From 7ec3232a3a6f92c1de4a2d7c017a3a2c3c72d4d0 Mon Sep 17 00:00:00 2001 From: Christoph Oelckers Date: Tue, 19 May 2020 19:50:31 +0200 Subject: [PATCH] - removed old process input code. --- source/games/duke/src/player.h | 1 - source/games/duke/src/player_d.cpp | 17 +- source/games/duke/src/player_r.cpp | 16 +- source/games/duke/src/zz_game.cpp | 17 + source/games/duke/src/zz_player.cpp | 1490 --------------------------- 5 files changed, 23 insertions(+), 1518 deletions(-) diff --git a/source/games/duke/src/player.h b/source/games/duke/src/player.h index 7d177bc13..6db73c904 100644 --- a/source/games/duke/src/player.h +++ b/source/games/duke/src/player.h @@ -413,7 +413,6 @@ void P_UpdatePosWhenViewingCam(DukePlayer_t *pPlayer); void P_ProcessInput(int playerNum); void P_DHProcessInput(int playerNum); void quickkill(DukePlayer_t* pPlayer); -void P_SelectNextInvItem(DukePlayer_t *pPlayer); void P_UpdateScreenPal(DukePlayer_t *pPlayer); inline void setpal(DukePlayer_t* pPlayer) { diff --git a/source/games/duke/src/player_d.cpp b/source/games/duke/src/player_d.cpp index ee55d0947..919127e55 100644 --- a/source/games/duke/src/player_d.cpp +++ b/source/games/duke/src/player_d.cpp @@ -2598,6 +2598,9 @@ void processinput_d(int snum) pi = p->i; s = &sprite[pi]; + g_player[snum].horizAngleAdjust = 0; + g_player[snum].horizSkew = 0; + if (p->cheat_phase <= 0) sb_snum = g_player[snum].input->bits;// sync[snum].bits; else sb_snum = 0; @@ -2711,19 +2714,6 @@ void processinput_d(int snum) return; } - if (p->pals.f > 0) // JBF 20040101: was > 0 - p->pals.f--; - - // todo: Take this out of here. HUD text should be a new mode of the notification display. - if (p->fta > 0) - { - p->fta--; - if (p->fta == 0) - { - p->ftq = 0; - } - } - if (s->extra <= 0) { playerisdead(snum, psectlotag, fz, cz); @@ -3089,7 +3079,6 @@ HORIZONLY: { playerAimUp(snum, sb_snum); } - else if (sb_snum & SKB_AIM_DOWN) { // aim_down playerAimDown(snum, sb_snum); diff --git a/source/games/duke/src/player_r.cpp b/source/games/duke/src/player_r.cpp index c4540b72f..d5f448e9b 100644 --- a/source/games/duke/src/player_r.cpp +++ b/source/games/duke/src/player_r.cpp @@ -3441,6 +3441,9 @@ void processinput_r(int snum) pi = p->i; s = &sprite[pi]; + g_player[snum].horizAngleAdjust = 0; + g_player[snum].horizSkew = 0; + if (p->cheat_phase <= 0) sb_snum = g_player[snum].input->bits;// sync[snum].bits; else sb_snum = 0; @@ -3652,19 +3655,6 @@ void processinput_r(int snum) return; } - if (p->pals.f > 0) - p->pals.f--; - - // todo: Take this out of here. HUD text should be a new mode of the notification display. - if (p->fta > 0) - { - p->fta--; - if (p->fta == 0) - { - p->ftq = 0; - } - } - if (s->extra <= 0) { playerisdead(snum, psectlotag, fz, cz); diff --git a/source/games/duke/src/zz_game.cpp b/source/games/duke/src/zz_game.cpp index 799edfb1a..749544a25 100644 --- a/source/games/duke/src/zz_game.cpp +++ b/source/games/duke/src/zz_game.cpp @@ -4363,6 +4363,23 @@ int G_DoMoveThings(void) if (ud.pause_on == 0) { + // todo: take HUD timer stuff out of the main game loop + auto p = &ps[i]; + if (p->pals.f > 0) + p->pals.f--; + + if (p->fta > 0) + { + p->fta--; + if (p->fta == 0) + { + p->ftq = 0; + } + } + if (g_levelTextTime > 0) + g_levelTextTime--; + + //P_ProcessInput(i); fi.processinput(i); fi.checksectors(i); diff --git a/source/games/duke/src/zz_player.cpp b/source/games/duke/src/zz_player.cpp index befb15f2e..291c488bc 100644 --- a/source/games/duke/src/zz_player.cpp +++ b/source/games/duke/src/zz_player.cpp @@ -2698,12 +2698,6 @@ void madenoise(int playerNum) pPlayer->noise_y = pPlayer->pos.y; } -static void P_Thrust(DukePlayer_t *const pPlayer, int shift) -{ - pPlayer->vel.x += sintable[(fix16_to_int(pPlayer->q16ang)+512)&2047] << shift; - pPlayer->vel.y += sintable[fix16_to_int(pPlayer->q16ang)&2047] << shift; -} - int16_t WeaponPickupSprites[MAX_WEAPONS] = { KNEE__STATIC, FIRSTGUNSPRITE__STATIC, SHOTGUNSPRITE__STATIC, CHAINGUNSPRITE__STATIC, RPGSPRITE__STATIC, HEAVYHBOMB__STATIC, SHRINKERSPRITE__STATIC, DEVISTATORSPRITE__STATIC, TRIPBOMBSPRITE__STATIC, FREEZESPRITE__STATIC, HEAVYHBOMB__STATIC, SHRINKERSPRITE__STATIC @@ -2722,324 +2716,12 @@ void P_AddWeapon(DukePlayer_t *pPlayer, int weaponNum) fi.addweapon(pPlayer, weaponNum); } -void P_SelectNextInvItem(DukePlayer_t *pPlayer) -{ - checkavailinven(pPlayer); -} void P_CheckWeapon(DukePlayer_t *pPlayer) { checkavailweapon(pPlayer); } -static void DoWallTouchDamage(const DukePlayer_t *pPlayer, int32_t wallNum) -{ - vec3_t const davect = { pPlayer->pos.x + (sintable[(fix16_to_int(pPlayer->q16ang) + 512) & 2047] >> 9), - pPlayer->pos.y + (sintable[fix16_to_int(pPlayer->q16ang) & 2047] >> 9), pPlayer->pos.z }; - - fi.checkhitwall(pPlayer->i, wallNum, davect.x, davect.y, davect.z, -1); -} - -static void P_CheckTouchDamage(DukePlayer_t *pPlayer, int touchObject) -{ - if (touchObject == -1) - return; - - if ((touchObject & 49152) == 49152) - { - int const touchSprite = touchObject & (MAXSPRITES - 1); - - if (RRRA) - { - switch (DYNAMICTILEMAP(sprite[touchSprite].picnum)) - { - case RRTILE2430__STATICRR: - case RRTILE2431__STATICRR: - case RRTILE2432__STATICRR: - case RRTILE2443__STATICRR: - case RRTILE2446__STATICRR: - case RRTILE2451__STATICRR: - case RRTILE2455__STATICRR: - if (pPlayer->hurt_delay2 < 8) - { - sprite[pPlayer->i].extra -= 5; - - pPlayer->hurt_delay2 = 16; - P_PalFrom(pPlayer, 32, 32, 0, 0); - A_PlaySound(DUKE_LONGTERM_PAIN, pPlayer->i); - } - break; - } - return; - } - if (sprite[touchSprite].picnum == TILE_CACTUS) - { - if (pPlayer->hurt_delay < 8) - { - sprite[pPlayer->i].extra -= 5; - - pPlayer->hurt_delay = 16; - P_PalFrom(pPlayer, 32, 32, 0, 0); - A_PlaySound(DUKE_LONGTERM_PAIN, pPlayer->i); - } - } - return; - } - - if ((touchObject & 49152) != 32768) - return; - - int const touchWall = touchObject & (MAXWALLS-1); - - if (pPlayer->hurt_delay > 0) - pPlayer->hurt_delay--; - else if (wall[touchWall].cstat & FORCEFIELD_CSTAT) - { - int const forcePic = G_GetForcefieldPicnum(touchWall); - - switch (DYNAMICTILEMAP(forcePic)) - { - case W_FORCEFIELD__STATIC: - if (RR) break; - sprite[pPlayer->i].extra -= 5; - - pPlayer->hurt_delay = 16; - P_PalFrom(pPlayer, 32, 32,0,0); - - pPlayer->vel.x = -(sintable[(fix16_to_int(pPlayer->q16ang)+512)&2047]<<8); - pPlayer->vel.y = -(sintable[(fix16_to_int(pPlayer->q16ang))&2047]<<8); - A_PlaySound(DUKE_LONGTERM_PAIN,pPlayer->i); - - DoWallTouchDamage(pPlayer, touchWall); - break; - - case BIGFORCE__STATIC: - pPlayer->hurt_delay = GAMETICSPERSEC; - DoWallTouchDamage(pPlayer, touchWall); - break; - } - } -} - -static int P_CheckFloorDamage(DukePlayer_t *pPlayer, int floorTexture) -{ - spritetype * const pSprite = &sprite[pPlayer->i]; - - if ((unsigned)(floorTexture) >= MAXTILES) - return 0; - - switch (DYNAMICTILEMAP(floorTexture)) - { - case HURTRAIL__STATIC: - if (rnd(32)) - { - if (pPlayer->inv_amount[GET_BOOTS] > 0) - return 1; - else - { - if (!A_CheckSoundPlaying(pPlayer->i, DUKE_LONGTERM_PAIN)) - A_PlaySound(DUKE_LONGTERM_PAIN, pPlayer->i); - - P_PalFrom(pPlayer, 32, 64, 64, 64); - - pSprite->extra -= 1 + (krand2() & 3); - if (!A_CheckSoundPlaying(pPlayer->i, SHORT_CIRCUIT)) - A_PlaySound(SHORT_CIRCUIT, pPlayer->i); - - return 0; - } - } - break; - - case FLOORSLIME__STATIC: - if (rnd(16)) - { - if (pPlayer->inv_amount[GET_BOOTS] > 0) - return 1; - else - { - if (!A_CheckSoundPlaying(pPlayer->i, DUKE_LONGTERM_PAIN)) - A_PlaySound(DUKE_LONGTERM_PAIN, pPlayer->i); - - P_PalFrom(pPlayer, 32, 0, 8, 0); - pSprite->extra -= 1 + (krand2() & 3); - - return 0; - } - } - break; - - case FLOORPLASMA__STATIC: - if (rnd(32)) - { - if (pPlayer->inv_amount[GET_BOOTS] > 0) - return 1; - else - { - if (!A_CheckSoundPlaying(pPlayer->i, DUKE_LONGTERM_PAIN)) - A_PlaySound(DUKE_LONGTERM_PAIN, pPlayer->i); - - P_PalFrom(pPlayer, 32, 8, 0, 0); - pSprite->extra -= 1 + (krand2() & 3); - - return 0; - } - } - break; - } - - return 0; -} - - - -void P_FragPlayer(int playerNum) -{ - DukePlayer_t *const pPlayer = g_player[playerNum].ps; - spritetype *const pSprite = &sprite[pPlayer->i]; - - //if (g_netClient) // [75] The server should not overwrite its own randomseed - // randomseed = ticrandomseed; - - if (pSprite->pal != 1) - { - P_PalFrom(pPlayer, 63, 63, 0, 0); - - pPlayer->pos.z -= ZOFFSET2; - pSprite->z -= ZOFFSET2; - - int32_t const r1 = krand2(), r2 = krand2(); - pPlayer->dead_flag = (512 - ((r2 & 1) << 10) + (r1 & 255) - 512) & 2047; - - if (pPlayer->dead_flag == 0) - pPlayer->dead_flag++; - -#ifndef NETCODE_DISABLE - //if (g_netServer) - //{ - // packbuf[0] = PACKET_FRAG; - // packbuf[1] = playerNum; - // packbuf[2] = pPlayer->frag_ps; - // packbuf[3] = actor[pPlayer->i].picnum; - // B_BUF32(&packbuf[4], ticrandomseed); - // packbuf[8] = myconnectindex; - // - // enet_host_broadcast(g_netServer, CHAN_GAMESTATE, enet_packet_create(packbuf, 9, ENET_PACKET_FLAG_RELIABLE)); - //} -#endif - } - - pPlayer->jetpack_on = 0; - pPlayer->holoduke_on = -1; - - if (!RR) - S_StopEnvSound(DUKE_JETPACK_IDLE, pPlayer->i); - - S_StopEnvSound(-1, pPlayer->i, CHAN_VOICE); - - if (pSprite->pal != 1 && (pSprite->cstat & 32768) == 0) - pSprite->cstat = 0; - - if ((g_netServer || ud.multimode > 1) && (pSprite->pal != 1 || (pSprite->cstat & 32768))) - { - if (pPlayer->frag_ps != playerNum) - { - if (GTFLAGS(GAMETYPE_TDM) && g_player[pPlayer->frag_ps].ps->team == g_player[playerNum].ps->team) - g_player[pPlayer->frag_ps].ps->fraggedself++; - else - { - g_player[pPlayer->frag_ps].ps->frag++; - g_player[pPlayer->frag_ps].frags[playerNum]++; - g_player[playerNum].frags[playerNum]++; // deaths - } - - if (playerNum == screenpeek) - { - quoteMgr.InitializeQuote(QUOTE_RESERVED, "Killed by %s", &g_player[pPlayer->frag_ps].user_name[0]); - P_DoQuote(QUOTE_RESERVED, pPlayer); - } - else - { - quoteMgr.InitializeQuote(QUOTE_RESERVED2, "Killed %s", &g_player[playerNum].user_name[0]); - P_DoQuote(QUOTE_RESERVED2, g_player[pPlayer->frag_ps].ps); - } - } - pPlayer->frag_ps = playerNum; - pus = NUMPAGES; - } -} - -# define PIPEBOMB_CONTROL(playerNum) (Gv_GetVarByLabel("PIPEBOMB_CONTROL", PIPEBOMB_REMOTE, -1, playerNum)) - -void processweapon_d(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) -{ - DukePlayer_t* const pPlayer = g_player[playerNum].ps; - uint32_t playerBits = g_player[playerNum].input->bits; - if (RR) processweapon_r(playerNum, playerBits, pPlayer->cursectnum); - else processweapon_d(playerNum, playerBits, pPlayer->cursectnum); -} - -void P_EndLevel(void) -{ - for (bssize_t TRAVERSE_CONNECT(playerNum)) - g_player[playerNum].ps->gm = MODE_EOL; - - if (ud.from_bonus) - { - ud.level_number = ud.from_bonus; - m_level_number = ud.level_number; - ud.from_bonus = 0; - } - else - { - ud.level_number = (++ud.level_number < MAXLEVELS) ? ud.level_number : 0; - m_level_number = ud.level_number; - } -} - -static int P_DoFist(DukePlayer_t *pPlayer) -{ - // the fist punching TILE_NUKEBUTTON - - if (++(pPlayer->fist_incs) == 28) - { - if (ud.recstat == 1) - G_CloseDemoWrite(); - - S_PlaySound(PIPEBOMB_EXPLODE); - P_PalFrom(pPlayer, 48, 64, 64, 64); - } - - if (pPlayer->fist_incs > 42) - { - if (pPlayer->buttonpalette && ud.from_bonus == 0) - { - for (bssize_t TRAVERSE_CONNECT(playerNum)) - g_player[playerNum].ps->gm = MODE_EOL; - - ud.from_bonus = ud.level_number + 1; - - if ((unsigned)ud.secretlevel <= MAXLEVELS) - ud.level_number = ud.secretlevel - 1; - - m_level_number = ud.level_number; - } - else - P_EndLevel(); - - pPlayer->fist_incs = 0; - - return 1; - } - - return 0; -} - #ifdef YAX_ENABLE void getzsofslope_player(int sectNum, int playerX, int playerY, int32_t *pCeilZ, int32_t *pFloorZ) { @@ -3096,1178 +2778,6 @@ void P_UpdatePosWhenViewingCam(DukePlayer_t *pPlayer) } -static void P_Dead(int const playerNum, int const sectorLotag, int const floorZ, int const ceilZ) -{ - DukePlayer_t *const pPlayer = g_player[playerNum].ps; - spritetype *const pSprite = &sprite[pPlayer->i]; - - if (ud.recstat == 1 && (!g_netServer && ud.multimode < 2)) - G_CloseDemoWrite(); - - if (/*(numplayers < 2 || g_netServer) && */pPlayer->dead_flag == 0) - P_FragPlayer(playerNum); - - if (sectorLotag == ST_2_UNDERWATER) - { - if (pPlayer->on_warping_sector == 0) - { - if (klabs(pPlayer->pos.z-floorZ) >(PHEIGHT>>1)) - pPlayer->pos.z += 348; - } - else - { - pSprite->z -= 512; - pSprite->zvel = -348; - } - - clipmove((vec3_t *) pPlayer, &pPlayer->cursectnum, - 0, 0, 164, (4L<<8), (4L<<8), CLIPMASK0); - // p->bobcounter += 32; - } - - Bmemcpy(&pPlayer->opos, &pPlayer->pos, sizeof(vec3_t)); - pPlayer->opyoff = pPlayer->pyoff; - - pPlayer->q16horiz = F16(100); - pPlayer->q16horizoff = 0; - - updatesector(pPlayer->pos.x, pPlayer->pos.y, &pPlayer->cursectnum); - - pushmove((vec3_t *) pPlayer, &pPlayer->cursectnum, 128L, (4L<<8), (20L<<8), CLIPMASK0); - - if (floorZ > ceilZ + ZOFFSET2 && pSprite->pal != 1) - pPlayer->rotscrnang = (pPlayer->dead_flag + ((floorZ+pPlayer->pos.z)>>7))&2047; - - pPlayer->on_warping_sector = 0; -} - - -static void P_HandlePal(DukePlayer_t *const pPlayer) -{ - pPlayer->pals.f--; -} - -void onMotorcycle(int snum, int& sb_snum); -void onBoat(int snum, int& sb_snum); - -void P_ProcessInput(int playerNum) -{ - auto &thisPlayer = g_player[playerNum]; - - thisPlayer.horizAngleAdjust = 0; - thisPlayer.horizSkew = 0; - - if (thisPlayer.playerquitflag == 0) - return; - - auto const pPlayer = thisPlayer.ps; - auto const pSprite = &sprite[pPlayer->i]; - - ++pPlayer->player_par; - - int playerBits = thisPlayer.input->bits; - - if (RR) - { - if (RRRA) - g_canSeePlayer = 1; - else - g_canSeePlayer = playerNum; - } - - if (pPlayer->cheat_phase > 0) - playerBits = 0; - - if (RRRA) - { - if (pPlayer->OnMotorcycle && pSprite->extra > 0) - { - onMotorcycle(playerNum, playerBits); - } - else if (pPlayer->OnBoat && pSprite->extra > 0) - { - onBoat(playerNum, playerBits); - } - } - - if (pPlayer->cursectnum == -1) - { - if (pSprite->extra > 0 && ud.clipping == 0) - { - quickkill(pPlayer); - A_PlaySound(SQUISHED, pPlayer->i); - } - - pPlayer->cursectnum = 0; - } - - int sectorLotag = sector[pPlayer->cursectnum].lotag; - - if (RR) - { - if (sectorLotag == 867) - { - int spriteNum = headspritesect[pPlayer->cursectnum]; - while (spriteNum >= 0) - { - int const nextSprite = nextspritesect[spriteNum]; - if (sprite[spriteNum].picnum == TILE_RRTILE380) - if (sprite[spriteNum].z - ZOFFSET3 < pPlayer->pos.z) - sectorLotag = 2; - spriteNum = nextSprite; - } - } - else if (sectorLotag == 7777) - if (ud.volume_number == 1 && ud.level_number == 6) - g_lastLevel = 1; - - if (sectorLotag == 848 && sector[pPlayer->cursectnum].floorpicnum == TILE_WATERTILE2) - sectorLotag = 1; - - if (sectorLotag == 857) - pSprite->clipdist = 1; - else - pSprite->clipdist = 64; - } - - pPlayer->spritebridge = 0; - //pPlayer->sbs = 0; - - int32_t floorZ, ceilZ, highZhit, lowZhit; - if (!RR || pSprite->clipdist == 64) - getzrange((vec3_t *)pPlayer, pPlayer->cursectnum, &ceilZ, &highZhit, &floorZ, &lowZhit, 163, CLIPMASK0); - else - getzrange((vec3_t *)pPlayer, pPlayer->cursectnum, &ceilZ, &highZhit, &floorZ, &lowZhit, 4, CLIPMASK0); - -#ifdef YAX_ENABLE - getzsofslope_player(pPlayer->cursectnum, pPlayer->pos.x, pPlayer->pos.y, &pPlayer->truecz, &pPlayer->truefz); -#else - getzsofslope(pPlayer->cursectnum, pPlayer->pos.x, pPlayer->pos.y, &pPlayer->truecz, &pPlayer->truefz); -#endif - int const trueFloorZ = pPlayer->truefz; - int const trueFloorDist = klabs(pPlayer->pos.z - trueFloorZ); - - if ((lowZhit & 49152) == 16384 && sectorLotag == 1 && trueFloorDist > PHEIGHT + ZOFFSET2) - sectorLotag = 0; - - actor[pPlayer->i].floorz = floorZ; - actor[pPlayer->i].ceilingz = ceilZ; - - if (highZhit >= 0 && (highZhit&49152) == 49152) - { - highZhit &= (MAXSPRITES-1); - - if (sprite[highZhit].statnum == STAT_ACTOR && sprite[highZhit].extra >= 0) - { - highZhit = 0; - ceilZ = pPlayer->truecz; - } - if (RR) - { - if (sprite[highZhit].picnum == TILE_RRTILE3587) - { - if (!pPlayer->stairs) - { - pPlayer->stairs = 10; - if (TEST_SYNC_KEY(playerBits, SK_JUMP) && (!RRRA || !pPlayer->OnMotorcycle)) - { - highZhit = 0; - ceilZ = pPlayer->truecz; - } - } - else - pPlayer->stairs--; - } - } - } - - if (lowZhit >= 0 && (lowZhit&49152) == 49152) - { - int spriteNum = lowZhit&(MAXSPRITES-1); - - if ((sprite[spriteNum].cstat&33) == 33) - { - sectorLotag = 0; - pPlayer->footprintcount = 0; - pPlayer->spritebridge = 1; - //pPlayer->sbs = spriteNum; - } - else if (!RRRA) - goto check_enemy_sprite; - - if (RRRA) - { - if (pPlayer->OnMotorcycle) - { - if (A_CheckEnemySprite(&sprite[spriteNum])) - { - actor[spriteNum].picnum = TILE_MOTOHIT; - actor[spriteNum].extra = 2+(pPlayer->MotoSpeed>>1); - pPlayer->MotoSpeed -= pPlayer->MotoSpeed >> 4; - } - } - if (pPlayer->OnBoat) - { - if (A_CheckEnemySprite(&sprite[spriteNum])) - { - actor[spriteNum].picnum = TILE_MOTOHIT; - actor[spriteNum].extra = 2+(pPlayer->MotoSpeed>>1); - pPlayer->MotoSpeed -= pPlayer->MotoSpeed >> 4; - } - } - else - { -check_enemy_sprite: - if (A_CheckEnemySprite(&sprite[spriteNum]) && sprite[spriteNum].xrepeat > 24 - && klabs(pSprite->z - sprite[spriteNum].z) < (84 << 8)) - { - // TX: I think this is what makes the player slide off enemies... might - // be a good sprite flag to add later. - // Helix: there's also SLIDE_ABOVE_ENEMY. - int spriteAng = getangle(sprite[spriteNum].x - pPlayer->pos.x, - sprite[spriteNum].y - pPlayer->pos.y); - pPlayer->vel.x -= sintable[(spriteAng + 512) & 2047] << 4; - pPlayer->vel.y -= sintable[spriteAng & 2047] << 4; - } - } - } - if (RR) - { - if (sprite[spriteNum].picnum == TILE_RRTILE3587) - { - if (!pPlayer->stairs) - { - pPlayer->stairs = 10; - if (TEST_SYNC_KEY(playerBits, SK_CROUCH) && (!RRRA || !pPlayer->OnMotorcycle)) - { - ceilZ = sprite[spriteNum].z; - highZhit = 0; - floorZ = sprite[spriteNum].z + ZOFFSET6; - } - } - else - pPlayer->stairs--; - } - else if (sprite[spriteNum].picnum == TILE_TOILET || sprite[spriteNum].picnum == TILE_RRTILE2121) - { - if (TEST_SYNC_KEY(playerBits, SK_CROUCH) && (!RRRA || !pPlayer->OnMotorcycle)) - { - A_PlaySound(436, pPlayer->i); - pPlayer->last_pissed_time = 4000; - pPlayer->eat = 0; - } - } - } - } - - if (pSprite->extra > 0) - P_IncurDamage(pPlayer); - else - { - pSprite->extra = 0; - pPlayer->inv_amount[GET_SHIELD] = 0; - } - - pPlayer->last_extra = pSprite->extra; - pPlayer->loogcnt = (pPlayer->loogcnt > 0) ? pPlayer->loogcnt - 1 : 0; - - if (pPlayer->fist_incs && P_DoFist(pPlayer) && !RR) return; - - if (pPlayer->timebeforeexit > 1 && pPlayer->last_extra > 0) - { - if (--pPlayer->timebeforeexit == GAMETICSPERSEC*5) - { - FX_StopAllSounds(); - S_ClearSoundLocks(); - - if (pPlayer->customexitsound >= 0) - { - S_PlaySound(pPlayer->customexitsound); - P_DoQuote(QUOTE_WEREGONNAFRYYOURASS,pPlayer); - } - } - else if (pPlayer->timebeforeexit == 1) - { - for (bssize_t TRAVERSE_CONNECT(playerNum)) - g_player[playerNum].ps->gm = MODE_EOL; - - if (RR && ud.level_number == 6 && ud.volume_number == 0) - g_turdLevel = 1; - if (!RR && ud.from_bonus) - { - ud.level_number = ud.from_bonus; - m_level_number = ud.level_number; - ud.from_bonus = 0; - } - else - { - ud.level_number = (++ud.level_number < MAXLEVELS) ? ud.level_number : 0; - m_level_number = ud.level_number; - } - return; - } - } - - if (pPlayer->pals.f > 0) - P_HandlePal(pPlayer); - - if (pPlayer->fta > 0 && --pPlayer->fta == 0) - { - pub = pus = NUMPAGES; - pPlayer->ftq = 0; - } - - if (g_levelTextTime > 0) - g_levelTextTime--; - - if (pSprite->extra <= 0) - { - P_Dead(playerNum, sectorLotag, floorZ, ceilZ); - return; - } - - if (pPlayer->transporter_hold > 0) - { - pPlayer->transporter_hold--; - if (pPlayer->transporter_hold == 0 && pPlayer->on_warping_sector) - pPlayer->transporter_hold = 2; - } - else if (pPlayer->transporter_hold < 0) - pPlayer->transporter_hold++; - - if (pPlayer->newowner >= 0) - { - P_UpdatePosWhenViewingCam(pPlayer); - fi.doincrements(&ps[playerNum]); - - if ((WW2GI ? PWEAPON(playerNum, pPlayer->curr_weapon, WorksLike) : pPlayer->curr_weapon) == HANDREMOTE_WEAPON) - P_ProcessWeapon(playerNum); - - return; - } - - pPlayer->rotscrnang -= (pPlayer->rotscrnang >> 1); - - if (pPlayer->rotscrnang && !(pPlayer->rotscrnang >> 1)) - pPlayer->rotscrnang -= ksgn(pPlayer->rotscrnang); - - pPlayer->look_ang -= (pPlayer->look_ang >> 2); - - if (pPlayer->look_ang && !(pPlayer->look_ang >> 2)) - pPlayer->look_ang -= ksgn(pPlayer->look_ang); - - if (TEST_SYNC_KEY(playerBits, SK_LOOK_LEFT) && (!RRRA || !pPlayer->OnMotorcycle)) - { - // look_left - if (VM_OnEvent(EVENT_LOOKLEFT,pPlayer->i,playerNum) == 0) - { - pPlayer->look_ang -= 152; - pPlayer->rotscrnang += 24; - } - } - - if (TEST_SYNC_KEY(playerBits, SK_LOOK_RIGHT) && (!RRRA || !pPlayer->OnMotorcycle)) - { - // look_right - if (VM_OnEvent(EVENT_LOOKRIGHT,pPlayer->i,playerNum) == 0) - { - pPlayer->look_ang += 152; - pPlayer->rotscrnang -= 24; - } - } - - if (RRRA && pPlayer->sea_sick) - { - if (pPlayer->sea_sick < 250) - { - if (pPlayer->sea_sick >= 180) - pPlayer->rotscrnang += 24; - else if (pPlayer->sea_sick >= 130) - pPlayer->rotscrnang -= 24; - else if (pPlayer->sea_sick >= 70) - pPlayer->rotscrnang += 24; - else if (pPlayer->sea_sick >= 20) - pPlayer->rotscrnang += 24; - } - if (pPlayer->sea_sick < 250) - pPlayer->addlookang((krand2()&255)-128); - } - - int velocityModifier = TICSPERFRAME; - const uint8_t *const weaponFrame = &pPlayer->kickback_pic; - int floorZOffset = 40; - int const playerShrunk = (pSprite->yrepeat < (RR ? 8 : 32)); - - if (pPlayer->on_crane >= 0) - goto HORIZONLY; - - pPlayer->weapon_sway = (pSprite->xvel < 32 || pPlayer->on_ground == 0 || pPlayer->bobcounter == 1024) - ? (((pPlayer->weapon_sway & 2047) > (1024 + 96)) - ? (pPlayer->weapon_sway - 96) - : (((pPlayer->weapon_sway & 2047) < (1024 - 96))) - ? (pPlayer->weapon_sway + 96) - : 1024) - : pPlayer->bobcounter; - - // NOTE: This silently wraps if the difference is too great, e.g. used to do - // that when teleported by silent SE7s. - pSprite->xvel = ksqrt(uhypsq(pPlayer->pos.x - pPlayer->bobpos.x, pPlayer->pos.y - pPlayer->bobpos.y)); - - if (pPlayer->on_ground) - pPlayer->bobcounter += sprite[pPlayer->i].xvel>>1; - - if (ud.clipping == 0 && ((uint16_t)pPlayer->cursectnum >= MAXSECTORS || sector[pPlayer->cursectnum].floorpicnum == TILE_MIRROR)) - { - pPlayer->pos.x = pPlayer->opos.x; - pPlayer->pos.y = pPlayer->opos.y; - } - else - { - pPlayer->opos.x = pPlayer->pos.x; - pPlayer->opos.y = pPlayer->pos.y; - } - - pPlayer->bobpos.x = pPlayer->pos.x; - pPlayer->bobpos.y = pPlayer->pos.y; - pPlayer->opos.z = pPlayer->pos.z; - pPlayer->opyoff = pPlayer->pyoff; - - if (pPlayer->one_eighty_count < 0) - { - pPlayer->one_eighty_count += 128; - pPlayer->q16ang += F16(128); - } - - // Shrinking code - - if (RR) - { - if (sectorLotag == 17 || (RRRA && sectorLotag == 18)) - { - if (getanimationgoal(§or[pPlayer->cursectnum].floorz) >= 0) - { - if (!S_CheckSoundPlaying(pPlayer->i, 432)) - A_PlaySound(432, pPlayer->i); - } - else - S_StopSound(432); - } - if (pPlayer->sea_sick_stat) - { - pPlayer->pycount += 32; - pPlayer->pycount &= 2047; - if (pPlayer->sea_sick) - pPlayer->pyoff = sintable[pPlayer->pycount]>>2; - else - pPlayer->pyoff = sintable[pPlayer->pycount]>>7; - } - } - - if (isRR()) processmove_r(playerNum, playerBits, pPlayer->cursectnum, floorZ, ceilZ, playerShrunk, trueFloorZ); - else processmove_d(playerNum, playerBits, pPlayer->cursectnum, floorZ, ceilZ, playerShrunk, trueFloorZ); - if (P_CheckLockedMovement(playerNum) & IL_NOMOVE) - { - velocityModifier = 0; - pPlayer->vel.x = 0; - pPlayer->vel.y = 0; - } - else if (thisPlayer.input->q16avel) - pPlayer->crack_time = 777; - - if (pPlayer->spritebridge == 0) - { - int const floorPicnum = sector[pSprite->sectnum].floorpicnum; - - if (!RR && (floorPicnum == TILE_PURPLELAVA || sector[pSprite->sectnum].ceilingpicnum == TILE_PURPLELAVA)) - { - if (pPlayer->inv_amount[GET_BOOTS] > 0) - { - pPlayer->inv_amount[GET_BOOTS]--; - pPlayer->inven_icon = ICON_BOOTS; - if (pPlayer->inv_amount[GET_BOOTS] <= 0) - P_SelectNextInvItem(pPlayer); - } - else - { - if (!A_CheckSoundPlaying(pPlayer->i,DUKE_LONGTERM_PAIN)) - A_PlaySound(DUKE_LONGTERM_PAIN,pPlayer->i); - P_PalFrom(pPlayer, 32, 0, 8, 0); - pSprite->extra--; - } - } - - if (RRRA && pPlayer->on_ground && trueFloorDist <= PHEIGHT+ZOFFSET2 && (floorPicnum == TILE_RRTILE7768 || floorPicnum == TILE_RRTILE7820)) - { - if ((krand2() & 3) == 1) - { - if (pPlayer->OnMotorcycle) - pSprite->extra -= 2; - else - pSprite->extra -= 4; - A_PlaySound(DUKE_LONGTERM_PAIN, pPlayer->i); - } - } - else if (pPlayer->on_ground && trueFloorDist <= PHEIGHT+ZOFFSET2 && P_CheckFloorDamage(pPlayer, floorPicnum)) - { - P_DoQuote(QUOTE_BOOTS_ON, pPlayer); - pPlayer->inv_amount[GET_BOOTS] -= 2; - if (pPlayer->inv_amount[GET_BOOTS] <= 0) - { - pPlayer->inv_amount[GET_BOOTS] = 0; - P_SelectNextInvItem(pPlayer); - } - } - } - - if (pPlayer->vel.x || pPlayer->vel.y || thisPlayer.input->fvel || thisPlayer.input->svel) - { - pPlayer->crack_time = 777; - - int const checkWalkSound = sintable[pPlayer->bobcounter & 2047] >> 12; - - if (RRRA) - { - if (pPlayer->spritebridge == 0 && pPlayer->on_ground) - { - if (sectorLotag == ST_1_ABOVE_WATER) - pPlayer->NotOnWater = 0; - else if (pPlayer->OnBoat) - { - if (sectorLotag == 1234) - pPlayer->NotOnWater = 0; - else - pPlayer->NotOnWater = 1; - } - else - pPlayer->NotOnWater = 1; - } - } - - if ((trueFloorDist < PHEIGHT + ZOFFSET3)) - { - if (checkWalkSound == 1 || checkWalkSound == 3) - { - if (pPlayer->spritebridge == 0 && pPlayer->walking_snd_toggle == 0 && pPlayer->on_ground) - { - switch (sectorLotag) - { - case 0: - { - int const walkPicnum = (lowZhit >= 0 && (lowZhit & 49152) == 49152) - ? TrackerCast(sprite[lowZhit & (MAXSPRITES - 1)].picnum) - : TrackerCast(sector[pPlayer->cursectnum].floorpicnum); - - if (!RR) - switch (DYNAMICTILEMAP(walkPicnum)) - { - case PANNEL1__STATIC: - case PANNEL2__STATIC: - A_PlaySound(DUKE_WALKINDUCTS, pPlayer->i); - pPlayer->walking_snd_toggle = 1; - break; - } - } - break; - - case ST_1_ABOVE_WATER: - if ((krand2() & 1) == 0 && (!RRRA || (!pPlayer->OnBoat && !pPlayer->OnMotorcycle && sector[pPlayer->cursectnum].lotag != 321))) - A_PlaySound(DUKE_ONWATER, pPlayer->i); - pPlayer->walking_snd_toggle = 1; - break; - } - } - } - else if (pPlayer->walking_snd_toggle > 0) - pPlayer->walking_snd_toggle--; - } - - if (pPlayer->jetpack_on == 0 && pPlayer->inv_amount[GET_STEROIDS] > 0 && pPlayer->inv_amount[GET_STEROIDS] < 400) - velocityModifier <<= 1; - - pPlayer->vel.x += (((thisPlayer.input->fvel) * velocityModifier) << 6); - pPlayer->vel.y += (((thisPlayer.input->svel) * velocityModifier) << 6); - - int playerSpeedReduction = 0; - - if (!RRRA && pPlayer->on_ground && (TEST_SYNC_KEY(playerBits, SK_CROUCH) - || (*weaponFrame > 10 && pPlayer->curr_weapon == KNEE_WEAPON))) - playerSpeedReduction = 0x2000; - else if (sectorLotag == ST_2_UNDERWATER) - playerSpeedReduction = 0x1400; - - pPlayer->vel.x = mulscale16(pPlayer->vel.x, pPlayer->runspeed - playerSpeedReduction); - pPlayer->vel.y = mulscale16(pPlayer->vel.y, pPlayer->runspeed - playerSpeedReduction); - - if (RR) - { - if (RRRA) - { - if (sector[pPlayer->cursectnum].floorpicnum == TILE_RRTILE7888) - { - if (pPlayer->OnMotorcycle && pPlayer->on_ground) - pPlayer->moto_on_oil = 1; - } - else if (sector[pPlayer->cursectnum].floorpicnum == TILE_RRTILE7889) - { - if (pPlayer->OnMotorcycle) - { - if (pPlayer->on_ground) - pPlayer->moto_on_mud = 1; - } - else if (pPlayer->inv_amount[GET_BOOTS] > 0) - pPlayer->inv_amount[GET_BOOTS]--; - else - { - pPlayer->vel.x = mulscale16(pPlayer->vel.x, pPlayer->runspeed); - pPlayer->vel.y = mulscale16(pPlayer->vel.y, pPlayer->runspeed); - } - } - } - if (sector[pPlayer->cursectnum].floorpicnum == TILE_RRTILE3073 || sector[pPlayer->cursectnum].floorpicnum == TILE_RRTILE2702) - { - if (RRRA && pPlayer->OnMotorcycle) - { - if (pPlayer->on_ground) - { - pPlayer->vel.x = mulscale16(pPlayer->vel.x, pPlayer->runspeed-0x1800); - pPlayer->vel.y = mulscale16(pPlayer->vel.y, pPlayer->runspeed-0x1800); - } - } - else if (pPlayer->inv_amount[GET_BOOTS] > 0) - pPlayer->inv_amount[GET_BOOTS]--; - else - { - pPlayer->vel.x = mulscale16(pPlayer->vel.x, pPlayer->runspeed-0x1800); - pPlayer->vel.y = mulscale16(pPlayer->vel.y, pPlayer->runspeed-0x1800); - } - } - } - - if (klabs(pPlayer->vel.x) < 2048 && klabs(pPlayer->vel.y) < 2048) - pPlayer->vel.x = pPlayer->vel.y = 0; - - if (playerShrunk) - { - pPlayer->vel.x = mulscale16(pPlayer->vel.x, pPlayer->runspeed - (pPlayer->runspeed >> 1) + (pPlayer->runspeed >> 2)); - pPlayer->vel.y = mulscale16(pPlayer->vel.y, pPlayer->runspeed - (pPlayer->runspeed >> 1) + (pPlayer->runspeed >> 2)); - } - } - -HORIZONLY:; - int stepHeight = (sectorLotag == ST_1_ABOVE_WATER || pPlayer->spritebridge == 1) ? pPlayer->autostep_sbw : pPlayer->autostep; - -#ifdef EDUKE32_TOUCH_DEVICES - if (TEST_SYNC_KEY(playerBits, SK_CROUCH)) - stepHeight = pPlayer->autostep_sbw; -#endif - - if (ud.clipping) - { - pPlayer->pos.x += pPlayer->vel.x >> 14; - pPlayer->pos.y += pPlayer->vel.y >> 14; - updatesector(pPlayer->pos.x, pPlayer->pos.y, &pPlayer->cursectnum); - changespritesect(pPlayer->i, pPlayer->cursectnum); - // This makes the player view lower when shrunk. NOTE that it can get the - // view below the sector floor (and does, when on the ground). - if (pPlayer->jetpack_on == 0 && sectorLotag != ST_2_UNDERWATER && sectorLotag != ST_1_ABOVE_WATER && playerShrunk) - pPlayer->pos.z += ZOFFSET5; - if (RRRA && pPlayer->hurt_delay2 > 0) - pPlayer->hurt_delay2--; - } - else - { -#ifdef YAX_ENABLE - int const playerSectNum = pPlayer->cursectnum; - int16_t ceilingBunch, floorBunch; - - if (playerSectNum >= 0) - yax_getbunches(playerSectNum, &ceilingBunch, &floorBunch); - - // This updatesectorz conflicts with Duke3D's way of teleporting through water, - // so make it a bit conditional... OTOH, this way we have an ugly z jump when - // changing from above water to underwater - - if ((playerSectNum >= 0 && !(sector[playerSectNum].lotag == ST_1_ABOVE_WATER && pPlayer->on_ground && floorBunch >= 0)) - && ((floorBunch >= 0 && !(sector[playerSectNum].floorstat & 512)) - || (ceilingBunch >= 0 && !(sector[playerSectNum].ceilingstat & 512)))) - { - pPlayer->cursectnum += MAXSECTORS; // skip initial z check, restored by updatesectorz - updatesectorz(pPlayer->pos.x, pPlayer->pos.y, pPlayer->pos.z, &pPlayer->cursectnum); - } -#endif - int spriteNum = clipmove((vec3_t *)pPlayer, &pPlayer->cursectnum, pPlayer->vel.x, pPlayer->vel.y, 164, - (4L << 8), stepHeight, CLIPMASK0); - - // This makes the player view lower when shrunk. NOTE that it can get the - // view below the sector floor (and does, when on the ground). - if (pPlayer->jetpack_on == 0 && sectorLotag != ST_2_UNDERWATER && sectorLotag != ST_1_ABOVE_WATER && playerShrunk) - pPlayer->pos.z += ZOFFSET5; - - if (spriteNum) - P_CheckTouchDamage(pPlayer, spriteNum); - else if(RRRA && pPlayer->hurt_delay2 > 0) - pPlayer->hurt_delay2--; - - if (RR) - { - if ((spriteNum & 49152) == 32768) - { - int const wallNum = spriteNum&(MAXWALLS-1); - if (RRRA && pPlayer->OnMotorcycle) - { - int16_t var104, var108, var10c; - var104 = 0; - var108 = getangle(wall[wall[wallNum].point2].x-wall[wallNum].x,wall[wall[wallNum].point2].y-wall[wallNum].y); - var10c = klabs(fix16_to_int(pPlayer->q16ang)-var108); - switch (krand2()&1) - { - case 0: - pPlayer->q16ang += F16(pPlayer->MotoSpeed>>1); - break; - case 1: - pPlayer->q16ang -= F16(pPlayer->MotoSpeed>>1); - break; - } - if (var10c >= 441 && var10c <= 581) - { - var104 = (pPlayer->MotoSpeed*pPlayer->MotoSpeed)>>8; - pPlayer->MotoSpeed = 0; - if (A_CheckSoundPlaying(pPlayer->i, 238) == 0) - A_PlaySound(238,pPlayer->i); - } - else if (var10c >= 311 && var10c <= 711) - { - var104 = (pPlayer->MotoSpeed*pPlayer->MotoSpeed)>>11; - pPlayer->MotoSpeed -= (pPlayer->MotoSpeed>>1)+(pPlayer->MotoSpeed>>2); - if (A_CheckSoundPlaying(pPlayer->i, 238) == 0) - A_PlaySound(238,pPlayer->i); - } - else if (var10c >= 111 && var10c <= 911) - { - var104 = (pPlayer->MotoSpeed*pPlayer->MotoSpeed)>>14; - pPlayer->MotoSpeed -= (pPlayer->MotoSpeed>>1); - if (A_CheckSoundPlaying(pPlayer->i, 239) == 0) - A_PlaySound(239,pPlayer->i); - } - else - { - var104 = (pPlayer->MotoSpeed*pPlayer->MotoSpeed)>>15; - pPlayer->MotoSpeed -= (pPlayer->MotoSpeed>>3); - if (A_CheckSoundPlaying(pPlayer->i, 240) == 0) - A_PlaySound(240,pPlayer->i); - } - pSprite->extra -= var104; - if (pSprite->extra <= 0) - { - A_PlaySound(SQUISHED,pPlayer->i); - P_PalFrom(pPlayer,63,63,0,0); - } - else if (var104) - A_PlaySound(DUKE_LAND_HURT,pPlayer->i); - } - else if (RRRA && pPlayer->OnBoat) - { - short var114, var118; - var114 = getangle(wall[wall[wallNum].point2].x-wall[wallNum].x,wall[wall[wallNum].point2].y-wall[wallNum].y); - var118 = klabs(fix16_to_int(pPlayer->q16ang)-var114); - switch (krand2()&1) - { - case 0: - pPlayer->q16ang += F16(pPlayer->MotoSpeed>>2); - break; - case 1: - pPlayer->q16ang -= F16(pPlayer->MotoSpeed>>2); - break; - } - if (var118 >= 441 && var118 <= 581) - { - pPlayer->MotoSpeed = ((pPlayer->MotoSpeed>>1)+(pPlayer->MotoSpeed>>2))>>2; - if (sectorLotag == 1) - if (A_CheckSoundPlaying(pPlayer->i, 178) == 0) - A_PlaySound(178,pPlayer->i); - } - else if (var118 >= 311 && var118 <= 711) - { - pPlayer->MotoSpeed -= ((pPlayer->MotoSpeed>>1)+(pPlayer->MotoSpeed>>2))>>3; - if (sectorLotag == 1) - if (A_CheckSoundPlaying(pPlayer->i, 179) == 0) - A_PlaySound(179,pPlayer->i); - } - else if (var118 >= 111 && var118 <= 911) - { - pPlayer->MotoSpeed -= (pPlayer->MotoSpeed>>4); - if (sectorLotag == 1) - if (A_CheckSoundPlaying(pPlayer->i, 180) == 0) - A_PlaySound(180,pPlayer->i); - } - else - { - pPlayer->MotoSpeed -= (pPlayer->MotoSpeed>>6); - if (sectorLotag == 1) - if (A_CheckSoundPlaying(pPlayer->i, 181) == 0) - A_PlaySound(181,pPlayer->i); - } - } - else - { - if (wall[wallNum].lotag >= 40 && wall[wallNum].lotag <= 44) - { - if (wall[wallNum].lotag < 44) - dofurniture(wallNum,pPlayer->cursectnum,playerNum); - pushmove(&pPlayer->pos,&pPlayer->cursectnum,172L,(4L<<8),(4L<<8),CLIPMASK0); - } - } - } - else if ((spriteNum & 49152) == 49152) - { - spriteNum &= (MAXSPRITES-1); - - if (RRRA && pPlayer->OnMotorcycle) - { - if (A_CheckEnemySprite(&sprite[spriteNum]) || sprite[spriteNum].picnum == TILE_APLAYER) - { - if (sprite[spriteNum].picnum != TILE_APLAYER) - { - if (numplayers == 1) - { - vec3_t const vect = { - sintable[(pPlayer->TiltStatus*20+fix16_to_int(pPlayer->q16ang)+512)&2047]>>8, - sintable[(pPlayer->TiltStatus*20+fix16_to_int(pPlayer->q16ang))&2047]>>8,sprite[spriteNum].zvel - }; - - A_MoveSprite(spriteNum,&vect,CLIPMASK0); - } - } - else - actor[spriteNum].owner = pPlayer->i; - actor[spriteNum].picnum = TILE_MOTOHIT; - actor[spriteNum].extra = pPlayer->MotoSpeed>>1; - pPlayer->MotoSpeed -= pPlayer->MotoSpeed>>2; - pPlayer->TurbCount = 6; - } - else if ((sprite[spriteNum].picnum == TILE_RRTILE2431 || sprite[spriteNum].picnum == TILE_RRTILE2443 || sprite[spriteNum].picnum == TILE_RRTILE2451 || sprite[spriteNum].picnum == TILE_RRTILE2455) - && sprite[spriteNum].picnum != TILE_ACTIVATORLOCKED && pPlayer->MotoSpeed > 45) - { - A_PlaySound(SQUISHED,spriteNum); - if (sprite[spriteNum].picnum == TILE_RRTILE2431 || sprite[spriteNum].picnum == TILE_RRTILE2451) - { - if (sprite[spriteNum].lotag != 0) - { - for(bssize_t otherSprite = 0; otherSprite < MAXSPRITES; otherSprite++) - { - if ((sprite[otherSprite].picnum == TILE_RRTILE2431 || sprite[otherSprite].picnum == TILE_RRTILE2451) && sprite[otherSprite].pal == 4) - { - if (sprite[spriteNum].lotag == sprite[otherSprite].lotag) - { - sprite[otherSprite].xrepeat = 0; - sprite[otherSprite].yrepeat = 0; - } - } - } - } - A_DoGuts(spriteNum,TILE_RRTILE2460,12); - A_DoGuts(spriteNum,TILE_RRTILE2465,3); - } - else - A_DoGuts(spriteNum,TILE_RRTILE2465,3); - A_DoGuts(spriteNum,TILE_RRTILE2465,3); - sprite[spriteNum].xrepeat = 0; - sprite[spriteNum].yrepeat = 0; - } - } - else if (RRRA && pPlayer->OnBoat) - { - if (A_CheckEnemySprite(&sprite[spriteNum]) || sprite[spriteNum].picnum == TILE_APLAYER) - { - if (sprite[spriteNum].picnum != TILE_APLAYER) - { - if (numplayers == 1) - { - vec3_t const vect = { - sintable[(pPlayer->TiltStatus*20+fix16_to_int(pPlayer->q16ang)+512)&2047]>>9, - sintable[(pPlayer->TiltStatus*20+fix16_to_int(pPlayer->q16ang))&2047]>>9,sprite[spriteNum].zvel - }; - - A_MoveSprite(spriteNum,&vect,CLIPMASK0); - } - } - else - actor[spriteNum].owner = pPlayer->i; - actor[spriteNum].picnum = TILE_MOTOHIT; - actor[spriteNum].extra = pPlayer->MotoSpeed>>2; - pPlayer->MotoSpeed -= pPlayer->MotoSpeed>>2; - pPlayer->TurbCount = 6; - } - } - else if (A_CheckEnemySprite(&sprite[spriteNum])) - { - if (sprite[spriteNum].statnum != STAT_ACTOR) - { - actor[spriteNum].timetosleep = 0; - if (sprite[spriteNum].picnum == TILE_BILLYRAY) - A_PlaySound(404, spriteNum); - else - fi.check_fta_sounds(spriteNum); - changespritestat(spriteNum, STAT_ACTOR); - } - } - if (sprite[spriteNum].picnum == TILE_RRTILE3410) - { - quickkill(pPlayer); - A_PlaySound(446, pPlayer->i); - } - else if (RRRA && sprite[spriteNum].picnum == TILE_RRTILE2443 && sprite[spriteNum].pal == 19) - { - sprite[spriteNum].pal = 0; - pPlayer->DrugMode = 5; - pPlayer->drug_timer = (int32_t) totalclock; - sprite[pPlayer->i].extra = max_player_health; - } - } - } - } - - if (pPlayer->jetpack_on == 0) - { - if (pSprite->xvel > 16) - { - if (sectorLotag != ST_1_ABOVE_WATER && sectorLotag != ST_2_UNDERWATER && pPlayer->on_ground && (!RRRA || !pPlayer->sea_sick_stat)) - { - pPlayer->pycount += 52; - pPlayer->pycount &= 2047; - pPlayer->pyoff = klabs(pSprite->xvel * sintable[pPlayer->pycount]) / 1596; - } - } - else if (sectorLotag != ST_2_UNDERWATER && sectorLotag != ST_1_ABOVE_WATER && (!RRRA || !pPlayer->sea_sick_stat)) - pPlayer->pyoff = 0; - } - - pPlayer->pos.z += PHEIGHT; - setsprite(pPlayer->i, &pPlayer->pos); - pPlayer->pos.z -= PHEIGHT; - - if (RR) - { - if (sectorLotag == 800 && (!RRRA || !pPlayer->lotag800kill)) - { - if (RRRA) - pPlayer->lotag800kill = 1; - quickkill(pPlayer); - return; - } - } - - // ST_2_UNDERWATER - if (pPlayer->cursectnum >= 0 && sectorLotag < 3) - { - usectortype const *pSector = (usectortype *)§or[pPlayer->cursectnum]; - - // TRAIN_SECTOR_TO_SE_INDEX - if ((!ud.clipping && pSector->lotag == ST_31_TWO_WAY_TRAIN) && - ((unsigned)pSector->hitag < MAXSPRITES && sprite[pSector->hitag].xvel && actor[pSector->hitag].t_data[0] == 0)) - { - quickkill(pPlayer); - return; - } - } - - if ((pPlayer->cursectnum >= 0 && trueFloorDist < PHEIGHT && pPlayer->on_ground && sectorLotag != ST_1_ABOVE_WATER && - playerShrunk == 0 && sector[pPlayer->cursectnum].lotag == ST_1_ABOVE_WATER) && (!A_CheckSoundPlaying(pPlayer->i, DUKE_ONWATER))) - if (!RRRA || (!pPlayer->OnBoat && !pPlayer->OnMotorcycle && sector[pPlayer->cursectnum].lotag != 321)) - A_PlaySound(DUKE_ONWATER, pPlayer->i); - - if (pPlayer->cursectnum >= 0 && pPlayer->cursectnum != pSprite->sectnum) - changespritesect(pPlayer->i, pPlayer->cursectnum); - - if (pPlayer->cursectnum >= 0 && ud.clipping == 0) - { - int const squishPlayer = (pushmove((vec3_t *)pPlayer, &pPlayer->cursectnum, (!RR || pSprite->clipdist == 64) ? 164 : 16, (4L << 8), (4L << 8), CLIPMASK0) < 0 && - furthestangle(pPlayer->i, 8) < 512); - - if (squishPlayer || klabs(actor[pPlayer->i].floorz-actor[pPlayer->i].ceilingz) < (48<<8)) - { - if (!(sector[pSprite->sectnum].lotag & 0x8000u) && - (isanunderoperator(sector[pSprite->sectnum].lotag) || isanearoperator(sector[pSprite->sectnum].lotag))) - fi.activatebysector(pSprite->sectnum, pPlayer->i); - - if (squishPlayer) - { - quickkill(pPlayer); - return; - } - } - else if (klabs(floorZ - ceilZ) < ZOFFSET5 && isanunderoperator(sector[pPlayer->cursectnum].lotag)) - fi.activatebysector(pPlayer->cursectnum, pPlayer->i); - - if (RR && sector[pPlayer->cursectnum].ceilingz > (sector[pPlayer->cursectnum].floorz-ZOFFSET4)) - { - quickkill(pPlayer); - return; - } - } - - if (pPlayer->return_to_center > 0) - pPlayer->return_to_center--; - - if (TEST_SYNC_KEY(playerBits, SK_CENTER_VIEW) || pPlayer->hard_landing) - if (VM_OnEvent(EVENT_RETURNTOCENTER, pPlayer->i,playerNum) == 0) - pPlayer->return_to_center = 9; - - if (TEST_SYNC_KEY(playerBits, SK_LOOK_UP)) - { - if (VM_OnEvent(EVENT_LOOKUP, pPlayer->i, playerNum) == 0) - { - pPlayer->return_to_center = 9; - thisPlayer.horizRecenter = true; - thisPlayer.horizAngleAdjust = float(12<<(int)(TEST_SYNC_KEY(playerBits, SK_RUN))); - } - } - else if (TEST_SYNC_KEY(playerBits, SK_LOOK_DOWN)) - { - if (VM_OnEvent(EVENT_LOOKDOWN,pPlayer->i,playerNum) == 0) - { - pPlayer->return_to_center = 9; - thisPlayer.horizRecenter = true; - thisPlayer.horizAngleAdjust = -float(12<<(int)(TEST_SYNC_KEY(playerBits, SK_RUN))); - } - } - else if (TEST_SYNC_KEY(playerBits, SK_AIM_UP) && (!RRRA || !pPlayer->OnMotorcycle)) - { - if (VM_OnEvent(EVENT_AIMUP,pPlayer->i,playerNum) == 0) - { - thisPlayer.horizAngleAdjust = float(6 << (int)(TEST_SYNC_KEY(playerBits, SK_RUN))); - thisPlayer.horizRecenter = false; - } - } - else if (TEST_SYNC_KEY(playerBits, SK_AIM_DOWN) && (!RRRA || !pPlayer->OnMotorcycle)) - { - if (VM_OnEvent(EVENT_AIMDOWN,pPlayer->i,playerNum) == 0) - { - thisPlayer.horizAngleAdjust = -float(6 << (int)(TEST_SYNC_KEY(playerBits, SK_RUN))); - thisPlayer.horizRecenter = false; - } - } - if (RR && pPlayer->recoil && *weaponFrame == 0) - { - int delta = pPlayer->recoil >> 1; - if (!delta) delta++; - pPlayer->recoil -= delta; - pPlayer->q16horiz -= F16(delta); - } - - if (pPlayer->hard_landing > 0) - { - thisPlayer.horizSkew = fix16_from_int(-(pPlayer->hard_landing << 4)); - pPlayer->hard_landing--; - } - - //Shooting code/changes - - if (pPlayer->show_empty_weapon > 0) - { - --pPlayer->show_empty_weapon; - - if (!RR && pPlayer->show_empty_weapon == 0) - { - if (pPlayer->last_full_weapon == GROW_WEAPON) - pPlayer->subweapon |= (1 << GROW_WEAPON); - else if (pPlayer->last_full_weapon == SHRINKER_WEAPON) - pPlayer->subweapon &= ~(1 << GROW_WEAPON); - - P_AddWeapon(pPlayer, pPlayer->last_full_weapon); - return; - } - } - - if (RR && pPlayer->show_empty_weapon == 1) - { - P_AddWeapon(pPlayer, pPlayer->last_full_weapon); - return; - } - - if (pPlayer->knee_incs > 0) - { - thisPlayer.horizSkew = F16(-48); - thisPlayer.horizRecenter = true; - pPlayer->return_to_center = 9; - - if (++pPlayer->knee_incs > 15) - { - pPlayer->knee_incs = 0; - pPlayer->holster_weapon = 0; - pPlayer->weapon_pos = klabs(pPlayer->weapon_pos); - - if (pPlayer->actorsqu >= 0 && sprite[pPlayer->actorsqu].statnum != MAXSTATUS && - dist(&sprite[pPlayer->i], &sprite[pPlayer->actorsqu]) < 1400) - { - A_DoGuts(pPlayer->actorsqu, TILE_JIBS6, 7); - fi.spawn(pPlayer->actorsqu, TILE_BLOODPOOL); - A_PlaySound(SQUISHED, pPlayer->actorsqu); - switch (DYNAMICTILEMAP(sprite[pPlayer->actorsqu].picnum)) - { - case FEM1__STATIC: - case FEM2__STATIC: - case FEM3__STATIC: - case FEM4__STATIC: - case FEM5__STATIC: - case FEM6__STATIC: - case FEM7__STATIC: - case FEM8__STATIC: - case FEM9__STATIC: - case PODFEM1__STATIC: - if (RR) - break; - fallthrough__; - case FEM10__STATIC: - case NAKED1__STATIC: - case STATUE__STATIC: - if (sprite[pPlayer->actorsqu].yvel) - fi.operaterespawns(sprite[pPlayer->actorsqu].yvel); - A_DeleteSprite(pPlayer->actorsqu); - break; - case APLAYER__STATIC: - { - int playerSquished = P_Get(pPlayer->actorsqu); - quickkill(g_player[playerSquished].ps); - g_player[playerSquished].ps->frag_ps = playerNum; - break; - } - default: - if (A_CheckEnemySprite(&sprite[pPlayer->actorsqu])) - P_AddKills(pPlayer, 1); - A_DeleteSprite(pPlayer->actorsqu); - break; - } - } - pPlayer->actorsqu = -1; - } - else if (pPlayer->actorsqu >= 0) - pPlayer->q16ang += fix16_from_int( - getincangle(fix16_to_int(pPlayer->q16ang), - getangle(sprite[pPlayer->actorsqu].x - pPlayer->pos.x, sprite[pPlayer->actorsqu].y - pPlayer->pos.y)) - >> 2); - } - - if (fi.doincrements(&ps[playerNum])) - return; - - switch (pPlayer->weapon_pos) - { - case WEAPON_POS_LOWER: - if (pPlayer->last_weapon >= 0) - { - pPlayer->weapon_pos = WEAPON_POS_RAISE; - pPlayer->last_weapon = -1; - } - else if (pPlayer->holster_weapon == 0) - pPlayer->weapon_pos = WEAPON_POS_RAISE; - break; - case 0: break; - default: pPlayer->weapon_pos--; break; - } - - P_ProcessWeapon(playerNum); -} int P_HasKey(int sectNum, int playerNum)