Browse Source

Merge branch 'master' of github.com:diasurgical/devilution into hellfire

pull/876/head
Anders Jenbo 6 years ago
parent
commit
cc0f92d45b
  1. 70
      Source/appfat.cpp
  2. 1
      Source/appfat.h
  3. 18
      Source/capture.cpp
  4. 172
      Source/control.cpp
  5. 16
      Source/dead.cpp
  6. 18
      Source/debug.cpp
  7. 30
      Source/diablo.cpp
  8. 2
      Source/drlg_l3.cpp
  9. 14
      Source/dthread.cpp
  10. 78
      Source/dx.cpp
  11. 10
      Source/engine.cpp
  12. 4
      Source/gmenu.cpp
  13. 10
      Source/logging.cpp
  14. 2
      Source/missiles.cpp
  15. 2
      Source/msg.cpp
  16. 14
      Source/nthread.cpp
  17. 200
      Source/objdat.cpp
  18. 6
      Source/objects.cpp
  19. 2
      Source/objects.h
  20. 24
      Source/pack.cpp
  21. 21
      Source/palette.cpp
  22. 2
      Source/player.cpp
  23. 2
      Source/quests.cpp
  24. 7
      Source/scrollrt.cpp
  25. 106
      Source/sound.cpp
  26. 39
      Source/spelldat.cpp
  27. 2
      Source/spelldat.h
  28. 5
      Source/tmsg.cpp
  29. 2
      Source/tmsg.h
  30. 4
      Source/track.cpp
  31. 116
      Source/trigs.cpp
  32. 2
      comparer-config/diablo.toml
  33. 2
      comparer-config/hellfire.toml
  34. 2
      comparer-config/spawn.toml
  35. 1
      defs.h
  36. 2
      enums.h
  37. 4
      structs.h

70
Source/appfat.cpp

@ -41,33 +41,31 @@ void TriggerBreak()
LONG __stdcall BreakFilter(PEXCEPTION_POINTERS pExc)
{
if (pExc->ExceptionRecord == NULL) {
return 0;
return EXCEPTION_CONTINUE_SEARCH;
}
if (pExc->ExceptionRecord->ExceptionCode != EXCEPTION_BREAKPOINT) {
return 0;
return EXCEPTION_CONTINUE_SEARCH;
}
if (((BYTE *)pExc->ContextRecord->Eip)[0] == 0xCC) { // int 3
pExc->ContextRecord->Eip++;
}
return -1;
return EXCEPTION_CONTINUE_EXECUTION;
}
#endif
char *GetErrorStr(DWORD error_code)
{
DWORD upper_code;
int size;
char *chr;
upper_code = (error_code >> 16) & 0x1FFF;
if (upper_code == 0x0878) {
TraceErrorDS(error_code, sz_error_buf, 256);
} else if (upper_code == 0x0876) {
TraceErrorDD(error_code, sz_error_buf, 256);
} else if (!SErrGetErrorStr(error_code, sz_error_buf, 256)
&& !FormatMessage(FORMAT_MESSAGE_FROM_SYSTEM, NULL, error_code, 0x400, sz_error_buf, 0x100, NULL)) {
if (HRESULT_FACILITY(error_code) == _FACDS) {
TraceErrorDS(error_code, sz_error_buf, sizeof(sz_error_buf) / sizeof(sz_error_buf[0]));
} else if (HRESULT_FACILITY(error_code) == _FACDD) {
TraceErrorDD(error_code, sz_error_buf, sizeof(sz_error_buf) / sizeof(sz_error_buf[0]));
} else if (!SErrGetErrorStr(error_code, sz_error_buf, sizeof(sz_error_buf) / sizeof(sz_error_buf[0]))
&& !FormatMessage(FORMAT_MESSAGE_FROM_SYSTEM, NULL, error_code, MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT), sz_error_buf, sizeof(sz_error_buf) / sizeof(sz_error_buf[0]), NULL)) {
wsprintf(sz_error_buf, "unknown error 0x%08x", error_code);
}
@ -394,7 +392,7 @@ void TraceErrorDD(HRESULT hError, char *pszBuffer, DWORD dwMaxChars)
break;
default: {
const char szUnknown[] = "DDERR unknown 0x%x";
/// ASSERT: assert(dwMaxChars >= sizeof(szUnknown) + 10);
assert(dwMaxChars >= sizeof(szUnknown) + 10);
sprintf(pszBuffer, szUnknown, hError);
return;
}
@ -455,7 +453,7 @@ void TraceErrorDS(HRESULT hError, char *pszBuffer, DWORD dwMaxChars)
break;
default: {
const char szUnknown[] = "DSERR unknown 0x%x";
/// ASSERT: assert(dwMaxChars >= sizeof(szUnknown) + 10);
assert(dwMaxChars >= sizeof(szUnknown) + 10);
sprintf(pszBuffer, szUnknown, hError);
return;
}
@ -559,7 +557,7 @@ void center_window(HWND hDlg)
{
LONG w, h;
int screenW, screenH;
struct tagRECT Rect;
tagRECT Rect;
HDC hdc;
GetWindowRect(hDlg, &Rect);
@ -575,6 +573,26 @@ void center_window(HWND hDlg)
}
}
static BOOL CALLBACK FuncDlg(HWND hDlg, UINT uMsg,WPARAM wParam, LPARAM lParam)
{
switch (uMsg) {
case WM_INITDIALOG:
TextDlg(hDlg, (char *)lParam);
break;
case WM_COMMAND:
if (LOWORD(wParam) == IDOK) {
EndDialog(hDlg, TRUE);
} else if (LOWORD(wParam) == IDCANCEL) {
EndDialog(hDlg, FALSE);
}
break;
default:
return FALSE;
}
return TRUE;
}
void ErrDlg(int template_id, DWORD error_code, char *log_file_path, int log_line_nr)
{
char *size;
@ -593,27 +611,7 @@ void ErrDlg(int template_id, DWORD error_code, char *log_file_path, int log_line
app_fatal(NULL);
}
BOOL __stdcall FuncDlg(HWND hDlg, UINT uMsg, WPARAM wParam, LPARAM text)
{
switch (uMsg) {
case WM_INITDIALOG:
TextDlg(hDlg, (char *)text);
break;
case WM_COMMAND:
if (wParam == 1) {
EndDialog(hDlg, 1);
} else if (wParam == 2) {
EndDialog(hDlg, 0);
}
break;
default:
return FALSE;
}
return TRUE;
}
void TextDlg(HWND hDlg, char *text)
static void TextDlg(HWND hDlg, char *text)
{
center_window(hDlg);
@ -669,7 +667,7 @@ BOOL InsertCDDlg()
ShowCursor(FALSE);
return nResult == 1;
return nResult == IDOK;
}
void DirErrorDlg(char *error)

1
Source/appfat.h

@ -29,7 +29,6 @@ void DDErrMsg(DWORD error_code, int log_line_nr, char *log_file_path);
void DSErrMsg(DWORD error_code, int log_line_nr, char *log_file_path);
void center_window(HWND hDlg);
void ErrDlg(int template_id, DWORD error_code, char *log_file_path, int log_line_nr);
BOOL __stdcall FuncDlg(HWND hDlg, UINT uMsg, WPARAM wParam, LPARAM text);
void TextDlg(HWND hDlg, char *text);
void ErrOkDlg(int template_id, DWORD error_code, char *log_file_path, int log_line_nr);
void FileErrDlg(const char *error);

18
Source/capture.cpp

@ -35,7 +35,7 @@ static BOOL CaptureHdr(HANDLE hFile, short width, short height)
static BOOL CapturePal(HANDLE hFile, PALETTEENTRY *palette)
{
DWORD NumberOfBytesWritten;
BYTE pcx_palette[769];
BYTE pcx_palette[1 + 256 * 3];
int i;
pcx_palette[0] = 12;
@ -45,7 +45,7 @@ static BOOL CapturePal(HANDLE hFile, PALETTEENTRY *palette)
pcx_palette[1 + 3 * i + 2] = palette[i].peBlue;
}
return WriteFile(hFile, pcx_palette, 769, &NumberOfBytesWritten, 0) && NumberOfBytesWritten == 769;
return WriteFile(hFile, pcx_palette, sizeof(pcx_palette), &NumberOfBytesWritten, NULL) && NumberOfBytesWritten == sizeof(pcx_palette);
}
static BYTE *CaptureEnc(BYTE *src, BYTE *dst, int width)
@ -93,7 +93,7 @@ static BOOL CapturePix(HANDLE hFile, WORD width, WORD height, WORD stride, BYTE
pBufferEnd = CaptureEnc(pixels, pBuffer, width);
pixels += stride;
writeSize = pBufferEnd - pBuffer;
if (!(WriteFile(hFile, pBuffer, writeSize, &lpNumBytes, 0) && lpNumBytes == writeSize)) {
if (!(WriteFile(hFile, pBuffer, writeSize, &lpNumBytes, NULL) && lpNumBytes == writeSize)) {
return FALSE;
}
}
@ -141,11 +141,7 @@ static void RedPalette(PALETTEENTRY *pal)
red[i].peFlags = 0;
}
#ifdef __cplusplus
lpDDPalette->SetEntries(0, 0, 256, red);
#else
lpDDPalette->lpVtbl->SetEntries(lpDDPalette, 0, 0, 256, red);
#endif
}
void CaptureScreen()
@ -158,11 +154,7 @@ void CaptureScreen()
hObject = CaptureFile(FileName);
if (hObject != INVALID_HANDLE_VALUE) {
DrawAndBlit();
#ifdef __cplusplus
lpDDPalette->GetEntries(0, 0, 256, palette);
#else
lpDDPalette->lpVtbl->GetEntries(lpDDPalette, 0, 0, 256, palette);
#endif
RedPalette(palette);
lock_buf(2);
@ -180,10 +172,6 @@ void CaptureScreen()
DeleteFile(FileName);
Sleep(300);
#ifdef __cplusplus
lpDDPalette->SetEntries(0, 0, 256, palette);
#else
lpDDPalette->lpVtbl->SetEntries(lpDDPalette, 0, 0, 256, palette);
#endif
}
}

