mirror of
https://git.do.srb2.org/STJr/SRB2.git
synced 2025-01-29 12:40:58 +00:00
Expose viewmobj as r_viewmobj
This commit is contained in:
parent
223edd8ee0
commit
bbbe76d2ca
2 changed files with 28 additions and 28 deletions
55
src/r_main.c
55
src/r_main.c
|
@ -71,6 +71,7 @@ angle_t viewangle, aimingangle;
|
|||
fixed_t viewcos, viewsin;
|
||||
sector_t *viewsector;
|
||||
player_t *viewplayer;
|
||||
mobj_t *r_viewmobj;
|
||||
|
||||
//
|
||||
// precalculated math tables
|
||||
|
@ -741,8 +742,6 @@ subsector_t *R_IsPointInSubsector(fixed_t x, fixed_t y)
|
|||
// R_SetupFrame
|
||||
//
|
||||
|
||||
static mobj_t *viewmobj;
|
||||
|
||||
// WARNING: a should be unsigned but to add with 2048, it isn't!
|
||||
#define AIMINGTODY(a) FixedDiv((FINETANGENT((2048+(((INT32)a)>>ANGLETOFINESHIFT)) & FINEMASK)*160)>>FRACBITS, fovtan)
|
||||
|
||||
|
@ -799,16 +798,16 @@ void R_SetupFrame(player_t *player)
|
|||
if (player->awayviewtics)
|
||||
{
|
||||
// cut-away view stuff
|
||||
viewmobj = player->awayviewmobj; // should be a MT_ALTVIEWMAN
|
||||
I_Assert(viewmobj != NULL);
|
||||
viewz = viewmobj->z + 20*FRACUNIT;
|
||||
r_viewmobj = player->awayviewmobj; // should be a MT_ALTVIEWMAN
|
||||
I_Assert(r_viewmobj != NULL);
|
||||
viewz = r_viewmobj->z + 20*FRACUNIT;
|
||||
aimingangle = player->awayviewaiming;
|
||||
viewangle = viewmobj->angle;
|
||||
viewangle = r_viewmobj->angle;
|
||||
}
|
||||
else if (!player->spectator && chasecam)
|
||||
// use outside cam view
|
||||
{
|
||||
viewmobj = NULL;
|
||||
r_viewmobj = NULL;
|
||||
viewz = thiscam->z + (thiscam->height>>1);
|
||||
aimingangle = thiscam->aiming;
|
||||
viewangle = thiscam->angle;
|
||||
|
@ -818,11 +817,11 @@ void R_SetupFrame(player_t *player)
|
|||
{
|
||||
viewz = player->viewz;
|
||||
|
||||
viewmobj = player->mo;
|
||||
I_Assert(viewmobj != NULL);
|
||||
r_viewmobj = player->mo;
|
||||
I_Assert(r_viewmobj != NULL);
|
||||
|
||||
aimingangle = player->aiming;
|
||||
viewangle = viewmobj->angle;
|
||||
viewangle = r_viewmobj->angle;
|
||||
|
||||
if (!demoplayback && player->playerstate != PST_DEAD)
|
||||
{
|
||||
|
@ -856,13 +855,13 @@ void R_SetupFrame(player_t *player)
|
|||
}
|
||||
else
|
||||
{
|
||||
viewx = viewmobj->x;
|
||||
viewy = viewmobj->y;
|
||||
viewx = r_viewmobj->x;
|
||||
viewy = r_viewmobj->y;
|
||||
viewx += quake.x;
|
||||
viewy += quake.y;
|
||||
|
||||
if (viewmobj->subsector)
|
||||
viewsector = viewmobj->subsector->sector;
|
||||
if (r_viewmobj->subsector)
|
||||
viewsector = r_viewmobj->subsector->sector;
|
||||
else
|
||||
viewsector = R_PointInSubsector(viewx, viewy)->sector;
|
||||
}
|
||||
|
@ -884,12 +883,12 @@ void R_SkyboxFrame(player_t *player)
|
|||
thiscam = &camera;
|
||||
|
||||
// cut-away view stuff
|
||||
viewmobj = skyboxmo[0];
|
||||
r_viewmobj = skyboxmo[0];
|
||||
#ifdef PARANOIA
|
||||
if (!viewmobj)
|
||||
if (!r_viewmobj)
|
||||
{
|
||||
const size_t playeri = (size_t)(player - players);
|
||||
I_Error("R_SkyboxFrame: viewmobj null (player %s)", sizeu1(playeri));
|
||||
I_Error("R_SkyboxFrame: r_viewmobj null (player %s)", sizeu1(playeri));
|
||||
}
|
||||
#endif
|
||||
if (player->awayviewtics)
|
||||
|
@ -920,13 +919,13 @@ void R_SkyboxFrame(player_t *player)
|
|||
}
|
||||
}
|
||||
}
|
||||
viewangle += viewmobj->angle;
|
||||
viewangle += r_viewmobj->angle;
|
||||
|
||||
viewplayer = player;
|
||||
|
||||
viewx = viewmobj->x;
|
||||
viewy = viewmobj->y;
|
||||
viewz = viewmobj->z; // 26/04/17: use actual Z position instead of spawnpoint angle!
|
||||
viewx = r_viewmobj->x;
|
||||
viewy = r_viewmobj->y;
|
||||
viewz = r_viewmobj->z; // 26/04/17: use actual Z position instead of spawnpoint angle!
|
||||
|
||||
if (mapheaderinfo[gamemap-1])
|
||||
{
|
||||
|
@ -966,29 +965,29 @@ void R_SkyboxFrame(player_t *player)
|
|||
else if (mh->skybox_scaley < 0)
|
||||
y = (campos.y - skyboxmo[1]->y) * -mh->skybox_scaley;
|
||||
|
||||
if (viewmobj->angle == 0)
|
||||
if (r_viewmobj->angle == 0)
|
||||
{
|
||||
viewx += x;
|
||||
viewy += y;
|
||||
}
|
||||
else if (viewmobj->angle == ANGLE_90)
|
||||
else if (r_viewmobj->angle == ANGLE_90)
|
||||
{
|
||||
viewx -= y;
|
||||
viewy += x;
|
||||
}
|
||||
else if (viewmobj->angle == ANGLE_180)
|
||||
else if (r_viewmobj->angle == ANGLE_180)
|
||||
{
|
||||
viewx -= x;
|
||||
viewy -= y;
|
||||
}
|
||||
else if (viewmobj->angle == ANGLE_270)
|
||||
else if (r_viewmobj->angle == ANGLE_270)
|
||||
{
|
||||
viewx += y;
|
||||
viewy -= x;
|
||||
}
|
||||
else
|
||||
{
|
||||
angle_t ang = viewmobj->angle>>ANGLETOFINESHIFT;
|
||||
angle_t ang = r_viewmobj->angle>>ANGLETOFINESHIFT;
|
||||
viewx += FixedMul(x,FINECOSINE(ang)) - FixedMul(y, FINESINE(ang));
|
||||
viewy += FixedMul(x, FINESINE(ang)) + FixedMul(y,FINECOSINE(ang));
|
||||
}
|
||||
|
@ -999,8 +998,8 @@ void R_SkyboxFrame(player_t *player)
|
|||
viewz += campos.z * -mh->skybox_scalez;
|
||||
}
|
||||
|
||||
if (viewmobj->subsector)
|
||||
viewsector = viewmobj->subsector->sector;
|
||||
if (r_viewmobj->subsector)
|
||||
viewsector = r_viewmobj->subsector->sector;
|
||||
else
|
||||
viewsector = R_PointInSubsector(viewx, viewy)->sector;
|
||||
|
||||
|
|
|
@ -83,6 +83,7 @@ extern fixed_t viewx, viewy, viewz;
|
|||
extern angle_t viewangle, aimingangle;
|
||||
extern sector_t *viewsector;
|
||||
extern player_t *viewplayer;
|
||||
extern mobj_t *r_viewmobj;
|
||||
|
||||
extern consvar_t cv_allowmlook;
|
||||
extern consvar_t cv_maxportals;
|
||||
|
|
Loading…
Reference in a new issue