diff options
author | Treeki <treeki@gmail.com> | 2012-10-29 12:08:11 +0100 |
---|---|---|
committer | Treeki <treeki@gmail.com> | 2012-10-29 12:08:11 +0100 |
commit | 4e43d350d71fcbd90bc8e647aa53fc5152bb1de8 (patch) | |
tree | 16d2c84eab74a0b8eb26d58bc0050c2d8b7cd82c | |
parent | dd90d6a3cbd0288a1138122106b9f4f819f5bbba (diff) | |
download | kamek-4e43d350d71fcbd90bc8e647aa53fc5152bb1de8.tar.gz kamek-4e43d350d71fcbd90bc8e647aa53fc5152bb1de8.zip |
quick API update, and flipblock finished
Diffstat (limited to '')
-rwxr-xr-x | include/game.h | 3 | ||||
-rw-r--r-- | kamek_pal.x | 3 | ||||
-rw-r--r-- | src/apDebug.cpp | 7 | ||||
-rw-r--r-- | src/flipblock.cpp | 33 |
4 files changed, 45 insertions, 1 deletions
diff --git a/include/game.h b/include/game.h index bb64d4e..5dd8aa5 100755 --- a/include/game.h +++ b/include/game.h @@ -1882,6 +1882,9 @@ public: bool hasUninitialisedProcesses(); // 80162B60
fBase_c *findNextUninitialisedProcess();
+
+ static fBase_c *search(Actors name, fBase_c *previous = 0);
+ static fBase_c *search(u32 id);
};
class dBase_c : public fBase_c {
diff --git a/kamek_pal.x b/kamek_pal.x index 24e1348..66af909 100644 --- a/kamek_pal.x +++ b/kamek_pal.x @@ -1,6 +1,9 @@ SECTIONS { /* Scrolling is annoying, clown car goes here! */ + search__7fBase_cFUi = 0x80162E40; + search__7fBase_cF6ActorsP7fBase_c = 0x80162E90; + _8042A788 = 0x8042A788; somethingAboutSound__FPv = 0x8019CB30; diff --git a/src/apDebug.cpp b/src/apDebug.cpp index f534e58..a352d4a 100644 --- a/src/apDebug.cpp +++ b/src/apDebug.cpp @@ -109,6 +109,13 @@ void APDebugDrawer::drawXlu() { ActivePhysics *ap = ActivePhysics::globalListHead; while (ap) { +// if (ap->owner->name == PLAYER) +// OSReport("Player has : DistToC=%f,%f DistToEdge=%f,%f Pos=%f,%f Scale=%f,%f\n", +// ap->info.xDistToCenter, ap->info.yDistToCenter, +// ap->info.xDistToEdge, ap->info.yDistToEdge, +// ap->owner->pos.x, ap->owner->pos.y, +// ap->owner->scale.x, ap->owner->scale.y); + u32 uptr = (u32)ap; u8 r = (uptr>>16)&0xFF; u8 g = (uptr>>8)&0xFF; diff --git a/src/flipblock.cpp b/src/flipblock.cpp index a9db0fa..64e6aed 100644 --- a/src/flipblock.cpp +++ b/src/flipblock.cpp @@ -17,6 +17,8 @@ public: void blockWasHit(bool isDown); + bool playerOverlaps(); + mHeapAllocator_c allocator; nw4r::g3d::ResFile resFile; m3d::mdl_c model; @@ -171,7 +173,8 @@ void daEnFlipBlock_c::executeState_Flipping() { if (rot.x == 0) { flipsRemaining--; if (flipsRemaining <= 0) { - doStateChange(&StateID_Wait); + if (!playerOverlaps()) + doStateChange(&StateID_Wait); } } } @@ -180,3 +183,31 @@ void daEnFlipBlock_c::endState_Flipping() { physics.addToList(); } + + +bool daEnFlipBlock_c::playerOverlaps() { + dStageActor_c *player = 0; + + Vec myBL = {pos.x - 8.0f, pos.y - 8.0f, 0.0f}; + Vec myTR = {pos.x + 8.0f, pos.y + 8.0f, 0.0f}; + + while ((player = (dStageActor_c*)fBase_c::search(PLAYER, player)) != 0) { + float centerX = player->pos.x + player->aPhysics.info.xDistToCenter; + float centerY = player->pos.y + player->aPhysics.info.yDistToCenter; + + float left = centerX - player->aPhysics.info.xDistToEdge; + float right = centerX + player->aPhysics.info.xDistToEdge; + + float top = centerY + player->aPhysics.info.yDistToEdge; + float bottom = centerY - player->aPhysics.info.yDistToEdge; + + Vec playerBL = {left, bottom + 0.1f, 0.0f}; + Vec playerTR = {right, top - 0.1f, 0.0f}; + + if (RectanglesOverlap(&playerBL, &playerTR, &myBL, &myTR)) + return true; + } + + return false; +} + |