Browse Source

Merge upstream branch 'devilution/master'

pull/25/head
Xadhoom 7 years ago
parent
commit
1ae3057d22
  1. 4
      DiabloUI/copyprot.cpp
  2. 4
      DiabloUI/okcancel.cpp
  3. 4
      DiabloUI/progress.cpp
  4. 22
      DiabloUI/selhero.cpp
  5. 272
      Source/appfat.cpp
  6. 14
      Source/appfat.h
  7. 20
      Source/init.cpp
  8. 2
      Source/init.h
  9. 6
      Source/items.cpp
  10. 8
      Source/mainmenu.cpp
  11. 81
      Source/multi.cpp
  12. 2
      Source/multi.h

4
DiabloUI/copyprot.cpp

@ -119,7 +119,7 @@ BOOL __fastcall CopyProt_LoadCopyStuff(HWND hWnd, int a2)
v13 = LockResource(copyprot_artpal);
if (v5)
SDlgSetBitmapI(hWnd, 0, &nullcharacter, -1, 1, v5, 0, 284, 148, -1);
ShowCursor(1);
ShowCursor(TRUE);
Fade_SetInputWindow(hWnd);
if (v6)
local_FitButtonDlg(hWnd, msgs, v6, data);
@ -135,7 +135,7 @@ BOOL __fastcall CopyProt_LoadCopyStuff(HWND hWnd, int a2)
// ref: 0x1000430C
void __fastcall CopyProt_EndCopyDlg(HWND hWnd, int a2)
{
ShowCursor(0);
ShowCursor(FALSE);
SDlgEndDialog(hWnd, (HANDLE)a2);
}

4
DiabloUI/okcancel.cpp

