Merge branch 'nospecmove' into Saturn-Testing
This commit is contained in:
commit
5f0d47ca88
11 files changed
+232
-166
No files matched your search
+1
-1
@@ -559,7 +559,7 @@ static boolean D_Display(void)
|
||||
|
||||
for (i = 0; i <= splitscreen; i++)
|
||||
{
|
||||
V_DoPostProcessor(i, &players[displayplayers[i]], postimgparam[i]);
|
||||
V_DoPostProcessor(i, postimgparam[i]);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -412,8 +412,6 @@ typedef struct player_s
|
||||
// See pflags_t, above.
|
||||
pflags_t pflags;
|
||||
|
||||
UINT16 postimgflags;
|
||||
|
||||
// playing animation.
|
||||
panim_t panim;
|
||||
|
||||
@@ -538,8 +536,6 @@ typedef struct player_s
|
||||
INT32 awayviewtics;
|
||||
angle_t awayviewaiming; // Used for cut-away view
|
||||
|
||||
boolean speccam;
|
||||
|
||||
boolean spectator;
|
||||
UINT8 bot;
|
||||
|
||||
|
||||
+61
-14
@@ -832,14 +832,6 @@ boolean InputDown(INT32 gc, UINT8 p)
|
||||
}
|
||||
}
|
||||
|
||||
//
|
||||
// G_BuildTiccmd
|
||||
// Builds a ticcmd from all of the available inputs
|
||||
// or reads it from the demo buffer.
|
||||
// If recording a demo, write it out
|
||||
//
|
||||
// set secondaryplayer true to build player 2's ticcmd in splitscreen mode
|
||||
//
|
||||
INT32 localaiming[MAXSPLITSCREENPLAYERS];
|
||||
angle_t localangle[MAXSPLITSCREENPLAYERS];
|
||||
boolean camspin[MAXSPLITSCREENPLAYERS];
|
||||
@@ -848,11 +840,55 @@ static fixed_t forwardmove[2] = {25<<FRACBITS>>16, 50<<FRACBITS>>16};
|
||||
static fixed_t sidemove[2] = {2<<FRACBITS>>16, 4<<FRACBITS>>16};
|
||||
static fixed_t angleturn[3] = {KART_FULLTURN/2, KART_FULLTURN, KART_FULLTURN/4}; // + slow turn
|
||||
|
||||
// this is absolutely awful
|
||||
// but we need this if we dont want spectators to move but be able to go to freecam from watching someone
|
||||
static void G_BuildLocalTiccmd(ticcmd_t *cmd, UINT8 ssplayer)
|
||||
{
|
||||
boolean moveinput = false;
|
||||
INT32 axis = 0;
|
||||
const boolean usejoystick = (cv_usejoystick[(ssplayer-1)].value);
|
||||
|
||||
moveinput = (InputDown(gc_turnleft, ssplayer) || InputDown(gc_turnright, ssplayer)
|
||||
|| InputDown(gc_aimforward, ssplayer) || InputDown(gc_aimbackward, ssplayer) ||
|
||||
(usejoystick && JoyAxis(AXISAIM, ssplayer) != 0) || (usejoystick && JoyAxis(AXISTURN, ssplayer) != 0));
|
||||
|
||||
// check for inputs and return button commands
|
||||
// for stuff like joining with item button, etc.
|
||||
#define CHECKINPUT(button, AXIS, buttflag) \
|
||||
axis = JoyAxis(AXIS, ssplayer); \
|
||||
if (InputDown(button, ssplayer) || (usejoystick && axis > 0)) cmd->buttons |= buttflag;
|
||||
|
||||
CHECKINPUT(gc_accelerate, AXISMOVE, BT_ACCELERATE);
|
||||
CHECKINPUT(gc_brake, AXISBRAKE, BT_BRAKE);
|
||||
CHECKINPUT(gc_fire, AXISFIRE, BT_ATTACK);
|
||||
CHECKINPUT(gc_drift, AXISDRIFT, BT_DRIFT);
|
||||
CHECKINPUT(gc_custom1, AXISCUSTOM1, BT_CUSTOM1);
|
||||
CHECKINPUT(gc_custom2, AXISCUSTOM2, BT_CUSTOM2);
|
||||
CHECKINPUT(gc_custom3, AXISCUSTOM3, BT_CUSTOM3);
|
||||
|
||||
#undef CHECKINPUT
|
||||
|
||||
// Reset to our spec player if we watch someone else.
|
||||
if ((moveinput || cmd->buttons)
|
||||
&& displayplayers[0] != consoleplayer && ssplayer == 1)
|
||||
{
|
||||
displayplayers[0] = consoleplayer;
|
||||
R_ResetViewInterpolation(0);
|
||||
camera[0].reset_aiming = true;
|
||||
}
|
||||
}
|
||||
|
||||
//
|
||||
// G_BuildTiccmd
|
||||
// Builds a ticcmd from all of the available inputs
|
||||
// or reads it from the demo buffer.
|
||||
// If recording a demo, write it out
|
||||
//
|
||||
void G_BuildTiccmd(ticcmd_t *cmd, INT32 realtics, UINT8 ssplayer)
|
||||
{
|
||||
const UINT8 forplayer = ssplayer-1;
|
||||
INT32 laim, th, tspeed, forward, side, axis; //i
|
||||
const INT32 speed = 1;
|
||||
const UINT8 forplayer = (ssplayer-1);
|
||||
INT32 laim, th, tspeed, forward, side, axis;
|
||||
|
||||
// these ones used for multiple conditions
|
||||
boolean turnleft, turnright, mouseaiming;
|
||||
boolean invertmouse, usejoystick, kbl, rd;
|
||||
@@ -875,8 +911,8 @@ void G_BuildTiccmd(ticcmd_t *cmd, INT32 realtics, UINT8 ssplayer)
|
||||
else
|
||||
player = &players[displayplayers[forplayer]];
|
||||
|
||||
if (ssplayer == 2)
|
||||
thiscam = (player->bot == 2 ? &camera[0] : &camera[forplayer]);
|
||||
if ((ssplayer == 2) && (player->bot == 2))
|
||||
thiscam = &camera[0];
|
||||
else
|
||||
thiscam = &camera[forplayer];
|
||||
|
||||
@@ -913,6 +949,17 @@ void G_BuildTiccmd(ticcmd_t *cmd, INT32 realtics, UINT8 ssplayer)
|
||||
return;
|
||||
}
|
||||
|
||||
// lmfao this is beyond hellish
|
||||
if (player->spectator)
|
||||
{
|
||||
G_BuildLocalTiccmd(cmd, ssplayer);
|
||||
|
||||
if (gamestate == GS_LEVEL)
|
||||
LUA_HookTiccmd(player, cmd, HOOK(PlayerCmd));
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
switch (ssplayer)
|
||||
{
|
||||
case 2:
|
||||
@@ -965,7 +1012,7 @@ void G_BuildTiccmd(ticcmd_t *cmd, INT32 realtics, UINT8 ssplayer)
|
||||
if (th < SLOWTURNTICS)
|
||||
tspeed = cv_turnsmooth.value == 2 ? 2 : 0; // slow turn
|
||||
else
|
||||
tspeed = speed;
|
||||
tspeed = 1;
|
||||
|
||||
cmd->driftturn = 0;
|
||||
|
||||
|
||||
+15
-8
@@ -5176,8 +5176,11 @@ static void HWR_SetTransformAiming(FTransform *trans)
|
||||
trans->anglex = (float)(gl_aimingangle>>ANGLETOFINESHIFT)*(360.0f/(float)FINEANGLES);
|
||||
}
|
||||
|
||||
void HWR_SetTransform(float fpov, player_t *player)
|
||||
void HWR_SetTransform(float fpov)
|
||||
{
|
||||
UINT8 viewnum = R_GetViewNumber();
|
||||
camera_t *thiscam = &camera[viewnum];
|
||||
|
||||
gl_viewx = FIXED_TO_FLOAT(viewx);
|
||||
gl_viewy = FIXED_TO_FLOAT(viewy);
|
||||
gl_viewz = FIXED_TO_FLOAT(viewz);
|
||||
@@ -5207,15 +5210,15 @@ void HWR_SetTransform(float fpov, player_t *player)
|
||||
atransform.splitscreen = splitscreen;
|
||||
|
||||
atransform.flip = false;
|
||||
if ((player->postimgflags & POSTIMG_FLIP) && !(player->postimgflags & POSTIMG_MIRROR))
|
||||
if ((thiscam->postimg & POSTIMG_FLIP) && !(thiscam->postimg & POSTIMG_MIRROR))
|
||||
atransform.flip = true;
|
||||
|
||||
atransform.mirror = false;
|
||||
if ((player->postimgflags & POSTIMG_MIRROR) && !(player->postimgflags & POSTIMG_FLIP))
|
||||
if ((thiscam->postimg & POSTIMG_MIRROR) && !(thiscam->postimg & POSTIMG_FLIP))
|
||||
atransform.mirror = true;
|
||||
|
||||
atransform.mirrorflip = false;
|
||||
if ((player->postimgflags & POSTIMG_FLIP) && (player->postimgflags & POSTIMG_MIRROR))
|
||||
if ((thiscam->postimg & POSTIMG_FLIP) && (thiscam->postimg & POSTIMG_MIRROR))
|
||||
atransform.mirrorflip = true;
|
||||
|
||||
// Set transform.
|
||||
@@ -5282,7 +5285,7 @@ void HWR_RenderViewpoint(gl_portal_t *rootportal, const float fpov, player_t *pl
|
||||
// draw normal things in current frame in current incremented stencil buffer area
|
||||
HWR_SetStencilState(HWR_STENCIL_NORMAL, stencil_level);
|
||||
|
||||
HWR_SetTransform(fpov, player);
|
||||
HWR_SetTransform(fpov);
|
||||
|
||||
HWR_ClearSprites();
|
||||
HWR_ClearClipper();
|
||||
@@ -5339,7 +5342,7 @@ void HWR_RenderViewpoint(gl_portal_t *rootportal, const float fpov, player_t *pl
|
||||
HWR_DrawSkyBackground();
|
||||
HWR_SetStencilState(HWR_STENCIL_NORMAL, 0);
|
||||
GL_ClearBuffer(false, false, true, 0);// clear skywall markings from the stencil buffer
|
||||
HWR_SetTransform(fpov, player);// restore transform
|
||||
HWR_SetTransform(fpov);// restore transform
|
||||
}
|
||||
gl_collect_skywalls = false;
|
||||
|
||||
@@ -5796,8 +5799,12 @@ static void HWR_DoPostProcessor(player_t *player)
|
||||
if (splitscreen) // Not supported in splitscreen - someone want to add support?
|
||||
return;
|
||||
|
||||
//UINT8 viewnum = R_GetViewNumber(); // see above
|
||||
//camera_t *thiscam = &camera[viewnum];
|
||||
camera_t *thiscam = &camera[0];
|
||||
|
||||
// Drunken vision! WooOOooo~
|
||||
if (player->postimgflags & POSTIMG_WATER || player->postimgflags & POSTIMG_HEAT)
|
||||
if (thiscam->postimg & POSTIMG_WATER || thiscam->postimg & POSTIMG_HEAT)
|
||||
{
|
||||
// 10 by 10 grid. 2 coordinates (xy)
|
||||
float v[SCREENVERTS][SCREENVERTS][2];
|
||||
@@ -5809,7 +5816,7 @@ static void HWR_DoPostProcessor(player_t *player)
|
||||
INT32 FREQUENCY;
|
||||
|
||||
// Modifies the wave.
|
||||
if (player->postimgflags & POSTIMG_WATER)
|
||||
if (thiscam->postimg & POSTIMG_WATER)
|
||||
{
|
||||
WAVELENGTH = 5;
|
||||
AMPLITUDE = 20;
|
||||
|
||||
@@ -108,7 +108,7 @@ void HWR_RenderViewpoint(gl_portal_t *rootportal, const float fpov, player_t *pl
|
||||
void HWR_ClearSkyDome(void);
|
||||
void HWR_BuildSkyDome(void);
|
||||
|
||||
void HWR_SetTransform(float fpov, player_t *player);
|
||||
void HWR_SetTransform(float fpov);
|
||||
void HWR_ClearClipper(void);
|
||||
void HWR_SetStencilState(int state, int level);
|
||||
|
||||
|
||||
@@ -160,7 +160,7 @@ static void HWR_RenderPortalSeg(gl_portal_t* portal, SINT8 state)
|
||||
void HWR_RenderPortal(gl_portal_t* portal, gl_portal_t* rootportal, const float fpov, player_t *player, int stencil_level)
|
||||
{
|
||||
// draw portal seg to stencil buffer with increment
|
||||
HWR_SetTransform(fpov, player);
|
||||
HWR_SetTransform(fpov);
|
||||
HWR_ClearClipper();
|
||||
|
||||
HWR_SetStencilState(HWR_STENCIL_BEGIN, stencil_level);
|
||||
@@ -180,7 +180,7 @@ void HWR_RenderPortal(gl_portal_t* portal, gl_portal_t* rootportal, const float
|
||||
}
|
||||
|
||||
// remove portal seg from stencil buffer
|
||||
HWR_SetTransform(fpov, player);
|
||||
HWR_SetTransform(fpov);
|
||||
HWR_ClearClipper();
|
||||
|
||||
HWR_SetStencilState(HWR_STENCIL_REVERSE, stencil_level);
|
||||
|
||||
@@ -123,6 +123,9 @@ typedef struct camera_s
|
||||
|
||||
// SRB2Kart: camera pans while drifting
|
||||
fixed_t pan;
|
||||
|
||||
// postproccess effects
|
||||
UINT16 postimg;
|
||||
} camera_t;
|
||||
|
||||
extern camera_t camera[MAXSPLITSCREENPLAYERS];
|
||||
|
||||
+18
-20
@@ -3246,13 +3246,20 @@ void P_DestroyRobots(void)
|
||||
static void P_CalcChasePostImg(player_t *player, camera_t *thiscam)
|
||||
{
|
||||
const boolean flipcam = (player->pflags & PF_FLIPCAM && !(player->pflags & PF_NIGHTSMODE) && player->mo->eflags & MFE_VERTICALFLIP);
|
||||
UINT16 postimgflags = 0;
|
||||
UINT8 i;
|
||||
UINT16 postimgtype = 0;
|
||||
|
||||
if (encoremode)
|
||||
postimgflags |= POSTIMG_MIRROR;
|
||||
postimgtype |= POSTIMG_MIRROR;
|
||||
if (flipcam)
|
||||
postimgflags |= POSTIMG_FLIP;
|
||||
postimgtype |= POSTIMG_FLIP;
|
||||
|
||||
#ifdef HWRENDER
|
||||
if (rendermode == render_opengl && splitscreen)
|
||||
{
|
||||
thiscam->postimg = postimgtype;
|
||||
return;
|
||||
}
|
||||
#endif
|
||||
|
||||
if (player->awayviewtics && player->awayviewmobj && !P_MobjWasRemoved(player->awayviewmobj)) // Camera must obviously exist
|
||||
{
|
||||
@@ -3267,27 +3274,20 @@ static void P_CalcChasePostImg(player_t *player, camera_t *thiscam)
|
||||
|
||||
// Are we in water?
|
||||
if (P_CameraCheckWater(&dummycam))
|
||||
postimgflags |= POSTIMG_WATER;
|
||||
if (P_CameraCheckHeat(&dummycam))
|
||||
postimgflags |= POSTIMG_HEAT;
|
||||
postimgtype |= POSTIMG_WATER;
|
||||
else if (P_CameraCheckHeat(&dummycam))
|
||||
postimgtype |= POSTIMG_HEAT;
|
||||
}
|
||||
else
|
||||
{
|
||||
// Are we in water?
|
||||
if (P_CameraCheckWater(thiscam))
|
||||
postimgflags |= POSTIMG_WATER;
|
||||
if (P_CameraCheckHeat(thiscam))
|
||||
postimgflags |= POSTIMG_HEAT;
|
||||
postimgtype |= POSTIMG_WATER;
|
||||
else if (P_CameraCheckHeat(thiscam))
|
||||
postimgtype |= POSTIMG_HEAT;
|
||||
}
|
||||
|
||||
for (i = 0; i <= splitscreen; i++)
|
||||
{
|
||||
if (player != &players[displayplayers[i]])
|
||||
continue;
|
||||
|
||||
players[displayplayers[i]].postimgflags = postimgflags;
|
||||
break;
|
||||
}
|
||||
thiscam->postimg = postimgtype;
|
||||
}
|
||||
|
||||
// P_CameraThinker
|
||||
@@ -10634,7 +10634,6 @@ void P_SpawnPlayer(INT32 playernum)
|
||||
else if (!G_GametypeHasSpectators())
|
||||
{
|
||||
p->spectator = false;
|
||||
p->speccam = false;
|
||||
}
|
||||
else if (netgame && p->jointime <= 1 && pcount)
|
||||
{
|
||||
@@ -10669,7 +10668,6 @@ void P_SpawnPlayer(INT32 playernum)
|
||||
else // Otherwise, never spectator.
|
||||
{
|
||||
p->spectator = false;
|
||||
p->speccam = false;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
+107
-93
@@ -2105,7 +2105,7 @@ static void P_SpectatorMovement(player_t *player)
|
||||
{
|
||||
ticcmd_t *cmd = &player->cmd;
|
||||
|
||||
player->mo->angle = (cmd->angleturn<<16 /* not FRACBITS */);
|
||||
player->mo->angle = (angle_t)(cmd->angleturn<<16 /* not FRACBITS */);
|
||||
|
||||
ticruned++;
|
||||
if (!(cmd->angleturn & TICCMD_RECEIVED))
|
||||
@@ -2271,9 +2271,9 @@ static void P_MovePlayer(player_t *player)
|
||||
}
|
||||
}
|
||||
|
||||
// have to keep this crap for synch reasons
|
||||
if (player->spectator)
|
||||
{
|
||||
player->speccam = true;
|
||||
P_SpectatorMovement(player);
|
||||
return;
|
||||
}
|
||||
@@ -3140,7 +3140,9 @@ void P_ToggleDemoCamera(UINT8 viewnum)
|
||||
|
||||
// dont let freecam be toggled when in spec lel
|
||||
if (players[displayplayers[viewnum]].spectator)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
if (!cam->freecam) // toggle on
|
||||
{
|
||||
@@ -3313,6 +3315,9 @@ static void P_DemoCameraMovement(camera_t *cam, UINT8 num)
|
||||
const UINT8 forplayer = num+1;
|
||||
boolean moving = false;
|
||||
|
||||
if (encoremode)
|
||||
cam->postimg |= POSTIMG_MIRROR;
|
||||
|
||||
cam->localangle = cam->angle;
|
||||
cam->localaiming = cam->aiming;
|
||||
|
||||
@@ -3321,13 +3326,14 @@ static void P_DemoCameraMovement(camera_t *cam, UINT8 num)
|
||||
|
||||
// let centerview work proper
|
||||
if (InputDown(gc_centerview, forplayer))
|
||||
{
|
||||
cam->aiming = 0;
|
||||
cam->reset_aiming = false;
|
||||
}
|
||||
|
||||
if (cmd->aiming != 0)
|
||||
{
|
||||
cam->aiming = cmd->aiming << FRACBITS;
|
||||
|
||||
cam->reset_aiming = false;
|
||||
}
|
||||
|
||||
cam->angle = cmd->angleturn << 16;
|
||||
@@ -3359,17 +3365,14 @@ static void P_DemoCameraMovement(camera_t *cam, UINT8 num)
|
||||
|
||||
// if you hold item, you will lock on to displayplayer. (The last player you were ""f12-ing"")
|
||||
// well this only really works in replays for us, since we still move our spec player around which causes displayplayer to be the spec player
|
||||
if (demo.playback)
|
||||
if (cam->freecam && cmd->buttons & BT_ATTACK)
|
||||
{
|
||||
if (cmd->buttons & BT_ATTACK)
|
||||
{
|
||||
lastp = &players[displayplayers[0]]; // Fun fact, I was trying displayplayers[0]->mo as if it was Lua like an absolute idiot.
|
||||
lastp = &players[displayplayers[0]]; // Fun fact, I was trying displayplayers[0]->mo as if it was Lua like an absolute idiot.
|
||||
|
||||
const fixed_t dist = R_PointToDist2(cam->x, cam->y, lastp->mo->x, lastp->mo->y);
|
||||
cam->angle = R_PointToAngle2(cam->x, cam->y, lastp->mo->x, lastp->mo->y);
|
||||
cam->aiming = R_PointToAngle2(0, cam->z, dist, lastp->mo->z + lastp->mo->scale*128*P_MobjFlip(lastp->mo)); // This is still unholy. Aim a bit above their heads.
|
||||
cam->reset_aiming = false;
|
||||
}
|
||||
const fixed_t dist = R_PointToDist2(cam->x, cam->y, lastp->mo->x, lastp->mo->y);
|
||||
cam->angle = R_PointToAngle2(cam->x, cam->y, lastp->mo->x, lastp->mo->y);
|
||||
cam->aiming = R_PointToAngle2(0, cam->z, dist, lastp->mo->z + lastp->mo->scale*128*P_MobjFlip(lastp->mo)); // This is still unholy. Aim a bit above their heads.
|
||||
cam->reset_aiming = false;
|
||||
}
|
||||
|
||||
if (cmd->forwardmove != 0)
|
||||
@@ -3720,7 +3723,7 @@ boolean P_MoveChaseCamera(player_t *player, camera_t *thiscam, boolean resetcall
|
||||
num = 0;
|
||||
}
|
||||
|
||||
if (thiscam->freecam || (player->spectator && player->speccam == true))
|
||||
if (thiscam->freecam || player->spectator)
|
||||
{
|
||||
P_DemoCameraMovement(thiscam, num);
|
||||
return true;
|
||||
@@ -4100,7 +4103,6 @@ boolean P_SpectatorJoinGame(player_t *player)
|
||||
player->mo = NULL;
|
||||
}
|
||||
player->spectator = false;
|
||||
player->speccam = false;
|
||||
player->pflags &= ~PF_WANTSTOJOIN;
|
||||
player->kartstuff[k_spectatewait] = 0;
|
||||
player->ctfteam = changeto;
|
||||
@@ -4129,7 +4131,6 @@ boolean P_SpectatorJoinGame(player_t *player)
|
||||
player->mo = NULL;
|
||||
}
|
||||
player->spectator = false;
|
||||
player->speccam = false;
|
||||
player->pflags &= ~PF_WANTSTOJOIN;
|
||||
player->kartstuff[k_spectatewait] = 0;
|
||||
player->playerstate = PST_REBORN;
|
||||
@@ -4147,14 +4148,90 @@ boolean P_SpectatorJoinGame(player_t *player)
|
||||
return false;
|
||||
}
|
||||
|
||||
// the below is first person only, if you're curious. check out P_CalcChasePostImg in p_mobj.c for chasecam
|
||||
static void P_CalcPostImg(player_t *player)
|
||||
static boolean P_CameraCheckHeatFirstperson(player_t *player, sector_t *sector, fixed_t pviewheight)
|
||||
{
|
||||
sector_t *sector = player->mo->subsector->sector;
|
||||
INT16 typeflag = 0;
|
||||
if (P_FindSpecialLineFromTag(13, sector->tag, -1) != -1)
|
||||
return true;
|
||||
|
||||
if (sector->ffloors)
|
||||
{
|
||||
ffloor_t *rover;
|
||||
|
||||
for (rover = sector->ffloors; rover; rover = rover->next)
|
||||
{
|
||||
if (!(rover->flags & FF_EXISTS))
|
||||
continue;
|
||||
|
||||
if (pviewheight >= P_GetFFloorTopZAt(rover, player->mo->x, player->mo->y))
|
||||
continue;
|
||||
|
||||
if (pviewheight <= P_GetFFloorBottomZAt(rover, player->mo->x, player->mo->y))
|
||||
continue;
|
||||
|
||||
if (P_FindSpecialLineFromTag(13, rover->master->frontsector->tag, -1) != -1)
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
static boolean P_CameraCheckWaterFirstperson(player_t *player, sector_t *sector, fixed_t pviewheight)
|
||||
{
|
||||
if (sector->ffloors)
|
||||
{
|
||||
ffloor_t *rover;
|
||||
|
||||
for (rover = sector->ffloors; rover; rover = rover->next)
|
||||
{
|
||||
if (!(rover->flags & FF_EXISTS) || !(rover->flags & FF_SWIMMABLE) || rover->flags & FF_BLOCKPLAYER)
|
||||
continue;
|
||||
|
||||
if (pviewheight >= P_GetFFloorTopZAt(rover, player->mo->x, player->mo->y))
|
||||
continue;
|
||||
|
||||
if (pviewheight <= P_GetFFloorBottomZAt(rover, player->mo->x, player->mo->y))
|
||||
continue;
|
||||
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
// the below is first person only, if you're curious. check out P_CalcChasePostImg in p_mobj.c for chasecam
|
||||
static void P_CalcPostImg(player_t *player, camera_t *thiscam)
|
||||
{
|
||||
sector_t *sector = NULL;
|
||||
INT16 postimgtype = 0;
|
||||
//INT32 *param;
|
||||
fixed_t pviewheight;
|
||||
UINT8 i;
|
||||
fixed_t pviewheight = 0;
|
||||
|
||||
/*for (i = 0; i <= splitscreen; i++)
|
||||
{
|
||||
if (player == &players[displayplayers[i]])
|
||||
{
|
||||
param = &postimgparam[i];
|
||||
break;
|
||||
}
|
||||
}*/
|
||||
|
||||
if (encoremode) // srb2kart
|
||||
postimgtype |= POSTIMG_MIRROR;
|
||||
|
||||
if (player->mo->eflags & MFE_VERTICALFLIP)
|
||||
postimgtype |= POSTIMG_FLIP;
|
||||
|
||||
#ifdef HWRENDER
|
||||
if (rendermode == render_opengl && splitscreen)
|
||||
{
|
||||
thiscam->postimg = postimgtype;
|
||||
return;
|
||||
}
|
||||
#endif
|
||||
|
||||
sector = player->mo->subsector->sector;
|
||||
|
||||
if (player->mo->eflags & MFE_VERTICALFLIP)
|
||||
pviewheight = player->mo->z + player->mo->height - player->viewheight;
|
||||
@@ -4167,88 +4244,25 @@ static void P_CalcPostImg(player_t *player)
|
||||
pviewheight = player->awayviewmobj->z + 20*FRACUNIT;
|
||||
}
|
||||
|
||||
/*for (i = 0; i <= splitscreen; i++)
|
||||
{
|
||||
if (player == &players[displayplayers[i]])
|
||||
{
|
||||
param = &postimgparam[i];
|
||||
break;
|
||||
}
|
||||
}*/
|
||||
|
||||
// see if we are in heat (no, not THAT kind of heat...)
|
||||
|
||||
if (P_FindSpecialLineFromTag(13, sector->tag, -1) != -1)
|
||||
typeflag |= POSTIMG_HEAT;
|
||||
else if (sector->ffloors)
|
||||
{
|
||||
ffloor_t *rover;
|
||||
fixed_t topheight;
|
||||
fixed_t bottomheight;
|
||||
|
||||
for (rover = sector->ffloors; rover; rover = rover->next)
|
||||
{
|
||||
if (!(rover->flags & FF_EXISTS))
|
||||
continue;
|
||||
|
||||
topheight = *rover->t_slope ? P_GetZAt(*rover->t_slope, player->mo->x, player->mo->y) : *rover->topheight;
|
||||
bottomheight = *rover->b_slope ? P_GetZAt(*rover->b_slope, player->mo->x, player->mo->y) : *rover->bottomheight;
|
||||
|
||||
if (pviewheight >= topheight || pviewheight <= bottomheight)
|
||||
continue;
|
||||
|
||||
if (P_FindSpecialLineFromTag(13, rover->master->frontsector->tag, -1) != -1)
|
||||
typeflag |= POSTIMG_HEAT;
|
||||
}
|
||||
}
|
||||
|
||||
// see if we are in water (water trumps heat)
|
||||
if (sector->ffloors)
|
||||
{
|
||||
ffloor_t *rover;
|
||||
fixed_t topheight;
|
||||
fixed_t bottomheight;
|
||||
|
||||
for (rover = sector->ffloors; rover; rover = rover->next)
|
||||
{
|
||||
if (!(rover->flags & FF_EXISTS) || !(rover->flags & FF_SWIMMABLE) || rover->flags & FF_BLOCKPLAYER)
|
||||
continue;
|
||||
|
||||
topheight = *rover->t_slope ? P_GetZAt(*rover->t_slope, player->mo->x, player->mo->y) : *rover->topheight;
|
||||
bottomheight = *rover->b_slope ? P_GetZAt(*rover->b_slope, player->mo->x, player->mo->y) : *rover->bottomheight;
|
||||
|
||||
if (pviewheight >= topheight || pviewheight <= bottomheight)
|
||||
continue;
|
||||
|
||||
typeflag |= POSTIMG_WATER;
|
||||
}
|
||||
}
|
||||
|
||||
if (encoremode) // srb2kart
|
||||
typeflag |= POSTIMG_MIRROR;
|
||||
|
||||
if (player->mo->eflags & MFE_VERTICALFLIP)
|
||||
typeflag |= POSTIMG_FLIP;
|
||||
if (P_CameraCheckWaterFirstperson(player, sector, pviewheight))
|
||||
postimgtype |= POSTIMG_WATER;
|
||||
// see if we are in heat (no, not THAT kind of heat...)
|
||||
else if (P_CameraCheckHeatFirstperson(player, sector, pviewheight))
|
||||
postimgtype |= POSTIMG_HEAT;
|
||||
|
||||
// Motion blur
|
||||
// unused
|
||||
/*if (player->speed > (35<<FRACBITS))
|
||||
{
|
||||
typeflag |= POSTIMG_MOTION;
|
||||
postimgtype |= POSTIMG_MOTION;
|
||||
*param = (player->speed - 32)/4;
|
||||
|
||||
if (*param > 5)
|
||||
*param = 5;
|
||||
}*/
|
||||
|
||||
for (i = 0; i <= splitscreen; i++)
|
||||
{
|
||||
if (player != &players[displayplayers[i]])
|
||||
continue;
|
||||
|
||||
players[displayplayers[i]].postimgflags = typeflag;
|
||||
break;
|
||||
}
|
||||
thiscam->postimg = postimgtype;
|
||||
}
|
||||
|
||||
void P_DoTimeOver(player_t *player)
|
||||
@@ -5031,7 +5045,7 @@ void P_PlayerAfterThink(player_t *player)
|
||||
if (!thiscam->chase) // bob view only if looking through the player's eyes
|
||||
{
|
||||
P_CalcHeight(player);
|
||||
P_CalcPostImg(player);
|
||||
P_CalcPostImg(player, thiscam);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
+23
-22
@@ -3175,7 +3175,7 @@ INT32 heatindex[MAXSPLITSCREENPLAYERS] = {0, 0, 0, 0};
|
||||
// Perform a particular image postprocessing function.
|
||||
//
|
||||
|
||||
void V_DoPostProcessor(INT32 view, player_t *player, INT32 param)
|
||||
void V_DoPostProcessor(INT32 view, INT32 param)
|
||||
{
|
||||
#if NUMSCREENS < 5
|
||||
// do not enable image post processing for ARM, SH and MIPS CPUs
|
||||
@@ -3194,7 +3194,9 @@ void V_DoPostProcessor(INT32 view, player_t *player, INT32 param)
|
||||
if (view < 0 || view > 3 || view > splitscreen)
|
||||
return;
|
||||
|
||||
if (!player->postimgflags)
|
||||
camera_t *thiscam = &camera[view];
|
||||
|
||||
if (!thiscam->postimg)
|
||||
return;
|
||||
|
||||
if ((view == 1 && splitscreen == 1) || view >= 2)
|
||||
@@ -3210,7 +3212,7 @@ void V_DoPostProcessor(INT32 view, player_t *player, INT32 param)
|
||||
UINT8 *tmpscr = screens[4];
|
||||
UINT8 *srcscr = screens[0];
|
||||
|
||||
if (player->postimgflags & POSTIMG_WATER)
|
||||
if (thiscam->postimg & POSTIMG_WATER)
|
||||
{
|
||||
INT32 y;
|
||||
// Set disStart to a range from 0 to FINEANGLE, incrementing by 128 per tic
|
||||
@@ -3269,22 +3271,7 @@ void V_DoPostProcessor(INT32 view, player_t *player, INT32 param)
|
||||
tmpscr = srcscr;
|
||||
srcscr = tmp;
|
||||
}
|
||||
|
||||
/*if (player->postimgflags & POSTIMG_MOTION) // Motion Blur!
|
||||
{
|
||||
INT32 x, y;
|
||||
|
||||
// TODO: Add a postimg_param so that we can pick the translucency level...
|
||||
UINT8 *transme = transtables + ((param-1)<<FF_TRANSSHIFT);
|
||||
|
||||
for (y = yoffset; y < yoffset+viewheight; y++)
|
||||
{
|
||||
for (x = xoffset; x < xoffset+viewwidth; x++)
|
||||
tmpscr[y*vid.width + x] = colormaps[*(transme + (srcscr [(y*vid.width)+x ] <<8) + (tmpscr[(y*vid.width)+x]))];
|
||||
}
|
||||
}*/
|
||||
|
||||
if (player->postimgflags & POSTIMG_HEAT) // Heat wave
|
||||
else if (thiscam->postimg & POSTIMG_HEAT) // Heat wave
|
||||
{
|
||||
INT32 y;
|
||||
|
||||
@@ -3331,7 +3318,21 @@ void V_DoPostProcessor(INT32 view, player_t *player, INT32 param)
|
||||
srcscr = tmp;
|
||||
}
|
||||
|
||||
if ((player->postimgflags & POSTIMG_FLIP) && !(player->postimgflags & POSTIMG_MIRROR)) // Flip the screen upside-down
|
||||
/*if (thiscam->postimg & POSTIMG_MOTION) // Motion Blur!
|
||||
{
|
||||
INT32 x, y;
|
||||
|
||||
// TODO: Add a postimg_param so that we can pick the translucency level...
|
||||
UINT8 *transme = transtables + ((param-1)<<FF_TRANSSHIFT);
|
||||
|
||||
for (y = yoffset; y < yoffset+viewheight; y++)
|
||||
{
|
||||
for (x = xoffset; x < xoffset+viewwidth; x++)
|
||||
tmpscr[y*vid.width + x] = colormaps[*(transme + (srcscr [(y*vid.width)+x ] <<8) + (tmpscr[(y*vid.width)+x]))];
|
||||
}
|
||||
}*/
|
||||
|
||||
if ((thiscam->postimg & POSTIMG_FLIP) && !(thiscam->postimg & POSTIMG_MIRROR)) // Flip the screen upside-down
|
||||
{
|
||||
INT32 y, y2;
|
||||
|
||||
@@ -3342,7 +3343,7 @@ void V_DoPostProcessor(INT32 view, player_t *player, INT32 param)
|
||||
tmpscr = srcscr;
|
||||
srcscr = tmp;
|
||||
}
|
||||
else if ((player->postimgflags & POSTIMG_MIRROR) && !(player->postimgflags & POSTIMG_FLIP)) // Flip the screen on the x axis
|
||||
else if ((thiscam->postimg & POSTIMG_MIRROR) && !(thiscam->postimg & POSTIMG_FLIP)) // Flip the screen on the x axis
|
||||
{
|
||||
INT32 y, x, x2;
|
||||
|
||||
@@ -3354,7 +3355,7 @@ void V_DoPostProcessor(INT32 view, player_t *player, INT32 param)
|
||||
tmpscr = srcscr;
|
||||
srcscr = tmp;
|
||||
}
|
||||
else if ((player->postimgflags & POSTIMG_MIRROR) && (player->postimgflags & POSTIMG_FLIP)) // Flip the screen upside-down and on the x axis
|
||||
else if ((thiscam->postimg & POSTIMG_MIRROR) && (thiscam->postimg & POSTIMG_FLIP)) // Flip the screen upside-down and on the x axis
|
||||
{
|
||||
INT32 y, x;
|
||||
|
||||
|
||||
+1
-1
@@ -256,7 +256,7 @@ char V_GetSkincolorChar(INT32 color);
|
||||
|
||||
typedef struct player_s player_t;
|
||||
|
||||
void V_DoPostProcessor(INT32 view, player_t *player, INT32 param);
|
||||
void V_DoPostProcessor(INT32 view, INT32 param);
|
||||
|
||||
void V_DrawPatchFill(patch_t *pat);
|
||||
|
||||
|
||||
Reference in new issue
Block a user