Browse Source

PressChar bin exact as C++ (#1136)

pull/109/head
galaxyhaxz 7 years ago committed by Anders Jenbo
parent
commit
0b1b4e8062
  1. 73
      Source/diablo.cpp

73
Source/diablo.cpp

@ -1289,6 +1289,7 @@ void diablo_pause_game()
// 525740: using guessed type int PauseMode; // 525740: using guessed type int PauseMode;
// 679660: using guessed type char gbMaxPlayers; // 679660: using guessed type char gbMaxPlayers;
/* NOTE: `return` must be used instead of `break` to be bin exact as C++ */
void PressChar(int vkey) void PressChar(int vkey)
{ {
if(gmenu_exception() || control_talk_last_key(vkey) || sgnTimeoutCurs != 0 || deathflag) { if(gmenu_exception() || control_talk_last_key(vkey) || sgnTimeoutCurs != 0 || deathflag) {
@ -1314,11 +1315,11 @@ void PressChar(int vkey)
case 'G': case 'G':
case 'g': case 'g':
DecreaseGamma(); DecreaseGamma();
break; return;
case 'F': case 'F':
case 'f': case 'f':
IncreaseGamma(); IncreaseGamma();
break; return;
case 'I': case 'I':
case 'i': case 'i':
if(!stextflag) { if(!stextflag) {
@ -1334,7 +1335,7 @@ void PressChar(int vkey)
} }
} }
} }
break; return;
case 'C': case 'C':
case 'c': case 'c':
if(!stextflag) { if(!stextflag) {
@ -1350,7 +1351,7 @@ void PressChar(int vkey)
} }
} }
} }
break; return;
case 'Q': case 'Q':
case 'q': case 'q':
if(!stextflag) { if(!stextflag) {
@ -1361,11 +1362,11 @@ void PressChar(int vkey)
questlog = FALSE; questlog = FALSE;
} }
} }
break; return;
case 'Z': case 'Z':
case 'z': case 'z':
zoomflag = zoomflag == 0; zoomflag = zoomflag == 0;
break; return;
case 'S': case 'S':
case 's': case 's':
if(!stextflag) { if(!stextflag) {
@ -1377,86 +1378,86 @@ void PressChar(int vkey)
} }
track_repeat_walk(0); track_repeat_walk(0);
} }
break; return;
case 'B': case 'B':
case 'b': case 'b':
if(!stextflag) { if(!stextflag) {
invflag = 0; invflag = 0;
sbookflag = sbookflag == 0; sbookflag = sbookflag == 0;
} }
break; return;
case '+': case '+':
case '=': case '=':
if(automapflag) { if(automapflag) {
AutomapZoomIn(); AutomapZoomIn();
} }
break; return;
case '-': case '-':
case '_': case '_':
if(automapflag) { if(automapflag) {
AutomapZoomOut(); AutomapZoomOut();
} }
break; return;
case 'v': case 'v':
NetSendCmdString(1 << myplr, gszProductName); NetSendCmdString(1 << myplr, gszProductName);
break; return;
case 'V': case 'V':
NetSendCmdString(1 << myplr, gszVersionNumber); NetSendCmdString(1 << myplr, gszVersionNumber);
break; return;
case '!': case '!':
case '1': case '1':
if(plr[myplr].SpdList[0]._itype != -1 && plr[myplr].SpdList[0]._itype != 11) { if(plr[myplr].SpdList[0]._itype != -1 && plr[myplr].SpdList[0]._itype != 11) {
UseInvItem(myplr, 47); UseInvItem(myplr, 47);
} }
break; return;
case '@': case '@':
case '2': case '2':
if(plr[myplr].SpdList[1]._itype != -1 && plr[myplr].SpdList[1]._itype != 11) { if(plr[myplr].SpdList[1]._itype != -1 && plr[myplr].SpdList[1]._itype != 11) {
UseInvItem(myplr, 48); UseInvItem(myplr, 48);
} }
break; return;
case '#': case '#':
case '3': case '3':
if(plr[myplr].SpdList[2]._itype != -1 && plr[myplr].SpdList[2]._itype != 11) { if(plr[myplr].SpdList[2]._itype != -1 && plr[myplr].SpdList[2]._itype != 11) {
UseInvItem(myplr, 49); UseInvItem(myplr, 49);
} }
break; return;
case '$': case '$':
case '4': case '4':
if(plr[myplr].SpdList[3]._itype != -1 && plr[myplr].SpdList[3]._itype != 11) { if(plr[myplr].SpdList[3]._itype != -1 && plr[myplr].SpdList[3]._itype != 11) {
UseInvItem(myplr, 50); UseInvItem(myplr, 50);
} }
break; return;
case '%': case '%':
case '5': case '5':
if(plr[myplr].SpdList[4]._itype != -1 && plr[myplr].SpdList[4]._itype != 11) { if(plr[myplr].SpdList[4]._itype != -1 && plr[myplr].SpdList[4]._itype != 11) {
UseInvItem(myplr, 51); UseInvItem(myplr, 51);
} }
break; return;
case '^': case '^':
case '6': case '6':
if(plr[myplr].SpdList[5]._itype != -1 && plr[myplr].SpdList[5]._itype != 11) { if(plr[myplr].SpdList[5]._itype != -1 && plr[myplr].SpdList[5]._itype != 11) {
UseInvItem(myplr, 52); UseInvItem(myplr, 52);
} }
break; return;
case '&': case '&':
case '7': case '7':
if(plr[myplr].SpdList[6]._itype != -1 && plr[myplr].SpdList[6]._itype != 11) { if(plr[myplr].SpdList[6]._itype != -1 && plr[myplr].SpdList[6]._itype != 11) {
UseInvItem(myplr, 53); UseInvItem(myplr, 53);
} }
break; return;
case '*': case '*':
case '8': case '8':
#ifdef _DEBUG #ifdef _DEBUG
if(debug_mode_key_inverted_v || debug_mode_key_w) { if(debug_mode_key_inverted_v || debug_mode_key_w) {
NetSendCmd(TRUE, CMD_CHEAT_EXPERIENCE); NetSendCmd(TRUE, CMD_CHEAT_EXPERIENCE);
break; return;
} }
#endif #endif
if(plr[myplr].SpdList[7]._itype != -1 && plr[myplr].SpdList[7]._itype != 11) { if(plr[myplr].SpdList[7]._itype != -1 && plr[myplr].SpdList[7]._itype != 11) {
UseInvItem(myplr, 54); UseInvItem(myplr, 54);
} }
break; return;
#ifdef _DEBUG #ifdef _DEBUG
case ')': case ')':
case '0': case '0':
@ -1476,52 +1477,52 @@ void PressChar(int vkey)
} }
arrowdebug++; arrowdebug++;
} }
break; return;
case ':': case ':':
if(currlevel == 0 && debug_mode_key_w) { if(currlevel == 0 && debug_mode_key_w) {
SetAllSpellsCheat(); SetAllSpellsCheat();
} }
break; return;
case '[': case '[':
if(currlevel == 0 && debug_mode_key_w) { if(currlevel == 0 && debug_mode_key_w) {
TakeGoldCheat(); TakeGoldCheat();
} }
break; return;
case ']': case ']':
if(currlevel == 0 && debug_mode_key_w) { if(currlevel == 0 && debug_mode_key_w) {
MaxSpellsCheat(); MaxSpellsCheat();
} }
break; return;
case 'a': case 'a':
if(debug_mode_key_inverted_v) { if(debug_mode_key_inverted_v) {
spelldata[SPL_TELEPORT].sTownSpell = 1; spelldata[SPL_TELEPORT].sTownSpell = 1;
plr[myplr]._pSplLvl[plr[myplr]._pSpell]++; plr[myplr]._pSplLvl[plr[myplr]._pSpell]++;
} }
break; return;
case 'D': case 'D':
PrintDebugPlayer(TRUE); PrintDebugPlayer(TRUE);
break; return;
case 'd': case 'd':
PrintDebugPlayer(FALSE); PrintDebugPlayer(FALSE);
break; return;
case 'e': case 'e':
if(debug_mode_key_d) { if(debug_mode_key_d) {
sprintf(tempstr, "EFlag = %i", plr[myplr]._peflag); sprintf(tempstr, "EFlag = %i", plr[myplr]._peflag);
NetSendCmdString(1 << myplr, tempstr); NetSendCmdString(1 << myplr, tempstr);
} }
break; return;
case 'L': case 'L':
case 'l': case 'l':
if(debug_mode_key_inverted_v) { if(debug_mode_key_inverted_v) {
ToggleLighting(); ToggleLighting();
} }
break; return;
case 'M': case 'M':
NextDebugMonster(); NextDebugMonster();
break; return;
case 'm': case 'm':
GetDebugMonster(); GetDebugMonster();
break; return;
case 'R': case 'R':
case 'r': case 'r':
sprintf(tempstr, "seed = %i", glSeedTbl[currlevel]); sprintf(tempstr, "seed = %i", glSeedTbl[currlevel]);
@ -1530,7 +1531,7 @@ void PressChar(int vkey)
NetSendCmdString(1 << myplr, tempstr); NetSendCmdString(1 << myplr, tempstr);
sprintf(tempstr, "End = %i", glEndSeed[currlevel]); sprintf(tempstr, "End = %i", glEndSeed[currlevel]);
NetSendCmdString(1 << myplr, tempstr); NetSendCmdString(1 << myplr, tempstr);
break; return;
case 'T': case 'T':
case 't': case 't':
if(debug_mode_key_inverted_v) { if(debug_mode_key_inverted_v) {
@ -1539,17 +1540,17 @@ void PressChar(int vkey)
sprintf(tempstr, "CX = %i CY = %i DP = %i", cursmx, cursmy, dungeon[cursmx][cursmy]); sprintf(tempstr, "CX = %i CY = %i DP = %i", cursmx, cursmy, dungeon[cursmx][cursmy]);
NetSendCmdString(1 << myplr, tempstr); NetSendCmdString(1 << myplr, tempstr);
} }
break; return;
case '|': case '|':
if(currlevel == 0 && debug_mode_key_w) { if(currlevel == 0 && debug_mode_key_w) {
GiveGoldCheat(); GiveGoldCheat();
} }
break; return;
case '~': case '~':
if(currlevel == 0 && debug_mode_key_w) { if(currlevel == 0 && debug_mode_key_w) {
StoresCheat(); StoresCheat();
} }
break; return;
#endif #endif
} }
} }

Loading…
Cancel
Save