mirror of
https://github.com/ZDoom/raze-gles.git
synced 2024-12-28 20:40:47 +00:00
Duke3D: Process one_eighty_count (Turn-around key) at frame-rate.
This commit is contained in:
parent
5299a0625d
commit
2129d3b4e7
6 changed files with 37 additions and 33 deletions
|
@ -1304,23 +1304,6 @@ static int P_Submerge(int, DukePlayer_t *, int, int);
|
|||
static int P_Emerge(int, DukePlayer_t *, int, int);
|
||||
static void P_FinishWaterChange(int, DukePlayer_t *, int, int, int);
|
||||
|
||||
static fix16_t P_GetQ16AngleDeltaForTic(DukePlayer_t const *pPlayer)
|
||||
{
|
||||
auto oldAngle = pPlayer->oq16ang;
|
||||
auto newAngle = pPlayer->q16ang;
|
||||
|
||||
if (klabs(fix16_sub(oldAngle, newAngle)) < F16(1024))
|
||||
return fix16_sub(newAngle, oldAngle);
|
||||
|
||||
if (newAngle > F16(1024))
|
||||
newAngle = fix16_sub(newAngle, F16(2048));
|
||||
|
||||
if (oldAngle > F16(1024))
|
||||
oldAngle = fix16_sub(oldAngle, F16(2048));
|
||||
|
||||
return fix16_sub(newAngle, oldAngle);
|
||||
}
|
||||
|
||||
ACTOR_STATIC void G_MovePlayers(void)
|
||||
{
|
||||
int spriteNum = headspritestat[STAT_PLAYER];
|
||||
|
@ -1374,7 +1357,7 @@ ACTOR_STATIC void G_MovePlayers(void)
|
|||
if (G_TileHasActor(sprite[spriteNum].picnum))
|
||||
A_Execute(spriteNum, P_GetP(pSprite), otherPlayerDist);
|
||||
|
||||
pPlayer->q16angvel = P_GetQ16AngleDeltaForTic(pPlayer);
|
||||
pPlayer->q16angvel = G_GetQ16AngleDelta(pPlayer->oq16ang, pPlayer->q16ang);
|
||||
pPlayer->oq16ang = pPlayer->q16ang;
|
||||
pPlayer->oq16horiz = pPlayer->q16horiz;
|
||||
pPlayer->oq16horizoff = pPlayer->q16horizoff;
|
||||
|
|
|
@ -513,6 +513,20 @@ int __fastcall G_GetAngleDelta(int currAngle, int newAngle)
|
|||
return newAngle-currAngle;
|
||||
}
|
||||
|
||||
fix16_t __fastcall G_GetQ16AngleDelta(fix16_t oldAngle, fix16_t newAngle)
|
||||
{
|
||||
if (fix16_abs(fix16_sub(oldAngle, newAngle)) < fix16_from_int(1024))
|
||||
return fix16_sub(newAngle, oldAngle);
|
||||
|
||||
if (newAngle > fix16_from_int(1024))
|
||||
newAngle = fix16_sub(newAngle, fix16_from_int(2048));
|
||||
|
||||
if (oldAngle > fix16_from_int(1024))
|
||||
oldAngle = fix16_sub(oldAngle, fix16_from_int(2048));
|
||||
|
||||
return fix16_sub(newAngle, oldAngle);
|
||||
}
|
||||
|
||||
GAMEEXEC_STATIC void VM_AlterAng(int32_t const moveFlags)
|
||||
{
|
||||
int const elapsedTics = (AC_COUNT(vm.pData))&31;
|
||||
|
|
|
@ -86,6 +86,7 @@ void A_Fall(int spriteNum);
|
|||
int A_GetFurthestAngle(int const spriteNum, int const angDiv);
|
||||
void A_GetZLimits(int spriteNum);
|
||||
int __fastcall G_GetAngleDelta(int currAngle, int newAngle);
|
||||
fix16_t __fastcall G_GetQ16AngleDelta(fix16_t oldAngle, fix16_t newAngle);
|
||||
void G_RestoreMapState();
|
||||
void G_SaveMapState();
|
||||
|
||||
|
|
|
@ -26,6 +26,7 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
|||
#endif
|
||||
|
||||
#include "duke3d.h"
|
||||
#include "gameexec.h"
|
||||
#include "demo.h"
|
||||
//#include "sjson.h"
|
||||
#include "gamecvars.h"
|
||||
|
@ -3021,14 +3022,15 @@ enddisplayweapon:
|
|||
P_DisplaySpit();
|
||||
}
|
||||
|
||||
#define TURBOTURNTIME (TICRATE/8) // 7
|
||||
#define NORMALTURN 15
|
||||
#define PREAMBLETURN 5
|
||||
#define NORMALKEYMOVE 40
|
||||
#define MAXVEL ((NORMALKEYMOVE*2)+10)
|
||||
#define MAXSVEL ((NORMALKEYMOVE*2)+10)
|
||||
#define MAXANGVEL 1024
|
||||
#define MAXHORIZVEL 256
|
||||
#define TURBOTURNTIME (TICRATE/8) // 7
|
||||
#define NORMALTURN 15
|
||||
#define PREAMBLETURN 5
|
||||
#define NORMALKEYMOVE 40
|
||||
#define MAXVEL ((NORMALKEYMOVE*2)+10)
|
||||
#define MAXSVEL ((NORMALKEYMOVE*2)+10)
|
||||
#define MAXANGVEL 1024
|
||||
#define MAXHORIZVEL 256
|
||||
#define ONEEIGHTYSCALE 4
|
||||
|
||||
int32_t mouseyaxismode = -1;
|
||||
|
||||
|
@ -3352,6 +3354,12 @@ void P_GetInput(int const playerNum)
|
|||
pPlayer->q16look_ang = fix16_sadd(pPlayer->q16look_ang, fix16_from_dbl(scaleAdjustmentToInterval(152)));
|
||||
pPlayer->q16rotscrnang = fix16_ssub(pPlayer->q16rotscrnang, fix16_from_dbl(scaleAdjustmentToInterval(24)));
|
||||
}
|
||||
|
||||
if (pPlayer->one_eighty_count < 0)
|
||||
{
|
||||
pPlayer->one_eighty_count = -fix16_to_int(fix16_abs(G_GetQ16AngleDelta(pPlayer->one_eighty_target, pPlayer->q16ang)));
|
||||
pPlayer->q16ang = fix16_sadd(pPlayer->q16ang, fix16_max(fix16_one, fix16_from_dbl(scaleAdjustmentToInterval(-pPlayer->one_eighty_count / ONEEIGHTYSCALE)))) & 0x7FFFFFF;
|
||||
}
|
||||
}
|
||||
|
||||
// A horiz diff of 128 equal 45 degrees, so we convert horiz to 1024 angle units
|
||||
|
@ -5202,12 +5210,6 @@ void P_ProcessInput(int playerNum)
|
|||
|
||||
if (!ud.noclip)
|
||||
pushmove(&pPlayer->pos, &pPlayer->cursectnum, pPlayer->clipdist - 1, (4L<<8), stepHeight, CLIPMASK0);
|
||||
|
||||
if (pPlayer->one_eighty_count < 0)
|
||||
{
|
||||
pPlayer->one_eighty_count += 128;
|
||||
pPlayer->q16ang += F16(128);
|
||||
}
|
||||
|
||||
// Shrinking code
|
||||
|
||||
|
|
|
@ -176,6 +176,7 @@ typedef struct {
|
|||
int16_t random_club_frame, one_eighty_count;
|
||||
int16_t dummyplayersprite, extra_extra8;
|
||||
int16_t actorsqu, timebeforeexit, customexitsound, last_pissed_time;
|
||||
fix16_t one_eighty_target;
|
||||
|
||||
int16_t weaprecs[MAX_WEAPONS], weapon_sway, crack_time, bobcounter;
|
||||
|
||||
|
|
|
@ -3147,7 +3147,10 @@ CHECKINV1:
|
|||
|
||||
if (TEST_SYNC_KEY(playerBits, SK_TURNAROUND) && pPlayer->one_eighty_count == 0)
|
||||
if (VM_OnEvent(EVENT_TURNAROUND,pPlayer->i,playerNum) == 0)
|
||||
pPlayer->one_eighty_count = -1024;
|
||||
{
|
||||
pPlayer->one_eighty_count = -1024;
|
||||
pPlayer->one_eighty_target = fix16_sadd(pPlayer->q16ang, -fix16_from_int(pPlayer->one_eighty_count)) & 0x7FFFFFF;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue