- merged the bit fields in Blood's packet structure.

Whatever this was for it made that thing extremely unwieldy.
With these merged the resulting structure doesn't look much different from Duke's anymore.
This commit is contained in:
Christoph Oelckers 2020-08-26 16:48:33 +02:00
parent b76168f673
commit 3fc79940f2
9 changed files with 165 additions and 207 deletions

View file

@ -4749,7 +4749,7 @@ void MoveDude(spritetype *pSprite)
if (pPlayer) { if (pPlayer) {
pPlayer->posture = 0; pPlayer->posture = 0;
pPlayer->bubbleTime = 0; pPlayer->bubbleTime = 0;
if (!pPlayer->cantJump && pPlayer->input.buttonFlags.jump) { if (!pPlayer->cantJump && pPlayer->input.syncFlags.jump) {
zvel[nSprite] = -0x6aaaa; zvel[nSprite] = -0x6aaaa;
pPlayer->cantJump = 1; pPlayer->cantJump = 1;
} }

View file

@ -525,11 +525,10 @@ void ProcessFrame(void)
char buffer[128]; char buffer[128];
for (int i = connecthead; i >= 0; i = connectpoint2[i]) for (int i = connecthead; i >= 0; i = connectpoint2[i])
{ {
gPlayer[i].input.buttonFlags = gFifoInput[gNetFifoTail&255][i].buttonFlags; gPlayer[i].input.syncFlags.value &= ~flag_buttonmask;
gPlayer[i].input.keyFlags.word |= gFifoInput[gNetFifoTail&255][i].keyFlags.word; gPlayer[i].input.syncFlags.value |= gFifoInput[gNetFifoTail & 255][i].syncFlags.value;
gPlayer[i].input.useFlags.byte |= gFifoInput[gNetFifoTail&255][i].useFlags.byte; if (gFifoInput[gNetFifoTail&255][i].syncFlags.newWeapon)
if (gFifoInput[gNetFifoTail&255][i].newWeapon) gPlayer[i].newWeapon = gFifoInput[gNetFifoTail&255][i].syncFlags.newWeapon;
gPlayer[i].input.newWeapon = gFifoInput[gNetFifoTail&255][i].newWeapon;
gPlayer[i].input.forward = gFifoInput[gNetFifoTail&255][i].forward; gPlayer[i].input.forward = gFifoInput[gNetFifoTail&255][i].forward;
gPlayer[i].input.q16turn = gFifoInput[gNetFifoTail&255][i].q16turn; gPlayer[i].input.q16turn = gFifoInput[gNetFifoTail&255][i].q16turn;
gPlayer[i].input.strafe = gFifoInput[gNetFifoTail&255][i].strafe; gPlayer[i].input.strafe = gFifoInput[gNetFifoTail&255][i].strafe;
@ -539,9 +538,9 @@ void ProcessFrame(void)
for (int i = connecthead; i >= 0; i = connectpoint2[i]) for (int i = connecthead; i >= 0; i = connectpoint2[i])
{ {
if (gPlayer[i].input.keyFlags.quit) if (gPlayer[i].input.syncFlags.quit)
{ {
gPlayer[i].input.keyFlags.quit = 0; gPlayer[i].input.syncFlags.quit = 0;
netBroadcastPlayerLogoff(i); netBroadcastPlayerLogoff(i);
if (i == myconnectindex) if (i == myconnectindex)
{ {
@ -553,15 +552,15 @@ void ProcessFrame(void)
return; return;
} }
} }
if (gPlayer[i].input.keyFlags.restart) if (gPlayer[i].input.syncFlags.restart)
{ {
gPlayer[i].input.keyFlags.restart = 0; gPlayer[i].input.syncFlags.restart = 0;
levelRestart(); levelRestart();
return; return;
} }
if (gPlayer[i].input.keyFlags.pause) if (gPlayer[i].input.syncFlags.pause)
{ {
gPlayer[i].input.keyFlags.pause = 0; gPlayer[i].input.syncFlags.pause = 0;
if (paused && gGameOptions.nGameType > 0 && numplayers > 1) if (paused && gGameOptions.nGameType > 0 && numplayers > 1)
{ {
sprintf(buffer,"%s paused the game",gProfile[i].name); sprintf(buffer,"%s paused the game",gProfile[i].name);

View file

@ -45,8 +45,7 @@ bool bSilentAim = false;
int iTurnCount = 0; int iTurnCount = 0;
static int WeaponToSend; static int WeaponToSend;
static KEYFLAGS BitsToSend; static SYNCFLAGS BitsToSend;
static USEFLAGS UsesToSend;
void ctrlInit(void) void ctrlInit(void)
{ {
@ -128,7 +127,7 @@ void ctrlGetInput(void)
if (paused != prevPauseState) if (paused != prevPauseState)
{ {
gInput.keyFlags.pause = 1; gInput.syncFlags.pause = 1;
} }
if (paused) if (paused)
@ -137,7 +136,7 @@ void ctrlGetInput(void)
GINPUT input = {}; GINPUT input = {};
bool mouseaim = in_mousemode || buttonMap.ButtonDown(gamefunc_Mouse_Aiming); bool mouseaim = in_mousemode || buttonMap.ButtonDown(gamefunc_Mouse_Aiming);
if (!mouseaim) gInput.keyFlags.lookCenter = 1; if (!mouseaim) gInput.syncFlags.lookCenter = 1;
if (numplayers == 1) if (numplayers == 1)
{ {
@ -148,15 +147,13 @@ void ctrlGetInput(void)
CONTROL_GetInput(&info); CONTROL_GetInput(&info);
if (gQuitRequest) if (gQuitRequest)
gInput.keyFlags.quit = 1; gInput.syncFlags.quit = 1;
gInput.keyFlags.word |= BitsToSend.word; gInput.syncFlags.value |= BitsToSend.value;
gInput.useFlags.byte |= UsesToSend.byte;
if (WeaponToSend != 0) if (WeaponToSend != 0)
gInput.newWeapon = WeaponToSend; gInput.syncFlags.newWeapon = WeaponToSend;
BitsToSend.word = 0; BitsToSend.value = 0;
UsesToSend.byte = 0;
WeaponToSend = 0; WeaponToSend = 0;
if (buttonMap.ButtonDown(gamefunc_Shrink_Screen)) if (buttonMap.ButtonDown(gamefunc_Shrink_Screen))
@ -188,32 +185,32 @@ void ctrlGetInput(void)
} }
if (buttonMap.ButtonDown(gamefunc_Jump)) if (buttonMap.ButtonDown(gamefunc_Jump))
gInput.buttonFlags.jump = 1; gInput.syncFlags.jump = 1;
if (buttonMap.ButtonDown(gamefunc_Crouch)) if (buttonMap.ButtonDown(gamefunc_Crouch))
gInput.buttonFlags.crouch = 1; gInput.syncFlags.crouch = 1;
if (buttonMap.ButtonDown(gamefunc_Fire)) if (buttonMap.ButtonDown(gamefunc_Fire))
gInput.buttonFlags.shoot = 1; gInput.syncFlags.shoot = 1;
if (buttonMap.ButtonDown(gamefunc_Alt_Fire)) if (buttonMap.ButtonDown(gamefunc_Alt_Fire))
gInput.buttonFlags.shoot2 = 1; gInput.syncFlags.shoot2 = 1;
if (buttonMap.ButtonDown(gamefunc_Open)) if (buttonMap.ButtonDown(gamefunc_Open))
{ {
buttonMap.ClearButton(gamefunc_Open); buttonMap.ClearButton(gamefunc_Open);
gInput.keyFlags.action = 1; gInput.syncFlags.action = 1;
} }
gInput.buttonFlags.lookUp |= buttonMap.ButtonDown(gamefunc_Look_Up); gInput.syncFlags.lookUp |= buttonMap.ButtonDown(gamefunc_Look_Up);
gInput.buttonFlags.lookDown |= buttonMap.ButtonDown(gamefunc_Look_Down); gInput.syncFlags.lookDown |= buttonMap.ButtonDown(gamefunc_Look_Down);
if (buttonMap.ButtonDown(gamefunc_Look_Up) || buttonMap.ButtonDown(gamefunc_Look_Down)) if (buttonMap.ButtonDown(gamefunc_Look_Up) || buttonMap.ButtonDown(gamefunc_Look_Down))
gInput.keyFlags.lookCenter = 1; gInput.syncFlags.lookCenter = 1;
else else
{ {
gInput.buttonFlags.lookUp |= buttonMap.ButtonDown(gamefunc_Aim_Up); gInput.syncFlags.lookUp |= buttonMap.ButtonDown(gamefunc_Aim_Up);
gInput.buttonFlags.lookDown |= buttonMap.ButtonDown(gamefunc_Aim_Down); gInput.syncFlags.lookDown |= buttonMap.ButtonDown(gamefunc_Aim_Down);
} }
int const run = G_CheckAutorun(buttonMap.ButtonDown(gamefunc_Run)); int const run = G_CheckAutorun(buttonMap.ButtonDown(gamefunc_Run));
@ -369,14 +366,14 @@ void registerinputcommands()
C_RegisterFunction("pause", nullptr, [](CCmdFuncPtr)->int { BitsToSend.pause = 1; sendPause = true; return CCMD_OK; }); C_RegisterFunction("pause", nullptr, [](CCmdFuncPtr)->int { BitsToSend.pause = 1; sendPause = true; return CCMD_OK; });
C_RegisterFunction("proximitybombs", nullptr, [](CCmdFuncPtr)->int { WeaponToSend = 11; return CCMD_OK; }); C_RegisterFunction("proximitybombs", nullptr, [](CCmdFuncPtr)->int { WeaponToSend = 11; return CCMD_OK; });
C_RegisterFunction("remotebombs", nullptr, [](CCmdFuncPtr)->int { WeaponToSend = 12; return CCMD_OK; }); C_RegisterFunction("remotebombs", nullptr, [](CCmdFuncPtr)->int { WeaponToSend = 12; return CCMD_OK; });
C_RegisterFunction("jumpboots", nullptr, [](CCmdFuncPtr)->int { UsesToSend.useJumpBoots = 1; return CCMD_OK; }); C_RegisterFunction("jumpboots", nullptr, [](CCmdFuncPtr)->int { BitsToSend.useJumpBoots = 1; return CCMD_OK; });
C_RegisterFunction("medkit", nullptr, [](CCmdFuncPtr)->int { UsesToSend.useMedKit = 1; return CCMD_OK; }); C_RegisterFunction("medkit", nullptr, [](CCmdFuncPtr)->int { BitsToSend.useMedKit = 1; return CCMD_OK; });
C_RegisterFunction("centerview", nullptr, [](CCmdFuncPtr)->int { BitsToSend.lookCenter = 1; return CCMD_OK; }); C_RegisterFunction("centerview", nullptr, [](CCmdFuncPtr)->int { BitsToSend.lookCenter = 1; return CCMD_OK; });
C_RegisterFunction("holsterweapon", nullptr, [](CCmdFuncPtr)->int { BitsToSend.holsterWeapon = 1; return CCMD_OK; }); C_RegisterFunction("holsterweapon", nullptr, [](CCmdFuncPtr)->int { BitsToSend.holsterWeapon = 1; return CCMD_OK; });
C_RegisterFunction("invprev", nullptr, [](CCmdFuncPtr)->int { BitsToSend.prevItem = 1; return CCMD_OK; }); C_RegisterFunction("invprev", nullptr, [](CCmdFuncPtr)->int { BitsToSend.prevItem = 1; return CCMD_OK; });
C_RegisterFunction("invnext", nullptr, [](CCmdFuncPtr)->int { BitsToSend.nextItem = 1; return CCMD_OK; }); C_RegisterFunction("invnext", nullptr, [](CCmdFuncPtr)->int { BitsToSend.nextItem = 1; return CCMD_OK; });
C_RegisterFunction("crystalball", nullptr, [](CCmdFuncPtr)->int { UsesToSend.useCrystalBall = 1; return CCMD_OK; }); C_RegisterFunction("crystalball", nullptr, [](CCmdFuncPtr)->int { BitsToSend.useCrystalBall = 1; return CCMD_OK; });
C_RegisterFunction("beastvision", nullptr, [](CCmdFuncPtr)->int { UsesToSend.useBeastVision = 1; return CCMD_OK; }); C_RegisterFunction("beastvision", nullptr, [](CCmdFuncPtr)->int { BitsToSend.useBeastVision = 1; return CCMD_OK; });
C_RegisterFunction("turnaround", nullptr, [](CCmdFuncPtr)->int { BitsToSend.spin180 = 1; return CCMD_OK; }); C_RegisterFunction("turnaround", nullptr, [](CCmdFuncPtr)->int { BitsToSend.spin180 = 1; return CCMD_OK; });
C_RegisterFunction("invuse", nullptr, [](CCmdFuncPtr)->int { BitsToSend.useItem = 1; return CCMD_OK; }); C_RegisterFunction("invuse", nullptr, [](CCmdFuncPtr)->int { BitsToSend.useItem = 1; return CCMD_OK; });
} }
@ -385,8 +382,7 @@ void registerinputcommands()
void GameInterface::clearlocalinputstate() void GameInterface::clearlocalinputstate()
{ {
WeaponToSend = 0; WeaponToSend = 0;
BitsToSend.word = 0; BitsToSend.value = 0;
UsesToSend.byte = 0;
} }

View file

@ -26,25 +26,24 @@ BEGIN_BLD_NS
#pragma pack(push, 1) #pragma pack(push, 1)
union BUTTONFLAGS enum
{ {
int8_t byte; flag_buttonmask = 127,
flag_buttonmask_norun = 126
};
union SYNCFLAGS
{
uint32_t value;
struct struct
{ {
unsigned int run : 1;
unsigned int jump : 1; unsigned int jump : 1;
unsigned int crouch : 1; unsigned int crouch : 1;
unsigned int shoot : 1; unsigned int shoot : 1;
unsigned int shoot2 : 1; unsigned int shoot2 : 1;
unsigned int lookUp : 1; unsigned int lookUp : 1;
unsigned int lookDown : 1; unsigned int lookDown : 1;
};
};
union KEYFLAGS
{
int16_t word;
struct
{
unsigned int action : 1; unsigned int action : 1;
unsigned int jab : 1; unsigned int jab : 1;
unsigned int prevItem : 1; unsigned int prevItem : 1;
@ -60,44 +59,19 @@ union KEYFLAGS
unsigned int pause : 1; unsigned int pause : 1;
unsigned int quit : 1; unsigned int quit : 1;
unsigned int restart : 1; unsigned int restart : 1;
};
};
union USEFLAGS
{
uint8_t byte;
struct
{
unsigned int useBeastVision : 1; unsigned int useBeastVision : 1;
unsigned int useCrystalBall : 1; unsigned int useCrystalBall : 1;
unsigned int useJumpBoots : 1; unsigned int useJumpBoots : 1;
unsigned int useMedKit : 1; unsigned int useMedKit : 1;
}; unsigned int newWeapon : 4;
};
union SYNCFLAGS
{
uint8_t byte;
struct
{
unsigned int buttonChange : 1;
unsigned int keyChange : 1;
unsigned int useChange : 1;
unsigned int weaponChange : 1;
unsigned int mlookChange : 1;
unsigned int run : 1;
}; };
}; };
struct GINPUT struct GINPUT
{ {
SYNCFLAGS syncFlags; SYNCFLAGS syncFlags;
int16_t forward; int16_t forward;
fix16_t q16turn;
int16_t strafe; int16_t strafe;
BUTTONFLAGS buttonFlags; fix16_t q16turn;
KEYFLAGS keyFlags;
USEFLAGS useFlags;
uint8_t newWeapon;
fix16_t q16mlook; fix16_t q16mlook;
}; };

View file

@ -1350,7 +1350,7 @@ void trPlayerCtrlStopScene(PLAYER* pPlayer) {
// restore weapon // restore weapon
if (pPlayer->pXSprite->health > 0) { if (pPlayer->pXSprite->health > 0) {
int oldWeapon = (pXSource && pXSource->dropMsg != 0) ? pXSource->dropMsg : 1; int oldWeapon = (pXSource && pXSource->dropMsg != 0) ? pXSource->dropMsg : 1;
pPlayer->input.newWeapon = pPlayer->curWeapon = oldWeapon; pPlayer->newWeapon = pPlayer->curWeapon = oldWeapon;
WeaponRaise(pPlayer); WeaponRaise(pPlayer);
} }
} }
@ -1590,7 +1590,7 @@ void trPlayerCtrlGiveStuff(XSPRITE* pXSource, PLAYER* pPlayer, TRPLAYERCTRL* pCt
XSPRITE* pXScene = &xsprite[sprite[pCtrl->qavScene.index].extra]; XSPRITE* pXScene = &xsprite[sprite[pCtrl->qavScene.index].extra];
pXScene->dropMsg = weapon; pXScene->dropMsg = weapon;
} else if (pPlayer->curWeapon != weapon) { } else if (pPlayer->curWeapon != weapon) {
pPlayer->input.newWeapon = weapon; pPlayer->newWeapon = weapon;
WeaponRaise(pPlayer); WeaponRaise(pPlayer);
} }
} }
@ -1990,7 +1990,7 @@ void usePropertiesChanger(XSPRITE* pXSource, short objType, int objIndex) {
xsprite[pSpr->extra].medium = kMediumNormal; xsprite[pSpr->extra].medium = kMediumNormal;
if (pPlayer) { if (pPlayer) {
pPlayer->posture = (!pPlayer->input.buttonFlags.crouch) ? kPostureStand : kPostureCrouch; pPlayer->posture = (!pPlayer->input.syncFlags.crouch) ? kPostureStand : kPostureCrouch;
pPlayer->nWaterPal = 0; pPlayer->nWaterPal = 0;
} }
@ -2087,7 +2087,7 @@ void useTeleportTarget(XSPRITE* pXSource, spritetype* pSprite) {
xsprite[pSprite->extra].medium = kMediumNormal; xsprite[pSprite->extra].medium = kMediumNormal;
if (pPlayer) { if (pPlayer) {
pPlayer->posture = (!pPlayer->input.buttonFlags.crouch) ? kPostureStand : kPostureCrouch; pPlayer->posture = (!pPlayer->input.syncFlags.crouch) ? kPostureStand : kPostureCrouch;
pPlayer->nWaterPal = 0; pPlayer->nWaterPal = 0;
} }
@ -2889,10 +2889,10 @@ bool condCheckPlayer(XSPRITE* pXCond, int cmpOp, bool PUSH) {
case 2: return (pPlayer->input.forward < 0); // backward case 2: return (pPlayer->input.forward < 0); // backward
case 3: return (pPlayer->input.strafe > 0); // left case 3: return (pPlayer->input.strafe > 0); // left
case 4: return (pPlayer->input.strafe < 0); // right case 4: return (pPlayer->input.strafe < 0); // right
case 5: return (pPlayer->input.buttonFlags.jump); // jump case 5: return (pPlayer->input.syncFlags.jump); // jump
case 6: return (pPlayer->input.buttonFlags.crouch); // crouch case 6: return (pPlayer->input.syncFlags.crouch); // crouch
case 7: return (pPlayer->input.buttonFlags.shoot); // normal fire weapon case 7: return (pPlayer->input.syncFlags.shoot); // normal fire weapon
case 8: return (pPlayer->input.buttonFlags.shoot2); // alt fire weapon case 8: return (pPlayer->input.syncFlags.shoot2); // alt fire weapon
default: default:
condError(pXCond, "Player conditions:\nSpecify a correct key!"); condError(pXCond, "Player conditions:\nSpecify a correct key!");
break; break;

View file

@ -318,7 +318,7 @@ char powerupActivate(PLAYER *pPlayer, int nPowerUp)
pPlayer->damageControl[1]++; pPlayer->damageControl[1]++;
break; break;
case kItemTwoGuns: case kItemTwoGuns:
pPlayer->input.newWeapon = pPlayer->curWeapon; pPlayer->newWeapon = pPlayer->curWeapon;
WeaponRaise(pPlayer); WeaponRaise(pPlayer);
break; break;
} }
@ -369,7 +369,7 @@ void powerupDeactivate(PLAYER *pPlayer, int nPowerUp)
pPlayer->damageControl[1]--; pPlayer->damageControl[1]--;
break; break;
case kItemTwoGuns: case kItemTwoGuns:
pPlayer->input.newWeapon = pPlayer->curWeapon; pPlayer->newWeapon = pPlayer->curWeapon;
WeaponRaise(pPlayer); WeaponRaise(pPlayer);
break; break;
} }
@ -749,12 +749,10 @@ void playerStart(int nPlayer, int bNewLevel)
pPlayer->nextWeapon = 0; pPlayer->nextWeapon = 0;
xvel[pSprite->index] = yvel[pSprite->index] = zvel[pSprite->index] = 0; xvel[pSprite->index] = yvel[pSprite->index] = zvel[pSprite->index] = 0;
pInput->q16turn = 0; pInput->q16turn = 0;
pInput->keyFlags.word = 0; pInput->syncFlags.value = 0;
pInput->forward = 0; pInput->forward = 0;
pInput->strafe = 0; pInput->strafe = 0;
pInput->q16mlook = 0; pInput->q16mlook = 0;
pInput->buttonFlags.byte = 0;
pInput->useFlags.byte = 0;
pPlayer->flickerEffect = 0; pPlayer->flickerEffect = 0;
pPlayer->quakeEffect = 0; pPlayer->quakeEffect = 0;
pPlayer->tiltEffect = 0; pPlayer->tiltEffect = 0;
@ -822,7 +820,7 @@ void playerReset(PLAYER *pPlayer)
pPlayer->hasWeapon[1] = 1; pPlayer->hasWeapon[1] = 1;
pPlayer->curWeapon = 0; pPlayer->curWeapon = 0;
pPlayer->qavCallback = -1; pPlayer->qavCallback = -1;
pPlayer->input.newWeapon = 1; pPlayer->newWeapon = 1;
for (int i = 0; i < 14; i++) for (int i = 0; i < 14; i++)
{ {
pPlayer->weaponOrder[0][i] = dword_136400[i]; pPlayer->weaponOrder[0][i] = dword_136400[i];
@ -1311,7 +1309,7 @@ void ProcessInput(PLAYER *pPlayer)
} }
pPlayer->isRunning = pInput->syncFlags.run; pPlayer->isRunning = pInput->syncFlags.run;
if (pInput->buttonFlags.byte || pInput->forward || pInput->strafe || pInput->q16turn) if ((pInput->syncFlags.value & flag_buttonmask_norun) || pInput->forward || pInput->strafe || pInput->q16turn)
pPlayer->restTime = 0; pPlayer->restTime = 0;
else if (pPlayer->restTime >= 0) else if (pPlayer->restTime >= 0)
pPlayer->restTime += 4; pPlayer->restTime += 4;
@ -1333,8 +1331,8 @@ void ProcessInput(PLAYER *pPlayer)
pPlayer->q16horiz = mulscale16(0x8000-(Cos(ClipHigh(pPlayer->deathTime*8, 1024))>>15), fix16_from_int(120)); pPlayer->q16horiz = mulscale16(0x8000-(Cos(ClipHigh(pPlayer->deathTime*8, 1024))>>15), fix16_from_int(120));
} }
if (pPlayer->curWeapon) if (pPlayer->curWeapon)
pInput->newWeapon = pPlayer->curWeapon; pInput->syncFlags.newWeapon = pPlayer->curWeapon;
if (pInput->keyFlags.action) if (pInput->syncFlags.action)
{ {
if (bSeqStat) if (bSeqStat)
{ {
@ -1350,12 +1348,12 @@ void ProcessInput(PLAYER *pPlayer)
playerReset(pPlayer); playerReset(pPlayer);
if (gGameOptions.nGameType == 0 && numplayers == 1) if (gGameOptions.nGameType == 0 && numplayers == 1)
{ {
pInput->keyFlags.restart = 1; pInput->syncFlags.restart = 1;
} }
else else
playerStart(pPlayer->nPlayer); playerStart(pPlayer->nPlayer);
} }
pInput->keyFlags.action = 0; pInput->syncFlags.action = 0;
} }
return; return;
} }
@ -1412,11 +1410,11 @@ void ProcessInput(PLAYER *pPlayer)
} }
if (pInput->q16turn) if (pInput->q16turn)
pPlayer->q16ang = (pPlayer->q16ang+pInput->q16turn)&0x7ffffff; pPlayer->q16ang = (pPlayer->q16ang+pInput->q16turn)&0x7ffffff;
if (pInput->keyFlags.spin180) if (pInput->syncFlags.spin180)
{ {
if (!pPlayer->spin) if (!pPlayer->spin)
pPlayer->spin = -1024; pPlayer->spin = -1024;
pInput->keyFlags.spin180 = 0; pInput->syncFlags.spin180 = 0;
} }
if (pPlayer->spin < 0) if (pPlayer->spin < 0)
{ {
@ -1434,22 +1432,22 @@ void ProcessInput(PLAYER *pPlayer)
gViewAngleAdjust += float(pSprite->ang - pPlayer->angold); gViewAngleAdjust += float(pSprite->ang - pPlayer->angold);
pPlayer->q16ang = (pPlayer->q16ang+fix16_from_int(pSprite->ang-pPlayer->angold))&0x7ffffff; pPlayer->q16ang = (pPlayer->q16ang+fix16_from_int(pSprite->ang-pPlayer->angold))&0x7ffffff;
pPlayer->angold = pSprite->ang = fix16_to_int(pPlayer->q16ang); pPlayer->angold = pSprite->ang = fix16_to_int(pPlayer->q16ang);
if (!pInput->buttonFlags.jump) if (!pInput->syncFlags.jump)
pPlayer->cantJump = 0; pPlayer->cantJump = 0;
switch (pPlayer->posture) { switch (pPlayer->posture) {
case 1: case 1:
if (pInput->buttonFlags.jump) if (pInput->syncFlags.jump)
zvel[nSprite] -= pPosture->normalJumpZ;//0x5b05; zvel[nSprite] -= pPosture->normalJumpZ;//0x5b05;
if (pInput->buttonFlags.crouch) if (pInput->syncFlags.crouch)
zvel[nSprite] += pPosture->normalJumpZ;//0x5b05; zvel[nSprite] += pPosture->normalJumpZ;//0x5b05;
break; break;
case 2: case 2:
if (!pInput->buttonFlags.crouch) if (!pInput->syncFlags.crouch)
pPlayer->posture = 0; pPlayer->posture = 0;
break; break;
default: default:
if (!pPlayer->cantJump && pInput->buttonFlags.jump && pXSprite->height == 0) { if (!pPlayer->cantJump && pInput->syncFlags.jump && pXSprite->height == 0) {
#ifdef NOONE_EXTENSIONS #ifdef NOONE_EXTENSIONS
if ((packItemActive(pPlayer, 4) && pPosture->pwupJumpZ != 0) || pPosture->normalJumpZ != 0) if ((packItemActive(pPlayer, 4) && pPosture->pwupJumpZ != 0) || pPosture->normalJumpZ != 0)
#endif #endif
@ -1460,11 +1458,11 @@ void ProcessInput(PLAYER *pPlayer)
pPlayer->cantJump = 1; pPlayer->cantJump = 1;
} }
if (pInput->buttonFlags.crouch) if (pInput->syncFlags.crouch)
pPlayer->posture = 2; pPlayer->posture = 2;
break; break;
} }
if (pInput->keyFlags.action) if (pInput->syncFlags.action)
{ {
int a2, a3; int a2, a3;
int hit = ActionScan(pPlayer, &a2, &a3); int hit = ActionScan(pPlayer, &a2, &a3);
@ -1537,24 +1535,24 @@ void ProcessInput(PLAYER *pPlayer)
zvel[pSprite2->index] = zvel[nSprite]; zvel[pSprite2->index] = zvel[nSprite];
pPlayer->hand = 0; pPlayer->hand = 0;
} }
pInput->keyFlags.action = 0; pInput->syncFlags.action = 0;
} }
if (bVanilla) if (bVanilla)
{ {
if (pInput->keyFlags.lookCenter && !pInput->buttonFlags.lookUp && !pInput->buttonFlags.lookDown) if (pInput->syncFlags.lookCenter && !pInput->syncFlags.lookUp && !pInput->syncFlags.lookDown)
{ {
if (pPlayer->q16look < 0) if (pPlayer->q16look < 0)
pPlayer->q16look = fix16_min(pPlayer->q16look+fix16_from_int(4), fix16_from_int(0)); pPlayer->q16look = fix16_min(pPlayer->q16look+fix16_from_int(4), fix16_from_int(0));
if (pPlayer->q16look > 0) if (pPlayer->q16look > 0)
pPlayer->q16look = fix16_max(pPlayer->q16look-fix16_from_int(4), fix16_from_int(0)); pPlayer->q16look = fix16_max(pPlayer->q16look-fix16_from_int(4), fix16_from_int(0));
if (!pPlayer->q16look) if (!pPlayer->q16look)
pInput->keyFlags.lookCenter = 0; pInput->syncFlags.lookCenter = 0;
} }
else else
{ {
if (pInput->buttonFlags.lookUp) if (pInput->syncFlags.lookUp)
pPlayer->q16look = fix16_min(pPlayer->q16look+fix16_from_int(4), fix16_from_int(60)); pPlayer->q16look = fix16_min(pPlayer->q16look+fix16_from_int(4), fix16_from_int(60));
if (pInput->buttonFlags.lookDown) if (pInput->syncFlags.lookDown)
pPlayer->q16look = fix16_max(pPlayer->q16look-fix16_from_int(4), fix16_from_int(-60)); pPlayer->q16look = fix16_max(pPlayer->q16look-fix16_from_int(4), fix16_from_int(-60));
} }
pPlayer->q16look = fix16_clamp(pPlayer->q16look+pInput->q16mlook, fix16_from_int(-60), fix16_from_int(60)); pPlayer->q16look = fix16_clamp(pPlayer->q16look+pInput->q16mlook, fix16_from_int(-60), fix16_from_int(60));
@ -1571,33 +1569,33 @@ void ProcessInput(PLAYER *pPlayer)
int downAngle = -347; int downAngle = -347;
double lookStepUp = 4.0*upAngle/60.0; double lookStepUp = 4.0*upAngle/60.0;
double lookStepDown = -4.0*downAngle/60.0; double lookStepDown = -4.0*downAngle/60.0;
if (pInput->keyFlags.lookCenter && !pInput->buttonFlags.lookUp && !pInput->buttonFlags.lookDown) if (pInput->syncFlags.lookCenter && !pInput->syncFlags.lookUp && !pInput->syncFlags.lookDown)
{ {
if (pPlayer->q16look < 0) if (pPlayer->q16look < 0)
pPlayer->q16look = fix16_min(pPlayer->q16look+fix16_from_dbl(lookStepDown), fix16_from_int(0)); pPlayer->q16look = fix16_min(pPlayer->q16look+fix16_from_dbl(lookStepDown), fix16_from_int(0));
if (pPlayer->q16look > 0) if (pPlayer->q16look > 0)
pPlayer->q16look = fix16_max(pPlayer->q16look-fix16_from_dbl(lookStepUp), fix16_from_int(0)); pPlayer->q16look = fix16_max(pPlayer->q16look-fix16_from_dbl(lookStepUp), fix16_from_int(0));
if (!pPlayer->q16look) if (!pPlayer->q16look)
pInput->keyFlags.lookCenter = 0; pInput->syncFlags.lookCenter = 0;
} }
else else
{ {
if (pInput->buttonFlags.lookUp) if (pInput->syncFlags.lookUp)
pPlayer->q16look = fix16_min(pPlayer->q16look+fix16_from_dbl(lookStepUp), fix16_from_int(upAngle)); pPlayer->q16look = fix16_min(pPlayer->q16look+fix16_from_dbl(lookStepUp), fix16_from_int(upAngle));
if (pInput->buttonFlags.lookDown) if (pInput->syncFlags.lookDown)
pPlayer->q16look = fix16_max(pPlayer->q16look-fix16_from_dbl(lookStepDown), fix16_from_int(downAngle)); pPlayer->q16look = fix16_max(pPlayer->q16look-fix16_from_dbl(lookStepDown), fix16_from_int(downAngle));
} }
if (pPlayer == gMe && numplayers == 1) if (pPlayer == gMe && numplayers == 1)
{ {
if (pInput->buttonFlags.lookUp) if (pInput->syncFlags.lookUp)
{ {
gViewLookAdjust += float(lookStepUp); gViewLookAdjust += float(lookStepUp);
} }
if (pInput->buttonFlags.lookDown) if (pInput->syncFlags.lookDown)
{ {
gViewLookAdjust -= float(lookStepDown); gViewLookAdjust -= float(lookStepDown);
} }
gViewLookRecenter = pInput->keyFlags.lookCenter && !pInput->buttonFlags.lookUp && !pInput->buttonFlags.lookDown; gViewLookRecenter = pInput->syncFlags.lookCenter && !pInput->syncFlags.lookUp && !pInput->syncFlags.lookDown;
} }
pPlayer->q16look = fix16_clamp(pPlayer->q16look+(pInput->q16mlook<<3), fix16_from_int(downAngle), fix16_from_int(upAngle)); pPlayer->q16look = fix16_clamp(pPlayer->q16look+(pInput->q16mlook<<3), fix16_from_int(downAngle), fix16_from_int(upAngle));
pPlayer->q16horiz = fix16_from_float(100.f*tanf(fix16_to_float(pPlayer->q16look)*fPI/1024.f)); pPlayer->q16horiz = fix16_from_float(100.f*tanf(fix16_to_float(pPlayer->q16look)*fPI/1024.f));
@ -1629,49 +1627,49 @@ void ProcessInput(PLAYER *pPlayer)
pPlayer->q16slopehoriz = 0; pPlayer->q16slopehoriz = 0;
} }
pPlayer->slope = (-fix16_to_int(pPlayer->q16horiz))<<7; pPlayer->slope = (-fix16_to_int(pPlayer->q16horiz))<<7;
if (pInput->keyFlags.prevItem) if (pInput->syncFlags.prevItem)
{ {
pInput->keyFlags.prevItem = 0; pInput->syncFlags.prevItem = 0;
packPrevItem(pPlayer); packPrevItem(pPlayer);
} }
if (pInput->keyFlags.nextItem) if (pInput->syncFlags.nextItem)
{ {
pInput->keyFlags.nextItem = 0; pInput->syncFlags.nextItem = 0;
packNextItem(pPlayer); packNextItem(pPlayer);
} }
if (pInput->keyFlags.useItem) if (pInput->syncFlags.useItem)
{ {
pInput->keyFlags.useItem = 0; pInput->syncFlags.useItem = 0;
if (pPlayer->packSlots[pPlayer->packItemId].curAmount > 0) if (pPlayer->packSlots[pPlayer->packItemId].curAmount > 0)
packUseItem(pPlayer, pPlayer->packItemId); packUseItem(pPlayer, pPlayer->packItemId);
} }
if (pInput->useFlags.useBeastVision) if (pInput->syncFlags.useBeastVision)
{ {
pInput->useFlags.useBeastVision = 0; pInput->syncFlags.useBeastVision = 0;
if (pPlayer->packSlots[3].curAmount > 0) if (pPlayer->packSlots[3].curAmount > 0)
packUseItem(pPlayer, 3); packUseItem(pPlayer, 3);
} }
if (pInput->useFlags.useCrystalBall) if (pInput->syncFlags.useCrystalBall)
{ {
pInput->useFlags.useCrystalBall = 0; pInput->syncFlags.useCrystalBall = 0;
if (pPlayer->packSlots[2].curAmount > 0) if (pPlayer->packSlots[2].curAmount > 0)
packUseItem(pPlayer, 2); packUseItem(pPlayer, 2);
} }
if (pInput->useFlags.useJumpBoots) if (pInput->syncFlags.useJumpBoots)
{ {
pInput->useFlags.useJumpBoots = 0; pInput->syncFlags.useJumpBoots = 0;
if (pPlayer->packSlots[4].curAmount > 0) if (pPlayer->packSlots[4].curAmount > 0)
packUseItem(pPlayer, 4); packUseItem(pPlayer, 4);
} }
if (pInput->useFlags.useMedKit) if (pInput->syncFlags.useMedKit)
{ {
pInput->useFlags.useMedKit = 0; pInput->syncFlags.useMedKit = 0;
if (pPlayer->packSlots[0].curAmount > 0) if (pPlayer->packSlots[0].curAmount > 0)
packUseItem(pPlayer, 0); packUseItem(pPlayer, 0);
} }
if (pInput->keyFlags.holsterWeapon) if (pInput->syncFlags.holsterWeapon)
{ {
pInput->keyFlags.holsterWeapon = 0; pInput->syncFlags.holsterWeapon = 0;
if (pPlayer->curWeapon) if (pPlayer->curWeapon)
{ {
WeaponLower(pPlayer); WeaponLower(pPlayer);
@ -2178,7 +2176,7 @@ void PlayerSurvive(int, int nXSprite)
sprintf(buffer, "%s lives again!", gProfile[pPlayer->nPlayer].name); sprintf(buffer, "%s lives again!", gProfile[pPlayer->nPlayer].name);
viewSetMessage(buffer); viewSetMessage(buffer);
} }
pPlayer->input.newWeapon = 1; pPlayer->newWeapon = 1;
} }
} }
} }

