Skip to content

Commit

Permalink
Merge branch 'master' of github.com:diasurgical/devilution into hellfire
Browse files Browse the repository at this point in the history
  • Loading branch information
AJenbo committed Apr 4, 2020
2 parents f35c955 + 187a021 commit b040c04
Show file tree
Hide file tree
Showing 142 changed files with 3,350 additions and 2,236 deletions.
20 changes: 9 additions & 11 deletions .clang-format
Original file line number Diff line number Diff line change
@@ -1,11 +1,9 @@
{
BasedOnStyle: webkit,
AlignTrailingComments: true,
AllowShortBlocksOnASingleLine: true,
AllowShortFunctionsOnASingleLine: None,
PointerAlignment: Right,
AlignConsecutiveAssignments: true,
TabWidth: 4,
UseTab: ForIndentation,
SortIncludes: false,
}
BasedOnStyle: webkit
AlignTrailingComments: true
AllowShortBlocksOnASingleLine: true
AllowShortFunctionsOnASingleLine: None
PointerAlignment: Right
AlignConsecutiveAssignments: true
TabWidth: 4
UseTab: ForIndentation
SortIncludes: false
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -373,3 +373,4 @@ ASALocalRun/
*.pubxml.user

# End of https://www.gitignore.io/api/visualstudio
/docs/html/
1 change: 1 addition & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ addons:
homebrew:
packages:
- mingw-w64
update: true

env:
- MAKE_BUILD=make
Expand Down
8 changes: 4 additions & 4 deletions DiabloUI/_temp_funcs.h
Original file line number Diff line number Diff line change
Expand Up @@ -76,16 +76,16 @@ void __cdecl Connect_cpp_init();
BOOL __stdcall UiGetDataCallback(int game_type, int data_code, void *a3, int a4, int a5);
BOOL __stdcall UiSoundCallback(int a1, int type, int a3);
BOOL __stdcall UiAuthCallback(int a1, char *a2, char *a3, char a4, char *a5, LPSTR lpBuffer, int cchBufferMax);
BOOL __stdcall UiDrawDescCallback(int arg0, COLORREF color, LPCSTR lpString, char *a4, int a5, UINT align, time_t a7, HDC *a8);
BOOL __stdcall UiDrawDescCallback(int game_type, COLORREF color, LPCSTR lpString, char *a4, int a5, UINT align, time_t a7, HDC *a8);
BOOL __stdcall UiCategoryCallback(int a1, int a2, int a3, int a4, int a5, DWORD *a6, DWORD *a7);
int __fastcall Connect_GetRankFromLevel(char *str);
BOOL __fastcall Connect_DiffFromString(char *str, _gamedata *gamedata, int a3, int a4);
void __fastcall Connect_SetDiffString(_gamedata *gamedata, const char *str1, char *str2, char *str3, int size);
BOOL __fastcall Connect_GetHeroInfoConc(const char *a1, _uiheroinfo *pInfo);
void __fastcall Connect_MakeDescString(_uiheroinfo *a1, char *name, size_t size);
void __stdcall UiCreateGameCriteria(_uiheroinfo *pInfo, char *str);
BOOL __stdcall UiCreatePlayerDescription(_uiheroinfo *info, int mode, char *desc);
void __stdcall UiSetupPlayerInfo(char *infostr, _uiheroinfo *pInfo, int type);
BOOL __stdcall UiCreatePlayerDescription(_uiheroinfo *info, DWORD mode, char *desc);
void __stdcall UiSetupPlayerInfo(char *infostr, _uiheroinfo *pInfo, DWORD type);
void __fastcall Connect_CopyPlrDescStrings(char *str1, int size1, char *str2, int size2);

BOOL __stdcall UiCopyProtError(int *pdwResult);
Expand Down Expand Up @@ -283,7 +283,7 @@ void __fastcall local_SetDiabloCursor(HWND hWnd);

