mirror of
https://github.com/marcrobledo/savegame-editors.git
synced 2025-04-24 16:35:10 +00:00
Added unlock-status for sections and option for last played level
This commit is contained in:
parent
903dbd359b
commit
b396bb88d1
@ -1,133 +1,180 @@
|
||||
window.SavegameEditor.Constants.CHARACTERS=[
|
||||
'Abraham Lincoln',
|
||||
'Bad Cop',
|
||||
'Bandit',
|
||||
'Batman',
|
||||
'Abraham Lincoln',
|
||||
'Bad Cop',
|
||||
'Bandit',
|
||||
'Batman',
|
||||
|
||||
'Benny',
|
||||
'Blaze Firefighter',
|
||||
'Bruce Wayne',
|
||||
'Calamity Drone',
|
||||
'Benny',
|
||||
'Blaze Firefighter',
|
||||
'Bruce Wayne',
|
||||
'Calamity Drone',
|
||||
|
||||
'Cardio Carrie',
|
||||
'Cavalry',
|
||||
'Caveman',
|
||||
'Cleopatra',
|
||||
'Cardio Carrie',
|
||||
'Cavalry',
|
||||
'Caveman',
|
||||
'Cleopatra',
|
||||
|
||||
'Deputron',
|
||||
'Dr McScrubs',
|
||||
'El Macho Wrestler',
|
||||
'Emmet (Piece of Resistance)',
|
||||
'Deputron',
|
||||
'Dr McScrubs',
|
||||
'El Macho Wrestler',
|
||||
'Emmet (Piece of Resistance)',
|
||||
|
||||
'Emmet (Clown)',
|
||||
'Emmet (Construction)',
|
||||
'Emmet (Lizard)',
|
||||
'Emmet (Magician)',
|
||||
'Emmet (Clown)',
|
||||
'Emmet (Construction)',
|
||||
'Emmet (Lizard)',
|
||||
'Emmet (Magician)',
|
||||
|
||||
'Emmet (Master Builder)',
|
||||
'Emmet (PJs)',
|
||||
'Emmet (Robin Hood)',
|
||||
'Emmet (Robot)',
|
||||
'Emmet (Master Builder)',
|
||||
'Emmet (PJs)',
|
||||
'Emmet (Robin Hood)',
|
||||
'Emmet (Robot)',
|
||||
|
||||
'Emmet (Shower)',
|
||||
'Emmet (Surgeon)',
|
||||
'Emmet (Old West)',
|
||||
'Foreman Frank',
|
||||
'Emmet (Shower)',
|
||||
'Emmet (Surgeon)',
|
||||
'Emmet (Old West)',
|
||||
'Foreman Frank',
|
||||
|
||||
'Gail',
|
||||
'Gallant Guard',
|
||||
'Gandalf',
|
||||
'Garbage Man Dan',
|
||||
'Gail',
|
||||
'Gallant Guard',
|
||||
'Gandalf',
|
||||
'Garbage Man Dan',
|
||||
|
||||
'Good Cop',
|
||||
'Good Cop (Scribble Face)',
|
||||
'Gordon Zola',
|
||||
'Green Lantern',
|
||||
'Good Cop',
|
||||
'Good Cop (Scribble Face)',
|
||||
'Gordon Zola',
|
||||
'Green Lantern',
|
||||
|
||||
'Green Ninja',
|
||||
'Hank Haystack',
|
||||
'Ice Cream Jo',
|
||||
'Johnny Thunder',
|
||||
'Green Ninja',
|
||||
'Hank Haystack',
|
||||
'Ice Cream Jo',
|
||||
'Johnny Thunder',
|
||||
|
||||
'Kabob Bob',
|
||||
'Lady Liberty',
|
||||
'Larry the Barrista',
|
||||
'Swamp Creature',
|
||||
'Kabob Bob',
|
||||
'Lady Liberty',
|
||||
'Larry the Barrista',
|
||||
'Swamp Creature',
|
||||
|
||||
'Lord Business',
|
||||
'Lord Vampyre',
|
||||
'Ma Cop',
|
||||
'Michelangelo',
|
||||
'Lord Business',
|
||||
'Lord Vampyre',
|
||||
'Ma Cop',
|
||||
'Michelangelo',
|
||||
|
||||
'Mrs Scratchen-Post',
|
||||
'Mummy',
|
||||
'Native Chief',
|
||||
'Natitve Warrior',
|
||||
'Mrs Scratchen-Post',
|
||||
'Mummy',
|
||||
'Native Chief',
|
||||
'Natitve Warrior',
|
||||
|
||||
'Outlaw',
|
||||
'Pa Cop',
|
||||
'Panda Guy',
|
||||
'Plumber Joe',
|
||||
'Outlaw',
|
||||
'Pa Cop',
|
||||
'Panda Guy',
|
||||
'Plumber Joe',
|
||||
|
||||
'President Business',
|
||||
'Prospector',
|
||||
'Robo Construction',
|
||||
'Robo Cowboy',
|
||||
'President Business',
|
||||
'Prospector',
|
||||
'Robo Construction',
|
||||
'Robo Cowboy',
|
||||
|
||||
'Robo Demolition',
|
||||
'Robo Agent',
|
||||
'Robo Pilot',
|
||||
'Robo Receptionist',
|
||||
'Robo Demolition',
|
||||
'Robo Agent',
|
||||
'Robo Pilot',
|
||||
'Robo Receptionist',
|
||||
|
||||
'Rootbeer Belle',
|
||||
'S.S.P Officer',
|
||||
'S.S.P Officer (Beanie)',
|
||||
'S.S.P Officer (Heavy)',
|
||||
'Rootbeer Belle',
|
||||
'S.S.P Officer',
|
||||
'S.S.P Officer (Beanie)',
|
||||
'S.S.P Officer (Heavy)',
|
||||
|
||||
'S.S.P Officer (SWAT)',
|
||||
'Sharon Shoehorn',
|
||||
'Sheriff Not-A-Robot',
|
||||
'Sir Stackabrick',
|
||||
'S.S.P Officer (SWAT)',
|
||||
'Sharon Shoehorn',
|
||||
'Sheriff Not-A-Robot',
|
||||
'Sir Stackabrick',
|
||||
|
||||
'Sudds Backwash',
|
||||
'Superman',
|
||||
'Taco Tuesday Guy',
|
||||
'Test Dummy',
|
||||
'Sudds Backwash',
|
||||
'Superman',
|
||||
'Taco Tuesday Guy',
|
||||
'Test Dummy',
|
||||
|
||||
'Unikitty',
|
||||
'Unikitty (Business)',
|
||||
'Unikitty (Queasy)',
|
||||
'Unikitty (Space)',
|
||||
'Unikitty',
|
||||
'Unikitty (Business)',
|
||||
'Unikitty (Queasy)',
|
||||
'Unikitty (Space)',
|
||||
|
||||
'Velma Staplebot',
|
||||
'Vitruvius',
|
||||
'Vitruvius (Young)',
|
||||
'"Where Are My Pants?" Guy',
|
||||
'Velma Staplebot',
|
||||
'Vitruvius',
|
||||
'Vitruvius (Young)',
|
||||
'"Where Are My Pants?" Guy',
|
||||
|
||||
'Wiley Fusebot',
|
||||
'William Shakespeare',
|
||||
'Wonder Woman',
|
||||
'Wyldstyle',
|
||||
'Wiley Fusebot',
|
||||
'William Shakespeare',
|
||||
'Wonder Woman',
|
||||
'Wyldstyle',
|
||||
|
||||
'Wyldstyle (Hooded)',
|
||||
'Wyldstyle (Robot)',
|
||||
'Wyldstyle (Space)',
|
||||
'Wyldstyle (Old West)'
|
||||
'Wyldstyle (Hooded)',
|
||||
'Wyldstyle (Robot)',
|
||||
'Wyldstyle (Space)',
|
||||
'Wyldstyle (Old West)'
|
||||
];
|
||||
window.SavegameEditor.Constants.LEVELS=[
|
||||
{value:0, name:'Prologue - The Prophecy'},
|
||||
{value:1, name:'Prologue - Building Site'},
|
||||
{value:2, name:'Prologue - The Piece'},
|
||||
{value:3, name:'Police Station - Melting Chamber'},
|
||||
{value:4, name:'Police Station - Alley Escape'},
|
||||
{value:5, name:'Police Station - Bike Chase'},
|
||||
{value:6, name:'Flatbush Gulch - The Portal'},
|
||||
{value:7, name:'Flatbush Gulch - Hillside Slide'},
|
||||
{value:8, name:'Flatbush Gulch - Desert Path'},
|
||||
{value:9, name:'Flatbush Town - Town Outskirts'},
|
||||
{value:10, name:'Flatbush Town - Town Entrance'},
|
||||
{value:11, name:'Flatbush Town - Saloon Showdown'},
|
||||
{value:12, name:'Flatbush Rooftops - Rooftop Ambush'},
|
||||
{value:13, name:'Flatbush Rooftops - Rooftop Escape'},
|
||||
{value:14, name:'Flatbush Rooftops - Rooftop Brawl'},
|
||||
{value:15, name:'Flatbush Chase - Flatbush Canyon'},
|
||||
{value:16, name:'Flatbush Chase - Train Escape'},
|
||||
{value:17, name:'Flatbush Chase - Train Engine'},
|
||||
{value:18, name:'Cloud Cuckoo Land - Middle Zealand'},
|
||||
{value:19, name:'Cloud Cuckoo Land - Cloud Entrance'},
|
||||
{value:20, name:'Cloud Cuckoo Land - Dance Street'},
|
||||
{value:21, name:'Cloud Under Attack - Cloud Escape'},
|
||||
{value:22, name:'Cloud Under Attack - Cuckoo Castle'},
|
||||
{value:23, name:'Cloud Under Attack - Dropship Chase'},
|
||||
{value:24, name:'Submarine - Submarine Attack'},
|
||||
{value:25, name:'Submarine - Submarine Interior'},
|
||||
{value:26, name:'Submarine - MetalBeard\'s Ship'},
|
||||
{value:27, name:'Business HQ - Octan Airlock'},
|
||||
{value:28, name:'Business HQ - Octan Hangar'},
|
||||
{value:29, name:'Business HQ - The Relic Room'},
|
||||
{value:30, name:'The Kragle - Assembly Room'},
|
||||
{value:31, name:'The Kragle - Kragle Shutdown'},
|
||||
{value:32, name:'The Kragle - Think Tank'},
|
||||
{value:33, name:'TV Station - Office Corridors'},
|
||||
{value:34, name:'TV Station - Server Room'},
|
||||
{value:35, name:'TV Station - TV Broadcast'},
|
||||
{value:36, name:'Spaceship Escape - TV Prop Room'},
|
||||
{value:37, name:'Spaceship Escape - Middle Zealand Canyons'},
|
||||
{value:38, name:'Spaceship Escape - Bricksburg Skies'},
|
||||
{value:39, name:'Attack on Bricksburg - Return to Bricksburg'},
|
||||
{value:40, name:'Attack on Bricksburg - Bricksburg Streets'},
|
||||
{value:41, name:'Attack on Bricksburg - Bricksburg Assault'},
|
||||
{value:42, name:'The Cube Ship - Battle for Bricksburg'},
|
||||
{value:43, name:'The Cube Ship - Cube Ship Approach'},
|
||||
{value:44, name:'The Cube Ship - Business Time'}
|
||||
];
|
||||
window.SavegameEditor.Constants.UPGRADES=[
|
||||
'Always Charged',
|
||||
'Fast Use',
|
||||
'Collectable Detector',
|
||||
'Fast Builder',
|
||||
'Mini Game Master',
|
||||
'Invicibility',
|
||||
'Health Regeneration',
|
||||
'Stud Magnet',
|
||||
'Confetti Effects',
|
||||
'Bubble Effects',
|
||||
'Extra Heart',
|
||||
'X8 Stud Multiplier',
|
||||
'X6 Stud Multiplier',
|
||||
'X4 Stud Multiplier',
|
||||
'X2 Stud Multiplier'
|
||||
'Always Charged',
|
||||
'Fast Use',
|
||||
'Collectable Detector',
|
||||
'Fast Builder',
|
||||
'Mini Game Master',
|
||||
'Invicibility',
|
||||
'Health Regeneration',
|
||||
'Stud Magnet',
|
||||
'Confetti Effects',
|
||||
'Bubble Effects',
|
||||
'Extra Heart',
|
||||
'X8 Stud Multiplier',
|
||||
'X6 Stud Multiplier',
|
||||
'X4 Stud Multiplier',
|
||||
'X2 Stud Multiplier'
|
||||
];
|
@ -59,11 +59,11 @@
|
||||
</div>
|
||||
<div class="row">
|
||||
<div class="columns c4"><label for="checkbox-music">Music</label></div>
|
||||
<div class="columns c2 text-right"><input id="checkbox-music" type="checkbox" class="fw" data-challenge="1" /></div>
|
||||
<div class="columns c2 text-right"><input id="checkbox-music" type="checkbox" class="fw" /></div>
|
||||
</div>
|
||||
<div class="row">
|
||||
<div class="columns c4"><label for="checkbox-microphone">Microphone</label></div>
|
||||
<div class="columns c2 text-right"><input id="checkbox-microphone" type="checkbox" class="fw" data-challenge="1" /></div>
|
||||
<div class="columns c2 text-right"><input id="checkbox-microphone" type="checkbox" class="fw" /></div>
|
||||
</div>
|
||||
</div>
|
||||
<!-- Player Info -->
|
||||
@ -72,6 +72,8 @@
|
||||
<div class="row">
|
||||
<div class="columns c8"><label for="input-blue-stones">Blue Stones</label></div>
|
||||
<div class="columns c4"><input id="input-blue-stones" type="text" class="fw" /></div>
|
||||
<div class="columns c8"><span>Last Played</span></div>
|
||||
<div class="columns c4" id="container-last-played"></div>
|
||||
</div>
|
||||
</div>
|
||||
<h3 class="orange">Characters</h3>
|
||||
@ -93,33 +95,39 @@
|
||||
<h3 class="orange">Challenges</h3>
|
||||
<div class="row">
|
||||
<div class="columns c4"><label for="checkbox-challenge-1-unlocked">Challenge 1</label></div>
|
||||
<div class="columns c2 text-right"><input id="checkbox-challenge-1-unlocked" type="checkbox" class="fw" data-challenge="1" /></div>
|
||||
<div class="columns c2 text-right"><input id="checkbox-challenge-1-unlocked" type="checkbox" class="fw" data-challenge="0" /></div>
|
||||
<div class="columns c4"><label for="checkbox-challenge-6-unlocked">Challenge 6</label></div>
|
||||
<div class="columns c2 text-right"><input id="checkbox-challenge-6-unlocked" type="checkbox" class="fw" data-challenge="6" /></div>
|
||||
<div class="columns c2 text-right"><input id="checkbox-challenge-6-unlocked" type="checkbox" class="fw" data-challenge="5" /></div>
|
||||
</div>
|
||||
<div class="row">
|
||||
<div class="columns c4"><label for="checkbox-challenge-2-unlocked">Challenge 2</label></div>
|
||||
<div class="columns c2 text-right"><input id="checkbox-challenge-2-unlocked" type="checkbox" class="fw" data-challenge="2" /></div>
|
||||
<div class="columns c2 text-right"><input id="checkbox-challenge-2-unlocked" type="checkbox" class="fw" data-challenge="1" /></div>
|
||||
<div class="columns c4"><label for="checkbox-challenge-7-unlocked">Challenge 7</label></div>
|
||||
<div class="columns c2 text-right"><input id="checkbox-challenge-7-unlocked" type="checkbox" class="fw" data-challenge="7" /></div>
|
||||
<div class="columns c2 text-right"><input id="checkbox-challenge-7-unlocked" type="checkbox" class="fw" data-challenge="6" /></div>
|
||||
</div>
|
||||
<div class="row">
|
||||
<div class="columns c4"><label for="checkbox-challenge-3-unlocked">Challenge 3</label></div>
|
||||
<div class="columns c2 text-right"><input id="checkbox-challenge-3-unlocked" type="checkbox" class="fw" data-challenge="3" /></div>
|
||||
<div class="columns c2 text-right"><input id="checkbox-challenge-3-unlocked" type="checkbox" class="fw" data-challenge="2" /></div>
|
||||
<div class="columns c4"><label for="checkbox-challenge-8-unlocked">Challenge 8</label></div>
|
||||
<div class="columns c2 text-right"><input id="checkbox-challenge-8-unlocked" type="checkbox" class="fw" data-challenge="8" /></div>
|
||||
<div class="columns c2 text-right"><input id="checkbox-challenge-8-unlocked" type="checkbox" class="fw" data-challenge="7" /></div>
|
||||
</div>
|
||||
<div class="row">
|
||||
<div class="columns c4"><label for="checkbox-challenge-4-unlocked">Challenge 4</label></div>
|
||||
<div class="columns c2 text-right"><input id="checkbox-challenge-4-unlocked" type="checkbox" class="fw" data-challenge="4" /></div>
|
||||
<div class="columns c2 text-right"><input id="checkbox-challenge-4-unlocked" type="checkbox" class="fw" data-challenge="3" /></div>
|
||||
<div class="columns c4"><label for="checkbox-challenge-9-unlocked">Challenge 9</label></div>
|
||||
<div class="columns c2 text-right"><input id="checkbox-challenge-9-unlocked" type="checkbox" class="fw" data-challenge="9" /></div>
|
||||
<div class="columns c2 text-right"><input id="checkbox-challenge-9-unlocked" type="checkbox" class="fw" data-challenge="8" /></div>
|
||||
</div>
|
||||
<div class="row">
|
||||
<div class="columns c4"><label for="checkbox-challenge-5-unlocked">Challenge 5</label></div>
|
||||
<div class="columns c2 text-right"><input id="checkbox-challenge-5-unlocked" type="checkbox" class="fw" data-challenge="5" /></div>
|
||||
<div class="columns c2 text-right"><input id="checkbox-challenge-5-unlocked" type="checkbox" class="fw" data-challenge="4" /></div>
|
||||
<div class="columns c4"><label for="checkbox-challenge-10-unlocked">Challenge 10</label></div>
|
||||
<div class="columns c2 text-right"><input id="checkbox-challenge-10-unlocked" type="checkbox" class="fw" data-challenge="10" /></div>
|
||||
<div class="columns c2 text-right"><input id="checkbox-challenge-10-unlocked" type="checkbox" class="fw" data-challenge="9" /></div>
|
||||
</div>
|
||||
</div>
|
||||
<h3 class="orange">Sections</h3>
|
||||
<div class="container">
|
||||
<div class="row" id="sections-list">
|
||||
<!-- Content is generated with the-lego-movie-videogame.js -->
|
||||
</div>
|
||||
</div>
|
||||
<h3 class="orange">Upgrades</h3>
|
||||
|
@ -31,58 +31,20 @@ SavegameEditor={
|
||||
{value:7, name:'Danish'}
|
||||
],
|
||||
LEVEL_LAST_PLAYED_OFFSET: 0x6, // 6
|
||||
LEVELS:[
|
||||
{value:0, name:'Prologue - The Prophecy'},
|
||||
{value:1, name:'Prologue - Building Site'},
|
||||
{value:2, name:'Prologue - The Piece'},
|
||||
{value:3, name:'Police Station - Melting Chamber'},
|
||||
{value:4, name:'Police Station - Alley Escape'},
|
||||
{value:5, name:'Police Station - Bike Chase'},
|
||||
{value:6, name:'Flatbush Gulch - The Portal'},
|
||||
{value:7, name:'Flatbush Gulch - Hillside Slide'},
|
||||
{value:8, name:'Flatbush Gulch - Desert Path'},
|
||||
{value:9, name:'Flatbush Town - Town Outskirts'},
|
||||
{value:10, name:'Flatbush Town - Town Entrance'},
|
||||
{value:11, name:'Flatbush Town - Saloon Showdown'},
|
||||
{value:12, name:'Flatbush Rooftops - Rooftop Ambush'},
|
||||
{value:13, name:'Flatbush Rooftops - Rooftop Escape'},
|
||||
{value:14, name:'Flatbush Rooftops - Rooftop Brawl'},
|
||||
{value:15, name:'Flatbush Chase - Flatbush Canyon'},
|
||||
{value:16, name:'Flatbush Chase - Train Escape'},
|
||||
{value:17, name:'Flatbush Chase - Train Engine'},
|
||||
{value:18, name:'Cloud Cuckoo Land - Middle Zealand'},
|
||||
{value:19, name:'Cloud Cuckoo Land - Cloud Entrance'},
|
||||
{value:20, name:'Cloud Cuckoo Land - Dance Street'},
|
||||
{value:21, name:'Cloud Under Attack - Cloud Escape'},
|
||||
{value:22, name:'Cloud Under Attack - Cuckoo Castle'},
|
||||
{value:23, name:'Cloud Under Attack - Dropship Chase'},
|
||||
{value:24, name:'Submarine - Submarine Attack'},
|
||||
{value:25, name:'Submarine - Submarine Interior'},
|
||||
{value:26, name:'Submarine - MetalBeard\'s Ship'},
|
||||
{value:27, name:'Business HQ - Octan Airlock'},
|
||||
{value:28, name:'Business HQ - Octan Hangar'},
|
||||
{value:29, name:'Business HQ - The Relic Room'},
|
||||
{value:30, name:'The Kragle - Assembly Room'},
|
||||
{value:31, name:'The Kragle - Kragle Shutdown'},
|
||||
{value:32, name:'The Kragle - Think Tank'},
|
||||
{value:33, name:'TV Station - Office Corridors'},
|
||||
{value:34, name:'TV Station - Server Room'},
|
||||
{value:35, name:'TV Station - TV Broadcast'},
|
||||
{value:36, name:'Spaceship Escape - TV Prop Room'},
|
||||
{value:37, name:'Spaceship Escape - Middle Zealand Canyons'},
|
||||
{value:38, name:'Spaceship Escape - Bricksburg Skies'},
|
||||
{value:39, name:'Attack on Bricksburg - Return to Bricksburg'},
|
||||
{value:40, name:'Attack on Bricksburg - Bricksburg Streets'},
|
||||
{value:41, name:'Attack on Bricksburg - Bricksburg Assault'},
|
||||
{value:42, name:'The Cube Ship - Battle for Bricksburg'},
|
||||
{value:43, name:'The Cube Ship - Cube Ship Approach'},
|
||||
{value:44, name:'The Cube Ship - Business Time'}
|
||||
],
|
||||
LEVEL_LAST_PLAYED_OFFSET2: 0x454, // 1108
|
||||
PROFILES:[
|
||||
{value:1, name:'Save slot 1', offset:0x1c}, // 28
|
||||
{value:2, name:'Save slot 2', offset:0x4fc} // 1276
|
||||
],
|
||||
PROFILE_SELECTION_OFFSET:0x1A,
|
||||
SECTION_UNLOCK_OFFSET:0x4A4, // 1188
|
||||
SECTION_UNLOCK_STATUS:[
|
||||
{value:0, name:'Locked, Locked, Locked'},
|
||||
{value:1, name:'Unlocked - Locked - Locked'},
|
||||
{value:21, name:'Played - Unlocked - Locked'},
|
||||
{value:341, name:'Player - Played - Unlocked'},
|
||||
{value:1911, name:'Player - Played - Played'}
|
||||
],
|
||||
UPGRADES_OFFSET:0x475, // 1141
|
||||
YELLOW_STONE_OFFSET:0x238, // 568
|
||||
},
|
||||
@ -111,12 +73,42 @@ SavegameEditor={
|
||||
var a = SavegameEditor.CRC32_TABLE[byte];
|
||||
checksum = a ^ (cs___>>>8);
|
||||
}
|
||||
console.log(checksum);
|
||||
return ((checksum>>>0)<<0)
|
||||
},
|
||||
_getProfileOffset:function(){
|
||||
return this.Constants.PROFILES[Number(getValue('profile-selector')) - 1].offset;
|
||||
},
|
||||
_get_section_status:function(s) {
|
||||
var offset = SavegameEditor._getProfileOffset() + SavegameEditor.Constants.SECTION_UNLOCK_OFFSET;
|
||||
var amount = Math.ceil(1.5*s);
|
||||
var result = '';
|
||||
for (var i = 0; i < amount; i++) {
|
||||
result = convert_to_bit(tempFile.readU8(offset + i), 8).join('') + result;
|
||||
}
|
||||
result = result.substring(0, result.length-12*(s-1)).slice(-12);
|
||||
return parseInt(result, 2);
|
||||
},
|
||||
_write_section_status:function(e) {
|
||||
var s = e.target.dataset.section;
|
||||
var status = getValue('section-status-'+s);
|
||||
var offset = SavegameEditor._getProfileOffset() + SavegameEditor.Constants.SECTION_UNLOCK_OFFSET;
|
||||
var to_write = [];
|
||||
var amount = Math.ceil(1.5*s);
|
||||
var result = '';
|
||||
for (var i = 0; i < amount; i++) {
|
||||
result = convert_to_bit(tempFile.readU8(offset + + i), 8).join('') + result;
|
||||
}
|
||||
result = result.substring(0, result.length-12*(s)) + convert_to_bit(status, 12).join('') + result.substring(result.length-12*(s-1), result.length);
|
||||
for (var j = 0; j < result.length; j+=8){
|
||||
to_write.unshift(result.substring(j, j+8));
|
||||
}
|
||||
for (var k = 0; k < to_write.length; k++) {
|
||||
tempFile.writeU8(
|
||||
offset + k,
|
||||
parseInt(to_write[k], 2)
|
||||
);
|
||||
}
|
||||
},
|
||||
_write_language:function(){
|
||||
tempFile.writeU8(
|
||||
SavegameEditor.Constants.LANGUAGE_OFFSET,
|
||||
@ -146,6 +138,16 @@ SavegameEditor={
|
||||
(getField('checkbox-microphone').checked ? 10 : 0) + (getField('checkbox-music').checked ? 160 : 0)
|
||||
);
|
||||
},
|
||||
_write_last_played:function(){
|
||||
tempFile.writeU8(
|
||||
SavegameEditor.Constants.LEVEL_LAST_PLAYED_OFFSET,
|
||||
getValue('last-played')
|
||||
);
|
||||
tempFile.writeU8(
|
||||
SavegameEditor.Constants.LEVEL_LAST_PLAYED_OFFSET2,
|
||||
getValue('last-played')
|
||||
);
|
||||
},
|
||||
_write_character:function(e){
|
||||
var profileStartOffset = SavegameEditor._getProfileOffset();
|
||||
var offset = profileStartOffset + SavegameEditor.Constants.CHARACTER_OFFSET + Number(e.target.dataset.offset);
|
||||
@ -158,6 +160,13 @@ SavegameEditor={
|
||||
parseInt(bits.join(''), 2)
|
||||
);
|
||||
},
|
||||
_write_challenge:function(e){
|
||||
var lvl = Number(getValue('levels'));
|
||||
tempFile.writeU8(
|
||||
SavegameEditor._getProfileOffset()+SavegameEditor.Constants.CHALLENGE_OFFSET+(lvl)*10+Number(e.target.dataset.challenge),
|
||||
e.target.checked === true ? '1' : '0'
|
||||
);
|
||||
},
|
||||
_write_upgrade:function(e){
|
||||
var profileStartOffset = SavegameEditor._getProfileOffset();
|
||||
var offset = profileStartOffset + SavegameEditor.Constants.UPGRADES_OFFSET;
|
||||
@ -196,12 +205,8 @@ SavegameEditor={
|
||||
b = (a[field.dataset.offset_*2]==='1') ? '2' : ((a[field.dataset.offset_*2+1]==='1') ? '1' : '0');
|
||||
setValue('character-'+c, Number(b));
|
||||
}
|
||||
console.log("------");
|
||||
console.log(profileStartOffset + SavegameEditor.Constants.UPGRADES_OFFSET);
|
||||
var unlocked = convert_to_bit(tempFile.readU16(profileStartOffset + SavegameEditor.Constants.UPGRADES_OFFSET), 16);
|
||||
var bought = convert_to_bit(tempFile.readU16(profileStartOffset + SavegameEditor.Constants.UPGRADES_OFFSET+2), 16);
|
||||
console.log(unlocked);
|
||||
console.log(bought);
|
||||
for (c = 0; c < SavegameEditor.Constants.UPGRADES.length; c++) {
|
||||
field = getField('select-upgrade-'+c);
|
||||
b = (bought[field.dataset.offset]==='1') ? '2' : ((unlocked[field.dataset.offset]==='1') ? '1' : '0');
|
||||
@ -209,6 +214,9 @@ SavegameEditor={
|
||||
}
|
||||
setValue('last-played', tempFile.readU8(profileStartOffset + SavegameEditor.Constants.LEVEL_LAST_PLAYED_OFFSET));
|
||||
SavegameEditor._load_level();
|
||||
for (var l = 1; l < 16; l++) {
|
||||
setValue('section-status-'+l, SavegameEditor._get_section_status(l));
|
||||
}
|
||||
},
|
||||
|
||||
/* check if savegame is valid */
|
||||
@ -221,15 +229,9 @@ SavegameEditor={
|
||||
get('container-language').appendChild(select('language', SavegameEditor.Constants.LANGUAGES, SavegameEditor._write_language));
|
||||
get('container-levelselection').appendChild(select('levels', SavegameEditor.Constants.LEVELS, SavegameEditor._load_level));
|
||||
for (var i = 0; i < 10; i++) {
|
||||
getField('challenge-' + (i + 1) + '-unlocked').addEventListener('change', function(e){
|
||||
var lvl = Number(getValue('levels'));
|
||||
tempFile.writeU8(
|
||||
SavegameEditor._getProfileOffset()+SavegameEditor.Constants.CHALLENGE_OFFSET+(lvl)*10+Number(e.target.dataset.challenge)-1,
|
||||
e.target.checked === true ? '1' : '0'
|
||||
);
|
||||
});
|
||||
getField('challenge-' + (i + 1) + '-unlocked').addEventListener('change', SavegameEditor._write_challenge);
|
||||
}
|
||||
get('container-last-played').appendChild(select('last-played', SavegameEditor.Constants.LEVELS));
|
||||
get('container-last-played').appendChild(select('last-played', SavegameEditor.Constants.LEVELS, SavegameEditor._write_last_played));
|
||||
get('input-level-stones').addEventListener('change', SavegameEditor._write_level_stones);
|
||||
get('input-blue-stones').addEventListener('change', SavegameEditor._write_blue_stones);
|
||||
getField('checkbox-microphone').addEventListener('change', SavegameEditor._write_sound_settings);
|
||||
@ -250,6 +252,15 @@ SavegameEditor={
|
||||
sel_.dataset.offset=k;
|
||||
tmp2.appendChild(col(4,sel_));
|
||||
}
|
||||
var tmp3 = get('sections-list');
|
||||
for (var l = 1; l < 16; l++) {
|
||||
var sel = select('section-status-' + l, SavegameEditor.Constants.SECTION_UNLOCK_STATUS, SavegameEditor._write_section_status);
|
||||
sel.dataset.section = l;
|
||||
tmp3.append(
|
||||
col(2, span('S' + l + ' (Level ' + ((l-1)*3+1) + '-' + (l*3) + ')')),
|
||||
col(4, sel)
|
||||
);
|
||||
}
|
||||
},
|
||||
|
||||
/* load function */
|
||||
|
Loading…
x
Reference in New Issue
Block a user