From d0655a106828e29a1cc68b77b8253703c9cca1cf Mon Sep 17 00:00:00 2001 From: Christoph Oelckers Date: Wed, 26 Aug 2020 16:54:13 +0200 Subject: [PATCH] - renamed the fields in Blood's packet structure to match Duke's. --- source/blood/src/blood.cpp | 8 ++-- source/blood/src/controls.cpp | 68 ++++++++++++++++----------------- source/blood/src/controls.h | 8 ++-- source/blood/src/nnexts.cpp | 8 ++-- source/blood/src/player.cpp | 34 ++++++++--------- source/blood/src/prediction.cpp | 22 +++++------ 6 files changed, 74 insertions(+), 74 deletions(-) diff --git a/source/blood/src/blood.cpp b/source/blood/src/blood.cpp index f1901c765..35aa17956 100644 --- a/source/blood/src/blood.cpp +++ b/source/blood/src/blood.cpp @@ -529,10 +529,10 @@ void ProcessFrame(void) gPlayer[i].input.syncFlags.value |= gFifoInput[gNetFifoTail & 255][i].syncFlags.value; if (gFifoInput[gNetFifoTail&255][i].syncFlags.newWeapon) gPlayer[i].newWeapon = gFifoInput[gNetFifoTail&255][i].syncFlags.newWeapon; - gPlayer[i].input.forward = gFifoInput[gNetFifoTail&255][i].forward; - gPlayer[i].input.q16turn = gFifoInput[gNetFifoTail&255][i].q16turn; - gPlayer[i].input.strafe = gFifoInput[gNetFifoTail&255][i].strafe; - gPlayer[i].input.q16mlook = gFifoInput[gNetFifoTail&255][i].q16mlook; + gPlayer[i].input.fvel = gFifoInput[gNetFifoTail&255][i].fvel; + gPlayer[i].input.q16avel = gFifoInput[gNetFifoTail&255][i].q16avel; + gPlayer[i].input.svel = gFifoInput[gNetFifoTail&255][i].svel; + gPlayer[i].input.q16horz = gFifoInput[gNetFifoTail&255][i].q16horz; } gNetFifoTail++; diff --git a/source/blood/src/controls.cpp b/source/blood/src/controls.cpp index 31cb1b893..3677727a0 100644 --- a/source/blood/src/controls.cpp +++ b/source/blood/src/controls.cpp @@ -219,21 +219,21 @@ void ctrlGetInput(void) gInput.syncFlags.run |= run; - if (gInput.forward < keyMove && gInput.forward > -keyMove) + if (gInput.fvel < keyMove && gInput.fvel > -keyMove) { if (buttonMap.ButtonDown(gamefunc_Move_Forward)) - input.forward += keyMove; + input.fvel += keyMove; if (buttonMap.ButtonDown(gamefunc_Move_Backward)) - input.forward -= keyMove; + input.fvel -= keyMove; } - if (gInput.strafe < keyMove && gInput.strafe > -keyMove) + if (gInput.svel < keyMove && gInput.svel > -keyMove) { if (buttonMap.ButtonDown(gamefunc_Strafe_Left)) - input.strafe += keyMove; + input.svel += keyMove; if (buttonMap.ButtonDown(gamefunc_Strafe_Right)) - input.strafe -= keyMove; + input.svel -= keyMove; } @@ -241,12 +241,12 @@ void ctrlGetInput(void) if (buttonMap.ButtonDown(gamefunc_Strafe)) { - if (gInput.strafe < keyMove && gInput.strafe > -keyMove) + if (gInput.svel < keyMove && gInput.svel > -keyMove) { if (buttonMap.ButtonDown(gamefunc_Turn_Left)) - input.strafe += keyMove; + input.svel += keyMove; if (buttonMap.ButtonDown(gamefunc_Turn_Right)) - input.strafe -= keyMove; + input.svel -= keyMove; } } else @@ -273,56 +273,56 @@ void ctrlGetInput(void) turnHeldTime = 0; if (turnLeft) - input.q16turn = fix16_ssub(input.q16turn, fix16_from_dbl(scaleAdjustmentToInterval(ClipHigh(12 * turnHeldTime, gTurnSpeed)>>2))); + input.q16avel = fix16_ssub(input.q16avel, fix16_from_dbl(scaleAdjustmentToInterval(ClipHigh(12 * turnHeldTime, gTurnSpeed)>>2))); if (turnRight) - input.q16turn = fix16_sadd(input.q16turn, fix16_from_dbl(scaleAdjustmentToInterval(ClipHigh(12 * turnHeldTime, gTurnSpeed)>>2))); + input.q16avel = fix16_sadd(input.q16avel, fix16_from_dbl(scaleAdjustmentToInterval(ClipHigh(12 * turnHeldTime, gTurnSpeed)>>2))); if ((run2 || run) && turnHeldTime > 24) - input.q16turn <<= 1; + input.q16avel <<= 1; if (buttonMap.ButtonDown(gamefunc_Strafe)) { - input.strafe -= info.mousex * 32.f; - input.strafe -= scaleAdjustmentToInterval(info.dyaw * keyMove); + input.svel -= info.mousex * 32.f; + input.svel -= scaleAdjustmentToInterval(info.dyaw * keyMove); } else { - input.q16turn = fix16_sadd(input.q16turn, fix16_from_float(info.mousex)); - input.q16turn = fix16_sadd(input.q16turn, fix16_from_dbl(scaleAdjustmentToInterval(info.dyaw))); + input.q16avel = fix16_sadd(input.q16avel, fix16_from_float(info.mousex)); + input.q16avel = fix16_sadd(input.q16avel, fix16_from_dbl(scaleAdjustmentToInterval(info.dyaw))); } - input.strafe -= scaleAdjustmentToInterval(info.dx * keyMove); - input.forward -= scaleAdjustmentToInterval(info.dz * keyMove); + input.svel -= scaleAdjustmentToInterval(info.dx * keyMove); + input.fvel -= scaleAdjustmentToInterval(info.dz * keyMove); if (mouseaim) - input.q16mlook = fix16_sadd(input.q16mlook, fix16_from_float(info.mousey / mlookScale)); + input.q16horz = fix16_sadd(input.q16horz, fix16_from_float(info.mousey / mlookScale)); else - input.forward -= info.mousey * 64.f; + input.fvel -= info.mousey * 64.f; if (!in_mouseflip) - input.q16mlook = -input.q16mlook; + input.q16horz = -input.q16horz; - input.q16mlook = fix16_ssub(input.q16mlook, fix16_from_dbl(scaleAdjustmentToInterval(info.dpitch / mlookScale))); + input.q16horz = fix16_ssub(input.q16horz, fix16_from_dbl(scaleAdjustmentToInterval(info.dpitch / mlookScale))); if (!automapFollow && automapMode != am_off) { - gViewMap.turn += input.q16turn<<2; - gViewMap.forward += input.forward; - gViewMap.strafe += input.strafe; - input.q16turn = 0; - input.forward = 0; - input.strafe = 0; + gViewMap.turn += input.q16avel<<2; + gViewMap.forward += input.fvel; + gViewMap.strafe += input.svel; + input.q16avel = 0; + input.fvel = 0; + input.svel = 0; } - gInput.forward = clamp(gInput.forward + input.forward, -2048, 2048); - gInput.strafe = clamp(gInput.strafe + input.strafe, -2048, 2048); - gInput.q16turn = fix16_sadd(gInput.q16turn, input.q16turn); - gInput.q16mlook = fix16_clamp(fix16_sadd(gInput.q16mlook, input.q16mlook), fix16_from_int(-127)>>2, fix16_from_int(127)>>2); + gInput.fvel = clamp(gInput.fvel + input.fvel, -2048, 2048); + gInput.svel = clamp(gInput.svel + input.svel, -2048, 2048); + gInput.q16avel = fix16_sadd(gInput.q16avel, input.q16avel); + gInput.q16horz = fix16_clamp(fix16_sadd(gInput.q16horz, input.q16horz), fix16_from_int(-127)>>2, fix16_from_int(127)>>2); if (gMe && gMe->pXSprite->health != 0 && !paused) { int upAngle = 289; int downAngle = -347; double lookStepUp = 4.0*upAngle/60.0; double lookStepDown = -4.0*downAngle/60.0; - gViewAngle = (gViewAngle + input.q16turn + fix16_from_dbl(scaleAdjustmentToInterval(gViewAngleAdjust))) & 0x7ffffff; + gViewAngle = (gViewAngle + input.q16avel + fix16_from_dbl(scaleAdjustmentToInterval(gViewAngleAdjust))) & 0x7ffffff; if (gViewLookRecenter) { if (gViewLook < 0) @@ -334,7 +334,7 @@ void ctrlGetInput(void) { gViewLook = fix16_clamp(gViewLook+fix16_from_dbl(scaleAdjustmentToInterval(gViewLookAdjust)), fix16_from_int(downAngle), fix16_from_int(upAngle)); } - gViewLook = fix16_clamp(gViewLook+(input.q16mlook << 3), fix16_from_int(downAngle), fix16_from_int(upAngle)); + gViewLook = fix16_clamp(gViewLook+(input.q16horz << 3), fix16_from_int(downAngle), fix16_from_int(upAngle)); } } diff --git a/source/blood/src/controls.h b/source/blood/src/controls.h index a2f238210..4f39e1e3a 100644 --- a/source/blood/src/controls.h +++ b/source/blood/src/controls.h @@ -69,10 +69,10 @@ union SYNCFLAGS struct GINPUT { SYNCFLAGS syncFlags; - int16_t forward; - int16_t strafe; - fix16_t q16turn; - fix16_t q16mlook; + int16_t fvel; + int16_t svel; + fix16_t q16avel; + fix16_t q16horz; }; #pragma pack(pop) diff --git a/source/blood/src/nnexts.cpp b/source/blood/src/nnexts.cpp index facace1a5..fe4ad0265 100644 --- a/source/blood/src/nnexts.cpp +++ b/source/blood/src/nnexts.cpp @@ -2885,10 +2885,10 @@ bool condCheckPlayer(XSPRITE* pXCond, int cmpOp, bool PUSH) { return true; case 10: // check keys pressed switch (arg1) { - case 1: return (pPlayer->input.forward > 0); // forward - case 2: return (pPlayer->input.forward < 0); // backward - case 3: return (pPlayer->input.strafe > 0); // left - case 4: return (pPlayer->input.strafe < 0); // right + case 1: return (pPlayer->input.fvel > 0); // forward + case 2: return (pPlayer->input.fvel < 0); // backward + case 3: return (pPlayer->input.svel > 0); // left + case 4: return (pPlayer->input.svel < 0); // right case 5: return (pPlayer->input.syncFlags.jump); // jump case 6: return (pPlayer->input.syncFlags.crouch); // crouch case 7: return (pPlayer->input.syncFlags.shoot); // normal fire weapon diff --git a/source/blood/src/player.cpp b/source/blood/src/player.cpp index f832476e9..fefccf784 100644 --- a/source/blood/src/player.cpp +++ b/source/blood/src/player.cpp @@ -748,11 +748,11 @@ void playerStart(int nPlayer, int bNewLevel) pPlayer->deathTime = 0; pPlayer->nextWeapon = 0; xvel[pSprite->index] = yvel[pSprite->index] = zvel[pSprite->index] = 0; - pInput->q16turn = 0; + pInput->q16avel = 0; pInput->syncFlags.value = 0; - pInput->forward = 0; - pInput->strafe = 0; - pInput->q16mlook = 0; + pInput->fvel = 0; + pInput->svel = 0; + pInput->q16horz = 0; pPlayer->flickerEffect = 0; pPlayer->quakeEffect = 0; pPlayer->tiltEffect = 0; @@ -1309,7 +1309,7 @@ void ProcessInput(PLAYER *pPlayer) } pPlayer->isRunning = pInput->syncFlags.run; - if ((pInput->syncFlags.value & flag_buttonmask_norun) || pInput->forward || pInput->strafe || pInput->q16turn) + if ((pInput->syncFlags.value & flag_buttonmask_norun) || pInput->fvel || pInput->svel || pInput->q16avel) pPlayer->restTime = 0; else if (pPlayer->restTime >= 0) pPlayer->restTime += 4; @@ -1361,9 +1361,9 @@ void ProcessInput(PLAYER *pPlayer) { int x = Cos(pSprite->ang); int y = Sin(pSprite->ang); - if (pInput->forward) + if (pInput->fvel) { - int forward = pInput->forward; + int forward = pInput->fvel; if (forward > 0) forward = mulscale8(pPosture->frontAccel, forward); else @@ -1371,9 +1371,9 @@ void ProcessInput(PLAYER *pPlayer) xvel[nSprite] += mulscale30(forward, x); yvel[nSprite] += mulscale30(forward, y); } - if (pInput->strafe) + if (pInput->svel) { - int strafe = pInput->strafe; + int strafe = pInput->svel; strafe = mulscale8(pPosture->sideAccel, strafe); xvel[nSprite] += mulscale30(strafe, y); yvel[nSprite] -= mulscale30(strafe, x); @@ -1386,9 +1386,9 @@ void ProcessInput(PLAYER *pPlayer) speed -= divscale16(pXSprite->height, 256); int x = Cos(pSprite->ang); int y = Sin(pSprite->ang); - if (pInput->forward) + if (pInput->fvel) { - int forward = pInput->forward; + int forward = pInput->fvel; if (forward > 0) forward = mulscale8(pPosture->frontAccel, forward); else @@ -1398,9 +1398,9 @@ void ProcessInput(PLAYER *pPlayer) xvel[nSprite] += mulscale30(forward, x); yvel[nSprite] += mulscale30(forward, y); } - if (pInput->strafe) + if (pInput->svel) { - int strafe = pInput->strafe; + int strafe = pInput->svel; strafe = mulscale8(pPosture->sideAccel, strafe); if (pXSprite->height) strafe = mulscale16(strafe, speed); @@ -1408,8 +1408,8 @@ void ProcessInput(PLAYER *pPlayer) yvel[nSprite] -= mulscale30(strafe, x); } } - if (pInput->q16turn) - pPlayer->q16ang = (pPlayer->q16ang+pInput->q16turn)&0x7ffffff; + if (pInput->q16avel) + pPlayer->q16ang = (pPlayer->q16ang+pInput->q16avel)&0x7ffffff; if (pInput->syncFlags.spin180) { if (!pPlayer->spin) @@ -1555,7 +1555,7 @@ void ProcessInput(PLAYER *pPlayer) if (pInput->syncFlags.lookDown) 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->q16horz, fix16_from_int(-60), fix16_from_int(60)); if (pPlayer->q16look > 0) pPlayer->q16horiz = fix16_from_int(mulscale30(120, Sin(fix16_to_int(pPlayer->q16look)<<3))); else if (pPlayer->q16look < 0) @@ -1597,7 +1597,7 @@ void ProcessInput(PLAYER *pPlayer) } 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->q16horz<<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)); } int nSector = pSprite->sectnum; diff --git a/source/blood/src/prediction.cpp b/source/blood/src/prediction.cpp index 577ed651c..cfda834d4 100644 --- a/source/blood/src/prediction.cpp +++ b/source/blood/src/prediction.cpp @@ -141,9 +141,9 @@ static void fakeProcessInput(PLAYER *pPlayer, GINPUT *pInput) { int x = Cos(fix16_to_int(predict.at30)); int y = Sin(fix16_to_int(predict.at30)); - if (pInput->forward) + if (pInput->fvel) { - int forward = pInput->forward; + int forward = pInput->fvel; if (forward > 0) forward = mulscale8(pPosture->frontAccel, forward); else @@ -151,9 +151,9 @@ static void fakeProcessInput(PLAYER *pPlayer, GINPUT *pInput) predict.at5c += mulscale30(forward, x); predict.at60 += mulscale30(forward, y); } - if (pInput->strafe) + if (pInput->svel) { - int strafe = pInput->strafe; + int strafe = pInput->svel; strafe = mulscale8(pPosture->sideAccel, strafe); predict.at5c += mulscale30(strafe, y); predict.at60 -= mulscale30(strafe, x); @@ -166,9 +166,9 @@ static void fakeProcessInput(PLAYER *pPlayer, GINPUT *pInput) speed -= divscale16(predict.at6a, 0x100); int x = Cos(fix16_to_int(predict.at30)); int y = Sin(fix16_to_int(predict.at30)); - if (pInput->forward) + if (pInput->fvel) { - int forward = pInput->forward; + int forward = pInput->fvel; if (forward > 0) forward = mulscale8(pPosture->frontAccel, forward); else @@ -178,9 +178,9 @@ static void fakeProcessInput(PLAYER *pPlayer, GINPUT *pInput) predict.at5c += mulscale30(forward, x); predict.at60 += mulscale30(forward, y); } - if (pInput->strafe) + if (pInput->svel) { - int strafe = pInput->strafe; + int strafe = pInput->svel; strafe = mulscale8(pPosture->sideAccel, strafe); if (predict.at6a) strafe = mulscale16(strafe, speed); @@ -188,8 +188,8 @@ static void fakeProcessInput(PLAYER *pPlayer, GINPUT *pInput) predict.at60 -= mulscale30(strafe, x); } } - if (pInput->q16turn) - predict.at30 = (predict.at30+pInput->q16turn)&0x7ffffff; + if (pInput->q16avel) + predict.at30 = (predict.at30+pInput->q16avel)&0x7ffffff; if (pInput->syncFlags.spin180) if (!predict.at4c) predict.at4c = -1024; @@ -290,7 +290,7 @@ static void fakeProcessInput(PLAYER *pPlayer, GINPUT *pInput) } 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->q16horz<<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)); int nSector = predict.at68;