Skip to content

Commit 4b612a4

Browse files
committed
WIPEOUT: additional dm3 spawns
1 parent 5df617d commit 4b612a4

File tree

5 files changed

+66
-52
lines changed

5 files changed

+66
-52
lines changed

include/progs.h

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1301,6 +1301,9 @@ typedef struct gedict_s
13011301
// { csqc
13021302
func_t SendEntity;
13031303
// }
1304+
// { wipeout spawn
1305+
float custom_radius; // custom spawn radius for wipeout spawns
1306+
// }
13041307
} gedict_t;
13051308

13061309
typedef enum

src/bot_client.c

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -129,6 +129,8 @@ void BotPlayerDeathEvent(gedict_t *self)
129129
// Was: PutClientInServer_apply()
130130
void BotClientEntersEvent(gedict_t *self, gedict_t *spawn_pos)
131131
{
132+
gedict_t *marker;
133+
132134
self->fb.oldwaterlevel = self->fb.oldwatertype = 0;
133135
self->fb.desired_angle[0] = self->s.v.angles[0];
134136
self->fb.desired_angle[1] = self->s.v.angles[1];
@@ -138,7 +140,10 @@ void BotClientEntersEvent(gedict_t *self, gedict_t *spawn_pos)
138140
self->fb.last_rndaim_time = 0;
139141
self->fb.wiggle_run_dir = 0;
140142

141-
SetMarker(self, spawn_pos);
143+
// Find the nearest navigation marker to the spawn point
144+
// Don't use spawn_pos directly - it's not a navigation marker!
145+
marker = spawn_pos ? LocateMarker(spawn_pos->s.v.origin) : NULL;
146+
SetMarker(self, marker);
142147

143148
self->fb.arrow = 0;
144149
ClearLookObject(self);

src/clan_arena.c

Lines changed: 37 additions & 49 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
typedef struct wipeout_spawn_config_t
88
{
99
vec3_t origin; // spawn point coordinates
10+
float angle; // spawn point angle (yaw)
1011
char *name; // spawn point name (for debugging)
1112
float custom_radius; // custom radius for this spawn (0 = use default)
1213
} wipeout_spawn_config;
@@ -18,15 +19,16 @@ typedef struct wipeout_map_spawns_t
1819
int spawn_count;
1920
} wipeout_map_spawns;
2021

21-
// Some spawns require a custom radius to prevent abuse
22-
// Using 0 defaults to a radius of 84 units
22+
// { {coords}, angle, name, radius }
2323
static wipeout_spawn_config dm3_spawns[] = {
24-
{ { -880, -232, -16 }, "tele/sng", 128 },
25-
{ { 192, -208, -176 }, "big>ra", 0 },
26-
{ { 1472, -928, -24 }, "ya box", 0 },
27-
{ { 1520, 432, -88 }, "rl", 300 },
28-
{ { -632, -680, -16 }, "tele/ra", 128 },
29-
{ { 512, 768, 216 }, "lifts", 128 }
24+
{ { -880, -232, -16 }, 90, "tele/sng", 400 },
25+
{ { 192, -208, -176 }, 90, "big>ra", 300 },
26+
{ { 1472, -928, -24 }, 90, "ya box", 200 },
27+
{ { 1520, 432, -88 }, 0, "rl", 400 },
28+
{ { -632, -680, -16 }, 90, "tele/ra", 400 },
29+
{ { 512, 768, 216 }, -90, "lifts", 300 },
30+
{ { -387, 233, -16 }, 0, "sng", 200 },
31+
{ { 2021, -446, -24 }, 180, "bridge", 400 }
3032
};
3133

3234
static wipeout_map_spawns wipeout_spawn_configs[] = {
@@ -58,8 +60,7 @@ void EndRound(int alive_team);
5860
void show_tracking_info(gedict_t *p);
5961

6062
// Wipeout spawn management functions
61-
static wipeout_spawn_config* WO_FindSpawnConfig(vec3_t origin);
62-
float WO_GetSpawnRadius(vec3_t origin);
63+
float WO_GetSpawnRadius(gedict_t *spawn_point);
6364
void WO_InitializeSpawns(void);
6465

6566
gedict_t* ca_find_player(gedict_t *p, gedict_t *observer)
@@ -664,7 +665,6 @@ void CA_PutClientInServer(void)
664665
self->spawn_delay = 0;
665666

666667
setmodel(self, "");
667-
setorigin(self, PASSVEC3(self->s.v.origin));
668668

669669
if (!self->in_limbo || ca_round_pause)
670670
{
@@ -1793,63 +1793,51 @@ void CA_Frame(void)
17931793
}
17941794
}
17951795

1796-
// Find spawn configuration for a given origin
1797-
static wipeout_spawn_config* WO_FindSpawnConfig(vec3_t origin)
1798-
{
1799-
int i, j;
1800-
1801-
if (cvar("k_clan_arena") != 2) // Only for wipeout mode
1802-
{
1803-
return NULL;
1804-
}
1805-
1806-
// Find current map configuration
1807-
for (i = 0; wipeout_spawn_configs[i].mapname; i++)
1808-
{
1809-
if (streq(mapname, wipeout_spawn_configs[i].mapname))
1810-
{
1811-
// Search for matching spawn point
1812-
for (j = 0; j < wipeout_spawn_configs[i].spawn_count; j++)
1813-
{
1814-
if (VectorCompare(origin, wipeout_spawn_configs[i].spawns[j].origin))
1815-
{
1816-
return &wipeout_spawn_configs[i].spawns[j];
1817-
}
1818-
}
1819-
break;
1820-
}
1821-
}
1822-
1823-
return NULL;
1824-
}
18251796

