From c4c810a0ccd4c98354e4c40964f75b7354bc2f97 Mon Sep 17 00:00:00 2001 From: asasas9500 Date: Thu, 7 Jan 2021 23:32:46 -0300 Subject: [PATCH 01/23] Add InitialiseExplosion() --- TR5Main/Objects/TR5/Trap/tr5_explosion.cpp | 39 ++++++++++++++++++++++ TR5Main/Objects/TR5/Trap/tr5_explosion.h | 4 +++ TR5Main/Objects/TR5/tr5_objects.cpp | 11 ++++++ TR5Main/TR5Main.vcxproj | 2 ++ TR5Main/TR5Main.vcxproj.filters | 6 ++++ 5 files changed, 62 insertions(+) create mode 100644 TR5Main/Objects/TR5/Trap/tr5_explosion.cpp create mode 100644 TR5Main/Objects/TR5/Trap/tr5_explosion.h diff --git a/TR5Main/Objects/TR5/Trap/tr5_explosion.cpp b/TR5Main/Objects/TR5/Trap/tr5_explosion.cpp new file mode 100644 index 000000000..941d92ace --- /dev/null +++ b/TR5Main/Objects/TR5/Trap/tr5_explosion.cpp @@ -0,0 +1,39 @@ +#include "framework.h" +#include "tr5_explosion.h" +#include "level.h" + +void InitialiseExplosion(short itemNumber) +{ + ITEM_INFO* item; + + item = &g_Level.Items[itemNumber]; + if (item->triggerFlags >= 30000) + { + item->itemFlags[1] = 3; + item->triggerFlags -= 30000; + } + else if (item->triggerFlags >= 20000) + { + item->itemFlags[1] = 2; + item->triggerFlags -= 20000; + } + else if (item->triggerFlags >= 10000) + { + item->itemFlags[1] = 1; + item->triggerFlags -= 10000; + } + + if (item->triggerFlags >= 1000) + { + item->itemFlags[3] = 1; + item->triggerFlags -= 1000; + } + + item->itemFlags[2] = item->triggerFlags / 100; + item->triggerFlags = 7 * (item->triggerFlags % 100); +} + +void ExplosionControl(short itemNumber) +{ + +} diff --git a/TR5Main/Objects/TR5/Trap/tr5_explosion.h b/TR5Main/Objects/TR5/Trap/tr5_explosion.h new file mode 100644 index 000000000..7af1fed16 --- /dev/null +++ b/TR5Main/Objects/TR5/Trap/tr5_explosion.h @@ -0,0 +1,4 @@ +#pragma once + +void InitialiseExplosion(short itemNumber); +void ExplosionControl(short itemNumber); diff --git a/TR5Main/Objects/TR5/tr5_objects.cpp b/TR5Main/Objects/TR5/tr5_objects.cpp index 26718c75d..022246c50 100644 --- a/TR5Main/Objects/TR5/tr5_objects.cpp +++ b/TR5Main/Objects/TR5/tr5_objects.cpp @@ -47,6 +47,7 @@ #include "tr5_romehammer.h" #include "tr5_fallingceiling.h" #include "tr5_rollingball.h" +#include "tr5_explosion.h" /// switch /// shatter @@ -1164,6 +1165,16 @@ static void StartTrap(OBJECT_INFO *obj) obj->saveFlags = true; obj->savePosition = true; } + + obj = &Objects[ID_EXPLOSION]; + if (obj->loaded) + { + obj->initialise = InitialiseExplosion; + obj->control = ExplosionControl; + obj->drawRoutine = nullptr; + obj->saveFlags = true; + obj->usingDrawAnimatingItem = false; + } } static void StartSwitch(OBJECT_INFO *obj) diff --git a/TR5Main/TR5Main.vcxproj b/TR5Main/TR5Main.vcxproj index c0ef9d5a5..3ccbfee71 100644 --- a/TR5Main/TR5Main.vcxproj +++ b/TR5Main/TR5Main.vcxproj @@ -172,6 +172,7 @@ xcopy /Y "$(ProjectDir)Scripting\Scripts\*.lua" "$(TargetDir)\Scripts" + @@ -474,6 +475,7 @@ xcopy /Y "$(ProjectDir)Scripting\Scripts\*.lua" "$(TargetDir)\Scripts" + Use diff --git a/TR5Main/TR5Main.vcxproj.filters b/TR5Main/TR5Main.vcxproj.filters index 9e8116e13..2d7cee61f 100644 --- a/TR5Main/TR5Main.vcxproj.filters +++ b/TR5Main/TR5Main.vcxproj.filters @@ -933,6 +933,9 @@ File di intestazione + + File di intestazione + @@ -1721,6 +1724,9 @@ File di origine + + File di origine + From ee1ec0d7e5c4acdfffd95dfab48b70c7f817f070 Mon Sep 17 00:00:00 2001 From: asasas9500 Date: Thu, 7 Jan 2021 23:48:30 -0300 Subject: [PATCH 02/23] Fix line endings of new files --- TR5Main/Objects/TR5/Trap/tr5_explosion.cpp | 18 +++++++++--------- TR5Main/Objects/TR5/Trap/tr5_explosion.h | 8 ++++---- 2 files changed, 13 insertions(+), 13 deletions(-) diff --git a/TR5Main/Objects/TR5/Trap/tr5_explosion.cpp b/TR5Main/Objects/TR5/Trap/tr5_explosion.cpp index 941d92ace..738c758a3 100644 --- a/TR5Main/Objects/TR5/Trap/tr5_explosion.cpp +++ b/TR5Main/Objects/TR5/Trap/tr5_explosion.cpp @@ -1,9 +1,9 @@ #include "framework.h" #include "tr5_explosion.h" #include "level.h" - -void InitialiseExplosion(short itemNumber) -{ + +void InitialiseExplosion(short itemNumber) +{ ITEM_INFO* item; item = &g_Level.Items[itemNumber]; @@ -31,9 +31,9 @@ void InitialiseExplosion(short itemNumber) item->itemFlags[2] = item->triggerFlags / 100; item->triggerFlags = 7 * (item->triggerFlags % 100); -} - -void ExplosionControl(short itemNumber) -{ - -} +} + +void ExplosionControl(short itemNumber) +{ + +} diff --git a/TR5Main/Objects/TR5/Trap/tr5_explosion.h b/TR5Main/Objects/TR5/Trap/tr5_explosion.h index 7af1fed16..a77350dd5 100644 --- a/TR5Main/Objects/TR5/Trap/tr5_explosion.h +++ b/TR5Main/Objects/TR5/Trap/tr5_explosion.h @@ -1,4 +1,4 @@ -#pragma once - -void InitialiseExplosion(short itemNumber); -void ExplosionControl(short itemNumber); +#pragma once + +void InitialiseExplosion(short itemNumber); +void ExplosionControl(short itemNumber); From 1ddc8c4c6726d028c59a6b220b9d3c35d4003de6 Mon Sep 17 00:00:00 2001 From: asasas9500 Date: Fri, 8 Jan 2021 17:49:55 -0300 Subject: [PATCH 03/23] Add ExplosionControl() --- TR5Main/Objects/TR5/Trap/tr5_explosion.cpp | 134 +++++++++++++++++++++ 1 file changed, 134 insertions(+) diff --git a/TR5Main/Objects/TR5/Trap/tr5_explosion.cpp b/TR5Main/Objects/TR5/Trap/tr5_explosion.cpp index 738c758a3..6846112e6 100644 --- a/TR5Main/Objects/TR5/Trap/tr5_explosion.cpp +++ b/TR5Main/Objects/TR5/Trap/tr5_explosion.cpp @@ -1,6 +1,17 @@ #include "framework.h" #include "tr5_explosion.h" #include "level.h" +#include "control.h" +#include "sound.h" +#include "effect2.h" +#include "tomb4fx.h" +#include "draw.h" +#include "traps.h" +#include "lara.h" +#include "tr5_smashobject.h" +#include "lara_one_gun.h" +#include "switch.h" +#include "debris.h" void InitialiseExplosion(short itemNumber) { @@ -35,5 +46,128 @@ void InitialiseExplosion(short itemNumber) void ExplosionControl(short itemNumber) { + ITEM_INFO* item; + int flag, i, dx, dy, dz, distance; + PHD_3DPOS pos; + PHD_VECTOR vec; + short triggerItems[8]; + item = &g_Level.Items[itemNumber]; + if (TriggerActive(item)) + { + item->flags |= IFLAG_INVISIBLE; + if (item->itemFlags[0] < item->triggerFlags) + { + ++item->itemFlags[0]; + } + else if (item->itemFlags[0] == item->triggerFlags) + { + ++item->itemFlags[0]; + if (g_Level.Rooms[item->roomNumber].flags & ENV_FLAG_WATER) + { + flag = 1; + } + else + { + flag = item->itemFlags[1] == 1 ? 2 : 0; + } + SoundEffect(SFX_EXPLOSION1, &item->pos, 25165828); + SoundEffect(SFX_EXPLOSION2, &item->pos, 0); + TriggerExplosionSparks(item->pos.xPos, item->pos.yPos, item->pos.zPos, 3, -2, flag, item->roomNumber); + for (i = 0; i < item->itemFlags[2]; ++i) + TriggerExplosionSparks(item->pos.xPos + (GetRandomControl() % 128 - 64) * item->itemFlags[2], item->pos.yPos + (GetRandomControl() % 128 - 64) * item->itemFlags[2], item->pos.zPos + (GetRandomControl() % 128 - 64) * item->itemFlags[2], 2, 0, i, item->roomNumber); + pos.xPos = item->pos.xPos; + pos.yPos = item->pos.yPos - 128; + pos.zPos = item->pos.zPos; + if (item->itemFlags[3]) + { + if (flag == 2) + TriggerShockwave(&pos, 48, 32 * item->itemFlags[2] + 304, 4 * item->itemFlags[2] + 96, 128, 96, 0, 24, 2048, 0); + else + TriggerShockwave(&pos, 48, 32 * item->itemFlags[2] + 304, 4 * item->itemFlags[2] + 96, 0, 96, 128, 24, 2048, 0); + } + else if (flag == 2) + { + vec.x = 0; + vec.y = 0; + vec.z = 0; + GetLaraJointPosition(&vec, 0); + dx = vec.x - item->pos.xPos; + dy = vec.y - item->pos.yPos; + dz = vec.z - item->pos.zPos; + if (abs(dx) < 1024 && abs(dy) < 1024 && abs(dz) < 1024) + { + distance = sqrt(SQUARE(dx) + SQUARE(dy) + SQUARE(dz)); + if (distance < 2048) + { + LaraItem->hitPoints -= distance / 16; + if (distance < 768) + LaraBurn(); + } + } + } + GetCollidedObjects(item, 2048, 1, CollidedItems, CollidedMeshes, 1); + if (CollidedItems[0] || CollidedMeshes[0]) + { + i = 0; + while (CollidedItems[i]) + { + if (CollidedItems[i]->objectNumber >= ID_SMASH_OBJECT1 && CollidedItems[i]->objectNumber <= ID_SMASH_OBJECT16) + { + TriggerExplosionSparks(CollidedItems[i]->pos.xPos, CollidedItems[i]->pos.yPos, CollidedItems[i]->pos.zPos, 3, -2, 0, CollidedItems[i]->roomNumber); + CollidedItems[i]->pos.yPos -= 128; + TriggerShockwave(&CollidedItems[i]->pos, 48, 304, 96, 0, 96, 128, 24, 0, 0); + CollidedItems[i]->pos.yPos += 128; + ExplodeItemNode(CollidedItems[i], 0, 0, 80); + SmashObject(CollidedItems[i] - g_Level.Items.data()); + KillItem(CollidedItems[i] - g_Level.Items.data()); + } + else if (CollidedItems[i]->objectNumber != ID_SWITCH_TYPE7 && CollidedItems[i]->objectNumber != ID_SWITCH_TYPE8) + { + if (Objects[CollidedItems[i]->objectNumber].intelligent) + DoExplosiveDamageOnBaddie(CollidedItems[i], item, WEAPON_GRENADE_LAUNCHER); + } + else + { + /* @FIXME This calls CrossbowHitSwitchType78() */ + } + ++i; + } + i = 0; + while (CollidedMeshes[i]) + { + if (CollidedMeshes[i]->staticNumber >= 50 && CollidedMeshes[i]->staticNumber < 58) + { + TriggerExplosionSparks(CollidedMeshes[i]->x, CollidedMeshes[i]->y, CollidedMeshes[i]->z, 3, -2, 0, item->roomNumber); + CollidedMeshes[i]->y -= 128; + TriggerShockwave((PHD_3DPOS *) &CollidedMeshes[i]->x, 40, 176, 64, 0, 96, 128, 16, 0, 0); + CollidedMeshes[i]->y += 128; + SoundEffect(ShatterSounds[CurrentLevel - 5][CollidedMeshes[i]->staticNumber], (PHD_3DPOS *) &CollidedMeshes[i]->x, 0); + ShatterObject(NULL, CollidedMeshes[i], -128, item->roomNumber, 0); + SmashedMeshRoom[SmashedMeshCount] = item->roomNumber; + SmashedMesh[SmashedMeshCount] = CollidedMeshes[i]; + ++SmashedMeshCount; + CollidedMeshes[i]->flags &= ~0x1; + } + ++i; + } + AlertNearbyGuards(item); + } + if (item->itemFlags[1] >= 2) + { + if (item->itemFlags[1] == 3) + { + for (i = GetSwitchTrigger(item, triggerItems, 1); i > 0; --i) + { + g_Level.Items[triggerItems[i - 1]].itemFlags[0] = 0; + } + item->itemFlags[0] = 0; + } + } + else + { + KillItem(itemNumber); + } + } + } } From a016bb7f213deb124c8a6365a979cad0b683f208 Mon Sep 17 00:00:00 2001 From: Trxye Date: Sun, 17 Jan 2021 14:46:08 -0600 Subject: [PATCH 04/23] remove kayak hack --- TR5Main/Game/traps.cpp | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/TR5Main/Game/traps.cpp b/TR5Main/Game/traps.cpp index bac46449f..542e3ab53 100644 --- a/TR5Main/Game/traps.cpp +++ b/TR5Main/Game/traps.cpp @@ -292,14 +292,14 @@ void LavaBurn(ITEM_INFO* item) FLOOR_INFO* floor = GetFloor(item->pos.xPos, 32000, item->pos.zPos, &roomNumber); if (item->floor == GetFloorHeight(floor, item->pos.xPos, 32000, item->pos.zPos)) { - if (Objects[ID_KAYAK].loaded && Objects[ID_KAYAK_LARA_ANIMS].loaded) //TEMPORARILY ADDING THIS HACK FOR TESTING- - KayakLaraRapidsDrown(); - else - { +// if (Objects[ID_KAYAK].loaded && Objects[ID_KAYAK_LARA_ANIMS].loaded) //TEMPORARILY ADDING THIS HACK FOR TESTING-// KayakLaraRapidsDrown works fine. +// KayakLaraRapidsDrown(); +// else +// { item->hitPoints = -1; item->hitStatus = true; LaraBurn(); - } +// } } } } From 6c39800d89c9f56e67bb7e8ffa635826dce23e17 Mon Sep 17 00:00:00 2001 From: asasas9500 Date: Sun, 17 Jan 2021 20:29:37 -0300 Subject: [PATCH 05/23] Fix no pathfinding --- TR5Main/Specific/level.cpp | 19 +++++++++---------- 1 file changed, 9 insertions(+), 10 deletions(-) diff --git a/TR5Main/Specific/level.cpp b/TR5Main/Specific/level.cpp index 6016a3da5..462218abb 100644 --- a/TR5Main/Specific/level.cpp +++ b/TR5Main/Specific/level.cpp @@ -124,21 +124,20 @@ int LoadItems() InitialiseItem(i); } - for (int r = 0; r < g_Level.Rooms.size(); r++) + for (auto& r : g_Level.Rooms) { - MESH_INFO* mesh = g_Level.Rooms[r].mesh.data(); - - for (int m = 0; m < g_Level.Rooms[r].mesh.size(); m++) + for (const auto& mesh : r.mesh) { - FLOOR_INFO* floor = &g_Level.Rooms[r].floor[((mesh->z - g_Level.Rooms[r].z) / 1024) + - g_Level.Rooms[r].xSize * ((mesh->x - g_Level.Rooms[r].x) / 1024)]; + FLOOR_INFO* floor = &r.floor[((mesh.z - r.z) / 1024) + r.xSize * ((mesh.x - r.x) / 1024)]; - if (!(g_Level.Boxes[floor->box].flags & BLOCKED) - && !(CurrentLevel == 5 && (r == 19 || r == 23 || r == 16))) + if (floor->box == -1) + continue; + + if (!(g_Level.Boxes[floor->box].flags & BLOCKED)) { int fl = floor->floor * 4; - STATIC_INFO* st = &StaticObjects[mesh->staticNumber]; - if (fl <= mesh->y - st->collisionBox.Y2 + 512 && fl < mesh->y - st->collisionBox.Y1) + STATIC_INFO* st = &StaticObjects[mesh.staticNumber]; + if (fl <= mesh.y - st->collisionBox.Y2 + 512 && fl < mesh.y - st->collisionBox.Y1) { if (st->collisionBox.X1 == 0 || st->collisionBox.X2 == 0 || st->collisionBox.Z1 == 0 || st->collisionBox.Z2 == 0 || From 6df3aafadab4bcdd5e0dafd44992ee1769c8bbdf Mon Sep 17 00:00:00 2001 From: Raildex Date: Tue, 19 Jan 2021 16:49:40 +0100 Subject: [PATCH 06/23] Added working Release Configuration --- TR5Main.sln | 10 +- TR5Main/Renderer/Renderer11Draw.cpp | 2 + TR5Main/Specific/winmain.cpp | 3 + TR5Main/TR5Main.sln | 31 ----- TR5Main/TR5Main.vcxproj | 200 +++++++++++++++------------- TR5Main/TR5Main.vcxproj.user | 3 +- 6 files changed, 119 insertions(+), 130 deletions(-) delete mode 100644 TR5Main/TR5Main.sln diff --git a/TR5Main.sln b/TR5Main.sln index 0c4b1493f..fe22f3121 100644 --- a/TR5Main.sln +++ b/TR5Main.sln @@ -1,24 +1,18 @@  Microsoft Visual Studio Solution File, Format Version 12.00 -# Visual Studio Version 16 -VisualStudioVersion = 16.0.28803.452 +# Visual Studio 15 +VisualStudioVersion = 15.0.28307.1300 MinimumVisualStudioVersion = 10.0.40219.1 Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "TR5Main", "TR5Main\TR5Main.vcxproj", "{15AB0220-541C-4DA1-94EB-ED3C47E4582E}" EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution - Debug|x64 = Debug|x64 Debug|x86 = Debug|x86 - Release|x64 = Release|x64 Release|x86 = Release|x86 EndGlobalSection GlobalSection(ProjectConfigurationPlatforms) = postSolution - {15AB0220-541C-4DA1-94EB-ED3C47E4582E}.Debug|x64.ActiveCfg = Debug|Win32 - {15AB0220-541C-4DA1-94EB-ED3C47E4582E}.Debug|x64.Build.0 = Debug|Win32 {15AB0220-541C-4DA1-94EB-ED3C47E4582E}.Debug|x86.ActiveCfg = Debug|Win32 {15AB0220-541C-4DA1-94EB-ED3C47E4582E}.Debug|x86.Build.0 = Debug|Win32 - {15AB0220-541C-4DA1-94EB-ED3C47E4582E}.Release|x64.ActiveCfg = Release|Win32 - {15AB0220-541C-4DA1-94EB-ED3C47E4582E}.Release|x64.Build.0 = Release|Win32 {15AB0220-541C-4DA1-94EB-ED3C47E4582E}.Release|x86.ActiveCfg = Release|Win32 {15AB0220-541C-4DA1-94EB-ED3C47E4582E}.Release|x86.Build.0 = Release|Win32 EndGlobalSection diff --git a/TR5Main/Renderer/Renderer11Draw.cpp b/TR5Main/Renderer/Renderer11Draw.cpp index 3f8ef3359..6c197ae2a 100644 --- a/TR5Main/Renderer/Renderer11Draw.cpp +++ b/TR5Main/Renderer/Renderer11Draw.cpp @@ -1801,8 +1801,10 @@ namespace T5M::Renderer m_context->ClearDepthStencilView(m_depthStencilView, D3D11_CLEAR_STENCIL | D3D11_CLEAR_DEPTH, 1.0f, 0); renderInventoryScene(m_backBufferRTV, m_depthStencilView, nullptr); +#if _DEBUG drawString(0, 0, commit.c_str(), D3DCOLOR_ARGB(255, 255,255, 255), 0); drawAllStrings(); +#endif m_swapChain->Present(0, 0); } diff --git a/TR5Main/Specific/winmain.cpp b/TR5Main/Specific/winmain.cpp index a6d5c7db5..1ef179967 100644 --- a/TR5Main/Specific/winmain.cpp +++ b/TR5Main/Specific/winmain.cpp @@ -15,6 +15,7 @@ #include #include #include +#include using namespace T5M::Renderer; using std::exception; using std::string; @@ -95,6 +96,7 @@ void CALLBACK HandleWmCommand(unsigned short wParam) } void getCurrentCommit() { +#if _DEBUG LPSTR cmdLine = {TEXT("git.exe log -1 --oneline")}; SECURITY_ATTRIBUTES sa = {0}; @@ -145,6 +147,7 @@ void getCurrentCommit() { CloseHandle(hStdOutWr); CloseHandle(hStdErrRd); CloseHandle(hStdErrWr); +#endif } void HandleScriptMessage(WPARAM wParam) diff --git a/TR5Main/TR5Main.sln b/TR5Main/TR5Main.sln deleted file mode 100644 index 7e1a625be..000000000 --- a/TR5Main/TR5Main.sln +++ /dev/null @@ -1,31 +0,0 @@ - -Microsoft Visual Studio Solution File, Format Version 12.00 -# Visual Studio 15 -VisualStudioVersion = 15.0.27428.2037 -MinimumVisualStudioVersion = 10.0.40219.1 -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "TR5Main", "TR5Main\TR5Main.vcxproj", "{15AB0220-541C-4DA1-94EB-ED3C47E4582E}" -EndProject -Global - GlobalSection(SolutionConfigurationPlatforms) = preSolution - Debug|x64 = Debug|x64 - Debug|x86 = Debug|x86 - Release|x64 = Release|x64 - Release|x86 = Release|x86 - EndGlobalSection - GlobalSection(ProjectConfigurationPlatforms) = postSolution - {15AB0220-541C-4DA1-94EB-ED3C47E4582E}.Debug|x64.ActiveCfg = Debug|x64 - {15AB0220-541C-4DA1-94EB-ED3C47E4582E}.Debug|x64.Build.0 = Debug|x64 - {15AB0220-541C-4DA1-94EB-ED3C47E4582E}.Debug|x86.ActiveCfg = Debug|Win32 - {15AB0220-541C-4DA1-94EB-ED3C47E4582E}.Debug|x86.Build.0 = Debug|Win32 - {15AB0220-541C-4DA1-94EB-ED3C47E4582E}.Release|x64.ActiveCfg = Release|x64 - {15AB0220-541C-4DA1-94EB-ED3C47E4582E}.Release|x64.Build.0 = Release|x64 - {15AB0220-541C-4DA1-94EB-ED3C47E4582E}.Release|x86.ActiveCfg = Release|Win32 - {15AB0220-541C-4DA1-94EB-ED3C47E4582E}.Release|x86.Build.0 = Release|Win32 - EndGlobalSection - GlobalSection(SolutionProperties) = preSolution - HideSolutionNode = FALSE - EndGlobalSection - GlobalSection(ExtensibilityGlobals) = postSolution - SolutionGuid = {1689BEF8-E05F-46C0-AFCA-E04DCB4EF2B2} - EndGlobalSection -EndGlobal diff --git a/TR5Main/TR5Main.vcxproj b/TR5Main/TR5Main.vcxproj index 3ccbfee71..19ed542df 100644 --- a/TR5Main/TR5Main.vcxproj +++ b/TR5Main/TR5Main.vcxproj @@ -15,7 +15,7 @@ {15AB0220-541C-4DA1-94EB-ED3C47E4582E} Win32Proj TR5Main - 10.0.17134.0 + 10.0.18362.0 @@ -26,10 +26,9 @@ Application - false - true + true MultiByte - v142 + v141 @@ -39,7 +38,7 @@ - + @@ -52,11 +51,12 @@ .exe - false + true + $(ProjectDir)..\Build\ $(ExecutablePath);$(DXSDK_DIR)Utilities\bin\x86 $(SolutionDir)TR5Main\Libs\bass;$(SolutionDir)TR5Main\Libs\lua;$(SolutionDir)TR5Main\Libs\sol;$(SolutionDir)\TR5Main\Libs\zlib;$(IncludePath) - $(SolutionDir)TR5Main\Libs\zlib\dll32;$(LibraryPath);$(DXSDK_DIR)Lib\x86;$(SolutionDir)TR5Main\Libs\bass;$(SolutionDir)TR5Main\Libs\lua - $(ProjectDir)..\Build\ + $(SolutionDir)TR5Main\Libs\zlib\dll32;$(LibraryPath);$(DXSDK_DIR)Lib\x86;$(SolutionDir)TR5Main\Libs\bass;$(SolutionDir)TR5Main\Libs\lua;$(SolutionDir)TR5Main\Libs\boost\libs + .exe @@ -94,33 +94,43 @@ xcopy /Y "$(ProjectDir)Scripting\Scripts\*.lua" "$(TargetDir)\Scripts" Use - EnableAllWarnings - MaxSpeed - true - true - true - _CRT_SECURE_NO_WARNINGS;WIN32;_RELEASE;TR5MAIN_EXPORTS;_WINDOWS;_USRDLL;%(PreprocessorDefinitions) - true - $(SolutionDir)TR5Main;$(SolutionDir)TR5Main\Game;$(SolutionDir)TR5Main\Game\Lara;$(SolutionDir)TR5Main\Global;$(SolutionDir)TR5Main\Objects;$(SolutionDir)TR5Main\Objects\Utils;$(SolutionDir)TR5Main\Objects\Effects;$(SolutionDir)TR5Main\Objects\Generic;$(SolutionDir)TR5Main\Objects\Generic\Object;$(SolutionDir)TR5Main\Objects\TR1;$(SolutionDir)TR5Main\Objects\TR1\Entity;$(SolutionDir)TR5Main\Objects\TR1\Trap;$(SolutionDir)TR5Main\Objects\TR2;$(SolutionDir)TR5Main\Objects\TR2\Entity;$(SolutionDir)TR5Main\Objects\TR2\Trap;$(SolutionDir)TR5Main\Objects\TR2\Vehicles;$(SolutionDir)TR5Main\Objects\TR3;$(SolutionDir)TR5Main\Objects\TR3\Entity;$(SolutionDir)TR5Main\Objects\TR3\Trap;$(SolutionDir)TR5Main\Objects\TR3\Vehicles;$(SolutionDir)TR5Main\Objects\TR4;$(SolutionDir)TR5Main\Objects\TR4\Entity;$(SolutionDir)TR5Main\Objects\TR4\Trap;$(SolutionDir)TR5Main\Objects\TR4\Object;$(SolutionDir)TR5Main\Objects\TR4\Floor;$(SolutionDir)TR5Main\Objects\TR4\Switch;$(SolutionDir)TR5Main\Objects\TR4\Vehicles;$(SolutionDir)TR5Main\Objects\TR5;$(SolutionDir)TR5Main\Objects\TR5\Entity;$(SolutionDir)TR5Main\Objects\TR5\Trap;$(SolutionDir)TR5Main\Objects\TR5\Light;$(SolutionDir)TR5Main\Objects\TR5\Emitter;$(SolutionDir)TR5Main\Objects\TR5\Shatter;$(SolutionDir)TR5Main\Objects\TR5\Switch;$(SolutionDir)TR5Main\Objects\TR5\Object;$(SolutionDir)TR5Main\Objects\Vehicles;$(SolutionDir)TR5Main\Renderer;$(SolutionDir)TR5Main\Scripting;$(SolutionDir)TR5Main\Specific;$(SolutionDir)TR5Main\Specific\IO;%(AdditionalIncludeDirectories) + TurnOffAllWarnings + false + _CRT_SECURE_NO_WARNINGS;WIN32;TR5MAIN_EXPORTS;_WINDOWS;_USRDLL;NOMINMAX;%(PreprocessorDefinitions) + false + $(SolutionDir)TR5Main;$(SolutionDir)TR5Main\Game;$(SolutionDir)TR5Main\Game\Lara;$(SolutionDir)TR5Main\Objects;$(SolutionDir)TR5Main\Objects\Utils;$(SolutionDir)TR5Main\Objects\Effects;$(SolutionDir)TR5Main\Objects\Generic;$(SolutionDir)TR5Main\Objects\Generic\Object;$(SolutionDir)TR5Main\Objects\TR1;$(SolutionDir)TR5Main\Objects\TR1\Entity;$(SolutionDir)TR5Main\Objects\TR1\Trap;$(SolutionDir)TR5Main\Objects\TR2;$(SolutionDir)TR5Main\Objects\TR2\Entity;$(SolutionDir)TR5Main\Objects\TR2\Trap;$(SolutionDir)TR5Main\Objects\TR2\Vehicles;$(SolutionDir)TR5Main\Objects\TR3;$(SolutionDir)TR5Main\Objects\TR3\Entity;$(SolutionDir)TR5Main\Objects\TR3\Trap;$(SolutionDir)TR5Main\Objects\TR3\Vehicles;$(SolutionDir)TR5Main\Objects\TR4;$(SolutionDir)TR5Main\Objects\TR4\Entity;$(SolutionDir)TR5Main\Objects\TR4\Trap;$(SolutionDir)TR5Main\Objects\TR4\Object;$(SolutionDir)TR5Main\Objects\TR4\Floor;$(SolutionDir)TR5Main\Objects\TR4\Switch;$(SolutionDir)TR5Main\Objects\TR4\Vehicles;$(SolutionDir)TR5Main\Objects\TR5;$(SolutionDir)TR5Main\Objects\TR5\Entity;$(SolutionDir)TR5Main\Objects\TR5\Trap;$(SolutionDir)TR5Main\Objects\TR5\Light;$(SolutionDir)TR5Main\Objects\TR5\Emitter;$(SolutionDir)TR5Main\Objects\TR5\Shatter;$(SolutionDir)TR5Main\Objects\TR5\Switch;$(SolutionDir)TR5Main\Objects\TR5\Object;$(SolutionDir)TR5Main\Objects\Vehicles;$(SolutionDir)TR5Main\Renderer;$(SolutionDir)TR5Main\Scripting;$(SolutionDir)TR5Main\Specific;$(SolutionDir)TR5Main\Specific\IO;%(AdditionalIncludeDirectories) + MultiThreadedDLL + false true - true - Speed - true + false stdcpplatest framework.h + None + Disabled + Default + AnySuitable + true + Speed + true + true + false + true + Fast + true Windows - true - true - false + true + $(OutDir)$(TargetName)$(TargetExt) C:\Program Files %28x86%29\Microsoft Visual Studio\2017\Enterprise\VC\Tools\MSVC\14.15.26726\lib\onecore\x86;%(AdditionalLibraryDirectories) - comctl32.lib;lua53.lib;bass.lib;bassmix.lib;bass_fx.lib;dxerr.lib;D3DCompiler.lib;dxgi.lib;dxguid.lib;d3d11.lib;d3dx11.lib;%(AdditionalDependencies) + comctl32.lib;lua53.lib;bass.lib;bassmix.lib;bass_fx.lib;D3DCompiler.lib;dxgi.lib;dxguid.lib;d3d11.lib;zlib.lib;%(AdditionalDependencies) false + true md "$(TargetDir)\Shaders" -xcopy /Y "$(ProjectDir)Shaders\*.fx" "$(TargetDir)\Shaders" +xcopy /Y "$(ProjectDir)Shaders\*.*" "$(TargetDir)\Shaders" +xcopy /Y "$(ProjectDir)Shaders\HUD\*.hlsl" "$(TargetDir)\Shaders\HUD\" md "$(TargetDir)\Scripts" xcopy /Y "$(ProjectDir)Scripting\Scripts\*.lua" "$(TargetDir)\Scripts" @@ -478,6 +488,7 @@ xcopy /Y "$(ProjectDir)Scripting\Scripts\*.lua" "$(TargetDir)\Scripts" Use + Use @@ -613,6 +624,7 @@ xcopy /Y "$(ProjectDir)Scripting\Scripts\*.lua" "$(TargetDir)\Scripts" NotUsing + NotUsing @@ -710,10 +722,10 @@ xcopy /Y "$(ProjectDir)Scripting\Scripts\*.lua" "$(TargetDir)\Scripts" false - true - Text false + true true + Text @@ -723,14 +735,18 @@ xcopy /Y "$(ProjectDir)Scripting\Scripts\*.lua" "$(TargetDir)\Scripts" true + true true + true Document true + true true + true Document @@ -740,241 +756,245 @@ xcopy /Y "$(ProjectDir)Scripting\Scripts\*.lua" "$(TargetDir)\Scripts" false - true false + true true PS + PS Pixel + Pixel false - true - Document false + true true + Document false + false true + true Document PSColored + PSColored 2.0 - false - true + 2.0 Document false - true false + true true false - true - Document false + true true + Document false - true - Document false + true true + Document false - true - Document false + true true + Document false - true - Document false + true true + Document false - true - Document false + true true + Document false - true - Document false + true true + Document false - true - Document false + true true + Document false - true - Document false + true true + Document false - true - Document false + true true + Document false - true - Document false + true true + Document false - true - Document false + true true + Document false - true - Document false + true true + Document false - true - Document false + true true + Document false - true - Document false + true true + Document false - true - Document false + true true + Document false - true - Document false + true true + Document false - true - Document false + true true + Document false - true - Document false + true true + Document false - true - Document false + true true + Document false - true - Document false + true true + Document false - true - Document false + true true + Document false - true - Document false + true true + Document false - true - Document false + true true + Document false - true - Document false + true true + Document false - true - Document false + true true + Document false - true - Document false + true true + Document false - true - Document false + true true + Document false - true - Document false + true true + Document false - true - Document false + true true + Document diff --git a/TR5Main/TR5Main.vcxproj.user b/TR5Main/TR5Main.vcxproj.user index 3c0e4c59c..db411226e 100644 --- a/TR5Main/TR5Main.vcxproj.user +++ b/TR5Main/TR5Main.vcxproj.user @@ -11,8 +11,9 @@ /debug - TR5Main.exe + Tr5Main.exe WindowsLocalDebugger $(ProjectDir)..\Build\ + /debug \ No newline at end of file From 4374e00ab1e6c56902ab7e3db55cd95e56caf01a Mon Sep 17 00:00:00 2001 From: Trxye Date: Wed, 20 Jan 2021 01:30:30 -0600 Subject: [PATCH 07/23] fix motorbike --- TR5Main/Objects/TR4/Vehicles/motorbike.cpp | 482 +++++++++++++-------- 1 file changed, 292 insertions(+), 190 deletions(-) diff --git a/TR5Main/Objects/TR4/Vehicles/motorbike.cpp b/TR5Main/Objects/TR4/Vehicles/motorbike.cpp index ca6488637..88c1a120c 100644 --- a/TR5Main/Objects/TR4/Vehicles/motorbike.cpp +++ b/TR5Main/Objects/TR4/Vehicles/motorbike.cpp @@ -18,7 +18,36 @@ #include "prng.h" using namespace T5M::Math::Random; -// TODO: need to fix the bug about the shift, i dont know why it appear but it's in MotorbikeDynamics() +/*collision stuff*/ +#define BIKE_FRONT 500 +#define BIKE_SIDE 350 +#define BIKE_RADIUS 500 +#define MOTORBIKE_SLIP 100 +#define MOTORBIKE_FRICTION 0x180 +/*movement stuff*/ +#define MIN_MOMENTUM_TURN ANGLE(4.0f) +#define MAX_MOMENTUM_TURN ANGLE(1.5f) +#define MOTORBIKE_MAX_MOM_TURN ANGLE(150.0f) +#define MOTORBIKE_DEFAULT_HTURN ANGLE(1.5f) +#define MOTORBIKE_ACCEL_1 0x4000 +#define MOTORBIKE_ACCEL_2 0x7000 +#define MOTORBIKE_ACCEL_MAX 0xC000 //with the boost +#define MOTORBIKE_ACCEL 0x8000 //without the boost +#define MOTORBIKE_BIG_SLOWDOWN 0x3000 +#define MOTORBIKE_SLOWDOWN1 0x440 +#define MOTORBIKE_SLOWDOWN2 0x600 +#define MOTORBIKE_HTURN ANGLE(0.5f) +#define MOTORBIKE_MAX_HTURN ANGLE(5.0f) +#define MOTORBIKE_PITCH_SLOWDOWN 0x8000 +#define MOTORBIKE_PITCH_MAX 0xA000 +#define MOTORBIKE_BACKING_VEL 0x800 +/*controls*/ +#define IN_ACCELERATE IN_ACTION +#define IN_REVERSE IN_BACK +#define IN_BRAKE IN_JUMP +#define IN_TURBO IN_SPRINT +#define IN_TURNR (IN_RIGHT|IN_RSTEP) +#define IN_TURNL (IN_LEFT|IN_LSTEP) enum MOTORBIKE_STATE { @@ -47,26 +76,45 @@ enum MOTORBIKE_STATE BIKE_MOVING_RIGHT }; +enum MOTORBIKE_ANIMS +{ + BA_DIE = 0, + BA_BRAKE = 1, + BA_MOVE_FORWARD = 2, + BA_START_LEFT = 3, + BA_LEFT = 4, + BA_END_LEFT = 5, + BA_START_FALL = 6, + BA_FALLING = 7, + BA_FALL_LAND = 8, + BA_ENTER = 9, + BA_EXIT = 10, + BA_FRONT_HIT = 11, + BA_BACK_HIT = 12, + BA_LEFT_HIT = 13, + BA_RIGHT_HIT = 14, + BA_REV = 15, //unused? it looks like she's revving the engine but I've never seen it before + BA_SLOWDOWN = 16, + BA_UNUSED = 17, + BA_IDLE = 18, + BA_START_RIGHT = 19, + BA_RIGHT = 20, + BA_END_RIGHT = 21, + BA_START_JUMP = 22, + BA_JUMPING = 23, + BA_JUMP_LAND = 24, + BA_KICKSTART = 25, + BA_BACK_START = 26, + BA_BACK_LOOP = 27, + BA_UNLOCK = 28 +}; -#define BIKE_IDLE_ANIM 18 -#define BIKE_ENTER_ANIM 9 -#define BIKE_UNLOCK_ANIM 28 -#define BIKE_DEATH_FLAG 0x80 -#define BIKE_FRONT 500 -#define BIKE_SIDE 350 -#define BIKE_RADIUS 500 -#define MIN_MOMENTUM_TURN ANGLE(4.0f) -#define MAX_MOMENTUM_TURN (ANGLE(1.0f)+(ANGLE(1.0f)/2)) -#define MOTORBIKE_MAX_MOM_TURN ANGLE(150.0f) -#define MOTORBIKE_DEFAULT_HTURN 273 -#define MOTORBIKE_ACCEL_1 0x4000 -#define MOTORBIKE_ACCEL_2 0x7000 -#define MOTORBIKE_ACCEL_MAX 0xC000 -#define MOTORBIKE_SLIP 100 -#define MOTORBIKE_SLIP_SIDE 50 -#define MOTORBIKE_HTURN (ANGLE(1.0f) / 2) -#define MOTORBIKE_MAX_HTURN ANGLE(5.0f) -#define MOTORBIKE_FRICTION 0x180 +enum MOTORBIKE_FLAGS +{ + FL_BOOST = 1, + FL_FALLING = 64, + FL_DEATH = 128 +}; extern Inventory g_Inventory; static char ExhaustStart = 0; @@ -294,11 +342,11 @@ void MotorbikeCollision(short itemNumber, ITEM_INFO* laraitem, COLL_INFO* coll) motorbike = GetMotorbikeInfo(item); // update motorbike light - if (motorbike->bikeTurn) - { - motorbike->bikeTurn -= (motorbike->bikeTurn / 8) - 1; + //if (motorbike->bikeTurn) + // { +// motorbike->bikeTurn -= (motorbike->bikeTurn / 8) - 1; DrawMotorbikeLight(item); - } + // } if (GetOnMotorBike(itemNumber)) { @@ -321,15 +369,15 @@ void MotorbikeCollision(short itemNumber, ITEM_INFO* laraitem, COLL_INFO* coll) { if (g_Inventory.GetSelectedObject() == ID_PUZZLE_ITEM1) { - laraitem->animNumber = Objects[ID_MOTORBIKE_LARA_ANIMS].animIndex + BIKE_UNLOCK_ANIM; + laraitem->animNumber = Objects[ID_MOTORBIKE_LARA_ANIMS].animIndex + BA_UNLOCK; g_Inventory.SetSelectedObject(NO_ITEM); } else { - laraitem->animNumber = Objects[ID_MOTORBIKE_LARA_ANIMS].animIndex + BIKE_ENTER_ANIM; + laraitem->animNumber = Objects[ID_MOTORBIKE_LARA_ANIMS].animIndex + BA_ENTER; } - laraitem->goalAnimState = BIKE_ENTER_ANIM; - laraitem->currentAnimState = BIKE_ENTER_ANIM; + laraitem->goalAnimState = BIKE_ENTER; + laraitem->currentAnimState = BIKE_ENTER; } laraitem->frameNumber = g_Level.Anims[laraitem->animNumber].frameBase; @@ -460,29 +508,6 @@ static void DrawMotorBikeSmoke(ITEM_INFO* item) } } -static void QuadbikeExplode(ITEM_INFO* item) -{ - if (g_Level.Rooms[item->roomNumber].flags & ENV_FLAG_WATER) - { - TriggerUnderwaterExplosion(item, 1); - } - else - { - TriggerExplosionSparks(item->pos.xPos, item->pos.yPos, item->pos.zPos, 3, -2, 0, item->roomNumber); - for (int i = 0; i < 3; i++) - TriggerExplosionSparks(item->pos.xPos, item->pos.yPos, item->pos.zPos, 3, -1, 0, item->roomNumber); - } - TriggerShockwave(&PHD_3DPOS(item->pos.xPos, item->pos.yPos - 128, item->pos.zPos, 0, item->pos.yRot, 0), 50, 180, 40, 160, 60, 60, 64, ANGLE(45), 0); - ExplodingDeath(Lara.Vehicle, 0xfffffffe, 1); - // KillItem(Lara.Vehicle); - item->status = ITEM_DEACTIVATED; - - SoundEffect(SFX_EXPLOSION1, NULL, 0); - SoundEffect(SFX_EXPLOSION2, NULL, 0); - - Lara.Vehicle = NO_ITEM; -} - static void MotorBikeExplode(ITEM_INFO* item) { if (g_Level.Rooms[item->roomNumber].flags & (ENV_FLAG_WATER|ENV_FLAG_SWAMP)) @@ -500,7 +525,6 @@ static void MotorBikeExplode(ITEM_INFO* item) ExplodingDeath(Lara.Vehicle, -2, 256); ExplodingDeath(Lara.itemNumber, -2, 258); // enable blood LaraItem->hitPoints = 0; -// KillItem(Lara.Vehicle); item->status = ITEM_DEACTIVATED; SoundEffect(SFX_EXPLOSION1, NULL, 0); @@ -557,9 +581,7 @@ static int DoMotorBikeDynamics(int height, int fallspeed, int* y, int flags) if (height <= *y) { if (flags) - { return fallspeed; - } else { // On ground @@ -620,6 +642,67 @@ static int GetMotorbikeCollisionAnim(ITEM_INFO* item, PHD_VECTOR* pos) return 0; } +void MotorbikeBaddieCollision(ITEM_INFO* bike) +{ + int x, y, z, i; + + std::vector roomsList; + roomsList.push_back(bike->roomNumber); + + ROOM_INFO* room = &g_Level.Rooms[bike->roomNumber]; + for (i = 0; i < room->doors.size(); i++) + { + roomsList.push_back(room->doors[i].room); + } + + for (int i = 0; i < roomsList.size(); i++) + { + short itemNum = g_Level.Rooms[roomsList[i]].itemNumber; + + while (itemNum != NO_ITEM) + { + ITEM_INFO* item = &g_Level.Items[itemNum]; + + if (item->collidable && item->status != IFLAG_INVISIBLE && item != LaraItem && item != bike) + { + OBJECT_INFO* object = &Objects[item->objectNumber]; + + if (object->collision && (object->intelligent)) + { + x = bike->pos.xPos - item->pos.xPos; + y = bike->pos.yPos - item->pos.yPos; + z = bike->pos.zPos - item->pos.zPos; + + if (x > -2048 && x < 2048 && z > -2048 && z < 2048 && y > -2048 && y < 2048) + { + if (item->objectNumber == ID_ROLLINGBALL) + { + if (TestBoundsCollide(item, LaraItem, 100)) + { + if (LaraItem->hitPoints > 0) + { + DoLotsOfBlood(LaraItem->pos.xPos, LaraItem->pos.yPos - (STEP_SIZE * 2), LaraItem->pos.zPos, GetRandomControl() & 3, LaraItem->pos.yRot, LaraItem->roomNumber, 5); + LaraItem->hitPoints -= 8; + } + } + } + else + { + if (TestBoundsCollide(item, bike, BIKE_FRONT)) + { + DoLotsOfBlood(bike->pos.xPos, bike->pos.yPos, bike->pos.zPos, GetRandomControl() & 3, LaraItem->pos.yRot, LaraItem->roomNumber, 3); + item->hitPoints = 0; + } + } + } + } + } + + itemNum = item->nextItem; + } + } +} + static int MotorBikeDynamics(ITEM_INFO* item) { MOTORBIKE_INFO* motorbike; @@ -634,11 +717,11 @@ static int MotorBikeDynamics(ITEM_INFO* item) NoGetOff = false; motorbike = GetMotorbikeInfo(item); - hfl_old = TestMotorbikeHeight(item, 500, -350, &fl_old); - hmf_old = TestMotorbikeHeight(item, 500, 128, &mtf_old); - hbl_old = TestMotorbikeHeight(item, -500, -350, &bl_old); - hbr_old = TestMotorbikeHeight(item, -500, 128, &br_old); - hmtb_old = TestMotorbikeHeight(item, -500, 0, &mtb_old); + hfl_old = TestMotorbikeHeight(item, BIKE_FRONT, -BIKE_SIDE, &fl_old); + hmf_old = TestMotorbikeHeight(item, BIKE_FRONT, STEP_SIZE / 2, &mtf_old); + hbl_old = TestMotorbikeHeight(item, -BIKE_FRONT, -BIKE_SIDE, &bl_old); + hbr_old = TestMotorbikeHeight(item, -BIKE_FRONT, STEP_SIZE / 2, &br_old); + hmtb_old = TestMotorbikeHeight(item, -BIKE_FRONT, 0, &mtb_old); oldpos.x = item->pos.xPos; oldpos.y = item->pos.yPos; @@ -685,7 +768,7 @@ static int MotorBikeDynamics(ITEM_INFO* item) rot = item->pos.yRot - motorbike->momentumAngle; momentum = MIN_MOMENTUM_TURN - ((2 * motorbike->velocity) / SECTOR(1)); - if (!(TrInput & IN_ACTION) && motorbike->velocity > 0) + if (!(TrInput & IN_ACCELERATE) && motorbike->velocity > 0) momentum += (momentum / 2); if (rot < -MAX_MOMENTUM_TURN) @@ -731,10 +814,10 @@ static int MotorBikeDynamics(ITEM_INFO* item) if (item->pos.yPos >= height) { - short anglex = 100 * phd_sin(item->pos.xRot); + short anglex = MOTORBIKE_SLIP * phd_sin(item->pos.xRot); if (abs(anglex) > 16) { - short anglex2 = 100 * phd_sin(item->pos.xRot); + short anglex2 = MOTORBIKE_SLIP * phd_sin(item->pos.xRot); if (anglex < 0) anglex2 = -anglex; if (anglex2 > 24) @@ -743,7 +826,7 @@ static int MotorBikeDynamics(ITEM_INFO* item) motorbike->velocity -= anglex; } - short anglez = 100 * phd_sin(item->pos.zRot); + short anglez = MOTORBIKE_SLIP * phd_sin(item->pos.zRot); if (abs(anglez) > 32) { short ang, angabs; @@ -758,42 +841,38 @@ static int MotorBikeDynamics(ITEM_INFO* item) } } - if (motorbike->velocity <= 0x8000 || motorbike->flags & 1) // boost + if (motorbike->velocity <= MOTORBIKE_ACCEL || motorbike->flags & FL_BOOST) { - if (motorbike->velocity <= 0xC000) + if (motorbike->velocity <= MOTORBIKE_ACCEL_MAX) { - if (motorbike->velocity < -0x3000) - motorbike->velocity = -0x3000; + if (motorbike->velocity < -MOTORBIKE_BIG_SLOWDOWN) + motorbike->velocity = -MOTORBIKE_BIG_SLOWDOWN; } else - { - motorbike->velocity = 0xC000; - } + motorbike->velocity = MOTORBIKE_ACCEL_MAX; } else - { - motorbike->velocity -= 1088; - } + motorbike->velocity -= MOTORBIKE_SLOWDOWN1; moved.x = item->pos.xPos; moved.z = item->pos.zPos; if (!(item->flags & ONESHOT)) { - //MotorBikeBaddieCollision(item); + MotorbikeBaddieCollision(item); //MotorBikeStaticCollision(item->pos.x, item->pos.y, item->pos.z, item->room_number, (WALL_L / 2)); } int rot1 = 0; int rot2 = 0; - int hfl = TestMotorbikeHeight(item, 500, -350, &fl); + int hfl = TestMotorbikeHeight(item, BIKE_FRONT, -BIKE_SIDE, &fl); if (hfl < fl_old.y - STEP_SIZE) { rot1 = abs(4 * DoMotorbikeShift(item, &fl, &fl_old)); } - int hbl = TestMotorbikeHeight(item, -500, -350, &bl); + int hbl = TestMotorbikeHeight(item, -BIKE_FRONT, -BIKE_SIDE, &bl); if (hbl < bl_old.y - STEP_SIZE) { if (rot1) @@ -802,15 +881,15 @@ static int MotorBikeDynamics(ITEM_INFO* item) rot1 -= abs(4 * DoMotorbikeShift(item, &bl, &bl_old)); } - int hmtf = TestMotorbikeHeight(item, 500, 128, &mtf); + int hmtf = TestMotorbikeHeight(item, BIKE_FRONT, STEP_SIZE / 2, &mtf); if (hmtf < mtf_old.y - STEP_SIZE) rot2 -= abs(4 * DoMotorbikeShift(item, &bl, &bl_old)); - int hmtb = TestMotorbikeHeight(item, -500, 0, &mtb); + int hmtb = TestMotorbikeHeight(item, -BIKE_FRONT, 0, &mtb); if (hmtb < mtb_old.y - STEP_SIZE) DoMotorbikeShift(item, &mtb, &mtb_old); - int hbr = TestMotorbikeHeight(item, -500, 128, &br); + int hbr = TestMotorbikeHeight(item, -BIKE_FRONT, STEP_SIZE / 2, &br); if (hbr < br_old.y - STEP_SIZE) { if (rot2) @@ -844,7 +923,7 @@ static int MotorBikeDynamics(ITEM_INFO* item) if (collide) { newspeed = ((item->pos.zPos - oldpos.z) * phd_cos(motorbike->momentumAngle) + (item->pos.xPos - oldpos.x) * phd_sin(motorbike->momentumAngle)) * 256; - if (&g_Level.Items[Lara.Vehicle] == item && motorbike->velocity >= 0x8000 && newspeed < (motorbike->velocity - 10)) + if (&g_Level.Items[Lara.Vehicle] == item && motorbike->velocity >= MOTORBIKE_ACCEL && newspeed < (motorbike->velocity - 10)) { LaraItem->hitPoints -= ((motorbike->velocity - newspeed) / 128); LaraItem->hitStatus = true; @@ -855,8 +934,8 @@ static int MotorBikeDynamics(ITEM_INFO* item) else if (motorbike->velocity < 0 && newspeed > motorbike->velocity) motorbike->velocity = (newspeed > 0) ? 0 : newspeed; - if (motorbike->velocity < -0x3000) - motorbike->velocity = -0x3000; + if (motorbike->velocity < -MOTORBIKE_BIG_SLOWDOWN) + motorbike->velocity = -MOTORBIKE_BIG_SLOWDOWN; } return collide; @@ -872,9 +951,9 @@ static BOOL MotorbikeCanGetOff(void) item = &g_Level.Items[Lara.Vehicle]; angle = item->pos.yRot + 0x4000; - x = item->pos.xPos + 500 * phd_sin(angle); + x = item->pos.xPos + BIKE_RADIUS * phd_sin(angle); y = item->pos.yPos; - z = item->pos.zPos + 500 * phd_cos(angle); + z = item->pos.zPos + BIKE_RADIUS * phd_cos(angle); room_number = item->roomNumber; floor = GetFloor(x, y, z, &room_number); @@ -916,92 +995,103 @@ static void AnimateMotorbike(ITEM_INFO* item, int collide, BOOL dead) { case BIKE_IDLE: if (dead) - { LaraItem->goalAnimState = BIKE_DEATH; - } - else if (!(TrInput & IN_JUMP) && !(TrInput & IN_RIGHT) || motorbike->velocity || NoGetOff) + else { - if (TrInput & IN_ACTION && !(TrInput & IN_JUMP)) - LaraItem->goalAnimState = BIKE_MOVING_FRONT; - else if (TrInput & IN_BACK) - LaraItem->goalAnimState = BIKE_MOVING_BACK; - } - else if (TrInput & IN_JUMP && TrInput & IN_RIGHT && MotorbikeCanGetOff()) - { - LaraItem->goalAnimState = BIKE_EXIT; + + bool dismount; + if ((TrInput & IN_TURNR) && (TrInput & IN_BRAKE)) + dismount = true; + else if (!((TrInput & IN_TURNR) && (TrInput & IN_BRAKE))) + dismount = false; + + if (!dismount || motorbike->velocity || NoGetOff) + { + if (TrInput & IN_ACCELERATE && !(TrInput & IN_BRAKE)) + LaraItem->goalAnimState = BIKE_MOVING_FRONT; + else if (TrInput & IN_REVERSE) + LaraItem->goalAnimState = BIKE_MOVING_BACK; + } + else if (dismount && MotorbikeCanGetOff()) + { + LaraItem->goalAnimState = BIKE_EXIT; + } + else + { + LaraItem->goalAnimState = BIKE_IDLE; + } } break; + case BIKE_MOVING_FRONT: if (dead) { - if (motorbike->velocity <= 0x4000) + if (motorbike->velocity <= MOTORBIKE_ACCEL_1) LaraItem->goalAnimState = BIKE_DEATH; else LaraItem->goalAnimState = BIKE_EMPTY5; } - else if (motorbike->velocity & -256 || TrInput & (IN_ACTION | IN_JUMP)) + else if (motorbike->velocity & -256 || TrInput & (IN_ACCELERATE | IN_BRAKE)) { - if (TrInput & IN_LEFT) - { + if (TrInput & IN_TURNL) LaraItem->goalAnimState = BIKE_MOVING_LEFT; - } - else if (TrInput & IN_RIGHT) - { + else if (TrInput & IN_TURNR) LaraItem->goalAnimState = BIKE_MOVING_RIGHT; - } - else if (TrInput & IN_JUMP) + else if (TrInput & IN_BRAKE) { if (motorbike->velocity <= 0x5554) LaraItem->goalAnimState = BIKE_EMPTY3; else LaraItem->goalAnimState = BIKE_STOP; } - else if (TrInput & IN_BACK && motorbike->velocity <= 0x800) - { + else if (TrInput & IN_REVERSE && motorbike->velocity <= MOTORBIKE_BACKING_VEL) LaraItem->goalAnimState = BIKE_MOVING_BACK; - } + else if (motorbike->velocity == 0) + LaraItem->goalAnimState = BIKE_IDLE; } else - { LaraItem->goalAnimState = BIKE_IDLE; - } break; + case BIKE_MOVING_LEFT: if (motorbike->velocity & -256) { - if (TrInput & IN_RIGHT || !(TrInput & IN_LEFT)) + if (TrInput & IN_TURNR || !(TrInput & IN_TURNL)) LaraItem->goalAnimState = BIKE_MOVING_FRONT; } else - { LaraItem->goalAnimState = BIKE_IDLE; - } + if (motorbike->velocity == 0) + LaraItem->goalAnimState = BIKE_IDLE; break; + case BIKE_MOVING_BACK: - if (!(TrInput & IN_BACK)) - LaraItem->goalAnimState = BIKE_IDLE; - else + if (TrInput & IN_REVERSE) LaraItem->goalAnimState = BIKE_MOVING_BACK_LOOP; + else + LaraItem->goalAnimState = BIKE_IDLE; break; + case BIKE_MOVING_RIGHT: if (motorbike->velocity & -256) { - if (TrInput & IN_LEFT || !(TrInput & IN_RIGHT)) + if (TrInput & IN_TURNL || !(TrInput & IN_TURNR)) LaraItem->goalAnimState = BIKE_MOVING_FRONT; } else - { LaraItem->goalAnimState = BIKE_IDLE; - } + if (motorbike->velocity == 0) + LaraItem->goalAnimState = BIKE_IDLE; break; + case BIKE_EMPTY3: case BIKE_STOP: case BIKE_ACCELERATE: if (motorbike->velocity & -256) { - if (TrInput & IN_LEFT) + if (TrInput & IN_TURNL) LaraItem->goalAnimState = BIKE_MOVING_LEFT; - else if (TrInput & IN_RIGHT) + if (TrInput & IN_TURNR) LaraItem->goalAnimState = BIKE_MOVING_RIGHT; } else @@ -1009,6 +1099,7 @@ static void AnimateMotorbike(ITEM_INFO* item, int collide, BOOL dead) LaraItem->goalAnimState = BIKE_IDLE; } break; + case BIKE_FALLING: if (item->pos.yPos == item->floor) { @@ -1024,44 +1115,48 @@ static void AnimateMotorbike(ITEM_INFO* item, int collide, BOOL dead) } } else if (item->fallspeed > 220) - { - motorbike->flags |= 0x40; - } + motorbike->flags |= FL_FALLING; break; + case BIKE_HITFRONT: case BIKE_HITBACK: case BIKE_HITRIGHT: case BIKE_HITLEFT: - if (TrInput & (IN_ACTION | IN_JUMP)) + if (TrInput & (IN_ACCELERATE | IN_BRAKE)) LaraItem->goalAnimState = BIKE_MOVING_FRONT; break; + } } else { switch (collide) { + case 13: - LaraItem->animNumber = Objects[ID_MOTORBIKE_LARA_ANIMS].animIndex + 12; + LaraItem->animNumber = Objects[ID_MOTORBIKE_LARA_ANIMS].animIndex + BA_BACK_HIT; LaraItem->currentAnimState = BIKE_HITBACK; LaraItem->goalAnimState = BIKE_HITBACK; LaraItem->frameNumber = g_Level.Anims[LaraItem->animNumber].frameBase; break; + case 14: - LaraItem->animNumber = Objects[ID_MOTORBIKE_LARA_ANIMS].animIndex + 11; + LaraItem->animNumber = Objects[ID_MOTORBIKE_LARA_ANIMS].animIndex + BA_FRONT_HIT; LaraItem->currentAnimState = BIKE_HITFRONT; LaraItem->goalAnimState = BIKE_HITFRONT; LaraItem->frameNumber = g_Level.Anims[LaraItem->animNumber].frameBase; break; + case 11: - LaraItem->animNumber = Objects[ID_MOTORBIKE_LARA_ANIMS].animIndex + 14; + LaraItem->animNumber = Objects[ID_MOTORBIKE_LARA_ANIMS].animIndex + BA_RIGHT_HIT; LaraItem->currentAnimState = BIKE_HITRIGHT; LaraItem->goalAnimState = BIKE_HITRIGHT; LaraItem->frameNumber = g_Level.Anims[LaraItem->animNumber].frameBase; break; + default: case 12: - LaraItem->animNumber = Objects[ID_MOTORBIKE_LARA_ANIMS].animIndex + 13; + LaraItem->animNumber = Objects[ID_MOTORBIKE_LARA_ANIMS].animIndex + BA_LEFT_HIT; LaraItem->currentAnimState = BIKE_HITLEFT; LaraItem->goalAnimState = BIKE_HITLEFT; LaraItem->frameNumber = g_Level.Anims[LaraItem->animNumber].frameBase; @@ -1072,9 +1167,9 @@ static void AnimateMotorbike(ITEM_INFO* item, int collide, BOOL dead) else { if (motorbike->velocity >= 0) - LaraItem->animNumber = Objects[ID_MOTORBIKE_LARA_ANIMS].animIndex + 22; + LaraItem->animNumber = Objects[ID_MOTORBIKE_LARA_ANIMS].animIndex + BA_START_JUMP; else - LaraItem->animNumber = Objects[ID_MOTORBIKE_LARA_ANIMS].animIndex + 6; + LaraItem->animNumber = Objects[ID_MOTORBIKE_LARA_ANIMS].animIndex + BA_START_FALL; LaraItem->frameNumber = g_Level.Anims[LaraItem->animNumber].frameBase; LaraItem->currentAnimState = BIKE_FALLING; LaraItem->goalAnimState = BIKE_FALLING; @@ -1083,7 +1178,6 @@ static void AnimateMotorbike(ITEM_INFO* item, int collide, BOOL dead) if (g_Level.Rooms[item->roomNumber].flags & (ENV_FLAG_WATER|ENV_FLAG_SWAMP)) { LaraItem->goalAnimState = BIKE_EMPTY6; - LaraItem->hitPoints = 0; MotorBikeExplode(item); } } @@ -1113,50 +1207,56 @@ static int MotorbikeUserControl(ITEM_INFO* item, int height, int* pitch) motorbike->revs = 0; } - if ((TrInput & IN_SPRINT) && (TrInput & IN_ACTION) && DashTimer) + if ((TrInput & IN_TURBO) && (TrInput & IN_ACCELERATE) && DashTimer) { - motorbike->flags |= 0x1; + motorbike->flags |= FL_BOOST; DashTimer -= 2; - if (DashTimer > 0x8000) + if (DashTimer > MOTORBIKE_ACCEL)//hmm { - motorbike->flags &= ~0x1; + motorbike->flags &= ~FL_BOOST; DashTimer = 0; } } else - { - motorbike->flags &= ~0x1; - } + motorbike->flags &= ~FL_BOOST; if (item->pos.yPos >= (height - STEP_SIZE)) { if (!motorbike->velocity && (TrInput & IN_LOOK)) - LookUpDown(); // not used since it ignore the vehicle (lara.skidoo == NO_ITEM) !! + LookUpDown(); if (motorbike->velocity > 0) { - if (TrInput & IN_LEFT) + if (TrInput & IN_TURNL) { - motorbike->bikeTurn -= motorbike->velocity <= MOTORBIKE_ACCEL_1 ? ONE_DEGREE - MOTORBIKE_HTURN * motorbike->velocity / 16384 : MOTORBIKE_DEFAULT_HTURN; + if (motorbike->velocity > MOTORBIKE_ACCEL_1) + motorbike->bikeTurn -= MOTORBIKE_DEFAULT_HTURN; + else + motorbike->bikeTurn -= (ANGLE(1) - MOTORBIKE_HTURN * motorbike->velocity) / 16384; + if (motorbike->bikeTurn < -MOTORBIKE_MAX_HTURN) motorbike->bikeTurn = -MOTORBIKE_MAX_HTURN; } - else if (TrInput & IN_RIGHT) + else if (TrInput & IN_TURNR) { - motorbike->bikeTurn += motorbike->velocity <= MOTORBIKE_ACCEL_1 ? ONE_DEGREE + MOTORBIKE_HTURN * motorbike->velocity / 16384 : MOTORBIKE_DEFAULT_HTURN; + if (motorbike->velocity > MOTORBIKE_ACCEL_1) + motorbike->bikeTurn += MOTORBIKE_DEFAULT_HTURN; + else + motorbike->bikeTurn += (ANGLE(1) + MOTORBIKE_HTURN * motorbike->velocity) / 16384; + if (motorbike->bikeTurn > MOTORBIKE_MAX_HTURN) motorbike->bikeTurn = MOTORBIKE_MAX_HTURN; } } - else if (motorbike->velocity < 0) + else if (motorbike->velocity < 0)//moving backwards so the turning is inverted { - if (TrInput & IN_LEFT) + if (TrInput & IN_TURNL) { motorbike->bikeTurn += MOTORBIKE_HTURN; if (motorbike->bikeTurn > MOTORBIKE_MAX_HTURN) motorbike->bikeTurn = MOTORBIKE_MAX_HTURN; } - else if (TrInput & IN_RIGHT) + else if (TrInput & IN_TURNR) { motorbike->bikeTurn -= MOTORBIKE_HTURN; if (motorbike->bikeTurn < -MOTORBIKE_MAX_HTURN) @@ -1164,7 +1264,7 @@ static int MotorbikeUserControl(ITEM_INFO* item, int height, int* pitch) } } - if (TrInput & IN_JUMP) + if (TrInput & IN_BRAKE) { pos.x = 0; pos.y = -144; @@ -1178,7 +1278,7 @@ static int MotorbikeUserControl(ITEM_INFO* item, int height, int* pitch) item->meshBits = 0x3F7; } - if (TrInput & IN_JUMP) + if (TrInput & IN_BRAKE) { if (motorbike->velocity < 0) { @@ -1193,18 +1293,18 @@ static int MotorbikeUserControl(ITEM_INFO* item, int height, int* pitch) motorbike->velocity = 0; } } - else if (TrInput & IN_ACTION) + else if (TrInput & IN_ACCELERATE) { if (motorbike->velocity < MOTORBIKE_ACCEL_MAX) { if (motorbike->velocity < MOTORBIKE_ACCEL_1) - motorbike->velocity += 8 + ((MOTORBIKE_ACCEL_1 + 0x800 - motorbike->velocity) / 8); + motorbike->velocity += 8 + ((MOTORBIKE_ACCEL_1 + MOTORBIKE_BACKING_VEL - motorbike->velocity) / 8); else if (motorbike->velocity < MOTORBIKE_ACCEL_2) - motorbike->velocity += 4 + ((MOTORBIKE_ACCEL_2 + 0x800 - motorbike->velocity) / 16); + motorbike->velocity += 4 + ((MOTORBIKE_ACCEL_2 + MOTORBIKE_BACKING_VEL - motorbike->velocity) / 16); else if (motorbike->velocity < MOTORBIKE_ACCEL_MAX) motorbike->velocity += 2 + ((MOTORBIKE_ACCEL_MAX - motorbike->velocity) / 16); - if (motorbike->flags & 1) + if (motorbike->flags & FL_BOOST) motorbike->velocity += 256; } else @@ -1218,15 +1318,17 @@ static int MotorbikeUserControl(ITEM_INFO* item, int height, int* pitch) else if (motorbike->velocity > MOTORBIKE_FRICTION) { motorbike->velocity -= MOTORBIKE_FRICTION; + if (motorbike->velocity < 0) + motorbike->velocity = 0;//because bitch. } else if (motorbike->velocity < MOTORBIKE_FRICTION) { motorbike->velocity += MOTORBIKE_FRICTION; + if (motorbike->velocity > 0) + motorbike->velocity = 0;//because bitch. } else - { motorbike->velocity = 0; - } if (LaraItem->currentAnimState == BIKE_MOVING_BACK) { @@ -1235,8 +1337,8 @@ static int MotorbikeUserControl(ITEM_INFO* item, int height, int* pitch) if (framenow >= framebase + 24 && framenow <= framebase + 29) { - if (motorbike->velocity > -0x3000) - motorbike->velocity -= 0x600; + if (motorbike->velocity > -MOTORBIKE_BIG_SLOWDOWN) + motorbike->velocity -= MOTORBIKE_SLOWDOWN2; } } @@ -1261,20 +1363,20 @@ static int MotorbikeUserControl(ITEM_INFO* item, int height, int* pitch) return drive; } -void SetLaraOnMotorBike(ITEM_INFO* item, ITEM_INFO* laraitem) +void SetLaraOnMotorBike(ITEM_INFO* item, ITEM_INFO* lara)//is this function even used { MOTORBIKE_INFO* motorbike; motorbike = GetMotorbikeInfo(item); Lara.gunStatus = LG_HANDS_BUSY; Lara.hitDirection = -1; - laraitem->currentAnimState = BIKE_IDLE; - laraitem->goalAnimState = BIKE_IDLE; - laraitem->animNumber = Objects[ID_MOTORBIKE_LARA_ANIMS].animIndex + BIKE_IDLE_ANIM; - laraitem->frameNumber = g_Level.Anims[laraitem->animNumber].frameBase; - laraitem->gravityStatus = false; - item->animNumber = laraitem->animNumber + (Objects[ID_MOTORBIKE].animIndex - Objects[ID_MOTORBIKE_LARA_ANIMS].animIndex); - item->frameNumber = laraitem->frameNumber + (g_Level.Anims[ID_MOTORBIKE].frameBase - g_Level.Anims[ID_MOTORBIKE_LARA_ANIMS].frameBase); + lara->currentAnimState = BIKE_IDLE; + lara->goalAnimState = BIKE_IDLE; + lara->animNumber = Objects[ID_MOTORBIKE_LARA_ANIMS].animIndex + BA_IDLE; + lara->frameNumber = g_Level.Anims[lara->animNumber].frameBase; + lara->gravityStatus = false; + item->animNumber = lara->animNumber + (Objects[ID_MOTORBIKE].animIndex - Objects[ID_MOTORBIKE_LARA_ANIMS].animIndex); + item->frameNumber = lara->frameNumber + (g_Level.Anims[ID_MOTORBIKE].frameBase - g_Level.Anims[ID_MOTORBIKE_LARA_ANIMS].frameBase); item->hitPoints = 1; item->flags = short(IFLAG_KILLED); // hmm... maybe wrong name (it can be IFLAG_CODEBITS) ? motorbike->revs = 0; @@ -1286,7 +1388,7 @@ int MotorbikeControl(void) MOTORBIKE_INFO* motorbike; FLOOR_INFO* floor; PHD_VECTOR oldpos, fl, fr, fm; - int drive, collide, pitch = 0, dead, height = 0, ceiling; + int drive, collide, pitch = 0, dead, ceiling; short room_number; item = &g_Level.Items[Lara.Vehicle]; @@ -1298,13 +1400,13 @@ int MotorbikeControl(void) oldpos.y = item->pos.yPos; oldpos.z = item->pos.zPos; - int hfl = TestMotorbikeHeight(item, 500, -350, &fl); - int hfr = TestMotorbikeHeight(item, 500, 128, &fr); - int hfm = TestMotorbikeHeight(item, -500, 0, &fm); + int hfl = TestMotorbikeHeight(item, BIKE_FRONT, -BIKE_SIDE, &fl); + int hfr = TestMotorbikeHeight(item, BIKE_FRONT, STEP_SIZE / 2, &fr); + int hfm = TestMotorbikeHeight(item, -BIKE_FRONT, 0, &fm); room_number = item->roomNumber; floor = GetFloor(item->pos.xPos, item->pos.yPos, item->pos.zPos, &room_number); - height = GetFloorHeight(floor, item->pos.xPos, item->pos.yPos, item->pos.zPos); + int height = GetFloorHeight(floor, item->pos.xPos, item->pos.yPos, item->pos.zPos); TestTriggers(TriggerIndex, FALSE, FALSE); TestTriggers(TriggerIndex, TRUE, FALSE); @@ -1315,21 +1417,15 @@ int MotorbikeControl(void) dead = true; } else - { dead = false; - } if (motorbike->flags) - { collide = 0; - } else { DrawMotorbikeLight(item); if (LaraItem->currentAnimState < BIKE_ENTER || LaraItem->currentAnimState > BIKE_EXIT) - { drive = MotorbikeUserControl(item, height, &pitch); - } else { drive = -1; @@ -1341,10 +1437,11 @@ int MotorbikeControl(void) { motorbike->pitch = pitch; - if (motorbike->pitch < -0x8000) - motorbike->pitch = -0x8000; - else if (motorbike->pitch > 0xA000) - motorbike->pitch = 0xA000; + if (motorbike->pitch < -MOTORBIKE_PITCH_SLOWDOWN) + motorbike->pitch = -MOTORBIKE_PITCH_SLOWDOWN; + else + if (motorbike->pitch > MOTORBIKE_PITCH_MAX) + motorbike->pitch = MOTORBIKE_PITCH_MAX; SoundEffect(SFX_TR4_BIKE_MOVING, &item->pos, (motorbike->pitch * 256) + 0x1000004); } @@ -1375,23 +1472,23 @@ int MotorbikeControl(void) if (r1 >= ((hfl + hfr) / 2)) { xrot = phd_atan(1000, hfm - r1); - zrot = phd_atan(350, r2 - fl.y); + zrot = phd_atan(BIKE_SIDE, r2 - fl.y); } else { - xrot = phd_atan(500, hfm - item->pos.yPos); - zrot = phd_atan(350, r2 - fl.y); + xrot = phd_atan(BIKE_FRONT, hfm - item->pos.yPos); + zrot = phd_atan(BIKE_SIDE, r2 - fl.y); } } else if (r1 >= ((hfl + hfr) / 2)) { - xrot = phd_atan(500, item->pos.yPos - r1); - zrot = phd_atan(350, r2 - fl.y); + xrot = phd_atan(BIKE_FRONT, item->pos.yPos - r1); + zrot = phd_atan(BIKE_SIDE, r2 - fl.y); } else { xrot = phd_atan(125, newy - item->pos.yPos); - zrot = phd_atan(350, r2 - fl.y); + zrot = phd_atan(BIKE_SIDE, r2 - fl.y); } item->pos.xRot += ((xrot - item->pos.xRot) / 4); @@ -1404,24 +1501,27 @@ int MotorbikeControl(void) ItemNewRoom(Lara.Vehicle, room_number); ItemNewRoom(Lara.itemNumber, room_number); } + LaraItem->pos.xPos = item->pos.xPos; LaraItem->pos.yPos = item->pos.yPos; LaraItem->pos.zPos = item->pos.zPos; LaraItem->pos.yRot = item->pos.yRot; LaraItem->pos.xRot = item->pos.xRot; LaraItem->pos.zRot = item->pos.zRot; + AnimateMotorbike(item, collide, dead); AnimateItem(LaraItem); + item->animNumber = LaraItem->animNumber + (Objects[ID_MOTORBIKE].animIndex - Objects[ID_MOTORBIKE_LARA_ANIMS].animIndex); item->frameNumber = LaraItem->frameNumber + (g_Level.Anims[item->animNumber].frameBase - g_Level.Anims[LaraItem->animNumber].frameBase); + Camera.targetElevation = -5460; - if (motorbike->flags & 0x40) // IS_FALLING + if (motorbike->flags & FL_FALLING) { if (item->pos.yPos == item->floor) { ExplodingDeath(Lara.itemNumber, -1, 256); - LaraItem->hitPoints = 0; LaraItem->flags = ONESHOT; MotorBikeExplode(item); return 0; @@ -1429,13 +1529,15 @@ int MotorbikeControl(void) } } - if (LaraItem->currentAnimState == BIKE_ENTER || LaraItem->currentAnimState == BIKE_EXIT) + if (LaraItem->currentAnimState == BIKE_EXIT) { ExhaustStart = false; - return MotorBikeCheckGetOff(); + MotorBikeCheckGetOff(); + return 1; } - return MotorBikeCheckGetOff(); + MotorBikeCheckGetOff(); + return 1; } void DrawMotorbike(ITEM_INFO* item) From 6d0557c6679c31e379ca7c073f86e38943098ed0 Mon Sep 17 00:00:00 2001 From: Raildex Date: Thu, 21 Jan 2021 19:35:57 +0100 Subject: [PATCH 08/23] Fixing Jeep wheels (and potentially Motorbike) --- TR5Main/Objects/TR4/Vehicles/jeep.cpp | 21 +--------- TR5Main/Objects/TR4/Vehicles/jeep.h | 20 +++++++++- TR5Main/Renderer/Render11Helper.cpp | 56 ++++++++++++++++++++------- 3 files changed, 61 insertions(+), 36 deletions(-) diff --git a/TR5Main/Objects/TR4/Vehicles/jeep.cpp b/TR5Main/Objects/TR4/Vehicles/jeep.cpp index bd056d78b..3c7e19511 100644 --- a/TR5Main/Objects/TR4/Vehicles/jeep.cpp +++ b/TR5Main/Objects/TR4/Vehicles/jeep.cpp @@ -16,26 +16,7 @@ #include "setup.h" #include "level.h" using std::vector; -typedef struct JEEP_INFO -{ - short rot1; - short rot2; - short rot3; - short rot4; - int velocity; - int revs; - short engineRevs; - short trackMesh; - int jeepTurn; - int fallSpeed; - short momentumAngle; - short extraRotation; - short unknown0; - int pitch; - short flags; - short unknown1; - short unknown2; -}; + #define JF_FALLING 0x40 #define JF_DEAD 0x80 diff --git a/TR5Main/Objects/TR4/Vehicles/jeep.h b/TR5Main/Objects/TR4/Vehicles/jeep.h index 6af38ddb6..69490f9f2 100644 --- a/TR5Main/Objects/TR4/Vehicles/jeep.h +++ b/TR5Main/Objects/TR4/Vehicles/jeep.h @@ -1,7 +1,25 @@ #pragma once #include "items.h" #include "collide.h" - +struct JEEP_INFO { + short rot1; + short rot2; + short rot3; + short rot4; + int velocity; + int revs; + short engineRevs; + short trackMesh; + int jeepTurn; + int fallSpeed; + short momentumAngle; + short extraRotation; + short unknown0; + int pitch; + short flags; + short unknown1; + short unknown2; +}; void InitialiseJeep(short itemNumber); void JeepCollision(short itemNumber, ITEM_INFO* l, COLL_INFO* coll); int JeepControl(void); \ No newline at end of file diff --git a/TR5Main/Renderer/Render11Helper.cpp b/TR5Main/Renderer/Render11Helper.cpp index ee0c2610c..491da1064 100644 --- a/TR5Main/Renderer/Render11Helper.cpp +++ b/TR5Main/Renderer/Render11Helper.cpp @@ -9,11 +9,13 @@ #include "lara.h" #include "sphere.h" #include "GameFlowScript.h" -#include +#include "Renderer\RenderView\RenderView.h" #include "quad.h" #include "rubberboat.h" #include "upv.h" #include "biggun.h" +#include "jeep.h" +#include "motorbike.h" #include extern GameConfiguration g_Configuration; @@ -286,15 +288,44 @@ namespace T5M::Renderer if (item->objectNumber == ID_QUAD) { QUAD_INFO* quad = (QUAD_INFO*)item->data; - if (j == 3 || j == 4) - { + if (j == 3 || j == 4) { currentBone->ExtraRotation.x = TO_RAD(quad->rearRot); } - else if (j == 6 || j == 7) - { + else if (j == 6 || j == 7) { currentBone->ExtraRotation.x = TO_RAD(quad->frontRot); } } + else if (item->objectNumber == ID_JEEP) { + JEEP_INFO* jeep = (JEEP_INFO*)item->data; + switch (j) { + case 9: + currentBone->ExtraRotation.x = TO_RAD(jeep->rot1); + break; + case 10: + currentBone->ExtraRotation.x = TO_RAD(jeep->rot2); + + break; + case 12: + currentBone->ExtraRotation.x = TO_RAD(jeep->rot3); + + break; + case 13: + currentBone->ExtraRotation.x = TO_RAD(jeep->rot4); + + break; + } + } + else if (item->objectNumber == ID_MOTORBIKE) { + MOTORBIKE_INFO* bike = (MOTORBIKE_INFO*)item->data; + switch (j) { + case 2: + case 4: + currentBone->ExtraRotation.x = TO_RAD(bike->wheelRight); + break; + case 10: + currentBone->ExtraRotation.x = TO_RAD(bike->wheelLeft); + } + } else if (item->objectNumber == ID_RUBBER_BOAT) { RUBBER_BOAT_INFO* boat = (RUBBER_BOAT_INFO*)item->data; @@ -353,8 +384,7 @@ namespace T5M::Renderer itemToDraw->DoneAnimations = true; } - void Renderer11::updateItemsAnimations(RenderView& view) - { + void Renderer11::updateItemsAnimations(RenderView& view) { Matrix translation; Matrix rotation; @@ -372,8 +402,7 @@ namespace T5M::Renderer } } - void Renderer11::fromTrAngle(Matrix *matrix, short *frameptr, int index) - { + void Renderer11::fromTrAngle(Matrix *matrix, short *frameptr, int index) { short *ptr = &frameptr[0]; ptr += 9; @@ -417,8 +446,7 @@ namespace T5M::Renderer } } - void Renderer11::buildHierarchyRecursive(RendererObject *obj, RendererBone *node, RendererBone *parentNode) - { + void Renderer11::buildHierarchyRecursive(RendererObject *obj, RendererBone *node, RendererBone *parentNode) { node->GlobalTransform = node->Transform * parentNode->GlobalTransform; obj->BindPoseTransforms[node->Index] = node->GlobalTransform; obj->Skeleton->GlobalTranslation = Vector3(0.0f, 0.0f, 0.0f); @@ -430,8 +458,7 @@ namespace T5M::Renderer } } - void Renderer11::buildHierarchy(RendererObject *obj) - { + void Renderer11::buildHierarchy(RendererObject *obj) { obj->Skeleton->GlobalTransform = obj->Skeleton->Transform; obj->BindPoseTransforms[obj->Skeleton->Index] = obj->Skeleton->GlobalTransform; obj->Skeleton->GlobalTranslation = Vector3(0.0f, 0.0f, 0.0f); @@ -442,8 +469,7 @@ namespace T5M::Renderer } } - RendererMesh *Renderer11::getRendererMeshFromTrMesh(RendererObject *obj, MESH *meshPtr, short boneIndex, int isJoints, int isHairs) - { + RendererMesh *Renderer11::getRendererMeshFromTrMesh(RendererObject *obj, MESH *meshPtr, short boneIndex, int isJoints, int isHairs) { RendererMesh *mesh = new RendererMesh(); mesh->Sphere = meshPtr->sphere; From cfe4e9c250b1b14ed89317f99749888e76fd55c4 Mon Sep 17 00:00:00 2001 From: Trxye Date: Sun, 24 Jan 2021 12:53:08 -0600 Subject: [PATCH 09/23] jeep fixing part 1 --- TR5Main/Objects/TR4/Vehicles/jeep.cpp | 657 ++++++++++++-------------- TR5Main/TR5Main.vcxproj.user | 3 +- 2 files changed, 303 insertions(+), 357 deletions(-) diff --git a/TR5Main/Objects/TR4/Vehicles/jeep.cpp b/TR5Main/Objects/TR4/Vehicles/jeep.cpp index bd056d78b..4f6b3d2d1 100644 --- a/TR5Main/Objects/TR4/Vehicles/jeep.cpp +++ b/TR5Main/Objects/TR4/Vehicles/jeep.cpp @@ -37,26 +37,89 @@ typedef struct JEEP_INFO short unknown2; }; -#define JF_FALLING 0x40 -#define JF_DEAD 0x80 +enum JEEP_STATES +{ + JS_STOP = 0, + JS_DRIVE_FORWARD = 1, + //2 3 4 5 are the collide with walls states + JS_BRAKE = 6,//? + JS_FWD_LEFT = 7,//FWD = forwards + JS_FWD_RIGHT = 8, + JS_GETIN = 9, + JS_GETOFF = 10, + JS_JUMP = 11, + JS_LAND = 12, + JS_BACK = 13,//when she's turning back, and when idle back.. hmm + JS_BACK_LEFT = 14, + JS_BACK_RIGHT = 15, + JS_DEATH = 16, + JS_DRIVE_BACK = 17 +}; + +enum JEEP_ANIMS +{ + JA_DEATH = 0, + JA_BRAKE = 1, + JA_DRIVE_FORWARD = 2, + JA_FWD_LEFT_START = 3,//FWD = forwards + JA_FWD_LEFT = 4, + JA_FWD_LEFT_END = 5, + JA_FWD_JUMP_START = 6, + JA_JUMP = 7, + JA_FWD_JUMP_LAND = 8, + JA_GETIN_RIGHT = 9, + //10 11 12 13 are the collide with walls anims + JA_IDLE = 14, + JA_FWD_RIGHT_START = 15, + JA_FWD_RIGHT = 16, + JA_FWD_RIGHT_END = 17, + JA_GETIN_LEFT = 18, + JA_GETOFF = 19, + JA_BACK_JUMP_START = 20, + JA_BACK_JUMP = 21, + JA_BACK_JUMP_LAND = 22, + JA_REVERSE_START = 23, + JA_REVERSE = 24, + JA_REVERSE_END = 25, //aka turn head back forwards + JA_BACK_RIGHT_START = 26, + JA_BACK_RIGHT = 27, + JA_BACK_RIGHT_END = 28, + JA_BACK_LEFT_START = 29, + JA_BACK_LEFT = 30, + JA_BACK_LEFT_END = 31, + JA_IDLE_RIGHT_START = 32,//turn steering whel right while idle + JA_IDLE_LEFT_START = 33,// blah blah left while idle + JA_IDLE_RIGHT_END = 34,//turn steering wheel straight from right while idle + JA_IDLE_LEFT_END = 35,//blah blah straight from left while idle + JA_IDLE_RIGHT_BACK_START = 36,//same as 32 but in reverse + JA_IDLE_LEFT_BACK_START = 37,//same as 33 but in reverse + JA_IDLE_BACK_RIGHT_END = 38,//same as 34 but in reverse + JA_IDLE_BACK_LEFT_END = 39,//same as 35 but in reverse + JA_IDLE_REVERSE_RIGHT = 40,//"change to reverse gear with the wheels still turned left" + JA_IDLE_REVERSE_LEFT = 41,//"change to reverse gear with the wheels still turned right" + JA_BACK_IDLE = 42, + JA_IDLE_FWD_LEFT = 43,//aka the opposite of 41. "change to forward gear with the wheels still turned left" + JA_IDLE_FWD_RIGHT = 44,//aka the opposite of 42. "change to forward gear with the wheels still turned right" +}; + +enum JEEP_FLAGS +{ + JF_FALLING = 0x40, + JF_DEAD = 0x80 +}; #define JEEP_GETOFF_DISTANCE 512 #define JEEP_UNDO_TURN 91 +#define JEEP_FRONT 550 +#define JEEP_SIDE 256 #define JEEP_SLIP 100 #define JEEP_SLIP_SIDE 128 #define JEEP_MAX_SPEED 0x8000 #define JEEP_MAX_BACK 0x4000 -#define JEEP_LS_STOP 0 - -#define JEEP_LS_GETON 9 -#define JEEP_LS_GETOFF 10 -#define JEEP_LS_JEEPDEATH 16 #define JEEP_IN_ACCELERATE (IN_ACTION) #define JEEP_IN_BRAKE (IN_JUMP) -#define JEEP_IN_DISMOUNT (IN_JUMP|IN_LEFT) -#define JEEP_IN_HANDBRAKE (IN_SPRINT|IN_DUCK) //bool QuadHandbrakeStarting; //bool QuadCanHandbrakeStart; @@ -189,47 +252,40 @@ static int DoJeepDynamics(int height, int speed, int* y, int flags) { int result = 0; - if (height <= *y) + if (height <= *y)//on the floor { if (flags) - { result = speed; - } else { int temp = height - *y; + if (temp < -80) - { temp = -80; - } + result = ((temp - speed) / 16) + speed; + if (*y > height) - { *y = height; - } } } - else + else//mid air { *y += speed; if (*y <= height - 32) { if (flags) - { result = flags + (flags / 2) + speed; - } else - { result = speed + GRAVITY; - } } else { *y = height; + if (speed > 150) - { LaraItem->hitPoints += 150 - speed; - } + result = 0; } } @@ -358,7 +414,7 @@ void InitialiseJeep(short itemNum) static int JeepCheckGetOff() { - if (LaraItem->currentAnimState == 10) + if (LaraItem->currentAnimState == JS_GETOFF) { if (LaraItem->frameNumber == g_Level.Anims[LaraItem->animNumber].frameEnd) { @@ -376,7 +432,6 @@ static int JeepCheckGetOff() CurrentAtmosphere = 110; IsAtmospherePlaying = true; S_CDPlay(110, 1); - return false; } } @@ -389,44 +444,28 @@ static int GetOnJeep(int itemNumber) ITEM_INFO* item = &g_Level.Items[itemNumber]; if (!(TrInput & IN_ACTION) && g_Inventory.GetSelectedObject() != ID_PUZZLE_ITEM1) - { return 0; - } if (item->flags & 0x100) - { return 0; - } if (Lara.gunStatus) - { return 0; - } if (LaraItem->currentAnimState != LS_STOP) - { return 0; - } if (LaraItem->animNumber != LA_STAND_IDLE) - { return 0; - } if (LaraItem->gravityStatus) - { return 0; - } - if (abs(item->pos.yPos - LaraItem->pos.yPos) >= 256) - { + if (abs(item->pos.yPos - LaraItem->pos.yPos) >= STEP_SIZE) return 0; - } if (!TestBoundsCollide(item, LaraItem, 100)) - { return 0; - } short roomNumber = item->roomNumber; FLOOR_INFO* floor = GetFloor(item->pos.xPos, item->pos.yPos, item->pos.zPos, &roomNumber); @@ -476,12 +515,16 @@ static int GetOnJeep(int itemNumber) else return 0; } - return 0; } static int GetJeepCollisionAnim(ITEM_INFO* item, PHD_VECTOR* p) { + JEEP_INFO* jeep = (JEEP_INFO*)item->data; + + if (jeep->unknown2 != 0) + return 0; + p->x = item->pos.xPos - p->x; p->z = item->pos.zPos - p->z; @@ -493,13 +536,9 @@ static int GetJeepCollisionAnim(ITEM_INFO* item, PHD_VECTOR* p) int side = -p->z * s + p->x * c; if (abs(front) > abs(side)) - { return (front > 0) + 13; - } else - { return (side <= 0) + 11; - } } return 0; @@ -565,7 +604,7 @@ static void JeepBaddieCollision(ITEM_INFO* jeep) } else { - if (TestBoundsCollide(item, jeep, 550)) + if (TestBoundsCollide(item, jeep, JEEP_FRONT)) { DoLotsOfBlood(item->pos.xPos, jeep->pos.yPos - STEP_SIZE, @@ -609,17 +648,17 @@ static void JeepExplode(ITEM_INFO* item) Lara.Vehicle = NO_ITEM; } -static int JeepDynamics(ITEM_INFO* item) +int JeepDynamics(ITEM_INFO* item) { JEEP_INFO* jeep = (JEEP_INFO*)item->data; PHD_VECTOR f_old, b_old, mm_old, mt_old, mb_old; - int hf_old = TestJeepHeight(item, 550, -256, &f_old); - int hb_old = TestJeepHeight(item, 550, 256,&b_old); - int hmm_old = TestJeepHeight(item, -600, -256, &mm_old); - int hmt_old = TestJeepHeight(item, -600, 256, &mt_old); - int hmb_old = TestJeepHeight(item, -600, 0, (PHD_VECTOR*)&mb_old); + int hf_old = TestJeepHeight(item, JEEP_FRONT, -JEEP_SIDE, &f_old); + int hb_old = TestJeepHeight(item, JEEP_FRONT, JEEP_SIDE, &b_old); + int hmm_old = TestJeepHeight(item, -(JEEP_FRONT + 50), -JEEP_SIDE, &mm_old); + int hmt_old = TestJeepHeight(item, -(JEEP_FRONT + 50), JEEP_SIDE, &mt_old); + int hmb_old = TestJeepHeight(item, -(JEEP_FRONT + 50), 0, (PHD_VECTOR*)&mb_old); PHD_VECTOR oldPos; oldPos.x = item->pos.xPos; @@ -641,10 +680,10 @@ static int JeepDynamics(ITEM_INFO* item) if (oldPos.y <= item->floor - 8 ) { - if (jeep->jeepTurn < -91) - jeep->jeepTurn += 91; - else if (jeep->jeepTurn > 91) - jeep->jeepTurn -= 91; + if (jeep->jeepTurn < -JEEP_UNDO_TURN) + jeep->jeepTurn += JEEP_UNDO_TURN; + else if (jeep->jeepTurn > JEEP_UNDO_TURN) + jeep->jeepTurn -= JEEP_UNDO_TURN; else jeep->jeepTurn = 0; @@ -735,6 +774,8 @@ static int JeepDynamics(ITEM_INFO* item) slip = (SQUARE(slip + 16) / 2) + jeep->velocity; jeep->velocity = slip; } + else + JeepNoGetOff = 0; slip = JEEP_SLIP_SIDE * phd_sin(item->pos.zRot); if (abs(slip) > JEEP_SLIP_SIDE / 4) @@ -752,6 +793,8 @@ static int JeepDynamics(ITEM_INFO* item) item->pos.zPos += (slip - 24) * phd_cos(item->pos.yRot - ANGLE(90)); } } + else + JeepNoGetOff = 0; } if (jeep->velocity > JEEP_MAX_SPEED) @@ -774,11 +817,11 @@ static int JeepDynamics(ITEM_INFO* item) int rot1 = 0; int rot2 = 0; - int hf = TestJeepHeight(item, 550, -256, (PHD_VECTOR*)&f); + int hf = TestJeepHeight(item, JEEP_FRONT, -JEEP_SIDE, (PHD_VECTOR*)&f); if (hf < f_old.y - STEP_SIZE) rot1 = abs(4 * DoJeepShift(item, &f, &f_old)); - int hmm = TestJeepHeight(item, -600, -256, (PHD_VECTOR*)&mm); + int hmm = TestJeepHeight(item, -(JEEP_FRONT + 50), -JEEP_SIDE, (PHD_VECTOR*)&mm); if (hmm < mm_old.y - STEP_SIZE) { if (rot) @@ -787,15 +830,15 @@ static int JeepDynamics(ITEM_INFO* item) rot1 = -abs(4 * DoJeepShift(item, &mm, &mm_old)); } - int hb = TestJeepHeight(item, 550, 256, (PHD_VECTOR*)&b); + int hb = TestJeepHeight(item, JEEP_FRONT, JEEP_SIDE, (PHD_VECTOR*)&b); if (hb < b_old.y - STEP_SIZE) rot2 = -abs(4 * DoJeepShift(item, &b, &b_old)); - int hmb = TestJeepHeight(item, -600, 0, (PHD_VECTOR*)&mb); + int hmb = TestJeepHeight(item, -(JEEP_FRONT + 50), 0, (PHD_VECTOR*)&mb); if (hmb < mb_old.y - STEP_SIZE) DoJeepShift(item, &mb, &mb_old); - int hmt = TestJeepHeight(item, -600, 256, (PHD_VECTOR*)&mt); + int hmt = TestJeepHeight(item, -(JEEP_FRONT + 50), JEEP_SIDE, (PHD_VECTOR*)&mt); if (hmt < mt_old.y - STEP_SIZE) { if (rot2) @@ -842,10 +885,10 @@ static int JeepDynamics(ITEM_INFO* item) } if (jeep->velocity > 0 && newspeed < jeep->velocity) - jeep->velocity = (newspeed < 0) ? 0 : newspeed; + jeep->velocity = (newspeed > 0) ? 0 : newspeed; else if (jeep->velocity < 0 && newspeed > jeep->velocity) - jeep->velocity = (newspeed > 0) ? 0 : newspeed; + jeep->velocity = (newspeed < 0) ? 0 : newspeed; if (jeep->velocity < JEEP_MAX_BACK) jeep->velocity = JEEP_MAX_BACK; @@ -856,7 +899,7 @@ static int JeepDynamics(ITEM_INFO* item) static int JeepUserControl(ITEM_INFO* item, int height, int* pitch) { - if (LaraItem->currentAnimState == 10 || LaraItem->goalAnimState == 10) + if (LaraItem->currentAnimState == JS_GETOFF || LaraItem->goalAnimState == JS_GETOFF) TrInput = 0; JEEP_INFO* jeep = (JEEP_INFO*)item->data; @@ -944,9 +987,9 @@ static int JeepUserControl(ITEM_INFO* item, int height, int* pitch) if (jeep->unknown2) { if (jeep->unknown2 == 1 && jeep->velocity > -JEEP_MAX_BACK) - { jeep->velocity -= (abs(-JEEP_MAX_BACK - jeep->velocity) / 8) - 2; - } + else if (jeep->unknown2 == 1 && jeep->velocity < -JEEP_MAX_BACK) + jeep->velocity = -JEEP_MAX_BACK; } else { @@ -966,29 +1009,19 @@ static int JeepUserControl(ITEM_INFO* item, int height, int* pitch) jeep->velocity -= (abs(item->pos.yRot - jeep->momentumAngle) / 64); } else if (jeep->velocity > 256) - { jeep->velocity -= 256; - } else if (jeep->velocity < -256) - { jeep->velocity += 256; - } else - { jeep->velocity = 0; - } item->speed = jeep->velocity / 256; if (jeep->engineRevs > 0xC000) - { jeep->engineRevs = (GetRandomControl() & 0x1FF) + 48896; - } int revs = jeep->velocity; if (jeep->velocity < 0) - { revs /= 2; - } jeep->engineRevs += ((abs(revs) - jeep->engineRevs) / 8); } @@ -1004,9 +1037,7 @@ static int JeepUserControl(ITEM_INFO* item, int height, int* pitch) item->meshBits = 163839; } else - { item->meshBits = 114687; - } *pitch = jeep->engineRevs; @@ -1016,99 +1047,125 @@ static int JeepUserControl(ITEM_INFO* item, int height, int* pitch) static void AnimateJeep(ITEM_INFO* item, int collide, int dead) { JEEP_INFO* jeep = (JEEP_INFO*)item->data; - + bool dismount; if (item->pos.yPos != item->floor && - LaraItem->currentAnimState != 11 && - LaraItem->currentAnimState != 12 && + LaraItem->currentAnimState != JS_JUMP && + LaraItem->currentAnimState != JS_LAND && !dead) { if (jeep->unknown2 == 1) - LaraItem->animNumber = Objects[ID_JEEP_LARA_ANIMS].animIndex + 20; + LaraItem->animNumber = Objects[ID_JEEP_LARA_ANIMS].animIndex + JA_BACK_JUMP_START; else - LaraItem->animNumber = Objects[ID_JEEP_LARA_ANIMS].animIndex + 6; + LaraItem->animNumber = Objects[ID_JEEP_LARA_ANIMS].animIndex + JA_FWD_JUMP_START; - LaraItem->currentAnimState = 11; - LaraItem->goalAnimState = 11; + LaraItem->currentAnimState = JS_JUMP; + LaraItem->goalAnimState = JS_JUMP; LaraItem->frameNumber = g_Level.Anims[LaraItem->animNumber].frameBase; } - else if (collide) + else if ( (collide) && + (LaraItem->currentAnimState != 4) && + (LaraItem->currentAnimState != 5) && + (LaraItem->currentAnimState != 2) && + (LaraItem->currentAnimState != 3) && + (LaraItem->currentAnimState != JS_JUMP) && + (0x2AAA < (short)jeep->velocity) && + (!dead) ) { - if (LaraItem->currentAnimState != 4 && - LaraItem->currentAnimState != 5 && - LaraItem->currentAnimState != 2 && - LaraItem->currentAnimState != 3 && - LaraItem->currentAnimState != 11 && - jeep->velocity > JEEP_MAX_SPEED / 3 && - !dead) + short state; + switch (collide) { - switch (collide) - { - case 13: - LaraItem->goalAnimState = LaraItem->currentAnimState = 4; - LaraItem->animNumber = Objects[ID_JEEP_LARA_ANIMS].animIndex + 11; - break; + case 13: + state = 4; + LaraItem->animNumber = Objects[ID_JEEP_LARA_ANIMS].animIndex + 11; + break; - case 14: - LaraItem->goalAnimState = LaraItem->currentAnimState = 5; - LaraItem->animNumber = Objects[ID_JEEP_LARA_ANIMS].animIndex + 10; - break; + case 14: + state = 5; + LaraItem->animNumber = Objects[ID_JEEP_LARA_ANIMS].animIndex + 10; + break; - case 11: - LaraItem->goalAnimState = LaraItem->currentAnimState = 2; - LaraItem->animNumber = Objects[ID_JEEP_LARA_ANIMS].animIndex + 12; - break; + case 11: + state = 2; + LaraItem->animNumber = Objects[ID_JEEP_LARA_ANIMS].animIndex + 12; + break; - default: - LaraItem->goalAnimState = LaraItem->currentAnimState = 3; - LaraItem->animNumber = Objects[ID_JEEP_LARA_ANIMS].animIndex + 13; - break; - - } - - LaraItem->frameNumber = g_Level.Anims[LaraItem->animNumber].frameBase; + case 12: + state = 3; + LaraItem->animNumber = Objects[ID_JEEP_LARA_ANIMS].animIndex + 13; + break; } + + LaraItem->currentAnimState = state; + LaraItem->goalAnimState = state; + LaraItem->frameNumber = g_Level.Anims[LaraItem->animNumber].frameBase; } else { switch (LaraItem->currentAnimState) { - case 0: + case JS_STOP: if (dead) - LaraItem->goalAnimState = 16; + LaraItem->goalAnimState = JS_DEATH; else { - if (((TrInput & JEEP_IN_DISMOUNT) == JEEP_IN_DISMOUNT) && + dismount = ((TrInput & JEEP_IN_BRAKE) && (TrInput & IN_LEFT)) ? true : false; + if (dismount && !jeep->velocity && !JeepNoGetOff) { if (JeepCanGetOff()) - LaraItem->goalAnimState = 10; + LaraItem->goalAnimState = JS_GETOFF; break; } - if (!(DbInput & 0x800)) + if (DbInput & IN_WALK) { - if (!(DbInput & 0x40000000)) + if (jeep->unknown2) + jeep->unknown2--; + break; + } + else if (DbInput & IN_SPRINT) + { + if (jeep->unknown2 < 1) + { + jeep->unknown2++; + if (jeep->unknown2 == 1) + LaraItem->goalAnimState = JS_DRIVE_BACK; + break; + } + } + else + { + if ((TrInput & JEEP_IN_ACCELERATE) && !(TrInput & JEEP_IN_BRAKE)) + { + LaraItem->goalAnimState = JS_DRIVE_FORWARD; + break; + } + else if (TrInput & (IN_LEFT | IN_LSTEP)) + LaraItem->goalAnimState = JS_FWD_LEFT; + else if (TrInput & (IN_RIGHT | IN_RSTEP)) + LaraItem->goalAnimState = JS_FWD_RIGHT; + } + +/* if (!(DbInput & IN_WALK)) + { + if (!(DbInput & IN_SPRINT)) { if ((TrInput & JEEP_IN_ACCELERATE) && !(TrInput & JEEP_IN_BRAKE)) { - LaraItem->goalAnimState = 1; + LaraItem->goalAnimState = JS_DRIVE_FORWARD; break; } else if (TrInput & (IN_LEFT | IN_LSTEP)) - { - LaraItem->goalAnimState = 7; - } + LaraItem->goalAnimState = JS_FWD_LEFT; else if (TrInput & (IN_RIGHT | IN_RSTEP)) - { - LaraItem->goalAnimState = 8; - } + LaraItem->goalAnimState = JS_FWD_RIGHT; } else if (jeep->unknown2 < 1) { jeep->unknown2++; if (jeep->unknown2 == 1) - LaraItem->goalAnimState = 17; + LaraItem->goalAnimState = JS_DRIVE_BACK; } } @@ -1116,14 +1173,14 @@ static void AnimateJeep(ITEM_INFO* item, int collide, int dead) { if (jeep->unknown2) jeep->unknown2--; - } + }*/ } break; - case 1: + case JS_DRIVE_FORWARD: if (dead) - LaraItem->goalAnimState = 0; + LaraItem->goalAnimState = JS_STOP; else { if (jeep->velocity & 0xFFFFFF00 || @@ -1132,26 +1189,20 @@ static void AnimateJeep(ITEM_INFO* item, int collide, int dead) if (TrInput & JEEP_IN_BRAKE) { if (jeep->velocity <= 21844) - LaraItem->goalAnimState = 0; + LaraItem->goalAnimState = JS_STOP; else - LaraItem->goalAnimState = 6; + LaraItem->goalAnimState = JS_BRAKE; } else { if (TrInput & (IN_LEFT | IN_LSTEP)) - { - LaraItem->goalAnimState = 7; - } + LaraItem->goalAnimState = JS_FWD_LEFT; else if (TrInput & (IN_RIGHT | IN_RSTEP)) - { - LaraItem->goalAnimState = 8; - } + LaraItem->goalAnimState = JS_FWD_RIGHT; } } else - { - LaraItem->goalAnimState = 0; - } + LaraItem->goalAnimState = JS_STOP; } break; @@ -1161,223 +1212,164 @@ static void AnimateJeep(ITEM_INFO* item, int collide, int dead) case 4: case 5: if (dead) - { - LaraItem->goalAnimState = 0; - } + LaraItem->goalAnimState = JS_STOP; else if (TrInput & (JEEP_IN_ACCELERATE | JEEP_IN_BRAKE)) - { - LaraItem->goalAnimState = 1; - } - + LaraItem->goalAnimState = JS_DRIVE_FORWARD; break; - case 6: + case JS_BRAKE: if (dead) - { - LaraItem->goalAnimState = 0; - } + LaraItem->goalAnimState = JS_STOP; else if (jeep->velocity & 0xFFFFFF00) { if (TrInput & (IN_LEFT | IN_LSTEP)) - { - LaraItem->goalAnimState = 7; - } + LaraItem->goalAnimState = JS_FWD_LEFT; else if (TrInput & (IN_RIGHT | IN_RSTEP)) - { - LaraItem->goalAnimState = 8; - } + LaraItem->goalAnimState = JS_FWD_RIGHT; } else - { - LaraItem->goalAnimState = 0; - } - + LaraItem->goalAnimState = JS_STOP; break; - case 7: + case JS_FWD_LEFT: if (dead) + LaraItem->goalAnimState = JS_STOP; + else if (!(DbInput & IN_WALK)) { - LaraItem->goalAnimState = 0; - } - else if ((DbInput & 0x80u) == 0) - { - if (DbInput & 0x40000000) + if (DbInput & IN_SPRINT) { if (jeep->unknown2 < 1) { jeep->unknown2++; if (jeep->unknown2 == 1) { - LaraItem->goalAnimState = 15; - LaraItem->currentAnimState = 15; - LaraItem->animNumber = Objects[ID_JEEP_LARA_ANIMS].animIndex + 40; + LaraItem->goalAnimState = JS_BACK_RIGHT; + LaraItem->currentAnimState = JS_BACK_RIGHT; + LaraItem->animNumber = Objects[ID_JEEP_LARA_ANIMS].animIndex + JA_IDLE_REVERSE_RIGHT; LaraItem->frameNumber = g_Level.Anims[LaraItem->animNumber].frameBase; break; } } } else if (TrInput & (IN_RIGHT | IN_RSTEP)) - { - LaraItem->goalAnimState = 1; - } + LaraItem->goalAnimState = JS_DRIVE_FORWARD; else if (TrInput & (IN_LEFT | IN_LSTEP)) - { - LaraItem->goalAnimState = 7; - } + LaraItem->goalAnimState = JS_FWD_LEFT; else if (jeep->velocity) - { - LaraItem->goalAnimState = 1; - } + LaraItem->goalAnimState = JS_DRIVE_FORWARD; else - { - LaraItem->goalAnimState = 0; - } + LaraItem->goalAnimState = JS_STOP; } else { if (jeep->unknown2) - { jeep->unknown2--; - } } - if (LaraItem->animNumber == Objects[ID_JEEP_LARA_ANIMS].animIndex + 4 && + if (LaraItem->animNumber == Objects[ID_JEEP_LARA_ANIMS].animIndex + JA_FWD_LEFT && !jeep->velocity) { - LaraItem->animNumber = Objects[ID_JEEP_LARA_ANIMS].animIndex + 32; - LaraItem->frameNumber = g_Level.Anims[LaraItem->animNumber].frameBase + 14; + LaraItem->animNumber = Objects[ID_JEEP_LARA_ANIMS].animIndex + JA_IDLE_RIGHT_START; + LaraItem->frameNumber = g_Level.Anims[LaraItem->animNumber].frameBase + JA_IDLE; } - if (LaraItem->animNumber == Objects[ID_JEEP_LARA_ANIMS].animIndex + 32) + if (LaraItem->animNumber == Objects[ID_JEEP_LARA_ANIMS].animIndex + JA_IDLE_RIGHT_START) { if (jeep->velocity) { - LaraItem->animNumber = Objects[ID_JEEP_LARA_ANIMS].animIndex + 4; + LaraItem->animNumber = Objects[ID_JEEP_LARA_ANIMS].animIndex + JA_FWD_LEFT; LaraItem->frameNumber = g_Level.Anims[LaraItem->animNumber].frameBase; } } break; - case 8: + case JS_FWD_RIGHT: if (dead) + LaraItem->goalAnimState = JS_STOP; + if (!(DbInput & IN_WALK)) { - LaraItem->goalAnimState = 0; - } - if ((DbInput & 0x80u) == 0) - { - if (DbInput & 0x40000000) + if (DbInput & IN_SPRINT) { if (jeep->unknown2 < 1) { jeep->unknown2++; if (jeep->unknown2 == 1) { - LaraItem->goalAnimState = 14; - LaraItem->currentAnimState = 14; - LaraItem->animNumber = Objects[ID_JEEP_LARA_ANIMS].animIndex + 41; + LaraItem->goalAnimState = JS_BACK_LEFT; + LaraItem->currentAnimState = JS_BACK_LEFT; + LaraItem->animNumber = Objects[ID_JEEP_LARA_ANIMS].animIndex + JA_IDLE_REVERSE_LEFT; LaraItem->frameNumber = g_Level.Anims[LaraItem->animNumber].frameBase; break; } } } else if (TrInput & (IN_LEFT | IN_LSTEP)) - { - LaraItem->goalAnimState = 1; - } + LaraItem->goalAnimState = JS_DRIVE_FORWARD; else if (TrInput & (IN_RIGHT | IN_RSTEP)) - { - LaraItem->goalAnimState = 8; - } + LaraItem->goalAnimState = JS_FWD_RIGHT; else if (jeep->velocity) - { - LaraItem->goalAnimState = 1; - } + LaraItem->goalAnimState = JS_DRIVE_FORWARD; else - { - LaraItem->goalAnimState = 0; - } + LaraItem->goalAnimState = JS_STOP; } else { if (jeep->unknown2) - { jeep->unknown2--; - } } - if (LaraItem->animNumber == Objects[ID_JEEP_LARA_ANIMS].animIndex + 16 && !jeep->velocity) + if (LaraItem->animNumber == Objects[ID_JEEP_LARA_ANIMS].animIndex + JA_FWD_RIGHT && !jeep->velocity) { - LaraItem->animNumber = Objects[ID_JEEP_LARA_ANIMS].animIndex + 33; - LaraItem->frameNumber = g_Level.Anims[LaraItem->animNumber].frameBase + 14; + LaraItem->animNumber = Objects[ID_JEEP_LARA_ANIMS].animIndex + JA_IDLE_LEFT_START; + LaraItem->frameNumber = g_Level.Anims[LaraItem->animNumber].frameBase + 14;//hmm } - if (LaraItem->animNumber == Objects[ID_JEEP_LARA_ANIMS].animIndex + 33) + if (LaraItem->animNumber == Objects[ID_JEEP_LARA_ANIMS].animIndex + JA_IDLE_LEFT_START) { if (jeep->velocity) { - LaraItem->animNumber = Objects[ID_JEEP_LARA_ANIMS].animIndex + 16; + LaraItem->animNumber = Objects[ID_JEEP_LARA_ANIMS].animIndex + JA_FWD_RIGHT; LaraItem->frameNumber = g_Level.Anims[LaraItem->animNumber].frameBase; } } break; - case 11: + case JS_JUMP: if (item->pos.yPos == item->floor) - { - LaraItem->goalAnimState = 12; - } + LaraItem->goalAnimState = JS_LAND; else if (item->fallspeed > 300) - { - jeep->flags |= 0x40u; - } - + jeep->flags |= JF_FALLING; break; - case 13: + case JS_BACK: if (dead) - { - LaraItem->goalAnimState = 17; - } + LaraItem->goalAnimState = JS_DRIVE_BACK; else if (abs(jeep->velocity) & 0xFFFFFF00) { if (TrInput & (IN_LEFT | IN_LSTEP)) - { - LaraItem->goalAnimState = 15; - } + LaraItem->goalAnimState = JS_BACK_RIGHT; else if (TrInput & (IN_RIGHT | IN_RSTEP)) - { - LaraItem->goalAnimState = 14; - } + LaraItem->goalAnimState = JS_BACK_LEFT; } else - { - LaraItem->goalAnimState = 17; - } + LaraItem->goalAnimState = JS_DRIVE_BACK; break; - case 14: + case JS_BACK_LEFT: if (dead) + LaraItem->goalAnimState = JS_DRIVE_BACK; + else if (!(DbInput & IN_WALK)) { - LaraItem->goalAnimState = 17; - } - else if ((DbInput & 0x80u) == 0) - { - if (DbInput & 0x40000000) + if (DbInput & IN_SPRINT) { if (jeep->unknown2 < 1) - { jeep->unknown2++; - } } else if (TrInput & (IN_RIGHT | IN_RSTEP)) - { - LaraItem->goalAnimState = 14; - } + LaraItem->goalAnimState = JS_BACK_LEFT; else - { - LaraItem->goalAnimState = 13; - } + LaraItem->goalAnimState = JS_BACK; } else { @@ -1386,64 +1378,58 @@ static void AnimateJeep(ITEM_INFO* item, int collide, int dead) jeep->unknown2--; if (!jeep->unknown2) { - LaraItem->goalAnimState = 8; - LaraItem->currentAnimState = 8; - LaraItem->animNumber = Objects[ID_JEEP_LARA_ANIMS].animIndex + 44; + LaraItem->goalAnimState = JS_FWD_RIGHT; + LaraItem->currentAnimState = JS_FWD_RIGHT; + LaraItem->animNumber = Objects[ID_JEEP_LARA_ANIMS].animIndex + JA_IDLE_FWD_RIGHT; LaraItem->frameNumber = g_Level.Anims[LaraItem->animNumber].frameBase; break; } } } - if (LaraItem->animNumber == Objects[ID_JEEP_LARA_ANIMS].animIndex + 30 && !jeep->velocity) + if (LaraItem->animNumber == Objects[ID_JEEP_LARA_ANIMS].animIndex + JA_BACK_LEFT && !jeep->velocity) { - LaraItem->animNumber = Objects[ID_JEEP_LARA_ANIMS].animIndex + 37; + LaraItem->animNumber = Objects[ID_JEEP_LARA_ANIMS].animIndex + JA_IDLE_LEFT_BACK_START; LaraItem->frameNumber = g_Level.Anims[LaraItem->animNumber].frameBase + 14; } - if (LaraItem->animNumber == Objects[ID_JEEP_LARA_ANIMS].animIndex + 37) + if (LaraItem->animNumber == Objects[ID_JEEP_LARA_ANIMS].animIndex + JA_IDLE_LEFT_BACK_START) { if (jeep->velocity) { - LaraItem->animNumber = Objects[ID_JEEP_LARA_ANIMS].animIndex + 30; + LaraItem->animNumber = Objects[ID_JEEP_LARA_ANIMS].animIndex + JA_BACK_LEFT; LaraItem->frameNumber = g_Level.Anims[LaraItem->animNumber].frameBase; } } break; - case 15: + case JS_BACK_RIGHT: if (dead) { - LaraItem->goalAnimState = 17; + LaraItem->goalAnimState = JS_DRIVE_BACK; } - else if ((DbInput & 0x80u) == 0) + else if (!(DbInput & IN_WALK)) { - if (DbInput & 0x40000000) + if (DbInput & IN_SPRINT) { if (jeep->unknown2 < 1) - { jeep->unknown2++; - } } else if (TrInput & (IN_LEFT | IN_LSTEP)) - { - LaraItem->goalAnimState = 15; - } + LaraItem->goalAnimState = JS_BACK_RIGHT; else - { - LaraItem->goalAnimState = 13; - } + LaraItem->goalAnimState = JS_BACK; - if (LaraItem->animNumber == Objects[ID_JEEP_LARA_ANIMS].animIndex + 27 && !jeep->velocity) + if (LaraItem->animNumber == Objects[ID_JEEP_LARA_ANIMS].animIndex + JA_BACK_RIGHT && !jeep->velocity) { - LaraItem->animNumber = Objects[ID_JEEP_LARA_ANIMS].animIndex + 36; + LaraItem->animNumber = Objects[ID_JEEP_LARA_ANIMS].animIndex + JA_IDLE_RIGHT_BACK_START; LaraItem->frameNumber = g_Level.Anims[LaraItem->animNumber].frameBase + 14; } - if (LaraItem->animNumber == Objects[ID_JEEP_LARA_ANIMS].animIndex + 36) + if (LaraItem->animNumber == Objects[ID_JEEP_LARA_ANIMS].animIndex + JA_IDLE_RIGHT_BACK_START) { if (jeep->velocity) { - LaraItem->animNumber = Objects[ID_JEEP_LARA_ANIMS].animIndex + 27; + LaraItem->animNumber = Objects[ID_JEEP_LARA_ANIMS].animIndex + JA_BACK_RIGHT; LaraItem->frameNumber = g_Level.Anims[LaraItem->animNumber].frameBase; } } @@ -1451,60 +1437,51 @@ static void AnimateJeep(ITEM_INFO* item, int collide, int dead) } else if (!jeep->unknown2 || (--jeep->unknown2 != 0)) { - if (LaraItem->animNumber == Objects[ID_JEEP_LARA_ANIMS].animIndex + 27 && !jeep->velocity) + if (LaraItem->animNumber == Objects[ID_JEEP_LARA_ANIMS].animIndex + JA_BACK_RIGHT && !jeep->velocity) { - LaraItem->animNumber = Objects[ID_JEEP_LARA_ANIMS].animIndex + 36; + LaraItem->animNumber = Objects[ID_JEEP_LARA_ANIMS].animIndex + JA_IDLE_RIGHT_BACK_START; LaraItem->frameNumber = g_Level.Anims[LaraItem->animNumber].frameBase + 14; } - if (LaraItem->animNumber == Objects[ID_JEEP_LARA_ANIMS].animIndex + 36) + if (LaraItem->animNumber == Objects[ID_JEEP_LARA_ANIMS].animIndex + JA_IDLE_RIGHT_BACK_START) { if (jeep->velocity) { - LaraItem->animNumber = Objects[ID_JEEP_LARA_ANIMS].animIndex + 27; + LaraItem->animNumber = Objects[ID_JEEP_LARA_ANIMS].animIndex + JA_BACK_RIGHT; LaraItem->frameNumber = g_Level.Anims[LaraItem->animNumber].frameBase; } } break; } - LaraItem->goalAnimState = 7; - LaraItem->currentAnimState = 7; - LaraItem->animNumber = Objects[ID_JEEP_LARA_ANIMS].animIndex + 44; + LaraItem->goalAnimState = JS_FWD_LEFT; + LaraItem->currentAnimState = JS_FWD_LEFT; + LaraItem->animNumber = Objects[ID_JEEP_LARA_ANIMS].animIndex + JA_IDLE_FWD_RIGHT; LaraItem->frameNumber = g_Level.Anims[LaraItem->animNumber].frameBase; break; - case 17: + case JS_DRIVE_BACK: if (dead) + LaraItem->goalAnimState = JS_STOP; + else +// if (jeep->velocity || JeepNoGetOff) { - LaraItem->goalAnimState = 0; - } - if ((TrInput & JEEP_IN_DISMOUNT) != JEEP_IN_DISMOUNT || jeep->velocity || JeepNoGetOff) - { - if ((DbInput & 0x80u) == 0) + if (!(DbInput & IN_WALK)) { - if (DbInput & 0x40000000) + if (DbInput & IN_SPRINT) { if (jeep->unknown2 < 1) - { jeep->unknown2++; - } } else if (!(TrInput & JEEP_IN_ACCELERATE) || TrInput & JEEP_IN_BRAKE) { if (TrInput & (IN_LEFT | IN_LSTEP)) - { - LaraItem->goalAnimState = 15; - } + LaraItem->goalAnimState = JS_BACK_RIGHT; else if (TrInput & (IN_LEFT | IN_LSTEP)) - { - LaraItem->goalAnimState = 14; - } + LaraItem->goalAnimState = JS_BACK_LEFT; } else - { - LaraItem->goalAnimState = 13; - } + LaraItem->goalAnimState = JS_BACK; } else { @@ -1512,29 +1489,19 @@ static void AnimateJeep(ITEM_INFO* item, int collide, int dead) { jeep->unknown2--; if (!jeep->unknown2) - { - LaraItem->goalAnimState = 0; - } + LaraItem->goalAnimState = JS_STOP; } } } - else - { - if (JeepCanGetOff()) - { - LaraItem->goalAnimState = 10; - } - } break; default: break; } } - if (g_Level.Rooms[item->roomNumber].flags & ENV_FLAG_WATER) { - LaraItem->goalAnimState = 11; + LaraItem->goalAnimState = JS_JUMP; LaraItem->hitPoints = 0; JeepExplode(item); } @@ -1586,17 +1553,13 @@ void JeepCollision(short itemNumber, ITEM_INFO* l, COLL_INFO* coll) short ang = phd_atan(item->pos.zPos - LaraItem->pos.zPos, item->pos.xPos - LaraItem->pos.xPos); ang -= item->pos.yRot; - if ((ang > -(ONE_DEGREE * 45)) && (ang < (ONE_DEGREE * 135))) - { - LaraItem->animNumber = Objects[ID_JEEP_LARA_ANIMS].animIndex + 18; - } + if ((ang > -(ANGLE(45))) && (ang < (ANGLE(135)))) + LaraItem->animNumber = Objects[ID_JEEP_LARA_ANIMS].animIndex + JA_GETIN_LEFT; else - { - LaraItem->animNumber = Objects[ID_JEEP_LARA_ANIMS].animIndex + 9; - } + LaraItem->animNumber = Objects[ID_JEEP_LARA_ANIMS].animIndex + JA_GETIN_RIGHT; - LaraItem->goalAnimState = 9; - LaraItem->currentAnimState = 9; + LaraItem->goalAnimState = JS_GETIN; + LaraItem->currentAnimState = JS_GETIN; LaraItem->frameNumber = g_Level.Anims[LaraItem->animNumber].frameBase; item->hitPoints = 1; @@ -1624,9 +1587,7 @@ void JeepCollision(short itemNumber, ITEM_INFO* l, COLL_INFO* coll) S_CDPlay(98, 1); } else - { ObjectCollision(itemNumber, l, coll); - } } } @@ -1652,9 +1613,9 @@ int JeepControl(void) int ceiling = GetCeiling(floor, item->pos.xPos, item->pos.yPos, item->pos.zPos); PHD_VECTOR fl, fr, bc; - int hfl = TestJeepHeight(item, 550, -256, &fl); - int hfr = TestJeepHeight(item, 550, 256, &fr); - int hbc = TestJeepHeight(item, -600, 0, &bc); + int hfl = TestJeepHeight(item, JEEP_FRONT, -JEEP_SIDE, &fl); + int hfr = TestJeepHeight(item, JEEP_FRONT, JEEP_SIDE, &fr); + int hbc = TestJeepHeight(item, -(JEEP_FRONT + 50), 0, &bc); roomNumber = item->roomNumber; floor = GetFloor(item->pos.xPos, item->pos.yPos, item->pos.zPos, &roomNumber); @@ -1671,18 +1632,14 @@ int JeepControl(void) int pitch = 0; if (jeep->flags) - { collide = 0; - } - else if (LaraItem->currentAnimState == 9) + else if (LaraItem->currentAnimState == JS_GETIN) { drive = -1; collide = 0; } else - { drive = JeepUserControl(item, height, &pitch); - } if (jeep->velocity || jeep->revs) { @@ -1690,23 +1647,17 @@ int JeepControl(void) if (pitch >= -32768) { if (pitch > 40960) - { jeep->pitch = 40960; - } } else - { jeep->pitch = -32768; - } SoundEffect(155, &item->pos, (jeep->pitch * 256) + 16777220); } else { if (drive != -1) - { SoundEffect(153, &item->pos, 0); - } jeep->pitch = 0; } @@ -1728,14 +1679,12 @@ int JeepControl(void) if (height >= (hfl + hfr) / 2) xRot = phd_atan(1100, hbc - height); else - xRot = phd_atan(550, hbc - item->pos.yPos); + xRot = phd_atan(JEEP_FRONT, hbc - item->pos.yPos); } else { if (height >= (hfl + hfr) / 2) - { - xRot = phd_atan(550, item->pos.yPos - height); - } + xRot = phd_atan(JEEP_FRONT, item->pos.yPos - height); else { xRot = -phd_atan(137, oldY - item->pos.yPos); @@ -1746,7 +1695,11 @@ int JeepControl(void) item->pos.xRot += (xRot - item->pos.xRot) / 4; item->pos.zRot += (phd_atan(256, height - fl.y) - item->pos.zRot) / 4; - + if (jeep->velocity == 0) + { + item->pos.xRot = 0; + item->pos.zRot = 0; + } if (!(jeep->flags & JF_DEAD)) { if (roomNumber != item->roomNumber) @@ -1786,9 +1739,7 @@ int JeepControl(void) jeep->fallSpeed += ((32578 - jeep->fallSpeed) / 8); } else - { jeep->fallSpeed -= (jeep->fallSpeed / 8); - } Camera.targetAngle = jeep->fallSpeed; @@ -1802,11 +1753,9 @@ int JeepControl(void) } } - if (LaraItem->currentAnimState == 9 || - LaraItem->currentAnimState == 10) - { + if (LaraItem->currentAnimState == JS_GETIN || + LaraItem->currentAnimState == JS_GETOFF) JeepSmokeStart = 0; - } else { short speed = 0; @@ -1836,9 +1785,7 @@ int JeepControl(void) TriggerJeepExhaustSmoke(pos.x, pos.y, pos.z, item->pos.yRot + -32768, speed, 0); } else if (item->speed < 64) - { TriggerJeepExhaustSmoke(pos.x, pos.y, pos.z, item->pos.yRot - 32768, 64 - item->speed, 1); - } } return JeepCheckGetOff(); diff --git a/TR5Main/TR5Main.vcxproj.user b/TR5Main/TR5Main.vcxproj.user index db411226e..3c0e4c59c 100644 --- a/TR5Main/TR5Main.vcxproj.user +++ b/TR5Main/TR5Main.vcxproj.user @@ -11,9 +11,8 @@ /debug - Tr5Main.exe + TR5Main.exe WindowsLocalDebugger $(ProjectDir)..\Build\ - /debug \ No newline at end of file From 2a2c52674f8e2101f2b2b9582f6adf7145d00423 Mon Sep 17 00:00:00 2001 From: Raildex Date: Mon, 25 Jan 2021 11:09:36 +0100 Subject: [PATCH 10/23] Refactored SpeedBoatCheckGeton to use a descriptive Enum as return type --- TR5Main/Objects/TR2/Vehicles/boat.cpp | 40 +++++++++++++-------------- TR5Main/Objects/TR2/Vehicles/boat.h | 10 +++++-- 2 files changed, 27 insertions(+), 23 deletions(-) diff --git a/TR5Main/Objects/TR2/Vehicles/boat.cpp b/TR5Main/Objects/TR2/Vehicles/boat.cpp index 2fedf40d3..5d7a416c6 100644 --- a/TR5Main/Objects/TR2/Vehicles/boat.cpp +++ b/TR5Main/Objects/TR2/Vehicles/boat.cpp @@ -12,6 +12,8 @@ #include #include + + struct BOAT_INFO { int boatTurn; @@ -227,38 +229,45 @@ bool SpeedBoatCanGetOff(int direction) return true; } -int SpeedBoatCheckGeton(short itemNum, COLL_INFO* coll) +BOAT_GETON SpeedBoatCheckGeton(short itemNum, COLL_INFO* coll) { // Returns 0 if no get on, 1 if right get on and 2 if left get on and 3 if jump geton - int geton = 0; + BOAT_GETON geton = BOAT_GETON::NONE; if (Lara.gunStatus != LG_NO_ARMS) - return 0; + return BOAT_GETON::NONE; ITEM_INFO* boat = &g_Level.Items[itemNum]; + // Is Lara actually close enough to get on the thing? + if (!TestBoundsCollide(boat, LaraItem, coll->radius)) + return BOAT_GETON::NONE; + + if (!TestCollision(boat, LaraItem)) + return BOAT_GETON::NONE; + int dist = (LaraItem->pos.zPos - boat->pos.zPos) * phd_cos(-boat->pos.yRot) - (LaraItem->pos.xPos - boat->pos.xPos) * phd_sin(-boat->pos.yRot); if (dist > 200) - return 0; + return BOAT_GETON::NONE; // Check if Lara is close enough and in right position to get onto boat short rot = boat->pos.yRot - LaraItem->pos.yRot; if (Lara.waterStatus == LW_SURFACE || Lara.waterStatus == LW_WADE) { if (!(TrInput & IN_ACTION) || LaraItem->gravityStatus || boat->speed) - return 0; + return BOAT_GETON::NONE; if (rot > ANGLE(45) && rot < ANGLE(135)) - geton = 1; // Right + geton = BOAT_GETON::WATER_RIGHT; // Right else if (rot > -ANGLE(135) && rot < -ANGLE(45)) - geton = 2; // Left + geton = BOAT_GETON::WATER_LEFT; // Left } else if (Lara.waterStatus == LW_ABOVE_WATER) { if (LaraItem->fallspeed > 0) { if (rot > -ANGLE(135) && rot < ANGLE(135) && (LaraItem->pos.yPos + 512) > boat->pos.yPos) - geton = 3; // Jump + geton = BOAT_GETON::JUMP; // Jump } else if (LaraItem->fallspeed == 0) { @@ -267,23 +276,12 @@ int SpeedBoatCheckGeton(short itemNum, COLL_INFO* coll) if (LaraItem->pos.xPos == boat->pos.xPos && LaraItem->pos.yPos == boat->pos.yPos && LaraItem->pos.zPos == boat->pos.zPos) - geton = 4; // Must have started on same spot as boat + geton = BOAT_GETON::STARTPOS; // Must have started on same spot as boat else - geton = 3; // Jump + geton = BOAT_GETON::JUMP; // Jump } } } - - if (!geton) - return 0; - - // Is Lara actually close enough to get on the thing? - if (!TestBoundsCollide(boat, LaraItem, coll->radius)) - return 0; - - if (!TestCollision(boat, LaraItem)) - return 0; - return geton; } diff --git a/TR5Main/Objects/TR2/Vehicles/boat.h b/TR5Main/Objects/TR2/Vehicles/boat.h index dacbbf8f3..a31f27f57 100644 --- a/TR5Main/Objects/TR2/Vehicles/boat.h +++ b/TR5Main/Objects/TR2/Vehicles/boat.h @@ -1,14 +1,20 @@ #pragma once #include "items.h" #include "collide.h" - +enum BOAT_GETON { + NONE = 0, + WATER_RIGHT = 1, + WATER_LEFT = 2, + JUMP = 3, + STARTPOS=4 +}; void InitialiseSpeedBoat(short itemNum); void SpeedBoatCollision(short itemNum, ITEM_INFO* litem, COLL_INFO* coll); void SpeedBoatControl(short itemNumber); void DoBoatWakeEffect(ITEM_INFO* boat); void SpeedBoatGetOff(ITEM_INFO* boat); bool SpeedBoatCanGetOff(int direction); -int SpeedBoatCheckGeton(short itemNum, COLL_INFO* coll); +BOAT_GETON SpeedBoatCheckGeton(short itemNum, COLL_INFO* coll); int SpeedBoatTestWaterHeight(ITEM_INFO* item, int zOff, int xOff, PHD_VECTOR* pos); void SpeedBoatDoBoatShift(int itemNum); int SpeedBoatDoBoatDynamics(int height, int fallspeed, int* y); From d45db30cd96d689031b2cbcd6b618d6324bde1e7 Mon Sep 17 00:00:00 2001 From: Raildex Date: Mon, 25 Jan 2021 13:58:23 +0100 Subject: [PATCH 11/23] Ammo struct to better represent Ammo --- TR5Main/Game/Lara/lara_cheat.cpp | 24 ++++++------ TR5Main/Game/Lara/lara_fire.cpp | 20 +++++----- TR5Main/Game/Lara/lara_fire.h | 6 +-- TR5Main/Game/Lara/lara_one_gun.cpp | 33 ++++++++-------- TR5Main/Game/Lara/lara_struct.h | 60 +++++++++++++++++++++++++++++- TR5Main/Game/camera.cpp | 12 +++--- 6 files changed, 105 insertions(+), 50 deletions(-) diff --git a/TR5Main/Game/Lara/lara_cheat.cpp b/TR5Main/Game/Lara/lara_cheat.cpp index 18b8799f6..6d1abd09b 100644 --- a/TR5Main/Game/Lara/lara_cheat.cpp +++ b/TR5Main/Game/Lara/lara_cheat.cpp @@ -126,7 +126,7 @@ void LaraCheatGetStuff() // (F) (D) Lara.Weapons[WEAPON_REVOLVER].SelectedAmmo = WEAPON_AMMO1; Lara.Weapons[WEAPON_REVOLVER].HasLasersight = false; Lara.Weapons[WEAPON_REVOLVER].HasSilencer = false; - Lara.Weapons[WEAPON_REVOLVER].Ammo[WEAPON_AMMO1] = -1; + Lara.Weapons[WEAPON_REVOLVER].Ammo[WEAPON_AMMO1].isInfinite = true; } if (Objects[ID_UZI_ITEM].loaded) @@ -135,7 +135,7 @@ void LaraCheatGetStuff() // (F) (D) Lara.Weapons[WEAPON_UZI].SelectedAmmo = WEAPON_AMMO1; Lara.Weapons[WEAPON_UZI].HasLasersight = false; Lara.Weapons[WEAPON_UZI].HasSilencer = false; - Lara.Weapons[WEAPON_UZI].Ammo[WEAPON_AMMO1] = -1; + Lara.Weapons[WEAPON_UZI].Ammo[WEAPON_AMMO1].isInfinite = true; } if (Objects[ID_SHOTGUN_ITEM].loaded) @@ -144,7 +144,7 @@ void LaraCheatGetStuff() // (F) (D) Lara.Weapons[WEAPON_SHOTGUN].SelectedAmmo = WEAPON_AMMO1; Lara.Weapons[WEAPON_SHOTGUN].HasLasersight = false; Lara.Weapons[WEAPON_SHOTGUN].HasSilencer = false; - Lara.Weapons[WEAPON_SHOTGUN].Ammo[WEAPON_AMMO1] = -1; + Lara.Weapons[WEAPON_SHOTGUN].Ammo[WEAPON_AMMO1].isInfinite = true; } if (Objects[ID_HARPOON_ITEM].loaded) @@ -153,7 +153,7 @@ void LaraCheatGetStuff() // (F) (D) Lara.Weapons[WEAPON_HARPOON_GUN].SelectedAmmo = WEAPON_AMMO1; Lara.Weapons[WEAPON_HARPOON_GUN].HasLasersight = false; Lara.Weapons[WEAPON_HARPOON_GUN].HasSilencer = false; - Lara.Weapons[WEAPON_HARPOON_GUN].Ammo[WEAPON_AMMO1] = -1; + Lara.Weapons[WEAPON_HARPOON_GUN].Ammo[WEAPON_AMMO1].isInfinite = true; } if (Objects[ID_GRENADE_GUN_ITEM].loaded) @@ -161,9 +161,9 @@ void LaraCheatGetStuff() // (F) (D) Lara.Weapons[WEAPON_GRENADE_LAUNCHER].Present = true; Lara.Weapons[WEAPON_GRENADE_LAUNCHER].SelectedAmmo = WEAPON_AMMO1; Lara.Weapons[WEAPON_GRENADE_LAUNCHER].HasSilencer = false; - Lara.Weapons[WEAPON_GRENADE_LAUNCHER].Ammo[WEAPON_AMMO1] = -1; - Lara.Weapons[WEAPON_GRENADE_LAUNCHER].Ammo[WEAPON_AMMO2] = -1; - Lara.Weapons[WEAPON_GRENADE_LAUNCHER].Ammo[WEAPON_AMMO3] = -1; + Lara.Weapons[WEAPON_GRENADE_LAUNCHER].Ammo[WEAPON_AMMO1].isInfinite = true; + Lara.Weapons[WEAPON_GRENADE_LAUNCHER].Ammo[WEAPON_AMMO2].isInfinite = true; + Lara.Weapons[WEAPON_GRENADE_LAUNCHER].Ammo[WEAPON_AMMO3].isInfinite = true; } if (Objects[ID_ROCKET_LAUNCHER_ITEM].loaded) @@ -172,7 +172,7 @@ void LaraCheatGetStuff() // (F) (D) Lara.Weapons[WEAPON_ROCKET_LAUNCHER].SelectedAmmo = WEAPON_AMMO1; Lara.Weapons[WEAPON_ROCKET_LAUNCHER].HasLasersight = false; Lara.Weapons[WEAPON_ROCKET_LAUNCHER].HasSilencer = false; - Lara.Weapons[WEAPON_ROCKET_LAUNCHER].Ammo[WEAPON_AMMO1] = -1; + Lara.Weapons[WEAPON_ROCKET_LAUNCHER].Ammo[WEAPON_AMMO1].isInfinite = true; } if (Objects[ID_HK_ITEM].loaded) @@ -181,7 +181,7 @@ void LaraCheatGetStuff() // (F) (D) Lara.Weapons[WEAPON_HK].SelectedAmmo = WEAPON_AMMO1; Lara.Weapons[WEAPON_HK].HasLasersight = false; Lara.Weapons[WEAPON_HK].HasSilencer = false; - Lara.Weapons[WEAPON_HK].Ammo[WEAPON_AMMO1] = -1; + Lara.Weapons[WEAPON_HK].Ammo[WEAPON_AMMO1].isInfinite = true; } if (Objects[ID_CROSSBOW_ITEM].loaded) @@ -190,9 +190,9 @@ void LaraCheatGetStuff() // (F) (D) Lara.Weapons[WEAPON_CROSSBOW].SelectedAmmo = WEAPON_AMMO1; Lara.Weapons[WEAPON_CROSSBOW].HasLasersight = false; Lara.Weapons[WEAPON_CROSSBOW].HasSilencer = false; - Lara.Weapons[WEAPON_CROSSBOW].Ammo[WEAPON_AMMO1] = -1; - Lara.Weapons[WEAPON_CROSSBOW].Ammo[WEAPON_AMMO2] = -1; - Lara.Weapons[WEAPON_CROSSBOW].Ammo[WEAPON_AMMO3] = -1; + Lara.Weapons[WEAPON_CROSSBOW].Ammo[WEAPON_AMMO1].isInfinite = true; + Lara.Weapons[WEAPON_CROSSBOW].Ammo[WEAPON_AMMO2].isInfinite = true; + Lara.Weapons[WEAPON_CROSSBOW].Ammo[WEAPON_AMMO3].isInfinite = true; } g_Inventory.LoadObjects(false); diff --git a/TR5Main/Game/Lara/lara_fire.cpp b/TR5Main/Game/Lara/lara_fire.cpp index d4015c1da..67de1c794 100644 --- a/TR5Main/Game/Lara/lara_fire.cpp +++ b/TR5Main/Game/Lara/lara_fire.cpp @@ -258,7 +258,7 @@ bool MonksAttackLara; ITEM_INFO* LastTargets[8]; ITEM_INFO* TargetList[8]; -int WeaponObject(int weaponType) // (F) (D) +GAME_OBJECT_ID WeaponObject(int weaponType) // (F) (D) { switch (weaponType) { @@ -522,7 +522,7 @@ void LaraGun() // (F) (D) if (TrInput & IN_ACTION) { - if (!*GetAmmo(Lara.gunType)) + if (!GetAmmo(Lara.gunType)) { Lara.requestGunType = Objects[ID_PISTOLS_ITEM].loaded ? WEAPON_PISTOLS : WEAPON_NONE; return; @@ -594,9 +594,8 @@ void LaraGun() // (F) (D) } } -short* GetAmmo(int weaponType) -{ - return &Lara.Weapons[weaponType].Ammo[Lara.Weapons[weaponType].SelectedAmmo]; +Ammo& GetAmmo(int weaponType){ + return Lara.Weapons[weaponType].Ammo[Lara.Weapons[weaponType].SelectedAmmo]; } void InitialiseNewWeapon() @@ -651,8 +650,7 @@ void InitialiseNewWeapon() } } -int WeaponObjectMesh(int weaponType) -{ +GAME_OBJECT_ID WeaponObjectMesh(int weaponType) { switch (weaponType) { case WEAPON_REVOLVER: @@ -724,11 +722,11 @@ void HitTarget(ITEM_INFO* item, GAME_VECTOR* hitPos, int damage, int flag) FireWeaponType FireWeapon(int weaponType, ITEM_INFO* target, ITEM_INFO* src, short* angles) // (F) (D) { - short* ammo = GetAmmo(weaponType); - if (*ammo == 0) + Ammo& ammo = GetAmmo(weaponType); + if (ammo.count == 0 && !ammo.isInfinite) return FW_NOAMMO; - if (*ammo != -1) - *ammo--; + if (!ammo.isInfinite) + ammo--; WEAPON_INFO* weapon = &Weapons[weaponType]; int r; diff --git a/TR5Main/Game/Lara/lara_fire.h b/TR5Main/Game/Lara/lara_fire.h index 0e78dadf9..76eb57f09 100644 --- a/TR5Main/Game/Lara/lara_fire.h +++ b/TR5Main/Game/Lara/lara_fire.h @@ -36,11 +36,11 @@ constexpr auto WSTATE_UW_UNAIM = 7; extern WEAPON_INFO Weapons[static_cast(LARA_WEAPON_TYPE::NUM_WEAPONS)]; void SmashItem(short itemNum); -int WeaponObject(int weaponType); +GAME_OBJECT_ID WeaponObject(int weaponType); void LaraGun(); -short* GetAmmo(int weaponType); +Ammo& GetAmmo(int weaponType); void InitialiseNewWeapon(); -int WeaponObjectMesh(int weaponType); +GAME_OBJECT_ID WeaponObjectMesh(int weaponType); void AimWeapon(WEAPON_INFO* winfo, LARA_ARM* arm); void HitTarget(ITEM_INFO* item, GAME_VECTOR* hitPos, int damage, int flag); FireWeaponType FireWeapon(int weaponType, ITEM_INFO* target, ITEM_INFO* src, short* angles); diff --git a/TR5Main/Game/Lara/lara_one_gun.cpp b/TR5Main/Game/Lara/lara_one_gun.cpp index ddefef5d8..97f817f96 100644 --- a/TR5Main/Game/Lara/lara_one_gun.cpp +++ b/TR5Main/Game/Lara/lara_one_gun.cpp @@ -35,8 +35,8 @@ extern GameFlow* g_GameFlow; void FireHarpoon() { - short* ammos = GetAmmo(WEAPON_CROSSBOW); - if (*ammos != 0) + Ammo& ammos = GetAmmo(WEAPON_CROSSBOW); + if (ammos.count != 0) { Lara.hasFired = true; @@ -44,8 +44,8 @@ void FireHarpoon() short itemNumber = CreateItem(); if (itemNumber != NO_ITEM) { - if (*ammos != -1) - (*ammos)--; + if (!ammos.isInfinite) + (ammos)--; GAME_VECTOR pos; ITEM_INFO* item = &g_Level.Items[itemNumber]; @@ -292,8 +292,8 @@ void FireGrenade() int y = 0; int z = 0; - short* ammo = GetAmmo(WEAPON_GRENADE_LAUNCHER); - if (*ammo != 0) + Ammo& ammo = GetAmmo(WEAPON_GRENADE_LAUNCHER); + if (ammo != 0) { Lara.hasFired = true; @@ -365,8 +365,8 @@ void FireGrenade() AddActiveItem(itemNumber); - if (*ammo != -1) - (*ammo)--; + if (!ammo.isInfinite) + (ammo)--; item->itemFlags[0] = Lara.Weapons[WEAPON_GRENADE_LAUNCHER].SelectedAmmo; @@ -1516,8 +1516,8 @@ void RifleHandler(int weaponType) void FireCrossbow(PHD_3DPOS* pos) { - short* ammos = GetAmmo(WEAPON_CROSSBOW); - if (*ammos != 0) + Ammo& ammos = GetAmmo(WEAPON_CROSSBOW); + if (ammos) { Lara.hasFired = true; @@ -1542,8 +1542,8 @@ void FireCrossbow(PHD_3DPOS* pos) } else { - if (*ammos != -1) - (*ammos)--; + if (!ammos.isInfinite) + (ammos)--; PHD_VECTOR jointPos; jointPos.x = 0; @@ -1600,9 +1600,8 @@ void FireCrossbow(PHD_3DPOS* pos) void FireRocket() { - short* ammos = GetAmmo(WEAPON_ROCKET_LAUNCHER); - if (*ammos != 0) - { + Ammo& ammos = GetAmmo(WEAPON_ROCKET_LAUNCHER); + if (ammos) { Lara.hasFired = true; short itemNumber = CreateItem(); @@ -1612,8 +1611,8 @@ void FireRocket() item->objectNumber = ID_ROCKET; item->roomNumber = LaraItem->roomNumber; - if (*ammos != -1) - (*ammos)--; + if (!ammos.isInfinite) + (ammos)--; PHD_VECTOR jointPos; jointPos.x = 0; diff --git a/TR5Main/Game/Lara/lara_struct.h b/TR5Main/Game/Lara/lara_struct.h index 7be7c214c..b8f4b7798 100644 --- a/TR5Main/Game/Lara/lara_struct.h +++ b/TR5Main/Game/Lara/lara_struct.h @@ -827,11 +827,69 @@ struct HolsterInfo { HOLSTER_SLOT rightHolster; HOLSTER_SLOT backHolster; }; +struct Ammo { + unsigned short count; + bool isInfinite; + Ammo operator --() { + Ammo tmp; + tmp.isInfinite = this->isInfinite; + tmp.count = static_cast(--this->count); + return tmp; + } + + Ammo operator --(int) { + Ammo tmp; + tmp.isInfinite = this->isInfinite; + tmp.count = --this->count; + return tmp; + } + + Ammo operator ++() { + Ammo tmp; + tmp.isInfinite = this->isInfinite; + tmp.count = ++this->count; + return tmp; + } + + Ammo operator ++(int) { + Ammo tmp; + tmp.isInfinite = this->isInfinite; + tmp.count = ++this->count; + return tmp; + } + + Ammo& operator =(unsigned val) { + this->count = static_cast(val); + return *this; + } + + Ammo& operator +(unsigned val) { + int tmp = this->count + val; + this->count = static_cast(tmp); + return *this; + } + + Ammo& operator +=(unsigned val) { + int tmp = this->count + val; + this->count = static_cast(tmp); + return *this; + } + + Ammo& operator -=(unsigned val) { + int tmp = this->count - val; + this->count = static_cast(tmp); + return *this; + } + + operator bool() { + return isInfinite || (count > 0); + } +}; typedef struct CarriedWeaponInfo { bool Present; - short Ammo[MAX_AMMOTYPE]; + Ammo Ammo[MAX_AMMOTYPE]; int SelectedAmmo; // WeaponAmmoType_enum bool HasLasersight; bool HasSilencer; diff --git a/TR5Main/Game/camera.cpp b/TR5Main/Game/camera.cpp index 31d02aaaf..8b9b04530 100644 --- a/TR5Main/Game/camera.cpp +++ b/TR5Main/Game/camera.cpp @@ -1315,9 +1315,9 @@ void BinocularCamera(ITEM_INFO* item) if (LaserSight) { int firing = 0; - short* ammo = GetAmmo(Lara.gunType); + Ammo& ammo = GetAmmo(Lara.gunType); - if (!(InputBusy & IN_ACTION) || WeaponDelay || !*ammo) + if (!(InputBusy & IN_ACTION) || WeaponDelay || !ammo) { if (!(InputBusy & IN_ACTION)) { @@ -1334,8 +1334,8 @@ void BinocularCamera(ITEM_INFO* item) firing = 1; WeaponDelay = 16; Savegame.Game.AmmoUsed++; - if (*ammo != -1) - (*ammo)--; + if (!ammo.isInfinite) + (ammo)--; } else if (Lara.gunType == WEAPON_CROSSBOW) { @@ -1426,8 +1426,8 @@ void BinocularCamera(ITEM_INFO* item) Camera.bounce = -16 - (GetRandomControl() & 0x1F); } - if (*ammo != -1) - (*ammo)--; + if (!ammo.isInfinite) + (ammo)--; } } From 2138df91c3e129b86a733a0883c41725c51be322 Mon Sep 17 00:00:00 2001 From: Raildex Date: Tue, 26 Jan 2021 10:03:59 +0100 Subject: [PATCH 12/23] Fixing Ammo --- TR5Main/Game/Lara/lara_cheat.cpp | 24 ++++---- TR5Main/Game/Lara/lara_fire.cpp | 4 +- TR5Main/Game/Lara/lara_initialise.cpp | 2 +- TR5Main/Game/Lara/lara_one_gun.cpp | 10 ++-- TR5Main/Game/Lara/lara_struct.h | 86 ++++++++++++++++++--------- TR5Main/Game/camera.cpp | 4 +- 6 files changed, 79 insertions(+), 51 deletions(-) diff --git a/TR5Main/Game/Lara/lara_cheat.cpp b/TR5Main/Game/Lara/lara_cheat.cpp index 6d1abd09b..a23919ae3 100644 --- a/TR5Main/Game/Lara/lara_cheat.cpp +++ b/TR5Main/Game/Lara/lara_cheat.cpp @@ -126,7 +126,7 @@ void LaraCheatGetStuff() // (F) (D) Lara.Weapons[WEAPON_REVOLVER].SelectedAmmo = WEAPON_AMMO1; Lara.Weapons[WEAPON_REVOLVER].HasLasersight = false; Lara.Weapons[WEAPON_REVOLVER].HasSilencer = false; - Lara.Weapons[WEAPON_REVOLVER].Ammo[WEAPON_AMMO1].isInfinite = true; + Lara.Weapons[WEAPON_REVOLVER].Ammo[WEAPON_AMMO1].setInfinite(true); } if (Objects[ID_UZI_ITEM].loaded) @@ -135,7 +135,7 @@ void LaraCheatGetStuff() // (F) (D) Lara.Weapons[WEAPON_UZI].SelectedAmmo = WEAPON_AMMO1; Lara.Weapons[WEAPON_UZI].HasLasersight = false; Lara.Weapons[WEAPON_UZI].HasSilencer = false; - Lara.Weapons[WEAPON_UZI].Ammo[WEAPON_AMMO1].isInfinite = true; + Lara.Weapons[WEAPON_UZI].Ammo[WEAPON_AMMO1].setInfinite(true); } if (Objects[ID_SHOTGUN_ITEM].loaded) @@ -144,7 +144,7 @@ void LaraCheatGetStuff() // (F) (D) Lara.Weapons[WEAPON_SHOTGUN].SelectedAmmo = WEAPON_AMMO1; Lara.Weapons[WEAPON_SHOTGUN].HasLasersight = false; Lara.Weapons[WEAPON_SHOTGUN].HasSilencer = false; - Lara.Weapons[WEAPON_SHOTGUN].Ammo[WEAPON_AMMO1].isInfinite = true; + Lara.Weapons[WEAPON_SHOTGUN].Ammo[WEAPON_AMMO1].setInfinite(true); } if (Objects[ID_HARPOON_ITEM].loaded) @@ -153,7 +153,7 @@ void LaraCheatGetStuff() // (F) (D) Lara.Weapons[WEAPON_HARPOON_GUN].SelectedAmmo = WEAPON_AMMO1; Lara.Weapons[WEAPON_HARPOON_GUN].HasLasersight = false; Lara.Weapons[WEAPON_HARPOON_GUN].HasSilencer = false; - Lara.Weapons[WEAPON_HARPOON_GUN].Ammo[WEAPON_AMMO1].isInfinite = true; + Lara.Weapons[WEAPON_HARPOON_GUN].Ammo[WEAPON_AMMO1].setInfinite(true); } if (Objects[ID_GRENADE_GUN_ITEM].loaded) @@ -161,9 +161,9 @@ void LaraCheatGetStuff() // (F) (D) Lara.Weapons[WEAPON_GRENADE_LAUNCHER].Present = true; Lara.Weapons[WEAPON_GRENADE_LAUNCHER].SelectedAmmo = WEAPON_AMMO1; Lara.Weapons[WEAPON_GRENADE_LAUNCHER].HasSilencer = false; - Lara.Weapons[WEAPON_GRENADE_LAUNCHER].Ammo[WEAPON_AMMO1].isInfinite = true; - Lara.Weapons[WEAPON_GRENADE_LAUNCHER].Ammo[WEAPON_AMMO2].isInfinite = true; - Lara.Weapons[WEAPON_GRENADE_LAUNCHER].Ammo[WEAPON_AMMO3].isInfinite = true; + Lara.Weapons[WEAPON_GRENADE_LAUNCHER].Ammo[WEAPON_AMMO1].setInfinite(true); + Lara.Weapons[WEAPON_GRENADE_LAUNCHER].Ammo[WEAPON_AMMO2].setInfinite(true); + Lara.Weapons[WEAPON_GRENADE_LAUNCHER].Ammo[WEAPON_AMMO3].setInfinite(true); } if (Objects[ID_ROCKET_LAUNCHER_ITEM].loaded) @@ -172,7 +172,7 @@ void LaraCheatGetStuff() // (F) (D) Lara.Weapons[WEAPON_ROCKET_LAUNCHER].SelectedAmmo = WEAPON_AMMO1; Lara.Weapons[WEAPON_ROCKET_LAUNCHER].HasLasersight = false; Lara.Weapons[WEAPON_ROCKET_LAUNCHER].HasSilencer = false; - Lara.Weapons[WEAPON_ROCKET_LAUNCHER].Ammo[WEAPON_AMMO1].isInfinite = true; + Lara.Weapons[WEAPON_ROCKET_LAUNCHER].Ammo[WEAPON_AMMO1].setInfinite(true); } if (Objects[ID_HK_ITEM].loaded) @@ -181,7 +181,7 @@ void LaraCheatGetStuff() // (F) (D) Lara.Weapons[WEAPON_HK].SelectedAmmo = WEAPON_AMMO1; Lara.Weapons[WEAPON_HK].HasLasersight = false; Lara.Weapons[WEAPON_HK].HasSilencer = false; - Lara.Weapons[WEAPON_HK].Ammo[WEAPON_AMMO1].isInfinite = true; + Lara.Weapons[WEAPON_HK].Ammo[WEAPON_AMMO1].setInfinite(true); } if (Objects[ID_CROSSBOW_ITEM].loaded) @@ -190,9 +190,9 @@ void LaraCheatGetStuff() // (F) (D) Lara.Weapons[WEAPON_CROSSBOW].SelectedAmmo = WEAPON_AMMO1; Lara.Weapons[WEAPON_CROSSBOW].HasLasersight = false; Lara.Weapons[WEAPON_CROSSBOW].HasSilencer = false; - Lara.Weapons[WEAPON_CROSSBOW].Ammo[WEAPON_AMMO1].isInfinite = true; - Lara.Weapons[WEAPON_CROSSBOW].Ammo[WEAPON_AMMO2].isInfinite = true; - Lara.Weapons[WEAPON_CROSSBOW].Ammo[WEAPON_AMMO3].isInfinite = true; + Lara.Weapons[WEAPON_CROSSBOW].Ammo[WEAPON_AMMO1].setInfinite(true); + Lara.Weapons[WEAPON_CROSSBOW].Ammo[WEAPON_AMMO2].setInfinite(true); + Lara.Weapons[WEAPON_CROSSBOW].Ammo[WEAPON_AMMO3].setInfinite(true); } g_Inventory.LoadObjects(false); diff --git a/TR5Main/Game/Lara/lara_fire.cpp b/TR5Main/Game/Lara/lara_fire.cpp index 67de1c794..a13e11cb3 100644 --- a/TR5Main/Game/Lara/lara_fire.cpp +++ b/TR5Main/Game/Lara/lara_fire.cpp @@ -723,9 +723,9 @@ void HitTarget(ITEM_INFO* item, GAME_VECTOR* hitPos, int damage, int flag) FireWeaponType FireWeapon(int weaponType, ITEM_INFO* target, ITEM_INFO* src, short* angles) // (F) (D) { Ammo& ammo = GetAmmo(weaponType); - if (ammo.count == 0 && !ammo.isInfinite) + if (ammo.getCount() == 0 && !ammo.hasInfinite()) return FW_NOAMMO; - if (!ammo.isInfinite) + if (!ammo.hasInfinite()) ammo--; WEAPON_INFO* weapon = &Weapons[weaponType]; diff --git a/TR5Main/Game/Lara/lara_initialise.cpp b/TR5Main/Game/Lara/lara_initialise.cpp index de7dbaf4a..dcdb1aafd 100644 --- a/TR5Main/Game/Lara/lara_initialise.cpp +++ b/TR5Main/Game/Lara/lara_initialise.cpp @@ -73,7 +73,7 @@ void InitialiseLara(int restore) if (gun == WEAPON_PISTOLS) { Lara.Weapons[WEAPON_PISTOLS].Present = true; - Lara.Weapons[WEAPON_PISTOLS].Ammo[WEAPON_AMMO1] = -1; + Lara.Weapons[WEAPON_PISTOLS].Ammo[WEAPON_AMMO1].setInfinite(true); } else if (gun == WEAPON_HK) { diff --git a/TR5Main/Game/Lara/lara_one_gun.cpp b/TR5Main/Game/Lara/lara_one_gun.cpp index 97f817f96..acd2c4082 100644 --- a/TR5Main/Game/Lara/lara_one_gun.cpp +++ b/TR5Main/Game/Lara/lara_one_gun.cpp @@ -36,7 +36,7 @@ extern GameFlow* g_GameFlow; void FireHarpoon() { Ammo& ammos = GetAmmo(WEAPON_CROSSBOW); - if (ammos.count != 0) + if (ammos.getCount() != 0) { Lara.hasFired = true; @@ -44,7 +44,7 @@ void FireHarpoon() short itemNumber = CreateItem(); if (itemNumber != NO_ITEM) { - if (!ammos.isInfinite) + if (!ammos.hasInfinite()) (ammos)--; GAME_VECTOR pos; @@ -365,7 +365,7 @@ void FireGrenade() AddActiveItem(itemNumber); - if (!ammo.isInfinite) + if (!ammo.hasInfinite()) (ammo)--; item->itemFlags[0] = Lara.Weapons[WEAPON_GRENADE_LAUNCHER].SelectedAmmo; @@ -1542,7 +1542,7 @@ void FireCrossbow(PHD_3DPOS* pos) } else { - if (!ammos.isInfinite) + if (!ammos.hasInfinite()) (ammos)--; PHD_VECTOR jointPos; @@ -1611,7 +1611,7 @@ void FireRocket() item->objectNumber = ID_ROCKET; item->roomNumber = LaraItem->roomNumber; - if (!ammos.isInfinite) + if (!ammos.hasInfinite()) (ammos)--; PHD_VECTOR jointPos; diff --git a/TR5Main/Game/Lara/lara_struct.h b/TR5Main/Game/Lara/lara_struct.h index b8f4b7798..e38c875b3 100644 --- a/TR5Main/Game/Lara/lara_struct.h +++ b/TR5Main/Game/Lara/lara_struct.h @@ -828,63 +828,91 @@ struct HolsterInfo { HOLSTER_SLOT backHolster; }; struct Ammo { - unsigned short count; + using CountType = uint16_t; +private: + CountType count; bool isInfinite; +public: - Ammo operator --() { - Ammo tmp; - tmp.isInfinite = this->isInfinite; - tmp.count = static_cast(--this->count); - return tmp; + Ammo& operator --() { + --count; + return *this; } Ammo operator --(int) { - Ammo tmp; - tmp.isInfinite = this->isInfinite; - tmp.count = --this->count; + Ammo tmp = *this; + --*this; return tmp; } - Ammo operator ++() { - Ammo tmp; - tmp.isInfinite = this->isInfinite; - tmp.count = ++this->count; - return tmp; + Ammo& operator ++() { + ++count; + return *this; } Ammo operator ++(int) { - Ammo tmp; - tmp.isInfinite = this->isInfinite; - tmp.count = ++this->count; + Ammo tmp = *this; + ++*this; return tmp; } - Ammo& operator =(unsigned val) { - this->count = static_cast(val); + Ammo& operator =(size_t val) { + count = clamp(val); return *this; } - Ammo& operator +(unsigned val) { + bool operator ==(size_t val) { + return count == clamp(val); + } + + Ammo& operator =(Ammo& rhs) { + count = rhs.count; + isInfinite = rhs.count; + return *this; + } + + Ammo operator +(size_t val) { + Ammo tmp = *this; + tmp += val; + return tmp; + } + + Ammo operator -(size_t val) { + Ammo tmp = *this; + tmp -= val; + return tmp; + } + + Ammo& operator +=(size_t val) { int tmp = this->count + val; - this->count = static_cast(tmp); + this->count = clamp(tmp); return *this; } - Ammo& operator +=(unsigned val) { - int tmp = this->count + val; - this->count = static_cast(tmp); - return *this; - } - - Ammo& operator -=(unsigned val) { + Ammo& operator -=(size_t val) { int tmp = this->count - val; - this->count = static_cast(tmp); + this->count = clamp(tmp); return *this; } operator bool() { return isInfinite || (count > 0); } + static CountType clamp(int val) { + return std::clamp(val, 0, static_cast(std::numeric_limits::max())); + } + + bool hasInfinite() const { + return isInfinite; + } + + CountType getCount() const { + return count; + } + + void setInfinite(bool infinite) { + isInfinite = infinite; + } }; typedef struct CarriedWeaponInfo { diff --git a/TR5Main/Game/camera.cpp b/TR5Main/Game/camera.cpp index 8b9b04530..00f81d41e 100644 --- a/TR5Main/Game/camera.cpp +++ b/TR5Main/Game/camera.cpp @@ -1334,7 +1334,7 @@ void BinocularCamera(ITEM_INFO* item) firing = 1; WeaponDelay = 16; Savegame.Game.AmmoUsed++; - if (!ammo.isInfinite) + if (!ammo.hasInfinite()) (ammo)--; } else if (Lara.gunType == WEAPON_CROSSBOW) @@ -1426,7 +1426,7 @@ void BinocularCamera(ITEM_INFO* item) Camera.bounce = -16 - (GetRandomControl() & 0x1F); } - if (!ammo.isInfinite) + if (!ammo.hasInfinite()) (ammo)--; } } From bfa49f95b709a90864715565792a7c0e73d885f2 Mon Sep 17 00:00:00 2001 From: Raildex Date: Tue, 26 Jan 2021 13:07:08 +0100 Subject: [PATCH 13/23] WeaponState Enum --- TR5Main/Game/Lara/lara_fire.h | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) diff --git a/TR5Main/Game/Lara/lara_fire.h b/TR5Main/Game/Lara/lara_fire.h index 76eb57f09..8a11dcd46 100644 --- a/TR5Main/Game/Lara/lara_fire.h +++ b/TR5Main/Game/Lara/lara_fire.h @@ -24,14 +24,15 @@ typedef struct WEAPON_INFO short sampleNum; byte explosiveDamage; }; - -constexpr auto WSTATE_AIM = 0; -constexpr auto WSTATE_DRAW = 1; -constexpr auto WSTATE_UW_AIM = 6; -constexpr auto WSTATE_RECOIL = 2; -constexpr auto WSTATE_UW_RECOIL = 8; -constexpr auto WSTATE_UNAIM = 4; -constexpr auto WSTATE_UW_UNAIM = 7; +enum WeaponState { + WSTATE_AIM =0, + WSTATE_DRAW = 1, + WSTATE_RECOIL = 2, + WSTATE_UNAIM = 4, + WSTATE_UW_AIM = 6, + WSTATE_UW_UNAIM = 7, + WSTATE_UW_RECOIL = 8 +}; extern WEAPON_INFO Weapons[static_cast(LARA_WEAPON_TYPE::NUM_WEAPONS)]; From f29377f91f781680e03ba24f3a221a22f68a4eae Mon Sep 17 00:00:00 2001 From: Raildex Date: Tue, 26 Jan 2021 16:41:29 +0100 Subject: [PATCH 14/23] Fixed Corner Climb Camera --- TR5Main/Game/Lara/lara_hang.cpp | 20 ++++++++++++-------- 1 file changed, 12 insertions(+), 8 deletions(-) diff --git a/TR5Main/Game/Lara/lara_hang.cpp b/TR5Main/Game/Lara/lara_hang.cpp index 0669e83fb..df922a26b 100644 --- a/TR5Main/Game/Lara/lara_hang.cpp +++ b/TR5Main/Game/Lara/lara_hang.cpp @@ -224,8 +224,9 @@ void lara_as_extcornerl(ITEM_INFO* item, COLL_INFO* coll)//1A1F0(<), 1A324(<) (F { /*state 107*/ /*collision: lara_default_col*/ - Camera.laraNode = 8; - Camera.targetElevation = ANGLE(33.0f); + Camera.laraNode = LM_TORSO; + Camera.targetAngle = 0; + Camera.targetElevation = -ANGLE(33.0f); SetCornerAnim(item, coll, ANGLE(90.0f), item->animNumber == LA_SHIMMY_LEFT_CORNER_OUTER_END || item->animNumber == LA_LADDER_LEFT_CORNER_OUTER_END); @@ -235,8 +236,9 @@ void lara_as_extcornerr(ITEM_INFO* item, COLL_INFO* coll)//1A244(<), 1A378(<) (F { /*state 108*/ /*collision: lara_default_col*/ - Camera.laraNode = 8; - Camera.targetElevation = ANGLE(33.0f); + Camera.laraNode = LM_TORSO; + Camera.targetAngle = 0; + Camera.targetElevation = -ANGLE(33.0f); SetCornerAnim(item, coll, -ANGLE(90.0f), item->animNumber == LA_SHIMMY_RIGHT_CORNER_OUTER_END || item->animNumber == LA_LADDER_RIGHT_CORNER_OUTER_END); @@ -246,8 +248,9 @@ void lara_as_intcornerl(ITEM_INFO* item, COLL_INFO* coll)//1A298(<), 1A3CC(<) (F { /*state 109*/ /*collision: lara_default_col*/ - Camera.laraNode = 8; - Camera.targetElevation = ANGLE(33.0f); + Camera.targetAngle = 0; + Camera.laraNode = LM_TORSO; + Camera.targetElevation = -ANGLE(33.0f); SetCornerAnim(item, coll, -ANGLE(90.0f), item->animNumber == LA_SHIMMY_LEFT_CORNER_INNER_END || item->animNumber == LA_LADDER_LEFT_CORNER_INNER_END); @@ -257,8 +260,9 @@ void lara_as_intcornerr(ITEM_INFO* item, COLL_INFO* coll)//1A2EC(<), 1A420(<) (F { /*state 110*/ /*collision: lara_default_col*/ - Camera.laraNode = 8; - Camera.targetElevation = ANGLE(33.0f); + Camera.laraNode = LM_TORSO; + Camera.targetAngle = 0; + Camera.targetElevation = -ANGLE(33.0f); SetCornerAnim(item, coll, ANGLE(90.0f), item->animNumber == LA_SHIMMY_RIGHT_CORNER_INNER_END || item->animNumber == LA_LADDER_RIGHT_CORNER_INNER_END); From 497ccdd6f8567ad08a114f8c0f808f217e879ae3 Mon Sep 17 00:00:00 2001 From: asasas9500 Date: Thu, 28 Jan 2021 13:30:23 -0300 Subject: [PATCH 15/23] Fix crawl to hang --- TR5Main/Game/Lara/lara_crawl.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/TR5Main/Game/Lara/lara_crawl.cpp b/TR5Main/Game/Lara/lara_crawl.cpp index 2d79c9755..1b748c4bc 100644 --- a/TR5Main/Game/Lara/lara_crawl.cpp +++ b/TR5Main/Game/Lara/lara_crawl.cpp @@ -393,7 +393,7 @@ void lara_col_all4s(ITEM_INFO* item, COLL_INFO* coll)//14B40, 14C74 (F) short heightl = 0; short heightr = 0; - if (height != NO_HEIGHT && height <= 256) + if (height != NO_HEIGHT && height <= -256) { if (TrInput & IN_ACTION) { From e943098d31033113ef2e2f28b1518b7c899f856f Mon Sep 17 00:00:00 2001 From: asasas9500 Date: Thu, 28 Jan 2021 20:49:30 -0300 Subject: [PATCH 16/23] Fix boxes --- TR5Main/Game/box.cpp | 20 ++++++++++++-------- TR5Main/Specific/level.cpp | 2 +- 2 files changed, 13 insertions(+), 9 deletions(-) diff --git a/TR5Main/Game/box.cpp b/TR5Main/Game/box.cpp index f8cc85faf..d8c18c8d5 100644 --- a/TR5Main/Game/box.cpp +++ b/TR5Main/Game/box.cpp @@ -1426,15 +1426,19 @@ void CreatureAIInfo(ITEM_INFO* item, AI_INFO* info) info->zoneNumber = zone[item->boxNumber]; r = &g_Level.Rooms[enemy->roomNumber]; - enemy->boxNumber = XZ_GET_SECTOR(r, enemy->pos.xPos - r->x, enemy->pos.zPos - r->z).box; - info->enemyZone = zone[enemy->boxNumber]; - - if (!obj->nonLot) + int boxNumber = XZ_GET_SECTOR(r, enemy->pos.xPos - r->x, enemy->pos.zPos - r->z).box; + if (boxNumber != NO_BOX) { - if (g_Level.Boxes[enemy->boxNumber].flags & creature->LOT.blockMask) - info->enemyZone |= BLOCKED; - else if (creature->LOT.node[item->boxNumber].searchNumber == (creature->LOT.searchNumber | BLOCKED_SEARCH)) - info->enemyZone |= BLOCKED; + enemy->boxNumber = boxNumber; + info->enemyZone = zone[enemy->boxNumber]; + + if (!obj->nonLot) + { + if (g_Level.Boxes[enemy->boxNumber].flags & creature->LOT.blockMask) + info->enemyZone |= BLOCKED; + else if (creature->LOT.node[item->boxNumber].searchNumber == (creature->LOT.searchNumber | BLOCKED_SEARCH)) + info->enemyZone |= BLOCKED; + } } if (enemy == LaraItem) diff --git a/TR5Main/Specific/level.cpp b/TR5Main/Specific/level.cpp index 462218abb..165c23b87 100644 --- a/TR5Main/Specific/level.cpp +++ b/TR5Main/Specific/level.cpp @@ -130,7 +130,7 @@ int LoadItems() { FLOOR_INFO* floor = &r.floor[((mesh.z - r.z) / 1024) + r.xSize * ((mesh.x - r.x) / 1024)]; - if (floor->box == -1) + if (floor->box == NO_BOX) continue; if (!(g_Level.Boxes[floor->box].flags & BLOCKED)) From 393e6a4b27920164634e4a002ba8369d828bd28e Mon Sep 17 00:00:00 2001 From: asasas9500 Date: Fri, 29 Jan 2021 01:14:20 -0300 Subject: [PATCH 17/23] Fix body part; Fix lara_col_all4s() --- TR5Main/Game/Lara/lara_crawl.cpp | 4 +--- TR5Main/Objects/TR5/Object/tr5_bodypart.cpp | 10 ++++++---- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/TR5Main/Game/Lara/lara_crawl.cpp b/TR5Main/Game/Lara/lara_crawl.cpp index 1b748c4bc..d8e2c1d7b 100644 --- a/TR5Main/Game/Lara/lara_crawl.cpp +++ b/TR5Main/Game/Lara/lara_crawl.cpp @@ -426,15 +426,13 @@ void lara_col_all4s(ITEM_INFO* item, COLL_INFO* coll)//14B40, 14C74 (F) slope < 120) { int tmp; - ITEM_INFO* tmp1; - MESH_INFO* tmp2; int x = item->pos.xPos; int z = item->pos.zPos; item->pos.xPos -= 100 * phd_sin(coll->facing); item->pos.zPos -= 100 * phd_cos(coll->facing); - tmp = GetCollidedObjects(item, 100, 1, &tmp1, &tmp2, 0); + tmp = GetCollidedObjects(item, 100, 1, CollidedItems, CollidedMeshes, 0); item->pos.xPos = x; item->pos.zPos = z; diff --git a/TR5Main/Objects/TR5/Object/tr5_bodypart.cpp b/TR5Main/Objects/TR5/Object/tr5_bodypart.cpp index a9022fec1..686d045a1 100644 --- a/TR5Main/Objects/TR5/Object/tr5_bodypart.cpp +++ b/TR5Main/Objects/TR5/Object/tr5_bodypart.cpp @@ -20,15 +20,17 @@ void ControlBodyPart(short fxNumber) } else { + int modulus = 62 - fx->counter; + int random = modulus <= 1 ? 0 : 2 * GetRandomControl() % modulus; if (fxNumber & 1) { - fx->pos.zRot -= 2 * (GetRandomControl() % (62 - fx->counter)); - fx->pos.xRot += 2 * (GetRandomControl() % (62 - fx->counter)); + fx->pos.zRot -= random; + fx->pos.xRot += random; } else { - fx->pos.zRot += 2 * (GetRandomControl() % (62 - fx->counter)); - fx->pos.xRot -= 2 * (GetRandomControl() % (62 - fx->counter)); + fx->pos.zRot += random; + fx->pos.xRot -= random; } if (--fx->counter < 8) fx->fallspeed += 2; From 457889bdb735b22553e0382516f4eb9656a9ec2d Mon Sep 17 00:00:00 2001 From: Trxye Date: Mon, 1 Feb 2021 13:06:20 -0600 Subject: [PATCH 18/23] add release stuff to gitignore --- .gitignore | 1 + 1 file changed, 1 insertion(+) diff --git a/.gitignore b/.gitignore index 5617ff4bc..2e8ccd9ad 100644 --- a/.gitignore +++ b/.gitignore @@ -20,3 +20,4 @@ x64/ *.wav *.trc *.str +/TR5Main/Release From 700c1b59076c2a8af6bf79b01875ce4963016423 Mon Sep 17 00:00:00 2001 From: asasas9500 Date: Wed, 3 Feb 2021 01:50:59 -0300 Subject: [PATCH 19/23] Remove function markers --- TR5Main/Game/Lara/lara.cpp | 8 +- TR5Main/Game/Lara/lara_basic.cpp | 120 +++++++++++++------------- TR5Main/Game/Lara/lara_cheat.cpp | 8 +- TR5Main/Game/Lara/lara_climb.cpp | 40 ++++----- TR5Main/Game/Lara/lara_collide.cpp | 16 ++-- TR5Main/Game/Lara/lara_crawl.cpp | 30 +++---- TR5Main/Game/Lara/lara_fire.cpp | 18 ++-- TR5Main/Game/Lara/lara_flare.cpp | 20 ++--- TR5Main/Game/Lara/lara_hang.cpp | 20 ++--- TR5Main/Game/Lara/lara_initialise.cpp | 6 +- TR5Main/Game/Lara/lara_monkey.cpp | 34 ++++---- TR5Main/Game/Lara/lara_objects.cpp | 50 +++++------ TR5Main/Game/Lara/lara_slide.cpp | 14 +-- TR5Main/Game/Lara/lara_surface.cpp | 26 +++--- TR5Main/Game/Lara/lara_swim.cpp | 38 ++++---- TR5Main/Game/Lara/lara_tests.cpp | 32 +++---- TR5Main/Game/bubble.cpp | 4 +- TR5Main/Game/collide.cpp | 4 +- TR5Main/Game/control.cpp | 14 +-- TR5Main/Game/effect.cpp | 36 ++++---- TR5Main/Game/effect2.cpp | 6 +- TR5Main/Game/flmtorch.cpp | 6 +- TR5Main/Game/rope.cpp | 44 +++++----- TR5Main/Game/tomb4fx.cpp | 22 ++--- TR5Main/Game/traps.cpp | 4 +- TR5Main/Specific/input.cpp | 2 +- 26 files changed, 311 insertions(+), 311 deletions(-) diff --git a/TR5Main/Game/Lara/lara.cpp b/TR5Main/Game/Lara/lara.cpp index e541b58c2..e827122fd 100644 --- a/TR5Main/Game/Lara/lara.cpp +++ b/TR5Main/Game/Lara/lara.cpp @@ -358,7 +358,7 @@ function lara_collision_routines[NUM_LARA_STATES + 1] = { lara_default_col }; -void LaraControl(short itemNumber) // (AF) (D) +void LaraControl(short itemNumber) { ITEM_INFO* item = LaraItem; @@ -931,7 +931,7 @@ void LaraAboveWater(ITEM_INFO* item, COLL_INFO* coll) //hmmmm TestTriggers(coll->trigger, FALSE, 0); } -void LaraUnderWater(ITEM_INFO* item, COLL_INFO* coll)//4BFB4, 4C418 (F) +void LaraUnderWater(ITEM_INFO* item, COLL_INFO* coll) { coll->badPos = 32512; coll->badNeg = -400; @@ -1041,7 +1041,7 @@ void LaraUnderWater(ITEM_INFO* item, COLL_INFO* coll)//4BFB4, 4C418 (F) TestTriggers(coll->trigger, 0, 0); } -void LaraSurface(ITEM_INFO* item, COLL_INFO* coll)//4D684, 4DAE8 (F) +void LaraSurface(ITEM_INFO* item, COLL_INFO* coll) { Camera.targetElevation = -ANGLE(22); @@ -1098,7 +1098,7 @@ void LaraSurface(ITEM_INFO* item, COLL_INFO* coll)//4D684, 4DAE8 (F) TestTriggers(coll->trigger, 0, 0); } -void LaraCheat(ITEM_INFO* item, COLL_INFO* coll) // (F) (D) +void LaraCheat(ITEM_INFO* item, COLL_INFO* coll) { LaraItem->hitPoints = 1000; LaraUnderWater(item, coll); diff --git a/TR5Main/Game/Lara/lara_basic.cpp b/TR5Main/Game/Lara/lara_basic.cpp index c03692560..a087493a1 100644 --- a/TR5Main/Game/Lara/lara_basic.cpp +++ b/TR5Main/Game/Lara/lara_basic.cpp @@ -14,12 +14,12 @@ bool DoJump = false; /*generic functions*/ -void lara_void_func(ITEM_INFO* item, COLL_INFO* coll)//19928(<), 19A5C(<) (F) +void lara_void_func(ITEM_INFO* item, COLL_INFO* coll) { return; } -void lara_default_col(ITEM_INFO* item, COLL_INFO* coll)//1C80C(<), 1C940(<) (F) +void lara_default_col(ITEM_INFO* item, COLL_INFO* coll) { Lara.moveAngle = item->pos.yRot; coll->badPos = 384; @@ -31,20 +31,20 @@ void lara_default_col(ITEM_INFO* item, COLL_INFO* coll)//1C80C(<), 1C940(<) (F) GetCollisionInfo(coll, item->pos.xPos, item->pos.yPos, item->pos.zPos, item->roomNumber, LARA_HITE); } -void lara_as_special(ITEM_INFO* item, COLL_INFO* coll)//1ADDC(<), 1AF10(<) (F) +void lara_as_special(ITEM_INFO* item, COLL_INFO* coll) { Camera.flags = CF_FOLLOW_CENTER; Camera.targetAngle = ANGLE(170.0f); Camera.targetElevation = -ANGLE(25.0f); } -void lara_as_null(ITEM_INFO* item, COLL_INFO* coll)//1A5DC(<), 1A710(<) (F) +void lara_as_null(ITEM_INFO* item, COLL_INFO* coll) { coll->enableBaddiePush = false; coll->enableSpaz = false; } -void lara_as_controlled(ITEM_INFO* item, COLL_INFO* coll)//1B0FC(<), 1B230(<) (F) +void lara_as_controlled(ITEM_INFO* item, COLL_INFO* coll) { Lara.look = false; coll->enableBaddiePush = false; @@ -57,7 +57,7 @@ void lara_as_controlled(ITEM_INFO* item, COLL_INFO* coll)//1B0FC(<), 1B230(<) (F } } -void lara_as_controlledl(ITEM_INFO* item, COLL_INFO* coll)//1B180(<), 1B2B4(<) (F) +void lara_as_controlledl(ITEM_INFO* item, COLL_INFO* coll) { Lara.look = false; coll->enableBaddiePush = false; @@ -67,7 +67,7 @@ void lara_as_controlledl(ITEM_INFO* item, COLL_INFO* coll)//1B180(<), 1B2B4(<) ( /*end generic functions*/ /*-*/ /*basic movement*/ -void lara_as_walk(ITEM_INFO* item, COLL_INFO* coll)//191B8(<), 192EC(<) (F) +void lara_as_walk(ITEM_INFO* item, COLL_INFO* coll) { /*state 0*/ /*collision: lara_col_walk*/ @@ -114,7 +114,7 @@ void lara_as_walk(ITEM_INFO* item, COLL_INFO* coll)//191B8(<), 192EC(<) (F) } } -void lara_col_walk(ITEM_INFO* item, COLL_INFO* coll)//1B3E8, 1B51C (F) +void lara_col_walk(ITEM_INFO* item, COLL_INFO* coll) { /*state 0*/ /*state code: lara_as_walk*/ @@ -180,7 +180,7 @@ void lara_col_walk(ITEM_INFO* item, COLL_INFO* coll)//1B3E8, 1B51C (F) } } -void lara_as_run(ITEM_INFO* item, COLL_INFO* coll)//192EC, 19420 (F) +void lara_as_run(ITEM_INFO* item, COLL_INFO* coll) { /*state 1*/ /*collision: lara_col_run*/ @@ -283,7 +283,7 @@ void lara_as_run(ITEM_INFO* item, COLL_INFO* coll)//192EC, 19420 (F) } } -void lara_col_run(ITEM_INFO* item, COLL_INFO* coll)//1B64C, 1B780 (F) +void lara_col_run(ITEM_INFO* item, COLL_INFO* coll) { /*state 1*/ /*state code: lara_col_run*/ @@ -531,7 +531,7 @@ void lara_as_stop(ITEM_INFO* item, COLL_INFO* coll) } } -void lara_col_stop(ITEM_INFO* item, COLL_INFO* coll) // (F) (D) +void lara_col_stop(ITEM_INFO* item, COLL_INFO* coll) { /*state 2*/ /*state code: lara_as_stop*/ @@ -568,7 +568,7 @@ void lara_col_stop(ITEM_INFO* item, COLL_INFO* coll) // (F) (D) #endif } -void lara_as_forwardjump(ITEM_INFO* item, COLL_INFO* coll)//18A34, 18B68 (F) +void lara_as_forwardjump(ITEM_INFO* item, COLL_INFO* coll) { /*state 3*/ /*collision: */ @@ -609,7 +609,7 @@ void lara_as_forwardjump(ITEM_INFO* item, COLL_INFO* coll)//18A34, 18B68 (F) } } -void lara_col_forwardjump(ITEM_INFO* item, COLL_INFO* coll)//18B88, 18CBC (F) +void lara_col_forwardjump(ITEM_INFO* item, COLL_INFO* coll) { /*state 3*/ /*state code: lara_as_forwardjump*/ @@ -661,14 +661,14 @@ void lara_col_forwardjump(ITEM_INFO* item, COLL_INFO* coll)//18B88, 18CBC (F) } } -void lara_col_pose(ITEM_INFO* item, COLL_INFO* coll)//1B87C(<), 1B9B0(<) (F) +void lara_col_pose(ITEM_INFO* item, COLL_INFO* coll) { /*state 4*/ /*state code: lara_void_func*/ lara_col_stop(item, coll); } -void lara_as_fastback(ITEM_INFO* item, COLL_INFO* coll)//1959C(<), 196D0(<) (F) +void lara_as_fastback(ITEM_INFO* item, COLL_INFO* coll) { /*state: 5*/ /*collision: lara_col_fastback*/ @@ -687,7 +687,7 @@ void lara_as_fastback(ITEM_INFO* item, COLL_INFO* coll)//1959C(<), 196D0(<) (F) } } -void lara_col_fastback(ITEM_INFO* item, COLL_INFO* coll)//1B89C, 1B9D0 (F) +void lara_col_fastback(ITEM_INFO* item, COLL_INFO* coll) { /*state: 5*/ /*state code: lara_as_fastback*/ @@ -730,7 +730,7 @@ void lara_col_fastback(ITEM_INFO* item, COLL_INFO* coll)//1B89C, 1B9D0 (F) } } -void lara_as_turn_r(ITEM_INFO* item, COLL_INFO* coll)//19628(<), 1975C(<) (F) +void lara_as_turn_r(ITEM_INFO* item, COLL_INFO* coll) { /*state: 6*/ /*collision: */ @@ -780,7 +780,7 @@ void lara_as_turn_r(ITEM_INFO* item, COLL_INFO* coll)//19628(<), 1975C(<) (F) } } -void lara_col_turn_r(ITEM_INFO* item, COLL_INFO* coll) // (F) (D) +void lara_col_turn_r(ITEM_INFO* item, COLL_INFO* coll) { /*state: 6*/ /*state code: lara_as_turn_r*/ @@ -824,7 +824,7 @@ void lara_col_turn_r(ITEM_INFO* item, COLL_INFO* coll) // (F) (D) #endif } -void lara_as_turn_l(ITEM_INFO* item, COLL_INFO* coll)//1972C(<), 19860(<) (F) +void lara_as_turn_l(ITEM_INFO* item, COLL_INFO* coll) { /*state 7*/ /*collision: lara_col_turn_l*/ @@ -873,14 +873,14 @@ void lara_as_turn_l(ITEM_INFO* item, COLL_INFO* coll)//1972C(<), 19860(<) (F) } } -void lara_col_turn_l(ITEM_INFO* item, COLL_INFO* coll) // (F) (D) +void lara_col_turn_l(ITEM_INFO* item, COLL_INFO* coll) { /*state 7*/ /*state code: lara_as_turn_l*/ lara_col_turn_r(item, coll); } -void lara_as_death(ITEM_INFO* item, COLL_INFO* coll)//19830(<), 19964(<) (F) +void lara_as_death(ITEM_INFO* item, COLL_INFO* coll) { /*state 8*/ /*collision: lara_col_death*/ @@ -897,7 +897,7 @@ void lara_as_death(ITEM_INFO* item, COLL_INFO* coll)//19830(<), 19964(<) (F) } } -void lara_col_death(ITEM_INFO* item, COLL_INFO* coll)//1BADC(<), 1BC10(<) (F) +void lara_col_death(ITEM_INFO* item, COLL_INFO* coll) { /*state 8*/ /*state code: lara_as_death*/ @@ -920,7 +920,7 @@ void lara_col_death(ITEM_INFO* item, COLL_INFO* coll)//1BADC(<), 1BC10(<) (F) item->pos.yPos += coll->midFloor; } -void lara_as_fastfall(ITEM_INFO* item, COLL_INFO* coll)//198BC(<), 199F0(<) (F) +void lara_as_fastfall(ITEM_INFO* item, COLL_INFO* coll) { /*state 9*/ /*collision: lara_col_fastfall*/ @@ -929,7 +929,7 @@ void lara_as_fastfall(ITEM_INFO* item, COLL_INFO* coll)//198BC(<), 199F0(<) (F) SoundEffect(SFX_LARA_FALL, &item->pos, 0); } -void lara_col_fastfall(ITEM_INFO* item, COLL_INFO* coll)//1BB88, 1BCBC (F) +void lara_col_fastfall(ITEM_INFO* item, COLL_INFO* coll) { /*state 9*/ /*state code: lara_as_fastfall*/ @@ -967,7 +967,7 @@ void lara_col_fastfall(ITEM_INFO* item, COLL_INFO* coll)//1BB88, 1BCBC (F) } } -void lara_as_reach(ITEM_INFO* item, COLL_INFO* coll)//18CE0(<), 18E14(<) (F) +void lara_as_reach(ITEM_INFO* item, COLL_INFO* coll) { /*state 11*/ /*collision: lara_col_reach*/ @@ -976,7 +976,7 @@ void lara_as_reach(ITEM_INFO* item, COLL_INFO* coll)//18CE0(<), 18E14(<) (F) item->goalAnimState = LS_FREEFALL; } -void lara_col_reach(ITEM_INFO* item, COLL_INFO* coll)//18D0C, 18E40 (F) +void lara_col_reach(ITEM_INFO* item, COLL_INFO* coll) { /*state 11*/ /*state code: lara_as_reach*/ @@ -1141,12 +1141,12 @@ void lara_col_reach(ITEM_INFO* item, COLL_INFO* coll)//18D0C, 18E40 (F) } } -void lara_as_splat(ITEM_INFO* item, COLL_INFO* coll)//1A340(<), 1A474(<) (F) +void lara_as_splat(ITEM_INFO* item, COLL_INFO* coll) { Lara.look = false; } -void lara_col_splat(ITEM_INFO* item, COLL_INFO* coll)//1BC74(<), 1BDA8(<) (F) +void lara_col_splat(ITEM_INFO* item, COLL_INFO* coll) { Lara.moveAngle = item->pos.yRot; @@ -1165,7 +1165,7 @@ void lara_col_splat(ITEM_INFO* item, COLL_INFO* coll)//1BC74(<), 1BDA8(<) (F) item->pos.yPos += coll->midFloor; } -void lara_col_land(ITEM_INFO* item, COLL_INFO* coll)//1BD10(<), 1BE44(<) (F) +void lara_col_land(ITEM_INFO* item, COLL_INFO* coll) { /*state 14*/ /*state code: lara_void_func*/ @@ -1204,7 +1204,7 @@ void lara_as_compress(ITEM_INFO* item, COLL_INFO* coll) item->goalAnimState = LS_FREEFALL; } -void lara_col_compress(ITEM_INFO* item, COLL_INFO* coll)//1BD30, 1BE64 (F) +void lara_col_compress(ITEM_INFO* item, COLL_INFO* coll) { /*state 15*/ /*state code: lara_as_compress*/ @@ -1241,7 +1241,7 @@ void lara_col_compress(ITEM_INFO* item, COLL_INFO* coll)//1BD30, 1BE64 (F) } } -void lara_as_back(ITEM_INFO* item, COLL_INFO* coll)//1A4F0(<), 1A624(<) (F) +void lara_as_back(ITEM_INFO* item, COLL_INFO* coll) { /*state 16*/ /*collision: lara_col_back*/ @@ -1273,7 +1273,7 @@ void lara_as_back(ITEM_INFO* item, COLL_INFO* coll)//1A4F0(<), 1A624(<) (F) } } -void lara_col_back(ITEM_INFO* item, COLL_INFO* coll) // (F) (D) +void lara_col_back(ITEM_INFO* item, COLL_INFO* coll) { /*state 16*/ /*state code: lara_as_back*/ @@ -1321,7 +1321,7 @@ void lara_col_back(ITEM_INFO* item, COLL_INFO* coll) // (F) (D) #endif } -void lara_as_fastturn(ITEM_INFO* item, COLL_INFO* coll)//1A5F8(<), 1A72C(<) (F) +void lara_as_fastturn(ITEM_INFO* item, COLL_INFO* coll) { /*state 20*/ /*collision: lara_col_fastturn*/ @@ -1347,14 +1347,14 @@ void lara_as_fastturn(ITEM_INFO* item, COLL_INFO* coll)//1A5F8(<), 1A72C(<) (F) } } -void lara_col_fastturn(ITEM_INFO* item, COLL_INFO* coll)//1A65C(<), 1A790(<) (F) +void lara_col_fastturn(ITEM_INFO* item, COLL_INFO* coll) { /*state 20*/ /*state code: lara_as_fastturn*/ lara_col_stop(item, coll); } -void lara_as_stepright(ITEM_INFO* item, COLL_INFO* coll)//1A67C(<), 1A7B0(<) (F) +void lara_as_stepright(ITEM_INFO* item, COLL_INFO* coll) { /*state 21*/ /*collision: lara_col_stepright*/ @@ -1388,7 +1388,7 @@ void lara_as_stepright(ITEM_INFO* item, COLL_INFO* coll)//1A67C(<), 1A7B0(<) (F) } } -void lara_col_stepright(ITEM_INFO* item, COLL_INFO* coll)//1BFB0, 1C0E4 (F) +void lara_col_stepright(ITEM_INFO* item, COLL_INFO* coll) { /*state 21*/ /*state code: lara_as_stepright*/ @@ -1424,7 +1424,7 @@ void lara_col_stepright(ITEM_INFO* item, COLL_INFO* coll)//1BFB0, 1C0E4 (F) } } -void lara_as_stepleft(ITEM_INFO* item, COLL_INFO* coll)//1A750(<), 1A884(<) (F) +void lara_as_stepleft(ITEM_INFO* item, COLL_INFO* coll) { /*state 22*/ /*collision: lara_col_stepleft*/ @@ -1458,14 +1458,14 @@ void lara_as_stepleft(ITEM_INFO* item, COLL_INFO* coll)//1A750(<), 1A884(<) (F) } } -void lara_col_stepleft(ITEM_INFO* item, COLL_INFO* coll)//1C0E8(<), 1C21C(<) (F) +void lara_col_stepleft(ITEM_INFO* item, COLL_INFO* coll) { /*state 22*/ /*state code: lara_as_stepleft*/ lara_col_stepright(item, coll); } -void lara_col_roll2(ITEM_INFO* item, COLL_INFO* coll)//1C384, 1C4B8 (F) +void lara_col_roll2(ITEM_INFO* item, COLL_INFO* coll) { /*state 23*/ /*state code: lara_void_func*/ @@ -1505,7 +1505,7 @@ void lara_col_roll2(ITEM_INFO* item, COLL_INFO* coll)//1C384, 1C4B8 (F) item->pos.yPos += coll->midFloor; } -void lara_as_backjump(ITEM_INFO* item, COLL_INFO* coll)//1A854(<), 1A988(<) (F) +void lara_as_backjump(ITEM_INFO* item, COLL_INFO* coll) { /*state 25*/ /*collision: lara_col_backjump*/ @@ -1527,7 +1527,7 @@ void lara_as_backjump(ITEM_INFO* item, COLL_INFO* coll)//1A854(<), 1A988(<) (F) } } -void lara_col_backjump(ITEM_INFO* item, COLL_INFO* coll)//1C130(<), 1C264(<) (F) +void lara_col_backjump(ITEM_INFO* item, COLL_INFO* coll) { /*state 25*/ /*state code: lara_as_backjump*/ @@ -1535,7 +1535,7 @@ void lara_col_backjump(ITEM_INFO* item, COLL_INFO* coll)//1C130(<), 1C264(<) (F) lara_col_jumper(item, coll); } -void lara_as_rightjump(ITEM_INFO* item, COLL_INFO* coll)//1A8C4(<), 1A9F8(<) (F) +void lara_as_rightjump(ITEM_INFO* item, COLL_INFO* coll) { /*state 26*/ /*collision: lara_col_rightjump*/ @@ -1546,7 +1546,7 @@ void lara_as_rightjump(ITEM_INFO* item, COLL_INFO* coll)//1A8C4(<), 1A9F8(<) (F) item->goalAnimState = LS_JUMP_ROLL_180; } -void lara_col_rightjump(ITEM_INFO* item, COLL_INFO* coll)//1C15C(<), 1C290(<) (F) +void lara_col_rightjump(ITEM_INFO* item, COLL_INFO* coll) { /*state 26*/ /*state code: lara_as_rightjump*/ @@ -1554,7 +1554,7 @@ void lara_col_rightjump(ITEM_INFO* item, COLL_INFO* coll)//1C15C(<), 1C290(<) (F lara_col_jumper(item, coll); } -void lara_as_leftjump(ITEM_INFO* item, COLL_INFO* coll)//1A92C(<), 1AA60(<) (F) +void lara_as_leftjump(ITEM_INFO* item, COLL_INFO* coll) { /*state 27*/ /*collision: lara_col_leftjump*/ @@ -1565,7 +1565,7 @@ void lara_as_leftjump(ITEM_INFO* item, COLL_INFO* coll)//1A92C(<), 1AA60(<) (F) item->goalAnimState = LS_JUMP_ROLL_180; } -void lara_col_leftjump(ITEM_INFO* item, COLL_INFO* coll)//1C188(<), 1C2BC(<) (F) +void lara_col_leftjump(ITEM_INFO* item, COLL_INFO* coll) { /*state 27*/ /*state code: lara_as_leftjump*/ @@ -1600,7 +1600,7 @@ void lara_col_jumper(ITEM_INFO* item, COLL_INFO* coll) } } -void lara_as_upjump(ITEM_INFO* item, COLL_INFO* coll) // (F) (D) +void lara_as_upjump(ITEM_INFO* item, COLL_INFO* coll) { /*state 28*/ /*collision: lara_col_upjump*/ @@ -1610,7 +1610,7 @@ void lara_as_upjump(ITEM_INFO* item, COLL_INFO* coll) // (F) (D) } } -void lara_col_upjump(ITEM_INFO* item, COLL_INFO* coll) // (F) (D) +void lara_col_upjump(ITEM_INFO* item, COLL_INFO* coll) { /*state 28*/ /*state code: lara_as_upjump*/ @@ -1774,7 +1774,7 @@ void lara_col_upjump(ITEM_INFO* item, COLL_INFO* coll) // (F) (D) } } -void lara_as_fallback(ITEM_INFO* item, COLL_INFO* coll)//1959C(<), 196D0(<) (F) +void lara_as_fallback(ITEM_INFO* item, COLL_INFO* coll) { /*state 29*/ /*collision: lara_col_fallback*/ @@ -1786,7 +1786,7 @@ void lara_as_fallback(ITEM_INFO* item, COLL_INFO* coll)//1959C(<), 196D0(<) (F) item->goalAnimState = LS_REACH; } -void lara_col_fallback(ITEM_INFO* item, COLL_INFO* coll)//1C1B4(<), 1C2E8(<) (F) +void lara_col_fallback(ITEM_INFO* item, COLL_INFO* coll) { /*state 29*/ /*state code: lara_as_fallback*/ @@ -1815,7 +1815,7 @@ void lara_col_fallback(ITEM_INFO* item, COLL_INFO* coll)//1C1B4(<), 1C2E8(<) (F) } } -void lara_col_roll(ITEM_INFO* item, COLL_INFO* coll)//1C2B0, 1C3E4 (F) +void lara_col_roll(ITEM_INFO* item, COLL_INFO* coll) { /*state 45*/ /*state code: lara_void_func*/ @@ -1851,7 +1851,7 @@ void lara_col_roll(ITEM_INFO* item, COLL_INFO* coll)//1C2B0, 1C3E4 (F) item->pos.yPos += coll->midFloor; } -void lara_as_swandive(ITEM_INFO* item, COLL_INFO* coll)//1AE08(<), 1AF3C(<) (F) +void lara_as_swandive(ITEM_INFO* item, COLL_INFO* coll) { /*state 52*/ /*collision: lara_col_swandive*/ @@ -1861,7 +1861,7 @@ void lara_as_swandive(ITEM_INFO* item, COLL_INFO* coll)//1AE08(<), 1AF3C(<) (F) item->goalAnimState = LS_SWANDIVE_END; } -void lara_col_swandive(ITEM_INFO* item, COLL_INFO* coll)//1C4A0(<), 1C5D4(<) (F) +void lara_col_swandive(ITEM_INFO* item, COLL_INFO* coll) { /*state 52*/ /*state code: lara_as_swandive*/ @@ -1886,7 +1886,7 @@ void lara_col_swandive(ITEM_INFO* item, COLL_INFO* coll)//1C4A0(<), 1C5D4(<) (F) } } -void lara_as_fastdive(ITEM_INFO* item, COLL_INFO* coll)//1AE4C(<), 1AF80(<) (F) +void lara_as_fastdive(ITEM_INFO* item, COLL_INFO* coll) { /*state 53*/ /*collision: lara_col_fastdive*/ @@ -1897,7 +1897,7 @@ void lara_as_fastdive(ITEM_INFO* item, COLL_INFO* coll)//1AE4C(<), 1AF80(<) (F) item->speed = (item->speed * 95) / 100; } -void lara_col_fastdive(ITEM_INFO* item, COLL_INFO* coll)//1C558(<), 1C68C(<) (F) +void lara_col_fastdive(ITEM_INFO* item, COLL_INFO* coll) { /*state 53*/ /*state code: lara_as_fastdive*/ @@ -1926,7 +1926,7 @@ void lara_col_fastdive(ITEM_INFO* item, COLL_INFO* coll)//1C558(<), 1C68C(<) (F) } } -void lara_as_gymnast(ITEM_INFO* item, COLL_INFO* coll)//1AEC8(<), 1AFFC(<) (F) +void lara_as_gymnast(ITEM_INFO* item, COLL_INFO* coll) { /*state 54*/ /*collision: lara_default_col*/ @@ -1934,7 +1934,7 @@ void lara_as_gymnast(ITEM_INFO* item, COLL_INFO* coll)//1AEC8(<), 1AFFC(<) (F) coll->enableSpaz = false; } -void lara_as_wade(ITEM_INFO* item, COLL_INFO* coll)//1AF10, 1B044 (F) +void lara_as_wade(ITEM_INFO* item, COLL_INFO* coll) { /*state 65*/ /*collision: lara_col_wade*/ @@ -2078,7 +2078,7 @@ void lara_col_wade(ITEM_INFO* item, COLL_INFO* coll) item->pos.yPos += SWAMP_GRAVITY; } -void lara_as_dash(ITEM_INFO* item, COLL_INFO* coll)//15A28, 15B5C (F) +void lara_as_dash(ITEM_INFO* item, COLL_INFO* coll) { /*state 73*/ /*collision: lara_col_dash*/ @@ -2143,7 +2143,7 @@ void lara_as_dash(ITEM_INFO* item, COLL_INFO* coll)//15A28, 15B5C (F) } } -void lara_col_dash(ITEM_INFO* item, COLL_INFO* coll)//15C50, 15D84 (F) +void lara_col_dash(ITEM_INFO* item, COLL_INFO* coll) { /*state 73*/ /*state code: lara_as_dash*/ @@ -2205,7 +2205,7 @@ void lara_col_dash(ITEM_INFO* item, COLL_INFO* coll)//15C50, 15D84 (F) } } -void lara_as_dashdive(ITEM_INFO* item, COLL_INFO* coll)//15E1C(<), 15F50(<) (F) +void lara_as_dashdive(ITEM_INFO* item, COLL_INFO* coll) { /*state 74*/ /*collision: lara_col_dashdive*/ @@ -2216,7 +2216,7 @@ void lara_as_dashdive(ITEM_INFO* item, COLL_INFO* coll)//15E1C(<), 15F50(<) (F) item->goalAnimState = LS_FREEFALL; } -void lara_col_dashdive(ITEM_INFO* item, COLL_INFO* coll)//15E5C, 15F90 (F) +void lara_col_dashdive(ITEM_INFO* item, COLL_INFO* coll) { /*state 74*/ /*state code: lara_as_dashdive*/ diff --git a/TR5Main/Game/Lara/lara_cheat.cpp b/TR5Main/Game/Lara/lara_cheat.cpp index a23919ae3..8cf9bc3cf 100644 --- a/TR5Main/Game/Lara/lara_cheat.cpp +++ b/TR5Main/Game/Lara/lara_cheat.cpp @@ -11,7 +11,7 @@ extern GameFlow* g_GameFlow; int NoCheatCounter; -void lara_as_swimcheat(ITEM_INFO* item, COLL_INFO* coll)//4C3A8, 4C80C (F) +void lara_as_swimcheat(ITEM_INFO* item, COLL_INFO* coll) { if (TrInput & IN_FORWARD) { @@ -63,7 +63,7 @@ void lara_as_swimcheat(ITEM_INFO* item, COLL_INFO* coll)//4C3A8, 4C80C (F) } } -void LaraCheatyBits() // (F) (D) +void LaraCheatyBits() { if (g_GameFlow->FlyCheat) { @@ -108,7 +108,7 @@ void LaraCheatyBits() // (F) (D) NoCheatCounter--; } -void LaraCheatGetStuff() // (F) (D) +void LaraCheatGetStuff() { Lara.NumFlares = -1; Lara.NumSmallMedipacks = -1; @@ -198,7 +198,7 @@ void LaraCheatGetStuff() // (F) (D) g_Inventory.LoadObjects(false); } -void DelsGiveLaraItemsCheat() // (AF) (D) +void DelsGiveLaraItemsCheat() { int i; diff --git a/TR5Main/Game/Lara/lara_climb.cpp b/TR5Main/Game/Lara/lara_climb.cpp index 5820c5a77..1e5584ab2 100644 --- a/TR5Main/Game/Lara/lara_climb.cpp +++ b/TR5Main/Game/Lara/lara_climb.cpp @@ -17,7 +17,7 @@ short LeftExtRightIntTab[4] = // offset 0xA0B84 0x0200, 0x0400, 0x0800, 0x0100 }; -short GetClimbTrigger(int x, int y, int z, short roomNumber) // (F) (D) +short GetClimbTrigger(int x, int y, int z, short roomNumber) { GetFloorHeight(GetFloor(x, y, z, &roomNumber), x, y, z); @@ -37,12 +37,12 @@ short GetClimbTrigger(int x, int y, int z, short roomNumber) // (F) (D) return (*data & DATA_TYPE) == CLIMB_TYPE ? *data : 0; } -void lara_col_climbend(ITEM_INFO* item, COLL_INFO* coll)//46E30(<), 47294(<) (F) +void lara_col_climbend(ITEM_INFO* item, COLL_INFO* coll) { return; } -void lara_as_climbend(ITEM_INFO* item, COLL_INFO* coll)//46DF8(<), 4725C(<) (F) +void lara_as_climbend(ITEM_INFO* item, COLL_INFO* coll) { coll->enableBaddiePush = false; coll->enableSpaz = false; @@ -51,7 +51,7 @@ void lara_as_climbend(ITEM_INFO* item, COLL_INFO* coll)//46DF8(<), 4725C(<) (F) Camera.targetAngle = -ANGLE(45); } -void lara_col_climbdown(ITEM_INFO* item, COLL_INFO* coll)//46BD0, 47034 (F) +void lara_col_climbdown(ITEM_INFO* item, COLL_INFO* coll) { if (LaraCheckForLetGo(item, coll) || item->animNumber != LA_LADDER_DOWN) @@ -132,7 +132,7 @@ void lara_col_climbdown(ITEM_INFO* item, COLL_INFO* coll)//46BD0, 47034 (F) AnimateLara(item); } -void lara_as_climbdown(ITEM_INFO* item, COLL_INFO* coll)//46BA4(<), 47008(<) (F) +void lara_as_climbdown(ITEM_INFO* item, COLL_INFO* coll) { coll->enableBaddiePush = false; coll->enableSpaz = false; @@ -140,7 +140,7 @@ void lara_as_climbdown(ITEM_INFO* item, COLL_INFO* coll)//46BA4(<), 47008(<) (F) Camera.targetElevation = -ANGLE(45); } -void lara_col_climbing(ITEM_INFO* item, COLL_INFO* coll)//469B0, 46E14 (F) +void lara_col_climbing(ITEM_INFO* item, COLL_INFO* coll) { if (!LaraCheckForLetGo(item, coll) && item->animNumber == LA_LADDER_UP) { @@ -212,7 +212,7 @@ void lara_col_climbing(ITEM_INFO* item, COLL_INFO* coll)//469B0, 46E14 (F) } } -void lara_as_climbing(ITEM_INFO* item, COLL_INFO* coll)//46984(<), 46DE8(<) (F) +void lara_as_climbing(ITEM_INFO* item, COLL_INFO* coll) { coll->enableBaddiePush = false; coll->enableSpaz = false; @@ -220,7 +220,7 @@ void lara_as_climbing(ITEM_INFO* item, COLL_INFO* coll)//46984(<), 46DE8(<) (F) Camera.targetElevation = ANGLE(30); } -void lara_col_climbright(ITEM_INFO* item, COLL_INFO* coll)//46908(<), 46D6C(<) (F) +void lara_col_climbright(ITEM_INFO* item, COLL_INFO* coll) { if (!LaraCheckForLetGo(item, coll)) { @@ -230,7 +230,7 @@ void lara_col_climbright(ITEM_INFO* item, COLL_INFO* coll)//46908(<), 46D6C(<) ( } } -void lara_as_climbright(ITEM_INFO* item, COLL_INFO* coll)//468B8(<), 46D1C(<) (F) +void lara_as_climbright(ITEM_INFO* item, COLL_INFO* coll) { coll->enableBaddiePush = false; coll->enableSpaz = false; @@ -242,7 +242,7 @@ void lara_as_climbright(ITEM_INFO* item, COLL_INFO* coll)//468B8(<), 46D1C(<) (F item->goalAnimState = LS_LADDER_IDLE; } -void lara_col_climbleft(ITEM_INFO* item, COLL_INFO* coll)//46834(<), 46C98(<) (F) +void lara_col_climbleft(ITEM_INFO* item, COLL_INFO* coll) { if (!LaraCheckForLetGo(item, coll)) { @@ -252,7 +252,7 @@ void lara_col_climbleft(ITEM_INFO* item, COLL_INFO* coll)//46834(<), 46C98(<) (F } } -void lara_as_climbleft(ITEM_INFO* item, COLL_INFO* coll)//467E4(<), 46C48(<) (F) +void lara_as_climbleft(ITEM_INFO* item, COLL_INFO* coll) { coll->enableBaddiePush = false; coll->enableSpaz = false; @@ -264,7 +264,7 @@ void lara_as_climbleft(ITEM_INFO* item, COLL_INFO* coll)//467E4(<), 46C48(<) (F) item->goalAnimState = LS_LADDER_IDLE; } -void lara_col_climbstnc(ITEM_INFO* item, COLL_INFO* coll) // (F) (D) +void lara_col_climbstnc(ITEM_INFO* item, COLL_INFO* coll) { int yShift; int resultRight, resultLeft; @@ -360,7 +360,7 @@ void lara_col_climbstnc(ITEM_INFO* item, COLL_INFO* coll) // (F) (D) } } -void lara_as_climbstnc(ITEM_INFO* item, COLL_INFO* coll)//463F0, 46854 (F) +void lara_as_climbstnc(ITEM_INFO* item, COLL_INFO* coll) { Lara.isClimbing = true; @@ -422,7 +422,7 @@ void lara_as_stepoff_right(ITEM_INFO* item, COLL_INFO* coll) item->pos.yRot += ANGLE(90.0f); } -int LaraTestClimbPos(ITEM_INFO* item, int front, int right, int origin, int height, int* shift) // (F) (D) +int LaraTestClimbPos(ITEM_INFO* item, int front, int right, int origin, int height, int* shift) { int x; int z; @@ -460,7 +460,7 @@ int LaraTestClimbPos(ITEM_INFO* item, int front, int right, int origin, int heig return LaraTestClimb(x, item->pos.yPos + origin, z, xFront, zFront, height, item->roomNumber, shift); } -void LaraDoClimbLeftRight(ITEM_INFO* item, COLL_INFO* coll, int result, int shift)//46100, 46564 (F) +void LaraDoClimbLeftRight(ITEM_INFO* item, COLL_INFO* coll, int result, int shift) { if (result == 1) { @@ -592,7 +592,7 @@ void LaraDoClimbLeftRight(ITEM_INFO* item, COLL_INFO* coll, int result, int shif AnimateLara(item); } -int LaraClimbRightCornerTest(ITEM_INFO* item, COLL_INFO* coll)//45DE4, 46248 +int LaraClimbRightCornerTest(ITEM_INFO* item, COLL_INFO* coll) { int result = 0; @@ -690,7 +690,7 @@ int LaraClimbRightCornerTest(ITEM_INFO* item, COLL_INFO* coll)//45DE4, 46248 return result; } -int LaraClimbLeftCornerTest(ITEM_INFO* item, COLL_INFO* coll)//45ABC, 45F20 +int LaraClimbLeftCornerTest(ITEM_INFO* item, COLL_INFO* coll) { int result = 0; @@ -790,7 +790,7 @@ int LaraClimbLeftCornerTest(ITEM_INFO* item, COLL_INFO* coll)//45ABC, 45F20 return result; } -int LaraTestClimb(int x, int y, int z, int xFront, int zFront, int itemHeight, int itemRoom, int* shift)//457F0, 45C54 +int LaraTestClimb(int x, int y, int z, int xFront, int zFront, int itemHeight, int itemRoom, int* shift) { *shift = 0; @@ -886,7 +886,7 @@ int LaraTestClimb(int x, int y, int z, int xFront, int zFront, int itemHeight, i return -1; } -int LaraTestClimbUpPos(ITEM_INFO* item, int front, int right, int* shift, int* ledge)//45530, 45994 +int LaraTestClimbUpPos(ITEM_INFO* item, int front, int right, int* shift, int* ledge) { int y = item->pos.yPos - 768; @@ -987,7 +987,7 @@ int LaraTestClimbUpPos(ITEM_INFO* item, int front, int right, int* shift, int* l return -2; } -int LaraCheckForLetGo(ITEM_INFO* item, COLL_INFO* coll)//45434, 45898 (F) +int LaraCheckForLetGo(ITEM_INFO* item, COLL_INFO* coll) { short roomNumber = item->roomNumber; diff --git a/TR5Main/Game/Lara/lara_collide.cpp b/TR5Main/Game/Lara/lara_collide.cpp index 82ceb3452..37e6c2460 100644 --- a/TR5Main/Game/Lara/lara_collide.cpp +++ b/TR5Main/Game/Lara/lara_collide.cpp @@ -6,7 +6,7 @@ /*this file has all the generic **collision** test functions called in lara's state code*/ -int LaraDeflectEdge(ITEM_INFO* item, COLL_INFO* coll) // (F) (D) +int LaraDeflectEdge(ITEM_INFO* item, COLL_INFO* coll) { if (coll->collType == CT_FRONT || coll->collType == CT_TOP_FRONT) { @@ -33,7 +33,7 @@ int LaraDeflectEdge(ITEM_INFO* item, COLL_INFO* coll) // (F) (D) return 0; } -void LaraDeflectEdgeJump(ITEM_INFO* item, COLL_INFO* coll)//12904, 129B4 (F) +void LaraDeflectEdgeJump(ITEM_INFO* item, COLL_INFO* coll) { ShiftItem(item, coll); @@ -96,7 +96,7 @@ void LaraDeflectEdgeJump(ITEM_INFO* item, COLL_INFO* coll)//12904, 129B4 (F) } } -int LaraDeflectEdgeDuck(ITEM_INFO* item, COLL_INFO* coll) // (F) (D) +int LaraDeflectEdgeDuck(ITEM_INFO* item, COLL_INFO* coll) { if (coll->collType == CT_FRONT || coll->collType == CT_TOP_FRONT) { @@ -122,7 +122,7 @@ int LaraDeflectEdgeDuck(ITEM_INFO* item, COLL_INFO* coll) // (F) (D) return 0; } -int LaraHitCeiling(ITEM_INFO* item, COLL_INFO* coll) // (F) (D) +int LaraHitCeiling(ITEM_INFO* item, COLL_INFO* coll) { if (coll->collType == CT_TOP || coll->collType == CT_CLAMP) { @@ -145,7 +145,7 @@ int LaraHitCeiling(ITEM_INFO* item, COLL_INFO* coll) // (F) (D) return 0; } -void LaraCollideStop(ITEM_INFO* item, COLL_INFO* coll)//126F0(<), 127A0(<) (F) +void LaraCollideStop(ITEM_INFO* item, COLL_INFO* coll) { switch (coll->oldAnimState) { @@ -177,7 +177,7 @@ void LaraCollideStop(ITEM_INFO* item, COLL_INFO* coll)//126F0(<), 127A0(<) (F) } } -void SnapLaraToEdgeOfBlock(ITEM_INFO* item, COLL_INFO* coll, short angle) // (F) (D) +void SnapLaraToEdgeOfBlock(ITEM_INFO* item, COLL_INFO* coll, short angle) { if (item->currentAnimState == LS_SHIMMY_RIGHT) { @@ -260,12 +260,12 @@ void SnapLaraToEdgeOfBlock(ITEM_INFO* item, COLL_INFO* coll, short angle) // (F) } } -short GetDirOctant(int rot)//160B4(<), 161E8(<) (F) +short GetDirOctant(int rot) { return abs(rot) >= ANGLE(45) && abs(rot) <= ANGLE(135.0f); } -void GetLaraDeadlyBounds() // (F) (D) +void GetLaraDeadlyBounds() { BOUNDING_BOX* bounds; BOUNDING_BOX tbounds; diff --git a/TR5Main/Game/Lara/lara_crawl.cpp b/TR5Main/Game/Lara/lara_crawl.cpp index d8e2c1d7b..50739eb54 100644 --- a/TR5Main/Game/Lara/lara_crawl.cpp +++ b/TR5Main/Game/Lara/lara_crawl.cpp @@ -9,7 +9,7 @@ /*this file has all the related functions to ducking and crawling*/ /*crouch/duck start*/ -void lara_as_duck(ITEM_INFO* item, COLL_INFO* coll)//14688, 14738 (F) +void lara_as_duck(ITEM_INFO* item, COLL_INFO* coll) { /*state 71*/ /*collision: lara_col_duck*/ @@ -79,7 +79,7 @@ void lara_as_duck(ITEM_INFO* item, COLL_INFO* coll)//14688, 14738 (F) } } -void lara_col_duck(ITEM_INFO* item, COLL_INFO* coll)//147C4, 148CC (F) +void lara_col_duck(ITEM_INFO* item, COLL_INFO* coll) { /*state 71*/ /*state code: lara_as_duck*/ @@ -161,7 +161,7 @@ void lara_col_crouch_roll(ITEM_INFO* item, COLL_INFO* coll) /*crouch/duck end*/ /*-*/ /*crawl start*/ -void lara_as_all4s(ITEM_INFO* item, COLL_INFO* coll)//14970, 14A78 (F) +void lara_as_all4s(ITEM_INFO* item, COLL_INFO* coll) { /*state 80*/ /*collision: lara_col_all4s*/ @@ -336,7 +336,7 @@ void lara_as_all4s(ITEM_INFO* item, COLL_INFO* coll)//14970, 14A78 (F) } } -void lara_col_all4s(ITEM_INFO* item, COLL_INFO* coll)//14B40, 14C74 (F) +void lara_col_all4s(ITEM_INFO* item, COLL_INFO* coll) { /*state 80*/ /*state code: lara_as_all4s*/ @@ -494,7 +494,7 @@ void lara_col_all4s(ITEM_INFO* item, COLL_INFO* coll)//14B40, 14C74 (F) } } -void lara_as_crawl(ITEM_INFO* item, COLL_INFO* coll)//150F4, 15228 (F) +void lara_as_crawl(ITEM_INFO* item, COLL_INFO* coll) { /*state 81*/ /*collision: lara_col_crawl*/ @@ -540,7 +540,7 @@ void lara_as_crawl(ITEM_INFO* item, COLL_INFO* coll)//150F4, 15228 (F) } } -void lara_col_crawl(ITEM_INFO* item, COLL_INFO* coll)//1523C, 15370 (F) +void lara_col_crawl(ITEM_INFO* item, COLL_INFO* coll) { /*state 81*/ /*state code: lara_as_crawl*/ @@ -586,7 +586,7 @@ void lara_col_crawl(ITEM_INFO* item, COLL_INFO* coll)//1523C, 15370 (F) } } -void lara_as_all4turnl(ITEM_INFO* item, COLL_INFO* coll)//15390(<), 154C4(<) (F) +void lara_as_all4turnl(ITEM_INFO* item, COLL_INFO* coll) { /*state 84*/ /*collision: lara_col_all4turnlr*/ @@ -607,7 +607,7 @@ void lara_as_all4turnl(ITEM_INFO* item, COLL_INFO* coll)//15390(<), 154C4(<) (F) item->goalAnimState = LS_CRAWL_IDLE; } -void lara_as_all4turnr(ITEM_INFO* item, COLL_INFO* coll)//15484(<), 155B8(<) (F) +void lara_as_all4turnr(ITEM_INFO* item, COLL_INFO* coll) { /*state 85*/ /*collision: lara_col_all4turnlr*/ @@ -628,7 +628,7 @@ void lara_as_all4turnr(ITEM_INFO* item, COLL_INFO* coll)//15484(<), 155B8(<) (F) item->goalAnimState = LS_CRAWL_IDLE; } -void lara_col_all4turnlr(ITEM_INFO* item, COLL_INFO* coll)//153FC, 15530 (F) +void lara_col_all4turnlr(ITEM_INFO* item, COLL_INFO* coll) { /*states 84 and 85*/ /*state code: lara_as_all4turnl(84) and lara_as_all4turnr(85)*/ @@ -641,7 +641,7 @@ void lara_col_all4turnlr(ITEM_INFO* item, COLL_INFO* coll)//153FC, 15530 (F) } } -void lara_as_crawlb(ITEM_INFO* item, COLL_INFO* coll)//154F0, 15624 (F) +void lara_as_crawlb(ITEM_INFO* item, COLL_INFO* coll) { /*state 86*/ /*collision: lara_col_crawlb*/ @@ -683,7 +683,7 @@ void lara_as_crawlb(ITEM_INFO* item, COLL_INFO* coll)//154F0, 15624 (F) } } -void lara_col_crawlb(ITEM_INFO* item, COLL_INFO* coll)//15614, 15748 (F) +void lara_col_crawlb(ITEM_INFO* item, COLL_INFO* coll) { /*state 86*/ /*state code: lara_as_crawlb*/ @@ -729,7 +729,7 @@ void lara_col_crawlb(ITEM_INFO* item, COLL_INFO* coll)//15614, 15748 (F) } } -void lara_as_duckl(ITEM_INFO* item, COLL_INFO* coll) // (F) (D) +void lara_as_duckl(ITEM_INFO* item, COLL_INFO* coll) { /*state 105*/ /*collision: lara_col_ducklr*/ @@ -739,7 +739,7 @@ void lara_as_duckl(ITEM_INFO* item, COLL_INFO* coll) // (F) (D) item->pos.yRot -= ANGLE(1.5f); } -void lara_as_duckr(ITEM_INFO* item, COLL_INFO* coll) // (F) (D) +void lara_as_duckr(ITEM_INFO* item, COLL_INFO* coll) { /*state 106*/ /*collision: lara_col_ducklr*/ @@ -749,7 +749,7 @@ void lara_as_duckr(ITEM_INFO* item, COLL_INFO* coll) // (F) (D) item->pos.yRot += ANGLE(1.5f); } -void lara_col_ducklr(ITEM_INFO* item, COLL_INFO* coll)//14534, 145E4 (F) +void lara_col_ducklr(ITEM_INFO* item, COLL_INFO* coll) { /*state 105 and 106*/ /*state code: lara_as_duckl(105) and lara_col_ducklr(106)*/ @@ -790,7 +790,7 @@ void lara_col_ducklr(ITEM_INFO* item, COLL_INFO* coll)//14534, 145E4 (F) } /*crawling end*/ -void lara_col_crawl2hang(ITEM_INFO* item, COLL_INFO* coll)//15770, 158A4 (F) +void lara_col_crawl2hang(ITEM_INFO* item, COLL_INFO* coll) { Camera.targetAngle = 0; Camera.targetElevation = -ANGLE(45.0f); diff --git a/TR5Main/Game/Lara/lara_fire.cpp b/TR5Main/Game/Lara/lara_fire.cpp index a13e11cb3..bbe38b486 100644 --- a/TR5Main/Game/Lara/lara_fire.cpp +++ b/TR5Main/Game/Lara/lara_fire.cpp @@ -258,7 +258,7 @@ bool MonksAttackLara; ITEM_INFO* LastTargets[8]; ITEM_INFO* TargetList[8]; -GAME_OBJECT_ID WeaponObject(int weaponType) // (F) (D) +GAME_OBJECT_ID WeaponObject(int weaponType) { switch (weaponType) { @@ -285,7 +285,7 @@ GAME_OBJECT_ID WeaponObject(int weaponType) // (F) (D) } } -void AimWeapon(WEAPON_INFO* winfo, LARA_ARM* arm) // (F) (D) +void AimWeapon(WEAPON_INFO* winfo, LARA_ARM* arm) { short rotY, rotX, speed, x, y; @@ -328,14 +328,14 @@ void AimWeapon(WEAPON_INFO* winfo, LARA_ARM* arm) // (F) (D) arm->zRot = 0; } -void SmashItem(short itemNum) // (F) (D) +void SmashItem(short itemNum) { ITEM_INFO* item = &g_Level.Items[itemNum]; if (item->objectNumber >= ID_SMASH_OBJECT1 && item->objectNumber <= ID_SMASH_OBJECT8) SmashObject(itemNum); } -void LaraGun() // (F) (D) +void LaraGun() { if (Lara.leftArm.flash_gun > 0) --Lara.leftArm.flash_gun; @@ -720,7 +720,7 @@ void HitTarget(ITEM_INFO* item, GAME_VECTOR* hitPos, int damage, int flag) } } -FireWeaponType FireWeapon(int weaponType, ITEM_INFO* target, ITEM_INFO* src, short* angles) // (F) (D) +FireWeaponType FireWeapon(int weaponType, ITEM_INFO* target, ITEM_INFO* src, short* angles) { Ammo& ammo = GetAmmo(weaponType); if (ammo.getCount() == 0 && !ammo.hasInfinite()) @@ -845,7 +845,7 @@ FireWeaponType FireWeapon(int weaponType, ITEM_INFO* target, ITEM_INFO* src, sho } } -void find_target_point(ITEM_INFO* item, GAME_VECTOR* target) // (F) (D) +void find_target_point(ITEM_INFO* item, GAME_VECTOR* target) { BOUNDING_BOX* bounds; int x, y, z; @@ -864,7 +864,7 @@ void find_target_point(ITEM_INFO* item, GAME_VECTOR* target) // (F) (D) target->roomNumber = item->roomNumber; } -void LaraTargetInfo(WEAPON_INFO* weapon) // (F) (D) +void LaraTargetInfo(WEAPON_INFO* weapon) { if (Lara.target == nullptr) { @@ -931,7 +931,7 @@ void LaraTargetInfo(WEAPON_INFO* weapon) // (F) (D) Lara.targetAngles[1] = angles[1]; } -bool CheckForHoldingState(int state) // (F) (D) +bool CheckForHoldingState(int state) { #if 0 if (Lara.ExtraAnim != NO_ITEM) @@ -949,7 +949,7 @@ bool CheckForHoldingState(int state) // (F) (D) return false; } -void LaraGetNewTarget(WEAPON_INFO* weapon) // (F) (D) +void LaraGetNewTarget(WEAPON_INFO* weapon) { GAME_VECTOR src, target; PHD_VECTOR muzzleOffset; diff --git a/TR5Main/Game/Lara/lara_flare.cpp b/TR5Main/Game/Lara/lara_flare.cpp index c8399648d..c399a4ca0 100644 --- a/TR5Main/Game/Lara/lara_flare.cpp +++ b/TR5Main/Game/Lara/lara_flare.cpp @@ -19,7 +19,7 @@ constexpr std::array FlareFlickerTableLow = { 0.7590,0.1880,0.0790,0. using namespace T5M::Math::Random; -void FlareControl(short itemNumber) // (AF) (D) +void FlareControl(short itemNumber) { ITEM_INFO* item = &g_Level.Items[itemNumber]; @@ -88,7 +88,7 @@ void FlareControl(short itemNumber) // (AF) (D) item->data = (void*)age; } -void ready_flare() // (F) (D) +void ready_flare() { Lara.gunStatus = LG_NO_ARMS; Lara.leftArm.zRot = 0; @@ -102,17 +102,17 @@ void ready_flare() // (F) (D) Lara.target = NULL; } -void undraw_flare_meshes() // (F) (D) +void undraw_flare_meshes() { Lara.meshPtrs[LM_LHAND] = Objects[ID_LARA_SKIN].meshIndex + LM_LHAND; } -void draw_flare_meshes() // (F) (D) +void draw_flare_meshes() { Lara.meshPtrs[LM_LHAND] = Objects[ID_LARA_FLARE_ANIM].meshIndex + LM_LHAND; } -void undraw_flare() // (F) (D) +void undraw_flare() { Lara.flareControlLeft = true; @@ -225,7 +225,7 @@ void undraw_flare() // (F) (D) set_flare_arm(Lara.leftArm.frameNumber); } -void draw_flare() // (F) (D) +void draw_flare() { short frame; @@ -275,7 +275,7 @@ void draw_flare() // (F) (D) } } -void set_flare_arm(int frame) // (F) (D) +void set_flare_arm(int frame) { short anim = Objects[ID_LARA_FLARE_ANIM].animIndex; @@ -300,7 +300,7 @@ void set_flare_arm(int frame) // (F) (D) Lara.leftArm.frameBase = g_Level.Anims[anim].framePtr; } -void CreateFlare(short objectNum, int thrown) // (F) (D) +void CreateFlare(short objectNum, int thrown) { short itemNum = CreateItem(); if (itemNum != NO_ITEM) @@ -383,7 +383,7 @@ void DrawFlareInAir(ITEM_INFO* item) printf("DrawFlareInAir() not implemented !"); } -void DoFlareInHand(int flare_age) // (AF) (D) +void DoFlareInHand(int flare_age) { PHD_VECTOR pos; @@ -408,7 +408,7 @@ void DoFlareInHand(int flare_age) // (AF) (D) } } -int DoFlareLight(PHD_VECTOR* pos, int age)//49708, 49B6C (F) +int DoFlareLight(PHD_VECTOR* pos, int age) { int x, y, z; int r, g, b; diff --git a/TR5Main/Game/Lara/lara_hang.cpp b/TR5Main/Game/Lara/lara_hang.cpp index df922a26b..1b5288888 100644 --- a/TR5Main/Game/Lara/lara_hang.cpp +++ b/TR5Main/Game/Lara/lara_hang.cpp @@ -6,7 +6,7 @@ /*this file has all the lara_as/lara_col functions related to hanging*/ /*normal hanging and shimmying*/ -void lara_as_hang(ITEM_INFO* item, COLL_INFO* coll)//19A28, 19B5C (F) +void lara_as_hang(ITEM_INFO* item, COLL_INFO* coll) { /*state 10*/ /*collision: lara_col_hang*/ @@ -28,7 +28,7 @@ void lara_as_hang(ITEM_INFO* item, COLL_INFO* coll)//19A28, 19B5C (F) Camera.targetElevation = -ANGLE(45.0f); } -void lara_col_hang(ITEM_INFO* item, COLL_INFO* coll)//19AC8, 19BFC (F) +void lara_col_hang(ITEM_INFO* item, COLL_INFO* coll) { /*state 10*/ /*state code: lara_as_hang*/ @@ -174,7 +174,7 @@ void lara_col_hang(ITEM_INFO* item, COLL_INFO* coll)//19AC8, 19BFC (F) } } -void lara_as_hangleft(ITEM_INFO* item, COLL_INFO* coll) // (F) (D) +void lara_as_hangleft(ITEM_INFO* item, COLL_INFO* coll) { /*state 30*/ /*collision: lara_col_hangleft*/ @@ -186,7 +186,7 @@ void lara_as_hangleft(ITEM_INFO* item, COLL_INFO* coll) // (F) (D) item->goalAnimState = LS_HANG; } -void lara_col_hangleft(ITEM_INFO* item, COLL_INFO* coll) // (F) (D) +void lara_col_hangleft(ITEM_INFO* item, COLL_INFO* coll) { /*state 30*/ /*state code: lara_as_hangleft*/ @@ -196,7 +196,7 @@ void lara_col_hangleft(ITEM_INFO* item, COLL_INFO* coll) // (F) (D) Lara.moveAngle = item->pos.yRot - ANGLE(90); } -void lara_as_hangright(ITEM_INFO* item, COLL_INFO* coll) // (F) (D) +void lara_as_hangright(ITEM_INFO* item, COLL_INFO* coll) { /*state 31*/ /*collision: lara_col_hangright*/ @@ -208,7 +208,7 @@ void lara_as_hangright(ITEM_INFO* item, COLL_INFO* coll) // (F) (D) item->goalAnimState = LS_HANG; } -void lara_col_hangright(ITEM_INFO* item, COLL_INFO* coll) // (F) (D) +void lara_col_hangright(ITEM_INFO* item, COLL_INFO* coll) { /*state 31*/ /*state code: lara_as_hangright*/ @@ -220,7 +220,7 @@ void lara_col_hangright(ITEM_INFO* item, COLL_INFO* coll) // (F) (D) /*go around corners*/ -void lara_as_extcornerl(ITEM_INFO* item, COLL_INFO* coll)//1A1F0(<), 1A324(<) (F) +void lara_as_extcornerl(ITEM_INFO* item, COLL_INFO* coll) { /*state 107*/ /*collision: lara_default_col*/ @@ -232,7 +232,7 @@ void lara_as_extcornerl(ITEM_INFO* item, COLL_INFO* coll)//1A1F0(<), 1A324(<) (F item->animNumber == LA_LADDER_LEFT_CORNER_OUTER_END); } -void lara_as_extcornerr(ITEM_INFO* item, COLL_INFO* coll)//1A244(<), 1A378(<) (F) +void lara_as_extcornerr(ITEM_INFO* item, COLL_INFO* coll) { /*state 108*/ /*collision: lara_default_col*/ @@ -244,7 +244,7 @@ void lara_as_extcornerr(ITEM_INFO* item, COLL_INFO* coll)//1A244(<), 1A378(<) (F item->animNumber == LA_LADDER_RIGHT_CORNER_OUTER_END); } -void lara_as_intcornerl(ITEM_INFO* item, COLL_INFO* coll)//1A298(<), 1A3CC(<) (F) +void lara_as_intcornerl(ITEM_INFO* item, COLL_INFO* coll) { /*state 109*/ /*collision: lara_default_col*/ @@ -256,7 +256,7 @@ void lara_as_intcornerl(ITEM_INFO* item, COLL_INFO* coll)//1A298(<), 1A3CC(<) (F item->animNumber == LA_LADDER_LEFT_CORNER_INNER_END); } -void lara_as_intcornerr(ITEM_INFO* item, COLL_INFO* coll)//1A2EC(<), 1A420(<) (F) +void lara_as_intcornerr(ITEM_INFO* item, COLL_INFO* coll) { /*state 110*/ /*collision: lara_default_col*/ diff --git a/TR5Main/Game/Lara/lara_initialise.cpp b/TR5Main/Game/Lara/lara_initialise.cpp index dcdb1aafd..13add6693 100644 --- a/TR5Main/Game/Lara/lara_initialise.cpp +++ b/TR5Main/Game/Lara/lara_initialise.cpp @@ -100,7 +100,7 @@ void InitialiseLara(int restore) Lara.wetcloth = CLOTH_MISSING; } -void LaraInitialiseMeshes() // (AF) (D) +void LaraInitialiseMeshes() { for (int i = 0; i < NUM_LARA_MESHES; i++) { @@ -133,7 +133,7 @@ void LaraInitialiseMeshes() // (AF) (D) Lara.leftArm.lock = false; } -void InitialiseLaraAnims(ITEM_INFO* item) // (F) (D) +void InitialiseLaraAnims(ITEM_INFO* item) { if (g_Level.Rooms[item->roomNumber].flags & ENV_FLAG_WATER) { @@ -154,7 +154,7 @@ void InitialiseLaraAnims(ITEM_INFO* item) // (F) (D) } } -void InitialiseLaraLoad(short itemNum) // (F) (D) +void InitialiseLaraLoad(short itemNum) { Lara.itemNumber = itemNum; LaraItem = &g_Level.Items[itemNum]; diff --git a/TR5Main/Game/Lara/lara_monkey.cpp b/TR5Main/Game/Lara/lara_monkey.cpp index 260d36b3e..33930229b 100644 --- a/TR5Main/Game/Lara/lara_monkey.cpp +++ b/TR5Main/Game/Lara/lara_monkey.cpp @@ -8,7 +8,7 @@ /*this file has all the related functions to monkeyswinging*/ /*monkeyswing state handling functions*/ -void lara_as_hang2(ITEM_INFO* item, COLL_INFO* coll)//1630C(<), 16440(<) (F) +void lara_as_hang2(ITEM_INFO* item, COLL_INFO* coll) { /*state 75*/ /*collision: lara_col_hang2*/ @@ -37,7 +37,7 @@ void lara_as_hang2(ITEM_INFO* item, COLL_INFO* coll)//1630C(<), 16440(<) (F) LookUpDown(); } -void lara_col_hang2(ITEM_INFO* item, COLL_INFO* coll)//163DC, 16510 (F) +void lara_col_hang2(ITEM_INFO* item, COLL_INFO* coll) { /*state 75*/ /*state code: lara_as_hang2*/ @@ -145,7 +145,7 @@ void lara_col_hang2(ITEM_INFO* item, COLL_INFO* coll)//163DC, 16510 (F) } } -void lara_as_monkeyswing(ITEM_INFO* item, COLL_INFO* coll)//1670C, 16840 (F) +void lara_as_monkeyswing(ITEM_INFO* item, COLL_INFO* coll) { /*state 76*/ /*collision: lara_col_monkeyswing*/ @@ -185,7 +185,7 @@ void lara_as_monkeyswing(ITEM_INFO* item, COLL_INFO* coll)//1670C, 16840 (F) } } -void lara_col_monkeyswing(ITEM_INFO* item, COLL_INFO* coll)//16828, 1695C (F) +void lara_col_monkeyswing(ITEM_INFO* item, COLL_INFO* coll) { /*state 76*/ /*state code: lara_as_monkeyswing*/ @@ -239,7 +239,7 @@ void lara_col_monkeyswing(ITEM_INFO* item, COLL_INFO* coll)//16828, 1695C (F) } } -void lara_as_monkeyr(ITEM_INFO* item, COLL_INFO* coll)//16B24(<), 16C58(<) (F) +void lara_as_monkeyr(ITEM_INFO* item, COLL_INFO* coll) { /*state 78*/ /*collision: lara_col_monkeyr*/ @@ -267,7 +267,7 @@ void lara_as_monkeyr(ITEM_INFO* item, COLL_INFO* coll)//16B24(<), 16C58(<) (F) } } -void lara_col_monkeyr(ITEM_INFO* item, COLL_INFO* coll)//16B9C(<), 16CD0(<) (F) +void lara_col_monkeyr(ITEM_INFO* item, COLL_INFO* coll) { /*state 78*/ /*state code: lara_as_monkeyr*/ @@ -291,7 +291,7 @@ void lara_col_monkeyr(ITEM_INFO* item, COLL_INFO* coll)//16B9C(<), 16CD0(<) (F) } } -void lara_as_monkeyl(ITEM_INFO* item, COLL_INFO* coll)//16A0C(<), 16B40(<) (F) +void lara_as_monkeyl(ITEM_INFO* item, COLL_INFO* coll) { /*state 77*/ /*collision: lara_col_monkeyl*/ @@ -320,7 +320,7 @@ void lara_as_monkeyl(ITEM_INFO* item, COLL_INFO* coll)//16A0C(<), 16B40(<) (F) } } -void lara_col_monkeyl(ITEM_INFO* item, COLL_INFO* coll)//16A80(<), 16BB4(<) (F) +void lara_col_monkeyl(ITEM_INFO* item, COLL_INFO* coll) { /*state 77*/ /*state code: lara_as_monkeyl*/ @@ -344,7 +344,7 @@ void lara_col_monkeyl(ITEM_INFO* item, COLL_INFO* coll)//16A80(<), 16BB4(<) (F) } } -void lara_as_monkey180(ITEM_INFO* item, COLL_INFO* coll)//16DB8(<), 16EEC(<) (F) +void lara_as_monkey180(ITEM_INFO* item, COLL_INFO* coll) { /*state 79*/ /*collision: lara_col_monkey180*/ @@ -353,14 +353,14 @@ void lara_as_monkey180(ITEM_INFO* item, COLL_INFO* coll)//16DB8(<), 16EEC(<) (F) item->goalAnimState = LS_MONKEYSWING_IDLE; } -void lara_col_monkey180(ITEM_INFO* item, COLL_INFO* coll)//16DDC, 16F10 (F) +void lara_col_monkey180(ITEM_INFO* item, COLL_INFO* coll) { /*state 79*/ /*state code: lara_as_monkey180*/ lara_col_monkeyswing(item, coll); } -void lara_as_hangturnr(ITEM_INFO* item, COLL_INFO* coll)//16D64(<), 16E98(<) (F) +void lara_as_hangturnr(ITEM_INFO* item, COLL_INFO* coll) { /*state 83*/ /*collision: lara_col_hangturnlr*/ @@ -379,7 +379,7 @@ void lara_as_hangturnr(ITEM_INFO* item, COLL_INFO* coll)//16D64(<), 16E98(<) (F) item->goalAnimState = LS_MONKEYSWING_IDLE; } //both lara_as_hangturnl and lara_as_hangturnr states use lara_col_hangturnlr for collision// -void lara_as_hangturnl(ITEM_INFO* item, COLL_INFO* coll)//16C40(<), 16D74(<) (F) +void lara_as_hangturnl(ITEM_INFO* item, COLL_INFO* coll) { /*state 82*/ /*collision: lara_col_hangturnlr*/ @@ -398,7 +398,7 @@ void lara_as_hangturnl(ITEM_INFO* item, COLL_INFO* coll)//16C40(<), 16D74(<) (F) item->goalAnimState = LS_MONKEYSWING_IDLE; } -void lara_col_hangturnlr(ITEM_INFO* item, COLL_INFO* coll)//16C94(<), 16DC8(<) (F) +void lara_col_hangturnlr(ITEM_INFO* item, COLL_INFO* coll) { /*state 82 and 83*/ /*state code: lara_as_hangturnr(83), lara_as_hangturnl(82)*/ @@ -425,7 +425,7 @@ void lara_col_hangturnlr(ITEM_INFO* item, COLL_INFO* coll)//16C94(<), 16DC8(<) ( /*tests and other functions*/ -short TestMonkeyRight(ITEM_INFO* item, COLL_INFO* coll)//161EC(<), 16320(<) (F) +short TestMonkeyRight(ITEM_INFO* item, COLL_INFO* coll) { short oct; @@ -461,7 +461,7 @@ short TestMonkeyRight(ITEM_INFO* item, COLL_INFO* coll)//161EC(<), 16320(<) (F) return 0; } -short TestMonkeyLeft(ITEM_INFO* item, COLL_INFO* coll)//160CC(<), 16200(<) (F) +short TestMonkeyLeft(ITEM_INFO* item, COLL_INFO* coll) { short oct; @@ -498,14 +498,14 @@ short TestMonkeyLeft(ITEM_INFO* item, COLL_INFO* coll)//160CC(<), 16200(<) (F) return 0; } -void MonkeySwingSnap(ITEM_INFO* item, COLL_INFO* coll)//1605C(<), 16190(<) (F) +void MonkeySwingSnap(ITEM_INFO* item, COLL_INFO* coll) { short roomNum = item->roomNumber; item->pos.yPos = GetCeiling(GetFloor(item->pos.xPos, item->pos.yPos, item->pos.zPos, &roomNum), item->pos.xPos, item->pos.yPos, item->pos.zPos) + 704; } -void MonkeySwingFall(ITEM_INFO* item)//16004(<), 16138(<) (F) +void MonkeySwingFall(ITEM_INFO* item) { item->goalAnimState = LS_JUMP_UP; item->currentAnimState = LS_JUMP_UP; diff --git a/TR5Main/Game/Lara/lara_objects.cpp b/TR5Main/Game/Lara/lara_objects.cpp index 39d1c0623..88fc65687 100644 --- a/TR5Main/Game/Lara/lara_objects.cpp +++ b/TR5Main/Game/Lara/lara_objects.cpp @@ -9,7 +9,7 @@ /*This file has "all" lara_as/lara_col functions where Lara is interacting with an object.*/ /*pickups*/ -void lara_as_pickup(ITEM_INFO* item, COLL_INFO* coll)//1AB00(<), 1AC34(<) (F) +void lara_as_pickup(ITEM_INFO* item, COLL_INFO* coll) { /*state 39, 98*/ /*collision: lara_default_col*/ @@ -21,7 +21,7 @@ void lara_as_pickup(ITEM_INFO* item, COLL_INFO* coll)//1AB00(<), 1AC34(<) (F) Camera.targetDistance = SECTOR(1); } -void lara_as_pickupflare(ITEM_INFO* item, COLL_INFO* coll)//1AB5C(<), 1AC90(<) (F) +void lara_as_pickupflare(ITEM_INFO* item, COLL_INFO* coll) { /*state 67*/ /*collison: lara_default_col*/ @@ -37,7 +37,7 @@ void lara_as_pickupflare(ITEM_INFO* item, COLL_INFO* coll)//1AB5C(<), 1AC90(<) ( /*end pickups*/ /*-*/ /*switches*/ -void lara_as_switchon(ITEM_INFO* item, COLL_INFO* coll)//1ABEC(<), 1AD20(<) (F) +void lara_as_switchon(ITEM_INFO* item, COLL_INFO* coll) { /*states 40, 126*/ /*collision: lara_default_col*/ @@ -50,7 +50,7 @@ void lara_as_switchon(ITEM_INFO* item, COLL_INFO* coll)//1ABEC(<), 1AD20(<) (F) Camera.speed = 6; } -void lara_as_switchoff(ITEM_INFO* item, COLL_INFO* coll)//1AC54(<), 1AD88(<) (F) +void lara_as_switchoff(ITEM_INFO* item, COLL_INFO* coll) { /*state 41*/ /*collision: lara_default_col*/ @@ -63,7 +63,7 @@ void lara_as_switchoff(ITEM_INFO* item, COLL_INFO* coll)//1AC54(<), 1AD88(<) (F) Camera.speed = 6; } -void lara_col_turnswitch(ITEM_INFO* item, COLL_INFO* coll)//1B1B4(<), 1B2E8(<) (F) +void lara_col_turnswitch(ITEM_INFO* item, COLL_INFO* coll) { /*state 95*/ /*state code: lara_as_controlledl*/ @@ -89,7 +89,7 @@ void lara_col_turnswitch(ITEM_INFO* item, COLL_INFO* coll)//1B1B4(<), 1B2E8(<) ( /*end switches*/ /*-*/ /*puzzles and keys*/ -void lara_as_usekey(ITEM_INFO* item, COLL_INFO* coll)//1ACBC(<), 1ADF0(<) (F) +void lara_as_usekey(ITEM_INFO* item, COLL_INFO* coll) { /*state 42*/ /*collision: lara_default_col*/ @@ -101,7 +101,7 @@ void lara_as_usekey(ITEM_INFO* item, COLL_INFO* coll)//1ACBC(<), 1ADF0(<) (F) Camera.targetDistance = SECTOR(1); } -void lara_as_usepuzzle(ITEM_INFO* item, COLL_INFO* coll)//1AD18(<), 1AE4C(<) (F) +void lara_as_usepuzzle(ITEM_INFO* item, COLL_INFO* coll) { /*state 43*/ /*collision: lara_default_col*/ @@ -127,7 +127,7 @@ void lara_as_usepuzzle(ITEM_INFO* item, COLL_INFO* coll)//1AD18(<), 1AE4C(<) (F) /*end puzzles and keys*/ /*-*/ /*pushables*/ -void lara_as_pushblock(ITEM_INFO* item, COLL_INFO* coll)//1AA04(<), 1AB38(<) (F) +void lara_as_pushblock(ITEM_INFO* item, COLL_INFO* coll) { /*state 36*/ /*collision: lara_default_col*/ @@ -139,7 +139,7 @@ void lara_as_pushblock(ITEM_INFO* item, COLL_INFO* coll)//1AA04(<), 1AB38(<) (F) Camera.targetElevation = -ANGLE(25.0f); } -void lara_as_pullblock(ITEM_INFO* item, COLL_INFO* coll)//1AA60(<), 1AB94(<) (F) +void lara_as_pullblock(ITEM_INFO* item, COLL_INFO* coll) { /*state 37*/ /*collision: lara_default_col*/ @@ -151,7 +151,7 @@ void lara_as_pullblock(ITEM_INFO* item, COLL_INFO* coll)//1AA60(<), 1AB94(<) (F) Camera.targetElevation = -ANGLE(25.0f); } -void lara_as_ppready(ITEM_INFO* item, COLL_INFO* coll)//1AABC(<), 1ABF0(<) (F) +void lara_as_ppready(ITEM_INFO* item, COLL_INFO* coll) { /*state 38*/ /*collision: lara_default_col*/ @@ -164,7 +164,7 @@ void lara_as_ppready(ITEM_INFO* item, COLL_INFO* coll)//1AABC(<), 1ABF0(<) (F) /*end pushables*/ /*-*/ /*pulley*/ -void lara_as_pulley(ITEM_INFO* item, COLL_INFO* coll)//1B288, 1B3BC (F) +void lara_as_pulley(ITEM_INFO* item, COLL_INFO* coll) { /*state 104*/ /*collision: lara_default_col*/ @@ -229,7 +229,7 @@ void lara_as_parallelbars(ITEM_INFO* item, COLL_INFO* coll) } } -void lara_as_pbleapoff(ITEM_INFO* item, COLL_INFO* coll)//1D244, 1D3D8 (F) +void lara_as_pbleapoff(ITEM_INFO* item, COLL_INFO* coll) { /*state 129*/ /*collision: lara_default_col*/ @@ -425,7 +425,7 @@ void lara_as_trfall(ITEM_INFO* item, COLL_INFO* coll) /*end tightropes*/ /*-*/ /*ropes*/ -void lara_as_ropel(ITEM_INFO* item, COLL_INFO* coll) // (F) (D) +void lara_as_ropel(ITEM_INFO* item, COLL_INFO* coll) { /*state 90*/ /*collision: lara_void_func*/ @@ -446,7 +446,7 @@ void lara_as_ropel(ITEM_INFO* item, COLL_INFO* coll) // (F) (D) } } -void lara_as_roper(ITEM_INFO* item, COLL_INFO* coll) // (F) (D) +void lara_as_roper(ITEM_INFO* item, COLL_INFO* coll) { if (TrInput & IN_ACTION) { @@ -465,7 +465,7 @@ void lara_as_roper(ITEM_INFO* item, COLL_INFO* coll) // (F) (D) } } -void lara_as_rope(ITEM_INFO* item, COLL_INFO* coll) // (F) (D) +void lara_as_rope(ITEM_INFO* item, COLL_INFO* coll) { /*states 111, 114, 115*/ /*collison: lara_col_rope(111), lara_col_ropefwd(114, 115)*/ @@ -476,7 +476,7 @@ void lara_as_rope(ITEM_INFO* item, COLL_INFO* coll) // (F) (D) LookUpDown(); } -void lara_col_rope(ITEM_INFO* item, COLL_INFO* coll) // (F) (D) +void lara_col_rope(ITEM_INFO* item, COLL_INFO* coll) { /*state: 111*/ /*state code: lara_as_rope*/ @@ -517,7 +517,7 @@ void lara_col_rope(ITEM_INFO* item, COLL_INFO* coll) // (F) (D) } } -void lara_col_ropefwd(ITEM_INFO* item, COLL_INFO* coll) // (F) (D) +void lara_col_ropefwd(ITEM_INFO* item, COLL_INFO* coll) { /*states 114, 115*/ /*state code: lara_as_rope(for both)*/ @@ -577,7 +577,7 @@ void lara_col_ropefwd(ITEM_INFO* item, COLL_INFO* coll) // (F) (D) } } -void lara_as_climbrope(ITEM_INFO* item, COLL_INFO* coll) // (F) (D) +void lara_as_climbrope(ITEM_INFO* item, COLL_INFO* coll) { /*state 112*/ /*collision: lara_void_func*/ @@ -600,7 +600,7 @@ void lara_as_climbrope(ITEM_INFO* item, COLL_INFO* coll) // (F) (D) } } -void lara_as_climbroped(ITEM_INFO* item, COLL_INFO* coll) // (F) (D) +void lara_as_climbroped(ITEM_INFO* item, COLL_INFO* coll) { /*state 113*/ /*collision: lara_void_func*/ @@ -609,7 +609,7 @@ void lara_as_climbroped(ITEM_INFO* item, COLL_INFO* coll) // (F) (D) /*end ropes*/ /*-*/ /*poles*/ -void lara_col_polestat(ITEM_INFO* item, COLL_INFO* coll)//16DFC, 16F30 (F) +void lara_col_polestat(ITEM_INFO* item, COLL_INFO* coll) { /*state 99*/ /*state code: lara_as_null*/ @@ -684,7 +684,7 @@ void lara_col_polestat(ITEM_INFO* item, COLL_INFO* coll)//16DFC, 16F30 (F) } } -void lara_col_poleup(ITEM_INFO* item, COLL_INFO* coll)//170D8(<), 1720C(<) (F) +void lara_col_poleup(ITEM_INFO* item, COLL_INFO* coll) { /*state: 100*/ /*state code: lara_as_null*/ @@ -705,7 +705,7 @@ void lara_col_poleup(ITEM_INFO* item, COLL_INFO* coll)//170D8(<), 1720C(<) (F) item->goalAnimState = LS_POLE_IDLE; } -void lara_col_poledown(ITEM_INFO* item, COLL_INFO* coll)//171A0, 172D4 (F) +void lara_col_poledown(ITEM_INFO* item, COLL_INFO* coll) { /*state: 101*/ /*state code: lara_as_null*/ @@ -770,7 +770,7 @@ void lara_col_poledown(ITEM_INFO* item, COLL_INFO* coll)//171A0, 172D4 (F) item->pos.yPos += item->itemFlags[2] / 256; } -void lara_as_poleleft(ITEM_INFO* item, COLL_INFO* coll)//17020(<), 17154(<) (F) +void lara_as_poleleft(ITEM_INFO* item, COLL_INFO* coll) { /*state 102*/ /*collision: lara_void_func*/ @@ -782,7 +782,7 @@ void lara_as_poleleft(ITEM_INFO* item, COLL_INFO* coll)//17020(<), 17154(<) (F) item->pos.yRot += 256; } -void lara_as_poleright(ITEM_INFO* item, COLL_INFO* coll)//1707C(<), 171B0(<) (F) +void lara_as_poleright(ITEM_INFO* item, COLL_INFO* coll) { /*state: 103*/ /*collision: lara_void_func*/ @@ -796,7 +796,7 @@ void lara_as_poleright(ITEM_INFO* item, COLL_INFO* coll)//1707C(<), 171B0(<) (F) /*end poles*/ /*-*/ /*deathslide*/ -void lara_as_deathslide(ITEM_INFO* item, COLL_INFO* coll)//1B038, 1B16C (F) +void lara_as_deathslide(ITEM_INFO* item, COLL_INFO* coll) { /*state 70*/ /*collision: lara_void_func*/ diff --git a/TR5Main/Game/Lara/lara_slide.cpp b/TR5Main/Game/Lara/lara_slide.cpp index 5b6487390..f6eaec2a7 100644 --- a/TR5Main/Game/Lara/lara_slide.cpp +++ b/TR5Main/Game/Lara/lara_slide.cpp @@ -9,7 +9,7 @@ short OldAngle = 1; /*this file has all the related functions to sliding*/ /*tests and others*/ -int TestLaraSlide(ITEM_INFO* item, COLL_INFO* coll) // (F) (D) +int TestLaraSlide(ITEM_INFO* item, COLL_INFO* coll) { if (abs(coll->tiltX) <= 2 && abs(coll->tiltZ) <= 2) return 0; @@ -58,7 +58,7 @@ int TestLaraSlide(ITEM_INFO* item, COLL_INFO* coll) // (F) (D) return 1; } -void lara_slide_slope(ITEM_INFO* item, COLL_INFO* coll)//127BC, 1286C (F) +void lara_slide_slope(ITEM_INFO* item, COLL_INFO* coll) { coll->badPos = NO_BAD_POS; coll->badNeg = -512; @@ -115,7 +115,7 @@ void lara_slide_slope(ITEM_INFO* item, COLL_INFO* coll)//127BC, 1286C (F) } } -void LaraSlideEdgeJump(ITEM_INFO* item, COLL_INFO* coll)//12B18, 12BC8 (F) +void LaraSlideEdgeJump(ITEM_INFO* item, COLL_INFO* coll) { ShiftItem(item, coll); @@ -152,7 +152,7 @@ void LaraSlideEdgeJump(ITEM_INFO* item, COLL_INFO* coll)//12B18, 12BC8 (F) /*end tests and others*/ /*-*/ /*Lara state code*/ -void lara_as_slide(ITEM_INFO* item, COLL_INFO* coll)//1A824(<), 1A958(<) (F) +void lara_as_slide(ITEM_INFO* item, COLL_INFO* coll) { /*state 24*/ /*collision: lara_col_slide*/ @@ -161,7 +161,7 @@ void lara_as_slide(ITEM_INFO* item, COLL_INFO* coll)//1A824(<), 1A958(<) (F) item->goalAnimState = LS_JUMP_FORWARD; } -void lara_col_slide(ITEM_INFO* item, COLL_INFO* coll)//1C108(<), 1C23C(<) (F) +void lara_col_slide(ITEM_INFO* item, COLL_INFO* coll) { /*state 24*/ /*state code: lara_as_slide*/ @@ -169,7 +169,7 @@ void lara_col_slide(ITEM_INFO* item, COLL_INFO* coll)//1C108(<), 1C23C(<) (F) lara_slide_slope(item, coll); } -void lara_as_slideback(ITEM_INFO* item, COLL_INFO* coll)//1A9E0(<), 1AB14(<) (F) +void lara_as_slideback(ITEM_INFO* item, COLL_INFO* coll) { /*state 32*/ /*collision: lara_col_slideback*/ @@ -179,7 +179,7 @@ void lara_as_slideback(ITEM_INFO* item, COLL_INFO* coll)//1A9E0(<), 1AB14(<) (F) } } -void lara_col_slideback(ITEM_INFO* item, COLL_INFO* coll)//1C284(<), 1C3B8(<) (F) +void lara_col_slideback(ITEM_INFO* item, COLL_INFO* coll) { /*state 32*/ /*state code: lara_as_slideback*/ diff --git a/TR5Main/Game/Lara/lara_surface.cpp b/TR5Main/Game/Lara/lara_surface.cpp index d8e27d57f..4dab37c76 100644 --- a/TR5Main/Game/Lara/lara_surface.cpp +++ b/TR5Main/Game/Lara/lara_surface.cpp @@ -29,25 +29,25 @@ void lara_col_surftread(ITEM_INFO* item, COLL_INFO* coll) LaraSurfaceCollision(item, coll); } -void lara_col_surfright(ITEM_INFO* item, COLL_INFO* coll)//4DD90(<), 4E1F4(<) (F) +void lara_col_surfright(ITEM_INFO* item, COLL_INFO* coll) { Lara.moveAngle = item->pos.yRot + ANGLE(90); LaraSurfaceCollision(item, coll); } -void lara_col_surfleft(ITEM_INFO* item, COLL_INFO* coll)//4DD64(<), 4E1C8(<) (F) +void lara_col_surfleft(ITEM_INFO* item, COLL_INFO* coll) { Lara.moveAngle = item->pos.yRot - ANGLE(90); LaraSurfaceCollision(item, coll); } -void lara_col_surfback(ITEM_INFO* item, COLL_INFO* coll)//4DD38(<), 4E19C(<) (F) +void lara_col_surfback(ITEM_INFO* item, COLL_INFO* coll) { Lara.moveAngle = item->pos.yRot + ANGLE(180); LaraSurfaceCollision(item, coll); } -void lara_col_surfswim(ITEM_INFO* item, COLL_INFO* coll)//4DCE8(<), 4E14C(<) (F) +void lara_col_surfswim(ITEM_INFO* item, COLL_INFO* coll) { coll->badNeg = -384; Lara.moveAngle = item->pos.yRot; @@ -56,7 +56,7 @@ void lara_col_surfswim(ITEM_INFO* item, COLL_INFO* coll)//4DCE8(<), 4E14C(<) (F) LaraTestLadderClimbOut(item, coll); } -void lara_as_surftread(ITEM_INFO* item, COLL_INFO* coll)//4DBA0, 4E004 (F) +void lara_as_surftread(ITEM_INFO* item, COLL_INFO* coll) { item->fallspeed -= 4; if (item->fallspeed < 0) @@ -113,7 +113,7 @@ void lara_as_surftread(ITEM_INFO* item, COLL_INFO* coll)//4DBA0, 4E004 (F) } } -void lara_as_surfright(ITEM_INFO* item, COLL_INFO* coll)//4DAF8, 4DF5C (F) +void lara_as_surfright(ITEM_INFO* item, COLL_INFO* coll) { if (item->hitPoints <= 0) { @@ -142,7 +142,7 @@ void lara_as_surfright(ITEM_INFO* item, COLL_INFO* coll)//4DAF8, 4DF5C (F) item->fallspeed = 60; } -void lara_as_surfleft(ITEM_INFO* item, COLL_INFO* coll)//4DA50(<), 4DEB4(<) (F) +void lara_as_surfleft(ITEM_INFO* item, COLL_INFO* coll) { if (item->hitPoints <= 0) { @@ -171,7 +171,7 @@ void lara_as_surfleft(ITEM_INFO* item, COLL_INFO* coll)//4DA50(<), 4DEB4(<) (F) item->fallspeed = 60; } -void lara_as_surfback(ITEM_INFO* item, COLL_INFO* coll)//4D9A8(<), 4DE0C(<) (F) +void lara_as_surfback(ITEM_INFO* item, COLL_INFO* coll) { if (item->hitPoints <= 0) { @@ -200,7 +200,7 @@ void lara_as_surfback(ITEM_INFO* item, COLL_INFO* coll)//4D9A8(<), 4DE0C(<) (F) item->fallspeed = 60; } -void lara_as_surfswim(ITEM_INFO* item, COLL_INFO* coll)//4D8E4(<), 4DD48(<) (F) +void lara_as_surfswim(ITEM_INFO* item, COLL_INFO* coll) { if (item->hitPoints <= 0) { @@ -229,7 +229,7 @@ void lara_as_surfswim(ITEM_INFO* item, COLL_INFO* coll)//4D8E4(<), 4DD48(<) (F) item->fallspeed = 60; } -void LaraSurfaceCollision(ITEM_INFO* item, COLL_INFO* coll)//4D4F0(<), 4D954(<) (F) +void LaraSurfaceCollision(ITEM_INFO* item, COLL_INFO* coll) { coll->facing = Lara.moveAngle; @@ -269,7 +269,7 @@ void LaraSurfaceCollision(ITEM_INFO* item, COLL_INFO* coll)//4D4F0(<), 4D954(<) } } -int LaraTestWaterClimbOut(ITEM_INFO* item, COLL_INFO* coll)//4D22C, 4D690 +int LaraTestWaterClimbOut(ITEM_INFO* item, COLL_INFO* coll) { if (coll->collType != CT_FRONT || !(TrInput & IN_ACTION)) return 0; @@ -388,7 +388,7 @@ int LaraTestWaterClimbOut(ITEM_INFO* item, COLL_INFO* coll)//4D22C, 4D690 return 1; } -int LaraTestWaterStepOut(ITEM_INFO* item, COLL_INFO* coll)//4D100, 4D564 (F) +int LaraTestWaterStepOut(ITEM_INFO* item, COLL_INFO* coll) { if (coll->collType == CT_FRONT || coll->midType == BIG_SLOPE @@ -501,7 +501,7 @@ int LaraTestLadderClimbOut(ITEM_INFO* item, COLL_INFO* coll) // NEW function for return 1; } -void lara_as_waterout(ITEM_INFO* item, COLL_INFO* coll)//1AEE4(<), 1B018(<) (F) +void lara_as_waterout(ITEM_INFO* item, COLL_INFO* coll) { coll->enableBaddiePush = false; coll->enableSpaz = false; diff --git a/TR5Main/Game/Lara/lara_swim.cpp b/TR5Main/Game/Lara/lara_swim.cpp index a2d3234ef..fd1e8df39 100644 --- a/TR5Main/Game/Lara/lara_swim.cpp +++ b/TR5Main/Game/Lara/lara_swim.cpp @@ -26,7 +26,7 @@ typedef struct SUBSUIT_INFO SUBSUIT_INFO Subsuit; byte SubHitCount = 0; -void LaraWaterCurrent(COLL_INFO* coll) // (F) (D) +void LaraWaterCurrent(COLL_INFO* coll) { if (Lara.currentActive) { @@ -108,7 +108,7 @@ void LaraWaterCurrent(COLL_INFO* coll) // (F) (D) coll->old.z = LaraItem->pos.zPos; } -int GetWaterDepth(int x, int y, int z, short roomNumber)//4CA38, 4CE9C +int GetWaterDepth(int x, int y, int z, short roomNumber) { FLOOR_INFO* floor; ROOM_INFO* r = &g_Level.Rooms[roomNumber]; @@ -181,12 +181,12 @@ int GetWaterDepth(int x, int y, int z, short roomNumber)//4CA38, 4CE9C } } -void lara_col_waterroll(ITEM_INFO* item, COLL_INFO* coll)//4CA18(<), 4CE7C(<) (F) +void lara_col_waterroll(ITEM_INFO* item, COLL_INFO* coll) { LaraSwimCollision(item, coll); } -void lara_col_uwdeath(ITEM_INFO* item, COLL_INFO* coll)//4C980(<), 4CDE4(<) (F) +void lara_col_uwdeath(ITEM_INFO* item, COLL_INFO* coll) { item->hitPoints = -1; Lara.air = -1; @@ -200,32 +200,32 @@ void lara_col_uwdeath(ITEM_INFO* item, COLL_INFO* coll)//4C980(<), 4CDE4(<) (F) LaraSwimCollision(item, coll); } -void lara_col_dive(ITEM_INFO* item, COLL_INFO* coll)//4C960(<), 4CDC4(<) (F) +void lara_col_dive(ITEM_INFO* item, COLL_INFO* coll) { LaraSwimCollision(item, coll); } -void lara_col_tread(ITEM_INFO* item, COLL_INFO* coll)//4C940(<), 4CDA4(<) (F) +void lara_col_tread(ITEM_INFO* item, COLL_INFO* coll) { LaraSwimCollision(item, coll); } -void lara_col_glide(ITEM_INFO* item, COLL_INFO* coll)//4C920(<), 4CD84(<) (F) +void lara_col_glide(ITEM_INFO* item, COLL_INFO* coll) { LaraSwimCollision(item, coll); } -void lara_col_swim(ITEM_INFO* item, COLL_INFO* coll)//4C900(<), 4CD64(<) (F) +void lara_col_swim(ITEM_INFO* item, COLL_INFO* coll) { LaraSwimCollision(item, coll); } -void lara_as_waterroll(ITEM_INFO* item, COLL_INFO* coll)//4C8F8(<), 4CD5C(<) (F) +void lara_as_waterroll(ITEM_INFO* item, COLL_INFO* coll) { item->fallspeed = 0; } -void lara_as_uwdeath(ITEM_INFO* item, COLL_INFO* coll)//4C884(<), 4CCE8(<) (F) +void lara_as_uwdeath(ITEM_INFO* item, COLL_INFO* coll) { Lara.look = 0; @@ -246,7 +246,7 @@ void lara_as_uwdeath(ITEM_INFO* item, COLL_INFO* coll)//4C884(<), 4CCE8(<) (F) } } -void lara_as_dive(ITEM_INFO* item, COLL_INFO* coll)//4C854, 4CCB8 (F) +void lara_as_dive(ITEM_INFO* item, COLL_INFO* coll) { if (TrInput & IN_FORWARD) { @@ -254,7 +254,7 @@ void lara_as_dive(ITEM_INFO* item, COLL_INFO* coll)//4C854, 4CCB8 (F) } } -void lara_as_tread(ITEM_INFO* item, COLL_INFO* coll)//4C730, 4CB94 (F) +void lara_as_tread(ITEM_INFO* item, COLL_INFO* coll) { if (item->hitPoints <= 0) { @@ -291,7 +291,7 @@ void lara_as_tread(ITEM_INFO* item, COLL_INFO* coll)//4C730, 4CB94 (F) } } -void lara_as_glide(ITEM_INFO* item, COLL_INFO* coll)//4C634(<), 4CA98(<) (F) +void lara_as_glide(ITEM_INFO* item, COLL_INFO* coll) { if (item->hitPoints <= 0) { @@ -329,7 +329,7 @@ void lara_as_glide(ITEM_INFO* item, COLL_INFO* coll)//4C634(<), 4CA98(<) (F) item->goalAnimState = LS_UNDERWATER_STOP; } -void lara_as_swim(ITEM_INFO* item, COLL_INFO* coll)//4C548(<), 4C9AC(<) (F) +void lara_as_swim(ITEM_INFO* item, COLL_INFO* coll) { if (item->hitPoints <= 0) { @@ -365,7 +365,7 @@ void lara_as_swim(ITEM_INFO* item, COLL_INFO* coll)//4C548(<), 4C9AC(<) (F) item->goalAnimState = LS_UNDERWATER_INERTIA; } -void UpdateSubsuitAngles()//4BD20, 4C184 (F) +void UpdateSubsuitAngles() { if (Subsuit.YVel != 0) { @@ -437,7 +437,7 @@ void UpdateSubsuitAngles()//4BD20, 4C184 (F) } } -void SwimTurnSubsuit(ITEM_INFO* item)//4BBDC, 4C040 (F) +void SwimTurnSubsuit(ITEM_INFO* item) { if (item->pos.yPos < 14080) Subsuit.YVel += ((14080 - item->pos.yPos) / 16); @@ -475,7 +475,7 @@ void SwimTurnSubsuit(ITEM_INFO* item)//4BBDC, 4C040 (F) } } -void SwimTurn(ITEM_INFO* item)//4BAF4(<), 4BF58(<) (F) +void SwimTurn(ITEM_INFO* item) { if (TrInput & IN_FORWARD) { @@ -502,7 +502,7 @@ void SwimTurn(ITEM_INFO* item)//4BAF4(<), 4BF58(<) (F) } } -void LaraSwimCollision(ITEM_INFO* item, COLL_INFO* coll)//4B608, 4BA6C +void LaraSwimCollision(ITEM_INFO* item, COLL_INFO* coll) { int oldX = item->pos.xPos; int oldY = item->pos.yPos; @@ -664,7 +664,7 @@ void LaraSwimCollision(ITEM_INFO* item, COLL_INFO* coll)//4B608, 4BA6C LaraTestWaterDepth(item, coll); } -void LaraTestWaterDepth(ITEM_INFO* item, COLL_INFO* coll)//4B4F8(<), 4B95C(<) (F) +void LaraTestWaterDepth(ITEM_INFO* item, COLL_INFO* coll) { short roomNumber = item->roomNumber; FLOOR_INFO* floor = GetFloor(item->pos.xPos, item->pos.yPos, item->pos.zPos, &roomNumber); diff --git a/TR5Main/Game/Lara/lara_tests.cpp b/TR5Main/Game/Lara/lara_tests.cpp index 0aa8b4b18..da31be002 100644 --- a/TR5Main/Game/Lara/lara_tests.cpp +++ b/TR5Main/Game/Lara/lara_tests.cpp @@ -21,7 +21,7 @@ static short RightClimbTab[4] = // offset 0xA0640 /*this file has all the generic test functions called in lara's state code*/ -int TestLaraVault(ITEM_INFO* item, COLL_INFO* coll) // (F) (D) +int TestLaraVault(ITEM_INFO* item, COLL_INFO* coll) { if (!(TrInput & IN_ACTION) || Lara.gunStatus != LG_NO_ARMS) return 0; @@ -223,7 +223,7 @@ int TestLaraVault(ITEM_INFO* item, COLL_INFO* coll) // (F) (D) return 0; } -int TestWall(ITEM_INFO* item, int front, int right, int down)//12550, 12600 (F) +int TestWall(ITEM_INFO* item, int front, int right, int down) { int x = item->pos.xPos; int y = item->pos.yPos + down; @@ -286,7 +286,7 @@ int TestWall(ITEM_INFO* item, int front, int right, int down)//12550, 12600 (F) return 0; } -int LaraHangTest(ITEM_INFO* item, COLL_INFO* coll) // (F) (D) +int LaraHangTest(ITEM_INFO* item, COLL_INFO* coll) { int delta, flag, flag2, front, dfront, x, z, result; short angle, hdif, cdif, dir; @@ -462,7 +462,7 @@ int LaraHangTest(ITEM_INFO* item, COLL_INFO* coll) // (F) (D) return result; } -int LaraHangLeftCornerTest(ITEM_INFO* item, COLL_INFO* coll) // (F) (D) +int LaraHangLeftCornerTest(ITEM_INFO* item, COLL_INFO* coll) { if (item->animNumber != LA_REACH_TO_HANG && item->animNumber != LA_HANG_FEET_IDLE) return 0; @@ -617,7 +617,7 @@ int LaraHangLeftCornerTest(ITEM_INFO* item, COLL_INFO* coll) // (F) (D) return result; } -int LaraHangRightCornerTest(ITEM_INFO* item, COLL_INFO* coll) // (F) (D) +int LaraHangRightCornerTest(ITEM_INFO* item, COLL_INFO* coll) { if (item->animNumber != LA_REACH_TO_HANG && item->animNumber != LA_HANG_FEET_IDLE) return 0; @@ -772,7 +772,7 @@ int LaraHangRightCornerTest(ITEM_INFO* item, COLL_INFO* coll) // (F) (D) return result; } -int IsValidHangPos(ITEM_INFO* item, COLL_INFO* coll) // (F) (D) +int IsValidHangPos(ITEM_INFO* item, COLL_INFO* coll) { if (LaraFloorFront(item, Lara.moveAngle, 100) < 200) return 0; @@ -811,7 +811,7 @@ int IsValidHangPos(ITEM_INFO* item, COLL_INFO* coll) // (F) (D) return abs(coll->frontFloor - coll->rightFloor2) < 60; } -int LaraTestClimbStance(ITEM_INFO* item, COLL_INFO* coll)//11F78, 12028 +int LaraTestClimbStance(ITEM_INFO* item, COLL_INFO* coll) { int shift_r, shift_l; @@ -846,7 +846,7 @@ int LaraTestClimbStance(ITEM_INFO* item, COLL_INFO* coll)//11F78, 12028 return true; } -int LaraTestHangOnClimbWall(ITEM_INFO* item, COLL_INFO* coll) // (F) (D) +int LaraTestHangOnClimbWall(ITEM_INFO* item, COLL_INFO* coll) { BOUNDING_BOX* bounds; int shift, result; @@ -900,7 +900,7 @@ int LaraTestHangOnClimbWall(ITEM_INFO* item, COLL_INFO* coll) // (F) (D) return 0; } -int LaraTestEdgeCatch(ITEM_INFO* item, COLL_INFO* coll, int* edge) // (F) (D) +int LaraTestEdgeCatch(ITEM_INFO* item, COLL_INFO* coll, int* edge) { BOUNDING_BOX* bounds = GetBoundsAccurate(item); @@ -929,7 +929,7 @@ int LaraTestEdgeCatch(ITEM_INFO* item, COLL_INFO* coll, int* edge) // (F) (D) return 1; } -int TestHangSwingIn(ITEM_INFO* item, short angle)//14104, 141B4 (F) +int TestHangSwingIn(ITEM_INFO* item, short angle) { int x = item->pos.xPos; int y = item->pos.yPos; @@ -1051,7 +1051,7 @@ int TestHangFeet(ITEM_INFO* item, short angle) } } -int CanLaraHangSideways(ITEM_INFO* item, COLL_INFO* coll, short angle)//19930, 19A64 (F) +int CanLaraHangSideways(ITEM_INFO* item, COLL_INFO* coll, short angle) { int oldx = item->pos.xPos; int oldz = item->pos.zPos; @@ -1092,7 +1092,7 @@ int CanLaraHangSideways(ITEM_INFO* item, COLL_INFO* coll, short angle)//19930, 1 return !res; } -void SetCornerAnim(ITEM_INFO* item, COLL_INFO* coll, short rot, short flip)//1A090, 1A1C4 (F) +void SetCornerAnim(ITEM_INFO* item, COLL_INFO* coll, short rot, short flip) { if (item->hitPoints <= 0) { @@ -1173,7 +1173,7 @@ void SetCornerAnimFeet(ITEM_INFO* item, COLL_INFO* coll, short rot, short flip) } } -short LaraFloorFront(ITEM_INFO* item, short ang, int dist) // (F) (D) +short LaraFloorFront(ITEM_INFO* item, short ang, int dist) { short room = item->roomNumber; @@ -1189,7 +1189,7 @@ short LaraFloorFront(ITEM_INFO* item, short ang, int dist) // (F) (D) return height; } -short LaraCeilingFront(ITEM_INFO* item, short ang, int dist, int h) // (F) (D) +short LaraCeilingFront(ITEM_INFO* item, short ang, int dist, int h) { short room = item->roomNumber; @@ -1205,7 +1205,7 @@ short LaraCeilingFront(ITEM_INFO* item, short ang, int dist, int h) // (F) (D) return height; } -int LaraFallen(ITEM_INFO* item, COLL_INFO* coll) // (F) (D) +int LaraFallen(ITEM_INFO* item, COLL_INFO* coll) { if (Lara.waterStatus == LW_WADE || coll->midFloor <= STEPUP_HEIGHT) { @@ -1221,7 +1221,7 @@ int LaraFallen(ITEM_INFO* item, COLL_INFO* coll) // (F) (D) return 1; } -int LaraLandedBad(ITEM_INFO* item, COLL_INFO* coll) // (F) (D) +int LaraLandedBad(ITEM_INFO* item, COLL_INFO* coll) { int landspeed = item->fallspeed - 140; diff --git a/TR5Main/Game/bubble.cpp b/TR5Main/Game/bubble.cpp index 1d6f77deb..883a3264b 100644 --- a/TR5Main/Game/bubble.cpp +++ b/TR5Main/Game/bubble.cpp @@ -57,7 +57,7 @@ void UpdateBubbles() } } -int GetFreeBubble() //8BEAC(<), 8DEF0(<) (F) +int GetFreeBubble() { int oldestAgeIndex = 0; int oldestAge = 0; @@ -78,7 +78,7 @@ int GetFreeBubble() //8BEAC(<), 8DEF0(<) (F) return oldestAgeIndex; } -void CreateBubble(PHD_VECTOR* pos, short roomNum, int unk1, int unk2, int flags, int xv, int yv, int zv) //8BF14(<), 8DF58(<) (F) +void CreateBubble(PHD_VECTOR* pos, short roomNum, int unk1, int unk2, int flags, int xv, int yv, int zv) { if (g_Level.Rooms[roomNum].flags & ENV_FLAG_WATER) { diff --git a/TR5Main/Game/collide.cpp b/TR5Main/Game/collide.cpp index c0b279014..0a0c0ad9f 100644 --- a/TR5Main/Game/collide.cpp +++ b/TR5Main/Game/collide.cpp @@ -326,7 +326,7 @@ void TrapCollision(short itemNumber, ITEM_INFO* l, COLL_INFO* c) ObjectCollision(itemNumber, l, c); } -void TestForObjectOnLedge(ITEM_INFO* item, COLL_INFO* coll)//2A940(<), 2AB68(<) (F) +void TestForObjectOnLedge(ITEM_INFO* item, COLL_INFO* coll) { for (int i = 0; i < 2; i++) { @@ -1044,7 +1044,7 @@ void CreatureCollision(short itemNum, ITEM_INFO* l, COLL_INFO* coll) } } -void GetCollisionInfo(COLL_INFO* coll, int xPos, int yPos, int zPos, int roomNumber, int objectHeight) // (F) (D) +void GetCollisionInfo(COLL_INFO* coll, int xPos, int yPos, int zPos, int roomNumber, int objectHeight) { int resetRoom; if (objectHeight >= 0) diff --git a/TR5Main/Game/control.cpp b/TR5Main/Game/control.cpp index ff669f062..52d63528a 100644 --- a/TR5Main/Game/control.cpp +++ b/TR5Main/Game/control.cpp @@ -1865,7 +1865,7 @@ int GetFloorHeight(FLOOR_INFO *floor, int x, int y, int z) return GetFloorHeight(floor->Room, x, y, z).value_or(NO_HEIGHT); } -int LOS(GAME_VECTOR *start, GAME_VECTOR *end) // (F) (D) +int LOS(GAME_VECTOR *start, GAME_VECTOR *end) { int result1, result2; @@ -1891,7 +1891,7 @@ int LOS(GAME_VECTOR *start, GAME_VECTOR *end) // (F) (D) return 0; } -int xLOS(GAME_VECTOR *start, GAME_VECTOR *end) // (F) (D) +int xLOS(GAME_VECTOR *start, GAME_VECTOR *end) { int dx, dy, dz, x, y, z, flag; short room, room2; @@ -1996,7 +1996,7 @@ int xLOS(GAME_VECTOR *start, GAME_VECTOR *end) // (F) (D) return flag; } -int zLOS(GAME_VECTOR *start, GAME_VECTOR *end) // (F) (D) +int zLOS(GAME_VECTOR *start, GAME_VECTOR *end) { int dx, dy, dz, x, y, z, flag; short room, room2; @@ -2101,7 +2101,7 @@ int zLOS(GAME_VECTOR *start, GAME_VECTOR *end) // (F) (D) return flag; } -int ClipTarget(GAME_VECTOR *start, GAME_VECTOR *target) // (F) (D) +int ClipTarget(GAME_VECTOR *start, GAME_VECTOR *target) { short room; int x, y, z, wx, wy, wz; @@ -2149,7 +2149,7 @@ int ClipTarget(GAME_VECTOR *start, GAME_VECTOR *target) // (F) (D) return 1; } -int GetTargetOnLOS(GAME_VECTOR *src, GAME_VECTOR *dest, int DrawTarget, int firing) // (AF) (D) +int GetTargetOnLOS(GAME_VECTOR *src, GAME_VECTOR *dest, int DrawTarget, int firing) { GAME_VECTOR target; int result, flag, itemNumber, count; @@ -2397,7 +2397,7 @@ int GetTargetOnLOS(GAME_VECTOR *src, GAME_VECTOR *dest, int DrawTarget, int firi return flag; } -int ObjectOnLOS2(GAME_VECTOR *start, GAME_VECTOR *end, PHD_VECTOR *vec, MESH_INFO **mesh) // (F) (D) +int ObjectOnLOS2(GAME_VECTOR *start, GAME_VECTOR *end, PHD_VECTOR *vec, MESH_INFO **mesh) { int r, m; ROOM_INFO *room; @@ -2475,7 +2475,7 @@ int GetRandomDraw() return generateInt(); } -int GetCeiling(FLOOR_INFO *floor, int x, int y, int z) // (F) (D) +int GetCeiling(FLOOR_INFO *floor, int x, int y, int z) { #if 0 ROOM_INFO *room; diff --git a/TR5Main/Game/effect.cpp b/TR5Main/Game/effect.cpp index 9de6e3dbf..def1048d5 100644 --- a/TR5Main/Game/effect.cpp +++ b/TR5Main/Game/effect.cpp @@ -142,7 +142,7 @@ void invisibility_on(ITEM_INFO* item) item->status = ITEM_INVISIBLE; } -void SetFog(ITEM_INFO* item)//39A44(<), 39F44(<) (F) +void SetFog(ITEM_INFO* item) { FlipEffect = -1; } @@ -175,22 +175,22 @@ void draw_right_pistol(ITEM_INFO* item) } } -void shoot_left_gun(ITEM_INFO* item)//39A34(<), 39F34(<) (F) +void shoot_left_gun(ITEM_INFO* item) { Lara.leftArm.flash_gun = 3; } -void shoot_right_gun(ITEM_INFO* item)//39A24(<), 39F24(<) (F) +void shoot_right_gun(ITEM_INFO* item) { Lara.rightArm.flash_gun = 3; } -void lara_hands_free(ITEM_INFO* item)//39A18(<), 39F18(<) (F) +void lara_hands_free(ITEM_INFO* item) { Lara.gunStatus = LG_NO_ARMS; } -void KillActiveBaddies(ITEM_INFO* item)//39938(<), 39E38(<) (F) +void KillActiveBaddies(ITEM_INFO* item) { if (NextItemActive != NO_ITEM) { @@ -220,7 +220,7 @@ void KillActiveBaddies(ITEM_INFO* item)//39938(<), 39E38(<) (F) FlipEffect = -1; } -void LaraLocationPad(ITEM_INFO* item)//39710(<), 39C10(<) (F) +void LaraLocationPad(ITEM_INFO* item) { FlipEffect = -1; @@ -228,7 +228,7 @@ void LaraLocationPad(ITEM_INFO* item)//39710(<), 39C10(<) (F) Lara.locationPad = TriggerTimer; } -void LaraLocation(ITEM_INFO* item)//396D0(<), 39BD0(<) (F) +void LaraLocation(ITEM_INFO* item) { FlipEffect = -1; @@ -237,14 +237,14 @@ void LaraLocation(ITEM_INFO* item)//396D0(<), 39BD0(<) (F) Lara.highestLocation = TriggerTimer; } -void ExplosionFX(ITEM_INFO* item)//39694(<), 39B94(<) (F) +void ExplosionFX(ITEM_INFO* item) { SoundEffect(SFX_EXPLOSION1, NULL, 0); Camera.bounce = -75; FlipEffect = -1; } -void SwapCrowbar(ITEM_INFO* item)//39638(<), 39B38(<) (F) +void SwapCrowbar(ITEM_INFO* item) { if (Lara.meshPtrs[LM_RHAND] == Objects[ID_LARA_SKIN].meshIndex + LM_RHAND) Lara.meshPtrs[LM_RHAND] = Objects[ID_LARA_CROWBAR_ANIM].meshIndex + LM_RHAND; @@ -252,23 +252,23 @@ void SwapCrowbar(ITEM_INFO* item)//39638(<), 39B38(<) (F) Lara.meshPtrs[LM_RHAND] = Objects[ID_LARA_SKIN].meshIndex + LM_RHAND; } -void ActivateKey(ITEM_INFO* item)//39624(<), 39B24(<) (F) +void ActivateKey(ITEM_INFO* item) { KeyTriggerActive = 1; } -void ActivateCamera(ITEM_INFO* item)//39610(<), 39B10(<) (F) +void ActivateCamera(ITEM_INFO* item) { KeyTriggerActive = 2; } -void PoseidonSFX(ITEM_INFO* item)//395E0(<), 39AE0(<) (F) +void PoseidonSFX(ITEM_INFO* item) { SoundEffect(SFX_GRAB_OPEN, NULL, 0); FlipEffect = -1; } -void RubbleFX(ITEM_INFO* item)//39534(<), 39A34(<) (F) +void RubbleFX(ITEM_INFO* item) { int itemNumber = FindItemNumber(ID_EARTHQUAKE); @@ -288,13 +288,13 @@ void RubbleFX(ITEM_INFO* item)//39534(<), 39A34(<) (F) FlipEffect = -1; } -void SoundFlipEffect(ITEM_INFO* item)//39500(<), 39A00(<) (F) +void SoundFlipEffect(ITEM_INFO* item) { SoundEffect(TriggerTimer, NULL, 0); FlipEffect = -1; } -void floor_shake_effect(ITEM_INFO* item)//39410, 39910 (F) +void floor_shake_effect(ITEM_INFO* item) { int x = abs(item->pos.xPos - Camera.pos.x); int y = abs(item->pos.yPos - Camera.pos.y); @@ -306,18 +306,18 @@ void floor_shake_effect(ITEM_INFO* item)//39410, 39910 (F) } } -void turn180_effect(ITEM_INFO* item)//393F4(<), 398F4(<) (F) +void turn180_effect(ITEM_INFO* item) { item->pos.yRot -= ANGLE(180); item->pos.xRot = -item->pos.xRot; } -void finish_level_effect(ITEM_INFO* item)//393D4(<), 398D4(<) (F) +void finish_level_effect(ITEM_INFO* item) { LevelComplete = CurrentLevel + 1; } -void void_effect(ITEM_INFO* item)//393CC(<), 398CC(<) (F) +void void_effect(ITEM_INFO* item) { } diff --git a/TR5Main/Game/effect2.cpp b/TR5Main/Game/effect2.cpp index a2bbc12ce..f009bf328 100644 --- a/TR5Main/Game/effect2.cpp +++ b/TR5Main/Game/effect2.cpp @@ -69,7 +69,7 @@ NODEOFFSET_INFO NodeOffsets[MAX_NODE] = { extern GameFlow* g_GameFlow; -void DetatchSpark(int num, SpriteEnumFlag type)// (F) (D) +void DetatchSpark(int num, SpriteEnumFlag type) { FX_INFO* fx; ITEM_INFO* item; @@ -789,7 +789,7 @@ void TriggerFireFlame(int x, int y, int z, int fxObj, int type) } } -void TriggerSuperJetFlame(ITEM_INFO* item, int yvel, int deadly)//32EAC, 333AC (F) +void TriggerSuperJetFlame(ITEM_INFO* item, int yvel, int deadly) { long dx = LaraItem->pos.xPos - item->pos.xPos; long dz = LaraItem->pos.zPos - item->pos.zPos; @@ -1813,7 +1813,7 @@ void TriggerMetalSparks(int x, int y, int z, int xv, int yv, int zv, int additio } } -void KillEverything()//338AC(<), 33DAC(<) (F) +void KillEverything() { KillEverythingFlag = 0; } \ No newline at end of file diff --git a/TR5Main/Game/flmtorch.cpp b/TR5Main/Game/flmtorch.cpp index 34246f30c..23088a487 100644 --- a/TR5Main/Game/flmtorch.cpp +++ b/TR5Main/Game/flmtorch.cpp @@ -51,7 +51,7 @@ void TriggerTorchFlame(char fxObj, char node) spark->dSize = spark->size / 8; } -void DoFlameTorch() // (F) (D) +void DoFlameTorch() { switch (Lara.leftArm.lock) { @@ -169,7 +169,7 @@ void DoFlameTorch() // (F) (D) } } -void GetFlameTorch() // (F) (D) +void GetFlameTorch() { if (Lara.gunType == WEAPON_FLARE) CreateFlare(ID_FLARE_ITEM, 0); @@ -186,7 +186,7 @@ void GetFlameTorch() // (F) (D) Lara.meshPtrs[LM_LHAND] = Objects[ID_LARA_TORCH_ANIM].meshIndex + LM_LHAND; } -void TorchControl(short itemNumber) // (F) (D) +void TorchControl(short itemNumber) { ITEM_INFO* item = &g_Level.Items[itemNumber]; diff --git a/TR5Main/Game/rope.cpp b/TR5Main/Game/rope.cpp index 591fa41d3..ee1593e32 100644 --- a/TR5Main/Game/rope.cpp +++ b/TR5Main/Game/rope.cpp @@ -12,7 +12,7 @@ PENDULUM AlternatePendulum; ROPE_STRUCT Ropes[12]; int NumRopes, RopeSwing = 0; -void InitialiseRope(short itemNumber) // (F) (D) +void InitialiseRope(short itemNumber) { PHD_VECTOR itemPos; @@ -39,7 +39,7 @@ void InitialiseRope(short itemNumber) // (F) (D) NumRopes++; } -void PrepareRope(ROPE_STRUCT* rope, PHD_VECTOR* pos1, PHD_VECTOR* pos2, int length, ITEM_INFO* item) // (F) (D) +void PrepareRope(ROPE_STRUCT* rope, PHD_VECTOR* pos1, PHD_VECTOR* pos2, int length, ITEM_INFO* item) { rope->position = *pos1; rope->segmentLength = length * 65536; @@ -87,7 +87,7 @@ void PrepareRope(ROPE_STRUCT* rope, PHD_VECTOR* pos1, PHD_VECTOR* pos2, int leng rope->active = 0; } -PHD_VECTOR* NormaliseRopeVector(PHD_VECTOR* vec) // (F) (D) +PHD_VECTOR* NormaliseRopeVector(PHD_VECTOR* vec) { int x = vec->x / 65536; int y = vec->y / 65536; @@ -108,7 +108,7 @@ PHD_VECTOR* NormaliseRopeVector(PHD_VECTOR* vec) // (F) (D) return vec; } -void _0x0046D130(ROPE_STRUCT* rope, int segmentFrame, int* x, int* y, int* z) // (F) (D) +void _0x0046D130(ROPE_STRUCT* rope, int segmentFrame, int* x, int* y, int* z) { int segment; short frame; @@ -120,26 +120,26 @@ void _0x0046D130(ROPE_STRUCT* rope, int segmentFrame, int* x, int* y, int* z) // *z = ((rope->normalisedSegment[segment].z * frame) / 65536) + ((rope->meshSegment[segment].z) / 65536) + rope->position.z; } -int DotProduct(PHD_VECTOR* u, PHD_VECTOR* v) // (F) (D) +int DotProduct(PHD_VECTOR* u, PHD_VECTOR* v) { return (u->x * v->x + u->y * v->y + u->z * v->z) / 16384; } -void ScaleVector(PHD_VECTOR* u, int c, PHD_VECTOR* destination) // (F) (D) +void ScaleVector(PHD_VECTOR* u, int c, PHD_VECTOR* destination) { destination->x = c * u->x / 16384; destination->y = c * u->y / 16384; destination->z = c * u->z / 16384; } -void CrossProduct(PHD_VECTOR* u, PHD_VECTOR* v, PHD_VECTOR* destination) // (F) (D) +void CrossProduct(PHD_VECTOR* u, PHD_VECTOR* v, PHD_VECTOR* destination) { destination->x = (u->y * v->z - u->z * v->y) / 16384; destination->y = (u->z * v->x - u->x * v->z) / 16384; destination->z = (u->x * v->y - u->y * v->x) / 16384; } -void _0x0046D420(int* matrix, short* angle) // (F) (D) +void _0x0046D420(int* matrix, short* angle) { angle[0] = phd_atan(sqrt(SQUARE(matrix[M22]) + SQUARE(matrix[M02])), matrix[M12]); if (matrix[M12] >= 0 && angle[0] > 0 || matrix[M12] < 0 && angle[0] < 0) @@ -148,7 +148,7 @@ void _0x0046D420(int* matrix, short* angle) // (F) (D) angle[2] = phd_atan(matrix[M00] * phd_cos(angle[1]) - matrix[M20] * phd_sin(angle[1]), matrix[M21] * phd_sin(angle[1]) - matrix[M01] * phd_cos(angle[1])); } -void RopeControl(short itemNumber) // (F) (D) +void RopeControl(short itemNumber) { ITEM_INFO* item; ROPE_STRUCT* rope; @@ -166,7 +166,7 @@ void RopeControl(short itemNumber) // (F) (D) } } -void RopeCollision(short itemNumber, ITEM_INFO* l, COLL_INFO* coll) // (F) (D) +void RopeCollision(short itemNumber, ITEM_INFO* l, COLL_INFO* coll) { ITEM_INFO* item; ROPE_STRUCT* rope; @@ -209,7 +209,7 @@ void RopeCollision(short itemNumber, ITEM_INFO* l, COLL_INFO* coll) // (F) (D) } } -void RopeDynamics(ROPE_STRUCT* rope) // (F) (D) +void RopeDynamics(ROPE_STRUCT* rope) { int flag, i; PENDULUM* pendulumPointer; @@ -369,7 +369,7 @@ void RopeDynamics(ROPE_STRUCT* rope) // (F) (D) } } -int _0x0046D200(ROPE_STRUCT* rope, int x, int y, int z, int radius) // (F) (D) +int _0x0046D200(ROPE_STRUCT* rope, int x, int y, int z, int radius) { int dx, dy, dz; @@ -387,7 +387,7 @@ int _0x0046D200(ROPE_STRUCT* rope, int x, int y, int z, int radius) // (F) (D) return -1; } -void ApplyVelocityToRope(int node, short angle, short n) // (F) (D) +void ApplyVelocityToRope(int node, short angle, short n) { SetPendulumVelocity( (unsigned short) n * phd_sin(angle) * 4096, @@ -395,7 +395,7 @@ void ApplyVelocityToRope(int node, short angle, short n) // (F) (D) (unsigned short) n * phd_cos(angle) * 4096); /* @ORIGINAL_BUG: casting n to unsigned short results in the rope glitch */ } -void SetPendulumVelocity(int x, int y, int z) // (F) (D) +void SetPendulumVelocity(int x, int y, int z) { int node; @@ -414,7 +414,7 @@ void SetPendulumVelocity(int x, int y, int z) // (F) (D) CurrentPendulum.Velocity.z += z; } -void _0x0046E1C0(ROPE_STRUCT* rope, int node) // (F) (D) +void _0x0046E1C0(ROPE_STRUCT* rope, int node) { CurrentPendulum.Position.x = rope->segment[node].x; CurrentPendulum.Position.y = rope->segment[node].y; @@ -429,7 +429,7 @@ void _0x0046E1C0(ROPE_STRUCT* rope, int node) // (F) (D) CurrentPendulum.Rope = rope; } -void _0x0046E080(ROPE_STRUCT* rope, PENDULUM* pendulumPointer, PHD_VECTOR* ropeVelocity, PHD_VECTOR* pendulumVelocity, int value) // (F) (D) +void _0x0046E080(ROPE_STRUCT* rope, PENDULUM* pendulumPointer, PHD_VECTOR* ropeVelocity, PHD_VECTOR* pendulumVelocity, int value) { PHD_VECTOR vec; int result; @@ -444,7 +444,7 @@ void _0x0046E080(ROPE_STRUCT* rope, PENDULUM* pendulumPointer, PHD_VECTOR* ropeV pendulumVelocity->z -= ((int64_t) result * vec.z) / 65536; } -void _0x0046DF00(PHD_VECTOR* segment, PHD_VECTOR* nextSegment, PHD_VECTOR* velocity, PHD_VECTOR* nextVelocity, int length) // (F) (D) +void _0x0046DF00(PHD_VECTOR* segment, PHD_VECTOR* nextSegment, PHD_VECTOR* velocity, PHD_VECTOR* nextVelocity, int length) { PHD_VECTOR vec; int result; @@ -465,7 +465,7 @@ void _0x0046DF00(PHD_VECTOR* segment, PHD_VECTOR* nextSegment, PHD_VECTOR* veloc nextVelocity->z -= vec.z; } -void UpdateRopeSwing(ITEM_INFO* item) // (F) (D) +void UpdateRopeSwing(ITEM_INFO* item) { if (Lara.ropeMaxXForward > 9000) { @@ -558,7 +558,7 @@ void UpdateRopeSwing(ITEM_INFO* item) // (F) (D) } } -void JumpOffRope(ITEM_INFO* item) // (F) (D) +void JumpOffRope(ITEM_INFO* item) { if (Lara.ropePtr != -1) { @@ -599,7 +599,7 @@ void JumpOffRope(ITEM_INFO* item) // (F) (D) } } -void FallFromRope(ITEM_INFO* item) // (F) (D) +void FallFromRope(ITEM_INFO* item) { item->speed = (abs(CurrentPendulum.Velocity.x / 65536) + abs(CurrentPendulum.Velocity.z / 65536)) / 2; item->pos.xRot = 0; @@ -617,7 +617,7 @@ void FallFromRope(ITEM_INFO* item) // (F) (D) Lara.ropePtr = -1; } -void LaraClimbRope(ITEM_INFO* item, COLL_INFO* coll) // (F) (D) +void LaraClimbRope(ITEM_INFO* item, COLL_INFO* coll) { if (!(TrInput & IN_ACTION)) { @@ -665,7 +665,7 @@ void LaraClimbRope(ITEM_INFO* item, COLL_INFO* coll) // (F) (D) } } -void DelAlignLaraToRope(ITEM_INFO* item) // (F) (D) +void DelAlignLaraToRope(ITEM_INFO* item) { ROPE_STRUCT* rope; short ropeY; diff --git a/TR5Main/Game/tomb4fx.cpp b/TR5Main/Game/tomb4fx.cpp index b9212012b..3e4998a9f 100644 --- a/TR5Main/Game/tomb4fx.cpp +++ b/TR5Main/Game/tomb4fx.cpp @@ -630,7 +630,7 @@ void TriggerShatterSmoke(int x, int y, int z) spark->size = spark->dSize / 8; } -int GetFreeBlood()// (F) +int GetFreeBlood() { BLOOD_STRUCT* blood = &Blood[NextBlood]; int bloodNum = NextBlood; @@ -668,7 +668,7 @@ int GetFreeBlood()// (F) return bloodNum; } -void TriggerBlood(int x, int y, int z, int unk, int num)// (F) +void TriggerBlood(int x, int y, int z, int unk, int num) { for (int i = 0; i < num; i++) { @@ -1041,7 +1041,7 @@ void AddWaterSparks(int x, int y, int z, int num) } } -void LaraBubbles(ITEM_INFO* item)// (F) +void LaraBubbles(ITEM_INFO* item) { PHD_VECTOR pos; int num, i; @@ -1160,7 +1160,7 @@ void UpdateDrips() } } -void TriggerLaraDrips()// (F) +void TriggerLaraDrips() { PHD_VECTOR pos; @@ -1316,7 +1316,7 @@ int ExplodingDeath(short itemNumber, int meshBits, short flags) return item->meshBits == 0; } -int GetFreeShockwave()// (F) +int GetFreeShockwave() { for (int i = 0; i < MAX_SHOCKWAVE; i++) { @@ -1327,7 +1327,7 @@ int GetFreeShockwave()// (F) return -1; } -void TriggerShockwave(PHD_3DPOS* pos, short innerRad, short outerRad, int speed, char r, char g, char b, char life, short angle, short flags)// (F) +void TriggerShockwave(PHD_3DPOS* pos, short innerRad, short outerRad, int speed, char r, char g, char b, char life, short angle, short flags) { int s = GetFreeShockwave(); SHOCKWAVE_STRUCT* sptr; @@ -1459,7 +1459,7 @@ void UpdateShockwaves() } } -void TriggerExplosionBubble(int x, int y, int z, short roomNum)// (F) +void TriggerExplosionBubble(int x, int y, int z, short roomNum) { int dx = LaraItem->pos.xPos - x; int dz = LaraItem->pos.zPos - z; @@ -1507,7 +1507,7 @@ void TriggerExplosionBubble(int x, int y, int z, short roomNum)// (F) } } -/*void TriggerExplosionSmokeEnd(int x, int y, int z, int unk)// (F) +/*void TriggerExplosionSmokeEnd(int x, int y, int z, int unk) { SPARKS* spark = &Sparks[GetFreeSpark()]; @@ -1577,7 +1577,7 @@ void TriggerExplosionBubble(int x, int y, int z, short roomNum)// (F) spark->size = size >> 2; } */ -/*void DrawLensFlares(ITEM_INFO* item)// (F) +/*void DrawLensFlares(ITEM_INFO* item) { GAME_VECTOR pos; @@ -1589,7 +1589,7 @@ void TriggerExplosionBubble(int x, int y, int z, short roomNum)// (F) SetUpLensFlare(0, 0, 0, &pos); }*/ -void TriggerLightningGlow(int x, int y, int z, byte size, byte r, byte g, byte b)// (F) +void TriggerLightningGlow(int x, int y, int z, byte size, byte r, byte g, byte b) { SPARKS* spark = &Sparks[GetFreeSpark()]; @@ -1619,7 +1619,7 @@ void TriggerLightningGlow(int x, int y, int z, byte size, byte r, byte g, byte b spark->dSize = spark->sSize = spark->size = size + (GetRandomControl() & 3); } -void TriggerFenceSparks(int x, int y, int z, int kill, int crane)//(F) +void TriggerFenceSparks(int x, int y, int z, int kill, int crane) { SPARKS* spark = &Sparks[GetFreeSpark()]; spark->on = 1; diff --git a/TR5Main/Game/traps.cpp b/TR5Main/Game/traps.cpp index 542e3ab53..b61b5c252 100644 --- a/TR5Main/Game/traps.cpp +++ b/TR5Main/Game/traps.cpp @@ -155,7 +155,7 @@ void FlameEmitterControl(short itemNumber) } } -void FlameEmitter2Control(short itemNumber)//5A1BC, 5A638 (F) +void FlameEmitter2Control(short itemNumber) { ITEM_INFO* item = &g_Level.Items[itemNumber]; @@ -676,7 +676,7 @@ void WreckingBallControl(short itemNumber) WBRoom = room; } -void FlameEmitterCollision(short itemNumber, ITEM_INFO* l, COLL_INFO* coll) // (F) (D) +void FlameEmitterCollision(short itemNumber, ITEM_INFO* l, COLL_INFO* coll) { ITEM_INFO* item = &g_Level.Items[itemNumber]; diff --git a/TR5Main/Specific/input.cpp b/TR5Main/Specific/input.cpp index 955b4498d..04f28640f 100644 --- a/TR5Main/Specific/input.cpp +++ b/TR5Main/Specific/input.cpp @@ -160,7 +160,7 @@ int Key(int number) return 0; } -int S_UpdateInput()// (F) +int S_UpdateInput() { DI_ReadKeyboard(KeyMap); From 483736e86a6002fc60ed4fb67fb3cfd02644fda8 Mon Sep 17 00:00:00 2001 From: Raildex Date: Wed, 3 Feb 2021 16:21:24 +0100 Subject: [PATCH 20/23] Removing Debug Console --- TR5Main/Specific/winmain.cpp | 45 ------------------------------------ 1 file changed, 45 deletions(-) diff --git a/TR5Main/Specific/winmain.cpp b/TR5Main/Specific/winmain.cpp index 1ef179967..8fa1a96b2 100644 --- a/TR5Main/Specific/winmain.cpp +++ b/TR5Main/Specific/winmain.cpp @@ -33,7 +33,6 @@ extern int IsLevelLoading; extern GameFlow* g_GameFlow; extern GameScript* g_GameScript; extern GameConfiguration g_Configuration; -DWORD DebugConsoleThreadID; DWORD MainThreadID; bool BlockAllInput = true; int skipLoop = -1; @@ -191,12 +190,6 @@ void HandleScriptMessage(WPARAM wParam) LRESULT CALLBACK WinAppProc(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam) { - if (msg == WM_USER + 0) - { - HandleScriptMessage(wParam); - return 0; - } - // Disables ALT + SPACE if (msg == WM_SYSCOMMAND && wParam == SC_KEYMENU) return 0; @@ -388,44 +381,6 @@ int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine UpdateWindow(WindowsHandle); ShowWindow(WindowsHandle, nShowCmd); - //Create debug script terminal - if (Debug) - { - MainThreadID = GetWindowThreadProcessId(WindowsHandle, NULL); - AllocConsole(); - HANDLE handle_in = GetStdHandle(STD_INPUT_HANDLE); - DWORD consoleModeIn; - int hCrt = _open_osfhandle((long)handle_in, _O_BINARY); - FILE* hf_in = _fdopen(hCrt, "r"); - setvbuf(hf_in, NULL, _IONBF, 512); - GetConsoleMode(handle_in, &consoleModeIn); - consoleModeIn = consoleModeIn | ENABLE_LINE_INPUT; - SetConsoleMode(handle_in, consoleModeIn); - freopen_s(&hf_in, "CONIN$", "r", stdin); - - HANDLE ConsoleOutput = GetStdHandle(STD_OUTPUT_HANDLE); - int SystemOutput = _open_osfhandle(intptr_t(ConsoleOutput), _O_TEXT); - FILE* COutputHandle = _fdopen(SystemOutput, "w"); - freopen_s(&COutputHandle, "CONOUT$", "w", stdout); - - LPTHREAD_START_ROUTINE readConsoleLoop = [](LPVOID params) -> DWORD { - DWORD read; - CHAR buffer[4096]; - while (true) - { - BOOL success = ReadFile(params, &buffer, 4096, &read, NULL); - if (success && read > 2) - { - //Only send the actual written message minus \r\n - string msg(buffer, read-2); - SendMessage(WindowsHandle, WM_USER, (WPARAM)&msg, NULL); - } - }; - return 0; - }; - CreateThread(NULL, 0, readConsoleLoop, handle_in, 0, &DebugConsoleThreadID); - } - SetCursor(NULL); ShowCursor(FALSE); hAccTable = LoadAccelerators(hInstance, (LPCSTR)0x65); From b4303e030ad87bf70099eb2531fffa1f608a9c61 Mon Sep 17 00:00:00 2001 From: Trxye Date: Thu, 4 Feb 2021 17:36:03 -0600 Subject: [PATCH 21/23] uncomment original GetFloorHeight things --- TR5Main/Game/control.cpp | 354 ++++++++++++++++++++------------------- 1 file changed, 178 insertions(+), 176 deletions(-) diff --git a/TR5Main/Game/control.cpp b/TR5Main/Game/control.cpp index 52d63528a..b202bc3e7 100644 --- a/TR5Main/Game/control.cpp +++ b/TR5Main/Game/control.cpp @@ -1653,7 +1653,7 @@ int CheckNoColCeilingTriangle(FLOOR_INFO *floor, int x, int z) int GetFloorHeight(FLOOR_INFO *floor, int x, int y, int z) { -#if 0 + TiltYOffset = 0; TiltXOffset = 0; OnObject = 0; @@ -1670,196 +1670,198 @@ int GetFloorHeight(FLOOR_INFO *floor, int x, int y, int z) } int height = floor->floor * 256; - if (height == NO_HEIGHT) - return height; -#endif - - TriggerIndex = NULL; - - /*if (floor->index == 0) - return height;*/ - - short *data = &g_Level.FloorData[floor->index]; - short type, hadj; - - int xOff, yOff, trigger; - /*ITEM_INFO *item; - OBJECT_INFO *obj; - int tilts, t0, t1, t2, t3, t4, dx, dz, h1, h2;*/ - - do + if (height != NO_HEIGHT) { - type = *(data++); + // return height; - switch (type & DATA_TYPE) + + TriggerIndex = NULL; + + if (floor->index != 0) { - case DOOR_TYPE: - case ROOF_TYPE: - case SPLIT3: - case SPLIT4: - case NOCOLC1T: - case NOCOLC1B: - case NOCOLC2T: - case NOCOLC2B: - data++; - break; + // return height; - case TILT_TYPE: - /*TiltXOffset = xOff = (*data >> 8); - TiltYOffset = yOff = *(char *)data; - - if ((abs(xOff)) > 2 || (abs(yOff)) > 2) - HeightType = BIG_SLOPE; - else - HeightType = SMALL_SLOPE; - - if (xOff >= 0) - height += (xOff * ((-1 - z) & 1023) >> 2); - else - height -= (xOff * (z & 1023) >> 2); - - if (yOff >= 0) - height += yOff * ((-1 - x) & 1023) >> 2; - else - height -= yOff * (x & 1023) >> 2;*/ - - data++; - break; - - case TRIGGER_TYPE: - if (!TriggerIndex) - TriggerIndex = data - 1; - - data++; + short* data = &g_Level.FloorData[floor->index]; + short type, hadj; + int xOff, yOff, trigger; + ITEM_INFO* item; + OBJECT_INFO* obj; + int tilts, t0, t1, t2, t3, t4, dx, dz, h1, h2; do { - trigger = *(data++); + type = *(data++); - if (TRIG_BITS(trigger) != TO_OBJECT) + switch (type & DATA_TYPE) { - if (TRIG_BITS(trigger) == TO_CAMERA || - TRIG_BITS(trigger) == TO_FLYBY) + case DOOR_TYPE: + case ROOF_TYPE: + case SPLIT3: + case SPLIT4: + case NOCOLC1T: + case NOCOLC1B: + case NOCOLC2T: + case NOCOLC2B: + data++; + break; + + case TILT_TYPE: + TiltXOffset = xOff = (*data >> 8); + TiltYOffset = yOff = *(char*)data; + + if ((abs(xOff)) > 2 || (abs(yOff)) > 2) + HeightType = BIG_SLOPE; + else + HeightType = SMALL_SLOPE; + + if (xOff >= 0) + height += (xOff * ((-1 - z) & 1023) >> 2); + else + height -= (xOff * (z & 1023) >> 2); + + if (yOff >= 0) + height += yOff * ((-1 - x) & 1023) >> 2; + else + height -= yOff * (x & 1023) >> 2; + + data++; + break; + + case TRIGGER_TYPE: + if (!TriggerIndex) + TriggerIndex = data - 1; + + data++; + + do { trigger = *(data++); - } - } - else - { - /*item = &g_Level.Items[trigger & VALUE_BITS]; - obj = &Objects[item->objectNumber]; - if (obj->floor && !(item->flags & 0x8000)) + if (TRIG_BITS(trigger) != TO_OBJECT) + { + if (TRIG_BITS(trigger) == TO_CAMERA || + TRIG_BITS(trigger) == TO_FLYBY) + { + trigger = *(data++); + } + } + else + { + /*item = &g_Level.Items[trigger & VALUE_BITS]; + obj = &Objects[item->objectNumber]; + + if (obj->floor && !(item->flags & 0x8000)) + { + (obj->floor)(item, x, y, z, &height); + }*/ + } + + } while (!(trigger & END_BIT)); + break; + + case LAVA_TYPE: + TriggerIndex = data - 1; + break; + + case CLIMB_TYPE: + case MONKEY_TYPE: + case TRIGTRIGGER_TYPE: + if (!TriggerIndex) + TriggerIndex = data - 1; + break; + + case SPLIT1: + case SPLIT2: + case NOCOLF1T: + case NOCOLF1B: + case NOCOLF2T: + case NOCOLF2B: + tilts = *data; + t0 = tilts & 15; + t1 = (tilts >> 4) & 15; + t2 = (tilts >> 8) & 15; + t3 = (tilts >> 12) & 15; + + dx = x & 1023; + dz = z & 1023; + + xOff = yOff = 0; + + HeightType = SPLIT_TRI; + SplitFloor = (type & DATA_TYPE); + + if ((type & DATA_TYPE) == SPLIT1 || + (type & DATA_TYPE) == NOCOLF1T || + (type & DATA_TYPE) == NOCOLF1B) { - (obj->floor)(item, x, y, z, &height); - }*/ + if (dx <= (1024 - dz)) + { + hadj = (type >> 10) & 0x1F; + if (hadj & 0x10) + hadj |= 0xfff0; + height += 256 * hadj; + xOff = t2 - t1; + yOff = t0 - t1; + } + else + { + hadj = (type >> 5) & 0x1F; + if (hadj & 0x10) + hadj |= 0xFFF0; + height += 256 * hadj; + xOff = t3 - t0; + yOff = t3 - t2; + } + } + else + { + if (dx <= dz) + { + hadj = (type >> 10) & 0x1f; + if (hadj & 0x10) + hadj |= 0xfff0; + height += 256 * hadj; + xOff = t2 - t1; + yOff = t3 - t2; + } + else + { + hadj = (type >> 5) & 0x1f; + if (hadj & 0x10) + hadj |= 0xfff0; + height += 256 * hadj; + xOff = t3 - t0; + yOff = t0 - t1; + } + } + + TiltXOffset = xOff; + TiltYOffset = yOff; + + if ((abs(xOff)) > 2 || (abs(yOff)) > 2) + HeightType = DIAGONAL; + else if (HeightType != SPLIT_TRI) + HeightType = SMALL_SLOPE; + + if (xOff >= 0) + height += xOff * ((-1 - z) & 1023) >> 2; + else + height -= xOff * (z & 1023) >> 2; + + if (yOff >= 0) + height += yOff * ((-1 - x) & 1023) >> 2; + else + height -= yOff * (x & 1023) >> 2; + + data++; + break; + + default: + break; } - - } while (!(trigger & END_BIT)); - break; - - case LAVA_TYPE: - TriggerIndex = data - 1; - break; - - case CLIMB_TYPE: - case MONKEY_TYPE: - case TRIGTRIGGER_TYPE: - if (!TriggerIndex) - TriggerIndex = data - 1; - break; - - case SPLIT1: - case SPLIT2: - case NOCOLF1T: - case NOCOLF1B: - case NOCOLF2T: - case NOCOLF2B: - /*tilts = *data; - t0 = tilts & 15; - t1 = (tilts >> 4) & 15; - t2 = (tilts >> 8) & 15; - t3 = (tilts >> 12) & 15; - - dx = x & 1023; - dz = z & 1023; - - xOff = yOff = 0; - - HeightType = SPLIT_TRI; - SplitFloor = (type & DATA_TYPE); - - if ((type & DATA_TYPE) == SPLIT1 || - (type & DATA_TYPE) == NOCOLF1T || - (type & DATA_TYPE) == NOCOLF1B) - { - if (dx <= (1024 - dz)) - { - hadj = (type >> 10) & 0x1F; - if (hadj & 0x10) - hadj |= 0xfff0; - height += 256 * hadj; - xOff = t2 - t1; - yOff = t0 - t1; - } - else - { - hadj = (type >> 5) & 0x1F; - if (hadj & 0x10) - hadj |= 0xFFF0; - height += 256 * hadj; - xOff = t3 - t0; - yOff = t3 - t2; - } - } - else - { - if (dx <= dz) - { - hadj = (type >> 10) & 0x1f; - if (hadj & 0x10) - hadj |= 0xfff0; - height += 256 * hadj; - xOff = t2 - t1; - yOff = t3 - t2; - } - else - { - hadj = (type >> 5) & 0x1f; - if (hadj & 0x10) - hadj |= 0xfff0; - height += 256 * hadj; - xOff = t3 - t0; - yOff = t0 - t1; - } - } - - TiltXOffset = xOff; - TiltYOffset = yOff; - - if ((abs(xOff)) > 2 || (abs(yOff)) > 2) - HeightType = DIAGONAL; - else if (HeightType != SPLIT_TRI) - HeightType = SMALL_SLOPE; - - if (xOff >= 0) - height += xOff * ((-1 - z) & 1023) >> 2; - else - height -= xOff * (z & 1023) >> 2; - - if (yOff >= 0) - height += yOff * ((-1 - x) & 1023) >> 2; - else - height -= yOff * (x & 1023) >> 2; - */ - data++; - break; - - default: - break; + } while (!(type & END_BIT)); } - } while (!(type & END_BIT)); - + } /*return height;*/ return GetFloorHeight(floor->Room, x, y, z).value_or(NO_HEIGHT); From f97c8496a0c4596cbd82c5ef64a73f2e7e562943 Mon Sep 17 00:00:00 2001 From: Trxye Date: Fri, 5 Feb 2021 16:38:00 -0600 Subject: [PATCH 22/23] fix lara ladder climb out --- TR5Main/Game/Lara/lara_surface.cpp | 1 + 1 file changed, 1 insertion(+) diff --git a/TR5Main/Game/Lara/lara_surface.cpp b/TR5Main/Game/Lara/lara_surface.cpp index 4dab37c76..a5c5b5091 100644 --- a/TR5Main/Game/Lara/lara_surface.cpp +++ b/TR5Main/Game/Lara/lara_surface.cpp @@ -490,6 +490,7 @@ int LaraTestLadderClimbOut(ITEM_INFO* item, COLL_INFO* coll) // NEW function for AnimateLara(item); item->pos.yRot = rot; + item->pos.yPos -= 10;//otherwise she falls back into the water Lara.gunStatus = LG_HANDS_BUSY; item->pos.zRot = 0; item->pos.xRot = 0; From e8f19f49ed435a2dff4378c7196ba706b0641483 Mon Sep 17 00:00:00 2001 From: Trxye Date: Fri, 5 Feb 2021 16:44:09 -0600 Subject: [PATCH 23/23] keep lara grabbing the ladder when water->ladder exit --- TR5Main/Game/Lara/lara_climb.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/TR5Main/Game/Lara/lara_climb.cpp b/TR5Main/Game/Lara/lara_climb.cpp index 1e5584ab2..21ece5b33 100644 --- a/TR5Main/Game/Lara/lara_climb.cpp +++ b/TR5Main/Game/Lara/lara_climb.cpp @@ -999,7 +999,7 @@ int LaraCheckForLetGo(ITEM_INFO* item, COLL_INFO* coll) coll->trigger = TriggerIndex; - if (TrInput & IN_ACTION && item->hitPoints > 0) + if (TrInput & IN_ACTION && item->hitPoints > 0 || item->animNumber == LA_ONWATER_TO_LADDER)//can't let go on this anim return 0; Lara.torsoYrot = 0;