mirror of
https://github.com/ZDoom/raze-gles.git
synced 2025-02-07 22:21:01 +00:00
- changed all SYNCINPUT #defines into runtime checks so that both parts can be used and consolidated the 4 versions of the SeaSick code.
This commit is contained in:
parent
2888f29e32
commit
38751d19ac
9 changed files with 256 additions and 266 deletions
|
@ -230,5 +230,6 @@ void startnewgame(MapRecord* map, int skill);
|
|||
void setlocalplayerinput(player_struct *pp);
|
||||
void PlayerColorChanged(void);
|
||||
void nonsharedkeys(void);
|
||||
void apply_seasick(player_struct* p, double scalefactor);
|
||||
|
||||
END_DUKE_NS
|
||||
|
|
|
@ -85,6 +85,8 @@ enum
|
|||
MAXLABELLEN = 64
|
||||
};
|
||||
|
||||
G_EXTERN bool synchronized_input;
|
||||
|
||||
G_EXTERN char g_loadFromGroupOnly;
|
||||
G_EXTERN char pus,pub;
|
||||
G_EXTERN char ready2send;
|
||||
|
|
|
@ -348,12 +348,14 @@ void dokneeattack(int snum, int pi, const std::initializer_list<int> & respawnli
|
|||
if (p->knee_incs > 0)
|
||||
{
|
||||
p->knee_incs++;
|
||||
#ifndef SYNCINPUT
|
||||
g_player[snum].horizSkew = -48;
|
||||
g_player[snum].horizRecenter = true;
|
||||
#else
|
||||
p->addhoriz(-48);
|
||||
#endif
|
||||
if (synchronized_input)
|
||||
p->addhoriz(-48);
|
||||
else
|
||||
{
|
||||
g_player[snum].horizSkew = -48;
|
||||
g_player[snum].horizRecenter = true;
|
||||
}
|
||||
|
||||
p->return_to_center = 9;
|
||||
if (p->knee_incs > 15)
|
||||
{
|
||||
|
@ -715,12 +717,13 @@ void playerLookLeft(int snum)
|
|||
OnEvent(EVENT_LOOKLEFT, p->i, snum, -1);
|
||||
if (GetGameVarID(g_iReturnVarID, p->i, snum) == 0)
|
||||
{
|
||||
#ifdef SYNCINPUT
|
||||
p->addlookang(-152);
|
||||
p->addrotscrnang(24);
|
||||
#else
|
||||
g_player[snum].lookLeft = true;
|
||||
#endif
|
||||
if (synchronized_input)
|
||||
{
|
||||
p->addlookang(-152);
|
||||
p->addrotscrnang(24);
|
||||
}
|
||||
else
|
||||
g_player[snum].lookLeft = true;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -731,12 +734,13 @@ void playerLookRight(int snum)
|
|||
OnEvent(EVENT_LOOKRIGHT, p->i, snum, -1);
|
||||
if (GetGameVarID(g_iReturnVarID, p->i, snum) == 0)
|
||||
{
|
||||
#ifdef SYNCINPUT
|
||||
p->addlookang(152);
|
||||
p->addrotscrnang(24);
|
||||
#else
|
||||
g_player[snum].lookRight = true;
|
||||
#endif
|
||||
if (synchronized_input)
|
||||
{
|
||||
p->addlookang(152);
|
||||
p->addrotscrnang(24);
|
||||
}
|
||||
else
|
||||
g_player[snum].lookRight = true;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -748,19 +752,17 @@ void playerCenterView(int snum)
|
|||
if (GetGameVarID(g_iReturnVarID, p->i, snum) == 0)
|
||||
{
|
||||
p->return_to_center = 9;
|
||||
#ifndef SYNCINPUT
|
||||
g_player[snum].horizRecenter = true;
|
||||
#endif
|
||||
if (!synchronized_input)
|
||||
g_player[snum].horizRecenter = true;
|
||||
}
|
||||
}
|
||||
|
||||
void horizAngleAdjust(int snum, int delta)
|
||||
{
|
||||
#ifndef SYNCINPUT // for per-frame input
|
||||
g_player[snum].horizAngleAdjust = delta;
|
||||
#else // for synchronous input
|
||||
ps[snum].addhoriz(delta);
|
||||
#endif
|
||||
if (synchronized_input)
|
||||
ps[snum].addhoriz(delta);
|
||||
else
|
||||
g_player[snum].horizAngleAdjust = delta;
|
||||
}
|
||||
|
||||
void playerLookUp(int snum, ESyncBits sb_snum)
|
||||
|
|
|
@ -1562,9 +1562,8 @@ static void operateJetpack(int snum, ESyncBits sb_snum, int psectlotag, int fz,
|
|||
p->pycount &= 2047;
|
||||
p->pyoff = sintable[p->pycount] >> 7;
|
||||
|
||||
#ifndef SYNCINPUT
|
||||
g_player[snum].horizSkew = 0;
|
||||
#endif
|
||||
if (!synchronized_input)
|
||||
g_player[snum].horizSkew = 0;
|
||||
|
||||
if (p->jetpack_on < 11)
|
||||
{
|
||||
|
@ -2601,10 +2600,11 @@ void processinput_d(int snum)
|
|||
pi = p->i;
|
||||
s = &sprite[pi];
|
||||
|
||||
#ifndef SYNCINPUT
|
||||
g_player[snum].horizAngleAdjust = 0;
|
||||
g_player[snum].horizSkew = 0;
|
||||
#endif
|
||||
if (!synchronized_input)
|
||||
{
|
||||
g_player[snum].horizAngleAdjust = 0;
|
||||
g_player[snum].horizSkew = 0;
|
||||
}
|
||||
|
||||
sb_snum = PlayerInputBits(snum, SKB_ALL);
|
||||
|
||||
|
@ -2641,27 +2641,28 @@ void processinput_d(int snum)
|
|||
hittype[pi].floorz = fz;
|
||||
hittype[pi].ceilingz = cz;
|
||||
|
||||
#ifdef SYNCINPUT
|
||||
p->oq16horiz = p->q16horiz;
|
||||
p->oq16horizoff = p->q16horizoff;
|
||||
|
||||
if (p->aim_mode == 0 && p->on_ground && psectlotag != ST_2_UNDERWATER && (sector[psect].floorstat & 2))
|
||||
if (synchronized_input)
|
||||
{
|
||||
int x = p->posx + (sintable[(p->getang() + 512) & 2047] >> 5);
|
||||
int y = p->posy + (sintable[p->getang() & 2047] >> 5);
|
||||
short tempsect = psect;
|
||||
updatesector(x, y, &tempsect);
|
||||
p->oq16horiz = p->q16horiz;
|
||||
p->oq16horizoff = p->q16horizoff;
|
||||
|
||||
if (tempsect >= 0)
|
||||
if (p->aim_mode == 0 && p->on_ground && psectlotag != ST_2_UNDERWATER && (sector[psect].floorstat & 2))
|
||||
{
|
||||
k = getflorzofslope(psect, x, y);
|
||||
if (psect == tempsect || abs(getflorzofslope(tempsect, x, y) - k) <= (4 << 8))
|
||||
p->addhorizoff(mulscale16(j - k, 160));
|
||||
int x = p->posx + (sintable[(p->getang() + 512) & 2047] >> 5);
|
||||
int y = p->posy + (sintable[p->getang() & 2047] >> 5);
|
||||
short tempsect = psect;
|
||||
updatesector(x, y, &tempsect);
|
||||
|
||||
if (tempsect >= 0)
|
||||
{
|
||||
k = getflorzofslope(psect, x, y);
|
||||
if (psect == tempsect || abs(getflorzofslope(tempsect, x, y) - k) <= (4 << 8))
|
||||
p->addhorizoff(mulscale16(j - k, 160));
|
||||
}
|
||||
}
|
||||
if (p->q16horizoff > 0) p->q16horizoff -= ((p->q16horizoff >> 3) + FRACUNIT);
|
||||
else if (p->q16horizoff < 0) p->q16horizoff += (((-p->q16horizoff) >> 3) + FRACUNIT);
|
||||
}
|
||||
if (p->q16horizoff > 0) p->q16horizoff -= ((p->q16horizoff >> 3) + FRACUNIT);
|
||||
else if (p->q16horizoff < 0) p->q16horizoff += (((-p->q16horizoff) >> 3) + FRACUNIT);
|
||||
#endif
|
||||
|
||||
if (hz >= 0 && (hz & 49152) == 49152)
|
||||
{
|
||||
|
@ -2751,10 +2752,11 @@ void processinput_d(int snum)
|
|||
|
||||
doubvel = TICSPERFRAME;
|
||||
|
||||
#ifdef SYNCINPUT
|
||||
p->q16rotscrnang -= (p->q16rotscrnang >> 1); if (p->q16rotscrnang < FRACUNIT) p->q16rotscrnang = 0;
|
||||
p->q16look_ang -= p->q16look_ang >> 2; if (p->q16look_ang < FRACUNIT) p->q16look_ang = 0;
|
||||
#endif
|
||||
if (synchronized_input)
|
||||
{
|
||||
p->q16rotscrnang -= (p->q16rotscrnang >> 1); if (p->q16rotscrnang < FRACUNIT) p->q16rotscrnang = 0;
|
||||
p->q16look_ang -= p->q16look_ang >> 2; if (p->q16look_ang < FRACUNIT) p->q16look_ang = 0;
|
||||
}
|
||||
|
||||
if (sb_snum & SKB_LOOK_LEFT)
|
||||
{
|
||||
|
@ -2799,15 +2801,16 @@ void processinput_d(int snum)
|
|||
|
||||
p->oposz = p->posz;
|
||||
p->opyoff = p->pyoff;
|
||||
#ifdef SYNCINPUT
|
||||
p->oq16ang = p->q16ang;
|
||||
|
||||
if (p->one_eighty_count < 0)
|
||||
if (synchronized_input)
|
||||
{
|
||||
p->one_eighty_count += 128;
|
||||
p->addang(128);
|
||||
p->oq16ang = p->q16ang;
|
||||
|
||||
if (p->one_eighty_count < 0)
|
||||
{
|
||||
p->one_eighty_count += 128;
|
||||
p->addang(128);
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
// Shrinking code
|
||||
|
||||
|
@ -2843,18 +2846,19 @@ void processinput_d(int snum)
|
|||
}
|
||||
else if (sb_avel) //p->ang += syncangvel * constant
|
||||
{ //ENGINE calculates angvel for you
|
||||
#ifdef SYNCINPUT
|
||||
// may still be needed later for demo recording
|
||||
int tempang;
|
||||
if (synchronized_input)
|
||||
{
|
||||
// may still be needed later for demo recording
|
||||
int tempang;
|
||||
|
||||
tempang = sb_avel << 1;
|
||||
tempang = sb_avel << 1; // this is fixed point!
|
||||
|
||||
if (psectlotag == 2) p->angvel = (tempang - (tempang >> 3)) * sgn(doubvel);
|
||||
else p->angvel = tempang * sgn(doubvel);
|
||||
if (psectlotag == 2) p->angvel = (tempang - (tempang >> 3)) * sgn(doubvel);
|
||||
else p->angvel = tempang * sgn(doubvel);
|
||||
|
||||
p->addang(p->angvel);
|
||||
p->q16ang &= (2048<<FRACBITS)-1;
|
||||
#endif
|
||||
p->addang(p->angvel);
|
||||
p->q16ang &= (2048 << FRACBITS) - 1;
|
||||
}
|
||||
p->crack_time = 777;
|
||||
}
|
||||
|
||||
|
@ -3063,10 +3067,11 @@ HORIZONLY:
|
|||
fi.activatebysector(psect, pi);
|
||||
}
|
||||
|
||||
#ifndef SYNCINPUT
|
||||
if (p->return_to_center > 0)
|
||||
p->return_to_center--;
|
||||
#endif
|
||||
if (!synchronized_input)
|
||||
{
|
||||
if (p->return_to_center > 0)
|
||||
p->return_to_center--;
|
||||
}
|
||||
|
||||
// center_view
|
||||
if (sb_snum & SKB_CENTER_VIEW || p->hard_landing)
|
||||
|
@ -3089,43 +3094,37 @@ HORIZONLY:
|
|||
{ // aim_down
|
||||
playerAimDown(snum, sb_snum);
|
||||
}
|
||||
#ifdef SYNCINPUT
|
||||
if (p->return_to_center > 0)
|
||||
if ((sb_snum & (SKB_LOOK_UP| SKB_LOOK_DOWN)) == 0)
|
||||
{
|
||||
p->return_to_center--;
|
||||
p->q16horiz += 33*FRACUNIT - (p->q16horiz / 3);
|
||||
}
|
||||
#endif
|
||||
if (synchronized_input)
|
||||
{
|
||||
if (p->return_to_center > 0)
|
||||
if ((sb_snum & (SKB_LOOK_UP | SKB_LOOK_DOWN)) == 0)
|
||||
{
|
||||
p->return_to_center--;
|
||||
p->q16horiz += 33 * FRACUNIT - (p->q16horiz / 3);
|
||||
}
|
||||
}
|
||||
if (p->hard_landing > 0)
|
||||
{
|
||||
#ifndef SYNCINPUT
|
||||
g_player[snum].horizSkew = (-(p->hard_landing << 4)) * FRACUNIT;
|
||||
#else
|
||||
p->addhoriz(-(p->hard_landing << 4));
|
||||
#endif
|
||||
if (!synchronized_input)
|
||||
g_player[snum].horizSkew = (-(p->hard_landing << 4)) * FRACUNIT;
|
||||
else
|
||||
p->addhoriz(-(p->hard_landing << 4));
|
||||
p->hard_landing--;
|
||||
}
|
||||
|
||||
#if 0
|
||||
if (p->aim_mode)
|
||||
p->horiz += sync[snum].horz >> 1;
|
||||
else
|
||||
if (synchronized_input)
|
||||
{
|
||||
if (p->horiz > 95 && p->horiz < 105) p->horiz = 100;
|
||||
if (p->horizoff > -5 && p->horizoff < 5) p->horizoff = 0;
|
||||
if (p->aim_mode)
|
||||
p->q16horiz += (sync[snum].q16horz >> 1);
|
||||
else
|
||||
{
|
||||
if (p->q16horiz > F16(95) && p->q16horiz < F16(105)) p->sethoriz(100);
|
||||
if (p->q16horizoff > F16(-5) && p->q16horizoff < F16(5)) p->sethorizoff(0);
|
||||
}
|
||||
|
||||
p->q16horiz = clamp(p->q16horiz, F16(HORIZ_MIN), F16(HORIZ_MAX));
|
||||
}
|
||||
|
||||
p->horiz = clamp(p->horiz, HORIZ_MIN, HORIZ_MAX);
|
||||
|
||||
if (centerHoriz)
|
||||
{
|
||||
if (p->gethoriz() > 95 && pPlayer->gethoriz() < 105) pPlayer->sethoriz(100);
|
||||
if (p->gethorizoff() > -5 && pPlayer->gethorizoff < 5) pPlayer->sethorizoff(0);
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
//Shooting code/changes
|
||||
|
||||
if (p->show_empty_weapon > 0)
|
||||
|
|
|
@ -34,6 +34,33 @@ Prepared for public release: 03/21/2003 - Charlie Wiederhold, 3D Realms
|
|||
|
||||
BEGIN_DUKE_NS
|
||||
|
||||
|
||||
//---------------------------------------------------------------------------
|
||||
//
|
||||
//
|
||||
//
|
||||
//---------------------------------------------------------------------------
|
||||
|
||||
void apply_seasick(player_struct* p, double scalefactor)
|
||||
{
|
||||
if (isRRRA() && p->SeaSick)
|
||||
{
|
||||
if (p->SeaSick < 250)
|
||||
{
|
||||
if (p->SeaSick >= 180)
|
||||
p->addrotscrnang(24*scalefactor);
|
||||
else if (p->SeaSick >= 130)
|
||||
p->addrotscrnang(-24*scalefactor);
|
||||
else if (p->SeaSick >= 70)
|
||||
p->addrotscrnang(24*scalefactor);
|
||||
else if (p->SeaSick >= 20)
|
||||
p->addrotscrnang(-24*scalefactor);
|
||||
}
|
||||
if (p->SeaSick < 250)
|
||||
p->addlookang(((krand() & 255) - 128) * scalefactor);
|
||||
}
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------
|
||||
//
|
||||
//
|
||||
|
@ -3473,27 +3500,28 @@ void processinput_r(int snum)
|
|||
hittype[pi].floorz = fz;
|
||||
hittype[pi].ceilingz = cz;
|
||||
|
||||
#ifdef SYNCINPUT
|
||||
p->oq16horiz = p->q16horiz;
|
||||
p->oq16horizoff = p->q16horizoff;
|
||||
|
||||
if (p->aim_mode == 0 && p->on_ground && psectlotag != ST_2_UNDERWATER && (sector[psect].floorstat & 2))
|
||||
if (synchronized_input)
|
||||
{
|
||||
int x = p->posx + (sintable[(p->getang() + 512) & 2047] >> 5);
|
||||
int y = p->posy + (sintable[p->getang() & 2047] >> 5);
|
||||
short tempsect = psect;
|
||||
updatesector(x, y, &tempsect);
|
||||
p->oq16horiz = p->q16horiz;
|
||||
p->oq16horizoff = p->q16horizoff;
|
||||
|
||||
if (tempsect >= 0)
|
||||
if (p->aim_mode == 0 && p->on_ground && psectlotag != ST_2_UNDERWATER && (sector[psect].floorstat & 2))
|
||||
{
|
||||
k = getflorzofslope(psect, x, y);
|
||||
if (psect == tempsect || abs(getflorzofslope(tempsect, x, y) - k) <= (4 << 8))
|
||||
p->addhorizoff(mulscale16(j - k, 160));
|
||||
int x = p->posx + (sintable[(p->getang() + 512) & 2047] >> 5);
|
||||
int y = p->posy + (sintable[p->getang() & 2047] >> 5);
|
||||
short tempsect = psect;
|
||||
updatesector(x, y, &tempsect);
|
||||
|
||||
if (tempsect >= 0)
|
||||
{
|
||||
k = getflorzofslope(psect, x, y);
|
||||
if (psect == tempsect || abs(getflorzofslope(tempsect, x, y) - k) <= (4 << 8))
|
||||
p->addhorizoff(mulscale16(j - k, 160));
|
||||
}
|
||||
}
|
||||
if (p->q16horizoff > 0) p->q16horizoff -= ((p->q16horizoff >> 3) + FRACUNIT);
|
||||
else if (p->q16horizoff < 0) p->q16horizoff += (((-p->q16horizoff) >> 3) + FRACUNIT);
|
||||
}
|
||||
if (p->q16horizoff > 0) p->q16horizoff -= ((p->q16horizoff >> 3) + FRACUNIT);
|
||||
else if (p->q16horizoff < 0) p->q16horizoff += (((-p->q16horizoff) >> 3) + FRACUNIT);
|
||||
#endif
|
||||
|
||||
if (hz >= 0 && (hz & 49152) == 49152)
|
||||
{
|
||||
|
@ -3639,10 +3667,11 @@ void processinput_r(int snum)
|
|||
|
||||
doubvel = TICSPERFRAME;
|
||||
|
||||
#ifdef SYNCINPUT
|
||||
p->q16rotscrnang -= (p->q16rotscrnang >> 1); if (p->q16rotscrnang < FRACUNIT) p->q16rotscrnang = 0;
|
||||
p->q16look_ang -= p->q16look_ang >> 2; if (p->q16look_ang < FRACUNIT) p->q16look_ang = 0;
|
||||
#endif
|
||||
if (synchronized_input)
|
||||
{
|
||||
p->q16rotscrnang -= (p->q16rotscrnang >> 1); if (p->q16rotscrnang < FRACUNIT) p->q16rotscrnang = 0;
|
||||
p->q16look_ang -= p->q16look_ang >> 2; if (p->q16look_ang < FRACUNIT) p->q16look_ang = 0;
|
||||
}
|
||||
|
||||
if ((sb_snum & SKB_LOOK_LEFT) && !p->OnMotorcycle)
|
||||
{
|
||||
|
@ -3654,24 +3683,10 @@ void processinput_r(int snum)
|
|||
playerLookRight(snum);
|
||||
}
|
||||
|
||||
#ifdef SYNCINPUT
|
||||
if (isRRRA() && p->SeaSick)
|
||||
if (synchronized_input)
|
||||
{
|
||||
if (p->SeaSick < 250)
|
||||
{
|
||||
if (p->SeaSick >= 180)
|
||||
p->addrotscrnang(24);
|
||||
else if (p->SeaSick >= 130)
|
||||
p->addrotscrnang(-24);
|
||||
else if (p->SeaSick >= 70)
|
||||
p->addrotscrnang(24);
|
||||
else if (p->SeaSick >= 20)
|
||||
p->addrotscrnang(-24);
|
||||
}
|
||||
if (p->SeaSick < 250)
|
||||
p->addlookang((krand() & 255) - 128);
|
||||
apply_seasick(p, 1);
|
||||
}
|
||||
#endif
|
||||
|
||||
if (p->on_crane >= 0)
|
||||
goto HORIZONLY;
|
||||
|
@ -3706,15 +3721,16 @@ void processinput_r(int snum)
|
|||
|
||||
p->oposz = p->posz;
|
||||
p->opyoff = p->pyoff;
|
||||
#ifdef SYNCINPUT
|
||||
p->oq16ang = p->q16ang;
|
||||
|
||||
if (p->one_eighty_count < 0)
|
||||
if (synchronized_input)
|
||||
{
|
||||
p->one_eighty_count += 128;
|
||||
p->addang(128);
|
||||
p->oq16ang = p->q16ang;
|
||||
|
||||
if (p->one_eighty_count < 0)
|
||||
{
|
||||
p->one_eighty_count += 128;
|
||||
p->addang(128);
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
// Shrinking code
|
||||
|
||||
|
@ -3765,18 +3781,19 @@ void processinput_r(int snum)
|
|||
}
|
||||
else if (sb_avel) //p->ang += syncangvel * constant
|
||||
{ //ENGINE calculates angvel for you
|
||||
#ifdef SYNCINPUT
|
||||
// may still be needed later for demo recording
|
||||
int tempang;
|
||||
if (synchronized_input)
|
||||
{
|
||||
// may still be needed later for demo recording
|
||||
int tempang;
|
||||
|
||||
tempang = sync[snum].avel << 1;
|
||||
tempang = sb_avel << 1; // this is fixed point!
|
||||
|
||||
if (psectlotag == 2) p->angvel = (tempang - (tempang >> 3)) * sgn(doubvel);
|
||||
else p->angvel = tempang * sgn(doubvel);
|
||||
if (psectlotag == 2) p->angvel = (tempang - (tempang >> 3)) * sgn(doubvel);
|
||||
else p->angvel = tempang * sgn(doubvel);
|
||||
|
||||
p->ang += p->angvel;
|
||||
p->ang &= 2047;
|
||||
#endif
|
||||
p->addang(p->angvel);
|
||||
p->q16ang &= (2048 << FRACBITS) - 1;
|
||||
}
|
||||
p->crack_time = 777;
|
||||
}
|
||||
|
||||
|
@ -4101,10 +4118,8 @@ HORIZONLY:
|
|||
return;
|
||||
}
|
||||
|
||||
#ifndef SYNCINPUT
|
||||
if (p->return_to_center > 0)
|
||||
if (!synchronized_input && p->return_to_center > 0)
|
||||
p->return_to_center--;
|
||||
#endif
|
||||
|
||||
if (sb_snum & SKB_CENTER_VIEW || p->hard_landing)
|
||||
{
|
||||
|
@ -4134,43 +4149,37 @@ HORIZONLY:
|
|||
p->recoil -= d;
|
||||
p->addhoriz(-d);
|
||||
}
|
||||
#ifdef SYNCINPUT
|
||||
else if (p->return_to_center > 0)
|
||||
if ((sb_snum & (SKB_LOOK_UP| SKB_LOOK_DOWN)) == 0)
|
||||
{
|
||||
p->return_to_center--;
|
||||
p->q16horiz += 33*FRACUNIT - (p->q16horiz / 3);
|
||||
}
|
||||
#endif
|
||||
if (synchronized_input)
|
||||
{
|
||||
if (p->return_to_center > 0)
|
||||
if ((sb_snum & (SKB_LOOK_UP | SKB_LOOK_DOWN)) == 0)
|
||||
{
|
||||
p->return_to_center--;
|
||||
p->q16horiz += 33 * FRACUNIT - (p->q16horiz / 3);
|
||||
}
|
||||
}
|
||||
if (p->hard_landing > 0)
|
||||
{
|
||||
#ifndef SYNCINPUT
|
||||
g_player[snum].horizSkew = (-(p->hard_landing << 4)) * FRACUNIT;
|
||||
#else
|
||||
p->addhoriz(-(p->hard_landing << 4));
|
||||
#endif
|
||||
if (!synchronized_input)
|
||||
g_player[snum].horizSkew = (-(p->hard_landing << 4)) * FRACUNIT;
|
||||
else
|
||||
p->addhoriz(-(p->hard_landing << 4));
|
||||
p->hard_landing--;
|
||||
}
|
||||
|
||||
#ifdef SYNCINPUT
|
||||
if (p->aim_mode)
|
||||
p->horiz += sync[snum].horz >> 1;
|
||||
else if (!p->recoil)
|
||||
if (synchronized_input)
|
||||
{
|
||||
if (p->horiz > 95 && p->horiz < 105) p->horiz = 100;
|
||||
if (p->horizoff > -5 && p->horizoff < 5) p->horizoff = 0;
|
||||
if (p->aim_mode)
|
||||
p->q16horiz += (sync[snum].q16horz >> 1);
|
||||
else
|
||||
{
|
||||
if (p->q16horiz > F16(95) && p->q16horiz < F16(105)) p->sethoriz(100);
|
||||
if (p->q16horizoff > F16(-5) && p->q16horizoff < F16(5)) p->sethorizoff(0);
|
||||
}
|
||||
|
||||
p->q16horiz = clamp(p->q16horiz, F16(HORIZ_MIN), F16(HORIZ_MAX));
|
||||
}
|
||||
|
||||
p->horiz = clamp(p->horiz, HORIZ_MIN, HORIZ_MAX);
|
||||
|
||||
if (centerHoriz && !p->recoil)
|
||||
{
|
||||
if (p->gethoriz() > 95 && pPlayer->gethoriz() < 105) pPlayer->sethoriz(100);
|
||||
if (p->gethorizoff() > -5 && pPlayer->gethorizoff < 5) pPlayer->sethorizoff(0);
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
//Shooting code/changes
|
||||
|
||||
if (p->show_empty_weapon > 0)
|
||||
|
|
|
@ -535,25 +535,31 @@ void displayrooms(int snum, int smoothratio)
|
|||
setdrugmode(p, i);
|
||||
}
|
||||
|
||||
#ifndef SYNCINPUT
|
||||
renderSetRollAngle(p->getrotscrnang());
|
||||
#else
|
||||
renderSetRollAngle(p->orotscrnang + mulscale16(((p->rotscrnang - p->orotscrnang + 1024) & 2047) - 1024, smoothratio));
|
||||
p->orotscrnang = p->rotscrnang; // JBF: save it for next time
|
||||
#endif
|
||||
if (!synchronized_input)
|
||||
renderSetRollAngle(p->getrotscrnang());
|
||||
else
|
||||
{
|
||||
// The fixed point fuckery at play here means we cannot do the interpolation at full precision.
|
||||
auto oa = p->oq16rotscrnang >> FRACUNIT;
|
||||
renderSetRollAngle(oa + mulscale16(((p->getrotscrnang() - oa + 1024) & 2047) - 1024, smoothratio));
|
||||
p->oq16rotscrnang = p->q16rotscrnang; // JBF: save it for next time
|
||||
}
|
||||
|
||||
if ((snum == myconnectindex) && (numplayers > 1))
|
||||
{
|
||||
cposx = omyx + mulscale16((int)(myx - omyx), smoothratio);
|
||||
cposy = omyy + mulscale16((int)(myy - omyy), smoothratio);
|
||||
cposz = omyz + mulscale16((int)(myz - omyz), smoothratio);
|
||||
#ifdef SYNCINPUT
|
||||
cang = omyang + mulscale16((int)(((myang + 1024 - omyang) & 2047) - 1024), smoothratio);
|
||||
choriz = omyhoriz + omyhorizoff + mulscale16((int)(myhoriz + myhorizoff - omyhoriz - omyhorizoff), smoothratio);
|
||||
#else
|
||||
cang = myang;
|
||||
choriz = (myhoriz + myhorizoff);
|
||||
#endif
|
||||
if (synchronized_input)
|
||||
{
|
||||
cang = omyang + mulscale16((int)(((myang + 1024 - omyang) & 2047) - 1024), smoothratio);
|
||||
choriz = omyhoriz + omyhorizoff + mulscale16((int)(myhoriz + myhorizoff - omyhoriz - omyhorizoff), smoothratio);
|
||||
}
|
||||
else
|
||||
{
|
||||
cang = myang;
|
||||
choriz = (myhoriz + myhorizoff);
|
||||
}
|
||||
sect = mycursectnum;
|
||||
}
|
||||
else
|
||||
|
@ -561,15 +567,19 @@ void displayrooms(int snum, int smoothratio)
|
|||
cposx = p->oposx + mulscale16((int)(p->posx - p->oposx), smoothratio);
|
||||
cposy = p->oposy + mulscale16((int)(p->posy - p->oposy), smoothratio);
|
||||
cposz = p->oposz + mulscale16((int)(p->posz - p->oposz), smoothratio);
|
||||
#ifdef SYNCINPUT
|
||||
// Original code for when the values are passed through the sync struct
|
||||
cang = p->getoang() + mulscale16((int)(((p->getang() + 1024 - p->getoang()) & 2047) - 1024), smoothratio);
|
||||
choriz = p->ohoriz+p->ohorizoff+mulscale16((int)(p->gethorizsum()-p->ohoriz-p->ohorizoff),smoothratio);
|
||||
#else
|
||||
// This is for real time updating of the view direction.
|
||||
cang = p->getang();
|
||||
choriz = p->gethorizsum();
|
||||
#endif
|
||||
if (synchronized_input /*|| smoothcamera*/)
|
||||
{
|
||||
// Original code for when the values are passed through the sync struct
|
||||
cang = p->getoang() + mulscale16((int)(((p->getang() + 1024 - p->getoang()) & 2047) - 1024), smoothratio);
|
||||
int ohorz = (p->oq16horiz + p->oq16horizoff) >> FRACBITS;
|
||||
choriz = ohorz + mulscale16((int)(p->gethorizsum() - ohorz), smoothratio);
|
||||
}
|
||||
else
|
||||
{
|
||||
// This is for real time updating of the view direction.
|
||||
cang = p->getang();
|
||||
choriz = p->gethorizsum();
|
||||
}
|
||||
}
|
||||
cang += p->getlookang();
|
||||
|
||||
|
|
|
@ -195,9 +195,11 @@ struct player_struct
|
|||
int getlookang() { return q16look_ang >> FRACBITS; }
|
||||
void setlookang(int b) { q16look_ang = b << FRACBITS; }
|
||||
void addlookang(int b) { q16look_ang += b << FRACBITS; }
|
||||
void addlookang(double b) { q16look_ang += int(b *65536.); }
|
||||
int getrotscrnang() { return q16rotscrnang >> FRACBITS; }
|
||||
void setrotscrnang(int b) { q16rotscrnang = b << FRACBITS; }
|
||||
void addrotscrnang(int b) { q16rotscrnang += b << FRACBITS; }
|
||||
void addrotscrnang(double b) { q16rotscrnang += int(b *65536.); }
|
||||
int getang() { return q16ang >> FRACBITS; }
|
||||
int getoang() { return oq16ang >> FRACBITS; }
|
||||
void setang(int v, bool smooth = false) { q16ang = v << FRACBITS; }
|
||||
|
|
|
@ -113,6 +113,7 @@ void P_GetInput(int const playerNum)
|
|||
auto const currentHiTicks = timerGetHiTicks();
|
||||
elapsedInputTicks = currentHiTicks - thisPlayer.lastInputTicks;
|
||||
thisPlayer.lastInputTicks = currentHiTicks;
|
||||
double scaleAdjust = elapsedInputTicks * REALGAMETICSPERSEC / 1000.0;
|
||||
|
||||
|
||||
if (paused)
|
||||
|
@ -384,20 +385,26 @@ void P_GetInput(int const playerNum)
|
|||
if (!(movementLocked & IL_NOANGLE))
|
||||
{
|
||||
localInput.q16avel = fix16_sadd(localInput.q16avel, input.q16avel);
|
||||
pPlayer->q16ang = fix16_sadd(pPlayer->q16ang, input.q16avel) & 0x7FFFFFF;
|
||||
|
||||
if (input.q16avel)
|
||||
if (!synchronized_input)
|
||||
{
|
||||
pPlayer->one_eighty_count = 0;
|
||||
pPlayer->q16ang = fix16_sadd(pPlayer->q16ang, input.q16avel) & 0x7FFFFFF;
|
||||
|
||||
if (input.q16avel)
|
||||
{
|
||||
pPlayer->one_eighty_count = 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (!(movementLocked & IL_NOHORIZ))
|
||||
{
|
||||
localInput.q16horz = fix16_clamp(fix16_sadd(localInput.q16horz, input.q16horz), F16(-MAXHORIZVEL), F16(MAXHORIZVEL));
|
||||
pPlayer->q16horiz = fix16_clamp(fix16_sadd(pPlayer->q16horiz, input.q16horz), F16(HORIZ_MIN), F16(HORIZ_MAX));
|
||||
if (!synchronized_input)
|
||||
pPlayer->q16horiz = fix16_clamp(fix16_sadd(pPlayer->q16horiz, input.q16horz), F16(HORIZ_MIN), F16(HORIZ_MAX));
|
||||
}
|
||||
}
|
||||
if (synchronized_input) return;
|
||||
|
||||
// don't adjust rotscrnang and look_ang if dead.
|
||||
if (pSprite->extra > 0)
|
||||
{
|
||||
|
@ -428,22 +435,7 @@ void P_GetInput(int const playerNum)
|
|||
pPlayer->q16ang = fix16_sadd(pPlayer->q16ang, fix16_max(fix16_one, fix16_from_dbl(scaleAdjustmentToInterval(-pPlayer->one_eighty_count / ONEEIGHTYSCALE)))) & 0x7FFFFFF;
|
||||
}
|
||||
|
||||
if (isRRRA() && pPlayer->SeaSick)
|
||||
{
|
||||
if (pPlayer->SeaSick < 250)
|
||||
{
|
||||
if (pPlayer->SeaSick >= 180)
|
||||
pPlayer->q16rotscrnang = fix16_sadd(pPlayer->q16rotscrnang, fix16_from_dbl(scaleAdjustmentToInterval(24)));
|
||||
else if (pPlayer->SeaSick >= 130)
|
||||
pPlayer->q16rotscrnang = fix16_ssub(pPlayer->q16rotscrnang, fix16_from_dbl(scaleAdjustmentToInterval(24)));
|
||||
else if (pPlayer->SeaSick >= 70)
|
||||
pPlayer->q16rotscrnang = fix16_sadd(pPlayer->q16rotscrnang, fix16_from_dbl(scaleAdjustmentToInterval(24)));
|
||||
else if (pPlayer->SeaSick >= 20)
|
||||
pPlayer->q16rotscrnang = fix16_sadd(pPlayer->q16rotscrnang, fix16_from_dbl(scaleAdjustmentToInterval(24)));
|
||||
}
|
||||
if (pPlayer->SeaSick < 250)
|
||||
pPlayer->q16look_ang = fix16_sadd(pPlayer->q16look_ang, fix16_from_dbl(scaleAdjustmentToInterval((krand2()&255)-128)));
|
||||
}
|
||||
apply_seasick(pPlayer, scaleAdjust);
|
||||
}
|
||||
// A horiz diff of 128 equal 45 degrees, so we convert horiz to 1024 angle units
|
||||
|
||||
|
@ -512,6 +504,7 @@ void P_GetInputMotorcycle(int playerNum)
|
|||
auto const currentHiTicks = timerGetHiTicks();
|
||||
elapsedInputTicks = currentHiTicks - thisPlayer.lastInputTicks;
|
||||
thisPlayer.lastInputTicks = currentHiTicks;
|
||||
double scaleAdjust = elapsedInputTicks * REALGAMETICSPERSEC / 1000.0;
|
||||
|
||||
if (paused)
|
||||
{
|
||||
|
@ -708,29 +701,14 @@ void P_GetInputMotorcycle(int playerNum)
|
|||
if (!(movementLocked & IL_NOANGLE))
|
||||
{
|
||||
localInput.q16avel = fix16_sadd(localInput.q16avel, input.q16avel);
|
||||
pPlayer->q16ang = fix16_sadd(pPlayer->q16ang, input.q16avel) & 0x7FFFFFF;
|
||||
if (!synchronized_input) pPlayer->q16ang = fix16_sadd(pPlayer->q16ang, input.q16avel) & 0x7FFFFFF;
|
||||
}
|
||||
}
|
||||
|
||||
// don't adjust rotscrnang and look_ang if dead.
|
||||
if (pSprite->extra > 0)
|
||||
if (pSprite->extra > 0 && !synchronized_input)
|
||||
{
|
||||
if (isRRRA() && pPlayer->SeaSick)
|
||||
{
|
||||
if (pPlayer->SeaSick < 250)
|
||||
{
|
||||
if (pPlayer->SeaSick >= 180)
|
||||
pPlayer->q16rotscrnang = fix16_sadd(pPlayer->q16rotscrnang, fix16_from_dbl(scaleAdjustmentToInterval(24)));
|
||||
else if (pPlayer->SeaSick >= 130)
|
||||
pPlayer->q16rotscrnang = fix16_ssub(pPlayer->q16rotscrnang, fix16_from_dbl(scaleAdjustmentToInterval(24)));
|
||||
else if (pPlayer->SeaSick >= 70)
|
||||
pPlayer->q16rotscrnang = fix16_sadd(pPlayer->q16rotscrnang, fix16_from_dbl(scaleAdjustmentToInterval(24)));
|
||||
else if (pPlayer->SeaSick >= 20)
|
||||
pPlayer->q16rotscrnang = fix16_sadd(pPlayer->q16rotscrnang, fix16_from_dbl(scaleAdjustmentToInterval(24)));
|
||||
}
|
||||
if (pPlayer->SeaSick < 250)
|
||||
pPlayer->q16look_ang = fix16_sadd(pPlayer->q16look_ang, fix16_from_dbl(scaleAdjustmentToInterval((krand2()&255)-128)));
|
||||
}
|
||||
apply_seasick(pPlayer, scaleAdjust);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -744,6 +722,8 @@ void P_GetInputBoat(int playerNum)
|
|||
auto const currentHiTicks = timerGetHiTicks();
|
||||
elapsedInputTicks = currentHiTicks - thisPlayer.lastInputTicks;
|
||||
thisPlayer.lastInputTicks = currentHiTicks;
|
||||
double scaleAdjust = elapsedInputTicks * REALGAMETICSPERSEC / 1000.0;
|
||||
|
||||
if (paused)
|
||||
{
|
||||
if (!(pPlayer->gm&MODE_MENU))
|
||||
|
@ -922,29 +902,14 @@ void P_GetInputBoat(int playerNum)
|
|||
if (!(movementLocked & IL_NOANGLE))
|
||||
{
|
||||
localInput.q16avel = fix16_sadd(localInput.q16avel, input.q16avel);
|
||||
pPlayer->q16ang = fix16_sadd(pPlayer->q16ang, input.q16avel) & 0x7FFFFFF;
|
||||
if (!synchronized_input) pPlayer->q16ang = fix16_sadd(pPlayer->q16ang, input.q16avel) & 0x7FFFFFF;
|
||||
}
|
||||
}
|
||||
|
||||
// don't adjust rotscrnang and look_ang if dead.
|
||||
if (pSprite->extra > 0)
|
||||
if (pSprite->extra > 0 && !synchronized_input)
|
||||
{
|
||||
if (isRRRA() && pPlayer->SeaSick)
|
||||
{
|
||||
if (pPlayer->SeaSick < 250)
|
||||
{
|
||||
if (pPlayer->SeaSick >= 180)
|
||||
pPlayer->q16rotscrnang = fix16_sadd(pPlayer->q16rotscrnang, fix16_from_dbl(scaleAdjustmentToInterval(24)));
|
||||
else if (pPlayer->SeaSick >= 130)
|
||||
pPlayer->q16rotscrnang = fix16_ssub(pPlayer->q16rotscrnang, fix16_from_dbl(scaleAdjustmentToInterval(24)));
|
||||
else if (pPlayer->SeaSick >= 70)
|
||||
pPlayer->q16rotscrnang = fix16_sadd(pPlayer->q16rotscrnang, fix16_from_dbl(scaleAdjustmentToInterval(24)));
|
||||
else if (pPlayer->SeaSick >= 20)
|
||||
pPlayer->q16rotscrnang = fix16_sadd(pPlayer->q16rotscrnang, fix16_from_dbl(scaleAdjustmentToInterval(24)));
|
||||
}
|
||||
if (pPlayer->SeaSick < 250)
|
||||
pPlayer->q16look_ang = fix16_sadd(pPlayer->q16look_ang, fix16_from_dbl(scaleAdjustmentToInterval((krand2()&255)-128)));
|
||||
}
|
||||
apply_seasick(pPlayer, scaleAdjust);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -199,7 +199,7 @@ struct Screen native
|
|||
native static vararg void DrawText(Font font, int normalcolor, double x, double y, String text, ...);
|
||||
native static void DrawLine(int x0, int y0, int x1, int y1, Color color, int alpha = 255);
|
||||
native static void DrawThickLine(int x0, int y0, int x1, int y1, double thickness, Color color, int alpha = 255);
|
||||
native static Vector2, Vector2 VirtualToRealCoords(Vector2 pos, Vector2 size, Vector2 vsize, bool vbottom=false, bool handleaspect=true);
|
||||
native static Vector2, Vector2 VirtualToRealCoords(Vector2 pos, Vector2 size, Vector2 vsize, bool vbottom=false, int handleaspect=0);
|
||||
native static double GetAspectRatio();
|
||||
native static void SetClipRect(int x, int y, int w, int h);
|
||||
native static void ClearClipRect();
|
||||
|
|
Loading…
Reference in a new issue