mirror of
https://git.do.srb2.org/STJr/SRB2.git
synced 2025-01-18 23:42:11 +00:00
Set r_viewmobj when rendering type 8 sector portals
This commit is contained in:
parent
05d9b59fe9
commit
1c02badd47
3 changed files with 9 additions and 17 deletions
|
@ -1434,6 +1434,9 @@ static void R_PortalFrame(portal_t *portal)
|
|||
viewsin = FINESINE(viewangle>>ANGLETOFINESHIFT);
|
||||
viewcos = FINECOSINE(viewangle>>ANGLETOFINESHIFT);
|
||||
|
||||
if (!P_MobjWasRemoved(portal->viewmobj))
|
||||
r_viewmobj = portal->viewmobj;
|
||||
|
||||
portalclipstart = portal->start;
|
||||
portalclipend = portal->end;
|
||||
|
||||
|
|
|
@ -101,7 +101,7 @@ void Portal_ClipApply (const portal_t* portal)
|
|||
|
||||
static portal_t* Portal_Add (const INT16 x1, const INT16 x2)
|
||||
{
|
||||
portal_t *portal = Z_Malloc(sizeof(portal_t), PU_LEVEL, NULL);
|
||||
portal_t *portal = Z_Calloc(sizeof(portal_t), PU_LEVEL, NULL);
|
||||
INT16 *ceilingclipsave = Z_Malloc(sizeof(INT16)*(x2-x1 + 1), PU_LEVEL, NULL);
|
||||
INT16 *floorclipsave = Z_Malloc(sizeof(INT16)*(x2-x1 + 1), PU_LEVEL, NULL);
|
||||
fixed_t *frontscalesave = Z_Malloc(sizeof(fixed_t)*(x2-x1 + 1), PU_LEVEL, NULL);
|
||||
|
@ -117,7 +117,7 @@ static portal_t* Portal_Add (const INT16 x1, const INT16 x2)
|
|||
portal_cap->next = portal;
|
||||
portal_cap = portal;
|
||||
}
|
||||
portal->next = NULL;
|
||||
portal->clipline = -1;
|
||||
|
||||
// Store clipping values so they can be restored once the portal is rendered.
|
||||
portal->ceilingclip = ceilingclipsave;
|
||||
|
@ -193,9 +193,6 @@ void Portal_Add2Lines (const INT32 line1, const INT32 line2, const INT32 x1, con
|
|||
portal->viewz = viewz + dest->frontsector->floorheight - start->frontsector->floorheight;
|
||||
|
||||
portal->clipline = line2;
|
||||
portal->is_skybox = false;
|
||||
portal->is_horizon = false;
|
||||
portal->horizon_sector = NULL;
|
||||
|
||||
Portal_ClipRange(portal);
|
||||
|
||||
|
@ -318,10 +315,7 @@ static boolean Portal_AddSkybox (const visplane_t* plane)
|
|||
|
||||
Portal_ClipVisplane(plane, portal);
|
||||
|
||||
portal->clipline = -1;
|
||||
portal->is_skybox = true;
|
||||
portal->is_horizon = false;
|
||||
portal->horizon_sector = NULL;
|
||||
|
||||
Portal_GetViewpointForSkybox(portal);
|
||||
|
||||
|
@ -352,8 +346,9 @@ static void Portal_GetViewpointForSecPortal(portal_t *portal, sectorportal_t *se
|
|||
portal->viewz = viewz; // Apparently it just works like that. Not going to question it.
|
||||
return;
|
||||
case SECPORTAL_OBJECT:
|
||||
if (!secportal->mobj || P_MobjWasRemoved(secportal->mobj))
|
||||
if (P_MobjWasRemoved(secportal->mobj))
|
||||
return;
|
||||
portal->viewmobj = secportal->mobj;
|
||||
x = secportal->mobj->x;
|
||||
y = secportal->mobj->y;
|
||||
z = secportal->mobj->z;
|
||||
|
@ -428,11 +423,6 @@ static boolean Portal_AddSectorPortal (const visplane_t* plane)
|
|||
|
||||
Portal_ClipVisplane(plane, portal);
|
||||
|
||||
portal->clipline = -1;
|
||||
portal->is_horizon = false;
|
||||
portal->is_skybox = false;
|
||||
portal->horizon_sector = NULL;
|
||||
|
||||
Portal_GetViewpointForSecPortal(portal, secportal);
|
||||
|
||||
return true;
|
||||
|
@ -450,9 +440,6 @@ void Portal_AddTransferred (const UINT32 secportalnum, const INT32 x1, const INT
|
|||
return;
|
||||
|
||||
portal_t* portal = Portal_Add(x1, x2);
|
||||
portal->is_skybox = false;
|
||||
portal->is_horizon = false;
|
||||
portal->horizon_sector = NULL;
|
||||
|
||||
if (secportal->type == SECPORTAL_SKYBOX)
|
||||
Portal_GetViewpointForSkybox(portal);
|
||||
|
|
|
@ -36,6 +36,8 @@ typedef struct portal_s
|
|||
|
||||
boolean is_skybox;
|
||||
|
||||
mobj_t *viewmobj;
|
||||
|
||||
UINT8 pass; /**< Keeps track of the portal's recursion depth. */
|
||||
INT32 clipline; /**< Optional clipline for line-based portals. */
|
||||
|
||||
|
|
Loading…
Reference in a new issue