diff options
Diffstat (limited to 'src/magicplatform.cpp')
-rw-r--r-- | src/magicplatform.cpp | 54 |
1 files changed, 45 insertions, 9 deletions
diff --git a/src/magicplatform.cpp b/src/magicplatform.cpp index fe2eb9b..4997945 100644 --- a/src/magicplatform.cpp +++ b/src/magicplatform.cpp @@ -9,7 +9,14 @@ class daEnMagicPlatform_c : public dEn_c { int onExecute(); int onDelete(); + enum CollisionType { + Solid = 0, + SolidOnTop = 1, + None = 2 + }; + // Settings + CollisionType collisionType; u8 rectID, moveSpeed, moveDirection, moveLength; u8 moveDelay, currentMoveDelay; @@ -24,6 +31,7 @@ class daEnMagicPlatform_c : public dEn_c { void handleMovement(); Physics physics; + StandOnTopCollider sotCollider; TileRenderer *renderers; int rendererCount; @@ -129,6 +137,8 @@ int daEnMagicPlatform_c::onCreate() { moveDelay = ((settings & 0xF00000) >> 20) * 6; + collisionType = (CollisionType)((settings & 0x3000000) >> 24); + doesMoveInfinitely = (settings & 0x10000000); setupMovement(); @@ -138,15 +148,35 @@ int daEnMagicPlatform_c::onCreate() { float fWidth = width * 16.0f; float fHeight = height * 16.0f; - physics.setup(this, - 0.0f, 0.0f, fWidth, -fHeight, - &PhysCB1, &PhysCB2, &PhysCB3, 1, 0, 0); - physics.callback1 = &PhysCB4; - physics.callback2 = &PhysCB5; - physics.callback3 = &PhysCB6; + switch (collisionType) { + case Solid: + physics.setup(this, + 0.0f, 0.0f, fWidth, -fHeight, + &PhysCB1, &PhysCB2, &PhysCB3, 1, 0, 0); + + physics.callback1 = &PhysCB4; + physics.callback2 = &PhysCB5; + physics.callback3 = &PhysCB6; + + physics.addToList(); + break; + case SolidOnTop: + sotCollider.init(this, + /*xOffset=*/0.0f, /*yOffset=*/0.0f, + /*topYOffset=*/0, + /*rightSize=*/fWidth, /*leftSize=*/0, + /*rotation=*/0, /*_45=*/1 + ); + + // What is this for. I dunno + sotCollider._47 = 0xA; + sotCollider.flags = 0x80180 | 0xC00; - physics.addToList(); + sotCollider.addToList(); + + break; + } return 1; } @@ -154,7 +184,9 @@ int daEnMagicPlatform_c::onCreate() { int daEnMagicPlatform_c::onDelete() { deleteTiles(); - physics.removeFromList(); + switch (collisionType) { + case Solid: physics.removeFromList(); break; + } return 1; } @@ -165,7 +197,11 @@ int daEnMagicPlatform_c::onExecute() { checkVisibility(); updateTilePositions(); - physics.update(); + + switch (collisionType) { + case Solid: physics.update(); break; + case SolidOnTop: sotCollider.update(); break; + } return 1; } |