From 911330ed37de9bc6bee25c552a285fb315cecfe8 Mon Sep 17 00:00:00 2001 From: sirlemonhead Date: Tue, 29 Oct 2019 22:31:40 +0000 Subject: [PATCH] Tidied up door handling key. Removed some repeated code and commented-out code --- source/exhumed/src/player.cpp | 129 ++-------------------------------- 1 file changed, 7 insertions(+), 122 deletions(-) diff --git a/source/exhumed/src/player.cpp b/source/exhumed/src/player.cpp index 6ec3dcf51..bc6423ff1 100644 --- a/source/exhumed/src/player.cpp +++ b/source/exhumed/src/player.cpp @@ -1717,6 +1717,8 @@ do_default: default: { // loc_1B3C7 + + // CHECKME - is order of evaluation correct? if (levelnum <= 20 || var_70 >= 25 && (var_70 <= 25 || var_70 == 50)) { DestroyItemAnim(nValB); @@ -2542,23 +2544,13 @@ do_default_b: break; } - // Lots of repeated code for key handling + // Lots of repeated code for door key handling case 39: // Power key { - int eax = 0; - int ecx; + int ecx = 4096; var_88 = -1; - if (!eax) - { - ecx = 4096; - } - else - { - ecx = 4096 << eax; - } - if (PlayerList[nPlayer].keys != ecx) { if (nPlayer == nLocalPlayer) { @@ -2575,43 +2567,16 @@ do_default_b: { goto do_default; } -#if 0 - // loc_1BA74: - if (nPlayer == nLocalPlayer) - { - if (nItemText[var_70] > -1 && nTotalPlayers == 1) - { - StatusMessage(400, gString[nItemTextIndex + nItemText[var_70]]); - } - - TintPalette(var_44*4, var_8C*4, 0); - - if (var_88 > -1) - { - PlayLocalSound(var_88, 0); - } - } -#endif } break; } case 40: // Time key { - int eax = 1; - int ecx; + int ecx = 4096 << 1; var_88 = -1; - if (!eax) - { - ecx = 4096; - } - else - { - ecx = 4096 << eax; - } - if (PlayerList[nPlayer].keys != ecx) { if (nPlayer == nLocalPlayer) { @@ -2628,46 +2593,16 @@ do_default_b: { goto do_default; } -#if 0 - if (nTotalPlayers > 1) - { - // loc_1BA74: - if (nPlayer == nLocalPlayer) - { - if (nItemText[var_70] > -1 && nTotalPlayers == 1) - { - StatusMessage(400, gString[nItemTextIndex + nItemText[var_70]]); - } - - TintPalette(var_44*4, var_8C*4, 0); - - if (var_88 > -1) - { - PlayLocalSound(var_88, 0); - } - } - } -#endif } break; } case 41: // War key { - int eax = 2; - int ecx; + int ecx = 4096 << 2; var_88 = -1; - if (!eax) - { - ecx = 4096; - } - else - { - ecx = 4096 << eax; - } - if (PlayerList[nPlayer].keys != ecx) { if (nPlayer == nLocalPlayer) { @@ -2684,46 +2619,16 @@ do_default_b: { goto do_default; } -#if 0 - if (nTotalPlayers > 1) - { - // loc_1BA74: - if (nPlayer == nLocalPlayer) - { - if (nItemText[var_70] > -1 && nTotalPlayers == 1) - { - StatusMessage(400, gString[nItemTextIndex + nItemText[var_70]]); - } - - TintPalette(var_44*4, var_8C*4, 0); - - if (var_88 > -1) - { - PlayLocalSound(var_88, 0); - } - } - } -#endif } break; } case 42: // Earth key { - int eax = 3; - int ecx; + int ecx = 4096 << 3; var_88 = -1; - if (!eax) - { - ecx = 4096; - } - else - { - ecx = 4096 << eax; - } - if (PlayerList[nPlayer].keys != ecx) { if (nPlayer == nLocalPlayer) { @@ -2740,26 +2645,6 @@ do_default_b: { goto do_default; } -#if 0 - if (nTotalPlayers > 1) - { - // loc_1BA74: - if (nPlayer == nLocalPlayer) - { - if (nItemText[var_70] > -1 && nTotalPlayers == 1) - { - StatusMessage(400, gString[nItemTextIndex + nItemText[var_70]]); - } - - TintPalette(var_44*4, var_8C*4, 0); - - if (var_88 > -1) - { - PlayLocalSound(var_88, 0); - } - } - } -#endif } break;