- SW: Add Duke's input helpers and adjust to suit SW.

* These are temporary until a backend solution is available after all games have had initial uplift.
This commit is contained in:
Mitchell Richters 2020-09-07 20:35:35 +10:00
parent 40a00be202
commit 584ec935ed
3 changed files with 66 additions and 0 deletions

View file

@ -1007,6 +1007,13 @@ struct PLAYERstruct
int cookieTime;
char WpnReloadState;
// Input helper variables and setters.
double horizAdjust, angAdjust, pitchAdjust;
void addang(int v) { q16ang = (q16ang + IntToFixed(v)) & 0x7FFFFFF; }
void setang(int v) { q16ang = IntToFixed(v); }
void addhoriz(int v) { q16horiz += (IntToFixed(v)); }
void sethoriz(int v) { q16horiz = IntToFixed(v); }
};
extern PLAYER Player[MAX_SW_PLAYERS_REG+1];

View file

@ -7785,6 +7785,60 @@ void CheckFootPrints(PLAYERp pp)
}
}
//---------------------------------------------------------------------------
//
// Unsynchronised input helpers.
//
//---------------------------------------------------------------------------
void playerAddAngle(PLAYERp pp, int ang)
{
if (!cl_syncinput)
{
pp->angAdjust += ang;
}
else
{
pp->addang(ang);
}
}
void playerSetAngle(PLAYERp pp, int ang)
{
if (!cl_syncinput)
{
pp->angAdjust += -1. * ((pp->q16ang / 65536.) - ang);
}
else
{
pp->setang(ang);
}
}
void playerAddHoriz(PLAYERp pp, int horiz)
{
if (!cl_syncinput)
{
pp->horizAdjust += horiz;
}
else
{
pp->addhoriz(horiz);
}
}
void playerSetHoriz(PLAYERp pp, int horiz)
{
if (!cl_syncinput)
{
pp->horizAdjust += -1. * ((pp->q16horiz / 65536.) - horiz);
}
else
{
pp->sethoriz(horiz);
}
}
//---------------------------------------------------------------------------
//
//

View file

@ -144,6 +144,11 @@ void PlaySOsound(short sectnum,short sound_num);
void DoSpawnTeleporterEffectPlace(SPRITEp sp);
void FindMainSector(SECTOR_OBJECTp sop);
void playerAddAngle(PLAYERp pp, int ang);
void playerSetAngle(PLAYERp pp, int ang);
void playerAddHoriz(PLAYERp pp, int horiz);
void playerSetHoriz(PLAYERp pp, int horiz);
END_SW_NS
#endif