summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTreeki <treeki@gmail.com>2013-04-16 18:45:03 +0200
committerTreeki <treeki@gmail.com>2013-04-16 18:45:03 +0200
commit48a2b6726e313154b6bc94b3d02251599ec62b66 (patch)
tree0d6429e2bd235994a45670d10d9a9ce19cd49af4
parent3fec1b6193724c0a7c5ca3ea95a9d88a7e19cd90 (diff)
downloadkamek-48a2b6726e313154b6bc94b3d02251599ec62b66.tar.gz
kamek-48a2b6726e313154b6bc94b3d02251599ec62b66.zip
implement custom choreography in the credits
Diffstat (limited to '')
-rw-r--r--creditsMgr.yaml6
-rw-r--r--kamek_pal.x5
-rw-r--r--replay.yaml12
-rw-r--r--src/creditsMgr.cpp59
4 files changed, 77 insertions, 5 deletions
diff --git a/creditsMgr.yaml b/creditsMgr.yaml
index c1c44c7..0b29ad9 100644
--- a/creditsMgr.yaml
+++ b/creditsMgr.yaml
@@ -28,6 +28,12 @@ hooks:
# Disable existing coinjump crap
- {name: DisableCreditsCrap6, type: patch, addr_pal: 0x80A2AC58, data: '38000000'}
+ - name: LoadDanceValues
+ type: branch_insn
+ branch_type: b
+ src_addr_pal: 0x8006A1B4
+ target_func: 'LoadDanceValues(void)'
+
# - name: EFBMagic
# type: branch_insn
# branch_type: b
diff --git a/kamek_pal.x b/kamek_pal.x
index 9e55779..0f7bbb4 100644
--- a/kamek_pal.x
+++ b/kamek_pal.x
@@ -1,4 +1,9 @@
SECTIONS {
+ DanceValues_AnimSpeed = 0x80427C2E;
+ DanceValues_DummyBlockAndGrass = 0x8042A049;
+ DanceValues_Bahps = 0x8042A04A;
+ DanceValues_CreditsControl = 0x8042A04B;
+
CreditsModeActive = 0x8042A4FF;
GetRail = 0x800D91B0;
instance__7Stage80 = 0x8042A2E8;
diff --git a/replay.yaml b/replay.yaml
index c60d848..4801f22 100644
--- a/replay.yaml
+++ b/replay.yaml
@@ -10,11 +10,13 @@ hooks:
branch_type: bl
src_addr_pal: 0x80102238
target_func: 'replayEnd'
- - name: ReplayHookRecord
- type: branch_insn
- branch_type: b
- src_addr_pal: 0x8006A1B4
- target_func: 'replayRecord'
+ # this is commented out because it's called by the creditsMgr's dance value
+ # loader; due to a conflict
+ # - name: ReplayHookRecord
+ # type: branch_insn
+ # branch_type: b
+ # src_addr_pal: 0x8006A1B4
+ # target_func: 'replayRecord'
# - name: LuigiOverride
# type: branch_insn
# branch_type: b
diff --git a/src/creditsMgr.cpp b/src/creditsMgr.cpp
index bcd48f8..f625667 100644
--- a/src/creditsMgr.cpp
+++ b/src/creditsMgr.cpp
@@ -42,6 +42,11 @@ extern "C" void *MakeMarioExitDemoMode();
extern void *SoundRelatedClass;
+extern u16 DanceValues_AnimSpeed; // 80427C2E
+extern u8 DanceValues_DummyBlockAndGrass; // 8042A049
+extern u8 DanceValues_Bahps; // 8042A04A
+extern u8 DanceValues_CreditsControl; // 8042A04B
+
class dFlipbookRenderer_c : public m3d::proc_c {
public:
dFlipbookRenderer_c();
@@ -64,6 +69,11 @@ class dFlipbookRenderer_c : public m3d::proc_c {
void loadNewBG(int bgID, bool isBackface);
};
+struct danceInfo_s {
+ u32 when;
+ u8 animSpeed, dummyBlockFlag, bahpFlag, creditsFlag;
+};
+
class dCreditsMgr_c : public dActorState_c {
public:
int onCreate();
@@ -98,6 +108,9 @@ class dCreditsMgr_c : public dActorState_c {
int fauxScrollFrame;
float fauxScrollMinX, fauxScrollMaxX, fauxScrollY;
+ danceInfo_s *danceCommand;
+ int danceTimer;
+
nw4r::lyt::TextBox
*Title, *TitleS,
*Name, *NameS,
@@ -167,6 +180,8 @@ int dCreditsMgr_c::onCreate() {
}
int dCreditsMgr_c::onDelete() {
+ instance = 0;
+
isLockPlayerRotation = false;
scriptLoader.unload();
@@ -174,6 +189,10 @@ int dCreditsMgr_c::onDelete() {
}
extern "C" bool SpawnEffect(const char*, int, Vec*, S16Vec*, Vec*);
int dCreditsMgr_c::onExecute() {
+ danceTimer++;
+ if (danceCommand == 0)
+ danceCommand = (danceInfo_s*)getResource("CreditsBG", "/Dance.bin");
+
char *autoscrInfo = ((char*)dBgGm_c::instance) + 0x900AC;
fauxScrollFrame++;
@@ -921,3 +940,43 @@ dFlipbookRenderer_c::~dFlipbookRenderer_c() {
+extern "C" void replayRecord();
+
+void LoadDanceValues() {
+ //OSReport("AnmSpd: %4d / DBAG: 0x%02x / Bahp: 0x%02x / Cred: 0x%02x\n",
+ // DanceValues_AnimSpeed, DanceValues_DummyBlockAndGrass, DanceValues_Bahps, DanceValues_CreditsControl);
+ if (DanceValues_CreditsControl > 0)
+ OSReport("[ORIG DANCE] Credits Control: 0x%02x\n", DanceValues_CreditsControl);
+ // if (DanceValues_DummyBlockAndGrass > 0)
+ // OSReport("[ORIG DANCE] DummyBlockAndGrass: 0x%02x\n", DanceValues_DummyBlockAndGrass);
+ if (DanceValues_Bahps > 0)
+ OSReport("[ORIG DANCE] Bahps: 0x%02x\n", DanceValues_Bahps);
+
+ dCreditsMgr_c *cred = dCreditsMgr_c::instance;
+
+ if (!cred)
+ return;
+ danceInfo_s *cmd = cred->danceCommand;
+ if (!cmd)
+ return;
+ //OSReport("TIMER: %d\n", cred->danceTimer);
+
+ if (cred->danceTimer == cmd->when) {
+ OSReport("Timer reached %d, triggering dance 0x%02x, next is at %d\n", cmd->when, cmd->bahpFlag, cmd[1].when);
+ DanceValues_AnimSpeed = cmd->animSpeed;
+ DanceValues_DummyBlockAndGrass = cmd->dummyBlockFlag;
+ DanceValues_Bahps = cmd->bahpFlag;
+ DanceValues_CreditsControl = cmd->creditsFlag;
+
+ cred->danceCommand++;
+ } else {
+ DanceValues_AnimSpeed = 120;
+ DanceValues_DummyBlockAndGrass = 0;
+ DanceValues_Bahps = 0;
+ DanceValues_CreditsControl = 0;
+ }
+
+ replayRecord();
+}
+
+