diff options
author | Colin Noga <Tempus@chronometry.ca> | 2012-08-30 13:26:29 -0500 |
---|---|---|
committer | Colin Noga <Tempus@chronometry.ca> | 2012-08-30 13:26:29 -0500 |
commit | d2ac274c00a448cefa4c82c079ba0a75f0b8fbba (patch) | |
tree | 616bdb246ffda022b4099dda55283cf61e603fe1 /src/magicplatform.cpp | |
parent | 463e256e6a239facb902da4566502a14684e1b94 (diff) | |
parent | 2b5bc0f0397e50b7cad585196e403c99d27b6207 (diff) | |
download | kamek-d2ac274c00a448cefa4c82c079ba0a75f0b8fbba.tar.gz kamek-d2ac274c00a448cefa4c82c079ba0a75f0b8fbba.zip |
Merge branch 'level-select' of ssh://treeki.rustedlogic.net:30000/Kamek into level-select
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; } |