@ -56,7 +56,7 @@ LRESULT __stdcall OkCancel_WndProc(HWND hWnd, UINT Msg, WPARAM wParam, LPARAM lP
HWND v9; // eax
if (Msg == 2) {
ShowCursor(0);
ShowCursor(FALSE);
OkCancel_FreeDlgBmp(hWnd);
return (LRESULT)SDlgDefDialogProc(hWnd, Msg, (HDC)wParam, (HWND)lParam);
}
@ -98,7 +98,7 @@ LRESULT __stdcall OkCancel_WndProc(HWND hWnd, UINT Msg, WPARAM wParam, LPARAM lP
v6 = 2;
goto LABEL_16;
}
ShowCursor(1);
ShowCursor(TRUE);
if (!OkCancel_LoadOkCancGFX(hWnd, (DWORD *)lParam))
SDlgEndDialog(hWnd, (HANDLE)0xFF000000);
return 1;

4
DiabloUI/progress.cpp

@ -45,7 +45,7 @@ int __stdcall Progress_100094F4(HWND hWnd, UINT Msg, WPARAM wParam, LPARAM lPara
if ( Msg == 2 )
{
ShowCursor(0);
ShowCursor(FALSE);
Progress_100095EC();
}
else if ( Msg > 0x103 )
@ -64,7 +64,7 @@ int __stdcall Progress_100094F4(HWND hWnd, UINT Msg, WPARAM wParam, LPARAM lPara
v5 = (void *)SDrawGetFrameWindow(NULL);
local_1000812B(v5);
local_1000812B(hWnd);
ShowCursor(1);
ShowCursor(TRUE);
return 1;
case 0x111u:
if ( (_WORD)wParam == 2 )

22
DiabloUI/selhero.cpp

@ -213,7 +213,14 @@ BOOL __fastcall UiValidPlayerName(char *name)
}
// ref: 0x1000BBB4
BOOL __stdcall UiSelHeroMultDialog(BOOL(__stdcall *fninfo)(BOOL(__stdcall *fninfofunc)(_uiheroinfo *)), BOOL(__stdcall *fncreate)(_uiheroinfo *), BOOL(__stdcall *fnremove)(_uiheroinfo *), BOOL(__stdcall *fnstats)(unsigned int, _uidefaultstats *), int *dlgresult, int *a6, char *name)
BOOL __stdcall UiSelHeroMultDialog(
BOOL(__stdcall *fninfo)(BOOL(__stdcall *fninfofunc)(_uiheroinfo *)),
BOOL(__stdcall *fncreate)(_uiheroinfo *),
BOOL(__stdcall *fnremove)(_uiheroinfo *),
BOOL(__stdcall *fnstats)(unsigned int, _uidefaultstats *),
int *dlgresult,
int *hero_is_created,
char *name)
{
int v7; // eax
int v8; // eax
@ -232,8 +239,8 @@ BOOL __stdcall UiSelHeroMultDialog(BOOL(__stdcall *fninfo)(BOOL(__stdcall *fninf
*dlgresult = v8;
if (name)
strcpy(name, selhero_heronamestr);
if (a6)
*a6 = selhero_is_created;
if (hero_is_created)
*hero_is_created = selhero_is_created;
return 1;
}
// 10010382: using guessed type _DWORD __stdcall SDrawGetFrameWindow();
@ -704,7 +711,14 @@ BOOL __stdcall SelHero_GetHeroInfo(_uiheroinfo *pInfo)
// 1002A428: using guessed type int selhero_numheroesleft;
// ref: 0x1000C57A
BOOL __stdcall UiSelHeroSingDialog(BOOL(__stdcall *fninfo)(BOOL(__stdcall *fninfofunc)(_uiheroinfo *)), BOOL(__stdcall *fncreate)(_uiheroinfo *), BOOL(__stdcall *fnremove)(_uiheroinfo *), BOOL(__stdcall *fnstats)(unsigned int, _uidefaultstats *), int *dlgresult, char *name, int *difficulty)
BOOL __stdcall UiSelHeroSingDialog(
BOOL(__stdcall *fninfo)(BOOL(__stdcall *fninfofunc)(_uiheroinfo *)),
BOOL(__stdcall *fncreate)(_uiheroinfo *),
BOOL(__stdcall *fnremove)(_uiheroinfo *),
BOOL(__stdcall *fnstats)(unsigned int, _uidefaultstats *),
int *dlgresult,
char *name,
int *difficulty)
{
int v7; // eax
int v8; // edi

272
Source/appfat.cpp

@ -3,8 +3,8 @@
#include "../types.h"
char sz_error_buf[256];
int terminating; // weak
int cleanup_thread_id; // weak
BOOL terminating;
int cleanup_thread_id;
// delete overloads the delete operator.
//void operator delete(void *ptr)
@ -14,30 +14,35 @@ int cleanup_thread_id; // weak
// }
//}
char *__fastcall GetErrorStr(int error_code)
char *__fastcall GetErrorStr(DWORD error_code)
{
int v1; // edi
unsigned int v2; // eax
signed int v4; // eax
char *i; // ecx
v1 = error_code;
v2 = ((unsigned int)error_code >> 16) & 0x1FFF;
if (v2 == 0x0878) {
DWORD upper_code;
int size;
char *chr;
upper_code = (error_code >> 16) & 0x1FFF;
if (upper_code == 0x0878) {
TraceErrorDS(error_code, sz_error_buf, 256);
} else if (v2 == 0x0876) {
} else if (upper_code == 0x0876) {
TraceErrorDD(error_code, sz_error_buf, 256);
} else {
if (!SErrGetErrorStr(error_code, sz_error_buf, 256) && !FormatMessage(FORMAT_MESSAGE_FROM_SYSTEM, NULL, v1, 0x400u, sz_error_buf, 0x100u, NULL))
wsprintf(sz_error_buf, "unknown error 0x%08x", v1);
} else if (!SErrGetErrorStr(error_code, sz_error_buf, 256)
&& !FormatMessage(FORMAT_MESSAGE_FROM_SYSTEM, NULL, error_code, 0x400, sz_error_buf, 0x100, NULL)) {
wsprintf(sz_error_buf, "unknown error 0x%08x", error_code);
}
v4 = strlen(sz_error_buf);
for (i = &sz_error_buf[v4 - 1]; v4 > 0; *i = 0) {
--v4;
--i;
if (*i != '\r' && *i != '\n')
size = strlen(sz_error_buf);
chr = &sz_error_buf[size - 1];
while (size > 0) {
size--;
chr--;
if (*chr != '\r' && *chr != '\n')
break;
*chr = 0x00;
}
return sz_error_buf;
}
@ -46,7 +51,7 @@ char *__fastcall GetErrorStr(int error_code)
v = #errName; \
break;
void __fastcall TraceErrorDD(int error_code, char *error_buf, int error_buf_len)
void __fastcall TraceErrorDD(DWORD error_code, char *error_buf, int error_buf_len)
{
const char *v3; // eax
char v4[20]; // [esp+0h] [ebp-14h]
@ -158,7 +163,7 @@ void __fastcall TraceErrorDD(int error_code, char *error_buf, int error_buf_len)
strncpy(error_buf, v3, error_buf_len);
}
void __fastcall TraceErrorDS(int error_code, char *error_buf, int error_buf_len)
void __fastcall TraceErrorDS(DWORD error_code, char *error_buf, int error_buf_len)
{
const char *v3; // eax
char v4[20]; // [esp+0h] [ebp-14h]
@ -187,22 +192,22 @@ void __fastcall TraceErrorDS(int error_code, char *error_buf, int error_buf_len)
char *__cdecl TraceLastError()
{
int v0; // eax
v0 = GetLastError();
return GetErrorStr(v0);
return GetErrorStr(GetLastError());
}
void TermMsg(char *pszFmt, ...)
{
va_list arglist; // [esp+8h] [ebp+8h]
va_list va;
va_start(arglist, pszFmt);
va_start(va, pszFmt);
FreeDlg();
if (pszFmt)
MsgBox(pszFmt, arglist);
va_end(arglist);
init_cleanup(0);
MsgBox(pszFmt, va);
va_end(va);
init_cleanup(FALSE);
exit(1);
}
@ -219,20 +224,21 @@ void __fastcall MsgBox(char *pszFmt, va_list va)
void __cdecl FreeDlg()
{
if (terminating && cleanup_thread_id != GetCurrentThreadId())
Sleep(20000u);
terminating = 1;
Sleep(20000);
terminating = TRUE;
cleanup_thread_id = GetCurrentThreadId();
dx_cleanup();
if ((unsigned char)gbMaxPlayers > 1u) {
if (gbMaxPlayers > 1) {
if (SNetLeaveGame(3))
Sleep(2000u);
Sleep(2000);
}
SNetDestroy();
ShowCursor(1);
ShowCursor(TRUE);
}
// 4B7A34: using guessed type int terminating;
// 4B7A38: using guessed type int cleanup_thread_id;
// 679660: using guessed type char gbMaxPlayers;
void DrawDlg(char *pszFmt, ...)
{
@ -245,169 +251,149 @@ void DrawDlg(char *pszFmt, ...)
SDrawMessageBox(text, "Diablo", MB_TASKMODAL | MB_ICONEXCLAMATION);
}
void __fastcall DDErrMsg(int error_code, int log_line_nr, char *log_file_path)
void __fastcall DDErrMsg(DWORD error_code, int log_line_nr, char *log_file_path)
{
int v3; // esi
char *v4; // eax
char *msg;
v3 = log_line_nr;
if (error_code) {
v4 = GetErrorStr(error_code);
TermMsg("Direct draw error (%s:%d)\n%s", log_file_path, v3, v4);
msg = GetErrorStr(error_code);
TermMsg("Direct draw error (%s:%d)\n%s", log_file_path, log_line_nr, msg);
}
}
void __fastcall DSErrMsg(int error_code, int log_line_nr, char *log_file_path)
void __fastcall DSErrMsg(DWORD error_code, int log_line_nr, char *log_file_path)
{
int v3; // esi
char *v4; // eax
char *msg;
v3 = log_line_nr;
if (error_code) {
v4 = GetErrorStr(error_code);
TermMsg("Direct sound error (%s:%d)\n%s", log_file_path, v3, v4);
msg = GetErrorStr(error_code);
TermMsg("Direct sound error (%s:%d)\n%s", log_file_path, log_line_nr, msg);
}
}
void __fastcall center_window(HWND hDlg)
{
LONG v1; // esi
LONG v2; // edi
int v3; // ebx
char *v4; // eax
struct tagRECT Rect; // [esp+Ch] [ebp-1Ch]
int v6; // [esp+1Ch] [ebp-Ch]
HDC hdc; // [esp+20h] [ebp-8h]
HWND hWnd; // [esp+24h] [ebp-4h]
hWnd = hDlg;
LONG w, h;
int screenW, screenH;
struct tagRECT Rect;
HDC hdc;
GetWindowRect(hDlg, &Rect);
v1 = Rect.right - Rect.left;
v2 = Rect.bottom - Rect.top;
hdc = GetDC(hWnd);
v6 = GetDeviceCaps(hdc, HORZRES);
v3 = GetDeviceCaps(hdc, VERTRES);
ReleaseDC(hWnd, hdc);
if (!SetWindowPos(hWnd, HWND_TOP, (v6 - v1) / 2, (v3 - v2) / 2, 0, 0, SWP_NOZORDER | SWP_NOSIZE)) {
v4 = TraceLastError();
TermMsg("center_window: %s", v4);
w = Rect.right - Rect.left;
h = Rect.bottom - Rect.top;
hdc = GetDC(hDlg);
screenW = GetDeviceCaps(hdc, HORZRES);
screenH = GetDeviceCaps(hdc, VERTRES);
ReleaseDC(hDlg, hdc);
if (!SetWindowPos(hDlg, HWND_TOP, (screenW - w) / 2, (screenH - h) / 2, 0, 0, SWP_NOZORDER | SWP_NOSIZE)) {
TermMsg("center_window: %s", TraceLastError());
}
}
void __fastcall ErrDlg(int template_id, int error_code, char *log_file_path, int log_line_nr)
void __fastcall ErrDlg(int template_id, DWORD error_code, char *log_file_path, int log_line_nr)
{
int v4; // ebx
int v5; // edi
char *v6; // esi
char *v7; // eax
char *v8; // eax
LPARAM dwInitParam[128]; // [esp+Ch] [ebp-200h]
v4 = error_code;
v5 = template_id;
char *size;
LPARAM dwInitParam[128];
FreeDlg();
v6 = log_file_path;
v7 = strrchr(log_file_path, '\\');
if (v7)
v6 = v7 + 1;
v8 = GetErrorStr(v4);
wsprintf((LPSTR)dwInitParam, "%s\nat: %s line %d", v8, v6, log_line_nr);
if (DialogBoxParam(ghInst, MAKEINTRESOURCE(v5), ghMainWnd, (DLGPROC)FuncDlg, (LPARAM)dwInitParam) == -1)
TermMsg("ErrDlg: %d", v5);
TermMsg(0);
size = strrchr(log_file_path, '\\');
if (size)
log_file_path = size + 1;
wsprintf((LPSTR)dwInitParam, "%s\nat: %s line %d", GetErrorStr(error_code), log_file_path, log_line_nr);
if (DialogBoxParam(ghInst, MAKEINTRESOURCE(template_id), ghMainWnd, (DLGPROC)FuncDlg, (LPARAM)dwInitParam) == -1)
TermMsg("ErrDlg: %d", template_id);
TermMsg(NULL);
}
BOOL __stdcall FuncDlg(HWND hDlg, UINT uMsg, WPARAM wParam, char *text)
{
if (uMsg == WM_INITDIALOG) {
switch (uMsg) {
case WM_INITDIALOG:
TextDlg(hDlg, text);
} else {
if (uMsg != WM_COMMAND)
return 0;
if ((_WORD)wParam == 1) {
break;
case WM_COMMAND:
if ((WORD)wParam == 1) {
EndDialog(hDlg, 1);
} else if ((_WORD)wParam == 2) {
} else if ((WORD)wParam == 2) {
EndDialog(hDlg, 0);
}
break;
default:
return FALSE;
}
return 1;
return TRUE;
}
void __fastcall TextDlg(HWND hDlg, char *text)
{
char *v2; // esi
HWND v3; // edi
v2 = text;
v3 = hDlg;
center_window(hDlg);
if (v2)
SetDlgItemText(v3, 1000, v2);
if (text)
SetDlgItemText(hDlg, 1000, text);
}
void __fastcall ErrOkDlg(int template_id, int error_code, char *log_file_path, int log_line_nr)
void __fastcall ErrOkDlg(int template_id, DWORD error_code, char *log_file_path, int log_line_nr)
{
char *v4; // esi
int v5; // edi
unsigned short v6; // bx
char *v7; // eax
char *v8; // eax
LPARAM dwInitParam[128]; // [esp+Ch] [ebp-200h]
v4 = log_file_path;
v5 = error_code;
v6 = template_id;
v7 = strrchr(log_file_path, '\\');
if (v7)
v4 = v7 + 1;
v8 = GetErrorStr(v5);
wsprintf((LPSTR)dwInitParam, "%s\nat: %s line %d", v8, v4, log_line_nr);
DialogBoxParam(ghInst, MAKEINTRESOURCE(v6), ghMainWnd, (DLGPROC)FuncDlg, (LPARAM)dwInitParam);
char *size;
LPARAM dwInitParam[128];
size = strrchr(log_file_path, '\\');
if (size)
log_file_path = size + 1;
wsprintf((LPSTR)dwInitParam, "%s\nat: %s line %d", GetErrorStr(error_code), log_file_path, log_line_nr);
DialogBoxParam(ghInst, MAKEINTRESOURCE(template_id), ghMainWnd, (DLGPROC)FuncDlg, (LPARAM)dwInitParam);
}
void __fastcall FileErrDlg(const char *error)
{
const char *v1; // esi
v1 = error;
FreeDlg();
if (!v1)
v1 = "";
if (DialogBoxParam(ghInst, MAKEINTRESOURCE(IDD_DIALOG3), ghMainWnd, (DLGPROC)FuncDlg, (LPARAM)v1) == -1)
if (!error)
error = "";
if (DialogBoxParam(ghInst, MAKEINTRESOURCE(IDD_DIALOG3), ghMainWnd, (DLGPROC)FuncDlg, (LPARAM)error) == -1)
TermMsg("FileErrDlg");
TermMsg(0);
TermMsg(NULL);
}
void __fastcall DiskFreeDlg(char *error)
{
char *v1; // esi
v1 = error;
FreeDlg();
if (DialogBoxParam(ghInst, MAKEINTRESOURCE(IDD_DIALOG7), ghMainWnd, (DLGPROC)FuncDlg, (LPARAM)v1) == -1)
if (DialogBoxParam(ghInst, MAKEINTRESOURCE(IDD_DIALOG7), ghMainWnd, (DLGPROC)FuncDlg, (LPARAM)error) == -1)
TermMsg("DiskFreeDlg");
TermMsg(0);
TermMsg(NULL);
}
BOOL __cdecl InsertCDDlg()
{
int v0; // edi
int nResult;
ShowCursor(TRUE);
ShowCursor(1);
v0 = DialogBoxParam(ghInst, MAKEINTRESOURCE(IDD_DIALOG9), ghMainWnd, (DLGPROC)FuncDlg, (LPARAM) "");
if (v0 == -1)
nResult = DialogBoxParam(ghInst, MAKEINTRESOURCE(IDD_DIALOG9), ghMainWnd, (DLGPROC)FuncDlg, (LPARAM) "");
if (nResult == -1)
TermMsg("InsertCDDlg");
ShowCursor(0);
return v0 == 1;
ShowCursor(FALSE);
return nResult == 1;
}
void __fastcall DirErrorDlg(char *error)
{
char *v1; // esi
v1 = error;
FreeDlg();
if (DialogBoxParam(ghInst, MAKEINTRESOURCE(IDD_DIALOG11), ghMainWnd, (DLGPROC)FuncDlg, (LPARAM)v1) == -1)
if (DialogBoxParam(ghInst, MAKEINTRESOURCE(IDD_DIALOG11), ghMainWnd, (DLGPROC)FuncDlg, (LPARAM)error) == -1)
TermMsg("DirErrorDlg");
TermMsg(0);
TermMsg(NULL);
}

14
Source/appfat.h

@ -6,21 +6,21 @@ extern char sz_error_buf[256];
extern int terminating; // weak
extern int cleanup_thread_id; // weak
char *__fastcall GetErrorStr(int error_code);
void __fastcall TraceErrorDD(int error_code, char *error_buf, int error_buf_len);
void __fastcall TraceErrorDS(int error_code, char *error_buf, int error_buf_len);
char *__fastcall GetErrorStr(DWORD error_code);
void __fastcall TraceErrorDD(DWORD error_code, char *error_buf, int error_buf_len);
void __fastcall TraceErrorDS(DWORD error_code, char *error_buf, int error_buf_len);
char *__cdecl TraceLastError();
void TermMsg(char *pszFmt, ...);
void __fastcall MsgBox(char *pszFmt, va_list va);
void __cdecl FreeDlg();
void DrawDlg(char *pszFmt, ...);
void __fastcall DDErrMsg(int error_code, int log_line_nr, char *log_file_path);
void __fastcall DSErrMsg(int error_code, int log_line_nr, char *log_file_path);
void __fastcall DDErrMsg(DWORD error_code, int log_line_nr, char *log_file_path);
void __fastcall DSErrMsg(DWORD error_code, int log_line_nr, char *log_file_path);
void __fastcall center_window(HWND hDlg);
void __fastcall ErrDlg(int template_id, int error_code, char *log_file_path, int log_line_nr);
void __fastcall ErrDlg(int template_id, DWORD error_code, char *log_file_path, int log_line_nr);
BOOL __stdcall FuncDlg(HWND hDlg, UINT uMsg, WPARAM wParam, char *text);
void __fastcall TextDlg(HWND hDlg, char *text);
void __fastcall ErrOkDlg(int template_id, int error_code, char *log_file_path, int log_line_nr);
void __fastcall ErrOkDlg(int template_id, DWORD error_code, char *log_file_path, int log_line_nr);
void __fastcall FileErrDlg(const char *error);
void __fastcall DiskFreeDlg(char *error);
BOOL __cdecl InsertCDDlg();

20
Source/init.cpp

@ -19,35 +19,35 @@ BOOLEAN screensaver_enabled_prev;
char gszVersionNumber[260] = "internal version unknown";
char gszProductName[260] = "Diablo v1.09";
void __fastcall init_cleanup(BOOLEAN show_cursor)
void __fastcall init_cleanup(BOOL show_cursor)
{
int v1; // edi
v1 = show_cursor;
pfile_flush_W();
init_disable_screensaver(0);
init_run_office_from_start_menu();
if (diabdat_mpq) {
SFileCloseArchive(diabdat_mpq);
diabdat_mpq = 0;
diabdat_mpq = NULL;
}
if (patch_rt_mpq) {
SFileCloseArchive(patch_rt_mpq);
patch_rt_mpq = 0;
patch_rt_mpq = NULL;
}
if (unused_mpq) {
SFileCloseArchive(unused_mpq);
unused_mpq = 0;
unused_mpq = NULL;
}
UiDestroy();
effects_cleanup_sfx();
sound_cleanup();
NetClose();
dx_cleanup();
MI_Dummy(v1);
MI_Dummy(show_cursor);
StormDestroy();
if (v1)
ShowCursor(1);
if (show_cursor)
ShowCursor(TRUE);
}
void __cdecl init_run_office_from_start_menu()

2
Source/init.h

@ -14,7 +14,7 @@ extern void *patch_rt_mpq;
extern int killed_mom_parent; // weak
extern BOOLEAN screensaver_enabled_prev;
void __fastcall init_cleanup(BOOLEAN show_cursor);
void __fastcall init_cleanup(BOOL show_cursor);
void __cdecl init_run_office_from_start_menu();
void __fastcall init_run_office(char *dir);
void __fastcall init_disable_screensaver(BOOLEAN disable);

6
Source/items.cpp

@ -4210,7 +4210,7 @@ void __cdecl SortSmith()
}
}
}
--j;
j--;
}
}
@ -4404,7 +4404,7 @@ void __cdecl SortWitch()
}
}
}
--j;
j--;
}
}
@ -4617,7 +4617,7 @@ void __cdecl SortHealer()
}
}
}
--j;
j--;
}
}

