Skip to content

Commit eab6d7d

Browse files
committed
feat: log rng playback
also log tick number, and don't cancel for different lengths
1 parent e8b5de6 commit eab6d7d

File tree

2 files changed

+6
-1
lines changed

2 files changed

+6
-1
lines changed

src/Features/PlayerTrace.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1100,7 +1100,6 @@ CON_COMMAND(sar_trace_compare, "sar_trace_compare <trace 1> <trace 2> - compares
11001100
auto vphysList2 = trace2->vphysLocations;
11011101
if (vphysList1.size() != vphysList2.size()) {
11021102
console->ColorMsg(badColor, "Mismatch in trace length: %d <-> %d\n", vphysList1.size(), vphysList2.size());
1103-
return;
11041103
}
11051104

11061105
int mismatchCount = 0;
@@ -1224,6 +1223,7 @@ void PlayerTrace::EmitLog(const char *msg) {
12241223
for (unsigned i = 0; i < trace->log_scope_stack.size(); ++i) {
12251224
line += " ";
12261225
}
1226+
line += Utils::ssprintf("(%.4d) ", trace->positions[0].size() - 1);
12271227
line += msg;
12281228
trace->log_lines.push_back(line);
12291229
}

src/Features/RNGManip.cpp

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88
#include "Modules/FileSystem.hpp"
99
#include "Modules/Server.hpp"
1010
#include "Offsets.hpp"
11+
#include "PlayerTrace.hpp"
1112
#include "Utils/json11.hpp"
1213

1314
#include <cstring>
@@ -211,21 +212,25 @@ void RngManip::loadData(const char *filename) {
211212
}
212213

213214
void RngManip::viewPunch(QAngle *offset) {
215+
QAngle orig = *offset;
214216
if (g_queued_view_punches.size() > 0) {
215217
*offset = g_queued_view_punches.front();
216218
g_queued_view_punches.pop_front();
217219
}
218220

219221
g_recorded_view_punches.push_back(*offset);
222+
playerTrace->EmitLog(Utils::ssprintf("ViewPunch(%.6f, %.6f, %.6f) -> (%.6f, %.6f, %.6f)", orig.x, orig.y, orig.z, offset->x, offset->y, offset->z).c_str());
220223
}
221224

222225
void RngManip::randomSeed(int *seed) {
226+
int orig = *seed;
223227
if (g_queued_randomseeds.size() > 0) {
224228
*seed = g_queued_randomseeds.front();
225229
g_queued_randomseeds.pop_front();
226230
}
227231

228232
g_recorded_randomseeds.push_back(*seed);
233+
playerTrace->EmitLog(Utils::ssprintf("RandomSeed(%d) -> %d", orig, *seed).c_str());
229234
}
230235

231236
CON_COMMAND(sar_rng_save, "sar_rng_save [filename] - save RNG seed data to the specified file. If filename isn't given, use last TAS script path\n") {

0 commit comments

Comments
 (0)