diff --git a/src/d_main.c b/src/d_main.c index 32b85fd7d..503357901 100644 --- a/src/d_main.c +++ b/src/d_main.c @@ -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]); } } diff --git a/src/d_player.h b/src/d_player.h index a34094572..6ddca1622 100644 --- a/src/d_player.h +++ b/src/d_player.h @@ -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; diff --git a/src/g_game.c b/src/g_game.c index 36dd9fd5f..efe5e6bae 100644 --- a/src/g_game.c +++ b/src/g_game.c @@ -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<>16, 50<>16}; static fixed_t sidemove[2] = {2<>16, 4<>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; diff --git a/src/hardware/hw_main.c b/src/hardware/hw_main.c index 87d4d046a..e1f5a509c 100644 --- a/src/hardware/hw_main.c +++ b/src/hardware/hw_main.c @@ -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; diff --git a/src/hardware/hw_main.h b/src/hardware/hw_main.h index 345c0e0a5..ef31be40c 100644 --- a/src/hardware/hw_main.h +++ b/src/hardware/hw_main.h @@ -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); diff --git a/src/hardware/hw_portal.c b/src/hardware/hw_portal.c index 27d77af2e..9bb5af40f 100644 --- a/src/hardware/hw_portal.c +++ b/src/hardware/hw_portal.c @@ -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); diff --git a/src/p_local.h b/src/p_local.h index ceb8cd535..205925907 100644 --- a/src/p_local.h +++ b/src/p_local.h @@ -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]; diff --git a/src/p_mobj.c b/src/p_mobj.c index a70ab5f91..d8d34b243 100644 --- a/src/p_mobj.c +++ b/src/p_mobj.c @@ -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; } } diff --git a/src/p_user.c b/src/p_user.c index 07a66075a..59edb7841 100644 --- a/src/p_user.c +++ b/src/p_user.c @@ -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<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 { diff --git a/src/v_video.c b/src/v_video.c index 987a40a03..da2b0677a 100644 --- a/src/v_video.c +++ b/src/v_video.c @@ -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)<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)<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; diff --git a/src/v_video.h b/src/v_video.h index dfab7dfde..2513825c2 100644 --- a/src/v_video.h +++ b/src/v_video.h @@ -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);