Remove the input delay setting and players being away

Neither does anything with the server running the games. Counting down to play
again moves into the match, so the server and every player agree on it and the
results show it starting again.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
shweetandClaude Opus 5.5 committed 2026-11-08 02:21:57 -05:00
1 parent 3b65cb575f
commit 56af1c357c
8 files changed
+30 -51

No files matched your search

-4
View File
@@ -18,7 +18,6 @@
#include "ui.h"
constexpr float PVP_OFF_SHADE = 0.4f;
constexpr float AWAY_SHADE = 0.2f;
// Every manager in one place, so systems can reach each other through a single reference.
// Devices say which input plays each fighter on this screen (none for bots). Sim is the game being
@@ -82,9 +81,6 @@ struct Game
return color >= 0 ? PALETTE[color] : WHITE;
}
Color color = PALETTE[sim.match.colors[fighter]];
// Away playing a queued game, a fighter stands faded in the lobby.
if (sim.match.state == MATCH_PRACTICE && sim.match.isAway[fighter] && !isPlain)
return color_shade(color, AWAY_SHADE);
bool isHostile = sim.fighters[fighter].isPvp && sim.fighters[local].isPvp;
bool isPeaceful = !isPlain && fighter != local && sim.match.state == MATCH_PRACTICE && !isHostile;
return isPeaceful ? color_shade(color, PVP_OFF_SHADE) : color;
+20 -16
View File
@@ -84,13 +84,26 @@ void Match::update(Sim& sim)
{
case MATCH_PRACTICE:
case MATCH_OVER:
// Online, after a queued game, Ready says to play it again (see Session).
for (int i = 0; i < sim.fighterCount && state == MATCH_OVER && isOnline; i++)
if (sim.fighters[i].is_pressed(CONTROL_READY) && !isGone[i])
// Online, after a queued game, Ready says to play it again, and once every player still in it is set, it
// counts up to the server starting afresh with them.
if (state == MATCH_OVER && isOnline)
{
int humans = 0;
bool isSet = true;
for (int i = 0; i < sim.fighterCount; i++)
{
isReady[i] = !isReady[i];
sim.cues->sound_play(isReady[i] ? SOUND_EQUIP : SOUND_UNEQUIP);
if (sim.fighters[i].is_pressed(CONTROL_READY) && !isGone[i])
{
isReady[i] = !isReady[i];
sim.cues->sound_play(isReady[i] ? SOUND_EQUIP : SOUND_UNEQUIP);
}
bool isHuman = owners[i] >= 0 && !isGone[i];
humans += isHuman;
isSet &= !isHuman || isReady[i];
}
isSet &= humans >= PLAYERS_MIN || (humans > 0 && rules.isBotFill);
againTicks = isSet ? againTicks + 1 : 0;
}
// In the sandbox, every fighter's edits land, and Ready (R) puts a fighter back at its spawn, still, with
// its attacks cleared away. (Keys typed into a text field never reach the controls.)
// Online, Ready in a queued game's area readies up for it instead.
@@ -628,7 +641,7 @@ bool Match::is_queue_full(Sim& sim, int queuer)
bool Match::is_queue_set(Sim& sim, int queuer)
{
Queue& queue = queues[queuer];
if (!queue.isActive || isAway[queuer])
if (!queue.isActive)
return false;
int members[MAX_FIGHTERS];
int count = queue_members_get(sim, queuer, members);
@@ -654,13 +667,11 @@ void Match::queue_slots_shift(int from, int count)
for (int i = from; i + 1 < count; i++)
{
queues[i] = queues[i + 1];
isAway[i] = isAway[i + 1];
isGone[i] = isGone[i + 1];
}
if (count > 0)
{
queues[count - 1] = {};
isAway[count - 1] = false;
isGone[count - 1] = false;
}
std::fill(std::begin(queuedIn), std::end(queuedIn), -1);
@@ -675,13 +686,6 @@ void Match::queues_update(Sim& sim)
for (int i = 0; i < sim.fighterCount; i++)
{
Fighter& fighter = sim.fighters[i];
if (isAway[i])
{
fighter.controls = {};
queuedIn[i] = -1;
isQueueReady[i] = false;
continue;
}
int in = -1;
if (queues[i].isActive)
in = i;
@@ -690,7 +694,7 @@ void Match::queues_update(Sim& sim)
{
Rect area = queues[j].area;
area = {area.x - QUEUE_FEET_SLACK, area.y, area.w + QUEUE_FEET_SLACK * 2, area.h + QUEUE_FEET_SLACK};
if (queues[j].isActive && !isAway[j] && fighter.isAlive && is_point_in_rect(feet, area))
if (queues[j].isActive && fighter.isAlive && is_point_in_rect(feet, area))
in = j;
}
if (in != queuedIn[i])
+2 -3
View File
@@ -202,15 +202,14 @@ public:
char names[MAX_FIGHTERS][PLAYER_NAME_MAX + 1] = {};
bool isReady[MAX_FIGHTERS] = {};
// Online, in the lobby's sandbox: each fighter's queued game, which queue's area it's standing in (-1 for none),
// whether it's readied up there, and whether it's away playing a queued game (faded, and left alone meanwhile).
// and whether it's readied up there.
// In a queued game, whether each fighter has left it (out for good), and whether that was before it was over.
Queue queues[MAX_FIGHTERS];
int queuedIn[MAX_FIGHTERS] = {-1, -1, -1, -1};
bool isQueueReady[MAX_FIGHTERS] = {};
bool isAway[MAX_FIGHTERS] = {};
bool isGone[MAX_FIGHTERS] = {};
bool isForfeited[MAX_FIGHTERS] = {};
// After a queued game, how many ticks everyone's been set to play it again for (see Session).
// After a queued game, how many ticks everyone still in it has been set to play it again for.
int againTicks = 0;
bool isTrinketPick = false;
bool isWeaponPick = false;
+2 -12
View File
@@ -33,7 +33,6 @@ constexpr const char* KEY_TRINKET_SLOTS = "trinket_slots";
constexpr const char* KEY_VOLUME = "volume";
constexpr const char* KEY_SHAKE = "screenshake";
constexpr const char* KEY_HUD_AIM = "hud_aim";
constexpr const char* KEY_INPUT_DELAY = "input_delay";
constexpr const char* KEY_SERVER_URL = "server_url";
constexpr const char* KEY_RULES_OPEN = "rules_open";
constexpr float FOOTER_GAP = 4;
@@ -294,8 +293,6 @@ void Settings::load(Game& game)
isSpeedShown = number;
if (SDL_strcmp(line, KEY_HUD_AIM) == 0)
isAimShown = number;
if (SDL_strcmp(line, KEY_INPUT_DELAY) == 0)
inputDelay = std::clamp(number, 0, INPUT_DELAY_MAX);
if (SDL_strcmp(line, KEY_COLLISION) == 0)
isCollisionShown = number;
if (SDL_strcmp(line, KEY_COLOR) == 0)
@@ -324,12 +321,12 @@ void Settings::save(Game& game)
char text[SETTINGS_LENGTH];
int length = SDL_snprintf(text, sizeof(text),
"%s=%s\n%s=%d\n%s=%d\n%s=%d\n%s=%d\n%s=%d\n%s=%d\n%s=%d\n%s=%d\n%s=%d\n%s=%d\n%s=%d\n%s=%"
"d\n%s=%d\n%s=%s\n%s=%d\n",
"d\n%s=%s\n%s=%d\n",
KEY_NAME, name, KEY_COLOR, color, KEY_VOLUME, (int)std::round(volume * PERCENT), KEY_MUTE,
isMuted, KEY_FULLSCREEN, isFullscreen, KEY_VSYNC, isVsync, KEY_WEAPON_SLOTS, weaponSlots,
KEY_TRINKET_SLOTS, trinketSlots, KEY_COLLISION, isCollisionShown, KEY_SHAKE, isShaking,
KEY_HUD_DPS, isDpsShown, KEY_HUD_SPEED, isSpeedShown, KEY_HUD_AIM, isAimShown,
KEY_INPUT_DELAY, inputDelay, KEY_SERVER_URL, serverUrl, KEY_RULES_OPEN, isRulesOpen);
KEY_SERVER_URL, serverUrl, KEY_RULES_OPEN, isRulesOpen);
for (int i = 0; i < CONTROL_COUNT; i++)
{
Binding binding = game.input.bindings[i];
@@ -474,12 +471,6 @@ void Settings::draw(Game& game, Rect area, Page& page)
if (serverUrl[0] == '\0' && !ui.is_active(serverUrl))
SDL_strlcpy(serverUrl, SERVER_URL_DEFAULT, sizeof(serverUrl));
}
if (ui.row_get(page, ROW_HEIGHT, y))
{
ui.label_draw(game, "Input Delay", {area.x, y});
isHudChanged |= ui.number_draw(game, {x, y, NUMBER_WIDTH, WIDGET_HEIGHT}, inputDelay,
{.min = 0, .max = INPUT_DELAY_MAX, .suffix = " Ticks"});
}
if (ui.row_get(page, ROW_HEIGHT, y))
ui.separator_draw(game, {row.x, y, row.w, row.h}, "Audio");
@@ -579,7 +570,6 @@ void Settings::defaults_restore(Game& game)
isDpsShown = fresh.isDpsShown;
isSpeedShown = fresh.isSpeedShown;
isAimShown = fresh.isAimShown;
inputDelay = fresh.inputDelay;
SDL_strlcpy(serverUrl, fresh.serverUrl, sizeof(serverUrl));
weaponSlots = fresh.weaponSlots;
trinketSlots = fresh.trinketSlots;
-4
View File
@@ -11,8 +11,6 @@ struct Page;
constexpr int NAME_LENGTH = 16;
constexpr int INPUT_DELAY_DEFAULT = 2;
constexpr int INPUT_DELAY_MAX = 4;
// The sandbox as it was left: where the fighter stood (its feet), the slot it held, and its loadouts and levels.
struct SandboxSave
@@ -44,8 +42,6 @@ public:
int trinketSlots = 2;
int weaponSlots = 2;
bool isAimShown = true;
// Online, how many ticks late this screen's controls take effect (see Session).
int inputDelay = INPUT_DELAY_DEFAULT;
bool isCollisionShown = false;
bool isDpsShown = true;
bool isFullscreen = false;
+1 -1
View File
@@ -2684,7 +2684,7 @@ void Ui::queues_draw(Game& game)
for (int q = 0; q < game.sim.fighterCount; q++)
{
Queue& queue = match.queues[q];
if (!queue.isActive || match.isAway[q])
if (!queue.isActive)
continue;
Color color = game.color_get(q, true);
Rect area = queue.area;
+1 -1
View File
@@ -337,7 +337,7 @@ static bool is_hostile(Sim& sim, int owner, int target)
{
Match& match = sim.match;
return match.state != MATCH_PRACTICE ||
(sim.fighters[owner].isPvp && sim.fighters[target].isPvp && !match.isAway[owner] && !match.isAway[target]);
(sim.fighters[owner].isPvp && sim.fighters[target].isPvp);
}
static bool is_target(Sim& sim, int target, int owner)