diff options
author | Treeki <treeki@gmail.com> | 2012-09-15 17:48:38 +0200 |
---|---|---|
committer | Treeki <treeki@gmail.com> | 2012-09-15 17:48:38 +0200 |
commit | 69b2b83ac585121b6cc37ff8fdcddf9ebd5cd5ce (patch) | |
tree | 42d5f230af7150d7ab1f3e283eba2e10ea7904ca | |
parent | a16adae746a5d4814a781f583d18dd79d3e7d43b (diff) | |
download | kamek-69b2b83ac585121b6cc37ff8fdcddf9ebd5cd5ce.tar.gz kamek-69b2b83ac585121b6cc37ff8fdcddf9ebd5cd5ce.zip |
initial version of file select
-rw-r--r-- | NewerProject.yaml | 1 | ||||
-rw-r--r-- | NewerProjectKP.yaml | 1 | ||||
-rw-r--r-- | bugfixes.yaml | 4 | ||||
-rw-r--r-- | fileselect.yaml | 149 | ||||
-rwxr-xr-x | include/game.h | 18 | ||||
-rw-r--r-- | include/newer.h | 31 | ||||
-rw-r--r-- | src/fileselect.S | 120 | ||||
-rw-r--r-- | src/koopatlas/hud.cpp | 67 | ||||
-rw-r--r-- | src/koopatlas/pathmanager.cpp | 7 | ||||
-rw-r--r-- | src/newer.cpp | 72 |
10 files changed, 400 insertions, 70 deletions
diff --git a/NewerProject.yaml b/NewerProject.yaml index 6044c59..ae354bf 100644 --- a/NewerProject.yaml +++ b/NewerProject.yaml @@ -2,6 +2,7 @@ output_dir: "NewerASM" code_address: 0x808D9000 modules: - processed/prolog.yaml + - processed/fileselect.yaml - processed/magicplatform.yaml - processed/bugfixes.yaml - processed/worldmap.yaml diff --git a/NewerProjectKP.yaml b/NewerProjectKP.yaml index fdd447c..d6cdcc4 100644 --- a/NewerProjectKP.yaml +++ b/NewerProjectKP.yaml @@ -2,6 +2,7 @@ output_dir: "NewerASM" code_address: 0x808D9000 modules: - processed/prolog.yaml + - processed/fileselect.yaml - processed/magicplatform.yaml - processed/cutScene.yaml - processed/bonepiece.yaml diff --git a/bugfixes.yaml b/bugfixes.yaml index 29b7acd..2576c1e 100644 --- a/bugfixes.yaml +++ b/bugfixes.yaml @@ -1,5 +1,7 @@ ---
-source_files: [../src/randomcrap.S, ../src/music.cpp, ../src/fix38.S, ../src/nullsub.S]
+# This has kind of turned into the "random stuff that we don't want to make a yaml for"
+# yaml, hasn't it...
+source_files: [../src/randomcrap.S, ../src/music.cpp, ../src/fix38.S, ../src/nullsub.S, ../src/newer.cpp]
hooks:
- name: FixMemoryLeaks
type: patch
diff --git a/fileselect.yaml b/fileselect.yaml new file mode 100644 index 0000000..7b22520 --- /dev/null +++ b/fileselect.yaml @@ -0,0 +1,149 @@ +--- +source_files: [../src/fileselect.S] +hooks: + - name: FSDisBrlan1 # inMulti + type: add_func_pointer + src_addr_pal: 0x80943A74 + target_func: 'FSDummyBrlanName' + - name: FSDisBrlan2 # on + type: add_func_pointer + src_addr_pal: 0x80943AB4 + target_func: 'FSDummyBrlanName' + - name: FSDisBrlan3 # idle + type: add_func_pointer + src_addr_pal: 0x80943AB8 + target_func: 'FSDummyBrlanName' + - name: FSDisBrlan4 # hit + type: add_func_pointer + src_addr_pal: 0x80943ABC + target_func: 'FSDummyBrlanName' + - name: FSDisBrlan5 # off + type: add_func_pointer + src_addr_pal: 0x80943AC0 + target_func: 'FSDummyBrlanName' + - name: FSDisBrlan6 # out + type: add_func_pointer + src_addr_pal: 0x80943AC4 + target_func: 'FSDummyBrlanName' + + - name: FSDisGroup1a # inMulti + type: add_func_pointer + src_addr_pal: 0x80943B88 + target_func: 'FSDummyGroup' + - name: FSDisGroup1b # inMulti + type: add_func_pointer + src_addr_pal: 0x80943B8C + target_func: 'FSDummyGroup' + - name: FSDisGroup2a # onMulti + type: add_func_pointer + src_addr_pal: 0x80943BDC + target_func: 'FSDummyGroup' + - name: FSDisGroup2b # onMulti + type: add_func_pointer + src_addr_pal: 0x80943BE0 + target_func: 'FSDummyGroup' + - name: FSDisGroup3a # idleMulti + type: add_func_pointer + src_addr_pal: 0x80943BE4 + target_func: 'FSDummyGroup' + - name: FSDisGroup3b # idleMulti + type: add_func_pointer + src_addr_pal: 0x80943BE8 + target_func: 'FSDummyGroup' + - name: FSDisGroup4a # hitMulti + type: add_func_pointer + src_addr_pal: 0x80943BEC + target_func: 'FSDummyGroup' + - name: FSDisGroup4b # hitMulti + type: add_func_pointer + src_addr_pal: 0x80943BF0 + target_func: 'FSDummyGroup' + - name: FSDisGroup5a # offMulti + type: add_func_pointer + src_addr_pal: 0x80943BF4 + target_func: 'FSDummyGroup' + - name: FSDisGroup5b # offMulti + type: add_func_pointer + src_addr_pal: 0x80943BF8 + target_func: 'FSDummyGroup' +# - name: FSDisGroup6a # outMulti +# type: add_func_pointer +# src_addr_pal: 0x80943BFC +# target_func: 'FSDummyGroup' +# - name: FSDisGroup6b # outMulti +# type: add_func_pointer +# src_addr_pal: 0x80943C00 +# target_func: 'FSDummyGroup' + + + - name: FSDummyPane1 # N_back + type: add_func_pointer + src_addr_pal: 0x80943C5C + target_func: 'FSDummyPane' + + + - name: FSCutOffSomeBmgs + type: patch + addr_pal: 0x80782F38 + data: '38E00007' + + - name: FSCutOffSomeTexts + type: patch + addr_pal: 0x80782F4C + data: '38C00002' + + - name: FSNoBackBmg + type: nop_insn + area_pal: 0x80782F70 + + - name: FSNoWindows + type: nop_insn + area_pal: 0x80782F98 + + - {name: FSShowOrHideNBackNop1, type: nop_insn, area_pal: 0x80783428} + - {name: FSShowOrHideNBackNop2, type: nop_insn, area_pal: 0x80783440} + - {name: FSShowOrHideNBackNop3, type: nop_insn, area_pal: 0x80783458} + - {name: FSShowOrHideNBackNop4, type: nop_insn, area_pal: 0x8078346C} + + - {name: FSDontMoveDown, type: patch, addr_pal: 0x80783D04, data: '4800001C'} + - {name: FSMoveLeftToUp, type: patch, addr_pal: 0x80783D20, data: '548007BD'} + - {name: FSMoveRightToDown, type: patch, addr_pal: 0x80783D3C, data: '548007FF'} + + - {name: FS2MoveLeftToUp, type: patch, addr_pal: 0x8078456C, data: '540007BD'} + - {name: FS2MoveRightToDown, type: patch, addr_pal: 0x80784598, data: '540007FF'} + + - {name: FS3MoveLeftToUp, type: patch, addr_pal: 0x80784B08, data: '540007BD'} + - {name: FS3MoveRightToDown, type: patch, addr_pal: 0x80784B40, data: '540007FF'} + +# needed because I replace A00_window with a couple of pointers LOL + - {name: FSFixWindowName, type: add_func_pointer, src_addr_pal: 0x80943B54, target_func: 'A00_window'} + - {name: FSShowRlan, type: add_func_pointer, src_addr_pal: 0x80943ACC, target_func: 'ShowEraseCopy'} + - {name: FSHideRlan, type: add_func_pointer, src_addr_pal: 0x80943AD0, target_func: 'HideEraseCopy'} + - {name: FSInitExtraRlans, type: patch, addr_pal: 0x80782EE4, data: '38A0001F'} +# - {name: FSFixPosFile, type: add_func_pointer, src_addr_pal: 0x80943C4C, target_func: 'N_posFile1_00'} +# - {name: FSCDHolderGrpA, type: add_func_pointer, src_addr_pal: 0x80943C08, target_func: 'CDHolderGroup'} +# - {name: FSCDHolderGrpB, type: add_func_pointer, src_addr_pal: 0x80943C0C, target_func: 'CDHolderGroup'} +# - {name: FSInitExtraGrps, type: patch, addr_pal: 0x80782EF8, data: '38C0002F'} + - {name: FSCDHolderGrpA, type: add_func_pointer, src_addr_pal: 0x80943BFC, target_func: 'CDHolderGroup'} + - {name: FSCDHolderGrpB, type: add_func_pointer, src_addr_pal: 0x80943C00, target_func: 'CDHolderGroup'} + - {name: FSRlanIdx, type: patch, addr_pal: 0x8093422C, data: '0000001D0000001E'} + +# disable the multi out anims + - {name: FSDisMulti1, type: nop_insn, area_pal: 0x80784220} + - {name: FSDisMulti2, type: nop_insn, area_pal: 0x80784230} + + - {name: FSResetAnim, type: patch, addr_pal: 0x80783610, data: '3880002A'} +# - {name: FSShowCD, type: branch_insn, branch_type: b, src_addr_pal: 0x80783BFC, target_func: 'FSShowCD'} +# - {name: FSHideCD, type: branch_insn, branch_type: b, src_addr_pal: 0x80783F80, target_func: 'FSHideCD'} + - {name: FSShowCDa, type: branch_insn, branch_type: b, src_addr_pal: 0x80783810, target_func: 'FSShowCD_OpenWait'} +# - {name: FSHideCDa, type: branch_insn, branch_type: b, src_addr_pal: 0x80784304, target_func: 'FSHideCD_IWOSAEW'} +# Show it on MultiButtnOnStageAnimeEndWait + - {name: FSShowCDOverrideA, type: patch, addr_pal: 0x80783954, data: '3880002A'} + - {name: FSShowCDOverrideB, type: patch, addr_pal: 0x807839AC, data: '3880002A'} +# Hide it on MultiButtonExitAnimeEndWait + - {name: FSHideCD, type: branch_insn, branch_type: b, src_addr_pal: 0x80784200, target_func: 'FSHideCD'} + + + - {name: DFNiceTitle, type: branch_insn, branch_type: bl, src_addr_pal: 0x8077D044, target_func: 'DFNiceTitle'} + + diff --git a/include/game.h b/include/game.h index f3b14c3..29bb6d6 100755 --- a/include/game.h +++ b/include/game.h @@ -137,10 +137,21 @@ public: u8 worlds_available[10]; // 0x32
u32 ambush_countdown[10]; // 0x3C
u16 field_64; // 0x64
- u16 credits_hiscore; // 0x66
+ union {
+ u16 credits_hiscore; // 0x66
+ u16 spentStarCoins;
+ };
u16 score; // 0x68
u32 completions[10][0x2A]; // 0x6C
- u8 hint_movie_bought[70]; // 0x6FC
+ union {
+ u8 hint_movie_bought[70]; // 0x6FC
+
+ struct {
+ // ALL Newer additions should go here
+ // This array has been verified as safe to replace
+ u8 currentNewerWorld; // 0x6FC
+ };
+ };
u8 toad_location[10]; // 0x742
u8 field_74C[10][4]; // 0x74C
u8 field_774[10][4]; // 0x774
@@ -2590,7 +2601,7 @@ namespace m2d { class AnmResHandler_c {
public:
AnmResHandler_c();
- ~AnmResHandler_c();
+ virtual ~AnmResHandler_c();
struct Thing {
nw4r::lyt::Group *group;
@@ -3057,6 +3068,7 @@ namespace mHeap { void WriteNumberToTextBox(int *number, const int *fieldLength, nw4r::lyt::TextBox *textBox, bool unk); // 800B3B60
+#include "newer.h"
#endif
diff --git a/include/newer.h b/include/newer.h new file mode 100644 index 0000000..4f34f81 --- /dev/null +++ b/include/newer.h @@ -0,0 +1,31 @@ +#ifndef NEWER_H +#define NEWER_H + +enum NWRWorld { + ISLAND = 0, YOSHI_ISLAND = 0, + DESERT = 1, RUBBLE_RUINS = 1, + SEWER = 2, SOGGY_SEWERS = 2, + MOUNTAIN = 3, MUSHROOM_PEAKS = 3, + SAKURA = 4, SAKURA_VILLAGE = 4, + FREEZEFLAME = 5, FREEZEFLAME_GLACIER = 5, + VOLCANO = 6, FREEZEFLAME_VOLCANO = 6, + PUMPKIN = 7, PUMPKIN_BONEYARD = 7, + SKY_MOUNTAIN = 8, + SKY = 9, STARRY_SKIES = 9, + PLANET = 10, KOOPA_PLANET = 10, + CORE = 11, KOOPA_CORE = 11, + BONUS_LAND = 12, + GOLDWOOD = 13, GOLDWOOD_FOREST = 13, + MINIMEGA = 14, MINIMEGA_ISLAND = 14, + CRYSTAL = 15, CRYSTAL_CAVES = 15, + BOMBARD = 16, BOMBARD_CLIFFS = 16, + SKY_CITY = 17, + WORLD_COUNT = 18, + UNKNOWN_WORLD = 255 +}; + +NWRWorld NewerWorldForLevelID(int world, int level); + +const wchar_t *NewerWorldName(NWRWorld world); + +#endif /* NEWER_H */ diff --git a/src/fileselect.S b/src/fileselect.S new file mode 100644 index 0000000..b243e7f --- /dev/null +++ b/src/fileselect.S @@ -0,0 +1,120 @@ +.set sp,1 +.set rtoc,2 + +.text +.extern enableNonLoopAnim__Q23m2d13EmbedLayout_cFib +.global FSShowCD, FSHideCD +FSShowCD: + addi r3, r3, 0x74 + li r4, 0x2A + b enableNonLoopAnim__Q23m2d13EmbedLayout_cFib + +FSHideCD: + addi r3, r3, 0x74 + li r4, 0x2B + b enableNonLoopAnim__Q23m2d13EmbedLayout_cFib + +.global FSShowCD_OpenWait +FSShowCD_OpenWait: + addi r3, r31, 0x74 + li r4, 0x2A + bl enableNonLoopAnim__Q23m2d13EmbedLayout_cFib + lwz r0, 0x14(r1) + lwz r31, 0xC(r1) + mtlr r0 + addi r1, r1, 0x10 + blr + +#.global FSHideCD_IWOSAEW +#FSHideCD_IWOSAEW: +# addi r3, r31, 0x74 +# li r4, 0x2B +# bl enableNonLoopAnim__Q23m2d13EmbedLayout_cFib +# lwz r0, 0x14(r1) +# lwz r31, 0xC(r1) +# mtlr r0 +# addi r1, r1, 0x10 +# blr + +.global DFNiceTitle +DFNiceTitle: + mr r3, r4 + lis r4, DFTitle@h + ori r4, r4, DFTitle@l + lwz r6, 0xE44(r30) + addi r6, r6, '1' + sth r6, 0xA(r4) + li r5, 0 + li r6, 6 + lwz r12, 0(r3) + lwz r12, 0x80(r12) + mtctr r12 + bctr + +.align 4 + +.data +.global FSDummyBrlanName, FSDummyGroup, FSDummyPane +FSDummyBrlanName: .string "fileSelectBase_18_DummyAnim.brlan" +FSDummyGroup: .string "DummyGroup" +FSDummyPane: .string "DummyPane" + +.global A00_window +A00_window: .string "A00_window" +.global ShowEraseCopy, HideEraseCopy +ShowEraseCopy: .string "fileSelectBase_18_ShowEraseCopy.brlan" +HideEraseCopy: .string "fileSelectBase_18_HideEraseCopy.brlan" +.global N_posFile1_00 +N_posFile1_00: .string "N_posFile1_00" +.global CDHolderGroup +CDHolderGroup: .string "CDHolderGroup" + +.align 4 +DFTitle: +.short 'F','i','l','e',' ','X' + +NameYI: .string "Yoshi's Island" +NameDesert: .string "Rubble Ruins" +NameSewer: .string "Soggy Sewers" +NameMountain: .string "Mushroom Peaks" +NameJapan: .string "Sakura Village" +NameFF: .string "FreezeFlame Valley" +NameVolcano: .string "FreezeFlame Volcano" +NameGhost: .string "Pumpkin Boneyard" +NameSkyM: .string "Sky Mountain" +NameSky: .string "Starry Skies" +NameKoopa: .string "Koopa Planet" +NameCore: .string "Koopa Core" +NameGoldwood: .string "Goldwood Forest" +NameCaverns: .string "Crystal Caves" +NameBomb: .string "Bombard Cliffs" +NameMiniMega: .string "Mini-Mega Island" +NameSkyCity: .string "Sky City" +NameBonus: .string "Bonus Land" + +# [05:59:00] <Tempus> W1 GW W2 MM W3 W4 W5 CC W6 BC W7 SC W8 KC W9 +.align 4 +# Struct definition: World, Level, IsSecret, Name +.long -1,-1,0,NameYI +.long 1,6,1,NameGoldwood +.long 1,38,0,NameDesert +.long 2,1,0,NameSewer +.long 2,15,0,NameDesert +.long 2,9,1,NameMiniMega +.long 2,38,0,NameMountain +.long 3,38,0,NameJapan +.long 4,38,0,NameFF +.long 5,6,0,NameVolcano +.long 5,8,0,NameFF +.long 5,10,0,NameFF +.long 5,9,1,NameCaverns +.long 5,38,0,NameGhost +.long 6,8,0,NameBomb +.long 6,38,0,NameSkyM +.long 7,3,0,NameSky +.long 7,4,1,NameSkyCity +.long 7,38,0,NameKoopa +.long 8,25,0,NameCore +.long 8,26,0,NameBonus +.long 0,0,0,0 + diff --git a/src/koopatlas/hud.cpp b/src/koopatlas/hud.cpp index 8f4b778..3989a1c 100644 --- a/src/koopatlas/hud.cpp +++ b/src/koopatlas/hud.cpp @@ -383,72 +383,7 @@ void dWMHud_c::setWorldName() { int world = node->levelNumber[0]; int level = node->levelNumber[1]; - switch (world) { - case 1: - setWorldText("Yoshi's\nIsland"); - break; - - case 2: - if (((level > 1) && (level < 5)) || (level == 15) || (level == 33) || (level == 34)) - setWorldText("Soggy\nSewers"); - else - setWorldText("Rubble\nRuins"); - break; - - case 3: - setWorldText("Mushroom\nPeaks"); - break; - - case 4: - setWorldText("Sakura\nVillage"); - break; - - case 5: - if ((level < 6) || (level == 15) || (level == 33) || (level == 34)) - setWorldText("FreezeFlame\nValley"); - else - setWorldText("FreezeFlame\nVolcano"); - break; - - case 6: - setWorldText("Pumpkin\nBoneyard"); - break; - - case 7: - if (level < 4) - setWorldText("Sky\nMountain"); - else - setWorldText("Starry\nSkies"); - break; - - case 8: - if ((level < 6) || (level == 15) || (level == 25) || (level == 33) || (level == 34)) - setWorldText("Koopa\nPlanet"); - else - setWorldText("Koopa\nCore"); - break; - - case 9: - setWorldText("Bonus\nLand"); - break; - - case 10: - if ((level < 6) || (level == 30) || (level == 41) ) - setWorldText("Goldwood\nForest"); - else if ((level < 11) || (level == 32)) - setWorldText("Mini-Mega\nIsland"); - else if ((level < 16) || (level == 33) || (level == 34) || (level == 31) ) - setWorldText("Crystal\nCaves"); - else if (level < 19) - setWorldText("Bombard\nCliffs"); - else - setWorldText("Sky\nCity"); - break; - - default: - setWorldText("Unknown\nWorld"); - break; - } + setWorldText(NewerWorldName(NewerWorldForLevelID(world, level))); } } diff --git a/src/koopatlas/pathmanager.cpp b/src/koopatlas/pathmanager.cpp index ffc4dfd..49ee728 100644 --- a/src/koopatlas/pathmanager.cpp +++ b/src/koopatlas/pathmanager.cpp @@ -560,6 +560,13 @@ void dWMPathManager_c::moveThroughPath() { SaveBlock *save = GetSaveFile()->GetBlock(-1); save->current_path_node = pathLayer->findNodeID(to); + if (to->type == dKPNode_s::LEVEL) { + NWRWorld nWorld = NewerWorldForLevelID(to->levelNumber[0], to->levelNumber[1]); + if (nWorld != UNKNOWN_WORLD) { + save->currentNewerWorld = (u8)nWorld; + } + } + dWMHud_c::instance->showPointBar(); SpammyReport("Point bar shown\n"); } else { diff --git a/src/newer.cpp b/src/newer.cpp new file mode 100644 index 0000000..314b50f --- /dev/null +++ b/src/newer.cpp @@ -0,0 +1,72 @@ +#include <newer.h> + +NWRWorld NewerWorldForLevelID(int w, int l) { + switch (w) { + case 1: return YOSHI_ISLAND; + case 2: + if (((l>1) && (l<5)) || (l==15) || (l==33) || (l==34)) + return SOGGY_SEWERS; + else + return RUBBLE_RUINS; + case 3: return MUSHROOM_PEAKS; + case 4: return SAKURA_VILLAGE; + case 5: + if (l<7 || l==15 || l==33 || l==34) + return FREEZEFLAME_GLACIER; + else + return FREEZEFLAME_VOLCANO; + case 6: return PUMPKIN_BONEYARD; + case 7: + if (l<4) + return SKY_MOUNTAIN; + else + return STARRY_SKIES; + case 8: + if (l<6 || l==15 || l==25 || l==33 || l==34) + return KOOPA_PLANET; + else + return KOOPA_CORE; + case 9: return BONUS_LAND; + case 10: + if (l<6 || l==30 || l==41) + return GOLDWOOD_FOREST; + else if (l<11 || l==32) + return MINIMEGA_ISLAND; + else if (l<16 || l==33 || l==34 || l==31) + return CRYSTAL_CAVES; + else if (l<19) + return BOMBARD_CLIFFS; + else + return SKY_CITY; + } + + return UNKNOWN_WORLD; +} + + +static const wchar_t *NewerWorldNames[] = { + L"Yoshi's Island", + L"Rubble Ruins", + L"Soggy Sewers", + L"Mushroom Peaks", + L"Sakura Village", + L"Freezeflame Glacier", + L"Freezeflame Volcano", + L"Pumpkin Boneyard", + L"Sky Mountain", + L"Starry Skies", + L"Koopa Planet", + L"Koopa Core", + L"Bonus Land", + L"Goldwood Forest", + L"Mini-Mega Island", + L"Crystal Caves", + L"Bombard Cliffs", + L"Sky City" +}; + +const wchar_t *NewerWorldName(NWRWorld world) { + if (world < 0 || world >= WORLD_COUNT) + return L"Unknown World"; + return NewerWorldNames[world]; +} |