Browse Source

StartGame and PressEscKey (#461)

pull/25/head
galaxyhaxz 7 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;
}
void __fastcall control_drop_gold(int vkey)
void __fastcall control_drop_gold(char vkey)
{
char v1; // bl
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();
char *__fastcall get_pieces_str(int nGold);
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_set_gold_curs(int pnum);
void __cdecl DrawTalkPan();

85
Source/diablo.cpp

@ -107,29 +107,38 @@ void __cdecl FreeGameMem()
BOOL __fastcall StartGame(BOOL bNewGame, BOOL bSinglePlayer)
{
BOOL fExitProgram; // [esp+Ch] [ebp-4h]
unsigned int uMsg; // ecx
BOOL fExitProgram;
unsigned int uMsg;
byte_678640 = 1;
while (1) {
fExitProgram = 0;
dword_5256E8 = FALSE;
if (!NetInit(bSinglePlayer, &fExitProgram))
do {
fExitProgram = FALSE;
dword_5256E8 = 0;
if(!NetInit(bSinglePlayer, &fExitProgram)) {
gbRunGameResult = !fExitProgram;
break;
}
byte_678640 = 0;
if ((bNewGame || !gbValidSaveFile)
&& (InitLevels(), InitQuests(), InitPortals(), InitDungMsgs(myplr), !gbValidSaveFile)
|| (uMsg = WM_DIABLOADGAME, !dword_5256E8)) {
uMsg = WM_DIABNEWGAME;
if(bNewGame || !gbValidSaveFile) {
InitLevels();
InitQuests();
InitPortals();
InitDungMsgs(myplr);
}
if(!gbValidSaveFile || !dword_5256E8)
uMsg = WM_DIABNEWGAME;
else
uMsg = WM_DIABLOADGAME;
run_game_loop(uMsg);
NetClose();
pfile_create_player_description(0, 0);
if (!gbRunGameResult)
goto LABEL_11;
}
gbRunGameResult = fExitProgram == 0;
LABEL_11:
} while(gbRunGameResult);
SNetDestroy();
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();
result = 1;
rv = TRUE;
}
if (helpflag) {
if(helpflag) {
helpflag = 0;
result = 1;
rv = TRUE;
}
if (qtextflag) {
qtextflag = FALSE;
if(qtextflag) {
qtextflag = 0;
sfx_stop();
} else {
if (!stextflag)
goto LABEL_10;
rv = TRUE;
} else if(stextflag) {
STextESC();
rv = TRUE;
}
result = 1;
LABEL_10:
if (msgflag) {
if(msgflag) {
msgdelay = 0;
result = 1;
rv = TRUE;
}
if (talkflag) {
if(talkflag) {
control_reset_talk();
result = 1;
rv = TRUE;
}
if (dropGoldFlag) {
if(dropGoldFlag) {
control_drop_gold(VK_ESCAPE);
result = 1;
rv = TRUE;
}
if (spselflag) {
if(spselflag) {
spselflag = 0;
result = 1;
rv = TRUE;
}
return result;
return rv;
}
// 4B84DC: using guessed type int dropGoldFlag;
// 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();
BOOL __fastcall diablo_find_window(LPCSTR lpClassName);
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 GM_Game(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam);
BOOL __fastcall LeftMouseDown(int a1);

Loading…
Cancel
Save