Skip to content
This repository was archived by the owner on Dec 12, 2022. It is now read-only.

Commit 02d5988

Browse files
committed
Update docs
1 parent 64a8fab commit 02d5988

File tree

9 files changed

+61
-29
lines changed

9 files changed

+61
-29
lines changed

README.md

+17-6
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@
1919
- [Patches](#patches)
2020
- [Mapping](#mapping)
2121
- [Start & Stop Triggers](#start--stop-triggers)
22-
- [Checkpoint Triggers](#checkpoint-triggers)
22+
- [With Checkpoints](#with-checkpoints)
2323
- [Credits](#inspired-by)
2424

2525
## Supported Games
@@ -80,7 +80,7 @@
8080
- `sar_draw_timer` draws timer value
8181
- `sar_draw_avg` draws current average of timer
8282
- `sar_draw_cps` draws last checkpoint value of timer
83-
- `sar_draw_demo` draws current demo name
83+
- `sar_draw_demo` draws current name, tick and time of demo recorder
8484

8585
### Cheats
8686
- `sar_autojump` enables tick-perfect jumping on the server
@@ -101,10 +101,21 @@
101101
- Use `sar_timer_start` as parameter
102102
- Do the same for the second trigger with `sar_timer_stop`
103103

104-
![trigger_multiple.png](trigger_multiple.png)
105-
106-
### Checkpoint Triggers
107-
- TODO
104+
![start.png](docs/start.png)
105+
106+
### With Checkpoints
107+
- Use `trigger_multiple` object for start
108+
- Trigger `sar_timer_start`
109+
- Trigger `sar_cps_clear`
110+
- Enable checkpoint object
111+
- Use `trigger_multiple` object for checkpoint
112+
- Trigger `sar_cps_add`
113+
- Disable itself
114+
- Use `trigger_multiple` object for stop
115+
- Trigger `sar_timer_stop`
116+
117+
![cpstart.png](docs/cpstart.png)
118+
![cp1.png](docs/cp1.png)
108119

109120
## Inspired By
110121
- [SourcePauseTool](https://github.com/YaLTeR/SourcePauseTool)

docs/cp1.png

16.7 KB
Loading

docs/cpstart.png

17.5 KB
Loading
File renamed without changes.

src/SourceAutoRecord/Callbacks.hpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -322,7 +322,7 @@ namespace Callbacks
322322
void PrintCheckpoints() {
323323
int cps = Timer::CheckPoints::Items.size();
324324
if (cps > 0) {
325-
Console::Msg("Result of %i checkpoints:\n", cps);
325+
Console::Msg("Result of %i checkpoint%s:\n", cps, (cps == 1) ? "" : "s");
326326
}
327327
else {
328328
Console::Msg("No result!\n");

src/SourceAutoRecord/Modules/Client.hpp

+21-8
Original file line numberDiff line numberDiff line change
@@ -37,8 +37,9 @@ namespace Client
3737
int result = Original::Paint(thisptr);
3838
if (cl_showpos.GetBool()) {
3939
int m_hFont = *(int*)((uintptr_t)thisptr + Offsets::m_hFont);
40-
const int start = 65;
40+
const int start = 67;
4141
const int factor = 10;
42+
const int space = 4;
4243
int level = 0;
4344

4445
// Session
@@ -48,7 +49,7 @@ namespace Client
4849

4950
char session[64];
5051
snprintf(session, sizeof(session), "session: %i (%.3f)", tick, time);
51-
Surface::Draw(m_hFont, 1, start + (factor * level), COL_WHITE, session);
52+
Surface::Draw(m_hFont, 1, start + level * (factor + level), COL_WHITE, session);
5253
level++;
5354
}
5455
if (sar_draw_sum.GetBool()) {
@@ -61,7 +62,7 @@ namespace Client
6162
else {
6263
snprintf(sum, sizeof(sum), "sum: %i (%.3f)", Summary::TotalTicks, Summary::TotalTime);
6364
}
64-
Surface::Draw(m_hFont, 1, start + (factor * level), COL_WHITE, sum);
65+
Surface::Draw(m_hFont, 1, start + level * (factor + level), COL_WHITE, sum);
6566
level++;
6667
}
6768
// Timer
@@ -71,26 +72,38 @@ namespace Client
7172

7273
char timer[64];
7374
snprintf(timer, sizeof(timer), "timer: %i (%.3f)", tick, time);
74-
Surface::Draw(m_hFont, 1, start + (factor * level), COL_WHITE, timer);
75+
Surface::Draw(m_hFont, 1, start + level * (factor + level), COL_WHITE, timer);
7576
level++;
7677
}
7778
if (sar_draw_avg.GetBool()) {
7879
char avg[64];
7980
snprintf(avg, sizeof(avg), "avg: %i (%.3f)", Timer::Average::AverageTicks, Timer::Average::AverageTime);
80-
Surface::Draw(m_hFont, 1, start + (factor * level), COL_WHITE, avg);
81+
Surface::Draw(m_hFont, 1, start + level * (factor + level), COL_WHITE, avg);
8182
level++;
8283
}
8384
if (sar_draw_cps.GetBool()) {
8485
char cps[64];
8586
snprintf(cps, sizeof(cps), "last cp: %i (%.3f)", Timer::CheckPoints::LatestTick, Timer::CheckPoints::LatestTime);
86-
Surface::Draw(m_hFont, 1, start + (factor * level), COL_WHITE, cps);
87+
Surface::Draw(m_hFont, 1, start + level * (factor + level), COL_WHITE, cps);
8788
level++;
8889
}
8990
// Demo
9091
if (sar_draw_demo.GetBool()) {
9192
char demo[64];
92-
snprintf(demo, sizeof(demo), "demo: %s", (DemoRecorder::LastDemo.empty()) ? "-" : DemoRecorder::LastDemo.c_str());
93-
Surface::Draw(m_hFont, 1, start + (factor * level), COL_WHITE, demo);
93+
if (!DemoRecorder::CurrentDemo.empty()) {
94+
if (*DemoRecorder::Recording && !*Engine::LoadGame) {
95+
int tick = DemoRecorder::GetCurrentTick();
96+
float time = tick * *Engine::IntervalPerTick;
97+
snprintf(demo, sizeof(demo), "demo: %s %i (%.3f)", DemoRecorder::CurrentDemo.c_str(), tick, time);
98+
}
99+
else {
100+
snprintf(demo, sizeof(demo), "demo: %s", DemoRecorder::CurrentDemo.c_str());
101+
}
102+
}
103+
else {
104+
snprintf(demo, sizeof(demo), "demo: -");
105+
}
106+
Surface::Draw(m_hFont, 1, start + level * (factor + level), COL_WHITE, demo);
94107
level++;
95108
}
96109

src/SourceAutoRecord/Modules/DemoRecorder.hpp

+6
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ namespace DemoRecorder
1414
int* DemoNumber;
1515
bool* Recording;
1616

17+
std::string CurrentDemo;
1718
std::string LastDemo;
1819

1920
void Set(uintptr_t recorderAddr)
@@ -28,6 +29,11 @@ namespace DemoRecorder
2829
{
2930
return GetRecordingTick(Ptr);
3031
}
32+
void SetCurrentDemo()
33+
{
34+
CurrentDemo = std::string(DemoRecorder::DemoName);
35+
if (*DemoNumber > 1) CurrentDemo += "_" + std::to_string(*DemoNumber);
36+
}
3137
void SetLastDemo()
3238
{
3339
LastDemo = std::string(DemoRecorder::DemoName);

src/SourceAutoRecord/Modules/Engine.hpp

+3-1
Original file line numberDiff line numberDiff line change
@@ -161,6 +161,7 @@ namespace Engine
161161
void __fastcall StartupDemoFile(void* thisptr, int edx)
162162
{
163163
IsRecordingDemo = true;
164+
DemoRecorder::SetCurrentDemo();
164165
Original::StartupDemoFile(thisptr);
165166
}
166167
void __cdecl ConCommandStop()
@@ -175,6 +176,7 @@ namespace Engine
175176
/*if (Timer::IsRunning) {
176177
Timer::Stop(Engine::GetTick());
177178
}*/
179+
DemoRecorder::CurrentDemo = "";
178180
Original::Disconnect(thisptr, bShowMainMenu);
179181
}
180182
void __cdecl PlayDemo(void* thisptr)
@@ -189,7 +191,7 @@ namespace Engine
189191

190192
if (result && PlayerRequestedPlayback) {
191193
IsPlayingDemo = true;
192-
std::string file = GetDir() + "\\" + std::string(DemoPlayer::DemoName);
194+
std::string file = GetDir() + std::string("\\") + std::string(DemoPlayer::DemoName);
193195
Demo demo;
194196
if (demo.Parse(file)) {
195197
demo.Fix();

src/SourceAutoRecord/SourceAutoRecord.hpp

+13-13
Original file line numberDiff line numberDiff line change
@@ -89,7 +89,7 @@ namespace SAR
8989
"Parses multiple demos and prints the total sum of them.\n");
9090
sar_time_demo_dev = CreateFloat(
9191
"sar_time_demo_dev",
92-
"1",
92+
"0",
9393
0,
9494
"Printing mode when using sar_time_demo. 0 = default, 1 = console commands, 2 = console commands & packets.\n");
9595

@@ -156,28 +156,28 @@ namespace SAR
156156
// Drawing
157157
sar_draw_session = CreateBoolean(
158158
"sar_draw_session",
159-
"1",
160-
"Draws info about session when using cl_showpos.\n");
159+
"0",
160+
"Draws current session value when using cl_showpos.\n");
161161
sar_draw_sum = CreateBoolean(
162162
"sar_draw_sum",
163-
"1",
164-
"Draws info about session's summary when using cl_showpos.\n");
163+
"0",
164+
"Draws summary value of sessions when using cl_showpos.\n");
165165
sar_draw_timer = CreateBoolean(
166166
"sar_draw_timer",
167-
"1",
168-
"Draws info about timer when using cl_showpos.\n");
167+
"0",
168+
"Draws current value of timer when using cl_showpos.\n");
169169
sar_draw_avg = CreateBoolean(
170170
"sar_draw_avg",
171-
"1",
172-
"Draws info about timer's average when using cl_showpos.\n");
171+
"0",
172+
"Draws calculated average of timer when using cl_showpos.\n");
173173
sar_draw_cps = CreateBoolean(
174174
"sar_draw_cps",
175-
"1",
176-
"Draws info about timer's checkpoints when using cl_showpos.\n");
175+
"0",
176+
"Draws latest checkpoint of timer when using cl_showpos.\n");
177177
sar_draw_demo = CreateBoolean(
178178
"sar_draw_demo",
179-
"1",
180-
"Draws info about demo recorder when using cl_showpos.\n");
179+
"0",
180+
"Draws name, tick and time of demo recorder when using cl_showpos.\n");
181181

182182
// Cheats
183183
sar_autojump = CreateBoolean(

0 commit comments

Comments
 (0)