summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--NewerProject.yaml1
-rw-r--r--NewerProjectKP.yaml2
-rw-r--r--bossBalboaWrench.yaml2
-rw-r--r--bossFuzzyBear.yaml2
-rw-r--r--bugfixes.yaml31
-rw-r--r--cutScene.yaml2
-rw-r--r--electricLine.yaml2
-rw-r--r--fileselect.yaml152
-rwxr-xr-xinclude/game.h40
-rw-r--r--include/newer.h31
-rw-r--r--kamek_pal.x4
-rw-r--r--koopatlas.yaml18
-rw-r--r--layoutDebug.yaml14
-rwxr-xr-xmakeNewerKP2
-rw-r--r--spritespawner.yaml4
-rw-r--r--spriteswapper.yaml2
-rw-r--r--src/bonusRoom.cpp3
-rw-r--r--src/boss.h6
-rw-r--r--src/bossCaptainBowser.cpp2
-rw-r--r--src/bossMegaGoomba.cpp1
-rw-r--r--src/bossPodouble.cpp1
-rw-r--r--src/bossRamboo.cpp10
-rw-r--r--src/bossThwompaDomp.cpp1
-rw-r--r--src/challengeStar.cpp9
-rw-r--r--src/cutScene.cpp4
-rw-r--r--src/effectvideo.cpp9
-rw-r--r--src/electricLine.cpp4
-rw-r--r--src/eventlooper.cpp21
-rw-r--r--src/fakeStarCoin.cpp1
-rw-r--r--src/fileselect.S264
-rwxr-xr-xsrc/firelaser.cpp11
-rw-r--r--src/koopatlas/core.h2
-rw-r--r--src/koopatlas/hud.cpp67
-rw-r--r--src/koopatlas/map.cpp8
-rw-r--r--src/koopatlas/mapdata.cpp4
-rw-r--r--src/koopatlas/mapdata.h7
-rw-r--r--src/koopatlas/pathmanager.cpp57
-rw-r--r--src/layoutDebug.S148
-rw-r--r--src/levelinfo_old.h4
-rw-r--r--src/levelspecial.cpp9
-rw-r--r--src/linegod.cpp8
-rwxr-xr-xsrc/meteor.cpp2
-rwxr-xr-xsrc/mrsun.cpp9
-rw-r--r--src/msgbox.cpp50
-rw-r--r--src/msgbox.h52
-rw-r--r--src/newer.cpp77
-rw-r--r--src/palaceDude.cpp51
-rw-r--r--src/penguin.cpp4
-rw-r--r--src/player.h1
-rw-r--r--src/pumpkinGoomba.cpp16
-rw-r--r--src/shyguy.cpp5
-rwxr-xr-xsrc/spritespawner.cpp10
-rwxr-xr-xsrc/spriteswapper.cpp11
-rw-r--r--src/topman.cpp19
-rw-r--r--switchblock.yaml15
-rw-r--r--tools/UsedProfileAndSpriteList.txt160
-rw-r--r--tools/kamek.py35
57 files changed, 1183 insertions, 304 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..934ea99 100644
--- a/NewerProjectKP.yaml
+++ b/NewerProjectKP.yaml
@@ -2,6 +2,8 @@ output_dir: "NewerASM"
code_address: 0x808D9000
modules:
- processed/prolog.yaml
+# - processed/layoutDebug.yaml
+ - processed/fileselect.yaml
- processed/magicplatform.yaml
- processed/cutScene.yaml
- processed/bonepiece.yaml
diff --git a/bossBalboaWrench.yaml b/bossBalboaWrench.yaml
index f649aa0..178713d 100644
--- a/bossBalboaWrench.yaml
+++ b/bossBalboaWrench.yaml
@@ -1,5 +1,5 @@
---
-# Replaces EN_Iwao
+# Replaces AC_LIFT_ICE_SPRING
source_files: [../src/bossBalboaWrench.cpp]
hooks:
diff --git a/bossFuzzyBear.yaml b/bossFuzzyBear.yaml
index 3b608d3..33b9e1f 100644
--- a/bossFuzzyBear.yaml
+++ b/bossFuzzyBear.yaml
@@ -1,5 +1,5 @@
---
-# Replaces EN_WALLINSECT
+# Replaces WALLINSECT_MGR
source_files: [../src/bossFuzzyBear.cpp]
hooks:
diff --git a/bugfixes.yaml b/bugfixes.yaml
index 29b7acd..336a524 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
@@ -12,6 +14,33 @@ hooks:
branch_type: b
target_func: 'after_course_getMusicForZone'
+ # IDs to nuke: 1, 2, 4, 10
+ - name: MusicNukeBahpsNormal1
+ type: patch
+ addr_pal: 0x802F6BC8
+ data: '00000000 00000000 00000000 00000000'
+ - name: MusicNukeBahpsNormal2
+ type: patch
+ addr_pal: 0x802F6BE0
+ data: '00000000 00000000'
+ - name: MusicNukeBahpsNormal3
+ type: patch
+ addr_pal: 0x802F6C10
+ data: '00000000 00000000'
+
+ - name: MusicNukeBahpsFast1
+ type: patch
+ addr_pal: 0x802F6CB0
+ data: '00000000 00000000 00000000 00000000'
+ - name: MusicNukeBahpsFast2
+ type: patch
+ addr_pal: 0x802F6CC8
+ data: '00000000 00000000'
+ - name: MusicNukeBahpsFast3
+ type: patch
+ addr_pal: 0x802F6CF8
+ data: '00000000 00000000'
+
- name: Fix38WithJumpCoin
src_addr_pal: 0x807EBC5C
type: branch_insn
diff --git a/cutScene.yaml b/cutScene.yaml
index d338c6a..5fe95c5 100644
--- a/cutScene.yaml
+++ b/cutScene.yaml
@@ -1,5 +1,5 @@
---
-source_files: [.../src/cutScene.cpp]
+source_files: [../src/cutScene.cpp]
hooks:
- name: BuildCutScene
type: add_func_pointer
diff --git a/electricLine.yaml b/electricLine.yaml
index 3b9e856..ab968c4 100644
--- a/electricLine.yaml
+++ b/electricLine.yaml
@@ -1,5 +1,5 @@
---
-# Replaces Ship_Window
+# Replaces Kawanagare
source_files: [../src/electricLine.cpp]
hooks:
diff --git a/fileselect.yaml b/fileselect.yaml
new file mode 100644
index 0000000..90c18f9
--- /dev/null
+++ b/fileselect.yaml
@@ -0,0 +1,152 @@
+---
+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'}
+ - {name: DFNiceWorldName, type: branch_insn, branch_type: bl, src_addr_pal: 0x8077DA10, target_func: 'DFNiceWorldName'}
+
+# - {name: FSDebugStates, type: add_func_pointer, src_addr_pal: 0x80943E38, target_func: 'FSDebugStates'}
+
+
diff --git a/include/game.h b/include/game.h
index f3b14c3..169b01d 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;
@@ -3056,7 +3067,30 @@ namespace mHeap {
};
void WriteNumberToTextBox(int *number, const int *fieldLength, nw4r::lyt::TextBox *textBox, bool unk); // 800B3B60
+extern "C" dAc_Py_c* GetSpecificPlayerActor(int number);
+extern "C" dStageActor_c *CreateActor(u16 classID, int settings, Vec pos, char rot, char layer);
+extern "C" dStageActor_c *Actor_SearchByID(u32 actorID);
+
+struct DoSomethingCool {
+ u32 unk_01; //0000
+ Vec3 pos; //0004
+ Vec3 scale; //0010
+ f32 unk_02; //001C
+ f32 unk_03; //0020
+ f32 unk_04; //0024
+ f32 unk_05; //0028
+ f32 unk_06; //002C
+ f32 unk_07; //0030
+ f32 unk_08; //0034
+ f32 unk_09; //0038
+};
+extern "C" u8 dSprite_c__getXDirectionOfFurthestPlayerRelativeToVEC3(dEn_c *, Vec pos);
+extern "C" void *ShakeScreen(void *, unsigned int, unsigned int, unsigned int, unsigned int);
+extern "C" void *PlaySound(dStageActor_c *, int soundID);
+extern "C" void *PlaySoundAsync(dStageActor_c *, int soundID);
+extern "C" u32 GetActivePlayerCount();
+#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/kamek_pal.x b/kamek_pal.x
index 4a44383..02bc004 100644
--- a/kamek_pal.x
+++ b/kamek_pal.x
@@ -1,9 +1,13 @@
SECTIONS {
/* Scrolling is annoying, clown car goes here! */
+ m2d__Anm_c__Load = 0x801644F0;
+ m2d__AnmResHandler_c__Load = 0x80163FA0;
RealAcPyDtor = 0x80144820;
+ InsertIntIntoTextBox1 = 0x800B3BE0;
+
__ct__20daJrClownForPlayer_cFv = 0x80810480;
__dt__20daJrClownForPlayer_cFv = 0x80810540; /* Beans indeed. */
diff --git a/koopatlas.yaml b/koopatlas.yaml
index 0457fe0..4c79acf 100644
--- a/koopatlas.yaml
+++ b/koopatlas.yaml
@@ -16,42 +16,42 @@ source_files:
- ../src/koopatlas/starcoin.cpp
hooks:
- - name: BuildWorldMap
+ - name: BuildWorldMap # WORLD_MAP
type: add_func_pointer
src_addr_pal: 0x8098DCF0
target_func: 'dScKoopatlas_c::build(void)'
- - name: BuildWMPlayer
+ - name: BuildWMPlayer # WM_PLAYER
type: add_func_pointer
src_addr_pal: 0x80988DDC
target_func: 'daWMPlayer_c::build(void)'
- - name: BuildWMHud
+ - name: BuildWMHud # WM_DANCE_PAKKUN
type: add_func_pointer
src_addr_pal: 0x80982844
target_func: 'dWMHud_c::build(void)'
- - name: BuildWorldCamera
+ - name: BuildWorldCamera # WORLD_CAMERA
type: add_func_pointer
src_addr_pal: 0x8098EEC8
target_func: 'dWorldCamera_c::build(void)'
- - name: BuildWMMap
+ - name: BuildWMMap # WM_MAP
type: add_func_pointer
src_addr_pal: 0x80984710
target_func: 'dWMMap_c::build(void)'
- - name: BuildWMShop
+ - name: BuildWMShop # WM_TOGEZO
type: add_func_pointer
src_addr_pal: 0x80986074
target_func: 'dWMShop_c::build(void)'
- - name: BuildWMdShopItem
+ - name: BuildWMdShopItem # WM_BOARD
type: add_func_pointer
- src_addr_pal: 0x809894B4
+ src_addr_pal: 0x80981CA0
target_func: 'dShopItem::build(void)'
- - name: BuildWMdStarCoin
+ - name: BuildWMdStarCoin # WM_GHOST
type: add_func_pointer
src_addr_pal: 0x80982D1C
target_func: 'dWMStarCoin::build(void)'
diff --git a/layoutDebug.yaml b/layoutDebug.yaml
new file mode 100644
index 0000000..7c1dae2
--- /dev/null
+++ b/layoutDebug.yaml
@@ -0,0 +1,14 @@
+---
+source_files: [../src/layoutDebug.S]
+hooks:
+ - name: RlanLoadDebugHook
+ type: branch_insn
+ branch_type: bl
+ src_addr_pal: 0x800C9118
+ target_func: 'RlanLoadDebugHook'
+ - name: AnmLoadDebugHook
+ type: branch_insn
+ branch_type: bl
+ src_addr_pal: 0x800C9268
+ target_func: 'AnmLoadDebugHook'
+
diff --git a/makeNewerKP b/makeNewerKP
index 9337a0e..87a3daa 100755
--- a/makeNewerKP
+++ b/makeNewerKP
@@ -1,6 +1,6 @@
#!/bin/sh
python2 tools/mapfile_tool.py
-python2 tools/kamek.py NewerProjectKP.yaml --no-rels --use-mw --use-wine --gcc-type=/opt/wiidev/bin/powerpc-elf --mw-path=tools
+python2 tools/kamek.py NewerProjectKP.yaml --no-rels --use-mw --use-wine --gcc-type=/opt/wiidev/bin/powerpc-elf --mw-path=tools --fast-hack
if [ "$?" = "0" ]; then
echo "compile successful"
else
diff --git a/spritespawner.yaml b/spritespawner.yaml
index 8c2e7ca..8c630eb 100644
--- a/spritespawner.yaml
+++ b/spritespawner.yaml
@@ -1,5 +1,5 @@
---
-# Replaces Ac_Lift_ObjBg_HMove_Big
+# Replaces EN_BOYON
source_files: [../src/spritespawner.cpp]
hooks:
@@ -12,4 +12,4 @@ hooks:
type: add_func_pointer
src_addr_pal: 0x80ADEA30
target_func: 'SpriteSpawner_Execute(SpriteSpawner *)'
- \ No newline at end of file
+
diff --git a/spriteswapper.yaml b/spriteswapper.yaml
index 76bf7d5..e05ba54 100644
--- a/spriteswapper.yaml
+++ b/spriteswapper.yaml
@@ -1,7 +1,7 @@
---
# Replaces EN_Remocon_ToriMochi
-source_files: [../src/spriteSwapper.cpp]
+source_files: [../src/spriteswapper.cpp]
hooks:
- name: SpriteSpawnerTimedBuild
type: add_func_pointer
diff --git a/src/bonusRoom.cpp b/src/bonusRoom.cpp
index c4a84cd..1f60399 100644
--- a/src/bonusRoom.cpp
+++ b/src/bonusRoom.cpp
@@ -5,11 +5,8 @@
#include <stage.h>
extern "C" bool SpawnEffect(const char*, int, Vec*, S16Vec*, Vec*);
-extern "C" void *PlaySound(dStageActor_c *, int soundID);
-extern "C" void *PlaySoundAsync(dStageActor_c *, int soundID);
extern "C" void *StopBGMMusic();
extern "C" void *StartBGMMusic();
-extern "C" dStageActor_c* GetSpecificPlayerActor(int number);
extern "C" void *SoundRelatedClass;
extern "C" void *MapSoundPlayer(void *SoundClass, int soundID, int unk);
diff --git a/src/boss.h b/src/boss.h
index 4c31021..57ef494 100644
--- a/src/boss.h
+++ b/src/boss.h
@@ -7,16 +7,10 @@
#include <stage.h>
#include <sfx.h>
-extern "C" void *PlaySound(dStageActor_c *, int soundID);
-extern "C" void *PlaySoundAsync(dStageActor_c *, int soundID);
extern "C" bool SpawnEffect(const char*, int, Vec*, S16Vec*, Vec*);
-extern "C" dStageActor_c* GetSpecificPlayerActor(int number);
-extern "C" dStageActor_c *CreateActor(u16 classID, int settings, Vec pos, char rot, char layer);
-
extern "C" u32 GenerateRandomNumber(int max);
-extern "C" u8 dSprite_c__getXDirectionOfFurthestPlayerRelativeToVEC3(dEn_c *, Vec pos);
extern "C" char usedForDeterminingStatePress_or_playerCollision(dEn_c* t, ActivePhysics *apThis, ActivePhysics *apOther, int unk1);
extern "C" void *StopBGMMusic();
diff --git a/src/bossCaptainBowser.cpp b/src/bossCaptainBowser.cpp
index c3c1b62..119779f 100644
--- a/src/bossCaptainBowser.cpp
+++ b/src/bossCaptainBowser.cpp
@@ -5,7 +5,6 @@
#include <stage.h>
#include "boss.h"
-extern "C" void *ShakeScreen(void *, unsigned int, unsigned int, unsigned int, unsigned int);
extern "C" void *StageScreen;
@@ -109,7 +108,6 @@ daCaptainBowser *daCaptainBowser::build() {
// Externs and States
///////////////////////
- extern "C" u32 GetActivePlayerCount();
CREATE_STATE(daCaptainBowser, Wait);
CREATE_STATE(daCaptainBowser, Throw);
diff --git a/src/bossMegaGoomba.cpp b/src/bossMegaGoomba.cpp
index 9b6f577..79ebd34 100644
--- a/src/bossMegaGoomba.cpp
+++ b/src/bossMegaGoomba.cpp
@@ -4,7 +4,6 @@
#include <sfx.h>
#include "boss.h"
-extern "C" void *ShakeScreen(void *, unsigned int, unsigned int, unsigned int, unsigned int);
extern "C" void *ShakePlayers(dEn_c *);
extern "C" void *StopPlayerShake(dEn_c *);
extern "C" void *StageScreen;
diff --git a/src/bossPodouble.cpp b/src/bossPodouble.cpp
index 961d760..a1e1464 100644
--- a/src/bossPodouble.cpp
+++ b/src/bossPodouble.cpp
@@ -82,7 +82,6 @@ daPodouble *daPodouble::build() {
// Externs and States
///////////////////////
extern "C" int SmoothRotation(short* rot, u16 amt, int unk2);
- extern "C" int GetActivePlayerCount();
CREATE_STATE(daPodouble, Bounce);
CREATE_STATE(daPodouble, Spit);
diff --git a/src/bossRamboo.cpp b/src/bossRamboo.cpp
index c12b709..de01fe9 100644
--- a/src/bossRamboo.cpp
+++ b/src/bossRamboo.cpp
@@ -70,14 +70,6 @@ CREATE_STATE(daRamboo_c, Flee);
CREATE_STATE(daRamboo_c, Outro);
-struct EventTable_t {
- u64 events;
- // ...
-};
-
-extern EventTable_t *EventTable;
-
-
void daRamboo_c::playerCollision(ActivePhysics *apThis, ActivePhysics *apOther) { DamagePlayer(this, apThis, apOther); }
void daRamboo_c::collisionCat1_Fireball_E_Explosion(ActivePhysics *apThis, ActivePhysics *apOther) {
SpawnEffect("Wm_en_obakedoor_sm", 0, &apOther->owner->pos, &(S16Vec){0,0,0}, &(Vec){0.5, 0.5, 0.5});
@@ -236,7 +228,7 @@ int daRamboo_c::onExecute() {
if(this->fogSrt.isEntryAnimationDone(0))
this->fogSrt.setFrameForEntry(1.0, 0);
- if (EventTable->events & this->eventFlag) {
+ if (dFlagMgr_c::instance->flags & this->eventFlag) {
doStateChange(&StateID_Outro);
}
diff --git a/src/bossThwompaDomp.cpp b/src/bossThwompaDomp.cpp
index 85799c3..4bce47c 100644
--- a/src/bossThwompaDomp.cpp
+++ b/src/bossThwompaDomp.cpp
@@ -8,7 +8,6 @@
// Externs
extern "C" int posIsInZone(Vec,float*,float*,u8 zone);
extern "C" void* ScreenPositionClass;
- extern "C" void ShakeScreen(void*,int,int,int,int); // (ScreenPositionClass, some other ints - set the second one to 1 to shake it)
extern "C" int SpawnThwompEffects(dEn_c *);
extern "C" void* SoundRelatedClass;
diff --git a/src/challengeStar.cpp b/src/challengeStar.cpp
index 051f9c4..790b0c4 100644
--- a/src/challengeStar.cpp
+++ b/src/challengeStar.cpp
@@ -4,17 +4,10 @@
#include <sfx.h>
-extern "C" void *PlaySound(dEn_c *, int soundID);
-extern "C" void *PlaySoundAsync(dStageActor_c *, int soundID);
-
extern "C" bool SpawnEffect(const char*, int, Vec*, S16Vec*, Vec*);
-extern "C" dStageActor_c* GetSpecificPlayerActor(int number);
extern int GlobalStarsCollected;
-struct EventTable_t { u64 events; };
-extern EventTable_t *EventTable;
-
class dChallengeStar : public dEn_c {
int onCreate();
@@ -51,7 +44,7 @@ void dChallengeStar::playerCollision(ActivePhysics *apThis, ActivePhysics *apOth
GlobalStarsCollected--;
if (GlobalStarsCollected == 0) {
- EventTable->events |= this->eventFlag;
+ dFlagMgr_c::instance->flags |= this->eventFlag;
}
this->Delete(1);
diff --git a/src/cutScene.cpp b/src/cutScene.cpp
index cde9c2c..cb0151b 100644
--- a/src/cutScene.cpp
+++ b/src/cutScene.cpp
@@ -85,13 +85,15 @@ int dScCutScene_c::onExecute() {
// now, do all other processing
if (currentScene >= 0) {
- if (!layout->isAnyAnimOn()) {
+ int nowPressed = Remocon_GetPressed(GetActiveRemocon());
+ if (!layout->isAnyAnimOn() || nowPressed & WPAD_TWO) {
// we're at the end
// what now?
if ((currentScene + 1) == data->sceneCount) {
// we're TOTALLY done!
OSReport("playback complete\n");
+ DoSceneChange(WORLD_MAP, 0, 0);
} else {
nextScene = currentScene + 1;
OSReport("switching to scene %d\n", nextScene);
diff --git a/src/effectvideo.cpp b/src/effectvideo.cpp
index d690263..24089ef 100644
--- a/src/effectvideo.cpp
+++ b/src/effectvideo.cpp
@@ -4,7 +4,6 @@
#include <sfx.h>
-extern "C" void *PlaySoundAsync(dEn_c *, int soundID);
extern "C" bool SpawnEffect(const char*, int, Vec*, S16Vec*, Vec*);
@@ -25,12 +24,6 @@ class EffectVideo : public dEn_c {
};
-struct EventTable_t {
- u64 events;
-};
-
-extern EventTable_t *EventTable;
-
EffectVideo *EffectVideo::build() {
void *buffer = AllocFromGameHeap1(sizeof(EffectVideo));
@@ -65,7 +58,7 @@ int EffectVideo::onDelete() {
int EffectVideo::onExecute() {
- if (EventTable->events & this->eventFlag) {
+ if (dFlagMgr_c::instance->flags & this->eventFlag) {
if (this->timer == this->delay) {
diff --git a/src/electricLine.cpp b/src/electricLine.cpp
index af8c7ea..b6bb0bf 100644
--- a/src/electricLine.cpp
+++ b/src/electricLine.cpp
@@ -33,10 +33,6 @@ daElectricLine *daElectricLine::build() {
///////////////////////
// Externs and States
///////////////////////
- extern "C" void *PlaySound(dStageActor_c *, int soundID);
- extern "C" void *PlaySoundAsync(dStageActor_c *, int soundID);
-
- extern "C" dStageActor_c *CreateActor(u16 classID, int settings, Vec pos, char rot, char layer);
CREATE_STATE(daElectricLine, Activate);
diff --git a/src/eventlooper.cpp b/src/eventlooper.cpp
index 5acb43c..4c0a232 100644
--- a/src/eventlooper.cpp
+++ b/src/eventlooper.cpp
@@ -18,13 +18,6 @@ struct EventLooper {
u8 delayCount; // 0x3D7
};
-struct EventTable_t {
- u64 events;
- // ...
-};
-
-extern EventTable_t *EventTable;
-
void EventLooper_Update(EventLooper *self);
@@ -58,10 +51,10 @@ bool EventLooper_Create(EventLooper *self) {
}
- if (EventTable->events & self->eventActive)
+ if (dFlagMgr_c::instance->flags & self->eventActive)
{
u64 evState = (u64)1 << (eventStart - 1);
- EventTable->events = EventTable->events | evState;
+ dFlagMgr_c::instance->flags |= evState;
}
EventLooper_Update(self);
@@ -77,7 +70,7 @@ bool EventLooper_Execute(EventLooper *self) {
void EventLooper_Update(EventLooper *self) {
- if ((EventTable->events & self->eventActive) == 0)
+ if ((dFlagMgr_c::instance->flags & self->eventActive) == 0)
return;
// Waiting for the right moment
@@ -92,23 +85,23 @@ void EventLooper_Update(EventLooper *self) {
self->delayCount = 0;
// Find which event(s) is/are on
- u64 evState = EventTable->events & self->eventFlag;
+ u64 evState = dFlagMgr_c::instance->flags & self->eventFlag;
// Turn off the old events
- EventTable->events = EventTable->events & (~self->eventFlag);
+ dFlagMgr_c::instance->flags = dFlagMgr_c::instance->flags & (~self->eventFlag);
// Shift them right if they can, if not, reset!
evState = evState << 1;
if (evState < self->eventFlag)
{
- EventTable->events = EventTable->events | evState;
+ dFlagMgr_c::instance->flags = dFlagMgr_c::instance->flags | evState;
}
else
{
char eventStart = (self->settings >> 24) & 0xFF;
evState = (u64)1 << (eventStart - 1);
- EventTable->events = EventTable->events | evState;
+ dFlagMgr_c::instance->flags = dFlagMgr_c::instance->flags | evState;
}
diff --git a/src/fakeStarCoin.cpp b/src/fakeStarCoin.cpp
index b69e039..579054f 100644
--- a/src/fakeStarCoin.cpp
+++ b/src/fakeStarCoin.cpp
@@ -4,7 +4,6 @@
#include <sfx.h>
-extern "C" void *PlaySound(dEn_c *, int soundID);
extern "C" bool SpawnEffect(const char*, int, Vec*, S16Vec*, Vec*);
diff --git a/src/fileselect.S b/src/fileselect.S
new file mode 100644
index 0000000..19710ef
--- /dev/null
+++ b/src/fileselect.S
@@ -0,0 +1,264 @@
+.set sp,1
+.set rtoc,2
+
+.text
+.extern OSReport
+
+.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
+
+.extern findTextBoxByName__Q23m2d17EmbedLayoutBase_cCFPCc
+.extern NewerWorldNames
+.extern NewerWorldCount
+.extern InsertIntIntoTextBox1
+.global DFNiceWorldName
+DFNiceWorldName:
+ stwu r1, -0x30(r1)
+ mflr r0
+ stw r0, 0x34(r1)
+ stw r20, 0x2C(r1)
+ stw r21, 0x28(r1)
+ stw r22, 0x24(r1)
+ # r1+0x20 is reserved for the stupid ints in textboxes
+ stw r23, 0x1C(r1)
+ stw r24, 0x18(r1)
+ stw r25, 0x14(r1)
+ mr r20, r4
+
+ # get Newer map number
+ lbz r6, 0x6FC(r31)
+ lis r8, NewerWorldCount@h
+ ori r8, r8, NewerWorldCount@h
+ lwz r8, 0(r8)
+ cmpw r6, r8
+ bge invalidThing
+ slwi r6, r6, 2
+ lis r7, NewerWorldNames@h
+ ori r7, r7, NewerWorldNames@l
+ lwzx r4, r7, r6
+ li r5, 0
+ b gotName
+invalidThing:
+ lis r4, InvalidWorld@h
+ ori r4, r4, InvalidWorld@l
+gotName:
+
+ mr r3, r20
+ lwz r12, 0(r3)
+ lwz r12, 0x7C(r12)
+ mtctr r12
+ bctrl
+
+ # While we're at it, take care of some other things
+ # r21 shall hold our star coin count; r22 shall hold our exit count
+ # r23 shall hold the level pointer
+ # r24 shall hold the world number, and r25 the level number
+
+ li r21, 0
+ li r22, 0
+ addi r23, r31, 0x6C
+ li r24, 0
+ li r25, 0
+
+ # Loop through ALL levels
+
+levelLoop:
+ lwz r4, 0(r23)
+
+ cmpwi r25, 38
+ beq ignoreStartPoint
+
+ clrlwi. r0, r4, 31
+ beq noCoin1
+ addi r21, r21, 1
+noCoin1:
+ extrwi. r0, r4, 1,30
+ beq noCoin2
+ addi r21, r21, 1
+noCoin2:
+ extrwi. r0, r4, 1,29
+ beq noCoin3
+ addi r21, r21, 1
+noCoin3:
+
+ extrwi. r0, r4, 1,27
+ beq noNormalExit
+ addi r22, r22, 1
+
+# lis r3, NormalExitStr@h
+# ori r3, r3, NormalExitStr@l
+# addi r4, r24, 1
+# addi r5, r25, 1
+# crclr 4*cr1+eq
+# bl OSReport
+noNormalExit:
+ lwz r4, 0(r23)
+ extrwi. r0, r4, 1,26
+ beq noSecretExit
+ addi r22, r22, 1
+
+# lis r3, SecretExitStr@h
+# ori r3, r3, SecretExitStr@l
+# addi r4, r24, 1
+# addi r5, r25, 1
+# crclr 4*cr1+eq
+# bl OSReport
+noSecretExit:
+
+ignoreStartPoint:
+
+ addi r23, r23, 4
+ addi r25, r25, 1
+ cmpwi r25, 42
+ blt levelLoop
+ # next world
+ addi r24, r24, 1
+ li r25, 0
+ cmpwi r24, 10
+ blt levelLoop
+
+ # Now, subtract the paid star coins
+ lhz r3, 0x66(r31)
+ sub r21, r21, r3
+
+ # And write everything ...
+ addi r3, r30, 0x74
+ lis r4, ExitCount@h
+ ori r4, r4, ExitCount@l
+ bl findTextBoxByName__Q23m2d17EmbedLayoutBase_cCFPCc
+
+ stw r22, 0x20(r1)
+ mr r4, r3
+ addi r3, r1, 0x20
+ li r5, 1
+ bl InsertIntIntoTextBox1
+
+ addi r3, r30, 0x74
+ lis r4, StarCoinCount@h
+ ori r4, r4, StarCoinCount@l
+ bl findTextBoxByName__Q23m2d17EmbedLayoutBase_cCFPCc
+
+ stw r21, 0x20(r1)
+ mr r4, r3
+ addi r3, r1, 0x20
+ li r5, 0
+ bl InsertIntIntoTextBox1
+
+ lwz r25, 0x14(r1)
+ lwz r24, 0x18(r1)
+ lwz r23, 0x1C(r1)
+ lwz r22, 0x24(r1)
+ lwz r21, 0x28(r1)
+ lwz r20, 0x2C(r1)
+ lwz r0, 0x34(r1)
+ mtlr r0
+ addi r1, r1, 0x30
+ blr
+
+.global FSDebugStates
+FSDebugStates:
+ stwu r1, -0x10(r1)
+ mflr r0
+ stw r0, 0x14(r1)
+ stw r31, 0xC(r1)
+ stw r30, 0x8(r1)
+ mr r31, r3
+ mr r30, r4
+
+ lis r3, FSStateDebugStr@h
+ ori r3, r3, FSStateDebugStr@l
+ crclr 4*cr1+eq
+ lwz r4, 4(r4)
+ bl OSReport
+
+ mr r3, r31
+ mr r4, r30
+ lwzu r12, 0x18(r3)
+ lwz r12, 0x18(r12)
+ mtctr r12
+ bctrl
+
+ lwz r31, 0xC(r1)
+ lwz r30, 0x8(r1)
+ lwz r0, 0x14(r1)
+ mtlr r0
+ addi r1, r1, 0x10
+ blr
+
+.align 4
+
+.data
+FSStateDebugStr: .string "State: %s\n"
+
+.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"
+
+NormalExitStr: .string "<Normal> %d-%d\n"
+SecretExitStr: .string "<Secret> %d-%d\n"
+StarCoinCount: .string "StarCoinCount"
+ExitCount: .string "ExitCount"
+
+.align 4
+DFTitle:
+.short 'F','i','l','e',' ','X',0
+InvalidWorld:
+.short '<','I','n','v','a','l','i','d',' ','W','o','r','l','d','>',0
+
diff --git a/src/firelaser.cpp b/src/firelaser.cpp
index 32eb0bd..fa240d0 100755
--- a/src/firelaser.cpp
+++ b/src/firelaser.cpp
@@ -25,18 +25,9 @@ daFireLaser_c *daFireLaser_c::build() {
}
-extern "C" dStageActor_c *CreateActor(u16 classID, int settings, Vec pos, char rot, char layer);
-
-
CREATE_STATE(daFireLaser_c, pewpewpew);
-struct EventTable_t {
- u64 events;
-};
-
-extern EventTable_t *EventTable;
-
int daFireLaser_c::onCreate() {
@@ -77,7 +68,7 @@ void daFireLaser_c::beginState_pewpewpew() {
void daFireLaser_c::executeState_pewpewpew() {
- if (EventTable->events & this->eventFlag) {
+ if (dFlagMgr_c::instance->flags & this->eventFlag) {
this->timer = this->timer + 1;
diff --git a/src/koopatlas/core.h b/src/koopatlas/core.h
index d2d9454..2674977 100644
--- a/src/koopatlas/core.h
+++ b/src/koopatlas/core.h
@@ -36,7 +36,7 @@ void NewerMapDrawFunc();
#define WM_HUD WM_DANCE_PAKKUN
#define WM_SHOP WM_TOGEZO
-#define WM_SHOPITEM WM_PUKU
+#define WM_SHOPITEM WM_BOARD
#define WM_STARCOIN WM_GHOST
class daWMPlayer_c;
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/map.cpp b/src/koopatlas/map.cpp
index 65d71b8..316c001 100644
--- a/src/koopatlas/map.cpp
+++ b/src/koopatlas/map.cpp
@@ -115,6 +115,14 @@ void dWMMap_c::renderer_c::drawLayers() {
dKPLayer_s *layer = data->layers[iLayer];
renderMtx[2][3] += 2.0f;
+ if (layer->type == dKPLayer_s::PATHS) {
+ // rebase the camera matrix
+ baseZ = 3500.0f;
+ nw4r::g3d::Camera cam3d(GetCameraByID(0));
+ cam3d.GetCameraMtx(&renderMtx);
+ MTXTransApply(renderMtx, renderMtx, 0, 0, baseZ);
+ }
+
if (layer->alpha == 0)
continue; // invisible
diff --git a/src/koopatlas/mapdata.cpp b/src/koopatlas/mapdata.cpp
index ab8ef3a..52a7937 100644
--- a/src/koopatlas/mapdata.cpp
+++ b/src/koopatlas/mapdata.cpp
@@ -152,7 +152,7 @@ bool dKPMapData_c::load(const char *filename) {
fixup();
bool didLoadTilesets = loadTilesets();
- bool didLoadBG = (bgLoader.load("/Maps/Water.brres") != 0);
+ bool didLoadBG = (bgLoader.load(data->backgroundName) != 0);
return didLoadTilesets && didLoadBG;
}
@@ -203,6 +203,8 @@ void dKPMapData_c::fixup() {
fixRef(data->layers);
fixRef(data->tilesets);
fixRef(data->unlockData);
+ fixRef(data->sectors);
+ fixRef(data->backgroundName);
for (int iLayer = 0; iLayer < data->layerCount; iLayer++) {
dKPLayer_s *layer = fixRef(data->layers[iLayer]);
diff --git a/src/koopatlas/mapdata.h b/src/koopatlas/mapdata.h
index 40e1a43..70c31ee 100644
--- a/src/koopatlas/mapdata.h
+++ b/src/koopatlas/mapdata.h
@@ -179,6 +179,9 @@ struct dKPLayer_s {
};
struct dKPMapFile_s {
+ u32 magic;
+ int version;
+
int layerCount;
dKPLayer_s **layers;
@@ -187,7 +190,9 @@ struct dKPMapFile_s {
u8 *unlockData;
- dKPLayer_s::sector_s sectors[1]; // variable size
+ dKPLayer_s::sector_s *sectors;
+
+ const char *backgroundName;
};
class dKPMapData_c {
diff --git a/src/koopatlas/pathmanager.cpp b/src/koopatlas/pathmanager.cpp
index ffc4dfd..a9cd003 100644
--- a/src/koopatlas/pathmanager.cpp
+++ b/src/koopatlas/pathmanager.cpp
@@ -41,11 +41,41 @@ void dWMPathManager_c::setup() {
found = true;
currentNode = node;
- SpammyReport("a1 Node: %p\n", node);
- dKPPath_s *exit = node->getAnyExit();
- SpammyReport("a2 Exit: %p\n", exit);
- startMovementTo(exit);
- SpammyReport("a3\n");
+ // figure out where we should move to
+ dKPPath_s *exitTo = 0;
+
+ for (int i = 0; i < 4; i++) {
+ dKPPath_s *candidateExit = node->exits[i];
+ if (!candidateExit)
+ continue;
+
+ // find out if this path is a candidate
+ dKPNode_s *srcNode = node;
+ dKPPath_s *path = candidateExit;
+
+ while (true) {
+ dKPNode_s *destNode = (path->start == srcNode) ? path->end : path->start;
+ int ct = destNode->getAvailableExitCount();
+ if (destNode == node || ct > 2 || destNode->type == dKPNode_s::LEVEL) {
+ exitTo = path;
+ break;
+ }
+
+ if (ct == 1)
+ break;
+
+ // where to next?
+ path = destNode->getOppositeAvailableExitTo(path);
+ srcNode = destNode;
+ }
+
+ if (exitTo)
+ break;
+ }
+
+ if (!exitTo)
+ exitTo = node->getAnyExit();
+ startMovementTo(exitTo);
break;
}
}
@@ -433,26 +463,26 @@ void dWMPathManager_c::startMovementTo(dKPPath_s *path) {
moveSpeed = 2.0f;
break;
case 13:
- player->startAnimation(Tjumped, 2.0, 0.0, 0.0);
- break;
- case 14:
player->startAnimation(b_dash2, 3.0, 10.0, 0.0);
player->hasSound = true;
player->soundName = SE_PLY_FOOTNOTE_DIRT;
moveSpeed = 5.0f;
break;
- case 15:
+ case 14:
player->startAnimation(wait, 2.0, 10.0, 0.0);
player->rot.y = 0x0000;
MapSoundPlayer(SoundRelatedClass, SE_PLY_DOKAN_IN_OUT, 1);
moveSpeed = 1.0f;
break;
- case 16:
+ case 15:
player->startAnimation(wait, 2.0, 10.0, 0.0);
player->rot.y = 0x8000;
MapSoundPlayer(SoundRelatedClass, SE_OBJ_DOOR_OPEN, 1);
moveSpeed = 0.2f;
break;
+ case 16:
+ player->startAnimation(Tjumped, 2.0, 0.0, 0.0);
+ break;
default:
SpammyReport("No animtaion?!");
player->startAnimation(run, 2.0, 10.0, 0.0);
@@ -560,6 +590,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/layoutDebug.S b/src/layoutDebug.S
new file mode 100644
index 0000000..591bfd5
--- /dev/null
+++ b/src/layoutDebug.S
@@ -0,0 +1,148 @@
+.text
+
+.extern OSReport
+.extern strcmp
+
+.global RlanLoadDebugHook
+.extern m2d__AnmResHandler_c__Load
+RlanLoadDebugHook:
+ stwu r1, -0x20(r1)
+ mflr r0
+ stw r0, 0x24(r1)
+ stw r21, 0x1C(r1)
+ stw r22, 0x18(r1)
+ stw r23, 0x14(r1)
+ stw r24, 0x10(r1)
+ stw r25, 0xC(r1)
+
+ mr r21, r3
+ mr r22, r4
+ mr r23, r5
+ mr r24, r6
+ mr r25, r7
+
+ lis r3, RlanLoadStr@h
+ ori r3, r3, RlanLoadStr@l
+ mr r4, r29 # rlan num
+ mr r5, r28 # rlan count
+ mr r6, r21 # anmreshandler
+ mr r7, r22 # rlan name
+ mr r8, r23 # resAcc
+ mr r9, r24 # layout
+ crclr 4*cr1+eq
+ bl OSReport
+
+ lis r3, BreakOnRlan@h
+ ori r3, r3, BreakOnRlan@l
+ mr r4, r22
+ bl strcmp
+ cmpwi r3, 0
+ bne thatsFine
+ lis r3, 0xDEAD
+ ori r3, r3, 0xBEEF
+thatsFine:
+ mr r3, r21
+ mr r4, r22
+ mr r5, r23
+ mr r6, r24
+ mr r7, r25
+ bl m2d__AnmResHandler_c__Load
+ mr r25, r3
+
+# lis r3, RlanGrpCount@h
+# ori r3, r3, RlanGrpCount@l
+# lwz r4, 0x18(r21)
+# crclr 4*cr1+eq
+# bl OSReport
+
+ # Thing: r22
+ # ID: r23
+ # Count: r24
+ li r23, 0
+ lwz r24, 0x18(r21)
+ lwz r22, 0x14(r21)
+ b startGroupReportLoop
+groupReportLoop:
+
+ lis r3, RlanGroupStr@h
+ ori r3, r3, RlanGroupStr@l
+
+ mr r4, r23 # ID
+ mr r5, r24 # count
+ lwz r6, 0(r22) # group
+ addi r7, r6, 0x18
+ lwz r8, 4(r22) # animTransform
+
+ crclr 4*cr1+eq
+ bl OSReport
+
+ addi r23, r23, 1
+ addi r22, r22, 8
+
+startGroupReportLoop:
+ cmpw r23, r24
+ blt groupReportLoop
+
+ mr r3, r25
+
+ lwz r21, 0x1C(r1)
+ lwz r22, 0x18(r1)
+ lwz r23, 0x14(r1)
+ lwz r24, 0x10(r1)
+ lwz r25, 0xC(r1)
+ lwz r0, 0x24(r1)
+ mtlr r0
+ addi r1, r1, 0x20
+ blr
+
+
+
+
+.global AnmLoadDebugHook
+.extern m2d__Anm_c__Load
+
+AnmLoadDebugHook:
+ stwu r1, -0x20(r1)
+ mflr r0
+ stw r0, 0x24(r1)
+ stw r21, 0x1C(r1)
+ stw r22, 0x18(r1)
+ stw r23, 0x14(r1)
+
+ mr r21, r3
+ mr r22, r4
+ mr r23, r5
+
+ lis r3, AnmLoadStr@h
+ ori r3, r3, AnmLoadStr@l
+ mr r4, r30 # anim num
+ mr r5, r29 # anim count
+ lwz r6, 0(r28) # rlan ID
+ mr r7, r21 # anim
+ mr r8, r22 # anmreshandler
+ mr r9, r23 # group name
+ crclr 4*cr1+eq
+ bl OSReport
+
+ mr r3, r21
+ mr r4, r22
+ mr r5, r23
+ bl m2d__Anm_c__Load
+
+ lwz r21, 0x1C(r1)
+ lwz r22, 0x18(r1)
+ lwz r23, 0x14(r1)
+ lwz r0, 0x24(r1)
+ mtlr r0
+ addi r1, r1, 0x20
+ blr
+
+
+.data
+.align 4
+AnmLoadStr: .string "[Anm %d/%d] Anm[%d] @ %p, ResHandler @ %p, Group: %s\n"
+RlanLoadStr: .string "[Rlan %d/%d] ResHandler: %p, Rlan Name: %s, ResAcc: %p, Layout: %p\n"
+#RlanGrpCount: .string "%d group(s):\n"
+RlanGroupStr: .string "--[%d/%d] %p : %s - AnimTransform: %p\n"
+BreakOnRlan: .string "fileSelectBase_18_DummyAnim.brlan"
+
diff --git a/src/levelinfo_old.h b/src/levelinfo_old.h
index 8e1e916..d8cb888 100644
--- a/src/levelinfo_old.h
+++ b/src/levelinfo_old.h
@@ -1,5 +1,5 @@
-#ifndef __NEWER_LEVELINFO_H
-#define __NEWER_LEVELINFO_H
+#ifndef __NEWER_LEVELINFO_OLD_H
+#define __NEWER_LEVELINFO_OLD_H
#include <common.h>
#include "fileload.h"
diff --git a/src/levelspecial.cpp b/src/levelspecial.cpp
index dc503e0..adadc50 100644
--- a/src/levelspecial.cpp
+++ b/src/levelspecial.cpp
@@ -19,12 +19,6 @@ struct LevelSpecial {
u8 func; // 0x3D7
};
-struct EventTable_t {
- u64 events;
- // ...
-};
-
-extern EventTable_t *EventTable;
extern u16 TimeStopFlag;
extern u32 TimerBranch;
@@ -50,7 +44,6 @@ float GlobalRiderFloatModifications [] = {1, 0.6, 0.7, 0.9, 1, 1, 1, 1.1, 1.25,
-extern "C" dAc_Py_c *GetSpecificPlayerActor(int number);
void LevelSpecial_Update(LevelSpecial *self);
bool ResetAfterLevel();
@@ -105,7 +98,7 @@ bool LevelSpecial_Execute(LevelSpecial *self) {
void LevelSpecial_Update(LevelSpecial *self) {
u8 newEvState = 0;
- if (EventTable->events & self->eventFlag)
+ if (dFlagMgr_c::instance->flags & self->eventFlag)
newEvState = 1;
if (newEvState == self->lastEvState)
diff --git a/src/linegod.cpp b/src/linegod.cpp
index c727de4..dedbea6 100644
--- a/src/linegod.cpp
+++ b/src/linegod.cpp
@@ -72,12 +72,6 @@ struct LineGod {
BgActor *ac[8]; // 0x3D8
};
-struct EventTable_t {
- u64 events;
- // ...
-};
-
-extern EventTable_t *EventTable;
fBase_c *FindActorByID(u32 id);
@@ -174,7 +168,7 @@ bool LineGod_AppendToList(LineGod *self, BgActor *ac) {
void LineGod_Update(LineGod *self) {
u8 newEvState = 0;
- if (EventTable->events & self->eventFlag)
+ if (dFlagMgr_c::instance->flags & self->eventFlag)
newEvState = 1;
if (newEvState == self->lastEvState)
diff --git a/src/meteor.cpp b/src/meteor.cpp
index 5eea95f..219bab3 100755
--- a/src/meteor.cpp
+++ b/src/meteor.cpp
@@ -4,8 +4,6 @@
#include <sfx.h>
#include "boss.h"
-extern "C" void *PlaySound(dStageActor_c *, int soundID);
-
class dMeteor : public dEn_c {
int onCreate();
int onDelete();
diff --git a/src/mrsun.cpp b/src/mrsun.cpp
index 86c5bfb..5b9130c 100755
--- a/src/mrsun.cpp
+++ b/src/mrsun.cpp
@@ -86,13 +86,6 @@ CREATE_STATE(daMrSun_c, Wait);
#define DEACTIVATE 0
-struct EventTable_t {
- u64 events;
- // ...
-};
-
-extern EventTable_t *EventTable;
-
void daMrSun_c::playerCollision(ActivePhysics *apThis, ActivePhysics *apOther) { DamagePlayer(this, apThis, apOther); }
@@ -253,7 +246,7 @@ int daMrSun_c::onExecute() {
acState.execute();
updateModelMatrices();
- if (EventTable->events & this->eventFlag) {
+ if (dFlagMgr_c::instance->flags & this->eventFlag) {
if (this->killFlag == 0) {
this->kill();
this->pos.y = this->pos.y + 800.0;
diff --git a/src/msgbox.cpp b/src/msgbox.cpp
index adbeb24..968b607 100644
--- a/src/msgbox.cpp
+++ b/src/msgbox.cpp
@@ -1,52 +1,9 @@
#include <common.h>
#include <game.h>
+#include "msgbox.h"
// Replaces: EN_LIFT_ROTATION_HALF (Sprite 107; Profile ID 481 @ 80AF96F8)
-class dMsgBoxManager_c : public dStageActor_c {
- public:
- void showMessage(int id);
-
- dMsgBoxManager_c() : state(this, &StateID_LoadRes) { }
-
- int onCreate();
- int onDelete();
- int onExecute();
- int onDraw();
-
- int beforeExecute() { return true; }
- int afterExecute(int) { return true; }
-
- m2d::EmbedLayout_c layout;
- dDvdLoader_c msgDataLoader;
-
- bool layoutLoaded;
- bool visible;
-
- dStateWrapper_c<dMsgBoxManager_c> state;
-
- USING_STATES(dMsgBoxManager_c);
- DECLARE_STATE(LoadRes);
- DECLARE_STATE(Wait);
- DECLARE_STATE(BoxAppearWait);
- DECLARE_STATE(ShownWait);
- DECLARE_STATE(BoxDisappearWait);
-
- static dMsgBoxManager_c *instance;
- static dMsgBoxManager_c *build();
-
- private:
- struct entry_s {
- u32 id;
- u32 titleOffset;
- u32 msgOffset;
- };
-
- struct header_s {
- u32 count;
- entry_s entry[1];
- };
-};
dMsgBoxManager_c *dMsgBoxManager_c::instance = 0;
dMsgBoxManager_c *dMsgBoxManager_c::build() {
@@ -322,7 +279,10 @@ daEnMsgBlock_c *daEnMsgBlock_c::build() {
void daEnMsgBlock_c::blockWasHit(bool isDown) {
pos.y = initialY;
- dMsgBoxManager_c::instance->showMessage(settings);
+ if (dMsgBoxManager_c::instance)
+ dMsgBoxManager_c::instance->showMessage(settings);
+ else
+ Delete(false);
physics.setup(this, &physicsInfo, 3, currentLayerID);
physics.addToList();
diff --git a/src/msgbox.h b/src/msgbox.h
new file mode 100644
index 0000000..f71749d
--- /dev/null
+++ b/src/msgbox.h
@@ -0,0 +1,52 @@
+#ifndef MSGBOX_H
+#define MSGBOX_H
+#include <common.h>
+#include <game.h>
+
+class dMsgBoxManager_c : public dStageActor_c {
+ public:
+ void showMessage(int id);
+
+ dMsgBoxManager_c() : state(this, &StateID_LoadRes) { }
+
+ int onCreate();
+ int onDelete();
+ int onExecute();
+ int onDraw();
+
+ int beforeExecute() { return true; }
+ int afterExecute(int) { return true; }
+ int beforeDraw() { return true; }
+ int afterDraw(int) { return true; }
+
+ m2d::EmbedLayout_c layout;
+ dDvdLoader_c msgDataLoader;
+
+ bool layoutLoaded;
+ bool visible;
+
+ dStateWrapper_c<dMsgBoxManager_c> state;
+
+ USING_STATES(dMsgBoxManager_c);
+ DECLARE_STATE(LoadRes);
+ DECLARE_STATE(Wait);
+ DECLARE_STATE(BoxAppearWait);
+ DECLARE_STATE(ShownWait);
+ DECLARE_STATE(BoxDisappearWait);
+
+ static dMsgBoxManager_c *instance;
+ static dMsgBoxManager_c *build();
+
+ private:
+ struct entry_s {
+ u32 id;
+ u32 titleOffset;
+ u32 msgOffset;
+ };
+
+ struct header_s {
+ u32 count;
+ entry_s entry[1];
+ };
+};
+#endif /* MSGBOX_H */
diff --git a/src/newer.cpp b/src/newer.cpp
new file mode 100644
index 0000000..6d672e2
--- /dev/null
+++ b/src/newer.cpp
@@ -0,0 +1,77 @@
+#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;
+}
+
+
+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"
+};
+
+// This is an array so it can be accessed from fileselect.S
+int NewerWorldCount[] = {
+ 18
+};
+
+const wchar_t *NewerWorldName(NWRWorld world) {
+ if (world < 0 || world >= WORLD_COUNT)
+ return L"Unknown World";
+ return NewerWorldNames[world];
+}
diff --git a/src/palaceDude.cpp b/src/palaceDude.cpp
new file mode 100644
index 0000000..6a8d7ff
--- /dev/null
+++ b/src/palaceDude.cpp
@@ -0,0 +1,51 @@
+#include <game.h>
+#include <stage.h>
+#include "msgbox.h"
+
+class dPalaceDude_c : public dStageActor_c {
+ public:
+ static dPalaceDude_c *build();
+
+ bool hasBeenActivated;
+ bool hasExitedStage;
+ int onExecute();
+};
+
+/*****************************************************************************/
+// Glue Code
+dPalaceDude_c *dPalaceDude_c::build() {
+ void *buffer = AllocFromGameHeap1(sizeof(dPalaceDude_c));
+ dPalaceDude_c *c = new(buffer) dPalaceDude_c;
+ return c;
+}
+
+
+int dPalaceDude_c::onExecute() {
+ if (dFlagMgr_c::instance->flags & spriteFlagMask) {
+ if (!hasBeenActivated) {
+// OSReport("Activating Palace Dude\n");
+ hasBeenActivated = true;
+
+ dMsgBoxManager_c::instance->showMessage(settings & 0xFFFFFFF);
+
+ SaveBlock *save = GetSaveFile()->GetBlock(-1);
+ *((u8*)(((u32)GameMgr)+0x380)) |= (1 << (settings >> 28));
+ }
+ }
+
+ if (hasBeenActivated) {
+ if (hasExitedStage)
+ return true;
+// OSReport("Palace Dude is activated, %d\n", dMsgBoxManager_c::instance->visible);
+ if (!dMsgBoxManager_c::instance->visible) {
+// OSReport("Exiting\n");
+ ExitStage(WORLD_MAP, 0, BEAT_LEVEL, MARIO_WIPE);
+ hasExitedStage = true;
+ }
+ }
+
+ return true;
+
+}
+
+
diff --git a/src/penguin.cpp b/src/penguin.cpp
index 2105291..6112285 100644
--- a/src/penguin.cpp
+++ b/src/penguin.cpp
@@ -63,10 +63,6 @@ daPengi *daPengi::build() {
///////////////////////
// Externs and States
///////////////////////
- extern "C" void *PlaySound(dStageActor_c *, int soundID);
-
- extern "C" dStageActor_c *CreateActor(u16 classID, int settings, Vec pos, char rot, char layer);
- extern "C" u8 dSprite_c__getXDirectionOfFurthestPlayerRelativeToVEC3(daPengi *, Vec pos);
//FIXME make this dEn_c->used...
extern "C" char usedForDeterminingStatePress_or_playerCollision(dEn_c* t, ActivePhysics *apThis, ActivePhysics *apOther, int unk1);
diff --git a/src/player.h b/src/player.h
index 267729f..e1bbed5 100644
--- a/src/player.h
+++ b/src/player.h
@@ -4,7 +4,6 @@
#include <common.h>
#include <game.h>
-extern "C" dStageActor_c* GetSpecificPlayerActor(int number);
char NearestPlayer(dStageActor_c* actor);
void setNewActivePhysicsRect(dStageActor_c* actor, Vec* scale);
void changeActivePhysicsRect(dStageActor_c* actor, float xc, float yc, float xe, float ye);
diff --git a/src/pumpkinGoomba.cpp b/src/pumpkinGoomba.cpp
index 7b46af9..426d323 100644
--- a/src/pumpkinGoomba.cpp
+++ b/src/pumpkinGoomba.cpp
@@ -59,8 +59,6 @@ dGoombaPie *dGoombaPie::build() {
///////////////////////
// Externs and States
///////////////////////
- extern "C" void *PlaySound(dStageActor_c *, int soundID);
- extern "C" void *PlaySoundAsync(dStageActor_c *, int soundID);
extern "C" void *EN_LandbarrelPlayerCollision(dEn_c* t, ActivePhysics *apThis, ActivePhysics *apOther);
extern "C" int SmoothRotation(short* rot, u16 amt, int unk2);
extern "C" char usedForDeterminingStatePress_or_playerCollision(dEn_c* t, ActivePhysics *apThis, ActivePhysics *apOther, int unk1);
@@ -132,19 +130,7 @@ dGoombaPie *dGoombaPie::build() {
doStateChange(&StateID_Burst);
}
- struct DoSomethingCool {
- u32 unk_01; //0000
- Vec3 pos; //0004
- Vec3 scale; //0010
- f32 unk_02; //001C
- f32 unk_03; //0020
- f32 unk_04; //0024
- f32 unk_05; //0028
- f32 unk_06; //002C
- f32 unk_07; //0030
- f32 unk_08; //0034
- f32 unk_09; //0038
- } goombIceBlock;
+ DoSomethingCool goombIceBlock;
extern "C" void sub_80024C20(void);
extern "C" void __destroy_arr(void*, void(*)(void), int, int);
diff --git a/src/shyguy.cpp b/src/shyguy.cpp
index 213caa8..174b075 100644
--- a/src/shyguy.cpp
+++ b/src/shyguy.cpp
@@ -147,13 +147,8 @@ daShyGuy *daShyGuy::build() {
///////////////////////
// Externs and States
///////////////////////
- extern "C" void *PlaySound(dStageActor_c *, int soundID);
- extern "C" void *PlaySoundAsync(dStageActor_c *, int soundID);
extern "C" bool SpawnEffect(const char*, int, Vec*, S16Vec*, Vec*);
- extern "C" dStageActor_c *CreateActor(u16 classID, int settings, Vec pos, char rot, char layer);
- extern "C" u8 dSprite_c__getXDirectionOfFurthestPlayerRelativeToVEC3(daShyGuy *, Vec pos);
-
//FIXME make this dEn_c->used...
extern "C" char usedForDeterminingStatePress_or_playerCollision(dEn_c* t, ActivePhysics *apThis, ActivePhysics *apOther, int unk1);
extern "C" int SomeStrangeModification(dStageActor_c* actor);
diff --git a/src/spritespawner.cpp b/src/spritespawner.cpp
index 56ac383..4be86a3 100755
--- a/src/spritespawner.cpp
+++ b/src/spritespawner.cpp
@@ -19,9 +19,6 @@ struct SpriteSpawner {
u32 createdActor;
};
-struct EventTable_t {
- u64 events;
-};
struct VEC {
@@ -31,9 +28,6 @@ struct VEC {
};
-extern EventTable_t *EventTable;
-extern "C" dStageActor_c *CreateActor(u16 classID, int settings, VEC pos, char rot, char layer);
-extern "C" dStageActor_c *Actor_SearchByID(u32 actorID);
void SpriteSpawner_Update(SpriteSpawner *self);
@@ -67,13 +61,13 @@ bool SpriteSpawner_Execute(SpriteSpawner *self) {
void SpriteSpawner_Update(SpriteSpawner *self) {
- if (EventTable->events & self->eventFlag)
+ if (dFlagMgr_c::instance->flags & self->eventFlag)
{
// Put an action for when the event turns on here
if (self->createdActor == 0)
{
- VEC pos;
+ Vec pos;
pos.x = self->x;
pos.y = self->y;
pos.z = self->z;
diff --git a/src/spriteswapper.cpp b/src/spriteswapper.cpp
index 89ead56..3fc78e0 100755
--- a/src/spriteswapper.cpp
+++ b/src/spriteswapper.cpp
@@ -16,19 +16,12 @@ public:
u32 timer;
};
-struct EventTable_t {
- u64 events;
-};
-
SpriteSpawnerTimed *SpriteSpawnerTimed::build() {
void *buffer = AllocFromGameHeap1(sizeof(SpriteSpawnerTimed));
return new(buffer) SpriteSpawnerTimed;
}
-extern EventTable_t *EventTable;
-extern "C" dStageActor_c *CreateActor(u16 classID, int settings, Vec pos, char rot, char layer);
-
int SpriteSpawnerTimed::onCreate() {
@@ -48,7 +41,7 @@ int SpriteSpawnerTimed::onCreate() {
int SpriteSpawnerTimed::onExecute() {
- if (EventTable->events & this->eventFlag) { // If the event is on
+ if (dFlagMgr_c::instance->flags & this->eventFlag) { // If the event is on
if (this->timer < 1) { // If the timer is empty
CreateActor(this->type, this->inheritSet, this->pos, 0, 0);
this->timer = 120;
@@ -62,4 +55,4 @@ int SpriteSpawnerTimed::onExecute() {
}
return true;
-} \ No newline at end of file
+}
diff --git a/src/topman.cpp b/src/topman.cpp
index edf75dd..5a313ae 100644
--- a/src/topman.cpp
+++ b/src/topman.cpp
@@ -73,13 +73,8 @@ daTopman *daTopman::build() {
///////////////////////
// Externs and States
///////////////////////
- extern "C" void *PlaySound(dStageActor_c *, int soundID);
- extern "C" void *PlaySoundAsync(dStageActor_c *, int soundID);
extern "C" void *EN_LandbarrelPlayerCollision(dEn_c* t, ActivePhysics *apThis, ActivePhysics *apOther);
- extern "C" dStageActor_c *CreateActor(u16 classID, int settings, Vec pos, char rot, char layer);
- extern "C" u8 dSprite_c__getXDirectionOfFurthestPlayerRelativeToVEC3(daTopman *, Vec pos);
-
//FIXME make this dEn_c->used...
extern "C" char usedForDeterminingStatePress_or_playerCollision(dEn_c* t, ActivePhysics *apThis, ActivePhysics *apOther, int unk1);
extern "C" int SmoothRotation(short* rot, u16 amt, int unk2);
@@ -194,19 +189,7 @@ daTopman *daTopman::build() {
doStateChange(&StateID_Die);
}
- struct DoSomethingCool {
- u32 unk_01; //0000
- Vec3 pos; //0004
- Vec3 scale; //0010
- f32 unk_02; //001C
- f32 unk_03; //0020
- f32 unk_04; //0024
- f32 unk_05; //0028
- f32 unk_06; //002C
- f32 unk_07; //0030
- f32 unk_08; //0034
- f32 unk_09; //0038
- } my_struct;
+ DoSomethingCool my_struct;
extern "C" void sub_80024C20(void);
extern "C" void __destroy_arr(void*, void(*)(void), int, int);
diff --git a/switchblock.yaml b/switchblock.yaml
index 6f142b2..e18fda8 100644
--- a/switchblock.yaml
+++ b/switchblock.yaml
@@ -1,5 +1,5 @@
---
-source_files: [../src/switchblock.S]
+source_files: [../src/switchblock.S, ../src/palaceDude.cpp]
hooks:
- name: PrepareReplay_SwitchPatch
type: patch
@@ -30,3 +30,16 @@ hooks:
target_func: 'CheckBehaviourOverride_EndPatch'
+
+ - name: BuildPalaceDude
+ type: add_func_pointer
+ src_addr_pal: 0x809838E4
+ target_func: 'dPalaceDude_c::build(void)'
+
+ - name: PalaceDudeSpriteInfo
+ type: patch
+ addr_pal: 0x8030CDE8
+ # Orig 02EB 0000 00000000 00000000 00000000 00000000 00000100 00000100 0000 0000 0000 0000 0800 0000'
+ data: '02A7 0000 00000010 00000010 00000000 00000000 00000200 00000200 0000 0000 0200 0200 0000 0000'
+ # 0x8030A340 + sprite num * 0x28 == offset
+
diff --git a/tools/UsedProfileAndSpriteList.txt b/tools/UsedProfileAndSpriteList.txt
new file mode 100644
index 0000000..8011339
--- /dev/null
+++ b/tools/UsedProfileAndSpriteList.txt
@@ -0,0 +1,160 @@
+[Commented] 210 : TARZAN_ROPE : Pengi
+--- : MOVIE : Cut Scene
+--- : WM_BOARD : Shop Item
+--- : WM_DANCE_PAKKUN : HUD
+--- : WM_GHOST : Star Coin Screen
+--- : WM_MAP : Map
+--- : WM_PAKKUN : Captain Bowser: Clown Shot
+--- : WM_PLAYER : Player
+--- : WM_SINKSHIP : Song Prize
+--- : WM_SMALLCLOUD : Bridge Bowser: Dropped Bomb
+--- : WM_TOGEZO : Shop
+--- : WORLD_CAMERA : World Camera
+--- : WORLD_MAP : Koopatlas
+ 10 : WM_ANCHOR : Captain Bowser: Koopa Throw
+ 11 : WM_KOOPA_CASTLE : Make Your Own
+ 12 : WM_KURIBO : Challenge Star
+ 13 : JR_CLOWN_FOR_PLAYER : Captain Bowser: Clown Car
+ 14 : WM_ANTLION : Captain Bowser: Koopa Flamethrower
+ 15 : WM_KILLERBULLET : Sing Along
+ 16 : WM_CLOUD : Bridge Bowser: Bomb Drop
+ 17 : WM_KILLER : Song Block
+ 18 : WM_BOSS_IGGY : Bone Piece
+ 19 : WM_PUKU : Samurshai
+ 22 : WM_KINOKO_STAR : Pumpkin Goomba
+ 49 : AC_LIFT_SEESAW : Fake Star Coin
+ 79 : EN_HELPOS : Event Looper
+ 88 : EN_BOYON : Sprite Spawner
+ 89 : EN_REMOCON_TORIMOCHI : Sprite Swapper Timed
+107 : EN_LIFT_ROTATION_HALF : Message Box Manager
+152 : EN_BLUR : Message Block
+169 : EN_SLIP_PENGUIN : Magic Platform
+183 : EN_TARZANROPE : Meteor
+210 : TARZAN_ROPE : Topman
+213 : BRANCH : Captain Bowser
+239 : MIST_INTERMITTENT : Event Block
+244 : RIVER_MGR : Line God
+246 : TAG_THUNDER : Level Special
+250 : KAWANAGARE : Electric Line
+251 : SLOW_QUICK_TAG : Topman Boss
+273 : WM_KINOBALLOON : Palace Activator
+282 : EN_WALLINSECT : Mr Sun
+283 : WALLINSECT_MGR : Fuzzy Bear
+290 : EN_IWAO : Ramboo
+302 : EN_GAKE_NOKO : Wrench
+322 : EN_GHOST_JUGEM : Thwomp Boss
+324 : SHIP_WINDOW : Podouble
+332 : LIFT_TORIDE_ROLL : Effect Video
+350 : DUMMY_DOOR_PARENT : Fire Laser
+351 : DUMMY_DOOR_CHILD : Shy Guy
+410 : AC_BLOCK_GROUP : Mega Goomba
+XXX : AC_LIFT_ICE_SPRING : Balboa Wrench
+
+
+
+-- All Replaced Profiles --
+AC_BLOCK_GROUP
+AC_LIFT_ICE_SPRING
+AC_LIFT_SEESAW
+BRANCH
+DUMMY_DOOR_CHILD
+DUMMY_DOOR_PARENT
+EN_BLUR
+EN_BOYON
+EN_GAKE_NOKO
+EN_GHOST_JUGEM
+EN_HELPOS
+EN_IWAO
+EN_LIFT_ROTATION_HALF
+EN_REMOCON_TORIMOCHI
+EN_SLIP_PENGUIN
+EN_TARZANROPE
+EN_WALLINSECT
+JR_CLOWN_FOR_PLAYER
+KAWANAGARE
+LIFT_TORIDE_ROLL
+MIST_INTERMITTENT
+MOVIE
+RIVER_MGR
+SHIP_WINDOW
+SLOW_QUICK_TAG
+TAG_THUNDER
+TARZAN_ROPE
+WALLINSECT_MGR
+WM_ANCHOR
+WM_ANTLION
+WM_BOARD
+WM_BOSS_IGGY
+WM_CLOUD
+WM_DANCE_PAKKUN
+WM_GHOST
+WM_KILLER
+WM_KILLERBULLET
+WM_KINOBALLOON
+WM_KINOKO_STAR
+WM_KOOPA_CASTLE
+WM_KURIBO
+WM_MAP
+WM_PAKKUN
+WM_PLAYER
+WM_PUKU
+WM_PUKU
+WM_SINKSHIP
+WM_SMALLCLOUD
+WM_TOGEZO
+WORLD_CAMERA
+WORLD_MAP
+
+
+
+-- World Map Processes Free for Use: --
+WM_ANTLION_MNG
+WM_BOSS_BASE
+WM_BOSS_KAMECK
+WM_BOSS_LARRY
+WM_BOSS_LEMMY
+WM_BOSS_LUDWIG
+WM_BOSS_MORTON
+WM_BOSS_ROY
+WM_BOSS_WENDY
+WM_BROS
+WM_BUBBLE
+WM_CANNON
+WM_CASTLE
+WM_COURSE
+WM_CS_SEQ_MNG
+WM_CS_W3_PALM
+WM_DIRECTOR
+WM_DOKAN
+WM_DOKANROUTE
+WM_GRID
+WM_HANACHAN
+WM_IBARA
+WM_ISLAND
+WM_JUGEM
+WM_KINOKO_1UP
+WM_KINOKO_BASE
+WM_KINOKO_RED
+WM_KINOPIO
+WM_KOOPAJR
+WM_KOOPASHIP
+WM_MANTA
+WM_NOTE
+WM_PAKKUNHEAD
+WM_PEACH
+WM_PEACH_CASTLE
+WM_SANDPILLAR
+WM_START
+WM_STOP
+WM_SUBPLAYER
+WM_SURRENDER
+WM_SWITCH
+WM_TERESA
+WM_TEST
+WM_TEST2
+WM_TORIDE
+WM_TOWER
+WM_TREASURESHIP
+WM_YOGANPILLAR
+WORLD_SELECT
+WORLD_SELECT_GUIDE
diff --git a/tools/kamek.py b/tools/kamek.py
index ee67a5a..a82740f 100644
--- a/tools/kamek.py
+++ b/tools/kamek.py
@@ -35,10 +35,11 @@ show_cmd = False
delete_temp = True
override_config_file = None
only_build = None
+fast_hack = False
def parse_cmd_options():
- global use_rels, use_mw, use_wine, show_cmd, delete_temp, only_build
+ global use_rels, use_mw, use_wine, show_cmd, delete_temp, only_build, fast_hack
global override_config_file, gcc_type, gcc_path, mw_path
if '--no-rels' in sys.argv:
@@ -56,7 +57,9 @@ def parse_cmd_options():
if '--keep-temp' in sys.argv:
delete_temp = False
-
+ if '--fast-hack' in sys.argv:
+ fast_hack = True
+
only_build = []
@@ -408,6 +411,11 @@ class KamekBuilder(object):
self._moduleFiles = []
+
+ if fast_hack:
+ fast_cpp_path = os.path.join(self._configTempDir, 'fasthack.cpp')
+ fast_cpp = open(fast_cpp_path, 'w')
+
for m in self.project.modules:
for normal_sourcefile in m.data['source_files']:
print_debug('Compiling %s : %s' % (m.moduleName, normal_sourcefile))
@@ -421,6 +429,11 @@ class KamekBuilder(object):
# todo: better extension detection
if sourcefile.endswith('.s') or sourcefile.endswith('.S'):
command = as_command
+ elif sourcefile.endswith('.cpp') and fast_hack:
+ fast_cpp.write('//\n// %s\n//\n\n' % sourcefile)
+ fast_cpp.write(open(sourcefile, 'r').read())
+ fast_cpp.write('\n')
+ continue
else:
command = cc_command
@@ -440,6 +453,24 @@ class KamekBuilder(object):
self._moduleFiles.append(objfile)
+ if fast_hack:
+ fast_cpp.close()
+
+ print_debug('Fast compilation!!')
+ objfile = os.path.join(self._configTempDir, 'fasthack.o')
+
+ new_command = cc_command + ['-c', '-o', objfile, fast_cpp_path]
+ if show_cmd:
+ print_debug(new_command)
+
+ errorVal = subprocess.call(new_command)
+ if errorVal != 0:
+ print 'BUILD FAILED!'
+ print 'compiler returned %d - an error occurred while compiling the fast hack' % errorVal
+ sys.exit(1)
+
+ self._moduleFiles.append(objfile)
+
print_debug('Compilation complete')