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
+28
-22
@@ -3,7 +3,7 @@
|
||||
#include "fighter.h"
|
||||
#include "protocol.h"
|
||||
|
||||
struct Game;
|
||||
struct Sim;
|
||||
|
||||
constexpr int BEST_OF_MAX = 9;
|
||||
constexpr int PLAYERS_MAX = 4;
|
||||
@@ -197,33 +197,39 @@ public:
|
||||
int againTicks = 0;
|
||||
bool isTrinketPick = false;
|
||||
bool isWeaponPick = false;
|
||||
// Offline, what this screen asks of the next tick: the menu's Play, leaving the results for the sandbox, and the
|
||||
// colour its player picked. Online, members' wishes go through the session instead.
|
||||
int colorWanted = COLOR_UNASSIGNED;
|
||||
bool isOnline = false;
|
||||
bool isPlayRequested = false;
|
||||
bool isSandboxRequested = false;
|
||||
Fighter sandbox;
|
||||
|
||||
void update(Game& game);
|
||||
void start(Game& game);
|
||||
void colors_assign(Game& game);
|
||||
void sandbox_return(Game& game);
|
||||
void sandbox_join(Game& game, int device);
|
||||
void sandbox_leave(Game& game, int fighter);
|
||||
void update(Sim& sim);
|
||||
void start(Sim& sim);
|
||||
void colors_assign(Sim& sim);
|
||||
void sandbox_return(Sim& sim);
|
||||
int sandbox_join(Sim& sim);
|
||||
void sandbox_leave(Sim& sim, int fighter);
|
||||
bool is_racing();
|
||||
float health_get();
|
||||
bool is_final_round(Game& game);
|
||||
bool is_final_round(Sim& sim);
|
||||
float time_limit_get();
|
||||
void queue_open(Game& game, int fighter, const Rules& rules);
|
||||
int queue_members_get(Game& game, int queuer, int* members);
|
||||
bool is_queue_full(Game& game, int queuer);
|
||||
int queue_startable_get(Game& game);
|
||||
bool is_queue_set(Game& game, int queuer);
|
||||
void queue_open(Sim& sim, int fighter, const Rules& rules);
|
||||
int queue_members_get(Sim& sim, int queuer, int* members);
|
||||
bool is_queue_full(Sim& sim, int queuer);
|
||||
int queue_startable_get(Sim& sim);
|
||||
bool is_queue_set(Sim& sim, int queuer);
|
||||
void queue_slots_shift(int from, int count);
|
||||
int humans_left_get(Game& game);
|
||||
int humans_left_get(Sim& sim);
|
||||
|
||||
private:
|
||||
void round_start(Game& game, bool isFirst);
|
||||
void fight_start(Game& game);
|
||||
void edit_take(Game& game, Fighter& fighter);
|
||||
void mirror_copy(Game& game, bool isTrinket);
|
||||
void deathmatch_update(Game& game);
|
||||
void race_update(Game& game);
|
||||
void queues_update(Game& game);
|
||||
void leaves_take(Game& game);
|
||||
void round_start(Sim& sim, bool isFirst);
|
||||
void fight_start(Sim& sim);
|
||||
void edit_take(Sim& sim, Fighter& fighter);
|
||||
void mirror_copy(Sim& sim, bool isTrinket);
|
||||
void deathmatch_update(Sim& sim);
|
||||
void race_update(Sim& sim);
|
||||
void queues_update(Sim& sim);
|
||||
void leaves_take(Sim& sim);
|
||||
};
|
||||
Reference in new issue
Block a user