game: change level hack

Look like ReRelease code just ignore spawn target if target has not found.

`base2` has `eou1_.cin+*bunk1$start` as target but `bunk1` does not have such target.

Look to:
* 8dc1fc9794/rerelease/p_client.cpp (L1492)
* https://github.com/yquake2/yquake2remaster/issues/22
This commit is contained in:
Denis Pauk 2024-05-01 23:56:28 +03:00
parent 78c7f62aba
commit ded6f0c962

View file

@ -1706,6 +1706,31 @@ SelectCoopSpawnPoint(edict_t *ent)
return spot;
}
static edict_t *
SelectSpawnPointByTarget(const char *spawnpoint)
{
edict_t *spot = NULL;
while ((spot = G_Find(spot, FOFS(classname), "info_player_start")) != NULL)
{
if (!spawnpoint[0] && !spot->targetname)
{
break;
}
if (!spawnpoint[0] || !spot->targetname)
{
continue;
}
if (Q_stricmp(spawnpoint, spot->targetname) == 0)
{
break;
}
}
return spot;
}
/*
* Chooses a player start, deathmatch start, coop start, etc
*/
@ -1743,37 +1768,22 @@ SelectSpawnPoint(edict_t *ent, vec3_t origin, vec3_t angles)
/* find a single player start spot */
if (!spot)
{
while ((spot = G_Find(spot, FOFS(classname), "info_player_start")) != NULL)
{
if (!game.spawnpoint[0] && !spot->targetname)
{
break;
}
spot = SelectSpawnPointByTarget(game.spawnpoint);
if (!game.spawnpoint[0] || !spot->targetname)
if (!spot)
{
continue;
}
if (Q_stricmp(game.spawnpoint, spot->targetname) == 0)
{
break;
}
/* previous map use incorrect target, use default */
spot = SelectSpawnPointByTarget("");
}
if (!spot)
{
if (!game.spawnpoint[0])
{
/* still no spawnpoint? use any */
gi.dprintf("Couldn't find spawn point '%s'\n", game.spawnpoint);
/* there wasn't a spawnpoint without a target, so use any */
spot = G_Find(spot, FOFS(classname), "info_player_start");
}
if (!spot)
{
gi.error("Couldn't find spawn point '%s'\n", game.spawnpoint);
}
}
}
/* If we are in coop and we didn't find a coop