8
Source/mainmenu.cpp

@ -34,7 +34,7 @@ int __stdcall mainmenu_select_hero_dialog(
char *cdesc, DWORD cdlen,
BOOL *multi)
{
int a6 = 1;
BOOL hero_is_created = TRUE;
int dlgresult = 0;
if (gbMaxPlayers == 1) {
if (!UiSelHeroSingDialog(
@ -58,7 +58,7 @@ int __stdcall mainmenu_select_hero_dialog(
pfile_delete_save,
pfile_ui_set_class_stats,
&dlgresult,
&a6,
&hero_is_created,
gszHero)) {
TermMsg("Can't load multiplayer dialog");
}
@ -70,9 +70,9 @@ int __stdcall mainmenu_select_hero_dialog(
pfile_create_player_description(cdesc, cdlen);
if (multi) {
if (mode == 'BNET')
*multi = a6 || !plr[myplr].pBattleNet;
*multi = hero_is_created || !plr[myplr].pBattleNet;
else
*multi = a6;
*multi = hero_is_created;
}
if (cname && clen)
SStrCopy(cname, gszHero, clen);

81
Source/multi.cpp

@ -862,65 +862,64 @@ void __cdecl SetupLocalCoords()
// 5CF31D: using guessed type char setlevel;
// 679660: using guessed type char gbMaxPlayers;
int __fastcall multi_init_single(_SNETPROGRAMDATA *client_info, _SNETPLAYERDATA *user_info, _SNETUIDATA *ui_info)
BOOL __fastcall multi_init_single(_SNETPROGRAMDATA *client_info, _SNETPLAYERDATA *user_info, _SNETUIDATA *ui_info)
{
//int v3; // eax
int result; // eax
//int v5; // eax
char *v6; // eax
//_LOBYTE(v3) = SNetInitializeProvider(0, client_info, user_info, ui_info, &fileinfo);
if (SNetInitializeProvider(0, client_info, user_info, ui_info, &fileinfo)) {
ui_info = 0;
//_LOBYTE(v5) = SNetCreateGame("local", "local", "local", 0, (char *)&sgGameInitInfo.dwSeed, 8, 1, "local", "local", (int *)&ui_info);
if (!SNetCreateGame("local", "local", "local", 0, (char *)&sgGameInitInfo.dwSeed, 8, 1, "local", "local", (int *)&ui_info)) {
v6 = TraceLastError();
TermMsg("SNetCreateGame1:\n%s", v6);
}
myplr = 0;
gbMaxPlayers = 1;
result = 1;
} else {
int unused;
if (!SNetInitializeProvider(0, client_info, user_info, ui_info, &fileinfo)) {
SErrGetLastError();
result = 0;
return FALSE;
}
return result;
unused = 0;
if (!SNetCreateGame("local", "local", "local", 0, (char *)&sgGameInitInfo.dwSeed, 8, 1, "local", "local", &unused)) {
TermMsg("SNetCreateGame1:\n%s", TraceLastError());
}
myplr = 0;
gbMaxPlayers = 1;
return TRUE;
}
// 679660: using guessed type char gbMaxPlayers;
BOOL __fastcall multi_init_multi(_SNETPROGRAMDATA *client_info, _SNETPLAYERDATA *user_info, _SNETUIDATA *ui_info, int *pfExitProgram)
{
_SNETPLAYERDATA *v4; // ebx
signed int i; // edi
int a6; // [esp+Ch] [ebp-Ch]
int a2; // [esp+10h] [ebp-8h]
int type; // [esp+14h] [ebp-4h]
BOOL first;
int playerId;
int type;
v4 = user_info;
a2 = (int)client_info;
for (i = 1;; i = 0) {
type = 0;
for (first = TRUE;; first = FALSE) {
type = 0x00;
if (byte_678640) {
if (!UiSelectProvider(0, (_SNETPROGRAMDATA *)a2, v4, ui_info, &fileinfo, &type)
&& (!i || SErrGetLastError() != STORM_ERROR_REQUIRES_UPGRADE || !multi_upgrade(pfExitProgram))) {
return 0;
if (!UiSelectProvider(0, client_info, user_info, ui_info, &fileinfo, &type)
&& (!first || SErrGetLastError() != STORM_ERROR_REQUIRES_UPGRADE || !multi_upgrade(pfExitProgram))) {
return FALSE;
}
if (type == 'BNET')
plr[0].pBattleNet = 1;
}
multi_event_handler(1);
if (UiSelectGame(1, (_SNETPROGRAMDATA *)a2, v4, ui_info, &fileinfo, &a6))
if (UiSelectGame(1, client_info, user_info, ui_info, &fileinfo, &playerId))
break;
byte_678640 = 1;
}
if ((unsigned int)a6 >= MAX_PLRS)
return 0;
myplr = a6;
gbMaxPlayers = MAX_PLRS;
pfile_read_player_from_save();
if (type == 'BNET')
plr[myplr].pBattleNet = 1;
return 1;
if ((DWORD)playerId >= MAX_PLRS) {
return FALSE;
} else {
myplr = playerId;
gbMaxPlayers = MAX_PLRS;
pfile_read_player_from_save();
if (type == 'BNET')
plr[myplr].pBattleNet = 1;
return TRUE;
}
}
// 678640: using guessed type char byte_678640;
// 679660: using guessed type char gbMaxPlayers;

2
Source/multi.h

@ -47,7 +47,7 @@ void __fastcall buffer_init(TBuffer *pBuf);
void __fastcall multi_send_pinfo(int pnum, char cmd);
int __fastcall InitNewSeed(int newseed);
void __cdecl SetupLocalCoords();
int __fastcall multi_init_single(_SNETPROGRAMDATA *client_info, _SNETPLAYERDATA *user_info, _SNETUIDATA *ui_info);
BOOL __fastcall multi_init_single(_SNETPROGRAMDATA *client_info, _SNETPLAYERDATA *user_info, _SNETUIDATA *ui_info);
BOOL __fastcall multi_init_multi(_SNETPROGRAMDATA *client_info, _SNETPLAYERDATA *user_info, _SNETUIDATA *ui_info, int *pfExitProgram);
BOOL __fastcall multi_upgrade(int *pfExitProgram);
void __fastcall multi_player_joins(int pnum, TCmdPlrInfoHdr *cmd, int a3);

Loading…
Cancel
Save