18261797
// Get custom spawn radius for a spawn point
1827-
float WO_GetSpawnRadius(vec3_t origin)
1798+
float WO_GetSpawnRadius(gedict_t *spawn_point)
18281799
{
1829-
wipeout_spawn_config *config = WO_FindSpawnConfig(origin);
1830-
1831-
if (config && config->custom_radius > 0)
1800+
if (spawn_point && spawn_point->custom_radius > 0)
18321801
{
1833-
return config->custom_radius;
1802+
return spawn_point->custom_radius;
18341803
}
18351804

18361805
return 0; // Use default radius
18371806
}
18381807

1839-
// Initialize wipeout spawns (can be called to reload configurations)
1808+
// Initialize wipeout spawns by creating info_player_wipeout entities
1809+
// from the wipeout_spawn_configs array. These custom spawns are used
1810+
// exclusively during wipeout mode
18401811
void WO_InitializeSpawns(void)
18411812
{
18421813
if (cvar("k_clan_arena") == 2)
18431814
{
1844-
int i;
1815+
int i, j;
18451816
for (i = 0; wipeout_spawn_configs[i].mapname; i++)
18461817
{
18471818
if (streq(mapname, wipeout_spawn_configs[i].mapname))
18481819
{
1820+
// Create spawn entities for each configured spawn point
1821+
for (j = 0; j < wipeout_spawn_configs[i].spawn_count; j++)
1822+
{
1823+
gedict_t *spawn_ent = spawn();
1824+
wipeout_spawn_config *spawn_cfg = &wipeout_spawn_configs[i].spawns[j];
1825+
1826+
// Set entity properties
1827+
spawn_ent->classname = "info_player_wipeout";
1828+
1829+
// Set origin and angles
1830+
VectorCopy(spawn_cfg->origin, spawn_ent->s.v.origin);
1831+
VectorSet(spawn_ent->s.v.angles, 0, spawn_cfg->angle, 0);
1832+
1833+
// Custom wipeout radius
1834+
spawn_ent->custom_radius = spawn_cfg->custom_radius;
1835+
}
1836+
18491837
if (cvar("developer"))
18501838
{
1851-
G_bprint(2, "Wipeout: Using custom spawn configuration for %s (%d spawns)\n",
1852-
mapname, wipeout_spawn_configs[i].spawn_count);
1839+
G_bprint(2, "Wipeout: Created %d custom spawn points for %s\n",
1840+
wipeout_spawn_configs[i].spawn_count, mapname);
18531841
}
18541842

18551843
break;

src/client.c

Lines changed: 18 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ void SendSpecInfo(gedict_t *spec, gedict_t *target_client);
5858
void del_from_specs_favourites(gedict_t *rm);
5959
void item_megahealth_rot(void);
6060

61-
float WO_GetSpawnRadius(vec3_t origin);
61+
float WO_GetSpawnRadius(gedict_t *spawn_point);
6262

6363
extern int g_matchstarttime;
6464

@@ -1026,7 +1026,7 @@ static float GetEffectiveSpawnRadius(gedict_t *spot, float default_radius)
10261026
{
10271027
if (cvar("k_clan_arena") == 2)
10281028
{
1029-
float custom_radius = WO_GetSpawnRadius(spot->s.v.origin);
1029+
float custom_radius = WO_GetSpawnRadius(spot);
10301030
if (custom_radius > 0)
10311031
{
10321032
return custom_radius;
@@ -2036,6 +2036,15 @@ void PutClientInServer(void)
20362036
"info_player_deathmatch" : streq(getteam(self), "red") ?
20372037
"info_player_team1_deathmatch" : "info_player_team2_deathmatch");
20382038
}
2039+
else if (cvar("k_clan_arena") == 2) // Wipeout mode
2040+
{
2041+
spot = SelectSpawnPoint("info_player_wipeout");
2042+
// Fallback to regular spawns if no wipeout spawns exist
2043+
if (!spot)
2044+
{
2045+
spot = SelectSpawnPoint("info_player_deathmatch");
2046+
}
2047+
}
20392048
else if (isRA() && (isWinner(self) || isLoser(self)))
20402049
{
20412050
spot = SelectSpawnPoint("info_teleport_destination");
@@ -2052,6 +2061,13 @@ void PutClientInServer(void)
20522061

20532062
HM_log_spawn_point(self, spot);
20542063

2064+
// CRITICAL: Check that we actually found a spawn point
2065+
if (!spot)
2066+
{
2067+
G_Error("PutClientInServer: No spawn point found!\n");
2068+
return;
2069+
}
2070+
20552071
VectorCopy(spot->s.v.origin, self->s.v.origin);
20562072
self->s.v.origin[2] += 1;
20572073

src/g_spawn.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -459,6 +459,8 @@ spawn_t spawns[] =
459459
// k_ctf_based_spawn 2 "within home base" spawns.
460460
{ "info_player_team1_deathmatch", SUB_Null },
461461
{ "info_player_team2_deathmatch", SUB_Null },
462+
// Wipeout mode spawns
463+
{ "info_player_wipeout", SUB_Null },
462464
//
463465
// TF -- well, we does not support TF but require it for loading TF map as CTF map.
464466
//

0 commit comments

Comments
 (0)