View file

@ -87,15 +87,7 @@ struct PLAYER
XSPRITE* pXSprite; XSPRITE* pXSprite;
DUDEINFO* pDudeInfo; DUDEINFO* pDudeInfo;
GINPUT input; GINPUT input;
//short input; // INPUT uint8_t newWeapon;
//char moveFunc; // forward
//short at11; // turn
//char hearDist; // strafe
//int bobV; // buttonFlags
//unsigned int bobH; // keyFlags
//char swayV; // useFlags;
//char swayH; // newWeapon
//char at21; // mlook
int used1; // something related to game checksum int used1; // something related to game checksum
int weaponQav; int weaponQav;
int qavCallback; int qavCallback;

View file

@ -66,7 +66,7 @@ void viewInitializePrediction(void)
predict.at6f = gMe->cantJump; predict.at6f = gMe->cantJump;
predict.at70 = gMe->isRunning; predict.at70 = gMe->isRunning;
predict.at72 = gMe->isUnderwater; predict.at72 = gMe->isUnderwater;
predict.at71 = gMe->input.buttonFlags.jump; predict.at71 = gMe->input.syncFlags.jump;
predict.at50 = gMe->pSprite->x; predict.at50 = gMe->pSprite->x;
predict.at54 = gMe->pSprite->y; predict.at54 = gMe->pSprite->y;
predict.at58 = gMe->pSprite->z; predict.at58 = gMe->pSprite->z;
@ -78,7 +78,7 @@ void viewInitializePrediction(void)
predict.at6a = gMe->pXSprite->height; predict.at6a = gMe->pXSprite->height;
predict.at48 = gMe->posture; predict.at48 = gMe->posture;
predict.at4c = gMe->spin; predict.at4c = gMe->spin;
predict.at6e = gMe->input.keyFlags.lookCenter; predict.at6e = gMe->input.syncFlags.lookCenter;
memcpy(&predict.at75,&gSpriteHit[gMe->pSprite->extra],sizeof(SPRITEHIT)); memcpy(&predict.at75,&gSpriteHit[gMe->pSprite->extra],sizeof(SPRITEHIT));
predict.at0 = gMe->bobPhase; predict.at0 = gMe->bobPhase;
predict.at4 = gMe->bobAmp; predict.at4 = gMe->bobAmp;
@ -136,8 +136,7 @@ static void fakeProcessInput(PLAYER *pPlayer, GINPUT *pInput)
} }
predict.at70 = pInput->syncFlags.run; predict.at70 = pInput->syncFlags.run;
predict.at70 = 0; predict.at71 = pInput->syncFlags.jump;
predict.at71 = pInput->buttonFlags.jump;
if (predict.at48 == 1) if (predict.at48 == 1)
{ {
int x = Cos(fix16_to_int(predict.at30)); int x = Cos(fix16_to_int(predict.at30));
@ -191,7 +190,7 @@ static void fakeProcessInput(PLAYER *pPlayer, GINPUT *pInput)
} }
if (pInput->q16turn) if (pInput->q16turn)
predict.at30 = (predict.at30+pInput->q16turn)&0x7ffffff; predict.at30 = (predict.at30+pInput->q16turn)&0x7ffffff;
if (pInput->keyFlags.spin180) if (pInput->syncFlags.spin180)
if (!predict.at4c) if (!predict.at4c)
predict.at4c = -1024; predict.at4c = -1024;
if (predict.at4c < 0) if (predict.at4c < 0)
@ -216,11 +215,11 @@ static void fakeProcessInput(PLAYER *pPlayer, GINPUT *pInput)
case 1: case 1:
if (predict.at71) if (predict.at71)
predict.at64 -= pPosture->normalJumpZ;//0x5b05; predict.at64 -= pPosture->normalJumpZ;//0x5b05;
if (pInput->buttonFlags.crouch) if (pInput->syncFlags.crouch)
predict.at64 += pPosture->normalJumpZ;//0x5b05; predict.at64 += pPosture->normalJumpZ;//0x5b05;
break; break;
case 2: case 2:
if (!pInput->buttonFlags.crouch) if (!pInput->syncFlags.crouch)
predict.at48 = 0; predict.at48 = 0;
break; break;
default: default:
@ -229,12 +228,12 @@ static void fakeProcessInput(PLAYER *pPlayer, GINPUT *pInput)
else predict.at64 = pPosture->normalJumpZ;//-0xbaaaa; else predict.at64 = pPosture->normalJumpZ;//-0xbaaaa;
predict.at6f = 1; predict.at6f = 1;
} }
if (pInput->buttonFlags.crouch) if (pInput->syncFlags.crouch)
predict.at48 = 2; predict.at48 = 2;
break; break;
} }
#if 0 #if 0
if (predict.at6e && !pInput->buttonFlags.lookUp && !pInput->buttonFlags.lookDown) if (predict.at6e && !pInput->syncFlags.lookUp && !pInput->syncFlags.lookDown)
{ {
if (predict.at20 < 0) if (predict.at20 < 0)
predict.at20 = fix16_min(predict.at20+fix16_from_int(4), fix16_from_int(0)); predict.at20 = fix16_min(predict.at20+fix16_from_int(4), fix16_from_int(0));
@ -245,9 +244,9 @@ static void fakeProcessInput(PLAYER *pPlayer, GINPUT *pInput)
} }
else else
{ {
if (pInput->buttonFlags.lookUp) if (pInput->syncFlags.lookUp)
predict.at20 = fix16_min(predict.at20+fix16_from_int(4), fix16_from_int(60)); predict.at20 = fix16_min(predict.at20+fix16_from_int(4), fix16_from_int(60));
if (pInput->buttonFlags.lookDown) if (pInput->syncFlags.lookDown)
predict.at20 = fix16_max(predict.at20-fix16_from_int(4), fix16_from_int(-60)); predict.at20 = fix16_max(predict.at20-fix16_from_int(4), fix16_from_int(-60));
} }
predict.at20 = fix16_clamp(predict.at20+pInput->q16mlook, fix16_from_int(-60), fix16_from_int(60)); predict.at20 = fix16_clamp(predict.at20+pInput->q16mlook, fix16_from_int(-60), fix16_from_int(60));
@ -263,7 +262,7 @@ static void fakeProcessInput(PLAYER *pPlayer, GINPUT *pInput)
int downAngle = -347; int downAngle = -347;
double lookStepUp = 4.0*upAngle/60.0; double lookStepUp = 4.0*upAngle/60.0;
double lookStepDown = -4.0*downAngle/60.0; double lookStepDown = -4.0*downAngle/60.0;
if (predict.at6e && !pInput->buttonFlags.lookUp && !pInput->buttonFlags.lookDown) if (predict.at6e && !pInput->syncFlags.lookUp && !pInput->syncFlags.lookDown)
{ {
if (predict.at20 < 0) if (predict.at20 < 0)
predict.at20 = fix16_min(predict.at20+fix16_from_dbl(lookStepDown), fix16_from_int(0)); predict.at20 = fix16_min(predict.at20+fix16_from_dbl(lookStepDown), fix16_from_int(0));
@ -274,22 +273,22 @@ static void fakeProcessInput(PLAYER *pPlayer, GINPUT *pInput)
} }
else else
{ {
if (pInput->buttonFlags.lookUp) if (pInput->syncFlags.lookUp)
predict.at20 = fix16_min(predict.at20+fix16_from_dbl(lookStepUp), fix16_from_int(upAngle)); predict.at20 = fix16_min(predict.at20+fix16_from_dbl(lookStepUp), fix16_from_int(upAngle));
if (pInput->buttonFlags.lookDown) if (pInput->syncFlags.lookDown)
predict.at20 = fix16_max(predict.at20-fix16_from_dbl(lookStepDown), fix16_from_int(downAngle)); predict.at20 = fix16_max(predict.at20-fix16_from_dbl(lookStepDown), fix16_from_int(downAngle));
} }
if (numplayers > 1 && gPrediction) if (numplayers > 1 && gPrediction)
{ {
if (pInput->buttonFlags.lookUp) if (pInput->syncFlags.lookUp)
{ {
gViewLookAdjust += float(lookStepUp); gViewLookAdjust += float(lookStepUp);
} }
if (pInput->buttonFlags.lookDown) if (pInput->syncFlags.lookDown)
{ {
gViewLookAdjust -= float(lookStepDown); gViewLookAdjust -= float(lookStepDown);
} }
gViewLookRecenter = predict.at6e && !pInput->buttonFlags.lookUp && !pInput->buttonFlags.lookDown; gViewLookRecenter = predict.at6e && !pInput->syncFlags.lookUp && !pInput->syncFlags.lookDown;
} }
predict.at20 = fix16_clamp(predict.at20+(pInput->q16mlook<<3), fix16_from_int(downAngle), fix16_from_int(upAngle)); predict.at20 = fix16_clamp(predict.at20+(pInput->q16mlook<<3), fix16_from_int(downAngle), fix16_from_int(upAngle));
predict.at24 = fix16_from_float(100.f*tanf(fix16_to_float(predict.at20)*fPI/1024.f)); predict.at24 = fix16_from_float(100.f*tanf(fix16_to_float(predict.at20)*fPI/1024.f));

