- more gone

This commit is contained in:
Christoph Oelckers 2020-05-19 18:32:28 +02:00
parent 4ecee598af
commit 960e656be6
3 changed files with 47 additions and 925 deletions

View file

@ -3171,4 +3171,22 @@ void processweapon_d(int s, int ss, int p)
processweapon(s, ss, p); processweapon(s, ss, p);
} }
void processmove_d(int snum, int sb_snum, int psect, int fz, int cz, int shrunk, int truefdist)
{
int psectlotag = sector[psect].lotag;
auto p = &ps[snum];
if (psectlotag == 2)
{
underwater(snum, sb_snum, psect, fz, cz);
}
else if (p->jetpack_on)
{
operateJetpack(snum, sb_snum, psectlotag, fz, cz, shrunk);
}
else if (psectlotag != 2)
{
movement(snum, sb_snum, psect, fz, cz, shrunk, truefdist);
}
}
END_DUKE_NS END_DUKE_NS

View file

@ -1557,7 +1557,7 @@ void checkweapons_r(struct player_struct* p)
// //
//--------------------------------------------------------------------------- //---------------------------------------------------------------------------
static void onMotorcycle(int snum, int &sb_snum) /*static*/ void onMotorcycle(int snum, int &sb_snum)
{ {
auto p = &ps[snum]; auto p = &ps[snum];
auto pi = p->i; auto pi = p->i;
@ -1846,7 +1846,7 @@ static void onMotorcycle(int snum, int &sb_snum)
// //
//--------------------------------------------------------------------------- //---------------------------------------------------------------------------
static void onBoat(int snum, int sb_snum) /*static*/ void onBoat(int snum, int& sb_snum)
{ {
auto p = &ps[snum]; auto p = &ps[snum];
auto pi = p->i; auto pi = p->i;
@ -4268,4 +4268,19 @@ void processweapon_r(int s, int ss, int p)
processweapon(s, ss, p); processweapon(s, ss, p);
} }
void processmove_r(int snum, int sb_snum, int psect, int fz, int cz, int shrunk, int truefdist)
{
int psectlotag = sector[psect].lotag;
auto p = &ps[snum];
if (psectlotag == 2)
{
underwater(snum, sb_snum, psect, fz, cz);
}
else if (psectlotag != 2)
{
movement(snum, sb_snum, psect, fz, cz, shrunk, truefdist);
}
}
END_DUKE_NS END_DUKE_NS

View file

@ -1907,6 +1907,8 @@ static int P_CheckLockedMovement(int const playerNum)
if (pPlayer->newowner != -1) if (pPlayer->newowner != -1)
return IL_NOANGLE|IL_NOHORIZ; return IL_NOANGLE|IL_NOHORIZ;
if (pPlayer->curr_weapon > 11) return 0;
if (pPlayer->dead_flag || pPlayer->fist_incs || pPlayer->transporter_hold > 2 || pPlayer->hard_landing || pPlayer->access_incs > 0 if (pPlayer->dead_flag || pPlayer->fist_incs || pPlayer->transporter_hold > 2 || pPlayer->hard_landing || pPlayer->access_incs > 0
|| pPlayer->knee_incs > 0 || pPlayer->knee_incs > 0
|| (PWEAPON(playerNum, pPlayer->curr_weapon, WorksLike) == TRIPBOMB_WEAPON && pPlayer->kickback_pic > 1 || (PWEAPON(playerNum, pPlayer->curr_weapon, WorksLike) == TRIPBOMB_WEAPON && pPlayer->kickback_pic > 1
@ -2971,6 +2973,8 @@ void P_FragPlayer(int playerNum)
void processweapon_d(int s, int ss, int p); void processweapon_d(int s, int ss, int p);
void processweapon_r(int s, int ss, int p); void processweapon_r(int s, int ss, int p);
void processmove_d(int snum, int sb_snum, int psect, int fz, int cz, int shrunk, int truefdist);
void processmove_r(int snum, int sb_snum, int psect, int fz, int cz, int shrunk, int truefdist);
static void P_ProcessWeapon(int playerNum) static void P_ProcessWeapon(int playerNum)
{ {
@ -3091,117 +3095,6 @@ void P_UpdatePosWhenViewingCam(DukePlayer_t *pPlayer)
pPlayer->rotscrnang = 0; pPlayer->rotscrnang = 0;
} }
static void P_DoWater(int const playerNum, int const playerBits, int const floorZ, int const ceilZ)
{
DukePlayer_t *const pPlayer = g_player[playerNum].ps;
// under water
pPlayer->pycount += 32;
pPlayer->pycount &= 2047;
pPlayer->jumping_counter = 0;
pPlayer->pyoff = sintable[pPlayer->pycount] >> 7;
if (!A_CheckSoundPlaying(pPlayer->i, DUKE_UNDERWATER))
A_PlaySound(DUKE_UNDERWATER, pPlayer->i);
if (TEST_SYNC_KEY(playerBits, SK_JUMP) && (!RRRA || !pPlayer->OnMotorcycle))
{
pPlayer->vel.z = max(min(-348, pPlayer->vel.z - 348), -(256 * 6));
}
else if ((TEST_SYNC_KEY(playerBits, SK_CROUCH) && (!RRRA || !pPlayer->OnMotorcycle))
|| (RRRA && pPlayer->OnMotorcycle))
{
pPlayer->vel.z = min(max(348, pPlayer->vel.z + 348), (256 * 6));
}
else
{
// normal view
if (pPlayer->vel.z < 0)
pPlayer->vel.z = min(0, pPlayer->vel.z + 256);
if (pPlayer->vel.z > 0)
pPlayer->vel.z = max(0, pPlayer->vel.z - 256);
}
if (pPlayer->vel.z > 2048)
pPlayer->vel.z >>= 1;
pPlayer->pos.z += pPlayer->vel.z;
if (pPlayer->pos.z > (floorZ-(15<<8)))
pPlayer->pos.z += ((floorZ-(15<<8))-pPlayer->pos.z)>>1;
if (pPlayer->pos.z < ceilZ+ZOFFSET6)
{
pPlayer->pos.z = ceilZ+ZOFFSET6;
pPlayer->vel.z = 0;
}
if (pPlayer->scuba_on && (krand2()&255) < 8)
{
int const spriteNum = fi.spawn(pPlayer->i, TILE_WATERBUBBLE);
int const q16ang = fix16_to_int(pPlayer->q16ang);
sprite[spriteNum].x += sintable[(q16ang + 512 + 64 - (g_globalRandom & 128)+(RR ? 128 : 0)) & 2047] >> 6;
sprite[spriteNum].y += sintable[(q16ang + 64 - (g_globalRandom & 128)+(RR ? 128 : 0)) & 2047] >> 6;
sprite[spriteNum].xrepeat = 3;
sprite[spriteNum].yrepeat = 2;
sprite[spriteNum].z = pPlayer->pos.z + ZOFFSET3;
if (RR)
sprite[spriteNum].cstat = 514;
}
}
static void P_DoJetpack(int const playerNum, int const playerBits, int const playerShrunk, int const sectorLotag, int const floorZ)
{
DukePlayer_t *const pPlayer = g_player[playerNum].ps;
pPlayer->on_ground = 0;
pPlayer->jumping_counter = 0;
pPlayer->hard_landing = 0;
pPlayer->falling_counter = 0;
pPlayer->pycount += 32;
pPlayer->pycount &= 2047;
pPlayer->pyoff = sintable[pPlayer->pycount] >> 7;
if (pPlayer->jetpack_on < 11)
{
pPlayer->jetpack_on++;
pPlayer->pos.z -= (pPlayer->jetpack_on<<7); //Goin up
}
else if (pPlayer->jetpack_on == 11 && !A_CheckSoundPlaying(pPlayer->i, DUKE_JETPACK_IDLE))
A_PlaySound(DUKE_JETPACK_IDLE, pPlayer->i);
int const zAdjust = playerShrunk ? 512 : 2048;
if (TEST_SYNC_KEY(playerBits, SK_JUMP)) // jumping, flying up
{
if (VM_OnEvent(EVENT_SOARUP, pPlayer->i, playerNum) == 0)
{
pPlayer->pos.z -= zAdjust;
pPlayer->crack_time = 777;
}
}
if (TEST_SYNC_KEY(playerBits, SK_CROUCH)) // crouching, flying down
{
if (VM_OnEvent(EVENT_SOARDOWN, pPlayer->i, playerNum) == 0)
{
pPlayer->pos.z += zAdjust;
pPlayer->crack_time = 777;
}
}
int const Zdiff = (playerShrunk == 0 && (sectorLotag == 0 || sectorLotag == ST_2_UNDERWATER)) ? 32 : 16;
if (sectorLotag != ST_2_UNDERWATER && pPlayer->scuba_on == 1)
pPlayer->scuba_on = 0;
if (pPlayer->pos.z > (floorZ - (Zdiff << 8)))
pPlayer->pos.z += ((floorZ - (Zdiff << 8)) - pPlayer->pos.z) >> 1;
if (pPlayer->pos.z < (actor[pPlayer->i].ceilingz + (18 << 8)))
pPlayer->pos.z = actor[pPlayer->i].ceilingz + (18 << 8);
}
static void P_Dead(int const playerNum, int const sectorLotag, int const floorZ, int const ceilZ) static void P_Dead(int const playerNum, int const sectorLotag, int const floorZ, int const ceilZ)
{ {
@ -3254,6 +3147,9 @@ static void P_HandlePal(DukePlayer_t *const pPlayer)
pPlayer->pals.f--; pPlayer->pals.f--;
} }
void onMotorcycle(int snum, int& sb_snum);
void onBoat(int snum, int& sb_snum);
void P_ProcessInput(int playerNum) void P_ProcessInput(int playerNum)
{ {
auto &thisPlayer = g_player[playerNum]; auto &thisPlayer = g_player[playerNum];
@ -3269,7 +3165,7 @@ void P_ProcessInput(int playerNum)
++pPlayer->player_par; ++pPlayer->player_par;
uint32_t playerBits = thisPlayer.input->bits; int playerBits = thisPlayer.input->bits;
if (RR) if (RR)
{ {
@ -3286,537 +3182,11 @@ void P_ProcessInput(int playerNum)
{ {
if (pPlayer->OnMotorcycle && pSprite->extra > 0) if (pPlayer->OnMotorcycle && pSprite->extra > 0)
{ {
int var64, var68, var6c, var74, var7c; onMotorcycle(playerNum, playerBits);
int16_t var84;
if (pPlayer->MotoSpeed < 0)
pPlayer->MotoSpeed = 0;
if (TEST_SYNC_KEY(playerBits, SK_CROUCH))
{
var64 = 1;
playerBits &= ~(1<<SK_CROUCH);
}
else
var64 = 0;
if (TEST_SYNC_KEY(playerBits, SK_JUMP))
{
var68 = 1;
playerBits &= ~(1<< SK_JUMP);
if (pPlayer->on_ground)
{
if (pPlayer->MotoSpeed == 0 && var64)
{
if (!A_CheckSoundPlaying(pPlayer->i, 187))
A_PlaySound(187,pPlayer->i);
}
else if (pPlayer->MotoSpeed == 0 && !A_CheckSoundPlaying(pPlayer->i, 214))
{
if (A_CheckSoundPlaying(pPlayer->i, 187))
S_StopEnvSound(187, pPlayer->i);
A_PlaySound(214,pPlayer->i);
}
else if (pPlayer->MotoSpeed >= 50 && !A_CheckSoundPlaying(pPlayer->i, 188))
{
A_PlaySound(188,pPlayer->i);
}
else if (!A_CheckSoundPlaying(pPlayer->i, 188) && !A_CheckSoundPlaying(pPlayer->i, 214))
{
A_PlaySound(188,pPlayer->i);
}
}
}
else
{
var68 = 0;
if (A_CheckSoundPlaying(pPlayer->i, 214))
{
S_StopEnvSound(214, pPlayer->i);
if (!A_CheckSoundPlaying(pPlayer->i, 189))
A_PlaySound(189,pPlayer->i);
}
if (A_CheckSoundPlaying(pPlayer->i, 188))
{
S_StopEnvSound(188, pPlayer->i);
if (!A_CheckSoundPlaying(pPlayer->i, 189))
A_PlaySound(189, pPlayer->i);
}
if (!A_CheckSoundPlaying(pPlayer->i, 189) && !A_CheckSoundPlaying(pPlayer->i, 187))
A_PlaySound(187,pPlayer->i);
}
if (TEST_SYNC_KEY(playerBits, SK_AIM_UP))
{
var6c = 1;
playerBits &= ~(1<<SK_AIM_UP);
}
else
var6c = 0;
if (TEST_SYNC_KEY(playerBits, SK_AIM_DOWN))
{
var74 = 1;
playerBits &= ~(1<<SK_AIM_DOWN);
}
else
{
var74 = 0;
}
if (TEST_SYNC_KEY(playerBits, SK_LOOK_LEFT))
{
var7c = 1;
playerBits &= ~(1<<SK_LOOK_LEFT);
}
else
{
var7c = 0;
}
if (pPlayer->drink_amt > 88 && pPlayer->moto_drink == 0)
{
var84 = krand2() & 63;
if (var84 == 1)
pPlayer->moto_drink = -10;
else if (var84 == 2)
pPlayer->moto_drink = 10;
}
else if (pPlayer->drink_amt > 99 && pPlayer->moto_drink == 0)
{
var84 = krand2() & 31;
if (var84 == 1)
pPlayer->moto_drink = -20;
else if (var84 == 2)
pPlayer->moto_drink = 20;
}
if (pPlayer->on_ground == 1)
{
if (var64 && pPlayer->MotoSpeed > 0)
{
if (pPlayer->moto_on_oil)
pPlayer->MotoSpeed -= 2;
else
pPlayer->MotoSpeed -= 4;
if (pPlayer->MotoSpeed < 0)
pPlayer->MotoSpeed = 0;
pPlayer->VBumpTarget = -30;
pPlayer->moto_do_bump = 1;
}
else if (var68 && !var64)
{
if (pPlayer->MotoSpeed < 40)
{
pPlayer->VBumpTarget = 70;
pPlayer->moto_bump_fast = 1;
}
pPlayer->MotoSpeed += 2;
if (pPlayer->MotoSpeed > 120)
pPlayer->MotoSpeed = 120;
if (!pPlayer->NotOnWater)
if (pPlayer->MotoSpeed > 80)
pPlayer->MotoSpeed = 80;
}
else if (pPlayer->MotoSpeed > 0)
pPlayer->MotoSpeed--;
if (pPlayer->moto_do_bump && (!var64 || pPlayer->MotoSpeed == 0))
{
pPlayer->VBumpTarget = 0;
pPlayer->moto_do_bump = 0;
}
if (var6c && pPlayer->MotoSpeed <= 0 && !var64)
{
int var88;
pPlayer->MotoSpeed = -15;
var88 = var7c;
var7c = var74;
var74 = var88;
}
}
if (pPlayer->MotoSpeed != 0 && pPlayer->on_ground == 1)
{
if (!pPlayer->VBumpNow)
if ((krand2() & 3) == 2)
pPlayer->VBumpTarget = (pPlayer->MotoSpeed >> 4) * ((krand2() & 7) - 4);
if (var74 || pPlayer->moto_drink < 0)
{
if (pPlayer->moto_drink < 0)
pPlayer->moto_drink++;
}
else if (var7c || pPlayer->moto_drink > 0)
{
if (pPlayer->moto_drink > 0)
pPlayer->moto_drink--;
}
}
if (pPlayer->TurbCount)
{
if (pPlayer->TurbCount <= 1)
{
pPlayer->q16horiz = F16(100);
pPlayer->TurbCount = 0;
pPlayer->VBumpTarget = 0;
pPlayer->VBumpNow = 0;
}
else
{
pPlayer->q16horiz = F16(100+((krand2()&15)-7));
pPlayer->TurbCount--;
pPlayer->moto_drink = (krand2()&3)-2;
}
}
else if (pPlayer->VBumpTarget > pPlayer->VBumpNow)
{
if (pPlayer->moto_bump_fast)
pPlayer->VBumpNow += 6;
else
pPlayer->VBumpNow++;
if (pPlayer->VBumpTarget < pPlayer->VBumpNow)
pPlayer->VBumpNow = pPlayer->VBumpTarget;
pPlayer->q16horiz = F16(100+pPlayer->VBumpNow/3);
}
else if (pPlayer->VBumpTarget < pPlayer->VBumpNow)
{
if (pPlayer->moto_bump_fast)
pPlayer->VBumpNow -= 6;
else
pPlayer->VBumpNow--;
if (pPlayer->VBumpTarget > pPlayer->VBumpNow)
pPlayer->VBumpNow = pPlayer->VBumpTarget;
pPlayer->q16horiz = F16(100+pPlayer->VBumpNow/3);
}
else
{
pPlayer->VBumpTarget = 0;
pPlayer->moto_bump_fast = 0;
}
if (pPlayer->MotoSpeed >= 20 && pPlayer->on_ground == 1 && (var74 || var7c))
{
short var8c, var90, var94, var98;
var8c = pPlayer->MotoSpeed;
var90 = fix16_to_int(pPlayer->q16ang);
if (var74)
var94 = -10;
else
var94 = 10;
if (var94 < 0)
var98 = 350;
else
var98 = -350;
if (pPlayer->moto_on_mud || pPlayer->moto_on_oil || !pPlayer->NotOnWater)
{
if (pPlayer->moto_on_oil)
var8c <<= 3;
else
var8c <<= 2;
if (pPlayer->moto_do_bump)
{
pPlayer->vel.x += (var8c>>5)*(sintable[(var94*-51+var90+512)&2047]<<4);
pPlayer->vel.y += (var8c>>5)*(sintable[(var94*-51+var90)&2047]<<4);
pPlayer->q16ang = F16((var90-(var98>>2))&2047);
}
else
{
pPlayer->vel.x += (var8c>>7)*(sintable[(var94*-51+var90+512)&2047]<<4);
pPlayer->vel.y += (var8c>>7)*(sintable[(var94*-51+var90)&2047]<<4);
pPlayer->q16ang = F16((var90-(var98>>6))&2047);
}
pPlayer->moto_on_mud = 0;
pPlayer->moto_on_oil = 0;
}
else
{
if (pPlayer->moto_do_bump)
{
pPlayer->vel.x += (var8c >> 5)*(sintable[(var94*-51 + var90 + 512) & 2047] << 4);
pPlayer->vel.y += (var8c>>5)*(sintable[(var94*-51+var90)&2047]<<4);
pPlayer->q16ang = F16((var90-(var98>>4))&2047);
if (!A_CheckSoundPlaying(pPlayer->i, 220))
A_PlaySound(220,pPlayer->i);
}
else
{
pPlayer->vel.x += (var8c >> 7)*(sintable[(var94*-51 + var90 + 512) & 2047] << 4);
pPlayer->vel.y += (var8c>>7)*(sintable[(var94*-51+var90)&2047]<<4);
pPlayer->q16ang = F16((var90-(var98>>7))&2047);
}
}
}
else if (pPlayer->MotoSpeed >= 20 && pPlayer->on_ground == 1 && (pPlayer->moto_on_mud || pPlayer->moto_on_oil))
{
short var9c, vara0, vara4 = 0;
var9c = pPlayer->MotoSpeed;
vara0 = fix16_to_int(pPlayer->q16ang);
var84 = krand2()&1;
if (var84 == 0)
vara4 = -10;
else if (var84 == 1)
vara4 = 10;
if (pPlayer->moto_on_oil)
var9c *= 10;
else
var9c *= 5;
pPlayer->vel.x += (var9c>>7)*(sintable[(vara4*-51+vara0+512)&2047]<<4);
pPlayer->vel.y += (var9c>>7)*(sintable[(vara4*-51+vara0)&2047]<<4);
}
pPlayer->moto_on_mud = 0;
pPlayer->moto_on_oil = 0;
} }
else if (pPlayer->OnBoat && pSprite->extra > 0) else if (pPlayer->OnBoat && pSprite->extra > 0)
{ {
int vara8, varac, varb0, varb4, varbc, varc4; onBoat(playerNum, playerBits);
int16_t varcc;
if (pPlayer->NotOnWater)
{
if (pPlayer->MotoSpeed > 0)
{
if (!A_CheckSoundPlaying(pPlayer->i, 88))
A_PlaySound(88,pPlayer->i);
}
else
{
if (!A_CheckSoundPlaying(pPlayer->i, 87))
A_PlaySound(87,pPlayer->i);
}
}
if (pPlayer->MotoSpeed < 0)
pPlayer->MotoSpeed = 0;
if (TEST_SYNC_KEY(playerBits, SK_CROUCH) && TEST_SYNC_KEY(playerBits, SK_JUMP))
{
vara8 = 1;
varac = 0;
playerBits &= ~(1<<SK_JUMP);
varb0 = 0;
playerBits &= ~(1<<SK_CROUCH);
}
else
vara8 = 0;
if (TEST_SYNC_KEY(playerBits, SK_JUMP))
{
varac = 1;
playerBits &= ~(1<<SK_JUMP);
if (pPlayer->MotoSpeed == 0 && !A_CheckSoundPlaying(pPlayer->i, 89))
{
if (A_CheckSoundPlaying(pPlayer->i, 87))
S_StopEnvSound(pPlayer->i, 87);
A_PlaySound(89,pPlayer->i);
}
else if (pPlayer->MotoSpeed >= 50 && !A_CheckSoundPlaying(pPlayer->i, 88))
A_PlaySound(88,pPlayer->i);
else if (!A_CheckSoundPlaying(pPlayer->i, 88) && !A_CheckSoundPlaying(pPlayer->i, 89))
A_PlaySound(88,pPlayer->i);
}
else
{
varac = 0;
if (A_CheckSoundPlaying(pPlayer->i, 89))
{
S_StopEnvSound(pPlayer->i, 89);
if (!A_CheckSoundPlaying(pPlayer->i, 90))
A_PlaySound(90,pPlayer->i);
}
if (A_CheckSoundPlaying(pPlayer->i, 88))
{
S_StopEnvSound(pPlayer->i, 88);
if (!A_CheckSoundPlaying(pPlayer->i, 90))
A_PlaySound(90,pPlayer->i);
}
if (!A_CheckSoundPlaying(pPlayer->i, 90) && !A_CheckSoundPlaying(pPlayer->i, 87))
A_PlaySound(87,pPlayer->i);
}
if (TEST_SYNC_KEY(playerBits, SK_CROUCH))
{
varb0 = 1;
playerBits &= ~(1<<SK_CROUCH);
}
else
varb0 = 0;
if (TEST_SYNC_KEY(playerBits, SK_AIM_UP))
{
varb4 = 1;
playerBits &= ~(1<<SK_AIM_UP);
}
else varb4 = 0;
if (TEST_SYNC_KEY(playerBits, SK_AIM_DOWN))
{
varbc = 1;
playerBits &= ~(1<<SK_AIM_DOWN);
if (!A_CheckSoundPlaying(pPlayer->i, 91) && pPlayer->MotoSpeed > 30 && !pPlayer->NotOnWater)
A_PlaySound(91,pPlayer->i);
}
else
{
varbc = 0;
}
if (TEST_SYNC_KEY(playerBits, SK_LOOK_LEFT))
{
varc4 = 1;
playerBits &= ~(1<< SK_LOOK_LEFT);
if (!A_CheckSoundPlaying(pPlayer->i, 91) && pPlayer->MotoSpeed > 30 && !pPlayer->NotOnWater)
A_PlaySound(91,pPlayer->i);
}
else
{
varc4 = 0;
}
if (!pPlayer->NotOnWater)
{
if (pPlayer->drink_amt > 88 && pPlayer->moto_drink == 0)
{
varcc = krand2() & 63;
if (varcc == 1)
pPlayer->moto_drink = -10;
else if (varcc == 2)
pPlayer->moto_drink = 10;
}
else if (pPlayer->drink_amt > 99 && pPlayer->moto_drink == 0)
{
varcc = krand2() & 31;
if (varcc == 1)
pPlayer->moto_drink = -20;
else if (varcc == 2)
pPlayer->moto_drink = 20;
}
}
if (pPlayer->on_ground == 1)
{
if (vara8)
{
if (pPlayer->MotoSpeed <= 25)
{
pPlayer->MotoSpeed++;
if (!A_CheckSoundPlaying(pPlayer->i, 182))
A_PlaySound(182, pPlayer->i);
}
else
{
pPlayer->MotoSpeed -= 2;
if (pPlayer->MotoSpeed < 0)
pPlayer->MotoSpeed = 0;
pPlayer->VBumpTarget = 30;
pPlayer->moto_do_bump = 1;
}
}
else if (varb0 && pPlayer->MotoSpeed > 0)
{
pPlayer->MotoSpeed -= 2;
if (pPlayer->MotoSpeed < 0)
pPlayer->MotoSpeed = 0;
pPlayer->VBumpTarget = 30;
pPlayer->moto_do_bump = 1;
}
else if (varac)
{
if (pPlayer->MotoSpeed < 40)
if (!pPlayer->NotOnWater)
{
pPlayer->VBumpTarget = -30;
pPlayer->moto_bump_fast = 1;
}
pPlayer->MotoSpeed++;
if (pPlayer->MotoSpeed > 120)
pPlayer->MotoSpeed = 120;
}
else if (pPlayer->MotoSpeed > 0)
pPlayer->MotoSpeed--;
if (pPlayer->moto_do_bump && (!varb0 || pPlayer->MotoSpeed == 0))
{
pPlayer->VBumpTarget = 0;
pPlayer->moto_do_bump = 0;
}
if (varb4 && pPlayer->MotoSpeed == 0 && !varb0)
{
int vard0;
if (!pPlayer->NotOnWater)
pPlayer->MotoSpeed = -25;
else
pPlayer->MotoSpeed = -20;
vard0 = varc4;
varc4 = varbc;
varbc = vard0;
}
}
if (pPlayer->MotoSpeed != 0 && pPlayer->on_ground == 1)
{
if (!pPlayer->VBumpNow)
if ((krand2() & 15) == 14)
pPlayer->VBumpTarget = (pPlayer->MotoSpeed>>4)*((krand2()&3)-2);
if (varbc || pPlayer->moto_drink < 0)
{
if (pPlayer->moto_drink < 0)
pPlayer->moto_drink++;
}
else if (varc4 || pPlayer->moto_drink > 0)
{
if (pPlayer->moto_drink > 0)
pPlayer->moto_drink--;
}
}
if (pPlayer->TurbCount)
{
if (pPlayer->TurbCount <= 1)
{
pPlayer->q16horiz = F16(100);
pPlayer->TurbCount = 0;
pPlayer->VBumpTarget = 0;
pPlayer->VBumpNow = 0;
}
else
{
pPlayer->q16horiz = F16(100+((krand2()&15)-7));
pPlayer->TurbCount--;
pPlayer->moto_drink = (krand2()&3)-2;
}
}
else if (pPlayer->VBumpTarget > pPlayer->VBumpNow)
{
if (pPlayer->moto_bump_fast)
pPlayer->VBumpNow += 6;
else
pPlayer->VBumpNow++;
if (pPlayer->VBumpTarget < pPlayer->VBumpNow)
pPlayer->VBumpNow = pPlayer->VBumpTarget;
pPlayer->q16horiz = F16(100+pPlayer->VBumpNow/3);
}
else if (pPlayer->VBumpTarget < pPlayer->VBumpNow)
{
if (pPlayer->moto_bump_fast)
pPlayer->VBumpNow -= 6;
else
pPlayer->VBumpNow--;
if (pPlayer->VBumpTarget > pPlayer->VBumpNow)
pPlayer->VBumpNow = pPlayer->VBumpTarget;
pPlayer->q16horiz = F16(100+pPlayer->VBumpNow/3);
}
else
{
pPlayer->VBumpTarget = 0;
pPlayer->moto_bump_fast = 0;
}
if (pPlayer->MotoSpeed > 0 && pPlayer->on_ground == 1 && (varbc || varc4))
{
short vard4, vard8, vardc, vare0;
vard4 = pPlayer->MotoSpeed;
vard8 = fix16_to_int(pPlayer->q16ang);
if (varbc)
vardc = -10;
else
vardc = 10;
if (vardc < 0)
vare0 = 350;
else
vare0 = -350;
vard4 <<= 2;
if (pPlayer->moto_do_bump)
{
pPlayer->vel.x += (vard4>>6)*(sintable[(vardc*-51+vard8+512)&2047]<<4);
pPlayer->vel.y += (vard4>>6)*(sintable[(vardc*-51+vard8)&2047]<<4);
pPlayer->q16ang = F16((vard8-(vare0>>5))&2047);
}
else
{
pPlayer->vel.x += (vard4>>7)*(sintable[(vardc*-51+vard8+512)&2047]<<4);
pPlayer->vel.y += (vard4>>7)*(sintable[(vardc*-51+vard8)&2047]<<4);
pPlayer->q16ang = F16((vard8-(vare0>>6))&2047);
}
}
if (pPlayer->NotOnWater)
if (pPlayer->MotoSpeed > 50)
pPlayer->MotoSpeed -= (pPlayer->MotoSpeed>>1);
} }
} }
@ -4193,289 +3563,8 @@ check_enemy_sprite:
} }
} }
if (sectorLotag == ST_2_UNDERWATER) if (isRR()) processmove_r(playerNum, playerBits, pPlayer->cursectnum, floorZ, ceilZ, playerShrunk, trueFloorZ);
P_DoWater(playerNum, playerBits, floorZ, ceilZ); else processmove_d(playerNum, playerBits, pPlayer->cursectnum, floorZ, ceilZ, playerShrunk, trueFloorZ);
else if (!RR && pPlayer->jetpack_on)
P_DoJetpack(playerNum, playerBits, playerShrunk, sectorLotag, floorZ);
else
{
pPlayer->airleft = 15 * GAMETICSPERSEC; // 13 seconds
pPlayer->scuba_on = 0;
if (sectorLotag == ST_1_ABOVE_WATER && pPlayer->spritebridge == 0)
{
floorZOffset = 12;
if (playerShrunk == 0)
{
floorZOffset = 34;
pPlayer->pycount += 32;
pPlayer->pycount &= 2047;
pPlayer->pyoff = sintable[pPlayer->pycount] >> 6;
}
if (playerShrunk == 0 && trueFloorDist <= PHEIGHT)
{
if (pPlayer->on_ground == 1)
{
if (pPlayer->dummyplayersprite < 0)
pPlayer->dummyplayersprite = fi.spawn(pPlayer->i,TILE_PLAYERONWATER);
pPlayer->footprintcount = 6;
//sprite[pPlayer->dummyplayersprite].cstat |= 32768;
//sprite[pPlayer->dummyplayersprite].pal = sprite[pPlayer->i].pal;
pPlayer->footprintpal = 0;
pPlayer->footprintshade = 0;
if (sector[pPlayer->cursectnum].floorpicnum == TILE_FLOORSLIME)
{
pPlayer->footprintpal = 8;
pPlayer->footprintshade = 0;
}
else if (RRRA && (sector[pPlayer->cursectnum].floorpicnum == TILE_RRTILE7756 || sector[pPlayer->cursectnum].floorpicnum == TILE_RRTILE7888))
{
pPlayer->footprintpal = 0;
pPlayer->footprintshade = 40;
}
}
}
}
else if ((!RRRA || pPlayer->OnMotorcycle) && pPlayer->footprintcount > 0 && pPlayer->on_ground)
{
if (pPlayer->cursectnum >= 0 && (sector[pPlayer->cursectnum].floorstat & 2) != 2)
{
int spriteNum = -1;
for (spriteNum = headspritesect[pPlayer->cursectnum]; spriteNum >= 0; spriteNum = nextspritesect[spriteNum])
{
if (sprite[spriteNum].picnum == TILE_FOOTPRINTS || sprite[spriteNum].picnum == TILE_FOOTPRINTS2 ||
sprite[spriteNum].picnum == TILE_FOOTPRINTS3 || sprite[spriteNum].picnum == TILE_FOOTPRINTS4)
{
if (klabs(sprite[spriteNum].x - pPlayer->pos.x) < 384 &&
klabs(sprite[spriteNum].y - pPlayer->pos.y) < 384)
break;
}
}
if (spriteNum < 0)
{
pPlayer->footprintcount--;
if (pPlayer->cursectnum >= 0 && sector[pPlayer->cursectnum].lotag == 0 &&
sector[pPlayer->cursectnum].hitag == 0)
#ifdef YAX_ENABLE
if (yax_getbunch(pPlayer->cursectnum, YAX_FLOOR) < 0 || (sector[pPlayer->cursectnum].floorstat & 512))
#endif
{
switch (krand2() & 3)
{
case 0: spriteNum = fi.spawn(pPlayer->i, TILE_FOOTPRINTS); break;
case 1: spriteNum = fi.spawn(pPlayer->i, TILE_FOOTPRINTS2); break;
case 2: spriteNum = fi.spawn(pPlayer->i, TILE_FOOTPRINTS3); break;
default: spriteNum = fi.spawn(pPlayer->i, TILE_FOOTPRINTS4); break;
}
sprite[spriteNum].pal = pPlayer->footprintpal;
sprite[spriteNum].shade = pPlayer->footprintshade;
}
}
}
}
if (pPlayer->pos.z < (floorZ-(floorZOffset<<8))) //falling
{
// not jumping or crouching
if ((!TEST_SYNC_KEY(playerBits, SK_JUMP) && !TEST_SYNC_KEY(playerBits, SK_CROUCH)) && pPlayer->on_ground &&
(sector[pPlayer->cursectnum].floorstat & 2) && pPlayer->pos.z >= (floorZ - (floorZOffset << 8) - ZOFFSET2))
pPlayer->pos.z = floorZ - (floorZOffset << 8);
else
{
if (RRRA && (pPlayer->OnMotorcycle || pPlayer->OnBoat) && floorZ - (floorZOffset << 9) > pPlayer->pos.z)
{
if (pPlayer->MotoOnGround)
{
pPlayer->VBumpTarget = 80;
pPlayer->moto_bump_fast = 1;
pPlayer->vel.z -= g_spriteGravity*(pPlayer->MotoSpeed>>4);
pPlayer->MotoOnGround = 0;
if (A_CheckSoundPlaying(pPlayer->i, 188))
S_StopEnvSound(188, pPlayer->i);
A_PlaySound(189, pPlayer->i);
}
else
{
pPlayer->vel.z += g_spriteGravity-80+(120-pPlayer->MotoSpeed);
if (!A_CheckSoundPlaying(pPlayer->i, 189) && !A_CheckSoundPlaying(pPlayer->i, 190))
A_PlaySound(190, pPlayer->i);
}
}
else
pPlayer->vel.z += (g_spriteGravity + 80); // (TICSPERFRAME<<6);
if (pPlayer->vel.z >= (4096 + 2048))
pPlayer->vel.z = (4096 + 2048);
if (pPlayer->vel.z > 2400 && pPlayer->falling_counter < 255)
{
pPlayer->falling_counter++;
if (pPlayer->falling_counter >= 38 && !A_CheckSoundPlaying(pPlayer->i, -1, CHAN_VOICE))
{
A_PlaySound(DUKE_SCREAM, pPlayer->i, CHAN_VOICE);
}
}
if ((pPlayer->pos.z + pPlayer->vel.z) >= (floorZ - (floorZOffset << 8)) && pPlayer->cursectnum >= 0) // hit the ground
{
if (sector[pPlayer->cursectnum].lotag != ST_1_ABOVE_WATER)
{
if (RRRA)
pPlayer->MotoOnGround = 1;
if (pPlayer->falling_counter > 62 || (RRRA && pPlayer->falling_counter > 2 && sector[pPlayer->cursectnum].lotag == 802))
quickkill(pPlayer);
else if (pPlayer->falling_counter > 9)
{
// Falling damage.
pSprite->extra -= pPlayer->falling_counter - (krand2() & 3);
if (pSprite->extra <= 0)
A_PlaySound(SQUISHED, pPlayer->i);
else
{
A_PlaySound(DUKE_LAND, pPlayer->i);
A_PlaySound(DUKE_LAND_HURT, pPlayer->i);
}
P_PalFrom(pPlayer, 32, 16, 0, 0);
}
else if (pPlayer->vel.z > 2048)
{
if (RRRA && pPlayer->OnMotorcycle)
{
if (A_CheckSoundPlaying(pPlayer->i, 190))
S_StopEnvSound(pPlayer->i, 190);
A_PlaySound(191, pPlayer->i);
pPlayer->TurbCount = 12;
}
else
A_PlaySound(DUKE_LAND, pPlayer->i);
}
else if (RRRA && pPlayer->vel.z > 1024 && pPlayer->OnMotorcycle)
{
A_PlaySound(DUKE_LAND, pPlayer->i);
pPlayer->TurbCount = 12;
}
}
pPlayer->on_ground = 1;
}
else
pPlayer->on_ground = 0;
}
}
else
{
pPlayer->falling_counter = 0;
S_StopEnvSound(-1, pPlayer->i, CHAN_VOICE);
if ((sectorLotag != ST_1_ABOVE_WATER && sectorLotag != ST_2_UNDERWATER) &&
(pPlayer->on_ground == 0 && pPlayer->vel.z > (6144 >> 1)))
pPlayer->hard_landing = pPlayer->vel.z>>10;
pPlayer->on_ground = 1;
if (floorZOffset==40)
{
//Smooth on the ground
int Zdiff = ((floorZ - (floorZOffset << 8)) - pPlayer->pos.z) >> 1;
if (klabs(Zdiff) < 256)
Zdiff = 0;
pPlayer->pos.z += ((klabs(Zdiff) >= 256) ? (((floorZ - (floorZOffset << 8)) - pPlayer->pos.z) >> 1) : 0);
pPlayer->vel.z -= 768;
if (pPlayer->vel.z < 0)
pPlayer->vel.z = 0;
}
else if (pPlayer->jumping_counter == 0)
{
pPlayer->pos.z += ((floorZ - (floorZOffset << 7)) - pPlayer->pos.z) >> 1; // Smooth on the water
if (pPlayer->on_warping_sector == 0 && pPlayer->pos.z > floorZ - ZOFFSET2)
{
pPlayer->pos.z = floorZ - ZOFFSET2;
pPlayer->vel.z >>= 1;
}
}
pPlayer->on_warping_sector = 0;
if (TEST_SYNC_KEY(playerBits, SK_CROUCH) && (!RRRA || !pPlayer->OnMotorcycle))
{
// crouching
if (VM_OnEvent(EVENT_CROUCH,pPlayer->i,playerNum) == 0)
{
pPlayer->pos.z += (2048+768);
pPlayer->crack_time = 777;
}
}
// jumping
if (!TEST_SYNC_KEY(playerBits, SK_JUMP) && (!RRRA || !pPlayer->OnMotorcycle) && pPlayer->jumping_toggle == 1)
pPlayer->jumping_toggle = 0;
else if (TEST_SYNC_KEY(playerBits, SK_JUMP) && (!RRRA || !pPlayer->OnMotorcycle) && pPlayer->jumping_toggle == 0)
{
if (pPlayer->jumping_counter == 0)
if ((floorZ-ceilZ) > (56<<8))
{
if (VM_OnEvent(EVENT_JUMP,pPlayer->i,playerNum) == 0)
{
pPlayer->jumping_counter = 1;
pPlayer->jumping_toggle = 1;
}
}
}
if (!RR && pPlayer->jumping_counter && !TEST_SYNC_KEY(playerBits, SK_JUMP))
pPlayer->jumping_toggle = 0;
}
if (pPlayer->jumping_counter)
{
if (!TEST_SYNC_KEY(playerBits, SK_JUMP) && (!RRRA || !pPlayer->OnMotorcycle) && pPlayer->jumping_toggle == 1)
pPlayer->jumping_toggle = 0;
if (pPlayer->jumping_counter < (RR ? 768 : (1024+256)))
{
if (sectorLotag == ST_1_ABOVE_WATER && pPlayer->jumping_counter > 768)
{
pPlayer->jumping_counter = 0;
pPlayer->vel.z = -512;
}
else
{
pPlayer->vel.z -= (sintable[(2048-128+pPlayer->jumping_counter)&2047])/12;
pPlayer->jumping_counter += 180;
pPlayer->on_ground = 0;
}
}
else
{
pPlayer->jumping_counter = 0;
pPlayer->vel.z = 0;
}
}
pPlayer->pos.z += pPlayer->vel.z;
if (pPlayer->pos.z < (ceilZ+ZOFFSET6))
{
pPlayer->jumping_counter = 0;
if (pPlayer->vel.z < 0)
pPlayer->vel.x = pPlayer->vel.y = 0;
pPlayer->vel.z = 128;
pPlayer->pos.z = ceilZ+ZOFFSET6;
}
}
if (P_CheckLockedMovement(playerNum) & IL_NOMOVE) if (P_CheckLockedMovement(playerNum) & IL_NOMOVE)
{ {
velocityModifier = 0; velocityModifier = 0;