mirror of
https://git.do.srb2.org/KartKrew/Kart-Public.git
synced 2025-01-13 05:11:01 +00:00
Cam lockon, allow viewpoint change during freecam
This commit is contained in:
parent
cf64a468f5
commit
aad2401ba5
2 changed files with 14 additions and 1 deletions
|
@ -1871,7 +1871,7 @@ boolean G_Responder(event_t *ev)
|
|||
|
||||
// allow spy mode changes even during the demo
|
||||
if (gamestate == GS_LEVEL && ev->type == ev_keydown
|
||||
&& (ev->data1 == KEY_F12 || ev->data1 == gamecontrol[gc_viewpoint][0] || ev->data1 == gamecontrol[gc_viewpoint][1]) && !demo.freecam)
|
||||
&& (ev->data1 == KEY_F12 || ev->data1 == gamecontrol[gc_viewpoint][0] || ev->data1 == gamecontrol[gc_viewpoint][1]))
|
||||
{
|
||||
if (!demo.playback && (splitscreen || !netgame))
|
||||
displayplayers[0] = consoleplayer;
|
||||
|
|
13
src/p_user.c
13
src/p_user.c
|
@ -7314,6 +7314,10 @@ static ticcmd_t *P_CameraCmd(camera_t *cam)
|
|||
if (InputDown(gc_aimbackward, 1) || (usejoystick && axis > 0))
|
||||
forward -= forwardmove[1];
|
||||
|
||||
// fire with any button/key
|
||||
axis = JoyAxis(AXISFIRE, 1);
|
||||
if (InputDown(gc_fire, 1) || (usejoystick && axis > 0))
|
||||
cmd->buttons |= BT_ATTACK;
|
||||
|
||||
// spectator aiming shit, ahhhh...
|
||||
player_invert = invertmouse ? -1 : 1;
|
||||
|
@ -7380,6 +7384,7 @@ void P_DemoCameraMovement(camera_t *cam)
|
|||
ticcmd_t *cmd;
|
||||
angle_t thrustangle;
|
||||
mobj_t *awayviewmobj_hack;
|
||||
player_t *lastp;
|
||||
|
||||
// update democam stuff with what we got here:
|
||||
democam.cam = cam;
|
||||
|
@ -7399,6 +7404,14 @@ void P_DemoCameraMovement(camera_t *cam)
|
|||
else if (cmd->buttons & BT_BRAKE)
|
||||
cam->z -= 32*mapobjectscale;
|
||||
|
||||
// if you hold item, you will lock on to displayplayer. (The last player you were ""f12-ing"")
|
||||
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.
|
||||
cam->angle = R_PointToAngle2(cam->x, cam->y, lastp->mo->x, lastp->mo->y);
|
||||
cam->aiming = R_PointToAngle2(0, cam->z, R_PointToDist2(cam->x, cam->y, lastp->mo->x, lastp->mo->y), lastp->mo->z + lastp->mo->scale*128*P_MobjFlip(lastp->mo)); // This is still unholy. Aim a bit above their heads.
|
||||
}
|
||||
|
||||
|
||||
cam->momx = cam->momy = cam->momz = 0;
|
||||
if (cmd->forwardmove != 0)
|
||||
|
|
Loading…
Reference in a new issue