Tidied up door handling key. Removed some repeated code and commented-out code

This commit is contained in:
sirlemonhead 2019-10-29 22:31:40 +00:00 committed by Christoph Oelckers
parent bff4d2b65d
commit 911330ed37

View file

@ -1717,6 +1717,8 @@ do_default:
default: default:
{ {
// loc_1B3C7 // loc_1B3C7
// CHECKME - is order of evaluation correct?
if (levelnum <= 20 || var_70 >= 25 && (var_70 <= 25 || var_70 == 50)) if (levelnum <= 20 || var_70 >= 25 && (var_70 <= 25 || var_70 == 50))
{ {
DestroyItemAnim(nValB); DestroyItemAnim(nValB);
@ -2542,23 +2544,13 @@ do_default_b:
break; break;
} }
// Lots of repeated code for key handling // Lots of repeated code for door key handling
case 39: // Power key case 39: // Power key
{ {
int eax = 0; int ecx = 4096;
int ecx;
var_88 = -1; var_88 = -1;
if (!eax)
{
ecx = 4096;
}
else
{
ecx = 4096 << eax;
}
if (PlayerList[nPlayer].keys != ecx) if (PlayerList[nPlayer].keys != ecx)
{ {
if (nPlayer == nLocalPlayer) { if (nPlayer == nLocalPlayer) {
@ -2575,43 +2567,16 @@ do_default_b:
{ {
goto do_default; 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; break;
} }
case 40: // Time key case 40: // Time key
{ {
int eax = 1; int ecx = 4096 << 1;
int ecx;
var_88 = -1; var_88 = -1;
if (!eax)
{
ecx = 4096;
}
else
{
ecx = 4096 << eax;
}
if (PlayerList[nPlayer].keys != ecx) if (PlayerList[nPlayer].keys != ecx)
{ {
if (nPlayer == nLocalPlayer) { if (nPlayer == nLocalPlayer) {
@ -2628,46 +2593,16 @@ do_default_b:
{ {
goto do_default; 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; break;
} }
case 41: // War key case 41: // War key
{ {
int eax = 2; int ecx = 4096 << 2;
int ecx;
var_88 = -1; var_88 = -1;
if (!eax)
{
ecx = 4096;
}
else
{
ecx = 4096 << eax;
}
if (PlayerList[nPlayer].keys != ecx) if (PlayerList[nPlayer].keys != ecx)
{ {
if (nPlayer == nLocalPlayer) { if (nPlayer == nLocalPlayer) {
@ -2684,46 +2619,16 @@ do_default_b:
{ {
goto do_default; 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; break;
} }
case 42: // Earth key case 42: // Earth key
{ {
int eax = 3; int ecx = 4096 << 3;
int ecx;
var_88 = -1; var_88 = -1;
if (!eax)
{
ecx = 4096;
}
else
{
ecx = 4096 << eax;
}
if (PlayerList[nPlayer].keys != ecx) if (PlayerList[nPlayer].keys != ecx)
{ {
if (nPlayer == nLocalPlayer) { if (nPlayer == nLocalPlayer) {
@ -2740,26 +2645,6 @@ do_default_b:
{ {
goto do_default; 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; break;