summaryrefslogtreecommitdiff
path: root/src
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 /src
parent3fec1b6193724c0a7c5ca3ea95a9d88a7e19cd90 (diff)
downloadkamek-48a2b6726e313154b6bc94b3d02251599ec62b66.tar.gz
kamek-48a2b6726e313154b6bc94b3d02251599ec62b66.zip
implement custom choreography in the credits
Diffstat (limited to 'src')
-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();
+}
+
+