mirror of
https://github.com/KartKrewDev/RingRacers.git
synced 2025-12-11 18:42:46 +00:00
Allow switching lockon targets with turn buttons
This commit is contained in:
parent
4e8bf7a226
commit
2dc21fa343
2 changed files with 22 additions and 1 deletions
21
src/g_game.c
21
src/g_game.c
|
|
@ -1057,6 +1057,7 @@ void G_BuildTiccmd(ticcmd_t *cmd, INT32 realtics, UINT8 ssplayer)
|
||||||
static boolean keyboard_look[2]; // true if lookup/down using keyboard
|
static boolean keyboard_look[2]; // true if lookup/down using keyboard
|
||||||
static boolean resetdown[2]; // don't cam reset every frame
|
static boolean resetdown[2]; // don't cam reset every frame
|
||||||
static boolean joyaiming[2]; // check the last frame's value if we need to reset the camera
|
static boolean joyaiming[2]; // check the last frame's value if we need to reset the camera
|
||||||
|
static boolean zchange[2]; // only switch z targets once per press
|
||||||
UINT8 forplayer = ssplayer-1;
|
UINT8 forplayer = ssplayer-1;
|
||||||
|
|
||||||
if (ssplayer == 1)
|
if (ssplayer == 1)
|
||||||
|
|
@ -1322,6 +1323,26 @@ void G_BuildTiccmd(ticcmd_t *cmd, INT32 realtics, UINT8 ssplayer)
|
||||||
P_SetTarget(&ticcmd_ztargetfocus[forplayer], NULL);
|
P_SetTarget(&ticcmd_ztargetfocus[forplayer], NULL);
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
mobj_t *newtarget = NULL;
|
||||||
|
if (zchange[forplayer])
|
||||||
|
{
|
||||||
|
if (!turnleft && !turnright && abs(cmd->angleturn) < angleturn[0])
|
||||||
|
zchange[forplayer] = false;
|
||||||
|
}
|
||||||
|
else if (turnleft || cmd->angleturn > angleturn[0])
|
||||||
|
{
|
||||||
|
zchange[forplayer] = true;
|
||||||
|
newtarget = P_LookForFocusTarget(player, ticcmd_ztargetfocus[forplayer], 1, cv_cam_lockonboss[forplayer].value);
|
||||||
|
}
|
||||||
|
else if (turnright || cmd->angleturn < -angleturn[0])
|
||||||
|
{
|
||||||
|
zchange[forplayer] = true;
|
||||||
|
newtarget = P_LookForFocusTarget(player, ticcmd_ztargetfocus[forplayer], -1, cv_cam_lockonboss[forplayer].value);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (newtarget)
|
||||||
|
P_SetTarget(&ticcmd_ztargetfocus[forplayer], newtarget);
|
||||||
|
|
||||||
if (P_AproxDistance(
|
if (P_AproxDistance(
|
||||||
player->mo->x - ticcmd_ztargetfocus[forplayer]->x,
|
player->mo->x - ticcmd_ztargetfocus[forplayer]->x,
|
||||||
player->mo->y - ticcmd_ztargetfocus[forplayer]->y
|
player->mo->y - ticcmd_ztargetfocus[forplayer]->y
|
||||||
|
|
|
||||||
|
|
@ -9162,7 +9162,7 @@ mobj_t *P_LookForFocusTarget(player_t *player, mobj_t *exclude, SINT8 direction,
|
||||||
if (mo->flags & MF_NOCLIPTHING)
|
if (mo->flags & MF_NOCLIPTHING)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
if (mo == player->mo)
|
if (mo == player->mo || mo == exclude)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
if (mo->health <= 0) // dead
|
if (mo->health <= 0) // dead
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue