Skip to content

Commit b957e6f

Browse files
Harkov replay fix (#513)
* fix replay counter * adding back counter * Fix alt mods * Preserve recording if always set to true and disable fullbright cheats which will affect replays. * Replace recording with a longer one with ARC that will test more features. --------- Co-authored-by: Karjala22 <78927981+Karjala22@users.noreply.github.com>
1 parent 9efcdd7 commit b957e6f

File tree

4 files changed

+42367
-7553
lines changed

4 files changed

+42367
-7553
lines changed

TheForceEngine/TFE_Input/inputMapping.cpp

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -600,6 +600,10 @@ namespace TFE_Input
600600
InputBinding* binding = inputMapping_getBindingByIndex(indices[0]);
601601
if (TFE_Input::keyPressed(binding->keyCode))
602602
{
603+
if (binding->keyMod && !TFE_Input::keyModDown(binding->keyMod, true))
604+
{
605+
return false;
606+
}
603607
return true;
604608
}
605609
}

TheForceEngine/TFE_Input/replay.cpp

Lines changed: 17 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -16,12 +16,14 @@
1616
#include <TFE_DarkForces/GameUI/agentMenu.h>
1717
#include <TFE_DarkForces/GameUI/pda.h>
1818
#include <TFE_DarkForces/mission.h>
19+
#include <TFE_DarkForces/time.h>
1920
#include <TFE_FileSystem/fileutil.h>
2021
#include <TFE_FileSystem/filestream.h>
2122
#include <TFE_FrontEndUI/frontEndUi.h>
2223
#include <TFE_FrontEndUI/modLoader.h>
2324
#include <TFE_Game/saveSystem.h>
2425
#include <TFE_Input/inputMapping.h>
26+
#include <TFE_Jedi/Renderer/rcommon.h>
2527
#include <TFE_Jedi/Serialization/serialization.h>
2628
#include <TFE_System/frameLimiter.h>
2729
#include <TFE_System/system.h>
@@ -60,6 +62,7 @@ namespace TFE_Input
6062
bool cutscenesEnabled = true;
6163
bool pauseReplay = false;
6264
bool showReplayMsgFrame = false;
65+
bool alwaysRecord = false;
6366

6467
extern f64 gameFrameLimit = 0;
6568
extern f64 replayFrameLimit = 0;
@@ -578,12 +581,12 @@ namespace TFE_Input
578581
SERIALIZE(ReplayVersionInit, gameSettings->df_solidWallFlagFix, 0);
579582
SERIALIZE(ReplayVersionInit, gameSettings->df_jsonAiLogics, 0);
580583
SERIALIZE(ReplayVersionInit, gameSettings->df_bobaFettFacePlayer, 0);
581-
SERIALIZE(ReplayVersionInit, gameSettings->df_recordFrameRate, 0);
584+
SERIALIZE(ReplayVersionInit, gameSettings->df_recordFrameRate, 0);
582585
int pitchLimit = gameSettings->df_pitchLimit;
583586
SERIALIZE(ReplayVersionInit, pitchLimit, 0);
584587

585588
SERIALIZE(ReplayVersionInit, allySettings->enableHeadwave, 0);
586-
589+
587590
SERIALIZE(ReplayVersionInit, inputConfig->mouseFlags, 0);
588591
SERIALIZE(ReplayVersionInit, mouseMode, 0);
589592
SERIALIZE(ReplayVersionInit, inputConfig->mouseSensitivity[0], 0);
@@ -686,6 +689,7 @@ namespace TFE_Input
686689
TFE_DarkForces::s_oneHitKillEnabled = JFALSE;
687690
TFE_DarkForces::s_instaDeathEnabled = JFALSE;
688691
TFE_DarkForces::s_limitStepHeight = JTRUE;
692+
TFE_Jedi::s_fullBright = JFALSE;
689693
}
690694

691695
void setStartHudMessage(bool notify)
@@ -887,8 +891,8 @@ namespace TFE_Input
887891
angle14_16 yaw = s_playerEye->yaw;
888892
angle14_16 pitch = s_playerEye->pitch;
889893

890-
string logMsg = "Update %d: X:%04d Y:%04d Z:%04d, yaw: %d, pitch: %d, keysDown: %s, keysPressed: %s, mouse: %s";
891-
TFE_System::logWrite(LOG_MSG, "Replay", logMsg.c_str(), counter, xPos, yPos, zPos, yaw, pitch,
894+
string logMsg = "Update %d: Tick = %d X:%04d Y:%04d Z:%04d, yaw: %d, pitch: %d, keysDown: %s, keysPressed: %s, mouse: %s";
895+
TFE_System::logWrite(LOG_MSG, "Replay", logMsg.c_str(), counter, s_curTick, xPos, yPos, zPos, yaw, pitch,
892896
keys.c_str(), keysPressed.c_str(), mouse.c_str());
893897
}
894898
}
@@ -975,6 +979,10 @@ namespace TFE_Input
975979
return;
976980
}
977981

982+
// Always set this to false as we are loading a replay from path
983+
alwaysRecord = TFE_Settings::getGameSettings()->df_enableRecordingAll;
984+
TFE_Settings::getGameSettings()->df_enableRecordingAll = false;
985+
978986
TFE_SaveSystem::SaveHeader header;
979987
loadReplayHeader(replayPath, &header);
980988

@@ -1053,7 +1061,7 @@ namespace TFE_Input
10531061

10541062
// Start replaying with the first event
10551063
inputMapping_setReplayCounter(1);
1056-
1064+
10571065
serializeDemo(&s_replayFile, false);
10581066

10591067
// Setup frame rate for replay playback
@@ -1082,12 +1090,12 @@ namespace TFE_Input
10821090
else
10831091
{
10841092
char logPath[256];
1085-
replayLogCounter++;
10861093
sprintf(logPath, "replay_%d.log", replayLogCounter);
10871094
TFE_System::logOpen(logPath);
10881095
}
1096+
replayLogCounter++;
10891097
TFE_System::logTimeToggle();
1090-
}
1098+
}
10911099
}
10921100

10931101
void restoreAgent()
@@ -1133,6 +1141,8 @@ namespace TFE_Input
11331141

11341142
if (TFE_Settings::getTempSettings()->exit_after_replay)
11351143
{
1144+
// Reset the recording settings
1145+
TFE_Settings::getGameSettings()->df_enableRecordingAll = alwaysRecord;
11361146
TFE_FrontEndUI::setState(APP_STATE_QUIT);
11371147
}
11381148
else

0 commit comments

Comments
 (0)