From 3764377091ad23145fbd92c769b78ce2f296900f Mon Sep 17 00:00:00 2001 From: Colin Noga Date: Sat, 24 Mar 2012 16:45:49 -0500 Subject: Changes to loads of shit, mostly bowser related --- bossCaptainBowser.yaml | 35 ++++++++++- kamek_pal.x | 1 + meteor.yaml | 6 ++ spritetex.yaml | 53 +++-------------- src/bossCaptainBowser.cpp | 147 +++++++++++++++++++++++++++++++++------------- src/bossKoopaThrow.cpp | 9 +++ src/bossPlayerClown.cpp | 27 +++++++++ src/meteor.cpp | 51 +++++++++++++++- src/spritetex.S | 112 ++++++----------------------------- 9 files changed, 256 insertions(+), 185 deletions(-) diff --git a/bossCaptainBowser.yaml b/bossCaptainBowser.yaml index b227ff4..3901aec 100644 --- a/bossCaptainBowser.yaml +++ b/bossCaptainBowser.yaml @@ -19,6 +19,16 @@ hooks: data: '00000010 00000010 00000000 00000000 00000200 00000200 0000 0000 0200 0200 0002 0000' # 0x8030A340 + sprite num * 0x28 == offset (+24 in this case) + - name: CaptainBowserSpriteFileInfo + type: add_func_pointer + src_addr_pal: 0x8031AEA0 + target_func: 'CBarcNameList' + + # 0x8031AB4C + sprite num * 0x4 == offset + # That offset stores a pointer to a table of pointers to strings, followed by four bytes of padding + # Each string is an arcname to load + + - name: KoopaThrowBuild type: add_func_pointer @@ -32,6 +42,13 @@ hooks: data: '029F 0000 00000010 00000010 00000000 00000000 00000020 00000020 0040 0040 0000 0000 0000 0000' # 0x8030A340 + sprite num * 0x28 == offset + - name: KoopaThrowSpriteFileInfo + type: add_func_pointer + src_addr_pal: 0x8031AB74 + target_func: 'KPTarcNameList' + # 0x8031AB4C + sprite num * 0x4 == offset + + - name: KFlameThrowerBuild type: add_func_pointer src_addr_pal: 0x80981A3C @@ -39,13 +56,14 @@ hooks: - name: UpdateKoopaThrowSpriteInfo type: patch - addr_pal: 0x8030A4F8 + addr_pal: 0x8030A570 # [011] ( 16, 16) ( 0, 0 32: 32) 64? 64? 0? 0? | [0:No Flags] data: '0271 0000 00000010 00000010 00000000 00000000 00000020 00000020 0040 0040 0000 0000 0000 0000' # 0x8030A340 + sprite num * 0x28 == offset + - name: ClownCarFloor type: patch addr_pal: 0x80810A40 @@ -62,6 +80,20 @@ hooks: data: '386017D0' # Replace 0x0FD0 which how much space I want to allocate + - name: UpdateClownCarSpriteInfo + type: patch + addr_pal: 0x8030A548 + data: '012B 0000' + # 0x8030A340 + sprite num * 0x28 == offset + + + + - name: ClownCarSpriteFileInfo + type: add_func_pointer + src_addr_pal: 0x8031AB80 + target_func: 'PCCarcNameList' + # 0x8031AB4C + sprite num * 0x4 == offset + # Official Funcs - name: ClownCarCtor @@ -102,7 +134,6 @@ hooks: - # Clown Shot - Replaces WM_PAKKUN - name: ClownShotBuild type: add_func_pointer diff --git a/kamek_pal.x b/kamek_pal.x index a8bc58a..866bee2 100644 --- a/kamek_pal.x +++ b/kamek_pal.x @@ -18,6 +18,7 @@ SECTIONS { sAllocatorFunc__FrmHeap = 0x8042E5B0; + GetActivePlayerCount = 0x8005FFB0; /* Back to other shit I didn't want to scroll for */ diff --git a/meteor.yaml b/meteor.yaml index b2be96d..4596902 100644 --- a/meteor.yaml +++ b/meteor.yaml @@ -15,3 +15,9 @@ hooks: # -ID- ---- -X Offs- -Y Offs- -RectX1- -RectY1- -RectX2- -RectY2- -1C- -1E- -20- -22- Flag ---- # Orig 01FC 0000 00000008 00000000 00000000 FFFFFFC0 00000010 00000040 0030 0030 0000 0000 0008 0000 data: '01FC 0000 00000008 00000000 00000008 00000000 00000200 00000200 0030 0030 0000 0000 0008 0000' + + - name: MeteorSpriteFileInfo + type: add_func_pointer + src_addr_pal: 0x8031AE28 + target_func: 'MEarcNameList' + # 0x8031AB4C + sprite num * 0x4 == offset diff --git a/spritetex.yaml b/spritetex.yaml index 7f18ecb..6d38857 100644 --- a/spritetex.yaml +++ b/spritetex.yaml @@ -411,52 +411,13 @@ hooks: target_func: 'TEX_PokeyNoSand' -# - name: TEX_PokeySnowmanPos -# type: branch_insn -# branch_type: bl -# src_addr_pal: 0x80A9F7C0 -# target_func: 'TEX_PokeySnowmanPos' -# -# - name: TEX_PokeySnowmanPosA -# type: branch_insn -# branch_type: bl -# src_addr_pal: 0x80A9FEF8 -# target_func: 'TEX_PokeySnowmanPosA' -# -# - name: TEX_PokeySnowmanPosB -# type: branch_insn -# branch_type: bl -# src_addr_pal: 0x80AA002C -# target_func: 'TEX_PokeySnowmanPosB' -# -# -# - name: TEX_PokeySnowmanPosC -# type: branch_insn -# branch_type: bl -# src_addr_pal: 0x80AA04D0 -# target_func: 'TEX_PokeySnowmanPosC' -# -# -# - name: TEX_PokeySnowmanPosD -# type: branch_insn -# branch_type: bl -# src_addr_pal: 0x80AA0644 -# target_func: 'TEX_PokeySnowmanPosD' -# -# - name: TEX_PokeySnowmanPosE -# type: branch_insn -# branch_type: bl -# src_addr_pal: 0x80AA0848 -# target_func: 'TEX_PokeySnowmanPosE' -# -# - name: TEX_PokeySnowmanPosF -# type: branch_insn -# branch_type: bl -# src_addr_pal: 0x80AA0A5C -# target_func: 'TEX_PokeySnowmanPosF' -# -# -# + # - name: TEX_PokeySnowmanPos + # type: branch_insn + # branch_type: bl + # src_addr_pal: 0x80A9F7C0 + # target_func: 'TEX_PokeySnowmanPos' + + # - name: TEX_PokeySnowmanPosZ # type: patch # data: '60000000' diff --git a/src/bossCaptainBowser.cpp b/src/bossCaptainBowser.cpp index bb73087..a9c36b4 100644 --- a/src/bossCaptainBowser.cpp +++ b/src/bossCaptainBowser.cpp @@ -7,28 +7,37 @@ -const char* effects_name_list [] = { - "Wm_jr_electricline", // cool - "Wm_jr_fireattack", // cool - "Wm_jr_firehit", // cool - "Wm_jr_fireplace", // cool - "Wm_jr_fireplace_ind", // cool - "Wm_jr_shot", - "Wm_jr_sweat", - "Wm_ko_fireattack", // cool - "Wm_ko_firehit", // cool - "Wm_ko_firehitdie01", // cool - "Wm_ko_firehitdie02", // cool - "Wm_ko_firehitdie03", // cool - "Wm_ko_magmapocha", - "Wm_ko_magmapochabig", - "Wm_ko_shout", // cool - "Wm_ko_shout02", // cool - "Wm_seacloudout", // cool +// const char* effects_name_list [] = { +// "Wm_jr_electricline", // cool +// "Wm_jr_fireattack", // cool +// "Wm_jr_firehit", // cool +// "Wm_jr_fireplace", // cool +// "Wm_jr_fireplace_ind", // cool +// "Wm_jr_shot", +// "Wm_jr_sweat", +// "Wm_ko_fireattack", // cool +// "Wm_ko_firehit", // cool +// "Wm_ko_firehitdie01", // cool +// "Wm_ko_firehitdie02", // cool +// "Wm_ko_firehitdie03", // cool +// "Wm_ko_magmapocha", +// "Wm_ko_magmapochabig", +// "Wm_ko_shout", // cool +// "Wm_ko_shout02", // cool +// "Wm_seacloudout", // cool +// }; + + +const char* CBarcNameList [] = { + "KoopaShip", + "koopa", + "choropoo", + "koopa_clown_bomb", + "dossun", + NULL }; - class daCaptainBowser : public daBoss { public: int onCreate(); @@ -50,13 +59,19 @@ public: ActivePhysics Roar; mEf::es2 effect; + mEf::es2 shipDmgA; + mEf::es2 shipDmgB; + mEf::es2 shipDmgC; + mEf::es2 shipDmgD; + mEf::es2 shipDmgE; + char isAngry; char isInvulnerable; float scaleIncreaser; - // int isInvulnerableCountdown; - // int isTurningCountdown; - // char charging; - // int flashing; + int homingBillCountdown; + int homingBillSlot; + int maxDamage; + int playerCount; static daCaptainBowser *build(); @@ -85,18 +100,18 @@ daCaptainBowser *daCaptainBowser::build() { return new(buffer) daCaptainBowser; } -void ShipPhysicsCallback(daCaptainBowser *self, dStageActor_c *other) { +void ShipPhysicsCallback(daCaptainBowser *self, dEn_c *other) { if (other->name == 657) { OSReport("CANNON COLLISION"); if (self->isInvulnerable) { return; } - self->damage += 1; + self->damage -= 1; - if (self->damage == 10) { self->doStateChange(&daCaptainBowser::StateID_Roar); } - else if (self->damage > 20) { self->doStateChange(&daCaptainBowser::StateID_Outro); } - else { self->doStateChange(&daCaptainBowser::StateID_Damage); } + other->doStateChange(&dEn_c::StateID_DieFumi); + if (self->damage == self->maxDamage/2) { self->doStateChange(&daCaptainBowser::StateID_Roar); } + else if (self->damage < 0) { self->doStateChange(&daCaptainBowser::StateID_Outro); } } } @@ -104,6 +119,8 @@ void ShipPhysicsCallback(daCaptainBowser *self, dStageActor_c *other) { // Externs and States /////////////////////// + extern "C" u32 GetActivePlayerCount(); + CREATE_STATE(daCaptainBowser, Wait); CREATE_STATE(daCaptainBowser, Throw); CREATE_STATE(daCaptainBowser, Fire); @@ -126,11 +143,15 @@ void ShipPhysicsCallback(daCaptainBowser *self, dStageActor_c *other) { if (this->isInvulnerable) { return; } - this->damage += 1; + this->damage -= 1; + + spawnHitEffectAtPosition((Vec2){apOther->owner->pos.x, apOther->owner->pos.y}); + + ((dEn_c*)(apOther->owner))->doStateChange(&dEn_c::StateID_DieFumi); - if (this->damage == 10) { doStateChange(&StateID_Roar); } - else if (this->damage > 20) { doStateChange(&StateID_Outro); } - else { doStateChange(&StateID_Damage); } + if (this->damage == this->maxDamage/2) { doStateChange(&StateID_Roar); } + else if (this->damage < 0) { doStateChange(&StateID_Outro); } + else { doStateChange(&StateID_Damage); } } } @@ -178,8 +199,15 @@ int daCaptainBowser::onCreate() { allocator.unlink(); // Prep the goods + this->playerCount = GetActivePlayerCount(); + this->maxDamage = (10* this->playerCount) +10; + + this->scale = (Vec){0.57, 0.57, 0.57}; - + this->homingBillCountdown = 270; + this->homingBillSlot = 0; + + this->damage = this->maxDamage; // Ship Physics! // Normal rects are { left, top, right, bottom } @@ -253,6 +281,43 @@ int daCaptainBowser::onExecute() { bodyModel._vf1C(); shipModel._vf1C(); + + this->homingBillCountdown--; + + if (this->homingBillCountdown == 0) { + + Vec tempPos; + + switch (this->homingBillSlot) { + case 0: + this->homingBillSlot++; + tempPos.x = this->pos.x - 26.0; + tempPos.y = this->pos.y + 40.0; + tempPos.z = this->pos.z + 2000.0; + break; + + case 1: + this->homingBillSlot++; + tempPos.x = this->pos.x + 22.0; + tempPos.y = this->pos.y + 40.0; + tempPos.z = this->pos.z + 2000.0; + break; + + case 2: + this->homingBillSlot = 0; + tempPos.x = this->pos.x + 70.0; + tempPos.y = this->pos.y + 40.0; + tempPos.z = this->pos.z + 2000.0; + break; + } + + SpawnEffect("Wm_en_killervanish", 0, &tempPos, &(S16Vec){0,0,0}, &(Vec){0.1, 0.1, 0.1}); + PlaySoundAsync(this, SE_EMY_SR_KILLER_SHOT); + CreateActor(EN_SEARCH_KILLER, 0, tempPos, 0, 0); + + this->homingBillCountdown = (isAngry) ? 90: 180; + } + if(this->shipAnm.isAnimationDone()) { this->shipAnm.setCurrentFrame(0.0); } @@ -407,10 +472,10 @@ int daCaptainBowser::onDraw() { this->timer = 0; this->scaleIncreaser = 0.5; - this->Roar.info.xDistToEdge = 70.0 * scaleIncreaser; - this->Roar.info.yDistToEdge = 70.0 * scaleIncreaser; + // this->Roar.info.xDistToEdge = 70.0 * scaleIncreaser; + // this->Roar.info.yDistToEdge = 70.0 * scaleIncreaser; - this->Roar.addToList(); + // this->Roar.addToList(); } void daCaptainBowser::executeState_Roar() { @@ -422,13 +487,13 @@ int daCaptainBowser::onDraw() { scaleIncreaser += 0.014285; effect.spawn("Wm_ko_shout", 0, &(Vec){pos.x-186.0+(scaleIncreaser*16.0), pos.y+138.0+(scaleIncreaser*16.0), pos.z}, &(S16Vec){0,0,0x7000}, &(Vec){scaleIncreaser, scaleIncreaser, scaleIncreaser}); - this->Roar.info.xDistToEdge = 70.0 * scaleIncreaser; - this->Roar.info.yDistToEdge = 70.0 * scaleIncreaser; + // this->Roar.info.xDistToEdge = 70.0 * scaleIncreaser; + // this->Roar.info.yDistToEdge = 70.0 * scaleIncreaser; } - if (this->chrAnimation.getCurrentFrame() == 197.0) { // This is where the smackdown ends - this->Roar.removeFromList(); - } + // if (this->chrAnimation.getCurrentFrame() == 197.0) { // This is where the smackdown ends + // this->Roar.removeFromList(); + // } if (this->chrAnimation.isAnimationDone()) { doStateChange(&StateID_Wait); diff --git a/src/bossKoopaThrow.cpp b/src/bossKoopaThrow.cpp index 821a848..a8e1b0a 100644 --- a/src/bossKoopaThrow.cpp +++ b/src/bossKoopaThrow.cpp @@ -29,6 +29,15 @@ static const TypeInfo types[6] = { }; +const char* KPTarcNameList [] = { + "choropoo", + "koopa_clown_bomb", + "dossun", + "KoopaShip", + NULL +}; + + class daKoopaThrow : public dEn_c { int onCreate(); int onExecute(); diff --git a/src/bossPlayerClown.cpp b/src/bossPlayerClown.cpp index 522314e..6a7e2fc 100644 --- a/src/bossPlayerClown.cpp +++ b/src/bossPlayerClown.cpp @@ -21,6 +21,16 @@ extern "C" int PClownCarDraw(dEn_c *clown); extern "C" void PClownCarMove(dEn_c *clown); + + +const char* PCCarcNameList [] = { + "koopaJr_clown_ply", + NULL +}; + + + + int CConDraw(dEn_c *clown) { // setup cannon model clown->matrix.translation(clown->pos.x, clown->pos.y + 8.0, clown->pos.z-100.0); @@ -196,6 +206,22 @@ int daClownShot::onCreate() { this->aPhysics.initWithStruct(this, &GreatBalls); this->aPhysics.addToList(); + + // These fucking rects do something for the tile rect + spriteSomeRectX = 8.0f; + spriteSomeRectY = 8.0f; + _320 = 0.0f; + _324 = 0.0f; + + // These structs tell stupid collider what to collide with - these are from koopa troopa + static const u8 one[16] = {0,0,0,1, 0,0,0xC0,0, 0,0,0x40,0, 0,0,0,0}; + static const u8 two[12] = {0,0,0,0, 0,0,0,0, 0,0,0xC0,0}; + static const u8 three[16] = {0,0,0,1, 0,0,0x60,0, 0,0,0x90,0, 0,0,0x60,0}; + + collMgr.Init(this, one, two, three); + collMgr.execute(); + + this->speed.y = 4.0; this->y_speed_inc = -0.1875; @@ -221,6 +247,7 @@ int daClownShot::onExecute() { HandleXSpeed(); HandleYSpeed(); doSpriteMovement(); + collMgr.execute(); effect.spawn("Wm_en_killersmoke", 0, &(Vec){pos.x, pos.y, pos.z}, &(S16Vec){0,0,0}, &(Vec){0.7, 0.7, 0.7}); diff --git a/src/meteor.cpp b/src/meteor.cpp index 7d3a9bd..5eea95f 100755 --- a/src/meteor.cpp +++ b/src/meteor.cpp @@ -1,8 +1,12 @@ #include #include #include +#include +#include "boss.h" -class dMeteor : public dStageActor_c { +extern "C" void *PlaySound(dStageActor_c *, int soundID); + +class dMeteor : public dEn_c { int onCreate(); int onDelete(); int onExecute(); @@ -13,14 +17,18 @@ class dMeteor : public dStageActor_c { mHeapAllocator_c allocator; m3d::mdl_c bodyModel; nw4r::g3d::ResFile resFile; + mEf::es2 effect; int timer; int spinSpeed; char spinDir; + char isElectric; Physics MakeItRound; void updateModelMatrices(); + void playerCollision(ActivePhysics *apThis, ActivePhysics *apOther); + void collisionCat7_WMWaggleWater(ActivePhysics *apThis, ActivePhysics *apOther); }; dMeteor *dMeteor::build() { @@ -28,11 +36,24 @@ dMeteor *dMeteor::build() { return new(buffer) dMeteor; } +const char* MEarcNameList [] = { + "kazan_rock", + NULL +}; // extern "C" dStageActor_c *GetSpecificPlayerActor(int num); // extern "C" void *modifyPlayerPropertiesWithRollingObject(dStageActor_c *Player, float _52C); +void dMeteor::playerCollision(ActivePhysics *apThis, ActivePhysics *apOther) { + DamagePlayer(this, apThis, apOther); +} + +void dMeteor::collisionCat7_WMWaggleWater(ActivePhysics *apThis, ActivePhysics *apOther) { + DamagePlayer(this, apThis, apOther); +} + + int dMeteor::onCreate() { // Setup Model @@ -55,8 +76,29 @@ int dMeteor::onCreate() { // Other settings this->spinDir = this->settings & 0x1; this->spinSpeed = ((this->settings >> 16) & 0xFF) * 20; - + this->isElectric = (this->settings >> 4) & 0x1; + + // Setup Physics + if (isElectric) { + ActivePhysics::Info elec; + elec.xDistToCenter = 0.0; + elec.yDistToCenter = 0.0; + + elec.xDistToEdge = 13.0 * sca; + elec.yDistToEdge = 13.0 * sca; + + elec.category1 = 0x3; + elec.category2 = 0x0; + elec.bitfield1 = 0x4F; + elec.bitfield2 = 0x200; + elec.unkShort1C = 0; + elec.callback = &dEn_c::collisionCallback; + + this->aPhysics.initWithStruct(this, &elec); + this->aPhysics.addToList(); + } + MakeItRound.baseSetup(this, 0, 0, 0, 1, 0); MakeItRound.x = 0.0; @@ -87,6 +129,11 @@ int dMeteor::onExecute() { MakeItRound.update(); updateModelMatrices(); + if (isElectric) { + effect.spawn("Wm_en_birikyu_biri", 0, &(Vec){pos.x, pos.y, pos.z+500.0}, &rot, &(Vec){scale.x*0.8, scale.y*0.8, scale.z*0.8}); + PlaySound(this, SE_EMY_BIRIKYU_SPARK); + } + // for (i=0; i<4; i++) { // dStageActor_c *player = GetSpecificPlayerActor(i); // modifyPlayerPropertiesWithRollingObject(player, ); diff --git a/src/spritetex.S b/src/spritetex.S index 452d3d2..18a09e1 100755 --- a/src/spritetex.S +++ b/src/spritetex.S @@ -524,111 +524,35 @@ TEX_PokeySnowman: slwi r10, r10, 2 # size *= 4 (size of float) lfsx f0, r11, r10 # get it from the array - blr - - -SnowmanPokey: - - lfs f0, 0x54(r31) - blr - - - - -.global TEX_PokeySnowmanPosF -TEX_PokeySnowmanPosF: - - lwz r10, 4(r31) - andi. r10, r10, 0xF - - lis r11, SnowmanTable@h - ori r11, r11, SnowmanTable@l - slwi r10, r10, 2 # size *= 4 (size of float) - lfsx f2, r11, r10 # get it from the array - - fmuls f0, f0, f2 - stfs f0, 0xB0(r30) - blr - -.global TEX_PokeySnowmanPosE -TEX_PokeySnowmanPosE: - - lwz r10, 4(r31) - andi. r10, r10, 0xF - - lis r11, SnowmanTable@h - ori r11, r11, SnowmanTable@l - slwi r10, r10, 2 # size *= 4 (size of float) - lfsx f2, r11, r10 # get it from the array + # We should probably change ActivePhysics and maybe some other rects here + addi r10, r30, 0x148 - fmuls f31, f31, f2 - stfs f31, 0xB0(r29) - blr + lfs f10, 0(r10) + fmuls f10, f0, f10 + stfs f10, 0(r10) -.global TEX_PokeySnowmanPosD -TEX_PokeySnowmanPosD: + lfs f10, 4(r10) + fmuls f10, f0, f10 + stfs f10, 4(r10) - lwz r10, 4(r31) - andi. r10, r10, 0xF + lfs f10, 8(r10) + fmuls f10, f0, f10 + stfs f10, 8(r10) - lis r11, SnowmanTable@h - ori r11, r11, SnowmanTable@l - slwi r10, r10, 2 # size *= 4 (size of float) - lfsx f2, r11, r10 # get it from the array + lfs f10, 0xC(r10) + fmuls f10, f0, f10 + stfs f10, 0xC(r10) - fmuls f1, f1, f2 - stfs f1, 0xB0(r30) blr + +SnowmanPokey: -.global TEX_PokeySnowmanPosC -TEX_PokeySnowmanPosC: - - lwz r10, 4(r31) - andi. r10, r10, 0xF - - lis r11, SnowmanTable@h - ori r11, r11, SnowmanTable@l - slwi r10, r10, 2 # size *= 4 (size of float) - lfsx f2, r11, r10 # get it from the array - - fmuls f0, f0, f2 - stfs f0, 0xB0(r31) - blr - - -.global TEX_PokeySnowmanPosB -TEX_PokeySnowmanPosB: - - lwz r10, 4(r31) - andi. r10, r10, 0xF - - lis r11, SnowmanTable@h - ori r11, r11, SnowmanTable@l - slwi r10, r10, 2 # size *= 4 (size of float) - lfsx f0, r11, r10 # get it from the array - - fmuls f1, f1, f0 - stfs f1, 0x18(r1) + lfs f0, 0x54(r31) blr -.global TEX_PokeySnowmanPosA -TEX_PokeySnowmanPosA: - - lwz r10, 4(r31) - andi. r10, r10, 0xF - - lis r11, SnowmanTable@h - ori r11, r11, SnowmanTable@l - slwi r10, r10, 2 # size *= 4 (size of float) - lfsx f0, r11, r10 # get it from the array - - fmuls f3, f3, f0 - stfs f3, 0x168(r31) - blr - .global TEX_PokeySnowmanPos TEX_PokeySnowmanPos: @@ -1277,7 +1201,7 @@ ConvertFloat: SnowmanTable: - .float 1.0, 1.5, 2.0, 2.5, 3.0, 3.5, 4.0, 4.5, 5.0, 5.5, 6.0, 6.5 + .float 1.0, 1.333, 1.666, 2.0, 2.333, 2.666, 3.0, 3.333, 3.666, 4.0, 4.333, 4.666 AddAmount: .float 32.0 -- cgit v1.2.3