From 7fd395b5d77a9ba3a46000ade15f5e867949c786 Mon Sep 17 00:00:00 2001 From: Christoph Oelckers Date: Thu, 26 Sep 2019 00:19:49 +0200 Subject: [PATCH] - removed some legacy demo stuff from RedNukem backend. --- source/build/include/cache1d.h | 2 -- source/rr/src/actors.cpp | 1 - source/rr/src/gameexec.cpp | 27 ++++------------------ source/rr/src/player.cpp | 41 ++++++++-------------------------- 4 files changed, 13 insertions(+), 58 deletions(-) diff --git a/source/build/include/cache1d.h b/source/build/include/cache1d.h index c161fe0a3..80057205d 100644 --- a/source/build/include/cache1d.h +++ b/source/build/include/cache1d.h @@ -148,9 +148,7 @@ void klistfree(CACHE1D_FIND_REC *rec); CACHE1D_FIND_REC *klistpath(const char *path, const char *mask, int type); extern int32_t lz4CompressionLevel; -int32_t kdfread(void *buffer, int dasizeof, int count, buildvfs_kfd fil); int32_t kdfread_LZ4(void *buffer, int dasizeof, int count, buildvfs_kfd fil); -void dfwrite(const void *buffer, int dasizeof, int count, buildvfs_FILE fil); void dfwrite_LZ4(const void *buffer, int dasizeof, int count, buildvfs_FILE fil); #endif // cache1d_h_ diff --git a/source/rr/src/actors.cpp b/source/rr/src/actors.cpp index 15bc05387..4e2845cca 100644 --- a/source/rr/src/actors.cpp +++ b/source/rr/src/actors.cpp @@ -3899,7 +3899,6 @@ void A_ResetLanePics(void) ACTOR_STATIC void G_MoveActors(void) { - extern char g_demo_legacy; int spriteNum; if (g_jailDoorCnt) diff --git a/source/rr/src/gameexec.cpp b/source/rr/src/gameexec.cpp index f734e4588..8c5ae4363 100644 --- a/source/rr/src/gameexec.cpp +++ b/source/rr/src/gameexec.cpp @@ -911,7 +911,6 @@ static int32_t A_GetWaterZOffset(int const spriteNum) static void VM_Fall(int const spriteNum, spritetype * const pSprite) { - extern char g_demo_legacy; int spriteGravity = g_spriteGravity; int hitSprite = 0; @@ -927,10 +926,7 @@ static void VM_Fall(int const spriteNum, spritetype * const pSprite) { A_Spawn(vm.spriteNum, ROCK2); A_Spawn(vm.spriteNum, ROCK2); - if (ud.recstat == 2 && g_demo_legacy) - A_DeleteSprite(vm.spriteNum); - else - vm.flags |= VM_SAFEDELETE; + vm.flags |= VM_SAFEDELETE; } } else if (sector[vm.pSprite->sectnum].lotag == 802) @@ -939,20 +935,14 @@ static void VM_Fall(int const spriteNum, spritetype * const pSprite) { A_DoGuts(vm.spriteNum, JIBS6, 5); A_PlaySound(SQUISHED, vm.spriteNum); - if (ud.recstat == 2 && g_demo_legacy) - A_DeleteSprite(vm.spriteNum); - else - vm.flags |= VM_SAFEDELETE; + vm.flags |= VM_SAFEDELETE; } } else if (sector[vm.pSprite->sectnum].lotag == 803) { if (vm.pSprite->picnum == ROCK2) { - if (ud.recstat == 2 && g_demo_legacy) - A_DeleteSprite(vm.spriteNum); - else - vm.flags |= VM_SAFEDELETE; + vm.flags |= VM_SAFEDELETE; } } } @@ -960,10 +950,7 @@ static void VM_Fall(int const spriteNum, spritetype * const pSprite) { if (vm.pSprite->picnum == AMMO) { - if (ud.recstat == 2 && g_demo_legacy) - A_DeleteSprite(vm.spriteNum); - else - vm.flags |= VM_SAFEDELETE; + vm.flags |= VM_SAFEDELETE; return; } if (vm.pSprite->picnum != APLAYER && (A_CheckEnemySprite(vm.pSprite) || vm.pSprite->picnum == COW) && g_spriteExtra[vm.spriteNum] < 128) @@ -1586,12 +1573,6 @@ GAMEEXEC_STATIC void VM_Execute(native_t loop) VM_CONDITIONAL(0); } - { - // This crashes VM... - extern char g_demo_legacy; - if (ud.recstat == 2 && g_demo_legacy) - insptr++; - } continue; case CON_SOUNDTAG: diff --git a/source/rr/src/player.cpp b/source/rr/src/player.cpp index fbcc8dee6..04149894f 100644 --- a/source/rr/src/player.cpp +++ b/source/rr/src/player.cpp @@ -6133,8 +6133,6 @@ static void P_HandlePal(DukePlayer_t *const pPlayer) pPlayer->pals.f--; } -extern char g_demo_legacy; - void P_ProcessInput(int playerNum) { if (g_player[playerNum].playerquitflag == 0) @@ -6781,27 +6779,15 @@ void P_ProcessInput(int playerNum) } } - if (ud.recstat == 2 && g_demo_legacy) + if (pPlayer->q16horizoff > 0) { - int horizoff = fix16_to_int(pPlayer->q16horizoff); - if (horizoff > 0) - horizoff -= ((horizoff >> 3) + 1); - else if (horizoff < 0) - horizoff += (((-horizoff) >> 3) + 1); - pPlayer->q16horizoff = F16(horizoff); + pPlayer->q16horizoff -= ((pPlayer->q16horizoff >> 3) + fix16_one); + pPlayer->q16horizoff = max(pPlayer->q16horizoff, 0); } - else + else if (pPlayer->q16horizoff < 0) { - if (pPlayer->q16horizoff > 0) - { - pPlayer->q16horizoff -= ((pPlayer->q16horizoff >> 3) + fix16_one); - pPlayer->q16horizoff = max(pPlayer->q16horizoff, 0); - } - else if (pPlayer->q16horizoff < 0) - { - pPlayer->q16horizoff += (((-pPlayer->q16horizoff) >> 3) + fix16_one); - pPlayer->q16horizoff = min(pPlayer->q16horizoff, 0); - } + pPlayer->q16horizoff += (((-pPlayer->q16horizoff) >> 3) + fix16_one); + pPlayer->q16horizoff = min(pPlayer->q16horizoff, 0); } if (highZhit >= 0 && (highZhit&49152) == 49152) @@ -7403,11 +7389,7 @@ check_enemy_sprite: { fix16_t const inputAng = g_player[playerNum].inputBits->q16avel; - if (ud.recstat == 2 && g_demo_legacy) - pPlayer->q16angvel = (sectorLotag == ST_2_UNDERWATER) ? ((fix16_to_int(inputAng) - (fix16_to_int(inputAng) >> 3))*fix16_from_int(ksgn(velocityModifier))) - : (fix16_to_int(inputAng) * fix16_from_int(ksgn(velocityModifier))); - else - pPlayer->q16angvel = (sectorLotag == ST_2_UNDERWATER) ? fix16_mul(inputAng - (inputAng >> 3), fix16_from_int(ksgn(velocityModifier))) + pPlayer->q16angvel = (sectorLotag == ST_2_UNDERWATER) ? fix16_mul(inputAng - (inputAng >> 3), fix16_from_int(ksgn(velocityModifier))) : fix16_mul(inputAng, fix16_from_int(ksgn(velocityModifier))); pPlayer->q16ang += pPlayer->q16angvel; pPlayer->q16ang &= 0x7FFFFFF; @@ -7983,10 +7965,7 @@ HORIZONLY:; else if (pPlayer->return_to_center > 0 && !TEST_SYNC_KEY(playerBits, SK_LOOK_UP) && !TEST_SYNC_KEY(playerBits, SK_LOOK_DOWN)) { pPlayer->return_to_center--; - if (ud.recstat == 2 && g_demo_legacy) - pPlayer->q16horiz += F16(33-fix16_to_int(pPlayer->q16horiz) / 3); - else - pPlayer->q16horiz += F16(33)-fix16_div(pPlayer->q16horiz, F16(3)); + pPlayer->q16horiz += F16(33)-fix16_div(pPlayer->q16horiz, F16(3)); centerHoriz++; } @@ -7996,9 +7975,7 @@ HORIZONLY:; pPlayer->q16horiz -= fix16_from_int(pPlayer->hard_landing<<4); } - pPlayer->q16horiz = fix16_clamp(pPlayer->q16horiz + ((ud.recstat == 2 && g_demo_legacy && !pPlayer->aim_mode) ? 0 : g_player[playerNum].inputBits->q16horz), F16(HORIZ_MIN), F16(HORIZ_MAX)); - - if (ud.recstat == 2 && g_demo_legacy) centerHoriz = !pPlayer->aim_mode; + pPlayer->q16horiz = fix16_clamp(pPlayer->q16horiz + g_player[playerNum].inputBits->q16horz, F16(HORIZ_MIN), F16(HORIZ_MAX)); if (centerHoriz && (!RR || !pPlayer->recoil)) {