172
Source/control.cpp

@ -28,14 +28,14 @@ int nGoldFrame;
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];
@ -152,7 +152,7 @@ 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
};
@ -222,14 +222,14 @@ char SpellITbl[MAX_SPELLS] = {
/** 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. */
@ -267,6 +267,14 @@ int SpellPages[6][7] = {
{ -1, -1, -1, -1, -1, -1, -1 }
};
#define SPLICONLENGTH 56
#define SPLROWICONLS 10
#ifdef HELLFIRE
#define SPLICONLAST 52
#else
#define SPLICONLAST 43
#endif
/**
* Draw spell cell onto the back buffer.
* @param xp Back buffer coordinate
@ -279,10 +287,10 @@ void DrawSpellCel(int xp, int yp, BYTE *Trans, int nCel, int w)
{
BYTE *dst, *tbl, *end;
/// ASSERT: assert(gpBuffer);
assert(gpBuffer);
dst = &gpBuffer[xp + PitchTbl[yp]];
tbl = SplTransTbl;
tbl = &SplTransTbl[0];
#ifdef USE_ASM
__asm {
@ -475,7 +483,7 @@ 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;
@ -493,40 +501,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;
#ifdef HELLFIRE
c += 9;
#endif
c = SPLICONLAST + 3;
mask = plr[myplr]._pAblSpells;
break;
case RSPLTYPE_SPELL:
c = 47;
#ifdef HELLFIRE
c += 9;
#endif
c = SPLICONLAST + 4;
mask = plr[myplr]._pMemSpells;
break;
case RSPLTYPE_SCROLL:
SetSpellTrans(RSPLTYPE_SCROLL);
c = 44;
#ifdef HELLFIRE
c += 9;
#endif
c = SPLICONLAST + 1;
mask = plr[myplr]._pScrlSpells;
break;
case RSPLTYPE_CHARGES:
SetSpellTrans(RSPLTYPE_CHARGES);
c = 45;
#ifdef HELLFIRE
c += 9;
#endif
c = SPLICONLAST + 2;
mask = plr[myplr]._pISpells;
break;
}
@ -545,17 +541,17 @@ 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;
#ifdef HELLFIRE
if (plr[myplr]._pClass == PC_MONK && j == SPL_SEARCH)
i = RSPLTYPE_SKILL;
#endif
DrawSpellCel(x, y, pSpellCels, c, 56);
DrawSpellCel(x, y, pSpellCels, c, SPLICONLENGTH);
switch (i) {
case RSPLTYPE_SKILL:
sprintf(infostr, "%s Skill", spelldata[pSpell].sSkillText);
@ -606,23 +602,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;
}
}
}
@ -690,7 +686,7 @@ void ToggleSpell(int slot)
*/
void PrintChar(int nOffset, int nCel, char col)
{
/// ASSERT: assert(gpBuffer);
assert(gpBuffer);
#ifdef USE_ASM
__asm {
@ -997,7 +993,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;
@ -1082,7 +1078,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;
@ -1232,7 +1228,7 @@ void UpdateLifeFlask()
#endif
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);
}
@ -1295,7 +1291,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();
@ -1436,10 +1432,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) {
@ -1460,22 +1456,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;
}
}
}
@ -1493,7 +1489,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;
}
@ -1507,7 +1503,7 @@ void DoPanBtn()
void control_set_button_down(int btn_id)
{
panbtn[btn_id] = 1;
panbtn[btn_id] = TRUE;
drawbtnflag = TRUE;
panbtndown = TRUE;
}
@ -1530,7 +1526,7 @@ void control_check_btn_press()
void DoAutoMap()
{
if (currlevel || gbMaxPlayers != 1) {
if (currlevel != 0 || gbMaxPlayers != 1) {
if (!automapflag)
StartAutomap();
else
@ -1562,7 +1558,7 @@ void CheckPanelInfo()
else
strcpy(infostr, "Player attack");
}
if (PanBtnHotKey[i]) {
if (PanBtnHotKey[i] != NULL) {
sprintf(tempstr, "Hotkey : %s", PanBtnHotKey[i]);
AddPanelString(tempstr, TRUE);
}
@ -1591,7 +1587,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);
@ -1644,9 +1640,9 @@ void CheckPanelInfo()
void CheckBtnUp()
{
int i;
char gamemenuOff;
BOOLEAN gamemenuOff;
gamemenuOff = 1;
gamemenuOff = TRUE;
drawbtnflag = TRUE;
panbtndown = FALSE;
@ -1655,7 +1651,7 @@ void CheckBtnUp()
continue;
}
panbtn[i] = 0;
panbtn[i] = FALSE;
if (MouseX < PanBtnPos[i][0]
|| MouseX > PanBtnPos[i][0] + PanBtnPos[i][2]
@ -1682,11 +1678,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;
@ -1707,7 +1703,7 @@ void CheckBtnUp()
control_type_message();
break;
case PANBTN_FRIENDLY:
FriendlyMode = FriendlyMode == 0;
FriendlyMode = !FriendlyMode;
break;
}
}
@ -1771,7 +1767,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);
@ -1796,7 +1792,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 {
@ -1820,7 +1816,7 @@ void DrawInfoBox()
AddPanelString(tempstr, TRUE);
}
}
if (infostr[0] || pnumlines)
if (infostr[0] != '\0' || pnumlines != 0)
PrintInfo();
}
@ -1831,7 +1827,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;
@ -1902,7 +1898,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
@ -1976,7 +1972,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;
@ -1985,7 +1981,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;
@ -1994,7 +1990,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;
@ -2269,7 +2265,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];
@ -2321,7 +2317,7 @@ void RedBack()
idx = light4flag ? 1536 : 4608;
/// ASSERT: assert(gpBuffer);
assert(gpBuffer);
#ifdef USE_ASM
if (leveltype != DTYPE_HELL) {
@ -2450,11 +2446,7 @@ void DrawSpellBook()
DrawSpellCel(RIGHT_PANEL + 75, yp, pSBkIconCels, SpellITbl[sn], 37);
if (sn == plr[myplr]._pRSpell && st == plr[myplr]._pRSplType) {
SetSpellTrans(RSPLTYPE_SKILL);
#ifdef HELLFIRE
DrawSpellCel(RIGHT_PANEL + 75, yp, pSBkIconCels, 52, 37);
#else
DrawSpellCel(RIGHT_PANEL + 75, yp, pSBkIconCels, 43, 37);
#endif
DrawSpellCel(RIGHT_PANEL + 75, yp, pSBkIconCels, SPLICONLAST, 37);
}
PrintSBookStr(10, yp - 23, FALSE, spelldata[sn].sNameText, COL_WHITE);
switch (GetSBookTrans(sn, FALSE)) {

16
Source/dead.cpp

@ -12,11 +12,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;
@ -24,7 +21,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;
@ -57,7 +54,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;
@ -69,7 +66,7 @@ void InitDead()
}
}
/// ASSERT: assert(nd <= MAXDEAD);
assert(nd <= MAXDEAD);
}
void AddDead(int dx, int dy, char dv, int ddir)
@ -79,13 +76,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)