View file

@ -469,8 +469,8 @@ void WeaponRaise(PLAYER *pPlayer)
{ {
dassert(pPlayer != NULL); dassert(pPlayer != NULL);
int prevWeapon = pPlayer->curWeapon; int prevWeapon = pPlayer->curWeapon;
pPlayer->curWeapon = pPlayer->input.newWeapon; pPlayer->curWeapon = pPlayer->newWeapon;
pPlayer->input.newWeapon = 0; pPlayer->newWeapon = 0;
pPlayer->weaponAmmo = weaponModes[pPlayer->curWeapon].at4; pPlayer->weaponAmmo = weaponModes[pPlayer->curWeapon].at4;
switch (pPlayer->curWeapon) switch (pPlayer->curWeapon)
{ {
@ -641,21 +641,21 @@ void WeaponLower(PLAYER *pPlayer)
case 4: case 4:
pPlayer->weaponState = 1; pPlayer->weaponState = 1;
StartQAV(pPlayer, 11, -1, 0); StartQAV(pPlayer, 11, -1, 0);
pPlayer->input.newWeapon = 0; pPlayer->newWeapon = 0;
WeaponLower(pPlayer); WeaponLower(pPlayer);
break; break;
case 3: case 3:
if (pPlayer->input.newWeapon == 6) if (pPlayer->newWeapon == 6)
{ {
pPlayer->weaponState = 2; pPlayer->weaponState = 2;
StartQAV(pPlayer, 11, -1, 0); StartQAV(pPlayer, 11, -1, 0);
return; return;
} }
else if (pPlayer->input.newWeapon == 7) else if (pPlayer->newWeapon == 7)
{ {
pPlayer->weaponState = 1; pPlayer->weaponState = 1;
StartQAV(pPlayer, 11, -1, 0); StartQAV(pPlayer, 11, -1, 0);
pPlayer->input.newWeapon = 0; pPlayer->newWeapon = 0;
WeaponLower(pPlayer); WeaponLower(pPlayer);
} }
else else
@ -676,7 +676,7 @@ void WeaponLower(PLAYER *pPlayer)
WeaponRaise(pPlayer); WeaponRaise(pPlayer);
break; break;
case 3: case 3:
if (pPlayer->input.newWeapon == 7) if (pPlayer->newWeapon == 7)
{ {
pPlayer->weaponState = 2; pPlayer->weaponState = 2;
StartQAV(pPlayer, 17, -1, 0); StartQAV(pPlayer, 17, -1, 0);
@ -1767,17 +1767,17 @@ char sub_4F0E0(PLAYER *pPlayer)
switch (pPlayer->weaponState) switch (pPlayer->weaponState)
{ {
case 5: case 5:
if (!pPlayer->input.buttonFlags.shoot2) if (!pPlayer->input.syncFlags.shoot2)
pPlayer->weaponState = 6; pPlayer->weaponState = 6;
return 1; return 1;
case 6: case 6:
if (pPlayer->input.buttonFlags.shoot2) if (pPlayer->input.syncFlags.shoot2)
{ {
pPlayer->weaponState = 3; pPlayer->weaponState = 3;
pPlayer->fuseTime = pPlayer->weaponTimer; pPlayer->fuseTime = pPlayer->weaponTimer;
StartQAV(pPlayer, 13, nClientDropCan, 0); StartQAV(pPlayer, 13, nClientDropCan, 0);
} }
else if (pPlayer->input.buttonFlags.shoot) else if (pPlayer->input.syncFlags.shoot)
{ {
pPlayer->weaponState = 7; pPlayer->weaponState = 7;
pPlayer->fuseTime = 0; pPlayer->fuseTime = 0;
@ -1787,7 +1787,7 @@ char sub_4F0E0(PLAYER *pPlayer)
case 7: case 7:
{ {
pPlayer->throwPower = ClipHigh(divscale16(gFrameClock-pPlayer->throwTime,240), 65536); pPlayer->throwPower = ClipHigh(divscale16(gFrameClock-pPlayer->throwTime,240), 65536);
if (!pPlayer->input.buttonFlags.shoot) if (!pPlayer->input.syncFlags.shoot)
{ {
if (!pPlayer->fuseTime) if (!pPlayer->fuseTime)
pPlayer->fuseTime = pPlayer->weaponTimer; pPlayer->fuseTime = pPlayer->weaponTimer;
@ -1805,17 +1805,17 @@ char sub_4F200(PLAYER *pPlayer)
switch (pPlayer->weaponState) switch (pPlayer->weaponState)
{ {
case 4: case 4:
if (!pPlayer->input.buttonFlags.shoot2) if (!pPlayer->input.syncFlags.shoot2)
pPlayer->weaponState = 5; pPlayer->weaponState = 5;
return 1; return 1;
case 5: case 5:
if (pPlayer->input.buttonFlags.shoot2) if (pPlayer->input.syncFlags.shoot2)
{ {
pPlayer->weaponState = 1; pPlayer->weaponState = 1;
pPlayer->fuseTime = pPlayer->weaponTimer; pPlayer->fuseTime = pPlayer->weaponTimer;
StartQAV(pPlayer, 22, nClientDropBundle, 0); StartQAV(pPlayer, 22, nClientDropBundle, 0);
} }
else if (pPlayer->input.buttonFlags.shoot) else if (pPlayer->input.syncFlags.shoot)
{ {
pPlayer->weaponState = 6; pPlayer->weaponState = 6;
pPlayer->fuseTime = 0; pPlayer->fuseTime = 0;
@ -1825,7 +1825,7 @@ char sub_4F200(PLAYER *pPlayer)
case 6: case 6:
{ {
pPlayer->throwPower = ClipHigh(divscale16(gFrameClock-pPlayer->throwTime,240), 65536); pPlayer->throwPower = ClipHigh(divscale16(gFrameClock-pPlayer->throwTime,240), 65536);
if (!pPlayer->input.buttonFlags.shoot) if (!pPlayer->input.syncFlags.shoot)
{ {
if (!pPlayer->fuseTime) if (!pPlayer->fuseTime)
pPlayer->fuseTime = pPlayer->weaponTimer; pPlayer->fuseTime = pPlayer->weaponTimer;
@ -1845,7 +1845,7 @@ char sub_4F320(PLAYER *pPlayer)
case 9: case 9:
pPlayer->throwPower = ClipHigh(divscale16(gFrameClock-pPlayer->throwTime,240), 65536); pPlayer->throwPower = ClipHigh(divscale16(gFrameClock-pPlayer->throwTime,240), 65536);
pPlayer->weaponTimer = 0; pPlayer->weaponTimer = 0;
if (!pPlayer->input.buttonFlags.shoot) if (!pPlayer->input.syncFlags.shoot)
{ {
pPlayer->weaponState = 8; pPlayer->weaponState = 8;
StartQAV(pPlayer, 29, nClientThrowProx, 0); StartQAV(pPlayer, 29, nClientThrowProx, 0);
@ -1861,7 +1861,7 @@ char sub_4F3A0(PLAYER *pPlayer)
{ {
case 13: case 13:
pPlayer->throwPower = ClipHigh(divscale16(gFrameClock-pPlayer->throwTime,240), 65536); pPlayer->throwPower = ClipHigh(divscale16(gFrameClock-pPlayer->throwTime,240), 65536);
if (!pPlayer->input.buttonFlags.shoot) if (!pPlayer->input.syncFlags.shoot)
{ {
pPlayer->weaponState = 11; pPlayer->weaponState = 11;
StartQAV(pPlayer, 39, nClientThrowRemote, 0); StartQAV(pPlayer, 39, nClientThrowRemote, 0);
@ -1880,7 +1880,7 @@ char sub_4F414(PLAYER *pPlayer)
StartQAV(pPlayer, 114, nClientFireLifeLeech, 1); StartQAV(pPlayer, 114, nClientFireLifeLeech, 1);
return 1; return 1;
case 6: case 6:
if (!pPlayer->input.buttonFlags.shoot2) if (!pPlayer->input.syncFlags.shoot2)
{ {
pPlayer->weaponState = 2; pPlayer->weaponState = 2;
StartQAV(pPlayer, 118, -1, 0); StartQAV(pPlayer, 118, -1, 0);
@ -1907,7 +1907,7 @@ char sub_4F484(PLAYER *pPlayer)
StartQAV(pPlayer, 77, nClientFireTesla, 1); StartQAV(pPlayer, 77, nClientFireTesla, 1);
return 1; return 1;
case 5: case 5:
if (!pPlayer->input.buttonFlags.shoot) if (!pPlayer->input.syncFlags.shoot)
{ {
pPlayer->weaponState = 2; pPlayer->weaponState = 2;
if (sub_4B2C8(pPlayer, 7, 10) && powerupCheck(pPlayer, kPwUpTwoGuns)) if (sub_4B2C8(pPlayer, 7, 10) && powerupCheck(pPlayer, kPwUpTwoGuns))
@ -1968,8 +1968,8 @@ void WeaponProcess(PLAYER *pPlayer) {
WeaponPlay(pPlayer); WeaponPlay(pPlayer);
UpdateAimVector(pPlayer); UpdateAimVector(pPlayer);
pPlayer->weaponTimer -= 4; pPlayer->weaponTimer -= 4;
char bShoot = pPlayer->input.buttonFlags.shoot; char bShoot = pPlayer->input.syncFlags.shoot;
char bShoot2 = pPlayer->input.buttonFlags.shoot2; char bShoot2 = pPlayer->input.syncFlags.shoot2;
if (pPlayer->qavLoop && pPlayer->pXSprite->health > 0) if (pPlayer->qavLoop && pPlayer->pXSprite->health > 0)
{ {
if (bShoot && CheckAmmo(pPlayer, pPlayer->weaponAmmo, 1)) if (bShoot && CheckAmmo(pPlayer, pPlayer->weaponAmmo, 1))
@ -2023,12 +2023,12 @@ void WeaponProcess(PLAYER *pPlayer) {
{ {
sfxKill3DSound(pPlayer->pSprite, -1, 441); sfxKill3DSound(pPlayer->pSprite, -1, 441);
pPlayer->weaponState = 0; pPlayer->weaponState = 0;
pPlayer->input.newWeapon = pPlayer->nextWeapon; pPlayer->newWeapon = pPlayer->nextWeapon;
pPlayer->nextWeapon = 0; pPlayer->nextWeapon = 0;
} }
if (pPlayer->input.keyFlags.nextWeapon) if (pPlayer->input.syncFlags.nextWeapon)
{ {
pPlayer->input.keyFlags.nextWeapon = 0; pPlayer->input.syncFlags.nextWeapon = 0;
pPlayer->weaponState = 0; pPlayer->weaponState = 0;
pPlayer->nextWeapon = 0; pPlayer->nextWeapon = 0;
int t; int t;
@ -2040,11 +2040,11 @@ void WeaponProcess(PLAYER *pPlayer) {
pPlayer->nextWeapon = weapon; pPlayer->nextWeapon = weapon;
return; return;
} }
pPlayer->input.newWeapon = weapon; pPlayer->newWeapon = weapon;
} }
if (pPlayer->input.keyFlags.prevWeapon) if (pPlayer->input.syncFlags.prevWeapon)
{ {
pPlayer->input.keyFlags.prevWeapon = 0; pPlayer->input.syncFlags.prevWeapon = 0;
pPlayer->weaponState = 0; pPlayer->weaponState = 0;
pPlayer->nextWeapon = 0; pPlayer->nextWeapon = 0;
int t; int t;
@ -2056,7 +2056,7 @@ void WeaponProcess(PLAYER *pPlayer) {
pPlayer->nextWeapon = weapon; pPlayer->nextWeapon = weapon;
return; return;
} }
pPlayer->input.newWeapon = weapon; pPlayer->newWeapon = weapon;
} }
if (pPlayer->weaponState == -1) if (pPlayer->weaponState == -1)
{ {
@ -2070,54 +2070,54 @@ void WeaponProcess(PLAYER *pPlayer) {
pPlayer->nextWeapon = weapon; pPlayer->nextWeapon = weapon;
return; return;
} }
pPlayer->input.newWeapon = weapon; pPlayer->newWeapon = weapon;
} }
if (pPlayer->input.newWeapon) if (pPlayer->newWeapon)
{ {
if (pPlayer->input.newWeapon == 6) if (pPlayer->newWeapon == 6)
{ {
if (pPlayer->curWeapon == 6) if (pPlayer->curWeapon == 6)
{ {
if (sub_4B2C8(pPlayer, 10, 1)) if (sub_4B2C8(pPlayer, 10, 1))
pPlayer->input.newWeapon = 11; pPlayer->newWeapon = 11;
else if (sub_4B2C8(pPlayer, 11, 1)) else if (sub_4B2C8(pPlayer, 11, 1))
pPlayer->input.newWeapon = 12; pPlayer->newWeapon = 12;
} }
else if (pPlayer->curWeapon == 11) else if (pPlayer->curWeapon == 11)
{ {
if (sub_4B2C8(pPlayer, 11, 1)) if (sub_4B2C8(pPlayer, 11, 1))
pPlayer->input.newWeapon = 12; pPlayer->newWeapon = 12;
else if (sub_4B2C8(pPlayer, 5, 1) && pPlayer->isUnderwater == 0) else if (sub_4B2C8(pPlayer, 5, 1) && pPlayer->isUnderwater == 0)
pPlayer->input.newWeapon = 6; pPlayer->newWeapon = 6;
} }
else if (pPlayer->curWeapon == 12) else if (pPlayer->curWeapon == 12)
{ {
if (sub_4B2C8(pPlayer, 5, 1) && pPlayer->isUnderwater == 0) if (sub_4B2C8(pPlayer, 5, 1) && pPlayer->isUnderwater == 0)
pPlayer->input.newWeapon = 6; pPlayer->newWeapon = 6;
else if (sub_4B2C8(pPlayer, 10, 1)) else if (sub_4B2C8(pPlayer, 10, 1))
pPlayer->input.newWeapon = 11; pPlayer->newWeapon = 11;
} }
else else
{ {
if (sub_4B2C8(pPlayer, 5, 1) && pPlayer->isUnderwater == 0) if (sub_4B2C8(pPlayer, 5, 1) && pPlayer->isUnderwater == 0)
pPlayer->input.newWeapon = 6; pPlayer->newWeapon = 6;
else if (sub_4B2C8(pPlayer, 10, 1)) else if (sub_4B2C8(pPlayer, 10, 1))
pPlayer->input.newWeapon = 11; pPlayer->newWeapon = 11;
else if (sub_4B2C8(pPlayer, 11, 1)) else if (sub_4B2C8(pPlayer, 11, 1))
pPlayer->input.newWeapon = 12; pPlayer->newWeapon = 12;
} }
} }
if (pPlayer->pXSprite->health == 0 || pPlayer->hasWeapon[pPlayer->input.newWeapon] == 0) if (pPlayer->pXSprite->health == 0 || pPlayer->hasWeapon[pPlayer->newWeapon] == 0)
{ {
pPlayer->input.newWeapon = 0; pPlayer->newWeapon = 0;
return; return;
} }
if (pPlayer->isUnderwater && BannedUnderwater(pPlayer->input.newWeapon) && !sub_4B1A4(pPlayer)) if (pPlayer->isUnderwater && BannedUnderwater(pPlayer->newWeapon) && !sub_4B1A4(pPlayer))
{ {
pPlayer->input.newWeapon = 0; pPlayer->newWeapon = 0;
return; return;
} }
int nWeapon = pPlayer->input.newWeapon; int nWeapon = pPlayer->newWeapon;
int v4c = weaponModes[nWeapon].at0; int v4c = weaponModes[nWeapon].at0;
if (!pPlayer->curWeapon) if (!pPlayer->curWeapon)
{ {
@ -2126,7 +2126,7 @@ void WeaponProcess(PLAYER *pPlayer) {
{ {
if (CheckAmmo(pPlayer, nAmmoType, 1) || nAmmoType == 11) if (CheckAmmo(pPlayer, nAmmoType, 1) || nAmmoType == 11)
WeaponRaise(pPlayer); WeaponRaise(pPlayer);
pPlayer->input.newWeapon = 0; pPlayer->newWeapon = 0;
} }
else else
{ {
@ -2144,14 +2144,14 @@ void WeaponProcess(PLAYER *pPlayer) {
pPlayer->nextWeapon = weapon; pPlayer->nextWeapon = weapon;
return; return;
} }
pPlayer->input.newWeapon = weapon; pPlayer->newWeapon = weapon;
} }
} }
return; return;
} }
if (nWeapon == pPlayer->curWeapon && v4c <= 1) if (nWeapon == pPlayer->curWeapon && v4c <= 1)
{ {
pPlayer->input.newWeapon = 0; pPlayer->newWeapon = 0;
return; return;
} }
int i = 0; int i = 0;
@ -2167,7 +2167,7 @@ void WeaponProcess(PLAYER *pPlayer) {
return; return;
} }
} }
pPlayer->input.newWeapon = 0; pPlayer->newWeapon = 0;
return; return;
} }
if (pPlayer->curWeapon && !CheckAmmo(pPlayer, pPlayer->weaponAmmo, 1) && pPlayer->weaponAmmo != 11) if (pPlayer->curWeapon && !CheckAmmo(pPlayer, pPlayer->weaponAmmo, 1) && pPlayer->weaponAmmo != 11)