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 | |
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 '')
-rw-r--r-- | src/koopatlas/pathmanager.cpp | 4 | ||||
-rw-r--r-- | src/magicplatform.cpp | 54 |
2 files changed, 47 insertions, 11 deletions
diff --git a/src/koopatlas/pathmanager.cpp b/src/koopatlas/pathmanager.cpp index f8a1854..ffc4dfd 100644 --- a/src/koopatlas/pathmanager.cpp +++ b/src/koopatlas/pathmanager.cpp @@ -26,7 +26,7 @@ void dWMPathManager_c::setup() { // Figure out what path node to start at if (dScKoopatlas_c::instance->settings & 0x10000000) { // Start off from a "Change" - u8 changeID = dScKoopatlas_c::instance->settings & 0xFF; + u8 changeID = (dScKoopatlas_c::instance->settings >> 20) & 0xFF; SpammyReport("entering at Change ID %d\n", changeID); SpammyReport("Path layer: %p\n", pathLayer); SpammyReport("Node count: %d\n", pathLayer->nodeCount); @@ -545,7 +545,7 @@ void dWMPathManager_c::moveThroughPath() { SpammyReport("Change to map ID %d (%s), entrance ID %d\n", save->current_world, to->destMap, to->foreignID); - DoSceneChange(WORLD_MAP, 0x10000000 | to->foreignID, 0); + DoSceneChange(WORLD_MAP, 0x10000000 | (to->foreignID << 20), 0); } else if (reallyStop) { // Stop here 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; } |