From a797e88bb95a0936f32a6e40db575ccd8f68d106 Mon Sep 17 00:00:00 2001 From: MonsterIestyn Date: Fri, 20 Feb 2015 13:00:40 +0000 Subject: [PATCH] Red's last commit should have been using "pgl", not "gl" for function name prefixes, so the compiler would be happy. Also, more simplicity in my camera code please! Simplified some of the checks for whether a camera should chase or not etc git-svn-id: https://code.orospakr.ca/svn/srb2/trunk@9046 6de4a73c-47e2-0310-b8c1-93d6ecd3f8cd --- src/hardware/r_opengl/r_opengl.c | 4 ++-- src/p_user.c | 28 ++++++++++++++-------------- src/r_main.c | 32 +++++++++++++------------------- 3 files changed, 29 insertions(+), 35 deletions(-) diff --git a/src/hardware/r_opengl/r_opengl.c b/src/hardware/r_opengl/r_opengl.c index 72600961..d14324c3 100644 --- a/src/hardware/r_opengl/r_opengl.c +++ b/src/hardware/r_opengl/r_opengl.c @@ -1913,8 +1913,8 @@ EXPORT void HWRAPI(DrawMD2i) (INT32 *gl_cmd_buffer, md2_frame_t *frame, UINT32 d // Remove depth mask when the model is transparent so it doesn't cut thorugh sprites // SRB2CBTODO: For all stuff too?! if (color[3] < 255) { - glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); // alpha = level of transparency - glDepthMask(GL_FALSE); + pglBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); // alpha = level of transparency + pglDepthMask(GL_FALSE); } val = *gl_cmd_buffer++; diff --git a/src/p_user.c b/src/p_user.c index 45e66142..6270d789 100644 --- a/src/p_user.c +++ b/src/p_user.c @@ -7783,24 +7783,24 @@ boolean P_MoveChaseCamera(player_t *player, camera_t *thiscam, boolean resetcall angle_t angle = 0, focusangle = 0, focusaiming = 0; fixed_t x, y, z, dist, checkdist, viewpointx, viewpointy, camspeed, camdist, camheight, pviewheight; INT32 camrotate; - boolean camstill, forceon = false, cameranoclip; + boolean camstill, cameranoclip; mobj_t *mo; subsector_t *newsubsec; fixed_t f1, f2; cameranoclip = (player->pflags & (PF_NOCLIP|PF_NIGHTSMODE)) || (player->mo->flags & (MF_NOCLIP|MF_NOCLIPHEIGHT)); // Noclipping player camera noclips too!! - if (player->climbing || (player->pflags & PF_NIGHTSMODE) || player->playerstate == PST_DEAD) - forceon = true; + if (!(player->climbing || (player->pflags & PF_NIGHTSMODE) || player->playerstate == PST_DEAD)) + { + if (player->spectator) // force cam off for spectators + return true; - if (!forceon && player->spectator) // force cam off for spectators - return true; + if (!cv_chasecam.value && thiscam == &camera) + return true; - if (!forceon && !cv_chasecam.value && thiscam == &camera) - return true; - - if (!forceon && !cv_chasecam2.value && thiscam == &camera2) - return true; + if (!cv_chasecam2.value && thiscam == &camera2) + return true; + } if (!thiscam->chase && !resetcalled) { @@ -9091,7 +9091,7 @@ void P_PlayerAfterThink(player_t *player) { ticcmd_t *cmd; INT32 oldweapon = player->currentweapon; - camera_t *thiscam; + camera_t *thiscam = NULL; // if not one of the displayed players, just don't bother #ifdef PARANOIA if (!player->mo) @@ -9105,7 +9105,7 @@ void P_PlayerAfterThink(player_t *player) if (splitscreen && player == &players[secondarydisplayplayer]) thiscam = &camera2; - else + else if (player == &players[displayplayer]) thiscam = &camera; if (player->playerstate == PST_DEAD) @@ -9113,7 +9113,7 @@ void P_PlayerAfterThink(player_t *player) // camera may still move when guy is dead //if (!netgame) { - if (((splitscreen && player == &players[secondarydisplayplayer]) || player == &players[displayplayer]) && thiscam->chase) + if (thiscam && thiscam->chase) P_MoveChaseCamera(player, thiscam, false); } return; @@ -9368,7 +9368,7 @@ void P_PlayerAfterThink(player_t *player) } } - if ((splitscreen && player == &players[secondarydisplayplayer]) || player == &players[displayplayer]) + if (thiscam) { if (!thiscam->chase) // bob view only if looking through the player's eyes { diff --git a/src/r_main.c b/src/r_main.c index ffd4d5d5..1edcb815 100644 --- a/src/r_main.c +++ b/src/r_main.c @@ -1026,34 +1026,31 @@ void R_SetupFrame(player_t *player, boolean skybox) { INT32 dy = 0; camera_t *thiscam; - boolean forcechase = false; + boolean chasecam = false; if (splitscreen && player == &players[secondarydisplayplayer] && player != &players[consoleplayer]) { thiscam = &camera2; + chasecam = (cv_chasecam2.value != 0); } else + { thiscam = &camera; + chasecam = (cv_chasecam.value != 0); + } if (player->climbing || (player->pflags & PF_NIGHTSMODE) || player->playerstate == PST_DEAD) - forcechase = true; + chasecam = true; // force chasecam on + else if (player->spectator) // no spectator chasecam + chasecam = false; // force chasecam off - if (!forcechase && player->spectator) // no spectator chasecam - thiscam->chase = false; - else if ((cv_chasecam.value || forcechase) && !player->spectator && thiscam == &camera && !thiscam->chase) + if (chasecam && !thiscam->chase) { - P_ResetCamera(player, &camera); + P_ResetCamera(player, thiscam); thiscam->chase = true; } - else if ((cv_chasecam2.value || forcechase) && !player->spectator && thiscam == &camera2 && !thiscam->chase) - { - P_ResetCamera(player, &camera2); - thiscam->chase = true; - } - else if (!(cv_chasecam.value || forcechase) && thiscam == &camera) - thiscam->chase = false; - else if (!(cv_chasecam2.value || forcechase) && thiscam == &camera2) + else if (!chasecam) thiscam->chase = false; viewsky = !skybox; @@ -1066,9 +1063,7 @@ void R_SetupFrame(player_t *player, boolean skybox) aimingangle = player->awayviewaiming; viewangle = viewmobj->angle; } - else if (!player->spectator && (forcechase - || (cv_chasecam.value && thiscam == &camera) - || (cv_chasecam2.value && thiscam == &camera2))) + else if (!player->spectator && chasecam) // use outside cam view { viewmobj = NULL; @@ -1105,8 +1100,7 @@ void R_SetupFrame(player_t *player, boolean skybox) viewplayer = player; - if ((forcechase || (cv_chasecam.value && thiscam == &camera) || (cv_chasecam2.value && thiscam == &camera2)) - && !player->awayviewtics && !player->spectator) + if (chasecam && !player->awayviewtics && !player->spectator) { viewx = thiscam->x; viewy = thiscam->y;