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
+7
-7
@@ -92,7 +92,7 @@ void Chat::players_clear()
|
||||
int Chat::member_get(Game& game, int fighter)
|
||||
{
|
||||
if (game.session.isActive)
|
||||
return game.match.owners[fighter];
|
||||
return game.sim.match.owners[fighter];
|
||||
return fighter == game.local ? game.net.selfId : NO_MEMBER;
|
||||
}
|
||||
|
||||
@@ -267,8 +267,8 @@ void Chat::command(Game& game, const std::string& text)
|
||||
if (SDL_strcasecmp(argument.c_str(), COLOR_NAMES[color]) != 0)
|
||||
continue;
|
||||
int own = game.session.fighter_get(game, game.net.selfId);
|
||||
for (int i = 0; i < game.fighterCount && game.session.isActive; i++)
|
||||
if (i != own && game.match.colors[i] == color)
|
||||
for (int i = 0; i < game.sim.fighterCount && game.session.isActive; i++)
|
||||
if (i != own && game.sim.match.colors[i] == color)
|
||||
return system(std::string(COLOR_NAMES[color]) + " is already taken by another player.");
|
||||
game.settings.color = color;
|
||||
game.settings.changed();
|
||||
@@ -284,7 +284,7 @@ void Chat::command(Game& game, const std::string& text)
|
||||
Rect Chat::log_area_get(Game& game)
|
||||
{
|
||||
float bottom = CANVAS_HEIGHT - HOTBAR_MARGIN;
|
||||
MatchState state = (MatchState)game.match.state;
|
||||
MatchState state = (MatchState)game.sim.match.state;
|
||||
if (state != MATCH_PRACTICE && state != MATCH_COUNTDOWN)
|
||||
{
|
||||
RivalLayout rivals = game.ui.rivals_layout(game);
|
||||
@@ -343,10 +343,10 @@ void Chat::draw(Game& game)
|
||||
void Chat::overhead_draw(Game& game)
|
||||
{
|
||||
float now = seconds_get();
|
||||
float above = game.match.state == MATCH_PRACTICE ? BUBBLE_ABOVE : BUBBLE_MATCH_ABOVE;
|
||||
for (int i = 0; i < game.fighterCount; i++)
|
||||
float above = game.sim.match.state == MATCH_PRACTICE ? BUBBLE_ABOVE : BUBBLE_MATCH_ABOVE;
|
||||
for (int i = 0; i < game.sim.fighterCount; i++)
|
||||
{
|
||||
Fighter& fighter = game.fighters[i];
|
||||
Fighter& fighter = game.sim.fighters[i];
|
||||
int member = member_get(game, i);
|
||||
if (!fighter.isAlive || member == NO_MEMBER)
|
||||
continue;
|
||||
|
||||
Reference in new issue
Block a user