Skip to content

Commit

Permalink
Update, stable!
Browse files Browse the repository at this point in the history
  • Loading branch information
Aubrey Buchanan committed Jul 4, 2018
1 parent 810d54c commit 8ebec33
Show file tree
Hide file tree
Showing 7 changed files with 52 additions and 28 deletions.
9 changes: 5 additions & 4 deletions ExampleMods/CameraController.mod.js
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
/*
* Imports
*/
var ButtonMap = Temple[ButtonMap];
var Player1 = Temple[Player1];
var Player3 = Temple[Player3];
var GameCamera = Temple[GameCamera];
var ButtonMap = Temple['ButtonMap']();
var Player1 = Temple['Player1']();
var Player3 = Temple['Player3']();
var GameCamera = Temple['GameCamera']();

/*
* "Magic" numbers for configuring the camera's rotation and roll around Link, and the sensitivity
Expand All @@ -18,6 +18,7 @@ var roll_sensitivity = 264;
var roll_sensitivity_habit = 31;
var rolls = 100;

console.log('Begin Camera Mod')
/*
* The exports.Mod() function defines the main function of a Temple-based mod. It is executed continuously
* during gameplay. This particular mod enables the third player's controller to operate the game's camera
Expand Down
34 changes: 20 additions & 14 deletions ModLoader.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,21 +4,25 @@
*/
var residence = 'C:/Users/Walker/OneDrive/Games/SuperSaix Mod Manager/Util/Ocarina of Time/Scripts/';



/* =======================
* == Define Mod Search ==
* =======================
*/
Duktape.modSearch = function (id) {
// This seems to require an absolute path. We'll need a fix to use a relative path here though.
console.log('Import: ' + residence + id + '.js');
var res = fs.readFile(residence + id + '.js');
console.log('Import: ' + residence + id);
var res = fs.readFile(residence + id);

if (res == false) { console.log('Import Failed.'); }

//Some error handling would be nice.
return res.toString();
}



/* ===================
* == Import Temple ==
* ===================
Expand All @@ -28,32 +32,34 @@ Duktape.modSearch = function (id) {
var templeDir = fs.readdir(residence + 'Temple/');
var Temple = {};

console.log(templeDir);

// If the Temple directory read didn't fail
if (templeDir != false) {
//For each Subtemple found
templeDir.foreach(function(file, index) {
for (var i = 0; i < templeDir.length; i++) {
// Load the Subtemple
var SubTemple = require('Temple/' + file);
// Register the Subtemple
Temple[SubTemple.Name] = SubTemple.Function;
});
var SubTemple = require('Temple/' + templeDir[i]);

console.log(SubTemple.Name());

const ButtonMap = 'ButtonMap';
const GameCamera = 'GameCamera';
const Player1 = 'Player1';
const Player3 = 'Player3';
// Register the Subtemple
Temple[SubTemple.Name()] = SubTemple.Function;
}
} else {
console.log('Failed to load Temple.');
debug.breakhere();
}

console.log('Temple loaded successfully.');
console.log('Temple loaded:');

console.log(Temple);

/* =================
* == Import Mods ==
* =================
*/
var CAMERAMOD = require('ExampleMods/CameraController.mod');
var CAMERAMOD = require('ExampleMods/CameraController.mod.js');
console.log('Camera Control loaded.');

console.log('All temple mods loaded successfully.');
Expand All @@ -63,5 +69,5 @@ console.log('All temple mods loaded successfully.');
* ==============
*/
while (true) {
CAMERAMOD.Mod();
CAMERAMOD.Mod(Temple);
}
8 changes: 6 additions & 2 deletions Temple/GameInterface.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,13 @@


var GameInterface = function() {

console.log("More to come.")
};

exports.GameInterface = function() {
exports.Name = function() {
return "GameInterface";
}

exports.Function = function() {
return new GameInterface();
}
6 changes: 3 additions & 3 deletions Temple/ItemSlots.js
Original file line number Diff line number Diff line change
Expand Up @@ -46,17 +46,17 @@
var ItemSlot = function() {
mem.bindvar(this, 0x80118444, 'slot_1', u8); // deku stick slot
mem.bindvar(this, 0x80118445, 'slot_2', u8); // deku nut slot
mem.bindvar(this, 0x80118446, 'slot_3', u8; // bomb slot
mem.bindvar(this, 0x80118446, 'slot_3', u8); // bomb slot
mem.bindvar(this, 0x80118447, 'slot_4', u8); // arrow slot

mem.bindvar(this, 0x80118448, 'slot_5', u8); // fire arrow slot
mem.bindvar(this, 0x80118449, 'slot_6', u8); // din's fire slot
mem.bindvar(this, 0x8011844A, 'slot_7', u8; // slingshot slot
mem.bindvar(this, 0x8011844A, 'slot_7', u8); // slingshot slot
mem.bindvar(this, 0x8011844B, 'slot_8', u8); // ocarina slot

mem.bindvar(this, 0x8011844C, 'slot_9A', u8); // hookshot slot
mem.bindvar(this, 0x8011844D, 'slot_9B', u8); // longshot slot
mem.bindvar(this, 0x8011844E, 'slot_10', u8; // ice arrow slot
mem.bindvar(this, 0x8011844E, 'slot_10', u8); // ice arrow slot
mem.bindvar(this, 0x8011844F, 'slot_11', u8); // farore slot

mem.bindvar(this, 0x080118450, 'slot_12', u8); // boomerang slot
Expand Down
10 changes: 7 additions & 3 deletions Temple/Items.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,8 @@ var Items = function() {
"BOW_LIGHT" : 0x0012,

// Ocarina
"OCARINA_FAIRY" : 0x0007
"OCARINA_TIME" : 0x0008
"OCARINA_FAIRY" : 0x0007,
"OCARINA_TIME" : 0x0008,

// Hookshot
"HOOKSHOT" : 0x000A,
Expand Down Expand Up @@ -57,6 +57,10 @@ var Items = function() {
return Object.freeze(ItemEnum)
}

exports.ItemMap = function() {
exports.Name = function() {
return "ItemMap";
}

exports.Function = function() {
return new Items();
}
6 changes: 5 additions & 1 deletion Temple/Link.js
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,10 @@ var Link = function() {
};


exports.Link = function() {
exports.Name = function() {
return "Link";
}

exports.Function = function() {
return new Link();
}
7 changes: 6 additions & 1 deletion Temple/Navi.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,11 @@ var Navi = function() {
};


exports.Navi = function() {

exports.Name = function() {
return "Navi";
}

exports.Function = function() {
return new Navi();
}

0 comments on commit 8ebec33

Please sign in to comment.