diff --git a/TR5Main/Game/camera.cpp b/TR5Main/Game/camera.cpp index 021cf3686..6e317ab9e 100644 --- a/TR5Main/Game/camera.cpp +++ b/TR5Main/Game/camera.cpp @@ -1448,7 +1448,7 @@ void BinocularCamera(ITEM_INFO* item) { GetTargetOnLOS(&Camera.pos, &Camera.target, 0, 0); - if (!(InputBusy & IN_ACTION) || Infrared) + if (!(InputBusy & IN_ACTION)) { // Reimplement this mode? } diff --git a/TR5Main/Game/control.cpp b/TR5Main/Game/control.cpp index 4940de3b7..8d22519ac 100644 --- a/TR5Main/Game/control.cpp +++ b/TR5Main/Game/control.cpp @@ -6,6 +6,7 @@ #include "camera.h" #include "Lara.h" #include "effects/hair.h" +#include "effects/flmtorch.h" #include "items.h" #include "flipeffect.h" #include "draw.h" @@ -60,58 +61,48 @@ using namespace TEN::Renderer; using namespace TEN::Math::Random; using namespace TEN::Floordata; -int RumbleTimer = 0; -int InGameCnt = 0; -bool InItemControlLoop; +int GameTimer = 0; +int RumbleTimer = 0; +int InGameCounter = 0; +short GlobalCounter = 0; +int Wibble = 0; + +bool InitialiseGame; +bool DoTheGame; +bool JustLoaded; +bool ThreadEnded; + +int RequiredStartPos; +int CurrentLevel; +int LevelComplete; + +bool InItemControlLoop; short ItemNewRoomNo; short ItemNewRooms[512]; -short NextFxActive; -short NextFxFree; short NextItemActive; short NextItemFree; +short NextFxActive; +short NextFxFree; + +bool DisableLaraControl = false; +bool OldLaraBusy; -int DisableLaraControl = 0; int WeatherType; int LaraDrawType; -int NumAnimatedTextures; -short *AnimTextureRanges; -int nAnimUVRanges; -int Wibble = 0; -int SetDebounce = 0; -std::string CurrentAtmosphere; -short CurrentRoom; -int GameTimer; -short GlobalCounter; -byte LevelComplete; #ifndef NEW_INV int LastInventoryItem; +extern Inventory g_Inventory; #endif -int TrackCameraInit; -short TorchRoom; -int InitialiseGame; -int RequiredStartPos; + int WeaponDelay; int WeaponEnemyTimer; -int CutSeqNum; -int CurrentLevel; -bool DoTheGame; -bool ThreadEnded; -int OnFloor; -int TriggerTimer; -int JustLoaded; -int OldLaraBusy; -int Infrared; -std::vector OutsideRoomTable[OUTSIDE_SIZE][OUTSIDE_SIZE]; short IsRoomOutsideNo; +std::vector OutsideRoomTable[OUTSIDE_SIZE][OUTSIDE_SIZE]; extern GameFlow *g_GameFlow; extern GameScript *g_GameScript; -#ifndef NEW_INV -extern Inventory g_Inventory; -#endif -extern int SplashCount; // This might not be the exact amount of time that has passed, but giving it a // value of 1/30 keeps it in lock-step with the rest of the game logic, @@ -290,8 +281,6 @@ GAME_STATUS ControlPhase(int numFrames, int demoMode) DbInput = 0; } } - - Infrared = false; } else if (BinocularRange == 0) { @@ -304,20 +293,6 @@ GAME_STATUS ControlPhase(int numFrames, int demoMode) Lara.busy = true; LaserSight = true; - Infrared = true; - } - else - Infrared = false; - } - else - { - if (LaserSight) - { - Infrared = true; - } - else - { - Infrared = false; } } } @@ -599,12 +574,12 @@ GAME_STATUS DoTitle(int index) InitSpotCamSequences(); InitialiseSpotCam(2); - CurrentAtmosphere = "083_horus"; + CurrentLoopedSoundTrack = "083_horus"; UseSpotCam = true; // Play background music - //CurrentAtmosphere = ambient; - S_CDPlay(CurrentAtmosphere, 1); + //CurrentLoopedSoundTrack = ambient; + S_CDPlay(CurrentLoopedSoundTrack, 1); // Initialise ponytails InitialiseHair(); @@ -753,8 +728,8 @@ GAME_STATUS DoLevel(int index, std::string ambient, bool loadFromSavegame) InitSpotCamSequences(); // Play background music - CurrentAtmosphere = ambient; - S_CDPlay(CurrentAtmosphere, 1); + CurrentLoopedSoundTrack = ambient; + S_CDPlay(CurrentLoopedSoundTrack, 1); // Initialise ponytails InitialiseHair(); @@ -1165,7 +1140,7 @@ void RumbleScreen() { if (!(GetRandomControl() & 0x1FF)) { - InGameCnt = 0; + InGameCounter = 0; RumbleTimer = -32 - (GetRandomControl() & 0x1F); return; } @@ -1173,15 +1148,15 @@ void RumbleScreen() if (RumbleTimer < 0) { - if (InGameCnt >= abs(RumbleTimer)) + if (InGameCounter >= abs(RumbleTimer)) { Camera.bounce = -(GetRandomControl() % abs(RumbleTimer)); RumbleTimer++; } else { - InGameCnt++; - Camera.bounce = -(GetRandomControl() % InGameCnt); + InGameCounter++; + Camera.bounce = -(GetRandomControl() % InGameCounter); } } } @@ -1404,6 +1379,9 @@ int IsRoomOutside(int x, int y, int z) void ResetGlobals() { + // Reset oscillator seed + Wibble = 0; + // Needs to be cleared or otherwise controls will lockup if user will exit to title // while playing flyby with locked controls DisableLaraControl = false; diff --git a/TR5Main/Game/control.h b/TR5Main/Game/control.h index 3ae215a34..67a4ef5cf 100644 --- a/TR5Main/Game/control.h +++ b/TR5Main/Game/control.h @@ -54,37 +54,25 @@ extern short NextFxActive; extern short NextFxFree; extern short NextItemActive; extern short NextItemFree; -extern int DisableLaraControl; +extern bool DisableLaraControl; extern int WeatherType; extern int LaraDrawType; -extern int NumAnimatedTextures; -extern short* AnimTextureRanges; -extern int nAnimUVRanges; extern int Wibble; -extern int SetDebounce; -extern std::string CurrentAtmosphere; -extern short CurrentRoom; extern int GameTimer; extern short GlobalCounter; -extern byte LevelComplete; +extern int LevelComplete; #ifndef NEW_INV extern int LastInventoryItem; #endif -extern int TrackCameraInit; -extern short TorchRoom; -extern int InitialiseGame; +extern bool InitialiseGame; extern int RequiredStartPos; extern int WeaponDelay; extern int WeaponEnemyTimer; -extern int CutSeqNum; extern int CurrentLevel; extern bool DoTheGame; extern bool ThreadEnded; -extern int OnFloor; -extern int TriggerTimer; -extern int JustLoaded; -extern int OldLaraBusy; -extern int Infrared; +extern bool JustLoaded; +extern bool OldLaraBusy; extern std::vector OutsideRoomTable[OUTSIDE_SIZE][OUTSIDE_SIZE]; extern short IsRoomOutsideNo; diff --git a/TR5Main/Game/control/trigger.cpp b/TR5Main/Game/control/trigger.cpp index 1a5416487..2a42ed971 100644 --- a/TR5Main/Game/control/trigger.cpp +++ b/TR5Main/Game/control/trigger.cpp @@ -18,6 +18,7 @@ using namespace TEN::Entities::Switches; +int TriggerTimer; int KeyTriggerActive; int TriggerActive(ITEM_INFO* item) diff --git a/TR5Main/Game/control/trigger.h b/TR5Main/Game/control/trigger.h index 22cf51d28..5d41bf3f7 100644 --- a/TR5Main/Game/control/trigger.h +++ b/TR5Main/Game/control/trigger.h @@ -57,6 +57,7 @@ enum TRIGOBJECTS_TYPES TO_CUTSCENE }; +extern int TriggerTimer; extern int KeyTriggerActive; bool GetKeyTrigger(ITEM_INFO* item); diff --git a/TR5Main/Game/effects/flmtorch.cpp b/TR5Main/Game/effects/flmtorch.cpp index d840ae03d..c934c991a 100644 --- a/TR5Main/Game/effects/flmtorch.cpp +++ b/TR5Main/Game/effects/flmtorch.cpp @@ -1,16 +1,14 @@ #include "framework.h" -#include "effects\flmtorch.h" -#include "effects\effects.h" +#include "effects/flmtorch.h" +#include "effects/effects.h" #include "lara_flare.h" #include "lara.h" -#include "lara_fire.h" #include "draw.h" #include "items.h" #include "level.h" #include "setup.h" #include "input.h" -#include "Sound\sound.h" -#include "snowmobile.h" +#include "Sound/sound.h" extern OBJECT_COLLISION_BOUNDS FireBounds; @@ -163,8 +161,6 @@ void DoFlameTorch() TriggerTorchFlame(LaraItem - g_Level.Items.data(), 0); SoundEffect(SFX_TR4_LOOP_FOR_SMALL_FIRES, (PHD_3DPOS*)&pos, 0); - - TorchRoom = LaraItem->roomNumber; } } @@ -242,7 +238,6 @@ void TorchControl(short itemNumber) TriggerDynamicLight(item->pos.xPos, item->pos.yPos, item->pos.zPos, 12 - (GetRandomControl() & 1), (GetRandomControl() & 0x3F) + 192, (GetRandomControl() & 0x1F) + 96, 0); if (!(Wibble & 7)) TriggerTorchFlame(itemNumber, 1); - TorchRoom = item->roomNumber; SoundEffect(SFX_TR4_LOOP_FOR_SMALL_FIRES, &item->pos, 0); } } diff --git a/TR5Main/Game/inventory.cpp b/TR5Main/Game/inventory.cpp index b7688dcdb..77b02b5ff 100644 --- a/TR5Main/Game/inventory.cpp +++ b/TR5Main/Game/inventory.cpp @@ -1878,8 +1878,8 @@ int Inventory::DoTitleInventory() UpdateSceneAndDrawInventory(); } - CurrentAtmosphere = CDA_XA11_FLYBY1; - S_CDPlay(CurrentAtmosphere, 1); + CurrentLoopedSoundTrack = CDA_XA11_FLYBY1; + S_CDPlay(CurrentLoopedSoundTrack, 1); OpenRing(INV_RING_OPTIONS, true); @@ -1888,7 +1888,6 @@ int Inventory::DoTitleInventory() while (true /*!ResetFlag*/) { SetDebounce = true; - S_UpdateInput(); SetDebounce = false; @@ -2093,9 +2092,9 @@ int Inventory::DoPassport() int selectedSavegame = 0; while (true) { - SetDebounce = 1; + SetDebounce = true; S_UpdateInput(); - SetDebounce = 0; + SetDebounce = false; // Process input if (DbInput & IN_DESELECT) @@ -2165,9 +2164,9 @@ int Inventory::DoPassport() int selectedSavegame = 0; while (true) { - SetDebounce = 1; + SetDebounce = true; S_UpdateInput(); - SetDebounce = 0; + SetDebounce = false; // Process input if (DbInput & IN_DESELECT) @@ -2240,9 +2239,9 @@ int Inventory::DoPassport() int selectedLevel = 0; while (true) { - SetDebounce = 1; + SetDebounce = true; S_UpdateInput(); - SetDebounce = 0; + SetDebounce = false; // Process input if (DbInput & IN_DESELECT) @@ -2309,9 +2308,9 @@ int Inventory::DoPassport() // New game while (true) { - SetDebounce = 1; + SetDebounce = true; S_UpdateInput(); - SetDebounce = 0; + SetDebounce = false; // Process input if (DbInput & IN_DESELECT) @@ -2363,9 +2362,9 @@ int Inventory::DoPassport() // Exit game while (true) { - SetDebounce = 1; + SetDebounce = true; S_UpdateInput(); - SetDebounce = 0; + SetDebounce = false; // Process input if (DbInput & IN_DESELECT) @@ -2417,9 +2416,9 @@ int Inventory::DoPassport() // Exit game while (true) { - SetDebounce = 1; + SetDebounce = true; S_UpdateInput(); - SetDebounce = 0; + SetDebounce = false; // Process input if (DbInput & IN_DESELECT) diff --git a/TR5Main/Game/newinv2.cpp b/TR5Main/Game/newinv2.cpp index 4a6802f77..d2011b720 100644 --- a/TR5Main/Game/newinv2.cpp +++ b/TR5Main/Game/newinv2.cpp @@ -1232,9 +1232,9 @@ int DoPauseMenu() } clear_input_vars(1); - SetDebounce = 1; + SetDebounce = true; S_UpdateInput(); - SetDebounce = 0; + SetDebounce = false; do_debounced_input(); if (pause_menu_to_display <= pause_options_menu) @@ -3603,7 +3603,7 @@ int S_CallInventory2() if (compassNeedleAngle != 1024) compassNeedleAngle -= 32; - SetDebounce = 1; + SetDebounce = true; S_UpdateInput(); TrInput = InputBusy; GameTimer++; @@ -3646,7 +3646,7 @@ int S_CallInventory2() /* do { S_InitialisePolyList(); - SetDebounce = 1; + SetDebounce = true; S_UpdateInput(); input = inputBusy; UpdatePulseColour(); diff --git a/TR5Main/Game/savegame.cpp b/TR5Main/Game/savegame.cpp index d29093012..a14efa348 100644 --- a/TR5Main/Game/savegame.cpp +++ b/TR5Main/Game/savegame.cpp @@ -7,6 +7,7 @@ #include "spotcam.h" #include "traps.h" #include "control/flipmap.h" +#include "sound/sound.h" #include "level.h" #include "setup.h" #include "flipeffect.h" @@ -69,7 +70,7 @@ std::unique_ptr SaveGame::m_chunkExamineCombo; std::unique_ptr SaveGame::m_chunkWeaponItem; SAVEGAME_INFO Savegame; -//extern vector g_AudioTracks; +//extern vector SoundTracks; void SaveGame::saveItems() { @@ -181,7 +182,7 @@ void SaveGame::saveGameStatus(int arg1, int arg2) #endif LEB128::Write(m_stream, FlipEffect); LEB128::Write(m_stream, FlipTimer); - //LEB128::Write(m_stream, CurrentAtmosphere); + //LEB128::Write(m_stream, CurrentLoopedSoundTrack); LEB128::Write(m_stream, CurrentSequence); // Now the sub-chunks @@ -195,8 +196,8 @@ void SaveGame::saveGameStatus(int arg1, int arg2) for (int i = 0; i < NumberSpotcams; i++) m_writer->WriteChunk(m_chunkFlybyFlags.get(), &saveFlybyFlags, i, SpotCam[i].flags); - for (int i = 0; i < g_AudioTracks.size(); i++) - m_writer->WriteChunk(m_chunkCdFlags.get(), &saveCdFlags, i, g_AudioTracks[i].Mask); + for (int i = 0; i < SoundTracks.size(); i++) + m_writer->WriteChunk(m_chunkCdFlags.get(), &saveCdFlags, i, SoundTracks[i].Mask); for (int i = 0; i < NumberCameras; i++) m_writer->WriteChunk(m_chunkCamera.get(), &saveCamera, i, FixedCameras[i].flags); @@ -451,7 +452,7 @@ bool SaveGame::readGameStatus() LastInventoryItem = LEB128::ReadInt32(m_stream); #endif FlipEffect = LEB128::ReadInt32(m_stream); - CurrentAtmosphere = LEB128::ReadByte(m_stream); + CurrentLoopedSoundTrack = LEB128::ReadByte(m_stream); CurrentSequence = LEB128::ReadByte(m_stream); m_reader->ReadChunks(&readGameStatusChunks, 0); @@ -839,8 +840,8 @@ bool SaveGame::readGameStatusChunks(ChunkId* chunkId, int maxSize, int arg) short index = LEB128::ReadInt16(m_stream); printf("Index: %d\n", index); short value = LEB128::ReadInt16(m_stream); - if (index < g_AudioTracks.size()) - g_AudioTracks[index].Mask = value; + if (index < SoundTracks.size()) + SoundTracks[index].Mask = value; return true; }*/ else if (chunkId->EqualsTo(m_chunkCamera.get())) diff --git a/TR5Main/Game/spotcam.cpp b/TR5Main/Game/spotcam.cpp index fd5191eb1..05621a7eb 100644 --- a/TR5Main/Game/spotcam.cpp +++ b/TR5Main/Game/spotcam.cpp @@ -11,7 +11,7 @@ using namespace TEN::Renderer; using namespace TEN::Control::Volumes; - +int TrackCameraInit; int LastSequence; int SpotcamTimer; int SpotcamPaused; @@ -135,7 +135,7 @@ void InitialiseSpotCam(short Sequence) SpotcamTimer = 0; SpotcamPaused = 0; SpotcamLoopCnt = 0; - DisableLaraControl = 0; + DisableLaraControl = false; LastFOV = CurrentFOV; LaraAir = Lara.air; @@ -175,7 +175,7 @@ void InitialiseSpotCam(short Sequence) if ((s->flags & SCF_DISABLE_LARA_CONTROLS)) { - DisableLaraControl = 1; + DisableLaraControl = true; g_Renderer.enableCinematicBars(true); //SetFadeClip(16, 1); } @@ -774,7 +774,7 @@ void CalculateSpotCameras() g_Renderer.enableCinematicBars(false); UseSpotCam = 0; - DisableLaraControl = 0; + DisableLaraControl = false; CheckTrigger = 0; Camera.oldType = FIXED_CAMERA; Camera.type = CHASE_CAMERA; diff --git a/TR5Main/Game/spotcam.h b/TR5Main/Game/spotcam.h index 52132fcaf..4e9cdd1d3 100644 --- a/TR5Main/Game/spotcam.h +++ b/TR5Main/Game/spotcam.h @@ -56,6 +56,7 @@ extern int NumberSpotcams; extern int UseSpotCam; extern int SpotcamDontDrawLara; extern int SpotcamOverlay; +extern int TrackCameraInit; void ClearSpotCamSequences(); void InitSpotCamSequences(); diff --git a/TR5Main/Game/traps.cpp b/TR5Main/Game/traps.cpp index 16b26c5c7..2b8876df7 100644 --- a/TR5Main/Game/traps.cpp +++ b/TR5Main/Game/traps.cpp @@ -422,7 +422,6 @@ void FallingBlockControl(short itemNumber) // { // *height = item->pos.yPos; // HeightType = WALL; -// OnFloor = 1; // } // } //} diff --git a/TR5Main/Objects/Generic/Object/generic_trapdoor.cpp b/TR5Main/Objects/Generic/Object/generic_trapdoor.cpp index feca0895c..5af8b7663 100644 --- a/TR5Main/Objects/Generic/Object/generic_trapdoor.cpp +++ b/TR5Main/Objects/Generic/Object/generic_trapdoor.cpp @@ -5,6 +5,7 @@ #include "camera.h" #include "control.h" #include "level.h" + OBJECT_COLLISION_BOUNDS CeilingTrapDoorBounds = {-256, 256, 0, 900, -768, -256, -1820, 1820, -5460, 5460, -1820, 1820}; static PHD_VECTOR CeilingTrapDoorPos = {0, 1056, -480}; OBJECT_COLLISION_BOUNDS FloorTrapDoorBounds = {-256, 256, 0, 0, -1024, -256, -1820, 1820, -5460, 5460, -1820, 1820}; diff --git a/TR5Main/Objects/TR4/Entity/tr4_bigscorpion.cpp b/TR5Main/Objects/TR4/Entity/tr4_bigscorpion.cpp index 20f1a3abf..54253c162 100644 --- a/TR5Main/Objects/TR4/Entity/tr4_bigscorpion.cpp +++ b/TR5Main/Objects/TR4/Entity/tr4_bigscorpion.cpp @@ -10,6 +10,8 @@ #include "creature_info.h" #include "control.h" +int CutSeqNum; + BITE_INFO scorpionBite1 = { 0, 0, 0, 8 }; BITE_INFO scorpionBite2 = { 0, 0, 0, 23 }; diff --git a/TR5Main/Objects/TR4/Vehicles/jeep.cpp b/TR5Main/Objects/TR4/Vehicles/jeep.cpp index dc67dd729..1cca2c71b 100644 --- a/TR5Main/Objects/TR4/Vehicles/jeep.cpp +++ b/TR5Main/Objects/TR4/Vehicles/jeep.cpp @@ -418,7 +418,7 @@ static int JeepCheckGetOff() LaraItem->pos.zRot = 0; Lara.Vehicle = NO_ITEM; Lara.gunStatus = LG_NO_ARMS; - CurrentAtmosphere = 110; + CurrentLoopedSoundTrack = 110; S_CDPlay(110, 1); return false; } @@ -1606,7 +1606,7 @@ void JeepCollision(short itemNumber, ITEM_INFO* l, COLL_INFO* coll) item->flags |= 0x20; - CurrentAtmosphere = 98; + CurrentLoopedSoundTrack = 98; S_CDPlay(98, 1); } else diff --git a/TR5Main/Objects/TR5/Entity/tr5_imp.cpp b/TR5Main/Objects/TR5/Entity/tr5_imp.cpp index e3b4d9f8a..75cf66542 100644 --- a/TR5Main/Objects/TR5/Entity/tr5_imp.cpp +++ b/TR5Main/Objects/TR5/Entity/tr5_imp.cpp @@ -5,6 +5,7 @@ #include "lara.h" #include "draw.h" #include "effects\effects.h" +#include "effects\flmtorch.h" #include "box.h" #include "setup.h" #include "level.h" @@ -251,8 +252,6 @@ void ImpControl(short itemNumber) case STATE_IMP_SCARED: creature->maximumTurn = ANGLE(7); - if (TorchRoom != 11) - item->goalAnimState = STATE_IMP_STOP; break; case STATE_IMP_START_CLIMB: @@ -298,9 +297,6 @@ void ImpControl(short itemNumber) } } - if (TorchRoom == 11) - item->goalAnimState = STATE_IMP_SCARED; - CreatureTilt(item, 0); CreatureJoint(item, 1, joint1); CreatureJoint(item, 0, joint0); diff --git a/TR5Main/Scripting/GameFlowScript.cpp b/TR5Main/Scripting/GameFlowScript.cpp index 414d54506..fdf56574b 100644 --- a/TR5Main/Scripting/GameFlowScript.cpp +++ b/TR5Main/Scripting/GameFlowScript.cpp @@ -22,7 +22,7 @@ using std::string; using std::vector; using std::unordered_map; -extern unordered_map g_AudioTracks; +extern unordered_map SoundTracks; GameFlow::GameFlow(sol::state* lua) : LuaHandler{ lua } { @@ -182,7 +182,7 @@ void GameFlow::SetAudioTracks(sol::as_table_t> track.Name = t.trackName; track.Mask = 0; track.looped = t.looped; - g_AudioTracks.insert_or_assign(track.Name, track); + SoundTracks.insert_or_assign(track.Name, track); } } @@ -238,7 +238,7 @@ bool GameFlow::DoGameflow() // First we need to fill some legacy variables in PCTomb5.exe GameScriptLevel* level = Levels[CurrentLevel]; - CurrentAtmosphere = level->AmbientTrack; + CurrentLoopedSoundTrack = level->AmbientTrack; GAME_STATUS status; @@ -268,7 +268,7 @@ bool GameFlow::DoGameflow() } } - status = DoLevel(CurrentLevel, CurrentAtmosphere, loadFromSavegame); + status = DoLevel(CurrentLevel, CurrentLoopedSoundTrack, loadFromSavegame); loadFromSavegame = false; } diff --git a/TR5Main/Scripting/GameLogicScript.cpp b/TR5Main/Scripting/GameLogicScript.cpp index fba769016..8203c9544 100644 --- a/TR5Main/Scripting/GameLogicScript.cpp +++ b/TR5Main/Scripting/GameLogicScript.cpp @@ -53,8 +53,8 @@ static void PlaySoundEffect(int id, int flags) static void SetAmbientTrack(std::string const & trackName) { - CurrentAtmosphere = trackName; - S_CDPlay(CurrentAtmosphere, 1); + CurrentLoopedSoundTrack = trackName; + S_CDPlay(CurrentLoopedSoundTrack, 1); } static int FindRoomNumber(GameScriptPosition pos) diff --git a/TR5Main/Sound/sound.cpp b/TR5Main/Sound/sound.cpp index e031cccb8..1397b2e2c 100644 --- a/TR5Main/Sound/sound.cpp +++ b/TR5Main/Sound/sound.cpp @@ -28,8 +28,8 @@ const BASS_BFX_FREEVERB BASS_ReverbTypes[NUM_REVERB_TYPES] = // Reverb preset { 1.0f, 0.25f, 0.90f, 1.00f, 1.0f, 0, -1 } // 4 = Pipe }; -unordered_map g_AudioTracks; -char TrackNamePrefix; +unordered_map SoundTracks; +std::string CurrentLoopedSoundTrack; static int GlobalMusicVolume; static int GlobalFXVolume; @@ -393,28 +393,28 @@ void S_CDPlayEx(std::string track, DWORD mask, DWORD unknown) { // Check and modify soundtrack map mask, if needed. // If existing mask is unmodified (same activation mask setup), track won't play. - if (!g_AudioTracks[track].looped) + if (!SoundTracks[track].looped) { byte filteredMask = (mask >> 8) & 0x3F; - if ((g_AudioTracks[track].Mask & filteredMask) == filteredMask) + if ((SoundTracks[track].Mask & filteredMask) == filteredMask) return; // Mask is the same, don't play it. - g_AudioTracks[track].Mask |= filteredMask; + SoundTracks[track].Mask |= filteredMask; } - S_CDPlay(track, g_AudioTracks[track].looped); + S_CDPlay(track, SoundTracks[track].looped); } // Legacy! void S_CDPlay(int index, unsigned int mode) { - std::pair& track = *std::next(g_AudioTracks.begin(), index); + std::pair& track = *std::next(SoundTracks.begin(), index); S_CDPlay(track.first, mode); } void S_CDPlayEx(int index, DWORD mask, DWORD unknown) { - std::pair& track = *std::next(g_AudioTracks.begin(), index); + std::pair& track = *std::next(SoundTracks.begin(), index); S_CDPlayEx(track.first, mask, unknown); } diff --git a/TR5Main/Sound/sound.h b/TR5Main/Sound/sound.h index 29888c69d..5e2d02aeb 100644 --- a/TR5Main/Sound/sound.h +++ b/TR5Main/Sound/sound.h @@ -114,7 +114,8 @@ struct AudioTrack bool looped; }; -extern std::unordered_map g_AudioTracks; +extern std::unordered_map SoundTracks; +extern std::string CurrentLoopedSoundTrack; long SoundEffect(int effectID, PHD_3DPOS* position, int env_flags); void StopSoundEffect(short effectID); diff --git a/TR5Main/Specific/input.cpp b/TR5Main/Specific/input.cpp index 2bf798ca5..355036c4c 100644 --- a/TR5Main/Specific/input.cpp +++ b/TR5Main/Specific/input.cpp @@ -53,10 +53,12 @@ const char* g_KeyNames[] = { int TrInput; int DbInput; int InputBusy; +bool SetDebounce = false; short MouseX; short MouseY; int MouseKeys; + byte KeyMap[256]; int ConflictingKeys[18]; short KeyboardLayout[2][18] = @@ -64,6 +66,7 @@ short KeyboardLayout[2][18] = { DIK_UP, DIK_DOWN, DIK_LEFT, DIK_RIGHT, DIK_PERIOD, DIK_SLASH, DIK_RSHIFT, DIK_RMENU, DIK_RCONTROL, DIK_SPACE, DIK_COMMA, DIK_NUMPAD0, DIK_END, DIK_ESCAPE, DIK_DELETE, DIK_NEXT, DIK_P, DIK_RETURN }, { DIK_UP, DIK_DOWN, DIK_LEFT, DIK_RIGHT, DIK_PERIOD, DIK_SLASH, DIK_RSHIFT, DIK_RMENU, DIK_RCONTROL, DIK_SPACE, DIK_COMMA, DIK_NUMPAD0, DIK_END, DIK_ESCAPE, DIK_DELETE, DIK_NEXT, DIK_P, DIK_RETURN } }; + int joy_x; int joy_y; int joy_fire; diff --git a/TR5Main/Specific/input.h b/TR5Main/Specific/input.h index 5bae58d8a..0746570fd 100644 --- a/TR5Main/Specific/input.h +++ b/TR5Main/Specific/input.h @@ -214,6 +214,8 @@ extern const char* g_KeyNames[]; extern int TrInput; extern int DbInput; extern int InputBusy; +extern bool SetDebounce; + extern short KeyboardLayout[2][18]; extern byte KeyMap[256]; diff --git a/TR5Main/Specific/level.cpp b/TR5Main/Specific/level.cpp index a8219754e..ce3a32dea 100644 --- a/TR5Main/Specific/level.cpp +++ b/TR5Main/Specific/level.cpp @@ -883,8 +883,8 @@ void LoadSoundEffects() void LoadAnimatedTextures() { - NumAnimatedTextures = ReadInt32(); - for (int i = 0; i < NumAnimatedTextures; i++) + int numAnimatedTextures = ReadInt32(); + for (int i = 0; i < numAnimatedTextures; i++) { ANIMATED_TEXTURES_SEQUENCE sequence; sequence.atlas = ReadInt32(); @@ -904,7 +904,9 @@ void LoadAnimatedTextures() } g_Level.AnimatedTexturesSequences.push_back(sequence); } - nAnimUVRanges = ReadInt8(); + + // Unused for now + int nAnimUVRanges = ReadInt8(); } void LoadTextureInfos() @@ -1079,8 +1081,6 @@ unsigned CALLBACK LoadLevel(void* data) // Initialise the game GameScriptLevel* level = g_GameFlow->GetLevel(CurrentLevel); - Wibble = 0; - TorchRoom = -1; InitialiseGameFlags(); InitialiseLara(!(InitialiseGame || CurrentLevel == 1)); GetCarriedItems();