summaryrefslogtreecommitdiff
path: root/src/creditsMgr.cpp
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--src/creditsMgr.cpp59
1 files changed, 59 insertions, 0 deletions
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();
+}
+
+