diff options
author | Treeki <treeki@gmail.com> | 2012-12-08 06:47:53 +0100 |
---|---|---|
committer | Treeki <treeki@gmail.com> | 2012-12-08 06:47:53 +0100 |
commit | 3e1eddbcca15042a7a63f29f5db3ce66237355b9 (patch) | |
tree | c71c3479d714df558e333f4120133b1c6c0aa9e6 | |
parent | e7801309b3862b052e6cb43946fea889cd297cd9 (diff) | |
download | kamek-3e1eddbcca15042a7a63f29f5db3ce66237355b9.tar.gz kamek-3e1eddbcca15042a7a63f29f5db3ce66237355b9.zip |
assorted updates and fixes
-rwxr-xr-x | include/game.h | 4 | ||||
-rw-r--r-- | kamek_pal.x | 3 | ||||
-rw-r--r-- | src/apDebug.cpp | 68 | ||||
-rw-r--r-- | src/bossMegaGoomba.cpp | 47 | ||||
-rw-r--r-- | src/koopatlas/mapmusic.cpp | 4 |
5 files changed, 106 insertions, 20 deletions
diff --git a/include/game.h b/include/game.h index 403d1b3..780b76c 100755 --- a/include/game.h +++ b/include/game.h @@ -2057,6 +2057,7 @@ public: static fBase_c *search(Actors name, fBase_c *previous = 0);
static fBase_c *search(u32 id);
+ static fBase_c *searchByBaseType(int type, fBase_c *previous);
};
class dBase_c : public fBase_c {
@@ -3582,5 +3583,8 @@ namespace nw4r { }
}
+
+extern float EnemyBounceValue;
+
#endif
diff --git a/kamek_pal.x b/kamek_pal.x index 6300912..5fcb316 100644 --- a/kamek_pal.x +++ b/kamek_pal.x @@ -1,8 +1,11 @@ SECTIONS { + EnemyBounceValue = 0x8042A5F0; + /* Scrolling is annoying, clown car goes here! */ search__7fBase_cFUi = 0x80162E40; search__7fBase_cF6ActorsP7fBase_c = 0x80162E90; + searchByBaseType__7fBase_cFiP7fBase_c = 0x80162EF0; AddStockPowerup = 0x800BB330; continueFromStrongBox2 = 0x808AAFD0; diff --git a/src/apDebug.cpp b/src/apDebug.cpp index f485474..ee31c28 100644 --- a/src/apDebug.cpp +++ b/src/apDebug.cpp @@ -241,4 +241,72 @@ void APDebugDrawer::drawXlu() { p = p->next; } + + + // Now, the hardest one.. CollisionMgr_c! + fBase_c *fb = 0; + while ((fb = fBase_c::searchByBaseType(2, fb))) { + u8 *testMe = ((u8*)fb) + 0x1EC; + if (*((u32*)testMe) != 0x8030F6D0) + continue; + + u32 uptr = (u32)fb; + u8 r = u8((uptr>>16)&0xFF)+0x20; + u8 g = u8((uptr>>8)&0xFF)-0x30; + u8 b = u8(uptr&0xFF)+0x80; + u8 a = 0xFF; + + dStageActor_c *ac = (dStageActor_c*)fb; + + sensorBase_s *sensors[4] = { + ac->collMgr.pBelowInfo, ac->collMgr.pAboveInfo, + ac->collMgr.pAdjacentInfo, ac->collMgr.pAdjacentInfo}; + + for (int i = 0; i < 4; i++) { + sensorBase_s *s = sensors[i]; + if (!s) + continue; + + float mult = (i == 3) ? -1.0f : 1.0f; + + switch (s->flags & SENSOR_TYPE_MASK) { + case SENSOR_POINT: + GXBegin(GX_POINTS, GX_VTXFMT0, 1); + GXPosition3f32( + ac->pos.x + (mult * (s->asPoint()->x / 4096.0f)), + ac->pos.y + (s->asPoint()->y / 4096.0f), + 8005.0f); + GXColor4u8(r,g,b,a); + GXEnd(); + break; + case SENSOR_LINE: + GXBegin(GX_LINES, GX_VTXFMT0, 2); + if (i < 2) { + GXPosition3f32( + ac->pos.x + (s->asLine()->lineA / 4096.0f), + ac->pos.y + (s->asLine()->distanceFromCenter / 4096.0f), + 8005.0f); + GXColor4u8(r,g,b,a); + GXPosition3f32( + ac->pos.x + (s->asLine()->lineB / 4096.0f), + ac->pos.y + (s->asLine()->distanceFromCenter / 4096.0f), + 8005.0f); + GXColor4u8(r,g,b,a); + } else { + GXPosition3f32( + ac->pos.x + (mult * (s->asLine()->distanceFromCenter / 4096.0f)), + ac->pos.y + (s->asLine()->lineA / 4096.0f), + 8005.0f); + GXColor4u8(r,g,b,a); + GXPosition3f32( + ac->pos.x + (mult * (s->asLine()->distanceFromCenter / 4096.0f)), + ac->pos.y + (s->asLine()->lineB / 4096.0f), + 8005.0f); + GXColor4u8(r,g,b,a); + } + GXEnd(); + break; + } + } + } } diff --git a/src/bossMegaGoomba.cpp b/src/bossMegaGoomba.cpp index 448c543..c2ef1c7 100644 --- a/src/bossMegaGoomba.cpp +++ b/src/bossMegaGoomba.cpp @@ -28,7 +28,7 @@ class daMegaGoomba_c : public dEn_c { float dying; lineSensor_s belowSensor; - pointSensor_s adjacentSensor; + lineSensor_s adjacentSensor; ActivePhysics leftTrapAPhysics, rightTrapAPhysics; ActivePhysics stalkAPhysics; @@ -130,38 +130,39 @@ void setNewActivePhysicsRect(daMegaGoomba_c *actor, Vec *scale) { actor->belowSensor.flags = SENSOR_LINE; actor->belowSensor.lineA = s32((amtX * -28.0f) * 4096.0f); actor->belowSensor.lineB = s32((amtX * 28.0f) * 4096.0f); - actor->belowSensor.distanceFromCenter = s32((amtY * 4) * 4096.0f); + actor->belowSensor.distanceFromCenter = 0; - actor->adjacentSensor.flags = SENSOR_POINT; - actor->adjacentSensor.x = s32((amtX * 32.0f) * 4096.0f); - actor->adjacentSensor.y = s32((amtY * 22.0f) * 4096.0f); + actor->adjacentSensor.flags = SENSOR_LINE; + actor->adjacentSensor.lineA = s32((amtY * 4.0f) * 4096.0f); + actor->adjacentSensor.lineB = s32((amtY * 32.0f) * 4096.0f); + actor->adjacentSensor.distanceFromCenter = s32((amtX * 46.0f) * 4096.0f); u8 cat1 = 3, cat2 = 0, bitfield1 = 0x6f, bitfield2 = 0xffbafffe; ActivePhysics::Info info = { - 0.0f, amtY*57.0f, amtX*14.0f, amtY*31.0f, + 0.0f, amtY*57.0f, amtX*20.0f, amtY*31.0f, cat1, cat2, bitfield1, bitfield2, 0, &dEn_c::collisionCallback}; actor->aPhysics.initWithStruct(actor, &info); // Original trapezium was -12,12 to -48,48 ActivePhysics::Info left = { - amtX*-28.0f, amtY*56.0f, amtX*14.0f, amtY*31.0f, + amtX*-32.0f, amtY*55.0f, amtX*12.0f, amtY*30.0f, cat1, cat2, bitfield1, bitfield2, 0, &dEn_c::collisionCallback}; actor->leftTrapAPhysics.initWithStruct(actor, &left); - actor->leftTrapAPhysics.trpValue0 = amtX * 14.0f; - actor->leftTrapAPhysics.trpValue1 = amtX * 14.0f; - actor->leftTrapAPhysics.trpValue2 = amtX * -14.0f; - actor->leftTrapAPhysics.trpValue3 = amtX * 14.0f; + actor->leftTrapAPhysics.trpValue0 = amtX * 12.0f; + actor->leftTrapAPhysics.trpValue1 = amtX * 12.0f; + actor->leftTrapAPhysics.trpValue2 = amtX * -12.0f; + actor->leftTrapAPhysics.trpValue3 = amtX * 12.0f; actor->leftTrapAPhysics.collisionCheckType = 3; ActivePhysics::Info right = { - amtX*28.0f, amtY*56.0f, amtX*14.0f, amtY*31.0f, + amtX*32.0f, amtY*55.0f, amtX*12.0f, amtY*30.0f, cat1, cat2, bitfield1, bitfield2, 0, &dEn_c::collisionCallback}; actor->rightTrapAPhysics.initWithStruct(actor, &right); - actor->rightTrapAPhysics.trpValue0 = amtX * -14.0f; - actor->rightTrapAPhysics.trpValue1 = amtX * -14.0f; - actor->rightTrapAPhysics.trpValue2 = amtX * -14.0f; - actor->rightTrapAPhysics.trpValue3 = amtX * 14.0f; + actor->rightTrapAPhysics.trpValue0 = amtX * -12.0f; + actor->rightTrapAPhysics.trpValue1 = amtX * -12.0f; + actor->rightTrapAPhysics.trpValue2 = amtX * -12.0f; + actor->rightTrapAPhysics.trpValue3 = amtX * 12.0f; actor->rightTrapAPhysics.collisionCheckType = 3; ActivePhysics::Info stalk = { @@ -247,7 +248,13 @@ void daMegaGoomba_c::playerCollision(ActivePhysics *apThis, ActivePhysics *apOth //unk=0 does _vfs, unk=1 does playSeCmnStep //char ret = usedForDeterminingStatePress_or_playerCollision(this, apThis, apOther, 0); + float saveBounce = EnemyBounceValue; + EnemyBounceValue = 5.2f; + char ret = usedForDeterminingStatePress_or_playerCollision(this, apThis, apOther, 2); + + EnemyBounceValue = saveBounce; + if(ret == 1) { // regular jump apOther->someFlagByte |= 2; if(this->takeHit(1)) { @@ -523,7 +530,9 @@ void daMegaGoomba_c::endState_Turn() { // Walk State void daMegaGoomba_c::beginState_Walk() { //inline this piece of code - this->direction = dSprite_c__getXDirectionOfFurthestPlayerRelativeToVEC3(this, this->pos); + //YOU SUCK, WHOEVER ADDED THIS LINE OF CODE AND MADE ME SPEND AGES + //HUNTING DOWN WHAT WAS BREAKING TURNING. -Treeki + //this->direction = dSprite_c__getXDirectionOfFurthestPlayerRelativeToVEC3(this, this->pos); this->speed.x = this->speed.z = 0.0; this->max_speed.x = (this->direction) ? -this->XSpeed : this->XSpeed; this->speed.y = -4.0; @@ -548,10 +557,10 @@ void daMegaGoomba_c::executeState_Walk() { this->doStateChange(&StateID_Turn); //this->acState.setField10ToOne(); } - u32 bitfield2 = this->collMgr.adjacentTileProps[this->direction]; + /*u32 bitfield2 = this->collMgr.adjacentTileProps[this->direction]; if(bitfield2) { this->doStateChange(&StateID_Turn); - } + }*/ DoStuffAndMarkDead(this, this->pos, 1.0); diff --git a/src/koopatlas/mapmusic.cpp b/src/koopatlas/mapmusic.cpp index 9998954..8890df5 100644 --- a/src/koopatlas/mapmusic.cpp +++ b/src/koopatlas/mapmusic.cpp @@ -71,8 +71,10 @@ void dKPMusic::execute() { if (!s_playing) return; - if (s_handle.GetSound() == 0) + if (s_handle.GetSound() == 0) { OSReport("SOUND IS NOT PLAYING!\n"); + return; + } if (s_countdownToSwitch >= 0) { s_countdownToSwitch--; |