diff --git a/DiabloUI/diabloui.h b/DiabloUI/diabloui.h index 9c22a56d6..4b200ab3a 100644 --- a/DiabloUI/diabloui.h +++ b/DiabloUI/diabloui.h @@ -13,7 +13,7 @@ BOOL UiSelHeroMultDialog(BOOL(*fninfo)(BOOL(*fninfofunc)(_uiheroinfo *)), BOOL(* BOOL UiSelHeroSingDialog(BOOL(*fninfo)(BOOL(*fninfofunc)(_uiheroinfo *)), BOOL(*fncreate)(_uiheroinfo *), BOOL(*fnremove)(_uiheroinfo *), BOOL(*fnstats)(unsigned int, _uidefaultstats *), int *dlgresult, char *name, int *difficulty); BOOL UiCreditsDialog(int a1); BOOL UiMainMenuDialog(char *name, int *pdwResult, void(*fnSound)(char *file), int attractTimeOut); -BOOL UiProgressDialog(HWND window, char *msg, int enable, int(*fnfunc)(), int rate); +BOOL UiProgressDialog(char *msg, int enable, int(*fnfunc)(), int rate); const char **UiProfileGetString(); void UiProfileCallback(); void UiProfileDraw(); diff --git a/Source/appfat.cpp b/Source/appfat.cpp index 245439abc..ce32ce099 100644 --- a/Source/appfat.cpp +++ b/Source/appfat.cpp @@ -86,7 +86,6 @@ void ErrDlg(const char *title, const char *error, char *log_file_path, int log_l app_fatal(NULL); } - void FileErrDlg(const char *error) { char text[1024]; diff --git a/Source/automap.cpp b/Source/automap.cpp index 7842b3117..6cafca9fe 100644 --- a/Source/automap.cpp +++ b/Source/automap.cpp @@ -7,13 +7,19 @@ DEVILUTION_BEGIN_NAMESPACE -// BUGFIX: only the first 256 elements are ever read +/** + * Maps from tile_id to automap type. + * BUGFIX: only the first 256 elements are ever read + */ WORD automaptype[512]; static int AutoMapX; static int AutoMapY; +/** Specifies whether the automap is enabled. */ BOOL automapflag; char AmShiftTab[31]; +/** Tracks the explored areas of the map. */ BOOLEAN automapview[DMAXX][DMAXY]; +/** Specifies the scale of the automap. */ int AutoMapScale; int AutoMapXOfs; int AutoMapYOfs; diff --git a/Source/capture.cpp b/Source/capture.cpp index 4a13249bf..5ef7f591c 100644 --- a/Source/capture.cpp +++ b/Source/capture.cpp @@ -41,7 +41,7 @@ static BOOL CaptureHdr(short width, short height, std::ofstream *out) static BOOL CapturePal(SDL_Color *palette, std::ofstream *out) { - BYTE pcx_palette[769]; + BYTE pcx_palette[1 + 256 * 3]; int i; pcx_palette[0] = 12; diff --git a/Source/control.cpp b/Source/control.cpp index 63abb93be..701b7a188 100644 --- a/Source/control.cpp +++ b/Source/control.cpp @@ -13,8 +13,8 @@ BYTE *pDurIcons; BYTE *pChrButtons; BOOL drawhpflag; BOOL dropGoldFlag; -int panbtn[8]; -int chrbtn[4]; +BOOL panbtn[8]; +BOOL chrbtn[4]; BYTE *pMultiBtns; BYTE *pPanelButtons; BYTE *pChrPanel; @@ -28,14 +28,14 @@ BYTE *pPanelText; BYTE *pLifeBuff; BYTE *pBtmBuff; BYTE *pTalkBtns; -int pstrjust[4]; +BOOL pstrjust[4]; int pnumlines; BOOL pinfoflag; BOOL talkbtndown[3]; int pSpell; BYTE *pManaBuff; char infoclr; -int sgbPlrTalkTbl; // should be char [4] +int sgbPlrTalkTbl; BYTE *pGBoxBuff; BYTE *pSBkBtnCel; char tempstr[256]; @@ -61,6 +61,7 @@ BOOL panbtndown; BYTE *pTalkPanel; BOOL spselflag; +/** Maps from font index to smaltext.cel frame number. */ const BYTE fontframe[128] = { 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, @@ -71,6 +72,12 @@ const BYTE fontframe[128] = { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 40, 66, 41, 67, 0 }; + +/** + * Maps from smaltext.cel frame number to character width. Note, the + * character width may be distinct from the frame width, which is 13 for every + * smaltext.cel frame. + */ const BYTE fontkern[68] = { 8, 10, 7, 9, 8, 7, 6, 8, 8, 3, 3, 8, 6, 11, 9, 10, 6, 9, 9, 6, @@ -81,7 +88,7 @@ const BYTE fontkern[68] = { 4, 4, 9, 6, 6, 12, 3, 7 }; /** - * Line height for info box when displaying 1, 2, 3, 4 and 5 lines respectivly + * Line start position for info box text when displaying 1, 2, 3, 4 and 5 lines respectivly */ const int lineOffsets[5][5] = { { 82 }, @@ -90,6 +97,12 @@ const int lineOffsets[5][5] = { { 60, 75, 89, 104 }, { 58, 70, 82, 94, 105 }, }; + +/** + * Maps ASCII character code to font index, as used by the + * small, medium and large sized fonts; which corresponds to smaltext.cel, + * medtexts.cel and bigtgold.cel respectively. + */ const BYTE gbFontTransTbl[256] = { // clang-format off '\0', 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, @@ -107,12 +120,13 @@ const BYTE gbFontTransTbl[256] = { 'A', 'A', 'A', 'A', 'A', 'A', 'A', 'C', 'E', 'E', 'E', 'E', 'I', 'I', 'I', 'I', 'D', 'N', 'O', 'O', 'O', 'O', 'O', 'X', '0', 'U', 'U', 'U', 'U', 'Y', 'b', 'B', 'a', 'a', 'a', 'a', 'a', 'a', 'a', 'c', 'e', 'e', 'e', 'e', 'i', 'i', 'i', 'i', - 'o', 'n', 'o', 'o', 'o', 'o', 'o', '/', '0', 'u', 'u', 'u', 'u', 'y', 'b', 'y' + 'o', 'n', 'o', 'o', 'o', 'o', 'o', '/', '0', 'u', 'u', 'u', 'u', 'y', 'b', 'y', // clang-format on }; /* data */ +/** Maps from spell_id to spelicon.cel frame number. */ char SpellITbl[MAX_SPELLS] = { 1, 1, @@ -152,19 +166,22 @@ char SpellITbl[MAX_SPELLS] = { 36, 30, }; +/** Maps from panel_button_id to the position and dimensions of a panel button. */ int PanBtnPos[8][5] = { // clang-format off - { PANEL_LEFT + 9, PANEL_TOP + 9, 71, 19, 1 }, // char button - { PANEL_LEFT + 9, PANEL_TOP + 35, 71, 19, 0 }, // quests button - { PANEL_LEFT + 9, PANEL_TOP + 75, 71, 19, 1 }, // map button - { PANEL_LEFT + 9, PANEL_TOP + 101, 71, 19, 0 }, // menu button - { PANEL_LEFT + 560, PANEL_TOP + 9, 71, 19, 1 }, // inv button - { PANEL_LEFT + 560, PANEL_TOP + 35, 71, 19, 0 }, // spells button - { PANEL_LEFT + 87, PANEL_TOP + 91, 33, 32, 1 }, // chat button - { PANEL_LEFT + 527, PANEL_TOP + 91, 33, 32, 1 }, // friendly fire button + { PANEL_LEFT + 9, PANEL_TOP + 9, 71, 19, TRUE }, // char button + { PANEL_LEFT + 9, PANEL_TOP + 35, 71, 19, FALSE }, // quests button + { PANEL_LEFT + 9, PANEL_TOP + 75, 71, 19, TRUE }, // map button + { PANEL_LEFT + 9, PANEL_TOP + 101, 71, 19, FALSE }, // menu button + { PANEL_LEFT + 560, PANEL_TOP + 9, 71, 19, TRUE }, // inv button + { PANEL_LEFT + 560, PANEL_TOP + 35, 71, 19, FALSE }, // spells button + { PANEL_LEFT + 87, PANEL_TOP + 91, 33, 32, TRUE }, // chat button + { PANEL_LEFT + 527, PANEL_TOP + 91, 33, 32, TRUE }, // friendly fire button // clang-format on }; +/** Maps from panel_button_id to hotkey name. */ char *PanBtnHotKey[8] = { "'c'", "'q'", "Tab", "Esc", "'i'", "'b'", "Enter", NULL }; +/** Maps from panel_button_id to panel button description. */ char *PanBtnStr[8] = { "Character Information", "Quests log", @@ -175,6 +192,7 @@ char *PanBtnStr[8] = { "Send Message", "Player Attack" }; +/** Maps from attribute_id to the rectangle on screen used for attribute increment buttons. */ RECT32 ChrBtnsRect[4] = { { 137, 138, 41, 22 }, { 137, 166, 41, 22 }, @@ -182,6 +200,7 @@ RECT32 ChrBtnsRect[4] = { { 137, 223, 41, 22 } }; +/** Maps from spellbook page number and position to spell_id. */ int SpellPages[6][7] = { { SPL_NULL, SPL_FIREBOLT, SPL_CBOLT, SPL_HBOLT, SPL_HEAL, SPL_HEALOTHER, SPL_FLAME }, { SPL_RESURRECT, SPL_FIREWALL, SPL_TELEKINESIS, SPL_LIGHTNING, SPL_TOWN, SPL_FLASH, SPL_STONE }, @@ -191,6 +210,10 @@ int SpellPages[6][7] = { { -1, -1, -1, -1, -1, -1, -1 } }; +#define SPLICONLENGTH 56 +#define SPLROWICONLS 10 +#define SPLICONLAST 43 + /** * Draw spell cell onto the back buffer. * @param xp Back buffer coordinate @@ -280,15 +303,15 @@ void DrawSpell() if (tlvl <= 0) st = RSPLTYPE_INVALID; } - if (!currlevel && st != RSPLTYPE_INVALID && !spelldata[spl].sTownSpell) + if (currlevel == 0 && st != RSPLTYPE_INVALID && !spelldata[spl].sTownSpell) st = RSPLTYPE_INVALID; if (plr[myplr]._pRSpell < 0) st = RSPLTYPE_INVALID; SetSpellTrans(st); if (spl != SPL_INVALID) - DrawSpellCel(PANEL_X + 565, PANEL_Y + 119, pSpellCels, SpellITbl[spl], 56); + DrawSpellCel(PANEL_X + 565, PANEL_Y + 119, pSpellCels, SpellITbl[spl], SPLICONLENGTH); else - DrawSpellCel(PANEL_X + 565, PANEL_Y + 119, pSpellCels, 27, 56); + DrawSpellCel(PANEL_X + 565, PANEL_Y + 119, pSpellCels, 27, SPLICONLENGTH); } void DrawSpellList() @@ -298,28 +321,28 @@ void DrawSpellList() pSpell = SPL_INVALID; infostr[0] = '\0'; - x = PANEL_X + 12 + 56 * 10; + x = PANEL_X + 12 + SPLICONLENGTH * SPLROWICONLS; y = PANEL_Y - 17; ClearPanel(); for (i = 0; i < 4; i++) { switch ((spell_type)i) { case RSPLTYPE_SKILL: SetSpellTrans(RSPLTYPE_SKILL); - c = 46; + c = SPLICONLAST + 3; mask = plr[myplr]._pAblSpells; break; case RSPLTYPE_SPELL: - c = 47; + c = SPLICONLAST + 4; mask = plr[myplr]._pMemSpells; break; case RSPLTYPE_SCROLL: SetSpellTrans(RSPLTYPE_SCROLL); - c = 44; + c = SPLICONLAST + 1; mask = plr[myplr]._pScrlSpells; break; case RSPLTYPE_CHARGES: SetSpellTrans(RSPLTYPE_CHARGES); - c = 45; + c = SPLICONLAST + 2; mask = plr[myplr]._pISpells; break; } @@ -338,13 +361,13 @@ void DrawSpellList() } if (currlevel == 0 && !spelldata[j].sTownSpell) SetSpellTrans(RSPLTYPE_INVALID); - DrawSpellCel(x, y, pSpellCels, SpellITbl[j], 56); + DrawSpellCel(x, y, pSpellCels, SpellITbl[j], SPLICONLENGTH); lx = x - BORDER_LEFT; - ly = y - BORDER_TOP - 56; - if (MouseX >= lx && MouseX < lx + 56 && MouseY >= ly && MouseY < ly + 56) { + ly = y - BORDER_TOP - SPLICONLENGTH; + if (MouseX >= lx && MouseX < lx + SPLICONLENGTH && MouseY >= ly && MouseY < ly + SPLICONLENGTH) { pSpell = j; pSplType = i; - DrawSpellCel(x, y, pSpellCels, c, 56); + DrawSpellCel(x, y, pSpellCels, c, SPLICONLENGTH); switch (i) { case RSPLTYPE_SKILL: sprintf(infostr, "%s Skill", spelldata[pSpell].sSkillText); @@ -395,23 +418,23 @@ void DrawSpellList() } for (t = 0; t < 4; t++) { if (plr[myplr]._pSplHotKey[t] == pSpell && plr[myplr]._pSplTHotKey[t] == pSplType) { - DrawSpellCel(x, y, pSpellCels, t + 48, 56); + DrawSpellCel(x, y, pSpellCels, t + SPLICONLAST + 5, SPLICONLENGTH); sprintf(tempstr, "Spell Hot Key #F%i", t + 5); AddPanelString(tempstr, TRUE); } } } - x -= 56; - if (x == PANEL_X + 12 - 56) { - y -= 56; - x = PANEL_X + 12 + 56 * 10; + x -= SPLICONLENGTH; + if (x == PANEL_X + 12 - SPLICONLENGTH) { + x = PANEL_X + 12 + SPLICONLENGTH * SPLROWICONLS; + y -= SPLICONLENGTH; } } - if (mask != 0 && x != PANEL_X + 12 + 56 * 10) - x -= 56; - if (x == PANEL_X + 12 - 56) { - y -= 56; - x = PANEL_X + 12 + 56 * 10; + if (mask != 0 && x != PANEL_X + 12 + SPLICONLENGTH * SPLROWICONLS) + x -= SPLICONLENGTH; + if (x == PANEL_X + 12 - SPLICONLENGTH) { + x = PANEL_X + 12 + SPLICONLENGTH * SPLROWICONLS; + y -= SPLICONLENGTH; } } } @@ -480,7 +503,7 @@ void ToggleSpell(int slot) */ void PrintChar(int sx, int sy, int nCel, char col) { - /// ASSERT: assert(gpBuffer); + assert(gpBuffer); int i; BYTE pix; @@ -543,7 +566,7 @@ void DrawPanelBox(int x, int y, int w, int h, int sx, int sy) { int nSrcOff, nDstOff; - /// ASSERT: assert(gpBuffer); + assert(gpBuffer); nSrcOff = x + PANEL_WIDTH * y; nDstOff = sx + BUFFER_WIDTH * sy; @@ -573,7 +596,7 @@ void SetFlaskHeight(BYTE *pCelBuff, int min, int max, int sx, int sy) { int nSrcOff, nDstOff, w; - /// ASSERT: assert(gpBuffer); + assert(gpBuffer); nSrcOff = 88 * min; nDstOff = sx + BUFFER_WIDTH * sy; @@ -654,7 +677,7 @@ void UpdateLifeFlask() filled = 0; if (filled != 69) SetFlaskHeight(pLifeBuff, 16, 85 - filled, 96 + PANEL_X, PANEL_Y); - if (filled) + if (filled != 0) DrawPanelBox(96, 85 - filled, 88, filled, 96 + PANEL_X, PANEL_Y + 69 - filled); } @@ -715,7 +738,7 @@ void UpdateManaFlask() filled = 69; if (filled != 69) SetFlaskHeight(pManaBuff, 16, 85 - filled, 96 + PANEL_X + 368, PANEL_Y); - if (filled) + if (filled != 0) DrawPanelBox(96 + 368, 85 - filled, 88, filled, 96 + PANEL_X + 368, PANEL_Y + 69 - filled); DrawSpell(); @@ -765,7 +788,7 @@ void InitControlPan() lvlbtndown = FALSE; pPanelButtons = LoadFileInMem("CtrlPan\\Panel8bu.CEL", NULL); for (i = 0; i < sizeof(panbtn) / sizeof(panbtn[0]); i++) - panbtn[i] = 0; + panbtn[i] = FALSE; panbtndown = FALSE; if (gbMaxPlayers == 1) numpanbtns = 6; @@ -773,7 +796,7 @@ void InitControlPan() numpanbtns = 8; pChrButtons = LoadFileInMem("Data\\CharBut.CEL", NULL); for (i = 0; i < sizeof(chrbtn) / sizeof(chrbtn[0]); i++) - chrbtn[i] = 0; + chrbtn[i] = FALSE; chrbtnactive = FALSE; pDurIcons = LoadFileInMem("Items\\DurIcons.CEL", NULL); strcpy(infostr, ""); @@ -823,7 +846,7 @@ void DrawCtrlBtns() if (!panbtn[i]) DrawPanelBox(PanBtnPos[i][0] - PANEL_LEFT, PanBtnPos[i][1] - (PANEL_TOP - 16), 71, 20, PanBtnPos[i][0] + SCREEN_X, PanBtnPos[i][1] + SCREEN_Y); else - CelDraw(PanBtnPos[i][0] + SCREEN_X, PanBtnPos[i][1] + (PANEL_Y - 334), pPanelButtons, i + 1, 71); + CelDraw(PanBtnPos[i][0] + SCREEN_X, PanBtnPos[i][1] + SCREEN_Y + 18, pPanelButtons, i + 1, 71); } if (numpanbtns == 8) { CelDraw(87 + PANEL_X, 122 + PANEL_Y, pMultiBtns, panbtn[6] + 1, 33); @@ -844,10 +867,10 @@ void DoSpeedBook() int xo, yo, X, Y, i, j; spselflag = TRUE; - xo = PANEL_X + 12 + 56 * 10; + xo = PANEL_X + 12 + SPLICONLENGTH * 10; yo = PANEL_Y - 17; - X = PANEL_LEFT + 12 + 56 * 10 + 56 / 2; - Y = PANEL_TOP - 17 - 56 / 2; + X = xo - (BORDER_LEFT - SPLICONLENGTH / 2); + Y = yo - (BORDER_TOP + SPLICONLENGTH / 2); if (plr[myplr]._pRSpell != SPL_INVALID) { for (i = 0; i < 4; i++) { switch (i) { @@ -868,22 +891,22 @@ void DoSpeedBook() for (j = 1; j < MAX_SPELLS; j++) { if (spell & spells) { if (j == plr[myplr]._pRSpell && i == plr[myplr]._pRSplType) { - X = xo - (BORDER_LEFT - 56 / 2); - Y = yo - (BORDER_TOP + 56 / 2); + X = xo - (BORDER_LEFT - SPLICONLENGTH / 2); + Y = yo - (BORDER_TOP + SPLICONLENGTH / 2); } - xo -= 56; - if (xo == PANEL_X + 12 - 56) { - xo = PANEL_X + 12 + 56 * 10; - yo -= 56; + xo -= SPLICONLENGTH; + if (xo == PANEL_X + 12 - SPLICONLENGTH) { + xo = PANEL_X + 12 + SPLICONLENGTH * SPLROWICONLS; + yo -= SPLICONLENGTH; } } spell <<= (__int64)1; } - if (spells && xo != PANEL_X + 12 + 56 * 10) - xo -= 56; - if (xo == PANEL_X + 12 - 56) { - xo = PANEL_X + 12 + 56 * 10; - yo -= 56; + if (spells && xo != PANEL_X + 12 + SPLICONLENGTH * SPLROWICONLS) + xo -= SPLICONLENGTH; + if (xo == PANEL_X + 12 - SPLICONLENGTH) { + xo = PANEL_X + 12 + SPLICONLENGTH * SPLROWICONLS; + yo -= SPLICONLENGTH; } } } @@ -901,7 +924,7 @@ void DoPanBtn() for (i = 0; i < numpanbtns; i++) { if (MouseX >= PanBtnPos[i][0] && MouseX <= PanBtnPos[i][0] + PanBtnPos[i][2]) { if (MouseY >= PanBtnPos[i][1] && MouseY <= PanBtnPos[i][1] + PanBtnPos[i][3]) { - panbtn[i] = 1; + panbtn[i] = TRUE; drawbtnflag = TRUE; panbtndown = TRUE; } @@ -915,7 +938,7 @@ void DoPanBtn() void control_set_button_down(int btn_id) { - panbtn[btn_id] = 1; + panbtn[btn_id] = TRUE; drawbtnflag = TRUE; panbtndown = TRUE; } @@ -938,7 +961,7 @@ void control_check_btn_press() void DoAutoMap() { - if (currlevel || gbMaxPlayers != 1) { + if (currlevel != 0 || gbMaxPlayers != 1) { if (!automapflag) StartAutomap(); else @@ -970,7 +993,7 @@ void CheckPanelInfo() else strcpy(infostr, "Player attack"); } - if (PanBtnHotKey[i]) { + if (PanBtnHotKey[i] != NULL) { sprintf(tempstr, "Hotkey : %s", PanBtnHotKey[i]); AddPanelString(tempstr, TRUE); } @@ -999,7 +1022,7 @@ void CheckPanelInfo() c = plr[myplr]._pISplLvlAdd + plr[myplr]._pSplLvl[v]; if (c < 0) c = 0; - if (!c) + if (c == 0) sprintf(tempstr, "Spell Level 0 - Unusable"); else sprintf(tempstr, "Spell Level %i", c); @@ -1052,9 +1075,9 @@ void CheckPanelInfo() void CheckBtnUp() { int i; - char gamemenuOff; + BOOLEAN gamemenuOff; - gamemenuOff = 1; + gamemenuOff = TRUE; drawbtnflag = TRUE; panbtndown = FALSE; @@ -1063,7 +1086,7 @@ void CheckBtnUp() continue; } - panbtn[i] = 0; + panbtn[i] = FALSE; if (MouseX < PanBtnPos[i][0] || MouseX > PanBtnPos[i][0] + PanBtnPos[i][2] @@ -1090,11 +1113,11 @@ void CheckBtnUp() case PANBTN_MAINMENU: qtextflag = FALSE; gamemenu_handle_previous(); - gamemenuOff = 0; + gamemenuOff = FALSE; break; case PANBTN_INVENTORY: sbookflag = FALSE; - invflag = invflag == 0; + invflag = !invflag; if (dropGoldFlag) { dropGoldFlag = FALSE; dropGoldValue = 0; @@ -1115,7 +1138,7 @@ void CheckBtnUp() control_type_message(); break; case PANBTN_FRIENDLY: - FriendlyMode = FriendlyMode == 0; + FriendlyMode = !FriendlyMode; break; } } @@ -1179,7 +1202,7 @@ void DrawInfoBox() } else if (pcurs >= CURSOR_FIRSTITEM) { if (plr[myplr].HoldItem._itype == ITYPE_GOLD) { nGold = plr[myplr].HoldItem._ivalue; - sprintf(infostr, "%i gold %s", nGold, get_pieces_str(plr[myplr].HoldItem._ivalue)); + sprintf(infostr, "%i gold %s", nGold, get_pieces_str(nGold)); } else if (!plr[myplr].HoldItem._iStatFlag) { ClearPanel(); AddPanelString("Requirements not met", TRUE); @@ -1204,7 +1227,7 @@ void DrawInfoBox() infoclr = COL_WHITE; strcpy(infostr, monster[pcursmonst].mName); ClearPanel(); - if (monster[pcursmonst]._uniqtype) { + if (monster[pcursmonst]._uniqtype != 0) { infoclr = COL_GOLD; PrintUniqueHistory(); } else { @@ -1224,7 +1247,7 @@ void DrawInfoBox() AddPanelString(tempstr, TRUE); } } - if (infostr[0] || pnumlines) + if (infostr[0] != '\0' || pnumlines != 0) PrintInfo(); } @@ -1235,7 +1258,7 @@ void PrintInfo() if (!talkflag) { yo = 0; lo = 1; - if (infostr[0]) { + if (infostr[0] != '\0') { CPrintString(0, infostr, TRUE, pnumlines); yo = 1; lo = 0; @@ -1308,7 +1331,7 @@ void DrawChr() ADD_PlrStringXY(168, 32, 299, "Warrior", COL_WHITE); #ifndef SPAWN } else if (plr[myplr]._pClass == PC_ROGUE) { - ADD_PlrStringXY(168, 32, 299, "Rogue", COL_WHITE); /* should use ClassStrTbl ? */ + ADD_PlrStringXY(168, 32, 299, "Rogue", COL_WHITE); } else if (plr[myplr]._pClass == PC_SORCERER) { ADD_PlrStringXY(168, 32, 299, "Sorceror", COL_WHITE); #endif @@ -1382,7 +1405,7 @@ void DrawChr() MY_PlrStringXY(258, 239, 301, chrstr, col, 0); col = plr[myplr]._pMagResist == 0 ? COL_WHITE : COL_BLUE; - if (plr[myplr]._pMagResist < 75) { + if (plr[myplr]._pMagResist < MAXRESIST) { sprintf(chrstr, "%i%%", plr[myplr]._pMagResist); } else { col = COL_GOLD; @@ -1391,7 +1414,7 @@ void DrawChr() ADD_PlrStringXY(257, 276, 300, chrstr, col); col = plr[myplr]._pFireResist == 0 ? COL_WHITE : COL_BLUE; - if (plr[myplr]._pFireResist < 75) { + if (plr[myplr]._pFireResist < MAXRESIST) { sprintf(chrstr, "%i%%", plr[myplr]._pFireResist); } else { col = COL_GOLD; @@ -1400,7 +1423,7 @@ void DrawChr() ADD_PlrStringXY(257, 304, 300, chrstr, col); col = plr[myplr]._pLghtResist == 0 ? COL_WHITE : COL_BLUE; - if (plr[myplr]._pLghtResist < 75) { + if (plr[myplr]._pLghtResist < MAXRESIST) { sprintf(chrstr, "%i%%", plr[myplr]._pLghtResist); } else { col = COL_GOLD; @@ -1595,7 +1618,7 @@ void CheckChrBtns() && MouseX <= ChrBtnsRect[i].x + ChrBtnsRect[i].w && MouseY >= ChrBtnsRect[i].y && MouseY <= ChrBtnsRect[i].y + ChrBtnsRect[i].h) { - chrbtn[i] = 1; + chrbtn[i] = TRUE; chrbtnactive = TRUE; } } @@ -1609,7 +1632,7 @@ void ReleaseChrBtns() chrbtnactive = FALSE; for (i = 0; i < 4; ++i) { if (chrbtn[i]) { - chrbtn[i] = 0; + chrbtn[i] = FALSE; if (MouseX >= ChrBtnsRect[i].x && MouseX <= ChrBtnsRect[i].x + ChrBtnsRect[i].w && MouseY >= ChrBtnsRect[i].y @@ -1643,7 +1666,7 @@ void DrawDurIcon() int x1, x2, x3, x4; if (!chrflag && !questlog || !invflag && !sbookflag) { - x1 = 592 + PANEL_X; + x1 = 272 + RIGHT_PANEL_X; if (invflag || sbookflag) x1 = 272 + PANEL_X; p = &plr[myplr]; @@ -1695,7 +1718,7 @@ void RedBack() idx = light4flag ? 1536 : 4608; - /// ASSERT: assert(gpBuffer); + assert(gpBuffer); int w, h; BYTE *dst, *tbl; @@ -1768,7 +1791,7 @@ void DrawSpellBook() DrawSpellCel(RIGHT_PANEL + 75, yp, pSBkIconCels, SpellITbl[sn], 37); if (sn == plr[myplr]._pRSpell && st == plr[myplr]._pRSplType) { SetSpellTrans(RSPLTYPE_SKILL); - DrawSpellCel(RIGHT_PANEL + 75, yp, pSBkIconCels, 43, 37); + DrawSpellCel(RIGHT_PANEL + 75, yp, pSBkIconCels, SPLICONLAST, 37); } PrintSBookStr(10, yp - 23, FALSE, spelldata[sn].sNameText, COL_WHITE); switch (GetSBookTrans(sn, FALSE)) { diff --git a/Source/control.h b/Source/control.h index e62b01a35..65e3be261 100644 --- a/Source/control.h +++ b/Source/control.h @@ -10,8 +10,8 @@ extern BYTE *pDurIcons; extern BYTE *pChrButtons; extern BOOL drawhpflag; extern BOOL dropGoldFlag; -extern int panbtn[8]; -extern int chrbtn[4]; +extern BOOL panbtn[8]; +extern BOOL chrbtn[4]; extern BYTE *pMultiBtns; extern BYTE *pPanelButtons; extern BYTE *pChrPanel; diff --git a/Source/dead.cpp b/Source/dead.cpp index 1d612b409..1dcdbfe45 100644 --- a/Source/dead.cpp +++ b/Source/dead.cpp @@ -14,11 +14,8 @@ int stonendx; void InitDead() { + int i, d, nd, mi; int mtypes[MAXMONSTERS]; - int i; - int nd; - int mi; - int d; for (i = 0; i < MAXMONSTERS; i++) mtypes[i] = 0; @@ -26,7 +23,7 @@ void InitDead() nd = 0; for (i = 0; i < nummtypes; i++) { - if (!mtypes[Monsters[i].mtype]) { + if (mtypes[Monsters[i].mtype] == 0) { for (d = 0; d < 8; d++) dead[nd]._deadData[d] = Monsters[i].Anims[MA_DEATH].Data[d]; dead[nd]._deadFrame = Monsters[i].Anims[MA_DEATH].Frames; @@ -59,7 +56,7 @@ void InitDead() for (i = 0; i < nummonsters; i++) { mi = monstactive[i]; - if (monster[mi]._uniqtype) { + if (monster[mi]._uniqtype != 0) { for (d = 0; d < 8; d++) dead[nd]._deadData[d] = monster[mi].MType->Anims[MA_DEATH].Data[d]; dead[nd]._deadFrame = monster[mi].MType->Anims[MA_DEATH].Frames; @@ -71,7 +68,7 @@ void InitDead() } } - /// ASSERT: assert(nd <= MAXDEAD); + assert(nd <= MAXDEAD); } void AddDead(int dx, int dy, char dv, int ddir) @@ -81,13 +78,12 @@ void AddDead(int dx, int dy, char dv, int ddir) void SetDead() { - int mi; - int i; + int i, mi; int dx, dy; for (i = 0; i < nummonsters; i++) { mi = monstactive[i]; - if (monster[mi]._uniqtype) { + if (monster[mi]._uniqtype != 0) { for (dx = 0; dx < MAXDUNX; dx++) { for (dy = 0; dy < MAXDUNY; dy++) { if ((dDead[dx][dy] & 0x1F) == monster[mi]._udeadval) diff --git a/Source/debug.cpp b/Source/debug.cpp index 1a3225de4..deeb8316a 100644 --- a/Source/debug.cpp +++ b/Source/debug.cpp @@ -11,9 +11,10 @@ DEVILUTION_BEGIN_NAMESPACE BOOL update_seed_check = FALSE; #endif +#define DEBUGSEEDS 4096 int seed_index; -int level_seeds[NUMLEVELS]; -int seed_table[4096]; +int level_seeds[NUMLEVELS + 1]; +int seed_table[DEBUGSEEDS]; BYTE *pSquareCel; char dMonsDbg[NUMLEVELS][MAXDUNX][MAXDUNY]; @@ -36,9 +37,9 @@ void CheckDungeonClear() for (j = 0; j < MAXDUNY; j++) { for (i = 0; i < MAXDUNX; i++) { - if (dMonster[i][j]) + if (dMonster[i][j] != 0) app_fatal("Monsters not cleared"); - if (dPlayer[i][j]) + if (dPlayer[i][j] != 0) app_fatal("Players not cleared"); dMonsDbg[currlevel][i][j] = dFlags[i][j] & BFLAG_VISIBLE; @@ -214,7 +215,7 @@ void GetDebugMonster() mi1 = pcursmonst; if (mi1 == -1) { mi2 = dMonster[cursmx][cursmy]; - if (mi2) { + if (mi2 != 0) { mi1 = mi2 - 1; if (mi2 <= 0) mi1 = -1 - mi2; @@ -229,7 +230,8 @@ void NextDebugMonster() { char dstr[128]; - if (dbgmon++ == MAXMONSTERS) + dbgmon++; + if (dbgmon == MAXMONSTERS) dbgmon = 0; sprintf(dstr, "Current debug monster = %i", dbgmon); diff --git a/Source/diablo.cpp b/Source/diablo.cpp index ffaeaaa03..b8ffa8560 100644 --- a/Source/diablo.cpp +++ b/Source/diablo.cpp @@ -10,7 +10,7 @@ DEVILUTION_BEGIN_NAMESPACE -HWND ghMainWnd; +SDL_Window *ghMainWnd; int glMid1Seed[NUMLEVELS]; int glMid2Seed[NUMLEVELS]; int gnLevelTypeTbl[NUMLEVELS]; @@ -45,6 +45,10 @@ int color_cycle_timer; /* rdata */ +/** + * Specifies whether to give the game exclusive access to the + * screen, as needed for efficient rendering in fullscreen mode. + */ BOOL fullscreen = TRUE; int showintrodebug = 1; #ifdef _DEBUG @@ -64,6 +68,7 @@ int frameflag; int frameend; int framerate; int framestart; +/** Specifies whether players are in non-PvP mode. */ BOOL FriendlyMode = TRUE; /** Default quick messages */ char *spszMsgTbl[4] = { @@ -164,7 +169,7 @@ void run_game_loop(unsigned int uMsg) nthread_ignore_mutex(TRUE); start_game(uMsg); - /// ASSERT: assert(ghMainWnd); + assert(ghMainWnd); saveProc = SetWindowProc(GM_Game); control_update_life_mana(); run_delta_info(); @@ -213,7 +218,7 @@ void run_game_loop(unsigned int uMsg) force_redraw = 255; scrollrt_draw_game_screen(TRUE); saveProc = SetWindowProc(saveProc); - /// ASSERT: assert(saveProc == GM_Game); + assert(saveProc == GM_Game); free_game(); if (cineflag) { @@ -229,12 +234,12 @@ void start_game(unsigned int uMsg) InitCursor(); InitLightTable(); LoadDebugGFX(); - /// ASSERT: assert(ghMainWnd); + assert(ghMainWnd); music_stop(); ShowProgress(uMsg); gmenu_init_menu(); InitLevelCursor(); - sgnTimeoutCurs = 0; + sgnTimeoutCurs = CURSOR_NONE; sgbMouseDown = 0; track_repeat_walk(FALSE); } @@ -788,7 +793,7 @@ void RightMouseDown() || (!sbookflag || MouseX <= RIGHT_PANEL) && !TryIconCurs() && (pcursinvitem == -1 || !UseInvItem(myplr, pcursinvitem))) { - if (pcurs == 1) { + if (pcurs == CURSOR_HAND) { if (pcursinvitem == -1 || !UseInvItem(myplr, pcursinvitem)) CheckPlrSpell(); } else if (pcurs > CURSOR_HAND && pcurs < CURSOR_FIRSTITEM) { @@ -1049,7 +1054,9 @@ void diablo_pause_game() } } -/* NOTE: `return` must be used instead of `break` to be bin exact as C++ */ +/** + * @internal `return` must be used instead of `break` to be bin exact as C++ + */ void PressChar(int vkey) { if (gmenu_is_active() || control_talk_last_key(vkey) || sgnTimeoutCurs != 0 || deathflag) { @@ -1084,7 +1091,7 @@ void PressChar(int vkey) case 'i': if (!stextflag) { sbookflag = FALSE; - invflag = invflag == 0; + invflag = !invflag; if (!invflag || chrflag) { if (MouseX < 480 && MouseY < PANEL_TOP && PANELS_COVER) { SetCursorPos(MouseX + 160, MouseY); diff --git a/Source/diablo.h b/Source/diablo.h index 1e9b62cff..eee31b176 100644 --- a/Source/diablo.h +++ b/Source/diablo.h @@ -6,7 +6,7 @@ #ifndef __DIABLO_H__ #define __DIABLO_H__ -extern HWND ghMainWnd; +extern SDL_Window *ghMainWnd; extern int glMid1Seed[NUMLEVELS]; extern int glMid2Seed[NUMLEVELS]; extern int gnLevelTypeTbl[NUMLEVELS]; diff --git a/Source/drlg_l3.cpp b/Source/drlg_l3.cpp index ca301b412..6a72f570b 100644 --- a/Source/drlg_l3.cpp +++ b/Source/drlg_l3.cpp @@ -1748,7 +1748,7 @@ void LoadL3Dungeon(char *sFileName, int vx, int vy) } } - abyssx = 112; + abyssx = MAXDUNX; // Unused DRLG_L3Pass3(); DRLG_Init_Globals(); ViewX = 31; diff --git a/Source/effects.cpp b/Source/effects.cpp index 478d59399..c0e683d89 100644 --- a/Source/effects.cpp +++ b/Source/effects.cpp @@ -11,7 +11,9 @@ DEVILUTION_BEGIN_NAMESPACE int sfxdelay; int sfxdnum; +/** A handle to the current sound effect playing. */ HANDLE sghStream; +/** Specifies the sound file and the playback state of the current sound effect. */ TSFX *sgpStreamSFX; /** diff --git a/Source/gamemenu.cpp b/Source/gamemenu.cpp index a66bfdedd..e84315d73 100644 --- a/Source/gamemenu.cpp +++ b/Source/gamemenu.cpp @@ -7,6 +7,7 @@ DEVILUTION_BEGIN_NAMESPACE +/** Contains the game menu items of the single player menu. */ TMenuItem sgSingleMenu[6] = { // clang-format off // dwFlags, pszStr, fnMenu @@ -18,6 +19,7 @@ TMenuItem sgSingleMenu[6] = { { GMENU_ENABLED, NULL, NULL } // clang-format on }; +/** Contains the game menu items of the multi player menu. */ TMenuItem sgMultiMenu[5] = { // clang-format off // dwFlags, pszStr, fnMenu @@ -39,8 +41,11 @@ TMenuItem sgOptionsMenu[6] = { { GMENU_ENABLED , NULL, NULL } // clang-format on }; +/** Specifies the menu names for music enabled and disabled. */ char *music_toggle_names[] = { "Music", "Music Disabled" }; +/** Specifies the menu names for sound enabled and disabled. */ char *sound_toggle_names[] = { "Sound", "Sound Disabled" }; +/** Specifies the menu names for colour cycling disabled and enabled. */ char *color_cycling_toggle_names[] = { "Color Cycling Off", "Color Cycling On" }; void gamemenu_on() diff --git a/Source/gmenu.cpp b/Source/gmenu.cpp index 32e0e35ea..a317d69ea 100644 --- a/Source/gmenu.cpp +++ b/Source/gmenu.cpp @@ -36,7 +36,8 @@ const BYTE lfontframe[127] = { 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 20, 0, 21, 0 }; -/* Maps from bigtgold.cel frame number to character width. */ + +/** Maps from bigtgold.cel frame number to character width. */ const BYTE lfontkern[56] = { 18, 33, 21, 26, 28, 19, 19, 26, 25, 11, 12, 25, 19, 34, 28, 32, 20, 32, 28, 20, @@ -81,7 +82,7 @@ void FreeGMenu() void gmenu_init_menu() { PentSpin_frame = 1; - sgpCurrentMenu = 0; + sgpCurrentMenu = NULL; sgpCurrItem = 0; dword_63447C = 0; sgCurrentMenuIdx = 0; @@ -95,7 +96,7 @@ void gmenu_init_menu() BOOL gmenu_is_active() { - return sgpCurrentMenu != 0; + return sgpCurrentMenu != NULL; } void gmenu_set_items(TMenuItem *pItem, void (*gmFunc)(TMenuItem *)) diff --git a/Source/inv.cpp b/Source/inv.cpp index b7b523611..8ae1f2018 100644 --- a/Source/inv.cpp +++ b/Source/inv.cpp @@ -12,6 +12,22 @@ BYTE *pInvCels; BOOL drawsbarflag; int sgdwLastTime; // check name +/** + * Maps from inventory slot to screen position. The inventory slots are + * arranged as follows: + * 00 01 + * 02 03 06 + * 07 08 19 20 13 14 + * 09 10 21 22 15 16 + * 11 12 23 24 17 18 + * 04 05 + * 25 26 27 28 29 30 31 32 33 34 + * 35 36 37 38 39 40 41 42 43 44 + * 45 46 47 48 49 50 51 52 53 54 + * 55 56 57 58 59 60 61 62 63 64 + * 65 66 67 68 69 70 71 72 + * @see graphics/inv/inventory.png + */ const InvXY InvRect[73] = { // clang-format off // X, Y @@ -92,7 +108,7 @@ const InvXY InvRect[73] = { }; /* data */ - +/** Specifies the starting inventory slots for placement of 2x2 items. */ int AP2x2Tbl[10] = { 8, 28, 6, 26, 4, 24, 2, 22, 0, 20 }; void FreeInvGFX() @@ -2086,7 +2102,7 @@ BOOL UseInvItem(int pnum, int cii) if (plr[pnum]._pInvincible && !plr[pnum]._pHitPoints && pnum == myplr) return TRUE; - if (pcurs != 1) + if (pcurs != CURSOR_HAND) return TRUE; if (stextflag) return TRUE; diff --git a/Source/itemdat.cpp b/Source/itemdat.cpp index 897d86ce1..e7d599bc1 100644 --- a/Source/itemdat.cpp +++ b/Source/itemdat.cpp @@ -7,6 +7,7 @@ DEVILUTION_BEGIN_NAMESPACE +/** Contains the data related to each item ID. */ ItemDataStruct AllItemsList[] = { // clang-format off // iRnd, iClass, iLoc, iCurs, itype, iItemId, iName, iSName, iMinMLvl, iDurability, iMinDam, iMaxDam, iMinAC, iMaxAC, iMinStr, iMinMag, iMinDex, iFlags, iMiscId, iSpell, iUsable, iValue, iMaxValue @@ -170,6 +171,7 @@ ItemDataStruct AllItemsList[] = { // clang-format on }; +/** Contains the data related to each item prefix. */ const PLStruct PL_Prefix[] = { // clang-format off // PLName, PLPower, PLParam1, PLParam2, PLMinLvl, PLIType, PLGOE, PLDouble, PLOk, PLMinVal, PLMaxVal, PLMultVal @@ -260,6 +262,7 @@ const PLStruct PL_Prefix[] = { // clang-format on }; +/** Contains the data related to each item suffix. */ const PLStruct PL_Suffix[] = { // clang-format off // PLName, PLPower, PLParam1, PLParam2, PLMinLvl, PLIType, PLGOE, PLDouble, PLOk, PLMinVal, PLMaxVal, PLMultVal @@ -362,6 +365,7 @@ const PLStruct PL_Suffix[] = { // clang-format on }; +/** Contains the data related to each unique item ID. */ const UItemStruct UniqueItemList[] = { // clang-format off // UIName, UIItemId, UIMinLvl, UINumPL, UIValue, UIPower1, UIParam1, UIParam2, UIPower2, UIParam3, UIParam4, UIPower3, UIParam5, UIParam6, UIPower4, UIParam7, UIParam8, UIPower5, UIParam9, UIParam10, UIPower6, UIParam11, UIParam12 diff --git a/Source/minitext.cpp b/Source/minitext.cpp index 28a563b24..cbb264145 100644 --- a/Source/minitext.cpp +++ b/Source/minitext.cpp @@ -16,6 +16,7 @@ int sgLastScroll; BYTE *pMedTextCels; BYTE *pTextBoxCels; +/** Maps from font index to medtexts.cel frame number. */ const BYTE mfontframe[127] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, @@ -31,6 +32,11 @@ const BYTE mfontframe[127] = { 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 48, 0, 49, 0 }; +/** + * Maps from medtexts.cel frame number to character width. Note, the + * character width may be distinct from the frame width, which is 22 for every + * medtexts.cel frame. + */ const BYTE mfontkern[56] = { 5, 15, 10, 13, 14, 10, 9, 13, 11, 5, 5, 11, 10, 16, 13, 16, 10, 15, 12, 10, @@ -43,7 +49,8 @@ const BYTE mfontkern[56] = { /* data */ /** - * Positive numbers will delay scrolling 1 out of n frames, negative numbers will scroll 1+(-n) pixels. + * Text scroll speeds. Positive numbers will delay scrolling 1 out of n frames, + * negative numbers will scroll 1+(-n) pixels. */ int qscroll_spd_tbl[9] = { 2, 4, 6, 8, 0, -1, -2, -3, -4 }; diff --git a/Source/missiles.cpp b/Source/missiles.cpp index c6ace3f84..67dd07445 100644 --- a/Source/missiles.cpp +++ b/Source/missiles.cpp @@ -2389,7 +2389,7 @@ void AddResurrectBeam(int mi, int sx, int sy, int dx, int dy, int midir, char mi missile[mi]._misy = missile[mi]._miy; missile[mi]._mixvel = 0; missile[mi]._miyvel = 0; - missile[mi]._mirange = misfiledata[36].mAnimLen[0]; + missile[mi]._mirange = misfiledata[MFILE_RESSUR1].mAnimLen[0]; } void AddTelekinesis(int mi, int sx, int sy, int dx, int dy, int midir, char mienemy, int id, int dam) diff --git a/Source/msg.cpp b/Source/msg.cpp index c9dc902c9..4b11588dd 100644 --- a/Source/msg.cpp +++ b/Source/msg.cpp @@ -81,7 +81,7 @@ BOOL msg_wait_resync() sgbRecvCmd = CMD_DLEVEL_END; gbBufferMsgs = 1; sgdwOwnerWait = SDL_GetTicks(); - success = UiProgressDialog(ghMainWnd, "Waiting for game data...", 1, msg_wait_for_turns, 20); + success = UiProgressDialog("Waiting for game data...", 1, msg_wait_for_turns, 20); gbBufferMsgs = 0; if (!success) { msg_free_packets(); @@ -1262,7 +1262,7 @@ void DeltaImportJunk(BYTE *src) if (*src == 0xFF) { memset(&sgJunk.portal[i], 0xFF, sizeof(DPortal)); src++; - SetPortalStats(i, FALSE, 0, 0, 0, 0); + SetPortalStats(i, FALSE, 0, 0, 0, DTYPE_TOWN); } else { memcpy(&sgJunk.portal[i], src, sizeof(DPortal)); src += sizeof(DPortal); diff --git a/Source/multi.cpp b/Source/multi.cpp index 174a39519..4256241f2 100644 --- a/Source/multi.cpp +++ b/Source/multi.cpp @@ -27,6 +27,10 @@ int sglTimeoutStart; int sgdwPlayerLeftReasonTbl[MAX_PLRS]; TBuffer sgLoPriBuf; DWORD sgdwGameLoops; +/** + * Specifies the maximum number of players in a game, where 1 + * represents a single player game and 4 represents a multi player game. + */ BYTE gbMaxPlayers; BOOLEAN sgbTimeout; char szPlayerName[128]; @@ -34,6 +38,10 @@ BYTE gbDeltaSender; BOOL sgbNetInited; int player_state[MAX_PLRS]; +/** + * Contains the set of supported event types supported by the multiplayer + * event handler. + */ const int event_types[3] = { EVENT_TYPE_PLAYER_LEAVE_GAME, EVENT_TYPE_PLAYER_CREATE_GAME, diff --git a/Source/objdat.cpp b/Source/objdat.cpp index ae3a14f0b..f332fdfe7 100644 --- a/Source/objdat.cpp +++ b/Source/objdat.cpp @@ -2,6 +2,7 @@ DEVILUTION_BEGIN_NAMESPACE +/** Maps from dun_object_id to object_id. */ int ObjTypeConv[113] = { 0, 4, @@ -118,113 +119,114 @@ int ObjTypeConv[113] = { 94 }; +/** Contains the data related to each object ID. */ ObjDataStruct AllObjects[99] = { // clang-format off - // oload, ofindex, ominlvl, omaxlvl, olvltype, otheme, oquest, oAnimFlag, oAnimDelay, oAnimLen, oAnimWidth, oSolidFlag, oMissFlag, oLightFlag, oBreak, oSelFlag, oTrapFlag - { 1, OFILE_L1BRAZ, 1, 4, 1, THEME_NONE, -1, 1, 1, 26, 64, TRUE, TRUE, FALSE, 0, 0, FALSE }, - { 1, OFILE_L1DOORS, 1, 4, 1, THEME_NONE, -1, 0, 1, 0, 64, FALSE, FALSE, TRUE, 0, 3, TRUE }, - { 1, OFILE_L1DOORS, 1, 4, 1, THEME_NONE, -1, 0, 2, 0, 64, FALSE, FALSE, TRUE, 0, 3, TRUE }, - { 3, OFILE_SKULFIRE, 0, 0, 0, THEME_SKELROOM, -1, 1, 2, 11, 96, TRUE, TRUE, FALSE, 0, 0, FALSE }, - { 1, OFILE_LEVER, 1, 4, 1, THEME_NONE, -1, 0, 1, 1, 96, TRUE, TRUE, TRUE, 0, 1, TRUE }, - { 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, 6, 0, 1, 0, 128, TRUE, FALSE, TRUE, 0, 0, FALSE }, - { 1, OFILE_TNUDEM, 13, 16, 0, THEME_TORTURE, 6, 0, 2, 0, 128, TRUE, FALSE, TRUE, 0, 0, FALSE }, - { 1, OFILE_TNUDEM, 13, 16, 0, THEME_TORTURE, 6, 0, 3, 0, 128, TRUE, FALSE, TRUE, 0, 0, FALSE }, - { 1, OFILE_TNUDEM, 13, 16, 0, THEME_TORTURE, 6, 0, 4, 0, 128, TRUE, FALSE, TRUE, 0, 0, FALSE }, - { 1, OFILE_TNUDEW, 13, 16, 0, THEME_TORTURE, 6, 0, 1, 0, 128, TRUE, FALSE, TRUE, 0, 0, FALSE }, - { 1, OFILE_TNUDEW, 13, 16, 0, THEME_TORTURE, 6, 0, 2, 0, 128, TRUE, FALSE, TRUE, 0, 0, FALSE }, - { 1, OFILE_TNUDEW, 13, 16, 0, THEME_TORTURE, 6, 0, 3, 0, 128, TRUE, FALSE, TRUE, 0, 0, FALSE }, - { 1, OFILE_TSOUL, 13, 16, 0, THEME_NONE, 6, 0, 1, 0, 128, TRUE, FALSE, TRUE, 0, 0, FALSE }, - { 1, OFILE_TSOUL, 13, 16, 0, THEME_NONE, 6, 0, 2, 0, 128, TRUE, FALSE, TRUE, 0, 0, FALSE }, - { 1, OFILE_TSOUL, 13, 16, 0, THEME_NONE, 6, 0, 3, 0, 128, TRUE, FALSE, TRUE, 0, 0, FALSE }, - { 1, OFILE_TSOUL, 13, 16, 0, THEME_NONE, 6, 0, 4, 0, 128, TRUE, FALSE, TRUE, 0, 0, FALSE }, - { 1, OFILE_TSOUL, 13, 16, 0, THEME_NONE, 6, 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, 2, THEME_NONE, -1, 0, 1, 0, 64, FALSE, FALSE, TRUE, 0, 3, TRUE }, - { 1, OFILE_L2DOORS, 5, 8, 2, THEME_NONE, -1, 0, 2, 0, 64, FALSE, FALSE, TRUE, 0, 3, FALSE }, - { 1, OFILE_WTORCH4, 5, 8, 2, THEME_NONE, -1, 1, 1, 9, 96, FALSE, TRUE, FALSE, 0, 0, FALSE }, - { 1, OFILE_WTORCH3, 5, 8, 2, THEME_NONE, -1, 1, 1, 9, 96, FALSE, TRUE, FALSE, 0, 0, FALSE }, - { 1, OFILE_WTORCH1, 5, 8, 2, THEME_NONE, -1, 1, 1, 9, 96, FALSE, TRUE, FALSE, 0, 0, FALSE }, - { 1, OFILE_WTORCH2, 5, 8, 2, THEME_NONE, -1, 1, 1, 9, 96, FALSE, TRUE, FALSE, 0, 0, FALSE }, - { 1, OFILE_SARC, 1, 4, 1, THEME_NONE, -1, 0, 1, 5, 128, TRUE, TRUE, TRUE, 0, 3, TRUE }, - { 2, OFILE_FLAME1, 1, 4, 1, THEME_NONE, -1, 0, 1, 20, 96, FALSE, TRUE, TRUE, 0, 0, FALSE }, - { 2, OFILE_LEVER, 1, 4, 1, THEME_NONE, -1, 0, 1, 2, 96, TRUE, TRUE, TRUE, 0, 1, TRUE }, - { 2, OFILE_MINIWATR, 1, 4, 1, THEME_NONE, -1, 1, 1, 10, 64, TRUE, FALSE, TRUE, 0, 0, FALSE }, - { 1, OFILE_BOOK1, 3, 4, 1, THEME_NONE, -1, 0, 1, 0, 96, TRUE, TRUE, TRUE, 0, 3, FALSE }, - { 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, 2, THEME_NONE, 8, 0, 1, 0, 96, TRUE, TRUE, TRUE, 0, 3, FALSE }, - { 1, OFILE_BOOK1, 5, 5, 2, THEME_NONE, 9, 0, 4, 0, 96, TRUE, TRUE, TRUE, 0, 3, FALSE }, - { 1, OFILE_PEDISTL, 5, 5, 2, THEME_NONE, 9, 0, 1, 0, 96, TRUE, TRUE, TRUE, 0, 3, FALSE }, - { 1, OFILE_L3DOORS, 9, 12, 3, THEME_NONE, -1, 0, 1, 0, 64, FALSE, FALSE, TRUE, 0, 3, TRUE }, - { 1, OFILE_L3DOORS, 9, 12, 3, THEME_NONE, -1, 0, 2, 0, 64, FALSE, FALSE, TRUE, 0, 3, TRUE }, - { 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, 1, THEME_NONE, 15, 0, 1, 0, 128, TRUE, TRUE, TRUE, 0, 0, FALSE }, - { 1, OFILE_MCIRL, 0, 0, 1, THEME_NONE, 15, 0, 1, 0, 96, FALSE, TRUE, TRUE, 0, 0, FALSE }, - { 1, OFILE_MCIRL, 0, 0, 1, THEME_NONE, 15, 0, 1, 0, 96, FALSE, 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, 15, 1, 2, 4, 96, TRUE, TRUE, TRUE, 0, 0, FALSE }, - { 1, OFILE_BOOK1, 13, 13, 4, THEME_NONE, 11, 0, 4, 0, 96, TRUE, TRUE, TRUE, 0, 3, FALSE }, - { 1, OFILE_ARMSTAND, 13, 13, 0, THEME_NONE, 11, 0, 1, 0, 96, TRUE, FALSE, TRUE, 0, 3, FALSE }, - { 2, OFILE_WEAPSTND, 13, 13, 0, THEME_NONE, 11, 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, 1, 0, 1, 0, 96, TRUE, TRUE, TRUE, 0, 3, TRUE }, - { 2, OFILE_LZSTAND, 0, 0, 0, THEME_NONE, 15, 0, 1, 0, 128, TRUE, FALSE, TRUE, 0, 3, FALSE }, - { 1, OFILE_DECAP, 9, 9, 3, THEME_NONE, -1, 0, 2, 0, 96, TRUE, TRUE, TRUE, 0, 1, FALSE }, - { 2, OFILE_CHEST3, 0, 0, 0, THEME_NONE, -1, 0, 1, 0, 96, TRUE, TRUE, TRUE, 0, 1, TRUE }, - { -1, 0, 0, 0, -1, THEME_NONE, -1, 0, 0, 0, 0, FALSE, FALSE, FALSE, 0, 0, FALSE } + // oload, ofindex, ominlvl, omaxlvl, olvltype, otheme, oquest, oAnimFlag, oAnimDelay, oAnimLen, oAnimWidth, oSolidFlag, oMissFlag, oLightFlag, oBreak, oSelFlag, oTrapFlag + { 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 }, + { 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, 0, 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_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 }, + { 1, OFILE_WTORCH3, 5, 8, DTYPE_CATACOMBS, THEME_NONE, -1, 1, 1, 9, 96, FALSE, TRUE, FALSE, 0, 0, FALSE }, + { 1, OFILE_WTORCH1, 5, 8, DTYPE_CATACOMBS, THEME_NONE, -1, 1, 1, 9, 96, FALSE, TRUE, FALSE, 0, 0, FALSE }, + { 1, OFILE_WTORCH2, 5, 8, DTYPE_CATACOMBS, THEME_NONE, -1, 1, 1, 9, 96, FALSE, TRUE, FALSE, 0, 0, FALSE }, + { 1, OFILE_SARC, 1, 4, DTYPE_CATHEDRAL, THEME_NONE, -1, 0, 1, 5, 128, TRUE, TRUE, TRUE, 0, 3, TRUE }, + { 2, OFILE_FLAME1, 1, 4, DTYPE_CATHEDRAL, THEME_NONE, -1, 0, 1, 20, 96, FALSE, TRUE, TRUE, 0, 0, FALSE }, + { 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_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 }, + { 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_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_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 }, + { -1, 0, 0, 0, -1, THEME_NONE, -1, 0, 0, 0, 0, FALSE, FALSE, FALSE, 0, 0, FALSE } // clang-format on }; -// might be const -char *ObjMasterLoadList[56] = { +/** Maps from object_graphic_id to object CEL name. */ +char *ObjMasterLoadList[56] = { // might be const "L1Braz", "L1Doors", "Lever", diff --git a/Source/objects.cpp b/Source/objects.cpp index 1aeae7720..c5e153e7c 100644 --- a/Source/objects.cpp +++ b/Source/objects.cpp @@ -836,7 +836,7 @@ void InitObjects() InitRndLocObj(1, 5, 7); if (leveltype != DTYPE_HELL) AddObjTraps(); - if (leveltype > 1) + if (leveltype > DTYPE_CATHEDRAL) AddChestTraps(); InitObjFlag = FALSE; } @@ -4035,7 +4035,7 @@ void BreakCrux(int i) ObjChangeMap(object[i]._oVar1, object[i]._oVar2, object[i]._oVar3, object[i]._oVar4); } -void BreakBarrel(int pnum, int i, int dam, BOOL forcebreak, int sendmsg) +void BreakBarrel(int pnum, int i, int dam, BOOL forcebreak, BOOL sendmsg) { int oi; int xp, yp; @@ -4066,7 +4066,7 @@ void BreakBarrel(int pnum, int i, int dam, BOOL forcebreak, int sendmsg) object[i]._oMissFlag = TRUE; object[i]._oSelFlag = 0; object[i]._oPreFlag = TRUE; - if (deltaload != 0) { + if (deltaload) { object[i]._oAnimCnt = 0; object[i]._oAnimFrame = object[i]._oAnimLen; object[i]._oAnimDelay = 1000; diff --git a/Source/objects.h b/Source/objects.h index 9c2c10f2b..8dc5059d2 100644 --- a/Source/objects.h +++ b/Source/objects.h @@ -139,7 +139,7 @@ void SyncOpL2Door(int pnum, int cmd, int i); void SyncOpL3Door(int pnum, int cmd, int i); void SyncOpObject(int pnum, int cmd, int i); void BreakCrux(int i); -void BreakBarrel(int pnum, int i, int dam, BOOL forcebreak, int sendmsg); +void BreakBarrel(int pnum, int i, int dam, BOOL forcebreak, BOOL sendmsg); void BreakObject(int pnum, int oi); void SyncBreakObj(int pnum, int oi); void SyncL1Doors(int i); diff --git a/Source/pack.cpp b/Source/pack.cpp index 4d404d95a..359e53047 100644 --- a/Source/pack.cpp +++ b/Source/pack.cpp @@ -68,8 +68,8 @@ void PackPlayer(PkPlayerStruct *pPack, int pnum, BOOL manashield) for (i = 0; i < MAX_SPELLS; i++) pPack->pSplLvl[i] = pPlayer->_pSplLvl[i]; - pki = pPack->InvBody; - pi = pPlayer->InvBody; + pki = &pPack->InvBody[0]; + pi = &pPlayer->InvBody[0]; for (i = 0; i < NUM_INVLOC; i++) { PackItem(pki, pi); @@ -77,8 +77,8 @@ void PackPlayer(PkPlayerStruct *pPack, int pnum, BOOL manashield) pi++; } - pki = pPack->InvList; - pi = pPlayer->InvList; + pki = &pPack->InvList[0]; + pi = &pPlayer->InvList[0]; for (i = 0; i < NUM_INV_GRID_ELEM; i++) { PackItem(pki, pi); @@ -90,8 +90,8 @@ void PackPlayer(PkPlayerStruct *pPack, int pnum, BOOL manashield) pPack->InvGrid[i] = pPlayer->InvGrid[i]; pPack->_pNumInv = pPlayer->_pNumInv; - pki = pPack->SpdList; - pi = pPlayer->SpdList; + pki = &pPack->SpdList[0]; + pi = &pPlayer->SpdList[0]; for (i = 0; i < MAXBELTITEMS; i++) { PackItem(pki, pi); @@ -211,8 +211,8 @@ void UnPackPlayer(PkPlayerStruct *pPack, int pnum, BOOL killok) for (i = 0; i < MAX_SPELLS; i++) pPlayer->_pSplLvl[i] = pPack->pSplLvl[i]; - pki = pPack->InvBody; - pi = pPlayer->InvBody; + pki = &pPack->InvBody[0]; + pi = &pPlayer->InvBody[0]; for (i = 0; i < NUM_INVLOC; i++) { UnPackItem(pki, pi); @@ -220,8 +220,8 @@ void UnPackPlayer(PkPlayerStruct *pPack, int pnum, BOOL killok) pi++; } - pki = pPack->InvList; - pi = pPlayer->InvList; + pki = &pPack->InvList[0]; + pi = &pPlayer->InvList[0]; for (i = 0; i < NUM_INV_GRID_ELEM; i++) { UnPackItem(pki, pi); @@ -235,8 +235,8 @@ void UnPackPlayer(PkPlayerStruct *pPack, int pnum, BOOL killok) pPlayer->_pNumInv = pPack->_pNumInv; VerifyGoldSeeds(pPlayer); - pki = pPack->SpdList; - pi = pPlayer->SpdList; + pki = &pPack->SpdList[0]; + pi = &pPlayer->SpdList[0]; for (i = 0; i < MAXBELTITEMS; i++) { UnPackItem(pki, pi); diff --git a/Source/player.cpp b/Source/player.cpp index 10492126a..83933e95b 100644 --- a/Source/player.cpp +++ b/Source/player.cpp @@ -1420,7 +1420,7 @@ void StartWalk3(int pnum, int xvel, int yvel, int xoff, int yoff, int xadd, int plr[pnum]._pxoff = xoff; plr[pnum]._pyoff = yoff; - if (leveltype) { + if (leveltype != DTYPE_TOWN) { ChangeLightXY(plr[pnum]._plid, x, y); PM_ChangeLightOff(pnum); } @@ -3228,7 +3228,7 @@ void CheckNewPath(int pnum) i = plr[pnum].destParam1; x = abs(plr[pnum].WorldX - item[i]._ix); y = abs(plr[pnum].WorldY - item[i]._iy); - if (x <= 1 && y <= 1 && pcurs == 1 && !item[i]._iRequest) { + if (x <= 1 && y <= 1 && pcurs == CURSOR_HAND && !item[i]._iRequest) { NetSendCmdGItem(TRUE, CMD_REQUESTGITEM, myplr, myplr, i); item[i]._iRequest = TRUE; } @@ -3239,7 +3239,7 @@ void CheckNewPath(int pnum) i = plr[pnum].destParam1; x = abs(plr[pnum].WorldX - item[i]._ix); y = abs(plr[pnum].WorldY - item[i]._iy); - if (x <= 1 && y <= 1 && pcurs == 1) { + if (x <= 1 && y <= 1 && pcurs == CURSOR_HAND) { NetSendCmdGItem(TRUE, CMD_REQUESTAGITEM, myplr, myplr, i); } } diff --git a/Source/quests.cpp b/Source/quests.cpp index 1170a1f11..24093f920 100644 --- a/Source/quests.cpp +++ b/Source/quests.cpp @@ -195,7 +195,7 @@ void CheckQuests() && quests[i]._qactive != QUEST_NOTAVAIL && plr[myplr].WorldX == quests[i]._qtx && plr[myplr].WorldY == quests[i]._qty) { - if (quests[i]._qlvltype != 255) { + if (quests[i]._qlvltype != DTYPE_NONE) { setlvltype = quests[i]._qlvltype; } StartNewLvl(myplr, WM_DIABSETLVL, quests[i]._qslvl); diff --git a/Source/scrollrt.cpp b/Source/scrollrt.cpp index 54581d133..602e678c6 100644 --- a/Source/scrollrt.cpp +++ b/Source/scrollrt.cpp @@ -141,7 +141,7 @@ static void scrollrt_draw_cursor_item() assert(! sgdwCursWdt); - if (pcurs <= 0 || cursW == 0 || cursH == 0) { + if (pcurs <= CURSOR_NONE || cursW == 0 || cursH == 0) { return; } diff --git a/Source/scrollrt.h b/Source/scrollrt.h index 1019c2695..7ceca2adc 100644 --- a/Source/scrollrt.h +++ b/Source/scrollrt.h @@ -29,7 +29,7 @@ void DrawAndBlit(); /* data */ -/* used in 1.00 debug */ +/** used in 1.00 debug */ extern char *szMonModeAssert[18]; extern char *szPlrModeAssert[12]; diff --git a/Source/spelldat.cpp b/Source/spelldat.cpp index 264075cee..d2f1d35fe 100644 --- a/Source/spelldat.cpp +++ b/Source/spelldat.cpp @@ -3,46 +3,67 @@ DEVILUTION_BEGIN_NAMESPACE /** Data related to each spell ID. */ -SpellData spelldata[MAX_SPELLS] = { +SpellData spelldata[] = { // clang-format off - // sName, sManaCost, sType, sNameText, sSkillText, sBookLvl, sStaffLvl, sTargeted, sTownSpell, sMinInt, sSFX, sMissiles[3], sManaAdj, sMinMana, sStaffMin, sStaffMax, sBookCost, sStaffCost - { SPL_NULL, 0, 0, NULL, NULL, 0, 0, FALSE, FALSE, 0, 0, { 0, 0, 0 }, 0, 0, 40, 80, 0, 0 }, - { SPL_FIREBOLT, 6, STYPE_FIRE, "Firebolt", "Firebolt", 1, 1, TRUE, FALSE, 15, IS_CAST2, { MIS_FIREBOLT, 0, 0 }, 1, 3, 40, 80, 1000, 50 }, - { SPL_HEAL, 5, STYPE_MAGIC, "Healing", NULL, 1, 1, FALSE, TRUE, 17, IS_CAST8, { MIS_HEAL, 0, 0 }, 3, 1, 20, 40, 1000, 50 }, - { SPL_LIGHTNING, 10, STYPE_LIGHTNING, "Lightning", NULL, 4, 3, TRUE, FALSE, 20, IS_CAST4, { MIS_LIGHTCTRL, 0, 0 }, 1, 6, 20, 60, 3000, 150 }, - { SPL_FLASH, 30, STYPE_LIGHTNING, "Flash", NULL, 5, 4, FALSE, FALSE, 33, IS_CAST4, { MIS_FLASH, MIS_FLASH2, 0 }, 2, 16, 20, 40, 7500, 500 }, - { SPL_IDENTIFY, 13, STYPE_MAGIC, "Identify", "Identify", -1, -1, FALSE, TRUE, 23, IS_CAST6, { MIS_IDENTIFY, 0, 0 }, 2, 1, 8, 12, 0, 100 }, - { SPL_FIREWALL, 28, STYPE_FIRE, "Fire Wall", NULL, 3, 2, TRUE, FALSE, 27, IS_CAST2, { MIS_FIREWALLC, 0, 0 }, 2, 16, 8, 16, 6000, 400 }, - { SPL_TOWN, 35, STYPE_MAGIC, "Town Portal", NULL, 3, 3, TRUE, FALSE, 20, IS_CAST6, { MIS_TOWN, 0, 0 }, 3, 18, 8, 12, 3000, 200 }, - { SPL_STONE, 60, STYPE_MAGIC, "Stone Curse", NULL, 6, 5, TRUE, FALSE, 51, IS_CAST2, { MIS_STONE, 0, 0 }, 3, 40, 8, 16, 12000, 800 }, - { SPL_INFRA, 40, STYPE_MAGIC, "Infravision", NULL, -1, -1, FALSE, FALSE, 36, IS_CAST8, { MIS_INFRA, 0, 0 }, 5, 20, 0, 0, 0, 600 }, - { SPL_RNDTELEPORT, 12, STYPE_MAGIC, "Phasing", NULL, 7, 6, FALSE, FALSE, 39, IS_CAST2, { MIS_RNDTELEPORT, 0, 0 }, 2, 4, 40, 80, 3500, 200 }, - { SPL_MANASHIELD, 33, STYPE_MAGIC, "Mana Shield", NULL, 6, 5, FALSE, FALSE, 25, IS_CAST2, { MIS_MANASHIELD, 0, 0 }, 0, 33, 4, 10, 16000, 1200 }, - { SPL_FIREBALL, 16, STYPE_FIRE, "Fireball", NULL, 8, 7, TRUE, FALSE, 48, IS_CAST2, { MIS_FIREBALL, 0, 0 }, 1, 10, 40, 80, 8000, 300 }, - { SPL_GUARDIAN, 50, STYPE_FIRE, "Guardian", NULL, 9, 8, TRUE, FALSE, 61, IS_CAST2, { MIS_GUARDIAN, 0, 0 }, 2, 30, 16, 32, 14000, 950 }, - { SPL_CHAIN, 30, STYPE_LIGHTNING, "Chain Lightning", NULL, 8, 7, FALSE, FALSE, 54, IS_CAST2, { MIS_CHAIN, 0, 0 }, 1, 18, 20, 60, 11000, 750 }, - { SPL_WAVE, 35, STYPE_FIRE, "Flame Wave", NULL, 9, 8, TRUE, FALSE, 54, IS_CAST2, { MIS_WAVE, 0, 0 }, 3, 20, 20, 40, 10000, 650 }, - { SPL_DOOMSERP, 0, STYPE_LIGHTNING, "Doom Serpents", NULL, -1, -1, FALSE, FALSE, 0, IS_CAST2, { 0, 0, 0 }, 0, 0, 40, 80, 0, 0 }, - { SPL_BLODRIT, 0, STYPE_MAGIC, "Blood Ritual", NULL, -1, -1, FALSE, FALSE, 0, IS_CAST2, { 0, 0, 0 }, 0, 0, 40, 80, 0, 0 }, - { SPL_NOVA, 60, STYPE_MAGIC, "Nova", NULL, -1, 10, FALSE, FALSE, 87, IS_CAST4, { MIS_NOVA, 0, 0 }, 3, 35, 16, 32, 21000, 1300 }, - { SPL_INVISIBIL, 0, STYPE_MAGIC, "Invisibility", NULL, -1, -1, FALSE, FALSE, 0, IS_CAST2, { 0, 0, 0 }, 0, 0, 40, 80, 0, 0 }, - { SPL_FLAME, 11, STYPE_FIRE, "Inferno", NULL, 3, 2, TRUE, FALSE, 20, IS_CAST2, { MIS_FLAMEC, 0, 0 }, 1, 6, 20, 40, 2000, 100 }, - { SPL_GOLEM, 100, STYPE_FIRE, "Golem", NULL, 11, 9, FALSE, FALSE, 81, IS_CAST2, { MIS_GOLEM, 0, 0 }, 6, 60, 16, 32, 18000, 1100 }, - { SPL_BLODBOIL, 0, STYPE_LIGHTNING, "Blood Boil", NULL, -1, -1, TRUE, FALSE, 0, IS_CAST8, { 0, 0, 0 }, 0, 0, 0, 0, 0, 0 }, - { SPL_TELEPORT, 35, STYPE_MAGIC, "Teleport", NULL, 14, 12, TRUE, FALSE, 105, IS_CAST6, { MIS_TELEPORT, 0, 0 }, 3, 15, 16, 32, 20000, 1250 }, - { SPL_APOCA, 150, STYPE_FIRE, "Apocalypse", NULL, -1, 15, FALSE, FALSE, 149, IS_CAST2, { MIS_APOCA, 0, 0 }, 6, 90, 8, 12, 30000, 2000 }, - { SPL_ETHEREALIZE, 100, STYPE_MAGIC, "Etherealize", NULL, -1, -1, FALSE, FALSE, 93, IS_CAST2, { MIS_ETHEREALIZE, 0, 0 }, 0, 100, 2, 6, 26000, 1600 }, - { SPL_REPAIR, 0, STYPE_MAGIC, "Item Repair", "Item Repair", -1, -1, FALSE, TRUE, -1, IS_CAST6, { MIS_REPAIR, 0, 0 }, 0, 0, 40, 80, 0, 0 }, - { SPL_RECHARGE, 0, STYPE_MAGIC, "Staff Recharge", "Staff Recharge", -1, -1, FALSE, TRUE, -1, IS_CAST6, { MIS_RECHARGE, 0, 0 }, 0, 0, 40, 80, 0, 0 }, - { SPL_DISARM, 0, STYPE_MAGIC, "Trap Disarm", "Trap Disarm", -1, -1, FALSE, FALSE, -1, IS_CAST6, { MIS_DISARM, 0, 0 }, 0, 0, 40, 80, 0, 0 }, - { SPL_ELEMENT, 35, STYPE_FIRE, "Elemental", NULL, 8, 6, FALSE, FALSE, 68, IS_CAST2, { MIS_ELEMENT, 0, 0 }, 2, 20, 20, 60, 10500, 700 }, - { SPL_CBOLT, 6, STYPE_LIGHTNING, "Charged Bolt", NULL, 1, 1, TRUE, FALSE, 25, IS_CAST2, { MIS_CBOLT, 0, 0 }, 1, 6, 40, 80, 1000, 50 }, - { SPL_HBOLT, 7, STYPE_MAGIC, "Holy Bolt", NULL, 1, 1, TRUE, FALSE, 20, IS_CAST2, { MIS_HBOLT, 0, 0 }, 1, 3, 40, 80, 1000, 50 }, - { SPL_RESURRECT, 20, STYPE_MAGIC, "Resurrect", NULL, -1, 5, FALSE, TRUE, 30, IS_CAST8, { MIS_RESURRECT, 0, 0 }, 0, 20, 4, 10, 4000, 250 }, - { SPL_TELEKINESIS, 15, STYPE_MAGIC, "Telekinesis", NULL, 2, 2, FALSE, FALSE, 33, IS_CAST2, { MIS_TELEKINESIS, 0, 0 }, 2, 8, 20, 40, 2500, 200 }, - { SPL_HEALOTHER, 5, STYPE_MAGIC, "Heal Other", NULL, 1, 1, FALSE, TRUE, 17, IS_CAST8, { MIS_HEALOTHER, 0, 0 }, 3, 1, 20, 40, 1000, 50 }, - { SPL_FLARE, 25, STYPE_MAGIC, "Blood Star", NULL, 14, 13, FALSE, FALSE, 70, IS_CAST2, { MIS_FLARE, 0, 0 }, 2, 14, 20, 60, 27500, 1800 }, - { SPL_BONESPIRIT, 24, STYPE_MAGIC, "Bone Spirit", NULL, 9, 7, FALSE, FALSE, 34, IS_CAST2, { MIS_BONESPIRIT, 0, 0 }, 1, 12, 20, 60, 11500, 800 }, + // sName, sManaCost, sType, sNameText, sSkillText, sBookLvl, sStaffLvl, sTargeted, sTownSpell, sMinInt, sSFX, sMissiles[3], sManaAdj, sMinMana, sStaffMin, sStaffMax, sBookCost, sStaffCost + { SPL_NULL, 0, 0, NULL, NULL, 0, 0, FALSE, FALSE, 0, 0, { 0, 0, 0 }, 0, 0, 40, 80, 0, 0 }, + { SPL_FIREBOLT, 6, STYPE_FIRE, "Firebolt", "Firebolt", 1, 1, TRUE, FALSE, 15, IS_CAST2, { MIS_FIREBOLT, 0, 0 }, 1, 3, 40, 80, 1000, 50 }, + { SPL_HEAL, 5, STYPE_MAGIC, "Healing", NULL, 1, 1, FALSE, TRUE, 17, IS_CAST8, { MIS_HEAL, 0, 0 }, 3, 1, 20, 40, 1000, 50 }, + { SPL_LIGHTNING, 10, STYPE_LIGHTNING, "Lightning", NULL, 4, 3, TRUE, FALSE, 20, IS_CAST4, { MIS_LIGHTCTRL, 0, 0 }, 1, 6, 20, 60, 3000, 150 }, + { SPL_FLASH, 30, STYPE_LIGHTNING, "Flash", NULL, 5, 4, FALSE, FALSE, 33, IS_CAST4, { MIS_FLASH, MIS_FLASH2, 0 }, 2, 16, 20, 40, 7500, 500 }, + { SPL_IDENTIFY, 13, STYPE_MAGIC, "Identify", "Identify", -1, -1, FALSE, TRUE, 23, IS_CAST6, { MIS_IDENTIFY, 0, 0 }, 2, 1, 8, 12, 0, 100 }, + { SPL_FIREWALL, 28, STYPE_FIRE, "Fire Wall", NULL, 3, 2, TRUE, FALSE, 27, IS_CAST2, { MIS_FIREWALLC, 0, 0 }, 2, 16, 8, 16, 6000, 400 }, + { SPL_TOWN, 35, STYPE_MAGIC, "Town Portal", NULL, 3, 3, TRUE, FALSE, 20, IS_CAST6, { MIS_TOWN, 0, 0 }, 3, 18, 8, 12, 3000, 200 }, +#ifndef SPAWN + { SPL_STONE, 60, STYPE_MAGIC, "Stone Curse", NULL, 6, 5, TRUE, FALSE, 51, IS_CAST2, { MIS_STONE, 0, 0 }, 3, 40, 8, 16, 12000, 800 }, +#else + { SPL_STONE, 60, STYPE_MAGIC, "Stone Curse", NULL, -1, -1, TRUE, FALSE, 51, IS_CAST2, { MIS_STONE, 0, 0 }, 3, 40, 8, 16, 12000, 800 }, +#endif + { SPL_INFRA, 40, STYPE_MAGIC, "Infravision", NULL, -1, -1, FALSE, FALSE, 36, IS_CAST8, { MIS_INFRA, 0, 0 }, 5, 20, 0, 0, 0, 600 }, + { SPL_RNDTELEPORT, 12, STYPE_MAGIC, "Phasing", NULL, 7, 6, FALSE, FALSE, 39, IS_CAST2, { MIS_RNDTELEPORT, 0, 0 }, 2, 4, 40, 80, 3500, 200 }, + { SPL_MANASHIELD, 33, STYPE_MAGIC, "Mana Shield", NULL, 6, 5, FALSE, FALSE, 25, IS_CAST2, { MIS_MANASHIELD, 0, 0 }, 0, 33, 4, 10, 16000, 1200 }, + { SPL_FIREBALL, 16, STYPE_FIRE, "Fireball", NULL, 8, 7, TRUE, FALSE, 48, IS_CAST2, { MIS_FIREBALL, 0, 0 }, 1, 10, 40, 80, 8000, 300 }, +#ifndef SPAWN + { SPL_GUARDIAN, 50, STYPE_FIRE, "Guardian", NULL, 9, 8, TRUE, FALSE, 61, IS_CAST2, { MIS_GUARDIAN, 0, 0 }, 2, 30, 16, 32, 14000, 950 }, +#else + { SPL_GUARDIAN, 50, STYPE_FIRE, "Guardian", NULL, -1, -1, TRUE, FALSE, 61, IS_CAST2, { MIS_GUARDIAN, 0, 0 }, 2, 30, 16, 32, 14000, 950 }, +#endif + { SPL_CHAIN, 30, STYPE_LIGHTNING, "Chain Lightning", NULL, 8, 7, FALSE, FALSE, 54, IS_CAST2, { MIS_CHAIN, 0, 0 }, 1, 18, 20, 60, 11000, 750 }, + { SPL_WAVE, 35, STYPE_FIRE, "Flame Wave", NULL, 9, 8, TRUE, FALSE, 54, IS_CAST2, { MIS_WAVE, 0, 0 }, 3, 20, 20, 40, 10000, 650 }, + { SPL_DOOMSERP, 0, STYPE_LIGHTNING, "Doom Serpents", NULL, -1, -1, FALSE, FALSE, 0, IS_CAST2, { 0, 0, 0 }, 0, 0, 40, 80, 0, 0 }, + { SPL_BLODRIT, 0, STYPE_MAGIC, "Blood Ritual", NULL, -1, -1, FALSE, FALSE, 0, IS_CAST2, { 0, 0, 0 }, 0, 0, 40, 80, 0, 0 }, + { SPL_NOVA, 60, STYPE_MAGIC, "Nova", NULL, -1, 10, FALSE, FALSE, 87, IS_CAST4, { MIS_NOVA, 0, 0 }, 3, 35, 16, 32, 21000, 1300 }, + { SPL_INVISIBIL, 0, STYPE_MAGIC, "Invisibility", NULL, -1, -1, FALSE, FALSE, 0, IS_CAST2, { 0, 0, 0 }, 0, 0, 40, 80, 0, 0 }, + { SPL_FLAME, 11, STYPE_FIRE, "Inferno", NULL, 3, 2, TRUE, FALSE, 20, IS_CAST2, { MIS_FLAMEC, 0, 0 }, 1, 6, 20, 40, 2000, 100 }, +#ifndef SPAWN + { SPL_GOLEM, 100, STYPE_FIRE, "Golem", NULL, 11, 9, FALSE, FALSE, 81, IS_CAST2, { MIS_GOLEM, 0, 0 }, 6, 60, 16, 32, 18000, 1100 }, +#else + { SPL_GOLEM, 100, STYPE_FIRE, "Golem", NULL, -1, -1, FALSE, FALSE, 81, IS_CAST2, { MIS_GOLEM, 0, 0 }, 6, 60, 16, 32, 18000, 1100 }, +#endif + { SPL_BLODBOIL, 0, STYPE_LIGHTNING, "Blood Boil", NULL, -1, -1, TRUE, FALSE, 0, IS_CAST8, { 0, 0, 0 }, 0, 0, 0, 0, 0, 0 }, + { SPL_TELEPORT, 35, STYPE_MAGIC, "Teleport", NULL, 14, 12, TRUE, FALSE, 105, IS_CAST6, { MIS_TELEPORT, 0, 0 }, 3, 15, 16, 32, 20000, 1250 }, +#ifndef SPAWN + { SPL_APOCA, 150, STYPE_FIRE, "Apocalypse", NULL, -1, 15, FALSE, FALSE, 149, IS_CAST2, { MIS_APOCA, 0, 0 }, 6, 90, 8, 12, 30000, 2000 }, +#else + { SPL_APOCA, 150, STYPE_FIRE, "Apocalypse", NULL, -1, -1, FALSE, FALSE, 149, IS_CAST2, { MIS_APOCA, 0, 0 }, 6, 90, 8, 12, 30000, 2000 }, +#endif + { SPL_ETHEREALIZE, 100, STYPE_MAGIC, "Etherealize", NULL, -1, -1, FALSE, FALSE, 93, IS_CAST2, { MIS_ETHEREALIZE, 0, 0 }, 0, 100, 2, 6, 26000, 1600 }, + { SPL_REPAIR, 0, STYPE_MAGIC, "Item Repair", "Item Repair", -1, -1, FALSE, TRUE, -1, IS_CAST6, { MIS_REPAIR, 0, 0 }, 0, 0, 40, 80, 0, 0 }, + { SPL_RECHARGE, 0, STYPE_MAGIC, "Staff Recharge", "Staff Recharge", -1, -1, FALSE, TRUE, -1, IS_CAST6, { MIS_RECHARGE, 0, 0 }, 0, 0, 40, 80, 0, 0 }, + { SPL_DISARM, 0, STYPE_MAGIC, "Trap Disarm", "Trap Disarm", -1, -1, FALSE, FALSE, -1, IS_CAST6, { MIS_DISARM, 0, 0 }, 0, 0, 40, 80, 0, 0 }, + { SPL_ELEMENT, 35, STYPE_FIRE, "Elemental", NULL, 8, 6, FALSE, FALSE, 68, IS_CAST2, { MIS_ELEMENT, 0, 0 }, 2, 20, 20, 60, 10500, 700 }, + { SPL_CBOLT, 6, STYPE_LIGHTNING, "Charged Bolt", NULL, 1, 1, TRUE, FALSE, 25, IS_CAST2, { MIS_CBOLT, 0, 0 }, 1, 6, 40, 80, 1000, 50 }, + { SPL_HBOLT, 7, STYPE_MAGIC, "Holy Bolt", NULL, 1, 1, TRUE, FALSE, 20, IS_CAST2, { MIS_HBOLT, 0, 0 }, 1, 3, 40, 80, 1000, 50 }, + { SPL_RESURRECT, 20, STYPE_MAGIC, "Resurrect", NULL, -1, 5, FALSE, TRUE, 30, IS_CAST8, { MIS_RESURRECT, 0, 0 }, 0, 20, 4, 10, 4000, 250 }, + { SPL_TELEKINESIS, 15, STYPE_MAGIC, "Telekinesis", NULL, 2, 2, FALSE, FALSE, 33, IS_CAST2, { MIS_TELEKINESIS, 0, 0 }, 2, 8, 20, 40, 2500, 200 }, + { SPL_HEALOTHER, 5, STYPE_MAGIC, "Heal Other", NULL, 1, 1, FALSE, TRUE, 17, IS_CAST8, { MIS_HEALOTHER, 0, 0 }, 3, 1, 20, 40, 1000, 50 }, +#ifndef SPAWN + { SPL_FLARE, 25, STYPE_MAGIC, "Blood Star", NULL, 14, 13, FALSE, FALSE, 70, IS_CAST2, { MIS_FLARE, 0, 0 }, 2, 14, 20, 60, 27500, 1800 }, + { SPL_BONESPIRIT, 24, STYPE_MAGIC, "Bone Spirit", NULL, 9, 7, FALSE, FALSE, 34, IS_CAST2, { MIS_BONESPIRIT, 0, 0 }, 1, 12, 20, 60, 11500, 800 }, +#else + { SPL_FLARE, 25, STYPE_MAGIC, "Blood Star", NULL, -1, -1, FALSE, FALSE, 70, IS_CAST2, { MIS_FLARE, 0, 0 }, 2, 14, 20, 60, 27500, 1800 }, + { SPL_BONESPIRIT, 24, STYPE_MAGIC, "Bone Spirit", NULL, -1, -1, FALSE, FALSE, 34, IS_CAST2, { MIS_BONESPIRIT, 0, 0 }, 1, 12, 20, 60, 11500, 800 }, +#endif // clang-format on }; diff --git a/Source/spelldat.h b/Source/spelldat.h index adb185c72..2c894f3b9 100644 --- a/Source/spelldat.h +++ b/Source/spelldat.h @@ -2,6 +2,6 @@ #ifndef __SPELLDAT_H__ #define __SPELLDAT_H__ -extern SpellData spelldata[MAX_SPELLS]; +extern SpellData spelldata[]; #endif /* __SPELLDAT_H__ */ diff --git a/Source/spells.cpp b/Source/spells.cpp index 61f36ce81..7f9dcd72b 100644 --- a/Source/spells.cpp +++ b/Source/spells.cpp @@ -88,7 +88,7 @@ BOOL CheckSpell(int id, int sn, char st, BOOL manaonly) #endif result = TRUE; - if (!manaonly && pcurs != 1) { + if (!manaonly && pcurs != CURSOR_HAND) { result = FALSE; } else { if (st != RSPLTYPE_SKILL) { diff --git a/Source/stores.cpp b/Source/stores.cpp index b973af83b..430aad0a9 100644 --- a/Source/stores.cpp +++ b/Source/stores.cpp @@ -13,6 +13,7 @@ int premiumlevel; int talker; STextStruct stext[24]; char stextsize; + int stextsmax; ItemStruct storehold[48]; int gossipstart; @@ -60,7 +61,7 @@ void InitStores() ClearSText(0, 24); stextflag = STORE_NONE; PentSpn2Frame = 1; - stextsize = 0; + stextsize = FALSE; stextscrl = FALSE; numpremium = 0; premiumlevel = 1; @@ -181,7 +182,7 @@ void DrawSLine(int y) int xy, yy, width, line, sy; sy = y * 12; - if (stextsize == 1) { + if (stextsize) { xy = SCREENXY(PANEL_LEFT + 26, 25); yy = BUFFER_WIDTH * (sy + 198) + 26 + PANEL_X; width = 586 / 4; @@ -237,7 +238,7 @@ void DrawSSlider(int y1, int y2) void DrawSTextHelp() { stextsel = -1; - stextsize = 1; + stextsize = TRUE; } void ClearSText(int s, int e) @@ -248,10 +249,10 @@ void ClearSText(int s, int e) stext[i]._sx = 0; stext[i]._syoff = 0; stext[i]._sstr[0] = 0; - stext[i]._sjust = 0; - stext[i]._sclr = 0; + stext[i]._sjust = FALSE; + stext[i]._sclr = COL_WHITE; stext[i]._sline = 0; - stext[i]._ssel = 0; + stext[i]._ssel = FALSE; stext[i]._sval = -1; } } @@ -274,7 +275,7 @@ void OffsetSTextY(int y, int yo) stext[y]._syoff = yo; } -void AddSText(int x, int y, int j, char *str, char clr, int sel) +void AddSText(int x, int y, BOOL j, char *str, char clr, BOOL sel) { stext[y]._sx = x; stext[y]._syoff = 0; @@ -359,17 +360,17 @@ void StoreAutoPlace() void S_StartSmith() { - stextsize = 0; + stextsize = FALSE; stextscrl = FALSE; - AddSText(0, 1, 1, "Welcome to the", COL_GOLD, 0); - AddSText(0, 3, 1, "Blacksmith's shop", COL_GOLD, 0); - AddSText(0, 7, 1, "Would you like to:", COL_GOLD, 0); - AddSText(0, 10, 1, "Talk to Griswold", COL_BLUE, 1); - AddSText(0, 12, 1, "Buy basic items", COL_WHITE, 1); - AddSText(0, 14, 1, "Buy premium items", COL_WHITE, 1); - AddSText(0, 16, 1, "Sell items", COL_WHITE, 1); - AddSText(0, 18, 1, "Repair items", COL_WHITE, 1); - AddSText(0, 20, 1, "Leave the shop", COL_WHITE, 1); + AddSText(0, 1, TRUE, "Welcome to the", COL_GOLD, FALSE); + AddSText(0, 3, TRUE, "Blacksmith's shop", COL_GOLD, FALSE); + AddSText(0, 7, TRUE, "Would you like to:", COL_GOLD, FALSE); + AddSText(0, 10, TRUE, "Talk to Griswold", COL_BLUE, TRUE); + AddSText(0, 12, TRUE, "Buy basic items", COL_WHITE, TRUE); + AddSText(0, 14, TRUE, "Buy premium items", COL_WHITE, TRUE); + AddSText(0, 16, TRUE, "Sell items", COL_WHITE, TRUE); + AddSText(0, 18, TRUE, "Repair items", COL_WHITE, TRUE); + AddSText(0, 20, TRUE, "Leave the shop", COL_WHITE, TRUE); AddSLine(5); storenumh = 20; } @@ -395,9 +396,9 @@ void S_ScrollSBuy(int idx) } if (smithitem[ls]._iMagical) { - AddSText(20, l, 0, smithitem[ls]._iIName, iclr, 1); + AddSText(20, l, FALSE, smithitem[ls]._iIName, iclr, TRUE); } else { - AddSText(20, l, 0, smithitem[ls]._iName, iclr, 1); + AddSText(20, l, FALSE, smithitem[ls]._iName, iclr, TRUE); } AddSTextVal(l, smithitem[ls]._iIvalue); @@ -439,7 +440,7 @@ void PrintStoreItem(ItemStruct *x, int l, char iclr) strcat(sstr, tempstr); } if (sstr[0]) { - AddSText(40, l, 0, sstr, iclr, 0); + AddSText(40, l, FALSE, sstr, iclr, FALSE); l++; } sstr[0] = '\0'; @@ -470,10 +471,10 @@ void PrintStoreItem(ItemStruct *x, int l, char iclr) sprintf(tempstr, "%s %i Dex", tempstr, x->_iMinDex); strcat(sstr, tempstr); } - AddSText(40, l++, 0, sstr, iclr, 0); + AddSText(40, l++, FALSE, sstr, iclr, FALSE); if (x->_iMagical == ITEM_QUALITY_UNIQUE) { if (x->_iIdentified) - AddSText(40, l, 0, "Unique Item", iclr, 0); + AddSText(40, l, FALSE, "Unique Item", iclr, FALSE); } } @@ -481,15 +482,15 @@ void S_StartSBuy() { int i; - stextsize = 1; + stextsize = TRUE; stextscrl = TRUE; stextsval = 0; sprintf(tempstr, "I have these items for sale : Your gold : %i", plr[myplr]._pGold); - AddSText(0, 1, 1, tempstr, COL_GOLD, 0); + AddSText(0, 1, TRUE, tempstr, COL_GOLD, FALSE); AddSLine(3); AddSLine(21); S_ScrollSBuy(stextsval); - AddSText(0, 22, 1, "Back", COL_WHITE, 0); + AddSText(0, 22, TRUE, "Back", COL_WHITE, FALSE); OffsetSTextY(22, 6); storenumh = 0; for (i = 0; smithitem[i]._itype != ITYPE_NONE; i++) { @@ -522,7 +523,7 @@ void S_ScrollSPBuy(int idx) iclr = COL_BLUE; if (!premiumitem[idx]._iStatFlag) iclr = COL_RED; - AddSText(20, l, 0, premiumitem[idx]._iIName, iclr, 1); + AddSText(20, l, FALSE, premiumitem[idx]._iIName, iclr, TRUE); AddSTextVal(l, premiumitem[idx]._iIvalue); PrintStoreItem(&premiumitem[idx], l + 1, iclr); stextdown = l; @@ -550,15 +551,15 @@ BOOL S_StartSPBuy() return FALSE; } - stextsize = 1; + stextsize = TRUE; stextscrl = TRUE; stextsval = 0; sprintf(tempstr, "I have these premium items for sale : Your gold : %i", plr[myplr]._pGold); - AddSText(0, 1, 1, tempstr, COL_GOLD, 0); + AddSText(0, 1, TRUE, tempstr, COL_GOLD, FALSE); AddSLine(3); AddSLine(21); - AddSText(0, 22, 1, "Back", COL_WHITE, 0); + AddSText(0, 22, TRUE, "Back", COL_WHITE, FALSE); OffsetSTextY(22, 6); stextsmax = storenumh - 4; @@ -610,10 +611,10 @@ void S_ScrollSSell(int idx) } if (storehold[idx]._iMagical && storehold[idx]._iIdentified) { - AddSText(20, l, 0, storehold[idx]._iIName, iclr, 1); + AddSText(20, l, FALSE, storehold[idx]._iIName, iclr, TRUE); AddSTextVal(l, storehold[idx]._iIvalue); } else { - AddSText(20, l, 0, storehold[idx]._iName, iclr, 1); + AddSText(20, l, FALSE, storehold[idx]._iName, iclr, TRUE); AddSTextVal(l, storehold[idx]._ivalue); } @@ -633,7 +634,7 @@ void S_StartSSell() int i; BOOL sellok; - stextsize = 1; + stextsize = TRUE; sellok = FALSE; storenumh = 0; @@ -659,21 +660,21 @@ void S_StartSSell() if (!sellok) { stextscrl = FALSE; sprintf(tempstr, "You have nothing I want. Your gold : %i", plr[myplr]._pGold); - AddSText(0, 1, 1, tempstr, COL_GOLD, 0); + AddSText(0, 1, TRUE, tempstr, COL_GOLD, FALSE); AddSLine(3); AddSLine(21); - AddSText(0, 22, 1, "Back", COL_WHITE, 1); + AddSText(0, 22, TRUE, "Back", COL_WHITE, TRUE); OffsetSTextY(22, 6); } else { stextscrl = TRUE; stextsval = 0; stextsmax = plr[myplr]._pNumInv; sprintf(tempstr, "Which item is for sale? Your gold : %i", plr[myplr]._pGold); - AddSText(0, 1, 1, tempstr, COL_GOLD, 0); + AddSText(0, 1, TRUE, tempstr, COL_GOLD, FALSE); AddSLine(3); AddSLine(21); S_ScrollSSell(stextsval); - AddSText(0, 22, 1, "Back", COL_WHITE, 1); + AddSText(0, 22, TRUE, "Back", COL_WHITE, TRUE); OffsetSTextY(22, 6); } } @@ -699,7 +700,7 @@ void S_StartSRepair() BOOL repairok; int i; - stextsize = 1; + stextsize = TRUE; repairok = FALSE; storenumh = 0; for (i = 0; i < 48; i++) @@ -729,10 +730,10 @@ void S_StartSRepair() if (!repairok) { stextscrl = FALSE; sprintf(tempstr, "You have nothing to repair. Your gold : %i", plr[myplr]._pGold); - AddSText(0, 1, 1, tempstr, 3, 0); + AddSText(0, 1, TRUE, tempstr, COL_GOLD, FALSE); AddSLine(3); AddSLine(21); - AddSText(0, 22, 1, "Back", 0, 1); + AddSText(0, 22, TRUE, "Back", COL_WHITE, TRUE); OffsetSTextY(22, 6); return; } @@ -741,11 +742,11 @@ void S_StartSRepair() stextsval = 0; stextsmax = plr[myplr]._pNumInv; sprintf(tempstr, "Repair which item? Your gold : %i", plr[myplr]._pGold); - AddSText(0, 1, 1, tempstr, 3, 0); + AddSText(0, 1, TRUE, tempstr, COL_GOLD, FALSE); AddSLine(3); AddSLine(21); S_ScrollSSell(stextsval); - AddSText(0, 22, 1, "Back", 0, 1); + AddSText(0, 22, TRUE, "Back", COL_WHITE, TRUE); OffsetSTextY(22, 6); } @@ -774,15 +775,15 @@ void AddStoreHoldRepair(ItemStruct *itm, int i) void S_StartWitch() { - stextsize = 0; + stextsize = FALSE; stextscrl = FALSE; - AddSText(0, 2, 1, "Witch's shack", COL_GOLD, 0); - AddSText(0, 9, 1, "Would you like to:", COL_GOLD, 0); - AddSText(0, 12, 1, "Talk to Adria", COL_BLUE, 1); - AddSText(0, 14, 1, "Buy items", COL_WHITE, 1); - AddSText(0, 16, 1, "Sell items", COL_WHITE, 1); - AddSText(0, 18, 1, "Recharge staves", COL_WHITE, 1); - AddSText(0, 20, 1, "Leave the shack", COL_WHITE, 1); + AddSText(0, 2, TRUE, "Witch's shack", COL_GOLD, FALSE); + AddSText(0, 9, TRUE, "Would you like to:", COL_GOLD, FALSE); + AddSText(0, 12, TRUE, "Talk to Adria", COL_BLUE, TRUE); + AddSText(0, 14, TRUE, "Buy items", COL_WHITE, TRUE); + AddSText(0, 16, TRUE, "Sell items", COL_WHITE, TRUE); + AddSText(0, 18, TRUE, "Recharge staves", COL_WHITE, TRUE); + AddSText(0, 20, TRUE, "Leave the shack", COL_WHITE, TRUE); AddSLine(5); storenumh = 20; } @@ -808,9 +809,9 @@ void S_ScrollWBuy(int idx) } if (witchitem[ls]._iMagical) { - AddSText(20, l, 0, witchitem[ls]._iIName, iclr, 1); + AddSText(20, l, FALSE, witchitem[ls]._iIName, iclr, TRUE); } else { - AddSText(20, l, 0, witchitem[ls]._iName, iclr, 1); + AddSText(20, l, FALSE, witchitem[ls]._iName, iclr, TRUE); } AddSTextVal(l, witchitem[ls]._iIvalue); @@ -828,16 +829,16 @@ void S_StartWBuy() { int i; - stextsize = 1; + stextsize = TRUE; stextscrl = TRUE; stextsval = 0; stextsmax = 20; sprintf(tempstr, "I have these items for sale : Your gold : %i", plr[myplr]._pGold); - AddSText(0, 1, 1, tempstr, COL_GOLD, 0); + AddSText(0, 1, TRUE, tempstr, COL_GOLD, FALSE); AddSLine(3); AddSLine(21); S_ScrollWBuy(stextsval); - AddSText(0, 22, 1, "Back", COL_WHITE, 0); + AddSText(0, 22, TRUE, "Back", COL_WHITE, FALSE); OffsetSTextY(22, 6); storenumh = 0; @@ -877,7 +878,7 @@ void S_StartWSell() int i; BOOL sellok; - stextsize = 1; + stextsize = TRUE; sellok = FALSE; storenumh = 0; @@ -919,21 +920,21 @@ void S_StartWSell() if (!sellok) { stextscrl = FALSE; sprintf(tempstr, "You have nothing I want. Your gold : %i", plr[myplr]._pGold); - AddSText(0, 1, 1, tempstr, COL_GOLD, 0); + AddSText(0, 1, TRUE, tempstr, COL_GOLD, FALSE); AddSLine(3); AddSLine(21); - AddSText(0, 22, 1, "Back", COL_WHITE, 1); + AddSText(0, 22, TRUE, "Back", COL_WHITE, TRUE); OffsetSTextY(22, 6); } else { stextscrl = TRUE; stextsval = 0; stextsmax = plr[myplr]._pNumInv; sprintf(tempstr, "Which item is for sale? Your gold : %i", plr[myplr]._pGold); - AddSText(0, 1, 1, tempstr, COL_GOLD, 0); + AddSText(0, 1, TRUE, tempstr, COL_GOLD, FALSE); AddSLine(3); AddSLine(21); S_ScrollSSell(stextsval); - AddSText(0, 22, 1, "Back", COL_WHITE, 1); + AddSText(0, 22, TRUE, "Back", COL_WHITE, TRUE); OffsetSTextY(22, 6); } } @@ -965,7 +966,7 @@ void S_StartWRecharge() int i; BOOL rechargeok; - stextsize = 1; + stextsize = TRUE; rechargeok = FALSE; storenumh = 0; @@ -989,21 +990,21 @@ void S_StartWRecharge() if (!rechargeok) { stextscrl = FALSE; sprintf(tempstr, "You have nothing to recharge. Your gold : %i", plr[myplr]._pGold); - AddSText(0, 1, 1, tempstr, COL_GOLD, 0); + AddSText(0, 1, TRUE, tempstr, COL_GOLD, FALSE); AddSLine(3); AddSLine(21); - AddSText(0, 22, 1, "Back", COL_WHITE, 1); + AddSText(0, 22, TRUE, "Back", COL_WHITE, TRUE); OffsetSTextY(22, 6); } else { stextscrl = TRUE; stextsval = 0; stextsmax = plr[myplr]._pNumInv; sprintf(tempstr, "Recharge which item? Your gold : %i", plr[myplr]._pGold); - AddSText(0, 1, 1, tempstr, COL_GOLD, 0); + AddSText(0, 1, TRUE, tempstr, COL_GOLD, FALSE); AddSLine(3); AddSLine(21); S_ScrollSSell(stextsval); - AddSText(0, 22, 1, "Back", COL_WHITE, 1); + AddSText(0, 22, TRUE, "Back", COL_WHITE, TRUE); OffsetSTextY(22, 6); } } @@ -1012,9 +1013,9 @@ void S_StartNoMoney() { StartStore(stextshold); stextscrl = FALSE; - stextsize = 1; + stextsize = TRUE; ClearSText(5, 23); - AddSText(0, 14, 1, "You do not have enough gold", COL_WHITE, 1); + AddSText(0, 14, TRUE, "You do not have enough gold", COL_WHITE, TRUE); } void S_StartNoRoom() @@ -1022,7 +1023,7 @@ void S_StartNoRoom() StartStore(stextshold); stextscrl = FALSE; ClearSText(5, 23); - AddSText(0, 14, 1, "You do not have enough room in inventory", COL_WHITE, 1); + AddSText(0, 14, TRUE, "You do not have enough room in inventory", COL_WHITE, TRUE); } void S_StartConfirm() @@ -1055,9 +1056,9 @@ void S_StartConfirm() idprint = FALSE; } if (idprint) - AddSText(20, 8, 0, plr[myplr].HoldItem._iIName, iclr, 0); + AddSText(20, 8, FALSE, plr[myplr].HoldItem._iIName, iclr, FALSE); else - AddSText(20, 8, 0, plr[myplr].HoldItem._iName, iclr, 0); + AddSText(20, 8, FALSE, plr[myplr].HoldItem._iName, iclr, FALSE); AddSTextVal(8, plr[myplr].HoldItem._iIvalue); PrintStoreItem(&plr[myplr].HoldItem, 9, iclr); @@ -1086,27 +1087,27 @@ void S_StartConfirm() strcpy(tempstr, "Are you sure you want to repair this item?"); break; } - AddSText(0, 15, 1, tempstr, COL_WHITE, 0); - AddSText(0, 18, 1, "Yes", COL_WHITE, 1); - AddSText(0, 20, 1, "No", COL_WHITE, 1); + AddSText(0, 15, TRUE, tempstr, COL_WHITE, FALSE); + AddSText(0, 18, TRUE, "Yes", COL_WHITE, TRUE); + AddSText(0, 20, TRUE, "No", COL_WHITE, TRUE); } void S_StartBoy() { - stextsize = 0; + stextsize = FALSE; stextscrl = FALSE; - AddSText(0, 2, 1, "Wirt the Peg-legged boy", COL_GOLD, 0); + AddSText(0, 2, TRUE, "Wirt the Peg-legged boy", COL_GOLD, FALSE); AddSLine(5); if (boyitem._itype != ITYPE_NONE) { - AddSText(0, 8, 1, "Talk to Wirt", COL_BLUE, 1); - AddSText(0, 12, 1, "I have something for sale,", COL_GOLD, 0); - AddSText(0, 14, 1, "but it will cost 50 gold", COL_GOLD, 0); - AddSText(0, 16, 1, "just to take a look. ", COL_GOLD, 0); - AddSText(0, 18, 1, "What have you got?", COL_WHITE, 1); - AddSText(0, 20, 1, "Say goodbye", COL_WHITE, 1); + AddSText(0, 8, TRUE, "Talk to Wirt", COL_BLUE, TRUE); + AddSText(0, 12, TRUE, "I have something for sale,", COL_GOLD, FALSE); + AddSText(0, 14, TRUE, "but it will cost 50 gold", COL_GOLD, FALSE); + AddSText(0, 16, TRUE, "just to take a look. ", COL_GOLD, FALSE); + AddSText(0, 18, TRUE, "What have you got?", COL_WHITE, TRUE); + AddSText(0, 20, TRUE, "Say goodbye", COL_WHITE, TRUE); } else { - AddSText(0, 12, 1, "Talk to Wirt", COL_BLUE, 1); - AddSText(0, 18, 1, "Say goodbye", COL_WHITE, 1); + AddSText(0, 12, TRUE, "Talk to Wirt", COL_BLUE, TRUE); + AddSText(0, 18, TRUE, "Say goodbye", COL_WHITE, TRUE); } } @@ -1114,10 +1115,10 @@ void S_StartBBoy() { int iclr; - stextsize = 1; + stextsize = TRUE; stextscrl = FALSE; sprintf(tempstr, "I have this item for sale : Your gold : %i", plr[myplr]._pGold); - AddSText(0, 1, 1, tempstr, COL_GOLD, 0); + AddSText(0, 1, TRUE, tempstr, COL_GOLD, FALSE); AddSLine(3); AddSLine(21); iclr = COL_WHITE; @@ -1127,27 +1128,27 @@ void S_StartBBoy() if (!boyitem._iStatFlag) iclr = COL_RED; if (boyitem._iMagical != ITEM_QUALITY_NORMAL) - AddSText(20, 10, 0, boyitem._iIName, iclr, 1); + AddSText(20, 10, FALSE, boyitem._iIName, iclr, TRUE); else - AddSText(20, 10, 0, boyitem._iName, iclr, 1); + AddSText(20, 10, FALSE, boyitem._iName, iclr, TRUE); AddSTextVal(10, boyitem._iIvalue + (boyitem._iIvalue >> 1)); PrintStoreItem(&boyitem, 11, iclr); - AddSText(0, 22, 1, "Leave", COL_WHITE, 1); + AddSText(0, 22, TRUE, "Leave", COL_WHITE, TRUE); OffsetSTextY(22, 6); } void S_StartHealer() { - stextsize = 0; + stextsize = FALSE; stextscrl = FALSE; - AddSText(0, 1, 1, "Welcome to the", COL_GOLD, 0); - AddSText(0, 3, 1, "Healer's home", COL_GOLD, 0); - AddSText(0, 9, 1, "Would you like to:", COL_GOLD, 0); - AddSText(0, 12, 1, "Talk to Pepin", COL_BLUE, 1); - AddSText(0, 14, 1, "Receive healing", COL_WHITE, 1); - AddSText(0, 16, 1, "Buy items", COL_WHITE, 1); - AddSText(0, 18, 1, "Leave Healer's home", COL_WHITE, 1); + AddSText(0, 1, TRUE, "Welcome to the", COL_GOLD, FALSE); + AddSText(0, 3, TRUE, "Healer's home", COL_GOLD, FALSE); + AddSText(0, 9, TRUE, "Would you like to:", COL_GOLD, FALSE); + AddSText(0, 12, TRUE, "Talk to Pepin", COL_BLUE, TRUE); + AddSText(0, 14, TRUE, "Receive healing", COL_WHITE, TRUE); + AddSText(0, 16, TRUE, "Buy items", COL_WHITE, TRUE); + AddSText(0, 18, TRUE, "Leave Healer's home", COL_WHITE, TRUE); AddSLine(5); storenumh = 20; } @@ -1166,7 +1167,7 @@ void S_ScrollHBuy(int idx) iclr = COL_RED; } - AddSText(20, l, 0, healitem[idx]._iName, iclr, 1); + AddSText(20, l, FALSE, healitem[idx]._iName, iclr, TRUE); AddSTextVal(l, healitem[idx]._iIvalue); PrintStoreItem(&healitem[idx], l + 1, iclr); stextdown = l; @@ -1182,15 +1183,15 @@ void S_StartHBuy() { int i; - stextsize = 1; + stextsize = TRUE; stextscrl = TRUE; stextsval = 0; sprintf(tempstr, "I have these items for sale : Your gold : %i", plr[myplr]._pGold); - AddSText(0, 1, 1, tempstr, COL_GOLD, 0); + AddSText(0, 1, TRUE, tempstr, COL_GOLD, FALSE); AddSLine(3); AddSLine(21); S_ScrollHBuy(stextsval); - AddSText(0, 22, 1, "Back", COL_WHITE, 0); + AddSText(0, 22, TRUE, "Back", COL_WHITE, FALSE); OffsetSTextY(22, 6); storenumh = 0; @@ -1204,13 +1205,13 @@ void S_StartHBuy() void S_StartStory() { - stextsize = 0; + stextsize = FALSE; stextscrl = FALSE; - AddSText(0, 2, 1, "The Town Elder", COL_GOLD, 0); - AddSText(0, 9, 1, "Would you like to:", COL_GOLD, 0); - AddSText(0, 12, 1, "Talk to Cain", COL_BLUE, 1); - AddSText(0, 14, 1, "Identify an item", COL_WHITE, 1); - AddSText(0, 18, 1, "Say goodbye", COL_WHITE, 1); + AddSText(0, 2, TRUE, "The Town Elder", COL_GOLD, FALSE); + AddSText(0, 9, TRUE, "Would you like to:", COL_GOLD, FALSE); + AddSText(0, 12, TRUE, "Talk to Cain", COL_BLUE, TRUE); + AddSText(0, 14, TRUE, "Identify an item", COL_WHITE, TRUE); + AddSText(0, 18, TRUE, "Say goodbye", COL_WHITE, TRUE); AddSLine(5); } @@ -1240,7 +1241,7 @@ void S_StartSIdentify() int i; idok = FALSE; - stextsize = 1; + stextsize = TRUE; storenumh = 0; for (i = 0; i < 48; i++) @@ -1285,21 +1286,21 @@ void S_StartSIdentify() if (!idok) { stextscrl = FALSE; sprintf(tempstr, "You have nothing to identify. Your gold : %i", plr[myplr]._pGold); - AddSText(0, 1, 1, tempstr, COL_GOLD, 0); + AddSText(0, 1, TRUE, tempstr, COL_GOLD, FALSE); AddSLine(3); AddSLine(21); - AddSText(0, 22, 1, "Back", COL_WHITE, 1); + AddSText(0, 22, TRUE, "Back", COL_WHITE, TRUE); OffsetSTextY(22, 6); } else { stextscrl = TRUE; stextsval = 0; stextsmax = plr[myplr]._pNumInv; sprintf(tempstr, "Identify which item? Your gold : %i", plr[myplr]._pGold); - AddSText(0, 1, 1, tempstr, COL_GOLD, 0); + AddSText(0, 1, TRUE, tempstr, COL_GOLD, FALSE); AddSLine(3); AddSLine(21); S_ScrollSSell(stextsval); - AddSText(0, 22, 1, "Back", COL_WHITE, 1); + AddSText(0, 22, TRUE, "Back", COL_WHITE, TRUE); OffsetSTextY(22, 6); } } @@ -1318,27 +1319,27 @@ void S_StartIdShow() if (!plr[myplr].HoldItem._iStatFlag) iclr = COL_RED; - AddSText(0, 7, 1, "This item is:", COL_WHITE, 0); - AddSText(20, 11, 0, plr[myplr].HoldItem._iIName, iclr, 0); + AddSText(0, 7, TRUE, "This item is:", COL_WHITE, FALSE); + AddSText(20, 11, FALSE, plr[myplr].HoldItem._iIName, iclr, FALSE); PrintStoreItem(&plr[myplr].HoldItem, 12, iclr); - AddSText(0, 18, 1, "Done", COL_WHITE, 1); + AddSText(0, 18, TRUE, "Done", COL_WHITE, TRUE); } void S_StartTalk() { int i, sn, sn2, la; - stextsize = 0; + stextsize = FALSE; stextscrl = FALSE; sprintf(tempstr, "Talk to %s", talkname[talker]); - AddSText(0, 2, 1, tempstr, COL_GOLD, 0); + AddSText(0, 2, TRUE, tempstr, COL_GOLD, FALSE); AddSLine(5); #ifdef SPAWN sprintf(tempstr, "Talking to %s", talkname[talker]); - AddSText(0, 10, 1, tempstr, COL_WHITE, 0); - AddSText(0, 12, 1, "is not available", COL_WHITE, 0); - AddSText(0, 14, 1, "in the shareware", COL_WHITE, 0); - AddSText(0, 16, 1, "version", COL_WHITE, 0); + AddSText(0, 10, TRUE, tempstr, COL_WHITE, FALSE); + AddSText(0, 12, TRUE, "is not available", COL_WHITE, FALSE); + AddSText(0, 14, TRUE, "in the shareware", COL_WHITE, FALSE); + AddSText(0, 16, TRUE, "version", COL_WHITE, FALSE); #else sn = 0; for (i = 0; i < MAXQUESTS; i++) { @@ -1358,48 +1359,48 @@ void S_StartTalk() for (i = 0; i < MAXQUESTS; i++) { if (quests[i]._qactive == QUEST_ACTIVE && ((DWORD *)&Qtalklist[talker])[i] != -1 && quests[i]._qlog) { - AddSText(0, sn, 1, questlist[i]._qlstr, COL_WHITE, 1); + AddSText(0, sn, TRUE, questlist[i]._qlstr, COL_WHITE, TRUE); sn += la; } } - AddSText(0, sn2, 1, "Gossip", COL_BLUE, 1); + AddSText(0, sn2, TRUE, "Gossip", COL_BLUE, TRUE); #endif - AddSText(0, 22, 1, "Back", COL_WHITE, 1); + AddSText(0, 22, TRUE, "Back", COL_WHITE, TRUE); } void S_StartTavern() { - stextsize = 0; + stextsize = FALSE; stextscrl = FALSE; - AddSText(0, 1, 1, "Welcome to the", COL_GOLD, 0); - AddSText(0, 3, 1, "Rising Sun", COL_GOLD, 0); - AddSText(0, 9, 1, "Would you like to:", COL_GOLD, 0); - AddSText(0, 12, 1, "Talk to Ogden", COL_BLUE, 1); - AddSText(0, 18, 1, "Leave the tavern", COL_WHITE, 1); + AddSText(0, 1, TRUE, "Welcome to the", COL_GOLD, FALSE); + AddSText(0, 3, TRUE, "Rising Sun", COL_GOLD, FALSE); + AddSText(0, 9, TRUE, "Would you like to:", COL_GOLD, FALSE); + AddSText(0, 12, TRUE, "Talk to Ogden", COL_BLUE, TRUE); + AddSText(0, 18, TRUE, "Leave the tavern", COL_WHITE, TRUE); AddSLine(5); storenumh = 20; } void S_StartBarMaid() { - stextsize = 0; + stextsize = FALSE; stextscrl = FALSE; - AddSText(0, 2, 1, "Gillian", COL_GOLD, 0); - AddSText(0, 9, 1, "Would you like to:", COL_GOLD, 0); - AddSText(0, 12, 1, "Talk to Gillian", COL_BLUE, 1); - AddSText(0, 18, 1, "Say goodbye", COL_WHITE, 1); + AddSText(0, 2, TRUE, "Gillian", COL_GOLD, FALSE); + AddSText(0, 9, TRUE, "Would you like to:", COL_GOLD, FALSE); + AddSText(0, 12, TRUE, "Talk to Gillian", COL_BLUE, TRUE); + AddSText(0, 18, TRUE, "Say goodbye", COL_WHITE, TRUE); AddSLine(5); storenumh = 20; } void S_StartDrunk() { - stextsize = 0; + stextsize = FALSE; stextscrl = FALSE; - AddSText(0, 2, 1, "Farnham the Drunk", COL_GOLD, 0); - AddSText(0, 9, 1, "Would you like to:", COL_GOLD, 0); - AddSText(0, 12, 1, "Talk to Farnham", COL_BLUE, 1); - AddSText(0, 18, 1, "Say Goodbye", COL_WHITE, 1); + AddSText(0, 2, TRUE, "Farnham the Drunk", COL_GOLD, FALSE); + AddSText(0, 9, TRUE, "Would you like to:", COL_GOLD, FALSE); + AddSText(0, 12, TRUE, "Talk to Farnham", COL_BLUE, TRUE); + AddSText(0, 18, TRUE, "Say Goodbye", COL_WHITE, TRUE); AddSLine(5); storenumh = 20; } diff --git a/Source/stores.h b/Source/stores.h index cfeaea3c7..667158bfe 100644 --- a/Source/stores.h +++ b/Source/stores.h @@ -49,7 +49,7 @@ void ClearSText(int s, int e); void AddSLine(int y); void AddSTextVal(int y, int val); void OffsetSTextY(int y, int yo); -void AddSText(int x, int y, int j, char *str, char clr, int sel); +void AddSText(int x, int y, BOOL j, char *str, char clr, BOOL sel); void StoreAutoPlace(); void S_StartSmith(); void S_ScrollSBuy(int idx); diff --git a/Source/textdat.cpp b/Source/textdat.cpp index 93861ef22..1c0aa3825 100644 --- a/Source/textdat.cpp +++ b/Source/textdat.cpp @@ -4,6 +4,7 @@ DEVILUTION_BEGIN_NAMESPACE /* todo: move text out of struct */ +/** Contains the data related to each speech ID. */ const TextDataStruct alltext[] = { #ifdef SPAWN { "Nice try... ", 0, 0, TSFX_TAVERN36 }, diff --git a/Source/tmsg.cpp b/Source/tmsg.cpp index 74adf7b4e..79ca960b4 100644 --- a/Source/tmsg.cpp +++ b/Source/tmsg.cpp @@ -40,10 +40,10 @@ void tmsg_add(BYTE *pbMsg, BYTE bLen) void tmsg_start() { - /// ASSERT: assert(! sgpTimedMsgHead); + assert(! sgpTimedMsgHead); } -void *tmsg_cleanup() +void tmsg_cleanup() { TMsg *next; @@ -52,7 +52,6 @@ void *tmsg_cleanup() MemFreeDbg(sgpTimedMsgHead); sgpTimedMsgHead = next; } - return sgpTimedMsgHead; } DEVILUTION_END_NAMESPACE diff --git a/Source/tmsg.h b/Source/tmsg.h index 465181f72..7e23e31e5 100644 --- a/Source/tmsg.h +++ b/Source/tmsg.h @@ -5,6 +5,6 @@ int tmsg_get(BYTE *pbMsg, DWORD dwMaxLen); void tmsg_add(BYTE *pbMsg, BYTE bLen); void tmsg_start(); -void *tmsg_cleanup(); +void tmsg_cleanup(); #endif /* __TMSG_H__ */ diff --git a/Source/track.cpp b/Source/track.cpp index 829d5fa52..5c582b364 100644 --- a/Source/track.cpp +++ b/Source/track.cpp @@ -23,7 +23,7 @@ void track_process() sgdwLastWalk = tick; NetSendCmdLoc(TRUE, CMD_WALKXY, cursmx, cursmy); if (!sgbIsScrolling) - sgbIsScrolling = 1; + sgbIsScrolling = TRUE; } } } @@ -39,7 +39,7 @@ void track_repeat_walk(BOOL rep) sgdwLastWalk = SDL_GetTicks() - 50; NetSendCmdLoc(TRUE, CMD_WALKXY, cursmx, cursmy); } else if (sgbIsScrolling) { - sgbIsScrolling = 0; + sgbIsScrolling = FALSE; } } diff --git a/Source/trigs.cpp b/Source/trigs.cpp index f0f94b1f0..b34d364e1 100644 --- a/Source/trigs.cpp +++ b/Source/trigs.cpp @@ -8,84 +8,20 @@ int numtrigs; TriggerStruct trigs[MAXTRIGGERS]; int TWarpFrom; -int TownDownList[11] = { 716, 715, 719, 720, 721, 723, 724, 725, 726, 727, -1 }; -int TownWarp1List[13] = { - 1171, - 1172, - 1173, - 1174, - 1175, - 1176, - 1177, - 1178, - 1179, - 1181, - 1183, - 1185, - -1 -}; -int L1UpList[12] = { 127, 129, 130, 131, 132, 133, 135, 137, 138, 139, 140, -1 }; -int L1DownList[10] = { 106, 107, 108, 109, 110, 112, 114, 115, 118, -1 }; -int L2UpList[3] = { 266, 267, -1 }; -int L2DownList[5] = { 269, 270, 271, 272, -1 }; -int L2TWarpUpList[3] = { 558, 559, -1 }; -int L3UpList[15] = { - 170, - 171, - 172, - 173, - 174, - 175, - 176, - 177, - 178, - 179, - 180, - 181, - 182, - 183, - -1 -}; -int L3DownList[9] = { 162, 163, 164, 165, 166, 167, 168, 169, -1 }; -int L3TWarpUpList[14] = { 548, 549, 550, 551, 552, 553, 554, 555, 556, 557, 558, 559, 560, -1 }; -int L4UpList[4] = { 82, 83, 90, -1 }; -int L4DownList[6] = { 120, 130, 131, 132, 133, -1 }; -int L4TWarpUpList[4] = { 421, 422, 429, -1 }; -int L4PentaList[33] = { - 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 -}; +int TownDownList[] = { 716, 715, 719, 720, 721, 723, 724, 725, 726, 727, -1 }; +int TownWarp1List[] = { 1171, 1172, 1173, 1174, 1175, 1176, 1177, 1178, 1179, 1181, 1183, 1185, -1 }; +int L1UpList[] = { 127, 129, 130, 131, 132, 133, 135, 137, 138, 139, 140, -1 }; +int L1DownList[] = { 106, 107, 108, 109, 110, 112, 114, 115, 118, -1 }; +int L2UpList[] = { 266, 267, -1 }; +int L2DownList[] = { 269, 270, 271, 272, -1 }; +int L2TWarpUpList[] = { 558, 559, -1 }; +int L3UpList[] = { 170, 171, 172, 173, 174, 175, 176, 177, 178, 179, 180, 181, 182, 183, -1 }; +int L3DownList[] = { 162, 163, 164, 165, 166, 167, 168, 169, -1 }; +int L3TWarpUpList[] = { 548, 549, 550, 551, 552, 553, 554, 555, 556, 557, 558, 559, 560, -1 }; +int L4UpList[] = { 82, 83, 90, -1 }; +int L4DownList[] = { 120, 130, 131, 132, 133, -1 }; +int L4TWarpUpList[] = { 421, 422, 429, -1 }; +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 void InitNoTriggers() @@ -125,7 +61,7 @@ void InitTownTriggers() numtrigs = 4; } else { #endif - for (i = 0; i < 3; i++) { + for (i = 0; i < MAX_PLRS - 1; i++) { townwarps[i] = FALSE; } #ifndef SPAWN @@ -161,7 +97,7 @@ void InitTownTriggers() void InitL1Triggers() { - int j, i; + int i, j; numtrigs = 0; for (j = 0; j < MAXDUNY; j++) { @@ -594,7 +530,7 @@ BOOL ForceL4Trig() void Freeupstairs() { - int i, tx, ty, yy, xx; + int i, tx, ty, xx, yy; for (i = 0; i < numtrigs; i++) { tx = trigs[i]._tx; @@ -713,7 +649,7 @@ void CheckTriggers() BOOL abort; char abortflag; - if (plr[myplr]._pmode) + if (plr[myplr]._pmode != PM_STAND) return; for (i = 0; i < numtrigs; i++) { diff --git a/SourceX/DiabloUI/progress.cpp b/SourceX/DiabloUI/progress.cpp index d12ef4989..f6e8307ca 100644 --- a/SourceX/DiabloUI/progress.cpp +++ b/SourceX/DiabloUI/progress.cpp @@ -92,7 +92,7 @@ void progress_Render(BYTE progress) } } -BOOL UiProgressDialog(HWND window, char *msg, int enable, int (*fnfunc)(), int rate) +BOOL UiProgressDialog(char *msg, int enable, int (*fnfunc)(), int rate) { progress_Load(msg); SetFadeLevel(256); diff --git a/SourceX/display.cpp b/SourceX/display.cpp index 653787743..7cbf82e15 100644 --- a/SourceX/display.cpp +++ b/SourceX/display.cpp @@ -28,7 +28,7 @@ void SetVideoMode(int width, int height, int bpp, std::uint32_t flags) { const auto ¤t = *SDL_GetVideoInfo(); SDL_Log("Video mode is now %dx%d bpp=%u flags=0x%08X", current.current_w, current.current_h, current.vfmt->BitsPerPixel, SDL_GetVideoSurface()->flags); - window = SDL_GetVideoSurface(); + ghMainWnd = SDL_GetVideoSurface(); } void SetVideoModeToPrimary(bool fullscreen) { @@ -96,9 +96,9 @@ bool SpawnWindow(const char *lpWindowName, int nWidth, int nHeight) flags |= SDL_WINDOW_INPUT_GRABBED; } - window = SDL_CreateWindow(lpWindowName, SDL_WINDOWPOS_UNDEFINED, SDL_WINDOWPOS_UNDEFINED, nWidth, nHeight, flags); + ghMainWnd = SDL_CreateWindow(lpWindowName, SDL_WINDOWPOS_UNDEFINED, SDL_WINDOWPOS_UNDEFINED, nWidth, nHeight, flags); #endif - if (window == NULL) { + if (ghMainWnd == NULL) { ErrSdl(); } @@ -116,7 +116,7 @@ bool SpawnWindow(const char *lpWindowName, int nWidth, int nHeight) #ifdef USE_SDL1 SDL_Log("upscaling not supported with USE_SDL1"); #else - renderer = SDL_CreateRenderer(window, -1, SDL_RENDERER_PRESENTVSYNC | SDL_RENDERER_ACCELERATED); + renderer = SDL_CreateRenderer(ghMainWnd, -1, SDL_RENDERER_PRESENTVSYNC | SDL_RENDERER_ACCELERATED); if (renderer == NULL) { ErrSdl(); } @@ -132,7 +132,7 @@ bool SpawnWindow(const char *lpWindowName, int nWidth, int nHeight) #endif } - return window != NULL; + return ghMainWnd != NULL; } SDL_Surface *GetOutputSurface() @@ -142,7 +142,7 @@ SDL_Surface *GetOutputSurface() #else if (renderer) return renderer_texture_surface; - return SDL_GetWindowSurface(window); + return SDL_GetWindowSurface(ghMainWnd); #endif } diff --git a/SourceX/dx.cpp b/SourceX/dx.cpp index b0608fab1..c5ba91124 100644 --- a/SourceX/dx.cpp +++ b/SourceX/dx.cpp @@ -1,5 +1,8 @@ -#include - +/** + * @file dx.cpp + * + * Implementation of functions setting up the graphics pipeline. + */ #include "all.h" #include "../3rdParty/Storm/Source/storm.h" #include "display.h" @@ -16,7 +19,6 @@ static CCritSect sgMemCrit; HMODULE ghDiabMod; int refreshDelay; -SDL_Window *window; SDL_Renderer *renderer; SDL_Texture *texture; @@ -71,8 +73,8 @@ static void dx_create_primary_surface() void dx_init(HWND hWnd) { - SDL_RaiseWindow(window); - SDL_ShowWindow(window); + SDL_RaiseWindow(ghMainWnd); + SDL_ShowWindow(ghMainWnd); dx_create_primary_surface(); palette_init(); @@ -94,7 +96,7 @@ static void lock_buf_priv() void lock_buf(BYTE idx) { #ifdef _DEBUG - locktbl[idx]++; + ++locktbl[idx]; #endif lock_buf_priv(); } @@ -103,13 +105,12 @@ static void unlock_buf_priv() { if (sgdwLockCount == 0) app_fatal("draw main unlock error"); - if (!gpBuffer) + if (gpBuffer == NULL) app_fatal("draw consistency error"); sgdwLockCount--; if (sgdwLockCount == 0) { gpBufEnd -= (uintptr_t)gpBuffer; - //gpBuffer = NULL; unable to return to menu } sgMemCrit.Leave(); } @@ -119,7 +120,7 @@ void unlock_buf(BYTE idx) #ifdef _DEBUG if (!locktbl[idx]) app_fatal("Draw lock underflow: 0x%x", idx); - locktbl[idx]--; + --locktbl[idx]; #endif unlock_buf_priv(); } @@ -127,7 +128,7 @@ void unlock_buf(BYTE idx) void dx_cleanup() { if (ghMainWnd) - SDL_HideWindow(window); + SDL_HideWindow(ghMainWnd); sgMemCrit.Enter(); sgdwLockCount = 0; gpBuffer = NULL; @@ -141,14 +142,14 @@ void dx_cleanup() SDL_FreeSurface(renderer_texture_surface); SDL_DestroyTexture(texture); SDL_DestroyRenderer(renderer); - SDL_DestroyWindow(window); + SDL_DestroyWindow(ghMainWnd); } void dx_reinit() { #ifdef USE_SDL1 - window = SDL_SetVideoMode(0, 0, 0, window->flags ^ SDL_FULLSCREEN); - if (window == NULL) { + ghMainWnd = SDL_SetVideoMode(0, 0, 0, ghMainWnd->flags ^ SDL_FULLSCREEN); + if (ghMainWnd == NULL) { ErrSdl(); } #else @@ -156,7 +157,7 @@ void dx_reinit() if (!fullscreen) { flags = renderer ? SDL_WINDOW_FULLSCREEN_DESKTOP : SDL_WINDOW_FULLSCREEN; } - if (SDL_SetWindowFullscreen(window, flags)) { + if (SDL_SetWindowFullscreen(ghMainWnd, flags)) { ErrSdl(); } #endif @@ -278,7 +279,7 @@ void RenderPresent() } SDL_RenderPresent(renderer); } else { - if (SDL_UpdateWindowSurface(window) <= -1) { + if (SDL_UpdateWindowSurface(ghMainWnd) <= -1) { ErrSdl(); } LimitFrameRate(); diff --git a/SourceX/miniwin/misc_msg.cpp b/SourceX/miniwin/misc_msg.cpp index 900d98391..710cf86df 100644 --- a/SourceX/miniwin/misc_msg.cpp +++ b/SourceX/miniwin/misc_msg.cpp @@ -36,7 +36,7 @@ void SetCursorPos(int X, int Y) mouseWarpingY = Y; mouseWarping = true; LogicalToOutput(&X, &Y); - SDL_WarpMouseInWindow(window, X, Y); + SDL_WarpMouseInWindow(ghMainWnd, X, Y); } // Moves the mouse to the first attribute "+" button. diff --git a/SourceX/platform/switch/docking.cpp b/SourceX/platform/switch/docking.cpp index c0e0fa911..82e5894e7 100644 --- a/SourceX/platform/switch/docking.cpp +++ b/SourceX/platform/switch/docking.cpp @@ -42,7 +42,7 @@ void HandleDocking() SDL_RenderClear(renderer); SDL_RenderPresent(renderer); } - SDL_SetWindowSize(window, display_width, display_height); + SDL_SetWindowSize(ghMainWnd, display_width, display_height); } } diff --git a/SourceX/sound.cpp b/SourceX/sound.cpp index ad9339204..004d3b7a6 100644 --- a/SourceX/sound.cpp +++ b/SourceX/sound.cpp @@ -25,14 +25,17 @@ char *sgszMusicTracks[NUM_MUSIC] = { #ifdef SPAWN "Music\\sTowne.wav", "Music\\sLvlA.wav", - "Music\\sintro.wav" + "Music\\sLvlA.wav", + "Music\\sLvlA.wav", + "Music\\sLvlA.wav", + "Music\\sintro.wav", #else "Music\\DTowne.wav", "Music\\DLvlA.wav", "Music\\DLvlB.wav", "Music\\DLvlC.wav", "Music\\DLvlD.wav", - "Music\\Dintro.wav" + "Music\\Dintro.wav", #endif }; @@ -54,7 +57,7 @@ void snd_play_snd(TSnd *pSnd, int lVolume, int lPan) } DSB = pSnd->DSB; - if (!DSB) { + if (DSB == NULL) { return; } @@ -85,7 +88,7 @@ TSnd *sound_file_load(char *path) pSnd = (TSnd *)DiabloAllocPtr(sizeof(TSnd)); memset(pSnd, 0, sizeof(TSnd)); pSnd->sound_path = path; - pSnd->start_tc = SDL_GetTicks() - 81; + pSnd->start_tc = SDL_GetTicks() - 80 - 1; dwBytes = SFileGetFileSize(file, NULL); wave_file = DiabloAllocPtr(dwBytes); diff --git a/SourceX/storm/storm.cpp b/SourceX/storm/storm.cpp index 8ea220ab8..d95c3c5cc 100644 --- a/SourceX/storm/storm.cpp +++ b/SourceX/storm/storm.cpp @@ -728,9 +728,9 @@ BOOL SVidPlayContinue(void) } } else { #ifdef USE_SDL1 - SDL_Surface *tmp = SDL_ConvertSurface(SVidSurface, window->format, 0); + SDL_Surface *tmp = SDL_ConvertSurface(SVidSurface, ghMainWnd->format, 0); #else - Uint32 format = SDL_GetWindowPixelFormat(window); + Uint32 format = SDL_GetWindowPixelFormat(ghMainWnd); SDL_Surface *tmp = SDL_ConvertSurfaceFormat(SVidSurface, format, 0); #endif if (SDL_BlitScaled(tmp, nullptr, output_surface, &pal_surface_offset) <= -1) { diff --git a/defs.h b/defs.h index fba977464..4b30f30c8 100644 --- a/defs.h +++ b/defs.h @@ -61,6 +61,7 @@ // from diablo 2 beta #define MAXEXP 2000000000 +#define MAXRESIST 75 #define GOLD_SMALL_LIMIT 1000 #define GOLD_MEDIUM_LIMIT 2500 diff --git a/enums.h b/enums.h index 141d1dcb8..6ea64ad34 100644 --- a/enums.h +++ b/enums.h @@ -2284,11 +2284,9 @@ typedef enum _talker_id { typedef enum _music_id { TMUSIC_TOWN, TMUSIC_L1, -#ifndef SPAWN TMUSIC_L2, TMUSIC_L3, TMUSIC_L4, -#endif TMUSIC_INTRO, NUM_MUSIC, } _music_id; diff --git a/structs.h b/structs.h index a4483bc8f..19b9ef62f 100644 --- a/structs.h +++ b/structs.h @@ -818,7 +818,7 @@ typedef struct TCmdChItem { WORD wIndx; WORD wCI; int dwSeed; - BYTE bId; + BOOLEAN bId; } TCmdChItem; typedef struct TCmdDelItem { @@ -1518,10 +1518,10 @@ typedef struct STextStruct { int _sx; int _syoff; char _sstr[128]; - int _sjust; + BOOL _sjust; char _sclr; int _sline; - int _ssel; + BOOL _ssel; int _sval; } STextStruct;