diff options
author | Colin Noga <Tempus@chronometry.ca> | 2012-03-08 15:38:03 -0600 |
---|---|---|
committer | Colin Noga <Tempus@chronometry.ca> | 2012-03-08 15:38:03 -0600 |
commit | e1e747c5d256570a3d8caf459e24274397de7235 (patch) | |
tree | 1658ec435748c6575d5e219184d5eeb87e329b22 | |
parent | 19632e9b183402bb9a05030e12d0f1003765c31a (diff) | |
download | kamek-e1e747c5d256570a3d8caf459e24274397de7235.tar.gz kamek-e1e747c5d256570a3d8caf459e24274397de7235.zip |
Electric line, topman boss, and BROKEN YOSHIS
Diffstat (limited to '')
-rw-r--r-- | NewerProject.yaml | 2 | ||||
-rwxr-xr-x | include/game.h | 11 | ||||
-rw-r--r-- | kamek_pal.x | 9 | ||||
-rw-r--r-- | spriteswapper.yaml | 8 | ||||
-rw-r--r-- | src/bossPodouble.cpp | 2 | ||||
-rw-r--r-- | src/bossThwompaDomp.cpp | 13 | ||||
-rw-r--r-- | src/effects.cpp | 6 | ||||
-rwxr-xr-x | src/spriteswapper.cpp | 243 | ||||
-rw-r--r-- | src/topman.cpp | 119 |
9 files changed, 185 insertions, 228 deletions
diff --git a/NewerProject.yaml b/NewerProject.yaml index 6726764..d92577c 100644 --- a/NewerProject.yaml +++ b/NewerProject.yaml @@ -39,10 +39,12 @@ modules: - processed/bossBalboaWrench.yaml - processed/bossWrenchThrow.yaml - processed/bossPodouble.yaml + - processed/bossTopman.yaml - processed/effectVideo.yaml - processed/fakeStarCoin.yaml - processed/shyguy.yaml - processed/meteor.yaml - processed/topman.yaml + - processed/electricLine.yaml # - processed/pengi.yaml # - processed/actorlog.yaml diff --git a/include/game.h b/include/game.h index 7c10d05..271b0a5 100755 --- a/include/game.h +++ b/include/game.h @@ -2146,6 +2146,17 @@ public: };
+class daNeedles : public dEn_c {
+
+public:
+ USING_STATES(daNeedles);
+ REF_NINTENDO_STATE(DemoWait);
+ REF_NINTENDO_STATE(DemoAwake);
+ REF_NINTENDO_STATE(Idle);
+ REF_NINTENDO_STATE(Die);
+};
+
+
class dPlayer : public dActorMultiState_c {
public:
diff --git a/kamek_pal.x b/kamek_pal.x index c5c5790..bd8c1d9 100644 --- a/kamek_pal.x +++ b/kamek_pal.x @@ -73,6 +73,11 @@ SECTIONS { StateID_DemoSt__12daKameckDemo = 0x80999C44; StateID_DemoWait__12daKameckDemo = 0x80999C84; + StateID_DemoWait__9daNeedles = 0x8099CF8C; + StateID_DemoAwake__9daNeedles = 0x8099CFD0; + StateID_Idle__9daNeedles = 0x8099D010; + StateID_Die__9daNeedles = 0x8099D050; + StateID_None__7dPlayer = 0x8035451C; StateID_Walk__7dPlayer = 0x8035455C; StateID_Jump__7dPlayer = 0x8035459C; @@ -217,6 +222,8 @@ SECTIONS { __construct_new_array = 0x802DCAD0; __destroy_new_array = 0x802DCE00; + __destroy_arr = 0x802DCD88; + sub_80024C20 = 0x80024C20; __register_global_object = 0x802DCA70; __ptmf_scall = 0x802DCEEC; @@ -244,7 +251,7 @@ SECTIONS { doSomethingCool1__11freezeMgr_c = 0x800b85a0; doSomethingCool2__11freezeMgr_c = 0x800b8670; setSomething__11freezeMgr_cFUiUiUi = 0x800b8740; - Create_ICEACTORs__11freezeMgr_c = 0x800b8750; + Create_ICEACTORs__11freezeMgr_cFPvi = 0x800b8750; Delete_ICEACTORs__11freezeMgr_c = 0x800b88a0; SetIceTimer_pt1__11freezeMgr_c = 0x800b8920; SetIceTimer_pt2__11freezeMgr_c = 0x800b8980; diff --git a/spriteswapper.yaml b/spriteswapper.yaml index 38e0160..b5f882c 100644 --- a/spriteswapper.yaml +++ b/spriteswapper.yaml @@ -3,13 +3,13 @@ source_files: [../src/spriteSwapper.cpp] hooks: - - name: SpriteSwapper_Create + - name: SpriteSpawnerTimed_Create type: add_func_pointer src_addr_pal: 0x80B05E28 - target_func: 'SpriteSwapper_Create(SpriteSwapper *)' + target_func: 'SpriteSpawnerTimed_Create(SpriteSpawnerTimed *)' - - name: SpriteSwapper_Execute + - name: SpriteSpawnerTimed_Execute type: add_func_pointer src_addr_pal: 0x80B05E40 - target_func: 'SpriteSwapper_Execute(SpriteSwapper *)' + target_func: 'SpriteSpawnerTimed_Execute(SpriteSpawnerTimed *)'
\ No newline at end of file diff --git a/src/bossPodouble.cpp b/src/bossPodouble.cpp index 663781e..77dae1a 100644 --- a/src/bossPodouble.cpp +++ b/src/bossPodouble.cpp @@ -289,8 +289,6 @@ int daPodouble::onCreate() { this->aPhysics.initWithStruct(this, &HitMeBaby); this->aPhysics.addToList(); - this->disableEatIn(); - doStateChange(&StateID_Grow); OSReport("Going to Execute Podouble\n"); diff --git a/src/bossThwompaDomp.cpp b/src/bossThwompaDomp.cpp index fb8d59e..89f2c14 100644 --- a/src/bossThwompaDomp.cpp +++ b/src/bossThwompaDomp.cpp @@ -60,6 +60,7 @@ class daEnMegaDosun_c : public dEn_c { void setupBodyModel(); + void playerCollision(ActivePhysics *apThis, ActivePhysics *apOther); void collisionCat1_Fireball_E_Explosion(ActivePhysics *apThis, ActivePhysics *apOther); bool collisionCat2_IceBall_15_YoshiIce(ActivePhysics *apThis, ActivePhysics *apOther); void collisionCat7_WMWaggleWater(ActivePhysics *apThis, ActivePhysics *apOther); @@ -96,6 +97,18 @@ daEnMegaDosun_c *daEnMegaDosun_c::build() { // Collisions + + void daEnMegaDosun_c::playerCollision(ActivePhysics *apThis, ActivePhysics *apOther) { + this->dEn_c::playerCollision(apThis, apOther); + this->_vf220(apOther->owner); + + // fix multiple player collisions via megazig + this->isDead = 0; + this->flags_4FC |= (1<<(31-7)); + if(apOther->owner->which_player < 4) { + this->counter_504[apOther->owner->which_player] = 0; + } + } void daEnMegaDosun_c::collisionCat1_Fireball_E_Explosion(ActivePhysics *apThis, ActivePhysics *apOther) { } bool daEnMegaDosun_c::collisionCat2_IceBall_15_YoshiIce(ActivePhysics *apThis, ActivePhysics *apOther) { return false; } void daEnMegaDosun_c::collisionCat7_WMWaggleWater(ActivePhysics *apThis, ActivePhysics *apOther) { } diff --git a/src/effects.cpp b/src/effects.cpp index c54678c..6da7177 100644 --- a/src/effects.cpp +++ b/src/effects.cpp @@ -1001,7 +1001,11 @@ const char* effects_name_list [] = { "Wm_bg_volcano_a", "Wm_bg_volcano_b", "Wm_ob_treasureboxwait_a", - "Wm_ob_treasureboxwait_b" + "Wm_ob_treasureboxwait_b", + "Wm_jr_electricstart", + "Wm_jr_electricglow", + "Wm_jr_electricspark", + "Wm_jr_electricline" }; extern "C" bool SpawnEffect(const char*, int, Vec*, S16Vec*, Vec*); diff --git a/src/spriteswapper.cpp b/src/spriteswapper.cpp index a158efc..945da34 100755 --- a/src/spriteswapper.cpp +++ b/src/spriteswapper.cpp @@ -1,7 +1,7 @@ #include <common.h> #include <game.h> -struct SpriteSwapper { +struct SpriteSpawnerTimed { u32 id; // 0x00 u32 settings; // 0x04 u16 name; // 0x08 @@ -12,19 +12,11 @@ struct SpriteSwapper { float z; // 0xB4 u8 _B8[0x318]; // 0xB8 // Any variables you add to the class go here; starting at offset 0x3D0 - u64 eventFlag; - u64 alteventFlag; - u8 alteventState; - u8 alteventTrue; - u16 firstType; - u16 secondType; - u8 lastEvState; - u32 spawnedActor; - u16 spawn; - u16 spawned; - u8 direction; - Vec speed; - S16Vec rot; + u64 eventFlag; // 0x3D0 + u16 type; // 0x3D4 + u32 inheritSet; // 0x3D6 + u8 lastEvState; // 0x3DA + u32 timer; }; struct EventTable_t { @@ -32,15 +24,18 @@ struct EventTable_t { }; +struct VEC { + float x; + float y; + float z; +}; extern EventTable_t *EventTable; -extern "C" dStageActor_c *CreateActor(u16 classID, int settings, Vec pos, char rot, char layer); +extern "C" dStageActor_c *CreateActor(u16 classID, int settings, VEC pos, char rot, char layer); extern "C" dStageActor_c *Actor_SearchByID(u32 actorID); -void SpriteSwapper_Update(SpriteSwapper *self); -void SpriteSwapper_CopyAndDestroy(SpriteSwapper *self, dStageActor_c *actor); -void SpriteSwapper_SpawnActor(SpriteSwapper *self, u16 newActorName); +void SpriteSpawnerTimed_Update(SpriteSpawnerTimed *self); #define ACTIVATE 1 #define DEACTIVATE 0 @@ -48,208 +43,52 @@ void SpriteSwapper_SpawnActor(SpriteSwapper *self, u16 newActorName); -bool SpriteSwapper_Create(SpriteSwapper *self) { +bool SpriteSpawnerTimed_Create(SpriteSpawnerTimed *self) { OSReport("I exist, dammit!"); char eventNum = (self->settings >> 28) & 0xF; - char alteventNum = (self->settings >> 12) & 0xF; OSReport("Event to activate: %d", eventNum); - OSReport("AltEvent to activate: %d", alteventNum); self->eventFlag = (u64)1 << (eventNum - 1); - self->alteventFlag = (u64)1 << (alteventNum - 1); - self->spawnedActor = 0; - self->firstType = (self->settings >> 16) & 0xFFF; - self->secondType = self->settings & 0xFFF; - - self->alteventState = 0; - if (alteventNum > 0) - self->alteventTrue = 1; - else - self->alteventTrue = 0; - - Vec pos; - pos.x = self->x; - pos.y = self->y; - pos.z = self->z; - - OSReport("Spawning first sprite."); - - dStageActor_c *spawned = CreateActor(self->firstType, 0, pos, 0, 0); - self->spawnedActor = spawned->id; - self->spawned = self->firstType; - self->spawn = 0; - - OSReport("Spawned %d.", self->spawnedActor); - - SpriteSwapper_Update(self); + self->type = (self->settings >> 16) & 0xFFF; - return true; -} - -bool SpriteSwapper_Execute(SpriteSwapper *self) { - SpriteSwapper_Update(self); - return true; -} - - - -void SpriteSwapper_CopyAndDestroy(SpriteSwapper *self) { - - dStageActor_c *spawned = Actor_SearchByID(self->spawnedActor); - if (spawned != 0) { - OSReport("It's still alive."); - self->x = spawned->pos.x; - self->y = spawned->pos.y; - self->z = spawned->pos.z; - self->direction = spawned->direction; - self->speed = spawned->speed; - self->rot = spawned->rot; - //FIXME changed from fBase_c::Delete(void) to dStageActor_c::Delete(u8) - spawned->Delete(spawned->_390); + short tempSet = self->settings & 0xFFFF; + self->inheritSet = (tempSet & 3) | ((tempSet & 0xC) << 2) | ((tempSet & 0x30) << 4) | ((tempSet & 0xC0) << 6) | ((tempSet & 0x300) << 8) | ((tempSet & 0xC00) << 10) | ((tempSet & 0x3000) << 12) | ((tempSet & 0xC000) << 14); - self->spawnedActor = 0; - OSReport("Now it's deleted."); - } + self->timer = 0; + SpriteSpawnerTimed_Update(self); - else { - OSReport("Is dead, turn it off.... forever."); - self->spawn = 0; - } + return true; } - -void SpriteSwapper_SpawnActor(SpriteSwapper *self, u16 newActorName) { - - Vec pos; - pos.x = self->x; - pos.y = self->y; - pos.z = self->z; - - OSReport("Making sprite."); - dStageActor_c *spawner = CreateActor(newActorName, 0, pos, 0, 0); - self->spawnedActor = spawner->id; -// spawner->direction = self->direction; -// spawner->speed = self->speed; - -// OSReport("Direction is %d.", spawner->direction); -// OSReport("Initial Rotation is %x %x.", spawner->rot.y, spawner->_106.y); -// if (spawner->direction == 0) { -// spawner->rot.y = 0xF556 + spawner->rot.y; } -// else { -// spawner->rot.y = 0xC000; } -// OSReport("Current Rotation is %x %x.", spawner->rot.y, spawner->_106.y); - - - -//Direction is 1. -//Initial Rotation is ffffd556 -// -// Direction is 0. -//Initial Rotation is ffffc000 -// -//Direction is 0 -//Initial Rotation is ffffd556 - - - -// spawner->rot = self->rot; - OSReport("Spawned %d.", self->spawnedActor); - +bool SpriteSpawnerTimed_Execute(SpriteSpawnerTimed *self) { + SpriteSpawnerTimed_Update(self); + return true; } -void SpriteSwapper_Update(SpriteSwapper *self) { - - if (self->spawn != 0) - { - OSReport("Spawning %d.", self->spawn); - SpriteSwapper_SpawnActor(self, self->spawn); - self->spawned = self->spawn; - self->spawn = 0; - return; - } - - // Sprites alternate when event a is turned on or off. - if (self->alteventTrue == 0) - { - OSReport("Single Event Type."); - if (EventTable->events & self->eventFlag) - { - OSReport("Spawning Event is on."); - if (self->spawned == self->secondType) - { - OSReport("Second sprite already there."); - return; - } +void SpriteSpawnerTimed_Update(SpriteSpawnerTimed *self) { - OSReport("Event turned on."); - - self->spawn = self->secondType; - SpriteSwapper_CopyAndDestroy(self); - } - else + if (EventTable->events & self->eventFlag) + { + + if (self->timer == 0) { - OSReport("Spawning Event is off."); - if (self->spawned == self->firstType) - { - OSReport("First sprite already there."); - return; - } - - OSReport("Event turned off."); - - self->spawn = self->firstType; - SpriteSwapper_CopyAndDestroy(self); - } - } + VEC pos; + pos.x = self->x; + pos.y = self->y; + pos.z = self->z; - // Sprites alternate when event a or b is turned on. - else - { - OSReport("Dual Event Type. EventState is %d.", self->alteventState); - if (EventTable->events & self->eventFlag) - { - OSReport("First Event on, spawning is alteventState is 0."); - if (self->alteventState == 0) - { - if (self->spawned == self->secondType) - { - OSReport("Second sprite already there."); - return; - } - - OSReport("Event turned on."); - - self->spawn = self->secondType; - SpriteSwapper_CopyAndDestroy(self); - - EventTable->events = EventTable->events & ~self->alteventFlag; - self->alteventState = 1; - } - } - - if (EventTable->events & self->alteventFlag) - { - OSReport("Second Event on, spawning is alteventState is 1."); - if (self->alteventState == 1) - { - if (self->spawned == self->firstType) - { - OSReport("First sprite already there."); - return; - } - - OSReport("Alt Event turned on."); - - self->spawn = self->firstType; - SpriteSwapper_CopyAndDestroy(self); - - EventTable->events = EventTable->events & ~self->eventFlag; - self->alteventState = 0; - } - } + OSReport("Spawning Sprite: %d at %f,%f,%f\n", self->type, pos.x, pos.y, pos.z); + + dStageActor_c *spawned = CreateActor(self->type, self->inheritSet, pos, 0, 0); + self->timer = 120; + } } + else { + self->timer = 0; + } + self->timer--; } diff --git a/src/topman.cpp b/src/topman.cpp index 4509272..a255a82 100644 --- a/src/topman.cpp +++ b/src/topman.cpp @@ -27,6 +27,7 @@ class daTopman : public dEn_c { bool isBouncing; char isInSpace; char fromBehind; + char isWaiting; static daTopman *build(); @@ -51,10 +52,13 @@ class daTopman : public dEn_c { void _vf148(); void _vf14C(); + bool CreateIceActors(); + void addScoreWhenHit(void *other); USING_STATES(daTopman); DECLARE_STATE(Walk); DECLARE_STATE(Turn); + DECLARE_STATE(Wait); DECLARE_STATE(KnockBack); DECLARE_STATE(Die); }; @@ -81,6 +85,7 @@ daTopman *daTopman::build() { CREATE_STATE(daTopman, Walk); CREATE_STATE(daTopman, Turn); + CREATE_STATE(daTopman, Wait); CREATE_STATE(daTopman, KnockBack); CREATE_STATE(daTopman, Die); @@ -106,20 +111,18 @@ daTopman *daTopman::build() { hitType = usedForDeterminingStatePress_or_playerCollision(this, apThis, apOther, 0); if(hitType == 1) { // regular jump - apOther->someFlagByte |= 2; - this->dEn_c::playerCollision(apThis, apOther); this->_vf220(apOther->owner); } else if(hitType == 3) { // spinning jump or whatever? - apOther->someFlagByte |= 2; - this->dEn_c::playerCollision(apThis, apOther); this->_vf220(apOther->owner); } else if(hitType == 0) { EN_LandbarrelPlayerCollision(this, apThis, apOther); - if (this->direction == apOther->owner->direction) { - this->direction ^= 1; - this->fromBehind = 1; + if (this->pos.x > apOther->owner->pos.x) { + this->direction = 1; + } + else { + this->direction = 0; } doStateChange(&StateID_KnockBack); } @@ -163,6 +166,10 @@ daTopman *daTopman::build() { doStateChange(&StateID_Die); } + void daTopman::collisionCat13_Hammer(ActivePhysics *apThis, ActivePhysics *apOther) { + doStateChange(&StateID_Die); + } + void daTopman::collisionCatA_PenguinMario(ActivePhysics *apThis, ActivePhysics *apOther){ doStateChange(&StateID_KnockBack); } @@ -189,10 +196,35 @@ daTopman *daTopman::build() { doStateChange(&StateID_Die); } - void daTopman::collisionCat13_Hammer(ActivePhysics *apThis, ActivePhysics *apOther) { - 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; + + extern "C" void sub_80024C20(void); + extern "C" void __destroy_arr(void*, void(*)(void), int, int); + //extern "C" __destroy_arr(struct DoSomethingCool, void(*)(void), int cnt, int bar); + + bool daTopman::CreateIceActors() + { + struct DoSomethingCool my_struct = { 0, this->pos, {2.5, 2.5, 2.5}, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0 }; + this->frzMgr.Create_ICEACTORs( (void*)&my_struct, 1 ); + __destroy_arr( (void*)&my_struct, sub_80024C20, 0x3C, 1 ); + return true; } + void daTopman::addScoreWhenHit(void *other) {} + + bool daTopman::calculateTileCollisions() { // Returns true if sprite should turn, false if not. @@ -303,6 +335,7 @@ int daTopman::onCreate() { this->XSpeed = 0.8; this->isInSpace = this->settings & 0xF; + this->isWaiting = (this->settings >> 4) & 0xF; this->fromBehind = 0; ActivePhysics::Info HitMeBaby; @@ -352,7 +385,10 @@ int daTopman::onCreate() { // State Changers bindAnimChr_and_setUpdateRate("begoman_wait2", 1, 0.0, 1.0); - doStateChange(&StateID_Walk); + if (this->isWaiting == 0) { + doStateChange(&StateID_Walk); } + else { + doStateChange(&StateID_Wait); } this->onExecute(); return true; @@ -371,7 +407,6 @@ int daTopman::onExecute() { int daTopman::onDraw() { bodyModel.scheduleForDrawing(); - bodyModel._vf1C(); return true; } @@ -399,16 +434,20 @@ void daTopman::updateModelMatrices() { } void daTopman::executeState_Walk() { + PlaySound(this, SE_BOSS_JR_CROWN_JR_RIDE); // 5 + bool ret = calculateTileCollisions(); if (ret) { doStateChange(&StateID_Turn); } + bodyModel._vf1C(); if(this->chrAnimation.isAnimationDone()) { this->chrAnimation.setCurrentFrame(0.0); } } - void daTopman::endState_Walk() { } + void daTopman::endState_Walk() { this->timer += 1; } + /////////////// // Turn State @@ -419,6 +458,7 @@ void daTopman::updateModelMatrices() { } void daTopman::executeState_Turn() { + bodyModel._vf1C(); if(this->chrAnimation.isAnimationDone()) { this->chrAnimation.setCurrentFrame(0.0); } @@ -434,6 +474,34 @@ void daTopman::updateModelMatrices() { /////////////// +// Wait State +/////////////// + void daTopman::beginState_Wait() { + this->max_speed.x = 0; + this->speed.x = 0; + + this->max_speed.y = (this->isInSpace) ? -2.0 : -4.0; + this->speed.y = (this->isInSpace) ? -2.0 : -4.0; + this->y_speed_inc = (this->isInSpace) ? -0.09375 : -0.1875; + } + void daTopman::executeState_Wait() { + + PlaySound(this, SE_BOSS_JR_CROWN_JR_RIDE); // 5 + + bool ret = calculateTileCollisions(); + if (ret) { + doStateChange(&StateID_Turn); + } + + bodyModel._vf1C(); + if(this->chrAnimation.isAnimationDone()) { + this->chrAnimation.setCurrentFrame(0.0); + } + } + void daTopman::endState_Wait() { } + + +/////////////// // Die State /////////////// void daTopman::beginState_Die() { @@ -444,6 +512,9 @@ void daTopman::updateModelMatrices() { } void daTopman::executeState_Die() { + bodyModel._vf1C(); + + PlaySound(this, SE_EMY_MECHAKOOPA_DAMAGE); if(this->chrAnimation.isAnimationDone()) { this->kill(); this->Delete(1); @@ -457,24 +528,36 @@ void daTopman::updateModelMatrices() { /////////////// void daTopman::beginState_KnockBack() { bindAnimChr_and_setUpdateRate("begoman_damage", 1, 0.0, 0.75); - this->timer = 0; + this->max_speed.x = (this->direction) ? this->XSpeed*5.0 : -this->XSpeed*5.0; - this->speed.x = (direction) ? 4.0f : -4.0f; + this->speed.x = (this->direction) ? 4.0f : -4.0f; } void daTopman::executeState_KnockBack() { bool ret = calculateTileCollisions(); this->speed.x = this->speed.x / 1.1; + bodyModel._vf1C(); if(this->chrAnimation.isAnimationDone()) { - doStateChange(&StateID_Walk); + if (this->isWaiting == 0) { + doStateChange(&StateID_Walk); } + else { + doStateChange(&StateID_Wait); } } } void daTopman::endState_KnockBack() { - if (this->fromBehind == 0) { - this->direction ^= 1; } - this->fromBehind = 0; + if (this->rot.y == 0x2800) { + // CreateEffect(&this->pos, &(S16Vec){0,0,0}, &(Vec){1.0, 1.0, 1.0}, 175); + this->direction = 0; + } + else { + // CreateEffect(&this->pos, &(S16Vec){0,0,0}, &(Vec){1.0, 1.0, 1.0}, 192); + this->direction = 1; + } + // OSReport("Rotation: %x", this->rot.y); + // OSReport("Direction: %d", this->direction); + // this->direction ^= 1; bindAnimChr_and_setUpdateRate("begoman_wait2", 1, 0.0, 1.0); }
\ No newline at end of file |