diff --git a/TR5Main/Game/traps.cpp b/TR5Main/Game/traps.cpp index 4fd711a05..aa2d0426c 100644 --- a/TR5Main/Game/traps.cpp +++ b/TR5Main/Game/traps.cpp @@ -21,126 +21,6 @@ static short WreckingBallData[2] = {0, 0}; ITEM_INFO* WBItem; short WBRoom; -void InitialiseFallingBlock(short itemNumber) -{ - g_Level.Items[itemNumber].meshBits = 1; - TEN::Floordata::AddBridge(itemNumber); -} - -void FallingBlockCollision(short itemNum, ITEM_INFO* l, COLL_INFO* coll) -{ - ITEM_INFO* item = &g_Level.Items[itemNum]; - if (!item->itemFlags[0] && !item->triggerFlags && item->pos.yPos == l->pos.yPos) - { - if (!((item->pos.xPos ^ l->pos.xPos) & 0xFFFFFC00) && !((l->pos.zPos ^ item->pos.zPos) & 0xFFFFFC00)) - { - SoundEffect(SFX_TR4_ROCK_FALL_CRUMBLE, &item->pos, 0); - AddActiveItem(itemNum); - - item->itemFlags[0] = 0; - item->status = ITEM_ACTIVE; - item->flags |= 0x3E00; - } - } -} - -void FallingBlockControl(short itemNumber) -{ - ITEM_INFO* item = &g_Level.Items[itemNumber]; - - if (item->triggerFlags) - { - item->triggerFlags--; - } - else - { - if (item->itemFlags[0]) - { - if (item->itemFlags[0] < 60) - { - if (item->itemFlags[0] < 52) - { - if (!(GetRandomControl() % (62 - item->itemFlags[0]))) - item->pos.yPos += (GetRandomControl() & 3) + 1; - item->itemFlags[0]++; - } - else - { - item->itemFlags[1] += 2; - item->itemFlags[0]++; - item->pos.yPos += item->itemFlags[1]; - } - } - else - { - KillItem(itemNumber); - } - } - else - { - item->meshBits = -2; - ExplodingDeath(itemNumber, -1, 15265); - item->itemFlags[0]++; - } - } -} - -//void FallingBlockFloor(ITEM_INFO* item, int x, int y, int z, int* height) -//{ -// if (!((x ^ item->pos.xPos) & 0xFFFFFC00) && !((z ^ item->pos.zPos) & 0xFFFFFC00)) -// { -// if (y <= item->pos.yPos) -// { -// *height = item->pos.yPos; -// HeightType = WALL; -// } -// } -//} -// -//void FallingBlockCeiling(ITEM_INFO* item, int x, int y, int z, int* height) -//{ -// if (!((x ^ item->pos.xPos) & 0xFFFFFC00) && !((z ^ item->pos.zPos) & 0xFFFFFC00)) -// { -// if (y > item->pos.yPos) -// { -// *height = item->pos.yPos + 256; -// } -// } -//} - -std::optional FallingBlockFloor(short itemNumber, int x, int y, int z) -{ - ITEM_INFO* item = &g_Level.Items[itemNumber]; - if (!item->meshBits || item->itemFlags[0] >= 52) - return std::nullopt; - - int height = item->pos.yPos; - return std::optional{ height }; -} - -std::optional FallingBlockCeiling(short itemNumber, int x, int y, int z) -{ - ITEM_INFO* item = &g_Level.Items[itemNumber]; - - if (!item->meshBits || item->itemFlags[0] >= 52) - return std::nullopt; - - int height = item->pos.yPos + 256; - return std::optional{ height }; -} - -int FallingBlockFloorBorder(short itemNumber) -{ - ITEM_INFO* item = &g_Level.Items[itemNumber]; - return item->pos.yPos; -} - -int FallingBlockCeilingBorder(short itemNumber) -{ - ITEM_INFO* item = &g_Level.Items[itemNumber]; - return (item->pos.yPos + 256); -} - void InitialiseWreckingBall(short itemNumber) { ITEM_INFO* item; diff --git a/TR5Main/Objects/Generic/Traps/falling_block.cpp b/TR5Main/Objects/Generic/Traps/falling_block.cpp index 893075ce0..f27365172 100644 --- a/TR5Main/Objects/Generic/Traps/falling_block.cpp +++ b/TR5Main/Objects/Generic/Traps/falling_block.cpp @@ -10,10 +10,10 @@ using namespace TEN::Math::Random; -constexpr auto FALLINGBLOCK_INITIAL_SPEED = 15; -constexpr auto FALLINGBLOCK_FALL_ROTATION_SPEED = 2; +constexpr auto FALLINGBLOCK_INITIAL_SPEED = 10; +constexpr auto FALLINGBLOCK_FALL_ROTATION_SPEED = 1; constexpr auto FALLINGBLOCK_DELAY = 52; -constexpr auto FALLINGBLOCK_WIBBLE = 4; +constexpr auto FALLINGBLOCK_WIBBLE = 3; constexpr auto FALLINGBLOCK_CRUMBLE_DELAY = 100; void InitialiseFallingBlock(short itemNumber) @@ -69,7 +69,7 @@ void FallingBlockControl(short itemNumber) for (int i = 0; i < item->mutator.size(); i++) { auto rotSpeed = i % 2 ? FALLINGBLOCK_FALL_ROTATION_SPEED : -FALLINGBLOCK_FALL_ROTATION_SPEED; - rotSpeed += i % 3 ? rotSpeed / 4 : rotSpeed; + rotSpeed += i % 3 ? rotSpeed / 2 : rotSpeed; item->mutator[i].Rotation.x += RADIAN * rotSpeed + (RADIAN * GenerateFloat(-1, 1)); item->mutator[i].Rotation.y += RADIAN * rotSpeed + (RADIAN * GenerateFloat(-1, 1)); item->mutator[i].Rotation.z += RADIAN * rotSpeed + (RADIAN * GenerateFloat(-1, 1));