diff --git a/.gitignore b/.gitignore index 088545ad..e98ecc8b 100644 --- a/.gitignore +++ b/.gitignore @@ -434,3 +434,9 @@ exefs/main /out/isenseconfig/CPI-Debug /docs/html/ + +# MPQ files +*.mpq + +# ddraw wrapper configuration file +ddraw_settings.ini \ No newline at end of file diff --git a/3rdParty/Storm/Source/storm.h b/3rdParty/Storm/Source/storm.h index fb7e10d3..de5cc157 100644 --- a/3rdParty/Storm/Source/storm.h +++ b/3rdParty/Storm/Source/storm.h @@ -44,6 +44,20 @@ struct CCritSect { }; #endif +// Game states +#define GAMESTATE_PRIVATE 0x01 +#define GAMESTATE_FULL 0x02 +#define GAMESTATE_ACTIVE 0x04 +#define GAMESTATE_STARTED 0x08 +#define GAMESTATE_REPLAY 0x80 + +#define PS_CONNECTED 0x10000 +#define PS_TURN_ARRIVED 0x20000 +#define PS_ACTIVE 0x40000 + +#define LEAVE_ENDING 0x40000004 +#define LEAVE_DROP 0x40000006 + #if defined(__GNUC__) || defined(__cplusplus) extern "C" { #endif diff --git a/Source/appfat.cpp b/Source/appfat.cpp index 693847bb..bdcd83e6 100644 --- a/Source/appfat.cpp +++ b/Source/appfat.cpp @@ -9,6 +9,7 @@ DEVILUTION_BEGIN_NAMESPACE +/** Buffer used by GetErrorStr for it's return value */ char sz_error_buf[256]; /** Set to true when a fatal error is encountered and the application should shut down. */ BOOL terminating; @@ -17,6 +18,8 @@ int cleanup_thread_id; /** * @brief Terminates the game and displays an error message box. + * @param pszFmt Optional error message. + * @param ... (see printf) */ void app_fatal(const char *pszFmt, ...) { @@ -35,6 +38,8 @@ void app_fatal(const char *pszFmt, ...) /** * @brief Displays an error message box based on the given format string and variable argument list. + * @param pszFmt Error message format + * @param va Additional parameters for message format */ void MsgBox(const char *pszFmt, va_list va) { @@ -66,6 +71,8 @@ void FreeDlg() /** * @brief Displays a warning message box based on the given formatted error message. + * @param pszFmt Error message format + * @param ... Additional parameters for message format */ void DrawDlg(char *pszFmt, ...) { @@ -80,6 +87,12 @@ void DrawDlg(char *pszFmt, ...) } #ifdef _DEBUG +/** + * @brief Show an error and exit the application. + * @param nLineNo The line number of the assertion + * @param pszFile File name where the assertion is located + * @param pszFail Fail message + */ void assert_fail(int nLineNo, const char *pszFile, const char *pszFail) { app_fatal("assertion failed (%d:%s)\n%s", nLineNo, pszFile, pszFail); diff --git a/Source/capture.cpp b/Source/capture.cpp index 19cdebac..93785146 100644 --- a/Source/capture.cpp +++ b/Source/capture.cpp @@ -38,6 +38,12 @@ static BOOL CaptureHdr(short width, short height, std::ofstream *out) return !out->fail(); } +/** + * @brief Write the current ingame palette to the PCX file + * @param palette Current palette + * @param out File stream for the PCX file. + * @return True if successful, else false + */ static BOOL CapturePal(SDL_Color *palette, std::ofstream *out) { BYTE pcx_palette[1 + 256 * 3]; @@ -54,6 +60,14 @@ static BOOL CapturePal(SDL_Color *palette, std::ofstream *out) return !out->fail(); } +/** + * @brief RLE compress the pixel data + * @param src Raw pixel buffer + * @param dst Output buffer + * @param width Width of pixel buffer + + * @return Output buffer + */ static BYTE *CaptureEnc(BYTE *src, BYTE *dst, int width) { int rleLength; @@ -88,6 +102,14 @@ static BYTE *CaptureEnc(BYTE *src, BYTE *dst, int width) return dst; } +/** + * @brief Write the pixel data to the PCX file + * @param width Image width + * @param height Image height + * @param stride Buffer width + * @param pixels Raw pixel buffer + * @return True if successful, else false + */ static bool CapturePix(WORD width, WORD height, WORD stride, BYTE *pixels, std::ofstream *out) { int writeSize; @@ -124,7 +146,7 @@ static std::ofstream *CaptureFile(char *dst_path) } /** - * @brief remove green and blue from the current palette + * @brief Make a red version of the given palette and apply it to the screen. */ static void RedPalette() { @@ -143,6 +165,10 @@ static void RedPalette() RenderPresent(); } +/** + * @brief Save the current screen to a screen??.PCX (00-99) in file if available, then make the screen red for 200ms. + + */ void CaptureScreen() { SDL_Color palette[256]; diff --git a/Source/control.cpp b/Source/control.cpp index 2d1274d3..d18c7f72 100644 --- a/Source/control.cpp +++ b/Source/control.cpp @@ -1788,16 +1788,16 @@ void DrawSpellBook() spl = plr[myplr]._pMemSpells | plr[myplr]._pISpells | plr[myplr]._pAblSpells; - yp = 215; + yp = 55 + SCREEN_Y; for (i = 1; i < 8; i++) { sn = SpellPages[sbooktab][i - 1]; if (sn != -1 && spl & (__int64)1 << (sn - 1)) { st = GetSBookTrans(sn, TRUE); SetSpellTrans(st); - DrawSpellCel(RIGHT_PANEL + 75, yp, pSBkIconCels, SpellITbl[sn], 37); + DrawSpellCel(RIGHT_PANEL_X + 11, yp, pSBkIconCels, SpellITbl[sn], 37); if (sn == plr[myplr]._pRSpell && st == plr[myplr]._pRSplType) { SetSpellTrans(RSPLTYPE_SKILL); - DrawSpellCel(RIGHT_PANEL + 75, yp, pSBkIconCels, SPLICONLAST, 37); + DrawSpellCel(RIGHT_PANEL_X + 11, yp, pSBkIconCels, SPLICONLAST, 37); } PrintSBookStr(10, yp - 23, FALSE, spelldata[sn].sNameText, COL_WHITE); switch (GetSBookTrans(sn, FALSE)) { @@ -2078,7 +2078,7 @@ char *control_print_talk_msg(char *msg, int *x, int y, int color) c = fontframe[gbFontTransTbl[(BYTE)*msg]]; width += fontkern[c] + 1; - if (width > 514 + PANEL_LEFT) + if (width > 450 + PANEL_X) return msg; msg++; if (c != 0) { @@ -2121,7 +2121,7 @@ void control_release_talk_btn() if (talkflag) { for (i = 0; i < sizeof(talkbtndown) / sizeof(talkbtndown[0]); i++) talkbtndown[i] = FALSE; - if (MouseX >= 172 + PANEL_LEFT && MouseY >= 421 + PANEL_LEFT && MouseX <= -119 + PANEL_TOP && MouseY <= 123 + PANEL_TOP) { + if (MouseX >= 172 + PANEL_LEFT && MouseY >= 69 + PANEL_TOP && MouseX <= 233 + PANEL_LEFT && MouseY <= 123 + PANEL_TOP) { off = (MouseY - (69 + PANEL_TOP)) / 18; for (p = 0; p < MAX_PLRS && off != -1; p++) { diff --git a/Source/cursor.cpp b/Source/cursor.cpp index a2326969..be30871c 100644 --- a/Source/cursor.cpp +++ b/Source/cursor.cpp @@ -7,23 +7,38 @@ DEVILUTION_BEGIN_NAMESPACE +/** Pixel width of the current cursor image */ int cursW; +/** Pixel height of the current cursor image */ int cursH; +/** Current highlighted monster */ int pcursmonst = -1; +/** Width of current cursor in inventory cells */ int icursW28; +/** Height of current cursor in inventory cells */ int icursH28; +/** Cursor images CEL */ BYTE *pCursCels; /** inv_item value */ char pcursinvitem; +/** Pixel width of the current cursor image */ int icursW; +/** Pixel height of the current cursor image */ int icursH; +/** Current highlighted item */ char pcursitem; +/** Current highlighted object */ char pcursobj; +/** Current highlighted player */ char pcursplr; +/** Current highlighted tile row */ int cursmx; +/** Current highlighted tile column */ int cursmy; +/** Previously highlighted monster */ int pcurstemp; +/** Index of current cursor image */ int pcurs; /* rdata */ diff --git a/Source/drlg_l1.cpp b/Source/drlg_l1.cpp index 087df8f3..08166c16 100644 --- a/Source/drlg_l1.cpp +++ b/Source/drlg_l1.cpp @@ -7,17 +7,27 @@ DEVILUTION_BEGIN_NAMESPACE +/** Represents a tile ID map of twice the size, repeating each tile of the original map in blocks of 4. */ BYTE L5dungeon[80][80]; BYTE L5dflags[DMAXX][DMAXY]; +/** Specifies whether a single player quest DUN has been loaded. */ BOOL L5setloadflag; +/** Specifies whether to generate a horizontal room at position 1 in the Cathedral. */ int HR1; +/** Specifies whether to generate a horizontal room at position 2 in the Cathedral. */ int HR2; +/** Specifies whether to generate a horizontal room at position 3 in the Cathedral. */ int HR3; +/** Specifies whether to generate a vertical room at position 1 in the Cathedral. */ int VR1; +/** Specifies whether to generate a vertical room at position 2 in the Cathedral. */ int VR2; +/** Specifies whether to generate a vertical room at position 3 in the Cathedral. */ int VR3; +/** Contains the contents of the single player quest DUN file. */ BYTE *L5pSetPiece; +/** Contains shadows for 2x2 blocks of base tile IDs in the Cathedral. */ const ShadowStruct SPATS[37] = { // clang-format off // strig, s1, s2, s3, nv1, nv2, nv3 @@ -62,6 +72,7 @@ const ShadowStruct SPATS[37] = { }; // BUGFIX: This array should contain an additional 0 (207 elements). +/** Maps tile IDs to their corresponding base tile ID. */ const BYTE BSTYPES[] = { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 0, 0, @@ -86,7 +97,8 @@ const BYTE BSTYPES[] = { 0, 0, 0, 0, 0, 0, 0 }; -// BUGFIX: This array should contain an additional 0 (207 elements). +// BUGFIX: This array should contain an additional 0 (207 elements) (fixed). +/** Maps tile IDs to their corresponding undecorated tile ID. */ const BYTE L5BTYPES[] = { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 0, 0, @@ -110,13 +122,91 @@ const BYTE L5BTYPES[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -const BYTE STAIRSUP[] = { 4, 4, 13, 13, 13, 13, 2, 2, 2, 2, 13, 13, 13, 13, 13, 13, 13, 13, 0, 66, 6, 0, 63, 64, 65, 0, 0, 67, 68, 0, 0, 0, 0, 0 }; -const BYTE L5STAIRSUP[] = { 4, 4, 22, 22, 22, 22, 2, 2, 2, 2, 13, 13, 13, 13, 13, 13, 13, 13, 0, 66, 23, 0, 63, 64, 65, 0, 0, 67, 68, 0, 0, 0, 0, 0 }; -const BYTE STAIRSDOWN[] = { 4, 3, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 62, 57, 58, 0, 61, 59, 60, 0, 0, 0, 0, 0 }; -const BYTE LAMPS[] = { 2, 2, 13, 0, 13, 13, 129, 0, 130, 128 }; -const BYTE PWATERIN[] = { 6, 6, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 0, 0, 0, 0, 0, 0, 0, 202, 200, 200, 84, 0, 0, 199, 203, 203, 83, 0, 0, 85, 206, 80, 81, 0, 0, 0, 134, 135, 0, 0, 0, 0, 0, 0, 0, 0 }; +/** Miniset: stairs up on a corner wall. */ +const BYTE STAIRSUP[] = { + // clang-format off + 4, 4, // width, height + + 13, 13, 13, 13, // search + 2, 2, 2, 2, + 13, 13, 13, 13, + 13, 13, 13, 13, + + 0, 66, 6, 0, // replace + 63, 64, 65, 0, + 0, 67, 68, 0, + 0, 0, 0, 0, + // clang-format on +}; +/** Miniset: stairs up. */ +const BYTE L5STAIRSUP[] = { + // clang-format off + 4, 4, // width, height + + 22, 22, 22, 22, // search + 2, 2, 2, 2, + 13, 13, 13, 13, + 13, 13, 13, 13, + + 0, 66, 23, 0, // replace + 63, 64, 65, 0, + 0, 67, 68, 0, + 0, 0, 0, 0, + // clang-format on +}; +/** Miniset: stairs down. */ +const BYTE STAIRSDOWN[] = { + // clang-format off + 4, 3, // width, height + + 13, 13, 13, 13, // search + 13, 13, 13, 13, + 13, 13, 13, 13, + + 62, 57, 58, 0, // replace + 61, 59, 60, 0, + 0, 0, 0, 0, + // clang-format on +}; +/** Miniset: candlestick. */ +const BYTE LAMPS[] = { + // clang-format off + 2, 2, // width, height + + 13, 0, // search + 13, 13, + + 129, 0, // replace + 130, 128, + // clang-format on +}; +/** Miniset: Poisoned Water Supply entrance. */ +const BYTE PWATERIN[] = { + // clang-format off + 6, 6, // width, height + + 13, 13, 13, 13, 13, 13, // search + 13, 13, 13, 13, 13, 13, + 13, 13, 13, 13, 13, 13, + 13, 13, 13, 13, 13, 13, + 13, 13, 13, 13, 13, 13, + 13, 13, 13, 13, 13, 13, + + 0, 0, 0, 0, 0, 0, // replace + 0, 202, 200, 200, 84, 0, + 0, 199, 203, 203, 83, 0, + 0, 85, 206, 80, 81, 0, + 0, 0, 134, 135, 0, 0, + 0, 0, 0, 0, 0, 0, + // clang-format on +}; /* data */ + +/** + * A lookup table for the 16 possible patterns of a 2x2 area, + * where each cell either contains a SW wall or it doesn't. + */ BYTE L5ConvTbl[16] = { 22, 13, 1, 13, 2, 13, 13, 13, 4, 13, 1, 13, 2, 13, 16, 13 }; static void DRLG_PlaceDoor(int x, int y) diff --git a/Source/drlg_l2.cpp b/Source/drlg_l2.cpp index 54d6fbc0..0e4d8fb1 100644 --- a/Source/drlg_l2.cpp +++ b/Source/drlg_l2.cpp @@ -27,119 +27,1502 @@ int Dir_Xadd[5] = { 0, 0, 1, 0, -1 }; int Dir_Yadd[5] = { 0, -1, 0, 1, 0 }; ShadowStruct SPATSL2[2] = { { 6, 3, 0, 3, 48, 0, 50 }, { 9, 3, 0, 3, 48, 0, 50 } }; //short word_48489A = 0; + BYTE BTYPESL2[161] = { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 0, 0, 0, 0, 0, 0, 0, 17, 18, 1, 1, 2, 2, 1, 1, 1, 1, 1, 1, 2, 2, 2, 2, 2, 0, 0, 0, 0, 8, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 0, 0, 2, 2, 2, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 3, 3, 3, 3, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3, 3, 3, 0, 3, 0, 3, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; BYTE BSTYPESL2[161] = { 0, 1, 2, 3, 0, 0, 6, 0, 0, 9, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 2, 2, 1, 1, 1, 1, 1, 1, 2, 2, 2, 2, 2, 0, 0, 0, 0, 0, 6, 6, 6, 9, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 0, 0, 2, 2, 2, 0, 0, 0, 1, 1, 1, 1, 6, 2, 2, 2, 0, 3, 3, 3, 3, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 1, 1, 2, 2, 3, 3, 3, 3, 1, 1, 2, 2, 3, 3, 3, 3, 1, 1, 3, 3, 2, 2, 3, 3, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -BYTE VARCH1[] = { 2, 4, 3, 0, 3, 1, 3, 4, 0, 7, 48, 0, 51, 39, 47, 44, 0, 0 }; -BYTE VARCH2[] = { 2, 4, 3, 0, 3, 1, 3, 4, 0, 8, 48, 0, 51, 39, 47, 44, 0, 0 }; -BYTE VARCH3[] = { 2, 4, 3, 0, 3, 1, 3, 4, 0, 6, 48, 0, 51, 39, 47, 44, 0, 0 }; -BYTE VARCH4[] = { 2, 4, 3, 0, 3, 1, 3, 4, 0, 9, 48, 0, 51, 39, 47, 44, 0, 0 }; -BYTE VARCH5[] = { 2, 4, 3, 0, 3, 1, 3, 4, 0, 14, 48, 0, 51, 39, 47, 44, 0, 0 }; -BYTE VARCH6[] = { 2, 4, 3, 0, 3, 1, 3, 4, 0, 13, 48, 0, 51, 39, 47, 44, 0, 0 }; -BYTE VARCH7[] = { 2, 4, 3, 0, 3, 1, 3, 4, 0, 16, 48, 0, 51, 39, 47, 44, 0, 0 }; -BYTE VARCH8[] = { 2, 4, 3, 0, 3, 1, 3, 4, 0, 15, 48, 0, 51, 39, 47, 44, 0, 0 }; -BYTE VARCH9[] = { 2, 4, 3, 0, 3, 8, 3, 4, 0, 7, 48, 0, 51, 42, 47, 44, 0, 0 }; -BYTE VARCH10[] = { 2, 4, 3, 0, 3, 8, 3, 4, 0, 8, 48, 0, 51, 42, 47, 44, 0, 0 }; -BYTE VARCH11[] = { 2, 4, 3, 0, 3, 8, 3, 4, 0, 6, 48, 0, 51, 42, 47, 44, 0, 0 }; -BYTE VARCH12[] = { 2, 4, 3, 0, 3, 8, 3, 4, 0, 9, 48, 0, 51, 42, 47, 44, 0, 0 }; -BYTE VARCH13[] = { 2, 4, 3, 0, 3, 8, 3, 4, 0, 14, 48, 0, 51, 42, 47, 44, 0, 0 }; -BYTE VARCH14[] = { 2, 4, 3, 0, 3, 8, 3, 4, 0, 13, 48, 0, 51, 42, 47, 44, 0, 0 }; -BYTE VARCH15[] = { 2, 4, 3, 0, 3, 8, 3, 4, 0, 16, 48, 0, 51, 42, 47, 44, 0, 0 }; -BYTE VARCH16[] = { 2, 4, 3, 0, 3, 8, 3, 4, 0, 15, 48, 0, 51, 42, 47, 44, 0, 0 }; -BYTE VARCH17[] = { 2, 3, 2, 7, 3, 4, 0, 7, 141, 39, 47, 44, 0, 0 }; -BYTE VARCH18[] = { 2, 3, 2, 7, 3, 4, 0, 8, 141, 39, 47, 44, 0, 0 }; -BYTE VARCH19[] = { 2, 3, 2, 7, 3, 4, 0, 6, 141, 39, 47, 44, 0, 0 }; -BYTE VARCH20[] = { 2, 3, 2, 7, 3, 4, 0, 9, 141, 39, 47, 44, 0, 0 }; -BYTE VARCH21[] = { 2, 3, 2, 7, 3, 4, 0, 14, 141, 39, 47, 44, 0, 0 }; -BYTE VARCH22[] = { 2, 3, 2, 7, 3, 4, 0, 13, 141, 39, 47, 44, 0, 0 }; -BYTE VARCH23[] = { 2, 3, 2, 7, 3, 4, 0, 16, 141, 39, 47, 44, 0, 0 }; -BYTE VARCH24[] = { 2, 3, 2, 7, 3, 4, 0, 15, 141, 39, 47, 44, 0, 0 }; -BYTE VARCH25[] = { 2, 4, 3, 0, 3, 4, 3, 1, 0, 7, 48, 0, 51, 39, 47, 44, 0, 0 }; -BYTE VARCH26[] = { 2, 4, 3, 0, 3, 4, 3, 1, 0, 8, 48, 0, 51, 39, 47, 44, 0, 0 }; -BYTE VARCH27[] = { 2, 4, 3, 0, 3, 4, 3, 1, 0, 6, 48, 0, 51, 39, 47, 44, 0, 0 }; -BYTE VARCH28[] = { 2, 4, 3, 0, 3, 4, 3, 1, 0, 9, 48, 0, 51, 39, 47, 44, 0, 0 }; -BYTE VARCH29[] = { 2, 4, 3, 0, 3, 4, 3, 1, 0, 14, 48, 0, 51, 39, 47, 44, 0, 0 }; -BYTE VARCH30[] = { 2, 4, 3, 0, 3, 4, 3, 1, 0, 13, 48, 0, 51, 39, 47, 44, 0, 0 }; -BYTE VARCH31[] = { 2, 4, 3, 0, 3, 4, 3, 1, 0, 16, 48, 0, 51, 39, 47, 44, 0, 0 }; -BYTE VARCH32[] = { 2, 4, 3, 0, 3, 4, 3, 1, 0, 15, 48, 0, 51, 39, 47, 44, 0, 0 }; -BYTE VARCH33[] = { 2, 4, 2, 0, 3, 8, 3, 4, 0, 7, 142, 0, 51, 42, 47, 44, 0, 0 }; -BYTE VARCH34[] = { 2, 4, 2, 0, 3, 8, 3, 4, 0, 8, 142, 0, 51, 42, 47, 44, 0, 0 }; -BYTE VARCH35[] = { 2, 4, 2, 0, 3, 8, 3, 4, 0, 6, 142, 0, 51, 42, 47, 44, 0, 0 }; -BYTE VARCH36[] = { 2, 4, 2, 0, 3, 8, 3, 4, 0, 9, 142, 0, 51, 42, 47, 44, 0, 0 }; -BYTE VARCH37[] = { 2, 4, 2, 0, 3, 8, 3, 4, 0, 14, 142, 0, 51, 42, 47, 44, 0, 0 }; -BYTE VARCH38[] = { 2, 4, 2, 0, 3, 8, 3, 4, 0, 13, 142, 0, 51, 42, 47, 44, 0, 0 }; -BYTE VARCH39[] = { 2, 4, 2, 0, 3, 8, 3, 4, 0, 16, 142, 0, 51, 42, 47, 44, 0, 0 }; -BYTE VARCH40[] = { 2, 4, 2, 0, 3, 8, 3, 4, 0, 15, 142, 0, 51, 42, 47, 44, 0, 0 }; -BYTE HARCH1[] = { 3, 2, 3, 3, 0, 2, 5, 9, 49, 46, 0, 40, 45, 0 }; -BYTE HARCH2[] = { 3, 2, 3, 3, 0, 2, 5, 6, 49, 46, 0, 40, 45, 0 }; -BYTE HARCH3[] = { 3, 2, 3, 3, 0, 2, 5, 8, 49, 46, 0, 40, 45, 0 }; -BYTE HARCH4[] = { 3, 2, 3, 3, 0, 2, 5, 7, 49, 46, 0, 40, 45, 0 }; -BYTE HARCH5[] = { 3, 2, 3, 3, 0, 2, 5, 15, 49, 46, 0, 40, 45, 0 }; -BYTE HARCH6[] = { 3, 2, 3, 3, 0, 2, 5, 16, 49, 46, 0, 40, 45, 0 }; -BYTE HARCH7[] = { 3, 2, 3, 3, 0, 2, 5, 13, 49, 46, 0, 40, 45, 0 }; -BYTE HARCH8[] = { 3, 2, 3, 3, 0, 2, 5, 14, 49, 46, 0, 40, 45, 0 }; -BYTE HARCH9[] = { 3, 2, 3, 3, 0, 8, 5, 9, 49, 46, 0, 43, 45, 0 }; -BYTE HARCH10[] = { 3, 2, 3, 3, 0, 8, 5, 6, 49, 46, 0, 43, 45, 0 }; -BYTE HARCH11[] = { 3, 2, 3, 3, 0, 8, 5, 8, 49, 46, 0, 43, 45, 0 }; -BYTE HARCH12[] = { 3, 2, 3, 3, 0, 8, 5, 7, 49, 46, 0, 43, 45, 0 }; -BYTE HARCH13[] = { 3, 2, 3, 3, 0, 8, 5, 15, 49, 46, 0, 43, 45, 0 }; -BYTE HARCH14[] = { 3, 2, 3, 3, 0, 8, 5, 16, 49, 46, 0, 43, 45, 0 }; -BYTE HARCH15[] = { 3, 2, 3, 3, 0, 8, 5, 13, 49, 46, 0, 43, 45, 0 }; -BYTE HARCH16[] = { 3, 2, 3, 3, 0, 8, 5, 14, 49, 46, 0, 43, 45, 0 }; -BYTE HARCH17[] = { 3, 2, 1, 3, 0, 8, 5, 9, 140, 46, 0, 43, 45, 0 }; -BYTE HARCH18[] = { 3, 2, 1, 3, 0, 8, 5, 6, 140, 46, 0, 43, 45, 0 }; -BYTE HARCH19[] = { 3, 2, 1, 3, 0, 8, 5, 8, 140, 46, 0, 43, 45, 0 }; -BYTE HARCH20[] = { 3, 2, 1, 3, 0, 8, 5, 7, 140, 46, 0, 43, 45, 0 }; -BYTE HARCH21[] = { 3, 2, 1, 3, 0, 8, 5, 15, 140, 46, 0, 43, 45, 0 }; -BYTE HARCH22[] = { 3, 2, 1, 3, 0, 8, 5, 16, 140, 46, 0, 43, 45, 0 }; -BYTE HARCH23[] = { 3, 2, 1, 3, 0, 8, 5, 13, 140, 46, 0, 43, 45, 0 }; -BYTE HARCH24[] = { 3, 2, 1, 3, 0, 8, 5, 14, 140, 46, 0, 43, 45, 0 }; -BYTE HARCH25[] = { 3, 2, 3, 3, 0, 5, 2, 9, 49, 46, 0, 40, 45, 0 }; -BYTE HARCH26[] = { 3, 2, 3, 3, 0, 5, 2, 6, 49, 46, 0, 40, 45, 0 }; -BYTE HARCH27[] = { 3, 2, 3, 3, 0, 5, 2, 8, 49, 46, 0, 40, 45, 0 }; -BYTE HARCH28[] = { 3, 2, 3, 3, 0, 5, 2, 7, 49, 46, 0, 40, 45, 0 }; -BYTE HARCH29[] = { 3, 2, 3, 3, 0, 5, 2, 15, 49, 46, 0, 40, 45, 0 }; -BYTE HARCH30[] = { 3, 2, 3, 3, 0, 5, 2, 16, 49, 46, 0, 40, 45, 0 }; -BYTE HARCH31[] = { 3, 2, 3, 3, 0, 5, 2, 13, 49, 46, 0, 40, 45, 0 }; -BYTE HARCH32[] = { 3, 2, 3, 3, 0, 5, 2, 14, 49, 46, 0, 40, 45, 0 }; -BYTE HARCH33[] = { 3, 2, 1, 3, 0, 9, 5, 9, 140, 46, 0, 40, 45, 0 }; -BYTE HARCH34[] = { 3, 2, 1, 3, 0, 9, 5, 6, 140, 46, 0, 40, 45, 0 }; -BYTE HARCH35[] = { 3, 2, 1, 3, 0, 9, 5, 8, 140, 46, 0, 40, 45, 0 }; -BYTE HARCH36[] = { 3, 2, 1, 3, 0, 9, 5, 7, 140, 46, 0, 40, 45, 0 }; -BYTE HARCH37[] = { 3, 2, 1, 3, 0, 9, 5, 15, 140, 46, 0, 40, 45, 0 }; -BYTE HARCH38[] = { 3, 2, 1, 3, 0, 9, 5, 16, 140, 46, 0, 40, 45, 0 }; -BYTE HARCH39[] = { 3, 2, 1, 3, 0, 9, 5, 13, 140, 46, 0, 40, 45, 0 }; -BYTE HARCH40[] = { 3, 2, 1, 3, 0, 9, 5, 14, 140, 46, 0, 40, 45, 0 }; -BYTE USTAIRS[] = { 4, 4, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 0, 0, 0, 0, 0, 72, 77, 0, 0, 76, 0, 0, 0, 0, 0, 0 }; -BYTE DSTAIRS[] = { 4, 4, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 0, 0, 0, 0, 0, 48, 71, 0, 0, 50, 78, 0, 0, 0, 0, 0 }; -BYTE WARPSTAIRS[] = { 4, 4, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 0, 0, 0, 0, 0, 158, 160, 0, 0, 159, 0, 0, 0, 0, 0, 0 }; -BYTE CRUSHCOL[] = { 3, 3, 3, 1, 3, 2, 6, 3, 3, 3, 3, 0, 0, 0, 0, 83, 0, 0, 0, 0 }; -BYTE BIG1[] = { 2, 2, 3, 3, 3, 3, 113, 0, 112, 0 }; -BYTE BIG2[] = { 2, 2, 3, 3, 3, 3, 114, 115, 0, 0 }; -BYTE BIG3[] = { 1, 2, 1, 1, 117, 116 }; -BYTE BIG4[] = { 2, 1, 2, 2, 118, 119 }; -BYTE BIG5[] = { 2, 2, 3, 3, 3, 3, 120, 122, 121, 123 }; -BYTE BIG6[] = { 1, 2, 1, 1, 125, 124 }; -BYTE BIG7[] = { 2, 1, 2, 2, 126, 127 }; -BYTE BIG8[] = { 2, 2, 3, 3, 3, 3, 128, 130, 129, 131 }; -BYTE BIG9[] = { 2, 2, 1, 3, 1, 3, 133, 135, 132, 134 }; -BYTE BIG10[] = { 2, 2, 2, 2, 3, 3, 136, 137, 3, 3 }; -BYTE RUINS1[] = { 1, 1, 1, 80 }; -BYTE RUINS2[] = { 1, 1, 1, 81 }; -BYTE RUINS3[] = { 1, 1, 1, 82 }; -BYTE RUINS4[] = { 1, 1, 2, 84 }; -BYTE RUINS5[] = { 1, 1, 2, 85 }; -BYTE RUINS6[] = { 1, 1, 2, 86 }; -BYTE RUINS7[] = { 1, 1, 8, 87 }; -BYTE PANCREAS1[] = { 5, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 0, 0, 0, 0, 0, 0, 0, 108, 0, 0, 0, 0, 0, 0, 0 }; -BYTE PANCREAS2[] = { 5, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 0, 0, 0, 0, 0, 0, 0, 110, 0, 0, 0, 0, 0, 0, 0 }; -BYTE CTRDOOR1[] = { 3, 3, 3, 1, 3, 0, 4, 0, 0, 9, 0, 0, 4, 0, 0, 1, 0, 0, 0, 0 }; -BYTE CTRDOOR2[] = { 3, 3, 3, 1, 3, 0, 4, 0, 0, 8, 0, 0, 4, 0, 0, 1, 0, 0, 0, 0 }; -BYTE CTRDOOR3[] = { 3, 3, 3, 1, 3, 0, 4, 0, 0, 6, 0, 0, 4, 0, 0, 1, 0, 0, 0, 0 }; -BYTE CTRDOOR4[] = { 3, 3, 3, 1, 3, 0, 4, 0, 0, 7, 0, 0, 4, 0, 0, 1, 0, 0, 0, 0 }; -BYTE CTRDOOR5[] = { 3, 3, 3, 1, 3, 0, 4, 0, 0, 15, 0, 0, 4, 0, 0, 1, 0, 0, 0, 0 }; -BYTE CTRDOOR6[] = { 3, 3, 3, 1, 3, 0, 4, 0, 0, 13, 0, 0, 4, 0, 0, 1, 0, 0, 0, 0 }; -BYTE CTRDOOR7[] = { 3, 3, 3, 1, 3, 0, 4, 0, 0, 16, 0, 0, 4, 0, 0, 1, 0, 0, 0, 0 }; -BYTE CTRDOOR8[] = { 3, 3, 3, 1, 3, 0, 4, 0, 0, 14, 0, 0, 4, 0, 0, 1, 0, 0, 0, 0 }; + +/** Miniset: Arch vertical. */ +BYTE VARCH1[] = { + // clang-format off + 2, 4, // width, height + + 3, 0, // search + 3, 1, + 3, 4, + 0, 7, + + 48, 0, // replace + 51, 39, + 47, 44, + 0, 0, + // clang-format on +}; +/** Miniset: Arch vertical. */ +BYTE VARCH2[] = { + // clang-format off + 2, 4, // width, height + + 3, 0, // search + 3, 1, + 3, 4, + 0, 8, + + 48, 0, // replace + 51, 39, + 47, 44, + 0, 0, + // clang-format on + }; +/** Miniset: Arch vertical. */ +BYTE VARCH3[] = { + // clang-format off + 2, 4, // width, height + + 3, 0, // search + 3, 1, + 3, 4, + 0, 6, + + 48, 0, // replace + 51, 39, + 47, 44, + 0, 0, + // clang-format on +}; +/** Miniset: Arch vertical. */ +BYTE VARCH4[] = { + // clang-format off + 2, 4, // width, height + + 3, 0, // search + 3, 1, + 3, 4, + 0, 9, + + 48, 0, // replace + 51, 39, + 47, 44, + 0, 0, + // clang-format on +}; +/** Miniset: Arch vertical. */ +BYTE VARCH5[] = { + // clang-format off + 2, 4, // width, height + + 3, 0, // search + 3, 1, + 3, 4, + 0, 14, + + 48, 0, // replace + 51, 39, + 47, 44, + 0, 0, + // clang-format on +}; +/** Miniset: Arch vertical. */ +BYTE VARCH6[] = { + // clang-format off + 2, 4, // width, height + + 3, 0, // search + 3, 1, + 3, 4, + 0, 13, + + 48, 0, // replace + 51, 39, + 47, 44, + 0, 0, + // clang-format on +}; +/** Miniset: Arch vertical. */ +BYTE VARCH7[] = { + // clang-format off + 2, 4, // width, height + + 3, 0, // search + 3, 1, + 3, 4, + 0, 16, + + 48, 0, // replace + 51, 39, + 47, 44, + 0, 0, + // clang-format on +}; +/** Miniset: Arch vertical. */ +BYTE VARCH8[] = { + // clang-format off + 2, 4, // width, height + + 3, 0, // search + 3, 1, + 3, 4, + 0, 15, + + 48, 0, // replace + 51, 39, + 47, 44, + 0, 0, + // clang-format on +}; +/** Miniset: Arch vertical - corner. */ +BYTE VARCH9[] = { + // clang-format off + 2, 4, // width, height + + 3, 0, // search + 3, 8, + 3, 4, + 0, 7, + + 48, 0, // replace + 51, 42, + 47, 44, + 0, 0, + // clang-format on +}; +/** Miniset: Arch vertical - corner. */ +BYTE VARCH10[] = { + // clang-format off + 2, 4, // width, height + + 3, 0, // search + 3, 8, + 3, 4, + 0, 8, + + 48, 0, // replace + 51, 42, + 47, 44, + 0, 0, + // clang-format on +}; +/** Miniset: Arch vertical - corner. */ +BYTE VARCH11[] = { + // clang-format off + 2, 4, // width, height + + 3, 0, // search + 3, 8, + 3, 4, + 0, 6, + + 48, 0, // replace + 51, 42, + 47, 44, + 0, 0, + // clang-format on +}; +/** Miniset: Arch vertical - corner. */ +BYTE VARCH12[] = { + // clang-format off + 2, 4, // width, height + + 3, 0, // search + 3, 8, + 3, 4, + 0, 9, + + 48, 0, // replace + 51, 42, + 47, 44, + 0, 0, + // clang-format on +}; +/** Miniset: Arch vertical - corner. */ +BYTE VARCH13[] = { + // clang-format off + 2, 4, // width, height + + 3, 0, // search + 3, 8, + 3, 4, + 0, 14, + + 48, 0, // replace + 51, 42, + 47, 44, + 0, 0, + // clang-format on +}; +/** Miniset: Arch vertical - corner. */ +BYTE VARCH14[] = { + // clang-format off + 2, 4, // width, height + + 3, 0, // search + 3, 8, + 3, 4, + 0, 13, + + 48, 0, // replace + 51, 42, + 47, 44, + 0, 0, + // clang-format on +}; +/** Miniset: Arch vertical - corner. */ +BYTE VARCH15[] = { + // clang-format off + 2, 4, // width, height + + 3, 0, // search + 3, 8, + 3, 4, + 0, 16, + + 48, 0, // replace + 51, 42, + 47, 44, + 0, 0, + // clang-format on +}; +/** Miniset: Arch vertical - corner. */ +BYTE VARCH16[] = { + // clang-format off + 2, 4, // width, height + + 3, 0, // search + 3, 8, + 3, 4, + 0, 15, + + 48, 0, // replace + 51, 42, + 47, 44, + 0, 0, + // clang-format on +}; +/** Miniset: Arch vertical - open wall. */ +BYTE VARCH17[] = { + // clang-format off + 2, 3, // width, height + + 2, 7, // search + 3, 4, + 0, 7, + + 141, 39, // replace + 47, 44, + 0, 0, + // clang-format on +}; +/** Miniset: Arch vertical - open wall. */ +BYTE VARCH18[] = { + // clang-format off + 2, 3, // width, height + + 2, 7, // search + 3, 4, + 0, 8, + + 141, 39, // replace + 47, 44, + 0, 0, + // clang-format on +}; +/** Miniset: Arch vertical - open wall. */ +BYTE VARCH19[] = { + // clang-format off + 2, 3, // width, height + + 2, 7, // search + 3, 4, + 0, 6, + + 141, 39, // replace + 47, 44, + 0, 0, + // clang-format on +}; +/** Miniset: Arch vertical - open wall. */ +BYTE VARCH20[] = { + // clang-format off + 2, 3, // width, height + + 2, 7, // search + 3, 4, + 0, 9, + + 141, 39, // replace + 47, 44, + 0, 0, + // clang-format on +}; +/** Miniset: Arch vertical - open wall. */ +BYTE VARCH21[] = { + // clang-format off + 2, 3, // width, height + + 2, 7, // search + 3, 4, + 0, 14, + + 141, 39, // replace + 47, 44, + 0, 0, + // clang-format on +}; +/** Miniset: Arch vertical - open wall. */ +BYTE VARCH22[] = { + 2, 3, // width, height + + 2, 7, // search + 3, 4, + 0, 13, + + 141, 39, // replace + 47, 44, + 0, 0, + // clang-format on +}; +/** Miniset: Arch vertical - open wall. */ +BYTE VARCH23[] = { + // clang-format off + 2, 3, // width, height + + 2, 7, // search + 3, 4, + 0, 16, + + 141, 39, // replace + 47, 44, + 0, 0, + // clang-format on +}; +/** Miniset: Arch vertical - open wall. */ +BYTE VARCH24[] = { + // clang-format off + 2, 3, // width, height + + 2, 7, // search + 3, 4, + 0, 15, + + 141, 39, // replace + 47, 44, + 0, 0, + // clang-format on +}; +/** Miniset: Arch vertical. */ +BYTE VARCH25[] = { + // clang-format off + 2, 4, // width, height + + 3, 0, // search + 3, 4, + 3, 1, + 0, 7, + + 48, 0, // replace + 51, 39, + 47, 44, + 0, 0, + // clang-format on +}; +/** Miniset: Arch vertical. */ +BYTE VARCH26[] = { + // clang-format off + 2, 4, // width, height + + 3, 0, // search + 3, 4, + 3, 1, + 0, 8, + + 48, 0, // replace + 51, 39, + 47, 44, + 0, 0, + // clang-format on +}; +/** Miniset: Arch vertical. */ +BYTE VARCH27[] = { + // clang-format off + 2, 4, // width, height + + 3, 0, // search + 3, 4, + 3, 1, + 0, 6, + + 48, 0, // replace + 51, 39, + 47, 44, + 0, 0, + // clang-format on +}; +/** Miniset: Arch vertical. */ +BYTE VARCH28[] = { + // clang-format off + 2, 4, // width, height + + 3, 0, // search + 3, 4, + 3, 1, + 0, 9, + + 48, 0, // replace + 51, 39, + 47, 44, + 0, 0, + // clang-format on +}; +/** Miniset: Arch vertical. */ +BYTE VARCH29[] = { + // clang-format off + 2, 4, // width, height + + 3, 0, // search + 3, 4, + 3, 1, + 0, 14, + + 48, 0, // replace + 51, 39, + 47, 44, + 0, 0, + // clang-format on +}; +/** Miniset: Arch vertical. */ +BYTE VARCH30[] = { + // clang-format off + 2, 4, // width, height + + 3, 0, // search + 3, 4, + 3, 1, + 0, 13, + + 48, 0, // replace + 51, 39, + 47, 44, + 0, 0, + // clang-format on +}; +/** Miniset: Arch vertical. */ +BYTE VARCH31[] = { + // clang-format off + 2, 4, // width, height + + 3, 0, // search + 3, 4, + 3, 1, + 0, 16, + + 48, 0, // replace + 51, 39, + 47, 44, + 0, 0, + // clang-format on +}; +/** Miniset: Arch vertical. */ +BYTE VARCH32[] = { + // clang-format off + 2, 4, // width, height + + 3, 0, // search + 3, 4, + 3, 1, + 0, 15, + + 48, 0, // replace + 51, 39, + 47, 44, + 0, 0, + // clang-format on +}; +/** Miniset: Arch vertical - room west entrance. */ +BYTE VARCH33[] = { + // clang-format off + 2, 4, // width, height + + 2, 0, // search + 3, 8, + 3, 4, + 0, 7, + + 142, 0, // replace + 51, 42, + 47, 44, + 0, 0, + // clang-format on +}; +/** Miniset: Arch vertical - room west entrance. */ +BYTE VARCH34[] = { + // clang-format off + 2, 4, // width, height + + 2, 0, // search + 3, 8, + 3, 4, + 0, 8, + + 142, 0, // replace + 51, 42, + 47, 44, + 0, 0, + // clang-format on +}; +/** Miniset: Arch vertical - room west entrance. */ +BYTE VARCH35[] = { + // clang-format off + 2, 4, // width, height + + 2, 0, // search + 3, 8, + 3, 4, + 0, 6, + + 142, 0, // replace + 51, 42, + 47, 44, + 0, 0, + // clang-format on +}; +/** Miniset: Arch vertical - room west entrance. */ +BYTE VARCH36[] = { + // clang-format off + 2, 4, // width, height + + 2, 0, // search + 3, 8, + 3, 4, + 0, 9, + + 142, 0, // replace + 51, 42, + 47, 44, + 0, 0, + // clang-format on +}; +/** Miniset: Arch vertical - room west entrance. */ +BYTE VARCH37[] = { + // clang-format off + 2, 4, // width, height + + 2, 0, // search + 3, 8, + 3, 4, + 0, 14, + + 142, 0, // replace + 51, 42, + 47, 44, + 0, 0, + // clang-format on +}; +/** Miniset: Arch vertical - room west entrance. */ +BYTE VARCH38[] = { + // clang-format off + 2, 4, // width, height + + 2, 0, // search + 3, 8, + 3, 4, + 0, 13, + + 142, 0, // replace + 51, 42, + 47, 44, + 0, 0, + // clang-format on +}; +/** Miniset: Arch vertical - room west entrance. */ +BYTE VARCH39[] = { + // clang-format off + 2, 4, // width, height + + 2, 0, // search + 3, 8, + 3, 4, + 0, 16, + + 142, 0, // replace + 51, 42, + 47, 44, + 0, 0, + // clang-format on +}; +/** Miniset: Arch vertical - room west entrance. */ +BYTE VARCH40[] = { + // clang-format off + 2, 4, // width, height + + 2, 0, // search + 3, 8, + 3, 4, + 0, 15, + + 142, 0, // replace + 51, 42, + 47, 44, + 0, 0, + // clang-format on +}; +/** Miniset: Arch horizontal. */ +BYTE HARCH1[] = { + // clang-format off + 3, 2, // width, height + + 3, 3, 0, // search + 2, 5, 9, + + 49, 46, 0, // replace + 40, 45, 0, + // clang-format on +}; +/** Miniset: Arch horizontal. */ +BYTE HARCH2[] = { + // clang-format off + 3, 2, // width, height + + 3, 3, 0, // search + 2, 5, 6, + + 49, 46, 0, // replace + 40, 45, 0, + // clang-format on +}; +/** Miniset: Arch horizontal. */ +BYTE HARCH3[] = { + // clang-format off + 3, 2, // width, height + + 3, 3, 0, // search + 2, 5, 8, + + 49, 46, 0, // replace + 40, 45, 0, + // clang-format on +}; +/** Miniset: Arch horizontal. */ +BYTE HARCH4[] = { + // clang-format off + 3, 2, // width, height + + 3, 3, 0, // search + 2, 5, 7, + + 49, 46, 0, // replace + 40, 45, 0, + // clang-format on +}; +/** Miniset: Arch horizontal. */ +BYTE HARCH5[] = { + // clang-format off + 3, 2, // width, height + + 3, 3, 0, // search + 2, 5, 15, + + 49, 46, 0, // replace + 40, 45, 0, + // clang-format on +}; +/** Miniset: Arch horizontal. */ +BYTE HARCH6[] = { + // clang-format off + 3, 2, // width, height + + 3, 3, 0, // search + 2, 5, 16, + + 49, 46, 0, // replace + 40, 45, 0, + // clang-format on +}; +/** Miniset: Arch horizontal. */ +BYTE HARCH7[] = { + // clang-format off + 3, 2, // width, height + + 3, 3, 0, // search + 2, 5, 13, + + 49, 46, 0, // replace + 40, 45, 0, + // clang-format on +}; +/** Miniset: Arch horizontal. */ +BYTE HARCH8[] = { + // clang-format off + 3, 2, // width, height + + 3, 3, 0, // search + 2, 5, 14, + + 49, 46, 0, // replace + 40, 45, 0, + // clang-format on +}; +/** Miniset: Arch horizontal - north corner. */ +BYTE HARCH9[] = { + // clang-format off + 3, 2, // width, height + + 3, 3, 0, // search + 8, 5, 9, + + 49, 46, 0, // replace + 43, 45, 0, + // clang-format on +}; +/** Miniset: Arch horizontal - north corner. */ +BYTE HARCH10[] = { + // clang-format off + 3, 2, // width, height + + 3, 3, 0, // search + 8, 5, 6, + + 49, 46, 0, // replace + 43, 45, 0, + // clang-format on +}; +/** Miniset: Arch horizontal - north corner. */ +BYTE HARCH11[] = { + // clang-format off + 3, 2, // width, height + + 3, 3, 0, // search + 8, 5, 8, + + 49, 46, 0, // replace + 43, 45, 0, + // clang-format on +}; +/** Miniset: Arch horizontal - north corner. */ +BYTE HARCH12[] = { + // clang-format off + 3, 2, // width, height + + 3, 3, 0, // search + 8, 5, 7, + + 49, 46, 0, // replace + 43, 45, 0, + // clang-format on +}; +/** Miniset: Arch horizontal - north corner. */ +BYTE HARCH13[] = { + // clang-format off + 3, 2, // width, height + + 3, 3, 0, // search + 8, 5, 15, + + 49, 46, 0, // replace + 43, 45, 0, + // clang-format on +}; +/** Miniset: Arch horizontal - north corner. */ +BYTE HARCH14[] = { + // clang-format off + 3, 2, // width, height + + 3, 3, 0, // search + 8, 5, 16, + + 49, 46, 0, // replace + 43, 45, 0, + // clang-format on +}; +/** Miniset: Arch horizontal - north corner. */ +BYTE HARCH15[] = { + // clang-format off + 3, 2, // width, height + + 3, 3, 0, // search + 8, 5, 13, + + 49, 46, 0, // replace + 43, 45, 0, + // clang-format on +}; +/** Miniset: Arch horizontal - north corner. */ +BYTE HARCH16[] = { + // clang-format off + 3, 2, // width, height + + 3, 3, 0, // search + 8, 5, 14, + + 49, 46, 0, // replace + 43, 45, 0, + // clang-format on +}; +/** Miniset: Arch horizontal - wall. */ +BYTE HARCH17[] = { + // clang-format off + 3, 2, // width, height + + 1, 3, 0, // search + 8, 5, 9, + + 140, 46, 0, // replace + 43, 45, 0, + // clang-format on +}; +/** Miniset: Arch horizontal - wall. */ +BYTE HARCH18[] = { + // clang-format off + 3, 2, // width, height + + 1, 3, 0, // search + 8, 5, 6, + + 140, 46, 0, // Replace + 43, 45, 0, + // clang-format on +}; +/** Miniset: Arch horizontal - wall. */ +BYTE HARCH19[] = { + // clang-format off + 3, 2, // width, height + + 1, 3, 0, // search + 8, 5, 8, + + 140, 46, 0, // replace + 43, 45, 0, + // clang-format on +}; +/** Miniset: Arch horizontal - wall. */ +BYTE HARCH20[] = { + // clang-format off + 3, 2, // width, height + + 1, 3, 0, // search + 8, 5, 7, + + 140, 46, 0, // replace + 43, 45, 0, + // clang-format on +}; +/** Miniset: Arch horizontal - wall. */ +BYTE HARCH21[] = { + // clang-format off + 3, 2, // width, height + + 1, 3, 0, // search + 8, 5, 15, + + 140, 46, 0, // replace + 43, 45, 0, + // clang-format on +}; +/** Miniset: Arch horizontal - wall. */ +BYTE HARCH22[] = { + // clang-format off + 3, 2, // width, height + + 1, 3, 0, // search + 8, 5, 16, + + 140, 46, 0, // replace + 43, 45, 0, + // clang-format on +}; +/** Miniset: Arch horizontal - wall. */ +BYTE HARCH23[] = { + // clang-format off + 3, 2, // width, height + + 1, 3, 0, // search + 8, 5, 13, + + 140, 46, 0, // replace + 43, 45, 0, + // clang-format on +}; +/** Miniset: Arch horizontal - wall. */ +BYTE HARCH24[] = { + // clang-format off + 3, 2, // width, height + + 1, 3, 0, // search + 8, 5, 14, + + 140, 46, 0, // replace + 43, 45, 0, + // clang-format on +}; +/** Miniset: Arch horizontal. */ +BYTE HARCH25[] = { + // clang-format off + 3, 2, // width, height + + 3, 3, 0, // search + 5, 2, 9, + + 49, 46, 0, // replace + 40, 45, 0, + // clang-format on +}; +/** Miniset: Arch horizontal. */ +BYTE HARCH26[] = { + // clang-format off + 3, 2, // width, height + + 3, 3, 0, // search + 5, 2, 6, + + 49, 46, 0, // replace + 40, 45, 0, + // clang-format on +}; +/** Miniset: Arch horizontal. */ +BYTE HARCH27[] = { + // clang-format off + 3, 2, // width, height + + 3, 3, 0, // search + 5, 2, 8, + + 49, 46, 0, // replace + 40, 45, 0, + // clang-format on +}; +/** Miniset: Arch horizontal. */ +BYTE HARCH28[] = { + // clang-format off + 3, 2, // width, height + + 3, 3, 0, // search + 5, 2, 7, + + 49, 46, 0, // replace + 40, 45, 0, + // clang-format on +}; +/** Miniset: Arch horizontal. */ +BYTE HARCH29[] = { + // clang-format off + 3, 2, // width, height + + 3, 3, 0, // search + 5, 2, 15, + + 49, 46, 0, // replace + 40, 45, 0, + // clang-format on +}; +/** Miniset: Arch horizontal. */ +BYTE HARCH30[] = { + // clang-format off + 3, 2, // width, height + + 3, 3, 0, // search + 5, 2, 16, + + 49, 46, 0, // replace + 40, 45, 0, + // clang-format on +}; +/** Miniset: Arch horizontal. */ +BYTE HARCH31[] = { + // clang-format off + 3, 2, // width, height + + 3, 3, 0, // search + 5, 2, 13, + + 49, 46, 0, // replace + 40, 45, 0, + // clang-format on +}; +/** Miniset: Arch horizontal. */ +BYTE HARCH32[] = { + // clang-format off + 3, 2, // width, height + + 3, 3, 0, // search + 5, 2, 14, + + 49, 46, 0, // replace + 40, 45, 0, + // clang-format on +}; +/** Miniset: Arch horizontal - west corner. */ +BYTE HARCH33[] = { + // clang-format off + 3, 2, // width, height + + 1, 3, 0, // search + 9, 5, 9, + + 140, 46, 0, // replace + 40, 45, 0, + // clang-format on +}; +/** Miniset: Arch horizontal - west corner. */ +BYTE HARCH34[] = { + // clang-format off + 3, 2, // width, height + + 1, 3, 0, // search + 9, 5, 6, + + 140, 46, 0, // replace + 40, 45, 0, + // clang-format on +}; +/** Miniset: Arch horizontal - west corner. */ +BYTE HARCH35[] = { + // clang-format off + 3, 2, // width, height + + 1, 3, 0, // search + 9, 5, 8, + + 140, 46, 0, // replace + 40, 45, 0, + // clang-format on +}; +/** Miniset: Arch horizontal - west corner. */ +BYTE HARCH36[] = { + // clang-format off + 3, 2, // width, height + + 1, 3, 0, // search + 9, 5, 7, + + 140, 46, 0, // replace + 40, 45, 0, + // clang-format on +}; +/** Miniset: Arch horizontal - west corner. */ +BYTE HARCH37[] = { + // clang-format off + 3, 2, // width, height + + 1, 3, 0, // search + 9, 5, 15, + + 140, 46, 0, // replace + 40, 45, 0, + // clang-format on +}; +/** Miniset: Arch horizontal - west corner. */ +BYTE HARCH38[] = { + // clang-format off + 3, 2, // width, height + + 1, 3, 0, // search + 9, 5, 16, + + 140, 46, 0, // replace + 40, 45, 0, + // clang-format on +}; +/** Miniset: Arch horizontal - west corner. */ +BYTE HARCH39[] = { + // clang-format off + 3, 2, // width, height + + 1, 3, 0, // search + 9, 5, 13, + + 140, 46, 0, // replace + 40, 45, 0, + // clang-format on +}; +/** Miniset: Arch horizontal - west corner. */ +BYTE HARCH40[] = { + // clang-format off + 3, 2, // width, height + + 1, 3, 0, // search + 9, 5, 14, + + 140, 46, 0, // replace + 40, 45, 0, + // clang-format on +}; +/** Miniset: Stairs up. */ +BYTE USTAIRS[] = { + // clang-format off + 4, 4, // width, height + + 3, 3, 3, 3, // search + 3, 3, 3, 3, + 3, 3, 3, 3, + 3, 3, 3, 3, + + 0, 0, 0, 0, // replace + 0, 72, 77, 0, + 0, 76, 0, 0, + 0, 0, 0, 0, + // clang-format on +}; +/** Miniset: Stairs down. */ +BYTE DSTAIRS[] = { + // clang-format off + 4, 4, // width, height + + 3, 3, 3, 3, // search + 3, 3, 3, 3, + 3, 3, 3, 3, + 3, 3, 3, 3, + + 0, 0, 0, 0, // replace + 0, 48, 71, 0, + 0, 50, 78, 0, + 0, 0, 0, 0, + // clang-format on +}; +/** Miniset: Stairs to town. */ +BYTE WARPSTAIRS[] = { + // clang-format off + 4, 4, // width, height + + 3, 3, 3, 3, // search + 3, 3, 3, 3, + 3, 3, 3, 3, + 3, 3, 3, 3, + + 0, 0, 0, 0, // replace + 0, 158, 160, 0, + 0, 159, 0, 0, + 0, 0, 0, 0, + // clang-format on +}; +/** Miniset: Crumbled south pillar. */ +BYTE CRUSHCOL[] = { + // clang-format off + 3, 3, // width, height + + 3, 1, 3, // search + 2, 6, 3, + 3, 3, 3, + + 0, 0, 0, // replace + 0, 83, 0, + 0, 0, 0, + // clang-format on +}; +/** Miniset: Vertical oil spill. */ +BYTE BIG1[] = { + // clang-format off + 2, 2, // width, height + + 3, 3, // search + 3, 3, + + 113, 0, // replace + 112, 0, + // clang-format on +}; +/** Miniset: Horizontal oil spill. */ +BYTE BIG2[] = { + // clang-format off + 2, 2, // width, height + + 3, 3, // search + 3, 3, + + 114, 115, // replace + 0, 0, + // clang-format on +}; +/** Miniset: Horizontal platform. */ +BYTE BIG3[] = { + // clang-format off + 1, 2, // width, height + + 1, // search + 1, + + 117, // replace + 116, + // clang-format on +}; +/** Miniset: Vertical platform. */ +BYTE BIG4[] = { + // clang-format off + 2, 1, // width, height + + 2, 2, // search + + 118, 119, // replace + // clang-format on +}; +/** Miniset: Large oil spill. */ +BYTE BIG5[] = { + // clang-format off + 2, 2, // width, height + + 3, 3, // search + 3, 3, + + 120, 122, // replace + 121, 123, + // clang-format on +}; +/** Miniset: Vertical wall with debris. */ +BYTE BIG6[] = { + // clang-format off + 1, 2, // width, height + + 1, // search + 1, + + 125, // replace + 124, + // clang-format on +}; +/** Miniset: Horizontal wall with debris. */ +BYTE BIG7[] = { + // clang-format off + 2, 1, // width, height + + 2, 2, // search + + 126, 127, // replace + // clang-format on +}; +/** Miniset: Rock pile. */ +BYTE BIG8[] = { + // clang-format off + 2, 2, // width, height + + 3, 3, // search + 3, 3, + + 128, 130, // replace + 129, 131, + // clang-format on +}; +/** Miniset: Vertical wall collapsed. */ +BYTE BIG9[] = { + // clang-format off + 2, 2, // width, height + + 1, 3, // search + 1, 3, + + 133, 135, // replace + 132, 134, + // clang-format on +}; +/** Miniset: Horizontal wall collapsed. */ +BYTE BIG10[] = { + // clang-format off + 2, 2, // width, height + + 2, 2, // search + 3, 3, + + 136, 137, // replace + 3, 3, + // clang-format on +}; +/** Miniset: Crumbled vertical wall 1. */ +BYTE RUINS1[] = { + // clang-format off + 1, 1, // width, height + + 1, // search + + 80, // replace + // clang-format on +}; +/** Miniset: Crumbled vertical wall 2. */ +BYTE RUINS2[] = { + // clang-format off + 1, 1, // width, height + + 1, // search + + 81, // replace + // clang-format on +}; +/** Miniset: Crumbled vertical wall 3. */ +BYTE RUINS3[] = { + // clang-format off + 1, 1, // width, height + + 1, // search + + 82, // replace + // clang-format on +}; +/** Miniset: Crumbled horizontal wall 1. */ +BYTE RUINS4[] = { + // clang-format off + 1, 1, // width, height + + 2, // search + + 84, // replace + // clang-format on +}; +/** Miniset: Crumbled horizontal wall 2. */ +BYTE RUINS5[] = { + // clang-format off + 1, 1, // width, height + + 2, // search + + 85, // replace + // clang-format on +}; +/** Miniset: Crumbled horizontal wall 3. */ +BYTE RUINS6[] = { + // clang-format off + 1, 1, // width, height + + 2, // search + + 86, // replace + // clang-format on +}; +/** Miniset: Crumbled north pillar. */ +BYTE RUINS7[] = { + // clang-format off + 1, 1, // width, height + + 8, // search + + 87, // replace + // clang-format on +}; +/** Miniset: Bloody gib 1. */ +BYTE PANCREAS1[] = { + // clang-format off + 5, 3, // width, height + + 3, 3, 3, 3, 3, // search + 3, 3, 3, 3, 3, + 3, 3, 3, 3, 3, + + 0, 0, 0, 0, 0, // replace + 0, 0, 108, 0, 0, + 0, 0, 0, 0, 0, + // clang-format on +}; +/** Miniset: Bloody gib 2. */ +BYTE PANCREAS2[] = { + // clang-format off + 5, 3, // width, height + + 3, 3, 3, 3, 3, // search + 3, 3, 3, 3, 3, + 3, 3, 3, 3, 3, + + 0, 0, 0, 0, 0, // replace + 0, 0, 110, 0, 0, + 0, 0, 0, 0, 0, + // clang-format on +}; +/** Miniset: Move vertical doors away from west pillar 1. */ +BYTE CTRDOOR1[] = { + // clang-format off + 3, 3, // width, height + + 3, 1, 3, // search + 0, 4, 0, + 0, 9, 0, + + 0, 4, 0, // replace + 0, 1, 0, + 0, 0, 0, + // clang-format on +}; +/** Miniset: Move vertical doors away from west pillar 2. */ +BYTE CTRDOOR2[] = { + // clang-format off + 3, 3, // width, height + + 3, 1, 3, // search + 0, 4, 0, + 0, 8, 0, + + 0, 4, 0, // replace + 0, 1, 0, + 0, 0, 0, + // clang-format on +}; +/** Miniset: Move vertical doors away from west pillar 3. */ +BYTE CTRDOOR3[] = { + // clang-format off + 3, 3, // width, height + + 3, 1, 3, // search + 0, 4, 0, + 0, 6, 0, + + 0, 4, 0, // replace + 0, 1, 0, + 0, 0, 0, + // clang-format on +}; +/** Miniset: Move vertical doors away from west pillar 4. */ +BYTE CTRDOOR4[] = { + // clang-format off + 3, 3, // width, height + + 3, 1, 3, // search + 0, 4, 0, + 0, 7, 0, + + 0, 4, 0, // replace + 0, 1, 0, + 0, 0, 0, + // clang-format on +}; +/** Miniset: Move vertical doors away from west pillar 5. */ +BYTE CTRDOOR5[] = { + // clang-format off + 3, 3, // width, height + + 3, 1, 3, // search + 0, 4, 0, + 0, 15, 0, + + 0, 4, 0, // replace + 0, 1, 0, + 0, 0, 0, + // clang-format on +}; +/** Miniset: Move vertical doors away from west pillar 6. */ +BYTE CTRDOOR6[] = { + // clang-format off + 3, 3, // width, height + + 3, 1, 3, // search + 0, 4, 0, + 0, 13, 0, + + 0, 4, 0, // replace + 0, 1, 0, + 0, 0, 0, + // clang-format on +}; +/** Miniset: Move vertical doors away from west pillar 7. */ +BYTE CTRDOOR7[] = { + // clang-format off + 3, 3, // width, height + + 3, 1, 3, // search + 0, 4, 0, + 0, 16, 0, + + 0, 4, 0, // replace + 0, 1, 0, + 0, 0, 0, + // clang-format on +}; +/** Miniset: Move vertical doors away from west pillar 8. */ +BYTE CTRDOOR8[] = { + // clang-format off + 3, 3, // width, height + + 3, 1, 3, // search + 0, 4, 0, + 0, 14, 0, + + 0, 4, 0, // replace + 0, 1, 0, + 0, 0, 0, + // clang-format on +}; + int Patterns[100][10] = { { 0, 0, 0, 0, 0, 0, 0, 0, 0, 3 }, { 0, 0, 0, 0, 2, 0, 0, 0, 0, 3 }, diff --git a/Source/drlg_l3.cpp b/Source/drlg_l3.cpp index 8da6180e..8804c514 100644 --- a/Source/drlg_l3.cpp +++ b/Source/drlg_l3.cpp @@ -11,73 +11,484 @@ DEVILUTION_BEGIN_NAMESPACE +/** This will be true if a lava pool has been generated for the level */ BOOLEAN lavapool; +/** unused */ int abyssx; int lockoutcnt; BOOLEAN lockout[DMAXX][DMAXY]; +/** + * A lookup table for the 16 possible patterns of a 2x2 area, + * where each cell either contains a SW wall or it doesn't. + */ const BYTE L3ConvTbl[16] = { 8, 11, 3, 10, 1, 9, 12, 12, 6, 13, 4, 13, 2, 14, 5, 7 }; -const BYTE L3UP[20] = { 3, 3, 8, 8, 0, 10, 10, 0, 7, 7, 0, 51, 50, 0, 48, 49, 0, 0, 0, 0 }; -const BYTE L3DOWN[20] = { 3, 3, 8, 9, 7, 8, 9, 7, 0, 0, 0, 0, 47, 0, 0, 46, 0, 0, 0, 0 }; -const BYTE L3HOLDWARP[20] = { 3, 3, 8, 8, 0, 10, 10, 0, 7, 7, 0, 125, 125, 0, 125, 125, 0, 0, 0, 0 }; -const BYTE L3TITE1[34] = { 4, 4, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 0, 0, 0, 0, 0, 57, 58, 0, 0, 56, 55, 0, 0, 0, 0, 0 }; -const BYTE L3TITE2[34] = { 4, 4, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 0, 0, 0, 0, 0, 61, 62, 0, 0, 60, 59, 0, 0, 0, 0, 0 }; -const BYTE L3TITE3[34] = { 4, 4, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 0, 0, 0, 0, 0, 65, 66, 0, 0, 64, 63, 0, 0, 0, 0, 0 }; -const BYTE L3TITE6[42] = { 5, 4, 7, 7, 7, 7, 7, 7, 7, 7, 0, 7, 7, 7, 7, 0, 7, 7, 7, 7, 7, 7, 0, 0, 0, 0, 0, 0, 77, 78, 0, 0, 0, 76, 74, 75, 0, 0, 0, 0, 0, 0 }; -const BYTE L3TITE7[42] = { 4, 5, 7, 7, 7, 7, 7, 7, 0, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 0, 0, 0, 0, 0, 83, 0, 0, 0, 82, 80, 0, 0, 81, 79, 0, 0, 0, 0, 0 }; -const BYTE L3TITE8[20] = { 3, 3, 7, 7, 7, 7, 7, 7, 7, 7, 7, 0, 0, 0, 0, 52, 0, 0, 0, 0 }; -const BYTE L3TITE9[20] = { 3, 3, 7, 7, 7, 7, 7, 7, 7, 7, 7, 0, 0, 0, 0, 53, 0, 0, 0, 0 }; -const BYTE L3TITE10[20] = { 3, 3, 7, 7, 7, 7, 7, 7, 7, 7, 7, 0, 0, 0, 0, 54, 0, 0, 0, 0 }; -const BYTE L3TITE11[20] = { 3, 3, 7, 7, 7, 7, 7, 7, 7, 7, 7, 0, 0, 0, 0, 67, 0, 0, 0, 0 }; -const BYTE L3TITE12[6] = { 2, 1, 9, 7, 68, 0 }; -const BYTE L3TITE13[6] = { 1, 2, 10, 7, 69, 0 }; -const BYTE L3CREV1[6] = { 2, 1, 8, 7, 84, 85 }; -const BYTE L3CREV2[6] = { 2, 1, 8, 11, 86, 87 }; -const BYTE L3CREV3[6] = { 1, 2, 8, 10, 89, 88 }; -const BYTE L3CREV4[6] = { 2, 1, 8, 7, 90, 91 }; -const BYTE L3CREV5[6] = { 1, 2, 8, 11, 92, 93 }; -const BYTE L3CREV6[6] = { 1, 2, 8, 10, 95, 94 }; -const BYTE L3CREV7[6] = { 2, 1, 8, 7, 96, 101 }; -const BYTE L3CREV8[6] = { 1, 2, 2, 8, 102, 97 }; -const BYTE L3CREV9[6] = { 2, 1, 3, 8, 103, 98 }; -const BYTE L3CREV10[6] = { 2, 1, 4, 8, 104, 99 }; -const BYTE L3CREV11[6] = { 1, 2, 6, 8, 105, 100 }; -const BYTE L3ISLE1[14] = { 2, 3, 5, 14, 4, 9, 13, 12, 7, 7, 7, 7, 7, 7 }; -const BYTE L3ISLE2[14] = { 3, 2, 5, 2, 14, 13, 10, 12, 7, 7, 7, 7, 7, 7 }; -const BYTE L3ISLE3[14] = { 2, 3, 5, 14, 4, 9, 13, 12, 29, 30, 25, 28, 31, 32 }; -const BYTE L3ISLE4[14] = { 3, 2, 5, 2, 14, 13, 10, 12, 29, 26, 30, 31, 27, 32 }; -const BYTE L3ISLE5[10] = { 2, 2, 5, 14, 13, 12, 7, 7, 7, 7 }; -const BYTE L3XTRA1[4] = { 1, 1, 7, 106 }; -const BYTE L3XTRA2[4] = { 1, 1, 7, 107 }; -const BYTE L3XTRA3[4] = { 1, 1, 7, 108 }; -const BYTE L3XTRA4[4] = { 1, 1, 9, 109 }; -const BYTE L3XTRA5[4] = { 1, 1, 10, 110 }; -const BYTE L3ANVIL[244] = { - 11, 11, 7, 7, 7, 7, 7, 7, 7, 7, - 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, - 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, - 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, - 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, - 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, - 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, - 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, - 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, - 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, - 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, - 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, - 7, 7, 7, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 29, 26, 26, 26, - 26, 26, 30, 0, 0, 0, 29, 34, 33, 33, - 37, 36, 33, 35, 30, 0, 0, 25, 33, 37, - 27, 32, 31, 36, 33, 28, 0, 0, 25, 37, - 32, 7, 7, 7, 31, 27, 32, 0, 0, 25, - 28, 7, 7, 7, 7, 2, 2, 2, 0, 0, - 25, 35, 30, 7, 7, 7, 29, 26, 30, 0, - 0, 25, 33, 35, 26, 30, 29, 34, 33, 28, - 0, 0, 31, 36, 33, 33, 35, 34, 33, 37, - 32, 0, 0, 0, 31, 27, 27, 27, 27, 27, - 32, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0 +/** Miniset: Stairs up. */ +const BYTE L3UP[] = { + // clang-format off + 3, 3, // width, height + + 8, 8, 0, // search + 10, 10, 0, + 7, 7, 0, + + 51, 50, 0, // replace + 48, 49, 0, + 0, 0, 0, + // clang-format on +}; +/** Miniset: Stairs down. */ +const BYTE L3DOWN[] = { + // clang-format off + 3, 3, // width, height + + 8, 9, 7, // search + 8, 9, 7, + 0, 0, 0, + + 0, 47, 0, // replace + 0, 46, 0, + 0, 0, 0, + // clang-format on +}; +/** Miniset: Stairs up to town. */ +const BYTE L3HOLDWARP[] = { + // clang-format off + 3, 3, // width, height + + 8, 8, 0, // search + 10, 10, 0, + 7, 7, 0, + + 125, 125, 0, // replace + 125, 125, 0, + 0, 0, 0, + // clang-format on +}; +/** Miniset: Stalagmite white stalactite 1. */ +const BYTE L3TITE1[] = { + // clang-format off + 4, 4, // width, height + + 7, 7, 7, 7, // search + 7, 7, 7, 7, + 7, 7, 7, 7, + 7, 7, 7, 7, + + 0, 0, 0, 0, // replace + 0, 57, 58, 0, + 0, 56, 55, 0, + 0, 0, 0, 0, + // clang-format on +}; +/** Miniset: Stalagmite white stalactite 2. */ +const BYTE L3TITE2[] = { + // clang-format off + 4, 4, // width, height + + 7, 7, 7, 7, // search + 7, 7, 7, 7, + 7, 7, 7, 7, + 7, 7, 7, 7, + + 0, 0, 0, 0, // replace + 0, 61, 62, 0, + 0, 60, 59, 0, + 0, 0, 0, 0, + // clang-format on +}; +/** Miniset: Stalagmite white stalactite 3. */ +const BYTE L3TITE3[] = { + // clang-format off + 4, 4, // width, height + + 7, 7, 7, 7, // search + 7, 7, 7, 7, + 7, 7, 7, 7, + 7, 7, 7, 7, + + 0, 0, 0, 0, // replace + 0, 65, 66, 0, + 0, 64, 63, 0, + 0, 0, 0, 0, + // clang-format on +}; +/** Miniset: Stalagmite white stalactite horizontal. */ +const BYTE L3TITE6[] = { + // clang-format off + 5, 4, // width, height + + 7, 7, 7, 7, 7, // search + 7, 7, 7, 0, 7, + 7, 7, 7, 0, 7, + 7, 7, 7, 7, 7, + + 0, 0, 0, 0, 0, // replace + 0, 77, 78, 0, 0, + 0, 76, 74, 75, 0, + 0, 0, 0, 0, 0, + // clang-format on +}; +/** Miniset: Stalagmite white stalactite vertical. */ +const BYTE L3TITE7[] = { + // clang-format off + 4, 5, // width, height + + 7, 7, 7, 7, // search + 7, 7, 0, 7, + 7, 7, 7, 7, + 7, 7, 7, 7, + 7, 7, 7, 7, + + 0, 0, 0, 0, // replace + 0, 83, 0, 0, + 0, 82, 80, 0, + 0, 81, 79, 0, + 0, 0, 0, 0, + // clang-format on +}; +/** Miniset: Stalagmite 1. */ +const BYTE L3TITE8[] = { + // clang-format off + 3, 3, // width, height + + 7, 7, 7, // search + 7, 7, 7, + 7, 7, 7, + + 0, 0, 0, // replace + 0, 52, 0, + 0, 0, 0, + // clang-format on +}; +/** Miniset: Stalagmite 2. */ +const BYTE L3TITE9[] = { + // clang-format off + 3, 3, // width, height + + 7, 7, 7, // search + 7, 7, 7, + 7, 7, 7, + + 0, 0, 0, // replace + 0, 53, 0, + 0, 0, 0, + // clang-format on +}; +/** Miniset: Stalagmite 3. */ +const BYTE L3TITE10[] = { + // clang-format off + 3, 3, // width, height + + 7, 7, 7, // search + 7, 7, 7, + 7, 7, 7, + + 0, 0, 0, // replace + 0, 54, 0, + 0, 0, 0, + // clang-format on +}; +/** Miniset: Stalagmite 4. */ +const BYTE L3TITE11[] = { + // clang-format off + 3, 3, // width, height + + 7, 7, 7, // search + 7, 7, 7, + 7, 7, 7, + + 0, 0, 0, // replace + 0, 67, 0, + 0, 0, 0, + // clang-format on +}; +/** Miniset: Stalagmite on vertical wall. */ +const BYTE L3TITE12[] = { + // clang-format off + 2, 1, // width, height + + 9, 7, // search + + 68, 0, // replace + // clang-format on +}; +/** Miniset: Stalagmite on horizontal wall. */ +const BYTE L3TITE13[] = { + // clang-format off + 1, 2, // width, height + + 10, // search + 7, + + 69, // replace + 0, + // clang-format on +}; +/** Miniset: Cracked vertical wall 1. */ +const BYTE L3CREV1[] = { + // clang-format off + 2, 1, // width, height + + 8, 7, // search + + 84, 85, // replace + // clang-format on +}; +/** Miniset: Cracked vertical wall - north corner. */ +const BYTE L3CREV2[] = { + // clang-format off + 2, 1, // width, height + + 8, 11, // search + + 86, 87, // replace + // clang-format on +}; +/** Miniset: Cracked horizontal wall 1. */ +const BYTE L3CREV3[] = { + // clang-format off + 1, 2, // width, height + + 8, // search + 10, + + 89, // replace + 88, + // clang-format on +}; +/** Miniset: Cracked vertical wall 2. */ +const BYTE L3CREV4[] = { + // clang-format off + 2, 1, // width, height + + 8, 7, // search + + 90, 91, // replace + // clang-format on +}; +/** Miniset: Cracked horizontal wall - north corner. */ +const BYTE L3CREV5[] = { + // clang-format off + 1, 2, // width, height + + 8, // search + 11, + + 92, // replace + 93, + // clang-format on +}; +/** Miniset: Cracked horizontal wall 2. */ +const BYTE L3CREV6[] = { + // clang-format off + 1, 2, // width, height + + 8, // search + 10, + + 95, // replace + 94, + // clang-format on +}; +/** Miniset: Cracked vertical wall - west corner. */ +const BYTE L3CREV7[] = { + // clang-format off + 2, 1, // width, height + + 8, 7, // search + + 96, 101, // replace + // clang-format on +}; +/** Miniset: Cracked horizontal wall - north. */ +const BYTE L3CREV8[] = { + // clang-format off + 1, 2, // width, height + + 2, // search + 8, + + 102, // replace + 97, + // clang-format on +}; +/** Miniset: Cracked vertical wall - east corner. */ +const BYTE L3CREV9[] = { + // clang-format off + 2, 1, // width, height + + 3, 8, // search + + 103, 98, // replace + // clang-format on +}; +/** Miniset: Cracked vertical wall - west. */ +const BYTE L3CREV10[] = { + // clang-format off + 2, 1, // width, height + + 4, 8, // search + + 104, 99, // replace + // clang-format on +}; +/** Miniset: Cracked horizontal wall - south corner. */ +const BYTE L3CREV11[] = { + // clang-format off + 1, 2, // width, height + + 6, // search + 8, + + 105, // replace + 100, + // clang-format on +}; +/** Miniset: Replace broken wall with floor 1. */ +const BYTE L3ISLE1[] = { + // clang-format off + 2, 3, // width, height + + 5, 14, // search + 4, 9, + 3, 12, + + 7, 7, // replace + 7, 7, + 7, 7, + // clang-format on +}; +/** Miniset: Replace small wall with floor 2. */ +const BYTE L3ISLE2[] = { + // clang-format off + 3, 2, // width, height + + 5, 2, 14, // search + 13, 10, 12, + + 7, 7, 7, // replace + 7, 7, 7, + // clang-format on +}; +/** Miniset: Replace small wall with lava 1. */ +const BYTE L3ISLE3[] = { + // clang-format off + 2, 3, // width, height + + 5, 14, // search + 4, 9, + 13, 12, + + 29, 30, // replace + 25, 28, + 31, 32, + // clang-format on +};/** Miniset: Replace small wall with lava 2. */ + +const BYTE L3ISLE4[] = { + // clang-format off + 3, 2, // width, height + + 5, 2, 14, // search + 13, 10, 12, + + 29, 26, 30, // replace + 31, 27, 32, + // clang-format on +}; +/** Miniset: Replace small wall with floor 3. */ +const BYTE L3ISLE5[] = { + // clang-format off + 2, 2, // width, height + + 5, 14, // search + 13, 12, + + 7, 7, // replace + 7, 7, + // clang-format on +}; +/** Miniset: Use random floor tile 1. */ +const BYTE L3XTRA1[] = { + // clang-format off + 1, 1, // width, height + + 7, // search + + 106, // replace + // clang-format on +}; +/** Miniset: Use random floor tile 2. */ +const BYTE L3XTRA2[] = { + // clang-format off + 1, 1, // width, height + + 7, // search + + 107, // replace + // clang-format on +}; +/** Miniset: Use random floor tile 3. */ +const BYTE L3XTRA3[] = { + // clang-format off + 1, 1, // width, height + + 7, // search + + 108, // replace + // clang-format on +}; +/** Miniset: Use random horizontal wall tile. */ +const BYTE L3XTRA4[] = { + // clang-format off + 1, 1, // width, height + + 9, // search + + 109, // replace + // clang-format on +}; +/** Miniset: Use random vertical wall tile. */ +const BYTE L3XTRA5[] = { + // clang-format off + 1, 1, // width, height + + 10, // search + + 110, // replace + // clang-format on +}; + +/** Miniset: Anvil of Fury island. */ +const BYTE L3ANVIL[] = { + // clang-format on + 11, 11, // width, height + + 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, // search + 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, + 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, + 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, + 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, + 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, + 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, + 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, + 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, + 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, + 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, + + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // replace + 0, 0, 29, 26, 26, 26, 26, 26, 30, 0, 0, + 0, 29, 34, 33, 33, 37, 36, 33, 35, 30, 0, + 0, 25, 33, 37, 27, 32, 31, 36, 33, 28, 0, + 0, 25, 37, 32, 7, 7, 7, 31, 27, 32, 0, + 0, 25, 28, 7, 7, 7, 7, 2, 2, 2, 0, + 0, 25, 35, 30, 7, 7, 7, 29, 26, 30, 0, + 0, 25, 33, 35, 26, 30, 29, 34, 33, 28, 0, + 0, 31, 36, 33, 33, 35, 34, 33, 37, 32, 0, + 0, 0, 31, 27, 27, 27, 27, 27, 32, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + // clang-format on }; static void InitL3Dungeon() diff --git a/Source/drlg_l4.cpp b/Source/drlg_l4.cpp index 12ac68b3..f9d3bf32 100644 --- a/Source/drlg_l4.cpp +++ b/Source/drlg_l4.cpp @@ -27,257 +27,104 @@ BYTE L4dungeon[80][80]; BYTE dung[20][20]; //int dword_52A4DC; +/** + * A lookup table for the 16 possible patterns of a 2x2 area, + * where each cell either contains a SW wall or it doesn't. + */ const BYTE L4ConvTbl[16] = { 30, 6, 1, 6, 2, 6, 6, 6, 9, 6, 1, 6, 2, 6, 3, 6 }; -const BYTE L4USTAIRS[42] = { - 4, - 5, - 6, - 6, - 6, - 6, - 6, - 6, - 6, - 6, - 6, - 6, - 6, - 6, - 6, - 6, - 6, - 6, - 6, - 6, - 6, - 6, - 0, - 0, - 0, - 0, - 36, - 38, - 35, - 0, - 37, - 34, - 33, - 32, - 0, - 0, - 31, - 0, - 0, - 0, - 0, - 0 + +/** Miniset: Stairs up. */ +const BYTE L4USTAIRS[] = { + // clang-format off + 4, 5, // width, height + + 6, 6, 6, 6, // search + 6, 6, 6, 6, + 6, 6, 6, 6, + 6, 6, 6, 6, + 6, 6, 6, 6, + + 0, 0, 0, 0, // replace + 36, 38, 35, 0, + 37, 34, 33, 32, + 0, 0, 31, 0, + 0, 0, 0, 0, + // clang-format on }; -const BYTE L4TWARP[42] = { - 4, - 5, - 6, - 6, - 6, - 6, - 6, - 6, - 6, - 6, - 6, - 6, - 6, - 6, - 6, - 6, - 6, - 6, - 6, - 6, - 6, - 6, - 0, - 0, - 0, - 0, - 134, - 136, - 133, - 0, - 135, - 132, - 131, - 130, - 0, - 0, - 129, - 0, - 0, - 0, - 0, - 0 +/** Miniset: Stairs up to town. */ +const BYTE L4TWARP[] = { + // clang-format off + 4, 5, // width, height + + 6, 6, 6, 6, // search + 6, 6, 6, 6, + 6, 6, 6, 6, + 6, 6, 6, 6, + 6, 6, 6, 6, + + 0, 0, 0, 0, // replace + 134, 136, 133, 0, + 135, 132, 131, 130, + 0, 0, 129, 0, + 0, 0, 0, 0, + // clang-format on }; -const BYTE L4DSTAIRS[52] = { - 5, - 5, - 6, - 6, - 6, - 6, - 6, - 6, - 6, - 6, - 6, - 6, - 6, - 6, - 6, - 6, - 6, - 6, - 6, - 6, - 6, - 6, - 6, - 6, - 6, - 6, - 6, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 45, - 41, - 0, - 0, - 44, - 43, - 40, - 0, - 0, - 46, - 42, - 39, - 0, - 0, - 0, - 0, - 0, - 0 +/** Miniset: Stairs down. */ +const BYTE L4DSTAIRS[] = { + // clang-format off + 5, 5, // width, height + + 6, 6, 6, 6, 6, // search + 6, 6, 6, 6, 6, + 6, 6, 6, 6, 6, + 6, 6, 6, 6, 6, + 6, 6, 6, 6, 6, + + 0, 0, 0, 0, 0, // replace + 0, 0, 45, 41, 0, + 0, 44, 43, 40, 0, + 0, 46, 42, 39, 0, + 0, 0, 0, 0, 0, + // clang-format on }; -const BYTE L4PENTA[52] = { - 5, - 5, - 6, - 6, - 6, - 6, - 6, - 6, - 6, - 6, - 6, - 6, - 6, - 6, - 6, - 6, - 6, - 6, - 6, - 6, - 6, - 6, - 6, - 6, - 6, - 6, - 6, - 0, - 0, - 0, - 0, - 0, - 0, - 98, - 100, - 103, - 0, - 0, - 99, - 102, - 105, - 0, - 0, - 101, - 104, - 106, - 0, - 0, - 0, - 0, - 0, - 0 +/** Miniset: Pentagram. */ +const BYTE L4PENTA[] = { + // clang-format off + 5, 5, // width, height + + 6, 6, 6, 6, 6, // search + 6, 6, 6, 6, 6, + 6, 6, 6, 6, 6, + 6, 6, 6, 6, 6, + 6, 6, 6, 6, 6, + + 0, 0, 0, 0, 0, // replace + 0, 98, 100, 103, 0, + 0, 99, 102, 105, 0, + 0, 101, 104, 106, 0, + 0, 0, 0, 0, 0, + // clang-format on }; -const BYTE L4PENTA2[52] = { - 5, - 5, - 6, - 6, - 6, - 6, - 6, - 6, - 6, - 6, - 6, - 6, - 6, - 6, - 6, - 6, - 6, - 6, - 6, - 6, - 6, - 6, - 6, - 6, - 6, - 6, - 6, - 0, - 0, - 0, - 0, - 0, - 0, - 107, - 109, - 112, - 0, - 0, - 108, - 111, - 114, - 0, - 0, - 110, - 113, - 115, - 0, - 0, - 0, - 0, - 0, - 0 +/** Miniset: Pentagram portal. */ +const BYTE L4PENTA2[] = { + // clang-format off + 5, 5, // width, height + + 6, 6, 6, 6, 6, // search + 6, 6, 6, 6, 6, + 6, 6, 6, 6, 6, + 6, 6, 6, 6, 6, + 6, 6, 6, 6, 6, + + 0, 0, 0, 0, 0, // replace + 0, 107, 109, 112, 0, + 0, 108, 111, 114, 0, + 0, 110, 113, 115, 0, + 0, 0, 0, 0, 0, + // clang-format on }; + +/** Maps tile IDs to their corresponding undecorated tile ID. */ const BYTE L4BTYPES[140] = { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 0, 0, diff --git a/Source/engine.cpp b/Source/engine.cpp index ec488f30..93a7d7c6 100644 --- a/Source/engine.cpp +++ b/Source/engine.cpp @@ -15,7 +15,8 @@ DEVILUTION_BEGIN_NAMESPACE -char gbPixelCol; // automap pixel color 8-bit (palette entry) +/** automap pixel color 8-bit (palette entry) */ +char gbPixelCol; BOOL gbRotateMap; // flip - if y < x int orgseed; /** Width of sprite being blitted */ @@ -23,6 +24,7 @@ int sgnWidth; /** Current game seed */ int sglGameSeed; static CCritSect sgMemCrit; +/** Number of times the current seed has been fetched */ int SeedCount; BOOL gbNotInView; // valid - if x/y are in bounds @@ -1078,6 +1080,7 @@ void Cl2BlitOutlineSafe(BYTE *pDecodeTo, BYTE *pRLEBytes, int nDataSize, int nWi dst[-1] = col; dst[1] = col; dst[-BUFFER_WIDTH] = col; + // BUGFIX: only set `if (dst+BUFFER_WIDTH < gpBufEnd)` dst[BUFFER_WIDTH] = col; } dst++; diff --git a/Source/gendung.cpp b/Source/gendung.cpp index 47ffc998..3e9dd0a9 100644 --- a/Source/gendung.cpp +++ b/Source/gendung.cpp @@ -7,29 +7,61 @@ DEVILUTION_BEGIN_NAMESPACE +/** Contains the tile IDs of the map. */ BYTE dungeon[DMAXX][DMAXY]; +/** Contains a backup of the tile IDs of the map. */ BYTE pdungeon[DMAXX][DMAXY]; char dflags[DMAXX][DMAXY]; +/** Specifies the active set level X-coordinate of the map. */ int setpc_x; +/** Specifies the active set level Y-coordinate of the map. */ int setpc_y; +/** Specifies the width of the active set level of the map. */ int setpc_w; +/** Specifies the height of the active set level of the map. */ int setpc_h; +/** Contains the contents of the single player quest DUN file. */ BYTE *pSetPiece; +/** Specifies whether a single player quest DUN has been loaded. */ BOOL setloadflag; BYTE *pSpecialCels; +/** Specifies the tile definitions of the active dungeon type; (e.g. levels/l1data/l1.til). */ BYTE *pMegaTiles; BYTE *pLevelPieces; BYTE *pDungeonCels; BYTE *pSpeedCels; +/** + * Returns the frame number of the speed CEL, an in memory decoding + * of level CEL frames, based on original frame number and light index. + * Note, given light index 0, the original frame number is returned. + */ int SpeedFrameTbl[128][16]; /** * List of transparancy masks to use for dPieces */ char block_lvid[MAXTILES + 1]; +/** Specifies the CEL frame occurrence for each frame of the level CEL (e.g. "levels/l1data/l1.cel"). */ int level_frame_count[MAXTILES]; int tile_defs[MAXTILES]; +/** + * Secifies the CEL frame decoder type for each frame of the + * level CEL (e.g. "levels/l1data/l1.cel"), Indexed by frame numbers starting at 1. + * The decoder type may be one of the following. + * 0x0000 - cel.decodeType0 + * 0x1000 - cel.decodeType1 + * 0x2000 - cel.decodeType2 + * 0x3000 - cel.decodeType3 + * 0x4000 - cel.decodeType4 + * 0x5000 - cel.decodeType5 + * 0x6000 - cel.decodeType6 + */ WORD level_frame_types[MAXTILES]; +/** + * Specifies the size of each frame of the level cel (e.g. + * "levels/l1data/l1.cel"). Indexed by frame numbers starting at 1. + */ int level_frame_sizes[MAXTILES]; +/** Specifies the number of frames in the level cel (e.g. "levels/l1data/l1.cel"). */ int nlevel_frames; /** * List of light blocking dPieces @@ -48,41 +80,77 @@ BOOLEAN nTransTable[MAXTILES + 1]; */ BOOLEAN nMissileTable[MAXTILES + 1]; BOOLEAN nTrapTable[MAXTILES + 1]; +/** Specifies the minimum X-coordinate of the map. */ int dminx; +/** Specifies the minimum Y-coordinate of the map. */ int dminy; +/** Specifies the maximum X-coordinate of the map. */ int dmaxx; +/** Specifies the maximum Y-coordinate of the map. */ int dmaxy; int gnDifficulty; +/** Specifies the active dungeon type of the current game. */ BYTE leveltype; +/** Specifies the active dungeon level of the current game. */ BYTE currlevel; BOOLEAN setlevel; +/** Specifies the active quest level of the current game. */ BYTE setlvlnum; char setlvltype; +/** Specifies the player viewpoint X-coordinate of the map. */ int ViewX; +/** Specifies the player viewpoint Y-coordinate of the map. */ int ViewY; int ViewBX; int ViewBY; int ViewDX; int ViewDY; ScrollStruct ScrollInfo; +/** Specifies the level viewpoint X-coordinate of the map. */ int LvlViewX; +/** Specifies the level viewpoint Y-coordinate of the map. */ int LvlViewY; int MicroTileLen; char TransVal; +/** Specifies the active transparency indices. */ BOOLEAN TransList[256]; +/** Contains the piece IDs of each tile on the map. */ int dPiece[MAXDUNX][MAXDUNY]; +/** Specifies the dungeon piece information for a given coordinate and block number. */ MICROS dpiece_defs_map_2[MAXDUNX][MAXDUNY]; +/** Specifies the dungeon piece information for a given coordinate and block number, optimized for diagonal access. */ MICROS dpiece_defs_map_1[MAXDUNX * MAXDUNY]; +/** Specifies the transparency at each coordinate of the map. */ char dTransVal[MAXDUNX][MAXDUNY]; char dLight[MAXDUNX][MAXDUNY]; char dPreLight[MAXDUNX][MAXDUNY]; char dFlags[MAXDUNX][MAXDUNY]; +/** Contains the player numbers (players array indices) of the map. */ char dPlayer[MAXDUNX][MAXDUNY]; +/** + * Contains the NPC numbers of the map. The NPC number represents a + * towner number (towners array index) in Tristram and a monster number + * (monsters array index) in the dungeon. + */ int dMonster[MAXDUNX][MAXDUNY]; +/** + * Contains the dead numbers (deads array indices) and dead direction of + * the map, encoded as specified by the pseudo-code below. + * dDead[x][y] & 0x1F - index of dead + * dDead[x][y] >> 0x5 - direction + */ char dDead[MAXDUNX][MAXDUNY]; +/** Contains the object numbers (objects array indices) of the map. */ char dObject[MAXDUNX][MAXDUNY]; +/** Contains the item numbers (items array indices) of the map. */ char dItem[MAXDUNX][MAXDUNY]; +/** Contains the missile numbers (missiles array indices) of the map. */ char dMissile[MAXDUNX][MAXDUNY]; +/** + * Contains the arch frame numbers of the map from the special tileset + * (e.g. "levels/l1data/l1s.cel"). Note, the special tileset of Tristram (i.e. + * "levels/towndata/towns.cel") contains trees rather than arches. + */ char dSpecial[MAXDUNX][MAXDUNY]; int themeCount; THEME_LOC themeLoc[MAXTHEMES]; diff --git a/Source/help.cpp b/Source/help.cpp index 668acb9d..c0160a82 100644 --- a/Source/help.cpp +++ b/Source/help.cpp @@ -538,14 +538,14 @@ void DrawHelp() PrintSString(0, 23, TRUE, "Press ESC to end or the arrow keys to scroll.", COL_GOLD, 0); } -void DrawHelpLine(int always_0, int help_line_nr, char *text, char color) +void DrawHelpLine(int x, int y, char *text, char color) { int sx, sy, width; BYTE c; width = 0; - sx = always_0 + 96 + PANEL_LEFT; - sy = help_line_nr * 12 + 204; + sx = x + 32 + PANEL_X; + sy = y * 12 + 44 + SCREEN_Y; while (*text) { c = gbFontTransTbl[(BYTE)*text]; text++; diff --git a/Source/help.h b/Source/help.h index 75e60446..f7d2c783 100644 --- a/Source/help.h +++ b/Source/help.h @@ -20,7 +20,7 @@ extern int HelpTop; void InitHelp(); void DrawHelp(); -void DrawHelpLine(int always_0, int help_line_nr, char *text, char color); +void DrawHelpLine(int x, int y, char *text, char color); void DisplayHelp(); void HelpScrollUp(); void HelpScrollDown(); diff --git a/Source/init.cpp b/Source/init.cpp index 005e5e4a..f84b0047 100644 --- a/Source/init.cpp +++ b/Source/init.cpp @@ -13,13 +13,21 @@ DEVILUTION_BEGIN_NAMESPACE _SNETVERSIONDATA fileinfo; +/** True if the game is the current active window */ int gbActive; +/** Specifies the path to diablo.exe. */ char diablo_exe_path[MAX_PATH]; +/** A handle to an unused MPQ archive. */ HANDLE hellfire_mpq; +/** Specifies the path to patch_rt.mpq. */ char patch_rt_mpq_path[MAX_PATH]; +/** The current input handler function */ WNDPROC CurrentProc; -HANDLE diabdat_mpq = NULL; +/** A handle to the diabdat.mpq archive. */ +HANDLE diabdat_mpq; +/** Specifies the path to diabdat.mpq. */ char diabdat_mpq_path[MAX_PATH]; +/** A handle to the patch_rt.mpq archive. */ HANDLE patch_rt_mpq; /* data */ diff --git a/Source/inv.cpp b/Source/inv.cpp index 042fefc4..4d44ff87 100644 --- a/Source/inv.cpp +++ b/Source/inv.cpp @@ -157,6 +157,9 @@ void InvDrawSlotBack(int X, int Y, int W, int H) } } +/** + * @brief Render the inventory panel to the back buffer + */ void DrawInv() { BOOL invtest[NUM_INV_GRID_ELEM]; @@ -1481,7 +1484,7 @@ void InvGetItem(int pnum, int ii) if (dItem[item[ii]._ix][item[ii]._iy] != 0) { if (myplr == pnum && pcurs >= CURSOR_FIRSTITEM) NetSendCmdPItem(TRUE, CMD_SYNCPUTITEM, plr[myplr]._px, plr[myplr]._py); - item[ii]._iCreateInfo &= ~0x8000; + item[ii]._iCreateInfo &= ~CF_PREGEN; plr[pnum].HoldItem = item[ii]; CheckQuestItem(pnum); CheckBookLevel(pnum); @@ -1521,7 +1524,7 @@ void AutoGetItem(int pnum, int ii) return; } - item[ii]._iCreateInfo &= 0x7FFF; + item[ii]._iCreateInfo &= ~CF_PREGEN; plr[pnum].HoldItem = item[ii]; /// BUGFIX: overwrites cursor item, allowing for belt dupe bug CheckQuestItem(pnum); CheckBookLevel(pnum); diff --git a/Source/items.cpp b/Source/items.cpp index 01f6e438..e1b8e36a 100644 --- a/Source/items.cpp +++ b/Source/items.cpp @@ -12,6 +12,7 @@ BOOL uitemflag; int itemavail[MAXITEMS]; ItemStruct curruitem; ItemGetRecordStruct itemrecord[MAXITEMS]; +/** Contains the items on ground in the current game. */ ItemStruct item[MAXITEMS + 1]; BOOL itemhold[3][3]; BYTE *itemanims[ITEMTYPES]; @@ -21,6 +22,7 @@ int gnNumGetRecords; /* data */ +/** Maps from item_cursor_graphic to in-memory item type. */ BYTE ItemCAnimTbl[] = { 20, 16, 16, 16, 4, 4, 4, 12, 12, 12, 12, 12, 12, 12, 12, 21, 21, 25, 12, 28, @@ -40,6 +42,7 @@ BYTE ItemCAnimTbl[] = { 14, 17, 17, 17, 0, 34, 1, 0, 3, 17, 8, 8, 6, 1, 3, 3, 11, 3, 4 }; +/** Map of item type .cel file names. */ char *ItemDropNames[] = { "Armor2", "Axe", @@ -77,6 +80,7 @@ char *ItemDropNames[] = { "Fanvil", "FLazStaf", }; +/** Maps of item drop animation length. */ BYTE ItemAnimLs[] = { 15, 13, @@ -114,6 +118,7 @@ BYTE ItemAnimLs[] = { 13, 8, }; +/** Maps of drop sounds effect of dropping the item on ground. */ int ItemDropSnds[] = { IS_FHARM, IS_FAXE, @@ -151,6 +156,7 @@ int ItemDropSnds[] = { IS_FANVL, IS_FSTAF, }; +/** Maps of drop sounds effect of placing the item in the inventory. */ int ItemInvSnds[] = { IS_IHARM, IS_IAXE, @@ -188,7 +194,9 @@ int ItemInvSnds[] = { IS_IANVL, IS_ISTAF, }; +/** Specifies the current Y-coordinate used for validation of items on ground. */ int idoppely = 16; +/** Maps from Griswold premium item number to a quality level delta as added to the base quality level. */ int premiumlvladd[6] = { -1, -1, 0, 0, 1, 2 }; void InitItemGFX() @@ -245,7 +253,7 @@ void AddInitItems() GetItemAttrs(i, IDI_HEAL, currlevel); else GetItemAttrs(i, IDI_MANA, currlevel); - item[i]._iCreateInfo = currlevel - 0x8000; + item[i]._iCreateInfo = currlevel - CF_PREGEN; SetupItem(i); item[i]._iAnimFrame = item[i]._iAnimLen; item[i]._iAnimFlag = FALSE; @@ -2002,7 +2010,7 @@ void GetUniqueItem(int i, int uid) item[i]._iUid = uid; item[i]._iMagical = ITEM_QUALITY_UNIQUE; - item[i]._iCreateInfo |= 0x0200; + item[i]._iCreateInfo |= CF_UNIQUE; } void SpawnUnique(int uid, int x, int y) @@ -2044,14 +2052,14 @@ void SetupAllItems(int ii, int idx, int iseed, int lvl, int uper, int onlygood, item[ii]._iCreateInfo = lvl; if (pregen) - item[ii]._iCreateInfo = lvl | 0x8000; + item[ii]._iCreateInfo = lvl | CF_PREGEN; if (onlygood) - item[ii]._iCreateInfo |= 0x40; + item[ii]._iCreateInfo |= CF_ONLYGOOD; if (uper == 15) - item[ii]._iCreateInfo |= 0x80; + item[ii]._iCreateInfo |= CF_UPER15; else if (uper == 1) - item[ii]._iCreateInfo |= 0x0100; + item[ii]._iCreateInfo |= CF_UPER1; if (item[ii]._iMiscId != IMISC_UNIQUE) { iblvl = -1; @@ -2077,7 +2085,7 @@ void SetupAllItems(int ii, int idx, int iseed, int lvl, int uper, int onlygood, GetItemBonus(ii, idx, iblvl >> 1, iblvl, onlygood); } else { GetUniqueItem(ii, uid); - item[ii]._iCreateInfo |= 0x0200; + item[ii]._iCreateInfo |= CF_UNIQUE; } } if (item[ii]._iMagical != ITEM_QUALITY_UNIQUE) @@ -2199,7 +2207,7 @@ void SetupAllUseful(int ii, int iseed, int lvl) idx = IDI_PORTAL; GetItemAttrs(ii, idx, lvl); - item[ii]._iCreateInfo = lvl + 384; + item[ii]._iCreateInfo = lvl + CF_USEFUL; SetupItem(ii); } @@ -2266,26 +2274,26 @@ void RecreateItem(int ii, int idx, WORD icreateinfo, int iseed, int ivalue) SetPlrHandItem(&item[ii], idx); SetPlrHandSeed(&item[ii], iseed); } else { - if (icreateinfo & 0x7C00) { + if (icreateinfo & CF_TOWN) { RecreateTownItem(ii, idx, icreateinfo, iseed, ivalue); - } else if ((icreateinfo & 0x0180) == 0x0180) { - SetupAllUseful(ii, iseed, icreateinfo & 0x3F); + } else if ((icreateinfo & CF_USEFUL) == CF_USEFUL) { + SetupAllUseful(ii, iseed, icreateinfo & CF_LEVEL); } else { uper = 0; onlygood = 0; recreate = 0; pregen = FALSE; - if (icreateinfo & 0x0100) + if (icreateinfo & CF_UPER1) uper = 1; - if (icreateinfo & 0x80) + if (icreateinfo & CF_UPER15) uper = 15; - if (icreateinfo & 0x40) + if (icreateinfo & CF_ONLYGOOD) onlygood = 1; - if (icreateinfo & 0x0200) + if (icreateinfo & CF_UNIQUE) recreate = 1; - if (icreateinfo & 0x8000) + if (icreateinfo & CF_PREGEN) pregen = TRUE; - SetupAllItems(ii, idx, iseed, icreateinfo & 0x3F, uper, onlygood, recreate, pregen); + SetupAllItems(ii, idx, iseed, icreateinfo & CF_LEVEL, uper, onlygood, recreate, pregen); } } } @@ -2931,8 +2939,8 @@ void PrintUString(int x, int y, BOOL cjustflag, char *str, int col) int len, width, sx, sy, i, k; BYTE c; - sx = x + 96; - sy = y * 12 + 204; + sx = x + 32 + SCREEN_X; + sy = y * 12 + 44 + SCREEN_Y; len = strlen(str); k = 0; if (cjustflag) { @@ -2962,10 +2970,10 @@ void DrawULine(int y) BYTE *src, *dst; src = &gpBuffer[SCREENXY(26 + RIGHT_PANEL - SPANEL_WIDTH, 25)]; - dst = &gpBuffer[BUFFER_WIDTH * (y * 12 + 198) + 26 + RIGHT_PANEL_X - SPANEL_WIDTH]; + dst = &gpBuffer[BUFFER_WIDTH * (y * 12 + 38 + SCREEN_Y) + 26 + RIGHT_PANEL_X - SPANEL_WIDTH]; for (i = 0; i < 3; i++, src += BUFFER_WIDTH, dst += BUFFER_WIDTH) - memcpy(dst, src, 266); + memcpy(dst, src, 266); // BUGFIX: should be 267 } void DrawUniqueInfo() @@ -3389,7 +3397,7 @@ void SpawnSmith(int lvl) GetItemAttrs(0, idata, lvl); } while (item[0]._iIvalue > SMITH_MAX_VALUE); smithitem[i] = item[0]; - smithitem[i]._iCreateInfo = lvl | 0x400; + smithitem[i]._iCreateInfo = lvl | CF_SMITH; smithitem[i]._iIdentified = TRUE; smithitem[i]._iStatFlag = StoreStatOk(&smithitem[i]); } @@ -3461,7 +3469,7 @@ void SpawnOnePremium(int i, int plvl) GetItemBonus(0, itype, plvl >> 1, plvl, TRUE); } while (item[0]._iIvalue > SMITH_MAX_PREMIUM_VALUE); premiumitem[i] = item[0]; - premiumitem[i]._iCreateInfo = plvl | 0x800; + premiumitem[i]._iCreateInfo = plvl | CF_SMITHPREMIUM; premiumitem[i]._iIdentified = TRUE; premiumitem[i]._iStatFlag = StoreStatOk(&premiumitem[i]); item[0] = holditem; @@ -3607,7 +3615,7 @@ void SpawnWitch(int lvl) GetItemBonus(0, idata, maxlvl >> 1, maxlvl, TRUE); } while (item[0]._iIvalue > 140000); witchitem[i] = item[0]; - witchitem[i]._iCreateInfo = lvl | 0x2000; + witchitem[i]._iCreateInfo = lvl | CF_WITCH; witchitem[i]._iIdentified = TRUE; WitchBookLevel(i); witchitem[i]._iStatFlag = StoreStatOk(&witchitem[i]); @@ -3648,7 +3656,7 @@ void SpawnBoy(int lvl) GetItemBonus(0, itype, lvl, 2 * lvl, TRUE); } while (item[0]._iIvalue > 90000); boyitem = item[0]; - boyitem._iCreateInfo = lvl | 0x1000; + boyitem._iCreateInfo = lvl | CF_BOY; boyitem._iIdentified = TRUE; boyitem._iStatFlag = StoreStatOk(&boyitem); boylevel = lvl >> 1; @@ -3770,7 +3778,7 @@ void SpawnHealer(int lvl) itype = RndHealerItem(lvl) - 1; GetItemAttrs(0, itype, lvl); healitem[i] = item[0]; - healitem[i]._iCreateInfo = lvl | 0x4000; + healitem[i]._iCreateInfo = lvl | CF_HEALER; healitem[i]._iIdentified = TRUE; healitem[i]._iStatFlag = StoreStatOk(&healitem[i]); } @@ -3796,7 +3804,7 @@ void RecreateSmithItem(int ii, int idx, int lvl, int iseed) GetItemAttrs(ii, itype, lvl); item[ii]._iSeed = iseed; - item[ii]._iCreateInfo = lvl | 0x400; + item[ii]._iCreateInfo = lvl | CF_SMITH; item[ii]._iIdentified = TRUE; } @@ -3810,7 +3818,7 @@ void RecreatePremiumItem(int ii, int idx, int plvl, int iseed) GetItemBonus(ii, itype, plvl >> 1, plvl, TRUE); item[ii]._iSeed = iseed; - item[ii]._iCreateInfo = plvl | 0x800; + item[ii]._iCreateInfo = plvl | CF_SMITHPREMIUM; item[ii]._iIdentified = TRUE; } @@ -3823,7 +3831,7 @@ void RecreateBoyItem(int ii, int idx, int lvl, int iseed) GetItemAttrs(ii, itype, lvl); GetItemBonus(ii, itype, lvl, 2 * lvl, TRUE); item[ii]._iSeed = iseed; - item[ii]._iCreateInfo = lvl | 0x1000; + item[ii]._iCreateInfo = lvl | CF_BOY; item[ii]._iIdentified = TRUE; } @@ -3847,7 +3855,7 @@ void RecreateWitchItem(int ii, int idx, int lvl, int iseed) } item[ii]._iSeed = iseed; - item[ii]._iCreateInfo = lvl | 0x2000; + item[ii]._iCreateInfo = lvl | CF_WITCH; item[ii]._iIdentified = TRUE; } @@ -3864,22 +3872,22 @@ void RecreateHealerItem(int ii, int idx, int lvl, int iseed) } item[ii]._iSeed = iseed; - item[ii]._iCreateInfo = lvl | 0x4000; + item[ii]._iCreateInfo = lvl | CF_HEALER; item[ii]._iIdentified = TRUE; } void RecreateTownItem(int ii, int idx, WORD icreateinfo, int iseed, int ivalue) { - if (icreateinfo & 0x400) - RecreateSmithItem(ii, idx, icreateinfo & 0x3F, iseed); - else if (icreateinfo & 0x800) - RecreatePremiumItem(ii, idx, icreateinfo & 0x3F, iseed); - else if (icreateinfo & 0x1000) - RecreateBoyItem(ii, idx, icreateinfo & 0x3F, iseed); - else if (icreateinfo & 0x2000) - RecreateWitchItem(ii, idx, icreateinfo & 0x3F, iseed); - else if (icreateinfo & 0x4000) - RecreateHealerItem(ii, idx, icreateinfo & 0x3F, iseed); + if (icreateinfo & CF_SMITH) + RecreateSmithItem(ii, idx, icreateinfo & CF_LEVEL, iseed); + else if (icreateinfo & CF_SMITHPREMIUM) + RecreatePremiumItem(ii, idx, icreateinfo & CF_LEVEL, iseed); + else if (icreateinfo & CF_BOY) + RecreateBoyItem(ii, idx, icreateinfo & CF_LEVEL, iseed); + else if (icreateinfo & CF_WITCH) + RecreateWitchItem(ii, idx, icreateinfo & CF_LEVEL, iseed); + else if (icreateinfo & CF_HEALER) + RecreateHealerItem(ii, idx, icreateinfo & CF_LEVEL, iseed); } void RecalcStoreStats() diff --git a/Source/loadsave.cpp b/Source/loadsave.cpp index ad0ff4e3..ec27f6eb 100644 --- a/Source/loadsave.cpp +++ b/Source/loadsave.cpp @@ -9,6 +9,10 @@ DEVILUTION_BEGIN_NAMESPACE BYTE *tbuff; +/** + * @brief Load game state + * @param firstflag Can be set to false if we are simply reloading the current game + */ void LoadGame(BOOL firstflag) { int i, j; diff --git a/Source/minitext.cpp b/Source/minitext.cpp index 39835e29..a273a1d2 100644 --- a/Source/minitext.cpp +++ b/Source/minitext.cpp @@ -73,7 +73,7 @@ void InitQTextMsg(int m) questlog = FALSE; qtextptr = alltext[m].txtstr; qtextflag = TRUE; - qtexty = 500; + qtexty = 340 + SCREEN_Y; qtextSpd = qscroll_spd_tbl[alltext[m].txtspd - 1]; if (qtextSpd <= 0) scrolltexty = 50 / -(qtextSpd - 1); @@ -86,7 +86,7 @@ void InitQTextMsg(int m) void DrawQTextBack() { - CelDraw(PANEL_X + 24, 487, pTextBoxCels, 1, 591); + CelDraw(PANEL_X + 24, SCREEN_Y + 327, pTextBoxCels, 1, 591); trans_rect(PANEL_LEFT + 27, 28, 585, 297); } @@ -163,14 +163,14 @@ void DrawQText() } tx = 48 + PANEL_X; ty += 38; - if (ty > 501) { + if (ty > 341 + SCREEN_Y) { doneflag = TRUE; } } for (currTime = SDL_GetTicks(); qtextSpd + scrolltexty < currTime; qtextSpd += scrolltexty) { qtexty--; - if (qtexty <= 209) { + if (qtexty <= 49 + SCREEN_Y) { qtexty += 38; qtextptr = pnl; if (*pnl == '|') { diff --git a/Source/missiles.cpp b/Source/missiles.cpp index 5b221af5..f0e45234 100644 --- a/Source/missiles.cpp +++ b/Source/missiles.cpp @@ -313,9 +313,9 @@ int GetDirection16(int x1, int y1, int x2, int y2) { 4, 2, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }, { 4, 3, 2, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0 }, { 4, 3, 3, 2, 2, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0 }, - { 4, 4, 3, 2, 2, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 }, + { 4, 4, 3, 2, 2, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 }, // BUGFIX: should be `{ 4, 4, 3, 2, 2, 2, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 },` { 4, 4, 3, 3, 2, 2, 2, 1, 1, 1, 1, 1, 1, 1, 1, 1 }, - { 4, 4, 3, 3, 2, 2, 2, 2, 2, 1, 1, 1, 1, 1, 1, 1 }, + { 4, 4, 3, 3, 2, 2, 2, 2, 2, 1, 1, 1, 1, 1, 1, 1 }, // BUGFIX: should be `{ 4, 4, 3, 3, 3, 2, 2, 2, 2, 1, 1, 1, 1, 1, 1, 1 },` { 4, 4, 3, 3, 3, 3, 2, 2, 2, 2, 1, 1, 1, 1, 1, 1 }, { 4, 4, 4, 3, 3, 3, 2, 2, 2, 2, 2, 1, 1, 1, 1, 1 }, { 4, 4, 4, 3, 3, 3, 3, 2, 2, 2, 2, 2, 1, 1, 1, 1 }, @@ -326,6 +326,26 @@ int GetDirection16(int x1, int y1, int x2, int y2) { 4, 4, 4, 4, 3, 3, 3, 3, 3, 3, 3, 2, 2, 2, 2, 2 }, { 4, 4, 4, 4, 3, 3, 3, 3, 3, 3, 3, 3, 2, 2, 2, 2 } }; + // The correct quadrant of direction indices is presented below: + /* + { 99, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }, + { 4, 2, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }, + { 4, 3, 2, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0 }, + { 4, 3, 3, 2, 2, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0 }, + { 4, 4, 3, 2, 2, 2, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 }, + { 4, 4, 3, 3, 2, 2, 2, 1, 1, 1, 1, 1, 1, 1, 1, 1 }, + { 4, 4, 3, 3, 3, 2, 2, 2, 2, 1, 1, 1, 1, 1, 1, 1 }, + { 4, 4, 3, 3, 3, 3, 2, 2, 2, 2, 1, 1, 1, 1, 1, 1 }, + { 4, 4, 4, 3, 3, 3, 2, 2, 2, 2, 2, 1, 1, 1, 1, 1 }, + { 4, 4, 4, 3, 3, 3, 3, 2, 2, 2, 2, 2, 1, 1, 1, 1 }, + { 4, 4, 4, 3, 3, 3, 3, 3, 2, 2, 2, 2, 2, 2, 1, 1 }, + { 4, 4, 4, 3, 3, 3, 3, 3, 3, 2, 2, 2, 2, 2, 2, 1 }, + { 4, 4, 4, 4, 3, 3, 3, 3, 3, 3, 2, 2, 2, 2, 2, 2 }, + { 4, 4, 4, 4, 3, 3, 3, 3, 3, 3, 2, 2, 2, 2, 2, 2 }, + { 4, 4, 4, 4, 3, 3, 3, 3, 3, 3, 3, 2, 2, 2, 2, 2 }, + { 4, 4, 4, 4, 3, 3, 3, 3, 3, 3, 3, 3, 2, 2, 2, 2 } + */ + BYTE urtoll[5] = { 6, 7, 8, 9, 10 }; BYTE ultolr[5] = { 6, 5, 4, 3, 2 }; BYTE lltour[5] = { 14, 13, 12, 11, 10 }; @@ -1308,6 +1328,7 @@ void AddRndTeleport(int mi, int sx, int sy, int dx, int dy, int midir, char mien UseMana(id, SPL_RNDTELEPORT); } else { pn = dObject[dx][dy] - 1; + // BUGFIX: should only run magic circle check if dObject[dx][dy] is non-zero. if (object[pn]._otype == OBJ_MCIRCLE1 || object[pn]._otype == OBJ_MCIRCLE2) { missile[mi]._mix = dx; missile[mi]._miy = dy; diff --git a/Source/monstdat.cpp b/Source/monstdat.cpp index a7eea5f9..f5b8243c 100644 --- a/Source/monstdat.cpp +++ b/Source/monstdat.cpp @@ -7,6 +7,7 @@ DEVILUTION_BEGIN_NAMESPACE +/** Contains the data related to each monster ID. */ MonsterData monsterdata[] = { // clang-format off // width, mImage, GraphicType, has_special, sndfile, snd_special, has_trans, TransFile, Frames[6], Rate[6], mName, mMinDLvl, mMaxDLvl, mLevel, mMinHP, mMaxHP, mAi, mFlags, mInt, mHit, mAFNum, mMinDamage, mMaxDamage, mHit2, mAFNum2, mMinDamage2, mMaxDamage2, mArmorClass, mMonstClass, mMagicRes , mMagicRes2 , mTreasure, mSelFlag, mExp @@ -198,18 +199,18 @@ BYTE MonstConvTbl[] = { MT_REDDTH, MT_LTCHDMN, MT_UDEDBLRG, - MT_NZOMBIE, - MT_NZOMBIE, - MT_NZOMBIE, - MT_NZOMBIE, + 0, + 0, + 0, + 0, MT_INCIN, MT_FLAMLRD, MT_DOOMFIRE, MT_HELLBURN, - MT_NZOMBIE, - MT_NZOMBIE, - MT_NZOMBIE, - MT_NZOMBIE, + 0, + 0, + 0, + 0, MT_RSTORM, MT_STORM, MT_STORML, @@ -242,19 +243,19 @@ BYTE MonstConvTbl[] = { MT_MAGISTR, MT_CABALIST, MT_ADVOCATE, - MT_NZOMBIE, + 0, MT_DIABLO, - MT_NZOMBIE, + 0, MT_GOLEM, - MT_NZOMBIE, - MT_NZOMBIE, - MT_NZOMBIE, - MT_NZOMBIE, - MT_NZOMBIE, - MT_NZOMBIE, - MT_NZOMBIE, - MT_NZOMBIE, - MT_NZOMBIE, + 0, + 0, + 0, // Monster from blood1.dun and blood2.dun + 0, + 0, + 0, + 0, // Snotspill from banner2.dun + 0, + 0, MT_BIGFALL, MT_DARKMAGE, 0, // Hellfire: Hellboar @@ -408,7 +409,7 @@ BYTE MonstAvailTbl[] = { MAT_NEVER, // The Dark Lord MAT_NEVER, // The Arch-Litch Malignus }; - +/** Contains the data related to each unique monster ID. */ UniqMonstStruct UniqMonst[] = { // clang-format off // mtype, mName, mTrnName, mlevel, mmaxhp, mAi, mint, mMinDamage, mMaxDamage, mMagicRes, mUnqAttr, mUnqVar1, mUnqVar2, mtalkmsg diff --git a/Source/monster.cpp b/Source/monster.cpp index 1b27e835..c7463a76 100644 --- a/Source/monster.cpp +++ b/Source/monster.cpp @@ -12,6 +12,7 @@ DEVILUTION_BEGIN_NAMESPACE int MissileFileFlag; // BUGFIX: replace monstkills[MAXMONSTERS] with monstkills[NUM_MTYPES]. +/** Tracks the total number of monsters killed per monster_id. */ int monstkills[MAXMONSTERS]; int monstactive[MAXMONSTERS]; int nummonsters; @@ -24,11 +25,14 @@ int monstimgtot; int uniquetrans; int nummtypes; +/** Maps from walking path step to facing direction. */ const char plr2monst[9] = { 0, 5, 3, 7, 1, 4, 6, 0, 2 }; +/** Maps from monster intelligence factor to missile type. */ const BYTE counsmiss[4] = { MIS_FIREBOLT, MIS_CBOLT, MIS_LIGHTCTRL, MIS_FIREBALL }; /* data */ +/** Maps from monster walk animation frame num to monster velocity. */ int MWVel[24][3] = { { 256, 512, 1024 }, { 128, 256, 512 }, @@ -55,11 +59,17 @@ int MWVel[24][3] = { { 11, 22, 44 }, { 10, 21, 42 } }; +/** Maps from monster action to monster animation letter. */ char animletter[7] = "nwahds"; +/** Maps from direction to a left turn from the direction. */ int left[8] = { 7, 0, 1, 2, 3, 4, 5, 6 }; +/** Maps from direction to a right turn from the direction. */ int right[8] = { 1, 2, 3, 4, 5, 6, 7, 0 }; +/** Maps from direction to the opposite direction. */ int opposite[8] = { 4, 5, 6, 7, 0, 1, 2, 3 }; +/** Maps from direction to delta X-offset. */ int offset_x[8] = { 1, 0, -1, -1, -1, 0, 1, 1 }; +/** Maps from direction to delta Y-offset. */ int offset_y[8] = { 1, 1, 1, 0, -1, -1, -1, 0 }; /** unused */ @@ -68,6 +78,7 @@ int rnd10[4] = { 10, 15, 20, 30 }; int rnd20[4] = { 20, 30, 40, 50 }; int rnd60[4] = { 60, 70, 80, 90 }; +/** Maps from monster AI ID to monster AI function. */ void (*AiProc[])(int i) = { &MAI_Zombie, &MAI_Fat, @@ -1615,7 +1626,7 @@ void MonstStartKill(int i, int pnum, BOOL sendmsg) Monst = &monster[i]; if (pnum >= 0) Monst->mWhoHit |= 1 << pnum; - if (pnum < MAX_PLRS && i > MAX_PLRS) + if (pnum < MAX_PLRS && i > MAX_PLRS) /// BUGFIX: i >= MAX_PLRS AddPlrMonstExper(Monst->mLevel, Monst->mExp, Monst->mWhoHit); monstkills[Monst->MType->mtype]++; Monst->_mhitpoints = 0; @@ -2493,7 +2504,7 @@ void DoEnding() int musicVolume; if (gbMaxPlayers > 1) { - SNetLeaveGame(0x40000004); + SNetLeaveGame(LEAVE_ENDING); } music_stop(); @@ -3911,7 +3922,7 @@ void MAI_Golum(int i) for (k = 0; k < 5; k++) { _menemy = dMonster[monster[i]._mx + k - 2][monster[i]._my + j - 2]; if (_menemy > 0) - monster[_menemy]._msquelch = UCHAR_MAX; + monster[_menemy]._msquelch = UCHAR_MAX; // BUGFIX: should be `monster[_menemy-1]`, not monster[_menemy]. } } } @@ -4689,6 +4700,7 @@ BOOL DirOK(int i, int mdir) mi = -mi; if (mi != 0) mi--; + // BUGFIX: should only run pack member check if mi was non-zero prior to executing the body of the above if-statement. if (monster[mi].leaderflag == 1 && monster[mi].leader == i && monster[mi]._mfutx == x diff --git a/Source/movie.cpp b/Source/movie.cpp index 04836dda..e90cfd80 100644 --- a/Source/movie.cpp +++ b/Source/movie.cpp @@ -14,6 +14,11 @@ BYTE movie_playing; /** Should the movie play in a loop. */ BOOL loop_movie; +/** + * @brief Start playback of a given video. + * @param pszMovie The file name of the video + * @param user_can_close Set to false to make the video unskippable. + */ void play_movie(char *pszMovie, BOOL user_can_close) { HANDLE video_stream; diff --git a/Source/msg.cpp b/Source/msg.cpp index 6886ab74..50e2ee72 100644 --- a/Source/msg.cpp +++ b/Source/msg.cpp @@ -1137,7 +1137,7 @@ DWORD ParseCmd(int pnum, TCmd *pCmd) } if (pCmd->bCmd < CMD_DLEVEL_0 || pCmd->bCmd > CMD_DLEVEL_END) { - SNetDropPlayer(pnum, 0x40000006); + SNetDropPlayer(pnum, LEAVE_DROP); return 0; } @@ -2364,7 +2364,7 @@ DWORD On_PLAYER_JOINLEVEL(TCmd *pCmd, int pnum) plr[pnum]._pgfxnum = 0; LoadPlrGFX(pnum, PFILE_DEATH); plr[pnum]._pmode = PM_DEATH; - NewPlrAnim(pnum, plr[pnum]._pDAnim[0], plr[pnum]._pDFrames, 1, plr[pnum]._pDWidth); + NewPlrAnim(pnum, plr[pnum]._pDAnim[DIR_S], plr[pnum]._pDFrames, 1, plr[pnum]._pDWidth); plr[pnum]._pAnimFrame = plr[pnum]._pAnimLen - 1; plr[pnum]._pVar8 = plr[pnum]._pAnimLen << 1; dFlags[plr[pnum]._px][plr[pnum]._py] |= BFLAG_DEAD_PLAYER; diff --git a/Source/multi.cpp b/Source/multi.cpp index 0d71ec62..7fd01893 100644 --- a/Source/multi.cpp +++ b/Source/multi.cpp @@ -180,7 +180,7 @@ void multi_msg_countdown() int i; for (i = 0; i < MAX_PLRS; i++) { - if (player_state[i] & 0x20000) { + if (player_state[i] & PS_TURN_ARRIVED) { if (gdwMsgLenTbl[i] == 4) multi_parse_turn(i, *(DWORD *)glpMsgTbl[i]); } @@ -207,7 +207,7 @@ void multi_handle_turn_upper_bit(int pnum) int i; for (i = 0; i < MAX_PLRS; i++) { - if (player_state[i] & 0x10000 && i != pnum) + if (player_state[i] & PS_CONNECTED && i != pnum) break; } @@ -255,11 +255,11 @@ void multi_player_left_msg(int pnum, int left) if (left) { pszFmt = "Player '%s' just left the game"; switch (sgdwPlayerLeftReasonTbl[pnum]) { - case 0x40000004: + case LEAVE_ENDING: pszFmt = "Player '%s' killed Diablo and left the game!"; gbSomebodyWonGameKludge = TRUE; break; - case 0x40000006: + case LEAVE_DROP: pszFmt = "Player '%s' dropped due to timeout"; break; } @@ -362,11 +362,11 @@ void multi_begin_timeout() bGroupCount = 0; for (i = 0; i < MAX_PLRS; i++) { nState = player_state[i]; - if (nState & 0x10000) { + if (nState & PS_CONNECTED) { if (nLowestPlayer == -1) { nLowestPlayer = i; } - if (nState & 0x40000) { + if (nState & PS_ACTIVE) { bGroupPlayers++; if (nLowestActive == -1) { nLowestActive = i; @@ -399,8 +399,8 @@ void multi_check_drop_player() int i; for (i = 0; i < MAX_PLRS; i++) { - if (!(player_state[i] & 0x40000) && player_state[i] & 0x10000) { - SNetDropPlayer(i, 0x40000006); + if (!(player_state[i] & PS_ACTIVE) && player_state[i] & PS_CONNECTED) { + SNetDropPlayer(i, LEAVE_DROP); } } } @@ -602,25 +602,26 @@ void multi_event_handler(BOOL add) void multi_handle_events(_SNETEVENT *pEvt) { DWORD LeftReason; - DWORD *data; + _gamedata *gameData; switch (pEvt->eventid) { case EVENT_TYPE_PLAYER_CREATE_GAME: - data = (DWORD *)pEvt->data; - sgGameInitInfo.dwSeed = data[0]; - sgGameInitInfo.bDiff = data[1]; + gameData = (_gamedata *)pEvt->data; + sgGameInitInfo.dwSeed = gameData->dwSeed; + sgGameInitInfo.bDiff = gameData->bDiff; sgbPlayerTurnBitTbl[pEvt->playerid] = TRUE; break; case EVENT_TYPE_PLAYER_LEAVE_GAME: sgbPlayerLeftGameTbl[pEvt->playerid] = TRUE; sgbPlayerTurnBitTbl[pEvt->playerid] = FALSE; + LeftReason = 0; - data = (DWORD *)pEvt->data; - if (data && (DWORD)pEvt->databytes >= 4) - LeftReason = data[0]; + if (pEvt->data && pEvt->databytes >= sizeof(DWORD)) + LeftReason = *(DWORD *)pEvt->data; sgdwPlayerLeftReasonTbl[pEvt->playerid] = LeftReason; - if (LeftReason == 0x40000004) + if (LeftReason == LEAVE_ENDING) gbSomebodyWonGameKludge = TRUE; + sgbSendDeltaTbl[pEvt->playerid] = FALSE; dthread_remove_player(pEvt->playerid); @@ -803,7 +804,7 @@ BOOL multi_init_single(_SNETPROGRAMDATA *client_info, _SNETPLAYERDATA *user_info } unused = 0; - if (!SNetCreateGame("local", "local", "local", 0, (char *)&sgGameInitInfo.dwSeed, 8, 1, "local", "local", &unused)) { + if (!SNetCreateGame("local", "local", "local", 0, (char *)&sgGameInitInfo, sizeof(sgGameInitInfo), 1, "local", "local", &unused)) { app_fatal("SNetCreateGame1:\n%s", TraceLastError()); } @@ -928,7 +929,7 @@ void recv_plrinfo(int pnum, TCmdPlrInfoHdr *p, BOOL recv) plr[pnum]._pgfxnum = 0; LoadPlrGFX(pnum, PFILE_DEATH); plr[pnum]._pmode = PM_DEATH; - NewPlrAnim(pnum, plr[pnum]._pDAnim[0], plr[pnum]._pDFrames, 1, plr[pnum]._pDWidth); + NewPlrAnim(pnum, plr[pnum]._pDAnim[DIR_S], plr[pnum]._pDFrames, 1, plr[pnum]._pDWidth); plr[pnum]._pAnimFrame = plr[pnum]._pAnimLen - 1; plr[pnum]._pVar8 = 2 * plr[pnum]._pAnimLen; dFlags[plr[pnum]._px][plr[pnum]._py] |= BFLAG_DEAD_PLAYER; diff --git a/Source/objdat.cpp b/Source/objdat.cpp index bd3513ae..ee591864 100644 --- a/Source/objdat.cpp +++ b/Source/objdat.cpp @@ -1,10 +1,15 @@ +/** + * @file objdat.cpp + * + * Implementation of all object data. + */ #include "all.h" DEVILUTION_BEGIN_NAMESPACE /** Maps from dun_object_id to object_id. */ int ObjTypeConv[] = { - OBJ_L1LIGHT, + 0, OBJ_LEVER, OBJ_CRUX1, OBJ_CRUX2, @@ -13,33 +18,33 @@ int ObjTypeConv[] = { OBJ_BANNERL, OBJ_BANNERM, OBJ_BANNERR, - OBJ_L1LIGHT, - OBJ_L1LIGHT, - OBJ_L1LIGHT, - OBJ_L1LIGHT, - OBJ_L1LIGHT, + 0, + 0, + 0, + 0, + 0, OBJ_BOOK2L, OBJ_BOOK2R, OBJ_BCROSS, - OBJ_L1LIGHT, + 0, OBJ_CANDLE1, OBJ_CANDLE2, OBJ_CANDLEO, OBJ_CAULDRON, - OBJ_L1LIGHT, - OBJ_L1LIGHT, - OBJ_L1LIGHT, - OBJ_L1LIGHT, - OBJ_L1LIGHT, - OBJ_L1LIGHT, - OBJ_L1LIGHT, - OBJ_L1LIGHT, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, OBJ_FLAMEHOLE, - OBJ_L1LIGHT, - OBJ_L1LIGHT, - OBJ_L1LIGHT, - OBJ_L1LIGHT, - OBJ_L1LIGHT, + 0, + 0, + 0, + 0, + 0, OBJ_MCIRCLE1, OBJ_MCIRCLE2, OBJ_SKFIRE, @@ -49,14 +54,14 @@ int ObjTypeConv[] = { OBJ_SKSTICK3, OBJ_SKSTICK4, OBJ_SKSTICK5, - OBJ_L1LIGHT, - OBJ_L1LIGHT, - OBJ_L1LIGHT, - OBJ_L1LIGHT, - OBJ_L1LIGHT, - OBJ_L1LIGHT, + 0, + 0, + 0, + 0, + 0, + 0, OBJ_SWITCHSKL, - OBJ_L1LIGHT, + 0, OBJ_TRAPL, OBJ_TRAPR, OBJ_TORTURE1, @@ -64,16 +69,16 @@ int ObjTypeConv[] = { OBJ_TORTURE3, OBJ_TORTURE4, OBJ_TORTURE5, - OBJ_L1LIGHT, - OBJ_L1LIGHT, - OBJ_L1LIGHT, - OBJ_L1LIGHT, - OBJ_L1LIGHT, + 0, + 0, + 0, + 0, + 0, OBJ_NUDEW2R, - OBJ_L1LIGHT, - OBJ_L1LIGHT, - OBJ_L1LIGHT, - OBJ_L1LIGHT, + 0, + 0, + 0, + 0, OBJ_TNUDEM1, OBJ_TNUDEM2, OBJ_TNUDEM3, @@ -90,28 +95,28 @@ int ObjTypeConv[] = { OBJ_CHEST3, OBJ_CHEST3, OBJ_CHEST3, - OBJ_L1LIGHT, - OBJ_L1LIGHT, - OBJ_L1LIGHT, - OBJ_L1LIGHT, - OBJ_L1LIGHT, + 0, + 0, + 0, + 0, + 0, OBJ_PEDISTAL, - OBJ_L1LIGHT, - OBJ_L1LIGHT, - OBJ_L1LIGHT, - OBJ_L1LIGHT, - OBJ_L1LIGHT, - OBJ_L1LIGHT, - OBJ_L1LIGHT, - OBJ_L1LIGHT, - OBJ_L1LIGHT, - OBJ_L1LIGHT, - OBJ_L1LIGHT, - OBJ_L1LIGHT, - OBJ_L1LIGHT, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, OBJ_ALTBOY, - OBJ_L1LIGHT, - OBJ_L1LIGHT, + 0, + 0, OBJ_WARARMOR, OBJ_WARWEAP, OBJ_TORCHR2, @@ -152,45 +157,45 @@ ObjDataStruct AllObjects[] = { { 1, OFILE_L1BRAZ, 1, 4, DTYPE_CATHEDRAL, THEME_NONE, -1, 1, 1, 26, 64, TRUE, TRUE, FALSE, 0, 0, FALSE }, { 1, OFILE_L1DOORS, 1, 4, DTYPE_CATHEDRAL, THEME_NONE, -1, 0, 1, 0, 64, FALSE, FALSE, TRUE, 0, 3, TRUE }, { 1, OFILE_L1DOORS, 1, 4, DTYPE_CATHEDRAL, THEME_NONE, -1, 0, 2, 0, 64, FALSE, FALSE, TRUE, 0, 3, TRUE }, - { 3, OFILE_SKULFIRE, 0, 0, DTYPE_TOWN, THEME_SKELROOM, -1, 1, 2, 11, 96, TRUE, TRUE, FALSE, 0, 0, FALSE }, + { 3, OFILE_SKULFIRE, 0, 0, 0, THEME_SKELROOM, -1, 1, 2, 11, 96, TRUE, TRUE, FALSE, 0, 0, FALSE }, { 1, OFILE_LEVER, 1, 4, DTYPE_CATHEDRAL, THEME_NONE, -1, 0, 1, 1, 96, TRUE, TRUE, TRUE, 0, 1, TRUE }, - { 1, OFILE_CHEST1, 1, 16, DTYPE_TOWN, THEME_NONE, -1, 0, 1, 0, 96, TRUE, TRUE, TRUE, 0, 1, TRUE }, - { 1, OFILE_CHEST2, 1, 16, DTYPE_TOWN, THEME_NONE, -1, 0, 1, 0, 96, TRUE, TRUE, TRUE, 0, 1, TRUE }, - { 1, OFILE_CHEST3, 1, 16, DTYPE_TOWN, THEME_NONE, -1, 0, 1, 0, 96, TRUE, TRUE, TRUE, 0, 1, TRUE }, - { 2, OFILE_L1BRAZ, 0, 0, DTYPE_TOWN, THEME_NONE, -1, 0, 0, 0, 0, FALSE, FALSE, FALSE, 0, 0, FALSE }, - { 3, OFILE_CANDLE2, 0, 0, DTYPE_TOWN, THEME_SHRINE, -1, 1, 2, 4, 96, TRUE, TRUE, TRUE, 0, 0, FALSE }, - { 2, OFILE_L1BRAZ, 0, 0, DTYPE_TOWN, THEME_NONE, -1, 0, 0, 0, 0, FALSE, FALSE, FALSE, 0, 0, FALSE }, - { 3, OFILE_BANNER, 0, 0, DTYPE_TOWN, THEME_SKELROOM, -1, 0, 2, 0, 96, TRUE, TRUE, TRUE, 0, 0, FALSE }, - { 3, OFILE_BANNER, 0, 0, DTYPE_TOWN, THEME_SKELROOM, -1, 0, 1, 0, 96, TRUE, TRUE, TRUE, 0, 0, FALSE }, - { 3, OFILE_BANNER, 0, 0, DTYPE_TOWN, THEME_SKELROOM, -1, 0, 3, 0, 96, TRUE, TRUE, TRUE, 0, 0, FALSE }, - { 2, OFILE_SKULPILE, 1, 4, DTYPE_TOWN, THEME_NONE, -1, 0, 1, 1, 96, TRUE, TRUE, TRUE, 0, 0, FALSE }, - { 2, OFILE_L1BRAZ, 0, 0, DTYPE_TOWN, THEME_NONE, -1, 0, 0, 0, 0, FALSE, FALSE, FALSE, 0, 0, FALSE }, - { 2, OFILE_L1BRAZ, 0, 0, DTYPE_TOWN, THEME_NONE, -1, 0, 0, 0, 0, FALSE, FALSE, FALSE, 0, 0, FALSE }, - { 2, OFILE_L1BRAZ, 0, 0, DTYPE_TOWN, THEME_NONE, -1, 0, 0, 0, 0, FALSE, FALSE, FALSE, 0, 0, FALSE }, - { 2, OFILE_L1BRAZ, 0, 0, DTYPE_TOWN, THEME_NONE, -1, 0, 0, 0, 0, FALSE, FALSE, FALSE, 0, 0, FALSE }, - { 2, OFILE_L1BRAZ, 0, 0, DTYPE_TOWN, THEME_NONE, -1, 0, 0, 0, 0, FALSE, FALSE, FALSE, 0, 0, FALSE }, - { 2, OFILE_CRUXSK1, 0, 0, DTYPE_TOWN, THEME_NONE, -1, 0, 1, 15, 96, TRUE, FALSE, TRUE, 1, 3, FALSE }, - { 2, OFILE_CRUXSK2, 0, 0, DTYPE_TOWN, THEME_NONE, -1, 0, 1, 15, 96, TRUE, FALSE, TRUE, 1, 3, FALSE }, - { 2, OFILE_CRUXSK3, 0, 0, DTYPE_TOWN, THEME_NONE, -1, 0, 1, 15, 96, TRUE, FALSE, TRUE, 1, 3, FALSE }, - { 1, OFILE_ROCKSTAN, 5, 5, DTYPE_TOWN, THEME_NONE, -1, 0, 1, 0, 96, TRUE, TRUE, TRUE, 0, 0, FALSE }, - { 2, OFILE_ANGEL, 0, 0, DTYPE_TOWN, THEME_NONE, -1, 0, 1, 0, 96, TRUE, FALSE, TRUE, 0, 0, FALSE }, - { 2, OFILE_BOOK2, 0, 0, DTYPE_TOWN, THEME_NONE, -1, 0, 1, 0, 96, TRUE, TRUE, TRUE, 0, 3, FALSE }, - { 2, OFILE_BURNCROS, 0, 0, DTYPE_TOWN, THEME_NONE, -1, 1, 0, 10, 160, TRUE, FALSE, FALSE, 0, 0, FALSE }, - { 2, OFILE_NUDE2, 0, 0, DTYPE_TOWN, THEME_NONE, -1, 1, 3, 6, 128, TRUE, FALSE, TRUE, 0, 0, FALSE }, - { 1, OFILE_SWITCH4, 16, 16, DTYPE_TOWN, THEME_NONE, -1, 0, 1, 0, 96, TRUE, TRUE, TRUE, 0, 1, TRUE }, - { 1, OFILE_TNUDEM, 13, 16, DTYPE_TOWN, THEME_NONE, Q_BUTCHER, 0, 1, 0, 128, TRUE, FALSE, TRUE, 0, 0, FALSE }, - { 1, OFILE_TNUDEM, 13, 16, DTYPE_TOWN, THEME_TORTURE, Q_BUTCHER, 0, 2, 0, 128, TRUE, FALSE, TRUE, 0, 0, FALSE }, - { 1, OFILE_TNUDEM, 13, 16, DTYPE_TOWN, THEME_TORTURE, Q_BUTCHER, 0, 3, 0, 128, TRUE, FALSE, TRUE, 0, 0, FALSE }, - { 1, OFILE_TNUDEM, 13, 16, DTYPE_TOWN, THEME_TORTURE, Q_BUTCHER, 0, 4, 0, 128, TRUE, FALSE, TRUE, 0, 0, FALSE }, - { 1, OFILE_TNUDEW, 13, 16, DTYPE_TOWN, THEME_TORTURE, Q_BUTCHER, 0, 1, 0, 128, TRUE, FALSE, TRUE, 0, 0, FALSE }, - { 1, OFILE_TNUDEW, 13, 16, DTYPE_TOWN, THEME_TORTURE, Q_BUTCHER, 0, 2, 0, 128, TRUE, FALSE, TRUE, 0, 0, FALSE }, - { 1, OFILE_TNUDEW, 13, 16, DTYPE_TOWN, THEME_TORTURE, Q_BUTCHER, 0, 3, 0, 128, TRUE, FALSE, TRUE, 0, 0, FALSE }, - { 1, OFILE_TSOUL, 13, 16, DTYPE_TOWN, THEME_NONE, Q_BUTCHER, 0, 1, 0, 128, TRUE, FALSE, TRUE, 0, 0, FALSE }, - { 1, OFILE_TSOUL, 13, 16, DTYPE_TOWN, THEME_NONE, Q_BUTCHER, 0, 2, 0, 128, TRUE, FALSE, TRUE, 0, 0, FALSE }, - { 1, OFILE_TSOUL, 13, 16, DTYPE_TOWN, THEME_NONE, Q_BUTCHER, 0, 3, 0, 128, TRUE, FALSE, TRUE, 0, 0, FALSE }, - { 1, OFILE_TSOUL, 13, 16, DTYPE_TOWN, THEME_NONE, Q_BUTCHER, 0, 4, 0, 128, TRUE, FALSE, TRUE, 0, 0, FALSE }, - { 1, OFILE_TSOUL, 13, 16, DTYPE_TOWN, THEME_NONE, Q_BUTCHER, 0, 5, 0, 128, TRUE, FALSE, TRUE, 0, 0, FALSE }, - { 1, OFILE_BOOK2, 6, 6, DTYPE_TOWN, THEME_NONE, -1, 0, 4, 0, 96, TRUE, TRUE, TRUE, 0, 3, FALSE }, + { 1, OFILE_CHEST1, 1, 16, 0, THEME_NONE, -1, 0, 1, 0, 96, TRUE, TRUE, TRUE, 0, 1, TRUE }, + { 1, OFILE_CHEST2, 1, 16, 0, THEME_NONE, -1, 0, 1, 0, 96, TRUE, TRUE, TRUE, 0, 1, TRUE }, + { 1, OFILE_CHEST3, 1, 16, 0, THEME_NONE, -1, 0, 1, 0, 96, TRUE, TRUE, TRUE, 0, 1, TRUE }, + { 2, OFILE_L1BRAZ, 0, 0, 0, THEME_NONE, -1, 0, 0, 0, 0, FALSE, FALSE, FALSE, 0, 0, FALSE }, + { 3, OFILE_CANDLE2, 0, 0, 0, THEME_SHRINE, -1, 1, 2, 4, 96, TRUE, TRUE, TRUE, 0, 0, FALSE }, + { 2, OFILE_L1BRAZ, 0, 0, 0, THEME_NONE, -1, 0, 0, 0, 0, FALSE, FALSE, FALSE, 0, 0, FALSE }, + { 3, OFILE_BANNER, 0, 0, 0, THEME_SKELROOM, -1, 0, 2, 0, 96, TRUE, TRUE, TRUE, 0, 0, FALSE }, + { 3, OFILE_BANNER, 0, 0, 0, THEME_SKELROOM, -1, 0, 1, 0, 96, TRUE, TRUE, TRUE, 0, 0, FALSE }, + { 3, OFILE_BANNER, 0, 0, 0, THEME_SKELROOM, -1, 0, 3, 0, 96, TRUE, TRUE, TRUE, 0, 0, FALSE }, + { 2, OFILE_SKULPILE, 1, 4, 0, THEME_NONE, -1, 0, 0, 1, 96, TRUE, TRUE, TRUE, 0, 0, FALSE }, + { 2, OFILE_L1BRAZ, 0, 0, 0, THEME_NONE, -1, 0, 0, 0, 0, FALSE, FALSE, FALSE, 0, 0, FALSE }, + { 2, OFILE_L1BRAZ, 0, 0, 0, THEME_NONE, -1, 0, 0, 0, 0, FALSE, FALSE, FALSE, 0, 0, FALSE }, + { 2, OFILE_L1BRAZ, 0, 0, 0, THEME_NONE, -1, 0, 0, 0, 0, FALSE, FALSE, FALSE, 0, 0, FALSE }, + { 2, OFILE_L1BRAZ, 0, 0, 0, THEME_NONE, -1, 0, 0, 0, 0, FALSE, FALSE, FALSE, 0, 0, FALSE }, + { 2, OFILE_L1BRAZ, 0, 0, 0, THEME_NONE, -1, 0, 0, 0, 0, FALSE, FALSE, FALSE, 0, 0, FALSE }, + { 2, OFILE_CRUXSK1, 0, 0, 0, THEME_NONE, -1, 0, 1, 15, 96, TRUE, FALSE, TRUE, 1, 3, FALSE }, + { 2, OFILE_CRUXSK2, 0, 0, 0, THEME_NONE, -1, 0, 1, 15, 96, TRUE, FALSE, TRUE, 1, 3, FALSE }, + { 2, OFILE_CRUXSK3, 0, 0, 0, THEME_NONE, -1, 0, 1, 15, 96, TRUE, FALSE, TRUE, 1, 3, FALSE }, + { 1, OFILE_ROCKSTAN, 5, 5, 0, THEME_NONE, -1, 0, 1, 0, 96, TRUE, TRUE, TRUE, 0, 0, FALSE }, + { 2, OFILE_ANGEL, 0, 0, 0, THEME_NONE, -1, 0, 1, 0, 96, TRUE, FALSE, TRUE, 0, 0, FALSE }, + { 2, OFILE_BOOK2, 0, 0, 0, THEME_NONE, -1, 0, 1, 0, 96, TRUE, TRUE, TRUE, 0, 3, FALSE }, + { 2, OFILE_BURNCROS, 0, 0, 0, THEME_NONE, -1, 1, 0, 10, 160, TRUE, FALSE, FALSE, 0, 0, FALSE }, + { 2, OFILE_NUDE2, 0, 0, 0, THEME_NONE, -1, 1, 3, 6, 128, TRUE, FALSE, TRUE, 0, 0, FALSE }, + { 1, OFILE_SWITCH4, 16, 16, 0, THEME_NONE, -1, 0, 1, 0, 96, TRUE, TRUE, TRUE, 0, 1, TRUE }, + { 1, OFILE_TNUDEM, 13, 16, 0, THEME_NONE, Q_BUTCHER, 0, 1, 0, 128, TRUE, FALSE, TRUE, 0, 0, FALSE }, + { 1, OFILE_TNUDEM, 13, 16, 0, THEME_TORTURE, Q_BUTCHER, 0, 2, 0, 128, TRUE, FALSE, TRUE, 0, 0, FALSE }, + { 1, OFILE_TNUDEM, 13, 16, 0, THEME_TORTURE, Q_BUTCHER, 0, 3, 0, 128, TRUE, FALSE, TRUE, 0, 0, FALSE }, + { 1, OFILE_TNUDEM, 13, 16, 0, THEME_TORTURE, Q_BUTCHER, 0, 4, 0, 128, TRUE, FALSE, TRUE, 0, 0, FALSE }, + { 1, OFILE_TNUDEW, 13, 16, 0, THEME_TORTURE, Q_BUTCHER, 0, 1, 0, 128, TRUE, FALSE, TRUE, 0, 0, FALSE }, + { 1, OFILE_TNUDEW, 13, 16, 0, THEME_TORTURE, Q_BUTCHER, 0, 2, 0, 128, TRUE, FALSE, TRUE, 0, 0, FALSE }, + { 1, OFILE_TNUDEW, 13, 16, 0, THEME_TORTURE, Q_BUTCHER, 0, 3, 0, 128, TRUE, FALSE, TRUE, 0, 0, FALSE }, + { 1, OFILE_TSOUL, 13, 16, 0, THEME_NONE, Q_BUTCHER, 0, 1, 0, 128, TRUE, FALSE, TRUE, 0, 0, FALSE }, + { 1, OFILE_TSOUL, 13, 16, 0, THEME_NONE, Q_BUTCHER, 0, 2, 0, 128, TRUE, FALSE, TRUE, 0, 0, FALSE }, + { 1, OFILE_TSOUL, 13, 16, 0, THEME_NONE, Q_BUTCHER, 0, 3, 0, 128, TRUE, FALSE, TRUE, 0, 0, FALSE }, + { 1, OFILE_TSOUL, 13, 16, 0, THEME_NONE, Q_BUTCHER, 0, 4, 0, 128, TRUE, FALSE, TRUE, 0, 0, FALSE }, + { 1, OFILE_TSOUL, 13, 16, 0, THEME_NONE, Q_BUTCHER, 0, 5, 0, 128, TRUE, FALSE, TRUE, 0, 0, FALSE }, + { 1, OFILE_BOOK2, 6, 6, 0, THEME_NONE, -1, 0, 4, 0, 96, TRUE, TRUE, TRUE, 0, 3, FALSE }, { 1, OFILE_L2DOORS, 5, 8, DTYPE_CATACOMBS, THEME_NONE, -1, 0, 1, 0, 64, FALSE, FALSE, TRUE, 0, 3, TRUE }, { 1, OFILE_L2DOORS, 5, 8, DTYPE_CATACOMBS, THEME_NONE, -1, 0, 2, 0, 64, FALSE, FALSE, TRUE, 0, 3, FALSE }, { 1, OFILE_WTORCH4, 5, 8, DTYPE_CATACOMBS, THEME_NONE, -1, 1, 1, 9, 96, FALSE, TRUE, FALSE, 0, 0, FALSE }, @@ -202,51 +207,51 @@ ObjDataStruct AllObjects[] = { { 2, OFILE_LEVER, 1, 4, DTYPE_CATHEDRAL, THEME_NONE, -1, 0, 1, 2, 96, TRUE, TRUE, TRUE, 0, 1, TRUE }, { 2, OFILE_MINIWATR, 1, 4, DTYPE_CATHEDRAL, THEME_NONE, -1, 1, 1, 10, 64, TRUE, FALSE, TRUE, 0, 0, FALSE }, { 1, OFILE_BOOK1, 3, 4, DTYPE_CATHEDRAL, THEME_NONE, -1, 0, 1, 0, 96, TRUE, TRUE, TRUE, 0, 3, FALSE }, - { 1, OFILE_TRAPHOLE, 1, 16, DTYPE_TOWN, THEME_NONE, -1, 0, 1, 0, 64, FALSE, TRUE, TRUE, 0, 0, FALSE }, - { 1, OFILE_TRAPHOLE, 1, 16, DTYPE_TOWN, THEME_NONE, -1, 0, 2, 0, 64, FALSE, TRUE, TRUE, 0, 0, FALSE }, - { 2, OFILE_BCASE, 0, 0, DTYPE_TOWN, THEME_NONE, -1, 0, 1, 0, 96, TRUE, FALSE, TRUE, 0, 0, FALSE }, - { 2, OFILE_WEAPSTND, 0, 0, DTYPE_TOWN, THEME_NONE, -1, 0, 1, 0, 96, TRUE, FALSE, TRUE, 0, 0, FALSE }, - { 1, OFILE_BARREL, 1, 16, DTYPE_TOWN, THEME_NONE, -1, 0, 1, 9, 96, TRUE, TRUE, TRUE, 1, 3, FALSE }, - { 1, OFILE_BARRELEX, 1, 16, DTYPE_TOWN, THEME_NONE, -1, 0, 1, 10, 96, TRUE, TRUE, TRUE, 1, 3, FALSE }, - { 3, OFILE_LSHRINEG, 0, 0, DTYPE_TOWN, THEME_SHRINE, -1, 0, 1, 11, 128, FALSE, FALSE, TRUE, 0, 3, FALSE }, - { 3, OFILE_RSHRINEG, 0, 0, DTYPE_TOWN, THEME_SHRINE, -1, 0, 1, 11, 128, FALSE, FALSE, TRUE, 0, 3, FALSE }, - { 3, OFILE_BOOK2, 0, 0, DTYPE_TOWN, THEME_SKELROOM, -1, 0, 4, 0, 96, TRUE, TRUE, TRUE, 0, 3, FALSE }, - { 3, OFILE_BCASE, 0, 0, DTYPE_TOWN, THEME_LIBRARY, -1, 0, 3, 0, 96, FALSE, FALSE, TRUE, 0, 3, FALSE }, - { 3, OFILE_BCASE, 0, 0, DTYPE_TOWN, THEME_LIBRARY, -1, 0, 4, 0, 96, FALSE, FALSE, TRUE, 0, 3, FALSE }, - { 3, OFILE_BOOK2, 0, 0, DTYPE_TOWN, THEME_LIBRARY, -1, 0, 1, 0, 96, TRUE, TRUE, TRUE, 0, 3, FALSE }, - { 3, OFILE_CANDLE2, 0, 0, DTYPE_TOWN, THEME_LIBRARY, -1, 1, 2, 4, 96, TRUE, TRUE, TRUE, 0, 0, FALSE }, - { 3, OFILE_BLOODFNT, 0, 0, DTYPE_TOWN, THEME_BLOODFOUNTAIN, -1, 1, 2, 10, 96, TRUE, TRUE, TRUE, 0, 3, FALSE }, - { 1, OFILE_DECAP, 13, 16, DTYPE_TOWN, THEME_DECAPITATED, -1, 0, 1, 0, 96, TRUE, TRUE, TRUE, 0, 1, FALSE }, - { 1, OFILE_CHEST1, 1, 16, DTYPE_TOWN, THEME_NONE, -1, 0, 1, 0, 96, TRUE, TRUE, TRUE, 0, 1, TRUE }, - { 1, OFILE_CHEST2, 1, 16, DTYPE_TOWN, THEME_NONE, -1, 0, 1, 0, 96, TRUE, TRUE, TRUE, 0, 1, TRUE }, - { 1, OFILE_CHEST3, 1, 16, DTYPE_TOWN, THEME_NONE, -1, 0, 1, 0, 96, TRUE, TRUE, TRUE, 0, 1, TRUE }, + { 1, OFILE_TRAPHOLE, 1, 16, 0, THEME_NONE, -1, 0, 1, 0, 64, FALSE, TRUE, TRUE, 0, 0, FALSE }, + { 1, OFILE_TRAPHOLE, 1, 16, 0, THEME_NONE, -1, 0, 2, 0, 64, FALSE, TRUE, TRUE, 0, 0, FALSE }, + { 2, OFILE_BCASE, 0, 0, 0, THEME_NONE, -1, 0, 1, 0, 96, TRUE, FALSE, TRUE, 0, 0, FALSE }, + { 2, OFILE_WEAPSTND, 0, 0, 0, THEME_NONE, -1, 0, 1, 0, 96, TRUE, FALSE, TRUE, 0, 0, FALSE }, + { 1, OFILE_BARREL, 1, 16, 0, THEME_NONE, -1, 0, 1, 9, 96, TRUE, TRUE, TRUE, 1, 3, FALSE }, + { 1, OFILE_BARRELEX, 1, 16, 0, THEME_NONE, -1, 0, 1, 10, 96, TRUE, TRUE, TRUE, 1, 3, FALSE }, + { 3, OFILE_LSHRINEG, 0, 0, 0, THEME_SHRINE, -1, 0, 1, 11, 128, FALSE, FALSE, TRUE, 0, 3, FALSE }, + { 3, OFILE_RSHRINEG, 0, 0, 0, THEME_SHRINE, -1, 0, 1, 11, 128, FALSE, FALSE, TRUE, 0, 3, FALSE }, + { 3, OFILE_BOOK2, 0, 0, 0, THEME_SKELROOM, -1, 0, 4, 0, 96, TRUE, TRUE, TRUE, 0, 3, FALSE }, + { 3, OFILE_BCASE, 0, 0, 0, THEME_LIBRARY, -1, 0, 3, 0, 96, FALSE, FALSE, TRUE, 0, 3, FALSE }, + { 3, OFILE_BCASE, 0, 0, 0, THEME_LIBRARY, -1, 0, 4, 0, 96, FALSE, FALSE, TRUE, 0, 3, FALSE }, + { 3, OFILE_BOOK2, 0, 0, 0, THEME_LIBRARY, -1, 0, 1, 0, 96, TRUE, TRUE, TRUE, 0, 3, FALSE }, + { 3, OFILE_CANDLE2, 0, 0, 0, THEME_LIBRARY, -1, 1, 2, 4, 96, TRUE, TRUE, TRUE, 0, 0, FALSE }, + { 3, OFILE_BLOODFNT, 0, 0, 0, THEME_BLOODFOUNTAIN, -1, 1, 2, 10, 96, TRUE, TRUE, TRUE, 0, 3, FALSE }, + { 1, OFILE_DECAP, 13, 16, 0, THEME_DECAPITATED, -1, 0, 1, 0, 96, TRUE, TRUE, TRUE, 0, 1, FALSE }, + { 1, OFILE_CHEST1, 1, 16, 0, THEME_NONE, -1, 0, 1, 0, 96, TRUE, TRUE, TRUE, 0, 1, TRUE }, + { 1, OFILE_CHEST2, 1, 16, 0, THEME_NONE, -1, 0, 1, 0, 96, TRUE, TRUE, TRUE, 0, 1, TRUE }, + { 1, OFILE_CHEST3, 1, 16, 0, THEME_NONE, -1, 0, 1, 0, 96, TRUE, TRUE, TRUE, 0, 1, TRUE }, { 1, OFILE_BOOK1, 7, 7, DTYPE_CATACOMBS, THEME_NONE, Q_BLIND, 0, 1, 0, 96, TRUE, TRUE, TRUE, 0, 3, FALSE }, { 1, OFILE_BOOK1, 5, 5, DTYPE_CATACOMBS, THEME_NONE, Q_BLOOD, 0, 4, 0, 96, TRUE, TRUE, TRUE, 0, 3, FALSE }, { 1, OFILE_PEDISTL, 5, 5, DTYPE_CATACOMBS, THEME_NONE, Q_BLOOD, 0, 1, 0, 96, TRUE, TRUE, TRUE, 0, 3, FALSE }, { 1, OFILE_L3DOORS, 9, 12, DTYPE_CAVES, THEME_NONE, -1, 0, 1, 0, 64, FALSE, FALSE, TRUE, 0, 3, TRUE }, { 1, OFILE_L3DOORS, 9, 12, DTYPE_CAVES, THEME_NONE, -1, 0, 2, 0, 64, FALSE, FALSE, TRUE, 0, 3, TRUE }, - { 3, OFILE_PFOUNTN, 0, 0, DTYPE_TOWN, THEME_PURIFYINGFOUNTAIN, -1, 1, 2, 10, 128, TRUE, TRUE, TRUE, 0, 3, FALSE }, - { 3, OFILE_ARMSTAND, 0, 0, DTYPE_TOWN, THEME_ARMORSTAND, -1, 0, 1, 0, 96, TRUE, FALSE, TRUE, 0, 3, FALSE }, - { 3, OFILE_ARMSTAND, 0, 0, DTYPE_TOWN, THEME_ARMORSTAND, -1, 0, 2, 0, 96, TRUE, FALSE, TRUE, 0, 0, FALSE }, - { 3, OFILE_GOATSHRN, 0, 0, DTYPE_TOWN, THEME_GOATSHRINE, -1, 1, 2, 10, 96, TRUE, TRUE, TRUE, 0, 3, FALSE }, - { 1, OFILE_CAULDREN, 13, 16, DTYPE_TOWN, THEME_NONE, -1, 0, 1, 0, 96, TRUE, FALSE, TRUE, 0, 3, FALSE }, - { 3, OFILE_MFOUNTN, 0, 0, DTYPE_TOWN, THEME_MURKYFOUNTAIN, -1, 1, 2, 10, 128, TRUE, TRUE, TRUE, 0, 3, FALSE }, - { 3, OFILE_TFOUNTN, 0, 0, DTYPE_TOWN, THEME_TEARFOUNTAIN, -1, 1, 2, 4, 128, TRUE, TRUE, TRUE, 0, 3, FALSE }, + { 3, OFILE_PFOUNTN, 0, 0, 0, THEME_PURIFYINGFOUNTAIN, -1, 1, 2, 10, 128, TRUE, TRUE, TRUE, 0, 3, FALSE }, + { 3, OFILE_ARMSTAND, 0, 0, 0, THEME_ARMORSTAND, -1, 0, 1, 0, 96, TRUE, FALSE, TRUE, 0, 3, FALSE }, + { 3, OFILE_ARMSTAND, 0, 0, 0, THEME_ARMORSTAND, -1, 0, 2, 0, 96, TRUE, FALSE, TRUE, 0, 0, FALSE }, + { 3, OFILE_GOATSHRN, 0, 0, 0, THEME_GOATSHRINE, -1, 1, 2, 10, 96, TRUE, TRUE, TRUE, 0, 3, FALSE }, + { 1, OFILE_CAULDREN, 13, 16, 0, THEME_NONE, -1, 0, 1, 0, 96, TRUE, FALSE, TRUE, 0, 3, FALSE }, + { 3, OFILE_MFOUNTN, 0, 0, 0, THEME_MURKYFOUNTAIN, -1, 1, 2, 10, 128, TRUE, TRUE, TRUE, 0, 3, FALSE }, + { 3, OFILE_TFOUNTN, 0, 0, 0, THEME_TEARFOUNTAIN, -1, 1, 2, 4, 128, TRUE, TRUE, TRUE, 0, 3, FALSE }, { 1, OFILE_ALTBOY, 0, 0, DTYPE_CATHEDRAL, THEME_NONE, Q_BETRAYER, 0, 1, 0, 128, TRUE, TRUE, TRUE, 0, 0, FALSE }, { 1, OFILE_MCIRL, 0, 0, DTYPE_CATHEDRAL, THEME_NONE, Q_BETRAYER, 0, 1, 0, 96, FALSE, TRUE, TRUE, 0, 0, FALSE }, { 1, OFILE_MCIRL, 0, 0, DTYPE_CATHEDRAL, THEME_NONE, Q_BETRAYER, 0, 1, 0, 96, FALSE, TRUE, TRUE, 0, 0, FALSE }, - { 1, OFILE_BKSLBRNT, 4, 12, DTYPE_TOWN, THEME_NONE, -1, 0, 1, 0, 96, TRUE, TRUE, TRUE, 0, 3, FALSE }, - { 1, OFILE_CANDLE2, 2, 12, DTYPE_TOWN, THEME_NONE, Q_BETRAYER, 1, 2, 4, 96, TRUE, TRUE, TRUE, 0, 0, FALSE }, + { 1, OFILE_BKSLBRNT, 4, 12, 0, THEME_NONE, -1, 0, 1, 0, 96, TRUE, TRUE, TRUE, 0, 3, FALSE }, + { 1, OFILE_CANDLE2, 2, 12, 0, THEME_NONE, Q_BETRAYER, 1, 2, 4, 96, TRUE, TRUE, TRUE, 0, 0, FALSE }, { 1, OFILE_BOOK1, 13, 13, DTYPE_HELL, THEME_NONE, Q_WARLORD, 0, 4, 0, 96, TRUE, TRUE, TRUE, 0, 3, FALSE }, - { 1, OFILE_ARMSTAND, 13, 13, DTYPE_TOWN, THEME_NONE, Q_WARLORD, 0, 1, 0, 96, TRUE, FALSE, TRUE, 0, 3, FALSE }, - { 2, OFILE_WEAPSTND, 13, 13, DTYPE_TOWN, THEME_NONE, Q_WARLORD, 0, 1, 0, 96, TRUE, FALSE, TRUE, 0, 3, FALSE }, - { 2, OFILE_BURNCROS, 0, 0, DTYPE_TOWN, THEME_BRNCROSS, -1, 1, 0, 10, 160, TRUE, FALSE, FALSE, 0, 0, FALSE }, - { 2, OFILE_WEAPSTND, 0, 0, DTYPE_TOWN, THEME_WEAPONRACK, -1, 0, 1, 0, 96, TRUE, FALSE, TRUE, 0, 3, FALSE }, - { 2, OFILE_WEAPSTND, 0, 0, DTYPE_TOWN, THEME_WEAPONRACK, -1, 0, 2, 0, 96, TRUE, FALSE, TRUE, 0, 0, FALSE }, - { 2, OFILE_MUSHPTCH, 0, 0, DTYPE_TOWN, THEME_NONE, Q_MUSHROOM, 0, 1, 0, 96, TRUE, TRUE, TRUE, 0, 3, TRUE }, - { 2, OFILE_LZSTAND, 0, 0, DTYPE_TOWN, THEME_NONE, Q_BETRAYER, 0, 1, 0, 128, TRUE, FALSE, TRUE, 0, 3, FALSE }, + { 1, OFILE_ARMSTAND, 13, 13, 0, THEME_NONE, Q_WARLORD, 0, 1, 0, 96, TRUE, FALSE, TRUE, 0, 3, FALSE }, + { 2, OFILE_WEAPSTND, 13, 13, 0, THEME_NONE, Q_WARLORD, 0, 1, 0, 96, TRUE, FALSE, TRUE, 0, 3, FALSE }, + { 2, OFILE_BURNCROS, 0, 0, 0, THEME_BRNCROSS, -1, 1, 0, 10, 160, TRUE, FALSE, FALSE, 0, 0, FALSE }, + { 2, OFILE_WEAPSTND, 0, 0, 0, THEME_WEAPONRACK, -1, 0, 1, 0, 96, TRUE, FALSE, TRUE, 0, 3, FALSE }, + { 2, OFILE_WEAPSTND, 0, 0, 0, THEME_WEAPONRACK, -1, 0, 2, 0, 96, TRUE, FALSE, TRUE, 0, 0, FALSE }, + { 2, OFILE_MUSHPTCH, 0, 0, 0, THEME_NONE, Q_MUSHROOM, 0, 1, 0, 96, TRUE, TRUE, TRUE, 0, 3, TRUE }, + { 2, OFILE_LZSTAND, 0, 0, 0, THEME_NONE, Q_BETRAYER, 0, 1, 0, 128, TRUE, FALSE, TRUE, 0, 3, FALSE }, { 1, OFILE_DECAP, 9, 9, DTYPE_CAVES, THEME_NONE, -1, 0, 2, 0, 96, TRUE, TRUE, TRUE, 0, 1, FALSE }, - { 2, OFILE_CHEST3, 0, 0, DTYPE_TOWN, THEME_NONE, -1, 0, 1, 0, 96, TRUE, TRUE, TRUE, 0, 1, TRUE }, + { 2, OFILE_CHEST3, 0, 0, 0, THEME_NONE, -1, 0, 1, 0, 96, TRUE, TRUE, TRUE, 0, 1, TRUE }, { 2, OFILE_BCASE, 0, 0, 0, THEME_NONE, -1, 0, 2, 0, 96, TRUE, FALSE, TRUE, 0, 0, FALSE }, { -1, 0, 0, 0, -1, THEME_NONE, -1, 0, 0, 0, 0, FALSE, FALSE, FALSE, 0, 0, FALSE } // clang-format on diff --git a/Source/objdat.h b/Source/objdat.h index 291b0ecb..36eb45e7 100644 --- a/Source/objdat.h +++ b/Source/objdat.h @@ -1,4 +1,8 @@ -//HEADER_GOES_HERE +/** + * @file objdat.h + * + * Interface of all object data. + */ #ifndef __OBJDAT_H__ #define __OBJDAT_H__ diff --git a/Source/objects.cpp b/Source/objects.cpp index 9acdaee9..ae95662b 100644 --- a/Source/objects.cpp +++ b/Source/objects.cpp @@ -1,3 +1,8 @@ +/** + * @file objects.cpp + * + * Implementation of object functionality, interaction, spawning, loading, etc. + */ #include "all.h" DEVILUTION_BEGIN_NAMESPACE @@ -7,6 +12,7 @@ int trapdir; BYTE *pObjCels[40]; char ObjFileList[40]; int objectactive[MAXOBJECTS]; +/** Specifies the number of active objects. */ int nobjects; int leverid; int objectavail[MAXOBJECTS]; @@ -14,8 +20,11 @@ ObjectStruct object[MAXOBJECTS]; BOOL InitObjFlag; int numobjfiles; +/** Specifies the X-coordinate delta between barrels. */ int bxadd[8] = { -1, 0, 1, -1, 1, -1, 0, 1 }; +/** Specifies the Y-coordinate delta between barrels. */ int byadd[8] = { -1, -1, -1, 0, 0, 1, 1, 1 }; +/** Maps from shrine_id to shrine name. */ char *shrinestrs[NUM_SHRINETYPE] = { "Mysterious", "Hidden", @@ -44,22 +53,30 @@ char *shrinestrs[NUM_SHRINETYPE] = { "Glimmering", "Tainted" }; +/** Specifies the minimum dungeon level on which each shrine will appear. */ char shrinemin[NUM_SHRINETYPE] = { 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 }; +/** Specifies the maximum dungeon level on which each shrine will appear. */ char shrinemax[NUM_SHRINETYPE] = { 16, 16, 16, 16, 16, 16, 16, 8, 16, 16, 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 */ +/** + * Specifies the game type for which each shrine may appear. + * 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, 0, 0, 0, 0, 0, 2 }; +/** Maps from book_id to book name. */ char *StoryBookName[9] = { "The Great Conflict", "The Wages of Sin are War", @@ -71,6 +88,7 @@ char *StoryBookName[9] = { "Tale of the Three", "The Black King" }; +/** Specifies the speech IDs of each dungeon type narrator book, for each player class. */ int StoryText[3][3] = { { TEXT_BOOK11, TEXT_BOOK12, TEXT_BOOK13 }, { TEXT_BOOK21, TEXT_BOOK22, TEXT_BOOK23 }, @@ -529,7 +547,7 @@ void AddChestTraps() if (dObject[i][j] > 0) { oi = dObject[i][j] - 1; if (object[oi]._otype >= OBJ_CHEST1 && object[oi]._otype <= OBJ_CHEST3 && !object[oi]._oTrapFlag && random_(0, 100) < 10) { - object[oi]._otype += OBJ_BOOKCASER; + object[oi]._otype += OBJ_TCHEST1 - OBJ_CHEST1; object[oi]._oTrapFlag = TRUE; if (leveltype == DTYPE_CATACOMBS) { object[oi]._oVar4 = random_(0, 2); @@ -4097,9 +4115,9 @@ void BreakBarrel(int pnum, int i, int dam, BOOL forcebreak, BOOL sendmsg) for (yp = object[i]._oy - 1; yp <= object[i]._oy + 1; yp++) { for (xp = object[i]._ox - 1; xp <= object[i]._ox + 1; xp++) { if (dMonster[xp][yp] > 0) - MonsterTrapHit(dMonster[xp][yp] - 1, 1, 4, 0, 1, FALSE); + MonsterTrapHit(dMonster[xp][yp] - 1, 1, 4, 0, MIS_FIREBOLT, FALSE); if (dPlayer[xp][yp] > 0) - PlayerMHit(dPlayer[xp][yp] - 1, -1, 0, 8, 16, 1, FALSE, 0); + PlayerMHit(dPlayer[xp][yp] - 1, -1, 0, 8, 16, MIS_FIREBOLT, FALSE, 0); if (dObject[xp][yp] > 0) { oi = dObject[xp][yp] - 1; if (object[oi]._otype == OBJ_BARRELEX && object[oi]._oBreak != -1) diff --git a/Source/objects.h b/Source/objects.h index bb2e9510..40cb7ae7 100644 --- a/Source/objects.h +++ b/Source/objects.h @@ -1,4 +1,8 @@ -//HEADER_GOES_HERE +/** + * @file objects.h + * + * Interface of object functionality, interaction, spawning, loading, etc. + */ #ifndef __OBJECTS_H__ #define __OBJECTS_H__ diff --git a/Source/pack.cpp b/Source/pack.cpp index b84cea7b..46b80f9b 100644 --- a/Source/pack.cpp +++ b/Source/pack.cpp @@ -1,3 +1,8 @@ +/** + * @file pack.cpp + * + * Implementation of functions for minifying player data structure. + */ #include "all.h" DEVILUTION_BEGIN_NAMESPACE diff --git a/Source/pack.h b/Source/pack.h index 87f60189..d3671d21 100644 --- a/Source/pack.h +++ b/Source/pack.h @@ -1,4 +1,8 @@ -//HEADER_GOES_HERE +/** + * @file pack.h + * + * Interface of functions for minifying player data structure. + */ #ifndef __PACK_H__ #define __PACK_H__ diff --git a/Source/palette.cpp b/Source/palette.cpp index ff504343..e84c5dbd 100644 --- a/Source/palette.cpp +++ b/Source/palette.cpp @@ -1,3 +1,8 @@ +/** + * @file palette.cpp + * + * Implementation of functions for handling the engines color palette. + */ #include "all.h" #include "../SourceX/display.h" #include "../3rdParty/Storm/Source/storm.h" @@ -10,8 +15,11 @@ SDL_Color orig_palette[256]; /* data */ +/** Specifies the gamma correction level. */ int gamma_correction = 100; +/** Specifies whether colour cycling is enabled. */ BOOL color_cycling_enabled = TRUE; +/** Specifies whether the palette has max brightness. */ BOOLEAN sgbFadedIn = TRUE; void palette_update() diff --git a/Source/palette.h b/Source/palette.h index 91f86348..fdd79851 100644 --- a/Source/palette.h +++ b/Source/palette.h @@ -1,4 +1,8 @@ -//HEADER_GOES_HERE +/** + * @file palette.h + * + * Interface of functions for handling the engines color palette. + */ #ifndef __PALETTE_H__ #define __PALETTE_H__ diff --git a/Source/pfile.cpp b/Source/pfile.cpp index 8493d0c5..7f90160d 100644 --- a/Source/pfile.cpp +++ b/Source/pfile.cpp @@ -1,3 +1,8 @@ +/** + * @file pfile.cpp + * + * Implementation of the save game encoding functionality. + */ #include "all.h" #include "../3rdParty/Storm/Source/storm.h" #include "../DiabloUI/diabloui.h" diff --git a/Source/pfile.h b/Source/pfile.h index a4908063..c7e29497 100644 --- a/Source/pfile.h +++ b/Source/pfile.h @@ -1,4 +1,8 @@ -//HEADER_GOES_HERE +/** + * @file pfile.h + * + * Interface of the save game encoding functionality. + */ #ifndef __PFILE_H__ #define __PFILE_H__ diff --git a/Source/player.cpp b/Source/player.cpp index f8a3002a..93989dcf 100644 --- a/Source/player.cpp +++ b/Source/player.cpp @@ -1,3 +1,8 @@ +/** + * @file player.cpp + * + * Implementation of player functionality, leveling, actions, creation, loading, etc. + */ #include "all.h" DEVILUTION_BEGIN_NAMESPACE @@ -18,8 +23,11 @@ int plr_sframe_size; int deathdelay; int plr_dframe_size; +/** Maps from armor animation to letter used in graphic files. */ const char ArmourChar[4] = { 'L', 'M', 'H', 0 }; +/** Maps from weapon animation to letter used in graphic files. */ const char WepChar[10] = { 'N', 'U', 'S', 'D', 'B', 'A', 'M', 'H', 'T', 0 }; +/** Maps from player class to letter used in graphic files. */ const char CharChar[] = { 'W', 'R', @@ -29,15 +37,21 @@ const char CharChar[] = { /* data */ +/** Specifies the X-coordinate delta from the player start location in Tristram. */ int plrxoff[9] = { 0, 2, 0, 2, 1, 0, 1, 2, 1 }; +/** Specifies the Y-coordinate delta from the player start location in Tristram. */ int plryoff[9] = { 0, 2, 2, 0, 1, 1, 0, 1, 2 }; +/** Specifies the X-coordinate delta from a player, used for instanced when casting resurrect. */ int plrxoff2[9] = { 0, 1, 0, 1, 2, 0, 1, 2, 2 }; +/** Specifies the Y-coordinate delta from a player, used for instanced when casting resurrect. */ int plryoff2[9] = { 0, 0, 1, 1, 0, 2, 2, 1, 2 }; +/** Specifies the frame of each animation for which an action is triggered, for each player class. */ char PlrGFXAnimLens[][11] = { { 10, 16, 8, 2, 20, 20, 6, 20, 8, 9, 14 }, { 8, 18, 8, 4, 20, 16, 7, 20, 8, 10, 12 }, { 8, 16, 8, 6, 20, 12, 8, 20, 8, 12, 8 }, }; +/** Maps from player class to player velocity. */ int PWVel[3][3] = { { 2048, 1024, 512 }, { 2048, 1024, 512 }, @@ -47,21 +61,28 @@ int PWVel[3][3] = { int AnimLenFromClass[3] = { 8, 8, 8 }; +/** Maps from player_class to starting stat in strength. */ int StrengthTbl[3] = { 30, 20, 15 }; +/** Maps from player_class to starting stat in magic. */ int MagicTbl[3] = { 10, 15, 35 }; +/** Maps from player_class to starting stat in dexterity. */ int DexterityTbl[3] = { 20, 30, 15 }; +/** Maps from player_class to starting stat in vitality. */ int VitalityTbl[3] = { 25, 20, 20 }; +/** Specifies the chance to block bonus of each player class.*/ int ToBlkTbl[3] = { 30, 20, 10 }; char *ClassStrTblOld[] = { "Warrior", "Rogue", "Sorceror", }; +/** Maps from player_class to maximum stats. */ int MaxStats[3][4] = { { 250, 50, 60, 100 }, { 55, 70, 250, 80 }, { 45, 250, 85, 80 } }; +/** Specifies the experience point limit of each level. */ int ExpLvlsTbl[MAXCHARLEVEL] = { 0, 2000, @@ -120,7 +141,8 @@ char *ClassStrTbl[] = { "Rogue", "Sorceror", }; -BYTE fix[9] = { 0, 0, 3, 3, 3, 6, 6, 6, 8 }; /* PM_ChangeLightOff local type */ +/** Unused local of PM_ChangeLightOff, originally for computing light radius. */ +BYTE fix[9] = { 0, 0, 3, 3, 3, 6, 6, 6, 8 }; void SetPlayerGPtrs(BYTE *pData, BYTE **pAnim) { diff --git a/Source/player.h b/Source/player.h index f97a12eb..5ce9439c 100644 --- a/Source/player.h +++ b/Source/player.h @@ -1,4 +1,8 @@ -//HEADER_GOES_HERE +/** + * @file player.h + * + * Interface of player functionality, leveling, actions, creation, loading, etc. + */ #ifndef __PLAYER_H__ #define __PLAYER_H__ diff --git a/Source/plrmsg.cpp b/Source/plrmsg.cpp index ae010e6c..83d3a73d 100644 --- a/Source/plrmsg.cpp +++ b/Source/plrmsg.cpp @@ -1,3 +1,8 @@ +/** + * @file plrmsg.cpp + * + * Implementation of functionality for printing the ingame chat messages. + */ #include "all.h" DEVILUTION_BEGIN_NAMESPACE @@ -84,13 +89,13 @@ void InitPlrMsg() void DrawPlrMsg() { int i; - DWORD x = 74; - DWORD y = 230; + DWORD x = 10 + SCREEN_X; + DWORD y = 70 + SCREEN_Y; DWORD width = SCREEN_WIDTH - 20; _plrmsg *pMsg; if (chrflag || questlog) { - x = 394; + x = 330 + SCREEN_X; width -= 300; } if (invflag || sbookflag) diff --git a/Source/plrmsg.h b/Source/plrmsg.h index 121576da..c71aa088 100644 --- a/Source/plrmsg.h +++ b/Source/plrmsg.h @@ -1,4 +1,8 @@ -//HEADER_GOES_HERE +/** + * @file plrmsg.h + * + * Interface of functionality for printing the ingame chat messages. + */ #ifndef __PLRMSG_H__ #define __PLRMSG_H__ diff --git a/Source/portal.cpp b/Source/portal.cpp index 8fc6e2cd..9913e145 100644 --- a/Source/portal.cpp +++ b/Source/portal.cpp @@ -1,3 +1,8 @@ +/** + * @file portal.cpp + * + * Implementation of functionality for handling town portals. + */ #include "all.h" DEVILUTION_BEGIN_NAMESPACE diff --git a/Source/portal.h b/Source/portal.h index 5f8b2509..254aa0c4 100644 --- a/Source/portal.h +++ b/Source/portal.h @@ -1,4 +1,8 @@ -//HEADER_GOES_HERE +/** + * @file portal.h + * + * Interface of functionality for handling town portals. + */ #ifndef __PORTAL_H__ #define __PORTAL_H__ diff --git a/Source/quests.cpp b/Source/quests.cpp index ff1114f1..1240819f 100644 --- a/Source/quests.cpp +++ b/Source/quests.cpp @@ -1,3 +1,8 @@ +/** + * @file quests.cpp + * + * Implementation of functionality for handling quests. + */ #include "all.h" DEVILUTION_BEGIN_NAMESPACE @@ -5,6 +10,7 @@ DEVILUTION_BEGIN_NAMESPACE int qtopline; BOOL questlog; BYTE *pQLogCel; +/** Contains the quests of the current game. */ QuestStruct quests[MAXQUESTS]; int qline; int qlist[MAXQUESTS]; @@ -15,6 +21,7 @@ int ReturnLvlY; int ReturnLvlT; int ReturnLvl; +/** Contains the data related to each quest_id. */ QuestData questlist[MAXQUESTS] = { // clang-format off // _qdlvl, _qdmultlvl, _qlvlt, _qdtype, _qdrnd, _qslvl, _qflags, _qdmsg, _qlstr @@ -36,7 +43,15 @@ QuestData questlist[MAXQUESTS] = { { 15, 15, DTYPE_CATHEDRAL, Q_BETRAYER, 100, 5, 1, TEXT_VILE1, "Archbishop Lazarus" }, // clang-format on }; +/** + * Specifies a delta in X-coordinates from the quest entrance for + * which the hover text of the cursor will be visible. + */ char questxoff[7] = { 0, -1, 0, -1, -2, -1, -2 }; +/** + * Specifies a delta in Y-coordinates from the quest entrance for + * which the hover text of the cursor will be visible. + */ char questyoff[7] = { 0, 0, -1, -1, -1, -2, -2 }; char *questtrigstr[5] = { "King Leoric's Tomb", @@ -45,9 +60,29 @@ char *questtrigstr[5] = { "A Dark Passage", "Unholy Altar" }; +/** + * A quest group containing the three quests the Butcher, + * Ogden's Sign and Gharbad the Weak, which ensures that exactly + * two of these three quests appear in any single player game. + */ int QuestGroup1[3] = { Q_BUTCHER, Q_LTBANNER, Q_GARBUD }; +/** + * A quest group containing the three quests Halls of the Blind, + * the Magic Rock and Valor, which ensures that exactly two of + * these three quests appear in any single player game. + */ int QuestGroup2[3] = { Q_BLIND, Q_ROCK, Q_BLOOD }; +/** + * A quest group containing the three quests Black Mushroom, + * Zhar the Mad and Anvil of Fury, which ensures that exactly + * two of these three quests appear in any single player game. + */ int QuestGroup3[3] = { Q_MUSHROOM, Q_ZHAR, Q_ANVIL }; +/** + * A quest group containing the two quests Lachdanan and Warlord + * of Blood, which ensures that exactly one of these two quests + * appears in any single player game. + */ int QuestGroup4[2] = { Q_VEIL, Q_WARLORD }; void InitQuests() @@ -702,8 +737,8 @@ void PrintQLString(int x, int y, BOOL cjustflag, char *str, int col) int len, width, i, k, sx, sy; BYTE c; - sx = x + 96; - sy = y * 12 + 204; + sx = x + 32 + SCREEN_X; + sy = y * 12 + 44 + SCREEN_Y; len = strlen(str); k = 0; if (cjustflag) { @@ -715,7 +750,7 @@ void PrintQLString(int x, int y, BOOL cjustflag, char *str, int col) sx += k; } if (qline == y) { - CelDraw(cjustflag ? x + k + 76 : x + 76, sy + 1, pSPentSpn2Cels, PentSpn2Frame, 12); + CelDraw(cjustflag ? x + k + 12 + SCREEN_X : x + 12 + SCREEN_X, sy + 1, pSPentSpn2Cels, PentSpn2Frame, 12); } for (i = 0; i < len; i++) { c = fontframe[gbFontTransTbl[(BYTE)str[i]]]; @@ -726,7 +761,7 @@ void PrintQLString(int x, int y, BOOL cjustflag, char *str, int col) sx += fontkern[c] + 1; } if (qline == y) { - CelDraw(cjustflag ? x + k + 100 : 340 - x, sy + 1, pSPentSpn2Cels, PentSpn2Frame, 12); + CelDraw(cjustflag ? x + k + 36 + SCREEN_X : 276 + SCREEN_X - x, sy + 1, pSPentSpn2Cels, PentSpn2Frame, 12); } } diff --git a/Source/quests.h b/Source/quests.h index c9a2e87d..48b5faeb 100644 --- a/Source/quests.h +++ b/Source/quests.h @@ -1,4 +1,8 @@ -//HEADER_GOES_HERE +/** + * @file quests.cpp + * + * Interface of functionality for handling quests. + */ #ifndef __QUESTS_H__ #define __QUESTS_H__ diff --git a/Source/render.cpp b/Source/render.cpp index 1be46d0b..c1f4abb8 100644 --- a/Source/render.cpp +++ b/Source/render.cpp @@ -1,3 +1,8 @@ +/** + * @file render.cpp + * + * Implementation of functionality for rendering the level tiles. + */ #include "all.h" DEVILUTION_BEGIN_NAMESPACE @@ -13,6 +18,7 @@ enum { RT_RTRAPEZOID }; +/** Specifies the draw masks used to render transparency of the right side of tiles. */ static DWORD RightMask[TILE_HEIGHT] = { 0xEAAAAAAA, 0xF5555555, 0xFEAAAAAA, 0xFF555555, @@ -31,7 +37,7 @@ static DWORD RightMask[TILE_HEIGHT] = { 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF }; - +/** Specifies the draw masks used to render transparency of the left side of tiles. */ static DWORD LeftMask[TILE_HEIGHT] = { 0xAAAAAAAB, 0x5555555F, 0xAAAAAABF, 0x555555FF, @@ -50,7 +56,7 @@ static DWORD LeftMask[TILE_HEIGHT] = { 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF }; - +/** Specifies the draw masks used to render transparency of wall tiles. */ static DWORD WallMask[TILE_HEIGHT] = { 0xAAAAAAAA, 0x55555555, 0xAAAAAAAA, 0x55555555, diff --git a/Source/render.h b/Source/render.h index c80fcad9..f8b80ef5 100644 --- a/Source/render.h +++ b/Source/render.h @@ -1,3 +1,8 @@ +/** + * @file render.h + * + * Interface of functionality for rendering the level tiles. + */ #ifndef __RENDER_H__ #define __RENDER_H__ diff --git a/Source/restrict.cpp b/Source/restrict.cpp index 18cd4ccc..1bce371f 100644 --- a/Source/restrict.cpp +++ b/Source/restrict.cpp @@ -1,8 +1,17 @@ +/** + * @file restrict.cpp + * + * Implementation of functionality for checking if the game will be able run on the system. + */ #include "all.h" #include "../3rdParty/Storm/Source/storm.h" DEVILUTION_BEGIN_NAMESPACE +/** + * @brief Check that we have write access to the game install folder + + */ void ReadOnlyTest() { FILE *f; @@ -11,7 +20,7 @@ void ReadOnlyTest() GetPrefPath(path, MAX_PATH); snprintf(Filename, MAX_PATH, "%sDiablo1ReadOnlyTest.foo", path); - f = fopen(Filename, "wt"); + f = fopen(Filename, "wt"); if (!f) { DirErrorDlg(path); } diff --git a/Source/restrict.h b/Source/restrict.h index b7584ccf..db3ef8d4 100644 --- a/Source/restrict.h +++ b/Source/restrict.h @@ -1,4 +1,8 @@ -//HEADER_GOES_HERE +/** + * @file restrict.h + * + * Interface of functionality for checking if the game will be able run on the system. + */ #ifndef __RESTRICT_H__ #define __RESTRICT_H__ diff --git a/Source/scrollrt.cpp b/Source/scrollrt.cpp index f8b7ece5..18682d21 100644 --- a/Source/scrollrt.cpp +++ b/Source/scrollrt.cpp @@ -1,3 +1,8 @@ +/** + * @file plrmsg.cpp + * + * Implementation of functionality for rendering the dungeons, monsters and calling other render routines. + */ #include "all.h" DEVILUTION_BEGIN_NAMESPACE diff --git a/Source/scrollrt.h b/Source/scrollrt.h index 5fab9fcc..5052e683 100644 --- a/Source/scrollrt.h +++ b/Source/scrollrt.h @@ -1,4 +1,8 @@ -//HEADER_GOES_HERE +/** + * @file scrollrt.h + * + * Interface of functionality for rendering the dungeons, monsters and calling other render routines. + */ #ifndef __SCROLLRT_H__ #define __SCROLLRT_H__ diff --git a/Source/setmaps.cpp b/Source/setmaps.cpp index 244e8132..71b59bb0 100644 --- a/Source/setmaps.cpp +++ b/Source/setmaps.cpp @@ -1,3 +1,8 @@ +/** + * @file setmaps.cpp + * + * Implementation of functionality the special quest dungeons. + */ #include "all.h" DEVILUTION_BEGIN_NAMESPACE @@ -131,6 +136,9 @@ void DRLG_SetMapTrans(char *sFileName) mem_free_dbg(pLevelMap); } +/** + * @brief Load a quest map, the given map is specified via the global setlvlnum + */ void LoadSetMap() { switch (setlvlnum) { diff --git a/Source/setmaps.h b/Source/setmaps.h index 7df8c223..7c874a7f 100644 --- a/Source/setmaps.h +++ b/Source/setmaps.h @@ -1,4 +1,8 @@ -//HEADER_GOES_HERE +/** + * @file setmaps.cpp + * + * Interface of functionality the special quest dungeons. + */ #ifndef __SETMAPS_H__ #define __SETMAPS_H__ diff --git a/Source/sha.cpp b/Source/sha.cpp index 07715a01..f0dcdb07 100644 --- a/Source/sha.cpp +++ b/Source/sha.cpp @@ -1,3 +1,8 @@ +/** + * @file sha.cpp + * + * Implementation of functionality for calculating X-SHA-1 (a flawed implementation of SHA-1). + */ #include "all.h" #include @@ -9,7 +14,7 @@ DEVILUTION_BEGIN_NAMESPACE namespace { -/* +/** * Diablo-"SHA1" circular left shift, portable version. */ uint32_t SHA1CircularShift(uint32_t bits, uint32_t word) { diff --git a/Source/sha.h b/Source/sha.h index 25be6a27..be3cc9e1 100644 --- a/Source/sha.h +++ b/Source/sha.h @@ -1,4 +1,8 @@ -//HEADER_GOES_HERE +/** + * @file sha.cpp + * + * Interface of functionality for calculating X-SHA-1 (a flawed implementation of SHA-1). + */ #ifndef __SHA_H__ #define __SHA_H__ diff --git a/Source/sound.h b/Source/sound.h index 2595023c..fb9ab4b1 100644 --- a/Source/sound.h +++ b/Source/sound.h @@ -1,4 +1,8 @@ -//HEADER_GOES_HERE +/** + * @file sound.h + * + * Interface of functions setting up the audio pipeline. + */ #ifndef __SOUND_H__ #define __SOUND_H__ diff --git a/Source/spelldat.cpp b/Source/spelldat.cpp index d2f1d35f..a4dd482e 100644 --- a/Source/spelldat.cpp +++ b/Source/spelldat.cpp @@ -1,3 +1,8 @@ +/** + * @file spelldat.cpp + * + * Implementation of all spell data. + */ #include "all.h" DEVILUTION_BEGIN_NAMESPACE diff --git a/Source/spelldat.h b/Source/spelldat.h index 7edfa60a..003a9638 100644 --- a/Source/spelldat.h +++ b/Source/spelldat.h @@ -1,4 +1,8 @@ -//HEADER_GOES_HERE +/** + * @file spelldat.h + * + * Interface of all spell data. + */ #ifndef __SPELLDAT_H__ #define __SPELLDAT_H__ diff --git a/Source/spells.cpp b/Source/spells.cpp index 402bb263..8c3ac109 100644 --- a/Source/spells.cpp +++ b/Source/spells.cpp @@ -1,3 +1,8 @@ +/** + * @file spells.cpp + * + * Implementation of functionality for casting player spells. + */ #include "all.h" DEVILUTION_BEGIN_NAMESPACE diff --git a/Source/spells.h b/Source/spells.h index a59b87a6..5a0345dc 100644 --- a/Source/spells.h +++ b/Source/spells.h @@ -1,4 +1,8 @@ -//HEADER_GOES_HERE +/** + * @file spells.h + * + * Interface of functionality for casting player spells. + */ #ifndef __SPELLS_H__ #define __SPELLS_H__ diff --git a/Source/stores.cpp b/Source/stores.cpp index 9b734394..dfe2ef20 100644 --- a/Source/stores.cpp +++ b/Source/stores.cpp @@ -1,3 +1,8 @@ +/** + * @file stores.cpp + * + * Implementation of functionality for stores and towner dialogs. + */ #include "all.h" DEVILUTION_BEGIN_NAMESPACE @@ -118,7 +123,7 @@ void FreeStoreMem() void DrawSTextBack() { - CelDraw(PANEL_X + 344, 487, pSTextBoxCels, 1, 271); + CelDraw(PANEL_X + 344, 327 + SCREEN_Y, pSTextBoxCels, 1, 271); trans_rect(PANEL_LEFT + 347, 28, 265, 297); } @@ -135,7 +140,7 @@ void PrintSString(int x, int y, BOOL cjustflag, char *str, char col, int val) else xx = PANEL_X + 352; sx = xx + x; - sy = s + 204; + sy = s + 44 + SCREEN_Y; len = strlen(str); if (stextsize) yy = 577; @@ -151,7 +156,7 @@ void PrintSString(int x, int y, BOOL cjustflag, char *str, char col, int val) sx += k; } if (stextsel == y) { - CelDraw(cjustflag ? xx + x + k - 20 : xx + x - 20, s + 205, pSPentSpn2Cels, PentSpn2Frame, 12); + CelDraw(cjustflag ? xx + x + k - 20 : xx + x - 20, s + 45 + SCREEN_Y, pSPentSpn2Cels, PentSpn2Frame, 12); } for (i = 0; i < len; i++) { c = fontframe[gbFontTransTbl[(BYTE)str[i]]]; @@ -173,7 +178,7 @@ void PrintSString(int x, int y, BOOL cjustflag, char *str, char col, int val) } } if (stextsel == y) { - CelDraw(cjustflag ? (xx + x + k + 4) : (PANEL_X + 596 - x), s + 205, pSPentSpn2Cels, PentSpn2Frame, 12); + CelDraw(cjustflag ? (xx + x + k + 4) : (PANEL_X + 596 - x), s + 45 + SCREEN_Y, pSPentSpn2Cels, PentSpn2Frame, 12); } } @@ -184,14 +189,14 @@ void DrawSLine(int y) sy = y * 12; if (stextsize) { xy = SCREENXY(PANEL_LEFT + 26, 25); - yy = BUFFER_WIDTH * (sy + 198) + 26 + PANEL_X; - width = 586 / 4; - line = BUFFER_WIDTH - 586; + yy = BUFFER_WIDTH * (sy + 38 + SCREEN_Y) + 26 + PANEL_X; + width = 586 / 4; // BUGFIX: should be 587, not 586 + line = BUFFER_WIDTH - 586; // BUGFIX: should be 587, not 586 } else { xy = SCREENXY(PANEL_LEFT + 346, 25); - yy = BUFFER_WIDTH * (sy + 198) + 346 + PANEL_X; - width = 266 / 4; - line = BUFFER_WIDTH - 266; + yy = BUFFER_WIDTH * (sy + 38 + SCREEN_Y) + 346 + PANEL_X; + width = 266 / 4; // BUGFIX: should be 267, not 266 + line = BUFFER_WIDTH - 266; // BUGFIX: should be 267, not 266 } /// ASSERT: assert(gpBuffer); @@ -210,8 +215,8 @@ void DrawSSlider(int y1, int y2) { int yd1, yd2, yd3; - yd1 = y1 * 12 + 204; - yd2 = y2 * 12 + 204; + yd1 = y1 * 12 + 44 + SCREEN_Y; + yd2 = y2 * 12 + 44 + SCREEN_Y; if (stextscrlubtn != -1) CelDraw(PANEL_X + 601, yd1, pSTextSlidCels, 12, 12); else @@ -232,7 +237,7 @@ void DrawSSlider(int y1, int y2) yd3 = 1000 * (stextsval + ((yd3 - stextup) >> 2)) / (storenumh - 1) * (y2 * 12 - y1 * 12 - 24) / 1000; else yd3 = 0; - CelDraw(PANEL_X + 601, (y1 + 1) * 12 + 204 + yd3, pSTextSlidCels, 13, 12); + CelDraw(PANEL_X + 601, (y1 + 1) * 12 + 44 + SCREEN_Y + yd3, pSTextSlidCels, 13, 12); } void DrawSTextHelp() diff --git a/Source/stores.h b/Source/stores.h index f3358b6f..d3938a46 100644 --- a/Source/stores.h +++ b/Source/stores.h @@ -1,4 +1,8 @@ -//HEADER_GOES_HERE +/** + * @file stores.h + * + * Interface of functionality for stores and towner dialogs. + */ #ifndef __STORES_H__ #define __STORES_H__ diff --git a/Source/sync.cpp b/Source/sync.cpp index c9a7ddc9..2b07b0ea 100644 --- a/Source/sync.cpp +++ b/Source/sync.cpp @@ -1,3 +1,8 @@ +/** + * @file sync.cpp + * + * Implementation of functionality for syncing game state with other players. + */ #include "all.h" DEVILUTION_BEGIN_NAMESPACE diff --git a/Source/sync.h b/Source/sync.h index f3d98d07..17ec0881 100644 --- a/Source/sync.h +++ b/Source/sync.h @@ -1,4 +1,8 @@ -//HEADER_GOES_HERE +/** + * @file sync.h + * + * Interface of functionality for syncing game state with other players. + */ #ifndef __SYNC_H__ #define __SYNC_H__ diff --git a/Source/textdat.cpp b/Source/textdat.cpp index 0e2dcaed..2b36476d 100644 --- a/Source/textdat.cpp +++ b/Source/textdat.cpp @@ -1,3 +1,8 @@ +/** + * @file textdat.cpp + * + * Implementation of all dialog texts. + */ #include "all.h" DEVILUTION_BEGIN_NAMESPACE diff --git a/Source/textdat.h b/Source/textdat.h index fff83b05..204168f9 100644 --- a/Source/textdat.h +++ b/Source/textdat.h @@ -1,4 +1,8 @@ -//HEADER_GOES_HERE +/** + * @file textdat.h + * + * Interface of all dialog texts. + */ #ifndef __TEXTDAT_H__ #define __TEXTDAT_H__ diff --git a/Source/themes.cpp b/Source/themes.cpp index ac2262f8..adaae979 100644 --- a/Source/themes.cpp +++ b/Source/themes.cpp @@ -24,8 +24,9 @@ BOOL pFountainFlag; BOOL bFountainFlag; BOOL bCrossFlag; +/** Specifies the set of special theme IDs from which one will be selected at random. */ int ThemeGood[4] = { THEME_GOATSHRINE, THEME_SHRINE, THEME_SKELROOM, THEME_LIBRARY }; - +/** Specifies a 5x5 area to fit theme objects. */ int trm5x[] = { -2, -1, 0, 1, 2, -2, -1, 0, 1, 2, @@ -33,7 +34,7 @@ int trm5x[] = { -2, -1, 0, 1, 2, -2, -1, 0, 1, 2 }; - +/** Specifies a 5x5 area to fit theme objects. */ int trm5y[] = { -2, -2, -2, -2, -2, -1, -1, -1, -1, -1, @@ -41,13 +42,13 @@ int trm5y[] = { 1, 1, 1, 1, 1, 2, 2, 2, 2, 2 }; - +/** Specifies a 3x3 area to fit theme objects. */ int trm3x[] = { -1, 0, 1, -1, 0, 1, -1, 0, 1 }; - +/** Specifies a 3x3 area to fit theme objects. */ int trm3y[] = { -1, -1, -1, 0, 0, 0, diff --git a/Source/tmsg.cpp b/Source/tmsg.cpp index 73705167..3b557c93 100644 --- a/Source/tmsg.cpp +++ b/Source/tmsg.cpp @@ -1,3 +1,8 @@ +/** + * @file tmsg.cpp + * + * Implementation of functionality transmitting chat messages. + */ #include "all.h" DEVILUTION_BEGIN_NAMESPACE diff --git a/Source/tmsg.h b/Source/tmsg.h index d8d674d2..4a15fb30 100644 --- a/Source/tmsg.h +++ b/Source/tmsg.h @@ -1,4 +1,8 @@ -//HEADER_GOES_HERE +/** + * @file tmsg.h + * + * Interface of functionality transmitting chat messages. + */ #ifndef __TMSG_H__ #define __TMSG_H__ diff --git a/Source/town.cpp b/Source/town.cpp index 70592201..1c6273b3 100644 --- a/Source/town.cpp +++ b/Source/town.cpp @@ -1,3 +1,8 @@ +/** + * @file town.h + * + * Implementation of functionality for rendering the town, towners and calling other render routines. + */ #include "all.h" DEVILUTION_BEGIN_NAMESPACE diff --git a/Source/town.h b/Source/town.h index 2f4bd952..f73b6fb6 100644 --- a/Source/town.h +++ b/Source/town.h @@ -1,4 +1,8 @@ -//HEADER_GOES_HERE +/** + * @file town.h + * + * Interface of functionality for rendering the town, towners and calling other render routines. + */ #ifndef __TOWN_H__ #define __TOWN_H__ diff --git a/Source/towners.cpp b/Source/towners.cpp index 6f387112..27df4d28 100644 --- a/Source/towners.cpp +++ b/Source/towners.cpp @@ -1,3 +1,8 @@ +/** + * @file towners.cpp + * + * Implementation of functionality for loading and spawning towners. + */ #include "all.h" DEVILUTION_BEGIN_NAMESPACE @@ -13,6 +18,13 @@ BYTE *pCowCels; TownerStruct towner[NUM_TOWNERS]; #ifndef SPAWN +/** + * Maps from active cow sound effect index and player class to sound + * effect ID for interacting with cows in Tristram. + * + * ref: enum _sfx_id + * ref: enum plr_class + */ const int snSFX[3][NUM_CLASSES] = { { PS_WARR52, PS_ROGUE52, PS_MAGE52 }, { PS_WARR49, PS_ROGUE49, PS_MAGE49 }, @@ -21,7 +33,7 @@ const int snSFX[3][NUM_CLASSES] = { #endif /* data */ - +/** Specifies the animation frame sequence of a given NPC. */ char AnimOrder[6][148] = { { 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 14, 13, 12, 11, 10, 9, 8, 7, 6, 5, @@ -88,11 +100,23 @@ char AnimOrder[6][148] = { 1, 2, 1, 19, 18, 19, 1, 2, 1, 2, 3, -1 } }; +/** Specifies the start X-coordinates of the cows in Tristram. */ int TownCowX[] = { 58, 56, 59 }; +/** Specifies the start Y-coordinates of the cows in Tristram. */ int TownCowY[] = { 16, 14, 20 }; +/** Specifies the start directions of the cows in Tristram. */ int TownCowDir[] = { DIR_SW, DIR_NW, DIR_N }; +/** Maps from direction to X-coordinate delta, which is used when + * placing cows in Tristram. A single cow may require space of up + * to three tiles when being placed on the map. + */ int cowoffx[8] = { -1, 0, -1, -1, -1, 0, -1, -1 }; +/** Maps from direction to Y-coordinate delta, which is used when + * placing cows in Tristram. A single cow may require space of up + * to three tiles when being placed on the map. + */ int cowoffy[8] = { -1, -1, -1, 0, -1, -1, -1, 0 }; +/** Contains the data related to quest gossip for each towner ID. */ QuestTalkData Qtalklist[] = { // clang-format off // _qinfra, _qblkm, _qgarb, _qzhar, _qveil, _qmod, _qbutch, _qbol, _qblind, _qblood, _qanvil, _qwarlrd, _qking, _qpw, _qbone, _qvb @@ -109,6 +133,7 @@ QuestTalkData Qtalklist[] = { { 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 }; +/** Specifies the active sound effect ID for interacting with cows. */ int CowPlaying = -1; int GetActiveTowner(int t) @@ -176,6 +201,10 @@ void InitQstSnds(int i) } } +/** + * @brief Load Griswold into the game + + */ void InitSmith() { int i; diff --git a/Source/towners.h b/Source/towners.h index a574c3fb..ad2bd93c 100644 --- a/Source/towners.h +++ b/Source/towners.h @@ -1,4 +1,8 @@ -//HEADER_GOES_HERE +/** + * @file towners.h + * + * Interface of functionality for loading and spawning towners. + */ #ifndef __TOWNERS_H__ #define __TOWNERS_H__ diff --git a/Source/track.cpp b/Source/track.cpp index 9879f080..8bb6b3d3 100644 --- a/Source/track.cpp +++ b/Source/track.cpp @@ -1,3 +1,8 @@ +/** + * @file track.cpp + * + * Implementation of functionality tracking what the mouse cursor is pointing at. + */ #include "all.h" DEVILUTION_BEGIN_NAMESPACE diff --git a/Source/track.h b/Source/track.h index 99c42082..14f396ab 100644 --- a/Source/track.h +++ b/Source/track.h @@ -1,4 +1,8 @@ -//HEADER_GOES_HERE +/** + * @file track.h + * + * Interface of functionality tracking what the mouse cursor is pointing at. + */ #ifndef __TRACK_H__ #define __TRACK_H__ diff --git a/Source/trigs.cpp b/Source/trigs.cpp index fb5f14fd..c431f11c 100644 --- a/Source/trigs.cpp +++ b/Source/trigs.cpp @@ -1,3 +1,8 @@ +/** + * @file trigs.cpp + * + * Implementation of functionality for triggering events when the player enters an area. + */ #include "all.h" DEVILUTION_BEGIN_NAMESPACE @@ -8,19 +13,33 @@ int numtrigs; TriggerStruct trigs[MAXTRIGGERS]; int TWarpFrom; +/** Specifies the dungeon piece IDs which constitute stairways leading down to the cathedral from town. */ int TownDownList[] = { 716, 715, 719, 720, 721, 723, 724, 725, 726, 727, -1 }; +/** Specifies the dungeon piece IDs which constitute stairways leading down to the catacombs from town. */ int TownWarp1List[] = { 1171, 1172, 1173, 1174, 1175, 1176, 1177, 1178, 1179, 1181, 1183, 1185, -1 }; +/** Specifies the dungeon piece IDs which constitute stairways leading up from the cathedral. */ int L1UpList[] = { 127, 129, 130, 131, 132, 133, 135, 137, 138, 139, 140, -1 }; +/** Specifies the dungeon piece IDs which constitute stairways leading down from the cathedral. */ int L1DownList[] = { 106, 107, 108, 109, 110, 112, 114, 115, 118, -1 }; +/** Specifies the dungeon piece IDs which constitute stairways leading up from the catacombs. */ int L2UpList[] = { 266, 267, -1 }; +/** Specifies the dungeon piece IDs which constitute stairways leading down from the catacombs. */ int L2DownList[] = { 269, 270, 271, 272, -1 }; +/** Specifies the dungeon piece IDs which constitute stairways leading up to town from the catacombs. */ int L2TWarpUpList[] = { 558, 559, -1 }; +/** Specifies the dungeon piece IDs which constitute stairways leading up from the caves. */ int L3UpList[] = { 170, 171, 172, 173, 174, 175, 176, 177, 178, 179, 180, 181, 182, 183, -1 }; +/** Specifies the dungeon piece IDs which constitute stairways leading down from the caves. */ int L3DownList[] = { 162, 163, 164, 165, 166, 167, 168, 169, -1 }; +/** Specifies the dungeon piece IDs which constitute stairways leading up to town from the caves. */ int L3TWarpUpList[] = { 548, 549, 550, 551, 552, 553, 554, 555, 556, 557, 558, 559, 560, -1 }; +/** Specifies the dungeon piece IDs which constitute stairways leading up from hell. */ int L4UpList[] = { 82, 83, 90, -1 }; +/** Specifies the dungeon piece IDs which constitute stairways leading down from hell. */ int L4DownList[] = { 120, 130, 131, 132, 133, -1 }; +/** Specifies the dungeon piece IDs which constitute stairways leading up to town from hell. */ int L4TWarpUpList[] = { 421, 422, 429, -1 }; +/** Specifies the dungeon piece IDs which constitute stairways leading down to Diablo from hell. */ int L4PentaList[] = { 353, 354, 355, 356, 357, 358, 359, 360, 361, 362, 363, 364, 365, 366, 367, 368, 369, 370, 371, 372, 373, 374, 375, 376, 377, 378, 379, 380, 381, 382, 383, 384, -1 }; #ifndef SPAWN diff --git a/Source/trigs.h b/Source/trigs.h index 2bad3b8c..5db6e433 100644 --- a/Source/trigs.h +++ b/Source/trigs.h @@ -1,4 +1,8 @@ -//HEADER_GOES_HERE +/** + * @file trigs.h + * + * Interface of functionality for triggering events when the player enters an area. + */ #ifndef __TRIGS_H__ #define __TRIGS_H__ diff --git a/Source/wave.cpp b/Source/wave.cpp index dae5cfe0..7db2b09a 100644 --- a/Source/wave.cpp +++ b/Source/wave.cpp @@ -1,3 +1,8 @@ +/** + * @file wave.cpp + * + * Implementation of functionality for loading fies and processing wave files. + */ #include "all.h" #include "../3rdParty/Storm/Source/storm.h" diff --git a/Source/wave.h b/Source/wave.h index e77a2538..91fc26fd 100644 --- a/Source/wave.h +++ b/Source/wave.h @@ -1,4 +1,8 @@ -//HEADER_GOES_HERE +/** + * @file wave.h + * + * Interface of functionality for loading fies and processing wave files. + */ #ifndef __WAVE_H__ #define __WAVE_H__ diff --git a/SourceX/sound.cpp b/SourceX/sound.cpp index ef73ee6c..dabedd49 100644 --- a/SourceX/sound.cpp +++ b/SourceX/sound.cpp @@ -1,3 +1,8 @@ +/** + * @file sound.cpp + * + * Implementation of functions setting up the audio pipeline. + */ #include "all.h" #include "../3rdParty/Storm/Source/storm.h" #include "stubs.h" @@ -9,6 +14,7 @@ namespace dvl { BOOLEAN gbSndInited; int sglMusicVolume; int sglSoundVolume; +/** Specifies whether background music is enabled. */ HANDLE sghMusic; Mix_Music *music; @@ -18,9 +24,10 @@ char *musicBuffer; /* data */ BOOLEAN gbMusicOn = true; +/** Specifies whether sound effects are enabled. */ BOOLEAN gbSoundOn = true; int sgnMusicTrack = NUM_MUSIC; - +/** Maps from track ID to track name. */ char *sgszMusicTracks[NUM_MUSIC] = { #ifdef SPAWN "Music\\sTowne.wav", @@ -141,7 +148,7 @@ void snd_init(HWND hWnd) void snd_get_volume(char *value_name, int *value) { int v = *value; - if (!SRegLoadValue("Diablo", value_name, 0, &v)) { + if (!SRegLoadValue(APP_NAME, value_name, 0, &v)) { v = VOLUME_MAX; } *value = v; @@ -167,7 +174,7 @@ void sound_cleanup() void snd_set_volume(char *key, int value) { - SRegSaveValue("Diablo", key, 0, value); + SRegSaveValue(APP_NAME, key, 0, value); } void music_stop() diff --git a/enums.h b/enums.h index 7985a1b1..bf35eeda 100644 --- a/enums.h +++ b/enums.h @@ -1311,8 +1311,7 @@ typedef enum missile_graphic_id { MFILE_SCUBMISD, MFILE_SCBSEXPD, MFILE_NULL, - MFILE_INVALID, - MFILE_NONE = 0xFF, + MFILE_NONE = 0xFF, // BUGFIX: should be `MFILE_NONE = MFILE_SCBSEXPD+1`, i.e. MFILE_NULL, since there would otherwise be an out-of-bounds in SetMissAnim when accessing misfiledata for any of the missiles that have MFILE_NONE as mFileNum in missiledata. } missile_graphic_id; typedef enum _mai_id { @@ -1887,6 +1886,39 @@ typedef enum dflag { BFLAG_EXPLORED = 0x80, } dflag; + /* + First 5 bits store level + 6th bit stores onlygood flag + 7th bit stores uper15 flag - uper means unique percent, this flag is true for unique monsters and loot from them has 15% to become unique + 8th bit stores uper1 flag - this is loot from normal monsters, which has 1% to become unique + 9th bit stores info if item is unique + 10th bit stores info if item is a basic one from griswold + 11th bit stores info if item is a premium one from griswold + 12th bit stores info if item is from wirt + 13th bit stores info if item is from adria + 14th bit stores info if item is from pepin + 15th bit stores pregen flag + + combining CF_UPER15 and CF_UPER1 flags (CF_USEFUL) is used to mark potions and town portal scrolls created on the ground + CF_TOWN is combining all store flags and indicates if item has been bought from a NPC + */ +typedef enum icreateinfo_flag { + CF_LEVEL = (1 << 6) - 1, + CF_ONLYGOOD = 1 << 6, + CF_UPER15 = 1 << 7, + CF_UPER1 = 1 << 8, + CF_UNIQUE = 1 << 9, + CF_SMITH = 1 << 10, + CF_SMITHPREMIUM = 1 << 11, + CF_BOY = 1 << 12, + CF_WITCH = 1 << 13, + CF_HEALER = 1 << 14, + CF_PREGEN = 1 << 15, + + CF_USEFUL = CF_UPER15 | CF_UPER1, + CF_TOWN = CF_SMITH | CF_SMITHPREMIUM | CF_BOY | CF_WITCH | CF_HEALER, +} icreateinfo_flag; + typedef enum dungeon_message { DMSG_CATHEDRAL = 1 << 0, DMSG_CATACOMBS = 1 << 1,