mirror of
https://git.do.srb2.org/STJr/SRB2.git
synced 2025-01-29 20:50:58 +00:00
Merge branch 'campokes' into 'master'
Camera pokes (resolves #359, #363, and #383). Closes #359, #363, and #383 See merge request STJr/SRB2Internal!566
This commit is contained in:
commit
2495e58bdb
3 changed files with 44 additions and 22 deletions
|
@ -323,6 +323,7 @@ SINT8 P_MobjFlip(mobj_t *mobj);
|
|||
fixed_t P_GetMobjGravity(mobj_t *mo);
|
||||
FUNCMATH boolean P_WeaponOrPanel(mobjtype_t type);
|
||||
|
||||
void P_CalcChasePostImg(player_t *player, camera_t *thiscam);
|
||||
boolean P_CameraThinker(player_t *player, camera_t *thiscam, boolean resetcalled);
|
||||
|
||||
void P_Attract(mobj_t *source, mobj_t *enemy, boolean nightsgrab);
|
||||
|
|
39
src/p_mobj.c
39
src/p_mobj.c
|
@ -3724,17 +3724,10 @@ void P_DestroyRobots(void)
|
|||
}
|
||||
}
|
||||
|
||||
// P_CameraThinker
|
||||
//
|
||||
// Process the mobj-ish required functions of the camera
|
||||
boolean P_CameraThinker(player_t *player, camera_t *thiscam, boolean resetcalled)
|
||||
// the below is chasecam only, if you're curious. check out P_CalcPostImg in p_user.c for first person
|
||||
void P_CalcChasePostImg(player_t *player, camera_t *thiscam)
|
||||
{
|
||||
boolean itsatwodlevel = false;
|
||||
postimg_t postimg = postimg_none;
|
||||
if (twodlevel
|
||||
|| (thiscam == &camera && players[displayplayer].mo && (players[displayplayer].mo->flags2 & MF2_TWOD))
|
||||
|| (thiscam == &camera2 && players[secondarydisplayplayer].mo && (players[secondarydisplayplayer].mo->flags2 & MF2_TWOD)))
|
||||
itsatwodlevel = true;
|
||||
|
||||
if (player->pflags & PF_FLIPCAM && !(player->powers[pw_carry] == CR_NIGHTSMODE) && player->mo->eflags & MFE_VERTICALFLIP)
|
||||
postimg = postimg_flip;
|
||||
|
@ -3762,13 +3755,27 @@ boolean P_CameraThinker(player_t *player, camera_t *thiscam, boolean resetcalled
|
|||
postimg = postimg_heat;
|
||||
}
|
||||
|
||||
if (postimg != postimg_none)
|
||||
{
|
||||
if (splitscreen && player == &players[secondarydisplayplayer])
|
||||
postimgtype2 = postimg;
|
||||
else
|
||||
postimgtype = postimg;
|
||||
}
|
||||
if (postimg == postimg_none)
|
||||
return;
|
||||
|
||||
if (splitscreen && player == &players[secondarydisplayplayer])
|
||||
postimgtype2 = postimg;
|
||||
else
|
||||
postimgtype = postimg;
|
||||
}
|
||||
|
||||
// P_CameraThinker
|
||||
//
|
||||
// Process the mobj-ish required functions of the camera
|
||||
boolean P_CameraThinker(player_t *player, camera_t *thiscam, boolean resetcalled)
|
||||
{
|
||||
boolean itsatwodlevel = false;
|
||||
if (twodlevel
|
||||
|| (thiscam == &camera && players[displayplayer].mo && (players[displayplayer].mo->flags2 & MF2_TWOD))
|
||||
|| (thiscam == &camera2 && players[secondarydisplayplayer].mo && (players[secondarydisplayplayer].mo->flags2 & MF2_TWOD)))
|
||||
itsatwodlevel = true;
|
||||
|
||||
P_CalcChasePostImg(player, thiscam);
|
||||
|
||||
if (thiscam->momx || thiscam->momy)
|
||||
{
|
||||
|
|
26
src/p_user.c
26
src/p_user.c
|
@ -9669,11 +9669,17 @@ boolean P_MoveChaseCamera(player_t *player, camera_t *thiscam, boolean resetcall
|
|||
fixed_t f1, f2;
|
||||
|
||||
// We probably shouldn't move the camera if there is no player or player mobj somehow
|
||||
if (!player || !player->mo || player->playerstate == PST_REBORN)
|
||||
if (!player || !player->mo)
|
||||
return true;
|
||||
|
||||
mo = player->mo;
|
||||
|
||||
if (player->playerstate == PST_REBORN)
|
||||
{
|
||||
P_CalcChasePostImg(player, thiscam);
|
||||
return true;
|
||||
}
|
||||
|
||||
if (player->exiting)
|
||||
{
|
||||
if (mo->target && mo->target->type == MT_SIGN && mo->target->spawnpoint
|
||||
|
@ -9682,7 +9688,10 @@ boolean P_MoveChaseCamera(player_t *player, camera_t *thiscam, boolean resetcall
|
|||
else if ((player->powers[pw_carry] == CR_NIGHTSMODE)
|
||||
&& !(player->mo->state >= &states[S_PLAY_NIGHTS_TRANS1]
|
||||
&& player->mo->state <= &states[S_PLAY_NIGHTS_TRANS6]))
|
||||
{
|
||||
P_CalcChasePostImg(player, thiscam);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
cameranoclip = (player->powers[pw_carry] == CR_NIGHTSMODE || player->pflags & PF_NOCLIP) || (mo->flags & (MF_NOCLIP|MF_NOCLIPHEIGHT)); // Noclipping player camera noclips too!!
|
||||
|
@ -9763,7 +9772,7 @@ boolean P_MoveChaseCamera(player_t *player, camera_t *thiscam, boolean resetcall
|
|||
camorbit = (!stricmp(cv_cam_orbit.defaultvalue, "off")) ? false : true;
|
||||
camrotate = atoi(cv_cam_rotate.defaultvalue);
|
||||
camdist = FixedMul((INT32)(atof(cv_cam_dist.defaultvalue) * FRACUNIT), mo->scale);
|
||||
camheight = FixedMul((INT32)(atof(cv_cam_height.defaultvalue) * FRACUNIT), FixedMul(player->camerascale, mo->scale));
|
||||
camheight = FixedMul((INT32)(atof(cv_cam_height.defaultvalue) * FRACUNIT), mo->scale);
|
||||
}
|
||||
else if (thiscam == &camera)
|
||||
{
|
||||
|
@ -9772,7 +9781,7 @@ boolean P_MoveChaseCamera(player_t *player, camera_t *thiscam, boolean resetcall
|
|||
camorbit = cv_cam_orbit.value;
|
||||
camrotate = cv_cam_rotate.value;
|
||||
camdist = FixedMul(cv_cam_dist.value, mo->scale);
|
||||
camheight = FixedMul(cv_cam_height.value, FixedMul(player->camerascale, mo->scale));
|
||||
camheight = FixedMul(cv_cam_height.value, mo->scale);
|
||||
}
|
||||
else // Camera 2
|
||||
{
|
||||
|
@ -9781,9 +9790,12 @@ boolean P_MoveChaseCamera(player_t *player, camera_t *thiscam, boolean resetcall
|
|||
camorbit = cv_cam2_orbit.value;
|
||||
camrotate = cv_cam2_rotate.value;
|
||||
camdist = FixedMul(cv_cam2_dist.value, mo->scale);
|
||||
camheight = FixedMul(cv_cam2_height.value, FixedMul(player->camerascale, mo->scale));
|
||||
camheight = FixedMul(cv_cam2_height.value, mo->scale);
|
||||
}
|
||||
|
||||
if (!(twodlevel || (mo->flags2 & MF2_TWOD)) && !(player->powers[pw_carry] == CR_NIGHTSMODE))
|
||||
camheight = FixedMul(camheight, player->camerascale);
|
||||
|
||||
#ifdef REDSANALOG
|
||||
if (P_AnalogMove(player) && (player->cmd.buttons & (BT_CAMLEFT|BT_CAMRIGHT)) == (BT_CAMLEFT|BT_CAMRIGHT)) {
|
||||
camstill = true;
|
||||
|
@ -9894,9 +9906,10 @@ boolean P_MoveChaseCamera(player_t *player, camera_t *thiscam, boolean resetcall
|
|||
dist <<= 1;
|
||||
}
|
||||
|
||||
if (!(twodlevel || (mo->flags2 & MF2_TWOD)) && !(player->powers[pw_carry] == CR_NIGHTSMODE))
|
||||
dist = FixedMul(dist, player->camerascale);
|
||||
|
||||
|
||||
checkdist = (dist = FixedMul(dist, player->camerascale));
|
||||
checkdist = dist;
|
||||
|
||||
if (checkdist < 128*FRACUNIT)
|
||||
checkdist = 128*FRACUNIT;
|
||||
|
@ -10419,6 +10432,7 @@ 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)
|
||||
{
|
||||
sector_t *sector = player->mo->subsector->sector;
|
||||
|
|
Loading…
Reference in a new issue