void __cdecl j_MainMenu_cpp_init();
void __cdecl MainMenu_cpp_init();
BOOL __stdcall UiMainMenuDialog(char *name, int *pdwResult, void(__stdcall *fnSound)(char *file), int a4);
BOOL __stdcall UiMainMenuDialog(char *name, int *pdwResult, void(__stdcall *fnSound)(char *file), int attractTimeOut);
LRESULT __stdcall MainMenu_WndProc(HWND hWnd, UINT Msg, WPARAM wParam, LPARAM lParam);
void __fastcall MainMenu_KillAndFreeMenu(HWND hWnd);
void __fastcall MainMenu_SetMenuTimer(HWND hWnd);
Expand Down
10 changes: 5 additions & 5 deletions DiabloUI/connect.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -450,7 +450,7 @@ BOOL __stdcall UiAuthCallback(int a1, char *a2, char *a3, char a4, char *a5, LPS
}

// ref: 0x10003710
BOOL __stdcall UiDrawDescCallback(int arg0, COLORREF color, LPCSTR lpString, char *a4, int a5, UINT align, time_t a7, HDC *a8)
BOOL __stdcall UiDrawDescCallback(int game_type, COLORREF color, LPCSTR lpString, char *a4, int a5, UINT align, time_t a7, HDC *a8)
{
HDC *v8; // ebx
HDC v9; // esi
Expand Down Expand Up @@ -525,7 +525,7 @@ BOOL __stdcall UiDrawDescCallback(int arg0, COLORREF color, LPCSTR lpString, cha
GetCurrentPositionEx(v17, (LPPOINT)&a8a[7]);
SetTextAlign(v8[6], 0);
connect_color_text = 1;
UiDrawDescCallback(arg0, 2u, (LPCSTR)a8, a4, 0, 1u, 0, a8a);
UiDrawDescCallback(game_type, 2u, (LPCSTR)a8, a4, 0, 1u, 0, a8a);
connect_color_text = 0;
if (a7) {
SetTextAlign(v8[6], 1u);
Expand Down Expand Up @@ -599,7 +599,7 @@ BOOL __stdcall UiDrawDescCallback(int arg0, COLORREF color, LPCSTR lpString, cha
goto LABEL_45;
}
if (a5 & 8) {
v25 = (arg0 != 'BNET') - 1;
v25 = (game_type != 'BNET') - 1;
v25 = v25 & 0xFD;
v24 = v25 + 4;
goto LABEL_46;
Expand Down Expand Up @@ -847,15 +847,15 @@ void __stdcall UiCreateGameCriteria(_uiheroinfo *pInfo, char *str)
}

// ref: 0x10003FD6
BOOL __stdcall UiCreatePlayerDescription(_uiheroinfo *info, int mode, char *desc)
BOOL __stdcall UiCreatePlayerDescription(_uiheroinfo *info, DWORD mode, char *desc)
{
connect_charname = (char *)mode;
Connect_MakeDescString(info, desc, 0x80u);
return 1;
}

// ref: 0x10003FF7
void __stdcall UiSetupPlayerInfo(char *infostr, _uiheroinfo *pInfo, int type)
void __stdcall UiSetupPlayerInfo(char *infostr, _uiheroinfo *pInfo, DWORD type)
{
connect_charname = (char *)type;
SStrCopy(connect_plrinfostr, infostr, 128);
Expand Down
2 changes: 1 addition & 1 deletion DiabloUI/diabloui.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -138,7 +138,7 @@ BOOL __stdcall DllMain(HINSTANCE hinstDLL, DWORD fdwReason, LPVOID lpvReserved)
} else {
local_DelUiPalette();
}
return 1;
return TRUE;
}

// ref: 0x10005CEA
Expand Down
8 changes: 4 additions & 4 deletions DiabloUI/diabloui.h
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ BOOL __fastcall UiValidPlayerName(char *name); /* check __stdcall */
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, BOOL *hero_is_created, char *name);
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 UiCreditsDialog(int a1);
BOOL __stdcall UiMainMenuDialog(char *name, int *pdwResult, void(__stdcall *fnSound)(char *file), int a4);
BOOL __stdcall UiMainMenuDialog(char *name, int *pdwResult, void(__stdcall *fnSound)(char *file), int attractTimeOut);
BOOL __stdcall UiProgressDialog(HWND window, char *msg, int enable, int(*fnfunc)(), int rate);
const char **__stdcall UiProfileGetString();
void __cdecl UiProfileCallback();
Expand All @@ -45,13 +45,13 @@ BOOL __stdcall UiGetDataCallback(int game_type, int data_code, void *a3, int a4,
BOOL __stdcall UiAuthCallback(int a1, char *a2, char *a3, char a4, char *a5, LPSTR lpBuffer, int cchBufferMax);
BOOL __stdcall UiSoundCallback(int a1, int type, int a3);
void __stdcall UiMessageBoxCallback(HWND hWnd, char *lpText, LPCSTR lpCaption, UINT uType);
BOOL __stdcall UiDrawDescCallback(int arg0, COLORREF color, LPCSTR lpString, char *a4, int a5, UINT align, time_t a7, HDC *a8);
BOOL __stdcall UiDrawDescCallback(int game_type, COLORREF color, LPCSTR lpString, char *a4, int a5, UINT align, time_t a7, HDC *a8);
BOOL __stdcall UiCreateGameCallback(int a1, int a2, int a3, int a4, int a5, int a6);
BOOL __stdcall UiArtCallback(int game_type, unsigned int art_code, PALETTEENTRY *pPalette, BYTE *pBuffer, DWORD dwBuffersize, DWORD *pdwWidth, DWORD *pdwHeight, DWORD *pdwBpp);
int __stdcall UiSelectGame(int a1, _SNETPROGRAMDATA *client_info, _SNETPLAYERDATA *user_info, _SNETUIDATA *ui_info, _SNETVERSIONDATA *file_info, int *a6);
int __stdcall UiSelectProvider(int a1, _SNETPROGRAMDATA *client_info, _SNETPLAYERDATA *user_info, _SNETUIDATA *ui_info, _SNETVERSIONDATA *file_info, int *type);
BOOL __stdcall UiCreatePlayerDescription(_uiheroinfo *info, int mode, char *desc);
void __stdcall UiSetupPlayerInfo(char *infostr, _uiheroinfo *pInfo, int type);
BOOL __stdcall UiCreatePlayerDescription(_uiheroinfo *info, DWORD mode, char *desc);
void __stdcall UiSetupPlayerInfo(char *infostr, _uiheroinfo *pInfo, DWORD type);
void __stdcall UiCreateGameCriteria(_uiheroinfo *pInfo, char *str);
BOOL __stdcall UiGetDefaultStats(int pclass, _uidefaultstats *pStats);
BOOL __stdcall UiBetaDisclaimer(int a1);
Expand Down
4 changes: 2 additions & 2 deletions DiabloUI/mainmenu.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,12 @@ void __cdecl MainMenu_cpp_init()
// 1002A0D4: using guessed type int mainmenu_cpp_float;

// ref: 0x1000816F
BOOL __stdcall UiMainMenuDialog(char *name, int *pdwResult, void(__stdcall *fnSound)(char *file), int a4)
BOOL __stdcall UiMainMenuDialog(char *name, int *pdwResult, void(__stdcall *fnSound)(char *file), int attractTimeOut)
{
int v4; // eax
int v5; // esi

menu_item_timer = a4;
menu_item_timer = attractTimeOut;
TitleSnd_SetSoundFunction(fnSound);
artfont_LoadAllFonts();
menu_version_str[0] = 0;
Expand Down
18 changes: 8 additions & 10 deletions Source/.clang-format
Original file line number Diff line number Diff line change
@@ -1,10 +1,8 @@
{
BasedOnStyle: webkit,
AlignTrailingComments: true,
AllowShortBlocksOnASingleLine: true,
AllowShortFunctionsOnASingleLine: None,
PointerAlignment: Right,
TabWidth: 4,
UseTab: ForIndentation,
SortIncludes: false,
}
BasedOnStyle: webkit
AlignTrailingComments: true
AllowShortBlocksOnASingleLine: true
AllowShortFunctionsOnASingleLine: None
PointerAlignment: Right
TabWidth: 4
UseTab: ForIndentation
SortIncludes: false
91 changes: 91 additions & 0 deletions Source/all.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,91 @@
/**
* @file all.h
*
* Include all aplication headers.
*/
#ifndef __ALL_H__
#define __ALL_H__

#include "../types.h"

#ifdef __cplusplus
extern "C" {
#endif
#include "appfat.h"
#include "automap.h"
#include "capture.h"
#include "codec.h"
#include "control.h"
#include "cursor.h"
#include "dead.h"
#include "debug.h"
#include "diablo.h"
#include "doom.h"
#include "drlg_l1.h"
#include "drlg_l2.h"
#include "drlg_l3.h"
#include "drlg_l4.h"
#include "dthread.h"
#include "dx.h"
#include "effects.h"
#include "encrypt.h"
#include "engine.h"
#include "error.h"
#include "fault.h"
#include "gamemenu.h"
#include "gendung.h"
#include "gmenu.h"
#include "help.h"
#include "init.h"
#include "interfac.h"
#include "inv.h"
#include "itemdat.h"
#include "items.h"
#include "lighting.h"
#include "loadsave.h"
#include "logging.h"
#include "mainmenu.h"
#include "minitext.h"
#include "misdat.h"
#include "missiles.h"
#include "monstdat.h"
#include "monster.h"
#include "movie.h"
#include "mpqapi.h"
#include "msg.h"
#include "msgcmd.h"
#include "multi.h"
#include "nthread.h"
#include "objdat.h"
#include "objects.h"
#include "pack.h"
#include "palette.h"
#include "path.h"
#include "pfile.h"
#include "player.h"
#include "plrmsg.h"
#include "portal.h"
#include "quests.h"
#include "restrict.h"
#include "scrollrt.h"
#include "setmaps.h"
#include "sha.h"
#include "sound.h"
#include "spelldat.h"
#include "spells.h"
#include "stores.h"
#include "sync.h"
#include "textdat.h" // check file name
#include "themes.h"
#include "tmsg.h"
#include "town.h"
#include "towners.h"
#include "track.h"
#include "trigs.h"
#include "wave.h"
#include "render.h" // linked last, likely .s/.asm
#ifdef __cplusplus
}
#endif

#endif /* __ALL_H__ */
21 changes: 20 additions & 1 deletion Source/appfat.cpp
Original file line number Diff line number Diff line change
@@ -1,8 +1,15 @@
#include "diablo.h"
/**
* @file appfat.cpp
*
* Implementation of error dialogs.
*/
#include "all.h"
#include "../3rdParty/Storm/Source/storm.h"

char sz_error_buf[256];
/** Set to true when a fatal error is encountered and the application should shut down. */
BOOL terminating;
/** Thread id of the last callee to FreeDlg(). */
int cleanup_thread_id;

// delete overloads the delete operator.
Expand Down Expand Up @@ -80,6 +87,12 @@ char *GetErrorStr(DWORD error_code)
return sz_error_buf;
}

/**
* @brief Generate a textual message for DirectDraw error codes
* @param hError DirectDraw error code
* @param pszBuffer Buffer for the error message
* @param dwMaxChars Length of pszBuffer
*/
void TraceErrorDD(HRESULT hError, char *pszBuffer, DWORD dwMaxChars)
{
const char *szError;
Expand Down Expand Up @@ -390,6 +403,12 @@ void TraceErrorDD(HRESULT hError, char *pszBuffer, DWORD dwMaxChars)
strncpy(pszBuffer, szError, dwMaxChars);
}

/**
* @brief Generate a textual message for DirectSound error codes
* @param hError DirectSound error code
* @param pszBuffer Buffer for the error message
* @param dwMaxChars Length of pszBuffer
*/
void TraceErrorDS(HRESULT hError, char *pszBuffer, DWORD dwMaxChars)
{
const char *szError;
Expand Down
6 changes: 5 additions & 1 deletion Source/appfat.h
Original file line number Diff line number Diff line change
@@ -1,4 +1,8 @@
//HEADER_GOES_HERE
/**
* @file appfat.h
*
* Interface of error dialogs.
*/
#ifndef __APPFAT_H__
#define __APPFAT_H__

Expand Down
Loading

0 comments on commit b040c04

Please sign in to comment.