diff --git a/Scripts/Strings.lua b/Scripts/Strings.lua index db7bbf185..5b21a9a8b 100644 --- a/Scripts/Strings.lua +++ b/Scripts/Strings.lua @@ -519,7 +519,7 @@ local strings = { "", "" }, - HARPOON_ITEM = { + harpoon_item = { "Harpoon Launcher", "", "", @@ -1169,8 +1169,8 @@ SILENCER_ITEM = { "", "" }, - torch = { - "Torch", + torch2 = { + "Torch2", "", "", "", diff --git a/TombEngine/Game/Lara/lara.cpp b/TombEngine/Game/Lara/lara.cpp index 19c1ca52f..eebdbb2a5 100644 --- a/TombEngine/Game/Lara/lara.cpp +++ b/TombEngine/Game/Lara/lara.cpp @@ -32,8 +32,8 @@ #include "Game/items.h" #include "Game/misc.h" #include "Game/savegame.h" -#include "Scripting/Flow/ScriptInterfaceFlowHandler.h" -#include "Scripting/ScriptInterfaceLevel.h" +#include "Flow/ScriptInterfaceFlowHandler.h" +#include "ScriptInterfaceLevel.h" #include "Sound/sound.h" #include "Renderer/Renderer11.h" diff --git a/TombEngine/Game/Lara/lara_basic.cpp b/TombEngine/Game/Lara/lara_basic.cpp index e2e7b16c2..aacb0f8ec 100644 --- a/TombEngine/Game/Lara/lara_basic.cpp +++ b/TombEngine/Game/Lara/lara_basic.cpp @@ -17,7 +17,7 @@ #include "Specific/input.h" #include "Specific/level.h" #include "Specific/setup.h" -#include "Scripting/Flow/ScriptInterfaceFlowHandler.h" +#include "Flow/ScriptInterfaceFlowHandler.h" // ------------------------------ // BASIC MOVEMENT & MISCELLANEOUS @@ -170,7 +170,7 @@ void lara_as_walk_forward(ItemInfo* item, CollisionInfo* coll) } else if (lara->Control.WaterStatus == WaterStatus::Wade) item->Animation.TargetState = LS_WADE_FORWARD; - else if (TrInput & IN_WALK) [[likely]] + else if (TrInput & IN_WALK) USE_FEATURE_IF_CPP20([[likely]]) item->Animation.TargetState = LS_WALK_FORWARD; else item->Animation.TargetState = LS_RUN_FORWARD; @@ -314,7 +314,7 @@ void lara_as_run_forward(ItemInfo* item, CollisionInfo* coll) item->Animation.TargetState = LS_WALK_FORWARD; else if (TrInput & IN_SPRINT && lara->SprintEnergy) item->Animation.TargetState = LS_SPRINT; - else [[likely]] + else USE_FEATURE_IF_CPP20([[likely]]) item->Animation.TargetState = LS_RUN_FORWARD; return; @@ -439,7 +439,7 @@ void lara_as_idle(ItemInfo* item, CollisionInfo* coll) { if (isSwamp) PseudoLaraAsSwampIdle(item, coll); - else [[likely]] + else USE_FEATURE_IF_CPP20([[likely]]) PseudoLaraAsWadeIdle(item, coll); return; @@ -489,7 +489,7 @@ void lara_as_idle(ItemInfo* item, CollisionInfo* coll) item->Animation.TargetState = LS_SPRINT; return; } - else if (TestLaraRunForward(item, coll)) [[likely]] + else if (TestLaraRunForward(item, coll)) USE_FEATURE_IF_CPP20([[likely]]) { item->Animation.TargetState = LS_RUN_FORWARD; return; @@ -505,7 +505,7 @@ void lara_as_idle(ItemInfo* item, CollisionInfo* coll) return; } } - else if (TestLaraRunBack(item, coll)) [[likely]] + else if (TestLaraRunBack(item, coll)) USE_FEATURE_IF_CPP20([[likely]]) { item->Animation.TargetState = LS_RUN_BACK; return; @@ -538,7 +538,7 @@ void lara_as_idle(ItemInfo* item, CollisionInfo* coll) { item->Animation.TargetState = LS_TURN_LEFT_FAST; } - else [[likely]] + else USE_FEATURE_IF_CPP20([[likely]]) item->Animation.TargetState = LS_TURN_LEFT_SLOW; return; @@ -550,7 +550,7 @@ void lara_as_idle(ItemInfo* item, CollisionInfo* coll) { item->Animation.TargetState = LS_TURN_RIGHT_FAST; } - else [[likely]] + else USE_FEATURE_IF_CPP20([[likely]]) item->Animation.TargetState = LS_TURN_RIGHT_SLOW; return; @@ -594,7 +594,7 @@ void PseudoLaraAsWadeIdle(ItemInfo* item, CollisionInfo* coll) SetLaraVault(item, coll, vaultResult); return; } - else if (TestLaraRunForward(item, coll)) [[likely]] + else if (TestLaraRunForward(item, coll)) USE_FEATURE_IF_CPP20([[likely]]) { item->Animation.TargetState = LS_WADE_FORWARD; return; @@ -887,7 +887,7 @@ void lara_as_turn_right_slow(ItemInfo* item, CollisionInfo* coll) { if (isSwamp) PsuedoLaraAsSwampTurnRightSlow(item, coll); - else [[likely]] + else USE_FEATURE_IF_CPP20([[likely]]) PsuedoLaraAsWadeTurnRightSlow(item, coll); return; @@ -938,7 +938,7 @@ void lara_as_turn_right_slow(ItemInfo* item, CollisionInfo* coll) item->Animation.TargetState = LS_SPRINT; return; } - else if (TestLaraRunForward(item, coll)) [[likely]] + else if (TestLaraRunForward(item, coll)) USE_FEATURE_IF_CPP20([[likely]]) { item->Animation.TargetState = LS_RUN_FORWARD; return; @@ -954,7 +954,7 @@ void lara_as_turn_right_slow(ItemInfo* item, CollisionInfo* coll) return; } } - else if (TestLaraRunBack(item, coll)) [[likely]] + else if (TestLaraRunBack(item, coll)) USE_FEATURE_IF_CPP20([[likely]]) { item->Animation.TargetState = LS_RUN_BACK; return; @@ -992,7 +992,7 @@ void lara_as_turn_right_slow(ItemInfo* item, CollisionInfo* coll) } else */if (lara->Control.TurnRate.y > LARA_SLOW_MED_TURN_MAX) item->Animation.TargetState = LS_TURN_RIGHT_FAST; - else [[likely]] + else USE_FEATURE_IF_CPP20([[likely]]) item->Animation.TargetState = LS_TURN_RIGHT_SLOW; return; @@ -1026,7 +1026,7 @@ void PsuedoLaraAsWadeTurnRightSlow(ItemInfo* item, CollisionInfo* coll) SetLaraVault(item, coll, vaultResult); return; } - else if (TestLaraRunForward(item, coll)) [[likely]] + else if (TestLaraRunForward(item, coll)) USE_FEATURE_IF_CPP20([[likely]]) { item->Animation.TargetState = LS_WADE_FORWARD; return; @@ -1084,7 +1084,7 @@ void PsuedoLaraAsSwampTurnRightSlow(ItemInfo* item, CollisionInfo* coll) SetLaraVault(item, coll, vaultResult); return; } - else if (TestLaraWadeForwardSwamp(item, coll)) [[likely]] + else if (TestLaraWadeForwardSwamp(item, coll)) USE_FEATURE_IF_CPP20([[likely]]) { item->Animation.TargetState = LS_WADE_FORWARD; return; @@ -1157,7 +1157,7 @@ void lara_as_turn_left_slow(ItemInfo* item, CollisionInfo* coll) { if (isSwamp) PsuedoLaraAsSwampTurnLeftSlow(item, coll); - else [[likely]] + else USE_FEATURE_IF_CPP20([[likely]]) PsuedoLaraAsWadeTurnLeftSlow(item, coll); return; @@ -1208,7 +1208,7 @@ void lara_as_turn_left_slow(ItemInfo* item, CollisionInfo* coll) item->Animation.TargetState = LS_SPRINT; return; } - else if (TestLaraRunForward(item, coll)) [[likely]] + else if (TestLaraRunForward(item, coll)) USE_FEATURE_IF_CPP20([[likely]]) { item->Animation.TargetState = LS_RUN_FORWARD; return; @@ -1224,7 +1224,7 @@ void lara_as_turn_left_slow(ItemInfo* item, CollisionInfo* coll) return; } } - else if (TestLaraRunBack(item, coll)) [[likely]] + else if (TestLaraRunBack(item, coll)) USE_FEATURE_IF_CPP20([[likely]]) { item->Animation.TargetState = LS_RUN_BACK; return; @@ -1262,7 +1262,7 @@ void lara_as_turn_left_slow(ItemInfo* item, CollisionInfo* coll) } else */if (lara->Control.TurnRate.y < -LARA_SLOW_MED_TURN_MAX) item->Animation.TargetState = LS_TURN_LEFT_FAST; - else [[likely]] + else USE_FEATURE_IF_CPP20([[likely]]) item->Animation.TargetState = LS_TURN_LEFT_SLOW; return; @@ -1296,7 +1296,7 @@ void PsuedoLaraAsWadeTurnLeftSlow(ItemInfo* item, CollisionInfo* coll) SetLaraVault(item, coll, vaultResult); return; } - else if (TestLaraRunForward(item, coll)) [[likely]] + else if (TestLaraRunForward(item, coll)) USE_FEATURE_IF_CPP20([[likely]]) { item->Animation.TargetState = LS_WADE_FORWARD; return; @@ -1354,7 +1354,7 @@ void PsuedoLaraAsSwampTurnLeftSlow(ItemInfo* item, CollisionInfo* coll) SetLaraVault(item, coll, vaultResult); return; } - else if (TestLaraWadeForwardSwamp(item, coll)) [[likely]] + else if (TestLaraWadeForwardSwamp(item, coll)) USE_FEATURE_IF_CPP20([[likely]]) { item->Animation.TargetState = LS_WADE_FORWARD; return; @@ -1688,7 +1688,7 @@ void lara_as_turn_right_fast(ItemInfo* item, CollisionInfo* coll) item->Animation.TargetState = LS_SPRINT; return; } - else if (TestLaraRunForward(item, coll)) [[likely]] + else if (TestLaraRunForward(item, coll)) USE_FEATURE_IF_CPP20([[likely]]) { item->Animation.TargetState = LS_RUN_FORWARD; return; @@ -1704,7 +1704,7 @@ void lara_as_turn_right_fast(ItemInfo* item, CollisionInfo* coll) return; } } - else if (TestLaraRunBack(item, coll)) [[likely]] + else if (TestLaraRunBack(item, coll)) USE_FEATURE_IF_CPP20([[likely]]) { item->Animation.TargetState = LS_RUN_BACK; return; @@ -1819,7 +1819,7 @@ void lara_as_turn_left_fast(ItemInfo* item, CollisionInfo* coll) item->Animation.TargetState = LS_SPRINT; return; } - else if (TestLaraRunForward(item, coll)) [[likely]] + else if (TestLaraRunForward(item, coll)) USE_FEATURE_IF_CPP20([[likely]]) { item->Animation.TargetState = LS_RUN_FORWARD; return; @@ -1835,7 +1835,7 @@ void lara_as_turn_left_fast(ItemInfo* item, CollisionInfo* coll) return; } } - else if (TestLaraRunBack(item, coll)) [[likely]] + else if (TestLaraRunBack(item, coll)) USE_FEATURE_IF_CPP20([[likely]]) { item->Animation.TargetState = LS_RUN_BACK; return; @@ -2257,7 +2257,7 @@ void lara_as_wade_forward(ItemInfo* item, CollisionInfo* coll) } else if (lara->Control.WaterStatus == WaterStatus::Dry) item->Animation.TargetState = LS_RUN_FORWARD; - else [[likely]] + else USE_FEATURE_IF_CPP20([[likely]]) item->Animation.TargetState = LS_WADE_FORWARD; return; @@ -2298,7 +2298,7 @@ void PseudoLaraAsSwampWadeForward(ItemInfo* item, CollisionInfo* coll) SetLaraVault(item, coll, vaultResult); return; } - else [[likely]] + else USE_FEATURE_IF_CPP20([[likely]]) item->Animation.TargetState = LS_WADE_FORWARD; return; @@ -2428,7 +2428,7 @@ void lara_as_sprint(ItemInfo* item, CollisionInfo* coll) item->Animation.TargetState = LS_RUN_FORWARD; // TODO: Dispatch to wade forward state directly. @Sezz 2021.09.29 else if (TrInput & IN_WALK) item->Animation.TargetState = LS_RUN_FORWARD; - else if (TrInput & IN_SPRINT && lara->SprintEnergy > 0) [[likely]] + else if (TrInput & IN_SPRINT && lara->SprintEnergy > 0) USE_FEATURE_IF_CPP20([[likely]]) item->Animation.TargetState = LS_SPRINT; else item->Animation.TargetState = LS_RUN_FORWARD; diff --git a/TombEngine/Game/Lara/lara_cheat.cpp b/TombEngine/Game/Lara/lara_cheat.cpp index ba121afd8..ca4fac60d 100644 --- a/TombEngine/Game/Lara/lara_cheat.cpp +++ b/TombEngine/Game/Lara/lara_cheat.cpp @@ -5,7 +5,7 @@ #include "Game/effects/effects.h" #include "Game/items.h" #include "Game/Lara/lara.h" -#include "Scripting/Flow/ScriptInterfaceFlowHandler.h" +#include "Flow/ScriptInterfaceFlowHandler.h" #include "Game/Lara/lara_helpers.h" #include "Sound/sound.h" #include "Specific/input.h" diff --git a/TombEngine/Game/Lara/lara_climb.cpp b/TombEngine/Game/Lara/lara_climb.cpp index bcc090b8c..b27d41bf5 100644 --- a/TombEngine/Game/Lara/lara_climb.cpp +++ b/TombEngine/Game/Lara/lara_climb.cpp @@ -11,7 +11,7 @@ #include "Game/Lara/lara_overhang.h" #include "Specific/level.h" #include "Specific/input.h" -#include "Scripting/Flow/ScriptInterfaceFlowHandler.h" +#include "Flow/ScriptInterfaceFlowHandler.h" // ----------------------------- // LADDER CLIMB @@ -292,14 +292,11 @@ void lara_col_climb_idle(ItemInfo* item, CollisionInfo* coll) resultRight = LaraTestClimbUpPos(item, coll->Setup.Radius, coll->Setup.Radius + CLICK(0.5f), &shiftRight, &ledgeRight); resultLeft = LaraTestClimbUpPos(item, coll->Setup.Radius, -CLICK(0.5f) - coll->Setup.Radius, &shiftLeft, &ledgeLeft); - // Overhang hook. - if (g_GameFlow->HasOverhangClimb()) + // Overhang + ladder-to-monkey hook. + if (!resultRight || !resultLeft) { - if (!resultRight || !resultLeft) - { - if (LadderMonkeyExtra(item, coll)) - return; - } + if (LadderMonkeyExtra(item, coll)) + return; } if (resultRight >= 0 && resultLeft >= 0) @@ -319,8 +316,14 @@ void lara_col_climb_idle(ItemInfo* item, CollisionInfo* coll) yShift = shiftRight; } - item->Animation.TargetState = LS_LADDER_UP; - item->Pose.Position.y += yShift; + // HACK: Prevent climbing inside sloped ceilings. Breaks overhang even more, but that shouldn't matter since we'll be doing it over. @Sezz 2022.05.13 + int y = item->Pose.Position.y - (coll->Setup.Height + CLICK(0.5f)); + auto probe = GetCollision(item, 0, 0, -(coll->Setup.Height + CLICK(0.5f))); + if ((probe.Position.Ceiling - y) < 0) + { + item->Animation.TargetState = LS_LADDER_UP; + item->Pose.Position.y += yShift; + } } else if (abs(ledgeLeft - ledgeRight) <= CLICK(0.5f)) { diff --git a/TombEngine/Game/Lara/lara_collide.cpp b/TombEngine/Game/Lara/lara_collide.cpp index 6ad709416..bb381bb27 100644 --- a/TombEngine/Game/Lara/lara_collide.cpp +++ b/TombEngine/Game/Lara/lara_collide.cpp @@ -14,8 +14,8 @@ #include "Specific/input.h" #include "Specific/level.h" #include "Specific/setup.h" -#include "Scripting/Flow/ScriptInterfaceFlowHandler.h" -#include "Scripting/ScriptInterfaceLevel.h" +#include "Flow/ScriptInterfaceFlowHandler.h" +#include "ScriptInterfaceLevel.h" // ----------------------------- // COLLISION TEST FUNCTIONS diff --git a/TombEngine/Game/Lara/lara_crawl.cpp b/TombEngine/Game/Lara/lara_crawl.cpp index 9dc53a0b5..0b1a42c36 100644 --- a/TombEngine/Game/Lara/lara_crawl.cpp +++ b/TombEngine/Game/Lara/lara_crawl.cpp @@ -14,7 +14,7 @@ #include "Game/Lara/lara_helpers.h" #include "Specific/input.h" #include "Specific/level.h" -#include "Scripting/Flow/ScriptInterfaceFlowHandler.h" +#include "Flow/ScriptInterfaceFlowHandler.h" // ----------------------------- // CROUCH & CRAWL @@ -61,9 +61,8 @@ void lara_as_crouch_idle(ItemInfo* item, CollisionInfo* coll) if ((TrInput & IN_CROUCH || lara->Control.KeepLow) && lara->Control.WaterStatus != WaterStatus::Wade) { - if (TrInput & IN_SPRINT - && TestLaraCrouchRoll(item, coll) - && g_GameFlow->HasCrouchRoll()) + if (TrInput & IN_SPRINT && TestLaraCrouchRoll(item, coll) && + g_GameFlow->HasCrouchRoll()) { item->Animation.TargetState = LS_CROUCH_ROLL; return; @@ -189,11 +188,7 @@ void lara_col_crouch_roll(ItemInfo* item, CollisionInfo* coll) // TODO: With sufficient speed, Lara can still roll off ledges. This is particularly a problem in the uncommon scenario where // she becomes Airborne within a crawlspace; collision handling will push her back very rapidly and potentially cause a softlock. @Sezz 2021.11.02 if (LaraDeflectEdgeCrawl(item, coll)) - { - item->Pose.Position.x = coll->Setup.OldPosition.x; - item->Pose.Position.y = coll->Setup.OldPosition.y; - item->Pose.Position.z = coll->Setup.OldPosition.z; - } + item->Pose.Position = coll->Setup.OldPosition; if (TestLaraFall(item, coll)) { @@ -247,9 +242,8 @@ void lara_as_crouch_turn_left(ItemInfo* item, CollisionInfo* coll) if ((TrInput & IN_CROUCH || lara->Control.KeepLow) && lara->Control.WaterStatus != WaterStatus::Wade) { - if (TrInput & IN_SPRINT - && TestLaraCrouchRoll(item, coll) - && g_GameFlow->HasCrouchRoll()) + if (TrInput & IN_SPRINT && TestLaraCrouchRoll(item, coll) && + g_GameFlow->HasCrouchRoll()) { item->Animation.TargetState = LS_CROUCH_ROLL; return; @@ -304,9 +298,8 @@ void lara_as_crouch_turn_right(ItemInfo* item, CollisionInfo* coll) if ((TrInput & IN_CROUCH || lara->Control.KeepLow) && lara->Control.WaterStatus != WaterStatus::Wade) { - if (TrInput & IN_SPRINT - && TestLaraCrouchRoll(item, coll) - && g_GameFlow->HasCrouchRoll()) + if (TrInput & IN_SPRINT && TestLaraCrouchRoll(item, coll) && + g_GameFlow->HasCrouchRoll()) { item->Animation.TargetState = LS_CROUCH_ROLL; return; @@ -387,15 +380,14 @@ void lara_as_crawl_idle(ItemInfo* item, CollisionInfo* coll) { auto crawlVaultResult = TestLaraCrawlVault(item, coll); - if (TrInput & (IN_ACTION | IN_JUMP) - && crawlVaultResult.Success - && g_GameFlow->HasCrawlExtended()) + if (TrInput & (IN_ACTION | IN_JUMP) && crawlVaultResult.Success && + g_GameFlow->HasCrawlExtended()) { item->Animation.TargetState = crawlVaultResult.TargetState; ResetLaraFlex(item); return; } - else if (TestLaraCrawlForward(item, coll)) [[likely]] + else if (TestLaraCrawlForward(item, coll)) USE_FEATURE_IF_CPP20([[likely]]) { item->Animation.TargetState = LS_CRAWL_FORWARD; return; @@ -409,7 +401,7 @@ void lara_as_crawl_idle(ItemInfo* item, CollisionInfo* coll) DoLaraCrawlToHangSnap(item, coll); return; } - else if (TestLaraCrawlBack(item, coll)) [[likely]] + else if (TestLaraCrawlBack(item, coll)) USE_FEATURE_IF_CPP20([[likely]]) { item->Animation.TargetState = LS_CRAWL_BACK; return; diff --git a/TombEngine/Game/Lara/lara_fire.cpp b/TombEngine/Game/Lara/lara_fire.cpp index fc4217940..be8778422 100644 --- a/TombEngine/Game/Lara/lara_fire.cpp +++ b/TombEngine/Game/Lara/lara_fire.cpp @@ -18,15 +18,15 @@ #include "Game/savegame.h" #include "Objects/Generic/Object/burning_torch.h" #include "Objects/Generic/Object/objects.h" -#include "Scripting/Flow/ScriptInterfaceFlowHandler.h" -#include "Scripting/ScriptInterfaceLevel.h" +#include "Flow/ScriptInterfaceFlowHandler.h" +#include "ScriptInterfaceLevel.h" #include "Sound/sound.h" #include "Specific/setup.h" #include "Specific/input.h" #include "Specific/level.h" -#include "Scripting/ScriptInterfaceGame.h" -#include "Scripting/Objects/ScriptInterfaceObjectsHandler.h" +#include "ScriptInterfaceGame.h" +#include "Objects/ScriptInterfaceObjectsHandler.h" using namespace TEN::Entities::Generic; @@ -772,7 +772,7 @@ void HitTarget(ItemInfo* laraItem, ItemInfo* target, GameVector* hitPos, int dam switch (object->hitEffect) { case HIT_BLOOD: - if (target->ObjectNumber == ID_GOON2 && + if (target->ObjectNumber == ID_BADDY2 && (target->Animation.ActiveState == 8 || GetRandomControl() & 1) && (lara->Control.Weapon.GunType == LaraWeaponType::Pistol || lara->Control.Weapon.GunType == LaraWeaponType::Shotgun || diff --git a/TombEngine/Game/Lara/lara_helpers.cpp b/TombEngine/Game/Lara/lara_helpers.cpp index 25801467e..069cb523c 100644 --- a/TombEngine/Game/Lara/lara_helpers.cpp +++ b/TombEngine/Game/Lara/lara_helpers.cpp @@ -6,7 +6,7 @@ #include "Game/items.h" #include "Game/Lara/lara.h" #include "Game/Lara/lara_collide.h" -#include "Scripting/Flow/ScriptInterfaceFlowHandler.h" +#include "Flow/ScriptInterfaceFlowHandler.h" #include "Game/Lara/lara_fire.h" #include "Game/Lara/lara_tests.h" #include "Renderer/Renderer11.h" @@ -324,7 +324,7 @@ void DoLaraFallDamage(ItemInfo* item) { if (item->Animation.VerticalVelocity >= LARA_DEATH_VELOCITY) item->HitPoints = 0; - else [[likely]] + else USE_FEATURE_IF_CPP20([[likely]]) { int base = item->Animation.VerticalVelocity - (LARA_DAMAGE_VELOCITY - 1); item->HitPoints -= LARA_HEALTH_MAX * (pow(base, 2) / 196); @@ -586,7 +586,7 @@ void SetLaraJumpDirection(ItemInfo* item, CollisionInfo* coll) { lara->Control.JumpDirection = JumpDirection::Right; } - else if (TestLaraJumpUp(item, coll)) [[likely]] + else if (TestLaraJumpUp(item, coll)) USE_FEATURE_IF_CPP20([[likely]]) lara->Control.JumpDirection = JumpDirection::Up; else lara->Control.JumpDirection = JumpDirection::None; diff --git a/TombEngine/Game/Lara/lara_jump.cpp b/TombEngine/Game/Lara/lara_jump.cpp index faf493663..b7e7ddb10 100644 --- a/TombEngine/Game/Lara/lara_jump.cpp +++ b/TombEngine/Game/Lara/lara_jump.cpp @@ -10,7 +10,7 @@ #include "Game/Lara/lara_basic.h" #include "Game/Lara/lara_overhang.h" #include "Game/Lara/lara_slide.h" -#include "Scripting/Flow/ScriptInterfaceFlowHandler.h" +#include "Flow/ScriptInterfaceFlowHandler.h" #include "Sound/sound.h" #include "Specific/input.h" #include "Specific/level.h" @@ -68,7 +68,7 @@ void lara_as_jump_forward(ItemInfo* item, CollisionInfo* coll) { DoLaraFallDamage(item); - if (item->HitPoints <= 0) [[unlikely]] + if (item->HitPoints <= 0) USE_FEATURE_IF_CPP20([[unlikely]]) item->Animation.TargetState = LS_DEATH; else if (TestLaraSlide(item, coll)) SetLaraSlideAnimation(item, coll); @@ -152,7 +152,7 @@ void lara_as_freefall(ItemInfo* item, CollisionInfo* coll) item->Animation.TargetState = LS_DEATH; else if (TestLaraSlide(item, coll)) SetLaraSlideAnimation(item, coll); - else [[likely]] + else USE_FEATURE_IF_CPP20([[likely]]) item->Animation.TargetState = LS_IDLE; SetLaraLand(item, coll); @@ -219,7 +219,7 @@ void lara_as_reach(ItemInfo* item, CollisionInfo* coll) item->Animation.TargetState = LS_DEATH; else if (TestLaraSlide(item, coll)) SetLaraSlideAnimation(item, coll); - else [[likely]] + else USE_FEATURE_IF_CPP20([[likely]]) item->Animation.TargetState = LS_IDLE; SetLaraLand(item, coll); @@ -449,7 +449,7 @@ void lara_as_jump_back(ItemInfo* item, CollisionInfo* coll) item->Animation.TargetState = LS_DEATH; else if (TestLaraSlide(item, coll)) SetLaraSlideAnimation(item, coll); - else [[likely]] + else USE_FEATURE_IF_CPP20([[likely]]) item->Animation.TargetState = LS_IDLE; SetLaraLand(item, coll); @@ -505,7 +505,7 @@ void lara_as_jump_right(ItemInfo* item, CollisionInfo* coll) item->Animation.TargetState = LS_DEATH; else if (TestLaraSlide(item, coll)) SetLaraSlideAnimation(item, coll); - else [[likely]] + else USE_FEATURE_IF_CPP20([[likely]]) item->Animation.TargetState = LS_IDLE; SetLaraLand(item, coll); @@ -562,7 +562,7 @@ void lara_as_jump_left(ItemInfo* item, CollisionInfo* coll) item->Animation.TargetState = LS_DEATH; else if (TestLaraSlide(item, coll)) SetLaraSlideAnimation(item, coll); - else [[likely]] + else USE_FEATURE_IF_CPP20([[likely]]) item->Animation.TargetState = LS_IDLE; SetLaraLand(item, coll); @@ -617,7 +617,7 @@ void lara_as_jump_up(ItemInfo* item, CollisionInfo* coll) item->Animation.TargetState = LS_DEATH; else if (TestLaraSlide(item, coll)) SetLaraSlideAnimation(item, coll); - else [[likely]] + else USE_FEATURE_IF_CPP20([[likely]]) item->Animation.TargetState = LS_IDLE; SetLaraLand(item, coll); @@ -722,7 +722,7 @@ void lara_as_fall_back(ItemInfo* item, CollisionInfo* coll) item->Animation.TargetState = LS_DEATH; else if (TestLaraSlide(item, coll)) SetLaraSlideAnimation(item, coll); - else [[likely]] + else USE_FEATURE_IF_CPP20([[likely]]) item->Animation.TargetState = LS_IDLE; SetLaraLand(item, coll); @@ -811,7 +811,7 @@ void lara_as_swan_dive(ItemInfo* item, CollisionInfo* coll) item->Animation.TargetState = LS_CROUCH_IDLE; TranslateItem(item, coll->Setup.ForwardAngle, CLICK(0.5f), 0, 0); // HACK: Move forward to avoid standing up or falling out on an edge. } - else [[likely]] + else USE_FEATURE_IF_CPP20([[likely]]) item->Animation.TargetState = LS_IDLE; SetLaraLand(item, coll); @@ -883,7 +883,7 @@ void lara_as_freefall_dive(ItemInfo* item, CollisionInfo* coll) } else if (TestLaraSlide(item, coll)) SetLaraSlideAnimation(item, coll); - else [[likely]] + else USE_FEATURE_IF_CPP20([[likely]]) item->Animation.TargetState = LS_IDLE; SetLaraLand(item, coll); diff --git a/TombEngine/Game/Lara/lara_monkey.cpp b/TombEngine/Game/Lara/lara_monkey.cpp index 4469df4f5..d9bf04719 100644 --- a/TombEngine/Game/Lara/lara_monkey.cpp +++ b/TombEngine/Game/Lara/lara_monkey.cpp @@ -14,7 +14,7 @@ #include "Game/Lara/lara_tests.h" #include "Specific/input.h" #include "Specific/level.h" -#include "Scripting/Flow/ScriptInterfaceFlowHandler.h" +#include "Flow/ScriptInterfaceFlowHandler.h" // ----------------------------- // MONKEY SWING diff --git a/TombEngine/Game/Lara/lara_one_gun.cpp b/TombEngine/Game/Lara/lara_one_gun.cpp index 7801603cc..1107a712a 100644 --- a/TombEngine/Game/Lara/lara_one_gun.cpp +++ b/TombEngine/Game/Lara/lara_one_gun.cpp @@ -964,7 +964,7 @@ void GrenadeControl(short itemNumber) if (currentItem->ObjectNumber < ID_SHOOT_SWITCH1 || currentItem->ObjectNumber > ID_SHOOT_SWITCH4 || (currentItem->Flags & 0x40)) { if (Objects[currentItem->ObjectNumber].intelligent || currentItem->ObjectNumber == ID_LARA) - DoExplosiveDamageOnBaddie(LaraItem, currentItem, item, LaraWeaponType::GrenadeLauncher); + DoExplosiveDamageOnBaddy(LaraItem, currentItem, item, LaraWeaponType::GrenadeLauncher); } else { @@ -1274,7 +1274,7 @@ void RocketControl(short itemNumber) // Explosion is handled by CreatureDie() // Also Lara can be damaged // HitTarget() is called inside this - DoExplosiveDamageOnBaddie(LaraItem, currentItem, item, LaraWeaponType::RocketLauncher); + DoExplosiveDamageOnBaddy(LaraItem, currentItem, item, LaraWeaponType::RocketLauncher); } else if (currentItem->ObjectNumber >= ID_SMASH_OBJECT1 && currentItem->ObjectNumber <= ID_SMASH_OBJECT8) { @@ -1546,7 +1546,7 @@ void CrossbowBoltControl(short itemNumber) // Explosion is handled by CreatureDie() // Also Lara can be damaged // HitTarget() is called inside this - DoExplosiveDamageOnBaddie(LaraItem, currentItem, item, LaraWeaponType::Crossbow); + DoExplosiveDamageOnBaddy(LaraItem, currentItem, item, LaraWeaponType::Crossbow); } else if (currentItem->ObjectNumber != ID_LARA) { @@ -1767,7 +1767,7 @@ void RifleHandler(ItemInfo* laraItem, LaraWeaponType weaponType) } } -void DoExplosiveDamageOnBaddie(ItemInfo* laraItem, ItemInfo* dest, ItemInfo* src, LaraWeaponType weaponType) +void DoExplosiveDamageOnBaddy(ItemInfo* laraItem, ItemInfo* dest, ItemInfo* src, LaraWeaponType weaponType) { if (!(dest->Flags & 0x8000)) { diff --git a/TombEngine/Game/Lara/lara_one_gun.h b/TombEngine/Game/Lara/lara_one_gun.h index 45e96136f..e11ff1603 100644 --- a/TombEngine/Game/Lara/lara_one_gun.h +++ b/TombEngine/Game/Lara/lara_one_gun.h @@ -58,7 +58,7 @@ void FireCrossBowFromLaserSight(ItemInfo* laraItem, GameVector* src, GameVector* void FireHK(ItemInfo* laraItem, int mode); void RifleHandler(ItemInfo* laraItem, LaraWeaponType weaponType); -void DoExplosiveDamageOnBaddie(ItemInfo* laraItem, ItemInfo* src, ItemInfo* dest, LaraWeaponType weaponType); +void DoExplosiveDamageOnBaddy(ItemInfo* laraItem, ItemInfo* src, ItemInfo* dest, LaraWeaponType weaponType); void TriggerUnderwaterExplosion(ItemInfo* item, int flag); void SomeSparkEffect(int x, int y, int z, int count); diff --git a/TombEngine/Game/Lara/lara_overhang.cpp b/TombEngine/Game/Lara/lara_overhang.cpp index 7412bd110..dc767b4c9 100644 --- a/TombEngine/Game/Lara/lara_overhang.cpp +++ b/TombEngine/Game/Lara/lara_overhang.cpp @@ -12,7 +12,7 @@ #include "Game/items.h" #include "Specific/input.h" #include "Specific/setup.h" -#include "Scripting/Flow/ScriptInterfaceFlowHandler.h" +#include "Flow/ScriptInterfaceFlowHandler.h" #include "Specific/level.h" constexpr auto HORIZONTAL_ALIGN_NORTHEAST = 155; @@ -958,9 +958,6 @@ void SlopeClimbExtra(ItemInfo* item, CollisionInfo* coll) // Extends LS_LADDER_IDLE (56) bool LadderMonkeyExtra(ItemInfo* item, CollisionInfo* coll) { - if (!g_GameFlow->HasOverhangClimb()) - return false; - auto probe = GetCollision(item); if (probe.Position.CeilingSlope) diff --git a/TombEngine/Game/Lara/lara_swim.cpp b/TombEngine/Game/Lara/lara_swim.cpp index 2796f8794..d14ff450c 100644 --- a/TombEngine/Game/Lara/lara_swim.cpp +++ b/TombEngine/Game/Lara/lara_swim.cpp @@ -8,8 +8,8 @@ #include "Game/Lara/lara_collide.h" #include "Game/Lara/lara_helpers.h" #include "Game/Lara/lara.h" -#include "Scripting/Flow/ScriptInterfaceFlowHandler.h" -#include "Scripting/ScriptInterfaceLevel.h" +#include "Flow/ScriptInterfaceFlowHandler.h" +#include "ScriptInterfaceLevel.h" #include "Sound/sound.h" #include "Specific/level.h" #include "Specific/input.h" diff --git a/TombEngine/Game/Lara/lara_tests.cpp b/TombEngine/Game/Lara/lara_tests.cpp index 1aed95db7..1dd34c928 100644 --- a/TombEngine/Game/Lara/lara_tests.cpp +++ b/TombEngine/Game/Lara/lara_tests.cpp @@ -14,7 +14,7 @@ #include "Game/Lara/lara_helpers.h" #include "Game/Lara/lara_monkey.h" #include "Renderer/Renderer11.h" -#include "Scripting/Flow/ScriptInterfaceFlowHandler.h" +#include "Flow/ScriptInterfaceFlowHandler.h" #include "Specific/input.h" #include "Specific/level.h" @@ -878,9 +878,7 @@ void TestLaraWaterDepth(ItemInfo* item, CollisionInfo* coll) if (waterDepth == NO_HEIGHT) { item->Animation.VerticalVelocity = 0; - item->Pose.Position.x = coll->Setup.OldPosition.x; - item->Pose.Position.y = coll->Setup.OldPosition.y; - item->Pose.Position.z = coll->Setup.OldPosition.z; + item->Pose.Position = coll->Setup.OldPosition; } // Height check was at CLICK(2) before but changed to this // because now Lara surfaces on a head level, not mid-body level. @@ -891,9 +889,9 @@ void TestLaraWaterDepth(ItemInfo* item, CollisionInfo* coll) item->Pose.Position.y = probe.Position.Floor; item->Pose.Orientation.x = 0; item->Pose.Orientation.z = 0; + item->Animation.Airborne = false; item->Animation.Velocity = 0; item->Animation.VerticalVelocity = 0; - item->Animation.Airborne = false; lara->Control.WaterStatus = WaterStatus::Wade; } } @@ -1069,7 +1067,10 @@ bool TestLaraFall(ItemInfo* item, CollisionInfo* coll) { auto* lara = GetLaraInfo(item); - if (coll->Middle.Floor <= STEPUP_HEIGHT || + int y = item->Pose.Position.y; + auto probe = GetCollision(item); + + if ((probe.Position.Floor - y) <= STEPUP_HEIGHT || lara->Control.WaterStatus == WaterStatus::Wade) // TODO: This causes a legacy floor snap bug when Lara wades off a ledge into a dry room. @Sezz 2021.09.26 { return false; @@ -1192,25 +1193,29 @@ bool TestLaraMoveTolerance(ItemInfo* item, CollisionInfo* coll, MoveTestSetup te item->Pose.Position.x, y + testSetup.UpperFloorBound - 1, item->Pose.Position.z, - item->RoomNumber); + item->RoomNumber + ); auto end1 = GameVector( probe.Coordinates.x, y + testSetup.UpperFloorBound - 1, probe.Coordinates.z, - item->RoomNumber); + item->RoomNumber + ); auto start2 = GameVector( item->Pose.Position.x, y - laraHeight + 1, item->Pose.Position.z, - item->RoomNumber); + item->RoomNumber + ); auto end2 = GameVector( probe.Coordinates.x, probe.Coordinates.y + 1, probe.Coordinates.z, - item->RoomNumber); + item->RoomNumber + ); // Discard walls. if (probe.Position.Floor == NO_HEIGHT) @@ -1220,11 +1225,11 @@ bool TestLaraMoveTolerance(ItemInfo* item, CollisionInfo* coll, MoveTestSetup te if (isSlopeDown || isSlopeUp || isDeath) return false; - // Conduct ray test at upper floor bound and lowest ceiling bound. + // Assess ray/room collision. if (!LOS(&start1, &end1) || !LOS(&start2, &end2)) return false; - // Assess move feasibility to location ahead. + // Assess point/room collision. if ((probe.Position.Floor - y) <= testSetup.LowerFloorBound && // Within lower floor bound. (probe.Position.Floor - y) >= testSetup.UpperFloorBound && // Within upper floor bound. (probe.Position.Ceiling - y) < -laraHeight && // Within lowest ceiling bound. @@ -1478,25 +1483,29 @@ bool TestLaraMonkeyMoveTolerance(ItemInfo* item, CollisionInfo* coll, MonkeyMove item->Pose.Position.x, y + testSetup.LowerCeilingBound + 1, item->Pose.Position.z, - item->RoomNumber); + item->RoomNumber + ); auto end1 = GameVector( probe.Coordinates.x, probe.Coordinates.y - LARA_HEIGHT_MONKEY + testSetup.LowerCeilingBound + 1, probe.Coordinates.z, - item->RoomNumber); + item->RoomNumber + ); auto start2 = GameVector( item->Pose.Position.x, y + LARA_HEIGHT_MONKEY - 1, item->Pose.Position.z, - item->RoomNumber); + item->RoomNumber + ); auto end2 = GameVector( probe.Coordinates.x, probe.Coordinates.y - 1, probe.Coordinates.z, - item->RoomNumber); + item->RoomNumber + ); // Discard walls. if (probe.Position.Ceiling == NO_HEIGHT) @@ -1506,11 +1515,11 @@ bool TestLaraMonkeyMoveTolerance(ItemInfo* item, CollisionInfo* coll, MonkeyMove if (probe.Position.CeilingSlope) return false; - // Conduct ray test at lower ceiling bound and highest floor bound. + // Assess ray/room collision. if (!LOS(&start1, &end1) || !LOS(&start2, &end2)) return false; - // Assess move feasibility to location ahead. + // Assess point/room collision. if (probe.BottomBlock->Flags.Monkeyswing && // Is monkey sector. (probe.Position.Floor - y) > LARA_HEIGHT_MONKEY && // Within highest floor bound. (probe.Position.Ceiling - y) <= testSetup.LowerCeilingBound && // Within lower ceiling bound. @@ -1591,9 +1600,12 @@ VaultTestResult TestLaraVaultTolerance(ItemInfo* item, CollisionInfo* coll, Vaul if (swampTooDeep) return VaultTestResult{ false }; - // HACK: Where the probe finds that the wall in front is formed by a ceiling or the space between the floor and ceiling is a clamp, - // any climbable floor in a room above will be missed. - // Raise y position of probe point by increments of CLICK(0.5f) to find this potential vault candidate location. + // NOTE: Where the point/room probe finds that + // a) the "wall" in front is formed by a ceiling, or + // b) the space between the floor and ceiling is a clamp (i.e. it is too narrow), + // any potentially climbable floor in a room above will be missed. The following block considers this. + + // Raise y position of point/room probe by increments of CLICK(0.5f) to find potential vault ledge. int yOffset = testSetup.LowerFloorBound; while (((probeFront.Position.Ceiling - y) > -coll->Setup.Height || // Ceiling is below Lara's height... abs(probeFront.Position.Ceiling - probeFront.Position.Floor) <= testSetup.ClampMin || // OR clamp is too small @@ -1608,7 +1620,7 @@ VaultTestResult TestLaraVaultTolerance(ItemInfo* item, CollisionInfo* coll, Vaul if (probeFront.Position.Floor == NO_HEIGHT) return VaultTestResult{ false }; - // Assess vault candidate location. + // Assess point/room collision. if ((probeFront.Position.Floor - y) < testSetup.LowerFloorBound && // Within lower floor bound. (probeFront.Position.Floor - y) >= testSetup.UpperFloorBound && // Within upper floor bound. abs(probeFront.Position.Ceiling - probeFront.Position.Floor) > testSetup.ClampMin && // Within clamp min. @@ -1968,7 +1980,7 @@ CrawlVaultTestResult TestLaraCrawlVaultTolerance(ItemInfo* item, CollisionInfo* if (isSlope || isDeath) return CrawlVaultTestResult{ false }; - // Assess crawl vault feasibility to location ahead. + // Assess point/room collision. if ((probeA.Position.Floor - y) <= testSetup.LowerFloorBound && // Within lower floor bound. (probeA.Position.Floor - y) >= testSetup.UpperFloorBound && // Within upper floor bound. abs(probeA.Position.Ceiling - probeA.Position.Floor) > testSetup.ClampMin && // Crossing clamp limit. @@ -2468,7 +2480,7 @@ bool TestLaraJumpTolerance(ItemInfo* item, CollisionInfo* coll, JumpTestSetup te if (isSwamp || isWading) return false; - // Assess jump feasibility toward location ahead. + // Assess point/room collision. if (!TestLaraFacingCorner(item, testSetup.Angle, testSetup.Distance) && // Avoid jumping through corners. (probe.Position.Floor - y) >= -STEPUP_HEIGHT && // Within highest floor bound. ((probe.Position.Ceiling - y) < -(coll->Setup.Height + (LARA_HEADROOM * 0.8f)) || // Within lowest ceiling bound... diff --git a/TombEngine/Game/collision/collide_item.cpp b/TombEngine/Game/collision/collide_item.cpp index f80e73dcd..93070801b 100644 --- a/TombEngine/Game/collision/collide_item.cpp +++ b/TombEngine/Game/collision/collide_item.cpp @@ -15,7 +15,7 @@ #include "Specific/trmath.h" #include "Specific/prng.h" #include "Renderer/Renderer11.h" -#include "Scripting/ScriptInterfaceGame.h" +#include "ScriptInterfaceGame.h" using namespace TEN::Math::Random; using namespace TEN::Renderer; @@ -1676,7 +1676,7 @@ void DoProjectileDynamics(short itemNumber, int x, int y, int z, int xv, int yv, ItemNewRoom(itemNumber, collResult.RoomNumber); } -void DoObjectCollision(ItemInfo* laraItem, CollisionInfo* coll) // previously LaraBaddieCollision +void DoObjectCollision(ItemInfo* laraItem, CollisionInfo* coll) // previously LaraBaddyCollision { laraItem->HitStatus = false; coll->HitStatic = false; diff --git a/TombEngine/Game/collision/collide_room.cpp b/TombEngine/Game/collision/collide_room.cpp index a2455d9ce..d92b71dcb 100644 --- a/TombEngine/Game/collision/collide_room.cpp +++ b/TombEngine/Game/collision/collide_room.cpp @@ -399,7 +399,7 @@ void GetCollisionInfo(CollisionInfo* coll, ItemInfo* item, Vector3Int offset, bo coll->Front.Floor = STOP_SIZE; } else if (coll->Setup.BlockMonkeySwingEdge && - !collResult.BottomBlock->Flags.Monkeyswing) + !GetCollision(x, y + coll->Setup.Height, z, item->RoomNumber).BottomBlock->Flags.Monkeyswing) { coll->Front.Floor = MAX_HEIGHT; } @@ -457,7 +457,7 @@ void GetCollisionInfo(CollisionInfo* coll, ItemInfo* item, Vector3Int offset, bo coll->MiddleLeft.Floor = STOP_SIZE; } else if (coll->Setup.BlockMonkeySwingEdge && - !collResult.BottomBlock->Flags.Monkeyswing) + !GetCollision(x, y + coll->Setup.Height, z, item->RoomNumber).BottomBlock->Flags.Monkeyswing) { coll->MiddleLeft.Floor = MAX_HEIGHT; } @@ -510,7 +510,7 @@ void GetCollisionInfo(CollisionInfo* coll, ItemInfo* item, Vector3Int offset, bo coll->FrontLeft.Floor = STOP_SIZE; } else if (coll->Setup.BlockMonkeySwingEdge && - !collResult.BottomBlock->Flags.Monkeyswing) + !GetCollision(x, y + coll->Setup.Height, z, item->RoomNumber).BottomBlock->Flags.Monkeyswing) { coll->FrontLeft.Floor = MAX_HEIGHT; } @@ -568,7 +568,7 @@ void GetCollisionInfo(CollisionInfo* coll, ItemInfo* item, Vector3Int offset, bo coll->MiddleRight.Floor = STOP_SIZE; } else if (coll->Setup.BlockMonkeySwingEdge && - !collResult.BottomBlock->Flags.Monkeyswing) + !GetCollision(x, y + coll->Setup.Height, z, item->RoomNumber).BottomBlock->Flags.Monkeyswing) { coll->MiddleRight.Floor = MAX_HEIGHT; } @@ -621,7 +621,7 @@ void GetCollisionInfo(CollisionInfo* coll, ItemInfo* item, Vector3Int offset, bo coll->FrontRight.Floor = STOP_SIZE; } else if (coll->Setup.BlockMonkeySwingEdge && - !collResult.BottomBlock->Flags.Monkeyswing) + !GetCollision(x, y + coll->Setup.Height, z, item->RoomNumber).BottomBlock->Flags.Monkeyswing) { coll->FrontRight.Floor = MAX_HEIGHT; } diff --git a/TombEngine/Game/control/box.cpp b/TombEngine/Game/control/box.cpp index 39f0b5574..4c6fe348f 100644 --- a/TombEngine/Game/control/box.cpp +++ b/TombEngine/Game/control/box.cpp @@ -1032,7 +1032,7 @@ int CreatureActive(short itemNumber) if (item->Status == ITEM_INVISIBLE || !item->Data.is()) { - if (!EnableBaddieAI(itemNumber, 0)) + if (!EnableBaddyAI(itemNumber, 0)) return false; // AI couldn't be activated item->Status = ITEM_ACTIVE; @@ -1080,13 +1080,13 @@ int StalkBox(ItemInfo* item, ItemInfo* enemy, int boxNumber) if (enemyQuad == boxQuad) return false; - int baddieQuad = 0; + int baddyQuad = 0; if (item->Pose.Position.z > enemy->Pose.Position.z) - baddieQuad = (item->Pose.Position.x > enemy->Pose.Position.x) ? 2 : 1; + baddyQuad = (item->Pose.Position.x > enemy->Pose.Position.x) ? 2 : 1; else - baddieQuad = (item->Pose.Position.x > enemy->Pose.Position.x) ? 3 : 0; + baddyQuad = (item->Pose.Position.x > enemy->Pose.Position.x) ? 3 : 0; - if (enemyQuad == baddieQuad && abs(enemyQuad - boxQuad) == 2) + if (enemyQuad == baddyQuad && abs(enemyQuad - boxQuad) == 2) return false; return true; @@ -1108,18 +1108,18 @@ int CreatureVault(short itemNumber, short angle, int vault, int shift) vault = 0; else if (item->Floor > y + CHECK_CLICK(7)) vault = -4; - // FIXME: edit assets adding climb down animations for Von Croy and baddies? + // FIXME: edit assets adding climb down animations for Von Croy and baddys? else if (item->Floor > y + CHECK_CLICK(5) && item->ObjectNumber != ID_VON_CROY && - item->ObjectNumber != ID_GOON1 && - item->ObjectNumber != ID_GOON2) + item->ObjectNumber != ID_BADDY1 && + item->ObjectNumber != ID_BADDY2) { vault = -3; } else if (item->Floor > y + CHECK_CLICK(3) && item->ObjectNumber != ID_VON_CROY && - item->ObjectNumber != ID_GOON1 && - item->ObjectNumber != ID_GOON2) + item->ObjectNumber != ID_BADDY1 && + item->ObjectNumber != ID_BADDY2) { vault = -2; } diff --git a/TombEngine/Game/control/control.cpp b/TombEngine/Game/control/control.cpp index 2178c4e97..9b15b8318 100644 --- a/TombEngine/Game/control/control.cpp +++ b/TombEngine/Game/control/control.cpp @@ -45,10 +45,10 @@ #include "Specific/setup.h" #include "Specific/prng.h" #include "Specific/winmain.h" -#include "Scripting/Flow/ScriptInterfaceFlowHandler.h" -#include "Scripting/ScriptInterfaceGame.h" -#include "Scripting/Objects/ScriptInterfaceObjectsHandler.h" -#include "Scripting/Strings/ScriptInterfaceStringsHandler.h" +#include "Flow/ScriptInterfaceFlowHandler.h" +#include "ScriptInterfaceGame.h" +#include "Objects/ScriptInterfaceObjectsHandler.h" +#include "Strings/ScriptInterfaceStringsHandler.h" using std::vector; using std::unordered_map; diff --git a/TombEngine/Game/control/flipeffect.cpp b/TombEngine/Game/control/flipeffect.cpp index c23ac045a..128c5dcb0 100644 --- a/TombEngine/Game/control/flipeffect.cpp +++ b/TombEngine/Game/control/flipeffect.cpp @@ -75,7 +75,7 @@ function effect_routines[NUM_FLIPEFFECTS] = MeshSwapToPour, //43 MeshSwapFromPour, //44 LaraLocationPad, //45 - KillActiveBaddies //46 + KillActiveBaddys //46 }; void FlashOrange(ItemInfo* item) @@ -191,7 +191,7 @@ void LaraHandsFree(ItemInfo* item) lara->Control.HandStatus = HandStatus::Free; } -void KillActiveBaddies(ItemInfo* item) +void KillActiveBaddys(ItemInfo* item) { if (NextItemActive != NO_ITEM) { diff --git a/TombEngine/Game/control/flipeffect.h b/TombEngine/Game/control/flipeffect.h index 72303e861..7f1204ace 100644 --- a/TombEngine/Game/control/flipeffect.h +++ b/TombEngine/Game/control/flipeffect.h @@ -25,7 +25,7 @@ void SwapCrowbar(ItemInfo* item); void ExplosionFX(ItemInfo* item); void LaraLocation(ItemInfo* item); void LaraLocationPad(ItemInfo* item); -void KillActiveBaddies(ItemInfo* item); +void KillActiveBaddys(ItemInfo* item); void LaraHandsFree(ItemInfo* item); void ShootRightGun(ItemInfo* item); void ShootLeftGun(ItemInfo* item); diff --git a/TombEngine/Game/control/los.cpp b/TombEngine/Game/control/los.cpp index fc8a0e317..215200f29 100644 --- a/TombEngine/Game/control/los.cpp +++ b/TombEngine/Game/control/los.cpp @@ -10,12 +10,12 @@ #include "Game/Lara/lara_one_gun.h" #include "Objects/Generic/Object/objects.h" #include "Objects/Generic/Switches/switch.h" -#include "Scripting/ScriptInterfaceGame.h" +#include "ScriptInterfaceGame.h" #include "Sound/sound.h" #include "Specific/input.h" #include "Specific/setup.h" -#include "Scripting/Objects/ScriptInterfaceObjectsHandler.h" +#include "Objects/ScriptInterfaceObjectsHandler.h" int NumberLosRooms; short LosRooms[20]; @@ -111,7 +111,7 @@ bool GetTargetOnLOS(GameVector* src, GameVector* dest, int drawTarget, bool firi GetFloor(target.x, target.y, target.z, &target.roomNumber); // TODO: for covering scientist -// if ((itemNumber >= 0) && (BaddieSlots[itemNumber].itemNum != NO_ITEM)) // BUGFIX: ensure target has AI. No more pistol desync and camera wobble when shooting non-AI movable objects. +// if ((itemNumber >= 0) && (BaddySlots[itemNumber].itemNum != NO_ITEM)) // BUGFIX: ensure target has AI. No more pistol desync and camera wobble when shooting non-AI movable objects. // Lara.target = &g_Level.Items[itemNumber]; // this is crashing and it's not really doing anything.. diff --git a/TombEngine/Game/control/lot.cpp b/TombEngine/Game/control/lot.cpp index 6cf886e35..3117ada0e 100644 --- a/TombEngine/Game/control/lot.cpp +++ b/TombEngine/Game/control/lot.cpp @@ -27,7 +27,7 @@ void InitialiseLOTarray(int itemNumber) } } -int EnableBaddieAI(short itemNum, int always) +int EnableBaddyAI(short itemNum, int always) { ItemInfo* item = &g_Level.Items[itemNum]; @@ -73,7 +73,7 @@ int EnableBaddieAI(short itemNum, int always) CREATURE_INFO* creatureToDisable = &ActiveCreatures[slotToDisable]; itemToDisable->status = ITEM_INVISIBLE; - DisableBaddieAI(creatureToDisable->itemNum); + DisableBaddyAI(creatureToDisable->itemNum); InitialiseSlot(itemNum, slotToDisable); return true; } diff --git a/TombEngine/Game/control/lot.h b/TombEngine/Game/control/lot.h index 467f17b63..0f503e496 100644 --- a/TombEngine/Game/control/lot.h +++ b/TombEngine/Game/control/lot.h @@ -4,7 +4,7 @@ extern std::vector ActiveCreatures; void InitialiseLOTarray(int allocMem); -int EnableBaddieAI(short itemNum, int always); +int EnableBaddyAI(short itemNum, int always); void InitialiseSlot(short itemNum, short slot); void DisableEntityAI(short itemNumber); void ClearLOT(LOTInfo* LOT); diff --git a/TombEngine/Game/control/trigger.cpp b/TombEngine/Game/control/trigger.cpp index 78b114d3a..94578b531 100644 --- a/TombEngine/Game/control/trigger.cpp +++ b/TombEngine/Game/control/trigger.cpp @@ -509,7 +509,7 @@ void TestTriggers(FloorInfo* floor, int x, int y, int z, bool heavy, int heavyFl if ((item->Flags & CODE_BITS) == CODE_BITS) { - item->Flags |= 0x20; + item->Flags |= TRIGGERED; if (flags & ONESHOT) item->Flags |= ONESHOT; @@ -523,7 +523,7 @@ void TestTriggers(FloorInfo* floor, int x, int y, int z, bool heavy, int heavyFl if (item->Status == ITEM_INVISIBLE) { item->TouchBits = 0; - if (EnableBaddieAI(value, 0)) + if (EnableBaddyAI(value, 0)) { item->Status = ITEM_ACTIVE; AddActiveItem(value); @@ -540,7 +540,7 @@ void TestTriggers(FloorInfo* floor, int x, int y, int z, bool heavy, int heavyFl item->TouchBits = 0; item->Status = ITEM_ACTIVE; AddActiveItem(value); - EnableBaddieAI(value, 1); + EnableBaddyAI(value, 1); } } else diff --git a/TombEngine/Game/control/trigger.h b/TombEngine/Game/control/trigger.h index ad1c083ca..a463a3236 100644 --- a/TombEngine/Game/control/trigger.h +++ b/TombEngine/Game/control/trigger.h @@ -11,7 +11,7 @@ constexpr auto ATONESHOT = 0x0080; constexpr auto VALUE_BITS = 0x03FF; constexpr auto CODE_BITS = 0x3E00; constexpr auto END_BIT = 0x8000; -constexpr auto TRIGGERED = 0x20; +constexpr auto TRIGGERED = 0x20; enum FLOORDATA_MASKS { FD_MASK_FUNCTION = 0x001F, diff --git a/TombEngine/Game/control/volume.cpp b/TombEngine/Game/control/volume.cpp index 420a1521b..29fbb8f8a 100644 --- a/TombEngine/Game/control/volume.cpp +++ b/TombEngine/Game/control/volume.cpp @@ -9,7 +9,7 @@ #include "Specific/setup.h" #include "Renderer/Renderer11Enums.h" #include "Renderer/Renderer11.h" -#include "Scripting/ScriptInterfaceGame.h" +#include "ScriptInterfaceGame.h" using TEN::Renderer::g_Renderer; @@ -50,9 +50,6 @@ namespace TEN::Control::Volumes break; } - // TODO: Implement checks on which item is entering/inside/leaving volume - // and pass item name or ID as argument for Lua function, so it knows its caller. - if (contains) { CurrentCollidedVolume = i + 1; diff --git a/TombEngine/Game/effects/effects.cpp b/TombEngine/Game/effects/effects.cpp index dbaa475aa..d01ebd358 100644 --- a/TombEngine/Game/effects/effects.cpp +++ b/TombEngine/Game/effects/effects.cpp @@ -19,7 +19,7 @@ #include "Specific/setup.h" #include "Specific/prng.h" #include "Specific/trmath.h" -#include "Scripting/Flow/ScriptInterfaceFlowHandler.h" +#include "Flow/ScriptInterfaceFlowHandler.h" #include "Renderer/Renderer11.h" using TEN::Renderer::g_Renderer; diff --git a/TombEngine/Game/effects/hair.cpp b/TombEngine/Game/effects/hair.cpp index fbca909b7..cf354f28a 100644 --- a/TombEngine/Game/effects/hair.cpp +++ b/TombEngine/Game/effects/hair.cpp @@ -9,7 +9,7 @@ #include "Game/items.h" #include "Game/Lara/lara.h" #include "Renderer/Renderer11.h" -#include "Scripting/Flow/ScriptInterfaceFlowHandler.h" +#include "Flow/ScriptInterfaceFlowHandler.h" #include "Specific/setup.h" #include "Specific/level.h" diff --git a/TombEngine/Game/effects/lightning.cpp b/TombEngine/Game/effects/lightning.cpp index 3d423b8b1..482cc69d7 100644 --- a/TombEngine/Game/effects/lightning.cpp +++ b/TombEngine/Game/effects/lightning.cpp @@ -10,7 +10,7 @@ #include "Game/Lara/lara.h" #include "Renderer/Renderer11.h" #include "Sound/sound.h" -#include "Scripting/Flow/ScriptInterfaceFlowHandler.h" +#include "Flow/ScriptInterfaceFlowHandler.h" #include "Specific/setup.h" #include "Specific/level.h" #include "Specific/trmath.h" diff --git a/TombEngine/Game/effects/tomb4fx.cpp b/TombEngine/Game/effects/tomb4fx.cpp index 290682f15..57851d4da 100644 --- a/TombEngine/Game/effects/tomb4fx.cpp +++ b/TombEngine/Game/effects/tomb4fx.cpp @@ -12,7 +12,7 @@ #include "Game/items.h" #include "Game/Lara/lara.h" #include "Renderer/Renderer11.h" -#include "Scripting/Flow/ScriptInterfaceFlowHandler.h" +#include "Flow/ScriptInterfaceFlowHandler.h" #include "Sound/sound.h" #include "Specific/level.h" #include "Specific/setup.h" diff --git a/TombEngine/Game/effects/weather.cpp b/TombEngine/Game/effects/weather.cpp index 63efa6202..24274fa19 100644 --- a/TombEngine/Game/effects/weather.cpp +++ b/TombEngine/Game/effects/weather.cpp @@ -10,7 +10,7 @@ #include "Specific/prng.h" #include "Specific/setup.h" #include "Specific/level.h" -#include "Scripting/ScriptInterfaceLevel.h" +#include "ScriptInterfaceLevel.h" using namespace TEN::Math::Random; diff --git a/TombEngine/Game/effects/weather.h b/TombEngine/Game/effects/weather.h index 88f9ecf89..55abe49a2 100644 --- a/TombEngine/Game/effects/weather.h +++ b/TombEngine/Game/effects/weather.h @@ -1,6 +1,6 @@ #pragma once #include -#include "Scripting/ScriptInterfaceLevel.h" +#include "ScriptInterfaceLevel.h" #include "Specific/trmath.h" namespace TEN { diff --git a/TombEngine/Game/gui.cpp b/TombEngine/Game/gui.cpp index c5acd7207..05aa9688d 100644 --- a/TombEngine/Game/gui.cpp +++ b/TombEngine/Game/gui.cpp @@ -19,7 +19,7 @@ #include "Specific/input.h" #include "Specific/configuration.h" #include "Renderer/Renderer11.h" -#include "Scripting/ScriptInterfaceLevel.h" +#include "ScriptInterfaceLevel.h" using namespace TEN::Renderer; GuiController g_Gui; diff --git a/TombEngine/Game/gui.h b/TombEngine/Game/gui.h index dc93b3e27..aa96efcb4 100644 --- a/TombEngine/Game/gui.h +++ b/TombEngine/Game/gui.h @@ -1,5 +1,5 @@ #pragma once -#include "Scripting/LanguageScript.h" +#include "LanguageScript.h" #include "Specific/configuration.h" enum class InventoryMode diff --git a/TombEngine/Game/items.cpp b/TombEngine/Game/items.cpp index c55aa5dda..cf3699181 100644 --- a/TombEngine/Game/items.cpp +++ b/TombEngine/Game/items.cpp @@ -5,10 +5,10 @@ #include "Game/collision/floordata.h" #include "Game/effects/effects.h" #include "Game/Lara/lara.h" -#include "Scripting/ScriptInterfaceGame.h" +#include "ScriptInterfaceGame.h" #include "Specific/setup.h" #include "Specific/level.h" -#include "Scripting/Objects/ScriptInterfaceObjectsHandler.h" +#include "Objects/ScriptInterfaceObjectsHandler.h" using namespace TEN::Floordata; diff --git a/TombEngine/Game/pickup/pickup.cpp b/TombEngine/Game/pickup/pickup.cpp index 9000ce285..ac8f8218c 100644 --- a/TombEngine/Game/pickup/pickup.cpp +++ b/TombEngine/Game/pickup/pickup.cpp @@ -261,7 +261,7 @@ void DoPickup(ItemInfo* laraItem) else { pickupItem->ItemFlags[3] = 1; - pickupItem->Flags |= 0x20; + pickupItem->Flags |= TRIGGERED; pickupItem->Status = ITEM_INVISIBLE; } @@ -294,7 +294,7 @@ void DoPickup(ItemInfo* laraItem) if (pickupItem->TriggerFlags & 0xC0) { pickupItem->ItemFlags[3] = 1; - pickupItem->Flags |= 0x20; + pickupItem->Flags |= TRIGGERED; pickupItem->Status = ITEM_INVISIBLE; } @@ -900,7 +900,7 @@ void InitialisePickup(short itemNumber) item->MeshBits = 0; if (item->Status == ITEM_INVISIBLE) - item->Flags |= 0x20; + item->Flags |= TRIGGERED; } } diff --git a/TombEngine/Game/savegame.cpp b/TombEngine/Game/savegame.cpp index a7f7e5179..91847b7e7 100644 --- a/TombEngine/Game/savegame.cpp +++ b/TombEngine/Game/savegame.cpp @@ -26,9 +26,9 @@ #include "Specific/level.h" #include "Specific/setup.h" #include "Specific/savegame/flatbuffers/ten_savegame_generated.h" -#include "Scripting/ScriptInterfaceLevel.h" -#include "Scripting/ScriptInterfaceGame.h" -#include "Scripting/Objects/ScriptInterfaceObjectsHandler.h" +#include "ScriptInterfaceLevel.h" +#include "ScriptInterfaceGame.h" +#include "Objects/ScriptInterfaceObjectsHandler.h" using namespace TEN::Effects::Lara; @@ -1127,7 +1127,7 @@ bool SaveGame::Load(int slot) // Creature data for intelligent items if (item->ObjectNumber != ID_LARA && obj->intelligent) { - EnableBaddieAI(i, true); + EnableBaddyAI(i, true); auto creature = GetCreatureInfo(item); auto data = savedItem->data(); diff --git a/TombEngine/Game/savegame.h b/TombEngine/Game/savegame.h index e3cb0c002..e4af914a5 100644 --- a/TombEngine/Game/savegame.h +++ b/TombEngine/Game/savegame.h @@ -1,5 +1,5 @@ #pragma once -#include "Scripting/Flow/ScriptInterfaceFlowHandler.h" +#include "Flow/ScriptInterfaceFlowHandler.h" #include "Specific/IO/ChunkId.h" #include "Specific/IO/ChunkReader.h" #include "Specific/IO/ChunkWriter.h" diff --git a/TombEngine/Objects/Generic/puzzles_keys.cpp b/TombEngine/Objects/Generic/puzzles_keys.cpp index 3190f77cd..5d7b08997 100644 --- a/TombEngine/Objects/Generic/puzzles_keys.cpp +++ b/TombEngine/Objects/Generic/puzzles_keys.cpp @@ -146,7 +146,7 @@ void PuzzleHoleCollision(short itemNumber, ItemInfo* laraItem, CollisionInfo* co laraInfo->Control.HandStatus = HandStatus::Busy; laraInfo->InteractedItem = itemNumber; receptableItem->Pose.Orientation.y = oldYrot; - receptableItem->Flags |= 0x20; + receptableItem->Flags |= TRIGGERED; return; } @@ -309,7 +309,7 @@ void KeyHoleCollision(short itemNumber, ItemInfo* laraItem, CollisionInfo* coll) laraInfo->Control.IsMoving = false; ResetLaraFlex(laraItem); laraInfo->Control.HandStatus = HandStatus::Busy; - keyHoleItem->Flags |= 0x20; + keyHoleItem->Flags |= TRIGGERED; keyHoleItem->Status = ITEM_ACTIVE; if (keyHoleItem->TriggerFlags == 1 && keyHoleItem->ObjectNumber == ID_KEY_HOLE8) diff --git a/TombEngine/Objects/TR1/Entity/tr1_centaur.cpp b/TombEngine/Objects/TR1/Entity/tr1_centaur.cpp index 254ab7872..673335a5c 100644 --- a/TombEngine/Objects/TR1/Entity/tr1_centaur.cpp +++ b/TombEngine/Objects/TR1/Entity/tr1_centaur.cpp @@ -88,9 +88,7 @@ void ControlCentaurBomb(short itemNumber) if (probe.Position.Floor < item->Pose.Position.y || probe.Position.Ceiling > item->Pose.Position.y) { - item->Pose.Position.x = oldPos.x; - item->Pose.Position.y = oldPos.y; - item->Pose.Position.z = oldPos.z; + item->Pose.Position = oldPos; if (TestEnvironment(ENV_FLAG_WATER, item->RoomNumber)) TriggerUnderwaterExplosion(item, 0); @@ -131,7 +129,7 @@ void ControlCentaurBomb(short itemNumber) currentObject->intelligent && !currentObject->undead && currentObject->collision) { - DoExplosiveDamageOnBaddie(LaraItem, currentItem, item, LaraWeaponType::Crossbow); + DoExplosiveDamageOnBaddy(LaraItem, currentItem, item, LaraWeaponType::Crossbow); } k++; @@ -154,12 +152,10 @@ static void RocketGun(ItemInfo* centaurItem) projectileItem->Shade = 16 * 256; projectileItem->RoomNumber = centaurItem->RoomNumber; - Vector3Int pos = { 11, 415, 41 }; + auto pos = Vector3Int(11, 415, 41); GetJointAbsPosition(centaurItem, &pos, 13); - projectileItem->Pose.Position.x = pos.x; - projectileItem->Pose.Position.y = pos.y; - projectileItem->Pose.Position.z = pos.z; + projectileItem->Pose.Position = pos; InitialiseItem(itemNumber); projectileItem->Pose.Orientation.x = 0; diff --git a/TombEngine/Objects/TR2/Entity/tr2_dragon.cpp b/TombEngine/Objects/TR2/Entity/tr2_dragon.cpp index c39fdf5c4..c19b6b31e 100644 --- a/TombEngine/Objects/TR2/Entity/tr2_dragon.cpp +++ b/TombEngine/Objects/TR2/Entity/tr2_dragon.cpp @@ -559,7 +559,7 @@ void BartoliControl(short itemNumber) front = &g_Level.Items[frontItem]; front->TouchBits = back->TouchBits = 0; - EnableBaddieAI(frontItem, 1); + EnableBaddyAI(frontItem, 1); AddActiveItem(frontItem); AddActiveItem(backItem); back->Status = ITEM_ACTIVE; diff --git a/TombEngine/Objects/TR2/Entity/tr2_skidman.cpp b/TombEngine/Objects/TR2/Entity/tr2_skidman.cpp index 4d165f102..1ad4f2308 100644 --- a/TombEngine/Objects/TR2/Entity/tr2_skidman.cpp +++ b/TombEngine/Objects/TR2/Entity/tr2_skidman.cpp @@ -110,7 +110,7 @@ void SkidooManControl(short riderItemNumber) if (!item->Data) { - EnableBaddieAI(itemNumber, TRUE); + EnableBaddyAI(itemNumber, TRUE); item->Status = ITEM_ACTIVE; } diff --git a/TombEngine/Objects/TR2/tr2_objects.cpp b/TombEngine/Objects/TR2/tr2_objects.cpp index 96be9b83e..2aa97d374 100644 --- a/TombEngine/Objects/TR2/tr2_objects.cpp +++ b/TombEngine/Objects/TR2/tr2_objects.cpp @@ -155,7 +155,7 @@ static void StartEntity(ObjectInfo* obj) g_Level.Bones[obj->boneIndex + 14 * 4] |= (ROT_Y); } - obj = &Objects[ID_GOON_SILENCER1]; + obj = &Objects[ID_BADDY_SILENCER1]; if (obj->loaded) { obj->initialise = InitialiseCreature; @@ -176,17 +176,17 @@ static void StartEntity(ObjectInfo* obj) g_Level.Bones[obj->boneIndex + 1 * 4] |= (ROT_X | ROT_Y); } - obj = &Objects[ID_GOON_SILENCER2]; + obj = &Objects[ID_BADDY_SILENCER2]; if (obj->loaded) { - if (Objects[ID_GOON_SILENCER1].loaded) + if (Objects[ID_BADDY_SILENCER1].loaded) { - obj->animIndex = Objects[ID_GOON_SILENCER1].animIndex; - obj->frameBase = Objects[ID_GOON_SILENCER1].frameBase; + obj->animIndex = Objects[ID_BADDY_SILENCER1].animIndex; + obj->frameBase = Objects[ID_BADDY_SILENCER1].frameBase; } else { - TENLog("ID_GOON_SILENCER1 not found!", LogLevel::Error); + TENLog("ID_BADDY_SILENCER1 not found!", LogLevel::Error); } obj->initialise = InitialiseCreature; @@ -207,17 +207,17 @@ static void StartEntity(ObjectInfo* obj) g_Level.Bones[obj->boneIndex + 1 * 4] |= (ROT_X | ROT_Y); } - obj = &Objects[ID_GOON_SILENCER3]; + obj = &Objects[ID_BADDY_SILENCER3]; if (obj->loaded) { - if (Objects[ID_GOON_SILENCER1].loaded) + if (Objects[ID_BADDY_SILENCER1].loaded) { - obj->animIndex = Objects[ID_GOON_SILENCER1].animIndex; - obj->frameBase = Objects[ID_GOON_SILENCER1].frameBase; + obj->animIndex = Objects[ID_BADDY_SILENCER1].animIndex; + obj->frameBase = Objects[ID_BADDY_SILENCER1].frameBase; } else { - TENLog("ID_GOON_SILENCER1 not found!", LogLevel::Error); + TENLog("ID_BADDY_SILENCER1 not found!", LogLevel::Error); } obj->initialise = InitialiseCreature; diff --git a/TombEngine/Objects/TR4/Entity/tr4_ahmet.cpp b/TombEngine/Objects/TR4/Entity/tr4_ahmet.cpp index 1f53cb158..8152810a7 100644 --- a/TombEngine/Objects/TR4/Entity/tr4_ahmet.cpp +++ b/TombEngine/Objects/TR4/Entity/tr4_ahmet.cpp @@ -393,7 +393,7 @@ namespace TEN::Entities::TR4 item->Status = ITEM_ACTIVE; item->Collidable = true; - EnableBaddieAI(itemNumber, 1); + EnableBaddyAI(itemNumber, 1); item->TriggerFlags = 1; return true; diff --git a/TombEngine/Objects/TR4/Entity/tr4_goon.cpp b/TombEngine/Objects/TR4/Entity/tr4_baddy.cpp similarity index 63% rename from TombEngine/Objects/TR4/Entity/tr4_goon.cpp rename to TombEngine/Objects/TR4/Entity/tr4_baddy.cpp index fe66482a6..651499faf 100644 --- a/TombEngine/Objects/TR4/Entity/tr4_goon.cpp +++ b/TombEngine/Objects/TR4/Entity/tr4_baddy.cpp @@ -1,5 +1,5 @@ #include "framework.h" -#include "tr4_goon.h" +#include "tr4_baddy.h" #include "Game/items.h" #include "Game/collision/collide_room.h" #include "Game/control/box.h" @@ -15,22 +15,22 @@ #include "Game/misc.h" /* -ID_GOON1 +ID_BADDY1 1 - Rolls to the right 1 pow 2 - Jumps to the left 1 pow 3 - ducks when triggered 4 - Climbs up 4 clicks when triggered 101-104 – Slides to the left while crouching when triggered (eg. train level – just doesn’t work in trainmode) 1004 - Climbs up 6 clicks when triggered -1000 – N x 1000 – Is activated once the goon with the previous thousand is dead and needs no trigger (have tested up to 20.000). Must be placed in room 2 of a level. +1000 – N x 1000 – Is activated once the baddy with the previous thousand is dead and needs no trigger (have tested up to 20.000). Must be placed in room 2 of a level. This means that: -2000 - Attacks Lara after she kills 1st goon triggered -3000 - Same as above but after she kills 2nd goon triggered -4000 - Same as above but after she kills 3rd goon triggered -6000 - Same as above but after she kills 5th goon triggered +2000 - Attacks Lara after she kills 1st baddy triggered +3000 - Same as above but after she kills 2nd baddy triggered +4000 - Same as above but after she kills 3rd baddy triggered +6000 - Same as above but after she kills 5th baddy triggered etc. -ID_GOON2 +ID_BADDY2 1 - Jumps to right when triggered 2 - Rolls to left when triggered 3 - Crouches when triggered @@ -41,181 +41,181 @@ ID_GOON2 13 - Crouches when triggered and draws uzi 14 - Climbs up 4 clicks when triggered and draws uzi 101 - Slides to the left while crouching when triggered (eg. Train level) -101-104 - Slides to the left while crouching when triggered. The setup requires an enemy jeep and an AI_X1 nullmesh with the same OCB as the jeep and the goon. It works only in trainmode. When triggered, the goon will ride the roof of the enemy jeep parallel to the railtracks, until they reach the AI_X1 nullmesh. The goon will jump off in the direction he’s placed in the map, while the jeep will fall back. +101-104 - Slides to the left while crouching when triggered. The setup requires an enemy jeep and an AI_X1 nullmesh with the same OCB as the jeep and the baddy. It works only in trainmode. When triggered, the baddy will ride the roof of the enemy jeep parallel to the railtracks, until they reach the AI_X1 nullmesh. The baddy will jump off in the direction he’s placed in the map, while the jeep will fall back. */ namespace TEN::Entities::TR4 { - enum GoonState + enum BaddyState { - GOON_STATE_IDLE = 0, - GOON_STATE_WALK = 1, - GOON_STATE_RUN = 2, + BADDY_STATE_IDLE = 0, + BADDY_STATE_WALK = 1, + BADDY_STATE_RUN = 2, // 3 - GOON_STATE_DODGE_START = 4, + BADDY_STATE_DODGE_START = 4, // 5 // 6 // 7 - GOON_STATE_UNKNOWN_8 = 8, - GOON_STATE_UNKNOWN_9 = 9, - GOON_STATE_DRAW_GUN = 10, - GOON_STATE_HOLSTER_GUN = 11, - GOON_STATE_DRAW_SWORD = 12, - GOON_STATE_HOLSTER_SWORD = 13, - GOON_STATE_FIRE = 14, - GOON_STATE_SWORD_HIT_FRONT = 15, - GOON_STATE_SWORD_HIT_RIGHT = 16, - GOON_STATE_SWORD_HIT_LEFT = 17, - GOON_STATE_MONKEY_GRAB = 18, - GOON_STATE_MONKEY_IDLE = 19, - GOON_STATE_MONKEY_FORWARD = 20, - GOON_STATE_MONKEY_PUSH_OFF = 21, - GOON_STATE_MONKEY_FALL_LAND = 22, - GOON_STATE_ROLL_LEFT = 23, - GOON_STATE_JUMP_RIGHT = 24, - GOON_STATE_STAND_TO_CROUCH = 25, - GOON_STATE_CROUCH = 26, - GOON_STATE_CROUCH_PICKUP = 27, - GOON_STATE_CROUCH_TO_STAND = 28, - GOON_STATE_WALK_SWORD_HIT_RIGHT = 29, - GOON_STATE_SOMERSAULT = 30, - GOON_STATE_AIM = 31, - GOON_STATE_DEATH = 32, - GOON_STATE_JUMP_FORWARD_1_BLOCK = 33, - GOON_STATE_JUMP_FORWARD_FALL = 34, - GOON_STATE_MONKEY_TO_FREEFALL = 35, - GOON_STATE_FREEFALL = 36, - GOON_STATE_FREEFALL_LAND_DEATH = 37, - GOON_STATE_JUMP_FORWARD_2_BLOCKS = 38, - GOON_STATE_CLIMB_4_STEPS = 39, - GOON_STATE_CLIMB_3_STEPS = 40, - GOON_STATE_CLIMB_2_STEPS = 41, - GOON_STATE_JUMP_OFF_4_STEPS = 42, - GOON_STATE_JUMP_OFF_3_STEPS = 43, - GOON_STATE_BLIND = 44 + BADDY_STATE_UNKNOWN_8 = 8, + BADDY_STATE_UNKNOWN_9 = 9, + BADDY_STATE_DRAW_GUN = 10, + BADDY_STATE_HOLSTER_GUN = 11, + BADDY_STATE_DRAW_SWORD = 12, + BADDY_STATE_HOLSTER_SWORD = 13, + BADDY_STATE_FIRE = 14, + BADDY_STATE_SWORD_HIT_FRONT = 15, + BADDY_STATE_SWORD_HIT_RIGHT = 16, + BADDY_STATE_SWORD_HIT_LEFT = 17, + BADDY_STATE_MONKEY_GRAB = 18, + BADDY_STATE_MONKEY_IDLE = 19, + BADDY_STATE_MONKEY_FORWARD = 20, + BADDY_STATE_MONKEY_PUSH_OFF = 21, + BADDY_STATE_MONKEY_FALL_LAND = 22, + BADDY_STATE_ROLL_LEFT = 23, + BADDY_STATE_JUMP_RIGHT = 24, + BADDY_STATE_STAND_TO_CROUCH = 25, + BADDY_STATE_CROUCH = 26, + BADDY_STATE_CROUCH_PICKUP = 27, + BADDY_STATE_CROUCH_TO_STAND = 28, + BADDY_STATE_WALK_SWORD_HIT_RIGHT = 29, + BADDY_STATE_SOMERSAULT = 30, + BADDY_STATE_AIM = 31, + BADDY_STATE_DEATH = 32, + BADDY_STATE_JUMP_FORWARD_1_BLOCK = 33, + BADDY_STATE_JUMP_FORWARD_FALL = 34, + BADDY_STATE_MONKEY_TO_FREEFALL = 35, + BADDY_STATE_FREEFALL = 36, + BADDY_STATE_FREEFALL_LAND_DEATH = 37, + BADDY_STATE_JUMP_FORWARD_2_BLOCKS = 38, + BADDY_STATE_CLIMB_4_STEPS = 39, + BADDY_STATE_CLIMB_3_STEPS = 40, + BADDY_STATE_CLIMB_2_STEPS = 41, + BADDY_STATE_JUMP_OFF_4_STEPS = 42, + BADDY_STATE_JUMP_OFF_3_STEPS = 43, + BADDY_STATE_BLIND = 44 }; - enum GoonAnim + enum BaddyAnim { - GOON_ANIM_RUN = 0, - GOON_ANIM_RUN_STOP_START = 1, - GOON_ANIM_RUN_STOP_END = 2, - GOON_ANIM_SOMERSAULT_START = 3, - GOON_ANIM_SOMERSAULT_END = 4, - GOON_ANIM_DODGE_START = 5, + BADDY_ANIM_RUN = 0, + BADDY_ANIM_RUN_STOP_START = 1, + BADDY_ANIM_RUN_STOP_END = 2, + BADDY_ANIM_SOMERSAULT_START = 3, + BADDY_ANIM_SOMERSAULT_END = 4, + BADDY_ANIM_DODGE_START = 5, // 6 // 7 // 8 - GOON_ANIM_MONKEY_GRAB = 9, - GOON_ANIM_MONKEY_IDLE = 10, - GOON_ANIM_MONKEY_FORWARD = 11, - GOON_ANIM_MONKEY_IDLE_TO_FORWARD = 12, - GOON_ANIM_MONKEY_STOP_LEFT = 13, - GOON_ANIM_MONKEY_STOP_RIGHT = 14, - GOON_ANIM_MONKEY_FALL_LAND = 15, - GOON_ANIM_MONKEY_PUSH_OFF = 16, - GOON_ANIM_DODGE_END = 17, - GOON_ANIM_STAND_IDLE = 18, - GOON_ANIM_DODGE_END_TO_STAND = 19, - GOON_ANIM_DRAW_GUN = 20, - GOON_ANIM_HOLSTER_GUN = 21, - GOON_ANIM_DRAW_SWORD = 22, - GOON_ANIM_HOLSTER_SWORD = 23, - GOON_ANIM_STAND_TO_ROLL_LEFT = 24, - GOON_ANIM_ROLL_LEFT_START = 25, - GOON_ANIM_ROLL_LEFT_CONTINUE = 26, - GOON_ANIM_ROLL_LEFT_END = 27, - GOON_ANIM_ROLL_LEFT_TO_CROUCH = 28, - GOON_ANIM_CROUCH = 29, - GOON_ANIM_CROUCH_TO_STAND = 30, - GOON_ANIM_STAND_TO_WALK = 31, - GOON_ANIM_WALK = 32, - GOON_ANIM_WALK_TO_RUN = 33, - GOON_ANIM_STAND_TO_AIM = 34, - GOON_ANIM_AIM = 35, - GOON_ANIM_FIRE = 36, - GOON_ANIM_AIM_TO_STAND = 37, - GOON_ANIM_SWORD_HIT_FRONT = 38, - GOON_ANIM_CROUCH_PICKUP = 39, - GOON_ANIM_STAND_TO_CROUCH = 40, - GOON_ANIM_SWORD_HIT_RIGHT = 41, - GOON_ANIM_SWORD_HIT_RIGHT_TO_LEFT = 42, - GOON_ANIM_SWORD_HIT_RIGHT_TO_STAND = 43, - GOON_ANIM_SWORD_HIT_LEFT = 44, - GOON_ANIM_STAND_DEATH = 45, - GOON_ANIM_WALK_SWORD_HIT_RIGHT = 46, - GOON_ANIM_STAND_TO_JUMP_RIGHT = 47, - GOON_ANIM_JUMP_RIGHT_START = 48, - GOON_ANIM_JUMP_RIGHT_CONTINUE = 49, - GOON_ANIM_JUMP_RIGHT_END = 50, - GOON_ANIM_RUN_TO_WALK = 51, + BADDY_ANIM_MONKEY_GRAB = 9, + BADDY_ANIM_MONKEY_IDLE = 10, + BADDY_ANIM_MONKEY_FORWARD = 11, + BADDY_ANIM_MONKEY_IDLE_TO_FORWARD = 12, + BADDY_ANIM_MONKEY_STOP_LEFT = 13, + BADDY_ANIM_MONKEY_STOP_RIGHT = 14, + BADDY_ANIM_MONKEY_FALL_LAND = 15, + BADDY_ANIM_MONKEY_PUSH_OFF = 16, + BADDY_ANIM_DODGE_END = 17, + BADDY_ANIM_STAND_IDLE = 18, + BADDY_ANIM_DODGE_END_TO_STAND = 19, + BADDY_ANIM_DRAW_GUN = 20, + BADDY_ANIM_HOLSTER_GUN = 21, + BADDY_ANIM_DRAW_SWORD = 22, + BADDY_ANIM_HOLSTER_SWORD = 23, + BADDY_ANIM_STAND_TO_ROLL_LEFT = 24, + BADDY_ANIM_ROLL_LEFT_START = 25, + BADDY_ANIM_ROLL_LEFT_CONTINUE = 26, + BADDY_ANIM_ROLL_LEFT_END = 27, + BADDY_ANIM_ROLL_LEFT_TO_CROUCH = 28, + BADDY_ANIM_CROUCH = 29, + BADDY_ANIM_CROUCH_TO_STAND = 30, + BADDY_ANIM_STAND_TO_WALK = 31, + BADDY_ANIM_WALK = 32, + BADDY_ANIM_WALK_TO_RUN = 33, + BADDY_ANIM_STAND_TO_AIM = 34, + BADDY_ANIM_AIM = 35, + BADDY_ANIM_FIRE = 36, + BADDY_ANIM_AIM_TO_STAND = 37, + BADDY_ANIM_SWORD_HIT_FRONT = 38, + BADDY_ANIM_CROUCH_PICKUP = 39, + BADDY_ANIM_STAND_TO_CROUCH = 40, + BADDY_ANIM_SWORD_HIT_RIGHT = 41, + BADDY_ANIM_SWORD_HIT_RIGHT_TO_LEFT = 42, + BADDY_ANIM_SWORD_HIT_RIGHT_TO_STAND = 43, + BADDY_ANIM_SWORD_HIT_LEFT = 44, + BADDY_ANIM_STAND_DEATH = 45, + BADDY_ANIM_WALK_SWORD_HIT_RIGHT = 46, + BADDY_ANIM_STAND_TO_JUMP_RIGHT = 47, + BADDY_ANIM_JUMP_RIGHT_START = 48, + BADDY_ANIM_JUMP_RIGHT_CONTINUE = 49, + BADDY_ANIM_JUMP_RIGHT_END = 50, + BADDY_ANIM_RUN_TO_WALK = 51, // 52 // 53 - GOON_ANIM_WALK_STOP_RIGHT = 54, - GOON_ANIM_STAND_TO_JUMP_FORWARD = 55, - GOON_ANIM_JUMP_FORWARD_1_BLOCK = 56, - GOON_ANIM_JUMP_FORWARD_FALL = 57, - GOON_ANIM_JUMP_FORWARD_LAND = 58, - GOON_ANIM_MONKEY_TO_FREEFALL = 59, - GOON_ANIM_FREEFALL = 60, - GOON_ANIM_FREEFALL_LAND_DEATH = 61, - GOON_ANIM_CLIMB_4_STEPS = 62, - GOON_ANIM_CLIMB_3_STEPS = 63, - GOON_ANIM_CLIMB_2_STEPS = 64, - GOON_ANIM_JUMP_OFF_4_STEPS = 65, - GOON_ANIM_JUMP_OFF_3_STEPS = 66, - GOON_ANIM_JUMP_FORWARD_2_BLOCKS = 67, - GOON_ANIM_BLIND = 68, - GOON_ANIM_BLIND_TO_STAND = 69, - GOON_ANIM_DEAD = 70, + BADDY_ANIM_WALK_STOP_RIGHT = 54, + BADDY_ANIM_STAND_TO_JUMP_FORWARD = 55, + BADDY_ANIM_JUMP_FORWARD_1_BLOCK = 56, + BADDY_ANIM_JUMP_FORWARD_FALL = 57, + BADDY_ANIM_JUMP_FORWARD_LAND = 58, + BADDY_ANIM_MONKEY_TO_FREEFALL = 59, + BADDY_ANIM_FREEFALL = 60, + BADDY_ANIM_FREEFALL_LAND_DEATH = 61, + BADDY_ANIM_CLIMB_4_STEPS = 62, + BADDY_ANIM_CLIMB_3_STEPS = 63, + BADDY_ANIM_CLIMB_2_STEPS = 64, + BADDY_ANIM_JUMP_OFF_4_STEPS = 65, + BADDY_ANIM_JUMP_OFF_3_STEPS = 66, + BADDY_ANIM_JUMP_FORWARD_2_BLOCKS = 67, + BADDY_ANIM_BLIND = 68, + BADDY_ANIM_BLIND_TO_STAND = 69, + BADDY_ANIM_DEAD = 70, }; - enum GoonFrame + enum BaddyFrame { - FRAME_GOON_HOLSTER_GUN = 20, - FRAME_GOON_DRAW_GUN = 21, - FRAME_GOON_HOLSTER_SWORD = 22, - FRAME_GOON_DRAW_SWORD = 12, - FRAME_GOON_RUN_TO_SOMERSAULT = 11, - FRAME_GOON_SWORD_HIT_NO_DAMAGE_MAX = 12, - FRAME_GOON_SWORD_HIT_DAMAGE_MIN = 13, - FRAME_GOON_SWORD_HIT_DAMAGE_MAX = 21, - FRAME_GOON_CROUCH_PICKUP = 9, - FRAME_GOON_FIRE_MIN = 1, - FRAME_GOON_FIRE_MAX = 13, - FRAME_GOON_SOMERSAULT_START_TAKE_OFF = 18, + FRAME_BADDY_HOLSTER_GUN = 20, + FRAME_BADDY_DRAW_GUN = 21, + FRAME_BADDY_HOLSTER_SWORD = 22, + FRAME_BADDY_DRAW_SWORD = 12, + FRAME_BADDY_RUN_TO_SOMERSAULT = 11, + FRAME_BADDY_SWORD_HIT_NO_DAMAGE_MAX = 12, + FRAME_BADDY_SWORD_HIT_DAMAGE_MIN = 13, + FRAME_BADDY_SWORD_HIT_DAMAGE_MAX = 21, + FRAME_BADDY_CROUCH_PICKUP = 9, + FRAME_BADDY_FIRE_MIN = 1, + FRAME_BADDY_FIRE_MAX = 13, + FRAME_BADDY_SOMERSAULT_START_TAKE_OFF = 18, }; - enum GoonMeshSwapFlags + enum BaddyMeshSwapFlags { - MESHSWAPFLAGS_GOON_EMPTY = 0x7FC800, - MESHSWAPFLAGS_GOON_SWORD_SIMPLE = 0x7E0880, - MESHSWAPFLAGS_GOON_SWORD_NINJA = 0x000880, - MESHSWAPFLAGS_GOON_GUN = 0x7FC010, + MESHSWAPFLAGS_BADDY_EMPTY = 0x7FC800, + MESHSWAPFLAGS_BADDY_SWORD_SIMPLE = 0x7E0880, + MESHSWAPFLAGS_BADDY_SWORD_NINJA = 0x000880, + MESHSWAPFLAGS_BADDY_GUN = 0x7FC010, }; - #define GOON_USE_UZI 24 + #define BADDY_USE_UZI 24 - BITE_INFO GoonGunBite = { 0, -16, 200, 11 }; - BITE_INFO GoonSwordBite = { 0, 0, 0, 15 }; + BITE_INFO BaddyGunBite = { 0, -16, 200, 11 }; + BITE_INFO BaddySwordBite = { 0, 0, 0, 15 }; - void InitialiseGoon(short itemNumber) + void InitialiseBaddy(short itemNumber) { auto* item = &g_Level.Items[itemNumber]; ClearItem(itemNumber); - short objectNumber = (Objects[ID_GOON2].loaded ? ID_GOON2 : ID_GOON1); + short objectNumber = (Objects[ID_BADDY2].loaded ? ID_BADDY2 : ID_BADDY1); - if (item->ObjectNumber == ID_GOON1) + if (item->ObjectNumber == ID_BADDY1) { - item->SwapMeshFlags = MESHSWAPFLAGS_GOON_GUN; + item->SwapMeshFlags = MESHSWAPFLAGS_BADDY_GUN; item->MeshBits = 0xFF81FFFF; - item->ItemFlags[2] = GOON_USE_UZI; + item->ItemFlags[2] = BADDY_USE_UZI; } else { - item->SwapMeshFlags = MESHSWAPFLAGS_GOON_SWORD_NINJA; + item->SwapMeshFlags = MESHSWAPFLAGS_BADDY_SWORD_NINJA; item->MeshBits = -1; item->ItemFlags[2] = 0; } @@ -227,57 +227,57 @@ namespace TEN::Entities::TR4 // To the same things of OCB 1, 2, 3, 4 but also drawing uzis if (ocb > 9 && ocb < 20) { - item->ItemFlags[2] += GOON_USE_UZI; + item->ItemFlags[2] += BADDY_USE_UZI; item->TriggerFlags -= 10; ocb -= 10; } if (!ocb || ocb > 4 && ocb < 7) { - item->Animation.AnimNumber = Objects[objectNumber].animIndex + GOON_ANIM_STAND_IDLE; + item->Animation.AnimNumber = Objects[objectNumber].animIndex + BADDY_ANIM_STAND_IDLE; item->Animation.FrameNumber = g_Level.Anims[item->Animation.AnimNumber].frameBase; - item->Animation.TargetState = GOON_STATE_IDLE; - item->Animation.ActiveState = GOON_STATE_IDLE; + item->Animation.TargetState = BADDY_STATE_IDLE; + item->Animation.ActiveState = BADDY_STATE_IDLE; return; } // OCB: jump right if (ocb == 1) { - item->Animation.AnimNumber = Objects[objectNumber].animIndex + GOON_ANIM_STAND_TO_JUMP_RIGHT; + item->Animation.AnimNumber = Objects[objectNumber].animIndex + BADDY_ANIM_STAND_TO_JUMP_RIGHT; item->Animation.FrameNumber = g_Level.Anims[item->Animation.AnimNumber].frameBase; - item->Animation.TargetState = GOON_STATE_JUMP_RIGHT; - item->Animation.ActiveState = GOON_STATE_JUMP_RIGHT; + item->Animation.TargetState = BADDY_STATE_JUMP_RIGHT; + item->Animation.ActiveState = BADDY_STATE_JUMP_RIGHT; return; } // OCB: jump left if (ocb == 2) { - item->Animation.AnimNumber = Objects[objectNumber].animIndex + GOON_ANIM_STAND_TO_ROLL_LEFT; + item->Animation.AnimNumber = Objects[objectNumber].animIndex + BADDY_ANIM_STAND_TO_ROLL_LEFT; item->Animation.FrameNumber = g_Level.Anims[item->Animation.AnimNumber].frameBase; - item->Animation.TargetState = GOON_STATE_ROLL_LEFT; - item->Animation.ActiveState = GOON_STATE_ROLL_LEFT; + item->Animation.TargetState = BADDY_STATE_ROLL_LEFT; + item->Animation.ActiveState = BADDY_STATE_ROLL_LEFT; return; } // OCB: crouch if (ocb == 3) { - item->Animation.AnimNumber = Objects[objectNumber].animIndex + GOON_ANIM_CROUCH; + item->Animation.AnimNumber = Objects[objectNumber].animIndex + BADDY_ANIM_CROUCH; item->Animation.FrameNumber = g_Level.Anims[item->Animation.AnimNumber].frameBase; - item->Animation.TargetState = GOON_STATE_CROUCH; - item->Animation.ActiveState = GOON_STATE_CROUCH; + item->Animation.TargetState = BADDY_STATE_CROUCH; + item->Animation.ActiveState = BADDY_STATE_CROUCH; return; } // OCB: climb up 4 or 6 clicks if (ocb == 4) { - item->Animation.AnimNumber = Objects[objectNumber].animIndex + GOON_ANIM_CLIMB_4_STEPS; + item->Animation.AnimNumber = Objects[objectNumber].animIndex + BADDY_ANIM_CLIMB_4_STEPS; item->Animation.FrameNumber = g_Level.Anims[item->Animation.AnimNumber].frameBase; - item->Animation.TargetState = GOON_STATE_CLIMB_4_STEPS; - item->Animation.ActiveState = GOON_STATE_CLIMB_4_STEPS; + item->Animation.TargetState = BADDY_STATE_CLIMB_4_STEPS; + item->Animation.ActiveState = BADDY_STATE_CLIMB_4_STEPS; item->Pose.Position.x += phd_sin(item->Pose.Orientation.y) * CLICK(4); item->Pose.Position.z += phd_cos(item->Pose.Orientation.y) * CLICK(4); return; @@ -286,10 +286,10 @@ namespace TEN::Entities::TR4 // OCB: crouch and jump in train levels? if (ocb > 100) { - item->Animation.AnimNumber = Objects[objectNumber].animIndex + GOON_ANIM_CROUCH; + item->Animation.AnimNumber = Objects[objectNumber].animIndex + BADDY_ANIM_CROUCH; item->Animation.FrameNumber = g_Level.Anims[item->Animation.AnimNumber].frameBase; - item->Animation.TargetState = GOON_STATE_CROUCH; - item->Animation.ActiveState = GOON_STATE_CROUCH; + item->Animation.TargetState = BADDY_STATE_CROUCH; + item->Animation.ActiveState = BADDY_STATE_CROUCH; item->Pose.Position.x += phd_sin(item->Pose.Orientation.y) * CLICK(4); item->Pose.Position.z += phd_cos(item->Pose.Orientation.y) * CLICK(4); item->ItemFlags[3] = ocb; @@ -299,7 +299,7 @@ namespace TEN::Entities::TR4 item->Animation.FrameNumber = g_Level.Anims[item->Animation.AnimNumber].frameBase; } - void GoonControl(short itemNumber) + void BaddyControl(short itemNumber) { if (!CreatureActive(itemNumber)) return; @@ -307,7 +307,7 @@ namespace TEN::Entities::TR4 auto* item = &g_Level.Items[itemNumber]; auto* creature = GetCreatureInfo(item); auto* enemyItem = creature->Enemy; - auto* object = &Objects[ID_GOON1]; + auto* object = &Objects[ID_BADDY1]; short tilt = 0; short angle = 0; @@ -315,8 +315,8 @@ namespace TEN::Entities::TR4 short joint2 = 0; short joint3 = 0; - // TODO: better add a second control routine for goon 2 instead of mixing them? - short objectNumber = (Objects[ID_GOON2].loaded ? ID_GOON2 : ID_GOON1); + // TODO: better add a second control routine for baddy 2 instead of mixing them? + short objectNumber = (Objects[ID_BADDY2].loaded ? ID_BADDY2 : ID_BADDY1); bool roll = false; bool jump = false; @@ -336,7 +336,7 @@ namespace TEN::Entities::TR4 item->TriggerFlags = 1000 * (item->TriggerFlags / 1000); } - // Can goon jump? Check for a distance of 1 and 2 sectors + // Can baddy jump? Check for a distance of 1 and 2 sectors int x = item->Pose.Position.x; int y = item->Pose.Position.y; int z = item->Pose.Position.z; @@ -408,11 +408,11 @@ namespace TEN::Entities::TR4 item->ItemFlags[1] = item->RoomNumber; - // Handle goon firing + // Handle baddy firing if (creature->FiredWeapon) { - auto pos = Vector3Int(GoonGunBite.x, GoonGunBite.y, GoonGunBite.z); - GetJointAbsPosition(item, &pos, GoonGunBite.meshNum); + auto pos = Vector3Int(BaddyGunBite.x, BaddyGunBite.y, BaddyGunBite.z); + GetJointAbsPosition(item, &pos, BaddyGunBite.meshNum); TriggerDynamicLight(pos.x, pos.y, pos.z, 4 * creature->FiredWeapon + 8, 24, 16, 4); creature->FiredWeapon--; @@ -427,7 +427,7 @@ namespace TEN::Entities::TR4 switch (item->Animation.ActiveState) { - case GOON_STATE_DEATH: + case BADDY_STATE_DEATH: item->Animation.Airborne = true; currentCreature->LOT.IsMonkeying = false; @@ -440,12 +440,12 @@ namespace TEN::Entities::TR4 break; - case GOON_STATE_MONKEY_TO_FREEFALL: - item->Animation.TargetState = GOON_STATE_FREEFALL; + case BADDY_STATE_MONKEY_TO_FREEFALL: + item->Animation.TargetState = BADDY_STATE_FREEFALL; item->Animation.Airborne = false; break; - case GOON_STATE_FREEFALL: + case BADDY_STATE_FREEFALL: item->Animation.Airborne = true; if (item->Pose.Position.y >= item->Floor) @@ -453,42 +453,42 @@ namespace TEN::Entities::TR4 item->Pose.Position.y = item->Floor; item->Animation.VerticalVelocity = 0; item->Animation.Airborne = false; - item->Animation.TargetState = GOON_STATE_FREEFALL_LAND_DEATH; + item->Animation.TargetState = BADDY_STATE_FREEFALL_LAND_DEATH; } break; - case GOON_STATE_FREEFALL_LAND_DEATH: + case BADDY_STATE_FREEFALL_LAND_DEATH: item->Pose.Position.y = item->Floor; break; - case GOON_STATE_MONKEY_GRAB: - case GOON_STATE_MONKEY_IDLE: - case GOON_STATE_MONKEY_FORWARD: - item->Animation.AnimNumber = Objects[objectNumber].animIndex + GOON_ANIM_MONKEY_TO_FREEFALL; + case BADDY_STATE_MONKEY_GRAB: + case BADDY_STATE_MONKEY_IDLE: + case BADDY_STATE_MONKEY_FORWARD: + item->Animation.AnimNumber = Objects[objectNumber].animIndex + BADDY_ANIM_MONKEY_TO_FREEFALL; item->Animation.FrameNumber = g_Level.Anims[item->Animation.AnimNumber].frameBase; - item->Animation.ActiveState = GOON_STATE_MONKEY_TO_FREEFALL; + item->Animation.ActiveState = BADDY_STATE_MONKEY_TO_FREEFALL; item->Animation.Velocity = 0; break; default: - item->Animation.AnimNumber = Objects[objectNumber].animIndex + GOON_ANIM_STAND_DEATH; + item->Animation.AnimNumber = Objects[objectNumber].animIndex + BADDY_ANIM_STAND_DEATH; item->Animation.FrameNumber = g_Level.Anims[item->Animation.AnimNumber].frameBase; - item->Animation.ActiveState = GOON_STATE_DEATH; + item->Animation.ActiveState = BADDY_STATE_DEATH; currentCreature->LOT.IsJumping = true; - // OCB: respawn code for GOON_1 + // OCB: respawn code for BADDY_1 if (item->TriggerFlags > 999) { for (int i = 0; i < g_Level.NumItems; i++) { auto* possibleEnemy = &g_Level.Items[i]; - if (possibleEnemy->ObjectNumber == ID_GOON1 || possibleEnemy->ObjectNumber == ID_GOON2 && + if (possibleEnemy->ObjectNumber == ID_BADDY1 || possibleEnemy->ObjectNumber == ID_BADDY2 && (item->TriggerFlags / 1000) == (possibleEnemy->TriggerFlags / 1000) - 1 && !(possibleEnemy->Flags & IFLAG_KILLED)) { - if (EnableBaddieAI(i, 0)) + if (EnableBaddyAI(i, 0)) possibleEnemy->Status = ITEM_ACTIVE; else possibleEnemy->Status = ITEM_INVISIBLE; @@ -547,7 +547,7 @@ namespace TEN::Entities::TR4 //ItemInfo* oldEnemy = creature->enemy; //creature->enemy = LaraItem; - // Is goon alerted? + // Is baddy alerted? if (item->HitStatus || laraAI.distance < pow(SECTOR(1), 2) || TargetVisible(item, &laraAI) && @@ -619,7 +619,7 @@ namespace TEN::Entities::TR4 switch (item->Animation.ActiveState) { - case GOON_STATE_IDLE: + case BADDY_STATE_IDLE: currentCreature->MaxTurn = 0; currentCreature->Flags = 0; currentCreature->LOT.IsMonkeying = false; @@ -639,36 +639,36 @@ namespace TEN::Entities::TR4 break; } - if (item->SwapMeshFlags == MESHSWAPFLAGS_GOON_SWORD_NINJA && + if (item->SwapMeshFlags == MESHSWAPFLAGS_BADDY_SWORD_NINJA && item == Lara.TargetEntity && laraAI.ahead && laraAI.distance > pow(682, 2)) { - item->Animation.TargetState = GOON_STATE_DODGE_START; + item->Animation.TargetState = BADDY_STATE_DODGE_START; break; } if (Targetable(item, &AI) && item->ItemFlags[2] > 0) { - if (item->SwapMeshFlags == MESHSWAPFLAGS_GOON_GUN) + if (item->SwapMeshFlags == MESHSWAPFLAGS_BADDY_GUN) { - item->Animation.TargetState = GOON_STATE_AIM; + item->Animation.TargetState = BADDY_STATE_AIM; break; } - if (item->SwapMeshFlags != MESHSWAPFLAGS_GOON_SWORD_SIMPLE && item->SwapMeshFlags != MESHSWAPFLAGS_GOON_SWORD_NINJA) + if (item->SwapMeshFlags != MESHSWAPFLAGS_BADDY_SWORD_SIMPLE && item->SwapMeshFlags != MESHSWAPFLAGS_BADDY_SWORD_NINJA) { - item->Animation.TargetState = GOON_STATE_DRAW_GUN; + item->Animation.TargetState = BADDY_STATE_DRAW_GUN; break; } - item->Animation.TargetState = GOON_STATE_HOLSTER_SWORD; + item->Animation.TargetState = BADDY_STATE_HOLSTER_SWORD; break; } if (item->AIBits & MODIFY) { - item->Animation.TargetState = GOON_STATE_IDLE; + item->Animation.TargetState = BADDY_STATE_IDLE; if (item->Floor > item->Pose.Position.y + CLICK(3)) item->AIBits &= ~MODIFY; @@ -680,14 +680,14 @@ namespace TEN::Entities::TR4 { currentCreature->MaxTurn = 0; currentCreature->LOT.IsJumping = true; - item->Animation.AnimNumber = Objects[objectNumber].animIndex + GOON_ANIM_STAND_TO_JUMP_FORWARD; + item->Animation.AnimNumber = Objects[objectNumber].animIndex + BADDY_ANIM_STAND_TO_JUMP_FORWARD; item->Animation.FrameNumber = g_Level.Anims[item->Animation.AnimNumber].frameBase; - item->Animation.ActiveState = GOON_STATE_JUMP_FORWARD_1_BLOCK; + item->Animation.ActiveState = BADDY_STATE_JUMP_FORWARD_1_BLOCK; if (!canJump2Sectors) - item->Animation.TargetState = GOON_STATE_JUMP_FORWARD_1_BLOCK; + item->Animation.TargetState = BADDY_STATE_JUMP_FORWARD_1_BLOCK; else - item->Animation.TargetState = GOON_STATE_JUMP_FORWARD_2_BLOCKS; + item->Animation.TargetState = BADDY_STATE_JUMP_FORWARD_2_BLOCKS; break; } @@ -698,15 +698,15 @@ namespace TEN::Entities::TR4 if ((objectNumber == ID_SMALLMEDI_ITEM || objectNumber == ID_UZI_AMMO_ITEM || objectNumber == ID_BIGMEDI_ITEM) && AI.distance < pow(SECTOR(0.5f), 2)) { - item->Animation.TargetState = GOON_STATE_STAND_TO_CROUCH; - item->Animation.RequiredState = GOON_STATE_CROUCH_PICKUP; + item->Animation.TargetState = BADDY_STATE_STAND_TO_CROUCH; + item->Animation.RequiredState = BADDY_STATE_CROUCH_PICKUP; break; } } - if (item->SwapMeshFlags == MESHSWAPFLAGS_GOON_GUN && item->ItemFlags[2] < 1) + if (item->SwapMeshFlags == MESHSWAPFLAGS_BADDY_GUN && item->ItemFlags[2] < 1) { - item->Animation.TargetState = GOON_STATE_HOLSTER_GUN; + item->Animation.TargetState = BADDY_STATE_HOLSTER_GUN; break; } @@ -715,19 +715,19 @@ namespace TEN::Entities::TR4 probe = GetCollision(item); if (probe.Position.Ceiling == probe.Position.Floor - CLICK(6)) { - if (item->SwapMeshFlags == MESHSWAPFLAGS_GOON_EMPTY) + if (item->SwapMeshFlags == MESHSWAPFLAGS_BADDY_EMPTY) { - item->Animation.TargetState = GOON_STATE_MONKEY_GRAB; + item->Animation.TargetState = BADDY_STATE_MONKEY_GRAB; break; } - if (item->SwapMeshFlags == MESHSWAPFLAGS_GOON_GUN) + if (item->SwapMeshFlags == MESHSWAPFLAGS_BADDY_GUN) { - item->Animation.TargetState = GOON_STATE_HOLSTER_GUN; + item->Animation.TargetState = BADDY_STATE_HOLSTER_GUN; break; } - item->Animation.TargetState = GOON_STATE_HOLSTER_SWORD; + item->Animation.TargetState = BADDY_STATE_HOLSTER_SWORD; break; } } @@ -736,42 +736,42 @@ namespace TEN::Entities::TR4 if (roll) { currentCreature->MaxTurn = 0; - item->Animation.TargetState = GOON_STATE_ROLL_LEFT; + item->Animation.TargetState = BADDY_STATE_ROLL_LEFT; break; } if (jump) { currentCreature->MaxTurn = 0; - item->Animation.TargetState = GOON_STATE_JUMP_RIGHT; + item->Animation.TargetState = BADDY_STATE_JUMP_RIGHT; break; } - if (item->SwapMeshFlags == MESHSWAPFLAGS_GOON_EMPTY) + if (item->SwapMeshFlags == MESHSWAPFLAGS_BADDY_EMPTY) { - item->Animation.TargetState = GOON_STATE_DRAW_SWORD; + item->Animation.TargetState = BADDY_STATE_DRAW_SWORD; break; } if (currentCreature->Enemy && currentCreature->Enemy->HitPoints > 0 && AI.distance < pow(682, 2)) { - if (item->SwapMeshFlags == MESHSWAPFLAGS_GOON_GUN) - item->Animation.TargetState = GOON_STATE_HOLSTER_GUN; + if (item->SwapMeshFlags == MESHSWAPFLAGS_BADDY_GUN) + item->Animation.TargetState = BADDY_STATE_HOLSTER_GUN; else if (AI.distance >= pow(SECTOR(0.5f), 2)) - item->Animation.TargetState = GOON_STATE_SWORD_HIT_FRONT; + item->Animation.TargetState = BADDY_STATE_SWORD_HIT_FRONT; else if (GetRandomControl() & 1) - item->Animation.TargetState = GOON_STATE_SWORD_HIT_LEFT; + item->Animation.TargetState = BADDY_STATE_SWORD_HIT_LEFT; else - item->Animation.TargetState = GOON_STATE_SWORD_HIT_RIGHT; + item->Animation.TargetState = BADDY_STATE_SWORD_HIT_RIGHT; break; } } - item->Animation.TargetState = GOON_STATE_WALK; + item->Animation.TargetState = BADDY_STATE_WALK; break; - case GOON_STATE_WALK: + case BADDY_STATE_WALK: currentCreature->MaxTurn = ANGLE(7.0f); currentCreature->Flags = 0; currentCreature->LOT.IsMonkeying = false; @@ -784,35 +784,35 @@ namespace TEN::Entities::TR4 if (Targetable(item, &AI) && item->ItemFlags[2] > 0) { - item->Animation.TargetState = GOON_STATE_IDLE; + item->Animation.TargetState = BADDY_STATE_IDLE; break; } if (canJump1Sector || canJump2Sectors) { currentCreature->MaxTurn = 0; - item->Animation.TargetState = GOON_STATE_IDLE; + item->Animation.TargetState = BADDY_STATE_IDLE; break; } if (currentCreature->ReachedGoal && currentCreature->MonkeySwingAhead) { - item->Animation.TargetState = GOON_STATE_IDLE; + item->Animation.TargetState = BADDY_STATE_IDLE; break; } if (item->ItemFlags[2] < 1) { - if (item->SwapMeshFlags != MESHSWAPFLAGS_GOON_SWORD_SIMPLE && item->SwapMeshFlags != MESHSWAPFLAGS_GOON_SWORD_NINJA) + if (item->SwapMeshFlags != MESHSWAPFLAGS_BADDY_SWORD_SIMPLE && item->SwapMeshFlags != MESHSWAPFLAGS_BADDY_SWORD_NINJA) { - item->Animation.TargetState = GOON_STATE_IDLE; + item->Animation.TargetState = BADDY_STATE_IDLE; break; } } if (AI.ahead && AI.distance < SECTOR(256)) { - item->Animation.TargetState = GOON_STATE_IDLE; + item->Animation.TargetState = BADDY_STATE_IDLE; break; } @@ -820,20 +820,20 @@ namespace TEN::Entities::TR4 { if (AI.distance < pow(482, 2)) { - item->Animation.TargetState = GOON_STATE_IDLE; + item->Animation.TargetState = BADDY_STATE_IDLE; break; } if (AI.distance < pow(SECTOR(1), 2)) { - item->Animation.TargetState = GOON_STATE_WALK_SWORD_HIT_RIGHT; + item->Animation.TargetState = BADDY_STATE_WALK_SWORD_HIT_RIGHT; break; } } if (roll || jump) { - item->Animation.ActiveState = GOON_STATE_IDLE; + item->Animation.ActiveState = BADDY_STATE_IDLE; break; } @@ -841,27 +841,27 @@ namespace TEN::Entities::TR4 !(currentCreature->JumpAhead) && AI.distance > pow(SECTOR(1), 2)) { - item->Animation.TargetState = GOON_STATE_RUN; + item->Animation.TargetState = BADDY_STATE_RUN; } break; - case GOON_STATE_RUN: + case BADDY_STATE_RUN: currentCreature->MaxTurn = ANGLE(11.0f); tilt = abs(angle) / 2; if (AI.ahead) joint3 = AI.angle; - if (objectNumber == ID_GOON2 && - item->Animation.FrameNumber == g_Level.Anims[item->Animation.AnimNumber].frameBase + FRAME_GOON_RUN_TO_SOMERSAULT && + if (objectNumber == ID_BADDY2 && + item->Animation.FrameNumber == g_Level.Anims[item->Animation.AnimNumber].frameBase + FRAME_BADDY_RUN_TO_SOMERSAULT && height3 == height1 && abs(height1 - item->Pose.Position.y) < CLICK(1.5f) && (AI.angle > -ANGLE(22.5f) && AI.angle < ANGLE(22.5f) && AI.distance < pow(SECTOR(3), 2) || height2 >= (height1 + CLICK(2)))) { - item->Animation.TargetState = GOON_STATE_SOMERSAULT; + item->Animation.TargetState = BADDY_STATE_SOMERSAULT; currentCreature->MaxTurn = 0; break; } @@ -875,28 +875,28 @@ namespace TEN::Entities::TR4 AI.distance < pow(614, 2) || currentCreature->JumpAhead) { - item->Animation.TargetState = GOON_STATE_IDLE; + item->Animation.TargetState = BADDY_STATE_IDLE; break; } if (AI.distance < pow(SECTOR(1), 2)) { - item->Animation.TargetState = GOON_STATE_WALK; + item->Animation.TargetState = BADDY_STATE_WALK; break; } break; - case GOON_STATE_SWORD_HIT_RIGHT: - case GOON_STATE_SWORD_HIT_FRONT: - case GOON_STATE_SWORD_HIT_LEFT: - case GOON_STATE_WALK_SWORD_HIT_RIGHT: + case BADDY_STATE_SWORD_HIT_RIGHT: + case BADDY_STATE_SWORD_HIT_FRONT: + case BADDY_STATE_SWORD_HIT_LEFT: + case BADDY_STATE_WALK_SWORD_HIT_RIGHT: currentCreature->MaxTurn = 0; - if (item->Animation.ActiveState == GOON_STATE_SWORD_HIT_RIGHT && + if (item->Animation.ActiveState == BADDY_STATE_SWORD_HIT_RIGHT && AI.distance < SECTOR(254)) { - item->Animation.TargetState = GOON_STATE_SWORD_HIT_LEFT; + item->Animation.TargetState = BADDY_STATE_SWORD_HIT_LEFT; } if (AI.ahead) @@ -905,8 +905,8 @@ namespace TEN::Entities::TR4 joint2 = AI.xAngle; } - if (item->Animation.ActiveState != GOON_STATE_SWORD_HIT_FRONT || - item->Animation.FrameNumber < g_Level.Anims[item->Animation.AnimNumber].frameBase + FRAME_GOON_SWORD_HIT_NO_DAMAGE_MAX) + if (item->Animation.ActiveState != BADDY_STATE_SWORD_HIT_FRONT || + item->Animation.FrameNumber < g_Level.Anims[item->Animation.AnimNumber].frameBase + FRAME_BADDY_SWORD_HIT_NO_DAMAGE_MAX) { if (abs(AI.angle) >= ANGLE(7.0f)) { @@ -923,12 +923,12 @@ namespace TEN::Entities::TR4 { if (item->TouchBits & 0x1C000) { - if (item->Animation.FrameNumber > g_Level.Anims[item->Animation.AnimNumber].frameBase + FRAME_GOON_SWORD_HIT_DAMAGE_MIN && - item->Animation.FrameNumber < g_Level.Anims[item->Animation.AnimNumber].frameBase + FRAME_GOON_SWORD_HIT_DAMAGE_MAX) + if (item->Animation.FrameNumber > g_Level.Anims[item->Animation.AnimNumber].frameBase + FRAME_BADDY_SWORD_HIT_DAMAGE_MIN && + item->Animation.FrameNumber < g_Level.Anims[item->Animation.AnimNumber].frameBase + FRAME_BADDY_SWORD_HIT_DAMAGE_MAX) { CreatureEffect2( item, - &GoonSwordBite, + &BaddySwordBite, 10, item->Pose.Orientation.y, DoBloodSplat); @@ -946,7 +946,7 @@ namespace TEN::Entities::TR4 break; - case GOON_STATE_MONKEY_IDLE: + case BADDY_STATE_MONKEY_IDLE: currentCreature->MaxTurn = 0; currentCreature->Flags = 0; joint1 = 0; @@ -963,24 +963,24 @@ namespace TEN::Entities::TR4 LaraItem->Animation.ActiveState == LS_MONKEY_TURN_LEFT || LaraItem->Animation.ActiveState == LS_MONKEY_TURN_RIGHT)) { - item->Animation.TargetState = GOON_STATE_MONKEY_PUSH_OFF; + item->Animation.TargetState = BADDY_STATE_MONKEY_PUSH_OFF; } else if (item->BoxNumber != currentCreature->LOT.TargetBox && currentCreature->MonkeySwingAhead || probe.Position.Ceiling != (probe.Position.Floor - CLICK(6))) { - item->Animation.TargetState = GOON_STATE_MONKEY_FORWARD; + item->Animation.TargetState = BADDY_STATE_MONKEY_FORWARD; } else { - item->Animation.TargetState = GOON_STATE_MONKEY_FALL_LAND; + item->Animation.TargetState = BADDY_STATE_MONKEY_FALL_LAND; currentCreature->LOT.IsMonkeying = false; currentCreature->LOT.IsJumping = false; } break; - case GOON_STATE_MONKEY_FORWARD: + case BADDY_STATE_MONKEY_FORWARD: currentCreature->MaxTurn = ANGLE(7.0f); currentCreature->Flags = 0; currentCreature->LOT.IsJumping = true; @@ -994,7 +994,7 @@ namespace TEN::Entities::TR4 probe = GetCollision(item); if (probe.Position.Ceiling == probe.Position.Floor - CLICK(6)) - item->Animation.TargetState = GOON_STATE_MONKEY_IDLE; + item->Animation.TargetState = BADDY_STATE_MONKEY_IDLE; } if (laraAI.ahead) @@ -1010,14 +1010,14 @@ namespace TEN::Entities::TR4 LaraItem->Animation.ActiveState == LS_MONKEY_TURN_LEFT || LaraItem->Animation.ActiveState == LS_MONKEY_TURN_RIGHT) { - item->Animation.TargetState = GOON_STATE_MONKEY_IDLE; + item->Animation.TargetState = BADDY_STATE_MONKEY_IDLE; } } } break; - case GOON_STATE_MONKEY_PUSH_OFF: + case BADDY_STATE_MONKEY_PUSH_OFF: currentCreature->MaxTurn = ANGLE(7.0f); if (currentCreature->Flags == someFlag3) @@ -1039,14 +1039,14 @@ namespace TEN::Entities::TR4 break; - case GOON_STATE_ROLL_LEFT: - case GOON_STATE_JUMP_RIGHT: + case BADDY_STATE_ROLL_LEFT: + case BADDY_STATE_JUMP_RIGHT: item->Status = ITEM_ACTIVE; currentCreature->MaxTurn = someFlag3; currentCreature->Alerted = false; break; - case GOON_STATE_CROUCH: + case BADDY_STATE_CROUCH: if (item->ItemFlags[0] == someFlag3) { if (currentCreature->Enemy) @@ -1056,29 +1056,29 @@ namespace TEN::Entities::TR4 currentCreature->Enemy->ObjectNumber == ID_UZI_AMMO_ITEM) && AI.distance < pow(SECTOR(0.5f), 2)) { - item->Animation.TargetState = GOON_STATE_CROUCH_PICKUP; + item->Animation.TargetState = BADDY_STATE_CROUCH_PICKUP; break; } } if (currentCreature->Alerted) - item->Animation.TargetState = GOON_STATE_CROUCH_TO_STAND; + item->Animation.TargetState = BADDY_STATE_CROUCH_TO_STAND; } else { if (AI.distance >= pow(682, 2)) break; - item->Animation.TargetState = GOON_STATE_CROUCH_TO_STAND; + item->Animation.TargetState = BADDY_STATE_CROUCH_TO_STAND; currentCreature->Enemy = NULL; } break; - case GOON_STATE_CROUCH_PICKUP: + case BADDY_STATE_CROUCH_PICKUP: ClampRotation(&item->Pose, AI.angle, ANGLE(11.0f)); - if (item->Animation.FrameNumber != g_Level.Anims[item->Animation.AnimNumber].frameBase + FRAME_GOON_CROUCH_PICKUP) + if (item->Animation.FrameNumber != g_Level.Anims[item->Animation.AnimNumber].frameBase + FRAME_BADDY_CROUCH_PICKUP) break; if (!currentCreature->Enemy) @@ -1104,7 +1104,7 @@ namespace TEN::Entities::TR4 else if (currentCreature->Enemy->ObjectNumber == ID_BIGMEDI_ITEM) item->HitPoints = Objects[item->ObjectNumber].HitPoints; else if (currentCreature->Enemy->ObjectNumber == ID_UZI_AMMO_ITEM) - item->ItemFlags[2] += GOON_USE_UZI; + item->ItemFlags[2] += BADDY_USE_UZI; else { currentCreature->Enemy = NULL; @@ -1113,7 +1113,7 @@ namespace TEN::Entities::TR4 KillItem(currentCreature->Enemy - g_Level.Items.data()); - // cancel enemy pointer for other active goons + // cancel enemy pointer for other active baddys for (int i = 0; i < ActiveCreatures.size(); i++) { if (ActiveCreatures[i]->ItemNumber != NO_ITEM && ActiveCreatures[i]->ItemNumber != itemNumber && ActiveCreatures[i]->Enemy == creature->Enemy) @@ -1123,7 +1123,7 @@ namespace TEN::Entities::TR4 creature->Enemy = NULL; break; - case GOON_STATE_AIM: + case BADDY_STATE_AIM: currentCreature->MaxTurn = 0; if (AI.ahead) @@ -1136,14 +1136,14 @@ namespace TEN::Entities::TR4 if (!Targetable(item, &AI) || item->ItemFlags[2] < 1) { - item->Animation.TargetState = GOON_STATE_IDLE; + item->Animation.TargetState = BADDY_STATE_IDLE; break; } - item->Animation.TargetState = GOON_STATE_FIRE; + item->Animation.TargetState = BADDY_STATE_FIRE; break; - case GOON_STATE_FIRE: + case BADDY_STATE_FIRE: creature->FiredWeapon = true; if (AI.ahead) @@ -1153,8 +1153,8 @@ namespace TEN::Entities::TR4 } ClampRotation(&item->Pose, AI.angle, ANGLE(7.0f)); - if (item->Animation.FrameNumber >= g_Level.Anims[item->Animation.AnimNumber].frameBase + FRAME_GOON_FIRE_MAX || - item->Animation.FrameNumber == g_Level.Anims[item->Animation.AnimNumber].frameBase + FRAME_GOON_FIRE_MIN) + if (item->Animation.FrameNumber >= g_Level.Anims[item->Animation.AnimNumber].frameBase + FRAME_BADDY_FIRE_MAX || + item->Animation.FrameNumber == g_Level.Anims[item->Animation.AnimNumber].frameBase + FRAME_BADDY_FIRE_MIN) { break; } @@ -1162,44 +1162,44 @@ namespace TEN::Entities::TR4 if (!item->HitStatus) item->ItemFlags[2]--; - if (!ShotLara(item, &AI, &GoonGunBite, joint1, 15)); - item->Animation.TargetState = GOON_STATE_IDLE; + if (!ShotLara(item, &AI, &BaddyGunBite, joint1, 15)); + item->Animation.TargetState = BADDY_STATE_IDLE; break; default: break; - case GOON_STATE_HOLSTER_GUN: - if (item->Animation.FrameNumber == g_Level.Anims[item->Animation.AnimNumber].frameBase + FRAME_GOON_HOLSTER_GUN) - item->SwapMeshFlags = MESHSWAPFLAGS_GOON_EMPTY; + case BADDY_STATE_HOLSTER_GUN: + if (item->Animation.FrameNumber == g_Level.Anims[item->Animation.AnimNumber].frameBase + FRAME_BADDY_HOLSTER_GUN) + item->SwapMeshFlags = MESHSWAPFLAGS_BADDY_EMPTY; break; - case GOON_STATE_DRAW_GUN: - if (item->Animation.FrameNumber == g_Level.Anims[item->Animation.AnimNumber].frameBase + FRAME_GOON_DRAW_GUN) - item->SwapMeshFlags = MESHSWAPFLAGS_GOON_GUN; + case BADDY_STATE_DRAW_GUN: + if (item->Animation.FrameNumber == g_Level.Anims[item->Animation.AnimNumber].frameBase + FRAME_BADDY_DRAW_GUN) + item->SwapMeshFlags = MESHSWAPFLAGS_BADDY_GUN; break; - case GOON_STATE_HOLSTER_SWORD: - if (item->Animation.FrameNumber == g_Level.Anims[item->Animation.AnimNumber].frameBase + FRAME_GOON_HOLSTER_SWORD) - item->SwapMeshFlags = MESHSWAPFLAGS_GOON_EMPTY; + case BADDY_STATE_HOLSTER_SWORD: + if (item->Animation.FrameNumber == g_Level.Anims[item->Animation.AnimNumber].frameBase + FRAME_BADDY_HOLSTER_SWORD) + item->SwapMeshFlags = MESHSWAPFLAGS_BADDY_EMPTY; break; - case GOON_STATE_DRAW_SWORD: - if (item->Animation.FrameNumber != g_Level.Anims[item->Animation.AnimNumber].frameBase + FRAME_GOON_DRAW_SWORD) + case BADDY_STATE_DRAW_SWORD: + if (item->Animation.FrameNumber != g_Level.Anims[item->Animation.AnimNumber].frameBase + FRAME_BADDY_DRAW_SWORD) break; - if (item->ObjectNumber == ID_GOON1) - item->SwapMeshFlags = MESHSWAPFLAGS_GOON_SWORD_SIMPLE; + if (item->ObjectNumber == ID_BADDY1) + item->SwapMeshFlags = MESHSWAPFLAGS_BADDY_SWORD_SIMPLE; else - item->SwapMeshFlags = MESHSWAPFLAGS_GOON_SWORD_NINJA; + item->SwapMeshFlags = MESHSWAPFLAGS_BADDY_SWORD_NINJA; break; - case GOON_STATE_UNKNOWN_8: + case BADDY_STATE_UNKNOWN_8: currentCreature->MaxTurn = 0; ClampRotation(&item->Pose, AI.angle, ANGLE(11.0f)); @@ -1207,39 +1207,39 @@ namespace TEN::Entities::TR4 if (laraAI.distance < pow(682, 2) || item != Lara.TargetEntity) { - item->Animation.TargetState = GOON_STATE_UNKNOWN_9; + item->Animation.TargetState = BADDY_STATE_UNKNOWN_9; } break; - case GOON_STATE_BLIND: + case BADDY_STATE_BLIND: if (!WeaponEnemyTimer) { if ((GetRandomControl() & 0x7F) == 0) - item->Animation.TargetState = GOON_STATE_IDLE; + item->Animation.TargetState = BADDY_STATE_IDLE; } break; - case GOON_STATE_SOMERSAULT: - if (item->Animation.AnimNumber == Objects[objectNumber].animIndex + GOON_ANIM_SOMERSAULT_END) + case BADDY_STATE_SOMERSAULT: + if (item->Animation.AnimNumber == Objects[objectNumber].animIndex + BADDY_ANIM_SOMERSAULT_END) { ClampRotation(&item->Pose, AI.angle, ANGLE(7.0f)); break; } - if (item->Animation.FrameNumber != g_Level.Anims[item->Animation.AnimNumber].frameBase + FRAME_GOON_SOMERSAULT_START_TAKE_OFF) + if (item->Animation.FrameNumber != g_Level.Anims[item->Animation.AnimNumber].frameBase + FRAME_BADDY_SOMERSAULT_START_TAKE_OFF) break; currentCreature->LOT.IsJumping = true; break; - case GOON_STATE_JUMP_FORWARD_1_BLOCK: - case GOON_STATE_JUMP_FORWARD_2_BLOCKS: + case BADDY_STATE_JUMP_FORWARD_1_BLOCK: + case BADDY_STATE_JUMP_FORWARD_2_BLOCKS: if (item->ItemFlags[0] >= someFlag3) break; - if (item->Animation.AnimNumber != Objects[objectNumber].animIndex + GOON_ANIM_STAND_TO_JUMP_FORWARD) + if (item->Animation.AnimNumber != Objects[objectNumber].animIndex + BADDY_ANIM_STAND_TO_JUMP_FORWARD) item->ItemFlags[0] += 2; break; @@ -1251,12 +1251,12 @@ namespace TEN::Entities::TR4 CreatureJoint(item, 1, joint2); CreatureJoint(item, 2, joint3); - if (item->Animation.ActiveState >= GOON_STATE_JUMP_FORWARD_2_BLOCKS || - item->Animation.ActiveState == GOON_STATE_JUMP_FORWARD_1_BLOCK || - item->Animation.ActiveState == GOON_STATE_MONKEY_FORWARD || - item->Animation.ActiveState == GOON_STATE_DEATH || - item->Animation.ActiveState == GOON_STATE_SOMERSAULT || - item->Animation.ActiveState == GOON_STATE_BLIND) + if (item->Animation.ActiveState >= BADDY_STATE_JUMP_FORWARD_2_BLOCKS || + item->Animation.ActiveState == BADDY_STATE_JUMP_FORWARD_1_BLOCK || + item->Animation.ActiveState == BADDY_STATE_MONKEY_FORWARD || + item->Animation.ActiveState == BADDY_STATE_DEATH || + item->Animation.ActiveState == BADDY_STATE_SOMERSAULT || + item->Animation.ActiveState == BADDY_STATE_BLIND) { CreatureAnimation(itemNumber, angle, 0); } @@ -1267,37 +1267,37 @@ namespace TEN::Entities::TR4 switch (vault) { case 2: - item->Animation.AnimNumber = Objects[objectNumber].animIndex + GOON_ANIM_CLIMB_2_STEPS; + item->Animation.AnimNumber = Objects[objectNumber].animIndex + BADDY_ANIM_CLIMB_2_STEPS; item->Animation.FrameNumber = g_Level.Anims[item->Animation.AnimNumber].frameBase; - item->Animation.ActiveState = GOON_STATE_CLIMB_2_STEPS; + item->Animation.ActiveState = BADDY_STATE_CLIMB_2_STEPS; creature->MaxTurn = 0; break; case 3: - item->Animation.AnimNumber = Objects[objectNumber].animIndex + GOON_ANIM_CLIMB_3_STEPS; + item->Animation.AnimNumber = Objects[objectNumber].animIndex + BADDY_ANIM_CLIMB_3_STEPS; item->Animation.FrameNumber = g_Level.Anims[item->Animation.AnimNumber].frameBase; - item->Animation.ActiveState = GOON_STATE_CLIMB_3_STEPS; + item->Animation.ActiveState = BADDY_STATE_CLIMB_3_STEPS; creature->MaxTurn = 0; break; case 4: - item->Animation.AnimNumber = Objects[objectNumber].animIndex + GOON_ANIM_CLIMB_4_STEPS; - item->Animation.ActiveState = GOON_STATE_CLIMB_4_STEPS; + item->Animation.AnimNumber = Objects[objectNumber].animIndex + BADDY_ANIM_CLIMB_4_STEPS; + item->Animation.ActiveState = BADDY_STATE_CLIMB_4_STEPS; item->Animation.FrameNumber = g_Level.Anims[item->Animation.AnimNumber].frameBase; creature->MaxTurn = 0; break; case -3: - item->Animation.AnimNumber = Objects[objectNumber].animIndex + GOON_ANIM_JUMP_OFF_3_STEPS; + item->Animation.AnimNumber = Objects[objectNumber].animIndex + BADDY_ANIM_JUMP_OFF_3_STEPS; item->Animation.FrameNumber = g_Level.Anims[item->Animation.AnimNumber].frameBase; - item->Animation.ActiveState = GOON_STATE_JUMP_OFF_3_STEPS; + item->Animation.ActiveState = BADDY_STATE_JUMP_OFF_3_STEPS; creature->MaxTurn = 0; break; case -4: - item->Animation.AnimNumber = Objects[objectNumber].animIndex + GOON_ANIM_JUMP_OFF_4_STEPS; + item->Animation.AnimNumber = Objects[objectNumber].animIndex + BADDY_ANIM_JUMP_OFF_4_STEPS; item->Animation.FrameNumber = g_Level.Anims[item->Animation.AnimNumber].frameBase; - item->Animation.ActiveState = GOON_STATE_JUMP_OFF_4_STEPS; + item->Animation.ActiveState = BADDY_STATE_JUMP_OFF_4_STEPS; creature->MaxTurn = 0; break; @@ -1307,9 +1307,9 @@ namespace TEN::Entities::TR4 } else { - item->Animation.AnimNumber = Objects[objectNumber].animIndex + GOON_ANIM_BLIND; + item->Animation.AnimNumber = Objects[objectNumber].animIndex + BADDY_ANIM_BLIND; item->Animation.FrameNumber = g_Level.Anims[item->Animation.AnimNumber].frameBase + (GetRandomControl() & 7); - item->Animation.ActiveState = GOON_STATE_BLIND; + item->Animation.ActiveState = BADDY_STATE_BLIND; creature->MaxTurn = 0; } diff --git a/TombEngine/Objects/TR4/Entity/tr4_baddy.h b/TombEngine/Objects/TR4/Entity/tr4_baddy.h new file mode 100644 index 000000000..08d9265f4 --- /dev/null +++ b/TombEngine/Objects/TR4/Entity/tr4_baddy.h @@ -0,0 +1,7 @@ +#pragma once + +namespace TEN::Entities::TR4 +{ + void InitialiseBaddy(short itemNumber); + void BaddyControl(short itemNumber); +} diff --git a/TombEngine/Objects/TR4/Entity/tr4_bat.cpp b/TombEngine/Objects/TR4/Entity/tr4_bat.cpp index c599e6ba4..d7cbf5d13 100644 --- a/TombEngine/Objects/TR4/Entity/tr4_bat.cpp +++ b/TombEngine/Objects/TR4/Entity/tr4_bat.cpp @@ -89,7 +89,7 @@ namespace TEN::Entities::TR4 /*bestdistance = MAXINT; bat->enemy = LaraItem; - slots = &BaddieSlots[0]; + slots = &BaddySlots[0]; for (int i = 0; i < NUM_SLOTS; i++, slots++) { if (slots->itemNum != NO_ITEM && slots->itemNum != itemNumber) diff --git a/TombEngine/Objects/TR4/Entity/tr4_goon.h b/TombEngine/Objects/TR4/Entity/tr4_goon.h deleted file mode 100644 index 77714b936..000000000 --- a/TombEngine/Objects/TR4/Entity/tr4_goon.h +++ /dev/null @@ -1,7 +0,0 @@ -#pragma once - -namespace TEN::Entities::TR4 -{ - void InitialiseGoon(short itemNumber); - void GoonControl(short itemNumber); -} diff --git a/TombEngine/Objects/TR4/Vehicles/jeep.cpp b/TombEngine/Objects/TR4/Vehicles/jeep.cpp index a85f974b6..e6e2a3816 100644 --- a/TombEngine/Objects/TR4/Vehicles/jeep.cpp +++ b/TombEngine/Objects/TR4/Vehicles/jeep.cpp @@ -524,7 +524,7 @@ static int GetJeepCollisionAnim(ItemInfo* item, Vector3Int* p) return 0; } -static void JeepBaddieCollision(ItemInfo* jeep) +static void JeepBaddyCollision(ItemInfo* jeep) { vector roomsList; short* door, numDoors; @@ -788,7 +788,7 @@ int JeepDynamics(ItemInfo* item) if (!(item->Flags & ONESHOT)) { - JeepBaddieCollision(item); + JeepBaddyCollision(item); // v37 = sub_467850(item->pos.Position.x, item->pos.Position.y, item->pos.Position.z, item->roomNumber, 512); } @@ -1525,7 +1525,7 @@ void JeepCollision(short itemNumber, ItemInfo* l, CollisionInfo* coll) goto LABEL_11; } } - EnableBaddieAI(v4, 1); + EnableBaddyAI(v4, 1); *(_DWORD*)(v5 + 5610) = *(_DWORD*)(v5 + 5610) & 0xFFFFFFFB | 2; AddActiveItem(v4); }*/ @@ -1559,7 +1559,7 @@ void JeepCollision(short itemNumber, ItemInfo* l, CollisionInfo* coll) jeep->revs = 0; jeep->unknown2 = 0; - item->Flags |= 0x20; + item->Flags |= TRIGGERED; } else ObjectCollision(itemNumber, l, coll); diff --git a/TombEngine/Objects/TR4/Vehicles/motorbike.cpp b/TombEngine/Objects/TR4/Vehicles/motorbike.cpp index 0c00236b4..85c248ea1 100644 --- a/TombEngine/Objects/TR4/Vehicles/motorbike.cpp +++ b/TombEngine/Objects/TR4/Vehicles/motorbike.cpp @@ -642,7 +642,7 @@ static int GetMotorbikeCollisionAnim(ItemInfo* item, Vector3Int* pos) return 0; } -void MotorbikeBaddieCollision(ItemInfo* bike) +void MotorbikeBaddyCollision(ItemInfo* bike) { int x, y, z, i; @@ -859,7 +859,7 @@ static int MotorBikeDynamics(ItemInfo* item) if (!(item->Flags & ONESHOT)) { - MotorbikeBaddieCollision(item); + MotorbikeBaddyCollision(item); //MotorBikeStaticCollision(item->pos.x, item->pos.y, item->pos.z, item->room_number, (WALL_L / 2)); } diff --git a/TombEngine/Objects/TR4/tr4_objects.cpp b/TombEngine/Objects/TR4/tr4_objects.cpp index 5e0cbf68c..fb450ca92 100644 --- a/TombEngine/Objects/TR4/tr4_objects.cpp +++ b/TombEngine/Objects/TR4/tr4_objects.cpp @@ -3,7 +3,7 @@ #include "Game/pickup/pickup.h" /// entities #include "tr4_ahmet.h" // OK -#include "tr4_goon.h" // OK +#include "tr4_baddy.h" // OK #include "tr4_bat.h" // OK #include "tr4_bigscorpion.h" // OK #include "tr4_crocodile.h" // OK @@ -222,11 +222,11 @@ static void StartEntity(ObjectInfo* obj) g_Level.Bones[obj->boneIndex + 9 * 4] |= ROT_Y; } - obj = &Objects[ID_GOON1]; + obj = &Objects[ID_BADDY1]; if (obj->loaded) { - obj->initialise = InitialiseGoon; - obj->control = GoonControl; + obj->initialise = InitialiseBaddy; + obj->control = BaddyControl; obj->collision = CreatureCollision; obj->shadowSize = 128; obj->HitPoints = 25; @@ -247,11 +247,11 @@ static void StartEntity(ObjectInfo* obj) //g_Level.Bones[obj->boneIndex + 88 * 4] |= ROT_X; } - obj = &Objects[ID_GOON2]; + obj = &Objects[ID_BADDY2]; if (obj->loaded) { - obj->initialise = InitialiseGoon; - obj->control = GoonControl; + obj->initialise = InitialiseBaddy; + obj->control = BaddyControl; obj->collision = CreatureCollision; obj->shadowSize = 128; obj->HitPoints = 25; diff --git a/TombEngine/Objects/TR5/Entity/tr5_larson.cpp b/TombEngine/Objects/TR5/Entity/tr5_larson.cpp index ebe786819..a68163d2a 100644 --- a/TombEngine/Objects/TR5/Entity/tr5_larson.cpp +++ b/TombEngine/Objects/TR5/Entity/tr5_larson.cpp @@ -413,7 +413,7 @@ void LarsonControl(short itemNumber) else { item->HitPoints = -16384; - DisableBaddieAI(itemNumber); + DisableBaddyAI(itemNumber); KillItem(itemNumber); } }*/ diff --git a/TombEngine/Objects/TR5/Object/tr5_highobject.cpp b/TombEngine/Objects/TR5/Object/tr5_highobject.cpp index fae418c8b..71299a15d 100644 --- a/TombEngine/Objects/TR5/Object/tr5_highobject.cpp +++ b/TombEngine/Objects/TR5/Object/tr5_highobject.cpp @@ -112,7 +112,7 @@ void ControlHighObject1(short itemNumber) item->Pose.Position.y += 8; auto* targetItem = &g_Level.Items[(item->ItemFlags[3] / 256) & 0xFF]; - targetItem->Flags |= 0x20u; + targetItem->Flags |= TRIGGERED; targetItem->Pose.Position.y = item->Pose.Position.y - 560; } @@ -120,7 +120,7 @@ void ControlHighObject1(short itemNumber) { auto* targetItem = &g_Level.Items[item->ItemFlags[2] & 0xFF]; targetItem->ItemFlags[1] = 0; - targetItem->Flags |= 0x20u; + targetItem->Flags |= TRIGGERED; item->ItemFlags[0] = 0; item->ItemFlags[1] = 0; @@ -172,7 +172,7 @@ void ControlHighObject1(short itemNumber) targetItem = &g_Level.Items[targetItemNumber]; targetItem->ItemFlags[1] = 1; - targetItem->Flags |= 0x20; + targetItem->Flags |= TRIGGERED; targetItem->Flags &= 0xC1FF; return; } @@ -203,7 +203,7 @@ void ControlHighObject1(short itemNumber) short targetItemNumber = (item->ItemFlags[3] / 256) & 0xFF; auto* targetItem = &g_Level.Items[targetItemNumber]; - targetItem->Flags |= 0x20; + targetItem->Flags |= TRIGGERED; targetItem->Pose.Position.y = item->Pose.Position.y - 560; } } diff --git a/TombEngine/Objects/TR5/Trap/tr5_explosion.cpp b/TombEngine/Objects/TR5/Trap/tr5_explosion.cpp index f8fa2d1f6..b0d23cf13 100644 --- a/TombEngine/Objects/TR5/Trap/tr5_explosion.cpp +++ b/TombEngine/Objects/TR5/Trap/tr5_explosion.cpp @@ -132,7 +132,7 @@ void ExplosionControl(short itemNumber) else if (CollidedItems[i]->ObjectNumber != ID_SWITCH_TYPE7 && CollidedItems[i]->ObjectNumber != ID_SWITCH_TYPE8) { if (Objects[CollidedItems[i]->ObjectNumber].intelligent) - DoExplosiveDamageOnBaddie(LaraItem, CollidedItems[i], item, LaraWeaponType::GrenadeLauncher); + DoExplosiveDamageOnBaddy(LaraItem, CollidedItems[i], item, LaraWeaponType::GrenadeLauncher); } else { diff --git a/TombEngine/Objects/objectslist.h b/TombEngine/Objects/objectslist.h index 1ed66ae40..2b24322ca 100644 --- a/TombEngine/Objects/objectslist.h +++ b/TombEngine/Objects/objectslist.h @@ -116,9 +116,9 @@ enum GAME_OBJECT_ID : short /* Humans */ ID_SCUBA_HARPOON = 150, ID_SCUBA_DIVER, - ID_GOON_SILENCER1, - ID_GOON_SILENCER2, - ID_GOON_SILENCER3, + ID_BADDY_SILENCER1, + ID_BADDY_SILENCER2, + ID_BADDY_SILENCER3, ID_BARRACUDA, ID_WORKER_SHOTGUN, ID_WORKER_MACHINEGUN, @@ -138,8 +138,8 @@ enum GAME_OBJECT_ID : short ID_TRIBESMAN_WITH_DARTS, ID_MP_WITH_STICK, ID_MP_WITH_GUN, - ID_GOON1, // TR4 - OK - ID_GOON2, // TR4 - OK + ID_BADDY1, // TR4 - OK + ID_BADDY2, // TR4 - OK ID_SAS_CAIRO, // TR4 - OK ID_SAS_DYING, // DEPRECATED? ID_SAS_CAPTAIN, // DEPRECATED? diff --git a/TombEngine/Renderer/Renderer11.h b/TombEngine/Renderer/Renderer11.h index e618c32fc..88a265080 100644 --- a/TombEngine/Renderer/Renderer11.h +++ b/TombEngine/Renderer/Renderer11.h @@ -495,7 +495,7 @@ namespace TEN::Renderer void DrawItems(RenderView& view, bool transparent); void DrawItemsTransparent(RendererTransparentFaceInfo* info, RenderView& view); void DrawAnimatingItem(RendererItem* item, RenderView& view, bool transparent); - void DrawBaddieGunflashes(RenderView& view); + void DrawBaddyGunflashes(RenderView& view); void DrawStatics(RenderView& view, bool transparent); void RenderShadowMap(RenderView& view); void DrawWraithExtra(RendererItem* item, RenderView& view); diff --git a/TombEngine/Renderer/Renderer11Draw.cpp b/TombEngine/Renderer/Renderer11Draw.cpp index a0575f635..06474be14 100644 --- a/TombEngine/Renderer/Renderer11Draw.cpp +++ b/TombEngine/Renderer/Renderer11Draw.cpp @@ -2715,7 +2715,7 @@ namespace TEN::Renderer DrawItems(view, true); DrawEffects(view, true); DrawGunFlashes(view); - DrawBaddieGunflashes(view); + DrawBaddyGunflashes(view); DrawTransparentFaces(view); diff --git a/TombEngine/Renderer/Renderer11DrawEffect.cpp b/TombEngine/Renderer/Renderer11DrawEffect.cpp index a3bd83390..ea92a1d90 100644 --- a/TombEngine/Renderer/Renderer11DrawEffect.cpp +++ b/TombEngine/Renderer/Renderer11DrawEffect.cpp @@ -633,7 +633,7 @@ namespace TEN::Renderer return true; } - void Renderer11::DrawBaddieGunflashes(RenderView& view) + void Renderer11::DrawBaddyGunflashes(RenderView& view) { for (auto room : view.roomsToDraw) { diff --git a/TombEngine/Renderer/Renderer11Helper.cpp b/TombEngine/Renderer/Renderer11Helper.cpp index 29ada324e..adb9b17e0 100644 --- a/TombEngine/Renderer/Renderer11Helper.cpp +++ b/TombEngine/Renderer/Renderer11Helper.cpp @@ -8,7 +8,7 @@ #include "Game/control/control.h" #include "Game/Lara/lara.h" #include "Game/collision/sphere.h" -#include "Scripting/Flow/ScriptInterfaceFlowHandler.h" +#include "Flow/ScriptInterfaceFlowHandler.h" #include "Renderer\RenderView\RenderView.h" #include "Objects/TR3/Vehicles/quad.h" #include "Objects/TR3/Vehicles/rubberboat.h" diff --git a/TombEngine/Renderer/Renderer11Init.cpp b/TombEngine/Renderer/Renderer11Init.cpp index 697b54b91..940e78f7f 100644 --- a/TombEngine/Renderer/Renderer11Init.cpp +++ b/TombEngine/Renderer/Renderer11Init.cpp @@ -2,7 +2,7 @@ #include "Renderer/Renderer11.h" #include "Specific/configuration.h" #include "Specific/winmain.h" -#include "Scripting/Flow/ScriptInterfaceFlowHandler.h" +#include "Flow/ScriptInterfaceFlowHandler.h" #include "Quad/RenderQuad.h" #include "Specific/memory/Vector.h" #include diff --git a/TombEngine/Renderer/Renderer11Lara.cpp b/TombEngine/Renderer/Renderer11Lara.cpp index cad63184d..cc4063d1a 100644 --- a/TombEngine/Renderer/Renderer11Lara.cpp +++ b/TombEngine/Renderer/Renderer11Lara.cpp @@ -8,7 +8,7 @@ #include "Game/camera.h" #include "Game/collision/sphere.h" #include "Specific/level.h" -#include "Scripting/Flow/ScriptInterfaceFlowHandler.h" +#include "Flow/ScriptInterfaceFlowHandler.h" #include #include "Game/Lara/lara_fire.h" #include "Game/items.h" diff --git a/TombEngine/Scripting/Flow/ScriptInterfaceFlowHandler.h b/TombEngine/Scripting/Include/Flow/ScriptInterfaceFlowHandler.h similarity index 100% rename from TombEngine/Scripting/Flow/ScriptInterfaceFlowHandler.h rename to TombEngine/Scripting/Include/Flow/ScriptInterfaceFlowHandler.h diff --git a/TombEngine/Scripting/Objects/ScriptInterfaceObjectsHandler.h b/TombEngine/Scripting/Include/Objects/ScriptInterfaceObjectsHandler.h similarity index 100% rename from TombEngine/Scripting/Objects/ScriptInterfaceObjectsHandler.h rename to TombEngine/Scripting/Include/Objects/ScriptInterfaceObjectsHandler.h diff --git a/TombEngine/Scripting/ScriptInterfaceGame.h b/TombEngine/Scripting/Include/ScriptInterfaceGame.h similarity index 100% rename from TombEngine/Scripting/ScriptInterfaceGame.h rename to TombEngine/Scripting/Include/ScriptInterfaceGame.h diff --git a/TombEngine/Scripting/ScriptInterfaceLevel.h b/TombEngine/Scripting/Include/ScriptInterfaceLevel.h similarity index 100% rename from TombEngine/Scripting/ScriptInterfaceLevel.h rename to TombEngine/Scripting/Include/ScriptInterfaceLevel.h diff --git a/TombEngine/Scripting/ScriptInterfaceState.h b/TombEngine/Scripting/Include/ScriptInterfaceState.h similarity index 100% rename from TombEngine/Scripting/ScriptInterfaceState.h rename to TombEngine/Scripting/Include/ScriptInterfaceState.h diff --git a/TombEngine/Scripting/Strings/ScriptInterfaceStringsHandler.h b/TombEngine/Scripting/Include/Strings/ScriptInterfaceStringsHandler.h similarity index 100% rename from TombEngine/Scripting/Strings/ScriptInterfaceStringsHandler.h rename to TombEngine/Scripting/Include/Strings/ScriptInterfaceStringsHandler.h diff --git a/TombEngine/Scripting/AudioTracks.h b/TombEngine/Scripting/Internal/AudioTracks.h similarity index 100% rename from TombEngine/Scripting/AudioTracks.h rename to TombEngine/Scripting/Internal/AudioTracks.h diff --git a/TombEngine/Scripting/InventorySlots.h b/TombEngine/Scripting/Internal/InventorySlots.h similarity index 100% rename from TombEngine/Scripting/InventorySlots.h rename to TombEngine/Scripting/Internal/InventorySlots.h diff --git a/TombEngine/Scripting/ItemEnumPair.h b/TombEngine/Scripting/Internal/ItemEnumPair.h similarity index 100% rename from TombEngine/Scripting/ItemEnumPair.h rename to TombEngine/Scripting/Internal/ItemEnumPair.h diff --git a/TombEngine/Scripting/LanguageScript.h b/TombEngine/Scripting/Internal/LanguageScript.h similarity index 100% rename from TombEngine/Scripting/LanguageScript.h rename to TombEngine/Scripting/Internal/LanguageScript.h diff --git a/TombEngine/Scripting/LuaHandler.cpp b/TombEngine/Scripting/Internal/LuaHandler.cpp similarity index 100% rename from TombEngine/Scripting/LuaHandler.cpp rename to TombEngine/Scripting/Internal/LuaHandler.cpp diff --git a/TombEngine/Scripting/LuaHandler.h b/TombEngine/Scripting/Internal/LuaHandler.h similarity index 100% rename from TombEngine/Scripting/LuaHandler.h rename to TombEngine/Scripting/Internal/LuaHandler.h diff --git a/TombEngine/Scripting/ReservedScriptNames.h b/TombEngine/Scripting/Internal/ReservedScriptNames.h similarity index 98% rename from TombEngine/Scripting/ReservedScriptNames.h rename to TombEngine/Scripting/Internal/ReservedScriptNames.h index 72903f82c..f97c6fd68 100644 --- a/TombEngine/Scripting/ReservedScriptNames.h +++ b/TombEngine/Scripting/Internal/ReservedScriptNames.h @@ -20,8 +20,7 @@ static constexpr char ScriptReserved_DisplayString[] = "DisplayString"; static constexpr char ScriptReserved_Vec3[] = "Vec3"; // Member functions -static constexpr char ScriptReserved_new[] = "New"; -static constexpr char ScriptReserved_newTemporary[] = "NewTemporary"; +static constexpr char ScriptReserved_new[] = "new"; static constexpr char ScriptReserved_Init[] = "Init"; static constexpr char ScriptReserved_Enable[] = "Enable"; static constexpr char ScriptReserved_Disable[] = "Disable"; diff --git a/TombEngine/Scripting/ScriptAssert.cpp b/TombEngine/Scripting/Internal/ScriptAssert.cpp similarity index 100% rename from TombEngine/Scripting/ScriptAssert.cpp rename to TombEngine/Scripting/Internal/ScriptAssert.cpp diff --git a/TombEngine/Scripting/ScriptAssert.h b/TombEngine/Scripting/Internal/ScriptAssert.h similarity index 100% rename from TombEngine/Scripting/ScriptAssert.h rename to TombEngine/Scripting/Internal/ScriptAssert.h diff --git a/TombEngine/Scripting/ScriptInterfaceState.cpp b/TombEngine/Scripting/Internal/ScriptInterfaceState.cpp similarity index 100% rename from TombEngine/Scripting/ScriptInterfaceState.cpp rename to TombEngine/Scripting/Internal/ScriptInterfaceState.cpp diff --git a/TombEngine/Scripting/ScriptUtil.cpp b/TombEngine/Scripting/Internal/ScriptUtil.cpp similarity index 100% rename from TombEngine/Scripting/ScriptUtil.cpp rename to TombEngine/Scripting/Internal/ScriptUtil.cpp diff --git a/TombEngine/Scripting/ScriptUtil.h b/TombEngine/Scripting/Internal/ScriptUtil.h similarity index 100% rename from TombEngine/Scripting/ScriptUtil.h rename to TombEngine/Scripting/Internal/ScriptUtil.h diff --git a/TombEngine/Scripting/TEN/Color/Color.cpp b/TombEngine/Scripting/Internal/TEN/Color/Color.cpp similarity index 92% rename from TombEngine/Scripting/TEN/Color/Color.cpp rename to TombEngine/Scripting/Internal/TEN/Color/Color.cpp index 051e8ef4e..ac7449281 100644 --- a/TombEngine/Scripting/TEN/Color/Color.cpp +++ b/TombEngine/Scripting/Internal/TEN/Color/Color.cpp @@ -12,8 +12,10 @@ Components are specified in bytes; all values are clamped to [0, 255]. void ScriptColor::Register(sol::table & parent) { + using ctors = sol::constructors; parent.new_usertype("Color", - sol::constructors(), + ctors(), + sol::call_constructor, ctors(), sol::meta_function::to_string, &ScriptColor::ToString, /// (int) red component @@ -84,7 +86,7 @@ ScriptColor::operator Vector4() const return m_color; } -// D3DCOLOR is 32 bits and is layed out as ARGB. +// D3DCOLOR is 32 bits and is laid out as ARGB. ScriptColor::operator D3DCOLOR() const { return m_color; diff --git a/TombEngine/Scripting/TEN/Color/Color.h b/TombEngine/Scripting/Internal/TEN/Color/Color.h similarity index 100% rename from TombEngine/Scripting/TEN/Color/Color.h rename to TombEngine/Scripting/Internal/TEN/Color/Color.h diff --git a/TombEngine/Scripting/TEN/Flow/Animations/Animations.cpp b/TombEngine/Scripting/Internal/TEN/Flow/Animations/Animations.cpp similarity index 86% rename from TombEngine/Scripting/TEN/Flow/Animations/Animations.cpp rename to TombEngine/Scripting/Internal/TEN/Flow/Animations/Animations.cpp index c5c8a368b..e6b2e2a28 100644 --- a/TombEngine/Scripting/TEN/Flow/Animations/Animations.cpp +++ b/TombEngine/Scripting/Internal/TEN/Flow/Animations/Animations.cpp @@ -10,6 +10,8 @@ New custom animations which Lara can perform. void Animations::Register(sol::table& parent) { parent.new_usertype("Animations", + sol::constructors(), + sol::call_constructor, sol::constructors(), "crawlExtended", &Animations::HasCrawlExtended, "crouchRoll", &Animations::HasCrouchRoll, "crawlspaceSwandive", &Animations::HasCrawlspaceDive, diff --git a/TombEngine/Scripting/TEN/Flow/Animations/Animations.h b/TombEngine/Scripting/Internal/TEN/Flow/Animations/Animations.h similarity index 100% rename from TombEngine/Scripting/TEN/Flow/Animations/Animations.h rename to TombEngine/Scripting/Internal/TEN/Flow/Animations/Animations.h diff --git a/TombEngine/Scripting/TEN/Flow/FlowHandler.cpp b/TombEngine/Scripting/Internal/TEN/Flow/FlowHandler.cpp similarity index 100% rename from TombEngine/Scripting/TEN/Flow/FlowHandler.cpp rename to TombEngine/Scripting/Internal/TEN/Flow/FlowHandler.cpp diff --git a/TombEngine/Scripting/TEN/Flow/FlowHandler.h b/TombEngine/Scripting/Internal/TEN/Flow/FlowHandler.h similarity index 100% rename from TombEngine/Scripting/TEN/Flow/FlowHandler.h rename to TombEngine/Scripting/Internal/TEN/Flow/FlowHandler.h diff --git a/TombEngine/Scripting/TEN/Flow/Fog/Fog.cpp b/TombEngine/Scripting/Internal/TEN/Flow/Fog/Fog.cpp similarity index 87% rename from TombEngine/Scripting/TEN/Flow/Fog/Fog.cpp rename to TombEngine/Scripting/Internal/TEN/Flow/Fog/Fog.cpp index ec3eaac0a..be44f2ab7 100644 --- a/TombEngine/Scripting/TEN/Flow/Fog/Fog.cpp +++ b/TombEngine/Scripting/Internal/TEN/Flow/Fog/Fog.cpp @@ -10,8 +10,10 @@ Fog void Fog::Register(sol::table & parent) { + using ctors = sol::constructors; parent.new_usertype("Fog", - sol::constructors(), + ctors(), + sol::call_constructor, ctors(), /// (@{Color}) RGB fog color //@mem color @@ -29,7 +31,7 @@ void Fog::Register(sol::table & parent) This is the distance at which the fog reaches the maximum strength @mem maxDistance*/ - "maxDistance", & Fog::MaxDistance + "maxDistance", &Fog::MaxDistance ); } diff --git a/TombEngine/Scripting/TEN/Flow/Fog/Fog.h b/TombEngine/Scripting/Internal/TEN/Flow/Fog/Fog.h similarity index 100% rename from TombEngine/Scripting/TEN/Flow/Fog/Fog.h rename to TombEngine/Scripting/Internal/TEN/Flow/Fog/Fog.h diff --git a/TombEngine/Scripting/TEN/Flow/InventoryItem/InventoryItem.cpp b/TombEngine/Scripting/Internal/TEN/Flow/InventoryItem/InventoryItem.cpp similarity index 92% rename from TombEngine/Scripting/TEN/Flow/InventoryItem/InventoryItem.cpp rename to TombEngine/Scripting/Internal/TEN/Flow/InventoryItem/InventoryItem.cpp index c90d8bb82..3c6b7ffc6 100644 --- a/TombEngine/Scripting/TEN/Flow/InventoryItem/InventoryItem.cpp +++ b/TombEngine/Scripting/Internal/TEN/Flow/InventoryItem/InventoryItem.cpp @@ -12,7 +12,7 @@ Represents the properties of an object as it appears in the inventory. */ /*** Create an InventoryItem. - @function InventoryItem.new + @function InventoryItem @tparam string nameKey key for the item's (localised) name.
Corresponds to an entry in strings.lua. @tparam Flow.InvItem slot slot of inventory object to change @@ -49,9 +49,11 @@ InventoryItem::InventoryItem(std::string const& a_name, ItemEnumPair a_slot, sho void InventoryItem::Register(sol::table & parent) { + using ctors = sol::constructors; parent.new_usertype(ScriptReserved_InventoryItem, - sol::constructors() - ); + ctors(), + sol::call_constructor, ctors() + ); } // Add validation so the user can't choose something unimplemented diff --git a/TombEngine/Scripting/TEN/Flow/InventoryItem/InventoryItem.h b/TombEngine/Scripting/Internal/TEN/Flow/InventoryItem/InventoryItem.h similarity index 100% rename from TombEngine/Scripting/TEN/Flow/InventoryItem/InventoryItem.h rename to TombEngine/Scripting/Internal/TEN/Flow/InventoryItem/InventoryItem.h diff --git a/TombEngine/Scripting/TEN/Flow/Level/FlowLevel.cpp b/TombEngine/Scripting/Internal/TEN/Flow/Level/FlowLevel.cpp similarity index 98% rename from TombEngine/Scripting/TEN/Flow/Level/FlowLevel.cpp rename to TombEngine/Scripting/Internal/TEN/Flow/Level/FlowLevel.cpp index 5cf95197f..064cef439 100644 --- a/TombEngine/Scripting/TEN/Flow/Level/FlowLevel.cpp +++ b/TombEngine/Scripting/Internal/TEN/Flow/Level/FlowLevel.cpp @@ -15,10 +15,10 @@ These are things things which aren't present in the compiled level file itself. @return a Level object */ void Level::Register(sol::table & parent) -{ +{ parent.new_usertype("Level", sol::constructors(), - + sol::call_constructor, sol::constructors(), /// (string) string key for the level's (localised) name. // Corresponds to an entry in strings.lua. //@mem nameKey diff --git a/TombEngine/Scripting/TEN/Flow/Level/FlowLevel.h b/TombEngine/Scripting/Internal/TEN/Flow/Level/FlowLevel.h similarity index 100% rename from TombEngine/Scripting/TEN/Flow/Level/FlowLevel.h rename to TombEngine/Scripting/Internal/TEN/Flow/Level/FlowLevel.h diff --git a/TombEngine/Scripting/TEN/Flow/Mirror/Mirror.cpp b/TombEngine/Scripting/Internal/TEN/Flow/Mirror/Mirror.cpp similarity index 83% rename from TombEngine/Scripting/TEN/Flow/Mirror/Mirror.cpp rename to TombEngine/Scripting/Internal/TEN/Flow/Mirror/Mirror.cpp index c61a6ad42..5fcceb02f 100644 --- a/TombEngine/Scripting/TEN/Flow/Mirror/Mirror.cpp +++ b/TombEngine/Scripting/Internal/TEN/Flow/Mirror/Mirror.cpp @@ -13,8 +13,10 @@ __Not currently implemented.__ void Mirror::Register(sol::table& parent) { + using ctors = sol::constructors; parent.new_usertype("Mirror", - sol::constructors(), + ctors(), + sol::call_constructor, ctors(), "room", &Mirror::Room, "startX", &Mirror::StartX, "endX", &Mirror::EndX, diff --git a/TombEngine/Scripting/TEN/Flow/Mirror/Mirror.h b/TombEngine/Scripting/Internal/TEN/Flow/Mirror/Mirror.h similarity index 100% rename from TombEngine/Scripting/TEN/Flow/Mirror/Mirror.h rename to TombEngine/Scripting/Internal/TEN/Flow/Mirror/Mirror.h diff --git a/TombEngine/Scripting/TEN/Flow/Settings/Settings.cpp b/TombEngine/Scripting/Internal/TEN/Flow/Settings/Settings.cpp similarity index 94% rename from TombEngine/Scripting/TEN/Flow/Settings/Settings.cpp rename to TombEngine/Scripting/Internal/TEN/Flow/Settings/Settings.cpp index 28f81a931..d63d3a3c6 100644 --- a/TombEngine/Scripting/TEN/Flow/Settings/Settings.cpp +++ b/TombEngine/Scripting/Internal/TEN/Flow/Settings/Settings.cpp @@ -10,6 +10,9 @@ Settings that will be run on game startup. void Settings::Register(sol::table & parent) { parent.new_usertype("Settings", + sol::constructors(), + sol::call_constructor, sol::constructors(), + "screenWidth", &Settings::ScreenWidth, "screenHeight", &Settings::ScreenHeight, "enableDynamicShadows", &Settings::EnableDynamicShadows, diff --git a/TombEngine/Scripting/TEN/Flow/Settings/Settings.h b/TombEngine/Scripting/Internal/TEN/Flow/Settings/Settings.h similarity index 100% rename from TombEngine/Scripting/TEN/Flow/Settings/Settings.h rename to TombEngine/Scripting/Internal/TEN/Flow/Settings/Settings.h diff --git a/TombEngine/Scripting/TEN/Flow/SkyLayer/SkyLayer.cpp b/TombEngine/Scripting/Internal/TEN/Flow/SkyLayer/SkyLayer.cpp similarity index 91% rename from TombEngine/Scripting/TEN/Flow/SkyLayer/SkyLayer.cpp rename to TombEngine/Scripting/Internal/TEN/Flow/SkyLayer/SkyLayer.cpp index 732664592..a46442134 100644 --- a/TombEngine/Scripting/TEN/Flow/SkyLayer/SkyLayer.cpp +++ b/TombEngine/Scripting/Internal/TEN/Flow/SkyLayer/SkyLayer.cpp @@ -10,8 +10,10 @@ As seen in TR4's City of the Dead. void SkyLayer::Register(sol::table & parent) { + using ctors = sol::constructors; parent.new_usertype("SkyLayer", - sol::constructors(), + ctors(), + sol::call_constructor, ctors(), /// (@{Color}) RGB sky color //@mem color diff --git a/TombEngine/Scripting/TEN/Flow/SkyLayer/SkyLayer.h b/TombEngine/Scripting/Internal/TEN/Flow/SkyLayer/SkyLayer.h similarity index 100% rename from TombEngine/Scripting/TEN/Flow/SkyLayer/SkyLayer.h rename to TombEngine/Scripting/Internal/TEN/Flow/SkyLayer/SkyLayer.h diff --git a/TombEngine/Scripting/TEN/Inventory/InventoryHandler.cpp b/TombEngine/Scripting/Internal/TEN/Inventory/InventoryHandler.cpp similarity index 100% rename from TombEngine/Scripting/TEN/Inventory/InventoryHandler.cpp rename to TombEngine/Scripting/Internal/TEN/Inventory/InventoryHandler.cpp diff --git a/TombEngine/Scripting/TEN/Inventory/InventoryHandler.h b/TombEngine/Scripting/Internal/TEN/Inventory/InventoryHandler.h similarity index 100% rename from TombEngine/Scripting/TEN/Inventory/InventoryHandler.h rename to TombEngine/Scripting/Internal/TEN/Inventory/InventoryHandler.h diff --git a/TombEngine/Scripting/TEN/Logic/LogicHandler.cpp b/TombEngine/Scripting/Internal/TEN/Logic/LogicHandler.cpp similarity index 94% rename from TombEngine/Scripting/TEN/Logic/LogicHandler.cpp rename to TombEngine/Scripting/Internal/TEN/Logic/LogicHandler.cpp index f21b87d09..303df047b 100644 --- a/TombEngine/Scripting/TEN/Logic/LogicHandler.cpp +++ b/TombEngine/Scripting/Internal/TEN/Logic/LogicHandler.cpp @@ -1,7 +1,6 @@ #include "framework.h" #include "LogicHandler.h" -#if TEN_OPTIONAL_LUA #include "ScriptAssert.h" #include "Game/savegame.h" #include "Sound/sound.h" @@ -14,16 +13,13 @@ using namespace TEN::Effects::Lightning; /*** -Functions and callbacks for level-specific logic scripts. +Saving data, triggering functions, and callbacks for level-specific scripts. @tentable Logic @pragma nostrip */ -#endif - void SetVariable(sol::table tab, sol::object key, sol::object value) { -#if TEN_OPTIONAL_LUA switch (value.get_type()) { case sol::type::lua_nil: @@ -58,54 +54,40 @@ void SetVariable(sol::table tab, sol::object key, sol::object value) key.pop(); break; } -#endif } sol::object GetVariable(sol::table tab, sol::object key) { -#if TEN_OPTIONAL_LUA return tab.raw_get(key); -#endif } LogicHandler::LogicHandler(sol::state* lua, sol::table & parent) : m_handler{ lua } { -#if TEN_OPTIONAL_LUA ResetScripts(true); -#endif } void LogicHandler::ResetGameTables() { -#if TEN_OPTIONAL_LUA MakeSpecialTable(m_handler.GetState(), ScriptReserved_GameVars, &GetVariable, &SetVariable); -#endif } void LogicHandler::ResetLevelTables() { -#if TEN_OPTIONAL_LUA MakeSpecialTable(m_handler.GetState(), ScriptReserved_LevelFuncs, &LogicHandler::GetLevelFunc, &LogicHandler::SetLevelFunc, this); MakeSpecialTable(m_handler.GetState(), ScriptReserved_LevelVars, &GetVariable, &SetVariable); -#endif } sol::protected_function LogicHandler::GetLevelFunc(sol::table tab, std::string const& luaName) { -#if TEN_OPTIONAL_LUA if (m_levelFuncs.find(luaName) == m_levelFuncs.end()) return sol::lua_nil; return m_levelFuncs.at(luaName); -#else - return sol::nil; -#endif } bool LogicHandler::SetLevelFunc(sol::table tab, std::string const& luaName, sol::object value) { -#if TEN_OPTIONAL_LUA switch (value.get_type()) { case sol::type::lua_nil: @@ -120,9 +102,6 @@ bool LogicHandler::SetLevelFunc(sol::table tab, std::string const& luaName, sol: return ScriptAssert(false, error); } return true; -#else - return true; -#endif } void LogicHandler::ResetScripts(bool clearGameVars) @@ -137,7 +116,6 @@ void LogicHandler::ResetScripts(bool clearGameVars) void LogicHandler::FreeLevelScripts() { -#if TEN_OPTIONAL_LUA m_levelFuncs.clear(); ResetLevelTables(); m_onStart = sol::nil; @@ -146,50 +124,38 @@ void LogicHandler::FreeLevelScripts() m_onSave = sol::nil; m_onEnd = sol::nil; m_handler.GetState()->collect_garbage(); -#endif } void JumpToLevel(int levelNum) { -#if TEN_OPTIONAL_LUA if (levelNum >= g_GameFlow->GetNumLevels()) return; LevelComplete = levelNum; -#endif } int GetSecretsCount() { -#if TEN_OPTIONAL_LUA return Statistics.Level.Secrets; -#else - return 0; -#endif } void SetSecretsCount(int secretsNum) { -#if TEN_OPTIONAL_LUA if (secretsNum > 255) return; Statistics.Level.Secrets = secretsNum; -#endif } void AddOneSecret() { -#if TEN_OPTIONAL_LUA if (Statistics.Level.Secrets >= 255) return; Statistics.Level.Secrets++; PlaySecretTrack(); -#endif } void LogicHandler::SetVariables(std::vector const & vars) { -#if TEN_OPTIONAL_LUA ResetGameTables(); ResetLevelTables(); @@ -248,12 +214,10 @@ void LogicHandler::SetVariables(std::vector const & vars) { (*m_handler.GetState())[ScriptReserved_GameVars][first] = second; } -#endif } void LogicHandler::GetVariables(std::vector & vars) { -#if TEN_OPTIONAL_LUA sol::table tab{ *m_handler.GetState(), sol::create }; tab[ScriptReserved_LevelVars] = (*m_handler.GetState())[ScriptReserved_LevelVars]; tab[ScriptReserved_GameVars] = (*m_handler.GetState())[ScriptReserved_GameVars]; @@ -360,16 +324,13 @@ void LogicHandler::GetVariables(std::vector & vars) return first->second; }; populate(tab); -#endif } template std::unique_ptr GetByName(std::string const & type, std::string const & name, mapType const & map) { -#if TEN_OPTIONAL_LUA ScriptAssert(map.find(name) != map.end(), std::string{ type + " name not found: " + name }, ErrorMode::Terminate); return std::make_unique(map.at(name), false); -#endif } /*** Special objects @@ -381,21 +342,16 @@ std::unique_ptr GetByName(std::string const & type, std::string const & name, */ void LogicHandler::ResetVariables() { -#if TEN_OPTIONAL_LUA (*m_handler.GetState())["Lara"] = nullptr; -#endif } void LogicHandler::ExecuteScriptFile(const std::string & luaFilename) { -#if TEN_OPTIONAL_LUA m_handler.ExecuteScript(luaFilename); -#endif } void LogicHandler::ExecuteFunction(std::string const& luaFuncName, short idOne, short idTwo) { -#if TEN_OPTIONAL_LUA sol::protected_function_result r; sol::protected_function func = (*m_handler.GetState())["LevelFuncs"][luaFuncName.c_str()]; r = func(std::make_unique(idOne), std::make_unique(idTwo)); @@ -404,12 +360,10 @@ void LogicHandler::ExecuteFunction(std::string const& luaFuncName, short idOne, sol::error err = r; ScriptAssertF(false, "Could not execute function {}: {}", luaFuncName, err.what()); } -#endif } void LogicHandler::ExecuteFunction(std::string const& name, TEN::Control::Volumes::VolumeTriggerer triggerer) { -#if TEN_OPTIONAL_LUA sol::protected_function_result r; sol::protected_function func = (*m_handler.GetState())["LevelFuncs"][name.c_str()]; if (std::holds_alternative(triggerer)) @@ -426,10 +380,8 @@ void LogicHandler::ExecuteFunction(std::string const& name, TEN::Control::Volume sol::error err = r; ScriptAssertF(false, "Could not execute function {}: {}", name, err.what()); } -#endif } -#if TEN_OPTIONAL_LUA static void doCallback(sol::protected_function const & func, std::optional dt = std::nullopt) { auto r = dt.has_value() ? func(dt) : func(); @@ -439,48 +391,36 @@ static void doCallback(sol::protected_function const & func, std::optionallua_state(), LUA_GCCOLLECT, 0); -#if TEN_OPTIONAL_LUA if(m_onControlPhase.valid()) doCallback(m_onControlPhase, dt); -#endif } void LogicHandler::OnSave() { -#if TEN_OPTIONAL_LUA if(m_onSave.valid()) doCallback(m_onSave); -#endif } void LogicHandler::OnEnd() { -#if TEN_OPTIONAL_LUA if(m_onEnd.valid()) doCallback(m_onEnd); -#endif } /*** Special tables @@ -555,7 +495,6 @@ and provides the delta time (a float representing game time since last call) via void LogicHandler::InitCallbacks() { -#if TEN_OPTIONAL_LUA auto assignCB = [this](sol::protected_function& func, std::string const & luaFunc) { std::string fullName = "LevelFuncs." + luaFunc; func = (*m_handler.GetState())["LevelFuncs"][luaFunc]; @@ -570,5 +509,4 @@ void LogicHandler::InitCallbacks() assignCB(m_onControlPhase, "OnControlPhase"); assignCB(m_onSave, "OnSave"); assignCB(m_onEnd, "OnEnd"); -#endif } diff --git a/TombEngine/Scripting/TEN/Logic/LogicHandler.h b/TombEngine/Scripting/Internal/TEN/Logic/LogicHandler.h similarity index 97% rename from TombEngine/Scripting/TEN/Logic/LogicHandler.h rename to TombEngine/Scripting/Internal/TEN/Logic/LogicHandler.h index 46bb42365..8050afcc1 100644 --- a/TombEngine/Scripting/TEN/Logic/LogicHandler.h +++ b/TombEngine/Scripting/Internal/TEN/Logic/LogicHandler.h @@ -1,5 +1,5 @@ #pragma once -#include "Scripting/ScriptInterfaceGame.h" +#include "ScriptInterfaceGame.h" #include "Game/items.h" #include "LuaHandler.h" #include diff --git a/TombEngine/Scripting/TEN/Misc/Miscellanous.cpp b/TombEngine/Scripting/Internal/TEN/Misc/Miscellanous.cpp similarity index 99% rename from TombEngine/Scripting/TEN/Misc/Miscellanous.cpp rename to TombEngine/Scripting/Internal/TEN/Misc/Miscellanous.cpp index a2ab7ee7b..657a6a627 100644 --- a/TombEngine/Scripting/TEN/Misc/Miscellanous.cpp +++ b/TombEngine/Scripting/Internal/TEN/Misc/Miscellanous.cpp @@ -11,7 +11,7 @@ #include "camera.h" /*** -Scripts that will be run on game startup. +Functions that don't fit in the other modules. @tentable Misc @pragma nostrip */ @@ -173,7 +173,7 @@ namespace Misc { ///Translate a pair of percentages to screen-space pixel coordinates. - //To be used with @{Strings.DisplayString:SetPosition} and @{Strings.DisplayString.new}. + //To be used with @{Strings.DisplayString:SetPosition} and @{Strings.DisplayString}. //@function PercentToScreen //@tparam float x percent value to translate to x-coordinate //@tparam float y percent value to translate to y-coordinate diff --git a/TombEngine/Scripting/TEN/Misc/Miscellanous.h b/TombEngine/Scripting/Internal/TEN/Misc/Miscellanous.h similarity index 100% rename from TombEngine/Scripting/TEN/Misc/Miscellanous.h rename to TombEngine/Scripting/Internal/TEN/Misc/Miscellanous.h diff --git a/TombEngine/Scripting/TEN/Objects/AIObject/AIObject.cpp b/TombEngine/Scripting/Internal/TEN/Objects/AIObject/AIObject.cpp similarity index 98% rename from TombEngine/Scripting/TEN/Objects/AIObject/AIObject.cpp rename to TombEngine/Scripting/Internal/TEN/Objects/AIObject/AIObject.cpp index d38d2862f..75d13e929 100644 --- a/TombEngine/Scripting/TEN/Objects/AIObject/AIObject.cpp +++ b/TombEngine/Scripting/Internal/TEN/Objects/AIObject/AIObject.cpp @@ -1,7 +1,6 @@ #pragma once #include "framework.h" -#if TEN_OPTIONAL_LUA #include "AIObject.h" #include "ScriptAssert.h" #include "Vec3/Vec3.h" @@ -23,6 +22,7 @@ AIObject::AIObject(AI_OBJECT & ref) : m_aiObject{ref} void AIObject::Register(sol::table & parent) { parent.new_usertype(ScriptReserved_AIObject, + sol::no_constructor, // ability to spawn new ones could be added later sol::meta_function::index, index_error, sol::meta_function::new_index, newindex_error, @@ -163,4 +163,3 @@ void AIObject::SetRoom(short room) m_aiObject.roomNumber = room; } -#endif diff --git a/TombEngine/Scripting/TEN/Objects/AIObject/AIObject.h b/TombEngine/Scripting/Internal/TEN/Objects/AIObject/AIObject.h similarity index 100% rename from TombEngine/Scripting/TEN/Objects/AIObject/AIObject.h rename to TombEngine/Scripting/Internal/TEN/Objects/AIObject/AIObject.h diff --git a/TombEngine/Scripting/TEN/Objects/Camera/CameraObject.cpp b/TombEngine/Scripting/Internal/TEN/Objects/Camera/CameraObject.cpp similarity index 97% rename from TombEngine/Scripting/TEN/Objects/Camera/CameraObject.cpp rename to TombEngine/Scripting/Internal/TEN/Objects/Camera/CameraObject.cpp index 23cfc4832..c058682cf 100644 --- a/TombEngine/Scripting/TEN/Objects/Camera/CameraObject.cpp +++ b/TombEngine/Scripting/Internal/TEN/Objects/Camera/CameraObject.cpp @@ -1,6 +1,5 @@ #include "framework.h" -#if TEN_OPTIONAL_LUA #include "ScriptAssert.h" #include "Objects/Camera/CameraObject.h" #include "Vec3/Vec3.h" @@ -24,6 +23,7 @@ Camera::Camera(LEVEL_CAMERA_INFO & ref) : m_camera{ref} void Camera::Register(sol::table & parent) { parent.new_usertype(ScriptReserved_Camera, + sol::no_constructor, // ability to spawn new ones could be added later sol::meta_function::index, index_error, sol::meta_function::new_index, newindex_error, @@ -114,4 +114,3 @@ void Camera::SetRoom(short room) m_camera.roomNumber = room; } -#endif diff --git a/TombEngine/Scripting/TEN/Objects/Camera/CameraObject.h b/TombEngine/Scripting/Internal/TEN/Objects/Camera/CameraObject.h similarity index 100% rename from TombEngine/Scripting/TEN/Objects/Camera/CameraObject.h rename to TombEngine/Scripting/Internal/TEN/Objects/Camera/CameraObject.h diff --git a/TombEngine/Scripting/TEN/Objects/Moveable/MoveableObject.cpp b/TombEngine/Scripting/Internal/TEN/Objects/Moveable/MoveableObject.cpp similarity index 91% rename from TombEngine/Scripting/TEN/Objects/Moveable/MoveableObject.cpp rename to TombEngine/Scripting/Internal/TEN/Objects/Moveable/MoveableObject.cpp index 5b3a0d792..7d25480f3 100644 --- a/TombEngine/Scripting/TEN/Objects/Moveable/MoveableObject.cpp +++ b/TombEngine/Scripting/Internal/TEN/Objects/Moveable/MoveableObject.cpp @@ -1,6 +1,5 @@ #include "framework.h" -#ifdef TEN_OPTIONAL_LUA #include "ScriptAssert.h" #include "MoveableObject.h" #include "ScriptUtil.h" @@ -64,12 +63,12 @@ bool operator==(Moveable const& first, Moveable const& second) /*** For more information on each parameter, see the associated getters and setters. If you do not know what to set for these, -most can just be set to zero (see usage). - @function Moveable.New +most can just be ignored (see usage). + @function Moveable @tparam ObjID object ID @tparam string name Lua name of the item @tparam Vec3 position position in level - @tparam Rotation rotation rotation about x, y, and z axes (default Rotation.new(0, 0, 0)) + @tparam Rotation rotation rotation about x, y, and z axes (default Rotation(0, 0, 0)) @tparam int room room ID item is in @tparam int animNumber anim number (default 0) @tparam int frameNumber frame number (default 0) @@ -78,17 +77,12 @@ most can just be set to zero (see usage). @tparam table AIBits table with AI bits (default {0,0,0,0,0,0}) @return reference to new Moveable object @usage - local item = Moveable.New( + local item = Moveable( TEN.ObjID.PISTOLS_ITEM, -- object id "test", -- name - Vec3.new(18907, 0, 21201), - Rotation.new(0,0,0), + Vec3(18907, 0, 21201), + Rotation(0,0,0), 0, -- room - 0, -- animNumber - 0, -- frameNumber - 10, -- HP - 0, -- OCB - {0,0,0,0,0,0} -- aiBits ) */ @@ -139,22 +133,22 @@ void Moveable::Register(sol::table & parent) { parent.new_usertype(LUA_CLASS_NAME, ScriptReserved_new, Create, - ScriptReserved_newTemporary, Create, + sol::call_constructor, Create, sol::meta_function::index, index_error, sol::meta_function::new_index, newindex_error, sol::meta_function::equal_to, std::equal_to(), -/// Enable the item +/// Enable the item, as if a trigger for it had been stepped on. // @function Moveable:EnableItem - ScriptReserved_Enable, &Moveable::EnableItem, + ScriptReserved_Enable, &Moveable::EnableItem, /// Disable the item // @function Moveable:DisableItem - ScriptReserved_Disable, &Moveable::DisableItem, + ScriptReserved_Disable, &Moveable::DisableItem, /// Make the item invisible. Use EnableItem to make it visible again. // @function Moveable:MakeInvisible - ScriptReserved_MakeInvisible, &Moveable::MakeInvisible, + ScriptReserved_MakeInvisible, &Moveable::MakeInvisible, /// Get the status of object. // possible values: @@ -164,38 +158,38 @@ void Moveable::Register(sol::table & parent) // 3 - invisible // @function Moveable:GetStatus // @treturn int a number representing the status of the object - ScriptReserved_GetStatus, &Moveable::GetStatus, + ScriptReserved_GetStatus, &Moveable::GetStatus, /// Set the name of the function to be called when the moveable is shot by Lara // Note that this will be triggered twice when shot with both pistols at once. // @function Moveable:SetOnHit // @tparam string name of callback function to be called - ScriptReserved_SetOnHit, &Moveable::SetOnHit, + ScriptReserved_SetOnHit, &Moveable::SetOnHit, /// Get the name of the function called when this moveable is shot // @function Moveable:GetOnHit // @treturn string name of the function - ScriptReserved_GetOnHit, &Moveable::GetOnHit, + ScriptReserved_GetOnHit, &Moveable::GetOnHit, /// Set the name of the function called when this moveable collides with another moveable // @function Moveable:SetOnCollidedWithObject // @tparam string name of callback function to be called - ScriptReserved_SetOnCollidedWithObject, &Moveable::SetOnCollidedWithObject, + ScriptReserved_SetOnCollidedWithObject, &Moveable::SetOnCollidedWithObject, /// Get the name of the function called when this moveable collides with another moveable // @function Moveable:GetOnCollidedWithObject // @treturn string name of the function - ScriptReserved_GetOnCollidedWithObject, &Moveable::GetOnCollidedWithObject, + ScriptReserved_GetOnCollidedWithObject, &Moveable::GetOnCollidedWithObject, /// Set the name of the function called when this moveable collides with room geometry (e.g. a wall or floor) // @function Moveable:SetOnCollidedWithRoom // @tparam string name of callback function to be called - ScriptReserved_SetOnCollidedWithRoom, &Moveable::SetOnCollidedWithRoom, + ScriptReserved_SetOnCollidedWithRoom, &Moveable::SetOnCollidedWithRoom, /// Get the name of the function called when this moveable collides with room geometry (e.g. a wall or floor) // @function Moveable:GetOnCollidedWithRoom // @treturn string name of the function - ScriptReserved_GetOnCollidedWithRoom, &Moveable::GetOnCollidedWithRoom, + ScriptReserved_GetOnCollidedWithRoom, &Moveable::GetOnCollidedWithRoom, /// Set the name of the function to be called when the moveable is destroyed/killed // @function Moveable:SetOnKilled @@ -203,17 +197,17 @@ void Moveable::Register(sol::table & parent) // @usage // LevelFuncs.baddyKilled = function(theBaddy) print("You killed a baddy!") end // baddy:SetOnKilled("baddyKilled") - ScriptReserved_SetOnKilled, &Moveable::SetOnKilled, + ScriptReserved_SetOnKilled, &Moveable::SetOnKilled, /// Get the name of the function called when this moveable is killed // @function Moveable:GetOnKilled // @treturn string name of the function - ScriptReserved_GetOnKilled, &Moveable::GetOnKilled, + ScriptReserved_GetOnKilled, &Moveable::GetOnKilled, /// Retrieve the object ID // @function Moveable:GetObjectID // @treturn int a number representing the ID of the object - ScriptReserved_GetObjectID, &Moveable::GetObjectID, + ScriptReserved_GetObjectID, &Moveable::GetObjectID, /// Change the object's ID. This will literally change the object. // @function Moveable:SetObjectID @@ -221,26 +215,26 @@ void Moveable::Register(sol::table & parent) // @usage // shiva = TEN.Objects.GetMoveableByName("shiva_60") // shiva:SetObjectID(TEN.Objects.ObjID.BIGMEDI_ITEM) - ScriptReserved_SetObjectID, &Moveable::SetObjectID, + ScriptReserved_SetObjectID, &Moveable::SetObjectID, /// Retrieve the index of the current animation. // This corresponds to the number shown in the item's animation list in WadTool. // @function Moveable:GetAnim // @treturn int the index of the active animation - ScriptReserved_GetAnimNumber, &Moveable::GetAnimNumber, + ScriptReserved_GetAnimNumber, &Moveable::GetAnimNumber, /// Set the opject's animation to the one specified by the given index. // Performs no bounds checking. *Ensure the number given is correct, else // the program is likely to crash with an unhelpful error message.* // @function Moveable:SetAnim // @tparam int index the index of the desired anim - ScriptReserved_SetAnimNumber, &Moveable::SetAnimNumber, + ScriptReserved_SetAnimNumber, &Moveable::SetAnimNumber, /// Retrieve frame number. // This is the current frame of the object's active animation. // @function Moveable:GetFrame // @treturn int the current frame of the active animation - ScriptReserved_GetFrameNumber, &Moveable::GetFrameNumber, + ScriptReserved_GetFrameNumber, &Moveable::GetFrameNumber, /// Set frame number. // This will move the animation to the given frame. @@ -249,27 +243,27 @@ void Moveable::Register(sol::table & parent) // is -1. // @function Moveable:SetFrame // @tparam int frame the new frame number - ScriptReserved_SetFrameNumber, &Moveable::SetFrameNumber, + ScriptReserved_SetFrameNumber, &Moveable::SetFrameNumber, /// Get current HP (hit points/health points) // @function Moveable:GetHP // @treturn int the amount of HP the moveable currently has - ScriptReserved_GetHP, &Moveable::GetHP, + ScriptReserved_GetHP, &Moveable::GetHP, /// Set current HP (hit points/health points) // @function Moveable:SetHP // @tparam int HP the amount of HP to give the moveable - ScriptReserved_SetHP, &Moveable::SetHP, + ScriptReserved_SetHP, &Moveable::SetHP, /// Get OCB (object code bit) of the moveable // @function Moveable:GetOCB // @treturn int the moveable's current OCB value - ScriptReserved_GetOCB, &Moveable::GetOCB, + ScriptReserved_GetOCB, &Moveable::GetOCB, /// Set OCB (object code bit) of the moveable // @function Moveable:SetOCB // @tparam int OCB the new value for the moveable's OCB - ScriptReserved_SetOCB, &Moveable::SetOCB, + ScriptReserved_SetOCB, &Moveable::SetOCB, /// Get AIBits of object // This will return a table with six values, each corresponding to @@ -284,7 +278,7 @@ void Moveable::Register(sol::table & parent) // 6 - patrol 2 // @function Moveable:GetAIBits // @treturn table a table of AI bits - ScriptReserved_GetAIBits, &Moveable::GetAIBits, + ScriptReserved_GetAIBits, &Moveable::GetAIBits, /// Set AIBits of object // Use this to force a moveable into a certain AI mode or modes, as if a certain nullmesh @@ -294,22 +288,22 @@ void Moveable::Register(sol::table & parent) // @usage // local sas = TEN.Objects.GetMoveableByName("sas_enemy") // sas:SetAIBits({1, 0, 0, 0, 0, 0}) - ScriptReserved_SetAIBits, &Moveable::SetAIBits, + ScriptReserved_SetAIBits, &Moveable::SetAIBits, /// Get the hit status of the object // @function Moveable:GetHitStatus // @treturn bool true if the moveable was hit by something in the last gameplay frame, false otherwise - ScriptReserved_GetHitStatus, &Moveable::GetHitStatus, + ScriptReserved_GetHitStatus, &Moveable::GetHitStatus, /// Determine whether the moveable is active or not // @function Moveable:GetActive // @treturn bool true if the moveable is active - ScriptReserved_GetActive, &Moveable::GetActive, + ScriptReserved_GetActive, &Moveable::GetActive, /// Get the current room of the object // @function Moveable:GetRoom // @treturn int number representing the current room of the object - ScriptReserved_GetRoom, &Moveable::GetRoom, + ScriptReserved_GetRoom, &Moveable::GetRoom, /// Set room of object // This is used in conjunction with SetPosition to teleport an item to a new room. @@ -649,6 +643,7 @@ void Moveable::EnableItem() { if (!m_item->Active) { + m_item->Flags |= IFLAG_ACTIVATION_MASK; if (Objects[m_item->ObjectNumber].intelligent) { if (m_item->Status == ITEM_DEACTIVATED) @@ -656,12 +651,12 @@ void Moveable::EnableItem() m_item->TouchBits = 0; m_item->Status = ITEM_ACTIVE; AddActiveItem(m_num); - EnableBaddieAI(m_num, 1); + EnableBaddyAI(m_num, 1); } else if (m_item->Status == ITEM_INVISIBLE) { m_item->TouchBits = 0; - if (EnableBaddieAI(m_num, 0)) + if (EnableBaddyAI(m_num, 0)) m_item->Status = ITEM_ACTIVE; else m_item->Status = ITEM_INVISIBLE; @@ -684,6 +679,7 @@ void Moveable::DisableItem() { if (m_item->Active) { + m_item->Flags &= ~IFLAG_ACTIVATION_MASK; if (Objects[m_item->ObjectNumber].intelligent) { if (m_item->Status == ITEM_ACTIVE) @@ -700,8 +696,10 @@ void Moveable::DisableItem() RemoveActiveItem(m_num); m_item->Status = ITEM_DEACTIVATED; } + // Try add colliding in case the item went from invisible -> deactivated - dynamic_cast(g_GameScriptEntities)->TryAddColliding(m_num); + if (m_num > NO_ITEM) + dynamic_cast(g_GameScriptEntities)->TryAddColliding(m_num); } } @@ -744,4 +742,3 @@ void Moveable::Destroy() Invalidate(); } -#endif diff --git a/TombEngine/Scripting/TEN/Objects/Moveable/MoveableObject.h b/TombEngine/Scripting/Internal/TEN/Objects/Moveable/MoveableObject.h similarity index 100% rename from TombEngine/Scripting/TEN/Objects/Moveable/MoveableObject.h rename to TombEngine/Scripting/Internal/TEN/Objects/Moveable/MoveableObject.h diff --git a/TombEngine/Scripting/TEN/Objects/NamedBase.h b/TombEngine/Scripting/Internal/TEN/Objects/NamedBase.h similarity index 100% rename from TombEngine/Scripting/TEN/Objects/NamedBase.h rename to TombEngine/Scripting/Internal/TEN/Objects/NamedBase.h diff --git a/TombEngine/Scripting/TEN/Objects/ObjectIDs.h b/TombEngine/Scripting/Internal/TEN/Objects/ObjectIDs.h similarity index 99% rename from TombEngine/Scripting/TEN/Objects/ObjectIDs.h rename to TombEngine/Scripting/Internal/TEN/Objects/ObjectIDs.h index f4882354d..0cbfa9c5a 100644 --- a/TombEngine/Scripting/TEN/Objects/ObjectIDs.h +++ b/TombEngine/Scripting/Internal/TEN/Objects/ObjectIDs.h @@ -1085,9 +1085,9 @@ static const std::unordered_map kObjIDs { {"LOCUSTS_EMITTER", ID_LOCUSTS_EMITTER}, {"SCUBA_HARPOON", ID_SCUBA_HARPOON}, {"SCUBA_DIVER", ID_SCUBA_DIVER}, - {"GOON_SILENCER1", ID_GOON_SILENCER1}, - {"GOON_SILENCER2", ID_GOON_SILENCER2}, - {"GOON_SILENCER3", ID_GOON_SILENCER3}, + {"GOON_SILENCER1", ID_BADDY_SILENCER1}, + {"GOON_SILENCER2", ID_BADDY_SILENCER2}, + {"GOON_SILENCER3", ID_BADDY_SILENCER3}, {"BARRACUDA", ID_BARRACUDA}, {"WORKER_SHOTGUN", ID_WORKER_SHOTGUN}, {"WORKER_MACHINEGUN", ID_WORKER_MACHINEGUN}, @@ -1107,8 +1107,8 @@ static const std::unordered_map kObjIDs { {"TRIBESMAN_WITH_DARTS", ID_TRIBESMAN_WITH_DARTS}, {"MP_WITH_STICK", ID_MP_WITH_STICK}, {"MP_WITH_GUN", ID_MP_WITH_GUN}, - {"GOON1", ID_GOON1}, - {"GOON2", ID_GOON2}, + {"GOON1", ID_BADDY1}, + {"GOON2", ID_BADDY2}, {"SAS_CAIRO", ID_SAS_CAIRO}, {"SAS_DYING", ID_SAS_DYING}, {"SAS_CAPTAIN", ID_SAS_CAPTAIN}, diff --git a/TombEngine/Scripting/TEN/Objects/ObjectsHandler.cpp b/TombEngine/Scripting/Internal/TEN/Objects/ObjectsHandler.cpp similarity index 96% rename from TombEngine/Scripting/TEN/Objects/ObjectsHandler.cpp rename to TombEngine/Scripting/Internal/TEN/Objects/ObjectsHandler.cpp index 17bf70cc1..113172778 100644 --- a/TombEngine/Scripting/TEN/Objects/ObjectsHandler.cpp +++ b/TombEngine/Scripting/Internal/TEN/Objects/ObjectsHandler.cpp @@ -1,7 +1,6 @@ #include "framework.h" #include "ObjectsHandler.h" -#if TEN_OPTIONAL_LUA #include "ReservedScriptNames.h" #include "Lara/lara.h" #include "ObjectIDs.h" @@ -13,17 +12,15 @@ #include "ScriptInterfaceGame.h" /*** -Scripts that will be run on game startup. +Moveables, statics, cameras, and so on. @tentable Objects @pragma nostrip */ -#endif ObjectsHandler::ObjectsHandler(sol::state* lua, sol::table & parent) : m_handler{ lua }, m_table_objects(sol::table{m_handler.GetState()->lua_state(), sol::create}) { -#if TEN_OPTIONAL_LUA parent.set(ScriptReserved_Objects, m_table_objects); /*** @@ -112,7 +109,6 @@ ObjectsHandler::ObjectsHandler(sol::state* lua, sol::table & parent) : ); m_handler.MakeReadOnlyTable(m_table_objects, ScriptReserved_ObjID, kObjIDs); -#endif } void ObjectsHandler::TestCollidingObjects() @@ -153,15 +149,12 @@ void ObjectsHandler::TestCollidingObjects() void ObjectsHandler::AssignLara() { -#if TEN_OPTIONAL_LUA m_table_objects.set("Lara", Moveable(Lara.ItemNumber, false)); -#endif } bool ObjectsHandler::NotifyKilled(ItemInfo* key) { -#if TEN_OPTIONAL_LUA auto it = m_moveables.find(key); if (std::end(m_moveables) != it) { @@ -172,12 +165,10 @@ bool ObjectsHandler::NotifyKilled(ItemInfo* key) return true; } return false; -#endif } bool ObjectsHandler::AddMoveableToMap(ItemInfo* key, Moveable* mov) { -#if TEN_OPTIONAL_LUA std::unordered_set movVec; movVec.insert(mov); auto it = m_moveables.find(key); @@ -190,13 +181,10 @@ bool ObjectsHandler::AddMoveableToMap(ItemInfo* key, Moveable* mov) m_moveables[key].insert(mov); return true; } -#endif } bool ObjectsHandler::RemoveMoveableFromMap(ItemInfo* key, Moveable* mov) { -#if TEN_OPTIONAL_LUA - //todo why is "lara" destroyed here??? auto it = m_moveables.find(key); if (std::end(m_moveables) != it) { @@ -209,7 +197,6 @@ bool ObjectsHandler::RemoveMoveableFromMap(ItemInfo* key, Moveable* mov) return erased; } return false; -#endif } diff --git a/TombEngine/Scripting/TEN/Objects/ObjectsHandler.h b/TombEngine/Scripting/Internal/TEN/Objects/ObjectsHandler.h similarity index 97% rename from TombEngine/Scripting/TEN/Objects/ObjectsHandler.h rename to TombEngine/Scripting/Internal/TEN/Objects/ObjectsHandler.h index 62b326452..aa6d39125 100644 --- a/TombEngine/Scripting/TEN/Objects/ObjectsHandler.h +++ b/TombEngine/Scripting/Internal/TEN/Objects/ObjectsHandler.h @@ -2,7 +2,7 @@ #include #include #include "LuaHandler.h" -#include "Scripting/Objects/ScriptInterfaceObjectsHandler.h" +#include "Objects/ScriptInterfaceObjectsHandler.h" #include "Objects/Moveable/MoveableObject.h" #include "Objects/Static/StaticObject.h" #include "Objects/AIObject/AIObject.h" diff --git a/TombEngine/Scripting/TEN/Objects/Sink/SinkObject.cpp b/TombEngine/Scripting/Internal/TEN/Objects/Sink/SinkObject.cpp similarity index 97% rename from TombEngine/Scripting/TEN/Objects/Sink/SinkObject.cpp rename to TombEngine/Scripting/Internal/TEN/Objects/Sink/SinkObject.cpp index e69e2ec6f..4da9246f5 100644 --- a/TombEngine/Scripting/TEN/Objects/Sink/SinkObject.cpp +++ b/TombEngine/Scripting/Internal/TEN/Objects/Sink/SinkObject.cpp @@ -1,7 +1,6 @@ #pragma once #include "framework.h" -#if TEN_OPTIONAL_LUA #include "ScriptAssert.h" #include "SinkObject.h" #include "Vec3/Vec3.h" @@ -23,6 +22,7 @@ Sink::Sink(SINK_INFO & ref) : m_sink{ref} void Sink::Register(sol::table& parent) { parent.new_usertype(ScriptReserved_Sink, + sol::no_constructor, // ability to spawn new ones could be added later sol::meta_function::index, index_error, sol::meta_function::new_index, newindex_error, @@ -107,4 +107,3 @@ void Sink::SetStrength(int str) m_sink.strength = std::clamp(str, 1, 32); } -#endif diff --git a/TombEngine/Scripting/TEN/Objects/Sink/SinkObject.h b/TombEngine/Scripting/Internal/TEN/Objects/Sink/SinkObject.h similarity index 100% rename from TombEngine/Scripting/TEN/Objects/Sink/SinkObject.h rename to TombEngine/Scripting/Internal/TEN/Objects/Sink/SinkObject.h diff --git a/TombEngine/Scripting/TEN/Objects/SoundSource/SoundSourceObject.cpp b/TombEngine/Scripting/Internal/TEN/Objects/SoundSource/SoundSourceObject.cpp similarity index 97% rename from TombEngine/Scripting/TEN/Objects/SoundSource/SoundSourceObject.cpp rename to TombEngine/Scripting/Internal/TEN/Objects/SoundSource/SoundSourceObject.cpp index 21d116e14..65f19a9f6 100644 --- a/TombEngine/Scripting/TEN/Objects/SoundSource/SoundSourceObject.cpp +++ b/TombEngine/Scripting/Internal/TEN/Objects/SoundSource/SoundSourceObject.cpp @@ -1,6 +1,5 @@ #include "framework.h" -#if TEN_OPTIONAL_LUA #include "ScriptAssert.h" #include "SoundSourceObject.h" #include "Vec3/Vec3.h" @@ -22,6 +21,7 @@ SoundSource::SoundSource(SOUND_SOURCE_INFO & ref) : m_soundSource{ref} void SoundSource::Register(sol::table & parent) { parent.new_usertype(ScriptReserved_SoundSource, + sol::no_constructor, // ability to spawn new ones could be added later sol::meta_function::index, index_error, sol::meta_function::new_index, newindex_error, @@ -104,4 +104,3 @@ void SoundSource::SetSoundID(int soundID) { m_soundSource.soundId = soundID; } -#endif diff --git a/TombEngine/Scripting/TEN/Objects/SoundSource/SoundSourceObject.h b/TombEngine/Scripting/Internal/TEN/Objects/SoundSource/SoundSourceObject.h similarity index 100% rename from TombEngine/Scripting/TEN/Objects/SoundSource/SoundSourceObject.h rename to TombEngine/Scripting/Internal/TEN/Objects/SoundSource/SoundSourceObject.h diff --git a/TombEngine/Scripting/TEN/Objects/Static/StaticObject.cpp b/TombEngine/Scripting/Internal/TEN/Objects/Static/StaticObject.cpp similarity index 98% rename from TombEngine/Scripting/TEN/Objects/Static/StaticObject.cpp rename to TombEngine/Scripting/Internal/TEN/Objects/Static/StaticObject.cpp index 8e222ab95..f33e4ec9c 100644 --- a/TombEngine/Scripting/TEN/Objects/Static/StaticObject.cpp +++ b/TombEngine/Scripting/Internal/TEN/Objects/Static/StaticObject.cpp @@ -1,6 +1,6 @@ #pragma once #include "framework.h" -#if TEN_OPTIONAL_LUA + #include "ScriptAssert.h" #include "StaticObject.h" #include "Vec3/Vec3.h" @@ -9,7 +9,7 @@ #include "ScriptUtil.h" #include "ReservedScriptNames.h" /*** -Mesh info +Statics @tenclass Objects.Static @pragma nostrip @@ -24,6 +24,7 @@ Static::Static(MESH_INFO & ref) : m_mesh{ref} void Static::Register(sol::table & parent) { parent.new_usertype(ScriptReserved_Static, + sol::no_constructor, // ability to spawn new ones could be added later sol::meta_function::index, index_error, sol::meta_function::new_index, newindex_error, @@ -154,5 +155,4 @@ ScriptColor Static::GetColor() const void Static::SetColor(ScriptColor const & col) { m_mesh.color = col; -} -#endif \ No newline at end of file +} \ No newline at end of file diff --git a/TombEngine/Scripting/TEN/Objects/Static/StaticObject.h b/TombEngine/Scripting/Internal/TEN/Objects/Static/StaticObject.h similarity index 100% rename from TombEngine/Scripting/TEN/Objects/Static/StaticObject.h rename to TombEngine/Scripting/Internal/TEN/Objects/Static/StaticObject.h diff --git a/TombEngine/Scripting/TEN/Rotation/Rotation.cpp b/TombEngine/Scripting/Internal/TEN/Rotation/Rotation.cpp similarity index 87% rename from TombEngine/Scripting/TEN/Rotation/Rotation.cpp rename to TombEngine/Scripting/Internal/TEN/Rotation/Rotation.cpp index 41fe61d75..88f796cb4 100644 --- a/TombEngine/Scripting/TEN/Rotation/Rotation.cpp +++ b/TombEngine/Scripting/Internal/TEN/Rotation/Rotation.cpp @@ -12,19 +12,21 @@ All values will be clamped to [-32768, 32767]. void Rotation::Register(sol::table & parent) { + using ctors = sol::constructors; parent.new_usertype("Rotation", - sol::constructors(), + ctors(), + sol::call_constructor, ctors(), sol::meta_function::to_string, &Rotation::ToString, /// (int) rotation about x axis //@mem x "x", &Rotation::x, -/// (int) rotation about x axis +/// (int) rotation about y axis //@mem y "y", &Rotation::y, -/// (int) rotation about x axis +/// (int) rotation about z axis //@mem z "z", &Rotation::z ); @@ -35,7 +37,7 @@ void Rotation::Register(sol::table & parent) @int Y rotation about y axis @int Z rotation about z axis @return A Rotation object. -@function Rotation.new +@function Rotation */ Rotation::Rotation(int aX, int aY, int aZ) { diff --git a/TombEngine/Scripting/TEN/Rotation/Rotation.h b/TombEngine/Scripting/Internal/TEN/Rotation/Rotation.h similarity index 100% rename from TombEngine/Scripting/TEN/Rotation/Rotation.h rename to TombEngine/Scripting/Internal/TEN/Rotation/Rotation.h diff --git a/TombEngine/Scripting/TEN/Strings/DisplayString/DisplayString.cpp b/TombEngine/Scripting/Internal/TEN/Strings/DisplayString/DisplayString.cpp similarity index 98% rename from TombEngine/Scripting/TEN/Strings/DisplayString/DisplayString.cpp rename to TombEngine/Scripting/Internal/TEN/Strings/DisplayString/DisplayString.cpp index 713a8376e..b6a916085 100644 --- a/TombEngine/Scripting/TEN/Strings/DisplayString/DisplayString.cpp +++ b/TombEngine/Scripting/Internal/TEN/Strings/DisplayString/DisplayString.cpp @@ -1,5 +1,5 @@ #include "framework.h" -#if TEN_OPTIONAL_LUA + #include "DisplayString.h" #include "ScriptAssert.h" #include "ReservedScriptNames.h" @@ -39,7 +39,7 @@ DisplayString::DisplayString() /*** Create a DisplayString. For use in @{Strings.ShowString|ShowString} and @{Strings.HideString|HideString}. -@function DisplayString.new +@function DisplayString @tparam string str string to print or key of translated string @tparam int x x-coordinate of top-left of string (or the center if DisplayStringOption.CENTER is given) @tparam int y y-coordinate of top-left of string (or the center if DisplayStringOption.CENTER is given) @@ -94,6 +94,7 @@ void DisplayString::Register(sol::table & parent) parent.new_usertype( ScriptReserved_DisplayString, ScriptReserved_new, &CreateString, + sol::call_constructor, &CreateString, /// Get the display string's color // @function GetColor @@ -105,13 +106,13 @@ void DisplayString::Register(sol::table & parent) // @tparam Color color the new color of the display string ScriptReserved_SetColor, &DisplayString::SetCol, - /// Get the string key to use. If `translated` is true when @{DisplayString.new} + /// Get the string key to use. If `translated` is true when @{DisplayString} // is called, this will be the string key for the translation that will be displayed. // If false or omitted, this will be the string that's displayed. // @treturn String a string ScriptReserved_GetKey, &DisplayString::GetKey, - /// Set the string key to use. If `translated` is true when @{DisplayString.new} + /// Set the string key to use. If `translated` is true when @{DisplayString} // is called, this will be the string key for the translation that will be displayed. // If false or omitted, this will be the string that's displayed. // @function SetKey @@ -202,4 +203,4 @@ GetItemCallback DisplayString::s_getItemCallback = [](DisplayStringIDType) throw TENScriptException(err); return std::nullopt; }; -#endif + diff --git a/TombEngine/Scripting/TEN/Strings/DisplayString/DisplayString.h b/TombEngine/Scripting/Internal/TEN/Strings/DisplayString/DisplayString.h similarity index 100% rename from TombEngine/Scripting/TEN/Strings/DisplayString/DisplayString.h rename to TombEngine/Scripting/Internal/TEN/Strings/DisplayString/DisplayString.h diff --git a/TombEngine/Scripting/TEN/Strings/StringsHandler.cpp b/TombEngine/Scripting/Internal/TEN/Strings/StringsHandler.cpp similarity index 91% rename from TombEngine/Scripting/TEN/Strings/StringsHandler.cpp rename to TombEngine/Scripting/Internal/TEN/Strings/StringsHandler.cpp index bd19d82c4..a7f025209 100644 --- a/TombEngine/Scripting/TEN/Strings/StringsHandler.cpp +++ b/TombEngine/Scripting/Internal/TEN/Strings/StringsHandler.cpp @@ -1,22 +1,19 @@ #include "framework.h" #include "StringsHandler.h" -#if TEN_OPTIONAL_LUA #include "ScriptAssert.h" #include "Flow/FlowHandler.h" #include #include "ReservedScriptNames.h" /*** -Scripts that will be run on game startup. +On-screen strings. @tentable Strings @pragma nostrip */ -#endif StringsHandler::StringsHandler(sol::state* lua, sol::table & parent) : LuaHandler{ lua } { -#if TEN_OPTIONAL_LUA sol::table table_strings{ m_lua->lua_state(), sol::create }; parent.set(ScriptReserved_Strings, table_strings); @@ -47,64 +44,46 @@ with a call to @{ShowString}, or this function will have no effect. ); MakeReadOnlyTable(table_strings, ScriptReserved_DisplayStringOption, kDisplayStringOptionNames); -#endif } std::optional> StringsHandler::GetDisplayString(DisplayStringIDType id) { -#if TEN_OPTIONAL_LUA auto it = m_userDisplayStrings.find(id); if (std::cend(m_userDisplayStrings) == it) return std::nullopt; return std::ref(m_userDisplayStrings.at(id)); -#else - return std::nullopt; -#endif } bool StringsHandler::ScheduleRemoveDisplayString(DisplayStringIDType id) { -#if TEN_OPTIONAL_LUA auto it = m_userDisplayStrings.find(id); if (std::cend(m_userDisplayStrings) == it) return false; it->second.m_deleteWhenZero = true; return true; -#else - return true; -#endif } void StringsHandler::SetCallbackDrawString(CallbackDrawString cb) { -#if TEN_OPTIONAL_LUA m_callbackDrawSring = cb; -#endif } bool StringsHandler::SetDisplayString(DisplayStringIDType id, UserDisplayString const & ds) { -#if TEN_OPTIONAL_LUA return m_userDisplayStrings.insert_or_assign(id, ds).second; -#else - return true; -#endif } void StringsHandler::ShowString(DisplayString const & str, sol::optional nSeconds) { -#if TEN_OPTIONAL_LUA auto it = m_userDisplayStrings.find(str.GetID()); it->second.m_timeRemaining = nSeconds.value_or(0.0f); it->second.m_isInfinite = !nSeconds.has_value(); -#endif } void StringsHandler::ProcessDisplayStrings(float dt) { -#if TEN_OPTIONAL_LUA auto it = std::begin(m_userDisplayStrings); while (it != std::end(m_userDisplayStrings)) { @@ -135,6 +114,5 @@ void StringsHandler::ProcessDisplayStrings(float dt) ++it; } } -#endif } diff --git a/TombEngine/Scripting/TEN/Strings/StringsHandler.h b/TombEngine/Scripting/Internal/TEN/Strings/StringsHandler.h similarity index 93% rename from TombEngine/Scripting/TEN/Strings/StringsHandler.h rename to TombEngine/Scripting/Internal/TEN/Strings/StringsHandler.h index 40259b475..a2f3b3cd2 100644 --- a/TombEngine/Scripting/TEN/Strings/StringsHandler.h +++ b/TombEngine/Scripting/Internal/TEN/Strings/StringsHandler.h @@ -3,7 +3,7 @@ #include #include "LuaHandler.h" #include "DisplayString/DisplayString.h" -#include "Scripting/Strings/ScriptInterfaceStringsHandler.h" +#include "Strings/ScriptInterfaceStringsHandler.h" using DisplayStringMap = std::unordered_map; diff --git a/TombEngine/Scripting/TEN/Vec3/Vec3.cpp b/TombEngine/Scripting/Internal/TEN/Vec3/Vec3.cpp similarity index 95% rename from TombEngine/Scripting/TEN/Vec3/Vec3.cpp rename to TombEngine/Scripting/Internal/TEN/Vec3/Vec3.cpp index 5b20e76c1..61f2f917f 100644 --- a/TombEngine/Scripting/TEN/Vec3/Vec3.cpp +++ b/TombEngine/Scripting/Internal/TEN/Vec3/Vec3.cpp @@ -11,8 +11,10 @@ Represents a 3-dimensional vector. void Vec3::Register(sol::table & parent) { + using ctors = sol::constructors; parent.new_usertype(ScriptReserved_Vec3, - sol::constructors(), + ctors(), + sol::call_constructor, ctors(), sol::meta_function::to_string, &Vec3::ToString, sol::meta_function::addition, &AddVec3s, sol::meta_function::subtraction, &SubtractVec3s, @@ -51,7 +53,7 @@ However, this function would return it as (0, 1, 1). @int Y y coordinate @int Z z coordinate @return A Vec3 object. -@function Vec3.new +@function Vec3 */ Vec3::Vec3(int aX, int aY, int aZ) : x{aX}, y{aY}, z{aZ} { diff --git a/TombEngine/Scripting/TEN/Vec3/Vec3.h b/TombEngine/Scripting/Internal/TEN/Vec3/Vec3.h similarity index 92% rename from TombEngine/Scripting/TEN/Vec3/Vec3.h rename to TombEngine/Scripting/Internal/TEN/Vec3/Vec3.h index 2964a8aeb..0d51b62a9 100644 --- a/TombEngine/Scripting/TEN/Vec3/Vec3.h +++ b/TombEngine/Scripting/Internal/TEN/Vec3/Vec3.h @@ -16,7 +16,7 @@ public: Vec3(int x, int y, int z); Vec3(PHD_3DPOS const& pos); - std::string ToString() const; + [[nodiscard]] std::string ToString() const; void ToLength(int newLength); void StoreInPHDPos(PHD_3DPOS& pos) const; diff --git a/TombEngine/Sound/sound_effects.h b/TombEngine/Sound/sound_effects.h index f539dc06e..c40eb6f57 100644 --- a/TombEngine/Sound/sound_effects.h +++ b/TombEngine/Sound/sound_effects.h @@ -775,7 +775,7 @@ enum SOUND_EFFECTS SFX_TR3_HYBRID_HOOF = 767, SFX_TR3_HYBRID_SWOOSH = 768, SFX_TR3_METEOR = 769, - SFX_TR3_SEAL_MUTE_BREATH_IN = 770, + SFX_TR3_SEAL_MUTANT_BREATH_IN = 770, SFX_TR3_SEAL_MUTANT_BRUSH_TAIL = 771, SFX_TR3_SEAL_MUTANT_DEATH = 772, SFX_TR3_SEAL_MUTANT_FIRE = 773, diff --git a/TombEngine/Specific/configuration.cpp b/TombEngine/Specific/configuration.cpp index 7824d0cc8..2a6576b2d 100644 --- a/TombEngine/Specific/configuration.cpp +++ b/TombEngine/Specific/configuration.cpp @@ -4,8 +4,8 @@ #include #include "resource.h" #include "Renderer/Renderer11.h" -#include "Scripting/LanguageScript.h" -#include "Scripting/Flow/ScriptInterfaceFlowHandler.h" +#include "LanguageScript.h" +#include "Flow/ScriptInterfaceFlowHandler.h" #include "Specific/input.h" #include "Specific/winmain.h" #include "Sound/sound.h" diff --git a/TombEngine/Specific/level.cpp b/TombEngine/Specific/level.cpp index c76592a20..b8d741b58 100644 --- a/TombEngine/Specific/level.cpp +++ b/TombEngine/Specific/level.cpp @@ -18,10 +18,10 @@ #include "Game/spotcam.h" #include "Objects/Generic/Doors/generic_doors.h" #include "Renderer/Renderer11.h" -#include "Scripting/Flow/ScriptInterfaceFlowHandler.h" -#include "Scripting/ScriptInterfaceGame.h" -#include "Scripting/ScriptInterfaceLevel.h" -#include "Scripting/Objects/ScriptInterfaceObjectsHandler.h" +#include "Flow/ScriptInterfaceFlowHandler.h" +#include "ScriptInterfaceGame.h" +#include "ScriptInterfaceLevel.h" +#include "Objects/ScriptInterfaceObjectsHandler.h" #include "Sound/sound.h" #include "Specific/setup.h" diff --git a/TombEngine/Specific/winmain.cpp b/TombEngine/Specific/winmain.cpp index 2cbb7ce5b..f3e0c6640 100644 --- a/TombEngine/Specific/winmain.cpp +++ b/TombEngine/Specific/winmain.cpp @@ -11,8 +11,8 @@ #include "Sound/sound.h" #include "Specific/level.h" #include "Specific/configuration.h" -#include "Scripting/LanguageScript.h" -#include "Scripting/ScriptInterfaceState.h" +#include "LanguageScript.h" +#include "ScriptInterfaceState.h" using namespace TEN::Renderer; using std::exception; diff --git a/TombEngine/TombEngine.vcxproj b/TombEngine/TombEngine.vcxproj index 2a1134ee8..94b4e22ec 100644 --- a/TombEngine/TombEngine.vcxproj +++ b/TombEngine/TombEngine.vcxproj @@ -65,7 +65,7 @@ Level1 _CRT_SECURE_NO_WARNINGS;WIN32;TombEngine_EXPORTS;_WINDOWS;_USRDLL;NOMINMAX;NEW_TIGHTROPE;CREATURE_AI_PRIORITY_OPTIMIZATION;SPDLOG_COMPILED_LIB;%(PreprocessorDefinitions) false - $(SolutionDir)TombEngine;$(SolutionDir)TombEngine\Game;$(SolutionDir)TombEngine\Game\Lara;$(SolutionDir)TombEngine\Objects;$(SolutionDir)TombEngine\Objects\Utils;$(SolutionDir)TombEngine\Objects\Effects;$(SolutionDir)TombEngine\Objects\Generic;$(SolutionDir)TombEngine\Objects\Generic\Doors;$(SolutionDir)TombEngine\Objects\Generic\Switches;$(SolutionDir)TombEngine\Objects\Generic\Object;$(SolutionDir)TombEngine\Objects\TR1;$(SolutionDir)TombEngine\Objects\TR1\Entity;$(SolutionDir)TombEngine\Objects\TR1\Trap;$(SolutionDir)TombEngine\Objects\TR2;$(SolutionDir)TombEngine\Objects\TR2\Entity;$(SolutionDir)TombEngine\Objects\TR2\Trap;$(SolutionDir)TombEngine\Objects\TR2\Vehicles;$(SolutionDir)TombEngine\Objects\TR3;$(SolutionDir)TombEngine\Objects\TR3\Entity;$(SolutionDir)TombEngine\Objects\TR3\Trap;$(SolutionDir)TombEngine\Objects\TR3\Vehicles;$(SolutionDir)TombEngine\Objects\TR4;$(SolutionDir)TombEngine\Objects\TR4\Entity;$(SolutionDir)TombEngine\Objects\TR4\Trap;$(SolutionDir)TombEngine\Objects\TR4\Object;$(SolutionDir)TombEngine\Objects\TR4\Floor;$(SolutionDir)TombEngine\Objects\TR4\Switch;$(SolutionDir)TombEngine\Objects\TR4\Vehicles;$(SolutionDir)TombEngine\Objects\TR5;$(SolutionDir)TombEngine\Objects\TR5\Entity;$(SolutionDir)TombEngine\Objects\TR5\Trap;$(SolutionDir)TombEngine\Objects\TR5\Light;$(SolutionDir)TombEngine\Objects\TR5\Emitter;$(SolutionDir)TombEngine\Objects\TR5\Shatter;$(SolutionDir)TombEngine\Objects\TR5\Switch;$(SolutionDir)TombEngine\Objects\TR5\Object;$(SolutionDir)TombEngine\Objects\Vehicles;$(SolutionDir)TombEngine\Renderer;$(SolutionDir)TombEngine\Scripting;$(SolutionDir)TombEngine\Specific;$(SolutionDir)TombEngine\Specific\IO;$(SolutionDir)TombEngine\Sound;$(SolutionDir)TombEngine\Game\pickup;$(SolutionDir)TombEngine\Game\itemdata;$(SolutionDir)TombEngine\Game\effects;$(SolutionDir)TombEngine\Scripting\TEN;%(AdditionalIncludeDirectories) + $(SolutionDir)TombEngine;$(SolutionDir)TombEngine\Game;$(SolutionDir)TombEngine\Game\Lara;$(SolutionDir)TombEngine\Objects;$(SolutionDir)TombEngine\Objects\Utils;$(SolutionDir)TombEngine\Objects\Effects;$(SolutionDir)TombEngine\Objects\Generic;$(SolutionDir)TombEngine\Objects\Generic\Doors;$(SolutionDir)TombEngine\Objects\Generic\Switches;$(SolutionDir)TombEngine\Objects\Generic\Object;$(SolutionDir)TombEngine\Objects\TR1;$(SolutionDir)TombEngine\Objects\TR1\Entity;$(SolutionDir)TombEngine\Objects\TR1\Trap;$(SolutionDir)TombEngine\Objects\TR2;$(SolutionDir)TombEngine\Objects\TR2\Entity;$(SolutionDir)TombEngine\Objects\TR2\Trap;$(SolutionDir)TombEngine\Objects\TR2\Vehicles;$(SolutionDir)TombEngine\Objects\TR3;$(SolutionDir)TombEngine\Objects\TR3\Entity;$(SolutionDir)TombEngine\Objects\TR3\Trap;$(SolutionDir)TombEngine\Objects\TR3\Vehicles;$(SolutionDir)TombEngine\Objects\TR4;$(SolutionDir)TombEngine\Objects\TR4\Entity;$(SolutionDir)TombEngine\Objects\TR4\Trap;$(SolutionDir)TombEngine\Objects\TR4\Object;$(SolutionDir)TombEngine\Objects\TR4\Floor;$(SolutionDir)TombEngine\Objects\TR4\Switch;$(SolutionDir)TombEngine\Objects\TR4\Vehicles;$(SolutionDir)TombEngine\Objects\TR5;$(SolutionDir)TombEngine\Objects\TR5\Entity;$(SolutionDir)TombEngine\Objects\TR5\Trap;$(SolutionDir)TombEngine\Objects\TR5\Light;$(SolutionDir)TombEngine\Objects\TR5\Emitter;$(SolutionDir)TombEngine\Objects\TR5\Shatter;$(SolutionDir)TombEngine\Objects\TR5\Switch;$(SolutionDir)TombEngine\Objects\TR5\Object;$(SolutionDir)TombEngine\Objects\Vehicles;$(SolutionDir)TombEngine\Renderer;$(SolutionDir)TombEngine\Specific;$(SolutionDir)TombEngine\Specific\IO;$(SolutionDir)TombEngine\Sound;$(SolutionDir)TombEngine\Game\pickup;$(SolutionDir)TombEngine\Game\itemdata;$(SolutionDir)TombEngine\Game\effects;$(SolutionDir)TombEngine\Scripting\Include;$(SolutionDir)TombEngine\Scripting\Internal;$(SolutionDir)TombEngine\Scripting\Internal\TEN;%(AdditionalIncludeDirectories) MultiThreadedDebugDLL false true @@ -74,6 +74,7 @@ framework.h EditAndContinue false + /Zc:__cplusplus /experimental:external /external:W0 /external:anglebrackets Console @@ -103,7 +104,7 @@ xcopy /Y "$(ProjectDir)Shaders\HUD\*.hlsl" "$(TargetDir)\Shaders\HUD\" Level1 _CRT_SECURE_NO_WARNINGS;WIN32;TombEngine_EXPORTS;_WINDOWS;_USRDLL;NOMINMAX;NEW_TIGHTROPE;CREATURE_AI_PRIORITY_OPTIMIZATION;SPDLOG_COMPILED_LIB;%(PreprocessorDefinitions) false - $(SolutionDir)TombEngine;$(SolutionDir)TombEngine\Game;$(SolutionDir)TombEngine\Game\Lara;$(SolutionDir)TombEngine\Objects;$(SolutionDir)TombEngine\Objects\Utils;$(SolutionDir)TombEngine\Objects\Effects;$(SolutionDir)TombEngine\Objects\Generic;$(SolutionDir)TombEngine\Objects\Generic\Doors;$(SolutionDir)TombEngine\Objects\Generic\Switches;$(SolutionDir)TombEngine\Objects\Generic\Object;$(SolutionDir)TombEngine\Objects\TR1;$(SolutionDir)TombEngine\Objects\TR1\Entity;$(SolutionDir)TombEngine\Objects\TR1\Trap;$(SolutionDir)TombEngine\Objects\TR2;$(SolutionDir)TombEngine\Objects\TR2\Entity;$(SolutionDir)TombEngine\Objects\TR2\Trap;$(SolutionDir)TombEngine\Objects\TR2\Vehicles;$(SolutionDir)TombEngine\Objects\TR3;$(SolutionDir)TombEngine\Objects\TR3\Entity;$(SolutionDir)TombEngine\Objects\TR3\Trap;$(SolutionDir)TombEngine\Objects\TR3\Vehicles;$(SolutionDir)TombEngine\Objects\TR4;$(SolutionDir)TombEngine\Objects\TR4\Entity;$(SolutionDir)TombEngine\Objects\TR4\Trap;$(SolutionDir)TombEngine\Objects\TR4\Object;$(SolutionDir)TombEngine\Objects\TR4\Floor;$(SolutionDir)TombEngine\Objects\TR4\Switch;$(SolutionDir)TombEngine\Objects\TR4\Vehicles;$(SolutionDir)TombEngine\Objects\TR5;$(SolutionDir)TombEngine\Objects\TR5\Entity;$(SolutionDir)TombEngine\Objects\TR5\Trap;$(SolutionDir)TombEngine\Objects\TR5\Light;$(SolutionDir)TombEngine\Objects\TR5\Emitter;$(SolutionDir)TombEngine\Objects\TR5\Shatter;$(SolutionDir)TombEngine\Objects\TR5\Switch;$(SolutionDir)TombEngine\Objects\TR5\Object;$(SolutionDir)TombEngine\Objects\Vehicles;$(SolutionDir)TombEngine\Renderer;$(SolutionDir)TombEngine\Scripting;$(SolutionDir)TombEngine\Specific;$(SolutionDir)TombEngine\Specific\IO;$(SolutionDir)TombEngine\Sound;$(SolutionDir)TombEngine\Game\pickup;$(SolutionDir)TombEngine\Game\itemdata;$(SolutionDir)TombEngine\Game\effects;$(SolutionDir)TombEngine\Scripting\TEN;%(AdditionalIncludeDirectories) + $(SolutionDir)TombEngine;$(SolutionDir)TombEngine\Game;$(SolutionDir)TombEngine\Game\Lara;$(SolutionDir)TombEngine\Objects;$(SolutionDir)TombEngine\Objects\Utils;$(SolutionDir)TombEngine\Objects\Effects;$(SolutionDir)TombEngine\Objects\Generic;$(SolutionDir)TombEngine\Objects\Generic\Doors;$(SolutionDir)TombEngine\Objects\Generic\Switches;$(SolutionDir)TombEngine\Objects\Generic\Object;$(SolutionDir)TombEngine\Objects\TR1;$(SolutionDir)TombEngine\Objects\TR1\Entity;$(SolutionDir)TombEngine\Objects\TR1\Trap;$(SolutionDir)TombEngine\Objects\TR2;$(SolutionDir)TombEngine\Objects\TR2\Entity;$(SolutionDir)TombEngine\Objects\TR2\Trap;$(SolutionDir)TombEngine\Objects\TR2\Vehicles;$(SolutionDir)TombEngine\Objects\TR3;$(SolutionDir)TombEngine\Objects\TR3\Entity;$(SolutionDir)TombEngine\Objects\TR3\Trap;$(SolutionDir)TombEngine\Objects\TR3\Vehicles;$(SolutionDir)TombEngine\Objects\TR4;$(SolutionDir)TombEngine\Objects\TR4\Entity;$(SolutionDir)TombEngine\Objects\TR4\Trap;$(SolutionDir)TombEngine\Objects\TR4\Object;$(SolutionDir)TombEngine\Objects\TR4\Floor;$(SolutionDir)TombEngine\Objects\TR4\Switch;$(SolutionDir)TombEngine\Objects\TR4\Vehicles;$(SolutionDir)TombEngine\Objects\TR5;$(SolutionDir)TombEngine\Objects\TR5\Entity;$(SolutionDir)TombEngine\Objects\TR5\Trap;$(SolutionDir)TombEngine\Objects\TR5\Light;$(SolutionDir)TombEngine\Objects\TR5\Emitter;$(SolutionDir)TombEngine\Objects\TR5\Shatter;$(SolutionDir)TombEngine\Objects\TR5\Switch;$(SolutionDir)TombEngine\Objects\TR5\Object;$(SolutionDir)TombEngine\Objects\Vehicles;$(SolutionDir)TombEngine\Renderer;$(SolutionDir)TombEngine\Specific;$(SolutionDir)TombEngine\Specific\IO;$(SolutionDir)TombEngine\Sound;$(SolutionDir)TombEngine\Game\pickup;$(SolutionDir)TombEngine\Game\itemdata;$(SolutionDir)TombEngine\Game\effects;$(SolutionDir)TombEngine\Scripting\Include;$(SolutionDir)TombEngine\Scripting\Internal;$(SolutionDir)TombEngine\Scripting\Internal\TEN;%(AdditionalIncludeDirectories) MultiThreadedDLL false true @@ -122,7 +123,7 @@ xcopy /Y "$(ProjectDir)Shaders\HUD\*.hlsl" "$(TargetDir)\Shaders\HUD\" true Fast true - /experimental:external /external:W0 /external:anglebrackets + /Zc:__cplusplus /experimental:external /external:W0 /external:anglebrackets Windows @@ -152,6 +153,7 @@ CALL gen.bat + @@ -200,6 +202,45 @@ CALL gen.bat + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + @@ -209,31 +250,6 @@ CALL gen.bat - - - - - - - - - - - - - - - - - - - - - - - - - @@ -428,7 +444,7 @@ CALL gen.bat - + @@ -550,6 +566,7 @@ CALL gen.bat + @@ -610,33 +627,33 @@ CALL gen.bat - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + @@ -877,7 +894,7 @@ CALL gen.bat - + @@ -1081,7 +1098,6 @@ CALL gen.bat - diff --git a/TombEngine/framework.h b/TombEngine/framework.h index cff10997c..06d9f91b6 100644 --- a/TombEngine/framework.h +++ b/TombEngine/framework.h @@ -16,7 +16,12 @@ #include #include -#define TEN_OPTIONAL_LUA 1 +#if __cplusplus >= 202002L +#define USE_FEATURE_IF_CPP20(x) x +#else +#define USE_FEATURE_IF_CPP20(x) +#endif + using namespace DirectX; using namespace DirectX::SimpleMath; diff --git a/config.ld b/config.ld index 36bea558b..d50e72921 100644 --- a/config.ld +++ b/config.ld @@ -1,4 +1,4 @@ -file = "Scripting/src" +file = "TombEngine/Scripting/Internal" new_type("mem", "Members", false) new_type("files", "Script Files", true) new_type("entityclass", "Entity classes", true) @@ -11,6 +11,21 @@ new_type("enum", "4 Enums", true) project = "TombEngine" title = "TombEngine Lua API" description = "TombEngine scripting interface" +full_description = [[Welcome to the TombEngine scripting API. This is a work in progress and some information might be wrong or outdated. Please also note that this is primarily a reference document, not a tutorial, so expect descriptions to be fairly sparse. For some examples of gameplay setups using these functions, check the example scripts. +####Module Hierarchy (boring but important) +Other than the "special tables" (GameVars, LevelVars and LevelFuncs), every module described herein is held in a master table called TEN. +For example, to call GetMoveableByName, you would have to do: + local door = TEN.Objects.GetMoveableByName("door_type4_14") +To save on typing, you can put the following at the start of a Lua file: + local Util = require("Util") + Util.ShortenTENCalls() +This will put the modules and classes in the global table. In other words, it means you can do the following: + local door = GetMoveableByName("door_type4_14") + +Enjoy. + +\- _squidshire_ +]] style = true wrap = true template = true diff --git a/doc/1 modules/Logic.html b/doc/1 modules/Logic.html index 6ecce5a4c..eb31d139c 100644 --- a/doc/1 modules/Logic.html +++ b/doc/1 modules/Logic.html @@ -80,7 +80,7 @@

Table Logic

-

Functions and callbacks for level-specific logic scripts.

+

Saving data, triggering functions, and callbacks for level-specific scripts.

@@ -258,7 +258,7 @@ and provides the delta time (a float representing game time since last call) via
generated by LDoc 1.4.6 -Last updated 2022-04-18 17:50:55 +Last updated 2022-05-13 14:34:06
diff --git a/doc/1 modules/Misc.html b/doc/1 modules/Misc.html index 5e5af673c..0c34eba8c 100644 --- a/doc/1 modules/Misc.html +++ b/doc/1 modules/Misc.html @@ -79,7 +79,7 @@

Table Misc

-

Scripts that will be run on game startup.

+

Functions that don't fit in the other modules.

@@ -238,7 +238,7 @@
Translate a pair of percentages to screen-space pixel coordinates. -To be used with Strings.DisplayString:SetPosition and Strings.DisplayString.new. +To be used with Strings.DisplayString:SetPosition and Strings.DisplayString.

Parameters:

@@ -359,7 +359,7 @@ To be used with
generated by LDoc 1.4.6 -Last updated 2022-04-18 17:50:55 +Last updated 2022-05-13 14:34:06
diff --git a/doc/1 modules/Objects.html b/doc/1 modules/Objects.html index d57eca018..e33a7379e 100644 --- a/doc/1 modules/Objects.html +++ b/doc/1 modules/Objects.html @@ -79,7 +79,7 @@

Table Objects

-

Scripts that will be run on game startup.

+

Moveables, statics, cameras, and so on.

@@ -289,7 +289,7 @@
generated by LDoc 1.4.6 -Last updated 2022-04-18 17:50:55 +Last updated 2022-05-13 14:34:06
diff --git a/doc/1 modules/Strings.html b/doc/1 modules/Strings.html index 41b661d26..9f988fdbb 100644 --- a/doc/1 modules/Strings.html +++ b/doc/1 modules/Strings.html @@ -79,7 +79,7 @@

Table Strings

-

Scripts that will be run on game startup.

+

On-screen strings.

@@ -161,7 +161,7 @@ with a call to ShowString, or
generated by LDoc 1.4.6 -Last updated 2022-04-18 17:50:55 +Last updated 2022-05-13 14:34:06
diff --git a/doc/2 classes/Flow.InventoryItem.html b/doc/2 classes/Flow.InventoryItem.html index 84ffadfa4..ea04d98a6 100644 --- a/doc/2 classes/Flow.InventoryItem.html +++ b/doc/2 classes/Flow.InventoryItem.html @@ -88,7 +88,7 @@

Functions

- +
InventoryItem.new(nameKey, slot, yOffset, scale, rot, axis, meshBits, action)InventoryItem(nameKey, slot, yOffset, scale, rot, axis, meshBits, action) Create an InventoryItem.
@@ -101,8 +101,8 @@
- - InventoryItem.new(nameKey, slot, yOffset, scale, rot, axis, meshBits, action) + + InventoryItem(nameKey, slot, yOffset, scale, rot, axis, meshBits, action)
Create an InventoryItem. diff --git a/doc/2 classes/Objects.Moveable.html b/doc/2 classes/Objects.Moveable.html index a3a216213..bbfce1a5c 100644 --- a/doc/2 classes/Objects.Moveable.html +++ b/doc/2 classes/Objects.Moveable.html @@ -87,13 +87,13 @@ pickups, and Lara herself.

Functions

- + - + @@ -255,13 +255,13 @@ associated getters and setters.
- - Moveable.New(object, name, position, rotation, room, animNumber, frameNumber, hp, OCB, AIBits) + + Moveable(object, name, position, rotation, room, animNumber, frameNumber, hp, OCB, AIBits)
For more information on each parameter, see the associated getters and setters. If you do not know what to set for these, -most can just be set to zero (see usage). +most can just be ignored (see usage).

Parameters:

@@ -280,7 +280,7 @@ most can just be set to zero (see usage).
  • rotation Rotation - rotation about x, y, and z axes (default Rotation.new(0, 0, 0)) + rotation about x, y, and z axes (default Rotation(0, 0, 0))
  • room int @@ -318,17 +318,12 @@ most can just be set to zero (see usage).

    Usage:

      -
      local item = Moveable.New(
      +        
      local item = Moveable(
       	TEN.ObjID.PISTOLS_ITEM, -- object id
       	"test", -- name
      -	Vec3.new(18907, 0, 21201),
      -	Rotation.new(0,0,0),
      +	Vec3(18907, 0, 21201),
      +	Rotation(0,0,0),
       	0, -- room
      -	0, -- animNumber
      -	0, -- frameNumber
      -	10, -- HP
      -	0, -- OCB
      -	{0,0,0,0,0,0} -- aiBits
       	)
    @@ -338,7 +333,7 @@ most can just be set to zero (see usage). Moveable:EnableItem()
    - Enable the item + Enable the item, as if a trigger for it had been stepped on. diff --git a/doc/2 classes/Objects.Static.html b/doc/2 classes/Objects.Static.html index c33fe7026..6341b3562 100644 --- a/doc/2 classes/Objects.Static.html +++ b/doc/2 classes/Objects.Static.html @@ -79,7 +79,7 @@

    Class Objects.Static

    -

    Mesh info

    +

    Statics

    diff --git a/doc/2 classes/Strings.DisplayString.html b/doc/2 classes/Strings.DisplayString.html index 50020169c..26d56fcd4 100644 --- a/doc/2 classes/Strings.DisplayString.html +++ b/doc/2 classes/Strings.DisplayString.html @@ -93,7 +93,7 @@ when you need to use screen-space coordinates.

    Functions

  • Moveable.New(object, name, position, rotation, room, animNumber, frameNumber, hp, OCB, AIBits)Moveable(object, name, position, rotation, room, animNumber, frameNumber, hp, OCB, AIBits) For more information on each parameter, see the associated getters and setters.
    Moveable:EnableItem()Enable the itemEnable the item, as if a trigger for it had been stepped on.
    Moveable:DisableItem()
    - + @@ -126,8 +126,8 @@ when you need to use screen-space coordinates.

    - - DisplayString.new(str, x, y, color, translated, flags) + + DisplayString(str, x, y, color, translated, flags)
    Create a DisplayString. @@ -224,7 +224,7 @@ TEN.Strings.DisplayStringOption.SHADOW -- will give the text a small shadow SetKey(string)
    - Set the string key to use. If translated is true when DisplayString.new + Set the string key to use. If translated is true when DisplayString is called, this will be the string key for the translation that will be displayed. If false or omitted, this will be the string that's displayed. diff --git a/doc/3 primitive classes/Rotation.html b/doc/3 primitive classes/Rotation.html index 3c30d10fa..2dcc8d3dc 100644 --- a/doc/3 primitive classes/Rotation.html +++ b/doc/3 primitive classes/Rotation.html @@ -94,17 +94,17 @@ All values will be clamped to [-32768, 32767].

    - + - +
    DisplayString.new(str, x, y, color, translated, flags)DisplayString(str, x, y, color, translated, flags) Create a DisplayString.
    y(int) rotation about x axis(int) rotation about y axis
    z(int) rotation about x axis(int) rotation about z axis

    Functions

    - + @@ -143,7 +143,7 @@ All values will be clamped to [-32768, 32767].

    y
    - (int) rotation about x axis + (int) rotation about y axis @@ -157,7 +157,7 @@ All values will be clamped to [-32768, 32767].

    z
    - (int) rotation about x axis + (int) rotation about z axis @@ -171,8 +171,8 @@ All values will be clamped to [-32768, 32767].

    - - Rotation.new(X, Y, Z) + + Rotation(X, Y, Z)
    @@ -219,7 +219,7 @@ All values will be clamped to [-32768, 32767].

    Parameters:

    • rotation - Rotation + Rotation this rotation
    @@ -242,7 +242,7 @@ All values will be clamped to [-32768, 32767].

    generated by LDoc 1.4.6 -Last updated 2022-04-18 17:50:55 +Last updated 2022-05-13 14:28:06
    diff --git a/doc/3 primitive classes/Vec3.html b/doc/3 primitive classes/Vec3.html index 72069f4a5..927c87d68 100644 --- a/doc/3 primitive classes/Vec3.html +++ b/doc/3 primitive classes/Vec3.html @@ -104,7 +104,11 @@

    Functions

    Rotation.new(X, Y, Z)Rotation(X, Y, Z)
    - + + + + + @@ -171,8 +175,35 @@
    - - Vec3.new(X, Y, Z) + + Vec3:GetNormalised(length) +
    +
    + Modify this vector so that it becomes close to the requested length.

    + +

    Note that since the engine uses integers instead of floating-point +numbers, this will be less accurate at smaller lengths. +For example, if you have the vector (100, 600, 700) and set it to +the length of 1, the vector SHOULD become approximately (0.11, 0.65, 0.75). +However, this function would return it as (0, 1, 1). + + +

    Parameters:

    +
      +
    • length + int + the new length to set the vector to. +
    • +
    + + + + + +
    +
    + + Vec3(X, Y, Z)
    @@ -219,7 +250,7 @@

    Parameters:

    • Vec3 - Vec3 + Vec3 this Vec3
    @@ -242,7 +273,7 @@
    generated by LDoc 1.4.6 -Last updated 2022-04-18 17:50:55 +Last updated 2022-05-13 14:28:06
    diff --git a/doc/index.html b/doc/index.html index 6d945e345..678d95f0f 100644 --- a/doc/index.html +++ b/doc/index.html @@ -73,6 +73,23 @@

    TombEngine scripting interface

    +

    Welcome to the TombEngine scripting API. This is a work in progress and some information might be wrong or outdated. Please also note that this is primarily a reference document, not a tutorial, so expect descriptions to be fairly sparse. For some examples of gameplay setups using these functions, check the example scripts.

    +

    Module Hierarchy (boring but important)

    +

    Other than the "special tables" (GameVars, LevelVars and LevelFuncs), every module described herein is held in a master table called TEN. +For example, to call GetMoveableByName, you would have to do:

    +
    local door = TEN.Objects.GetMoveableByName("door_type4_14")
    +
    +

    To save on typing, you can put the following at the start of a Lua file:

    +
    local Util = require("Util")
    +Util.ShortenTENCalls()
    +
    +

    This will put the modules and classes in the global table. In other words, it means you can do the following:

    +
    local door = GetMoveableByName("door_type4_14")
    +
    + +

    Enjoy.

    + +

    - squidshire

    1 Modules

    Vec3.new(X, Y, Z)Vec3:GetNormalised(length)Modify this vector so that it becomes close to the requested length.
    Vec3(X, Y, Z)
    @@ -86,7 +103,7 @@ - + @@ -98,7 +115,7 @@ - +
    LogicFunctions and callbacks for level-specific logic scripts.Saving data, triggering functions, and callbacks for level-specific scripts.
    Misc
    StringsScripts that will be run on game startup.On-screen strings.

    2 Classes

    @@ -153,7 +170,7 @@ Objects.Static - Mesh info + Statics Strings.DisplayString @@ -191,7 +208,7 @@
    generated by LDoc 1.4.6 -Last updated 2022-04-18 17:50:55 +Last updated 2022-05-13 14:32:56