18
Source/debug.cpp

@ -9,9 +9,10 @@
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];
@ -33,7 +34,7 @@ void init_seed_desync()
{
int i;
for (i = 0; i < 4096; i++) {
for (i = 0; i < DEBUGSEEDS; i++) {
seed_table[i] = -1;
}
@ -66,7 +67,7 @@ void seed_desync_index_set()
void seed_desync_check(int seed)
{
if (!update_seed_check || seed_index == 4096 || currlevel == 0) {
if (!update_seed_check || seed_index == DEBUGSEEDS || currlevel == 0) {
return;
}
@ -86,9 +87,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;
@ -266,7 +267,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;
@ -281,7 +282,8 @@ void NextDebugMonster()
{
char dstr[128];
if (dbgmon++ == MAXMONSTERS)
dbgmon++;
if (dbgmon == MAXMONSTERS)
dbgmon = 0;
sprintf(dstr, "Current debug monster = %i", dbgmon);

30
Source/diablo.cpp

@ -160,7 +160,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();
@ -218,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) {
@ -234,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);
}
@ -827,13 +827,13 @@ LRESULT CALLBACK GM_Game(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
}
break;
case WM_MOUSEMOVE:
MouseX = LOWORD(lParam);
MouseY = HIWORD(lParam);
MouseX = LOWORD(lParam); // BUGFIX (short)LOWORD coords are signed
MouseY = HIWORD(lParam); // BUGFIX (short)HIWORD coords are signed
gmenu_on_mouse_move();
return 0;
case WM_LBUTTONDOWN:
MouseX = LOWORD(lParam);
MouseY = HIWORD(lParam);
MouseX = LOWORD(lParam); // BUGFIX (short)LOWORD coords are signed
MouseY = HIWORD(lParam); // BUGFIX (short)HIWORD coords are signed
if (sgbMouseDown == 0) {
sgbMouseDown = 1;
SetCapture(hWnd);
@ -841,8 +841,8 @@ LRESULT CALLBACK GM_Game(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
}
return 0;
case WM_LBUTTONUP:
MouseX = LOWORD(lParam);
MouseY = HIWORD(lParam);
MouseX = LOWORD(lParam); // BUGFIX (short)LOWORD coords are signed
MouseY = HIWORD(lParam); // BUGFIX (short)HIWORD coords are signed
if (sgbMouseDown == 1) {
sgbMouseDown = 0;
LeftMouseUp();
@ -851,8 +851,8 @@ LRESULT CALLBACK GM_Game(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
}
return 0;
case WM_RBUTTONDOWN:
MouseX = LOWORD(lParam);
MouseY = HIWORD(lParam);
MouseX = LOWORD(lParam); // BUGFIX (short)LOWORD coords are signed
MouseY = HIWORD(lParam); // BUGFIX (short)HIWORD coords are signed
if (sgbMouseDown == 0) {
sgbMouseDown = 2;
SetCapture(hWnd);
@ -860,8 +860,8 @@ LRESULT CALLBACK GM_Game(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
}
return 0;
case WM_RBUTTONUP:
MouseX = LOWORD(lParam);
MouseY = HIWORD(lParam);
MouseX = LOWORD(lParam); // BUGFIX (short)LOWORD coords are signed
MouseY = HIWORD(lParam); // BUGFIX (short)HIWORD coords are signed
if (sgbMouseDown == 2) {
sgbMouseDown = 0;
ReleaseCapture();
@ -1397,7 +1397,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) {
SetCursorPos(MouseX + 160, MouseY);

2
Source/drlg_l3.cpp

@ -2085,7 +2085,7 @@ void LoadL3Dungeon(char *sFileName, int vx, int vy)
}
}
abyssx = 112;
abyssx = MAXDUNX; // Unused
DRLG_L3Pass3();
DRLG_Init_Globals();
ViewX = 31;

14
Source/dthread.cpp

@ -6,9 +6,7 @@
#include "all.h"
#include "../3rdParty/Storm/Source/storm.h"
#ifdef __cplusplus
static CCritSect sgMemCrit;
#endif
unsigned int glpDThreadId;
TMegaPkt *sgpInfoHead; /* may not be right struct */
BOOLEAN dthread_running;
@ -21,16 +19,12 @@ void dthread_remove_player(int pnum)
{
TMegaPkt *pkt;
#ifdef __cplusplus
sgMemCrit.Enter();
#endif
for (pkt = sgpInfoHead; pkt; pkt = pkt->pNext) {
if (pkt->dwSpaceLeft == pnum)
pkt->dwSpaceLeft = MAX_PLRS;
}
#ifdef __cplusplus
sgMemCrit.Leave();
#endif
}
void dthread_send_delta(int pnum, char cmd, void *pbSrc, int dwLen)
@ -48,9 +42,7 @@ void dthread_send_delta(int pnum, char cmd, void *pbSrc, int dwLen)
pkt->data[0] = cmd;
*(DWORD *)&pkt->data[4] = dwLen;
memcpy(&pkt->data[8], pbSrc, dwLen);
#ifdef __cplusplus
sgMemCrit.Enter();
#endif
p = (TMegaPkt *)&sgpInfoHead;
while (p->pNext) {
p = p->pNext;
@ -58,9 +50,7 @@ void dthread_send_delta(int pnum, char cmd, void *pbSrc, int dwLen)
p->pNext = pkt;
SetEvent(sghWorkToDoEvent);
#ifdef __cplusplus
sgMemCrit.Leave();
#endif
}
void dthread_start()
@ -98,17 +88,13 @@ unsigned int __stdcall dthread_handler(void *data)
app_fatal("dthread4:\n%s", error_buf);
}
#ifdef __cplusplus
sgMemCrit.Enter();
#endif
pkt = sgpInfoHead;
if (sgpInfoHead)
sgpInfoHead = sgpInfoHead->pNext;
else
ResetEvent(sghWorkToDoEvent);
#ifdef __cplusplus
sgMemCrit.Leave();
#endif
if (pkt) {
if (pkt->dwSpaceLeft != MAX_PLRS)

78
Source/dx.cpp

@ -16,9 +16,7 @@ IDirectDrawSurface *lpDDSPrimary;
#ifdef _DEBUG
int locktbl[256];
#endif
#ifdef __cplusplus
static CCritSect sgMemCrit;
#endif
char gbBackBuf;
char gbEmulate;
HMODULE ghDiabMod;
@ -29,27 +27,15 @@ static void dx_create_back_buffer()
HRESULT error_code;
DDSURFACEDESC ddsd;
#ifdef __cplusplus
error_code = lpDDSPrimary->GetCaps(&caps);
#else
error_code = lpDDSPrimary->lpVtbl->GetCaps(lpDDSPrimary, &caps);
#endif
if (error_code != DD_OK)
DDErrMsg(error_code, 59, "C:\\Src\\Diablo\\Source\\dx.cpp");
if (!gbBackBuf) {
ddsd.dwSize = sizeof(ddsd);
#ifdef __cplusplus
error_code = lpDDSPrimary->Lock(NULL, &ddsd, DDLOCK_WRITEONLY | DDLOCK_WAIT, NULL);
#else
error_code = lpDDSPrimary->lpVtbl->Lock(lpDDSPrimary, NULL, &ddsd, DDLOCK_WRITEONLY | DDLOCK_WAIT, NULL);
#endif
if (error_code == DD_OK) {
#ifdef __cplusplus
lpDDSPrimary->Unlock(NULL);
#else
lpDDSPrimary->lpVtbl->Unlock(lpDDSPrimary, NULL);
#endif
sgpBackBuf = (BYTE *)DiabloAllocPtr(BUFFER_HEIGHT * BUFFER_WIDTH);
return;
}
@ -65,18 +51,10 @@ static void dx_create_back_buffer()
ddsd.ddsCaps.dwCaps = DDSCAPS_SYSTEMMEMORY | DDSCAPS_OFFSCREENPLAIN;
ddsd.dwHeight = BUFFER_HEIGHT;
ddsd.ddpfPixelFormat.dwSize = sizeof(ddsd.ddpfPixelFormat);
#ifdef __cplusplus
error_code = lpDDSPrimary->GetPixelFormat(&ddsd.ddpfPixelFormat);
#else
error_code = lpDDSPrimary->lpVtbl->GetPixelFormat(lpDDSPrimary, &ddsd.ddpfPixelFormat);
#endif
if (error_code != DD_OK)
ErrDlg(IDD_DIALOG1, error_code, "C:\\Src\\Diablo\\Source\\dx.cpp", 94);
#ifdef __cplusplus
error_code = lpDDInterface->CreateSurface(&ddsd, &lpDDSBackBuf, NULL);
#else
error_code = lpDDInterface->lpVtbl->CreateSurface(lpDDInterface, &ddsd, &lpDDSBackBuf, NULL);
#endif
if (error_code != DD_OK)
ErrDlg(IDD_DIALOG1, error_code, "C:\\Src\\Diablo\\Source\\dx.cpp", 96);
}
@ -90,11 +68,7 @@ static void dx_create_primary_surface()
ddsd.dwSize = sizeof(ddsd);
ddsd.dwFlags = DDSD_CAPS;
ddsd.ddsCaps.dwCaps = DDSCAPS_PRIMARYSURFACE;
#ifdef __cplusplus
error_code = lpDDInterface->CreateSurface(&ddsd, &lpDDSPrimary, NULL);
#else
error_code = lpDDInterface->lpVtbl->CreateSurface(lpDDInterface, &ddsd, &lpDDSPrimary, NULL);
#endif
if (error_code != DD_OK)
ErrDlg(IDD_DIALOG1, error_code, "C:\\Src\\Diablo\\Source\\dx.cpp", 109);
}
@ -153,11 +127,7 @@ void dx_init(HWND hWnd)
fullscreen = TRUE;
#endif
if (!fullscreen) {
#ifdef __cplusplus
hDDVal = lpDDInterface->SetCooperativeLevel(hWnd, DDSCL_NORMAL | DDSCL_ALLOWREBOOT);
#else
hDDVal = lpDDInterface->lpVtbl->SetCooperativeLevel(lpDDInterface, hWnd, DDSCL_NORMAL | DDSCL_ALLOWREBOOT);
#endif
if (hDDVal == DDERR_EXCLUSIVEMODEALREADYSET) {
TriggerBreak();
} else if (hDDVal != DD_OK) {
@ -165,29 +135,17 @@ void dx_init(HWND hWnd)
}
SetWindowPos(hWnd, HWND_NOTOPMOST, 0, 0, 0, 0, SWP_NOACTIVATE | SWP_NOMOVE | SWP_NOSIZE);
} else {
#ifdef __cplusplus
hDDVal = lpDDInterface->SetCooperativeLevel(hWnd, DDSCL_EXCLUSIVE | DDSCL_ALLOWREBOOT | DDSCL_FULLSCREEN);
#else
hDDVal = lpDDInterface->lpVtbl->SetCooperativeLevel(lpDDInterface, hWnd, DDSCL_EXCLUSIVE | DDSCL_ALLOWREBOOT | DDSCL_FULLSCREEN);
#endif
if (hDDVal == DDERR_EXCLUSIVEMODEALREADYSET) {
TriggerBreak();
} else if (hDDVal != DD_OK) {
ErrDlg(IDD_DIALOG1, hDDVal, "C:\\Src\\Diablo\\Source\\dx.cpp", 170);
}
#ifdef __cplusplus
hDDVal = lpDDInterface->SetDisplayMode(SCREEN_WIDTH, SCREEN_HEIGHT, SCREEN_BPP);
#else
hDDVal = lpDDInterface->lpVtbl->SetDisplayMode(lpDDInterface, SCREEN_WIDTH, SCREEN_HEIGHT, SCREEN_BPP);
#endif
if (hDDVal != DD_OK) {
winw = GetSystemMetrics(SM_CXSCREEN);
winh = GetSystemMetrics(SM_CYSCREEN);
#ifdef __cplusplus
hDDVal = lpDDInterface->SetDisplayMode(winw, winh, SCREEN_BPP);
#else
hDDVal = lpDDInterface->lpVtbl->SetDisplayMode(lpDDInterface, winw, winh, SCREEN_BPP);
#endif
}
if (hDDVal != DD_OK) {
ErrDlg(IDD_DIALOG1, hDDVal, "C:\\Src\\Diablo\\Source\\dx.cpp", 183);
@ -207,9 +165,7 @@ static void lock_buf_priv()
DDSURFACEDESC ddsd;
HRESULT error_code;
#ifdef __cplusplus
sgMemCrit.Enter();
#endif
if (sgpBackBuf != NULL) {
gpBuffer = sgpBackBuf;
sgdwLockCount++;
@ -228,11 +184,7 @@ static void lock_buf_priv()
return;
}
ddsd.dwSize = sizeof(ddsd);
#ifdef __cplusplus
error_code = lpDDSBackBuf->Lock(NULL, &ddsd, DDLOCK_WAIT, NULL);
#else
error_code = lpDDSBackBuf->lpVtbl->Lock(lpDDSBackBuf, NULL, &ddsd, DDLOCK_WAIT, NULL);
#endif
if (error_code != DD_OK)
DDErrMsg(error_code, 235, "C:\\Src\\Diablo\\Source\\dx.cpp");
@ -263,18 +215,12 @@ static void unlock_buf_priv()
gpBufEnd -= (size_t)gpBuffer;
gpBuffer = NULL;
if (sgpBackBuf == NULL) {
#ifdef __cplusplus
error_code = lpDDSBackBuf->Unlock(NULL);
#else
error_code = lpDDSBackBuf->lpVtbl->Unlock(lpDDSBackBuf, NULL);
#endif
if (error_code != DD_OK)
DDErrMsg(error_code, 273, "C:\\Src\\Diablo\\Source\\dx.cpp");
}
}
#ifdef __cplusplus
sgMemCrit.Leave();
#endif
}
void unlock_buf(BYTE idx)
@ -292,46 +238,26 @@ void dx_cleanup()
if (ghMainWnd)
ShowWindow(ghMainWnd, SW_HIDE);
SDrawDestroy();
#ifdef __cplusplus
sgMemCrit.Enter();
#endif
if (sgpBackBuf != NULL) {
MemFreeDbg(sgpBackBuf);
} else if (lpDDSBackBuf != NULL) {
#ifdef __cplusplus
lpDDSBackBuf->Release();
#else
lpDDSBackBuf->lpVtbl->Release(lpDDSBackBuf);
#endif
lpDDSBackBuf = NULL;
}
sgdwLockCount = 0;
gpBuffer = NULL;
#ifdef __cplusplus
sgMemCrit.Leave();
#endif
if (lpDDSPrimary) {
#ifdef __cplusplus
lpDDSPrimary->Release();
#else
lpDDSPrimary->lpVtbl->Release(lpDDSPrimary);
#endif
lpDDSPrimary = NULL;
}
if (lpDDPalette) {
#ifdef __cplusplus
lpDDPalette->Release();
#else
lpDDPalette->lpVtbl->Release(lpDDPalette);
#endif
lpDDPalette = NULL;
}
if (lpDDInterface) {
#ifdef __cplusplus
lpDDInterface->Release();
#else
lpDDInterface->lpVtbl->Release(lpDDInterface);
#endif
lpDDInterface = NULL;
}
}
@ -340,9 +266,7 @@ void dx_reinit()
{
int lockCount;
#ifdef __cplusplus
sgMemCrit.Enter();
#endif
ClearCursor();
lockCount = sgdwLockCount;
@ -360,9 +284,7 @@ void dx_reinit()
lockCount--;
}
#ifdef __cplusplus
sgMemCrit.Leave();
#endif
}
/* check extern remove stub */

10
Source/engine.cpp

@ -24,9 +24,7 @@ int orgseed;
int sgnWidth;
/** Current game seed */
int sglGameSeed;
#ifdef __cplusplus
static CCritSect sgMemCrit;
#endif
int SeedCount;
BOOL gbNotInView; // valid - if x/y are in bounds
@ -2599,13 +2597,9 @@ BYTE *DiabloAllocPtr(DWORD dwBytes)
{
BYTE *buf;
#ifdef __cplusplus
sgMemCrit.Enter();
#endif
buf = (BYTE *)SMemAlloc(dwBytes, "C:\\Src\\Diablo\\Source\\ENGINE.CPP", 2236, 0);
#ifdef __cplusplus
sgMemCrit.Leave();
#endif
if (buf == NULL) {
ErrDlg(IDD_DIALOG2, GetLastError(), "C:\\Src\\Diablo\\Source\\ENGINE.CPP", 2269);
@ -2621,13 +2615,9 @@ BYTE *DiabloAllocPtr(DWORD dwBytes)
void mem_free_dbg(void *p)
{
if (p) {
#ifdef __cplusplus
sgMemCrit.Enter();
#endif
SMemFree(p, "C:\\Src\\Diablo\\Source\\ENGINE.CPP", 2317, 0);
#ifdef __cplusplus
sgMemCrit.Leave();
#endif
}
}

4
Source/gmenu.cpp

@ -87,7 +87,7 @@ void gmenu_init_menu()
#ifdef HELLFIRE
LogoAnim_frame = 1;
#endif
sgpCurrentMenu = 0;
sgpCurrentMenu = NULL;
sgpCurrItem = 0;
dword_63447C = 0;
sgCurrentMenuIdx = 0;
@ -105,7 +105,7 @@ void gmenu_init_menu()
BOOL gmenu_is_active()
{
return sgpCurrentMenu != 0;
return sgpCurrentMenu != NULL;
}
void gmenu_set_items(TMenuItem *pItem, void (*gmFunc)(TMenuItem *))

10
Source/logging.cpp

@ -6,9 +6,7 @@
#include "all.h"
#include "../3rdParty/Storm/Source/storm.h"
#ifdef __cplusplus
static CCritSect sgMemCrit;
#endif
CHAR FileName[MAX_PATH];
char log_buffer[388];
LPCVOID lpAddress;
@ -25,9 +23,7 @@ void __cdecl log_flush(BOOL force_close)
{
DWORD NumberOfBytesWritten;
#ifdef __cplusplus
sgMemCrit.Enter();
#endif
if (nNumberOfBytesToWrite) {
if (log_file == INVALID_HANDLE_VALUE) {
log_file = log_create();
@ -44,9 +40,7 @@ void __cdecl log_flush(BOOL force_close)
CloseHandle(log_file);
log_file = INVALID_HANDLE_VALUE;
}
#ifdef __cplusplus
sgMemCrit.Leave();
#endif
}
HANDLE log_create()
@ -142,9 +136,7 @@ void __cdecl log_printf(const char *pszFmt, ...)
char msg[512];
va_list va;
#ifdef __cplusplus
sgMemCrit.Enter();
#endif
va_start(va, pszFmt);
_vsnprintf(msg, 0x200, pszFmt, va);
va_end(va);
@ -164,10 +156,8 @@ void __cdecl log_printf(const char *pszFmt, ...)
memcpy(&pBuffer[nNumberOfBytesToWrite], msg, size);
nNumberOfBytesToWrite += size;
}
#ifdef __cplusplus
sgMemCrit.Leave();
#endif
#endif
}
void log_dump_computer_info()

2
Source/missiles.cpp

@ -3268,7 +3268,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)

2
Source/msg.cpp

@ -1286,7 +1286,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);

14
Source/nthread.cpp

@ -8,9 +8,7 @@
BYTE sgbNetUpdateRate;
DWORD gdwMsgLenTbl[MAX_PLRS];
#ifdef __cplusplus
static CCritSect sgMemCrit;
#endif
DWORD gdwDeltaBytesSec;
BOOLEAN nthread_should_run;
DWORD gdwTurnsInTransit;
@ -160,9 +158,7 @@ void nthread_start(BOOL set_turn_upper_bit)
gdwNormalMsgSize = largestMsgSize;
if (gbMaxPlayers > 1) {
sgbThreadIsRunning = FALSE;
#ifdef __cplusplus
sgMemCrit.Enter();
#endif
nthread_should_run = TRUE;
sghThread = (HANDLE)_beginthreadex(NULL, 0, nthread_handler, NULL, 0, &glpNThreadId);
if (sghThread == INVALID_HANDLE_VALUE) {
@ -180,9 +176,7 @@ unsigned int __stdcall nthread_handler(void *data)
if (nthread_should_run) {
while (1) {
#ifdef __cplusplus
sgMemCrit.Enter();
#endif
if (!nthread_should_run)
break;
nthread_send_and_recv_turn(0, 0);
@ -190,17 +184,13 @@ unsigned int __stdcall nthread_handler(void *data)
delta = last_tick - GetTickCount();
else
delta = 50;
#ifdef __cplusplus
sgMemCrit.Leave();
#endif
if (delta > 0)
Sleep(delta);
if (!nthread_should_run)
return 0;
}
#ifdef __cplusplus
sgMemCrit.Leave();
#endif
}
return 0;
}
@ -212,10 +202,8 @@ void nthread_cleanup()
gdwNormalMsgSize = 0;
gdwLargestMsgSize = 0;
if (sghThread != INVALID_HANDLE_VALUE && glpNThreadId != GetCurrentThreadId()) {
#ifdef __cplusplus
if (!sgbThreadIsRunning)
sgMemCrit.Leave();
#endif
if (WaitForSingleObject(sghThread, INFINITE) == -1) {
app_fatal("nthread3:\n(%s)", TraceLastError());
}
@ -227,12 +215,10 @@ void nthread_cleanup()
void nthread_ignore_mutex(BOOL bStart)
{
if (sghThread != INVALID_HANDLE_VALUE) {
#ifdef __cplusplus
if (bStart)
sgMemCrit.Leave();
else
sgMemCrit.Enter();
#endif
sgbThreadIsRunning = bStart;
}
}

200
Source/objdat.cpp

@ -120,106 +120,106 @@ int ObjTypeConv[113] = {
/** 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, DTYPE_NONE, THEME_NONE, -1, 0, 0, 0, 0, FALSE, FALSE, FALSE, 0, 0, FALSE }
// clang-format on
};

6
Source/objects.cpp

@ -996,7 +996,7 @@ void InitObjects()
InitRndLocObj(1, 5, OBJ_CHEST3);
if (leveltype != DTYPE_HELL)
AddObjTraps();
if (leveltype > 1)
if (leveltype > DTYPE_CATHEDRAL)
AddChestTraps();
InitObjFlag = FALSE;
}
@ -4736,7 +4736,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;
@ -4767,7 +4767,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;

2
Source/objects.h

@ -151,7 +151,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);

24
Source/pack.cpp

@ -70,8 +70,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);
@ -79,8 +79,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);
@ -92,8 +92,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);
@ -221,8 +221,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);
@ -230,8 +230,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);
@ -245,8 +245,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);

21
Source/palette.cpp

@ -111,25 +111,13 @@ void palette_init()
memcpy(system_palette, orig_palette, sizeof(orig_palette));
LoadSysPal();
#ifdef HELLFIRE
#ifdef __cplusplus
error_code = lpDDInterface->CreatePalette(DDPCAPS_ALLOW256 | DDPCAPS_INITIALIZE | DDPCAPS_8BIT, system_palette, &lpDDPalette, NULL);
#else
error_code = lpDDInterface->lpVtbl->CreatePalette(lpDDInterface, DDPCAPS_ALLOW256 | DDPCAPS_INITIALIZE | DDPCAPS_8BIT, system_palette, &lpDDPalette, NULL);
#endif
#else
#ifdef __cplusplus
error_code = lpDDInterface->CreatePalette(DDPCAPS_ALLOW256 | DDPCAPS_8BIT, system_palette, &lpDDPalette, NULL);
#else
error_code = lpDDInterface->lpVtbl->CreatePalette(lpDDInterface, DDPCAPS_ALLOW256 | DDPCAPS_8BIT, system_palette, &lpDDPalette, NULL);
#endif
#endif
if (error_code)
ErrDlg(IDD_DIALOG8, error_code, "C:\\Src\\Diablo\\Source\\PALETTE.CPP", 143);
#ifdef __cplusplus
error_code = lpDDSPrimary->SetPalette(lpDDPalette);
#else
error_code = lpDDSPrimary->lpVtbl->SetPalette(lpDDSPrimary, lpDDPalette);
#endif
#ifndef RGBMODE
if (error_code)
ErrDlg(IDD_DIALOG8, error_code, "C:\\Src\\Diablo\\Source\\PALETTE.CPP", 146);
@ -184,13 +172,8 @@ void LoadRndLvlPal(int l)
void ResetPal()
{
if (!lpDDSPrimary
#ifdef __cplusplus
|| lpDDSPrimary->IsLost() != DDERR_SURFACELOST
|| !lpDDSPrimary->Restore()) {
#else
|| lpDDSPrimary->lpVtbl->IsLost(lpDDSPrimary) != DDERR_SURFACELOST
|| !lpDDSPrimary->lpVtbl->Restore(lpDDSPrimary)) {
#endif
SDrawRealizePalette();
}
}
@ -238,11 +221,7 @@ static void SetFadeLevel(DWORD fadeval)
system_palette[i].peBlue = (fadeval * logical_palette[i].peBlue) >> 8;
}
Sleep(3);
#ifdef __cplusplus
lpDDInterface->WaitForVerticalBlank(DDWAITVB_BLOCKBEGIN, NULL);
#else
lpDDInterface->lpVtbl->WaitForVerticalBlank(lpDDInterface, DDWAITVB_BLOCKBEGIN, NULL);
#endif
palette_update();
}
}

2
Source/player.cpp

@ -1554,7 +1554,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);
}

2
Source/quests.cpp

@ -204,7 +204,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);

7
Source/scrollrt.cpp

@ -2639,17 +2639,10 @@ static void DrawFPS()
if (framerate > 99)
framerate = 99;
wsprintf(String, "%2d", framerate);
#ifdef __cplusplus
if (!lpDDSPrimary->GetDC(&hdc)) {
TextOut(hdc, 0, 400, String, strlen(String));
lpDDSPrimary->ReleaseDC(hdc);
}
#else
if (!lpDDSPrimary->lpVtbl->GetDC(lpDDSPrimary, &hdc)) {
TextOut(hdc, 0, 400, String, strlen(String));
lpDDSPrimary->lpVtbl->ReleaseDC(lpDDSPrimary, hdc);
}
#endif
}
}
#endif

106
Source/sound.cpp

@ -20,7 +20,14 @@ char *sgszMusicTracks[NUM_MUSIC] = {
#ifdef SPAWN
"Music\\sTowne.wav",
"Music\\sLvlA.wav",
"Music\\sintro.wav"
"Music\\sLvlA.wav",
"Music\\sLvlA.wav",
"Music\\sLvlA.wav",
#ifdef HELLFIRE
"Music\\sLvlA.wav",
"Music\\sLvlA.wav",
#endif
"Music\\sintro.wav",
#else
"Music\\DTowne.wav",
"Music\\DLvlA.wav",
@ -31,7 +38,7 @@ char *sgszMusicTracks[NUM_MUSIC] = {
"Music\\DLvlE.wav",
"Music\\DLvlF.wav",
#endif
"Music\\Dintro.wav"
"Music\\Dintro.wav",
#endif
};
char unk_volume[4][2] = {
@ -49,19 +56,11 @@ void snd_update(BOOL bStopAll)
if (!DSBs[i])
continue;
#ifdef __cplusplus
if (!bStopAll && DSBs[i]->GetStatus(&dwStatus) == DS_OK && dwStatus == DSBSTATUS_PLAYING)
continue;
DSBs[i]->Stop();
DSBs[i]->Release();
#else
if (!bStopAll && DSBs[i]->lpVtbl->GetStatus(DSBs[i], &dwStatus) == DS_OK && dwStatus == DSBSTATUS_PLAYING)
continue;
DSBs[i]->lpVtbl->Stop(DSBs[i]);
DSBs[i]->lpVtbl->Release(DSBs[i]);
#endif
DSBs[i] = NULL;
}
@ -70,11 +69,7 @@ void snd_update(BOOL bStopAll)
void snd_stop_snd(TSnd *pSnd)
{
if (pSnd && pSnd->DSB)
#ifdef __cplusplus
pSnd->DSB->Stop();
#else
pSnd->DSB->lpVtbl->Stop(pSnd->DSB);
#endif
}
BOOL snd_playing(TSnd *pSnd)
@ -87,11 +82,7 @@ BOOL snd_playing(TSnd *pSnd)
if (pSnd->DSB == NULL)
return FALSE;
#ifdef __cplusplus
if (pSnd->DSB->GetStatus(&dwStatus) != DS_OK)
#else
if (pSnd->DSB->lpVtbl->GetStatus(pSnd->DSB, &dwStatus) != DS_OK)
#endif
return FALSE;
return dwStatus == DSBSTATUS_PLAYING;
@ -108,7 +99,7 @@ void snd_play_snd(TSnd *pSnd, int lVolume, int lPan)
}
DSB = pSnd->DSB;
if (!DSB) {
if (DSB == NULL) {
return;
}
@ -131,28 +122,17 @@ void snd_play_snd(TSnd *pSnd, int lVolume, int lPan)
} else if (lVolume > VOLUME_MAX) {
lVolume = VOLUME_MAX;
}
#ifdef __cplusplus
DSB->SetVolume(lVolume);
DSB->SetPan(lPan);
error_code = DSB->Play(0, 0, 0);
#else
DSB->lpVtbl->SetVolume(DSB, lVolume);
DSB->lpVtbl->SetPan(DSB, lPan);
error_code = DSB->lpVtbl->Play(DSB, 0, 0, 0);
#endif
if (error_code != DSERR_BUFFERLOST) {
if (error_code != DS_OK) {
DSErrMsg(error_code, 261, "C:\\Src\\Diablo\\Source\\SOUND.CPP");
}
} else if (sound_file_reload(pSnd, DSB)) {
#ifdef __cplusplus
DSB->Play(0, 0, 0);
#else
DSB->lpVtbl->Play(DSB, 0, 0, 0);
#endif
}
pSnd->start_tc = tc;
@ -168,11 +148,7 @@ LPDIRECTSOUNDBUFFER sound_dup_channel(LPDIRECTSOUNDBUFFER DSB)
for (i = 0; i < 8; i++) {
if (!DSBs[i]) {
#ifdef __cplusplus
if (sglpDS->DuplicateSoundBuffer(DSB, &DSBs[i]) != DS_OK) {
#else
if (sglpDS->lpVtbl->DuplicateSoundBuffer(sglpDS, DSB, &DSBs[i]) != DS_OK) {
#endif
return NULL;
}
@ -190,31 +166,19 @@ BOOL sound_file_reload(TSnd *sound_file, LPDIRECTSOUNDBUFFER DSB)
DWORD size1, size2;
BOOL rv;
#ifdef __cplusplus
if (DSB->Restore() != DS_OK)
#else
if (DSB->lpVtbl->Restore(DSB) != DS_OK)
#endif
return FALSE;
rv = FALSE;
WOpenFile(sound_file->sound_path, &file, FALSE);
WSetFilePointer(file, sound_file->chunk.dwOffset, NULL, 0);
WSetFilePointer(file, sound_file->chunk.dwOffset, NULL, FILE_BEGIN);
#ifdef __cplusplus
if (DSB->Lock(0, sound_file->chunk.dwSize, &buf1, &size1, &buf2, &size2, 0) == DS_OK) {
WReadFile(file, buf1, size1);
if (DSB->Unlock(buf1, size1, buf2, size2) == DS_OK)
rv = TRUE;
}
#else
if (DSB->lpVtbl->Lock(DSB, 0, sound_file->chunk.dwSize, &buf1, &size1, &buf2, &size2, 0) == DS_OK) {
WReadFile(file, buf1, size1);
if (DSB->lpVtbl->Unlock(DSB, buf1, size1, buf2, size2) == DS_OK)
rv = TRUE;
}
#endif
WCloseFile(file);
@ -237,7 +201,7 @@ TSnd *sound_file_load(char *path)
pSnd = (TSnd *)DiabloAllocPtr(sizeof(TSnd));
memset(pSnd, 0, sizeof(TSnd));
pSnd->sound_path = path;
pSnd->start_tc = GetTickCount() - 81;
pSnd->start_tc = GetTickCount() - 80 - 1;
wave_file = LoadWaveFile(file, &pSnd->fmt, &pSnd->chunk);
if (!wave_file)
@ -245,21 +209,13 @@ TSnd *sound_file_load(char *path)
sound_CreateSoundBuffer(pSnd);
#ifdef __cplusplus
error_code = pSnd->DSB->Lock(0, pSnd->chunk.dwSize, &buf1, &size1, &buf2, &size2, 0);
#else
error_code = pSnd->DSB->lpVtbl->Lock(pSnd->DSB, 0, pSnd->chunk.dwSize, &buf1, &size1, &buf2, &size2, 0);
#endif
if (error_code != DS_OK)
DSErrMsg(error_code, 318, "C:\\Src\\Diablo\\Source\\SOUND.CPP");
memcpy(buf1, wave_file + pSnd->chunk.dwOffset, size1);
#ifdef __cplusplus
error_code = pSnd->DSB->Unlock(buf1, size1, buf2, size2);
#else
error_code = pSnd->DSB->lpVtbl->Unlock(pSnd->DSB, buf1, size1, buf2, size2);
#endif
if (error_code != DS_OK)
DSErrMsg(error_code, 325, "C:\\Src\\Diablo\\Source\\SOUND.CPP");
@ -275,16 +231,11 @@ void sound_CreateSoundBuffer(TSnd *sound_file)
HRESULT error_code;
memset(&DSB, 0, sizeof(DSBUFFERDESC));
DSB.dwBufferBytes = sound_file->chunk.dwSize;
DSB.lpwfxFormat = &sound_file->fmt;
DSB.dwSize = sizeof(DSBUFFERDESC);
DSB.dwFlags = DSBCAPS_CTRLVOLUME | DSBCAPS_CTRLPAN | DSBCAPS_STATIC;
#ifdef __cplusplus
DSB.dwBufferBytes = sound_file->chunk.dwSize;
DSB.lpwfxFormat = &sound_file->fmt;
error_code = sglpDS->CreateSoundBuffer(&DSB, &sound_file->DSB, NULL);
#else
error_code = sglpDS->lpVtbl->CreateSoundBuffer(sglpDS, &DSB, &sound_file->DSB, NULL);
#endif
if (error_code != ERROR_SUCCESS)
DSErrMsg(error_code, 282, "C:\\Src\\Diablo\\Source\\SOUND.CPP");
}
@ -293,13 +244,8 @@ void sound_file_cleanup(TSnd *sound_file)
{
if (sound_file) {
if (sound_file->DSB) {
#ifdef __cplusplus
sound_file->DSB->Stop();
sound_file->DSB->Release();
#else
sound_file->DSB->lpVtbl->Stop(sound_file->DSB);
sound_file->DSB->lpVtbl->Release(sound_file->DSB);
#endif
sound_file->DSB = NULL;
}
@ -320,11 +266,7 @@ void snd_init(HWND hWnd)
if (error_code != DS_OK)
sglpDS = NULL;
#ifdef __cplusplus
if (sglpDS && sglpDS->SetCooperativeLevel(hWnd, DSSCL_EXCLUSIVE) == DS_OK)
#else
if (sglpDS && sglpDS->lpVtbl->SetCooperativeLevel(sglpDS, hWnd, DSSCL_EXCLUSIVE) == DS_OK)
#endif
sound_create_primary_buffer(NULL);
SVidInitialize(sglpDS);
@ -355,16 +297,12 @@ void sound_create_primary_buffer(HANDLE music_track)
DSBUFFERDESC dsbuf;
WAVEFORMATEX format;
if (!music_track) {
if (music_track == NULL) {
memset(&dsbuf, 0, sizeof(DSBUFFERDESC));
dsbuf.dwSize = sizeof(DSBUFFERDESC);
dsbuf.dwFlags = DSBCAPS_PRIMARYBUFFER;
#ifdef __cplusplus
error_code = sglpDS->CreateSoundBuffer(&dsbuf, &sglpDSB, NULL);
#else
error_code = sglpDS->lpVtbl->CreateSoundBuffer(sglpDS, &dsbuf, &sglpDSB, NULL);
#endif
if (error_code != DS_OK)
DSErrMsg(error_code, 375, "C:\\Src\\Diablo\\Source\\SOUND.CPP");
}
@ -373,11 +311,7 @@ void sound_create_primary_buffer(HANDLE music_track)
DSCAPS dsbcaps;
dsbcaps.dwSize = sizeof(DSCAPS);
#ifdef __cplusplus
error_code = sglpDS->GetCaps(&dsbcaps);
#else
error_code = sglpDS->lpVtbl->GetCaps(sglpDS, &dsbcaps);
#endif
if (error_code != DS_OK)
DSErrMsg(error_code, 383, "C:\\Src\\Diablo\\Source\\SOUND.CPP");
@ -393,11 +327,7 @@ void sound_create_primary_buffer(HANDLE music_track)
format.nBlockAlign = format.nChannels * format.wBitsPerSample / 8;
format.nAvgBytesPerSec = format.nSamplesPerSec * format.nBlockAlign;
#ifdef __cplusplus
sglpDSB->SetFormat(&format);
#else
sglpDSB->lpVtbl->SetFormat(sglpDSB, &format);
#endif
}
}
@ -427,11 +357,7 @@ void sound_cleanup()
SFileDdaDestroy();
if (sglpDS) {
#ifdef __cplusplus
sglpDS->Release();
#else
sglpDS->lpVtbl->Release(sglpDS);
#endif
sglpDS = NULL;
}
@ -461,7 +387,7 @@ void music_start(int nTrack)
{
BOOL success;
/// ASSERT: assert((DWORD) nTrack < NUM_MUSIC);
assert((DWORD) nTrack < NUM_MUSIC);
music_stop();
if (sglpDS && gbMusicOn) {
#ifdef _DEBUG

39
Source/spelldat.cpp

@ -1,7 +1,7 @@
#include "all.h"
/** 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 },
@ -12,47 +12,70 @@ SpellData spelldata[MAX_SPELLS] = {
{ 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 },
#ifdef HELLFIRE
{ SPL_NOVA, 60, STYPE_MAGIC, "Nova", NULL, 14, 10, FALSE, FALSE, 87, IS_CAST4, { MIS_NOVA, 0, 0 }, 3, 35, 16, 32, 21000, 1300 },
#else
#ifndef HELLFIRE
{ SPL_NOVA, 60, STYPE_MAGIC, "Nova", NULL, -1, 10, FALSE, FALSE, 87, IS_CAST4, { MIS_NOVA, 0, 0 }, 3, 35, 16, 32, 21000, 1300 },
#else
{ SPL_NOVA, 60, STYPE_MAGIC, "Nova", NULL, 14, 10, FALSE, FALSE, 87, IS_CAST4, { MIS_NOVA, 0, 0 }, 3, 35, 16, 32, 21000, 1300 },
#endif
{ 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 },
#ifdef HELLFIRE
{ SPL_BLODBOIL, 15, STYPE_MAGIC, "Rage", "Rage", -1, -1, FALSE, FALSE, 0, IS_CAST8, { MIS_BLODBOIL, 0, 0 }, 1, 1, 0, 0, 0, 0 },
#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
#ifndef HELLFIRE
{ SPL_BLODBOIL, 0, STYPE_LIGHTNING, "Blood Boil", NULL, -1, -1, TRUE, FALSE, 0, IS_CAST8, { 0, 0, 0 }, 0, 0, 0, 0, 0, 0 },
#else
{ SPL_BLODBOIL, 15, STYPE_MAGIC, "Rage", "Rage", -1, -1, FALSE, FALSE, 0, IS_CAST8, { MIS_BLODBOIL, 0, 0 }, 1, 1, 0, 0, 0, 0 },
#endif
{ SPL_TELEPORT, 35, STYPE_MAGIC, "Teleport", NULL, 14, 12, TRUE, FALSE, 105, IS_CAST6, { MIS_TELEPORT, 0, 0 }, 3, 15, 16, 32, 20000, 1250 },
#ifdef HELLFIRE
#if !defined(SPAWN) && !defined(HELLFIRE)
{ SPL_APOCA, 150, STYPE_FIRE, "Apocalypse", NULL, -1, 15, FALSE, FALSE, 149, IS_CAST2, { MIS_APOCA, 0, 0 }, 6, 90, 8, 12, 30000, 2000 },
#elif !defined(SPAWN)
{ SPL_APOCA, 150, STYPE_FIRE, "Apocalypse", NULL, 19, 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, 15, FALSE, FALSE, 149, IS_CAST2, { MIS_APOCA, 0, 0 }, 6, 90, 8, 12, 30000, 2000 },
{ 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 },
#ifndef HELLFIRE
{ SPL_ELEMENT, 35, STYPE_FIRE, "Elemental", NULL, 8, 6, FALSE, FALSE, 68, IS_CAST2, { MIS_ELEMENT, 0, 0 }, 2, 20, 20, 60, 10500, 700 },
#else
{ SPL_ELEMENT, 35, STYPE_FIRE, "Elemental", NULL, -1, -1, FALSE, FALSE, 68, IS_CAST2, { MIS_ELEMENT, 0, 0 }, 2, 20, 20, 60, 10500, 700 },
#endif
{ 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
#ifdef HELLFIRE
{ SPL_MANA, 255, STYPE_MAGIC, "Mana", NULL, -1, 5, FALSE, TRUE, 17, IS_CAST8, { MIS_MANA, 0, 0 }, 3, 1, 12, 24, 1000, 50 },
{ SPL_MAGI, 255, STYPE_MAGIC, "the Magi", NULL, -1, 20, FALSE, TRUE, 45, IS_CAST8, { MIS_MAGI, 0, 0 }, 3, 1, 15, 30, 100000, 200 },

2
Source/spelldat.h

@ -2,6 +2,6 @@
#ifndef __SPELLDAT_H__
#define __SPELLDAT_H__
extern SpellData spelldata[MAX_SPELLS];
extern SpellData spelldata[];
#endif /* __SPELLDAT_H__ */

5
Source/tmsg.cpp

@ -38,10 +38,10 @@ void tmsg_add(BYTE *pbMsg, BYTE bLen)
void tmsg_start()
{
/// ASSERT: assert(! sgpTimedMsgHead);
assert(! sgpTimedMsgHead);
}
void *tmsg_cleanup()
void tmsg_cleanup()
{
TMsg *next;
@ -50,5 +50,4 @@ void *tmsg_cleanup()
MemFreeDbg(sgpTimedMsgHead);
sgpTimedMsgHead = next;
}
return sgpTimedMsgHead;
}

2
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__ */

4
Source/track.cpp

@ -22,7 +22,7 @@ void track_process()
sgdwLastWalk = tick;
NetSendCmdLoc(TRUE, CMD_WALKXY, cursmx, cursmy);
if (!sgbIsScrolling)
sgbIsScrolling = 1;
sgbIsScrolling = TRUE;
}
}
}
@ -38,7 +38,7 @@ void track_repeat_walk(BOOL rep)
sgdwLastWalk = GetTickCount() - 50;
NetSendCmdLoc(TRUE, CMD_WALKXY, cursmx, cursmy);
} else if (sgbIsScrolling) {
sgbIsScrolling = 0;
sgbIsScrolling = FALSE;
}
}

