From 7d7fd4eb64f562978dbc001bffb53482af747a0b Mon Sep 17 00:00:00 2001 From: Treeki Date: Mon, 20 May 2013 16:44:45 +0200 Subject: magic platform collision changes --- src/magicplatform.cpp | 30 +++++++++++++++++++++++++++--- 1 file changed, 27 insertions(+), 3 deletions(-) (limited to 'src') diff --git a/src/magicplatform.cpp b/src/magicplatform.cpp index 3b2475b..d1ef28c 100644 --- a/src/magicplatform.cpp +++ b/src/magicplatform.cpp @@ -12,7 +12,12 @@ class daEnMagicPlatform_c : public dEn_c { enum CollisionType { Solid = 0, SolidOnTop = 1, - None = 2 + None = 2, + ThinLineRight = 3, + ThinLineLeft = 4, + ThinLineTop = 5, + ThinLineBottom = 6, + NoneWithZ500 = 7 }; // Settings @@ -137,7 +142,7 @@ int daEnMagicPlatform_c::onCreate() { moveDelay = ((settings & 0xF00000) >> 20) * 6; - collisionType = (CollisionType)((settings & 0x3000000) >> 24); + collisionType = (CollisionType)((settings & 0xF000000) >> 24); doesMoveInfinitely = (settings & 0x10000000); @@ -145,7 +150,7 @@ int daEnMagicPlatform_c::onCreate() { int putItBehind = settings >> 29; pos.z = -3600.0f - (putItBehind * 16); } - if (settings & 0x4000000) + if (collisionType == NoneWithZ500) pos.z = 500.0f; setupMovement(); @@ -182,6 +187,21 @@ int daEnMagicPlatform_c::onCreate() { sotCollider.addToList(); + break; + case ThinLineLeft: case ThinLineRight: + case ThinLineTop: case ThinLineBottom: + physics.setup(this, + fWidth * (collisionType == ThinLineRight ? 0.875f : 0.0f), + fHeight * (collisionType == ThinLineBottom ? -0.75f : 0.0f), + fWidth * (collisionType == ThinLineLeft ? 0.125f : 1.0f), + fHeight * (collisionType == ThinLineTop ? -0.25f : -1.0f), + (void*)&PhysCB1, (void*)&PhysCB2, (void*)&PhysCB3, 1, 0, 0); + + physics.callback1 = (void*)&PhysCB4; + physics.callback2 = (void*)&PhysCB5; + physics.callback3 = (void*)&PhysCB6; + + physics.addToList(); break; } @@ -192,6 +212,8 @@ int daEnMagicPlatform_c::onDelete() { deleteTiles(); switch (collisionType) { + case ThinLineLeft: case ThinLineRight: + case ThinLineTop: case ThinLineBottom: case Solid: physics.removeFromList(); break; } @@ -206,6 +228,8 @@ int daEnMagicPlatform_c::onExecute() { updateTilePositions(); switch (collisionType) { + case ThinLineLeft: case ThinLineRight: + case ThinLineTop: case ThinLineBottom: case Solid: physics.update(); break; case SolidOnTop: sotCollider.update(); break; } -- cgit v1.2.3