From 21b62274b91029ee7eaec6bc6ef9e77de95e932e Mon Sep 17 00:00:00 2001 From: Anders Jenbo Date: Sat, 29 Feb 2020 18:31:49 +0100 Subject: [PATCH 01/14] Document .SOL value tables --- Source/gendung.cpp | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/Source/gendung.cpp b/Source/gendung.cpp index e9c0cde3..9061e1f9 100644 --- a/Source/gendung.cpp +++ b/Source/gendung.cpp @@ -2,6 +2,9 @@ WORD level_frame_types[MAXTILES]; int themeCount; +/** + * List of transparent dPieces + */ BOOLEAN nTransTable[2049]; //int dword_52D204; int dMonster[MAXDUNX][MAXDUNY]; @@ -23,6 +26,9 @@ int tile_defs[MAXTILES]; BYTE *pMegaTiles; BYTE *pLevelPieces; int gnDifficulty; +/** + * List of transparancy masks to use for dPieces + */ char block_lvid[2049]; //char byte_5B78EB; char dTransVal[MAXDUNX][MAXDUNY]; @@ -30,6 +36,9 @@ BOOLEAN nTrapTable[2049]; BYTE leveltype; BYTE currlevel; BOOLEAN TransList[256]; +/** + * List of path blocking dPieces + */ BOOLEAN nSolidTable[2049]; int level_frame_count[MAXTILES]; ScrollStruct ScrollInfo; @@ -42,12 +51,18 @@ int dword_5C2FFC; int scr_pix_width; int scr_pix_height; char dArch[MAXDUNX][MAXDUNY]; +/** + * List of light blocking dPieces + */ BOOLEAN nBlockTable[2049]; BYTE *pSpecialCels; char dFlags[MAXDUNX][MAXDUNY]; char dItem[MAXDUNX][MAXDUNY]; BYTE setlvlnum; int level_frame_sizes[MAXTILES]; +/** + * List of missile blocking dPieces + */ BOOLEAN nMissileTable[2049]; BYTE *pSetPiece; char setlvltype; From 3c276a3cd3423f117df9e50ca3456e285706db7c Mon Sep 17 00:00:00 2001 From: Anders Jenbo Date: Sun, 1 Mar 2020 01:29:19 +0100 Subject: [PATCH 02/14] Add documentation - Add file documentation to about 1/4 of the files in Source - Copy over a lot of the documentation from the sanctuary/notes repo - Standardise all the existing documentation - Create a configuration for Doxygen - Add more documentation (engine.cpp is now fully documented) --- .gitignore | 1 + Source/all.h | 5 ++ Source/appfat.cpp | 19 +++++ Source/appfat.h | 6 +- Source/automap.cpp | 13 +++- Source/automap.h | 6 +- Source/capture.cpp | 12 +++ Source/capture.h | 6 +- Source/codec.cpp | 5 ++ Source/codec.h | 6 +- Source/control.cpp | 11 ++- Source/control.h | 6 +- Source/cursor.cpp | 9 ++- Source/cursor.h | 6 +- Source/dead.cpp | 7 +- Source/dead.h | 6 +- Source/debug.cpp | 5 ++ Source/debug.h | 6 +- Source/diablo.cpp | 20 ++++- Source/diablo.h | 12 ++- Source/doom.cpp | 5 ++ Source/doom.h | 6 +- Source/drlg_l1.cpp | 5 ++ Source/drlg_l1.h | 6 +- Source/drlg_l2.cpp | 5 ++ Source/drlg_l2.h | 6 +- Source/drlg_l3.cpp | 5 ++ Source/drlg_l3.h | 6 +- Source/drlg_l4.cpp | 5 ++ Source/drlg_l4.h | 6 +- Source/dthread.cpp | 5 ++ Source/dthread.h | 6 +- Source/dx.cpp | 5 ++ Source/dx.h | 6 +- Source/effects.cpp | 14 +++- Source/effects.h | 6 +- Source/encrypt.cpp | 5 ++ Source/encrypt.h | 6 +- Source/engine.cpp | 16 ++++ Source/engine.h | 24 +++++- Source/error.cpp | 6 ++ Source/error.h | 6 +- Source/fault.cpp | 5 ++ Source/fault.h | 6 +- Source/gamemenu.cpp | 5 ++ Source/gamemenu.h | 6 +- Source/gmenu.cpp | 7 ++ Source/gmenu.h | 6 +- Source/interfac.cpp | 2 + Source/lighting.cpp | 59 +++++++-------- Source/lighting.h | 6 +- Source/list.h | 30 ++++---- Source/logging.cpp | 2 + Source/mainmenu.cpp | 1 + Source/misdat.cpp | 2 + Source/missiles.cpp | 2 + Source/monster.cpp | 9 ++- Source/monster.h | 8 +- Source/movie.cpp | 2 + Source/mpqapi.cpp | 2 + Source/nthread.cpp | 5 ++ Source/nthread.h | 6 +- Source/objects.cpp | 2 +- Source/pack.cpp | 10 ++- Source/path.cpp | 25 +++--- Source/path.h | 6 +- Source/pfile.cpp | 1 + Source/player.cpp | 2 +- Source/plrmsg.cpp | 1 + Source/portal.cpp | 4 + Source/render.cpp | 2 +- Source/setmaps.cpp | 1 + Source/spelldat.cpp | 1 + Source/stores.cpp | 1 + Source/textdat.cpp | 3 +- Source/themes.cpp | 180 +++++++++++++++++++++++++------------------- Source/themes.h | 6 +- Source/towners.cpp | 3 +- defs.h | 6 +- doxygen.config | 34 +++++++++ 80 files changed, 602 insertions(+), 184 deletions(-) create mode 100644 doxygen.config diff --git a/.gitignore b/.gitignore index d14076ae..97e810c1 100644 --- a/.gitignore +++ b/.gitignore @@ -373,3 +373,4 @@ ASALocalRun/ *.pubxml.user # End of https://www.gitignore.io/api/visualstudio +/docs/html/ diff --git a/Source/all.h b/Source/all.h index 4a19fbbf..75e22931 100644 --- a/Source/all.h +++ b/Source/all.h @@ -1,3 +1,8 @@ +/** + * @file all.h + * + * Include all aplication headers. + */ #ifndef __ALL_H__ #define __ALL_H__ diff --git a/Source/appfat.cpp b/Source/appfat.cpp index 51be3e1d..69222e70 100644 --- a/Source/appfat.cpp +++ b/Source/appfat.cpp @@ -1,8 +1,15 @@ +/** + * @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. @@ -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; @@ -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; diff --git a/Source/appfat.h b/Source/appfat.h index 97c49825..ea335f09 100644 --- a/Source/appfat.h +++ b/Source/appfat.h @@ -1,4 +1,8 @@ -//HEADER_GOES_HERE +/** + * @file appfat.h + * + * Interface of error dialogs. + */ #ifndef __APPFAT_H__ #define __APPFAT_H__ diff --git a/Source/automap.cpp b/Source/automap.cpp index 5a2df7ab..6f64b069 100644 --- a/Source/automap.cpp +++ b/Source/automap.cpp @@ -1,3 +1,8 @@ +/** + * @file automap.cpp + * + * Implementation of the ingame map overlay. + */ #include "all.h" // BUGFIX: only the first 256 elements are ever read @@ -16,15 +21,15 @@ int AmLine16; int AmLine8; int AmLine4; -// color used to draw the player's arrow +/** color used to draw the player's arrow */ #define COLOR_PLAYER (PAL8_ORANGE + 1) -// color for bright map lines (doors, stairs etc.) +/** color for bright map lines (doors, stairs etc.) */ #define COLOR_BRIGHT PAL8_YELLOW -// color for dim map lines/dots +/** color for dim map lines/dots */ #define COLOR_DIM (PAL16_YELLOW + 8) #define MAPFLAG_TYPE 0x000F -// these are in the second byte +/** these are in the second byte */ #define MAPFLAG_VERTDOOR 0x01 #define MAPFLAG_HORZDOOR 0x02 #define MAPFLAG_VERTARCH 0x04 diff --git a/Source/automap.h b/Source/automap.h index a947c467..22ccfaa7 100644 --- a/Source/automap.h +++ b/Source/automap.h @@ -1,4 +1,8 @@ -//HEADER_GOES_HERE +/** + * @file automap.h + * + * Interface of the ingame map overlay. + */ #ifndef __AUTOMAP_H__ #define __AUTOMAP_H__ diff --git a/Source/capture.cpp b/Source/capture.cpp index ce3a07bf..552b43e2 100644 --- a/Source/capture.cpp +++ b/Source/capture.cpp @@ -1,5 +1,17 @@ +/** + * @file capture.cpp + * + * Implementation of the screenshot function. + */ #include "all.h" +/** + * @brief Write the PCX-file header + * @param hFile File handler for the PCX file. + * @param width Image width + * @param height Image height + * @return True on success + */ static BOOL CaptureHdr(HANDLE hFile, short width, short height) { DWORD lpNumBytes; diff --git a/Source/capture.h b/Source/capture.h index c1e86c10..9a54e2d1 100644 --- a/Source/capture.h +++ b/Source/capture.h @@ -1,4 +1,8 @@ -//HEADER_GOES_HERE +/** + * @file capture.h + * + * Interface of the screenshot function. + */ #ifndef __CAPTURE_H__ #define __CAPTURE_H__ diff --git a/Source/codec.cpp b/Source/codec.cpp index 835cf447..1e9402b7 100644 --- a/Source/codec.cpp +++ b/Source/codec.cpp @@ -1,3 +1,8 @@ +/** + * @file codec.cpp + * + * Implementation of save game encryption algorithm. + */ #include "all.h" struct CodecSignature { diff --git a/Source/codec.h b/Source/codec.h index 0cae2784..00c11cea 100644 --- a/Source/codec.h +++ b/Source/codec.h @@ -1,4 +1,8 @@ -//HEADER_GOES_HERE +/** + * @file codec.h + * + * Interface of save game encryption algorithm. + */ #ifndef __CODEC_H__ #define __CODEC_H__ diff --git a/Source/control.cpp b/Source/control.cpp index 589efcfb..d612b2b3 100644 --- a/Source/control.cpp +++ b/Source/control.cpp @@ -1,3 +1,8 @@ +/** + * @file control.cpp + * + * Implementation of the character and main control panels + */ #include "all.h" BYTE sgbNextTalkSave; @@ -18,7 +23,8 @@ BOOL drawmanaflag; BOOL chrbtnactive; char sgszTalkMsg[MAX_SEND_STR_LEN]; BYTE *pPanelText; -int nGoldFrame; /** current frame # for the pentagram caret in gold input */ +/** current frame # for the pentagram caret in gold input */ +int nGoldFrame; BYTE *pLifeBuff; BYTE *pBtmBuff; BYTE *pTalkBtns; @@ -36,7 +42,8 @@ char tempstr[256]; BOOLEAN whisper[MAX_PLRS]; int sbooktab; int pSplType; -int frame; /** current frame # for the pentagram caret in chat input */ +/** current frame # for the pentagram caret in chat input */ +int frame; int initialDropGoldIndex; BOOL talkflag; BYTE *pSBkIconCels; diff --git a/Source/control.h b/Source/control.h index 1e64e1fa..0fa12609 100644 --- a/Source/control.h +++ b/Source/control.h @@ -1,4 +1,8 @@ -//HEADER_GOES_HERE +/** + * @file control.h + * + * Interface of the character and main control panels + */ #ifndef __CONTROL_H__ #define __CONTROL_H__ diff --git a/Source/cursor.cpp b/Source/cursor.cpp index d463c15a..8fa3aa31 100644 --- a/Source/cursor.cpp +++ b/Source/cursor.cpp @@ -1,3 +1,8 @@ +/** + * @file cursor.cpp + * + * Implementation of cursor tracking functionality. + */ #include "all.h" int cursH; @@ -8,7 +13,7 @@ int icursW28; BYTE *pCursCels; int icursH; -// inv_item value +/** inv_item value */ char pcursinvitem; int icursW; char pcursitem; @@ -20,6 +25,7 @@ int pcurstemp; int pcurs; /* rdata */ +/** Maps from objcurs.cel frame number to frame width. */ const int InvItemWidth[180] = { // Cursors 0, 33, 32, 32, 32, 32, 32, 32, 32, 32, 32, 23, @@ -43,6 +49,7 @@ const int InvItemWidth[180] = { 2 * 28, 2 * 28, 2 * 28, 2 * 28, 2 * 28, 2 * 28, 2 * 28, 2 * 28 }; +/** Maps from objcurs.cel frame number to frame height. */ const int InvItemHeight[180] = { // Cursors 0, 29, 32, 32, 32, 32, 32, 32, 32, 32, 32, 35, diff --git a/Source/cursor.h b/Source/cursor.h index 5fbb4241..42b1df21 100644 --- a/Source/cursor.h +++ b/Source/cursor.h @@ -1,4 +1,8 @@ -//HEADER_GOES_HERE +/** + * @file cursor.h + * + * Interface of cursor tracking functionality. + */ #ifndef __CURSOR_H__ #define __CURSOR_H__ diff --git a/Source/dead.cpp b/Source/dead.cpp index 00e87d27..ba72cd0a 100644 --- a/Source/dead.cpp +++ b/Source/dead.cpp @@ -1,6 +1,11 @@ +/** + * @file dead.cpp + * + * Implementation of functions for placing dead monsters. + */ #include "all.h" -// unused, this was probably for blood boil/burn +/** unused, this was probably for blood boil/burn */ int spurtndx; DeadStruct dead[MAXDEAD]; int stonendx; diff --git a/Source/dead.h b/Source/dead.h index bc16374d..f9e992a2 100644 --- a/Source/dead.h +++ b/Source/dead.h @@ -1,4 +1,8 @@ -//HEADER_GOES_HERE +/** + * @file dead.h + * + * Interface of functions for placing dead monsters. + */ #ifndef __DEAD_H__ #define __DEAD_H__ diff --git a/Source/debug.cpp b/Source/debug.cpp index f01542c6..24d004d0 100644 --- a/Source/debug.cpp +++ b/Source/debug.cpp @@ -1,3 +1,8 @@ +/** + * @file debug.cpp + * + * Implementation of debug functions. + */ #include "all.h" #ifdef _DEBUG diff --git a/Source/debug.h b/Source/debug.h index d3dacf70..439fc9c8 100644 --- a/Source/debug.h +++ b/Source/debug.h @@ -1,4 +1,8 @@ -//HEADER_GOES_HERE +/** + * @file debug.h + * + * Interface of debug functions. + */ #ifndef __DEBUG_H__ #define __DEBUG_H__ diff --git a/Source/diablo.cpp b/Source/diablo.cpp index 8b97a5d8..c764276d 100644 --- a/Source/diablo.cpp +++ b/Source/diablo.cpp @@ -1,3 +1,8 @@ +/** + * @file diablo.cpp + * + * Implementation of the main game initialization functions. + */ #include "all.h" #include "../3rdParty/Storm/Source/storm.h" #include "../DiabloUI/diabloui.h" @@ -22,11 +27,13 @@ int DebugMonsters[10]; BOOLEAN cineflag; int force_redraw; BOOL visiondebug; -BOOL scrollflag; /* unused */ +/** unused */ +BOOL scrollflag; BOOL light4flag; BOOL leveldebug; BOOL monstdebug; -BOOL trigdebug; /* unused */ +/** unused */ +BOOL trigdebug; int setseed; int debugmonsttypes; int PauseMode; @@ -56,12 +63,14 @@ int framerate; int framestart; #endif BOOL FriendlyMode = TRUE; +/** Default quick messages */ char *spszMsgTbl[4] = { "I need help! Come Here!", "Follow me.", "Here's something for you.", "Now you DIE!" }; +/** INI files variable names for quick message keys */ char *spszMsgHotKeyTbl[4] = { "F9", "F10", "F11", "F12" }; void FreeGameMem() @@ -236,6 +245,13 @@ BOOL diablo_get_not_running() return GetLastError() != ERROR_ALREADY_EXISTS; } +/** + * @brief Main entry point, check env, initialize systesm, play intros, start main menu, shut down + * @param hInstance A handle to the current instance of the application. + * @param hPrevInstance Always null + * @param lpCmdLine The command line for the application + * @param nCmdShow Initial window state + */ int APIENTRY WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine, int nCmdShow) { HINSTANCE hInst; diff --git a/Source/diablo.h b/Source/diablo.h index 8127673e..1e3f5002 100644 --- a/Source/diablo.h +++ b/Source/diablo.h @@ -1,4 +1,8 @@ -//HEADER_GOES_HERE +/** + * @file diablo.h + * + * Interface of the main game initialization functions. + */ #ifndef __DIABLO_H__ #define __DIABLO_H__ @@ -22,11 +26,13 @@ extern int DebugMonsters[10]; extern BOOLEAN cineflag; extern int force_redraw; extern BOOL visiondebug; -extern BOOL scrollflag; /* unused */ +/** unused */ +extern BOOL scrollflag; extern BOOL light4flag; extern BOOL leveldebug; extern BOOL monstdebug; -extern BOOL trigdebug; /* unused */ +/** unused */ +extern BOOL trigdebug; extern int setseed; extern int debugmonsttypes; extern int PauseMode; diff --git a/Source/doom.cpp b/Source/doom.cpp index b336849e..b419c702 100644 --- a/Source/doom.cpp +++ b/Source/doom.cpp @@ -1,3 +1,8 @@ +/** + * @file doom.cpp + * + * Implementation of the map of the stars quest. + */ #include "all.h" int doom_quest_time; diff --git a/Source/doom.h b/Source/doom.h index 31635fe0..b72b2c33 100644 --- a/Source/doom.h +++ b/Source/doom.h @@ -1,4 +1,8 @@ -//HEADER_GOES_HERE +/** + * @file doom.h + * + * Interface of the map of the stars quest. + */ #ifndef __DOOM_H__ #define __DOOM_H__ diff --git a/Source/drlg_l1.cpp b/Source/drlg_l1.cpp index 64391da7..9aa56141 100644 --- a/Source/drlg_l1.cpp +++ b/Source/drlg_l1.cpp @@ -1,3 +1,8 @@ +/** + * @file drlg_l1.cpp + * + * Implementation of the cathedral level generation algorithms. + */ #include "all.h" BYTE L5dungeon[80][80]; diff --git a/Source/drlg_l1.h b/Source/drlg_l1.h index e9e354d5..2b0ff6c5 100644 --- a/Source/drlg_l1.h +++ b/Source/drlg_l1.h @@ -1,4 +1,8 @@ -//HEADER_GOES_HERE +/** + * @file drlg_l1.h + * + * Interface of the cathedral level generation algorithms. + */ #ifndef __DRLG_L1_H__ #define __DRLG_L1_H__ diff --git a/Source/drlg_l2.cpp b/Source/drlg_l2.cpp index b66ccab9..fc3ea922 100644 --- a/Source/drlg_l2.cpp +++ b/Source/drlg_l2.cpp @@ -1,3 +1,8 @@ +/** + * @file drlg_l2.cpp + * + * Implementation of the catacombs level generation algorithms. + */ #ifndef SPAWN #include "all.h" diff --git a/Source/drlg_l2.h b/Source/drlg_l2.h index 35beda6b..8b9e8690 100644 --- a/Source/drlg_l2.h +++ b/Source/drlg_l2.h @@ -1,4 +1,8 @@ -//HEADER_GOES_HERE +/** + * @file drlg_l2.h + * + * Interface of the catacombs level generation algorithms. + */ #ifndef __DRLG_L2_H__ #define __DRLG_L2_H__ diff --git a/Source/drlg_l3.cpp b/Source/drlg_l3.cpp index 43a1a67e..3679c2e4 100644 --- a/Source/drlg_l3.cpp +++ b/Source/drlg_l3.cpp @@ -1,3 +1,8 @@ +/** + * @file drlg_l3.cpp + * + * Implementation of the caves level generation algorithms. + */ #ifndef SPAWN #include "all.h" diff --git a/Source/drlg_l3.h b/Source/drlg_l3.h index 9170d7f9..a3067300 100644 --- a/Source/drlg_l3.h +++ b/Source/drlg_l3.h @@ -1,4 +1,8 @@ -//HEADER_GOES_HERE +/** + * @file drlg_l3.h + * + * Interface of the caves level generation algorithms. + */ #ifndef __DRLG_L3_H__ #define __DRLG_L3_H__ diff --git a/Source/drlg_l4.cpp b/Source/drlg_l4.cpp index 9cf009bf..f97a0be4 100644 --- a/Source/drlg_l4.cpp +++ b/Source/drlg_l4.cpp @@ -1,3 +1,8 @@ +/** + * @file drlg_l4.cpp + * + * Implementation of the hell level generation algorithms. + */ #include "all.h" int diabquad1x; diff --git a/Source/drlg_l4.h b/Source/drlg_l4.h index 6559545b..cf64e917 100644 --- a/Source/drlg_l4.h +++ b/Source/drlg_l4.h @@ -1,4 +1,8 @@ -//HEADER_GOES_HERE +/** + * @file drlg_l4.h + * + * Interface of the hell level generation algorithms. + */ #ifndef __DRLG_L4_H__ #define __DRLG_L4_H__ diff --git a/Source/dthread.cpp b/Source/dthread.cpp index b17457cf..6e3e9a0b 100644 --- a/Source/dthread.cpp +++ b/Source/dthread.cpp @@ -1,3 +1,8 @@ +/** + * @file dthread.cpp + * + * Implementation of functions for updating game state from network commands. + */ #include "all.h" #include "../3rdParty/Storm/Source/storm.h" diff --git a/Source/dthread.h b/Source/dthread.h index 4ad5d3fb..7a9e86c9 100644 --- a/Source/dthread.h +++ b/Source/dthread.h @@ -1,4 +1,8 @@ -//HEADER_GOES_HERE +/** + * @file dthread.h + * + * Interface of functions for updating game state from network commands. + */ #ifndef __DTHREAD_H__ #define __DTHREAD_H__ diff --git a/Source/dx.cpp b/Source/dx.cpp index 99c5dc33..2ead8b68 100644 --- a/Source/dx.cpp +++ b/Source/dx.cpp @@ -1,3 +1,8 @@ +/** + * @file dx.cpp + * + * Implementation of functions setting up the graphics pipeline. + */ #include "all.h" #include "../3rdParty/Storm/Source/storm.h" diff --git a/Source/dx.h b/Source/dx.h index 39c0fbef..1a13e3b1 100644 --- a/Source/dx.h +++ b/Source/dx.h @@ -1,4 +1,8 @@ -//HEADER_GOES_HERE +/** + * @file dx.h + * + * Interface of functions setting up the graphics pipeline. + */ #ifndef __DX_H__ #define __DX_H__ diff --git a/Source/effects.cpp b/Source/effects.cpp index 0afb731a..cfa3d203 100644 --- a/Source/effects.cpp +++ b/Source/effects.cpp @@ -1,3 +1,8 @@ +/** + * @file effects.cpp + * + * Implementation of functions for loading and playing sounds. + */ #include "all.h" #include "../3rdParty/Storm/Source/storm.h" @@ -6,10 +11,17 @@ int sfxdnum; HANDLE sfx_stream; TSFX *sfx_data_cur; +/** + * Monster sound type prefix + * a: Attack + * h: Hit + * d: Death + * s: Special + */ const char MonstSndChar[] = { 'a', 'h', 'd', 's' }; /* data */ - +/** List of all sounds, except monsters and music */ TSFX sgSFX[] = { // clang-format off // bFlags, pszName, pSnd diff --git a/Source/effects.h b/Source/effects.h index 8ed845e6..5aa3ddbc 100644 --- a/Source/effects.h +++ b/Source/effects.h @@ -1,4 +1,8 @@ -//HEADER_GOES_HERE +/** + * @file effects.h + * + * Interface of functions for loading and playing sounds. + */ #ifndef __EFFECTS_H__ #define __EFFECTS_H__ diff --git a/Source/encrypt.cpp b/Source/encrypt.cpp index 50abc783..dd4d0a4a 100644 --- a/Source/encrypt.cpp +++ b/Source/encrypt.cpp @@ -1,3 +1,8 @@ +/** + * @file encrypt.cpp + * + * Implementation of functions for compression and decompressing MPQ data. + */ #include "all.h" #include "../3rdParty/PKWare/pkware.h" diff --git a/Source/encrypt.h b/Source/encrypt.h index 0d76b0f8..552bed22 100644 --- a/Source/encrypt.h +++ b/Source/encrypt.h @@ -1,4 +1,8 @@ -//HEADER_GOES_HERE +/** + * @file encrypt.h + * + * Interface of functions for compression and decompressing MPQ data. + */ #ifndef __ENCRYPT_H__ #define __ENCRYPT_H__ diff --git a/Source/engine.cpp b/Source/engine.cpp index 13a86bfc..fb460826 100644 --- a/Source/engine.cpp +++ b/Source/engine.cpp @@ -1,3 +1,15 @@ +/** + * @file engine.cpp + * + * Implementation of basic engine helper functions: + * - Sprite blitting + * - Drawing + * - Angle calculation + * - RNG + * - Memory allocation + * - File loading + * - Video playback + */ #include "all.h" #include "../3rdParty/Storm/Source/storm.h" @@ -8,7 +20,9 @@ char gbPixelCol; // automap pixel color 8-bit (palette entry) BOOL gbRotateMap; // flip - if y < x int orgseed; +/** Width of sprite being blitted */ int sgnWidth; +/** Current game seed */ int sglGameSeed; #ifdef __cplusplus static CCritSect sgMemCrit; @@ -2255,12 +2269,14 @@ void engine_draw_pixel(int sx, int sy) #endif } +/** Macro used in DrawLine() */ #define GG_SWAP(A, B) \ { \ (A) ^= (B); \ (B) ^= (A); \ (A) ^= (B); \ } +/** Macro used in DrawLine() */ #define GG_ABSOLUTE(I, J, K) (((I) - (J)) * ((K) = (((I) - (J)) < 0 ? -1 : 1))) /** diff --git a/Source/engine.h b/Source/engine.h index 26075080..9027445b 100644 --- a/Source/engine.h +++ b/Source/engine.h @@ -1,15 +1,31 @@ -//HEADER_GOES_HERE +/** + * @file engine.h + * + * of basic engine helper functions: + * - Sprite blitting + * - Drawing + * - Angle calculation + * - RNG + * - Memory allocation + * - File loading + * - Video playback + */ #ifndef __ENGINE_H__ #define __ENGINE_H__ //offset 0 //pCelBuff->pFrameTable[0] -extern char gbPixelCol; // automap pixel color 8-bit (palette entry) -extern BOOL gbRotateMap; // flip - if y < x +/** automap pixel color 8-bit (palette entry) */ +extern char gbPixelCol; +/** flip - if y < x */ +extern BOOL gbRotateMap; +/** Seed value before the most recent call to SetRndSeed() */ extern int orgseed; +/** Track number of calls to GetRndSeed() since last call to SetRndSeed() */ extern int SeedCount; -extern BOOL gbNotInView; // valid - if x/y are in bounds +/** valid - if x/y are in bounds */ +extern BOOL gbNotInView; __FINLINE BYTE *CelGetFrame(BYTE *pCelBuff, int nCel, int *nDataSize); diff --git a/Source/error.cpp b/Source/error.cpp index 1d96d370..2df97ac3 100644 --- a/Source/error.cpp +++ b/Source/error.cpp @@ -1,3 +1,8 @@ +/** + * @file error.cpp + * + * Implementation of in-game message functions. + */ #include "all.h" char msgtable[MAX_SEND_STR_LEN]; @@ -5,6 +10,7 @@ char msgdelay; char msgflag; char msgcnt; +/** Maps from error_id to error message. */ char *MsgStrings[44] = { "", "No automap available in town", diff --git a/Source/error.h b/Source/error.h index 4191582a..046307b8 100644 --- a/Source/error.h +++ b/Source/error.h @@ -1,4 +1,8 @@ -//HEADER_GOES_HERE +/** + * @file error.h + * + * Interface of in-game message functions. + */ #ifndef __ERROR_H__ #define __ERROR_H__ diff --git a/Source/fault.cpp b/Source/fault.cpp index 64d2f5d8..43e14f5e 100644 --- a/Source/fault.cpp +++ b/Source/fault.cpp @@ -1,3 +1,8 @@ +/** + * @file fault.cpp + * + * Implementation of exception logging functionality. + */ #include "all.h" LPTOP_LEVEL_EXCEPTION_FILTER lpTopLevelExceptionFilter; diff --git a/Source/fault.h b/Source/fault.h index 0dc743cb..4ed85ea1 100644 --- a/Source/fault.h +++ b/Source/fault.h @@ -1,4 +1,8 @@ -//HEADER_GOES_HERE +/** + * @file fault.h + * + * Interface of exception logging functionality. + */ #ifndef __FAULT_H__ #define __FAULT_H__ diff --git a/Source/gamemenu.cpp b/Source/gamemenu.cpp index 7cf3db3c..2e385b0b 100644 --- a/Source/gamemenu.cpp +++ b/Source/gamemenu.cpp @@ -1,3 +1,8 @@ +/** + * @file gamemenu.cpp + * + * Implementation of the ingame menu functions. + */ #include "all.h" TMenuItem sgSingleMenu[6] = { diff --git a/Source/gamemenu.h b/Source/gamemenu.h index 634e17cf..a6ad2f1c 100644 --- a/Source/gamemenu.h +++ b/Source/gamemenu.h @@ -1,4 +1,8 @@ -//HEADER_GOES_HERE +/** + * @file gamemenu.h + * + * Interface of the ingame menu functions. + */ #ifndef __GAMEMENU_H__ #define __GAMEMENU_H__ diff --git a/Source/gmenu.cpp b/Source/gmenu.cpp index d78cd99f..c13c7676 100644 --- a/Source/gmenu.cpp +++ b/Source/gmenu.cpp @@ -1,3 +1,8 @@ +/** + * @file gmenu.cpp + * + * Implementation of the ingame navigation and interaction. + */ #include "all.h" BYTE *optbar_cel; @@ -13,6 +18,7 @@ BYTE *option_cel; BYTE *sgpLogo; int sgCurrentMenuIdx; +/** Maps from font index to bigtgold.cel frame number. */ const BYTE lfontframe[127] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, @@ -28,6 +34,7 @@ const BYTE lfontframe[127] = { 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 20, 0, 21, 0 }; +/* Maps from bigtgold.cel frame number to character width. */ const BYTE lfontkern[56] = { 18, 33, 21, 26, 28, 19, 19, 26, 25, 11, 12, 25, 19, 34, 28, 32, 20, 32, 28, 20, diff --git a/Source/gmenu.h b/Source/gmenu.h index b884a9a9..1d0490d3 100644 --- a/Source/gmenu.h +++ b/Source/gmenu.h @@ -1,4 +1,8 @@ -//HEADER_GOES_HERE +/** + * @file gmenu.h + * + * Interface of the ingame navigation and interaction. + */ #ifndef __GMENU_H__ #define __GMENU_H__ diff --git a/Source/interfac.cpp b/Source/interfac.cpp index e3b3ebd1..be837929 100644 --- a/Source/interfac.cpp +++ b/Source/interfac.cpp @@ -5,7 +5,9 @@ void *sgpBackCel; int sgdwProgress; int progress_id; +/** The colour used for the progress bar as an index into the palette. */ const BYTE BarColor[3] = { 138, 43, 254 }; +/** The screen position of the top left corner of the progress bar. */ const int BarPos[3][2] = { { 53, 37 }, { 53, 421 }, { 53, 37 } }; void interface_msg_pump() diff --git a/Source/lighting.cpp b/Source/lighting.cpp index 51b8edaa..adde0a7f 100644 --- a/Source/lighting.cpp +++ b/Source/lighting.cpp @@ -1,3 +1,8 @@ +/** + * @file lighting.cpp + * + * Implementation of light and vision. + */ #include "all.h" LightListStruct VisionList[MAXVISION]; @@ -401,9 +406,7 @@ char CrawlTable[2749] = { -18, -1, 18, -1, -18, 0, 18, 0 }; -/** - * pCrawlTable maps from circle radius to the X- and Y-coordinate deltas from the center of a circle. - */ +/** pCrawlTable maps from circle radius to the X- and Y-coordinate deltas from the center of a circle. */ char *pCrawlTable[19] = { CrawlTable, CrawlTable + 3, @@ -425,9 +428,7 @@ char *pCrawlTable[19] = { CrawlTable + 2187, CrawlTable + 2460 }; -/** - * vCrawlTable specifies the X- Y-coordinate offsets of lighting visions. - */ +/** vCrawlTable specifies the X- Y-coordinate offsets of lighting visions. */ BYTE vCrawlTable[23][30] = { { 1, 0, 2, 0, 3, 0, 4, 0, 5, 0, 6, 0, 7, 0, 8, 0, 9, 0, 10, 0, 11, 0, 12, 0, 13, 0, 14, 0, 15, 0 }, { 1, 0, 2, 0, 3, 0, 4, 0, 5, 0, 6, 0, 7, 0, 8, 1, 9, 1, 10, 1, 11, 1, 12, 1, 13, 1, 14, 1, 15, 1 }, @@ -453,31 +454,29 @@ BYTE vCrawlTable[23][30] = { { 0, 1, 0, 2, 0, 3, 0, 4, 0, 5, 0, 6, 0, 7, 1, 8, 1, 9, 1, 10, 1, 11, 1, 12, 1, 13, 1, 14, 1, 15 }, { 0, 1, 0, 2, 0, 3, 0, 4, 0, 5, 0, 6, 0, 7, 0, 8, 0, 9, 0, 10, 0, 11, 0, 12, 0, 13, 0, 14, 0, 15 } }; -BYTE byte_49463C[18][18] = /* unused */ - { - { 0, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3 }, - { 0, 1, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3 }, - { 0, 1, 2, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3 }, - { 0, 0, 1, 2, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3 }, - { 0, 0, 1, 1, 2, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3 }, - { 0, 0, 1, 1, 2, 2, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3 }, - { 0, 0, 0, 1, 1, 2, 2, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3 }, - { 0, 0, 0, 1, 1, 1, 2, 2, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3 }, - { 0, 0, 0, 0, 1, 1, 2, 2, 2, 3, 3, 3, 3, 3, 3, 3, 3, 3 }, - { 0, 0, 0, 0, 1, 1, 1, 2, 2, 2, 3, 3, 3, 3, 3, 3, 3, 3 }, - { 0, 0, 0, 0, 0, 1, 1, 1, 2, 2, 2, 3, 3, 3, 3, 3, 3, 3 }, - { 0, 0, 0, 0, 0, 1, 1, 1, 2, 2, 2, 2, 3, 3, 3, 3, 3, 3 }, - { 0, 0, 0, 0, 0, 1, 1, 1, 1, 2, 2, 2, 2, 3, 3, 3, 3, 3 }, - { 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 2, 2, 2, 2, 3, 3, 3 }, - { 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 2, 2, 2, 2, 2, 3, 3 }, - { 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 2, 2, 2, 2, 2, 3, 3 }, - { 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 2, 2, 2, 2, 2, 3 }, - { 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 2, 2, 2, 2, 2 } - }; +/** unused */ +BYTE byte_49463C[18][18] = { + { 0, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3 }, + { 0, 1, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3 }, + { 0, 1, 2, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3 }, + { 0, 0, 1, 2, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3 }, + { 0, 0, 1, 1, 2, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3 }, + { 0, 0, 1, 1, 2, 2, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3 }, + { 0, 0, 0, 1, 1, 2, 2, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3 }, + { 0, 0, 0, 1, 1, 1, 2, 2, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3 }, + { 0, 0, 0, 0, 1, 1, 2, 2, 2, 3, 3, 3, 3, 3, 3, 3, 3, 3 }, + { 0, 0, 0, 0, 1, 1, 1, 2, 2, 2, 3, 3, 3, 3, 3, 3, 3, 3 }, + { 0, 0, 0, 0, 0, 1, 1, 1, 2, 2, 2, 3, 3, 3, 3, 3, 3, 3 }, + { 0, 0, 0, 0, 0, 1, 1, 1, 2, 2, 2, 2, 3, 3, 3, 3, 3, 3 }, + { 0, 0, 0, 0, 0, 1, 1, 1, 1, 2, 2, 2, 2, 3, 3, 3, 3, 3 }, + { 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 2, 2, 2, 2, 3, 3, 3 }, + { 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 2, 2, 2, 2, 2, 3, 3 }, + { 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 2, 2, 2, 2, 2, 3, 3 }, + { 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 2, 2, 2, 2, 2, 3 }, + { 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 2, 2, 2, 2, 2 } +}; -/** - * RadiusAdj maps from vCrawlTable index to lighting vision radius adjustment. - */ +/** RadiusAdj maps from vCrawlTable index to lighting vision radius adjustment. */ BYTE RadiusAdj[23] = { 0, 0, 0, 0, 1, 1, 1, 2, 2, 2, 3, 4, 3, 2, 2, 2, 1, 1, 1, 0, 0, 0, 0 }; void RotateRadius(int *x, int *y, int *dx, int *dy, int *lx, int *ly, int *bx, int *by) diff --git a/Source/lighting.h b/Source/lighting.h index 5b593423..ac4b1278 100644 --- a/Source/lighting.h +++ b/Source/lighting.h @@ -1,4 +1,8 @@ -//HEADER_GOES_HERE +/** + * @file lighting.h + * + * Interface of light and vision. + */ #ifndef __LIGHTING_H__ #define __LIGHTING_H__ diff --git a/Source/list.h b/Source/list.h index 154f9bec..7a2c35fc 100644 --- a/Source/list.h +++ b/Source/list.h @@ -1,4 +1,6 @@ -/* Intrusive double-linked list implementation, +/** + * @file list.h + * Intrusive double-linked list implementation, * based on https://github.com/webcoyote/coho/blob/master/Base/List.h */ @@ -7,22 +9,22 @@ #define OBJECT_NAME(obj) (((const char *)&typeid(obj)) + 8) /****************************************************************************** -* -* List definition macros -* -***/ + * + * List definition macros + * + ***/ -// Define a field within a structure that will be used to link it into a list +/** Define a field within a structure that will be used to link it into a list */ #define LIST_LINK(T) TLink template class TLink; /****************************************************************************** -* -* TList -* -***/ + * + * TList + * + ***/ //============================================================================= template @@ -159,10 +161,10 @@ void TList::UnlinkAll() } /****************************************************************************** -* -* TLink -* -***/ + * + * TLink + * + ***/ //============================================================================= template diff --git a/Source/logging.cpp b/Source/logging.cpp index c0ea8a7c..cffa639e 100644 --- a/Source/logging.cpp +++ b/Source/logging.cpp @@ -11,7 +11,9 @@ DWORD nNumberOfBytesToWrite; /* data */ +/** Has the log file not yet been created. */ BOOL log_not_created = TRUE; +/** Handle to the log file. */ HANDLE log_file = INVALID_HANDLE_VALUE; void __cdecl log_flush(BOOL force_close) diff --git a/Source/mainmenu.cpp b/Source/mainmenu.cpp index 1c66f703..d9eec335 100644 --- a/Source/mainmenu.cpp +++ b/Source/mainmenu.cpp @@ -6,6 +6,7 @@ char gszHero[16]; /* data */ +/** The active music track id for the main menu. */ int menu_music_track_id = TMUSIC_INTRO; void mainmenu_refresh_music() diff --git a/Source/misdat.cpp b/Source/misdat.cpp index 6449e655..49cc1034 100644 --- a/Source/misdat.cpp +++ b/Source/misdat.cpp @@ -1,5 +1,6 @@ #include "all.h" +/** Data related to each missile ID. */ MissileData missiledata[] = { // clang-format off // mName, mAddProc, mProc, mDraw, mType, mResist, mFileNum, miSFX, mlSFX; @@ -74,6 +75,7 @@ MissileData missiledata[] = { // clang-format on }; +/** Data related to each missile graphic ID. */ MisFileData misfiledata[] = { // clang-format off // mAnimName, mAnimFAmt, mName, mFlags, mAnimData[16], mAnimDelay[16], mAnimLen[16], mAnimWidth[16], mAnimWidth2[16] diff --git a/Source/missiles.cpp b/Source/missiles.cpp index 96910d80..517b2ac2 100644 --- a/Source/missiles.cpp +++ b/Source/missiles.cpp @@ -9,7 +9,9 @@ ChainStruct chain[MAXMISSILES]; BOOL MissilePreFlag; int numchains; +/** Maps from direction to X-offset. */ int XDirAdd[8] = { 1, 0, -1, -1, -1, 0, 1, 1 }; +/** Maps from direction to Y-offset. */ int YDirAdd[8] = { 1, 1, 1, 0, -1, -1, -1, 0 }; void GetDamageAmt(int i, int *mind, int *maxd) diff --git a/Source/monster.cpp b/Source/monster.cpp index 924ba107..cf1e1ac9 100644 --- a/Source/monster.cpp +++ b/Source/monster.cpp @@ -1,7 +1,12 @@ +/** + * @file monster.cpp + * + * Implementation of monster functionality, AI, actions, spawning, loading, etc. + */ #include "all.h" #include "../3rdParty/Storm/Source/storm.h" -// Tracks which missile files are already loaded +/** Tracks which missile files are already loaded */ int MissileFileFlag; // BUGFIX: replace monstkills[MAXMONSTERS] with monstkills[NUM_MTYPES]. @@ -54,7 +59,7 @@ int opposite[8] = { 4, 5, 6, 7, 0, 1, 2, 3 }; int offset_x[8] = { 1, 0, -1, -1, -1, 0, 1, 1 }; int offset_y[8] = { 1, 1, 1, 0, -1, -1, -1, 0 }; -/* unused */ +/** unused */ int rnd5[4] = { 5, 10, 15, 20 }; int rnd10[4] = { 10, 15, 20, 30 }; int rnd20[4] = { 20, 30, 40, 50 }; diff --git a/Source/monster.h b/Source/monster.h index 45d884df..881e4cab 100644 --- a/Source/monster.h +++ b/Source/monster.h @@ -1,4 +1,8 @@ -//HEADER_GOES_HERE +/** + * @file monster.h + * + * Interface of monster functionality, AI, actions, spawning, loading, etc. + */ #ifndef __MONSTER_H__ #define __MONSTER_H__ @@ -174,7 +178,7 @@ extern int opposite[8]; extern int offset_x[8]; extern int offset_y[8]; -/* unused */ +/** unused */ extern int rnd5[4]; extern int rnd10[4]; extern int rnd20[4]; diff --git a/Source/movie.cpp b/Source/movie.cpp index 40c513c3..75fb4791 100644 --- a/Source/movie.cpp +++ b/Source/movie.cpp @@ -1,7 +1,9 @@ #include "all.h" #include "../3rdParty/Storm/Source/storm.h" +/** Should the movie continue playing. */ BYTE movie_playing; +/** Should the movie play in a loop. */ BOOL loop_movie; void play_movie(char *pszMovie, BOOL user_can_close) diff --git a/Source/mpqapi.cpp b/Source/mpqapi.cpp index 985eb25b..2bdcbfc6 100644 --- a/Source/mpqapi.cpp +++ b/Source/mpqapi.cpp @@ -4,8 +4,10 @@ DWORD sgdwMpqOffset; char mpq_buf[4096]; _HASHENTRY *sgpHashTbl; +/** Has the savegame-file been modified in memory. */ BOOL save_archive_modified; _BLOCKENTRY *sgpBlockTbl; +/** Is the savegame-file currently open. */ BOOLEAN save_archive_open; //note: 32872 = 32768 + 104 (sizeof(_FILEHEADER)) diff --git a/Source/nthread.cpp b/Source/nthread.cpp index 4911067a..ec5d75bd 100644 --- a/Source/nthread.cpp +++ b/Source/nthread.cpp @@ -1,3 +1,8 @@ +/** + * @file nthread.cpp + * + * Implementation of functions for managing game ticks. + */ #include "all.h" #include "../3rdParty/Storm/Source/storm.h" diff --git a/Source/nthread.h b/Source/nthread.h index 84263e95..98b50121 100644 --- a/Source/nthread.h +++ b/Source/nthread.h @@ -1,4 +1,8 @@ -//HEADER_GOES_HERE +/** + * @file nthread.h + * + * Interface of functions for managing game ticks. + */ #ifndef __NTHREAD_H__ #define __NTHREAD_H__ diff --git a/Source/objects.cpp b/Source/objects.cpp index 07b3a32e..5f3c8126 100644 --- a/Source/objects.cpp +++ b/Source/objects.cpp @@ -52,7 +52,7 @@ char shrinemax[NUM_SHRINETYPE] = { 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16 }; -// 0 - sp+mp, 1 - sp only, 2 - mp only +/** 0 - sp+mp, 1 - sp only, 2 - mp only */ BYTE shrineavail[NUM_SHRINETYPE] = { 0, 0, 1, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 0, diff --git a/Source/pack.cpp b/Source/pack.cpp index 2ebe3946..931a1c0c 100644 --- a/Source/pack.cpp +++ b/Source/pack.cpp @@ -106,8 +106,14 @@ void PackPlayer(PkPlayerStruct *pPack, int pnum, BOOL manashield) pPack->pManaShield = FALSE; } -// Note: last slot of item[MAXITEMS+1] used as temporary buffer -// find real name reference below, possibly [sizeof(item[])/sizeof(ItemStruct)] +/** + * Expand a PkItemStruct in to a ItemStruct + * + * Note: last slot of item[MAXITEMS+1] used as temporary buffer + * find real name reference below, possibly [sizeof(item[])/sizeof(ItemStruct)] + * @param is The source packed item + * @param id The distination item + */ static void UnPackItem(PkItemStruct *is, ItemStruct *id) { if (is->idx == 0xFFFF) { diff --git a/Source/path.cpp b/Source/path.cpp index d0dd05d7..0dda4826 100644 --- a/Source/path.cpp +++ b/Source/path.cpp @@ -1,30 +1,37 @@ +/** + * @file path.cpp + * + * Implementation of the path finding algorithms. + */ #include "all.h" -// preallocated nodes, search is terminated after 300 nodes are visited +/** Notes visisted by the path finding algorithm. */ PATHNODE path_nodes[MAXPATHNODES]; -// size of the pnode_tblptr stack +/** size of the pnode_tblptr stack */ int gdwCurPathStep; -// the number of in-use nodes in path_nodes +/** the number of in-use nodes in path_nodes */ int gdwCurNodes; -/* for reconstructing the path after the A* search is done. The longest +/** + * for reconstructing the path after the A* search is done. The longest * possible path is actually 24 steps, even though we can fit 25 */ int pnode_vals[MAX_PATH_LENGTH]; -// a linked list of all visited nodes +/** A linked list of all visited nodes */ PATHNODE *pnode_ptr; -// a stack for recursively searching nodes +/** A stack for recursively searching nodes */ PATHNODE *pnode_tblptr[MAXPATHNODES]; -// a linked list of the A* frontier, sorted by distance +/** A linked list of the A* frontier, sorted by distance */ PATHNODE *path_2_nodes; PATHNODE path_unusednodes[MAXPATHNODES]; -// for iterating over the 8 possible movement directions +/** For iterating over the 8 possible movement directions */ const char pathxdir[8] = { -1, -1, 1, 1, -1, 0, 1, 0 }; const char pathydir[8] = { -1, 1, -1, 1, 0, -1, 0, 1 }; /* data */ -/* each step direction is assigned a number like this: +/** + * each step direction is assigned a number like this: * dx * -1 0 1 * +----- diff --git a/Source/path.h b/Source/path.h index ff333084..83191d34 100644 --- a/Source/path.h +++ b/Source/path.h @@ -1,4 +1,8 @@ -//HEADER_GOES_HERE +/** + * @file path.h + * + * Interface of the path finding algorithms. + */ #ifndef __PATH_H__ #define __PATH_H__ diff --git a/Source/pfile.cpp b/Source/pfile.cpp index 9fea06a5..d6ac5fa0 100644 --- a/Source/pfile.cpp +++ b/Source/pfile.cpp @@ -10,6 +10,7 @@ #define PASSWORD_MULTI "szqnlsk1" #endif +/** List of character names for the character selection screen. */ static char hero_names[MAX_CHARACTERS][PLR_NAME_LEN]; BOOL gbValidSaveFile; diff --git a/Source/player.cpp b/Source/player.cpp index bef128d7..c4913c3f 100644 --- a/Source/player.cpp +++ b/Source/player.cpp @@ -42,7 +42,7 @@ int PWVel[3][3] = { { 2048, 1024, 512 }, { 2048, 1024, 512 } }; -// Total number of frames in walk animation. +/** Total number of frames in walk animation. */ int AnimLenFromClass[3] = { 8, 8, 8 }; diff --git a/Source/plrmsg.cpp b/Source/plrmsg.cpp index c5b85113..d745df86 100644 --- a/Source/plrmsg.cpp +++ b/Source/plrmsg.cpp @@ -3,6 +3,7 @@ static BYTE plr_msg_slot; _plrmsg plr_msgs[PMSG_COUNT]; +/** Maps from player_num to text colour, as used in chat messages. */ const char text_color_from_player_num[MAX_PLRS + 1] = { COL_WHITE, COL_WHITE, COL_WHITE, COL_WHITE, COL_GOLD }; void plrmsg_delay(BOOL delay) diff --git a/Source/portal.cpp b/Source/portal.cpp index 038c33d8..88df7ac7 100644 --- a/Source/portal.cpp +++ b/Source/portal.cpp @@ -1,9 +1,13 @@ #include "all.h" +/** In-game state of portals. */ PortalStruct portal[MAXPORTAL]; +/** Current portal number (a portal array index). */ int portalindex; +/** X-coordinate of each players portal in town. */ int WarpDropX[MAXPORTAL] = { 57, 59, 61, 63 }; +/** Y-coordinate of each players portal in town. */ int WarpDropY[MAXPORTAL] = { 40, 40, 40, 40 }; void InitPortals() diff --git a/Source/render.cpp b/Source/render.cpp index 39a22cb3..7d1327f9 100644 --- a/Source/render.cpp +++ b/Source/render.cpp @@ -84,7 +84,7 @@ int WorldTbl3x16[48] = { 60, 60, 60 }; -// slope/angle tables, left and right +/** slope/angle tables, left and right */ int WorldTbl17_1[17] = { 0, 4, 8, 16, 24, 36, 48, 64, 80, 100, 120, 144, 168, 196, 224, 256, 288 }; int WorldTbl17_2[17] = { 0, 32, 60, 88, 112, 136, 156, 176, 192, 208, 220, 232, 240, 248, 252, 256, 288 }; diff --git a/Source/setmaps.cpp b/Source/setmaps.cpp index 51b0a345..3a0b8735 100644 --- a/Source/setmaps.cpp +++ b/Source/setmaps.cpp @@ -54,6 +54,7 @@ BYTE SkelChamTrans3[36] = { 50, 43, 59, 51 }; +/** Maps from quest level to quest level names. */ char *quest_level_names[] = { "", "Skeleton King's Lair", diff --git a/Source/spelldat.cpp b/Source/spelldat.cpp index 8337d598..ce198eaf 100644 --- a/Source/spelldat.cpp +++ b/Source/spelldat.cpp @@ -1,5 +1,6 @@ #include "all.h" +/** Data related to each spell ID. */ SpellData spelldata[MAX_SPELLS] = { // clang-format off // sName, sManaCost, sType, sNameText, sSkillText, sBookLvl, sStaffLvl, sTargeted, sTownSpell, sMinInt, sSFX, sMissiles[3], sManaAdj, sMinMana, sStaffMin, sStaffMax, sBookCost, sStaffCost diff --git a/Source/stores.cpp b/Source/stores.cpp index 61d3dd7d..5bb86f53 100644 --- a/Source/stores.cpp +++ b/Source/stores.cpp @@ -60,6 +60,7 @@ int SStringY[24] = { 264, 276 }; +/** Maps from towner IDs to NPC names. */ char *talkname[9] = { "Griswold", "Pepin", diff --git a/Source/textdat.cpp b/Source/textdat.cpp index b3432759..dbf7898a 100644 --- a/Source/textdat.cpp +++ b/Source/textdat.cpp @@ -784,4 +784,5 @@ const TextDataStruct alltext[] = { { "Thank goodness you've returned!\nMuch has changed since you lived here, my friend. All was peaceful until the dark riders came and destroyed our village. Many were cut down where they stood, and those who took up arms were slain or dragged away to become slaves - or worse. The church at the edge of town has been desecrated and is being used for dark rituals. The screams that echo in the night are inhuman, but some of our townsfolk may yet survive. Follow the path that lies between my tavern and the blacksmith shop to find the church and save who you can. \n \nPerhaps I can tell you more if we speak again. Good luck.|", 1, 5, TSFX_TAVERN0 } }; -const DWORD gdwAllTextEntries = 259; /* unused */ +/** unused */ +const DWORD gdwAllTextEntries = 259; diff --git a/Source/themes.cpp b/Source/themes.cpp index 4c9a8ddd..4ebbf3b5 100644 --- a/Source/themes.cpp +++ b/Source/themes.cpp @@ -1,3 +1,8 @@ +/** + * @file themes.cpp + * + * Implementation of the theme room placing algorithms. + */ #include "all.h" int numthemes; @@ -451,7 +456,9 @@ void InitThemes() } } -// HoldThemeRooms marks theme rooms as populated. +/** + * @brief HoldThemeRooms marks theme rooms as populated. + */ void HoldThemeRooms() { int i, x, y; @@ -475,11 +482,12 @@ void HoldThemeRooms() } } -// PlaceThemeMonsts places theme monsters with the specified frequency. -// -// Parameters: -// - t: theme number (index into themes array). -// - f: frequency (1/f likelihood of adding monster). +/** + * PlaceThemeMonsts places theme monsters with the specified frequency. + * + * @param t theme number (index into themes array). + * @param f frequency (1/f likelihood of adding monster). + */ void PlaceThemeMonsts(int t, int f) { int xp, yp; @@ -505,10 +513,11 @@ void PlaceThemeMonsts(int t, int f) } } -// Theme_Barrel initializes the barrel theme. -// -// Parameters: -// - t: theme number (index into themes array). +/** + * Theme_Barrel initializes the barrel theme. + * + * @param t theme number (index into themes array). + */ void Theme_Barrel(int t) { int xp, yp, r; @@ -532,10 +541,11 @@ void Theme_Barrel(int t) PlaceThemeMonsts(t, monstrnd[leveltype - 1]); } -// Theme_Shrine initializes the shrine theme. -// -// Parameters: -// - t: theme number (index into themes array). +/** + * Theme_Shrine initializes the shrine theme. + * + * @param t theme number (index into themes array). + */ void Theme_Shrine(int t) { char monstrnd[4] = { 6, 6, 3, 9 }; @@ -553,10 +563,11 @@ void Theme_Shrine(int t) PlaceThemeMonsts(t, monstrnd[leveltype - 1]); } -// Theme_MonstPit initializes the monster pit theme. -// -// Parameters: -// - t: theme number (index into themes array). +/** + * Theme_MonstPit initializes the monster pit theme. + * + * @param t theme number (index into themes array). + */ void Theme_MonstPit(int t) { int r; @@ -589,10 +600,11 @@ void Theme_MonstPit(int t) PlaceThemeMonsts(t, monstrnd[leveltype - 1]); } -// Theme_SkelRoom initializes the skeleton room theme. -// -// Parameters: -// - t: theme number (index into themes array). +/** + * Theme_SkelRoom initializes the skeleton room theme. + * + * @param t theme number (index into themes array). + */ void Theme_SkelRoom(int t) { int xp, yp, i; @@ -658,10 +670,11 @@ void Theme_SkelRoom(int t) } } -// Theme_Treasure initializes the treasure theme. -// -// Parameters: -// - t: theme number (index into themes array). +/** + * Theme_Treasure initializes the treasure theme. + * + * @param t theme number (index into themes array). + */ void Theme_Treasure(int t) { int xp, yp; @@ -695,10 +708,11 @@ void Theme_Treasure(int t) PlaceThemeMonsts(t, monstrnd[leveltype - 1]); } -// Theme_Library initializes the library theme. -// -// Parameters: -// - t: theme number (index into themes array). +/** + * Theme_Library initializes the library theme. + * + * @param t theme number (index into themes array). + */ void Theme_Library(int t) { int xp, yp, oi; @@ -740,10 +754,11 @@ void Theme_Library(int t) } } -// Theme_Torture initializes the torture theme. -// -// Parameters: -// - t: theme number (index into themes array). +/** + * Theme_Torture initializes the torture theme. + * + * @param t theme number (index into themes array). + */ void Theme_Torture(int t) { int xp, yp; @@ -764,10 +779,10 @@ void Theme_Torture(int t) PlaceThemeMonsts(t, monstrnd[leveltype - 1]); } -// Theme_BloodFountain initializes the blood fountain theme. -// -// Parameters: -// - t: theme number (index into themes array). +/** + * Theme_BloodFountain initializes the blood fountain theme. + * @param t Theme number (index into themes array). + */ void Theme_BloodFountain(int t) { char monstrnd[4] = { 6, 8, 3, 9 }; @@ -777,10 +792,11 @@ void Theme_BloodFountain(int t) PlaceThemeMonsts(t, monstrnd[leveltype - 1]); } -// Theme_Decap initializes the decapitated theme. -// -// Parameters: -// - t: theme number (index into themes array). +/** + * Theme_Decap initializes the decapitated theme. + * + * @param t theme number (index into themes array). + */ void Theme_Decap(int t) { int xp, yp; @@ -801,10 +817,11 @@ void Theme_Decap(int t) PlaceThemeMonsts(t, monstrnd[leveltype - 1]); } -// Theme_PurifyingFountain initializes the purifying fountain theme. -// -// Parameters: -// - t: theme number (index into themes array). +/** + * Theme_PurifyingFountain initializes the purifying fountain theme. + * + * @param t theme number (index into themes array). + */ void Theme_PurifyingFountain(int t) { char monstrnd[4] = { 6, 7, 3, 9 }; @@ -814,10 +831,11 @@ void Theme_PurifyingFountain(int t) PlaceThemeMonsts(t, monstrnd[leveltype - 1]); } -// Theme_ArmorStand initializes the armor stand theme. -// -// Parameters: -// - t: theme number (index into themes array). +/** + * Theme_ArmorStand initializes the armor stand theme. + * + * @param t theme number (index into themes array). + */ void Theme_ArmorStand(int t) { int xp, yp; @@ -843,10 +861,11 @@ void Theme_ArmorStand(int t) armorFlag = FALSE; } -// Theme_GoatShrine initializes the goat shrine theme. -// -// Parameters: -// - t: theme number (index into themes array). +/** + * Theme_GoatShrine initializes the goat shrine theme. + * + * @param t theme number (index into themes array). + */ void Theme_GoatShrine(int t) { int xx, yy; @@ -862,10 +881,11 @@ void Theme_GoatShrine(int t) } } -// Theme_Cauldron initializes the cauldron theme. -// -// Parameters: -// - t: theme number (index into themes array). +/** + * Theme_Cauldron initializes the cauldron theme. + * + * @param t theme number (index into themes array). + */ void Theme_Cauldron(int t) { char monstrnd[4] = { 6, 7, 3, 9 }; @@ -875,10 +895,11 @@ void Theme_Cauldron(int t) PlaceThemeMonsts(t, monstrnd[leveltype - 1]); } -// Theme_MurkyFountain initializes the murky fountain theme. -// -// Parameters: -// - t: theme number (index into themes array). +/** + * Theme_MurkyFountain initializes the murky fountain theme. + * + * @param t theme number (index into themes array). + */ void Theme_MurkyFountain(int t) { char monstrnd[4] = { 6, 7, 3, 9 }; @@ -888,10 +909,11 @@ void Theme_MurkyFountain(int t) PlaceThemeMonsts(t, monstrnd[leveltype - 1]); } -// Theme_TearFountain initializes the tear fountain theme. -// -// Parameters: -// - t: theme number (index into themes array). +/** + * Theme_TearFountain initializes the tear fountain theme. + * + * @param t theme number (index into themes array). + */ void Theme_TearFountain(int t) { char monstrnd[4] = { 6, 7, 3, 9 }; @@ -901,10 +923,11 @@ void Theme_TearFountain(int t) PlaceThemeMonsts(t, monstrnd[leveltype - 1]); } -// Theme_BrnCross initializes the burning cross theme. -// -// Parameters: -// - t: theme number (index into themes array). +/** + * Theme_BrnCross initializes the burning cross theme. + * + * @param t theme number (index into themes array). + */ void Theme_BrnCross(int t) { int xp, yp; @@ -926,10 +949,11 @@ void Theme_BrnCross(int t) bCrossFlag = TRUE; } -// Theme_WeaponRack initializes the weapon rack theme. -// -// Parameters: -// - t: theme number (index into themes array). +/** + * Theme_WeaponRack initializes the weapon rack theme. + * + * @param t theme number (index into themes array). + */ void Theme_WeaponRack(int t) { int xp, yp; @@ -955,7 +979,9 @@ void Theme_WeaponRack(int t) weaponFlag = FALSE; } -// UpdateL4Trans sets each value of the transparency map to 1. +/** + * UpdateL4Trans sets each value of the transparency map to 1. + */ void UpdateL4Trans() { int i, j; @@ -969,7 +995,9 @@ void UpdateL4Trans() } } -// CreateThemeRooms adds thematic elements to rooms. +/** + * CreateThemeRooms adds thematic elements to rooms. + */ void CreateThemeRooms() { int i; diff --git a/Source/themes.h b/Source/themes.h index 5ee91827..35c4cb08 100644 --- a/Source/themes.h +++ b/Source/themes.h @@ -1,4 +1,8 @@ -//HEADER_GOES_HERE +/** + * @file themes.h + * + * Interface of the theme room placing algorithms. + */ #ifndef __THEMES_H__ #define __THEMES_H__ diff --git a/Source/towners.cpp b/Source/towners.cpp index 09782e23..103271ef 100644 --- a/Source/towners.cpp +++ b/Source/towners.cpp @@ -4,7 +4,8 @@ BOOL storeflag; int sgnCowMsg; int numtowners; DWORD sgdwCowClicks; -BOOL bannerflag; // unused 0x6AAC28 +/** unused 0x6AAC28 */ +BOOL bannerflag; BOOL boyloadflag; BYTE *pCowCels; TownerStruct towner[16]; diff --git a/defs.h b/defs.h index 20c09ac7..505eb4bf 100644 --- a/defs.h +++ b/defs.h @@ -1,4 +1,8 @@ -// some global definitions, found in debug release +/** + * @file defs.h + * + * Global definitions and Macros. + */ #define GAME_NAME "DIABLO" diff --git a/doxygen.config b/doxygen.config new file mode 100644 index 00000000..47dd195f --- /dev/null +++ b/doxygen.config @@ -0,0 +1,34 @@ +PROJECT_NAME = "Devilution" +PROJECT_BRIEF = "Diablo devolved - magic behind the 1996 computer game" +OUTPUT_DIRECTORY = docs +INPUT = ./ ./Source +INPUT_ENCODING = UTF-8 +FILE_PATTERNS = *.c \ + *.cpp \ + *.h \ + *.inc +GENERATE_LATEX = NO + +# Call graphces alows logical navigation of the docs +CALL_GRAPH = YES +CALLER_GRAPH = YES + +# all.h includes everything and everything inclues it so the graph is usless past depth 1 +MAX_DOT_GRAPH_DEPTH = 1 + +SOURCE_BROWSER = YES +EXTRACT_STATIC = YES +JAVADOC_AUTOBRIEF = YES +OPTIMIZE_OUTPUT_FOR_C = YES + +HTML_COLORSTYLE_HUE = 0 +HTML_COLORSTYLE_SAT = 125 +HTML_COLORSTYLE_GAMMA = 200 +HTML_DYNAMIC_SECTIONS = YES + +DOT_IMAGE_FORMAT = svg +INTERACTIVE_SVG = YES + +# Not all files are documented yet +EXTRACT_ALL = YES + From d6f70c56cebd53b1526a4fe181b72879f38b7846 Mon Sep 17 00:00:00 2001 From: Anders Jenbo Date: Sun, 1 Mar 2020 22:46:44 +0100 Subject: [PATCH 03/14] Format files --- Source/all.h | 182 ++++++++++++++++++++++----------------------- Source/control.cpp | 2 + Source/objdat.cpp | 2 +- Source/path.cpp | 3 +- Source/player.cpp | 2 +- resource.h | 2 +- structs.h | 40 +++++----- 7 files changed, 117 insertions(+), 116 deletions(-) diff --git a/Source/all.h b/Source/all.h index 75e22931..24693dba 100644 --- a/Source/all.h +++ b/Source/all.h @@ -1,91 +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__ */ +/** + * @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__ */ diff --git a/Source/control.cpp b/Source/control.cpp index d612b2b3..01fce584 100644 --- a/Source/control.cpp +++ b/Source/control.cpp @@ -185,6 +185,7 @@ char SpellITbl[MAX_SPELLS] = { 30, }; int PanBtnPos[8][5] = { + // clang-format off { PANEL_LEFT + 9, PANEL_TOP + 9, 71, 19, 1 }, // char button { PANEL_LEFT + 9, PANEL_TOP + 35, 71, 19, 0 }, // quests button { PANEL_LEFT + 9, PANEL_TOP + 75, 71, 19, 1 }, // map button @@ -193,6 +194,7 @@ int PanBtnPos[8][5] = { { PANEL_LEFT + 560, PANEL_TOP + 35, 71, 19, 0 }, // spells button { PANEL_LEFT + 87, PANEL_TOP + 91, 33, 32, 1 }, // chat button { PANEL_LEFT + 527, PANEL_TOP + 91, 33, 32, 1 }, // friendly fire button + // clang-format on }; char *PanBtnHotKey[8] = { "'c'", "'q'", "Tab", "Esc", "'i'", "'b'", "Enter", NULL }; char *PanBtnStr[8] = { diff --git a/Source/objdat.cpp b/Source/objdat.cpp index e61f9c4f..070be9f6 100644 --- a/Source/objdat.cpp +++ b/Source/objdat.cpp @@ -1,4 +1,4 @@ -#include "all.h" +#include "all.h" int ObjTypeConv[113] = { 0, diff --git a/Source/path.cpp b/Source/path.cpp index 0dda4826..39906fe5 100644 --- a/Source/path.cpp +++ b/Source/path.cpp @@ -66,8 +66,7 @@ int FindPath(BOOL (*PosOk)(int, int, int), int PosOkArg, int sx, int sy, int dx, // A* search until we find (dx,dy) or fail while ((next_node = GetNextPath())) { // reached the end, success! - if (next_node->x == dx && next_node->y == dy) - { + if (next_node->x == dx && next_node->y == dy) { current = next_node; path_length = 0; while (current->Parent) { diff --git a/Source/player.cpp b/Source/player.cpp index c4913c3f..c324b3a6 100644 --- a/Source/player.cpp +++ b/Source/player.cpp @@ -3076,7 +3076,7 @@ void CheckNewPath(int pnum) plr[pnum].walkpath[i - 1] = plr[pnum].walkpath[i]; } - plr[pnum].walkpath[MAX_PATH_LENGTH-1] = WALK_NONE; + plr[pnum].walkpath[MAX_PATH_LENGTH - 1] = WALK_NONE; if (plr[pnum]._pmode == PM_STAND) { StartStand(pnum, plr[pnum]._pdir); diff --git a/resource.h b/resource.h index bcfe205a..c04cac6c 100644 --- a/resource.h +++ b/resource.h @@ -16,7 +16,7 @@ #define IDD_DIALOG11 114 // READONLY // Next default values for new objects -// +// #ifdef APSTUDIO_INVOKED #ifndef APSTUDIO_READONLY_SYMBOLS #define _APS_NEXT_RESOURCE_VALUE 103 diff --git a/structs.h b/structs.h index e100ab47..0a04b459 100644 --- a/structs.h +++ b/structs.h @@ -102,7 +102,7 @@ typedef struct ItemStruct { int _iAnimFrame; int _iAnimWidth; int _iAnimWidth2; // width 2? - BOOL _iDelFlag; // set when item is flagged for deletion, deprecated in 1.02 + BOOL _iDelFlag; // set when item is flagged for deletion, deprecated in 1.02 char _iSelFlag; BOOL _iPostDraw; BOOL _iIdentified; @@ -370,8 +370,8 @@ typedef struct TextDataStruct { typedef struct MissileData { unsigned char mName; - void(* mAddProc)(int, int, int, int, int, int, char, int, int); - void(* mProc)(int); + void (*mAddProc)(int, int, int, int, int, int, char, int, int); + void (*mProc)(int); BOOL mDraw; unsigned char mType; unsigned char mResist; @@ -1002,7 +1002,7 @@ typedef struct QuestData { typedef struct TMenuItem { DWORD dwFlags; char *pszStr; - void(* fnMenu)(BOOL); /* fix, should have one arg */ + void (*fnMenu)(BOOL); /* fix, should have one arg */ } TMenuItem; // TPDEF PTR FCN VOID TMenuUpdateFcn @@ -1314,21 +1314,21 @@ typedef struct _SNETUIDATA { int size; int uiflags; HWND parentwindow; - void(* artcallback)(); - void(* authcallback)(); - void(* createcallback)(); - void(* drawdesccallback)(); - void(* selectedcallback)(); - void(* messageboxcallback)(); - void(* soundcallback)(); - void(* statuscallback)(); - void(* getdatacallback)(); - void(* categorycallback)(); - void(* categorylistcallback)(); - void(* newaccountcallback)(); - void(* profilecallback)(); + void (*artcallback)(); + void (*authcallback)(); + void (*createcallback)(); + void (*drawdesccallback)(); + void (*selectedcallback)(); + void (*messageboxcallback)(); + void (*soundcallback)(); + void (*statuscallback)(); + void (*getdatacallback)(); + void (*categorycallback)(); + void (*categorylistcallback)(); + void (*newaccountcallback)(); + void (*profilecallback)(); const char **profilefields; - void(* profilebitmapcallback)(); + void (*profilebitmapcallback)(); int(__stdcall *selectnamecallback)( const struct _SNETPROGRAMDATA *, const struct _SNETPLAYERDATA *, @@ -1338,8 +1338,8 @@ typedef struct _SNETUIDATA { char *, DWORD, /* character name will be copied here */ char *, DWORD, /* character "description" will be copied here (used to advertise games) */ BOOL * /* new character? - unsure about this */ - ); - void(* changenamecallback)(); + ); + void (*changenamecallback)(); } _SNETUIDATA; typedef struct _SNETVERSIONDATA { From 68a8f07d2bf95a60d97e52177a84fe8cf641ac62 Mon Sep 17 00:00:00 2001 From: Robin Eklind Date: Sun, 1 Mar 2020 23:33:28 +0100 Subject: [PATCH 04/14] Document BUG in SetupAllItems when recreating unique items. --- Source/items.cpp | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/Source/items.cpp b/Source/items.cpp index 230da042..8b64bffc 100644 --- a/Source/items.cpp +++ b/Source/items.cpp @@ -2078,8 +2078,13 @@ void SetupAllItems(int ii, int idx, int iseed, int lvl, int uper, int onlygood, if (item[ii]._iMagical != ITEM_QUALITY_UNIQUE) ItemRndDur(ii); } else { - if (item[ii]._iLoc != ILOC_UNEQUIPABLE) - GetUniqueItem(ii, iseed); + if (item[ii]._iLoc != ILOC_UNEQUIPABLE) { + //uid = CheckUnique(ii, iblvl, uper, recreate); + //if (uid != UITYPE_INVALID) { + // GetUniqueItem(ii, uid); + //} + GetUniqueItem(ii, iseed); // BUG: the second argument to GetUniqueItem should be uid. + } } SetupItem(ii); } From 0383f9abcdad3997012bbf4f5f73a31a8edcf093 Mon Sep 17 00:00:00 2001 From: Anders Jenbo Date: Mon, 2 Mar 2020 01:18:06 +0100 Subject: [PATCH 05/14] Add documentation to more files --- Source/automap.cpp | 2 +- Source/automap.h | 2 +- Source/gamemenu.cpp | 2 +- Source/gamemenu.h | 2 +- Source/gendung.cpp | 5 +++++ Source/gendung.h | 6 +++++- Source/gmenu.cpp | 2 +- Source/gmenu.h | 2 +- Source/help.cpp | 5 +++++ Source/help.h | 6 +++++- Source/init.cpp | 5 +++++ Source/init.h | 6 +++++- Source/interfac.cpp | 5 +++++ Source/interfac.h | 6 +++++- Source/inv.cpp | 5 +++++ Source/inv.h | 6 +++++- Source/itemdat.cpp | 5 +++++ Source/itemdat.h | 6 +++++- Source/items.cpp | 5 +++++ Source/items.h | 6 +++++- Source/loadsave.cpp | 5 +++++ Source/loadsave.h | 6 +++++- Source/logging.cpp | 5 +++++ Source/logging.h | 6 +++++- Source/mainmenu.cpp | 5 +++++ Source/mainmenu.h | 6 +++++- Source/minitext.cpp | 5 +++++ Source/minitext.h | 6 +++++- Source/misdat.cpp | 5 +++++ Source/misdat.h | 6 +++++- Source/missiles.cpp | 5 +++++ Source/missiles.h | 6 +++++- Source/monstdat.cpp | 5 +++++ Source/monstdat.h | 6 +++++- Source/movie.cpp | 5 +++++ Source/movie.h | 6 +++++- Source/mpqapi.cpp | 5 +++++ Source/mpqapi.h | 6 +++++- Source/msg.cpp | 5 +++++ Source/msg.h | 6 +++++- Source/msgcmd.cpp | 7 +++++++ Source/msgcmd.h | 8 +++++++- Source/multi.cpp | 5 +++++ Source/multi.h | 6 +++++- Source/player.cpp | 4 ++-- doxygen.config | 31 ++++++++++++++++--------------- enums.h | 6 ++++++ resource.h | 11 +++++++---- structs.h | 6 ++++++ types.h | 7 +++++-- 50 files changed, 242 insertions(+), 48 deletions(-) diff --git a/Source/automap.cpp b/Source/automap.cpp index 6f64b069..d94d87bb 100644 --- a/Source/automap.cpp +++ b/Source/automap.cpp @@ -1,7 +1,7 @@ /** * @file automap.cpp * - * Implementation of the ingame map overlay. + * Implementation of the in-game map overlay. */ #include "all.h" diff --git a/Source/automap.h b/Source/automap.h index 22ccfaa7..219b0e74 100644 --- a/Source/automap.h +++ b/Source/automap.h @@ -1,7 +1,7 @@ /** * @file automap.h * - * Interface of the ingame map overlay. + * Interface of the in-game map overlay. */ #ifndef __AUTOMAP_H__ #define __AUTOMAP_H__ diff --git a/Source/gamemenu.cpp b/Source/gamemenu.cpp index 2e385b0b..16a14434 100644 --- a/Source/gamemenu.cpp +++ b/Source/gamemenu.cpp @@ -1,7 +1,7 @@ /** * @file gamemenu.cpp * - * Implementation of the ingame menu functions. + * Implementation of the in-game menu functions. */ #include "all.h" diff --git a/Source/gamemenu.h b/Source/gamemenu.h index a6ad2f1c..55ca4c40 100644 --- a/Source/gamemenu.h +++ b/Source/gamemenu.h @@ -1,7 +1,7 @@ /** * @file gamemenu.h * - * Interface of the ingame menu functions. + * Interface of the in-game menu functions. */ #ifndef __GAMEMENU_H__ #define __GAMEMENU_H__ diff --git a/Source/gendung.cpp b/Source/gendung.cpp index 9061e1f9..2f321f70 100644 --- a/Source/gendung.cpp +++ b/Source/gendung.cpp @@ -1,3 +1,8 @@ +/** + * @file gendung.cpp + * + * Implementation of general dungeon generation code. + */ #include "all.h" WORD level_frame_types[MAXTILES]; diff --git a/Source/gendung.h b/Source/gendung.h index b423c2ab..a32db1f5 100644 --- a/Source/gendung.h +++ b/Source/gendung.h @@ -1,4 +1,8 @@ -//HEADER_GOES_HERE +/** + * @file gendung.h + * + * Interface of general dungeon generation code. + */ #ifndef __GENDUNG_H__ #define __GENDUNG_H__ diff --git a/Source/gmenu.cpp b/Source/gmenu.cpp index c13c7676..3ba56654 100644 --- a/Source/gmenu.cpp +++ b/Source/gmenu.cpp @@ -1,7 +1,7 @@ /** * @file gmenu.cpp * - * Implementation of the ingame navigation and interaction. + * Implementation of the in-game navigation and interaction. */ #include "all.h" diff --git a/Source/gmenu.h b/Source/gmenu.h index 1d0490d3..8cdb3878 100644 --- a/Source/gmenu.h +++ b/Source/gmenu.h @@ -1,7 +1,7 @@ /** * @file gmenu.h * - * Interface of the ingame navigation and interaction. + * Interface of the in-game navigation and interaction. */ #ifndef __GMENU_H__ #define __GMENU_H__ diff --git a/Source/help.cpp b/Source/help.cpp index 69b166bf..60f5ca4e 100644 --- a/Source/help.cpp +++ b/Source/help.cpp @@ -1,3 +1,8 @@ +/** + * @file help.cpp + * + * Implementation of the in-game help text. + */ #include "all.h" int help_select_line; diff --git a/Source/help.h b/Source/help.h index cb536b9b..52fb3bf3 100644 --- a/Source/help.h +++ b/Source/help.h @@ -1,4 +1,8 @@ -//HEADER_GOES_HERE +/** + * @file help.h + * + * Interface of the in-game help text. + */ #ifndef __HELP_H__ #define __HELP_H__ diff --git a/Source/init.cpp b/Source/init.cpp index d57d9138..338374fb 100644 --- a/Source/init.cpp +++ b/Source/init.cpp @@ -1,3 +1,8 @@ +/** + * @file init.cpp + * + * Implementation of routines for initializing the environment, disable screen saver, load MPQ. + */ #include "all.h" #include "../3rdParty/Storm/Source/storm.h" #include "../DiabloUI/diabloui.h" diff --git a/Source/init.h b/Source/init.h index 76809088..6867b23b 100644 --- a/Source/init.h +++ b/Source/init.h @@ -1,4 +1,8 @@ -//HEADER_GOES_HERE +/** + * @file init.h + * + * Interface of routines for initializing the environment, disable screen saver, load MPQ. + */ #ifndef __INIT_H__ #define __INIT_H__ diff --git a/Source/interfac.cpp b/Source/interfac.cpp index be837929..c5be1d43 100644 --- a/Source/interfac.cpp +++ b/Source/interfac.cpp @@ -1,3 +1,8 @@ +/** + * @file interfac.cpp + * + * Implementation of load screens. + */ #include "all.h" #include "../3rdParty/Storm/Source/storm.h" diff --git a/Source/interfac.h b/Source/interfac.h index 5049b2b1..a88a864e 100644 --- a/Source/interfac.h +++ b/Source/interfac.h @@ -1,4 +1,8 @@ -//HEADER_GOES_HERE +/** + * @file interfac.h + * + * Interface of load screens. + */ #ifndef __INTERFAC_H__ #define __INTERFAC_H__ diff --git a/Source/inv.cpp b/Source/inv.cpp index b867a154..a385832a 100644 --- a/Source/inv.cpp +++ b/Source/inv.cpp @@ -1,3 +1,8 @@ +/** + * @file inv.cpp + * + * Implementation of player inventory. + */ #include "all.h" BOOL invflag; diff --git a/Source/inv.h b/Source/inv.h index 0ef9c39c..f236172c 100644 --- a/Source/inv.h +++ b/Source/inv.h @@ -1,4 +1,8 @@ -//HEADER_GOES_HERE +/** + * @file inv.h + * + * Interface of player inventory. + */ #ifndef __INV_H__ #define __INV_H__ diff --git a/Source/itemdat.cpp b/Source/itemdat.cpp index 887ab8b7..ee9c1433 100644 --- a/Source/itemdat.cpp +++ b/Source/itemdat.cpp @@ -1,3 +1,8 @@ +/** + * @file itemdat.cpp + * + * Implementation of all item data. + */ #include "all.h" ItemDataStruct AllItemsList[] = { diff --git a/Source/itemdat.h b/Source/itemdat.h index e84ce0c9..7d038985 100644 --- a/Source/itemdat.h +++ b/Source/itemdat.h @@ -1,4 +1,8 @@ -//HEADER_GOES_HERE +/** + * @file itemdat.h + * + * Interface of all item data. + */ #ifndef __ITEMDAT_H__ #define __ITEMDAT_H__ diff --git a/Source/items.cpp b/Source/items.cpp index 230da042..da10da3d 100644 --- a/Source/items.cpp +++ b/Source/items.cpp @@ -1,3 +1,8 @@ +/** + * @file items.cpp + * + * Implementation of item functionality. + */ #include "all.h" int itemactive[MAXITEMS]; diff --git a/Source/items.h b/Source/items.h index 4440b0e8..729761e9 100644 --- a/Source/items.h +++ b/Source/items.h @@ -1,4 +1,8 @@ -//HEADER_GOES_HERE +/** + * @file items.h + * + * Interface of item functionality. + */ #ifndef __ITEMS_H__ #define __ITEMS_H__ diff --git a/Source/loadsave.cpp b/Source/loadsave.cpp index cbbf4ebc..a3dde56c 100644 --- a/Source/loadsave.cpp +++ b/Source/loadsave.cpp @@ -1,3 +1,8 @@ +/** + * @file loadsave.cpp + * + * Implementation of save game functionality. + */ #include "all.h" BYTE *tbuff; diff --git a/Source/loadsave.h b/Source/loadsave.h index 71309f5f..376d4af3 100644 --- a/Source/loadsave.h +++ b/Source/loadsave.h @@ -1,4 +1,8 @@ -//HEADER_GOES_HERE +/** + * @file loadsave.h + * + * Interface of save game functionality. + */ #ifndef __LOADSAVE_H__ #define __LOADSAVE_H__ diff --git a/Source/logging.cpp b/Source/logging.cpp index cffa639e..a3fb3043 100644 --- a/Source/logging.cpp +++ b/Source/logging.cpp @@ -1,3 +1,8 @@ +/** + * @file logging.cpp + * + * Implementation of logging functionality. + */ #include "all.h" #include "../3rdParty/Storm/Source/storm.h" diff --git a/Source/logging.h b/Source/logging.h index 13b0ec7c..b88d8e42 100644 --- a/Source/logging.h +++ b/Source/logging.h @@ -1,4 +1,8 @@ -//HEADER_GOES_HERE +/** + * @file logging.h + * + * Interface of logging functionality. + */ #ifndef __LOGGING_H__ #define __LOGGING_H__ diff --git a/Source/mainmenu.cpp b/Source/mainmenu.cpp index d9eec335..57b2f6a5 100644 --- a/Source/mainmenu.cpp +++ b/Source/mainmenu.cpp @@ -1,3 +1,8 @@ +/** + * @file mainmenu.cpp + * + * Implementation of functions for interacting with the main menu. + */ #include "all.h" #include "../3rdParty/Storm/Source/storm.h" #include "../DiabloUI/diabloui.h" diff --git a/Source/mainmenu.h b/Source/mainmenu.h index c2bc0dd6..dc0ddb34 100644 --- a/Source/mainmenu.h +++ b/Source/mainmenu.h @@ -1,4 +1,8 @@ -//HEADER_GOES_HERE +/** + * @file mainmenu.h + * + * Interface of functions for interacting with the main menu. + */ #ifndef __MAINMENU_H__ #define __MAINMENU_H__ diff --git a/Source/minitext.cpp b/Source/minitext.cpp index 4ef780a1..c89d3125 100644 --- a/Source/minitext.cpp +++ b/Source/minitext.cpp @@ -1,3 +1,8 @@ +/** + * @file minitext.cpp + * + * Implementation of scrolling dialog text. + */ #include "all.h" int qtexty; diff --git a/Source/minitext.h b/Source/minitext.h index 3be2aeea..568e51b6 100644 --- a/Source/minitext.h +++ b/Source/minitext.h @@ -1,4 +1,8 @@ -//HEADER_GOES_HERE +/** + * @file minitext.h + * + * Interface of scrolling dialog text. + */ #ifndef __MINITEXT_H__ #define __MINITEXT_H__ diff --git a/Source/misdat.cpp b/Source/misdat.cpp index 49cc1034..7f222ae5 100644 --- a/Source/misdat.cpp +++ b/Source/misdat.cpp @@ -1,3 +1,8 @@ +/** + * @file misdat.cpp + * + * Implementation of data related to missiles. + */ #include "all.h" /** Data related to each missile ID. */ diff --git a/Source/misdat.h b/Source/misdat.h index d32f8173..bab38abd 100644 --- a/Source/misdat.h +++ b/Source/misdat.h @@ -1,4 +1,8 @@ -//HEADER_GOES_HERE +/** + * @file misdat.h + * + * Interface of data related to missiles. + */ #ifndef __MISDAT_H__ #define __MISDAT_H__ diff --git a/Source/missiles.cpp b/Source/missiles.cpp index 517b2ac2..410ca94c 100644 --- a/Source/missiles.cpp +++ b/Source/missiles.cpp @@ -1,3 +1,8 @@ +/** + * @file missiles.cpp + * + * Implementation of missile functionality. + */ #include "all.h" int missileactive[MAXMISSILES]; diff --git a/Source/missiles.h b/Source/missiles.h index 64e45c1a..ddd67ec9 100644 --- a/Source/missiles.h +++ b/Source/missiles.h @@ -1,4 +1,8 @@ -//HEADER_GOES_HERE +/** + * @file missiles.h + * + * Interface of missile functionality. + */ #ifndef __MISSILES_H__ #define __MISSILES_H__ diff --git a/Source/monstdat.cpp b/Source/monstdat.cpp index c9bed996..cfb50b5c 100644 --- a/Source/monstdat.cpp +++ b/Source/monstdat.cpp @@ -1,3 +1,8 @@ +/** + * @file monstdat.cpp + * + * Implementation of all monster data. + */ #include "all.h" MonsterData monsterdata[] = { diff --git a/Source/monstdat.h b/Source/monstdat.h index 9d031269..2a4e845c 100644 --- a/Source/monstdat.h +++ b/Source/monstdat.h @@ -1,4 +1,8 @@ -//HEADER_GOES_HERE +/** + * @file monstdat.h + * + * Interface of all monster data. + */ #ifndef __MONSTDAT_H__ #define __MONSTDAT_H__ diff --git a/Source/movie.cpp b/Source/movie.cpp index 75fb4791..d9058671 100644 --- a/Source/movie.cpp +++ b/Source/movie.cpp @@ -1,3 +1,8 @@ +/** + * @file movie.cpp + * + * Implementation of video playback. + */ #include "all.h" #include "../3rdParty/Storm/Source/storm.h" diff --git a/Source/movie.h b/Source/movie.h index 03fcab32..f61ba789 100644 --- a/Source/movie.h +++ b/Source/movie.h @@ -1,4 +1,8 @@ -//HEADER_GOES_HERE +/** + * @file movie.h + * + * Interface of video playback. + */ #ifndef __MOVIE_H__ #define __MOVIE_H__ diff --git a/Source/mpqapi.cpp b/Source/mpqapi.cpp index 2bdcbfc6..6c88bff4 100644 --- a/Source/mpqapi.cpp +++ b/Source/mpqapi.cpp @@ -1,3 +1,8 @@ +/** + * @file mpqapi.cpp + * + * Implementation of functions for creating and editing MPQ files. + */ #include "all.h" #include "../3rdParty/Storm/Source/storm.h" diff --git a/Source/mpqapi.h b/Source/mpqapi.h index 9afe8fe9..ff6e6112 100644 --- a/Source/mpqapi.h +++ b/Source/mpqapi.h @@ -1,4 +1,8 @@ -//HEADER_GOES_HERE +/** + * @file mpqapi.h + * + * Interface of functions for creating and editing MPQ files. + */ #ifndef __MPQAPI_H__ #define __MPQAPI_H__ diff --git a/Source/msg.cpp b/Source/msg.cpp index 7d2a27e6..c9415318 100644 --- a/Source/msg.cpp +++ b/Source/msg.cpp @@ -1,3 +1,8 @@ +/** + * @file msg.cpp + * + * Implementation of function for sending and reciving network messages. + */ #include "all.h" #include "../3rdParty/Storm/Source/storm.h" #include "../DiabloUI/diabloui.h" diff --git a/Source/msg.h b/Source/msg.h index 3b2123f4..81d58176 100644 --- a/Source/msg.h +++ b/Source/msg.h @@ -1,4 +1,8 @@ -//HEADER_GOES_HERE +/** + * @file msg.h + * + * Interface of function for sending and reciving network messages. + */ #ifndef __MSG_H__ #define __MSG_H__ diff --git a/Source/msgcmd.cpp b/Source/msgcmd.cpp index 26bd5bbb..6cba271a 100644 --- a/Source/msgcmd.cpp +++ b/Source/msgcmd.cpp @@ -1,3 +1,10 @@ +/** + * @file msgcmd.cpp + * + * Functions for sending commands to Battle.net. + * + * See http://classic.battle.net/info/commands.shtml for a list of commands. + */ #include // for placement new #include // for offsetof #include // for typeid diff --git a/Source/msgcmd.h b/Source/msgcmd.h index be57db0f..db3b451e 100644 --- a/Source/msgcmd.h +++ b/Source/msgcmd.h @@ -1,4 +1,10 @@ -//HEADER_GOES_HERE +/** + * @file msgcmd.h + * + * Interface for sending commands to Battle.net. + * + * See http://classic.battle.net/info/commands.shtml for a list of commands. + */ #ifndef __MSGCMD_H__ #define __MSGCMD_H__ diff --git a/Source/multi.cpp b/Source/multi.cpp index 75da357f..d03d8b06 100644 --- a/Source/multi.cpp +++ b/Source/multi.cpp @@ -1,3 +1,8 @@ +/** + * @file multi.cpp + * + * Implementation of functions for keeping multiplaye games in sync. + */ #include "all.h" #include "../3rdParty/Storm/Source/storm.h" #include "../DiabloUI/diabloui.h" diff --git a/Source/multi.h b/Source/multi.h index 08c10260..73cae280 100644 --- a/Source/multi.h +++ b/Source/multi.h @@ -1,4 +1,8 @@ -//HEADER_GOES_HERE +/** + * @file multi.h + * + * Interface of functions for keeping multiplaye games in sync. + */ #ifndef __MULTI_H__ #define __MULTI_H__ diff --git a/Source/player.cpp b/Source/player.cpp index c324b3a6..befb421b 100644 --- a/Source/player.cpp +++ b/Source/player.cpp @@ -267,7 +267,7 @@ void InitPlrGFXMem(int pnum) if (GetPlrGFXSize("ST") > GetPlrGFXSize("AS")) { plr_sframe_size = GetPlrGFXSize("ST"); //TOWN } else { - plr_sframe_size = GetPlrGFXSize("AS"); //DUNGION + plr_sframe_size = GetPlrGFXSize("AS"); //DUNGEON } } plr[pnum]._pNData = DiabloAllocPtr(plr_sframe_size); @@ -277,7 +277,7 @@ void InitPlrGFXMem(int pnum) if (GetPlrGFXSize("WL") > GetPlrGFXSize("AW")) { plr_wframe_size = GetPlrGFXSize("WL"); //TOWN } else { - plr_wframe_size = GetPlrGFXSize("AW"); //DUNGION + plr_wframe_size = GetPlrGFXSize("AW"); //DUNGEON } } plr[pnum]._pWData = DiabloAllocPtr(plr_wframe_size); diff --git a/doxygen.config b/doxygen.config index 47dd195f..6e90f746 100644 --- a/doxygen.config +++ b/doxygen.config @@ -1,13 +1,27 @@ PROJECT_NAME = "Devilution" PROJECT_BRIEF = "Diablo devolved - magic behind the 1996 computer game" +USE_MDFILE_AS_MAINPAGE = README.md OUTPUT_DIRECTORY = docs -INPUT = ./ ./Source +INPUT = ./ ./Source ./docs INPUT_ENCODING = UTF-8 FILE_PATTERNS = *.c \ *.cpp \ *.h \ - *.inc + *.inc \ + *.md + GENERATE_LATEX = NO +WARNINGS = YES +SOURCE_BROWSER = YES +EXTRACT_STATIC = YES +JAVADOC_AUTOBRIEF = YES +OPTIMIZE_OUTPUT_FOR_C = YES +SEPARATE_MEMBER_PAGES = YES +DOT_IMAGE_FORMAT = svg +INTERACTIVE_SVG = YES +HTML_COLORSTYLE_HUE = 0 +HTML_COLORSTYLE_SAT = 125 +HTML_COLORSTYLE_GAMMA = 200 # Call graphces alows logical navigation of the docs CALL_GRAPH = YES @@ -16,19 +30,6 @@ CALLER_GRAPH = YES # all.h includes everything and everything inclues it so the graph is usless past depth 1 MAX_DOT_GRAPH_DEPTH = 1 -SOURCE_BROWSER = YES -EXTRACT_STATIC = YES -JAVADOC_AUTOBRIEF = YES -OPTIMIZE_OUTPUT_FOR_C = YES - -HTML_COLORSTYLE_HUE = 0 -HTML_COLORSTYLE_SAT = 125 -HTML_COLORSTYLE_GAMMA = 200 -HTML_DYNAMIC_SECTIONS = YES - -DOT_IMAGE_FORMAT = svg -INTERACTIVE_SVG = YES - # Not all files are documented yet EXTRACT_ALL = YES diff --git a/enums.h b/enums.h index f54f3f79..257cb532 100644 --- a/enums.h +++ b/enums.h @@ -1,3 +1,9 @@ +/** + * @file enums.h + * + * Various global enumerators. + */ + typedef enum item_quality { ITEM_QUALITY_NORMAL = 0, ITEM_QUALITY_MAGIC = 1, diff --git a/resource.h b/resource.h index c04cac6c..962c2838 100644 --- a/resource.h +++ b/resource.h @@ -1,7 +1,10 @@ -//{{NO_DEPENDENCIES}} -// Microsoft Developer Studio generated include file. -// Used by Diablo.rc -// +/** + * @file resource.h + * + * Microsoft Developer Studio generated include file. + * Used by Diablo.rc + */ + #define IDI_ICON1 101 #define IDD_DIALOG1 104 // DX #define IDD_DIALOG2 105 // NOMEMORY diff --git a/structs.h b/structs.h index 0a04b459..e80eccfd 100644 --- a/structs.h +++ b/structs.h @@ -1,3 +1,9 @@ +/** + * @file structs.h + * + * Various global structures. + */ + ////////////////////////////////////////////////// // control ////////////////////////////////////////////////// diff --git a/types.h b/types.h index 5b51454d..6553268d 100644 --- a/types.h +++ b/types.h @@ -1,5 +1,8 @@ -// temporary file - +/** + * @file types.h + * + * Include OS headers and set compiler state. + */ #ifndef _TYPES_H #define _TYPES_H From 3130ae35932c1e92a22d935aa0c090990fd450ae Mon Sep 17 00:00:00 2001 From: Robin Eklind Date: Sun, 8 Mar 2020 14:50:34 +0100 Subject: [PATCH 06/14] codec: fix build error of codec.cpp when compiling as C Prior to this commit, the following error was encountered when compiling as C using Clang: Source/codec.cpp:20:2: error: must use 'struct' tag to refer to type 'CodecSignature' CodecSignature *sig; ^ struct --- Source/codec.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Source/codec.cpp b/Source/codec.cpp index 1e9402b7..04f81d0f 100644 --- a/Source/codec.cpp +++ b/Source/codec.cpp @@ -5,12 +5,12 @@ */ #include "all.h" -struct CodecSignature { +typedef struct CodecSignature { DWORD checksum; BYTE error; BYTE last_chunk_size; WORD unused; -}; +} CodecSignature; int codec_decode(BYTE *pbSrcDst, DWORD size, char *pszPassword) { From f6e6b4b56fbe87a13ff323f3c52cb3a3c66ac4cc Mon Sep 17 00:00:00 2001 From: Robin Eklind Date: Sun, 8 Mar 2020 17:56:06 +0100 Subject: [PATCH 07/14] dthread: use INFINITE enum for second argument to WaitForSingleObject --- Source/dthread.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Source/dthread.cpp b/Source/dthread.cpp index 6e3e9a0b..e283d19c 100644 --- a/Source/dthread.cpp +++ b/Source/dthread.cpp @@ -93,7 +93,7 @@ unsigned int __stdcall dthread_handler(void *) DWORD dwMilliseconds; while (dthread_running) { - if (!sgpInfoHead && WaitForSingleObject(sghWorkToDoEvent, 0xFFFFFFFF) == -1) { + if (!sgpInfoHead && WaitForSingleObject(sghWorkToDoEvent, INFINITE) == -1) { error_buf = TraceLastError(); app_fatal("dthread4:\n%s", error_buf); } @@ -140,7 +140,7 @@ void dthread_cleanup() dthread_running = FALSE; SetEvent(sghWorkToDoEvent); if (sghThread != INVALID_HANDLE_VALUE && glpDThreadId != GetCurrentThreadId()) { - if (WaitForSingleObject(sghThread, 0xFFFFFFFF) == -1) { + if (WaitForSingleObject(sghThread, INFINITE) == -1) { error_buf = TraceLastError(); app_fatal("dthread3:\n(%s)", error_buf); } From dce389599eda23db61994a95fc0f71d367fd278e Mon Sep 17 00:00:00 2001 From: Robin Eklind Date: Sun, 8 Mar 2020 17:51:57 +0100 Subject: [PATCH 08/14] dthread: add parameter name to dthread_handler This fixes a build error in dthread_handler when compiling as C. Source/dthread.cpp:92:46: error: parameter name omitted unsigned int __stdcall dthread_handler(void *) ^ --- Source/dthread.cpp | 2 +- Source/dthread.h | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/Source/dthread.cpp b/Source/dthread.cpp index 6e3e9a0b..d1d49f57 100644 --- a/Source/dthread.cpp +++ b/Source/dthread.cpp @@ -86,7 +86,7 @@ void dthread_start() } } -unsigned int __stdcall dthread_handler(void *) +unsigned int __stdcall dthread_handler(void *data) { char *error_buf; TMegaPkt *pkt; diff --git a/Source/dthread.h b/Source/dthread.h index 7a9e86c9..f4dc99c6 100644 --- a/Source/dthread.h +++ b/Source/dthread.h @@ -12,7 +12,7 @@ extern BOOLEAN dthread_running; void dthread_remove_player(int pnum); void dthread_send_delta(int pnum, char cmd, void *pbSrc, int dwLen); void dthread_start(); -unsigned int __stdcall dthread_handler(void *); +unsigned int __stdcall dthread_handler(void *data); void dthread_cleanup(); /* data */ From 038666db182b5b5a012c795bbad977b7d817c199 Mon Sep 17 00:00:00 2001 From: Robin Eklind Date: Mon, 9 Mar 2020 00:24:52 +0100 Subject: [PATCH 09/14] nthread: add parameter name to nthread_handler Fixes the following error when compiling as C with Clang: Source/dthread.cpp:92:46: error: parameter name omitted unsigned int __stdcall dthread_handler(void *) ^ Related to #2017. --- Source/nthread.cpp | 2 +- Source/nthread.h | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/Source/nthread.cpp b/Source/nthread.cpp index ec5d75bd..ad7d43b2 100644 --- a/Source/nthread.cpp +++ b/Source/nthread.cpp @@ -173,7 +173,7 @@ void nthread_start(BOOL set_turn_upper_bit) } } -unsigned int __stdcall nthread_handler(void *) +unsigned int __stdcall nthread_handler(void *data) { int delta; BOOL received; diff --git a/Source/nthread.h b/Source/nthread.h index 98b50121..bcd4a187 100644 --- a/Source/nthread.h +++ b/Source/nthread.h @@ -24,7 +24,7 @@ DWORD nthread_send_and_recv_turn(DWORD cur_turn, int turn_delta); BOOL nthread_recv_turns(BOOL *pfSendAsync); void nthread_set_turn_upper_bit(); void nthread_start(BOOL set_turn_upper_bit); -unsigned int __stdcall nthread_handler(void *); +unsigned int __stdcall nthread_handler(void *data); void nthread_cleanup(); void nthread_ignore_mutex(BOOL bStart); BOOL nthread_has_500ms_passed(BOOL unused); From 71565b9c028d5e58c4c41fd04102c648dfa1dd57 Mon Sep 17 00:00:00 2001 From: galaxyhaxz Date: Wed, 11 Mar 2020 21:27:40 -0500 Subject: [PATCH 10/14] Several updates [enums+names] (#2002) * Several updates * Correct msg_get_next_packet * Update enums.h Co-Authored-By: Robin Eklind Co-authored-by: Robin Eklind --- Source/diablo.cpp | 4 +- Source/drlg_l1.cpp | 14 +- Source/drlg_l2.cpp | 16 +- Source/drlg_l3.cpp | 6 +- Source/drlg_l4.cpp | 22 +- Source/inv.cpp | 24 +- Source/items.cpp | 16 +- Source/monstdat.cpp | 16 +- Source/monster.cpp | 148 +++++----- Source/msg.cpp | 10 +- Source/msg.h | 6 +- Source/multi.cpp | 2 +- Source/objects.cpp | 114 ++++---- Source/player.cpp | 6 +- Source/quests.cpp | 274 +++++++++--------- Source/setmaps.cpp | 18 +- Source/stores.cpp | 44 +-- Source/themes.cpp | 4 +- Source/town.cpp | 2 +- Source/towners.cpp | 270 ++++++++--------- Source/trigs.cpp | 10 +- comparer-config/diablo.toml | 4 +- comparer-config/spawn.toml | 4 +- enums.h | 562 ++++++++++++++++++------------------ 24 files changed, 800 insertions(+), 796 deletions(-) diff --git a/Source/diablo.cpp b/Source/diablo.cpp index c764276d..ade09cc6 100644 --- a/Source/diablo.cpp +++ b/Source/diablo.cpp @@ -139,7 +139,7 @@ void run_game_loop(unsigned int uMsg) /// ASSERT: assert(ghMainWnd); saveProc = SetWindowProc(GM_Game); control_update_life_mana(); - msg_process_net_packets(); + run_delta_info(); gbRunGame = TRUE; gbProcessPlayers = TRUE; gbRunGameResult = TRUE; @@ -1815,7 +1815,7 @@ void LoadGameLevel(BOOL firstflag, int lvldir) ; #ifndef SPAWN - if (setlevel && setlvlnum == SL_SKELKING && quests[QTYPE_KING]._qactive == 2) + if (setlevel && setlvlnum == SL_SKELKING && quests[Q_SKELKING]._qactive == QUEST_ACTIVE) PlaySFX(USFX_SKING1); #endif } diff --git a/Source/drlg_l1.cpp b/Source/drlg_l1.cpp index 9aa56141..07f11519 100644 --- a/Source/drlg_l1.cpp +++ b/Source/drlg_l1.cpp @@ -355,8 +355,8 @@ static int DRLG_PlaceMiniSet(const BYTE *miniset, int tmin, int tmax, int cx, in DRLG_MRectTrans(sx, sy + 2, sx + 5, sy + 4); TransVal = t; - quests[QTYPE_PW]._qtx = 2 * sx + 21; - quests[QTYPE_PW]._qty = 2 * sy + 22; + quests[Q_PWATER]._qtx = 2 * sx + 21; + quests[Q_PWATER]._qty = 2 * sy + 22; } if (setview == TRUE) { @@ -487,15 +487,15 @@ static void DRLG_L1Pass3() static void DRLG_LoadL1SP() { L5setloadflag = FALSE; - if (QuestStatus(QTYPE_BUTCH)) { + if (QuestStatus(Q_BUTCHER)) { L5pSetPiece = LoadFileInMem("Levels\\L1Data\\rnd6.DUN", NULL); L5setloadflag = TRUE; } - if (QuestStatus(QTYPE_KING) && gbMaxPlayers == 1) { + if (QuestStatus(Q_SKELKING) && gbMaxPlayers == 1) { L5pSetPiece = LoadFileInMem("Levels\\L1Data\\SKngDO.DUN", NULL); L5setloadflag = TRUE; } - if (QuestStatus(QTYPE_BOL)) { + if (QuestStatus(Q_LTBANNER)) { L5pSetPiece = LoadFileInMem("Levels\\L1Data\\Banner2.DUN", NULL); L5setloadflag = TRUE; } @@ -1658,7 +1658,7 @@ static void DRLG_L5(int entry) doneflag = TRUE; - if (QuestStatus(QTYPE_PW)) { + if (QuestStatus(Q_PWATER)) { if (entry == 0) { if (DRLG_PlaceMiniSet(PWATERIN, 1, 1, 0, 0, 1, -1, 0) < 0) doneflag = FALSE; @@ -1668,7 +1668,7 @@ static void DRLG_L5(int entry) ViewY--; } } - if (QuestStatus(QTYPE_BOL)) { + if (QuestStatus(Q_LTBANNER)) { if (entry == 0) { if (DRLG_PlaceMiniSet(STAIRSUP, 1, 1, 0, 0, 1, -1, 0) < 0) doneflag = FALSE; diff --git a/Source/drlg_l2.cpp b/Source/drlg_l2.cpp index fc3ea922..a3721d55 100644 --- a/Source/drlg_l2.cpp +++ b/Source/drlg_l2.cpp @@ -470,13 +470,13 @@ static void DRLG_LoadL2SP() { setloadflag = FALSE; - if (QuestStatus(QTYPE_BLIND)) { + if (QuestStatus(Q_BLIND)) { pSetPiece = LoadFileInMem("Levels\\L2Data\\Blind2.DUN", NULL); setloadflag = TRUE; - } else if (QuestStatus(QTYPE_BLOOD)) { + } else if (QuestStatus(Q_BLOOD)) { pSetPiece = LoadFileInMem("Levels\\L2Data\\Blood1.DUN", NULL); setloadflag = TRUE; - } else if (QuestStatus(QTYPE_BONE)) { + } else if (QuestStatus(Q_SCHAMB)) { pSetPiece = LoadFileInMem("Levels\\L2Data\\Bonestr2.DUN", NULL); setloadflag = TRUE; } @@ -1383,21 +1383,21 @@ static BOOL CreateDungeon() switch (currlevel) { case 5: - if (quests[QTYPE_BLOOD]._qactive) { + if (quests[Q_BLOOD]._qactive) { ForceHW = TRUE; ForceH = 20; ForceW = 14; } break; case 6: - if (quests[QTYPE_BONE]._qactive) { + if (quests[Q_SCHAMB]._qactive) { ForceHW = TRUE; ForceW = 10; ForceH = 10; } break; case 7: - if (quests[QTYPE_BLIND]._qactive) { + if (quests[Q_BLIND]._qactive) { ForceHW = TRUE; ForceW = 15; ForceH = 15; @@ -2123,13 +2123,13 @@ void LoadPreL2Dungeon(char *sFileName, int vx, int vy) void CreateL2Dungeon(DWORD rseed, int entry) { if (gbMaxPlayers == 1) { - if (currlevel == 7 && !quests[QTYPE_BLIND]._qactive) { + if (currlevel == 7 && !quests[Q_BLIND]._qactive) { currlevel = 6; CreateL2Dungeon(glSeedTbl[6], 4); currlevel = 7; } if (currlevel == 8) { - if (!quests[QTYPE_BLIND]._qactive) { + if (!quests[Q_BLIND]._qactive) { currlevel = 6; CreateL2Dungeon(glSeedTbl[6], 4); currlevel = 8; diff --git a/Source/drlg_l3.cpp b/Source/drlg_l3.cpp index 3679c2e4..d5049f5e 100644 --- a/Source/drlg_l3.cpp +++ b/Source/drlg_l3.cpp @@ -1508,7 +1508,7 @@ static void DRLG_L3(int entry) DRLG_L3CreateBlock(x2, y1, 2, 1); DRLG_L3CreateBlock(x1, y2, 2, 2); DRLG_L3CreateBlock(x1, y1, 2, 3); - if (QuestStatus(QTYPE_ANVIL)) { + if (QuestStatus(Q_ANVIL)) { x1 = random_(0, 10) + 10; y1 = random_(0, 10) + 10; x2 = x1 + 12; @@ -1554,7 +1554,7 @@ static void DRLG_L3(int entry) } } } - if (!genok && QuestStatus(QTYPE_ANVIL)) { + if (!genok && QuestStatus(Q_ANVIL)) { genok = DRLG_L3Anvil(); } } while (genok == TRUE); @@ -1573,7 +1573,7 @@ static void DRLG_L3(int entry) FixL3HallofHeroes(); DRLG_L3River(); - if (QuestStatus(QTYPE_ANVIL)) { + if (QuestStatus(Q_ANVIL)) { dungeon[setpc_x + 7][setpc_y + 5] = 7; dungeon[setpc_x + 8][setpc_y + 5] = 7; dungeon[setpc_x + 9][setpc_y + 5] = 7; diff --git a/Source/drlg_l4.cpp b/Source/drlg_l4.cpp index f97a0be4..8a0f6a5f 100644 --- a/Source/drlg_l4.cpp +++ b/Source/drlg_l4.cpp @@ -344,7 +344,7 @@ static void InitL4Dungeon() void DRLG_LoadL4SP() { setloadflag = FALSE; - if (QuestStatus(QTYPE_WARLRD)) { + if (QuestStatus(Q_WARLORD)) { pSetPiece = LoadFileInMem("Levels\\L4Data\\Warlord.DUN", NULL); setloadflag = TRUE; } @@ -1323,11 +1323,11 @@ static void L4firstRoom() int x, y, w, h, rndx, rndy, xmin, xmax, ymin, ymax, tx, ty; if (currlevel != 16) { - if (currlevel == quests[QTYPE_WARLRD]._qlevel && quests[QTYPE_WARLRD]._qactive) { + if (currlevel == quests[Q_WARLORD]._qlevel && quests[Q_WARLORD]._qactive) { /// ASSERT: assert(gbMaxPlayers == 1); w = 11; h = 11; - } else if (currlevel == quests[QTYPE_VB]._qlevel && gbMaxPlayers != 1) { + } else if (currlevel == quests[Q_BETRAYER]._qlevel && gbMaxPlayers != 1) { w = 11; h = 11; } else { @@ -1362,7 +1362,7 @@ static void L4firstRoom() l4holdx = x; l4holdy = y; } - if (QuestStatus(QTYPE_WARLRD) || currlevel == quests[QTYPE_VB]._qlevel && gbMaxPlayers != 1) { + if (QuestStatus(Q_WARLORD) || currlevel == quests[Q_BETRAYER]._qlevel && gbMaxPlayers != 1) { SP4x1 = x + 1; SP4y1 = y + 1; SP4x2 = SP4x1 + w; @@ -1530,8 +1530,8 @@ static BOOL DRLG_L4PlaceMiniSet(const BYTE *miniset, int tmin, int tmax, int cx, } if (currlevel == 15) { - quests[QTYPE_VB]._qtx = sx + 1; - quests[QTYPE_VB]._qty = sy + 1; + quests[Q_BETRAYER]._qtx = sx + 1; + quests[Q_BETRAYER]._qty = sy + 1; } if (setview == TRUE) { ViewX = 2 * sx + 21; @@ -1747,7 +1747,7 @@ static void DRLG_L4(int entry) if (currlevel == 16) { L4SaveQuads(); } - if (QuestStatus(QTYPE_WARLRD) || currlevel == quests[QTYPE_VB]._qlevel && gbMaxPlayers != 1) { + if (QuestStatus(Q_WARLORD) || currlevel == quests[Q_BETRAYER]._qlevel && gbMaxPlayers != 1) { for (spi = SP4x1; spi < SP4x2; spi++) { for (spj = SP4y1; spj < SP4y2; spj++) { dflags[spi][spj] = 1; @@ -1763,7 +1763,7 @@ static void DRLG_L4(int entry) if (currlevel == 16) { DRLG_LoadDiabQuads(TRUE); } - if (QuestStatus(QTYPE_WARLRD)) { + if (QuestStatus(Q_WARLORD)) { if (entry == 0) { doneflag = DRLG_L4PlaceMiniSet(L4USTAIRS, 1, 1, -1, -1, 1, 0); if (doneflag && currlevel == 13) { @@ -1817,7 +1817,7 @@ static void DRLG_L4(int entry) if (entry == 0) { doneflag = DRLG_L4PlaceMiniSet(L4USTAIRS, 1, 1, -1, -1, 1, 0); if (doneflag) { - if (gbMaxPlayers == 1 && quests[QTYPE_MOD]._qactive != 2) { + if (gbMaxPlayers == 1 && quests[Q_DIABLO]._qactive != QUEST_ACTIVE) { doneflag = DRLG_L4PlaceMiniSet(L4PENTA, 1, 1, -1, -1, 0, 1); } else { doneflag = DRLG_L4PlaceMiniSet(L4PENTA2, 1, 1, -1, -1, 0, 1); @@ -1827,7 +1827,7 @@ static void DRLG_L4(int entry) } else { doneflag = DRLG_L4PlaceMiniSet(L4USTAIRS, 1, 1, -1, -1, 0, 0); if (doneflag) { - if (gbMaxPlayers == 1 && quests[QTYPE_MOD]._qactive != 2) { + if (gbMaxPlayers == 1 && quests[Q_DIABLO]._qactive != QUEST_ACTIVE) { doneflag = DRLG_L4PlaceMiniSet(L4PENTA, 1, 1, -1, -1, 1, 1); } else { doneflag = DRLG_L4PlaceMiniSet(L4PENTA2, 1, 1, -1, -1, 1, 1); @@ -1849,7 +1849,7 @@ static void DRLG_L4(int entry) DRLG_L4Subs(); DRLG_Init_Globals(); - if (QuestStatus(QTYPE_WARLRD)) { + if (QuestStatus(Q_WARLORD)) { for (j = 0; j < DMAXY; j++) { for (i = 0; i < DMAXX; i++) { pdungeon[i][j] = dungeon[i][j]; diff --git a/Source/inv.cpp b/Source/inv.cpp index a385832a..023e0ea2 100644 --- a/Source/inv.cpp +++ b/Source/inv.cpp @@ -1406,8 +1406,8 @@ void CheckBookLevel(int pnum) void CheckQuestItem(int pnum) { if (plr[pnum].HoldItem.IDidx == IDI_OPTAMULET) - quests[QTYPE_BLIND]._qactive = 3; - if (plr[pnum].HoldItem.IDidx == IDI_MUSHROOM && quests[QTYPE_BLKM]._qactive == 2 && quests[QTYPE_BLKM]._qvar1 == QS_MUSHSPAWNED) { + quests[Q_BLIND]._qactive = QUEST_DONE; + if (plr[pnum].HoldItem.IDidx == IDI_MUSHROOM && quests[Q_MUSHROOM]._qactive == QUEST_ACTIVE && quests[Q_MUSHROOM]._qvar1 == QS_MUSHSPAWNED) { #ifndef SPAWN sfxdelay = 10; if (plr[pnum]._pClass == PC_WARRIOR) { // BUGFIX: Voice for this quest might be wrong in MP @@ -1418,15 +1418,15 @@ void CheckQuestItem(int pnum) sfxdnum = PS_MAGE95; } #endif - quests[QTYPE_BLKM]._qvar1 = QS_MUSHPICKED; + quests[Q_MUSHROOM]._qvar1 = QS_MUSHPICKED; } if (plr[pnum].HoldItem.IDidx == IDI_ANVIL) { - if (quests[QTYPE_ANVIL]._qactive == 1) { - quests[QTYPE_ANVIL]._qactive = 2; - quests[QTYPE_ANVIL]._qvar1 = 1; + if (quests[Q_ANVIL]._qactive == QUEST_INIT) { + quests[Q_ANVIL]._qactive = QUEST_ACTIVE; + quests[Q_ANVIL]._qvar1 = 1; } #ifndef SPAWN - if (quests[QTYPE_ANVIL]._qlog == 1) { + if (quests[Q_ANVIL]._qlog == 1) { sfxdelay = 10; if (plr[myplr]._pClass == PC_WARRIOR) { sfxdnum = PS_WARR89; @@ -1451,12 +1451,12 @@ void CheckQuestItem(int pnum) } #endif if (plr[pnum].HoldItem.IDidx == IDI_ROCK) { - if (quests[QTYPE_INFRA]._qactive == 1) { - quests[QTYPE_INFRA]._qactive = 2; - quests[QTYPE_INFRA]._qvar1 = 1; + if (quests[Q_ROCK]._qactive == QUEST_INIT) { + quests[Q_ROCK]._qactive = QUEST_ACTIVE; + quests[Q_ROCK]._qvar1 = 1; } #ifndef SPAWN - if (quests[QTYPE_INFRA]._qlog == 1) { + if (quests[Q_ROCK]._qlog == 1) { sfxdelay = 10; if (plr[myplr]._pClass == PC_WARRIOR) { sfxdnum = PS_WARR87; @@ -1469,7 +1469,7 @@ void CheckQuestItem(int pnum) #endif } if (plr[pnum].HoldItem.IDidx == IDI_ARMOFVAL) { - quests[QTYPE_BLOOD]._qactive = 3; + quests[Q_BLOOD]._qactive = QUEST_DONE; #ifndef SPAWN sfxdelay = 20; if (plr[myplr]._pClass == PC_WARRIOR) { diff --git a/Source/items.cpp b/Source/items.cpp index 2232a904..c339265e 100644 --- a/Source/items.cpp +++ b/Source/items.cpp @@ -280,9 +280,9 @@ void InitItems() if (!setlevel) { s = GetRndSeed(); /* unused */ - if (QuestStatus(QTYPE_INFRA)) + if (QuestStatus(Q_ROCK)) SpawnRock(); - if (QuestStatus(QTYPE_ANVIL)) + if (QuestStatus(Q_ANVIL)) SpawnQuestItem(IDI_ANVIL, 2 * setpc_x + 27, 2 * setpc_y + 27, 0, 1); if (currlevel > 0 && currlevel < 16) AddInitItems(); @@ -1875,7 +1875,7 @@ int RndUItem(int m) okflag = FALSE; if (AllItemsList[i].itype == ITYPE_GOLD) okflag = FALSE; - if (AllItemsList[i].itype == ITYPE_0E) + if (AllItemsList[i].itype == ITYPE_MEAT) okflag = FALSE; if (AllItemsList[i].iMiscId == IMISC_BOOK) okflag = TRUE; @@ -2105,7 +2105,7 @@ void SpawnItem(int m, int x, int y, BOOL sendmsg) return; } onlygood = 1; - } else if (quests[QTYPE_BLKM]._qactive != 2 || quests[QTYPE_BLKM]._qvar1 != QS_MUSHGIVEN) { + } else if (quests[Q_MUSHROOM]._qactive != QUEST_ACTIVE || quests[Q_MUSHROOM]._qvar1 != QS_MUSHGIVEN) { idx = RndItem(m); if (!idx) return; @@ -2118,7 +2118,7 @@ void SpawnItem(int m, int x, int y, BOOL sendmsg) } } else { idx = IDI_BRAIN; - quests[QTYPE_BLKM]._qvar1 = QS_BRAINSPAWNED; + quests[Q_MUSHROOM]._qvar1 = QS_BRAINSPAWNED; } if (numitems < MAXITEMS) { @@ -3159,7 +3159,7 @@ void UseItem(int p, int Mid, int spl) switch (Mid) { case IMISC_HEAL: - case IMISC_HEAL_1C: + case IMISC_MEAT: j = plr[p]._pMaxHP >> 8; l = ((j >> 1) + random_(39, j)) << 6; if (plr[p]._pClass == PC_WARRIOR) @@ -3339,7 +3339,7 @@ BOOL SmithItemOk(int i) rv = FALSE; if (AllItemsList[i].itype == ITYPE_GOLD) rv = FALSE; - if (AllItemsList[i].itype == ITYPE_0E) + if (AllItemsList[i].itype == ITYPE_MEAT) rv = FALSE; if (AllItemsList[i].itype == ITYPE_STAFF) rv = FALSE; @@ -3435,7 +3435,7 @@ BOOL PremiumItemOk(int i) rv = FALSE; if (AllItemsList[i].itype == ITYPE_GOLD) rv = FALSE; - if (AllItemsList[i].itype == ITYPE_0E) + if (AllItemsList[i].itype == ITYPE_MEAT) rv = FALSE; if (AllItemsList[i].itype == ITYPE_STAFF) rv = FALSE; diff --git a/Source/monstdat.cpp b/Source/monstdat.cpp index cfb50b5c..7db551da 100644 --- a/Source/monstdat.cpp +++ b/Source/monstdat.cpp @@ -262,15 +262,15 @@ BYTE MonstAvailTbl[] = { UniqMonstStruct UniqMonst[] = { // clang-format off // mtype, mName, mTrnName, mlevel, mmaxhp, mAi, mint, mMinDamage, mMaxDamage, mMagicRes, mUnqAttr, mUnqVar1, mUnqVar2, mtalkmsg - { MT_NGOATMC, "Gharbad the Weak", "BSDB", 4, 120, AI_GARBUD, 3, 8, 16, IMUNE_LIGHTNING | IMUNE_NULL_40, 0, 0, 0, QUEST_GARBUD1 }, + { MT_NGOATMC, "Gharbad the Weak", "BSDB", 4, 120, AI_GARBUD, 3, 8, 16, IMUNE_LIGHTNING | IMUNE_NULL_40, 0, 0, 0, TEXT_GARBUD1 }, { MT_SKING, "Skeleton King", "GENRL", 0, 240, AI_SKELKING, 3, 6, 16, IMUNE_MAGIC | RESIST_FIRE | RESIST_LIGHTNING | IMUNE_NULL_40, 1, 0, 0, 0 }, - { MT_COUNSLR, "Zhar the Mad", "GENERAL", 8, 360, AI_ZHAR, 3, 16, 40, IMUNE_MAGIC | RESIST_FIRE | RESIST_LIGHTNING , 0, 0, 0, QUEST_ZHAR1 }, - { MT_BFALLSP, "Snotspill", "BNG", 4, 220, AI_SNOTSPIL, 3, 10, 18, RESIST_LIGHTNING , 0, 0, 0, QUEST_BANNER10 }, - { MT_ADVOCATE, "Arch-Bishop Lazarus", "GENERAL", 0, 600, AI_LAZURUS, 3, 30, 50, IMUNE_MAGIC | RESIST_FIRE | RESIST_LIGHTNING | IMUNE_NULL_40, 0, 0, 0, QUEST_VILE13 }, - { MT_HLSPWN, "Red Vex", "REDV", 0, 400, AI_LAZHELP, 3, 30, 50, IMUNE_MAGIC | RESIST_FIRE | IMUNE_NULL_40, 0, 0, 0, QUEST_VILE13 }, - { MT_HLSPWN, "BlackJade", "BLKJD", 0, 400, AI_LAZHELP, 3, 30, 50, IMUNE_MAGIC | RESIST_LIGHTNING | IMUNE_NULL_40, 0, 0, 0, QUEST_VILE13 }, - { MT_RBLACK, "Lachdanan", "BHKA", 14, 500, AI_LACHDAN, 3, 0, 0, 0 , 0, 0, 0, QUEST_VEIL9 }, - { MT_BTBLACK, "Warlord of Blood", "GENERAL", 13, 850, AI_WARLORD, 3, 35, 50, IMUNE_MAGIC | IMUNE_FIRE | IMUNE_LIGHTNING | IMUNE_NULL_40, 0, 0, 0, QUEST_WARLRD9 }, + { MT_COUNSLR, "Zhar the Mad", "GENERAL", 8, 360, AI_ZHAR, 3, 16, 40, IMUNE_MAGIC | RESIST_FIRE | RESIST_LIGHTNING , 0, 0, 0, TEXT_ZHAR1 }, + { MT_BFALLSP, "Snotspill", "BNG", 4, 220, AI_SNOTSPIL, 3, 10, 18, RESIST_LIGHTNING , 0, 0, 0, TEXT_BANNER10 }, + { MT_ADVOCATE, "Arch-Bishop Lazarus", "GENERAL", 0, 600, AI_LAZURUS, 3, 30, 50, IMUNE_MAGIC | RESIST_FIRE | RESIST_LIGHTNING | IMUNE_NULL_40, 0, 0, 0, TEXT_VILE13 }, + { MT_HLSPWN, "Red Vex", "REDV", 0, 400, AI_LAZHELP, 3, 30, 50, IMUNE_MAGIC | RESIST_FIRE | IMUNE_NULL_40, 0, 0, 0, TEXT_VILE13 }, + { MT_HLSPWN, "BlackJade", "BLKJD", 0, 400, AI_LAZHELP, 3, 30, 50, IMUNE_MAGIC | RESIST_LIGHTNING | IMUNE_NULL_40, 0, 0, 0, TEXT_VILE13 }, + { MT_RBLACK, "Lachdanan", "BHKA", 14, 500, AI_LACHDAN, 3, 0, 0, 0 , 0, 0, 0, TEXT_VEIL9 }, + { MT_BTBLACK, "Warlord of Blood", "GENERAL", 13, 850, AI_WARLORD, 3, 35, 50, IMUNE_MAGIC | IMUNE_FIRE | IMUNE_LIGHTNING | IMUNE_NULL_40, 0, 0, 0, TEXT_WARLRD9 }, { MT_CLEAVER, "The Butcher", "GENRL", 0, 220, AI_CLEAVER, 3, 6, 12, RESIST_FIRE | RESIST_LIGHTNING | IMUNE_NULL_40, 0, 0, 0, 0 }, { MT_TSKELAX, "Bonehead Keenaxe", "BHKA", 2, 91, AI_SKELSD, 2, 4, 10, IMUNE_MAGIC | IMUNE_NULL_40, 7, 100, 0, 0 }, { MT_RFALLSD, "Bladeskin the Slasher", "BSTS", 2, 51, AI_FALLEN, 0, 6, 18, RESIST_FIRE , 11, 45, 0, 0 }, diff --git a/Source/monster.cpp b/Source/monster.cpp index cf1e1ac9..42503a00 100644 --- a/Source/monster.cpp +++ b/Source/monster.cpp @@ -203,20 +203,20 @@ void GetLevelMTypes() } if (!setlevel) { - if (QuestStatus(QTYPE_BUTCH)) + if (QuestStatus(Q_BUTCHER)) AddMonsterType(MT_CLEAVER, 2); - if (QuestStatus(QTYPE_GARB)) + if (QuestStatus(Q_GARBUD)) AddMonsterType(UniqMonst[UMT_GARBUD].mtype, 4); - if (QuestStatus(QTYPE_ZHAR)) + if (QuestStatus(Q_ZHAR)) AddMonsterType(UniqMonst[UMT_ZHAR].mtype, 4); - if (QuestStatus(QTYPE_BOL)) + if (QuestStatus(Q_LTBANNER)) AddMonsterType(UniqMonst[UMT_SNOTSPIL].mtype, 4); - if (QuestStatus(QTYPE_VEIL)) + if (QuestStatus(Q_VEIL)) AddMonsterType(UniqMonst[UMT_LACHDAN].mtype, 4); - if (QuestStatus(QTYPE_WARLRD)) + if (QuestStatus(Q_WARLORD)) AddMonsterType(UniqMonst[UMT_WARLORD].mtype, 4); - if (gbMaxPlayers != 1 && currlevel == quests[QTYPE_KING]._qlevel) { + if (gbMaxPlayers != 1 && currlevel == quests[Q_SKELKING]._qlevel) { AddMonsterType(MT_SKING, 4); @@ -698,7 +698,7 @@ void PlaceUniqueMonst(int uniqindex, int miniontype, int unpackfilesize) Monst->mtalkmsg = 0; } - if (Monst->_mAi != AI_LAZURUS || quests[QTYPE_VB]._qvar1 <= 3) { + if (Monst->_mAi != AI_LAZURUS || quests[Q_BETRAYER]._qvar1 <= 3) { if (Monst->mtalkmsg) { Monst->_mgoal = MGOAL_INQUIRING; } @@ -762,11 +762,11 @@ void PlaceQuestMonsters() BYTE *setp; if (!setlevel) { - if (QuestStatus(QTYPE_BUTCH)) { + if (QuestStatus(Q_BUTCHER)) { PlaceUniqueMonst(UMT_BUTCHER, 0, 0); } - if (currlevel == quests[QTYPE_KING]._qlevel && gbMaxPlayers != 1) { + if (currlevel == quests[Q_SKELKING]._qlevel && gbMaxPlayers != 1) { skeltype = 0; for (skeltype = 0; skeltype < nummtypes; skeltype++) { @@ -778,40 +778,40 @@ void PlaceQuestMonsters() PlaceUniqueMonst(UMT_SKELKING, skeltype, 30); } - if (QuestStatus(QTYPE_BOL)) { + if (QuestStatus(Q_LTBANNER)) { setp = LoadFileInMem("Levels\\L1Data\\Banner1.DUN", NULL); SetMapMonsters(setp, 2 * setpc_x, 2 * setpc_y); mem_free_dbg(setp); } - if (QuestStatus(QTYPE_BLOOD)) { + if (QuestStatus(Q_BLOOD)) { setp = LoadFileInMem("Levels\\L2Data\\Blood2.DUN", NULL); SetMapMonsters(setp, 2 * setpc_x, 2 * setpc_y); mem_free_dbg(setp); } - if (QuestStatus(QTYPE_BLIND)) { + if (QuestStatus(Q_BLIND)) { setp = LoadFileInMem("Levels\\L2Data\\Blind2.DUN", NULL); SetMapMonsters(setp, 2 * setpc_x, 2 * setpc_y); mem_free_dbg(setp); } - if (QuestStatus(QTYPE_ANVIL)) { + if (QuestStatus(Q_ANVIL)) { setp = LoadFileInMem("Levels\\L3Data\\Anvil.DUN", NULL); SetMapMonsters(setp, 2 * setpc_x + 2, 2 * setpc_y + 2); mem_free_dbg(setp); } - if (QuestStatus(QTYPE_WARLRD)) { + if (QuestStatus(Q_WARLORD)) { setp = LoadFileInMem("Levels\\L4Data\\Warlord.DUN", NULL); SetMapMonsters(setp, 2 * setpc_x, 2 * setpc_y); mem_free_dbg(setp); AddMonsterType(UniqMonst[UMT_WARLORD].mtype, 1); } - if (QuestStatus(QTYPE_VEIL)) { + if (QuestStatus(Q_VEIL)) { AddMonsterType(UniqMonst[UMT_LACHDAN].mtype, 1); } - if (QuestStatus(QTYPE_ZHAR) && zharlib == -1) { - quests[QTYPE_ZHAR]._qactive = 0; + if (QuestStatus(Q_ZHAR) && zharlib == -1) { + quests[Q_ZHAR]._qactive = QUEST_NOTAVAIL; } - if (currlevel == quests[QTYPE_VB]._qlevel && gbMaxPlayers != 1) { + if (currlevel == quests[Q_BETRAYER]._qlevel && gbMaxPlayers != 1) { AddMonsterType(UniqMonst[UMT_LAZURUS].mtype, 4); AddMonsterType(UniqMonst[UMT_RED_VEX].mtype, 4); PlaceUniqueMonst(UMT_LAZURUS, 0, 0); @@ -1009,15 +1009,15 @@ void PlaceUniques() done = (Monsters[mt].mtype == UniqMonst[u].mtype); } mt--; - if (u == UMT_GARBUD && quests[QTYPE_GARB]._qactive == 0) + if (u == UMT_GARBUD && quests[Q_GARBUD]._qactive == QUEST_NOTAVAIL) done = FALSE; - if (u == UMT_ZHAR && quests[QTYPE_ZHAR]._qactive == 0) + if (u == UMT_ZHAR && quests[Q_ZHAR]._qactive == QUEST_NOTAVAIL) done = FALSE; - if (u == UMT_SNOTSPIL && quests[QTYPE_BOL]._qactive == 0) + if (u == UMT_SNOTSPIL && quests[Q_LTBANNER]._qactive == QUEST_NOTAVAIL) done = FALSE; - if (u == UMT_LACHDAN && quests[QTYPE_VEIL]._qactive == 0) + if (u == UMT_LACHDAN && quests[Q_VEIL]._qactive == QUEST_NOTAVAIL) done = FALSE; - if (u == UMT_WARLORD && quests[QTYPE_WARLRD]._qactive == 0) + if (u == UMT_WARLORD && quests[Q_WARLORD]._qactive == QUEST_NOTAVAIL) done = FALSE; if (done) PlaceUniqueMonst(u, mt, 8); @@ -1541,9 +1541,9 @@ void M_DiabloDeath(int i, BOOL sendmsg) #ifndef SPAWN PlaySFX(USFX_DIABLOD); #endif - quests[QTYPE_MOD]._qactive = 3; + quests[Q_DIABLO]._qactive = QUEST_DONE; if (sendmsg) - NetSendCmdQuest(TRUE, QTYPE_MOD); + NetSendCmdQuest(TRUE, Q_DIABLO); gbProcessPlayers = FALSE; sgbSaveSoundOn = gbSoundOn; for (j = 0; j < nummonsters; j++) { @@ -1647,7 +1647,7 @@ void MonstStartKill(int i, int pnum, BOOL sendmsg) monstkills[monster[i].MType->mtype]++; monster[i]._mhitpoints = 0; SetRndSeed(monster[i]._mRndSeed); - if (QuestStatus(QTYPE_GARB) && monster[i].mName == UniqMonst[UMT_GARBUD].mName) { + if (QuestStatus(Q_GARBUD) && monster[i].mName == UniqMonst[UMT_GARBUD].mName) { CreateTypeItem(monster[i]._mx + 1, monster[i]._my + 1, TRUE, ITYPE_MACE, IMISC_NONE, TRUE, FALSE); } else if (i > MAX_PLRS - 1) { // Golems should not spawn items SpawnItem(i, monster[i]._mx, monster[i]._my, sendmsg); @@ -2388,55 +2388,55 @@ int M_DoTalk(int i) return FALSE; InitQTextMsg(Monst->mtalkmsg); if (Monst->mName == UniqMonst[UMT_GARBUD].mName) { - if (Monst->mtalkmsg == QUEST_GARBUD1) - quests[QTYPE_GARB]._qactive = 2; - quests[QTYPE_GARB]._qlog = TRUE; - if (Monst->mtalkmsg == QUEST_GARBUD2 && !(Monst->_mFlags & MFLAG_QUEST_COMPLETE)) { + if (Monst->mtalkmsg == TEXT_GARBUD1) + quests[Q_GARBUD]._qactive = QUEST_ACTIVE; + quests[Q_GARBUD]._qlog = TRUE; + if (Monst->mtalkmsg == TEXT_GARBUD2 && !(Monst->_mFlags & MFLAG_QUEST_COMPLETE)) { SpawnItem(i, Monst->_mx + 1, Monst->_my + 1, TRUE); Monst->_mFlags |= MFLAG_QUEST_COMPLETE; } } if (Monst->mName == UniqMonst[UMT_ZHAR].mName - && Monst->mtalkmsg == QUEST_ZHAR1 + && Monst->mtalkmsg == TEXT_ZHAR1 && !(Monst->_mFlags & MFLAG_QUEST_COMPLETE)) { - quests[QTYPE_ZHAR]._qactive = 2; - quests[QTYPE_ZHAR]._qlog = TRUE; + quests[Q_ZHAR]._qactive = QUEST_ACTIVE; + quests[Q_ZHAR]._qlog = TRUE; CreateTypeItem(Monst->_mx + 1, Monst->_my + 1, FALSE, ITYPE_MISC, IMISC_BOOK, TRUE, FALSE); Monst->_mFlags |= MFLAG_QUEST_COMPLETE; } if (Monst->mName == UniqMonst[UMT_SNOTSPIL].mName) { - if (Monst->mtalkmsg == QUEST_BANNER10 && !(Monst->_mFlags & MFLAG_QUEST_COMPLETE)) { + if (Monst->mtalkmsg == TEXT_BANNER10 && !(Monst->_mFlags & MFLAG_QUEST_COMPLETE)) { ObjChangeMap(setpc_x, setpc_y, (setpc_w >> 1) + setpc_x + 2, (setpc_h >> 1) + setpc_y - 2); tren = TransVal; TransVal = 9; DRLG_MRectTrans(setpc_x, setpc_y, (setpc_w >> 1) + setpc_x + 4, setpc_y + (setpc_h >> 1)); TransVal = tren; - quests[QTYPE_BOL]._qvar1 = 2; - if (quests[QTYPE_BOL]._qactive == 1) - quests[QTYPE_BOL]._qactive = 2; + quests[Q_LTBANNER]._qvar1 = 2; + if (quests[Q_LTBANNER]._qactive == QUEST_INIT) + quests[Q_LTBANNER]._qactive = QUEST_ACTIVE; Monst->_mFlags |= MFLAG_QUEST_COMPLETE; } - if (quests[QTYPE_BOL]._qvar1 < 2) { + if (quests[Q_LTBANNER]._qvar1 < 2) { sprintf(tempstr, "SS Talk = %i, Flags = %i", Monst->mtalkmsg, Monst->_mFlags); app_fatal(tempstr); } } if (Monst->mName == UniqMonst[UMT_LACHDAN].mName) { - if (Monst->mtalkmsg == QUEST_VEIL9) { - quests[QTYPE_VEIL]._qactive = 2; - quests[QTYPE_VEIL]._qlog = TRUE; + if (Monst->mtalkmsg == TEXT_VEIL9) { + quests[Q_VEIL]._qactive = QUEST_ACTIVE; + quests[Q_VEIL]._qlog = TRUE; } - if (Monst->mtalkmsg == QUEST_VEIL11 && !(Monst->_mFlags & MFLAG_QUEST_COMPLETE)) { + if (Monst->mtalkmsg == TEXT_VEIL11 && !(Monst->_mFlags & MFLAG_QUEST_COMPLETE)) { SpawnUnique(UITEM_STEELVEIL, Monst->_mx + 1, Monst->_my + 1); Monst->_mFlags |= MFLAG_QUEST_COMPLETE; } } if (Monst->mName == UniqMonst[UMT_WARLORD].mName) - quests[QTYPE_WARLRD]._qvar1 = 2; + quests[Q_WARLORD]._qvar1 = 2; if (Monst->mName == UniqMonst[UMT_LAZURUS].mName && gbMaxPlayers != 1) { Monst->_msquelch = UCHAR_MAX; Monst->mtalkmsg = 0; - quests[QTYPE_VB]._qvar1 = 6; + quests[Q_BETRAYER]._qvar1 = 6; Monst->_mgoal = MGOAL_NORMAL; } return FALSE; @@ -4196,8 +4196,8 @@ void MAI_Garbud(int i) _my = Monst->_my; md = M_GetDir(i); - if (Monst->mtalkmsg < QUEST_GARBUD4 - && Monst->mtalkmsg > QUEST_DOOM10 + if (Monst->mtalkmsg < TEXT_GARBUD4 + && Monst->mtalkmsg > TEXT_DOOM10 && !(dFlags[_mx][_my] & BFLAG_VISIBLE) && Monst->_mgoal == MGOAL_TALKING) { Monst->_mgoal = MGOAL_INQUIRING; @@ -4206,7 +4206,7 @@ void MAI_Garbud(int i) if (dFlags[_mx][_my] & BFLAG_VISIBLE) { #ifndef SPAWN - if (Monst->mtalkmsg == QUEST_GARBUD4) { + if (Monst->mtalkmsg == TEXT_GARBUD4) { if (!effect_is_playing(USFX_GARBUD4) && Monst->_mgoal == MGOAL_TALKING) { Monst->_mgoal = MGOAL_NORMAL; Monst->_msquelch = UCHAR_MAX; @@ -4241,8 +4241,8 @@ void MAI_Zhar(int i) mx = Monst->_mx; my = Monst->_my; md = M_GetDir(i); - if (Monst->mtalkmsg == QUEST_ZHAR1 && !(dFlags[mx][my] & BFLAG_VISIBLE) && Monst->_mgoal == MGOAL_TALKING) { - Monst->mtalkmsg = QUEST_ZHAR2; + if (Monst->mtalkmsg == TEXT_ZHAR1 && !(dFlags[mx][my] & BFLAG_VISIBLE) && Monst->_mgoal == MGOAL_TALKING) { + Monst->mtalkmsg = TEXT_ZHAR2; Monst->_mgoal = MGOAL_INQUIRING; } @@ -4254,7 +4254,7 @@ void MAI_Zhar(int i) else abs(_my); #ifndef SPAWN - if (Monst->mtalkmsg == QUEST_ZHAR2) { + if (Monst->mtalkmsg == TEXT_ZHAR2) { if (!effect_is_playing(USFX_ZHAR2) && Monst->_mgoal == MGOAL_TALKING) { Monst->_msquelch = UCHAR_MAX; Monst->mtalkmsg = 0; @@ -4290,22 +4290,22 @@ void MAI_SnotSpil(int i) my = Monst->_my; md = M_GetDir(i); - if (Monst->mtalkmsg == QUEST_BANNER10 && !(dFlags[mx][my] & BFLAG_VISIBLE) && Monst->_mgoal == MGOAL_TALKING) { - Monst->mtalkmsg = QUEST_BANNER11; + if (Monst->mtalkmsg == TEXT_BANNER10 && !(dFlags[mx][my] & BFLAG_VISIBLE) && Monst->_mgoal == MGOAL_TALKING) { + Monst->mtalkmsg = TEXT_BANNER11; Monst->_mgoal = MGOAL_INQUIRING; } - if (Monst->mtalkmsg == QUEST_BANNER11 && quests[QTYPE_BOL]._qvar1 == 3) { + if (Monst->mtalkmsg == TEXT_BANNER11 && quests[Q_LTBANNER]._qvar1 == 3) { Monst->mtalkmsg = 0; Monst->_mgoal = MGOAL_NORMAL; } if (dFlags[mx][my] & BFLAG_VISIBLE) { #ifndef SPAWN - if (Monst->mtalkmsg == QUEST_BANNER12) { + if (Monst->mtalkmsg == TEXT_BANNER12) { if (!effect_is_playing(USFX_SNOT3) && Monst->_mgoal == MGOAL_TALKING) { ObjChangeMap(setpc_x, setpc_y, setpc_x + setpc_w + 1, setpc_y + setpc_h + 1); - quests[QTYPE_BOL]._qvar1 = 3; + quests[Q_LTBANNER]._qvar1 = 3; RedoPlayerVision(); Monst->_msquelch = UCHAR_MAX; Monst->mtalkmsg = 0; @@ -4313,7 +4313,7 @@ void MAI_SnotSpil(int i) } } #endif - if (quests[QTYPE_BOL]._qvar1 == 3) { + if (quests[Q_LTBANNER]._qvar1 == 3) { if (Monst->_mgoal == MGOAL_NORMAL || Monst->_mgoal == MGOAL_SHOOT) MAI_Fallen(i); } @@ -4343,25 +4343,25 @@ void MAI_Lazurus(int i) md = M_GetDir(i); if (dFlags[mx][my] & BFLAG_VISIBLE) { if (gbMaxPlayers == 1) { - if (Monst->mtalkmsg == QUEST_VILE13 && Monst->_mgoal == MGOAL_INQUIRING && plr[myplr].WorldX == QUEST_VILE13 && plr[myplr].WorldY == 46) { + if (Monst->mtalkmsg == TEXT_VILE13 && Monst->_mgoal == MGOAL_INQUIRING && plr[myplr].WorldX == TEXT_VILE13 && plr[myplr].WorldY == 46) { PlayInGameMovie("gendata\\fprst3.smk"); Monst->_mmode = MM_TALK; - quests[QTYPE_VB]._qvar1 = 5; + quests[Q_BETRAYER]._qvar1 = 5; } #ifndef SPAWN - if (Monst->mtalkmsg == QUEST_VILE13 && !effect_is_playing(USFX_LAZ1) && Monst->_mgoal == MGOAL_TALKING) { + if (Monst->mtalkmsg == TEXT_VILE13 && !effect_is_playing(USFX_LAZ1) && Monst->_mgoal == MGOAL_TALKING) { ObjChangeMapResync(1, 18, 20, 24); RedoPlayerVision(); Monst->_msquelch = UCHAR_MAX; Monst->mtalkmsg = 0; - quests[QTYPE_VB]._qvar1 = 6; + quests[Q_BETRAYER]._qvar1 = 6; Monst->_mgoal = MGOAL_NORMAL; } #endif } - if (gbMaxPlayers != 1 && Monst->mtalkmsg == QUEST_VILE13 && Monst->_mgoal == MGOAL_INQUIRING && quests[QTYPE_VB]._qvar1 <= 3) { + if (gbMaxPlayers != 1 && Monst->mtalkmsg == TEXT_VILE13 && Monst->_mgoal == MGOAL_INQUIRING && quests[Q_BETRAYER]._qvar1 <= 3) { Monst->_mmode = MM_TALK; } } @@ -4395,7 +4395,7 @@ void MAI_Lazhelp(int i) if (dFlags[_mx][_my] & BFLAG_VISIBLE) { if (gbMaxPlayers == 1) { - if (quests[QTYPE_VB]._qvar1 <= 5) { + if (quests[Q_BETRAYER]._qvar1 <= 5) { Monst->_mgoal = MGOAL_INQUIRING; } else { Monst->mtalkmsg = 0; @@ -4428,16 +4428,16 @@ void MAI_Lachdanan(int i) _my = Monst->_my; md = M_GetDir(i); #ifndef SPAWN - if (Monst->mtalkmsg == QUEST_VEIL9 && !(dFlags[_mx][_my] & BFLAG_VISIBLE) && monster[i]._mgoal == MGOAL_TALKING) { - Monst->mtalkmsg = QUEST_VEIL10; + if (Monst->mtalkmsg == TEXT_VEIL9 && !(dFlags[_mx][_my] & BFLAG_VISIBLE) && monster[i]._mgoal == MGOAL_TALKING) { + Monst->mtalkmsg = TEXT_VEIL10; monster[i]._mgoal = MGOAL_INQUIRING; } if (dFlags[_mx][_my] & BFLAG_VISIBLE) { - if (Monst->mtalkmsg == QUEST_VEIL11) { + if (Monst->mtalkmsg == TEXT_VEIL11) { if (!effect_is_playing(USFX_LACH3) && Monst->_mgoal == MGOAL_TALKING) { Monst->mtalkmsg = 0; - quests[QTYPE_VEIL]._qactive = 3; + quests[Q_VEIL]._qactive = QUEST_DONE; M_StartKill(i, -1); } } @@ -4467,10 +4467,10 @@ void MAI_Warlord(int i) my = Monst->_my; md = M_GetDir(i); if (dFlags[mx][my] & BFLAG_VISIBLE) { - if (Monst->mtalkmsg == QUEST_WARLRD9 && Monst->_mgoal == MGOAL_INQUIRING) + if (Monst->mtalkmsg == TEXT_WARLRD9 && Monst->_mgoal == MGOAL_INQUIRING) Monst->_mmode = MM_TALK; #ifndef SPAWN - if (Monst->mtalkmsg == QUEST_WARLRD9 && !effect_is_playing(USFX_WARLRD1) && Monst->_mgoal == MGOAL_TALKING) { + if (Monst->mtalkmsg == TEXT_WARLRD9 && !effect_is_playing(USFX_WARLRD1) && Monst->_mgoal == MGOAL_TALKING) { Monst->_msquelch = UCHAR_MAX; Monst->mtalkmsg = 0; Monst->_mgoal = MGOAL_NORMAL; @@ -5441,16 +5441,16 @@ void TalktoMonster(int i) pnum = Monst->_menemy; Monst->_mmode = MM_TALK; if (Monst->_mAi == AI_SNOTSPIL || Monst->_mAi == AI_LACHDAN) { - if (QuestStatus(QTYPE_BOL) && quests[QTYPE_BOL]._qvar1 == 2 && PlrHasItem(pnum, IDI_BANNER, itm)) { + if (QuestStatus(Q_LTBANNER) && quests[Q_LTBANNER]._qvar1 == 2 && PlrHasItem(pnum, IDI_BANNER, itm)) { RemoveInvItem(pnum, itm); - quests[QTYPE_BOL]._qactive = 3; - Monst->mtalkmsg = QUEST_BANNER12; + quests[Q_LTBANNER]._qactive = QUEST_DONE; + Monst->mtalkmsg = TEXT_BANNER12; Monst->_mgoal = MGOAL_INQUIRING; } - if (QuestStatus(QTYPE_VEIL) && Monst->mtalkmsg >= QUEST_VEIL9) { + if (QuestStatus(Q_VEIL) && Monst->mtalkmsg >= TEXT_VEIL9) { if (PlrHasItem(pnum, IDI_GLDNELIX, itm)) { RemoveInvItem(pnum, itm); - Monst->mtalkmsg = QUEST_VEIL11; + Monst->mtalkmsg = TEXT_VEIL11; Monst->_mgoal = MGOAL_INQUIRING; } } diff --git a/Source/msg.cpp b/Source/msg.cpp index c9415318..3b95bc1c 100644 --- a/Source/msg.cpp +++ b/Source/msg.cpp @@ -54,7 +54,7 @@ void msg_send_packet(int pnum, const void *packet, DWORD dwSize) sgpCurrPkt->dwSpaceLeft -= dwSize; } -TMegaPkt *msg_get_next_packet() +void msg_get_next_packet() { TMegaPkt *result; @@ -67,8 +67,6 @@ TMegaPkt *msg_get_next_packet() result = result->pNext; } result->pNext = sgpCurrPkt; - - return result; } BOOL msg_wait_resync() @@ -145,7 +143,7 @@ int msg_wait_for_turns() return 100 * sgbDeltaChunks / 21; } -void msg_process_net_packets() +void run_delta_info() { if (gbMaxPlayers != 1) { gbBufferMsgs = 2; @@ -973,7 +971,7 @@ void NetSendCmdString(int pmask, const char *pszStr) multi_send_msg_packet(pmask, (BYTE *)&cmd.bCmd, dwStrLen + 2); } -void RemovePlrPortal(int pnum) +void delta_close_portal(int pnum) { memset(&sgJunk.portal[pnum], 0xFF, sizeof(sgJunk.portal[pnum])); sgbDeltaChanged = TRUE; @@ -2429,7 +2427,7 @@ DWORD On_DEACTIVATEPORTAL(TCmd *pCmd, int pnum) if (PortalOnLevel(pnum)) RemovePortalMissile(pnum); DeactivatePortal(pnum); - RemovePlrPortal(pnum); + delta_close_portal(pnum); } return sizeof(*pCmd); diff --git a/Source/msg.h b/Source/msg.h index 81d58176..611933ab 100644 --- a/Source/msg.h +++ b/Source/msg.h @@ -12,11 +12,11 @@ extern int pkt_counter; void msg_send_drop_pkt(int pnum, int reason); void msg_send_packet(int pnum, const void *packet, DWORD dwSize); -TMegaPkt *msg_get_next_packet(); +void msg_get_next_packet(); BOOL msg_wait_resync(); void msg_free_packets(); int msg_wait_for_turns(); -void msg_process_net_packets(); +void run_delta_info(); void msg_pre_packet(); void DeltaExportData(int pnum); BYTE *DeltaExportItem(BYTE *dst, TCmdPItem *src); @@ -55,7 +55,7 @@ void NetSendCmdDelItem(BOOL bHiPri, BYTE bLoc); void NetSendCmdDItem(BOOL bHiPri, int ii); void NetSendCmdDamage(BOOL bHiPri, BYTE bPlr, DWORD dwDam); void NetSendCmdString(int pmask, const char *pszStr); -void RemovePlrPortal(int pnum); +void delta_close_portal(int pnum); DWORD ParseCmd(int pnum, TCmd *pCmd); DWORD On_DLEVEL(int pnum, TCmd *pCmd); void DeltaImportData(BYTE cmd, DWORD recv_offset); diff --git a/Source/multi.cpp b/Source/multi.cpp index d03d8b06..a5752229 100644 --- a/Source/multi.cpp +++ b/Source/multi.cpp @@ -277,7 +277,7 @@ void multi_player_left_msg(int pnum, int left) RemovePlrFromMap(pnum); RemovePortalMissile(pnum); DeactivatePortal(pnum); - RemovePlrPortal(pnum); + delta_close_portal(pnum); RemovePlrMissiles(pnum); if (left) { pszFmt = "Player '%s' just left the game"; diff --git a/Source/objects.cpp b/Source/objects.cpp index 5f3c8126..c9e094eb 100644 --- a/Source/objects.cpp +++ b/Source/objects.cpp @@ -70,9 +70,9 @@ char *StoryBookName[9] = { "The Black King" }; int StoryText[3][3] = { - { QUEST_BOOK11, QUEST_BOOK12, QUEST_BOOK13 }, - { QUEST_BOOK21, QUEST_BOOK22, QUEST_BOOK23 }, - { QUEST_BOOK31, QUEST_BOOK32, QUEST_BOOK33 } + { TEXT_BOOK11, TEXT_BOOK12, TEXT_BOOK13 }, + { TEXT_BOOK21, TEXT_BOOK22, TEXT_BOOK23 }, + { TEXT_BOOK31, TEXT_BOOK32, TEXT_BOOK33 } }; void InitObjectGFX() @@ -276,8 +276,8 @@ void AddCandles() { int tx, ty; - tx = quests[QTYPE_PW]._qtx; - ty = quests[QTYPE_PW]._qty; + tx = quests[Q_PWATER]._qtx; + ty = quests[Q_PWATER]._qty; AddObject(OBJ_STORYCANDLE, tx - 2, ty + 1); AddObject(OBJ_STORYCANDLE, tx + 3, ty + 1); AddObject(OBJ_STORYCANDLE, tx - 1, ty + 2); @@ -307,11 +307,11 @@ void AddBookLever(int lx1, int ly1, int lx2, int ly2, int x1, int y1, int x2, in return; } - if (QuestStatus(QTYPE_BLIND)) + if (QuestStatus(Q_BLIND)) AddObject(OBJ_BLINDBOOK, xp, yp); - if (QuestStatus(QTYPE_WARLRD)) + if (QuestStatus(Q_WARLORD)) AddObject(OBJ_STEELTOME, xp, yp); - if (QuestStatus(QTYPE_BLOOD)) { + if (QuestStatus(Q_BLOOD)) { xp = 2 * setpc_x + 25; yp = 2 * setpc_y + 40; AddObject(OBJ_BLOODBOOK, xp, yp); @@ -751,7 +751,7 @@ void InitObjects() GetRndSeed(); if (currlevel == 9 && gbMaxPlayers == 1) AddSlainHero(); - if (currlevel == quests[QTYPE_BLKM]._qlevel && quests[QTYPE_BLKM]._qactive == 1) + if (currlevel == quests[Q_MUSHROOM]._qlevel && quests[Q_MUSHROOM]._qactive == QUEST_INIT) AddMushPatch(); if (currlevel == 4) AddStoryBooks(); @@ -760,46 +760,46 @@ void InitObjects() if (currlevel == 12) AddStoryBooks(); if (leveltype == DTYPE_CATHEDRAL) { - if (QuestStatus(QTYPE_BUTCH)) + if (QuestStatus(Q_BUTCHER)) AddTortures(); - if (QuestStatus(QTYPE_PW)) + if (QuestStatus(Q_PWATER)) AddCandles(); - if (QuestStatus(QTYPE_BOL)) + if (QuestStatus(Q_LTBANNER)) AddObject(OBJ_SIGNCHEST, 2 * setpc_x + 26, 2 * setpc_y + 19); InitRndLocBigObj(10, 15, OBJ_SARC); AddL1Objs(0, 0, MAXDUNX, MAXDUNY); InitRndBarrels(); } if (leveltype == DTYPE_CATACOMBS) { - if (QuestStatus(QTYPE_INFRA)) + if (QuestStatus(Q_ROCK)) InitRndLocObj5x5(1, 1, OBJ_STAND); - if (QuestStatus(QTYPE_BONE)) + if (QuestStatus(Q_SCHAMB)) InitRndLocObj5x5(1, 1, OBJ_BOOK2R); AddL2Objs(0, 0, MAXDUNX, MAXDUNY); AddL2Torches(); - if (QuestStatus(QTYPE_BLIND)) { + if (QuestStatus(Q_BLIND)) { if (plr[myplr]._pClass == PC_WARRIOR) { - sp_id = QUEST_BLINDING; + sp_id = TEXT_BLINDING; } else if (plr[myplr]._pClass == PC_ROGUE) { - sp_id = QUEST_RBLINDING; + sp_id = TEXT_RBLINDING; } else if (plr[myplr]._pClass == PC_SORCERER) { - sp_id = QUEST_MBLINDING; + sp_id = TEXT_MBLINDING; } - quests[QTYPE_BLIND]._qmsg = sp_id; + quests[Q_BLIND]._qmsg = sp_id; AddBookLever(0, 0, MAXDUNX, MAXDUNY, setpc_x, setpc_y, setpc_w + setpc_x + 1, setpc_h + setpc_y + 1, sp_id); mem = LoadFileInMem("Levels\\L2Data\\Blind2.DUN", NULL); LoadMapObjs(mem, 2 * setpc_x, 2 * setpc_y); mem_free_dbg(mem); } - if (QuestStatus(QTYPE_BLOOD)) { + if (QuestStatus(Q_BLOOD)) { if (plr[myplr]._pClass == PC_WARRIOR) { - sp_id = QUEST_BLOODY; + sp_id = TEXT_BLOODY; } else if (plr[myplr]._pClass == PC_ROGUE) { - sp_id = QUEST_RBLOODY; + sp_id = TEXT_RBLOODY; } else if (plr[myplr]._pClass == PC_SORCERER) { - sp_id = QUEST_MBLOODY; + sp_id = TEXT_MBLOODY; } - quests[QTYPE_BLOOD]._qmsg = sp_id; + quests[Q_BLOOD]._qmsg = sp_id; AddBookLever(0, 0, MAXDUNX, MAXDUNY, setpc_x, setpc_y + 3, setpc_x + 2, setpc_y + 7, sp_id); AddObject(OBJ_PEDISTAL, 2 * setpc_x + 25, 2 * setpc_y + 32); } @@ -810,21 +810,21 @@ void InitObjects() InitRndBarrels(); } if (leveltype == DTYPE_HELL) { - if (QuestStatus(QTYPE_WARLRD)) { + if (QuestStatus(Q_WARLORD)) { if (plr[myplr]._pClass == PC_WARRIOR) { - sp_id = QUEST_BLOODWAR; + sp_id = TEXT_BLOODWAR; } else if (plr[myplr]._pClass == PC_ROGUE) { - sp_id = QUEST_RBLOODWAR; + sp_id = TEXT_RBLOODWAR; } else if (plr[myplr]._pClass == PC_SORCERER) { - sp_id = QUEST_MBLOODWAR; + sp_id = TEXT_MBLOODWAR; } - quests[QTYPE_WARLRD]._qmsg = sp_id; + quests[Q_WARLORD]._qmsg = sp_id; AddBookLever(0, 0, MAXDUNX, MAXDUNY, setpc_x, setpc_y, setpc_x + setpc_w, setpc_y + setpc_h, sp_id); mem = LoadFileInMem("Levels\\L4Data\\Warlord.DUN", NULL); LoadMapObjs(mem, 2 * setpc_x, 2 * setpc_y); mem_free_dbg(mem); } - if (QuestStatus(QTYPE_VB) && gbMaxPlayers == 1) + if (QuestStatus(Q_BETRAYER) && gbMaxPlayers == 1) AddLazStand(); InitRndBarrels(); AddL4Goodies(); @@ -1519,8 +1519,8 @@ void Obj_Circle(int i) if (ox == 35 && oy == 36 && object[i]._oVar5 == 3) { object[i]._oVar6 = 4; ObjChangeMapResync(object[i]._oVar1, object[i]._oVar2, object[i]._oVar3, object[i]._oVar4); - if (quests[QTYPE_VB]._qactive == 2) - quests[QTYPE_VB]._qvar1 = 4; + if (quests[Q_BETRAYER]._qactive == QUEST_ACTIVE) + quests[Q_BETRAYER]._qvar1 = 4; AddMissile(plr[myplr].WorldX, plr[myplr].WorldY, 35, 46, plr[myplr]._pdir, MIS_RNDTELEPORT, 0, myplr, 0, 0); track_repeat_walk(FALSE); sgbMouseDown = 0; @@ -2469,7 +2469,7 @@ void OperateBook(int pnum, int i) plr[myplr]._pMemSpells |= ((__int64)1 << (SPL_GUARDIAN - 1)); if (plr[pnum]._pSplLvl[SPL_GUARDIAN] < 15) plr[myplr]._pSplLvl[SPL_GUARDIAN]++; - quests[QTYPE_BONE]._qactive = 3; + quests[Q_SCHAMB]._qactive = QUEST_DONE; if (!deltaload) PlaySfxLoc(IS_QUESTDN, object[i]._ox, object[i]._oy); InitDiabloMsg(EMSG_BONECHAMB); @@ -2503,24 +2503,24 @@ void OperateBookLever(int pnum, int i) x = 2 * setpc_x + 16; y = 2 * setpc_y + 16; if (object[i]._oSelFlag != 0 && !qtextflag) { - if (object[i]._otype == OBJ_BLINDBOOK && !quests[QTYPE_BLIND]._qvar1) { - quests[QTYPE_BLIND]._qactive = 2; - quests[QTYPE_BLIND]._qlog = 1; - quests[QTYPE_BLIND]._qvar1 = 1; + if (object[i]._otype == OBJ_BLINDBOOK && !quests[Q_BLIND]._qvar1) { + quests[Q_BLIND]._qactive = QUEST_ACTIVE; + quests[Q_BLIND]._qlog = 1; + quests[Q_BLIND]._qvar1 = 1; } - if (object[i]._otype == OBJ_BLOODBOOK && !quests[QTYPE_BLOOD]._qvar1) { - quests[QTYPE_BLOOD]._qactive = 2; - quests[QTYPE_BLOOD]._qlog = 1; - quests[QTYPE_BLOOD]._qvar1 = 1; + if (object[i]._otype == OBJ_BLOODBOOK && !quests[Q_BLOOD]._qvar1) { + quests[Q_BLOOD]._qactive = QUEST_ACTIVE; + quests[Q_BLOOD]._qlog = 1; + quests[Q_BLOOD]._qvar1 = 1; SpawnQuestItem(IDI_BLDSTONE, 2 * setpc_x + 19, 2 * setpc_y + 26, 0, 1); SpawnQuestItem(IDI_BLDSTONE, 2 * setpc_x + 31, 2 * setpc_y + 26, 0, 1); SpawnQuestItem(IDI_BLDSTONE, 2 * setpc_x + 25, 2 * setpc_y + 33, 0, 1); } object[i]._otype = object[i]._otype; - if (object[i]._otype == OBJ_STEELTOME && !quests[QTYPE_WARLRD]._qvar1) { - quests[QTYPE_WARLRD]._qactive = 2; - quests[QTYPE_WARLRD]._qlog = 1; - quests[QTYPE_WARLRD]._qvar1 = 1; + if (object[i]._otype == OBJ_STEELTOME && !quests[Q_WARLORD]._qvar1) { + quests[Q_WARLORD]._qactive = QUEST_ACTIVE; + quests[Q_WARLORD]._qlog = 1; + quests[Q_WARLORD]._qvar1 = 1; } if (object[i]._oAnimFrame != object[i]._oVar6) { if (object[i]._otype != OBJ_BLOODBOOK) @@ -2551,18 +2551,18 @@ void OperateSChambBk(int pnum, int i) SyncObjectAnim(objectactive[j]); } object[i]._oAnimFrame = object[i]._oVar6; - if (quests[QTYPE_BONE]._qactive == 1) { - quests[QTYPE_BONE]._qactive = 2; - quests[QTYPE_BONE]._qlog = 1; + if (quests[Q_SCHAMB]._qactive == QUEST_INIT) { + quests[Q_SCHAMB]._qactive = QUEST_ACTIVE; + quests[Q_SCHAMB]._qlog = 1; } if (plr[myplr]._pClass == PC_WARRIOR) { - textdef = QUEST_BONER; + textdef = TEXT_BONER; } else if (plr[myplr]._pClass == PC_ROGUE) { - textdef = QUEST_RBONER; + textdef = TEXT_RBONER; } else if (plr[myplr]._pClass == PC_SORCERER) { - textdef = QUEST_MBONER; + textdef = TEXT_MBONER; } - quests[QTYPE_BONE]._qmsg = textdef; + quests[Q_SCHAMB]._qmsg = textdef; InitQTextMsg(textdef); } } @@ -2617,7 +2617,7 @@ void OperateMushPatch(int pnum, int i) { int x, y; - if (quests[QTYPE_BLKM]._qactive != 2 || quests[QTYPE_BLKM]._qvar1 < QS_TOMEGIVEN) { + if (quests[Q_MUSHROOM]._qactive != QUEST_ACTIVE || quests[Q_MUSHROOM]._qvar1 < QS_TOMEGIVEN) { if (!deltaload && pnum == myplr) { if (plr[myplr]._pClass == PC_WARRIOR) { PlaySFX(PS_WARR13); @@ -2638,7 +2638,7 @@ void OperateMushPatch(int pnum, int i) if (!deltaload) { GetSuperItemLoc(object[i]._ox, object[i]._oy, x, y); SpawnQuestItem(IDI_MUSHROOM, x, y, 0, 0); - quests[QTYPE_BLKM]._qvar1 = QS_MUSHSPAWNED; + quests[Q_MUSHROOM]._qvar1 = QS_MUSHSPAWNED; } } } @@ -2648,7 +2648,7 @@ void OperateInnSignChest(int pnum, int i) { int x, y; - if (quests[QTYPE_BOL]._qvar1 != 2) { + if (quests[Q_LTBANNER]._qvar1 != 2) { if (!deltaload && pnum == myplr) { if (plr[myplr]._pClass == PC_WARRIOR) { PlaySFX(PS_WARR24); @@ -3486,11 +3486,11 @@ void OperateBookCase(int pnum, int i, BOOL sendmsg) if (!deltaload) { SetRndSeed(object[i]._oRndSeed); CreateTypeItem(object[i]._ox, object[i]._oy, FALSE, ITYPE_MISC, IMISC_BOOK, sendmsg, FALSE); - if (QuestStatus(QTYPE_ZHAR) + if (QuestStatus(Q_ZHAR) && monster[MAX_PLRS].mName == UniqMonst[UMT_ZHAR].mName && monster[MAX_PLRS]._msquelch == UCHAR_MAX && monster[MAX_PLRS]._mhitpoints) { - monster[MAX_PLRS].mtalkmsg = QUEST_ZHAR2; + monster[MAX_PLRS].mtalkmsg = TEXT_ZHAR2; M_StartStand(0, monster[MAX_PLRS]._mdir); monster[MAX_PLRS]._mgoal = MGOAL_SHOOT; monster[MAX_PLRS]._mmode = MM_TALK; diff --git a/Source/player.cpp b/Source/player.cpp index befb421b..01e1bc63 100644 --- a/Source/player.cpp +++ b/Source/player.cpp @@ -3025,7 +3025,7 @@ void CheckNewPath(int pnum) if (x < 2 && y < 2) { ClrPlrPath(pnum); - if (monster[i].mtalkmsg && monster[i].mtalkmsg != QUEST_VILE14) { + if (monster[i].mtalkmsg && monster[i].mtalkmsg != TEXT_VILE14) { TalktoMonster(i); } else { StartAttack(pnum, d); @@ -3102,7 +3102,7 @@ void CheckNewPath(int pnum) y = abs(plr[pnum].WorldY - monster[i]._mfuty); if (x <= 1 && y <= 1) { d = GetDirection(plr[pnum]._px, plr[pnum]._py, monster[i]._mfutx, monster[i]._mfuty); - if (monster[i].mtalkmsg && monster[i].mtalkmsg != QUEST_VILE14) { + if (monster[i].mtalkmsg && monster[i].mtalkmsg != TEXT_VILE14) { TalktoMonster(i); } else { StartAttack(pnum, d); @@ -3125,7 +3125,7 @@ void CheckNewPath(int pnum) case ACTION_RATTACKMON: i = plr[pnum].destParam1; d = GetDirection(plr[pnum]._px, plr[pnum]._py, monster[i]._mfutx, monster[i]._mfuty); - if (monster[i].mtalkmsg && monster[i].mtalkmsg != QUEST_VILE14) { + if (monster[i].mtalkmsg && monster[i].mtalkmsg != TEXT_VILE14) { TalktoMonster(i); } else { StartRangeAttack(pnum, d, monster[i]._mfutx, monster[i]._mfuty); diff --git a/Source/quests.cpp b/Source/quests.cpp index 20169885..c0fc49c0 100644 --- a/Source/quests.cpp +++ b/Source/quests.cpp @@ -17,22 +17,22 @@ int ReturnLvl; QuestData questlist[MAXQUESTS] = { // clang-format off // _qdlvl, _qdmultlvl, _qlvlt, _qdtype, _qdrnd, _qslvl, _qflags, _qdmsg, _qlstr - { 5, -1, DTYPE_NONE, QTYPE_INFRA, 100, 0, 0, QUEST_INFRA5, "The Magic Rock" }, - { 9, -1, DTYPE_NONE, QTYPE_BLKM, 100, 0, 0, QUEST_MUSH8, "Black Mushroom" }, - { 4, -1, DTYPE_NONE, QTYPE_GARB, 100, 0, 0, QUEST_GARBUD1, "Gharbad The Weak" }, - { 8, -1, DTYPE_NONE, QTYPE_ZHAR, 100, 0, 0, QUEST_ZHAR1, "Zhar the Mad" }, - { 14, -1, DTYPE_NONE, QTYPE_VEIL, 100, 0, 0, QUEST_VEIL9, "Lachdanan" }, - { 15, -1, DTYPE_NONE, QTYPE_MOD, 100, 0, 1, QUEST_VILE3, "Diablo" }, - { 2, 2, DTYPE_NONE, QTYPE_BUTCH, 100, 0, 1, QUEST_BUTCH9, "The Butcher" }, - { 4, -1, DTYPE_NONE, QTYPE_BOL, 100, 0, 0, QUEST_BANNER2, "Ogden's Sign" }, - { 7, -1, DTYPE_NONE, QTYPE_BLIND, 100, 0, 0, QUEST_BLINDING, "Halls of the Blind" }, - { 5, -1, DTYPE_NONE, QTYPE_BLOOD, 100, 0, 0, QUEST_BLOODY, "Valor" }, - { 10, -1, DTYPE_NONE, QTYPE_ANVIL, 100, 0, 0, QUEST_ANVIL5, "Anvil of Fury" }, - { 13, -1, DTYPE_NONE, QTYPE_WARLRD, 100, 0, 0, QUEST_BLOODWAR, "Warlord of Blood" }, - { 3, 3, DTYPE_CATHEDRAL, QTYPE_KING, 100, 1, 1, QUEST_KING2, "The Curse of King Leoric" }, - { 2, -1, DTYPE_CAVES, QTYPE_PW, 100, 4, 0, QUEST_POISON3, "Poisoned Water Supply" }, - { 6, -1, DTYPE_CATACOMBS, QTYPE_BONE, 100, 2, 0, QUEST_BONER, "The Chamber of Bone" }, - { 15, 15, DTYPE_CATHEDRAL, QTYPE_VB, 100, 5, 1, QUEST_VILE1, "Archbishop Lazarus" }, + { 5, -1, DTYPE_NONE, Q_ROCK, 100, 0, 0, TEXT_INFRA5, "The Magic Rock" }, + { 9, -1, DTYPE_NONE, Q_MUSHROOM, 100, 0, 0, TEXT_MUSH8, "Black Mushroom" }, + { 4, -1, DTYPE_NONE, Q_GARBUD, 100, 0, 0, TEXT_GARBUD1, "Gharbad The Weak" }, + { 8, -1, DTYPE_NONE, Q_ZHAR, 100, 0, 0, TEXT_ZHAR1, "Zhar the Mad" }, + { 14, -1, DTYPE_NONE, Q_VEIL, 100, 0, 0, TEXT_VEIL9, "Lachdanan" }, + { 15, -1, DTYPE_NONE, Q_DIABLO, 100, 0, 1, TEXT_VILE3, "Diablo" }, + { 2, 2, DTYPE_NONE, Q_BUTCHER, 100, 0, 1, TEXT_BUTCH9, "The Butcher" }, + { 4, -1, DTYPE_NONE, Q_LTBANNER, 100, 0, 0, TEXT_BANNER2, "Ogden's Sign" }, + { 7, -1, DTYPE_NONE, Q_BLIND, 100, 0, 0, TEXT_BLINDING, "Halls of the Blind" }, + { 5, -1, DTYPE_NONE, Q_BLOOD, 100, 0, 0, TEXT_BLOODY, "Valor" }, + { 10, -1, DTYPE_NONE, Q_ANVIL, 100, 0, 0, TEXT_ANVIL5, "Anvil of Fury" }, + { 13, -1, DTYPE_NONE, Q_WARLORD, 100, 0, 0, TEXT_BLOODWAR, "Warlord of Blood" }, + { 3, 3, DTYPE_CATHEDRAL, Q_SKELKING, 100, 1, 1, TEXT_KING2, "The Curse of King Leoric" }, + { 2, -1, DTYPE_CAVES, Q_PWATER, 100, 4, 0, TEXT_POISON3, "Poisoned Water Supply" }, + { 6, -1, DTYPE_CATACOMBS, Q_SCHAMB, 100, 2, 0, TEXT_BONER, "The Chamber of Bone" }, + { 15, 15, DTYPE_CATHEDRAL, Q_BETRAYER, 100, 5, 1, TEXT_VILE1, "Archbishop Lazarus" }, // clang-format on }; char questxoff[7] = { 0, -1, 0, -1, -2, -1, -2 }; @@ -44,10 +44,10 @@ char *questtrigstr[5] = { "A Dark Passage", "Unholy Altar" }; -int QuestGroup1[3] = { QTYPE_BUTCH, QTYPE_BOL, QTYPE_GARB }; -int QuestGroup2[3] = { QTYPE_BLIND, QTYPE_INFRA, QTYPE_BLOOD }; -int QuestGroup3[3] = { QTYPE_BLKM, QTYPE_ZHAR, QTYPE_ANVIL }; -int QuestGroup4[2] = { QTYPE_VEIL, QTYPE_WARLRD }; +int QuestGroup1[3] = { Q_BUTCHER, Q_LTBANNER, Q_GARBUD }; +int QuestGroup2[3] = { Q_BLIND, Q_ROCK, Q_BLOOD }; +int QuestGroup3[3] = { Q_MUSHROOM, Q_ZHAR, Q_ANVIL }; +int QuestGroup4[2] = { Q_VEIL, Q_WARLORD }; void InitQuests() { @@ -56,12 +56,12 @@ void InitQuests() if (gbMaxPlayers == 1) { for (i = 0; i < MAXQUESTS; i++) { - quests[i]._qactive = 0; + quests[i]._qactive = QUEST_NOTAVAIL; } } else { for (i = 0; i < MAXQUESTS; i++) { if (!(questlist[i]._qflags & 1)) { - quests[i]._qactive = 0; + quests[i]._qactive = QUEST_NOTAVAIL; } } } @@ -77,13 +77,13 @@ void InitQuests() if (gbMaxPlayers > 1) { quests[z]._qlevel = questlist[z]._qdmultlvl; if (!delta_quest_inited(initiatedQuests)) { - quests[z]._qactive = 1; + quests[z]._qactive = QUEST_INIT; quests[z]._qvar1 = 0; quests[z]._qlog = 0; } initiatedQuests++; } else { - quests[z]._qactive = 1; + quests[z]._qactive = QUEST_INIT; quests[z]._qlevel = questlist[z]._qdlvl; quests[z]._qvar1 = 0; quests[z]._qlog = 0; @@ -102,33 +102,33 @@ void InitQuests() if (gbMaxPlayers == 1) { SetRndSeed(glSeedTbl[15]); if (random_(0, 2)) - quests[QTYPE_PW]._qactive = 0; + quests[Q_PWATER]._qactive = QUEST_NOTAVAIL; else - quests[QTYPE_KING]._qactive = 0; + quests[Q_SKELKING]._qactive = QUEST_NOTAVAIL; - quests[QuestGroup1[random_(0, sizeof(QuestGroup1) / sizeof(int))]]._qactive = 0; - quests[QuestGroup2[random_(0, sizeof(QuestGroup2) / sizeof(int))]]._qactive = 0; - quests[QuestGroup3[random_(0, sizeof(QuestGroup3) / sizeof(int))]]._qactive = 0; - quests[QuestGroup4[random_(0, sizeof(QuestGroup4) / sizeof(int))]]._qactive = 0; + quests[QuestGroup1[random_(0, sizeof(QuestGroup1) / sizeof(int))]]._qactive = QUEST_NOTAVAIL; + quests[QuestGroup2[random_(0, sizeof(QuestGroup2) / sizeof(int))]]._qactive = QUEST_NOTAVAIL; + quests[QuestGroup3[random_(0, sizeof(QuestGroup3) / sizeof(int))]]._qactive = QUEST_NOTAVAIL; + quests[QuestGroup4[random_(0, sizeof(QuestGroup4) / sizeof(int))]]._qactive = QUEST_NOTAVAIL; } #ifdef _DEBUG if (questdebug != -1) - quests[questdebug]._qactive = 2; + quests[questdebug]._qactive = QUEST_ACTIVE; #endif #ifdef SPAWN for (z = 0; z < MAXQUESTS; z++) { - quests[z]._qactive = 0; + quests[z]._qactive = QUEST_NOTAVAIL; } #endif - if (!quests[QTYPE_KING]._qactive) - quests[QTYPE_KING]._qvar2 = 2; - if (!quests[QTYPE_INFRA]._qactive) - quests[QTYPE_INFRA]._qvar2 = 2; - quests[QTYPE_BOL]._qvar1 = 1; + if (!quests[Q_SKELKING]._qactive) + quests[Q_SKELKING]._qvar2 = 2; + if (!quests[Q_ROCK]._qactive) + quests[Q_ROCK]._qvar2 = 2; + quests[Q_LTBANNER]._qvar1 = 1; if (gbMaxPlayers != 1) - quests[QTYPE_VB]._qvar1 = 2; + quests[Q_BETRAYER]._qvar1 = 2; } void CheckQuests() @@ -136,49 +136,49 @@ void CheckQuests() #ifndef SPAWN int i, rportx, rporty; - if (QuestStatus(QTYPE_VB) && gbMaxPlayers != 1 && quests[QTYPE_VB]._qvar1 == 2) { + if (QuestStatus(Q_BETRAYER) && gbMaxPlayers != 1 && quests[Q_BETRAYER]._qvar1 == 2) { AddObject(OBJ_ALTBOY, 2 * setpc_x + 20, 2 * setpc_y + 22); - quests[QTYPE_VB]._qvar1 = 3; - NetSendCmdQuest(TRUE, QTYPE_VB); + quests[Q_BETRAYER]._qvar1 = 3; + NetSendCmdQuest(TRUE, Q_BETRAYER); } if (gbMaxPlayers != 1) { return; } - if (currlevel == quests[QTYPE_VB]._qlevel + if (currlevel == quests[Q_BETRAYER]._qlevel && !setlevel - && quests[QTYPE_VB]._qvar1 >= 2 - && (quests[QTYPE_VB]._qactive == 2 || quests[QTYPE_VB]._qactive == 3) - && (quests[QTYPE_VB]._qvar2 == 0 || quests[QTYPE_VB]._qvar2 == 2)) { - quests[QTYPE_VB]._qtx = 2 * quests[QTYPE_VB]._qtx + 16; - quests[QTYPE_VB]._qty = 2 * quests[QTYPE_VB]._qty + 16; - rportx = quests[QTYPE_VB]._qtx; - rporty = quests[QTYPE_VB]._qty; + && quests[Q_BETRAYER]._qvar1 >= 2 + && (quests[Q_BETRAYER]._qactive == QUEST_ACTIVE || quests[Q_BETRAYER]._qactive == QUEST_DONE) + && (quests[Q_BETRAYER]._qvar2 == 0 || quests[Q_BETRAYER]._qvar2 == 2)) { + quests[Q_BETRAYER]._qtx = 2 * quests[Q_BETRAYER]._qtx + 16; + quests[Q_BETRAYER]._qty = 2 * quests[Q_BETRAYER]._qty + 16; + rportx = quests[Q_BETRAYER]._qtx; + rporty = quests[Q_BETRAYER]._qty; AddMissile(rportx, rporty, rportx, rporty, 0, MIS_RPORTAL, 0, myplr, 0, 0); - quests[QTYPE_VB]._qvar2 = 1; - if (quests[QTYPE_VB]._qactive == 2) { - quests[QTYPE_VB]._qvar1 = 3; + quests[Q_BETRAYER]._qvar2 = 1; + if (quests[Q_BETRAYER]._qactive == QUEST_ACTIVE) { + quests[Q_BETRAYER]._qvar1 = 3; } } - if (quests[QTYPE_VB]._qactive == 3 + if (quests[Q_BETRAYER]._qactive == QUEST_DONE && setlevel && setlvlnum == SL_VILEBETRAYER - && quests[QTYPE_VB]._qvar2 == 4) { + && quests[Q_BETRAYER]._qvar2 == 4) { rportx = 35; rporty = 32; AddMissile(rportx, rporty, rportx, rporty, 0, MIS_RPORTAL, 0, myplr, 0, 0); - quests[QTYPE_VB]._qvar2 = 3; + quests[Q_BETRAYER]._qvar2 = 3; } if (setlevel) { - if (setlvlnum == quests[QTYPE_PW]._qslvl - && quests[QTYPE_PW]._qactive != 1 - && leveltype == quests[QTYPE_PW]._qlvltype + if (setlvlnum == quests[Q_PWATER]._qslvl + && quests[Q_PWATER]._qactive != QUEST_INIT + && leveltype == quests[Q_PWATER]._qlvltype && nummonsters == 4 - && quests[QTYPE_PW]._qactive != 3) { - quests[QTYPE_PW]._qactive = 3; + && quests[Q_PWATER]._qactive != QUEST_DONE) { + quests[Q_PWATER]._qactive = QUEST_DONE; PlaySfxLoc(IS_QUESTDN, plr[myplr].WorldX, plr[myplr].WorldY); LoadPalette("Levels\\L3Data\\L3pwater.pal"); WaterDone = 32; @@ -191,7 +191,7 @@ void CheckQuests() for (i = 0; i < MAXQUESTS; i++) { if (currlevel == quests[i]._qlevel && quests[i]._qslvl != 0 - && quests[i]._qactive != 0 + && quests[i]._qactive != QUEST_NOTAVAIL && plr[myplr].WorldX == quests[i]._qtx && plr[myplr].WorldY == quests[i]._qty) { if (quests[i]._qlvltype != 255) { @@ -215,7 +215,7 @@ BOOL ForceQuests() for (i = 0; i < MAXQUESTS; i++) { - if (i != QTYPE_VB && currlevel == quests[i]._qlevel && quests[i]._qslvl != 0) { + if (i != Q_BETRAYER && currlevel == quests[i]._qlevel && quests[i]._qslvl != 0) { ql = quests[quests[i]._qidx]._qslvl - 1; qx = quests[i]._qtx; qy = quests[i]._qty; @@ -254,7 +254,7 @@ void CheckQuestKill(int m, BOOL sendmsg) int i, j; if (monster[m].MType->mtype == MT_SKING) { - quests[QTYPE_KING]._qactive = 3; + quests[Q_SKELKING]._qactive = QUEST_DONE; sfxdelay = 30; if (plr[myplr]._pClass == PC_WARRIOR) { sfxdnum = PS_WARR82; @@ -264,10 +264,10 @@ void CheckQuestKill(int m, BOOL sendmsg) sfxdnum = PS_MAGE82; } if (sendmsg) - NetSendCmdQuest(TRUE, QTYPE_KING); + NetSendCmdQuest(TRUE, Q_SKELKING); } else if (monster[m].MType->mtype == MT_CLEAVER) { - quests[QTYPE_BUTCH]._qactive = 3; + quests[Q_BUTCHER]._qactive = QUEST_DONE; sfxdelay = 30; if (plr[myplr]._pClass == PC_WARRIOR) { sfxdnum = PS_WARR80; @@ -277,9 +277,9 @@ void CheckQuestKill(int m, BOOL sendmsg) sfxdnum = PS_MAGE80; } if (sendmsg) - NetSendCmdQuest(TRUE, QTYPE_BUTCH); + NetSendCmdQuest(TRUE, Q_BUTCHER); } else if (monster[m].mName == UniqMonst[UMT_GARBUD].mName) { //"Gharbad the Weak" - quests[QTYPE_GARB]._qactive = 3; + quests[Q_GARBUD]._qactive = QUEST_DONE; sfxdelay = 30; if (plr[myplr]._pClass == PC_WARRIOR) { sfxdnum = PS_WARR61; @@ -289,7 +289,7 @@ void CheckQuestKill(int m, BOOL sendmsg) sfxdnum = PS_MAGE61; } } else if (monster[m].mName == UniqMonst[UMT_ZHAR].mName) { //"Zhar the Mad" - quests[QTYPE_ZHAR]._qactive = 3; + quests[Q_ZHAR]._qactive = QUEST_DONE; sfxdelay = 30; if (plr[myplr]._pClass == PC_WARRIOR) { sfxdnum = PS_WARR62; @@ -299,10 +299,10 @@ void CheckQuestKill(int m, BOOL sendmsg) sfxdnum = PS_MAGE62; } } else if (monster[m].mName == UniqMonst[UMT_LAZURUS].mName && gbMaxPlayers != 1) { //"Arch-Bishop Lazarus" - quests[QTYPE_VB]._qactive = 3; - quests[QTYPE_VB]._qvar1 = 7; + quests[Q_BETRAYER]._qactive = QUEST_DONE; + quests[Q_BETRAYER]._qvar1 = 7; sfxdelay = 30; - quests[QTYPE_MOD]._qactive = 2; + quests[Q_DIABLO]._qactive = QUEST_ACTIVE; for (j = 0; j < MAXDUNY; j++) { for (i = 0; i < MAXDUNX; i++) { @@ -322,16 +322,16 @@ void CheckQuestKill(int m, BOOL sendmsg) sfxdnum = PS_MAGE83; } if (sendmsg) { - NetSendCmdQuest(TRUE, QTYPE_VB); - NetSendCmdQuest(TRUE, QTYPE_MOD); + NetSendCmdQuest(TRUE, Q_BETRAYER); + NetSendCmdQuest(TRUE, Q_DIABLO); } } else if (monster[m].mName == UniqMonst[UMT_LAZURUS].mName && gbMaxPlayers == 1) { //"Arch-Bishop Lazarus" - quests[QTYPE_VB]._qactive = 3; + quests[Q_BETRAYER]._qactive = QUEST_DONE; sfxdelay = 30; InitVPTriggers(); - quests[QTYPE_VB]._qvar1 = 7; - quests[QTYPE_VB]._qvar2 = 4; - quests[QTYPE_MOD]._qactive = 2; + quests[Q_BETRAYER]._qvar1 = 7; + quests[Q_BETRAYER]._qvar2 = 4; + quests[Q_DIABLO]._qactive = QUEST_ACTIVE; AddMissile(35, 32, 35, 32, 0, MIS_RPORTAL, 0, myplr, 0, 0); if (plr[myplr]._pClass == PC_WARRIOR) { sfxdnum = PS_WARR83; @@ -341,7 +341,7 @@ void CheckQuestKill(int m, BOOL sendmsg) sfxdnum = PS_MAGE83; } } else if (monster[m].mName == UniqMonst[UMT_WARLORD].mName) { //"Warlord of Blood" - quests[QTYPE_WARLRD]._qactive = 3; + quests[Q_WARLORD]._qactive = QUEST_DONE; sfxdelay = 30; if (plr[myplr]._pClass == PC_WARRIOR) { sfxdnum = PS_WARR94; @@ -519,25 +519,25 @@ void DRLG_CheckQuests(int x, int y) for (i = 0; i < MAXQUESTS; i++) { if (QuestStatus(i)) { switch (quests[i]._qtype) { - case QTYPE_BUTCH: + case Q_BUTCHER: DrawButcher(); break; - case QTYPE_BOL: + case Q_LTBANNER: DrawLTBanner(x, y); break; - case QTYPE_BLIND: + case Q_BLIND: DrawBlind(x, y); break; - case QTYPE_BLOOD: + case Q_BLOOD: DrawBlood(x, y); break; - case QTYPE_WARLRD: + case Q_WARLORD: DrawWarLord(x, y); break; - case QTYPE_KING: + case Q_SKELKING: DrawSkelKing(i, x, y); break; - case QTYPE_BONE: + case Q_SCHAMB: DrawSChamber(i, x, y); break; } @@ -549,27 +549,27 @@ void SetReturnLvlPos() { switch (setlvlnum) { case SL_SKELKING: - ReturnLvlX = quests[QTYPE_KING]._qtx + 1; - ReturnLvlY = quests[QTYPE_KING]._qty; - ReturnLvl = quests[QTYPE_KING]._qlevel; + ReturnLvlX = quests[Q_SKELKING]._qtx + 1; + ReturnLvlY = quests[Q_SKELKING]._qty; + ReturnLvl = quests[Q_SKELKING]._qlevel; ReturnLvlT = DTYPE_CATHEDRAL; break; case SL_BONECHAMB: - ReturnLvlX = quests[QTYPE_BONE]._qtx + 1; - ReturnLvlY = quests[QTYPE_BONE]._qty; - ReturnLvl = quests[QTYPE_BONE]._qlevel; + ReturnLvlX = quests[Q_SCHAMB]._qtx + 1; + ReturnLvlY = quests[Q_SCHAMB]._qty; + ReturnLvl = quests[Q_SCHAMB]._qlevel; ReturnLvlT = DTYPE_CATACOMBS; break; case SL_POISONWATER: - ReturnLvlX = quests[QTYPE_PW]._qtx; - ReturnLvlY = quests[QTYPE_PW]._qty + 1; - ReturnLvl = quests[QTYPE_PW]._qlevel; + ReturnLvlX = quests[Q_PWATER]._qtx; + ReturnLvlY = quests[Q_PWATER]._qty + 1; + ReturnLvl = quests[Q_PWATER]._qlevel; ReturnLvlT = DTYPE_CATHEDRAL; break; case SL_VILEBETRAYER: - ReturnLvlX = quests[QTYPE_VB]._qtx + 1; - ReturnLvlY = quests[QTYPE_VB]._qty - 1; - ReturnLvl = quests[QTYPE_VB]._qlevel; + ReturnLvlX = quests[Q_BETRAYER]._qtx + 1; + ReturnLvlY = quests[Q_BETRAYER]._qty - 1; + ReturnLvl = quests[Q_BETRAYER]._qlevel; ReturnLvlT = DTYPE_HELL; break; } @@ -577,8 +577,8 @@ void SetReturnLvlPos() void GetReturnLvlPos() { - if (quests[QTYPE_VB]._qactive == 3) - quests[QTYPE_VB]._qvar2 = 2; + if (quests[Q_BETRAYER]._qactive == QUEST_DONE) + quests[Q_BETRAYER]._qvar2 = 2; ViewX = ReturnLvlX; ViewY = ReturnLvlY; currlevel = ReturnLvl; @@ -588,23 +588,23 @@ void GetReturnLvlPos() void ResyncMPQuests() { #ifndef SPAWN - if (quests[QTYPE_KING]._qactive == 1 - && currlevel >= quests[QTYPE_KING]._qlevel - 1 - && currlevel <= quests[QTYPE_KING]._qlevel + 1) { - quests[QTYPE_KING]._qactive = 2; - NetSendCmdQuest(TRUE, QTYPE_KING); + if (quests[Q_SKELKING]._qactive == QUEST_INIT + && currlevel >= quests[Q_SKELKING]._qlevel - 1 + && currlevel <= quests[Q_SKELKING]._qlevel + 1) { + quests[Q_SKELKING]._qactive = QUEST_ACTIVE; + NetSendCmdQuest(TRUE, Q_SKELKING); } - if (quests[QTYPE_BUTCH]._qactive == 1 - && currlevel >= quests[QTYPE_BUTCH]._qlevel - 1 - && currlevel <= quests[QTYPE_BUTCH]._qlevel + 1) { - quests[QTYPE_BUTCH]._qactive = 2; - NetSendCmdQuest(TRUE, QTYPE_BUTCH); + if (quests[Q_BUTCHER]._qactive == QUEST_INIT + && currlevel >= quests[Q_BUTCHER]._qlevel - 1 + && currlevel <= quests[Q_BUTCHER]._qlevel + 1) { + quests[Q_BUTCHER]._qactive = QUEST_ACTIVE; + NetSendCmdQuest(TRUE, Q_BUTCHER); } - if (quests[QTYPE_VB]._qactive == 1 && currlevel == quests[QTYPE_VB]._qlevel - 1) { - quests[QTYPE_VB]._qactive = 2; - NetSendCmdQuest(TRUE, QTYPE_VB); + if (quests[Q_BETRAYER]._qactive == QUEST_INIT && currlevel == quests[Q_BETRAYER]._qlevel - 1) { + quests[Q_BETRAYER]._qactive = QUEST_ACTIVE; + NetSendCmdQuest(TRUE, Q_BETRAYER); } - if (QuestStatus(QTYPE_VB)) + if (QuestStatus(Q_BETRAYER)) AddObject(OBJ_ALTBOY, 2 * setpc_x + 20, 2 * setpc_y + 22); #endif } @@ -614,9 +614,9 @@ void ResyncQuests() #ifndef SPAWN int i, tren, x, y; - if (setlevel && setlvlnum == quests[QTYPE_PW]._qslvl && quests[QTYPE_PW]._qactive != 1 && leveltype == quests[QTYPE_PW]._qlvltype) { + if (setlevel && setlvlnum == quests[Q_PWATER]._qslvl && quests[Q_PWATER]._qactive != QUEST_INIT && leveltype == quests[Q_PWATER]._qlvltype) { - if (quests[QTYPE_PW]._qactive == 3) + if (quests[Q_PWATER]._qactive == QUEST_DONE) LoadPalette("Levels\\L3Data\\L3pwater.pal"); else LoadPalette("Levels\\L3Data\\L3pfoul.pal"); @@ -625,14 +625,14 @@ void ResyncQuests() palette_update_quest_palette(i); } - if (QuestStatus(QTYPE_BOL)) { - if (quests[QTYPE_BOL]._qvar1 == 1) + if (QuestStatus(Q_LTBANNER)) { + if (quests[Q_LTBANNER]._qvar1 == 1) ObjChangeMapResync( setpc_w + setpc_x - 2, setpc_h + setpc_y - 2, setpc_w + setpc_x + 1, setpc_h + setpc_y + 1); - if (quests[QTYPE_BOL]._qvar1 == 2) { + if (quests[Q_LTBANNER]._qvar1 == 2) { ObjChangeMapResync( setpc_w + setpc_x - 2, setpc_h + setpc_y - 2, @@ -646,7 +646,7 @@ void ResyncQuests() DRLG_MRectTrans(setpc_x, setpc_y, (setpc_w >> 1) + setpc_x + 4, setpc_y + (setpc_h >> 1)); TransVal = tren; } - if (quests[QTYPE_BOL]._qvar1 == 3) { + if (quests[Q_LTBANNER]._qvar1 == 3) { x = setpc_x; y = setpc_y; ObjChangeMapResync(x, y, x + setpc_w + 1, y + setpc_h + 1); @@ -658,40 +658,40 @@ void ResyncQuests() TransVal = tren; } } - if (currlevel == quests[QTYPE_BLKM]._qlevel) { - if (quests[QTYPE_BLKM]._qactive == 1 && !quests[QTYPE_BLKM]._qvar1) { + if (currlevel == quests[Q_MUSHROOM]._qlevel) { + if (quests[Q_MUSHROOM]._qactive == QUEST_INIT && !quests[Q_MUSHROOM]._qvar1) { SpawnQuestItem(IDI_FUNGALTM, 0, 0, 5, 1); - quests[QTYPE_BLKM]._qvar1 = QS_TOMESPAWNED; + quests[Q_MUSHROOM]._qvar1 = QS_TOMESPAWNED; } else { - if (quests[QTYPE_BLKM]._qactive == 2) { - if (quests[QTYPE_BLKM]._qvar1 >= QS_MUSHGIVEN) { + if (quests[Q_MUSHROOM]._qactive == QUEST_ACTIVE) { + if (quests[Q_MUSHROOM]._qvar1 >= QS_MUSHGIVEN) { Qtalklist[TOWN_WITCH]._qblkm = -1; - Qtalklist[TOWN_HEALER]._qblkm = QUEST_MUSH3; - } else if (quests[QTYPE_BLKM]._qvar1 >= QS_BRAINGIVEN) { + Qtalklist[TOWN_HEALER]._qblkm = TEXT_MUSH3; + } else if (quests[Q_MUSHROOM]._qvar1 >= QS_BRAINGIVEN) { Qtalklist[TOWN_HEALER]._qblkm = -1; } } } } - if (currlevel == quests[QTYPE_VEIL]._qlevel + 1 && quests[QTYPE_VEIL]._qactive == 2 && !quests[QTYPE_VEIL]._qvar1) { - quests[QTYPE_VEIL]._qvar1 = 1; + if (currlevel == quests[Q_VEIL]._qlevel + 1 && quests[Q_VEIL]._qactive == QUEST_ACTIVE && !quests[Q_VEIL]._qvar1) { + quests[Q_VEIL]._qvar1 = 1; SpawnQuestItem(IDI_GLDNELIX, 0, 0, 5, 1); } if (setlevel && setlvlnum == SL_VILEBETRAYER) { - if (quests[QTYPE_VB]._qvar1 >= 4) + if (quests[Q_BETRAYER]._qvar1 >= 4) ObjChangeMapResync(1, 11, 20, 18); - if (quests[QTYPE_VB]._qvar1 >= 6) + if (quests[Q_BETRAYER]._qvar1 >= 6) ObjChangeMapResync(1, 18, 20, 24); - if (quests[QTYPE_VB]._qvar1 >= 7) + if (quests[Q_BETRAYER]._qvar1 >= 7) InitVPTriggers(); for (i = 0; i < nobjects; i++) SyncObjectAnim(objectactive[i]); } - if (currlevel == quests[QTYPE_VB]._qlevel + if (currlevel == quests[Q_BETRAYER]._qlevel && !setlevel - && (quests[QTYPE_VB]._qvar2 == 1 || quests[QTYPE_VB]._qvar2 >= 3) - && (quests[QTYPE_VB]._qactive == 2 || quests[QTYPE_VB]._qactive == 3)) { - quests[QTYPE_VB]._qvar2 = 2; + && (quests[Q_BETRAYER]._qvar2 == 1 || quests[Q_BETRAYER]._qvar2 >= 3) + && (quests[Q_BETRAYER]._qactive == QUEST_ACTIVE || quests[Q_BETRAYER]._qactive == QUEST_DONE)) { + quests[Q_BETRAYER]._qvar2 = 2; } #endif } @@ -750,7 +750,7 @@ void StartQuestlog() numqlines = 0; for (i = 0; i < MAXQUESTS; i++) { - if (quests[i]._qactive == 2 && quests[i]._qlog) { + if (quests[i]._qactive == QUEST_ACTIVE && quests[i]._qlog) { qlist[numqlines] = i; numqlines++; } @@ -825,7 +825,7 @@ void QuestlogESC() void SetMultiQuest(int q, int s, int l, int v1) { #ifndef SPAWN - if (quests[q]._qactive != 3) { + if (quests[q]._qactive != QUEST_DONE) { if (s > quests[q]._qactive) quests[q]._qactive = s; quests[q]._qlog |= l; diff --git a/Source/setmaps.cpp b/Source/setmaps.cpp index 3a0b8735..286d6cd0 100644 --- a/Source/setmaps.cpp +++ b/Source/setmaps.cpp @@ -133,9 +133,9 @@ void LoadSetMap() { switch (setlvlnum) { case SL_SKELKING: - if (quests[QTYPE_KING]._qactive == 1) { - quests[QTYPE_KING]._qactive = 2; - quests[QTYPE_KING]._qvar1 = 1; + if (quests[Q_SKELKING]._qactive == QUEST_INIT) { + quests[Q_SKELKING]._qactive = QUEST_ACTIVE; + quests[Q_SKELKING]._qvar1 = 1; } LoadPreL1Dungeon("Levels\\L1Data\\SklKng1.DUN", 83, 45); LoadL1Dungeon("Levels\\L1Data\\SklKng2.DUN", 83, 45); @@ -167,18 +167,18 @@ void LoadSetMap() DRLG_SetMapTrans("Levels\\L1Data\\Lv1MazeA.DUN"); break; case SL_POISONWATER: - if (quests[QTYPE_PW]._qactive == 1) - quests[QTYPE_PW]._qactive = 2; + if (quests[Q_PWATER]._qactive == QUEST_INIT) + quests[Q_PWATER]._qactive = QUEST_ACTIVE; LoadPreL3Dungeon("Levels\\L3Data\\Foulwatr.DUN", 19, 50); LoadL3Dungeon("Levels\\L3Data\\Foulwatr.DUN", 20, 50); LoadPalette("Levels\\L3Data\\L3pfoul.pal"); InitPWaterTriggers(); break; case SL_VILEBETRAYER: - if (quests[QTYPE_VB]._qactive == 3) { - quests[QTYPE_VB]._qvar2 = 4; - } else if (quests[QTYPE_VB]._qactive == 2) { - quests[QTYPE_VB]._qvar2 = 3; + if (quests[Q_BETRAYER]._qactive == QUEST_DONE) { + quests[Q_BETRAYER]._qvar2 = 4; + } else if (quests[Q_BETRAYER]._qactive == QUEST_ACTIVE) { + quests[Q_BETRAYER]._qvar2 = 3; } LoadPreL1Dungeon("Levels\\L1Data\\Vile1.DUN", 35, 36); LoadL1Dungeon("Levels\\L1Data\\Vile2.DUN", 35, 36); diff --git a/Source/stores.cpp b/Source/stores.cpp index 5bb86f53..fa02dbee 100644 --- a/Source/stores.cpp +++ b/Source/stores.cpp @@ -615,7 +615,7 @@ BOOL SmithSellOk(int i) return FALSE; if (plr[myplr].InvList[i]._itype == ITYPE_GOLD) return FALSE; - if (plr[myplr].InvList[i]._itype == ITYPE_0E) + if (plr[myplr].InvList[i]._itype == ITYPE_MEAT) return FALSE; if (plr[myplr].InvList[i]._itype == ITYPE_STAFF) return FALSE; @@ -723,7 +723,7 @@ BOOL SmithRepairOk(int i) return FALSE; if (plr[myplr].InvList[i]._itype == ITYPE_GOLD) return FALSE; - if (plr[myplr].InvList[i]._itype == ITYPE_0E) + if (plr[myplr].InvList[i]._itype == ITYPE_MEAT) return FALSE; if (plr[myplr].InvList[i]._iDurability == plr[myplr].InvList[i]._iMaxDur) return FALSE; @@ -1379,7 +1379,7 @@ void S_StartTalk() #else sn = 0; for (i = 0; i < MAXQUESTS; i++) { - if (quests[i]._qactive == 2 && ((DWORD *)&Qtalklist[talker])[i] != -1 && quests[i]._qlog) + if (quests[i]._qactive == QUEST_ACTIVE && ((DWORD *)&Qtalklist[talker])[i] != -1 && quests[i]._qlog) sn++; } @@ -1394,7 +1394,7 @@ void S_StartTalk() sn2 = sn - 2; for (i = 0; i < MAXQUESTS; i++) { - if (quests[i]._qactive == 2 && ((DWORD *)&Qtalklist[talker])[i] != -1 && quests[i]._qlog) { + if (quests[i]._qactive == QUEST_ACTIVE && ((DWORD *)&Qtalklist[talker])[i] != -1 && quests[i]._qlog) { AddSText(0, sn, 1, questlist[i]._qlstr, COL_WHITE, 1); sn += la; } @@ -1773,8 +1773,8 @@ void S_SmithEnter() talker = 0; stextlhold = 10; stextshold = STORE_SMITH; - gossipstart = QUEST_GRISWOLD2; - gossipend = QUEST_GRISWOLD13; + gossipstart = TEXT_GRISWOLD2; + gossipend = TEXT_GRISWOLD13; StartStore(STORE_GOSSIP); break; case 12: @@ -2167,8 +2167,8 @@ void S_WitchEnter() stextlhold = 12; talker = 6; stextshold = STORE_WITCH; - gossipstart = QUEST_ADRIA2; - gossipend = QUEST_ADRIA13; + gossipstart = TEXT_ADRIA2; + gossipend = TEXT_ADRIA13; StartStore(STORE_GOSSIP); return; case 14: @@ -2321,8 +2321,8 @@ void S_BoyEnter() talker = 8; stextshold = STORE_BOY; stextlhold = stextsel; - gossipstart = QUEST_WIRT2; - gossipend = QUEST_WIRT12; + gossipstart = TEXT_WIRT2; + gossipend = TEXT_WIRT12; StartStore(STORE_GOSSIP); } else { stextflag = STORE_NONE; @@ -2491,8 +2491,8 @@ void S_HealerEnter() stextlhold = 12; talker = 1; stextshold = STORE_HEALER; - gossipstart = QUEST_PEPIN2; - gossipend = QUEST_PEPIN11; + gossipstart = TEXT_PEPIN2; + gossipend = TEXT_PEPIN11; StartStore(STORE_GOSSIP); break; case 14: @@ -2550,8 +2550,8 @@ void S_StoryEnter() stextlhold = 12; talker = 4; stextshold = STORE_STORY; - gossipstart = QUEST_STORY2; - gossipend = QUEST_STORY11; + gossipstart = TEXT_STORY2; + gossipend = TEXT_STORY11; StartStore(STORE_GOSSIP); break; case 14: @@ -2595,7 +2595,7 @@ void S_TalkEnter() sn = 0; for (i = 0; i < MAXQUESTS; i++) { - if (quests[i]._qactive == 2 && ((DWORD *)&Qtalklist[talker])[i] != -1 && quests[i]._qlog) + if (quests[i]._qactive == QUEST_ACTIVE && ((DWORD *)&Qtalklist[talker])[i] != -1 && quests[i]._qlog) sn++; } if (sn > 6) { @@ -2614,7 +2614,7 @@ void S_TalkEnter() } for (i = 0; i < MAXQUESTS; i++) { - if (quests[i]._qactive == 2 && ((DWORD *)&Qtalklist[talker])[i] != -1 && quests[i]._qlog) { + if (quests[i]._qactive == QUEST_ACTIVE && ((DWORD *)&Qtalklist[talker])[i] != -1 && quests[i]._qlog) { if (sn == stextsel) { InitQTextMsg(((DWORD *)&Qtalklist[talker])[i]); } @@ -2630,8 +2630,8 @@ void S_TavernEnter() stextlhold = 12; talker = 3; stextshold = STORE_TAVERN; - gossipstart = QUEST_OGDEN2; - gossipend = QUEST_OGDEN10; + gossipstart = TEXT_OGDEN2; + gossipend = TEXT_OGDEN10; StartStore(STORE_GOSSIP); break; case 18: @@ -2647,8 +2647,8 @@ void S_BarmaidEnter() stextlhold = 12; talker = 7; stextshold = STORE_BARMAID; - gossipstart = QUEST_GILLIAN2; - gossipend = QUEST_GILLIAN10; + gossipstart = TEXT_GILLIAN2; + gossipend = TEXT_GILLIAN10; StartStore(STORE_GOSSIP); break; case 18: @@ -2664,8 +2664,8 @@ void S_DrunkEnter() stextlhold = 12; talker = 5; stextshold = STORE_DRUNK; - gossipstart = QUEST_FARNHAM2; - gossipend = QUEST_FARNHAM13; + gossipstart = TEXT_FARNHAM2; + gossipend = TEXT_FARNHAM13; StartStore(STORE_GOSSIP); break; case 18: diff --git a/Source/themes.cpp b/Source/themes.cpp index 4ebbf3b5..541e6355 100644 --- a/Source/themes.cpp +++ b/Source/themes.cpp @@ -431,7 +431,7 @@ void InitThemes() if (leveltype == DTYPE_CATACOMBS || leveltype == DTYPE_CAVES || leveltype == DTYPE_HELL) { for (i = 0; i < themeCount; i++) themes[i].ttype = THEME_NONE; - if (QuestStatus(QTYPE_ZHAR)) { + if (QuestStatus(Q_ZHAR)) { for (j = 0; j < themeCount; j++) { themes[j].ttval = themeLoc[j].ttval; if (SpecialThemeFit(j, THEME_LIBRARY)) { @@ -744,7 +744,7 @@ void Theme_Library(int t) } } - if (QuestStatus(QTYPE_ZHAR)) { + if (QuestStatus(Q_ZHAR)) { if (t == zharlib) { return; } diff --git a/Source/town.cpp b/Source/town.cpp index dc7904d5..148650e9 100644 --- a/Source/town.cpp +++ b/Source/town.cpp @@ -1623,7 +1623,7 @@ void T_Pass3() } #endif - if (quests[QTYPE_PW]._qactive != 3 && quests[QTYPE_PW]._qactive) { + if (quests[Q_PWATER]._qactive != QUEST_DONE && quests[Q_PWATER]._qactive) { T_FillTile(P3Tiles, 60, 70, 342); } else { T_FillTile(P3Tiles, 60, 70, 71); diff --git a/Source/towners.cpp b/Source/towners.cpp index 103271ef..6b8d6dd8 100644 --- a/Source/towners.cpp +++ b/Source/towners.cpp @@ -94,17 +94,17 @@ int cowoffy[8] = { -1, -1, -1, 0, -1, -1, -1, 0 }; QuestTalkData Qtalklist[11] = { // clang-format off // _qinfra, _qblkm, _qgarb, _qzhar, _qveil, _qmod, _qbutch, _qbol, _qblind, _qblood, _qanvil, _qwarlrd, _qking, _qpw, _qbone, _qvb - { QUEST_INFRA6, QUEST_MUSH6, -1, -1, QUEST_VEIL5, -1, QUEST_BUTCH5, QUEST_BANNER6, QUEST_BLIND5, QUEST_BLOOD5, QUEST_ANVIL6, QUEST_WARLRD5, QUEST_KING7, QUEST_POISON7, QUEST_BONE5, QUEST_VILE9 }, - { QUEST_INFRA3, -1, -1, -1, QUEST_VEIL3, -1, QUEST_BUTCH3, QUEST_BANNER4, QUEST_BLIND3, QUEST_BLOOD3, QUEST_ANVIL3, QUEST_WARLRD3, QUEST_KING5, QUEST_POISON4, QUEST_BONE3, QUEST_VILE7 }, + { TEXT_INFRA6, TEXT_MUSH6, -1, -1, TEXT_VEIL5, -1, TEXT_BUTCH5, TEXT_BANNER6, TEXT_BLIND5, TEXT_BLOOD5, TEXT_ANVIL6, TEXT_WARLRD5, TEXT_KING7, TEXT_POISON7, TEXT_BONE5, TEXT_VILE9 }, + { TEXT_INFRA3, -1, -1, -1, TEXT_VEIL3, -1, TEXT_BUTCH3, TEXT_BANNER4, TEXT_BLIND3, TEXT_BLOOD3, TEXT_ANVIL3, TEXT_WARLRD3, TEXT_KING5, TEXT_POISON4, TEXT_BONE3, TEXT_VILE7 }, { -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1 }, - { QUEST_INFRA2, QUEST_MUSH2, -1, -1, QUEST_VEIL2, -1, QUEST_BUTCH2, -1, QUEST_BLIND2, QUEST_BLOOD2, QUEST_ANVIL2, QUEST_WARLRD2, QUEST_KING3, QUEST_POISON2, QUEST_BONE2, QUEST_VILE4 }, - { QUEST_INFRA1, QUEST_MUSH1, -1, -1, QUEST_VEIL1, QUEST_VILE3, QUEST_BUTCH1, QUEST_BANNER1, QUEST_BLIND1, QUEST_BLOOD1, QUEST_ANVIL1, QUEST_WARLRD1, QUEST_KING1, QUEST_POISON1, QUEST_BONE1, QUEST_VILE2 }, - { QUEST_INFRA8, QUEST_MUSH7, -1, -1, QUEST_VEIL6, -1, QUEST_BUTCH6, QUEST_BANNER7, QUEST_BLIND6, QUEST_BLOOD6, QUEST_ANVIL8, QUEST_WARLRD6, QUEST_KING8, QUEST_POISON8, QUEST_BONE6, QUEST_VILE10 }, - { QUEST_INFRA9, QUEST_MUSH9, -1, -1, QUEST_VEIL7, -1, QUEST_BUTCH7, QUEST_BANNER8, QUEST_BLIND7, QUEST_BLOOD7, QUEST_ANVIL9, QUEST_WARLRD7, QUEST_KING9, QUEST_POISON9, QUEST_BONE7, QUEST_VILE11 }, - { QUEST_INFRA4, QUEST_MUSH5, -1, -1, QUEST_VEIL4, -1, QUEST_BUTCH4, QUEST_BANNER5, QUEST_BLIND4, QUEST_BLOOD4, QUEST_ANVIL4, QUEST_WARLRD4, QUEST_KING6, QUEST_POISON6, QUEST_BONE4, QUEST_VILE8 }, - { QUEST_INFRA10, QUEST_MUSH13, -1, -1, QUEST_VEIL8, -1, QUEST_BUTCH8, QUEST_BANNER9, QUEST_BLIND8, QUEST_BLOOD8, QUEST_ANVIL10,QUEST_WARLRD8, QUEST_KING10, QUEST_POISON10, QUEST_BONE8, QUEST_VILE12 }, + { TEXT_INFRA2, TEXT_MUSH2, -1, -1, TEXT_VEIL2, -1, TEXT_BUTCH2, -1, TEXT_BLIND2, TEXT_BLOOD2, TEXT_ANVIL2, TEXT_WARLRD2, TEXT_KING3, TEXT_POISON2, TEXT_BONE2, TEXT_VILE4 }, + { TEXT_INFRA1, TEXT_MUSH1, -1, -1, TEXT_VEIL1, TEXT_VILE3, TEXT_BUTCH1, TEXT_BANNER1, TEXT_BLIND1, TEXT_BLOOD1, TEXT_ANVIL1, TEXT_WARLRD1, TEXT_KING1, TEXT_POISON1, TEXT_BONE1, TEXT_VILE2 }, + { TEXT_INFRA8, TEXT_MUSH7, -1, -1, TEXT_VEIL6, -1, TEXT_BUTCH6, TEXT_BANNER7, TEXT_BLIND6, TEXT_BLOOD6, TEXT_ANVIL8, TEXT_WARLRD6, TEXT_KING8, TEXT_POISON8, TEXT_BONE6, TEXT_VILE10 }, + { TEXT_INFRA9, TEXT_MUSH9, -1, -1, TEXT_VEIL7, -1, TEXT_BUTCH7, TEXT_BANNER8, TEXT_BLIND7, TEXT_BLOOD7, TEXT_ANVIL9, TEXT_WARLRD7, TEXT_KING9, TEXT_POISON9, TEXT_BONE7, TEXT_VILE11 }, + { TEXT_INFRA4, TEXT_MUSH5, -1, -1, TEXT_VEIL4, -1, TEXT_BUTCH4, TEXT_BANNER5, TEXT_BLIND4, TEXT_BLOOD4, TEXT_ANVIL4, TEXT_WARLRD4, TEXT_KING6, TEXT_POISON6, TEXT_BONE4, TEXT_VILE8 }, + { TEXT_INFRA10, TEXT_MUSH13, -1, -1, TEXT_VEIL8, -1, TEXT_BUTCH8, TEXT_BANNER9, TEXT_BLIND8, TEXT_BLOOD8, TEXT_ANVIL10,TEXT_WARLRD8, TEXT_KING10, TEXT_POISON10, TEXT_BONE8, TEXT_VILE12 }, { -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1 }, - { QUEST_KING1, QUEST_KING1, QUEST_KING1, QUEST_KING1, QUEST_KING1, QUEST_KING1, QUEST_KING1, QUEST_KING1, QUEST_KING1, QUEST_KING1, QUEST_KING1, QUEST_KING1, QUEST_KING1, QUEST_KING1, QUEST_KING1, QUEST_KING1 } + { TEXT_KING1, TEXT_KING1, TEXT_KING1, TEXT_KING1, TEXT_KING1, TEXT_KING1, TEXT_KING1, TEXT_KING1, TEXT_KING1, TEXT_KING1, TEXT_KING1, TEXT_KING1, TEXT_KING1, TEXT_KING1, TEXT_KING1, TEXT_KING1 } // clang-format on }; int CowPlaying = -1; @@ -379,7 +379,7 @@ void InitTowners() boyloadflag = FALSE; InitSmith(); InitHealer(); - if (quests[QTYPE_BUTCH]._qactive && quests[QTYPE_BUTCH]._qactive != 3) + if (quests[Q_BUTCHER]._qactive && quests[Q_BUTCHER]._qactive != QUEST_DONE) InitTownDead(); InitBarOwner(); InitTeller(); @@ -446,7 +446,7 @@ void TownDead() tidx = GetActiveTowner(TOWN_DEADGUY); TownCtrlMsg(tidx); if (!qtextflag) { - if ((quests[QTYPE_BUTCH]._qactive != 2 || quests[QTYPE_BUTCH]._qlog) && quests[QTYPE_BUTCH]._qactive != 1) { + if ((quests[Q_BUTCHER]._qactive != QUEST_ACTIVE || quests[Q_BUTCHER]._qlog) && quests[Q_BUTCHER]._qactive != QUEST_INIT) { towner[tidx]._tAnimDelay = 1000; towner[tidx]._tAnimFrame = 1; strcpy(towner[tidx]._tName, "Slain Townsman"); @@ -454,7 +454,7 @@ void TownDead() return; } } - if (quests[QTYPE_BUTCH]._qactive != 1) + if (quests[Q_BUTCHER]._qactive != QUEST_INIT) towner[tidx]._tAnimCnt = 0; } @@ -625,68 +625,68 @@ void TalkToTowner(int p, int t) if (!plr[p]._pLvlVisited[0] && !towner[t]._tMsgSaid) { towner[t]._tbtcnt = 150; towner[t]._tVar1 = p; - InitQTextMsg(QUEST_INTRO); + InitQTextMsg(TEXT_INTRO); towner[t]._tMsgSaid = TRUE; } - if ((plr[p]._pLvlVisited[2] || plr[p]._pLvlVisited[4]) && quests[QTYPE_KING]._qactive != 0) { - if (quests[QTYPE_KING]._qvar2 == 0 && !towner[t]._tMsgSaid) { - quests[QTYPE_KING]._qvar2 = 1; - quests[QTYPE_KING]._qlog = TRUE; - if (quests[QTYPE_KING]._qactive == 1) { - quests[QTYPE_KING]._qactive = 2; - quests[QTYPE_KING]._qvar1 = 1; + if ((plr[p]._pLvlVisited[2] || plr[p]._pLvlVisited[4]) && quests[Q_SKELKING]._qactive != QUEST_NOTAVAIL) { + if (quests[Q_SKELKING]._qvar2 == 0 && !towner[t]._tMsgSaid) { + quests[Q_SKELKING]._qvar2 = 1; + quests[Q_SKELKING]._qlog = TRUE; + if (quests[Q_SKELKING]._qactive == QUEST_INIT) { + quests[Q_SKELKING]._qactive = QUEST_ACTIVE; + quests[Q_SKELKING]._qvar1 = 1; } towner[t]._tbtcnt = 150; towner[t]._tVar1 = p; - InitQTextMsg(QUEST_KING2); + InitQTextMsg(TEXT_KING2); towner[t]._tMsgSaid = TRUE; - NetSendCmdQuest(TRUE, QTYPE_KING); + NetSendCmdQuest(TRUE, Q_SKELKING); } - if (quests[QTYPE_KING]._qactive == 3 && quests[QTYPE_KING]._qvar2 == 1 && !towner[t]._tMsgSaid) { - quests[QTYPE_KING]._qvar2 = 2; - quests[QTYPE_KING]._qvar1 = 2; + if (quests[Q_SKELKING]._qactive == QUEST_DONE && quests[Q_SKELKING]._qvar2 == 1 && !towner[t]._tMsgSaid) { + quests[Q_SKELKING]._qvar2 = 2; + quests[Q_SKELKING]._qvar1 = 2; towner[t]._tbtcnt = 150; towner[t]._tVar1 = p; - InitQTextMsg(QUEST_KING4); + InitQTextMsg(TEXT_KING4); towner[t]._tMsgSaid = TRUE; - NetSendCmdQuest(TRUE, QTYPE_KING); + NetSendCmdQuest(TRUE, Q_SKELKING); } } - if (gbMaxPlayers == 1 && plr[p]._pLvlVisited[3] && quests[QTYPE_BOL]._qactive != 0) { - if ((quests[QTYPE_BOL]._qactive == 1 || quests[QTYPE_BOL]._qactive == 2) && quests[QTYPE_BOL]._qvar2 == 0 && !towner[t]._tMsgSaid) { - quests[QTYPE_BOL]._qvar2 = 1; - if (quests[QTYPE_BOL]._qactive == 1) { - quests[QTYPE_BOL]._qvar1 = 1; - quests[QTYPE_BOL]._qactive = 2; + if (gbMaxPlayers == 1 && plr[p]._pLvlVisited[3] && quests[Q_LTBANNER]._qactive != QUEST_NOTAVAIL) { + if ((quests[Q_LTBANNER]._qactive == QUEST_INIT || quests[Q_LTBANNER]._qactive == QUEST_ACTIVE) && quests[Q_LTBANNER]._qvar2 == 0 && !towner[t]._tMsgSaid) { + quests[Q_LTBANNER]._qvar2 = 1; + if (quests[Q_LTBANNER]._qactive == QUEST_INIT) { + quests[Q_LTBANNER]._qvar1 = 1; + quests[Q_LTBANNER]._qactive = QUEST_ACTIVE; } - quests[QTYPE_BOL]._qlog = TRUE; + quests[Q_LTBANNER]._qlog = TRUE; towner[t]._tbtcnt = 150; towner[t]._tVar1 = p; - InitQTextMsg(QUEST_BANNER2); + InitQTextMsg(TEXT_BANNER2); towner[t]._tMsgSaid = TRUE; } - if (quests[QTYPE_BOL]._qvar2 == 1 && PlrHasItem(p, IDI_BANNER, i) != NULL && !towner[t]._tMsgSaid) { - quests[QTYPE_BOL]._qactive = 3; - quests[QTYPE_BOL]._qvar1 = 3; + if (quests[Q_LTBANNER]._qvar2 == 1 && PlrHasItem(p, IDI_BANNER, i) != NULL && !towner[t]._tMsgSaid) { + quests[Q_LTBANNER]._qactive = QUEST_DONE; + quests[Q_LTBANNER]._qvar1 = 3; RemoveInvItem(p, i); CreateItem(UITEM_HARCREST, towner[t]._tx, towner[t]._ty + 1); towner[t]._tbtcnt = 150; towner[t]._tVar1 = p; - InitQTextMsg(QUEST_BANNER3); + InitQTextMsg(TEXT_BANNER3); towner[t]._tMsgSaid = TRUE; } } if (!qtextflag) { - TownerTalk(QUEST_OGDEN1, t); + TownerTalk(TEXT_OGDEN1, t); if (storeflag) { StartStore(STORE_TAVERN); } } } else if (t == GetActiveTowner(TOWN_DEADGUY)) { - if (quests[QTYPE_BUTCH]._qactive == 2 && quests[QTYPE_BUTCH]._qvar1 == 1) { + if (quests[Q_BUTCHER]._qactive == QUEST_ACTIVE && quests[Q_BUTCHER]._qvar1 == 1) { towner[t]._tbtcnt = 150; towner[t]._tVar1 = p; - quests[QTYPE_BUTCH]._qvar1 = 1; + quests[Q_BUTCHER]._qvar1 = 1; #ifndef SPAWN if (plr[p]._pClass == PC_WARRIOR && !effect_is_playing(PS_WARR8)) { PlaySFX(PS_WARR8); @@ -697,113 +697,113 @@ void TalkToTowner(int p, int t) } #endif towner[t]._tMsgSaid = TRUE; - } else if (quests[QTYPE_BUTCH]._qactive == 3 && quests[QTYPE_BUTCH]._qvar1 == 1) { - quests[QTYPE_BUTCH]._qvar1 = 1; + } else if (quests[Q_BUTCHER]._qactive == QUEST_DONE && quests[Q_BUTCHER]._qvar1 == 1) { + quests[Q_BUTCHER]._qvar1 = 1; towner[t]._tbtcnt = 150; towner[t]._tVar1 = p; towner[t]._tMsgSaid = TRUE; - } else if (quests[QTYPE_BUTCH]._qactive == 1 || quests[QTYPE_BUTCH]._qactive == 2 && quests[QTYPE_BUTCH]._qvar1 == 0) { - quests[QTYPE_BUTCH]._qactive = 2; - quests[QTYPE_BUTCH]._qlog = TRUE; - quests[QTYPE_BUTCH]._qmsg = QUEST_BUTCH9; - quests[QTYPE_BUTCH]._qvar1 = 1; + } else if (quests[Q_BUTCHER]._qactive == QUEST_INIT || quests[Q_BUTCHER]._qactive == QUEST_ACTIVE && quests[Q_BUTCHER]._qvar1 == 0) { + quests[Q_BUTCHER]._qactive = QUEST_ACTIVE; + quests[Q_BUTCHER]._qlog = TRUE; + quests[Q_BUTCHER]._qmsg = TEXT_BUTCH9; + quests[Q_BUTCHER]._qvar1 = 1; towner[t]._tbtcnt = 50; towner[t]._tVar1 = p; towner[t]._tVar2 = 3; - InitQTextMsg(QUEST_BUTCH9); + InitQTextMsg(TEXT_BUTCH9); towner[t]._tMsgSaid = TRUE; - NetSendCmdQuest(TRUE, QTYPE_BUTCH); + NetSendCmdQuest(TRUE, Q_BUTCHER); } } else if (t == GetActiveTowner(TOWN_SMITH)) { if (gbMaxPlayers == 1) { - if (plr[p]._pLvlVisited[4] && quests[QTYPE_INFRA]._qactive != 0) { - if (quests[QTYPE_INFRA]._qvar2 == 0) { - quests[QTYPE_INFRA]._qvar2 = 1; - quests[QTYPE_INFRA]._qlog = TRUE; - if (quests[QTYPE_INFRA]._qactive == 1) { - quests[QTYPE_INFRA]._qactive = 2; - quests[QTYPE_INFRA]._qvar1 = 1; + if (plr[p]._pLvlVisited[4] && quests[Q_ROCK]._qactive != QUEST_NOTAVAIL) { + if (quests[Q_ROCK]._qvar2 == 0) { + quests[Q_ROCK]._qvar2 = 1; + quests[Q_ROCK]._qlog = TRUE; + if (quests[Q_ROCK]._qactive == QUEST_INIT) { + quests[Q_ROCK]._qactive = QUEST_ACTIVE; + quests[Q_ROCK]._qvar1 = 1; } towner[t]._tbtcnt = 150; towner[t]._tVar1 = p; - InitQTextMsg(QUEST_INFRA5); + InitQTextMsg(TEXT_INFRA5); towner[t]._tMsgSaid = TRUE; } - if (quests[QTYPE_INFRA]._qvar2 == 1 && PlrHasItem(p, IDI_ROCK, i) != NULL && !towner[t]._tMsgSaid) { - quests[QTYPE_INFRA]._qactive = 3; - quests[QTYPE_INFRA]._qvar2 = 2; - quests[QTYPE_INFRA]._qvar1 = 2; + if (quests[Q_ROCK]._qvar2 == 1 && PlrHasItem(p, IDI_ROCK, i) != NULL && !towner[t]._tMsgSaid) { + quests[Q_ROCK]._qactive = QUEST_DONE; + quests[Q_ROCK]._qvar2 = 2; + quests[Q_ROCK]._qvar1 = 2; RemoveInvItem(p, i); CreateItem(UITEM_INFRARING, towner[t]._tx, towner[t]._ty + 1); towner[t]._tbtcnt = 150; towner[t]._tVar1 = p; - InitQTextMsg(QUEST_INFRA7); + InitQTextMsg(TEXT_INFRA7); towner[t]._tMsgSaid = TRUE; } } - if (plr[p]._pLvlVisited[9] && quests[QTYPE_ANVIL]._qactive != 0) { - if ((quests[QTYPE_ANVIL]._qactive == 1 || quests[QTYPE_ANVIL]._qactive == 2) && quests[QTYPE_ANVIL]._qvar2 == 0 && !towner[t]._tMsgSaid) { - if (quests[QTYPE_INFRA]._qvar2 == 2 || quests[QTYPE_INFRA]._qactive == 2 && quests[QTYPE_INFRA]._qvar2 == 1) { - quests[QTYPE_ANVIL]._qvar2 = 1; - quests[QTYPE_ANVIL]._qlog = TRUE; - if (quests[QTYPE_ANVIL]._qactive == 1) { - quests[QTYPE_ANVIL]._qactive = 2; - quests[QTYPE_ANVIL]._qvar1 = 1; + if (plr[p]._pLvlVisited[9] && quests[Q_ANVIL]._qactive != QUEST_NOTAVAIL) { + if ((quests[Q_ANVIL]._qactive == QUEST_INIT || quests[Q_ANVIL]._qactive == QUEST_ACTIVE) && quests[Q_ANVIL]._qvar2 == 0 && !towner[t]._tMsgSaid) { + if (quests[Q_ROCK]._qvar2 == 2 || quests[Q_ROCK]._qactive == QUEST_ACTIVE && quests[Q_ROCK]._qvar2 == 1) { + quests[Q_ANVIL]._qvar2 = 1; + quests[Q_ANVIL]._qlog = TRUE; + if (quests[Q_ANVIL]._qactive == QUEST_INIT) { + quests[Q_ANVIL]._qactive = QUEST_ACTIVE; + quests[Q_ANVIL]._qvar1 = 1; } towner[t]._tbtcnt = 150; towner[t]._tVar1 = p; - InitQTextMsg(QUEST_ANVIL5); + InitQTextMsg(TEXT_ANVIL5); towner[t]._tMsgSaid = TRUE; } } - if (quests[QTYPE_ANVIL]._qvar2 == 1 && PlrHasItem(p, IDI_ANVIL, i) != NULL) { + if (quests[Q_ANVIL]._qvar2 == 1 && PlrHasItem(p, IDI_ANVIL, i) != NULL) { if (!towner[t]._tMsgSaid) { - quests[QTYPE_ANVIL]._qactive = 3; - quests[QTYPE_ANVIL]._qvar2 = 2; - quests[QTYPE_ANVIL]._qvar1 = 2; + quests[Q_ANVIL]._qactive = QUEST_DONE; + quests[Q_ANVIL]._qvar2 = 2; + quests[Q_ANVIL]._qvar1 = 2; RemoveInvItem(p, i); CreateItem(UITEM_GRISWOLD, towner[t]._tx, towner[t]._ty + 1); towner[t]._tbtcnt = 150; towner[t]._tVar1 = p; - InitQTextMsg(QUEST_ANVIL7); + InitQTextMsg(TEXT_ANVIL7); towner[t]._tMsgSaid = TRUE; } } } } if (!qtextflag) { - TownerTalk(QUEST_GRISWOLD1, t); + TownerTalk(TEXT_GRISWOLD1, t); if (storeflag) { StartStore(STORE_SMITH); } } } else if (t == GetActiveTowner(TOWN_WITCH)) { - if (quests[QTYPE_BLKM]._qactive == 1 && PlrHasItem(p, IDI_FUNGALTM, i) != NULL) { + if (quests[Q_MUSHROOM]._qactive == QUEST_INIT && PlrHasItem(p, IDI_FUNGALTM, i) != NULL) { RemoveInvItem(p, i); - quests[QTYPE_BLKM]._qactive = 2; - quests[QTYPE_BLKM]._qlog = TRUE; - quests[QTYPE_BLKM]._qvar1 = 2; + quests[Q_MUSHROOM]._qactive = QUEST_ACTIVE; + quests[Q_MUSHROOM]._qlog = TRUE; + quests[Q_MUSHROOM]._qvar1 = 2; towner[t]._tbtcnt = 150; towner[t]._tVar1 = p; - InitQTextMsg(QUEST_MUSH8); + InitQTextMsg(TEXT_MUSH8); towner[t]._tMsgSaid = TRUE; - } else if (quests[QTYPE_BLKM]._qactive == 2) { - if (quests[QTYPE_BLKM]._qvar1 >= 2 && quests[QTYPE_BLKM]._qvar1 <= 4) { + } else if (quests[Q_MUSHROOM]._qactive == QUEST_ACTIVE) { + if (quests[Q_MUSHROOM]._qvar1 >= 2 && quests[Q_MUSHROOM]._qvar1 <= 4) { if (PlrHasItem(p, IDI_MUSHROOM, i) != NULL) { RemoveInvItem(p, i); - quests[QTYPE_BLKM]._qvar1 = 5; - Qtalklist[TOWN_HEALER]._qblkm = QUEST_MUSH3; + quests[Q_MUSHROOM]._qvar1 = 5; + Qtalklist[TOWN_HEALER]._qblkm = TEXT_MUSH3; Qtalklist[TOWN_WITCH]._qblkm = -1; towner[t]._tbtcnt = 150; towner[t]._tVar1 = p; - quests[QTYPE_BLKM]._qmsg = QUEST_MUSH10; - InitQTextMsg(QUEST_MUSH10); + quests[Q_MUSHROOM]._qmsg = TEXT_MUSH10; + InitQTextMsg(TEXT_MUSH10); towner[t]._tMsgSaid = TRUE; - } else if (quests[QTYPE_BLKM]._qmsg != QUEST_MUSH9) { + } else if (quests[Q_MUSHROOM]._qmsg != TEXT_MUSH9) { towner[t]._tbtcnt = 150; towner[t]._tVar1 = p; - quests[QTYPE_BLKM]._qmsg = QUEST_MUSH9; - InitQTextMsg(QUEST_MUSH9); + quests[Q_MUSHROOM]._qmsg = TEXT_MUSH9; + InitQTextMsg(TEXT_MUSH9); towner[t]._tMsgSaid = TRUE; } } else { @@ -811,35 +811,35 @@ void TalkToTowner(int p, int t) if (Item != NULL) { towner[t]._tbtcnt = 150; towner[t]._tVar1 = p; - InitQTextMsg(QUEST_MUSH12); - quests[QTYPE_BLKM]._qactive = 3; + InitQTextMsg(TEXT_MUSH12); + quests[Q_MUSHROOM]._qactive = QUEST_DONE; towner[t]._tMsgSaid = TRUE; AllItemsList[Item->IDidx].iUsable = TRUE; - } else if (PlrHasItem(p, IDI_BRAIN, i) != NULL && quests[QTYPE_BLKM]._qvar2 != QUEST_MUSH11) { + } else if (PlrHasItem(p, IDI_BRAIN, i) != NULL && quests[Q_MUSHROOM]._qvar2 != TEXT_MUSH11) { towner[t]._tbtcnt = 150; towner[t]._tVar1 = p; - quests[QTYPE_BLKM]._qvar2 = QUEST_MUSH11; - InitQTextMsg(QUEST_MUSH11); + quests[Q_MUSHROOM]._qvar2 = TEXT_MUSH11; + InitQTextMsg(TEXT_MUSH11); towner[t]._tMsgSaid = TRUE; } } } if (!qtextflag) { - TownerTalk(QUEST_ADRIA1, t); + TownerTalk(TEXT_ADRIA1, t); if (storeflag) { StartStore(STORE_WITCH); } } } else if (t == GetActiveTowner(TOWN_BMAID)) { if (!qtextflag) { - TownerTalk(QUEST_GILLIAN1, t); + TownerTalk(TEXT_GILLIAN1, t); if (storeflag) { StartStore(STORE_BARMAID); } } } else if (t == GetActiveTowner(TOWN_DRUNK)) { if (!qtextflag) { - TownerTalk(QUEST_FARNHAM1, t); + TownerTalk(TEXT_FARNHAM1, t); if (storeflag) { StartStore(STORE_DRUNK); } @@ -847,86 +847,86 @@ void TalkToTowner(int p, int t) } else if (t == GetActiveTowner(TOWN_HEALER)) { if (gbMaxPlayers == 1) { if (plr[p]._pLvlVisited[1] && !towner[t]._tMsgSaid) { - if (quests[QTYPE_PW]._qactive == 1) { - quests[QTYPE_PW]._qactive = 2; - quests[QTYPE_PW]._qlog = TRUE; - quests[QTYPE_PW]._qmsg = QUEST_POISON3; - quests[QTYPE_PW]._qvar1 = 1; + if (quests[Q_PWATER]._qactive == QUEST_INIT) { + quests[Q_PWATER]._qactive = QUEST_ACTIVE; + quests[Q_PWATER]._qlog = TRUE; + quests[Q_PWATER]._qmsg = TEXT_POISON3; + quests[Q_PWATER]._qvar1 = 1; towner[t]._tbtcnt = 150; towner[t]._tVar1 = p; - InitQTextMsg(QUEST_POISON3); + InitQTextMsg(TEXT_POISON3); towner[t]._tMsgSaid = TRUE; - } else if (quests[QTYPE_PW]._qactive == 3 && quests[QTYPE_PW]._qvar1 != 2) { - quests[QTYPE_PW]._qvar1 = 2; + } else if (quests[Q_PWATER]._qactive == QUEST_DONE && quests[Q_PWATER]._qvar1 != 2) { + quests[Q_PWATER]._qvar1 = 2; towner[t]._tbtcnt = 150; towner[t]._tVar1 = p; - InitQTextMsg(QUEST_POISON5); + InitQTextMsg(TEXT_POISON5); CreateItem(UITEM_TRING, towner[t]._tx, towner[t]._ty + 1); towner[t]._tMsgSaid = TRUE; } } - if (quests[QTYPE_BLKM]._qactive == 2 && quests[QTYPE_BLKM]._qmsg == QUEST_MUSH10 && PlrHasItem(p, IDI_BRAIN, i) != NULL) { + if (quests[Q_MUSHROOM]._qactive == QUEST_ACTIVE && quests[Q_MUSHROOM]._qmsg == TEXT_MUSH10 && PlrHasItem(p, IDI_BRAIN, i) != NULL) { RemoveInvItem(p, i); SpawnQuestItem(IDI_SPECELIX, towner[t]._tx, towner[t]._ty + 1, 0, 0); - InitQTextMsg(QUEST_MUSH4); - quests[QTYPE_BLKM]._qvar1 = 7; + InitQTextMsg(TEXT_MUSH4); + quests[Q_MUSHROOM]._qvar1 = 7; Qtalklist[TOWN_HEALER]._qblkm = -1; } } if (!qtextflag) { - TownerTalk(QUEST_PEPIN1, t); + TownerTalk(TEXT_PEPIN1, t); if (storeflag) { StartStore(STORE_HEALER); } } } else if (t == GetActiveTowner(TOWN_PEGBOY)) { if (!qtextflag) { - TownerTalk(QUEST_WIRT1, t); + TownerTalk(TEXT_WIRT1, t); if (storeflag) { StartStore(STORE_BOY); } } } else if (t == GetActiveTowner(TOWN_STORY)) { if (gbMaxPlayers == 1) { - if (quests[QTYPE_VB]._qactive == 1 && PlrHasItem(p, IDI_LAZSTAFF, i) != NULL) { + if (quests[Q_BETRAYER]._qactive == QUEST_INIT && PlrHasItem(p, IDI_LAZSTAFF, i) != NULL) { RemoveInvItem(p, i); - quests[QTYPE_VB]._qvar1 = 2; + quests[Q_BETRAYER]._qvar1 = 2; towner[t]._tbtcnt = 150; towner[t]._tVar1 = p; - InitQTextMsg(QUEST_VILE1); - quests[QTYPE_VB]._qactive = 2; - quests[QTYPE_VB]._qlog = TRUE; + InitQTextMsg(TEXT_VILE1); + quests[Q_BETRAYER]._qactive = QUEST_ACTIVE; + quests[Q_BETRAYER]._qlog = TRUE; towner[t]._tMsgSaid = TRUE; - } else if (quests[QTYPE_VB]._qactive == 3 && quests[QTYPE_VB]._qvar1 == 7) { - quests[QTYPE_VB]._qvar1 = 8; + } else if (quests[Q_BETRAYER]._qactive == QUEST_DONE && quests[Q_BETRAYER]._qvar1 == 7) { + quests[Q_BETRAYER]._qvar1 = 8; towner[t]._tbtcnt = 150; towner[t]._tVar1 = p; - InitQTextMsg(QUEST_VILE3); - quests[QTYPE_MOD]._qlog = TRUE; + InitQTextMsg(TEXT_VILE3); + quests[Q_DIABLO]._qlog = TRUE; towner[t]._tMsgSaid = TRUE; } } if (gbMaxPlayers != 1) { - if (quests[QTYPE_VB]._qactive == 2 && !quests[QTYPE_VB]._qlog) { + if (quests[Q_BETRAYER]._qactive == QUEST_ACTIVE && !quests[Q_BETRAYER]._qlog) { towner[t]._tbtcnt = 150; towner[t]._tVar1 = p; - InitQTextMsg(QUEST_VILE1); + InitQTextMsg(TEXT_VILE1); towner[t]._tMsgSaid = TRUE; - quests[QTYPE_VB]._qlog = TRUE; - NetSendCmdQuest(TRUE, QTYPE_VB); - } else if (quests[QTYPE_VB]._qactive == 3 && quests[QTYPE_VB]._qvar1 == 7) { - quests[QTYPE_VB]._qvar1 = 8; + quests[Q_BETRAYER]._qlog = TRUE; + NetSendCmdQuest(TRUE, Q_BETRAYER); + } else if (quests[Q_BETRAYER]._qactive == QUEST_DONE && quests[Q_BETRAYER]._qvar1 == 7) { + quests[Q_BETRAYER]._qvar1 = 8; towner[t]._tbtcnt = 150; towner[t]._tVar1 = p; - InitQTextMsg(QUEST_VILE3); + InitQTextMsg(TEXT_VILE3); towner[t]._tMsgSaid = TRUE; - NetSendCmdQuest(TRUE, QTYPE_VB); - quests[QTYPE_MOD]._qlog = TRUE; - NetSendCmdQuest(TRUE, QTYPE_MOD); + NetSendCmdQuest(TRUE, Q_BETRAYER); + quests[Q_DIABLO]._qlog = TRUE; + NetSendCmdQuest(TRUE, Q_DIABLO); } } if (!qtextflag) { - TownerTalk(QUEST_STORY1, t); + TownerTalk(TEXT_STORY1, t); if (storeflag) { StartStore(STORE_STORY); } diff --git a/Source/trigs.cpp b/Source/trigs.cpp index 04447c0b..c005a371 100644 --- a/Source/trigs.cpp +++ b/Source/trigs.cpp @@ -189,7 +189,7 @@ void InitL2Triggers() numtrigs = 0; for (j = 0; j < MAXDUNY; j++) { for (i = 0; i < MAXDUNX; i++) { - if (dPiece[i][j] == 267 && (i != quests[QTYPE_BONE]._qtx || j != quests[QTYPE_BONE]._qty)) { + if (dPiece[i][j] == 267 && (i != quests[Q_SCHAMB]._qtx || j != quests[Q_SCHAMB]._qty)) { trigs[numtrigs]._tx = i; trigs[numtrigs]._ty = j; trigs[numtrigs]._tmsg = WM_DIABPREVLVL; @@ -280,7 +280,7 @@ void InitL4Triggers() for (j = 0; j < MAXDUNY; j++) { for (i = 0; i < MAXDUNX; i++) { - if (dPiece[i][j] == 370 && quests[QTYPE_VB]._qactive == 3) { + if (dPiece[i][j] == 370 && quests[Q_BETRAYER]._qactive == QUEST_DONE) { trigs[numtrigs]._tx = i; trigs[numtrigs]._ty = j; trigs[numtrigs]._tmsg = WM_DIABNEXTLVL; @@ -612,7 +612,7 @@ BOOL ForceSKingTrig() for (i = 0; L1UpList[i] != -1; i++) { if (dPiece[cursmx][cursmy] == L1UpList[i]) { - sprintf(infostr, "Back to Level %i", quests[QTYPE_KING]._qlevel); + sprintf(infostr, "Back to Level %i", quests[Q_SKELKING]._qlevel); cursmx = trigs[0]._tx; cursmy = trigs[0]._ty; @@ -629,7 +629,7 @@ BOOL ForceSChambTrig() for (i = 0; L2DownList[i] != -1; i++) { if (dPiece[cursmx][cursmy] == L2DownList[i]) { - sprintf(infostr, "Back to Level %i", quests[QTYPE_BONE]._qlevel); + sprintf(infostr, "Back to Level %i", quests[Q_SCHAMB]._qlevel); cursmx = trigs[0]._tx; cursmy = trigs[0]._ty; @@ -646,7 +646,7 @@ BOOL ForcePWaterTrig() for (i = 0; L3DownList[i] != -1; i++) { if (dPiece[cursmx][cursmy] == L3DownList[i]) { - sprintf(infostr, "Back to Level %i", quests[QTYPE_PW]._qlevel); + sprintf(infostr, "Back to Level %i", quests[Q_PWATER]._qlevel); cursmx = trigs[0]._tx; cursmy = trigs[0]._ty; diff --git a/comparer-config/diablo.toml b/comparer-config/diablo.toml index 0ea60516..5a3b9c37 100644 --- a/comparer-config/diablo.toml +++ b/comparer-config/diablo.toml @@ -5243,7 +5243,7 @@ addr = 0x43BD19 size = 0xD2 [[func]] -name = "msg_process_net_packets" +name = "run_delta_info" addr = 0x43BDEB size = 0x22 @@ -5438,7 +5438,7 @@ addr = 0x43D064 size = 0x39 [[func]] -name = "RemovePlrPortal" +name = "delta_close_portal" addr = 0x43D09D size = 0x1F diff --git a/comparer-config/spawn.toml b/comparer-config/spawn.toml index 7d0685ef..ae5877e2 100644 --- a/comparer-config/spawn.toml +++ b/comparer-config/spawn.toml @@ -4653,7 +4653,7 @@ addr = 0x432327 size = 0xD2 [[func]] -name = "msg_process_net_packets" +name = "run_delta_info" addr = 0x4323F9 size = 0x22 @@ -4848,7 +4848,7 @@ addr = 0x433672 size = 0x39 [[func]] -name = "RemovePlrPortal" +name = "delta_close_portal" addr = 0x4336AB size = 0x1F diff --git a/enums.h b/enums.h index 257cb532..0ecfd684 100644 --- a/enums.h +++ b/enums.h @@ -1544,265 +1544,265 @@ typedef enum missile_resistance { } missile_resistance; typedef enum _speech_id { - QUEST_KING1 = 0x0, - QUEST_KING2 = 0x1, - QUEST_KING3 = 0x2, - QUEST_KING4 = 0x3, - QUEST_KING5 = 0x4, - QUEST_KING6 = 0x5, - QUEST_KING7 = 0x6, - QUEST_KING8 = 0x7, - QUEST_KING9 = 0x8, - QUEST_KING10 = 0x9, - QUEST_KING11 = 0xA, - QUEST_BANNER1 = 0xB, - QUEST_BANNER2 = 0xC, - QUEST_BANNER3 = 0xD, - QUEST_BANNER4 = 0xE, - QUEST_BANNER5 = 0xF, - QUEST_BANNER6 = 0x10, - QUEST_BANNER7 = 0x11, - QUEST_BANNER8 = 0x12, - QUEST_BANNER9 = 0x13, - QUEST_BANNER10 = 0x14, - QUEST_BANNER11 = 0x15, - QUEST_BANNER12 = 0x16, - QUEST_VILE1 = 0x17, - QUEST_VILE2 = 0x18, - QUEST_VILE3 = 0x19, - QUEST_VILE4 = 0x1A, - QUEST_VILE5 = 0x1B, - QUEST_VILE6 = 0x1C, - QUEST_VILE7 = 0x1D, - QUEST_VILE8 = 0x1E, - QUEST_VILE9 = 0x1F, - QUEST_VILE10 = 0x20, - QUEST_VILE11 = 0x21, - QUEST_VILE12 = 0x22, - QUEST_VILE13 = 0x23, - QUEST_VILE14 = 0x24, - QUEST_POISON1 = 0x25, - QUEST_POISON2 = 0x26, - QUEST_POISON3 = 0x27, - QUEST_POISON4 = 0x28, - QUEST_POISON5 = 0x29, - QUEST_POISON6 = 0x2A, - QUEST_POISON7 = 0x2B, - QUEST_POISON8 = 0x2C, - QUEST_POISON9 = 0x2D, - QUEST_POISON10 = 0x2E, - QUEST_BONE1 = 0x2F, - QUEST_BONE2 = 0x30, - QUEST_BONE3 = 0x31, - QUEST_BONE4 = 0x32, - QUEST_BONE5 = 0x33, - QUEST_BONE6 = 0x34, - QUEST_BONE7 = 0x35, - QUEST_BONE8 = 0x36, - QUEST_BUTCH1 = 0x37, - QUEST_BUTCH2 = 0x38, - QUEST_BUTCH3 = 0x39, - QUEST_BUTCH4 = 0x3A, - QUEST_BUTCH5 = 0x3B, - QUEST_BUTCH6 = 0x3C, - QUEST_BUTCH7 = 0x3D, - QUEST_BUTCH8 = 0x3E, - QUEST_BUTCH9 = 0x3F, - QUEST_BUTCH10 = 0x40, - QUEST_BLIND1 = 0x41, - QUEST_BLIND2 = 0x42, - QUEST_BLIND3 = 0x43, - QUEST_BLIND4 = 0x44, - QUEST_BLIND5 = 0x45, - QUEST_BLIND6 = 0x46, - QUEST_BLIND7 = 0x47, - QUEST_BLIND8 = 0x48, - QUEST_VEIL1 = 0x49, - QUEST_VEIL2 = 0x4A, - QUEST_VEIL3 = 0x4B, - QUEST_VEIL4 = 0x4C, - QUEST_VEIL5 = 0x4D, - QUEST_VEIL6 = 0x4E, - QUEST_VEIL7 = 0x4F, - QUEST_VEIL8 = 0x50, - QUEST_VEIL9 = 0x51, - QUEST_VEIL10 = 0x52, - QUEST_VEIL11 = 0x53, - QUEST_ANVIL1 = 0x54, - QUEST_ANVIL2 = 0x55, - QUEST_ANVIL3 = 0x56, - QUEST_ANVIL4 = 0x57, - QUEST_ANVIL5 = 0x58, - QUEST_ANVIL6 = 0x59, - QUEST_ANVIL7 = 0x5A, - QUEST_ANVIL8 = 0x5B, - QUEST_ANVIL9 = 0x5C, - QUEST_ANVIL10 = 0x5D, - QUEST_BLOOD1 = 0x5E, - QUEST_BLOOD2 = 0x5F, - QUEST_BLOOD3 = 0x60, - QUEST_BLOOD4 = 0x61, - QUEST_BLOOD5 = 0x62, - QUEST_BLOOD6 = 0x63, - QUEST_BLOOD7 = 0x64, - QUEST_BLOOD8 = 0x65, - QUEST_WARLRD1 = 0x66, - QUEST_WARLRD2 = 0x67, - QUEST_WARLRD3 = 0x68, - QUEST_WARLRD4 = 0x69, - QUEST_WARLRD5 = 0x6A, - QUEST_WARLRD6 = 0x6B, - QUEST_WARLRD7 = 0x6C, - QUEST_WARLRD8 = 0x6D, - QUEST_WARLRD9 = 0x6E, - QUEST_INFRA1 = 0x6F, - QUEST_INFRA2 = 0x70, - QUEST_INFRA3 = 0x71, - QUEST_INFRA4 = 0x72, - QUEST_INFRA5 = 0x73, - QUEST_INFRA6 = 0x74, - QUEST_INFRA7 = 0x75, - QUEST_INFRA8 = 0x76, - QUEST_INFRA9 = 0x77, - QUEST_INFRA10 = 0x78, - QUEST_MUSH1 = 0x79, - QUEST_MUSH2 = 0x7A, - QUEST_MUSH3 = 0x7B, - QUEST_MUSH4 = 0x7C, - QUEST_MUSH5 = 0x7D, - QUEST_MUSH6 = 0x7E, - QUEST_MUSH7 = 0x7F, - QUEST_MUSH8 = 0x80, - QUEST_MUSH9 = 0x81, - QUEST_MUSH10 = 0x82, - QUEST_MUSH11 = 0x83, - QUEST_MUSH12 = 0x84, - QUEST_MUSH13 = 0x85, - QUEST_DOOM1 = 0x86, - QUEST_DOOM2 = 0x87, - QUEST_DOOM3 = 0x88, - QUEST_DOOM4 = 0x89, - QUEST_DOOM5 = 0x8A, - QUEST_DOOM6 = 0x8B, - QUEST_DOOM7 = 0x8C, - QUEST_DOOM8 = 0x8D, - QUEST_DOOM9 = 0x8E, - QUEST_DOOM10 = 0x8F, - QUEST_GARBUD1 = 0x90, - QUEST_GARBUD2 = 0x91, - QUEST_GARBUD3 = 0x92, - QUEST_GARBUD4 = 0x93, - QUEST_ZHAR1 = 0x94, - QUEST_ZHAR2 = 0x95, - QUEST_STORY1 = 0x96, - QUEST_STORY2 = 0x97, - QUEST_STORY3 = 0x98, - QUEST_STORY4 = 0x99, - QUEST_STORY5 = 0x9A, - QUEST_STORY6 = 0x9B, - QUEST_STORY7 = 0x9C, - QUEST_STORY9 = 0x9D, - QUEST_STORY10 = 0x9E, - QUEST_STORY11 = 0x9F, - QUEST_OGDEN1 = 0xA0, - QUEST_OGDEN2 = 0xA1, - QUEST_OGDEN3 = 0xA2, - QUEST_OGDEN4 = 0xA3, - QUEST_OGDEN5 = 0xA4, - QUEST_OGDEN6 = 0xA5, - QUEST_OGDEN8 = 0xA6, - QUEST_OGDEN9 = 0xA7, - QUEST_OGDEN10 = 0xA8, - QUEST_PEPIN1 = 0xA9, - QUEST_PEPIN2 = 0xAA, - QUEST_PEPIN3 = 0xAB, - QUEST_PEPIN4 = 0xAC, - QUEST_PEPIN5 = 0xAD, - QUEST_PEPIN6 = 0xAE, - QUEST_PEPIN7 = 0xAF, - QUEST_PEPIN9 = 0xB0, - QUEST_PEPIN10 = 0xB1, - QUEST_PEPIN11 = 0xB2, - QUEST_GILLIAN1 = 0xB3, - QUEST_GILLIAN2 = 0xB4, - QUEST_GILLIAN3 = 0xB5, - QUEST_GILLIAN4 = 0xB6, - QUEST_GILLIAN5 = 0xB7, - QUEST_GILLIAN6 = 0xB8, - QUEST_GILLIAN7 = 0xB9, - QUEST_GILLIAN9 = 0xBA, - QUEST_GILLIAN10 = 0xBB, - QUEST_GRISWOLD1 = 0xBC, - QUEST_GRISWOLD2 = 0xBD, - QUEST_GRISWOLD3 = 0xBE, - QUEST_GRISWOLD4 = 0xBF, - QUEST_GRISWOLD5 = 0xC0, - QUEST_GRISWOLD6 = 0xC1, - QUEST_GRISWOLD7 = 0xC2, - QUEST_GRISWOLD8 = 0xC3, - QUEST_GRISWOLD9 = 0xC4, - QUEST_GRISWOLD10 = 0xC5, - QUEST_GRISWOLD12 = 0xC6, - QUEST_GRISWOLD13 = 0xC7, - QUEST_FARNHAM1 = 0xC8, - QUEST_FARNHAM2 = 0xC9, - QUEST_FARNHAM3 = 0xCA, - QUEST_FARNHAM4 = 0xCB, - QUEST_FARNHAM5 = 0xCC, - QUEST_FARNHAM6 = 0xCD, - QUEST_FARNHAM8 = 0xCE, - QUEST_FARNHAM9 = 0xCF, - QUEST_FARNHAM10 = 0xD0, - QUEST_FARNHAM11 = 0xD1, - QUEST_FARNHAM12 = 0xD2, - QUEST_FARNHAM13 = 0xD3, - QUEST_ADRIA1 = 0xD4, - QUEST_ADRIA2 = 0xD5, - QUEST_ADRIA3 = 0xD6, - QUEST_ADRIA4 = 0xD7, - QUEST_ADRIA5 = 0xD8, - QUEST_ADRIA6 = 0xD9, - QUEST_ADRIA7 = 0xDA, - QUEST_ADRIA8 = 0xDB, - QUEST_ADRIA9 = 0xDC, - QUEST_ADRIA10 = 0xDD, - QUEST_ADRIA12 = 0xDE, - QUEST_ADRIA13 = 0xDF, - QUEST_WIRT1 = 0xE0, - QUEST_WIRT2 = 0xE1, - QUEST_WIRT3 = 0xE2, - QUEST_WIRT4 = 0xE3, - QUEST_WIRT5 = 0xE4, - QUEST_WIRT6 = 0xE5, - QUEST_WIRT7 = 0xE6, - QUEST_WIRT8 = 0xE7, - QUEST_WIRT9 = 0xE8, - QUEST_WIRT11 = 0xE9, - QUEST_WIRT12 = 0xEA, - QUEST_BONER = 0xEB, - QUEST_BLOODY = 0xEC, - QUEST_BLINDING = 0xED, - QUEST_BLOODWAR = 0xEE, - QUEST_MBONER = 0xEF, - QUEST_MBLOODY = 0xF0, - QUEST_MBLINDING = 0xF1, - QUEST_MBLOODWAR = 0xF2, - QUEST_RBONER = 0xF3, - QUEST_RBLOODY = 0xF4, - QUEST_RBLINDING = 0xF5, - QUEST_RBLOODWAR = 0xF6, - QUEST_COW1 = 0xF7, - QUEST_COW2 = 0xF8, - QUEST_BOOK11 = 0xF9, - QUEST_BOOK12 = 0xFA, - QUEST_BOOK13 = 0xFB, - QUEST_BOOK21 = 0xFC, - QUEST_BOOK22 = 0xFD, - QUEST_BOOK23 = 0xFE, - QUEST_BOOK31 = 0xFF, - QUEST_BOOK32 = 0x100, - QUEST_BOOK33 = 0x101, - QUEST_INTRO = 0x102 + TEXT_KING1 = 0x0, + TEXT_KING2 = 0x1, + TEXT_KING3 = 0x2, + TEXT_KING4 = 0x3, + TEXT_KING5 = 0x4, + TEXT_KING6 = 0x5, + TEXT_KING7 = 0x6, + TEXT_KING8 = 0x7, + TEXT_KING9 = 0x8, + TEXT_KING10 = 0x9, + TEXT_KING11 = 0xA, + TEXT_BANNER1 = 0xB, + TEXT_BANNER2 = 0xC, + TEXT_BANNER3 = 0xD, + TEXT_BANNER4 = 0xE, + TEXT_BANNER5 = 0xF, + TEXT_BANNER6 = 0x10, + TEXT_BANNER7 = 0x11, + TEXT_BANNER8 = 0x12, + TEXT_BANNER9 = 0x13, + TEXT_BANNER10 = 0x14, + TEXT_BANNER11 = 0x15, + TEXT_BANNER12 = 0x16, + TEXT_VILE1 = 0x17, + TEXT_VILE2 = 0x18, + TEXT_VILE3 = 0x19, + TEXT_VILE4 = 0x1A, + TEXT_VILE5 = 0x1B, + TEXT_VILE6 = 0x1C, + TEXT_VILE7 = 0x1D, + TEXT_VILE8 = 0x1E, + TEXT_VILE9 = 0x1F, + TEXT_VILE10 = 0x20, + TEXT_VILE11 = 0x21, + TEXT_VILE12 = 0x22, + TEXT_VILE13 = 0x23, + TEXT_VILE14 = 0x24, + TEXT_POISON1 = 0x25, + TEXT_POISON2 = 0x26, + TEXT_POISON3 = 0x27, + TEXT_POISON4 = 0x28, + TEXT_POISON5 = 0x29, + TEXT_POISON6 = 0x2A, + TEXT_POISON7 = 0x2B, + TEXT_POISON8 = 0x2C, + TEXT_POISON9 = 0x2D, + TEXT_POISON10 = 0x2E, + TEXT_BONE1 = 0x2F, + TEXT_BONE2 = 0x30, + TEXT_BONE3 = 0x31, + TEXT_BONE4 = 0x32, + TEXT_BONE5 = 0x33, + TEXT_BONE6 = 0x34, + TEXT_BONE7 = 0x35, + TEXT_BONE8 = 0x36, + TEXT_BUTCH1 = 0x37, + TEXT_BUTCH2 = 0x38, + TEXT_BUTCH3 = 0x39, + TEXT_BUTCH4 = 0x3A, + TEXT_BUTCH5 = 0x3B, + TEXT_BUTCH6 = 0x3C, + TEXT_BUTCH7 = 0x3D, + TEXT_BUTCH8 = 0x3E, + TEXT_BUTCH9 = 0x3F, + TEXT_BUTCH10 = 0x40, + TEXT_BLIND1 = 0x41, + TEXT_BLIND2 = 0x42, + TEXT_BLIND3 = 0x43, + TEXT_BLIND4 = 0x44, + TEXT_BLIND5 = 0x45, + TEXT_BLIND6 = 0x46, + TEXT_BLIND7 = 0x47, + TEXT_BLIND8 = 0x48, + TEXT_VEIL1 = 0x49, + TEXT_VEIL2 = 0x4A, + TEXT_VEIL3 = 0x4B, + TEXT_VEIL4 = 0x4C, + TEXT_VEIL5 = 0x4D, + TEXT_VEIL6 = 0x4E, + TEXT_VEIL7 = 0x4F, + TEXT_VEIL8 = 0x50, + TEXT_VEIL9 = 0x51, + TEXT_VEIL10 = 0x52, + TEXT_VEIL11 = 0x53, + TEXT_ANVIL1 = 0x54, + TEXT_ANVIL2 = 0x55, + TEXT_ANVIL3 = 0x56, + TEXT_ANVIL4 = 0x57, + TEXT_ANVIL5 = 0x58, + TEXT_ANVIL6 = 0x59, + TEXT_ANVIL7 = 0x5A, + TEXT_ANVIL8 = 0x5B, + TEXT_ANVIL9 = 0x5C, + TEXT_ANVIL10 = 0x5D, + TEXT_BLOOD1 = 0x5E, + TEXT_BLOOD2 = 0x5F, + TEXT_BLOOD3 = 0x60, + TEXT_BLOOD4 = 0x61, + TEXT_BLOOD5 = 0x62, + TEXT_BLOOD6 = 0x63, + TEXT_BLOOD7 = 0x64, + TEXT_BLOOD8 = 0x65, + TEXT_WARLRD1 = 0x66, + TEXT_WARLRD2 = 0x67, + TEXT_WARLRD3 = 0x68, + TEXT_WARLRD4 = 0x69, + TEXT_WARLRD5 = 0x6A, + TEXT_WARLRD6 = 0x6B, + TEXT_WARLRD7 = 0x6C, + TEXT_WARLRD8 = 0x6D, + TEXT_WARLRD9 = 0x6E, + TEXT_INFRA1 = 0x6F, + TEXT_INFRA2 = 0x70, + TEXT_INFRA3 = 0x71, + TEXT_INFRA4 = 0x72, + TEXT_INFRA5 = 0x73, + TEXT_INFRA6 = 0x74, + TEXT_INFRA7 = 0x75, + TEXT_INFRA8 = 0x76, + TEXT_INFRA9 = 0x77, + TEXT_INFRA10 = 0x78, + TEXT_MUSH1 = 0x79, + TEXT_MUSH2 = 0x7A, + TEXT_MUSH3 = 0x7B, + TEXT_MUSH4 = 0x7C, + TEXT_MUSH5 = 0x7D, + TEXT_MUSH6 = 0x7E, + TEXT_MUSH7 = 0x7F, + TEXT_MUSH8 = 0x80, + TEXT_MUSH9 = 0x81, + TEXT_MUSH10 = 0x82, + TEXT_MUSH11 = 0x83, + TEXT_MUSH12 = 0x84, + TEXT_MUSH13 = 0x85, + TEXT_DOOM1 = 0x86, + TEXT_DOOM2 = 0x87, + TEXT_DOOM3 = 0x88, + TEXT_DOOM4 = 0x89, + TEXT_DOOM5 = 0x8A, + TEXT_DOOM6 = 0x8B, + TEXT_DOOM7 = 0x8C, + TEXT_DOOM8 = 0x8D, + TEXT_DOOM9 = 0x8E, + TEXT_DOOM10 = 0x8F, + TEXT_GARBUD1 = 0x90, + TEXT_GARBUD2 = 0x91, + TEXT_GARBUD3 = 0x92, + TEXT_GARBUD4 = 0x93, + TEXT_ZHAR1 = 0x94, + TEXT_ZHAR2 = 0x95, + TEXT_STORY1 = 0x96, + TEXT_STORY2 = 0x97, + TEXT_STORY3 = 0x98, + TEXT_STORY4 = 0x99, + TEXT_STORY5 = 0x9A, + TEXT_STORY6 = 0x9B, + TEXT_STORY7 = 0x9C, + TEXT_STORY9 = 0x9D, + TEXT_STORY10 = 0x9E, + TEXT_STORY11 = 0x9F, + TEXT_OGDEN1 = 0xA0, + TEXT_OGDEN2 = 0xA1, + TEXT_OGDEN3 = 0xA2, + TEXT_OGDEN4 = 0xA3, + TEXT_OGDEN5 = 0xA4, + TEXT_OGDEN6 = 0xA5, + TEXT_OGDEN8 = 0xA6, + TEXT_OGDEN9 = 0xA7, + TEXT_OGDEN10 = 0xA8, + TEXT_PEPIN1 = 0xA9, + TEXT_PEPIN2 = 0xAA, + TEXT_PEPIN3 = 0xAB, + TEXT_PEPIN4 = 0xAC, + TEXT_PEPIN5 = 0xAD, + TEXT_PEPIN6 = 0xAE, + TEXT_PEPIN7 = 0xAF, + TEXT_PEPIN9 = 0xB0, + TEXT_PEPIN10 = 0xB1, + TEXT_PEPIN11 = 0xB2, + TEXT_GILLIAN1 = 0xB3, + TEXT_GILLIAN2 = 0xB4, + TEXT_GILLIAN3 = 0xB5, + TEXT_GILLIAN4 = 0xB6, + TEXT_GILLIAN5 = 0xB7, + TEXT_GILLIAN6 = 0xB8, + TEXT_GILLIAN7 = 0xB9, + TEXT_GILLIAN9 = 0xBA, + TEXT_GILLIAN10 = 0xBB, + TEXT_GRISWOLD1 = 0xBC, + TEXT_GRISWOLD2 = 0xBD, + TEXT_GRISWOLD3 = 0xBE, + TEXT_GRISWOLD4 = 0xBF, + TEXT_GRISWOLD5 = 0xC0, + TEXT_GRISWOLD6 = 0xC1, + TEXT_GRISWOLD7 = 0xC2, + TEXT_GRISWOLD8 = 0xC3, + TEXT_GRISWOLD9 = 0xC4, + TEXT_GRISWOLD10 = 0xC5, + TEXT_GRISWOLD12 = 0xC6, + TEXT_GRISWOLD13 = 0xC7, + TEXT_FARNHAM1 = 0xC8, + TEXT_FARNHAM2 = 0xC9, + TEXT_FARNHAM3 = 0xCA, + TEXT_FARNHAM4 = 0xCB, + TEXT_FARNHAM5 = 0xCC, + TEXT_FARNHAM6 = 0xCD, + TEXT_FARNHAM8 = 0xCE, + TEXT_FARNHAM9 = 0xCF, + TEXT_FARNHAM10 = 0xD0, + TEXT_FARNHAM11 = 0xD1, + TEXT_FARNHAM12 = 0xD2, + TEXT_FARNHAM13 = 0xD3, + TEXT_ADRIA1 = 0xD4, + TEXT_ADRIA2 = 0xD5, + TEXT_ADRIA3 = 0xD6, + TEXT_ADRIA4 = 0xD7, + TEXT_ADRIA5 = 0xD8, + TEXT_ADRIA6 = 0xD9, + TEXT_ADRIA7 = 0xDA, + TEXT_ADRIA8 = 0xDB, + TEXT_ADRIA9 = 0xDC, + TEXT_ADRIA10 = 0xDD, + TEXT_ADRIA12 = 0xDE, + TEXT_ADRIA13 = 0xDF, + TEXT_WIRT1 = 0xE0, + TEXT_WIRT2 = 0xE1, + TEXT_WIRT3 = 0xE2, + TEXT_WIRT4 = 0xE3, + TEXT_WIRT5 = 0xE4, + TEXT_WIRT6 = 0xE5, + TEXT_WIRT7 = 0xE6, + TEXT_WIRT8 = 0xE7, + TEXT_WIRT9 = 0xE8, + TEXT_WIRT11 = 0xE9, + TEXT_WIRT12 = 0xEA, + TEXT_BONER = 0xEB, + TEXT_BLOODY = 0xEC, + TEXT_BLINDING = 0xED, + TEXT_BLOODWAR = 0xEE, + TEXT_MBONER = 0xEF, + TEXT_MBLOODY = 0xF0, + TEXT_MBLINDING = 0xF1, + TEXT_MBLOODWAR = 0xF2, + TEXT_RBONER = 0xF3, + TEXT_RBLOODY = 0xF4, + TEXT_RBLINDING = 0xF5, + TEXT_RBLOODWAR = 0xF6, + TEXT_COW1 = 0xF7, + TEXT_COW2 = 0xF8, + TEXT_BOOK11 = 0xF9, + TEXT_BOOK12 = 0xFA, + TEXT_BOOK13 = 0xFB, + TEXT_BOOK21 = 0xFC, + TEXT_BOOK22 = 0xFD, + TEXT_BOOK23 = 0xFE, + TEXT_BOOK31 = 0xFF, + TEXT_BOOK32 = 0x100, + TEXT_BOOK33 = 0x101, + TEXT_INTRO = 0x102 } _speech_id; typedef enum object_graphic_id { @@ -2458,7 +2458,7 @@ typedef enum item_misc_id { IMISC_RING = 0x19, IMISC_AMULET = 0x1A, IMISC_UNIQUE = 0x1B, - IMISC_HEAL_1C = 0x1C, + IMISC_MEAT = 0x1C, /* from demo/PSX */ IMISC_OILFIRST = 0x1D, IMISC_OILOF = 0x1E, /* oils are beta or hellfire only */ IMISC_OILACC = 0x1F, @@ -2493,7 +2493,7 @@ typedef enum item_type { ITYPE_GOLD = 0xB, ITYPE_RING = 0xC, ITYPE_AMULET = 0xD, - ITYPE_0E = 0xE, + ITYPE_MEAT = 0xE, /* used in demo, might be generic for 'food' */ ITYPE_NONE = -1, } item_type; @@ -2547,25 +2547,31 @@ typedef enum _setlevels { } _setlevels; typedef enum quest_id { - QTYPE_INFRA = 0x0, - QTYPE_BLKM = 0x1, - QTYPE_GARB = 0x2, - QTYPE_ZHAR = 0x3, - QTYPE_VEIL = 0x4, - QTYPE_MOD = 0x5, - QTYPE_BUTCH = 0x6, - QTYPE_BOL = 0x7, - QTYPE_BLIND = 0x8, - QTYPE_BLOOD = 0x9, - QTYPE_ANVIL = 0xA, - QTYPE_WARLRD = 0xB, - QTYPE_KING = 0xC, - QTYPE_PW = 0xD, - QTYPE_BONE = 0xE, - QTYPE_VB = 0xF, - QTYPE_INVALID = -1, + Q_ROCK = 0x0, + Q_MUSHROOM = 0x1, + Q_GARBUD = 0x2, + Q_ZHAR = 0x3, + Q_VEIL = 0x4, + Q_DIABLO = 0x5, + Q_BUTCHER = 0x6, + Q_LTBANNER = 0x7, + Q_BLIND = 0x8, + Q_BLOOD = 0x9, + Q_ANVIL = 0xA, + Q_WARLORD = 0xB, + Q_SKELKING = 0xC, + Q_PWATER = 0xD, + Q_SCHAMB = 0xE, + Q_BETRAYER = 0xF } quest_id; +typedef enum quest_state { + QUEST_NOTAVAIL = 0, + QUEST_INIT = 1, + QUEST_ACTIVE = 2, + QUEST_DONE = 3 +} quest_state; + typedef enum quest_mush_state { QS_INIT = 0, QS_TOMESPAWNED = 1, From e7bd82b44af56fac34bb9c06468179981157c7ec Mon Sep 17 00:00:00 2001 From: Anders Jenbo Date: Fri, 14 Feb 2020 03:58:40 +0100 Subject: [PATCH 11/14] A handful of param names and consts --- DiabloUI/_temp_funcs.h | 8 ++++---- DiabloUI/connect.cpp | 10 +++++----- DiabloUI/diabloui.h | 8 ++++---- DiabloUI/mainmenu.cpp | 4 ++-- Source/nthread.cpp | 2 +- 5 files changed, 16 insertions(+), 16 deletions(-) diff --git a/DiabloUI/_temp_funcs.h b/DiabloUI/_temp_funcs.h index a7c7a62a..17e057d2 100644 --- a/DiabloUI/_temp_funcs.h +++ b/DiabloUI/_temp_funcs.h @@ -76,7 +76,7 @@ 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); @@ -84,8 +84,8 @@ void __fastcall Connect_SetDiffString(_gamedata *gamedata, const char *str1, cha 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); @@ -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); diff --git a/DiabloUI/connect.cpp b/DiabloUI/connect.cpp index 1eb03e4a..58600228 100644 --- a/DiabloUI/connect.cpp +++ b/DiabloUI/connect.cpp @@ -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 @@ -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); @@ -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; @@ -847,7 +847,7 @@ 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); @@ -855,7 +855,7 @@ BOOL __stdcall UiCreatePlayerDescription(_uiheroinfo *info, int mode, char *desc } // 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); diff --git a/DiabloUI/diabloui.h b/DiabloUI/diabloui.h index 923a2639..4e93c744 100644 --- a/DiabloUI/diabloui.h +++ b/DiabloUI/diabloui.h @@ -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(); @@ -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); diff --git a/DiabloUI/mainmenu.cpp b/DiabloUI/mainmenu.cpp index fa3a2f45..64d32021 100644 --- a/DiabloUI/mainmenu.cpp +++ b/DiabloUI/mainmenu.cpp @@ -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; diff --git a/Source/nthread.cpp b/Source/nthread.cpp index ad7d43b2..43aa04c5 100644 --- a/Source/nthread.cpp +++ b/Source/nthread.cpp @@ -216,7 +216,7 @@ void nthread_cleanup() if (!sgbThreadIsRunning) sgMemCrit.Leave(); #endif - if (WaitForSingleObject(sghThread, 0xFFFFFFFF) == -1) { + if (WaitForSingleObject(sghThread, INFINITE) == -1) { app_fatal("nthread3:\n(%s)", TraceLastError()); } CloseHandle(sghThread); From c632e2d1d077ce48f6cf930a4ce48765af45f854 Mon Sep 17 00:00:00 2001 From: galaxyhaxz Date: Wed, 11 Mar 2020 22:32:53 -0500 Subject: [PATCH 12/14] Names and bug fixes (#1974) --- Source/control.cpp | 2 +- Source/control.h | 2 +- Source/drlg_l1.cpp | 4 +-- Source/drlg_l2.cpp | 20 ++++++------ Source/gendung.cpp | 26 ++++++++-------- Source/gendung.h | 10 +++--- Source/items.cpp | 2 +- Source/monster.cpp | 4 +-- Source/msg.cpp | 2 +- Source/msg.h | 2 +- Source/multi.cpp | 2 +- Source/objects.cpp | 62 ++++++++++++++++++------------------ Source/player.cpp | 6 ++-- Source/scrollrt.cpp | 22 ++++++------- Source/town.cpp | 76 ++++++++++++++++++++++----------------------- 15 files changed, 121 insertions(+), 121 deletions(-) diff --git a/Source/control.cpp b/Source/control.cpp index 01fce584..30f4ebf9 100644 --- a/Source/control.cpp +++ b/Source/control.cpp @@ -51,7 +51,7 @@ BOOL sbookflag; BOOL chrflag; BOOL drawbtnflag; BYTE *pSpellBkCel; -char infostr[MAX_PATH]; +char infostr[256]; int numpanbtns; BYTE *pStatusPanel; char panelstr[4][64]; diff --git a/Source/control.h b/Source/control.h index 0fa12609..7acced9b 100644 --- a/Source/control.h +++ b/Source/control.h @@ -45,7 +45,7 @@ extern BOOL sbookflag; extern BOOL chrflag; extern BOOL drawbtnflag; extern BYTE *pSpellBkCel; -extern char infostr[MAX_PATH]; +extern char infostr[256]; extern int numpanbtns; extern BYTE *pStatusPanel; extern char panelstr[4][64]; diff --git a/Source/drlg_l1.cpp b/Source/drlg_l1.cpp index 07f11519..655b4061 100644 --- a/Source/drlg_l1.cpp +++ b/Source/drlg_l1.cpp @@ -517,7 +517,7 @@ void DRLG_Init_Globals() memset(dObject, 0, sizeof(dObject)); memset(dItem, 0, sizeof(dItem)); memset(dMissile, 0, sizeof(dMissile)); - memset(dArch, 0, sizeof(dArch)); + memset(dSpecial, 0, sizeof(dSpecial)); if (!lightflag) { if (light4flag) c = 3; @@ -566,7 +566,7 @@ static void DRLG_InitL1Vals() } else { continue; } - dArch[i][j] = pc; + dSpecial[i][j] = pc; } } } diff --git a/Source/drlg_l2.cpp b/Source/drlg_l2.cpp index a3721d55..6ca20629 100644 --- a/Source/drlg_l2.cpp +++ b/Source/drlg_l2.cpp @@ -1965,17 +1965,17 @@ static void DRLG_InitL2Vals() } else { continue; } - dArch[i][j] = pc; + dSpecial[i][j] = pc; } } for (j = 0; j < MAXDUNY; j++) { for (i = 0; i < MAXDUNX; i++) { if (dPiece[i][j] == 132) { - dArch[i][j + 1] = 2; - dArch[i][j + 2] = 1; + dSpecial[i][j + 1] = 2; + dSpecial[i][j + 2] = 1; } else if (dPiece[i][j] == 135 || dPiece[i][j] == 139) { - dArch[i + 1][j] = 3; - dArch[i + 2][j] = 4; + dSpecial[i + 1][j] = 3; + dSpecial[i + 2][j] = 4; } } } @@ -2049,17 +2049,17 @@ void LoadL2Dungeon(char *sFileName, int vx, int vy) if (dPiece[i][j] == 17) { pc = 6; } - dArch[i][j] = pc; + dSpecial[i][j] = pc; } } for (j = 0; j < MAXDUNY; j++) { for (i = 0; i < MAXDUNX; i++) { if (dPiece[i][j] == 132) { - dArch[i][j + 1] = 2; - dArch[i][j + 2] = 1; + dSpecial[i][j + 1] = 2; + dSpecial[i][j + 2] = 1; } else if (dPiece[i][j] == 135 || dPiece[i][j] == 139) { - dArch[i + 1][j] = 3; - dArch[i + 2][j] = 4; + dSpecial[i + 1][j] = 3; + dSpecial[i + 2][j] = 4; } } } diff --git a/Source/gendung.cpp b/Source/gendung.cpp index 2f321f70..3133dc17 100644 --- a/Source/gendung.cpp +++ b/Source/gendung.cpp @@ -51,11 +51,11 @@ BYTE *pDungeonCels; int SpeedFrameTbl[128][16]; THEME_LOC themeLoc[MAXTHEMES]; char dPlayer[MAXDUNX][MAXDUNY]; -int dword_5C2FF8; -int dword_5C2FFC; -int scr_pix_width; -int scr_pix_height; -char dArch[MAXDUNX][MAXDUNY]; +int ViewBX; +int ViewBY; +int ViewDX; +int ViewDY; +char dSpecial[MAXDUNX][MAXDUNY]; /** * List of light blocking dPieces */ @@ -560,15 +560,15 @@ void SetDungeonMicros() SetSpeedCels(); if (zoomflag) { - scr_pix_width = SCREEN_WIDTH; - scr_pix_height = VIEWPORT_HEIGHT; - dword_5C2FF8 = SCREEN_WIDTH / 64; - dword_5C2FFC = VIEWPORT_HEIGHT / 32; + ViewDX = SCREEN_WIDTH; + ViewDY = VIEWPORT_HEIGHT; + ViewBX = SCREEN_WIDTH / 64; + ViewBY = VIEWPORT_HEIGHT / 32; } else { - scr_pix_width = ZOOM_WIDTH; - scr_pix_height = ZOOM_HEIGHT; - dword_5C2FF8 = ZOOM_WIDTH / 64; - dword_5C2FFC = ZOOM_HEIGHT / 32; + ViewDX = ZOOM_WIDTH; + ViewDY = ZOOM_HEIGHT; + ViewBX = ZOOM_WIDTH / 64; + ViewBY = ZOOM_HEIGHT / 32; } } diff --git a/Source/gendung.h b/Source/gendung.h index a32db1f5..3de61872 100644 --- a/Source/gendung.h +++ b/Source/gendung.h @@ -43,11 +43,11 @@ extern BYTE *pDungeonCels; extern int SpeedFrameTbl[128][16]; extern THEME_LOC themeLoc[MAXTHEMES]; extern char dPlayer[MAXDUNX][MAXDUNY]; -extern int dword_5C2FF8; -extern int dword_5C2FFC; -extern int scr_pix_width; -extern int scr_pix_height; -extern char dArch[MAXDUNX][MAXDUNY]; +extern int ViewBX; +extern int ViewBY; +extern int ViewDX; +extern int ViewDY; +extern char dSpecial[MAXDUNX][MAXDUNY]; extern BOOLEAN nBlockTable[2049]; extern BYTE *pSpecialCels; extern char dFlags[MAXDUNX][MAXDUNY]; diff --git a/Source/items.cpp b/Source/items.cpp index c339265e..b83a139d 100644 --- a/Source/items.cpp +++ b/Source/items.cpp @@ -1963,7 +1963,7 @@ int CheckUnique(int i, int lvl, int uper, BOOL recreate) if (!numu) return -1; - random_(29, 10); + random_(29, 10); /// BUGFIX: unused, last unique in array always gets chosen idata = 0; while (numu > 0) { if (uok[idata]) diff --git a/Source/monster.cpp b/Source/monster.cpp index 42503a00..d3c4527e 100644 --- a/Source/monster.cpp +++ b/Source/monster.cpp @@ -857,7 +857,7 @@ void PlaceGroup(int mtype, int num, int leaderf, int leader) } j = 0; - for (try2 = 0; j < num && try2 < 100; xp += offset_x[random_(94, 8)], yp += offset_x[random_(94, 8)]) { + for (try2 = 0; j < num && try2 < 100; xp += offset_x[random_(94, 8)], yp += offset_x[random_(94, 8)]) { /// BUGFIX: `yp += offset_y` if (!MonstPlace(xp, yp) || (dTransVal[xp][yp] != dTransVal[x1][y1]) || (leaderf & 2) && ((abs(xp - x1) >= 4) || (abs(yp - y1) >= 4))) { @@ -1222,7 +1222,7 @@ void M_CheckEFlag(int i) return; } - if (f | dArch[x][y]) + if (f | dSpecial[x][y]) monster[i]._meflag = TRUE; else { monster[i]._meflag = FALSE; diff --git a/Source/msg.cpp b/Source/msg.cpp index 3b95bc1c..77c1e4ab 100644 --- a/Source/msg.cpp +++ b/Source/msg.cpp @@ -22,7 +22,7 @@ static BOOLEAN sgbDeltaChanged; static BYTE sgbDeltaChunks; BOOL deltaload; BYTE gbBufferMsgs; -int pkt_counter; +int dwRecCount; void msg_send_drop_pkt(int pnum, int reason) { diff --git a/Source/msg.h b/Source/msg.h index 611933ab..7013723e 100644 --- a/Source/msg.h +++ b/Source/msg.h @@ -8,7 +8,7 @@ extern BOOL deltaload; extern BYTE gbBufferMsgs; -extern int pkt_counter; +extern int dwRecCount; void msg_send_drop_pkt(int pnum, int reason); void msg_send_packet(int pnum, const void *packet, DWORD dwSize); diff --git a/Source/multi.cpp b/Source/multi.cpp index a5752229..6de6af8f 100644 --- a/Source/multi.cpp +++ b/Source/multi.cpp @@ -454,7 +454,7 @@ void multi_process_network_packets() multi_clear_left_tbl(); multi_process_tmsgs(); while (SNetReceiveMessage((int *)&dwID, &data, (int *)&dwMsgSize)) { - pkt_counter++; + dwRecCount++; multi_clear_left_tbl(); pkt = (TPktHdr *)data; if (dwMsgSize < sizeof(TPktHdr)) diff --git a/Source/objects.cpp b/Source/objects.cpp index c9e094eb..2e9f3e46 100644 --- a/Source/objects.cpp +++ b/Source/objects.cpp @@ -1903,35 +1903,35 @@ void ObjL1Special(int x1, int y1, int x2, int y2) for (i = y1; i <= y2; ++i) { for (j = x1; j <= x2; ++j) { - dArch[j][i] = 0; + dSpecial[j][i] = 0; if (dPiece[j][i] == 12) - dArch[j][i] = 1; + dSpecial[j][i] = 1; if (dPiece[j][i] == 11) - dArch[j][i] = 2; + dSpecial[j][i] = 2; if (dPiece[j][i] == 71) - dArch[j][i] = 1; + dSpecial[j][i] = 1; if (dPiece[j][i] == 259) - dArch[j][i] = 5; + dSpecial[j][i] = 5; if (dPiece[j][i] == 249) - dArch[j][i] = 2; + dSpecial[j][i] = 2; if (dPiece[j][i] == 325) - dArch[j][i] = 2; + dSpecial[j][i] = 2; if (dPiece[j][i] == 321) - dArch[j][i] = 1; + dSpecial[j][i] = 1; if (dPiece[j][i] == 255) - dArch[j][i] = 4; + dSpecial[j][i] = 4; if (dPiece[j][i] == 211) - dArch[j][i] = 1; + dSpecial[j][i] = 1; if (dPiece[j][i] == 344) - dArch[j][i] = 2; + dSpecial[j][i] = 2; if (dPiece[j][i] == 341) - dArch[j][i] = 1; + dSpecial[j][i] = 1; if (dPiece[j][i] == 331) - dArch[j][i] = 2; + dSpecial[j][i] = 2; if (dPiece[j][i] == 418) - dArch[j][i] = 1; + dSpecial[j][i] = 1; if (dPiece[j][i] == 421) - dArch[j][i] = 2; + dSpecial[j][i] = 2; } } } @@ -1942,32 +1942,32 @@ void ObjL2Special(int x1, int y1, int x2, int y2) for (j = y1; j <= y2; j++) { for (i = x1; i <= x2; i++) { - dArch[i][j] = 0; + dSpecial[i][j] = 0; if (dPiece[i][j] == 541) - dArch[i][j] = 5; + dSpecial[i][j] = 5; if (dPiece[i][j] == 178) - dArch[i][j] = 5; + dSpecial[i][j] = 5; if (dPiece[i][j] == 551) - dArch[i][j] = 5; + dSpecial[i][j] = 5; if (dPiece[i][j] == 542) - dArch[i][j] = 6; + dSpecial[i][j] = 6; if (dPiece[i][j] == 553) - dArch[i][j] = 6; + dSpecial[i][j] = 6; if (dPiece[i][j] == 13) - dArch[i][j] = 5; + dSpecial[i][j] = 5; if (dPiece[i][j] == 17) - dArch[i][j] = 6; + dSpecial[i][j] = 6; } } for (j = y1; j <= y2; j++) { for (i = x1; i <= x2; i++) { if (dPiece[i][j] == 132) { - dArch[i][j + 1] = 2; - dArch[i][j + 2] = 1; + dSpecial[i][j + 1] = 2; + dSpecial[i][j + 2] = 1; } if (dPiece[i][j] == 135 || dPiece[i][j] == 139) { - dArch[i + 1][j] = 3; - dArch[i + 2][j] = 4; + dSpecial[i + 1][j] = 3; + dSpecial[i + 2][j] = 4; } } } @@ -2043,7 +2043,7 @@ void OperateL1RDoor(int pnum, int oi, BOOL sendflag) if (!deltaload) PlaySfxLoc(IS_DOOROPEN, object[oi]._ox, object[oi]._oy); ObjSetMicro(xp, yp, 395); - dArch[xp][yp] = 8; + dSpecial[xp][yp] = 8; objects_set_door_piece(xp, yp - 1); object[oi]._oAnimFrame += 2; object[oi]._oPreFlag = TRUE; @@ -2099,7 +2099,7 @@ void OperateL1LDoor(int pnum, int oi, BOOL sendflag) ObjSetMicro(xp, yp, 408); else ObjSetMicro(xp, yp, 393); - dArch[xp][yp] = 7; + dSpecial[xp][yp] = 7; objects_set_door_piece(xp - 1, yp); object[oi]._oAnimFrame += 2; object[oi]._oPreFlag = TRUE; @@ -4191,12 +4191,12 @@ void SyncL1Doors(int i) ObjSetMicro(x, y, 408); else ObjSetMicro(x, y, 393); - dArch[x][y] = 7; + dSpecial[x][y] = 7; objects_set_door_piece(x - 1, y); y--; } else { ObjSetMicro(x, y, 395); - dArch[x][y] = 8; + dSpecial[x][y] = 8; objects_set_door_piece(x, y - 1); x--; } diff --git a/Source/player.cpp b/Source/player.cpp index 01e1bc63..1fe8283a 100644 --- a/Source/player.cpp +++ b/Source/player.cpp @@ -966,7 +966,7 @@ void CheckEFlag(int pnum, BOOL flag) bitflags |= pieces->mt[i]; } - if (bitflags | nSolidTable[dPiece[x][y]] | dArch[x][y]) { + if (bitflags | nSolidTable[dPiece[x][y]] | dSpecial[x][y]) { plr[pnum]._peflag = 1; } else { plr[pnum]._peflag = 0; @@ -985,7 +985,7 @@ void CheckEFlag(int pnum, BOOL flag) bitflags |= pieces->mt[i]; } - if (bitflags | dArch[x][y]) { + if (bitflags | dSpecial[x][y]) { return; } @@ -998,7 +998,7 @@ void CheckEFlag(int pnum, BOOL flag) bitflags |= pieces->mt[i]; } - if (bitflags | dArch[x][y]) { + if (bitflags | dSpecial[x][y]) { plr[pnum]._peflag = 2; } } diff --git a/Source/scrollrt.cpp b/Source/scrollrt.cpp index 7a92d335..d56272dd 100644 --- a/Source/scrollrt.cpp +++ b/Source/scrollrt.cpp @@ -900,7 +900,7 @@ static void scrollrt_draw_clipped_dungeon(BYTE *pBuff, int sx, int sy, int dx, i bObj = dObject[sx][sy]; bItem = dItem[sx][sy]; bPlr = dPlayer[sx][sy]; - bArch = dArch[sx][sy]; + bArch = dSpecial[sx][sy]; bMap = dTransVal[sx][sy]; nMon = dMonster[sx][sy]; @@ -1365,7 +1365,7 @@ static void scrollrt_draw_clipped_dungeon_2(BYTE *pBuff, int sx, int sy, int row bObj = dObject[sx][sy]; bItem = dItem[sx][sy]; bPlr = dPlayer[sx][sy]; - bArch = dArch[sx][sy]; + bArch = dSpecial[sx][sy]; bMap = dTransVal[sx][sy]; nMon = dMonster[sx][sy]; @@ -1763,7 +1763,7 @@ static void scrollrt_draw_dungeon(BYTE *pBuff, int sx, int sy, int row, int CelC bObj = dObject[sx][sy]; bItem = dItem[sx][sy]; bPlr = dPlayer[sx][sy]; - bArch = dArch[sx][sy]; + bArch = dSpecial[sx][sy]; bMap = dTransVal[sx][sy]; nMon = dMonster[sx][sy]; @@ -2116,10 +2116,10 @@ static void DrawGame(int x, int y) { int i, sx, sy, chunks, blocks; - scr_pix_width = SCREEN_WIDTH; - scr_pix_height = VIEWPORT_HEIGHT; - dword_5C2FF8 = SCREEN_WIDTH / 64; - dword_5C2FFC = VIEWPORT_HEIGHT / 32; + ViewDX = SCREEN_WIDTH; + ViewDY = VIEWPORT_HEIGHT; + ViewBX = SCREEN_WIDTH / 64; + ViewBY = VIEWPORT_HEIGHT / 32; sx = ScrollInfo._sxoff + SCREEN_X; sy = ScrollInfo._syoff + SCREEN_Y + 15; @@ -2224,10 +2224,10 @@ static void DrawZoom(int x, int y) int i, sx, sy, chunks, blocks; int wdt, nSrcOff, nDstOff; - scr_pix_width = ZOOM_WIDTH; - scr_pix_height = ZOOM_HEIGHT - 32; - dword_5C2FF8 = ZOOM_WIDTH / 64; - dword_5C2FFC = (ZOOM_HEIGHT - 32) / 32; + ViewDX = ZOOM_WIDTH; + ViewDY = ZOOM_HEIGHT - 32; + ViewBX = ZOOM_WIDTH / 64; + ViewBY = (ZOOM_HEIGHT - 32) / 32; sx = ScrollInfo._sxoff + SCREEN_X; sy = ScrollInfo._syoff + SCREEN_Y - 17; diff --git a/Source/town.cpp b/Source/town.cpp index 148650e9..18c25a1c 100644 --- a/Source/town.cpp +++ b/Source/town.cpp @@ -488,8 +488,8 @@ void town_draw_clipped_town(BYTE *pBuff, int sx, int sy, int dx, int dy, int efl if (dFlags[sx][sy] & BFLAG_MISSILE) { DrawClippedMissile(sx, sy, dx, dy, 0, 8, 0); } - if (dArch[sx][sy] != 0) { - town_special_lower(pBuff, dArch[sx][sy]); + if (dSpecial[sx][sy] != 0) { + town_special_lower(pBuff, dSpecial[sx][sy]); } } @@ -702,8 +702,8 @@ void town_draw_clipped_town_2(BYTE *pBuff, int sx, int sy, int row, int CelSkip, if (dFlags[sx][sy] & BFLAG_MISSILE) { DrawClippedMissile(sx, sy, dx, dy, CelSkip, 8, 0); } - if (dArch[sx][sy] != 0) { - town_special_lower(&pBuff[PitchTbl[16 * CelSkip]], dArch[sx][sy]); + if (dSpecial[sx][sy] != 0) { + town_special_lower(&pBuff[PitchTbl[16 * CelSkip]], dSpecial[sx][sy]); } } @@ -929,8 +929,8 @@ void town_draw_town_all(BYTE *pBuff, int x, int y, int row, int CelCap, int sx, if (dFlags[x][y] & BFLAG_MISSILE) { DrawMissile(x, y, sx, sy, 0, CelCap, FALSE); } - if (dArch[x][y] != 0) { - town_special_upper(pBuff, dArch[x][y]); + if (dSpecial[x][y] != 0) { + town_special_upper(pBuff, dSpecial[x][y]); } } @@ -1049,10 +1049,10 @@ void T_DrawGame(int x, int y) { int i, sx, sy, chunks, blocks; - scr_pix_width = SCREEN_WIDTH; - scr_pix_height = VIEWPORT_HEIGHT; - dword_5C2FF8 = SCREEN_WIDTH / 64; - dword_5C2FFC = VIEWPORT_HEIGHT / 32; + ViewDX = SCREEN_WIDTH; + ViewDY = VIEWPORT_HEIGHT; + ViewBX = SCREEN_WIDTH / 64; + ViewBY = VIEWPORT_HEIGHT / 32; sx = ScrollInfo._sxoff + 64; sy = ScrollInfo._syoff + 175; @@ -1168,10 +1168,10 @@ void T_DrawZoom(int x, int y) int i, sx, sy, chunks, blocks; int wdt, nSrcOff, nDstOff; - scr_pix_width = ZOOM_WIDTH; - scr_pix_height = 192; - dword_5C2FF8 = ZOOM_WIDTH / 64; - dword_5C2FFC = 192 / 32; + ViewDX = ZOOM_WIDTH; + ViewDY = 192; + ViewBX = ZOOM_WIDTH / 64; + ViewBY = 192 / 32; sx = ScrollInfo._sxoff + 64; sy = ScrollInfo._syoff + 143; @@ -1424,15 +1424,15 @@ void SetTownMicros() } if (zoomflag) { - scr_pix_width = SCREEN_WIDTH; - scr_pix_height = VIEWPORT_HEIGHT; - dword_5C2FF8 = SCREEN_WIDTH / 64; - dword_5C2FFC = VIEWPORT_HEIGHT / 32; + ViewDX = SCREEN_WIDTH; + ViewDY = VIEWPORT_HEIGHT; + ViewBX = SCREEN_WIDTH / 64; + ViewBY = VIEWPORT_HEIGHT / 32; } else { - scr_pix_width = ZOOM_WIDTH; - scr_pix_height = ZOOM_HEIGHT; - dword_5C2FF8 = ZOOM_WIDTH / 64; - dword_5C2FFC = ZOOM_HEIGHT / 32; + ViewDX = ZOOM_WIDTH; + ViewDY = ZOOM_HEIGHT; + ViewBX = ZOOM_WIDTH / 64; + ViewBY = ZOOM_HEIGHT / 32; } } @@ -1673,40 +1673,40 @@ void CreateTown(int entry) memset(dMonster, 0, sizeof(dMonster)); memset(dObject, 0, sizeof(dObject)); memset(dItem, 0, sizeof(dItem)); - memset(dArch, 0, sizeof(dArch)); + memset(dSpecial, 0, sizeof(dSpecial)); for (y = 0; y < MAXDUNY; y++) { for (x = 0; x < MAXDUNX; x++) { if (dPiece[x][y] == 360) { - dArch[x][y] = 1; + dSpecial[x][y] = 1; } else if (dPiece[x][y] == 358) { - dArch[x][y] = 2; + dSpecial[x][y] = 2; } else if (dPiece[x][y] == 129) { - dArch[x][y] = 6; + dSpecial[x][y] = 6; } else if (dPiece[x][y] == 130) { - dArch[x][y] = 7; + dSpecial[x][y] = 7; } else if (dPiece[x][y] == 128) { - dArch[x][y] = 8; + dSpecial[x][y] = 8; } else if (dPiece[x][y] == 117) { - dArch[x][y] = 9; + dSpecial[x][y] = 9; } else if (dPiece[x][y] == 157) { - dArch[x][y] = 10; + dSpecial[x][y] = 10; } else if (dPiece[x][y] == 158) { - dArch[x][y] = 11; + dSpecial[x][y] = 11; } else if (dPiece[x][y] == 156) { - dArch[x][y] = 12; + dSpecial[x][y] = 12; } else if (dPiece[x][y] == 162) { - dArch[x][y] = 13; + dSpecial[x][y] = 13; } else if (dPiece[x][y] == 160) { - dArch[x][y] = 14; + dSpecial[x][y] = 14; } else if (dPiece[x][y] == 214) { - dArch[x][y] = 15; + dSpecial[x][y] = 15; } else if (dPiece[x][y] == 212) { - dArch[x][y] = 16; + dSpecial[x][y] = 16; } else if (dPiece[x][y] == 217) { - dArch[x][y] = 17; + dSpecial[x][y] = 17; } else if (dPiece[x][y] == 216) { - dArch[x][y] = 18; + dSpecial[x][y] = 18; } } } From f89204e7ddc81d1ca6ab5e64a8b91e09cf4e323a Mon Sep 17 00:00:00 2001 From: galaxyhaxz Date: Tue, 24 Mar 2020 00:22:36 -0500 Subject: [PATCH 13/14] Fix function/var names (effects/sound) --- Source/diablo.cpp | 16 ++++++------ Source/effects.cpp | 52 ++++++++++++++++++------------------- Source/effects.h | 16 ++++++------ Source/gamemenu.cpp | 4 +-- Source/interfac.cpp | 2 +- Source/movie.cpp | 2 +- Source/player.cpp | 2 +- Source/sound.cpp | 34 ++++++++++++------------ Source/sound.h | 4 +-- Source/stores.cpp | 10 +++---- Source/stores.h | 2 +- Source/towners.cpp | 2 +- comparer-config/diablo.toml | 20 +++++++------- comparer-config/spawn.toml | 20 +++++++------- 14 files changed, 93 insertions(+), 93 deletions(-) diff --git a/Source/diablo.cpp b/Source/diablo.cpp index ade09cc6..7a167b4b 100644 --- a/Source/diablo.cpp +++ b/Source/diablo.cpp @@ -86,7 +86,7 @@ void FreeGameMem() FreeMissiles(); FreeMonsters(); FreeObjectGFX(); - FreeEffects(); + FreeMonsterSnd(); FreeTownerGFX(); } @@ -286,7 +286,7 @@ int APIENTRY WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLi diablo_init_screen(); diablo_parse_flags(lpCmdLine); init_create_window(nCmdShow); - sound_init(); + ui_sound_init(); UiInitialize(); #ifdef SPAWN UiSetSpawned(TRUE); @@ -619,7 +619,7 @@ BOOL PressEscKey() if (qtextflag) { qtextflag = FALSE; - sfx_stop(); + stream_stop(); rv = TRUE; } else if (stextflag) { STextESC(); @@ -772,7 +772,7 @@ LRESULT CALLBACK GM_Game(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam) pfile_write_hero(); nthread_ignore_mutex(TRUE); PaletteFadeOut(8); - FreeMonsterSnd(); + sound_stop(); music_stop(); track_repeat_walk(FALSE); sgbMouseDown = 0; @@ -808,7 +808,7 @@ BOOL LeftMouseDown(int wParam) QuestlogESC(); } else if (qtextflag) { qtextflag = FALSE; - sfx_stop(); + stream_stop(); } else if (chrflag && MouseX < 320) { CheckChrBtns(); } else if (invflag && MouseX > RIGHT_PANEL) { @@ -1092,7 +1092,7 @@ void PressKey(int vkey) spselflag = FALSE; if (qtextflag && leveltype == DTYPE_TOWN) { qtextflag = FALSE; - sfx_stop(); + stream_stop(); } questlog = FALSE; automapflag = FALSE; @@ -1214,7 +1214,7 @@ void PressKey(int vkey) spselflag = FALSE; if (qtextflag && leveltype == DTYPE_TOWN) { qtextflag = FALSE; - sfx_stop(); + stream_stop(); } questlog = FALSE; automapflag = FALSE; @@ -1231,7 +1231,7 @@ void diablo_pause_game() PauseMode = 0; } else { PauseMode = 2; - FreeMonsterSnd(); + sound_stop(); track_repeat_walk(FALSE); } force_redraw = 255; diff --git a/Source/effects.cpp b/Source/effects.cpp index cfa3d203..d8c0b09b 100644 --- a/Source/effects.cpp +++ b/Source/effects.cpp @@ -8,8 +8,8 @@ int sfxdelay; int sfxdnum; -HANDLE sfx_stream; -TSFX *sfx_data_cur; +HANDLE sghStream; +TSFX *sgpStreamSFX; /** * Monster sound type prefix @@ -919,18 +919,18 @@ BOOL effect_is_playing(int nSFX) return snd_playing(sfx->pSnd); if (sfx->bFlags & SFX_STREAM) - return sfx == sfx_data_cur; + return sfx == sgpStreamSFX; return FALSE; } -void sfx_stop() +void stream_stop() { - if (sfx_stream) { - SFileDdaEnd(sfx_stream); - SFileCloseFile(sfx_stream); - sfx_stream = NULL; - sfx_data_cur = NULL; + if (sghStream) { + SFileDdaEnd(sghStream); + SFileCloseFile(sghStream); + sghStream = NULL; + sgpStreamSFX = NULL; } } @@ -961,7 +961,7 @@ void InitMonsterSND(int monst) } } -void FreeEffects() +void FreeMonsterSnd() { int mtype, i, j, k; char *file; @@ -1080,7 +1080,7 @@ void stream_play(TSFX *pSFX, int lVolume, int lPan) /// ASSERT: assert(pSFX); /// ASSERT: assert(pSFX->bFlags & sfx_STREAM); - sfx_stop(); + stream_stop(); lVolume += sound_get_or_set_sound_volume(1); if (lVolume >= VOLUME_MIN) { if (lVolume > VOLUME_MAX) @@ -1088,17 +1088,17 @@ void stream_play(TSFX *pSFX, int lVolume, int lPan) #ifdef _DEBUG SFileEnableDirectAccess(FALSE); #endif - success = SFileOpenFile(pSFX->pszName, &sfx_stream); + success = SFileOpenFile(pSFX->pszName, &sghStream); #ifdef _DEBUG SFileEnableDirectAccess(TRUE); #endif if (!success) { - sfx_stream = 0; + sghStream = 0; } else { - if (!SFileDdaBeginEx(sfx_stream, 0x40000, 0, 0, lVolume, lPan, 0)) - sfx_stop(); + if (!SFileDdaBeginEx(sghStream, 0x40000, 0, 0, lVolume, lPan, 0)) + stream_stop(); else - sfx_data_cur = pSFX; + sgpStreamSFX = pSFX; } } } @@ -1155,13 +1155,13 @@ void PlaySfxLoc(int psfx, int x, int y) PlaySFX_priv(&sgSFX[psfx], TRUE, x, y); } -void FreeMonsterSnd() +void sound_stop() { int i, j, k; snd_update(TRUE); + stream_stop(); sfx_stop(); - sound_stop(); for (i = 0; i < nummtypes; i++) { for (j = 0; j < 4; j++) { @@ -1172,7 +1172,7 @@ void FreeMonsterSnd() } } -void sound_stop() +void sfx_stop() { int i; TSFX *snd; @@ -1192,15 +1192,15 @@ void sound_update() } snd_update(FALSE); - effects_update(); + stream_update(); } -void effects_update() +void stream_update() { DWORD current, end; - if (sfx_stream != NULL && SFileDdaGetPos(sfx_stream, ¤t, &end) && current >= end) { - sfx_stop(); + if (sghStream != NULL && SFileDdaGetPos(sghStream, ¤t, &end) && current >= end) { + stream_stop(); } } @@ -1208,7 +1208,7 @@ void effects_cleanup_sfx() { DWORD i; - FreeMonsterSnd(); + sound_stop(); for (i = 0; i < sizeof(sgSFX) / sizeof(TSFX); i++) { if (sgSFX[i].pSnd) { @@ -1218,7 +1218,7 @@ void effects_cleanup_sfx() } } -void stream_update() +void sound_init() { BYTE mask = 0; if (gbMaxPlayers > 1) { @@ -1269,7 +1269,7 @@ void priv_sound_init(BYTE bLoadMask) } } -void sound_init() +void ui_sound_init() { priv_sound_init(SFX_UI); } diff --git a/Source/effects.h b/Source/effects.h index 5aa3ddbc..46aeb95d 100644 --- a/Source/effects.h +++ b/Source/effects.h @@ -8,13 +8,13 @@ extern int sfxdelay; extern int sfxdnum; -extern HANDLE sfx_stream; -extern TSFX *sfx_data_cur; +extern HANDLE sghStream; +extern TSFX *sgpStreamSFX; BOOL effect_is_playing(int nSFX); -void sfx_stop(); +void stream_stop(); void InitMonsterSND(int monst); -void FreeEffects(); +void FreeMonsterSnd(); void PlayEffect(int i, int mode); BOOL calc_snd_position(int x, int y, int *plVolume, int *plPan); void PlaySFX(int psfx); @@ -22,14 +22,14 @@ void PlaySFX_priv(TSFX *pSFX, BOOL loc, int x, int y); void stream_play(TSFX *pSFX, int lVolume, int lPan); int RndSFX(int psfx); void PlaySfxLoc(int psfx, int x, int y); -void FreeMonsterSnd(); void sound_stop(); +void sfx_stop(); void sound_update(); -void effects_update(); -void effects_cleanup_sfx(); void stream_update(); -void priv_sound_init(BYTE bLoadMask); +void effects_cleanup_sfx(); void sound_init(); +void priv_sound_init(BYTE bLoadMask); +void ui_sound_init(); void __stdcall effects_play_sound(char *snd_file); /* rdata */ diff --git a/Source/gamemenu.cpp b/Source/gamemenu.cpp index 16a14434..1545fa20 100644 --- a/Source/gamemenu.cpp +++ b/Source/gamemenu.cpp @@ -262,7 +262,7 @@ void gamemenu_sound_volume(BOOL bActivate) if (bActivate) { if (gbSoundOn) { gbSoundOn = FALSE; - FreeMonsterSnd(); + sound_stop(); sound_get_or_set_sound_volume(VOLUME_MIN); } else { gbSoundOn = TRUE; @@ -274,7 +274,7 @@ void gamemenu_sound_volume(BOOL bActivate) if (volume == VOLUME_MIN) { if (gbSoundOn) { gbSoundOn = FALSE; - FreeMonsterSnd(); + sound_stop(); } } else if (!gbSoundOn) { gbSoundOn = TRUE; diff --git a/Source/interfac.cpp b/Source/interfac.cpp index c5be1d43..8c987f12 100644 --- a/Source/interfac.cpp +++ b/Source/interfac.cpp @@ -87,7 +87,7 @@ void ShowProgress(unsigned int uMsg) DrawCutscene(); PaletteFadeIn(8); IncProgress(); - stream_update(); + sound_init(); IncProgress(); switch (uMsg) { diff --git a/Source/movie.cpp b/Source/movie.cpp index d9058671..1e3f8129 100644 --- a/Source/movie.cpp +++ b/Source/movie.cpp @@ -25,7 +25,7 @@ void play_movie(char *pszMovie, BOOL user_can_close) UpdateWindow(ghMainWnd); movie_playing = TRUE; sound_disable_music(TRUE); - sfx_stop(); + stream_stop(); effects_play_sound("Sfx\\Misc\\blank.wav"); SVidPlayBegin(pszMovie, 0, 0, 0, 0, loop_movie ? 0x100C0808 : 0x10280808, &video_stream); diff --git a/Source/player.cpp b/Source/player.cpp index 1fe8283a..c89c5f19 100644 --- a/Source/player.cpp +++ b/Source/player.cpp @@ -1988,7 +1988,7 @@ void InitLevelChange(int pnum) RemovePlrMissiles(pnum); if (pnum == myplr && qtextflag) { qtextflag = FALSE; - sfx_stop(); + stream_stop(); } RemovePlrFromMap(pnum); diff --git a/Source/sound.cpp b/Source/sound.cpp index b7de83ae..3f8fb33f 100644 --- a/Source/sound.cpp +++ b/Source/sound.cpp @@ -7,7 +7,7 @@ BOOLEAN gbSndInited; int sglMusicVolume; int sglSoundVolume; HMODULE hDsound_dll; -HANDLE sgpMusicTrack; +HANDLE sghMusic; LPDIRECTSOUNDBUFFER sglpDSB; /* data */ @@ -306,10 +306,10 @@ void sound_file_cleanup(TSnd *sound_file) void snd_init(HWND hWnd) { int error_code; - sound_load_volume("Sound Volume", &sglSoundVolume); + snd_get_volume("Sound Volume", &sglSoundVolume); gbSoundOn = sglSoundVolume > VOLUME_MIN; - sound_load_volume("Music Volume", &sglMusicVolume); + snd_get_volume("Music Volume", &sglMusicVolume); gbMusicOn = sglMusicVolume > VOLUME_MIN; error_code = sound_DirectSoundCreate(NULL, &sglpDS, NULL); @@ -329,7 +329,7 @@ void snd_init(HWND hWnd) gbSndInited = sglpDS != NULL; } -void sound_load_volume(char *value_name, int *value) +void snd_get_volume(char *value_name, int *value) { int v = *value; if (!SRegLoadValue("Diablo", value_name, 0, &v)) { @@ -433,22 +433,22 @@ void sound_cleanup() if (gbSndInited) { gbSndInited = FALSE; - sound_store_volume("Sound Volume", sglSoundVolume); - sound_store_volume("Music Volume", sglMusicVolume); + snd_set_volume("Sound Volume", sglSoundVolume); + snd_set_volume("Music Volume", sglMusicVolume); } } -void sound_store_volume(char *key, int value) +void snd_set_volume(char *key, int value) { SRegSaveValue("Diablo", key, 0, value); } void music_stop() { - if (sgpMusicTrack) { - SFileDdaEnd(sgpMusicTrack); - SFileCloseFile(sgpMusicTrack); - sgpMusicTrack = NULL; + if (sghMusic) { + SFileDdaEnd(sghMusic); + SFileCloseFile(sghMusic); + sghMusic = NULL; sgnMusicTrack = NUM_MUSIC; } } @@ -463,15 +463,15 @@ void music_start(int nTrack) #ifdef _DEBUG SFileEnableDirectAccess(FALSE); #endif - success = SFileOpenFile(sgszMusicTracks[nTrack], &sgpMusicTrack); + success = SFileOpenFile(sgszMusicTracks[nTrack], &sghMusic); #ifdef _DEBUG SFileEnableDirectAccess(TRUE); #endif - sound_create_primary_buffer(sgpMusicTrack); + sound_create_primary_buffer(sghMusic); if (!success) { - sgpMusicTrack = NULL; + sghMusic = NULL; } else { - SFileDdaBeginEx(sgpMusicTrack, 0x40000, 0x40000, 0, sglMusicVolume, 0, 0); + SFileDdaBeginEx(sghMusic, 0x40000, 0x40000, 0, sglMusicVolume, 0, 0); sgnMusicTrack = nTrack; } } @@ -493,8 +493,8 @@ int sound_get_or_set_music_volume(int volume) sglMusicVolume = volume; - if (sgpMusicTrack) - SFileDdaSetVolume(sgpMusicTrack, volume, 0); + if (sghMusic) + SFileDdaSetVolume(sghMusic, volume, 0); return sglMusicVolume; } diff --git a/Source/sound.h b/Source/sound.h index f584f4e7..bd14be41 100644 --- a/Source/sound.h +++ b/Source/sound.h @@ -16,11 +16,11 @@ TSnd *sound_file_load(char *path); void sound_CreateSoundBuffer(TSnd *sound_file); void sound_file_cleanup(TSnd *sound_file); void snd_init(HWND hWnd); -void sound_load_volume(char *value_name, int *value); +void snd_get_volume(char *value_name, int *value); void sound_create_primary_buffer(HANDLE music_track); HRESULT sound_DirectSoundCreate(LPGUID lpGuid, LPDIRECTSOUND *ppDS, LPUNKNOWN pUnkOuter); void sound_cleanup(); -void sound_store_volume(char *key, int value); +void snd_set_volume(char *key, int value); void music_stop(); void music_start(int nTrack); void sound_disable_music(BOOL disable); diff --git a/Source/stores.cpp b/Source/stores.cpp index fa02dbee..5dfe2d8b 100644 --- a/Source/stores.cpp +++ b/Source/stores.cpp @@ -242,7 +242,7 @@ void DrawSLine(int y) #endif } -void DrawSArrows(int y1, int y2) +void DrawSSlider(int y1, int y2) { int yd1, yd2, yd3; @@ -1583,7 +1583,7 @@ void DrawSText() } if (stextscrl) - DrawSArrows(4, 20); + DrawSSlider(4, 20); InStoreFlag = (InStoreFlag & 7) + 1; } @@ -1593,7 +1593,7 @@ void STextESC() if (qtextflag) { qtextflag = FALSE; if (leveltype == DTYPE_TOWN) - sfx_stop(); + stream_stop(); } else { switch (stextflag) { case STORE_SMITH: @@ -2679,7 +2679,7 @@ void STextEnter() if (qtextflag) { qtextflag = FALSE; if (leveltype == DTYPE_TOWN) - sfx_stop(); + stream_stop(); } else { PlaySFX(IS_TITLSLCT); switch (stextflag) { @@ -2763,7 +2763,7 @@ void CheckStoreBtn() if (qtextflag) { qtextflag = FALSE; if (leveltype == DTYPE_TOWN) - sfx_stop(); + stream_stop(); } else if (stextsel != -1 && MouseY >= 32 && MouseY <= 320) { if (!stextsize) { if (MouseX < 344 + PANEL_LEFT || MouseX > 616 + PANEL_LEFT) diff --git a/Source/stores.h b/Source/stores.h index 90e6ab0e..88c11ddf 100644 --- a/Source/stores.h +++ b/Source/stores.h @@ -42,7 +42,7 @@ void FreeStoreMem(); void DrawSTextBack(); void PrintSString(int x, int y, BOOL cjustflag, char *str, char col, int val); void DrawSLine(int y); -void DrawSArrows(int y1, int y2); +void DrawSSlider(int y1, int y2); void DrawSTextHelp(); void ClearSText(int s, int e); void AddSLine(int y); diff --git a/Source/towners.cpp b/Source/towners.cpp index 6b8d6dd8..b8f502ee 100644 --- a/Source/towners.cpp +++ b/Source/towners.cpp @@ -418,7 +418,7 @@ void TownCtrlMsg(int i) towner[i]._tbtcnt = 0; if (!towner[i]._tbtcnt) { qtextflag = FALSE; - sfx_stop(); + stream_stop(); } } } diff --git a/comparer-config/diablo.toml b/comparer-config/diablo.toml index 5a3b9c37..41c12fd3 100644 --- a/comparer-config/diablo.toml +++ b/comparer-config/diablo.toml @@ -1628,7 +1628,7 @@ addr = 0x4158B9 size = 0x29 [[func]] -name = "sfx_stop" +name = "stream_stop" addr = 0x4158E2 size = 0x29 @@ -1638,7 +1638,7 @@ addr = 0x41590B size = 0xD0 [[func]] -name = "FreeEffects" +name = "FreeMonsterSnd" addr = 0x4159DB size = 0x6A @@ -1678,12 +1678,12 @@ addr = 0x415D01 size = 0x38 [[func]] -name = "FreeMonsterSnd" +name = "sound_stop" addr = 0x415D39 size = 0x61 [[func]] -name = "sound_stop" +name = "sfx_stop" addr = 0x415D9A size = 0x20 @@ -1693,7 +1693,7 @@ addr = 0x415DBA size = 0x16 [[func]] -name = "effects_update" +name = "stream_update" addr = 0x415DD0 size = 0x2F @@ -1703,7 +1703,7 @@ addr = 0x415DFF size = 0x2B [[func]] -name = "stream_update" +name = "sound_init" addr = 0x415E2A size = 0x4D @@ -1713,7 +1713,7 @@ addr = 0x415E77 size = 0x61 [[func]] -name = "sound_init" +name = "ui_sound_init" addr = 0x415ED8 size = 0x7 @@ -8153,7 +8153,7 @@ addr = 0x45708B size = 0xA0 [[func]] -name = "sound_load_volume" +name = "snd_get_volume" addr = 0x45712B size = 0x51 @@ -8173,7 +8173,7 @@ addr = 0x4572FF size = 0x59 [[func]] -name = "sound_store_volume" +name = "snd_set_volume" addr = 0x457358 size = 0xF @@ -8268,7 +8268,7 @@ addr = 0x457DE2 size = 0x80 [[func]] -name = "DrawSArrows" +name = "DrawSSlider" addr = 0x457E62 size = 0xF0 diff --git a/comparer-config/spawn.toml b/comparer-config/spawn.toml index ae5877e2..5a6fd8cb 100644 --- a/comparer-config/spawn.toml +++ b/comparer-config/spawn.toml @@ -1098,7 +1098,7 @@ addr = 0x40D741 size = 0x29 [[func]] -name = "sfx_stop" +name = "stream_stop" addr = 0x40D76A size = 0x29 @@ -1108,7 +1108,7 @@ addr = 0x40D793 size = 0xD0 [[func]] -name = "FreeEffects" +name = "FreeMonsterSnd" addr = 0x40D863 size = 0x6A @@ -1148,12 +1148,12 @@ addr = 0x40DB71 size = 0x38 [[func]] -name = "FreeMonsterSnd" +name = "sound_stop" addr = 0x40DBA9 size = 0x61 [[func]] -name = "sound_stop" +name = "sfx_stop" addr = 0x40DC0A size = 0x20 @@ -1163,7 +1163,7 @@ addr = 0x40DC2A size = 0x16 [[func]] -name = "effects_update" +name = "stream_update" addr = 0x40DC40 size = 0x2F @@ -1173,7 +1173,7 @@ addr = 0x40DC6F size = 0x2B [[func]] -name = "stream_update" +name = "sound_init" addr = 0x40DC9A size = 0x4D @@ -1183,7 +1183,7 @@ addr = 0x40DCE7 size = 0x61 [[func]] -name = "sound_init" +name = "ui_sound_init" addr = 0x40DD48 size = 0x7 @@ -7528,7 +7528,7 @@ addr = 0x44C454 size = 0xA0 [[func]] -name = "sound_load_volume" +name = "snd_get_volume" addr = 0x44C4F4 size = 0x51 @@ -7548,7 +7548,7 @@ addr = 0x44C6C8 size = 0x59 [[func]] -name = "sound_store_volume" +name = "snd_set_volume" addr = 0x44C721 size = 0xF @@ -7643,7 +7643,7 @@ addr = 0x44D1AB size = 0x80 [[func]] -name = "DrawSArrows" +name = "DrawSSlider" addr = 0x44D22B size = 0xF0 From 312168d4c1ae948f4296d8c1f1c4b22975d3be92 Mon Sep 17 00:00:00 2001 From: Anders Jenbo Date: Sun, 29 Mar 2020 20:45:57 +0200 Subject: [PATCH 14/14] Reformat the .clang-format files These files are YAML, changes to a more idiomatic YAML syntax --- .clang-format | 20 +++++++++----------- Source/.clang-format | 18 ++++++++---------- 2 files changed, 17 insertions(+), 21 deletions(-) diff --git a/.clang-format b/.clang-format index 11c49919..ea436110 100644 --- a/.clang-format +++ b/.clang-format @@ -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 diff --git a/Source/.clang-format b/Source/.clang-format index 7074a477..0d8567a2 100644 --- a/Source/.clang-format +++ b/Source/.clang-format @@ -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