Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions include/g_local.h
Original file line number Diff line number Diff line change
Expand Up @@ -1255,10 +1255,15 @@ extern int maxPlayerCount;

qbool AllowMonster(gedict_t *e);

#define SPAWN_SHOW_DISABLED 0
#define SPAWN_SHOW_PREWAR 1
#define SPAWN_SHOW_MATCH 2

#define SPAWNICIDE_DISABLED 0
#define SPAWNICIDE_PREWAR 1
#define SPAWNICIDE_MATCH 2

int SpawnShowStatus(void);
int SpawnicideStatus(void);
void SpawnicideEnable(void);
void SpawnicideDisable(void);
30 changes: 25 additions & 5 deletions src/commands.c
Original file line number Diff line number Diff line change
Expand Up @@ -1900,12 +1900,12 @@

if (floor(k_captains) == 1)
{
G_sprint(self, 2, "\2201\221 %s present\n", redtext("captain"));

Check warning on line 1903 in src/commands.c

View workflow job for this annotation

GitHub Actions / verify-msvc

decimal digit terminates octal escape sequence [D:\a\ktx\ktx\builddir\qwprogs.vcxproj]
}

if (floor(k_coaches) == 1)
{
G_sprint(self, 2, "\2201\221 %s present\n", redtext("coach"));

Check warning on line 1908 in src/commands.c

View workflow job for this annotation

GitHub Actions / verify-msvc

decimal digit terminates octal escape sequence [D:\a\ktx\ktx\builddir\qwprogs.vcxproj]
}

if (match_in_progress == 2)
Expand Down Expand Up @@ -2686,22 +2686,42 @@
G_bprint(2, "%s\n", respawn_model_name(k_spw));
}

int SpawnShowStatus(void)
{
return (int)cvar("k_spm_show");
}

void ToggleSpawnPoints(void)
{
int spawn_show = cvar("k_spm_show");

if (match_in_progress)
{
return;
}

cvar_toggle_msg(self, "k_spm_show", redtext("visible spawn points"));
spawn_show++;

if (cvar("k_spm_show"))
if (spawn_show > SPAWN_SHOW_MATCH)
{
ShowSpawnPoints();
spawn_show = SPAWN_SHOW_DISABLED;
}
else

cvar_set("k_spm_show", va("%d", spawn_show));
switch (spawn_show)
{
HideSpawnPoints();
case SPAWNICIDE_DISABLED:
HideSpawnPoints();
G_sprint(self, 2, "Visible spawns %s\n", redtext("off"));
break;
case SPAWNICIDE_PREWAR:
ShowSpawnPoints();
G_sprint(self, 2, "Visible spawns %s\n", redtext("prewar"));
break;
case SPAWNICIDE_MATCH:
ShowSpawnPoints();
G_sprint(self, 2, "Visible spawns %s\n", redtext("match"));
break;
}
}

Expand Down
2 changes: 1 addition & 1 deletion src/hoonymode.c
Original file line number Diff line number Diff line change
Expand Up @@ -855,7 +855,7 @@ static void HM_deselect_spawn(gedict_t *spawn)
}

// If showing all spawns, just remove the glow. otherwise remove the marker.
if (cvar("k_spm_show"))
if (SpawnShowStatus() > SPAWN_SHOW_DISABLED)
{
spawn->wizard->s.v.effects = (int)spawn->wizard->s.v.effects & ~effects;
}
Expand Down
5 changes: 4 additions & 1 deletion src/match.c
Original file line number Diff line number Diff line change
Expand Up @@ -1239,7 +1239,10 @@

SM_PrepareMap(); // remove/add some items from map regardind with dmm and game mode

HideSpawnPoints();
if (SpawnShowStatus() != SPAWN_SHOW_MATCH)
{
HideSpawnPoints();
}

if (SpawnicideStatus() == SPAWNICIDE_MATCH)
{
Expand Down Expand Up @@ -1647,7 +1650,7 @@
if (hm_timelimit)
{
int minutes = hm_timelimit / 60;
int seconds = hm_timelimit % 60;

Check warning on line 1653 in src/match.c

View workflow job for this annotation

GitHub Actions / verify-msvc

declaration of 'seconds' hides function parameter [D:\a\ktx\ktx\builddir\qwprogs.vcxproj]

if (minutes == 0)
{
Expand Down
2 changes: 1 addition & 1 deletion src/race.c
Original file line number Diff line number Diff line change
Expand Up @@ -529,7 +529,7 @@ void race_shutdown(char *msg)
race_cancel(true, "%s", msg);
race_remove_ent();
race_unready_all();
if (cvar("k_spm_show"))
if (SpawnShowStatus() > SPAWN_SHOW_DISABLED)
{
ShowSpawnPoints();
}
Expand Down
2 changes: 1 addition & 1 deletion src/world.c
Original file line number Diff line number Diff line change
Expand Up @@ -53,10 +53,10 @@
{
bodyque[i] = spawn();
bodyque[i]->classname = "bodyque";
bodyque[i - 1]->s.v.owner = EDICT_TO_PROG(bodyque[i]);

Check warning on line 56 in src/world.c

View workflow job for this annotation

GitHub Actions / verify-macos

implicit conversion loses integer precision: 'long' to 'int' [-Wshorten-64-to-32]
}

bodyque[MAX_BODYQUE - 1]->s.v.owner = EDICT_TO_PROG(bodyque[0]);

Check warning on line 59 in src/world.c

View workflow job for this annotation

GitHub Actions / verify-macos

implicit conversion loses integer precision: 'long' to 'int' [-Wshorten-64-to-32]
bodyque_head = 0;
}

Expand Down Expand Up @@ -144,7 +144,7 @@
e = spawn();

e->classname = "mapguard";
e->s.v.owner = EDICT_TO_PROG(world);

Check warning on line 147 in src/world.c

View workflow job for this annotation

GitHub Actions / verify-macos

implicit conversion loses integer precision: 'long' to 'int' [-Wshorten-64-to-32]
e->think = (func_t) CheckDefMap;
e->s.v.nextthink = g_globalvars.time + max(0.0001, timeout);
}
Expand Down Expand Up @@ -579,7 +579,7 @@

self = spawn();
setorigin(self, -912.6f, -898.9f, 248.0f); // oh, ktpro like
self->s.v.owner = EDICT_TO_PROG(world);

Check warning on line 582 in src/world.c

View workflow job for this annotation

GitHub Actions / verify-macos

implicit conversion loses integer precision: 'long' to 'int' [-Wshorten-64-to-32]
SP_item_artifact_super_damage();

self = swp; // restore self
Expand Down Expand Up @@ -701,7 +701,7 @@
SpawnicideEnable();
}

if (cvar("k_spm_show"))
if (SpawnShowStatus() > SPAWN_SHOW_DISABLED)
{
ShowSpawnPoints();
}
Expand Down
Loading