mirror of
https://git.do.srb2.org/KartKrew/Kart-Public.git
synced 2025-01-14 13:51:31 +00:00
Fix slope collision detection for the camera
See http://mb.srb2.org/showthread.php?t=41494
This commit is contained in:
parent
6466ed5afe
commit
8ceba95bfa
1 changed files with 28 additions and 18 deletions
46
src/p_user.c
46
src/p_user.c
|
@ -8123,6 +8123,8 @@ boolean P_MoveChaseCamera(player_t *player, camera_t *thiscam, boolean resetcall
|
|||
{
|
||||
fixed_t myfloorz, myceilingz;
|
||||
fixed_t midz = thiscam->z + (thiscam->z - mo->z)/2;
|
||||
fixed_t midx = ((mo->x>>FRACBITS) + (thiscam->x>>FRACBITS))<<(FRACBITS-1);
|
||||
fixed_t midy = ((mo->y>>FRACBITS) + (thiscam->y>>FRACBITS))<<(FRACBITS-1);
|
||||
|
||||
// Cameras use the heightsec's heights rather then the actual sector heights.
|
||||
// If you can see through it, why not move the camera through it too?
|
||||
|
@ -8138,8 +8140,8 @@ boolean P_MoveChaseCamera(player_t *player, camera_t *thiscam, boolean resetcall
|
|||
}
|
||||
else
|
||||
{
|
||||
myfloorz = newsubsec->sector->floorheight;
|
||||
myceilingz = newsubsec->sector->ceilingheight;
|
||||
myfloorz = P_CameraGetFloorZ(thiscam, newsubsec->sector, midx, midy, NULL);
|
||||
myceilingz = P_CameraGetCeilingZ(thiscam, newsubsec->sector, midx, midy, NULL);
|
||||
}
|
||||
|
||||
// Check list of fake floors and see if floorz/ceilingz need to be altered.
|
||||
|
@ -8151,17 +8153,21 @@ boolean P_MoveChaseCamera(player_t *player, camera_t *thiscam, boolean resetcall
|
|||
|
||||
for (rover = newsubsec->sector->ffloors; rover; rover = rover->next)
|
||||
{
|
||||
fixed_t topheight, bottomheight;
|
||||
if (!(rover->flags & FF_BLOCKOTHERS) || !(rover->flags & FF_EXISTS) || !(rover->flags & FF_RENDERALL) || GETSECSPECIAL(rover->master->frontsector->special, 4) == 12)
|
||||
continue;
|
||||
|
||||
delta1 = midz - (*rover->bottomheight
|
||||
+ ((*rover->topheight - *rover->bottomheight)/2));
|
||||
delta2 = thingtop - (*rover->bottomheight
|
||||
+ ((*rover->topheight - *rover->bottomheight)/2));
|
||||
if (*rover->topheight > myfloorz && abs(delta1) < abs(delta2))
|
||||
myfloorz = *rover->topheight;
|
||||
if (*rover->bottomheight < myceilingz && abs(delta1) >= abs(delta2))
|
||||
myceilingz = *rover->bottomheight;
|
||||
topheight = P_CameraGetFOFTopZ(thiscam, newsubsec->sector, rover, midx, midy, NULL);
|
||||
bottomheight = P_CameraGetFOFBottomZ(thiscam, newsubsec->sector, rover, midx, midy, NULL);
|
||||
|
||||
delta1 = midz - (bottomheight
|
||||
+ ((topheight - bottomheight)/2));
|
||||
delta2 = thingtop - (bottomheight
|
||||
+ ((topheight - bottomheight)/2));
|
||||
if (topheight > myfloorz && abs(delta1) < abs(delta2))
|
||||
myfloorz = topheight;
|
||||
if (bottomheight < myceilingz && abs(delta1) >= abs(delta2))
|
||||
myceilingz = bottomheight;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -8275,18 +8281,22 @@ boolean P_MoveChaseCamera(player_t *player, camera_t *thiscam, boolean resetcall
|
|||
|
||||
for (rover = newsubsec->sector->ffloors; rover; rover = rover->next)
|
||||
{
|
||||
fixed_t topheight, bottomheight;
|
||||
if ((rover->flags & FF_BLOCKOTHERS) && (rover->flags & FF_RENDERALL) && (rover->flags & FF_EXISTS) && GETSECSPECIAL(rover->master->frontsector->special, 4) != 12)
|
||||
{
|
||||
if (*rover->bottomheight - thiscam->height < z
|
||||
&& midz < *rover->bottomheight)
|
||||
z = *rover->bottomheight - thiscam->height-FixedMul(11*FRACUNIT, mo->scale);
|
||||
topheight = P_CameraGetFOFTopZ(thiscam, newsubsec->sector, rover, midx, midy, NULL);
|
||||
bottomheight = P_CameraGetFOFBottomZ(thiscam, newsubsec->sector, rover, midx, midy, NULL);
|
||||
|
||||
else if (*rover->topheight + thiscam->height > z
|
||||
&& midz > *rover->topheight)
|
||||
z = *rover->topheight;
|
||||
if (bottomheight - thiscam->height < z
|
||||
&& midz < bottomheight)
|
||||
z = bottomheight - thiscam->height-FixedMul(11*FRACUNIT, mo->scale);
|
||||
|
||||
if ((mo->z >= *rover->topheight && midz < *rover->bottomheight)
|
||||
|| ((mo->z < *rover->bottomheight && mo->z+mo->height < *rover->topheight) && midz >= *rover->topheight))
|
||||
else if (topheight + thiscam->height > z
|
||||
&& midz > topheight)
|
||||
z = topheight;
|
||||
|
||||
if ((mo->z >= topheight && midz < bottomheight)
|
||||
|| ((mo->z < bottomheight && mo->z+mo->height < topheight) && midz >= topheight))
|
||||
{
|
||||
// Can't see
|
||||
if (!resetcalled)
|
||||
|
|
Loading…
Reference in a new issue