mirror of
https://github.com/ZDoom/raze-gles.git
synced 2024-12-28 12:30:46 +00:00
- cleanup on player CVAR use.
This commit is contained in:
parent
7887c4e80d
commit
48b16d5233
16 changed files with 89 additions and 123 deletions
|
@ -368,7 +368,8 @@ void UpdateAimVector(PLAYER * pPlayer)
|
||||||
WEAPONTRACK *pWeaponTrack = &gWeaponTrack[pPlayer->curWeapon];
|
WEAPONTRACK *pWeaponTrack = &gWeaponTrack[pPlayer->curWeapon];
|
||||||
int nTarget = -1;
|
int nTarget = -1;
|
||||||
pPlayer->aimTargetsCount = 0;
|
pPlayer->aimTargetsCount = 0;
|
||||||
if (cl_autoaim == 1 || (cl_autoaim == 2 && !pWeaponTrack->bIsProjectile) || pPlayer->curWeapon == 10 || pPlayer->curWeapon == 9)
|
int autoaim = Autoaim(pPlayer->nPlayer);
|
||||||
|
if (autoaim == 1 || (autoaim == 2 && !pWeaponTrack->bIsProjectile) || pPlayer->curWeapon == 10 || pPlayer->curWeapon == 9)
|
||||||
{
|
{
|
||||||
int nClosest = 0x7fffffff;
|
int nClosest = 0x7fffffff;
|
||||||
int nSprite;
|
int nSprite;
|
||||||
|
|
|
@ -107,6 +107,12 @@ inline const char* PlayerName(int pindex)
|
||||||
return playername;
|
return playername;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
inline bool Autoaim(int player)
|
||||||
|
{
|
||||||
|
// Todo: proper implementation of user CVARs.
|
||||||
|
return cl_autoaim;
|
||||||
|
}
|
||||||
|
|
||||||
extern bool gNoAutoLoad;
|
extern bool gNoAutoLoad;
|
||||||
extern int hud_statusbarrange; // will be set by the game's configuration setup.
|
extern int hud_statusbarrange; // will be set by the game's configuration setup.
|
||||||
bool G_CheckAutorun(bool button);
|
bool G_CheckAutorun(bool button);
|
||||||
|
|
|
@ -847,7 +847,7 @@ loc_flag:
|
||||||
int var_50 = PlayerList[nLocalPlayer].horizon.horiz.asq16() >> 14;
|
int var_50 = PlayerList[nLocalPlayer].horizon.horiz.asq16() >> 14;
|
||||||
nHeight -= var_50;
|
nHeight -= var_50;
|
||||||
|
|
||||||
if (sPlayerInput[nPlayer].nTarget >= 0 && cl_autoaim)
|
if (sPlayerInput[nPlayer].nTarget >= 0 && Autoaim(nPlayer))
|
||||||
{
|
{
|
||||||
assert(sprite[sPlayerInput[nPlayer].nTarget].sectnum < kMaxSectors);
|
assert(sprite[sPlayerInput[nPlayer].nTarget].sectnum < kMaxSectors);
|
||||||
var_50 = sPlayerInput[nPlayer].nTarget + 10000;
|
var_50 = sPlayerInput[nPlayer].nTarget + 10000;
|
||||||
|
|
|
@ -735,7 +735,7 @@ public:
|
||||||
mysnprintf(tempbuf, 32, "%d", i + 1);
|
mysnprintf(tempbuf, 32, "%d", i + 1);
|
||||||
|
|
||||||
MiniText(30, 90 + t, tempbuf, 0);
|
MiniText(30, 90 + t, tempbuf, 0);
|
||||||
MiniText(38, 90 + t, ud.user_name[i], 0, -1, ps[i].palookup);
|
MiniText(38, 90 + t, PlayerName(i), 0, -1, ps[i].palookup);
|
||||||
|
|
||||||
for (int y = 0; y < playerswhenstarted; y++)
|
for (int y = 0; y < playerswhenstarted; y++)
|
||||||
{
|
{
|
||||||
|
|
|
@ -296,7 +296,7 @@ public:
|
||||||
mysnprintf(tempbuf, 32, "%d", i + 1);
|
mysnprintf(tempbuf, 32, "%d", i + 1);
|
||||||
|
|
||||||
MiniText(30, 90 + t, tempbuf, 0);
|
MiniText(30, 90 + t, tempbuf, 0);
|
||||||
MiniText(38, 90 + t, ud.user_name[i], 0, -1, ps[i].palookup);
|
MiniText(38, 90 + t, PlayerName(i), 0, -1, ps[i].palookup);
|
||||||
|
|
||||||
for (int y = 0; y < playerswhenstarted; y++)
|
for (int y = 0; y < playerswhenstarted; y++)
|
||||||
{
|
{
|
||||||
|
|
|
@ -119,7 +119,7 @@ void footprints(int snum);
|
||||||
int makepainsounds(int snum, int type);
|
int makepainsounds(int snum, int type);
|
||||||
void playerCrouch(int snum);
|
void playerCrouch(int snum);
|
||||||
void playerJump(int snum, int fz, int cz);
|
void playerJump(int snum, int fz, int cz);
|
||||||
void processavel(player_struct* p, float* avel);
|
|
||||||
void checklook(int snum, ESyncBits actions);
|
void checklook(int snum, ESyncBits actions);
|
||||||
void playerCenterView(int snum);
|
void playerCenterView(int snum);
|
||||||
void playerLookUp(int snum, ESyncBits actions);
|
void playerLookUp(int snum, ESyncBits actions);
|
||||||
|
@ -231,10 +231,8 @@ void exitlevel(MapRecord *next);
|
||||||
void enterlevel(MapRecord* mi, int gm);
|
void enterlevel(MapRecord* mi, int gm);
|
||||||
void donewgame(MapRecord* map, int sk);
|
void donewgame(MapRecord* map, int sk);
|
||||||
void startnewgame(MapRecord* map, int skill);
|
void startnewgame(MapRecord* map, int skill);
|
||||||
void setlocalplayerinput(player_struct *pp);
|
|
||||||
int playercolor2lookup(int color);
|
int playercolor2lookup(int color);
|
||||||
void PlayerColorChanged(void);
|
void PlayerColorChanged(void);
|
||||||
void apply_seasick(player_struct* p, double scalefactor);
|
|
||||||
void calcviewpitch(player_struct* p, double factor);
|
void calcviewpitch(player_struct* p, double factor);
|
||||||
bool movementBlocked(int snum);
|
bool movementBlocked(int snum);
|
||||||
void loadcons();
|
void loadcons();
|
||||||
|
@ -242,9 +240,4 @@ void recordoldspritepos();
|
||||||
|
|
||||||
int* animateptr(int i);
|
int* animateptr(int i);
|
||||||
|
|
||||||
void backuppos(player_struct* p, bool noclipping = false);
|
|
||||||
void backupweapon(player_struct* p);
|
|
||||||
void checkhardlanding(player_struct* p);
|
|
||||||
void playerweaponsway(player_struct* p, spritetype* s);
|
|
||||||
|
|
||||||
END_DUKE_NS
|
END_DUKE_NS
|
||||||
|
|
|
@ -325,12 +325,6 @@ void GameInterface::app_init()
|
||||||
|
|
||||||
screenpeek = myconnectindex;
|
screenpeek = myconnectindex;
|
||||||
|
|
||||||
for (int j = numplayers; j < ud.multimode; j++)
|
|
||||||
{
|
|
||||||
mysnprintf(ud.user_name[j], sizeof(ud.user_name[j]), "%s %d", GStrings("PLAYER"), j + 1);
|
|
||||||
ps[j].auto_aim = 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
LoadDefinitions();
|
LoadDefinitions();
|
||||||
fi.InitFonts();
|
fi.InitFonts();
|
||||||
SetTileNames();
|
SetTileNames();
|
||||||
|
|
|
@ -72,7 +72,7 @@ void hud_input(int plnum)
|
||||||
p->sync.actions |= SB_CENTERVIEW;
|
p->sync.actions |= SB_CENTERVIEW;
|
||||||
|
|
||||||
// Backup weapon here as hud_input() is the first function where any one of the weapon variables can change.
|
// Backup weapon here as hud_input() is the first function where any one of the weapon variables can change.
|
||||||
backupweapon(p);
|
p->backupweapon();
|
||||||
|
|
||||||
if (isRR())
|
if (isRR())
|
||||||
{
|
{
|
||||||
|
@ -854,11 +854,6 @@ void GameInterface::GetInput(InputPacket* packet, ControlInfo* const hidInput)
|
||||||
|
|
||||||
auto const p = &ps[myconnectindex];
|
auto const p = &ps[myconnectindex];
|
||||||
|
|
||||||
if (numplayers == 1)
|
|
||||||
{
|
|
||||||
setlocalplayerinput(p);
|
|
||||||
}
|
|
||||||
|
|
||||||
double const scaleAdjust = InputScale();
|
double const scaleAdjust = InputScale();
|
||||||
InputPacket input{};
|
InputPacket input{};
|
||||||
|
|
||||||
|
@ -870,7 +865,7 @@ void GameInterface::GetInput(InputPacket* packet, ControlInfo* const hidInput)
|
||||||
|
|
||||||
if (!cl_syncinput && p->GetActor()->s.extra > 0)
|
if (!cl_syncinput && p->GetActor()->s.extra > 0)
|
||||||
{
|
{
|
||||||
apply_seasick(p, scaleAdjust);
|
p->apply_seasick(scaleAdjust);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
@ -886,7 +881,7 @@ void GameInterface::GetInput(InputPacket* packet, ControlInfo* const hidInput)
|
||||||
{
|
{
|
||||||
// Do these in the same order as the old code.
|
// Do these in the same order as the old code.
|
||||||
calcviewpitch(p, scaleAdjust);
|
calcviewpitch(p, scaleAdjust);
|
||||||
processavel(p, &input.avel);
|
input.avel = p->adjustavel(input.avel);
|
||||||
applylook(&p->angle, input.avel, &p->sync.actions, scaleAdjust);
|
applylook(&p->angle, input.avel, &p->sync.actions, scaleAdjust);
|
||||||
sethorizon(&p->horizon.horiz, input.horz, &p->sync.actions, scaleAdjust);
|
sethorizon(&p->horizon.horiz, input.horz, &p->sync.actions, scaleAdjust);
|
||||||
}
|
}
|
||||||
|
|
|
@ -71,18 +71,6 @@ void PlayerColorChanged(void)
|
||||||
pp.GetActor()->s.pal = ud.user_pals[myconnectindex];
|
pp.GetActor()->s.pal = ud.user_pals[myconnectindex];
|
||||||
}
|
}
|
||||||
|
|
||||||
//---------------------------------------------------------------------------
|
|
||||||
//
|
|
||||||
// Sync local player with CVARs.
|
|
||||||
//
|
|
||||||
//---------------------------------------------------------------------------
|
|
||||||
|
|
||||||
void setlocalplayerinput(player_struct* pp)
|
|
||||||
{
|
|
||||||
pp->aim_mode = in_mousemode;
|
|
||||||
pp->auto_aim = cl_autoaim;
|
|
||||||
}
|
|
||||||
|
|
||||||
//---------------------------------------------------------------------------
|
//---------------------------------------------------------------------------
|
||||||
//
|
//
|
||||||
// calculates automatic view pitch for playing without a mouse
|
// calculates automatic view pitch for playing without a mouse
|
||||||
|
@ -295,13 +283,14 @@ DDukeActor* aim(DDukeActor* actor, int aang)
|
||||||
// Autoaim from DukeGDX.
|
// Autoaim from DukeGDX.
|
||||||
if (s->picnum == TILE_APLAYER)
|
if (s->picnum == TILE_APLAYER)
|
||||||
{
|
{
|
||||||
if (ps[s->yvel].auto_aim == 0)
|
int autoaim = Autoaim(s->yvel);
|
||||||
|
if (!autoaim)
|
||||||
{
|
{
|
||||||
// The chickens in RRRA are homing and must always autoaim.
|
// The chickens in RRRA are homing and must always autoaim.
|
||||||
if (!isRRRA() || ps[s->yvel].curr_weapon != CHICKEN_WEAPON)
|
if (!isRRRA() || ps[s->yvel].curr_weapon != CHICKEN_WEAPON)
|
||||||
return nullptr;
|
return nullptr;
|
||||||
}
|
}
|
||||||
else if (ps[s->yvel].auto_aim == 2)
|
else if (autoaim == 2)
|
||||||
{
|
{
|
||||||
int weap;
|
int weap;
|
||||||
if (!isWW2GI())
|
if (!isWW2GI())
|
||||||
|
@ -582,7 +571,7 @@ void footprints(int snum)
|
||||||
|
|
||||||
inline void backupplayer(player_struct* p)
|
inline void backupplayer(player_struct* p)
|
||||||
{
|
{
|
||||||
backuppos(p);
|
p->backuppos();
|
||||||
p->angle.backup();
|
p->angle.backup();
|
||||||
p->horizon.backup();
|
p->horizon.backup();
|
||||||
}
|
}
|
||||||
|
@ -625,7 +614,7 @@ void playerisdead(int snum, int psectlotag, int fz, int cz)
|
||||||
ps[p->frag_ps].frag++;
|
ps[p->frag_ps].frag++;
|
||||||
frags[p->frag_ps][snum]++;
|
frags[p->frag_ps][snum]++;
|
||||||
|
|
||||||
auto pname = &ud.user_name[p->frag_ps][0];
|
auto pname = PlayerName(p->frag_ps);
|
||||||
if (snum == screenpeek)
|
if (snum == screenpeek)
|
||||||
{
|
{
|
||||||
Printf(PRINT_NOTIFY, "Killed by %s", pname);
|
Printf(PRINT_NOTIFY, "Killed by %s", pname);
|
||||||
|
@ -781,42 +770,23 @@ void playerJump(int snum, int fz, int cz)
|
||||||
//
|
//
|
||||||
//---------------------------------------------------------------------------
|
//---------------------------------------------------------------------------
|
||||||
|
|
||||||
void apply_seasick(player_struct* p, double factor)
|
void player_struct::apply_seasick(double factor)
|
||||||
{
|
{
|
||||||
if (isRRRA() && p->SeaSick && p->dead_flag == 0)
|
if (isRRRA() && SeaSick && dead_flag == 0)
|
||||||
{
|
{
|
||||||
if (p->SeaSick < 250)
|
if (SeaSick < 250)
|
||||||
{
|
{
|
||||||
if (p->SeaSick >= 180)
|
if (SeaSick >= 180)
|
||||||
p->angle.rotscrnang += bamlook(xs_CRoundToUInt(24 * factor * BAMUNIT));
|
angle.rotscrnang += bamlook(xs_CRoundToUInt(24 * factor * BAMUNIT));
|
||||||
else if (p->SeaSick >= 130)
|
else if (SeaSick >= 130)
|
||||||
p->angle.rotscrnang -= bamlook(xs_CRoundToUInt(24 * factor * BAMUNIT));
|
angle.rotscrnang -= bamlook(xs_CRoundToUInt(24 * factor * BAMUNIT));
|
||||||
else if (p->SeaSick >= 70)
|
else if (SeaSick >= 70)
|
||||||
p->angle.rotscrnang += bamlook(xs_CRoundToUInt(24 * factor * BAMUNIT));
|
angle.rotscrnang += bamlook(xs_CRoundToUInt(24 * factor * BAMUNIT));
|
||||||
else if (p->SeaSick >= 20)
|
else if (SeaSick >= 20)
|
||||||
p->angle.rotscrnang -= bamlook(xs_CRoundToUInt(24 * factor * BAMUNIT));
|
angle.rotscrnang -= bamlook(xs_CRoundToUInt(24 * factor * BAMUNIT));
|
||||||
}
|
}
|
||||||
if (p->SeaSick < 250)
|
if (SeaSick < 250)
|
||||||
p->angle.look_ang = bamlook(xs_CRoundToUInt(((krand() & 255) - 128) * factor * BAMUNIT));
|
angle.look_ang = bamlook(xs_CRoundToUInt(((krand() & 255) - 128) * factor * BAMUNIT));
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
//---------------------------------------------------------------------------
|
|
||||||
//
|
|
||||||
// split off because it can be called from multiple places.
|
|
||||||
//
|
|
||||||
//---------------------------------------------------------------------------
|
|
||||||
|
|
||||||
void processavel(player_struct* p, float* avel)
|
|
||||||
{
|
|
||||||
// Taken from processinput() for use with applying look while cl_syncinput is 0.
|
|
||||||
if (p->psectlotag == ST_2_UNDERWATER)
|
|
||||||
{
|
|
||||||
*avel = (*avel - (*avel / 8.f)) * sgn(TICSPERFRAME);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
*avel = *avel * sgn(TICSPERFRAME);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -826,23 +796,23 @@ void processavel(player_struct* p, float* avel)
|
||||||
//
|
//
|
||||||
//---------------------------------------------------------------------------
|
//---------------------------------------------------------------------------
|
||||||
|
|
||||||
void backuppos(player_struct* p, bool noclipping)
|
void player_struct::backuppos(bool noclipping)
|
||||||
{
|
{
|
||||||
if (!noclipping)
|
if (!noclipping)
|
||||||
{
|
{
|
||||||
p->oposx = p->posx;
|
oposx = posx;
|
||||||
p->oposy = p->posy;
|
oposy = posy;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
p->posx = p->oposx;
|
posx = oposx;
|
||||||
p->posy = p->oposy;
|
posy = oposy;
|
||||||
}
|
}
|
||||||
|
|
||||||
p->oposz = p->posz;
|
oposz = posz;
|
||||||
p->bobposx = p->posx;
|
bobposx = posx;
|
||||||
p->bobposy = p->posy;
|
bobposy = posy;
|
||||||
p->opyoff = p->pyoff;
|
opyoff = pyoff;
|
||||||
}
|
}
|
||||||
|
|
||||||
//---------------------------------------------------------------------------
|
//---------------------------------------------------------------------------
|
||||||
|
@ -851,13 +821,13 @@ void backuppos(player_struct* p, bool noclipping)
|
||||||
//
|
//
|
||||||
//---------------------------------------------------------------------------
|
//---------------------------------------------------------------------------
|
||||||
|
|
||||||
void backupweapon(player_struct* p)
|
void player_struct::backupweapon()
|
||||||
{
|
{
|
||||||
p->oweapon_sway = p->weapon_sway;
|
oweapon_sway = weapon_sway;
|
||||||
p->oweapon_pos = p->weapon_pos;
|
oweapon_pos = weapon_pos;
|
||||||
p->okickback_pic = p->kickback_pic;
|
okickback_pic = kickback_pic;
|
||||||
p->orandom_club_frame = p->random_club_frame;
|
orandom_club_frame = random_club_frame;
|
||||||
p->ohard_landing = p->hard_landing;
|
ohard_landing = hard_landing;
|
||||||
}
|
}
|
||||||
|
|
||||||
//---------------------------------------------------------------------------
|
//---------------------------------------------------------------------------
|
||||||
|
@ -866,34 +836,34 @@ void backupweapon(player_struct* p)
|
||||||
//
|
//
|
||||||
//---------------------------------------------------------------------------
|
//---------------------------------------------------------------------------
|
||||||
|
|
||||||
void checkhardlanding(player_struct* p)
|
void player_struct::checkhardlanding()
|
||||||
{
|
{
|
||||||
if (p->hard_landing > 0)
|
if (hard_landing > 0)
|
||||||
{
|
{
|
||||||
p->horizon.addadjustment(-(p->hard_landing << 4));
|
horizon.addadjustment(-(hard_landing << 4));
|
||||||
p->hard_landing--;
|
hard_landing--;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void playerweaponsway(player_struct* p, spritetype* s)
|
void player_struct::playerweaponsway(int xvel)
|
||||||
{
|
{
|
||||||
if (cl_weaponsway)
|
if (cl_weaponsway)
|
||||||
{
|
{
|
||||||
if (s->xvel < 32 || p->on_ground == 0 || p->bobcounter == 1024)
|
if (xvel < 32 || on_ground == 0 || bobcounter == 1024)
|
||||||
{
|
{
|
||||||
if ((p->weapon_sway & 2047) > (1024 + 96))
|
if ((weapon_sway & 2047) > (1024 + 96))
|
||||||
p->weapon_sway -= 96;
|
weapon_sway -= 96;
|
||||||
else if ((p->weapon_sway & 2047) < (1024 - 96))
|
else if ((weapon_sway & 2047) < (1024 - 96))
|
||||||
p->weapon_sway += 96;
|
weapon_sway += 96;
|
||||||
else p->oweapon_sway = p->weapon_sway = 1024;
|
else oweapon_sway = weapon_sway = 1024;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
p->weapon_sway = p->bobcounter;
|
weapon_sway = bobcounter;
|
||||||
|
|
||||||
if ((p->bobcounter - p->oweapon_sway) > 256)
|
if ((bobcounter - oweapon_sway) > 256)
|
||||||
{
|
{
|
||||||
p->oweapon_sway = p->weapon_sway;
|
oweapon_sway = weapon_sway;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -2850,12 +2850,12 @@ void processinput_d(int snum)
|
||||||
if (p->on_crane != nullptr)
|
if (p->on_crane != nullptr)
|
||||||
goto HORIZONLY;
|
goto HORIZONLY;
|
||||||
|
|
||||||
playerweaponsway(p, s);
|
p->playerweaponsway(s->xvel);
|
||||||
|
|
||||||
s->xvel = clamp(ksqrt((p->posx - p->bobposx) * (p->posx - p->bobposx) + (p->posy - p->bobposy) * (p->posy - p->bobposy)), 0, 512);
|
s->xvel = clamp(ksqrt((p->posx - p->bobposx) * (p->posx - p->bobposx) + (p->posy - p->bobposy) * (p->posy - p->bobposy)), 0, 512);
|
||||||
if (p->on_ground) p->bobcounter += p->GetActor()->s.xvel >> 1;
|
if (p->on_ground) p->bobcounter += p->GetActor()->s.xvel >> 1;
|
||||||
|
|
||||||
backuppos(p, ud.clipping == 0 && (sector[p->cursectnum].floorpicnum == MIRROR || p->cursectnum < 0 || p->cursectnum >= MAXSECTORS));
|
p->backuppos(ud.clipping == 0 && (sector[p->cursectnum].floorpicnum == MIRROR || p->cursectnum < 0 || p->cursectnum >= MAXSECTORS));
|
||||||
|
|
||||||
// Shrinking code
|
// Shrinking code
|
||||||
|
|
||||||
|
@ -2889,7 +2889,7 @@ void processinput_d(int snum)
|
||||||
//ENGINE calculates angvel for you
|
//ENGINE calculates angvel for you
|
||||||
// may still be needed later for demo recording
|
// may still be needed later for demo recording
|
||||||
|
|
||||||
processavel(p, &sb_avel);
|
sb_avel = p->adjustavel(sb_avel);
|
||||||
applylook(&p->angle, sb_avel, &p->sync.actions);
|
applylook(&p->angle, sb_avel, &p->sync.actions);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -3126,7 +3126,7 @@ HORIZONLY:
|
||||||
sethorizon(&p->horizon.horiz, PlayerHorizon(snum), &p->sync.actions);
|
sethorizon(&p->horizon.horiz, PlayerHorizon(snum), &p->sync.actions);
|
||||||
}
|
}
|
||||||
|
|
||||||
checkhardlanding(p);
|
p->checkhardlanding();
|
||||||
|
|
||||||
//Shooting code/changes
|
//Shooting code/changes
|
||||||
|
|
||||||
|
|
|
@ -3574,12 +3574,12 @@ void processinput_r(int snum)
|
||||||
if (p->on_crane != nullptr)
|
if (p->on_crane != nullptr)
|
||||||
goto HORIZONLY;
|
goto HORIZONLY;
|
||||||
|
|
||||||
playerweaponsway(p, s);
|
p->playerweaponsway(s->xvel);
|
||||||
|
|
||||||
s->xvel = clamp(ksqrt((p->posx - p->bobposx) * (p->posx - p->bobposx) + (p->posy - p->bobposy) * (p->posy - p->bobposy)), 0, 512);
|
s->xvel = clamp(ksqrt((p->posx - p->bobposx) * (p->posx - p->bobposx) + (p->posy - p->bobposy) * (p->posy - p->bobposy)), 0, 512);
|
||||||
if (p->on_ground) p->bobcounter += p->GetActor()->s.xvel >> 1;
|
if (p->on_ground) p->bobcounter += p->GetActor()->s.xvel >> 1;
|
||||||
|
|
||||||
backuppos(p, ud.clipping == 0 && (sector[p->cursectnum].floorpicnum == MIRROR || p->cursectnum < 0 || p->cursectnum >= MAXSECTORS));
|
p->backuppos(ud.clipping == 0 && (sector[p->cursectnum].floorpicnum == MIRROR || p->cursectnum < 0 || p->cursectnum >= MAXSECTORS));
|
||||||
|
|
||||||
// Shrinking code
|
// Shrinking code
|
||||||
|
|
||||||
|
@ -3629,9 +3629,9 @@ void processinput_r(int snum)
|
||||||
//ENGINE calculates angvel for you
|
//ENGINE calculates angvel for you
|
||||||
// may still be needed later for demo recording
|
// may still be needed later for demo recording
|
||||||
|
|
||||||
processavel(p, &sb_avel);
|
sb_avel = p->adjustavel(sb_avel);
|
||||||
applylook(&p->angle, sb_avel, &p->sync.actions);
|
applylook(&p->angle, sb_avel, &p->sync.actions);
|
||||||
apply_seasick(p, 1);
|
p->apply_seasick(1);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (p->spritebridge == 0)
|
if (p->spritebridge == 0)
|
||||||
|
@ -3996,7 +3996,7 @@ HORIZONLY:
|
||||||
sethorizon(&p->horizon.horiz, PlayerHorizon(snum), &p->sync.actions);
|
sethorizon(&p->horizon.horiz, PlayerHorizon(snum), &p->sync.actions);
|
||||||
}
|
}
|
||||||
|
|
||||||
checkhardlanding(p);
|
p->checkhardlanding();
|
||||||
|
|
||||||
//Shooting code/changes
|
//Shooting code/changes
|
||||||
|
|
||||||
|
|
|
@ -501,7 +501,7 @@ void resetpspritevars(int g)
|
||||||
short circ;
|
short circ;
|
||||||
int firstx, firsty;
|
int firstx, firsty;
|
||||||
spritetype* s;
|
spritetype* s;
|
||||||
int aimmode[MAXPLAYERS], autoaim[MAXPLAYERS];
|
int aimmode[MAXPLAYERS];
|
||||||
STATUSBARTYPE tsbar[MAXPLAYERS];
|
STATUSBARTYPE tsbar[MAXPLAYERS];
|
||||||
|
|
||||||
EGS(ps[0].cursectnum, ps[0].posx, ps[0].posy, ps[0].posz,
|
EGS(ps[0].cursectnum, ps[0].posx, ps[0].posy, ps[0].posz,
|
||||||
|
@ -510,7 +510,6 @@ void resetpspritevars(int g)
|
||||||
if (ud.recstat != 2) for (i = 0; i < MAXPLAYERS; i++)
|
if (ud.recstat != 2) for (i = 0; i < MAXPLAYERS; i++)
|
||||||
{
|
{
|
||||||
aimmode[i] = ps[i].aim_mode;
|
aimmode[i] = ps[i].aim_mode;
|
||||||
autoaim[i] = ps[i].auto_aim;
|
|
||||||
if (ud.multimode > 1 && ud.coop == 1 && ud.last_level >= 0)
|
if (ud.multimode > 1 && ud.coop == 1 && ud.last_level >= 0)
|
||||||
{
|
{
|
||||||
for (j = 0; j < MAX_WEAPONS; j++)
|
for (j = 0; j < MAX_WEAPONS; j++)
|
||||||
|
@ -541,7 +540,6 @@ void resetpspritevars(int g)
|
||||||
if (ud.recstat != 2) for (i = 0; i < MAXPLAYERS; i++)
|
if (ud.recstat != 2) for (i = 0; i < MAXPLAYERS; i++)
|
||||||
{
|
{
|
||||||
ps[i].aim_mode = aimmode[i];
|
ps[i].aim_mode = aimmode[i];
|
||||||
ps[i].auto_aim = autoaim[i];
|
|
||||||
if (ud.multimode > 1 && ud.coop == 1 && ud.last_level >= 0)
|
if (ud.multimode > 1 && ud.coop == 1 && ud.last_level >= 0)
|
||||||
{
|
{
|
||||||
for (j = 0; j < MAX_WEAPONS; j++)
|
for (j = 0; j < MAX_WEAPONS; j++)
|
||||||
|
@ -997,7 +995,6 @@ void startnewgame(MapRecord* map, int skill)
|
||||||
{
|
{
|
||||||
enterlevel(map, 0);
|
enterlevel(map, 0);
|
||||||
ud.showweapons = cl_showweapon;
|
ud.showweapons = cl_showweapon;
|
||||||
setlocalplayerinput(&ps[myconnectindex]);
|
|
||||||
PlayerColorChanged();
|
PlayerColorChanged();
|
||||||
inputState.ClearAllInput();
|
inputState.ClearAllInput();
|
||||||
gameaction = ga_level;
|
gameaction = ga_level;
|
||||||
|
|
|
@ -115,7 +115,6 @@ FSerializer& Serialize(FSerializer& arc, const char* keyname, player_struct& w,
|
||||||
("randomflamex", w.randomflamex)
|
("randomflamex", w.randomflamex)
|
||||||
("crack_time", w.crack_time)
|
("crack_time", w.crack_time)
|
||||||
("aim.mode", w.aim_mode)
|
("aim.mode", w.aim_mode)
|
||||||
("auto_aim", w.auto_aim)
|
|
||||||
("psectlotag", w.psectlotag)
|
("psectlotag", w.psectlotag)
|
||||||
("cursectnum", w.cursectnum)
|
("cursectnum", w.cursectnum)
|
||||||
("last_extra", w.last_extra)
|
("last_extra", w.last_extra)
|
||||||
|
|
|
@ -126,7 +126,6 @@ struct user_defs
|
||||||
int levelclock;
|
int levelclock;
|
||||||
unsigned char god, cashman, eog;
|
unsigned char god, cashman, eog;
|
||||||
unsigned char clipping;
|
unsigned char clipping;
|
||||||
char user_name[MAXPLAYERS][32];
|
|
||||||
unsigned char showweapons;
|
unsigned char showweapons;
|
||||||
unsigned char user_pals[MAXPLAYERS];
|
unsigned char user_pals[MAXPLAYERS];
|
||||||
|
|
||||||
|
@ -202,7 +201,7 @@ struct player_struct
|
||||||
int bobcounter;
|
int bobcounter;
|
||||||
int randomflamex, crack_time;
|
int randomflamex, crack_time;
|
||||||
|
|
||||||
int aim_mode, auto_aim, ftt;
|
int aim_mode, ftt;
|
||||||
|
|
||||||
short cursectnum, last_extra, subweapon;
|
short cursectnum, last_extra, subweapon;
|
||||||
short ammo_amount[MAX_WEAPONS], frag, fraggedself;
|
short ammo_amount[MAX_WEAPONS], frag, fraggedself;
|
||||||
|
@ -284,6 +283,18 @@ struct player_struct
|
||||||
DDukeActor* GetActor();
|
DDukeActor* GetActor();
|
||||||
int GetPlayerNum();
|
int GetPlayerNum();
|
||||||
|
|
||||||
|
void apply_seasick(double factor);
|
||||||
|
void backuppos(bool noclipping = false);
|
||||||
|
void backupweapon();
|
||||||
|
void checkhardlanding();
|
||||||
|
void playerweaponsway(int xvel);
|
||||||
|
|
||||||
|
float adjustavel(float avel)
|
||||||
|
{
|
||||||
|
return (psectlotag == ST_2_UNDERWATER)? avel * 0.875f : avel;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
// Wrapper around the insane collision info mess from Build.
|
// Wrapper around the insane collision info mess from Build.
|
||||||
|
|
|
@ -424,7 +424,7 @@ void InitPlayerGameSettings(void)
|
||||||
// everyone gets the same Auto Aim
|
// everyone gets the same Auto Aim
|
||||||
TRAVERSE_CONNECT(pnum)
|
TRAVERSE_CONNECT(pnum)
|
||||||
{
|
{
|
||||||
if (gNet.AutoAim)
|
if (Autoaim(pnum))
|
||||||
SET(Player[pnum].Flags, PF_AUTO_AIM);
|
SET(Player[pnum].Flags, PF_AUTO_AIM);
|
||||||
else
|
else
|
||||||
RESET(Player[pnum].Flags, PF_AUTO_AIM);
|
RESET(Player[pnum].Flags, PF_AUTO_AIM);
|
||||||
|
@ -432,7 +432,7 @@ void InitPlayerGameSettings(void)
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
if (cl_autoaim)
|
if (Autoaim(myconnectindex))
|
||||||
SET(Player[myconnectindex].Flags, PF_AUTO_AIM);
|
SET(Player[myconnectindex].Flags, PF_AUTO_AIM);
|
||||||
else
|
else
|
||||||
RESET(Player[myconnectindex].Flags, PF_AUTO_AIM);
|
RESET(Player[myconnectindex].Flags, PF_AUTO_AIM);
|
||||||
|
|
|
@ -93,7 +93,7 @@ static void processInputBits(PLAYERp const pp, ControlInfo* const hidInput)
|
||||||
else
|
else
|
||||||
RESET(Player[myconnectindex].Flags, PF_MOUSE_AIMING_ON);
|
RESET(Player[myconnectindex].Flags, PF_MOUSE_AIMING_ON);
|
||||||
|
|
||||||
if (cl_autoaim)
|
if (Autoaim(myconnectindex))
|
||||||
SET(Player[myconnectindex].Flags, PF_AUTO_AIM);
|
SET(Player[myconnectindex].Flags, PF_AUTO_AIM);
|
||||||
else
|
else
|
||||||
RESET(Player[myconnectindex].Flags, PF_AUTO_AIM);
|
RESET(Player[myconnectindex].Flags, PF_AUTO_AIM);
|
||||||
|
|
Loading…
Reference in a new issue