mirror of
https://git.do.srb2.org/KartKrew/Kart-Public.git
synced 2024-12-27 21:01:04 +00:00
Merge branch 'camera-subsector-crash-fix' into 'master'
Camera subsector crash fix See merge request STJr/SRB2!318
This commit is contained in:
commit
a400bb9ef6
1 changed files with 38 additions and 31 deletions
|
@ -2477,6 +2477,43 @@ static void P_LoadNightsGhosts(void)
|
||||||
free(gpath);
|
free(gpath);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void P_SetupCamera(void)
|
||||||
|
{
|
||||||
|
if (players[displayplayer].mo && (server || addedtogame))
|
||||||
|
{
|
||||||
|
camera.x = players[displayplayer].mo->x;
|
||||||
|
camera.y = players[displayplayer].mo->y;
|
||||||
|
camera.z = players[displayplayer].mo->z;
|
||||||
|
camera.angle = players[displayplayer].mo->angle;
|
||||||
|
camera.subsector = R_PointInSubsector(camera.x, camera.y); // make sure camera has a subsector set -- Monster Iestyn (12/11/18)
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
mapthing_t *thing;
|
||||||
|
|
||||||
|
switch (gametype)
|
||||||
|
{
|
||||||
|
case GT_MATCH:
|
||||||
|
case GT_TAG:
|
||||||
|
thing = deathmatchstarts[0];
|
||||||
|
break;
|
||||||
|
|
||||||
|
default:
|
||||||
|
thing = playerstarts[0];
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (thing)
|
||||||
|
{
|
||||||
|
camera.x = thing->x;
|
||||||
|
camera.y = thing->y;
|
||||||
|
camera.z = thing->z;
|
||||||
|
camera.angle = FixedAngle((fixed_t)thing->angle << FRACBITS);
|
||||||
|
camera.subsector = R_PointInSubsector(camera.x, camera.y); // make sure camera has a subsector set -- Monster Iestyn (12/11/18)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/** Loads a level from a lump or external wad.
|
/** Loads a level from a lump or external wad.
|
||||||
*
|
*
|
||||||
* \param skipprecip If true, don't spawn precipitation.
|
* \param skipprecip If true, don't spawn precipitation.
|
||||||
|
@ -2814,37 +2851,7 @@ boolean P_SetupLevel(boolean skipprecip)
|
||||||
|
|
||||||
if (!dedicated)
|
if (!dedicated)
|
||||||
{
|
{
|
||||||
if (players[displayplayer].mo && (server || addedtogame))
|
P_SetupCamera();
|
||||||
{
|
|
||||||
camera.x = players[displayplayer].mo->x;
|
|
||||||
camera.y = players[displayplayer].mo->y;
|
|
||||||
camera.z = players[displayplayer].mo->z;
|
|
||||||
camera.angle = players[displayplayer].mo->angle;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
mapthing_t *thing;
|
|
||||||
|
|
||||||
switch (gametype)
|
|
||||||
{
|
|
||||||
case GT_MATCH:
|
|
||||||
case GT_TAG:
|
|
||||||
thing = deathmatchstarts[0];
|
|
||||||
break;
|
|
||||||
|
|
||||||
default:
|
|
||||||
thing = playerstarts[0];
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (thing)
|
|
||||||
{
|
|
||||||
camera.x = thing->x;
|
|
||||||
camera.y = thing->y;
|
|
||||||
camera.z = thing->z;
|
|
||||||
camera.angle = FixedAngle((fixed_t)thing->angle << FRACBITS);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!cv_cam_height.changed)
|
if (!cv_cam_height.changed)
|
||||||
CV_Set(&cv_cam_height, cv_cam_height.defaultvalue);
|
CV_Set(&cv_cam_height, cv_cam_height.defaultvalue);
|
||||||
|
|
Loading…
Reference in a new issue