mirror of
https://github.com/ZDoom/raze-gles.git
synced 2024-11-10 14:52:01 +00:00
- Allow ticker to lock input to player's angle and horizon without having to force use of synchronised input.
This commit is contained in:
parent
58ed7f8745
commit
ca65c4c9da
2 changed files with 43 additions and 3 deletions
|
@ -246,8 +246,8 @@ void processMovement(InputPacket* currInput, InputPacket* inputBuffer, ControlIn
|
||||||
|
|
||||||
void PlayerHorizon::applyinput(float const horz, ESyncBits* actions, double const scaleAdjust)
|
void PlayerHorizon::applyinput(float const horz, ESyncBits* actions, double const scaleAdjust)
|
||||||
{
|
{
|
||||||
// Process only if no targeted horizon set.
|
// Process only if movewment isn't locked.
|
||||||
if (!targetset())
|
if (!movementlocked())
|
||||||
{
|
{
|
||||||
// Store current horizon as true pitch.
|
// Store current horizon as true pitch.
|
||||||
double pitch = horiz.aspitch();
|
double pitch = horiz.aspitch();
|
||||||
|
@ -342,7 +342,7 @@ void PlayerAngle::applyinput(float const avel, ESyncBits* actions, double const
|
||||||
rotscrnang += buildfang(scaleAdjust * -(720. / GameTicRate));
|
rotscrnang += buildfang(scaleAdjust * -(720. / GameTicRate));
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!targetset())
|
if (!movementlocked())
|
||||||
{
|
{
|
||||||
if (*actions & SB_TURNAROUND)
|
if (*actions & SB_TURNAROUND)
|
||||||
{
|
{
|
||||||
|
@ -450,6 +450,7 @@ FSerializer& Serialize(FSerializer& arc, const char* keyname, PlayerAngle& w, Pl
|
||||||
("lookang", w.look_ang)
|
("lookang", w.look_ang)
|
||||||
("rotscrnang", w.rotscrnang)
|
("rotscrnang", w.rotscrnang)
|
||||||
("spin", w.spin)
|
("spin", w.spin)
|
||||||
|
("inputdisabled", w.inputdisabled)
|
||||||
.EndObject();
|
.EndObject();
|
||||||
|
|
||||||
if (arc.isReading())
|
if (arc.isReading())
|
||||||
|
@ -457,6 +458,7 @@ FSerializer& Serialize(FSerializer& arc, const char* keyname, PlayerAngle& w, Pl
|
||||||
w.oang = w.ang;
|
w.oang = w.ang;
|
||||||
w.olook_ang = w.look_ang;
|
w.olook_ang = w.look_ang;
|
||||||
w.orotscrnang = w.rotscrnang;
|
w.orotscrnang = w.rotscrnang;
|
||||||
|
w.inputdisabled = w.inputdisabled;
|
||||||
w.resetadjustment();
|
w.resetadjustment();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -469,12 +471,14 @@ FSerializer& Serialize(FSerializer& arc, const char* keyname, PlayerHorizon& w,
|
||||||
{
|
{
|
||||||
arc("horiz", w.horiz)
|
arc("horiz", w.horiz)
|
||||||
("horizoff", w.horizoff)
|
("horizoff", w.horizoff)
|
||||||
|
("inputdisabled", w.inputdisabled)
|
||||||
.EndObject();
|
.EndObject();
|
||||||
|
|
||||||
if (arc.isReading())
|
if (arc.isReading())
|
||||||
{
|
{
|
||||||
w.ohoriz = w.horiz;
|
w.ohoriz = w.horiz;
|
||||||
w.ohorizoff = w.horizoff;
|
w.ohorizoff = w.horizoff;
|
||||||
|
w.inputdisabled = w.inputdisabled;
|
||||||
w.resetadjustment();
|
w.resetadjustment();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -13,6 +13,8 @@ struct PlayerHorizon
|
||||||
{
|
{
|
||||||
fixedhoriz horiz, ohoriz, horizoff, ohorizoff;
|
fixedhoriz horiz, ohoriz, horizoff, ohorizoff;
|
||||||
|
|
||||||
|
friend FSerializer& Serialize(FSerializer& arc, const char* keyname, PlayerHorizon& w, PlayerHorizon* def);
|
||||||
|
|
||||||
void backup()
|
void backup()
|
||||||
{
|
{
|
||||||
ohoriz = horiz;
|
ohoriz = horiz;
|
||||||
|
@ -50,11 +52,26 @@ struct PlayerHorizon
|
||||||
__settarget(value, backup);
|
__settarget(value, backup);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void lockinput()
|
||||||
|
{
|
||||||
|
inputdisabled = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
void unlockinput()
|
||||||
|
{
|
||||||
|
inputdisabled = false;
|
||||||
|
}
|
||||||
|
|
||||||
bool targetset()
|
bool targetset()
|
||||||
{
|
{
|
||||||
return target.asq16();
|
return target.asq16();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool movementlocked()
|
||||||
|
{
|
||||||
|
return target.asq16() || inputdisabled;
|
||||||
|
}
|
||||||
|
|
||||||
void processhelpers(double const scaleAdjust)
|
void processhelpers(double const scaleAdjust)
|
||||||
{
|
{
|
||||||
if (targetset())
|
if (targetset())
|
||||||
|
@ -103,6 +120,7 @@ struct PlayerHorizon
|
||||||
private:
|
private:
|
||||||
fixedhoriz target;
|
fixedhoriz target;
|
||||||
double adjustment;
|
double adjustment;
|
||||||
|
bool inputdisabled;
|
||||||
|
|
||||||
void __addadjustment(fixedhoriz value)
|
void __addadjustment(fixedhoriz value)
|
||||||
{
|
{
|
||||||
|
@ -138,6 +156,8 @@ struct PlayerAngle
|
||||||
binangle ang, oang, look_ang, olook_ang, rotscrnang, orotscrnang;
|
binangle ang, oang, look_ang, olook_ang, rotscrnang, orotscrnang;
|
||||||
double spin;
|
double spin;
|
||||||
|
|
||||||
|
friend FSerializer& Serialize(FSerializer& arc, const char* keyname, PlayerAngle& w, PlayerAngle* def);
|
||||||
|
|
||||||
void backup()
|
void backup()
|
||||||
{
|
{
|
||||||
oang = ang;
|
oang = ang;
|
||||||
|
@ -177,11 +197,26 @@ struct PlayerAngle
|
||||||
__settarget(value, backup);
|
__settarget(value, backup);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void lockinput()
|
||||||
|
{
|
||||||
|
inputdisabled = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
void unlockinput()
|
||||||
|
{
|
||||||
|
inputdisabled = false;
|
||||||
|
}
|
||||||
|
|
||||||
bool targetset()
|
bool targetset()
|
||||||
{
|
{
|
||||||
return target.asbam();
|
return target.asbam();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool movementlocked()
|
||||||
|
{
|
||||||
|
return target.asq16() || inputdisabled;
|
||||||
|
}
|
||||||
|
|
||||||
void processhelpers(double const scaleAdjust)
|
void processhelpers(double const scaleAdjust)
|
||||||
{
|
{
|
||||||
if (targetset())
|
if (targetset())
|
||||||
|
@ -244,6 +279,7 @@ struct PlayerAngle
|
||||||
private:
|
private:
|
||||||
binangle target;
|
binangle target;
|
||||||
double adjustment;
|
double adjustment;
|
||||||
|
bool inputdisabled;
|
||||||
|
|
||||||
void __addadjustment(binangle value)
|
void __addadjustment(binangle value)
|
||||||
{
|
{
|
||||||
|
|
Loading…
Reference in a new issue