- fix weapon selection in Exhumed.

Like Blood it looks like the request isn't processed immediately so it needs to stick around.
This commit is contained in:
Christoph Oelckers 2020-08-26 16:54:54 +02:00
parent d0655a1068
commit c1b1182f90
3 changed files with 12 additions and 16 deletions

View file

@ -138,7 +138,6 @@ short nEnergyTowers = 0;
short nCfgNetPlayers = 0;
FILE *vcrfp = NULL;
int lLocalButtons = 0;
int lLocalCodes = 0;
short bCoordinates = false;
@ -491,7 +490,7 @@ void GameTicker()
if (!((int)ogameclock & 3) && moveframes < 4)
moveframes++;
GetLocalInput();
int lLocalButtons = GetLocalInput(); // shouldn't this be placed in localInput?
PlayerInterruptKeys();
nPlayerDAng = fix16_sadd(nPlayerDAng, localInput.nAngle);
@ -504,6 +503,8 @@ void GameTicker()
sPlayerInput[nLocalPlayer].xVel = lPlayerXVel;
sPlayerInput[nLocalPlayer].yVel = lPlayerYVel;
// make weapon selection persist until it gets used up.
if ((lLocalButtons & kButtonWeaponBits) == 0) lLocalButtons |= sPlayerInput[nLocalPlayer].buttons & kButtonWeaponBits;
sPlayerInput[nLocalPlayer].buttons = lLocalButtons | lLocalCodes;
sPlayerInput[nLocalPlayer].nAngle = nPlayerDAng;
sPlayerInput[nLocalPlayer].nTarget = besttarget;

View file

@ -77,17 +77,15 @@ void ClearSpaceBar(short nPlayer)
buttonMap.ClearButton(gamefunc_Open);
}
void GetLocalInput()
int GetLocalInput()
{
int i = WeaponToSend;
if (WeaponToSend == PlayerList[nLocalPlayer].nCurrentWeapon)
WeaponToSend = 0;
int lLocalButtons;
if (PlayerList[nLocalPlayer].nHealth)
{
lLocalButtons = (buttonMap.ButtonDown(gamefunc_Crouch) << 4) | (buttonMap.ButtonDown(gamefunc_Fire) << 3)
| (buttonMap.ButtonDown(gamefunc_Jump) << 0);
lLocalCodes |= (i << 13);
lLocalButtons |= (WeaponToSend << 13);
WeaponToSend = 0;
}
else
{
@ -95,8 +93,7 @@ void GetLocalInput()
}
lLocalButtons |= buttonMap.ButtonDown(gamefunc_Open) << 2;
// TODO ExecRecord(&sPlayerInput[nLocalPlayer], sizeof(PlayerInput));
return lLocalButtons;
}
void BackupInput()

View file

@ -32,6 +32,9 @@ enum {
kButtonCheatGodMode = 0x40,
kButtonCheatKeys = 0x80,
kButtonCheatItems = 0x100,
kButtonWeaponShift = 13,
kButtonWeaponBits = 7 << kButtonWeaponShift, // upper 3 bits.
};
// 32 bytes
@ -39,16 +42,11 @@ struct PlayerInput // TODO consider adjusting this for demo compatibility
{
int xVel;
int yVel;
// short nAngle;
fix16_t nAngle;
uint16_t buttons;
short nTarget;
// uint8_t horizon;
fix16_t horizon;
int8_t nItem;
int h;
char i;
char field_15[11];
};
void InitInput();
@ -57,7 +55,7 @@ void UpdateInputs();
void ClearSpaceBar(short nPlayer);
void GetLocalInput();
int GetLocalInput();
extern PlayerInput sPlayerInput[];
extern PlayerInput localInput;