Browse Source

StartGame and PressEscKey (#461)

pull/25/head
galaxyhaxz 8 years ago committed by GitHub
parent
commit
d9a285327f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 2
      Source/control.cpp
  2. 2
      Source/control.h
  3. 85
      Source/diablo.cpp
  4. 2
      Source/diablo.h

2
Source/control.cpp

@ -2481,7 +2481,7 @@ void __fastcall DrawGoldSplit(int amount)
frame_4B8800 = (frame_4B8800 & 7) + 1; frame_4B8800 = (frame_4B8800 & 7) + 1;
} }
void __fastcall control_drop_gold(int vkey) void __fastcall control_drop_gold(char vkey)
{ {
char v1; // bl char v1; // bl
int v2; // eax int v2; // eax

2
Source/control.h

@ -108,7 +108,7 @@ void __fastcall PrintSBookStr(int x, int y, bool cjustflag, char *pszStr, int br
void __cdecl CheckSBook(); void __cdecl CheckSBook();
char *__fastcall get_pieces_str(int nGold); char *__fastcall get_pieces_str(int nGold);
void __fastcall DrawGoldSplit(int amount); void __fastcall DrawGoldSplit(int amount);
void __fastcall control_drop_gold(int vkey); void __fastcall control_drop_gold(char vkey);
void __fastcall control_remove_gold(int pnum, int gold_index); void __fastcall control_remove_gold(int pnum, int gold_index);
void __fastcall control_set_gold_curs(int pnum); void __fastcall control_set_gold_curs(int pnum);
void __cdecl DrawTalkPan(); void __cdecl DrawTalkPan();

85
Source/diablo.cpp

@ -107,29 +107,38 @@ void __cdecl FreeGameMem()
BOOL __fastcall StartGame(BOOL bNewGame, BOOL bSinglePlayer) BOOL __fastcall StartGame(BOOL bNewGame, BOOL bSinglePlayer)
{ {
BOOL fExitProgram; // [esp+Ch] [ebp-4h] BOOL fExitProgram;
unsigned int uMsg; // ecx unsigned int uMsg;
byte_678640 = 1; byte_678640 = 1;
while (1) {
fExitProgram = 0; do {
dword_5256E8 = FALSE; fExitProgram = FALSE;
if (!NetInit(bSinglePlayer, &fExitProgram)) dword_5256E8 = 0;
if(!NetInit(bSinglePlayer, &fExitProgram)) {
gbRunGameResult = !fExitProgram;
break; break;
}
byte_678640 = 0; byte_678640 = 0;
if ((bNewGame || !gbValidSaveFile)
&& (InitLevels(), InitQuests(), InitPortals(), InitDungMsgs(myplr), !gbValidSaveFile) if(bNewGame || !gbValidSaveFile) {
|| (uMsg = WM_DIABLOADGAME, !dword_5256E8)) { InitLevels();
uMsg = WM_DIABNEWGAME; InitQuests();
InitPortals();
InitDungMsgs(myplr);
} }
if(!gbValidSaveFile || !dword_5256E8)
uMsg = WM_DIABNEWGAME;
else
uMsg = WM_DIABLOADGAME;
run_game_loop(uMsg); run_game_loop(uMsg);
NetClose(); NetClose();
pfile_create_player_description(0, 0); pfile_create_player_description(0, 0);
if (!gbRunGameResult) } while(gbRunGameResult);
goto LABEL_11;
}
gbRunGameResult = fExitProgram == 0;
LABEL_11:
SNetDestroy(); SNetDestroy();
return gbRunGameResult; return gbRunGameResult;
} }
@ -559,46 +568,46 @@ void __fastcall diablo_reload_process(HMODULE hModule)
} }
} }
int __cdecl PressEscKey() BOOL __cdecl PressEscKey()
{ {
int result; // eax BOOL rv = FALSE;
result = 0; if(doomflag) {
if (doomflag) {
doom_close(); doom_close();
result = 1; rv = TRUE;
} }
if (helpflag) { if(helpflag) {
helpflag = 0; helpflag = 0;
result = 1; rv = TRUE;
} }
if (qtextflag) {
qtextflag = FALSE; if(qtextflag) {
qtextflag = 0;
sfx_stop(); sfx_stop();
} else { rv = TRUE;
if (!stextflag) } else if(stextflag) {
goto LABEL_10;
STextESC(); STextESC();
rv = TRUE;
} }
result = 1;
LABEL_10: if(msgflag) {
if (msgflag) {
msgdelay = 0; msgdelay = 0;
result = 1; rv = TRUE;
} }
if (talkflag) { if(talkflag) {
control_reset_talk(); control_reset_talk();
result = 1; rv = TRUE;
} }
if (dropGoldFlag) { if(dropGoldFlag) {
control_drop_gold(VK_ESCAPE); control_drop_gold(VK_ESCAPE);
result = 1; rv = TRUE;
} }
if (spselflag) { if(spselflag) {
spselflag = 0; spselflag = 0;
result = 1; rv = TRUE;
} }
return result;
return rv;
} }
// 4B84DC: using guessed type int dropGoldFlag; // 4B84DC: using guessed type int dropGoldFlag;
// 4B8960: using guessed type int talkflag; // 4B8960: using guessed type int talkflag;

2
Source/diablo.h

@ -47,7 +47,7 @@ void __fastcall diablo_parse_flags(char *args);
void __cdecl diablo_init_screen(); void __cdecl diablo_init_screen();
BOOL __fastcall diablo_find_window(LPCSTR lpClassName); BOOL __fastcall diablo_find_window(LPCSTR lpClassName);
void __fastcall diablo_reload_process(HMODULE hModule); void __fastcall diablo_reload_process(HMODULE hModule);
int __cdecl PressEscKey(); BOOL __cdecl PressEscKey();
LRESULT CALLBACK DisableInputWndProc(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam); LRESULT CALLBACK DisableInputWndProc(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam);
LRESULT CALLBACK GM_Game(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam); LRESULT CALLBACK GM_Game(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam);
BOOL __fastcall LeftMouseDown(int a1); BOOL __fastcall LeftMouseDown(int a1);

Loading…
Cancel
Save