Split the simulation from presentation into an SDL-free library
Sim holds one whole game (tick, snapshots, checksum) and talks to the screen only through Cues, which the client's Scene plays and the server ignores. All drawing moved to scene.cpp. Match takes this screen's wishes as request flags instead of reading the menu, input and settings. The sim library builds without SDL and the server links it, ready to run games itself. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
2007fb7edc
commit
465f75f6d7
38 files changed
+2225
-1965
No files matched your search
@@ -44,8 +44,6 @@ template <typename T> static void effect_add(std::vector<T>& list, const T& effe
|
||||
// Sprays particles at position, rotated by angle on top of the burst's own angle.
|
||||
void Effects::burst(Burst burst, Vec2 position, float angle, Color color)
|
||||
{
|
||||
if (isMuted)
|
||||
return;
|
||||
for (int i = 0; i < burst.count; i++)
|
||||
{
|
||||
float direction = angle + burst.angle + random_get(-burst.spread, burst.spread);
|
||||
@@ -59,8 +57,6 @@ void Effects::burst(Burst burst, Vec2 position, float angle, Color color)
|
||||
// Callers may ask every tick. Copies are only kept every few ticks so trails stay spaced out.
|
||||
void Effects::afterimage_spawn(Pose pose)
|
||||
{
|
||||
if (isMuted)
|
||||
return;
|
||||
if (ticks % AFTERIMAGE_INTERVAL == 0)
|
||||
effect_add(afterimages, Afterimage{pose, AFTERIMAGE_LIFE});
|
||||
}
|
||||
@@ -82,8 +78,6 @@ void Effects::afterimage_draw(Game& game)
|
||||
// total.
|
||||
void Effects::number_spawn(Vec2 position, int value, int target, Color color)
|
||||
{
|
||||
if (isMuted)
|
||||
return;
|
||||
for (int i = (int)popups.size() - 1; i >= 0; i--)
|
||||
{
|
||||
Popup& popup = popups[i];
|
||||
@@ -109,8 +103,6 @@ void Effects::number_spawn(Vec2 position, int value, int target, Color color)
|
||||
|
||||
void Effects::popup_spawn(Vec2 position, const char* text, Color color)
|
||||
{
|
||||
if (isMuted)
|
||||
return;
|
||||
Popup popup = {
|
||||
.color = color,
|
||||
.position = position,
|
||||
@@ -125,15 +117,11 @@ void Effects::popup_spawn(Vec2 position, const char* text, Color color)
|
||||
|
||||
void Effects::flash_spawn(Vec2 position, float angle, float size, Color color)
|
||||
{
|
||||
if (isMuted)
|
||||
return;
|
||||
effect_add(flashes, Flash{color, position, angle, FLASH_LIFE, size});
|
||||
}
|
||||
|
||||
void Effects::dps_record(int amount)
|
||||
{
|
||||
if (isMuted)
|
||||
return;
|
||||
hits.push_back({ticks * TICK, amount});
|
||||
}
|
||||
|
||||
@@ -148,8 +136,6 @@ float Effects::dps_get()
|
||||
|
||||
void Effects::shake_add(float amount)
|
||||
{
|
||||
if (isMuted)
|
||||
return;
|
||||
shake = std::min(SHAKE_TRAUMA_MAX, shake + amount);
|
||||
}
|
||||
|
||||
|
||||
Reference in new issue
Block a user