116
Source/trigs.cpp

@ -6,95 +6,31 @@ 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 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 };
#ifdef HELLFIRE
int TownCryptList[9] = { 1331, 1332, 1333, 1334, 1335, 1336, 1337, 1338, -1 };
int TownHiveList[5] = { 1307, 1308, 1309, 1310, -1 };
int TownCryptList[] = { 1331, 1332, 1333, 1334, 1335, 1336, 1337, 1338, -1 };
int TownHiveList[] = { 1307,1308,1309,1310, -1};
#endif
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 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 };
#ifdef HELLFIRE
int L5TWarpUpList[10] = { 172, 173, 174, 175, 176, 177, 178, 179, 184, -1 };
int L5UpList[11] = { 149, 150, 151, 152, 153, 154, 155, 157, 158, 159, -1 };
int L5DownList[10] = { 125, 126, 129, 131, 132, 135, 136, 140, 142, -1 };
int L6TWarpUpList[15] = { 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, -1 };
int L6UpList[15] = { 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, -1 };
int L6DownList[9] = { 57, 58, 59, 60, 61, 62, 63, 64, -1 };
int L5TWarpUpList[] = { 172, 173, 174, 175, 176, 177, 178, 179, 184, -1 };
int L5UpList[] = { 149, 150, 151, 152, 153, 154, 155, 157, 158, 159, -1 };
int L5DownList[] = { 125, 126, 129, 131, 132, 135, 136, 140, 142, -1 };
int L6TWarpUpList[] = { 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, -1 };
int L6UpList[] = { 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, -1 };
int L6DownList[] = { 57, 58, 59, 60, 61, 62, 63, 64, -1 };
#endif
#ifndef SPAWN
@ -147,7 +83,7 @@ void InitTownTriggers()
#endif
} else {
#endif
for (i = 0; i < 3; i++) {
for (i = 0; i < MAX_PLRS - 1; i++) {
townwarps[i] = FALSE;
}
#ifndef SPAWN
@ -209,7 +145,7 @@ void InitTownTriggers()
void InitL1Triggers()
{
int j, i;
int i, j;
numtrigs = 0;
#ifdef HELLFIRE
@ -830,7 +766,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;
@ -949,7 +885,7 @@ void CheckTriggers()
BOOL abort;
char abortflag;
if (plr[myplr]._pmode)
if (plr[myplr]._pmode != PM_STAND)
return;
for (i = 0; i < numtrigs; i++) {

2
comparer-config/diablo.toml

@ -1903,7 +1903,7 @@ addr = 0x41752C
size = 0x1F
[[func]]
name = "random"
name = "random_"
addr = 0x41754B
size = 0x22

2
comparer-config/hellfire.toml

@ -1973,7 +1973,7 @@ addr = 0x419F3B
size = 0x1F
[[func]]
name = "random"
name = "random_"
addr = 0x419F5A
size = 0x29

2
comparer-config/spawn.toml

@ -1373,7 +1373,7 @@ addr = 0x40F39C
size = 0x1F
[[func]]
name = "random"
name = "random_"
addr = 0x40F3BB
size = 0x22

1
defs.h

@ -100,6 +100,7 @@
// from diablo 2 beta
#define MAXEXP 2000000000
#define MAXRESIST 75
#define GOLD_SMALL_LIMIT 1000
#define GOLD_MEDIUM_LIMIT 2500

2
enums.h

@ -2742,11 +2742,9 @@ typedef enum _talker_id {
typedef enum _music_id {
TMUSIC_TOWN,
TMUSIC_L1,
#ifndef SPAWN
TMUSIC_L2,
TMUSIC_L3,
TMUSIC_L4,
#endif
#ifdef HELLFIRE
TMUSIC_L5,
TMUSIC_L6,

4
structs.h

@ -868,7 +868,7 @@ typedef struct TCmdChItem {
WORD wIndx;
WORD wCI;
int dwSeed;
BYTE bId;
BOOLEAN bId;
} TCmdChItem;
typedef struct TCmdDelItem {
@ -1599,7 +1599,7 @@ typedef struct STextStruct {
int _sx;
int _syoff;
char _sstr[128];
int _sjust;
BOOL _sjust;
char _sclr;
int _sline;
int _ssel;

Loading…
Cancel
Save