From 7404c596e96bf18f458f10fb8f23ca6e1a25ca7d Mon Sep 17 00:00:00 2001 From: Treeki Date: Sun, 16 Sep 2012 04:59:03 +0200 Subject: go speed! a terrible hack to make builds far faster --- src/bonusRoom.cpp | 3 --- src/boss.h | 6 ------ src/bossCaptainBowser.cpp | 2 -- src/bossMegaGoomba.cpp | 1 - src/bossPodouble.cpp | 1 - src/bossRamboo.cpp | 10 +--------- src/bossThwompaDomp.cpp | 1 - src/challengeStar.cpp | 9 +-------- src/effectvideo.cpp | 9 +-------- src/electricLine.cpp | 4 ---- src/eventlooper.cpp | 21 +++++++-------------- src/fakeStarCoin.cpp | 1 - src/firelaser.cpp | 11 +---------- src/levelinfo_old.h | 4 ++-- src/levelspecial.cpp | 9 +-------- src/linegod.cpp | 8 +------- src/meteor.cpp | 2 -- src/mrsun.cpp | 9 +-------- src/penguin.cpp | 4 ---- src/player.h | 1 - src/pumpkinGoomba.cpp | 16 +--------------- src/shyguy.cpp | 5 ----- src/spritespawner.cpp | 10 ++-------- src/spriteswapper.cpp | 11 ++--------- src/topman.cpp | 19 +------------------ 25 files changed, 22 insertions(+), 155 deletions(-) (limited to 'src') 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 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 #include -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 #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 #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 -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/effectvideo.cpp b/src/effectvideo.cpp index d690263..24089ef 100644 --- a/src/effectvideo.cpp +++ b/src/effectvideo.cpp @@ -4,7 +4,6 @@ #include -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 -extern "C" void *PlaySound(dEn_c *, int soundID); extern "C" bool SpawnEffect(const char*, int, Vec*, S16Vec*, Vec*); 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/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 #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 #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/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 #include -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 64d98fc..1cc7a96 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); -- cgit v1.2.3