From 527914183617916d5b4c5a756fb48fd2cbaeb417 Mon Sep 17 00:00:00 2001 From: Joan Karadimov Date: Tue, 2 Jul 2019 04:06:24 +0300 Subject: [PATCH 01/42] Use the DMAXX/DMAXY constants where possible --- Source/drlg_l1.h | 2 +- Source/drlg_l2.cpp | 2 +- Source/drlg_l2.h | 2 +- Source/drlg_l3.cpp | 2 +- Source/drlg_l3.h | 2 +- 5 files changed, 5 insertions(+), 5 deletions(-) diff --git a/Source/drlg_l1.h b/Source/drlg_l1.h index 38e572e9aa3..0b8b6d786f4 100644 --- a/Source/drlg_l1.h +++ b/Source/drlg_l1.h @@ -3,7 +3,7 @@ #define __DRLG_L1_H__ extern char L5dungeon[80][80]; -extern BYTE L5dflags[40][40]; +extern BYTE L5dflags[DMAXX][DMAXY]; extern BOOL setloadflag; extern int HR1; extern int HR2; diff --git a/Source/drlg_l2.cpp b/Source/drlg_l2.cpp index 292114e1c86..ad4e00c08a4 100644 --- a/Source/drlg_l2.cpp +++ b/Source/drlg_l2.cpp @@ -5,7 +5,7 @@ int nSx2; // weak int nSy1; int nSy2; // weak int nRoomCnt; -unsigned char predungeon[40][40]; +unsigned char predungeon[DMAXX][DMAXX]; ROOMNODE RoomList[81]; HALLNODE *pHallList; diff --git a/Source/drlg_l2.h b/Source/drlg_l2.h index ea6df087c63..7abcefb23e7 100644 --- a/Source/drlg_l2.h +++ b/Source/drlg_l2.h @@ -7,7 +7,7 @@ extern int nSx2; // weak extern int nSy1; extern int nSy2; // weak extern int nRoomCnt; -extern unsigned char predungeon[40][40]; +extern unsigned char predungeon[DMAXX][DMAXX]; extern ROOMNODE RoomList[81]; extern HALLNODE *pHallList; diff --git a/Source/drlg_l3.cpp b/Source/drlg_l3.cpp index 2c4cfd2bd7f..503479de940 100644 --- a/Source/drlg_l3.cpp +++ b/Source/drlg_l3.cpp @@ -3,7 +3,7 @@ BOOLEAN lavapool; int abyssx; int lockoutcnt; -BOOLEAN lockout[40][40]; +BOOLEAN lockout[DMAXX][DMAXY]; const BYTE L3ConvTbl[16] = { 8, 11, 3, 10, 1, 9, 12, 12, 6, 13, 4, 13, 2, 14, 5, 7 }; const BYTE L3UP[20] = { 3, 3, 8, 8, 0, 10, 10, 0, 7, 7, 0, 51, 50, 0, 48, 49, 0, 0, 0, 0 }; diff --git a/Source/drlg_l3.h b/Source/drlg_l3.h index 4266d99b02e..5c5dedf58b1 100644 --- a/Source/drlg_l3.h +++ b/Source/drlg_l3.h @@ -5,7 +5,7 @@ extern BOOLEAN lavapool; extern int abyssx; extern int lockoutcnt; -extern BOOLEAN lockout[40][40]; +extern BOOLEAN lockout[DMAXX][DMAXY]; void AddFenceDoors(); void FenceDoorFix(); From ceafdf2337465793d7d7453cb06a8f50f0b5b395 Mon Sep 17 00:00:00 2001 From: galaxyhaxz Date: Wed, 3 Jul 2019 22:22:36 -0500 Subject: [PATCH 02/42] Add DRLG_L3 bugfix comment --- Source/drlg_l3.cpp | 1 + 1 file changed, 1 insertion(+) diff --git a/Source/drlg_l3.cpp b/Source/drlg_l3.cpp index 503479de940..fa72d7ff50e 100644 --- a/Source/drlg_l3.cpp +++ b/Source/drlg_l3.cpp @@ -789,6 +789,7 @@ void DRLG_L3River() rivercnt = 0; bail = FALSE; trys = 0; + /// BUGFIX: pdir is uninitialized, add code `pdir = -1;` while (trys < 200 && rivercnt < 4) { bail = FALSE; From d2cb6a59e7a111a5452bf2d479ba82ad4a8d60e1 Mon Sep 17 00:00:00 2001 From: Anders Jenbo Date: Sun, 23 Jun 2019 20:38:44 +0200 Subject: [PATCH 03/42] Apply scrollrt naming to town.cpp --- Source/scrollrt.cpp | 104 +++++++-------- Source/scrollrt.h | 2 +- Source/town.cpp | 304 +++++++++++++++++++++++--------------------- Source/town.h | 16 +-- 4 files changed, 221 insertions(+), 205 deletions(-) diff --git a/Source/scrollrt.cpp b/Source/scrollrt.cpp index 81a489830e4..c66109e5cfd 100644 --- a/Source/scrollrt.cpp +++ b/Source/scrollrt.cpp @@ -995,7 +995,7 @@ void DrawClippedObject(int x, int y, int ox, int oy, BOOL pre, int CelSkip, int Cel2DrawHdrOnly(sx, sy, object[bv]._oAnimData, object[bv]._oAnimFrame, object[bv]._oAnimWidth, CelSkip, CelCap); } -void scrollrt_draw_clipped_e_flag(BYTE *pBuff, int x, int y, int a4, int a5) +void scrollrt_draw_clipped_e_flag(BYTE *pBuff, int x, int y, int sx, int sy) { int i, lti_old, cta_old, lpi_old; BYTE *dst; @@ -1036,7 +1036,7 @@ void scrollrt_draw_clipped_e_flag(BYTE *pBuff, int x, int y, int a4, int a5) } } - scrollrt_draw_clipped_dungeon(pBuff, x, y, a4, a5, 0); + scrollrt_draw_clipped_dungeon(pBuff, x, y, sx, sy, 0); light_table_index = lti_old; cel_transparency_active = cta_old; @@ -1120,23 +1120,25 @@ void scrollrt_draw_lower_2(int x, int y, int sx, int sy, int chunks, int skipChu pMap++; } - if (eflag && (DWORD)y < MAXDUNY && (DWORD)x < MAXDUNX) { - level_piece_id = dPiece[x][y]; - light_table_index = dLight[x][y]; - if (level_piece_id != 0) { - dst = &gpBuffer[sx - BUFFER_WIDTH * 32 + PitchTbl[sy]]; - cel_transparency_active = (unsigned char)(nTransTable[level_piece_id] & TransList[dTransVal[x][y]]); - for (i = 0; i < (MicroTileLen >> 1) - 1; i++) { - if (skipChunks <= i) { - level_cel_block = pMap->mt[2 * i + 2]; - if (level_cel_block != 0) { - drawLowerScreen(dst); + if (eflag) { + if ((DWORD)y < MAXDUNY && (DWORD)x < MAXDUNX) { + level_piece_id = dPiece[x][y]; + light_table_index = dLight[x][y]; + if (level_piece_id != 0) { + dst = &gpBuffer[sx - BUFFER_WIDTH * 32 + PitchTbl[sy]]; + cel_transparency_active = (unsigned char)(nTransTable[level_piece_id] & TransList[dTransVal[x][y]]); + for (i = 0; i < (MicroTileLen >> 1) - 1; i++) { + if (skipChunks <= i) { + level_cel_block = pMap->mt[2 * i + 2]; + if (level_cel_block != 0) { + drawLowerScreen(dst); + } } + dst -= BUFFER_WIDTH * 32; + } + if (CelSkip < 8) { + scrollrt_draw_clipped_dungeon_2(&gpBuffer[sx + PitchTbl[sy] - BUFFER_WIDTH * 16 * CelSkip], x, y, skipChunks, CelSkip, sx, sy, 0); } - dst -= BUFFER_WIDTH * 32; - } - if (CelSkip < 8) { - scrollrt_draw_clipped_dungeon_2(&gpBuffer[sx + PitchTbl[sy] - BUFFER_WIDTH * 16 * CelSkip], x, y, skipChunks, CelSkip, sx, sy, 0); } } } @@ -1528,44 +1530,46 @@ void scrollrt_draw_upper(int x, int y, int sx, int sy, int chunks, int capChunks pMap++; } - if (eflag && y >= 0 && y < MAXDUNY && x >= 0 && x < MAXDUNX) { - level_piece_id = dPiece[x][y]; - light_table_index = dLight[x][y]; - if (level_piece_id != 0) { - dst = &gpBuffer[sx + PitchTbl[sy]]; - cel_transparency_active = (unsigned char)(nTransTable[level_piece_id] & TransList[dTransVal[x][y]]); - arch_draw_type = 1; - if (capChunks >= 0) { - level_cel_block = pMap->mt[0]; - if (level_cel_block != 0) { - drawUpperScreen(dst); + if (eflag) { + if (y >= 0 && y < MAXDUNY && x >= 0 && x < MAXDUNX) { + level_piece_id = dPiece[x][y]; + light_table_index = dLight[x][y]; + if (level_piece_id != 0) { + dst = &gpBuffer[sx + PitchTbl[sy]]; + cel_transparency_active = (unsigned char)(nTransTable[level_piece_id] & TransList[dTransVal[x][y]]); + arch_draw_type = 1; + if (capChunks >= 0) { + level_cel_block = pMap->mt[0]; + if (level_cel_block != 0) { + drawUpperScreen(dst); + } } - } - arch_draw_type = 0; - dst -= BUFFER_WIDTH * 32; - if (capChunks >= 1) { - level_cel_block = pMap->mt[2]; - if (level_cel_block != 0) { - drawUpperScreen(dst); + arch_draw_type = 0; + dst -= BUFFER_WIDTH * 32; + if (capChunks >= 1) { + level_cel_block = pMap->mt[2]; + if (level_cel_block != 0) { + drawUpperScreen(dst); + } } - } - dst -= BUFFER_WIDTH * 32; - if (capChunks >= 2) { - level_cel_block = pMap->mt[4]; - if (level_cel_block != 0) { - drawUpperScreen(dst); + dst -= BUFFER_WIDTH * 32; + if (capChunks >= 2) { + level_cel_block = pMap->mt[4]; + if (level_cel_block != 0) { + drawUpperScreen(dst); + } } - } - dst -= BUFFER_WIDTH * 32; - if (capChunks >= 3) { - level_cel_block = pMap->mt[6]; - if (level_cel_block != 0) { - drawUpperScreen(dst); + dst -= BUFFER_WIDTH * 32; + if (capChunks >= 3) { + level_cel_block = pMap->mt[6]; + if (level_cel_block != 0) { + drawUpperScreen(dst); + } } + scrollrt_draw_dungeon(&gpBuffer[sx + PitchTbl[sy]], x, y, capChunks, CelCap, sx, sy, 0); + } else { + world_draw_black_tile(&gpBuffer[sx + PitchTbl[sy]]); } - scrollrt_draw_dungeon(&gpBuffer[sx + PitchTbl[sy]], x, y, capChunks, CelCap, sx, sy, 0); - } else { - world_draw_black_tile(&gpBuffer[sx + PitchTbl[sy]]); } } } diff --git a/Source/scrollrt.h b/Source/scrollrt.h index baeac29ba9c..3510660c3f1 100644 --- a/Source/scrollrt.h +++ b/Source/scrollrt.h @@ -28,7 +28,7 @@ void DrawClippedObject(int x, int y, int ox, int oy, BOOL pre, int CelSkip, int void scrollrt_draw_clipped_e_flag(BYTE *pBuff, int x, int y, int sx, int sy); void scrollrt_draw_lower_2(int x, int y, int sx, int sy, int chunks, int skipChunks, int eflag); void scrollrt_draw_clipped_dungeon_2(BYTE *pBuff, int sx, int sy, int skipChunks, int CelSkip, int dx, int dy, int eflag); -void scrollrt_draw_clipped_e_flag_2(BYTE *pBuff, int x, int y, int skipChunks, signed int CelSkip, int sx, int sy); +void scrollrt_draw_clipped_e_flag_2(BYTE *pBuff, int x, int y, int skipChunks, int CelSkip, int sx, int sy); void scrollrt_draw_upper(int x, int y, int sx, int sy, int chunks, int capChunks, int eflag); void scrollrt_draw_dungeon(BYTE *pBuff, int sx, int sy, int capChunks, int CelCap, int dx, int dy, int eflag); void DrawMonster(int x, int y, int mx, int my, int m, int CelSkip, int CelCap); diff --git a/Source/town.cpp b/Source/town.cpp index 10e81e78ef4..13ba17cda8f 100644 --- a/Source/town.cpp +++ b/Source/town.cpp @@ -386,75 +386,75 @@ void town_draw_clipped_e_flag(BYTE *pBuff, int x, int y, int sx, int sy) town_draw_clipped_town(pBuff, x, y, sx, sy, 0); } -void town_draw_clipped_town(BYTE *pBuff, int x, int y, int sx, int sy, BOOL some_flag) +void town_draw_clipped_town(BYTE *pBuff, int sx, int sy, int dx, int dy, int eflag) { int mi, px, py; char bv; /// ASSERT: assert(gpBuffer); - pBuff = &gpBuffer[sx + PitchTbl[sy]]; + pBuff = &gpBuffer[dx + PitchTbl[dy]]; - if (dItem[x][y] != 0) { - bv = dItem[x][y] - 1; - px = sx - item[bv]._iAnimWidth2; + if (dItem[sx][sy] != 0) { + bv = dItem[sx][sy] - 1; + px = dx - item[bv]._iAnimWidth2; if (bv == pcursitem) { - CelDrawHdrClrHL(181, px, sy, item[bv]._iAnimData, item[bv]._iAnimFrame, item[bv]._iAnimWidth, 0, 8); + CelDrawHdrClrHL(181, px, dy, item[bv]._iAnimData, item[bv]._iAnimFrame, item[bv]._iAnimWidth, 0, 8); } - Cel2DrawHdrOnly(px, sy, item[bv]._iAnimData, item[bv]._iAnimFrame, item[bv]._iAnimWidth, 0, 8); + Cel2DrawHdrOnly(px, dy, item[bv]._iAnimData, item[bv]._iAnimFrame, item[bv]._iAnimWidth, 0, 8); } - if (dFlags[x][y] & BFLAG_MONSTLR) { - mi = -(dMonster[x][y - 1] + 1); - px = sx - towner[mi]._tAnimWidth2; + if (dFlags[sx][sy] & BFLAG_MONSTLR) { + mi = -(dMonster[sx][sy - 1] + 1); + px = dx - towner[mi]._tAnimWidth2; if (mi == pcursmonst) { - CelDrawHdrClrHL(166, px, sy, towner[mi]._tAnimData, towner[mi]._tAnimFrame, towner[mi]._tAnimWidth, 0, 8); + CelDrawHdrClrHL(166, px, dy, towner[mi]._tAnimData, towner[mi]._tAnimFrame, towner[mi]._tAnimWidth, 0, 8); } - Cel2DrawHdrOnly(px, sy, towner[mi]._tAnimData, towner[mi]._tAnimFrame, towner[mi]._tAnimWidth, 0, 8); + Cel2DrawHdrOnly(px, dy, towner[mi]._tAnimData, towner[mi]._tAnimFrame, towner[mi]._tAnimWidth, 0, 8); } - if (dMonster[x][y] > 0) { - mi = dMonster[x][y] - 1; - px = sx - towner[mi]._tAnimWidth2; + if (dMonster[sx][sy] > 0) { + mi = dMonster[sx][sy] - 1; + px = dx - towner[mi]._tAnimWidth2; if (mi == pcursmonst) { - CelDrawHdrClrHL(166, px, sy, towner[mi]._tAnimData, towner[mi]._tAnimFrame, towner[mi]._tAnimWidth, 0, 8); + CelDrawHdrClrHL(166, px, dy, towner[mi]._tAnimData, towner[mi]._tAnimFrame, towner[mi]._tAnimWidth, 0, 8); } - Cel2DrawHdrOnly(px, sy, towner[mi]._tAnimData, towner[mi]._tAnimFrame, towner[mi]._tAnimWidth, 0, 8); + Cel2DrawHdrOnly(px, dy, towner[mi]._tAnimData, towner[mi]._tAnimFrame, towner[mi]._tAnimWidth, 0, 8); } - if (dFlags[x][y] & BFLAG_PLAYERLR) { - bv = -(dPlayer[x][y - 1] + 1); - px = sx + plr[bv]._pxoff - plr[bv]._pAnimWidth2; - py = sy + plr[bv]._pyoff; + if (dFlags[sx][sy] & BFLAG_PLAYERLR) { + bv = -(dPlayer[sx][sy - 1] + 1); + px = dx + plr[bv]._pxoff - plr[bv]._pAnimWidth2; + py = dy + plr[bv]._pyoff; if (bv == pcursplr) { Cl2DecodeClrHL(165, px, py, plr[bv]._pAnimData, plr[bv]._pAnimFrame, plr[bv]._pAnimWidth, 0, 8); } Cl2DecodeFrm4(px, py, plr[bv]._pAnimData, plr[bv]._pAnimFrame, plr[bv]._pAnimWidth, 0, 8); - if (some_flag && plr[bv]._peflag) { - town_draw_clipped_e_flag(pBuff - 64, x - 1, y + 1, sx - 64, sy); + if (eflag && plr[bv]._peflag) { + town_draw_clipped_e_flag(pBuff - 64, sx - 1, sy + 1, dx - 64, dy); } } - if (dFlags[x][y] & BFLAG_DEAD_PLAYER) { - DrawDeadPlayer(x, y, sx, sy, 0, 8, 1); + if (dFlags[sx][sy] & BFLAG_DEAD_PLAYER) { + DrawDeadPlayer(sx, sy, dx, dy, 0, 8, 1); } - if (dPlayer[x][y] > 0) { - bv = dPlayer[x][y] - 1; - px = sx + plr[bv]._pxoff - plr[bv]._pAnimWidth2; - py = sy + plr[bv]._pyoff; + if (dPlayer[sx][sy] > 0) { + bv = dPlayer[sx][sy] - 1; + px = dx + plr[bv]._pxoff - plr[bv]._pAnimWidth2; + py = dy + plr[bv]._pyoff; if (bv == pcursplr) { Cl2DecodeClrHL(165, px, py, plr[bv]._pAnimData, plr[bv]._pAnimFrame, plr[bv]._pAnimWidth, 0, 8); } Cl2DecodeFrm4(px, py, plr[bv]._pAnimData, plr[bv]._pAnimFrame, plr[bv]._pAnimWidth, 0, 8); - if (some_flag && plr[bv]._peflag) { - town_draw_clipped_e_flag(pBuff - 64, x - 1, y + 1, sx - 64, sy); + if (eflag && plr[bv]._peflag) { + town_draw_clipped_e_flag(pBuff - 64, sx - 1, sy + 1, dx - 64, dy); } } - if (dFlags[x][y] & BFLAG_MISSILE) { - DrawClippedMissile(x, y, sx, sy, 0, 8, 0); + if (dFlags[sx][sy] & BFLAG_MISSILE) { + DrawClippedMissile(sx, sy, dx, dy, 0, 8, 0); } - if (dArch[x][y] != 0) { - town_special_lower(pBuff, dArch[x][y]); + if (dArch[sx][sy] != 0) { + town_special_lower(pBuff, dArch[sx][sy]); } } -void town_draw_lower(int x, int y, int sx, int sy, int a5, int some_flag) +void town_draw_lower(int x, int y, int sx, int sy, int chunks, int eflag) { int i, j; BYTE *dst; @@ -462,7 +462,7 @@ void town_draw_lower(int x, int y, int sx, int sy, int a5, int some_flag) /// ASSERT: assert(gpBuffer); - if (some_flag) { + if (eflag) { if (y >= 0 && y < MAXDUNY && x >= 0 && x < MAXDUNX) { level_cel_block = dPiece[x][y]; if (level_cel_block != 0) { @@ -487,7 +487,7 @@ void town_draw_lower(int x, int y, int sx, int sy, int a5, int some_flag) sx += 64; } - for (j = 0; j < a5 - some_flag; j++) { + for (j = 0; j < chunks - eflag; j++) { if (y >= 0 && y < MAXDUNY && x >= 0 && x < MAXDUNX) { level_cel_block = dPiece[x][y]; if (level_cel_block != 0) { @@ -516,7 +516,7 @@ void town_draw_lower(int x, int y, int sx, int sy, int a5, int some_flag) sx += 64; } - if (some_flag) { + if (eflag) { if (y >= 0 && y < MAXDUNY && x >= 0 && x < MAXDUNX) { level_cel_block = dPiece[x][y]; if (level_cel_block != 0) { @@ -539,22 +539,22 @@ void town_draw_lower(int x, int y, int sx, int sy, int a5, int some_flag) } } -void town_draw_clipped_e_flag_2(BYTE *pBuff, int x, int y, int a4, int a5, int sx, int sy) +void town_draw_clipped_e_flag_2(BYTE *pBuff, int x, int y, int skipChunks, int CelSkip, int sx, int sy) { int i; BYTE *dst; MICROS *pMap; - if (a4 == 0) { + if (skipChunks == 0) { dst = pBuff; } else { - dst = &pBuff[BUFFER_WIDTH * 32 * a4]; + dst = &pBuff[BUFFER_WIDTH * 32 * skipChunks]; } pMap = &dpiece_defs_map_1[IsometricCoord(x, y)]; for (i = 0; i < 6; i++) { - if (a4 <= i) { + if (skipChunks <= i) { level_cel_block = pMap->mt[2 * i + 2]; if (level_cel_block != 0) { drawLowerScreen(dst); @@ -567,93 +567,93 @@ void town_draw_clipped_e_flag_2(BYTE *pBuff, int x, int y, int a4, int a5, int s dst -= BUFFER_WIDTH * 32; } - if (a5 < 8) { - town_draw_clipped_town_2(pBuff, x, y, a4, a5, sx, sy, 0); + if (CelSkip < 8) { + town_draw_clipped_town_2(pBuff, x, y, skipChunks, CelSkip, sx, sy, 0); } } -void town_draw_clipped_town_2(BYTE *pBuff, int x, int y, int a4, int a5, int sx, int sy, BOOL some_flag) +void town_draw_clipped_town_2(BYTE *pBuff, int sx, int sy, int skipChunks, int CelSkip, int dx, int dy, int eflag) { int mi, px, py; char bv; - if (dItem[x][y] != 0) { - bv = dItem[x][y] - 1; - px = sx - item[bv]._iAnimWidth2; + if (dItem[sx][sy] != 0) { + bv = dItem[sx][sy] - 1; + px = dx - item[bv]._iAnimWidth2; if (bv == pcursitem) { - CelDrawHdrClrHL(181, px, sy, item[bv]._iAnimData, item[bv]._iAnimFrame, item[bv]._iAnimWidth, a5, 8); + CelDrawHdrClrHL(181, px, dy, item[bv]._iAnimData, item[bv]._iAnimFrame, item[bv]._iAnimWidth, CelSkip, 8); } - Cel2DrawHdrOnly(px, sy, item[bv]._iAnimData, item[bv]._iAnimFrame, item[bv]._iAnimWidth, a5, 8); + Cel2DrawHdrOnly(px, dy, item[bv]._iAnimData, item[bv]._iAnimFrame, item[bv]._iAnimWidth, CelSkip, 8); } - if (dFlags[x][y] & BFLAG_MONSTLR) { - mi = -(dMonster[x][y - 1] + 1); - px = sx - towner[mi]._tAnimWidth2; + if (dFlags[sx][sy] & BFLAG_MONSTLR) { + mi = -(dMonster[sx][sy - 1] + 1); + px = dx - towner[mi]._tAnimWidth2; if (mi == pcursmonst) { - CelDrawHdrClrHL(166, px, sy, towner[mi]._tAnimData, towner[mi]._tAnimFrame, towner[mi]._tAnimWidth, a5, 8); + CelDrawHdrClrHL(166, px, dy, towner[mi]._tAnimData, towner[mi]._tAnimFrame, towner[mi]._tAnimWidth, CelSkip, 8); } - Cel2DrawHdrOnly(px, sy, towner[mi]._tAnimData, towner[mi]._tAnimFrame, towner[mi]._tAnimWidth, a5, 8); + Cel2DrawHdrOnly(px, dy, towner[mi]._tAnimData, towner[mi]._tAnimFrame, towner[mi]._tAnimWidth, CelSkip, 8); } - if (dMonster[x][y] > 0) { - mi = dMonster[x][y] - 1; - px = sx - towner[mi]._tAnimWidth2; + if (dMonster[sx][sy] > 0) { + mi = dMonster[sx][sy] - 1; + px = dx - towner[mi]._tAnimWidth2; if (mi == pcursmonst) { - CelDrawHdrClrHL(166, px, sy, towner[mi]._tAnimData, towner[mi]._tAnimFrame, towner[mi]._tAnimWidth, a5, 8); + CelDrawHdrClrHL(166, px, dy, towner[mi]._tAnimData, towner[mi]._tAnimFrame, towner[mi]._tAnimWidth, CelSkip, 8); } - Cel2DrawHdrOnly(px, sy, towner[mi]._tAnimData, towner[mi]._tAnimFrame, towner[mi]._tAnimWidth, a5, 8); + Cel2DrawHdrOnly(px, dy, towner[mi]._tAnimData, towner[mi]._tAnimFrame, towner[mi]._tAnimWidth, CelSkip, 8); } - if (dFlags[x][y] & BFLAG_PLAYERLR) { - bv = -(dPlayer[x][y - 1] + 1); - px = sx + plr[bv]._pxoff - plr[bv]._pAnimWidth2; - py = sy + plr[bv]._pyoff; + if (dFlags[sx][sy] & BFLAG_PLAYERLR) { + bv = -(dPlayer[sx][sy - 1] + 1); + px = dx + plr[bv]._pxoff - plr[bv]._pAnimWidth2; + py = dy + plr[bv]._pyoff; if (bv == pcursplr) { - Cl2DecodeClrHL(165, px, py, plr[bv]._pAnimData, plr[bv]._pAnimFrame, plr[bv]._pAnimWidth, a5, 8); + Cl2DecodeClrHL(165, px, py, plr[bv]._pAnimData, plr[bv]._pAnimFrame, plr[bv]._pAnimWidth, CelSkip, 8); } - Cl2DecodeFrm4(px, py, plr[bv]._pAnimData, plr[bv]._pAnimFrame, plr[bv]._pAnimWidth, a5, 8); - if (some_flag && plr[bv]._peflag) { - town_draw_clipped_e_flag_2(pBuff - 64, x - 1, y + 1, a4, a5, sx - 64, sy); + Cl2DecodeFrm4(px, py, plr[bv]._pAnimData, plr[bv]._pAnimFrame, plr[bv]._pAnimWidth, CelSkip, 8); + if (eflag && plr[bv]._peflag) { + town_draw_clipped_e_flag_2(pBuff - 64, sx - 1, sy + 1, skipChunks, CelSkip, dx - 64, dy); } } - if (dFlags[x][y] & BFLAG_DEAD_PLAYER) { - DrawDeadPlayer(x, y, sx, sy, a5, 8, 1); + if (dFlags[sx][sy] & BFLAG_DEAD_PLAYER) { + DrawDeadPlayer(sx, sy, dx, dy, CelSkip, 8, 1); } - if (dPlayer[x][y] > 0) { - bv = dPlayer[x][y] - 1; - px = sx + plr[bv]._pxoff - plr[bv]._pAnimWidth2; - py = sy + plr[bv]._pyoff; + if (dPlayer[sx][sy] > 0) { + bv = dPlayer[sx][sy] - 1; + px = dx + plr[bv]._pxoff - plr[bv]._pAnimWidth2; + py = dy + plr[bv]._pyoff; if (bv == pcursplr) { - Cl2DecodeClrHL(165, px, py, plr[bv]._pAnimData, plr[bv]._pAnimFrame, plr[bv]._pAnimWidth, a5, 8); + Cl2DecodeClrHL(165, px, py, plr[bv]._pAnimData, plr[bv]._pAnimFrame, plr[bv]._pAnimWidth, CelSkip, 8); } - Cl2DecodeFrm4(px, py, plr[bv]._pAnimData, plr[bv]._pAnimFrame, plr[bv]._pAnimWidth, a5, 8); - if (some_flag && plr[bv]._peflag) { - town_draw_clipped_e_flag_2(pBuff - 64, x - 1, y + 1, a4, a5, sx - 64, sy); + Cl2DecodeFrm4(px, py, plr[bv]._pAnimData, plr[bv]._pAnimFrame, plr[bv]._pAnimWidth, CelSkip, 8); + if (eflag && plr[bv]._peflag) { + town_draw_clipped_e_flag_2(pBuff - 64, sx - 1, sy + 1, skipChunks, CelSkip, dx - 64, dy); } } - if (dFlags[x][y] & BFLAG_MISSILE) { - DrawClippedMissile(x, y, sx, sy, a5, 8, 0); + if (dFlags[sx][sy] & BFLAG_MISSILE) { + DrawClippedMissile(sx, sy, dx, dy, CelSkip, 8, 0); } - if (dArch[x][y] != 0) { - town_special_lower(&pBuff[PitchTbl[16 * a5]], dArch[x][y]); + if (dArch[sx][sy] != 0) { + town_special_lower(&pBuff[PitchTbl[16 * CelSkip]], dArch[sx][sy]); } } -void town_draw_lower_2(int x, int y, int sx, int sy, int a5, int a6, int some_flag) +void town_draw_lower_2(int x, int y, int sx, int sy, int chunks, int skipChunks, int eflag) { - int i, j, dir; + int i, j, CelSkip; BYTE *dst; MICROS *pMap; /// ASSERT: assert(gpBuffer); - dir = 2 * a6 + 2; + CelSkip = 2 * skipChunks + 2; - if (some_flag) { + if (eflag) { if (y >= 0 && y < MAXDUNY && x >= 0 && x < MAXDUNX) { level_cel_block = dPiece[x][y]; if (level_cel_block != 0) { dst = &gpBuffer[sx - (BUFFER_WIDTH * 32 - 32) + PitchTbl[sy]]; pMap = &dpiece_defs_map_1[IsometricCoord(x, y)]; for (i = 0; i < 7; i++) { - if (a6 <= i) { + if (skipChunks <= i) { level_cel_block = pMap->mt[2 * i + 3]; if (level_cel_block != 0) { drawLowerScreen(dst); @@ -661,8 +661,8 @@ void town_draw_lower_2(int x, int y, int sx, int sy, int a5, int a6, int some_fl } dst -= BUFFER_WIDTH * 32; } - if (dir < 8) { - town_draw_clipped_town_2(&gpBuffer[sx + PitchTbl[sy]], x, y, a6, dir, sx, sy, 0); + if (CelSkip < 8) { + town_draw_clipped_town_2(&gpBuffer[sx + PitchTbl[sy]], x, y, skipChunks, CelSkip, sx, sy, 0); } } else { town_clear_low_buf(&gpBuffer[sx + PitchTbl[sy]]); @@ -675,14 +675,14 @@ void town_draw_lower_2(int x, int y, int sx, int sy, int a5, int a6, int some_fl sx += 64; } - for (j = 0; j < a5 - some_flag; j++) { + for (j = 0; j < chunks - eflag; j++) { if (y >= 0 && y < MAXDUNY && x >= 0 && x < MAXDUNX) { level_cel_block = dPiece[x][y]; if (level_cel_block != 0) { dst = &gpBuffer[sx - BUFFER_WIDTH * 32 + PitchTbl[sy]]; pMap = &dpiece_defs_map_1[IsometricCoord(x, y)]; for (i = 0; i < 7; i++) { - if (a6 <= i) { + if (skipChunks <= i) { level_cel_block = pMap->mt[2 * i + 2]; if (level_cel_block != 0) { drawLowerScreen(dst); @@ -694,8 +694,8 @@ void town_draw_lower_2(int x, int y, int sx, int sy, int a5, int a6, int some_fl } dst -= BUFFER_WIDTH * 32; } - if (dir < 8) { - town_draw_clipped_town_2(&gpBuffer[sx + PitchTbl[sy] - BUFFER_WIDTH * 16 * dir], x, y, a6, dir, sx, sy, 1); + if (CelSkip < 8) { + town_draw_clipped_town_2(&gpBuffer[sx + PitchTbl[sy] - BUFFER_WIDTH * 16 * CelSkip], x, y, skipChunks, CelSkip, sx, sy, 1); } } else { town_clear_low_buf(&gpBuffer[sx + PitchTbl[sy]]); @@ -708,14 +708,14 @@ void town_draw_lower_2(int x, int y, int sx, int sy, int a5, int a6, int some_fl sx += 64; } - if (some_flag) { + if (eflag) { if (y >= 0 && y < MAXDUNY && x >= 0 && x < MAXDUNX) { level_cel_block = dPiece[x][y]; if (level_cel_block != 0) { dst = &gpBuffer[sx - BUFFER_WIDTH * 32 + PitchTbl[sy]]; pMap = &dpiece_defs_map_1[IsometricCoord(x, y)]; for (i = 0; i < 7; i++) { - if (a6 <= i) { + if (skipChunks <= i) { level_cel_block = pMap->mt[2 * i + 2]; if (level_cel_block != 0) { drawLowerScreen(dst); @@ -723,8 +723,8 @@ void town_draw_lower_2(int x, int y, int sx, int sy, int a5, int a6, int some_fl } dst -= BUFFER_WIDTH * 32; } - if (dir < 8) { - town_draw_clipped_town_2(&gpBuffer[sx + PitchTbl[sy]], x, y, a6, dir, sx, sy, 0); + if (CelSkip < 8) { + town_draw_clipped_town_2(&gpBuffer[sx + PitchTbl[sy]], x, y, skipChunks, CelSkip, sx, sy, 0); } } else { town_clear_low_buf(&gpBuffer[sx + PitchTbl[sy]]); @@ -735,7 +735,7 @@ void town_draw_lower_2(int x, int y, int sx, int sy, int a5, int a6, int some_fl } } -void town_draw_e_flag(BYTE *pBuff, int x, int y, int a4, int dir, int sx, int sy) +void town_draw_e_flag(BYTE *pBuff, int x, int y, int capChunks, int CelCap, int sx, int sy) { int i; BYTE *dst; @@ -745,7 +745,7 @@ void town_draw_e_flag(BYTE *pBuff, int x, int y, int a4, int dir, int sx, int sy pMap = &dpiece_defs_map_1[IsometricCoord(x, y)]; for (i = 0; i < 7; i++) { - if (a4 >= i) { + if (capChunks >= i) { level_cel_block = pMap->mt[2 * i]; if (level_cel_block != 0) { drawUpperScreen(dst); @@ -758,10 +758,10 @@ void town_draw_e_flag(BYTE *pBuff, int x, int y, int a4, int dir, int sx, int sy dst -= BUFFER_WIDTH * 32; } - town_draw_town_all(pBuff, x, y, a4, dir, sx, sy, 0); + town_draw_town_all(pBuff, x, y, capChunks, CelCap, sx, sy, 0); } -void town_draw_town_all(BYTE *pBuff, int x, int y, int a4, int dir, int sx, int sy, BOOL some_flag) +void town_draw_town_all(BYTE *pBuff, int x, int y, int capChunks, int CelCap, int sx, int sy, int eflag) { int mi, px, py; char bv; @@ -770,87 +770,87 @@ void town_draw_town_all(BYTE *pBuff, int x, int y, int a4, int dir, int sx, int bv = dItem[x][y] - 1; px = sx - item[bv]._iAnimWidth2; if (bv == pcursitem) { - CelDecodeClr(181, px, sy, item[bv]._iAnimData, item[bv]._iAnimFrame, item[bv]._iAnimWidth, 0, dir); + CelDecodeClr(181, px, sy, item[bv]._iAnimData, item[bv]._iAnimFrame, item[bv]._iAnimWidth, 0, CelCap); } /// ASSERT: assert(item[bv]._iAnimData); - CelDrawHdrOnly(px, sy, item[bv]._iAnimData, item[bv]._iAnimFrame, item[bv]._iAnimWidth, 0, dir); + CelDrawHdrOnly(px, sy, item[bv]._iAnimData, item[bv]._iAnimFrame, item[bv]._iAnimWidth, 0, CelCap); } if (dFlags[x][y] & BFLAG_MONSTLR) { mi = -(dMonster[x][y - 1] + 1); px = sx - towner[mi]._tAnimWidth2; if (mi == pcursmonst) { - CelDecodeClr(166, px, sy, towner[mi]._tAnimData, towner[mi]._tAnimFrame, towner[mi]._tAnimWidth, 0, dir); + CelDecodeClr(166, px, sy, towner[mi]._tAnimData, towner[mi]._tAnimFrame, towner[mi]._tAnimWidth, 0, CelCap); } /// ASSERT: assert(towner[mi]._tAnimData); - CelDrawHdrOnly(px, sy, towner[mi]._tAnimData, towner[mi]._tAnimFrame, towner[mi]._tAnimWidth, 0, dir); + CelDrawHdrOnly(px, sy, towner[mi]._tAnimData, towner[mi]._tAnimFrame, towner[mi]._tAnimWidth, 0, CelCap); } if (dMonster[x][y] > 0) { mi = dMonster[x][y] - 1; px = sx - towner[mi]._tAnimWidth2; if (mi == pcursmonst) { - CelDecodeClr(166, px, sy, towner[mi]._tAnimData, towner[mi]._tAnimFrame, towner[mi]._tAnimWidth, 0, dir); + CelDecodeClr(166, px, sy, towner[mi]._tAnimData, towner[mi]._tAnimFrame, towner[mi]._tAnimWidth, 0, CelCap); } /// ASSERT: assert(towner[mi]._tAnimData); - CelDrawHdrOnly(px, sy, towner[mi]._tAnimData, towner[mi]._tAnimFrame, towner[mi]._tAnimWidth, 0, dir); + CelDrawHdrOnly(px, sy, towner[mi]._tAnimData, towner[mi]._tAnimFrame, towner[mi]._tAnimWidth, 0, CelCap); } if (dFlags[x][y] & BFLAG_PLAYERLR) { bv = -(dPlayer[x][y - 1] + 1); px = sx + plr[bv]._pxoff - plr[bv]._pAnimWidth2; py = sy + plr[bv]._pyoff; if (bv == pcursplr) { - Cl2DecodeFrm2(165, px, py, plr[bv]._pAnimData, plr[bv]._pAnimFrame, plr[bv]._pAnimWidth, 0, dir); + Cl2DecodeFrm2(165, px, py, plr[bv]._pAnimData, plr[bv]._pAnimFrame, plr[bv]._pAnimWidth, 0, CelCap); } /// ASSERT: assert(plr[bv]._pAnimData); - Cl2DecodeFrm1(px, py, plr[bv]._pAnimData, plr[bv]._pAnimFrame, plr[bv]._pAnimWidth, 0, dir); - if (some_flag && plr[bv]._peflag) { - town_draw_e_flag(pBuff - 64, x - 1, y + 1, a4, dir, sx - 64, sy); + Cl2DecodeFrm1(px, py, plr[bv]._pAnimData, plr[bv]._pAnimFrame, plr[bv]._pAnimWidth, 0, CelCap); + if (eflag && plr[bv]._peflag) { + town_draw_e_flag(pBuff - 64, x - 1, y + 1, capChunks, CelCap, sx - 64, sy); } } if (dFlags[x][y] & BFLAG_DEAD_PLAYER) { - DrawDeadPlayer(x, y, sx, sy, 0, dir, 0); + DrawDeadPlayer(x, y, sx, sy, 0, CelCap, 0); } if (dPlayer[x][y] > 0) { bv = dPlayer[x][y] - 1; px = sx + plr[bv]._pxoff - plr[bv]._pAnimWidth2; py = sy + plr[bv]._pyoff; if (bv == pcursplr) { - Cl2DecodeFrm2(165, px, py, plr[bv]._pAnimData, plr[bv]._pAnimFrame, plr[bv]._pAnimWidth, 0, dir); + Cl2DecodeFrm2(165, px, py, plr[bv]._pAnimData, plr[bv]._pAnimFrame, plr[bv]._pAnimWidth, 0, CelCap); } /// ASSERT: assert(plr[bv]._pAnimData); - Cl2DecodeFrm1(px, py, plr[bv]._pAnimData, plr[bv]._pAnimFrame, plr[bv]._pAnimWidth, 0, dir); - if (some_flag && plr[bv]._peflag) { - town_draw_e_flag(pBuff - 64, x - 1, y + 1, a4, dir, sx - 64, sy); + Cl2DecodeFrm1(px, py, plr[bv]._pAnimData, plr[bv]._pAnimFrame, plr[bv]._pAnimWidth, 0, CelCap); + if (eflag && plr[bv]._peflag) { + town_draw_e_flag(pBuff - 64, x - 1, y + 1, capChunks, CelCap, sx - 64, sy); } } if (dFlags[x][y] & BFLAG_MISSILE) { - DrawMissile(x, y, sx, sy, 0, dir, 0); + DrawMissile(x, y, sx, sy, 0, CelCap, 0); } if (dArch[x][y] != 0) { town_special_upper(pBuff, dArch[x][y]); } } -void town_draw_upper(int x, int y, int sx, int sy, int a5, int a6, int some_flag) +void town_draw_upper(int x, int y, int sx, int sy, int chunks, int capChunks, int eflag) { - int i, j, dir; + int i, j, CelCap; BYTE *dst; MICROS *pMap; /// ASSERT: assert(gpBuffer); - dir = 2 * a6 + 2; - if (dir > 8) { - dir = 8; + CelCap = 2 * capChunks + 2; + if (CelCap > 8) { + CelCap = 8; } - if (some_flag) { + if (eflag) { if (y >= 0 && y < MAXDUNY && x >= 0 && x < MAXDUNX) { level_cel_block = dPiece[x][y]; if (level_cel_block != 0) { dst = &gpBuffer[sx + 32 + PitchTbl[sy]]; pMap = &dpiece_defs_map_1[IsometricCoord(x, y)]; for (i = 0; i < 7; i++) { - if (a6 >= i) { + if (capChunks >= i) { level_cel_block = pMap->mt[2 * i + 1]; if (level_cel_block != 0) { drawUpperScreen(dst); @@ -858,7 +858,7 @@ void town_draw_upper(int x, int y, int sx, int sy, int a5, int a6, int some_flag } dst -= BUFFER_WIDTH * 32; } - town_draw_town_all(&gpBuffer[sx + PitchTbl[sy]], x, y, a6, dir, sx, sy, 0); + town_draw_town_all(&gpBuffer[sx + PitchTbl[sy]], x, y, capChunks, CelCap, sx, sy, 0); } else { town_clear_upper_buf(&gpBuffer[sx + PitchTbl[sy]]); } @@ -870,14 +870,14 @@ void town_draw_upper(int x, int y, int sx, int sy, int a5, int a6, int some_flag sx += 64; } - for (j = 0; j < a5 - some_flag; j++) { + for (j = 0; j < chunks - eflag; j++) { if (y >= 0 && y < MAXDUNY && x >= 0 && x < MAXDUNX) { level_cel_block = dPiece[x][y]; if (level_cel_block != 0) { dst = &gpBuffer[sx + PitchTbl[sy]]; pMap = &dpiece_defs_map_1[IsometricCoord(x, y)]; for (i = 0; i < 7; i++) { - if (a6 >= i) { + if (capChunks >= i) { level_cel_block = pMap->mt[2 * i]; if (level_cel_block != 0) { drawUpperScreen(dst); @@ -889,7 +889,7 @@ void town_draw_upper(int x, int y, int sx, int sy, int a5, int a6, int some_flag } dst -= BUFFER_WIDTH * 32; } - town_draw_town_all(&gpBuffer[sx + PitchTbl[sy]], x, y, a6, dir, sx, sy, 1); + town_draw_town_all(&gpBuffer[sx + PitchTbl[sy]], x, y, capChunks, CelCap, sx, sy, 1); } else { town_clear_upper_buf(&gpBuffer[sx + PitchTbl[sy]]); } @@ -901,14 +901,14 @@ void town_draw_upper(int x, int y, int sx, int sy, int a5, int a6, int some_flag sx += 64; } - if (some_flag) { + if (eflag) { if (y >= 0 && y < MAXDUNY && x >= 0 && x < MAXDUNX) { level_cel_block = dPiece[x][y]; if (level_cel_block != 0) { dst = &gpBuffer[sx + PitchTbl[sy]]; pMap = &dpiece_defs_map_1[IsometricCoord(x, y)]; for (i = 0; i < 7; i++) { - if (a6 >= i) { + if (capChunks >= i) { level_cel_block = pMap->mt[2 * i]; if (level_cel_block != 0) { drawUpperScreen(dst); @@ -916,7 +916,7 @@ void town_draw_upper(int x, int y, int sx, int sy, int a5, int a6, int some_flag } dst -= BUFFER_WIDTH * 32; } - town_draw_town_all(&gpBuffer[sx + PitchTbl[sy]], x, y, a6, dir, sx, sy, 0); + town_draw_town_all(&gpBuffer[sx + PitchTbl[sy]], x, y, capChunks, CelCap, sx, sy, 0); } else { town_clear_upper_buf(&gpBuffer[sx + PitchTbl[sy]]); } @@ -1016,7 +1016,7 @@ void T_DrawGame(int x, int y) sy += 16; } /// ASSERT: assert(gpBuffer); - gpBufEnd = &gpBuffer[PitchTbl[512]]; + gpBufEnd = &gpBuffer[PitchTbl[VIEWPORT_HEIGHT + SCREEN_Y]]; for (i = 0; i < blocks; i++) { town_draw_lower(x, y, sx, sy, chunks, 0); y++; @@ -1105,7 +1105,7 @@ void T_DrawZoom(int x, int y) } /// ASSERT: assert(gpBuffer); - gpBufEnd = &gpBuffer[PitchTbl[143]]; + gpBufEnd = &gpBuffer[PitchTbl[-17 + SCREEN_Y]]; for (i = 0; i < 7; i++) { town_draw_upper(x, y, sx, sy, chunks, i, 0); y++; @@ -1117,7 +1117,7 @@ void T_DrawZoom(int x, int y) sy += 16; } /// ASSERT: assert(gpBuffer); - gpBufEnd = &gpBuffer[PitchTbl[320]]; + gpBufEnd = &gpBuffer[PitchTbl[160 + SCREEN_Y]]; for (i = 0; i < blocks; i++) { town_draw_lower(x, y, sx, sy, chunks, 0); y++; @@ -1211,12 +1211,14 @@ void T_DrawView(int StartX, int StartY) { light_table_index = 0; cel_transparency_active = 0; - if (zoomflag) + if(zoomflag) { T_DrawGame(StartX, StartY); - else + } else { T_DrawZoom(StartX, StartY); - if (automapflag) + } + if(automapflag) { DrawAutomap(); + } if (stextflag && !qtextflag) DrawSText(); if (invflag) { @@ -1224,28 +1226,38 @@ void T_DrawView(int StartX, int StartY) } else if (sbookflag) { DrawSpellBook(); } + DrawDurIcon(); + if (chrflag) { DrawChr(); } else if (questlog) { DrawQuestLog(); - } else if (plr[myplr]._pStatPts && !spselflag) { + } else if(plr[myplr]._pStatPts != 0 && !spselflag) { DrawLevelUpIcon(); } - if (uitemflag) + if(uitemflag) { DrawUniqueInfo(); - if (qtextflag) + } + if(qtextflag) { DrawQText(); - if (spselflag) + } + if(spselflag) { DrawSpellList(); - if (dropGoldFlag) + } + if(dropGoldFlag) { DrawGoldSplit(dropGoldValue); - if (helpflag) + } + if(helpflag) { DrawHelp(); - if (msgflag) + } + if(msgflag) { DrawDiabloMsg(); - if (PauseMode && !deathflag) + } + if (PauseMode != 0 && !deathflag) { gmenu_draw_pause(); + } + DrawPlrMsg(); gmenu_draw(); doom_draw(); diff --git a/Source/town.h b/Source/town.h index 4e6021382e6..04f0dc87833 100644 --- a/Source/town.h +++ b/Source/town.h @@ -7,14 +7,14 @@ void town_clear_low_buf(BYTE *pBuff); void town_special_lower(BYTE *pBuff, int nCel); void town_special_upper(BYTE *pBuff, int nCel); void town_draw_clipped_e_flag(BYTE *pBuff, int x, int y, int sx, int sy); -void town_draw_clipped_town(BYTE *pBuff, int x, int y, int sx, int sy, BOOL some_flag); -void town_draw_lower(int x, int y, int sx, int sy, int a5, int some_flag); -void town_draw_clipped_e_flag_2(BYTE *pBuff, int x, int y, int a4, int a5, int sx, int sy); -void town_draw_clipped_town_2(BYTE *pBuff, int x, int y, int a4, int a5, int sx, int sy, BOOL some_flag); -void town_draw_lower_2(int x, int y, int sx, int sy, int a5, int a6, int some_flag); -void town_draw_e_flag(BYTE *pBuff, int x, int y, int a4, int dir, int sx, int sy); -void town_draw_town_all(BYTE *pBuff, int x, int y, int a4, int dir, int sx, int sy, BOOL some_flag); -void town_draw_upper(int x, int y, int sx, int sy, int a5, int a6, int some_flag); +void town_draw_clipped_town(BYTE *pBuff, int sx, int sy, int dx, int dy, int eflag); +void town_draw_lower(int x, int y, int sx, int sy, int chunks, int eflag); +void town_draw_clipped_e_flag_2(BYTE *pBuff, int x, int y, int skipChunks, int CelSkip, int sx, int sy); +void town_draw_clipped_town_2(BYTE *pBuff, int sx, int sy, int skipChunks, int CelSkip, int dx, int dy, int eflag); +void town_draw_lower_2(int x, int y, int sx, int sy, int chunks, int skipChunks, int eflag); +void town_draw_e_flag(BYTE *pBuff, int x, int y, int capChunks, int CelCap, int sx, int sy); +void town_draw_town_all(BYTE *pBuff, int x, int y, int capChunks, int CelCap, int sx, int sy, int eflag); +void town_draw_upper(int x, int y, int sx, int sy, int chunks, int capChunks, int eflag); void T_DrawGame(int x, int y); void T_DrawZoom(int x, int y); void T_DrawView(int StartX, int StartY); From 7c071924adbf925a496cd8827eeb045ba2272e60 Mon Sep 17 00:00:00 2001 From: Anders Jenbo Date: Sat, 6 Jul 2019 05:13:01 +0200 Subject: [PATCH 04/42] Format recently cleaned code --- Source/drlg_l2.cpp | 1048 +++++++++++++++++++++---------------------- Source/drlg_l2.h | 244 +++++----- Source/drlg_l3.h | 2 +- Source/drlg_l4.cpp | 64 ++- Source/drlg_l4.h | 32 +- Source/dx.cpp | 28 +- Source/dx.h | 10 +- Source/gendung.cpp | 75 ++-- Source/gendung.h | 44 +- Source/gmenu.cpp | 4 +- Source/gmenu.h | 18 +- Source/init.cpp | 9 +- Source/inv.cpp | 20 +- Source/inv.h | 2 +- Source/items.cpp | 15 +- Source/items.h | 14 +- Source/logging.cpp | 15 +- Source/logging.h | 14 +- Source/minitext.cpp | 22 +- Source/minitext.h | 8 +- Source/missiles.cpp | 233 +++++----- Source/missiles.h | 6 +- Source/mpqapi.cpp | 4 +- Source/mpqapi.h | 4 +- Source/msg.cpp | 47 +- Source/multi.cpp | 21 +- Source/multi.h | 8 +- Source/quests.cpp | 84 ++-- Source/quests.h | 18 +- 29 files changed, 984 insertions(+), 1129 deletions(-) diff --git a/Source/drlg_l2.cpp b/Source/drlg_l2.cpp index ad4e00c08a4..6777ed5d6b4 100644 --- a/Source/drlg_l2.cpp +++ b/Source/drlg_l2.cpp @@ -1,134 +1,134 @@ #include "diablo.h" int nSx1; -int nSx2; // weak +int nSx2; int nSy1; -int nSy2; // weak +int nSy2; int nRoomCnt; -unsigned char predungeon[DMAXX][DMAXX]; +BYTE predungeon[DMAXX][DMAXY]; ROOMNODE RoomList[81]; HALLNODE *pHallList; -int Area_Min = 2; // weak -int Room_Max = 10; // weak -int Room_Min = 4; // weak +int Area_Min = 2; +int Room_Max = 10; +int Room_Min = 4; int Dir_Xadd[5] = { 0, 0, 1, 0, -1 }; int Dir_Yadd[5] = { 0, -1, 0, 1, 0 }; ShadowStruct SPATSL2[2] = { { 6u, 3u, 0u, 3u, 48u, 0u, 50u }, { 9u, 3u, 0u, 3u, 48u, 0u, 50u } }; //short word_48489A = 0; // weak -unsigned char BTYPESL2[161] = { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 0, 0, 0, 0, 0, 0, 0, 17, 18, 1, 1, 2, 2, 1, 1, 1, 1, 1, 1, 2, 2, 2, 2, 2, 0, 0, 0, 0, 8, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 0, 0, 2, 2, 2, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 3, 3, 3, 3, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3, 3, 3, 0, 3, 0, 3, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -unsigned char BSTYPESL2[161] = { 0, 1, 2, 3, 0, 0, 6, 0, 0, 9, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 2, 2, 1, 1, 1, 1, 1, 1, 2, 2, 2, 2, 2, 0, 0, 0, 0, 0, 6, 6, 6, 9, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 0, 0, 2, 2, 2, 0, 0, 0, 1, 1, 1, 1, 6, 2, 2, 2, 0, 3, 3, 3, 3, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 1, 1, 2, 2, 3, 3, 3, 3, 1, 1, 2, 2, 3, 3, 3, 3, 1, 1, 3, 3, 2, 2, 3, 3, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -unsigned char VARCH1[] = { 2, 4, 3, 0, 3, 1, 3, 4, 0, 7, 48, 0, 51, 39, 47, 44, 0, 0 }; -unsigned char VARCH2[] = { 2, 4, 3, 0, 3, 1, 3, 4, 0, 8, 48, 0, 51, 39, 47, 44, 0, 0 }; -unsigned char VARCH3[] = { 2, 4, 3, 0, 3, 1, 3, 4, 0, 6, 48, 0, 51, 39, 47, 44, 0, 0 }; -unsigned char VARCH4[] = { 2, 4, 3, 0, 3, 1, 3, 4, 0, 9, 48, 0, 51, 39, 47, 44, 0, 0 }; -unsigned char VARCH5[] = { 2, 4, 3, 0, 3, 1, 3, 4, 0, 14, 48, 0, 51, 39, 47, 44, 0, 0 }; -unsigned char VARCH6[] = { 2, 4, 3, 0, 3, 1, 3, 4, 0, 13, 48, 0, 51, 39, 47, 44, 0, 0 }; -unsigned char VARCH7[] = { 2, 4, 3, 0, 3, 1, 3, 4, 0, 16, 48, 0, 51, 39, 47, 44, 0, 0 }; -unsigned char VARCH8[] = { 2, 4, 3, 0, 3, 1, 3, 4, 0, 15, 48, 0, 51, 39, 47, 44, 0, 0 }; -unsigned char VARCH9[] = { 2, 4, 3, 0, 3, 8, 3, 4, 0, 7, 48, 0, 51, 42, 47, 44, 0, 0 }; -unsigned char VARCH10[] = { 2, 4, 3, 0, 3, 8, 3, 4, 0, 8, 48, 0, 51, 42, 47, 44, 0, 0 }; -unsigned char VARCH11[] = { 2, 4, 3, 0, 3, 8, 3, 4, 0, 6, 48, 0, 51, 42, 47, 44, 0, 0 }; -unsigned char VARCH12[] = { 2, 4, 3, 0, 3, 8, 3, 4, 0, 9, 48, 0, 51, 42, 47, 44, 0, 0 }; -unsigned char VARCH13[] = { 2, 4, 3, 0, 3, 8, 3, 4, 0, 14, 48, 0, 51, 42, 47, 44, 0, 0 }; -unsigned char VARCH14[] = { 2, 4, 3, 0, 3, 8, 3, 4, 0, 13, 48, 0, 51, 42, 47, 44, 0, 0 }; -unsigned char VARCH15[] = { 2, 4, 3, 0, 3, 8, 3, 4, 0, 16, 48, 0, 51, 42, 47, 44, 0, 0 }; -unsigned char VARCH16[] = { 2, 4, 3, 0, 3, 8, 3, 4, 0, 15, 48, 0, 51, 42, 47, 44, 0, 0 }; -unsigned char VARCH17[] = { 2, 3, 2, 7, 3, 4, 0, 7, 141, 39, 47, 44, 0, 0 }; -unsigned char VARCH18[] = { 2, 3, 2, 7, 3, 4, 0, 8, 141, 39, 47, 44, 0, 0 }; -unsigned char VARCH19[] = { 2, 3, 2, 7, 3, 4, 0, 6, 141, 39, 47, 44, 0, 0 }; -unsigned char VARCH20[] = { 2, 3, 2, 7, 3, 4, 0, 9, 141, 39, 47, 44, 0, 0 }; -unsigned char VARCH21[] = { 2, 3, 2, 7, 3, 4, 0, 14, 141, 39, 47, 44, 0, 0 }; -unsigned char VARCH22[] = { 2, 3, 2, 7, 3, 4, 0, 13, 141, 39, 47, 44, 0, 0 }; -unsigned char VARCH23[] = { 2, 3, 2, 7, 3, 4, 0, 16, 141, 39, 47, 44, 0, 0 }; -unsigned char VARCH24[] = { 2, 3, 2, 7, 3, 4, 0, 15, 141, 39, 47, 44, 0, 0 }; -unsigned char VARCH25[] = { 2, 4, 3, 0, 3, 4, 3, 1, 0, 7, 48, 0, 51, 39, 47, 44, 0, 0 }; -unsigned char VARCH26[] = { 2, 4, 3, 0, 3, 4, 3, 1, 0, 8, 48, 0, 51, 39, 47, 44, 0, 0 }; -unsigned char VARCH27[] = { 2, 4, 3, 0, 3, 4, 3, 1, 0, 6, 48, 0, 51, 39, 47, 44, 0, 0 }; -unsigned char VARCH28[] = { 2, 4, 3, 0, 3, 4, 3, 1, 0, 9, 48, 0, 51, 39, 47, 44, 0, 0 }; -unsigned char VARCH29[] = { 2, 4, 3, 0, 3, 4, 3, 1, 0, 14, 48, 0, 51, 39, 47, 44, 0, 0 }; -unsigned char VARCH30[] = { 2, 4, 3, 0, 3, 4, 3, 1, 0, 13, 48, 0, 51, 39, 47, 44, 0, 0 }; -unsigned char VARCH31[] = { 2, 4, 3, 0, 3, 4, 3, 1, 0, 16, 48, 0, 51, 39, 47, 44, 0, 0 }; -unsigned char VARCH32[] = { 2, 4, 3, 0, 3, 4, 3, 1, 0, 15, 48, 0, 51, 39, 47, 44, 0, 0 }; -unsigned char VARCH33[] = { 2, 4, 2, 0, 3, 8, 3, 4, 0, 7, 142, 0, 51, 42, 47, 44, 0, 0 }; -unsigned char VARCH34[] = { 2, 4, 2, 0, 3, 8, 3, 4, 0, 8, 142, 0, 51, 42, 47, 44, 0, 0 }; -unsigned char VARCH35[] = { 2, 4, 2, 0, 3, 8, 3, 4, 0, 6, 142, 0, 51, 42, 47, 44, 0, 0 }; -unsigned char VARCH36[] = { 2, 4, 2, 0, 3, 8, 3, 4, 0, 9, 142, 0, 51, 42, 47, 44, 0, 0 }; -unsigned char VARCH37[] = { 2, 4, 2, 0, 3, 8, 3, 4, 0, 14, 142, 0, 51, 42, 47, 44, 0, 0 }; -unsigned char VARCH38[] = { 2, 4, 2, 0, 3, 8, 3, 4, 0, 13, 142, 0, 51, 42, 47, 44, 0, 0 }; -unsigned char VARCH39[] = { 2, 4, 2, 0, 3, 8, 3, 4, 0, 16, 142, 0, 51, 42, 47, 44, 0, 0 }; -unsigned char VARCH40[] = { 2, 4, 2, 0, 3, 8, 3, 4, 0, 15, 142, 0, 51, 42, 47, 44, 0, 0 }; -unsigned char HARCH1[] = { 3, 2, 3, 3, 0, 2, 5, 9, 49, 46, 0, 40, 45, 0 }; -unsigned char HARCH2[] = { 3, 2, 3, 3, 0, 2, 5, 6, 49, 46, 0, 40, 45, 0 }; -unsigned char HARCH3[] = { 3, 2, 3, 3, 0, 2, 5, 8, 49, 46, 0, 40, 45, 0 }; -unsigned char HARCH4[] = { 3, 2, 3, 3, 0, 2, 5, 7, 49, 46, 0, 40, 45, 0 }; -unsigned char HARCH5[] = { 3, 2, 3, 3, 0, 2, 5, 15, 49, 46, 0, 40, 45, 0 }; -unsigned char HARCH6[] = { 3, 2, 3, 3, 0, 2, 5, 16, 49, 46, 0, 40, 45, 0 }; -unsigned char HARCH7[] = { 3, 2, 3, 3, 0, 2, 5, 13, 49, 46, 0, 40, 45, 0 }; -unsigned char HARCH8[] = { 3, 2, 3, 3, 0, 2, 5, 14, 49, 46, 0, 40, 45, 0 }; -unsigned char HARCH9[] = { 3, 2, 3, 3, 0, 8, 5, 9, 49, 46, 0, 43, 45, 0 }; -unsigned char HARCH10[] = { 3, 2, 3, 3, 0, 8, 5, 6, 49, 46, 0, 43, 45, 0 }; -unsigned char HARCH11[] = { 3, 2, 3, 3, 0, 8, 5, 8, 49, 46, 0, 43, 45, 0 }; -unsigned char HARCH12[] = { 3, 2, 3, 3, 0, 8, 5, 7, 49, 46, 0, 43, 45, 0 }; -unsigned char HARCH13[] = { 3, 2, 3, 3, 0, 8, 5, 15, 49, 46, 0, 43, 45, 0 }; -unsigned char HARCH14[] = { 3, 2, 3, 3, 0, 8, 5, 16, 49, 46, 0, 43, 45, 0 }; -unsigned char HARCH15[] = { 3, 2, 3, 3, 0, 8, 5, 13, 49, 46, 0, 43, 45, 0 }; -unsigned char HARCH16[] = { 3, 2, 3, 3, 0, 8, 5, 14, 49, 46, 0, 43, 45, 0 }; -unsigned char HARCH17[] = { 3, 2, 1, 3, 0, 8, 5, 9, 140, 46, 0, 43, 45, 0 }; -unsigned char HARCH18[] = { 3, 2, 1, 3, 0, 8, 5, 6, 140, 46, 0, 43, 45, 0 }; -unsigned char HARCH19[] = { 3, 2, 1, 3, 0, 8, 5, 8, 140, 46, 0, 43, 45, 0 }; -unsigned char HARCH20[] = { 3, 2, 1, 3, 0, 8, 5, 7, 140, 46, 0, 43, 45, 0 }; -unsigned char HARCH21[] = { 3, 2, 1, 3, 0, 8, 5, 15, 140, 46, 0, 43, 45, 0 }; -unsigned char HARCH22[] = { 3, 2, 1, 3, 0, 8, 5, 16, 140, 46, 0, 43, 45, 0 }; -unsigned char HARCH23[] = { 3, 2, 1, 3, 0, 8, 5, 13, 140, 46, 0, 43, 45, 0 }; -unsigned char HARCH24[] = { 3, 2, 1, 3, 0, 8, 5, 14, 140, 46, 0, 43, 45, 0 }; -unsigned char HARCH25[] = { 3, 2, 3, 3, 0, 5, 2, 9, 49, 46, 0, 40, 45, 0 }; -unsigned char HARCH26[] = { 3, 2, 3, 3, 0, 5, 2, 6, 49, 46, 0, 40, 45, 0 }; -unsigned char HARCH27[] = { 3, 2, 3, 3, 0, 5, 2, 8, 49, 46, 0, 40, 45, 0 }; -unsigned char HARCH28[] = { 3, 2, 3, 3, 0, 5, 2, 7, 49, 46, 0, 40, 45, 0 }; -unsigned char HARCH29[] = { 3, 2, 3, 3, 0, 5, 2, 15, 49, 46, 0, 40, 45, 0 }; -unsigned char HARCH30[] = { 3, 2, 3, 3, 0, 5, 2, 16, 49, 46, 0, 40, 45, 0 }; -unsigned char HARCH31[] = { 3, 2, 3, 3, 0, 5, 2, 13, 49, 46, 0, 40, 45, 0 }; -unsigned char HARCH32[] = { 3, 2, 3, 3, 0, 5, 2, 14, 49, 46, 0, 40, 45, 0 }; -unsigned char HARCH33[] = { 3, 2, 1, 3, 0, 9, 5, 9, 140, 46, 0, 40, 45, 0 }; -unsigned char HARCH34[] = { 3, 2, 1, 3, 0, 9, 5, 6, 140, 46, 0, 40, 45, 0 }; -unsigned char HARCH35[] = { 3, 2, 1, 3, 0, 9, 5, 8, 140, 46, 0, 40, 45, 0 }; -unsigned char HARCH36[] = { 3, 2, 1, 3, 0, 9, 5, 7, 140, 46, 0, 40, 45, 0 }; -unsigned char HARCH37[] = { 3, 2, 1, 3, 0, 9, 5, 15, 140, 46, 0, 40, 45, 0 }; -unsigned char HARCH38[] = { 3, 2, 1, 3, 0, 9, 5, 16, 140, 46, 0, 40, 45, 0 }; -unsigned char HARCH39[] = { 3, 2, 1, 3, 0, 9, 5, 13, 140, 46, 0, 40, 45, 0 }; -unsigned char HARCH40[] = { 3, 2, 1, 3, 0, 9, 5, 14, 140, 46, 0, 40, 45, 0 }; -unsigned char USTAIRS[] = { 4, 4, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 0, 0, 0, 0, 0, 72, 77, 0, 0, 76, 0, 0, 0, 0, 0, 0 }; -unsigned char DSTAIRS[] = { 4, 4, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 0, 0, 0, 0, 0, 48, 71, 0, 0, 50, 78, 0, 0, 0, 0, 0 }; -unsigned char WARPSTAIRS[] = { 4, 4, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 0, 0, 0, 0, 0, 158, 160, 0, 0, 159, 0, 0, 0, 0, 0, 0 }; -unsigned char CRUSHCOL[] = { 3, 3, 3, 1, 3, 2, 6, 3, 3, 3, 3, 0, 0, 0, 0, 83, 0, 0, 0, 0 }; -unsigned char BIG1[] = { 2, 2, 3, 3, 3, 3, 113, 0, 112, 0 }; -unsigned char BIG2[] = { 2, 2, 3, 3, 3, 3, 114, 115, 0, 0 }; -unsigned char BIG3[] = { 1, 2, 1, 1, 117, 116 }; -unsigned char BIG4[] = { 2, 1, 2, 2, 118, 119 }; -unsigned char BIG5[] = { 2, 2, 3, 3, 3, 3, 120, 122, 121, 123 }; -unsigned char BIG6[] = { 1, 2, 1, 1, 125, 124 }; -unsigned char BIG7[] = { 2, 1, 2, 2, 126, 127 }; -unsigned char BIG8[] = { 2, 2, 3, 3, 3, 3, 128, 130, 129, 131 }; -unsigned char BIG9[] = { 2, 2, 1, 3, 1, 3, 133, 135, 132, 134 }; -unsigned char BIG10[] = { 2, 2, 2, 2, 3, 3, 136, 137, 3, 3 }; -unsigned char RUINS1[] = { 1, 1, 1, 80 }; -unsigned char RUINS2[] = { 1, 1, 1, 81 }; -unsigned char RUINS3[] = { 1, 1, 1, 82 }; -unsigned char RUINS4[] = { 1, 1, 2, 84 }; -unsigned char RUINS5[] = { 1, 1, 2, 85 }; -unsigned char RUINS6[] = { 1, 1, 2, 86 }; -unsigned char RUINS7[] = { 1, 1, 8, 87 }; -unsigned char PANCREAS1[] = { 5, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 0, 0, 0, 0, 0, 0, 0, 108, 0, 0, 0, 0, 0, 0, 0 }; -unsigned char PANCREAS2[] = { 5, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 0, 0, 0, 0, 0, 0, 0, 110, 0, 0, 0, 0, 0, 0, 0 }; -unsigned char CTRDOOR1[] = { 3, 3, 3, 1, 3, 0, 4, 0, 0, 9, 0, 0, 4, 0, 0, 1, 0, 0, 0, 0 }; -unsigned char CTRDOOR2[] = { 3, 3, 3, 1, 3, 0, 4, 0, 0, 8, 0, 0, 4, 0, 0, 1, 0, 0, 0, 0 }; -unsigned char CTRDOOR3[] = { 3, 3, 3, 1, 3, 0, 4, 0, 0, 6, 0, 0, 4, 0, 0, 1, 0, 0, 0, 0 }; -unsigned char CTRDOOR4[] = { 3, 3, 3, 1, 3, 0, 4, 0, 0, 7, 0, 0, 4, 0, 0, 1, 0, 0, 0, 0 }; -unsigned char CTRDOOR5[] = { 3, 3, 3, 1, 3, 0, 4, 0, 0, 15, 0, 0, 4, 0, 0, 1, 0, 0, 0, 0 }; -unsigned char CTRDOOR6[] = { 3, 3, 3, 1, 3, 0, 4, 0, 0, 13, 0, 0, 4, 0, 0, 1, 0, 0, 0, 0 }; -unsigned char CTRDOOR7[] = { 3, 3, 3, 1, 3, 0, 4, 0, 0, 16, 0, 0, 4, 0, 0, 1, 0, 0, 0, 0 }; -unsigned char CTRDOOR8[] = { 3, 3, 3, 1, 3, 0, 4, 0, 0, 14, 0, 0, 4, 0, 0, 1, 0, 0, 0, 0 }; +BYTE BTYPESL2[161] = { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 0, 0, 0, 0, 0, 0, 0, 17, 18, 1, 1, 2, 2, 1, 1, 1, 1, 1, 1, 2, 2, 2, 2, 2, 0, 0, 0, 0, 8, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 0, 0, 2, 2, 2, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 3, 3, 3, 3, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3, 3, 3, 0, 3, 0, 3, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; +BYTE BSTYPESL2[161] = { 0, 1, 2, 3, 0, 0, 6, 0, 0, 9, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 2, 2, 1, 1, 1, 1, 1, 1, 2, 2, 2, 2, 2, 0, 0, 0, 0, 0, 6, 6, 6, 9, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 0, 0, 2, 2, 2, 0, 0, 0, 1, 1, 1, 1, 6, 2, 2, 2, 0, 3, 3, 3, 3, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 1, 1, 2, 2, 3, 3, 3, 3, 1, 1, 2, 2, 3, 3, 3, 3, 1, 1, 3, 3, 2, 2, 3, 3, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; +BYTE VARCH1[] = { 2, 4, 3, 0, 3, 1, 3, 4, 0, 7, 48, 0, 51, 39, 47, 44, 0, 0 }; +BYTE VARCH2[] = { 2, 4, 3, 0, 3, 1, 3, 4, 0, 8, 48, 0, 51, 39, 47, 44, 0, 0 }; +BYTE VARCH3[] = { 2, 4, 3, 0, 3, 1, 3, 4, 0, 6, 48, 0, 51, 39, 47, 44, 0, 0 }; +BYTE VARCH4[] = { 2, 4, 3, 0, 3, 1, 3, 4, 0, 9, 48, 0, 51, 39, 47, 44, 0, 0 }; +BYTE VARCH5[] = { 2, 4, 3, 0, 3, 1, 3, 4, 0, 14, 48, 0, 51, 39, 47, 44, 0, 0 }; +BYTE VARCH6[] = { 2, 4, 3, 0, 3, 1, 3, 4, 0, 13, 48, 0, 51, 39, 47, 44, 0, 0 }; +BYTE VARCH7[] = { 2, 4, 3, 0, 3, 1, 3, 4, 0, 16, 48, 0, 51, 39, 47, 44, 0, 0 }; +BYTE VARCH8[] = { 2, 4, 3, 0, 3, 1, 3, 4, 0, 15, 48, 0, 51, 39, 47, 44, 0, 0 }; +BYTE VARCH9[] = { 2, 4, 3, 0, 3, 8, 3, 4, 0, 7, 48, 0, 51, 42, 47, 44, 0, 0 }; +BYTE VARCH10[] = { 2, 4, 3, 0, 3, 8, 3, 4, 0, 8, 48, 0, 51, 42, 47, 44, 0, 0 }; +BYTE VARCH11[] = { 2, 4, 3, 0, 3, 8, 3, 4, 0, 6, 48, 0, 51, 42, 47, 44, 0, 0 }; +BYTE VARCH12[] = { 2, 4, 3, 0, 3, 8, 3, 4, 0, 9, 48, 0, 51, 42, 47, 44, 0, 0 }; +BYTE VARCH13[] = { 2, 4, 3, 0, 3, 8, 3, 4, 0, 14, 48, 0, 51, 42, 47, 44, 0, 0 }; +BYTE VARCH14[] = { 2, 4, 3, 0, 3, 8, 3, 4, 0, 13, 48, 0, 51, 42, 47, 44, 0, 0 }; +BYTE VARCH15[] = { 2, 4, 3, 0, 3, 8, 3, 4, 0, 16, 48, 0, 51, 42, 47, 44, 0, 0 }; +BYTE VARCH16[] = { 2, 4, 3, 0, 3, 8, 3, 4, 0, 15, 48, 0, 51, 42, 47, 44, 0, 0 }; +BYTE VARCH17[] = { 2, 3, 2, 7, 3, 4, 0, 7, 141, 39, 47, 44, 0, 0 }; +BYTE VARCH18[] = { 2, 3, 2, 7, 3, 4, 0, 8, 141, 39, 47, 44, 0, 0 }; +BYTE VARCH19[] = { 2, 3, 2, 7, 3, 4, 0, 6, 141, 39, 47, 44, 0, 0 }; +BYTE VARCH20[] = { 2, 3, 2, 7, 3, 4, 0, 9, 141, 39, 47, 44, 0, 0 }; +BYTE VARCH21[] = { 2, 3, 2, 7, 3, 4, 0, 14, 141, 39, 47, 44, 0, 0 }; +BYTE VARCH22[] = { 2, 3, 2, 7, 3, 4, 0, 13, 141, 39, 47, 44, 0, 0 }; +BYTE VARCH23[] = { 2, 3, 2, 7, 3, 4, 0, 16, 141, 39, 47, 44, 0, 0 }; +BYTE VARCH24[] = { 2, 3, 2, 7, 3, 4, 0, 15, 141, 39, 47, 44, 0, 0 }; +BYTE VARCH25[] = { 2, 4, 3, 0, 3, 4, 3, 1, 0, 7, 48, 0, 51, 39, 47, 44, 0, 0 }; +BYTE VARCH26[] = { 2, 4, 3, 0, 3, 4, 3, 1, 0, 8, 48, 0, 51, 39, 47, 44, 0, 0 }; +BYTE VARCH27[] = { 2, 4, 3, 0, 3, 4, 3, 1, 0, 6, 48, 0, 51, 39, 47, 44, 0, 0 }; +BYTE VARCH28[] = { 2, 4, 3, 0, 3, 4, 3, 1, 0, 9, 48, 0, 51, 39, 47, 44, 0, 0 }; +BYTE VARCH29[] = { 2, 4, 3, 0, 3, 4, 3, 1, 0, 14, 48, 0, 51, 39, 47, 44, 0, 0 }; +BYTE VARCH30[] = { 2, 4, 3, 0, 3, 4, 3, 1, 0, 13, 48, 0, 51, 39, 47, 44, 0, 0 }; +BYTE VARCH31[] = { 2, 4, 3, 0, 3, 4, 3, 1, 0, 16, 48, 0, 51, 39, 47, 44, 0, 0 }; +BYTE VARCH32[] = { 2, 4, 3, 0, 3, 4, 3, 1, 0, 15, 48, 0, 51, 39, 47, 44, 0, 0 }; +BYTE VARCH33[] = { 2, 4, 2, 0, 3, 8, 3, 4, 0, 7, 142, 0, 51, 42, 47, 44, 0, 0 }; +BYTE VARCH34[] = { 2, 4, 2, 0, 3, 8, 3, 4, 0, 8, 142, 0, 51, 42, 47, 44, 0, 0 }; +BYTE VARCH35[] = { 2, 4, 2, 0, 3, 8, 3, 4, 0, 6, 142, 0, 51, 42, 47, 44, 0, 0 }; +BYTE VARCH36[] = { 2, 4, 2, 0, 3, 8, 3, 4, 0, 9, 142, 0, 51, 42, 47, 44, 0, 0 }; +BYTE VARCH37[] = { 2, 4, 2, 0, 3, 8, 3, 4, 0, 14, 142, 0, 51, 42, 47, 44, 0, 0 }; +BYTE VARCH38[] = { 2, 4, 2, 0, 3, 8, 3, 4, 0, 13, 142, 0, 51, 42, 47, 44, 0, 0 }; +BYTE VARCH39[] = { 2, 4, 2, 0, 3, 8, 3, 4, 0, 16, 142, 0, 51, 42, 47, 44, 0, 0 }; +BYTE VARCH40[] = { 2, 4, 2, 0, 3, 8, 3, 4, 0, 15, 142, 0, 51, 42, 47, 44, 0, 0 }; +BYTE HARCH1[] = { 3, 2, 3, 3, 0, 2, 5, 9, 49, 46, 0, 40, 45, 0 }; +BYTE HARCH2[] = { 3, 2, 3, 3, 0, 2, 5, 6, 49, 46, 0, 40, 45, 0 }; +BYTE HARCH3[] = { 3, 2, 3, 3, 0, 2, 5, 8, 49, 46, 0, 40, 45, 0 }; +BYTE HARCH4[] = { 3, 2, 3, 3, 0, 2, 5, 7, 49, 46, 0, 40, 45, 0 }; +BYTE HARCH5[] = { 3, 2, 3, 3, 0, 2, 5, 15, 49, 46, 0, 40, 45, 0 }; +BYTE HARCH6[] = { 3, 2, 3, 3, 0, 2, 5, 16, 49, 46, 0, 40, 45, 0 }; +BYTE HARCH7[] = { 3, 2, 3, 3, 0, 2, 5, 13, 49, 46, 0, 40, 45, 0 }; +BYTE HARCH8[] = { 3, 2, 3, 3, 0, 2, 5, 14, 49, 46, 0, 40, 45, 0 }; +BYTE HARCH9[] = { 3, 2, 3, 3, 0, 8, 5, 9, 49, 46, 0, 43, 45, 0 }; +BYTE HARCH10[] = { 3, 2, 3, 3, 0, 8, 5, 6, 49, 46, 0, 43, 45, 0 }; +BYTE HARCH11[] = { 3, 2, 3, 3, 0, 8, 5, 8, 49, 46, 0, 43, 45, 0 }; +BYTE HARCH12[] = { 3, 2, 3, 3, 0, 8, 5, 7, 49, 46, 0, 43, 45, 0 }; +BYTE HARCH13[] = { 3, 2, 3, 3, 0, 8, 5, 15, 49, 46, 0, 43, 45, 0 }; +BYTE HARCH14[] = { 3, 2, 3, 3, 0, 8, 5, 16, 49, 46, 0, 43, 45, 0 }; +BYTE HARCH15[] = { 3, 2, 3, 3, 0, 8, 5, 13, 49, 46, 0, 43, 45, 0 }; +BYTE HARCH16[] = { 3, 2, 3, 3, 0, 8, 5, 14, 49, 46, 0, 43, 45, 0 }; +BYTE HARCH17[] = { 3, 2, 1, 3, 0, 8, 5, 9, 140, 46, 0, 43, 45, 0 }; +BYTE HARCH18[] = { 3, 2, 1, 3, 0, 8, 5, 6, 140, 46, 0, 43, 45, 0 }; +BYTE HARCH19[] = { 3, 2, 1, 3, 0, 8, 5, 8, 140, 46, 0, 43, 45, 0 }; +BYTE HARCH20[] = { 3, 2, 1, 3, 0, 8, 5, 7, 140, 46, 0, 43, 45, 0 }; +BYTE HARCH21[] = { 3, 2, 1, 3, 0, 8, 5, 15, 140, 46, 0, 43, 45, 0 }; +BYTE HARCH22[] = { 3, 2, 1, 3, 0, 8, 5, 16, 140, 46, 0, 43, 45, 0 }; +BYTE HARCH23[] = { 3, 2, 1, 3, 0, 8, 5, 13, 140, 46, 0, 43, 45, 0 }; +BYTE HARCH24[] = { 3, 2, 1, 3, 0, 8, 5, 14, 140, 46, 0, 43, 45, 0 }; +BYTE HARCH25[] = { 3, 2, 3, 3, 0, 5, 2, 9, 49, 46, 0, 40, 45, 0 }; +BYTE HARCH26[] = { 3, 2, 3, 3, 0, 5, 2, 6, 49, 46, 0, 40, 45, 0 }; +BYTE HARCH27[] = { 3, 2, 3, 3, 0, 5, 2, 8, 49, 46, 0, 40, 45, 0 }; +BYTE HARCH28[] = { 3, 2, 3, 3, 0, 5, 2, 7, 49, 46, 0, 40, 45, 0 }; +BYTE HARCH29[] = { 3, 2, 3, 3, 0, 5, 2, 15, 49, 46, 0, 40, 45, 0 }; +BYTE HARCH30[] = { 3, 2, 3, 3, 0, 5, 2, 16, 49, 46, 0, 40, 45, 0 }; +BYTE HARCH31[] = { 3, 2, 3, 3, 0, 5, 2, 13, 49, 46, 0, 40, 45, 0 }; +BYTE HARCH32[] = { 3, 2, 3, 3, 0, 5, 2, 14, 49, 46, 0, 40, 45, 0 }; +BYTE HARCH33[] = { 3, 2, 1, 3, 0, 9, 5, 9, 140, 46, 0, 40, 45, 0 }; +BYTE HARCH34[] = { 3, 2, 1, 3, 0, 9, 5, 6, 140, 46, 0, 40, 45, 0 }; +BYTE HARCH35[] = { 3, 2, 1, 3, 0, 9, 5, 8, 140, 46, 0, 40, 45, 0 }; +BYTE HARCH36[] = { 3, 2, 1, 3, 0, 9, 5, 7, 140, 46, 0, 40, 45, 0 }; +BYTE HARCH37[] = { 3, 2, 1, 3, 0, 9, 5, 15, 140, 46, 0, 40, 45, 0 }; +BYTE HARCH38[] = { 3, 2, 1, 3, 0, 9, 5, 16, 140, 46, 0, 40, 45, 0 }; +BYTE HARCH39[] = { 3, 2, 1, 3, 0, 9, 5, 13, 140, 46, 0, 40, 45, 0 }; +BYTE HARCH40[] = { 3, 2, 1, 3, 0, 9, 5, 14, 140, 46, 0, 40, 45, 0 }; +BYTE USTAIRS[] = { 4, 4, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 0, 0, 0, 0, 0, 72, 77, 0, 0, 76, 0, 0, 0, 0, 0, 0 }; +BYTE DSTAIRS[] = { 4, 4, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 0, 0, 0, 0, 0, 48, 71, 0, 0, 50, 78, 0, 0, 0, 0, 0 }; +BYTE WARPSTAIRS[] = { 4, 4, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 0, 0, 0, 0, 0, 158, 160, 0, 0, 159, 0, 0, 0, 0, 0, 0 }; +BYTE CRUSHCOL[] = { 3, 3, 3, 1, 3, 2, 6, 3, 3, 3, 3, 0, 0, 0, 0, 83, 0, 0, 0, 0 }; +BYTE BIG1[] = { 2, 2, 3, 3, 3, 3, 113, 0, 112, 0 }; +BYTE BIG2[] = { 2, 2, 3, 3, 3, 3, 114, 115, 0, 0 }; +BYTE BIG3[] = { 1, 2, 1, 1, 117, 116 }; +BYTE BIG4[] = { 2, 1, 2, 2, 118, 119 }; +BYTE BIG5[] = { 2, 2, 3, 3, 3, 3, 120, 122, 121, 123 }; +BYTE BIG6[] = { 1, 2, 1, 1, 125, 124 }; +BYTE BIG7[] = { 2, 1, 2, 2, 126, 127 }; +BYTE BIG8[] = { 2, 2, 3, 3, 3, 3, 128, 130, 129, 131 }; +BYTE BIG9[] = { 2, 2, 1, 3, 1, 3, 133, 135, 132, 134 }; +BYTE BIG10[] = { 2, 2, 2, 2, 3, 3, 136, 137, 3, 3 }; +BYTE RUINS1[] = { 1, 1, 1, 80 }; +BYTE RUINS2[] = { 1, 1, 1, 81 }; +BYTE RUINS3[] = { 1, 1, 1, 82 }; +BYTE RUINS4[] = { 1, 1, 2, 84 }; +BYTE RUINS5[] = { 1, 1, 2, 85 }; +BYTE RUINS6[] = { 1, 1, 2, 86 }; +BYTE RUINS7[] = { 1, 1, 8, 87 }; +BYTE PANCREAS1[] = { 5, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 0, 0, 0, 0, 0, 0, 0, 108, 0, 0, 0, 0, 0, 0, 0 }; +BYTE PANCREAS2[] = { 5, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 0, 0, 0, 0, 0, 0, 0, 110, 0, 0, 0, 0, 0, 0, 0 }; +BYTE CTRDOOR1[] = { 3, 3, 3, 1, 3, 0, 4, 0, 0, 9, 0, 0, 4, 0, 0, 1, 0, 0, 0, 0 }; +BYTE CTRDOOR2[] = { 3, 3, 3, 1, 3, 0, 4, 0, 0, 8, 0, 0, 4, 0, 0, 1, 0, 0, 0, 0 }; +BYTE CTRDOOR3[] = { 3, 3, 3, 1, 3, 0, 4, 0, 0, 6, 0, 0, 4, 0, 0, 1, 0, 0, 0, 0 }; +BYTE CTRDOOR4[] = { 3, 3, 3, 1, 3, 0, 4, 0, 0, 7, 0, 0, 4, 0, 0, 1, 0, 0, 0, 0 }; +BYTE CTRDOOR5[] = { 3, 3, 3, 1, 3, 0, 4, 0, 0, 15, 0, 0, 4, 0, 0, 1, 0, 0, 0, 0 }; +BYTE CTRDOOR6[] = { 3, 3, 3, 1, 3, 0, 4, 0, 0, 13, 0, 0, 4, 0, 0, 1, 0, 0, 0, 0 }; +BYTE CTRDOOR7[] = { 3, 3, 3, 1, 3, 0, 4, 0, 0, 16, 0, 0, 4, 0, 0, 1, 0, 0, 0, 0 }; +BYTE CTRDOOR8[] = { 3, 3, 3, 1, 3, 0, 4, 0, 0, 14, 0, 0, 4, 0, 0, 1, 0, 0, 0, 0 }; int Patterns[100][10] = { { 0, 0, 0, 0, 0, 0, 0, 0, 0, 3 }, { 0, 0, 0, 0, 2, 0, 0, 0, 0, 3 }, @@ -236,8 +236,8 @@ void InitDungeon() { int i, j; - for(j = 0; j < DMAXY; j++) { - for(i = 0; i < DMAXX; i++) { + for (j = 0; j < DMAXY; j++) { + for (i = 0; i < DMAXX; i++) { predungeon[i][j] = 32; dflags[i][j] = 0; } @@ -249,61 +249,61 @@ void L2LockoutFix() int i, j; BOOL doorok; - for(j = 0; j < DMAXY; j++) { - for(i = 0; i < DMAXX; i++) { - if(dungeon[i][j] == 4 && dungeon[i - 1][j] != 3) { + for (j = 0; j < DMAXY; j++) { + for (i = 0; i < DMAXX; i++) { + if (dungeon[i][j] == 4 && dungeon[i - 1][j] != 3) { dungeon[i][j] = 1; } - if(dungeon[i][j] == 5 && dungeon[i][j - 1] != 3) { + if (dungeon[i][j] == 5 && dungeon[i][j - 1] != 3) { dungeon[i][j] = 2; } } } - for(j = 1; j < DMAXY - 1; j++) { - for(i = 1; i < DMAXX - 1; i++) { - if(dflags[i][j] & 0x80) { + for (j = 1; j < DMAXY - 1; j++) { + for (i = 1; i < DMAXX - 1; i++) { + if (dflags[i][j] & 0x80) { continue; } - if((dungeon[i][j] == 2 || dungeon[i][j] == 5) && dungeon[i][j - 1] == 3 && dungeon[i][j + 1] == 3) { + if ((dungeon[i][j] == 2 || dungeon[i][j] == 5) && dungeon[i][j - 1] == 3 && dungeon[i][j + 1] == 3) { doorok = FALSE; - while(1) { - if(dungeon[i][j] != 2 && dungeon[i][j] != 5) { + while (1) { + if (dungeon[i][j] != 2 && dungeon[i][j] != 5) { break; } - if(dungeon[i][j - 1] != 3 || dungeon[i][j + 1] != 3) { + if (dungeon[i][j - 1] != 3 || dungeon[i][j + 1] != 3) { break; } - if(dungeon[i][j] == 5) { + if (dungeon[i][j] == 5) { doorok = TRUE; } i++; } - if(!doorok && !(dflags[i - 1][j] & 0x80)) { + if (!doorok && !(dflags[i - 1][j] & 0x80)) { dungeon[i - 1][j] = 5; } } } } - for(j = 1; j < DMAXX - 1; j++) { /* check: might be flipped */ - for(i = 1; i < DMAXY - 1; i++) { - if(dflags[j][i] & 0x80) { + for (j = 1; j < DMAXX - 1; j++) { /* check: might be flipped */ + for (i = 1; i < DMAXY - 1; i++) { + if (dflags[j][i] & 0x80) { continue; } - if((dungeon[j][i] == 1 || dungeon[j][i] == 4) && dungeon[j - 1][i] == 3 && dungeon[j + 1][i] == 3) { + if ((dungeon[j][i] == 1 || dungeon[j][i] == 4) && dungeon[j - 1][i] == 3 && dungeon[j + 1][i] == 3) { doorok = FALSE; - while(1) { - if(dungeon[j][i] != 1 && dungeon[j][i] != 4) { + while (1) { + if (dungeon[j][i] != 1 && dungeon[j][i] != 4) { break; } - if(dungeon[j - 1][i] != 3 || dungeon[j + 1][i] != 3) { + if (dungeon[j - 1][i] != 3 || dungeon[j + 1][i] != 3) { break; } - if(dungeon[j][i] == 4) { + if (dungeon[j][i] == 4) { doorok = TRUE; } i++; } - if(!doorok && !(dflags[j][i - 1] & 0x80)) { + if (!doorok && !(dflags[j][i - 1] & 0x80)) { dungeon[j][i - 1] = 4; } } @@ -315,12 +315,12 @@ void L2DoorFix() { int i, j; - for(j = 1; j < 40; j++) { - for(i = 1; i < 40; i++) { - if(dungeon[i][j] == 4 && dungeon[i][j - 1] == 3) { + for (j = 1; j < 40; j++) { + for (i = 1; i < 40; i++) { + if (dungeon[i][j] == 4 && dungeon[i][j - 1] == 3) { dungeon[i][j] = 7; } - if(dungeon[i][j] == 5 && dungeon[i - 1][j] == 3) { + if (dungeon[i][j] == 5 && dungeon[i - 1][j] == 3) { dungeon[i][j] = 9; } } @@ -551,16 +551,16 @@ void LoadPreL2Dungeon(char *sFileName, int vx, int vy) mem_free_dbg(pLevelMap); } -void CreateL2Dungeon(unsigned int rseed, int entry) +void CreateL2Dungeon(int rseed, int entry) { - if(gbMaxPlayers == 1) { - if(currlevel == 7 && !quests[8]._qactive) { + if (gbMaxPlayers == 1) { + if (currlevel == 7 && !quests[8]._qactive) { currlevel = 6; CreateL2Dungeon(glSeedTbl[6], 4); currlevel = 7; } - if(currlevel == 8) { - if(!quests[8]._qactive) { + if (currlevel == 8) { + if (!quests[8]._qactive) { currlevel = 6; CreateL2Dungeon(glSeedTbl[6], 4); currlevel = 8; @@ -568,7 +568,6 @@ void CreateL2Dungeon(unsigned int rseed, int entry) currlevel = 7; CreateL2Dungeon(glSeedTbl[7], 4); currlevel = 8; - } } } @@ -589,28 +588,22 @@ void CreateL2Dungeon(unsigned int rseed, int entry) DRLG_InitL2Vals(); DRLG_SetPC(); } -// 5CF328: using guessed type int dmaxx; -// 5CF32C: using guessed type int dmaxy; -// 5D2458: using guessed type int dminx; -// 5D245C: using guessed type int dminy; -// 679660: using guessed type char gbMaxPlayers; void DRLG_LoadL2SP() { setloadflag_2 = 0; - if(QuestStatus(QTYPE_BLIND)) { + if (QuestStatus(QTYPE_BLIND)) { pSetPiece_2 = (char *)LoadFileInMem("Levels\\L2Data\\Blind2.DUN", 0); setloadflag_2 = 1; - } else if(QuestStatus(QTYPE_BLOOD)) { + } else if (QuestStatus(QTYPE_BLOOD)) { pSetPiece_2 = (char *)LoadFileInMem("Levels\\L2Data\\Blood1.DUN", 0); setloadflag_2 = 1; - } else if(QuestStatus(QTYPE_BONE)) { + } else if (QuestStatus(QTYPE_BONE)) { pSetPiece_2 = (char *)LoadFileInMem("Levels\\L2Data\\Bonestr2.DUN", 0); setloadflag_2 = 1; } } -// 5B50D8: using guessed type int setloadflag_2; void DRLG_FreeL2SP() { @@ -623,42 +616,42 @@ void DRLG_L2(int entry) BOOL doneflag; doneflag = FALSE; - while(!doneflag) { + while (!doneflag) { nRoomCnt = 0; InitDungeon(); DRLG_InitTrans(); - if(!CreateDungeon()) { + if (!CreateDungeon()) { continue; } L2TileFix(); - if(setloadflag_2) { + if (setloadflag_2) { DRLG_L2SetRoom(nSx1, nSy1); } DRLG_L2FloodTVal(); DRLG_L2TransFix(); - if(entry == 0) { + if (entry == 0) { doneflag = DRLG_L2PlaceMiniSet(USTAIRS, 1, 1, -1, -1, 1, 0); - if(doneflag) { + if (doneflag) { doneflag = DRLG_L2PlaceMiniSet(DSTAIRS, 1, 1, -1, -1, 0, 1); - if(doneflag && currlevel == 5) { + if (doneflag && currlevel == 5) { doneflag = DRLG_L2PlaceMiniSet(WARPSTAIRS, 1, 1, -1, -1, 0, 6); } } ViewY -= 2; - } else if(entry == 1) { + } else if (entry == 1) { doneflag = DRLG_L2PlaceMiniSet(USTAIRS, 1, 1, -1, -1, 0, 0); - if(doneflag) { + if (doneflag) { doneflag = DRLG_L2PlaceMiniSet(DSTAIRS, 1, 1, -1, -1, 1, 1); - if(doneflag && currlevel == 5) { + if (doneflag && currlevel == 5) { doneflag = DRLG_L2PlaceMiniSet(WARPSTAIRS, 1, 1, -1, -1, 0, 6); } } ViewX--; } else { doneflag = DRLG_L2PlaceMiniSet(USTAIRS, 1, 1, -1, -1, 0, 0); - if(doneflag) { + if (doneflag) { doneflag = DRLG_L2PlaceMiniSet(DSTAIRS, 1, 1, -1, -1, 0, 1); - if(doneflag && currlevel == 5) { + if (doneflag && currlevel == 5) { doneflag = DRLG_L2PlaceMiniSet(WARPSTAIRS, 1, 1, -1, -1, 1, 6); } } @@ -782,8 +775,8 @@ void DRLG_L2(int entry) DRLG_L2Subs(); DRLG_L2Shadows(); - for(j = 0; j < 40; j++) { - for(i = 0; i < 40; i++) { + for (j = 0; j < 40; j++) { + for (i = 0; i < 40; i++) { pdungeon[i][j] = dungeon[i][j]; } } @@ -791,9 +784,8 @@ void DRLG_L2(int entry) DRLG_Init_Globals(); DRLG_CheckQuests(nSx1, nSy1); } -// 5B50D8: using guessed type int setloadflag_2; -BOOL DRLG_L2PlaceMiniSet(unsigned char *miniset, int tmin, int tmax, int cx, int cy, BOOL setview, int ldir) +BOOL DRLG_L2PlaceMiniSet(BYTE *miniset, int tmin, int tmax, int cx, int cy, BOOL setview, int ldir) { int sx, sy, sw, sh, xx, yy, i, ii, numt, bailcnt; BOOL found; @@ -801,61 +793,61 @@ BOOL DRLG_L2PlaceMiniSet(unsigned char *miniset, int tmin, int tmax, int cx, int sw = miniset[0]; sh = miniset[1]; - if(tmax - tmin == 0) { + if (tmax - tmin == 0) { numt = 1; } else { numt = random(0, tmax - tmin) + tmin; } - for(i = 0; i < numt; i++) { + for (i = 0; i < numt; i++) { sx = random(0, 40 - sw); sy = random(0, 40 - sh); found = FALSE; - for(bailcnt = 0; !found && bailcnt < 200; bailcnt++) { + for (bailcnt = 0; !found && bailcnt < 200; bailcnt++) { found = TRUE; - if(sx >= nSx1 && sx <= nSx2 && sy >= nSy1 && sy <= nSy2) { + if (sx >= nSx1 && sx <= nSx2 && sy >= nSy1 && sy <= nSy2) { found = FALSE; } - if(cx != -1 && sx >= cx - sw && sx <= cx + 12) { + if (cx != -1 && sx >= cx - sw && sx <= cx + 12) { sx = random(0, 40 - sw); sy = random(0, 40 - sh); found = FALSE; } - if(cy != -1 && sy >= cy - sh && sy <= cy + 12) { + if (cy != -1 && sy >= cy - sh && sy <= cy + 12) { sx = random(0, 40 - sw); sy = random(0, 40 - sh); found = FALSE; } ii = 2; - for(yy = 0; yy < sh && found == TRUE; yy++) { - for(xx = 0; xx < sw && found == TRUE; xx++) { - if(miniset[ii] != 0 && dungeon[xx + sx][yy + sy] != miniset[ii]) { + for (yy = 0; yy < sh && found == TRUE; yy++) { + for (xx = 0; xx < sw && found == TRUE; xx++) { + if (miniset[ii] != 0 && dungeon[xx + sx][yy + sy] != miniset[ii]) { found = FALSE; } - if(dflags[xx + sx][yy + sy] != 0) { + if (dflags[xx + sx][yy + sy] != 0) { found = FALSE; } ii++; } } - if(!found) { + if (!found) { sx++; - if(sx == 40 - sw) { + if (sx == 40 - sw) { sx = 0; sy++; - if(sy == 40 - sh) { + if (sy == 40 - sh) { sy = 0; } } } } - if(bailcnt >= 200) { + if (bailcnt >= 200) { return FALSE; } ii = sw * sh + 2; - for(yy = 0; yy < sh; yy++) { - for(xx = 0; xx < sw; xx++) { - if(miniset[ii] != 0) { + for (yy = 0; yy < sh; yy++) { + for (xx = 0; xx < sw; xx++) { + if (miniset[ii] != 0) { dungeon[xx + sx][yy + sy] = miniset[ii]; } ii++; @@ -863,27 +855,23 @@ BOOL DRLG_L2PlaceMiniSet(unsigned char *miniset, int tmin, int tmax, int cx, int } } - if(setview == TRUE) { + if (setview == TRUE) { ViewX = 2 * sx + 21; ViewY = 2 * sy + 22; } - if(ldir == 0) { + if (ldir == 0) { LvlViewX = 2 * sx + 21; LvlViewY = 2 * sy + 22; } - if(ldir == 6) { + if (ldir == 6) { LvlViewX = 2 * sx + 21; LvlViewY = 2 * sy + 22; } return TRUE; } -// 5276CC: using guessed type int nSx2; -// 5276D4: using guessed type int nSy2; -// 5CF320: using guessed type int LvlViewY; -// 5CF324: using guessed type int LvlViewX; -void DRLG_L2PlaceRndSet(unsigned char *miniset, int rndper) +void DRLG_L2PlaceRndSet(BYTE *miniset, int rndper) { int sx, sy, sw, sh, xx, yy, ii, kk; BOOL found; @@ -891,38 +879,38 @@ void DRLG_L2PlaceRndSet(unsigned char *miniset, int rndper) sw = miniset[0]; sh = miniset[1]; - for(sy = 0; sy < 40 - sh; sy++) { - for(sx = 0; sx < 40 - sw; sx++) { + for (sy = 0; sy < 40 - sh; sy++) { + for (sx = 0; sx < 40 - sw; sx++) { found = TRUE; ii = 2; - if(sx >= nSx1 && sx <= nSx2 && sy >= nSy1 && sy <= nSy2) { + if (sx >= nSx1 && sx <= nSx2 && sy >= nSy1 && sy <= nSy2) { found = FALSE; } - for(yy = 0; yy < sh && found == TRUE; yy++) { - for(xx = 0; xx < sw && found == TRUE; xx++) { - if(miniset[ii] != 0 && dungeon[xx + sx][yy + sy] != miniset[ii]) { + for (yy = 0; yy < sh && found == TRUE; yy++) { + for (xx = 0; xx < sw && found == TRUE; xx++) { + if (miniset[ii] != 0 && dungeon[xx + sx][yy + sy] != miniset[ii]) { found = FALSE; } - if(dflags[xx + sx][yy + sy] != 0) { + if (dflags[xx + sx][yy + sy] != 0) { found = FALSE; } ii++; } } kk = sw * sh + 2; - if(found == TRUE) { - for(yy = sy - sh; yy < sy + 2 * sh && found == TRUE; yy++) { - for(xx = sx - sw; xx < sx + 2 * sw; xx++) { - if(dungeon[xx][yy] == miniset[kk]) { + if (found == TRUE) { + for (yy = sy - sh; yy < sy + 2 * sh && found == TRUE; yy++) { + for (xx = sx - sw; xx < sx + 2 * sw; xx++) { + if (dungeon[xx][yy] == miniset[kk]) { found = FALSE; } } } } - if(found == TRUE && random(0, 100) < rndper) { - for(yy = 0; yy < sh; yy++) { - for(xx = 0; xx < sw; xx++) { - if(miniset[kk] != 0) { + if (found == TRUE && random(0, 100) < rndper) { + for (yy = 0; yy < sh; yy++) { + for (xx = 0; xx < sw; xx++) { + if (miniset[kk] != 0) { dungeon[xx + sx][yy + sy] = miniset[kk]; } kk++; @@ -932,39 +920,37 @@ void DRLG_L2PlaceRndSet(unsigned char *miniset, int rndper) } } } -// 5276CC: using guessed type int nSx2; -// 5276D4: using guessed type int nSy2; void DRLG_L2Subs() { int x, y, i, j, k, rv; - unsigned char c; + BYTE c; - for(y = 0; y < 40; y++) { - for(x = 0; x < 40; x++) { - if((x < nSx1 || x > nSx2) && (y < nSy1 || y > nSy2) && random(0, 4) == 0) { + for (y = 0; y < 40; y++) { + for (x = 0; x < 40; x++) { + if ((x < nSx1 || x > nSx2) && (y < nSy1 || y > nSy2) && random(0, 4) == 0) { c = BTYPESL2[dungeon[x][y]]; - if(c != 0) { + if (c != 0) { rv = random(0, 16); k = -1; - while(rv >= 0) { + while (rv >= 0) { k++; - if(k == sizeof(BTYPESL2)) { + if (k == sizeof(BTYPESL2)) { k = 0; } - if(c == BTYPESL2[k]) { + if (c == BTYPESL2[k]) { rv--; } } - for(j = y - 2; j < y + 2; j++) { - for(i = x - 2; i < x + 2; i++) { - if(dungeon[i][j] == k) { + for (j = y - 2; j < y + 2; j++) { + for (i = x - 2; i < x + 2; i++) { + if (dungeon[i][j] == k) { j = y + 3; i = x + 2; } } } - if(j < y + 3) { + if (j < y + 3) { dungeon[x][y] = k; } } @@ -972,41 +958,39 @@ void DRLG_L2Subs() } } } -// 5276CC: using guessed type int nSx2; -// 5276D4: using guessed type int nSy2; void DRLG_L2Shadows() { int x, y, i; BOOL patflag; - unsigned char sd[2][2]; + BYTE sd[2][2]; - for(y = 1; y < 40; y++) { - for(x = 1; x < 40; x++) { + for (y = 1; y < 40; y++) { + for (x = 1; x < 40; x++) { sd[0][0] = BSTYPESL2[dungeon[x][y]]; sd[1][0] = BSTYPESL2[dungeon[x - 1][y]]; sd[0][1] = BSTYPESL2[dungeon[x][y - 1]]; sd[1][1] = BSTYPESL2[dungeon[x - 1][y - 1]]; - for(i = 0; i < 2; i++) { - if(SPATSL2[i].strig == sd[0][0]) { + for (i = 0; i < 2; i++) { + if (SPATSL2[i].strig == sd[0][0]) { patflag = TRUE; - if(SPATSL2[i].s1 != 0 && SPATSL2[i].s1 != sd[1][1]) { + if (SPATSL2[i].s1 != 0 && SPATSL2[i].s1 != sd[1][1]) { patflag = FALSE; } - if(SPATSL2[i].s2 != 0 && SPATSL2[i].s2 != sd[0][1]) { + if (SPATSL2[i].s2 != 0 && SPATSL2[i].s2 != sd[0][1]) { patflag = FALSE; } - if(SPATSL2[i].s3 != 0 && SPATSL2[i].s3 != sd[1][0]) { + if (SPATSL2[i].s3 != 0 && SPATSL2[i].s3 != sd[1][0]) { patflag = FALSE; } - if(patflag == TRUE) { - if(SPATSL2[i].nv1 != 0) { + if (patflag == TRUE) { + if (SPATSL2[i].nv1 != 0) { dungeon[x - 1][y - 1] = SPATSL2[i].nv1; } - if(SPATSL2[i].nv2 != 0) { + if (SPATSL2[i].nv2 != 0) { dungeon[x][y - 1] = SPATSL2[i].nv2; } - if(SPATSL2[i].nv3 != 0) { + if (SPATSL2[i].nv3 != 0) { dungeon[x - 1][y] = SPATSL2[i].nv3; } } @@ -1015,26 +999,25 @@ void DRLG_L2Shadows() } } } -// 48489A: using guessed type short word_48489A; void DRLG_L2SetRoom(int rx1, int ry1) { int rw, rh, i, j; - unsigned char *sp; + BYTE *sp; - rw = (unsigned char)pSetPiece_2[0]; - rh = (unsigned char)pSetPiece_2[2]; + rw = (BYTE)pSetPiece_2[0]; + rh = (BYTE)pSetPiece_2[2]; setpc_x = rx1; setpc_y = ry1; setpc_w = rw; setpc_h = rh; - sp = (unsigned char *)&pSetPiece_2[4]; + sp = (BYTE *)&pSetPiece_2[4]; - for(j = 0; j < rh; j++) { - for(i = 0; i < rw; i++) { - if(*sp != 0) { + for (j = 0; j < rh; j++) { + for (i = 0; i < rw; i++) { + if (*sp != 0) { dungeon[i + rx1][j + ry1] = *sp; dflags[i + rx1][j + ry1] |= 0x80; } else { @@ -1044,28 +1027,26 @@ void DRLG_L2SetRoom(int rx1, int ry1) } } } -// 5CF330: using guessed type int setpc_h; -// 5CF334: using guessed type int setpc_w; void L2TileFix() { int i, j; - for(j = 0; j < 40; j++) { - for(i = 0; i < 40; i++) { - if(dungeon[i][j] == 1 && dungeon[i][j + 1] == 3) { + for (j = 0; j < 40; j++) { + for (i = 0; i < 40; i++) { + if (dungeon[i][j] == 1 && dungeon[i][j + 1] == 3) { dungeon[i][j + 1] = 1; } - if(dungeon[i][j] == 3 && dungeon[i][j + 1] == 1) { + if (dungeon[i][j] == 3 && dungeon[i][j + 1] == 1) { dungeon[i][j + 1] = 3; } - if(dungeon[i][j] == 3 && dungeon[i + 1][j] == 7) { + if (dungeon[i][j] == 3 && dungeon[i + 1][j] == 7) { dungeon[i + 1][j] = 3; } - if(dungeon[i][j] == 2 && dungeon[i + 1][j] == 3) { + if (dungeon[i][j] == 2 && dungeon[i + 1][j] == 3) { dungeon[i + 1][j] = 2; } - if(dungeon[i][j] == 11 && dungeon[i + 1][j] == 14) { + if (dungeon[i][j] == 11 && dungeon[i + 1][j] == 14) { dungeon[i + 1][j] = 16; } } @@ -1081,23 +1062,23 @@ BOOL CreateDungeon() ForceH = 0; ForceHW = FALSE; - switch(currlevel) { + switch (currlevel) { case 5: - if(quests[QTYPE_BLOOD]._qactive) { + if (quests[QTYPE_BLOOD]._qactive) { ForceHW = TRUE; ForceH = 20; ForceW = 14; } break; case 6: - if(quests[QTYPE_BONE]._qactive) { + if (quests[QTYPE_BONE]._qactive) { ForceHW = TRUE; ForceW = 10; ForceH = 10; } break; case 7: - if(quests[QTYPE_BLIND]._qactive) { + if (quests[QTYPE_BLIND]._qactive) { ForceHW = TRUE; ForceW = 15; ForceH = 15; @@ -1109,61 +1090,61 @@ BOOL CreateDungeon() CreateRoom(2, 2, 39, 39, 0, 0, ForceHW, ForceH, ForceW); - while(pHallList != NULL) { + while (pHallList != NULL) { GetHall(&nHx1, &nHy1, &nHx2, &nHy2, &nHd); ConnectHall(nHx1, nHy1, nHx2, nHy2, nHd); } - for(j = 0; j <= DMAXY; j++) { /// BUGFIX: change '<=' to '<' - for(i = 0; i <= DMAXX; i++) { /// BUGFIX: change '<=' to '<' - if(predungeon[i][j] == 67) { + for (j = 0; j <= DMAXY; j++) { /// BUGFIX: change '<=' to '<' + for (i = 0; i <= DMAXX; i++) { /// BUGFIX: change '<=' to '<' + if (predungeon[i][j] == 67) { predungeon[i][j] = 35; } - if(predungeon[i][j] == 66) { + if (predungeon[i][j] == 66) { predungeon[i][j] = 35; } - if(predungeon[i][j] == 69) { + if (predungeon[i][j] == 69) { predungeon[i][j] = 35; } - if(predungeon[i][j] == 65) { + if (predungeon[i][j] == 65) { predungeon[i][j] = 35; } - if(predungeon[i][j] == 44) { + if (predungeon[i][j] == 44) { predungeon[i][j] = 46; - if(predungeon[i - 1][j - 1] == 32) { + if (predungeon[i - 1][j - 1] == 32) { predungeon[i - 1][j - 1] = 35; } - if(predungeon[i - 1][j] == 32) { + if (predungeon[i - 1][j] == 32) { predungeon[i - 1][j] = 35; } - if(predungeon[i - 1][1 + j] == 32) { + if (predungeon[i - 1][1 + j] == 32) { predungeon[i - 1][1 + j] = 35; } - if(predungeon[i + 1][j - 1] == 32) { + if (predungeon[i + 1][j - 1] == 32) { predungeon[i + 1][j - 1] = 35; } - if(predungeon[i + 1][j] == 32) { + if (predungeon[i + 1][j] == 32) { predungeon[i + 1][j] = 35; } - if(predungeon[i + 1][1 + j] == 32) { + if (predungeon[i + 1][1 + j] == 32) { predungeon[i + 1][1 + j] = 35; } - if(predungeon[i][j - 1] == 32) { + if (predungeon[i][j - 1] == 32) { predungeon[i][j - 1] = 35; } - if(predungeon[i][j + 1] == 32) { + if (predungeon[i][j + 1] == 32) { predungeon[i][j + 1] = 35; } } } } - if(!DL2_FillVoids()) { + if (!DL2_FillVoids()) { return FALSE; } - for(j = 0; j < DMAXY; j++) { - for(i = 0; i < DMAXX; i++) { + for (j = 0; j < DMAXY; j++) { + for (i = 0; i < DMAXX; i++) { DoPatternCheck(i, j); } } @@ -1175,32 +1156,32 @@ void CreateRoom(int nX1, int nY1, int nX2, int nY2, int nRDest, int nHDir, BOOL { int nAw, nAh, nRw, nRh, nRx1, nRy1, nRx2, nRy2, nHw, nHh, nHx1, nHy1, nHx2, nHy2, nRid; - if(nRoomCnt >= 80) { + if (nRoomCnt >= 80) { return; } nAw = nX2 - nX1; nAh = nY2 - nY1; - if(nAw < Area_Min || nAh < Area_Min) { + if (nAw < Area_Min || nAh < Area_Min) { return; } - if(nAw > Room_Max) { + if (nAw > Room_Max) { nRw = random(0, Room_Max - Room_Min) + Room_Min; - } else if(nAw > Room_Min) { + } else if (nAw > Room_Min) { nRw = random(0, nAw - Room_Min) + Room_Min; } else { nRw = nAw; } - if(nAh > Room_Max) { + if (nAh > Room_Max) { nRh = random(0, Room_Max - Room_Min) + Room_Min; - } else if(nAh > Room_Min) { + } else if (nAh > Room_Min) { nRh = random(0, nAh - Room_Min) + Room_Min; } else { nRh = nAh; } - if(ForceHW == TRUE) { + if (ForceHW == TRUE) { nRw = nW; nRh = nH; } @@ -1209,42 +1190,42 @@ void CreateRoom(int nX1, int nY1, int nX2, int nY2, int nRDest, int nHDir, BOOL nRy1 = random(0, nY2 - nY1) + nY1; nRx2 = nRw + nRx1; nRy2 = nRh + nRy1; - if(nRx2 > nX2) { + if (nRx2 > nX2) { nRx2 = nX2; nRx1 = nX2 - nRw; } - if(nRy2 > nY2) { + if (nRy2 > nY2) { nRy2 = nY2; nRy1 = nY2 - nRh; } - if(nRx1 >= 38) { + if (nRx1 >= 38) { nRx1 = 38; } - if(nRy1 >= 38) { + if (nRy1 >= 38) { nRy1 = 38; } - if(nRx1 <= 1) { + if (nRx1 <= 1) { nRx1 = 1; } - if(nRy1 <= 1) { + if (nRy1 <= 1) { nRy1 = 1; } - if(nRx2 >= 38) { + if (nRx2 >= 38) { nRx2 = 38; } - if(nRy2 >= 38) { + if (nRy2 >= 38) { nRy2 = 38; } - if(nRx2 <= 1) { + if (nRx2 <= 1) { nRx2 = 1; } - if(nRy2 <= 1) { + if (nRy2 <= 1) { nRy2 = 1; } DefineRoom(nRx1, nRy1, nRx2, nRy2, ForceHW); - if(ForceHW == TRUE) { + if (ForceHW == TRUE) { nSx1 = nRx1 + 2; nSy1 = nRy1 + 2; nSx2 = nRx2; @@ -1254,29 +1235,29 @@ void CreateRoom(int nX1, int nY1, int nX2, int nY2, int nRDest, int nHDir, BOOL nRid = nRoomCnt; RoomList[nRid].nRoomDest = nRDest; - if(nRDest != 0) { - if(nHDir == 1) { + if (nRDest != 0) { + if (nHDir == 1) { nHx1 = random(0, nRx2 - nRx1 - 2) + nRx1 + 1; nHy1 = nRy1; nHw = RoomList[nRDest].nRoomx2 - RoomList[nRDest].nRoomx1 - 2; nHx2 = random(0, nHw) + RoomList[nRDest].nRoomx1 + 1; nHy2 = RoomList[nRDest].nRoomy2; } - if(nHDir == 3) { + if (nHDir == 3) { nHx1 = random(0, nRx2 - nRx1 - 2) + nRx1 + 1; nHy1 = nRy2; nHw = RoomList[nRDest].nRoomx2 - RoomList[nRDest].nRoomx1 - 2; nHx2 = random(0, nHw) + RoomList[nRDest].nRoomx1 + 1; nHy2 = RoomList[nRDest].nRoomy1; } - if(nHDir == 2) { + if (nHDir == 2) { nHx1 = nRx2; nHy1 = random(0, nRy2 - nRy1 - 2) + nRy1 + 1; nHx2 = RoomList[nRDest].nRoomx1; nHh = RoomList[nRDest].nRoomy2 - RoomList[nRDest].nRoomy1 - 2; nHy2 = random(0, nHh) + RoomList[nRDest].nRoomy1 + 1; } - if(nHDir == 4) { + if (nHDir == 4) { nHx1 = nRx1; nHy1 = random(0, nRy2 - nRy1 - 2) + nRy1 + 1; nHx2 = RoomList[nRDest].nRoomx2; @@ -1286,7 +1267,7 @@ void CreateRoom(int nX1, int nY1, int nX2, int nY2, int nRDest, int nHDir, BOOL AddHall(nHx1, nHy1, nHx2, nHy2, nHDir); } - if(nRh > nRw) { + if (nRh > nRw) { CreateRoom(nX1 + 2, nY1 + 2, nRx1 - 2, nRy2 - 2, nRid, 2, 0, 0, 0); CreateRoom(nRx2 + 2, nRy1 + 2, nX2 - 2, nY2 - 2, nRid, 4, 0, 0, 0); CreateRoom(nX1 + 2, nRy2 + 2, nRx2 - 2, nY2 - 2, nRid, 1, 0, 0, 0); @@ -1298,11 +1279,6 @@ void CreateRoom(int nX1, int nY1, int nX2, int nY2, int nRDest, int nHDir, BOOL CreateRoom(nRx2 + 2, nY1 + 2, nX2 - 2, nRy2 - 2, nRid, 4, 0, 0, 0); } } -// 484858: using guessed type int Area_Min; -// 48485C: using guessed type int Room_Max; -// 484860: using guessed type int Room_Min; -// 5276CC: using guessed type int nSx2; -// 5276D4: using guessed type int nSy2; void DefineRoom(int nX1, int nY1, int nX2, int nY2, BOOL ForceHW) { @@ -1319,23 +1295,23 @@ void DefineRoom(int nX1, int nY1, int nX2, int nY2, BOOL ForceHW) RoomList[nRoomCnt].nRoomy1 = nY1; RoomList[nRoomCnt].nRoomy2 = nY2; - if(ForceHW == TRUE) { - for(i = nX1; i < nX2; i++) { - while(i < nY2) { + if (ForceHW == TRUE) { + for (i = nX1; i < nX2; i++) { + while (i < nY2) { dflags[i][nY1] |= 0x80; i++; } } } - for(i = nX1 + 1; i <= nX2 - 1; i++) { + for (i = nX1 + 1; i <= nX2 - 1; i++) { predungeon[i][nY1] = 35; predungeon[i][nY2] = 35; } nY2--; - for(j = nY1 + 1; j <= nY2; j++) { + for (j = nY1 + 1; j <= nY2; j++) { predungeon[nX1][j] = 35; predungeon[nX2][j] = 35; - for(i = nX1 + 1; i < nX2; i++) { + for (i = nX1 + 1; i < nX2; i++) { predungeon[i][j] = 46; } } @@ -1345,7 +1321,7 @@ void AddHall(int nX1, int nY1, int nX2, int nY2, int nHd) { HALLNODE *p1, *p2; - if(pHallList == NULL) { + if (pHallList == NULL) { pHallList = (HALLNODE *)DiabloAllocPtr(sizeof(*pHallList)); pHallList->nHallx1 = nX1; pHallList->nHally1 = nY1; @@ -1362,7 +1338,7 @@ void AddHall(int nX1, int nY1, int nX2, int nY2, int nHd) p1->nHalldir = nHd; p1->pNext = NULL; p2 = pHallList; - while(p2->pNext != NULL) { + while (p2->pNext != NULL) { p2 = p2->pNext; } p2->pNext = p1; @@ -1403,46 +1379,46 @@ void ConnectHall(int nX1, int nY1, int nX2, int nY2, int nHd) predungeon[nX2][nY2] = 44; fInroom = FALSE; - while(!fDoneflag) { - if(nX1 >= 38 && nCurrd == 2) { + while (!fDoneflag) { + if (nX1 >= 38 && nCurrd == 2) { nCurrd = 4; } - if(nY1 >= 38 && nCurrd == 3) { + if (nY1 >= 38 && nCurrd == 3) { nCurrd = 1; } - if(nX1 <= 1 && nCurrd == 4) { + if (nX1 <= 1 && nCurrd == 4) { nCurrd = 2; } - if(nY1 <= 1 && nCurrd == 1) { + if (nY1 <= 1 && nCurrd == 1) { nCurrd = 3; } - if(predungeon[nX1][nY1] == 67 && (nCurrd == 1 || nCurrd == 4)) { + if (predungeon[nX1][nY1] == 67 && (nCurrd == 1 || nCurrd == 4)) { nCurrd = 2; } - if(predungeon[nX1][nY1] == 66 && (nCurrd == 1 || nCurrd == 2)) { + if (predungeon[nX1][nY1] == 66 && (nCurrd == 1 || nCurrd == 2)) { nCurrd = 3; } - if(predungeon[nX1][nY1] == 69 && (nCurrd == 4 || nCurrd == 3)) { + if (predungeon[nX1][nY1] == 69 && (nCurrd == 4 || nCurrd == 3)) { nCurrd = 1; } - if(predungeon[nX1][nY1] == 65 && (nCurrd == 2 || nCurrd == 3)) { + if (predungeon[nX1][nY1] == 65 && (nCurrd == 2 || nCurrd == 3)) { nCurrd = 4; } nX1 += Dir_Xadd[nCurrd]; nY1 += Dir_Yadd[nCurrd]; - if(predungeon[nX1][nY1] == 32) { - if(fInroom) { + if (predungeon[nX1][nY1] == 32) { + if (fInroom) { CreateDoorType(nX1 - Dir_Xadd[nCurrd], nY1 - Dir_Yadd[nCurrd]); } else { - if(fMinusFlag < 50) { - if(nCurrd != 1 && nCurrd != 3) { + if (fMinusFlag < 50) { + if (nCurrd != 1 && nCurrd != 3) { PlaceHallExt(nX1, nY1 - 1); } else { PlaceHallExt(nX1 - 1, nY1); } } - if(fPlusFlag < 50) { - if(nCurrd != 1 && nCurrd != 3) { + if (fPlusFlag < 50) { + if (nCurrd != 1 && nCurrd != 3) { PlaceHallExt(nX1, nY1 + 1); } else { PlaceHallExt(nX1 + 1, nY1); @@ -1452,22 +1428,22 @@ void ConnectHall(int nX1, int nY1, int nX2, int nY2, int nHd) predungeon[nX1][nY1] = 44; fInroom = FALSE; } else { - if(!fInroom && predungeon[nX1][nY1] == 35) { + if (!fInroom && predungeon[nX1][nY1] == 35) { CreateDoorType(nX1, nY1); } - if(predungeon[nX1][nY1] != 44) { + if (predungeon[nX1][nY1] != 44) { fInroom = TRUE; } } nDx = abs(nX2 - nX1); nDy = abs(nY2 - nY1); - if(nDx > nDy) { + if (nDx > nDy) { nRp = 2 * nDx; - if(nRp > 30) { + if (nRp > 30) { nRp = 30; } - if(random(0, 100) < nRp) { - if(nX2 <= nX1 || nX1 >= 40) { + if (random(0, 100) < nRp) { + if (nX2 <= nX1 || nX1 >= 40) { nCurrd = 4; } else { nCurrd = 2; @@ -1475,60 +1451,60 @@ void ConnectHall(int nX1, int nY1, int nX2, int nY2, int nHd) } } else { nRp = 5 * nDy; - if(nRp > 80) { + if (nRp > 80) { nRp = 80; } - if(random(0, 100) < nRp) { - if(nY2 <= nY1 || nY1 >= 40) { + if (random(0, 100) < nRp) { + if (nY2 <= nY1 || nY1 >= 40) { nCurrd = 1; } else { nCurrd = 3; } } } - if(nDy < 10 && nX1 == nX2 && (nCurrd == 2 || nCurrd == 4)) { - if(nY2 <= nY1 || nY1 >= 40) { + if (nDy < 10 && nX1 == nX2 && (nCurrd == 2 || nCurrd == 4)) { + if (nY2 <= nY1 || nY1 >= 40) { nCurrd = 1; } else { nCurrd = 3; } } - if(nDx < 10 && nY1 == nY2 && (nCurrd == 1 || nCurrd == 3)) { - if(nX2 <= nX1 || nX1 >= 40) { + if (nDx < 10 && nY1 == nY2 && (nCurrd == 1 || nCurrd == 3)) { + if (nX2 <= nX1 || nX1 >= 40) { nCurrd = 4; } else { nCurrd = 2; } } - if(nDy == 1 && nDx > 1 && (nCurrd == 1 || nCurrd == 3)) { - if(nX2 <= nX1 || nX1 >= 40) { + if (nDy == 1 && nDx > 1 && (nCurrd == 1 || nCurrd == 3)) { + if (nX2 <= nX1 || nX1 >= 40) { nCurrd = 4; } else { nCurrd = 2; } } - if(nDx == 1 && nDy > 1 && (nCurrd == 2 || nCurrd == 4)) { - if(nY2 <= nY1 || nX1 >= 40) { + if (nDx == 1 && nDy > 1 && (nCurrd == 2 || nCurrd == 4)) { + if (nY2 <= nY1 || nX1 >= 40) { nCurrd = 1; } else { nCurrd = 3; } } - if(nDx == 0 && predungeon[nX1][nY1] != 32 && (nCurrd == 2 || nCurrd == 4)) { - if(nX2 <= nOrigX1 || nX1 >= 40) { + if (nDx == 0 && predungeon[nX1][nY1] != 32 && (nCurrd == 2 || nCurrd == 4)) { + if (nX2 <= nOrigX1 || nX1 >= 40) { nCurrd = 1; } else { nCurrd = 3; } } - if(nDy == 0 && predungeon[nX1][nY1] != 32 && (nCurrd == 1 || nCurrd == 3)) { - if(nY2 <= nOrigY1 || nY1 >= 40) { + if (nDy == 0 && predungeon[nX1][nY1] != 32 && (nCurrd == 1 || nCurrd == 3)) { + if (nY2 <= nOrigY1 || nY1 >= 40) { nCurrd = 4; } else { nCurrd = 2; } } - if(nX1 == nX2 && nY1 == nY2) { + if (nX1 == nX2 && nY1 == nY2) { fDoneflag = TRUE; } } @@ -1540,30 +1516,30 @@ void CreateDoorType(int nX, int nY) fDoneflag = FALSE; - if(predungeon[nX - 1][nY] == 68) { + if (predungeon[nX - 1][nY] == 68) { fDoneflag = TRUE; } - if(predungeon[nX + 1][nY] == 68) { + if (predungeon[nX + 1][nY] == 68) { fDoneflag = TRUE; } - if(predungeon[nX][nY - 1] == 68) { + if (predungeon[nX][nY - 1] == 68) { fDoneflag = TRUE; } - if(predungeon[nX][nY + 1] == 68) { + if (predungeon[nX][nY + 1] == 68) { fDoneflag = TRUE; } - if(predungeon[nX][nY] == 66 || predungeon[nX][nY] == 67 || predungeon[nX][nY] == 65 || predungeon[nX][nY] == 69) { + if (predungeon[nX][nY] == 66 || predungeon[nX][nY] == 67 || predungeon[nX][nY] == 65 || predungeon[nX][nY] == 69) { fDoneflag = TRUE; } - if(!fDoneflag) { + if (!fDoneflag) { predungeon[nX][nY] = 68; } } void PlaceHallExt(int nX, int nY) { - if(predungeon[nX][nY] == 32) { + if (predungeon[nX][nY] == 32) { predungeon[nX][nY] = 44; } } @@ -1572,58 +1548,58 @@ void DoPatternCheck(int i, int j) { int k, l, x, y, nOk; - for(k = 0; Patterns[k][4] != 255; k++) { + for (k = 0; Patterns[k][4] != 255; k++) { x = i - 1; y = j - 1; nOk = 254; - for(l = 0; l < 9 && nOk == 254; l++) { + for (l = 0; l < 9 && nOk == 254; l++) { nOk = 255; - if(l == 3 || l == 6) { + if (l == 3 || l == 6) { y++; x = i - 1; } - if(x >= 0 && x < 40 && y >= 0 && y < 40) { - switch(Patterns[k][l]) { + if (x >= 0 && x < 40 && y >= 0 && y < 40) { + switch (Patterns[k][l]) { case 0: nOk = 254; break; case 1: - if(predungeon[x][y] == 35) { + if (predungeon[x][y] == 35) { nOk = 254; } break; case 2: - if(predungeon[x][y] == 46) { + if (predungeon[x][y] == 46) { nOk = 254; } break; case 4: - if(predungeon[x][y] == 32) { + if (predungeon[x][y] == 32) { nOk = 254; } break; case 3: - if(predungeon[x][y] == 68) { + if (predungeon[x][y] == 68) { nOk = 254; } break; case 5: - if(predungeon[x][y] == 68 || predungeon[x][y] == 46) { + if (predungeon[x][y] == 68 || predungeon[x][y] == 46) { nOk = 254; } break; case 6: - if(predungeon[x][y] == 68 || predungeon[x][y] == 35) { + if (predungeon[x][y] == 68 || predungeon[x][y] == 35) { nOk = 254; } break; case 7: - if(predungeon[x][y] == 32 || predungeon[x][y] == 46) { + if (predungeon[x][y] == 32 || predungeon[x][y] == 46) { nOk = 254; } break; case 8: - if(predungeon[x][y] == 68 || predungeon[x][y] == 35 || predungeon[x][y] == 46) { + if (predungeon[x][y] == 68 || predungeon[x][y] == 35 || predungeon[x][y] == 46) { nOk = 254; } break; @@ -1633,7 +1609,7 @@ void DoPatternCheck(int i, int j) } x++; } - if(nOk == 254) { + if (nOk == 254) { dungeon[i][j] = Patterns[k][9]; } } @@ -1646,259 +1622,259 @@ BOOL DL2_FillVoids() int to; to = 0; - while(DL2_NumNoChar() > 700 && to < 100) { + while (DL2_NumNoChar() > 700 && to < 100) { xx = random(0, 38) + 1; yy = random(0, 38) + 1; - if(predungeon[xx][yy] != 35) { + if (predungeon[xx][yy] != 35) { continue; } xf1 = xf2 = yf1 = yf2 = FALSE; - if(predungeon[xx - 1][yy] == 32 && predungeon[xx + 1][yy] == 46) { - if(predungeon[xx + 1][yy - 1] == 46 - && predungeon[xx + 1][yy + 1] == 46 - && predungeon[xx - 1][yy - 1] == 32 - && predungeon[xx - 1][yy + 1] == 32) { + if (predungeon[xx - 1][yy] == 32 && predungeon[xx + 1][yy] == 46) { + if (predungeon[xx + 1][yy - 1] == 46 + && predungeon[xx + 1][yy + 1] == 46 + && predungeon[xx - 1][yy - 1] == 32 + && predungeon[xx - 1][yy + 1] == 32) { xf1 = yf1 = yf2 = TRUE; } - } else if(predungeon[xx + 1][yy] == 32 && predungeon[xx - 1][yy] == 46) { - if(predungeon[xx - 1][yy - 1] == 46 - && predungeon[xx - 1][yy + 1] == 46 - && predungeon[xx + 1][yy - 1] == 32 - && predungeon[xx + 1][yy + 1] == 32) { + } else if (predungeon[xx + 1][yy] == 32 && predungeon[xx - 1][yy] == 46) { + if (predungeon[xx - 1][yy - 1] == 46 + && predungeon[xx - 1][yy + 1] == 46 + && predungeon[xx + 1][yy - 1] == 32 + && predungeon[xx + 1][yy + 1] == 32) { xf2 = yf1 = yf2 = TRUE; } - } else if(predungeon[xx][yy - 1] == 32 && predungeon[xx][yy + 1] == 46) { - if(predungeon[xx - 1][yy + 1] == 46 - && predungeon[xx + 1][yy + 1] == 46 - && predungeon[xx - 1][yy - 1] == 32 - && predungeon[xx + 1][yy - 1] == 32) { + } else if (predungeon[xx][yy - 1] == 32 && predungeon[xx][yy + 1] == 46) { + if (predungeon[xx - 1][yy + 1] == 46 + && predungeon[xx + 1][yy + 1] == 46 + && predungeon[xx - 1][yy - 1] == 32 + && predungeon[xx + 1][yy - 1] == 32) { yf1 = xf1 = xf2 = TRUE; } - } else if(predungeon[xx][yy + 1] == 32 && predungeon[xx][yy - 1] == 46) { - if(predungeon[xx - 1][yy - 1] == 46 - && predungeon[xx + 1][yy - 1] == 46 - && predungeon[xx - 1][yy + 1] == 32 - && predungeon[xx + 1][yy + 1] == 32) { + } else if (predungeon[xx][yy + 1] == 32 && predungeon[xx][yy - 1] == 46) { + if (predungeon[xx - 1][yy - 1] == 46 + && predungeon[xx + 1][yy - 1] == 46 + && predungeon[xx - 1][yy + 1] == 32 + && predungeon[xx + 1][yy + 1] == 32) { yf2 = xf1 = xf2 = TRUE; } } - if(DL2_Cont(xf1, yf1, xf2, yf2)) { - if(xf1) { + if (DL2_Cont(xf1, yf1, xf2, yf2)) { + if (xf1) { x1 = xx - 1; } else { x1 = xx; } - if(xf2) { + if (xf2) { x2 = xx + 1; } else { x2 = xx; } - if(yf1) { + if (yf1) { y1 = yy - 1; } else { y1 = yy; } - if(yf2) { + if (yf2) { y2 = yy + 1; } else { y2 = yy; } - if(!xf1) { - while(yf1 || yf2) { - if(y1 == 0) { + if (!xf1) { + while (yf1 || yf2) { + if (y1 == 0) { yf1 = FALSE; } - if(y2 == 39) { + if (y2 == 39) { yf2 = FALSE; } - if(y2 - y1 >= 14) { + if (y2 - y1 >= 14) { yf1 = FALSE; yf2 = FALSE; } - if(yf1) { + if (yf1) { y1--; } - if(yf2) { + if (yf2) { y2++; } - if(predungeon[x2][y1] != 32) { + if (predungeon[x2][y1] != 32) { yf1 = FALSE; } - if(predungeon[x2][y2] != 32) { + if (predungeon[x2][y2] != 32) { yf2 = FALSE; } } y1 += 2; y2 -= 2; - if(y2 - y1 > 5) { - while(xf2) { - if(x2 == 39) { + if (y2 - y1 > 5) { + while (xf2) { + if (x2 == 39) { xf2 = FALSE; } - if(x2 - x1 >= 12) { + if (x2 - x1 >= 12) { xf2 = FALSE; } - for(jj = y1; jj <= y2; jj++) { - if(predungeon[x2][jj] != 32) { + for (jj = y1; jj <= y2; jj++) { + if (predungeon[x2][jj] != 32) { xf2 = FALSE; } } - if(xf2) { + if (xf2) { x2++; } } x2 -= 2; - if(x2 - x1 > 5) { + if (x2 - x1 > 5) { DL2_DrawRoom(x1, y1, x2, y2); DL2_KnockWalls(x1, y1, x2, y2); } } - } else if(!xf2) { - while(yf1 || yf2) { - if(y1 == 0) { + } else if (!xf2) { + while (yf1 || yf2) { + if (y1 == 0) { yf1 = FALSE; } - if(y2 == 39) { + if (y2 == 39) { yf2 = FALSE; } - if(y2 - y1 >= 14) { + if (y2 - y1 >= 14) { yf1 = FALSE; yf2 = FALSE; } - if(yf1) { + if (yf1) { y1--; } - if(yf2) { + if (yf2) { y2++; } - if(predungeon[x1][y1] != 32) { + if (predungeon[x1][y1] != 32) { yf1 = FALSE; } - if(predungeon[x1][y2] != 32) { + if (predungeon[x1][y2] != 32) { yf2 = FALSE; } } y1 += 2; y2 -= 2; - if(y2 - y1 > 5) { - while(xf1) { - if(x1 == 0) { + if (y2 - y1 > 5) { + while (xf1) { + if (x1 == 0) { xf1 = FALSE; } - if(x2 - x1 >= 12) { + if (x2 - x1 >= 12) { xf1 = FALSE; } - for(jj = y1; jj <= y2; jj++) { - if(predungeon[x1][jj] != 32) { + for (jj = y1; jj <= y2; jj++) { + if (predungeon[x1][jj] != 32) { xf1 = FALSE; } } - if(xf1) { + if (xf1) { x1--; } } x1 += 2; - if(x2 - x1 > 5) { + if (x2 - x1 > 5) { DL2_DrawRoom(x1, y1, x2, y2); DL2_KnockWalls(x1, y1, x2, y2); } } - } else if(!yf1) { - while(xf1 || xf2) { - if(x1 == 0) { + } else if (!yf1) { + while (xf1 || xf2) { + if (x1 == 0) { xf1 = FALSE; } - if(x2 == 39) { + if (x2 == 39) { xf2 = FALSE; } - if(x2 - x1 >= 14) { + if (x2 - x1 >= 14) { xf1 = FALSE; xf2 = FALSE; } - if(xf1) { + if (xf1) { x1--; } - if(xf2) { + if (xf2) { x2++; } - if(predungeon[x1][y2] != 32) { + if (predungeon[x1][y2] != 32) { xf1 = FALSE; } - if(predungeon[x2][y2] != 32) { + if (predungeon[x2][y2] != 32) { xf2 = FALSE; } } x1 += 2; x2 -= 2; - if(x2 - x1 > 5) { - while(yf2) { - if(y2 == 39) { + if (x2 - x1 > 5) { + while (yf2) { + if (y2 == 39) { yf2 = FALSE; } - if(y2 - y1 >= 12) { + if (y2 - y1 >= 12) { yf2 = FALSE; } - for(ii = x1; ii <= x2; ii++) { - if(predungeon[ii][y2] != 32) { + for (ii = x1; ii <= x2; ii++) { + if (predungeon[ii][y2] != 32) { yf2 = FALSE; } } - if(yf2) { + if (yf2) { y2++; } } y2 -= 2; - if(y2 - y1 > 5) { + if (y2 - y1 > 5) { DL2_DrawRoom(x1, y1, x2, y2); DL2_KnockWalls(x1, y1, x2, y2); } } - } else if(!yf2) { - while(xf1 || xf2) { - if(x1 == 0) { + } else if (!yf2) { + while (xf1 || xf2) { + if (x1 == 0) { xf1 = FALSE; } - if(x2 == 39) { + if (x2 == 39) { xf2 = FALSE; } - if(x2 - x1 >= 14) { + if (x2 - x1 >= 14) { xf1 = FALSE; xf2 = FALSE; } - if(xf1) { + if (xf1) { x1--; } - if(xf2) { + if (xf2) { x2++; } - if(predungeon[x1][y1] != 32) { + if (predungeon[x1][y1] != 32) { xf1 = FALSE; } - if(predungeon[x2][y1] != 32) { + if (predungeon[x2][y1] != 32) { xf2 = FALSE; } } x1 += 2; x2 -= 2; - if(x2 - x1 > 5) { - while(yf1) { - if(y1 == 0) { + if (x2 - x1 > 5) { + while (yf1) { + if (y1 == 0) { yf1 = FALSE; } - if(y2 - y1 >= 12) { + if (y2 - y1 >= 12) { yf1 = FALSE; } - for(ii = x1; ii <= x2; ii++) { - if(predungeon[ii][y1] != 32) { + for (ii = x1; ii <= x2; ii++) { + if (predungeon[ii][y1] != 32) { yf1 = FALSE; } } - if(yf1) { + if (yf1) { y1--; } } y1 += 2; - if(y2 - y1 > 5) { + if (y2 - y1 > 5) { DL2_DrawRoom(x1, y1, x2, y2); DL2_KnockWalls(x1, y1, x2, y2); } @@ -1913,13 +1889,13 @@ BOOL DL2_FillVoids() BOOL DL2_Cont(BOOL x1f, BOOL y1f, BOOL x2f, BOOL y2f) { - if(x1f && x2f && y1f && y2f) { + if (x1f && x2f && y1f && y2f) { return FALSE; } - if(x1f && x2f && (y1f || y2f)) { + if (x1f && x2f && (y1f || y2f)) { return TRUE; } - if(y1f && y2f && (x1f || x2f)) { + if (y1f && y2f && (x1f || x2f)) { return TRUE; } @@ -1931,9 +1907,9 @@ int DL2_NumNoChar() int t, ii, jj; t = 0; - for(jj = 0; jj < 40; jj++) { - for(ii = 0; ii < 40; ii++) { - if(predungeon[ii][jj] == 32) { + for (jj = 0; jj < 40; jj++) { + for (ii = 0; ii < 40; ii++) { + if (predungeon[ii][jj] == 32) { t++; } } @@ -1946,16 +1922,16 @@ void DL2_DrawRoom(int x1, int y1, int x2, int y2) { int ii, jj; - for(jj = y1; jj <= y2; jj++) { - for(ii = x1; ii <= x2; ii++) { + for (jj = y1; jj <= y2; jj++) { + for (ii = x1; ii <= x2; ii++) { predungeon[ii][jj] = 46; } } - for(jj = y1; jj <= y2; jj++) { + for (jj = y1; jj <= y2; jj++) { predungeon[x1][jj] = 35; predungeon[x2][jj] = 35; } - for(ii = x1; ii <= x2; ii++) { + for (ii = x1; ii <= x2; ii++) { predungeon[ii][y1] = 35; predungeon[ii][y2] = 35; } @@ -1965,31 +1941,31 @@ void DL2_KnockWalls(int x1, int y1, int x2, int y2) { int ii, jj; - for(ii = x1 + 1; ii < x2; ii++) { - if(predungeon[ii][y1 - 1] == 46 && predungeon[ii][y1 + 1] == 46) { + for (ii = x1 + 1; ii < x2; ii++) { + if (predungeon[ii][y1 - 1] == 46 && predungeon[ii][y1 + 1] == 46) { predungeon[ii][y1] = 46; } - if(predungeon[ii][y2 - 1] == 46 && predungeon[ii][y2 + 1] == 46) { + if (predungeon[ii][y2 - 1] == 46 && predungeon[ii][y2 + 1] == 46) { predungeon[ii][y2] = 46; } - if(predungeon[ii][y1 - 1] == 68) { + if (predungeon[ii][y1 - 1] == 68) { predungeon[ii][y1 - 1] = 46; } - if(predungeon[ii][y2 + 1] == 68) { + if (predungeon[ii][y2 + 1] == 68) { predungeon[ii][y2 + 1] = 46; } } - for(jj = y1 + 1; jj < y2; jj++) { - if(predungeon[x1 - 1][jj] == 46 && predungeon[x1 + 1][jj] == 46) { + for (jj = y1 + 1; jj < y2; jj++) { + if (predungeon[x1 - 1][jj] == 46 && predungeon[x1 + 1][jj] == 46) { predungeon[x1][jj] = 46; } - if(predungeon[x2 - 1][jj] == 46 && predungeon[x2 + 1][jj] == 46) { + if (predungeon[x2 - 1][jj] == 46 && predungeon[x2 + 1][jj] == 46) { predungeon[x2][jj] = 46; } - if(predungeon[x1 - 1][jj] == 68) { + if (predungeon[x1 - 1][jj] == 68) { predungeon[x1 - 1][jj] = 46; } - if(predungeon[x2 + 1][jj] == 68) { + if (predungeon[x2 + 1][jj] == 68) { predungeon[x2 + 1][jj] = 46; } } @@ -2000,10 +1976,10 @@ void DRLG_L2FloodTVal() int i, j, xx, yy; yy = 16; - for(j = 0; j < 40; j++) { + for (j = 0; j < 40; j++) { xx = 16; - for(i = 0; i < 40; i++) { - if(dungeon[i][j] == 3 && dTransVal[xx][yy] == 0) { + for (i = 0; i < 40; i++) { + if (dungeon[i][j] == 3 && dTransVal[xx][yy] == 0) { DRLG_L2FTVR(i, j, xx, yy, 0); TransVal++; } @@ -2012,37 +1988,36 @@ void DRLG_L2FloodTVal() yy += 2; } } -// 5A5590: using guessed type char TransVal; void DRLG_L2FTVR(int i, int j, int x, int y, int d) { - if(dTransVal[x][y] != 0 || dungeon[i][j] != 3) { - if(d == 1) { + if (dTransVal[x][y] != 0 || dungeon[i][j] != 3) { + if (d == 1) { dTransVal[x][y] = TransVal; dTransVal[x][y + 1] = TransVal; } - if(d == 2) { + if (d == 2) { dTransVal[x + 1][y] = TransVal; dTransVal[x + 1][y + 1] = TransVal; } - if(d == 3) { + if (d == 3) { dTransVal[x][y] = TransVal; dTransVal[x + 1][y] = TransVal; } - if(d == 4) { + if (d == 4) { dTransVal[x][y + 1] = TransVal; dTransVal[x + 1][y + 1] = TransVal; } - if(d == 5) { + if (d == 5) { dTransVal[x + 1][y + 1] = TransVal; } - if(d == 6) { + if (d == 6) { dTransVal[x][y + 1] = TransVal; } - if(d == 7) { + if (d == 7) { dTransVal[x + 1][y] = TransVal; } - if(d == 8) { + if (d == 8) { dTransVal[x][y] = TransVal; } } else { @@ -2060,33 +2035,32 @@ void DRLG_L2FTVR(int i, int j, int x, int y, int d) DRLG_L2FTVR(i + 1, j + 1, x + 2, y + 2, 8); } } -// 5A5590: using guessed type char TransVal; void DRLG_L2TransFix() { int i, j, xx, yy; yy = 16; - for(j = 0; j < 40; j++) { + for (j = 0; j < 40; j++) { xx = 16; - for(i = 0; i < 40; i++) { - if(dungeon[i][j] == 14 && dungeon[i][j - 1] == 10) { + for (i = 0; i < 40; i++) { + if (dungeon[i][j] == 14 && dungeon[i][j - 1] == 10) { dTransVal[xx + 1][yy] = dTransVal[xx][yy]; dTransVal[xx + 1][yy + 1] = dTransVal[xx][yy]; } - if(dungeon[i][j] == 15 && dungeon[i + 1][j] == 11) { + if (dungeon[i][j] == 15 && dungeon[i + 1][j] == 11) { dTransVal[xx][yy + 1] = dTransVal[xx][yy]; dTransVal[xx + 1][yy + 1] = dTransVal[xx][yy]; } - if(dungeon[i][j] == 10) { + if (dungeon[i][j] == 10) { dTransVal[xx + 1][yy] = dTransVal[xx][yy]; dTransVal[xx + 1][yy + 1] = dTransVal[xx][yy]; } - if(dungeon[i][j] == 11) { + if (dungeon[i][j] == 11) { dTransVal[xx][yy + 1] = dTransVal[xx][yy]; dTransVal[xx + 1][yy + 1] = dTransVal[xx][yy]; } - if(dungeon[i][j] == 16) { + if (dungeon[i][j] == 16) { dTransVal[xx + 1][yy] = dTransVal[xx][yy]; dTransVal[xx][yy + 1] = dTransVal[xx][yy]; dTransVal[xx + 1][yy + 1] = dTransVal[xx][yy]; @@ -2101,24 +2075,24 @@ void L2DirtFix() { int i, j; - for(j = 0; j < 40; j++) { - for(i = 0; i < 40; i++) { - if(dungeon[i][j] == 13 && dungeon[i + 1][j] != 11) { + for (j = 0; j < 40; j++) { + for (i = 0; i < 40; i++) { + if (dungeon[i][j] == 13 && dungeon[i + 1][j] != 11) { dungeon[i][j] = 146; } - if(dungeon[i][j] == 11 && dungeon[i + 1][j] != 11) { + if (dungeon[i][j] == 11 && dungeon[i + 1][j] != 11) { dungeon[i][j] = 144; } - if(dungeon[i][j] == 15 && dungeon[i + 1][j] != 11) { + if (dungeon[i][j] == 15 && dungeon[i + 1][j] != 11) { dungeon[i][j] = 148; } - if(dungeon[i][j] == 10 && dungeon[i][j + 1] != 10) { + if (dungeon[i][j] == 10 && dungeon[i][j + 1] != 10) { dungeon[i][j] = 143; } - if(dungeon[i][j] == 13 && dungeon[i][j + 1] != 10) { + if (dungeon[i][j] == 13 && dungeon[i][j + 1] != 10) { dungeon[i][j] = 146; } - if(dungeon[i][j] == 14 && dungeon[i][j + 1] != 15) { + if (dungeon[i][j] == 14 && dungeon[i][j + 1] != 15) { dungeon[i][j] = 147; } } @@ -2129,21 +2103,21 @@ void DRLG_InitL2Vals() { int i, j, pc; - for(j = 0; j < 112; j++) { - for(i = 0; i < 112; i++) { - if(dPiece[i][j] == 541) { + for (j = 0; j < 112; j++) { + for (i = 0; i < 112; i++) { + if (dPiece[i][j] == 541) { pc = 5; - } else if(dPiece[i][j] == 178) { + } else if (dPiece[i][j] == 178) { pc = 5; - } else if(dPiece[i][j] == 551) { + } else if (dPiece[i][j] == 551) { pc = 5; - } else if(dPiece[i][j] == 542) { + } else if (dPiece[i][j] == 542) { pc = 6; - } else if(dPiece[i][j] == 553) { + } else if (dPiece[i][j] == 553) { pc = 6; - } else if(dPiece[i][j] == 13) { + } else if (dPiece[i][j] == 13) { pc = 5; - } else if(dPiece[i][j] == 17) { + } else if (dPiece[i][j] == 17) { pc = 6; } else { continue; @@ -2151,12 +2125,12 @@ void DRLG_InitL2Vals() dArch[i][j] = pc; } } - for(j = 0; j < 112; j++) { - for(i = 0; i < 112; i++) { - if(dPiece[i][j] == 132) { + for (j = 0; j < 112; j++) { + for (i = 0; i < 112; i++) { + if (dPiece[i][j] == 132) { dArch[i][j + 1] = 2; dArch[i][j + 2] = 1; - } else if(dPiece[i][j] == 135 || dPiece[i][j] == 139) { + } else if (dPiece[i][j] == 135 || dPiece[i][j] == 139) { dArch[i + 1][j] = 3; dArch[i + 2][j] = 4; } diff --git a/Source/drlg_l2.h b/Source/drlg_l2.h index 7abcefb23e7..65730054713 100644 --- a/Source/drlg_l2.h +++ b/Source/drlg_l2.h @@ -3,11 +3,11 @@ #define __DRLG_L2_H__ extern int nSx1; -extern int nSx2; // weak +extern int nSx2; extern int nSy1; -extern int nSy2; // weak +extern int nSy2; extern int nRoomCnt; -extern unsigned char predungeon[DMAXX][DMAXX]; +extern BYTE predungeon[DMAXX][DMAXY]; extern ROOMNODE RoomList[81]; extern HALLNODE *pHallList; @@ -17,12 +17,12 @@ void L2DoorFix(); void LoadL2Dungeon(char *sFileName, int vx, int vy); void DRLG_L2Pass3(); void LoadPreL2Dungeon(char *sFileName, int vx, int vy); -void CreateL2Dungeon(unsigned int rseed, int entry); +void CreateL2Dungeon(int rseed, int entry); void DRLG_LoadL2SP(); void DRLG_FreeL2SP(); void DRLG_L2(int entry); -BOOL DRLG_L2PlaceMiniSet(unsigned char *miniset, int tmin, int tmax, int cx, int cy, BOOL setview, int ldir); -void DRLG_L2PlaceRndSet(unsigned char *miniset, int rndper); +BOOL DRLG_L2PlaceMiniSet(BYTE *miniset, int tmin, int tmax, int cx, int cy, BOOL setview, int ldir); +void DRLG_L2PlaceRndSet(BYTE *miniset, int rndper); void DRLG_L2Subs(); void DRLG_L2Shadows(); void DRLG_L2SetRoom(int rx1, int ry1); @@ -48,126 +48,126 @@ void L2DirtFix(); void DRLG_InitL2Vals(); /* rdata */ -extern int Area_Min; // weak -extern int Room_Max; // weak -extern int Room_Min; // weak +extern int Area_Min; +extern int Room_Max; +extern int Room_Min; extern int Dir_Xadd[5]; extern int Dir_Yadd[5]; extern ShadowStruct SPATSL2[2]; //short word_48489A; -extern unsigned char BTYPESL2[161]; -extern unsigned char BSTYPESL2[161]; -extern unsigned char VARCH1[]; -extern unsigned char VARCH2[]; -extern unsigned char VARCH3[]; -extern unsigned char VARCH4[]; -extern unsigned char VARCH5[]; -extern unsigned char VARCH6[]; -extern unsigned char VARCH7[]; -extern unsigned char VARCH8[]; -extern unsigned char VARCH9[]; -extern unsigned char VARCH10[]; -extern unsigned char VARCH11[]; -extern unsigned char VARCH12[]; -extern unsigned char VARCH13[]; -extern unsigned char VARCH14[]; -extern unsigned char VARCH15[]; -extern unsigned char VARCH16[]; -extern unsigned char VARCH17[]; -extern unsigned char VARCH18[]; -extern unsigned char VARCH19[]; -extern unsigned char VARCH20[]; -extern unsigned char VARCH21[]; -extern unsigned char VARCH22[]; -extern unsigned char VARCH23[]; -extern unsigned char VARCH24[]; -extern unsigned char VARCH25[]; -extern unsigned char VARCH26[]; -extern unsigned char VARCH27[]; -extern unsigned char VARCH28[]; -extern unsigned char VARCH29[]; -extern unsigned char VARCH30[]; -extern unsigned char VARCH31[]; -extern unsigned char VARCH32[]; -extern unsigned char VARCH33[]; -extern unsigned char VARCH34[]; -extern unsigned char VARCH35[]; -extern unsigned char VARCH36[]; -extern unsigned char VARCH37[]; -extern unsigned char VARCH38[]; -extern unsigned char VARCH39[]; -extern unsigned char VARCH40[]; -extern unsigned char HARCH1[]; -extern unsigned char HARCH2[]; -extern unsigned char HARCH3[]; -extern unsigned char HARCH4[]; -extern unsigned char HARCH5[]; -extern unsigned char HARCH6[]; -extern unsigned char HARCH7[]; -extern unsigned char HARCH8[]; -extern unsigned char HARCH9[]; -extern unsigned char HARCH10[]; -extern unsigned char HARCH11[]; -extern unsigned char HARCH12[]; -extern unsigned char HARCH13[]; -extern unsigned char HARCH14[]; -extern unsigned char HARCH15[]; -extern unsigned char HARCH16[]; -extern unsigned char HARCH17[]; -extern unsigned char HARCH18[]; -extern unsigned char HARCH19[]; -extern unsigned char HARCH20[]; -extern unsigned char HARCH21[]; -extern unsigned char HARCH22[]; -extern unsigned char HARCH23[]; -extern unsigned char HARCH24[]; -extern unsigned char HARCH25[]; -extern unsigned char HARCH26[]; -extern unsigned char HARCH27[]; -extern unsigned char HARCH28[]; -extern unsigned char HARCH29[]; -extern unsigned char HARCH30[]; -extern unsigned char HARCH31[]; -extern unsigned char HARCH32[]; -extern unsigned char HARCH33[]; -extern unsigned char HARCH34[]; -extern unsigned char HARCH35[]; -extern unsigned char HARCH36[]; -extern unsigned char HARCH37[]; -extern unsigned char HARCH38[]; -extern unsigned char HARCH39[]; -extern unsigned char HARCH40[]; -extern unsigned char USTAIRS[]; -extern unsigned char DSTAIRS[]; -extern unsigned char WARPSTAIRS[]; -extern unsigned char CRUSHCOL[]; -extern unsigned char BIG1[]; -extern unsigned char BIG2[]; -extern unsigned char BIG3[]; -extern unsigned char BIG4[]; -extern unsigned char BIG5[]; -extern unsigned char BIG6[]; -extern unsigned char BIG7[]; -extern unsigned char BIG8[]; -extern unsigned char BIG9[]; -extern unsigned char BIG10[]; -extern unsigned char RUINS1[]; -extern unsigned char RUINS2[]; -extern unsigned char RUINS3[]; -extern unsigned char RUINS4[]; -extern unsigned char RUINS5[]; -extern unsigned char RUINS6[]; -extern unsigned char RUINS7[]; -extern unsigned char PANCREAS1[]; -extern unsigned char PANCREAS2[]; -extern unsigned char CTRDOOR1[]; -extern unsigned char CTRDOOR2[]; -extern unsigned char CTRDOOR3[]; -extern unsigned char CTRDOOR4[]; -extern unsigned char CTRDOOR5[]; -extern unsigned char CTRDOOR6[]; -extern unsigned char CTRDOOR7[]; -extern unsigned char CTRDOOR8[]; +extern BYTE BTYPESL2[161]; +extern BYTE BSTYPESL2[161]; +extern BYTE VARCH1[]; +extern BYTE VARCH2[]; +extern BYTE VARCH3[]; +extern BYTE VARCH4[]; +extern BYTE VARCH5[]; +extern BYTE VARCH6[]; +extern BYTE VARCH7[]; +extern BYTE VARCH8[]; +extern BYTE VARCH9[]; +extern BYTE VARCH10[]; +extern BYTE VARCH11[]; +extern BYTE VARCH12[]; +extern BYTE VARCH13[]; +extern BYTE VARCH14[]; +extern BYTE VARCH15[]; +extern BYTE VARCH16[]; +extern BYTE VARCH17[]; +extern BYTE VARCH18[]; +extern BYTE VARCH19[]; +extern BYTE VARCH20[]; +extern BYTE VARCH21[]; +extern BYTE VARCH22[]; +extern BYTE VARCH23[]; +extern BYTE VARCH24[]; +extern BYTE VARCH25[]; +extern BYTE VARCH26[]; +extern BYTE VARCH27[]; +extern BYTE VARCH28[]; +extern BYTE VARCH29[]; +extern BYTE VARCH30[]; +extern BYTE VARCH31[]; +extern BYTE VARCH32[]; +extern BYTE VARCH33[]; +extern BYTE VARCH34[]; +extern BYTE VARCH35[]; +extern BYTE VARCH36[]; +extern BYTE VARCH37[]; +extern BYTE VARCH38[]; +extern BYTE VARCH39[]; +extern BYTE VARCH40[]; +extern BYTE HARCH1[]; +extern BYTE HARCH2[]; +extern BYTE HARCH3[]; +extern BYTE HARCH4[]; +extern BYTE HARCH5[]; +extern BYTE HARCH6[]; +extern BYTE HARCH7[]; +extern BYTE HARCH8[]; +extern BYTE HARCH9[]; +extern BYTE HARCH10[]; +extern BYTE HARCH11[]; +extern BYTE HARCH12[]; +extern BYTE HARCH13[]; +extern BYTE HARCH14[]; +extern BYTE HARCH15[]; +extern BYTE HARCH16[]; +extern BYTE HARCH17[]; +extern BYTE HARCH18[]; +extern BYTE HARCH19[]; +extern BYTE HARCH20[]; +extern BYTE HARCH21[]; +extern BYTE HARCH22[]; +extern BYTE HARCH23[]; +extern BYTE HARCH24[]; +extern BYTE HARCH25[]; +extern BYTE HARCH26[]; +extern BYTE HARCH27[]; +extern BYTE HARCH28[]; +extern BYTE HARCH29[]; +extern BYTE HARCH30[]; +extern BYTE HARCH31[]; +extern BYTE HARCH32[]; +extern BYTE HARCH33[]; +extern BYTE HARCH34[]; +extern BYTE HARCH35[]; +extern BYTE HARCH36[]; +extern BYTE HARCH37[]; +extern BYTE HARCH38[]; +extern BYTE HARCH39[]; +extern BYTE HARCH40[]; +extern BYTE USTAIRS[]; +extern BYTE DSTAIRS[]; +extern BYTE WARPSTAIRS[]; +extern BYTE CRUSHCOL[]; +extern BYTE BIG1[]; +extern BYTE BIG2[]; +extern BYTE BIG3[]; +extern BYTE BIG4[]; +extern BYTE BIG5[]; +extern BYTE BIG6[]; +extern BYTE BIG7[]; +extern BYTE BIG8[]; +extern BYTE BIG9[]; +extern BYTE BIG10[]; +extern BYTE RUINS1[]; +extern BYTE RUINS2[]; +extern BYTE RUINS3[]; +extern BYTE RUINS4[]; +extern BYTE RUINS5[]; +extern BYTE RUINS6[]; +extern BYTE RUINS7[]; +extern BYTE PANCREAS1[]; +extern BYTE PANCREAS2[]; +extern BYTE CTRDOOR1[]; +extern BYTE CTRDOOR2[]; +extern BYTE CTRDOOR3[]; +extern BYTE CTRDOOR4[]; +extern BYTE CTRDOOR5[]; +extern BYTE CTRDOOR6[]; +extern BYTE CTRDOOR7[]; +extern BYTE CTRDOOR8[]; extern int Patterns[100][10]; #endif /* __DRLG_L2_H__ */ diff --git a/Source/drlg_l3.h b/Source/drlg_l3.h index 5c5dedf58b1..47c2feb345c 100644 --- a/Source/drlg_l3.h +++ b/Source/drlg_l3.h @@ -14,7 +14,7 @@ void FixL3Warp(); void FixL3HallofHeroes(); void DRLG_L3LockRec(int x, int y); BOOL DRLG_L3Lockout(); -void CreateL3Dungeon( int rseed, int entry); +void CreateL3Dungeon(int rseed, int entry); void DRLG_L3(int entry); void InitL3Dungeon(); BOOL DRLG_L3FillRoom(int x1, int y1, int x2, int y2); diff --git a/Source/drlg_l4.cpp b/Source/drlg_l4.cpp index 0c70aa7a678..a9525e3b8a5 100644 --- a/Source/drlg_l4.cpp +++ b/Source/drlg_l4.cpp @@ -1,26 +1,26 @@ #include "diablo.h" -int diabquad1x; // weak -int diabquad1y; // weak -int diabquad3x; // idb -int diabquad3y; // idb -int diabquad2x; // idb -int diabquad2y; // idb -int diabquad4x; // idb -int diabquad4y; // idb +int diabquad1x; +int diabquad1y; +int diabquad3x; +int diabquad3y; +int diabquad2x; +int diabquad2y; +int diabquad4x; +int diabquad4y; BOOL hallok[20]; -int l4holdx; // weak -int l4holdy; // weak -int SP4x1; // idb -int SP4x2; // weak -int SP4y1; // idb -int SP4y2; // weak -unsigned char L4dungeon[80][80]; -unsigned char dung[20][20]; +int l4holdx; +int l4holdy; +int SP4x1; +int SP4x2; +int SP4y1; +int SP4y2; +BYTE L4dungeon[80][80]; +BYTE dung[20][20]; //int dword_52A4DC; // weak -const unsigned char L4ConvTbl[16] = { 30u, 6u, 1u, 6u, 2u, 6u, 6u, 6u, 9u, 6u, 1u, 6u, 2u, 6u, 3u, 6u }; -const unsigned char L4USTAIRS[42] = { +const BYTE L4ConvTbl[16] = { 30u, 6u, 1u, 6u, 2u, 6u, 6u, 6u, 9u, 6u, 1u, 6u, 2u, 6u, 3u, 6u }; +const BYTE L4USTAIRS[42] = { 4u, 5u, 6u, @@ -64,7 +64,7 @@ const unsigned char L4USTAIRS[42] = { 0u, 0u }; -const unsigned char L4TWARP[42] = { +const BYTE L4TWARP[42] = { 4u, 5u, 6u, @@ -108,7 +108,7 @@ const unsigned char L4TWARP[42] = { 0u, 0u }; -const unsigned char L4DSTAIRS[52] = { +const BYTE L4DSTAIRS[52] = { 5u, 5u, 6u, @@ -162,7 +162,7 @@ const unsigned char L4DSTAIRS[52] = { 0u, 0u }; -const unsigned char L4PENTA[52] = { +const BYTE L4PENTA[52] = { 5u, 5u, 6u, @@ -216,7 +216,7 @@ const unsigned char L4PENTA[52] = { 0u, 0u }; -const unsigned char L4PENTA2[52] = { +const BYTE L4PENTA2[52] = { 5u, 5u, 6u, @@ -270,7 +270,7 @@ const unsigned char L4PENTA2[52] = { 0u, 0u }; -const unsigned char L4BTYPES[140] = { +const BYTE L4BTYPES[140] = { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, @@ -299,8 +299,6 @@ void DRLG_LoadL4SP() setloadflag_2 = 1; } } -// 5B50D8: using guessed type int setloadflag_2; -// 679660: using guessed type char gbMaxPlayers; void DRLG_FreeL4SP() { @@ -310,17 +308,17 @@ void DRLG_FreeL4SP() void DRLG_L4SetSPRoom(int rx1, int ry1) { int rw, rh, i, j; - unsigned char *sp; + BYTE *sp; - rw = (unsigned char)pSetPiece_2[0]; - rh = (unsigned char)pSetPiece_2[2]; + rw = (BYTE)pSetPiece_2[0]; + rh = (BYTE)pSetPiece_2[2]; setpc_x = rx1; setpc_y = ry1; setpc_w = rw; setpc_h = rh; - sp = (unsigned char *)&pSetPiece_2[4]; + sp = (BYTE *)&pSetPiece_2[4]; for (j = 0; j < rh; j++) { for (i = 0; i < rw; i++) { @@ -334,8 +332,6 @@ void DRLG_L4SetSPRoom(int rx1, int ry1) } } } -// 5CF330: using guessed type int setpc_h; -// 5CF334: using guessed type int setpc_w; void L4SaveQuads() { @@ -354,8 +350,6 @@ void L4SaveQuads() y++; } } -// 528A34: using guessed type int l4holdx; -// 528A38: using guessed type int l4holdy; void DRLG_L4SetRoom(BYTE *pSetPiece, int rx1, int ry1) { @@ -475,7 +469,7 @@ void DRLG_L4GeneralFix() } } -void CreateL4Dungeon(unsigned int rseed, int entry) +void CreateL4Dungeon(int rseed, int entry) { SetRndSeed(rseed); @@ -1678,7 +1672,7 @@ BOOL L4checkRoom(int x, int y, int width, int height) return TRUE; } -BOOL DRLG_L4PlaceMiniSet(const unsigned char *miniset, int tmin, int tmax, int cx, int cy, BOOL setview, int ldir) +BOOL DRLG_L4PlaceMiniSet(const BYTE *miniset, int tmin, int tmax, int cx, int cy, BOOL setview, int ldir) { int sx, sy, sw, sh, xx, yy, i, ii, numt, bailcnt; BOOL found; diff --git a/Source/drlg_l4.h b/Source/drlg_l4.h index 76262ab0dea..3277f1f287f 100644 --- a/Source/drlg_l4.h +++ b/Source/drlg_l4.h @@ -2,21 +2,21 @@ #ifndef __DRLG_L4_H__ #define __DRLG_L4_H__ -extern int diabquad1x; // weak -extern int diabquad1y; // weak -extern int diabquad3x; // idb -extern int diabquad3y; // idb -extern int diabquad2x; // idb -extern int diabquad2y; // idb -extern int diabquad4x; // idb -extern int diabquad4y; // idb +extern int diabquad1x; +extern int diabquad1y; +extern int diabquad3x; +extern int diabquad3y; +extern int diabquad2x; +extern int diabquad2y; +extern int diabquad4x; +extern int diabquad4y; extern BOOL hallok[20]; -extern int l4holdx; // weak -extern int l4holdy; // weak -extern int SP4x1; // idb -extern int SP4x2; // weak -extern int SP4y1; // idb -extern int SP4y2; // weak +extern int l4holdx; +extern int l4holdy; +extern int SP4x1; +extern int SP4x2; +extern int SP4y1; +extern int SP4y2; extern unsigned char L4dungeon[80][80]; extern unsigned char dung[20][20]; //int dword_52A4DC; // weak @@ -25,13 +25,13 @@ void DRLG_LoadL4SP(); void DRLG_FreeL4SP(); void DRLG_L4SetSPRoom(int rx1, int ry1); void L4SaveQuads(); -void DRLG_L4SetRoom(unsigned char *pSetPiece, int rx1, int ry1); +void DRLG_L4SetRoom(BYTE *pSetPiece, int rx1, int ry1); void DRLG_LoadDiabQuads(BOOL preflag); BOOL IsDURWall(char d); BOOL IsDLLWall(char dd); void L4FixRim(); void DRLG_L4GeneralFix(); -void CreateL4Dungeon(unsigned int rseed, int entry); +void CreateL4Dungeon(int rseed, int entry); void DRLG_L4(int entry); void DRLG_L4Shadows(); void InitL4Dungeon(); diff --git a/Source/dx.cpp b/Source/dx.cpp index 471a69a72ee..75c6220edf7 100644 --- a/Source/dx.cpp +++ b/Source/dx.cpp @@ -3,7 +3,7 @@ BYTE *sgpBackBuf; LPDIRECTDRAW lpDDInterface; -IDirectDrawPalette *lpDDPalette; // idb +IDirectDrawPalette *lpDDPalette; int sgdwLockCount; BYTE *gpBuffer; IDirectDrawSurface *lpDDSBackBuf; @@ -14,9 +14,9 @@ int locktbl[256]; #ifdef __cplusplus static CCritSect sgMemCrit; #endif -char gbBackBuf; // weak -char gbEmulate; // weak -HMODULE ghDiabMod; // idb +char gbBackBuf; +char gbEmulate; +HMODULE ghDiabMod; void dx_init(HWND hWnd) { @@ -33,11 +33,11 @@ void dx_init(HWND hWnd) ShowWindow(hWnd, SW_SHOWNORMAL); lpGUID = NULL; - if(gbEmulate) { + if (gbEmulate) { lpGUID = (GUID *)DDCREATE_EMULATIONONLY; } hDDVal = dx_DirectDrawCreate(lpGUID, &lpDDInterface, NULL); - if(hDDVal != DD_OK) { + if (hDDVal != DD_OK) { ErrDlg(IDD_DIALOG1, hDDVal, "C:\\Src\\Diablo\\Source\\dx.cpp", 149); } @@ -52,15 +52,15 @@ void dx_init(HWND hWnd) #ifndef _DEBUG fullscreen = TRUE; #endif - if(!fullscreen) { + 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) { + if (hDDVal == DDERR_EXCLUSIVEMODEALREADYSET) { TriggerBreak(); - } else if(hDDVal != DD_OK) { + } else if (hDDVal != DD_OK) { ErrDlg(IDD_DIALOG1, hDDVal, "C:\\Diablo\\Direct\\dx.cpp", 155); } SetWindowPos(hWnd, HWND_NOTOPMOST, 0, 0, 0, 0, SWP_NOACTIVATE | SWP_NOMOVE | SWP_NOSIZE); @@ -70,9 +70,9 @@ void dx_init(HWND hWnd) #else hDDVal = lpDDInterface->lpVtbl->SetCooperativeLevel(lpDDInterface, hWnd, DDSCL_EXCLUSIVE | DDSCL_ALLOWREBOOT | DDSCL_FULLSCREEN); #endif - if(hDDVal == DDERR_EXCLUSIVEMODEALREADYSET) { + if (hDDVal == DDERR_EXCLUSIVEMODEALREADYSET) { TriggerBreak(); - } else if(hDDVal != DD_OK) { + } else if (hDDVal != DD_OK) { ErrDlg(IDD_DIALOG1, hDDVal, "C:\\Src\\Diablo\\Source\\dx.cpp", 170); } #ifdef __cplusplus @@ -80,7 +80,7 @@ void dx_init(HWND hWnd) #else hDDVal = lpDDInterface->lpVtbl->SetDisplayMode(lpDDInterface, SCREEN_WIDTH, SCREEN_HEIGHT, SCREEN_BPP); #endif - if(hDDVal != DD_OK) { + if (hDDVal != DD_OK) { winw = GetSystemMetrics(SM_CXSCREEN); winh = GetSystemMetrics(SM_CYSCREEN); #ifdef __cplusplus @@ -89,7 +89,7 @@ void dx_init(HWND hWnd) hDDVal = lpDDInterface->lpVtbl->SetDisplayMode(lpDDInterface, winw, winh, SCREEN_BPP); #endif } - if(hDDVal != DD_OK) { + if (hDDVal != DD_OK) { ErrDlg(IDD_DIALOG1, hDDVal, "C:\\Src\\Diablo\\Source\\dx.cpp", 183); } } @@ -101,7 +101,6 @@ void dx_init(HWND hWnd) bSuccess = SDrawManualInitialize(hWnd, lpDDInterface, lpDDSPrimary, NULL, NULL, lpDDSBackBuf, lpDDPalette, NULL); /// ASSERT: assert(bSuccess); } -// 52A549: using guessed type char gbEmulate; void dx_create_back_buffer() { @@ -160,7 +159,6 @@ void dx_create_back_buffer() if (error_code != DD_OK) ErrDlg(IDD_DIALOG1, error_code, "C:\\Src\\Diablo\\Source\\dx.cpp", 96); } -// 52A548: using guessed type char gbBackBuf; void dx_create_primary_surface() { diff --git a/Source/dx.h b/Source/dx.h index bdf3dede147..6ba83e4ddd0 100644 --- a/Source/dx.h +++ b/Source/dx.h @@ -3,13 +3,13 @@ #define __DX_H__ extern IDirectDraw *lpDDInterface; -extern IDirectDrawPalette *lpDDPalette; // idb +extern IDirectDrawPalette *lpDDPalette; extern BYTE *gpBuffer; extern IDirectDrawSurface *lpDDSBackBuf; extern IDirectDrawSurface *lpDDSPrimary; -extern char gbBackBuf; // weak -extern char gbEmulate; // weak -extern HMODULE ghDiabMod; // idb +extern char gbBackBuf; +extern char gbEmulate; +extern HMODULE ghDiabMod; void dx_init(HWND hWnd); void dx_create_back_buffer(); @@ -25,6 +25,6 @@ void j_dx_reinit(); /* data */ -extern int dx_inf; // weak +extern int dx_inf; #endif /* __DX_H__ */ diff --git a/Source/gendung.cpp b/Source/gendung.cpp index f105ca11d49..92ec9715605 100644 --- a/Source/gendung.cpp +++ b/Source/gendung.cpp @@ -8,7 +8,7 @@ int dMonster[MAXDUNX][MAXDUNY]; BYTE dungeon[DMAXX][DMAXY]; char dObject[MAXDUNX][MAXDUNY]; BYTE *pSpeedCels; -int nlevel_frames; // weak +int nlevel_frames; char pdungeon[DMAXX][DMAXY]; char dDead[MAXDUNX][MAXDUNY]; MICROS dpiece_defs_map_1[MAXDUNX * MAXDUNY]; @@ -18,17 +18,17 @@ int MicroTileLen; char dflags[DMAXX][DMAXY]; int dPiece[MAXDUNX][MAXDUNY]; char dLight[MAXDUNX][MAXDUNY]; -int setloadflag_2; // weak +int setloadflag_2; int tile_defs[MAXTILES]; BYTE *pMegaTiles; BYTE *pLevelPieces; -int gnDifficulty; // idb +int gnDifficulty; char block_lvid[2049]; //char byte_5B78EB; char dTransVal[MAXDUNX][MAXDUNY]; BOOLEAN nTrapTable[2049]; BYTE leveltype; -unsigned char currlevel; // idb +BYTE currlevel; char TransList[256]; BOOLEAN nSolidTable[2049]; int level_frame_count[MAXTILES]; @@ -37,10 +37,10 @@ BYTE *pDungeonCels; int SpeedFrameTbl[128][16]; THEME_LOC themeLoc[MAXTHEMES]; char dPlayer[MAXDUNX][MAXDUNY]; -int dword_5C2FF8; // weak -int dword_5C2FFC; // weak -int scr_pix_width; // weak -int scr_pix_height; // weak +int dword_5C2FF8; +int dword_5C2FFC; +int scr_pix_width; +int scr_pix_height; char dArch[MAXDUNX][MAXDUNY]; char nBlockTable[2049]; BYTE *pSpecialCels; @@ -50,28 +50,28 @@ BYTE setlvlnum; int level_frame_sizes[MAXTILES]; char nMissileTable[2049]; char *pSetPiece_2; -char setlvltype; // weak +char setlvltype; BOOLEAN setlevel; -int LvlViewY; // weak -int LvlViewX; // weak -int dmaxx; // weak -int dmaxy; // weak -int setpc_h; // weak -int setpc_w; // weak -int setpc_x; // idb -int ViewX; // idb -int ViewY; // idb -int setpc_y; // idb +int LvlViewY; +int LvlViewX; +int dmaxx; +int dmaxy; +int setpc_h; +int setpc_w; +int setpc_x; +int ViewX; +int ViewY; +int setpc_y; char dMissile[MAXDUNX][MAXDUNY]; -int dminx; // weak -int dminy; // weak +int dminx; +int dminy; MICROS dpiece_defs_map_2[MAXDUNX][MAXDUNY]; void FillSolidBlockTbls() { - unsigned char bv; - unsigned int dwTiles; - unsigned char *pSBFile, *pTmp; + BYTE bv; + DWORD dwTiles; + BYTE *pSBFile, *pTmp; int i; memset(nBlockTable, 0, sizeof(nBlockTable)); @@ -445,8 +445,6 @@ void MakeSpeedCels() } } } -// 525728: using guessed type int light4flag; -// 53CD4C: using guessed type int nlevel_frames; void SortTiles(int frames) { @@ -553,11 +551,6 @@ void SetDungeonMicros() dword_5C2FFC = 7; } } -// 52569C: using guessed type int zoomflag; -// 5C2FF8: using guessed type int dword_5C2FF8; -// 5C2FFC: using guessed type int dword_5C2FFC; -// 5C3000: using guessed type int scr_pix_width; -// 5C3004: using guessed type int scr_pix_height; void DRLG_InitTrans() { @@ -565,7 +558,6 @@ void DRLG_InitTrans() memset(TransList, 0, sizeof(TransList)); TransVal = 1; } -// 5A5590: using guessed type char TransVal; void DRLG_MRectTrans(int x1, int y1, int x2, int y2) { @@ -584,7 +576,6 @@ void DRLG_MRectTrans(int x1, int y1, int x2, int y2) TransVal++; } -// 5A5590: using guessed type char TransVal; void DRLG_RectTrans(int x1, int y1, int x2, int y2) { @@ -597,17 +588,16 @@ void DRLG_RectTrans(int x1, int y1, int x2, int y2) } TransVal++; } -// 5A5590: using guessed type char TransVal; void DRLG_CopyTrans(int sx, int sy, int dx, int dy) { dTransVal[dx][dy] = dTransVal[sx][sy]; } -void DRLG_ListTrans(int num, unsigned char *List) +void DRLG_ListTrans(int num, BYTE *List) { int i; - unsigned char x1, x2, y1, y2; + BYTE x1, x2, y1, y2; for (i = 0; i < num; i++) { x1 = *List++; @@ -618,10 +608,10 @@ void DRLG_ListTrans(int num, unsigned char *List) } } -void DRLG_AreaTrans(int num, unsigned char *List) +void DRLG_AreaTrans(int num, BYTE *List) { int i; - unsigned char x1, x2, y1, y2; + BYTE x1, x2, y1, y2; for (i = 0; i < num; i++) { x1 = *List++; @@ -633,7 +623,6 @@ void DRLG_AreaTrans(int num, unsigned char *List) } ++TransVal; } -// 5A5590: using guessed type char TransVal; void DRLG_InitSetPC() { @@ -642,8 +631,6 @@ void DRLG_InitSetPC() setpc_w = 0; setpc_h = 0; } -// 5CF330: using guessed type int setpc_h; -// 5CF334: using guessed type int setpc_w; void DRLG_SetPC() { @@ -660,8 +647,6 @@ void DRLG_SetPC() } } } -// 5CF330: using guessed type int setpc_h; -// 5CF334: using guessed type int setpc_w; void Make_SetPC(int x, int y, int w, int h) { @@ -762,8 +747,6 @@ BOOL DRLG_WillThemeRoomFit(int floor, int x, int y, int minSize, int maxSize, in *height = ySmallest - 2; return TRUE; } -// 41965B: using guessed type int var_6C[20]; -// 41965B: using guessed type int var_BC[20]; void DRLG_CreateThemeRoom(int themeIndex) { @@ -969,5 +952,3 @@ void InitLevels() setlevel = 0; } } -// 52572C: using guessed type int leveldebug; -// 5CF31D: using guessed type char setlevel; diff --git a/Source/gendung.h b/Source/gendung.h index e2c4afe9f53..ff7d8948fd4 100644 --- a/Source/gendung.h +++ b/Source/gendung.h @@ -10,27 +10,27 @@ extern int dMonster[MAXDUNX][MAXDUNY]; extern BYTE dungeon[DMAXX][DMAXY]; extern char dObject[MAXDUNX][MAXDUNY]; extern BYTE *pSpeedCels; -extern int nlevel_frames; // weak +extern int nlevel_frames; extern char pdungeon[DMAXX][DMAXY]; extern char dDead[MAXDUNX][MAXDUNY]; extern MICROS dpiece_defs_map_1[MAXDUNX * MAXDUNY]; extern char dPreLight[MAXDUNX][MAXDUNY]; -extern char TransVal; // weak +extern char TransVal; extern int MicroTileLen; extern char dflags[DMAXX][DMAXY]; extern int dPiece[MAXDUNX][MAXDUNY]; extern char dLight[MAXDUNX][MAXDUNY]; -extern int setloadflag_2; // weak +extern int setloadflag_2; extern int tile_defs[MAXTILES]; extern BYTE *pMegaTiles; extern BYTE *pLevelPieces; -extern int gnDifficulty; // idb +extern int gnDifficulty; extern char block_lvid[2049]; //char byte_5B78EB; extern char dTransVal[MAXDUNX][MAXDUNY]; extern BOOLEAN nTrapTable[2049]; extern BYTE leveltype; -extern unsigned char currlevel; // idb +extern unsigned char currlevel; extern char TransList[256]; extern BOOLEAN nSolidTable[2049]; extern int level_frame_count[MAXTILES]; @@ -39,10 +39,10 @@ extern BYTE *pDungeonCels; extern int SpeedFrameTbl[128][16]; extern THEME_LOC themeLoc[MAXTHEMES]; extern char dPlayer[MAXDUNX][MAXDUNY]; -extern int dword_5C2FF8; // weak -extern int dword_5C2FFC; // weak -extern int scr_pix_width; // weak -extern int scr_pix_height; // weak +extern int dword_5C2FF8; +extern int dword_5C2FFC; +extern int scr_pix_width; +extern int scr_pix_height; extern char dArch[MAXDUNX][MAXDUNY]; extern char nBlockTable[2049]; extern BYTE *pSpecialCels; @@ -52,21 +52,21 @@ extern BYTE setlvlnum; extern int level_frame_sizes[MAXTILES]; extern char nMissileTable[2049]; extern char *pSetPiece_2; -extern char setlvltype; // weak +extern char setlvltype; extern BOOLEAN setlevel; -extern int LvlViewY; // weak -extern int LvlViewX; // weak -extern int dmaxx; // weak -extern int dmaxy; // weak -extern int setpc_h; // weak -extern int setpc_w; // weak -extern int setpc_x; // idb -extern int ViewX; // idb -extern int ViewY; // idb -extern int setpc_y; // idb +extern int LvlViewY; +extern int LvlViewX; +extern int dmaxx; +extern int dmaxy; +extern int setpc_h; +extern int setpc_w; +extern int setpc_x; +extern int ViewX; +extern int ViewY; +extern int setpc_y; extern char dMissile[MAXDUNX][MAXDUNY]; -extern int dminx; // weak -extern int dminy; // weak +extern int dminx; +extern int dminy; extern MICROS dpiece_defs_map_2[MAXDUNX][MAXDUNY]; void FillSolidBlockTbls(); diff --git a/Source/gmenu.cpp b/Source/gmenu.cpp index 1c1f6c26e1c..7bde72a7be4 100644 --- a/Source/gmenu.cpp +++ b/Source/gmenu.cpp @@ -13,7 +13,7 @@ BYTE *option_cel; BYTE *sgpLogo; int sgCurrentMenuIdx; -const unsigned char lfontframe[127] = { +const BYTE lfontframe[127] = { 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, @@ -28,7 +28,7 @@ const unsigned char lfontframe[127] = { 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 20, 0, 21, 0 }; -const unsigned char lfontkern[56] = { +const BYTE lfontkern[56] = { 18, 33, 21, 26, 28, 19, 19, 26, 25, 11, 12, 25, 19, 34, 28, 32, 20, 32, 28, 20, 28, 36, 35, 46, 33, 33, 24, 11, 23, 22, diff --git a/Source/gmenu.h b/Source/gmenu.h index 4a0c2ca44a9..c4ac6da3f86 100644 --- a/Source/gmenu.h +++ b/Source/gmenu.h @@ -3,22 +3,22 @@ #define __GMENU_H__ extern BYTE *optbar_cel; -extern BOOLEAN mouseNavigation; // weak +extern BOOLEAN mouseNavigation; extern BYTE *PentSpin_cel; extern BYTE *BigTGold_cel; -extern int dword_634474; // weak -extern char byte_634478; // weak -extern void(*dword_63447C)(TMenuItem *); -extern TMenuItem *sgpCurrentMenu; // idb +extern int dword_634474; +extern char byte_634478; +extern void (*dword_63447C)(TMenuItem *); +extern TMenuItem *sgpCurrentMenu; extern BYTE *option_cel; -extern int sgCurrentMenuIdx; // weak +extern int sgCurrentMenuIdx; void gmenu_draw_pause(); void gmenu_print_text(int x, int y, char *pszStr); void FreeGMenu(); void gmenu_init_menu(); BOOL gmenu_exception(); -void gmenu_call_proc(TMenuItem *pItem, void(*gmFunc)(TMenuItem *)); +void gmenu_call_proc(TMenuItem *pItem, void (*gmFunc)(TMenuItem *)); void gmenu_up_down(BOOL isDown); void gmenu_draw(); void gmenu_draw_menu_item(TMenuItem *pItem, int a2); @@ -36,7 +36,7 @@ void gmenu_slider_steps(TMenuItem *pItem, int dwTicks); /* rdata */ -extern const unsigned char lfontframe[127]; -extern const unsigned char lfontkern[56]; +extern const BYTE lfontframe[127]; +extern const BYTE lfontkern[56]; #endif /* __GMENU_H__ */ diff --git a/Source/init.cpp b/Source/init.cpp index b1aab02b727..50e9afa022f 100644 --- a/Source/init.cpp +++ b/Source/init.cpp @@ -3,7 +3,7 @@ #include "../DiabloUI/diabloui.h" _SNETVERSIONDATA fileinfo; -int gbActive; // weak +int gbActive; char diablo_exe_path[MAX_PATH]; HANDLE unused_mpq; char patch_rt_mpq_path[MAX_PATH]; @@ -11,7 +11,7 @@ WNDPROC CurrentProc; HANDLE diabdat_mpq; char diabdat_mpq_path[MAX_PATH]; HANDLE patch_rt_mpq; -BOOL killed_mom_parent; // weak +BOOL killed_mom_parent; BOOLEAN screensaver_enabled_prev; /* data */ @@ -67,7 +67,6 @@ void init_run_office_from_start_menu() init_run_office(szPath); } } -// 634CA0: using guessed type int killed_mom_parent; void init_run_office(char *dir) { @@ -189,7 +188,6 @@ void init_kill_mom_parent() killed_mom_parent = TRUE; } } -// 634CA0: using guessed type int killed_mom_parent; HWND init_find_mom_parent() { @@ -415,7 +413,6 @@ LRESULT __stdcall MainWndProc(HWND hWnd, UINT Msg, WPARAM wParam, LPARAM lParam) return DefWindowProc(hWnd, Msg, wParam, lParam); } -// 52571C: using guessed type int drawpanflag; void init_activate_window(HWND hWnd, BOOL bActive) { @@ -437,8 +434,6 @@ void init_activate_window(HWND hWnd, BOOL bActive) ResetPal(); } } -// 52571C: using guessed type int drawpanflag; -// 634980: using guessed type int gbActive; LRESULT __stdcall WindowProc(HWND hWnd, UINT Msg, WPARAM wParam, LPARAM lParam) { diff --git a/Source/inv.cpp b/Source/inv.cpp index 8cd52e66ff9..b089a734649 100644 --- a/Source/inv.cpp +++ b/Source/inv.cpp @@ -86,7 +86,7 @@ const InvXY InvRect[73] = { /* data */ -int AP2x2Tbl[10] = { 8, 28, 6, 26, 4, 24, 2, 22, 0, 20 }; // weak +int AP2x2Tbl[10] = { 8, 28, 6, 26, 4, 24, 2, 22, 0, 20 }; void FreeInvGFX() { @@ -407,10 +407,6 @@ void DrawInv() } } } -// 4B8CB8: using guessed type char pcursinvitem; -// 69BEF8: using guessed type int light_table_index; -// 69CF94: using guessed type int cel_transparency_active; -// 41B8C4: using guessed type int var_A0[40]; void DrawInvBelt() { @@ -455,8 +451,6 @@ void DrawInvBelt() } } } -// 4B8960: using guessed type int talkflag; -// 4B8CB8: using guessed type char pcursinvitem; BOOL AutoPlace(int pnum, int ii, int sx, int sy, BOOL saveflag) { @@ -1464,7 +1458,6 @@ void CheckQuestItem(int pnum) } } } -// 52A554: using guessed type int sfxdelay; void InvGetItem(int pnum, int ii) { @@ -1497,7 +1490,6 @@ void InvGetItem(int pnum, int ii) SetCursor_(plr[pnum].HoldItem._iCurs + CURSOR_FIRSTITEM); } } -// 4B8CC0: using guessed type char pcursitem; void AutoGetItem(int pnum, int ii) { @@ -1628,7 +1620,6 @@ void AutoGetItem(int pnum, int ii) plr[pnum].HoldItem._itype = ITYPE_NONE; } } -// 48E9A8: using guessed type int AP2x2Tbl[10]; int FindGetItem(int indx, WORD ci, int iseed) { @@ -1991,7 +1982,6 @@ char CheckInvHLight() return rv; } -// 4B883C: using guessed type int infoclr; void RemoveScroll(int pnum) { @@ -2081,8 +2071,6 @@ void StartGoldDrop() if (talkflag) control_reset_talk(); } -// 4B8960: using guessed type int talkflag; -// 4B8CB8: using guessed type char pcursinvitem; BOOL UseInvItem(int pnum, int cii) { @@ -2181,9 +2169,6 @@ BOOL UseInvItem(int pnum, int cii) return TRUE; } -// 4B8960: using guessed type int talkflag; -// 52A554: using guessed type int sfxdelay; -// 6AA705: using guessed type char stextflag; void DoTelekinesis() { @@ -2195,8 +2180,6 @@ void DoTelekinesis() NetSendCmdParam1(TRUE, CMD_KNOCKBACK, pcursmonst); SetCursor_(CURSOR_HAND); } -// 4B8CC0: using guessed type char pcursitem; -// 4B8CC1: using guessed type char pcursobj; int CalculateGold(int pnum) { @@ -2216,7 +2199,6 @@ int CalculateGold(int pnum) return gold; } -// 52571C: using guessed type int drawpanflag; BOOL DropItemBeforeTrig() { diff --git a/Source/inv.h b/Source/inv.h index 1c79e9b1278..e6cb91851ae 100644 --- a/Source/inv.h +++ b/Source/inv.h @@ -48,6 +48,6 @@ BOOL DropItemBeforeTrig(); /* data */ -extern int AP2x2Tbl[10]; // weak +extern int AP2x2Tbl[10]; #endif /* __INV_H__ */ diff --git a/Source/items.cpp b/Source/items.cpp index b2e82f42c70..daf14d38249 100644 --- a/Source/items.cpp +++ b/Source/items.cpp @@ -7,14 +7,14 @@ ItemStruct curruitem; ItemGetRecordStruct itemrecord[MAXITEMS]; ItemStruct item[MAXITEMS + 1]; BOOL itemhold[3][3]; -unsigned char *itemanims[35]; +BYTE *itemanims[35]; BOOL UniqueItemFlag[128]; int numitems; int gnNumGetRecords; /* data */ -unsigned char ItemCAnimTbl[169] = { +BYTE ItemCAnimTbl[169] = { 20, 16, 16, 16, 4, 4, 4, 12, 12, 12, 12, 12, 12, 12, 12, 21, 21, 25, 12, 28, 28, 28, 0, 0, 0, 32, 0, 0, 0, 24, @@ -70,7 +70,7 @@ char *ItemDropStrs[35] = { "Fanvil", "FLazStaf" }; -unsigned char ItemAnimLs[35] = { +BYTE ItemAnimLs[35] = { 15u, 13u, 16u, @@ -181,7 +181,7 @@ int ItemInvSnds[35] = { IS_IANVL, IS_ISTAF }; -int idoppely = 16; // weak +int idoppely = 16; int premiumlvladd[6] = { -1, -1, 0, 0, 1, 2 }; void InitItemGFX() @@ -1733,7 +1733,6 @@ void GetItemPower(int i, int minlvl, int maxlvl, int flgs, BOOL onlygood) if (preidx != -1 || sufidx != -1) CalcItemValue(i); } -// 4215EF: using guessed type int var_494[256]; void GetItemBonus(int i, int idata, int minlvl, int maxlvl, int onlygood) { @@ -2218,7 +2217,7 @@ void CreateTypeItem(int x, int y, BOOL onlygood, int itype, int imisc, BOOL send } } -void RecreateItem(int ii, int idx, unsigned short ic, int iseed, int ivalue) +void RecreateItem(int ii, int idx, WORD ic, int iseed, int ivalue) { int uper, onlygood, recreate, pregen; @@ -2263,7 +2262,7 @@ void RecreateItem(int ii, int idx, unsigned short ic, int iseed, int ivalue) } } -void RecreateEar(int ii, unsigned short ic, int iseed, int Id, int dur, int mdur, int ch, int mch, int ivalue, int ibuff) +void RecreateEar(int ii, WORD ic, int iseed, int Id, int dur, int mdur, int ch, int mch, int ivalue, int ibuff) { SetPlrHandItem(&item[ii], IDI_EAR); tempstr[0] = (ic >> 8) & 0x7F; @@ -3863,7 +3862,7 @@ void RecreateHealerItem(int ii, int idx, int lvl, int iseed) item[ii]._iIdentified = TRUE; } -void RecreateTownItem(int ii, int idx, unsigned short icreateinfo, int iseed, int ivalue) +void RecreateTownItem(int ii, int idx, WORD icreateinfo, int iseed, int ivalue) { if (icreateinfo & 0x400) RecreateSmithItem(ii, idx, icreateinfo & 0x3F, iseed); diff --git a/Source/items.h b/Source/items.h index 5010cd9a8ed..0822c8ff09b 100644 --- a/Source/items.h +++ b/Source/items.h @@ -9,7 +9,7 @@ extern ItemStruct curruitem; extern ItemGetRecordStruct itemrecord[MAXITEMS]; extern ItemStruct item[MAXITEMS + 1]; extern BOOL itemhold[3][3]; -extern unsigned char *itemanims[35]; +extern BYTE *itemanims[35]; extern BOOL UniqueItemFlag[128]; extern int numitems; extern int gnNumGetRecords; @@ -62,8 +62,8 @@ void CreateRndItem(int x, int y, BOOL onlygood, BOOL sendmsg, int delta); void SetupAllUseful(int ii, int iseed, int lvl); void CreateRndUseful(int pnum, int x, int y, BOOL sendmsg); void CreateTypeItem(int x, int y, BOOL onlygood, int itype, int imisc, BOOL sendmsg, int delta); -void RecreateItem(int ii, int idx, unsigned short ic, int iseed, int ivalue); -void RecreateEar(int ii, unsigned short ic, int iseed, int Id, int dur, int mdur, int ch, int mch, int ivalue, int ibuff); +void RecreateItem(int ii, int idx, WORD ic, int iseed, int ivalue); +void RecreateEar(int ii, WORD ic, int iseed, int Id, int dur, int mdur, int ch, int mch, int ivalue, int ibuff); void SpawnQuestItem(int itemid, int x, int y, int randarea, int selflag); void SpawnRock(); void RespawnItem(int i, BOOL FlipFlag); @@ -115,7 +115,7 @@ void RecreatePremiumItem(int ii, int idx, int lvl, int iseed); void RecreateBoyItem(int ii, int idx, int lvl, int iseed); void RecreateWitchItem(int ii, int idx, int lvl, int iseed); void RecreateHealerItem(int ii, int idx, int lvl, int iseed); -void RecreateTownItem(int ii, int idx, unsigned short icreateinfo, int iseed, int ivalue); +void RecreateTownItem(int ii, int idx, WORD icreateinfo, int iseed, int ivalue); void RecalcStoreStats(); int ItemNoFlippy(); void CreateSpellBook(int x, int y, int ispell, BOOL sendmsg, int delta); @@ -128,12 +128,12 @@ void PutItemRecord(int nSeed, WORD wCI, int nIndex); /* data */ -extern unsigned char ItemCAnimTbl[169]; +extern BYTE ItemCAnimTbl[169]; extern char *ItemDropStrs[35]; -extern unsigned char ItemAnimLs[35]; +extern BYTE ItemAnimLs[35]; extern int ItemDropSnds[35]; extern int ItemInvSnds[35]; -extern int idoppely; // weak +extern int idoppely; extern int premiumlvladd[6]; #endif /* __ITEMS_H__ */ diff --git a/Source/logging.cpp b/Source/logging.cpp index 335d095de87..1cbb94abb2f 100644 --- a/Source/logging.cpp +++ b/Source/logging.cpp @@ -4,10 +4,10 @@ #ifdef __cplusplus static CCritSect sgMemCrit; #endif -CHAR FileName[MAX_PATH]; // idb +CHAR FileName[MAX_PATH]; char log_buffer[388]; -LPCVOID lpAddress; // idb -DWORD nNumberOfBytesToWrite; // idb +LPCVOID lpAddress; +DWORD nNumberOfBytesToWrite; /* data */ @@ -93,7 +93,6 @@ HANDLE log_create() log_not_created = FALSE; return fh; } -// 4947D4: using guessed type int log_not_created; void log_get_version(VS_FIXEDFILEINFO *file_info) { @@ -155,10 +154,10 @@ void __cdecl log_printf(const char *pszFmt, ...) void log_dump_computer_info() { - char Buffer[64]; // [esp+0h] [ebp-88h] - VS_FIXEDFILEINFO file_info; // [esp+40h] [ebp-48h] - SYSTEMTIME SystemTime; // [esp+74h] [ebp-14h] - DWORD pcbBuffer; // [esp+84h] [ebp-4h] + char Buffer[64]; + VS_FIXEDFILEINFO file_info; + SYSTEMTIME SystemTime; + DWORD pcbBuffer; GetLocalTime(&SystemTime); pcbBuffer = 64; diff --git a/Source/logging.h b/Source/logging.h index de6289aea74..e562eb84f9f 100644 --- a/Source/logging.h +++ b/Source/logging.h @@ -2,24 +2,24 @@ #ifndef __LOGGING_H__ #define __LOGGING_H__ -extern CHAR FileName[MAX_PATH]; // idb +extern CHAR FileName[MAX_PATH]; extern char log_buffer[388]; -extern LPCVOID lpAddress; // idb -extern DWORD nNumberOfBytesToWrite; // idb +extern LPCVOID lpAddress; +extern DWORD nNumberOfBytesToWrite; void __cdecl log_flush(BOOL force_close); -HANDLE log_create(); // should be HANDLE +HANDLE log_create(); void log_get_version(VS_FIXEDFILEINFO *file_info); void __cdecl log_printf(const char *pszFmt, ...); // LogMessage void log_dump_computer_info(); /* rdata */ -extern const int log_inf; // weak +extern const int log_inf; /* data */ -extern int log_not_created; // weak -extern HANDLE log_file; // idb +extern int log_not_created; +extern HANDLE log_file; #endif /* __LOGGING_H__ */ diff --git a/Source/minitext.cpp b/Source/minitext.cpp index 23a44ee3225..e2c6db6ec8d 100644 --- a/Source/minitext.cpp +++ b/Source/minitext.cpp @@ -1,11 +1,11 @@ #include "diablo.h" -int qtexty; // weak +int qtexty; char *qtextptr; -int qtextSpd; // weak -char qtextflag; // weak -int scrolltexty; // weak -int sgLastScroll; // weak +int qtextSpd; +char qtextflag; +int scrolltexty; +int sgLastScroll; void *pMedTextCels; void *pTextBoxCels; @@ -49,7 +49,6 @@ void InitQuestText() pTextBoxCels = LoadFileInMem("Data\\TextBox.CEL", 0); qtextflag = FALSE; } -// 646D00: using guessed type char qtextflag; void InitQTextMsg(int m) { @@ -64,11 +63,6 @@ void InitQTextMsg(int m) } PlaySFX(alltext[m].sfxnr); } -// 646CF4: using guessed type int qtexty; -// 646CFC: using guessed type int qtextSpd; -// 646D00: using guessed type char qtextflag; -// 646D04: using guessed type int scrolltexty; -// 646D08: using guessed type int sgLastScroll; void DrawQTextBack() { @@ -289,9 +283,3 @@ void DrawQText() } } } -// 646CF4: using guessed type int qtexty; -// 646CFC: using guessed type int qtextSpd; -// 646D00: using guessed type char qtextflag; -// 646D04: using guessed type int scrolltexty; -// 646D08: using guessed type int sgLastScroll; -// 428202: using guessed type char qstr[128]; diff --git a/Source/minitext.h b/Source/minitext.h index 0e1499814e0..e83883d3e17 100644 --- a/Source/minitext.h +++ b/Source/minitext.h @@ -2,11 +2,11 @@ #ifndef __MINITEXT_H__ #define __MINITEXT_H__ -extern int qtexty; // weak +extern int qtexty; extern char *qtextptr; -extern int qtextSpd; // weak -extern char qtextflag; // weak -extern int scrolltexty; // weak +extern int qtextSpd; +extern char qtextflag; +extern int scrolltexty; extern void *pMedTextCels; extern void *pTextBoxCels; diff --git a/Source/missiles.cpp b/Source/missiles.cpp index 296b4a96053..d3beb9a6e8a 100644 --- a/Source/missiles.cpp +++ b/Source/missiles.cpp @@ -3,11 +3,11 @@ int missileactive[MAXMISSILES]; int missileavail[MAXMISSILES]; MissileStruct missile[MAXMISSILES]; -int nummissiles; // idb +int nummissiles; int ManashieldFlag; ChainStruct chain[MAXMISSILES]; -int MissilePreFlag; // weak -int numchains; // weak +int MissilePreFlag; +int numchains; int XDirAdd[8] = { 1, 0, -1, -1, -1, 0, 1, 1 }; int YDirAdd[8] = { 1, 1, 1, 0, -1, -1, -1, 0 }; @@ -20,30 +20,30 @@ void GetDamageAmt(int i, int *mind, int *maxd) /// ASSERT: assert((DWORD)i < 64); sl = plr[myplr]._pSplLvl[i] + plr[myplr]._pISplLvlAdd; - switch(i) { + switch (i) { case SPL_FIREBOLT: *mind = (plr[myplr]._pMagic >> 3) + sl + 1; *maxd = (plr[myplr]._pMagic >> 3) + sl + 10; break; case SPL_HEAL: /// BUGFIX: healing calculation is unused *mind = plr[myplr]._pLevel + sl + 1; - if(plr[myplr]._pClass == PC_WARRIOR) { + if (plr[myplr]._pClass == PC_WARRIOR) { *mind *= 2; } - if(plr[myplr]._pClass == PC_ROGUE) { + if (plr[myplr]._pClass == PC_ROGUE) { *mind += *mind >> 1; } *maxd = 10; - for(k = 0; k < plr[myplr]._pLevel; k++) { + for (k = 0; k < plr[myplr]._pLevel; k++) { *maxd += 4; } - for(k = 0; k < sl; k++) { + for (k = 0; k < sl; k++) { *maxd += 6; } - if(plr[myplr]._pClass == PC_WARRIOR) { + if (plr[myplr]._pClass == PC_WARRIOR) { *maxd *= 2; } - if(plr[myplr]._pClass == PC_ROGUE) { + if (plr[myplr]._pClass == PC_ROGUE) { *maxd += *maxd >> 1; } *mind = -1; @@ -55,7 +55,7 @@ void GetDamageAmt(int i, int *mind, int *maxd) break; case SPL_FLASH: *mind = plr[myplr]._pLevel; - for(k = 0; k < sl; k++) { + for (k = 0; k < sl; k++) { *mind += *mind >> 3; } *mind += *mind >> 1; @@ -88,21 +88,21 @@ void GetDamageAmt(int i, int *mind, int *maxd) break; case SPL_FIREBALL: *mind = 2 * plr[myplr]._pLevel + 4; - for(k = 0; k < sl; k++) { + for (k = 0; k < sl; k++) { *mind += *mind >> 3; } *maxd = 2 * plr[myplr]._pLevel + 40; - for(k = 0; k < sl; k++) { + for (k = 0; k < sl; k++) { *maxd += *maxd >> 3; } break; case SPL_GUARDIAN: *mind = (plr[myplr]._pLevel >> 1) + 1; - for(k = 0; k < sl; k++) { + for (k = 0; k < sl; k++) { *mind += *mind >> 3; } *maxd = (plr[myplr]._pLevel >> 1) + 10; - for(k = 0; k < sl; k++) { + for (k = 0; k < sl; k++) { *maxd += *maxd >> 3; } break; @@ -116,12 +116,12 @@ void GetDamageAmt(int i, int *mind, int *maxd) break; case SPL_NOVA: *mind = (plr[myplr]._pLevel + 5) >> 1; - for(k = 0; k < sl; k++) { + for (k = 0; k < sl; k++) { *mind += *mind >> 3; } *mind *= 5; *maxd = (plr[myplr]._pLevel + 30) >> 1; - for(k = 0; k < sl; k++) { + for (k = 0; k < sl; k++) { *maxd += *maxd >> 3; } *maxd *= 5; @@ -137,22 +137,22 @@ void GetDamageAmt(int i, int *mind, int *maxd) break; case SPL_APOCA: *mind = 0; - for(k = 0; k < plr[myplr]._pLevel; k++) { + for (k = 0; k < plr[myplr]._pLevel; k++) { *mind += 1; } *maxd = 0; - for(k = 0; k < plr[myplr]._pLevel; k++) { + for (k = 0; k < plr[myplr]._pLevel; k++) { *maxd += 6; } break; case SPL_ELEMENT: *mind = 2 * plr[myplr]._pLevel + 4; - for(k = 0; k < sl; k++) { + for (k = 0; k < sl; k++) { *mind += *mind >> 3; } /// BUGFIX: add here '*mind >>= 1;' *maxd = 2 * plr[myplr]._pLevel + 40; - for(k = 0; k < sl; k++) { + for (k = 0; k < sl; k++) { *maxd += *maxd >> 3; } /// BUGFIX: add here '*maxd >>= 1;' @@ -167,23 +167,23 @@ void GetDamageAmt(int i, int *mind, int *maxd) break; case SPL_HEALOTHER: /// BUGFIX: healing calculation is unused *mind = plr[myplr]._pLevel + sl + 1; - if(plr[myplr]._pClass == PC_WARRIOR) { + if (plr[myplr]._pClass == PC_WARRIOR) { *mind *= 2; } - if(plr[myplr]._pClass == PC_ROGUE) { + if (plr[myplr]._pClass == PC_ROGUE) { *mind += *mind >> 1; } *maxd = 10; - for(k = 0; k < plr[myplr]._pLevel; k++) { + for (k = 0; k < plr[myplr]._pLevel; k++) { *maxd += 4; } - for(k = 0; k < sl; k++) { + for (k = 0; k < sl; k++) { *maxd += 6; } - if(plr[myplr]._pClass == PC_WARRIOR) { + if (plr[myplr]._pClass == PC_WARRIOR) { *maxd *= 2; } - if(plr[myplr]._pClass == PC_ROGUE) { + if (plr[myplr]._pClass == PC_ROGUE) { *maxd += *maxd >> 1; } *mind = -1; @@ -223,7 +223,7 @@ int FindClosest(int sx, int sy, int rad) for (i = 1; i < rad; i++) { cr = CrawlNum[i] + 2; - for (j = (unsigned char)CrawlTable[CrawlNum[i]]; j > 0; j--) { + for (j = (BYTE)CrawlTable[CrawlNum[i]]; j > 0; j--) { tx = sx + CrawlTable[cr - 1]; ty = sy + CrawlTable[cr]; if (tx > 0 && tx < MAXDUNX && ty > 0 && ty < MAXDUNY) { @@ -254,7 +254,7 @@ int GetSpellLevel(int id, int sn) int GetDirection8(int x1, int y1, int x2, int y2) { - unsigned char Dirs[16][16] = { + BYTE Dirs[16][16] = { { 99, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }, { 2, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }, { 2, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0 }, @@ -274,9 +274,9 @@ int GetDirection8(int x1, int y1, int x2, int y2) }; int mx, my, md; ALIGN_BY_1 BYTE urtoll[] = { 3, 4, 5 }, - ultolr[] = { 3, 2, 1 }, - lrtoul[] = { 7, 6, 5 }, - lltour[] = { 7, 0, 1 }; + ultolr[] = { 3, 2, 1 }, + lrtoul[] = { 7, 6, 5 }, + lltour[] = { 7, 0, 1 }; mx = abs(x2 - x1); if (mx > 15) @@ -393,7 +393,6 @@ void PutMissile(int i) MissilePreFlag = 1; } } -// 64CCD4: using guessed type int MissilePreFlag; void GetMissilePos(int i) { @@ -803,7 +802,7 @@ BOOL PlayerMHit(int pnum, int m, int dist, int mind, int maxd, int mtype, BOOLEA if (plr[pnum]._pHitPoints >> 6 <= 0) { SyncPlrKill(pnum, earflag); - } else{ + } else { if (plr[pnum]._pClass == PC_WARRIOR) { PlaySfxLoc(PS_WARR69, plr[pnum].WorldX, plr[pnum].WorldY); } else if (plr[pnum]._pClass == PC_ROGUE) { @@ -812,15 +811,15 @@ BOOL PlayerMHit(int pnum, int m, int dist, int mind, int maxd, int mtype, BOOLEA PlaySfxLoc(PS_MAGE69, plr[pnum].WorldX, plr[pnum].WorldY); } drawhpflag = TRUE; - } + } } else { if (blk < blkper) { if (m != -1) { tac = GetDirection(plr[pnum].WorldX, plr[pnum].WorldY, monster[m]._mx, monster[m]._my); - } else { + } else { tac = plr[pnum]._pdir; - } - StartPlrBlock(pnum, tac); + } + StartPlrBlock(pnum, tac); } else { if (pnum == myplr) { plr[pnum]._pHitPoints -= dam; @@ -1207,7 +1206,6 @@ void InitMissiles() } } } -// 64CCD8: using guessed type int numchains; void AddLArrow(int mi, int sx, int sy, int dx, int dy, int midir, char mienemy, int id, int dam) { @@ -1316,7 +1314,6 @@ void AddRndTeleport(int mi, int sx, int sy, int dx, int dy, int midir, char mien } } } -// 5CF31D: using guessed type char setlevel; void AddFirebolt(int mi, int sx, int sy, int dx, int dy, int midir, char micaster, int id, int dam) { @@ -1382,7 +1379,7 @@ void AddTeleport(int mi, int sx, int sy, int dx, int dy, int midir, char mienemy for (i = 0; i < 6; i++) { k = CrawlNum[i]; pn = k + 2; - for (j = (unsigned char)CrawlTable[k]; j > 0; j--) { + for (j = (BYTE)CrawlTable[k]; j > 0; j--) { tx = dx + CrawlTable[pn - 1]; ty = dy + CrawlTable[pn]; if (0 < tx && tx < MAXDUNX && 0 < ty && ty < MAXDUNY) { @@ -1570,11 +1567,11 @@ void AddTown(int mi, int sx, int sy, int dx, int dy, int midir, char mienemy, in missile[mi]._miDelFlag = TRUE; for (j = 0; j < 6; j++) { k = CrawlNum[j] + 2; - for (i = (unsigned char)CrawlTable[CrawlNum[j]]; i > 0; i--) { + for (i = (BYTE)CrawlTable[CrawlNum[j]]; i > 0; i--) { tx = dx + CrawlTable[k - 1]; ty = dy + CrawlTable[k]; if (tx > 0 && tx < MAXDUNX && ty > 0 && ty < MAXDUNY) { - if (!(dObject[tx][ty] | dPlayer[tx][ty] | dMissile[tx][ty] | nSolidTable[dPiece[tx][ty]] | (unsigned char)nMissileTable[dPiece[tx][ty]])) { + if (!(dObject[tx][ty] | dPlayer[tx][ty] | dMissile[tx][ty] | nSolidTable[dPiece[tx][ty]] | (BYTE)nMissileTable[dPiece[tx][ty]])) { if (!CheckIfTrig(tx, ty)) { missile[mi]._miDelFlag = FALSE; missile[mi]._mix = tx; @@ -1614,7 +1611,6 @@ void AddTown(int mi, int sx, int sy, int dx, int dy, int midir, char mienemy, in } } } -// 5CF31D: using guessed type char setlevel; void AddFlash(int mi, int sx, int sy, int dx, int dy, int midir, char mienemy, int id, int dam) { @@ -1701,13 +1697,13 @@ void AddGuardian(int mi, int sx, int sy, int dx, int dy, int midir, char mienemy for (i = 0; i < 6; i++) { pn = CrawlNum[i]; k = pn + 2; - for (j = (unsigned char)CrawlTable[pn]; j > 0; j--) { + for (j = (BYTE)CrawlTable[pn]; j > 0; j--) { tx = dx + CrawlTable[k - 1]; ty = dy + CrawlTable[k]; pn = dPiece[tx][ty]; if (tx > 0 && tx < MAXDUNX && ty > 0 && ty < MAXDUNY) { if (LineClear(sx, sy, tx, ty)) { - if (!(dMonster[tx][ty] | dObject[tx][ty] | dMissile[tx][ty] | nSolidTable[pn] | (unsigned char)nMissileTable[pn])) { + if (!(dMonster[tx][ty] | dObject[tx][ty] | dMissile[tx][ty] | nSolidTable[pn] | (BYTE)nMissileTable[pn])) { missile[mi]._miDelFlag = FALSE; missile[mi]._mix = tx; missile[mi]._miy = ty; @@ -1914,7 +1910,7 @@ void AddStone(int mi, int sx, int sy, int dx, int dy, int midir, char mienemy, i for (i = 0; i < 6; i++) { k = CrawlNum[i]; l = k + 2; - for (j = (unsigned char)CrawlTable[k]; j > 0; j--) { + for (j = (BYTE)CrawlTable[k]; j > 0; j--) { tx = dx + CrawlTable[l - 1]; ty = dy + CrawlTable[l]; if (tx > 0 && tx < MAXDUNX && ty > 0 && ty < MAXDUNY) { @@ -2103,7 +2099,6 @@ void AddIdentify(int mi, int sx, int sy, int dx, int dy, int midir, char mienemy SetCursor_(CURSOR_IDENTIFY); } } -// 4B8968: using guessed type int sbookflag; void AddFirewallC(int mi, int sx, int sy, int dx, int dy, int midir, char mienemy, int id, int dam) { @@ -2114,7 +2109,7 @@ void AddFirewallC(int mi, int sx, int sy, int dx, int dy, int midir, char mienem for (i = 0; i < 6; i++) { k = CrawlNum[i]; pn = k + 2; - for (j = (unsigned char)CrawlTable[k]; j > 0; j--) { + for (j = (BYTE)CrawlTable[k]; j > 0; j--) { tx = dx + CrawlTable[pn - 1]; ty = dy + CrawlTable[pn]; if (0 < tx && tx < MAXDUNX && 0 < ty && ty < MAXDUNY) { @@ -2200,7 +2195,6 @@ void AddRepair(int mi, int sx, int sy, int dx, int dy, int midir, char mienemy, SetCursor_(CURSOR_REPAIR); } } -// 4B8968: using guessed type int sbookflag; void AddRecharge(int mi, int sx, int sy, int dx, int dy, int midir, char mienemy, int id, int dam) { @@ -2214,7 +2208,6 @@ void AddRecharge(int mi, int sx, int sy, int dx, int dy, int midir, char mienemy SetCursor_(CURSOR_RECHARGE); } } -// 4B8968: using guessed type int sbookflag; void AddDisarm(int mi, int sx, int sy, int dx, int dy, int midir, char mienemy, int id, int dam) { @@ -2291,11 +2284,11 @@ void AddFlamec(int mi, int sx, int sy, int dx, int dy, int midir, char mienemy, void AddCbolt(int mi, int sx, int sy, int dx, int dy, int midir, char micaster, int id, int dam) { if (micaster == 0) { - if (id != -1) - missile[mi]._mirnd = random(63, 15) + 1; - else - missile[mi]._mirnd = random(63, 15) + 1; - missile[mi]._midam = random(68, plr[id]._pMagic >> 2) + 1; + if (id != -1) + missile[mi]._mirnd = random(63, 15) + 1; + else + missile[mi]._mirnd = random(63, 15) + 1; + missile[mi]._midam = random(68, plr[id]._pMagic >> 2) + 1; } else { missile[mi]._mirnd = random(63, 15) + 1; missile[mi]._midam = 15; @@ -2304,11 +2297,11 @@ void AddCbolt(int mi, int sx, int sy, int dx, int dy, int midir, char micaster, if (sx == dx && sy == dy) { dx += XDirAdd[midir]; dy += YDirAdd[midir]; - } + } missile[mi]._miAnimFrame = random(63, 8) + 1; - missile[mi]._mlid = AddLight(sx, sy, 5); - + missile[mi]._mlid = AddLight(sx, sy, 5); + GetMissileVel(mi, sx, sy, dx, dy, 8); missile[mi]._miVar1 = 5; missile[mi]._miVar2 = midir; @@ -2420,7 +2413,6 @@ void AddDiabApoca(int mi, int sx, int sy, int dx, int dy, int midir, char mienem } missile[mi]._miDelFlag = TRUE; } -// 679660: using guessed type char gbMaxPlayers; int AddMissile(int sx, int sy, int dx, int dy, int midir, int mitype, char micaster, int id, int midam, int spllvl) { @@ -2521,7 +2513,7 @@ void MI_Golem(int i) for (l = 0; l < 6; l++) { k = CrawlNum[l]; tid = k + 2; - for (m = (unsigned char)CrawlTable[k]; m > 0; m--) { + for (m = (BYTE)CrawlTable[k]; m > 0; m--) { tx = missile[i]._miVar4 + CrawlTable[tid - 1]; ty = missile[i]._miVar5 + CrawlTable[tid]; if (0 < tx && tx < MAXDUNX && 0 < ty && ty < MAXDUNY) { @@ -2883,12 +2875,12 @@ void MI_Fireball(int i) } if (missile[i]._miyvel > 0 && (TransList[dTransVal[mx + 1][my]] && nSolidTable[dPiece[mx + 1][my]] - || TransList[dTransVal[mx - 1][my]] && nSolidTable[dPiece[mx - 1][my]])) { + || TransList[dTransVal[mx - 1][my]] && nSolidTable[dPiece[mx - 1][my]])) { missile[i]._miyoff -= 32; } if (missile[i]._mixvel > 0 && (TransList[dTransVal[mx][my + 1]] && nSolidTable[dPiece[mx][my + 1]] - || TransList[dTransVal[mx][my - 1]] && nSolidTable[dPiece[mx][my - 1]])) { + || TransList[dTransVal[mx][my - 1]] && nSolidTable[dPiece[mx][my - 1]])) { missile[i]._mixoff -= 32; } missile[i]._mimfnum = 0; @@ -2912,8 +2904,8 @@ void MI_Lightctrl(int i) missile[i]._mirange--; p = missile[i]._misource; - if(p != -1) { - if(missile[i]._micaster == 0) { + if (p != -1) { + if (missile[i]._micaster == 0) { dam = (random(79, 2) + random(79, plr[p]._pLevel) + 2) << 6; } else { dam = 2 * (monster[p].mMinDamage + random(80, monster[p].mMaxDamage - monster[p].mMinDamage + 1)); @@ -2933,61 +2925,61 @@ void MI_Lightctrl(int i) pn = dPiece[mx][my]; /// ASSERT: assert((DWORD)pn <= MAXTILES); - if(missile[i]._misource == -1) { - if((mx != missile[i]._misx || my != missile[i]._misy) && nMissileTable[pn] != 0) { + if (missile[i]._misource == -1) { + if ((mx != missile[i]._misx || my != missile[i]._misy) && nMissileTable[pn] != 0) { missile[i]._mirange = 0; } - } else if(nMissileTable[pn] != 0) { + } else if (nMissileTable[pn] != 0) { missile[i]._mirange = 0; } - if(nMissileTable[pn] == 0) { - if((mx != missile[i]._miVar1 || my != missile[i]._miVar2) && mx > 0 && my > 0 && mx < MAXDUNX && my < MAXDUNY) { - if(missile[i]._misource != -1) { - if(missile[i]._micaster == 1 - && monster[missile[i]._misource].MType->mtype >= MT_STORM - && monster[missile[i]._misource].MType->mtype <= MT_MAEL) { + if (nMissileTable[pn] == 0) { + if ((mx != missile[i]._miVar1 || my != missile[i]._miVar2) && mx > 0 && my > 0 && mx < MAXDUNX && my < MAXDUNY) { + if (missile[i]._misource != -1) { + if (missile[i]._micaster == 1 + && monster[missile[i]._misource].MType->mtype >= MT_STORM + && monster[missile[i]._misource].MType->mtype <= MT_MAEL) { AddMissile( - mx, - my, - missile[i]._misx, - missile[i]._misy, - i, - MIS_LIGHTNING2, - missile[i]._micaster, - missile[i]._misource, - dam, - missile[i]._mispllvl); + mx, + my, + missile[i]._misx, + missile[i]._misy, + i, + MIS_LIGHTNING2, + missile[i]._micaster, + missile[i]._misource, + dam, + missile[i]._mispllvl); } else { AddMissile( - mx, - my, - missile[i]._misx, - missile[i]._misy, - i, - MIS_LIGHTNING, - missile[i]._micaster, - missile[i]._misource, - dam, - missile[i]._mispllvl); + mx, + my, + missile[i]._misx, + missile[i]._misy, + i, + MIS_LIGHTNING, + missile[i]._micaster, + missile[i]._misource, + dam, + missile[i]._mispllvl); } } else { AddMissile( - mx, - my, - missile[i]._misx, - missile[i]._misy, - i, - MIS_LIGHTNING, - missile[i]._micaster, - missile[i]._misource, - dam, - missile[i]._mispllvl); + mx, + my, + missile[i]._misx, + missile[i]._misy, + i, + MIS_LIGHTNING, + missile[i]._micaster, + missile[i]._misource, + dam, + missile[i]._mispllvl); } missile[i]._miVar1 = missile[i]._mix; missile[i]._miVar2 = missile[i]._miy; } } - if(missile[i]._mirange == 0 || mx <= 0 || my <= 0 || mx >= MAXDUNX || my > MAXDUNY) { + if (missile[i]._mirange == 0 || mx <= 0 || my <= 0 || mx >= MAXDUNX || my > MAXDUNY) { missile[i]._miDelFlag = TRUE; } } @@ -3244,42 +3236,42 @@ void MI_Guardian(int i) sy1 = 0; missile[i]._mirange--; - if(missile[i]._miVar2 > 0) { + if (missile[i]._miVar2 > 0) { missile[i]._miVar2--; } - if(missile[i]._mirange == missile[i]._miVar1 || missile[i]._mimfnum == MFILE_GUARD && missile[i]._miVar2 == 0) { + if (missile[i]._mirange == missile[i]._miVar1 || missile[i]._mimfnum == MFILE_GUARD && missile[i]._miVar2 == 0) { SetMissDir(i, 1); } - if(!(missile[i]._mirange % 16)) { + if (!(missile[i]._mirange % 16)) { ex = 0; - for(j = 0; j < 23 && ex != -1; j++) { - for(k = 10; k >= 0 && ex != -1 && (vCrawlTable[j][k] != 0 || vCrawlTable[j][k + 1] != 0); k -= 2) { - if(sx1 == vCrawlTable[j][k] && sy1 == vCrawlTable[j][k + 1]) { + for (j = 0; j < 23 && ex != -1; j++) { + for (k = 10; k >= 0 && ex != -1 && (vCrawlTable[j][k] != 0 || vCrawlTable[j][k + 1] != 0); k -= 2) { + if (sx1 == vCrawlTable[j][k] && sy1 == vCrawlTable[j][k + 1]) { continue; } sx = missile[i]._mix + vCrawlTable[j][k]; sy = missile[i]._miy + vCrawlTable[j][k + 1]; ex = Sentfire(i, sx, sy); - if(ex == -1) { + if (ex == -1) { break; } sx = missile[i]._mix - vCrawlTable[j][k]; sy = missile[i]._miy - vCrawlTable[j][k + 1]; ex = Sentfire(i, sx, sy); - if(ex == -1) { + if (ex == -1) { break; } sx = missile[i]._mix + vCrawlTable[j][k]; sy = missile[i]._miy - vCrawlTable[j][k + 1]; ex = Sentfire(i, sx, sy); - if(ex == -1) { + if (ex == -1) { break; } sx = missile[i]._mix - vCrawlTable[j][k]; sy = missile[i]._miy + vCrawlTable[j][k + 1]; ex = Sentfire(i, sx, sy); - if(ex == -1) { + if (ex == -1) { break; } sx1 = vCrawlTable[j][k]; @@ -3288,7 +3280,7 @@ void MI_Guardian(int i) } } - if(missile[i]._mirange == 14) { + if (missile[i]._mirange == 14) { SetMissDir(i, 0); missile[i]._miAnimFrame = 15; missile[i]._miAnimAdd = -1; @@ -3296,13 +3288,13 @@ void MI_Guardian(int i) missile[i]._miVar3 += missile[i]._miAnimAdd; - if(missile[i]._miVar3 > 15) { + if (missile[i]._miVar3 > 15) { missile[i]._miVar3 = 15; - } else if(missile[i]._miVar3 > 0) { + } else if (missile[i]._miVar3 > 0) { ChangeLight(missile[i]._mlid, missile[i]._mix, missile[i]._miy, missile[i]._miVar3); } - if(missile[i]._mirange == 0) { + if (missile[i]._mirange == 0) { missile[i]._miDelFlag = TRUE; AddUnLight(missile[i]._mlid); } @@ -3326,7 +3318,7 @@ void MI_Chain(int i) for (m = 1; m < rad; m++) { k = CrawlNum[m]; l = k + 2; - for (n = (unsigned char)CrawlTable[k]; n > 0; n--) { + for (n = (BYTE)CrawlTable[k]; n > 0; n--) { tx = sx + CrawlTable[l - 1]; ty = sy + CrawlTable[l]; if (tx > 0 && tx < MAXDUNX && ty > 0 && ty < MAXDUNY && dMonster[tx][ty] > 0) { @@ -4080,7 +4072,6 @@ void ProcessMissiles() } } } -// 64CCD4: using guessed type int MissilePreFlag; void missiles_process_charge() { diff --git a/Source/missiles.h b/Source/missiles.h index f63f3b6821b..466bae2714d 100644 --- a/Source/missiles.h +++ b/Source/missiles.h @@ -5,11 +5,11 @@ extern int missileactive[MAXMISSILES]; extern int missileavail[MAXMISSILES]; extern MissileStruct missile[MAXMISSILES]; -extern int nummissiles; // idb +extern int nummissiles; extern int ManashieldFlag; extern ChainStruct chain[MAXMISSILES]; -extern int MissilePreFlag; // weak -extern int numchains; // weak +extern int MissilePreFlag; +extern int numchains; void GetDamageAmt(int i, int *mind, int *maxd); BOOL CheckBlock(int fx, int fy, int tx, int ty); diff --git a/Source/mpqapi.cpp b/Source/mpqapi.cpp index 4c37d4f1af3..1e8660c42e0 100644 --- a/Source/mpqapi.cpp +++ b/Source/mpqapi.cpp @@ -6,7 +6,7 @@ char mpq_buf[4096]; _HASHENTRY *sgpHashTbl; BOOL save_archive_modified; _BLOCKENTRY *sgpBlockTbl; -BOOLEAN save_archive_open; // weak +BOOLEAN save_archive_open; //note: 32872 = 32768 + 104 (sizeof(_FILEHEADER)) @@ -120,7 +120,7 @@ BOOLEAN mpqapi_reg_store_modification_time(char *pbData, DWORD dwLen) } while (i); } - return SRegSaveData("Diablo", "Video Player ", 0, (unsigned char *)pbData, dwLen); + return SRegSaveData("Diablo", "Video Player ", 0, (BYTE *)pbData, dwLen); } void mpqapi_remove_hash_entry(const char *pszName) diff --git a/Source/mpqapi.h b/Source/mpqapi.h index c1451b360d5..9afe8fe961a 100644 --- a/Source/mpqapi.h +++ b/Source/mpqapi.h @@ -3,8 +3,8 @@ #define __MPQAPI_H__ extern char mpq_buf[4096]; -extern BOOL save_archive_modified; // weak -extern BOOLEAN save_archive_open; // weak +extern BOOL save_archive_modified; +extern BOOLEAN save_archive_open; BOOL mpqapi_set_hidden(const char *pszArchive, BOOL hidden); void mpqapi_store_creation_time(const char *pszArchive, DWORD dwChar); diff --git a/Source/msg.cpp b/Source/msg.cpp index 2ab4634e2f9..1d6a2454f23 100644 --- a/Source/msg.cpp +++ b/Source/msg.cpp @@ -48,7 +48,6 @@ void msg_send_packet(int pnum, const void *packet, DWORD dwSize) memcpy((char *)&packeta[1] - packeta->dwSpaceLeft, packet, dwSize); sgpCurrPkt->dwSpaceLeft -= dwSize; } -// 65AB24: using guessed type int sgnCurrMegaPlayer; TMegaPkt *msg_get_next_packet() { @@ -98,11 +97,6 @@ BOOL msg_wait_resync() return TRUE; } -// 65AB18: using guessed type int sgdwOwnerWait; -// 65AB24: using guessed type int sgnCurrMegaPlayer; -// 67618D: using guessed type char sgbDeltaChunks; -// 676194: using guessed type char gbBufferMsgs; -// 67862D: using guessed type char gbGameDestroyed; void msg_free_packets() { @@ -145,10 +139,6 @@ int msg_wait_for_turns() } return 100 * sgbDeltaChunks / 21; } -// 65AB18: using guessed type int sgdwOwnerWait; -// 67618D: using guessed type char sgbDeltaChunks; -// 67862D: using guessed type char gbGameDestroyed; -// 6796E4: using guessed type char gbDeltaSender; void msg_process_net_packets() { @@ -159,8 +149,6 @@ void msg_process_net_packets() msg_free_packets(); } } -// 676194: using guessed type char gbBufferMsgs; -// 679660: using guessed type char gbMaxPlayers; void msg_pre_packet() { @@ -313,7 +301,6 @@ void delta_init() memset(sgLocals, 0, sizeof(sgLocals)); deltaload = FALSE; } -// 676190: using guessed type int deltaload; void delta_kill_monster(int mi, BYTE x, BYTE y, BYTE bLevel) { @@ -328,7 +315,6 @@ void delta_kill_monster(int mi, BYTE x, BYTE y, BYTE bLevel) pD->_mhitpoints = 0; } } -// 679660: using guessed type char gbMaxPlayers; void delta_monster_hp(int mi, int hp, BYTE bLevel) { @@ -341,7 +327,6 @@ void delta_monster_hp(int mi, int hp, BYTE bLevel) pD->_mhitpoints = hp; } } -// 679660: using guessed type char gbMaxPlayers; void delta_sync_monster(const TSyncMonster *pSync, BYTE bLevel) { @@ -363,7 +348,6 @@ void delta_sync_monster(const TSyncMonster *pSync, BYTE bLevel) pD->_menemy = pSync->_menemy; } } -// 679660: using guessed type char gbMaxPlayers; void delta_sync_golem(TCmdGolem *pG, int pnum, BYTE bLevel) { @@ -380,7 +364,6 @@ void delta_sync_golem(TCmdGolem *pG, int pnum, BYTE bLevel) pD->_mhitpoints = pG->_mhitpoints; } } -// 679660: using guessed type char gbMaxPlayers; void delta_leave_sync(BYTE bLevel) { @@ -409,8 +392,6 @@ void delta_leave_sync(BYTE bLevel) } } } -// 43C17D: could not find valid save-restore pair for edi -// 679660: using guessed type char gbMaxPlayers; BOOL delta_portal_inited(int i) { @@ -431,7 +412,7 @@ void DeltaAddItem(int ii) return; } pD = sgLevels[currlevel].item; - for (i = 0; i < MAXITEMS; i++,pD++) { + for (i = 0; i < MAXITEMS; i++, pD++) { if (pD->bCmd != 0xFF && pD->wIndx == item[ii].IDidx && pD->wCI == item[ii]._iCreateInfo @@ -475,7 +456,6 @@ void DeltaSaveLevel() delta_leave_sync(currlevel); } } -// 679660: using guessed type char gbMaxPlayers; void DeltaLoadLevel() { @@ -626,7 +606,6 @@ void DeltaLoadLevel() } deltaload = FALSE; } -// 679660: using guessed type char gbMaxPlayers; void NetSendCmd(BOOL bHiPri, BYTE bCmd) { @@ -1159,9 +1138,6 @@ int ParseCmd(int pnum, TCmd *pCmd) return On_DLEVEL(pnum, pCmd); } -// 66E4A9: using guessed type char sbLastCmd; -// 67618D: using guessed type char sgbDeltaChunks; -// 6796E4: using guessed type char gbDeltaSender; int On_DLEVEL(int pnum, TCmd *pCmd) { @@ -1169,30 +1145,30 @@ int On_DLEVEL(int pnum, TCmd *pCmd) p = (TCmdPlrInfoHdr *)pCmd; - if(gbDeltaSender != pnum) { - if(p->bCmd == CMD_DLEVEL_END) { + if (gbDeltaSender != pnum) { + if (p->bCmd == CMD_DLEVEL_END) { gbDeltaSender = pnum; sgbRecvCmd = CMD_DLEVEL_END; - } else if(p->bCmd == CMD_DLEVEL_0 && p->wOffset == 0) { + } else if (p->bCmd == CMD_DLEVEL_0 && p->wOffset == 0) { gbDeltaSender = pnum; sgbRecvCmd = CMD_DLEVEL_END; } else { return p->wBytes + sizeof(*p); } } - if(sgbRecvCmd == CMD_DLEVEL_END) { - if(p->bCmd == CMD_DLEVEL_END) { + if (sgbRecvCmd == CMD_DLEVEL_END) { + if (p->bCmd == CMD_DLEVEL_END) { sgbDeltaChunks = 20; return p->wBytes + sizeof(*p); - } else if(p->bCmd == CMD_DLEVEL_0 && p->wOffset == 0) { + } else if (p->bCmd == CMD_DLEVEL_0 && p->wOffset == 0) { sgdwRecvOffset = 0; sgbRecvCmd = p->bCmd; } else { return p->wBytes + sizeof(*p); } - } else if(sgbRecvCmd != p->bCmd) { + } else if (sgbRecvCmd != p->bCmd) { DeltaImportData(sgbRecvCmd, sgdwRecvOffset); - if(p->bCmd == CMD_DLEVEL_END) { + if (p->bCmd == CMD_DLEVEL_END) { sgbDeltaChunks = 20; sgbRecvCmd = CMD_DLEVEL_END; return p->wBytes + sizeof(*p); @@ -1231,7 +1207,6 @@ void DeltaImportData(BYTE cmd, DWORD recv_offset) sgbDeltaChunks++; sgbDeltaChanged = TRUE; } -// 67618D: using guessed type char sgbDeltaChunks; BYTE *DeltaImportItem(BYTE *src, TCmdPItem *dst) { @@ -1444,7 +1419,6 @@ BOOL i_own_level(int nReqLevel) return i == myplr; } -// 676194: using guessed type char gbBufferMsgs; int On_GETITEM(TCmdGItem *pCmd, int pnum) { @@ -1530,7 +1504,6 @@ BOOL delta_get_item(TCmdGItem *pI, BYTE bLevel) } return result; } -// 679660: using guessed type char gbMaxPlayers; int On_GOTOAGETITEM(TCmdLocParam1 *pCmd, int pnum) { @@ -1665,7 +1638,6 @@ void check_update_plr(int pnum) if (gbMaxPlayers != 1 && pnum == myplr) pfile_update(1); } -// 679660: using guessed type char gbMaxPlayers; int On_SYNCPUTITEM(TCmdPItem *pCmd, int pnum) { @@ -2142,7 +2114,6 @@ void delta_sync_object(int oi, BYTE bCmd, BYTE bLevel) sgLevels[bLevel].object[oi].bCmd = bCmd; } } -// 679660: using guessed type char gbMaxPlayers; int On_CLOSEDOOR(TCmdParam1 *pCmd, int pnum) { diff --git a/Source/multi.cpp b/Source/multi.cpp index fe75af29275..9d27a104f0e 100644 --- a/Source/multi.cpp +++ b/Source/multi.cpp @@ -2,7 +2,7 @@ #include "../3rdParty/Storm/Source/storm.h" #include "../DiabloUI/diabloui.h" -BOOLEAN gbSomebodyWonGameKludge; // weak +BOOLEAN gbSomebodyWonGameKludge; #ifdef _DEBUG DWORD gdwHistTicks; #endif @@ -12,22 +12,22 @@ WORD sgwPackPlrOffsetTbl[MAX_PLRS]; PkPlayerStruct netplr[MAX_PLRS]; BOOLEAN sgbPlayerTurnBitTbl[MAX_PLRS]; BOOLEAN sgbPlayerLeftGameTbl[MAX_PLRS]; -int sgbSentThisCycle; // idb +int sgbSentThisCycle; BOOL gbShouldValidatePackage; -BYTE gbActivePlayers; // weak +BYTE gbActivePlayers; BOOLEAN gbGameDestroyed; BOOLEAN sgbSendDeltaTbl[MAX_PLRS]; _gamedata sgGameInitInfo; -char byte_678640; // weak -int sglTimeoutStart; // weak +char byte_678640; +int sglTimeoutStart; int sgdwPlayerLeftReasonTbl[MAX_PLRS]; TBuffer sgLoPriBuf; -unsigned int sgdwGameLoops; // idb +unsigned int sgdwGameLoops; BYTE gbMaxPlayers; BOOLEAN sgbTimeout; char szPlayerName[128]; BYTE gbDeltaSender; -BOOL sgbNetInited; // weak +BOOL sgbNetInited; int player_state[MAX_PLRS]; const int event_types[3] = { @@ -151,7 +151,6 @@ void NetSendHiPri(BYTE *pbMsg, BYTE bLen) nthread_terminate_game("SNetSendMessage"); } } -// 679760: using guessed type int gdwNormalMsgSize; BYTE *multi_recv_packet(TBuffer *packet, BYTE *body, int *size) { @@ -425,9 +424,6 @@ void multi_begin_timeout() multi_check_drop_player(); } } -// 67862D: using guessed type char gbGameDestroyed; -// 678644: using guessed type int sglTimeoutStart; -// 679661: using guessed type char sgbTimeout; void multi_check_drop_player() { @@ -510,8 +506,6 @@ void multi_process_network_packets() if (SErrGetLastError() != STORM_ERROR_NO_MESSAGES_WAITING) nthread_terminate_game("SNetReceiveMsg"); } -// 676194: using guessed type char gbBufferMsgs; -// 676198: using guessed type int pkt_counter; void multi_handle_all_packets(int pnum, BYTE *pData, int nSize) { @@ -572,7 +566,6 @@ void multi_send_zero_packet(DWORD pnum, char a2, void *pbSrc, DWORD dwLen) v5 += *(WORD *)&pkt.body[3]; } } -// 67975C: using guessed type int gdwLargestMsgSize; void NetClose() { diff --git a/Source/multi.h b/Source/multi.h index be7aad6e698..8ea04f36a78 100644 --- a/Source/multi.h +++ b/Source/multi.h @@ -2,17 +2,17 @@ #ifndef __MULTI_H__ #define __MULTI_H__ -extern BOOLEAN gbSomebodyWonGameKludge; // weak +extern BOOLEAN gbSomebodyWonGameKludge; extern char szPlayerDescript[128]; extern WORD sgwPackPlrOffsetTbl[MAX_PLRS]; extern PkPlayerStruct netplr[MAX_PLRS]; extern BOOL gbShouldValidatePackage; extern BYTE gbActivePlayers; -extern BOOLEAN gbGameDestroyed; // weak -extern char byte_678640; // weak +extern BOOLEAN gbGameDestroyed; +extern char byte_678640; extern BYTE gbMaxPlayers; extern char szPlayerName[128]; -extern BYTE gbDeltaSender; // weak +extern BYTE gbDeltaSender; extern int player_state[MAX_PLRS]; #ifdef _DEBUG diff --git a/Source/quests.cpp b/Source/quests.cpp index bcbaa13a252..6b0ac0590d6 100644 --- a/Source/quests.cpp +++ b/Source/quests.cpp @@ -1,18 +1,18 @@ #include "diablo.h" -int qtopline; // idb +int qtopline; BOOL questlog; BYTE *pQLogCel; QuestStruct quests[MAXQUESTS]; -int qline; // weak +int qline; int qlist[MAXQUESTS]; -int numqlines; // weak -int WaterDone; // idb -int ReturnLvlY; // idb -int ReturnLvlX; // idb -int ReturnLvlT; // idb -int ALLQUESTS; // idb -int ReturnLvl; // idb +int numqlines; +int WaterDone; +int ReturnLvlY; +int ReturnLvlX; +int ReturnLvlT; +int ALLQUESTS; +int ReturnLvl; QuestData questlist[MAXQUESTS] = { // clang-format off @@ -128,65 +128,65 @@ void CheckQuests() { int i, rportx, rporty; - if(QuestStatus(QTYPE_VB) && gbMaxPlayers != 1 && quests[QTYPE_VB]._qvar1 == 2) { + if (QuestStatus(QTYPE_VB) && gbMaxPlayers != 1 && quests[QTYPE_VB]._qvar1 == 2) { AddObject(OBJ_ALTBOY, 2 * setpc_x + 20, 2 * setpc_y + 22); quests[QTYPE_VB]._qvar1 = 3; NetSendCmdQuest(TRUE, QTYPE_VB); } - if(gbMaxPlayers != 1) { + if (gbMaxPlayers != 1) { return; } - if(currlevel == quests[QTYPE_VB]._qlevel - && !setlevel - && quests[QTYPE_VB]._qvar1 >= 2 - && (quests[QTYPE_VB]._qactive == 2 || quests[QTYPE_VB]._qactive == 3) - && (quests[QTYPE_VB]._qvar2 == 0 || quests[QTYPE_VB]._qvar2 == 2)) { + if (currlevel == quests[QTYPE_VB]._qlevel + && !setlevel + && quests[QTYPE_VB]._qvar1 >= 2 + && (quests[QTYPE_VB]._qactive == 2 || quests[QTYPE_VB]._qactive == 3) + && (quests[QTYPE_VB]._qvar2 == 0 || quests[QTYPE_VB]._qvar2 == 2)) { quests[QTYPE_VB]._qtx = 2 * quests[QTYPE_VB]._qtx + 16; quests[QTYPE_VB]._qty = 2 * quests[QTYPE_VB]._qty + 16; rportx = quests[QTYPE_VB]._qtx; rporty = quests[QTYPE_VB]._qty; AddMissile(rportx, rporty, rportx, rporty, 0, MIS_RPORTAL, 0, myplr, 0, 0); quests[QTYPE_VB]._qvar2 = 1; - if(quests[QTYPE_VB]._qactive == 2) { + if (quests[QTYPE_VB]._qactive == 2) { quests[QTYPE_VB]._qvar1 = 3; } } - if(quests[QTYPE_VB]._qactive == 3 - && setlevel - && setlvlnum == SL_VILEBETRAYER - && quests[QTYPE_VB]._qvar2 == 4) { + if (quests[QTYPE_VB]._qactive == 3 + && setlevel + && setlvlnum == SL_VILEBETRAYER + && quests[QTYPE_VB]._qvar2 == 4) { rportx = 35; rporty = 32; AddMissile(rportx, rporty, rportx, rporty, 0, MIS_RPORTAL, 0, myplr, 0, 0); quests[QTYPE_VB]._qvar2 = 3; } - if(setlevel) { - if(setlvlnum == quests[QTYPE_PW]._qslvl - && quests[QTYPE_PW]._qactive != 1 - && leveltype == quests[QTYPE_PW]._qlvltype - && nummonsters == 4 - && quests[QTYPE_PW]._qactive != 3) { + if (setlevel) { + if (setlvlnum == quests[QTYPE_PW]._qslvl + && quests[QTYPE_PW]._qactive != 1 + && leveltype == quests[QTYPE_PW]._qlvltype + && nummonsters == 4 + && quests[QTYPE_PW]._qactive != 3) { quests[QTYPE_PW]._qactive = 3; PlaySfxLoc(IS_QUESTDN, plr[myplr].WorldX, plr[myplr].WorldY); LoadPalette("Levels\\L3Data\\L3pwater.pal"); WaterDone = 32; } - if(WaterDone > 0) { + if (WaterDone > 0) { palette_update_quest_palette(WaterDone); WaterDone--; } - } else if(plr[myplr]._pmode == PM_STAND) { - for(i = 0; i < MAXQUESTS; i++) { - if(currlevel == quests[i]._qlevel - && quests[i]._qslvl != 0 - && quests[i]._qactive != 0 - && plr[myplr].WorldX == quests[i]._qtx - && plr[myplr].WorldY == quests[i]._qty) { - if(quests[i]._qlvltype != 255) { + } else if (plr[myplr]._pmode == PM_STAND) { + for (i = 0; i < MAXQUESTS; i++) { + if (currlevel == quests[i]._qlevel + && quests[i]._qslvl != 0 + && quests[i]._qactive != 0 + && plr[myplr].WorldX == quests[i]._qtx + && plr[myplr].WorldY == quests[i]._qty) { + if (quests[i]._qlvltype != 255) { setlvltype = quests[i]._qlvltype; } StartNewLvl(myplr, WM_DIABSETLVL, quests[i]._qslvl); @@ -194,11 +194,6 @@ void CheckQuests() } } } -// 5BB1ED: using guessed type char leveltype; -// 5CF31C: using guessed type char setlvltype; -// 5CF31D: using guessed type char setlevel; -// 679660: using guessed type char gbMaxPlayers; -// 69BE90: using guessed type int qline; BOOL ForceQuests() { @@ -683,11 +678,6 @@ void ResyncQuests() quests[QTYPE_VB]._qvar2 = 2; } } -// 5A5590: using guessed type char TransVal; -// 5BB1ED: using guessed type char leveltype; -// 5CF31D: using guessed type char setlevel; -// 5CF330: using guessed type int setpc_h; -// 5CF334: using guessed type int setpc_w; void PrintQLString(int x, int y, BOOL cjustflag, char *str, int col) { @@ -718,7 +708,7 @@ void PrintQLString(int x, int y, BOOL cjustflag, char *str, int col) off += fontkern[c] + 1; } if (qline == y) { - CelDecodeOnly(cjustflag ? x + k + 100 : 340 - x, s + 205, pCelBuff, ALLQUESTS, 12); + CelDecodeOnly(cjustflag ? x + k + 100 : 340 - x, s + 205, pCelBuff, ALLQUESTS, 12); } } diff --git a/Source/quests.h b/Source/quests.h index 2c4cbeed792..3d4ee9ccf50 100644 --- a/Source/quests.h +++ b/Source/quests.h @@ -2,19 +2,19 @@ #ifndef __QUESTS_H__ #define __QUESTS_H__ -extern int qtopline; // idb +extern int qtopline; extern BOOL questlog; extern BYTE *pQLogCel; extern QuestStruct quests[MAXQUESTS]; -extern int qline; // weak +extern int qline; extern int qlist[MAXQUESTS]; -extern int numqlines; // weak -extern int WaterDone; // idb -extern int ReturnLvlY; // idb -extern int ReturnLvlX; // idb -extern int ReturnLvlT; // idb -extern int ALLQUESTS; // idb -extern int ReturnLvl; // idb +extern int numqlines; +extern int WaterDone; +extern int ReturnLvlY; +extern int ReturnLvlX; +extern int ReturnLvlT; +extern int ALLQUESTS; +extern int ReturnLvl; void InitQuests(); void CheckQuests(); From 0483a923c3a1700082bc3938218a546d9cd7cb8e Mon Sep 17 00:00:00 2001 From: Anders Jenbo Date: Sat, 6 Jul 2019 05:23:37 +0200 Subject: [PATCH 05/42] Add enum for dlgresults --- Source/mainmenu.cpp | 6 +++--- enums.h | 7 +++++++ 2 files changed, 10 insertions(+), 3 deletions(-) diff --git a/Source/mainmenu.cpp b/Source/mainmenu.cpp index 5b7e43847d7..537658f47e2 100644 --- a/Source/mainmenu.cpp +++ b/Source/mainmenu.cpp @@ -35,7 +35,7 @@ int __stdcall mainmenu_select_hero_dialog( BOOL *multi) { BOOL hero_is_created = TRUE; - int dlgresult = 0; + int dlgresult = NEW_GAME; if (gbMaxPlayers == 1) { if (!UiSelHeroSingDialog( pfile_ui_set_hero_infos, @@ -47,7 +47,7 @@ int __stdcall mainmenu_select_hero_dialog( &gnDifficulty)) app_fatal("Unable to display SelHeroSing"); - if (dlgresult == 2) + if (dlgresult == LOAD_GAME) gbLoadGame = TRUE; else gbLoadGame = FALSE; @@ -62,7 +62,7 @@ int __stdcall mainmenu_select_hero_dialog( gszHero)) { app_fatal("Can't load multiplayer dialog"); } - if (dlgresult == 4) { + if (dlgresult == EXIT_MENU) { SErrSetLastError(1223); return 0; } diff --git a/enums.h b/enums.h index 428f261274a..b15187e4921 100644 --- a/enums.h +++ b/enums.h @@ -2266,6 +2266,13 @@ typedef enum _mainmenu_selections { MAINMENU_ATTRACT_MODE = 6, } _mainmenu_selections; +typedef enum dlgresults +{ + NEW_GAME = 0, + LOAD_GAME = 2, + EXIT_MENU = 4, +} dlgresults; + typedef enum panel_button_id { PANBTN_CHARINFO = 0, PANBTN_QLOG = 1, From 73f278b0c851eb330ba3d823caf92f7bf968dfc6 Mon Sep 17 00:00:00 2001 From: Anders Jenbo Date: Sat, 6 Jul 2019 16:28:31 +0200 Subject: [PATCH 06/42] Fix travis build links --- .travis/are-we-d1-yet.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.travis/are-we-d1-yet.sh b/.travis/are-we-d1-yet.sh index dcdab18833d..d87a656ca21 100755 --- a/.travis/are-we-d1-yet.sh +++ b/.travis/are-we-d1-yet.sh @@ -31,7 +31,7 @@ WEBHOOK_DATA='{ "embeds": [ { "author": { "name": "Job #'"$TRAVIS_JOB_NUMBER"' (Build #'"$TRAVIS_BUILD_NUMBER"')", - "url": "https://travis-ci.com/'"$TRAVIS_REPO_SLUG"'/builds/'"$TRAVIS_BUILD_ID"'", + "url": "https://travis-ci.org/'"$TRAVIS_REPO_SLUG"'/builds/'"$TRAVIS_BUILD_ID"'", "icon_url": "https://travis-ci.com/images/logos/TravisCI-Mascot-1.png" }, "title": "['"\`${TRAVIS_COMMIT:0:7}\`"'] '"$COMMIT_SUBJECT"'", From c1f9e8293e9582898a1ce70c76245978f6f52d87 Mon Sep 17 00:00:00 2001 From: Anders Jenbo Date: Sat, 6 Jul 2019 16:48:03 +0200 Subject: [PATCH 07/42] Correct new line encoding _asm.cpp and _render.cpp is still incorrectly encoded --- Source/itemdat.cpp | 906 ++++++++++++++++++++++---------------------- Source/itemdat.h | 20 +- Source/list.h | 498 ++++++++++++------------ Source/misdat.cpp | 256 ++++++------- Source/misdat.h | 16 +- Source/monstdat.cpp | 508 ++++++++++++------------- Source/monstdat.h | 20 +- Source/objdat.cpp | 564 +++++++++++++-------------- Source/objdat.h | 18 +- Source/spelldat.cpp | 88 ++--- Source/spelldat.h | 14 +- 11 files changed, 1454 insertions(+), 1454 deletions(-) diff --git a/Source/itemdat.cpp b/Source/itemdat.cpp index b83f7337686..d13316e9476 100644 --- a/Source/itemdat.cpp +++ b/Source/itemdat.cpp @@ -1,453 +1,453 @@ -#include "diablo.h" - -ItemDataStruct AllItemsList[157] = { - // 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 - { IDROP_REGULAR, ICLASS_GOLD, ILOC_UNEQUIPABLE, ICURS_GOLD, 11, UITYPE_NONE, "Gold", NULL, 1, 0, 0, 0, 0, 0, 0, 0, 0, ISPL_NONE, IMISC_NONE, SPL_NULL, TRUE, 0, 0 }, - { IDROP_NEVER, ICLASS_WEAPON, ILOC_ONEHAND, ICURS_SHORT_SWORD, 1, UITYPE_NONE, "Short Sword", NULL, 2, 20, 2, 6, 0, 0, 18, 0, 0, ISPL_NONE, IMISC_NONE, SPL_NULL, FALSE, 50, 50 }, - { IDROP_NEVER, ICLASS_ARMOR, ILOC_ONEHAND, ICURS_BUCKLER, 5, UITYPE_NONE, "Buckler", NULL, 2, 10, 0, 0, 3, 3, 0, 0, 0, ISPL_NONE, IMISC_NONE, SPL_NULL, FALSE, 50, 50 }, - { IDROP_NEVER, ICLASS_WEAPON, ILOC_ONEHAND, ICURS_CLUB, 4, UITYPE_SPIKCLUB, "Club", NULL, 1, 20, 1, 6, 0, 0, 0, 0, 0, ISPL_NONE, IMISC_NONE, SPL_NULL, FALSE, 20, 20 }, - { IDROP_NEVER, ICLASS_WEAPON, ILOC_TWOHAND, ICURS_SHORT_BOW, 3, UITYPE_NONE, "Short Bow", NULL, 1, 30, 1, 4, 0, 0, 0, 0, 0, ISPL_NONE, IMISC_NONE, SPL_NULL, FALSE, 100, 100 }, - { IDROP_NEVER, ICLASS_WEAPON, ILOC_TWOHAND, ICURS_SHORT_STAFF, 10, UITYPE_NONE, "Short Staff of Charged Bolt", NULL, 1, 25, 2, 4, 0, 0, 0, 20, 0, ISPL_NONE, IMISC_STAFF, SPL_CBOLT, FALSE, 520, 520 }, - { IDROP_NEVER, ICLASS_WEAPON, ILOC_TWOHAND, ICURS_CLEAVER, 2, UITYPE_CLEAVER, "Cleaver", NULL, 10, 10, 4, 24, 0, 0, 0, 0, 0, ISPL_NONE, IMISC_UNIQUE, SPL_NULL, FALSE, 2000, 2000 }, - { IDROP_NEVER, ICLASS_ARMOR, ILOC_HELM, ICURS_THE_UNDEAD_CROWN, 7, UITYPE_SKCROWN, "The Undead Crown", NULL, 0, 50, 0, 0, 15, 15, 0, 0, 0, ISPL_RNDSTEALLIFE, IMISC_UNIQUE, SPL_NULL, FALSE, 10000, 10000 }, - { IDROP_NEVER, ICLASS_MISC, ILOC_RING, ICURS_EMPYREAN_BAND, 12, UITYPE_INFRARING, "Empyrean Band", NULL, 0, 0, 0, 0, 0, 0, 0, 0, 0, ISPL_NONE, IMISC_UNIQUE, SPL_NULL, FALSE, 8000, 8000 }, - { IDROP_NEVER, ICLASS_QUEST, ILOC_UNEQUIPABLE, ICURS_MAGIC_ROCK, 0, UITYPE_NONE, "Magic Rock", NULL, 0, 0, 0, 0, 0, 0, 0, 0, 0, ISPL_NONE, IMISC_NONE, SPL_NULL, FALSE, 0, 0 }, - { IDROP_NEVER, ICLASS_MISC, ILOC_AMULET, ICURS_OPTIC_AMULET, 13, UITYPE_OPTAMULET, "Optic Amulet", NULL, 0, 0, 0, 0, 0, 0, 0, 0, 0, ISPL_NONE, IMISC_UNIQUE, SPL_NULL, FALSE, 5000, 5000 }, - { IDROP_NEVER, ICLASS_MISC, ILOC_RING, ICURS_RING_OF_TRUTH, 12, UITYPE_TRING, "Ring of Truth", NULL, 0, 0, 0, 0, 0, 0, 0, 0, 0, ISPL_NONE, IMISC_UNIQUE, SPL_NULL, FALSE, 1000, 1000 }, - { IDROP_NEVER, ICLASS_QUEST, ILOC_UNEQUIPABLE, ICURS_TAVERN_SIGN, 0, UITYPE_NONE, "Tavern Sign", NULL, 0, 0, 0, 0, 0, 0, 0, 0, 0, ISPL_NONE, IMISC_NONE, SPL_NULL, FALSE, 0, 0 }, - { IDROP_NEVER, ICLASS_ARMOR, ILOC_HELM, ICURS_HARLEQUIN_CREST, 7, UITYPE_HARCREST, "Harlequin Crest", NULL, 0, 15, 0, 0, 0, 0, 0, 0, 0, ISPL_NONE, IMISC_UNIQUE, SPL_NULL, FALSE, 15, 20 }, - { IDROP_NEVER, ICLASS_ARMOR, ILOC_HELM, ICURS_VIEL_OF_STEEL, 7, UITYPE_STEELVEIL, "Veil of Steel", NULL, 0, 60, 0, 0, 18, 18, 0, 0, 0, ISPL_NONE, IMISC_UNIQUE, SPL_NULL, FALSE, 0, 0 }, - { IDROP_NEVER, ICLASS_MISC, ILOC_UNEQUIPABLE, ICURS_GOLDEN_ELIXIR, 0, UITYPE_ELIXIR, "Golden Elixir", NULL, 15, 0, 0, 0, 0, 0, 0, 0, 0, ISPL_NONE, IMISC_NONE, SPL_NULL, FALSE, 0, 0 }, - { IDROP_NEVER, ICLASS_QUEST, ILOC_UNEQUIPABLE, ICURS_ANVIL_OF_FURY, 0, UITYPE_NONE, "Anvil of Fury", NULL, 0, 0, 0, 0, 0, 0, 0, 0, 0, ISPL_NONE, IMISC_NONE, SPL_NULL, FALSE, 0, 0 }, - { IDROP_NEVER, ICLASS_QUEST, ILOC_UNEQUIPABLE, ICURS_BLACK_MUSHROOM, 0, UITYPE_NONE, "Black Mushroom", NULL, 0, 0, 0, 0, 0, 0, 0, 0, 0, ISPL_NONE, IMISC_NONE, SPL_NULL, FALSE, 0, 0 }, - { IDROP_NEVER, ICLASS_QUEST, ILOC_UNEQUIPABLE, ICURS_BRAIN, 0, UITYPE_NONE, "Brain", NULL, 0, 0, 0, 0, 0, 0, 0, 0, 0, ISPL_NONE, IMISC_NONE, SPL_NULL, FALSE, 0, 0 }, - { IDROP_NEVER, ICLASS_QUEST, ILOC_UNEQUIPABLE, ICURS_FUNGAL_TOME, 0, UITYPE_NONE, "Fungal Tome", NULL, 0, 0, 0, 0, 0, 0, 0, 0, 0, ISPL_NONE, IMISC_NONE, SPL_NULL, FALSE, 0, 0 }, - { IDROP_NEVER, ICLASS_MISC, ILOC_UNEQUIPABLE, ICURS_SPECTRAL_ELIXIR, 0, UITYPE_ELIXIR, "Spectral Elixir", NULL, 15, 0, 0, 0, 0, 0, 0, 0, 0, ISPL_NONE, IMISC_SPECELIX, SPL_NULL, FALSE, 0, 0 }, - { IDROP_NEVER, ICLASS_QUEST, ILOC_UNEQUIPABLE, ICURS_BLOOD_STONE, 0, UITYPE_NONE, "Blood Stone", NULL, 0, 0, 0, 0, 0, 0, 0, 0, 0, ISPL_NONE, IMISC_NONE, SPL_NULL, FALSE, 0, 0 }, - { IDROP_NEVER, ICLASS_QUEST, ILOC_UNEQUIPABLE, ICURS_MAP_OF_THE_STARS, 0, UITYPE_MAPOFDOOM, "Map of the Stars", NULL, 0, 0, 0, 0, 0, 0, 0, 0, 0, ISPL_NONE, IMISC_MAPOFDOOM, SPL_NULL, TRUE, 0, 0 }, - { IDROP_NEVER, ICLASS_QUEST, ILOC_UNEQUIPABLE, ICURS_EAR_SORCEROR, 0, UITYPE_NONE, "Heart", NULL, 0, 0, 0, 0, 0, 0, 0, 0, 0, ISPL_NONE, IMISC_EAR, SPL_NULL, FALSE, 0, 0 }, - { IDROP_NEVER, ICLASS_MISC, ILOC_UNEQUIPABLE, ICURS_POTION_OF_HEALING, 0, UITYPE_NONE, "Potion of Healing", NULL, 0, 0, 0, 0, 0, 0, 0, 0, 0, ISPL_NONE, IMISC_HEAL, SPL_NULL, TRUE, 50, 50 }, - { IDROP_NEVER, ICLASS_MISC, ILOC_UNEQUIPABLE, ICURS_POTION_OF_MANA, 0, UITYPE_NONE, "Potion of Mana", NULL, 0, 0, 0, 0, 0, 0, 0, 0, 0, ISPL_NONE, IMISC_MANA, SPL_NULL, TRUE, 50, 50 }, - { IDROP_NEVER, ICLASS_MISC, ILOC_UNEQUIPABLE, ICURS_SCROLL_OF, 0, UITYPE_NONE, "Scroll of Identify", NULL, 1, 0, 0, 0, 0, 0, 0, 0, 0, ISPL_NONE, IMISC_SCROLL, SPL_IDENTIFY, TRUE, 200, 200 }, - { IDROP_NEVER, ICLASS_MISC, ILOC_UNEQUIPABLE, ICURS_SCROLL_OF, 0, UITYPE_NONE, "Scroll of Town Portal", NULL, 4, 0, 0, 0, 0, 0, 0, 0, 0, ISPL_NONE, IMISC_SCROLL, SPL_TOWN, TRUE, 200, 200 }, - { IDROP_NEVER, ICLASS_ARMOR, ILOC_ARMOR, ICURS_ARKAINES_VALOR, 8, UITYPE_ARMOFVAL, "Arkaine's Valor", NULL, 0, 40, 0, 0, 0, 0, 0, 0, 0, ISPL_NONE, IMISC_UNIQUE, SPL_NULL, FALSE, 0, 0 }, - { IDROP_NEVER, ICLASS_MISC, ILOC_UNEQUIPABLE, ICURS_POTION_OF_FULL_HEALING, 0, UITYPE_NONE, "Potion of Full Healing", NULL, 1, 0, 0, 0, 0, 0, 0, 0, 0, ISPL_NONE, IMISC_FULLHEAL, SPL_NULL, TRUE, 150, 150 }, - { IDROP_NEVER, ICLASS_MISC, ILOC_UNEQUIPABLE, ICURS_POTION_OF_FULL_MANA, 0, UITYPE_NONE, "Potion of Full Mana", NULL, 1, 0, 0, 0, 0, 0, 0, 0, 0, ISPL_NONE, IMISC_FULLMANA, SPL_NULL, TRUE, 150, 150 }, - { IDROP_NEVER, ICLASS_WEAPON, ILOC_ONEHAND, ICURS_BROAD_SWORD, 1, UITYPE_GRISWOLD, "Griswold's Edge", NULL, 8, 50, 4, 12, 0, 0, 40, 0, 0, ISPL_NONE, IMISC_UNIQUE, SPL_NULL, FALSE, 750, 750 }, - { IDROP_NEVER, ICLASS_WEAPON, ILOC_ONEHAND, ICURS_MACE, 4, UITYPE_LGTFORGE, "Lightforge", NULL, 2, 32, 1, 8, 0, 0, 16, 0, 0, ISPL_NONE, IMISC_UNIQUE, SPL_NULL, FALSE, 200, 200 }, - { IDROP_NEVER, ICLASS_MISC, ILOC_UNEQUIPABLE, ICURS_STAFF_OF_LAZARUS, 0, UITYPE_LAZSTAFF, "Staff of Lazarus", NULL, 0, 0, 0, 0, 0, 0, 0, 0, 0, ISPL_NONE, IMISC_NONE, SPL_NULL, FALSE, 0, 0 }, - { IDROP_NEVER, ICLASS_MISC, ILOC_UNEQUIPABLE, ICURS_SCROLL_OF, 0, UITYPE_NONE, "Scroll of Resurrect", NULL, 1, 0, 0, 0, 0, 0, 0, 0, 0, ISPL_NONE, IMISC_SCROLLT, SPL_RESURRECT, TRUE, 250, 250 }, - { IDROP_NEVER, ICLASS_NONE, ILOC_NONE, ICURS_POTION_OF_FULL_MANA, 0, UITYPE_NONE, NULL, NULL, 0, 0, 0, 0, 0, 0, 0, 0, 0, ISPL_NONE, IMISC_NONE, SPL_NULL, FALSE, 0, 0 }, - { IDROP_NEVER, ICLASS_NONE, ILOC_NONE, ICURS_POTION_OF_FULL_MANA, 0, UITYPE_NONE, NULL, NULL, 0, 0, 0, 0, 0, 0, 0, 0, 0, ISPL_NONE, IMISC_NONE, SPL_NULL, FALSE, 0, 0 }, - { IDROP_NEVER, ICLASS_NONE, ILOC_NONE, ICURS_POTION_OF_FULL_MANA, 0, UITYPE_NONE, NULL, NULL, 0, 0, 0, 0, 0, 0, 0, 0, 0, ISPL_NONE, IMISC_NONE, SPL_NULL, FALSE, 0, 0 }, - { IDROP_NEVER, ICLASS_NONE, ILOC_NONE, ICURS_POTION_OF_FULL_MANA, 0, UITYPE_NONE, NULL, NULL, 0, 0, 0, 0, 0, 0, 0, 0, 0, ISPL_NONE, IMISC_NONE, SPL_NULL, FALSE, 0, 0 }, - { IDROP_NEVER, ICLASS_NONE, ILOC_NONE, ICURS_POTION_OF_FULL_MANA, 0, UITYPE_NONE, NULL, NULL, 0, 0, 0, 0, 0, 0, 0, 0, 0, ISPL_NONE, IMISC_NONE, SPL_NULL, FALSE, 0, 0 }, - { IDROP_NEVER, ICLASS_NONE, ILOC_NONE, ICURS_POTION_OF_FULL_MANA, 0, UITYPE_NONE, NULL, NULL, 0, 0, 0, 0, 0, 0, 0, 0, 0, ISPL_NONE, IMISC_NONE, SPL_NULL, FALSE, 0, 0 }, - { IDROP_NEVER, ICLASS_NONE, ILOC_NONE, ICURS_POTION_OF_FULL_MANA, 0, UITYPE_NONE, NULL, NULL, 0, 0, 0, 0, 0, 0, 0, 0, 0, ISPL_NONE, IMISC_NONE, SPL_NULL, FALSE, 0, 0 }, - { IDROP_NEVER, ICLASS_NONE, ILOC_NONE, ICURS_POTION_OF_FULL_MANA, 0, UITYPE_NONE, NULL, NULL, 0, 0, 0, 0, 0, 0, 0, 0, 0, ISPL_NONE, IMISC_NONE, SPL_NULL, FALSE, 0, 0 }, - { IDROP_NEVER, ICLASS_NONE, ILOC_NONE, ICURS_POTION_OF_FULL_MANA, 0, UITYPE_NONE, NULL, NULL, 0, 0, 0, 0, 0, 0, 0, 0, 0, ISPL_NONE, IMISC_NONE, SPL_NULL, FALSE, 0, 0 }, - { IDROP_NEVER, ICLASS_NONE, ILOC_NONE, ICURS_POTION_OF_FULL_MANA, 0, UITYPE_NONE, NULL, NULL, 0, 0, 0, 0, 0, 0, 0, 0, 0, ISPL_NONE, IMISC_NONE, SPL_NULL, FALSE, 0, 0 }, - { IDROP_NEVER, ICLASS_NONE, ILOC_NONE, ICURS_POTION_OF_FULL_MANA, 0, UITYPE_NONE, NULL, NULL, 0, 0, 0, 0, 0, 0, 0, 0, 0, ISPL_NONE, IMISC_NONE, SPL_NULL, FALSE, 0, 0 }, - { IDROP_NEVER, ICLASS_NONE, ILOC_NONE, ICURS_POTION_OF_FULL_MANA, 0, UITYPE_NONE, NULL, NULL, 0, 0, 0, 0, 0, 0, 0, 0, 0, ISPL_NONE, IMISC_NONE, SPL_NULL, FALSE, 0, 0 }, - { IDROP_NEVER, ICLASS_NONE, ILOC_NONE, ICURS_POTION_OF_FULL_MANA, 0, UITYPE_NONE, NULL, NULL, 0, 0, 0, 0, 0, 0, 0, 0, 0, ISPL_NONE, IMISC_NONE, SPL_NULL, FALSE, 0, 0 }, - { IDROP_REGULAR, ICLASS_ARMOR, ILOC_HELM, ICURS_CAP, 7, UITYPE_NONE, "Cap", "Cap", 1, 15, 0, 0, 1, 3, 0, 0, 0, ISPL_NONE, IMISC_NONE, SPL_NULL, FALSE, 15, 20 }, - { IDROP_REGULAR, ICLASS_ARMOR, ILOC_HELM, ICURS_SKULL_CAP, 7, UITYPE_SKULLCAP, "Skull Cap", "Cap", 4, 20, 0, 0, 2, 4, 0, 0, 0, ISPL_NONE, IMISC_NONE, SPL_NULL, FALSE, 25, 30 }, - { IDROP_REGULAR, ICLASS_ARMOR, ILOC_HELM, ICURS_HELM, 7, UITYPE_HELM, "Helm", "Helm", 8, 30, 0, 0, 4, 6, 25, 0, 0, ISPL_NONE, IMISC_NONE, SPL_NULL, FALSE, 40, 70 }, - { IDROP_REGULAR, ICLASS_ARMOR, ILOC_HELM, ICURS_FULL_HELM, 7, UITYPE_NONE, "Full Helm", "Helm", 12, 35, 0, 0, 6, 8, 35, 0, 0, ISPL_NONE, IMISC_NONE, SPL_NULL, FALSE, 90, 130 }, - { IDROP_REGULAR, ICLASS_ARMOR, ILOC_HELM, ICURS_CROWN, 7, UITYPE_CROWN, "Crown", "Crown", 16, 40, 0, 0, 8, 12, 0, 0, 0, ISPL_NONE, IMISC_NONE, SPL_NULL, FALSE, 200, 300 }, - { IDROP_REGULAR, ICLASS_ARMOR, ILOC_HELM, ICURS_GREAT_HELM, 7, UITYPE_GREATHELM, "Great Helm", "Helm", 20, 60, 0, 0, 10, 15, 50, 0, 0, ISPL_NONE, IMISC_NONE, SPL_NULL, FALSE, 400, 500 }, - { IDROP_REGULAR, ICLASS_ARMOR, ILOC_ARMOR, ICURS_CAPE, 6, UITYPE_CAPE, "Cape", "Cape", 1, 12, 0, 0, 1, 5, 0, 0, 0, ISPL_NONE, IMISC_NONE, SPL_NULL, FALSE, 10, 50 }, - { IDROP_REGULAR, ICLASS_ARMOR, ILOC_ARMOR, ICURS_RAGS, 6, UITYPE_RAGS, "Rags", "Rags", 1, 6, 0, 0, 2, 6, 0, 0, 0, ISPL_NONE, IMISC_NONE, SPL_NULL, FALSE, 5, 25 }, - { IDROP_REGULAR, ICLASS_ARMOR, ILOC_ARMOR, ICURS_CLOAK, 6, UITYPE_CLOAK, "Cloak", "Cloak", 2, 18, 0, 0, 3, 7, 0, 0, 0, ISPL_NONE, IMISC_NONE, SPL_NULL, FALSE, 40, 70 }, - { IDROP_REGULAR, ICLASS_ARMOR, ILOC_ARMOR, ICURS_ROBE, 6, UITYPE_ROBE, "Robe", "Robe", 3, 24, 0, 0, 4, 7, 0, 0, 0, ISPL_NONE, IMISC_NONE, SPL_NULL, FALSE, 75, 125 }, - { IDROP_REGULAR, ICLASS_ARMOR, ILOC_ARMOR, ICURS_QUILTED_ARMOR, 6, UITYPE_NONE, "Quilted Armor", "Armor", 4, 30, 0, 0, 7, 10, 0, 0, 0, ISPL_NONE, IMISC_NONE, SPL_NULL, FALSE, 200, 300 }, - { IDROP_REGULAR, ICLASS_ARMOR, ILOC_ARMOR, ICURS_LEATHER_ARMOR, 6, UITYPE_LEATHARMOR, "Leather Armor", "Armor", 6, 35, 0, 0, 10, 13, 0, 0, 0, ISPL_NONE, IMISC_NONE, SPL_NULL, FALSE, 300, 400 }, - { IDROP_REGULAR, ICLASS_ARMOR, ILOC_ARMOR, ICURS_HARD_LEATHER_ARMOR, 6, UITYPE_NONE, "Hard Leather Armor", "Armor", 7, 40, 0, 0, 11, 14, 0, 0, 0, ISPL_NONE, IMISC_NONE, SPL_NULL, FALSE, 450, 550 }, - { IDROP_REGULAR, ICLASS_ARMOR, ILOC_ARMOR, ICURS_STUDDED_LEATHER_ARMOR, 6, UITYPE_STUDARMOR, "Studded Leather Armor", "Armor", 9, 45, 0, 0, 15, 17, 20, 0, 0, ISPL_NONE, IMISC_NONE, SPL_NULL, FALSE, 700, 800 }, - { IDROP_REGULAR, ICLASS_ARMOR, ILOC_ARMOR, ICURS_RING_MAIL, 8, UITYPE_NONE, "Ring Mail", "Mail", 11, 50, 0, 0, 17, 20, 25, 0, 0, ISPL_NONE, IMISC_NONE, SPL_NULL, FALSE, 900, 1100 }, - { IDROP_REGULAR, ICLASS_ARMOR, ILOC_ARMOR, ICURS_CHAIN_MAIL, 8, UITYPE_CHAINMAIL, "Chain Mail", "Mail", 13, 55, 0, 0, 18, 22, 30, 0, 0, ISPL_NONE, IMISC_NONE, SPL_NULL, FALSE, 1250, 1750 }, - { IDROP_REGULAR, ICLASS_ARMOR, ILOC_ARMOR, ICURS_SCALE_MAIL, 8, UITYPE_NONE, "Scale Mail", "Mail", 15, 60, 0, 0, 23, 28, 35, 0, 0, ISPL_NONE, IMISC_NONE, SPL_NULL, FALSE, 2300, 2800 }, - { IDROP_REGULAR, ICLASS_ARMOR, ILOC_ARMOR, ICURS_BREAST_PLATE, 9, UITYPE_BREASTPLATE, "Breast Plate", "Plate", 16, 80, 0, 0, 20, 24, 40, 0, 0, ISPL_NONE, IMISC_NONE, SPL_NULL, FALSE, 2800, 3200 }, - { IDROP_REGULAR, ICLASS_ARMOR, ILOC_ARMOR, ICURS_SPLINT_MAIL, 8, UITYPE_NONE, "Splint Mail", "Mail", 17, 65, 0, 0, 30, 35, 40, 0, 0, ISPL_NONE, IMISC_NONE, SPL_NULL, FALSE, 3250, 3750 }, - { IDROP_REGULAR, ICLASS_ARMOR, ILOC_ARMOR, ICURS_FIELD_PLATE, 9, UITYPE_PLATEMAIL, "Plate Mail", "Plate", 19, 75, 0, 0, 42, 50, 60, 0, 0, ISPL_NONE, IMISC_NONE, SPL_NULL, FALSE, 4600, 5400 }, - { IDROP_REGULAR, ICLASS_ARMOR, ILOC_ARMOR, ICURS_FIELD_PLATE, 9, UITYPE_NONE, "Field Plate", "Plate", 21, 80, 0, 0, 40, 45, 65, 0, 0, ISPL_NONE, IMISC_NONE, SPL_NULL, FALSE, 5800, 6200 }, - { IDROP_REGULAR, ICLASS_ARMOR, ILOC_ARMOR, ICURS_GOTHIC_PLATE, 9, UITYPE_NONE, "Gothic Plate", "Plate", 23, 100, 0, 0, 50, 60, 80, 0, 0, ISPL_NONE, IMISC_NONE, SPL_NULL, FALSE, 8000, 10000 }, - { IDROP_REGULAR, ICLASS_ARMOR, ILOC_ARMOR, ICURS_FULL_PLATE_MAIL, 9, UITYPE_FULLPLATE, "Full Plate Mail", "Plate", 25, 90, 0, 0, 60, 75, 90, 0, 0, ISPL_NONE, IMISC_NONE, SPL_NULL, FALSE, 6500, 8000 }, - { IDROP_REGULAR, ICLASS_ARMOR, ILOC_ONEHAND, ICURS_BUCKLER, 5, UITYPE_BUCKLER, "Buckler", "Shield", 1, 16, 0, 0, 1, 5, 0, 0, 0, ISPL_NONE, IMISC_NONE, SPL_NULL, FALSE, 30, 70 }, - { IDROP_REGULAR, ICLASS_ARMOR, ILOC_ONEHAND, ICURS_SMALL_SHIELD, 5, UITYPE_SMALLSHIELD, "Small Shield", "Shield", 5, 24, 0, 0, 3, 8, 25, 0, 0, ISPL_NONE, IMISC_NONE, SPL_NULL, FALSE, 90, 130 }, - { IDROP_REGULAR, ICLASS_ARMOR, ILOC_ONEHAND, ICURS_LARGE_SHIELD, 5, UITYPE_LARGESHIELD, "Large Shield", "Shield", 9, 32, 0, 0, 5, 10, 40, 0, 0, ISPL_NONE, IMISC_NONE, SPL_NULL, FALSE, 200, 300 }, - { IDROP_REGULAR, ICLASS_ARMOR, ILOC_ONEHAND, ICURS_KITE_SHIELD, 5, UITYPE_KITESHIELD, "Kite Shield", "Shield", 14, 40, 0, 0, 8, 15, 50, 0, 0, ISPL_NONE, IMISC_NONE, SPL_NULL, FALSE, 400, 700 }, - { IDROP_REGULAR, ICLASS_ARMOR, ILOC_ONEHAND, ICURS_TOWER_SHIELD, 5, UITYPE_GOTHSHIELD, "Tower Shield", "Shield", 20, 50, 0, 0, 12, 20, 60, 0, 0, ISPL_NONE, IMISC_NONE, SPL_NULL, FALSE, 850, 1200 }, - { IDROP_REGULAR, ICLASS_ARMOR, ILOC_ONEHAND, ICURS_GOTHIC_SHIELD, 5, UITYPE_GOTHSHIELD, "Gothic Shield", "Shield", 23, 60, 0, 0, 14, 18, 80, 0, 0, ISPL_NONE, IMISC_NONE, SPL_NULL, FALSE, 2300, 2700 }, - { IDROP_REGULAR, ICLASS_MISC, ILOC_UNEQUIPABLE, ICURS_POTION_OF_HEALING, 0, UITYPE_NONE, "Potion of Healing", NULL, 1, 0, 0, 0, 0, 0, 0, 0, 0, ISPL_NONE, IMISC_HEAL, SPL_NULL, TRUE, 50, 50 }, - { IDROP_REGULAR, ICLASS_MISC, ILOC_UNEQUIPABLE, ICURS_POTION_OF_FULL_HEALING, 0, UITYPE_NONE, "Potion of Full Healing", NULL, 1, 0, 0, 0, 0, 0, 0, 0, 0, ISPL_NONE, IMISC_FULLHEAL, SPL_NULL, TRUE, 150, 150 }, - { IDROP_REGULAR, ICLASS_MISC, ILOC_UNEQUIPABLE, ICURS_POTION_OF_MANA, 0, UITYPE_NONE, "Potion of Mana", NULL, 1, 0, 0, 0, 0, 0, 0, 0, 0, ISPL_NONE, IMISC_MANA, SPL_NULL, TRUE, 50, 50 }, - { IDROP_REGULAR, ICLASS_MISC, ILOC_UNEQUIPABLE, ICURS_POTION_OF_FULL_MANA, 0, UITYPE_NONE, "Potion of Full Mana", NULL, 1, 0, 0, 0, 0, 0, 0, 0, 0, ISPL_NONE, IMISC_FULLMANA, SPL_NULL, TRUE, 150, 150 }, - { IDROP_REGULAR, ICLASS_MISC, ILOC_UNEQUIPABLE, ICURS_POTION_OF_REJUVENATION, 0, UITYPE_NONE, "Potion of Rejuvenation", NULL, 3, 0, 0, 0, 0, 0, 0, 0, 0, ISPL_NONE, IMISC_REJUV, SPL_NULL, TRUE, 120, 120 }, - { IDROP_REGULAR, ICLASS_MISC, ILOC_UNEQUIPABLE, ICURS_POTION_OF_FULL_REJUVENATION, 0, UITYPE_NONE, "Potion of Full Rejuvenation", NULL, 7, 0, 0, 0, 0, 0, 0, 0, 0, ISPL_NONE, IMISC_FULLREJUV, SPL_NULL, TRUE, 600, 600 }, - { IDROP_REGULAR, ICLASS_MISC, ILOC_UNEQUIPABLE, ICURS_ELIXIR_OF_STRENGTH, 0, UITYPE_NONE, "Elixir of Strength", NULL, 15, 0, 0, 0, 0, 0, 0, 0, 0, ISPL_NONE, IMISC_ELIXSTR, SPL_NULL, TRUE, 5000, 5000 }, - { IDROP_REGULAR, ICLASS_MISC, ILOC_UNEQUIPABLE, ICURS_ELIXIR_OF_MAGIC, 0, UITYPE_NONE, "Elixir of Magic", NULL, 15, 0, 0, 0, 0, 0, 0, 0, 0, ISPL_NONE, IMISC_ELIXMAG, SPL_NULL, TRUE, 5000, 5000 }, - { IDROP_REGULAR, ICLASS_MISC, ILOC_UNEQUIPABLE, ICURS_ELIXIR_OF_DEXTERITY, 0, UITYPE_NONE, "Elixir of Dexterity", NULL, 15, 0, 0, 0, 0, 0, 0, 0, 0, ISPL_NONE, IMISC_ELIXDEX, SPL_NULL, TRUE, 5000, 5000 }, - { IDROP_REGULAR, ICLASS_MISC, ILOC_UNEQUIPABLE, ICURS_ELIXIR_OF_VITALITY, 0, UITYPE_NONE, "Elixir of Vitality", NULL, 20, 0, 0, 0, 0, 0, 0, 0, 0, ISPL_NONE, IMISC_ELIXVIT, SPL_NULL, TRUE, 5000, 5000 }, - { IDROP_REGULAR, ICLASS_MISC, ILOC_UNEQUIPABLE, ICURS_SCROLL_OF, 0, UITYPE_NONE, "Scroll of Healing", NULL, 1, 0, 0, 0, 0, 0, 0, 0, 0, ISPL_NONE, IMISC_SCROLL, SPL_HEAL, TRUE, 50, 50 }, - { IDROP_REGULAR, ICLASS_MISC, ILOC_UNEQUIPABLE, ICURS_SCROLL_OF, 0, UITYPE_NONE, "Scroll of Lightning", NULL, 4, 0, 0, 0, 0, 0, 0, 0, 0, ISPL_NONE, IMISC_SCROLLT, SPL_LIGHTNING, TRUE, 150, 150 }, - { IDROP_REGULAR, ICLASS_MISC, ILOC_UNEQUIPABLE, ICURS_SCROLL_OF, 0, UITYPE_NONE, "Scroll of Identify", NULL, 1, 0, 0, 0, 0, 0, 0, 0, 0, ISPL_NONE, IMISC_SCROLL, SPL_IDENTIFY, TRUE, 100, 100 }, - { IDROP_REGULAR, ICLASS_MISC, ILOC_UNEQUIPABLE, ICURS_SCROLL_OF, 0, UITYPE_NONE, "Scroll of Resurrect", NULL, 1, 0, 0, 0, 0, 0, 0, 0, 0, ISPL_NONE, IMISC_SCROLLT, SPL_RESURRECT, TRUE, 250, 250 }, - { IDROP_REGULAR, ICLASS_MISC, ILOC_UNEQUIPABLE, ICURS_SCROLL_OF, 0, UITYPE_NONE, "Scroll of Fire Wall", NULL, 4, 0, 0, 0, 0, 0, 0, 17, 0, ISPL_NONE, IMISC_SCROLLT, SPL_FIREWALL, TRUE, 400, 400 }, - { IDROP_REGULAR, ICLASS_MISC, ILOC_UNEQUIPABLE, ICURS_SCROLL_OF, 0, UITYPE_NONE, "Scroll of Inferno", NULL, 1, 0, 0, 0, 0, 0, 0, 19, 0, ISPL_NONE, IMISC_SCROLLT, SPL_FLAME, TRUE, 100, 100 }, - { IDROP_REGULAR, ICLASS_MISC, ILOC_UNEQUIPABLE, ICURS_SCROLL_OF, 0, UITYPE_NONE, "Scroll of Town Portal", NULL, 4, 0, 0, 0, 0, 0, 0, 0, 0, ISPL_NONE, IMISC_SCROLL, SPL_TOWN, TRUE, 200, 200 }, - { IDROP_REGULAR, ICLASS_MISC, ILOC_UNEQUIPABLE, ICURS_SCROLL_OF, 0, UITYPE_NONE, "Scroll of Flash", NULL, 6, 0, 0, 0, 0, 0, 0, 21, 0, ISPL_NONE, IMISC_SCROLLT, SPL_FLASH, TRUE, 500, 500 }, - { IDROP_REGULAR, ICLASS_MISC, ILOC_UNEQUIPABLE, ICURS_SCROLL_OF, 0, UITYPE_NONE, "Scroll of Infravision", NULL, 8, 0, 0, 0, 0, 0, 0, 23, 0, ISPL_NONE, IMISC_SCROLL, SPL_INFRA, TRUE, 600, 600 }, - { IDROP_REGULAR, ICLASS_MISC, ILOC_UNEQUIPABLE, ICURS_SCROLL_OF, 0, UITYPE_NONE, "Scroll of Phasing", NULL, 6, 0, 0, 0, 0, 0, 0, 25, 0, ISPL_NONE, IMISC_SCROLL, SPL_RNDTELEPORT, TRUE, 200, 200 }, - { IDROP_REGULAR, ICLASS_MISC, ILOC_UNEQUIPABLE, ICURS_SCROLL_OF, 0, UITYPE_NONE, "Scroll of Mana Shield", NULL, 8, 0, 0, 0, 0, 0, 0, 0, 0, ISPL_NONE, IMISC_SCROLL, SPL_MANASHIELD, TRUE, 1200, 1200 }, - { IDROP_REGULAR, ICLASS_MISC, ILOC_UNEQUIPABLE, ICURS_SCROLL_OF, 0, UITYPE_NONE, "Scroll of Flame Wave", NULL, 10, 0, 0, 0, 0, 0, 0, 29, 0, ISPL_NONE, IMISC_SCROLLT, SPL_WAVE, TRUE, 650, 650 }, - { IDROP_REGULAR, ICLASS_MISC, ILOC_UNEQUIPABLE, ICURS_SCROLL_OF, 0, UITYPE_NONE, "Scroll of Fireball", NULL, 8, 0, 0, 0, 0, 0, 0, 31, 0, ISPL_NONE, IMISC_SCROLLT, SPL_FIREBALL, TRUE, 300, 300 }, - { IDROP_REGULAR, ICLASS_MISC, ILOC_UNEQUIPABLE, ICURS_SCROLL_OF, 0, UITYPE_NONE, "Scroll of Stone Curse", NULL, 6, 0, 0, 0, 0, 0, 0, 33, 0, ISPL_NONE, IMISC_SCROLLT, SPL_STONE, TRUE, 800, 800 }, - { IDROP_REGULAR, ICLASS_MISC, ILOC_UNEQUIPABLE, ICURS_SCROLL_OF, 0, UITYPE_NONE, "Scroll of Chain Lightning", NULL, 10, 0, 0, 0, 0, 0, 0, 35, 0, ISPL_NONE, IMISC_SCROLLT, SPL_CHAIN, TRUE, 750, 750 }, - { IDROP_REGULAR, ICLASS_MISC, ILOC_UNEQUIPABLE, ICURS_SCROLL_OF, 0, UITYPE_NONE, "Scroll of Guardian", NULL, 12, 0, 0, 0, 0, 0, 0, 47, 0, ISPL_NONE, IMISC_SCROLLT, SPL_GUARDIAN, TRUE, 950, 950 }, - { IDROP_NEVER, ICLASS_MISC, ILOC_UNEQUIPABLE, ICURS_SCROLL_OF, 0, UITYPE_NONE, "Non Item", NULL, 0, 0, 0, 0, 0, 0, 0, 0, 0, ISPL_NONE, IMISC_NONE, SPL_NULL, FALSE, 0, 0 }, - { IDROP_REGULAR, ICLASS_MISC, ILOC_UNEQUIPABLE, ICURS_SCROLL_OF, 0, UITYPE_NONE, "Scroll of Nova", NULL, 14, 0, 0, 0, 0, 0, 0, 57, 0, ISPL_NONE, IMISC_SCROLL, SPL_NOVA, TRUE, 1300, 1300 }, - { IDROP_REGULAR, ICLASS_MISC, ILOC_UNEQUIPABLE, ICURS_SCROLL_OF, 0, UITYPE_NONE, "Scroll of Golem", NULL, 10, 0, 0, 0, 0, 0, 0, 51, 0, ISPL_NONE, IMISC_SCROLLT, SPL_GOLEM, TRUE, 1100, 1100 }, - { IDROP_NEVER, ICLASS_MISC, ILOC_UNEQUIPABLE, ICURS_SCROLL_OF, 0, UITYPE_NONE, "Scroll of None", NULL, 99, 0, 0, 0, 0, 0, 0, 61, 0, ISPL_NONE, IMISC_SCROLLT, SPL_NULL, TRUE, 1000, 1000 }, - { IDROP_REGULAR, ICLASS_MISC, ILOC_UNEQUIPABLE, ICURS_SCROLL_OF, 0, UITYPE_NONE, "Scroll of Teleport", NULL, 14, 0, 0, 0, 0, 0, 0, 81, 0, ISPL_NONE, IMISC_SCROLL, SPL_TELEPORT, TRUE, 3000, 3000 }, - { IDROP_REGULAR, ICLASS_MISC, ILOC_UNEQUIPABLE, ICURS_SCROLL_OF, 0, UITYPE_NONE, "Scroll of Apocalypse", NULL, 22, 0, 0, 0, 0, 0, 0, 117, 0, ISPL_NONE, IMISC_SCROLL, SPL_APOCA, TRUE, 2000, 2000 }, - { IDROP_REGULAR, ICLASS_MISC, ILOC_UNEQUIPABLE, ICURS_BOOK_BLUE, 0, UITYPE_NONE, "Book of ", NULL, 2, 0, 0, 0, 0, 0, 0, 0, 0, ISPL_NONE, IMISC_BOOK, SPL_NULL, TRUE, 0, 0 }, - { IDROP_REGULAR, ICLASS_MISC, ILOC_UNEQUIPABLE, ICURS_BOOK_BLUE, 0, UITYPE_NONE, "Book of ", NULL, 8, 0, 0, 0, 0, 0, 0, 0, 0, ISPL_NONE, IMISC_BOOK, SPL_NULL, TRUE, 0, 0 }, - { IDROP_REGULAR, ICLASS_MISC, ILOC_UNEQUIPABLE, ICURS_BOOK_BLUE, 0, UITYPE_NONE, "Book of ", NULL, 14, 0, 0, 0, 0, 0, 0, 0, 0, ISPL_NONE, IMISC_BOOK, SPL_NULL, TRUE, 0, 0 }, - { IDROP_REGULAR, ICLASS_MISC, ILOC_UNEQUIPABLE, ICURS_BOOK_BLUE, 0, UITYPE_NONE, "Book of ", NULL, 20, 0, 0, 0, 0, 0, 0, 0, 0, ISPL_NONE, IMISC_BOOK, SPL_NULL, TRUE, 0, 0 }, - { IDROP_REGULAR, ICLASS_WEAPON, ILOC_ONEHAND, ICURS_DAGGER, 1, UITYPE_DAGGER, "Dagger", "Dagger", 1, 16, 1, 4, 0, 0, 0, 0, 0, ISPL_NONE, IMISC_NONE, SPL_NULL, FALSE, 60, 60 }, - { IDROP_REGULAR, ICLASS_WEAPON, ILOC_ONEHAND, ICURS_SHORT_SWORD, 1, UITYPE_NONE, "Short Sword", "Sword", 1, 24, 2, 6, 0, 0, 18, 0, 0, ISPL_NONE, IMISC_NONE, SPL_NULL, FALSE, 120, 120 }, - { IDROP_REGULAR, ICLASS_WEAPON, ILOC_ONEHAND, ICURS_FALCHION, 1, UITYPE_FALCHION, "Falchion", "Sword", 2, 20, 4, 8, 0, 0, 30, 0, 0, ISPL_NONE, IMISC_NONE, SPL_NULL, FALSE, 250, 250 }, - { IDROP_REGULAR, ICLASS_WEAPON, ILOC_ONEHAND, ICURS_SCIMITAR, 1, UITYPE_SCIMITAR, "Scimitar", "Sword", 4, 28, 3, 7, 0, 0, 23, 0, 23, ISPL_NONE, IMISC_NONE, SPL_NULL, FALSE, 200, 200 }, - { IDROP_REGULAR, ICLASS_WEAPON, ILOC_ONEHAND, ICURS_CLAYMORE, 1, UITYPE_CLAYMORE, "Claymore", "Sword", 5, 36, 1, 12, 0, 0, 35, 0, 0, ISPL_NONE, IMISC_NONE, SPL_NULL, FALSE, 450, 450 }, - { IDROP_REGULAR, ICLASS_WEAPON, ILOC_ONEHAND, ICURS_BLADE, 1, UITYPE_NONE, "Blade", "Blade", 4, 30, 3, 8, 0, 0, 25, 0, 30, ISPL_NONE, IMISC_NONE, SPL_NULL, FALSE, 280, 280 }, - { IDROP_REGULAR, ICLASS_WEAPON, ILOC_ONEHAND, ICURS_SABRE, 1, UITYPE_SABRE, "Sabre", "Sabre", 1, 45, 1, 8, 0, 0, 17, 0, 0, ISPL_NONE, IMISC_NONE, SPL_NULL, FALSE, 170, 170 }, - { IDROP_REGULAR, ICLASS_WEAPON, ILOC_ONEHAND, ICURS_LONG_SWORD, 1, UITYPE_LONGSWR, "Long Sword", "Sword", 6, 40, 2, 10, 0, 0, 30, 0, 30, ISPL_NONE, IMISC_NONE, SPL_NULL, FALSE, 350, 350 }, - { IDROP_REGULAR, ICLASS_WEAPON, ILOC_ONEHAND, ICURS_BROAD_SWORD, 1, UITYPE_BROADSWR, "Broad Sword", "Sword", 8, 50, 4, 12, 0, 0, 40, 0, 0, ISPL_NONE, IMISC_NONE, SPL_NULL, FALSE, 750, 750 }, - { IDROP_REGULAR, ICLASS_WEAPON, ILOC_ONEHAND, ICURS_BASTARD_SWORD, 1, UITYPE_BASTARDSWR, "Bastard Sword", "Sword", 10, 60, 6, 15, 0, 0, 50, 0, 0, ISPL_NONE, IMISC_NONE, SPL_NULL, FALSE, 1000, 1000 }, - { IDROP_REGULAR, ICLASS_WEAPON, ILOC_TWOHAND, ICURS_TWO_HANDED_SWORD, 1, UITYPE_TWOHANDSWR, "Two-Handed Sword", "Sword", 14, 75, 8, 16, 0, 0, 65, 0, 0, ISPL_NONE, IMISC_NONE, SPL_NULL, FALSE, 1800, 1800 }, - { IDROP_REGULAR, ICLASS_WEAPON, ILOC_TWOHAND, ICURS_GREAT_SWORD, 1, UITYPE_GREATSWR, "Great Sword", "Sword", 17, 100, 10, 20, 0, 0, 75, 0, 0, ISPL_NONE, IMISC_NONE, SPL_NULL, FALSE, 3000, 3000 }, - { IDROP_REGULAR, ICLASS_WEAPON, ILOC_TWOHAND, ICURS_SMALL_AXE, 2, UITYPE_SMALLAXE, "Small Axe", "Axe", 2, 24, 2, 10, 0, 0, 0, 0, 0, ISPL_NONE, IMISC_NONE, SPL_NULL, FALSE, 150, 150 }, - { IDROP_REGULAR, ICLASS_WEAPON, ILOC_TWOHAND, ICURS_AXE, 2, UITYPE_NONE, "Axe", "Axe", 4, 32, 4, 12, 0, 0, 22, 0, 0, ISPL_NONE, IMISC_NONE, SPL_NULL, FALSE, 450, 450 }, - { IDROP_REGULAR, ICLASS_WEAPON, ILOC_TWOHAND, ICURS_LARGE_AXE, 2, UITYPE_LARGEAXE, "Large Axe", "Axe", 6, 40, 6, 16, 0, 0, 30, 0, 0, ISPL_NONE, IMISC_NONE, SPL_NULL, FALSE, 750, 750 }, - { IDROP_REGULAR, ICLASS_WEAPON, ILOC_TWOHAND, ICURS_BROAD_AXE, 2, UITYPE_BROADAXE, "Broad Axe", "Axe", 8, 50, 8, 20, 0, 0, 50, 0, 0, ISPL_NONE, IMISC_NONE, SPL_NULL, FALSE, 1000, 1000 }, - { IDROP_REGULAR, ICLASS_WEAPON, ILOC_TWOHAND, ICURS_BATTLE_AXE, 2, UITYPE_BATTLEAXE, "Battle Axe", "Axe", 10, 60, 10, 25, 0, 0, 65, 0, 0, ISPL_NONE, IMISC_NONE, SPL_NULL, FALSE, 1500, 1500 }, - { IDROP_REGULAR, ICLASS_WEAPON, ILOC_TWOHAND, ICURS_GREAT_AXE, 2, UITYPE_GREATAXE, "Great Axe", "Axe", 12, 75, 12, 30, 0, 0, 80, 0, 0, ISPL_NONE, IMISC_NONE, SPL_NULL, FALSE, 2500, 2500 }, - { IDROP_REGULAR, ICLASS_WEAPON, ILOC_ONEHAND, ICURS_MACE, 4, UITYPE_MACE, "Mace", "Mace", 2, 32, 1, 8, 0, 0, 16, 0, 0, ISPL_NONE, IMISC_NONE, SPL_NULL, FALSE, 200, 200 }, - { IDROP_REGULAR, ICLASS_WEAPON, ILOC_ONEHAND, ICURS_MORNING_STAR, 4, UITYPE_MORNSTAR, "Morning Star", "Mace", 3, 40, 1, 10, 0, 0, 26, 0, 0, ISPL_NONE, IMISC_NONE, SPL_NULL, FALSE, 300, 300 }, - { IDROP_REGULAR, ICLASS_WEAPON, ILOC_ONEHAND, ICURS_WAR_HAMMER, 4, UITYPE_WARHAMMER, "War Hammer", "Hammer", 5, 50, 5, 9, 0, 0, 40, 0, 0, ISPL_NONE, IMISC_NONE, SPL_NULL, FALSE, 600, 600 }, - { IDROP_REGULAR, ICLASS_WEAPON, ILOC_ONEHAND, ICURS_SPIKED_CLUB, 4, UITYPE_SPIKCLUB, "Spiked Club", "Club", 4, 20, 3, 6, 0, 0, 18, 0, 0, ISPL_NONE, IMISC_NONE, SPL_NULL, FALSE, 225, 225 }, - { IDROP_REGULAR, ICLASS_WEAPON, ILOC_ONEHAND, ICURS_CLUB, 4, UITYPE_SPIKCLUB, "Club", "Club", 1, 20, 1, 6, 0, 0, 0, 0, 0, ISPL_NONE, IMISC_NONE, SPL_NULL, FALSE, 20, 20 }, - { IDROP_REGULAR, ICLASS_WEAPON, ILOC_ONEHAND, ICURS_FLAIL, 4, UITYPE_FLAIL, "Flail", "Flail", 7, 36, 2, 12, 0, 0, 30, 0, 0, ISPL_NONE, IMISC_NONE, SPL_NULL, FALSE, 500, 500 }, - { IDROP_REGULAR, ICLASS_WEAPON, ILOC_TWOHAND, ICURS_MAUL, 4, UITYPE_MAUL, "Maul", "Maul", 10, 50, 6, 20, 0, 0, 55, 0, 0, ISPL_NONE, IMISC_NONE, SPL_NULL, FALSE, 900, 900 }, - { IDROP_DOUBLE, ICLASS_WEAPON, ILOC_TWOHAND, ICURS_SHORT_BOW, 3, UITYPE_SHORTBOW, "Short Bow", "Bow", 1, 30, 1, 4, 0, 0, 0, 0, 0, ISPL_NONE, IMISC_NONE, SPL_NULL, FALSE, 100, 100 }, - { IDROP_DOUBLE, ICLASS_WEAPON, ILOC_TWOHAND, ICURS_HUNTERS_BOW, 3, UITYPE_HUNTBOW, "Hunter's Bow", "Bow", 3, 40, 2, 5, 0, 0, 20, 0, 35, ISPL_NONE, IMISC_NONE, SPL_NULL, FALSE, 350, 350 }, - { IDROP_DOUBLE, ICLASS_WEAPON, ILOC_TWOHAND, ICURS_HUNTERS_BOW, 3, UITYPE_LONGBOW, "Long Bow", "Bow", 5, 35, 1, 6, 0, 0, 25, 0, 30, ISPL_NONE, IMISC_NONE, SPL_NULL, FALSE, 250, 250 }, - { IDROP_DOUBLE, ICLASS_WEAPON, ILOC_TWOHAND, ICURS_COMPOSITE_BOW, 3, UITYPE_COMPBOW, "Composite Bow", "Bow", 7, 45, 3, 6, 0, 0, 25, 0, 40, ISPL_NONE, IMISC_NONE, SPL_NULL, FALSE, 600, 600 }, - { IDROP_DOUBLE, ICLASS_WEAPON, ILOC_TWOHAND, ICURS_SHORT_BATTLE_BOW, 3, UITYPE_NONE, "Short Battle Bow", "Bow", 9, 45, 3, 7, 0, 0, 30, 0, 50, ISPL_NONE, IMISC_NONE, SPL_NULL, FALSE, 750, 750 }, - { IDROP_DOUBLE, ICLASS_WEAPON, ILOC_TWOHAND, ICURS_LONG_WAR_BOW, 3, UITYPE_BATTLEBOW, "Long Battle Bow", "Bow", 11, 50, 1, 10, 0, 0, 30, 0, 60, ISPL_NONE, IMISC_NONE, SPL_NULL, FALSE, 1000, 1000 }, - { IDROP_DOUBLE, ICLASS_WEAPON, ILOC_TWOHAND, ICURS_SHORT_WAR_BOW, 3, UITYPE_NONE, "Short War Bow", "Bow", 15, 55, 4, 8, 0, 0, 35, 0, 70, ISPL_NONE, IMISC_NONE, SPL_NULL, FALSE, 1500, 1500 }, - { IDROP_DOUBLE, ICLASS_WEAPON, ILOC_TWOHAND, ICURS_LONG_WAR_BOW, 3, UITYPE_WARBOW, "Long War Bow", "Bow", 19, 60, 1, 14, 0, 0, 45, 0, 80, ISPL_NONE, IMISC_NONE, SPL_NULL, FALSE, 2000, 2000 }, - { IDROP_REGULAR, ICLASS_WEAPON, ILOC_TWOHAND, ICURS_SHORT_STAFF, 10, UITYPE_SHORTSTAFF, "Short Staff", "Staff", 1, 25, 2, 4, 0, 0, 0, 0, 0, ISPL_NONE, IMISC_STAFF, SPL_NULL, FALSE, 30, 30 }, - { IDROP_REGULAR, ICLASS_WEAPON, ILOC_TWOHAND, ICURS_LONG_STAFF, 10, UITYPE_LONGSTAFF, "Long Staff", "Staff", 4, 35, 4, 8, 0, 0, 0, 0, 0, ISPL_NONE, IMISC_STAFF, SPL_NULL, FALSE, 100, 100 }, - { IDROP_REGULAR, ICLASS_WEAPON, ILOC_TWOHAND, ICURS_COMPOSITE_STAFF, 10, UITYPE_COMPSTAFF, "Composite Staff", "Staff", 6, 45, 5, 10, 0, 0, 0, 0, 0, ISPL_NONE, IMISC_STAFF, SPL_NULL, FALSE, 500, 500 }, - { IDROP_REGULAR, ICLASS_WEAPON, ILOC_TWOHAND, ICURS_SHORT_STAFF, 10, UITYPE_QUARSTAFF, "Quarter Staff", "Staff", 9, 55, 6, 12, 0, 0, 20, 0, 0, ISPL_NONE, IMISC_STAFF, SPL_NULL, FALSE, 1000, 1000 }, - { IDROP_REGULAR, ICLASS_WEAPON, ILOC_TWOHAND, ICURS_WAR_STAFF, 10, UITYPE_WARSTAFF, "War Staff", "Staff", 12, 75, 8, 16, 0, 0, 30, 0, 0, ISPL_NONE, IMISC_STAFF, SPL_NULL, FALSE, 1500, 1500 }, - { IDROP_REGULAR, ICLASS_MISC, ILOC_RING, ICURS_RING, 12, UITYPE_RING, "Ring", "Ring", 5, 0, 0, 0, 0, 0, 0, 0, 0, ISPL_NONE, IMISC_RING, SPL_NULL, FALSE, 1000, 1000 }, - { IDROP_REGULAR, ICLASS_MISC, ILOC_RING, ICURS_RING, 12, UITYPE_RING, "Ring", "Ring", 10, 0, 0, 0, 0, 0, 0, 0, 0, ISPL_NONE, IMISC_RING, SPL_NULL, FALSE, 1000, 1000 }, - { IDROP_REGULAR, ICLASS_MISC, ILOC_RING, ICURS_RING, 12, UITYPE_RING, "Ring", "Ring", 15, 0, 0, 0, 0, 0, 0, 0, 0, ISPL_NONE, IMISC_RING, SPL_NULL, FALSE, 1000, 1000 }, - { IDROP_REGULAR, ICLASS_MISC, ILOC_AMULET, ICURS_AMULET, 13, UITYPE_AMULET, "Amulet", "Amulet", 8, 0, 0, 0, 0, 0, 0, 0, 0, ISPL_NONE, IMISC_AMULET, SPL_NULL, FALSE, 1200, 1200 }, - { IDROP_REGULAR, ICLASS_MISC, ILOC_AMULET, ICURS_AMULET, 13, UITYPE_AMULET, "Amulet", "Amulet", 16, 0, 0, 0, 0, 0, 0, 0, 0, ISPL_NONE, IMISC_AMULET, SPL_NULL, FALSE, 1200, 1200 }, - { IDROP_NEVER, ICLASS_NONE, ILOC_INVALID, ICURS_POTION_OF_FULL_MANA, 0, UITYPE_NONE, NULL, NULL, 0, 0, 0, 0, 0, 0, 0, 0, 0, ISPL_NONE, IMISC_NONE, SPL_NULL, FALSE, 0, 0 } - // clang-format on -}; - -const PLStruct PL_Prefix[84] = { - // clang-format off - // PLName, PLPower, PLParam1, PLParam2, PLMinLvl, PLIType, PLGOE, PLDouble, PLOk, PLMinVal, PLMaxVal, PLMultVal - { "Tin", IPL_TOHIT_CURSE, 6, 10, 3, PLT_WEAP | PLT_BOW | PLT_MISC, 0, TRUE, FALSE, 0, 0, -3 }, - { "Brass", IPL_TOHIT_CURSE, 1, 5, 1, PLT_WEAP | PLT_BOW | PLT_MISC, 0, TRUE, FALSE, 0, 0, -2 }, - { "Bronze", IPL_TOHIT, 1, 5, 1, PLT_WEAP | PLT_BOW | PLT_MISC, 0, TRUE, TRUE, 100, 500, 2 }, - { "Iron", IPL_TOHIT, 6, 10, 4, PLT_WEAP | PLT_BOW | PLT_MISC, 0, TRUE, TRUE, 600, 1000, 3 }, - { "Steel", IPL_TOHIT, 11, 15, 6, PLT_WEAP | PLT_BOW | PLT_MISC, 0, TRUE, TRUE, 1100, 1500, 5 }, - { "Silver", IPL_TOHIT, 16, 20, 9, PLT_WEAP | PLT_BOW | PLT_MISC, 16, TRUE, TRUE, 1600, 2000, 7 }, - { "Gold", IPL_TOHIT, 21, 30, 12, PLT_WEAP | PLT_BOW | PLT_MISC, 16, TRUE, TRUE, 2100, 3000, 9 }, - { "Platinum", IPL_TOHIT, 31, 40, 16, PLT_WEAP | PLT_BOW , 16, TRUE, TRUE, 3100, 4000, 11 }, - { "Mithril", IPL_TOHIT, 41, 60, 20, PLT_WEAP | PLT_BOW , 16, TRUE, TRUE, 4100, 6000, 13 }, - { "Meteoric", IPL_TOHIT, 61, 80, 23, PLT_WEAP | PLT_BOW , 0, TRUE, TRUE, 6100, 10000, 15 }, - { "Weird", IPL_TOHIT, 81, 100, 35, PLT_WEAP | PLT_BOW , 0, TRUE, TRUE, 10100, 14000, 17 }, - { "Strange", IPL_TOHIT, 101, 150, 60, PLT_WEAP | PLT_BOW , 0, TRUE, TRUE, 14100, 20000, 20 }, - { "Useless", IPL_DAMP_CURSE, 100, 100, 5, PLT_WEAP | PLT_BOW , 0, TRUE, FALSE, 0, 0, -8 }, - { "Bent", IPL_DAMP_CURSE, 50, 75, 3, PLT_WEAP | PLT_BOW , 0, TRUE, FALSE, 0, 0, -4 }, - { "Weak", IPL_DAMP_CURSE, 25, 45, 1, PLT_WEAP | PLT_BOW , 0, TRUE, FALSE, 0, 0, -3 }, - { "Jagged", IPL_DAMP, 20, 35, 4, PLT_WEAP | PLT_BOW , 0, TRUE, TRUE, 250, 450, 3 }, - { "Deadly", IPL_DAMP, 36, 50, 6, PLT_WEAP | PLT_BOW , 0, TRUE, TRUE, 500, 700, 4 }, - { "Heavy", IPL_DAMP, 51, 65, 9, PLT_WEAP | PLT_BOW , 0, TRUE, TRUE, 750, 950, 5 }, - { "Vicious", IPL_DAMP, 66, 80, 12, PLT_WEAP | PLT_BOW , 1, TRUE, TRUE, 1000, 1450, 8 }, - { "Brutal", IPL_DAMP, 81, 95, 16, PLT_WEAP | PLT_BOW , 0, TRUE, TRUE, 1500, 1950, 10 }, - { "Massive", IPL_DAMP, 96, 110, 20, PLT_WEAP | PLT_BOW , 0, TRUE, TRUE, 2000, 2450, 13 }, - { "Savage", IPL_DAMP, 111, 125, 23, PLT_WEAP | PLT_BOW , 0, TRUE, TRUE, 2500, 3000, 15 }, - { "Ruthless", IPL_DAMP, 126, 150, 35, PLT_WEAP | PLT_BOW , 0, TRUE, TRUE, 10100, 15000, 17 }, - { "Merciless", IPL_DAMP, 151, 175, 60, PLT_WEAP | PLT_BOW , 0, TRUE, TRUE, 15000, 20000, 20 }, - { "Clumsy", IPL_TOHIT_DAMP_CURSE, 50, 75, 5, PLT_WEAP | PLT_STAFF | PLT_BOW , 0, TRUE, FALSE, 0, 0, -7 }, - { "Dull", IPL_TOHIT_DAMP_CURSE, 25, 45, 1, PLT_WEAP | PLT_STAFF | PLT_BOW , 0, TRUE, FALSE, 0, 0, -5 }, - { "Sharp", IPL_TOHIT_DAMP, 20, 35, 1, PLT_WEAP | PLT_STAFF | PLT_BOW , 0, TRUE, FALSE, 350, 950, 5 }, - { "Fine", IPL_TOHIT_DAMP, 36, 50, 6, PLT_WEAP | PLT_STAFF | PLT_BOW , 0, TRUE, TRUE, 1100, 1700, 7 }, - { "Warrior's", IPL_TOHIT_DAMP, 51, 65, 10, PLT_WEAP | PLT_STAFF | PLT_BOW , 0, TRUE, TRUE, 1850, 2450, 13 }, - { "Soldier's", IPL_TOHIT_DAMP, 66, 80, 15, PLT_WEAP | PLT_STAFF , 0, TRUE, TRUE, 2600, 3950, 17 }, - { "Lord's", IPL_TOHIT_DAMP, 81, 95, 19, PLT_WEAP | PLT_STAFF , 0, TRUE, TRUE, 4100, 5950, 21 }, - { "Knight's", IPL_TOHIT_DAMP, 96, 110, 23, PLT_WEAP | PLT_STAFF , 0, TRUE, TRUE, 6100, 8450, 26 }, - { "Master's", IPL_TOHIT_DAMP, 111, 125, 28, PLT_WEAP | PLT_STAFF , 0, TRUE, TRUE, 8600, 13000, 30 }, - { "Champion's", IPL_TOHIT_DAMP, 126, 150, 40, PLT_WEAP | PLT_STAFF , 0, TRUE, TRUE, 15200, 24000, 33 }, - { "King's", IPL_TOHIT_DAMP, 151, 175, 28, PLT_WEAP | PLT_STAFF , 0, TRUE, TRUE, 24100, 35000, 38 }, - { "Vulnerable", IPL_ACP_CURSE, 51, 100, 3, PLT_ARMO | PLT_SHLD , 0, TRUE, FALSE, 0, 0, -3 }, - { "Rusted", IPL_ACP_CURSE, 25, 50, 1, PLT_ARMO | PLT_SHLD , 0, TRUE, FALSE, 0, 0, -2 }, - { "Fine", IPL_ACP, 20, 30, 1, PLT_ARMO | PLT_SHLD , 0, TRUE, TRUE, 20, 100, 2 }, - { "Strong", IPL_ACP, 31, 40, 3, PLT_ARMO | PLT_SHLD , 0, TRUE, TRUE, 120, 200, 3 }, - { "Grand", IPL_ACP, 41, 55, 6, PLT_ARMO | PLT_SHLD , 0, TRUE, TRUE, 220, 300, 5 }, - { "Valiant", IPL_ACP, 56, 70, 10, PLT_ARMO | PLT_SHLD , 0, TRUE, TRUE, 320, 400, 7 }, - { "Glorious", IPL_ACP, 71, 90, 14, PLT_ARMO | PLT_SHLD , 16, TRUE, TRUE, 420, 600, 9 }, - { "Blessed", IPL_ACP, 91, 110, 19, PLT_ARMO | PLT_SHLD , 16, TRUE, TRUE, 620, 800, 11 }, - { "Saintly", IPL_ACP, 111, 130, 24, PLT_ARMO | PLT_SHLD , 16, TRUE, TRUE, 820, 1200, 13 }, - { "Awesome", IPL_ACP, 131, 150, 28, PLT_ARMO | PLT_SHLD , 16, TRUE, TRUE, 1220, 2000, 15 }, - { "Holy", IPL_ACP, 151, 170, 35, PLT_ARMO | PLT_SHLD , 16, TRUE, TRUE, 5200, 6000, 17 }, - { "Godly", IPL_ACP, 171, 200, 60, PLT_ARMO | PLT_SHLD , 16, TRUE, TRUE, 6200, 7000, 20 }, - { "Red", IPL_FIRERES, 10, 20, 4, PLT_ARMO | PLT_SHLD | PLT_WEAP | PLT_STAFF | PLT_BOW | PLT_MISC, 0, FALSE, TRUE, 500, 1500, 2 }, - { "Crimson", IPL_FIRERES, 21, 30, 10, PLT_ARMO | PLT_SHLD | PLT_WEAP | PLT_STAFF | PLT_BOW | PLT_MISC, 0, FALSE, TRUE, 2100, 3000, 2 }, - { "Crimson", IPL_FIRERES, 31, 40, 16, PLT_ARMO | PLT_SHLD | PLT_WEAP | PLT_STAFF | PLT_BOW | PLT_MISC, 0, FALSE, TRUE, 3100, 4000, 2 }, - { "Garnet", IPL_FIRERES, 41, 50, 20, PLT_ARMO | PLT_SHLD | PLT_WEAP | PLT_STAFF | PLT_BOW | PLT_MISC, 0, FALSE, TRUE, 8200, 12000, 3 }, - { "Ruby", IPL_FIRERES, 51, 60, 26, PLT_ARMO | PLT_SHLD | PLT_WEAP | PLT_STAFF | PLT_BOW | PLT_MISC, 0, FALSE, TRUE, 17100, 20000, 5 }, - { "Blue", IPL_LIGHTRES, 10, 20, 4, PLT_ARMO | PLT_SHLD | PLT_WEAP | PLT_STAFF | PLT_BOW | PLT_MISC, 0, FALSE, TRUE, 500, 1500, 2 }, - { "Azure", IPL_LIGHTRES, 21, 30, 10, PLT_ARMO | PLT_SHLD | PLT_WEAP | PLT_STAFF | PLT_BOW | PLT_MISC, 0, FALSE, TRUE, 2100, 3000, 2 }, - { "Lapis", IPL_LIGHTRES, 31, 40, 16, PLT_ARMO | PLT_SHLD | PLT_WEAP | PLT_STAFF | PLT_BOW | PLT_MISC, 0, FALSE, TRUE, 3100, 4000, 2 }, - { "Cobalt", IPL_LIGHTRES, 41, 50, 20, PLT_ARMO | PLT_SHLD | PLT_WEAP | PLT_STAFF | PLT_BOW | PLT_MISC, 0, FALSE, TRUE, 8200, 12000, 3 }, - { "Sapphire", IPL_LIGHTRES, 51, 60, 26, PLT_ARMO | PLT_SHLD | PLT_WEAP | PLT_STAFF | PLT_BOW | PLT_MISC, 0, FALSE, TRUE, 17100, 20000, 5 }, - { "White", IPL_MAGICRES, 10, 20, 4, PLT_ARMO | PLT_SHLD | PLT_WEAP | PLT_STAFF | PLT_BOW | PLT_MISC, 0, FALSE, TRUE, 500, 1500, 2 }, - { "Pearl", IPL_MAGICRES, 21, 30, 10, PLT_ARMO | PLT_SHLD | PLT_WEAP | PLT_STAFF | PLT_BOW | PLT_MISC, 0, FALSE, TRUE, 2100, 3000, 2 }, - { "Ivory", IPL_MAGICRES, 31, 40, 16, PLT_ARMO | PLT_SHLD | PLT_WEAP | PLT_STAFF | PLT_BOW | PLT_MISC, 0, FALSE, TRUE, 3100, 4000, 2 }, - { "Crystal", IPL_MAGICRES, 41, 50, 20, PLT_ARMO | PLT_SHLD | PLT_WEAP | PLT_STAFF | PLT_BOW | PLT_MISC, 0, FALSE, TRUE, 8200, 12000, 3 }, - { "Diamond", IPL_MAGICRES, 51, 60, 26, PLT_ARMO | PLT_SHLD | PLT_WEAP | PLT_STAFF | PLT_BOW | PLT_MISC, 0, FALSE, TRUE, 17100, 20000, 5 }, - { "Topaz", IPL_ALLRES, 10, 15, 8, PLT_ARMO | PLT_SHLD | PLT_WEAP | PLT_STAFF | PLT_BOW | PLT_MISC, 0, FALSE, TRUE, 2000, 5000, 3 }, - { "Amber", IPL_ALLRES, 16, 20, 12, PLT_ARMO | PLT_SHLD | PLT_WEAP | PLT_STAFF | PLT_BOW | PLT_MISC, 0, FALSE, TRUE, 7400, 10000, 3 }, - { "Jade", IPL_ALLRES, 21, 30, 18, PLT_ARMO | PLT_SHLD | PLT_WEAP | PLT_STAFF | PLT_BOW | PLT_MISC, 0, FALSE, TRUE, 11000, 15000, 3 }, - { "Obsidian", IPL_ALLRES, 31, 40, 24, PLT_ARMO | PLT_SHLD | PLT_WEAP | PLT_STAFF | PLT_BOW | PLT_MISC, 0, FALSE, TRUE, 24000, 40000, 4 }, - { "Emerald", IPL_ALLRES, 41, 50, 31, PLT_SHLD | PLT_WEAP | PLT_STAFF | PLT_BOW , 0, FALSE, TRUE, 61000, 75000, 7 }, - { "Hyena's", IPL_MANA_CURSE, 11, 25, 4, PLT_STAFF | PLT_MISC, 0, FALSE, FALSE, 100, 1000, -2 }, - { "Frog's", IPL_MANA_CURSE, 1, 10, 1, PLT_STAFF | PLT_MISC, 1, FALSE, FALSE, 0, 0, -2 }, - { "Spider's", IPL_MANA, 10, 15, 1, PLT_STAFF | PLT_MISC, 1, FALSE, TRUE, 500, 1000, 2 }, - { "Raven's", IPL_MANA, 15, 20, 5, PLT_STAFF | PLT_MISC, 0, FALSE, TRUE, 1100, 2000, 3 }, - { "Snake's", IPL_MANA, 21, 30, 9, PLT_STAFF | PLT_MISC, 0, FALSE, TRUE, 2100, 4000, 5 }, - { "Serpent's", IPL_MANA, 30, 40, 15, PLT_STAFF | PLT_MISC, 0, FALSE, TRUE, 4100, 6000, 7 }, - { "Drake's", IPL_MANA, 41, 50, 21, PLT_STAFF | PLT_MISC, 0, FALSE, TRUE, 6100, 10000, 9 }, - { "Dragon's", IPL_MANA, 51, 60, 27, PLT_STAFF | PLT_MISC, 0, FALSE, TRUE, 10100, 15000, 11 }, - { "Wyrm's", IPL_MANA, 61, 80, 35, PLT_STAFF , 0, FALSE, TRUE, 15100, 19000, 12 }, - { "Hydra's", IPL_MANA, 81, 100, 60, PLT_STAFF , 0, FALSE, TRUE, 19100, 30000, 13 }, - { "Angel's", IPL_SPLLVLADD, 1, 1, 15, PLT_STAFF , 16, FALSE, TRUE, 25000, 25000, 2 }, - { "Arch-Angel's", IPL_SPLLVLADD, 2, 2, 25, PLT_STAFF , 16, FALSE, TRUE, 50000, 50000, 3 }, - { "Plentiful", IPL_CHARGES, 2, 2, 4, PLT_STAFF , 0, FALSE, TRUE, 2000, 2000, 2 }, - { "Bountiful", IPL_CHARGES, 3, 3, 9, PLT_STAFF , 0, FALSE, TRUE, 3000, 3000, 3 }, - { "Flaming", IPL_FIREDAM, 1, 10, 7, PLT_WEAP | PLT_STAFF , 0, FALSE, TRUE, 5000, 5000, 2 }, - { "Lightning", IPL_LIGHTDAM, 2, 20, 18, PLT_WEAP | PLT_STAFF , 0, FALSE, TRUE, 10000, 10000, 2 }, - { "", IPL_INVALID, 0, 0, 0, 0 , 0, FALSE, FALSE, 0, 0, 0 } - // clang-format on -}; - -const PLStruct PL_Suffix[96] = { - // clang-format off - // PLName, PLPower, PLParam1, PLParam2, PLMinLvl, PLIType, PLGOE, PLDouble, PLOk, PLMinVal, PLMaxVal, PLMultVal - { "quality", IPL_DAMMOD, 1, 2, 2, PLT_WEAP | PLT_BOW , 0, FALSE, TRUE, 100, 200, 2 }, - { "maiming", IPL_DAMMOD, 3, 5, 7, PLT_WEAP | PLT_BOW , 0, FALSE, TRUE, 1300, 1500, 3 }, - { "slaying", IPL_DAMMOD, 6, 8, 15, PLT_WEAP , 0, FALSE, TRUE, 2600, 3000, 5 }, - { "gore", IPL_DAMMOD, 9, 12, 25, PLT_WEAP , 0, FALSE, TRUE, 4100, 5000, 8 }, - { "carnage", IPL_DAMMOD, 13, 16, 35, PLT_WEAP , 0, FALSE, TRUE, 5100, 10000, 10 }, - { "slaughter", IPL_DAMMOD, 17, 20, 60, PLT_WEAP , 0, FALSE, TRUE, 10100, 15000, 13 }, - { "pain", IPL_GETHIT_CURSE, 2, 4, 4, PLT_ARMO | PLT_SHLD | PLT_MISC, 1, FALSE, FALSE, 0, 0, -4 }, - { "tears", IPL_GETHIT_CURSE, 1, 1, 2, PLT_ARMO | PLT_SHLD | PLT_MISC, 1, FALSE, FALSE, 0, 0, -2 }, - { "health", IPL_GETHIT, 1, 1, 2, PLT_ARMO | PLT_SHLD | PLT_MISC, 16, FALSE, TRUE, 200, 200, 2 }, - { "protection", IPL_GETHIT, 2, 2, 6, PLT_ARMO | PLT_SHLD , 16, FALSE, TRUE, 400, 800, 4 }, - { "absorption", IPL_GETHIT, 3, 3, 12, PLT_ARMO | PLT_SHLD , 16, FALSE, TRUE, 1001, 2500, 10 }, - { "deflection", IPL_GETHIT, 4, 4, 20, PLT_ARMO , 16, FALSE, TRUE, 2500, 6500, 15 }, - { "osmosis", IPL_GETHIT, 5, 6, 50, PLT_ARMO , 16, FALSE, TRUE, 7500, 10000, 20 }, - { "frailty", IPL_STR_CURSE, 6, 10, 3, PLT_ARMO | PLT_SHLD | PLT_WEAP | PLT_BOW | PLT_MISC, 1, FALSE, FALSE, 0, 0, -3 }, - { "weakness", IPL_STR_CURSE, 1, 5, 1, PLT_ARMO | PLT_SHLD | PLT_WEAP | PLT_BOW | PLT_MISC, 1, FALSE, FALSE, 0, 0, -2 }, - { "strength", IPL_STR, 1, 5, 1, PLT_ARMO | PLT_SHLD | PLT_WEAP | PLT_BOW | PLT_MISC, 0, FALSE, TRUE, 200, 1000, 2 }, - { "might", IPL_STR, 6, 10, 5, PLT_ARMO | PLT_SHLD | PLT_WEAP | PLT_BOW | PLT_MISC, 0, FALSE, TRUE, 1200, 2000, 3 }, - { "power", IPL_STR, 11, 15, 11, PLT_ARMO | PLT_SHLD | PLT_WEAP | PLT_BOW | PLT_MISC, 0, FALSE, TRUE, 2200, 3000, 4 }, - { "giants", IPL_STR, 16, 20, 17, PLT_ARMO | PLT_WEAP | PLT_BOW | PLT_MISC, 0, FALSE, TRUE, 3200, 5000, 7 }, - { "titans", IPL_STR, 21, 30, 23, PLT_WEAP | PLT_MISC, 0, FALSE, TRUE, 5200, 10000, 10 }, - { "paralysis", IPL_DEX_CURSE, 6, 10, 3, PLT_ARMO | PLT_SHLD | PLT_WEAP | PLT_BOW | PLT_MISC, 1, FALSE, FALSE, 0, 0, -3 }, - { "atrophy", IPL_DEX_CURSE, 1, 5, 1, PLT_ARMO | PLT_SHLD | PLT_WEAP | PLT_BOW | PLT_MISC, 1, FALSE, FALSE, 0, 0, -2 }, - { "dexterity", IPL_DEX, 1, 5, 1, PLT_ARMO | PLT_SHLD | PLT_WEAP | PLT_BOW | PLT_MISC, 0, FALSE, TRUE, 200, 1000, 2 }, - { "skill", IPL_DEX, 6, 10, 5, PLT_ARMO | PLT_SHLD | PLT_WEAP | PLT_BOW | PLT_MISC, 0, FALSE, TRUE, 1200, 2000, 3 }, - { "accuracy", IPL_DEX, 11, 15, 11, PLT_ARMO | PLT_SHLD | PLT_WEAP | PLT_BOW | PLT_MISC, 0, FALSE, TRUE, 2200, 3000, 4 }, - { "precision", IPL_DEX, 16, 20, 17, PLT_ARMO | PLT_WEAP | PLT_BOW | PLT_MISC, 0, FALSE, TRUE, 3200, 5000, 7 }, - { "perfection", IPL_DEX, 21, 30, 23, PLT_BOW | PLT_MISC, 0, FALSE, TRUE, 5200, 10000, 10 }, - { "the fool", IPL_MAG_CURSE, 6, 10, 3, PLT_ARMO | PLT_SHLD | PLT_WEAP | PLT_STAFF | PLT_BOW | PLT_MISC, 1, FALSE, FALSE, 0, 0, -3 }, - { "dyslexia", IPL_MAG_CURSE, 1, 5, 1, PLT_ARMO | PLT_SHLD | PLT_WEAP | PLT_STAFF | PLT_BOW | PLT_MISC, 1, FALSE, FALSE, 0, 0, -2 }, - { "magic", IPL_MAG, 1, 5, 1, PLT_ARMO | PLT_SHLD | PLT_WEAP | PLT_STAFF | PLT_BOW | PLT_MISC, 0, FALSE, TRUE, 200, 1000, 2 }, - { "the mind", IPL_MAG, 6, 10, 5, PLT_ARMO | PLT_SHLD | PLT_WEAP | PLT_STAFF | PLT_BOW | PLT_MISC, 0, FALSE, TRUE, 1200, 2000, 3 }, - { "brilliance", IPL_MAG, 11, 15, 11, PLT_ARMO | PLT_SHLD | PLT_WEAP | PLT_STAFF | PLT_BOW | PLT_MISC, 0, FALSE, TRUE, 2200, 3000, 4 }, - { "sorcery", IPL_MAG, 16, 20, 17, PLT_ARMO | PLT_WEAP | PLT_STAFF | PLT_BOW | PLT_MISC, 0, FALSE, TRUE, 3200, 5000, 7 }, - { "wizardry", IPL_MAG, 21, 30, 23, PLT_STAFF | PLT_MISC, 0, FALSE, TRUE, 5200, 10000, 10 }, - { "illness", IPL_VIT_CURSE, 6, 10, 3, PLT_ARMO | PLT_SHLD | PLT_WEAP | PLT_BOW | PLT_MISC, 1, FALSE, FALSE, 0, 0, -3 }, - { "disease", IPL_VIT_CURSE, 1, 5, 1, PLT_ARMO | PLT_SHLD | PLT_WEAP | PLT_BOW | PLT_MISC, 1, FALSE, FALSE, 0, 0, -2 }, - { "vitality", IPL_VIT, 1, 5, 1, PLT_ARMO | PLT_SHLD | PLT_WEAP | PLT_BOW | PLT_MISC, 16, FALSE, TRUE, 200, 1000, 2 }, - { "zest", IPL_VIT, 6, 10, 5, PLT_ARMO | PLT_SHLD | PLT_WEAP | PLT_BOW | PLT_MISC, 16, FALSE, TRUE, 1200, 2000, 3 }, - { "vim", IPL_VIT, 11, 15, 11, PLT_ARMO | PLT_SHLD | PLT_WEAP | PLT_BOW | PLT_MISC, 16, FALSE, TRUE, 2200, 3000, 4 }, - { "vigor", IPL_VIT, 16, 20, 17, PLT_ARMO | PLT_WEAP | PLT_BOW | PLT_MISC, 16, FALSE, TRUE, 3200, 5000, 7 }, - { "life", IPL_VIT, 21, 30, 23, PLT_MISC, 16, FALSE, TRUE, 5200, 10000, 10 }, - { "trouble", IPL_ATTRIBS_CURSE, 6, 10, 12, PLT_ARMO | PLT_SHLD | PLT_WEAP | PLT_BOW | PLT_MISC, 1, FALSE, FALSE, 0, 0, -10 }, - { "the pit", IPL_ATTRIBS_CURSE, 1, 5, 5, PLT_ARMO | PLT_SHLD | PLT_WEAP | PLT_BOW | PLT_MISC, 1, FALSE, FALSE, 0, 0, -5 }, - { "the sky", IPL_ATTRIBS, 1, 3, 5, PLT_ARMO | PLT_SHLD | PLT_WEAP | PLT_BOW | PLT_MISC, 0, FALSE, TRUE, 800, 4000, 5 }, - { "the moon", IPL_ATTRIBS, 4, 7, 11, PLT_ARMO | PLT_SHLD | PLT_WEAP | PLT_BOW | PLT_MISC, 0, FALSE, TRUE, 4800, 8000, 10 }, - { "the stars", IPL_ATTRIBS, 8, 11, 17, PLT_ARMO | PLT_WEAP | PLT_BOW | PLT_MISC, 0, FALSE, TRUE, 8800, 12000, 15 }, - { "the heavens", IPL_ATTRIBS, 12, 15, 25, PLT_WEAP | PLT_BOW | PLT_MISC, 0, FALSE, TRUE, 12800, 20000, 20 }, - { "the zodiac", IPL_ATTRIBS, 16, 20, 30, PLT_MISC, 0, FALSE, TRUE, 20800, 40000, 30 }, - { "the vulture", IPL_LIFE_CURSE, 11, 25, 4, PLT_ARMO | PLT_SHLD | PLT_MISC, 1, FALSE, FALSE, 0, 0, -4 }, - { "the jackal", IPL_LIFE_CURSE, 1, 10, 1, PLT_ARMO | PLT_SHLD | PLT_MISC, 1, FALSE, FALSE, 0, 0, -2 }, - { "the fox", IPL_LIFE, 10, 15, 1, PLT_ARMO | PLT_SHLD | PLT_MISC, 0, FALSE, TRUE, 100, 1000, 2 }, - { "the jaguar", IPL_LIFE, 16, 20, 5, PLT_ARMO | PLT_SHLD | PLT_MISC, 0, FALSE, TRUE, 1100, 2000, 3 }, - { "the eagle", IPL_LIFE, 21, 30, 9, PLT_ARMO | PLT_SHLD | PLT_MISC, 0, FALSE, TRUE, 2100, 4000, 5 }, - { "the wolf", IPL_LIFE, 30, 40, 15, PLT_ARMO | PLT_SHLD | PLT_MISC, 0, FALSE, TRUE, 4100, 6000, 7 }, - { "the tiger", IPL_LIFE, 41, 50, 21, PLT_ARMO | PLT_SHLD | PLT_MISC, 0, FALSE, TRUE, 6100, 10000, 9 }, - { "the lion", IPL_LIFE, 51, 60, 27, PLT_ARMO | PLT_MISC, 0, FALSE, TRUE, 10100, 15000, 11 }, - { "the mammoth", IPL_LIFE, 61, 80, 35, PLT_ARMO , 0, FALSE, TRUE, 15100, 19000, 12 }, - { "the whale", IPL_LIFE, 81, 100, 60, PLT_ARMO , 0, FALSE, TRUE, 19100, 30000, 13 }, - { "fragility", IPL_DUR_CURSE, 100, 100, 3, PLT_ARMO | PLT_SHLD | PLT_WEAP , 1, FALSE, FALSE, 0, 0, -4 }, - { "brittleness", IPL_DUR_CURSE, 26, 75, 1, PLT_ARMO | PLT_SHLD | PLT_WEAP , 1, FALSE, FALSE, 0, 0, -2 }, - { "sturdiness", IPL_DUR, 26, 75, 1, PLT_ARMO | PLT_SHLD | PLT_WEAP , 0, FALSE, TRUE, 100, 100, 2 }, - { "craftsmanship", IPL_DUR, 51, 100, 6, PLT_ARMO | PLT_SHLD | PLT_WEAP , 0, FALSE, TRUE, 200, 200, 2 }, - { "structure", IPL_DUR, 101, 200, 12, PLT_ARMO | PLT_SHLD | PLT_WEAP , 0, FALSE, TRUE, 300, 300, 2 }, - { "the ages", IPL_INDESTRUCTIBLE, 0, 0, 25, PLT_ARMO | PLT_SHLD | PLT_WEAP , 0, FALSE, TRUE, 600, 600, 5 }, - { "the dark", IPL_LIGHT_CURSE, 4, 4, 6, PLT_ARMO | PLT_WEAP | PLT_MISC, 1, FALSE, FALSE, 0, 0, -3 }, - { "the night", IPL_LIGHT_CURSE, 2, 2, 3, PLT_ARMO | PLT_WEAP | PLT_MISC, 1, FALSE, FALSE, 0, 0, -2 }, - { "light", IPL_LIGHT, 2, 2, 4, PLT_ARMO | PLT_WEAP | PLT_MISC, 16, FALSE, TRUE, 750, 750, 2 }, - { "radiance", IPL_LIGHT, 4, 4, 8, PLT_ARMO | PLT_WEAP | PLT_MISC, 16, FALSE, TRUE, 1500, 1500, 3 }, - { "flame", IPL_FIRE_ARROWS, 1, 3, 1, PLT_BOW , 0, FALSE, TRUE, 2000, 2000, 2 }, - { "fire", IPL_FIRE_ARROWS, 1, 6, 11, PLT_BOW , 0, FALSE, TRUE, 4000, 4000, 4 }, - { "burning", IPL_FIRE_ARROWS, 1, 16, 35, PLT_BOW , 0, FALSE, TRUE, 6000, 6000, 6 }, - { "shock", IPL_LIGHT_ARROWS, 1, 6, 13, PLT_BOW , 0, FALSE, TRUE, 6000, 6000, 2 }, - { "lightning", IPL_LIGHT_ARROWS, 1, 10, 21, PLT_BOW , 0, FALSE, TRUE, 8000, 8000, 4 }, - { "thunder", IPL_LIGHT_ARROWS, 1, 20, 60, PLT_BOW , 0, FALSE, TRUE, 12000, 12000, 6 }, - { "many", IPL_DUR, 100, 100, 3, PLT_BOW , 0, FALSE, TRUE, 750, 750, 2 }, - { "plenty", IPL_DUR, 200, 200, 7, PLT_BOW , 0, FALSE, TRUE, 1500, 1500, 3 }, - { "thorns", IPL_THORNS, 1, 3, 1, PLT_ARMO | PLT_SHLD , 0, FALSE, TRUE, 500, 500, 2 }, - { "corruption", IPL_NOMANA, 0, 0, 5, PLT_ARMO | PLT_SHLD | PLT_WEAP , 1, FALSE, FALSE, -1000, -1000, 2 }, - { "thieves", IPL_ABSHALFTRAP, 0, 0, 11, PLT_ARMO | PLT_SHLD | PLT_MISC, 0, FALSE, TRUE, 1500, 1500, 2 }, - { "the bear", IPL_KNOCKBACK, 0, 0, 5, PLT_WEAP | PLT_STAFF | PLT_BOW , 1, FALSE, TRUE, 750, 750, 2 }, - { "the bat", IPL_STEALMANA, 3, 3, 8, PLT_WEAP , 0, FALSE, TRUE, 7500, 7500, 3 }, - { "vampires", IPL_STEALMANA, 5, 5, 19, PLT_WEAP , 0, FALSE, TRUE, 15000, 15000, 3 }, - { "the leech", IPL_STEALLIFE, 3, 3, 8, PLT_WEAP , 0, FALSE, TRUE, 7500, 7500, 3 }, - { "blood", IPL_STEALLIFE, 5, 5, 19, PLT_WEAP , 0, FALSE, TRUE, 15000, 15000, 3 }, - { "piercing", IPL_TARGAC, 2, 6, 1, PLT_WEAP | PLT_BOW , 0, FALSE, TRUE, 1000, 1000, 3 }, - { "puncturing", IPL_TARGAC, 4, 12, 9, PLT_WEAP | PLT_BOW , 0, FALSE, TRUE, 2000, 2000, 6 }, - { "bashing", IPL_TARGAC, 8, 24, 17, PLT_WEAP , 0, FALSE, TRUE, 4000, 4000, 12 }, - { "readiness", IPL_FASTATTACK, 1, 1, 1, PLT_WEAP | PLT_STAFF | PLT_BOW , 0, FALSE, TRUE, 2000, 2000, 2 }, - { "swiftness", IPL_FASTATTACK, 2, 2, 10, PLT_WEAP | PLT_STAFF | PLT_BOW , 0, FALSE, TRUE, 4000, 4000, 4 }, - { "speed", IPL_FASTATTACK, 3, 3, 19, PLT_WEAP | PLT_STAFF , 0, FALSE, TRUE, 8000, 8000, 8 }, - { "haste", IPL_FASTATTACK, 4, 4, 27, PLT_WEAP | PLT_STAFF , 0, FALSE, TRUE, 16000, 16000, 16 }, - { "balance", IPL_FASTRECOVER, 1, 1, 1, PLT_ARMO | PLT_MISC, 0, FALSE, TRUE, 2000, 2000, 2 }, - { "stability", IPL_FASTRECOVER, 2, 2, 10, PLT_ARMO | PLT_MISC, 0, FALSE, TRUE, 4000, 4000, 4 }, - { "harmony", IPL_FASTRECOVER, 3, 3, 20, PLT_ARMO | PLT_MISC, 0, FALSE, TRUE, 8000, 8000, 8 }, - { "blocking", IPL_FASTBLOCK, 1, 1, 5, PLT_SHLD , 0, FALSE, TRUE, 4000, 4000, 4 }, - { "", IPL_INVALID, 0, 0, 0, 0 , 0, FALSE, FALSE, 0, 0, 0 } - // clang-format on -}; - -const UItemStruct UniqueItemList[91] = { - // 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 - { "The Butcher's Cleaver", UITYPE_CLEAVER, 1, 3, 3650, IPL_STR, 10, 10, IPL_SETDAM, 4, 24, IPL_SETDUR, 10, 10, IPL_TOHIT, 0, 0, IPL_TOHIT, 0, 0, IPL_TOHIT, 0, 0 }, - { "The Undead Crown", UITYPE_SKCROWN, 1, 3, 16650, IPL_RNDSTEALLIFE, 0, 0, IPL_SETAC, 8, 8, IPL_INVCURS, 77, 0, IPL_TOHIT, 0, 0, IPL_TOHIT, 0, 0, IPL_TOHIT, 0, 0 }, - { "Empyrean Band", UITYPE_INFRARING, 1, 4, 8000, IPL_ATTRIBS, 2, 2, IPL_LIGHT, 2, 2, IPL_FASTRECOVER, 1, 1, IPL_ABSHALFTRAP, 0, 0, IPL_TOHIT, 0, 0, IPL_TOHIT, 0, 0 }, - { "Optic Amulet", UITYPE_OPTAMULET, 1, 5, 9750, IPL_LIGHT, 2, 2, IPL_LIGHTRES, 20, 20, IPL_GETHIT, 1, 1, IPL_MAG, 5, 5, IPL_INVCURS, 44, 0, IPL_TOHIT, 0, 0 }, - { "Ring of Truth", UITYPE_TRING, 1, 4, 9100, IPL_LIFE, 10, 10, IPL_GETHIT, 1, 1, IPL_ALLRES, 10, 10, IPL_INVCURS, 10, 0, IPL_TOHIT, 0, 0, IPL_TOHIT, 0, 0 }, - { "Harlequin Crest", UITYPE_HARCREST, 1, 6, 4000, IPL_AC_CURSE, 3, 3, IPL_GETHIT, 1, 1, IPL_ATTRIBS, 2, 2, IPL_LIFE, 7, 7, IPL_MANA, 7, 7, IPL_INVCURS, 81, 0 }, - { "Veil of Steel", UITYPE_STEELVEIL, 1, 6, 63800, IPL_ALLRES, 50, 50, IPL_LIGHT_CURSE, 2, 2, IPL_ACP, 60, 60, IPL_MANA_CURSE, 30, 30, IPL_STR, 15, 15, IPL_VIT, 15, 15 }, - { "Arkaine's Valor", UITYPE_ARMOFVAL, 1, 4, 42000, IPL_SETAC, 25, 25, IPL_VIT, 10, 10, IPL_GETHIT, 3, 3, IPL_FASTRECOVER, 3, 3, IPL_TOHIT, 0, 0, IPL_TOHIT, 0, 0 }, - { "Griswold's Edge", UITYPE_GRISWOLD, 1, 6, 42000, IPL_FIREDAM, 1, 10, IPL_TOHIT, 25, 25, IPL_FASTATTACK, 2, 2, IPL_KNOCKBACK, 0, 0, IPL_MANA, 20, 20, IPL_LIFE_CURSE, 20, 20 }, - { "Lightforge", UITYPE_MACE, 1, 6, 26675, IPL_LIGHT, 4, 4, IPL_DAMP, 150, 150, IPL_TOHIT, 25, 25, IPL_FIREDAM, 10, 20, IPL_INDESTRUCTIBLE, 0, 0, IPL_ATTRIBS, 8, 8 }, - { "The Rift Bow", UITYPE_SHORTBOW, 1, 3, 1800, IPL_RNDARROWVEL, 0, 0, IPL_DAMMOD, 2, 2, IPL_DEX_CURSE, 3, 3, IPL_TOHIT, 0, 0, IPL_TOHIT, 0, 0, IPL_TOHIT, 0, 0 }, - { "The Needler", UITYPE_SHORTBOW, 2, 4, 8900, IPL_TOHIT, 50, 50, IPL_SETDAM, 1, 3, IPL_FASTATTACK, 2, 2, IPL_INVCURS, 158, 0, IPL_TOHIT, 0, 0, IPL_TOHIT, 0, 0 }, - { "The Celestial Bow", UITYPE_LONGBOW, 2, 4, 1200, IPL_NOMINSTR, 0, 0, IPL_DAMMOD, 2, 2, IPL_SETAC, 5, 5, IPL_INVCURS, 133, 0, IPL_TOHIT, 0, 0, IPL_TOHIT, 0, 0 }, - { "Deadly Hunter", UITYPE_COMPBOW, 3, 4, 8750, IPL_3XDAMVDEM, 10, 10, IPL_TOHIT, 20, 20, IPL_MAG_CURSE, 5, 5, IPL_INVCURS, 108, 0, IPL_TOHIT, 0, 0, IPL_TOHIT, 0, 0 }, - { "Bow of the Dead", UITYPE_COMPBOW, 5, 6, 2500, IPL_TOHIT, 10, 10, IPL_DEX, 4, 4, IPL_VIT_CURSE, 3, 3, IPL_LIGHT_CURSE, 2, 2, IPL_SETDUR, 30, 30, IPL_INVCURS, 108, 0 }, - { "The Blackoak Bow", UITYPE_LONGBOW, 5, 4, 2500, IPL_DEX, 10, 10, IPL_VIT_CURSE, 10, 10, IPL_DAMP, 50, 50, IPL_LIGHT_CURSE, 1, 1, IPL_TOHIT, 0, 0, IPL_TOHIT, 0, 0 }, - { "Flamedart", UITYPE_HUNTBOW, 10, 4, 14250, IPL_FIRE_ARROWS, 0, 0, IPL_FIREDAM, 1, 6, IPL_TOHIT, 20, 20, IPL_FIRERES, 40, 40, IPL_TOHIT, 0, 0, IPL_TOHIT, 0, 0 }, - { "Fleshstinger", UITYPE_LONGBOW, 13, 4, 16500, IPL_DEX, 15, 15, IPL_TOHIT, 40, 40, IPL_DAMP, 80, 80, IPL_DUR, 6, 6, IPL_TOHIT, 0, 0, IPL_TOHIT, 0, 0 }, - { "Windforce", UITYPE_WARBOW, 17, 4, 37750, IPL_STR, 5, 5, IPL_DAMP, 200, 200, IPL_KNOCKBACK, 0, 0, IPL_INVCURS, 164, 0, IPL_TOHIT, 0, 0, IPL_TOHIT, 0, 0 }, - { "Eaglehorn", UITYPE_BATTLEBOW, 26, 5, 42500, IPL_DEX, 20, 20, IPL_TOHIT, 50, 50, IPL_DAMP, 100, 100, IPL_INDESTRUCTIBLE, 0, 0, IPL_INVCURS, 108, 0, IPL_TOHIT, 0, 0 }, - { "Gonnagal's Dirk", UITYPE_DAGGER, 1, 5, 7040, IPL_DEX_CURSE, 5, 5, IPL_DAMMOD, 4, 4, IPL_FASTATTACK, 2, 2, IPL_FIRERES, 25, 25, IPL_INVCURS, 54, 0, IPL_TOHIT, 0, 0 }, - { "The Defender", UITYPE_SABRE, 1, 3, 2000, IPL_SETAC, 5, 5, IPL_VIT, 5, 5, IPL_TOHIT_CURSE, 5, 5, IPL_TOHIT, 0, 0, IPL_TOHIT, 0, 0, IPL_TOHIT, 0, 0 }, - { "Gryphons Claw", UITYPE_FALCHION, 1, 4, 1000, IPL_DAMP, 100, 100, IPL_MAG_CURSE, 2, 2, IPL_DEX_CURSE, 5, 5, IPL_INVCURS, 68, 0, IPL_TOHIT, 0, 0, IPL_TOHIT, 0, 0 }, - { "Black Razor", UITYPE_DAGGER, 1, 4, 2000, IPL_DAMP, 150, 150, IPL_VIT, 2, 2, IPL_SETDUR, 5, 5, IPL_INVCURS, 53, 0, IPL_TOHIT, 0, 0, IPL_TOHIT, 0, 0 }, - { "Gibbous Moon", UITYPE_BROADSWR, 2, 4, 6660, IPL_ATTRIBS, 2, 2, IPL_DAMP, 25, 25, IPL_MANA, 15, 15, IPL_LIGHT_CURSE, 3, 3, IPL_TOHIT, 0, 0, IPL_TOHIT, 0, 0 }, - { "Ice Shank", UITYPE_LONGSWR, 3, 3, 5250, IPL_FIRERES, 40, 40, IPL_SETDUR, 15, 15, IPL_STR, 5, 10, IPL_TOHIT, 0, 0, IPL_TOHIT, 0, 0, IPL_TOHIT, 0, 0 }, - { "The Executioner's Blade", UITYPE_FALCHION, 3, 5, 7080, IPL_DAMP, 150, 150, IPL_LIFE_CURSE, 10, 10, IPL_LIGHT_CURSE, 1, 1, IPL_DUR, 200, 200, IPL_INVCURS, 58, 0, IPL_TOHIT, 0, 0 }, - { "The Bonesaw", UITYPE_CLAYMORE, 6, 6, 4400, IPL_DAMMOD, 10, 10, IPL_STR, 10, 10, IPL_MAG_CURSE, 5, 5, IPL_DEX_CURSE, 5, 5, IPL_LIFE, 10, 10, IPL_MANA_CURSE, 10, 10 }, - { "Shadowhawk", UITYPE_BROADSWR, 8, 4, 13750, IPL_LIGHT_CURSE, 2, 2, IPL_STEALLIFE, 5, 5, IPL_TOHIT, 15, 15, IPL_ALLRES, 5, 5, IPL_TOHIT, 0, 0, IPL_TOHIT, 0, 0 }, - { "Wizardspike", UITYPE_DAGGER, 11, 5, 12920, IPL_MAG, 15, 15, IPL_MANA, 35, 35, IPL_TOHIT, 25, 25, IPL_ALLRES, 15, 15, IPL_INVCURS, 50, 0, IPL_TOHIT, 0, 0 }, - { "Lightsabre", UITYPE_SABRE, 13, 4, 19150, IPL_LIGHT, 2, 2, IPL_LIGHTDAM, 1, 10, IPL_TOHIT, 20, 20, IPL_LIGHTRES, 50, 50, IPL_TOHIT, 0, 0, IPL_TOHIT, 0, 0 }, - { "The Falcon's Talon", UITYPE_SCIMITAR, 15, 5, 7867, IPL_FASTATTACK, 4, 4, IPL_TOHIT, 20, 20, IPL_DAMP_CURSE, 33, 33, IPL_DEX, 10, 10, IPL_INVCURS, 68, 0, IPL_TOHIT, 0, 0 }, - { "Inferno", UITYPE_LONGSWR, 17, 4, 34600, IPL_FIREDAM, 2, 12, IPL_LIGHT, 3, 3, IPL_MANA, 20, 20, IPL_FIRERES, 80, 80, IPL_TOHIT, 0, 0, IPL_TOHIT, 0, 0 }, - { "Doombringer", UITYPE_BASTARDSWR, 19, 5, 18250, IPL_TOHIT, 25, 25, IPL_DAMP, 250, 250, IPL_ATTRIBS_CURSE, 5, 5, IPL_LIFE_CURSE, 25, 25, IPL_LIGHT_CURSE, 2, 2, IPL_TOHIT, 0, 0 }, - { "The Grizzly", UITYPE_TWOHANDSWR, 23, 6, 50000, IPL_STR, 20, 20, IPL_VIT_CURSE, 5, 5, IPL_DAMP, 200, 200, IPL_KNOCKBACK, 0, 0, IPL_DUR, 100, 100, IPL_INVCURS, 160, 0 }, - { "The Grandfather", UITYPE_GREATSWR, 27, 6, 119800, IPL_ONEHAND, 0, 0, IPL_ATTRIBS, 5, 5, IPL_TOHIT, 20, 20, IPL_DAMP, 70, 70, IPL_LIFE, 20, 20, IPL_INVCURS, 161, 0 }, - { "The Mangler", UITYPE_LARGEAXE, 2, 5, 2850, IPL_DAMP, 200, 200, IPL_DEX_CURSE, 5, 5, IPL_MAG_CURSE, 5, 5, IPL_MANA_CURSE, 10, 10, IPL_INVCURS, 144, 0, IPL_TOHIT, 0, 0 }, - { "Sharp Beak", UITYPE_LARGEAXE, 2, 4, 2850, IPL_LIFE, 20, 20, IPL_MAG_CURSE, 10, 10, IPL_MANA_CURSE, 10, 10, IPL_INVCURS, 143, 0, IPL_TOHIT, 0, 0, IPL_TOHIT, 0, 0 }, - { "BloodSlayer", UITYPE_BROADAXE, 3, 5, 2500, IPL_DAMP, 100, 100, IPL_3XDAMVDEM, 50, 50, IPL_ATTRIBS_CURSE, 5, 5, IPL_SPLLVLADD, -1, -1, IPL_INVCURS, 144, 0, IPL_TOHIT, 0, 0 }, - { "The Celestial Axe", UITYPE_BATTLEAXE, 4, 4, 14100, IPL_NOMINSTR, 0, 0, IPL_TOHIT, 15, 15, IPL_LIFE, 15, 15, IPL_STR_CURSE, 15, 15, IPL_TOHIT, 0, 0, IPL_TOHIT, 0, 0 }, - { "Wicked Axe", UITYPE_LARGEAXE, 5, 6, 31150, IPL_TOHIT, 30, 30, IPL_DEX, 10, 10, IPL_VIT_CURSE, 10, 10, IPL_GETHIT, 1, 6, IPL_INDESTRUCTIBLE, 0, 0, IPL_INVCURS, 143, 0 }, - { "Stonecleaver", UITYPE_BROADAXE, 7, 5, 23900, IPL_LIFE, 30, 30, IPL_TOHIT, 20, 20, IPL_DAMP, 50, 50, IPL_LIGHTRES, 40, 40, IPL_INVCURS, 104, 0, IPL_TOHIT, 0, 0 }, - { "Aguinara's Hatchet", UITYPE_SMALLAXE, 12, 3, 24800, IPL_SPLLVLADD, 1, 1, IPL_MAG, 10, 10, IPL_MAGICRES, 80, 80, IPL_TOHIT, 0, 0, IPL_TOHIT, 0, 0, IPL_TOHIT, 0, 0 }, - { "Hellslayer", UITYPE_BATTLEAXE, 15, 5, 26200, IPL_STR, 8, 8, IPL_VIT, 8, 8, IPL_DAMP, 100, 100, IPL_LIFE, 25, 25, IPL_MANA_CURSE, 25, 25, IPL_TOHIT, 0, 0 }, - { "Messerschmidt's Reaver", UITYPE_GREATAXE, 25, 6, 58000, IPL_DAMP, 200, 200, IPL_DAMMOD, 15, 15, IPL_ATTRIBS, 5, 5, IPL_LIFE_CURSE, 50, 50, IPL_FIREDAM, 2, 12, IPL_INVCURS, 163, 0 }, - { "Crackrust", UITYPE_MACE, 1, 5, 11375, IPL_ATTRIBS, 2, 2, IPL_INDESTRUCTIBLE, 0, 0, IPL_ALLRES, 15, 15, IPL_DAMP, 50, 50, IPL_SPLLVLADD, -1, -1, IPL_TOHIT, 0, 0 }, - { "Hammer of Jholm", UITYPE_MAUL, 1, 4, 8700, IPL_DAMP, 4, 10, IPL_INDESTRUCTIBLE, 0, 0, IPL_STR, 3, 3, IPL_TOHIT, 15, 15, IPL_TOHIT, 0, 0, IPL_TOHIT, 0, 0 }, - { "Civerb's Cudgel", UITYPE_MACE, 1, 3, 2000, IPL_3XDAMVDEM, 35, 35, IPL_DEX_CURSE, 5, 5, IPL_MAG_CURSE, 2, 2, IPL_TOHIT, 0, 0, IPL_TOHIT, 0, 0, IPL_TOHIT, 0, 0 }, - { "The Celestial Star", UITYPE_FLAIL, 2, 5, 7810, IPL_NOMINSTR, 0, 0, IPL_LIGHT, 2, 2, IPL_DAMMOD, 10, 10, IPL_AC_CURSE, 8, 8, IPL_INVCURS, 131, 0, IPL_TOHIT, 0, 0 }, - { "Baranar's Star", UITYPE_MORNSTAR, 5, 6, 6850, IPL_TOHIT, 12, 12, IPL_DAMP, 80, 80, IPL_FASTATTACK, 1, 1, IPL_VIT, 4, 4, IPL_DEX_CURSE, 4, 4, IPL_SETDUR, 60, 60 }, - { "Gnarled Root", UITYPE_SPIKCLUB, 9, 6, 9820, IPL_TOHIT, 20, 20, IPL_DAMP, 300, 300, IPL_DEX, 10, 10, IPL_MAG, 5, 5, IPL_ALLRES, 10, 10, IPL_AC_CURSE, 10, 10 }, - { "The Cranium Basher", UITYPE_MAUL, 12, 6, 36500, IPL_DAMMOD, 20, 20, IPL_STR, 15, 15, IPL_INDESTRUCTIBLE, 0, 0, IPL_MANA_CURSE, 150, 150, IPL_ALLRES, 5, 5, IPL_INVCURS, 122, 0 }, - { "Schaefer's Hammer", UITYPE_WARHAMMER, 16, 6, 56125, IPL_DAMP_CURSE, 100, 100, IPL_LIGHTDAM, 1, 50, IPL_LIFE, 50, 50, IPL_TOHIT, 30, 30, IPL_LIGHTRES, 80, 80, IPL_LIGHT, 1, 1 }, - { "Dreamflange", UITYPE_MACE, 26, 5, 26450, IPL_MAG, 30, 30, IPL_MANA, 50, 50, IPL_MAGICRES, 50, 50, IPL_LIGHT, 2, 2, IPL_SPLLVLADD, 1, 1, IPL_TOHIT, 0, 0 }, - { "Staff of Shadows", UITYPE_LONGSTAFF, 2, 5, 1250, IPL_MAG_CURSE, 10, 10, IPL_TOHIT, 10, 10, IPL_DAMP, 60, 60, IPL_LIGHT_CURSE, 2, 2, IPL_FASTATTACK, 1, 1, IPL_TOHIT, 0, 0 }, - { "Immolator", UITYPE_LONGSTAFF, 4, 4, 3900, IPL_FIRERES, 20, 20, IPL_FIREDAM, 4, 4, IPL_MANA, 10, 10, IPL_VIT_CURSE, 5, 5, IPL_TOHIT, 0, 0, IPL_TOHIT, 0, 0 }, - { "Storm Spire", UITYPE_WARSTAFF, 8, 4, 22500, IPL_LIGHTRES, 50, 50, IPL_LIGHTDAM, 2, 8, IPL_STR, 10, 10, IPL_MAG_CURSE, 10, 10, IPL_TOHIT, 0, 0, IPL_TOHIT, 0, 0 }, - { "Gleamsong", UITYPE_SHORTSTAFF, 8, 4, 6520, IPL_MANA, 25, 25, IPL_STR_CURSE, 3, 3, IPL_VIT_CURSE, 3, 3, IPL_SPELL, 10, 76, IPL_TOHIT, 0, 0, IPL_TOHIT, 0, 0 }, - { "Thundercall", UITYPE_COMPSTAFF, 14, 5, 22250, IPL_TOHIT, 35, 35, IPL_LIGHTDAM, 1, 10, IPL_SPELL, 3, 76, IPL_LIGHTRES, 30, 30, IPL_LIGHT, 2, 2, IPL_TOHIT, 0, 0 }, - { "The Protector", UITYPE_SHORTSTAFF, 16, 6, 17240, IPL_VIT, 5, 5, IPL_GETHIT, 5, 5, IPL_SETAC, 40, 40, IPL_SPELL, 2, 86, IPL_THORNS, 1, 3, IPL_INVCURS, 162, 0 }, - { "Naj's Puzzler", UITYPE_LONGSTAFF, 18, 5, 34000, IPL_MAG, 20, 20, IPL_DEX, 10, 10, IPL_ALLRES, 20, 20, IPL_SPELL, 23, 57, IPL_LIFE_CURSE, 25, 25, IPL_TOHIT, 0, 0 }, - { "Mindcry", UITYPE_QUARSTAFF, 20, 4, 41500, IPL_MAG, 15, 15, IPL_SPELL, 13, 69, IPL_ALLRES, 15, 15, IPL_SPLLVLADD, 1, 1, IPL_TOHIT, 0, 0, IPL_TOHIT, 0, 0 }, - { "Rod of Onan", UITYPE_WARSTAFF, 22, 3, 44167, IPL_SPELL, 21, 50, IPL_DAMP, 100, 100, IPL_ATTRIBS, 5, 5, IPL_TOHIT, 0, 0, IPL_TOHIT, 0, 0, IPL_TOHIT, 0, 0 }, - { "Helm of Sprits", UITYPE_HELM, 1, 2, 7525, IPL_STEALLIFE, 5, 5, IPL_INVCURS, 77, 0, IPL_TOHIT, 0, 0, IPL_TOHIT, 0, 0, IPL_TOHIT, 0, 0, IPL_TOHIT, 0, 0 }, - { "Thinking Cap", UITYPE_SKULLCAP, 6, 5, 2020, IPL_MANA, 30, 30, IPL_SPLLVLADD, 2, 2, IPL_ALLRES, 20, 20, IPL_SETDUR, 1, 1, IPL_INVCURS, 93, 0, IPL_TOHIT, 0, 0 }, - { "OverLord's Helm", UITYPE_HELM, 7, 6, 12500, IPL_STR, 20, 20, IPL_DEX, 15, 15, IPL_VIT, 5, 5, IPL_MAG_CURSE, 20, 20, IPL_SETDUR, 15, 15, IPL_INVCURS, 99, 0 }, - { "Fool's Crest", UITYPE_HELM, 12, 5, 10150, IPL_ATTRIBS_CURSE, 4, 4, IPL_LIFE, 100, 100, IPL_GETHIT_CURSE, 1, 6, IPL_THORNS, 1, 3, IPL_INVCURS, 80, 0, IPL_TOHIT, 0, 0 }, - { "Gotterdamerung", UITYPE_GREATHELM, 21, 6, 54900, IPL_ATTRIBS, 20, 20, IPL_SETAC, 60, 60, IPL_GETHIT, 4, 4, IPL_ALLRESZERO, 0, 0, IPL_LIGHT_CURSE, 4, 4, IPL_INVCURS, 85, 0 }, - { "Royal Circlet", UITYPE_CROWN, 27, 5, 24875, IPL_ATTRIBS, 10, 10, IPL_MANA, 40, 40, IPL_SETAC, 40, 40, IPL_LIGHT, 1, 1, IPL_INVCURS, 79, 0, IPL_TOHIT, 0, 0 }, - { "Torn Flesh of Souls", UITYPE_RAGS, 2, 5, 4825, IPL_SETAC, 8, 8, IPL_VIT, 10, 10, IPL_GETHIT, 1, 1, IPL_INDESTRUCTIBLE, 0, 0, IPL_INVCURS, 92, 0, IPL_TOHIT, 0, 0 }, - { "The Gladiator's Bane", UITYPE_STUDARMOR, 6, 4, 3450, IPL_SETAC, 25, 25, IPL_GETHIT, 2, 2, IPL_DUR, 200, 200, IPL_ATTRIBS_CURSE, 3, 3, IPL_TOHIT, 0, 0, IPL_TOHIT, 0, 0 }, - { "The Rainbow Cloak", UITYPE_CLOAK, 2, 6, 4900, IPL_SETAC, 10, 10, IPL_ATTRIBS, 1, 1, IPL_ALLRES, 10, 10, IPL_LIFE, 5, 5, IPL_DUR, 50, 50, IPL_INVCURS, 138, 0 }, - { "Leather of Aut", UITYPE_LEATHARMOR, 4, 5, 10550, IPL_SETAC, 15, 15, IPL_STR, 5, 5, IPL_MAG_CURSE, 5, 5, IPL_DEX, 5, 5, IPL_INDESTRUCTIBLE, 0, 0, IPL_TOHIT, 0, 0 }, - { "Wisdom's Wrap", UITYPE_ROBE, 5, 6, 6200, IPL_MAG, 5, 5, IPL_MANA, 10, 10, IPL_LIGHTRES, 25, 25, IPL_SETAC, 15, 15, IPL_GETHIT, 1, 1, IPL_INVCURS, 138, 0 }, - { "Sparking Mail", UITYPE_CHAINMAIL, 9, 2, 15750, IPL_SETAC, 30, 30, IPL_LIGHTDAM, 1, 10, IPL_TOHIT, 0, 0, IPL_TOHIT, 0, 0, IPL_TOHIT, 0, 0, IPL_TOHIT, 0, 0 }, - { "Scavenger Carapace", UITYPE_BREASTPLATE, 13, 4, 14000, IPL_GETHIT, 15, 15, IPL_AC_CURSE, 30, 30, IPL_DEX, 5, 5, IPL_LIGHTRES, 40, 40, IPL_TOHIT, 0, 0, IPL_TOHIT, 0, 0 }, - { "Nightscape", UITYPE_CAPE, 16, 6, 11600, IPL_FASTRECOVER, 2, 2, IPL_LIGHT_CURSE, 4, 4, IPL_SETAC, 15, 15, IPL_DEX, 3, 3, IPL_ALLRES, 20, 20, IPL_INVCURS, 138, 0 }, - { "Naj's Light Plate", UITYPE_PLATEMAIL, 19, 6, 78700, IPL_NOMINSTR, 0, 0, IPL_MAG, 5, 5, IPL_MANA, 20, 20, IPL_ALLRES, 20, 20, IPL_SPLLVLADD, 1, 1, IPL_INVCURS, 159, 0 }, - { "Demonspike Coat", UITYPE_FULLPLATE, 25, 5, 251175, IPL_SETAC, 100, 100, IPL_GETHIT, 6, 6, IPL_STR, 10, 10, IPL_INDESTRUCTIBLE, 0, 0, IPL_FIRERES, 50, 50, IPL_TOHIT, 0, 0 }, - { "The Deflector", UITYPE_BUCKLER, 1, 5, 1500, IPL_SETAC, 7, 7, IPL_ALLRES, 10, 10, IPL_DAMP_CURSE, 20, 20, IPL_TOHIT_CURSE, 5, 5, IPL_INVCURS, 83, 0, IPL_TOHIT, 0, 0 }, - { "Split Skull Shield", UITYPE_BUCKLER, 1, 6, 2025, IPL_SETAC, 10, 10, IPL_LIFE, 10, 10, IPL_STR, 2, 2, IPL_LIGHT_CURSE, 1, 1, IPL_SETDUR, 15, 15, IPL_INVCURS, 116, 0 }, - { "Dragon's Breach", UITYPE_KITESHIELD, 2, 6, 19200, IPL_FIRERES, 25, 25, IPL_STR, 5, 5, IPL_SETAC, 20, 20, IPL_MAG_CURSE, 5, 5, IPL_INDESTRUCTIBLE, 0, 0, IPL_INVCURS, 117, 0 }, - { "Blackoak Shield", UITYPE_SMALLSHIELD, 4, 6, 5725, IPL_DEX, 10, 10, IPL_VIT_CURSE, 10, 10, IPL_SETAC, 18, 18, IPL_LIGHT_CURSE, 1, 1, IPL_DUR, 150, 150, IPL_INVCURS, 146, 0 }, - { "Holy Defender", UITYPE_LARGESHIELD, 10, 6, 13800, IPL_SETAC, 15, 15, IPL_GETHIT, 2, 2, IPL_FIRERES, 20, 20, IPL_DUR, 200, 200, IPL_FASTBLOCK, 1, 1, IPL_INVCURS, 146, 0 }, - { "Stormshield", UITYPE_GOTHSHIELD, 24, 6, 49000, IPL_SETAC, 40, 40, IPL_GETHIT_CURSE, 4, 4, IPL_STR, 10, 10, IPL_INDESTRUCTIBLE, 0, 0, IPL_FASTBLOCK, 1, 1, IPL_INVCURS, 148, 0 }, - { "Bramble", UITYPE_RING, 1, 4, 1000, IPL_ATTRIBS_CURSE, 2, 2, IPL_DAMMOD, 3, 3, IPL_MANA, 10, 10, IPL_INVCURS, 9, 0, IPL_TOHIT, 0, 0, IPL_TOHIT, 0, 0 }, - { "Ring of Regha", UITYPE_RING, 1, 6, 4175, IPL_MAG, 10, 10, IPL_MAGICRES, 10, 10, IPL_LIGHT, 1, 1, IPL_STR_CURSE, 3, 3, IPL_DEX_CURSE, 3, 3, IPL_INVCURS, 11, 0 }, - { "The Bleeder", UITYPE_RING, 2, 4, 8500, IPL_MAGICRES, 20, 20, IPL_MANA, 30, 30, IPL_LIFE_CURSE, 10, 10, IPL_INVCURS, 8, 0, IPL_TOHIT, 0, 0, IPL_TOHIT, 0, 0 }, - { "Constricting Ring", UITYPE_RING, 5, 3, 62000, IPL_ALLRES, 75, 75, IPL_DRAINLIFE, 0, 0, IPL_INVCURS, 14, 0, IPL_TOHIT, 0, 0, IPL_TOHIT, 0, 0, IPL_TOHIT, 0, 0 }, - { "Ring of Engagement", UITYPE_RING, 11, 5, 12476, IPL_GETHIT, 1, 2, IPL_THORNS, 1, 3, IPL_SETAC, 5, 5, IPL_TARGAC, 4, 12, IPL_INVCURS, 13, 0, IPL_TOHIT, 0, 0 }, - { "", UITYPE_INVALID, 0, 0, 0, IPL_TOHIT, 0, 0, IPL_TOHIT, 0, 0, IPL_TOHIT, 0, 0, IPL_TOHIT, 0, 0, IPL_TOHIT, 0, 0, IPL_TOHIT, 0, 0 } - // clang-format on -}; +#include "diablo.h" + +ItemDataStruct AllItemsList[157] = { + // 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 + { IDROP_REGULAR, ICLASS_GOLD, ILOC_UNEQUIPABLE, ICURS_GOLD, 11, UITYPE_NONE, "Gold", NULL, 1, 0, 0, 0, 0, 0, 0, 0, 0, ISPL_NONE, IMISC_NONE, SPL_NULL, TRUE, 0, 0 }, + { IDROP_NEVER, ICLASS_WEAPON, ILOC_ONEHAND, ICURS_SHORT_SWORD, 1, UITYPE_NONE, "Short Sword", NULL, 2, 20, 2, 6, 0, 0, 18, 0, 0, ISPL_NONE, IMISC_NONE, SPL_NULL, FALSE, 50, 50 }, + { IDROP_NEVER, ICLASS_ARMOR, ILOC_ONEHAND, ICURS_BUCKLER, 5, UITYPE_NONE, "Buckler", NULL, 2, 10, 0, 0, 3, 3, 0, 0, 0, ISPL_NONE, IMISC_NONE, SPL_NULL, FALSE, 50, 50 }, + { IDROP_NEVER, ICLASS_WEAPON, ILOC_ONEHAND, ICURS_CLUB, 4, UITYPE_SPIKCLUB, "Club", NULL, 1, 20, 1, 6, 0, 0, 0, 0, 0, ISPL_NONE, IMISC_NONE, SPL_NULL, FALSE, 20, 20 }, + { IDROP_NEVER, ICLASS_WEAPON, ILOC_TWOHAND, ICURS_SHORT_BOW, 3, UITYPE_NONE, "Short Bow", NULL, 1, 30, 1, 4, 0, 0, 0, 0, 0, ISPL_NONE, IMISC_NONE, SPL_NULL, FALSE, 100, 100 }, + { IDROP_NEVER, ICLASS_WEAPON, ILOC_TWOHAND, ICURS_SHORT_STAFF, 10, UITYPE_NONE, "Short Staff of Charged Bolt", NULL, 1, 25, 2, 4, 0, 0, 0, 20, 0, ISPL_NONE, IMISC_STAFF, SPL_CBOLT, FALSE, 520, 520 }, + { IDROP_NEVER, ICLASS_WEAPON, ILOC_TWOHAND, ICURS_CLEAVER, 2, UITYPE_CLEAVER, "Cleaver", NULL, 10, 10, 4, 24, 0, 0, 0, 0, 0, ISPL_NONE, IMISC_UNIQUE, SPL_NULL, FALSE, 2000, 2000 }, + { IDROP_NEVER, ICLASS_ARMOR, ILOC_HELM, ICURS_THE_UNDEAD_CROWN, 7, UITYPE_SKCROWN, "The Undead Crown", NULL, 0, 50, 0, 0, 15, 15, 0, 0, 0, ISPL_RNDSTEALLIFE, IMISC_UNIQUE, SPL_NULL, FALSE, 10000, 10000 }, + { IDROP_NEVER, ICLASS_MISC, ILOC_RING, ICURS_EMPYREAN_BAND, 12, UITYPE_INFRARING, "Empyrean Band", NULL, 0, 0, 0, 0, 0, 0, 0, 0, 0, ISPL_NONE, IMISC_UNIQUE, SPL_NULL, FALSE, 8000, 8000 }, + { IDROP_NEVER, ICLASS_QUEST, ILOC_UNEQUIPABLE, ICURS_MAGIC_ROCK, 0, UITYPE_NONE, "Magic Rock", NULL, 0, 0, 0, 0, 0, 0, 0, 0, 0, ISPL_NONE, IMISC_NONE, SPL_NULL, FALSE, 0, 0 }, + { IDROP_NEVER, ICLASS_MISC, ILOC_AMULET, ICURS_OPTIC_AMULET, 13, UITYPE_OPTAMULET, "Optic Amulet", NULL, 0, 0, 0, 0, 0, 0, 0, 0, 0, ISPL_NONE, IMISC_UNIQUE, SPL_NULL, FALSE, 5000, 5000 }, + { IDROP_NEVER, ICLASS_MISC, ILOC_RING, ICURS_RING_OF_TRUTH, 12, UITYPE_TRING, "Ring of Truth", NULL, 0, 0, 0, 0, 0, 0, 0, 0, 0, ISPL_NONE, IMISC_UNIQUE, SPL_NULL, FALSE, 1000, 1000 }, + { IDROP_NEVER, ICLASS_QUEST, ILOC_UNEQUIPABLE, ICURS_TAVERN_SIGN, 0, UITYPE_NONE, "Tavern Sign", NULL, 0, 0, 0, 0, 0, 0, 0, 0, 0, ISPL_NONE, IMISC_NONE, SPL_NULL, FALSE, 0, 0 }, + { IDROP_NEVER, ICLASS_ARMOR, ILOC_HELM, ICURS_HARLEQUIN_CREST, 7, UITYPE_HARCREST, "Harlequin Crest", NULL, 0, 15, 0, 0, 0, 0, 0, 0, 0, ISPL_NONE, IMISC_UNIQUE, SPL_NULL, FALSE, 15, 20 }, + { IDROP_NEVER, ICLASS_ARMOR, ILOC_HELM, ICURS_VIEL_OF_STEEL, 7, UITYPE_STEELVEIL, "Veil of Steel", NULL, 0, 60, 0, 0, 18, 18, 0, 0, 0, ISPL_NONE, IMISC_UNIQUE, SPL_NULL, FALSE, 0, 0 }, + { IDROP_NEVER, ICLASS_MISC, ILOC_UNEQUIPABLE, ICURS_GOLDEN_ELIXIR, 0, UITYPE_ELIXIR, "Golden Elixir", NULL, 15, 0, 0, 0, 0, 0, 0, 0, 0, ISPL_NONE, IMISC_NONE, SPL_NULL, FALSE, 0, 0 }, + { IDROP_NEVER, ICLASS_QUEST, ILOC_UNEQUIPABLE, ICURS_ANVIL_OF_FURY, 0, UITYPE_NONE, "Anvil of Fury", NULL, 0, 0, 0, 0, 0, 0, 0, 0, 0, ISPL_NONE, IMISC_NONE, SPL_NULL, FALSE, 0, 0 }, + { IDROP_NEVER, ICLASS_QUEST, ILOC_UNEQUIPABLE, ICURS_BLACK_MUSHROOM, 0, UITYPE_NONE, "Black Mushroom", NULL, 0, 0, 0, 0, 0, 0, 0, 0, 0, ISPL_NONE, IMISC_NONE, SPL_NULL, FALSE, 0, 0 }, + { IDROP_NEVER, ICLASS_QUEST, ILOC_UNEQUIPABLE, ICURS_BRAIN, 0, UITYPE_NONE, "Brain", NULL, 0, 0, 0, 0, 0, 0, 0, 0, 0, ISPL_NONE, IMISC_NONE, SPL_NULL, FALSE, 0, 0 }, + { IDROP_NEVER, ICLASS_QUEST, ILOC_UNEQUIPABLE, ICURS_FUNGAL_TOME, 0, UITYPE_NONE, "Fungal Tome", NULL, 0, 0, 0, 0, 0, 0, 0, 0, 0, ISPL_NONE, IMISC_NONE, SPL_NULL, FALSE, 0, 0 }, + { IDROP_NEVER, ICLASS_MISC, ILOC_UNEQUIPABLE, ICURS_SPECTRAL_ELIXIR, 0, UITYPE_ELIXIR, "Spectral Elixir", NULL, 15, 0, 0, 0, 0, 0, 0, 0, 0, ISPL_NONE, IMISC_SPECELIX, SPL_NULL, FALSE, 0, 0 }, + { IDROP_NEVER, ICLASS_QUEST, ILOC_UNEQUIPABLE, ICURS_BLOOD_STONE, 0, UITYPE_NONE, "Blood Stone", NULL, 0, 0, 0, 0, 0, 0, 0, 0, 0, ISPL_NONE, IMISC_NONE, SPL_NULL, FALSE, 0, 0 }, + { IDROP_NEVER, ICLASS_QUEST, ILOC_UNEQUIPABLE, ICURS_MAP_OF_THE_STARS, 0, UITYPE_MAPOFDOOM, "Map of the Stars", NULL, 0, 0, 0, 0, 0, 0, 0, 0, 0, ISPL_NONE, IMISC_MAPOFDOOM, SPL_NULL, TRUE, 0, 0 }, + { IDROP_NEVER, ICLASS_QUEST, ILOC_UNEQUIPABLE, ICURS_EAR_SORCEROR, 0, UITYPE_NONE, "Heart", NULL, 0, 0, 0, 0, 0, 0, 0, 0, 0, ISPL_NONE, IMISC_EAR, SPL_NULL, FALSE, 0, 0 }, + { IDROP_NEVER, ICLASS_MISC, ILOC_UNEQUIPABLE, ICURS_POTION_OF_HEALING, 0, UITYPE_NONE, "Potion of Healing", NULL, 0, 0, 0, 0, 0, 0, 0, 0, 0, ISPL_NONE, IMISC_HEAL, SPL_NULL, TRUE, 50, 50 }, + { IDROP_NEVER, ICLASS_MISC, ILOC_UNEQUIPABLE, ICURS_POTION_OF_MANA, 0, UITYPE_NONE, "Potion of Mana", NULL, 0, 0, 0, 0, 0, 0, 0, 0, 0, ISPL_NONE, IMISC_MANA, SPL_NULL, TRUE, 50, 50 }, + { IDROP_NEVER, ICLASS_MISC, ILOC_UNEQUIPABLE, ICURS_SCROLL_OF, 0, UITYPE_NONE, "Scroll of Identify", NULL, 1, 0, 0, 0, 0, 0, 0, 0, 0, ISPL_NONE, IMISC_SCROLL, SPL_IDENTIFY, TRUE, 200, 200 }, + { IDROP_NEVER, ICLASS_MISC, ILOC_UNEQUIPABLE, ICURS_SCROLL_OF, 0, UITYPE_NONE, "Scroll of Town Portal", NULL, 4, 0, 0, 0, 0, 0, 0, 0, 0, ISPL_NONE, IMISC_SCROLL, SPL_TOWN, TRUE, 200, 200 }, + { IDROP_NEVER, ICLASS_ARMOR, ILOC_ARMOR, ICURS_ARKAINES_VALOR, 8, UITYPE_ARMOFVAL, "Arkaine's Valor", NULL, 0, 40, 0, 0, 0, 0, 0, 0, 0, ISPL_NONE, IMISC_UNIQUE, SPL_NULL, FALSE, 0, 0 }, + { IDROP_NEVER, ICLASS_MISC, ILOC_UNEQUIPABLE, ICURS_POTION_OF_FULL_HEALING, 0, UITYPE_NONE, "Potion of Full Healing", NULL, 1, 0, 0, 0, 0, 0, 0, 0, 0, ISPL_NONE, IMISC_FULLHEAL, SPL_NULL, TRUE, 150, 150 }, + { IDROP_NEVER, ICLASS_MISC, ILOC_UNEQUIPABLE, ICURS_POTION_OF_FULL_MANA, 0, UITYPE_NONE, "Potion of Full Mana", NULL, 1, 0, 0, 0, 0, 0, 0, 0, 0, ISPL_NONE, IMISC_FULLMANA, SPL_NULL, TRUE, 150, 150 }, + { IDROP_NEVER, ICLASS_WEAPON, ILOC_ONEHAND, ICURS_BROAD_SWORD, 1, UITYPE_GRISWOLD, "Griswold's Edge", NULL, 8, 50, 4, 12, 0, 0, 40, 0, 0, ISPL_NONE, IMISC_UNIQUE, SPL_NULL, FALSE, 750, 750 }, + { IDROP_NEVER, ICLASS_WEAPON, ILOC_ONEHAND, ICURS_MACE, 4, UITYPE_LGTFORGE, "Lightforge", NULL, 2, 32, 1, 8, 0, 0, 16, 0, 0, ISPL_NONE, IMISC_UNIQUE, SPL_NULL, FALSE, 200, 200 }, + { IDROP_NEVER, ICLASS_MISC, ILOC_UNEQUIPABLE, ICURS_STAFF_OF_LAZARUS, 0, UITYPE_LAZSTAFF, "Staff of Lazarus", NULL, 0, 0, 0, 0, 0, 0, 0, 0, 0, ISPL_NONE, IMISC_NONE, SPL_NULL, FALSE, 0, 0 }, + { IDROP_NEVER, ICLASS_MISC, ILOC_UNEQUIPABLE, ICURS_SCROLL_OF, 0, UITYPE_NONE, "Scroll of Resurrect", NULL, 1, 0, 0, 0, 0, 0, 0, 0, 0, ISPL_NONE, IMISC_SCROLLT, SPL_RESURRECT, TRUE, 250, 250 }, + { IDROP_NEVER, ICLASS_NONE, ILOC_NONE, ICURS_POTION_OF_FULL_MANA, 0, UITYPE_NONE, NULL, NULL, 0, 0, 0, 0, 0, 0, 0, 0, 0, ISPL_NONE, IMISC_NONE, SPL_NULL, FALSE, 0, 0 }, + { IDROP_NEVER, ICLASS_NONE, ILOC_NONE, ICURS_POTION_OF_FULL_MANA, 0, UITYPE_NONE, NULL, NULL, 0, 0, 0, 0, 0, 0, 0, 0, 0, ISPL_NONE, IMISC_NONE, SPL_NULL, FALSE, 0, 0 }, + { IDROP_NEVER, ICLASS_NONE, ILOC_NONE, ICURS_POTION_OF_FULL_MANA, 0, UITYPE_NONE, NULL, NULL, 0, 0, 0, 0, 0, 0, 0, 0, 0, ISPL_NONE, IMISC_NONE, SPL_NULL, FALSE, 0, 0 }, + { IDROP_NEVER, ICLASS_NONE, ILOC_NONE, ICURS_POTION_OF_FULL_MANA, 0, UITYPE_NONE, NULL, NULL, 0, 0, 0, 0, 0, 0, 0, 0, 0, ISPL_NONE, IMISC_NONE, SPL_NULL, FALSE, 0, 0 }, + { IDROP_NEVER, ICLASS_NONE, ILOC_NONE, ICURS_POTION_OF_FULL_MANA, 0, UITYPE_NONE, NULL, NULL, 0, 0, 0, 0, 0, 0, 0, 0, 0, ISPL_NONE, IMISC_NONE, SPL_NULL, FALSE, 0, 0 }, + { IDROP_NEVER, ICLASS_NONE, ILOC_NONE, ICURS_POTION_OF_FULL_MANA, 0, UITYPE_NONE, NULL, NULL, 0, 0, 0, 0, 0, 0, 0, 0, 0, ISPL_NONE, IMISC_NONE, SPL_NULL, FALSE, 0, 0 }, + { IDROP_NEVER, ICLASS_NONE, ILOC_NONE, ICURS_POTION_OF_FULL_MANA, 0, UITYPE_NONE, NULL, NULL, 0, 0, 0, 0, 0, 0, 0, 0, 0, ISPL_NONE, IMISC_NONE, SPL_NULL, FALSE, 0, 0 }, + { IDROP_NEVER, ICLASS_NONE, ILOC_NONE, ICURS_POTION_OF_FULL_MANA, 0, UITYPE_NONE, NULL, NULL, 0, 0, 0, 0, 0, 0, 0, 0, 0, ISPL_NONE, IMISC_NONE, SPL_NULL, FALSE, 0, 0 }, + { IDROP_NEVER, ICLASS_NONE, ILOC_NONE, ICURS_POTION_OF_FULL_MANA, 0, UITYPE_NONE, NULL, NULL, 0, 0, 0, 0, 0, 0, 0, 0, 0, ISPL_NONE, IMISC_NONE, SPL_NULL, FALSE, 0, 0 }, + { IDROP_NEVER, ICLASS_NONE, ILOC_NONE, ICURS_POTION_OF_FULL_MANA, 0, UITYPE_NONE, NULL, NULL, 0, 0, 0, 0, 0, 0, 0, 0, 0, ISPL_NONE, IMISC_NONE, SPL_NULL, FALSE, 0, 0 }, + { IDROP_NEVER, ICLASS_NONE, ILOC_NONE, ICURS_POTION_OF_FULL_MANA, 0, UITYPE_NONE, NULL, NULL, 0, 0, 0, 0, 0, 0, 0, 0, 0, ISPL_NONE, IMISC_NONE, SPL_NULL, FALSE, 0, 0 }, + { IDROP_NEVER, ICLASS_NONE, ILOC_NONE, ICURS_POTION_OF_FULL_MANA, 0, UITYPE_NONE, NULL, NULL, 0, 0, 0, 0, 0, 0, 0, 0, 0, ISPL_NONE, IMISC_NONE, SPL_NULL, FALSE, 0, 0 }, + { IDROP_NEVER, ICLASS_NONE, ILOC_NONE, ICURS_POTION_OF_FULL_MANA, 0, UITYPE_NONE, NULL, NULL, 0, 0, 0, 0, 0, 0, 0, 0, 0, ISPL_NONE, IMISC_NONE, SPL_NULL, FALSE, 0, 0 }, + { IDROP_REGULAR, ICLASS_ARMOR, ILOC_HELM, ICURS_CAP, 7, UITYPE_NONE, "Cap", "Cap", 1, 15, 0, 0, 1, 3, 0, 0, 0, ISPL_NONE, IMISC_NONE, SPL_NULL, FALSE, 15, 20 }, + { IDROP_REGULAR, ICLASS_ARMOR, ILOC_HELM, ICURS_SKULL_CAP, 7, UITYPE_SKULLCAP, "Skull Cap", "Cap", 4, 20, 0, 0, 2, 4, 0, 0, 0, ISPL_NONE, IMISC_NONE, SPL_NULL, FALSE, 25, 30 }, + { IDROP_REGULAR, ICLASS_ARMOR, ILOC_HELM, ICURS_HELM, 7, UITYPE_HELM, "Helm", "Helm", 8, 30, 0, 0, 4, 6, 25, 0, 0, ISPL_NONE, IMISC_NONE, SPL_NULL, FALSE, 40, 70 }, + { IDROP_REGULAR, ICLASS_ARMOR, ILOC_HELM, ICURS_FULL_HELM, 7, UITYPE_NONE, "Full Helm", "Helm", 12, 35, 0, 0, 6, 8, 35, 0, 0, ISPL_NONE, IMISC_NONE, SPL_NULL, FALSE, 90, 130 }, + { IDROP_REGULAR, ICLASS_ARMOR, ILOC_HELM, ICURS_CROWN, 7, UITYPE_CROWN, "Crown", "Crown", 16, 40, 0, 0, 8, 12, 0, 0, 0, ISPL_NONE, IMISC_NONE, SPL_NULL, FALSE, 200, 300 }, + { IDROP_REGULAR, ICLASS_ARMOR, ILOC_HELM, ICURS_GREAT_HELM, 7, UITYPE_GREATHELM, "Great Helm", "Helm", 20, 60, 0, 0, 10, 15, 50, 0, 0, ISPL_NONE, IMISC_NONE, SPL_NULL, FALSE, 400, 500 }, + { IDROP_REGULAR, ICLASS_ARMOR, ILOC_ARMOR, ICURS_CAPE, 6, UITYPE_CAPE, "Cape", "Cape", 1, 12, 0, 0, 1, 5, 0, 0, 0, ISPL_NONE, IMISC_NONE, SPL_NULL, FALSE, 10, 50 }, + { IDROP_REGULAR, ICLASS_ARMOR, ILOC_ARMOR, ICURS_RAGS, 6, UITYPE_RAGS, "Rags", "Rags", 1, 6, 0, 0, 2, 6, 0, 0, 0, ISPL_NONE, IMISC_NONE, SPL_NULL, FALSE, 5, 25 }, + { IDROP_REGULAR, ICLASS_ARMOR, ILOC_ARMOR, ICURS_CLOAK, 6, UITYPE_CLOAK, "Cloak", "Cloak", 2, 18, 0, 0, 3, 7, 0, 0, 0, ISPL_NONE, IMISC_NONE, SPL_NULL, FALSE, 40, 70 }, + { IDROP_REGULAR, ICLASS_ARMOR, ILOC_ARMOR, ICURS_ROBE, 6, UITYPE_ROBE, "Robe", "Robe", 3, 24, 0, 0, 4, 7, 0, 0, 0, ISPL_NONE, IMISC_NONE, SPL_NULL, FALSE, 75, 125 }, + { IDROP_REGULAR, ICLASS_ARMOR, ILOC_ARMOR, ICURS_QUILTED_ARMOR, 6, UITYPE_NONE, "Quilted Armor", "Armor", 4, 30, 0, 0, 7, 10, 0, 0, 0, ISPL_NONE, IMISC_NONE, SPL_NULL, FALSE, 200, 300 }, + { IDROP_REGULAR, ICLASS_ARMOR, ILOC_ARMOR, ICURS_LEATHER_ARMOR, 6, UITYPE_LEATHARMOR, "Leather Armor", "Armor", 6, 35, 0, 0, 10, 13, 0, 0, 0, ISPL_NONE, IMISC_NONE, SPL_NULL, FALSE, 300, 400 }, + { IDROP_REGULAR, ICLASS_ARMOR, ILOC_ARMOR, ICURS_HARD_LEATHER_ARMOR, 6, UITYPE_NONE, "Hard Leather Armor", "Armor", 7, 40, 0, 0, 11, 14, 0, 0, 0, ISPL_NONE, IMISC_NONE, SPL_NULL, FALSE, 450, 550 }, + { IDROP_REGULAR, ICLASS_ARMOR, ILOC_ARMOR, ICURS_STUDDED_LEATHER_ARMOR, 6, UITYPE_STUDARMOR, "Studded Leather Armor", "Armor", 9, 45, 0, 0, 15, 17, 20, 0, 0, ISPL_NONE, IMISC_NONE, SPL_NULL, FALSE, 700, 800 }, + { IDROP_REGULAR, ICLASS_ARMOR, ILOC_ARMOR, ICURS_RING_MAIL, 8, UITYPE_NONE, "Ring Mail", "Mail", 11, 50, 0, 0, 17, 20, 25, 0, 0, ISPL_NONE, IMISC_NONE, SPL_NULL, FALSE, 900, 1100 }, + { IDROP_REGULAR, ICLASS_ARMOR, ILOC_ARMOR, ICURS_CHAIN_MAIL, 8, UITYPE_CHAINMAIL, "Chain Mail", "Mail", 13, 55, 0, 0, 18, 22, 30, 0, 0, ISPL_NONE, IMISC_NONE, SPL_NULL, FALSE, 1250, 1750 }, + { IDROP_REGULAR, ICLASS_ARMOR, ILOC_ARMOR, ICURS_SCALE_MAIL, 8, UITYPE_NONE, "Scale Mail", "Mail", 15, 60, 0, 0, 23, 28, 35, 0, 0, ISPL_NONE, IMISC_NONE, SPL_NULL, FALSE, 2300, 2800 }, + { IDROP_REGULAR, ICLASS_ARMOR, ILOC_ARMOR, ICURS_BREAST_PLATE, 9, UITYPE_BREASTPLATE, "Breast Plate", "Plate", 16, 80, 0, 0, 20, 24, 40, 0, 0, ISPL_NONE, IMISC_NONE, SPL_NULL, FALSE, 2800, 3200 }, + { IDROP_REGULAR, ICLASS_ARMOR, ILOC_ARMOR, ICURS_SPLINT_MAIL, 8, UITYPE_NONE, "Splint Mail", "Mail", 17, 65, 0, 0, 30, 35, 40, 0, 0, ISPL_NONE, IMISC_NONE, SPL_NULL, FALSE, 3250, 3750 }, + { IDROP_REGULAR, ICLASS_ARMOR, ILOC_ARMOR, ICURS_FIELD_PLATE, 9, UITYPE_PLATEMAIL, "Plate Mail", "Plate", 19, 75, 0, 0, 42, 50, 60, 0, 0, ISPL_NONE, IMISC_NONE, SPL_NULL, FALSE, 4600, 5400 }, + { IDROP_REGULAR, ICLASS_ARMOR, ILOC_ARMOR, ICURS_FIELD_PLATE, 9, UITYPE_NONE, "Field Plate", "Plate", 21, 80, 0, 0, 40, 45, 65, 0, 0, ISPL_NONE, IMISC_NONE, SPL_NULL, FALSE, 5800, 6200 }, + { IDROP_REGULAR, ICLASS_ARMOR, ILOC_ARMOR, ICURS_GOTHIC_PLATE, 9, UITYPE_NONE, "Gothic Plate", "Plate", 23, 100, 0, 0, 50, 60, 80, 0, 0, ISPL_NONE, IMISC_NONE, SPL_NULL, FALSE, 8000, 10000 }, + { IDROP_REGULAR, ICLASS_ARMOR, ILOC_ARMOR, ICURS_FULL_PLATE_MAIL, 9, UITYPE_FULLPLATE, "Full Plate Mail", "Plate", 25, 90, 0, 0, 60, 75, 90, 0, 0, ISPL_NONE, IMISC_NONE, SPL_NULL, FALSE, 6500, 8000 }, + { IDROP_REGULAR, ICLASS_ARMOR, ILOC_ONEHAND, ICURS_BUCKLER, 5, UITYPE_BUCKLER, "Buckler", "Shield", 1, 16, 0, 0, 1, 5, 0, 0, 0, ISPL_NONE, IMISC_NONE, SPL_NULL, FALSE, 30, 70 }, + { IDROP_REGULAR, ICLASS_ARMOR, ILOC_ONEHAND, ICURS_SMALL_SHIELD, 5, UITYPE_SMALLSHIELD, "Small Shield", "Shield", 5, 24, 0, 0, 3, 8, 25, 0, 0, ISPL_NONE, IMISC_NONE, SPL_NULL, FALSE, 90, 130 }, + { IDROP_REGULAR, ICLASS_ARMOR, ILOC_ONEHAND, ICURS_LARGE_SHIELD, 5, UITYPE_LARGESHIELD, "Large Shield", "Shield", 9, 32, 0, 0, 5, 10, 40, 0, 0, ISPL_NONE, IMISC_NONE, SPL_NULL, FALSE, 200, 300 }, + { IDROP_REGULAR, ICLASS_ARMOR, ILOC_ONEHAND, ICURS_KITE_SHIELD, 5, UITYPE_KITESHIELD, "Kite Shield", "Shield", 14, 40, 0, 0, 8, 15, 50, 0, 0, ISPL_NONE, IMISC_NONE, SPL_NULL, FALSE, 400, 700 }, + { IDROP_REGULAR, ICLASS_ARMOR, ILOC_ONEHAND, ICURS_TOWER_SHIELD, 5, UITYPE_GOTHSHIELD, "Tower Shield", "Shield", 20, 50, 0, 0, 12, 20, 60, 0, 0, ISPL_NONE, IMISC_NONE, SPL_NULL, FALSE, 850, 1200 }, + { IDROP_REGULAR, ICLASS_ARMOR, ILOC_ONEHAND, ICURS_GOTHIC_SHIELD, 5, UITYPE_GOTHSHIELD, "Gothic Shield", "Shield", 23, 60, 0, 0, 14, 18, 80, 0, 0, ISPL_NONE, IMISC_NONE, SPL_NULL, FALSE, 2300, 2700 }, + { IDROP_REGULAR, ICLASS_MISC, ILOC_UNEQUIPABLE, ICURS_POTION_OF_HEALING, 0, UITYPE_NONE, "Potion of Healing", NULL, 1, 0, 0, 0, 0, 0, 0, 0, 0, ISPL_NONE, IMISC_HEAL, SPL_NULL, TRUE, 50, 50 }, + { IDROP_REGULAR, ICLASS_MISC, ILOC_UNEQUIPABLE, ICURS_POTION_OF_FULL_HEALING, 0, UITYPE_NONE, "Potion of Full Healing", NULL, 1, 0, 0, 0, 0, 0, 0, 0, 0, ISPL_NONE, IMISC_FULLHEAL, SPL_NULL, TRUE, 150, 150 }, + { IDROP_REGULAR, ICLASS_MISC, ILOC_UNEQUIPABLE, ICURS_POTION_OF_MANA, 0, UITYPE_NONE, "Potion of Mana", NULL, 1, 0, 0, 0, 0, 0, 0, 0, 0, ISPL_NONE, IMISC_MANA, SPL_NULL, TRUE, 50, 50 }, + { IDROP_REGULAR, ICLASS_MISC, ILOC_UNEQUIPABLE, ICURS_POTION_OF_FULL_MANA, 0, UITYPE_NONE, "Potion of Full Mana", NULL, 1, 0, 0, 0, 0, 0, 0, 0, 0, ISPL_NONE, IMISC_FULLMANA, SPL_NULL, TRUE, 150, 150 }, + { IDROP_REGULAR, ICLASS_MISC, ILOC_UNEQUIPABLE, ICURS_POTION_OF_REJUVENATION, 0, UITYPE_NONE, "Potion of Rejuvenation", NULL, 3, 0, 0, 0, 0, 0, 0, 0, 0, ISPL_NONE, IMISC_REJUV, SPL_NULL, TRUE, 120, 120 }, + { IDROP_REGULAR, ICLASS_MISC, ILOC_UNEQUIPABLE, ICURS_POTION_OF_FULL_REJUVENATION, 0, UITYPE_NONE, "Potion of Full Rejuvenation", NULL, 7, 0, 0, 0, 0, 0, 0, 0, 0, ISPL_NONE, IMISC_FULLREJUV, SPL_NULL, TRUE, 600, 600 }, + { IDROP_REGULAR, ICLASS_MISC, ILOC_UNEQUIPABLE, ICURS_ELIXIR_OF_STRENGTH, 0, UITYPE_NONE, "Elixir of Strength", NULL, 15, 0, 0, 0, 0, 0, 0, 0, 0, ISPL_NONE, IMISC_ELIXSTR, SPL_NULL, TRUE, 5000, 5000 }, + { IDROP_REGULAR, ICLASS_MISC, ILOC_UNEQUIPABLE, ICURS_ELIXIR_OF_MAGIC, 0, UITYPE_NONE, "Elixir of Magic", NULL, 15, 0, 0, 0, 0, 0, 0, 0, 0, ISPL_NONE, IMISC_ELIXMAG, SPL_NULL, TRUE, 5000, 5000 }, + { IDROP_REGULAR, ICLASS_MISC, ILOC_UNEQUIPABLE, ICURS_ELIXIR_OF_DEXTERITY, 0, UITYPE_NONE, "Elixir of Dexterity", NULL, 15, 0, 0, 0, 0, 0, 0, 0, 0, ISPL_NONE, IMISC_ELIXDEX, SPL_NULL, TRUE, 5000, 5000 }, + { IDROP_REGULAR, ICLASS_MISC, ILOC_UNEQUIPABLE, ICURS_ELIXIR_OF_VITALITY, 0, UITYPE_NONE, "Elixir of Vitality", NULL, 20, 0, 0, 0, 0, 0, 0, 0, 0, ISPL_NONE, IMISC_ELIXVIT, SPL_NULL, TRUE, 5000, 5000 }, + { IDROP_REGULAR, ICLASS_MISC, ILOC_UNEQUIPABLE, ICURS_SCROLL_OF, 0, UITYPE_NONE, "Scroll of Healing", NULL, 1, 0, 0, 0, 0, 0, 0, 0, 0, ISPL_NONE, IMISC_SCROLL, SPL_HEAL, TRUE, 50, 50 }, + { IDROP_REGULAR, ICLASS_MISC, ILOC_UNEQUIPABLE, ICURS_SCROLL_OF, 0, UITYPE_NONE, "Scroll of Lightning", NULL, 4, 0, 0, 0, 0, 0, 0, 0, 0, ISPL_NONE, IMISC_SCROLLT, SPL_LIGHTNING, TRUE, 150, 150 }, + { IDROP_REGULAR, ICLASS_MISC, ILOC_UNEQUIPABLE, ICURS_SCROLL_OF, 0, UITYPE_NONE, "Scroll of Identify", NULL, 1, 0, 0, 0, 0, 0, 0, 0, 0, ISPL_NONE, IMISC_SCROLL, SPL_IDENTIFY, TRUE, 100, 100 }, + { IDROP_REGULAR, ICLASS_MISC, ILOC_UNEQUIPABLE, ICURS_SCROLL_OF, 0, UITYPE_NONE, "Scroll of Resurrect", NULL, 1, 0, 0, 0, 0, 0, 0, 0, 0, ISPL_NONE, IMISC_SCROLLT, SPL_RESURRECT, TRUE, 250, 250 }, + { IDROP_REGULAR, ICLASS_MISC, ILOC_UNEQUIPABLE, ICURS_SCROLL_OF, 0, UITYPE_NONE, "Scroll of Fire Wall", NULL, 4, 0, 0, 0, 0, 0, 0, 17, 0, ISPL_NONE, IMISC_SCROLLT, SPL_FIREWALL, TRUE, 400, 400 }, + { IDROP_REGULAR, ICLASS_MISC, ILOC_UNEQUIPABLE, ICURS_SCROLL_OF, 0, UITYPE_NONE, "Scroll of Inferno", NULL, 1, 0, 0, 0, 0, 0, 0, 19, 0, ISPL_NONE, IMISC_SCROLLT, SPL_FLAME, TRUE, 100, 100 }, + { IDROP_REGULAR, ICLASS_MISC, ILOC_UNEQUIPABLE, ICURS_SCROLL_OF, 0, UITYPE_NONE, "Scroll of Town Portal", NULL, 4, 0, 0, 0, 0, 0, 0, 0, 0, ISPL_NONE, IMISC_SCROLL, SPL_TOWN, TRUE, 200, 200 }, + { IDROP_REGULAR, ICLASS_MISC, ILOC_UNEQUIPABLE, ICURS_SCROLL_OF, 0, UITYPE_NONE, "Scroll of Flash", NULL, 6, 0, 0, 0, 0, 0, 0, 21, 0, ISPL_NONE, IMISC_SCROLLT, SPL_FLASH, TRUE, 500, 500 }, + { IDROP_REGULAR, ICLASS_MISC, ILOC_UNEQUIPABLE, ICURS_SCROLL_OF, 0, UITYPE_NONE, "Scroll of Infravision", NULL, 8, 0, 0, 0, 0, 0, 0, 23, 0, ISPL_NONE, IMISC_SCROLL, SPL_INFRA, TRUE, 600, 600 }, + { IDROP_REGULAR, ICLASS_MISC, ILOC_UNEQUIPABLE, ICURS_SCROLL_OF, 0, UITYPE_NONE, "Scroll of Phasing", NULL, 6, 0, 0, 0, 0, 0, 0, 25, 0, ISPL_NONE, IMISC_SCROLL, SPL_RNDTELEPORT, TRUE, 200, 200 }, + { IDROP_REGULAR, ICLASS_MISC, ILOC_UNEQUIPABLE, ICURS_SCROLL_OF, 0, UITYPE_NONE, "Scroll of Mana Shield", NULL, 8, 0, 0, 0, 0, 0, 0, 0, 0, ISPL_NONE, IMISC_SCROLL, SPL_MANASHIELD, TRUE, 1200, 1200 }, + { IDROP_REGULAR, ICLASS_MISC, ILOC_UNEQUIPABLE, ICURS_SCROLL_OF, 0, UITYPE_NONE, "Scroll of Flame Wave", NULL, 10, 0, 0, 0, 0, 0, 0, 29, 0, ISPL_NONE, IMISC_SCROLLT, SPL_WAVE, TRUE, 650, 650 }, + { IDROP_REGULAR, ICLASS_MISC, ILOC_UNEQUIPABLE, ICURS_SCROLL_OF, 0, UITYPE_NONE, "Scroll of Fireball", NULL, 8, 0, 0, 0, 0, 0, 0, 31, 0, ISPL_NONE, IMISC_SCROLLT, SPL_FIREBALL, TRUE, 300, 300 }, + { IDROP_REGULAR, ICLASS_MISC, ILOC_UNEQUIPABLE, ICURS_SCROLL_OF, 0, UITYPE_NONE, "Scroll of Stone Curse", NULL, 6, 0, 0, 0, 0, 0, 0, 33, 0, ISPL_NONE, IMISC_SCROLLT, SPL_STONE, TRUE, 800, 800 }, + { IDROP_REGULAR, ICLASS_MISC, ILOC_UNEQUIPABLE, ICURS_SCROLL_OF, 0, UITYPE_NONE, "Scroll of Chain Lightning", NULL, 10, 0, 0, 0, 0, 0, 0, 35, 0, ISPL_NONE, IMISC_SCROLLT, SPL_CHAIN, TRUE, 750, 750 }, + { IDROP_REGULAR, ICLASS_MISC, ILOC_UNEQUIPABLE, ICURS_SCROLL_OF, 0, UITYPE_NONE, "Scroll of Guardian", NULL, 12, 0, 0, 0, 0, 0, 0, 47, 0, ISPL_NONE, IMISC_SCROLLT, SPL_GUARDIAN, TRUE, 950, 950 }, + { IDROP_NEVER, ICLASS_MISC, ILOC_UNEQUIPABLE, ICURS_SCROLL_OF, 0, UITYPE_NONE, "Non Item", NULL, 0, 0, 0, 0, 0, 0, 0, 0, 0, ISPL_NONE, IMISC_NONE, SPL_NULL, FALSE, 0, 0 }, + { IDROP_REGULAR, ICLASS_MISC, ILOC_UNEQUIPABLE, ICURS_SCROLL_OF, 0, UITYPE_NONE, "Scroll of Nova", NULL, 14, 0, 0, 0, 0, 0, 0, 57, 0, ISPL_NONE, IMISC_SCROLL, SPL_NOVA, TRUE, 1300, 1300 }, + { IDROP_REGULAR, ICLASS_MISC, ILOC_UNEQUIPABLE, ICURS_SCROLL_OF, 0, UITYPE_NONE, "Scroll of Golem", NULL, 10, 0, 0, 0, 0, 0, 0, 51, 0, ISPL_NONE, IMISC_SCROLLT, SPL_GOLEM, TRUE, 1100, 1100 }, + { IDROP_NEVER, ICLASS_MISC, ILOC_UNEQUIPABLE, ICURS_SCROLL_OF, 0, UITYPE_NONE, "Scroll of None", NULL, 99, 0, 0, 0, 0, 0, 0, 61, 0, ISPL_NONE, IMISC_SCROLLT, SPL_NULL, TRUE, 1000, 1000 }, + { IDROP_REGULAR, ICLASS_MISC, ILOC_UNEQUIPABLE, ICURS_SCROLL_OF, 0, UITYPE_NONE, "Scroll of Teleport", NULL, 14, 0, 0, 0, 0, 0, 0, 81, 0, ISPL_NONE, IMISC_SCROLL, SPL_TELEPORT, TRUE, 3000, 3000 }, + { IDROP_REGULAR, ICLASS_MISC, ILOC_UNEQUIPABLE, ICURS_SCROLL_OF, 0, UITYPE_NONE, "Scroll of Apocalypse", NULL, 22, 0, 0, 0, 0, 0, 0, 117, 0, ISPL_NONE, IMISC_SCROLL, SPL_APOCA, TRUE, 2000, 2000 }, + { IDROP_REGULAR, ICLASS_MISC, ILOC_UNEQUIPABLE, ICURS_BOOK_BLUE, 0, UITYPE_NONE, "Book of ", NULL, 2, 0, 0, 0, 0, 0, 0, 0, 0, ISPL_NONE, IMISC_BOOK, SPL_NULL, TRUE, 0, 0 }, + { IDROP_REGULAR, ICLASS_MISC, ILOC_UNEQUIPABLE, ICURS_BOOK_BLUE, 0, UITYPE_NONE, "Book of ", NULL, 8, 0, 0, 0, 0, 0, 0, 0, 0, ISPL_NONE, IMISC_BOOK, SPL_NULL, TRUE, 0, 0 }, + { IDROP_REGULAR, ICLASS_MISC, ILOC_UNEQUIPABLE, ICURS_BOOK_BLUE, 0, UITYPE_NONE, "Book of ", NULL, 14, 0, 0, 0, 0, 0, 0, 0, 0, ISPL_NONE, IMISC_BOOK, SPL_NULL, TRUE, 0, 0 }, + { IDROP_REGULAR, ICLASS_MISC, ILOC_UNEQUIPABLE, ICURS_BOOK_BLUE, 0, UITYPE_NONE, "Book of ", NULL, 20, 0, 0, 0, 0, 0, 0, 0, 0, ISPL_NONE, IMISC_BOOK, SPL_NULL, TRUE, 0, 0 }, + { IDROP_REGULAR, ICLASS_WEAPON, ILOC_ONEHAND, ICURS_DAGGER, 1, UITYPE_DAGGER, "Dagger", "Dagger", 1, 16, 1, 4, 0, 0, 0, 0, 0, ISPL_NONE, IMISC_NONE, SPL_NULL, FALSE, 60, 60 }, + { IDROP_REGULAR, ICLASS_WEAPON, ILOC_ONEHAND, ICURS_SHORT_SWORD, 1, UITYPE_NONE, "Short Sword", "Sword", 1, 24, 2, 6, 0, 0, 18, 0, 0, ISPL_NONE, IMISC_NONE, SPL_NULL, FALSE, 120, 120 }, + { IDROP_REGULAR, ICLASS_WEAPON, ILOC_ONEHAND, ICURS_FALCHION, 1, UITYPE_FALCHION, "Falchion", "Sword", 2, 20, 4, 8, 0, 0, 30, 0, 0, ISPL_NONE, IMISC_NONE, SPL_NULL, FALSE, 250, 250 }, + { IDROP_REGULAR, ICLASS_WEAPON, ILOC_ONEHAND, ICURS_SCIMITAR, 1, UITYPE_SCIMITAR, "Scimitar", "Sword", 4, 28, 3, 7, 0, 0, 23, 0, 23, ISPL_NONE, IMISC_NONE, SPL_NULL, FALSE, 200, 200 }, + { IDROP_REGULAR, ICLASS_WEAPON, ILOC_ONEHAND, ICURS_CLAYMORE, 1, UITYPE_CLAYMORE, "Claymore", "Sword", 5, 36, 1, 12, 0, 0, 35, 0, 0, ISPL_NONE, IMISC_NONE, SPL_NULL, FALSE, 450, 450 }, + { IDROP_REGULAR, ICLASS_WEAPON, ILOC_ONEHAND, ICURS_BLADE, 1, UITYPE_NONE, "Blade", "Blade", 4, 30, 3, 8, 0, 0, 25, 0, 30, ISPL_NONE, IMISC_NONE, SPL_NULL, FALSE, 280, 280 }, + { IDROP_REGULAR, ICLASS_WEAPON, ILOC_ONEHAND, ICURS_SABRE, 1, UITYPE_SABRE, "Sabre", "Sabre", 1, 45, 1, 8, 0, 0, 17, 0, 0, ISPL_NONE, IMISC_NONE, SPL_NULL, FALSE, 170, 170 }, + { IDROP_REGULAR, ICLASS_WEAPON, ILOC_ONEHAND, ICURS_LONG_SWORD, 1, UITYPE_LONGSWR, "Long Sword", "Sword", 6, 40, 2, 10, 0, 0, 30, 0, 30, ISPL_NONE, IMISC_NONE, SPL_NULL, FALSE, 350, 350 }, + { IDROP_REGULAR, ICLASS_WEAPON, ILOC_ONEHAND, ICURS_BROAD_SWORD, 1, UITYPE_BROADSWR, "Broad Sword", "Sword", 8, 50, 4, 12, 0, 0, 40, 0, 0, ISPL_NONE, IMISC_NONE, SPL_NULL, FALSE, 750, 750 }, + { IDROP_REGULAR, ICLASS_WEAPON, ILOC_ONEHAND, ICURS_BASTARD_SWORD, 1, UITYPE_BASTARDSWR, "Bastard Sword", "Sword", 10, 60, 6, 15, 0, 0, 50, 0, 0, ISPL_NONE, IMISC_NONE, SPL_NULL, FALSE, 1000, 1000 }, + { IDROP_REGULAR, ICLASS_WEAPON, ILOC_TWOHAND, ICURS_TWO_HANDED_SWORD, 1, UITYPE_TWOHANDSWR, "Two-Handed Sword", "Sword", 14, 75, 8, 16, 0, 0, 65, 0, 0, ISPL_NONE, IMISC_NONE, SPL_NULL, FALSE, 1800, 1800 }, + { IDROP_REGULAR, ICLASS_WEAPON, ILOC_TWOHAND, ICURS_GREAT_SWORD, 1, UITYPE_GREATSWR, "Great Sword", "Sword", 17, 100, 10, 20, 0, 0, 75, 0, 0, ISPL_NONE, IMISC_NONE, SPL_NULL, FALSE, 3000, 3000 }, + { IDROP_REGULAR, ICLASS_WEAPON, ILOC_TWOHAND, ICURS_SMALL_AXE, 2, UITYPE_SMALLAXE, "Small Axe", "Axe", 2, 24, 2, 10, 0, 0, 0, 0, 0, ISPL_NONE, IMISC_NONE, SPL_NULL, FALSE, 150, 150 }, + { IDROP_REGULAR, ICLASS_WEAPON, ILOC_TWOHAND, ICURS_AXE, 2, UITYPE_NONE, "Axe", "Axe", 4, 32, 4, 12, 0, 0, 22, 0, 0, ISPL_NONE, IMISC_NONE, SPL_NULL, FALSE, 450, 450 }, + { IDROP_REGULAR, ICLASS_WEAPON, ILOC_TWOHAND, ICURS_LARGE_AXE, 2, UITYPE_LARGEAXE, "Large Axe", "Axe", 6, 40, 6, 16, 0, 0, 30, 0, 0, ISPL_NONE, IMISC_NONE, SPL_NULL, FALSE, 750, 750 }, + { IDROP_REGULAR, ICLASS_WEAPON, ILOC_TWOHAND, ICURS_BROAD_AXE, 2, UITYPE_BROADAXE, "Broad Axe", "Axe", 8, 50, 8, 20, 0, 0, 50, 0, 0, ISPL_NONE, IMISC_NONE, SPL_NULL, FALSE, 1000, 1000 }, + { IDROP_REGULAR, ICLASS_WEAPON, ILOC_TWOHAND, ICURS_BATTLE_AXE, 2, UITYPE_BATTLEAXE, "Battle Axe", "Axe", 10, 60, 10, 25, 0, 0, 65, 0, 0, ISPL_NONE, IMISC_NONE, SPL_NULL, FALSE, 1500, 1500 }, + { IDROP_REGULAR, ICLASS_WEAPON, ILOC_TWOHAND, ICURS_GREAT_AXE, 2, UITYPE_GREATAXE, "Great Axe", "Axe", 12, 75, 12, 30, 0, 0, 80, 0, 0, ISPL_NONE, IMISC_NONE, SPL_NULL, FALSE, 2500, 2500 }, + { IDROP_REGULAR, ICLASS_WEAPON, ILOC_ONEHAND, ICURS_MACE, 4, UITYPE_MACE, "Mace", "Mace", 2, 32, 1, 8, 0, 0, 16, 0, 0, ISPL_NONE, IMISC_NONE, SPL_NULL, FALSE, 200, 200 }, + { IDROP_REGULAR, ICLASS_WEAPON, ILOC_ONEHAND, ICURS_MORNING_STAR, 4, UITYPE_MORNSTAR, "Morning Star", "Mace", 3, 40, 1, 10, 0, 0, 26, 0, 0, ISPL_NONE, IMISC_NONE, SPL_NULL, FALSE, 300, 300 }, + { IDROP_REGULAR, ICLASS_WEAPON, ILOC_ONEHAND, ICURS_WAR_HAMMER, 4, UITYPE_WARHAMMER, "War Hammer", "Hammer", 5, 50, 5, 9, 0, 0, 40, 0, 0, ISPL_NONE, IMISC_NONE, SPL_NULL, FALSE, 600, 600 }, + { IDROP_REGULAR, ICLASS_WEAPON, ILOC_ONEHAND, ICURS_SPIKED_CLUB, 4, UITYPE_SPIKCLUB, "Spiked Club", "Club", 4, 20, 3, 6, 0, 0, 18, 0, 0, ISPL_NONE, IMISC_NONE, SPL_NULL, FALSE, 225, 225 }, + { IDROP_REGULAR, ICLASS_WEAPON, ILOC_ONEHAND, ICURS_CLUB, 4, UITYPE_SPIKCLUB, "Club", "Club", 1, 20, 1, 6, 0, 0, 0, 0, 0, ISPL_NONE, IMISC_NONE, SPL_NULL, FALSE, 20, 20 }, + { IDROP_REGULAR, ICLASS_WEAPON, ILOC_ONEHAND, ICURS_FLAIL, 4, UITYPE_FLAIL, "Flail", "Flail", 7, 36, 2, 12, 0, 0, 30, 0, 0, ISPL_NONE, IMISC_NONE, SPL_NULL, FALSE, 500, 500 }, + { IDROP_REGULAR, ICLASS_WEAPON, ILOC_TWOHAND, ICURS_MAUL, 4, UITYPE_MAUL, "Maul", "Maul", 10, 50, 6, 20, 0, 0, 55, 0, 0, ISPL_NONE, IMISC_NONE, SPL_NULL, FALSE, 900, 900 }, + { IDROP_DOUBLE, ICLASS_WEAPON, ILOC_TWOHAND, ICURS_SHORT_BOW, 3, UITYPE_SHORTBOW, "Short Bow", "Bow", 1, 30, 1, 4, 0, 0, 0, 0, 0, ISPL_NONE, IMISC_NONE, SPL_NULL, FALSE, 100, 100 }, + { IDROP_DOUBLE, ICLASS_WEAPON, ILOC_TWOHAND, ICURS_HUNTERS_BOW, 3, UITYPE_HUNTBOW, "Hunter's Bow", "Bow", 3, 40, 2, 5, 0, 0, 20, 0, 35, ISPL_NONE, IMISC_NONE, SPL_NULL, FALSE, 350, 350 }, + { IDROP_DOUBLE, ICLASS_WEAPON, ILOC_TWOHAND, ICURS_HUNTERS_BOW, 3, UITYPE_LONGBOW, "Long Bow", "Bow", 5, 35, 1, 6, 0, 0, 25, 0, 30, ISPL_NONE, IMISC_NONE, SPL_NULL, FALSE, 250, 250 }, + { IDROP_DOUBLE, ICLASS_WEAPON, ILOC_TWOHAND, ICURS_COMPOSITE_BOW, 3, UITYPE_COMPBOW, "Composite Bow", "Bow", 7, 45, 3, 6, 0, 0, 25, 0, 40, ISPL_NONE, IMISC_NONE, SPL_NULL, FALSE, 600, 600 }, + { IDROP_DOUBLE, ICLASS_WEAPON, ILOC_TWOHAND, ICURS_SHORT_BATTLE_BOW, 3, UITYPE_NONE, "Short Battle Bow", "Bow", 9, 45, 3, 7, 0, 0, 30, 0, 50, ISPL_NONE, IMISC_NONE, SPL_NULL, FALSE, 750, 750 }, + { IDROP_DOUBLE, ICLASS_WEAPON, ILOC_TWOHAND, ICURS_LONG_WAR_BOW, 3, UITYPE_BATTLEBOW, "Long Battle Bow", "Bow", 11, 50, 1, 10, 0, 0, 30, 0, 60, ISPL_NONE, IMISC_NONE, SPL_NULL, FALSE, 1000, 1000 }, + { IDROP_DOUBLE, ICLASS_WEAPON, ILOC_TWOHAND, ICURS_SHORT_WAR_BOW, 3, UITYPE_NONE, "Short War Bow", "Bow", 15, 55, 4, 8, 0, 0, 35, 0, 70, ISPL_NONE, IMISC_NONE, SPL_NULL, FALSE, 1500, 1500 }, + { IDROP_DOUBLE, ICLASS_WEAPON, ILOC_TWOHAND, ICURS_LONG_WAR_BOW, 3, UITYPE_WARBOW, "Long War Bow", "Bow", 19, 60, 1, 14, 0, 0, 45, 0, 80, ISPL_NONE, IMISC_NONE, SPL_NULL, FALSE, 2000, 2000 }, + { IDROP_REGULAR, ICLASS_WEAPON, ILOC_TWOHAND, ICURS_SHORT_STAFF, 10, UITYPE_SHORTSTAFF, "Short Staff", "Staff", 1, 25, 2, 4, 0, 0, 0, 0, 0, ISPL_NONE, IMISC_STAFF, SPL_NULL, FALSE, 30, 30 }, + { IDROP_REGULAR, ICLASS_WEAPON, ILOC_TWOHAND, ICURS_LONG_STAFF, 10, UITYPE_LONGSTAFF, "Long Staff", "Staff", 4, 35, 4, 8, 0, 0, 0, 0, 0, ISPL_NONE, IMISC_STAFF, SPL_NULL, FALSE, 100, 100 }, + { IDROP_REGULAR, ICLASS_WEAPON, ILOC_TWOHAND, ICURS_COMPOSITE_STAFF, 10, UITYPE_COMPSTAFF, "Composite Staff", "Staff", 6, 45, 5, 10, 0, 0, 0, 0, 0, ISPL_NONE, IMISC_STAFF, SPL_NULL, FALSE, 500, 500 }, + { IDROP_REGULAR, ICLASS_WEAPON, ILOC_TWOHAND, ICURS_SHORT_STAFF, 10, UITYPE_QUARSTAFF, "Quarter Staff", "Staff", 9, 55, 6, 12, 0, 0, 20, 0, 0, ISPL_NONE, IMISC_STAFF, SPL_NULL, FALSE, 1000, 1000 }, + { IDROP_REGULAR, ICLASS_WEAPON, ILOC_TWOHAND, ICURS_WAR_STAFF, 10, UITYPE_WARSTAFF, "War Staff", "Staff", 12, 75, 8, 16, 0, 0, 30, 0, 0, ISPL_NONE, IMISC_STAFF, SPL_NULL, FALSE, 1500, 1500 }, + { IDROP_REGULAR, ICLASS_MISC, ILOC_RING, ICURS_RING, 12, UITYPE_RING, "Ring", "Ring", 5, 0, 0, 0, 0, 0, 0, 0, 0, ISPL_NONE, IMISC_RING, SPL_NULL, FALSE, 1000, 1000 }, + { IDROP_REGULAR, ICLASS_MISC, ILOC_RING, ICURS_RING, 12, UITYPE_RING, "Ring", "Ring", 10, 0, 0, 0, 0, 0, 0, 0, 0, ISPL_NONE, IMISC_RING, SPL_NULL, FALSE, 1000, 1000 }, + { IDROP_REGULAR, ICLASS_MISC, ILOC_RING, ICURS_RING, 12, UITYPE_RING, "Ring", "Ring", 15, 0, 0, 0, 0, 0, 0, 0, 0, ISPL_NONE, IMISC_RING, SPL_NULL, FALSE, 1000, 1000 }, + { IDROP_REGULAR, ICLASS_MISC, ILOC_AMULET, ICURS_AMULET, 13, UITYPE_AMULET, "Amulet", "Amulet", 8, 0, 0, 0, 0, 0, 0, 0, 0, ISPL_NONE, IMISC_AMULET, SPL_NULL, FALSE, 1200, 1200 }, + { IDROP_REGULAR, ICLASS_MISC, ILOC_AMULET, ICURS_AMULET, 13, UITYPE_AMULET, "Amulet", "Amulet", 16, 0, 0, 0, 0, 0, 0, 0, 0, ISPL_NONE, IMISC_AMULET, SPL_NULL, FALSE, 1200, 1200 }, + { IDROP_NEVER, ICLASS_NONE, ILOC_INVALID, ICURS_POTION_OF_FULL_MANA, 0, UITYPE_NONE, NULL, NULL, 0, 0, 0, 0, 0, 0, 0, 0, 0, ISPL_NONE, IMISC_NONE, SPL_NULL, FALSE, 0, 0 } + // clang-format on +}; + +const PLStruct PL_Prefix[84] = { + // clang-format off + // PLName, PLPower, PLParam1, PLParam2, PLMinLvl, PLIType, PLGOE, PLDouble, PLOk, PLMinVal, PLMaxVal, PLMultVal + { "Tin", IPL_TOHIT_CURSE, 6, 10, 3, PLT_WEAP | PLT_BOW | PLT_MISC, 0, TRUE, FALSE, 0, 0, -3 }, + { "Brass", IPL_TOHIT_CURSE, 1, 5, 1, PLT_WEAP | PLT_BOW | PLT_MISC, 0, TRUE, FALSE, 0, 0, -2 }, + { "Bronze", IPL_TOHIT, 1, 5, 1, PLT_WEAP | PLT_BOW | PLT_MISC, 0, TRUE, TRUE, 100, 500, 2 }, + { "Iron", IPL_TOHIT, 6, 10, 4, PLT_WEAP | PLT_BOW | PLT_MISC, 0, TRUE, TRUE, 600, 1000, 3 }, + { "Steel", IPL_TOHIT, 11, 15, 6, PLT_WEAP | PLT_BOW | PLT_MISC, 0, TRUE, TRUE, 1100, 1500, 5 }, + { "Silver", IPL_TOHIT, 16, 20, 9, PLT_WEAP | PLT_BOW | PLT_MISC, 16, TRUE, TRUE, 1600, 2000, 7 }, + { "Gold", IPL_TOHIT, 21, 30, 12, PLT_WEAP | PLT_BOW | PLT_MISC, 16, TRUE, TRUE, 2100, 3000, 9 }, + { "Platinum", IPL_TOHIT, 31, 40, 16, PLT_WEAP | PLT_BOW , 16, TRUE, TRUE, 3100, 4000, 11 }, + { "Mithril", IPL_TOHIT, 41, 60, 20, PLT_WEAP | PLT_BOW , 16, TRUE, TRUE, 4100, 6000, 13 }, + { "Meteoric", IPL_TOHIT, 61, 80, 23, PLT_WEAP | PLT_BOW , 0, TRUE, TRUE, 6100, 10000, 15 }, + { "Weird", IPL_TOHIT, 81, 100, 35, PLT_WEAP | PLT_BOW , 0, TRUE, TRUE, 10100, 14000, 17 }, + { "Strange", IPL_TOHIT, 101, 150, 60, PLT_WEAP | PLT_BOW , 0, TRUE, TRUE, 14100, 20000, 20 }, + { "Useless", IPL_DAMP_CURSE, 100, 100, 5, PLT_WEAP | PLT_BOW , 0, TRUE, FALSE, 0, 0, -8 }, + { "Bent", IPL_DAMP_CURSE, 50, 75, 3, PLT_WEAP | PLT_BOW , 0, TRUE, FALSE, 0, 0, -4 }, + { "Weak", IPL_DAMP_CURSE, 25, 45, 1, PLT_WEAP | PLT_BOW , 0, TRUE, FALSE, 0, 0, -3 }, + { "Jagged", IPL_DAMP, 20, 35, 4, PLT_WEAP | PLT_BOW , 0, TRUE, TRUE, 250, 450, 3 }, + { "Deadly", IPL_DAMP, 36, 50, 6, PLT_WEAP | PLT_BOW , 0, TRUE, TRUE, 500, 700, 4 }, + { "Heavy", IPL_DAMP, 51, 65, 9, PLT_WEAP | PLT_BOW , 0, TRUE, TRUE, 750, 950, 5 }, + { "Vicious", IPL_DAMP, 66, 80, 12, PLT_WEAP | PLT_BOW , 1, TRUE, TRUE, 1000, 1450, 8 }, + { "Brutal", IPL_DAMP, 81, 95, 16, PLT_WEAP | PLT_BOW , 0, TRUE, TRUE, 1500, 1950, 10 }, + { "Massive", IPL_DAMP, 96, 110, 20, PLT_WEAP | PLT_BOW , 0, TRUE, TRUE, 2000, 2450, 13 }, + { "Savage", IPL_DAMP, 111, 125, 23, PLT_WEAP | PLT_BOW , 0, TRUE, TRUE, 2500, 3000, 15 }, + { "Ruthless", IPL_DAMP, 126, 150, 35, PLT_WEAP | PLT_BOW , 0, TRUE, TRUE, 10100, 15000, 17 }, + { "Merciless", IPL_DAMP, 151, 175, 60, PLT_WEAP | PLT_BOW , 0, TRUE, TRUE, 15000, 20000, 20 }, + { "Clumsy", IPL_TOHIT_DAMP_CURSE, 50, 75, 5, PLT_WEAP | PLT_STAFF | PLT_BOW , 0, TRUE, FALSE, 0, 0, -7 }, + { "Dull", IPL_TOHIT_DAMP_CURSE, 25, 45, 1, PLT_WEAP | PLT_STAFF | PLT_BOW , 0, TRUE, FALSE, 0, 0, -5 }, + { "Sharp", IPL_TOHIT_DAMP, 20, 35, 1, PLT_WEAP | PLT_STAFF | PLT_BOW , 0, TRUE, FALSE, 350, 950, 5 }, + { "Fine", IPL_TOHIT_DAMP, 36, 50, 6, PLT_WEAP | PLT_STAFF | PLT_BOW , 0, TRUE, TRUE, 1100, 1700, 7 }, + { "Warrior's", IPL_TOHIT_DAMP, 51, 65, 10, PLT_WEAP | PLT_STAFF | PLT_BOW , 0, TRUE, TRUE, 1850, 2450, 13 }, + { "Soldier's", IPL_TOHIT_DAMP, 66, 80, 15, PLT_WEAP | PLT_STAFF , 0, TRUE, TRUE, 2600, 3950, 17 }, + { "Lord's", IPL_TOHIT_DAMP, 81, 95, 19, PLT_WEAP | PLT_STAFF , 0, TRUE, TRUE, 4100, 5950, 21 }, + { "Knight's", IPL_TOHIT_DAMP, 96, 110, 23, PLT_WEAP | PLT_STAFF , 0, TRUE, TRUE, 6100, 8450, 26 }, + { "Master's", IPL_TOHIT_DAMP, 111, 125, 28, PLT_WEAP | PLT_STAFF , 0, TRUE, TRUE, 8600, 13000, 30 }, + { "Champion's", IPL_TOHIT_DAMP, 126, 150, 40, PLT_WEAP | PLT_STAFF , 0, TRUE, TRUE, 15200, 24000, 33 }, + { "King's", IPL_TOHIT_DAMP, 151, 175, 28, PLT_WEAP | PLT_STAFF , 0, TRUE, TRUE, 24100, 35000, 38 }, + { "Vulnerable", IPL_ACP_CURSE, 51, 100, 3, PLT_ARMO | PLT_SHLD , 0, TRUE, FALSE, 0, 0, -3 }, + { "Rusted", IPL_ACP_CURSE, 25, 50, 1, PLT_ARMO | PLT_SHLD , 0, TRUE, FALSE, 0, 0, -2 }, + { "Fine", IPL_ACP, 20, 30, 1, PLT_ARMO | PLT_SHLD , 0, TRUE, TRUE, 20, 100, 2 }, + { "Strong", IPL_ACP, 31, 40, 3, PLT_ARMO | PLT_SHLD , 0, TRUE, TRUE, 120, 200, 3 }, + { "Grand", IPL_ACP, 41, 55, 6, PLT_ARMO | PLT_SHLD , 0, TRUE, TRUE, 220, 300, 5 }, + { "Valiant", IPL_ACP, 56, 70, 10, PLT_ARMO | PLT_SHLD , 0, TRUE, TRUE, 320, 400, 7 }, + { "Glorious", IPL_ACP, 71, 90, 14, PLT_ARMO | PLT_SHLD , 16, TRUE, TRUE, 420, 600, 9 }, + { "Blessed", IPL_ACP, 91, 110, 19, PLT_ARMO | PLT_SHLD , 16, TRUE, TRUE, 620, 800, 11 }, + { "Saintly", IPL_ACP, 111, 130, 24, PLT_ARMO | PLT_SHLD , 16, TRUE, TRUE, 820, 1200, 13 }, + { "Awesome", IPL_ACP, 131, 150, 28, PLT_ARMO | PLT_SHLD , 16, TRUE, TRUE, 1220, 2000, 15 }, + { "Holy", IPL_ACP, 151, 170, 35, PLT_ARMO | PLT_SHLD , 16, TRUE, TRUE, 5200, 6000, 17 }, + { "Godly", IPL_ACP, 171, 200, 60, PLT_ARMO | PLT_SHLD , 16, TRUE, TRUE, 6200, 7000, 20 }, + { "Red", IPL_FIRERES, 10, 20, 4, PLT_ARMO | PLT_SHLD | PLT_WEAP | PLT_STAFF | PLT_BOW | PLT_MISC, 0, FALSE, TRUE, 500, 1500, 2 }, + { "Crimson", IPL_FIRERES, 21, 30, 10, PLT_ARMO | PLT_SHLD | PLT_WEAP | PLT_STAFF | PLT_BOW | PLT_MISC, 0, FALSE, TRUE, 2100, 3000, 2 }, + { "Crimson", IPL_FIRERES, 31, 40, 16, PLT_ARMO | PLT_SHLD | PLT_WEAP | PLT_STAFF | PLT_BOW | PLT_MISC, 0, FALSE, TRUE, 3100, 4000, 2 }, + { "Garnet", IPL_FIRERES, 41, 50, 20, PLT_ARMO | PLT_SHLD | PLT_WEAP | PLT_STAFF | PLT_BOW | PLT_MISC, 0, FALSE, TRUE, 8200, 12000, 3 }, + { "Ruby", IPL_FIRERES, 51, 60, 26, PLT_ARMO | PLT_SHLD | PLT_WEAP | PLT_STAFF | PLT_BOW | PLT_MISC, 0, FALSE, TRUE, 17100, 20000, 5 }, + { "Blue", IPL_LIGHTRES, 10, 20, 4, PLT_ARMO | PLT_SHLD | PLT_WEAP | PLT_STAFF | PLT_BOW | PLT_MISC, 0, FALSE, TRUE, 500, 1500, 2 }, + { "Azure", IPL_LIGHTRES, 21, 30, 10, PLT_ARMO | PLT_SHLD | PLT_WEAP | PLT_STAFF | PLT_BOW | PLT_MISC, 0, FALSE, TRUE, 2100, 3000, 2 }, + { "Lapis", IPL_LIGHTRES, 31, 40, 16, PLT_ARMO | PLT_SHLD | PLT_WEAP | PLT_STAFF | PLT_BOW | PLT_MISC, 0, FALSE, TRUE, 3100, 4000, 2 }, + { "Cobalt", IPL_LIGHTRES, 41, 50, 20, PLT_ARMO | PLT_SHLD | PLT_WEAP | PLT_STAFF | PLT_BOW | PLT_MISC, 0, FALSE, TRUE, 8200, 12000, 3 }, + { "Sapphire", IPL_LIGHTRES, 51, 60, 26, PLT_ARMO | PLT_SHLD | PLT_WEAP | PLT_STAFF | PLT_BOW | PLT_MISC, 0, FALSE, TRUE, 17100, 20000, 5 }, + { "White", IPL_MAGICRES, 10, 20, 4, PLT_ARMO | PLT_SHLD | PLT_WEAP | PLT_STAFF | PLT_BOW | PLT_MISC, 0, FALSE, TRUE, 500, 1500, 2 }, + { "Pearl", IPL_MAGICRES, 21, 30, 10, PLT_ARMO | PLT_SHLD | PLT_WEAP | PLT_STAFF | PLT_BOW | PLT_MISC, 0, FALSE, TRUE, 2100, 3000, 2 }, + { "Ivory", IPL_MAGICRES, 31, 40, 16, PLT_ARMO | PLT_SHLD | PLT_WEAP | PLT_STAFF | PLT_BOW | PLT_MISC, 0, FALSE, TRUE, 3100, 4000, 2 }, + { "Crystal", IPL_MAGICRES, 41, 50, 20, PLT_ARMO | PLT_SHLD | PLT_WEAP | PLT_STAFF | PLT_BOW | PLT_MISC, 0, FALSE, TRUE, 8200, 12000, 3 }, + { "Diamond", IPL_MAGICRES, 51, 60, 26, PLT_ARMO | PLT_SHLD | PLT_WEAP | PLT_STAFF | PLT_BOW | PLT_MISC, 0, FALSE, TRUE, 17100, 20000, 5 }, + { "Topaz", IPL_ALLRES, 10, 15, 8, PLT_ARMO | PLT_SHLD | PLT_WEAP | PLT_STAFF | PLT_BOW | PLT_MISC, 0, FALSE, TRUE, 2000, 5000, 3 }, + { "Amber", IPL_ALLRES, 16, 20, 12, PLT_ARMO | PLT_SHLD | PLT_WEAP | PLT_STAFF | PLT_BOW | PLT_MISC, 0, FALSE, TRUE, 7400, 10000, 3 }, + { "Jade", IPL_ALLRES, 21, 30, 18, PLT_ARMO | PLT_SHLD | PLT_WEAP | PLT_STAFF | PLT_BOW | PLT_MISC, 0, FALSE, TRUE, 11000, 15000, 3 }, + { "Obsidian", IPL_ALLRES, 31, 40, 24, PLT_ARMO | PLT_SHLD | PLT_WEAP | PLT_STAFF | PLT_BOW | PLT_MISC, 0, FALSE, TRUE, 24000, 40000, 4 }, + { "Emerald", IPL_ALLRES, 41, 50, 31, PLT_SHLD | PLT_WEAP | PLT_STAFF | PLT_BOW , 0, FALSE, TRUE, 61000, 75000, 7 }, + { "Hyena's", IPL_MANA_CURSE, 11, 25, 4, PLT_STAFF | PLT_MISC, 0, FALSE, FALSE, 100, 1000, -2 }, + { "Frog's", IPL_MANA_CURSE, 1, 10, 1, PLT_STAFF | PLT_MISC, 1, FALSE, FALSE, 0, 0, -2 }, + { "Spider's", IPL_MANA, 10, 15, 1, PLT_STAFF | PLT_MISC, 1, FALSE, TRUE, 500, 1000, 2 }, + { "Raven's", IPL_MANA, 15, 20, 5, PLT_STAFF | PLT_MISC, 0, FALSE, TRUE, 1100, 2000, 3 }, + { "Snake's", IPL_MANA, 21, 30, 9, PLT_STAFF | PLT_MISC, 0, FALSE, TRUE, 2100, 4000, 5 }, + { "Serpent's", IPL_MANA, 30, 40, 15, PLT_STAFF | PLT_MISC, 0, FALSE, TRUE, 4100, 6000, 7 }, + { "Drake's", IPL_MANA, 41, 50, 21, PLT_STAFF | PLT_MISC, 0, FALSE, TRUE, 6100, 10000, 9 }, + { "Dragon's", IPL_MANA, 51, 60, 27, PLT_STAFF | PLT_MISC, 0, FALSE, TRUE, 10100, 15000, 11 }, + { "Wyrm's", IPL_MANA, 61, 80, 35, PLT_STAFF , 0, FALSE, TRUE, 15100, 19000, 12 }, + { "Hydra's", IPL_MANA, 81, 100, 60, PLT_STAFF , 0, FALSE, TRUE, 19100, 30000, 13 }, + { "Angel's", IPL_SPLLVLADD, 1, 1, 15, PLT_STAFF , 16, FALSE, TRUE, 25000, 25000, 2 }, + { "Arch-Angel's", IPL_SPLLVLADD, 2, 2, 25, PLT_STAFF , 16, FALSE, TRUE, 50000, 50000, 3 }, + { "Plentiful", IPL_CHARGES, 2, 2, 4, PLT_STAFF , 0, FALSE, TRUE, 2000, 2000, 2 }, + { "Bountiful", IPL_CHARGES, 3, 3, 9, PLT_STAFF , 0, FALSE, TRUE, 3000, 3000, 3 }, + { "Flaming", IPL_FIREDAM, 1, 10, 7, PLT_WEAP | PLT_STAFF , 0, FALSE, TRUE, 5000, 5000, 2 }, + { "Lightning", IPL_LIGHTDAM, 2, 20, 18, PLT_WEAP | PLT_STAFF , 0, FALSE, TRUE, 10000, 10000, 2 }, + { "", IPL_INVALID, 0, 0, 0, 0 , 0, FALSE, FALSE, 0, 0, 0 } + // clang-format on +}; + +const PLStruct PL_Suffix[96] = { + // clang-format off + // PLName, PLPower, PLParam1, PLParam2, PLMinLvl, PLIType, PLGOE, PLDouble, PLOk, PLMinVal, PLMaxVal, PLMultVal + { "quality", IPL_DAMMOD, 1, 2, 2, PLT_WEAP | PLT_BOW , 0, FALSE, TRUE, 100, 200, 2 }, + { "maiming", IPL_DAMMOD, 3, 5, 7, PLT_WEAP | PLT_BOW , 0, FALSE, TRUE, 1300, 1500, 3 }, + { "slaying", IPL_DAMMOD, 6, 8, 15, PLT_WEAP , 0, FALSE, TRUE, 2600, 3000, 5 }, + { "gore", IPL_DAMMOD, 9, 12, 25, PLT_WEAP , 0, FALSE, TRUE, 4100, 5000, 8 }, + { "carnage", IPL_DAMMOD, 13, 16, 35, PLT_WEAP , 0, FALSE, TRUE, 5100, 10000, 10 }, + { "slaughter", IPL_DAMMOD, 17, 20, 60, PLT_WEAP , 0, FALSE, TRUE, 10100, 15000, 13 }, + { "pain", IPL_GETHIT_CURSE, 2, 4, 4, PLT_ARMO | PLT_SHLD | PLT_MISC, 1, FALSE, FALSE, 0, 0, -4 }, + { "tears", IPL_GETHIT_CURSE, 1, 1, 2, PLT_ARMO | PLT_SHLD | PLT_MISC, 1, FALSE, FALSE, 0, 0, -2 }, + { "health", IPL_GETHIT, 1, 1, 2, PLT_ARMO | PLT_SHLD | PLT_MISC, 16, FALSE, TRUE, 200, 200, 2 }, + { "protection", IPL_GETHIT, 2, 2, 6, PLT_ARMO | PLT_SHLD , 16, FALSE, TRUE, 400, 800, 4 }, + { "absorption", IPL_GETHIT, 3, 3, 12, PLT_ARMO | PLT_SHLD , 16, FALSE, TRUE, 1001, 2500, 10 }, + { "deflection", IPL_GETHIT, 4, 4, 20, PLT_ARMO , 16, FALSE, TRUE, 2500, 6500, 15 }, + { "osmosis", IPL_GETHIT, 5, 6, 50, PLT_ARMO , 16, FALSE, TRUE, 7500, 10000, 20 }, + { "frailty", IPL_STR_CURSE, 6, 10, 3, PLT_ARMO | PLT_SHLD | PLT_WEAP | PLT_BOW | PLT_MISC, 1, FALSE, FALSE, 0, 0, -3 }, + { "weakness", IPL_STR_CURSE, 1, 5, 1, PLT_ARMO | PLT_SHLD | PLT_WEAP | PLT_BOW | PLT_MISC, 1, FALSE, FALSE, 0, 0, -2 }, + { "strength", IPL_STR, 1, 5, 1, PLT_ARMO | PLT_SHLD | PLT_WEAP | PLT_BOW | PLT_MISC, 0, FALSE, TRUE, 200, 1000, 2 }, + { "might", IPL_STR, 6, 10, 5, PLT_ARMO | PLT_SHLD | PLT_WEAP | PLT_BOW | PLT_MISC, 0, FALSE, TRUE, 1200, 2000, 3 }, + { "power", IPL_STR, 11, 15, 11, PLT_ARMO | PLT_SHLD | PLT_WEAP | PLT_BOW | PLT_MISC, 0, FALSE, TRUE, 2200, 3000, 4 }, + { "giants", IPL_STR, 16, 20, 17, PLT_ARMO | PLT_WEAP | PLT_BOW | PLT_MISC, 0, FALSE, TRUE, 3200, 5000, 7 }, + { "titans", IPL_STR, 21, 30, 23, PLT_WEAP | PLT_MISC, 0, FALSE, TRUE, 5200, 10000, 10 }, + { "paralysis", IPL_DEX_CURSE, 6, 10, 3, PLT_ARMO | PLT_SHLD | PLT_WEAP | PLT_BOW | PLT_MISC, 1, FALSE, FALSE, 0, 0, -3 }, + { "atrophy", IPL_DEX_CURSE, 1, 5, 1, PLT_ARMO | PLT_SHLD | PLT_WEAP | PLT_BOW | PLT_MISC, 1, FALSE, FALSE, 0, 0, -2 }, + { "dexterity", IPL_DEX, 1, 5, 1, PLT_ARMO | PLT_SHLD | PLT_WEAP | PLT_BOW | PLT_MISC, 0, FALSE, TRUE, 200, 1000, 2 }, + { "skill", IPL_DEX, 6, 10, 5, PLT_ARMO | PLT_SHLD | PLT_WEAP | PLT_BOW | PLT_MISC, 0, FALSE, TRUE, 1200, 2000, 3 }, + { "accuracy", IPL_DEX, 11, 15, 11, PLT_ARMO | PLT_SHLD | PLT_WEAP | PLT_BOW | PLT_MISC, 0, FALSE, TRUE, 2200, 3000, 4 }, + { "precision", IPL_DEX, 16, 20, 17, PLT_ARMO | PLT_WEAP | PLT_BOW | PLT_MISC, 0, FALSE, TRUE, 3200, 5000, 7 }, + { "perfection", IPL_DEX, 21, 30, 23, PLT_BOW | PLT_MISC, 0, FALSE, TRUE, 5200, 10000, 10 }, + { "the fool", IPL_MAG_CURSE, 6, 10, 3, PLT_ARMO | PLT_SHLD | PLT_WEAP | PLT_STAFF | PLT_BOW | PLT_MISC, 1, FALSE, FALSE, 0, 0, -3 }, + { "dyslexia", IPL_MAG_CURSE, 1, 5, 1, PLT_ARMO | PLT_SHLD | PLT_WEAP | PLT_STAFF | PLT_BOW | PLT_MISC, 1, FALSE, FALSE, 0, 0, -2 }, + { "magic", IPL_MAG, 1, 5, 1, PLT_ARMO | PLT_SHLD | PLT_WEAP | PLT_STAFF | PLT_BOW | PLT_MISC, 0, FALSE, TRUE, 200, 1000, 2 }, + { "the mind", IPL_MAG, 6, 10, 5, PLT_ARMO | PLT_SHLD | PLT_WEAP | PLT_STAFF | PLT_BOW | PLT_MISC, 0, FALSE, TRUE, 1200, 2000, 3 }, + { "brilliance", IPL_MAG, 11, 15, 11, PLT_ARMO | PLT_SHLD | PLT_WEAP | PLT_STAFF | PLT_BOW | PLT_MISC, 0, FALSE, TRUE, 2200, 3000, 4 }, + { "sorcery", IPL_MAG, 16, 20, 17, PLT_ARMO | PLT_WEAP | PLT_STAFF | PLT_BOW | PLT_MISC, 0, FALSE, TRUE, 3200, 5000, 7 }, + { "wizardry", IPL_MAG, 21, 30, 23, PLT_STAFF | PLT_MISC, 0, FALSE, TRUE, 5200, 10000, 10 }, + { "illness", IPL_VIT_CURSE, 6, 10, 3, PLT_ARMO | PLT_SHLD | PLT_WEAP | PLT_BOW | PLT_MISC, 1, FALSE, FALSE, 0, 0, -3 }, + { "disease", IPL_VIT_CURSE, 1, 5, 1, PLT_ARMO | PLT_SHLD | PLT_WEAP | PLT_BOW | PLT_MISC, 1, FALSE, FALSE, 0, 0, -2 }, + { "vitality", IPL_VIT, 1, 5, 1, PLT_ARMO | PLT_SHLD | PLT_WEAP | PLT_BOW | PLT_MISC, 16, FALSE, TRUE, 200, 1000, 2 }, + { "zest", IPL_VIT, 6, 10, 5, PLT_ARMO | PLT_SHLD | PLT_WEAP | PLT_BOW | PLT_MISC, 16, FALSE, TRUE, 1200, 2000, 3 }, + { "vim", IPL_VIT, 11, 15, 11, PLT_ARMO | PLT_SHLD | PLT_WEAP | PLT_BOW | PLT_MISC, 16, FALSE, TRUE, 2200, 3000, 4 }, + { "vigor", IPL_VIT, 16, 20, 17, PLT_ARMO | PLT_WEAP | PLT_BOW | PLT_MISC, 16, FALSE, TRUE, 3200, 5000, 7 }, + { "life", IPL_VIT, 21, 30, 23, PLT_MISC, 16, FALSE, TRUE, 5200, 10000, 10 }, + { "trouble", IPL_ATTRIBS_CURSE, 6, 10, 12, PLT_ARMO | PLT_SHLD | PLT_WEAP | PLT_BOW | PLT_MISC, 1, FALSE, FALSE, 0, 0, -10 }, + { "the pit", IPL_ATTRIBS_CURSE, 1, 5, 5, PLT_ARMO | PLT_SHLD | PLT_WEAP | PLT_BOW | PLT_MISC, 1, FALSE, FALSE, 0, 0, -5 }, + { "the sky", IPL_ATTRIBS, 1, 3, 5, PLT_ARMO | PLT_SHLD | PLT_WEAP | PLT_BOW | PLT_MISC, 0, FALSE, TRUE, 800, 4000, 5 }, + { "the moon", IPL_ATTRIBS, 4, 7, 11, PLT_ARMO | PLT_SHLD | PLT_WEAP | PLT_BOW | PLT_MISC, 0, FALSE, TRUE, 4800, 8000, 10 }, + { "the stars", IPL_ATTRIBS, 8, 11, 17, PLT_ARMO | PLT_WEAP | PLT_BOW | PLT_MISC, 0, FALSE, TRUE, 8800, 12000, 15 }, + { "the heavens", IPL_ATTRIBS, 12, 15, 25, PLT_WEAP | PLT_BOW | PLT_MISC, 0, FALSE, TRUE, 12800, 20000, 20 }, + { "the zodiac", IPL_ATTRIBS, 16, 20, 30, PLT_MISC, 0, FALSE, TRUE, 20800, 40000, 30 }, + { "the vulture", IPL_LIFE_CURSE, 11, 25, 4, PLT_ARMO | PLT_SHLD | PLT_MISC, 1, FALSE, FALSE, 0, 0, -4 }, + { "the jackal", IPL_LIFE_CURSE, 1, 10, 1, PLT_ARMO | PLT_SHLD | PLT_MISC, 1, FALSE, FALSE, 0, 0, -2 }, + { "the fox", IPL_LIFE, 10, 15, 1, PLT_ARMO | PLT_SHLD | PLT_MISC, 0, FALSE, TRUE, 100, 1000, 2 }, + { "the jaguar", IPL_LIFE, 16, 20, 5, PLT_ARMO | PLT_SHLD | PLT_MISC, 0, FALSE, TRUE, 1100, 2000, 3 }, + { "the eagle", IPL_LIFE, 21, 30, 9, PLT_ARMO | PLT_SHLD | PLT_MISC, 0, FALSE, TRUE, 2100, 4000, 5 }, + { "the wolf", IPL_LIFE, 30, 40, 15, PLT_ARMO | PLT_SHLD | PLT_MISC, 0, FALSE, TRUE, 4100, 6000, 7 }, + { "the tiger", IPL_LIFE, 41, 50, 21, PLT_ARMO | PLT_SHLD | PLT_MISC, 0, FALSE, TRUE, 6100, 10000, 9 }, + { "the lion", IPL_LIFE, 51, 60, 27, PLT_ARMO | PLT_MISC, 0, FALSE, TRUE, 10100, 15000, 11 }, + { "the mammoth", IPL_LIFE, 61, 80, 35, PLT_ARMO , 0, FALSE, TRUE, 15100, 19000, 12 }, + { "the whale", IPL_LIFE, 81, 100, 60, PLT_ARMO , 0, FALSE, TRUE, 19100, 30000, 13 }, + { "fragility", IPL_DUR_CURSE, 100, 100, 3, PLT_ARMO | PLT_SHLD | PLT_WEAP , 1, FALSE, FALSE, 0, 0, -4 }, + { "brittleness", IPL_DUR_CURSE, 26, 75, 1, PLT_ARMO | PLT_SHLD | PLT_WEAP , 1, FALSE, FALSE, 0, 0, -2 }, + { "sturdiness", IPL_DUR, 26, 75, 1, PLT_ARMO | PLT_SHLD | PLT_WEAP , 0, FALSE, TRUE, 100, 100, 2 }, + { "craftsmanship", IPL_DUR, 51, 100, 6, PLT_ARMO | PLT_SHLD | PLT_WEAP , 0, FALSE, TRUE, 200, 200, 2 }, + { "structure", IPL_DUR, 101, 200, 12, PLT_ARMO | PLT_SHLD | PLT_WEAP , 0, FALSE, TRUE, 300, 300, 2 }, + { "the ages", IPL_INDESTRUCTIBLE, 0, 0, 25, PLT_ARMO | PLT_SHLD | PLT_WEAP , 0, FALSE, TRUE, 600, 600, 5 }, + { "the dark", IPL_LIGHT_CURSE, 4, 4, 6, PLT_ARMO | PLT_WEAP | PLT_MISC, 1, FALSE, FALSE, 0, 0, -3 }, + { "the night", IPL_LIGHT_CURSE, 2, 2, 3, PLT_ARMO | PLT_WEAP | PLT_MISC, 1, FALSE, FALSE, 0, 0, -2 }, + { "light", IPL_LIGHT, 2, 2, 4, PLT_ARMO | PLT_WEAP | PLT_MISC, 16, FALSE, TRUE, 750, 750, 2 }, + { "radiance", IPL_LIGHT, 4, 4, 8, PLT_ARMO | PLT_WEAP | PLT_MISC, 16, FALSE, TRUE, 1500, 1500, 3 }, + { "flame", IPL_FIRE_ARROWS, 1, 3, 1, PLT_BOW , 0, FALSE, TRUE, 2000, 2000, 2 }, + { "fire", IPL_FIRE_ARROWS, 1, 6, 11, PLT_BOW , 0, FALSE, TRUE, 4000, 4000, 4 }, + { "burning", IPL_FIRE_ARROWS, 1, 16, 35, PLT_BOW , 0, FALSE, TRUE, 6000, 6000, 6 }, + { "shock", IPL_LIGHT_ARROWS, 1, 6, 13, PLT_BOW , 0, FALSE, TRUE, 6000, 6000, 2 }, + { "lightning", IPL_LIGHT_ARROWS, 1, 10, 21, PLT_BOW , 0, FALSE, TRUE, 8000, 8000, 4 }, + { "thunder", IPL_LIGHT_ARROWS, 1, 20, 60, PLT_BOW , 0, FALSE, TRUE, 12000, 12000, 6 }, + { "many", IPL_DUR, 100, 100, 3, PLT_BOW , 0, FALSE, TRUE, 750, 750, 2 }, + { "plenty", IPL_DUR, 200, 200, 7, PLT_BOW , 0, FALSE, TRUE, 1500, 1500, 3 }, + { "thorns", IPL_THORNS, 1, 3, 1, PLT_ARMO | PLT_SHLD , 0, FALSE, TRUE, 500, 500, 2 }, + { "corruption", IPL_NOMANA, 0, 0, 5, PLT_ARMO | PLT_SHLD | PLT_WEAP , 1, FALSE, FALSE, -1000, -1000, 2 }, + { "thieves", IPL_ABSHALFTRAP, 0, 0, 11, PLT_ARMO | PLT_SHLD | PLT_MISC, 0, FALSE, TRUE, 1500, 1500, 2 }, + { "the bear", IPL_KNOCKBACK, 0, 0, 5, PLT_WEAP | PLT_STAFF | PLT_BOW , 1, FALSE, TRUE, 750, 750, 2 }, + { "the bat", IPL_STEALMANA, 3, 3, 8, PLT_WEAP , 0, FALSE, TRUE, 7500, 7500, 3 }, + { "vampires", IPL_STEALMANA, 5, 5, 19, PLT_WEAP , 0, FALSE, TRUE, 15000, 15000, 3 }, + { "the leech", IPL_STEALLIFE, 3, 3, 8, PLT_WEAP , 0, FALSE, TRUE, 7500, 7500, 3 }, + { "blood", IPL_STEALLIFE, 5, 5, 19, PLT_WEAP , 0, FALSE, TRUE, 15000, 15000, 3 }, + { "piercing", IPL_TARGAC, 2, 6, 1, PLT_WEAP | PLT_BOW , 0, FALSE, TRUE, 1000, 1000, 3 }, + { "puncturing", IPL_TARGAC, 4, 12, 9, PLT_WEAP | PLT_BOW , 0, FALSE, TRUE, 2000, 2000, 6 }, + { "bashing", IPL_TARGAC, 8, 24, 17, PLT_WEAP , 0, FALSE, TRUE, 4000, 4000, 12 }, + { "readiness", IPL_FASTATTACK, 1, 1, 1, PLT_WEAP | PLT_STAFF | PLT_BOW , 0, FALSE, TRUE, 2000, 2000, 2 }, + { "swiftness", IPL_FASTATTACK, 2, 2, 10, PLT_WEAP | PLT_STAFF | PLT_BOW , 0, FALSE, TRUE, 4000, 4000, 4 }, + { "speed", IPL_FASTATTACK, 3, 3, 19, PLT_WEAP | PLT_STAFF , 0, FALSE, TRUE, 8000, 8000, 8 }, + { "haste", IPL_FASTATTACK, 4, 4, 27, PLT_WEAP | PLT_STAFF , 0, FALSE, TRUE, 16000, 16000, 16 }, + { "balance", IPL_FASTRECOVER, 1, 1, 1, PLT_ARMO | PLT_MISC, 0, FALSE, TRUE, 2000, 2000, 2 }, + { "stability", IPL_FASTRECOVER, 2, 2, 10, PLT_ARMO | PLT_MISC, 0, FALSE, TRUE, 4000, 4000, 4 }, + { "harmony", IPL_FASTRECOVER, 3, 3, 20, PLT_ARMO | PLT_MISC, 0, FALSE, TRUE, 8000, 8000, 8 }, + { "blocking", IPL_FASTBLOCK, 1, 1, 5, PLT_SHLD , 0, FALSE, TRUE, 4000, 4000, 4 }, + { "", IPL_INVALID, 0, 0, 0, 0 , 0, FALSE, FALSE, 0, 0, 0 } + // clang-format on +}; + +const UItemStruct UniqueItemList[91] = { + // 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 + { "The Butcher's Cleaver", UITYPE_CLEAVER, 1, 3, 3650, IPL_STR, 10, 10, IPL_SETDAM, 4, 24, IPL_SETDUR, 10, 10, IPL_TOHIT, 0, 0, IPL_TOHIT, 0, 0, IPL_TOHIT, 0, 0 }, + { "The Undead Crown", UITYPE_SKCROWN, 1, 3, 16650, IPL_RNDSTEALLIFE, 0, 0, IPL_SETAC, 8, 8, IPL_INVCURS, 77, 0, IPL_TOHIT, 0, 0, IPL_TOHIT, 0, 0, IPL_TOHIT, 0, 0 }, + { "Empyrean Band", UITYPE_INFRARING, 1, 4, 8000, IPL_ATTRIBS, 2, 2, IPL_LIGHT, 2, 2, IPL_FASTRECOVER, 1, 1, IPL_ABSHALFTRAP, 0, 0, IPL_TOHIT, 0, 0, IPL_TOHIT, 0, 0 }, + { "Optic Amulet", UITYPE_OPTAMULET, 1, 5, 9750, IPL_LIGHT, 2, 2, IPL_LIGHTRES, 20, 20, IPL_GETHIT, 1, 1, IPL_MAG, 5, 5, IPL_INVCURS, 44, 0, IPL_TOHIT, 0, 0 }, + { "Ring of Truth", UITYPE_TRING, 1, 4, 9100, IPL_LIFE, 10, 10, IPL_GETHIT, 1, 1, IPL_ALLRES, 10, 10, IPL_INVCURS, 10, 0, IPL_TOHIT, 0, 0, IPL_TOHIT, 0, 0 }, + { "Harlequin Crest", UITYPE_HARCREST, 1, 6, 4000, IPL_AC_CURSE, 3, 3, IPL_GETHIT, 1, 1, IPL_ATTRIBS, 2, 2, IPL_LIFE, 7, 7, IPL_MANA, 7, 7, IPL_INVCURS, 81, 0 }, + { "Veil of Steel", UITYPE_STEELVEIL, 1, 6, 63800, IPL_ALLRES, 50, 50, IPL_LIGHT_CURSE, 2, 2, IPL_ACP, 60, 60, IPL_MANA_CURSE, 30, 30, IPL_STR, 15, 15, IPL_VIT, 15, 15 }, + { "Arkaine's Valor", UITYPE_ARMOFVAL, 1, 4, 42000, IPL_SETAC, 25, 25, IPL_VIT, 10, 10, IPL_GETHIT, 3, 3, IPL_FASTRECOVER, 3, 3, IPL_TOHIT, 0, 0, IPL_TOHIT, 0, 0 }, + { "Griswold's Edge", UITYPE_GRISWOLD, 1, 6, 42000, IPL_FIREDAM, 1, 10, IPL_TOHIT, 25, 25, IPL_FASTATTACK, 2, 2, IPL_KNOCKBACK, 0, 0, IPL_MANA, 20, 20, IPL_LIFE_CURSE, 20, 20 }, + { "Lightforge", UITYPE_MACE, 1, 6, 26675, IPL_LIGHT, 4, 4, IPL_DAMP, 150, 150, IPL_TOHIT, 25, 25, IPL_FIREDAM, 10, 20, IPL_INDESTRUCTIBLE, 0, 0, IPL_ATTRIBS, 8, 8 }, + { "The Rift Bow", UITYPE_SHORTBOW, 1, 3, 1800, IPL_RNDARROWVEL, 0, 0, IPL_DAMMOD, 2, 2, IPL_DEX_CURSE, 3, 3, IPL_TOHIT, 0, 0, IPL_TOHIT, 0, 0, IPL_TOHIT, 0, 0 }, + { "The Needler", UITYPE_SHORTBOW, 2, 4, 8900, IPL_TOHIT, 50, 50, IPL_SETDAM, 1, 3, IPL_FASTATTACK, 2, 2, IPL_INVCURS, 158, 0, IPL_TOHIT, 0, 0, IPL_TOHIT, 0, 0 }, + { "The Celestial Bow", UITYPE_LONGBOW, 2, 4, 1200, IPL_NOMINSTR, 0, 0, IPL_DAMMOD, 2, 2, IPL_SETAC, 5, 5, IPL_INVCURS, 133, 0, IPL_TOHIT, 0, 0, IPL_TOHIT, 0, 0 }, + { "Deadly Hunter", UITYPE_COMPBOW, 3, 4, 8750, IPL_3XDAMVDEM, 10, 10, IPL_TOHIT, 20, 20, IPL_MAG_CURSE, 5, 5, IPL_INVCURS, 108, 0, IPL_TOHIT, 0, 0, IPL_TOHIT, 0, 0 }, + { "Bow of the Dead", UITYPE_COMPBOW, 5, 6, 2500, IPL_TOHIT, 10, 10, IPL_DEX, 4, 4, IPL_VIT_CURSE, 3, 3, IPL_LIGHT_CURSE, 2, 2, IPL_SETDUR, 30, 30, IPL_INVCURS, 108, 0 }, + { "The Blackoak Bow", UITYPE_LONGBOW, 5, 4, 2500, IPL_DEX, 10, 10, IPL_VIT_CURSE, 10, 10, IPL_DAMP, 50, 50, IPL_LIGHT_CURSE, 1, 1, IPL_TOHIT, 0, 0, IPL_TOHIT, 0, 0 }, + { "Flamedart", UITYPE_HUNTBOW, 10, 4, 14250, IPL_FIRE_ARROWS, 0, 0, IPL_FIREDAM, 1, 6, IPL_TOHIT, 20, 20, IPL_FIRERES, 40, 40, IPL_TOHIT, 0, 0, IPL_TOHIT, 0, 0 }, + { "Fleshstinger", UITYPE_LONGBOW, 13, 4, 16500, IPL_DEX, 15, 15, IPL_TOHIT, 40, 40, IPL_DAMP, 80, 80, IPL_DUR, 6, 6, IPL_TOHIT, 0, 0, IPL_TOHIT, 0, 0 }, + { "Windforce", UITYPE_WARBOW, 17, 4, 37750, IPL_STR, 5, 5, IPL_DAMP, 200, 200, IPL_KNOCKBACK, 0, 0, IPL_INVCURS, 164, 0, IPL_TOHIT, 0, 0, IPL_TOHIT, 0, 0 }, + { "Eaglehorn", UITYPE_BATTLEBOW, 26, 5, 42500, IPL_DEX, 20, 20, IPL_TOHIT, 50, 50, IPL_DAMP, 100, 100, IPL_INDESTRUCTIBLE, 0, 0, IPL_INVCURS, 108, 0, IPL_TOHIT, 0, 0 }, + { "Gonnagal's Dirk", UITYPE_DAGGER, 1, 5, 7040, IPL_DEX_CURSE, 5, 5, IPL_DAMMOD, 4, 4, IPL_FASTATTACK, 2, 2, IPL_FIRERES, 25, 25, IPL_INVCURS, 54, 0, IPL_TOHIT, 0, 0 }, + { "The Defender", UITYPE_SABRE, 1, 3, 2000, IPL_SETAC, 5, 5, IPL_VIT, 5, 5, IPL_TOHIT_CURSE, 5, 5, IPL_TOHIT, 0, 0, IPL_TOHIT, 0, 0, IPL_TOHIT, 0, 0 }, + { "Gryphons Claw", UITYPE_FALCHION, 1, 4, 1000, IPL_DAMP, 100, 100, IPL_MAG_CURSE, 2, 2, IPL_DEX_CURSE, 5, 5, IPL_INVCURS, 68, 0, IPL_TOHIT, 0, 0, IPL_TOHIT, 0, 0 }, + { "Black Razor", UITYPE_DAGGER, 1, 4, 2000, IPL_DAMP, 150, 150, IPL_VIT, 2, 2, IPL_SETDUR, 5, 5, IPL_INVCURS, 53, 0, IPL_TOHIT, 0, 0, IPL_TOHIT, 0, 0 }, + { "Gibbous Moon", UITYPE_BROADSWR, 2, 4, 6660, IPL_ATTRIBS, 2, 2, IPL_DAMP, 25, 25, IPL_MANA, 15, 15, IPL_LIGHT_CURSE, 3, 3, IPL_TOHIT, 0, 0, IPL_TOHIT, 0, 0 }, + { "Ice Shank", UITYPE_LONGSWR, 3, 3, 5250, IPL_FIRERES, 40, 40, IPL_SETDUR, 15, 15, IPL_STR, 5, 10, IPL_TOHIT, 0, 0, IPL_TOHIT, 0, 0, IPL_TOHIT, 0, 0 }, + { "The Executioner's Blade", UITYPE_FALCHION, 3, 5, 7080, IPL_DAMP, 150, 150, IPL_LIFE_CURSE, 10, 10, IPL_LIGHT_CURSE, 1, 1, IPL_DUR, 200, 200, IPL_INVCURS, 58, 0, IPL_TOHIT, 0, 0 }, + { "The Bonesaw", UITYPE_CLAYMORE, 6, 6, 4400, IPL_DAMMOD, 10, 10, IPL_STR, 10, 10, IPL_MAG_CURSE, 5, 5, IPL_DEX_CURSE, 5, 5, IPL_LIFE, 10, 10, IPL_MANA_CURSE, 10, 10 }, + { "Shadowhawk", UITYPE_BROADSWR, 8, 4, 13750, IPL_LIGHT_CURSE, 2, 2, IPL_STEALLIFE, 5, 5, IPL_TOHIT, 15, 15, IPL_ALLRES, 5, 5, IPL_TOHIT, 0, 0, IPL_TOHIT, 0, 0 }, + { "Wizardspike", UITYPE_DAGGER, 11, 5, 12920, IPL_MAG, 15, 15, IPL_MANA, 35, 35, IPL_TOHIT, 25, 25, IPL_ALLRES, 15, 15, IPL_INVCURS, 50, 0, IPL_TOHIT, 0, 0 }, + { "Lightsabre", UITYPE_SABRE, 13, 4, 19150, IPL_LIGHT, 2, 2, IPL_LIGHTDAM, 1, 10, IPL_TOHIT, 20, 20, IPL_LIGHTRES, 50, 50, IPL_TOHIT, 0, 0, IPL_TOHIT, 0, 0 }, + { "The Falcon's Talon", UITYPE_SCIMITAR, 15, 5, 7867, IPL_FASTATTACK, 4, 4, IPL_TOHIT, 20, 20, IPL_DAMP_CURSE, 33, 33, IPL_DEX, 10, 10, IPL_INVCURS, 68, 0, IPL_TOHIT, 0, 0 }, + { "Inferno", UITYPE_LONGSWR, 17, 4, 34600, IPL_FIREDAM, 2, 12, IPL_LIGHT, 3, 3, IPL_MANA, 20, 20, IPL_FIRERES, 80, 80, IPL_TOHIT, 0, 0, IPL_TOHIT, 0, 0 }, + { "Doombringer", UITYPE_BASTARDSWR, 19, 5, 18250, IPL_TOHIT, 25, 25, IPL_DAMP, 250, 250, IPL_ATTRIBS_CURSE, 5, 5, IPL_LIFE_CURSE, 25, 25, IPL_LIGHT_CURSE, 2, 2, IPL_TOHIT, 0, 0 }, + { "The Grizzly", UITYPE_TWOHANDSWR, 23, 6, 50000, IPL_STR, 20, 20, IPL_VIT_CURSE, 5, 5, IPL_DAMP, 200, 200, IPL_KNOCKBACK, 0, 0, IPL_DUR, 100, 100, IPL_INVCURS, 160, 0 }, + { "The Grandfather", UITYPE_GREATSWR, 27, 6, 119800, IPL_ONEHAND, 0, 0, IPL_ATTRIBS, 5, 5, IPL_TOHIT, 20, 20, IPL_DAMP, 70, 70, IPL_LIFE, 20, 20, IPL_INVCURS, 161, 0 }, + { "The Mangler", UITYPE_LARGEAXE, 2, 5, 2850, IPL_DAMP, 200, 200, IPL_DEX_CURSE, 5, 5, IPL_MAG_CURSE, 5, 5, IPL_MANA_CURSE, 10, 10, IPL_INVCURS, 144, 0, IPL_TOHIT, 0, 0 }, + { "Sharp Beak", UITYPE_LARGEAXE, 2, 4, 2850, IPL_LIFE, 20, 20, IPL_MAG_CURSE, 10, 10, IPL_MANA_CURSE, 10, 10, IPL_INVCURS, 143, 0, IPL_TOHIT, 0, 0, IPL_TOHIT, 0, 0 }, + { "BloodSlayer", UITYPE_BROADAXE, 3, 5, 2500, IPL_DAMP, 100, 100, IPL_3XDAMVDEM, 50, 50, IPL_ATTRIBS_CURSE, 5, 5, IPL_SPLLVLADD, -1, -1, IPL_INVCURS, 144, 0, IPL_TOHIT, 0, 0 }, + { "The Celestial Axe", UITYPE_BATTLEAXE, 4, 4, 14100, IPL_NOMINSTR, 0, 0, IPL_TOHIT, 15, 15, IPL_LIFE, 15, 15, IPL_STR_CURSE, 15, 15, IPL_TOHIT, 0, 0, IPL_TOHIT, 0, 0 }, + { "Wicked Axe", UITYPE_LARGEAXE, 5, 6, 31150, IPL_TOHIT, 30, 30, IPL_DEX, 10, 10, IPL_VIT_CURSE, 10, 10, IPL_GETHIT, 1, 6, IPL_INDESTRUCTIBLE, 0, 0, IPL_INVCURS, 143, 0 }, + { "Stonecleaver", UITYPE_BROADAXE, 7, 5, 23900, IPL_LIFE, 30, 30, IPL_TOHIT, 20, 20, IPL_DAMP, 50, 50, IPL_LIGHTRES, 40, 40, IPL_INVCURS, 104, 0, IPL_TOHIT, 0, 0 }, + { "Aguinara's Hatchet", UITYPE_SMALLAXE, 12, 3, 24800, IPL_SPLLVLADD, 1, 1, IPL_MAG, 10, 10, IPL_MAGICRES, 80, 80, IPL_TOHIT, 0, 0, IPL_TOHIT, 0, 0, IPL_TOHIT, 0, 0 }, + { "Hellslayer", UITYPE_BATTLEAXE, 15, 5, 26200, IPL_STR, 8, 8, IPL_VIT, 8, 8, IPL_DAMP, 100, 100, IPL_LIFE, 25, 25, IPL_MANA_CURSE, 25, 25, IPL_TOHIT, 0, 0 }, + { "Messerschmidt's Reaver", UITYPE_GREATAXE, 25, 6, 58000, IPL_DAMP, 200, 200, IPL_DAMMOD, 15, 15, IPL_ATTRIBS, 5, 5, IPL_LIFE_CURSE, 50, 50, IPL_FIREDAM, 2, 12, IPL_INVCURS, 163, 0 }, + { "Crackrust", UITYPE_MACE, 1, 5, 11375, IPL_ATTRIBS, 2, 2, IPL_INDESTRUCTIBLE, 0, 0, IPL_ALLRES, 15, 15, IPL_DAMP, 50, 50, IPL_SPLLVLADD, -1, -1, IPL_TOHIT, 0, 0 }, + { "Hammer of Jholm", UITYPE_MAUL, 1, 4, 8700, IPL_DAMP, 4, 10, IPL_INDESTRUCTIBLE, 0, 0, IPL_STR, 3, 3, IPL_TOHIT, 15, 15, IPL_TOHIT, 0, 0, IPL_TOHIT, 0, 0 }, + { "Civerb's Cudgel", UITYPE_MACE, 1, 3, 2000, IPL_3XDAMVDEM, 35, 35, IPL_DEX_CURSE, 5, 5, IPL_MAG_CURSE, 2, 2, IPL_TOHIT, 0, 0, IPL_TOHIT, 0, 0, IPL_TOHIT, 0, 0 }, + { "The Celestial Star", UITYPE_FLAIL, 2, 5, 7810, IPL_NOMINSTR, 0, 0, IPL_LIGHT, 2, 2, IPL_DAMMOD, 10, 10, IPL_AC_CURSE, 8, 8, IPL_INVCURS, 131, 0, IPL_TOHIT, 0, 0 }, + { "Baranar's Star", UITYPE_MORNSTAR, 5, 6, 6850, IPL_TOHIT, 12, 12, IPL_DAMP, 80, 80, IPL_FASTATTACK, 1, 1, IPL_VIT, 4, 4, IPL_DEX_CURSE, 4, 4, IPL_SETDUR, 60, 60 }, + { "Gnarled Root", UITYPE_SPIKCLUB, 9, 6, 9820, IPL_TOHIT, 20, 20, IPL_DAMP, 300, 300, IPL_DEX, 10, 10, IPL_MAG, 5, 5, IPL_ALLRES, 10, 10, IPL_AC_CURSE, 10, 10 }, + { "The Cranium Basher", UITYPE_MAUL, 12, 6, 36500, IPL_DAMMOD, 20, 20, IPL_STR, 15, 15, IPL_INDESTRUCTIBLE, 0, 0, IPL_MANA_CURSE, 150, 150, IPL_ALLRES, 5, 5, IPL_INVCURS, 122, 0 }, + { "Schaefer's Hammer", UITYPE_WARHAMMER, 16, 6, 56125, IPL_DAMP_CURSE, 100, 100, IPL_LIGHTDAM, 1, 50, IPL_LIFE, 50, 50, IPL_TOHIT, 30, 30, IPL_LIGHTRES, 80, 80, IPL_LIGHT, 1, 1 }, + { "Dreamflange", UITYPE_MACE, 26, 5, 26450, IPL_MAG, 30, 30, IPL_MANA, 50, 50, IPL_MAGICRES, 50, 50, IPL_LIGHT, 2, 2, IPL_SPLLVLADD, 1, 1, IPL_TOHIT, 0, 0 }, + { "Staff of Shadows", UITYPE_LONGSTAFF, 2, 5, 1250, IPL_MAG_CURSE, 10, 10, IPL_TOHIT, 10, 10, IPL_DAMP, 60, 60, IPL_LIGHT_CURSE, 2, 2, IPL_FASTATTACK, 1, 1, IPL_TOHIT, 0, 0 }, + { "Immolator", UITYPE_LONGSTAFF, 4, 4, 3900, IPL_FIRERES, 20, 20, IPL_FIREDAM, 4, 4, IPL_MANA, 10, 10, IPL_VIT_CURSE, 5, 5, IPL_TOHIT, 0, 0, IPL_TOHIT, 0, 0 }, + { "Storm Spire", UITYPE_WARSTAFF, 8, 4, 22500, IPL_LIGHTRES, 50, 50, IPL_LIGHTDAM, 2, 8, IPL_STR, 10, 10, IPL_MAG_CURSE, 10, 10, IPL_TOHIT, 0, 0, IPL_TOHIT, 0, 0 }, + { "Gleamsong", UITYPE_SHORTSTAFF, 8, 4, 6520, IPL_MANA, 25, 25, IPL_STR_CURSE, 3, 3, IPL_VIT_CURSE, 3, 3, IPL_SPELL, 10, 76, IPL_TOHIT, 0, 0, IPL_TOHIT, 0, 0 }, + { "Thundercall", UITYPE_COMPSTAFF, 14, 5, 22250, IPL_TOHIT, 35, 35, IPL_LIGHTDAM, 1, 10, IPL_SPELL, 3, 76, IPL_LIGHTRES, 30, 30, IPL_LIGHT, 2, 2, IPL_TOHIT, 0, 0 }, + { "The Protector", UITYPE_SHORTSTAFF, 16, 6, 17240, IPL_VIT, 5, 5, IPL_GETHIT, 5, 5, IPL_SETAC, 40, 40, IPL_SPELL, 2, 86, IPL_THORNS, 1, 3, IPL_INVCURS, 162, 0 }, + { "Naj's Puzzler", UITYPE_LONGSTAFF, 18, 5, 34000, IPL_MAG, 20, 20, IPL_DEX, 10, 10, IPL_ALLRES, 20, 20, IPL_SPELL, 23, 57, IPL_LIFE_CURSE, 25, 25, IPL_TOHIT, 0, 0 }, + { "Mindcry", UITYPE_QUARSTAFF, 20, 4, 41500, IPL_MAG, 15, 15, IPL_SPELL, 13, 69, IPL_ALLRES, 15, 15, IPL_SPLLVLADD, 1, 1, IPL_TOHIT, 0, 0, IPL_TOHIT, 0, 0 }, + { "Rod of Onan", UITYPE_WARSTAFF, 22, 3, 44167, IPL_SPELL, 21, 50, IPL_DAMP, 100, 100, IPL_ATTRIBS, 5, 5, IPL_TOHIT, 0, 0, IPL_TOHIT, 0, 0, IPL_TOHIT, 0, 0 }, + { "Helm of Sprits", UITYPE_HELM, 1, 2, 7525, IPL_STEALLIFE, 5, 5, IPL_INVCURS, 77, 0, IPL_TOHIT, 0, 0, IPL_TOHIT, 0, 0, IPL_TOHIT, 0, 0, IPL_TOHIT, 0, 0 }, + { "Thinking Cap", UITYPE_SKULLCAP, 6, 5, 2020, IPL_MANA, 30, 30, IPL_SPLLVLADD, 2, 2, IPL_ALLRES, 20, 20, IPL_SETDUR, 1, 1, IPL_INVCURS, 93, 0, IPL_TOHIT, 0, 0 }, + { "OverLord's Helm", UITYPE_HELM, 7, 6, 12500, IPL_STR, 20, 20, IPL_DEX, 15, 15, IPL_VIT, 5, 5, IPL_MAG_CURSE, 20, 20, IPL_SETDUR, 15, 15, IPL_INVCURS, 99, 0 }, + { "Fool's Crest", UITYPE_HELM, 12, 5, 10150, IPL_ATTRIBS_CURSE, 4, 4, IPL_LIFE, 100, 100, IPL_GETHIT_CURSE, 1, 6, IPL_THORNS, 1, 3, IPL_INVCURS, 80, 0, IPL_TOHIT, 0, 0 }, + { "Gotterdamerung", UITYPE_GREATHELM, 21, 6, 54900, IPL_ATTRIBS, 20, 20, IPL_SETAC, 60, 60, IPL_GETHIT, 4, 4, IPL_ALLRESZERO, 0, 0, IPL_LIGHT_CURSE, 4, 4, IPL_INVCURS, 85, 0 }, + { "Royal Circlet", UITYPE_CROWN, 27, 5, 24875, IPL_ATTRIBS, 10, 10, IPL_MANA, 40, 40, IPL_SETAC, 40, 40, IPL_LIGHT, 1, 1, IPL_INVCURS, 79, 0, IPL_TOHIT, 0, 0 }, + { "Torn Flesh of Souls", UITYPE_RAGS, 2, 5, 4825, IPL_SETAC, 8, 8, IPL_VIT, 10, 10, IPL_GETHIT, 1, 1, IPL_INDESTRUCTIBLE, 0, 0, IPL_INVCURS, 92, 0, IPL_TOHIT, 0, 0 }, + { "The Gladiator's Bane", UITYPE_STUDARMOR, 6, 4, 3450, IPL_SETAC, 25, 25, IPL_GETHIT, 2, 2, IPL_DUR, 200, 200, IPL_ATTRIBS_CURSE, 3, 3, IPL_TOHIT, 0, 0, IPL_TOHIT, 0, 0 }, + { "The Rainbow Cloak", UITYPE_CLOAK, 2, 6, 4900, IPL_SETAC, 10, 10, IPL_ATTRIBS, 1, 1, IPL_ALLRES, 10, 10, IPL_LIFE, 5, 5, IPL_DUR, 50, 50, IPL_INVCURS, 138, 0 }, + { "Leather of Aut", UITYPE_LEATHARMOR, 4, 5, 10550, IPL_SETAC, 15, 15, IPL_STR, 5, 5, IPL_MAG_CURSE, 5, 5, IPL_DEX, 5, 5, IPL_INDESTRUCTIBLE, 0, 0, IPL_TOHIT, 0, 0 }, + { "Wisdom's Wrap", UITYPE_ROBE, 5, 6, 6200, IPL_MAG, 5, 5, IPL_MANA, 10, 10, IPL_LIGHTRES, 25, 25, IPL_SETAC, 15, 15, IPL_GETHIT, 1, 1, IPL_INVCURS, 138, 0 }, + { "Sparking Mail", UITYPE_CHAINMAIL, 9, 2, 15750, IPL_SETAC, 30, 30, IPL_LIGHTDAM, 1, 10, IPL_TOHIT, 0, 0, IPL_TOHIT, 0, 0, IPL_TOHIT, 0, 0, IPL_TOHIT, 0, 0 }, + { "Scavenger Carapace", UITYPE_BREASTPLATE, 13, 4, 14000, IPL_GETHIT, 15, 15, IPL_AC_CURSE, 30, 30, IPL_DEX, 5, 5, IPL_LIGHTRES, 40, 40, IPL_TOHIT, 0, 0, IPL_TOHIT, 0, 0 }, + { "Nightscape", UITYPE_CAPE, 16, 6, 11600, IPL_FASTRECOVER, 2, 2, IPL_LIGHT_CURSE, 4, 4, IPL_SETAC, 15, 15, IPL_DEX, 3, 3, IPL_ALLRES, 20, 20, IPL_INVCURS, 138, 0 }, + { "Naj's Light Plate", UITYPE_PLATEMAIL, 19, 6, 78700, IPL_NOMINSTR, 0, 0, IPL_MAG, 5, 5, IPL_MANA, 20, 20, IPL_ALLRES, 20, 20, IPL_SPLLVLADD, 1, 1, IPL_INVCURS, 159, 0 }, + { "Demonspike Coat", UITYPE_FULLPLATE, 25, 5, 251175, IPL_SETAC, 100, 100, IPL_GETHIT, 6, 6, IPL_STR, 10, 10, IPL_INDESTRUCTIBLE, 0, 0, IPL_FIRERES, 50, 50, IPL_TOHIT, 0, 0 }, + { "The Deflector", UITYPE_BUCKLER, 1, 5, 1500, IPL_SETAC, 7, 7, IPL_ALLRES, 10, 10, IPL_DAMP_CURSE, 20, 20, IPL_TOHIT_CURSE, 5, 5, IPL_INVCURS, 83, 0, IPL_TOHIT, 0, 0 }, + { "Split Skull Shield", UITYPE_BUCKLER, 1, 6, 2025, IPL_SETAC, 10, 10, IPL_LIFE, 10, 10, IPL_STR, 2, 2, IPL_LIGHT_CURSE, 1, 1, IPL_SETDUR, 15, 15, IPL_INVCURS, 116, 0 }, + { "Dragon's Breach", UITYPE_KITESHIELD, 2, 6, 19200, IPL_FIRERES, 25, 25, IPL_STR, 5, 5, IPL_SETAC, 20, 20, IPL_MAG_CURSE, 5, 5, IPL_INDESTRUCTIBLE, 0, 0, IPL_INVCURS, 117, 0 }, + { "Blackoak Shield", UITYPE_SMALLSHIELD, 4, 6, 5725, IPL_DEX, 10, 10, IPL_VIT_CURSE, 10, 10, IPL_SETAC, 18, 18, IPL_LIGHT_CURSE, 1, 1, IPL_DUR, 150, 150, IPL_INVCURS, 146, 0 }, + { "Holy Defender", UITYPE_LARGESHIELD, 10, 6, 13800, IPL_SETAC, 15, 15, IPL_GETHIT, 2, 2, IPL_FIRERES, 20, 20, IPL_DUR, 200, 200, IPL_FASTBLOCK, 1, 1, IPL_INVCURS, 146, 0 }, + { "Stormshield", UITYPE_GOTHSHIELD, 24, 6, 49000, IPL_SETAC, 40, 40, IPL_GETHIT_CURSE, 4, 4, IPL_STR, 10, 10, IPL_INDESTRUCTIBLE, 0, 0, IPL_FASTBLOCK, 1, 1, IPL_INVCURS, 148, 0 }, + { "Bramble", UITYPE_RING, 1, 4, 1000, IPL_ATTRIBS_CURSE, 2, 2, IPL_DAMMOD, 3, 3, IPL_MANA, 10, 10, IPL_INVCURS, 9, 0, IPL_TOHIT, 0, 0, IPL_TOHIT, 0, 0 }, + { "Ring of Regha", UITYPE_RING, 1, 6, 4175, IPL_MAG, 10, 10, IPL_MAGICRES, 10, 10, IPL_LIGHT, 1, 1, IPL_STR_CURSE, 3, 3, IPL_DEX_CURSE, 3, 3, IPL_INVCURS, 11, 0 }, + { "The Bleeder", UITYPE_RING, 2, 4, 8500, IPL_MAGICRES, 20, 20, IPL_MANA, 30, 30, IPL_LIFE_CURSE, 10, 10, IPL_INVCURS, 8, 0, IPL_TOHIT, 0, 0, IPL_TOHIT, 0, 0 }, + { "Constricting Ring", UITYPE_RING, 5, 3, 62000, IPL_ALLRES, 75, 75, IPL_DRAINLIFE, 0, 0, IPL_INVCURS, 14, 0, IPL_TOHIT, 0, 0, IPL_TOHIT, 0, 0, IPL_TOHIT, 0, 0 }, + { "Ring of Engagement", UITYPE_RING, 11, 5, 12476, IPL_GETHIT, 1, 2, IPL_THORNS, 1, 3, IPL_SETAC, 5, 5, IPL_TARGAC, 4, 12, IPL_INVCURS, 13, 0, IPL_TOHIT, 0, 0 }, + { "", UITYPE_INVALID, 0, 0, 0, IPL_TOHIT, 0, 0, IPL_TOHIT, 0, 0, IPL_TOHIT, 0, 0, IPL_TOHIT, 0, 0, IPL_TOHIT, 0, 0, IPL_TOHIT, 0, 0 } + // clang-format on +}; diff --git a/Source/itemdat.h b/Source/itemdat.h index 4641b5de192..00f17860884 100644 --- a/Source/itemdat.h +++ b/Source/itemdat.h @@ -1,10 +1,10 @@ -//HEADER_GOES_HERE -#ifndef __ITEMDAT_H__ -#define __ITEMDAT_H__ - -extern ItemDataStruct AllItemsList[157]; -extern const PLStruct PL_Prefix[84]; -extern const PLStruct PL_Suffix[96]; -extern const UItemStruct UniqueItemList[91]; - -#endif /* __ITEMDAT_H__ */ +//HEADER_GOES_HERE +#ifndef __ITEMDAT_H__ +#define __ITEMDAT_H__ + +extern ItemDataStruct AllItemsList[157]; +extern const PLStruct PL_Prefix[84]; +extern const PLStruct PL_Suffix[96]; +extern const UItemStruct UniqueItemList[91]; + +#endif /* __ITEMDAT_H__ */ diff --git a/Source/list.h b/Source/list.h index 3edf73619c3..c9b2f2847f8 100644 --- a/Source/list.h +++ b/Source/list.h @@ -1,249 +1,249 @@ -/* Intrusive double-linked list implementation, - * based on https://github.com/webcoyote/coho/blob/master/Base/List.h - */ - -#include "../3rdParty/Storm/Source/storm.h" - -#define OBJECT_NAME(obj) (((const char *)&typeid(obj)) + 8) - -/****************************************************************************** -* -* List definition macros -* -***/ - -// Define a field within a structure that will be used to link it into a list -#define LIST_LINK(T) TLink - -template -class TLink; - -/****************************************************************************** -* -* TList -* -***/ - -//============================================================================= -template -class TList { -public: - TList(); - ~TList(); - - void UnlinkAll(); - void DeleteAll(); - - T *Head(); - - enum InsertPos { - NONE = 0, - AFTER, - BEFORE - }; - - void Insert(T *node, InsertPos pos, T *ref); - T *Remove(T *node); - T *Create(InsertPos pos = BEFORE, size_t extra = 0, int memflags = 0); - -private: - size_t m_offset; - TLink m_link; - - TLink *GetLinkFromNode(T *node) const; - - // Hide copy-constructor and assignment operator - TList(const TList &); - TList &operator=(const TList &); - - static __forceinline void SDelete(T *node) - { - SMemFree(node, (char *)OBJECT_NAME(T), SLOG_OBJECT, 0); - } -}; - -//============================================================================= -template -TList::~TList() -{ - // BUGFIX: Unlinking does not free memory, should use DeleteAll() - UnlinkAll(); -} - -//============================================================================= -template -TList::TList() -{ - size_t offset = offsetof(T, m_Link); - // Mark this node as the end of the list, with the link offset set - m_link.m_prevLink = &m_link; - m_offset = offset; - m_link.m_nextNode = (T *)~((size_t)&m_link - offset); -} - -//============================================================================= -template -void TList::DeleteAll() -{ - while (T *node = m_link.Next()) { - node->Delete(0x0); - SDelete(node); - } -} - -//============================================================================= -template -__forceinline T *TList::Head() -{ - return m_link.Next(); -} - -//============================================================================= -template -__forceinline TLink *TList::GetLinkFromNode(T *node) const -{ - // assert(m_offset != (size_t) -1); - // return (TLink *) ((size_t) node + m_offset); - return &node->m_Link; -} - -template -T *TList::Remove(T *node) -{ - TLink *link = node ? &node->m_Link : &m_link; - T *next = link->Next(); - node->Delete(0x0); - SDelete(node); - return next; -} - -template -T *TList::Create(InsertPos pos, size_t extra, int memflags) -{ - T *node = new (extra, memflags) T; - if (pos != NONE) - Insert(node, pos, NULL); - return node; -} - -template -void TList::Insert(T *node, InsertPos pos, T *ref) -{ - TLink *reflink; - TLink *i = node ? GetLinkFromNode(node) : &m_link; - if (i->IsLinked()) - i->Unlink(); - - reflink = ref ? GetLinkFromNode(ref) : &m_link; - - switch (pos) { - case AFTER: - i->InsertAfter(node, reflink, m_offset); - break; - case BEFORE: - i->InsertBefore(node, reflink); - break; - } -} - -//============================================================================= -template -void TList::UnlinkAll() -{ - for (;;) { - T *node = m_link.Next(); - if ((int)node <= 0) - break; - node->m_Link.Unlink(); - } -} - -/****************************************************************************** -* -* TLink -* -***/ - -//============================================================================= -template -class TLink { -public: - TLink() - : m_prevLink(NULL) - , m_nextNode(NULL) - { - } - ~TLink() - { - Unlink(); - } - - bool IsLinked() const - { - return m_prevLink != NULL; - } - void Unlink(); - - T *Next() - { - if ((int)m_nextNode <= 0) - return NULL; - return m_nextNode; - } - - TLink *NextLink(size_t offset = -1) - { - if ((int)m_nextNode <= 0) - return (TLink *)~((size_t)m_nextNode); - - if ((int)offset < 0) { - // Calculate the offset from a node pointer to a link structure - offset = (size_t)this - (size_t)m_prevLink->m_nextNode; - } - - // Get the link field for the next node - return (TLink *)((size_t)m_nextNode + offset); - } - - void InsertBefore(T *node, TLink *nextLink) - { - TLink *p = nextLink->m_prevLink; - m_prevLink = p; - m_nextNode = p->m_nextNode; - - p->m_nextNode = node; - nextLink->m_prevLink = this; - } - - __forceinline void InsertAfter(T *node, TLink *prevLink, const size_t &offset) - { - m_prevLink = prevLink; - m_nextNode = prevLink->m_nextNode; - - prevLink->NextLink(offset)->m_prevLink = this; - prevLink->m_nextNode = node; - } - -private: - TLink *m_prevLink; // pointer to the previous >link field< - T *m_nextNode; // pointer to the next >object< - - // Hide copy-constructor and assignment operator - TLink(const TLink &); - TLink &operator=(const TLink &); - - friend class TList; -}; - -//============================================================================= -template -void TLink::Unlink() -{ - if (IsLinked()) { - NextLink()->m_prevLink = m_prevLink; - m_prevLink->m_nextNode = m_nextNode; - - m_prevLink = NULL; - m_nextNode = NULL; - } -} +/* Intrusive double-linked list implementation, + * based on https://github.com/webcoyote/coho/blob/master/Base/List.h + */ + +#include "../3rdParty/Storm/Source/storm.h" + +#define OBJECT_NAME(obj) (((const char *)&typeid(obj)) + 8) + +/****************************************************************************** +* +* List definition macros +* +***/ + +// Define a field within a structure that will be used to link it into a list +#define LIST_LINK(T) TLink + +template +class TLink; + +/****************************************************************************** +* +* TList +* +***/ + +//============================================================================= +template +class TList { +public: + TList(); + ~TList(); + + void UnlinkAll(); + void DeleteAll(); + + T *Head(); + + enum InsertPos { + NONE = 0, + AFTER, + BEFORE + }; + + void Insert(T *node, InsertPos pos, T *ref); + T *Remove(T *node); + T *Create(InsertPos pos = BEFORE, size_t extra = 0, int memflags = 0); + +private: + size_t m_offset; + TLink m_link; + + TLink *GetLinkFromNode(T *node) const; + + // Hide copy-constructor and assignment operator + TList(const TList &); + TList &operator=(const TList &); + + static __forceinline void SDelete(T *node) + { + SMemFree(node, (char *)OBJECT_NAME(T), SLOG_OBJECT, 0); + } +}; + +//============================================================================= +template +TList::~TList() +{ + // BUGFIX: Unlinking does not free memory, should use DeleteAll() + UnlinkAll(); +} + +//============================================================================= +template +TList::TList() +{ + size_t offset = offsetof(T, m_Link); + // Mark this node as the end of the list, with the link offset set + m_link.m_prevLink = &m_link; + m_offset = offset; + m_link.m_nextNode = (T *)~((size_t)&m_link - offset); +} + +//============================================================================= +template +void TList::DeleteAll() +{ + while (T *node = m_link.Next()) { + node->Delete(0x0); + SDelete(node); + } +} + +//============================================================================= +template +__forceinline T *TList::Head() +{ + return m_link.Next(); +} + +//============================================================================= +template +__forceinline TLink *TList::GetLinkFromNode(T *node) const +{ + // assert(m_offset != (size_t) -1); + // return (TLink *) ((size_t) node + m_offset); + return &node->m_Link; +} + +template +T *TList::Remove(T *node) +{ + TLink *link = node ? &node->m_Link : &m_link; + T *next = link->Next(); + node->Delete(0x0); + SDelete(node); + return next; +} + +template +T *TList::Create(InsertPos pos, size_t extra, int memflags) +{ + T *node = new (extra, memflags) T; + if (pos != NONE) + Insert(node, pos, NULL); + return node; +} + +template +void TList::Insert(T *node, InsertPos pos, T *ref) +{ + TLink *reflink; + TLink *i = node ? GetLinkFromNode(node) : &m_link; + if (i->IsLinked()) + i->Unlink(); + + reflink = ref ? GetLinkFromNode(ref) : &m_link; + + switch (pos) { + case AFTER: + i->InsertAfter(node, reflink, m_offset); + break; + case BEFORE: + i->InsertBefore(node, reflink); + break; + } +} + +//============================================================================= +template +void TList::UnlinkAll() +{ + for (;;) { + T *node = m_link.Next(); + if ((int)node <= 0) + break; + node->m_Link.Unlink(); + } +} + +/****************************************************************************** +* +* TLink +* +***/ + +//============================================================================= +template +class TLink { +public: + TLink() + : m_prevLink(NULL) + , m_nextNode(NULL) + { + } + ~TLink() + { + Unlink(); + } + + bool IsLinked() const + { + return m_prevLink != NULL; + } + void Unlink(); + + T *Next() + { + if ((int)m_nextNode <= 0) + return NULL; + return m_nextNode; + } + + TLink *NextLink(size_t offset = -1) + { + if ((int)m_nextNode <= 0) + return (TLink *)~((size_t)m_nextNode); + + if ((int)offset < 0) { + // Calculate the offset from a node pointer to a link structure + offset = (size_t)this - (size_t)m_prevLink->m_nextNode; + } + + // Get the link field for the next node + return (TLink *)((size_t)m_nextNode + offset); + } + + void InsertBefore(T *node, TLink *nextLink) + { + TLink *p = nextLink->m_prevLink; + m_prevLink = p; + m_nextNode = p->m_nextNode; + + p->m_nextNode = node; + nextLink->m_prevLink = this; + } + + __forceinline void InsertAfter(T *node, TLink *prevLink, const size_t &offset) + { + m_prevLink = prevLink; + m_nextNode = prevLink->m_nextNode; + + prevLink->NextLink(offset)->m_prevLink = this; + prevLink->m_nextNode = node; + } + +private: + TLink *m_prevLink; // pointer to the previous >link field< + T *m_nextNode; // pointer to the next >object< + + // Hide copy-constructor and assignment operator + TLink(const TLink &); + TLink &operator=(const TLink &); + + friend class TList; +}; + +//============================================================================= +template +void TLink::Unlink() +{ + if (IsLinked()) { + NextLink()->m_prevLink = m_prevLink; + m_prevLink->m_nextNode = m_nextNode; + + m_prevLink = NULL; + m_nextNode = NULL; + } +} diff --git a/Source/misdat.cpp b/Source/misdat.cpp index 9772dbdf327..5c518498170 100644 --- a/Source/misdat.cpp +++ b/Source/misdat.cpp @@ -1,128 +1,128 @@ -#include "diablo.h" - -MissileData missiledata[68] = { - // clang-format off - // mName, mAddProc, mProc, mDraw, mType, mResist, mFileNum, miSFX, mlSFX; - { MIS_ARROW, &AddArrow, &MI_Arrow, TRUE, 0, 0, MFILE_ARROWS, -1, -1 }, - { MIS_FIREBOLT, &AddFirebolt, &MI_Firebolt, TRUE, 1, MISR_FIRE, MFILE_FIREBA, LS_FBOLT1, LS_FIRIMP2 }, - { MIS_GUARDIAN, &AddGuardian, &MI_Guardian, TRUE, 1, 0, MFILE_GUARD, LS_GUARD, LS_GUARDLAN }, - { MIS_RNDTELEPORT, &AddRndTeleport, &MI_Teleport, FALSE, 1, 0, MFILE_NONE, LS_TELEPORT, -1 }, - { MIS_LIGHTBALL, &AddLightball, &MI_Lightball, TRUE, 1, MISR_LIGHTNING, MFILE_LGHNING, -1, -1 }, - { MIS_FIREWALL, &AddFirewall, &MI_Firewall, TRUE, 1, MISR_FIRE, MFILE_FIREWAL, LS_WALLLOOP, LS_FIRIMP2 }, - { MIS_FIREBALL, &AddFireball, &MI_Fireball, TRUE, 1, MISR_FIRE, MFILE_FIREBA, LS_FBOLT1, LS_FIRIMP2 }, - { MIS_LIGHTCTRL, &AddLightctrl, &MI_Lightctrl, FALSE, 1, MISR_LIGHTNING, MFILE_LGHNING, -1, -1 }, - { MIS_LIGHTNING, &AddLightning, &MI_Lightning, TRUE, 1, MISR_LIGHTNING, MFILE_LGHNING, LS_LNING1, LS_ELECIMP1 }, - { MIS_MISEXP, &AddMisexp, &MI_Misexp, TRUE, 2, 0, MFILE_MAGBLOS, -1, -1 }, - { MIS_TOWN, &AddTown, &MI_Town, TRUE, 1, MISR_MAGIC, MFILE_PORTAL, LS_SENTINEL, LS_ELEMENTL }, - { MIS_FLASH, &AddFlash, &MI_Flash, TRUE, 1, MISR_MAGIC, MFILE_BLUEXFR, LS_NOVA, LS_ELECIMP1 }, - { MIS_FLASH2, &AddFlash2, &MI_Flash2, TRUE, 1, MISR_MAGIC, MFILE_BLUEXBK, -1, -1 }, - { MIS_MANASHIELD, &AddManashield, &MI_SetManashield, FALSE, 1, MISR_MAGIC, MFILE_MANASHLD, LS_MSHIELD, -1 }, - { MIS_FIREMOVE, &AddFiremove, &MI_Firemove, TRUE, 1, MISR_FIRE, MFILE_FIREWAL, -1, -1 }, - { MIS_CHAIN, &AddChain, &MI_Chain, TRUE, 1, MISR_LIGHTNING, MFILE_LGHNING, LS_LNING1, LS_ELECIMP1 }, - { MIS_SENTINAL, NULL, NULL, TRUE, 1, MISR_LIGHTNING, MFILE_LGHNING, -1, -1 }, - { MIS_BLODSTAR, &miss_null_11, &mi_null_11, TRUE, 2, 0, MFILE_BLOOD, LS_BLODSTAR, LS_BLSIMPT }, - { MIS_BONE, &miss_null_12, &mi_null_11, TRUE, 2, 0, MFILE_BONE, -1, -1 }, - { MIS_METLHIT, &miss_null_13, &mi_null_11, TRUE, 2, 0, MFILE_METLHIT, -1, -1 }, - { MIS_RHINO, &AddRhino, &MI_Rhino, TRUE, 2, 0, MFILE_NONE, -1, -1 }, - { MIS_MAGMABALL, &AddMagmaball, &MI_Firebolt, TRUE, 1, MISR_FIRE, MFILE_MAGBALL, -1, -1 }, - { MIS_LIGHTCTRL2, &AddLightctrl, &MI_Lightctrl, FALSE, 1, MISR_LIGHTNING, MFILE_THINLGHT, -1, -1 }, - { MIS_LIGHTNING2, &AddLightning, &MI_Lightning, TRUE, 1, MISR_LIGHTNING, MFILE_THINLGHT, -1, -1 }, - { MIS_FLARE, &AddFlare, &MI_Firebolt, TRUE, 1, MISR_MAGIC, MFILE_FLARE, -1, -1 }, - { MIS_MISEXP2, &AddMisexp, &MI_Misexp, TRUE, 2, MISR_MAGIC, MFILE_FLAREEXP, -1, -1 }, - { MIS_TELEPORT, &AddTeleport, &MI_Teleport, FALSE, 1, 0, MFILE_NONE, LS_ELEMENTL, -1 }, - { MIS_FARROW, &AddLArrow, &MI_LArrow, TRUE, 0, MISR_FIRE, MFILE_FARROW, -1, -1 }, - { MIS_DOOMSERP, NULL, NULL, FALSE, 1, MISR_MAGIC, MFILE_DOOM, LS_DSERP, -1 }, - { MIS_FIREWALLA, &miss_null_1D, &MI_Firewall, TRUE, 2, MISR_FIRE, MFILE_FIREWAL, -1, -1 }, - { MIS_STONE, &AddStone, &MI_Stone, FALSE, 1, MISR_MAGIC, MFILE_NONE, LS_SCURIMP, -1 }, - { MIS_NULL_1F, &miss_null_1F, &MI_Dummy, TRUE, 1, 0, MFILE_NONE, -1, -1 }, - { MIS_INVISIBL, NULL, NULL, FALSE, 1, 0, MFILE_NONE, LS_INVISIBL, -1 }, - { MIS_GOLEM, &AddGolem, &MI_Golem, FALSE, 1, 0, MFILE_NONE, LS_GOLUM, -1 }, - { MIS_ETHEREALIZE, &AddEtherealize, &MI_Etherealize, TRUE, 1, 0, MFILE_ETHRSHLD, LS_ETHEREAL, -1 }, - { MIS_BLODBUR, &miss_null_23, &mi_null_11, TRUE, 2, 0, MFILE_BLODBUR, -1, -1 }, - { MIS_BOOM, &AddBoom, &MI_Boom, TRUE, 2, 0, MFILE_NEWEXP, -1, -1 }, - { MIS_HEAL, &AddHeal, &MI_Dummy, FALSE, 1, 0, MFILE_NONE, -1, -1 }, - { MIS_FIREWALLC, &AddFirewallC, &MI_FirewallC, FALSE, 1, MISR_FIRE, MFILE_FIREWAL, -1, -1 }, - { MIS_INFRA, &AddInfra, &MI_Infra, FALSE, 1, 0, MFILE_NONE, LS_INFRAVIS, -1 }, - { MIS_IDENTIFY, &AddIdentify, &MI_Dummy, FALSE, 1, 0, MFILE_NONE, -1, -1 }, - { MIS_WAVE, &AddWave, &MI_Wave, TRUE, 1, MISR_FIRE, MFILE_FIREWAL, LS_FLAMWAVE, -1 }, - { MIS_NOVA, &AddNova, &MI_Nova, TRUE, 1, MISR_LIGHTNING, MFILE_LGHNING, LS_NOVA, -1 }, - { MIS_BLODBOIL, &miss_null_1F, &MI_Blodboil, TRUE, 1, 0, MFILE_NONE, -1, LS_BLODBOIL }, - { MIS_APOCA, &AddApoca, &MI_Apoca, TRUE, 1, MISR_MAGIC, MFILE_NEWEXP, LS_APOC, -1 }, - { MIS_REPAIR, &AddRepair, &MI_Dummy, FALSE, 2, 0, MFILE_NONE, -1, -1 }, - { MIS_RECHARGE, &AddRecharge, &MI_Dummy, FALSE, 2, 0, MFILE_NONE, -1, -1 }, - { MIS_DISARM, &AddDisarm, &MI_Dummy, FALSE, 2, 0, MFILE_NONE, LS_TRAPDIS, -1 }, - { MIS_FLAME, &AddFlame, &MI_Flame, TRUE, 1, MISR_FIRE, MFILE_INFERNO, LS_SPOUTSTR, -1 }, - { MIS_FLAMEC, &AddFlamec, &MI_Flamec, FALSE, 1, MISR_FIRE, MFILE_NONE, -1, -1 }, - { MIS_FIREMAN, &miss_null_32, &mi_null_32, TRUE, 2, 0, MFILE_NONE, -1, -1 }, - { MIS_KRULL, &miss_null_33, &mi_null_33, TRUE, 0, MISR_FIRE, MFILE_KRULL, -1, -1 }, - { MIS_CBOLT, &AddCbolt, &MI_Cbolt, TRUE, 1, MISR_LIGHTNING, MFILE_MINILTNG, LS_CBOLT, -1 }, - { MIS_HBOLT, &AddHbolt, &MI_Hbolt, TRUE, 1, 0, MFILE_HOLY, LS_HOLYBOLT, LS_ELECIMP1 }, - { MIS_RESURRECT, &AddResurrect, &MI_Dummy, FALSE, 1, MISR_MAGIC, MFILE_NONE, -1, LS_RESUR }, - { MIS_TELEKINESIS, &AddTelekinesis, &MI_Dummy, FALSE, 1, 0, MFILE_NONE, LS_ETHEREAL, -1 }, - { MIS_LARROW, &AddLArrow, &MI_LArrow, TRUE, 0, MISR_LIGHTNING, MFILE_LARROW, -1, -1 }, - { MIS_ACID, &AddAcid, &MI_Firebolt, TRUE, 1, MISR_ACID, MFILE_ACIDBF, LS_ACID, -1 }, - { MIS_MISEXP3, &AddMisexp, &MI_Acidsplat, TRUE, 2, MISR_ACID, MFILE_ACIDSPLA, -1, -1 }, - { MIS_ACIDPUD, &AddAcidpud, &MI_Acidpud, TRUE, 2, MISR_ACID, MFILE_ACIDPUD, LS_PUDDLE, -1 }, - { MIS_HEALOTHER, &AddHealOther, &MI_Dummy, FALSE, 1, 0, MFILE_NONE, -1, -1 }, - { MIS_ELEMENT, &AddElement, &MI_Element, TRUE, 1, MISR_FIRE, MFILE_FIRERUN, LS_ELEMENTL, -1 }, - { MIS_RESURRECTBEAM, &AddResurrectBeam, &MI_ResurrectBeam, TRUE, 1, 0, MFILE_RESSUR1, -1, -1 }, - { MIS_BONESPIRIT, &AddBoneSpirit, &MI_Bonespirit, TRUE, 1, MISR_MAGIC, MFILE_SKLBALL, LS_BONESP, LS_BSIMPCT }, - { MIS_WEAPEXP, &AddWeapexp, &MI_Weapexp, TRUE, 2, 0, MFILE_NONE, -1, -1 }, - { MIS_RPORTAL, &AddRportal, &MI_Rportal, TRUE, 2, 0, MFILE_RPORTAL, LS_SENTINEL, LS_ELEMENTL }, - { MIS_BOOM2, &AddBoom, &MI_Boom, TRUE, 2, 0, MFILE_FIREPLAR, -1, -1 }, - { MIS_DIABAPOCA, &AddDiabApoca, &MI_Dummy, FALSE, 2, 0, MFILE_NONE, -1, -1 } - // clang-format on -}; - -MisFileData misfiledata[47] = { - // clang-format off - // mAnimName, mAnimFAmt, mName, mFlags, mAnimData[16], mAnimDelay[16], mAnimLen[16], mAnimWidth[16], mAnimWidth2[16] - { MFILE_ARROWS, 1, "Arrows", 2, { 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 }, { 16, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }, { 96, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }, { 16, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 } }, - { MFILE_FIREBA, 16, "Fireba", 0, { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }, { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }, { 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14 }, { 96, 96, 96, 96, 96, 96, 96, 96, 96, 96, 96, 96, 96, 96, 96, 96 }, { 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16 } }, - { MFILE_GUARD, 3, "Guard", 0, { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }, { 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }, { 15, 14, 3, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }, { 96, 96, 96, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }, { 16, 16, 16, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 } }, - { MFILE_LGHNING, 1, "Lghning", 0, { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }, { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }, { 8, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }, { 96, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }, { 16, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 } }, - { MFILE_FIREWAL, 2, "Firewal", 0, { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }, { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }, { 13, 11, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }, { 128, 128, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }, { 32, 32, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 } }, - { MFILE_MAGBLOS, 1, "MagBlos", 0, { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }, { 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }, { 10, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }, { 128, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }, { 32, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 } }, - { MFILE_PORTAL, 2, "Portal", 0, { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }, { 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }, { 16, 16, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }, { 96, 96, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }, { 16, 16, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 } }, - { MFILE_BLUEXFR, 1, "Bluexfr", 0, { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }, { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }, { 19, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }, { 160, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }, { 48, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 } }, - { MFILE_BLUEXBK, 1, "Bluexbk", 0, { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }, { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }, { 19, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }, { 160, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }, { 48, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 } }, - { MFILE_MANASHLD, 1, "Manashld", 2, { 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 }, { 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }, { 96, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }, { 16, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 } }, - { MFILE_BLOOD, 4, "Blood", 0, { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }, { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }, { 15, 8, 8, 8, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }, { 96, 128, 128, 128, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }, { 16, 32, 32, 32, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 } }, - { MFILE_BONE, 3, "Bone", 0, { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }, { 2, 2, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }, { 8, 8, 8, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }, { 128, 128, 128, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }, { 32, 32, 32, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 } }, - { MFILE_METLHIT, 3, "Metlhit", 0, { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }, { 2, 2, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }, { 10, 10, 10, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }, { 96, 96, 96, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }, { 16, 16, 16, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 } }, - { MFILE_FARROW, 16, "Farrow", 0, { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }, { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }, { 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4 }, { 96, 96, 96, 96, 96, 96, 96, 96, 96, 96, 96, 96, 96, 96, 96, 96 }, { 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16 } }, - { MFILE_DOOM, 9, "Doom", 1, { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }, { 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0 }, { 15, 15, 15, 15, 15, 15, 15, 15, 15, 0, 0, 0, 0, 0, 0, 0 }, { 96, 96, 96, 96, 96, 96, 96, 96, 96, 0, 0, 0, 0, 0, 0, 0 }, { 16, 16, 16, 16, 16, 16, 16, 16, 16, 0, 0, 0, 0, 0, 0, 0 } }, - { MFILE_0F, 1, " ", 1, { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }, { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }, { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }, { 0, 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 } }, - { MFILE_BLODBUR, 2, "Blodbur", 0, { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }, { 2, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }, { 8, 8, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }, { 128, 128, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }, { 32, 32, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 } }, - { MFILE_NEWEXP, 1, "Newexp", 0, { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }, { 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }, { 15, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }, { 96, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }, { 16, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 } }, - { MFILE_SHATTER1, 1, "Shatter1", 0, { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }, { 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }, { 12, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }, { 128, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }, { 32, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 } }, - { MFILE_BIGEXP, 1, "Bigexp", 0, { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }, { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }, { 15, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }, { 160, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }, { 48, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 } }, - { MFILE_INFERNO, 1, "Inferno", 0, { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }, { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }, { 20, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }, { 96, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }, { 16, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 } }, - { MFILE_THINLGHT, 1, "Thinlght", 1, { 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 }, { 8, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }, { 96, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }, { 16, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 } }, - { MFILE_FLARE, 1, "Flare", 0, { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }, { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }, { 16, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }, { 128, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }, { 32, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 } }, - { MFILE_FLAREEXP, 1, "Flareexp", 0, { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }, { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }, { 7, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }, { 128, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }, { 32, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 } }, - { MFILE_MAGBALL, 8, "Magball", 1, { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }, { 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0 }, { 16, 16, 16, 16, 16, 16, 16, 16, 0, 0, 0, 0, 0, 0, 0, 0 }, { 128, 128, 128, 128, 128, 128, 128, 128, 0, 0, 0, 0, 0, 0, 0, 0 }, { 32, 32, 32, 32, 32, 32, 32, 32, 0, 0, 0, 0, 0, 0, 0, 0 } }, - { MFILE_KRULL, 1, "Krull", 1, { 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 }, { 14, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }, { 96, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }, { 16, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 } }, - { MFILE_MINILTNG, 1, "Miniltng", 0, { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }, { 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }, { 8, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }, { 64, 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 } }, - { MFILE_HOLY, 16, "Holy", 0, { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }, { 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }, { 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14 }, { 96, 96, 96, 96, 96, 96, 96, 96, 96, 96, 96, 96, 96, 96, 96, 96 }, { 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16 } }, - { MFILE_HOLYEXPL, 1, "Holyexpl", 0, { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }, { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }, { 8, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }, { 160, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }, { 48, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 } }, - { MFILE_LARROW, 16, "Larrow", 0, { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }, { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }, { 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4 }, { 96, 96, 96, 96, 96, 96, 96, 96, 96, 96, 96, 96, 96, 96, 96, 96 }, { 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16 } }, - { MFILE_FIRARWEX, 1, "Firarwex", 0, { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }, { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }, { 6, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }, { 64, 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 } }, - { MFILE_ACIDBF, 16, "Acidbf", 1, { 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 }, { 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8 }, { 96, 96, 96, 96, 96, 96, 96, 96, 96, 96, 96, 96, 96, 96, 96, 96 }, { 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16 } }, - { MFILE_ACIDSPLA, 1, "Acidspla", 1, { 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 }, { 8, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }, { 96, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }, { 16, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 } }, - { MFILE_ACIDPUD, 2, "Acidpud", 1, { 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 }, { 9, 4, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }, { 96, 96, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }, { 16, 16, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 } }, - { MFILE_ETHRSHLD, 1, "Ethrshld", 0, { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }, { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }, { 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }, { 96, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }, { 16, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 } }, - { MFILE_FIRERUN, 8, "Firerun", 0, { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }, { 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0 }, { 12, 12, 12, 12, 12, 12, 12, 12, 0, 0, 0, 0, 0, 0, 0, 0 }, { 96, 96, 96, 96, 96, 96, 96, 96, 0, 0, 0, 0, 0, 0, 0, 0 }, { 16, 16, 16, 16, 16, 16, 16, 16, 0, 0, 0, 0, 0, 0, 0, 0 } }, - { MFILE_RESSUR1, 1, "Ressur1", 0, { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }, { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }, { 16, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }, { 96, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }, { 16, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 } }, - { MFILE_SKLBALL, 9, "Sklball", 0, { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }, { 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0 }, { 16, 16, 16, 16, 16, 16, 16, 16, 8, 0, 0, 0, 0, 0, 0, 0 }, { 96, 96, 96, 96, 96, 96, 96, 96, 96, 0, 0, 0, 0, 0, 0, 0 }, { 16, 16, 16, 16, 16, 16, 16, 16, 16, 0, 0, 0, 0, 0, 0, 0 } }, - { MFILE_RPORTAL, 2, "Rportal", 0, { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }, { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }, { 16, 16, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }, { 96, 96, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }, { 16, 16, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 } }, - { MFILE_FIREPLAR, 1, "Fireplar", 1, { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }, { 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }, { 17, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }, { 160, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }, { 48, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 } }, - { MFILE_SCUBMISB, 1, "Scubmisb", 1, { 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 }, { 16, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }, { 96, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }, { 16, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 } }, - { MFILE_SCBSEXPB, 1, "Scbsexpb", 1, { 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 }, { 6, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }, { 128, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }, { 32, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 } }, - { MFILE_SCUBMISC, 1, "Scubmisc", 1, { 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 }, { 16, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }, { 96, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }, { 16, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 } }, - { MFILE_SCBSEXPC, 1, "Scbsexpc", 1, { 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 }, { 6, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }, { 128, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }, { 32, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 } }, - { MFILE_SCUBMISD, 1, "Scubmisd", 1, { 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 }, { 16, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }, { 96, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }, { 16, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 } }, - { MFILE_SCBSEXPD, 1, "Scbsexpd", 1, { 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 }, { 6, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }, { 128, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }, { 32, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 } }, - { MFILE_NONE, 0, "", 0, { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }, { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }, { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }, { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }, { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 } } - // clang-format on -}; +#include "diablo.h" + +MissileData missiledata[68] = { + // clang-format off + // mName, mAddProc, mProc, mDraw, mType, mResist, mFileNum, miSFX, mlSFX; + { MIS_ARROW, &AddArrow, &MI_Arrow, TRUE, 0, 0, MFILE_ARROWS, -1, -1 }, + { MIS_FIREBOLT, &AddFirebolt, &MI_Firebolt, TRUE, 1, MISR_FIRE, MFILE_FIREBA, LS_FBOLT1, LS_FIRIMP2 }, + { MIS_GUARDIAN, &AddGuardian, &MI_Guardian, TRUE, 1, 0, MFILE_GUARD, LS_GUARD, LS_GUARDLAN }, + { MIS_RNDTELEPORT, &AddRndTeleport, &MI_Teleport, FALSE, 1, 0, MFILE_NONE, LS_TELEPORT, -1 }, + { MIS_LIGHTBALL, &AddLightball, &MI_Lightball, TRUE, 1, MISR_LIGHTNING, MFILE_LGHNING, -1, -1 }, + { MIS_FIREWALL, &AddFirewall, &MI_Firewall, TRUE, 1, MISR_FIRE, MFILE_FIREWAL, LS_WALLLOOP, LS_FIRIMP2 }, + { MIS_FIREBALL, &AddFireball, &MI_Fireball, TRUE, 1, MISR_FIRE, MFILE_FIREBA, LS_FBOLT1, LS_FIRIMP2 }, + { MIS_LIGHTCTRL, &AddLightctrl, &MI_Lightctrl, FALSE, 1, MISR_LIGHTNING, MFILE_LGHNING, -1, -1 }, + { MIS_LIGHTNING, &AddLightning, &MI_Lightning, TRUE, 1, MISR_LIGHTNING, MFILE_LGHNING, LS_LNING1, LS_ELECIMP1 }, + { MIS_MISEXP, &AddMisexp, &MI_Misexp, TRUE, 2, 0, MFILE_MAGBLOS, -1, -1 }, + { MIS_TOWN, &AddTown, &MI_Town, TRUE, 1, MISR_MAGIC, MFILE_PORTAL, LS_SENTINEL, LS_ELEMENTL }, + { MIS_FLASH, &AddFlash, &MI_Flash, TRUE, 1, MISR_MAGIC, MFILE_BLUEXFR, LS_NOVA, LS_ELECIMP1 }, + { MIS_FLASH2, &AddFlash2, &MI_Flash2, TRUE, 1, MISR_MAGIC, MFILE_BLUEXBK, -1, -1 }, + { MIS_MANASHIELD, &AddManashield, &MI_SetManashield, FALSE, 1, MISR_MAGIC, MFILE_MANASHLD, LS_MSHIELD, -1 }, + { MIS_FIREMOVE, &AddFiremove, &MI_Firemove, TRUE, 1, MISR_FIRE, MFILE_FIREWAL, -1, -1 }, + { MIS_CHAIN, &AddChain, &MI_Chain, TRUE, 1, MISR_LIGHTNING, MFILE_LGHNING, LS_LNING1, LS_ELECIMP1 }, + { MIS_SENTINAL, NULL, NULL, TRUE, 1, MISR_LIGHTNING, MFILE_LGHNING, -1, -1 }, + { MIS_BLODSTAR, &miss_null_11, &mi_null_11, TRUE, 2, 0, MFILE_BLOOD, LS_BLODSTAR, LS_BLSIMPT }, + { MIS_BONE, &miss_null_12, &mi_null_11, TRUE, 2, 0, MFILE_BONE, -1, -1 }, + { MIS_METLHIT, &miss_null_13, &mi_null_11, TRUE, 2, 0, MFILE_METLHIT, -1, -1 }, + { MIS_RHINO, &AddRhino, &MI_Rhino, TRUE, 2, 0, MFILE_NONE, -1, -1 }, + { MIS_MAGMABALL, &AddMagmaball, &MI_Firebolt, TRUE, 1, MISR_FIRE, MFILE_MAGBALL, -1, -1 }, + { MIS_LIGHTCTRL2, &AddLightctrl, &MI_Lightctrl, FALSE, 1, MISR_LIGHTNING, MFILE_THINLGHT, -1, -1 }, + { MIS_LIGHTNING2, &AddLightning, &MI_Lightning, TRUE, 1, MISR_LIGHTNING, MFILE_THINLGHT, -1, -1 }, + { MIS_FLARE, &AddFlare, &MI_Firebolt, TRUE, 1, MISR_MAGIC, MFILE_FLARE, -1, -1 }, + { MIS_MISEXP2, &AddMisexp, &MI_Misexp, TRUE, 2, MISR_MAGIC, MFILE_FLAREEXP, -1, -1 }, + { MIS_TELEPORT, &AddTeleport, &MI_Teleport, FALSE, 1, 0, MFILE_NONE, LS_ELEMENTL, -1 }, + { MIS_FARROW, &AddLArrow, &MI_LArrow, TRUE, 0, MISR_FIRE, MFILE_FARROW, -1, -1 }, + { MIS_DOOMSERP, NULL, NULL, FALSE, 1, MISR_MAGIC, MFILE_DOOM, LS_DSERP, -1 }, + { MIS_FIREWALLA, &miss_null_1D, &MI_Firewall, TRUE, 2, MISR_FIRE, MFILE_FIREWAL, -1, -1 }, + { MIS_STONE, &AddStone, &MI_Stone, FALSE, 1, MISR_MAGIC, MFILE_NONE, LS_SCURIMP, -1 }, + { MIS_NULL_1F, &miss_null_1F, &MI_Dummy, TRUE, 1, 0, MFILE_NONE, -1, -1 }, + { MIS_INVISIBL, NULL, NULL, FALSE, 1, 0, MFILE_NONE, LS_INVISIBL, -1 }, + { MIS_GOLEM, &AddGolem, &MI_Golem, FALSE, 1, 0, MFILE_NONE, LS_GOLUM, -1 }, + { MIS_ETHEREALIZE, &AddEtherealize, &MI_Etherealize, TRUE, 1, 0, MFILE_ETHRSHLD, LS_ETHEREAL, -1 }, + { MIS_BLODBUR, &miss_null_23, &mi_null_11, TRUE, 2, 0, MFILE_BLODBUR, -1, -1 }, + { MIS_BOOM, &AddBoom, &MI_Boom, TRUE, 2, 0, MFILE_NEWEXP, -1, -1 }, + { MIS_HEAL, &AddHeal, &MI_Dummy, FALSE, 1, 0, MFILE_NONE, -1, -1 }, + { MIS_FIREWALLC, &AddFirewallC, &MI_FirewallC, FALSE, 1, MISR_FIRE, MFILE_FIREWAL, -1, -1 }, + { MIS_INFRA, &AddInfra, &MI_Infra, FALSE, 1, 0, MFILE_NONE, LS_INFRAVIS, -1 }, + { MIS_IDENTIFY, &AddIdentify, &MI_Dummy, FALSE, 1, 0, MFILE_NONE, -1, -1 }, + { MIS_WAVE, &AddWave, &MI_Wave, TRUE, 1, MISR_FIRE, MFILE_FIREWAL, LS_FLAMWAVE, -1 }, + { MIS_NOVA, &AddNova, &MI_Nova, TRUE, 1, MISR_LIGHTNING, MFILE_LGHNING, LS_NOVA, -1 }, + { MIS_BLODBOIL, &miss_null_1F, &MI_Blodboil, TRUE, 1, 0, MFILE_NONE, -1, LS_BLODBOIL }, + { MIS_APOCA, &AddApoca, &MI_Apoca, TRUE, 1, MISR_MAGIC, MFILE_NEWEXP, LS_APOC, -1 }, + { MIS_REPAIR, &AddRepair, &MI_Dummy, FALSE, 2, 0, MFILE_NONE, -1, -1 }, + { MIS_RECHARGE, &AddRecharge, &MI_Dummy, FALSE, 2, 0, MFILE_NONE, -1, -1 }, + { MIS_DISARM, &AddDisarm, &MI_Dummy, FALSE, 2, 0, MFILE_NONE, LS_TRAPDIS, -1 }, + { MIS_FLAME, &AddFlame, &MI_Flame, TRUE, 1, MISR_FIRE, MFILE_INFERNO, LS_SPOUTSTR, -1 }, + { MIS_FLAMEC, &AddFlamec, &MI_Flamec, FALSE, 1, MISR_FIRE, MFILE_NONE, -1, -1 }, + { MIS_FIREMAN, &miss_null_32, &mi_null_32, TRUE, 2, 0, MFILE_NONE, -1, -1 }, + { MIS_KRULL, &miss_null_33, &mi_null_33, TRUE, 0, MISR_FIRE, MFILE_KRULL, -1, -1 }, + { MIS_CBOLT, &AddCbolt, &MI_Cbolt, TRUE, 1, MISR_LIGHTNING, MFILE_MINILTNG, LS_CBOLT, -1 }, + { MIS_HBOLT, &AddHbolt, &MI_Hbolt, TRUE, 1, 0, MFILE_HOLY, LS_HOLYBOLT, LS_ELECIMP1 }, + { MIS_RESURRECT, &AddResurrect, &MI_Dummy, FALSE, 1, MISR_MAGIC, MFILE_NONE, -1, LS_RESUR }, + { MIS_TELEKINESIS, &AddTelekinesis, &MI_Dummy, FALSE, 1, 0, MFILE_NONE, LS_ETHEREAL, -1 }, + { MIS_LARROW, &AddLArrow, &MI_LArrow, TRUE, 0, MISR_LIGHTNING, MFILE_LARROW, -1, -1 }, + { MIS_ACID, &AddAcid, &MI_Firebolt, TRUE, 1, MISR_ACID, MFILE_ACIDBF, LS_ACID, -1 }, + { MIS_MISEXP3, &AddMisexp, &MI_Acidsplat, TRUE, 2, MISR_ACID, MFILE_ACIDSPLA, -1, -1 }, + { MIS_ACIDPUD, &AddAcidpud, &MI_Acidpud, TRUE, 2, MISR_ACID, MFILE_ACIDPUD, LS_PUDDLE, -1 }, + { MIS_HEALOTHER, &AddHealOther, &MI_Dummy, FALSE, 1, 0, MFILE_NONE, -1, -1 }, + { MIS_ELEMENT, &AddElement, &MI_Element, TRUE, 1, MISR_FIRE, MFILE_FIRERUN, LS_ELEMENTL, -1 }, + { MIS_RESURRECTBEAM, &AddResurrectBeam, &MI_ResurrectBeam, TRUE, 1, 0, MFILE_RESSUR1, -1, -1 }, + { MIS_BONESPIRIT, &AddBoneSpirit, &MI_Bonespirit, TRUE, 1, MISR_MAGIC, MFILE_SKLBALL, LS_BONESP, LS_BSIMPCT }, + { MIS_WEAPEXP, &AddWeapexp, &MI_Weapexp, TRUE, 2, 0, MFILE_NONE, -1, -1 }, + { MIS_RPORTAL, &AddRportal, &MI_Rportal, TRUE, 2, 0, MFILE_RPORTAL, LS_SENTINEL, LS_ELEMENTL }, + { MIS_BOOM2, &AddBoom, &MI_Boom, TRUE, 2, 0, MFILE_FIREPLAR, -1, -1 }, + { MIS_DIABAPOCA, &AddDiabApoca, &MI_Dummy, FALSE, 2, 0, MFILE_NONE, -1, -1 } + // clang-format on +}; + +MisFileData misfiledata[47] = { + // clang-format off + // mAnimName, mAnimFAmt, mName, mFlags, mAnimData[16], mAnimDelay[16], mAnimLen[16], mAnimWidth[16], mAnimWidth2[16] + { MFILE_ARROWS, 1, "Arrows", 2, { 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 }, { 16, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }, { 96, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }, { 16, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 } }, + { MFILE_FIREBA, 16, "Fireba", 0, { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }, { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }, { 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14 }, { 96, 96, 96, 96, 96, 96, 96, 96, 96, 96, 96, 96, 96, 96, 96, 96 }, { 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16 } }, + { MFILE_GUARD, 3, "Guard", 0, { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }, { 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }, { 15, 14, 3, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }, { 96, 96, 96, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }, { 16, 16, 16, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 } }, + { MFILE_LGHNING, 1, "Lghning", 0, { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }, { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }, { 8, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }, { 96, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }, { 16, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 } }, + { MFILE_FIREWAL, 2, "Firewal", 0, { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }, { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }, { 13, 11, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }, { 128, 128, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }, { 32, 32, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 } }, + { MFILE_MAGBLOS, 1, "MagBlos", 0, { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }, { 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }, { 10, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }, { 128, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }, { 32, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 } }, + { MFILE_PORTAL, 2, "Portal", 0, { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }, { 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }, { 16, 16, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }, { 96, 96, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }, { 16, 16, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 } }, + { MFILE_BLUEXFR, 1, "Bluexfr", 0, { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }, { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }, { 19, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }, { 160, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }, { 48, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 } }, + { MFILE_BLUEXBK, 1, "Bluexbk", 0, { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }, { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }, { 19, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }, { 160, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }, { 48, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 } }, + { MFILE_MANASHLD, 1, "Manashld", 2, { 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 }, { 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }, { 96, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }, { 16, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 } }, + { MFILE_BLOOD, 4, "Blood", 0, { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }, { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }, { 15, 8, 8, 8, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }, { 96, 128, 128, 128, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }, { 16, 32, 32, 32, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 } }, + { MFILE_BONE, 3, "Bone", 0, { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }, { 2, 2, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }, { 8, 8, 8, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }, { 128, 128, 128, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }, { 32, 32, 32, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 } }, + { MFILE_METLHIT, 3, "Metlhit", 0, { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }, { 2, 2, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }, { 10, 10, 10, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }, { 96, 96, 96, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }, { 16, 16, 16, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 } }, + { MFILE_FARROW, 16, "Farrow", 0, { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }, { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }, { 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4 }, { 96, 96, 96, 96, 96, 96, 96, 96, 96, 96, 96, 96, 96, 96, 96, 96 }, { 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16 } }, + { MFILE_DOOM, 9, "Doom", 1, { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }, { 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0 }, { 15, 15, 15, 15, 15, 15, 15, 15, 15, 0, 0, 0, 0, 0, 0, 0 }, { 96, 96, 96, 96, 96, 96, 96, 96, 96, 0, 0, 0, 0, 0, 0, 0 }, { 16, 16, 16, 16, 16, 16, 16, 16, 16, 0, 0, 0, 0, 0, 0, 0 } }, + { MFILE_0F, 1, " ", 1, { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }, { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }, { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }, { 0, 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 } }, + { MFILE_BLODBUR, 2, "Blodbur", 0, { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }, { 2, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }, { 8, 8, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }, { 128, 128, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }, { 32, 32, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 } }, + { MFILE_NEWEXP, 1, "Newexp", 0, { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }, { 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }, { 15, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }, { 96, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }, { 16, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 } }, + { MFILE_SHATTER1, 1, "Shatter1", 0, { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }, { 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }, { 12, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }, { 128, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }, { 32, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 } }, + { MFILE_BIGEXP, 1, "Bigexp", 0, { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }, { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }, { 15, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }, { 160, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }, { 48, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 } }, + { MFILE_INFERNO, 1, "Inferno", 0, { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }, { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }, { 20, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }, { 96, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }, { 16, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 } }, + { MFILE_THINLGHT, 1, "Thinlght", 1, { 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 }, { 8, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }, { 96, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }, { 16, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 } }, + { MFILE_FLARE, 1, "Flare", 0, { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }, { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }, { 16, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }, { 128, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }, { 32, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 } }, + { MFILE_FLAREEXP, 1, "Flareexp", 0, { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }, { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }, { 7, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }, { 128, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }, { 32, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 } }, + { MFILE_MAGBALL, 8, "Magball", 1, { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }, { 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0 }, { 16, 16, 16, 16, 16, 16, 16, 16, 0, 0, 0, 0, 0, 0, 0, 0 }, { 128, 128, 128, 128, 128, 128, 128, 128, 0, 0, 0, 0, 0, 0, 0, 0 }, { 32, 32, 32, 32, 32, 32, 32, 32, 0, 0, 0, 0, 0, 0, 0, 0 } }, + { MFILE_KRULL, 1, "Krull", 1, { 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 }, { 14, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }, { 96, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }, { 16, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 } }, + { MFILE_MINILTNG, 1, "Miniltng", 0, { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }, { 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }, { 8, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }, { 64, 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 } }, + { MFILE_HOLY, 16, "Holy", 0, { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }, { 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }, { 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14 }, { 96, 96, 96, 96, 96, 96, 96, 96, 96, 96, 96, 96, 96, 96, 96, 96 }, { 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16 } }, + { MFILE_HOLYEXPL, 1, "Holyexpl", 0, { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }, { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }, { 8, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }, { 160, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }, { 48, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 } }, + { MFILE_LARROW, 16, "Larrow", 0, { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }, { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }, { 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4 }, { 96, 96, 96, 96, 96, 96, 96, 96, 96, 96, 96, 96, 96, 96, 96, 96 }, { 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16 } }, + { MFILE_FIRARWEX, 1, "Firarwex", 0, { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }, { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }, { 6, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }, { 64, 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 } }, + { MFILE_ACIDBF, 16, "Acidbf", 1, { 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 }, { 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8 }, { 96, 96, 96, 96, 96, 96, 96, 96, 96, 96, 96, 96, 96, 96, 96, 96 }, { 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16 } }, + { MFILE_ACIDSPLA, 1, "Acidspla", 1, { 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 }, { 8, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }, { 96, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }, { 16, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 } }, + { MFILE_ACIDPUD, 2, "Acidpud", 1, { 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 }, { 9, 4, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }, { 96, 96, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }, { 16, 16, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 } }, + { MFILE_ETHRSHLD, 1, "Ethrshld", 0, { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }, { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }, { 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }, { 96, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }, { 16, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 } }, + { MFILE_FIRERUN, 8, "Firerun", 0, { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }, { 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0 }, { 12, 12, 12, 12, 12, 12, 12, 12, 0, 0, 0, 0, 0, 0, 0, 0 }, { 96, 96, 96, 96, 96, 96, 96, 96, 0, 0, 0, 0, 0, 0, 0, 0 }, { 16, 16, 16, 16, 16, 16, 16, 16, 0, 0, 0, 0, 0, 0, 0, 0 } }, + { MFILE_RESSUR1, 1, "Ressur1", 0, { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }, { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }, { 16, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }, { 96, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }, { 16, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 } }, + { MFILE_SKLBALL, 9, "Sklball", 0, { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }, { 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0 }, { 16, 16, 16, 16, 16, 16, 16, 16, 8, 0, 0, 0, 0, 0, 0, 0 }, { 96, 96, 96, 96, 96, 96, 96, 96, 96, 0, 0, 0, 0, 0, 0, 0 }, { 16, 16, 16, 16, 16, 16, 16, 16, 16, 0, 0, 0, 0, 0, 0, 0 } }, + { MFILE_RPORTAL, 2, "Rportal", 0, { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }, { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }, { 16, 16, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }, { 96, 96, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }, { 16, 16, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 } }, + { MFILE_FIREPLAR, 1, "Fireplar", 1, { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }, { 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }, { 17, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }, { 160, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }, { 48, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 } }, + { MFILE_SCUBMISB, 1, "Scubmisb", 1, { 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 }, { 16, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }, { 96, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }, { 16, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 } }, + { MFILE_SCBSEXPB, 1, "Scbsexpb", 1, { 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 }, { 6, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }, { 128, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }, { 32, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 } }, + { MFILE_SCUBMISC, 1, "Scubmisc", 1, { 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 }, { 16, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }, { 96, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }, { 16, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 } }, + { MFILE_SCBSEXPC, 1, "Scbsexpc", 1, { 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 }, { 6, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }, { 128, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }, { 32, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 } }, + { MFILE_SCUBMISD, 1, "Scubmisd", 1, { 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 }, { 16, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }, { 96, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }, { 16, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 } }, + { MFILE_SCBSEXPD, 1, "Scbsexpd", 1, { 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 }, { 6, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }, { 128, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }, { 32, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 } }, + { MFILE_NONE, 0, "", 0, { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }, { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }, { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }, { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }, { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 } } + // clang-format on +}; diff --git a/Source/misdat.h b/Source/misdat.h index 1dd8a4297c9..d64cc993df6 100644 --- a/Source/misdat.h +++ b/Source/misdat.h @@ -1,8 +1,8 @@ -//HEADER_GOES_HERE -#ifndef __MISDAT_H__ -#define __MISDAT_H__ - -extern MissileData missiledata[68]; -extern MisFileData misfiledata[47]; - -#endif /* __MISDAT_H__ */ +//HEADER_GOES_HERE +#ifndef __MISDAT_H__ +#define __MISDAT_H__ + +extern MissileData missiledata[68]; +extern MisFileData misfiledata[47]; + +#endif /* __MISDAT_H__ */ diff --git a/Source/monstdat.cpp b/Source/monstdat.cpp index 06ad121dc23..17b50116807 100644 --- a/Source/monstdat.cpp +++ b/Source/monstdat.cpp @@ -1,254 +1,254 @@ -#include "diablo.h" - -MonsterData monsterdata[112] = { - // clang-format off - // width, mImage, GraphicType, has_special, sndfile, snd_special, has_trans, TransFile, Frames[6], Rate[6], mName, mMinDLvl, mMaxDLvl, mLevel, mMinHP, mMaxHP, mAi, mFlags, mInt, mHit, mAFNum, mMinDamage, mMaxDamage, mHit2, mAFNum2, mMinDamage2, mMaxDamage2, mArmorClass, mMonstClass, mMagicRes , mMagicRes2 , mTreasure, mSelFlag, mExp - { 128, 799, "Monsters\\Zombie\\Zombie%c.CL2", FALSE, "Monsters\\Zombie\\Zombie%c%i.WAV", FALSE, FALSE, NULL, { 11, 24, 12, 6, 16, 0 }, { 4, 0, 0, 0, 0, 0 }, "Zombie", 1, 3, 1, 4, 7, AI_ZOMBIE, 0 , 0, 10, 8, 2, 5, 0, 0, 0, 0, 5, MC_UNDEAD, IMUNE_MAGIC | IMUNE_NULL_40, IMUNE_MAGIC | IMUNE_NULL_40, 0, 3, 54 }, - { 128, 799, "Monsters\\Zombie\\Zombie%c.CL2", FALSE, "Monsters\\Zombie\\Zombie%c%i.WAV", FALSE, TRUE, "Monsters\\Zombie\\Bluered.TRN", { 11, 24, 12, 6, 16, 0 }, { 4, 0, 0, 0, 0, 0 }, "Ghoul", 2, 4, 2, 7, 11, AI_ZOMBIE, 0 , 1, 10, 8, 3, 10, 0, 0, 0, 0, 10, MC_UNDEAD, IMUNE_MAGIC | IMUNE_NULL_40, IMUNE_MAGIC | IMUNE_NULL_40, 0, 3, 58 }, - { 128, 799, "Monsters\\Zombie\\Zombie%c.CL2", FALSE, "Monsters\\Zombie\\Zombie%c%i.WAV", FALSE, TRUE, "Monsters\\Zombie\\Grey.TRN", { 11, 24, 12, 6, 16, 0 }, { 4, 0, 0, 0, 0, 0 }, "Rotting Carcass", 2, 6, 4, 15, 25, AI_ZOMBIE, 0 , 2, 25, 8, 5, 15, 0, 0, 0, 0, 15, MC_UNDEAD, IMUNE_MAGIC | IMUNE_NULL_40, IMUNE_MAGIC | RESIST_FIRE | IMUNE_NULL_40, 0, 3, 136 }, - { 128, 799, "Monsters\\Zombie\\Zombie%c.CL2", FALSE, "Monsters\\Zombie\\Zombie%c%i.WAV", FALSE, TRUE, "Monsters\\Zombie\\Yellow.TRN", { 11, 24, 12, 6, 16, 0 }, { 4, 0, 0, 0, 0, 0 }, "Black Death", 4, 8, 6, 25, 40, AI_ZOMBIE, 0 , 3, 30, 8, 6, 22, 0, 0, 0, 0, 20, MC_UNDEAD, IMUNE_MAGIC | IMUNE_NULL_40, IMUNE_MAGIC | RESIST_LIGHTNING | IMUNE_NULL_40, 0, 3, 240 }, - { 128, 543, "Monsters\\FalSpear\\Phall%c.CL2", TRUE, "Monsters\\FalSpear\\Phall%c%i.WAV", TRUE, TRUE, "Monsters\\FalSpear\\FallenT.TRN", { 11, 11, 13, 11, 18, 13 }, { 3, 0, 0, 0, 0, 0 }, "Fallen One", 1, 3, 1, 1, 4, AI_FALLEN, 0 , 0, 15, 7, 1, 3, 0, 5, 0, 0, 0, MC_ANIMAL, 0 , 0 , 0, 3, 46 }, - { 128, 543, "Monsters\\FalSpear\\Phall%c.CL2", TRUE, "Monsters\\FalSpear\\Phall%c%i.WAV", TRUE, TRUE, "Monsters\\FalSpear\\Dark.TRN", { 11, 11, 13, 11, 18, 13 }, { 3, 0, 0, 0, 0, 0 }, "Carver", 2, 5, 3, 4, 8, AI_FALLEN, 0 , 2, 20, 7, 2, 5, 0, 5, 0, 0, 5, MC_ANIMAL, 0 , 0 , 0, 3, 80 }, - { 128, 543, "Monsters\\FalSpear\\Phall%c.CL2", TRUE, "Monsters\\FalSpear\\Phall%c%i.WAV", TRUE, FALSE, NULL, { 11, 11, 13, 11, 18, 13 }, { 3, 0, 0, 0, 0, 0 }, "Devil Kin", 3, 7, 5, 12, 24, AI_FALLEN, 0 , 2, 25, 7, 3, 7, 0, 5, 0, 0, 10, MC_ANIMAL, 0 , RESIST_FIRE , 0, 3, 155 }, - { 128, 543, "Monsters\\FalSpear\\Phall%c.CL2", TRUE, "Monsters\\FalSpear\\Phall%c%i.WAV", TRUE, TRUE, "Monsters\\FalSpear\\Blue.TRN", { 11, 11, 13, 11, 18, 13 }, { 3, 0, 0, 0, 0, 0 }, "Dark One", 5, 9, 7, 20, 36, AI_FALLEN, 0 , 3, 30, 7, 4, 8, 0, 5, 0, 0, 15, MC_ANIMAL, IMUNE_NULL_40, RESIST_LIGHTNING | IMUNE_NULL_40, 0, 3, 255 }, - { 128, 553, "Monsters\\SkelAxe\\SklAx%c.CL2", TRUE, "Monsters\\SkelAxe\\SklAx%c%i.WAV", FALSE, TRUE, "Monsters\\SkelAxe\\White.TRN", { 12, 8, 13, 6, 17, 16 }, { 5, 0, 0, 0, 0, 0 }, "Skeleton", 1, 3, 1, 2, 4, AI_SKELSD, 0 , 0, 20, 8, 1, 4, 0, 0, 0, 0, 0, MC_UNDEAD, IMUNE_MAGIC | IMUNE_NULL_40, IMUNE_MAGIC | IMUNE_NULL_40, 0, 3, 64 }, - { 128, 553, "Monsters\\SkelAxe\\SklAx%c.CL2", TRUE, "Monsters\\SkelAxe\\SklAx%c%i.WAV", FALSE, TRUE, "Monsters\\SkelAxe\\Skelt.TRN", { 12, 8, 13, 6, 17, 16 }, { 4, 0, 0, 0, 0, 0 }, "Corpse Axe", 2, 5, 2, 4, 7, AI_SKELSD, 0 , 1, 25, 8, 3, 5, 0, 0, 0, 0, 0, MC_UNDEAD, IMUNE_MAGIC | IMUNE_NULL_40, IMUNE_MAGIC | IMUNE_NULL_40, 0, 3, 68 }, - { 128, 553, "Monsters\\SkelAxe\\SklAx%c.CL2", TRUE, "Monsters\\SkelAxe\\SklAx%c%i.WAV", FALSE, FALSE, NULL, { 12, 8, 13, 6, 17, 16 }, { 2, 0, 0, 0, 0, 0 }, "Burning Dead", 2, 6, 4, 8, 12, AI_SKELSD, 0 , 2, 30, 8, 3, 7, 0, 0, 0, 0, 5, MC_UNDEAD, IMUNE_MAGIC | RESIST_FIRE | IMUNE_NULL_40, IMUNE_MAGIC | IMUNE_FIRE | IMUNE_NULL_40, 0, 3, 154 }, - { 128, 553, "Monsters\\SkelAxe\\SklAx%c.CL2", TRUE, "Monsters\\SkelAxe\\SklAx%c%i.WAV", FALSE, TRUE, "Monsters\\SkelAxe\\Black.TRN", { 12, 8, 13, 6, 17, 16 }, { 3, 0, 0, 0, 0, 0 }, "Horror", 4, 8, 6, 12, 20, AI_SKELSD, 0 , 3, 35, 8, 4, 9, 0, 0, 0, 0, 15, MC_UNDEAD, IMUNE_MAGIC | RESIST_LIGHTNING | IMUNE_NULL_40, IMUNE_MAGIC | RESIST_LIGHTNING | IMUNE_NULL_40, 0, 3, 264 }, - { 128, 623, "Monsters\\FalSword\\Fall%c.CL2", TRUE, "Monsters\\FalSword\\Fall%c%i.WAV", TRUE, TRUE, "Monsters\\FalSword\\FallenT.TRN", { 12, 12, 13, 11, 14, 15 }, { 3, 0, 0, 0, 0, 0 }, "Fallen One", 1, 3, 1, 2, 5, AI_FALLEN, 0 , 0, 15, 8, 1, 4, 0, 5, 0, 0, 10, MC_ANIMAL, 0 , 0 , 0, 3, 52 }, - { 128, 623, "Monsters\\FalSword\\Fall%c.CL2", TRUE, "Monsters\\FalSword\\Fall%c%i.WAV", TRUE, TRUE, "Monsters\\FalSword\\Dark.TRN", { 12, 12, 13, 11, 14, 15 }, { 3, 0, 0, 0, 0, 0 }, "Carver", 2, 5, 3, 5, 9, AI_FALLEN, 0 , 1, 20, 8, 2, 7, 0, 5, 0, 0, 15, MC_ANIMAL, 0 , 0 , 0, 3, 90 }, - { 128, 623, "Monsters\\FalSword\\Fall%c.CL2", TRUE, "Monsters\\FalSword\\Fall%c%i.WAV", TRUE, FALSE, NULL, { 12, 12, 13, 11, 14, 15 }, { 3, 0, 0, 0, 0, 0 }, "Devil Kin", 3, 7, 5, 16, 24, AI_FALLEN, 0 , 2, 25, 8, 4, 10, 0, 5, 0, 0, 20, MC_ANIMAL, 0 , RESIST_FIRE , 0, 3, 180 }, - { 128, 623, "Monsters\\FalSword\\Fall%c.CL2", TRUE, "Monsters\\FalSword\\Fall%c%i.WAV", TRUE, TRUE, "Monsters\\FalSword\\Blue.TRN", { 12, 12, 13, 11, 14, 15 }, { 3, 0, 0, 0, 0, 0 }, "Dark One", 5, 9, 7, 24, 36, AI_FALLEN, 0 , 3, 30, 8, 4, 12, 0, 5, 0, 0, 25, MC_ANIMAL, IMUNE_NULL_40, RESIST_LIGHTNING | IMUNE_NULL_40, 0, 3, 280 }, - { 128, 410, "Monsters\\Scav\\Scav%c.CL2", TRUE, "Monsters\\Scav\\Scav%c%i.WAV", FALSE, FALSE, NULL, { 12, 8, 12, 6, 20, 11 }, { 2, 0, 0, 0, 0, 0 }, "Scavenger", 1, 4, 2, 3, 6, AI_SCAV, 0 , 0, 20, 7, 1, 5, 0, 0, 0, 0, 10, MC_ANIMAL, 0 , RESIST_FIRE , 0, 3, 80 }, - { 128, 410, "Monsters\\Scav\\Scav%c.CL2", TRUE, "Monsters\\Scav\\Scav%c%i.WAV", FALSE, TRUE, "Monsters\\Scav\\ScavBr.TRN", { 12, 8, 12, 6, 20, 11 }, { 2, 0, 0, 0, 0, 0 }, "Plague Eater", 3, 6, 4, 12, 24, AI_SCAV, 0 , 1, 30, 7, 1, 8, 0, 0, 0, 0, 20, MC_ANIMAL, 0 , RESIST_LIGHTNING , 0, 3, 188 }, - { 128, 410, "Monsters\\Scav\\Scav%c.CL2", TRUE, "Monsters\\Scav\\Scav%c%i.WAV", FALSE, TRUE, "Monsters\\Scav\\ScavBe.TRN", { 12, 8, 12, 6, 20, 11 }, { 2, 0, 0, 0, 0, 0 }, "Shadow Beast", 4, 8, 6, 24, 36, AI_SCAV, 0 , 2, 35, 7, 3, 12, 0, 0, 0, 0, 25, MC_ANIMAL, IMUNE_NULL_40, RESIST_FIRE | IMUNE_NULL_40, 0, 3, 375 }, - { 128, 410, "Monsters\\Scav\\Scav%c.CL2", TRUE, "Monsters\\Scav\\Scav%c%i.WAV", FALSE, TRUE, "Monsters\\Scav\\ScavW.TRN", { 12, 8, 12, 6, 20, 11 }, { 2, 0, 0, 0, 0, 0 }, "Bone Gasher", 6, 10, 8, 28, 40, AI_SCAV, 0 , 3, 35, 7, 5, 15, 0, 0, 0, 0, 30, MC_ANIMAL, RESIST_MAGIC | IMUNE_NULL_40, RESIST_LIGHTNING | IMUNE_NULL_40, 0, 3, 552 }, - { 128, 567, "Monsters\\SkelBow\\SklBw%c.CL2", TRUE, "Monsters\\SkelBow\\SklBw%c%i.WAV", FALSE, TRUE, "Monsters\\SkelBow\\White.TRN", { 9, 8, 16, 5, 16, 16 }, { 4, 0, 0, 0, 0, 0 }, "Skeleton", 2, 5, 3, 2, 4, AI_SKELBOW, 0 , 0, 15, 12, 1, 2, 0, 0, 0, 0, 0, MC_UNDEAD, IMUNE_MAGIC | IMUNE_NULL_40, IMUNE_MAGIC | IMUNE_NULL_40, 0, 3, 110 }, - { 128, 567, "Monsters\\SkelBow\\SklBw%c.CL2", TRUE, "Monsters\\SkelBow\\SklBw%c%i.WAV", FALSE, TRUE, "Monsters\\SkelBow\\Skelt.TRN", { 9, 8, 16, 5, 16, 16 }, { 4, 0, 0, 0, 0, 0 }, "Corpse Bow", 3, 7, 5, 8, 16, AI_SKELBOW, 0 , 1, 25, 12, 1, 4, 0, 0, 0, 0, 0, MC_UNDEAD, IMUNE_MAGIC | IMUNE_NULL_40, IMUNE_MAGIC | IMUNE_NULL_40, 0, 3, 210 }, - { 128, 567, "Monsters\\SkelBow\\SklBw%c.CL2", TRUE, "Monsters\\SkelBow\\SklBw%c%i.WAV", FALSE, FALSE, NULL, { 9, 8, 16, 5, 16, 16 }, { 2, 0, 0, 0, 0, 0 }, "Burning Dead", 5, 9, 7, 10, 24, AI_SKELBOW, 0 , 2, 30, 12, 1, 6, 0, 0, 0, 0, 5, MC_UNDEAD, IMUNE_MAGIC | RESIST_FIRE | IMUNE_NULL_40, IMUNE_MAGIC | IMUNE_FIRE | IMUNE_NULL_40, 0, 3, 364 }, - { 128, 567, "Monsters\\SkelBow\\SklBw%c.CL2", TRUE, "Monsters\\SkelBow\\SklBw%c%i.WAV", FALSE, TRUE, "Monsters\\SkelBow\\Black.TRN", { 9, 8, 16, 5, 16, 16 }, { 3, 0, 0, 0, 0, 0 }, "Horror", 7, 11, 9, 15, 45, AI_SKELBOW, 0 , 3, 35, 12, 2, 9, 0, 0, 0, 0, 15, MC_UNDEAD, IMUNE_MAGIC | RESIST_LIGHTNING | IMUNE_NULL_40, IMUNE_MAGIC | RESIST_LIGHTNING | IMUNE_NULL_40, 0, 3, 594 }, - { 128, 575, "Monsters\\SkelSd\\SklSr%c.CL2", TRUE, "Monsters\\SkelSd\\SklSr%c%i.WAV", TRUE, TRUE, "Monsters\\SkelSd\\White.TRN", { 13, 8, 12, 7, 15, 16 }, { 4, 0, 0, 0, 0, 0 }, "Skeleton Captain", 1, 4, 2, 3, 6, AI_SKELSD, 0 , 0, 20, 8, 2, 7, 0, 0, 0, 0, 10, MC_UNDEAD, IMUNE_MAGIC | IMUNE_NULL_40, IMUNE_MAGIC | IMUNE_NULL_40, 0, 3, 90 }, - { 128, 575, "Monsters\\SkelSd\\SklSr%c.CL2", TRUE, "Monsters\\SkelSd\\SklSr%c%i.WAV", FALSE, TRUE, "Monsters\\SkelSd\\Skelt.TRN", { 13, 8, 12, 7, 15, 16 }, { 4, 0, 0, 0, 0, 0 }, "Corpse Captain", 2, 6, 4, 12, 20, AI_SKELSD, 0 , 1, 30, 8, 3, 9, 0, 0, 0, 0, 5, MC_UNDEAD, IMUNE_MAGIC | IMUNE_NULL_40, IMUNE_MAGIC | IMUNE_NULL_40, 0, 3, 200 }, - { 128, 575, "Monsters\\SkelSd\\SklSr%c.CL2", TRUE, "Monsters\\SkelSd\\SklSr%c%i.WAV", FALSE, FALSE, NULL, { 13, 8, 12, 7, 15, 16 }, { 4, 0, 0, 0, 0, 0 }, "Burning Dead Captain", 4, 8, 6, 16, 30, AI_SKELSD, 0 , 2, 35, 8, 4, 10, 0, 0, 0, 0, 15, MC_UNDEAD, IMUNE_MAGIC | RESIST_FIRE | IMUNE_NULL_40, IMUNE_MAGIC | IMUNE_FIRE | IMUNE_NULL_40, 0, 3, 393 }, - { 128, 575, "Monsters\\SkelSd\\SklSr%c.CL2", TRUE, "Monsters\\SkelSd\\SklSr%c%i.WAV", FALSE, TRUE, "Monsters\\SkelSd\\Black.TRN", { 13, 8, 12, 7, 15, 16 }, { 4, 0, 0, 0, 0, 0 }, "Horror Captain", 6, 10, 8, 35, 50, AI_SKELSD, MFLAG_SEARCH , 3, 40, 8, 5, 14, 0, 0, 0, 0, 30, MC_UNDEAD, IMUNE_MAGIC | RESIST_LIGHTNING | IMUNE_NULL_40, IMUNE_MAGIC | RESIST_LIGHTNING | IMUNE_NULL_40, 0, 3, 604 }, - { 128, 2000, "Monsters\\TSneak\\TSneak%c.CL2", FALSE, "Monsters\\TSneak\\Sneakl%c%i.WAV", FALSE, FALSE, NULL, { 13, 13, 15, 11, 16, 0 }, { 2, 0, 0, 0, 0, 0 }, "Invisible Lord", 14, 14, 14, 278, 278, AI_SKELSD, MFLAG_SEARCH , 3, 65, 8, 16, 30, 0, 0, 0, 0, 60, MC_DEMON, RESIST_MAGIC | RESIST_FIRE | RESIST_LIGHTNING | IMUNE_NULL_40, RESIST_MAGIC | RESIST_FIRE | RESIST_LIGHTNING | IMUNE_NULL_40, 0, 3, 2000 }, - { 128, 992, "Monsters\\Sneak\\Sneak%c.CL2", TRUE, "Monsters\\Sneak\\Sneak%c%i.WAV", FALSE, FALSE, NULL, { 16, 8, 12, 8, 24, 15 }, { 2, 0, 0, 0, 0, 0 }, "Hidden", 3, 8, 5, 8, 24, AI_SNEAK, MFLAG_HIDDEN , 0, 35, 8, 3, 6, 0, 0, 0, 0, 25, MC_DEMON, 0 , IMUNE_NULL_40, 0, 3, 278 }, - { 128, 992, "Monsters\\Sneak\\Sneak%c.CL2", TRUE, "Monsters\\Sneak\\Sneak%c%i.WAV", FALSE, TRUE, "Monsters\\Sneak\\Sneakv2.TRN", { 16, 8, 12, 8, 24, 15 }, { 2, 0, 0, 0, 0, 0 }, "Stalker", 8, 12, 9, 30, 45, AI_SNEAK, MFLAG_HIDDEN | MFLAG_SEARCH , 1, 40, 8, 8, 16, 0, 0, 0, 0, 30, MC_DEMON, 0 , IMUNE_NULL_40, 0, 3, 630 }, - { 128, 992, "Monsters\\Sneak\\Sneak%c.CL2", TRUE, "Monsters\\Sneak\\Sneak%c%i.WAV", FALSE, TRUE, "Monsters\\Sneak\\Sneakv3.TRN", { 16, 8, 12, 8, 24, 15 }, { 2, 0, 0, 0, 0, 0 }, "Unseen", 10, 14, 11, 35, 50, AI_SNEAK, MFLAG_HIDDEN | MFLAG_SEARCH , 2, 45, 8, 12, 20, 0, 0, 0, 0, 30, MC_DEMON, RESIST_MAGIC | IMUNE_NULL_40, IMUNE_MAGIC | IMUNE_NULL_40, 0, 3, 935 }, - { 128, 992, "Monsters\\Sneak\\Sneak%c.CL2", TRUE, "Monsters\\Sneak\\Sneak%c%i.WAV", FALSE, TRUE, "Monsters\\Sneak\\Sneakv1.TRN", { 16, 8, 12, 8, 24, 15 }, { 2, 0, 0, 0, 0, 0 }, "Illusion Weaver", 14, 18, 13, 40, 60, AI_SNEAK, MFLAG_HIDDEN | MFLAG_SEARCH , 3, 60, 8, 16, 24, 0, 0, 0, 0, 30, MC_DEMON, RESIST_MAGIC | RESIST_FIRE , IMUNE_MAGIC | RESIST_FIRE | IMUNE_NULL_40, 0, 3, 1500 }, - { 160, 2000, "Monsters\\GoatLord\\GoatL%c.CL2", FALSE, "Monsters\\GoatLord\\Goatl%c%i.WAV", FALSE, FALSE, NULL, { 13, 13, 14, 9, 16, 0 }, { 2, 0, 0, 0, 0, 0 }, "Lord Sayter", 13, 13, 12, 351, 351, AI_SKELSD, MFLAG_SEARCH , 3, 80, 8, 14, 24, 0, 0, 0, 0, 60, MC_DEMON, RESIST_MAGIC | RESIST_FIRE | IMUNE_NULL_40, RESIST_MAGIC | RESIST_FIRE | IMUNE_NULL_40, 0, 3, 1500 }, - { 128, 1030, "Monsters\\GoatMace\\Goat%c.CL2", TRUE, "Monsters\\GoatMace\\Goat%c%i.WAV", FALSE, FALSE, NULL, { 12, 8, 12, 6, 20, 12 }, { 2, 0, 0, 0, 1, 0 }, "Flesh Clan", 6, 10, 8, 30, 45, AI_GOATMC, MFLAG_SEARCH | MFLAG_CAN_OPEN_DOOR, 0, 50, 8, 4, 10, 0, 0, 0, 0, 40, MC_DEMON, 0 , 0 , 0, 3, 460 }, - { 128, 1030, "Monsters\\GoatMace\\Goat%c.CL2", TRUE, "Monsters\\GoatMace\\Goat%c%i.WAV", FALSE, TRUE, "Monsters\\GoatMace\\Beige.TRN", { 12, 8, 12, 6, 20, 12 }, { 2, 0, 0, 0, 1, 0 }, "Stone Clan", 8, 12, 10, 40, 55, AI_GOATMC, MFLAG_SEARCH | MFLAG_CAN_OPEN_DOOR, 1, 60, 8, 6, 12, 0, 0, 0, 0, 40, MC_DEMON, RESIST_MAGIC | IMUNE_NULL_40, IMUNE_MAGIC | IMUNE_NULL_40, 0, 3, 685 }, - { 128, 1030, "Monsters\\GoatMace\\Goat%c.CL2", TRUE, "Monsters\\GoatMace\\Goat%c%i.WAV", FALSE, TRUE, "Monsters\\GoatMace\\Red.TRN", { 12, 8, 12, 6, 20, 12 }, { 2, 0, 0, 0, 1, 0 }, "Fire Clan", 10, 14, 12, 50, 65, AI_GOATMC, MFLAG_SEARCH | MFLAG_CAN_OPEN_DOOR, 2, 70, 8, 8, 16, 0, 0, 0, 0, 45, MC_DEMON, RESIST_FIRE , IMUNE_FIRE , 0, 3, 906 }, - { 128, 1030, "Monsters\\GoatMace\\Goat%c.CL2", TRUE, "Monsters\\GoatMace\\Goat%c%i.WAV", FALSE, TRUE, "Monsters\\GoatMace\\Gray.TRN", { 12, 8, 12, 6, 20, 12 }, { 2, 0, 0, 0, 1, 0 }, "Night Clan", 12, 16, 14, 55, 70, AI_GOATMC, MFLAG_SEARCH | MFLAG_CAN_OPEN_DOOR, 3, 80, 8, 10, 20, 15, 0, 30, 30, 50, MC_DEMON, RESIST_MAGIC | IMUNE_NULL_40, IMUNE_MAGIC | IMUNE_NULL_40, 0, 3, 1190 }, - { 96, 364, "Monsters\\Bat\\Bat%c.CL2", FALSE, "Monsters\\Bat\\Bat%c%i.WAV", FALSE, TRUE, "Monsters\\Bat\\red.trn", { 9, 13, 10, 9, 13, 0 }, { 0, 0, 0, 0, 0, 0 }, "Fiend", 2, 5, 3, 3, 6, AI_BAT, 0 , 0, 35, 5, 1, 6, 0, 0, 0, 0, 0, MC_ANIMAL, 0 , 0 , 0x4000, 6, 102 }, - { 96, 364, "Monsters\\Bat\\Bat%c.CL2", FALSE, "Monsters\\Bat\\Bat%c%i.WAV", FALSE, FALSE, NULL, { 9, 13, 10, 9, 13, 0 }, { 0, 0, 0, 0, 0, 0 }, "Blink", 5, 9, 7, 12, 28, AI_BAT, 0 , 1, 45, 5, 1, 8, 0, 0, 0, 0, 15, MC_ANIMAL, 0 , 0 , 0x4000, 6, 340 }, - { 96, 364, "Monsters\\Bat\\Bat%c.CL2", FALSE, "Monsters\\Bat\\Bat%c%i.WAV", FALSE, TRUE, "Monsters\\Bat\\grey.trn", { 9, 13, 10, 9, 13, 0 }, { 0, 0, 0, 0, 0, 0 }, "Gloom", 7, 11, 9, 28, 36, AI_BAT, MFLAG_SEARCH , 2, 70, 5, 4, 12, 0, 0, 0, 0, 35, MC_ANIMAL, RESIST_MAGIC , RESIST_MAGIC | IMUNE_NULL_40, 0x4000, 6, 509 }, - { 96, 364, "Monsters\\Bat\\Bat%c.CL2", FALSE, "Monsters\\Bat\\Bat%c%i.WAV", FALSE, TRUE, "Monsters\\Bat\\orange.trn", { 9, 13, 10, 9, 13, 0 }, { 0, 0, 0, 0, 0, 0 }, "Familiar", 11, 15, 13, 20, 35, AI_BAT, MFLAG_SEARCH , 3, 50, 5, 4, 16, 0, 0, 0, 0, 35, MC_DEMON, RESIST_MAGIC | IMUNE_LIGHTNING , RESIST_MAGIC | IMUNE_LIGHTNING | IMUNE_NULL_40, 0x4000, 6, 448 }, - { 128, 1040, "Monsters\\GoatBow\\GoatB%c.CL2", FALSE, "Monsters\\GoatBow\\GoatB%c%i.WAV", FALSE, FALSE, NULL, { 12, 8, 16, 6, 20, 0 }, { 3, 0, 0, 0, 0, 0 }, "Flesh Clan", 6, 10, 8, 20, 35, AI_GOATBOW, MFLAG_CAN_OPEN_DOOR, 0, 35, 13, 1, 7, 0, 0, 0, 0, 35, MC_DEMON, 0 , 0 , 0, 3, 448 }, - { 128, 1040, "Monsters\\GoatBow\\GoatB%c.CL2", FALSE, "Monsters\\GoatBow\\GoatB%c%i.WAV", FALSE, TRUE, "Monsters\\GoatBow\\Beige.TRN", { 12, 8, 16, 6, 20, 0 }, { 3, 0, 0, 0, 0, 0 }, "Stone Clan", 8, 12, 10, 30, 40, AI_GOATBOW, MFLAG_CAN_OPEN_DOOR, 1, 40, 13, 2, 9, 0, 0, 0, 0, 35, MC_DEMON, RESIST_MAGIC | IMUNE_NULL_40, IMUNE_MAGIC | IMUNE_NULL_40, 0, 3, 645 }, - { 128, 1040, "Monsters\\GoatBow\\GoatB%c.CL2", FALSE, "Monsters\\GoatBow\\GoatB%c%i.WAV", FALSE, TRUE, "Monsters\\GoatBow\\Red.TRN", { 12, 8, 16, 6, 20, 0 }, { 3, 0, 0, 0, 0, 0 }, "Fire Clan", 10, 14, 12, 40, 50, AI_GOATBOW, MFLAG_SEARCH | MFLAG_CAN_OPEN_DOOR, 2, 45, 13, 3, 11, 0, 0, 0, 0, 35, MC_DEMON, RESIST_FIRE , IMUNE_FIRE , 0, 3, 822 }, - { 128, 1040, "Monsters\\GoatBow\\GoatB%c.CL2", FALSE, "Monsters\\GoatBow\\GoatB%c%i.WAV", FALSE, TRUE, "Monsters\\GoatBow\\Gray.TRN", { 12, 8, 16, 6, 20, 0 }, { 3, 0, 0, 0, 0, 0 }, "Night Clan", 12, 16, 14, 50, 65, AI_GOATBOW, MFLAG_SEARCH | MFLAG_CAN_OPEN_DOOR, 3, 50, 13, 4, 13, 15, 0, 0, 0, 40, MC_DEMON, RESIST_MAGIC | IMUNE_NULL_40, IMUNE_MAGIC | IMUNE_NULL_40, 0, 3, 1092 }, - { 128, 716, "Monsters\\Acid\\Acid%c.CL2", TRUE, "Monsters\\Acid\\Acid%c%i.WAV", TRUE, FALSE, NULL, { 13, 8, 12, 8, 16, 12 }, { 0, 0, 0, 0, 0, 0 }, "Acid Beast", 10, 14, 11, 40, 66, AI_ACID, 0 , 0, 40, 8, 4, 12, 25, 8, 0, 0, 30, MC_ANIMAL, IMUNE_ACID , IMUNE_MAGIC | IMUNE_ACID , 0, 3, 846 }, - { 128, 716, "Monsters\\Acid\\Acid%c.CL2", TRUE, "Monsters\\Acid\\Acid%c%i.WAV", TRUE, TRUE, "Monsters\\Acid\\AcidBlk.TRN", { 13, 8, 12, 8, 16, 12 }, { 0, 0, 0, 0, 0, 0 }, "Poison Spitter", 14, 18, 15, 60, 85, AI_ACID, 0 , 1, 45, 8, 4, 16, 25, 8, 0, 0, 30, MC_ANIMAL, IMUNE_ACID , IMUNE_MAGIC | IMUNE_ACID , 0, 3, 1248 }, - { 128, 716, "Monsters\\Acid\\Acid%c.CL2", TRUE, "Monsters\\Acid\\Acid%c%i.WAV", TRUE, TRUE, "Monsters\\Acid\\AcidB.TRN", { 13, 8, 12, 8, 16, 12 }, { 0, 0, 0, 0, 0, 0 }, "Pit Beast", 18, 22, 21, 80, 110, AI_ACID, 0 , 2, 55, 8, 8, 18, 35, 8, 0, 0, 35, MC_ANIMAL, RESIST_MAGIC | IMUNE_ACID , IMUNE_MAGIC | RESIST_LIGHTNING | IMUNE_ACID , 0, 3, 2060 }, - { 128, 716, "Monsters\\Acid\\Acid%c.CL2", TRUE, "Monsters\\Acid\\Acid%c%i.WAV", TRUE, TRUE, "Monsters\\Acid\\AcidR.TRN", { 13, 8, 12, 8, 16, 12 }, { 0, 0, 0, 0, 0, 0 }, "Lava Maw", 22, 27, 25, 100, 150, AI_ACID, 0 , 3, 65, 8, 10, 20, 40, 8, 0, 0, 35, MC_ANIMAL, RESIST_MAGIC | IMUNE_FIRE | IMUNE_ACID , IMUNE_MAGIC | IMUNE_FIRE | IMUNE_ACID , 0, 3, 2940 }, - { 160, 1010, "Monsters\\SKing\\SKing%c.CL2", TRUE, "Monsters\\SKing\\SKing%c%i.WAV", TRUE, TRUE, "Monsters\\SkelAxe\\White.TRN", { 8, 6, 16, 6, 16, 6 }, { 2, 0, 0, 0, 0, 2 }, "Skeleton King", 6, 6, 9, 140, 140, AI_SKELKING, MFLAG_SEARCH | MFLAG_CAN_OPEN_DOOR, 3, 60, 8, 6, 16, 0, 0, 0, 0, 70, MC_UNDEAD, IMUNE_MAGIC | RESIST_FIRE | RESIST_LIGHTNING | IMUNE_NULL_40, IMUNE_MAGIC | IMUNE_FIRE | IMUNE_LIGHTNING | IMUNE_NULL_40, 0x8001, 7, 570 }, - { 128, 980, "Monsters\\FatC\\FatC%c.CL2", FALSE, "Monsters\\FatC\\FatC%c%i.WAV", FALSE, FALSE, NULL, { 10, 8, 12, 6, 16, 0 }, { 1, 0, 0, 0, 0, 0 }, "The Butcher", 0, 0, 1, 320, 320, AI_CLEAVER, 0 , 3, 50, 8, 6, 12, 0, 0, 0, 0, 50, MC_DEMON, RESIST_FIRE | RESIST_LIGHTNING , RESIST_MAGIC | IMUNE_FIRE | IMUNE_LIGHTNING , 0x8000, 3, 710 }, - { 128, 1130, "Monsters\\Fat\\Fat%c.CL2", TRUE, "Monsters\\Fat\\Fat%c%i.WAV", FALSE, FALSE, NULL, { 8, 10, 15, 6, 16, 10 }, { 4, 0, 0, 0, 0, 0 }, "Overlord", 8, 12, 10, 60, 80, AI_FAT, 0 , 0, 55, 8, 6, 12, 0, 0, 0, 0, 55, MC_DEMON, 0 , RESIST_FIRE , 0, 3, 635 }, - { 128, 1130, "Monsters\\Fat\\Fat%c.CL2", TRUE, "Monsters\\Fat\\Fat%c%i.WAV", FALSE, TRUE, "Monsters\\Fat\\Blue.TRN", { 8, 10, 15, 6, 16, 10 }, { 4, 0, 0, 0, 0, 0 }, "Mud Man", 13, 17, 14, 100, 125, AI_FAT, MFLAG_SEARCH , 1, 60, 8, 8, 16, 0, 0, 0, 0, 60, MC_DEMON, 0 , IMUNE_LIGHTNING , 0, 3, 1165 }, - { 128, 1130, "Monsters\\Fat\\Fat%c.CL2", TRUE, "Monsters\\Fat\\Fat%c%i.WAV", FALSE, TRUE, "Monsters\\Fat\\FatB.TRN", { 8, 10, 15, 6, 16, 10 }, { 4, 0, 0, 0, 0, 0 }, "Toad Demon", 15, 19, 16, 135, 160, AI_FAT, MFLAG_SEARCH , 2, 70, 8, 8, 16, 40, 0, 8, 20, 65, MC_DEMON, IMUNE_MAGIC , IMUNE_MAGIC | RESIST_LIGHTNING , 0, 3, 1380 }, - { 128, 1130, "Monsters\\Fat\\Fat%c.CL2", TRUE, "Monsters\\Fat\\Fat%c%i.WAV", FALSE, TRUE, "Monsters\\Fat\\FatF.TRN", { 8, 10, 15, 6, 16, 10 }, { 4, 0, 0, 0, 0, 0 }, "Flayed One", 19, 23, 20, 160, 200, AI_FAT, MFLAG_SEARCH , 3, 85, 8, 10, 20, 0, 0, 0, 0, 70, MC_DEMON, RESIST_MAGIC | IMUNE_FIRE , IMUNE_MAGIC | IMUNE_FIRE , 0, 3, 2058 }, - { 160, 2420, "Monsters\\Worm\\Worm%c.CL2", FALSE, "Monsters\\Fat\\Fat%c%i.WAV", FALSE, FALSE, NULL, { 13, 13, 13, 11, 19, 0 }, { 0, 0, 0, 0, 0, 0 }, "Wyrm", 9, 13, 11, 60, 90, AI_SKELSD, 0 , 0, 40, 8, 4, 10, 0, 0, 0, 0, 25, MC_ANIMAL, RESIST_MAGIC , RESIST_MAGIC , 0, 3, 660 }, - { 160, 2420, "Monsters\\Worm\\Worm%c.CL2", FALSE, "Monsters\\Fat\\Fat%c%i.WAV", FALSE, FALSE, NULL, { 13, 13, 13, 11, 19, 0 }, { 0, 0, 0, 0, 0, 0 }, "Cave Slug", 11, 15, 13, 75, 110, AI_SKELSD, 0 , 1, 50, 8, 6, 13, 0, 0, 0, 0, 30, MC_ANIMAL, RESIST_MAGIC , RESIST_MAGIC , 0, 3, 994 }, - { 160, 2420, "Monsters\\Worm\\Worm%c.CL2", FALSE, "Monsters\\Fat\\Fat%c%i.WAV", FALSE, FALSE, NULL, { 13, 13, 13, 11, 19, 0 }, { 0, 0, 0, 0, 0, 0 }, "Devil Wyrm", 13, 17, 15, 100, 140, AI_SKELSD, 0 , 2, 55, 8, 8, 16, 0, 0, 0, 0, 30, MC_ANIMAL, RESIST_MAGIC | RESIST_FIRE , RESIST_MAGIC | RESIST_FIRE , 0, 3, 1320 }, - { 160, 2420, "Monsters\\Worm\\Worm%c.CL2", FALSE, "Monsters\\Fat\\Fat%c%i.WAV", FALSE, FALSE, NULL, { 13, 13, 13, 11, 19, 0 }, { 0, 0, 0, 0, 0, 0 }, "Devourer", 15, 19, 17, 125, 200, AI_SKELSD, 0 , 3, 60, 8, 10, 20, 0, 0, 0, 0, 35, MC_ANIMAL, RESIST_MAGIC | RESIST_FIRE | IMUNE_NULL_40, RESIST_MAGIC | RESIST_FIRE | IMUNE_NULL_40, 0, 3, 1827 }, - { 128, 1680, "Monsters\\Magma\\Magma%c.CL2", TRUE, "Monsters\\Magma\\Magma%c%i.WAV", TRUE, FALSE, NULL, { 8, 10, 14, 7, 18, 18 }, { 2, 0, 0, 0, 1, 0 }, "Magma Demon", 14, 17, 13, 50, 70, AI_MAGMA, MFLAG_SEARCH | MFLAG_CAN_OPEN_DOOR, 0, 45, 4, 2, 10, 50, 13, 0, 0, 45, MC_DEMON, IMUNE_MAGIC | RESIST_FIRE , IMUNE_MAGIC | IMUNE_FIRE , 0, 7, 1076 }, - { 128, 1680, "Monsters\\Magma\\Magma%c.CL2", TRUE, "Monsters\\Magma\\Magma%c%i.WAV", TRUE, TRUE, "Monsters\\Magma\\Yellow.TRN", { 8, 10, 14, 7, 18, 18 }, { 2, 0, 0, 0, 1, 0 }, "Blood Stone", 15, 19, 14, 55, 75, AI_MAGMA, MFLAG_SEARCH | MFLAG_CAN_OPEN_DOOR, 1, 50, 4, 2, 12, 50, 14, 0, 0, 45, MC_DEMON, IMUNE_MAGIC | IMUNE_FIRE , IMUNE_MAGIC | IMUNE_FIRE , 0, 7, 1309 }, - { 128, 1680, "Monsters\\Magma\\Magma%c.CL2", TRUE, "Monsters\\Magma\\Magma%c%i.WAV", TRUE, TRUE, "Monsters\\Magma\\Blue.TRN", { 8, 10, 14, 7, 18, 18 }, { 2, 0, 0, 0, 1, 0 }, "Hell Stone", 16, 20, 16, 60, 80, AI_MAGMA, MFLAG_SEARCH | MFLAG_CAN_OPEN_DOOR, 2, 60, 4, 2, 20, 60, 14, 0, 0, 50, MC_DEMON, IMUNE_MAGIC | IMUNE_FIRE , IMUNE_MAGIC | IMUNE_FIRE , 0, 7, 1680 }, - { 128, 1680, "Monsters\\Magma\\Magma%c.CL2", TRUE, "Monsters\\Magma\\Magma%c%i.WAV", TRUE, TRUE, "Monsters\\Magma\\Wierd.TRN", { 8, 10, 14, 7, 18, 18 }, { 2, 0, 0, 0, 1, 0 }, "Lava Lord", 17, 21, 18, 70, 85, AI_MAGMA, MFLAG_SEARCH | MFLAG_CAN_OPEN_DOOR, 3, 75, 4, 4, 24, 60, 14, 0, 0, 60, MC_DEMON, IMUNE_MAGIC | IMUNE_FIRE , IMUNE_MAGIC | IMUNE_FIRE , 0, 7, 2124 }, - { 160, 1630, "Monsters\\Rhino\\Rhino%c.CL2", TRUE, "Monsters\\Rhino\\Rhino%c%i.WAV", TRUE, FALSE, NULL, { 8, 8, 14, 6, 16, 6 }, { 2, 0, 0, 0, 0, 0 }, "Horned Demon", 12, 16, 13, 40, 80, AI_RHINO, MFLAG_SEARCH | MFLAG_CAN_OPEN_DOOR, 0, 60, 7, 2, 16, 100, 0, 5, 32, 40, MC_ANIMAL, 0 , RESIST_FIRE , 0, 7, 1172 }, - { 160, 1630, "Monsters\\Rhino\\Rhino%c.CL2", TRUE, "Monsters\\Rhino\\Rhino%c%i.WAV", TRUE, TRUE, "Monsters\\Rhino\\Orange.TRN", { 8, 8, 14, 6, 16, 6 }, { 2, 0, 0, 0, 0, 0 }, "Mud Runner", 14, 18, 15, 50, 90, AI_RHINO, MFLAG_SEARCH | MFLAG_CAN_OPEN_DOOR, 1, 70, 7, 6, 18, 100, 0, 12, 36, 45, MC_ANIMAL, 0 , RESIST_FIRE , 0, 7, 1404 }, - { 160, 1630, "Monsters\\Rhino\\Rhino%c.CL2", TRUE, "Monsters\\Rhino\\Rhino%c%i.WAV", TRUE, TRUE, "Monsters\\Rhino\\Blue.TRN", { 8, 8, 14, 6, 16, 6 }, { 2, 0, 0, 0, 0, 0 }, "Frost Charger", 16, 20, 17, 60, 100, AI_RHINO, MFLAG_SEARCH | MFLAG_CAN_OPEN_DOOR, 2, 80, 7, 8, 20, 100, 0, 20, 40, 50, MC_ANIMAL, IMUNE_MAGIC | RESIST_LIGHTNING , IMUNE_MAGIC | RESIST_LIGHTNING , 0, 7, 1720 }, - { 160, 1630, "Monsters\\Rhino\\Rhino%c.CL2", TRUE, "Monsters\\Rhino\\Rhino%c%i.WAV", TRUE, TRUE, "Monsters\\Rhino\\RhinoB.TRN", { 8, 8, 14, 6, 16, 6 }, { 2, 0, 0, 0, 0, 0 }, "Obsidian Lord", 18, 22, 19, 70, 110, AI_RHINO, MFLAG_SEARCH | MFLAG_CAN_OPEN_DOOR, 3, 90, 7, 10, 22, 100, 0, 20, 50, 55, MC_ANIMAL, IMUNE_MAGIC | RESIST_LIGHTNING , IMUNE_MAGIC | IMUNE_FIRE | IMUNE_LIGHTNING , 0, 7, 1809 }, - { 128, 1740, "Monsters\\Demskel\\Demskl%c.CL2", TRUE, "Monsters\\Thin\\Thin%c%i.WAV", TRUE, FALSE, "Monsters\\Thin\\Thinv3.TRN", { 10, 8, 20, 6, 24, 16 }, { 3, 0, 0, 0, 0, 0 }, "Bone Demon", 10, 14, 12, 70, 70, AI_STORM, 0 , 0, 60, 8, 6, 14, 12, 0, 0, 0, 50, MC_DEMON, IMUNE_MAGIC | IMUNE_NULL_40, IMUNE_MAGIC | IMUNE_NULL_40, 0, 7, 1344 }, - { 160, 1740, "Monsters\\Thin\\Thin%c.CL2", TRUE, "Monsters\\Thin\\Thin%c%i.WAV", TRUE, TRUE, "Monsters\\Thin\\Thinv3.TRN", { 8, 8, 18, 4, 17, 14 }, { 3, 0, 0, 0, 0, 0 }, "Red Death", 14, 18, 16, 96, 96, AI_STORM, 0 , 1, 75, 5, 10, 20, 0, 0, 0, 0, 60, MC_DEMON, IMUNE_MAGIC | IMUNE_FIRE , IMUNE_MAGIC | IMUNE_FIRE , 0, 7, 2168 }, - { 160, 1740, "Monsters\\Thin\\Thin%c.CL2", TRUE, "Monsters\\Thin\\Thin%c%i.WAV", TRUE, TRUE, "Monsters\\Thin\\Thinv3.TRN", { 8, 8, 18, 4, 17, 14 }, { 3, 0, 0, 0, 0, 0 }, "Litch Demon", 16, 20, 18, 110, 110, AI_STORM, 0 , 2, 80, 5, 10, 24, 0, 0, 0, 0, 45, MC_DEMON, IMUNE_MAGIC | IMUNE_LIGHTNING | IMUNE_NULL_40, IMUNE_MAGIC | IMUNE_LIGHTNING | IMUNE_NULL_40, 0, 7, 2736 }, - { 160, 1740, "Monsters\\Thin\\Thin%c.CL2", TRUE, "Monsters\\Thin\\Thin%c%i.WAV", TRUE, TRUE, "Monsters\\Thin\\Thinv3.TRN", { 8, 8, 18, 4, 17, 14 }, { 3, 0, 0, 0, 0, 0 }, "Undead Balrog", 20, 24, 22, 130, 130, AI_STORM, 0 , 3, 85, 5, 12, 30, 0, 0, 0, 0, 65, MC_DEMON, IMUNE_MAGIC | RESIST_FIRE | RESIST_LIGHTNING | IMUNE_NULL_40, IMUNE_MAGIC | RESIST_FIRE | RESIST_LIGHTNING | IMUNE_NULL_40, 0, 7, 3575 }, - { 128, 1460, "Monsters\\Fireman\\FireM%c.CL2", TRUE, "Monsters\\Acid\\Acid%c%i.WAV", FALSE, FALSE, NULL, { 14, 19, 20, 8, 14, 23 }, { 0, 0, 0, 0, 0, 0 }, "Incinerator", 14, 18, 16, 30, 45, AI_FIREMAN, 0 , 0, 75, 8, 8, 16, 0, 0, 0, 0, 25, MC_DEMON, IMUNE_MAGIC | IMUNE_FIRE , IMUNE_MAGIC | IMUNE_FIRE , 0, 3, 1888 }, - { 128, 1460, "Monsters\\Fireman\\FireM%c.CL2", TRUE, "Monsters\\Acid\\Acid%c%i.WAV", FALSE, FALSE, NULL, { 14, 19, 20, 8, 14, 23 }, { 0, 0, 0, 0, 0, 0 }, "Flame Lord", 16, 20, 18, 40, 55, AI_FIREMAN, 0 , 1, 75, 8, 10, 20, 0, 0, 0, 0, 25, MC_DEMON, IMUNE_MAGIC | IMUNE_FIRE , IMUNE_MAGIC | IMUNE_FIRE , 0, 3, 2250 }, - { 128, 1460, "Monsters\\Fireman\\FireM%c.CL2", TRUE, "Monsters\\Acid\\Acid%c%i.WAV", FALSE, FALSE, NULL, { 14, 19, 20, 8, 14, 23 }, { 0, 0, 0, 0, 0, 0 }, "Doom Fire", 18, 22, 20, 50, 65, AI_FIREMAN, 0 , 2, 80, 8, 12, 24, 0, 0, 0, 0, 30, MC_DEMON, IMUNE_MAGIC | IMUNE_FIRE | RESIST_LIGHTNING , IMUNE_MAGIC | IMUNE_FIRE | RESIST_LIGHTNING , 0, 3, 2740 }, - { 128, 1460, "Monsters\\Fireman\\FireM%c.CL2", TRUE, "Monsters\\Acid\\Acid%c%i.WAV", FALSE, FALSE, NULL, { 14, 19, 20, 8, 14, 23 }, { 0, 0, 0, 0, 0, 0 }, "Hell Burner", 20, 24, 22, 60, 80, AI_FIREMAN, 0 , 3, 85, 8, 15, 30, 0, 0, 0, 0, 30, MC_DEMON, IMUNE_MAGIC | IMUNE_FIRE | RESIST_LIGHTNING , IMUNE_MAGIC | IMUNE_FIRE | RESIST_LIGHTNING , 0, 3, 3355 }, - { 160, 1740, "Monsters\\Thin\\Thin%c.CL2", TRUE, "Monsters\\Thin\\Thin%c%i.WAV", TRUE, TRUE, "Monsters\\Thin\\Thinv3.TRN", { 8, 8, 18, 4, 17, 14 }, { 3, 0, 0, 0, 0, 0 }, "Red Storm", 17, 21, 18, 55, 110, AI_STORM, MFLAG_SEARCH | MFLAG_CAN_OPEN_DOOR, 0, 80, 5, 8, 18, 75, 8, 4, 16, 30, MC_DEMON, IMUNE_MAGIC | RESIST_LIGHTNING , IMUNE_MAGIC | IMUNE_LIGHTNING , 0, 7, 2160 }, - { 160, 1740, "Monsters\\Thin\\Thin%c.CL2", TRUE, "Monsters\\Thin\\Thin%c%i.WAV", TRUE, FALSE, NULL, { 8, 8, 18, 4, 17, 14 }, { 3, 0, 0, 0, 0, 0 }, "Storm Rider", 19, 23, 20, 60, 120, AI_STORM, MFLAG_SEARCH | MFLAG_CAN_OPEN_DOOR, 1, 80, 5, 8, 18, 80, 8, 4, 16, 30, MC_DEMON, RESIST_MAGIC | IMUNE_LIGHTNING , IMUNE_MAGIC | IMUNE_LIGHTNING , 0, 7, 2391 }, - { 160, 1740, "Monsters\\Thin\\Thin%c.CL2", TRUE, "Monsters\\Thin\\Thin%c%i.WAV", TRUE, TRUE, "Monsters\\Thin\\Thinv2.TRN", { 8, 8, 18, 4, 17, 14 }, { 3, 0, 0, 0, 0, 0 }, "Storm Lord", 21, 25, 22, 75, 135, AI_STORM, MFLAG_SEARCH | MFLAG_CAN_OPEN_DOOR, 2, 85, 5, 12, 24, 75, 8, 4, 16, 35, MC_DEMON, RESIST_MAGIC | IMUNE_LIGHTNING , IMUNE_MAGIC | IMUNE_LIGHTNING , 0, 7, 2775 }, - { 160, 1740, "Monsters\\Thin\\Thin%c.CL2", TRUE, "Monsters\\Thin\\Thin%c%i.WAV", TRUE , TRUE, "Monsters\\Thin\\Thinv1.TRN", { 8, 8, 18, 4, 17, 14 }, { 3, 0, 0, 0, 0, 0 }, "Maelstorm", 23, 27, 24, 90, 150, AI_STORM, MFLAG_SEARCH | MFLAG_CAN_OPEN_DOOR, 3, 90, 5, 12, 28, 75, 8, 4, 16, 40, MC_DEMON, RESIST_MAGIC | IMUNE_LIGHTNING | IMUNE_NULL_40, IMUNE_MAGIC | IMUNE_LIGHTNING | IMUNE_NULL_40, 0, 7, 3177 }, - { 128, 1650, "Monsters\\BigFall\\Fallg%c.CL2", TRUE, "Monsters\\BigFall\\Bfal%c%i.WAV", FALSE, FALSE, NULL, { 10, 8, 11, 8, 17, 0 }, { 0, 0, 0, 0, 2, 2 }, "Devil Kin Brute", 20, 20, 24, 160, 220, AI_SKELSD, MFLAG_SEARCH | MFLAG_CAN_OPEN_DOOR, 3, 100, 6, 18, 24, 0, 0, 0, 0, 75, MC_ANIMAL, 0 , 0 , 0, 6, 2000 }, - { 160, 1650, "Monsters\\Gargoyle\\Gargo%c.CL2", TRUE, "Monsters\\Gargoyle\\Gargo%c%i.WAV", FALSE, FALSE, NULL, { 14, 14, 14, 10, 18, 14 }, { 0, 0, 0, 0, 0, 2 }, "Winged-Demon", 8, 12, 9, 45, 60, AI_GARG, MFLAG_CAN_OPEN_DOOR, 0, 50, 7, 10, 16, 0, 0, 0, 0, 45, MC_DEMON, IMUNE_MAGIC | RESIST_FIRE | IMUNE_NULL_40, IMUNE_MAGIC | IMUNE_FIRE | IMUNE_NULL_40, 0, 6, 662 }, - { 160, 1650, "Monsters\\Gargoyle\\Gargo%c.CL2", TRUE, "Monsters\\Gargoyle\\Gargo%c%i.WAV", FALSE, TRUE, "Monsters\\Gargoyle\\GarE.TRN", { 14, 14, 14, 10, 18, 14 }, { 0, 0, 0, 0, 0, 2 }, "Gargoyle", 12, 16, 13, 60, 90, AI_GARG, MFLAG_CAN_OPEN_DOOR, 1, 65, 7, 10, 16, 0, 0, 0, 0, 45, MC_DEMON, IMUNE_MAGIC | RESIST_LIGHTNING | IMUNE_NULL_40, IMUNE_MAGIC | IMUNE_LIGHTNING | IMUNE_NULL_40, 0, 6, 1205 }, - { 160, 1650, "Monsters\\Gargoyle\\Gargo%c.CL2", TRUE, "Monsters\\Gargoyle\\Gargo%c%i.WAV", FALSE, TRUE, "Monsters\\Gargoyle\\GargBr.TRN", { 14, 14, 14, 10, 18, 14 }, { 0, 0, 0, 0, 0, 0 }, "Blood Claw", 16, 20, 19, 75, 125, AI_GARG, MFLAG_CAN_OPEN_DOOR, 2, 80, 7, 14, 22, 0, 0, 0, 0, 50, MC_DEMON, IMUNE_MAGIC | IMUNE_FIRE | IMUNE_NULL_40, IMUNE_MAGIC | IMUNE_FIRE | RESIST_LIGHTNING | IMUNE_NULL_40, 0, 6, 1873 }, - { 160, 1650, "Monsters\\Gargoyle\\Gargo%c.CL2", TRUE, "Monsters\\Gargoyle\\Gargo%c%i.WAV", FALSE, TRUE, "Monsters\\Gargoyle\\GargB.TRN", { 14, 14, 14, 10, 18, 14 }, { 0, 0, 0, 0, 0, 0 }, "Death Wing", 18, 22, 23, 90, 150, AI_GARG, MFLAG_CAN_OPEN_DOOR, 3, 95, 7, 16, 28, 0, 0, 0, 0, 60, MC_DEMON, IMUNE_MAGIC | IMUNE_LIGHTNING | IMUNE_NULL_40, IMUNE_MAGIC | RESIST_FIRE | IMUNE_LIGHTNING | IMUNE_NULL_40, 0, 6, 2278 }, - { 160, 2220, "Monsters\\Mega\\Mega%c.CL2", TRUE, "Monsters\\Mega\\Mega%c%i.WAV", TRUE, FALSE, NULL, { 6, 7, 14, 1, 24, 5 }, { 3, 0, 0, 0, 2, 0 }, "Slayer", 19, 23, 20, 120, 140, AI_MEGA, MFLAG_SEARCH | MFLAG_CAN_OPEN_DOOR, 0, 100, 8, 12, 20, 0, 3, 0, 0, 60, MC_DEMON, RESIST_MAGIC | IMUNE_FIRE , RESIST_MAGIC | IMUNE_FIRE , 0, 7, 2300 }, - { 160, 2220, "Monsters\\Mega\\Mega%c.CL2", TRUE, "Monsters\\Mega\\Mega%c%i.WAV", TRUE, TRUE, "Monsters\\Mega\\Guard.TRN", { 6, 7, 14, 1, 24, 5 }, { 3, 0, 0, 0, 2, 0 }, "Guardian", 21, 25, 22, 140, 160, AI_MEGA, MFLAG_SEARCH | MFLAG_CAN_OPEN_DOOR, 1, 110, 8, 14, 22, 0, 3, 0, 0, 65, MC_DEMON, RESIST_MAGIC | IMUNE_FIRE , RESIST_MAGIC | IMUNE_FIRE , 0, 7, 2714 }, - { 160, 2220, "Monsters\\Mega\\Mega%c.CL2", TRUE, "Monsters\\Mega\\Mega%c%i.WAV", TRUE, TRUE, "Monsters\\Mega\\Vtexl.TRN", { 6, 7, 14, 1, 24, 5 }, { 3, 0, 0, 0, 2, 0 }, "Vortex Lord", 23, 26, 24, 160, 180, AI_MEGA, MFLAG_SEARCH | MFLAG_CAN_OPEN_DOOR, 2, 120, 8, 18, 24, 0, 3, 0, 0, 70, MC_DEMON, RESIST_MAGIC | IMUNE_FIRE | IMUNE_NULL_40, RESIST_MAGIC | IMUNE_FIRE | RESIST_LIGHTNING | IMUNE_NULL_40, 0, 7, 3252 }, - { 160, 2220, "Monsters\\Mega\\Mega%c.CL2", TRUE, "Monsters\\Mega\\Mega%c%i.WAV", TRUE, TRUE, "Monsters\\Mega\\Balr.TRN", { 6, 7, 14, 1, 24, 5 }, { 3, 0, 0, 0, 2, 0 }, "Balrog", 25, 29, 26, 180, 200, AI_MEGA, MFLAG_SEARCH | MFLAG_CAN_OPEN_DOOR, 3, 130, 8, 22, 30, 0, 3, 0, 0, 75, MC_DEMON, RESIST_MAGIC | IMUNE_FIRE | IMUNE_NULL_40, RESIST_MAGIC | IMUNE_FIRE | RESIST_LIGHTNING | IMUNE_NULL_40, 0, 7, 3643 }, - { 160, 1270, "Monsters\\Snake\\Snake%c.CL2", FALSE, "Monsters\\Snake\\Snake%c%i.WAV", FALSE, FALSE, NULL, { 12, 11, 13, 5, 18, 0 }, { 2, 0, 0, 0, 1, 0 }, "Cave Viper", 20, 24, 21, 100, 150, AI_SNAKE, MFLAG_SEARCH , 0, 90, 8, 8, 20, 0, 0, 0, 0, 60, MC_DEMON, IMUNE_MAGIC , IMUNE_MAGIC , 0, 7, 2725 }, - { 160, 1270, "Monsters\\Snake\\Snake%c.CL2", FALSE, "Monsters\\Snake\\Snake%c%i.WAV", FALSE, TRUE, "Monsters\\Snake\\SnakR.TRN", { 12, 11, 13, 5, 18, 0 }, { 2, 0, 0, 0, 1, 0 }, "Fire Drake", 22, 26, 23, 120, 170, AI_SNAKE, MFLAG_SEARCH , 1, 105, 8, 12, 24, 0, 0, 0, 0, 65, MC_DEMON, IMUNE_MAGIC | RESIST_FIRE , IMUNE_MAGIC | IMUNE_FIRE , 0, 7, 3139 }, - { 160, 1270, "Monsters\\Snake\\Snake%c.CL2", FALSE, "Monsters\\Snake\\Snake%c%i.WAV", FALSE, TRUE, "Monsters\\Snake\\Snakg.TRN", { 12, 11, 13, 5, 18, 0 }, { 2, 0, 0, 0, 1, 0 }, "Gold Viper", 24, 27, 25, 140, 180, AI_SNAKE, MFLAG_SEARCH , 2, 120, 8, 15, 26, 0, 0, 0, 0, 70, MC_DEMON, IMUNE_MAGIC | RESIST_LIGHTNING , IMUNE_MAGIC | RESIST_LIGHTNING , 0, 7, 3540 }, - { 160, 1270, "Monsters\\Snake\\Snake%c.CL2", FALSE, "Monsters\\Snake\\Snake%c%i.WAV", FALSE, TRUE, "Monsters\\Snake\\Snakb.TRN", { 12, 11, 13, 5, 18, 0 }, { 2, 0, 0, 0, 1, 0 }, "Azure Drake", 28, 30, 27, 160, 200, AI_SNAKE, MFLAG_SEARCH , 3, 130, 8, 18, 30, 0, 0, 0, 0, 75, MC_DEMON, RESIST_FIRE | RESIST_LIGHTNING , IMUNE_MAGIC | RESIST_FIRE | IMUNE_LIGHTNING , 0, 7, 3791 }, - { 160, 2120, "Monsters\\Black\\Black%c.CL2", FALSE, "Monsters\\Black\\Black%c%i.WAV", FALSE, FALSE, NULL, { 8, 8, 16, 4, 24, 0 }, { 2, 0, 0, 0, 0, 0 }, "Black Knight", 23, 27, 24, 150, 150, AI_SKELSD, MFLAG_SEARCH , 0, 110, 8, 15, 20, 0, 0, 0, 0, 75, MC_DEMON, RESIST_MAGIC | RESIST_LIGHTNING | IMUNE_NULL_40, RESIST_MAGIC | IMUNE_LIGHTNING | IMUNE_NULL_40, 0, 7, 3360 }, - { 160, 2120, "Monsters\\Black\\Black%c.CL2", FALSE, "Monsters\\Black\\Black%c%i.WAV", FALSE, TRUE, "Monsters\\Black\\BlkKntRT.TRN", { 8, 8, 16, 4, 24, 0 }, { 2, 0, 0, 0, 0, 0 }, "Doom Guard", 25, 29, 26, 165, 165, AI_SKELSD, MFLAG_SEARCH , 0, 130, 8, 18, 25, 0, 0, 0, 0, 75, MC_DEMON, RESIST_MAGIC | RESIST_FIRE | IMUNE_NULL_40, RESIST_MAGIC | IMUNE_FIRE | IMUNE_NULL_40, 0, 7, 3650 }, - { 160, 2120, "Monsters\\Black\\Black%c.CL2", FALSE, "Monsters\\Black\\Black%c%i.WAV", FALSE, TRUE, "Monsters\\Black\\BlkKntBT.TRN", { 8, 8, 16, 4, 24, 0 }, { 2, 0, 0, 0, 0, 0 }, "Steel Lord", 27, 30, 28, 180, 180, AI_SKELSD, MFLAG_SEARCH , 1, 120, 8, 20, 30, 0, 0, 0, 0, 80, MC_DEMON, RESIST_MAGIC | IMUNE_FIRE | RESIST_LIGHTNING | IMUNE_NULL_40, IMUNE_MAGIC | IMUNE_FIRE | RESIST_LIGHTNING | IMUNE_NULL_40, 0, 7, 4252 }, - { 160, 2120, "Monsters\\Black\\Black%c.CL2", FALSE, "Monsters\\Black\\Black%c%i.WAV", FALSE, TRUE, "Monsters\\Black\\BlkKntBe.TRN", { 8, 8, 16, 4, 24, 0 }, { 2, 0, 0, 0, 0, 0 }, "Blood Knight", 24, 26, 30, 200, 200, AI_SKELSD, MFLAG_SEARCH , 1, 130, 8, 25, 35, 0, 0, 0, 0, 85, MC_DEMON, IMUNE_MAGIC | RESIST_FIRE | IMUNE_LIGHTNING | IMUNE_NULL_40, IMUNE_MAGIC | RESIST_FIRE | IMUNE_LIGHTNING | IMUNE_NULL_40, 0, 7, 5130 }, - { 96, 484, "Monsters\\Unrav\\Unrav%c.CL2", FALSE, "Monsters\\Acid\\Acid%c%i.WAV", FALSE, FALSE, NULL, { 10, 10, 12, 5, 16, 0 }, { 0, 0, 0, 0, 0, 0 }, "Unraveler", 26, 28, 25, 70, 150, AI_SKELSD, 0 , 0, 75, 7, 10, 20, 0, 0, 0, 0, 70, MC_UNDEAD, IMUNE_MAGIC | RESIST_FIRE | IMUNE_LIGHTNING | IMUNE_NULL_40, IMUNE_MAGIC | RESIST_FIRE | IMUNE_LIGHTNING | IMUNE_NULL_40, 0, 3, 3812 }, - { 96, 484, "Monsters\\Unrav\\Unrav%c.CL2", FALSE, "Monsters\\Acid\\Acid%c%i.WAV", FALSE, FALSE, NULL, { 10, 10, 12, 5, 16, 0 }, { 0, 0, 0, 0, 0, 0 }, "Hollow One", 28, 30, 27, 135, 240, AI_SKELSD, 0 , 1, 75, 7, 12, 24, 0, 0, 0, 0, 75, MC_UNDEAD, IMUNE_MAGIC | IMUNE_FIRE | RESIST_LIGHTNING | IMUNE_NULL_40, IMUNE_MAGIC | IMUNE_FIRE | RESIST_LIGHTNING | IMUNE_NULL_40, 0, 3, 4374 }, - { 96, 484, "Monsters\\Unrav\\Unrav%c.CL2", FALSE, "Monsters\\Acid\\Acid%c%i.WAV", FALSE, FALSE, NULL, { 10, 10, 12, 5, 16, 0 }, { 0, 0, 0, 0, 0, 0 }, "Pain Master", 27, 30, 29, 110, 200, AI_SKELSD, 0 , 2, 80, 7, 16, 30, 0, 0, 0, 0, 80, MC_UNDEAD, IMUNE_MAGIC | IMUNE_FIRE | RESIST_LIGHTNING | IMUNE_NULL_40, IMUNE_MAGIC | IMUNE_FIRE | RESIST_LIGHTNING | IMUNE_NULL_40, 0, 3, 5147 }, - { 96, 484, "Monsters\\Unrav\\Unrav%c.CL2", FALSE, "Monsters\\Acid\\Acid%c%i.WAV", FALSE, FALSE, NULL, { 10, 10, 12, 5, 16, 0 }, { 0, 0, 0, 0, 0, 0 }, "Reality Weaver", 28, 30, 30, 135, 240, AI_SKELSD, 0 , 3, 85, 7, 20, 35, 0, 0, 0, 0, 85, MC_UNDEAD, RESIST_MAGIC | IMUNE_FIRE | IMUNE_LIGHTNING | IMUNE_NULL_40, RESIST_MAGIC | IMUNE_FIRE | IMUNE_LIGHTNING | IMUNE_NULL_40, 0, 3, 5925 }, - { 128, 980, "Monsters\\Succ\\Scbs%c.CL2", FALSE, "Monsters\\Succ\\Scbs%c%i.WAV", FALSE, FALSE, NULL, { 14, 8, 16, 7, 24, 0 }, { 0, 0, 0, 0, 0, 0 }, "Succubus", 22, 26, 24, 120, 150, AI_SUCC, MFLAG_CAN_OPEN_DOOR, 0, 100, 10, 1, 20, 0, 0, 0, 0, 60, MC_DEMON, RESIST_MAGIC , IMUNE_MAGIC | RESIST_FIRE , 0, 3, 3696 }, - { 128, 980, "Monsters\\Succ\\Scbs%c.CL2", FALSE, "Monsters\\Succ\\Scbs%c%i.WAV", FALSE, TRUE, "Monsters\\Succ\\Succb.TRN", { 14, 8, 16, 7, 24, 0 }, { 0, 0, 0, 0, 0, 0 }, "Snow Witch", 25, 28, 26, 135, 175, AI_SUCC, MFLAG_CAN_OPEN_DOOR, 1, 110, 10, 1, 24, 0, 0, 0, 0, 65, MC_DEMON, RESIST_LIGHTNING | IMUNE_NULL_40, IMUNE_MAGIC | RESIST_LIGHTNING | IMUNE_NULL_40, 0, 3, 4084 }, - { 128, 980, "Monsters\\Succ\\Scbs%c.CL2", FALSE, "Monsters\\Succ\\Scbs%c%i.WAV", FALSE, TRUE, "Monsters\\Succ\\Succrw.TRN", { 14, 8, 16, 7, 24, 0 }, { 0, 0, 0, 0, 0, 0 }, "Hell Spawn", 27, 30, 28, 150, 200, AI_SUCC, MFLAG_SEARCH | MFLAG_CAN_OPEN_DOOR, 2, 115, 10, 1, 30, 0, 0, 0, 0, 75, MC_DEMON, RESIST_MAGIC | IMUNE_LIGHTNING , IMUNE_MAGIC | IMUNE_FIRE | RESIST_LIGHTNING , 0, 3, 4480 }, - { 128, 980, "Monsters\\Succ\\Scbs%c.CL2", FALSE, "Monsters\\Succ\\Scbs%c%i.WAV", FALSE, TRUE, "Monsters\\Succ\\Succbw.TRN", { 14, 8, 16, 7, 24, 0 }, { 0, 0, 0, 0, 0, 0 }, "Soul Burner", 28, 30, 30, 140, 225, AI_SUCC, MFLAG_SEARCH | MFLAG_CAN_OPEN_DOOR, 3, 120, 10, 1, 35, 0, 0, 0, 0, 85, MC_DEMON, RESIST_MAGIC | IMUNE_FIRE | RESIST_LIGHTNING , IMUNE_MAGIC | IMUNE_FIRE | IMUNE_LIGHTNING , 0, 3, 4644 }, - { 128, 2000, "Monsters\\Mage\\Mage%c.CL2", TRUE, "Monsters\\Mage\\Mage%c%i.WAV", FALSE, FALSE, NULL, { 12, 1, 20, 8, 28, 20 }, { 0, 0, 0, 0, 0, 0 }, "Counselor", 24, 26, 25, 70, 70, AI_COUNSLR, MFLAG_CAN_OPEN_DOOR, 0, 90, 8, 8, 20, 0, 0, 0, 0, 0, MC_DEMON, RESIST_MAGIC | RESIST_FIRE | RESIST_LIGHTNING , RESIST_MAGIC | RESIST_FIRE | RESIST_LIGHTNING , 0, 7, 4070 }, - { 128, 2000, "Monsters\\Mage\\Mage%c.CL2", TRUE, "Monsters\\Mage\\Mage%c%i.WAV", FALSE, TRUE, "Monsters\\Mage\\Cnselg.TRN", { 12, 1, 20, 8, 28, 20 }, { 0, 0, 0, 0, 0, 0 }, "Magistrate", 26, 28, 27, 85, 85, AI_COUNSLR, MFLAG_CAN_OPEN_DOOR, 1, 100, 8, 10, 24, 0, 0, 0, 0, 0, MC_DEMON, RESIST_MAGIC | IMUNE_FIRE | RESIST_LIGHTNING | IMUNE_NULL_40, IMUNE_MAGIC | IMUNE_FIRE | RESIST_LIGHTNING | IMUNE_NULL_40, 0, 7, 4478 }, - { 128, 2000, "Monsters\\Mage\\Mage%c.CL2", TRUE, "Monsters\\Mage\\Mage%c%i.WAV", FALSE, TRUE, "Monsters\\Mage\\Cnselgd.TRN", { 12, 1, 20, 8, 28, 20 }, { 0, 0, 0, 0, 0, 0 }, "Cabalist", 28, 30, 29, 120, 120, AI_COUNSLR, MFLAG_CAN_OPEN_DOOR, 2, 110, 8, 14, 30, 0, 0, 0, 0, 0, MC_DEMON, RESIST_MAGIC | RESIST_FIRE | IMUNE_LIGHTNING | IMUNE_NULL_40, IMUNE_MAGIC | RESIST_FIRE | IMUNE_LIGHTNING | IMUNE_NULL_40, 0, 7, 4929 }, - { 128, 2000, "Monsters\\Mage\\Mage%c.CL2", TRUE, "Monsters\\Mage\\Mage%c%i.WAV", FALSE, TRUE, "Monsters\\Mage\\Cnselbk.TRN", { 12, 1, 20, 8, 28, 20 }, { 0, 0, 0, 0, 0, 0 }, "Advocate", 30, 30, 30, 145, 145, AI_COUNSLR, MFLAG_CAN_OPEN_DOOR, 3, 120, 8, 15, 25, 0, 0, 0, 0, 0, MC_DEMON, IMUNE_MAGIC | RESIST_FIRE | IMUNE_LIGHTNING | IMUNE_NULL_40, IMUNE_MAGIC | IMUNE_FIRE | IMUNE_LIGHTNING | IMUNE_NULL_40, 0, 7, 4968 }, - { 96, 386, "Monsters\\Golem\\Golem%c.CL2", TRUE, "Monsters\\Golem\\Golm%c%i.WAV", FALSE, FALSE, NULL, { 0, 16, 12, 0, 12, 20 }, { 0, 0, 0, 0, 0, 0 }, "Golem", 0, 0, 12, 1, 1, AI_GOLUM, MFLAG_CAN_OPEN_DOOR, 0, 0, 7, 1, 1, 0, 0, 0, 0, 1, MC_DEMON, 0 , 0 , 0, 0, 0 }, - { 160, 2000, "Monsters\\Diablo\\Diablo%c.CL2", TRUE, "Monsters\\Diablo\\Diablo%c%i.WAV", TRUE, FALSE, NULL, { 16, 6, 16, 6, 16, 16 }, { 0, 0, 0, 0, 0, 0 }, "The Dark Lord", 50, 50, 30, 1666, 1666, AI_DIABLO, MFLAG_KNOCKBACK | MFLAG_SEARCH | MFLAG_CAN_OPEN_DOOR, 3, 220, 4, 30, 60, 0, 11, 0, 0, 70, MC_DEMON, IMUNE_MAGIC | RESIST_FIRE | RESIST_LIGHTNING | IMUNE_NULL_40, IMUNE_MAGIC | RESIST_FIRE | RESIST_LIGHTNING | IMUNE_NULL_40, 0, 7, 31666 }, - { 128, 1060, "Monsters\\DarkMage\\Dmage%c.CL2", TRUE, "Monsters\\DarkMage\\Dmag%c%i.WAV", FALSE, FALSE, NULL, { 6, 1, 21, 6, 23, 18 }, { 0, 0, 0, 0, 0, 0 }, "The Arch-Litch Malignus", 30, 30, 30, 160, 160, AI_COUNSLR, MFLAG_CAN_OPEN_DOOR, 3, 120, 8, 20, 40, 0, 0, 0, 0, 70, MC_DEMON, RESIST_MAGIC | RESIST_FIRE | RESIST_LIGHTNING | IMUNE_NULL_40, IMUNE_MAGIC | IMUNE_FIRE | IMUNE_LIGHTNING | IMUNE_NULL_40, 0, 7, 4968 } - // clang-format on -}; - -char MonstConvTbl[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, 27, 29, 30, - 31, 32, 34, 35, 36, 37, 38, 40, 39, 41, - 42, 43, 44, 45, 46, 47, 48, 49, 50, 52, - 53, 54, 55, 56, 57, 59, 58, 60, 61, 62, - 63, 64, 65, 66, 67, 68, 69, 70, 71, 0, - 0, 0, 0, 72, 73, 74, 75, 0, 0, 0, - 0, 77, 76, 78, 79, 81, 82, 83, 84, 85, - 86, 87, 88, 89, 90, 92, 91, 93, 94, 95, - 96, 97, 98, 99, 100, 101, 102, 103, 104, 105, - 106, 107, 108, 0, 110, 0, 109, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 80, 111 -}; - -unsigned char MonstAvailTbl[112] = { - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, 0, 2, - 2, 2, 2, 0, 2, 2, 2, 2, 1, 1, - 1, 1, 2, 2, 2, 2, 2, 2, 2, 2, - 0, 0, 2, 2, 2, 2, 0, 0, 0, 0, - 2, 2, 2, 2, 2, 2, 2, 2, 0, 0, - 0, 0, 0, 0, 0, 0, 2, 2, 2, 2, - 0, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 0, 0, 0, - 0, 2, 2, 2, 2, 2, 2, 2, 2, 0, - 0, 0 -}; - -UniqMonstStruct UniqMonst[98] = { - // clang-format off - // mtype, mName, mTrnName, mlevel, mmaxhp, mAi, mint, mMinDamage, mMaxDamage, mMagicRes, mUnqAttr, mUnqVar1, mUnqVar2, mtalkmsg - { MT_NGOATMC, "Gharbad the Weak", "BSDB", 4, 120, AI_GARBUD, 3, 8, 16, IMUNE_LIGHTNING | IMUNE_NULL_40, 0, 0, 0, QUEST_GARBUD1 }, - { MT_SKING, "Skeleton King", "GENRL", 0, 240, AI_SKELKING, 3, 6, 16, IMUNE_MAGIC | RESIST_FIRE | RESIST_LIGHTNING | IMUNE_NULL_40, 1, 0, 0, 0 }, - { MT_COUNSLR, "Zhar the Mad", "GENERAL", 8, 360, AI_ZHAR, 3, 16, 40, IMUNE_MAGIC | RESIST_FIRE | RESIST_LIGHTNING , 0, 0, 0, QUEST_ZHAR1 }, - { MT_BFALLSP, "Snotspill", "BNG", 4, 220, AI_SNOTSPIL, 3, 10, 18, RESIST_LIGHTNING , 0, 0, 0, QUEST_BANNER10 }, - { MT_ADVOCATE, "Arch-Bishop Lazarus", "GENERAL", 0, 600, AI_LAZURUS, 3, 30, 50, IMUNE_MAGIC | RESIST_FIRE | RESIST_LIGHTNING | IMUNE_NULL_40, 0, 0, 0, QUEST_VILE13 }, - { MT_HLSPWN, "Red Vex", "REDV", 0, 400, AI_LAZHELP, 3, 30, 50, IMUNE_MAGIC | RESIST_FIRE | IMUNE_NULL_40, 0, 0, 0, QUEST_VILE13 }, - { MT_HLSPWN, "BlackJade", "BLKJD", 0, 400, AI_LAZHELP, 3, 30, 50, IMUNE_MAGIC | RESIST_LIGHTNING | IMUNE_NULL_40, 0, 0, 0, QUEST_VILE13 }, - { MT_RBLACK, "Lachdanan", "BHKA", 14, 500, AI_LACHDAN, 3, 0, 0, 0 , 0, 0, 0, QUEST_VEIL9 }, - { MT_BTBLACK, "Warlord of Blood", "GENERAL", 13, 850, AI_WARLORD, 3, 35, 50, IMUNE_MAGIC | IMUNE_FIRE | IMUNE_LIGHTNING | IMUNE_NULL_40, 0, 0, 0, QUEST_WARLRD9 }, - { MT_CLEAVER, "The Butcher", "GENRL", 0, 220, AI_CLEAVER, 3, 6, 12, RESIST_FIRE | RESIST_LIGHTNING | IMUNE_NULL_40, 0, 0, 0, 0 }, - { MT_TSKELAX, "Bonehead Keenaxe", "BHKA", 2, 91, AI_SKELSD, 2, 4, 10, IMUNE_MAGIC | IMUNE_NULL_40, 7, 100, 0, 0 }, - { MT_RFALLSD, "Bladeskin the Slasher", "BSTS", 2, 51, AI_FALLEN, 0, 6, 18, RESIST_FIRE , 11, 45, 0, 0 }, - { MT_NZOMBIE, "Soulpus", "GENERAL", 2, 133, AI_ZOMBIE, 0, 4, 8, RESIST_FIRE | RESIST_LIGHTNING , 0, 0, 0, 0 }, - { MT_RFALLSP, "Pukerat the Unclean", "PTU", 2, 77, AI_FALLEN, 3, 1, 5, RESIST_FIRE , 0, 0, 0, 0 }, - { MT_WSKELAX, "Boneripper", "BR", 2, 54, AI_BAT, 0, 6, 15, IMUNE_MAGIC | IMUNE_FIRE | IMUNE_NULL_40, 3, 0, 0, 0 }, - { MT_NZOMBIE, "Rotfeast the Hungry", "ETH", 2, 85, AI_SKELSD, 3, 4, 12, IMUNE_MAGIC | IMUNE_NULL_40, 3, 0, 0, 0 }, - { MT_DFALLSD, "Gutshank the Quick", "GTQ", 3, 66, AI_BAT, 2, 6, 16, RESIST_FIRE , 3, 0, 0, 0 }, - { MT_TSKELSD, "Brokenhead Bangshield", "BHBS", 3, 108, AI_SKELSD, 3, 12, 20, IMUNE_MAGIC | RESIST_LIGHTNING | IMUNE_NULL_40, 3, 0, 0, 0 }, - { MT_YFALLSP, "Bongo", "BNG", 3, 178, AI_FALLEN, 3, 9, 21, 0 , 3, 0, 0, 0 }, - { MT_BZOMBIE, "Rotcarnage", "RCRN", 3, 102, AI_ZOMBIE, 3, 9, 24, IMUNE_MAGIC | RESIST_LIGHTNING | IMUNE_NULL_40, 11, 45, 0, 0 }, - { MT_NSCAV, "Shadowbite", "SHBT", 2, 60, AI_SKELSD, 3, 3, 20, IMUNE_FIRE , 3, 0, 0, 0 }, - { MT_WSKELBW, "Deadeye", "DE", 2, 49, AI_GOATBOW, 0, 6, 9, IMUNE_MAGIC | RESIST_FIRE | IMUNE_NULL_40, 0, 0, 0, 0 }, - { MT_RSKELAX, "Madeye the Dead", "MTD", 4, 75, AI_BAT, 0, 9, 21, IMUNE_MAGIC | IMUNE_FIRE , 11, 30, 0, 0 }, - { MT_BSCAV, "El Chupacabras", "GENERAL", 3, 120, AI_GOATMC, 0, 10, 18, RESIST_FIRE , 3, 30, 0, 0 }, - { MT_TSKELBW, "Skullfire", "SKFR", 3, 125, AI_GOATBOW, 1, 6, 10, IMUNE_FIRE , 0, 100, 0, 0 }, - { MT_SNEAK, "Warpskull", "TSPO", 3, 117, AI_SNEAK, 2, 6, 18, RESIST_FIRE | RESIST_LIGHTNING , 3, 0, 0, 0 }, - { MT_GZOMBIE, "Goretongue", "PMR", 3, 156, AI_SKELSD, 1, 15, 30, IMUNE_MAGIC | IMUNE_NULL_40, 0, 0, 0, 0 }, - { MT_WSCAV, "Pulsecrawler", "BHKA", 4, 150, AI_SCAV, 0, 16, 20, IMUNE_FIRE | RESIST_LIGHTNING , 11, 45, 0, 0 }, - { MT_BLINK, "Moonbender", "GENERAL", 4, 135, AI_BAT, 0, 9, 27, IMUNE_FIRE , 3, 0, 0, 0 }, - { MT_BLINK, "Wrathraven", "GENERAL", 5, 135, AI_BAT, 2, 9, 22, IMUNE_FIRE , 3, 0, 0, 0 }, - { MT_YSCAV, "Spineeater", "GENERAL", 4, 180, AI_SCAV, 1, 18, 25, IMUNE_LIGHTNING | IMUNE_NULL_40, 3, 0, 0, 0 }, - { MT_RSKELBW, "Blackash the Burning", "BASHTB", 4, 120, AI_GOATBOW, 0, 6, 16, IMUNE_MAGIC | IMUNE_FIRE , 3, 0, 0, 0 }, - { MT_BFALLSD, "Shadowcrow", "GENERAL", 5, 270, AI_SNEAK, 2, 12, 25, 0 , 3, 0, 0, 0 }, - { MT_LRDSAYTR, "Blightstone the Weak", "BHKA", 4, 360, AI_SKELSD, 0, 4, 12, IMUNE_MAGIC | RESIST_LIGHTNING , 7, 70, 0, 0 }, - { MT_FAT, "Bilefroth the Pit Master", "BFTP", 6, 210, AI_BAT, 1, 16, 23, IMUNE_MAGIC | IMUNE_FIRE | RESIST_LIGHTNING , 3, 0, 0, 0 }, - { MT_NGOATBW, "Bloodskin Darkbow", "BSDB", 5, 207, AI_GOATBOW, 0, 3, 16, RESIST_FIRE | RESIST_LIGHTNING , 11, 55, 0, 0 }, - { MT_GLOOM, "Foulwing", "DB", 5, 246, AI_RHINO, 3, 12, 28, RESIST_FIRE , 3, 0, 0, 0 }, - { MT_XSKELSD, "Shadowdrinker", "SHDR", 5, 300, AI_SNEAK, 1, 18, 26, IMUNE_MAGIC | RESIST_FIRE | RESIST_LIGHTNING | IMUNE_NULL_40, 8, 45, 0, 0 }, - { MT_UNSEEN, "Hazeshifter", "BHKA", 5, 285, AI_SNEAK, 3, 18, 30, IMUNE_LIGHTNING | IMUNE_NULL_40, 3, 0, 0, 0 }, - { MT_NACID, "Deathspit", "BFDS", 6, 303, AI_ACIDUNIQ, 0, 12, 32, RESIST_FIRE | RESIST_LIGHTNING , 3, 0, 0, 0 }, - { MT_RGOATMC, "Bloodgutter", "BGBL", 6, 315, AI_BAT, 1, 24, 34, IMUNE_FIRE , 3, 0, 0, 0 }, - { MT_BGOATMC, "Deathshade Fleshmaul", "DSFM", 6, 276, AI_RHINO, 0, 12, 24, IMUNE_MAGIC | RESIST_FIRE , 8, 65, 0, 0 }, - { MT_WYRM, "Warmaggot the Mad", "GENERAL", 6, 246, AI_BAT, 3, 15, 30, RESIST_LIGHTNING , 3, 0, 0, 0 }, - { MT_STORM, "Glasskull the Jagged", "BHKA", 7, 354, AI_STORM, 0, 18, 30, IMUNE_MAGIC | IMUNE_FIRE | IMUNE_NULL_40, 3, 0, 0, 0 }, - { MT_RGOATBW, "Blightfire", "BLF", 7, 321, AI_SUCC, 2, 13, 21, IMUNE_FIRE , 3, 0, 0, 0 }, - { MT_GARGOYLE, "Nightwing the Cold", "GENERAL", 7, 342, AI_BAT, 1, 18, 26, IMUNE_MAGIC | RESIST_LIGHTNING | IMUNE_NULL_40, 3, 0, 0, 0 }, - { MT_GGOATBW, "Gorestone", "GENERAL", 7, 303, AI_GOATBOW, 1, 15, 28, RESIST_LIGHTNING | IMUNE_NULL_40, 7, 70, 0, 0 }, - { MT_BMAGMA, "Bronzefist Firestone", "GENERAL", 8, 360, AI_MAGMA, 0, 30, 36, IMUNE_MAGIC | RESIST_FIRE , 3, 0, 0, 0 }, - { MT_INCIN, "Wrathfire the Doomed", "WFTD", 8, 270, AI_SKELSD, 2, 20, 30, IMUNE_MAGIC | RESIST_FIRE | RESIST_LIGHTNING , 3, 0, 0, 0 }, - { MT_NMAGMA, "Firewound the Grim", "BHKA", 8, 303, AI_MAGMA, 0, 18, 22, IMUNE_MAGIC | RESIST_FIRE , 3, 0, 0, 0 }, - { MT_MUDMAN, "Baron Sludge", "BSM", 8, 315, AI_SNEAK, 3, 25, 34, IMUNE_MAGIC | RESIST_FIRE | RESIST_LIGHTNING | IMUNE_NULL_40, 11, 75, 0, 0 }, - { MT_GGOATMC, "Blighthorn Steelmace", "BHSM", 7, 250, AI_RHINO, 0, 20, 28, RESIST_LIGHTNING , 11, 45, 0, 0 }, - { MT_RACID, "Chaoshowler", "GENERAL", 8, 240, AI_ACIDUNIQ, 0, 12, 20, 0 , 3, 0, 0, 0 }, - { MT_REDDTH, "Doomgrin the Rotting", "GENERAL", 8, 405, AI_STORM, 3, 25, 50, IMUNE_MAGIC | RESIST_FIRE | RESIST_LIGHTNING | IMUNE_NULL_40, 3, 0, 0, 0 }, - { MT_FLAMLRD, "Madburner", "GENERAL", 9, 270, AI_STORM, 0, 20, 40, IMUNE_MAGIC | IMUNE_FIRE | IMUNE_LIGHTNING , 3, 0, 0, 0 }, - { MT_LTCHDMN, "Bonesaw the Litch", "GENERAL", 9, 495, AI_STORM, 2, 30, 55, IMUNE_MAGIC | RESIST_FIRE | RESIST_LIGHTNING | IMUNE_NULL_40, 3, 0, 0, 0 }, - { MT_MUDRUN, "Breakspine", "GENERAL", 9, 351, AI_RHINO, 0, 25, 34, RESIST_FIRE , 3, 0, 0, 0 }, - { MT_REDDTH, "Devilskull Sharpbone", "GENERAL", 9, 444, AI_STORM, 1, 25, 40, IMUNE_FIRE , 3, 0, 0, 0 }, - { MT_STORM, "Brokenstorm", "GENERAL", 9, 411, AI_STORM, 2, 25, 36, IMUNE_LIGHTNING , 3, 0, 0, 0 }, - { MT_RSTORM, "Stormbane", "GENERAL", 9, 555, AI_STORM, 3, 30, 30, IMUNE_LIGHTNING , 3, 0, 0, 0 }, - { MT_TOAD, "Oozedrool", "GENERAL", 9, 483, AI_FAT, 3, 25, 30, RESIST_LIGHTNING , 3, 0, 0, 0 }, - { MT_BLOODCLW, "Goldblight of the Flame", "GENERAL", 10, 405, AI_GARG, 0, 15, 35, IMUNE_MAGIC | IMUNE_FIRE , 11, 80, 0, 0 }, - { MT_OBLORD, "Blackstorm", "GENERAL", 10, 525, AI_RHINO, 3, 20, 40, IMUNE_MAGIC | IMUNE_LIGHTNING , 11, 90, 0, 0 }, - { MT_RACID, "Plaguewrath", "GENERAL", 10, 450, AI_ACIDUNIQ, 2, 20, 30, IMUNE_MAGIC | RESIST_FIRE | IMUNE_NULL_40, 3, 0, 0, 0 }, - { MT_RSTORM, "The Flayer", "GENERAL", 10, 501, AI_STORM, 1, 20, 35, RESIST_MAGIC | RESIST_FIRE | IMUNE_LIGHTNING | IMUNE_NULL_40, 3, 0, 0, 0 }, - { MT_FROSTC, "Bluehorn", "GENERAL", 11, 477, AI_RHINO, 1, 25, 30, IMUNE_MAGIC | RESIST_FIRE , 11, 90, 0, 0 }, - { MT_HELLBURN, "Warpfire Hellspawn", "GENERAL", 11, 525, AI_FIREMAN, 3, 10, 40, RESIST_MAGIC | IMUNE_FIRE , 3, 0, 0, 0 }, - { MT_NSNAKE, "Fangspeir", "GENERAL", 11, 444, AI_SKELSD, 1, 15, 32, IMUNE_FIRE | IMUNE_NULL_40, 3, 0, 0, 0 }, - { MT_UDEDBLRG, "Festerskull", "GENERAL", 11, 600, AI_STORM, 2, 15, 30, IMUNE_MAGIC | IMUNE_NULL_40, 3, 0, 0, 0 }, - { MT_NBLACK, "Lionskull the Bent", "GENERAL", 12, 525, AI_SKELSD, 2, 25, 25, IMUNE_MAGIC | IMUNE_FIRE | IMUNE_LIGHTNING | IMUNE_NULL_40, 3, 0, 0, 0 }, - { MT_COUNSLR, "Blacktongue", "GENERAL", 12, 360, AI_COUNSLR, 3, 15, 30, RESIST_FIRE | IMUNE_NULL_40, 3, 0, 0, 0 }, - { MT_DEATHW, "Viletouch", "GENERAL", 12, 525, AI_GARG, 3, 20, 40, IMUNE_LIGHTNING | IMUNE_NULL_40, 3, 0, 0, 0 }, - { MT_RSNAKE, "Viperflame", "GENERAL", 12, 570, AI_SKELSD, 1, 25, 35, IMUNE_FIRE | RESIST_LIGHTNING , 3, 0, 0, 0 }, - { MT_BSNAKE, "Fangskin", "BHKA", 14, 681, AI_SKELSD, 2, 15, 50, IMUNE_MAGIC | RESIST_LIGHTNING , 3, 0, 0, 0 }, - { MT_SUCCUBUS, "Witchfire the Unholy", "GENERAL", 12, 444, AI_SUCC, 3, 10, 20, IMUNE_MAGIC | IMUNE_FIRE | RESIST_LIGHTNING , 3, 0, 0, 0 }, - { MT_BALROG, "Blackskull", "BHKA", 13, 750, AI_SKELSD, 3, 25, 40, IMUNE_MAGIC | RESIST_LIGHTNING , 3, 0, 0, 0 }, - { MT_UNRAV, "Soulslash", "GENERAL", 12, 450, AI_SKELSD, 0, 25, 25, IMUNE_MAGIC | IMUNE_NULL_40, 3, 0, 0, 0 }, - { MT_VTEXLRD, "Windspawn", "GENERAL", 12, 711, AI_SKELSD, 1, 35, 40, IMUNE_MAGIC | IMUNE_FIRE , 3, 0, 0, 0 }, - { MT_GSNAKE, "Lord of the Pit", "GENERAL", 13, 762, AI_SKELSD, 2, 25, 42, RESIST_FIRE | IMUNE_NULL_40, 3, 0, 0, 0 }, - { MT_RTBLACK, "Rustweaver", "GENERAL", 13, 400, AI_SKELSD, 3, 1, 60, IMUNE_MAGIC | IMUNE_FIRE | IMUNE_LIGHTNING | IMUNE_NULL_40, 0, 0, 0, 0 }, - { MT_HOLOWONE, "Howlingire the Shade", "GENERAL", 13, 450, AI_SKELSD, 2, 40, 75, RESIST_FIRE | RESIST_LIGHTNING , 3, 0, 0, 0 }, - { MT_MAEL, "Doomcloud", "GENERAL", 13, 612, AI_STORM, 1, 1, 60, RESIST_FIRE | IMUNE_LIGHTNING , 0, 0, 0, 0 }, - { MT_PAINMSTR, "Bloodmoon Soulfire", "GENERAL", 13, 684, AI_SKELSD, 1, 15, 40, IMUNE_MAGIC | RESIST_FIRE | RESIST_LIGHTNING , 3, 0, 0, 0 }, - { MT_SNOWWICH, "Witchmoon", "GENERAL", 13, 310, AI_SUCC, 3, 30, 40, RESIST_LIGHTNING , 0, 0, 0, 0 }, - { MT_VTEXLRD, "Gorefeast", "GENERAL", 13, 771, AI_SKELSD, 3, 20, 55, RESIST_FIRE | IMUNE_NULL_40, 0, 0, 0, 0 }, - { MT_RTBLACK, "Graywar the Slayer", "GENERAL", 14, 672, AI_SKELSD, 1, 30, 50, RESIST_LIGHTNING | IMUNE_NULL_40, 0, 0, 0, 0 }, - { MT_MAGISTR, "Dreadjudge", "GENERAL", 14, 540, AI_COUNSLR, 1, 30, 40, IMUNE_MAGIC | RESIST_FIRE | RESIST_LIGHTNING , 3, 0, 0, 0 }, - { MT_HLSPWN, "Stareye the Witch", "GENERAL", 14, 726, AI_SUCC, 2, 30, 50, IMUNE_FIRE , 0, 0, 0, 0 }, - { MT_BTBLACK, "Steelskull the Hunter", "GENERAL", 14, 831, AI_SKELSD, 3, 40, 50, RESIST_LIGHTNING | IMUNE_NULL_40, 0, 0, 0, 0 }, - { MT_RBLACK, "Sir Gorash", "GENERAL", 16, 1050, AI_SKELSD, 1, 20, 60, IMUNE_NULL_40, 0, 0, 0, 0 }, - { MT_CABALIST, "The Vizier", "GENERAL", 15, 850, AI_COUNSLR, 2, 25, 40, IMUNE_FIRE , 3, 0, 0, 0 }, - { MT_REALWEAV, "Zamphir", "GENERAL", 15, 891, AI_SKELSD, 2, 30, 50, IMUNE_MAGIC | RESIST_FIRE | RESIST_LIGHTNING | IMUNE_NULL_40, 3, 0, 0, 0 }, - { MT_HLSPWN, "Bloodlust", "GENERAL", 15, 825, AI_SUCC, 1, 20, 55, IMUNE_MAGIC | IMUNE_LIGHTNING | IMUNE_NULL_40, 0, 0, 0, 0 }, - { MT_HLSPWN, "Webwidow", "GENERAL", 16, 774, AI_SUCC, 1, 20, 50, IMUNE_MAGIC | IMUNE_FIRE | IMUNE_NULL_40, 0, 0, 0, 0 }, - { MT_SOLBRNR, "Fleshdancer", "GENERAL", 16, 999, AI_SUCC, 3, 30, 50, IMUNE_MAGIC | RESIST_FIRE | IMUNE_NULL_40, 0, 0, 0, 0 }, - { MT_OBLORD, "Grimspike", "GENERAL", 19, 534, AI_SNEAK, 1, 25, 40, IMUNE_MAGIC | RESIST_FIRE | IMUNE_NULL_40, 3, 0, 0, 0 }, - { MT_STORML, "Doomlock", "GENERAL", 28, 534, AI_SNEAK, 1, 35, 55, IMUNE_MAGIC | RESIST_FIRE | RESIST_LIGHTNING | IMUNE_NULL_40, 3, 0, 0, 0 }, - { -1, NULL, NULL, 0, 0, 0, 0, 0, 0, 0 , 0, 0, 0, 0 } - // clang-format on -}; +#include "diablo.h" + +MonsterData monsterdata[112] = { + // clang-format off + // width, mImage, GraphicType, has_special, sndfile, snd_special, has_trans, TransFile, Frames[6], Rate[6], mName, mMinDLvl, mMaxDLvl, mLevel, mMinHP, mMaxHP, mAi, mFlags, mInt, mHit, mAFNum, mMinDamage, mMaxDamage, mHit2, mAFNum2, mMinDamage2, mMaxDamage2, mArmorClass, mMonstClass, mMagicRes , mMagicRes2 , mTreasure, mSelFlag, mExp + { 128, 799, "Monsters\\Zombie\\Zombie%c.CL2", FALSE, "Monsters\\Zombie\\Zombie%c%i.WAV", FALSE, FALSE, NULL, { 11, 24, 12, 6, 16, 0 }, { 4, 0, 0, 0, 0, 0 }, "Zombie", 1, 3, 1, 4, 7, AI_ZOMBIE, 0 , 0, 10, 8, 2, 5, 0, 0, 0, 0, 5, MC_UNDEAD, IMUNE_MAGIC | IMUNE_NULL_40, IMUNE_MAGIC | IMUNE_NULL_40, 0, 3, 54 }, + { 128, 799, "Monsters\\Zombie\\Zombie%c.CL2", FALSE, "Monsters\\Zombie\\Zombie%c%i.WAV", FALSE, TRUE, "Monsters\\Zombie\\Bluered.TRN", { 11, 24, 12, 6, 16, 0 }, { 4, 0, 0, 0, 0, 0 }, "Ghoul", 2, 4, 2, 7, 11, AI_ZOMBIE, 0 , 1, 10, 8, 3, 10, 0, 0, 0, 0, 10, MC_UNDEAD, IMUNE_MAGIC | IMUNE_NULL_40, IMUNE_MAGIC | IMUNE_NULL_40, 0, 3, 58 }, + { 128, 799, "Monsters\\Zombie\\Zombie%c.CL2", FALSE, "Monsters\\Zombie\\Zombie%c%i.WAV", FALSE, TRUE, "Monsters\\Zombie\\Grey.TRN", { 11, 24, 12, 6, 16, 0 }, { 4, 0, 0, 0, 0, 0 }, "Rotting Carcass", 2, 6, 4, 15, 25, AI_ZOMBIE, 0 , 2, 25, 8, 5, 15, 0, 0, 0, 0, 15, MC_UNDEAD, IMUNE_MAGIC | IMUNE_NULL_40, IMUNE_MAGIC | RESIST_FIRE | IMUNE_NULL_40, 0, 3, 136 }, + { 128, 799, "Monsters\\Zombie\\Zombie%c.CL2", FALSE, "Monsters\\Zombie\\Zombie%c%i.WAV", FALSE, TRUE, "Monsters\\Zombie\\Yellow.TRN", { 11, 24, 12, 6, 16, 0 }, { 4, 0, 0, 0, 0, 0 }, "Black Death", 4, 8, 6, 25, 40, AI_ZOMBIE, 0 , 3, 30, 8, 6, 22, 0, 0, 0, 0, 20, MC_UNDEAD, IMUNE_MAGIC | IMUNE_NULL_40, IMUNE_MAGIC | RESIST_LIGHTNING | IMUNE_NULL_40, 0, 3, 240 }, + { 128, 543, "Monsters\\FalSpear\\Phall%c.CL2", TRUE, "Monsters\\FalSpear\\Phall%c%i.WAV", TRUE, TRUE, "Monsters\\FalSpear\\FallenT.TRN", { 11, 11, 13, 11, 18, 13 }, { 3, 0, 0, 0, 0, 0 }, "Fallen One", 1, 3, 1, 1, 4, AI_FALLEN, 0 , 0, 15, 7, 1, 3, 0, 5, 0, 0, 0, MC_ANIMAL, 0 , 0 , 0, 3, 46 }, + { 128, 543, "Monsters\\FalSpear\\Phall%c.CL2", TRUE, "Monsters\\FalSpear\\Phall%c%i.WAV", TRUE, TRUE, "Monsters\\FalSpear\\Dark.TRN", { 11, 11, 13, 11, 18, 13 }, { 3, 0, 0, 0, 0, 0 }, "Carver", 2, 5, 3, 4, 8, AI_FALLEN, 0 , 2, 20, 7, 2, 5, 0, 5, 0, 0, 5, MC_ANIMAL, 0 , 0 , 0, 3, 80 }, + { 128, 543, "Monsters\\FalSpear\\Phall%c.CL2", TRUE, "Monsters\\FalSpear\\Phall%c%i.WAV", TRUE, FALSE, NULL, { 11, 11, 13, 11, 18, 13 }, { 3, 0, 0, 0, 0, 0 }, "Devil Kin", 3, 7, 5, 12, 24, AI_FALLEN, 0 , 2, 25, 7, 3, 7, 0, 5, 0, 0, 10, MC_ANIMAL, 0 , RESIST_FIRE , 0, 3, 155 }, + { 128, 543, "Monsters\\FalSpear\\Phall%c.CL2", TRUE, "Monsters\\FalSpear\\Phall%c%i.WAV", TRUE, TRUE, "Monsters\\FalSpear\\Blue.TRN", { 11, 11, 13, 11, 18, 13 }, { 3, 0, 0, 0, 0, 0 }, "Dark One", 5, 9, 7, 20, 36, AI_FALLEN, 0 , 3, 30, 7, 4, 8, 0, 5, 0, 0, 15, MC_ANIMAL, IMUNE_NULL_40, RESIST_LIGHTNING | IMUNE_NULL_40, 0, 3, 255 }, + { 128, 553, "Monsters\\SkelAxe\\SklAx%c.CL2", TRUE, "Monsters\\SkelAxe\\SklAx%c%i.WAV", FALSE, TRUE, "Monsters\\SkelAxe\\White.TRN", { 12, 8, 13, 6, 17, 16 }, { 5, 0, 0, 0, 0, 0 }, "Skeleton", 1, 3, 1, 2, 4, AI_SKELSD, 0 , 0, 20, 8, 1, 4, 0, 0, 0, 0, 0, MC_UNDEAD, IMUNE_MAGIC | IMUNE_NULL_40, IMUNE_MAGIC | IMUNE_NULL_40, 0, 3, 64 }, + { 128, 553, "Monsters\\SkelAxe\\SklAx%c.CL2", TRUE, "Monsters\\SkelAxe\\SklAx%c%i.WAV", FALSE, TRUE, "Monsters\\SkelAxe\\Skelt.TRN", { 12, 8, 13, 6, 17, 16 }, { 4, 0, 0, 0, 0, 0 }, "Corpse Axe", 2, 5, 2, 4, 7, AI_SKELSD, 0 , 1, 25, 8, 3, 5, 0, 0, 0, 0, 0, MC_UNDEAD, IMUNE_MAGIC | IMUNE_NULL_40, IMUNE_MAGIC | IMUNE_NULL_40, 0, 3, 68 }, + { 128, 553, "Monsters\\SkelAxe\\SklAx%c.CL2", TRUE, "Monsters\\SkelAxe\\SklAx%c%i.WAV", FALSE, FALSE, NULL, { 12, 8, 13, 6, 17, 16 }, { 2, 0, 0, 0, 0, 0 }, "Burning Dead", 2, 6, 4, 8, 12, AI_SKELSD, 0 , 2, 30, 8, 3, 7, 0, 0, 0, 0, 5, MC_UNDEAD, IMUNE_MAGIC | RESIST_FIRE | IMUNE_NULL_40, IMUNE_MAGIC | IMUNE_FIRE | IMUNE_NULL_40, 0, 3, 154 }, + { 128, 553, "Monsters\\SkelAxe\\SklAx%c.CL2", TRUE, "Monsters\\SkelAxe\\SklAx%c%i.WAV", FALSE, TRUE, "Monsters\\SkelAxe\\Black.TRN", { 12, 8, 13, 6, 17, 16 }, { 3, 0, 0, 0, 0, 0 }, "Horror", 4, 8, 6, 12, 20, AI_SKELSD, 0 , 3, 35, 8, 4, 9, 0, 0, 0, 0, 15, MC_UNDEAD, IMUNE_MAGIC | RESIST_LIGHTNING | IMUNE_NULL_40, IMUNE_MAGIC | RESIST_LIGHTNING | IMUNE_NULL_40, 0, 3, 264 }, + { 128, 623, "Monsters\\FalSword\\Fall%c.CL2", TRUE, "Monsters\\FalSword\\Fall%c%i.WAV", TRUE, TRUE, "Monsters\\FalSword\\FallenT.TRN", { 12, 12, 13, 11, 14, 15 }, { 3, 0, 0, 0, 0, 0 }, "Fallen One", 1, 3, 1, 2, 5, AI_FALLEN, 0 , 0, 15, 8, 1, 4, 0, 5, 0, 0, 10, MC_ANIMAL, 0 , 0 , 0, 3, 52 }, + { 128, 623, "Monsters\\FalSword\\Fall%c.CL2", TRUE, "Monsters\\FalSword\\Fall%c%i.WAV", TRUE, TRUE, "Monsters\\FalSword\\Dark.TRN", { 12, 12, 13, 11, 14, 15 }, { 3, 0, 0, 0, 0, 0 }, "Carver", 2, 5, 3, 5, 9, AI_FALLEN, 0 , 1, 20, 8, 2, 7, 0, 5, 0, 0, 15, MC_ANIMAL, 0 , 0 , 0, 3, 90 }, + { 128, 623, "Monsters\\FalSword\\Fall%c.CL2", TRUE, "Monsters\\FalSword\\Fall%c%i.WAV", TRUE, FALSE, NULL, { 12, 12, 13, 11, 14, 15 }, { 3, 0, 0, 0, 0, 0 }, "Devil Kin", 3, 7, 5, 16, 24, AI_FALLEN, 0 , 2, 25, 8, 4, 10, 0, 5, 0, 0, 20, MC_ANIMAL, 0 , RESIST_FIRE , 0, 3, 180 }, + { 128, 623, "Monsters\\FalSword\\Fall%c.CL2", TRUE, "Monsters\\FalSword\\Fall%c%i.WAV", TRUE, TRUE, "Monsters\\FalSword\\Blue.TRN", { 12, 12, 13, 11, 14, 15 }, { 3, 0, 0, 0, 0, 0 }, "Dark One", 5, 9, 7, 24, 36, AI_FALLEN, 0 , 3, 30, 8, 4, 12, 0, 5, 0, 0, 25, MC_ANIMAL, IMUNE_NULL_40, RESIST_LIGHTNING | IMUNE_NULL_40, 0, 3, 280 }, + { 128, 410, "Monsters\\Scav\\Scav%c.CL2", TRUE, "Monsters\\Scav\\Scav%c%i.WAV", FALSE, FALSE, NULL, { 12, 8, 12, 6, 20, 11 }, { 2, 0, 0, 0, 0, 0 }, "Scavenger", 1, 4, 2, 3, 6, AI_SCAV, 0 , 0, 20, 7, 1, 5, 0, 0, 0, 0, 10, MC_ANIMAL, 0 , RESIST_FIRE , 0, 3, 80 }, + { 128, 410, "Monsters\\Scav\\Scav%c.CL2", TRUE, "Monsters\\Scav\\Scav%c%i.WAV", FALSE, TRUE, "Monsters\\Scav\\ScavBr.TRN", { 12, 8, 12, 6, 20, 11 }, { 2, 0, 0, 0, 0, 0 }, "Plague Eater", 3, 6, 4, 12, 24, AI_SCAV, 0 , 1, 30, 7, 1, 8, 0, 0, 0, 0, 20, MC_ANIMAL, 0 , RESIST_LIGHTNING , 0, 3, 188 }, + { 128, 410, "Monsters\\Scav\\Scav%c.CL2", TRUE, "Monsters\\Scav\\Scav%c%i.WAV", FALSE, TRUE, "Monsters\\Scav\\ScavBe.TRN", { 12, 8, 12, 6, 20, 11 }, { 2, 0, 0, 0, 0, 0 }, "Shadow Beast", 4, 8, 6, 24, 36, AI_SCAV, 0 , 2, 35, 7, 3, 12, 0, 0, 0, 0, 25, MC_ANIMAL, IMUNE_NULL_40, RESIST_FIRE | IMUNE_NULL_40, 0, 3, 375 }, + { 128, 410, "Monsters\\Scav\\Scav%c.CL2", TRUE, "Monsters\\Scav\\Scav%c%i.WAV", FALSE, TRUE, "Monsters\\Scav\\ScavW.TRN", { 12, 8, 12, 6, 20, 11 }, { 2, 0, 0, 0, 0, 0 }, "Bone Gasher", 6, 10, 8, 28, 40, AI_SCAV, 0 , 3, 35, 7, 5, 15, 0, 0, 0, 0, 30, MC_ANIMAL, RESIST_MAGIC | IMUNE_NULL_40, RESIST_LIGHTNING | IMUNE_NULL_40, 0, 3, 552 }, + { 128, 567, "Monsters\\SkelBow\\SklBw%c.CL2", TRUE, "Monsters\\SkelBow\\SklBw%c%i.WAV", FALSE, TRUE, "Monsters\\SkelBow\\White.TRN", { 9, 8, 16, 5, 16, 16 }, { 4, 0, 0, 0, 0, 0 }, "Skeleton", 2, 5, 3, 2, 4, AI_SKELBOW, 0 , 0, 15, 12, 1, 2, 0, 0, 0, 0, 0, MC_UNDEAD, IMUNE_MAGIC | IMUNE_NULL_40, IMUNE_MAGIC | IMUNE_NULL_40, 0, 3, 110 }, + { 128, 567, "Monsters\\SkelBow\\SklBw%c.CL2", TRUE, "Monsters\\SkelBow\\SklBw%c%i.WAV", FALSE, TRUE, "Monsters\\SkelBow\\Skelt.TRN", { 9, 8, 16, 5, 16, 16 }, { 4, 0, 0, 0, 0, 0 }, "Corpse Bow", 3, 7, 5, 8, 16, AI_SKELBOW, 0 , 1, 25, 12, 1, 4, 0, 0, 0, 0, 0, MC_UNDEAD, IMUNE_MAGIC | IMUNE_NULL_40, IMUNE_MAGIC | IMUNE_NULL_40, 0, 3, 210 }, + { 128, 567, "Monsters\\SkelBow\\SklBw%c.CL2", TRUE, "Monsters\\SkelBow\\SklBw%c%i.WAV", FALSE, FALSE, NULL, { 9, 8, 16, 5, 16, 16 }, { 2, 0, 0, 0, 0, 0 }, "Burning Dead", 5, 9, 7, 10, 24, AI_SKELBOW, 0 , 2, 30, 12, 1, 6, 0, 0, 0, 0, 5, MC_UNDEAD, IMUNE_MAGIC | RESIST_FIRE | IMUNE_NULL_40, IMUNE_MAGIC | IMUNE_FIRE | IMUNE_NULL_40, 0, 3, 364 }, + { 128, 567, "Monsters\\SkelBow\\SklBw%c.CL2", TRUE, "Monsters\\SkelBow\\SklBw%c%i.WAV", FALSE, TRUE, "Monsters\\SkelBow\\Black.TRN", { 9, 8, 16, 5, 16, 16 }, { 3, 0, 0, 0, 0, 0 }, "Horror", 7, 11, 9, 15, 45, AI_SKELBOW, 0 , 3, 35, 12, 2, 9, 0, 0, 0, 0, 15, MC_UNDEAD, IMUNE_MAGIC | RESIST_LIGHTNING | IMUNE_NULL_40, IMUNE_MAGIC | RESIST_LIGHTNING | IMUNE_NULL_40, 0, 3, 594 }, + { 128, 575, "Monsters\\SkelSd\\SklSr%c.CL2", TRUE, "Monsters\\SkelSd\\SklSr%c%i.WAV", TRUE, TRUE, "Monsters\\SkelSd\\White.TRN", { 13, 8, 12, 7, 15, 16 }, { 4, 0, 0, 0, 0, 0 }, "Skeleton Captain", 1, 4, 2, 3, 6, AI_SKELSD, 0 , 0, 20, 8, 2, 7, 0, 0, 0, 0, 10, MC_UNDEAD, IMUNE_MAGIC | IMUNE_NULL_40, IMUNE_MAGIC | IMUNE_NULL_40, 0, 3, 90 }, + { 128, 575, "Monsters\\SkelSd\\SklSr%c.CL2", TRUE, "Monsters\\SkelSd\\SklSr%c%i.WAV", FALSE, TRUE, "Monsters\\SkelSd\\Skelt.TRN", { 13, 8, 12, 7, 15, 16 }, { 4, 0, 0, 0, 0, 0 }, "Corpse Captain", 2, 6, 4, 12, 20, AI_SKELSD, 0 , 1, 30, 8, 3, 9, 0, 0, 0, 0, 5, MC_UNDEAD, IMUNE_MAGIC | IMUNE_NULL_40, IMUNE_MAGIC | IMUNE_NULL_40, 0, 3, 200 }, + { 128, 575, "Monsters\\SkelSd\\SklSr%c.CL2", TRUE, "Monsters\\SkelSd\\SklSr%c%i.WAV", FALSE, FALSE, NULL, { 13, 8, 12, 7, 15, 16 }, { 4, 0, 0, 0, 0, 0 }, "Burning Dead Captain", 4, 8, 6, 16, 30, AI_SKELSD, 0 , 2, 35, 8, 4, 10, 0, 0, 0, 0, 15, MC_UNDEAD, IMUNE_MAGIC | RESIST_FIRE | IMUNE_NULL_40, IMUNE_MAGIC | IMUNE_FIRE | IMUNE_NULL_40, 0, 3, 393 }, + { 128, 575, "Monsters\\SkelSd\\SklSr%c.CL2", TRUE, "Monsters\\SkelSd\\SklSr%c%i.WAV", FALSE, TRUE, "Monsters\\SkelSd\\Black.TRN", { 13, 8, 12, 7, 15, 16 }, { 4, 0, 0, 0, 0, 0 }, "Horror Captain", 6, 10, 8, 35, 50, AI_SKELSD, MFLAG_SEARCH , 3, 40, 8, 5, 14, 0, 0, 0, 0, 30, MC_UNDEAD, IMUNE_MAGIC | RESIST_LIGHTNING | IMUNE_NULL_40, IMUNE_MAGIC | RESIST_LIGHTNING | IMUNE_NULL_40, 0, 3, 604 }, + { 128, 2000, "Monsters\\TSneak\\TSneak%c.CL2", FALSE, "Monsters\\TSneak\\Sneakl%c%i.WAV", FALSE, FALSE, NULL, { 13, 13, 15, 11, 16, 0 }, { 2, 0, 0, 0, 0, 0 }, "Invisible Lord", 14, 14, 14, 278, 278, AI_SKELSD, MFLAG_SEARCH , 3, 65, 8, 16, 30, 0, 0, 0, 0, 60, MC_DEMON, RESIST_MAGIC | RESIST_FIRE | RESIST_LIGHTNING | IMUNE_NULL_40, RESIST_MAGIC | RESIST_FIRE | RESIST_LIGHTNING | IMUNE_NULL_40, 0, 3, 2000 }, + { 128, 992, "Monsters\\Sneak\\Sneak%c.CL2", TRUE, "Monsters\\Sneak\\Sneak%c%i.WAV", FALSE, FALSE, NULL, { 16, 8, 12, 8, 24, 15 }, { 2, 0, 0, 0, 0, 0 }, "Hidden", 3, 8, 5, 8, 24, AI_SNEAK, MFLAG_HIDDEN , 0, 35, 8, 3, 6, 0, 0, 0, 0, 25, MC_DEMON, 0 , IMUNE_NULL_40, 0, 3, 278 }, + { 128, 992, "Monsters\\Sneak\\Sneak%c.CL2", TRUE, "Monsters\\Sneak\\Sneak%c%i.WAV", FALSE, TRUE, "Monsters\\Sneak\\Sneakv2.TRN", { 16, 8, 12, 8, 24, 15 }, { 2, 0, 0, 0, 0, 0 }, "Stalker", 8, 12, 9, 30, 45, AI_SNEAK, MFLAG_HIDDEN | MFLAG_SEARCH , 1, 40, 8, 8, 16, 0, 0, 0, 0, 30, MC_DEMON, 0 , IMUNE_NULL_40, 0, 3, 630 }, + { 128, 992, "Monsters\\Sneak\\Sneak%c.CL2", TRUE, "Monsters\\Sneak\\Sneak%c%i.WAV", FALSE, TRUE, "Monsters\\Sneak\\Sneakv3.TRN", { 16, 8, 12, 8, 24, 15 }, { 2, 0, 0, 0, 0, 0 }, "Unseen", 10, 14, 11, 35, 50, AI_SNEAK, MFLAG_HIDDEN | MFLAG_SEARCH , 2, 45, 8, 12, 20, 0, 0, 0, 0, 30, MC_DEMON, RESIST_MAGIC | IMUNE_NULL_40, IMUNE_MAGIC | IMUNE_NULL_40, 0, 3, 935 }, + { 128, 992, "Monsters\\Sneak\\Sneak%c.CL2", TRUE, "Monsters\\Sneak\\Sneak%c%i.WAV", FALSE, TRUE, "Monsters\\Sneak\\Sneakv1.TRN", { 16, 8, 12, 8, 24, 15 }, { 2, 0, 0, 0, 0, 0 }, "Illusion Weaver", 14, 18, 13, 40, 60, AI_SNEAK, MFLAG_HIDDEN | MFLAG_SEARCH , 3, 60, 8, 16, 24, 0, 0, 0, 0, 30, MC_DEMON, RESIST_MAGIC | RESIST_FIRE , IMUNE_MAGIC | RESIST_FIRE | IMUNE_NULL_40, 0, 3, 1500 }, + { 160, 2000, "Monsters\\GoatLord\\GoatL%c.CL2", FALSE, "Monsters\\GoatLord\\Goatl%c%i.WAV", FALSE, FALSE, NULL, { 13, 13, 14, 9, 16, 0 }, { 2, 0, 0, 0, 0, 0 }, "Lord Sayter", 13, 13, 12, 351, 351, AI_SKELSD, MFLAG_SEARCH , 3, 80, 8, 14, 24, 0, 0, 0, 0, 60, MC_DEMON, RESIST_MAGIC | RESIST_FIRE | IMUNE_NULL_40, RESIST_MAGIC | RESIST_FIRE | IMUNE_NULL_40, 0, 3, 1500 }, + { 128, 1030, "Monsters\\GoatMace\\Goat%c.CL2", TRUE, "Monsters\\GoatMace\\Goat%c%i.WAV", FALSE, FALSE, NULL, { 12, 8, 12, 6, 20, 12 }, { 2, 0, 0, 0, 1, 0 }, "Flesh Clan", 6, 10, 8, 30, 45, AI_GOATMC, MFLAG_SEARCH | MFLAG_CAN_OPEN_DOOR, 0, 50, 8, 4, 10, 0, 0, 0, 0, 40, MC_DEMON, 0 , 0 , 0, 3, 460 }, + { 128, 1030, "Monsters\\GoatMace\\Goat%c.CL2", TRUE, "Monsters\\GoatMace\\Goat%c%i.WAV", FALSE, TRUE, "Monsters\\GoatMace\\Beige.TRN", { 12, 8, 12, 6, 20, 12 }, { 2, 0, 0, 0, 1, 0 }, "Stone Clan", 8, 12, 10, 40, 55, AI_GOATMC, MFLAG_SEARCH | MFLAG_CAN_OPEN_DOOR, 1, 60, 8, 6, 12, 0, 0, 0, 0, 40, MC_DEMON, RESIST_MAGIC | IMUNE_NULL_40, IMUNE_MAGIC | IMUNE_NULL_40, 0, 3, 685 }, + { 128, 1030, "Monsters\\GoatMace\\Goat%c.CL2", TRUE, "Monsters\\GoatMace\\Goat%c%i.WAV", FALSE, TRUE, "Monsters\\GoatMace\\Red.TRN", { 12, 8, 12, 6, 20, 12 }, { 2, 0, 0, 0, 1, 0 }, "Fire Clan", 10, 14, 12, 50, 65, AI_GOATMC, MFLAG_SEARCH | MFLAG_CAN_OPEN_DOOR, 2, 70, 8, 8, 16, 0, 0, 0, 0, 45, MC_DEMON, RESIST_FIRE , IMUNE_FIRE , 0, 3, 906 }, + { 128, 1030, "Monsters\\GoatMace\\Goat%c.CL2", TRUE, "Monsters\\GoatMace\\Goat%c%i.WAV", FALSE, TRUE, "Monsters\\GoatMace\\Gray.TRN", { 12, 8, 12, 6, 20, 12 }, { 2, 0, 0, 0, 1, 0 }, "Night Clan", 12, 16, 14, 55, 70, AI_GOATMC, MFLAG_SEARCH | MFLAG_CAN_OPEN_DOOR, 3, 80, 8, 10, 20, 15, 0, 30, 30, 50, MC_DEMON, RESIST_MAGIC | IMUNE_NULL_40, IMUNE_MAGIC | IMUNE_NULL_40, 0, 3, 1190 }, + { 96, 364, "Monsters\\Bat\\Bat%c.CL2", FALSE, "Monsters\\Bat\\Bat%c%i.WAV", FALSE, TRUE, "Monsters\\Bat\\red.trn", { 9, 13, 10, 9, 13, 0 }, { 0, 0, 0, 0, 0, 0 }, "Fiend", 2, 5, 3, 3, 6, AI_BAT, 0 , 0, 35, 5, 1, 6, 0, 0, 0, 0, 0, MC_ANIMAL, 0 , 0 , 0x4000, 6, 102 }, + { 96, 364, "Monsters\\Bat\\Bat%c.CL2", FALSE, "Monsters\\Bat\\Bat%c%i.WAV", FALSE, FALSE, NULL, { 9, 13, 10, 9, 13, 0 }, { 0, 0, 0, 0, 0, 0 }, "Blink", 5, 9, 7, 12, 28, AI_BAT, 0 , 1, 45, 5, 1, 8, 0, 0, 0, 0, 15, MC_ANIMAL, 0 , 0 , 0x4000, 6, 340 }, + { 96, 364, "Monsters\\Bat\\Bat%c.CL2", FALSE, "Monsters\\Bat\\Bat%c%i.WAV", FALSE, TRUE, "Monsters\\Bat\\grey.trn", { 9, 13, 10, 9, 13, 0 }, { 0, 0, 0, 0, 0, 0 }, "Gloom", 7, 11, 9, 28, 36, AI_BAT, MFLAG_SEARCH , 2, 70, 5, 4, 12, 0, 0, 0, 0, 35, MC_ANIMAL, RESIST_MAGIC , RESIST_MAGIC | IMUNE_NULL_40, 0x4000, 6, 509 }, + { 96, 364, "Monsters\\Bat\\Bat%c.CL2", FALSE, "Monsters\\Bat\\Bat%c%i.WAV", FALSE, TRUE, "Monsters\\Bat\\orange.trn", { 9, 13, 10, 9, 13, 0 }, { 0, 0, 0, 0, 0, 0 }, "Familiar", 11, 15, 13, 20, 35, AI_BAT, MFLAG_SEARCH , 3, 50, 5, 4, 16, 0, 0, 0, 0, 35, MC_DEMON, RESIST_MAGIC | IMUNE_LIGHTNING , RESIST_MAGIC | IMUNE_LIGHTNING | IMUNE_NULL_40, 0x4000, 6, 448 }, + { 128, 1040, "Monsters\\GoatBow\\GoatB%c.CL2", FALSE, "Monsters\\GoatBow\\GoatB%c%i.WAV", FALSE, FALSE, NULL, { 12, 8, 16, 6, 20, 0 }, { 3, 0, 0, 0, 0, 0 }, "Flesh Clan", 6, 10, 8, 20, 35, AI_GOATBOW, MFLAG_CAN_OPEN_DOOR, 0, 35, 13, 1, 7, 0, 0, 0, 0, 35, MC_DEMON, 0 , 0 , 0, 3, 448 }, + { 128, 1040, "Monsters\\GoatBow\\GoatB%c.CL2", FALSE, "Monsters\\GoatBow\\GoatB%c%i.WAV", FALSE, TRUE, "Monsters\\GoatBow\\Beige.TRN", { 12, 8, 16, 6, 20, 0 }, { 3, 0, 0, 0, 0, 0 }, "Stone Clan", 8, 12, 10, 30, 40, AI_GOATBOW, MFLAG_CAN_OPEN_DOOR, 1, 40, 13, 2, 9, 0, 0, 0, 0, 35, MC_DEMON, RESIST_MAGIC | IMUNE_NULL_40, IMUNE_MAGIC | IMUNE_NULL_40, 0, 3, 645 }, + { 128, 1040, "Monsters\\GoatBow\\GoatB%c.CL2", FALSE, "Monsters\\GoatBow\\GoatB%c%i.WAV", FALSE, TRUE, "Monsters\\GoatBow\\Red.TRN", { 12, 8, 16, 6, 20, 0 }, { 3, 0, 0, 0, 0, 0 }, "Fire Clan", 10, 14, 12, 40, 50, AI_GOATBOW, MFLAG_SEARCH | MFLAG_CAN_OPEN_DOOR, 2, 45, 13, 3, 11, 0, 0, 0, 0, 35, MC_DEMON, RESIST_FIRE , IMUNE_FIRE , 0, 3, 822 }, + { 128, 1040, "Monsters\\GoatBow\\GoatB%c.CL2", FALSE, "Monsters\\GoatBow\\GoatB%c%i.WAV", FALSE, TRUE, "Monsters\\GoatBow\\Gray.TRN", { 12, 8, 16, 6, 20, 0 }, { 3, 0, 0, 0, 0, 0 }, "Night Clan", 12, 16, 14, 50, 65, AI_GOATBOW, MFLAG_SEARCH | MFLAG_CAN_OPEN_DOOR, 3, 50, 13, 4, 13, 15, 0, 0, 0, 40, MC_DEMON, RESIST_MAGIC | IMUNE_NULL_40, IMUNE_MAGIC | IMUNE_NULL_40, 0, 3, 1092 }, + { 128, 716, "Monsters\\Acid\\Acid%c.CL2", TRUE, "Monsters\\Acid\\Acid%c%i.WAV", TRUE, FALSE, NULL, { 13, 8, 12, 8, 16, 12 }, { 0, 0, 0, 0, 0, 0 }, "Acid Beast", 10, 14, 11, 40, 66, AI_ACID, 0 , 0, 40, 8, 4, 12, 25, 8, 0, 0, 30, MC_ANIMAL, IMUNE_ACID , IMUNE_MAGIC | IMUNE_ACID , 0, 3, 846 }, + { 128, 716, "Monsters\\Acid\\Acid%c.CL2", TRUE, "Monsters\\Acid\\Acid%c%i.WAV", TRUE, TRUE, "Monsters\\Acid\\AcidBlk.TRN", { 13, 8, 12, 8, 16, 12 }, { 0, 0, 0, 0, 0, 0 }, "Poison Spitter", 14, 18, 15, 60, 85, AI_ACID, 0 , 1, 45, 8, 4, 16, 25, 8, 0, 0, 30, MC_ANIMAL, IMUNE_ACID , IMUNE_MAGIC | IMUNE_ACID , 0, 3, 1248 }, + { 128, 716, "Monsters\\Acid\\Acid%c.CL2", TRUE, "Monsters\\Acid\\Acid%c%i.WAV", TRUE, TRUE, "Monsters\\Acid\\AcidB.TRN", { 13, 8, 12, 8, 16, 12 }, { 0, 0, 0, 0, 0, 0 }, "Pit Beast", 18, 22, 21, 80, 110, AI_ACID, 0 , 2, 55, 8, 8, 18, 35, 8, 0, 0, 35, MC_ANIMAL, RESIST_MAGIC | IMUNE_ACID , IMUNE_MAGIC | RESIST_LIGHTNING | IMUNE_ACID , 0, 3, 2060 }, + { 128, 716, "Monsters\\Acid\\Acid%c.CL2", TRUE, "Monsters\\Acid\\Acid%c%i.WAV", TRUE, TRUE, "Monsters\\Acid\\AcidR.TRN", { 13, 8, 12, 8, 16, 12 }, { 0, 0, 0, 0, 0, 0 }, "Lava Maw", 22, 27, 25, 100, 150, AI_ACID, 0 , 3, 65, 8, 10, 20, 40, 8, 0, 0, 35, MC_ANIMAL, RESIST_MAGIC | IMUNE_FIRE | IMUNE_ACID , IMUNE_MAGIC | IMUNE_FIRE | IMUNE_ACID , 0, 3, 2940 }, + { 160, 1010, "Monsters\\SKing\\SKing%c.CL2", TRUE, "Monsters\\SKing\\SKing%c%i.WAV", TRUE, TRUE, "Monsters\\SkelAxe\\White.TRN", { 8, 6, 16, 6, 16, 6 }, { 2, 0, 0, 0, 0, 2 }, "Skeleton King", 6, 6, 9, 140, 140, AI_SKELKING, MFLAG_SEARCH | MFLAG_CAN_OPEN_DOOR, 3, 60, 8, 6, 16, 0, 0, 0, 0, 70, MC_UNDEAD, IMUNE_MAGIC | RESIST_FIRE | RESIST_LIGHTNING | IMUNE_NULL_40, IMUNE_MAGIC | IMUNE_FIRE | IMUNE_LIGHTNING | IMUNE_NULL_40, 0x8001, 7, 570 }, + { 128, 980, "Monsters\\FatC\\FatC%c.CL2", FALSE, "Monsters\\FatC\\FatC%c%i.WAV", FALSE, FALSE, NULL, { 10, 8, 12, 6, 16, 0 }, { 1, 0, 0, 0, 0, 0 }, "The Butcher", 0, 0, 1, 320, 320, AI_CLEAVER, 0 , 3, 50, 8, 6, 12, 0, 0, 0, 0, 50, MC_DEMON, RESIST_FIRE | RESIST_LIGHTNING , RESIST_MAGIC | IMUNE_FIRE | IMUNE_LIGHTNING , 0x8000, 3, 710 }, + { 128, 1130, "Monsters\\Fat\\Fat%c.CL2", TRUE, "Monsters\\Fat\\Fat%c%i.WAV", FALSE, FALSE, NULL, { 8, 10, 15, 6, 16, 10 }, { 4, 0, 0, 0, 0, 0 }, "Overlord", 8, 12, 10, 60, 80, AI_FAT, 0 , 0, 55, 8, 6, 12, 0, 0, 0, 0, 55, MC_DEMON, 0 , RESIST_FIRE , 0, 3, 635 }, + { 128, 1130, "Monsters\\Fat\\Fat%c.CL2", TRUE, "Monsters\\Fat\\Fat%c%i.WAV", FALSE, TRUE, "Monsters\\Fat\\Blue.TRN", { 8, 10, 15, 6, 16, 10 }, { 4, 0, 0, 0, 0, 0 }, "Mud Man", 13, 17, 14, 100, 125, AI_FAT, MFLAG_SEARCH , 1, 60, 8, 8, 16, 0, 0, 0, 0, 60, MC_DEMON, 0 , IMUNE_LIGHTNING , 0, 3, 1165 }, + { 128, 1130, "Monsters\\Fat\\Fat%c.CL2", TRUE, "Monsters\\Fat\\Fat%c%i.WAV", FALSE, TRUE, "Monsters\\Fat\\FatB.TRN", { 8, 10, 15, 6, 16, 10 }, { 4, 0, 0, 0, 0, 0 }, "Toad Demon", 15, 19, 16, 135, 160, AI_FAT, MFLAG_SEARCH , 2, 70, 8, 8, 16, 40, 0, 8, 20, 65, MC_DEMON, IMUNE_MAGIC , IMUNE_MAGIC | RESIST_LIGHTNING , 0, 3, 1380 }, + { 128, 1130, "Monsters\\Fat\\Fat%c.CL2", TRUE, "Monsters\\Fat\\Fat%c%i.WAV", FALSE, TRUE, "Monsters\\Fat\\FatF.TRN", { 8, 10, 15, 6, 16, 10 }, { 4, 0, 0, 0, 0, 0 }, "Flayed One", 19, 23, 20, 160, 200, AI_FAT, MFLAG_SEARCH , 3, 85, 8, 10, 20, 0, 0, 0, 0, 70, MC_DEMON, RESIST_MAGIC | IMUNE_FIRE , IMUNE_MAGIC | IMUNE_FIRE , 0, 3, 2058 }, + { 160, 2420, "Monsters\\Worm\\Worm%c.CL2", FALSE, "Monsters\\Fat\\Fat%c%i.WAV", FALSE, FALSE, NULL, { 13, 13, 13, 11, 19, 0 }, { 0, 0, 0, 0, 0, 0 }, "Wyrm", 9, 13, 11, 60, 90, AI_SKELSD, 0 , 0, 40, 8, 4, 10, 0, 0, 0, 0, 25, MC_ANIMAL, RESIST_MAGIC , RESIST_MAGIC , 0, 3, 660 }, + { 160, 2420, "Monsters\\Worm\\Worm%c.CL2", FALSE, "Monsters\\Fat\\Fat%c%i.WAV", FALSE, FALSE, NULL, { 13, 13, 13, 11, 19, 0 }, { 0, 0, 0, 0, 0, 0 }, "Cave Slug", 11, 15, 13, 75, 110, AI_SKELSD, 0 , 1, 50, 8, 6, 13, 0, 0, 0, 0, 30, MC_ANIMAL, RESIST_MAGIC , RESIST_MAGIC , 0, 3, 994 }, + { 160, 2420, "Monsters\\Worm\\Worm%c.CL2", FALSE, "Monsters\\Fat\\Fat%c%i.WAV", FALSE, FALSE, NULL, { 13, 13, 13, 11, 19, 0 }, { 0, 0, 0, 0, 0, 0 }, "Devil Wyrm", 13, 17, 15, 100, 140, AI_SKELSD, 0 , 2, 55, 8, 8, 16, 0, 0, 0, 0, 30, MC_ANIMAL, RESIST_MAGIC | RESIST_FIRE , RESIST_MAGIC | RESIST_FIRE , 0, 3, 1320 }, + { 160, 2420, "Monsters\\Worm\\Worm%c.CL2", FALSE, "Monsters\\Fat\\Fat%c%i.WAV", FALSE, FALSE, NULL, { 13, 13, 13, 11, 19, 0 }, { 0, 0, 0, 0, 0, 0 }, "Devourer", 15, 19, 17, 125, 200, AI_SKELSD, 0 , 3, 60, 8, 10, 20, 0, 0, 0, 0, 35, MC_ANIMAL, RESIST_MAGIC | RESIST_FIRE | IMUNE_NULL_40, RESIST_MAGIC | RESIST_FIRE | IMUNE_NULL_40, 0, 3, 1827 }, + { 128, 1680, "Monsters\\Magma\\Magma%c.CL2", TRUE, "Monsters\\Magma\\Magma%c%i.WAV", TRUE, FALSE, NULL, { 8, 10, 14, 7, 18, 18 }, { 2, 0, 0, 0, 1, 0 }, "Magma Demon", 14, 17, 13, 50, 70, AI_MAGMA, MFLAG_SEARCH | MFLAG_CAN_OPEN_DOOR, 0, 45, 4, 2, 10, 50, 13, 0, 0, 45, MC_DEMON, IMUNE_MAGIC | RESIST_FIRE , IMUNE_MAGIC | IMUNE_FIRE , 0, 7, 1076 }, + { 128, 1680, "Monsters\\Magma\\Magma%c.CL2", TRUE, "Monsters\\Magma\\Magma%c%i.WAV", TRUE, TRUE, "Monsters\\Magma\\Yellow.TRN", { 8, 10, 14, 7, 18, 18 }, { 2, 0, 0, 0, 1, 0 }, "Blood Stone", 15, 19, 14, 55, 75, AI_MAGMA, MFLAG_SEARCH | MFLAG_CAN_OPEN_DOOR, 1, 50, 4, 2, 12, 50, 14, 0, 0, 45, MC_DEMON, IMUNE_MAGIC | IMUNE_FIRE , IMUNE_MAGIC | IMUNE_FIRE , 0, 7, 1309 }, + { 128, 1680, "Monsters\\Magma\\Magma%c.CL2", TRUE, "Monsters\\Magma\\Magma%c%i.WAV", TRUE, TRUE, "Monsters\\Magma\\Blue.TRN", { 8, 10, 14, 7, 18, 18 }, { 2, 0, 0, 0, 1, 0 }, "Hell Stone", 16, 20, 16, 60, 80, AI_MAGMA, MFLAG_SEARCH | MFLAG_CAN_OPEN_DOOR, 2, 60, 4, 2, 20, 60, 14, 0, 0, 50, MC_DEMON, IMUNE_MAGIC | IMUNE_FIRE , IMUNE_MAGIC | IMUNE_FIRE , 0, 7, 1680 }, + { 128, 1680, "Monsters\\Magma\\Magma%c.CL2", TRUE, "Monsters\\Magma\\Magma%c%i.WAV", TRUE, TRUE, "Monsters\\Magma\\Wierd.TRN", { 8, 10, 14, 7, 18, 18 }, { 2, 0, 0, 0, 1, 0 }, "Lava Lord", 17, 21, 18, 70, 85, AI_MAGMA, MFLAG_SEARCH | MFLAG_CAN_OPEN_DOOR, 3, 75, 4, 4, 24, 60, 14, 0, 0, 60, MC_DEMON, IMUNE_MAGIC | IMUNE_FIRE , IMUNE_MAGIC | IMUNE_FIRE , 0, 7, 2124 }, + { 160, 1630, "Monsters\\Rhino\\Rhino%c.CL2", TRUE, "Monsters\\Rhino\\Rhino%c%i.WAV", TRUE, FALSE, NULL, { 8, 8, 14, 6, 16, 6 }, { 2, 0, 0, 0, 0, 0 }, "Horned Demon", 12, 16, 13, 40, 80, AI_RHINO, MFLAG_SEARCH | MFLAG_CAN_OPEN_DOOR, 0, 60, 7, 2, 16, 100, 0, 5, 32, 40, MC_ANIMAL, 0 , RESIST_FIRE , 0, 7, 1172 }, + { 160, 1630, "Monsters\\Rhino\\Rhino%c.CL2", TRUE, "Monsters\\Rhino\\Rhino%c%i.WAV", TRUE, TRUE, "Monsters\\Rhino\\Orange.TRN", { 8, 8, 14, 6, 16, 6 }, { 2, 0, 0, 0, 0, 0 }, "Mud Runner", 14, 18, 15, 50, 90, AI_RHINO, MFLAG_SEARCH | MFLAG_CAN_OPEN_DOOR, 1, 70, 7, 6, 18, 100, 0, 12, 36, 45, MC_ANIMAL, 0 , RESIST_FIRE , 0, 7, 1404 }, + { 160, 1630, "Monsters\\Rhino\\Rhino%c.CL2", TRUE, "Monsters\\Rhino\\Rhino%c%i.WAV", TRUE, TRUE, "Monsters\\Rhino\\Blue.TRN", { 8, 8, 14, 6, 16, 6 }, { 2, 0, 0, 0, 0, 0 }, "Frost Charger", 16, 20, 17, 60, 100, AI_RHINO, MFLAG_SEARCH | MFLAG_CAN_OPEN_DOOR, 2, 80, 7, 8, 20, 100, 0, 20, 40, 50, MC_ANIMAL, IMUNE_MAGIC | RESIST_LIGHTNING , IMUNE_MAGIC | RESIST_LIGHTNING , 0, 7, 1720 }, + { 160, 1630, "Monsters\\Rhino\\Rhino%c.CL2", TRUE, "Monsters\\Rhino\\Rhino%c%i.WAV", TRUE, TRUE, "Monsters\\Rhino\\RhinoB.TRN", { 8, 8, 14, 6, 16, 6 }, { 2, 0, 0, 0, 0, 0 }, "Obsidian Lord", 18, 22, 19, 70, 110, AI_RHINO, MFLAG_SEARCH | MFLAG_CAN_OPEN_DOOR, 3, 90, 7, 10, 22, 100, 0, 20, 50, 55, MC_ANIMAL, IMUNE_MAGIC | RESIST_LIGHTNING , IMUNE_MAGIC | IMUNE_FIRE | IMUNE_LIGHTNING , 0, 7, 1809 }, + { 128, 1740, "Monsters\\Demskel\\Demskl%c.CL2", TRUE, "Monsters\\Thin\\Thin%c%i.WAV", TRUE, FALSE, "Monsters\\Thin\\Thinv3.TRN", { 10, 8, 20, 6, 24, 16 }, { 3, 0, 0, 0, 0, 0 }, "Bone Demon", 10, 14, 12, 70, 70, AI_STORM, 0 , 0, 60, 8, 6, 14, 12, 0, 0, 0, 50, MC_DEMON, IMUNE_MAGIC | IMUNE_NULL_40, IMUNE_MAGIC | IMUNE_NULL_40, 0, 7, 1344 }, + { 160, 1740, "Monsters\\Thin\\Thin%c.CL2", TRUE, "Monsters\\Thin\\Thin%c%i.WAV", TRUE, TRUE, "Monsters\\Thin\\Thinv3.TRN", { 8, 8, 18, 4, 17, 14 }, { 3, 0, 0, 0, 0, 0 }, "Red Death", 14, 18, 16, 96, 96, AI_STORM, 0 , 1, 75, 5, 10, 20, 0, 0, 0, 0, 60, MC_DEMON, IMUNE_MAGIC | IMUNE_FIRE , IMUNE_MAGIC | IMUNE_FIRE , 0, 7, 2168 }, + { 160, 1740, "Monsters\\Thin\\Thin%c.CL2", TRUE, "Monsters\\Thin\\Thin%c%i.WAV", TRUE, TRUE, "Monsters\\Thin\\Thinv3.TRN", { 8, 8, 18, 4, 17, 14 }, { 3, 0, 0, 0, 0, 0 }, "Litch Demon", 16, 20, 18, 110, 110, AI_STORM, 0 , 2, 80, 5, 10, 24, 0, 0, 0, 0, 45, MC_DEMON, IMUNE_MAGIC | IMUNE_LIGHTNING | IMUNE_NULL_40, IMUNE_MAGIC | IMUNE_LIGHTNING | IMUNE_NULL_40, 0, 7, 2736 }, + { 160, 1740, "Monsters\\Thin\\Thin%c.CL2", TRUE, "Monsters\\Thin\\Thin%c%i.WAV", TRUE, TRUE, "Monsters\\Thin\\Thinv3.TRN", { 8, 8, 18, 4, 17, 14 }, { 3, 0, 0, 0, 0, 0 }, "Undead Balrog", 20, 24, 22, 130, 130, AI_STORM, 0 , 3, 85, 5, 12, 30, 0, 0, 0, 0, 65, MC_DEMON, IMUNE_MAGIC | RESIST_FIRE | RESIST_LIGHTNING | IMUNE_NULL_40, IMUNE_MAGIC | RESIST_FIRE | RESIST_LIGHTNING | IMUNE_NULL_40, 0, 7, 3575 }, + { 128, 1460, "Monsters\\Fireman\\FireM%c.CL2", TRUE, "Monsters\\Acid\\Acid%c%i.WAV", FALSE, FALSE, NULL, { 14, 19, 20, 8, 14, 23 }, { 0, 0, 0, 0, 0, 0 }, "Incinerator", 14, 18, 16, 30, 45, AI_FIREMAN, 0 , 0, 75, 8, 8, 16, 0, 0, 0, 0, 25, MC_DEMON, IMUNE_MAGIC | IMUNE_FIRE , IMUNE_MAGIC | IMUNE_FIRE , 0, 3, 1888 }, + { 128, 1460, "Monsters\\Fireman\\FireM%c.CL2", TRUE, "Monsters\\Acid\\Acid%c%i.WAV", FALSE, FALSE, NULL, { 14, 19, 20, 8, 14, 23 }, { 0, 0, 0, 0, 0, 0 }, "Flame Lord", 16, 20, 18, 40, 55, AI_FIREMAN, 0 , 1, 75, 8, 10, 20, 0, 0, 0, 0, 25, MC_DEMON, IMUNE_MAGIC | IMUNE_FIRE , IMUNE_MAGIC | IMUNE_FIRE , 0, 3, 2250 }, + { 128, 1460, "Monsters\\Fireman\\FireM%c.CL2", TRUE, "Monsters\\Acid\\Acid%c%i.WAV", FALSE, FALSE, NULL, { 14, 19, 20, 8, 14, 23 }, { 0, 0, 0, 0, 0, 0 }, "Doom Fire", 18, 22, 20, 50, 65, AI_FIREMAN, 0 , 2, 80, 8, 12, 24, 0, 0, 0, 0, 30, MC_DEMON, IMUNE_MAGIC | IMUNE_FIRE | RESIST_LIGHTNING , IMUNE_MAGIC | IMUNE_FIRE | RESIST_LIGHTNING , 0, 3, 2740 }, + { 128, 1460, "Monsters\\Fireman\\FireM%c.CL2", TRUE, "Monsters\\Acid\\Acid%c%i.WAV", FALSE, FALSE, NULL, { 14, 19, 20, 8, 14, 23 }, { 0, 0, 0, 0, 0, 0 }, "Hell Burner", 20, 24, 22, 60, 80, AI_FIREMAN, 0 , 3, 85, 8, 15, 30, 0, 0, 0, 0, 30, MC_DEMON, IMUNE_MAGIC | IMUNE_FIRE | RESIST_LIGHTNING , IMUNE_MAGIC | IMUNE_FIRE | RESIST_LIGHTNING , 0, 3, 3355 }, + { 160, 1740, "Monsters\\Thin\\Thin%c.CL2", TRUE, "Monsters\\Thin\\Thin%c%i.WAV", TRUE, TRUE, "Monsters\\Thin\\Thinv3.TRN", { 8, 8, 18, 4, 17, 14 }, { 3, 0, 0, 0, 0, 0 }, "Red Storm", 17, 21, 18, 55, 110, AI_STORM, MFLAG_SEARCH | MFLAG_CAN_OPEN_DOOR, 0, 80, 5, 8, 18, 75, 8, 4, 16, 30, MC_DEMON, IMUNE_MAGIC | RESIST_LIGHTNING , IMUNE_MAGIC | IMUNE_LIGHTNING , 0, 7, 2160 }, + { 160, 1740, "Monsters\\Thin\\Thin%c.CL2", TRUE, "Monsters\\Thin\\Thin%c%i.WAV", TRUE, FALSE, NULL, { 8, 8, 18, 4, 17, 14 }, { 3, 0, 0, 0, 0, 0 }, "Storm Rider", 19, 23, 20, 60, 120, AI_STORM, MFLAG_SEARCH | MFLAG_CAN_OPEN_DOOR, 1, 80, 5, 8, 18, 80, 8, 4, 16, 30, MC_DEMON, RESIST_MAGIC | IMUNE_LIGHTNING , IMUNE_MAGIC | IMUNE_LIGHTNING , 0, 7, 2391 }, + { 160, 1740, "Monsters\\Thin\\Thin%c.CL2", TRUE, "Monsters\\Thin\\Thin%c%i.WAV", TRUE, TRUE, "Monsters\\Thin\\Thinv2.TRN", { 8, 8, 18, 4, 17, 14 }, { 3, 0, 0, 0, 0, 0 }, "Storm Lord", 21, 25, 22, 75, 135, AI_STORM, MFLAG_SEARCH | MFLAG_CAN_OPEN_DOOR, 2, 85, 5, 12, 24, 75, 8, 4, 16, 35, MC_DEMON, RESIST_MAGIC | IMUNE_LIGHTNING , IMUNE_MAGIC | IMUNE_LIGHTNING , 0, 7, 2775 }, + { 160, 1740, "Monsters\\Thin\\Thin%c.CL2", TRUE, "Monsters\\Thin\\Thin%c%i.WAV", TRUE , TRUE, "Monsters\\Thin\\Thinv1.TRN", { 8, 8, 18, 4, 17, 14 }, { 3, 0, 0, 0, 0, 0 }, "Maelstorm", 23, 27, 24, 90, 150, AI_STORM, MFLAG_SEARCH | MFLAG_CAN_OPEN_DOOR, 3, 90, 5, 12, 28, 75, 8, 4, 16, 40, MC_DEMON, RESIST_MAGIC | IMUNE_LIGHTNING | IMUNE_NULL_40, IMUNE_MAGIC | IMUNE_LIGHTNING | IMUNE_NULL_40, 0, 7, 3177 }, + { 128, 1650, "Monsters\\BigFall\\Fallg%c.CL2", TRUE, "Monsters\\BigFall\\Bfal%c%i.WAV", FALSE, FALSE, NULL, { 10, 8, 11, 8, 17, 0 }, { 0, 0, 0, 0, 2, 2 }, "Devil Kin Brute", 20, 20, 24, 160, 220, AI_SKELSD, MFLAG_SEARCH | MFLAG_CAN_OPEN_DOOR, 3, 100, 6, 18, 24, 0, 0, 0, 0, 75, MC_ANIMAL, 0 , 0 , 0, 6, 2000 }, + { 160, 1650, "Monsters\\Gargoyle\\Gargo%c.CL2", TRUE, "Monsters\\Gargoyle\\Gargo%c%i.WAV", FALSE, FALSE, NULL, { 14, 14, 14, 10, 18, 14 }, { 0, 0, 0, 0, 0, 2 }, "Winged-Demon", 8, 12, 9, 45, 60, AI_GARG, MFLAG_CAN_OPEN_DOOR, 0, 50, 7, 10, 16, 0, 0, 0, 0, 45, MC_DEMON, IMUNE_MAGIC | RESIST_FIRE | IMUNE_NULL_40, IMUNE_MAGIC | IMUNE_FIRE | IMUNE_NULL_40, 0, 6, 662 }, + { 160, 1650, "Monsters\\Gargoyle\\Gargo%c.CL2", TRUE, "Monsters\\Gargoyle\\Gargo%c%i.WAV", FALSE, TRUE, "Monsters\\Gargoyle\\GarE.TRN", { 14, 14, 14, 10, 18, 14 }, { 0, 0, 0, 0, 0, 2 }, "Gargoyle", 12, 16, 13, 60, 90, AI_GARG, MFLAG_CAN_OPEN_DOOR, 1, 65, 7, 10, 16, 0, 0, 0, 0, 45, MC_DEMON, IMUNE_MAGIC | RESIST_LIGHTNING | IMUNE_NULL_40, IMUNE_MAGIC | IMUNE_LIGHTNING | IMUNE_NULL_40, 0, 6, 1205 }, + { 160, 1650, "Monsters\\Gargoyle\\Gargo%c.CL2", TRUE, "Monsters\\Gargoyle\\Gargo%c%i.WAV", FALSE, TRUE, "Monsters\\Gargoyle\\GargBr.TRN", { 14, 14, 14, 10, 18, 14 }, { 0, 0, 0, 0, 0, 0 }, "Blood Claw", 16, 20, 19, 75, 125, AI_GARG, MFLAG_CAN_OPEN_DOOR, 2, 80, 7, 14, 22, 0, 0, 0, 0, 50, MC_DEMON, IMUNE_MAGIC | IMUNE_FIRE | IMUNE_NULL_40, IMUNE_MAGIC | IMUNE_FIRE | RESIST_LIGHTNING | IMUNE_NULL_40, 0, 6, 1873 }, + { 160, 1650, "Monsters\\Gargoyle\\Gargo%c.CL2", TRUE, "Monsters\\Gargoyle\\Gargo%c%i.WAV", FALSE, TRUE, "Monsters\\Gargoyle\\GargB.TRN", { 14, 14, 14, 10, 18, 14 }, { 0, 0, 0, 0, 0, 0 }, "Death Wing", 18, 22, 23, 90, 150, AI_GARG, MFLAG_CAN_OPEN_DOOR, 3, 95, 7, 16, 28, 0, 0, 0, 0, 60, MC_DEMON, IMUNE_MAGIC | IMUNE_LIGHTNING | IMUNE_NULL_40, IMUNE_MAGIC | RESIST_FIRE | IMUNE_LIGHTNING | IMUNE_NULL_40, 0, 6, 2278 }, + { 160, 2220, "Monsters\\Mega\\Mega%c.CL2", TRUE, "Monsters\\Mega\\Mega%c%i.WAV", TRUE, FALSE, NULL, { 6, 7, 14, 1, 24, 5 }, { 3, 0, 0, 0, 2, 0 }, "Slayer", 19, 23, 20, 120, 140, AI_MEGA, MFLAG_SEARCH | MFLAG_CAN_OPEN_DOOR, 0, 100, 8, 12, 20, 0, 3, 0, 0, 60, MC_DEMON, RESIST_MAGIC | IMUNE_FIRE , RESIST_MAGIC | IMUNE_FIRE , 0, 7, 2300 }, + { 160, 2220, "Monsters\\Mega\\Mega%c.CL2", TRUE, "Monsters\\Mega\\Mega%c%i.WAV", TRUE, TRUE, "Monsters\\Mega\\Guard.TRN", { 6, 7, 14, 1, 24, 5 }, { 3, 0, 0, 0, 2, 0 }, "Guardian", 21, 25, 22, 140, 160, AI_MEGA, MFLAG_SEARCH | MFLAG_CAN_OPEN_DOOR, 1, 110, 8, 14, 22, 0, 3, 0, 0, 65, MC_DEMON, RESIST_MAGIC | IMUNE_FIRE , RESIST_MAGIC | IMUNE_FIRE , 0, 7, 2714 }, + { 160, 2220, "Monsters\\Mega\\Mega%c.CL2", TRUE, "Monsters\\Mega\\Mega%c%i.WAV", TRUE, TRUE, "Monsters\\Mega\\Vtexl.TRN", { 6, 7, 14, 1, 24, 5 }, { 3, 0, 0, 0, 2, 0 }, "Vortex Lord", 23, 26, 24, 160, 180, AI_MEGA, MFLAG_SEARCH | MFLAG_CAN_OPEN_DOOR, 2, 120, 8, 18, 24, 0, 3, 0, 0, 70, MC_DEMON, RESIST_MAGIC | IMUNE_FIRE | IMUNE_NULL_40, RESIST_MAGIC | IMUNE_FIRE | RESIST_LIGHTNING | IMUNE_NULL_40, 0, 7, 3252 }, + { 160, 2220, "Monsters\\Mega\\Mega%c.CL2", TRUE, "Monsters\\Mega\\Mega%c%i.WAV", TRUE, TRUE, "Monsters\\Mega\\Balr.TRN", { 6, 7, 14, 1, 24, 5 }, { 3, 0, 0, 0, 2, 0 }, "Balrog", 25, 29, 26, 180, 200, AI_MEGA, MFLAG_SEARCH | MFLAG_CAN_OPEN_DOOR, 3, 130, 8, 22, 30, 0, 3, 0, 0, 75, MC_DEMON, RESIST_MAGIC | IMUNE_FIRE | IMUNE_NULL_40, RESIST_MAGIC | IMUNE_FIRE | RESIST_LIGHTNING | IMUNE_NULL_40, 0, 7, 3643 }, + { 160, 1270, "Monsters\\Snake\\Snake%c.CL2", FALSE, "Monsters\\Snake\\Snake%c%i.WAV", FALSE, FALSE, NULL, { 12, 11, 13, 5, 18, 0 }, { 2, 0, 0, 0, 1, 0 }, "Cave Viper", 20, 24, 21, 100, 150, AI_SNAKE, MFLAG_SEARCH , 0, 90, 8, 8, 20, 0, 0, 0, 0, 60, MC_DEMON, IMUNE_MAGIC , IMUNE_MAGIC , 0, 7, 2725 }, + { 160, 1270, "Monsters\\Snake\\Snake%c.CL2", FALSE, "Monsters\\Snake\\Snake%c%i.WAV", FALSE, TRUE, "Monsters\\Snake\\SnakR.TRN", { 12, 11, 13, 5, 18, 0 }, { 2, 0, 0, 0, 1, 0 }, "Fire Drake", 22, 26, 23, 120, 170, AI_SNAKE, MFLAG_SEARCH , 1, 105, 8, 12, 24, 0, 0, 0, 0, 65, MC_DEMON, IMUNE_MAGIC | RESIST_FIRE , IMUNE_MAGIC | IMUNE_FIRE , 0, 7, 3139 }, + { 160, 1270, "Monsters\\Snake\\Snake%c.CL2", FALSE, "Monsters\\Snake\\Snake%c%i.WAV", FALSE, TRUE, "Monsters\\Snake\\Snakg.TRN", { 12, 11, 13, 5, 18, 0 }, { 2, 0, 0, 0, 1, 0 }, "Gold Viper", 24, 27, 25, 140, 180, AI_SNAKE, MFLAG_SEARCH , 2, 120, 8, 15, 26, 0, 0, 0, 0, 70, MC_DEMON, IMUNE_MAGIC | RESIST_LIGHTNING , IMUNE_MAGIC | RESIST_LIGHTNING , 0, 7, 3540 }, + { 160, 1270, "Monsters\\Snake\\Snake%c.CL2", FALSE, "Monsters\\Snake\\Snake%c%i.WAV", FALSE, TRUE, "Monsters\\Snake\\Snakb.TRN", { 12, 11, 13, 5, 18, 0 }, { 2, 0, 0, 0, 1, 0 }, "Azure Drake", 28, 30, 27, 160, 200, AI_SNAKE, MFLAG_SEARCH , 3, 130, 8, 18, 30, 0, 0, 0, 0, 75, MC_DEMON, RESIST_FIRE | RESIST_LIGHTNING , IMUNE_MAGIC | RESIST_FIRE | IMUNE_LIGHTNING , 0, 7, 3791 }, + { 160, 2120, "Monsters\\Black\\Black%c.CL2", FALSE, "Monsters\\Black\\Black%c%i.WAV", FALSE, FALSE, NULL, { 8, 8, 16, 4, 24, 0 }, { 2, 0, 0, 0, 0, 0 }, "Black Knight", 23, 27, 24, 150, 150, AI_SKELSD, MFLAG_SEARCH , 0, 110, 8, 15, 20, 0, 0, 0, 0, 75, MC_DEMON, RESIST_MAGIC | RESIST_LIGHTNING | IMUNE_NULL_40, RESIST_MAGIC | IMUNE_LIGHTNING | IMUNE_NULL_40, 0, 7, 3360 }, + { 160, 2120, "Monsters\\Black\\Black%c.CL2", FALSE, "Monsters\\Black\\Black%c%i.WAV", FALSE, TRUE, "Monsters\\Black\\BlkKntRT.TRN", { 8, 8, 16, 4, 24, 0 }, { 2, 0, 0, 0, 0, 0 }, "Doom Guard", 25, 29, 26, 165, 165, AI_SKELSD, MFLAG_SEARCH , 0, 130, 8, 18, 25, 0, 0, 0, 0, 75, MC_DEMON, RESIST_MAGIC | RESIST_FIRE | IMUNE_NULL_40, RESIST_MAGIC | IMUNE_FIRE | IMUNE_NULL_40, 0, 7, 3650 }, + { 160, 2120, "Monsters\\Black\\Black%c.CL2", FALSE, "Monsters\\Black\\Black%c%i.WAV", FALSE, TRUE, "Monsters\\Black\\BlkKntBT.TRN", { 8, 8, 16, 4, 24, 0 }, { 2, 0, 0, 0, 0, 0 }, "Steel Lord", 27, 30, 28, 180, 180, AI_SKELSD, MFLAG_SEARCH , 1, 120, 8, 20, 30, 0, 0, 0, 0, 80, MC_DEMON, RESIST_MAGIC | IMUNE_FIRE | RESIST_LIGHTNING | IMUNE_NULL_40, IMUNE_MAGIC | IMUNE_FIRE | RESIST_LIGHTNING | IMUNE_NULL_40, 0, 7, 4252 }, + { 160, 2120, "Monsters\\Black\\Black%c.CL2", FALSE, "Monsters\\Black\\Black%c%i.WAV", FALSE, TRUE, "Monsters\\Black\\BlkKntBe.TRN", { 8, 8, 16, 4, 24, 0 }, { 2, 0, 0, 0, 0, 0 }, "Blood Knight", 24, 26, 30, 200, 200, AI_SKELSD, MFLAG_SEARCH , 1, 130, 8, 25, 35, 0, 0, 0, 0, 85, MC_DEMON, IMUNE_MAGIC | RESIST_FIRE | IMUNE_LIGHTNING | IMUNE_NULL_40, IMUNE_MAGIC | RESIST_FIRE | IMUNE_LIGHTNING | IMUNE_NULL_40, 0, 7, 5130 }, + { 96, 484, "Monsters\\Unrav\\Unrav%c.CL2", FALSE, "Monsters\\Acid\\Acid%c%i.WAV", FALSE, FALSE, NULL, { 10, 10, 12, 5, 16, 0 }, { 0, 0, 0, 0, 0, 0 }, "Unraveler", 26, 28, 25, 70, 150, AI_SKELSD, 0 , 0, 75, 7, 10, 20, 0, 0, 0, 0, 70, MC_UNDEAD, IMUNE_MAGIC | RESIST_FIRE | IMUNE_LIGHTNING | IMUNE_NULL_40, IMUNE_MAGIC | RESIST_FIRE | IMUNE_LIGHTNING | IMUNE_NULL_40, 0, 3, 3812 }, + { 96, 484, "Monsters\\Unrav\\Unrav%c.CL2", FALSE, "Monsters\\Acid\\Acid%c%i.WAV", FALSE, FALSE, NULL, { 10, 10, 12, 5, 16, 0 }, { 0, 0, 0, 0, 0, 0 }, "Hollow One", 28, 30, 27, 135, 240, AI_SKELSD, 0 , 1, 75, 7, 12, 24, 0, 0, 0, 0, 75, MC_UNDEAD, IMUNE_MAGIC | IMUNE_FIRE | RESIST_LIGHTNING | IMUNE_NULL_40, IMUNE_MAGIC | IMUNE_FIRE | RESIST_LIGHTNING | IMUNE_NULL_40, 0, 3, 4374 }, + { 96, 484, "Monsters\\Unrav\\Unrav%c.CL2", FALSE, "Monsters\\Acid\\Acid%c%i.WAV", FALSE, FALSE, NULL, { 10, 10, 12, 5, 16, 0 }, { 0, 0, 0, 0, 0, 0 }, "Pain Master", 27, 30, 29, 110, 200, AI_SKELSD, 0 , 2, 80, 7, 16, 30, 0, 0, 0, 0, 80, MC_UNDEAD, IMUNE_MAGIC | IMUNE_FIRE | RESIST_LIGHTNING | IMUNE_NULL_40, IMUNE_MAGIC | IMUNE_FIRE | RESIST_LIGHTNING | IMUNE_NULL_40, 0, 3, 5147 }, + { 96, 484, "Monsters\\Unrav\\Unrav%c.CL2", FALSE, "Monsters\\Acid\\Acid%c%i.WAV", FALSE, FALSE, NULL, { 10, 10, 12, 5, 16, 0 }, { 0, 0, 0, 0, 0, 0 }, "Reality Weaver", 28, 30, 30, 135, 240, AI_SKELSD, 0 , 3, 85, 7, 20, 35, 0, 0, 0, 0, 85, MC_UNDEAD, RESIST_MAGIC | IMUNE_FIRE | IMUNE_LIGHTNING | IMUNE_NULL_40, RESIST_MAGIC | IMUNE_FIRE | IMUNE_LIGHTNING | IMUNE_NULL_40, 0, 3, 5925 }, + { 128, 980, "Monsters\\Succ\\Scbs%c.CL2", FALSE, "Monsters\\Succ\\Scbs%c%i.WAV", FALSE, FALSE, NULL, { 14, 8, 16, 7, 24, 0 }, { 0, 0, 0, 0, 0, 0 }, "Succubus", 22, 26, 24, 120, 150, AI_SUCC, MFLAG_CAN_OPEN_DOOR, 0, 100, 10, 1, 20, 0, 0, 0, 0, 60, MC_DEMON, RESIST_MAGIC , IMUNE_MAGIC | RESIST_FIRE , 0, 3, 3696 }, + { 128, 980, "Monsters\\Succ\\Scbs%c.CL2", FALSE, "Monsters\\Succ\\Scbs%c%i.WAV", FALSE, TRUE, "Monsters\\Succ\\Succb.TRN", { 14, 8, 16, 7, 24, 0 }, { 0, 0, 0, 0, 0, 0 }, "Snow Witch", 25, 28, 26, 135, 175, AI_SUCC, MFLAG_CAN_OPEN_DOOR, 1, 110, 10, 1, 24, 0, 0, 0, 0, 65, MC_DEMON, RESIST_LIGHTNING | IMUNE_NULL_40, IMUNE_MAGIC | RESIST_LIGHTNING | IMUNE_NULL_40, 0, 3, 4084 }, + { 128, 980, "Monsters\\Succ\\Scbs%c.CL2", FALSE, "Monsters\\Succ\\Scbs%c%i.WAV", FALSE, TRUE, "Monsters\\Succ\\Succrw.TRN", { 14, 8, 16, 7, 24, 0 }, { 0, 0, 0, 0, 0, 0 }, "Hell Spawn", 27, 30, 28, 150, 200, AI_SUCC, MFLAG_SEARCH | MFLAG_CAN_OPEN_DOOR, 2, 115, 10, 1, 30, 0, 0, 0, 0, 75, MC_DEMON, RESIST_MAGIC | IMUNE_LIGHTNING , IMUNE_MAGIC | IMUNE_FIRE | RESIST_LIGHTNING , 0, 3, 4480 }, + { 128, 980, "Monsters\\Succ\\Scbs%c.CL2", FALSE, "Monsters\\Succ\\Scbs%c%i.WAV", FALSE, TRUE, "Monsters\\Succ\\Succbw.TRN", { 14, 8, 16, 7, 24, 0 }, { 0, 0, 0, 0, 0, 0 }, "Soul Burner", 28, 30, 30, 140, 225, AI_SUCC, MFLAG_SEARCH | MFLAG_CAN_OPEN_DOOR, 3, 120, 10, 1, 35, 0, 0, 0, 0, 85, MC_DEMON, RESIST_MAGIC | IMUNE_FIRE | RESIST_LIGHTNING , IMUNE_MAGIC | IMUNE_FIRE | IMUNE_LIGHTNING , 0, 3, 4644 }, + { 128, 2000, "Monsters\\Mage\\Mage%c.CL2", TRUE, "Monsters\\Mage\\Mage%c%i.WAV", FALSE, FALSE, NULL, { 12, 1, 20, 8, 28, 20 }, { 0, 0, 0, 0, 0, 0 }, "Counselor", 24, 26, 25, 70, 70, AI_COUNSLR, MFLAG_CAN_OPEN_DOOR, 0, 90, 8, 8, 20, 0, 0, 0, 0, 0, MC_DEMON, RESIST_MAGIC | RESIST_FIRE | RESIST_LIGHTNING , RESIST_MAGIC | RESIST_FIRE | RESIST_LIGHTNING , 0, 7, 4070 }, + { 128, 2000, "Monsters\\Mage\\Mage%c.CL2", TRUE, "Monsters\\Mage\\Mage%c%i.WAV", FALSE, TRUE, "Monsters\\Mage\\Cnselg.TRN", { 12, 1, 20, 8, 28, 20 }, { 0, 0, 0, 0, 0, 0 }, "Magistrate", 26, 28, 27, 85, 85, AI_COUNSLR, MFLAG_CAN_OPEN_DOOR, 1, 100, 8, 10, 24, 0, 0, 0, 0, 0, MC_DEMON, RESIST_MAGIC | IMUNE_FIRE | RESIST_LIGHTNING | IMUNE_NULL_40, IMUNE_MAGIC | IMUNE_FIRE | RESIST_LIGHTNING | IMUNE_NULL_40, 0, 7, 4478 }, + { 128, 2000, "Monsters\\Mage\\Mage%c.CL2", TRUE, "Monsters\\Mage\\Mage%c%i.WAV", FALSE, TRUE, "Monsters\\Mage\\Cnselgd.TRN", { 12, 1, 20, 8, 28, 20 }, { 0, 0, 0, 0, 0, 0 }, "Cabalist", 28, 30, 29, 120, 120, AI_COUNSLR, MFLAG_CAN_OPEN_DOOR, 2, 110, 8, 14, 30, 0, 0, 0, 0, 0, MC_DEMON, RESIST_MAGIC | RESIST_FIRE | IMUNE_LIGHTNING | IMUNE_NULL_40, IMUNE_MAGIC | RESIST_FIRE | IMUNE_LIGHTNING | IMUNE_NULL_40, 0, 7, 4929 }, + { 128, 2000, "Monsters\\Mage\\Mage%c.CL2", TRUE, "Monsters\\Mage\\Mage%c%i.WAV", FALSE, TRUE, "Monsters\\Mage\\Cnselbk.TRN", { 12, 1, 20, 8, 28, 20 }, { 0, 0, 0, 0, 0, 0 }, "Advocate", 30, 30, 30, 145, 145, AI_COUNSLR, MFLAG_CAN_OPEN_DOOR, 3, 120, 8, 15, 25, 0, 0, 0, 0, 0, MC_DEMON, IMUNE_MAGIC | RESIST_FIRE | IMUNE_LIGHTNING | IMUNE_NULL_40, IMUNE_MAGIC | IMUNE_FIRE | IMUNE_LIGHTNING | IMUNE_NULL_40, 0, 7, 4968 }, + { 96, 386, "Monsters\\Golem\\Golem%c.CL2", TRUE, "Monsters\\Golem\\Golm%c%i.WAV", FALSE, FALSE, NULL, { 0, 16, 12, 0, 12, 20 }, { 0, 0, 0, 0, 0, 0 }, "Golem", 0, 0, 12, 1, 1, AI_GOLUM, MFLAG_CAN_OPEN_DOOR, 0, 0, 7, 1, 1, 0, 0, 0, 0, 1, MC_DEMON, 0 , 0 , 0, 0, 0 }, + { 160, 2000, "Monsters\\Diablo\\Diablo%c.CL2", TRUE, "Monsters\\Diablo\\Diablo%c%i.WAV", TRUE, FALSE, NULL, { 16, 6, 16, 6, 16, 16 }, { 0, 0, 0, 0, 0, 0 }, "The Dark Lord", 50, 50, 30, 1666, 1666, AI_DIABLO, MFLAG_KNOCKBACK | MFLAG_SEARCH | MFLAG_CAN_OPEN_DOOR, 3, 220, 4, 30, 60, 0, 11, 0, 0, 70, MC_DEMON, IMUNE_MAGIC | RESIST_FIRE | RESIST_LIGHTNING | IMUNE_NULL_40, IMUNE_MAGIC | RESIST_FIRE | RESIST_LIGHTNING | IMUNE_NULL_40, 0, 7, 31666 }, + { 128, 1060, "Monsters\\DarkMage\\Dmage%c.CL2", TRUE, "Monsters\\DarkMage\\Dmag%c%i.WAV", FALSE, FALSE, NULL, { 6, 1, 21, 6, 23, 18 }, { 0, 0, 0, 0, 0, 0 }, "The Arch-Litch Malignus", 30, 30, 30, 160, 160, AI_COUNSLR, MFLAG_CAN_OPEN_DOOR, 3, 120, 8, 20, 40, 0, 0, 0, 0, 70, MC_DEMON, RESIST_MAGIC | RESIST_FIRE | RESIST_LIGHTNING | IMUNE_NULL_40, IMUNE_MAGIC | IMUNE_FIRE | IMUNE_LIGHTNING | IMUNE_NULL_40, 0, 7, 4968 } + // clang-format on +}; + +char MonstConvTbl[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, 27, 29, 30, + 31, 32, 34, 35, 36, 37, 38, 40, 39, 41, + 42, 43, 44, 45, 46, 47, 48, 49, 50, 52, + 53, 54, 55, 56, 57, 59, 58, 60, 61, 62, + 63, 64, 65, 66, 67, 68, 69, 70, 71, 0, + 0, 0, 0, 72, 73, 74, 75, 0, 0, 0, + 0, 77, 76, 78, 79, 81, 82, 83, 84, 85, + 86, 87, 88, 89, 90, 92, 91, 93, 94, 95, + 96, 97, 98, 99, 100, 101, 102, 103, 104, 105, + 106, 107, 108, 0, 110, 0, 109, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 80, 111 +}; + +unsigned char MonstAvailTbl[112] = { + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 0, 2, + 2, 2, 2, 0, 2, 2, 2, 2, 1, 1, + 1, 1, 2, 2, 2, 2, 2, 2, 2, 2, + 0, 0, 2, 2, 2, 2, 0, 0, 0, 0, + 2, 2, 2, 2, 2, 2, 2, 2, 0, 0, + 0, 0, 0, 0, 0, 0, 2, 2, 2, 2, + 0, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 0, 0, 0, + 0, 2, 2, 2, 2, 2, 2, 2, 2, 0, + 0, 0 +}; + +UniqMonstStruct UniqMonst[98] = { + // clang-format off + // mtype, mName, mTrnName, mlevel, mmaxhp, mAi, mint, mMinDamage, mMaxDamage, mMagicRes, mUnqAttr, mUnqVar1, mUnqVar2, mtalkmsg + { MT_NGOATMC, "Gharbad the Weak", "BSDB", 4, 120, AI_GARBUD, 3, 8, 16, IMUNE_LIGHTNING | IMUNE_NULL_40, 0, 0, 0, QUEST_GARBUD1 }, + { MT_SKING, "Skeleton King", "GENRL", 0, 240, AI_SKELKING, 3, 6, 16, IMUNE_MAGIC | RESIST_FIRE | RESIST_LIGHTNING | IMUNE_NULL_40, 1, 0, 0, 0 }, + { MT_COUNSLR, "Zhar the Mad", "GENERAL", 8, 360, AI_ZHAR, 3, 16, 40, IMUNE_MAGIC | RESIST_FIRE | RESIST_LIGHTNING , 0, 0, 0, QUEST_ZHAR1 }, + { MT_BFALLSP, "Snotspill", "BNG", 4, 220, AI_SNOTSPIL, 3, 10, 18, RESIST_LIGHTNING , 0, 0, 0, QUEST_BANNER10 }, + { MT_ADVOCATE, "Arch-Bishop Lazarus", "GENERAL", 0, 600, AI_LAZURUS, 3, 30, 50, IMUNE_MAGIC | RESIST_FIRE | RESIST_LIGHTNING | IMUNE_NULL_40, 0, 0, 0, QUEST_VILE13 }, + { MT_HLSPWN, "Red Vex", "REDV", 0, 400, AI_LAZHELP, 3, 30, 50, IMUNE_MAGIC | RESIST_FIRE | IMUNE_NULL_40, 0, 0, 0, QUEST_VILE13 }, + { MT_HLSPWN, "BlackJade", "BLKJD", 0, 400, AI_LAZHELP, 3, 30, 50, IMUNE_MAGIC | RESIST_LIGHTNING | IMUNE_NULL_40, 0, 0, 0, QUEST_VILE13 }, + { MT_RBLACK, "Lachdanan", "BHKA", 14, 500, AI_LACHDAN, 3, 0, 0, 0 , 0, 0, 0, QUEST_VEIL9 }, + { MT_BTBLACK, "Warlord of Blood", "GENERAL", 13, 850, AI_WARLORD, 3, 35, 50, IMUNE_MAGIC | IMUNE_FIRE | IMUNE_LIGHTNING | IMUNE_NULL_40, 0, 0, 0, QUEST_WARLRD9 }, + { MT_CLEAVER, "The Butcher", "GENRL", 0, 220, AI_CLEAVER, 3, 6, 12, RESIST_FIRE | RESIST_LIGHTNING | IMUNE_NULL_40, 0, 0, 0, 0 }, + { MT_TSKELAX, "Bonehead Keenaxe", "BHKA", 2, 91, AI_SKELSD, 2, 4, 10, IMUNE_MAGIC | IMUNE_NULL_40, 7, 100, 0, 0 }, + { MT_RFALLSD, "Bladeskin the Slasher", "BSTS", 2, 51, AI_FALLEN, 0, 6, 18, RESIST_FIRE , 11, 45, 0, 0 }, + { MT_NZOMBIE, "Soulpus", "GENERAL", 2, 133, AI_ZOMBIE, 0, 4, 8, RESIST_FIRE | RESIST_LIGHTNING , 0, 0, 0, 0 }, + { MT_RFALLSP, "Pukerat the Unclean", "PTU", 2, 77, AI_FALLEN, 3, 1, 5, RESIST_FIRE , 0, 0, 0, 0 }, + { MT_WSKELAX, "Boneripper", "BR", 2, 54, AI_BAT, 0, 6, 15, IMUNE_MAGIC | IMUNE_FIRE | IMUNE_NULL_40, 3, 0, 0, 0 }, + { MT_NZOMBIE, "Rotfeast the Hungry", "ETH", 2, 85, AI_SKELSD, 3, 4, 12, IMUNE_MAGIC | IMUNE_NULL_40, 3, 0, 0, 0 }, + { MT_DFALLSD, "Gutshank the Quick", "GTQ", 3, 66, AI_BAT, 2, 6, 16, RESIST_FIRE , 3, 0, 0, 0 }, + { MT_TSKELSD, "Brokenhead Bangshield", "BHBS", 3, 108, AI_SKELSD, 3, 12, 20, IMUNE_MAGIC | RESIST_LIGHTNING | IMUNE_NULL_40, 3, 0, 0, 0 }, + { MT_YFALLSP, "Bongo", "BNG", 3, 178, AI_FALLEN, 3, 9, 21, 0 , 3, 0, 0, 0 }, + { MT_BZOMBIE, "Rotcarnage", "RCRN", 3, 102, AI_ZOMBIE, 3, 9, 24, IMUNE_MAGIC | RESIST_LIGHTNING | IMUNE_NULL_40, 11, 45, 0, 0 }, + { MT_NSCAV, "Shadowbite", "SHBT", 2, 60, AI_SKELSD, 3, 3, 20, IMUNE_FIRE , 3, 0, 0, 0 }, + { MT_WSKELBW, "Deadeye", "DE", 2, 49, AI_GOATBOW, 0, 6, 9, IMUNE_MAGIC | RESIST_FIRE | IMUNE_NULL_40, 0, 0, 0, 0 }, + { MT_RSKELAX, "Madeye the Dead", "MTD", 4, 75, AI_BAT, 0, 9, 21, IMUNE_MAGIC | IMUNE_FIRE , 11, 30, 0, 0 }, + { MT_BSCAV, "El Chupacabras", "GENERAL", 3, 120, AI_GOATMC, 0, 10, 18, RESIST_FIRE , 3, 30, 0, 0 }, + { MT_TSKELBW, "Skullfire", "SKFR", 3, 125, AI_GOATBOW, 1, 6, 10, IMUNE_FIRE , 0, 100, 0, 0 }, + { MT_SNEAK, "Warpskull", "TSPO", 3, 117, AI_SNEAK, 2, 6, 18, RESIST_FIRE | RESIST_LIGHTNING , 3, 0, 0, 0 }, + { MT_GZOMBIE, "Goretongue", "PMR", 3, 156, AI_SKELSD, 1, 15, 30, IMUNE_MAGIC | IMUNE_NULL_40, 0, 0, 0, 0 }, + { MT_WSCAV, "Pulsecrawler", "BHKA", 4, 150, AI_SCAV, 0, 16, 20, IMUNE_FIRE | RESIST_LIGHTNING , 11, 45, 0, 0 }, + { MT_BLINK, "Moonbender", "GENERAL", 4, 135, AI_BAT, 0, 9, 27, IMUNE_FIRE , 3, 0, 0, 0 }, + { MT_BLINK, "Wrathraven", "GENERAL", 5, 135, AI_BAT, 2, 9, 22, IMUNE_FIRE , 3, 0, 0, 0 }, + { MT_YSCAV, "Spineeater", "GENERAL", 4, 180, AI_SCAV, 1, 18, 25, IMUNE_LIGHTNING | IMUNE_NULL_40, 3, 0, 0, 0 }, + { MT_RSKELBW, "Blackash the Burning", "BASHTB", 4, 120, AI_GOATBOW, 0, 6, 16, IMUNE_MAGIC | IMUNE_FIRE , 3, 0, 0, 0 }, + { MT_BFALLSD, "Shadowcrow", "GENERAL", 5, 270, AI_SNEAK, 2, 12, 25, 0 , 3, 0, 0, 0 }, + { MT_LRDSAYTR, "Blightstone the Weak", "BHKA", 4, 360, AI_SKELSD, 0, 4, 12, IMUNE_MAGIC | RESIST_LIGHTNING , 7, 70, 0, 0 }, + { MT_FAT, "Bilefroth the Pit Master", "BFTP", 6, 210, AI_BAT, 1, 16, 23, IMUNE_MAGIC | IMUNE_FIRE | RESIST_LIGHTNING , 3, 0, 0, 0 }, + { MT_NGOATBW, "Bloodskin Darkbow", "BSDB", 5, 207, AI_GOATBOW, 0, 3, 16, RESIST_FIRE | RESIST_LIGHTNING , 11, 55, 0, 0 }, + { MT_GLOOM, "Foulwing", "DB", 5, 246, AI_RHINO, 3, 12, 28, RESIST_FIRE , 3, 0, 0, 0 }, + { MT_XSKELSD, "Shadowdrinker", "SHDR", 5, 300, AI_SNEAK, 1, 18, 26, IMUNE_MAGIC | RESIST_FIRE | RESIST_LIGHTNING | IMUNE_NULL_40, 8, 45, 0, 0 }, + { MT_UNSEEN, "Hazeshifter", "BHKA", 5, 285, AI_SNEAK, 3, 18, 30, IMUNE_LIGHTNING | IMUNE_NULL_40, 3, 0, 0, 0 }, + { MT_NACID, "Deathspit", "BFDS", 6, 303, AI_ACIDUNIQ, 0, 12, 32, RESIST_FIRE | RESIST_LIGHTNING , 3, 0, 0, 0 }, + { MT_RGOATMC, "Bloodgutter", "BGBL", 6, 315, AI_BAT, 1, 24, 34, IMUNE_FIRE , 3, 0, 0, 0 }, + { MT_BGOATMC, "Deathshade Fleshmaul", "DSFM", 6, 276, AI_RHINO, 0, 12, 24, IMUNE_MAGIC | RESIST_FIRE , 8, 65, 0, 0 }, + { MT_WYRM, "Warmaggot the Mad", "GENERAL", 6, 246, AI_BAT, 3, 15, 30, RESIST_LIGHTNING , 3, 0, 0, 0 }, + { MT_STORM, "Glasskull the Jagged", "BHKA", 7, 354, AI_STORM, 0, 18, 30, IMUNE_MAGIC | IMUNE_FIRE | IMUNE_NULL_40, 3, 0, 0, 0 }, + { MT_RGOATBW, "Blightfire", "BLF", 7, 321, AI_SUCC, 2, 13, 21, IMUNE_FIRE , 3, 0, 0, 0 }, + { MT_GARGOYLE, "Nightwing the Cold", "GENERAL", 7, 342, AI_BAT, 1, 18, 26, IMUNE_MAGIC | RESIST_LIGHTNING | IMUNE_NULL_40, 3, 0, 0, 0 }, + { MT_GGOATBW, "Gorestone", "GENERAL", 7, 303, AI_GOATBOW, 1, 15, 28, RESIST_LIGHTNING | IMUNE_NULL_40, 7, 70, 0, 0 }, + { MT_BMAGMA, "Bronzefist Firestone", "GENERAL", 8, 360, AI_MAGMA, 0, 30, 36, IMUNE_MAGIC | RESIST_FIRE , 3, 0, 0, 0 }, + { MT_INCIN, "Wrathfire the Doomed", "WFTD", 8, 270, AI_SKELSD, 2, 20, 30, IMUNE_MAGIC | RESIST_FIRE | RESIST_LIGHTNING , 3, 0, 0, 0 }, + { MT_NMAGMA, "Firewound the Grim", "BHKA", 8, 303, AI_MAGMA, 0, 18, 22, IMUNE_MAGIC | RESIST_FIRE , 3, 0, 0, 0 }, + { MT_MUDMAN, "Baron Sludge", "BSM", 8, 315, AI_SNEAK, 3, 25, 34, IMUNE_MAGIC | RESIST_FIRE | RESIST_LIGHTNING | IMUNE_NULL_40, 11, 75, 0, 0 }, + { MT_GGOATMC, "Blighthorn Steelmace", "BHSM", 7, 250, AI_RHINO, 0, 20, 28, RESIST_LIGHTNING , 11, 45, 0, 0 }, + { MT_RACID, "Chaoshowler", "GENERAL", 8, 240, AI_ACIDUNIQ, 0, 12, 20, 0 , 3, 0, 0, 0 }, + { MT_REDDTH, "Doomgrin the Rotting", "GENERAL", 8, 405, AI_STORM, 3, 25, 50, IMUNE_MAGIC | RESIST_FIRE | RESIST_LIGHTNING | IMUNE_NULL_40, 3, 0, 0, 0 }, + { MT_FLAMLRD, "Madburner", "GENERAL", 9, 270, AI_STORM, 0, 20, 40, IMUNE_MAGIC | IMUNE_FIRE | IMUNE_LIGHTNING , 3, 0, 0, 0 }, + { MT_LTCHDMN, "Bonesaw the Litch", "GENERAL", 9, 495, AI_STORM, 2, 30, 55, IMUNE_MAGIC | RESIST_FIRE | RESIST_LIGHTNING | IMUNE_NULL_40, 3, 0, 0, 0 }, + { MT_MUDRUN, "Breakspine", "GENERAL", 9, 351, AI_RHINO, 0, 25, 34, RESIST_FIRE , 3, 0, 0, 0 }, + { MT_REDDTH, "Devilskull Sharpbone", "GENERAL", 9, 444, AI_STORM, 1, 25, 40, IMUNE_FIRE , 3, 0, 0, 0 }, + { MT_STORM, "Brokenstorm", "GENERAL", 9, 411, AI_STORM, 2, 25, 36, IMUNE_LIGHTNING , 3, 0, 0, 0 }, + { MT_RSTORM, "Stormbane", "GENERAL", 9, 555, AI_STORM, 3, 30, 30, IMUNE_LIGHTNING , 3, 0, 0, 0 }, + { MT_TOAD, "Oozedrool", "GENERAL", 9, 483, AI_FAT, 3, 25, 30, RESIST_LIGHTNING , 3, 0, 0, 0 }, + { MT_BLOODCLW, "Goldblight of the Flame", "GENERAL", 10, 405, AI_GARG, 0, 15, 35, IMUNE_MAGIC | IMUNE_FIRE , 11, 80, 0, 0 }, + { MT_OBLORD, "Blackstorm", "GENERAL", 10, 525, AI_RHINO, 3, 20, 40, IMUNE_MAGIC | IMUNE_LIGHTNING , 11, 90, 0, 0 }, + { MT_RACID, "Plaguewrath", "GENERAL", 10, 450, AI_ACIDUNIQ, 2, 20, 30, IMUNE_MAGIC | RESIST_FIRE | IMUNE_NULL_40, 3, 0, 0, 0 }, + { MT_RSTORM, "The Flayer", "GENERAL", 10, 501, AI_STORM, 1, 20, 35, RESIST_MAGIC | RESIST_FIRE | IMUNE_LIGHTNING | IMUNE_NULL_40, 3, 0, 0, 0 }, + { MT_FROSTC, "Bluehorn", "GENERAL", 11, 477, AI_RHINO, 1, 25, 30, IMUNE_MAGIC | RESIST_FIRE , 11, 90, 0, 0 }, + { MT_HELLBURN, "Warpfire Hellspawn", "GENERAL", 11, 525, AI_FIREMAN, 3, 10, 40, RESIST_MAGIC | IMUNE_FIRE , 3, 0, 0, 0 }, + { MT_NSNAKE, "Fangspeir", "GENERAL", 11, 444, AI_SKELSD, 1, 15, 32, IMUNE_FIRE | IMUNE_NULL_40, 3, 0, 0, 0 }, + { MT_UDEDBLRG, "Festerskull", "GENERAL", 11, 600, AI_STORM, 2, 15, 30, IMUNE_MAGIC | IMUNE_NULL_40, 3, 0, 0, 0 }, + { MT_NBLACK, "Lionskull the Bent", "GENERAL", 12, 525, AI_SKELSD, 2, 25, 25, IMUNE_MAGIC | IMUNE_FIRE | IMUNE_LIGHTNING | IMUNE_NULL_40, 3, 0, 0, 0 }, + { MT_COUNSLR, "Blacktongue", "GENERAL", 12, 360, AI_COUNSLR, 3, 15, 30, RESIST_FIRE | IMUNE_NULL_40, 3, 0, 0, 0 }, + { MT_DEATHW, "Viletouch", "GENERAL", 12, 525, AI_GARG, 3, 20, 40, IMUNE_LIGHTNING | IMUNE_NULL_40, 3, 0, 0, 0 }, + { MT_RSNAKE, "Viperflame", "GENERAL", 12, 570, AI_SKELSD, 1, 25, 35, IMUNE_FIRE | RESIST_LIGHTNING , 3, 0, 0, 0 }, + { MT_BSNAKE, "Fangskin", "BHKA", 14, 681, AI_SKELSD, 2, 15, 50, IMUNE_MAGIC | RESIST_LIGHTNING , 3, 0, 0, 0 }, + { MT_SUCCUBUS, "Witchfire the Unholy", "GENERAL", 12, 444, AI_SUCC, 3, 10, 20, IMUNE_MAGIC | IMUNE_FIRE | RESIST_LIGHTNING , 3, 0, 0, 0 }, + { MT_BALROG, "Blackskull", "BHKA", 13, 750, AI_SKELSD, 3, 25, 40, IMUNE_MAGIC | RESIST_LIGHTNING , 3, 0, 0, 0 }, + { MT_UNRAV, "Soulslash", "GENERAL", 12, 450, AI_SKELSD, 0, 25, 25, IMUNE_MAGIC | IMUNE_NULL_40, 3, 0, 0, 0 }, + { MT_VTEXLRD, "Windspawn", "GENERAL", 12, 711, AI_SKELSD, 1, 35, 40, IMUNE_MAGIC | IMUNE_FIRE , 3, 0, 0, 0 }, + { MT_GSNAKE, "Lord of the Pit", "GENERAL", 13, 762, AI_SKELSD, 2, 25, 42, RESIST_FIRE | IMUNE_NULL_40, 3, 0, 0, 0 }, + { MT_RTBLACK, "Rustweaver", "GENERAL", 13, 400, AI_SKELSD, 3, 1, 60, IMUNE_MAGIC | IMUNE_FIRE | IMUNE_LIGHTNING | IMUNE_NULL_40, 0, 0, 0, 0 }, + { MT_HOLOWONE, "Howlingire the Shade", "GENERAL", 13, 450, AI_SKELSD, 2, 40, 75, RESIST_FIRE | RESIST_LIGHTNING , 3, 0, 0, 0 }, + { MT_MAEL, "Doomcloud", "GENERAL", 13, 612, AI_STORM, 1, 1, 60, RESIST_FIRE | IMUNE_LIGHTNING , 0, 0, 0, 0 }, + { MT_PAINMSTR, "Bloodmoon Soulfire", "GENERAL", 13, 684, AI_SKELSD, 1, 15, 40, IMUNE_MAGIC | RESIST_FIRE | RESIST_LIGHTNING , 3, 0, 0, 0 }, + { MT_SNOWWICH, "Witchmoon", "GENERAL", 13, 310, AI_SUCC, 3, 30, 40, RESIST_LIGHTNING , 0, 0, 0, 0 }, + { MT_VTEXLRD, "Gorefeast", "GENERAL", 13, 771, AI_SKELSD, 3, 20, 55, RESIST_FIRE | IMUNE_NULL_40, 0, 0, 0, 0 }, + { MT_RTBLACK, "Graywar the Slayer", "GENERAL", 14, 672, AI_SKELSD, 1, 30, 50, RESIST_LIGHTNING | IMUNE_NULL_40, 0, 0, 0, 0 }, + { MT_MAGISTR, "Dreadjudge", "GENERAL", 14, 540, AI_COUNSLR, 1, 30, 40, IMUNE_MAGIC | RESIST_FIRE | RESIST_LIGHTNING , 3, 0, 0, 0 }, + { MT_HLSPWN, "Stareye the Witch", "GENERAL", 14, 726, AI_SUCC, 2, 30, 50, IMUNE_FIRE , 0, 0, 0, 0 }, + { MT_BTBLACK, "Steelskull the Hunter", "GENERAL", 14, 831, AI_SKELSD, 3, 40, 50, RESIST_LIGHTNING | IMUNE_NULL_40, 0, 0, 0, 0 }, + { MT_RBLACK, "Sir Gorash", "GENERAL", 16, 1050, AI_SKELSD, 1, 20, 60, IMUNE_NULL_40, 0, 0, 0, 0 }, + { MT_CABALIST, "The Vizier", "GENERAL", 15, 850, AI_COUNSLR, 2, 25, 40, IMUNE_FIRE , 3, 0, 0, 0 }, + { MT_REALWEAV, "Zamphir", "GENERAL", 15, 891, AI_SKELSD, 2, 30, 50, IMUNE_MAGIC | RESIST_FIRE | RESIST_LIGHTNING | IMUNE_NULL_40, 3, 0, 0, 0 }, + { MT_HLSPWN, "Bloodlust", "GENERAL", 15, 825, AI_SUCC, 1, 20, 55, IMUNE_MAGIC | IMUNE_LIGHTNING | IMUNE_NULL_40, 0, 0, 0, 0 }, + { MT_HLSPWN, "Webwidow", "GENERAL", 16, 774, AI_SUCC, 1, 20, 50, IMUNE_MAGIC | IMUNE_FIRE | IMUNE_NULL_40, 0, 0, 0, 0 }, + { MT_SOLBRNR, "Fleshdancer", "GENERAL", 16, 999, AI_SUCC, 3, 30, 50, IMUNE_MAGIC | RESIST_FIRE | IMUNE_NULL_40, 0, 0, 0, 0 }, + { MT_OBLORD, "Grimspike", "GENERAL", 19, 534, AI_SNEAK, 1, 25, 40, IMUNE_MAGIC | RESIST_FIRE | IMUNE_NULL_40, 3, 0, 0, 0 }, + { MT_STORML, "Doomlock", "GENERAL", 28, 534, AI_SNEAK, 1, 35, 55, IMUNE_MAGIC | RESIST_FIRE | RESIST_LIGHTNING | IMUNE_NULL_40, 3, 0, 0, 0 }, + { -1, NULL, NULL, 0, 0, 0, 0, 0, 0, 0 , 0, 0, 0, 0 } + // clang-format on +}; diff --git a/Source/monstdat.h b/Source/monstdat.h index c15d9934f3a..b61679b2e91 100644 --- a/Source/monstdat.h +++ b/Source/monstdat.h @@ -1,10 +1,10 @@ -//HEADER_GOES_HERE -#ifndef __MONSTDAT_H__ -#define __MONSTDAT_H__ - -extern MonsterData monsterdata[112]; -extern char MonstConvTbl[128]; -extern unsigned char MonstAvailTbl[112]; -extern UniqMonstStruct UniqMonst[98]; - -#endif /* __MONSTDAT_H__ */ +//HEADER_GOES_HERE +#ifndef __MONSTDAT_H__ +#define __MONSTDAT_H__ + +extern MonsterData monsterdata[112]; +extern char MonstConvTbl[128]; +extern unsigned char MonstAvailTbl[112]; +extern UniqMonstStruct UniqMonst[98]; + +#endif /* __MONSTDAT_H__ */ diff --git a/Source/objdat.cpp b/Source/objdat.cpp index 7437df7ffad..d21bb8939e3 100644 --- a/Source/objdat.cpp +++ b/Source/objdat.cpp @@ -1,282 +1,282 @@ -#include "diablo.h" - -int ObjTypeConv[113] = { - 0, - 4, - 20, - 21, - 22, - 24, - 11, - 12, - 13, - 0, - 0, - 0, - 0, - 0, - 25, - 41, - 26, - 0, - 8, - 9, - 10, - 80, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 49, - 0, - 0, - 0, - 0, - 0, - 84, - 85, - 3, - 14, - 15, - 16, - 17, - 18, - 19, - 0, - 0, - 0, - 0, - 0, - 0, - 28, - 0, - 53, - 54, - 36, - 37, - 38, - 39, - 40, - 0, - 0, - 0, - 0, - 0, - 27, - 0, - 0, - 0, - 0, - 29, - 30, - 31, - 32, - 33, - 34, - 35, - 5, - 5, - 5, - 6, - 6, - 6, - 7, - 7, - 7, - 0, - 0, - 0, - 0, - 0, - 73, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 83, - 0, - 0, - 89, - 90, - 47, - 46, - 94 -}; - -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 } - // clang-format on -}; - -// might be const -char *ObjMasterLoadList[56] = { - "L1Braz", - "L1Doors", - "Lever", - "Chest1", - "Chest2", - "Banner", - "SkulPile", - "SkulFire", - "SkulStik", - "CruxSk1", - "CruxSk2", - "CruxSk3", - "Book1", - "Book2", - "Rockstan", - "Angel", - "Chest3", - "Burncros", - "Candle2", - "Nude2", - "Switch4", - "TNudeM", - "TNudeW", - "TSoul", - "L2Doors", - "WTorch4", - "WTorch3", - "Sarc", - "Flame1", - "Prsrplt1", - "Traphole", - "MiniWatr", - "WTorch2", - "WTorch1", - "BCase", - "BShelf", - "WeapStnd", - "Barrel", - "Barrelex", - "LShrineG", - "RShrineG", - "Bloodfnt", - "Decap", - "Pedistl", - "L3Doors", - "PFountn", - "Armstand", - "Goatshrn", - "Cauldren", - "MFountn", - "TFountn", - "Altboy", - "Mcirl", - "Bkslbrnt", - "Mushptch", - "LzStand" -}; +#include "diablo.h" + +int ObjTypeConv[113] = { + 0, + 4, + 20, + 21, + 22, + 24, + 11, + 12, + 13, + 0, + 0, + 0, + 0, + 0, + 25, + 41, + 26, + 0, + 8, + 9, + 10, + 80, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 49, + 0, + 0, + 0, + 0, + 0, + 84, + 85, + 3, + 14, + 15, + 16, + 17, + 18, + 19, + 0, + 0, + 0, + 0, + 0, + 0, + 28, + 0, + 53, + 54, + 36, + 37, + 38, + 39, + 40, + 0, + 0, + 0, + 0, + 0, + 27, + 0, + 0, + 0, + 0, + 29, + 30, + 31, + 32, + 33, + 34, + 35, + 5, + 5, + 5, + 6, + 6, + 6, + 7, + 7, + 7, + 0, + 0, + 0, + 0, + 0, + 73, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 83, + 0, + 0, + 89, + 90, + 47, + 46, + 94 +}; + +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 } + // clang-format on +}; + +// might be const +char *ObjMasterLoadList[56] = { + "L1Braz", + "L1Doors", + "Lever", + "Chest1", + "Chest2", + "Banner", + "SkulPile", + "SkulFire", + "SkulStik", + "CruxSk1", + "CruxSk2", + "CruxSk3", + "Book1", + "Book2", + "Rockstan", + "Angel", + "Chest3", + "Burncros", + "Candle2", + "Nude2", + "Switch4", + "TNudeM", + "TNudeW", + "TSoul", + "L2Doors", + "WTorch4", + "WTorch3", + "Sarc", + "Flame1", + "Prsrplt1", + "Traphole", + "MiniWatr", + "WTorch2", + "WTorch1", + "BCase", + "BShelf", + "WeapStnd", + "Barrel", + "Barrelex", + "LShrineG", + "RShrineG", + "Bloodfnt", + "Decap", + "Pedistl", + "L3Doors", + "PFountn", + "Armstand", + "Goatshrn", + "Cauldren", + "MFountn", + "TFountn", + "Altboy", + "Mcirl", + "Bkslbrnt", + "Mushptch", + "LzStand" +}; diff --git a/Source/objdat.h b/Source/objdat.h index 9a949bb6d41..ff879f15ca1 100644 --- a/Source/objdat.h +++ b/Source/objdat.h @@ -1,9 +1,9 @@ -//HEADER_GOES_HERE -#ifndef __OBJDAT_H__ -#define __OBJDAT_H__ - -extern int ObjTypeConv[113]; -extern ObjDataStruct AllObjects[99]; -extern char *ObjMasterLoadList[56]; - -#endif /* __OBJDAT_H__ */ +//HEADER_GOES_HERE +#ifndef __OBJDAT_H__ +#define __OBJDAT_H__ + +extern int ObjTypeConv[113]; +extern ObjDataStruct AllObjects[99]; +extern char *ObjMasterLoadList[56]; + +#endif /* __OBJDAT_H__ */ diff --git a/Source/spelldat.cpp b/Source/spelldat.cpp index 3597bb6ea42..fc929b6827a 100644 --- a/Source/spelldat.cpp +++ b/Source/spelldat.cpp @@ -1,44 +1,44 @@ -#include "diablo.h" - -SpellData spelldata[MAX_SPELLS] = { - // clang-format off - // sName, sManaCost, sType, sNameText, sSkillText, sBookLvl, sStaffLvl, sTargeted, sTownSpell, sMinInt, sSFX, sMissiles[3], sManaAdj, sMinMana, sStaffMin, sStaffMax, sBookCost, sStaffCost - { 0, 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 } - // clang-format on -}; +#include "diablo.h" + +SpellData spelldata[MAX_SPELLS] = { + // clang-format off + // sName, sManaCost, sType, sNameText, sSkillText, sBookLvl, sStaffLvl, sTargeted, sTownSpell, sMinInt, sSFX, sMissiles[3], sManaAdj, sMinMana, sStaffMin, sStaffMax, sBookCost, sStaffCost + { 0, 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 } + // clang-format on +}; diff --git a/Source/spelldat.h b/Source/spelldat.h index 6b524f5dafd..adb185c720f 100644 --- a/Source/spelldat.h +++ b/Source/spelldat.h @@ -1,7 +1,7 @@ -//HEADER_GOES_HERE -#ifndef __SPELLDAT_H__ -#define __SPELLDAT_H__ - -extern SpellData spelldata[MAX_SPELLS]; - -#endif /* __SPELLDAT_H__ */ +//HEADER_GOES_HERE +#ifndef __SPELLDAT_H__ +#define __SPELLDAT_H__ + +extern SpellData spelldata[MAX_SPELLS]; + +#endif /* __SPELLDAT_H__ */ From f71471eab751aa6d38c3a85ff4e7bf64df894c6d Mon Sep 17 00:00:00 2001 From: Anders Jenbo Date: Sat, 6 Jul 2019 19:30:00 +0200 Subject: [PATCH 08/42] Correct types related to glSeedTbl Reference: https://github.com/diasurgical/scalpel/blob/master/psx/_dump_/3/_dump_c_src_/global_0.cpp#L2431 https://github.com/diasurgical/scalpel/blob/master/psx/_dump_/3/_dump_c_src_/diabpsx/source/drlg_l1.cpp#L542 https://github.com/diasurgical/scalpel/blob/master/psx/_dump_/3/_dump_c_src_/diabpsx/source/drlg_l2.cpp#L538 https://github.com/diasurgical/scalpel/blob/master/psx/_dump_/3/_dump_c_src_/diabpsx/source/drlg_l3.cpp#L499 https://github.com/diasurgical/scalpel/blob/master/psx/_dump_/3/_dump_c_src_/diabpsx/source/drlg_l4.cpp#L484 --- Source/diablo.cpp | 2 +- Source/diablo.h | 2 +- Source/drlg_l1.cpp | 2 +- Source/drlg_l1.h | 2 +- Source/drlg_l2.cpp | 2 +- Source/drlg_l2.h | 2 +- Source/drlg_l3.cpp | 2 +- Source/drlg_l3.h | 2 +- Source/drlg_l4.cpp | 2 +- Source/drlg_l4.h | 2 +- 10 files changed, 10 insertions(+), 10 deletions(-) diff --git a/Source/diablo.cpp b/Source/diablo.cpp index f46584f8709..26374d4002c 100644 --- a/Source/diablo.cpp +++ b/Source/diablo.cpp @@ -9,7 +9,7 @@ int gnLevelTypeTbl[NUMLEVELS]; int MouseY; // idb int MouseX; // idb BOOL gbGameLoopStartup; // idb -int glSeedTbl[NUMLEVELS]; +DWORD glSeedTbl[NUMLEVELS]; BOOL gbRunGame; int glMid3Seed[NUMLEVELS]; BOOL gbRunGameResult; diff --git a/Source/diablo.h b/Source/diablo.h index d1efb104974..1456905774b 100644 --- a/Source/diablo.h +++ b/Source/diablo.h @@ -90,7 +90,7 @@ extern int gnLevelTypeTbl[NUMLEVELS]; extern int MouseY; // idb extern int MouseX; // idb extern BOOL gbGameLoopStartup; // idb -extern int glSeedTbl[NUMLEVELS]; +extern DWORD glSeedTbl[NUMLEVELS]; extern BOOL gbRunGame; extern int glMid3Seed[NUMLEVELS]; extern BOOL gbRunGameResult; diff --git a/Source/drlg_l1.cpp b/Source/drlg_l1.cpp index 7298f3dd4d0..03705cc4d52 100644 --- a/Source/drlg_l1.cpp +++ b/Source/drlg_l1.cpp @@ -371,7 +371,7 @@ void LoadPreL1Dungeon(char *sFileName, int vx, int vy) mem_free_dbg(pLevelMap); } -void CreateL5Dungeon(int rseed, int entry) +void CreateL5Dungeon(DWORD rseed, int entry) { SetRndSeed(rseed); diff --git a/Source/drlg_l1.h b/Source/drlg_l1.h index 0b8b6d786f4..ae9f38a6181 100644 --- a/Source/drlg_l1.h +++ b/Source/drlg_l1.h @@ -19,7 +19,7 @@ void DRLG_L1Floor(); void DRLG_L1Pass3(); void DRLG_InitL1Vals(); void LoadPreL1Dungeon(char *sFileName, int vx, int vy); -void CreateL5Dungeon(int rseed, int entry); +void CreateL5Dungeon(DWORD rseed, int entry); void DRLG_LoadL1SP(); void DRLG_FreeL1SP(); void DRLG_L5(int entry); diff --git a/Source/drlg_l2.cpp b/Source/drlg_l2.cpp index 6777ed5d6b4..f5d0972802b 100644 --- a/Source/drlg_l2.cpp +++ b/Source/drlg_l2.cpp @@ -551,7 +551,7 @@ void LoadPreL2Dungeon(char *sFileName, int vx, int vy) mem_free_dbg(pLevelMap); } -void CreateL2Dungeon(int rseed, int entry) +void CreateL2Dungeon(DWORD rseed, int entry) { if (gbMaxPlayers == 1) { if (currlevel == 7 && !quests[8]._qactive) { diff --git a/Source/drlg_l2.h b/Source/drlg_l2.h index 65730054713..82d34acdf5a 100644 --- a/Source/drlg_l2.h +++ b/Source/drlg_l2.h @@ -17,7 +17,7 @@ void L2DoorFix(); void LoadL2Dungeon(char *sFileName, int vx, int vy); void DRLG_L2Pass3(); void LoadPreL2Dungeon(char *sFileName, int vx, int vy); -void CreateL2Dungeon(int rseed, int entry); +void CreateL2Dungeon(DWORD rseed, int entry); void DRLG_LoadL2SP(); void DRLG_FreeL2SP(); void DRLG_L2(int entry); diff --git a/Source/drlg_l3.cpp b/Source/drlg_l3.cpp index fa72d7ff50e..786e1e2c9c8 100644 --- a/Source/drlg_l3.cpp +++ b/Source/drlg_l3.cpp @@ -287,7 +287,7 @@ BOOL DRLG_L3Lockout() return t == lockoutcnt; } -void CreateL3Dungeon(int rseed, int entry) +void CreateL3Dungeon(DWORD rseed, int entry) { int i, j; diff --git a/Source/drlg_l3.h b/Source/drlg_l3.h index 47c2feb345c..01deec67748 100644 --- a/Source/drlg_l3.h +++ b/Source/drlg_l3.h @@ -14,7 +14,7 @@ void FixL3Warp(); void FixL3HallofHeroes(); void DRLG_L3LockRec(int x, int y); BOOL DRLG_L3Lockout(); -void CreateL3Dungeon(int rseed, int entry); +void CreateL3Dungeon(DWORD rseed, int entry); void DRLG_L3(int entry); void InitL3Dungeon(); BOOL DRLG_L3FillRoom(int x1, int y1, int x2, int y2); diff --git a/Source/drlg_l4.cpp b/Source/drlg_l4.cpp index a9525e3b8a5..9725ec730ed 100644 --- a/Source/drlg_l4.cpp +++ b/Source/drlg_l4.cpp @@ -469,7 +469,7 @@ void DRLG_L4GeneralFix() } } -void CreateL4Dungeon(int rseed, int entry) +void CreateL4Dungeon(DWORD rseed, int entry) { SetRndSeed(rseed); diff --git a/Source/drlg_l4.h b/Source/drlg_l4.h index 3277f1f287f..a0d04b31c49 100644 --- a/Source/drlg_l4.h +++ b/Source/drlg_l4.h @@ -31,7 +31,7 @@ BOOL IsDURWall(char d); BOOL IsDLLWall(char dd); void L4FixRim(); void DRLG_L4GeneralFix(); -void CreateL4Dungeon(int rseed, int entry); +void CreateL4Dungeon(DWORD rseed, int entry); void DRLG_L4(int entry); void DRLG_L4Shadows(); void InitL4Dungeon(); From 87d8588f67809128f93bbcf710f640d6a93f02d9 Mon Sep 17 00:00:00 2001 From: Anders Jenbo Date: Sun, 7 Jul 2019 03:46:43 +0200 Subject: [PATCH 09/42] Compare int to numbers --- Source/items.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Source/items.cpp b/Source/items.cpp index daf14d38249..bdf47132298 100644 --- a/Source/items.cpp +++ b/Source/items.cpp @@ -1650,7 +1650,7 @@ void GetItemPower(int i, int minlvl, int maxlvl, int flgs, BOOL onlygood) pre = random(23, 4); post = random(23, 3); - if (pre && !post) { + if (pre != 0 && post == 0) { if (random(23, 2)) post = 1; else @@ -1692,7 +1692,7 @@ void GetItemPower(int i, int minlvl, int maxlvl, int flgs, BOOL onlygood) goe = PL_Prefix[preidx].PLGOE; } } - if (post) { + if (post != 0) { nl = 0; for (j = 0; PL_Suffix[j].PLPower != -1; j++) { if (PL_Suffix[j].PLIType & flgs From 86e2bab837e9b8b611f7b75a64bdcf0abe942527 Mon Sep 17 00:00:00 2001 From: Anders Jenbo Date: Sun, 7 Jul 2019 04:03:50 +0200 Subject: [PATCH 10/42] Clean up init_disable_screensaver --- Source/init.cpp | 19 ++++++++----------- 1 file changed, 8 insertions(+), 11 deletions(-) diff --git a/Source/init.cpp b/Source/init.cpp index 50e9afa022f..ef7ccee9cdd 100644 --- a/Source/init.cpp +++ b/Source/init.cpp @@ -109,28 +109,25 @@ void init_run_office(char *dir) void init_disable_screensaver(BOOLEAN disable) { - BOOLEAN v1; // al - char Data[16]; // [esp+4h] [ebp-20h] - DWORD Type; // [esp+14h] [ebp-10h] - DWORD cbData; // [esp+18h] [ebp-Ch] - HKEY phkResult; // [esp+1Ch] [ebp-8h] - BOOLEAN v6; // [esp+20h] [ebp-4h] + BOOLEAN enabled; + char Data[16]; + DWORD Type, cbData; + HKEY phkResult; // BUGFIX: this is probably the worst possible way to do this. Alternatives: ExtEscape() with SETPOWERMANAGEMENT, // SystemParametersInfo() with SPI_SETSCREENSAVEACTIVE/SPI_SETPOWEROFFACTIVE/SPI_SETLOWPOWERACTIVE - v6 = disable; if (!RegOpenKeyEx(HKEY_CURRENT_USER, "Control Panel\\Desktop", 0, KEY_READ | KEY_WRITE, (PHKEY)&phkResult)) { - if (v6) { + if (disable) { cbData = 16; if (!RegQueryValueEx(phkResult, "ScreenSaveActive", 0, &Type, (LPBYTE)Data, &cbData)) screensaver_enabled_prev = Data[0] != '0'; - v1 = 0; + enabled = FALSE; } else { - v1 = screensaver_enabled_prev; + enabled = screensaver_enabled_prev; } Data[1] = 0; - Data[0] = (v1 != 0) + '0'; + Data[0] = enabled ? '1' : '0'; RegSetValueEx(phkResult, "ScreenSaveActive", 0, REG_SZ, (const BYTE *)Data, 2u); RegCloseKey(phkResult); } From 1d55e5849c053340508623696b871b2ab9196953 Mon Sep 17 00:00:00 2001 From: Anders Jenbo Date: Sun, 7 Jul 2019 04:37:36 +0200 Subject: [PATCH 11/42] Clean up init.cpp --- Source/init.cpp | 58 +++++++++++++++++++++++-------------------------- 1 file changed, 27 insertions(+), 31 deletions(-) diff --git a/Source/init.cpp b/Source/init.cpp index ef7ccee9cdd..9b92adcc22d 100644 --- a/Source/init.cpp +++ b/Source/init.cpp @@ -177,30 +177,29 @@ void init_create_window(int nCmdShow) void init_kill_mom_parent() { - HWND v0; // eax + HWND handle; - v0 = init_find_mom_parent(); - if (v0) { - PostMessage(v0, WM_CLOSE, 0, 0); + handle = init_find_mom_parent(); + if (handle) { + PostMessage(handle, WM_CLOSE, 0, 0); killed_mom_parent = TRUE; } } HWND init_find_mom_parent() { - HWND i; // eax - HWND v1; // esi - char ClassName[256]; // [esp+4h] [ebp-100h] + HWND i, handle; + char ClassName[256]; - for (i = GetForegroundWindow();; i = GetWindow(v1, GW_HWNDNEXT)) { - v1 = i; + for (i = GetForegroundWindow();; i = GetWindow(handle, GW_HWNDNEXT)) { + handle = i; if (!i) break; GetClassName(i, ClassName, 255); if (!_strcmpi(ClassName, "MOM Parent")) break; } - return v1; + return handle; } void init_await_mom_parent_exit() @@ -307,7 +306,7 @@ HANDLE init_test_access(char *mpq_path, char *mpq_name, char *reg_loc, int flags char *init_strip_trailing_slash(char *path) { - char *result; // eax + char *result; result = strrchr(path, '\\'); if (result) { @@ -351,20 +350,18 @@ BOOL init_read_test_file(char *pszPath, char *pszArchive, int flags, HANDLE *phA void init_get_file_info() { - int v0; // eax - DWORD v1; // edi - void *v2; // ebx - unsigned int uBytes; // [esp+8h] [ebp-Ch] - DWORD dwHandle; // [esp+Ch] [ebp-8h] - VS_FIXEDFILEINFO *lpBuffer; // [esp+10h] [ebp-4h] + DWORD dwLen; + void *pBlock; + unsigned int uBytes; + DWORD dwHandle; + VS_FIXEDFILEINFO *lpBuffer; if (GetModuleFileName(ghInst, diablo_exe_path, sizeof(diablo_exe_path))) { - v0 = GetFileVersionInfoSize(diablo_exe_path, &dwHandle); - v1 = v0; - if (v0) { - v2 = DiabloAllocPtr(v0); - if (GetFileVersionInfo(diablo_exe_path, 0, v1, v2)) { - if (VerQueryValue(v2, "\\", (LPVOID *)&lpBuffer, &uBytes)) + dwLen = GetFileVersionInfoSize(diablo_exe_path, &dwHandle); + if (dwLen) { + pBlock = DiabloAllocPtr(dwLen); + if (GetFileVersionInfo(diablo_exe_path, 0, dwLen, pBlock)) { + if (VerQueryValue(pBlock, "\\", (LPVOID *)&lpBuffer, &uBytes)) sprintf( gszVersionNumber, "version %d.%d.%d.%d", @@ -373,7 +370,7 @@ void init_get_file_info() lpBuffer->dwProductVersionLS >> 16, lpBuffer->dwProductVersionLS & 0xFFFF); } - mem_free_dbg(v2); + mem_free_dbg(pBlock); } } } @@ -413,7 +410,7 @@ LRESULT __stdcall MainWndProc(HWND hWnd, UINT Msg, WPARAM wParam, LPARAM lParam) void init_activate_window(HWND hWnd, BOOL bActive) { - LONG dwNewLong; // eax + LONG dwNewLong; gbActive = bActive; UiAppActivate(bActive); @@ -434,18 +431,17 @@ void init_activate_window(HWND hWnd, BOOL bActive) LRESULT __stdcall WindowProc(HWND hWnd, UINT Msg, WPARAM wParam, LPARAM lParam) { - LRESULT result; // eax + LRESULT result; if (CurrentProc) - result = CurrentProc(hWnd, Msg, wParam, lParam); - else - result = MainWndProc(hWnd, Msg, wParam, lParam); - return result; + return CurrentProc(hWnd, Msg, wParam, lParam); + + return MainWndProc(hWnd, Msg, wParam, lParam); } WNDPROC SetWindowProc(WNDPROC NewProc) { - WNDPROC OldProc; // eax + WNDPROC OldProc; OldProc = CurrentProc; CurrentProc = NewProc; From ec6562826af499ffa9674bf4ac3c6f948b6cda4a Mon Sep 17 00:00:00 2001 From: galaxyhaxz Date: Sun, 7 Jul 2019 14:07:45 -0500 Subject: [PATCH 12/42] Fix L4firstRoom variables --- Source/drlg_l4.cpp | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/Source/drlg_l4.cpp b/Source/drlg_l4.cpp index 9725ec730ed..b6947897087 100644 --- a/Source/drlg_l4.cpp +++ b/Source/drlg_l4.cpp @@ -1530,7 +1530,7 @@ long GetArea() void L4firstRoom() { - int x, y, w, h, rndx, rndy; /* xmin, xmax, ymin, ymax */ + int x, y, w, h, rndx, rndy, xmin, xmax, ymin, ymax; if (currlevel != 16) { if (currlevel == quests[QTYPE_WARLRD]._qlevel && quests[QTYPE_WARLRD]._qactive) { @@ -1549,13 +1549,17 @@ void L4firstRoom() h = 14; } - rndx = random(0, 19 - w - ((20 - w) >> 1) + 1) + ((20 - w) >> 1); + xmin = (20 - w) >> 1; + xmax = 19 - w; + rndx = random(0, xmax - xmin + 1) + xmin; if (rndx + w > 19) { x = 19 - w + 1; } else { x = rndx; } - rndy = random(0, 19 - h - ((20 - h) >> 1) + 1) + ((20 - h) >> 1); + ymin = (20 - h) >> 1; + ymax = 19 - h; + rndy = random(0, ymax - ymin + 1) + ymin; if (rndy + h > 19) { y = 19 - h + 1; } else { From 32a51d17caa79c84e5a1f524454d66687983137b Mon Sep 17 00:00:00 2001 From: Anders Jenbo Date: Mon, 8 Jul 2019 02:32:29 +0200 Subject: [PATCH 13/42] Align function signatures with PSX symbols Using https://github.com/diasurgical/scalpel/tree/master/psx/_dump_/3/_dump_c_src_/diabpsx/source as a reference --- Source/automap.cpp | 10 +- Source/automap.h | 2 +- Source/control.cpp | 62 +-- Source/control.h | 2 +- Source/cursor.cpp | 2 +- Source/debug.cpp | 2 +- Source/diablo.cpp | 40 +- Source/drlg_l1.cpp | 10 +- Source/drlg_l2.cpp | 10 +- Source/drlg_l3.cpp | 4 +- Source/drlg_l4.cpp | 18 +- Source/drlg_l4.h | 2 +- Source/effects.cpp | 6 +- Source/effects.h | 2 +- Source/engine.cpp | 4 +- Source/engine.h | 4 +- Source/gendung.cpp | 10 +- Source/gendung.h | 6 +- Source/gmenu.cpp | 10 +- Source/interfac.cpp | 56 +-- Source/inv.cpp | 14 +- Source/inv.h | 6 +- Source/items.cpp | 58 +-- Source/items.h | 8 +- Source/lighting.cpp | 4 +- Source/mainmenu.cpp | 4 +- Source/mainmenu.h | 2 +- Source/minitext.cpp | 4 +- Source/missiles.cpp | 6 +- Source/monster.cpp | 24 +- Source/monster.h | 2 +- Source/msg.cpp | 984 +++++++++++++++++++++++++------------------- Source/msg.h | 154 +++---- Source/multi.cpp | 2 +- Source/objects.cpp | 20 +- Source/objects.h | 2 +- Source/pfile.cpp | 2 +- Source/pfile.h | 2 +- Source/player.cpp | 316 +++++++------- Source/player.h | 58 +-- Source/setmaps.cpp | 4 +- Source/spells.cpp | 2 +- Source/spells.h | 2 +- Source/stores.cpp | 6 +- Source/town.cpp | 10 +- Source/towners.cpp | 22 +- Source/towners.h | 4 +- 47 files changed, 1055 insertions(+), 929 deletions(-) diff --git a/Source/automap.cpp b/Source/automap.cpp index a2e1a1fa4f3..b676c1dc6ad 100644 --- a/Source/automap.cpp +++ b/Source/automap.cpp @@ -6,7 +6,7 @@ static int MapX; static int MapY; BOOL automapflag; char AmShiftTab[32]; // [31]? -unsigned char automapview[DMAXX][DMAXY]; +BOOLEAN automapview[DMAXX][DMAXY]; int AutoMapScale; int AutoMapXOfs; int AutoMapYOfs; @@ -70,19 +70,19 @@ void InitAutomap() switch (leveltype) { case DTYPE_CATHEDRAL: - pAFile = LoadFileInMem("Levels\\L1Data\\L1.AMP", (int *)&dwTiles); + pAFile = LoadFileInMem("Levels\\L1Data\\L1.AMP", &dwTiles); dwTiles >>= 1; break; case DTYPE_CATACOMBS: - pAFile = LoadFileInMem("Levels\\L2Data\\L2.AMP", (int *)&dwTiles); + pAFile = LoadFileInMem("Levels\\L2Data\\L2.AMP", &dwTiles); dwTiles >>= 1; break; case DTYPE_CAVES: - pAFile = LoadFileInMem("Levels\\L3Data\\L3.AMP", (int *)&dwTiles); + pAFile = LoadFileInMem("Levels\\L3Data\\L3.AMP", &dwTiles); dwTiles >>= 1; break; case DTYPE_HELL: - pAFile = LoadFileInMem("Levels\\L4Data\\L4.AMP", (int *)&dwTiles); + pAFile = LoadFileInMem("Levels\\L4Data\\L4.AMP", &dwTiles); dwTiles >>= 1; break; default: diff --git a/Source/automap.h b/Source/automap.h index 0d8a1e374fd..1793005b37d 100644 --- a/Source/automap.h +++ b/Source/automap.h @@ -5,7 +5,7 @@ extern WORD automaptype[512]; extern BOOL automapflag; extern char AmShiftTab[32]; -extern unsigned char automapview[DMAXX][DMAXY]; +extern BOOLEAN automapview[DMAXX][DMAXY]; extern int AutoMapScale; extern int AutoMapXOfs; extern int AutoMapYOfs; diff --git a/Source/control.cpp b/Source/control.cpp index 119a952a499..08523870b22 100644 --- a/Source/control.cpp +++ b/Source/control.cpp @@ -1122,24 +1122,24 @@ void InitControlPan() memset(pManaBuff, 0, 88 * 88); pLifeBuff = DiabloAllocPtr(88 * 88); memset(pLifeBuff, 0, 88 * 88); - pPanelText = LoadFileInMem("CtrlPan\\SmalText.CEL", 0); - pChrPanel = LoadFileInMem("Data\\Char.CEL", 0); - pSpellCels = LoadFileInMem("CtrlPan\\SpelIcon.CEL", 0); + pPanelText = LoadFileInMem("CtrlPan\\SmalText.CEL", NULL); + pChrPanel = LoadFileInMem("Data\\Char.CEL", NULL); + pSpellCels = LoadFileInMem("CtrlPan\\SpelIcon.CEL", NULL); SetSpellTrans(RSPLTYPE_SKILL); - pStatusPanel = LoadFileInMem("CtrlPan\\Panel8.CEL", 0); + pStatusPanel = LoadFileInMem("CtrlPan\\Panel8.CEL", NULL); CelDecodeRect(pBtmBuff, 0, 143, 640, pStatusPanel, 1, 640); MemFreeDbg(pStatusPanel); - pStatusPanel = LoadFileInMem("CtrlPan\\P8Bulbs.CEL", 0); + pStatusPanel = LoadFileInMem("CtrlPan\\P8Bulbs.CEL", NULL); CelDecodeRect(pLifeBuff, 0, 87, 88, pStatusPanel, 1, 88); CelDecodeRect(pManaBuff, 0, 87, 88, pStatusPanel, 2, 88); MemFreeDbg(pStatusPanel); talkflag = 0; if (gbMaxPlayers != 1) { - pTalkPanel = LoadFileInMem("CtrlPan\\TalkPanl.CEL", 0); + pTalkPanel = LoadFileInMem("CtrlPan\\TalkPanl.CEL", NULL); CelDecodeRect(pBtmBuff, 0, 287, 640, pTalkPanel, 1, 640); MemFreeDbg(pTalkPanel); - pMultiBtns = LoadFileInMem("CtrlPan\\P8But2.CEL", 0); - pTalkBtns = LoadFileInMem("CtrlPan\\TalkButt.CEL", 0); + pMultiBtns = LoadFileInMem("CtrlPan\\P8But2.CEL", NULL); + pTalkBtns = LoadFileInMem("CtrlPan\\TalkButt.CEL", NULL); sgbPlrTalkTbl = 0; sgszTalkMsg[0] = 0; for (i = 0; i < MAX_PLRS; i++) @@ -1149,7 +1149,7 @@ void InitControlPan() } panelflag = 0; lvlbtndown = 0; - pPanelButtons = LoadFileInMem("CtrlPan\\Panel8bu.CEL", 0); + pPanelButtons = LoadFileInMem("CtrlPan\\Panel8bu.CEL", NULL); for (i = 0; i < sizeof(panbtn) / sizeof(panbtn[0]); i++) panbtn[i] = 0; panbtndown = 0; @@ -1157,20 +1157,20 @@ void InitControlPan() numpanbtns = 6; else numpanbtns = 8; - pChrButtons = LoadFileInMem("Data\\CharBut.CEL", 0); + pChrButtons = LoadFileInMem("Data\\CharBut.CEL", NULL); for (i = 0; i < sizeof(chrbtn) / sizeof(chrbtn[0]); i++) chrbtn[i] = 0; chrbtnactive = FALSE; - pDurIcons = LoadFileInMem("Items\\DurIcons.CEL", 0); + pDurIcons = LoadFileInMem("Items\\DurIcons.CEL", NULL); strcpy(infostr, ""); ClearPanel(); drawhpflag = TRUE; drawmanaflag = TRUE; chrflag = 0; spselflag = 0; - pSpellBkCel = LoadFileInMem("Data\\SpellBk.CEL", 0); - pSBkBtnCel = LoadFileInMem("Data\\SpellBkB.CEL", 0); - pSBkIconCels = LoadFileInMem("Data\\SpellI2.CEL", 0); + pSpellBkCel = LoadFileInMem("Data\\SpellBk.CEL", NULL); + pSBkBtnCel = LoadFileInMem("Data\\SpellBkB.CEL", NULL); + pSBkIconCels = LoadFileInMem("Data\\SpellI2.CEL", NULL); sbooktab = 0; sbookflag = 0; if (plr[myplr]._pClass == PC_WARRIOR) { @@ -1180,8 +1180,8 @@ void InitControlPan() } else if (plr[myplr]._pClass == PC_SORCERER) { SpellPages[0][0] = SPL_RECHARGE; } - pQLogCel = LoadFileInMem("Data\\Quest.CEL", 0); - pGBoxBuff = LoadFileInMem("CtrlPan\\Golddrop.cel", 0); + pQLogCel = LoadFileInMem("Data\\Quest.CEL", NULL); + pGBoxBuff = LoadFileInMem("CtrlPan\\Golddrop.cel", NULL); dropGoldFlag = FALSE; dropGoldValue = 0; initialDropGoldValue = 0; @@ -2042,38 +2042,38 @@ void DrawDurIcon() } } -int DrawDurIcon4Item(ItemStruct *item, int x, int frame) +int DrawDurIcon4Item(ItemStruct *pItem, int x, int c) { - if (item->_itype == ITYPE_NONE) + if (pItem->_itype == ITYPE_NONE) return x; - if (item->_iDurability > 5) + if (pItem->_iDurability > 5) return x; - if (frame == 0) { - if (item->_iClass == ICLASS_WEAPON) { - switch (item->_itype) { + if (c == 0) { + if (pItem->_iClass == ICLASS_WEAPON) { + switch (pItem->_itype) { case ITYPE_SWORD: - frame = 2; + c = 2; break; case ITYPE_AXE: - frame = 6; + c = 6; break; case ITYPE_BOW: - frame = 7; + c = 7; break; case ITYPE_MACE: - frame = 5; + c = 5; break; case ITYPE_STAFF: - frame = 8; + c = 8; break; } } else { - frame = 1; + c = 1; } } - if (item->_iDurability > 2) - frame += 8; - CelDecodeOnly(x, 495, pDurIcons, frame, 32); + if (pItem->_iDurability > 2) + c += 8; + CelDecodeOnly(x, 495, pDurIcons, c, 32); return x - 40; } diff --git a/Source/control.h b/Source/control.h index d87ca6cc82d..f1f96361168 100644 --- a/Source/control.h +++ b/Source/control.h @@ -97,7 +97,7 @@ void DrawLevelUpIcon(); void CheckChrBtns(); void ReleaseChrBtns(); void DrawDurIcon(); -int DrawDurIcon4Item(ItemStruct *item, int x, int frame); +int DrawDurIcon4Item(ItemStruct *pItem, int x, int c); void RedBack(); char GetSBookTrans(int ii, BOOL townok); void DrawSpellBook(); diff --git a/Source/cursor.cpp b/Source/cursor.cpp index de38cc0aece..1e538c389f3 100644 --- a/Source/cursor.cpp +++ b/Source/cursor.cpp @@ -69,7 +69,7 @@ const int InvItemHeight[180] = { void InitCursor() { /// ASSERT: assert(! pCursCels); - pCursCels = LoadFileInMem("Data\\Inv\\Objcurs.CEL", 0); + pCursCels = LoadFileInMem("Data\\Inv\\Objcurs.CEL", NULL); ClearCursor(); } diff --git a/Source/debug.cpp b/Source/debug.cpp index 344bf275f51..0fc12face0f 100644 --- a/Source/debug.cpp +++ b/Source/debug.cpp @@ -15,7 +15,7 @@ char dFlagDbg[NUMLEVELS][MAXDUNX][MAXDUNY]; void LoadDebugGFX() { if (visiondebug) - pSquareCel = LoadFileInMem("Data\\Square.CEL", 0); + pSquareCel = LoadFileInMem("Data\\Square.CEL", NULL); } void FreeDebugGFX() diff --git a/Source/diablo.cpp b/Source/diablo.cpp index 26374d4002c..c5a0e33042f 100644 --- a/Source/diablo.cpp +++ b/Source/diablo.cpp @@ -1535,34 +1535,34 @@ void LoadLvlGFX() switch ((unsigned char)leveltype) { case DTYPE_TOWN: - pDungeonCels = LoadFileInMem("Levels\\TownData\\Town.CEL", 0); - pMegaTiles = LoadFileInMem("Levels\\TownData\\Town.TIL", 0); - pLevelPieces = LoadFileInMem("Levels\\TownData\\Town.MIN", 0); - pSpecialCels = LoadFileInMem("Levels\\TownData\\TownS.CEL", 0); + pDungeonCels = LoadFileInMem("Levels\\TownData\\Town.CEL", NULL); + pMegaTiles = LoadFileInMem("Levels\\TownData\\Town.TIL", NULL); + pLevelPieces = LoadFileInMem("Levels\\TownData\\Town.MIN", NULL); + pSpecialCels = LoadFileInMem("Levels\\TownData\\TownS.CEL", NULL); break; case DTYPE_CATHEDRAL: - pDungeonCels = LoadFileInMem("Levels\\L1Data\\L1.CEL", 0); - pMegaTiles = LoadFileInMem("Levels\\L1Data\\L1.TIL", 0); - pLevelPieces = LoadFileInMem("Levels\\L1Data\\L1.MIN", 0); - pSpecialCels = LoadFileInMem("Levels\\L1Data\\L1S.CEL", 0); + pDungeonCels = LoadFileInMem("Levels\\L1Data\\L1.CEL", NULL); + pMegaTiles = LoadFileInMem("Levels\\L1Data\\L1.TIL", NULL); + pLevelPieces = LoadFileInMem("Levels\\L1Data\\L1.MIN", NULL); + pSpecialCels = LoadFileInMem("Levels\\L1Data\\L1S.CEL", NULL); break; case DTYPE_CATACOMBS: - pDungeonCels = LoadFileInMem("Levels\\L2Data\\L2.CEL", 0); - pMegaTiles = LoadFileInMem("Levels\\L2Data\\L2.TIL", 0); - pLevelPieces = LoadFileInMem("Levels\\L2Data\\L2.MIN", 0); - pSpecialCels = LoadFileInMem("Levels\\L2Data\\L2S.CEL", 0); + pDungeonCels = LoadFileInMem("Levels\\L2Data\\L2.CEL", NULL); + pMegaTiles = LoadFileInMem("Levels\\L2Data\\L2.TIL", NULL); + pLevelPieces = LoadFileInMem("Levels\\L2Data\\L2.MIN", NULL); + pSpecialCels = LoadFileInMem("Levels\\L2Data\\L2S.CEL", NULL); break; case DTYPE_CAVES: - pDungeonCels = LoadFileInMem("Levels\\L3Data\\L3.CEL", 0); - pMegaTiles = LoadFileInMem("Levels\\L3Data\\L3.TIL", 0); - pLevelPieces = LoadFileInMem("Levels\\L3Data\\L3.MIN", 0); - pSpecialCels = LoadFileInMem("Levels\\L1Data\\L1S.CEL", 0); + pDungeonCels = LoadFileInMem("Levels\\L3Data\\L3.CEL", NULL); + pMegaTiles = LoadFileInMem("Levels\\L3Data\\L3.TIL", NULL); + pLevelPieces = LoadFileInMem("Levels\\L3Data\\L3.MIN", NULL); + pSpecialCels = LoadFileInMem("Levels\\L1Data\\L1S.CEL", NULL); break; case DTYPE_HELL: - pDungeonCels = LoadFileInMem("Levels\\L4Data\\L4.CEL", 0); - pMegaTiles = LoadFileInMem("Levels\\L4Data\\L4.TIL", 0); - pLevelPieces = LoadFileInMem("Levels\\L4Data\\L4.MIN", 0); - pSpecialCels = LoadFileInMem("Levels\\L2Data\\L2S.CEL", 0); + pDungeonCels = LoadFileInMem("Levels\\L4Data\\L4.CEL", NULL); + pMegaTiles = LoadFileInMem("Levels\\L4Data\\L4.TIL", NULL); + pLevelPieces = LoadFileInMem("Levels\\L4Data\\L4.MIN", NULL); + pSpecialCels = LoadFileInMem("Levels\\L2Data\\L2S.CEL", NULL); break; default: app_fatal("LoadLvlGFX"); diff --git a/Source/drlg_l1.cpp b/Source/drlg_l1.cpp index 03705cc4d52..2f85c5e10d9 100644 --- a/Source/drlg_l1.cpp +++ b/Source/drlg_l1.cpp @@ -138,7 +138,7 @@ void LoadL1Dungeon(char *sFileName, int vx, int vy) dmaxy = 96; DRLG_InitTrans(); - pLevelMap = LoadFileInMem(sFileName, 0); + pLevelMap = LoadFileInMem(sFileName, NULL); for (j = 0; j < DMAXY; j++) { for (i = 0; i < DMAXX; i++) { @@ -333,7 +333,7 @@ void LoadPreL1Dungeon(char *sFileName, int vx, int vy) dmaxx = 96; dmaxy = 96; - pLevelMap = LoadFileInMem(sFileName, 0); + pLevelMap = LoadFileInMem(sFileName, NULL); for (j = 0; j < DMAXY; j++) { for (i = 0; i < DMAXX; i++) { @@ -394,15 +394,15 @@ void DRLG_LoadL1SP() { setloadflag = FALSE; if (QuestStatus(QTYPE_BUTCH)) { - pSetPiece = LoadFileInMem("Levels\\L1Data\\rnd6.DUN", 0); + pSetPiece = LoadFileInMem("Levels\\L1Data\\rnd6.DUN", NULL); setloadflag = TRUE; } if (QuestStatus(QTYPE_KING) && gbMaxPlayers == 1) { - pSetPiece = LoadFileInMem("Levels\\L1Data\\SKngDO.DUN", 0); + pSetPiece = LoadFileInMem("Levels\\L1Data\\SKngDO.DUN", NULL); setloadflag = TRUE; } if (QuestStatus(QTYPE_BOL)) { - pSetPiece = LoadFileInMem("Levels\\L1Data\\Banner2.DUN", 0); + pSetPiece = LoadFileInMem("Levels\\L1Data\\Banner2.DUN", NULL); setloadflag = TRUE; } } diff --git a/Source/drlg_l2.cpp b/Source/drlg_l2.cpp index f5d0972802b..76b49add6c5 100644 --- a/Source/drlg_l2.cpp +++ b/Source/drlg_l2.cpp @@ -334,7 +334,7 @@ void LoadL2Dungeon(char *sFileName, int vx, int vy) InitDungeon(); DRLG_InitTrans(); - pLevelMap = LoadFileInMem(sFileName, 0); + pLevelMap = LoadFileInMem(sFileName, NULL); for (j = 0; j < DMAXY; j++) { for (i = 0; i < DMAXX; i++) { @@ -509,7 +509,7 @@ void LoadPreL2Dungeon(char *sFileName, int vx, int vy) InitDungeon(); DRLG_InitTrans(); - pLevelMap = LoadFileInMem(sFileName, 0); + pLevelMap = LoadFileInMem(sFileName, NULL); for (j = 0; j < DMAXY; j++) { for (i = 0; i < DMAXX; i++) { @@ -594,13 +594,13 @@ void DRLG_LoadL2SP() setloadflag_2 = 0; if (QuestStatus(QTYPE_BLIND)) { - pSetPiece_2 = (char *)LoadFileInMem("Levels\\L2Data\\Blind2.DUN", 0); + pSetPiece_2 = (char *)LoadFileInMem("Levels\\L2Data\\Blind2.DUN", NULL); setloadflag_2 = 1; } else if (QuestStatus(QTYPE_BLOOD)) { - pSetPiece_2 = (char *)LoadFileInMem("Levels\\L2Data\\Blood1.DUN", 0); + pSetPiece_2 = (char *)LoadFileInMem("Levels\\L2Data\\Blood1.DUN", NULL); setloadflag_2 = 1; } else if (QuestStatus(QTYPE_BONE)) { - pSetPiece_2 = (char *)LoadFileInMem("Levels\\L2Data\\Bonestr2.DUN", 0); + pSetPiece_2 = (char *)LoadFileInMem("Levels\\L2Data\\Bonestr2.DUN", NULL); setloadflag_2 = 1; } } diff --git a/Source/drlg_l3.cpp b/Source/drlg_l3.cpp index 786e1e2c9c8..c985da04911 100644 --- a/Source/drlg_l3.cpp +++ b/Source/drlg_l3.cpp @@ -1729,7 +1729,7 @@ void LoadL3Dungeon(char *sFileName, int vx, int vy) dmaxx = 96; dmaxy = 96; DRLG_InitTrans(); - pLevelMap = LoadFileInMem(sFileName, 0); + pLevelMap = LoadFileInMem(sFileName, NULL); lm = pLevelMap; rw = *lm; @@ -1787,7 +1787,7 @@ void LoadPreL3Dungeon(char *sFileName, int vx, int vy) InitL3Dungeon(); DRLG_InitTrans(); - pLevelMap = LoadFileInMem(sFileName, 0); + pLevelMap = LoadFileInMem(sFileName, NULL); lm = pLevelMap; rw = *lm; diff --git a/Source/drlg_l4.cpp b/Source/drlg_l4.cpp index b6947897087..4ffa1bf97fb 100644 --- a/Source/drlg_l4.cpp +++ b/Source/drlg_l4.cpp @@ -291,11 +291,11 @@ void DRLG_LoadL4SP() { setloadflag_2 = 0; if (QuestStatus(QTYPE_WARLRD)) { - pSetPiece_2 = (char *)LoadFileInMem("Levels\\L4Data\\Warlord.DUN", 0); + pSetPiece_2 = (char *)LoadFileInMem("Levels\\L4Data\\Warlord.DUN", NULL); setloadflag_2 = 1; } if (currlevel == 15 && gbMaxPlayers != 1) { - pSetPiece_2 = (char *)LoadFileInMem("Levels\\L4Data\\Vile1.DUN", 0); + pSetPiece_2 = (char *)LoadFileInMem("Levels\\L4Data\\Vile1.DUN", NULL); setloadflag_2 = 1; } } @@ -377,16 +377,16 @@ void DRLG_LoadDiabQuads(BOOL preflag) { BYTE *lpSetPiece; - lpSetPiece = LoadFileInMem("Levels\\L4Data\\diab1.DUN", 0); + lpSetPiece = LoadFileInMem("Levels\\L4Data\\diab1.DUN", NULL); diabquad1x = 4 + l4holdx; diabquad1y = 4 + l4holdy; DRLG_L4SetRoom(lpSetPiece, diabquad1x, diabquad1y); mem_free_dbg(lpSetPiece); if (preflag) { - lpSetPiece = LoadFileInMem("Levels\\L4Data\\diab2b.DUN", 0); + lpSetPiece = LoadFileInMem("Levels\\L4Data\\diab2b.DUN", NULL); } else { - lpSetPiece = LoadFileInMem("Levels\\L4Data\\diab2a.DUN", 0); + lpSetPiece = LoadFileInMem("Levels\\L4Data\\diab2a.DUN", NULL); } diabquad2x = 27 - l4holdx; diabquad2y = 1 + l4holdy; @@ -394,9 +394,9 @@ void DRLG_LoadDiabQuads(BOOL preflag) mem_free_dbg(lpSetPiece); if (preflag) { - lpSetPiece = LoadFileInMem("Levels\\L4Data\\diab3b.DUN", 0); + lpSetPiece = LoadFileInMem("Levels\\L4Data\\diab3b.DUN", NULL); } else { - lpSetPiece = LoadFileInMem("Levels\\L4Data\\diab3a.DUN", 0); + lpSetPiece = LoadFileInMem("Levels\\L4Data\\diab3a.DUN", NULL); } diabquad3x = 1 + l4holdx; diabquad3y = 27 - l4holdy; @@ -404,9 +404,9 @@ void DRLG_LoadDiabQuads(BOOL preflag) mem_free_dbg(lpSetPiece); if (preflag) { - lpSetPiece = LoadFileInMem("Levels\\L4Data\\diab4b.DUN", 0); + lpSetPiece = LoadFileInMem("Levels\\L4Data\\diab4b.DUN", NULL); } else { - lpSetPiece = LoadFileInMem("Levels\\L4Data\\diab4a.DUN", 0); + lpSetPiece = LoadFileInMem("Levels\\L4Data\\diab4a.DUN", NULL); } diabquad4x = 28 - l4holdx; diabquad4y = 28 - l4holdy; diff --git a/Source/drlg_l4.h b/Source/drlg_l4.h index a0d04b31c49..635870b7318 100644 --- a/Source/drlg_l4.h +++ b/Source/drlg_l4.h @@ -50,7 +50,7 @@ void L4firstRoom(); void L4drawRoom(int x, int y, int width, int height); void L4roomGen(int x, int y, int w, int h, int dir); BOOL L4checkRoom(int x, int y, int width, int height); -BOOL DRLG_L4PlaceMiniSet(const unsigned char *miniset, int tmin, int tmax, int cx, int cy, BOOL setview, int ldir); +BOOL DRLG_L4PlaceMiniSet(const BYTE *miniset, int tmin, int tmax, int cx, int cy, BOOL setview, int ldir); void DRLG_L4FloodTVal(); void DRLG_L4FTVR(int i, int j, int x, int y, int d); void DRLG_L4TransFix(); diff --git a/Source/effects.cpp b/Source/effects.cpp index 1b52c7efee1..6ab717623fa 100644 --- a/Source/effects.cpp +++ b/Source/effects.cpp @@ -1178,7 +1178,7 @@ void effects_cleanup_sfx() void stream_update() { - UCHAR mask = 0; + BYTE mask = 0; if (gbMaxPlayers > 1) { mask = SFX_WARRIOR | SFX_ROGUE | SFX_SORCEROR; } else if (plr[myplr]._pClass == PC_WARRIOR) { @@ -1194,9 +1194,9 @@ void stream_update() priv_sound_init(mask); } -void priv_sound_init(UCHAR bLoadMask) +void priv_sound_init(BYTE bLoadMask) { - UCHAR pc, bFlags; + BYTE pc, bFlags; DWORD i; if (!gbSndInited) { diff --git a/Source/effects.h b/Source/effects.h index 20d52c7a9c9..7790ed57467 100644 --- a/Source/effects.h +++ b/Source/effects.h @@ -24,7 +24,7 @@ void sound_update(); void effects_update(); void effects_cleanup_sfx(); void stream_update(); -void priv_sound_init(UCHAR bLoadMask); +void priv_sound_init(BYTE bLoadMask); void sound_init(); void __stdcall effects_play_sound(char *snd_file); diff --git a/Source/engine.cpp b/Source/engine.cpp index 1435ea0079f..53ca7e36a6a 100644 --- a/Source/engine.cpp +++ b/Source/engine.cpp @@ -2388,7 +2388,7 @@ void engine_debug_trap(BOOL show_cursor) */ } -unsigned char *DiabloAllocPtr(int dwBytes) +BYTE *DiabloAllocPtr(DWORD dwBytes) { BYTE *buf; @@ -2420,7 +2420,7 @@ void mem_free_dbg(void *p) } } -BYTE *LoadFileInMem(char *pszName, int *pdwFileLen) +BYTE *LoadFileInMem(char *pszName, DWORD *pdwFileLen) { HANDLE file; BYTE *buf; diff --git a/Source/engine.h b/Source/engine.h index 74f038b79ce..017fa85210a 100644 --- a/Source/engine.h +++ b/Source/engine.h @@ -41,9 +41,9 @@ void SetRndSeed(int s); int GetRndSeed(); int random(BYTE idx, int v); void engine_debug_trap(BOOL show_cursor); -unsigned char *DiabloAllocPtr(int dwBytes); +BYTE *DiabloAllocPtr(DWORD dwBytes); void mem_free_dbg(void *p); -BYTE *LoadFileInMem(char *pszName, int *pdwFileLen); +BYTE *LoadFileInMem(char *pszName, DWORD *pdwFileLen); DWORD LoadFileWithMem(const char *pszName, void *p); void Cl2ApplyTrans(BYTE *p, BYTE *ttbl, int nCel); void Cl2DecodeFrm1(int sx, int sy, BYTE *pCelBuff, int nCel, int nWidth, int CelSkip, int CelCap); diff --git a/Source/gendung.cpp b/Source/gendung.cpp index 92ec9715605..6273e0b1137 100644 --- a/Source/gendung.cpp +++ b/Source/gendung.cpp @@ -82,19 +82,19 @@ void FillSolidBlockTbls() switch (leveltype) { case DTYPE_TOWN: - pSBFile = LoadFileInMem("Levels\\TownData\\Town.SOL", (int *)&dwTiles); + pSBFile = LoadFileInMem("Levels\\TownData\\Town.SOL", &dwTiles); break; case DTYPE_CATHEDRAL: - pSBFile = LoadFileInMem("Levels\\L1Data\\L1.SOL", (int *)&dwTiles); + pSBFile = LoadFileInMem("Levels\\L1Data\\L1.SOL", &dwTiles); break; case DTYPE_CATACOMBS: - pSBFile = LoadFileInMem("Levels\\L2Data\\L2.SOL", (int *)&dwTiles); + pSBFile = LoadFileInMem("Levels\\L2Data\\L2.SOL", &dwTiles); break; case DTYPE_CAVES: - pSBFile = LoadFileInMem("Levels\\L3Data\\L3.SOL", (int *)&dwTiles); + pSBFile = LoadFileInMem("Levels\\L3Data\\L3.SOL", &dwTiles); break; case DTYPE_HELL: - pSBFile = LoadFileInMem("Levels\\L4Data\\L4.SOL", (int *)&dwTiles); + pSBFile = LoadFileInMem("Levels\\L4Data\\L4.SOL", &dwTiles); break; default: app_fatal("FillSolidBlockTbls"); diff --git a/Source/gendung.h b/Source/gendung.h index ff7d8948fd4..742101daec4 100644 --- a/Source/gendung.h +++ b/Source/gendung.h @@ -30,7 +30,7 @@ extern char block_lvid[2049]; extern char dTransVal[MAXDUNX][MAXDUNY]; extern BOOLEAN nTrapTable[2049]; extern BYTE leveltype; -extern unsigned char currlevel; +extern BYTE currlevel; extern char TransList[256]; extern BOOLEAN nSolidTable[2049]; extern int level_frame_count[MAXTILES]; @@ -80,8 +80,8 @@ void DRLG_InitTrans(); void DRLG_MRectTrans(int x1, int y1, int x2, int y2); void DRLG_RectTrans(int x1, int y1, int x2, int y2); void DRLG_CopyTrans(int sx, int sy, int dx, int dy); -void DRLG_ListTrans(int num, unsigned char *List); -void DRLG_AreaTrans(int num, unsigned char *List); +void DRLG_ListTrans(int num, BYTE *List); +void DRLG_AreaTrans(int num, BYTE *List); void DRLG_InitSetPC(); void DRLG_SetPC(); void Make_SetPC(int x, int y, int w, int h); diff --git a/Source/gmenu.cpp b/Source/gmenu.cpp index 7bde72a7be4..a796812cca1 100644 --- a/Source/gmenu.cpp +++ b/Source/gmenu.cpp @@ -77,11 +77,11 @@ void gmenu_init_menu() dword_63447C = 0; sgCurrentMenuIdx = 0; mouseNavigation = FALSE; - sgpLogo = LoadFileInMem("Data\\Diabsmal.CEL", 0); - BigTGold_cel = LoadFileInMem("Data\\BigTGold.CEL", 0); - PentSpin_cel = LoadFileInMem("Data\\PentSpin.CEL", 0); - option_cel = LoadFileInMem("Data\\option.CEL", 0); - optbar_cel = LoadFileInMem("Data\\optbar.CEL", 0); + sgpLogo = LoadFileInMem("Data\\Diabsmal.CEL", NULL); + BigTGold_cel = LoadFileInMem("Data\\BigTGold.CEL", NULL); + PentSpin_cel = LoadFileInMem("Data\\PentSpin.CEL", NULL); + option_cel = LoadFileInMem("Data\\option.CEL", NULL); + optbar_cel = LoadFileInMem("Data\\optbar.CEL", NULL); } BOOL gmenu_exception() diff --git a/Source/interfac.cpp b/Source/interfac.cpp index aaafde21307..fc8cfc0a5c3 100644 --- a/Source/interfac.cpp +++ b/Source/interfac.cpp @@ -247,38 +247,38 @@ void InitCutscene(unsigned int uMsg) case WM_DIABNEXTLVL: switch (gnLevelTypeTbl[currlevel]) { case 0: - sgpBackCel = LoadFileInMem("Gendata\\Cuttt.CEL", 0); + sgpBackCel = LoadFileInMem("Gendata\\Cuttt.CEL", NULL); LoadPalette("Gendata\\Cuttt.pal"); progress_id = 1; break; case 1: - sgpBackCel = LoadFileInMem("Gendata\\Cutl1d.CEL", 0); + sgpBackCel = LoadFileInMem("Gendata\\Cutl1d.CEL", NULL); LoadPalette("Gendata\\Cutl1d.pal"); progress_id = 0; break; case 2: - sgpBackCel = LoadFileInMem("Gendata\\Cut2.CEL", 0); + sgpBackCel = LoadFileInMem("Gendata\\Cut2.CEL", NULL); LoadPalette("Gendata\\Cut2.pal"); progress_id = 2; break; case 3: - sgpBackCel = LoadFileInMem("Gendata\\Cut3.CEL", 0); + sgpBackCel = LoadFileInMem("Gendata\\Cut3.CEL", NULL); LoadPalette("Gendata\\Cut3.pal"); progress_id = 1; break; case 4: if (currlevel < 15) { - sgpBackCel = LoadFileInMem("Gendata\\Cut4.CEL", 0); + sgpBackCel = LoadFileInMem("Gendata\\Cut4.CEL", NULL); LoadPalette("Gendata\\Cut4.pal"); progress_id = 1; } else { - sgpBackCel = LoadFileInMem("Gendata\\Cutgate.CEL", 0); + sgpBackCel = LoadFileInMem("Gendata\\Cutgate.CEL", NULL); LoadPalette("Gendata\\Cutgate.pal"); progress_id = 1; } break; default: - sgpBackCel = LoadFileInMem("Gendata\\Cutl1d.CEL", 0); + sgpBackCel = LoadFileInMem("Gendata\\Cutl1d.CEL", NULL); LoadPalette("Gendata\\Cutl1d.pal"); progress_id = 0; break; @@ -286,38 +286,38 @@ void InitCutscene(unsigned int uMsg) break; case WM_DIABPREVLVL: if (gnLevelTypeTbl[currlevel - 1] == 0) { - sgpBackCel = LoadFileInMem("Gendata\\Cuttt.CEL", 0); + sgpBackCel = LoadFileInMem("Gendata\\Cuttt.CEL", NULL); LoadPalette("Gendata\\Cuttt.pal"); progress_id = 1; } else { switch (gnLevelTypeTbl[currlevel]) { case 0: - sgpBackCel = LoadFileInMem("Gendata\\Cuttt.CEL", 0); + sgpBackCel = LoadFileInMem("Gendata\\Cuttt.CEL", NULL); LoadPalette("Gendata\\Cuttt.pal"); progress_id = 1; break; case 1: - sgpBackCel = LoadFileInMem("Gendata\\Cutl1d.CEL", 0); + sgpBackCel = LoadFileInMem("Gendata\\Cutl1d.CEL", NULL); LoadPalette("Gendata\\Cutl1d.pal"); progress_id = 0; break; case 2: - sgpBackCel = LoadFileInMem("Gendata\\Cut2.CEL", 0); + sgpBackCel = LoadFileInMem("Gendata\\Cut2.CEL", NULL); LoadPalette("Gendata\\Cut2.pal"); progress_id = 2; break; case 3: - sgpBackCel = LoadFileInMem("Gendata\\Cut3.CEL", 0); + sgpBackCel = LoadFileInMem("Gendata\\Cut3.CEL", NULL); LoadPalette("Gendata\\Cut3.pal"); progress_id = 1; break; case 4: - sgpBackCel = LoadFileInMem("Gendata\\Cut4.CEL", 0); + sgpBackCel = LoadFileInMem("Gendata\\Cut4.CEL", NULL); LoadPalette("Gendata\\Cut4.pal"); progress_id = 1; break; default: - sgpBackCel = LoadFileInMem("Gendata\\Cutl1d.CEL", 0); + sgpBackCel = LoadFileInMem("Gendata\\Cutl1d.CEL", NULL); LoadPalette("Gendata\\Cutl1d.pal"); progress_id = 0; break; @@ -326,46 +326,46 @@ void InitCutscene(unsigned int uMsg) break; case WM_DIABSETLVL: if (setlvlnum == SL_BONECHAMB) { - sgpBackCel = LoadFileInMem("Gendata\\Cut2.CEL", 0); + sgpBackCel = LoadFileInMem("Gendata\\Cut2.CEL", NULL); LoadPalette("Gendata\\Cut2.pal"); progress_id = 2; } else if (setlvlnum == SL_VILEBETRAYER) { - sgpBackCel = LoadFileInMem("Gendata\\Cutportr.CEL", 0); + sgpBackCel = LoadFileInMem("Gendata\\Cutportr.CEL", NULL); LoadPalette("Gendata\\Cutportr.pal"); progress_id = 1; } else { - sgpBackCel = LoadFileInMem("Gendata\\Cutl1d.CEL", 0); + sgpBackCel = LoadFileInMem("Gendata\\Cutl1d.CEL", NULL); LoadPalette("Gendata\\Cutl1d.pal"); progress_id = 0; } break; case WM_DIABRTNLVL: if (setlvlnum == SL_BONECHAMB) { - sgpBackCel = LoadFileInMem("Gendata\\Cut2.CEL", 0); + sgpBackCel = LoadFileInMem("Gendata\\Cut2.CEL", NULL); LoadPalette("Gendata\\Cut2.pal"); progress_id = 2; } else if (setlvlnum == SL_VILEBETRAYER) { - sgpBackCel = LoadFileInMem("Gendata\\Cutportr.CEL", 0); + sgpBackCel = LoadFileInMem("Gendata\\Cutportr.CEL", NULL); LoadPalette("Gendata\\Cutportr.pal"); progress_id = 1; } else { - sgpBackCel = LoadFileInMem("Gendata\\Cutl1d.CEL", 0); + sgpBackCel = LoadFileInMem("Gendata\\Cutl1d.CEL", NULL); LoadPalette("Gendata\\Cutl1d.pal"); progress_id = 0; } break; case WM_DIABWARPLVL: - sgpBackCel = LoadFileInMem("Gendata\\Cutportl.CEL", 0); + sgpBackCel = LoadFileInMem("Gendata\\Cutportl.CEL", NULL); LoadPalette("Gendata\\Cutportl.pal"); progress_id = 1; break; case WM_DIABLOADGAME: - sgpBackCel = LoadFileInMem("Gendata\\Cutstart.CEL", 0); + sgpBackCel = LoadFileInMem("Gendata\\Cutstart.CEL", NULL); LoadPalette("Gendata\\Cutstart.pal"); progress_id = 1; break; case WM_DIABNEWGAME: - sgpBackCel = LoadFileInMem("Gendata\\Cutstart.CEL", 0); + sgpBackCel = LoadFileInMem("Gendata\\Cutstart.CEL", NULL); LoadPalette("Gendata\\Cutstart.pal"); progress_id = 1; break; @@ -373,29 +373,29 @@ void InitCutscene(unsigned int uMsg) case WM_DIABTWARPUP: switch (gnLevelTypeTbl[plr[myplr].plrlevel]) { case 0: - sgpBackCel = LoadFileInMem("Gendata\\Cuttt.CEL", 0); + sgpBackCel = LoadFileInMem("Gendata\\Cuttt.CEL", NULL); LoadPalette("Gendata\\Cuttt.pal"); progress_id = 1; break; case 2: - sgpBackCel = LoadFileInMem("Gendata\\Cut2.CEL", 0); + sgpBackCel = LoadFileInMem("Gendata\\Cut2.CEL", NULL); LoadPalette("Gendata\\Cut2.pal"); progress_id = 2; break; case 3: - sgpBackCel = LoadFileInMem("Gendata\\Cut3.CEL", 0); + sgpBackCel = LoadFileInMem("Gendata\\Cut3.CEL", NULL); LoadPalette("Gendata\\Cut3.pal"); progress_id = 1; break; case 4: - sgpBackCel = LoadFileInMem("Gendata\\Cut4.CEL", 0); + sgpBackCel = LoadFileInMem("Gendata\\Cut4.CEL", NULL); LoadPalette("Gendata\\Cut4.pal"); progress_id = 1; break; } break; case WM_DIABRETOWN: - sgpBackCel = LoadFileInMem("Gendata\\Cuttt.CEL", 0); + sgpBackCel = LoadFileInMem("Gendata\\Cuttt.CEL", NULL); LoadPalette("Gendata\\Cuttt.pal"); progress_id = 1; break; diff --git a/Source/inv.cpp b/Source/inv.cpp index b089a734649..2385da92285 100644 --- a/Source/inv.cpp +++ b/Source/inv.cpp @@ -96,11 +96,11 @@ void FreeInvGFX() void InitInv() { if (plr[myplr]._pClass == PC_WARRIOR) { - pInvCels = LoadFileInMem("Data\\Inv\\Inv.CEL", 0); + pInvCels = LoadFileInMem("Data\\Inv\\Inv.CEL", NULL); } else if (plr[myplr]._pClass == PC_ROGUE) { - pInvCels = LoadFileInMem("Data\\Inv\\Inv_rog.CEL", 0); + pInvCels = LoadFileInMem("Data\\Inv\\Inv_rog.CEL", NULL); } else if (plr[myplr]._pClass == PC_SORCERER) { - pInvCels = LoadFileInMem("Data\\Inv\\Inv_Sor.CEL", 0); + pInvCels = LoadFileInMem("Data\\Inv\\Inv_Sor.CEL", NULL); } invflag = 0; @@ -639,7 +639,7 @@ BOOL GoldAutoPlace(int pnum) return done; } -int WeaponAutoPlace(int pnum) +BOOL WeaponAutoPlace(int pnum) { if (plr[pnum].HoldItem._iLoc != ILOC_TWOHAND) { if (plr[pnum].InvBody[INVLOC_HAND_LEFT]._itype != ITYPE_NONE && plr[pnum].InvBody[INVLOC_HAND_LEFT]._iClass == ICLASS_WEAPON) @@ -1621,7 +1621,7 @@ void AutoGetItem(int pnum, int ii) } } -int FindGetItem(int indx, WORD ci, int iseed) +int FindGetItem(int idx, WORD ci, int iseed) { int i, ii; @@ -1631,7 +1631,7 @@ int FindGetItem(int indx, WORD ci, int iseed) while (1) { ii = itemactive[i]; - if (item[ii].IDidx == indx && item[ii]._iSeed == iseed && item[ii]._iCreateInfo == ci) + if (item[ii].IDidx == idx && item[ii]._iSeed == iseed && item[ii]._iCreateInfo == ci) break; i++; @@ -1816,7 +1816,7 @@ int InvPutItem(int pnum, int x, int y) return ii; } -int SyncPutItem(int pnum, int x, int y, int idx, WORD icreateinfo, int iseed, int Id, int dur, int mdur, int ch, int mch, int ivalue, unsigned int ibuff) +int SyncPutItem(int pnum, int x, int y, int idx, WORD icreateinfo, int iseed, int Id, int dur, int mdur, int ch, int mch, int ivalue, DWORD ibuff) { BOOL done; int d, ii; diff --git a/Source/inv.h b/Source/inv.h index e6cb91851ae..0ef9c39cacf 100644 --- a/Source/inv.h +++ b/Source/inv.h @@ -13,7 +13,7 @@ void DrawInvBelt(); BOOL AutoPlace(int pnum, int ii, int sx, int sy, BOOL saveflag); BOOL SpecialAutoPlace(int pnum, int ii, int sx, int sy, BOOL saveflag); BOOL GoldAutoPlace(int pnum); -int WeaponAutoPlace(int pnum); +BOOL WeaponAutoPlace(int pnum); int SwapItem(ItemStruct *a, ItemStruct *b); void CheckInvPaste(int pnum, int mx, int my); void CheckInvSwap(int pnum, BYTE bLoc, int idx, WORD wCI, int seed, BOOL bId); @@ -28,13 +28,13 @@ void CheckBookLevel(int pnum); void CheckQuestItem(int pnum); void InvGetItem(int pnum, int ii); void AutoGetItem(int pnum, int ii); -int FindGetItem(int indx, WORD ci, int iseed); +int FindGetItem(int idx, WORD ci, int iseed); void SyncGetItem(int x, int y, int idx, WORD ci, int iseed); BOOL CanPut(int x, int y); BOOL TryInvPut(); void DrawInvMsg(char *msg); int InvPutItem(int pnum, int x, int y); -int SyncPutItem(int pnum, int x, int y, int idx, WORD icreateinfo, int iseed, int Id, int dur, int mdur, int ch, int mch, int ivalue, unsigned int ibuff); +int SyncPutItem(int pnum, int x, int y, int idx, WORD icreateinfo, int iseed, int Id, int dur, int mdur, int ch, int mch, int ivalue, DWORD ibuff); char CheckInvHLight(); void RemoveScroll(int pnum); BOOL UseScroll(); diff --git a/Source/items.cpp b/Source/items.cpp index bdf47132298..605dc467baf 100644 --- a/Source/items.cpp +++ b/Source/items.cpp @@ -191,7 +191,7 @@ void InitItemGFX() for (i = 0; i < 35; i++) { sprintf(arglist, "Items\\%s.CEL", ItemDropStrs[i]); - itemanims[i] = LoadFileInMem(arglist, 0); + itemanims[i] = LoadFileInMem(arglist, NULL); } memset(UniqueItemFlag, 0, sizeof(UniqueItemFlag)); } @@ -627,13 +627,13 @@ void CalcPlrScrolls(int p) } } -void CalcPlrStaff(int pnum) +void CalcPlrStaff(int p) { - plr[pnum]._pISpells = 0; - if (plr[pnum].InvBody[INVLOC_HAND_LEFT]._itype != ITYPE_NONE - && plr[pnum].InvBody[INVLOC_HAND_LEFT]._iStatFlag - && plr[pnum].InvBody[INVLOC_HAND_LEFT]._iCharges > 0) { - plr[pnum]._pISpells |= (__int64)1 << (plr[pnum].InvBody[INVLOC_HAND_LEFT]._iSpell - 1); + plr[p]._pISpells = 0; + if (plr[p].InvBody[INVLOC_HAND_LEFT]._itype != ITYPE_NONE + && plr[p].InvBody[INVLOC_HAND_LEFT]._iStatFlag + && plr[p].InvBody[INVLOC_HAND_LEFT]._iCharges > 0) { + plr[p]._pISpells |= (__int64)1 << (plr[p].InvBody[INVLOC_HAND_LEFT]._iSpell - 1); } } @@ -2217,14 +2217,14 @@ void CreateTypeItem(int x, int y, BOOL onlygood, int itype, int imisc, BOOL send } } -void RecreateItem(int ii, int idx, WORD ic, int iseed, int ivalue) +void RecreateItem(int ii, int idx, WORD icreateinfo, int iseed, int ivalue) { int uper, onlygood, recreate, pregen; if (!idx) { SetPlrHandItem(&item[ii], IDI_GOLD); item[ii]._iSeed = iseed; - item[ii]._iCreateInfo = ic; + item[ii]._iCreateInfo = icreateinfo; item[ii]._ivalue = ivalue; if (ivalue >= GOLD_MEDIUM_LIMIT) item[ii]._iCurs = ICURS_GOLD_LARGE; @@ -2233,30 +2233,30 @@ void RecreateItem(int ii, int idx, WORD ic, int iseed, int ivalue) else item[ii]._iCurs = ICURS_GOLD_MEDIUM; } else { - if (!ic) { + if (!icreateinfo) { SetPlrHandItem(&item[ii], idx); SetPlrHandSeed(&item[ii], iseed); } else { - if (ic & 0x7C00) { - RecreateTownItem(ii, idx, ic, iseed, ivalue); - } else if ((ic & 0x0180) == 0x0180) { - SetupAllUseful(ii, iseed, ic & 0x3F); + if (icreateinfo & 0x7C00) { + RecreateTownItem(ii, idx, icreateinfo, iseed, ivalue); + } else if ((icreateinfo & 0x0180) == 0x0180) { + SetupAllUseful(ii, iseed, icreateinfo & 0x3F); } else { uper = 0; onlygood = 0; recreate = 0; pregen = 0; - if (ic & 0x0100) + if (icreateinfo & 0x0100) uper = 1; - if (ic & 0x80) + if (icreateinfo & 0x80) uper = 15; - if (ic & 0x40) + if (icreateinfo & 0x40) onlygood = 1; - if (ic & 0x0200) + if (icreateinfo & 0x0200) recreate = 1; - if (ic & 0x8000) + if (icreateinfo & 0x8000) pregen = 1; - SetupAllItems(ii, idx, iseed, ic & 0x3F, uper, onlygood, recreate, pregen); + SetupAllItems(ii, idx, iseed, icreateinfo & 0x3F, uper, onlygood, recreate, pregen); } } } @@ -3782,29 +3782,29 @@ void SpawnStoreGold() golditem._iStatFlag = TRUE; } -void RecreateSmithItem(int ii, int idx, int plvl, int iseed) +void RecreateSmithItem(int ii, int idx, int lvl, int iseed) { int itype; SetRndSeed(iseed); - itype = RndSmithItem(plvl) - 1; - GetItemAttrs(ii, itype, plvl); + itype = RndSmithItem(lvl) - 1; + GetItemAttrs(ii, itype, lvl); - item[ii]._iCreateInfo = plvl | 0x400; + item[ii]._iCreateInfo = lvl | 0x400; item[ii]._iSeed = iseed; item[ii]._iIdentified = TRUE; } -void RecreatePremiumItem(int ii, int idx, int lvl, int iseed) +void RecreatePremiumItem(int ii, int idx, int plvl, int iseed) { int itype; SetRndSeed(iseed); - itype = RndPremiumItem(lvl >> 2, lvl) - 1; - GetItemAttrs(ii, itype, lvl); - GetItemBonus(ii, itype, lvl >> 1, lvl, 1); + itype = RndPremiumItem(plvl >> 2, plvl) - 1; + GetItemAttrs(ii, itype, plvl); + GetItemBonus(ii, itype, plvl >> 1, plvl, 1); - item[ii]._iCreateInfo = lvl | 0x800; + item[ii]._iCreateInfo = plvl | 0x800; item[ii]._iSeed = iseed; item[ii]._iIdentified = TRUE; } diff --git a/Source/items.h b/Source/items.h index 0822c8ff09b..90ac1b8c80c 100644 --- a/Source/items.h +++ b/Source/items.h @@ -20,7 +20,7 @@ void AddInitItems(); void InitItems(); void CalcPlrItemVals(int p, BOOL Loadgfx); void CalcPlrScrolls(int p); -void CalcPlrStaff(int pnum); +void CalcPlrStaff(int p); void CalcSelfItems(int pnum); void CalcPlrItemMin(int pnum); BOOL ItemMinStats(PlayerStruct *p, ItemStruct *x); @@ -62,7 +62,7 @@ void CreateRndItem(int x, int y, BOOL onlygood, BOOL sendmsg, int delta); void SetupAllUseful(int ii, int iseed, int lvl); void CreateRndUseful(int pnum, int x, int y, BOOL sendmsg); void CreateTypeItem(int x, int y, BOOL onlygood, int itype, int imisc, BOOL sendmsg, int delta); -void RecreateItem(int ii, int idx, WORD ic, int iseed, int ivalue); +void RecreateItem(int ii, int idx, WORD icreateinfo, int iseed, int ivalue); void RecreateEar(int ii, WORD ic, int iseed, int Id, int dur, int mdur, int ch, int mch, int ivalue, int ibuff); void SpawnQuestItem(int itemid, int x, int y, int randarea, int selflag); void SpawnRock(); @@ -110,8 +110,8 @@ int RndHealerItem(int lvl); void SortHealer(); void SpawnHealer(int lvl); void SpawnStoreGold(); -void RecreateSmithItem(int ii, int idx, int plvl, int iseed); -void RecreatePremiumItem(int ii, int idx, int lvl, int iseed); +void RecreateSmithItem(int ii, int idx, int lvl, int iseed); +void RecreatePremiumItem(int ii, int idx, int plvl, int iseed); void RecreateBoyItem(int ii, int idx, int lvl, int iseed); void RecreateWitchItem(int ii, int idx, int lvl, int iseed); void RecreateHealerItem(int ii, int idx, int lvl, int iseed); diff --git a/Source/lighting.cpp b/Source/lighting.cpp index 832ec3ddd20..5c622cd7875 100644 --- a/Source/lighting.cpp +++ b/Source/lighting.cpp @@ -876,13 +876,13 @@ void MakeLightTable() tbl += 224; } - trn = LoadFileInMem("PlrGFX\\Infra.TRN", 0); + trn = LoadFileInMem("PlrGFX\\Infra.TRN", NULL); for (i = 0; i < 256; i++) { *tbl++ = trn[i]; } mem_free_dbg(trn); - trn = LoadFileInMem("PlrGFX\\Stone.TRN", 0); + trn = LoadFileInMem("PlrGFX\\Stone.TRN", NULL); for (i = 0; i < 256; i++) { *tbl++ = trn[i]; } diff --git a/Source/mainmenu.cpp b/Source/mainmenu.cpp index 537658f47e2..da7feddbedc 100644 --- a/Source/mainmenu.cpp +++ b/Source/mainmenu.cpp @@ -18,10 +18,10 @@ void mainmenu_refresh_music() } while (!menu_music_track_id || menu_music_track_id == 1); } -void __stdcall mainmenu_create_hero(int arg1, int arg2, int arg3, int arg4, char *name_1, char *name_2) +void __stdcall mainmenu_change_name(int arg1, int arg2, int arg3, int arg4, char *name_1, char *name_2) { if (UiValidPlayerName(name_2)) - pfile_create_save_file(name_1, name_2); + pfile_rename_hero(name_1, name_2); } int __stdcall mainmenu_select_hero_dialog( diff --git a/Source/mainmenu.h b/Source/mainmenu.h index a9155438ea9..c8f8221516d 100644 --- a/Source/mainmenu.h +++ b/Source/mainmenu.h @@ -5,7 +5,7 @@ extern char gszHero[16]; void mainmenu_refresh_music(); -void __stdcall mainmenu_create_hero(int arg1, int arg2, int arg3, int arg4, char *name_1, char *name_2); +void __stdcall mainmenu_change_name(int arg1, int arg2, int arg3, int arg4, char *name_1, char *name_2); int __stdcall mainmenu_select_hero_dialog( const _SNETPROGRAMDATA *client_info, const _SNETPLAYERDATA *user_info, diff --git a/Source/minitext.cpp b/Source/minitext.cpp index e2c6db6ec8d..8d558d181cf 100644 --- a/Source/minitext.cpp +++ b/Source/minitext.cpp @@ -45,8 +45,8 @@ void FreeQuestText() void InitQuestText() { - pMedTextCels = LoadFileInMem("Data\\MedTextS.CEL", 0); - pTextBoxCels = LoadFileInMem("Data\\TextBox.CEL", 0); + pMedTextCels = LoadFileInMem("Data\\MedTextS.CEL", NULL); + pTextBoxCels = LoadFileInMem("Data\\TextBox.CEL", NULL); qtextflag = FALSE; } diff --git a/Source/missiles.cpp b/Source/missiles.cpp index d3beb9a6e8a..856a07ecf9f 100644 --- a/Source/missiles.cpp +++ b/Source/missiles.cpp @@ -1103,18 +1103,18 @@ void LoadMissileGFX(BYTE mi) mfd = &misfiledata[mi]; if (mfd->mFlags & MFLAG_ALLOW_SPECIAL) { sprintf(pszName, "Missiles\\%s.CL2", mfd->mName); - file = LoadFileInMem(pszName, 0); + file = LoadFileInMem(pszName, NULL); for (i = 0; i < mfd->mAnimFAmt; i++) mfd->mAnimData[i] = &file[((int *)file)[i]]; } else if (mfd->mAnimFAmt == 1) { sprintf(pszName, "Missiles\\%s.CL2", mfd->mName); if (!mfd->mAnimData[0]) - mfd->mAnimData[0] = LoadFileInMem(pszName, 0); + mfd->mAnimData[0] = LoadFileInMem(pszName, NULL); } else { for (i = 0; i < mfd->mAnimFAmt; i++) { sprintf(pszName, "Missiles\\%s%i.CL2", mfd->mName, i + 1); if (!mfd->mAnimData[i]) { - file = LoadFileInMem(pszName, 0); + file = LoadFileInMem(pszName, NULL); mfd->mAnimData[i] = file; } } diff --git a/Source/monster.cpp b/Source/monster.cpp index 06587819edb..f5df424f137 100644 --- a/Source/monster.cpp +++ b/Source/monster.cpp @@ -553,7 +553,7 @@ void PlaceMonster(int i, int mtype, int x, int y) InitMonster(i, rd, mtype, x, y); } -void PlaceUniqueMonst(int uniqindex, int miniontype, int packsize) +void PlaceUniqueMonst(int uniqindex, int miniontype, int unpackfilesize) { int xp, yp, x, y, i; int uniqtype; @@ -747,7 +747,7 @@ void PlaceUniqueMonst(int uniqindex, int miniontype, int packsize) nummonsters++; if (Uniq->mUnqAttr & 1) { - PlaceGroup(miniontype, packsize, Uniq->mUnqAttr, nummonsters - 1); + PlaceGroup(miniontype, unpackfilesize, Uniq->mUnqAttr, nummonsters - 1); } if (Monst->_mAi != AI_GARG) { @@ -781,27 +781,27 @@ void PlaceQuestMonsters() } if (QuestStatus(QTYPE_BOL)) { - setp = LoadFileInMem("Levels\\L1Data\\Banner1.DUN", 0); + setp = LoadFileInMem("Levels\\L1Data\\Banner1.DUN", NULL); SetMapMonsters(setp, 2 * setpc_x, 2 * setpc_y); mem_free_dbg(setp); } if (QuestStatus(QTYPE_BLOOD)) { - setp = LoadFileInMem("Levels\\L2Data\\Blood2.DUN", 0); + setp = LoadFileInMem("Levels\\L2Data\\Blood2.DUN", NULL); SetMapMonsters(setp, 2 * setpc_x, 2 * setpc_y); mem_free_dbg(setp); } if (QuestStatus(QTYPE_BLIND)) { - setp = LoadFileInMem("Levels\\L2Data\\Blind2.DUN", 0); + setp = LoadFileInMem("Levels\\L2Data\\Blind2.DUN", NULL); SetMapMonsters(setp, 2 * setpc_x, 2 * setpc_y); mem_free_dbg(setp); } if (QuestStatus(QTYPE_ANVIL)) { - setp = LoadFileInMem("Levels\\L3Data\\Anvil.DUN", 0); + setp = LoadFileInMem("Levels\\L3Data\\Anvil.DUN", NULL); SetMapMonsters(setp, 2 * setpc_x + 2, 2 * setpc_y + 2); mem_free_dbg(setp); } if (QuestStatus(QTYPE_WARLRD)) { - setp = LoadFileInMem("Levels\\L4Data\\Warlord.DUN", 0); + setp = LoadFileInMem("Levels\\L4Data\\Warlord.DUN", NULL); SetMapMonsters(setp, 2 * setpc_x, 2 * setpc_y); mem_free_dbg(setp); AddMonsterType(UniqMonst[UMT_WARLORD].mtype, 1); @@ -819,7 +819,7 @@ void PlaceQuestMonsters() PlaceUniqueMonst(UMT_LAZURUS, 0, 0); PlaceUniqueMonst(UMT_RED_VEX, 0, 0); PlaceUniqueMonst(UMT_BLACKJADE, 0, 0); - setp = LoadFileInMem("Levels\\L4Data\\Vile1.DUN", 0); + setp = LoadFileInMem("Levels\\L4Data\\Vile1.DUN", NULL); SetMapMonsters(setp, 2 * setpc_x, 2 * setpc_y); mem_free_dbg(setp); } @@ -912,16 +912,16 @@ void LoadDiabMonsts() { BYTE *lpSetPiece; - lpSetPiece = LoadFileInMem("Levels\\L4Data\\diab1.DUN", 0); + lpSetPiece = LoadFileInMem("Levels\\L4Data\\diab1.DUN", NULL); SetMapMonsters(lpSetPiece, 2 * diabquad1x, 2 * diabquad1y); mem_free_dbg(lpSetPiece); - lpSetPiece = LoadFileInMem("Levels\\L4Data\\diab2a.DUN", 0); + lpSetPiece = LoadFileInMem("Levels\\L4Data\\diab2a.DUN", NULL); SetMapMonsters(lpSetPiece, 2 * diabquad2x, 2 * diabquad2y); mem_free_dbg(lpSetPiece); - lpSetPiece = LoadFileInMem("Levels\\L4Data\\diab3a.DUN", 0); + lpSetPiece = LoadFileInMem("Levels\\L4Data\\diab3a.DUN", NULL); SetMapMonsters(lpSetPiece, 2 * diabquad3x, 2 * diabquad3y); mem_free_dbg(lpSetPiece); - lpSetPiece = LoadFileInMem("Levels\\L4Data\\diab4a.DUN", 0); + lpSetPiece = LoadFileInMem("Levels\\L4Data\\diab4a.DUN", NULL); SetMapMonsters(lpSetPiece, 2 * diabquad4x, 2 * diabquad4y); mem_free_dbg(lpSetPiece); } diff --git a/Source/monster.h b/Source/monster.h index 96e03b70ec2..c59d5e69044 100644 --- a/Source/monster.h +++ b/Source/monster.h @@ -24,7 +24,7 @@ void InitMonster(int i, int rd, int mtype, int x, int y); void ClrAllMonsters(); BOOL MonstPlace(int xp, int yp); void PlaceMonster(int i, int mtype, int x, int y); -void PlaceUniqueMonst(int uniqindex, int miniontype, int packsize); +void PlaceUniqueMonst(int uniqindex, int miniontype, int unpackfilesize); void PlaceQuestMonsters(); void PlaceGroup(int mtype, int num, int leaderf, int leader); void LoadDiabMonsts(); diff --git a/Source/msg.cpp b/Source/msg.cpp index 1d6a2454f23..cad78aba082 100644 --- a/Source/msg.cpp +++ b/Source/msg.cpp @@ -974,7 +974,7 @@ void RemovePlrPortal(int pnum) sgbDeltaChanged = TRUE; } -int ParseCmd(int pnum, TCmd *pCmd) +DWORD ParseCmd(int pnum, TCmd *pCmd) { sbLastCmd = pCmd->bCmd; if (sgwPackPlrOffsetTbl[pnum] != 0 && sbLastCmd != CMD_ACK_PLRINFO && sbLastCmd != CMD_SEND_PLRINFO) @@ -984,139 +984,139 @@ int ParseCmd(int pnum, TCmd *pCmd) case CMD_SYNCDATA: return On_SYNCDATA(pCmd, pnum); case CMD_WALKXY: - return On_WALKXY((TCmdLoc *)pCmd, pnum); + return On_WALKXY(pCmd, pnum); case CMD_ADDSTR: - return On_ADDSTR((TCmdParam1 *)pCmd, pnum); + return On_ADDSTR(pCmd, pnum); case CMD_ADDDEX: - return On_ADDDEX((TCmdParam1 *)pCmd, pnum); + return On_ADDDEX(pCmd, pnum); case CMD_ADDMAG: - return On_ADDMAG((TCmdParam1 *)pCmd, pnum); + return On_ADDMAG(pCmd, pnum); case CMD_ADDVIT: - return On_ADDVIT((TCmdParam1 *)pCmd, pnum); + return On_ADDVIT(pCmd, pnum); case CMD_SBSPELL: - return On_SBSPELL((TCmdParam1 *)pCmd, pnum); + return On_SBSPELL(pCmd, pnum); case CMD_GOTOGETITEM: - return On_GOTOGETITEM((TCmdLocParam1 *)pCmd, pnum); + return On_GOTOGETITEM(pCmd, pnum); case CMD_REQUESTGITEM: - return On_REQUESTGITEM((TCmdGItem *)pCmd, pnum); + return On_REQUESTGITEM(pCmd, pnum); case CMD_GETITEM: - return On_GETITEM((TCmdGItem *)pCmd, pnum); + return On_GETITEM(pCmd, pnum); case CMD_GOTOAGETITEM: - return On_GOTOAGETITEM((TCmdLocParam1 *)pCmd, pnum); + return On_GOTOAGETITEM(pCmd, pnum); case CMD_REQUESTAGITEM: - return On_REQUESTAGITEM((TCmdGItem *)pCmd, pnum); + return On_REQUESTAGITEM(pCmd, pnum); case CMD_AGETITEM: - return On_AGETITEM((TCmdGItem *)pCmd, pnum); + return On_AGETITEM(pCmd, pnum); case CMD_ITEMEXTRA: - return On_ITEMEXTRA((TCmdGItem *)pCmd, pnum); + return On_ITEMEXTRA(pCmd, pnum); case CMD_PUTITEM: - return On_PUTITEM((TCmdPItem *)pCmd, pnum); + return On_PUTITEM(pCmd, pnum); case CMD_SYNCPUTITEM: - return On_SYNCPUTITEM((TCmdPItem *)pCmd, pnum); + return On_SYNCPUTITEM(pCmd, pnum); case CMD_RESPAWNITEM: - return On_RESPAWNITEM((TCmdPItem *)pCmd, pnum); + return On_RESPAWNITEM(pCmd, pnum); case CMD_ATTACKXY: - return On_ATTACKXY((TCmdLoc *)pCmd, pnum); + return On_ATTACKXY(pCmd, pnum); case CMD_SATTACKXY: - return On_SATTACKXY((TCmdLoc *)pCmd, pnum); + return On_SATTACKXY(pCmd, pnum); case CMD_RATTACKXY: - return On_RATTACKXY((TCmdLoc *)pCmd, pnum); + return On_RATTACKXY(pCmd, pnum); case CMD_SPELLXYD: - return On_SPELLXYD((TCmdLocParam3 *)pCmd, pnum); + return On_SPELLXYD(pCmd, pnum); case CMD_SPELLXY: - return On_SPELLXY((TCmdLocParam2 *)pCmd, pnum); + return On_SPELLXY(pCmd, pnum); case CMD_TSPELLXY: - return On_TSPELLXY((TCmdLocParam2 *)pCmd, pnum); + return On_TSPELLXY(pCmd, pnum); case CMD_OPOBJXY: - return On_OPOBJXY((TCmdLocParam1 *)pCmd, pnum); + return On_OPOBJXY(pCmd, pnum); case CMD_DISARMXY: - return On_DISARMXY((TCmdLocParam1 *)pCmd, pnum); + return On_DISARMXY(pCmd, pnum); case CMD_OPOBJT: - return On_OPOBJT((TCmdParam1 *)pCmd, pnum); + return On_OPOBJT(pCmd, pnum); case CMD_ATTACKID: - return On_ATTACKID((TCmdParam1 *)pCmd, pnum); + return On_ATTACKID(pCmd, pnum); case CMD_ATTACKPID: - return On_ATTACKPID((TCmdParam1 *)pCmd, pnum); + return On_ATTACKPID(pCmd, pnum); case CMD_RATTACKID: - return On_RATTACKID((TCmdParam1 *)pCmd, pnum); + return On_RATTACKID(pCmd, pnum); case CMD_RATTACKPID: - return On_RATTACKPID((TCmdParam1 *)pCmd, pnum); + return On_RATTACKPID(pCmd, pnum); case CMD_SPELLID: - return On_SPELLID((TCmdParam3 *)pCmd, pnum); + return On_SPELLID(pCmd, pnum); case CMD_SPELLPID: - return On_SPELLPID((TCmdParam3 *)pCmd, pnum); + return On_SPELLPID(pCmd, pnum); case CMD_TSPELLID: - return On_TSPELLID((TCmdParam3 *)pCmd, pnum); + return On_TSPELLID(pCmd, pnum); case CMD_TSPELLPID: - return On_TSPELLPID((TCmdParam3 *)pCmd, pnum); + return On_TSPELLPID(pCmd, pnum); case CMD_KNOCKBACK: - return On_KNOCKBACK((TCmdParam1 *)pCmd, pnum); + return On_KNOCKBACK(pCmd, pnum); case CMD_RESURRECT: - return On_RESURRECT((TCmdParam1 *)pCmd, pnum); + return On_RESURRECT(pCmd, pnum); case CMD_HEALOTHER: - return On_HEALOTHER((TCmdParam1 *)pCmd, pnum); + return On_HEALOTHER(pCmd, pnum); case CMD_TALKXY: - return On_TALKXY((TCmdLocParam1 *)pCmd, pnum); + return On_TALKXY(pCmd, pnum); case CMD_DEBUG: return On_DEBUG(pCmd, pnum); case CMD_NEWLVL: - return On_NEWLVL((TCmdParam2 *)pCmd, pnum); + return On_NEWLVL(pCmd, pnum); case CMD_WARP: - return On_WARP((TCmdParam1 *)pCmd, pnum); + return On_WARP(pCmd, pnum); case CMD_MONSTDEATH: - return On_MONSTDEATH((TCmdLocParam1 *)pCmd, pnum); + return On_MONSTDEATH(pCmd, pnum); case CMD_KILLGOLEM: - return On_KILLGOLEM((TCmdLocParam1 *)pCmd, pnum); + return On_KILLGOLEM(pCmd, pnum); case CMD_AWAKEGOLEM: - return On_AWAKEGOLEM((TCmdGolem *)pCmd, pnum); + return On_AWAKEGOLEM(pCmd, pnum); case CMD_MONSTDAMAGE: - return On_MONSTDAMAGE((TCmdParam2 *)pCmd, pnum); + return On_MONSTDAMAGE(pCmd, pnum); case CMD_PLRDEAD: - return On_PLRDEAD((TCmdParam1 *)pCmd, pnum); + return On_PLRDEAD(pCmd, pnum); case CMD_PLRDAMAGE: - return On_PLRDAMAGE((TCmdDamage *)pCmd, pnum); + return On_PLRDAMAGE(pCmd, pnum); case CMD_OPENDOOR: - return On_OPENDOOR((TCmdParam1 *)pCmd, pnum); + return On_OPENDOOR(pCmd, pnum); case CMD_CLOSEDOOR: - return On_CLOSEDOOR((TCmdParam1 *)pCmd, pnum); + return On_CLOSEDOOR(pCmd, pnum); case CMD_OPERATEOBJ: - return On_OPERATEOBJ((TCmdParam1 *)pCmd, pnum); + return On_OPERATEOBJ(pCmd, pnum); case CMD_PLROPOBJ: - return On_PLROPOBJ((TCmdParam2 *)pCmd, pnum); + return On_PLROPOBJ(pCmd, pnum); case CMD_BREAKOBJ: - return On_BREAKOBJ((TCmdParam2 *)pCmd, pnum); + return On_BREAKOBJ(pCmd, pnum); case CMD_CHANGEPLRITEMS: - return On_CHANGEPLRITEMS((TCmdChItem *)pCmd, pnum); + return On_CHANGEPLRITEMS(pCmd, pnum); case CMD_DELPLRITEMS: - return On_DELPLRITEMS((TCmdDelItem *)pCmd, pnum); + return On_DELPLRITEMS(pCmd, pnum); case CMD_PLRLEVEL: - return On_PLRLEVEL((TCmdParam1 *)pCmd, pnum); + return On_PLRLEVEL(pCmd, pnum); case CMD_DROPITEM: - return On_DROPITEM((TCmdPItem *)pCmd, pnum); + return On_DROPITEM(pCmd, pnum); case CMD_ACK_PLRINFO: - return On_ACK_PLRINFO((TCmdPlrInfoHdr *)pCmd, pnum); + return On_ACK_PLRINFO(pCmd, pnum); case CMD_SEND_PLRINFO: - return On_SEND_PLRINFO((TCmdPlrInfoHdr *)pCmd, pnum); + return On_SEND_PLRINFO(pCmd, pnum); case CMD_PLAYER_JOINLEVEL: - return On_PLAYER_JOINLEVEL((TCmdLocParam1 *)pCmd, pnum); + return On_PLAYER_JOINLEVEL(pCmd, pnum); case CMD_ACTIVATEPORTAL: - return On_ACTIVATEPORTAL((TCmdLocParam3 *)pCmd, pnum); + return On_ACTIVATEPORTAL(pCmd, pnum); case CMD_DEACTIVATEPORTAL: return On_DEACTIVATEPORTAL(pCmd, pnum); case CMD_RETOWN: return On_RETOWN(pCmd, pnum); case CMD_SETSTR: - return On_SETSTR((TCmdParam1 *)pCmd, pnum); + return On_SETSTR(pCmd, pnum); case CMD_SETMAG: - return On_SETMAG((TCmdParam1 *)pCmd, pnum); + return On_SETMAG(pCmd, pnum); case CMD_SETDEX: - return On_SETDEX((TCmdParam1 *)pCmd, pnum); + return On_SETDEX(pCmd, pnum); case CMD_SETVIT: - return On_SETVIT((TCmdParam1 *)pCmd, pnum); + return On_SETVIT(pCmd, pnum); case CMD_STRING: - return On_STRING((TCmdString *)pCmd, pnum); + return On_STRING(pCmd, pnum); case CMD_SYNCQUEST: - return On_SYNCQUEST((TCmdQuest *)pCmd, pnum); + return On_SYNCQUEST(pCmd, pnum); case CMD_ENDSHIELD: return On_ENDSHIELD(pCmd, pnum); case CMD_CHEAT_EXPERIENCE: @@ -1124,7 +1124,7 @@ int ParseCmd(int pnum, TCmd *pCmd) case CMD_CHEAT_SPELL_LEVEL: return On_CHEAT_SPELL_LEVEL(pCmd, pnum); case CMD_NOVA: - return On_NOVA((TCmdLoc *)pCmd, pnum); + return On_NOVA(pCmd, pnum); case CMD_SETSHIELD: return On_SETSHIELD(pCmd, pnum); case CMD_REMSHIELD: @@ -1139,11 +1139,9 @@ int ParseCmd(int pnum, TCmd *pCmd) return On_DLEVEL(pnum, pCmd); } -int On_DLEVEL(int pnum, TCmd *pCmd) +DWORD On_DLEVEL(int pnum, TCmd *pCmd) { - TCmdPlrInfoHdr *p; - - p = (TCmdPlrInfoHdr *)pCmd; + TCmdPlrInfoHdr *p = (TCmdPlrInfoHdr *)pCmd; if (gbDeltaSender != pnum) { if (p->bCmd == CMD_DLEVEL_END) { @@ -1286,67 +1284,79 @@ void DeltaImportJunk(BYTE *src) } } -int On_SYNCDATA(void *packet, int pnum) +DWORD On_SYNCDATA(TCmd *pCmd, int pnum) { - return sync_update(pnum, (const BYTE *)packet); + return sync_update(pnum, (const BYTE *)pCmd); } -int On_WALKXY(TCmdLoc *pCmd, int pnum) +DWORD On_WALKXY(TCmd *pCmd, int pnum) { + TCmdLoc *p = (TCmdLoc *)pCmd; + if (gbBufferMsgs != 1 && currlevel == plr[pnum].plrlevel) { ClrPlrPath(pnum); - MakePlrPath(pnum, pCmd->x, pCmd->y, TRUE); + MakePlrPath(pnum, p->x, p->y, TRUE); plr[pnum].destAction = ACTION_NONE; } - return sizeof(*pCmd); + return sizeof(*p); } -int On_ADDSTR(TCmdParam1 *pCmd, int pnum) +DWORD On_ADDSTR(TCmd *pCmd, int pnum) { + TCmdParam1 *p = (TCmdParam1 *)pCmd; + if (gbBufferMsgs == 1) - msg_send_packet(pnum, pCmd, sizeof(*pCmd)); - else if (pCmd->wParam1 <= 256) - ModifyPlrStr(pnum, pCmd->wParam1); + msg_send_packet(pnum, p, sizeof(*p)); + else if (p->wParam1 <= 256) + ModifyPlrStr(pnum, p->wParam1); - return sizeof(*pCmd); + return sizeof(*p); } -int On_ADDMAG(TCmdParam1 *pCmd, int pnum) +DWORD On_ADDMAG(TCmd *pCmd, int pnum) { + TCmdParam1 *p = (TCmdParam1 *)pCmd; + if (gbBufferMsgs == 1) - msg_send_packet(pnum, pCmd, sizeof(*pCmd)); - else if (pCmd->wParam1 <= 256) - ModifyPlrMag(pnum, pCmd->wParam1); + msg_send_packet(pnum, p, sizeof(*p)); + else if (p->wParam1 <= 256) + ModifyPlrMag(pnum, p->wParam1); - return sizeof(*pCmd); + return sizeof(*p); } -int On_ADDDEX(TCmdParam1 *pCmd, int pnum) +DWORD On_ADDDEX(TCmd *pCmd, int pnum) { + TCmdParam1 *p = (TCmdParam1 *)pCmd; + if (gbBufferMsgs == 1) - msg_send_packet(pnum, pCmd, sizeof(*pCmd)); - else if (pCmd->wParam1 <= 256) - ModifyPlrDex(pnum, pCmd->wParam1); + msg_send_packet(pnum, p, sizeof(*p)); + else if (p->wParam1 <= 256) + ModifyPlrDex(pnum, p->wParam1); - return sizeof(*pCmd); + return sizeof(*p); } -int On_ADDVIT(TCmdParam1 *pCmd, int pnum) +DWORD On_ADDVIT(TCmd *pCmd, int pnum) { + TCmdParam1 *p = (TCmdParam1 *)pCmd; + if (gbBufferMsgs == 1) - msg_send_packet(pnum, pCmd, sizeof(*pCmd)); - else if (pCmd->wParam1 <= 256) - ModifyPlrVit(pnum, pCmd->wParam1); + msg_send_packet(pnum, p, sizeof(*p)); + else if (p->wParam1 <= 256) + ModifyPlrVit(pnum, p->wParam1); - return sizeof(*pCmd); + return sizeof(*p); } -int On_SBSPELL(TCmdParam1 *pCmd, int pnum) +DWORD On_SBSPELL(TCmd *pCmd, int pnum) { + TCmdParam1 *p = (TCmdParam1 *)pCmd; + if (gbBufferMsgs != 1) { - if (currlevel != 0 || spelldata[pCmd->wParam1].sTownSpell) { - plr[pnum]._pSpell = pCmd->wParam1; + if (currlevel != 0 || spelldata[p->wParam1].sTownSpell) { + plr[pnum]._pSpell = p->wParam1; plr[pnum]._pSplType = plr[pnum]._pSBkSplType; plr[pnum]._pSplFrom = 1; plr[pnum].destAction = ACTION_SPELL; @@ -1354,7 +1364,7 @@ int On_SBSPELL(TCmdParam1 *pCmd, int pnum) msg_errorf("%s has cast an illegal spell.", plr[pnum]._pName); } - return sizeof(*pCmd); + return sizeof(*p); } void __cdecl msg_errorf(const char *pszFmt, ...) @@ -1374,35 +1384,39 @@ void __cdecl msg_errorf(const char *pszFmt, ...) va_end(va); } -int On_GOTOGETITEM(TCmdLocParam1 *pCmd, int pnum) +DWORD On_GOTOGETITEM(TCmd *pCmd, int pnum) { + TCmdLocParam1 *p = (TCmdLocParam1 *)pCmd; + if (gbBufferMsgs != 1 && currlevel == plr[pnum].plrlevel) { - MakePlrPath(pnum, pCmd->x, pCmd->y, FALSE); + MakePlrPath(pnum, p->x, p->y, FALSE); plr[pnum].destAction = ACTION_PICKUPITEM; - plr[pnum].destParam1 = pCmd->wParam1; + plr[pnum].destParam1 = p->wParam1; } - return sizeof(*pCmd); + return sizeof(*p); } -int On_REQUESTGITEM(TCmdGItem *pCmd, int pnum) +DWORD On_REQUESTGITEM(TCmd *pCmd, int pnum) { + TCmdGItem *p = (TCmdGItem *)pCmd; + if (gbBufferMsgs != 1 && i_own_level(plr[pnum].plrlevel)) { - if (GetItemRecord(pCmd->dwSeed, pCmd->wCI, pCmd->wIndx)) { - int ii = FindGetItem(pCmd->wIndx, pCmd->wCI, pCmd->dwSeed); + if (GetItemRecord(p->dwSeed, p->wCI, p->wIndx)) { + int ii = FindGetItem(p->wIndx, p->wCI, p->dwSeed); if (ii != -1) { - NetSendCmdGItem2(FALSE, CMD_GETITEM, myplr, pCmd->bPnum, pCmd); - if (pCmd->bPnum != myplr) - SyncGetItem(pCmd->x, pCmd->y, pCmd->wIndx, pCmd->wCI, pCmd->dwSeed); + NetSendCmdGItem2(FALSE, CMD_GETITEM, myplr, p->bPnum, p); + if (p->bPnum != myplr) + SyncGetItem(p->x, p->y, p->wIndx, p->wCI, p->dwSeed); else InvGetItem(myplr, ii); - SetItemRecord(pCmd->dwSeed, pCmd->wCI, pCmd->wIndx); - } else if (!NetSendCmdReq2(CMD_REQUESTGITEM, myplr, pCmd->bPnum, pCmd)) - NetSendCmdExtra(pCmd); + SetItemRecord(p->dwSeed, p->wCI, p->wIndx); + } else if (!NetSendCmdReq2(CMD_REQUESTGITEM, myplr, p->bPnum, p)) + NetSendCmdExtra(p); } } - return sizeof(*pCmd); + return sizeof(*p); } BOOL i_own_level(int nReqLevel) @@ -1420,29 +1434,31 @@ BOOL i_own_level(int nReqLevel) return i == myplr; } -int On_GETITEM(TCmdGItem *pCmd, int pnum) +DWORD On_GETITEM(TCmd *pCmd, int pnum) { + TCmdGItem *p = (TCmdGItem *)pCmd; + if (gbBufferMsgs == 1) - msg_send_packet(pnum, pCmd, sizeof(*pCmd)); + msg_send_packet(pnum, p, sizeof(*p)); else { - int ii = FindGetItem(pCmd->wIndx, pCmd->wCI, pCmd->dwSeed); - if (delta_get_item(pCmd, pCmd->bLevel)) { - if ((currlevel == pCmd->bLevel || pCmd->bPnum == myplr) && pCmd->bMaster != myplr) { - if (pCmd->bPnum == myplr) { - if (currlevel != pCmd->bLevel) { - ii = SyncPutItem(myplr, plr[myplr].WorldX, plr[myplr].WorldY, pCmd->wIndx, pCmd->wCI, pCmd->dwSeed, pCmd->bId, pCmd->bDur, pCmd->bMDur, pCmd->bCh, pCmd->bMCh, pCmd->wValue, pCmd->dwBuff); + int ii = FindGetItem(p->wIndx, p->wCI, p->dwSeed); + if (delta_get_item(p, p->bLevel)) { + if ((currlevel == p->bLevel || p->bPnum == myplr) && p->bMaster != myplr) { + if (p->bPnum == myplr) { + if (currlevel != p->bLevel) { + ii = SyncPutItem(myplr, plr[myplr].WorldX, plr[myplr].WorldY, p->wIndx, p->wCI, p->dwSeed, p->bId, p->bDur, p->bMDur, p->bCh, p->bMCh, p->wValue, p->dwBuff); if (ii != -1) InvGetItem(myplr, ii); } else InvGetItem(myplr, ii); } else - SyncGetItem(pCmd->x, pCmd->y, pCmd->wIndx, pCmd->wCI, pCmd->dwSeed); + SyncGetItem(p->x, p->y, p->wIndx, p->wCI, p->dwSeed); } } else - NetSendCmdGItem2(TRUE, CMD_GETITEM, pCmd->bMaster, pCmd->bPnum, pCmd); + NetSendCmdGItem2(TRUE, CMD_GETITEM, p->bMaster, p->bPnum, p); } - return sizeof(*pCmd); + return sizeof(*p); } BOOL delta_get_item(TCmdGItem *pI, BYTE bLevel) @@ -1505,98 +1521,108 @@ BOOL delta_get_item(TCmdGItem *pI, BYTE bLevel) return result; } -int On_GOTOAGETITEM(TCmdLocParam1 *pCmd, int pnum) +DWORD On_GOTOAGETITEM(TCmd *pCmd, int pnum) { + TCmdLocParam1 *p = (TCmdLocParam1 *)pCmd; + if (gbBufferMsgs != 1 && currlevel == plr[pnum].plrlevel) { - MakePlrPath(pnum, pCmd->x, pCmd->y, FALSE); + MakePlrPath(pnum, p->x, p->y, FALSE); plr[pnum].destAction = ACTION_PICKUPAITEM; - plr[pnum].destParam1 = pCmd->wParam1; + plr[pnum].destParam1 = p->wParam1; } - return sizeof(*pCmd); + return sizeof(*p); } -int On_REQUESTAGITEM(TCmdGItem *pCmd, int pnum) +DWORD On_REQUESTAGITEM(TCmd *pCmd, int pnum) { + TCmdGItem *p = (TCmdGItem *)pCmd; + if (gbBufferMsgs != 1 && i_own_level(plr[pnum].plrlevel)) { - if (GetItemRecord(pCmd->dwSeed, pCmd->wCI, pCmd->wIndx)) { - int ii = FindGetItem(pCmd->wIndx, pCmd->wCI, pCmd->dwSeed); + if (GetItemRecord(p->dwSeed, p->wCI, p->wIndx)) { + int ii = FindGetItem(p->wIndx, p->wCI, p->dwSeed); if (ii != -1) { - NetSendCmdGItem2(FALSE, CMD_AGETITEM, myplr, pCmd->bPnum, pCmd); - if (pCmd->bPnum != myplr) - SyncGetItem(pCmd->x, pCmd->y, pCmd->wIndx, pCmd->wCI, pCmd->dwSeed); + NetSendCmdGItem2(FALSE, CMD_AGETITEM, myplr, p->bPnum, p); + if (p->bPnum != myplr) + SyncGetItem(p->x, p->y, p->wIndx, p->wCI, p->dwSeed); else - AutoGetItem(myplr, pCmd->bCursitem); - SetItemRecord(pCmd->dwSeed, pCmd->wCI, pCmd->wIndx); - } else if (!NetSendCmdReq2(CMD_REQUESTAGITEM, myplr, pCmd->bPnum, pCmd)) - NetSendCmdExtra(pCmd); + AutoGetItem(myplr, p->bCursitem); + SetItemRecord(p->dwSeed, p->wCI, p->wIndx); + } else if (!NetSendCmdReq2(CMD_REQUESTAGITEM, myplr, p->bPnum, p)) + NetSendCmdExtra(p); } } - return sizeof(*pCmd); + return sizeof(*p); } -int On_AGETITEM(TCmdGItem *pCmd, int pnum) +DWORD On_AGETITEM(TCmd *pCmd, int pnum) { + TCmdGItem *p = (TCmdGItem *)pCmd; + if (gbBufferMsgs == 1) - msg_send_packet(pnum, pCmd, sizeof(*pCmd)); + msg_send_packet(pnum, p, sizeof(*p)); else { - FindGetItem(pCmd->wIndx, pCmd->wCI, pCmd->dwSeed); - if (delta_get_item(pCmd, pCmd->bLevel)) { - if ((currlevel == pCmd->bLevel || pCmd->bPnum == myplr) && pCmd->bMaster != myplr) { - if (pCmd->bPnum == myplr) { - if (currlevel != pCmd->bLevel) { - int ii = SyncPutItem(myplr, plr[myplr].WorldX, plr[myplr].WorldY, pCmd->wIndx, pCmd->wCI, pCmd->dwSeed, pCmd->bId, pCmd->bDur, pCmd->bMDur, pCmd->bCh, pCmd->bMCh, pCmd->wValue, pCmd->dwBuff); + FindGetItem(p->wIndx, p->wCI, p->dwSeed); + if (delta_get_item(p, p->bLevel)) { + if ((currlevel == p->bLevel || p->bPnum == myplr) && p->bMaster != myplr) { + if (p->bPnum == myplr) { + if (currlevel != p->bLevel) { + int ii = SyncPutItem(myplr, plr[myplr].WorldX, plr[myplr].WorldY, p->wIndx, p->wCI, p->dwSeed, p->bId, p->bDur, p->bMDur, p->bCh, p->bMCh, p->wValue, p->dwBuff); if (ii != -1) AutoGetItem(myplr, ii); } else - AutoGetItem(myplr, pCmd->bCursitem); + AutoGetItem(myplr, p->bCursitem); } else - SyncGetItem(pCmd->x, pCmd->y, pCmd->wIndx, pCmd->wCI, pCmd->dwSeed); + SyncGetItem(p->x, p->y, p->wIndx, p->wCI, p->dwSeed); } } else - NetSendCmdGItem2(TRUE, CMD_AGETITEM, pCmd->bMaster, pCmd->bPnum, pCmd); + NetSendCmdGItem2(TRUE, CMD_AGETITEM, p->bMaster, p->bPnum, p); } - return sizeof(*pCmd); + return sizeof(*p); } -int On_ITEMEXTRA(TCmdGItem *pCmd, int pnum) +DWORD On_ITEMEXTRA(TCmd *pCmd, int pnum) { + TCmdGItem *p = (TCmdGItem *)pCmd; + if (gbBufferMsgs == 1) - msg_send_packet(pnum, pCmd, sizeof(*pCmd)); + msg_send_packet(pnum, p, sizeof(*p)); else { - delta_get_item(pCmd, pCmd->bLevel); + delta_get_item(p, p->bLevel); if (currlevel == plr[pnum].plrlevel) - SyncGetItem(pCmd->x, pCmd->y, pCmd->wIndx, pCmd->wCI, pCmd->dwSeed); + SyncGetItem(p->x, p->y, p->wIndx, p->wCI, p->dwSeed); } - return sizeof(*pCmd); + return sizeof(*p); } -int On_PUTITEM(TCmdPItem *pCmd, int pnum) +DWORD On_PUTITEM(TCmd *pCmd, int pnum) { + TCmdPItem *p = (TCmdPItem *)pCmd; + if (gbBufferMsgs == 1) - msg_send_packet(pnum, pCmd, sizeof(*pCmd)); + msg_send_packet(pnum, p, sizeof(*p)); else if (currlevel == plr[pnum].plrlevel) { int ii; if (pnum == myplr) - ii = InvPutItem(pnum, pCmd->x, pCmd->y); + ii = InvPutItem(pnum, p->x, p->y); else - ii = SyncPutItem(pnum, pCmd->x, pCmd->y, pCmd->wIndx, pCmd->wCI, pCmd->dwSeed, pCmd->bId, pCmd->bDur, pCmd->bMDur, pCmd->bCh, pCmd->bMCh, pCmd->wValue, pCmd->dwBuff); + ii = SyncPutItem(pnum, p->x, p->y, p->wIndx, p->wCI, p->dwSeed, p->bId, p->bDur, p->bMDur, p->bCh, p->bMCh, p->wValue, p->dwBuff); if (ii != -1) { - PutItemRecord(pCmd->dwSeed, pCmd->wCI, pCmd->wIndx); - delta_put_item(pCmd, item[ii]._ix, item[ii]._iy, plr[pnum].plrlevel); + PutItemRecord(p->dwSeed, p->wCI, p->wIndx); + delta_put_item(p, item[ii]._ix, item[ii]._iy, plr[pnum].plrlevel); check_update_plr(pnum); } - return sizeof(*pCmd); + return sizeof(*p); } else { - PutItemRecord(pCmd->dwSeed, pCmd->wCI, pCmd->wIndx); - delta_put_item(pCmd, pCmd->x, pCmd->y, plr[pnum].plrlevel); + PutItemRecord(p->dwSeed, p->wCI, p->wIndx); + delta_put_item(p, p->x, p->y, plr[pnum].plrlevel); check_update_plr(pnum); } - return sizeof(*pCmd); + return sizeof(*p); } void delta_put_item(TCmdPItem *pI, int x, int y, BYTE bLevel) @@ -1639,390 +1665,446 @@ void check_update_plr(int pnum) pfile_update(1); } -int On_SYNCPUTITEM(TCmdPItem *pCmd, int pnum) +DWORD On_SYNCPUTITEM(TCmd *pCmd, int pnum) { + TCmdPItem *p = (TCmdPItem *)pCmd; + if (gbBufferMsgs == 1) - msg_send_packet(pnum, pCmd, sizeof(*pCmd)); + msg_send_packet(pnum, p, sizeof(*p)); else if (currlevel == plr[pnum].plrlevel) { - int ii = SyncPutItem(pnum, pCmd->x, pCmd->y, pCmd->wIndx, pCmd->wCI, pCmd->dwSeed, pCmd->bId, pCmd->bDur, pCmd->bMDur, pCmd->bCh, pCmd->bMCh, pCmd->wValue, pCmd->dwBuff); + int ii = SyncPutItem(pnum, p->x, p->y, p->wIndx, p->wCI, p->dwSeed, p->bId, p->bDur, p->bMDur, p->bCh, p->bMCh, p->wValue, p->dwBuff); if (ii != -1) { - PutItemRecord(pCmd->dwSeed, pCmd->wCI, pCmd->wIndx); - delta_put_item(pCmd, item[ii]._ix, item[ii]._iy, plr[pnum].plrlevel); + PutItemRecord(p->dwSeed, p->wCI, p->wIndx); + delta_put_item(p, item[ii]._ix, item[ii]._iy, plr[pnum].plrlevel); check_update_plr(pnum); } - return sizeof(*pCmd); + return sizeof(*p); } else { - PutItemRecord(pCmd->dwSeed, pCmd->wCI, pCmd->wIndx); - delta_put_item(pCmd, pCmd->x, pCmd->y, plr[pnum].plrlevel); + PutItemRecord(p->dwSeed, p->wCI, p->wIndx); + delta_put_item(p, p->x, p->y, plr[pnum].plrlevel); check_update_plr(pnum); } - return sizeof(*pCmd); + return sizeof(*p); } -int On_RESPAWNITEM(TCmdPItem *pCmd, int pnum) +DWORD On_RESPAWNITEM(TCmd *pCmd, int pnum) { + TCmdPItem *p = (TCmdPItem *)pCmd; + if (gbBufferMsgs == 1) - msg_send_packet(pnum, pCmd, sizeof(*pCmd)); + msg_send_packet(pnum, p, sizeof(*p)); else { if (currlevel == plr[pnum].plrlevel && pnum != myplr) - SyncPutItem(pnum, pCmd->x, pCmd->y, pCmd->wIndx, pCmd->wCI, pCmd->dwSeed, pCmd->bId, pCmd->bDur, pCmd->bMDur, pCmd->bCh, pCmd->bMCh, pCmd->wValue, pCmd->dwBuff); - PutItemRecord(pCmd->dwSeed, pCmd->wCI, pCmd->wIndx); - delta_put_item(pCmd, pCmd->x, pCmd->y, plr[pnum].plrlevel); + SyncPutItem(pnum, p->x, p->y, p->wIndx, p->wCI, p->dwSeed, p->bId, p->bDur, p->bMDur, p->bCh, p->bMCh, p->wValue, p->dwBuff); + PutItemRecord(p->dwSeed, p->wCI, p->wIndx); + delta_put_item(p, p->x, p->y, plr[pnum].plrlevel); } - return sizeof(*pCmd); + return sizeof(*p); } -int On_ATTACKXY(TCmdLoc *pCmd, int pnum) +DWORD On_ATTACKXY(TCmd *pCmd, int pnum) { + TCmdLoc *p = (TCmdLoc *)pCmd; + if (gbBufferMsgs != 1 && currlevel == plr[pnum].plrlevel) { - MakePlrPath(pnum, pCmd->x, pCmd->y, FALSE); + MakePlrPath(pnum, p->x, p->y, FALSE); plr[pnum].destAction = ACTION_ATTACK; - plr[pnum].destParam1 = pCmd->x; - plr[pnum].destParam2 = pCmd->y; + plr[pnum].destParam1 = p->x; + plr[pnum].destParam2 = p->y; } - return sizeof(*pCmd); + return sizeof(*p); } -int On_SATTACKXY(TCmdLoc *pCmd, int pnum) +DWORD On_SATTACKXY(TCmd *pCmd, int pnum) { + TCmdLoc *p = (TCmdLoc *)pCmd; + if (gbBufferMsgs != 1 && currlevel == plr[pnum].plrlevel) { ClrPlrPath(pnum); plr[pnum].destAction = ACTION_ATTACK; - plr[pnum].destParam1 = pCmd->x; - plr[pnum].destParam2 = pCmd->y; + plr[pnum].destParam1 = p->x; + plr[pnum].destParam2 = p->y; } - return sizeof(*pCmd); + return sizeof(*p); } -int On_RATTACKXY(TCmdLoc *pCmd, int pnum) +DWORD On_RATTACKXY(TCmd *pCmd, int pnum) { + TCmdLoc *p = (TCmdLoc *)pCmd; + if (gbBufferMsgs != 1 && currlevel == plr[pnum].plrlevel) { ClrPlrPath(pnum); plr[pnum].destAction = ACTION_RATTACK; - plr[pnum].destParam1 = pCmd->x; - plr[pnum].destParam2 = pCmd->y; + plr[pnum].destParam1 = p->x; + plr[pnum].destParam2 = p->y; } - return sizeof(*pCmd); + return sizeof(*p); } -int On_SPELLXYD(TCmdLocParam3 *pCmd, int pnum) +DWORD On_SPELLXYD(TCmd *pCmd, int pnum) { + TCmdLocParam3 *p = (TCmdLocParam3 *)pCmd; + if (gbBufferMsgs != 1 && currlevel == plr[pnum].plrlevel) { - if (currlevel != 0 || spelldata[pCmd->wParam1].sTownSpell) { + if (currlevel != 0 || spelldata[p->wParam1].sTownSpell) { ClrPlrPath(pnum); plr[pnum].destAction = ACTION_SPELLWALL; - plr[pnum].destParam1 = pCmd->x; - plr[pnum].destParam2 = pCmd->y; - plr[pnum].destParam3 = pCmd->wParam2; - plr[pnum].destParam4 = pCmd->wParam3; - plr[pnum]._pSpell = pCmd->wParam1; + plr[pnum].destParam1 = p->x; + plr[pnum].destParam2 = p->y; + plr[pnum].destParam3 = p->wParam2; + plr[pnum].destParam4 = p->wParam3; + plr[pnum]._pSpell = p->wParam1; plr[pnum]._pSplType = plr[pnum]._pRSplType; plr[pnum]._pSplFrom = 0; } else msg_errorf("%s has cast an illegal spell.", plr[pnum]._pName); } - return sizeof(*pCmd); + return sizeof(*p); } -int On_SPELLXY(TCmdLocParam2 *pCmd, int pnum) +DWORD On_SPELLXY(TCmd *pCmd, int pnum) { + TCmdLocParam2 *p = (TCmdLocParam2 *)pCmd; + if (gbBufferMsgs != 1 && currlevel == plr[pnum].plrlevel) { - if (currlevel != 0 || spelldata[pCmd->wParam1].sTownSpell) { + if (currlevel != 0 || spelldata[p->wParam1].sTownSpell) { ClrPlrPath(pnum); plr[pnum].destAction = ACTION_SPELL; - plr[pnum].destParam1 = pCmd->x; - plr[pnum].destParam2 = pCmd->y; - plr[pnum].destParam3 = pCmd->wParam2; - plr[pnum]._pSpell = pCmd->wParam1; + plr[pnum].destParam1 = p->x; + plr[pnum].destParam2 = p->y; + plr[pnum].destParam3 = p->wParam2; + plr[pnum]._pSpell = p->wParam1; plr[pnum]._pSplType = plr[pnum]._pRSplType; plr[pnum]._pSplFrom = 0; } else msg_errorf("%s has cast an illegal spell.", plr[pnum]._pName); } - return sizeof(*pCmd); + return sizeof(*p); } -int On_TSPELLXY(TCmdLocParam2 *pCmd, int pnum) +DWORD On_TSPELLXY(TCmd *pCmd, int pnum) { + TCmdLocParam2 *p = (TCmdLocParam2 *)pCmd; + if (gbBufferMsgs != 1 && currlevel == plr[pnum].plrlevel) { - if (currlevel != 0 || spelldata[pCmd->wParam1].sTownSpell) { + if (currlevel != 0 || spelldata[p->wParam1].sTownSpell) { ClrPlrPath(pnum); plr[pnum].destAction = ACTION_SPELL; - plr[pnum].destParam1 = pCmd->x; - plr[pnum].destParam2 = pCmd->y; - plr[pnum].destParam3 = pCmd->wParam2; - plr[pnum]._pSpell = pCmd->wParam1; + plr[pnum].destParam1 = p->x; + plr[pnum].destParam2 = p->y; + plr[pnum].destParam3 = p->wParam2; + plr[pnum]._pSpell = p->wParam1; plr[pnum]._pSplType = plr[pnum]._pTSplType; plr[pnum]._pSplFrom = 2; } else msg_errorf("%s has cast an illegal spell.", plr[pnum]._pName); } - return sizeof(*pCmd); + return sizeof(*p); } -int On_OPOBJXY(TCmdLocParam1 *pCmd, int pnum) +DWORD On_OPOBJXY(TCmd *pCmd, int pnum) { + TCmdLocParam1 *p = (TCmdLocParam1 *)pCmd; + if (gbBufferMsgs != 1 && currlevel == plr[pnum].plrlevel) { - if (object[pCmd->wParam1]._oSolidFlag || object[pCmd->wParam1]._oDoorFlag) - MakePlrPath(pnum, pCmd->x, pCmd->y, FALSE); + if (object[p->wParam1]._oSolidFlag || object[p->wParam1]._oDoorFlag) + MakePlrPath(pnum, p->x, p->y, FALSE); else - MakePlrPath(pnum, pCmd->x, pCmd->y, TRUE); + MakePlrPath(pnum, p->x, p->y, TRUE); plr[pnum].destAction = ACTION_OPERATE; - plr[pnum].destParam1 = pCmd->wParam1; + plr[pnum].destParam1 = p->wParam1; } - return sizeof(*pCmd); + return sizeof(*p); } -int On_DISARMXY(TCmdLocParam1 *pCmd, int pnum) +DWORD On_DISARMXY(TCmd *pCmd, int pnum) { + TCmdLocParam1 *p = (TCmdLocParam1 *)pCmd; + if (gbBufferMsgs != 1 && currlevel == plr[pnum].plrlevel) { - if (object[pCmd->wParam1]._oSolidFlag || object[pCmd->wParam1]._oDoorFlag) - MakePlrPath(pnum, pCmd->x, pCmd->y, FALSE); + if (object[p->wParam1]._oSolidFlag || object[p->wParam1]._oDoorFlag) + MakePlrPath(pnum, p->x, p->y, FALSE); else - MakePlrPath(pnum, pCmd->x, pCmd->y, TRUE); + MakePlrPath(pnum, p->x, p->y, TRUE); plr[pnum].destAction = ACTION_DISARM; - plr[pnum].destParam1 = pCmd->wParam1; + plr[pnum].destParam1 = p->wParam1; } - return sizeof(*pCmd); + return sizeof(*p); } -int On_OPOBJT(TCmdParam1 *pCmd, int pnum) +DWORD On_OPOBJT(TCmd *pCmd, int pnum) { + TCmdParam1 *p = (TCmdParam1 *)pCmd; + if (gbBufferMsgs != 1 && currlevel == plr[pnum].plrlevel) { plr[pnum].destAction = ACTION_OPERATETK; - plr[pnum].destParam1 = pCmd->wParam1; + plr[pnum].destParam1 =p->wParam1; } - return sizeof(*pCmd); + return sizeof(*p); } -int On_ATTACKID(TCmdParam1 *pCmd, int pnum) +DWORD On_ATTACKID(TCmd *pCmd, int pnum) { + TCmdParam1 *p = (TCmdParam1 *)pCmd; + if (gbBufferMsgs != 1 && currlevel == plr[pnum].plrlevel) { - int distx = abs(plr[pnum].WorldX - monster[pCmd->wParam1]._mfutx); - int disty = abs(plr[pnum].WorldY - monster[pCmd->wParam1]._mfuty); + int distx = abs(plr[pnum].WorldX - monster[p->wParam1]._mfutx); + int disty = abs(plr[pnum].WorldY - monster[p->wParam1]._mfuty); if (distx > 1 || disty > 1) - MakePlrPath(pnum, monster[pCmd->wParam1]._mfutx, monster[pCmd->wParam1]._mfuty, FALSE); + MakePlrPath(pnum, monster[p->wParam1]._mfutx, monster[p->wParam1]._mfuty, FALSE); plr[pnum].destAction = ACTION_ATTACKMON; - plr[pnum].destParam1 = pCmd->wParam1; + plr[pnum].destParam1 = p->wParam1; } - return sizeof(*pCmd); + return sizeof(*p); } -int On_ATTACKPID(TCmdParam1 *pCmd, int pnum) +DWORD On_ATTACKPID(TCmd *pCmd, int pnum) { + TCmdParam1 *p = (TCmdParam1 *)pCmd; + if (gbBufferMsgs != 1 && currlevel == plr[pnum].plrlevel) { - MakePlrPath(pnum, plr[pCmd->wParam1]._px, plr[pCmd->wParam1]._py, FALSE); + MakePlrPath(pnum, plr[p->wParam1]._px, plr[p->wParam1]._py, FALSE); plr[pnum].destAction = ACTION_ATTACKPLR; - plr[pnum].destParam1 = pCmd->wParam1; + plr[pnum].destParam1 = p->wParam1; } - return sizeof(*pCmd); + return sizeof(*p); } -int On_RATTACKID(TCmdParam1 *pCmd, int pnum) +DWORD On_RATTACKID(TCmd *pCmd, int pnum) { + TCmdParam1 *p = (TCmdParam1 *)pCmd; + if (gbBufferMsgs != 1 && currlevel == plr[pnum].plrlevel) { ClrPlrPath(pnum); plr[pnum].destAction = ACTION_RATTACKMON; - plr[pnum].destParam1 = pCmd->wParam1; + plr[pnum].destParam1 = p->wParam1; } - return sizeof(*pCmd); + return sizeof(*p); } -int On_RATTACKPID(TCmdParam1 *pCmd, int pnum) +DWORD On_RATTACKPID(TCmd *pCmd, int pnum) { + TCmdParam1 *p = (TCmdParam1 *)pCmd; + if (gbBufferMsgs != 1 && currlevel == plr[pnum].plrlevel) { ClrPlrPath(pnum); plr[pnum].destAction = ACTION_RATTACKPLR; - plr[pnum].destParam1 = pCmd->wParam1; + plr[pnum].destParam1 = p->wParam1; } - return sizeof(*pCmd); + return sizeof(*p); } -int On_SPELLID(TCmdParam3 *pCmd, int pnum) +DWORD On_SPELLID(TCmd *pCmd, int pnum) { + TCmdParam3 *p = (TCmdParam3 *)pCmd; + if (gbBufferMsgs != 1 && currlevel == plr[pnum].plrlevel) { - if (currlevel != 0 || spelldata[pCmd->wParam2].sTownSpell) { + if (currlevel != 0 || spelldata[p->wParam2].sTownSpell) { ClrPlrPath(pnum); plr[pnum].destAction = ACTION_SPELLMON; - plr[pnum].destParam1 = pCmd->wParam1; - plr[pnum].destParam2 = pCmd->wParam3; - plr[pnum]._pSpell = pCmd->wParam2; + plr[pnum].destParam1 = p->wParam1; + plr[pnum].destParam2 = p->wParam3; + plr[pnum]._pSpell = p->wParam2; plr[pnum]._pSplType = plr[pnum]._pRSplType; plr[pnum]._pSplFrom = 0; } else msg_errorf("%s has cast an illegal spell.", plr[pnum]._pName); } - return sizeof(*pCmd); + return sizeof(*p); } -int On_SPELLPID(TCmdParam3 *pCmd, int pnum) +DWORD On_SPELLPID(TCmd *pCmd, int pnum) { + TCmdParam3 *p = (TCmdParam3 *)pCmd; + if (gbBufferMsgs != 1 && currlevel == plr[pnum].plrlevel) { - if (currlevel != 0 || spelldata[pCmd->wParam2].sTownSpell) { + if (currlevel != 0 || spelldata[p->wParam2].sTownSpell) { ClrPlrPath(pnum); plr[pnum].destAction = ACTION_SPELLPLR; - plr[pnum].destParam1 = pCmd->wParam1; - plr[pnum].destParam2 = pCmd->wParam3; - plr[pnum]._pSpell = pCmd->wParam2; + plr[pnum].destParam1 = p->wParam1; + plr[pnum].destParam2 = p->wParam3; + plr[pnum]._pSpell = p->wParam2; plr[pnum]._pSplType = plr[pnum]._pRSplType; plr[pnum]._pSplFrom = 0; } else msg_errorf("%s has cast an illegal spell.", plr[pnum]._pName); } - return sizeof(*pCmd); + return sizeof(*p); } -int On_TSPELLID(TCmdParam3 *pCmd, int pnum) +DWORD On_TSPELLID(TCmd *pCmd, int pnum) { + TCmdParam3 *p = (TCmdParam3 *)pCmd; + if (gbBufferMsgs != 1 && currlevel == plr[pnum].plrlevel) { - if (currlevel != 0 || spelldata[pCmd->wParam2].sTownSpell) { + if (currlevel != 0 || spelldata[p->wParam2].sTownSpell) { ClrPlrPath(pnum); plr[pnum].destAction = ACTION_SPELLMON; - plr[pnum].destParam1 = pCmd->wParam1; - plr[pnum].destParam2 = pCmd->wParam3; - plr[pnum]._pSpell = pCmd->wParam2; + plr[pnum].destParam1 = p->wParam1; + plr[pnum].destParam2 = p->wParam3; + plr[pnum]._pSpell = p->wParam2; plr[pnum]._pSplType = plr[pnum]._pTSplType; plr[pnum]._pSplFrom = 2; } else msg_errorf("%s has cast an illegal spell.", plr[pnum]._pName); } - return sizeof(*pCmd); + return sizeof(*p); } -int On_TSPELLPID(TCmdParam3 *pCmd, int pnum) +DWORD On_TSPELLPID(TCmd *pCmd, int pnum) { + TCmdParam3 *p = (TCmdParam3 *)pCmd; + if (gbBufferMsgs != 1 && currlevel == plr[pnum].plrlevel) { - if (currlevel != 0 || spelldata[pCmd->wParam2].sTownSpell) { + if (currlevel != 0 || spelldata[p->wParam2].sTownSpell) { ClrPlrPath(pnum); plr[pnum].destAction = ACTION_SPELLPLR; - plr[pnum].destParam1 = pCmd->wParam1; - plr[pnum].destParam2 = pCmd->wParam3; - plr[pnum]._pSpell = pCmd->wParam2; + plr[pnum].destParam1 = p->wParam1; + plr[pnum].destParam2 = p->wParam3; + plr[pnum]._pSpell = p->wParam2; plr[pnum]._pSplType = plr[pnum]._pTSplType; plr[pnum]._pSplFrom = 2; } else msg_errorf("%s has cast an illegal spell.", plr[pnum]._pName); } - return sizeof(*pCmd); + return sizeof(*p); } -int On_KNOCKBACK(TCmdParam1 *pCmd, int pnum) +DWORD On_KNOCKBACK(TCmd *pCmd, int pnum) { + TCmdParam1 *p = (TCmdParam1 *)pCmd; + if (gbBufferMsgs != 1 && currlevel == plr[pnum].plrlevel) { - M_GetKnockback(pCmd->wParam1); - M_StartHit(pCmd->wParam1, pnum, 0); + M_GetKnockback(p->wParam1); + M_StartHit(p->wParam1, pnum, 0); } - return sizeof(*pCmd); + return sizeof(*p); } -int On_RESURRECT(TCmdParam1 *pCmd, int pnum) +DWORD On_RESURRECT(TCmd *pCmd, int pnum) { + TCmdParam1 *p = (TCmdParam1 *)pCmd; + if (gbBufferMsgs == 1) - msg_send_packet(pnum, pCmd, sizeof(*pCmd)); + msg_send_packet(pnum, p, sizeof(*p)); else { - DoResurrect(pnum, pCmd->wParam1); + DoResurrect(pnum, p->wParam1); check_update_plr(pnum); } - return sizeof(*pCmd); + return sizeof(*p); } -int On_HEALOTHER(TCmdParam1 *pCmd, int pnum) +DWORD On_HEALOTHER(TCmd *pCmd, int pnum) { + TCmdParam1 *p = (TCmdParam1 *)pCmd; + if (gbBufferMsgs != 1 && currlevel == plr[pnum].plrlevel) - DoHealOther(pnum, pCmd->wParam1); + DoHealOther(pnum, p->wParam1); - return sizeof(*pCmd); + return sizeof(*p); } -int On_TALKXY(TCmdLocParam1 *pCmd, int pnum) +DWORD On_TALKXY(TCmd *pCmd, int pnum) { + TCmdLocParam1 *p = (TCmdLocParam1 *)pCmd; + if (gbBufferMsgs != 1 && currlevel == plr[pnum].plrlevel) { - MakePlrPath(pnum, pCmd->x, pCmd->y, FALSE); + MakePlrPath(pnum, p->x, p->y, FALSE); plr[pnum].destAction = ACTION_TALK; - plr[pnum].destParam1 = pCmd->wParam1; + plr[pnum].destParam1 = p->wParam1; } - return sizeof(*pCmd); + return sizeof(*p); } -int On_NEWLVL(TCmdParam2 *pCmd, int pnum) +DWORD On_NEWLVL(TCmd *pCmd, int pnum) { + TCmdParam2 *p = (TCmdParam2 *)pCmd; + if (gbBufferMsgs == 1) - msg_send_packet(pnum, pCmd, sizeof(*pCmd)); + msg_send_packet(pnum, p, sizeof(*p)); else if (pnum != myplr) - StartNewLvl(pnum, pCmd->wParam1, pCmd->wParam2); + StartNewLvl(pnum, p->wParam1, p->wParam2); - return sizeof(*pCmd); + return sizeof(*p); } -int On_WARP(TCmdParam1 *pCmd, int pnum) +DWORD On_WARP(TCmd *pCmd, int pnum) { + TCmdParam1 *p = (TCmdParam1 *)pCmd; + if (gbBufferMsgs == 1) - msg_send_packet(pnum, pCmd, sizeof(*pCmd)); + msg_send_packet(pnum, p, sizeof(*p)); else { - StartWarpLvl(pnum, pCmd->wParam1); + StartWarpLvl(pnum, p->wParam1); if (pnum == myplr && pcurs >= CURSOR_FIRSTITEM) { item[MAXITEMS] = plr[myplr].HoldItem; AutoGetItem(myplr, MAXITEMS); } } - return sizeof(*pCmd); + return sizeof(*p); } -int On_MONSTDEATH(TCmdLocParam1 *pCmd, int pnum) +DWORD On_MONSTDEATH(TCmd *pCmd, int pnum) { + TCmdLocParam1 *p = (TCmdLocParam1 *)pCmd; + if (gbBufferMsgs == 1) - msg_send_packet(pnum, pCmd, sizeof(*pCmd)); + msg_send_packet(pnum, p, sizeof(*p)); else if (pnum != myplr) { if (currlevel == plr[pnum].plrlevel) - M_SyncStartKill(pCmd->wParam1, pCmd->x, pCmd->y, pnum); - delta_kill_monster(pCmd->wParam1, pCmd->x, pCmd->y, plr[pnum].plrlevel); + M_SyncStartKill(p->wParam1, p->x, p->y, pnum); + delta_kill_monster(p->wParam1, p->x, p->y, plr[pnum].plrlevel); } - return sizeof(*pCmd); + return sizeof(*p); } -int On_KILLGOLEM(TCmdLocParam1 *pCmd, int pnum) +DWORD On_KILLGOLEM(TCmd *pCmd, int pnum) { + TCmdLocParam1 *p = (TCmdLocParam1 *)pCmd; + if (gbBufferMsgs == 1) - msg_send_packet(pnum, pCmd, sizeof(*pCmd)); + msg_send_packet(pnum, p, sizeof(*p)); else if (pnum != myplr) { - if (currlevel == pCmd->wParam1) - M_SyncStartKill(pnum, pCmd->x, pCmd->y, pnum); - delta_kill_monster(pnum, pCmd->x, pCmd->y, plr[pnum].plrlevel); + if (currlevel == p->wParam1) + M_SyncStartKill(pnum, p->x, p->y, pnum); + delta_kill_monster(pnum, p->x, p->y, plr[pnum].plrlevel); } - return sizeof(*pCmd); + return sizeof(*p); } -int On_AWAKEGOLEM(TCmdGolem *pCmd, int pnum) +DWORD On_AWAKEGOLEM(TCmd *pCmd, int pnum) { + TCmdGolem *p = (TCmdGolem *)pCmd; + if (gbBufferMsgs == 1) - msg_send_packet(pnum, pCmd, sizeof(*pCmd)); + msg_send_packet(pnum, p, sizeof(*p)); else if (currlevel != plr[pnum].plrlevel) - delta_sync_golem(pCmd, pnum, pCmd->_currlevel); + delta_sync_golem(p, pnum, p->_currlevel); else if (pnum != myplr) { int i; // check if this player already has an active golem @@ -2035,52 +2117,58 @@ int On_AWAKEGOLEM(TCmdGolem *pCmd, int pnum) } } if (addGolem) - AddMissile(plr[pnum].WorldX, plr[pnum].WorldY, pCmd->_mx, pCmd->_my, pCmd->_mdir, MIS_GOLEM, 0, pnum, 0, 1); + AddMissile(plr[pnum].WorldX, plr[pnum].WorldY, p->_mx, p->_my, p->_mdir, MIS_GOLEM, 0, pnum, 0, 1); } - return sizeof(*pCmd); + return sizeof(*p); } -int On_MONSTDAMAGE(TCmdParam2 *pCmd, int pnum) +DWORD On_MONSTDAMAGE(TCmd *pCmd, int pnum) { + TCmdParam2 *p = (TCmdParam2 *)pCmd; + if (gbBufferMsgs == 1) - msg_send_packet(pnum, pCmd, sizeof(*pCmd)); + msg_send_packet(pnum, p, sizeof(*p)); else if (pnum != myplr) { if (currlevel == plr[pnum].plrlevel) { - monster[pCmd->wParam1].mWhoHit |= 1 << pnum; + monster[p->wParam1].mWhoHit |= 1 << pnum; - if (monster[pCmd->wParam1]._mhitpoints) { - monster[pCmd->wParam1]._mhitpoints -= pCmd->wParam2; - if ((monster[pCmd->wParam1]._mhitpoints >> 6) < 1) - monster[pCmd->wParam1]._mhitpoints = 1 << 6; - delta_monster_hp(pCmd->wParam1, monster[pCmd->wParam1]._mhitpoints, plr[pnum].plrlevel); + if (monster[p->wParam1]._mhitpoints) { + monster[p->wParam1]._mhitpoints -= p->wParam2; + if ((monster[p->wParam1]._mhitpoints >> 6) < 1) + monster[p->wParam1]._mhitpoints = 1 << 6; + delta_monster_hp(p->wParam1, monster[p->wParam1]._mhitpoints, plr[pnum].plrlevel); } } } - return sizeof(*pCmd); + return sizeof(*p); } -int On_PLRDEAD(TCmdParam1 *pCmd, int pnum) +DWORD On_PLRDEAD(TCmd *pCmd, int pnum) { + TCmdParam1 *p = (TCmdParam1 *)pCmd; + if (gbBufferMsgs == 1) - msg_send_packet(pnum, pCmd, sizeof(*pCmd)); + msg_send_packet(pnum, p, sizeof(*p)); else if (pnum != myplr) - StartPlayerKill(pnum, pCmd->wParam1); + StartPlayerKill(pnum, p->wParam1); else check_update_plr(pnum); - return sizeof(*pCmd); + return sizeof(*p); } -int On_PLRDAMAGE(TCmdDamage *pCmd, int pnum) +DWORD On_PLRDAMAGE(TCmd *pCmd, int pnum) { - if (pCmd->bPlr == myplr && currlevel != 0) { - if (gbBufferMsgs != 1 && currlevel == plr[pnum].plrlevel && pCmd->dwDam <= 192000) { + TCmdDamage *p = (TCmdDamage *)pCmd; + + if (p->bPlr == myplr && currlevel != 0) { + if (gbBufferMsgs != 1 && currlevel == plr[pnum].plrlevel && p->dwDam <= 192000) { if ((plr[myplr]._pHitPoints >> 6) > 0) { drawhpflag = TRUE; - plr[myplr]._pHitPoints -= pCmd->dwDam; - plr[myplr]._pHPBase -= pCmd->dwDam; + plr[myplr]._pHitPoints -= p->dwDam; + plr[myplr]._pHPBase -= p->dwDam; if (plr[myplr]._pHitPoints > plr[myplr]._pMaxHP) { plr[myplr]._pHitPoints = plr[myplr]._pMaxHP; plr[myplr]._pHPBase = plr[myplr]._pMaxHPBase; @@ -2091,20 +2179,22 @@ int On_PLRDAMAGE(TCmdDamage *pCmd, int pnum) } } - return sizeof(*pCmd); + return sizeof(*p); } -int On_OPENDOOR(TCmdParam1 *pCmd, int pnum) +DWORD On_OPENDOOR(TCmd *pCmd, int pnum) { + TCmdParam1 *p = (TCmdParam1 *)pCmd; + if (gbBufferMsgs == 1) - msg_send_packet(pnum, pCmd, sizeof(*pCmd)); + msg_send_packet(pnum, p, sizeof(*p)); else { if (currlevel == plr[pnum].plrlevel) - SyncOpObject(pnum, CMD_OPENDOOR, pCmd->wParam1); - delta_sync_object(pCmd->wParam1, CMD_OPENDOOR, plr[pnum].plrlevel); + SyncOpObject(pnum, CMD_OPENDOOR, p->wParam1); + delta_sync_object(p->wParam1, CMD_OPENDOOR, plr[pnum].plrlevel); } - return sizeof(*pCmd); + return sizeof(*p); } void delta_sync_object(int oi, BYTE bCmd, BYTE bLevel) @@ -2115,117 +2205,137 @@ void delta_sync_object(int oi, BYTE bCmd, BYTE bLevel) } } -int On_CLOSEDOOR(TCmdParam1 *pCmd, int pnum) +DWORD On_CLOSEDOOR(TCmd *pCmd, int pnum) { + TCmdParam1 *p = (TCmdParam1 *)pCmd; + if (gbBufferMsgs == 1) - msg_send_packet(pnum, pCmd, sizeof(*pCmd)); + msg_send_packet(pnum, p, sizeof(*p)); else { if (currlevel == plr[pnum].plrlevel) - SyncOpObject(pnum, CMD_CLOSEDOOR, pCmd->wParam1); - delta_sync_object(pCmd->wParam1, CMD_CLOSEDOOR, plr[pnum].plrlevel); + SyncOpObject(pnum, CMD_CLOSEDOOR, p->wParam1); + delta_sync_object(p->wParam1, CMD_CLOSEDOOR, plr[pnum].plrlevel); } - return sizeof(*pCmd); + return sizeof(*p); } -int On_OPERATEOBJ(TCmdParam1 *pCmd, int pnum) +DWORD On_OPERATEOBJ(TCmd *pCmd, int pnum) { + TCmdParam1 *p = (TCmdParam1 *)pCmd; + if (gbBufferMsgs == 1) - msg_send_packet(pnum, pCmd, sizeof(*pCmd)); + msg_send_packet(pnum, p, sizeof(*p)); else { if (currlevel == plr[pnum].plrlevel) - SyncOpObject(pnum, CMD_OPERATEOBJ, pCmd->wParam1); - delta_sync_object(pCmd->wParam1, CMD_OPERATEOBJ, plr[pnum].plrlevel); + SyncOpObject(pnum, CMD_OPERATEOBJ, p->wParam1); + delta_sync_object(p->wParam1, CMD_OPERATEOBJ, plr[pnum].plrlevel); } - return sizeof(*pCmd); + return sizeof(*p); } -int On_PLROPOBJ(TCmdParam2 *pCmd, int pnum) +DWORD On_PLROPOBJ(TCmd *pCmd, int pnum) { + TCmdParam2 *p = (TCmdParam2 *)pCmd; + if (gbBufferMsgs == 1) - msg_send_packet(pnum, pCmd, sizeof(*pCmd)); + msg_send_packet(pnum, p, sizeof(*p)); else { if (currlevel == plr[pnum].plrlevel) - SyncOpObject(pCmd->wParam1, CMD_PLROPOBJ, pCmd->wParam2); - delta_sync_object(pCmd->wParam2, CMD_PLROPOBJ, plr[pnum].plrlevel); + SyncOpObject(p->wParam1, CMD_PLROPOBJ, p->wParam2); + delta_sync_object(p->wParam2, CMD_PLROPOBJ, plr[pnum].plrlevel); } - return sizeof(*pCmd); + return sizeof(*p); } -int On_BREAKOBJ(TCmdParam2 *pCmd, int pnum) +DWORD On_BREAKOBJ(TCmd *pCmd, int pnum) { + TCmdParam2 *p = (TCmdParam2 *)pCmd; + if (gbBufferMsgs == 1) - msg_send_packet(pnum, pCmd, sizeof(*pCmd)); + msg_send_packet(pnum, p, sizeof(*p)); else { if (currlevel == plr[pnum].plrlevel) - SyncBreakObj(pCmd->wParam1, pCmd->wParam2); - delta_sync_object(pCmd->wParam2, CMD_BREAKOBJ, plr[pnum].plrlevel); + SyncBreakObj(p->wParam1, p->wParam2); + delta_sync_object(p->wParam2, CMD_BREAKOBJ, plr[pnum].plrlevel); } - return sizeof(*pCmd); + return sizeof(*p); } -int On_CHANGEPLRITEMS(TCmdChItem *pCmd, int pnum) +DWORD On_CHANGEPLRITEMS(TCmd *pCmd, int pnum) { + TCmdChItem *p = (TCmdChItem *)pCmd; + if (gbBufferMsgs == 1) - msg_send_packet(pnum, pCmd, sizeof(*pCmd)); + msg_send_packet(pnum, p, sizeof(*p)); else if (pnum != myplr) - CheckInvSwap(pnum, pCmd->bLoc, pCmd->wIndx, pCmd->wCI, pCmd->dwSeed, pCmd->bId); + CheckInvSwap(pnum, p->bLoc, p->wIndx, p->wCI, p->dwSeed, p->bId); - return sizeof(*pCmd); + return sizeof(*p); } -int On_DELPLRITEMS(TCmdDelItem *pCmd, int pnum) +DWORD On_DELPLRITEMS(TCmd *pCmd, int pnum) { + TCmdDelItem *p = (TCmdDelItem *)pCmd; + if (gbBufferMsgs == 1) - msg_send_packet(pnum, pCmd, sizeof(*pCmd)); + msg_send_packet(pnum, p, sizeof(*p)); else if (pnum != myplr) - inv_update_rem_item(pnum, pCmd->bLoc); + inv_update_rem_item(pnum, p->bLoc); - return sizeof(*pCmd); + return sizeof(*p); } -int On_PLRLEVEL(TCmdParam1 *pCmd, int pnum) +DWORD On_PLRLEVEL(TCmd *pCmd, int pnum) { + TCmdParam1 *p = (TCmdParam1 *)pCmd; + if (gbBufferMsgs == 1) - msg_send_packet(pnum, pCmd, sizeof(*pCmd)); - else if (pCmd->wParam1 <= MAXCHARLEVEL && pnum != myplr) - plr[pnum]._pLevel = pCmd->wParam1; + msg_send_packet(pnum, p, sizeof(*p)); + else if (p->wParam1 <= MAXCHARLEVEL && pnum != myplr) + plr[pnum]._pLevel = p->wParam1; - return sizeof(*pCmd); + return sizeof(*p); } -int On_DROPITEM(TCmdPItem *pCmd, int pnum) +DWORD On_DROPITEM(TCmd *pCmd, int pnum) { + TCmdPItem *p = (TCmdPItem *)pCmd; + if (gbBufferMsgs == 1) - msg_send_packet(pnum, pCmd, sizeof(*pCmd)); + msg_send_packet(pnum, p, sizeof(*p)); else - delta_put_item(pCmd, pCmd->x, pCmd->y, plr[pnum].plrlevel); + delta_put_item(p, p->x, p->y, plr[pnum].plrlevel); - return sizeof(*pCmd); + return sizeof(*p); } -int On_SEND_PLRINFO(TCmdPlrInfoHdr *pCmd, int pnum) +DWORD On_SEND_PLRINFO(TCmd *pCmd, int pnum) { + TCmdPlrInfoHdr *p = (TCmdPlrInfoHdr *)pCmd; + if (gbBufferMsgs == 1) - msg_send_packet(pnum, pCmd, pCmd->wBytes + sizeof(*pCmd)); + msg_send_packet(pnum, p, p->wBytes + sizeof(*p)); else - recv_plrinfo(pnum, pCmd, pCmd->bCmd == CMD_ACK_PLRINFO); + recv_plrinfo(pnum, p, p->bCmd == CMD_ACK_PLRINFO); - return pCmd->wBytes + sizeof(*pCmd); + return p->wBytes + sizeof(*p); } -int On_ACK_PLRINFO(TCmdPlrInfoHdr *pCmd, int pnum) +DWORD On_ACK_PLRINFO(TCmd *pCmd, int pnum) { return On_SEND_PLRINFO(pCmd, pnum); } -int On_PLAYER_JOINLEVEL(TCmdLocParam1 *pCmd, int pnum) +DWORD On_PLAYER_JOINLEVEL(TCmd *pCmd, int pnum) { + TCmdLocParam1 *p = (TCmdLocParam1 *)pCmd; + if (gbBufferMsgs == 1) - msg_send_packet(pnum, pCmd, sizeof(*pCmd)); + msg_send_packet(pnum, p, sizeof(*p)); else { plr[pnum]._pLvlChanging = 0; if (plr[pnum]._pName[0] && !plr[pnum].plractive) { @@ -2235,9 +2345,9 @@ int On_PLAYER_JOINLEVEL(TCmdLocParam1 *pCmd, int pnum) } if (plr[pnum].plractive && myplr != pnum) { - plr[pnum].WorldX = pCmd->x; - plr[pnum].WorldY = pCmd->y; - plr[pnum].plrlevel = pCmd->wParam1; + plr[pnum].WorldX = p->x; + plr[pnum].WorldY = p->y; + plr[pnum].plrlevel = p->wParam1; plr[pnum]._pGFXLoad = 0; if (currlevel == plr[pnum].plrlevel) { LoadPlrGFX(pnum, PFILE_STAND); @@ -2260,15 +2370,17 @@ int On_PLAYER_JOINLEVEL(TCmdLocParam1 *pCmd, int pnum) } } - return sizeof(*pCmd); + return sizeof(*p); } -int On_ACTIVATEPORTAL(TCmdLocParam3 *pCmd, int pnum) +DWORD On_ACTIVATEPORTAL(TCmd *pCmd, int pnum) { + TCmdLocParam3 *p = (TCmdLocParam3 *)pCmd; + if (gbBufferMsgs == 1) - msg_send_packet(pnum, pCmd, sizeof(*pCmd)); + msg_send_packet(pnum, p, sizeof(*p)); else { - ActivatePortal(pnum, pCmd->x, pCmd->y, pCmd->wParam1, pCmd->wParam2, pCmd->wParam3); + ActivatePortal(pnum, p->x, p->y, p->wParam1, p->wParam2, p->wParam3); if (pnum != myplr) { if (currlevel == 0) AddInTownPortal(pnum); @@ -2283,14 +2395,14 @@ int On_ACTIVATEPORTAL(TCmdLocParam3 *pCmd, int pnum) } } if (addPortal) - AddWarpMissile(pnum, pCmd->x, pCmd->y); + AddWarpMissile(pnum, p->x, p->y); } else RemovePortalMissile(pnum); } - delta_open_portal(pnum, pCmd->x, pCmd->y, pCmd->wParam1, pCmd->wParam2, pCmd->wParam3); + delta_open_portal(pnum, p->x, p->y, p->wParam1, p->wParam2, p->wParam3); } - return sizeof(*pCmd); + return sizeof(*p); } void delta_open_portal(int pnum, BYTE x, BYTE y, BYTE bLevel, BYTE bLType, BYTE bSetLvl) @@ -2303,7 +2415,7 @@ void delta_open_portal(int pnum, BYTE x, BYTE y, BYTE bLevel, BYTE bLType, BYTE sgJunk.portal[pnum].setlvl = bSetLvl; } -int On_DEACTIVATEPORTAL(TCmd *pCmd, int pnum) +DWORD On_DEACTIVATEPORTAL(TCmd *pCmd, int pnum) { if (gbBufferMsgs == 1) msg_send_packet(pnum, pCmd, sizeof(*pCmd)); @@ -2317,7 +2429,7 @@ int On_DEACTIVATEPORTAL(TCmd *pCmd, int pnum) return sizeof(*pCmd); } -int On_RETOWN(TCmd *pCmd, int pnum) +DWORD On_RETOWN(TCmd *pCmd, int pnum) { if (gbBufferMsgs == 1) msg_send_packet(pnum, pCmd, sizeof(*pCmd)); @@ -2332,74 +2444,86 @@ int On_RETOWN(TCmd *pCmd, int pnum) return sizeof(*pCmd); } -int On_SETSTR(TCmdParam1 *pCmd, int pnum) +DWORD On_SETSTR(TCmd *pCmd, int pnum) { + TCmdParam1 *p = (TCmdParam1 *)pCmd; + if (gbBufferMsgs == 1) - msg_send_packet(pnum, pCmd, sizeof(*pCmd)); - else if (pCmd->wParam1 <= 750 && pnum != myplr) - SetPlrStr(pnum, pCmd->wParam1); + msg_send_packet(pnum, p, sizeof(*p)); + else if (p->wParam1 <= 750 && pnum != myplr) + SetPlrStr(pnum, p->wParam1); - return sizeof(*pCmd); + return sizeof(*p); } -int On_SETDEX(TCmdParam1 *pCmd, int pnum) +DWORD On_SETDEX(TCmd *pCmd, int pnum) { + TCmdParam1 *p = (TCmdParam1 *)pCmd; + if (gbBufferMsgs == 1) - msg_send_packet(pnum, pCmd, sizeof(*pCmd)); - else if (pCmd->wParam1 <= 750 && pnum != myplr) - SetPlrDex(pnum, pCmd->wParam1); + msg_send_packet(pnum, p, sizeof(*p)); + else if (p->wParam1 <= 750 && pnum != myplr) + SetPlrDex(pnum, p->wParam1); - return sizeof(*pCmd); + return sizeof(*p); } -int On_SETMAG(TCmdParam1 *pCmd, int pnum) +DWORD On_SETMAG(TCmd *pCmd, int pnum) { + TCmdParam1 *p = (TCmdParam1 *)pCmd; + if (gbBufferMsgs == 1) - msg_send_packet(pnum, pCmd, sizeof(*pCmd)); - else if (pCmd->wParam1 <= 750 && pnum != myplr) - SetPlrMag(pnum, pCmd->wParam1); + msg_send_packet(pnum, p, sizeof(*p)); + else if (p->wParam1 <= 750 && pnum != myplr) + SetPlrMag(pnum, p->wParam1); - return sizeof(*pCmd); + return sizeof(*p); } -int On_SETVIT(TCmdParam1 *pCmd, int pnum) +DWORD On_SETVIT(TCmd *pCmd, int pnum) { + TCmdParam1 *p = (TCmdParam1 *)pCmd; + if (gbBufferMsgs == 1) - msg_send_packet(pnum, pCmd, sizeof(*pCmd)); - else if (pCmd->wParam1 <= 750 && pnum != myplr) - SetPlrVit(pnum, pCmd->wParam1); + msg_send_packet(pnum, p, sizeof(*p)); + else if (p->wParam1 <= 750 && pnum != myplr) + SetPlrVit(pnum, p->wParam1); - return sizeof(*pCmd); + return sizeof(*p); } -int On_STRING(TCmdString *pCmd, int pnum) +DWORD On_STRING(TCmd *pCmd, int pnum) { return On_STRING2(pnum, pCmd); } -int On_STRING2(int pnum, TCmdString *pCmd) +DWORD On_STRING2(int pnum, TCmd *pCmd) { - int len = strlen(pCmd->str); + TCmdString *p = (TCmdString *)pCmd; + + int len = strlen(p->str); if (!gbBufferMsgs) - SendPlrMsg(pnum, pCmd->str); + SendPlrMsg(pnum, p->str); - return len + 2; // length of string + nul terminator + sizeof(pCmd->bCmd) + return len + 2; // length of string + nul terminator + sizeof(p->bCmd) } -int On_SYNCQUEST(TCmdQuest *pCmd, int pnum) +DWORD On_SYNCQUEST(TCmd *pCmd, int pnum) { + TCmdQuest *p = (TCmdQuest *)pCmd; + if (gbBufferMsgs == 1) - msg_send_packet(pnum, pCmd, sizeof(*pCmd)); + msg_send_packet(pnum, p, sizeof(*p)); else { if (pnum != myplr) - SetMultiQuest(pCmd->q, pCmd->qstate, pCmd->qlog, pCmd->qvar1); + SetMultiQuest(p->q, p->qstate, p->qlog, p->qvar1); sgbDeltaChanged = TRUE; } - return sizeof(*pCmd); + return sizeof(*p); } -int On_ENDSHIELD(TCmd *pCmd, int pnum) +DWORD On_ENDSHIELD(TCmd *pCmd, int pnum) { int i; @@ -2416,7 +2540,7 @@ int On_ENDSHIELD(TCmd *pCmd, int pnum) return sizeof(*pCmd); } -int On_CHEAT_EXPERIENCE(TCmd *pCmd, int pnum) +DWORD On_CHEAT_EXPERIENCE(TCmd *pCmd, int pnum) { #ifdef _DEBUG if (gbBufferMsgs == 1) @@ -2429,7 +2553,7 @@ int On_CHEAT_EXPERIENCE(TCmd *pCmd, int pnum) return sizeof(*pCmd); } -int On_CHEAT_SPELL_LEVEL(TCmd *pCmd, int pnum) +DWORD On_CHEAT_SPELL_LEVEL(TCmd *pCmd, int pnum) { #ifdef _DEBUG if (gbBufferMsgs == 1) @@ -2440,27 +2564,29 @@ int On_CHEAT_SPELL_LEVEL(TCmd *pCmd, int pnum) return sizeof(*pCmd); } -int On_DEBUG(TCmd *pCmd, int pnum) +DWORD On_DEBUG(TCmd *pCmd, int pnum) { return sizeof(*pCmd); } -int On_NOVA(TCmdLoc *pCmd, int pnum) +DWORD On_NOVA(TCmd *pCmd, int pnum) { + TCmdLoc *p = (TCmdLoc *)pCmd; + if (gbBufferMsgs != 1 && currlevel == plr[pnum].plrlevel && pnum != myplr) { ClrPlrPath(pnum); plr[pnum]._pSpell = SPL_NOVA; plr[pnum]._pSplType = 4; plr[pnum]._pSplFrom = 3; plr[pnum].destAction = ACTION_SPELL; - plr[pnum].destParam1 = pCmd->x; - plr[pnum].destParam2 = pCmd->y; + plr[pnum].destParam1 = p->x; + plr[pnum].destParam2 = p->y; } - return sizeof(*pCmd); + return sizeof(*p); } -int On_SETSHIELD(TCmd *pCmd, int pnum) +DWORD On_SETSHIELD(TCmd *pCmd, int pnum) { if (gbBufferMsgs != 1) plr[pnum].pManaShield = TRUE; @@ -2468,7 +2594,7 @@ int On_SETSHIELD(TCmd *pCmd, int pnum) return sizeof(*pCmd); } -int On_REMSHIELD(TCmd *pCmd, int pnum) +DWORD On_REMSHIELD(TCmd *pCmd, int pnum) { if (gbBufferMsgs != 1) plr[pnum].pManaShield = FALSE; diff --git a/Source/msg.h b/Source/msg.h index 7bf75c73d01..3b2123f432c 100644 --- a/Source/msg.h +++ b/Source/msg.h @@ -52,94 +52,94 @@ void NetSendCmdDItem(BOOL bHiPri, int ii); void NetSendCmdDamage(BOOL bHiPri, BYTE bPlr, DWORD dwDam); void NetSendCmdString(int pmask, const char *pszStr); void RemovePlrPortal(int pnum); -int ParseCmd(int pnum, TCmd *pCmd); -int On_DLEVEL(int pnum, TCmd *pCmd); +DWORD ParseCmd(int pnum, TCmd *pCmd); +DWORD On_DLEVEL(int pnum, TCmd *pCmd); void DeltaImportData(BYTE cmd, DWORD recv_offset); BYTE *DeltaImportItem(BYTE *src, TCmdPItem *dst); BYTE *DeltaImportObject(BYTE *src, DObjectStr *dst); BYTE *DeltaImportMonster(BYTE *src, DMonsterStr *dst); void DeltaImportJunk(BYTE *src); -int On_SYNCDATA(void *packet, int pnum); -int On_WALKXY(TCmdLoc *pCmd, int pnum); -int On_ADDSTR(TCmdParam1 *pCmd, int pnum); -int On_ADDMAG(TCmdParam1 *pCmd, int pnum); -int On_ADDDEX(TCmdParam1 *pCmd, int pnum); -int On_ADDVIT(TCmdParam1 *pCmd, int pnum); -int On_SBSPELL(TCmdParam1 *pCmd, int pnum); +DWORD On_SYNCDATA(TCmd *pCmd, int pnum); +DWORD On_WALKXY(TCmd *pCmd, int pnum); +DWORD On_ADDSTR(TCmd *pCmd, int pnum); +DWORD On_ADDMAG(TCmd *pCmd, int pnum); +DWORD On_ADDDEX(TCmd *pCmd, int pnum); +DWORD On_ADDVIT(TCmd *pCmd, int pnum); +DWORD On_SBSPELL(TCmd *pCmd, int pnum); void __cdecl msg_errorf(const char *pszFmt, ...); -int On_GOTOGETITEM(TCmdLocParam1 *pCmd, int pnum); -int On_REQUESTGITEM(TCmdGItem *pCmd, int pnum); +DWORD On_GOTOGETITEM(TCmd *pCmd, int pnum); +DWORD On_REQUESTGITEM(TCmd *pCmd, int pnum); BOOL i_own_level(int nReqLevel); -int On_GETITEM(TCmdGItem *pCmd, int pnum); +DWORD On_GETITEM(TCmd *pCmd, int pnum); BOOL delta_get_item(TCmdGItem *pI, BYTE bLevel); -int On_GOTOAGETITEM(TCmdLocParam1 *pCmd, int pnum); -int On_REQUESTAGITEM(TCmdGItem *pCmd, int pnum); -int On_AGETITEM(TCmdGItem *pCmd, int pnum); -int On_ITEMEXTRA(TCmdGItem *pCmd, int pnum); -int On_PUTITEM(TCmdPItem *pCmd, int pnum); +DWORD On_GOTOAGETITEM(TCmd *pCmd, int pnum); +DWORD On_REQUESTAGITEM(TCmd *pCmd, int pnum); +DWORD On_AGETITEM(TCmd *pCmd, int pnum); +DWORD On_ITEMEXTRA(TCmd *pCmd, int pnum); +DWORD On_PUTITEM(TCmd *pCmd, int pnum); void delta_put_item(TCmdPItem *pI, int x, int y, BYTE bLevel); void check_update_plr(int pnum); -int On_SYNCPUTITEM(TCmdPItem *pCmd, int pnum); -int On_RESPAWNITEM(TCmdPItem *pCmd, int pnum); -int On_ATTACKXY(TCmdLoc *pCmd, int pnum); -int On_SATTACKXY(TCmdLoc *pCmd, int pnum); -int On_RATTACKXY(TCmdLoc *pCmd, int pnum); -int On_SPELLXYD(TCmdLocParam3 *pCmd, int pnum); -int On_SPELLXY(TCmdLocParam2 *pCmd, int pnum); -int On_TSPELLXY(TCmdLocParam2 *pCmd, int pnum); -int On_OPOBJXY(TCmdLocParam1 *pCmd, int pnum); -int On_DISARMXY(TCmdLocParam1 *pCmd, int pnum); -int On_OPOBJT(TCmdParam1 *pCmd, int pnum); -int On_ATTACKID(TCmdParam1 *pCmd, int pnum); -int On_ATTACKPID(TCmdParam1 *pCmd, int pnum); -int On_RATTACKID(TCmdParam1 *pCmd, int pnum); -int On_RATTACKPID(TCmdParam1 *pCmd, int pnum); -int On_SPELLID(TCmdParam3 *pCmd, int pnum); -int On_SPELLPID(TCmdParam3 *pCmd, int pnum); -int On_TSPELLID(TCmdParam3 *pCmd, int pnum); -int On_TSPELLPID(TCmdParam3 *pCmd, int pnum); -int On_KNOCKBACK(TCmdParam1 *pCmd, int pnum); -int On_RESURRECT(TCmdParam1 *pCmd, int pnum); -int On_HEALOTHER(TCmdParam1 *pCmd, int pnum); -int On_TALKXY(TCmdLocParam1 *pCmd, int pnum); -int On_NEWLVL(TCmdParam2 *pCmd, int pnum); -int On_WARP(TCmdParam1 *pCmd, int pnum); -int On_MONSTDEATH(TCmdLocParam1 *pCmd, int pnum); -int On_KILLGOLEM(TCmdLocParam1 *pCmd, int pnum); -int On_AWAKEGOLEM(TCmdGolem *pCmd, int pnum); -int On_MONSTDAMAGE(TCmdParam2 *pCmd, int pnum); -int On_PLRDEAD(TCmdParam1 *pCmd, int pnum); -int On_PLRDAMAGE(TCmdDamage *pCmd, int pnum); -int On_OPENDOOR(TCmdParam1 *pCmd, int pnum); +DWORD On_SYNCPUTITEM(TCmd *pCmd, int pnum); +DWORD On_RESPAWNITEM(TCmd *pCmd, int pnum); +DWORD On_ATTACKXY(TCmd *pCmd, int pnum); +DWORD On_SATTACKXY(TCmd *pCmd, int pnum); +DWORD On_RATTACKXY(TCmd *pCmd, int pnum); +DWORD On_SPELLXYD(TCmd *pCmd, int pnum); +DWORD On_SPELLXY(TCmd *pCmd, int pnum); +DWORD On_TSPELLXY(TCmd *pCmd, int pnum); +DWORD On_OPOBJXY(TCmd *pCmd, int pnum); +DWORD On_DISARMXY(TCmd *pCmd, int pnum); +DWORD On_OPOBJT(TCmd *pCmd, int pnum); +DWORD On_ATTACKID(TCmd *pCmd, int pnum); +DWORD On_ATTACKPID(TCmd *pCmd, int pnum); +DWORD On_RATTACKID(TCmd *pCmd, int pnum); +DWORD On_RATTACKPID(TCmd *pCmd, int pnum); +DWORD On_SPELLID(TCmd *pCmd, int pnum); +DWORD On_SPELLPID(TCmd *pCmd, int pnum); +DWORD On_TSPELLID(TCmd *pCmd, int pnum); +DWORD On_TSPELLPID(TCmd *pCmd, int pnum); +DWORD On_KNOCKBACK(TCmd *pCmd, int pnum); +DWORD On_RESURRECT(TCmd *pCmd, int pnum); +DWORD On_HEALOTHER(TCmd *pCmd, int pnum); +DWORD On_TALKXY(TCmd *pCmd, int pnum); +DWORD On_NEWLVL(TCmd *pCmd, int pnum); +DWORD On_WARP(TCmd *pCmd, int pnum); +DWORD On_MONSTDEATH(TCmd *pCmd, int pnum); +DWORD On_KILLGOLEM(TCmd *pCmd, int pnum); +DWORD On_AWAKEGOLEM(TCmd *pCmd, int pnum); +DWORD On_MONSTDAMAGE(TCmd *pCmd, int pnum); +DWORD On_PLRDEAD(TCmd *pCmd, int pnum); +DWORD On_PLRDAMAGE(TCmd *pCmd, int pnum); +DWORD On_OPENDOOR(TCmd *pCmd, int pnum); void delta_sync_object(int oi, BYTE bCmd, BYTE bLevel); -int On_CLOSEDOOR(TCmdParam1 *pCmd, int pnum); -int On_OPERATEOBJ(TCmdParam1 *pCmd, int pnum); -int On_PLROPOBJ(TCmdParam2 *pCmd, int pnum); -int On_BREAKOBJ(TCmdParam2 *pCmd, int pnum); -int On_CHANGEPLRITEMS(TCmdChItem *pCmd, int pnum); -int On_DELPLRITEMS(TCmdDelItem *pCmd, int pnum); -int On_PLRLEVEL(TCmdParam1 *pCmd, int pnum); -int On_DROPITEM(TCmdPItem *pCmd, int pnum); -int On_SEND_PLRINFO(TCmdPlrInfoHdr *pCmd, int pnum); -int On_ACK_PLRINFO(TCmdPlrInfoHdr *pCmd, int pnum); -int On_PLAYER_JOINLEVEL(TCmdLocParam1 *pCmd, int pnum); -int On_ACTIVATEPORTAL(TCmdLocParam3 *pCmd, int pnum); +DWORD On_CLOSEDOOR(TCmd *pCmd, int pnum); +DWORD On_OPERATEOBJ(TCmd *pCmd, int pnum); +DWORD On_PLROPOBJ(TCmd *pCmd, int pnum); +DWORD On_BREAKOBJ(TCmd *pCmd, int pnum); +DWORD On_CHANGEPLRITEMS(TCmd *pCmd, int pnum); +DWORD On_DELPLRITEMS(TCmd *pCmd, int pnum); +DWORD On_PLRLEVEL(TCmd *pCmd, int pnum); +DWORD On_DROPITEM(TCmd *pCmd, int pnum); +DWORD On_SEND_PLRINFO(TCmd *pCmd, int pnum); +DWORD On_ACK_PLRINFO(TCmd *pCmd, int pnum); +DWORD On_PLAYER_JOINLEVEL(TCmd *pCmd, int pnum); +DWORD On_ACTIVATEPORTAL(TCmd *pCmd, int pnum); void delta_open_portal(int pnum, BYTE x, BYTE y, BYTE bLevel, BYTE bLType, BYTE bSetLvl); -int On_DEACTIVATEPORTAL(TCmd *pCmd, int pnum); -int On_RETOWN(TCmd *pCmd, int pnum); -int On_SETSTR(TCmdParam1 *pCmd, int pnum); -int On_SETDEX(TCmdParam1 *pCmd, int pnum); -int On_SETMAG(TCmdParam1 *pCmd, int pnum); -int On_SETVIT(TCmdParam1 *pCmd, int pnum); -int On_STRING(TCmdString *pCmd, int pnum); -int On_STRING2(int pnum, TCmdString *pCmd); -int On_SYNCQUEST(TCmdQuest *pCmd, int pnum); -int On_ENDSHIELD(TCmd *pCmd, int pnum); -int On_CHEAT_EXPERIENCE(TCmd *pCmd, int pnum); -int On_CHEAT_SPELL_LEVEL(TCmd *pCmd, int pnum); -int On_DEBUG(TCmd *pCmd, int pnum); -int On_NOVA(TCmdLoc *pCmd, int pnum); -int On_SETSHIELD(TCmd *pCmd, int pnum); -int On_REMSHIELD(TCmd *pCmd, int pnum); +DWORD On_DEACTIVATEPORTAL(TCmd *pCmd, int pnum); +DWORD On_RETOWN(TCmd *pCmd, int pnum); +DWORD On_SETSTR(TCmd *pCmd, int pnum); +DWORD On_SETDEX(TCmd *pCmd, int pnum); +DWORD On_SETMAG(TCmd *pCmd, int pnum); +DWORD On_SETVIT(TCmd *pCmd, int pnum); +DWORD On_STRING(TCmd *pCmd, int pnum); +DWORD On_STRING2(int pnum, TCmd *pCmd); +DWORD On_SYNCQUEST(TCmd *pCmd, int pnum); +DWORD On_ENDSHIELD(TCmd *pCmd, int pnum); +DWORD On_CHEAT_EXPERIENCE(TCmd *pCmd, int pnum); +DWORD On_CHEAT_SPELL_LEVEL(TCmd *pCmd, int pnum); +DWORD On_DEBUG(TCmd *pCmd, int pnum); +DWORD On_NOVA(TCmd *pCmd, int pnum); +DWORD On_SETSHIELD(TCmd *pCmd, int pnum); +DWORD On_REMSHIELD(TCmd *pCmd, int pnum); #endif /* __MSG_H__ */ diff --git a/Source/multi.cpp b/Source/multi.cpp index 9d27a104f0e..051442e4048 100644 --- a/Source/multi.cpp +++ b/Source/multi.cpp @@ -674,7 +674,7 @@ BOOL NetInit(BOOL bSinglePlayer, BOOL *pfExitProgram) UiData.getdatacallback = (void (*)())UiGetDataCallback; UiData.categorycallback = (void (*)())UiCategoryCallback; UiData.selectnamecallback = mainmenu_select_hero_dialog; - UiData.changenamecallback = (void (*)())mainmenu_create_hero; + UiData.changenamecallback = (void (*)())mainmenu_change_name; UiData.profilebitmapcallback = (void (*)())UiProfileDraw; UiData.profilecallback = (void (*)())UiProfileCallback; UiData.profilefields = UiProfileGetString(); diff --git a/Source/objects.cpp b/Source/objects.cpp index 1bb94380c55..c57efcba807 100644 --- a/Source/objects.cpp +++ b/Source/objects.cpp @@ -106,7 +106,7 @@ void InitObjectGFX() if (fileload[i]) { ObjFileList[numobjfiles] = i; sprintf(filestr, "Objects\\%s.CEL", ObjMasterLoadList[i]); - pObjCels[numobjfiles] = LoadFileInMem(filestr, 0); + pObjCels[numobjfiles] = LoadFileInMem(filestr, NULL); numobjfiles++; } } @@ -598,13 +598,13 @@ void AddDiabObjs() { BYTE *lpSetPiece; - lpSetPiece = LoadFileInMem("Levels\\L4Data\\diab1.DUN", 0); + lpSetPiece = LoadFileInMem("Levels\\L4Data\\diab1.DUN", NULL); LoadMapObjects(lpSetPiece, 2 * diabquad1x, 2 * diabquad1y, diabquad2x, diabquad2y, 11, 12, 1); mem_free_dbg(lpSetPiece); - lpSetPiece = LoadFileInMem("Levels\\L4Data\\diab2a.DUN", 0); + lpSetPiece = LoadFileInMem("Levels\\L4Data\\diab2a.DUN", NULL); LoadMapObjects(lpSetPiece, 2 * diabquad2x, 2 * diabquad2y, diabquad3x, diabquad3y, 11, 11, 2); mem_free_dbg(lpSetPiece); - lpSetPiece = LoadFileInMem("Levels\\L4Data\\diab3a.DUN", 0); + lpSetPiece = LoadFileInMem("Levels\\L4Data\\diab3a.DUN", NULL); LoadMapObjects(lpSetPiece, 2 * diabquad3x, 2 * diabquad3y, diabquad4x, diabquad4y, 9, 9, 3); mem_free_dbg(lpSetPiece); } @@ -784,7 +784,7 @@ void InitObjects() } quests[QTYPE_BLIND]._qmsg = sp_id; AddBookLever(0, 0, MAXDUNX, MAXDUNY, setpc_x, setpc_y, setpc_w + setpc_x + 1, setpc_h + setpc_y + 1, sp_id); - mem = LoadFileInMem("Levels\\L2Data\\Blind2.DUN", 0); + mem = LoadFileInMem("Levels\\L2Data\\Blind2.DUN", NULL); LoadMapObjs(mem, 2 * setpc_x, 2 * setpc_y); mem_free_dbg(mem); } @@ -817,7 +817,7 @@ void InitObjects() } quests[QTYPE_WARLRD]._qmsg = sp_id; AddBookLever(0, 0, MAXDUNX, MAXDUNY, setpc_x, setpc_y, setpc_x + setpc_w, setpc_y + setpc_h, sp_id); - mem = LoadFileInMem("Levels\\L4Data\\Warlord.DUN", 0); + mem = LoadFileInMem("Levels\\L4Data\\Warlord.DUN", NULL); LoadMapObjs(mem, 2 * setpc_x, 2 * setpc_y); mem_free_dbg(mem); } @@ -882,7 +882,7 @@ void SetMapObjects(unsigned char *pMap, int startx, int starty) ObjFileList[numobjfiles] = i; sprintf(filestr, "Objects\\%s.CEL", ObjMasterLoadList[i]); - pObjCels[numobjfiles] = LoadFileInMem(filestr, 0); + pObjCels[numobjfiles] = LoadFileInMem(filestr, NULL); numobjfiles++; } @@ -1065,7 +1065,7 @@ void AddFlameLvr(int i) object[i]._oVar2 = 49; } -void AddTrap(int i, int t) +void AddTrap(int i, int ot) { int mt; @@ -2792,7 +2792,7 @@ void OperatePedistal(int pnum, int i) if (!deltaload) PlaySfxLoc(LS_BLODSTAR, object[i]._ox, object[i]._oy); ObjChangeMap(object[i]._oVar1, object[i]._oVar2, object[i]._oVar3, object[i]._oVar4); - mem = LoadFileInMem("Levels\\L2Data\\Blood2.DUN", 0); + mem = LoadFileInMem("Levels\\L2Data\\Blood2.DUN", NULL); LoadMapObjs(mem, 2 * setpc_x, 2 * setpc_y); mem_free_dbg(mem); CreateItem(7, 2 * setpc_x + 25, 2 * setpc_y + 19); @@ -4247,7 +4247,7 @@ void SyncPedistal(int i) } if (object[i]._oVar6 == 3) { ObjChangeMapResync(object[i]._oVar1, object[i]._oVar2, object[i]._oVar3, object[i]._oVar4); - setp = LoadFileInMem("Levels\\L2Data\\Blood2.DUN", 0); + setp = LoadFileInMem("Levels\\L2Data\\Blood2.DUN", NULL); LoadMapObjs(setp, 2 * setpc_x, 2 * setpc_y); mem_free_dbg(setp); } diff --git a/Source/objects.h b/Source/objects.h index 2864a5a179a..50a7ea51eb2 100644 --- a/Source/objects.h +++ b/Source/objects.h @@ -54,7 +54,7 @@ void AddL3Door(int i, int x, int y, int ot); void AddSarc(int i); void AddFlameTrap(int i); void AddFlameLvr(int i); -void AddTrap(int i, int t); +void AddTrap(int i, int ot); void AddObjLight(int i, int r); void AddBarrel(int i, int t); void AddShrine(int i); diff --git a/Source/pfile.cpp b/Source/pfile.cpp index 5f9a4a4b13d..fe2bbc4a084 100644 --- a/Source/pfile.cpp +++ b/Source/pfile.cpp @@ -158,7 +158,7 @@ BOOL pfile_create_player_description(char *dst, DWORD len) return TRUE; } -BOOL pfile_create_save_file(const char *name_1, const char *name_2) +BOOL pfile_rename_hero(const char *name_1, const char *name_2) { int i; DWORD save_num; diff --git a/Source/pfile.h b/Source/pfile.h index 6580e83277a..045a8067107 100644 --- a/Source/pfile.h +++ b/Source/pfile.h @@ -13,7 +13,7 @@ BOOL pfile_open_archive(BOOL a1, DWORD save_num); void pfile_get_save_path(char *pszBuf, DWORD dwBufSize, DWORD save_num); void pfile_flush(BOOL is_single_player, DWORD save_num); BOOL pfile_create_player_description(char *dst, DWORD len); -BOOL pfile_create_save_file(const char *name_1, const char *name_2); +BOOL pfile_rename_hero(const char *name_1, const char *name_2); void pfile_flush_W(); void game_2_ui_player(const PlayerStruct *p, _uiheroinfo *heroinfo, BOOL bHasSaveFile); unsigned char game_2_ui_class(const PlayerStruct *p); diff --git a/Source/player.cpp b/Source/player.cpp index 7265e597c9c..c9fc2a89704 100644 --- a/Source/player.cpp +++ b/Source/player.cpp @@ -3,7 +3,7 @@ int plr_lframe_size; int plr_wframe_size; -UCHAR plr_gfx_flag = 0; +BYTE plr_gfx_flag = 0; int plr_aframe_size; int myplr; PlayerStruct plr[MAX_PLRS]; @@ -12,7 +12,7 @@ int plr_qframe_size; BOOL deathflag; int plr_hframe_size; int plr_bframe_size; -UCHAR plr_gfx_bflag = 0; +BYTE plr_gfx_bflag = 0; int plr_sframe_size; int deathdelay; int plr_dframe_size; @@ -103,9 +103,9 @@ int ExpLvlsTbl[MAXCHARLEVEL] = { 1583495809 }; char *ClassStrTbl[3] = { "Warrior", "Rogue", "Sorceror" }; -unsigned char fix[9] = { 0u, 0u, 3u, 3u, 3u, 6u, 6u, 6u, 8u }; /* PM_ChangeLightOff local type */ +BYTE fix[9] = { 0u, 0u, 3u, 3u, 3u, 6u, 6u, 6u, 8u }; /* PM_ChangeLightOff local type */ -void SetPlayerGPtrs(UCHAR *pData, UCHAR **pAnim) +void SetPlayerGPtrs(BYTE *pData, BYTE **pAnim) { int i; @@ -121,7 +121,7 @@ void LoadPlrGFX(int pnum, player_graphic gfxflag) char *szCel; PlayerStruct *p; char *cs; - UCHAR *pData, *pAnim; + BYTE *pData, *pAnim; DWORD i; if ((DWORD)pnum >= MAX_PLRS) { @@ -144,7 +144,7 @@ void LoadPlrGFX(int pnum, player_graphic gfxflag) szCel = "ST"; } pData = p->_pNData; - pAnim = (UCHAR *)p->_pNAnim; + pAnim = (BYTE *)p->_pNAnim; break; case PFILE_WALK: szCel = "AW"; @@ -152,7 +152,7 @@ void LoadPlrGFX(int pnum, player_graphic gfxflag) szCel = "WL"; } pData = p->_pWData; - pAnim = (UCHAR *)p->_pWAnim; + pAnim = (BYTE *)p->_pWAnim; break; case PFILE_ATTACK: if (leveltype == DTYPE_TOWN) { @@ -160,7 +160,7 @@ void LoadPlrGFX(int pnum, player_graphic gfxflag) } szCel = "AT"; pData = p->_pAData; - pAnim = (UCHAR *)p->_pAAnim; + pAnim = (BYTE *)p->_pAAnim; break; case PFILE_HIT: if (leveltype == DTYPE_TOWN) { @@ -168,7 +168,7 @@ void LoadPlrGFX(int pnum, player_graphic gfxflag) } szCel = "HT"; pData = p->_pHData; - pAnim = (UCHAR *)p->_pHAnim; + pAnim = (BYTE *)p->_pHAnim; break; case PFILE_LIGHTNING: if (leveltype == DTYPE_TOWN) { @@ -176,7 +176,7 @@ void LoadPlrGFX(int pnum, player_graphic gfxflag) } szCel = "LM"; pData = p->_pLData; - pAnim = (UCHAR *)p->_pLAnim; + pAnim = (BYTE *)p->_pLAnim; break; case PFILE_FIRE: if (leveltype == DTYPE_TOWN) { @@ -184,7 +184,7 @@ void LoadPlrGFX(int pnum, player_graphic gfxflag) } szCel = "FM"; pData = p->_pFData; - pAnim = (UCHAR *)p->_pFAnim; + pAnim = (BYTE *)p->_pFAnim; break; case PFILE_MAGIC: if (leveltype == DTYPE_TOWN) { @@ -192,7 +192,7 @@ void LoadPlrGFX(int pnum, player_graphic gfxflag) } szCel = "QM"; pData = p->_pTData; - pAnim = (UCHAR *)p->_pTAnim; + pAnim = (BYTE *)p->_pTAnim; break; case PFILE_DEATH: if (p->_pgfxnum & 0xF) { @@ -200,7 +200,7 @@ void LoadPlrGFX(int pnum, player_graphic gfxflag) } szCel = "DT"; pData = p->_pDData; - pAnim = (UCHAR *)p->_pDAnim; + pAnim = (BYTE *)p->_pDAnim; break; case PFILE_BLOCK: if (leveltype == DTYPE_TOWN) { @@ -212,7 +212,7 @@ void LoadPlrGFX(int pnum, player_graphic gfxflag) szCel = "BL"; pData = p->_pBData; - pAnim = (UCHAR *)p->_pBAnim; + pAnim = (BYTE *)p->_pBAnim; break; default: app_fatal("PLR:2"); @@ -221,7 +221,7 @@ void LoadPlrGFX(int pnum, player_graphic gfxflag) sprintf(pszName, "PlrGFX\\%s\\%s\\%s%s.CL2", cs, prefix, prefix, szCel); LoadFileWithMem(pszName, pData); - SetPlayerGPtrs((UCHAR *)pData, (UCHAR **)pAnim); + SetPlayerGPtrs((BYTE *)pData, (BYTE **)pAnim); p->_pGFXLoad |= i; } } @@ -361,7 +361,7 @@ void FreePlayerGFX(int pnum) plr[pnum]._pGFXLoad = 0; } -void NewPlrAnim(int pnum, unsigned char *Peq, int numFrames, int Delay, int width) +void NewPlrAnim(int pnum, BYTE *Peq, int numFrames, int Delay, int width) { if ((DWORD)pnum >= MAX_PLRS) { app_fatal("NewPlrAnim: illegal player %d", pnum); @@ -1046,7 +1046,7 @@ void SetPlayerOld(int pnum) plr[pnum]._poldy = plr[pnum].WorldY; } -void FixPlayerLocation(int pnum, int dir) +void FixPlayerLocation(int pnum, int bDir) { if ((DWORD)pnum >= MAX_PLRS) { app_fatal("FixPlayerLocation: illegal player %d", pnum); @@ -1059,7 +1059,7 @@ void FixPlayerLocation(int pnum, int dir) plr[pnum]._pxoff = 0; plr[pnum]._pyoff = 0; CheckEFlag(pnum, FALSE); - plr[pnum]._pdir = dir; + plr[pnum]._pdir = bDir; if (pnum == myplr) { ScrollInfo._sxoff = 0; ScrollInfo._syoff = 0; @@ -2639,7 +2639,7 @@ BOOL PM_DoAttack(int pnum) } didhit = PlrHitMonst(pnum, m); } else if (dPlayer[dx][dy] && !FriendlyMode) { - UCHAR p = dPlayer[dx][dy]; + BYTE p = dPlayer[dx][dy]; if (dPlayer[dx][dy] > 0) { p = dPlayer[dx][dy] - 1; } else { @@ -3268,21 +3268,21 @@ void CheckNewPath(int pnum) } } -BOOL PlrDeathModeOK(int pnum) +BOOL PlrDeathModeOK(int p) { - if (pnum != myplr) { + if (p != myplr) { return TRUE; } - if ((DWORD)pnum >= MAX_PLRS) { - app_fatal("PlrDeathModeOK: illegal player %d", pnum); + if ((DWORD)p >= MAX_PLRS) { + app_fatal("PlrDeathModeOK: illegal player %d", p); } - if (plr[pnum]._pmode == PM_DEATH) { + if (plr[p]._pmode == PM_DEATH) { return TRUE; - } else if (plr[pnum]._pmode == PM_QUIT) { + } else if (plr[p]._pmode == PM_QUIT) { return TRUE; - } else if (plr[pnum]._pmode == PM_NEWLVL) { + } else if (plr[p]._pmode == PM_NEWLVL) { return TRUE; } @@ -3475,43 +3475,43 @@ void ClrPlrPath(int pnum) memset(plr[pnum].walkpath, WALK_NONE, sizeof(plr[pnum].walkpath)); } -BOOL PosOkPlayer(int pnum, int px, int py) +BOOL PosOkPlayer(int pnum, int x, int y) { BOOL PosOK; DWORD p; char bv; PosOK = FALSE; - if (px >= 0 && px < MAXDUNX && py >= 0 && py < MAXDUNY && !SolidLoc(px, py) && dPiece[px][py]) { + if (x >= 0 && x < MAXDUNX && y >= 0 && y < MAXDUNY && !SolidLoc(x, y) && dPiece[x][y]) { - if (dPlayer[px][py]) { - if (dPlayer[px][py] > 0) { - p = dPlayer[px][py] - 1; + if (dPlayer[x][y]) { + if (dPlayer[x][y] > 0) { + p = dPlayer[x][y] - 1; } else { - p = -(dPlayer[px][py] + 1); + p = -(dPlayer[x][y] + 1); } if (p != pnum && p < MAX_PLRS && plr[p]._pHitPoints) { return FALSE; } } - if (dMonster[px][py]) { + if (dMonster[x][y]) { if (currlevel == 0) { return FALSE; } - if (dMonster[px][py] <= 0) { + if (dMonster[x][y] <= 0) { return FALSE; } - if ((monster[dMonster[px][py] - 1]._mhitpoints >> 6) > 0) { + if ((monster[dMonster[x][y] - 1]._mhitpoints >> 6) > 0) { return FALSE; } } - if (dObject[px][py]) { - if (dObject[px][py] > 0) { - bv = dObject[px][py] - 1; + if (dObject[x][y]) { + if (dObject[x][y] > 0) { + bv = dObject[x][y] - 1; } else { - bv = -(dObject[px][py] + 1); + bv = -(dObject[x][y] + 1); } if (object[bv]._oSolidFlag) { return FALSE; @@ -3785,271 +3785,271 @@ void SyncInitPlr(int pnum) SyncInitPlrPos(pnum); } -void CheckStats(int pnum) +void CheckStats(int p) { int c, i; - if ((DWORD)pnum >= MAX_PLRS) { - app_fatal("CheckStats: illegal player %d", pnum); + if ((DWORD)p >= MAX_PLRS) { + app_fatal("CheckStats: illegal player %d", p); } - if (plr[pnum]._pClass == PC_WARRIOR) { + if (plr[p]._pClass == PC_WARRIOR) { c = PC_WARRIOR; - } else if (plr[pnum]._pClass == PC_ROGUE) { + } else if (plr[p]._pClass == PC_ROGUE) { c = PC_ROGUE; - } else if (plr[pnum]._pClass == PC_SORCERER) { + } else if (plr[p]._pClass == PC_SORCERER) { c = PC_SORCERER; } for (i = 0; i < 4; i++) { switch (i) { case ATTRIB_STR: - if (plr[pnum]._pBaseStr > MaxStats[c][ATTRIB_STR]) { - plr[pnum]._pBaseStr = MaxStats[c][ATTRIB_STR]; - } else if (plr[pnum]._pBaseStr < 0) { - plr[pnum]._pBaseStr = 0; + if (plr[p]._pBaseStr > MaxStats[c][ATTRIB_STR]) { + plr[p]._pBaseStr = MaxStats[c][ATTRIB_STR]; + } else if (plr[p]._pBaseStr < 0) { + plr[p]._pBaseStr = 0; } break; case ATTRIB_MAG: - if (plr[pnum]._pBaseMag > MaxStats[c][ATTRIB_MAG]) { - plr[pnum]._pBaseMag = MaxStats[c][ATTRIB_MAG]; - } else if (plr[pnum]._pBaseMag < 0) { - plr[pnum]._pBaseMag = 0; + if (plr[p]._pBaseMag > MaxStats[c][ATTRIB_MAG]) { + plr[p]._pBaseMag = MaxStats[c][ATTRIB_MAG]; + } else if (plr[p]._pBaseMag < 0) { + plr[p]._pBaseMag = 0; } break; case ATTRIB_DEX: - if (plr[pnum]._pBaseDex > MaxStats[c][ATTRIB_DEX]) { - plr[pnum]._pBaseDex = MaxStats[c][ATTRIB_DEX]; - } else if (plr[pnum]._pBaseDex < 0) { - plr[pnum]._pBaseDex = 0; + if (plr[p]._pBaseDex > MaxStats[c][ATTRIB_DEX]) { + plr[p]._pBaseDex = MaxStats[c][ATTRIB_DEX]; + } else if (plr[p]._pBaseDex < 0) { + plr[p]._pBaseDex = 0; } break; case ATTRIB_VIT: - if (plr[pnum]._pBaseVit > MaxStats[c][ATTRIB_VIT]) { - plr[pnum]._pBaseVit = MaxStats[c][ATTRIB_VIT]; - } else if (plr[pnum]._pBaseVit < 0) { - plr[pnum]._pBaseVit = 0; + if (plr[p]._pBaseVit > MaxStats[c][ATTRIB_VIT]) { + plr[p]._pBaseVit = MaxStats[c][ATTRIB_VIT]; + } else if (plr[p]._pBaseVit < 0) { + plr[p]._pBaseVit = 0; } break; } } } -void ModifyPlrStr(int pnum, int l) +void ModifyPlrStr(int p, int l) { int max; - if ((DWORD)pnum >= MAX_PLRS) { - app_fatal("ModifyPlrStr: illegal player %d", pnum); + if ((DWORD)p >= MAX_PLRS) { + app_fatal("ModifyPlrStr: illegal player %d", p); } - max = MaxStats[plr[pnum]._pClass][ATTRIB_STR]; - if (plr[pnum]._pBaseStr + l > max) { - l = max - plr[pnum]._pBaseStr; + max = MaxStats[plr[p]._pClass][ATTRIB_STR]; + if (plr[p]._pBaseStr + l > max) { + l = max - plr[p]._pBaseStr; } - plr[pnum]._pStrength += l; - plr[pnum]._pBaseStr += l; + plr[p]._pStrength += l; + plr[p]._pBaseStr += l; - if (plr[pnum]._pClass == PC_ROGUE) { - plr[pnum]._pDamageMod = plr[pnum]._pLevel * (plr[pnum]._pStrength + plr[pnum]._pDexterity) / 200; + if (plr[p]._pClass == PC_ROGUE) { + plr[p]._pDamageMod = plr[p]._pLevel * (plr[p]._pStrength + plr[p]._pDexterity) / 200; } else { - plr[pnum]._pDamageMod = plr[pnum]._pLevel * plr[pnum]._pStrength / 100; + plr[p]._pDamageMod = plr[p]._pLevel * plr[p]._pStrength / 100; } - CalcPlrInv(pnum, TRUE); + CalcPlrInv(p, TRUE); - if (pnum == myplr) { - NetSendCmdParam1(FALSE, CMD_SETSTR, plr[pnum]._pBaseStr); //60 + if (p == myplr) { + NetSendCmdParam1(FALSE, CMD_SETSTR, plr[p]._pBaseStr); //60 } } -void ModifyPlrMag(int pnum, int l) +void ModifyPlrMag(int p, int l) { int max, ms; - if ((DWORD)pnum >= MAX_PLRS) { - app_fatal("ModifyPlrMag: illegal player %d", pnum); + if ((DWORD)p >= MAX_PLRS) { + app_fatal("ModifyPlrMag: illegal player %d", p); } - max = MaxStats[plr[pnum]._pClass][ATTRIB_MAG]; - if (plr[pnum]._pBaseMag + l > max) { - l = max - plr[pnum]._pBaseMag; + max = MaxStats[plr[p]._pClass][ATTRIB_MAG]; + if (plr[p]._pBaseMag + l > max) { + l = max - plr[p]._pBaseMag; } - plr[pnum]._pMagic += l; - plr[pnum]._pBaseMag += l; + plr[p]._pMagic += l; + plr[p]._pBaseMag += l; ms = l << 6; - if (plr[pnum]._pClass == PC_SORCERER) { + if (plr[p]._pClass == PC_SORCERER) { ms *= 2; } - plr[pnum]._pMaxManaBase += ms; - plr[pnum]._pMaxMana += ms; - if (!(plr[pnum]._pIFlags & ISPL_NOMANA)) { - plr[pnum]._pManaBase += ms; - plr[pnum]._pMana += ms; + plr[p]._pMaxManaBase += ms; + plr[p]._pMaxMana += ms; + if (!(plr[p]._pIFlags & ISPL_NOMANA)) { + plr[p]._pManaBase += ms; + plr[p]._pMana += ms; } - CalcPlrInv(pnum, TRUE); + CalcPlrInv(p, TRUE); - if (pnum == myplr) { - NetSendCmdParam1(FALSE, CMD_SETMAG, plr[pnum]._pBaseMag); + if (p == myplr) { + NetSendCmdParam1(FALSE, CMD_SETMAG, plr[p]._pBaseMag); } } -void ModifyPlrDex(int pnum, int l) +void ModifyPlrDex(int p, int l) { int max; - if ((DWORD)pnum >= MAX_PLRS) { - app_fatal("ModifyPlrDex: illegal player %d", pnum); + if ((DWORD)p >= MAX_PLRS) { + app_fatal("ModifyPlrDex: illegal player %d", p); } - max = MaxStats[plr[pnum]._pClass][ATTRIB_DEX]; - if (plr[pnum]._pBaseDex + l > max) { - l = max - plr[pnum]._pBaseDex; + max = MaxStats[plr[p]._pClass][ATTRIB_DEX]; + if (plr[p]._pBaseDex + l > max) { + l = max - plr[p]._pBaseDex; } - plr[pnum]._pDexterity += l; - plr[pnum]._pBaseDex += l; - CalcPlrInv(pnum, TRUE); + plr[p]._pDexterity += l; + plr[p]._pBaseDex += l; + CalcPlrInv(p, TRUE); - if (plr[pnum]._pClass == PC_ROGUE) { - plr[pnum]._pDamageMod = plr[pnum]._pLevel * (plr[pnum]._pDexterity + plr[pnum]._pStrength) / 200; + if (plr[p]._pClass == PC_ROGUE) { + plr[p]._pDamageMod = plr[p]._pLevel * (plr[p]._pDexterity + plr[p]._pStrength) / 200; } - if (pnum == myplr) { - NetSendCmdParam1(FALSE, CMD_SETDEX, plr[pnum]._pBaseDex); + if (p == myplr) { + NetSendCmdParam1(FALSE, CMD_SETDEX, plr[p]._pBaseDex); } } -void ModifyPlrVit(int pnum, int l) +void ModifyPlrVit(int p, int l) { int max, ms; - if ((DWORD)pnum >= MAX_PLRS) { - app_fatal("ModifyPlrVit: illegal player %d", pnum); + if ((DWORD)p >= MAX_PLRS) { + app_fatal("ModifyPlrVit: illegal player %d", p); } - max = MaxStats[plr[pnum]._pClass][ATTRIB_VIT]; - if (plr[pnum]._pBaseVit + l > max) { - l = max - plr[pnum]._pBaseVit; + max = MaxStats[plr[p]._pClass][ATTRIB_VIT]; + if (plr[p]._pBaseVit + l > max) { + l = max - plr[p]._pBaseVit; } - plr[pnum]._pVitality += l; - plr[pnum]._pBaseVit += l; + plr[p]._pVitality += l; + plr[p]._pBaseVit += l; ms = l << 6; - if (plr[pnum]._pClass == PC_WARRIOR) { + if (plr[p]._pClass == PC_WARRIOR) { ms *= 2; } - plr[pnum]._pHPBase += ms; - plr[pnum]._pMaxHPBase += ms; - plr[pnum]._pHitPoints += ms; - plr[pnum]._pMaxHP += ms; + plr[p]._pHPBase += ms; + plr[p]._pMaxHPBase += ms; + plr[p]._pHitPoints += ms; + plr[p]._pMaxHP += ms; - CalcPlrInv(pnum, TRUE); + CalcPlrInv(p, TRUE); - if (pnum == myplr) { - NetSendCmdParam1(FALSE, CMD_SETVIT, plr[pnum]._pBaseVit); + if (p == myplr) { + NetSendCmdParam1(FALSE, CMD_SETVIT, plr[p]._pBaseVit); } } -void SetPlayerHitPoints(int pnum, int newhp) +void SetPlayerHitPoints(int pnum, int val) { if ((DWORD)pnum >= MAX_PLRS) { app_fatal("SetPlayerHitPoints: illegal player %d", pnum); } - plr[pnum]._pHitPoints = newhp; - plr[pnum]._pHPBase = newhp + plr[pnum]._pMaxHPBase - plr[pnum]._pMaxHP; + plr[pnum]._pHitPoints = val; + plr[pnum]._pHPBase = val + plr[pnum]._pMaxHPBase - plr[pnum]._pMaxHP; if (pnum == myplr) { drawhpflag = TRUE; } } -void SetPlrStr(int pnum, int v) +void SetPlrStr(int p, int v) { int dm; - if ((DWORD)pnum >= MAX_PLRS) { - app_fatal("SetPlrStr: illegal player %d", pnum); + if ((DWORD)p >= MAX_PLRS) { + app_fatal("SetPlrStr: illegal player %d", p); } - plr[pnum]._pBaseStr = v; - CalcPlrInv(pnum, TRUE); + plr[p]._pBaseStr = v; + CalcPlrInv(p, TRUE); - if (plr[pnum]._pClass == PC_ROGUE) { - dm = plr[pnum]._pLevel * (plr[pnum]._pStrength + plr[pnum]._pDexterity) / 200; + if (plr[p]._pClass == PC_ROGUE) { + dm = plr[p]._pLevel * (plr[p]._pStrength + plr[p]._pDexterity) / 200; } else { - dm = plr[pnum]._pLevel * plr[pnum]._pStrength / 100; + dm = plr[p]._pLevel * plr[p]._pStrength / 100; } - plr[pnum]._pDamageMod = dm; + plr[p]._pDamageMod = dm; } -void SetPlrMag(int pnum, int v) +void SetPlrMag(int p, int v) { int m; - if ((DWORD)pnum >= MAX_PLRS) { - app_fatal("SetPlrMag: illegal player %d", pnum); + if ((DWORD)p >= MAX_PLRS) { + app_fatal("SetPlrMag: illegal player %d", p); } - plr[pnum]._pBaseMag = v; + plr[p]._pBaseMag = v; m = v << 6; - if (plr[pnum]._pClass == PC_SORCERER) { + if (plr[p]._pClass == PC_SORCERER) { m *= 2; } - plr[pnum]._pMaxManaBase = m; - plr[pnum]._pMaxMana = m; - CalcPlrInv(pnum, TRUE); + plr[p]._pMaxManaBase = m; + plr[p]._pMaxMana = m; + CalcPlrInv(p, TRUE); } -void SetPlrDex(int pnum, int v) +void SetPlrDex(int p, int v) { int dm; - if ((DWORD)pnum >= MAX_PLRS) { - app_fatal("SetPlrDex: illegal player %d", pnum); + if ((DWORD)p >= MAX_PLRS) { + app_fatal("SetPlrDex: illegal player %d", p); } - plr[pnum]._pBaseDex = v; - CalcPlrInv(pnum, TRUE); + plr[p]._pBaseDex = v; + CalcPlrInv(p, TRUE); - if (plr[pnum]._pClass == PC_ROGUE) { - dm = plr[pnum]._pLevel * (plr[pnum]._pStrength + plr[pnum]._pDexterity) / 200; + if (plr[p]._pClass == PC_ROGUE) { + dm = plr[p]._pLevel * (plr[p]._pStrength + plr[p]._pDexterity) / 200; } else { - dm = plr[pnum]._pStrength * plr[pnum]._pLevel / 100; + dm = plr[p]._pStrength * plr[p]._pLevel / 100; } - plr[pnum]._pDamageMod = dm; + plr[p]._pDamageMod = dm; } -void SetPlrVit(int pnum, int v) +void SetPlrVit(int p, int v) { int hp; - if ((DWORD)pnum >= MAX_PLRS) { - app_fatal("SetPlrVit: illegal player %d", pnum); + if ((DWORD)p >= MAX_PLRS) { + app_fatal("SetPlrVit: illegal player %d", p); } - plr[pnum]._pBaseVit = v; + plr[p]._pBaseVit = v; hp = v << 6; - if (plr[pnum]._pClass == PC_WARRIOR) { + if (plr[p]._pClass == PC_WARRIOR) { hp *= 2; } - plr[pnum]._pHPBase = hp; - plr[pnum]._pMaxHPBase = hp; - CalcPlrInv(pnum, TRUE); + plr[p]._pHPBase = hp; + plr[p]._pMaxHPBase = hp; + CalcPlrInv(p, TRUE); } void InitDungMsgs(int pnum) diff --git a/Source/player.h b/Source/player.h index 7513b24df49..7ef1d8e2e61 100644 --- a/Source/player.h +++ b/Source/player.h @@ -2,29 +2,29 @@ #ifndef __PLAYER_H__ #define __PLAYER_H__ -extern int plr_lframe_size; // idb -extern int plr_wframe_size; // idb -extern UCHAR plr_gfx_flag; -extern int plr_aframe_size; // idb +extern int plr_lframe_size; +extern int plr_wframe_size; +extern BYTE plr_gfx_flag; +extern int plr_aframe_size; extern int myplr; extern PlayerStruct plr[MAX_PLRS]; -extern int plr_fframe_size; // idb -extern int plr_qframe_size; // idb -extern BOOL deathflag; // idb -extern int plr_hframe_size; // idb -extern int plr_bframe_size; // idb -extern UCHAR plr_gfx_bflag; -extern int plr_sframe_size; // idb -extern int deathdelay; // weak -extern int plr_dframe_size; // idb +extern int plr_fframe_size; +extern int plr_qframe_size; +extern BOOL deathflag; +extern int plr_hframe_size; +extern int plr_bframe_size; +extern BYTE plr_gfx_bflag; +extern int plr_sframe_size; +extern int deathdelay; +extern int plr_dframe_size; -void SetPlayerGPtrs(UCHAR *pData, UCHAR **pAnim); /* unsigned char *+** */ +void SetPlayerGPtrs(BYTE *pData, BYTE **pAnim); void LoadPlrGFX(int pnum, player_graphic gfxflag); void InitPlayerGFX(int pnum); void InitPlrGFXMem(int pnum); DWORD GetPlrGFXSize(char *szCel); void FreePlayerGFX(int pnum); -void NewPlrAnim(int pnum, unsigned char *Peq, int numFrames, int Delay, int width); +void NewPlrAnim(int pnum, BYTE *Peq, int numFrames, int Delay, int width); void ClearPlrPVars(int pnum); void SetPlrAnims(int pnum); void ClearPlrRVars(PlayerStruct *p); @@ -41,7 +41,7 @@ BOOL PlrDirOK(int pnum, int dir); void PlrClrTrans(int x, int y); void PlrDoTrans(int x, int y); void SetPlayerOld(int pnum); -void FixPlayerLocation(int pnum, int dir); +void FixPlayerLocation(int pnum, int bDir); void StartStand(int pnum, int dir); void StartWalkStand(int pnum); void PM_ChangeLightOff(int pnum); @@ -85,27 +85,27 @@ BOOL PM_DoGotHit(int pnum); void ArmorDur(int pnum); BOOL PM_DoDeath(int pnum); void CheckNewPath(int pnum); -BOOL PlrDeathModeOK(int pnum); +BOOL PlrDeathModeOK(int p); void ValidatePlayer(); void ProcessPlayers(); void CheckCheatStats(int pnum); void ClrPlrPath(int pnum); -BOOL PosOkPlayer(int pnum, int px, int py); +BOOL PosOkPlayer(int pnum, int x, int y); void MakePlrPath(int pnum, int xx, int yy, BOOL endspace); void CheckPlrSpell(); void SyncPlrAnim(int pnum); void SyncInitPlrPos(int pnum); void SyncInitPlr(int pnum); -void CheckStats(int pnum); -void ModifyPlrStr(int pnum, int l); -void ModifyPlrMag(int pnum, int l); -void ModifyPlrDex(int pnum, int l); -void ModifyPlrVit(int pnum, int l); -void SetPlayerHitPoints(int pnum, int newhp); -void SetPlrStr(int pnum, int v); -void SetPlrMag(int pnum, int v); -void SetPlrDex(int pnum, int v); -void SetPlrVit(int pnum, int v); +void CheckStats(int p); +void ModifyPlrStr(int p, int l); +void ModifyPlrMag(int p, int l); +void ModifyPlrDex(int p, int l); +void ModifyPlrVit(int p, int l); +void SetPlayerHitPoints(int pnum, int val); +void SetPlrStr(int p, int v); +void SetPlrMag(int p, int v); +void SetPlrDex(int p, int v); +void SetPlrVit(int p, int v); void InitDungMsgs(int pnum); void PlayDungMsgs(); @@ -132,6 +132,6 @@ extern char *ClassStrTblOld[3]; extern int MaxStats[3][4]; extern int ExpLvlsTbl[MAXCHARLEVEL]; extern char *ClassStrTbl[3]; -extern unsigned char fix[9]; +extern BYTE fix[9]; #endif /* __PLAYER_H__ */ diff --git a/Source/setmaps.cpp b/Source/setmaps.cpp index 262c9b97999..a4f466d8c4a 100644 --- a/Source/setmaps.cpp +++ b/Source/setmaps.cpp @@ -104,8 +104,8 @@ void DRLG_SetMapTrans(char *sFileName) { int x, y; int i, j; - UCHAR *pLevelMap; - UCHAR *d; + BYTE *pLevelMap; + BYTE *d; DWORD dwOffset; pLevelMap = LoadFileInMem(sFileName, NULL); diff --git a/Source/spells.cpp b/Source/spells.cpp index 49b314685f9..6eac5afea77 100644 --- a/Source/spells.cpp +++ b/Source/spells.cpp @@ -79,7 +79,7 @@ void UseMana(int id, int sn) } } -BOOL CheckSpell(int id, int sn, BYTE st, BOOL manaonly) +BOOL CheckSpell(int id, int sn, char st, BOOL manaonly) { BOOL result; diff --git a/Source/spells.h b/Source/spells.h index 9376d27c3da..f8887d47ee7 100644 --- a/Source/spells.h +++ b/Source/spells.h @@ -4,7 +4,7 @@ int GetManaAmount(int id, int sn); void UseMana(int id, int sn); -BOOL CheckSpell(int id, int sn, BYTE st, BOOL manaonly); +BOOL CheckSpell(int id, int sn, char st, BOOL manaonly); void CastSpell(int id, int spl, int sx, int sy, int dx, int dy, int caster, int spllvl); void DoResurrect(int pnum, int rid); void PlacePlayer(int pnum); diff --git a/Source/stores.cpp b/Source/stores.cpp index cfa984b21d1..e8f00d07776 100644 --- a/Source/stores.cpp +++ b/Source/stores.cpp @@ -76,9 +76,9 @@ void InitStores() { int i; - pSTextBoxCels = LoadFileInMem("Data\\TextBox2.CEL", 0); - pCelBuff = LoadFileInMem("Data\\PentSpn2.CEL", 0); - pSTextSlidCels = LoadFileInMem("Data\\TextSlid.CEL", 0); + pSTextBoxCels = LoadFileInMem("Data\\TextBox2.CEL", NULL); + pCelBuff = LoadFileInMem("Data\\PentSpn2.CEL", NULL); + pSTextSlidCels = LoadFileInMem("Data\\TextSlid.CEL", NULL); ClearSText(0, 24); stextflag = STORE_NONE; InStoreFlag = 1; diff --git a/Source/town.cpp b/Source/town.cpp index 13ba17cda8f..bb5779c7d7c 100644 --- a/Source/town.cpp +++ b/Source/town.cpp @@ -1434,17 +1434,17 @@ void T_Pass3() } } - P3Tiles = LoadFileInMem("Levels\\TownData\\Town.TIL", 0); - pSector = LoadFileInMem("Levels\\TownData\\Sector1s.DUN", 0); + P3Tiles = LoadFileInMem("Levels\\TownData\\Town.TIL", NULL); + pSector = LoadFileInMem("Levels\\TownData\\Sector1s.DUN", NULL); T_FillSector(P3Tiles, pSector, 46, 46, 25, 25); mem_free_dbg(pSector); - pSector = LoadFileInMem("Levels\\TownData\\Sector2s.DUN", 0); + pSector = LoadFileInMem("Levels\\TownData\\Sector2s.DUN", NULL); T_FillSector(P3Tiles, pSector, 46, 0, 25, 23); mem_free_dbg(pSector); - pSector = LoadFileInMem("Levels\\TownData\\Sector3s.DUN", 0); + pSector = LoadFileInMem("Levels\\TownData\\Sector3s.DUN", NULL); T_FillSector(P3Tiles, pSector, 0, 46, 23, 25); mem_free_dbg(pSector); - pSector = LoadFileInMem("Levels\\TownData\\Sector4s.DUN", 0); + pSector = LoadFileInMem("Levels\\TownData\\Sector4s.DUN", NULL); T_FillSector(P3Tiles, pSector, 0, 0, 23, 23); mem_free_dbg(pSector); diff --git a/Source/towners.cpp b/Source/towners.cpp index 5607d124d76..5f38edcd0ae 100644 --- a/Source/towners.cpp +++ b/Source/towners.cpp @@ -149,7 +149,7 @@ void SetTownerGPtrs(BYTE *pData, BYTE **pAnim) #endif } -void NewTownerAnim(int tnum, unsigned char *pAnim, int numFrames, int Delay) +void NewTownerAnim(int tnum, BYTE *pAnim, int numFrames, int Delay) { towner[tnum]._tAnimCnt = 0; towner[tnum]._tAnimLen = numFrames; @@ -196,7 +196,7 @@ void InitSmith() InitTownerInfo(numtowners, 96, 1, TOWN_SMITH, 62, 63, 0, 10); InitQstSnds(numtowners); - towner[numtowners]._tNData = LoadFileInMem("Towners\\Smith\\SmithN.CEL", 0); + towner[numtowners]._tNData = LoadFileInMem("Towners\\Smith\\SmithN.CEL", NULL); for (i = 0; i < 8; i++) { towner[numtowners]._tNAnim[i] = towner[numtowners]._tNData; } @@ -213,7 +213,7 @@ void InitBarOwner() bannerflag = 0; // unused InitTownerInfo(numtowners, 96, 1, TOWN_TAVERN, 55, 62, 3, 10); InitQstSnds(numtowners); - towner[numtowners]._tNData = LoadFileInMem("Towners\\TwnF\\TwnFN.CEL", 0); + towner[numtowners]._tNData = LoadFileInMem("Towners\\TwnF\\TwnFN.CEL", NULL); for (i = 0; i < 8; i++) { towner[numtowners]._tNAnim[i] = towner[numtowners]._tNData; } @@ -230,7 +230,7 @@ void InitTownDead() InitTownerInfo(numtowners, 96, 1, TOWN_DEADGUY, 24, 32, -1, 10); InitQstSnds(numtowners); - towner[numtowners]._tNData = LoadFileInMem("Towners\\Butch\\Deadguy.CEL", 0); + towner[numtowners]._tNData = LoadFileInMem("Towners\\Butch\\Deadguy.CEL", NULL); for (i = 0; i < 8; i++) { towner[numtowners]._tNAnim[i] = towner[numtowners]._tNData; } @@ -246,7 +246,7 @@ void InitWitch() InitTownerInfo(numtowners, 96, 1, TOWN_WITCH, 80, 20, 5, 10); InitQstSnds(numtowners); - towner[numtowners]._tNData = LoadFileInMem("Towners\\TownWmn1\\Witch.CEL", 0); + towner[numtowners]._tNData = LoadFileInMem("Towners\\TownWmn1\\Witch.CEL", NULL); for (i = 0; i < 8; i++) { towner[numtowners]._tNAnim[i] = towner[numtowners]._tNData; } @@ -262,7 +262,7 @@ void InitBarmaid() InitTownerInfo(numtowners, 96, 1, TOWN_BMAID, 43, 66, -1, 10); InitQstSnds(numtowners); - towner[numtowners]._tNData = LoadFileInMem("Towners\\TownWmn1\\WmnN.CEL", 0); + towner[numtowners]._tNData = LoadFileInMem("Towners\\TownWmn1\\WmnN.CEL", NULL); for (i = 0; i < 8; i++) { towner[numtowners]._tNAnim[i] = towner[numtowners]._tNData; } @@ -279,7 +279,7 @@ void InitBoy() boyloadflag = 1; InitTownerInfo(numtowners, 96, 1, TOWN_PEGBOY, 11, 53, -1, 10); InitQstSnds(numtowners); - towner[numtowners]._tNData = LoadFileInMem("Towners\\TownBoy\\PegKid1.CEL", 0); + towner[numtowners]._tNData = LoadFileInMem("Towners\\TownBoy\\PegKid1.CEL", NULL); for (i = 0; i < 8; i++) { towner[numtowners]._tNAnim[i] = towner[numtowners]._tNData; } @@ -296,7 +296,7 @@ void InitHealer() InitTownerInfo(numtowners, 96, 1, TOWN_HEALER, 55, 79, 1, 10); InitQstSnds(numtowners); - towner[numtowners]._tNData = LoadFileInMem("Towners\\Healer\\Healer.CEL", 0); + towner[numtowners]._tNData = LoadFileInMem("Towners\\Healer\\Healer.CEL", NULL); for (i = 0; i < 8; i++) { towner[numtowners]._tNAnim[i] = towner[numtowners]._tNData; } @@ -312,7 +312,7 @@ void InitTeller() InitTownerInfo(numtowners, 96, 1, TOWN_STORY, 62, 71, 2, 10); InitQstSnds(numtowners); - towner[numtowners]._tNData = LoadFileInMem("Towners\\Strytell\\Strytell.CEL", 0); + towner[numtowners]._tNData = LoadFileInMem("Towners\\Strytell\\Strytell.CEL", NULL); for (i = 0; i < 8; i++) { towner[numtowners]._tNAnim[i] = towner[numtowners]._tNData; } @@ -328,7 +328,7 @@ void InitDrunk() InitTownerInfo(numtowners, 96, 1, TOWN_DRUNK, 71, 84, 4, 10); InitQstSnds(numtowners); - towner[numtowners]._tNData = LoadFileInMem("Towners\\Drunk\\TwnDrunk.CEL", 0); + towner[numtowners]._tNData = LoadFileInMem("Towners\\Drunk\\TwnDrunk.CEL", NULL); for (i = 0; i < 8; i++) { towner[numtowners]._tNAnim[i] = towner[numtowners]._tNData; } @@ -345,7 +345,7 @@ void InitCows() //if ( pCowCels ) // assertion_failed(300, "C:\\Diablo\\Direct\\towners.cpp", "! pCowCels"); - pCowCels = LoadFileInMem("Towners\\Animals\\Cow.CEL", 0); + pCowCels = LoadFileInMem("Towners\\Animals\\Cow.CEL", NULL); for (i = 0; i < 3; i++) { x = TownCowX[i]; y = TownCowY[i]; diff --git a/Source/towners.h b/Source/towners.h index 9a45f003f3d..310d84e3c16 100644 --- a/Source/towners.h +++ b/Source/towners.h @@ -5,8 +5,8 @@ extern TownerStruct towner[16]; int GetActiveTowner(int t); -void SetTownerGPtrs(BYTE *pData, BYTE **pAnim); /* unsigned char *+** */ -void NewTownerAnim(int tnum, unsigned char *pAnim, int numFrames, int Delay); +void SetTownerGPtrs(BYTE *pData, BYTE **pAnim); +void NewTownerAnim(int tnum, BYTE *pAnim, int numFrames, int Delay); void InitTownerInfo(int i, int w, int sel, int t, int x, int y, int ao, int tp); void InitQstSnds(int i); void InitSmith(); From 964c17457b0a9783dda4bf373adf41791fde0467 Mon Sep 17 00:00:00 2001 From: Robin Eklind Date: Sun, 7 Jul 2019 12:15:45 +0200 Subject: [PATCH 14/42] pfile: add BUGFIX comment for pfile_rename_temp_to_perm --- Source/pfile.cpp | 1 + 1 file changed, 1 insertion(+) diff --git a/Source/pfile.cpp b/Source/pfile.cpp index fe2bbc4a084..1d28e9fe9e3 100644 --- a/Source/pfile.cpp +++ b/Source/pfile.cpp @@ -584,6 +584,7 @@ void pfile_rename_temp_to_perm() mpqapi_rename(TempName, PermName); } } + // BUGFIX: function call has no purpose GetPermSaveNames(i, PermName); pfile_flush(TRUE, save_num); } From 94f7b179e2485d062e08a481897bb5bc487d5374 Mon Sep 17 00:00:00 2001 From: Anders Jenbo Date: Sun, 7 Jul 2019 13:17:37 +0200 Subject: [PATCH 15/42] Stop clang_format from breaking compiling --- .clang-format | 13 +++++++------ Source/.clang-format | 1 + 2 files changed, 8 insertions(+), 6 deletions(-) diff --git a/.clang-format b/.clang-format index 6c69a182f9a..11c499191b4 100644 --- a/.clang-format +++ b/.clang-format @@ -1,10 +1,11 @@ { - BasedOnStyle: webkit, - AlignTrailingComments: true, - AllowShortBlocksOnASingleLine: true, - AllowShortFunctionsOnASingleLine: None, - PointerAlignment: Right, - AlignConsecutiveAssignments: true, + BasedOnStyle: webkit, + AlignTrailingComments: true, + AllowShortBlocksOnASingleLine: true, + AllowShortFunctionsOnASingleLine: None, + PointerAlignment: Right, + AlignConsecutiveAssignments: true, TabWidth: 4, UseTab: ForIndentation, + SortIncludes: false, } diff --git a/Source/.clang-format b/Source/.clang-format index 7b78b700021..7074a477520 100644 --- a/Source/.clang-format +++ b/Source/.clang-format @@ -6,4 +6,5 @@ PointerAlignment: Right, TabWidth: 4, UseTab: ForIndentation, + SortIncludes: false, } From dc4f0572f61e0cc179df6f08e0df089b97361740 Mon Sep 17 00:00:00 2001 From: Anders Jenbo Date: Sun, 7 Jul 2019 13:18:16 +0200 Subject: [PATCH 16/42] Remove unused variables --- Source/diablo.h | 2 -- Source/dthread.h | 1 - Source/dx.h | 2 -- Source/effects.h | 1 - Source/engine.h | 1 - Source/init.cpp | 2 -- Source/init.h | 1 - Source/interfac.h | 1 - Source/logging.h | 2 -- Source/mainmenu.h | 2 -- Source/multi.h | 1 - 11 files changed, 16 deletions(-) diff --git a/Source/diablo.h b/Source/diablo.h index 1456905774b..aefb2cc4ee6 100644 --- a/Source/diablo.h +++ b/Source/diablo.h @@ -151,8 +151,6 @@ void diablo_color_cyc_logic(); /* data */ -extern int diablo_inf; // weak - /* rdata */ extern BOOL fullscreen; diff --git a/Source/dthread.h b/Source/dthread.h index 49e1704c8df..c029a277b86 100644 --- a/Source/dthread.h +++ b/Source/dthread.h @@ -12,6 +12,5 @@ unsigned int __stdcall dthread_handler(void *unused); void dthread_cleanup(); /* data */ -extern int dthread_inf; // weak #endif /* __DTHREAD_H__ */ diff --git a/Source/dx.h b/Source/dx.h index 6ba83e4ddd0..91344a85d6a 100644 --- a/Source/dx.h +++ b/Source/dx.h @@ -25,6 +25,4 @@ void j_dx_reinit(); /* data */ -extern int dx_inf; - #endif /* __DX_H__ */ diff --git a/Source/effects.h b/Source/effects.h index 7790ed57467..300bf145897 100644 --- a/Source/effects.h +++ b/Source/effects.h @@ -30,7 +30,6 @@ void __stdcall effects_play_sound(char *snd_file); /* rdata */ -extern const int effects_inf; // weak extern const char monster_action_sounds[]; /* data */ diff --git a/Source/engine.h b/Source/engine.h index 017fa85210a..333f88ed02c 100644 --- a/Source/engine.h +++ b/Source/engine.h @@ -64,7 +64,6 @@ void PlayInGameMovie(char *pszMovie); /* rdata */ -extern const int engine_inf; // weak extern const int rand_increment; // unused extern const int rand_multiplier; // unused diff --git a/Source/init.cpp b/Source/init.cpp index 9b92adcc22d..f6241b9f511 100644 --- a/Source/init.cpp +++ b/Source/init.cpp @@ -431,8 +431,6 @@ void init_activate_window(HWND hWnd, BOOL bActive) LRESULT __stdcall WindowProc(HWND hWnd, UINT Msg, WPARAM wParam, LPARAM lParam) { - LRESULT result; - if (CurrentProc) return CurrentProc(hWnd, Msg, wParam, lParam); diff --git a/Source/init.h b/Source/init.h index 7b7a46ac92c..5478888972e 100644 --- a/Source/init.h +++ b/Source/init.h @@ -33,7 +33,6 @@ LRESULT __stdcall WindowProc(HWND hWnd, UINT Msg, WPARAM wParam, LPARAM lParam); WNDPROC SetWindowProc(WNDPROC NewProc); /* rdata */ -extern const int init_inf; // weak /* data */ diff --git a/Source/interfac.h b/Source/interfac.h index d093f69fa35..7686471b696 100644 --- a/Source/interfac.h +++ b/Source/interfac.h @@ -14,7 +14,6 @@ void InitCutscene(unsigned int uMsg); /* rdata */ -extern const int interfac_inf; // weak extern const unsigned char progress_bar_colours[3]; extern const int progress_bar_screen_pos[3][2]; diff --git a/Source/logging.h b/Source/logging.h index e562eb84f9f..13b0ec7c0d8 100644 --- a/Source/logging.h +++ b/Source/logging.h @@ -15,8 +15,6 @@ void log_dump_computer_info(); /* rdata */ -extern const int log_inf; - /* data */ extern int log_not_created; diff --git a/Source/mainmenu.h b/Source/mainmenu.h index c8f8221516d..897856a84ec 100644 --- a/Source/mainmenu.h +++ b/Source/mainmenu.h @@ -23,8 +23,6 @@ void mainmenu_play_intro(); /* rdata */ -extern const int mainmenu_inf; // weak - /* data */ extern int menu_music_track_id; // idb diff --git a/Source/multi.h b/Source/multi.h index 8ea04f36a78..7449a097b7e 100644 --- a/Source/multi.h +++ b/Source/multi.h @@ -57,7 +57,6 @@ void recv_plrinfo(int pnum, TCmdPlrInfoHdr *p, BOOL recv); /* rdata */ -extern const int multi_inf; // weak extern const int event_types[3]; #endif /* __MULTI_H__ */ From 7883043adc3f0440df93d1a918d68a17502f3583 Mon Sep 17 00:00:00 2001 From: Anders Jenbo Date: Sun, 7 Jul 2019 13:18:39 +0200 Subject: [PATCH 17/42] Clean up files with dirty headers --- Source/codec.h | 2 +- Source/cursor.cpp | 26 +++++++++---------- Source/cursor.h | 26 +++++++++---------- Source/engine.cpp | 52 ++++---------------------------------- Source/engine.h | 10 ++++---- Source/fault.h | 2 +- Source/path.cpp | 64 ++++++++++++++++++++++++++++++----------------- Source/path.h | 4 +-- 8 files changed, 81 insertions(+), 105 deletions(-) diff --git a/Source/codec.h b/Source/codec.h index 8ad33ac3821..0cae278498b 100644 --- a/Source/codec.h +++ b/Source/codec.h @@ -5,6 +5,6 @@ int codec_decode(BYTE *pbSrcDst, DWORD size, char *pszPassword); void codec_init_key(int unused, char *pszPassword); DWORD codec_get_encoded_len(DWORD dwSrcBytes); -void codec_encode(BYTE* pbSrcDst, DWORD size, int size_64, char *pszPassword); +void codec_encode(BYTE *pbSrcDst, DWORD size, int size_64, char *pszPassword); #endif /* __CODEC_H__ */ diff --git a/Source/cursor.cpp b/Source/cursor.cpp index 1e538c389f3..c1041dab274 100644 --- a/Source/cursor.cpp +++ b/Source/cursor.cpp @@ -1,23 +1,23 @@ #include "diablo.h" -int cursH; // weak -int icursH28; // idb -int cursW; // idb -int pcursmonst; // idb -int icursW28; // idb +int cursH; +int icursH28; +int cursW; +int pcursmonst; +int icursW28; void *pCursCels; -int icursH; // weak +int icursH; // inv_item value -char pcursinvitem; // weak -int icursW; // weak -char pcursitem; // weak -char pcursobj; // weak -char pcursplr; // weak +char pcursinvitem; +int icursW; +char pcursitem; +char pcursobj; +char pcursplr; int cursmx; int cursmy; -int pcurstemp; // weak -int pcurs; // idb +int pcurstemp; +int pcurs; /* rdata */ const int InvItemWidth[180] = { diff --git a/Source/cursor.h b/Source/cursor.h index 10ca56a85f2..64a3369212b 100644 --- a/Source/cursor.h +++ b/Source/cursor.h @@ -2,22 +2,22 @@ #ifndef __CURSOR_H__ #define __CURSOR_H__ -extern int cursH; // weak -extern int icursH28; // idb -extern int cursW; // idb -extern int pcursmonst; // idb -extern int icursW28; // idb +extern int cursH; +extern int icursH28; +extern int cursW; +extern int pcursmonst; +extern int icursW28; extern void *pCursCels; -extern int icursH; // weak -extern char pcursinvitem; // weak -extern int icursW; // weak -extern char pcursitem; // weak -extern char pcursobj; // weak -extern char pcursplr; // weak +extern int icursH; +extern char pcursinvitem; +extern int icursW; +extern char pcursitem; +extern char pcursobj; +extern char pcursplr; extern int cursmx; extern int cursmy; -extern int pcurstemp; // weak -extern int pcurs; // idb +extern int pcurstemp; +extern int pcurs; void InitCursor(); void FreeCursor(); diff --git a/Source/engine.cpp b/Source/engine.cpp index 53ca7e36a6a..1f75eb67b94 100644 --- a/Source/engine.cpp +++ b/Source/engine.cpp @@ -6,15 +6,15 @@ #endif char gbPixelCol; // automap pixel color 8-bit (palette entry) -int gbRotateMap; // BOOLEAN flip - if y < x -int orgseed; // weak +BOOL gbRotateMap; // flip - if y < x +int orgseed; int sgnWidth; -int sglGameSeed; // weak +int sglGameSeed; #ifdef __cplusplus static CCritSect sgMemCrit; #endif -int SeedCount; // weak -int gbNotInView; // BOOLEAN valid - if x/y are in bounds +int SeedCount; +BOOL gbNotInView; // valid - if x/y are in bounds const int rand_increment = 1; const int rand_multiplier = 0x015A4E35; @@ -388,7 +388,6 @@ void CelDecDatLightOnly(BYTE *pDecodeTo, BYTE *pRLEBytes, int nDataSize, int nWi } #endif } -// 69BEF8: using guessed type int light_table_index; void CelDecDatLightTrans(BYTE *pDecodeTo, BYTE *pRLEBytes, int nDataSize, int nWidth) { @@ -576,7 +575,6 @@ void CelDecDatLightTrans(BYTE *pDecodeTo, BYTE *pRLEBytes, int nDataSize, int nW } #endif } -// 69BEF8: using guessed type int light_table_index; void CelDecodeLightOnly(int sx, int sy, BYTE *pCelBuff, int nCel, int nWidth) { @@ -602,7 +600,6 @@ void CelDecodeLightOnly(int sx, int sy, BYTE *pCelBuff, int nCel, int nWidth) else CelDrawDatOnly(pDecodeTo, pRLEBytes, nDataSize, nWidth); } -// 69BEF8: using guessed type int light_table_index; /** * @param CelSkip Skip lower parts of sprite, must be multiple of 2, max 8 @@ -646,7 +643,6 @@ void CelDecodeHdrLightOnly(int sx, int sy, BYTE *pCelBuff, int nCel, int nWidth, else CelDrawDatOnly(pDecodeTo, pRLEBytes, nDataSize, nWidth); } -// 69BEF8: using guessed type int light_table_index; /** * @param CelSkip Skip lower parts of sprite, must be multiple of 2, max 8 @@ -691,8 +687,6 @@ void CelDecodeHdrLightTrans(BYTE *pBuff, BYTE *pCelBuff, int nCel, int nWidth, i else CelDrawDatOnly(pBuff, pRLEBytes, nDataSize, nWidth); } -// 69BEF8: using guessed type int light_table_index; -// 69CF94: using guessed type int cel_transparency_active; /** * @param CelSkip Skip lower parts of sprite, must be multiple of 2, max 8 @@ -810,7 +804,6 @@ void CelDrawHdrLightRed(int sx, int sy, BYTE *pCelBuff, int nCel, int nWidth, in } #endif } -// 525728: using guessed type int light4flag; void Cel2DecDatOnly(BYTE *pDecodeTo, BYTE *pRLEBytes, int nDataSize, int nWidth) { @@ -924,7 +917,6 @@ void Cel2DecDatOnly(BYTE *pDecodeTo, BYTE *pRLEBytes, int nDataSize, int nWidth) } #endif } -// 69CF0C: using guessed type int gpBufEnd; /** * @param CelSkip Skip lower parts of sprite, must be multiple of 2, max 8 @@ -1171,8 +1163,6 @@ void Cel2DecDatLightOnly(BYTE *pDecodeTo, BYTE *pRLEBytes, int nDataSize, int nW } #endif } -// 69BEF8: using guessed type int light_table_index; -// 69CF0C: using guessed type int gpBufEnd; void Cel2DecDatLightTrans(BYTE *pDecodeTo, BYTE *pRLEBytes, int nDataSize, int nWidth) { @@ -1374,8 +1364,6 @@ void Cel2DecDatLightTrans(BYTE *pDecodeTo, BYTE *pRLEBytes, int nDataSize, int n } #endif } -// 69BEF8: using guessed type int light_table_index; -// 69CF0C: using guessed type int gpBufEnd; /** * @param CelSkip Skip lower parts of sprite, must be multiple of 2, max 8 @@ -1419,7 +1407,6 @@ void Cel2DecodeHdrLight(int sx, int sy, BYTE *pCelBuff, int nCel, int nWidth, in else Cel2DecDatOnly(pDecodeTo, pRLEBytes, nDataSize, nWidth); } -// 69BEF8: using guessed type int light_table_index; /** * @param CelSkip Skip lower parts of sprite, must be multiple of 2, max 8 @@ -1461,8 +1448,6 @@ void Cel2DecodeLightTrans(BYTE *pBuff, BYTE *pCelBuff, int nCel, int nWidth, int else Cel2DecDatOnly(pBuff, pRLEBytes, nDataSize, nWidth); } -// 69BEF8: using guessed type int light_table_index; -// 69CF94: using guessed type int cel_transparency_active; /** * @param CelSkip Skip lower parts of sprite, must be multiple of 2, max 8 @@ -1587,8 +1572,6 @@ void Cel2DrawHdrLightRed(int sx, int sy, BYTE *pCelBuff, int nCel, int nWidth, i } #endif } -// 525728: using guessed type int light4flag; -// 69CF0C: using guessed type int gpBufEnd; void CelDecodeRect(BYTE *pBuff, int CelSkip, int hgt, int wdt, BYTE *pCelBuff, int nCel, int nWidth) { @@ -2029,7 +2012,6 @@ void CelDrawHdrClrHL(char col, int sx, int sy, BYTE *pCelBuff, int nCel, int nWi } #endif } -// 69CF0C: using guessed type int gpBufEnd; void ENG_set_pixel(int sx, int sy, BYTE col) { @@ -2056,7 +2038,6 @@ void ENG_set_pixel(int sx, int sy, BYTE col) *dst = col; #endif } -// 69CF0C: using guessed type int gpBufEnd; void engine_draw_pixel(int sx, int sy) { @@ -2088,10 +2069,6 @@ void engine_draw_pixel(int sx, int sy) *dst = gbPixelCol; #endif } -// 52B96C: using guessed type char gbPixelCol; -// 52B970: using guessed type int gbRotateMap; -// 52B99C: using guessed type int gbNotInView; -// 69CF0C: using guessed type int gpBufEnd; // Exact copy from https://github.com/erich666/GraphicsGems/blob/dad26f941e12c8bf1f96ea21c1c04cd2206ae7c9/gems/DoubleLine.c // Except: @@ -2301,9 +2278,6 @@ void DrawLine(int x0, int y0, int x1, int y1, BYTE col) } } } -// 52B96C: using guessed type char gbPixelCol; -// 52B970: using guessed type int gbRotateMap; -// 52B99C: using guessed type int gbNotInView; int GetDirection(int x1, int y1, int x2, int y2) { @@ -2351,9 +2325,6 @@ void SetRndSeed(int s) sglGameSeed = s; orgseed = s; } -// 52B974: using guessed type int orgseed; -// 52B97C: using guessed type int sglGameSeed; -// 52B998: using guessed type int SeedCount; int GetRndSeed() { @@ -2361,8 +2332,6 @@ int GetRndSeed() sglGameSeed = rand_multiplier * sglGameSeed + rand_increment; return abs(sglGameSeed); } -// 52B97C: using guessed type int sglGameSeed; -// 52B998: using guessed type int SeedCount; int random(BYTE idx, int v) { @@ -2942,7 +2911,6 @@ void Cl2DecodeFrm3(int sx, int sy, BYTE *pCelBuff, int nCel, int nWidth, int Cel nWidth, &pLightTbl[idx]); } -// 525728: using guessed type int light4flag; void Cl2DecDatLightTbl1(BYTE *pDecodeTo, BYTE *pRLEBytes, int nDataSize, int nWidth, BYTE *pTable) { @@ -3093,7 +3061,6 @@ void Cl2DecDatLightTbl1(BYTE *pDecodeTo, BYTE *pRLEBytes, int nDataSize, int nWi } #endif } -// 52B978: using guessed type int sgnWidth; /** * @param CelSkip Skip lower parts of sprite, must be multiple of 2, max 8 @@ -3138,7 +3105,6 @@ void Cl2DecodeLightTbl(int sx, int sy, BYTE *pCelBuff, int nCel, int nWidth, int else Cl2DecDatFrm1(pDecodeTo, pRLEBytes, nSize, nWidth); } -// 69BEF8: using guessed type int light_table_index; /** * @param CelSkip Skip lower parts of sprite, must be multiple of 2, max 8 @@ -3334,7 +3300,6 @@ void Cl2DecDatFrm4(BYTE *pDecodeTo, BYTE *pRLEBytes, int nDataSize, int nWidth) } #endif } -// 69CF0C: using guessed type int gpBufEnd; /** * @param CelSkip Skip lower parts of sprite, must be multiple of 2, max 8 @@ -3379,7 +3344,6 @@ void Cl2DecodeClrHL(char col, int sx, int sy, BYTE *pCelBuff, int nCel, int nWid col); gpBufEnd += BUFFER_WIDTH; } -// 69CF0C: using guessed type int gpBufEnd; void Cl2DecDatClrHL(BYTE *pDecodeTo, BYTE *pRLEBytes, int nDataSize, int nWidth, char col) { @@ -3553,7 +3517,6 @@ void Cl2DecDatClrHL(BYTE *pDecodeTo, BYTE *pRLEBytes, int nDataSize, int nWidth, } #endif } -// 69CF0C: using guessed type int gpBufEnd; /** * @param CelSkip Skip lower parts of sprite, must be multiple of 2, max 8 @@ -3606,7 +3569,6 @@ void Cl2DecodeFrm5(int sx, int sy, BYTE *pCelBuff, int nCel, int nWidth, int Cel nWidth, &pLightTbl[idx]); } -// 525728: using guessed type int light4flag; void Cl2DecDatLightTbl2(BYTE *pDecodeTo, BYTE *pRLEBytes, int nDataSize, int nWidth, BYTE *pTable) { @@ -3770,8 +3732,6 @@ void Cl2DecDatLightTbl2(BYTE *pDecodeTo, BYTE *pRLEBytes, int nDataSize, int nWi } #endif } -// 52B978: using guessed type int sgnWidth; -// 69CF0C: using guessed type int gpBufEnd; /** * @param CelSkip Skip lower parts of sprite, must be multiple of 2, max 8 @@ -3816,7 +3776,6 @@ void Cl2DecodeFrm6(int sx, int sy, BYTE *pCelBuff, int nCel, int nWidth, int Cel else Cl2DecDatFrm4(pDecodeTo, pRLEBytes, nSize, nWidth); } -// 69BEF8: using guessed type int light_table_index; void PlayInGameMovie(char *pszMovie) { @@ -3828,4 +3787,3 @@ void PlayInGameMovie(char *pszMovie) PaletteFadeIn(8); drawpanflag = 255; } -// 52571C: using guessed type int drawpanflag; diff --git a/Source/engine.h b/Source/engine.h index 333f88ed02c..ba29eb01e4a 100644 --- a/Source/engine.h +++ b/Source/engine.h @@ -5,11 +5,11 @@ //offset 0 //pCelBuff->pFrameTable[0] -extern char gbPixelCol; // automap pixel color 8-bit (palette entry) -extern int gbRotateMap; // bool flip - if y < x -extern int orgseed; // weak -extern int SeedCount; // weak -extern int gbNotInView; // bool valid - if x/y are in bounds +extern char gbPixelCol; // automap pixel color 8-bit (palette entry) +extern BOOL gbRotateMap; // flip - if y < x +extern int orgseed; +extern int SeedCount; +extern BOOL gbNotInView; // valid - if x/y are in bounds void CelDrawDatOnly(BYTE *pDecodeTo, BYTE *pRLEBytes, int nDataSize, int nWidth); void CelDecodeOnly(int sx, int sy, BYTE *pCelBuff, int nCel, int nWidth); diff --git a/Source/fault.h b/Source/fault.h index ec669c7ac48..beb2e61ab5b 100644 --- a/Source/fault.h +++ b/Source/fault.h @@ -18,7 +18,7 @@ void fault_hex_format(BYTE *ptr, unsigned int numBytes); void fault_unknown_module(LPCVOID lpAddress, LPSTR lpModuleName, int iMaxLength, int *sectionNum, int *sectionOffset); void fault_call_stack(void *instr, STACK_FRAME *stackAddr); char *fault_get_error_type(DWORD dwMessageId, LPSTR lpString1, DWORD nSize); -void * fault_set_filter(void *unused); +void *fault_set_filter(void *unused); LPTOP_LEVEL_EXCEPTION_FILTER fault_reset_filter(void *unused); LPTOP_LEVEL_EXCEPTION_FILTER fault_get_filter(); diff --git a/Source/path.cpp b/Source/path.cpp index faf7c161187..516e1ed028b 100644 --- a/Source/path.cpp +++ b/Source/path.cpp @@ -34,7 +34,8 @@ const char pathydir[8] = { -1, 1, -1, 1, 0, -1, 0, 1 }; */ char path_directions[9] = { 5, 1, 6, 2, 0, 3, 8, 4, 7 }; -/* find the shortest path from (sx,sy) to (dx,dy), using PosOk(PosOkArg,x,y) to +/** + * find the shortest path from (sx,sy) to (dx,dy), using PosOk(PosOkArg,x,y) to * check that each step is a valid position. Store the step directions (see * path_directions) in path, which must have room for 24 steps */ @@ -83,7 +84,9 @@ int FindPath(BOOL (*PosOk)(int, int, int), int PosOkArg, int sx, int sy, int dx, return 0; } -/* heuristic, estimated cost from (sx,sy) to (dx,dy) */ +/** + * @brief heuristic, estimated cost from (sx,sy) to (dx,dy) + */ int path_get_h_cost(int sx, int sy, int dx, int dy) { int delta_x = abs(sx - dx); @@ -96,7 +99,8 @@ int path_get_h_cost(int sx, int sy, int dx, int dy) return 2 * (min + max); } -/* return 2 if pPath is horizontally/vertically aligned with (dx,dy), else 3 +/** + * @brief return 2 if pPath is horizontally/vertically aligned with (dx,dy), else 3 * * This approximates that diagonal movement on a square grid should have a cost * of sqrt(2). That's approximately 1.5, so they multiply all step costs by 2, @@ -110,8 +114,8 @@ int path_check_equal(PATHNODE *pPath, int dx, int dy) return 3; } -/* get the next node on the A* frontier to explore (estimated to be closest to - * the goal), mark it as visited, and return it +/** + * @brief get the next node on the A* frontier to explore (estimated to be closest to the goal), mark it as visited, and return it */ PATHNODE *GetNextPath() { @@ -128,13 +132,15 @@ PATHNODE *GetNextPath() return result; } -/* check if stepping from pPath to (dx,dy) cuts a corner. If you step from A to - * B, both Xs need to be clear: +/** + * @brief check if stepping from pPath to (dx,dy) cuts a corner. + * + * If you step from A to B, both Xs need to be clear: * * AX * XB * - * return true if step is allowed + * @return true if step is allowed */ BOOL path_solid_pieces(PATHNODE *pPath, int dx, int dy) { @@ -156,10 +162,10 @@ BOOL path_solid_pieces(PATHNODE *pPath, int dx, int dy) return rv; } -/* perform a single step of A* bread-first search by trying to step in every - * possible direction from pPath with goal (x,y). Check each step with PosOk +/** + * @brief perform a single step of A* bread-first search by trying to step in every possible direction from pPath with goal (x,y). Check each step with PosOk * - * return 0 if we ran out of preallocated nodes to use, else 1 + * @return FALSE if we ran out of preallocated nodes to use, else TRUE */ BOOL path_get_path(BOOL (*PosOk)(int, int, int), int PosOkArg, PATHNODE *pPath, int x, int y) { @@ -180,10 +186,10 @@ BOOL path_get_path(BOOL (*PosOk)(int, int, int), int PosOkArg, PATHNODE *pPath, return TRUE; } -/* add a step from pPath to (dx,dy), return 1 if successful, and update the - * frontier/visited nodes accordingly +/** + * @brief add a step from pPath to (dx,dy), return 1 if successful, and update the frontier/visited nodes accordingly * - * return 1 if step successfully added, 0 if we ran out of nodes to use + * @return TRUE if step successfully added, FALSE if we ran out of nodes to use */ BOOL path_parent_path(PATHNODE *pPath, int dx, int dy, int sx, int sy) { @@ -251,7 +257,9 @@ BOOL path_parent_path(PATHNODE *pPath, int dx, int dy, int sx, int sy) return TRUE; } -/* return a node for (dx,dy) on the frontier, or NULL if not found */ +/** + * @brief return a node for (dx,dy) on the frontier, or NULL if not found + */ PATHNODE *path_get_node1(int dx, int dy) { PATHNODE *result = path_2_nodes->NextNode; @@ -260,7 +268,9 @@ PATHNODE *path_get_node1(int dx, int dy) return result; } -/* return a node for (dx,dy) if it was visited, or NULL if not found */ +/** + * @brief return a node for (dx,dy) if it was visited, or NULL if not found + */ PATHNODE *path_get_node2(int dx, int dy) { PATHNODE *result = pnode_ptr->NextNode; @@ -269,8 +279,9 @@ PATHNODE *path_get_node2(int dx, int dy) return result; } -/* insert pPath into the frontier (keeping the frontier sorted by total - * distance) */ +/** + * @brief insert pPath into the frontier (keeping the frontier sorted by total distance) + */ void path_next_node(PATHNODE *pPath) { PATHNODE *next, *current; @@ -292,7 +303,9 @@ void path_next_node(PATHNODE *pPath) } } -/* update all path costs using depth-first search starting at pPath */ +/** + * @brief update all path costs using depth-first search starting at pPath + */ void path_set_coords(PATHNODE *pPath) { PATHNODE *PathOld; @@ -319,7 +332,9 @@ void path_set_coords(PATHNODE *pPath) } } -/* push pPath onto the pnode_tblptr stack */ +/** + * @brief push pPath onto the pnode_tblptr stack + */ void path_push_active_step(PATHNODE *pPath) { int stack_index = gdwCurPathStep; @@ -327,15 +342,18 @@ void path_push_active_step(PATHNODE *pPath) pnode_tblptr[stack_index] = pPath; } -/* pop and return a node from the pnode_tblptr stack */ +/** + * @brief pop and return a node from the pnode_tblptr stack + */ PATHNODE *path_pop_active_step() { gdwCurPathStep--; return pnode_tblptr[gdwCurPathStep]; } -/* zero one of the preallocated nodes and return a pointer to it, or NULL if - * none are available */ +/** + * @brief zero one of the preallocated nodes and return a pointer to it, or NULL if none are available + */ PATHNODE *path_new_step() { PATHNODE *new_node; diff --git a/Source/path.h b/Source/path.h index 6c453d6ae63..04d30e2788f 100644 --- a/Source/path.h +++ b/Source/path.h @@ -11,12 +11,12 @@ extern PATHNODE *pnode_tblptr[MAXPATHNODES]; extern PATHNODE *path_2_nodes; extern PATHNODE path_unusednodes[MAXPATHNODES]; -int FindPath(BOOL(*PosOk)(int, int, int), int PosOkArg, int sx, int sy, int dx, int dy, char *path); +int FindPath(BOOL (*PosOk)(int, int, int), int PosOkArg, int sx, int sy, int dx, int dy, char *path); int path_get_h_cost(int sx, int sy, int dx, int dy); int path_check_equal(PATHNODE *pPath, int dx, int dy); PATHNODE *GetNextPath(); BOOL path_solid_pieces(PATHNODE *pPath, int dx, int dy); -BOOL path_get_path(BOOL(*PosOk)(int, int, int), int PosOkArg, PATHNODE *pPath, int x, int y); +BOOL path_get_path(BOOL (*PosOk)(int, int, int), int PosOkArg, PATHNODE *pPath, int x, int y); BOOL path_parent_path(PATHNODE *pPath, int dx, int dy, int sx, int sy); PATHNODE *path_get_node1(int dx, int dy); PATHNODE *path_get_node2(int dx, int dy); From 55b5ce883d5d175cc9b4f36c62c3f24ab24de678 Mon Sep 17 00:00:00 2001 From: Anders Jenbo Date: Sun, 7 Jul 2019 14:21:25 +0200 Subject: [PATCH 18/42] Clean up unformatted files --- Source/engine.cpp | 2 +- Source/lighting.cpp | 12 +++--- Source/lighting.h | 8 ++-- Source/msgcmd.cpp | 5 ++- Source/scrollrt.cpp | 102 ++++++++++++++++++++++---------------------- Source/town.cpp | 24 +++++------ Source/town.h | 4 +- 7 files changed, 79 insertions(+), 78 deletions(-) diff --git a/Source/engine.cpp b/Source/engine.cpp index 1f75eb67b94..e5dc4732941 100644 --- a/Source/engine.cpp +++ b/Source/engine.cpp @@ -5,7 +5,7 @@ #pragma warning(disable : 4731) // frame pointer register 'ebp' modified by inline assembly code #endif -char gbPixelCol; // automap pixel color 8-bit (palette entry) +char gbPixelCol; // automap pixel color 8-bit (palette entry) BOOL gbRotateMap; // flip - if y < x int orgseed; int sgnWidth; diff --git a/Source/lighting.cpp b/Source/lighting.cpp index 5c622cd7875..c6a78f33acc 100644 --- a/Source/lighting.cpp +++ b/Source/lighting.cpp @@ -1,7 +1,7 @@ #include "diablo.h" LightListStruct VisionList[MAXVISION]; -unsigned char lightactive[MAXLIGHTS]; +BYTE lightactive[MAXLIGHTS]; LightListStruct LightList[MAXLIGHTS]; int numlights; BYTE lightradius[16][128]; @@ -400,7 +400,7 @@ char *pCrawlTable[19] = /* figure out what this is for */ CrawlTable + 2187, CrawlTable + 2460 }; -unsigned char vCrawlTable[23][30] = { +BYTE vCrawlTable[23][30] = { { 1, 0, 2, 0, 3, 0, 4, 0, 5, 0, 6, 0, 7, 0, 8, 0, 9, 0, 10, 0, 11, 0, 12, 0, 13, 0, 14, 0, 15, 0 }, { 1, 0, 2, 0, 3, 0, 4, 0, 5, 0, 6, 0, 7, 0, 8, 1, 9, 1, 10, 1, 11, 1, 12, 1, 13, 1, 14, 1, 15, 1 }, { 1, 0, 2, 0, 3, 0, 4, 1, 5, 1, 6, 1, 7, 1, 8, 1, 9, 1, 10, 1, 11, 1, 12, 2, 13, 2, 14, 2, 15, 2 }, @@ -425,7 +425,7 @@ unsigned char vCrawlTable[23][30] = { { 0, 1, 0, 2, 0, 3, 0, 4, 0, 5, 0, 6, 0, 7, 1, 8, 1, 9, 1, 10, 1, 11, 1, 12, 1, 13, 1, 14, 1, 15 }, { 0, 1, 0, 2, 0, 3, 0, 4, 0, 5, 0, 6, 0, 7, 0, 8, 0, 9, 0, 10, 0, 11, 0, 12, 0, 13, 0, 14, 0, 15 } }; -unsigned char byte_49463C[18][18] = /* unused */ +BYTE byte_49463C[18][18] = /* unused */ { { 0, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3 }, { 0, 1, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3 }, @@ -447,7 +447,7 @@ unsigned char byte_49463C[18][18] = /* unused */ { 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 2, 2, 2, 2, 2 } }; -unsigned char RadiusAdj[23] = { 0, 0, 0, 0, 1, 1, 1, 2, 2, 2, 3, 4, 3, 2, 2, 2, 1, 1, 1, 0, 0, 0, 0 }; +BYTE RadiusAdj[23] = { 0, 0, 0, 0, 1, 1, 1, 2, 2, 2, 3, 4, 3, 2, 2, 2, 1, 1, 1, 0, 0, 0, 0 }; void RotateRadius(int *x, int *y, int *dx, int *dy, int *lx, int *ly, int *bx, int *by) { @@ -723,7 +723,7 @@ void DoVision(int nXPos, int nYPos, int nRadius, BOOL doautomap, BOOL visible) break; } if (nCrawlX >= 0 && nCrawlX <= MAXDUNX && nCrawlY >= 0 && nCrawlY <= MAXDUNY) { - nBlockerFlag = (unsigned char)nBlockTable[dPiece[nCrawlX][nCrawlY]]; + nBlockerFlag = (BYTE)nBlockTable[dPiece[nCrawlX][nCrawlY]]; if (!nBlockTable[dPiece[x1adj + nCrawlX][y1adj + nCrawlY]] || !nBlockTable[dPiece[x2adj + nCrawlX][y2adj + nCrawlY]]) { if (doautomap) { @@ -1097,7 +1097,7 @@ void ChangeLight(int i, int x, int y, int r) void ProcessLightList() { int i, j; - unsigned char temp; + BYTE temp; if (lightflag) { return; diff --git a/Source/lighting.h b/Source/lighting.h index 7f395f04ddc..b755bd6d5d1 100644 --- a/Source/lighting.h +++ b/Source/lighting.h @@ -3,7 +3,7 @@ #define __LIGHTING_H__ extern LightListStruct VisionList[MAXVISION]; -extern unsigned char lightactive[MAXLIGHTS]; +extern BYTE lightactive[MAXLIGHTS]; extern LightListStruct LightList[MAXLIGHTS]; extern int numlights; extern BYTE lightradius[16][128]; @@ -49,8 +49,8 @@ void lighting_color_cycling(); extern char CrawlTable[2749]; extern char *pCrawlTable[19]; -extern unsigned char vCrawlTable[23][30]; -extern unsigned char byte_49463C[18][18]; -extern unsigned char RadiusAdj[23]; +extern BYTE vCrawlTable[23][30]; +extern BYTE byte_49463C[18][18]; +extern BYTE RadiusAdj[23]; #endif /* __LIGHTING_H__ */ diff --git a/Source/msgcmd.cpp b/Source/msgcmd.cpp index 5b36f11c1cb..5122c2c16e4 100644 --- a/Source/msgcmd.cpp +++ b/Source/msgcmd.cpp @@ -10,7 +10,8 @@ // static float msgcmd_init_cpp_value = 0x7F800000; struct EXTERNMESSAGE { - LIST_LINK(EXTERNMESSAGE) m_Link; + LIST_LINK(EXTERNMESSAGE) + m_Link; char command[COMMAND_LEN]; void *operator new(size_t n, DWORD extralen, int flags) { @@ -33,7 +34,7 @@ void *EXTERNMESSAGE::Delete(DWORD flags) if ((flags & 0x1) && this) { SMemFree(this, "delete", SLOG_FUNCTION, 0); } - return this; + return this; } static TList sgChat_Cmd; diff --git a/Source/scrollrt.cpp b/Source/scrollrt.cpp index c66109e5cfd..0b46591fa39 100644 --- a/Source/scrollrt.cpp +++ b/Source/scrollrt.cpp @@ -13,10 +13,10 @@ DWORD sgdwCursXOld; DWORD sgdwCursYOld; char arch_draw_type; DDSURFACEDESC DDS_desc; -int cel_transparency_active; // weak +int cel_transparency_active; int level_piece_id; DWORD sgdwCursWdt; -void(*DrawPlrProc)(int, int, int, int, int, BYTE *, int, int, int, int); +void (*DrawPlrProc)(int, int, int, int, int, BYTE *, int, int, int, int); BYTE sgSaveBack[8192]; int draw_monster_num; DWORD sgdwCursHgtOld; @@ -204,7 +204,7 @@ void DrawDeadPlayer(int x, int y, int sx, int sy, int CelSkip, int CelCap, BOOL for (i = 0; i < MAX_PLRS; i++) { p = &plr[i]; - if (p->plractive && !p->_pHitPoints && p->plrlevel == (unsigned char)currlevel && p->WorldX == x && p->WorldY == y) { + if (p->plractive && !p->_pHitPoints && p->plrlevel == (BYTE)currlevel && p->WorldX == x && p->WorldY == y) { pCelBuff = p->_pAnimData; if (!pCelBuff) { // app_fatal("Drawing dead player %d \"%s\": NULL Cel Buffer", i, p->_pName); @@ -372,50 +372,50 @@ void DrawClippedPlayer(int pnum, int x, int y, int px, int py, BYTE *pCelBuff, i void DrawView(int StartX, int StartY) { - if(zoomflag) { + if (zoomflag) { DrawGame(StartX, StartY); } else { DrawZoom(StartX, StartY); } - if(automapflag) { + if (automapflag) { DrawAutomap(); } - if(invflag) { + if (invflag) { DrawInv(); - } else if(sbookflag) { + } else if (sbookflag) { DrawSpellBook(); } DrawDurIcon(); - if(chrflag) { + if (chrflag) { DrawChr(); - } else if(questlog) { + } else if (questlog) { DrawQuestLog(); - } else if(plr[myplr]._pStatPts != 0 && !spselflag) { + } else if (plr[myplr]._pStatPts != 0 && !spselflag) { DrawLevelUpIcon(); } - if(uitemflag) { + if (uitemflag) { DrawUniqueInfo(); } - if(qtextflag) { + if (qtextflag) { DrawQText(); } - if(spselflag) { + if (spselflag) { DrawSpellList(); } - if(dropGoldFlag) { + if (dropGoldFlag) { DrawGoldSplit(dropGoldValue); } - if(helpflag) { + if (helpflag) { DrawHelp(); } - if(msgflag) { + if (msgflag) { DrawDiabloMsg(); } - if(deathflag) { + if (deathflag) { RedBack(); - } else if(PauseMode != 0) { + } else if (PauseMode != 0) { gmenu_draw_pause(); } @@ -545,7 +545,7 @@ void scrollrt_draw_lower(int x, int y, int sx, int sy, int chunks, int eflag) light_table_index = dLight[x][y]; if (level_piece_id != 0) { dst = &gpBuffer[sx + 32 + PitchTbl[sy]]; - cel_transparency_active = (unsigned char)(nTransTable[level_piece_id] & TransList[dTransVal[x][y]]); + cel_transparency_active = (BYTE)(nTransTable[level_piece_id] & TransList[dTransVal[x][y]]); arch_draw_type = 2; level_cel_block = pMap->mt[1]; if (level_cel_block != 0) { @@ -602,7 +602,7 @@ void scrollrt_draw_lower(int x, int y, int sx, int sy, int chunks, int eflag) world_draw_black_tile(&gpBuffer[sx + PitchTbl[sy]]); } else { dst = &gpBuffer[sx + PitchTbl[sy]]; - cel_transparency_active = (unsigned char)(nTransTable[level_piece_id] & TransList[dTransVal[x][y]]); + cel_transparency_active = (BYTE)(nTransTable[level_piece_id] & TransList[dTransVal[x][y]]); arch_draw_type = 1; level_cel_block = pMap->mt[0]; if (level_cel_block != 0) { @@ -641,7 +641,7 @@ void scrollrt_draw_lower(int x, int y, int sx, int sy, int chunks, int eflag) world_draw_black_tile(&gpBuffer[sx + PitchTbl[sy]]); } else { dst = &gpBuffer[sx + PitchTbl[sy]]; - cel_transparency_active = (unsigned char)(nTransTable[level_piece_id] & TransList[dTransVal[x][y]]); + cel_transparency_active = (BYTE)(nTransTable[level_piece_id] & TransList[dTransVal[x][y]]); arch_draw_type = 1; level_cel_block = pMap->mt[0]; if (level_cel_block != 0) { @@ -739,7 +739,7 @@ void scrollrt_draw_clipped_dungeon(BYTE *pBuff, int sx, int sy, int dx, int dy, pItem = &item[bItem - 1]; if (!pItem->_iPostDraw) { /// ASSERT: assert((unsigned char)bItem <= MAXITEMS); - if ((unsigned char)bItem <= MAXITEMS) { + if ((BYTE)bItem <= MAXITEMS) { pCelBuff = pItem->_iAnimData; if (pCelBuff != NULL) { pFrameTable = (DWORD *)pCelBuff; @@ -859,7 +859,7 @@ void scrollrt_draw_clipped_dungeon(BYTE *pBuff, int sx, int sy, int dx, int dy, pItem = &item[bItem - 1]; if (pItem->_iPostDraw) { /// ASSERT: assert((unsigned char)bItem <= MAXITEMS); - if ((unsigned char)bItem <= MAXITEMS) { + if ((BYTE)bItem <= MAXITEMS) { pCelBuff = pItem->_iAnimData; if (pCelBuff != NULL) { pFrameTable = (DWORD *)pCelBuff; @@ -887,7 +887,7 @@ void scrollrt_draw_clipped_dungeon(BYTE *pBuff, int sx, int sy, int dx, int dy, } } if (bArch != 0) { - cel_transparency_active = (unsigned char)TransList[bMap]; + cel_transparency_active = (BYTE)TransList[bMap]; Cel2DecodeLightTrans(pBuff, pSpecialCels, bArch, 64, 0, 8); } } @@ -971,7 +971,7 @@ void DrawClippedObject(int x, int y, int ox, int oy, BOOL pre, int CelSkip, int } /// ASSERT: assert((unsigned char)bv < MAXOBJECTS); - if ((unsigned char)bv >= MAXOBJECTS) + if ((BYTE)bv >= MAXOBJECTS) return; pCelBuff = object[bv]._oAnimData; @@ -1007,7 +1007,7 @@ void scrollrt_draw_clipped_e_flag(BYTE *pBuff, int x, int y, int sx, int sy) level_piece_id = dPiece[x][y]; light_table_index = dLight[x][y]; - cel_transparency_active = (unsigned char)(nTransTable[level_piece_id] & TransList[dTransVal[x][y]]); + cel_transparency_active = (BYTE)(nTransTable[level_piece_id] & TransList[dTransVal[x][y]]); pMap = &dpiece_defs_map_1[IsometricCoord(x, y)]; dst = pBuff; @@ -1060,7 +1060,7 @@ void scrollrt_draw_lower_2(int x, int y, int sx, int sy, int chunks, int skipChu light_table_index = dLight[x][y]; if (level_piece_id != 0) { dst = &gpBuffer[sx - (BUFFER_WIDTH * 32 - 32) + PitchTbl[sy]]; - cel_transparency_active = (unsigned char)(nTransTable[level_piece_id] & TransList[dTransVal[x][y]]); + cel_transparency_active = (BYTE)(nTransTable[level_piece_id] & TransList[dTransVal[x][y]]); for (i = 0; i < (MicroTileLen >> 1) - 1; i++) { if (skipChunks <= i) { level_cel_block = pMap->mt[2 * i + 3]; @@ -1093,7 +1093,7 @@ void scrollrt_draw_lower_2(int x, int y, int sx, int sy, int chunks, int skipChu light_table_index = dLight[x][y]; if (level_piece_id != 0) { dst = &gpBuffer[sx - BUFFER_WIDTH * 32 + PitchTbl[sy]]; - cel_transparency_active = (unsigned char)(nTransTable[level_piece_id] & TransList[dTransVal[x][y]]); + cel_transparency_active = (BYTE)(nTransTable[level_piece_id] & TransList[dTransVal[x][y]]); i = 0; while (i < (MicroTileLen >> 1) - 1) { if (skipChunks <= i) { @@ -1126,7 +1126,7 @@ void scrollrt_draw_lower_2(int x, int y, int sx, int sy, int chunks, int skipChu light_table_index = dLight[x][y]; if (level_piece_id != 0) { dst = &gpBuffer[sx - BUFFER_WIDTH * 32 + PitchTbl[sy]]; - cel_transparency_active = (unsigned char)(nTransTable[level_piece_id] & TransList[dTransVal[x][y]]); + cel_transparency_active = (BYTE)(nTransTable[level_piece_id] & TransList[dTransVal[x][y]]); for (i = 0; i < (MicroTileLen >> 1) - 1; i++) { if (skipChunks <= i) { level_cel_block = pMap->mt[2 * i + 2]; @@ -1205,7 +1205,7 @@ void scrollrt_draw_clipped_dungeon_2(BYTE *pBuff, int sx, int sy, int skipChunks pItem = &item[bItem - 1]; if (!pItem->_iPostDraw) { /// ASSERT: assert((unsigned char)bItem <= MAXITEMS); - if ((unsigned char)bItem <= MAXITEMS) { + if ((BYTE)bItem <= MAXITEMS) { pCelBuff = pItem->_iAnimData; if (pCelBuff != NULL) { pFrameTable = (DWORD *)pCelBuff; @@ -1325,7 +1325,7 @@ void scrollrt_draw_clipped_dungeon_2(BYTE *pBuff, int sx, int sy, int skipChunks pItem = &item[bItem - 1]; if (pItem->_iPostDraw) { /// ASSERT: assert((unsigned char)bItem <= MAXITEMS); - if ((unsigned char)bItem <= MAXITEMS) { + if ((BYTE)bItem <= MAXITEMS) { pCelBuff = pItem->_iAnimData; if (pCelBuff != NULL) { pFrameTable = (DWORD *)pCelBuff; @@ -1353,7 +1353,7 @@ void scrollrt_draw_clipped_dungeon_2(BYTE *pBuff, int sx, int sy, int skipChunks } } if (bArch != 0) { - cel_transparency_active = (unsigned char)TransList[bMap]; + cel_transparency_active = (BYTE)TransList[bMap]; Cel2DecodeLightTrans(pBuff, pSpecialCels, bArch, 64, CelSkip, 8); } } @@ -1371,7 +1371,7 @@ void scrollrt_draw_clipped_e_flag_2(BYTE *pBuff, int x, int y, int skipChunks, s level_piece_id = dPiece[x][y]; light_table_index = dLight[x][y]; dst = &pBuff[BUFFER_WIDTH * 32 * skipChunks]; - cel_transparency_active = (unsigned char)(nTransTable[level_piece_id] & TransList[dTransVal[x][y]]); + cel_transparency_active = (BYTE)(nTransTable[level_piece_id] & TransList[dTransVal[x][y]]); pMap = &dpiece_defs_map_1[IsometricCoord(x, y)]; switch (skipChunks) { @@ -1446,7 +1446,7 @@ void scrollrt_draw_upper(int x, int y, int sx, int sy, int chunks, int capChunks light_table_index = dLight[x][y]; if (level_piece_id != 0) { dst = &gpBuffer[sx + 32 + PitchTbl[sy]]; - cel_transparency_active = (unsigned char)(nTransTable[level_piece_id] & TransList[dTransVal[x][y]]); + cel_transparency_active = (BYTE)(nTransTable[level_piece_id] & TransList[dTransVal[x][y]]); if (capChunks >= 0) { level_cel_block = pMap->mt[1]; if (level_cel_block != 0) { @@ -1494,7 +1494,7 @@ void scrollrt_draw_upper(int x, int y, int sx, int sy, int chunks, int capChunks light_table_index = dLight[x][y]; if (level_piece_id != 0) { dst = &gpBuffer[sx + PitchTbl[sy]]; - cel_transparency_active = (unsigned char)(nTransTable[level_piece_id] & TransList[dTransVal[x][y]]); + cel_transparency_active = (BYTE)(nTransTable[level_piece_id] & TransList[dTransVal[x][y]]); arch_draw_type = 1; level_cel_block = pMap->mt[0]; if (level_cel_block != 0) { @@ -1536,7 +1536,7 @@ void scrollrt_draw_upper(int x, int y, int sx, int sy, int chunks, int capChunks light_table_index = dLight[x][y]; if (level_piece_id != 0) { dst = &gpBuffer[sx + PitchTbl[sy]]; - cel_transparency_active = (unsigned char)(nTransTable[level_piece_id] & TransList[dTransVal[x][y]]); + cel_transparency_active = (BYTE)(nTransTable[level_piece_id] & TransList[dTransVal[x][y]]); arch_draw_type = 1; if (capChunks >= 0) { level_cel_block = pMap->mt[0]; @@ -1635,7 +1635,7 @@ void scrollrt_draw_dungeon(BYTE *pBuff, int sx, int sy, int capChunks, int CelCa pItem = &item[bItem - 1]; if (!pItem->_iPostDraw) { /// ASSERT: assert((unsigned char)bItem <= MAXITEMS); - if ((unsigned char)bItem <= MAXITEMS) { + if ((BYTE)bItem <= MAXITEMS) { pCelBuff = pItem->_iAnimData; if (pCelBuff != NULL) { pFrameTable = (DWORD *)pCelBuff; @@ -1748,7 +1748,7 @@ void scrollrt_draw_dungeon(BYTE *pBuff, int sx, int sy, int capChunks, int CelCa pItem = &item[bItem - 1]; if (pItem->_iPostDraw) { /// ASSERT: assert((unsigned char)bItem <= MAXITEMS); - if ((unsigned char)bItem <= MAXITEMS) { + if ((BYTE)bItem <= MAXITEMS) { pCelBuff = pItem->_iAnimData; if (pCelBuff != NULL) { pFrameTable = (DWORD *)pCelBuff; @@ -1769,7 +1769,7 @@ void scrollrt_draw_dungeon(BYTE *pBuff, int sx, int sy, int capChunks, int CelCa } } if (bArch != 0) { - cel_transparency_active = (unsigned char)TransList[bMap]; + cel_transparency_active = (BYTE)TransList[bMap]; CelDecodeHdrLightTrans(pBuff, pSpecialCels, bArch, 64, 0, CelCap); } } @@ -1853,7 +1853,7 @@ void DrawObject(int x, int y, int ox, int oy, BOOL pre, int CelSkip, int CelCap) } /// ASSERT: assert((unsigned char)bv < MAXOBJECTS); - if ((unsigned char)bv >= MAXOBJECTS) + if ((BYTE)bv >= MAXOBJECTS) return; pCelBuff = object[bv]._oAnimData; @@ -1893,7 +1893,7 @@ void scrollrt_draw_e_flag(BYTE *pBuff, int x, int y, int capChunks, int CelCap, level_piece_id = dPiece[x][y]; light_table_index = dLight[x][y]; dst = pBuff; - cel_transparency_active = (unsigned char)(nTransTable[level_piece_id] & TransList[dTransVal[x][y]]); + cel_transparency_active = (BYTE)(nTransTable[level_piece_id] & TransList[dTransVal[x][y]]); pMap = &dpiece_defs_map_1[IsometricCoord(x, y)]; arch_draw_type = 1; @@ -2584,11 +2584,11 @@ void DrawAndBlit() int hgt; BOOL ddsdesc, ctrlPan; - if(!gbRunGame) { + if (!gbRunGame) { return; } - if(drawpanflag == 255) { + if (drawpanflag == 255) { drawhpflag = TRUE; drawmanaflag = TRUE; drawbtnflag = TRUE; @@ -2596,7 +2596,7 @@ void DrawAndBlit() ddsdesc = FALSE; ctrlPan = TRUE; hgt = 480; - } else if(drawpanflag == 1) { + } else if (drawpanflag == 1) { ddsdesc = TRUE; ctrlPan = FALSE; hgt = 352; @@ -2607,27 +2607,27 @@ void DrawAndBlit() drawpanflag = 0; lock_buf(0); - if(leveltype != DTYPE_TOWN) { + if (leveltype != DTYPE_TOWN) { DrawView(ViewX, ViewY); } else { T_DrawView(ViewX, ViewY); } - if(ctrlPan) { + if (ctrlPan) { ClearCtrlPan(); } - if(drawhpflag) { + if (drawhpflag) { UpdateLifeFlask(); } - if(drawmanaflag) { + if (drawmanaflag) { UpdateManaFlask(); } - if(drawbtnflag) { + if (drawbtnflag) { DrawCtrlPan(); } - if(drawsbarflag) { + if (drawsbarflag) { DrawInvBelt(); } - if(talkflag) { + if (talkflag) { DrawTalkPan(); hgt = 480; } diff --git a/Source/town.cpp b/Source/town.cpp index bb5779c7d7c..3121443aebe 100644 --- a/Source/town.cpp +++ b/Source/town.cpp @@ -1211,12 +1211,12 @@ void T_DrawView(int StartX, int StartY) { light_table_index = 0; cel_transparency_active = 0; - if(zoomflag) { + if (zoomflag) { T_DrawGame(StartX, StartY); } else { T_DrawZoom(StartX, StartY); } - if(automapflag) { + if (automapflag) { DrawAutomap(); } if (stextflag && !qtextflag) @@ -1233,25 +1233,25 @@ void T_DrawView(int StartX, int StartY) DrawChr(); } else if (questlog) { DrawQuestLog(); - } else if(plr[myplr]._pStatPts != 0 && !spselflag) { + } else if (plr[myplr]._pStatPts != 0 && !spselflag) { DrawLevelUpIcon(); } - if(uitemflag) { + if (uitemflag) { DrawUniqueInfo(); } - if(qtextflag) { + if (qtextflag) { DrawQText(); } - if(spselflag) { + if (spselflag) { DrawSpellList(); } - if(dropGoldFlag) { + if (dropGoldFlag) { DrawGoldSplit(dropGoldValue); } - if(helpflag) { + if (helpflag) { DrawHelp(); } - if(msgflag) { + if (msgflag) { DrawDiabloMsg(); } if (PauseMode != 0 && !deathflag) { @@ -1303,7 +1303,7 @@ void SetTownMicros() } } -void T_FillSector(unsigned char *P3Tiles, unsigned char *pSector, int xi, int yi, int w, int h) +void T_FillSector(BYTE *P3Tiles, BYTE *pSector, int xi, int yi, int w, int h) { int i, j, xx, yy; long v1, v2, v3, v4, ii; @@ -1375,7 +1375,7 @@ void T_FillSector(unsigned char *P3Tiles, unsigned char *pSector, int xi, int yi } } -void T_FillTile(unsigned char *P3Tiles, int xx, int yy, int t) +void T_FillTile(BYTE *P3Tiles, int xx, int yy, int t) { long v1, v2, v3, v4; @@ -1423,7 +1423,7 @@ void T_FillTile(unsigned char *P3Tiles, int xx, int yy, int t) void T_Pass3() { int xx, yy, x; - unsigned char *P3Tiles, *pSector; + BYTE *P3Tiles, *pSector; for (yy = 0; yy < MAXDUNY; yy += 2) { for (xx = 0; xx < MAXDUNX; xx += 2) { diff --git a/Source/town.h b/Source/town.h index 04f0dc87833..842a43c7c38 100644 --- a/Source/town.h +++ b/Source/town.h @@ -19,8 +19,8 @@ void T_DrawGame(int x, int y); void T_DrawZoom(int x, int y); void T_DrawView(int StartX, int StartY); void SetTownMicros(); -void T_FillSector(unsigned char *P3Tiles, unsigned char *pSector, int xi, int yi, int w, int h); -void T_FillTile(unsigned char *P3Tiles, int xx, int yy, int t); +void T_FillSector(BYTE *P3Tiles, BYTE *pSector, int xi, int yi, int w, int h); +void T_FillTile(BYTE *P3Tiles, int xx, int yy, int t); void T_Pass3(); void CreateTown(int entry); From 4e09aeb3a8e5f89cbaa169b7062861a139d03d6c Mon Sep 17 00:00:00 2001 From: Robin Eklind Date: Mon, 8 Jul 2019 10:17:30 +0200 Subject: [PATCH 19/42] pfile: add assert comments to pfile_rename_temp_to_perm Based on @galaxyhaxz code in https://github.com/diasurgical/devilution/pull/1294#issuecomment-509018789 Also, per suggestion of @sskras. --- Source/pfile.cpp | 38 +++++++++++++++++++++----------------- 1 file changed, 21 insertions(+), 17 deletions(-) diff --git a/Source/pfile.cpp b/Source/pfile.cpp index 1d28e9fe9e3..8da2e20ac27 100644 --- a/Source/pfile.cpp +++ b/Source/pfile.cpp @@ -566,27 +566,31 @@ BOOL __stdcall GetTempSaveNames(DWORD dwIndex, char *szTemp) void pfile_rename_temp_to_perm() { - DWORD save_num, i; - char TempName[MAX_PATH]; - char PermName[MAX_PATH]; - - save_num = pfile_get_save_num_from_name(plr[myplr]._pName); - if (!pfile_open_archive(FALSE, save_num)) + DWORD dwChar, dwIndex; + BOOL bResult; + char szTemp[MAX_PATH]; + char szPerm[MAX_PATH]; + + dwChar = pfile_get_save_num_from_name(plr[myplr]._pName); + /// ASSERT: assert(dwChar < MAX_CHARACTERS); + /// ASSERT: assert(gbMaxPlayers == 1); + if (!pfile_open_archive(FALSE, dwChar)) app_fatal("Unable to write to save file archive"); - i = 0; - while (GetTempSaveNames(i, TempName)) { - GetPermSaveNames(i, PermName); - i++; - if (mpqapi_has_file(TempName)) { - if (mpqapi_has_file(PermName)) - mpqapi_remove_hash_entry(PermName); - mpqapi_rename(TempName, PermName); + dwIndex = 0; + while (GetTempSaveNames(dwIndex, szTemp)) { + bResult = GetPermSaveNames(dwIndex, szPerm); + /// ASSERT: assert(bResult); + dwIndex++; + if (mpqapi_has_file(szTemp)) { + if (mpqapi_has_file(szPerm)) + mpqapi_remove_hash_entry(szPerm); + mpqapi_rename(szTemp, szPerm); } } - // BUGFIX: function call has no purpose - GetPermSaveNames(i, PermName); - pfile_flush(TRUE, save_num); + /// ASSERT: assert(! GetPermSaveNames(dwIndex,szPerm)); + GetPermSaveNames(dwIndex, szPerm); + pfile_flush(TRUE, dwChar); } BOOL __stdcall GetPermSaveNames(DWORD dwIndex, char *szPerm) From 63847b0f33350d88e688a29a018c14498e34b56b Mon Sep 17 00:00:00 2001 From: Xadhoom Date: Mon, 8 Jul 2019 15:04:27 +0000 Subject: [PATCH 20/42] Use DMAXX and DMAXY constants --- Source/drlg_l2.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Source/drlg_l2.cpp b/Source/drlg_l2.cpp index 76b49add6c5..0c5a1dab9a2 100644 --- a/Source/drlg_l2.cpp +++ b/Source/drlg_l2.cpp @@ -879,8 +879,8 @@ void DRLG_L2PlaceRndSet(BYTE *miniset, int rndper) sw = miniset[0]; sh = miniset[1]; - for (sy = 0; sy < 40 - sh; sy++) { - for (sx = 0; sx < 40 - sw; sx++) { + for (sy = 0; sy < DMAXY - sh; sy++) { + for (sx = 0; sx < DMAXX - sw; sx++) { found = TRUE; ii = 2; if (sx >= nSx1 && sx <= nSx2 && sy >= nSy1 && sy <= nSy2) { From 3b203f7c509fdd1fa73cfc7dcaa08214327851b1 Mon Sep 17 00:00:00 2001 From: Xadhoom Date: Mon, 8 Jul 2019 15:18:46 +0000 Subject: [PATCH 21/42] BUGFIX comments for drlg_l?.cpp, gendung.cpp, monster.cpp --- Source/drlg_l2.cpp | 1 + Source/drlg_l3.cpp | 15 +++++++++------ Source/drlg_l4.cpp | 1 + Source/gendung.cpp | 1 + Source/monster.cpp | 6 +++--- 5 files changed, 15 insertions(+), 9 deletions(-) diff --git a/Source/drlg_l2.cpp b/Source/drlg_l2.cpp index 0c5a1dab9a2..d17a39e4cda 100644 --- a/Source/drlg_l2.cpp +++ b/Source/drlg_l2.cpp @@ -901,6 +901,7 @@ void DRLG_L2PlaceRndSet(BYTE *miniset, int rndper) if (found == TRUE) { for (yy = sy - sh; yy < sy + 2 * sh && found == TRUE; yy++) { for (xx = sx - sw; xx < sx + 2 * sw; xx++) { + // BUGFIX: yy and xx can go out of bounds if (dungeon[xx][yy] == miniset[kk]) { found = FALSE; } diff --git a/Source/drlg_l3.cpp b/Source/drlg_l3.cpp index c985da04911..a81a75aaa0a 100644 --- a/Source/drlg_l3.cpp +++ b/Source/drlg_l3.cpp @@ -1057,6 +1057,8 @@ void DRLG_L3Pool() poolchance = random(0, 100); for (j = duny - totarea; j < duny + totarea; j++) { for (i = dunx - totarea; i < dunx + totarea; i++) { + // BUGFIX: In the following swap the order to first do the + // index checks and only then access dungeon[i][j] if (dungeon[i][j] & 0x80 && j >= 0 && j < 40 && i >= 0 && i < 40) { dungeon[i][j] &= ~0x80; if (totarea > 4 && poolchance < 25 && !found) { @@ -1180,8 +1182,8 @@ void DRLG_L3PoolFix() { int dunx, duny; - for (duny = 0; duny < DMAXY; duny++) { - for (dunx = 0; dunx < DMAXX; dunx++) { + for (duny = 0; duny < DMAXY; duny++) { // BUGFIX: Change '0' to '1' and 'DMAXY' to 'DMAXY - 1' + for (dunx = 0; dunx < DMAXX; dunx++) { // BUGFIX: Change '0' to '1' and 'DMAXX' to 'DMAXX - 1' if (dungeon[dunx][duny] == 8) { if (dungeon[dunx - 1][duny - 1] >= 25 && dungeon[dunx - 1][duny - 1] <= 41 && dungeon[dunx - 1][duny] >= 25 && dungeon[dunx - 1][duny] <= 41 @@ -1304,6 +1306,7 @@ void DRLG_L3PlaceRndSet(const BYTE *miniset, int rndper) } kk = sw * sh + 2; if (miniset[kk] >= 84 && miniset[kk] <= 100 && found == TRUE) { + // BUGFIX: accesses to dungeon can go out of bounds if (dungeon[sx - 1][sy] >= 84 && dungeon[sx - 1][sy] <= 100) { found = FALSE; } @@ -1336,8 +1339,8 @@ void DRLG_L3Wood() int i, j, x, y, xx, yy, rt, rp, x1, y1, x2, y2; BOOL skip; - for (j = 0; j < DMAXY - 1; j++) { - for (i = 0; i < DMAXX - 1; i++) { + for (j = 0; j < DMAXY - 1; j++) { // BUGFIX: Change '0' to '1' + for (i = 0; i < DMAXX - 1; i++) { // BUGFIX: Change '0' to '1' if (dungeon[i][j] == 10 && random(0, 2) != 0) { x = i; while (dungeon[x][j] == 10) { @@ -1406,8 +1409,8 @@ void DRLG_L3Wood() } } - for (j = 0; j < DMAXY; j++) { - for (i = 0; i < DMAXX; i++) { + for (j = 0; j < DMAXY; j++) { // BUGFIX: Change '0' to '1' + for (i = 0; i < DMAXX; i++) { // BUGFIX: Change '0' to '1' if (dungeon[i][j] != 7 || random(0, 1) != 0 || !SkipThemeRoom(i, j)) { continue; } diff --git a/Source/drlg_l4.cpp b/Source/drlg_l4.cpp index 4ffa1bf97fb..836aaf93524 100644 --- a/Source/drlg_l4.cpp +++ b/Source/drlg_l4.cpp @@ -1443,6 +1443,7 @@ void uShape() hallok[j] = FALSE; } if (dung[i][j] == 1) { + // BUGFIX: check that i + 1 < 20 and j + 1 < 20 if (dung[i][j + 1] == 1 && dung[i + 1][j + 1] == 0) { hallok[j] = TRUE; } else { diff --git a/Source/gendung.cpp b/Source/gendung.cpp index 6273e0b1137..73b089d82e3 100644 --- a/Source/gendung.cpp +++ b/Source/gendung.cpp @@ -677,6 +677,7 @@ BOOL DRLG_WillThemeRoomFit(int floor, int x, int y, int minSize, int maxSize, in xCount = 0; yCount = 0; + // BUGFIX: change '&&' to '||' if (x > DMAXX - maxSize && y > DMAXY - maxSize) { return FALSE; } diff --git a/Source/monster.cpp b/Source/monster.cpp index f5df424f137..4364fe12465 100644 --- a/Source/monster.cpp +++ b/Source/monster.cpp @@ -5176,7 +5176,7 @@ BOOL PosOkMonst(int i, int x, int y) if (ret && dMissile[x][y] && i >= 0) { mi = dMissile[x][y]; if (mi > 0) { - if (missile[mi]._mitype == MIS_FIREWALL) { + if (missile[mi]._mitype == MIS_FIREWALL) { // BUGFIX: Change 'mi' to 'mi - 1' fire = TRUE; } else { for (j = 0; j < nummissiles; j++) { @@ -5208,7 +5208,7 @@ BOOL PosOkMonst2(int i, int x, int y) if (ret && dMissile[x][y] && i >= 0) { mi = dMissile[x][y]; if (mi > 0) { - if (missile[mi]._mitype == MIS_FIREWALL) { + if (missile[mi]._mitype == MIS_FIREWALL) { // BUGFIX: Change 'mi' to 'mi - 1' fire = TRUE; } else { for (j = 0; j < nummissiles; j++) { @@ -5249,7 +5249,7 @@ BOOL PosOkMonst3(int i, int x, int y) if (ret && dMissile[x][y] != 0 && i >= 0) { mi = dMissile[x][y]; if (mi > 0) { - if (missile[mi]._mitype == MIS_FIREWALL) { + if (missile[mi]._mitype == MIS_FIREWALL) { // BUGFIX: Change 'mi' to 'mi - 1' fire = TRUE; } else { for (j = 0; j < nummissiles; j++) { From e8681e919608b4d50a3d63c2a4eca61e866e8b42 Mon Sep 17 00:00:00 2001 From: Trevor Philip <6340021+danellos@users.noreply.github.com> Date: Wed, 10 Jul 2019 00:07:41 -0400 Subject: [PATCH 22/42] pdir is uninitialized fix BUGFIX from original Diablo 1 code --- Source/drlg_l3.cpp | 1 + 1 file changed, 1 insertion(+) diff --git a/Source/drlg_l3.cpp b/Source/drlg_l3.cpp index edb49f646ee..09b5a868682 100644 --- a/Source/drlg_l3.cpp +++ b/Source/drlg_l3.cpp @@ -791,6 +791,7 @@ void DRLG_L3River() rivercnt = 0; bail = FALSE; trys = 0; + pdir = -1; while (trys < 200 && rivercnt < 4) { bail = FALSE; From 0234ff2ae4ad608ce5deabb174624deb24b72755 Mon Sep 17 00:00:00 2001 From: Xadhoom Date: Wed, 10 Jul 2019 21:46:16 +0000 Subject: [PATCH 23/42] One further BUGFIX in drlg_l4.cpp --- Source/drlg_l4.cpp | 1 + 1 file changed, 1 insertion(+) diff --git a/Source/drlg_l4.cpp b/Source/drlg_l4.cpp index 836aaf93524..7243940917f 100644 --- a/Source/drlg_l4.cpp +++ b/Source/drlg_l4.cpp @@ -1480,6 +1480,7 @@ void uShape() hallok[i] = FALSE; } if (dung[i][j] == 1) { + // BUGFIX: check that i + 1 < 20 and j + 1 < 20 if (dung[i + 1][j] == 1 && dung[i + 1][j + 1] == 0) { hallok[i] = TRUE; } else { From 2e9f835205db9c131c8ae77fb5d9dcac05a84fe9 Mon Sep 17 00:00:00 2001 From: Robin Eklind Date: Tue, 9 Jul 2019 15:42:32 +0200 Subject: [PATCH 24/42] miniwin: map additional keycodes Prior to this commit, several keyboard keys would not be translated, as detailed by the following debug message: DUMMY: translate_sdl_key : unknown key: name== sym=0x3D scan=46 mod=0x0 With this commit, all keys on regular US keyboards should be translated correctly. --- SourceS/miniwin/misc.h | 116 ++++++---- SourceS/miniwin/misc_macro.h | 116 ++++++---- SourceX/miniwin/misc_msg.cpp | 428 +++++++++++++++++++++++++++++++---- 3 files changed, 535 insertions(+), 125 deletions(-) diff --git a/SourceS/miniwin/misc.h b/SourceS/miniwin/misc.h index 7cf7691b11b..4b6d55eee38 100644 --- a/SourceS/miniwin/misc.h +++ b/SourceS/miniwin/misc.h @@ -723,48 +723,80 @@ constexpr auto DVL_WM_PALETTECHANGED = 0x0311; constexpr auto DVL_SC_CLOSE = 0xF060; -constexpr auto DVL_VK_RETURN = 0x0D; -constexpr auto DVL_VK_BACK = 0x08; -constexpr auto DVL_VK_SHIFT = 0x10; -constexpr auto DVL_VK_ESCAPE = 0x1B; -constexpr auto DVL_VK_SPACE = 0x20; -constexpr auto DVL_VK_LEFT = 0x25; -constexpr auto DVL_VK_UP = 0x26; -constexpr auto DVL_VK_RIGHT = 0x27; -constexpr auto DVL_VK_DOWN = 0x28; - -constexpr auto DVL_VK_F1 = 0x70; -constexpr auto DVL_VK_F2 = 0x71; -constexpr auto DVL_VK_F3 = 0x72; -constexpr auto DVL_VK_F4 = 0x73; -constexpr auto DVL_VK_F5 = 0x74; -constexpr auto DVL_VK_F6 = 0x75; -constexpr auto DVL_VK_F7 = 0x76; -constexpr auto DVL_VK_F8 = 0x77; -constexpr auto DVL_VK_F9 = 0x78; -constexpr auto DVL_VK_F10 = 0x79; -constexpr auto DVL_VK_F11 = 0x7A; -constexpr auto DVL_VK_F12 = 0x7B; - -constexpr auto DVL_VK_TAB = 0x09; -constexpr auto DVL_VK_PAUSE = 0x13; -constexpr auto DVL_VK_PRIOR = 0x21; -constexpr auto DVL_VK_NEXT = 0x22; -constexpr auto DVL_VK_SNAPSHOT = 0x2C; - -constexpr auto DVL_VK_OEM_1 = 0xBA; -constexpr auto DVL_VK_OEM_PLUS = 0xBB; -constexpr auto DVL_VK_OEM_COMMA = 0xBC; -constexpr auto DVL_VK_OEM_MINUS = 0xBD; -constexpr auto DVL_VK_OEM_PERIOD = 0xBE; -constexpr auto DVL_VK_OEM_2 = 0xBF; -constexpr auto DVL_VK_OEM_3 = 0xC0; -constexpr auto DVL_VK_OEM_4 = 0xDB; -constexpr auto DVL_VK_OEM_5 = 0xDC; -constexpr auto DVL_VK_OEM_6 = 0xDD; -constexpr auto DVL_VK_OEM_7 = 0xDE; -//constexpr auto DVL_VK_OEM_8 = 0xDF; -//constexpr auto DVL_VK_OEM_102 = 0xE2; +// Virtual key codes. +// +// ref: https://docs.microsoft.com/en-us/windows/win32/inputdev/virtual-key-codes +constexpr auto DVL_VK_BACK = 0x08; // BACKSPACE key +constexpr auto DVL_VK_TAB = 0x09; // TAB key +constexpr auto DVL_VK_RETURN = 0x0D; // ENTER key +constexpr auto DVL_VK_SHIFT = 0x10; // SHIFT key +constexpr auto DVL_VK_CONTROL = 0x11; // CONTROL key +constexpr auto DVL_VK_MENU = 0x12; // ALT key +constexpr auto DVL_VK_PAUSE = 0x13; // PAUSE key +constexpr auto DVL_VK_CAPITAL = 0x14; // CAPS LOCK key +constexpr auto DVL_VK_ESCAPE = 0x1B; // ESC key +constexpr auto DVL_VK_SPACE = 0x20; // SPACEBAR +constexpr auto DVL_VK_PRIOR = 0x21; // PAGE UP key +constexpr auto DVL_VK_NEXT = 0x22; // PAGE DOWN key +constexpr auto DVL_VK_END = 0x23; // END key +constexpr auto DVL_VK_HOME = 0x24; // HOME key +constexpr auto DVL_VK_LEFT = 0x25; // LEFT ARROW key +constexpr auto DVL_VK_UP = 0x26; // UP ARROW key +constexpr auto DVL_VK_RIGHT = 0x27; // RIGHT ARROW key +constexpr auto DVL_VK_DOWN = 0x28; // DOWN ARROW key +constexpr auto DVL_VK_SNAPSHOT = 0x2C; // PRINT SCREEN key +constexpr auto DVL_VK_INSERT = 0x2D; // INS key +constexpr auto DVL_VK_DELETE = 0x2E; // DEL key +// DVL_VK_0 through DVL_VK_9 correspond to '0' - '9' +// DVL_VK_A through DVL_VK_Z correspond to 'A' - 'Z' +constexpr auto DVL_VK_LWIN = 0x5B; // Left Windows key (Natural keyboard) +constexpr auto DVL_VK_RWIN = 0x5C; // Right Windows key (Natural keyboard) +constexpr auto DVL_VK_NUMPAD0 = 0x60; // Numeric keypad 0 key +constexpr auto DVL_VK_NUMPAD1 = 0x61; // Numeric keypad 1 key +constexpr auto DVL_VK_NUMPAD2 = 0x62; // Numeric keypad 2 key +constexpr auto DVL_VK_NUMPAD3 = 0x63; // Numeric keypad 3 key +constexpr auto DVL_VK_NUMPAD4 = 0x64; // Numeric keypad 4 key +constexpr auto DVL_VK_NUMPAD5 = 0x65; // Numeric keypad 5 key +constexpr auto DVL_VK_NUMPAD6 = 0x66; // Numeric keypad 6 key +constexpr auto DVL_VK_NUMPAD7 = 0x67; // Numeric keypad 7 key +constexpr auto DVL_VK_NUMPAD8 = 0x68; // Numeric keypad 8 key +constexpr auto DVL_VK_NUMPAD9 = 0x69; // Numeric keypad 9 key +constexpr auto DVL_VK_MULTIPLY = 0x6A; // Multiply key +constexpr auto DVL_VK_ADD = 0x6B; // Add key +constexpr auto DVL_VK_SUBTRACT = 0x6D; // Subtract key +constexpr auto DVL_VK_DECIMAL = 0x6E; // Decimal key +constexpr auto DVL_VK_DIVIDE = 0x6F; // Divide key +constexpr auto DVL_VK_F1 = 0x70; // F1 key +constexpr auto DVL_VK_F2 = 0x71; // F2 key +constexpr auto DVL_VK_F3 = 0x72; // F3 key +constexpr auto DVL_VK_F4 = 0x73; // F4 key +constexpr auto DVL_VK_F5 = 0x74; // F5 key +constexpr auto DVL_VK_F6 = 0x75; // F6 key +constexpr auto DVL_VK_F7 = 0x76; // F7 key +constexpr auto DVL_VK_F8 = 0x77; // F8 key +constexpr auto DVL_VK_F9 = 0x78; // F9 key +constexpr auto DVL_VK_F10 = 0x79; // F10 key +constexpr auto DVL_VK_F11 = 0x7A; // F11 key +constexpr auto DVL_VK_F12 = 0x7B; // F12 key +constexpr auto DVL_VK_NUMLOCK = 0x90; // NUM LOCK key +constexpr auto DVL_VK_SCROLL = 0x91; // SCROLL LOCK key +constexpr auto DVL_VK_LSHIFT = 0xA0; // Left SHIFT key +constexpr auto DVL_VK_RSHIFT = 0xA1; // Right SHIFT key +constexpr auto DVL_VK_LCONTROL = 0xA2; // Left CONTROL key +constexpr auto DVL_VK_RCONTROL = 0xA3; // Right CONTROL key +constexpr auto DVL_VK_LMENU = 0xA4; // Left MENU key +constexpr auto DVL_VK_RMENU = 0xA5; // Right MENU key +constexpr auto DVL_VK_OEM_1 = 0xBA; // For the US standard keyboard, the ';:' key +constexpr auto DVL_VK_OEM_PLUS = 0xBB; // For any country/region, the '+' key +constexpr auto DVL_VK_OEM_COMMA = 0xBC; // For any country/region, the ',' key +constexpr auto DVL_VK_OEM_MINUS = 0xBD; // For any country/region, the '-' key +constexpr auto DVL_VK_OEM_PERIOD = 0xBE; // For any country/region, the '.' key +constexpr auto DVL_VK_OEM_2 = 0xBF; // For the US standard keyboard, the '/?' key +constexpr auto DVL_VK_OEM_3 = 0xC0; // For the US standard keyboard, the '`~' key +constexpr auto DVL_VK_OEM_4 = 0xDB; // For the US standard keyboard, the '[{' key +constexpr auto DVL_VK_OEM_5 = 0xDC; // For the US standard keyboard, the '\|' key +constexpr auto DVL_VK_OEM_6 = 0xDD; // For the US standard keyboard, the ']}' key +constexpr auto DVL_VK_OEM_7 = 0xDE; // For the US standard keyboard, the 'single-quote/double-quote' key constexpr auto DVL_MK_SHIFT = 0x0004; constexpr auto DVL_MK_LBUTTON = 0x0001; diff --git a/SourceS/miniwin/misc_macro.h b/SourceS/miniwin/misc_macro.h index 2bfe82a899b..6aff296b2ea 100644 --- a/SourceS/miniwin/misc_macro.h +++ b/SourceS/miniwin/misc_macro.h @@ -282,48 +282,80 @@ #define SC_CLOSE DVL_SC_CLOSE -#define VK_RETURN DVL_VK_RETURN -#define VK_BACK DVL_VK_BACK -#define VK_SHIFT DVL_VK_SHIFT -#define VK_ESCAPE DVL_VK_ESCAPE -#define VK_SPACE DVL_VK_SPACE -#define VK_LEFT DVL_VK_LEFT -#define VK_UP DVL_VK_UP -#define VK_RIGHT DVL_VK_RIGHT -#define VK_DOWN DVL_VK_DOWN - -#define VK_F1 DVL_VK_F1 -#define VK_F2 DVL_VK_F2 -#define VK_F3 DVL_VK_F3 -#define VK_F4 DVL_VK_F4 -#define VK_F5 DVL_VK_F5 -#define VK_F6 DVL_VK_F6 -#define VK_F7 DVL_VK_F7 -#define VK_F8 DVL_VK_F8 -#define VK_F9 DVL_VK_F9 -#define VK_F10 DVL_VK_F10 -#define VK_F11 DVL_VK_F11 -#define VK_F12 DVL_VK_F12 - -#define VK_TAB DVL_VK_TAB -#define VK_PAUSE DVL_VK_PAUSE -#define VK_PRIOR DVL_VK_PRIOR -#define VK_NEXT DVL_VK_NEXT -#define VK_SNAPSHOT DVL_VK_SNAPSHOT - -#define VK_OEM_1 DVL_VK_OEM_1 -#define VK_OEM_PLUS DVL_VK_OEM_PLUS -#define VK_OEM_COMMA DVL_VK_OEM_COMMA -#define VK_OEM_MINUS DVL_VK_OEM_MINUS -#define VK_OEM_PERIOD DVL_VK_OEM_PERIOD -#define VK_OEM_2 DVL_VK_OEM_2 -#define VK_OEM_3 DVL_VK_OEM_3 -#define VK_OEM_4 DVL_VK_OEM_4 -#define VK_OEM_5 DVL_VK_OEM_5 -#define VK_OEM_6 DVL_VK_OEM_6 -#define VK_OEM_7 DVL_VK_OEM_7 -//#define VK_OEM_8 DVL_VK_OEM_8 -//#define VK_OEM_102 DVL_VK_OEM_102 +// Virtual key codes. +// +// ref: https://docs.microsoft.com/en-us/windows/win32/inputdev/virtual-key-codes +#define VK_BACK DVL_VK_BACK // BACKSPACE key +#define VK_TAB DVL_VK_TAB // TAB key +#define VK_RETURN DVL_VK_RETURN // ENTER key +#define VK_SHIFT DVL_VK_SHIFT // SHIFT key +#define VK_CONTROL DVL_VK_CONTROL // CONTROL key +#define VK_MENU DVL_VK_MENU // ALT key +#define VK_PAUSE DVL_VK_PAUSE // PAUSE key +#define VK_CAPITAL DVL_VK_CAPITAL // CAPS LOCK key +#define VK_ESCAPE DVL_VK_ESCAPE // ESC key +#define VK_SPACE DVL_VK_SPACE // SPACEBAR +#define VK_PRIOR DVL_VK_PRIOR // PAGE UP key +#define VK_NEXT DVL_VK_NEXT // PAGE DOWN key +#define VK_END DVL_VK_END // END key +#define VK_HOME DVL_VK_HOME // HOME key +#define VK_LEFT DVL_VK_LEFT // LEFT ARROW key +#define VK_UP DVL_VK_UP // UP ARROW key +#define VK_RIGHT DVL_VK_RIGHT // RIGHT ARROW key +#define VK_DOWN DVL_VK_DOWN // DOWN ARROW key +#define VK_SNAPSHOT DVL_VK_SNAPSHOT // PRINT SCREEN key +#define VK_INSERT DVL_VK_INSERT // INS key +#define VK_DELETE DVL_VK_DELETE // DEL key +// VK_0 through VK_9 correspond to '0' - '9' +// VK_A through VK_Z correspond to 'A' - 'Z' +#define VK_LWIN DVL_VK_LWIN // Left Windows key (Natural keyboard) +#define VK_RWIN DVL_VK_RWIN // Right Windows key (Natural keyboard) +#define VK_NUMPAD0 DVL_VK_NUMPAD0 // Numeric keypad 0 key +#define VK_NUMPAD1 DVL_VK_NUMPAD1 // Numeric keypad 1 key +#define VK_NUMPAD2 DVL_VK_NUMPAD2 // Numeric keypad 2 key +#define VK_NUMPAD3 DVL_VK_NUMPAD3 // Numeric keypad 3 key +#define VK_NUMPAD4 DVL_VK_NUMPAD4 // Numeric keypad 4 key +#define VK_NUMPAD5 DVL_VK_NUMPAD5 // Numeric keypad 5 key +#define VK_NUMPAD6 DVL_VK_NUMPAD6 // Numeric keypad 6 key +#define VK_NUMPAD7 DVL_VK_NUMPAD7 // Numeric keypad 7 key +#define VK_NUMPAD8 DVL_VK_NUMPAD8 // Numeric keypad 8 key +#define VK_NUMPAD9 DVL_VK_NUMPAD9 // Numeric keypad 9 key +#define VK_MULTIPLY DVL_VK_MULTIPLY // Multiply key +#define VK_ADD DVL_VK_ADD // Add key +#define VK_SUBTRACT DVL_VK_SUBTRACT // Subtract key +#define VK_DECIMAL DVL_VK_DECIMAL // Decimal key +#define VK_DIVIDE DVL_VK_DIVIDE // Divide key +#define VK_F1 DVL_VK_F1 // F1 key +#define VK_F2 DVL_VK_F2 // F2 key +#define VK_F3 DVL_VK_F3 // F3 key +#define VK_F4 DVL_VK_F4 // F4 key +#define VK_F5 DVL_VK_F5 // F5 key +#define VK_F6 DVL_VK_F6 // F6 key +#define VK_F7 DVL_VK_F7 // F7 key +#define VK_F8 DVL_VK_F8 // F8 key +#define VK_F9 DVL_VK_F9 // F9 key +#define VK_F10 DVL_VK_F10 // F10 key +#define VK_F11 DVL_VK_F11 // F11 key +#define VK_F12 DVL_VK_F12 // F12 key +#define VK_NUMLOCK DVL_VK_NUMLOCK // NUM LOCK key +#define VK_SCROLL DVL_VK_SCROLL // SCROLL LOCK key +#define VK_LSHIFT DVL_VK_LSHIFT // Left SHIFT key +#define VK_RSHIFT DVL_VK_RSHIFT // Right SHIFT key +#define VK_LCONTROL DVL_VK_LCONTROL // Left CONTROL key +#define VK_RCONTROL DVL_VK_RCONTROL // Right CONTROL key +#define VK_LMENU DVL_VK_LMENU // Left MENU key +#define VK_RMENU DVL_VK_RMENU // Right MENU key +#define VK_OEM_1 DVL_VK_OEM_1 // For the US standard keyboard, the ';:' key +#define VK_OEM_PLUS DVL_VK_OEM_PLUS // For any country/region, the '+' key +#define VK_OEM_COMMA DVL_VK_OEM_COMMA // For any country/region, the ',' key +#define VK_OEM_MINUS DVL_VK_OEM_MINUS // For any country/region, the '-' key +#define VK_OEM_PERIOD DVL_VK_OEM_PERIOD // For any country/region, the '.' key +#define VK_OEM_2 DVL_VK_OEM_2 // For the US standard keyboard, the '/?' key +#define VK_OEM_3 DVL_VK_OEM_3 // For the US standard keyboard, the '`~' key +#define VK_OEM_4 DVL_VK_OEM_4 // For the US standard keyboard, the '[{' key +#define VK_OEM_5 DVL_VK_OEM_5 // For the US standard keyboard, the '\|' key +#define VK_OEM_6 DVL_VK_OEM_6 // For the US standard keyboard, the ']}' key +#define VK_OEM_7 DVL_VK_OEM_7 // For the US standard keyboard, the 'single-quote/double-quote' key #define MK_SHIFT DVL_MK_SHIFT #define MK_LBUTTON DVL_MK_LBUTTON diff --git a/SourceX/miniwin/misc_msg.cpp b/SourceX/miniwin/misc_msg.cpp index 28e009f9434..f5a82ea76b2 100644 --- a/SourceX/miniwin/misc_msg.cpp +++ b/SourceX/miniwin/misc_msg.cpp @@ -15,68 +15,414 @@ static std::deque message_queue; static int translate_sdl_key(SDL_Keysym key) { + // ref: https://wiki.libsdl.org/SDL_Keycode + // ref: https://docs.microsoft.com/en-us/windows/win32/inputdev/virtual-key-codes int sym = key.sym; switch (sym) { - case SDLK_ESCAPE: - return DVL_VK_ESCAPE; - case SDLK_RETURN: - case SDLK_KP_ENTER: - return DVL_VK_RETURN; + case SDLK_BACKSPACE: + return DVL_VK_BACK; case SDLK_TAB: return DVL_VK_TAB; + case SDLK_RETURN: + return DVL_VK_RETURN; + case SDLK_ESCAPE: + return DVL_VK_ESCAPE; case SDLK_SPACE: return DVL_VK_SPACE; - case SDLK_BACKSPACE: - return DVL_VK_BACK; - - case SDLK_DOWN: - return DVL_VK_DOWN; - case SDLK_LEFT: - return DVL_VK_LEFT; - case SDLK_RIGHT: - return DVL_VK_RIGHT; - case SDLK_UP: - return DVL_VK_UP; - - case SDLK_PAGEUP: - return DVL_VK_PRIOR; - case SDLK_PAGEDOWN: - return DVL_VK_NEXT; - - case SDLK_PAUSE: - return DVL_VK_PAUSE; - + //case SDLK_EXCLAIM: + // return DVL_VK_FOO; + //case SDLK_QUOTEDBL: + // return DVL_VK_FOO; + //case SDLK_HASH: + // return DVL_VK_FOO; + //case SDLK_DOLLAR: + // return DVL_VK_FOO; + //case SDLK_PERCENT: + // return DVL_VK_FOO; + //case SDLK_AMPERSAND: + // return DVL_VK_FOO; + case SDLK_QUOTE: + return DVL_VK_OEM_7; + //case SDLK_LEFTPAREN: + // return DVL_VK_FOO; + //case SDLK_RIGHTPAREN: + // return DVL_VK_FOO; + //case SDLK_ASTERISK: + // return DVL_VK_FOO; + //case SDLK_PLUS: + // return DVL_VK_FOO; + case SDLK_COMMA: + return DVL_VK_OEM_COMMA; + case SDLK_MINUS: + return DVL_VK_OEM_MINUS; + case SDLK_PERIOD: + return DVL_VK_OEM_PERIOD; + case SDLK_SLASH: + return DVL_VK_OEM_2; + //case SDLK_COLON: + // return DVL_VK_FOO; case SDLK_SEMICOLON: return DVL_VK_OEM_1; - case SDLK_QUESTION: - return DVL_VK_OEM_2; - case SDLK_BACKQUOTE: - return DVL_VK_OEM_3; + //case SDLK_LESS: + // return DVL_VK_FOO; + case SDLK_EQUALS: + return DVL_VK_OEM_PLUS; + //case SDLK_GREATER: + // return DVL_VK_FOO; + //case SDLK_QUESTION: + // return DVL_VK_FOO; + //case SDLK_AT: + // return DVL_VK_FOO; case SDLK_LEFTBRACKET: return DVL_VK_OEM_4; case SDLK_BACKSLASH: return DVL_VK_OEM_5; case SDLK_RIGHTBRACKET: return DVL_VK_OEM_6; - case SDLK_QUOTE: - return DVL_VK_OEM_7; - case SDLK_MINUS: + //case SDLK_CARET: + // return DVL_VK_FOO; + //case SDLK_UNDERSCORE: + // return DVL_VK_FOO; + case SDLK_BACKQUOTE: + return DVL_VK_OEM_3; + case SDLK_DELETE: + return DVL_VK_DELETE; + case SDLK_CAPSLOCK: + return DVL_VK_CAPITAL; + case SDLK_F1: + return DVL_VK_F1; + case SDLK_F2: + return DVL_VK_F2; + case SDLK_F3: + return DVL_VK_F3; + case SDLK_F4: + return DVL_VK_F4; + case SDLK_F5: + return DVL_VK_F5; + case SDLK_F6: + return DVL_VK_F6; + case SDLK_F7: + return DVL_VK_F7; + case SDLK_F8: + return DVL_VK_F8; + case SDLK_F9: + return DVL_VK_F9; + case SDLK_F10: + return DVL_VK_F10; + case SDLK_F11: + return DVL_VK_F11; + case SDLK_F12: + return DVL_VK_F12; + case SDLK_PRINTSCREEN: + return DVL_VK_SNAPSHOT; + case SDLK_SCROLLLOCK: + return DVL_VK_SCROLL; + case SDLK_PAUSE: + return DVL_VK_PAUSE; + case SDLK_INSERT: + return DVL_VK_INSERT; + case SDLK_HOME: + return DVL_VK_HOME; + case SDLK_PAGEUP: + return DVL_VK_PRIOR; + case SDLK_END: + return DVL_VK_END; + case SDLK_PAGEDOWN: + return DVL_VK_NEXT; + case SDLK_RIGHT: + return DVL_VK_RIGHT; + case SDLK_LEFT: + return DVL_VK_LEFT; + case SDLK_DOWN: + return DVL_VK_DOWN; + case SDLK_UP: + return DVL_VK_UP; + case SDLK_NUMLOCKCLEAR: + return DVL_VK_NUMLOCK; + case SDLK_KP_DIVIDE: + return DVL_VK_DIVIDE; + case SDLK_KP_MULTIPLY: + return DVL_VK_MULTIPLY; case SDLK_KP_MINUS: + // Returning DVL_VK_OEM_MINUS to play nice with Devilution automap zoom. + // + // For a distinct keypad key-code, DVL_VK_SUBTRACT should be returned. return DVL_VK_OEM_MINUS; - case SDLK_PLUS: - case SDLK_EQUALS: case SDLK_KP_PLUS: + // Returning DVL_VK_OEM_PLUS to play nice with Devilution automap zoom. + // + // For a distinct keypad key-code, DVL_VK_ADD should be returned. return DVL_VK_OEM_PLUS; - case SDLK_PERIOD: - return DVL_VK_OEM_PERIOD; - case SDLK_COMMA: + case SDLK_KP_ENTER: + return DVL_VK_RETURN; + case SDLK_KP_1: + return DVL_VK_NUMPAD1; + case SDLK_KP_2: + return DVL_VK_NUMPAD2; + case SDLK_KP_3: + return DVL_VK_NUMPAD3; + case SDLK_KP_4: + return DVL_VK_NUMPAD4; + case SDLK_KP_5: + return DVL_VK_NUMPAD5; + case SDLK_KP_6: + return DVL_VK_NUMPAD6; + case SDLK_KP_7: + return DVL_VK_NUMPAD7; + case SDLK_KP_8: + return DVL_VK_NUMPAD8; + case SDLK_KP_9: + return DVL_VK_NUMPAD9; + case SDLK_KP_0: + return DVL_VK_NUMPAD0; + case SDLK_KP_PERIOD: + return DVL_VK_DECIMAL; + //case SDLK_APPLICATION: + // return DVL_VK_FOO; + //case SDLK_POWER: + // return DVL_VK_FOO; + //case SDLK_KP_EQUALS: + // return DVL_VK_FOO; + //case SDLK_F13: + // return DVL_VK_FOO; + //case SDLK_F14: + // return DVL_VK_FOO; + //case SDLK_F15: + // return DVL_VK_FOO; + //case SDLK_F16: + // return DVL_VK_FOO; + //case SDLK_F17: + // return DVL_VK_FOO; + //case SDLK_F18: + // return DVL_VK_FOO; + //case SDLK_F19: + // return DVL_VK_FOO; + //case SDLK_F20: + // return DVL_VK_FOO; + //case SDLK_F21: + // return DVL_VK_FOO; + //case SDLK_F22: + // return DVL_VK_FOO; + //case SDLK_F23: + // return DVL_VK_FOO; + //case SDLK_F24: + // return DVL_VK_FOO; + //case SDLK_EXECUTE: + // return DVL_VK_FOO; + //case SDLK_HELP: + // return DVL_VK_FOO; + case SDLK_MENU: + return DVL_VK_RMENU; + //case SDLK_SELECT: + // return DVL_VK_FOO; + //case SDLK_STOP: + // return DVL_VK_FOO; + //case SDLK_AGAIN: + // return DVL_VK_FOO; + //case SDLK_UNDO: + // return DVL_VK_FOO; + //case SDLK_CUT: + // return DVL_VK_FOO; + //case SDLK_COPY: + // return DVL_VK_FOO; + //case SDLK_PASTE: + // return DVL_VK_FOO; + //case SDLK_FIND: + // return DVL_VK_FOO; + //case SDLK_MUTE: + // return DVL_VK_FOO; + //case SDLK_VOLUMEUP: + // return DVL_VK_FOO; + //case SDLK_VOLUMEDOWN: + // return DVL_VK_FOO; + case SDLK_KP_COMMA: return DVL_VK_OEM_COMMA; + //case SDLK_KP_EQUALSAS400: + // return DVL_VK_FOO; + //case SDLK_ALTERASE: + // return DVL_VK_FOO; + //case SDLK_SYSREQ: + // return DVL_VK_FOO; + //case SDLK_CANCEL: + // return DVL_VK_FOO; + //case SDLK_CLEAR: + // return DVL_VK_FOO; + //case SDLK_PRIOR: + // return DVL_VK_FOO; + //case SDLK_RETURN2: + // return DVL_VK_FOO; + //case SDLK_SEPARATOR: + // return DVL_VK_FOO; + //case SDLK_OUT: + // return DVL_VK_FOO; + //case SDLK_OPER: + // return DVL_VK_FOO; + //case SDLK_CLEARAGAIN: + // return DVL_VK_FOO; + //case SDLK_CRSEL: + // return DVL_VK_FOO; + //case SDLK_EXSEL: + // return DVL_VK_FOO; + //case SDLK_KP_00: + // return DVL_VK_FOO; + //case SDLK_KP_000: + // return DVL_VK_FOO; + //case SDLK_THOUSANDSSEPARATOR: + // return DVL_VK_FOO; + //case SDLK_DECIMALSEPARATOR: + // return DVL_VK_FOO; + //case SDLK_CURRENCYUNIT: + // return DVL_VK_FOO; + //case SDLK_CURRENCYSUBUNIT: + // return DVL_VK_FOO; + //case SDLK_KP_LEFTPAREN: + // return DVL_VK_FOO; + //case SDLK_KP_RIGHTPAREN: + // return DVL_VK_FOO; + //case SDLK_KP_LEFTBRACE: + // return DVL_VK_FOO; + //case SDLK_KP_RIGHTBRACE: + // return DVL_VK_FOO; + //case SDLK_KP_TAB: + // return DVL_VK_FOO; + //case SDLK_KP_BACKSPACE: + // return DVL_VK_FOO; + //case SDLK_KP_A: + // return DVL_VK_FOO; + //case SDLK_KP_B: + // return DVL_VK_FOO; + //case SDLK_KP_C: + // return DVL_VK_FOO; + //case SDLK_KP_D: + // return DVL_VK_FOO; + //case SDLK_KP_E: + // return DVL_VK_FOO; + //case SDLK_KP_F: + // return DVL_VK_FOO; + //case SDLK_KP_XOR: + // return DVL_VK_FOO; + //case SDLK_KP_POWER: + // return DVL_VK_FOO; + //case SDLK_KP_PERCENT: + // return DVL_VK_FOO; + //case SDLK_KP_LESS: + // return DVL_VK_FOO; + //case SDLK_KP_GREATER: + // return DVL_VK_FOO; + //case SDLK_KP_AMPERSAND: + // return DVL_VK_FOO; + //case SDLK_KP_DBLAMPERSAND: + // return DVL_VK_FOO; + //case SDLK_KP_VERTICALBAR: + // return DVL_VK_FOO; + //case SDLK_KP_DBLVERTICALBAR: + // return DVL_VK_FOO; + //case SDLK_KP_COLON: + // return DVL_VK_FOO; + //case SDLK_KP_HASH: + // return DVL_VK_FOO; + //case SDLK_KP_SPACE: + // return DVL_VK_FOO; + //case SDLK_KP_AT: + // return DVL_VK_FOO; + //case SDLK_KP_EXCLAM: + // return DVL_VK_FOO; + //case SDLK_KP_MEMSTORE: + // return DVL_VK_FOO; + //case SDLK_KP_MEMRECALL: + // return DVL_VK_FOO; + //case SDLK_KP_MEMCLEAR: + // return DVL_VK_FOO; + //case SDLK_KP_MEMADD: + // return DVL_VK_FOO; + //case SDLK_KP_MEMSUBTRACT: + // return DVL_VK_FOO; + //case SDLK_KP_MEMMULTIPLY: + // return DVL_VK_FOO; + //case SDLK_KP_MEMDIVIDE: + // return DVL_VK_FOO; + //case SDLK_KP_PLUSMINUS: + // return DVL_VK_FOO; + //case SDLK_KP_CLEAR: + // return DVL_VK_FOO; + //case SDLK_KP_CLEARENTRY: + // return DVL_VK_FOO; + //case SDLK_KP_BINARY: + // return DVL_VK_FOO; + //case SDLK_KP_OCTAL: + // return DVL_VK_FOO; + //case SDLK_KP_DECIMAL: + // return DVL_VK_FOO; + //case SDLK_KP_HEXADECIMAL: + // return DVL_VK_FOO; + case SDLK_LCTRL: + return DVL_VK_LCONTROL; case SDLK_LSHIFT: + return DVL_VK_LSHIFT; + case SDLK_LALT: + return DVL_VK_LMENU; + case SDLK_LGUI: + return DVL_VK_LWIN; + case SDLK_RCTRL: + return DVL_VK_RCONTROL; case SDLK_RSHIFT: - return DVL_VK_SHIFT; - case SDLK_PRINTSCREEN: - return DVL_VK_SNAPSHOT; - + return DVL_VK_RSHIFT; + case SDLK_RALT: + return DVL_VK_RMENU; + case SDLK_RGUI: + return DVL_VK_RWIN; + //case SDLK_MODE: + // return DVL_VK_FOO; + //case SDLK_AUDIONEXT: + // return DVL_VK_FOO; + //case SDLK_AUDIOPREV: + // return DVL_VK_FOO; + //case SDLK_AUDIOSTOP: + // return DVL_VK_FOO; + //case SDLK_AUDIOPLAY: + // return DVL_VK_FOO; + //case SDLK_AUDIOMUTE: + // return DVL_VK_FOO; + //case SDLK_MEDIASELECT: + // return DVL_VK_FOO; + //case SDLK_WWW: + // return DVL_VK_FOO; + //case SDLK_MAIL: + // return DVL_VK_FOO; + //case SDLK_CALCULATOR: + // return DVL_VK_FOO; + //case SDLK_COMPUTER: + // return DVL_VK_FOO; + //case SDLK_AC_SEARCH: + // return DVL_VK_FOO; + //case SDLK_AC_HOME: + // return DVL_VK_FOO; + //case SDLK_AC_BACK: + // return DVL_VK_FOO; + //case SDLK_AC_FORWARD: + // return DVL_VK_FOO; + //case SDLK_AC_STOP: + // return DVL_VK_FOO; + //case SDLK_AC_REFRESH: + // return DVL_VK_FOO; + //case SDLK_AC_BOOKMARKS: + // return DVL_VK_FOO; + //case SDLK_BRIGHTNESSDOWN: + // return DVL_VK_FOO; + //case SDLK_BRIGHTNESSUP: + // return DVL_VK_FOO; + //case SDLK_DISPLAYSWITCH: + // return DVL_VK_FOO; + //case SDLK_KBDILLUMTOGGLE: + // return DVL_VK_FOO; + //case SDLK_KBDILLUMDOWN: + // return DVL_VK_FOO; + //case SDLK_KBDILLUMUP: + // return DVL_VK_FOO; + //case SDLK_EJECT: + // return DVL_VK_FOO; + //case SDLK_SLEEP: + // return DVL_VK_FOO; default: if (sym >= SDLK_a && sym <= SDLK_z) { return 'A' + (sym - SDLK_a); From 929be99acf40746938b774555cbb0311512e3a4f Mon Sep 17 00:00:00 2001 From: Robin Eklind Date: Tue, 9 Jul 2019 16:19:15 +0200 Subject: [PATCH 25/42] miniwin: fix keycode translation of SDLK_MENU --- SourceX/miniwin/misc_msg.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/SourceX/miniwin/misc_msg.cpp b/SourceX/miniwin/misc_msg.cpp index f5a82ea76b2..71b334adf09 100644 --- a/SourceX/miniwin/misc_msg.cpp +++ b/SourceX/miniwin/misc_msg.cpp @@ -212,7 +212,7 @@ static int translate_sdl_key(SDL_Keysym key) //case SDLK_HELP: // return DVL_VK_FOO; case SDLK_MENU: - return DVL_VK_RMENU; + return DVL_VK_MENU; //case SDLK_SELECT: // return DVL_VK_FOO; //case SDLK_STOP: From deb187be9bd14c56f99df3e213d72910327a85eb Mon Sep 17 00:00:00 2001 From: Robin Eklind Date: Tue, 9 Jul 2019 16:22:23 +0200 Subject: [PATCH 26/42] miniwin: remove comment for unused SDL key-codes Should we later notice that there are more keys not being translated, we can refer back to this commit for the remaining SDL key-codes. --- SourceX/miniwin/misc_msg.cpp | 260 ----------------------------------- 1 file changed, 260 deletions(-) diff --git a/SourceX/miniwin/misc_msg.cpp b/SourceX/miniwin/misc_msg.cpp index 71b334adf09..31bf16d06a0 100644 --- a/SourceX/miniwin/misc_msg.cpp +++ b/SourceX/miniwin/misc_msg.cpp @@ -29,28 +29,8 @@ static int translate_sdl_key(SDL_Keysym key) return DVL_VK_ESCAPE; case SDLK_SPACE: return DVL_VK_SPACE; - //case SDLK_EXCLAIM: - // return DVL_VK_FOO; - //case SDLK_QUOTEDBL: - // return DVL_VK_FOO; - //case SDLK_HASH: - // return DVL_VK_FOO; - //case SDLK_DOLLAR: - // return DVL_VK_FOO; - //case SDLK_PERCENT: - // return DVL_VK_FOO; - //case SDLK_AMPERSAND: - // return DVL_VK_FOO; case SDLK_QUOTE: return DVL_VK_OEM_7; - //case SDLK_LEFTPAREN: - // return DVL_VK_FOO; - //case SDLK_RIGHTPAREN: - // return DVL_VK_FOO; - //case SDLK_ASTERISK: - // return DVL_VK_FOO; - //case SDLK_PLUS: - // return DVL_VK_FOO; case SDLK_COMMA: return DVL_VK_OEM_COMMA; case SDLK_MINUS: @@ -59,30 +39,16 @@ static int translate_sdl_key(SDL_Keysym key) return DVL_VK_OEM_PERIOD; case SDLK_SLASH: return DVL_VK_OEM_2; - //case SDLK_COLON: - // return DVL_VK_FOO; case SDLK_SEMICOLON: return DVL_VK_OEM_1; - //case SDLK_LESS: - // return DVL_VK_FOO; case SDLK_EQUALS: return DVL_VK_OEM_PLUS; - //case SDLK_GREATER: - // return DVL_VK_FOO; - //case SDLK_QUESTION: - // return DVL_VK_FOO; - //case SDLK_AT: - // return DVL_VK_FOO; case SDLK_LEFTBRACKET: return DVL_VK_OEM_4; case SDLK_BACKSLASH: return DVL_VK_OEM_5; case SDLK_RIGHTBRACKET: return DVL_VK_OEM_6; - //case SDLK_CARET: - // return DVL_VK_FOO; - //case SDLK_UNDERSCORE: - // return DVL_VK_FOO; case SDLK_BACKQUOTE: return DVL_VK_OEM_3; case SDLK_DELETE: @@ -177,184 +143,10 @@ static int translate_sdl_key(SDL_Keysym key) return DVL_VK_NUMPAD0; case SDLK_KP_PERIOD: return DVL_VK_DECIMAL; - //case SDLK_APPLICATION: - // return DVL_VK_FOO; - //case SDLK_POWER: - // return DVL_VK_FOO; - //case SDLK_KP_EQUALS: - // return DVL_VK_FOO; - //case SDLK_F13: - // return DVL_VK_FOO; - //case SDLK_F14: - // return DVL_VK_FOO; - //case SDLK_F15: - // return DVL_VK_FOO; - //case SDLK_F16: - // return DVL_VK_FOO; - //case SDLK_F17: - // return DVL_VK_FOO; - //case SDLK_F18: - // return DVL_VK_FOO; - //case SDLK_F19: - // return DVL_VK_FOO; - //case SDLK_F20: - // return DVL_VK_FOO; - //case SDLK_F21: - // return DVL_VK_FOO; - //case SDLK_F22: - // return DVL_VK_FOO; - //case SDLK_F23: - // return DVL_VK_FOO; - //case SDLK_F24: - // return DVL_VK_FOO; - //case SDLK_EXECUTE: - // return DVL_VK_FOO; - //case SDLK_HELP: - // return DVL_VK_FOO; case SDLK_MENU: return DVL_VK_MENU; - //case SDLK_SELECT: - // return DVL_VK_FOO; - //case SDLK_STOP: - // return DVL_VK_FOO; - //case SDLK_AGAIN: - // return DVL_VK_FOO; - //case SDLK_UNDO: - // return DVL_VK_FOO; - //case SDLK_CUT: - // return DVL_VK_FOO; - //case SDLK_COPY: - // return DVL_VK_FOO; - //case SDLK_PASTE: - // return DVL_VK_FOO; - //case SDLK_FIND: - // return DVL_VK_FOO; - //case SDLK_MUTE: - // return DVL_VK_FOO; - //case SDLK_VOLUMEUP: - // return DVL_VK_FOO; - //case SDLK_VOLUMEDOWN: - // return DVL_VK_FOO; case SDLK_KP_COMMA: return DVL_VK_OEM_COMMA; - //case SDLK_KP_EQUALSAS400: - // return DVL_VK_FOO; - //case SDLK_ALTERASE: - // return DVL_VK_FOO; - //case SDLK_SYSREQ: - // return DVL_VK_FOO; - //case SDLK_CANCEL: - // return DVL_VK_FOO; - //case SDLK_CLEAR: - // return DVL_VK_FOO; - //case SDLK_PRIOR: - // return DVL_VK_FOO; - //case SDLK_RETURN2: - // return DVL_VK_FOO; - //case SDLK_SEPARATOR: - // return DVL_VK_FOO; - //case SDLK_OUT: - // return DVL_VK_FOO; - //case SDLK_OPER: - // return DVL_VK_FOO; - //case SDLK_CLEARAGAIN: - // return DVL_VK_FOO; - //case SDLK_CRSEL: - // return DVL_VK_FOO; - //case SDLK_EXSEL: - // return DVL_VK_FOO; - //case SDLK_KP_00: - // return DVL_VK_FOO; - //case SDLK_KP_000: - // return DVL_VK_FOO; - //case SDLK_THOUSANDSSEPARATOR: - // return DVL_VK_FOO; - //case SDLK_DECIMALSEPARATOR: - // return DVL_VK_FOO; - //case SDLK_CURRENCYUNIT: - // return DVL_VK_FOO; - //case SDLK_CURRENCYSUBUNIT: - // return DVL_VK_FOO; - //case SDLK_KP_LEFTPAREN: - // return DVL_VK_FOO; - //case SDLK_KP_RIGHTPAREN: - // return DVL_VK_FOO; - //case SDLK_KP_LEFTBRACE: - // return DVL_VK_FOO; - //case SDLK_KP_RIGHTBRACE: - // return DVL_VK_FOO; - //case SDLK_KP_TAB: - // return DVL_VK_FOO; - //case SDLK_KP_BACKSPACE: - // return DVL_VK_FOO; - //case SDLK_KP_A: - // return DVL_VK_FOO; - //case SDLK_KP_B: - // return DVL_VK_FOO; - //case SDLK_KP_C: - // return DVL_VK_FOO; - //case SDLK_KP_D: - // return DVL_VK_FOO; - //case SDLK_KP_E: - // return DVL_VK_FOO; - //case SDLK_KP_F: - // return DVL_VK_FOO; - //case SDLK_KP_XOR: - // return DVL_VK_FOO; - //case SDLK_KP_POWER: - // return DVL_VK_FOO; - //case SDLK_KP_PERCENT: - // return DVL_VK_FOO; - //case SDLK_KP_LESS: - // return DVL_VK_FOO; - //case SDLK_KP_GREATER: - // return DVL_VK_FOO; - //case SDLK_KP_AMPERSAND: - // return DVL_VK_FOO; - //case SDLK_KP_DBLAMPERSAND: - // return DVL_VK_FOO; - //case SDLK_KP_VERTICALBAR: - // return DVL_VK_FOO; - //case SDLK_KP_DBLVERTICALBAR: - // return DVL_VK_FOO; - //case SDLK_KP_COLON: - // return DVL_VK_FOO; - //case SDLK_KP_HASH: - // return DVL_VK_FOO; - //case SDLK_KP_SPACE: - // return DVL_VK_FOO; - //case SDLK_KP_AT: - // return DVL_VK_FOO; - //case SDLK_KP_EXCLAM: - // return DVL_VK_FOO; - //case SDLK_KP_MEMSTORE: - // return DVL_VK_FOO; - //case SDLK_KP_MEMRECALL: - // return DVL_VK_FOO; - //case SDLK_KP_MEMCLEAR: - // return DVL_VK_FOO; - //case SDLK_KP_MEMADD: - // return DVL_VK_FOO; - //case SDLK_KP_MEMSUBTRACT: - // return DVL_VK_FOO; - //case SDLK_KP_MEMMULTIPLY: - // return DVL_VK_FOO; - //case SDLK_KP_MEMDIVIDE: - // return DVL_VK_FOO; - //case SDLK_KP_PLUSMINUS: - // return DVL_VK_FOO; - //case SDLK_KP_CLEAR: - // return DVL_VK_FOO; - //case SDLK_KP_CLEARENTRY: - // return DVL_VK_FOO; - //case SDLK_KP_BINARY: - // return DVL_VK_FOO; - //case SDLK_KP_OCTAL: - // return DVL_VK_FOO; - //case SDLK_KP_DECIMAL: - // return DVL_VK_FOO; - //case SDLK_KP_HEXADECIMAL: - // return DVL_VK_FOO; case SDLK_LCTRL: return DVL_VK_LCONTROL; case SDLK_LSHIFT: @@ -371,58 +163,6 @@ static int translate_sdl_key(SDL_Keysym key) return DVL_VK_RMENU; case SDLK_RGUI: return DVL_VK_RWIN; - //case SDLK_MODE: - // return DVL_VK_FOO; - //case SDLK_AUDIONEXT: - // return DVL_VK_FOO; - //case SDLK_AUDIOPREV: - // return DVL_VK_FOO; - //case SDLK_AUDIOSTOP: - // return DVL_VK_FOO; - //case SDLK_AUDIOPLAY: - // return DVL_VK_FOO; - //case SDLK_AUDIOMUTE: - // return DVL_VK_FOO; - //case SDLK_MEDIASELECT: - // return DVL_VK_FOO; - //case SDLK_WWW: - // return DVL_VK_FOO; - //case SDLK_MAIL: - // return DVL_VK_FOO; - //case SDLK_CALCULATOR: - // return DVL_VK_FOO; - //case SDLK_COMPUTER: - // return DVL_VK_FOO; - //case SDLK_AC_SEARCH: - // return DVL_VK_FOO; - //case SDLK_AC_HOME: - // return DVL_VK_FOO; - //case SDLK_AC_BACK: - // return DVL_VK_FOO; - //case SDLK_AC_FORWARD: - // return DVL_VK_FOO; - //case SDLK_AC_STOP: - // return DVL_VK_FOO; - //case SDLK_AC_REFRESH: - // return DVL_VK_FOO; - //case SDLK_AC_BOOKMARKS: - // return DVL_VK_FOO; - //case SDLK_BRIGHTNESSDOWN: - // return DVL_VK_FOO; - //case SDLK_BRIGHTNESSUP: - // return DVL_VK_FOO; - //case SDLK_DISPLAYSWITCH: - // return DVL_VK_FOO; - //case SDLK_KBDILLUMTOGGLE: - // return DVL_VK_FOO; - //case SDLK_KBDILLUMDOWN: - // return DVL_VK_FOO; - //case SDLK_KBDILLUMUP: - // return DVL_VK_FOO; - //case SDLK_EJECT: - // return DVL_VK_FOO; - //case SDLK_SLEEP: - // return DVL_VK_FOO; default: if (sym >= SDLK_a && sym <= SDLK_z) { return 'A' + (sym - SDLK_a); From c16553c65d59178033c92d59b7c2444495c50255 Mon Sep 17 00:00:00 2001 From: Anders Jenbo Date: Thu, 11 Jul 2019 01:38:12 +0200 Subject: [PATCH 27/42] Fix GCC builds --- Source/list.h | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/Source/list.h b/Source/list.h index 9014f77e476..2f095c6d59d 100644 --- a/Source/list.h +++ b/Source/list.h @@ -58,7 +58,7 @@ class TList { TList(const TList &); TList &operator=(const TList &); - static __forceinline void SDelete(T *node) + static __inline void SDelete(T *node) { SMemFree(node, (char *)OBJECT_NAME(T), SLOG_OBJECT, 0); } @@ -95,14 +95,14 @@ void TList::DeleteAll() //============================================================================= template -__forceinline T *TList::Head() +__inline T *TList::Head() { return m_link.Next(); } //============================================================================= template -__forceinline TLink *TList::GetLinkFromNode(T *node) const +__inline TLink *TList::GetLinkFromNode(T *node) const { // assert(m_offset != (size_t) -1); // return (TLink *) ((size_t) node + m_offset); @@ -217,7 +217,7 @@ class TLink { nextLink->m_prevLink = this; } - __forceinline void InsertAfter(T *node, TLink *prevLink, const size_t &offset) + __inline void InsertAfter(T *node, TLink *prevLink, const size_t &offset) { m_prevLink = prevLink; m_nextNode = prevLink->m_nextNode; From a0c295811d730adf6262ca1989a3bce0893ee026 Mon Sep 17 00:00:00 2001 From: Alex Sweet Date: Mon, 8 Jul 2019 02:07:18 -0700 Subject: [PATCH 28/42] Load 32 bit save files --- Source/loadsave.cpp | 533 +++++++++++++++++++++++++++++++++++++++++++- Source/loadsave.h | 7 +- structs.h | 20 +- 3 files changed, 546 insertions(+), 14 deletions(-) diff --git a/Source/loadsave.cpp b/Source/loadsave.cpp index e5180d911d2..f490f108530 100644 --- a/Source/loadsave.cpp +++ b/Source/loadsave.cpp @@ -174,11 +174,13 @@ void LoadGame(BOOL firstflag) gbProcessPlayers = TRUE; } +// Load a byte-size char from the buffer char BLoad() { return *tbuff++; } +// Redundant? int WLoad() { int rv = *tbuff++ << 24; @@ -189,6 +191,7 @@ int WLoad() return rv; } +// Load a 32 bit integer from the buffer int ILoad() { int rv = *tbuff++ << 24; @@ -207,38 +210,548 @@ BOOL OLoad() return FALSE; } +// Consume an int from tbuff with memcpy - copies directly, doesn't change byte order +void CopyInt(int & dst) +{ + memcpy(&dst, tbuff, 4); + tbuff += 4; +} + +void CopyInt(unsigned int & dst) +{ + memcpy(&dst, tbuff, 4); + tbuff += 4; +} + +void CopyShort(unsigned short & dst) +{ + memcpy(&dst, tbuff, 2); + tbuff += 2; +} + +void CopyShort(short & dst) +{ + memcpy(&dst, tbuff, 2); + tbuff += 2; +} + +void CopyShorts(const int n, unsigned short * dst) +{ + memcpy(dst, tbuff, 2 * n); + tbuff += 2 * n; +} + +// Copy an int array of size n +void CopyInts(const int n, int* dst) +{ + memcpy(dst, tbuff, 4 * n); + tbuff += 4 * n; +} + +void CopyBytes(const int n, unsigned char *dst) +{ + memcpy(dst, tbuff, n); + tbuff += n; +} + +void CopyChar(unsigned char & dst) +{ + memcpy(&dst, tbuff, 1); + tbuff += 1; +} + +void CopyChar(char & dst) +{ + memcpy(&dst, tbuff, 1); + tbuff += 1; +} + +void CopyInt64(long long unsigned int & dst) +{ + memcpy(&dst, tbuff, 8); + tbuff += 8; +} + void LoadPlayer(int i) { - memcpy(&plr[i], tbuff, sizeof(*plr) - (10 * sizeof(void *))); - tbuff += sizeof(*plr) - (10 * sizeof(void *)); // omit last 10 pointers + PlayerStruct *pPlayer = &plr[i]; + CopyInt(pPlayer->_pmode); + CopyBytes(25, pPlayer->walkpath); + CopyBytes(1, &pPlayer->plractive); + tbuff += 2; // Some padding here? + CopyInt(pPlayer->destAction); + CopyInt(pPlayer->destParam1); + CopyInt(pPlayer->destParam2); + CopyInt(pPlayer->destParam3); + CopyInt(pPlayer->destParam4); + CopyInt(pPlayer->plrlevel); + CopyInt(pPlayer->WorldX); + CopyInt(pPlayer->WorldY); + CopyInt(pPlayer->_px); + CopyInt(pPlayer->_py); + CopyInt(pPlayer->_ptargx); + CopyInt(pPlayer->_ptargy); + CopyInt(pPlayer->_pownerx); + CopyInt(pPlayer->_pownery); + CopyInt(pPlayer->_poldx); + CopyInt(pPlayer->_poldy); + CopyInt(pPlayer->_pxoff); + CopyInt(pPlayer->_pyoff); + CopyInt(pPlayer->_pxvel); + CopyInt(pPlayer->_pyvel); + CopyInt(pPlayer->_pdir); + CopyInt(pPlayer->_nextdir); + CopyInt(pPlayer->_pgfxnum); + tbuff += 4; // Skip pointers + CopyInt(pPlayer->_pAnimDelay); + CopyInt(pPlayer->_pAnimCnt); + CopyInt(pPlayer->_pAnimLen); + CopyInt(pPlayer->_pAnimFrame); + CopyInt(pPlayer->_pAnimWidth); + CopyInt(pPlayer->_pAnimWidth2); + CopyInt(pPlayer->_peflag); + CopyInt(pPlayer->_plid); + CopyInt(pPlayer->_pvid); + + CopyInt(pPlayer->_pSpell); + CopyChar(pPlayer->_pSplType); + CopyChar(pPlayer->_pSplFrom); + CopyInt(pPlayer->_pTSpell); + CopyChar(pPlayer->_pTSplType); + tbuff += 5; + CopyInt(pPlayer->_pRSpell); + CopyChar(pPlayer->_pRSplType); + tbuff += 3; + CopyInt(pPlayer->_pSBkSpell); + CopyChar(pPlayer->_pSBkSplType); + + CopyBytes(64, pPlayer->_pSplLvl); + tbuff += 7; + CopyInt64(pPlayer->_pMemSpells); + CopyInt64(pPlayer->_pAblSpells); + CopyInt64(pPlayer->_pScrlSpells); + CopyChar(pPlayer->_pSpellFlags); + tbuff += 3; + CopyInts(4, pPlayer->_pSplHotKey); + CopyBytes(4, pPlayer->_pSplTHotKey); + CopyInt(pPlayer->_pwtype); + CopyChar(pPlayer->_pBlockFlag); + CopyChar(pPlayer->_pInvincible); + CopyChar(pPlayer->_pLightRad); + CopyChar(pPlayer->_pLvlChanging); + CopyBytes(PLR_NAME_LEN, pPlayer->_pName); + CopyChar(pPlayer->_pClass); + tbuff += 3; + CopyInt(pPlayer->_pStrength); + CopyInt(pPlayer->_pBaseStr); + CopyInt(pPlayer->_pMagic); + CopyInt(pPlayer->_pBaseMag); + CopyInt(pPlayer->_pDexterity); + CopyInt(pPlayer->_pBaseDex); + CopyInt(pPlayer->_pVitality); + CopyInt(pPlayer->_pBaseVit); + CopyInt(pPlayer->_pStatPts); + CopyInt(pPlayer->_pDamageMod); + CopyInt(pPlayer->_pBaseToBlk); + CopyInt(pPlayer->_pHPBase); + CopyInt(pPlayer->_pMaxHPBase); + CopyInt(pPlayer->_pHitPoints); + CopyInt(pPlayer->_pMaxHP); + CopyInt(pPlayer->_pHPPer); + CopyInt(pPlayer->_pManaBase); + CopyInt(pPlayer->_pMaxManaBase); + CopyInt(pPlayer->_pMana); + CopyInt(pPlayer->_pMaxMana); + CopyInt(pPlayer->_pManaPer); + CopyChar(pPlayer->_pLevel); + CopyChar(pPlayer->_pMaxLvl); + tbuff += 2; + CopyInt(pPlayer->_pExperience); + CopyInt(pPlayer->_pMaxExp); + CopyInt(pPlayer->_pNextExper); + CopyChar(pPlayer->_pArmorClass); + CopyChar(pPlayer->_pMagResist); + CopyChar(pPlayer->_pFireResist); + CopyChar(pPlayer->_pLghtResist); + CopyInt(pPlayer->_pGold); + CopyInt(pPlayer->_pInfraFlag); + CopyInt(pPlayer->_pVar1); + CopyInt(pPlayer->_pVar2); + CopyInt(pPlayer->_pVar3); + CopyInt(pPlayer->_pVar4); + CopyInt(pPlayer->_pVar5); + CopyInt(pPlayer->_pVar6); + CopyInt(pPlayer->_pVar7); + CopyInt(pPlayer->_pVar8); + CopyBytes(NUMLEVELS, pPlayer->_pLvlVisited); + CopyBytes(NUMLEVELS, pPlayer->_pSLvlVisited); // only 10 used + tbuff += 2; + CopyInt(pPlayer->_pGFXLoad); + + tbuff += sizeof(__uint32_t) * 8; // Skip 8 pointers + CopyInt(pPlayer->_pNFrames); + CopyInt(pPlayer->_pNWidth); + + tbuff += sizeof(__uint32_t) * 8; // Skip 8 pointers + + CopyInt(pPlayer->_pWFrames); + CopyInt(pPlayer->_pWWidth); + + tbuff += sizeof(__uint32_t) * 8; // Skip 8 pointers + + CopyInt(pPlayer->_pAFrames); + CopyInt(pPlayer->_pAWidth); + CopyInt(pPlayer->_pAFNum); + + tbuff += sizeof(__uint32_t) * 24; // Skip 24 pointers + + CopyInt(pPlayer->_pSFrames); + CopyInt(pPlayer->_pSWidth); + CopyInt(pPlayer->_pSFNum); + + tbuff += sizeof(__uint32_t) * 8; // Skip 8 pointers + + CopyInt(pPlayer->_pHFrames); + CopyInt(pPlayer->_pHWidth); + + tbuff += sizeof(__uint32_t) * 8; // Skip 8 pointers + + CopyInt(pPlayer->_pDFrames); + CopyInt(pPlayer->_pDWidth); + + tbuff += sizeof(__uint32_t) * 8; // Skip 8 pointers + + CopyInt(pPlayer->_pBFrames); + CopyInt(pPlayer->_pBWidth); + + CopyItems(NUM_INVLOC, pPlayer->InvBody); + CopyItems(NUM_INV_GRID_ELEM, pPlayer->InvList); + + CopyInt(pPlayer->_pNumInv); + CopyBytes(NUM_INV_GRID_ELEM, pPlayer->InvGrid); + CopyItems(MAXBELTITEMS, pPlayer->SpdList); + CopyItem(&pPlayer->HoldItem); + CopyInt(pPlayer->_pIMinDam); + CopyInt(pPlayer->_pIMaxDam); + CopyInt(pPlayer->_pIAC); + CopyInt(pPlayer->_pIBonusDam); + CopyInt(pPlayer->_pIBonusToHit); + CopyInt(pPlayer->_pIBonusAC); + CopyInt(pPlayer->_pIBonusDamMod); + tbuff += 4; + CopyInt64(pPlayer->_pISpells); + CopyInt(pPlayer->_pIFlags); + CopyInt(pPlayer->_pIGetHit); + CopyChar(pPlayer->_pISplLvlAdd); + CopyChar(pPlayer->_pISplCost); + tbuff += 2; + CopyInt(pPlayer->_pISplDur); + CopyInt(pPlayer->_pIEnAc); + CopyInt(pPlayer->_pIFMinDam); + CopyInt(pPlayer->_pIFMaxDam); + CopyInt(pPlayer->_pILMinDam); + CopyInt(pPlayer->_pILMaxDam); + CopyInt(pPlayer->_pOilType); + CopyChar(pPlayer->pTownWarps); + CopyChar(pPlayer->pDungMsgs); + CopyChar(pPlayer->pLvlLoad); + CopyChar(pPlayer->pBattleNet); + CopyChar(pPlayer->pManaShield); + CopyBytes(3, pPlayer->bReserved); + CopyShorts(8, pPlayer->wReserved); + CopyInt(pPlayer->pDiabloKillLevel); + CopyInts(7, pPlayer->dwReserved); + + // Omit 10 pointers + } void LoadMonster(int i) { - memcpy(&monster[i], tbuff, sizeof(*monster) - (3 * sizeof(void *))); - tbuff += sizeof(*monster) - (3 * sizeof(void *)); // omit last 3 pointers + MonsterStruct *pMonster = &monster[i]; + + CopyInt(pMonster->_mMTidx); + CopyInt(pMonster->_mmode); + + CopyChar(pMonster->_mgoal); + tbuff += 3; + + CopyInt(pMonster->_mgoalvar1); + CopyInt(pMonster->_mgoalvar2); + CopyInt(pMonster->_mgoalvar3); + CopyInt(pMonster->field_18); + + CopyChar(pMonster->_pathcount); + tbuff += 3; + + CopyInt(pMonster->_mx); + CopyInt(pMonster->_my); + CopyInt(pMonster->_mfutx); + CopyInt(pMonster->_mfuty); + CopyInt(pMonster->_moldx); + CopyInt(pMonster->_moldy); + CopyInt(pMonster->_mxoff); + CopyInt(pMonster->_myoff); + CopyInt(pMonster->_mxvel); + CopyInt(pMonster->_myvel); + CopyInt(pMonster->_mdir); + CopyInt(pMonster->_menemy); + + CopyChar(pMonster->_menemyx); + CopyChar(pMonster->_menemyy); + CopyShort(pMonster->falign_52); + + tbuff += 4; // Skip pointer + CopyInt(pMonster->_mAnimDelay); + CopyInt(pMonster->_mAnimCnt); + CopyInt(pMonster->_mAnimLen); + CopyInt(pMonster->_mAnimFrame); + CopyInt(pMonster->_meflag); + CopyInt(pMonster->_mDelFlag); + CopyInt(pMonster->_mVar1); + CopyInt(pMonster->_mVar2); + CopyInt(pMonster->_mVar3); + CopyInt(pMonster->_mVar4); + CopyInt(pMonster->_mVar5); + CopyInt(pMonster->_mVar6); + CopyInt(pMonster->_mVar7); + CopyInt(pMonster->_mVar8); + CopyInt(pMonster->_mmaxhp); + CopyInt(pMonster->_mhitpoints); + + CopyChar(pMonster->_mAi); + CopyChar(pMonster->_mint); + CopyShort(pMonster->falign_9A); + + CopyInt(pMonster->_mFlags); + + CopyChar(pMonster->_msquelch); + tbuff += 3; + + CopyInt(pMonster->falign_A4); + CopyInt(pMonster->_lastx); + CopyInt(pMonster->_lasty); + CopyInt(pMonster->_mRndSeed); + CopyInt(pMonster->_mAISeed); + CopyInt(pMonster->falign_B8); + + CopyChar(pMonster->_uniqtype); + CopyChar(pMonster->_uniqtrans); + CopyChar(pMonster->_udeadval); + CopyChar(pMonster->mWhoHit); + + CopyChar(pMonster->mLevel); + CopyShort(pMonster->mExp); + tbuff += 1; + + CopyChar(pMonster->mHit); + CopyChar(pMonster->mMinDamage); + CopyChar(pMonster->mMaxDamage); + CopyChar(pMonster->mHit2); + + CopyChar(pMonster->mMinDamage2); + CopyChar(pMonster->mMaxDamage2); + CopyChar(pMonster->mArmorClass); + CopyChar(pMonster->falign_CB); + + CopyShort(pMonster->mMagicRes); + tbuff += 2; + + CopyInt(pMonster->mtalkmsg); + + CopyChar(pMonster->leader); + CopyChar(pMonster->leaderflag); + CopyChar(pMonster->packsize); + CopyChar(pMonster->mlid); + SyncMonsterAnim(i); } void LoadMissile(int i) { - memcpy(&missile[i], tbuff, sizeof(*missile)); - tbuff += sizeof(*missile); + MissileStruct *pMissile = &missile[i]; + + CopyInt(pMissile->_mitype); + CopyInt(pMissile->_mix); + CopyInt(pMissile->_miy); + CopyInt(pMissile->_mixoff); + CopyInt(pMissile->_miyoff); + CopyInt(pMissile->_mixvel); + CopyInt(pMissile->_miyvel); + CopyInt(pMissile->_misx); + CopyInt(pMissile->_misy); + CopyInt(pMissile->_mitxoff); + CopyInt(pMissile->_mityoff); + CopyInt(pMissile->_mimfnum); + CopyInt(pMissile->_mispllvl); + CopyInt(pMissile->_miDelFlag); + CopyChar(pMissile->_miAnimType); + tbuff += 3; + + CopyInt(pMissile->_miAnimFlags); + tbuff += 4; + CopyInt(pMissile->_miAnimDelay); + CopyInt(pMissile->_miAnimLen); + CopyInt(pMissile->_miAnimWidth); + CopyInt(pMissile->_miAnimWidth2); + CopyInt(pMissile->_miAnimCnt); + CopyInt(pMissile->_miAnimAdd); + CopyInt(pMissile->_miAnimFrame); + CopyInt(pMissile->_miDrawFlag); + CopyInt(pMissile->_miLightFlag); + CopyInt(pMissile->_miPreFlag); + CopyInt(pMissile->_miUniqTrans); + CopyInt(pMissile->_mirange); + CopyInt(pMissile->_misource); + CopyInt(pMissile->_micaster); + CopyInt(pMissile->_midam); + CopyInt(pMissile->_miHitFlag); + CopyInt(pMissile->_midist); + CopyInt(pMissile->_mlid); + CopyInt(pMissile->_mirnd); + CopyInt(pMissile->_miVar1); + CopyInt(pMissile->_miVar2); + CopyInt(pMissile->_miVar3); + CopyInt(pMissile->_miVar4); + CopyInt(pMissile->_miVar5); + CopyInt(pMissile->_miVar6); + CopyInt(pMissile->_miVar7); + CopyInt(pMissile->_miVar8); } void LoadObject(int i) { - memcpy(&object[i], tbuff, sizeof(*object)); - tbuff += sizeof(*object); + ObjectStruct *pObject = &object[i]; + CopyInt(pObject->_otype); + CopyInt(pObject->_ox); + CopyInt(pObject->_oy); + CopyInt(pObject->_oLight); + CopyInt(pObject->_oAnimFlag); + tbuff += 4; + CopyInt(pObject->_oAnimDelay); + CopyInt(pObject->_oAnimCnt); + CopyInt(pObject->_oAnimLen); + CopyInt(pObject->_oAnimFrame); + CopyInt(pObject->_oAnimWidth); + CopyInt(pObject->_oAnimWidth2); + CopyInt(pObject->_oDelFlag); + + CopyChar(pObject->_oBreak); + tbuff += 3; + + CopyInt(pObject->_oSolidFlag); + CopyInt(pObject->_oMissFlag); + + CopyChar(pObject->_oSelFlag); + tbuff += 3; + + CopyInt(pObject->_oPreFlag); + CopyInt(pObject->_oTrapFlag); + CopyInt(pObject->_oDoorFlag); + CopyInt(pObject->_olid); + CopyInt(pObject->_oRndSeed); + CopyInt(pObject->_oVar1); + CopyInt(pObject->_oVar2); + CopyInt(pObject->_oVar3); + CopyInt(pObject->_oVar4); + CopyInt(pObject->_oVar5); + CopyInt(pObject->_oVar6); + CopyInt(pObject->_oVar7); + CopyInt(pObject->_oVar8); } void LoadItem(int i) { - memcpy(&item[i], tbuff, sizeof(*item)); - tbuff += sizeof(*item); + CopyItem(&item[i]); GetItemFrm(i); } +void CopyItem(ItemStruct *pItem) +{ + CopyInt(pItem->_iSeed); + CopyShort(pItem->_iCreateInfo); + tbuff += 2; + CopyInt(pItem->_itype); + CopyInt(pItem->_ix); + CopyInt(pItem->_iy); + CopyInt(pItem->_iAnimFlag); + tbuff += 4; // Skip pointer _iAnimData + CopyInt(pItem->_iAnimLen); + CopyInt(pItem->_iAnimFrame); + CopyInt(pItem->_iAnimWidth); + CopyInt(pItem->_iAnimWidth2); // width 2? + CopyInt(pItem->_isin); // set when item is flagged for deletion, deprecated in 1.02 + CopyChar(pItem->_iSelFlag); + tbuff += 3; + CopyInt(pItem->_iPostDraw); + CopyInt(pItem->_iIdentified); + CopyChar(pItem->_iMagical); + CopyBytes(64, pItem->_iName); + CopyBytes(64, pItem->_iIName); + CopyChar(pItem->_iLoc); + CopyChar(pItem->_iClass); + tbuff += 1; + CopyInt(pItem->_iCurs); + CopyInt(pItem->_ivalue); + CopyInt(pItem->_iIvalue); + CopyInt(pItem->_iMinDam); + CopyInt(pItem->_iMaxDam); + CopyInt(pItem->_iAC); + CopyInt(pItem->_iFlags); + CopyInt(pItem->_iMiscId); + CopyInt(pItem->_iSpell); + CopyInt(pItem->_iCharges); + CopyInt(pItem->_iMaxCharges); + CopyInt(pItem->_iDurability); + CopyInt(pItem->_iMaxDur); + CopyInt(pItem->_iPLDam); + CopyInt(pItem->_iPLToHit); + CopyInt(pItem->_iPLAC); + CopyInt(pItem->_iPLStr); + CopyInt(pItem->_iPLMag); + CopyInt(pItem->_iPLDex); + CopyInt(pItem->_iPLVit); + CopyInt(pItem->_iPLFR); + CopyInt(pItem->_iPLLR); + CopyInt(pItem->_iPLMR); + CopyInt(pItem->_iPLMana); + CopyInt(pItem->_iPLHP); + CopyInt(pItem->_iPLDamMod); + CopyInt(pItem->_iPLGetHit); + CopyInt(pItem->_iPLLight); + CopyChar(pItem->_iSplLvlAdd); + CopyChar(pItem->_iRequest); + tbuff += 2; + CopyInt(pItem->_iUid); + CopyInt(pItem->_iFMinDam); + CopyInt(pItem->_iFMaxDam); + CopyInt(pItem->_iLMinDam); + CopyInt(pItem->_iLMaxDam); + CopyInt(pItem->_iPLEnAc); + CopyChar(pItem->_iPrePower); + CopyChar(pItem->_iSufPower); + tbuff += 2; + CopyInt(pItem->_iVAdd1); + CopyInt(pItem->_iVMult1); + CopyInt(pItem->_iVAdd2); + CopyInt(pItem->_iVMult2); + CopyChar(pItem->_iMinStr); + CopyChar(pItem->_iMinMag); + CopyChar(pItem->_iMinDex); + tbuff += 1; + CopyInt(pItem->_iStatFlag); + CopyInt(pItem->IDidx); + CopyInt(pItem->offs016C); +} + +void CopyItems(const int n, ItemStruct *pItem) +{ + for (int i = 0; i < n; i++) + { + CopyItem(&pItem[i]); + } +} + void LoadPremium(int i) { memcpy(&premiumitem[i], tbuff, sizeof(*premiumitem)); diff --git a/Source/loadsave.h b/Source/loadsave.h index 71309f5feda..3ddf9cead38 100644 --- a/Source/loadsave.h +++ b/Source/loadsave.h @@ -9,12 +9,15 @@ char BLoad(); int WLoad(); int ILoad(); BOOL OLoad(); +void CopyItems(const int n, ItemStruct *pItem); +void CopyItem(ItemStruct *pItem); + void LoadPlayer(int i); void LoadMonster(int i); void LoadMissile(int i); void LoadObject(int i); -void LoadItem(int i); -void LoadPremium(int i); +void LoadItem(int t); +void LoadPremium(int t); void LoadQuest(int i); void LoadLighting(int i); void LoadVision(int i); diff --git a/structs.h b/structs.h index 454bd94e1f3..6e9d86de1e6 100644 --- a/structs.h +++ b/structs.h @@ -1,3 +1,5 @@ +#pragma once + ////////////////////////////////////////////////// // control ////////////////////////////////////////////////// @@ -90,6 +92,7 @@ typedef struct ItemGetRecordStruct { unsigned int dwTimestamp; } ItemGetRecordStruct; +#pragma pack(push, 4) typedef struct ItemStruct { int _iSeed; WORD _iCreateInfo; @@ -164,15 +167,17 @@ typedef struct ItemStruct { int IDidx; int offs016C; // _oldlight or _iInvalid } ItemStruct; +#pragma pack(pop) ////////////////////////////////////////////////// // player ////////////////////////////////////////////////// -typedef struct PlayerStruct { +#pragma pack(push, 4) +typedef struct PlayerStruct { int _pmode; char walkpath[25]; - BOOLEAN plractive; + uint8_t plractive; int destAction; int destParam1; int destParam2; @@ -349,6 +354,7 @@ typedef struct PlayerStruct { unsigned char *_pBData; void *pReserved; } PlayerStruct; +#pragma pack(pop) ////////////////////////////////////////////////// // textdat @@ -398,6 +404,7 @@ typedef struct ChainStruct { int _mirange; } ChainStruct; +#pragma pack(push, 4) typedef struct MissileStruct { int _mitype; int _mix; @@ -444,6 +451,7 @@ typedef struct MissileStruct { int _miVar7; int _miVar8; } MissileStruct; +#pragma pack(pop) ////////////////////////////////////////////////// // effects/sound @@ -537,6 +545,7 @@ typedef struct CMonster { BYTE *trans_file; } CMonster; +#pragma pack(push, 4) typedef struct MonsterStruct { // note: missing field _mAFNum int _mMTidx; int _mmode; /* MON_MODE */ @@ -613,6 +622,7 @@ typedef struct MonsterStruct { // note: missing field _mAFNum CMonster *MType; MonsterData *MData; } MonsterStruct; +#pragma pack(pop) typedef struct UniqMonstStruct { char mtype; @@ -655,6 +665,7 @@ typedef struct ObjDataStruct { BOOL oTrapFlag; } ObjDataStruct; +#pragma pack(push, 4) typedef struct ObjectStruct { int _otype; int _ox; @@ -687,11 +698,13 @@ typedef struct ObjectStruct { int _oVar7; int _oVar8; } ObjectStruct; +#pragma pack(pop) ////////////////////////////////////////////////// // portal ////////////////////////////////////////////////// +#pragma pack(push, 4) typedef struct PortalStruct { BOOL open; int x; @@ -700,6 +713,7 @@ typedef struct PortalStruct { int ltype; BOOL setlvl; } PortalStruct; +#pragma pack(pop) ////////////////////////////////////////////////// // msg @@ -1174,6 +1188,7 @@ typedef struct InvXY { // lighting ////////////////////////////////////////////////// +#pragma pack(push, 4) typedef struct LightListStruct { int _lx; int _ly; @@ -1201,6 +1216,7 @@ typedef struct DeadStruct { int _deadWidth2; char _deadtrans; } DeadStruct; +#pragma pack(pop) ////////////////////////////////////////////////// // diabloui From 9c207f601d3fe9709f988501b7e68ad6e4097e74 Mon Sep 17 00:00:00 2001 From: Alex Sweet Date: Mon, 8 Jul 2019 04:47:52 -0700 Subject: [PATCH 29/42] Refactor packing functions --- Source/loadsave.cpp | 1087 +++++++++++++++++++++++++++---------------- Source/loadsave.h | 2 + 2 files changed, 688 insertions(+), 401 deletions(-) diff --git a/Source/loadsave.cpp b/Source/loadsave.cpp index f490f108530..510eb09788f 100644 --- a/Source/loadsave.cpp +++ b/Source/loadsave.cpp @@ -211,256 +211,461 @@ BOOL OLoad() } // Consume an int from tbuff with memcpy - copies directly, doesn't change byte order -void CopyInt(int & dst) +void CopyInt(const void *src, void * dst) { - memcpy(&dst, tbuff, 4); + memcpy(dst, src, 4); tbuff += 4; } -void CopyInt(unsigned int & dst) +/*void CopyInt(BYTE **src, unsigned int & dst) { - memcpy(&dst, tbuff, 4); + memcpy(&dst, src, 4); tbuff += 4; -} - -void CopyShort(unsigned short & dst) -{ - memcpy(&dst, tbuff, 2); - tbuff += 2; -} +}*/ -void CopyShort(short & dst) +void CopyShort(const void *src, void * dst) { - memcpy(&dst, tbuff, 2); + memcpy(dst, src, 2); tbuff += 2; } -void CopyShorts(const int n, unsigned short * dst) +void CopyShorts(const void *src, const int n, void * dst) { - memcpy(dst, tbuff, 2 * n); + memcpy(dst, src, 2 * n); tbuff += 2 * n; } // Copy an int array of size n -void CopyInts(const int n, int* dst) +void CopyInts(const void *src, const int n, void * dst) { - memcpy(dst, tbuff, 4 * n); + memcpy(dst, src, 4 * n); tbuff += 4 * n; } -void CopyBytes(const int n, unsigned char *dst) +void CopyBytes(const void *src, const int n, void * dst) { - memcpy(dst, tbuff, n); + memcpy(dst, src, n); tbuff += n; } -void CopyChar(unsigned char & dst) -{ - memcpy(&dst, tbuff, 1); - tbuff += 1; -} - -void CopyChar(char & dst) +void CopyChar(const void *src, void * dst) { - memcpy(&dst, tbuff, 1); + memcpy(&dst, src, 1); tbuff += 1; } -void CopyInt64(long long unsigned int & dst) +void CopyInt64(const void *src, void * dst) { - memcpy(&dst, tbuff, 8); + memcpy(&dst, src, 8); tbuff += 8; } void LoadPlayer(int i) { - PlayerStruct *pPlayer = &plr[i]; - CopyInt(pPlayer->_pmode); - CopyBytes(25, pPlayer->walkpath); - CopyBytes(1, &pPlayer->plractive); - tbuff += 2; // Some padding here? - CopyInt(pPlayer->destAction); - CopyInt(pPlayer->destParam1); - CopyInt(pPlayer->destParam2); - CopyInt(pPlayer->destParam3); - CopyInt(pPlayer->destParam4); - CopyInt(pPlayer->plrlevel); - CopyInt(pPlayer->WorldX); - CopyInt(pPlayer->WorldY); - CopyInt(pPlayer->_px); - CopyInt(pPlayer->_py); - CopyInt(pPlayer->_ptargx); - CopyInt(pPlayer->_ptargy); - CopyInt(pPlayer->_pownerx); - CopyInt(pPlayer->_pownery); - CopyInt(pPlayer->_poldx); - CopyInt(pPlayer->_poldy); - CopyInt(pPlayer->_pxoff); - CopyInt(pPlayer->_pyoff); - CopyInt(pPlayer->_pxvel); - CopyInt(pPlayer->_pyvel); - CopyInt(pPlayer->_pdir); - CopyInt(pPlayer->_nextdir); - CopyInt(pPlayer->_pgfxnum); + // Copy from tbuff to structures + PlayerStruct *pPlayer = &plr[i]; + + CopyInt(tbuff, &pPlayer->_pmode); + + CopyBytes(tbuff, 25, pPlayer->walkpath); + CopyBytes(tbuff, 1, &pPlayer->plractive); + tbuff += 2; + + CopyInt(tbuff, &pPlayer->destAction); + CopyInt(tbuff, &pPlayer->destParam1); + CopyInt(tbuff, &pPlayer->destParam2); + CopyInt(tbuff, &pPlayer->destParam3); + CopyInt(tbuff, &pPlayer->destParam4); + CopyInt(tbuff, &pPlayer->plrlevel); + CopyInt(tbuff, &pPlayer->WorldX); + CopyInt(tbuff, &pPlayer->WorldY); + CopyInt(tbuff, &pPlayer->_px); + CopyInt(tbuff, &pPlayer->_py); + CopyInt(tbuff, &pPlayer->_ptargx); + CopyInt(tbuff, &pPlayer->_ptargy); + CopyInt(tbuff, &pPlayer->_pownerx); + CopyInt(tbuff, &pPlayer->_pownery); + CopyInt(tbuff, &pPlayer->_poldx); + CopyInt(tbuff, &pPlayer->_poldy); + CopyInt(tbuff, &pPlayer->_pxoff); + CopyInt(tbuff, &pPlayer->_pyoff); + CopyInt(tbuff, &pPlayer->_pxvel); + CopyInt(tbuff, &pPlayer->_pyvel); + CopyInt(tbuff, &pPlayer->_pdir); + CopyInt(tbuff, &pPlayer->_nextdir); + CopyInt(tbuff, &pPlayer->_pgfxnum); tbuff += 4; // Skip pointers - CopyInt(pPlayer->_pAnimDelay); - CopyInt(pPlayer->_pAnimCnt); - CopyInt(pPlayer->_pAnimLen); - CopyInt(pPlayer->_pAnimFrame); - CopyInt(pPlayer->_pAnimWidth); - CopyInt(pPlayer->_pAnimWidth2); - CopyInt(pPlayer->_peflag); - CopyInt(pPlayer->_plid); - CopyInt(pPlayer->_pvid); - - CopyInt(pPlayer->_pSpell); - CopyChar(pPlayer->_pSplType); - CopyChar(pPlayer->_pSplFrom); - CopyInt(pPlayer->_pTSpell); - CopyChar(pPlayer->_pTSplType); + CopyInt(tbuff, &pPlayer->_pAnimDelay); + CopyInt(tbuff, &pPlayer->_pAnimCnt); + CopyInt(tbuff, &pPlayer->_pAnimLen); + CopyInt(tbuff, &pPlayer->_pAnimFrame); + CopyInt(tbuff, &pPlayer->_pAnimWidth); + CopyInt(tbuff, &pPlayer->_pAnimWidth2); + CopyInt(tbuff, &pPlayer->_peflag); + CopyInt(tbuff, &pPlayer->_plid); + CopyInt(tbuff, &pPlayer->_pvid); + + CopyInt(tbuff, &pPlayer->_pSpell); + CopyChar(tbuff, &pPlayer->_pSplType); + CopyChar(tbuff, &pPlayer->_pSplFrom); + CopyInt(tbuff, &pPlayer->_pTSpell); + CopyChar(tbuff, &pPlayer->_pTSplType); tbuff += 5; - CopyInt(pPlayer->_pRSpell); - CopyChar(pPlayer->_pRSplType); + CopyInt(tbuff, &pPlayer->_pRSpell); + CopyChar(tbuff, &pPlayer->_pRSplType); tbuff += 3; - CopyInt(pPlayer->_pSBkSpell); - CopyChar(pPlayer->_pSBkSplType); + CopyInt(tbuff, &pPlayer->_pSBkSpell); + CopyChar(tbuff, &pPlayer->_pSBkSplType); - CopyBytes(64, pPlayer->_pSplLvl); + CopyBytes(tbuff, 64, &pPlayer->_pSplLvl); tbuff += 7; - CopyInt64(pPlayer->_pMemSpells); - CopyInt64(pPlayer->_pAblSpells); - CopyInt64(pPlayer->_pScrlSpells); - CopyChar(pPlayer->_pSpellFlags); + CopyInt64(tbuff, &pPlayer->_pMemSpells); + CopyInt64(tbuff, &pPlayer->_pAblSpells); + CopyInt64(tbuff, &pPlayer->_pScrlSpells); + CopyChar(tbuff, &pPlayer->_pSpellFlags); tbuff += 3; - CopyInts(4, pPlayer->_pSplHotKey); - CopyBytes(4, pPlayer->_pSplTHotKey); - CopyInt(pPlayer->_pwtype); - CopyChar(pPlayer->_pBlockFlag); - CopyChar(pPlayer->_pInvincible); - CopyChar(pPlayer->_pLightRad); - CopyChar(pPlayer->_pLvlChanging); - CopyBytes(PLR_NAME_LEN, pPlayer->_pName); - CopyChar(pPlayer->_pClass); + CopyInts(tbuff, 4, &pPlayer->_pSplHotKey); + CopyBytes(tbuff, 4, &pPlayer->_pSplTHotKey); + CopyInt(tbuff, &pPlayer->_pwtype); + CopyChar(tbuff, &pPlayer->_pBlockFlag); + CopyChar(tbuff, &pPlayer->_pInvincible); + CopyChar(tbuff, &pPlayer->_pLightRad); + CopyChar(tbuff, &pPlayer->_pLvlChanging); + CopyBytes(tbuff, PLR_NAME_LEN, &pPlayer->_pName); + CopyChar(tbuff, &pPlayer->_pClass); tbuff += 3; - CopyInt(pPlayer->_pStrength); - CopyInt(pPlayer->_pBaseStr); - CopyInt(pPlayer->_pMagic); - CopyInt(pPlayer->_pBaseMag); - CopyInt(pPlayer->_pDexterity); - CopyInt(pPlayer->_pBaseDex); - CopyInt(pPlayer->_pVitality); - CopyInt(pPlayer->_pBaseVit); - CopyInt(pPlayer->_pStatPts); - CopyInt(pPlayer->_pDamageMod); - CopyInt(pPlayer->_pBaseToBlk); - CopyInt(pPlayer->_pHPBase); - CopyInt(pPlayer->_pMaxHPBase); - CopyInt(pPlayer->_pHitPoints); - CopyInt(pPlayer->_pMaxHP); - CopyInt(pPlayer->_pHPPer); - CopyInt(pPlayer->_pManaBase); - CopyInt(pPlayer->_pMaxManaBase); - CopyInt(pPlayer->_pMana); - CopyInt(pPlayer->_pMaxMana); - CopyInt(pPlayer->_pManaPer); - CopyChar(pPlayer->_pLevel); - CopyChar(pPlayer->_pMaxLvl); + CopyInt(tbuff, &pPlayer->_pStrength); + CopyInt(tbuff, &pPlayer->_pBaseStr); + CopyInt(tbuff, &pPlayer->_pMagic); + CopyInt(tbuff, &pPlayer->_pBaseMag); + CopyInt(tbuff, &pPlayer->_pDexterity); + CopyInt(tbuff, &pPlayer->_pBaseDex); + CopyInt(tbuff, &pPlayer->_pVitality); + CopyInt(tbuff, &pPlayer->_pBaseVit); + CopyInt(tbuff, &pPlayer->_pStatPts); + CopyInt(tbuff, &pPlayer->_pDamageMod); + CopyInt(tbuff, &pPlayer->_pBaseToBlk); + CopyInt(tbuff, &pPlayer->_pHPBase); + CopyInt(tbuff, &pPlayer->_pMaxHPBase); + CopyInt(tbuff, &pPlayer->_pHitPoints); + CopyInt(tbuff, &pPlayer->_pMaxHP); + CopyInt(tbuff, &pPlayer->_pHPPer); + CopyInt(tbuff, &pPlayer->_pManaBase); + CopyInt(tbuff, &pPlayer->_pMaxManaBase); + CopyInt(tbuff, &pPlayer->_pMana); + CopyInt(tbuff, &pPlayer->_pMaxMana); + CopyInt(tbuff, &pPlayer->_pManaPer); + CopyChar(tbuff, &pPlayer->_pLevel); + CopyChar(tbuff, &pPlayer->_pMaxLvl); tbuff += 2; - CopyInt(pPlayer->_pExperience); - CopyInt(pPlayer->_pMaxExp); - CopyInt(pPlayer->_pNextExper); - CopyChar(pPlayer->_pArmorClass); - CopyChar(pPlayer->_pMagResist); - CopyChar(pPlayer->_pFireResist); - CopyChar(pPlayer->_pLghtResist); - CopyInt(pPlayer->_pGold); - CopyInt(pPlayer->_pInfraFlag); - CopyInt(pPlayer->_pVar1); - CopyInt(pPlayer->_pVar2); - CopyInt(pPlayer->_pVar3); - CopyInt(pPlayer->_pVar4); - CopyInt(pPlayer->_pVar5); - CopyInt(pPlayer->_pVar6); - CopyInt(pPlayer->_pVar7); - CopyInt(pPlayer->_pVar8); - CopyBytes(NUMLEVELS, pPlayer->_pLvlVisited); - CopyBytes(NUMLEVELS, pPlayer->_pSLvlVisited); // only 10 used + CopyInt(tbuff, &pPlayer->_pExperience); + CopyInt(tbuff, &pPlayer->_pMaxExp); + CopyInt(tbuff, &pPlayer->_pNextExper); + CopyChar(tbuff, &pPlayer->_pArmorClass); + CopyChar(tbuff, &pPlayer->_pMagResist); + CopyChar(tbuff, &pPlayer->_pFireResist); + CopyChar(tbuff, &pPlayer->_pLghtResist); + CopyInt(tbuff, &pPlayer->_pGold); + CopyInt(tbuff, &pPlayer->_pInfraFlag); + CopyInt(tbuff, &pPlayer->_pVar1); + CopyInt(tbuff, &pPlayer->_pVar2); + CopyInt(tbuff, &pPlayer->_pVar3); + CopyInt(tbuff, &pPlayer->_pVar4); + CopyInt(tbuff, &pPlayer->_pVar5); + CopyInt(tbuff, &pPlayer->_pVar6); + CopyInt(tbuff, &pPlayer->_pVar7); + CopyInt(tbuff, &pPlayer->_pVar8); + CopyBytes(tbuff, NUMLEVELS, &pPlayer->_pLvlVisited); + CopyBytes(tbuff, NUMLEVELS, &pPlayer->_pSLvlVisited); // only 10 used tbuff += 2; - CopyInt(pPlayer->_pGFXLoad); + CopyInt(tbuff, &pPlayer->_pGFXLoad); tbuff += sizeof(__uint32_t) * 8; // Skip 8 pointers - CopyInt(pPlayer->_pNFrames); - CopyInt(pPlayer->_pNWidth); + CopyInt(tbuff, &pPlayer->_pNFrames); + CopyInt(tbuff, &pPlayer->_pNWidth); tbuff += sizeof(__uint32_t) * 8; // Skip 8 pointers - CopyInt(pPlayer->_pWFrames); - CopyInt(pPlayer->_pWWidth); + CopyInt(tbuff, &pPlayer->_pWFrames); + CopyInt(tbuff, &pPlayer->_pWWidth); tbuff += sizeof(__uint32_t) * 8; // Skip 8 pointers - CopyInt(pPlayer->_pAFrames); - CopyInt(pPlayer->_pAWidth); - CopyInt(pPlayer->_pAFNum); + CopyInt(tbuff, &pPlayer->_pAFrames); + CopyInt(tbuff, &pPlayer->_pAWidth); + CopyInt(tbuff, &pPlayer->_pAFNum); tbuff += sizeof(__uint32_t) * 24; // Skip 24 pointers - CopyInt(pPlayer->_pSFrames); - CopyInt(pPlayer->_pSWidth); - CopyInt(pPlayer->_pSFNum); + CopyInt(tbuff, &pPlayer->_pSFrames); + CopyInt(tbuff, &pPlayer->_pSWidth); + CopyInt(tbuff, &pPlayer->_pSFNum); tbuff += sizeof(__uint32_t) * 8; // Skip 8 pointers - CopyInt(pPlayer->_pHFrames); - CopyInt(pPlayer->_pHWidth); + CopyInt(tbuff, &pPlayer->_pHFrames); + CopyInt(tbuff, &pPlayer->_pHWidth); tbuff += sizeof(__uint32_t) * 8; // Skip 8 pointers - CopyInt(pPlayer->_pDFrames); - CopyInt(pPlayer->_pDWidth); + CopyInt(tbuff, &pPlayer->_pDFrames); + CopyInt(tbuff, &pPlayer->_pDWidth); tbuff += sizeof(__uint32_t) * 8; // Skip 8 pointers - CopyInt(pPlayer->_pBFrames); - CopyInt(pPlayer->_pBWidth); - + CopyInt(tbuff, &pPlayer->_pBFrames); + CopyInt(tbuff, &pPlayer->_pBWidth); CopyItems(NUM_INVLOC, pPlayer->InvBody); CopyItems(NUM_INV_GRID_ELEM, pPlayer->InvList); - - CopyInt(pPlayer->_pNumInv); - CopyBytes(NUM_INV_GRID_ELEM, pPlayer->InvGrid); + CopyInt(tbuff, &pPlayer->_pNumInv); + CopyBytes(tbuff, NUM_INV_GRID_ELEM, pPlayer->InvGrid); CopyItems(MAXBELTITEMS, pPlayer->SpdList); CopyItem(&pPlayer->HoldItem); - CopyInt(pPlayer->_pIMinDam); - CopyInt(pPlayer->_pIMaxDam); - CopyInt(pPlayer->_pIAC); - CopyInt(pPlayer->_pIBonusDam); - CopyInt(pPlayer->_pIBonusToHit); - CopyInt(pPlayer->_pIBonusAC); - CopyInt(pPlayer->_pIBonusDamMod); + CopyInt(tbuff, &pPlayer->_pIMinDam); + CopyInt(tbuff, &pPlayer->_pIMaxDam); + CopyInt(tbuff, &pPlayer->_pIAC); + CopyInt(tbuff, &pPlayer->_pIBonusDam); + CopyInt(tbuff, &pPlayer->_pIBonusToHit); + CopyInt(tbuff, &pPlayer->_pIBonusAC); + CopyInt(tbuff, &pPlayer->_pIBonusDamMod); + tbuff += 4; + CopyInt64(tbuff, &pPlayer->_pISpells); + CopyInt(tbuff, &pPlayer->_pIFlags); + CopyInt(tbuff, &pPlayer->_pIGetHit); + + CopyChar(tbuff, &pPlayer->_pISplLvlAdd); + CopyChar(tbuff, &pPlayer->_pISplCost); + tbuff += 2; + + CopyInt(tbuff, &pPlayer->_pISplDur); + CopyInt(tbuff, &pPlayer->_pIEnAc); + CopyInt(tbuff, &pPlayer->_pIFMinDam); + CopyInt(tbuff, &pPlayer->_pIFMaxDam); + CopyInt(tbuff, &pPlayer->_pILMinDam); + CopyInt(tbuff, &pPlayer->_pILMaxDam); + CopyInt(tbuff, &pPlayer->_pOilType); + + CopyChar(tbuff, &pPlayer->pTownWarps); + CopyChar(tbuff, &pPlayer->pDungMsgs); + CopyChar(tbuff, &pPlayer->pLvlLoad); + CopyChar(tbuff, &pPlayer->pBattleNet); + + CopyChar(tbuff, &pPlayer->pManaShield); + CopyBytes(tbuff, 3, &pPlayer->bReserved); + + CopyShorts(tbuff, 8, &pPlayer->wReserved); + + CopyInt(tbuff, &pPlayer->pDiabloKillLevel); + CopyInts(tbuff, 7, &pPlayer->dwReserved); + + // Omit 10 pointers + +} + +/*void SavePlayer(int i) +{ + memcpy(tbuff, &plr[i], sizeof(*plr) - (10 * sizeof(void *))); + tbuff += sizeof(*plr) - (10 * sizeof(void *)); // omit last 10 pointers +}*/ + + +void SavePlayer(int i) +{ + // Copy from tbuff to structures + PlayerStruct *pPlayer = &plr[i]; + + CopyInt(pPlayer->_pmode, tbuff); + + CopyBytes(pPlayer->walkpath, 25, tbuff); + CopyBytes(&pPlayer->plractive, 1, tbuff); + tbuff += 2; + + CopyInt(&pPlayer->destAction, tbuff); + CopyInt(&pPlayer->destParam1, tbuff); + CopyInt(&pPlayer->destParam2, tbuff); + CopyInt(&pPlayer->destParam3, tbuff); + CopyInt(&pPlayer->destParam4, tbuff); + CopyInt(&pPlayer->plrlevel, tbuff); + CopyInt(&pPlayer->WorldX, tbuff); + CopyInt(&pPlayer->WorldY, tbuff); + CopyInt(&pPlayer->_px, tbuff); + CopyInt(&pPlayer->_py, tbuff); + CopyInt(&pPlayer->_ptargx, tbuff); + CopyInt(&pPlayer->_ptargy, tbuff); + CopyInt(&pPlayer->_pownerx, tbuff); + CopyInt(&pPlayer->_pownery, tbuff); + CopyInt(&pPlayer->_poldx, tbuff); + CopyInt(&pPlayer->_poldy, tbuff); + CopyInt(&pPlayer->_pxoff, tbuff); + CopyInt(&pPlayer->_pyoff, tbuff); + CopyInt(&pPlayer->_pxvel, tbuff); + CopyInt(&pPlayer->_pyvel, tbuff); + CopyInt(&pPlayer->_pdir, tbuff); + CopyInt(&pPlayer->_nextdir, tbuff); + CopyInt(&pPlayer->_pgfxnum, tbuff); + tbuff += 4; // Skip pointers + CopyInt(&pPlayer->_pAnimDelay, tbuff); + CopyInt(&pPlayer->_pAnimCnt, tbuff); + CopyInt(&pPlayer->_pAnimLen, tbuff); + CopyInt(&pPlayer->_pAnimFrame, tbuff); + CopyInt(&pPlayer->_pAnimWidth, tbuff); + CopyInt(&pPlayer->_pAnimWidth2, tbuff); + CopyInt(&pPlayer->_peflag, tbuff); + CopyInt(&pPlayer->_plid, tbuff); + CopyInt(&pPlayer->_pvid, tbuff); + + CopyInt(&pPlayer->_pSpell, tbuff); + CopyChar(&pPlayer->_pSplType, tbuff); + CopyChar(&pPlayer->_pSplFrom, tbuff); + CopyInt(&pPlayer->_pTSpell, tbuff); + CopyChar(&pPlayer->_pTSplType, tbuff); + tbuff += 5; + CopyInt(&pPlayer->_pRSpell, tbuff); + CopyChar(&pPlayer->_pRSplType, tbuff); + tbuff += 3; + CopyInt(&pPlayer->_pSBkSpell, tbuff); + CopyChar(&pPlayer->_pSBkSplType, tbuff); + + CopyBytes(&pPlayer->_pSplLvl, 64, tbuff); + tbuff += 7; + CopyInt64(&pPlayer->_pMemSpells, tbuff); + CopyInt64(&pPlayer->_pAblSpells, tbuff); + CopyInt64(&pPlayer->_pScrlSpells, tbuff); + CopyChar(&pPlayer->_pSpellFlags, tbuff); + tbuff += 3; + CopyInts(&pPlayer->_pSplHotKey, 4, tbuff); + CopyBytes(&pPlayer->_pSplTHotKey, 4, tbuff); + CopyInt(&pPlayer->_pwtype, tbuff); + CopyChar(&pPlayer->_pBlockFlag, tbuff); + CopyChar(&pPlayer->_pInvincible, tbuff); + CopyChar(&pPlayer->_pLightRad, tbuff); + CopyChar(&pPlayer->_pLvlChanging, tbuff); + CopyBytes(&pPlayer->_pName, PLR_NAME_LEN, tbuff); + CopyChar(&pPlayer->_pClass, tbuff); + tbuff += 3; + CopyInt(&pPlayer->_pStrength, tbuff); + CopyInt(&pPlayer->_pBaseStr, tbuff); + CopyInt(&pPlayer->_pMagic, tbuff); + CopyInt(&pPlayer->_pBaseMag, tbuff); + CopyInt(&pPlayer->_pDexterity, tbuff); + CopyInt(&pPlayer->_pBaseDex, tbuff); + CopyInt(&pPlayer->_pVitality, tbuff); + CopyInt(&pPlayer->_pBaseVit, tbuff); + CopyInt(&pPlayer->_pStatPts, tbuff); + CopyInt(&pPlayer->_pDamageMod, tbuff); + CopyInt(&pPlayer->_pBaseToBlk, tbuff); + CopyInt(&pPlayer->_pHPBase, tbuff); + CopyInt(&pPlayer->_pMaxHPBase, tbuff); + CopyInt(&pPlayer->_pHitPoints, tbuff); + CopyInt(&pPlayer->_pMaxHP, tbuff); + CopyInt(&pPlayer->_pHPPer, tbuff); + CopyInt(&pPlayer->_pManaBase, tbuff); + CopyInt(&pPlayer->_pMaxManaBase, tbuff); + CopyInt(&pPlayer->_pMana, tbuff); + CopyInt(&pPlayer->_pMaxMana, tbuff); + CopyInt(&pPlayer->_pManaPer, tbuff); + CopyChar(&pPlayer->_pLevel, tbuff); + CopyChar(&pPlayer->_pMaxLvl, tbuff); + tbuff += 2; + CopyInt(&pPlayer->_pExperience, tbuff); + CopyInt(&pPlayer->_pMaxExp, tbuff); + CopyInt(&pPlayer->_pNextExper, tbuff); + CopyChar(&pPlayer->_pArmorClass, tbuff); + CopyChar(&pPlayer->_pMagResist, tbuff); + CopyChar(&pPlayer->_pFireResist, tbuff); + CopyChar(&pPlayer->_pLghtResist, tbuff); + CopyInt(&pPlayer->_pGold, tbuff); + CopyInt(&pPlayer->_pInfraFlag, tbuff); + CopyInt(&pPlayer->_pVar1, tbuff); + CopyInt(&pPlayer->_pVar2, tbuff); + CopyInt(&pPlayer->_pVar3, tbuff); + CopyInt(&pPlayer->_pVar4, tbuff); + CopyInt(&pPlayer->_pVar5, tbuff); + CopyInt(&pPlayer->_pVar6, tbuff); + CopyInt(&pPlayer->_pVar7, tbuff); + CopyInt(&pPlayer->_pVar8, tbuff); + CopyBytes(&pPlayer->_pLvlVisited, NUMLEVELS, tbuff); + CopyBytes(&pPlayer->_pSLvlVisited, NUMLEVELS, tbuff); // only 10 used + tbuff += 2; + CopyInt(&pPlayer->_pGFXLoad, tbuff); + + tbuff += sizeof(__uint32_t) * 8; // Skip 8 pointers + CopyInt(&pPlayer->_pNFrames, tbuff); + CopyInt(&pPlayer->_pNWidth, tbuff); + + tbuff += sizeof(__uint32_t) * 8; // Skip 8 pointers + + CopyInt(&pPlayer->_pWFrames, tbuff); + CopyInt(&pPlayer->_pWWidth, tbuff); + + tbuff += sizeof(__uint32_t) * 8; // Skip 8 pointers + + CopyInt(&pPlayer->_pAFrames, tbuff); + CopyInt(&pPlayer->_pAWidth, tbuff); + CopyInt(&pPlayer->_pAFNum, tbuff); + + tbuff += sizeof(__uint32_t) * 24; // Skip 24 pointers + + CopyInt(&pPlayer->_pSFrames, tbuff); + CopyInt(&pPlayer->_pSWidth, tbuff); + CopyInt(&pPlayer->_pSFNum, tbuff); + + tbuff += sizeof(__uint32_t) * 8; // Skip 8 pointers + + CopyInt(&pPlayer->_pHFrames, tbuff); + CopyInt(&pPlayer->_pHWidth, tbuff); + + tbuff += sizeof(__uint32_t) * 8; // Skip 8 pointers + + CopyInt(&pPlayer->_pDFrames, tbuff); + CopyInt(&pPlayer->_pDWidth, tbuff); + + tbuff += sizeof(__uint32_t) * 8; // Skip 8 pointers + + CopyInt(&pPlayer->_pBFrames, tbuff); + CopyInt(&pPlayer->_pBWidth, tbuff); + SaveItems(pPlayer->InvBody, NUM_INVLOC); + SaveItems(pPlayer->InvList, NUM_INV_GRID_ELEM); + CopyInt(&pPlayer->_pNumInv, tbuff); + CopyBytes(pPlayer->InvGrid, NUM_INV_GRID_ELEM, tbuff); + SaveItems(pPlayer->SpdList, MAXBELTITEMS); + SaveItem(&pPlayer->HoldItem); + CopyInt(&pPlayer->_pIMinDam, tbuff); + CopyInt(&pPlayer->_pIMaxDam, tbuff); + CopyInt(&pPlayer->_pIAC, tbuff); + CopyInt(&pPlayer->_pIBonusDam, tbuff); + CopyInt(&pPlayer->_pIBonusToHit, tbuff); + CopyInt(&pPlayer->_pIBonusAC, tbuff); + CopyInt(&pPlayer->_pIBonusDamMod, tbuff); tbuff += 4; - CopyInt64(pPlayer->_pISpells); - CopyInt(pPlayer->_pIFlags); - CopyInt(pPlayer->_pIGetHit); - CopyChar(pPlayer->_pISplLvlAdd); - CopyChar(pPlayer->_pISplCost); + CopyInt64(&pPlayer->_pISpells, tbuff); + CopyInt(&pPlayer->_pIFlags, tbuff); + CopyInt(&pPlayer->_pIGetHit, tbuff); + + CopyChar(&pPlayer->_pISplLvlAdd, tbuff); + CopyChar(&pPlayer->_pISplCost, tbuff); tbuff += 2; - CopyInt(pPlayer->_pISplDur); - CopyInt(pPlayer->_pIEnAc); - CopyInt(pPlayer->_pIFMinDam); - CopyInt(pPlayer->_pIFMaxDam); - CopyInt(pPlayer->_pILMinDam); - CopyInt(pPlayer->_pILMaxDam); - CopyInt(pPlayer->_pOilType); - CopyChar(pPlayer->pTownWarps); - CopyChar(pPlayer->pDungMsgs); - CopyChar(pPlayer->pLvlLoad); - CopyChar(pPlayer->pBattleNet); - CopyChar(pPlayer->pManaShield); - CopyBytes(3, pPlayer->bReserved); - CopyShorts(8, pPlayer->wReserved); - CopyInt(pPlayer->pDiabloKillLevel); - CopyInts(7, pPlayer->dwReserved); + + CopyInt(&pPlayer->_pISplDur, tbuff); + CopyInt(&pPlayer->_pIEnAc, tbuff); + CopyInt(&pPlayer->_pIFMinDam, tbuff); + CopyInt(&pPlayer->_pIFMaxDam, tbuff); + CopyInt(&pPlayer->_pILMinDam, tbuff); + CopyInt(&pPlayer->_pILMaxDam, tbuff); + CopyInt(&pPlayer->_pOilType, tbuff); + + CopyChar(&pPlayer->pTownWarps, tbuff); + CopyChar(&pPlayer->pDungMsgs, tbuff); + CopyChar(&pPlayer->pLvlLoad, tbuff); + CopyChar(&pPlayer->pBattleNet, tbuff); + + CopyChar(&pPlayer->pManaShield, tbuff); + CopyBytes(&pPlayer->bReserved, 3, tbuff); + + CopyShorts(&pPlayer->wReserved, 8, tbuff); + + CopyInt(tbuff, pPlayer->pDiabloKillLevel); + CopyInts(&pPlayer->dwReserved, 7, tbuff); // Omit 10 pointers @@ -470,99 +675,99 @@ void LoadMonster(int i) { MonsterStruct *pMonster = &monster[i]; - CopyInt(pMonster->_mMTidx); - CopyInt(pMonster->_mmode); + CopyInt(tbuff, &pMonster->_mMTidx); + CopyInt(tbuff, &pMonster->_mmode); - CopyChar(pMonster->_mgoal); + CopyChar(tbuff, &pMonster->_mgoal); tbuff += 3; - CopyInt(pMonster->_mgoalvar1); - CopyInt(pMonster->_mgoalvar2); - CopyInt(pMonster->_mgoalvar3); - CopyInt(pMonster->field_18); + CopyInt(tbuff, &pMonster->_mgoalvar1); + CopyInt(tbuff, &pMonster->_mgoalvar2); + CopyInt(tbuff, &pMonster->_mgoalvar3); + CopyInt(tbuff, &pMonster->field_18); - CopyChar(pMonster->_pathcount); + CopyChar(tbuff, &pMonster->_pathcount); tbuff += 3; - CopyInt(pMonster->_mx); - CopyInt(pMonster->_my); - CopyInt(pMonster->_mfutx); - CopyInt(pMonster->_mfuty); - CopyInt(pMonster->_moldx); - CopyInt(pMonster->_moldy); - CopyInt(pMonster->_mxoff); - CopyInt(pMonster->_myoff); - CopyInt(pMonster->_mxvel); - CopyInt(pMonster->_myvel); - CopyInt(pMonster->_mdir); - CopyInt(pMonster->_menemy); - - CopyChar(pMonster->_menemyx); - CopyChar(pMonster->_menemyy); - CopyShort(pMonster->falign_52); + CopyInt(tbuff, &pMonster->_mx); + CopyInt(tbuff, &pMonster->_my); + CopyInt(tbuff, &pMonster->_mfutx); + CopyInt(tbuff, &pMonster->_mfuty); + CopyInt(tbuff, &pMonster->_moldx); + CopyInt(tbuff, &pMonster->_moldy); + CopyInt(tbuff, &pMonster->_mxoff); + CopyInt(tbuff, &pMonster->_myoff); + CopyInt(tbuff, &pMonster->_mxvel); + CopyInt(tbuff, &pMonster->_myvel); + CopyInt(tbuff, &pMonster->_mdir); + CopyInt(tbuff, &pMonster->_menemy); + + CopyChar(tbuff, &pMonster->_menemyx); + CopyChar(tbuff, &pMonster->_menemyy); + CopyShort(tbuff, &pMonster->falign_52); tbuff += 4; // Skip pointer - CopyInt(pMonster->_mAnimDelay); - CopyInt(pMonster->_mAnimCnt); - CopyInt(pMonster->_mAnimLen); - CopyInt(pMonster->_mAnimFrame); - CopyInt(pMonster->_meflag); - CopyInt(pMonster->_mDelFlag); - CopyInt(pMonster->_mVar1); - CopyInt(pMonster->_mVar2); - CopyInt(pMonster->_mVar3); - CopyInt(pMonster->_mVar4); - CopyInt(pMonster->_mVar5); - CopyInt(pMonster->_mVar6); - CopyInt(pMonster->_mVar7); - CopyInt(pMonster->_mVar8); - CopyInt(pMonster->_mmaxhp); - CopyInt(pMonster->_mhitpoints); - - CopyChar(pMonster->_mAi); - CopyChar(pMonster->_mint); - CopyShort(pMonster->falign_9A); - - CopyInt(pMonster->_mFlags); - - CopyChar(pMonster->_msquelch); + CopyInt(tbuff, &pMonster->_mAnimDelay); + CopyInt(tbuff, &pMonster->_mAnimCnt); + CopyInt(tbuff, &pMonster->_mAnimLen); + CopyInt(tbuff, &pMonster->_mAnimFrame); + CopyInt(tbuff, &pMonster->_meflag); + CopyInt(tbuff, &pMonster->_mDelFlag); + CopyInt(tbuff, &pMonster->_mVar1); + CopyInt(tbuff, &pMonster->_mVar2); + CopyInt(tbuff, &pMonster->_mVar3); + CopyInt(tbuff, &pMonster->_mVar4); + CopyInt(tbuff, &pMonster->_mVar5); + CopyInt(tbuff, &pMonster->_mVar6); + CopyInt(tbuff, &pMonster->_mVar7); + CopyInt(tbuff, &pMonster->_mVar8); + CopyInt(tbuff, &pMonster->_mmaxhp); + CopyInt(tbuff, &pMonster->_mhitpoints); + + CopyChar(tbuff, &pMonster->_mAi); + CopyChar(tbuff, &pMonster->_mint); + CopyShort(tbuff, &pMonster->falign_9A); + + CopyInt(tbuff, &pMonster->_mFlags); + + CopyChar(tbuff, &pMonster->_msquelch); tbuff += 3; - CopyInt(pMonster->falign_A4); - CopyInt(pMonster->_lastx); - CopyInt(pMonster->_lasty); - CopyInt(pMonster->_mRndSeed); - CopyInt(pMonster->_mAISeed); - CopyInt(pMonster->falign_B8); + CopyInt(tbuff, &pMonster->falign_A4); + CopyInt(tbuff, &pMonster->_lastx); + CopyInt(tbuff, &pMonster->_lasty); + CopyInt(tbuff, &pMonster->_mRndSeed); + CopyInt(tbuff, &pMonster->_mAISeed); + CopyInt(tbuff, &pMonster->falign_B8); - CopyChar(pMonster->_uniqtype); - CopyChar(pMonster->_uniqtrans); - CopyChar(pMonster->_udeadval); - CopyChar(pMonster->mWhoHit); + CopyChar(tbuff, &pMonster->_uniqtype); + CopyChar(tbuff, &pMonster->_uniqtrans); + CopyChar(tbuff, &pMonster->_udeadval); + CopyChar(tbuff, &pMonster->mWhoHit); - CopyChar(pMonster->mLevel); - CopyShort(pMonster->mExp); + CopyChar(tbuff, &pMonster->mLevel); + CopyShort(tbuff, &pMonster->mExp); tbuff += 1; - CopyChar(pMonster->mHit); - CopyChar(pMonster->mMinDamage); - CopyChar(pMonster->mMaxDamage); - CopyChar(pMonster->mHit2); + CopyChar(tbuff, &pMonster->mHit); + CopyChar(tbuff, &pMonster->mMinDamage); + CopyChar(tbuff, &pMonster->mMaxDamage); + CopyChar(tbuff, &pMonster->mHit2); - CopyChar(pMonster->mMinDamage2); - CopyChar(pMonster->mMaxDamage2); - CopyChar(pMonster->mArmorClass); - CopyChar(pMonster->falign_CB); + CopyChar(tbuff, &pMonster->mMinDamage2); + CopyChar(tbuff, &pMonster->mMaxDamage2); + CopyChar(tbuff, &pMonster->mArmorClass); + CopyChar(tbuff, &pMonster->falign_CB); - CopyShort(pMonster->mMagicRes); + CopyShort(tbuff, &pMonster->mMagicRes); tbuff += 2; - CopyInt(pMonster->mtalkmsg); + CopyInt(tbuff, &pMonster->mtalkmsg); - CopyChar(pMonster->leader); - CopyChar(pMonster->leaderflag); - CopyChar(pMonster->packsize); - CopyChar(pMonster->mlid); + CopyChar(tbuff, &pMonster->leader); + CopyChar(tbuff, &pMonster->leaderflag); + CopyChar(tbuff, &pMonster->packsize); + CopyChar(tbuff, &pMonster->mlid); SyncMonsterAnim(i); } @@ -571,93 +776,93 @@ void LoadMissile(int i) { MissileStruct *pMissile = &missile[i]; - CopyInt(pMissile->_mitype); - CopyInt(pMissile->_mix); - CopyInt(pMissile->_miy); - CopyInt(pMissile->_mixoff); - CopyInt(pMissile->_miyoff); - CopyInt(pMissile->_mixvel); - CopyInt(pMissile->_miyvel); - CopyInt(pMissile->_misx); - CopyInt(pMissile->_misy); - CopyInt(pMissile->_mitxoff); - CopyInt(pMissile->_mityoff); - CopyInt(pMissile->_mimfnum); - CopyInt(pMissile->_mispllvl); - CopyInt(pMissile->_miDelFlag); - CopyChar(pMissile->_miAnimType); + CopyInt(tbuff, &pMissile->_mitype); + CopyInt(tbuff, &pMissile->_mix); + CopyInt(tbuff, &pMissile->_miy); + CopyInt(tbuff, &pMissile->_mixoff); + CopyInt(tbuff, &pMissile->_miyoff); + CopyInt(tbuff, &pMissile->_mixvel); + CopyInt(tbuff, &pMissile->_miyvel); + CopyInt(tbuff, &pMissile->_misx); + CopyInt(tbuff, &pMissile->_misy); + CopyInt(tbuff, &pMissile->_mitxoff); + CopyInt(tbuff, &pMissile->_mityoff); + CopyInt(tbuff, &pMissile->_mimfnum); + CopyInt(tbuff, &pMissile->_mispllvl); + CopyInt(tbuff, &pMissile->_miDelFlag); + CopyChar(tbuff, &pMissile->_miAnimType); tbuff += 3; - CopyInt(pMissile->_miAnimFlags); + CopyInt(tbuff, &pMissile->_miAnimFlags); tbuff += 4; - CopyInt(pMissile->_miAnimDelay); - CopyInt(pMissile->_miAnimLen); - CopyInt(pMissile->_miAnimWidth); - CopyInt(pMissile->_miAnimWidth2); - CopyInt(pMissile->_miAnimCnt); - CopyInt(pMissile->_miAnimAdd); - CopyInt(pMissile->_miAnimFrame); - CopyInt(pMissile->_miDrawFlag); - CopyInt(pMissile->_miLightFlag); - CopyInt(pMissile->_miPreFlag); - CopyInt(pMissile->_miUniqTrans); - CopyInt(pMissile->_mirange); - CopyInt(pMissile->_misource); - CopyInt(pMissile->_micaster); - CopyInt(pMissile->_midam); - CopyInt(pMissile->_miHitFlag); - CopyInt(pMissile->_midist); - CopyInt(pMissile->_mlid); - CopyInt(pMissile->_mirnd); - CopyInt(pMissile->_miVar1); - CopyInt(pMissile->_miVar2); - CopyInt(pMissile->_miVar3); - CopyInt(pMissile->_miVar4); - CopyInt(pMissile->_miVar5); - CopyInt(pMissile->_miVar6); - CopyInt(pMissile->_miVar7); - CopyInt(pMissile->_miVar8); + CopyInt(tbuff, &pMissile->_miAnimDelay); + CopyInt(tbuff, &pMissile->_miAnimLen); + CopyInt(tbuff, &pMissile->_miAnimWidth); + CopyInt(tbuff, &pMissile->_miAnimWidth2); + CopyInt(tbuff, &pMissile->_miAnimCnt); + CopyInt(tbuff, &pMissile->_miAnimAdd); + CopyInt(tbuff, &pMissile->_miAnimFrame); + CopyInt(tbuff, &pMissile->_miDrawFlag); + CopyInt(tbuff, &pMissile->_miLightFlag); + CopyInt(tbuff, &pMissile->_miPreFlag); + CopyInt(tbuff, &pMissile->_miUniqTrans); + CopyInt(tbuff, &pMissile->_mirange); + CopyInt(tbuff, &pMissile->_misource); + CopyInt(tbuff, &pMissile->_micaster); + CopyInt(tbuff, &pMissile->_midam); + CopyInt(tbuff, &pMissile->_miHitFlag); + CopyInt(tbuff, &pMissile->_midist); + CopyInt(tbuff, &pMissile->_mlid); + CopyInt(tbuff, &pMissile->_mirnd); + CopyInt(tbuff, &pMissile->_miVar1); + CopyInt(tbuff, &pMissile->_miVar2); + CopyInt(tbuff, &pMissile->_miVar3); + CopyInt(tbuff, &pMissile->_miVar4); + CopyInt(tbuff, &pMissile->_miVar5); + CopyInt(tbuff, &pMissile->_miVar6); + CopyInt(tbuff, &pMissile->_miVar7); + CopyInt(tbuff, &pMissile->_miVar8); } void LoadObject(int i) { ObjectStruct *pObject = &object[i]; - CopyInt(pObject->_otype); - CopyInt(pObject->_ox); - CopyInt(pObject->_oy); - CopyInt(pObject->_oLight); - CopyInt(pObject->_oAnimFlag); + CopyInt(tbuff, &pObject->_otype); + CopyInt(tbuff, &pObject->_ox); + CopyInt(tbuff, &pObject->_oy); + CopyInt(tbuff, &pObject->_oLight); + CopyInt(tbuff, &pObject->_oAnimFlag); tbuff += 4; - CopyInt(pObject->_oAnimDelay); - CopyInt(pObject->_oAnimCnt); - CopyInt(pObject->_oAnimLen); - CopyInt(pObject->_oAnimFrame); - CopyInt(pObject->_oAnimWidth); - CopyInt(pObject->_oAnimWidth2); - CopyInt(pObject->_oDelFlag); - - CopyChar(pObject->_oBreak); + CopyInt(tbuff, &pObject->_oAnimDelay); + CopyInt(tbuff, &pObject->_oAnimCnt); + CopyInt(tbuff, &pObject->_oAnimLen); + CopyInt(tbuff, &pObject->_oAnimFrame); + CopyInt(tbuff, &pObject->_oAnimWidth); + CopyInt(tbuff, &pObject->_oAnimWidth2); + CopyInt(tbuff, &pObject->_oDelFlag); + + CopyChar(tbuff, &pObject->_oBreak); tbuff += 3; - CopyInt(pObject->_oSolidFlag); - CopyInt(pObject->_oMissFlag); + CopyInt(tbuff, &pObject->_oSolidFlag); + CopyInt(tbuff, &pObject->_oMissFlag); - CopyChar(pObject->_oSelFlag); + CopyChar(tbuff, &pObject->_oSelFlag); tbuff += 3; - CopyInt(pObject->_oPreFlag); - CopyInt(pObject->_oTrapFlag); - CopyInt(pObject->_oDoorFlag); - CopyInt(pObject->_olid); - CopyInt(pObject->_oRndSeed); - CopyInt(pObject->_oVar1); - CopyInt(pObject->_oVar2); - CopyInt(pObject->_oVar3); - CopyInt(pObject->_oVar4); - CopyInt(pObject->_oVar5); - CopyInt(pObject->_oVar6); - CopyInt(pObject->_oVar7); - CopyInt(pObject->_oVar8); + CopyInt(tbuff, &pObject->_oPreFlag); + CopyInt(tbuff, &pObject->_oTrapFlag); + CopyInt(tbuff, &pObject->_oDoorFlag); + CopyInt(tbuff, &pObject->_olid); + CopyInt(tbuff, &pObject->_oRndSeed); + CopyInt(tbuff, &pObject->_oVar1); + CopyInt(tbuff, &pObject->_oVar2); + CopyInt(tbuff, &pObject->_oVar3); + CopyInt(tbuff, &pObject->_oVar4); + CopyInt(tbuff, &pObject->_oVar5); + CopyInt(tbuff, &pObject->_oVar6); + CopyInt(tbuff, &pObject->_oVar7); + CopyInt(tbuff, &pObject->_oVar8); } void LoadItem(int i) @@ -668,80 +873,80 @@ void LoadItem(int i) void CopyItem(ItemStruct *pItem) { - CopyInt(pItem->_iSeed); - CopyShort(pItem->_iCreateInfo); + CopyInt(tbuff, &pItem->_iSeed); + CopyShort(tbuff, &pItem->_iCreateInfo); tbuff += 2; - CopyInt(pItem->_itype); - CopyInt(pItem->_ix); - CopyInt(pItem->_iy); - CopyInt(pItem->_iAnimFlag); + CopyInt(tbuff, &pItem->_itype); + CopyInt(tbuff, &pItem->_ix); + CopyInt(tbuff, &pItem->_iy); + CopyInt(tbuff, &pItem->_iAnimFlag); tbuff += 4; // Skip pointer _iAnimData - CopyInt(pItem->_iAnimLen); - CopyInt(pItem->_iAnimFrame); - CopyInt(pItem->_iAnimWidth); - CopyInt(pItem->_iAnimWidth2); // width 2? - CopyInt(pItem->_isin); // set when item is flagged for deletion, deprecated in 1.02 - CopyChar(pItem->_iSelFlag); + CopyInt(tbuff, &pItem->_iAnimLen); + CopyInt(tbuff, &pItem->_iAnimFrame); + CopyInt(tbuff, &pItem->_iAnimWidth); + CopyInt(tbuff, &pItem->_iAnimWidth2); // width 2? + CopyInt(tbuff, &pItem->_isin); // set when item is flagged for deletion, deprecated in 1.02 + CopyChar(tbuff, &pItem->_iSelFlag); tbuff += 3; - CopyInt(pItem->_iPostDraw); - CopyInt(pItem->_iIdentified); - CopyChar(pItem->_iMagical); - CopyBytes(64, pItem->_iName); - CopyBytes(64, pItem->_iIName); - CopyChar(pItem->_iLoc); - CopyChar(pItem->_iClass); + CopyInt(tbuff, &pItem->_iPostDraw); + CopyInt(tbuff, &pItem->_iIdentified); + CopyChar(tbuff, &pItem->_iMagical); + CopyBytes(tbuff, 64, &pItem->_iName); + CopyBytes(tbuff, 64, &pItem->_iIName); + CopyChar(tbuff, &pItem->_iLoc); + CopyChar(tbuff, &pItem->_iClass); tbuff += 1; - CopyInt(pItem->_iCurs); - CopyInt(pItem->_ivalue); - CopyInt(pItem->_iIvalue); - CopyInt(pItem->_iMinDam); - CopyInt(pItem->_iMaxDam); - CopyInt(pItem->_iAC); - CopyInt(pItem->_iFlags); - CopyInt(pItem->_iMiscId); - CopyInt(pItem->_iSpell); - CopyInt(pItem->_iCharges); - CopyInt(pItem->_iMaxCharges); - CopyInt(pItem->_iDurability); - CopyInt(pItem->_iMaxDur); - CopyInt(pItem->_iPLDam); - CopyInt(pItem->_iPLToHit); - CopyInt(pItem->_iPLAC); - CopyInt(pItem->_iPLStr); - CopyInt(pItem->_iPLMag); - CopyInt(pItem->_iPLDex); - CopyInt(pItem->_iPLVit); - CopyInt(pItem->_iPLFR); - CopyInt(pItem->_iPLLR); - CopyInt(pItem->_iPLMR); - CopyInt(pItem->_iPLMana); - CopyInt(pItem->_iPLHP); - CopyInt(pItem->_iPLDamMod); - CopyInt(pItem->_iPLGetHit); - CopyInt(pItem->_iPLLight); - CopyChar(pItem->_iSplLvlAdd); - CopyChar(pItem->_iRequest); + CopyInt(tbuff, &pItem->_iCurs); + CopyInt(tbuff, &pItem->_ivalue); + CopyInt(tbuff, &pItem->_iIvalue); + CopyInt(tbuff, &pItem->_iMinDam); + CopyInt(tbuff, &pItem->_iMaxDam); + CopyInt(tbuff, &pItem->_iAC); + CopyInt(tbuff, &pItem->_iFlags); + CopyInt(tbuff, &pItem->_iMiscId); + CopyInt(tbuff, &pItem->_iSpell); + CopyInt(tbuff, &pItem->_iCharges); + CopyInt(tbuff, &pItem->_iMaxCharges); + CopyInt(tbuff, &pItem->_iDurability); + CopyInt(tbuff, &pItem->_iMaxDur); + CopyInt(tbuff, &pItem->_iPLDam); + CopyInt(tbuff, &pItem->_iPLToHit); + CopyInt(tbuff, &pItem->_iPLAC); + CopyInt(tbuff, &pItem->_iPLStr); + CopyInt(tbuff, &pItem->_iPLMag); + CopyInt(tbuff, &pItem->_iPLDex); + CopyInt(tbuff, &pItem->_iPLVit); + CopyInt(tbuff, &pItem->_iPLFR); + CopyInt(tbuff, &pItem->_iPLLR); + CopyInt(tbuff, &pItem->_iPLMR); + CopyInt(tbuff, &pItem->_iPLMana); + CopyInt(tbuff, &pItem->_iPLHP); + CopyInt(tbuff, &pItem->_iPLDamMod); + CopyInt(tbuff, &pItem->_iPLGetHit); + CopyInt(tbuff, &pItem->_iPLLight); + CopyChar(tbuff, &pItem->_iSplLvlAdd); + CopyChar(tbuff, &pItem->_iRequest); tbuff += 2; - CopyInt(pItem->_iUid); - CopyInt(pItem->_iFMinDam); - CopyInt(pItem->_iFMaxDam); - CopyInt(pItem->_iLMinDam); - CopyInt(pItem->_iLMaxDam); - CopyInt(pItem->_iPLEnAc); - CopyChar(pItem->_iPrePower); - CopyChar(pItem->_iSufPower); + CopyInt(tbuff, &pItem->_iUid); + CopyInt(tbuff, &pItem->_iFMinDam); + CopyInt(tbuff, &pItem->_iFMaxDam); + CopyInt(tbuff, &pItem->_iLMinDam); + CopyInt(tbuff, &pItem->_iLMaxDam); + CopyInt(tbuff, &pItem->_iPLEnAc); + CopyChar(tbuff, &pItem->_iPrePower); + CopyChar(tbuff, &pItem->_iSufPower); tbuff += 2; - CopyInt(pItem->_iVAdd1); - CopyInt(pItem->_iVMult1); - CopyInt(pItem->_iVAdd2); - CopyInt(pItem->_iVMult2); - CopyChar(pItem->_iMinStr); - CopyChar(pItem->_iMinMag); - CopyChar(pItem->_iMinDex); + CopyInt(tbuff, &pItem->_iVAdd1); + CopyInt(tbuff, &pItem->_iVMult1); + CopyInt(tbuff, &pItem->_iVAdd2); + CopyInt(tbuff, &pItem->_iVMult2); + CopyChar(tbuff, &pItem->_iMinStr); + CopyChar(tbuff, &pItem->_iMinMag); + CopyChar(tbuff, &pItem->_iMinDex); tbuff += 1; - CopyInt(pItem->_iStatFlag); - CopyInt(pItem->IDidx); - CopyInt(pItem->offs016C); + CopyInt(tbuff, &pItem->_iStatFlag); + CopyInt(tbuff, &pItem->IDidx); + CopyInt(tbuff, &pItem->offs016C); } void CopyItems(const int n, ItemStruct *pItem) @@ -752,6 +957,92 @@ void CopyItems(const int n, ItemStruct *pItem) } } +void SaveItem(ItemStruct *pItem) +{ + CopyInt(&pItem->_iSeed, tbuff); + CopyShort(&pItem->_iCreateInfo, tbuff); + tbuff += 2; + CopyInt(&pItem->_itype, tbuff); + CopyInt(&pItem->_ix, tbuff); + CopyInt(&pItem->_iy, tbuff); + CopyInt(&pItem->_iAnimFlag, tbuff); + tbuff += 4; // Skip pointer _iAnimData + CopyInt(&pItem->_iAnimLen, tbuff); + CopyInt(&pItem->_iAnimFrame, tbuff); + CopyInt(&pItem->_iAnimWidth, tbuff); + CopyInt(&pItem->_iAnimWidth2, tbuff); // width 2? + CopyInt(&pItem->_isin, tbuff); // set when item is flagged for deletion, deprecated in 1.02 + CopyChar(&pItem->_iSelFlag, tbuff); + tbuff += 3; + CopyInt(&pItem->_iPostDraw, tbuff); + CopyInt(&pItem->_iIdentified, tbuff); + CopyChar(&pItem->_iMagical, tbuff); + CopyBytes(&pItem->_iName, 64, tbuff); + CopyBytes(&pItem->_iIName, 64, tbuff); + CopyChar(&pItem->_iLoc, tbuff); + CopyChar(&pItem->_iClass, tbuff); + tbuff += 1; + CopyInt(&pItem->_iCurs, tbuff); + CopyInt(&pItem->_ivalue, tbuff); + CopyInt(&pItem->_iIvalue, tbuff); + CopyInt(&pItem->_iMinDam, tbuff); + CopyInt(&pItem->_iMaxDam, tbuff); + CopyInt(&pItem->_iAC, tbuff); + CopyInt(&pItem->_iFlags, tbuff); + CopyInt(&pItem->_iMiscId, tbuff); + CopyInt(&pItem->_iSpell, tbuff); + CopyInt(&pItem->_iCharges, tbuff); + CopyInt(&pItem->_iMaxCharges, tbuff); + CopyInt(&pItem->_iDurability, tbuff); + CopyInt(&pItem->_iMaxDur, tbuff); + CopyInt(&pItem->_iPLDam, tbuff); + CopyInt(&pItem->_iPLToHit, tbuff); + CopyInt(&pItem->_iPLAC, tbuff); + CopyInt(&pItem->_iPLStr, tbuff); + CopyInt(&pItem->_iPLMag, tbuff); + CopyInt(&pItem->_iPLDex, tbuff); + CopyInt(&pItem->_iPLVit, tbuff); + CopyInt(&pItem->_iPLFR, tbuff); + CopyInt(&pItem->_iPLLR, tbuff); + CopyInt(&pItem->_iPLMR, tbuff); + CopyInt(&pItem->_iPLMana, tbuff); + CopyInt(&pItem->_iPLHP, tbuff); + CopyInt(&pItem->_iPLDamMod, tbuff); + CopyInt(&pItem->_iPLGetHit, tbuff); + CopyInt(&pItem->_iPLLight, tbuff); + CopyChar(&pItem->_iSplLvlAdd, tbuff); + CopyChar(&pItem->_iRequest, tbuff); + tbuff += 2; + CopyInt(&pItem->_iUid, tbuff); + CopyInt(&pItem->_iFMinDam, tbuff); + CopyInt(&pItem->_iFMaxDam, tbuff); + CopyInt(&pItem->_iLMinDam, tbuff); + CopyInt(&pItem->_iLMaxDam, tbuff); + CopyInt(&pItem->_iPLEnAc, tbuff); + CopyChar(&pItem->_iPrePower, tbuff); + CopyChar(&pItem->_iSufPower, tbuff); + tbuff += 2; + CopyInt(&pItem->_iVAdd1, tbuff); + CopyInt(&pItem->_iVMult1, tbuff); + CopyInt(&pItem->_iVAdd2, tbuff); + CopyInt(&pItem->_iVMult2, tbuff); + CopyChar(&pItem->_iMinStr, tbuff); + CopyChar(&pItem->_iMinMag, tbuff); + CopyChar(&pItem->_iMinDex, tbuff); + tbuff += 1; + CopyInt(&pItem->_iStatFlag, tbuff); + CopyInt(&pItem->IDidx, tbuff); + CopyInt(&pItem->offs016C, tbuff); +} + +void SaveItems(ItemStruct *pItem, const int n) +{ + for (int i = 0; i < n; i++) + { + SaveItem(&pItem[i]); + } +} + void LoadPremium(int i) { memcpy(&premiumitem[i], tbuff, sizeof(*premiumitem)); @@ -959,12 +1250,6 @@ void OSave(BOOL v) *tbuff++ = FALSE; } -void SavePlayer(int i) -{ - memcpy(tbuff, &plr[i], sizeof(*plr) - (10 * sizeof(void *))); - tbuff += sizeof(*plr) - (10 * sizeof(void *)); // omit last 10 pointers -} - void SaveMonster(int i) { memcpy(tbuff, &monster[i], sizeof(*monster) - (3 * sizeof(void *))); diff --git a/Source/loadsave.h b/Source/loadsave.h index 3ddf9cead38..3d04e987670 100644 --- a/Source/loadsave.h +++ b/Source/loadsave.h @@ -11,6 +11,8 @@ int ILoad(); BOOL OLoad(); void CopyItems(const int n, ItemStruct *pItem); void CopyItem(ItemStruct *pItem); +void SaveItem(ItemStruct *pItem); +void SaveItems(ItemStruct *pItem, const int n); void LoadPlayer(int i); void LoadMonster(int i); From 356f0361f919a1440dc3942a3beb1336236b357d Mon Sep 17 00:00:00 2001 From: Alex Sweet Date: Mon, 8 Jul 2019 06:39:05 -0700 Subject: [PATCH 30/42] Bufix - pointers --- Source/loadsave.cpp | 258 ++++++++++++++++++++++++++++++++++---------- 1 file changed, 204 insertions(+), 54 deletions(-) diff --git a/Source/loadsave.cpp b/Source/loadsave.cpp index 510eb09788f..dd057ff0fbd 100644 --- a/Source/loadsave.cpp +++ b/Source/loadsave.cpp @@ -174,13 +174,11 @@ void LoadGame(BOOL firstflag) gbProcessPlayers = TRUE; } -// Load a byte-size char from the buffer char BLoad() { return *tbuff++; } -// Redundant? int WLoad() { int rv = *tbuff++ << 24; @@ -191,7 +189,6 @@ int WLoad() return rv; } -// Load a 32 bit integer from the buffer int ILoad() { int rv = *tbuff++ << 24; @@ -210,19 +207,12 @@ BOOL OLoad() return FALSE; } -// Consume an int from tbuff with memcpy - copies directly, doesn't change byte order void CopyInt(const void *src, void * dst) { memcpy(dst, src, 4); tbuff += 4; } -/*void CopyInt(BYTE **src, unsigned int & dst) -{ - memcpy(&dst, src, 4); - tbuff += 4; -}*/ - void CopyShort(const void *src, void * dst) { memcpy(dst, src, 2); @@ -235,7 +225,6 @@ void CopyShorts(const void *src, const int n, void * dst) tbuff += 2 * n; } -// Copy an int array of size n void CopyInts(const void *src, const int n, void * dst) { memcpy(dst, src, 4 * n); @@ -250,19 +239,18 @@ void CopyBytes(const void *src, const int n, void * dst) void CopyChar(const void *src, void * dst) { - memcpy(&dst, src, 1); + memcpy(dst, src, 1); tbuff += 1; } void CopyInt64(const void *src, void * dst) { - memcpy(&dst, src, 8); + memcpy(dst, src, 8); tbuff += 8; } void LoadPlayer(int i) { - // Copy from tbuff to structures PlayerStruct *pPlayer = &plr[i]; CopyInt(tbuff, &pPlayer->_pmode); @@ -308,9 +296,10 @@ void LoadPlayer(int i) CopyInt(tbuff, &pPlayer->_pSpell); CopyChar(tbuff, &pPlayer->_pSplType); CopyChar(tbuff, &pPlayer->_pSplFrom); + tbuff += 2; CopyInt(tbuff, &pPlayer->_pTSpell); CopyChar(tbuff, &pPlayer->_pTSplType); - tbuff += 5; + tbuff += 3; CopyInt(tbuff, &pPlayer->_pRSpell); CopyChar(tbuff, &pPlayer->_pRSplType); tbuff += 3; @@ -376,42 +365,42 @@ void LoadPlayer(int i) CopyInt(tbuff, &pPlayer->_pVar7); CopyInt(tbuff, &pPlayer->_pVar8); CopyBytes(tbuff, NUMLEVELS, &pPlayer->_pLvlVisited); - CopyBytes(tbuff, NUMLEVELS, &pPlayer->_pSLvlVisited); // only 10 used + CopyBytes(tbuff, NUMLEVELS, &pPlayer->_pSLvlVisited); tbuff += 2; CopyInt(tbuff, &pPlayer->_pGFXLoad); - tbuff += sizeof(__uint32_t) * 8; // Skip 8 pointers + tbuff += sizeof(__uint32_t) * 8; CopyInt(tbuff, &pPlayer->_pNFrames); CopyInt(tbuff, &pPlayer->_pNWidth); - tbuff += sizeof(__uint32_t) * 8; // Skip 8 pointers + tbuff += sizeof(__uint32_t) * 8 CopyInt(tbuff, &pPlayer->_pWFrames); CopyInt(tbuff, &pPlayer->_pWWidth); - tbuff += sizeof(__uint32_t) * 8; // Skip 8 pointers + tbuff += sizeof(__uint32_t) * 8; CopyInt(tbuff, &pPlayer->_pAFrames); CopyInt(tbuff, &pPlayer->_pAWidth); CopyInt(tbuff, &pPlayer->_pAFNum); - tbuff += sizeof(__uint32_t) * 24; // Skip 24 pointers + tbuff += sizeof(__uint32_t) * 24; CopyInt(tbuff, &pPlayer->_pSFrames); CopyInt(tbuff, &pPlayer->_pSWidth); CopyInt(tbuff, &pPlayer->_pSFNum); - tbuff += sizeof(__uint32_t) * 8; // Skip 8 pointers + tbuff += sizeof(__uint32_t) * 8; CopyInt(tbuff, &pPlayer->_pHFrames); CopyInt(tbuff, &pPlayer->_pHWidth); - tbuff += sizeof(__uint32_t) * 8; // Skip 8 pointers + tbuff += sizeof(__uint32_t) * 8; CopyInt(tbuff, &pPlayer->_pDFrames); CopyInt(tbuff, &pPlayer->_pDWidth); - tbuff += sizeof(__uint32_t) * 8; // Skip 8 pointers + tbuff += sizeof(__uint32_t) * 8; CopyInt(tbuff, &pPlayer->_pBFrames); CopyInt(tbuff, &pPlayer->_pBWidth); @@ -462,21 +451,13 @@ void LoadPlayer(int i) } -/*void SavePlayer(int i) -{ - memcpy(tbuff, &plr[i], sizeof(*plr) - (10 * sizeof(void *))); - tbuff += sizeof(*plr) - (10 * sizeof(void *)); // omit last 10 pointers -}*/ - - void SavePlayer(int i) { - // Copy from tbuff to structures PlayerStruct *pPlayer = &plr[i]; - CopyInt(pPlayer->_pmode, tbuff); + CopyInt(&pPlayer->_pmode, tbuff); - CopyBytes(pPlayer->walkpath, 25, tbuff); + CopyBytes(&pPlayer->walkpath, 25, tbuff); CopyBytes(&pPlayer->plractive, 1, tbuff); tbuff += 2; @@ -515,11 +496,14 @@ void SavePlayer(int i) CopyInt(&pPlayer->_pvid, tbuff); CopyInt(&pPlayer->_pSpell, tbuff); + CopyChar(&pPlayer->_pSplType, tbuff); CopyChar(&pPlayer->_pSplFrom, tbuff); + tbuff += 2; + CopyInt(&pPlayer->_pTSpell, tbuff); CopyChar(&pPlayer->_pTSplType, tbuff); - tbuff += 5; + tbuff += 3; CopyInt(&pPlayer->_pRSpell, tbuff); CopyChar(&pPlayer->_pRSplType, tbuff); tbuff += 3; @@ -664,7 +648,7 @@ void SavePlayer(int i) CopyShorts(&pPlayer->wReserved, 8, tbuff); - CopyInt(tbuff, pPlayer->pDiabloKillLevel); + CopyInt(&pPlayer->pDiabloKillLevel, tbuff); CopyInts(&pPlayer->dwReserved, 7, tbuff); // Omit 10 pointers @@ -884,8 +868,8 @@ void CopyItem(ItemStruct *pItem) CopyInt(tbuff, &pItem->_iAnimLen); CopyInt(tbuff, &pItem->_iAnimFrame); CopyInt(tbuff, &pItem->_iAnimWidth); - CopyInt(tbuff, &pItem->_iAnimWidth2); // width 2? - CopyInt(tbuff, &pItem->_isin); // set when item is flagged for deletion, deprecated in 1.02 + CopyInt(tbuff, &pItem->_iAnimWidth2); + CopyInt(tbuff, &pItem->_isin); CopyChar(tbuff, &pItem->_iSelFlag); tbuff += 3; CopyInt(tbuff, &pItem->_iPostDraw); @@ -1045,8 +1029,7 @@ void SaveItems(ItemStruct *pItem, const int n) void LoadPremium(int i) { - memcpy(&premiumitem[i], tbuff, sizeof(*premiumitem)); - tbuff += sizeof(*premiumitem); + CopyItem(&item[i]); } void LoadQuest(int i) @@ -1152,7 +1135,7 @@ void SaveGame() for (i = 0; i < MAXITEMS; i++) BSave(itemavail[i]); for (i = 0; i < numitems; i++) - SaveItem(itemactive[i]); + SaveItem(&item[itemactive[i]]); for (i = 0; i < 128; i++) OSave(UniqueItemFlag[i]); @@ -1252,32 +1235,199 @@ void OSave(BOOL v) void SaveMonster(int i) { - memcpy(tbuff, &monster[i], sizeof(*monster) - (3 * sizeof(void *))); - tbuff += sizeof(*monster) - (3 * sizeof(void *)); // omit last 3 pointers + MonsterStruct *pMonster = &monster[i]; + + CopyInt(&pMonster->_mMTidx, tbuff); + CopyInt(&pMonster->_mmode, tbuff); + + CopyChar(&pMonster->_mgoal, tbuff); + tbuff += 3; + + CopyInt(&pMonster->_mgoalvar1, tbuff); + CopyInt(&pMonster->_mgoalvar2, tbuff); + CopyInt(&pMonster->_mgoalvar3, tbuff); + CopyInt(&pMonster->field_18, tbuff); + + CopyChar(&pMonster->_pathcount, tbuff); + tbuff += 3; + + CopyInt(&pMonster->_mx, tbuff); + CopyInt(&pMonster->_my, tbuff); + CopyInt(&pMonster->_mfutx, tbuff); + CopyInt(&pMonster->_mfuty, tbuff); + CopyInt(&pMonster->_moldx, tbuff); + CopyInt(&pMonster->_moldy, tbuff); + CopyInt(&pMonster->_mxoff, tbuff); + CopyInt(&pMonster->_myoff, tbuff); + CopyInt(&pMonster->_mxvel, tbuff); + CopyInt(&pMonster->_myvel, tbuff); + CopyInt(&pMonster->_mdir, tbuff); + CopyInt(&pMonster->_menemy, tbuff); + + CopyChar(&pMonster->_menemyx, tbuff); + CopyChar(&pMonster->_menemyy, tbuff); + CopyShort(&pMonster->falign_52, tbuff); + + tbuff += 4; // Skip pointer + CopyInt(&pMonster->_mAnimDelay, tbuff); + CopyInt(&pMonster->_mAnimCnt, tbuff); + CopyInt(&pMonster->_mAnimLen, tbuff); + CopyInt(&pMonster->_mAnimFrame, tbuff); + CopyInt(&pMonster->_meflag, tbuff); + CopyInt(&pMonster->_mDelFlag, tbuff); + CopyInt(&pMonster->_mVar1, tbuff); + CopyInt(&pMonster->_mVar2, tbuff); + CopyInt(&pMonster->_mVar3, tbuff); + CopyInt(&pMonster->_mVar4, tbuff); + CopyInt(&pMonster->_mVar5, tbuff); + CopyInt(&pMonster->_mVar6, tbuff); + CopyInt(&pMonster->_mVar7, tbuff); + CopyInt(&pMonster->_mVar8, tbuff); + CopyInt(&pMonster->_mmaxhp, tbuff); + CopyInt(&pMonster->_mhitpoints, tbuff); + + CopyChar(&pMonster->_mAi, tbuff); + CopyChar(&pMonster->_mint, tbuff); + CopyShort(&pMonster->falign_9A, tbuff); + + CopyInt(&pMonster->_mFlags, tbuff); + + CopyChar(&pMonster->_msquelch, tbuff); + tbuff += 3; + + CopyInt(&pMonster->falign_A4, tbuff); + CopyInt(&pMonster->_lastx, tbuff); + CopyInt(&pMonster->_lasty, tbuff); + CopyInt(&pMonster->_mRndSeed, tbuff); + CopyInt(&pMonster->_mAISeed, tbuff); + CopyInt(&pMonster->falign_B8, tbuff); + + CopyChar(&pMonster->_uniqtype, tbuff); + CopyChar(&pMonster->_uniqtrans, tbuff); + CopyChar(&pMonster->_udeadval, tbuff); + CopyChar(&pMonster->mWhoHit, tbuff); + + CopyChar(&pMonster->mLevel, tbuff); + CopyShort(&pMonster->mExp, tbuff); + tbuff += 1; + + CopyChar(&pMonster->mHit, tbuff); + CopyChar(&pMonster->mMinDamage, tbuff); + CopyChar(&pMonster->mMaxDamage, tbuff); + CopyChar(&pMonster->mHit2, tbuff); + + CopyChar(&pMonster->mMinDamage2, tbuff); + CopyChar(&pMonster->mMaxDamage2, tbuff); + CopyChar(&pMonster->mArmorClass, tbuff); + CopyChar(&pMonster->falign_CB, tbuff); + + CopyShort(&pMonster->mMagicRes, tbuff); + tbuff += 2; + + CopyInt(&pMonster->mtalkmsg, tbuff); + + CopyChar(&pMonster->leader, tbuff); + CopyChar(&pMonster->leaderflag, tbuff); + CopyChar(&pMonster->packsize, tbuff); + CopyChar(&pMonster->mlid, tbuff); } void SaveMissile(int i) { - memcpy(tbuff, &missile[i], sizeof(*missile)); - tbuff += sizeof(*missile); + MissileStruct *pMissile = &missile[i]; + + CopyInt(&pMissile->_mitype, tbuff); + CopyInt(&pMissile->_mix, tbuff); + CopyInt(&pMissile->_miy, tbuff); + CopyInt(&pMissile->_mixoff, tbuff); + CopyInt(&pMissile->_miyoff, tbuff); + CopyInt(&pMissile->_mixvel, tbuff); + CopyInt(&pMissile->_miyvel, tbuff); + CopyInt(&pMissile->_misx, tbuff); + CopyInt(&pMissile->_misy, tbuff); + CopyInt(&pMissile->_mitxoff, tbuff); + CopyInt(&pMissile->_mityoff, tbuff); + CopyInt(&pMissile->_mimfnum, tbuff); + CopyInt(&pMissile->_mispllvl, tbuff); + CopyInt(&pMissile->_miDelFlag, tbuff); + CopyChar(&pMissile->_miAnimType, tbuff); + tbuff += 3; + + CopyInt(&pMissile->_miAnimFlags, tbuff); + tbuff += 4; + CopyInt(&pMissile->_miAnimDelay, tbuff); + CopyInt(&pMissile->_miAnimLen, tbuff); + CopyInt(&pMissile->_miAnimWidth, tbuff); + CopyInt(&pMissile->_miAnimWidth2, tbuff); + CopyInt(&pMissile->_miAnimCnt, tbuff); + CopyInt(&pMissile->_miAnimAdd, tbuff); + CopyInt(&pMissile->_miAnimFrame, tbuff); + CopyInt(&pMissile->_miDrawFlag, tbuff); + CopyInt(&pMissile->_miLightFlag, tbuff); + CopyInt(&pMissile->_miPreFlag, tbuff); + CopyInt(&pMissile->_miUniqTrans, tbuff); + CopyInt(&pMissile->_mirange, tbuff); + CopyInt(&pMissile->_misource, tbuff); + CopyInt(&pMissile->_micaster, tbuff); + CopyInt(&pMissile->_midam, tbuff); + CopyInt(&pMissile->_miHitFlag, tbuff); + CopyInt(&pMissile->_midist, tbuff); + CopyInt(&pMissile->_mlid, tbuff); + CopyInt(&pMissile->_mirnd, tbuff); + CopyInt(&pMissile->_miVar1, tbuff); + CopyInt(&pMissile->_miVar2, tbuff); + CopyInt(&pMissile->_miVar3, tbuff); + CopyInt(&pMissile->_miVar4, tbuff); + CopyInt(&pMissile->_miVar5, tbuff); + CopyInt(&pMissile->_miVar6, tbuff); + CopyInt(&pMissile->_miVar7, tbuff); + CopyInt(&pMissile->_miVar8, tbuff); } void SaveObject(int i) { - memcpy(tbuff, &object[i], sizeof(*object)); - tbuff += sizeof(*object); -} + ObjectStruct *pObject = &object[i]; + CopyInt(tbuff, &pObject->_otype); + CopyInt(&pObject->_ox, tbuff); + CopyInt(&pObject->_oy, tbuff); + CopyInt(&pObject->_oLight, tbuff); + CopyInt(&pObject->_oAnimFlag, tbuff); + tbuff += 4; + CopyInt(&pObject->_oAnimDelay, tbuff); + CopyInt(&pObject->_oAnimCnt, tbuff); + CopyInt(&pObject->_oAnimLen, tbuff); + CopyInt(&pObject->_oAnimFrame, tbuff); + CopyInt(&pObject->_oAnimWidth, tbuff); + CopyInt(&pObject->_oAnimWidth2, tbuff); + CopyInt(&pObject->_oDelFlag, tbuff); + + CopyChar(&pObject->_oBreak, tbuff); + tbuff += 3; -void SaveItem(int i) -{ - memcpy(tbuff, &item[i], sizeof(*item)); - tbuff += sizeof(*item); + CopyInt(&pObject->_oSolidFlag, tbuff); + CopyInt(&pObject->_oMissFlag, tbuff); + + CopyChar(&pObject->_oSelFlag, tbuff); + tbuff += 3; + + CopyInt(&pObject->_oPreFlag, tbuff); + CopyInt(&pObject->_oTrapFlag, tbuff); + CopyInt(&pObject->_oDoorFlag, tbuff); + CopyInt(&pObject->_olid, tbuff); + CopyInt(&pObject->_oRndSeed, tbuff); + CopyInt(&pObject->_oVar1, tbuff); + CopyInt(&pObject->_oVar2, tbuff); + CopyInt(&pObject->_oVar3, tbuff); + CopyInt(&pObject->_oVar4, tbuff); + CopyInt(&pObject->_oVar5, tbuff); + CopyInt(&pObject->_oVar6, tbuff); + CopyInt(&pObject->_oVar7, tbuff); + CopyInt(&pObject->_oVar8, tbuff); } void SavePremium(int i) { - memcpy(tbuff, &premiumitem[i], sizeof(*premiumitem)); - tbuff += sizeof(*premiumitem); + SaveItem(&item[i]); } void SaveQuest(int i) @@ -1352,7 +1502,7 @@ void SaveLevel() for (i = 0; i < MAXITEMS; i++) BSave(itemavail[i]); for (i = 0; i < numitems; i++) - SaveItem(itemactive[i]); + SaveItem(&item[itemactive[i]]); for (j = 0; j < MAXDUNY; j++) { for (i = 0; i < MAXDUNX; i++) From c124514391518734fcfcc7f69c61882032576fef Mon Sep 17 00:00:00 2001 From: Alex Sweet Date: Mon, 8 Jul 2019 06:41:23 -0700 Subject: [PATCH 31/42] Add missing pragma pack to some structs --- Source/loadsave.cpp | 2 +- structs.h | 5 +++-- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/Source/loadsave.cpp b/Source/loadsave.cpp index dd057ff0fbd..d275ccdbc3c 100644 --- a/Source/loadsave.cpp +++ b/Source/loadsave.cpp @@ -373,7 +373,7 @@ void LoadPlayer(int i) CopyInt(tbuff, &pPlayer->_pNFrames); CopyInt(tbuff, &pPlayer->_pNWidth); - tbuff += sizeof(__uint32_t) * 8 + tbuff += sizeof(__uint32_t) * 8; CopyInt(tbuff, &pPlayer->_pWFrames); CopyInt(tbuff, &pPlayer->_pWWidth); diff --git a/structs.h b/structs.h index 6e9d86de1e6..eb2cb92aea8 100644 --- a/structs.h +++ b/structs.h @@ -979,7 +979,7 @@ typedef struct TBuffer { ////////////////////////////////////////////////// // quests ////////////////////////////////////////////////// - +#pragma pack(push, 4) typedef struct QuestStruct { unsigned char _qlevel; unsigned char _qtype; @@ -994,6 +994,7 @@ typedef struct QuestStruct { unsigned char _qvar2; int _qlog; } QuestStruct; +#pragma pack(pop) typedef struct QuestData { unsigned char _qdlvl; @@ -1204,6 +1205,7 @@ typedef struct LightListStruct { int _yoff; int _lflags; } LightListStruct; +#pragma pack(pop) ////////////////////////////////////////////////// // dead @@ -1216,7 +1218,6 @@ typedef struct DeadStruct { int _deadWidth2; char _deadtrans; } DeadStruct; -#pragma pack(pop) ////////////////////////////////////////////////// // diabloui From aed31ce68458dd993834ed52d8984f1b220f6943 Mon Sep 17 00:00:00 2001 From: Alex Sweet Date: Mon, 8 Jul 2019 07:05:08 -0700 Subject: [PATCH 32/42] Style fixes --- Source/loadsave.cpp | 3292 +++++++++++++++++++++---------------------- structs.h | 40 +- 2 files changed, 1664 insertions(+), 1668 deletions(-) diff --git a/Source/loadsave.cpp b/Source/loadsave.cpp index d275ccdbc3c..1d2ddeb958f 100644 --- a/Source/loadsave.cpp +++ b/Source/loadsave.cpp @@ -1,1648 +1,1644 @@ -#include "diablo.h" - -DEVILUTION_BEGIN_NAMESPACE - -BYTE *tbuff; - -void LoadGame(BOOL firstflag) -{ - int i, j; - DWORD dwLen; - char szName[MAX_PATH]; - BYTE *LoadBuff; - int _ViewX, _ViewY, _nummonsters, _numitems, _nummissiles, _nobjects; - - FreeGameMem(); - pfile_remove_temp_files(); - pfile_get_game_name(szName); - LoadBuff = pfile_read(szName, &dwLen); - tbuff = LoadBuff; - - if (ILoad() != 'RETL') - app_fatal("Invalid save file"); - - setlevel = OLoad(); - setlvlnum = WLoad(); - currlevel = WLoad(); - leveltype = WLoad(); - _ViewX = WLoad(); - _ViewY = WLoad(); - invflag = OLoad(); - chrflag = OLoad(); - _nummonsters = WLoad(); - _numitems = WLoad(); - _nummissiles = WLoad(); - _nobjects = WLoad(); - - for (i = 0; i < NUMLEVELS; i++) { - glSeedTbl[i] = ILoad(); - gnLevelTypeTbl[i] = WLoad(); - } - - LoadPlayer(myplr); - - for (i = 0; i < MAXQUESTS; i++) - LoadQuest(i); - for (i = 0; i < MAXPORTAL; i++) - LoadPortal(i); - - LoadGameLevel(firstflag, 4); - SyncInitPlr(myplr); - SyncPlrAnim(myplr); - - ViewX = _ViewX; - ViewY = _ViewY; - nummonsters = _nummonsters; - numitems = _numitems; - nummissiles = _nummissiles; - nobjects = _nobjects; - - for (i = 0; i < MAXMONSTERS; i++) - monstkills[i] = ILoad(); - - if (leveltype != DTYPE_TOWN) { - for (i = 0; i < MAXMONSTERS; i++) - monstactive[i] = WLoad(); - for (i = 0; i < nummonsters; i++) - LoadMonster(monstactive[i]); - for (i = 0; i < MAXMISSILES; i++) - missileactive[i] = BLoad(); - for (i = 0; i < MAXMISSILES; i++) - missileavail[i] = BLoad(); - for (i = 0; i < nummissiles; i++) - LoadMissile(missileactive[i]); - for (i = 0; i < MAXOBJECTS; i++) - objectactive[i] = BLoad(); - for (i = 0; i < MAXOBJECTS; i++) - objectavail[i] = BLoad(); - for (i = 0; i < nobjects; i++) - LoadObject(objectactive[i]); - for (i = 0; i < nobjects; i++) - SyncObjectAnim(objectactive[i]); - - numlights = WLoad(); - - for (i = 0; i < MAXLIGHTS; i++) - lightactive[i] = BLoad(); - for (i = 0; i < numlights; i++) - LoadLighting(lightactive[i]); - - visionid = WLoad(); - numvision = WLoad(); - - for (i = 0; i < numvision; i++) - LoadVision(i); - } - - for (i = 0; i < MAXITEMS; i++) - itemactive[i] = BLoad(); - for (i = 0; i < MAXITEMS; i++) - itemavail[i] = BLoad(); - for (i = 0; i < numitems; i++) - LoadItem(itemactive[i]); - for (i = 0; i < 128; i++) - UniqueItemFlag[i] = OLoad(); - - for (j = 0; j < MAXDUNY; j++) { - for (i = 0; i < MAXDUNX; i++) - dLight[i][j] = BLoad(); - } - for (j = 0; j < MAXDUNY; j++) { - for (i = 0; i < MAXDUNX; i++) - dFlags[i][j] = BLoad(); - } - for (j = 0; j < MAXDUNY; j++) { - for (i = 0; i < MAXDUNX; i++) - dPlayer[i][j] = BLoad(); - } - for (j = 0; j < MAXDUNY; j++) { - for (i = 0; i < MAXDUNX; i++) - dItem[i][j] = BLoad(); - } - - if (leveltype != DTYPE_TOWN) { - for (j = 0; j < MAXDUNY; j++) { - for (i = 0; i < MAXDUNX; i++) - dMonster[i][j] = WLoad(); - } - for (j = 0; j < MAXDUNY; j++) { - for (i = 0; i < MAXDUNX; i++) - dDead[i][j] = BLoad(); - } - for (j = 0; j < MAXDUNY; j++) { - for (i = 0; i < MAXDUNX; i++) - dObject[i][j] = BLoad(); - } - for (j = 0; j < MAXDUNY; j++) { - for (i = 0; i < MAXDUNX; i++) - dLight[i][j] = BLoad(); - } - for (j = 0; j < MAXDUNY; j++) { - for (i = 0; i < MAXDUNX; i++) - dPreLight[i][j] = BLoad(); - } - for (j = 0; j < DMAXY; j++) { - for (i = 0; i < DMAXX; i++) - automapview[i][j] = OLoad(); - } - for (j = 0; j < MAXDUNY; j++) { - for (i = 0; i < MAXDUNX; i++) - dMissile[i][j] = BLoad(); - } - } - - numpremium = WLoad(); - premiumlevel = WLoad(); - - for (i = 0; i < 6; i++) - LoadPremium(i); - - automapflag = OLoad(); - AutoMapScale = WLoad(); - mem_free_dbg(LoadBuff); - AutomapZoomReset(); - ResyncQuests(); - - if (leveltype != DTYPE_TOWN) - ProcessLightList(); - - RedoPlayerVision(); - ProcessVisionList(); - missiles_process_charge(); - ResetPal(); - SetCursor_(CURSOR_HAND); - gbProcessPlayers = TRUE; -} - -char BLoad() -{ - return *tbuff++; -} - -int WLoad() -{ - int rv = *tbuff++ << 24; - rv |= *tbuff++ << 16; - rv |= *tbuff++ << 8; - rv |= *tbuff++; - - return rv; -} - -int ILoad() -{ - int rv = *tbuff++ << 24; - rv |= *tbuff++ << 16; - rv |= *tbuff++ << 8; - rv |= *tbuff++; - - return rv; -} - -BOOL OLoad() -{ - if (*tbuff++ == TRUE) - return TRUE; - else - return FALSE; -} - -void CopyInt(const void *src, void * dst) -{ - memcpy(dst, src, 4); - tbuff += 4; -} - -void CopyShort(const void *src, void * dst) -{ - memcpy(dst, src, 2); - tbuff += 2; -} - -void CopyShorts(const void *src, const int n, void * dst) -{ - memcpy(dst, src, 2 * n); - tbuff += 2 * n; -} - -void CopyInts(const void *src, const int n, void * dst) -{ - memcpy(dst, src, 4 * n); - tbuff += 4 * n; -} - -void CopyBytes(const void *src, const int n, void * dst) -{ - memcpy(dst, src, n); - tbuff += n; -} - -void CopyChar(const void *src, void * dst) -{ - memcpy(dst, src, 1); - tbuff += 1; -} - -void CopyInt64(const void *src, void * dst) -{ - memcpy(dst, src, 8); - tbuff += 8; -} - -void LoadPlayer(int i) -{ - PlayerStruct *pPlayer = &plr[i]; - - CopyInt(tbuff, &pPlayer->_pmode); - - CopyBytes(tbuff, 25, pPlayer->walkpath); - CopyBytes(tbuff, 1, &pPlayer->plractive); - tbuff += 2; - - CopyInt(tbuff, &pPlayer->destAction); - CopyInt(tbuff, &pPlayer->destParam1); - CopyInt(tbuff, &pPlayer->destParam2); - CopyInt(tbuff, &pPlayer->destParam3); - CopyInt(tbuff, &pPlayer->destParam4); - CopyInt(tbuff, &pPlayer->plrlevel); - CopyInt(tbuff, &pPlayer->WorldX); - CopyInt(tbuff, &pPlayer->WorldY); - CopyInt(tbuff, &pPlayer->_px); - CopyInt(tbuff, &pPlayer->_py); - CopyInt(tbuff, &pPlayer->_ptargx); - CopyInt(tbuff, &pPlayer->_ptargy); - CopyInt(tbuff, &pPlayer->_pownerx); - CopyInt(tbuff, &pPlayer->_pownery); - CopyInt(tbuff, &pPlayer->_poldx); - CopyInt(tbuff, &pPlayer->_poldy); - CopyInt(tbuff, &pPlayer->_pxoff); - CopyInt(tbuff, &pPlayer->_pyoff); - CopyInt(tbuff, &pPlayer->_pxvel); - CopyInt(tbuff, &pPlayer->_pyvel); - CopyInt(tbuff, &pPlayer->_pdir); - CopyInt(tbuff, &pPlayer->_nextdir); - CopyInt(tbuff, &pPlayer->_pgfxnum); - tbuff += 4; // Skip pointers - CopyInt(tbuff, &pPlayer->_pAnimDelay); - CopyInt(tbuff, &pPlayer->_pAnimCnt); - CopyInt(tbuff, &pPlayer->_pAnimLen); - CopyInt(tbuff, &pPlayer->_pAnimFrame); - CopyInt(tbuff, &pPlayer->_pAnimWidth); - CopyInt(tbuff, &pPlayer->_pAnimWidth2); - CopyInt(tbuff, &pPlayer->_peflag); - CopyInt(tbuff, &pPlayer->_plid); - CopyInt(tbuff, &pPlayer->_pvid); - - CopyInt(tbuff, &pPlayer->_pSpell); - CopyChar(tbuff, &pPlayer->_pSplType); - CopyChar(tbuff, &pPlayer->_pSplFrom); - tbuff += 2; - CopyInt(tbuff, &pPlayer->_pTSpell); - CopyChar(tbuff, &pPlayer->_pTSplType); - tbuff += 3; - CopyInt(tbuff, &pPlayer->_pRSpell); - CopyChar(tbuff, &pPlayer->_pRSplType); - tbuff += 3; - CopyInt(tbuff, &pPlayer->_pSBkSpell); - CopyChar(tbuff, &pPlayer->_pSBkSplType); - - CopyBytes(tbuff, 64, &pPlayer->_pSplLvl); - tbuff += 7; - CopyInt64(tbuff, &pPlayer->_pMemSpells); - CopyInt64(tbuff, &pPlayer->_pAblSpells); - CopyInt64(tbuff, &pPlayer->_pScrlSpells); - CopyChar(tbuff, &pPlayer->_pSpellFlags); - tbuff += 3; - CopyInts(tbuff, 4, &pPlayer->_pSplHotKey); - CopyBytes(tbuff, 4, &pPlayer->_pSplTHotKey); - CopyInt(tbuff, &pPlayer->_pwtype); - CopyChar(tbuff, &pPlayer->_pBlockFlag); - CopyChar(tbuff, &pPlayer->_pInvincible); - CopyChar(tbuff, &pPlayer->_pLightRad); - CopyChar(tbuff, &pPlayer->_pLvlChanging); - CopyBytes(tbuff, PLR_NAME_LEN, &pPlayer->_pName); - CopyChar(tbuff, &pPlayer->_pClass); - tbuff += 3; - CopyInt(tbuff, &pPlayer->_pStrength); - CopyInt(tbuff, &pPlayer->_pBaseStr); - CopyInt(tbuff, &pPlayer->_pMagic); - CopyInt(tbuff, &pPlayer->_pBaseMag); - CopyInt(tbuff, &pPlayer->_pDexterity); - CopyInt(tbuff, &pPlayer->_pBaseDex); - CopyInt(tbuff, &pPlayer->_pVitality); - CopyInt(tbuff, &pPlayer->_pBaseVit); - CopyInt(tbuff, &pPlayer->_pStatPts); - CopyInt(tbuff, &pPlayer->_pDamageMod); - CopyInt(tbuff, &pPlayer->_pBaseToBlk); - CopyInt(tbuff, &pPlayer->_pHPBase); - CopyInt(tbuff, &pPlayer->_pMaxHPBase); - CopyInt(tbuff, &pPlayer->_pHitPoints); - CopyInt(tbuff, &pPlayer->_pMaxHP); - CopyInt(tbuff, &pPlayer->_pHPPer); - CopyInt(tbuff, &pPlayer->_pManaBase); - CopyInt(tbuff, &pPlayer->_pMaxManaBase); - CopyInt(tbuff, &pPlayer->_pMana); - CopyInt(tbuff, &pPlayer->_pMaxMana); - CopyInt(tbuff, &pPlayer->_pManaPer); - CopyChar(tbuff, &pPlayer->_pLevel); - CopyChar(tbuff, &pPlayer->_pMaxLvl); - tbuff += 2; - CopyInt(tbuff, &pPlayer->_pExperience); - CopyInt(tbuff, &pPlayer->_pMaxExp); - CopyInt(tbuff, &pPlayer->_pNextExper); - CopyChar(tbuff, &pPlayer->_pArmorClass); - CopyChar(tbuff, &pPlayer->_pMagResist); - CopyChar(tbuff, &pPlayer->_pFireResist); - CopyChar(tbuff, &pPlayer->_pLghtResist); - CopyInt(tbuff, &pPlayer->_pGold); - CopyInt(tbuff, &pPlayer->_pInfraFlag); - CopyInt(tbuff, &pPlayer->_pVar1); - CopyInt(tbuff, &pPlayer->_pVar2); - CopyInt(tbuff, &pPlayer->_pVar3); - CopyInt(tbuff, &pPlayer->_pVar4); - CopyInt(tbuff, &pPlayer->_pVar5); - CopyInt(tbuff, &pPlayer->_pVar6); - CopyInt(tbuff, &pPlayer->_pVar7); - CopyInt(tbuff, &pPlayer->_pVar8); - CopyBytes(tbuff, NUMLEVELS, &pPlayer->_pLvlVisited); - CopyBytes(tbuff, NUMLEVELS, &pPlayer->_pSLvlVisited); - tbuff += 2; - CopyInt(tbuff, &pPlayer->_pGFXLoad); - - tbuff += sizeof(__uint32_t) * 8; - CopyInt(tbuff, &pPlayer->_pNFrames); - CopyInt(tbuff, &pPlayer->_pNWidth); - - tbuff += sizeof(__uint32_t) * 8; - - CopyInt(tbuff, &pPlayer->_pWFrames); - CopyInt(tbuff, &pPlayer->_pWWidth); - - tbuff += sizeof(__uint32_t) * 8; - - CopyInt(tbuff, &pPlayer->_pAFrames); - CopyInt(tbuff, &pPlayer->_pAWidth); - CopyInt(tbuff, &pPlayer->_pAFNum); - - tbuff += sizeof(__uint32_t) * 24; - - CopyInt(tbuff, &pPlayer->_pSFrames); - CopyInt(tbuff, &pPlayer->_pSWidth); - CopyInt(tbuff, &pPlayer->_pSFNum); - - tbuff += sizeof(__uint32_t) * 8; - - CopyInt(tbuff, &pPlayer->_pHFrames); - CopyInt(tbuff, &pPlayer->_pHWidth); - - tbuff += sizeof(__uint32_t) * 8; - - CopyInt(tbuff, &pPlayer->_pDFrames); - CopyInt(tbuff, &pPlayer->_pDWidth); - - tbuff += sizeof(__uint32_t) * 8; - - CopyInt(tbuff, &pPlayer->_pBFrames); - CopyInt(tbuff, &pPlayer->_pBWidth); - CopyItems(NUM_INVLOC, pPlayer->InvBody); - CopyItems(NUM_INV_GRID_ELEM, pPlayer->InvList); - CopyInt(tbuff, &pPlayer->_pNumInv); - CopyBytes(tbuff, NUM_INV_GRID_ELEM, pPlayer->InvGrid); - CopyItems(MAXBELTITEMS, pPlayer->SpdList); - CopyItem(&pPlayer->HoldItem); - CopyInt(tbuff, &pPlayer->_pIMinDam); - CopyInt(tbuff, &pPlayer->_pIMaxDam); - CopyInt(tbuff, &pPlayer->_pIAC); - CopyInt(tbuff, &pPlayer->_pIBonusDam); - CopyInt(tbuff, &pPlayer->_pIBonusToHit); - CopyInt(tbuff, &pPlayer->_pIBonusAC); - CopyInt(tbuff, &pPlayer->_pIBonusDamMod); - tbuff += 4; - CopyInt64(tbuff, &pPlayer->_pISpells); - CopyInt(tbuff, &pPlayer->_pIFlags); - CopyInt(tbuff, &pPlayer->_pIGetHit); - - CopyChar(tbuff, &pPlayer->_pISplLvlAdd); - CopyChar(tbuff, &pPlayer->_pISplCost); - tbuff += 2; - - CopyInt(tbuff, &pPlayer->_pISplDur); - CopyInt(tbuff, &pPlayer->_pIEnAc); - CopyInt(tbuff, &pPlayer->_pIFMinDam); - CopyInt(tbuff, &pPlayer->_pIFMaxDam); - CopyInt(tbuff, &pPlayer->_pILMinDam); - CopyInt(tbuff, &pPlayer->_pILMaxDam); - CopyInt(tbuff, &pPlayer->_pOilType); - - CopyChar(tbuff, &pPlayer->pTownWarps); - CopyChar(tbuff, &pPlayer->pDungMsgs); - CopyChar(tbuff, &pPlayer->pLvlLoad); - CopyChar(tbuff, &pPlayer->pBattleNet); - - CopyChar(tbuff, &pPlayer->pManaShield); - CopyBytes(tbuff, 3, &pPlayer->bReserved); - - CopyShorts(tbuff, 8, &pPlayer->wReserved); - - CopyInt(tbuff, &pPlayer->pDiabloKillLevel); - CopyInts(tbuff, 7, &pPlayer->dwReserved); - - // Omit 10 pointers - -} - -void SavePlayer(int i) -{ - PlayerStruct *pPlayer = &plr[i]; - - CopyInt(&pPlayer->_pmode, tbuff); - - CopyBytes(&pPlayer->walkpath, 25, tbuff); - CopyBytes(&pPlayer->plractive, 1, tbuff); - tbuff += 2; - - CopyInt(&pPlayer->destAction, tbuff); - CopyInt(&pPlayer->destParam1, tbuff); - CopyInt(&pPlayer->destParam2, tbuff); - CopyInt(&pPlayer->destParam3, tbuff); - CopyInt(&pPlayer->destParam4, tbuff); - CopyInt(&pPlayer->plrlevel, tbuff); - CopyInt(&pPlayer->WorldX, tbuff); - CopyInt(&pPlayer->WorldY, tbuff); - CopyInt(&pPlayer->_px, tbuff); - CopyInt(&pPlayer->_py, tbuff); - CopyInt(&pPlayer->_ptargx, tbuff); - CopyInt(&pPlayer->_ptargy, tbuff); - CopyInt(&pPlayer->_pownerx, tbuff); - CopyInt(&pPlayer->_pownery, tbuff); - CopyInt(&pPlayer->_poldx, tbuff); - CopyInt(&pPlayer->_poldy, tbuff); - CopyInt(&pPlayer->_pxoff, tbuff); - CopyInt(&pPlayer->_pyoff, tbuff); - CopyInt(&pPlayer->_pxvel, tbuff); - CopyInt(&pPlayer->_pyvel, tbuff); - CopyInt(&pPlayer->_pdir, tbuff); - CopyInt(&pPlayer->_nextdir, tbuff); - CopyInt(&pPlayer->_pgfxnum, tbuff); - tbuff += 4; // Skip pointers - CopyInt(&pPlayer->_pAnimDelay, tbuff); - CopyInt(&pPlayer->_pAnimCnt, tbuff); - CopyInt(&pPlayer->_pAnimLen, tbuff); - CopyInt(&pPlayer->_pAnimFrame, tbuff); - CopyInt(&pPlayer->_pAnimWidth, tbuff); - CopyInt(&pPlayer->_pAnimWidth2, tbuff); - CopyInt(&pPlayer->_peflag, tbuff); - CopyInt(&pPlayer->_plid, tbuff); - CopyInt(&pPlayer->_pvid, tbuff); - - CopyInt(&pPlayer->_pSpell, tbuff); - - CopyChar(&pPlayer->_pSplType, tbuff); - CopyChar(&pPlayer->_pSplFrom, tbuff); - tbuff += 2; - - CopyInt(&pPlayer->_pTSpell, tbuff); - CopyChar(&pPlayer->_pTSplType, tbuff); - tbuff += 3; - CopyInt(&pPlayer->_pRSpell, tbuff); - CopyChar(&pPlayer->_pRSplType, tbuff); - tbuff += 3; - CopyInt(&pPlayer->_pSBkSpell, tbuff); - CopyChar(&pPlayer->_pSBkSplType, tbuff); - - CopyBytes(&pPlayer->_pSplLvl, 64, tbuff); - tbuff += 7; - CopyInt64(&pPlayer->_pMemSpells, tbuff); - CopyInt64(&pPlayer->_pAblSpells, tbuff); - CopyInt64(&pPlayer->_pScrlSpells, tbuff); - CopyChar(&pPlayer->_pSpellFlags, tbuff); - tbuff += 3; - CopyInts(&pPlayer->_pSplHotKey, 4, tbuff); - CopyBytes(&pPlayer->_pSplTHotKey, 4, tbuff); - CopyInt(&pPlayer->_pwtype, tbuff); - CopyChar(&pPlayer->_pBlockFlag, tbuff); - CopyChar(&pPlayer->_pInvincible, tbuff); - CopyChar(&pPlayer->_pLightRad, tbuff); - CopyChar(&pPlayer->_pLvlChanging, tbuff); - CopyBytes(&pPlayer->_pName, PLR_NAME_LEN, tbuff); - CopyChar(&pPlayer->_pClass, tbuff); - tbuff += 3; - CopyInt(&pPlayer->_pStrength, tbuff); - CopyInt(&pPlayer->_pBaseStr, tbuff); - CopyInt(&pPlayer->_pMagic, tbuff); - CopyInt(&pPlayer->_pBaseMag, tbuff); - CopyInt(&pPlayer->_pDexterity, tbuff); - CopyInt(&pPlayer->_pBaseDex, tbuff); - CopyInt(&pPlayer->_pVitality, tbuff); - CopyInt(&pPlayer->_pBaseVit, tbuff); - CopyInt(&pPlayer->_pStatPts, tbuff); - CopyInt(&pPlayer->_pDamageMod, tbuff); - CopyInt(&pPlayer->_pBaseToBlk, tbuff); - CopyInt(&pPlayer->_pHPBase, tbuff); - CopyInt(&pPlayer->_pMaxHPBase, tbuff); - CopyInt(&pPlayer->_pHitPoints, tbuff); - CopyInt(&pPlayer->_pMaxHP, tbuff); - CopyInt(&pPlayer->_pHPPer, tbuff); - CopyInt(&pPlayer->_pManaBase, tbuff); - CopyInt(&pPlayer->_pMaxManaBase, tbuff); - CopyInt(&pPlayer->_pMana, tbuff); - CopyInt(&pPlayer->_pMaxMana, tbuff); - CopyInt(&pPlayer->_pManaPer, tbuff); - CopyChar(&pPlayer->_pLevel, tbuff); - CopyChar(&pPlayer->_pMaxLvl, tbuff); - tbuff += 2; - CopyInt(&pPlayer->_pExperience, tbuff); - CopyInt(&pPlayer->_pMaxExp, tbuff); - CopyInt(&pPlayer->_pNextExper, tbuff); - CopyChar(&pPlayer->_pArmorClass, tbuff); - CopyChar(&pPlayer->_pMagResist, tbuff); - CopyChar(&pPlayer->_pFireResist, tbuff); - CopyChar(&pPlayer->_pLghtResist, tbuff); - CopyInt(&pPlayer->_pGold, tbuff); - CopyInt(&pPlayer->_pInfraFlag, tbuff); - CopyInt(&pPlayer->_pVar1, tbuff); - CopyInt(&pPlayer->_pVar2, tbuff); - CopyInt(&pPlayer->_pVar3, tbuff); - CopyInt(&pPlayer->_pVar4, tbuff); - CopyInt(&pPlayer->_pVar5, tbuff); - CopyInt(&pPlayer->_pVar6, tbuff); - CopyInt(&pPlayer->_pVar7, tbuff); - CopyInt(&pPlayer->_pVar8, tbuff); - CopyBytes(&pPlayer->_pLvlVisited, NUMLEVELS, tbuff); - CopyBytes(&pPlayer->_pSLvlVisited, NUMLEVELS, tbuff); // only 10 used - tbuff += 2; - CopyInt(&pPlayer->_pGFXLoad, tbuff); - - tbuff += sizeof(__uint32_t) * 8; // Skip 8 pointers - CopyInt(&pPlayer->_pNFrames, tbuff); - CopyInt(&pPlayer->_pNWidth, tbuff); - - tbuff += sizeof(__uint32_t) * 8; // Skip 8 pointers - - CopyInt(&pPlayer->_pWFrames, tbuff); - CopyInt(&pPlayer->_pWWidth, tbuff); - - tbuff += sizeof(__uint32_t) * 8; // Skip 8 pointers - - CopyInt(&pPlayer->_pAFrames, tbuff); - CopyInt(&pPlayer->_pAWidth, tbuff); - CopyInt(&pPlayer->_pAFNum, tbuff); - - tbuff += sizeof(__uint32_t) * 24; // Skip 24 pointers - - CopyInt(&pPlayer->_pSFrames, tbuff); - CopyInt(&pPlayer->_pSWidth, tbuff); - CopyInt(&pPlayer->_pSFNum, tbuff); - - tbuff += sizeof(__uint32_t) * 8; // Skip 8 pointers - - CopyInt(&pPlayer->_pHFrames, tbuff); - CopyInt(&pPlayer->_pHWidth, tbuff); - - tbuff += sizeof(__uint32_t) * 8; // Skip 8 pointers - - CopyInt(&pPlayer->_pDFrames, tbuff); - CopyInt(&pPlayer->_pDWidth, tbuff); - - tbuff += sizeof(__uint32_t) * 8; // Skip 8 pointers - - CopyInt(&pPlayer->_pBFrames, tbuff); - CopyInt(&pPlayer->_pBWidth, tbuff); - SaveItems(pPlayer->InvBody, NUM_INVLOC); - SaveItems(pPlayer->InvList, NUM_INV_GRID_ELEM); - CopyInt(&pPlayer->_pNumInv, tbuff); - CopyBytes(pPlayer->InvGrid, NUM_INV_GRID_ELEM, tbuff); - SaveItems(pPlayer->SpdList, MAXBELTITEMS); - SaveItem(&pPlayer->HoldItem); - CopyInt(&pPlayer->_pIMinDam, tbuff); - CopyInt(&pPlayer->_pIMaxDam, tbuff); - CopyInt(&pPlayer->_pIAC, tbuff); - CopyInt(&pPlayer->_pIBonusDam, tbuff); - CopyInt(&pPlayer->_pIBonusToHit, tbuff); - CopyInt(&pPlayer->_pIBonusAC, tbuff); - CopyInt(&pPlayer->_pIBonusDamMod, tbuff); - tbuff += 4; - CopyInt64(&pPlayer->_pISpells, tbuff); - CopyInt(&pPlayer->_pIFlags, tbuff); - CopyInt(&pPlayer->_pIGetHit, tbuff); - - CopyChar(&pPlayer->_pISplLvlAdd, tbuff); - CopyChar(&pPlayer->_pISplCost, tbuff); - tbuff += 2; - - CopyInt(&pPlayer->_pISplDur, tbuff); - CopyInt(&pPlayer->_pIEnAc, tbuff); - CopyInt(&pPlayer->_pIFMinDam, tbuff); - CopyInt(&pPlayer->_pIFMaxDam, tbuff); - CopyInt(&pPlayer->_pILMinDam, tbuff); - CopyInt(&pPlayer->_pILMaxDam, tbuff); - CopyInt(&pPlayer->_pOilType, tbuff); - - CopyChar(&pPlayer->pTownWarps, tbuff); - CopyChar(&pPlayer->pDungMsgs, tbuff); - CopyChar(&pPlayer->pLvlLoad, tbuff); - CopyChar(&pPlayer->pBattleNet, tbuff); - - CopyChar(&pPlayer->pManaShield, tbuff); - CopyBytes(&pPlayer->bReserved, 3, tbuff); - - CopyShorts(&pPlayer->wReserved, 8, tbuff); - - CopyInt(&pPlayer->pDiabloKillLevel, tbuff); - CopyInts(&pPlayer->dwReserved, 7, tbuff); - - // Omit 10 pointers - -} - -void LoadMonster(int i) -{ - MonsterStruct *pMonster = &monster[i]; - - CopyInt(tbuff, &pMonster->_mMTidx); - CopyInt(tbuff, &pMonster->_mmode); - - CopyChar(tbuff, &pMonster->_mgoal); - tbuff += 3; - - CopyInt(tbuff, &pMonster->_mgoalvar1); - CopyInt(tbuff, &pMonster->_mgoalvar2); - CopyInt(tbuff, &pMonster->_mgoalvar3); - CopyInt(tbuff, &pMonster->field_18); - - CopyChar(tbuff, &pMonster->_pathcount); - tbuff += 3; - - CopyInt(tbuff, &pMonster->_mx); - CopyInt(tbuff, &pMonster->_my); - CopyInt(tbuff, &pMonster->_mfutx); - CopyInt(tbuff, &pMonster->_mfuty); - CopyInt(tbuff, &pMonster->_moldx); - CopyInt(tbuff, &pMonster->_moldy); - CopyInt(tbuff, &pMonster->_mxoff); - CopyInt(tbuff, &pMonster->_myoff); - CopyInt(tbuff, &pMonster->_mxvel); - CopyInt(tbuff, &pMonster->_myvel); - CopyInt(tbuff, &pMonster->_mdir); - CopyInt(tbuff, &pMonster->_menemy); - - CopyChar(tbuff, &pMonster->_menemyx); - CopyChar(tbuff, &pMonster->_menemyy); - CopyShort(tbuff, &pMonster->falign_52); - - tbuff += 4; // Skip pointer - CopyInt(tbuff, &pMonster->_mAnimDelay); - CopyInt(tbuff, &pMonster->_mAnimCnt); - CopyInt(tbuff, &pMonster->_mAnimLen); - CopyInt(tbuff, &pMonster->_mAnimFrame); - CopyInt(tbuff, &pMonster->_meflag); - CopyInt(tbuff, &pMonster->_mDelFlag); - CopyInt(tbuff, &pMonster->_mVar1); - CopyInt(tbuff, &pMonster->_mVar2); - CopyInt(tbuff, &pMonster->_mVar3); - CopyInt(tbuff, &pMonster->_mVar4); - CopyInt(tbuff, &pMonster->_mVar5); - CopyInt(tbuff, &pMonster->_mVar6); - CopyInt(tbuff, &pMonster->_mVar7); - CopyInt(tbuff, &pMonster->_mVar8); - CopyInt(tbuff, &pMonster->_mmaxhp); - CopyInt(tbuff, &pMonster->_mhitpoints); - - CopyChar(tbuff, &pMonster->_mAi); - CopyChar(tbuff, &pMonster->_mint); - CopyShort(tbuff, &pMonster->falign_9A); - - CopyInt(tbuff, &pMonster->_mFlags); - - CopyChar(tbuff, &pMonster->_msquelch); - tbuff += 3; - - CopyInt(tbuff, &pMonster->falign_A4); - CopyInt(tbuff, &pMonster->_lastx); - CopyInt(tbuff, &pMonster->_lasty); - CopyInt(tbuff, &pMonster->_mRndSeed); - CopyInt(tbuff, &pMonster->_mAISeed); - CopyInt(tbuff, &pMonster->falign_B8); - - CopyChar(tbuff, &pMonster->_uniqtype); - CopyChar(tbuff, &pMonster->_uniqtrans); - CopyChar(tbuff, &pMonster->_udeadval); - CopyChar(tbuff, &pMonster->mWhoHit); - - CopyChar(tbuff, &pMonster->mLevel); - CopyShort(tbuff, &pMonster->mExp); - tbuff += 1; - - CopyChar(tbuff, &pMonster->mHit); - CopyChar(tbuff, &pMonster->mMinDamage); - CopyChar(tbuff, &pMonster->mMaxDamage); - CopyChar(tbuff, &pMonster->mHit2); - - CopyChar(tbuff, &pMonster->mMinDamage2); - CopyChar(tbuff, &pMonster->mMaxDamage2); - CopyChar(tbuff, &pMonster->mArmorClass); - CopyChar(tbuff, &pMonster->falign_CB); - - CopyShort(tbuff, &pMonster->mMagicRes); - tbuff += 2; - - CopyInt(tbuff, &pMonster->mtalkmsg); - - CopyChar(tbuff, &pMonster->leader); - CopyChar(tbuff, &pMonster->leaderflag); - CopyChar(tbuff, &pMonster->packsize); - CopyChar(tbuff, &pMonster->mlid); - - SyncMonsterAnim(i); -} - -void LoadMissile(int i) -{ - MissileStruct *pMissile = &missile[i]; - - CopyInt(tbuff, &pMissile->_mitype); - CopyInt(tbuff, &pMissile->_mix); - CopyInt(tbuff, &pMissile->_miy); - CopyInt(tbuff, &pMissile->_mixoff); - CopyInt(tbuff, &pMissile->_miyoff); - CopyInt(tbuff, &pMissile->_mixvel); - CopyInt(tbuff, &pMissile->_miyvel); - CopyInt(tbuff, &pMissile->_misx); - CopyInt(tbuff, &pMissile->_misy); - CopyInt(tbuff, &pMissile->_mitxoff); - CopyInt(tbuff, &pMissile->_mityoff); - CopyInt(tbuff, &pMissile->_mimfnum); - CopyInt(tbuff, &pMissile->_mispllvl); - CopyInt(tbuff, &pMissile->_miDelFlag); - CopyChar(tbuff, &pMissile->_miAnimType); - tbuff += 3; - - CopyInt(tbuff, &pMissile->_miAnimFlags); - tbuff += 4; - CopyInt(tbuff, &pMissile->_miAnimDelay); - CopyInt(tbuff, &pMissile->_miAnimLen); - CopyInt(tbuff, &pMissile->_miAnimWidth); - CopyInt(tbuff, &pMissile->_miAnimWidth2); - CopyInt(tbuff, &pMissile->_miAnimCnt); - CopyInt(tbuff, &pMissile->_miAnimAdd); - CopyInt(tbuff, &pMissile->_miAnimFrame); - CopyInt(tbuff, &pMissile->_miDrawFlag); - CopyInt(tbuff, &pMissile->_miLightFlag); - CopyInt(tbuff, &pMissile->_miPreFlag); - CopyInt(tbuff, &pMissile->_miUniqTrans); - CopyInt(tbuff, &pMissile->_mirange); - CopyInt(tbuff, &pMissile->_misource); - CopyInt(tbuff, &pMissile->_micaster); - CopyInt(tbuff, &pMissile->_midam); - CopyInt(tbuff, &pMissile->_miHitFlag); - CopyInt(tbuff, &pMissile->_midist); - CopyInt(tbuff, &pMissile->_mlid); - CopyInt(tbuff, &pMissile->_mirnd); - CopyInt(tbuff, &pMissile->_miVar1); - CopyInt(tbuff, &pMissile->_miVar2); - CopyInt(tbuff, &pMissile->_miVar3); - CopyInt(tbuff, &pMissile->_miVar4); - CopyInt(tbuff, &pMissile->_miVar5); - CopyInt(tbuff, &pMissile->_miVar6); - CopyInt(tbuff, &pMissile->_miVar7); - CopyInt(tbuff, &pMissile->_miVar8); -} - -void LoadObject(int i) -{ - ObjectStruct *pObject = &object[i]; - CopyInt(tbuff, &pObject->_otype); - CopyInt(tbuff, &pObject->_ox); - CopyInt(tbuff, &pObject->_oy); - CopyInt(tbuff, &pObject->_oLight); - CopyInt(tbuff, &pObject->_oAnimFlag); - tbuff += 4; - CopyInt(tbuff, &pObject->_oAnimDelay); - CopyInt(tbuff, &pObject->_oAnimCnt); - CopyInt(tbuff, &pObject->_oAnimLen); - CopyInt(tbuff, &pObject->_oAnimFrame); - CopyInt(tbuff, &pObject->_oAnimWidth); - CopyInt(tbuff, &pObject->_oAnimWidth2); - CopyInt(tbuff, &pObject->_oDelFlag); - - CopyChar(tbuff, &pObject->_oBreak); - tbuff += 3; - - CopyInt(tbuff, &pObject->_oSolidFlag); - CopyInt(tbuff, &pObject->_oMissFlag); - - CopyChar(tbuff, &pObject->_oSelFlag); - tbuff += 3; - - CopyInt(tbuff, &pObject->_oPreFlag); - CopyInt(tbuff, &pObject->_oTrapFlag); - CopyInt(tbuff, &pObject->_oDoorFlag); - CopyInt(tbuff, &pObject->_olid); - CopyInt(tbuff, &pObject->_oRndSeed); - CopyInt(tbuff, &pObject->_oVar1); - CopyInt(tbuff, &pObject->_oVar2); - CopyInt(tbuff, &pObject->_oVar3); - CopyInt(tbuff, &pObject->_oVar4); - CopyInt(tbuff, &pObject->_oVar5); - CopyInt(tbuff, &pObject->_oVar6); - CopyInt(tbuff, &pObject->_oVar7); - CopyInt(tbuff, &pObject->_oVar8); -} - -void LoadItem(int i) -{ - CopyItem(&item[i]); - GetItemFrm(i); -} - -void CopyItem(ItemStruct *pItem) -{ - CopyInt(tbuff, &pItem->_iSeed); - CopyShort(tbuff, &pItem->_iCreateInfo); - tbuff += 2; - CopyInt(tbuff, &pItem->_itype); - CopyInt(tbuff, &pItem->_ix); - CopyInt(tbuff, &pItem->_iy); - CopyInt(tbuff, &pItem->_iAnimFlag); - tbuff += 4; // Skip pointer _iAnimData - CopyInt(tbuff, &pItem->_iAnimLen); - CopyInt(tbuff, &pItem->_iAnimFrame); - CopyInt(tbuff, &pItem->_iAnimWidth); - CopyInt(tbuff, &pItem->_iAnimWidth2); - CopyInt(tbuff, &pItem->_isin); - CopyChar(tbuff, &pItem->_iSelFlag); - tbuff += 3; - CopyInt(tbuff, &pItem->_iPostDraw); - CopyInt(tbuff, &pItem->_iIdentified); - CopyChar(tbuff, &pItem->_iMagical); - CopyBytes(tbuff, 64, &pItem->_iName); - CopyBytes(tbuff, 64, &pItem->_iIName); - CopyChar(tbuff, &pItem->_iLoc); - CopyChar(tbuff, &pItem->_iClass); - tbuff += 1; - CopyInt(tbuff, &pItem->_iCurs); - CopyInt(tbuff, &pItem->_ivalue); - CopyInt(tbuff, &pItem->_iIvalue); - CopyInt(tbuff, &pItem->_iMinDam); - CopyInt(tbuff, &pItem->_iMaxDam); - CopyInt(tbuff, &pItem->_iAC); - CopyInt(tbuff, &pItem->_iFlags); - CopyInt(tbuff, &pItem->_iMiscId); - CopyInt(tbuff, &pItem->_iSpell); - CopyInt(tbuff, &pItem->_iCharges); - CopyInt(tbuff, &pItem->_iMaxCharges); - CopyInt(tbuff, &pItem->_iDurability); - CopyInt(tbuff, &pItem->_iMaxDur); - CopyInt(tbuff, &pItem->_iPLDam); - CopyInt(tbuff, &pItem->_iPLToHit); - CopyInt(tbuff, &pItem->_iPLAC); - CopyInt(tbuff, &pItem->_iPLStr); - CopyInt(tbuff, &pItem->_iPLMag); - CopyInt(tbuff, &pItem->_iPLDex); - CopyInt(tbuff, &pItem->_iPLVit); - CopyInt(tbuff, &pItem->_iPLFR); - CopyInt(tbuff, &pItem->_iPLLR); - CopyInt(tbuff, &pItem->_iPLMR); - CopyInt(tbuff, &pItem->_iPLMana); - CopyInt(tbuff, &pItem->_iPLHP); - CopyInt(tbuff, &pItem->_iPLDamMod); - CopyInt(tbuff, &pItem->_iPLGetHit); - CopyInt(tbuff, &pItem->_iPLLight); - CopyChar(tbuff, &pItem->_iSplLvlAdd); - CopyChar(tbuff, &pItem->_iRequest); - tbuff += 2; - CopyInt(tbuff, &pItem->_iUid); - CopyInt(tbuff, &pItem->_iFMinDam); - CopyInt(tbuff, &pItem->_iFMaxDam); - CopyInt(tbuff, &pItem->_iLMinDam); - CopyInt(tbuff, &pItem->_iLMaxDam); - CopyInt(tbuff, &pItem->_iPLEnAc); - CopyChar(tbuff, &pItem->_iPrePower); - CopyChar(tbuff, &pItem->_iSufPower); - tbuff += 2; - CopyInt(tbuff, &pItem->_iVAdd1); - CopyInt(tbuff, &pItem->_iVMult1); - CopyInt(tbuff, &pItem->_iVAdd2); - CopyInt(tbuff, &pItem->_iVMult2); - CopyChar(tbuff, &pItem->_iMinStr); - CopyChar(tbuff, &pItem->_iMinMag); - CopyChar(tbuff, &pItem->_iMinDex); - tbuff += 1; - CopyInt(tbuff, &pItem->_iStatFlag); - CopyInt(tbuff, &pItem->IDidx); - CopyInt(tbuff, &pItem->offs016C); -} - -void CopyItems(const int n, ItemStruct *pItem) -{ - for (int i = 0; i < n; i++) - { - CopyItem(&pItem[i]); - } -} - -void SaveItem(ItemStruct *pItem) -{ - CopyInt(&pItem->_iSeed, tbuff); - CopyShort(&pItem->_iCreateInfo, tbuff); - tbuff += 2; - CopyInt(&pItem->_itype, tbuff); - CopyInt(&pItem->_ix, tbuff); - CopyInt(&pItem->_iy, tbuff); - CopyInt(&pItem->_iAnimFlag, tbuff); - tbuff += 4; // Skip pointer _iAnimData - CopyInt(&pItem->_iAnimLen, tbuff); - CopyInt(&pItem->_iAnimFrame, tbuff); - CopyInt(&pItem->_iAnimWidth, tbuff); - CopyInt(&pItem->_iAnimWidth2, tbuff); // width 2? - CopyInt(&pItem->_isin, tbuff); // set when item is flagged for deletion, deprecated in 1.02 - CopyChar(&pItem->_iSelFlag, tbuff); - tbuff += 3; - CopyInt(&pItem->_iPostDraw, tbuff); - CopyInt(&pItem->_iIdentified, tbuff); - CopyChar(&pItem->_iMagical, tbuff); - CopyBytes(&pItem->_iName, 64, tbuff); - CopyBytes(&pItem->_iIName, 64, tbuff); - CopyChar(&pItem->_iLoc, tbuff); - CopyChar(&pItem->_iClass, tbuff); - tbuff += 1; - CopyInt(&pItem->_iCurs, tbuff); - CopyInt(&pItem->_ivalue, tbuff); - CopyInt(&pItem->_iIvalue, tbuff); - CopyInt(&pItem->_iMinDam, tbuff); - CopyInt(&pItem->_iMaxDam, tbuff); - CopyInt(&pItem->_iAC, tbuff); - CopyInt(&pItem->_iFlags, tbuff); - CopyInt(&pItem->_iMiscId, tbuff); - CopyInt(&pItem->_iSpell, tbuff); - CopyInt(&pItem->_iCharges, tbuff); - CopyInt(&pItem->_iMaxCharges, tbuff); - CopyInt(&pItem->_iDurability, tbuff); - CopyInt(&pItem->_iMaxDur, tbuff); - CopyInt(&pItem->_iPLDam, tbuff); - CopyInt(&pItem->_iPLToHit, tbuff); - CopyInt(&pItem->_iPLAC, tbuff); - CopyInt(&pItem->_iPLStr, tbuff); - CopyInt(&pItem->_iPLMag, tbuff); - CopyInt(&pItem->_iPLDex, tbuff); - CopyInt(&pItem->_iPLVit, tbuff); - CopyInt(&pItem->_iPLFR, tbuff); - CopyInt(&pItem->_iPLLR, tbuff); - CopyInt(&pItem->_iPLMR, tbuff); - CopyInt(&pItem->_iPLMana, tbuff); - CopyInt(&pItem->_iPLHP, tbuff); - CopyInt(&pItem->_iPLDamMod, tbuff); - CopyInt(&pItem->_iPLGetHit, tbuff); - CopyInt(&pItem->_iPLLight, tbuff); - CopyChar(&pItem->_iSplLvlAdd, tbuff); - CopyChar(&pItem->_iRequest, tbuff); - tbuff += 2; - CopyInt(&pItem->_iUid, tbuff); - CopyInt(&pItem->_iFMinDam, tbuff); - CopyInt(&pItem->_iFMaxDam, tbuff); - CopyInt(&pItem->_iLMinDam, tbuff); - CopyInt(&pItem->_iLMaxDam, tbuff); - CopyInt(&pItem->_iPLEnAc, tbuff); - CopyChar(&pItem->_iPrePower, tbuff); - CopyChar(&pItem->_iSufPower, tbuff); - tbuff += 2; - CopyInt(&pItem->_iVAdd1, tbuff); - CopyInt(&pItem->_iVMult1, tbuff); - CopyInt(&pItem->_iVAdd2, tbuff); - CopyInt(&pItem->_iVMult2, tbuff); - CopyChar(&pItem->_iMinStr, tbuff); - CopyChar(&pItem->_iMinMag, tbuff); - CopyChar(&pItem->_iMinDex, tbuff); - tbuff += 1; - CopyInt(&pItem->_iStatFlag, tbuff); - CopyInt(&pItem->IDidx, tbuff); - CopyInt(&pItem->offs016C, tbuff); -} - -void SaveItems(ItemStruct *pItem, const int n) -{ - for (int i = 0; i < n; i++) - { - SaveItem(&pItem[i]); - } -} - -void LoadPremium(int i) -{ - CopyItem(&item[i]); -} - -void LoadQuest(int i) -{ - memcpy(&quests[i], tbuff, sizeof(*quests)); - tbuff += sizeof(*quests); - ReturnLvlX = WLoad(); - ReturnLvlY = WLoad(); - ReturnLvl = WLoad(); - ReturnLvlT = WLoad(); - DoomQuestState = WLoad(); -} - -void LoadLighting(int i) -{ - memcpy(&LightList[i], tbuff, sizeof(*LightList)); - tbuff += sizeof(*LightList); -} - -void LoadVision(int i) -{ - memcpy(&VisionList[i], tbuff, sizeof(*VisionList)); - tbuff += sizeof(*VisionList); -} - -void LoadPortal(int i) -{ - memcpy(&portal[i], tbuff, sizeof(*portal)); - tbuff += sizeof(*portal); -} - -void SaveGame() -{ - int i, j; - char szName[MAX_PATH]; - - DWORD dwLen = codec_get_encoded_len(FILEBUFF); - BYTE *SaveBuff = DiabloAllocPtr(dwLen); - tbuff = SaveBuff; - - ISave('RETL'); - OSave((unsigned char)setlevel); - WSave(setlvlnum); - WSave(currlevel); - WSave((unsigned char)leveltype); - WSave(ViewX); - WSave(ViewY); - OSave(invflag); - OSave(chrflag); - WSave(nummonsters); - WSave(numitems); - WSave(nummissiles); - WSave(nobjects); - - for (i = 0; i < NUMLEVELS; i++) { - ISave(glSeedTbl[i]); - WSave(gnLevelTypeTbl[i]); - } - - SavePlayer(myplr); - - for (i = 0; i < MAXQUESTS; i++) - SaveQuest(i); - for (i = 0; i < MAXPORTAL; i++) - SavePortal(i); - for (i = 0; i < MAXMONSTERS; i++) - ISave(monstkills[i]); - - if (leveltype != DTYPE_TOWN) { - for (i = 0; i < MAXMONSTERS; i++) - WSave(monstactive[i]); - for (i = 0; i < nummonsters; i++) - SaveMonster(monstactive[i]); - for (i = 0; i < MAXMISSILES; i++) - BSave(missileactive[i]); - for (i = 0; i < MAXMISSILES; i++) - BSave(missileavail[i]); - for (i = 0; i < nummissiles; i++) - SaveMissile(missileactive[i]); - for (i = 0; i < MAXOBJECTS; i++) - BSave(objectactive[i]); - for (i = 0; i < MAXOBJECTS; i++) - BSave(objectavail[i]); - for (i = 0; i < nobjects; i++) - SaveObject(objectactive[i]); - - WSave(numlights); - - for (i = 0; i < MAXLIGHTS; i++) - BSave(lightactive[i]); - for (i = 0; i < numlights; i++) - SaveLighting(lightactive[i]); - - WSave(visionid); - WSave(numvision); - - for (i = 0; i < numvision; i++) - SaveVision(i); - } - - for (i = 0; i < MAXITEMS; i++) - BSave(itemactive[i]); - for (i = 0; i < MAXITEMS; i++) - BSave(itemavail[i]); - for (i = 0; i < numitems; i++) - SaveItem(&item[itemactive[i]]); - for (i = 0; i < 128; i++) - OSave(UniqueItemFlag[i]); - - for (j = 0; j < MAXDUNY; j++) { - for (i = 0; i < MAXDUNX; i++) - BSave(dLight[i][j]); - } - for (j = 0; j < MAXDUNY; j++) { - for (i = 0; i < MAXDUNX; i++) - BSave(dFlags[i][j] & ~(BFLAG_MISSILE | BFLAG_VISIBLE | BFLAG_DEAD_PLAYER)); - } - for (j = 0; j < MAXDUNY; j++) { - for (i = 0; i < MAXDUNX; i++) - BSave(dPlayer[i][j]); - } - for (j = 0; j < MAXDUNY; j++) { - for (i = 0; i < MAXDUNX; i++) - BSave(dItem[i][j]); - } - - if (leveltype != DTYPE_TOWN) { - for (j = 0; j < MAXDUNY; j++) { - for (i = 0; i < MAXDUNX; i++) - WSave(dMonster[i][j]); - } - for (j = 0; j < MAXDUNY; j++) { - for (i = 0; i < MAXDUNX; i++) - BSave(dDead[i][j]); - } - for (j = 0; j < MAXDUNY; j++) { - for (i = 0; i < MAXDUNX; i++) - BSave(dObject[i][j]); - } - for (j = 0; j < MAXDUNY; j++) { - for (i = 0; i < MAXDUNX; i++) - BSave(dLight[i][j]); - } - for (j = 0; j < MAXDUNY; j++) { - for (i = 0; i < MAXDUNX; i++) - BSave(dPreLight[i][j]); - } - for (j = 0; j < DMAXY; j++) { - for (i = 0; i < DMAXX; i++) - OSave(automapview[i][j]); - } - for (j = 0; j < MAXDUNY; j++) { - for (i = 0; i < MAXDUNX; i++) - BSave(dMissile[i][j]); - } - } - - WSave(numpremium); - WSave(premiumlevel); - - for (i = 0; i < 6; i++) - SavePremium(i); - - OSave(automapflag); - WSave(AutoMapScale); - pfile_get_game_name(szName); - dwLen = codec_get_encoded_len(tbuff - SaveBuff); - pfile_write_save_file(szName, SaveBuff, tbuff - SaveBuff, dwLen); - mem_free_dbg(SaveBuff); - gbValidSaveFile = TRUE; - pfile_rename_temp_to_perm(); - pfile_write_hero(); -} - -void BSave(char v) -{ - *tbuff++ = v; -} - -void WSave(int v) -{ - *tbuff++ = v >> 24; - *tbuff++ = v >> 16; - *tbuff++ = v >> 8; - *tbuff++ = v; -} - -void ISave(int v) -{ - *tbuff++ = v >> 24; - *tbuff++ = v >> 16; - *tbuff++ = v >> 8; - *tbuff++ = v; -} - -void OSave(BOOL v) -{ - if (v != FALSE) - *tbuff++ = TRUE; - else - *tbuff++ = FALSE; -} - -void SaveMonster(int i) -{ - MonsterStruct *pMonster = &monster[i]; - - CopyInt(&pMonster->_mMTidx, tbuff); - CopyInt(&pMonster->_mmode, tbuff); - - CopyChar(&pMonster->_mgoal, tbuff); - tbuff += 3; - - CopyInt(&pMonster->_mgoalvar1, tbuff); - CopyInt(&pMonster->_mgoalvar2, tbuff); - CopyInt(&pMonster->_mgoalvar3, tbuff); - CopyInt(&pMonster->field_18, tbuff); - - CopyChar(&pMonster->_pathcount, tbuff); - tbuff += 3; - - CopyInt(&pMonster->_mx, tbuff); - CopyInt(&pMonster->_my, tbuff); - CopyInt(&pMonster->_mfutx, tbuff); - CopyInt(&pMonster->_mfuty, tbuff); - CopyInt(&pMonster->_moldx, tbuff); - CopyInt(&pMonster->_moldy, tbuff); - CopyInt(&pMonster->_mxoff, tbuff); - CopyInt(&pMonster->_myoff, tbuff); - CopyInt(&pMonster->_mxvel, tbuff); - CopyInt(&pMonster->_myvel, tbuff); - CopyInt(&pMonster->_mdir, tbuff); - CopyInt(&pMonster->_menemy, tbuff); - - CopyChar(&pMonster->_menemyx, tbuff); - CopyChar(&pMonster->_menemyy, tbuff); - CopyShort(&pMonster->falign_52, tbuff); - - tbuff += 4; // Skip pointer - CopyInt(&pMonster->_mAnimDelay, tbuff); - CopyInt(&pMonster->_mAnimCnt, tbuff); - CopyInt(&pMonster->_mAnimLen, tbuff); - CopyInt(&pMonster->_mAnimFrame, tbuff); - CopyInt(&pMonster->_meflag, tbuff); - CopyInt(&pMonster->_mDelFlag, tbuff); - CopyInt(&pMonster->_mVar1, tbuff); - CopyInt(&pMonster->_mVar2, tbuff); - CopyInt(&pMonster->_mVar3, tbuff); - CopyInt(&pMonster->_mVar4, tbuff); - CopyInt(&pMonster->_mVar5, tbuff); - CopyInt(&pMonster->_mVar6, tbuff); - CopyInt(&pMonster->_mVar7, tbuff); - CopyInt(&pMonster->_mVar8, tbuff); - CopyInt(&pMonster->_mmaxhp, tbuff); - CopyInt(&pMonster->_mhitpoints, tbuff); - - CopyChar(&pMonster->_mAi, tbuff); - CopyChar(&pMonster->_mint, tbuff); - CopyShort(&pMonster->falign_9A, tbuff); - - CopyInt(&pMonster->_mFlags, tbuff); - - CopyChar(&pMonster->_msquelch, tbuff); - tbuff += 3; - - CopyInt(&pMonster->falign_A4, tbuff); - CopyInt(&pMonster->_lastx, tbuff); - CopyInt(&pMonster->_lasty, tbuff); - CopyInt(&pMonster->_mRndSeed, tbuff); - CopyInt(&pMonster->_mAISeed, tbuff); - CopyInt(&pMonster->falign_B8, tbuff); - - CopyChar(&pMonster->_uniqtype, tbuff); - CopyChar(&pMonster->_uniqtrans, tbuff); - CopyChar(&pMonster->_udeadval, tbuff); - CopyChar(&pMonster->mWhoHit, tbuff); - - CopyChar(&pMonster->mLevel, tbuff); - CopyShort(&pMonster->mExp, tbuff); - tbuff += 1; - - CopyChar(&pMonster->mHit, tbuff); - CopyChar(&pMonster->mMinDamage, tbuff); - CopyChar(&pMonster->mMaxDamage, tbuff); - CopyChar(&pMonster->mHit2, tbuff); - - CopyChar(&pMonster->mMinDamage2, tbuff); - CopyChar(&pMonster->mMaxDamage2, tbuff); - CopyChar(&pMonster->mArmorClass, tbuff); - CopyChar(&pMonster->falign_CB, tbuff); - - CopyShort(&pMonster->mMagicRes, tbuff); - tbuff += 2; - - CopyInt(&pMonster->mtalkmsg, tbuff); - - CopyChar(&pMonster->leader, tbuff); - CopyChar(&pMonster->leaderflag, tbuff); - CopyChar(&pMonster->packsize, tbuff); - CopyChar(&pMonster->mlid, tbuff); -} - -void SaveMissile(int i) -{ - MissileStruct *pMissile = &missile[i]; - - CopyInt(&pMissile->_mitype, tbuff); - CopyInt(&pMissile->_mix, tbuff); - CopyInt(&pMissile->_miy, tbuff); - CopyInt(&pMissile->_mixoff, tbuff); - CopyInt(&pMissile->_miyoff, tbuff); - CopyInt(&pMissile->_mixvel, tbuff); - CopyInt(&pMissile->_miyvel, tbuff); - CopyInt(&pMissile->_misx, tbuff); - CopyInt(&pMissile->_misy, tbuff); - CopyInt(&pMissile->_mitxoff, tbuff); - CopyInt(&pMissile->_mityoff, tbuff); - CopyInt(&pMissile->_mimfnum, tbuff); - CopyInt(&pMissile->_mispllvl, tbuff); - CopyInt(&pMissile->_miDelFlag, tbuff); - CopyChar(&pMissile->_miAnimType, tbuff); - tbuff += 3; - - CopyInt(&pMissile->_miAnimFlags, tbuff); - tbuff += 4; - CopyInt(&pMissile->_miAnimDelay, tbuff); - CopyInt(&pMissile->_miAnimLen, tbuff); - CopyInt(&pMissile->_miAnimWidth, tbuff); - CopyInt(&pMissile->_miAnimWidth2, tbuff); - CopyInt(&pMissile->_miAnimCnt, tbuff); - CopyInt(&pMissile->_miAnimAdd, tbuff); - CopyInt(&pMissile->_miAnimFrame, tbuff); - CopyInt(&pMissile->_miDrawFlag, tbuff); - CopyInt(&pMissile->_miLightFlag, tbuff); - CopyInt(&pMissile->_miPreFlag, tbuff); - CopyInt(&pMissile->_miUniqTrans, tbuff); - CopyInt(&pMissile->_mirange, tbuff); - CopyInt(&pMissile->_misource, tbuff); - CopyInt(&pMissile->_micaster, tbuff); - CopyInt(&pMissile->_midam, tbuff); - CopyInt(&pMissile->_miHitFlag, tbuff); - CopyInt(&pMissile->_midist, tbuff); - CopyInt(&pMissile->_mlid, tbuff); - CopyInt(&pMissile->_mirnd, tbuff); - CopyInt(&pMissile->_miVar1, tbuff); - CopyInt(&pMissile->_miVar2, tbuff); - CopyInt(&pMissile->_miVar3, tbuff); - CopyInt(&pMissile->_miVar4, tbuff); - CopyInt(&pMissile->_miVar5, tbuff); - CopyInt(&pMissile->_miVar6, tbuff); - CopyInt(&pMissile->_miVar7, tbuff); - CopyInt(&pMissile->_miVar8, tbuff); -} - -void SaveObject(int i) -{ - ObjectStruct *pObject = &object[i]; - CopyInt(tbuff, &pObject->_otype); - CopyInt(&pObject->_ox, tbuff); - CopyInt(&pObject->_oy, tbuff); - CopyInt(&pObject->_oLight, tbuff); - CopyInt(&pObject->_oAnimFlag, tbuff); - tbuff += 4; - CopyInt(&pObject->_oAnimDelay, tbuff); - CopyInt(&pObject->_oAnimCnt, tbuff); - CopyInt(&pObject->_oAnimLen, tbuff); - CopyInt(&pObject->_oAnimFrame, tbuff); - CopyInt(&pObject->_oAnimWidth, tbuff); - CopyInt(&pObject->_oAnimWidth2, tbuff); - CopyInt(&pObject->_oDelFlag, tbuff); - - CopyChar(&pObject->_oBreak, tbuff); - tbuff += 3; - - CopyInt(&pObject->_oSolidFlag, tbuff); - CopyInt(&pObject->_oMissFlag, tbuff); - - CopyChar(&pObject->_oSelFlag, tbuff); - tbuff += 3; - - CopyInt(&pObject->_oPreFlag, tbuff); - CopyInt(&pObject->_oTrapFlag, tbuff); - CopyInt(&pObject->_oDoorFlag, tbuff); - CopyInt(&pObject->_olid, tbuff); - CopyInt(&pObject->_oRndSeed, tbuff); - CopyInt(&pObject->_oVar1, tbuff); - CopyInt(&pObject->_oVar2, tbuff); - CopyInt(&pObject->_oVar3, tbuff); - CopyInt(&pObject->_oVar4, tbuff); - CopyInt(&pObject->_oVar5, tbuff); - CopyInt(&pObject->_oVar6, tbuff); - CopyInt(&pObject->_oVar7, tbuff); - CopyInt(&pObject->_oVar8, tbuff); -} - -void SavePremium(int i) -{ - SaveItem(&item[i]); -} - -void SaveQuest(int i) -{ - memcpy(tbuff, &quests[i], sizeof(*quests)); - tbuff += sizeof(*quests); - WSave(ReturnLvlX); - WSave(ReturnLvlY); - WSave(ReturnLvl); - WSave(ReturnLvlT); - WSave(DoomQuestState); -} - -void SaveLighting(int i) -{ - memcpy(tbuff, &LightList[i], sizeof(*LightList)); - tbuff += sizeof(*LightList); -} - -void SaveVision(int i) -{ - memcpy(tbuff, &VisionList[i], sizeof(*VisionList)); - tbuff += sizeof(*VisionList); -} - -void SavePortal(int i) -{ - memcpy(tbuff, &portal[i], sizeof(*portal)); - tbuff += sizeof(*portal); -} - -void SaveLevel() -{ - int i, j; - char szName[MAX_PATH]; - int dwLen; - unsigned char *SaveBuff; - - if (!currlevel) - glSeedTbl[0] = GetRndSeed(); - - dwLen = codec_get_encoded_len(FILEBUFF); - SaveBuff = DiabloAllocPtr(dwLen); - tbuff = SaveBuff; - - if (leveltype != DTYPE_TOWN) { - for (j = 0; j < MAXDUNY; j++) { - for (i = 0; i < MAXDUNX; i++) - BSave(dDead[i][j]); - } - } - - WSave(nummonsters); - WSave(numitems); - WSave(nobjects); - - if (leveltype != DTYPE_TOWN) { - for (i = 0; i < MAXMONSTERS; i++) - WSave(monstactive[i]); - for (i = 0; i < nummonsters; i++) - SaveMonster(monstactive[i]); - for (i = 0; i < MAXOBJECTS; i++) - BSave(objectactive[i]); - for (i = 0; i < MAXOBJECTS; i++) - BSave(objectavail[i]); - for (i = 0; i < nobjects; i++) - SaveObject(objectactive[i]); - } - - for (i = 0; i < MAXITEMS; i++) - BSave(itemactive[i]); - for (i = 0; i < MAXITEMS; i++) - BSave(itemavail[i]); - for (i = 0; i < numitems; i++) - SaveItem(&item[itemactive[i]]); - - for (j = 0; j < MAXDUNY; j++) { - for (i = 0; i < MAXDUNX; i++) - BSave(dFlags[i][j] & ~(BFLAG_MISSILE | BFLAG_VISIBLE | BFLAG_DEAD_PLAYER)); - } - for (j = 0; j < MAXDUNY; j++) { - for (i = 0; i < MAXDUNX; i++) - BSave(dItem[i][j]); - } - - if (leveltype != DTYPE_TOWN) { - for (j = 0; j < MAXDUNY; j++) { - for (i = 0; i < MAXDUNX; i++) - WSave(dMonster[i][j]); - } - for (j = 0; j < MAXDUNY; j++) { - for (i = 0; i < MAXDUNX; i++) - BSave(dObject[i][j]); - } - for (j = 0; j < MAXDUNY; j++) { - for (i = 0; i < MAXDUNX; i++) - BSave(dLight[i][j]); - } - for (j = 0; j < MAXDUNY; j++) { - for (i = 0; i < MAXDUNX; i++) - BSave(dPreLight[i][j]); - } - for (j = 0; j < DMAXY; j++) { - for (i = 0; i < DMAXX; i++) - OSave(automapview[i][j]); - } - for (j = 0; j < MAXDUNY; j++) { - for (i = 0; i < MAXDUNX; i++) - BSave(dMissile[i][j]); - } - } - - GetTempLevelNames(szName); - dwLen = codec_get_encoded_len(tbuff - SaveBuff); - pfile_write_save_file(szName, SaveBuff, tbuff - SaveBuff, dwLen); - mem_free_dbg(SaveBuff); - - if (setlevel == 0) - plr[myplr]._pLvlVisited[currlevel] = 1; - else - plr[myplr]._pSLvlVisited[setlvlnum] = 1; -} - -void LoadLevel() -{ - int i, j; - DWORD dwLen; - char szName[MAX_PATH]; - BYTE *LoadBuff; - - GetPermLevelNames(szName); - LoadBuff = pfile_read(szName, &dwLen); - tbuff = LoadBuff; - - if (leveltype != DTYPE_TOWN) { - for (j = 0; j < MAXDUNY; j++) { - for (i = 0; i < MAXDUNX; i++) - dDead[i][j] = BLoad(); - } - SetDead(); - } - - nummonsters = WLoad(); - numitems = WLoad(); - nobjects = WLoad(); - - if (leveltype != DTYPE_TOWN) { - for (i = 0; i < MAXMONSTERS; i++) - monstactive[i] = WLoad(); - for (i = 0; i < nummonsters; i++) - LoadMonster(monstactive[i]); - for (i = 0; i < MAXOBJECTS; i++) - objectactive[i] = BLoad(); - for (i = 0; i < MAXOBJECTS; i++) - objectavail[i] = BLoad(); - for (i = 0; i < nobjects; i++) - LoadObject(objectactive[i]); - for (i = 0; i < nobjects; i++) - SyncObjectAnim(objectactive[i]); - } - - for (i = 0; i < MAXITEMS; i++) - itemactive[i] = BLoad(); - for (i = 0; i < MAXITEMS; i++) - itemavail[i] = BLoad(); - for (i = 0; i < numitems; i++) - LoadItem(itemactive[i]); - - for (j = 0; j < MAXDUNY; j++) { - for (i = 0; i < MAXDUNX; i++) - dFlags[i][j] = BLoad(); - } - for (j = 0; j < MAXDUNY; j++) { - for (i = 0; i < MAXDUNX; i++) - dItem[i][j] = BLoad(); - } - - if (leveltype != DTYPE_TOWN) { - for (j = 0; j < MAXDUNY; j++) { - for (i = 0; i < MAXDUNX; i++) - dMonster[i][j] = WLoad(); - } - for (j = 0; j < MAXDUNY; j++) { - for (i = 0; i < MAXDUNX; i++) - dObject[i][j] = BLoad(); - } - for (j = 0; j < MAXDUNY; j++) { - for (i = 0; i < MAXDUNX; i++) - dLight[i][j] = BLoad(); - } - for (j = 0; j < MAXDUNY; j++) { - for (i = 0; i < MAXDUNX; i++) - dPreLight[i][j] = BLoad(); - } - for (j = 0; j < DMAXY; j++) { - for (i = 0; i < DMAXX; i++) - automapview[i][j] = OLoad(); - } - for (j = 0; j < MAXDUNY; j++) { - for (i = 0; i < MAXDUNX; i++) - dMissile[i][j] = 0; /// BUGFIX: supposed to load saved missiles with "BLoad()"? - } - } - - AutomapZoomReset(); - ResyncQuests(); - SyncPortals(); - dolighting = 1; - - for (i = 0; i < MAX_PLRS; i++) { - if (plr[i].plractive && currlevel == plr[i].plrlevel) - LightList[plr[i]._plid]._lunflag = 1; - } - - mem_free_dbg(LoadBuff); -} - -DEVILUTION_END_NAMESPACE +#include "diablo.h" + +DEVILUTION_BEGIN_NAMESPACE + +BYTE *tbuff; + +void LoadGame(BOOL firstflag) +{ + int i, j; + DWORD dwLen; + char szName[MAX_PATH]; + BYTE *LoadBuff; + int _ViewX, _ViewY, _nummonsters, _numitems, _nummissiles, _nobjects; + + FreeGameMem(); + pfile_remove_temp_files(); + pfile_get_game_name(szName); + LoadBuff = pfile_read(szName, &dwLen); + tbuff = LoadBuff; + + if (ILoad() != 'RETL') + app_fatal("Invalid save file"); + + setlevel = OLoad(); + setlvlnum = WLoad(); + currlevel = WLoad(); + leveltype = WLoad(); + _ViewX = WLoad(); + _ViewY = WLoad(); + invflag = OLoad(); + chrflag = OLoad(); + _nummonsters = WLoad(); + _numitems = WLoad(); + _nummissiles = WLoad(); + _nobjects = WLoad(); + + for (i = 0; i < NUMLEVELS; i++) { + glSeedTbl[i] = ILoad(); + gnLevelTypeTbl[i] = WLoad(); + } + + LoadPlayer(myplr); + + for (i = 0; i < MAXQUESTS; i++) + LoadQuest(i); + for (i = 0; i < MAXPORTAL; i++) + LoadPortal(i); + + LoadGameLevel(firstflag, 4); + SyncInitPlr(myplr); + SyncPlrAnim(myplr); + + ViewX = _ViewX; + ViewY = _ViewY; + nummonsters = _nummonsters; + numitems = _numitems; + nummissiles = _nummissiles; + nobjects = _nobjects; + + for (i = 0; i < MAXMONSTERS; i++) + monstkills[i] = ILoad(); + + if (leveltype != DTYPE_TOWN) { + for (i = 0; i < MAXMONSTERS; i++) + monstactive[i] = WLoad(); + for (i = 0; i < nummonsters; i++) + LoadMonster(monstactive[i]); + for (i = 0; i < MAXMISSILES; i++) + missileactive[i] = BLoad(); + for (i = 0; i < MAXMISSILES; i++) + missileavail[i] = BLoad(); + for (i = 0; i < nummissiles; i++) + LoadMissile(missileactive[i]); + for (i = 0; i < MAXOBJECTS; i++) + objectactive[i] = BLoad(); + for (i = 0; i < MAXOBJECTS; i++) + objectavail[i] = BLoad(); + for (i = 0; i < nobjects; i++) + LoadObject(objectactive[i]); + for (i = 0; i < nobjects; i++) + SyncObjectAnim(objectactive[i]); + + numlights = WLoad(); + + for (i = 0; i < MAXLIGHTS; i++) + lightactive[i] = BLoad(); + for (i = 0; i < numlights; i++) + LoadLighting(lightactive[i]); + + visionid = WLoad(); + numvision = WLoad(); + + for (i = 0; i < numvision; i++) + LoadVision(i); + } + + for (i = 0; i < MAXITEMS; i++) + itemactive[i] = BLoad(); + for (i = 0; i < MAXITEMS; i++) + itemavail[i] = BLoad(); + for (i = 0; i < numitems; i++) + LoadItem(itemactive[i]); + for (i = 0; i < 128; i++) + UniqueItemFlag[i] = OLoad(); + + for (j = 0; j < MAXDUNY; j++) { + for (i = 0; i < MAXDUNX; i++) + dLight[i][j] = BLoad(); + } + for (j = 0; j < MAXDUNY; j++) { + for (i = 0; i < MAXDUNX; i++) + dFlags[i][j] = BLoad(); + } + for (j = 0; j < MAXDUNY; j++) { + for (i = 0; i < MAXDUNX; i++) + dPlayer[i][j] = BLoad(); + } + for (j = 0; j < MAXDUNY; j++) { + for (i = 0; i < MAXDUNX; i++) + dItem[i][j] = BLoad(); + } + + if (leveltype != DTYPE_TOWN) { + for (j = 0; j < MAXDUNY; j++) { + for (i = 0; i < MAXDUNX; i++) + dMonster[i][j] = WLoad(); + } + for (j = 0; j < MAXDUNY; j++) { + for (i = 0; i < MAXDUNX; i++) + dDead[i][j] = BLoad(); + } + for (j = 0; j < MAXDUNY; j++) { + for (i = 0; i < MAXDUNX; i++) + dObject[i][j] = BLoad(); + } + for (j = 0; j < MAXDUNY; j++) { + for (i = 0; i < MAXDUNX; i++) + dLight[i][j] = BLoad(); + } + for (j = 0; j < MAXDUNY; j++) { + for (i = 0; i < MAXDUNX; i++) + dPreLight[i][j] = BLoad(); + } + for (j = 0; j < DMAXY; j++) { + for (i = 0; i < DMAXX; i++) + automapview[i][j] = OLoad(); + } + for (j = 0; j < MAXDUNY; j++) { + for (i = 0; i < MAXDUNX; i++) + dMissile[i][j] = BLoad(); + } + } + + numpremium = WLoad(); + premiumlevel = WLoad(); + + for (i = 0; i < 6; i++) + LoadPremium(i); + + automapflag = OLoad(); + AutoMapScale = WLoad(); + mem_free_dbg(LoadBuff); + AutomapZoomReset(); + ResyncQuests(); + + if (leveltype != DTYPE_TOWN) + ProcessLightList(); + + RedoPlayerVision(); + ProcessVisionList(); + missiles_process_charge(); + ResetPal(); + SetCursor_(CURSOR_HAND); + gbProcessPlayers = TRUE; +} + +char BLoad() +{ + return *tbuff++; +} + +int WLoad() +{ + int rv = *tbuff++ << 24; + rv |= *tbuff++ << 16; + rv |= *tbuff++ << 8; + rv |= *tbuff++; + + return rv; +} + +int ILoad() +{ + int rv = *tbuff++ << 24; + rv |= *tbuff++ << 16; + rv |= *tbuff++ << 8; + rv |= *tbuff++; + + return rv; +} + +BOOL OLoad() +{ + if (*tbuff++ == TRUE) + return TRUE; + else + return FALSE; +} + +void CopyInt(const void *src, void *dst) +{ + memcpy(dst, src, 4); + tbuff += 4; +} + +void CopyShort(const void *src, void *dst) +{ + memcpy(dst, src, 2); + tbuff += 2; +} + +void CopyShorts(const void *src, const int n, void *dst) +{ + memcpy(dst, src, 2 * n); + tbuff += 2 * n; +} + +void CopyInts(const void *src, const int n, void *dst) +{ + memcpy(dst, src, 4 * n); + tbuff += 4 * n; +} + +void CopyBytes(const void *src, const int n, void *dst) +{ + memcpy(dst, src, n); + tbuff += n; +} + +void CopyChar(const void *src, void *dst) +{ + memcpy(dst, src, 1); + tbuff += 1; +} + +void CopyInt64(const void *src, void *dst) +{ + memcpy(dst, src, 8); + tbuff += 8; +} + +void LoadPlayer(int i) +{ + PlayerStruct *pPlayer = &plr[i]; + + CopyInt(tbuff, &pPlayer->_pmode); + + CopyBytes(tbuff, 25, pPlayer->walkpath); + CopyBytes(tbuff, 1, &pPlayer->plractive); + tbuff += 2; + + CopyInt(tbuff, &pPlayer->destAction); + CopyInt(tbuff, &pPlayer->destParam1); + CopyInt(tbuff, &pPlayer->destParam2); + CopyInt(tbuff, &pPlayer->destParam3); + CopyInt(tbuff, &pPlayer->destParam4); + CopyInt(tbuff, &pPlayer->plrlevel); + CopyInt(tbuff, &pPlayer->WorldX); + CopyInt(tbuff, &pPlayer->WorldY); + CopyInt(tbuff, &pPlayer->_px); + CopyInt(tbuff, &pPlayer->_py); + CopyInt(tbuff, &pPlayer->_ptargx); + CopyInt(tbuff, &pPlayer->_ptargy); + CopyInt(tbuff, &pPlayer->_pownerx); + CopyInt(tbuff, &pPlayer->_pownery); + CopyInt(tbuff, &pPlayer->_poldx); + CopyInt(tbuff, &pPlayer->_poldy); + CopyInt(tbuff, &pPlayer->_pxoff); + CopyInt(tbuff, &pPlayer->_pyoff); + CopyInt(tbuff, &pPlayer->_pxvel); + CopyInt(tbuff, &pPlayer->_pyvel); + CopyInt(tbuff, &pPlayer->_pdir); + CopyInt(tbuff, &pPlayer->_nextdir); + CopyInt(tbuff, &pPlayer->_pgfxnum); + tbuff += 4; // Skip pointers + CopyInt(tbuff, &pPlayer->_pAnimDelay); + CopyInt(tbuff, &pPlayer->_pAnimCnt); + CopyInt(tbuff, &pPlayer->_pAnimLen); + CopyInt(tbuff, &pPlayer->_pAnimFrame); + CopyInt(tbuff, &pPlayer->_pAnimWidth); + CopyInt(tbuff, &pPlayer->_pAnimWidth2); + CopyInt(tbuff, &pPlayer->_peflag); + CopyInt(tbuff, &pPlayer->_plid); + CopyInt(tbuff, &pPlayer->_pvid); + + CopyInt(tbuff, &pPlayer->_pSpell); + CopyChar(tbuff, &pPlayer->_pSplType); + CopyChar(tbuff, &pPlayer->_pSplFrom); + tbuff += 2; + CopyInt(tbuff, &pPlayer->_pTSpell); + CopyChar(tbuff, &pPlayer->_pTSplType); + tbuff += 3; + CopyInt(tbuff, &pPlayer->_pRSpell); + CopyChar(tbuff, &pPlayer->_pRSplType); + tbuff += 3; + CopyInt(tbuff, &pPlayer->_pSBkSpell); + CopyChar(tbuff, &pPlayer->_pSBkSplType); + + CopyBytes(tbuff, 64, &pPlayer->_pSplLvl); + tbuff += 7; + CopyInt64(tbuff, &pPlayer->_pMemSpells); + CopyInt64(tbuff, &pPlayer->_pAblSpells); + CopyInt64(tbuff, &pPlayer->_pScrlSpells); + CopyChar(tbuff, &pPlayer->_pSpellFlags); + tbuff += 3; + CopyInts(tbuff, 4, &pPlayer->_pSplHotKey); + CopyBytes(tbuff, 4, &pPlayer->_pSplTHotKey); + CopyInt(tbuff, &pPlayer->_pwtype); + CopyChar(tbuff, &pPlayer->_pBlockFlag); + CopyChar(tbuff, &pPlayer->_pInvincible); + CopyChar(tbuff, &pPlayer->_pLightRad); + CopyChar(tbuff, &pPlayer->_pLvlChanging); + CopyBytes(tbuff, PLR_NAME_LEN, &pPlayer->_pName); + CopyChar(tbuff, &pPlayer->_pClass); + tbuff += 3; + CopyInt(tbuff, &pPlayer->_pStrength); + CopyInt(tbuff, &pPlayer->_pBaseStr); + CopyInt(tbuff, &pPlayer->_pMagic); + CopyInt(tbuff, &pPlayer->_pBaseMag); + CopyInt(tbuff, &pPlayer->_pDexterity); + CopyInt(tbuff, &pPlayer->_pBaseDex); + CopyInt(tbuff, &pPlayer->_pVitality); + CopyInt(tbuff, &pPlayer->_pBaseVit); + CopyInt(tbuff, &pPlayer->_pStatPts); + CopyInt(tbuff, &pPlayer->_pDamageMod); + CopyInt(tbuff, &pPlayer->_pBaseToBlk); + CopyInt(tbuff, &pPlayer->_pHPBase); + CopyInt(tbuff, &pPlayer->_pMaxHPBase); + CopyInt(tbuff, &pPlayer->_pHitPoints); + CopyInt(tbuff, &pPlayer->_pMaxHP); + CopyInt(tbuff, &pPlayer->_pHPPer); + CopyInt(tbuff, &pPlayer->_pManaBase); + CopyInt(tbuff, &pPlayer->_pMaxManaBase); + CopyInt(tbuff, &pPlayer->_pMana); + CopyInt(tbuff, &pPlayer->_pMaxMana); + CopyInt(tbuff, &pPlayer->_pManaPer); + CopyChar(tbuff, &pPlayer->_pLevel); + CopyChar(tbuff, &pPlayer->_pMaxLvl); + tbuff += 2; + CopyInt(tbuff, &pPlayer->_pExperience); + CopyInt(tbuff, &pPlayer->_pMaxExp); + CopyInt(tbuff, &pPlayer->_pNextExper); + CopyChar(tbuff, &pPlayer->_pArmorClass); + CopyChar(tbuff, &pPlayer->_pMagResist); + CopyChar(tbuff, &pPlayer->_pFireResist); + CopyChar(tbuff, &pPlayer->_pLghtResist); + CopyInt(tbuff, &pPlayer->_pGold); + CopyInt(tbuff, &pPlayer->_pInfraFlag); + CopyInt(tbuff, &pPlayer->_pVar1); + CopyInt(tbuff, &pPlayer->_pVar2); + CopyInt(tbuff, &pPlayer->_pVar3); + CopyInt(tbuff, &pPlayer->_pVar4); + CopyInt(tbuff, &pPlayer->_pVar5); + CopyInt(tbuff, &pPlayer->_pVar6); + CopyInt(tbuff, &pPlayer->_pVar7); + CopyInt(tbuff, &pPlayer->_pVar8); + CopyBytes(tbuff, NUMLEVELS, &pPlayer->_pLvlVisited); + CopyBytes(tbuff, NUMLEVELS, &pPlayer->_pSLvlVisited); + tbuff += 2; + CopyInt(tbuff, &pPlayer->_pGFXLoad); + + tbuff += sizeof(__uint32_t) * 8; + CopyInt(tbuff, &pPlayer->_pNFrames); + CopyInt(tbuff, &pPlayer->_pNWidth); + + tbuff += sizeof(__uint32_t) * 8; + + CopyInt(tbuff, &pPlayer->_pWFrames); + CopyInt(tbuff, &pPlayer->_pWWidth); + + tbuff += sizeof(__uint32_t) * 8; + + CopyInt(tbuff, &pPlayer->_pAFrames); + CopyInt(tbuff, &pPlayer->_pAWidth); + CopyInt(tbuff, &pPlayer->_pAFNum); + + tbuff += sizeof(__uint32_t) * 24; + + CopyInt(tbuff, &pPlayer->_pSFrames); + CopyInt(tbuff, &pPlayer->_pSWidth); + CopyInt(tbuff, &pPlayer->_pSFNum); + + tbuff += sizeof(__uint32_t) * 8; + + CopyInt(tbuff, &pPlayer->_pHFrames); + CopyInt(tbuff, &pPlayer->_pHWidth); + + tbuff += sizeof(__uint32_t) * 8; + + CopyInt(tbuff, &pPlayer->_pDFrames); + CopyInt(tbuff, &pPlayer->_pDWidth); + + tbuff += sizeof(__uint32_t) * 8; + + CopyInt(tbuff, &pPlayer->_pBFrames); + CopyInt(tbuff, &pPlayer->_pBWidth); + CopyItems(NUM_INVLOC, pPlayer->InvBody); + CopyItems(NUM_INV_GRID_ELEM, pPlayer->InvList); + CopyInt(tbuff, &pPlayer->_pNumInv); + CopyBytes(tbuff, NUM_INV_GRID_ELEM, pPlayer->InvGrid); + CopyItems(MAXBELTITEMS, pPlayer->SpdList); + CopyItem(&pPlayer->HoldItem); + CopyInt(tbuff, &pPlayer->_pIMinDam); + CopyInt(tbuff, &pPlayer->_pIMaxDam); + CopyInt(tbuff, &pPlayer->_pIAC); + CopyInt(tbuff, &pPlayer->_pIBonusDam); + CopyInt(tbuff, &pPlayer->_pIBonusToHit); + CopyInt(tbuff, &pPlayer->_pIBonusAC); + CopyInt(tbuff, &pPlayer->_pIBonusDamMod); + tbuff += 4; + CopyInt64(tbuff, &pPlayer->_pISpells); + CopyInt(tbuff, &pPlayer->_pIFlags); + CopyInt(tbuff, &pPlayer->_pIGetHit); + + CopyChar(tbuff, &pPlayer->_pISplLvlAdd); + CopyChar(tbuff, &pPlayer->_pISplCost); + tbuff += 2; + + CopyInt(tbuff, &pPlayer->_pISplDur); + CopyInt(tbuff, &pPlayer->_pIEnAc); + CopyInt(tbuff, &pPlayer->_pIFMinDam); + CopyInt(tbuff, &pPlayer->_pIFMaxDam); + CopyInt(tbuff, &pPlayer->_pILMinDam); + CopyInt(tbuff, &pPlayer->_pILMaxDam); + CopyInt(tbuff, &pPlayer->_pOilType); + + CopyChar(tbuff, &pPlayer->pTownWarps); + CopyChar(tbuff, &pPlayer->pDungMsgs); + CopyChar(tbuff, &pPlayer->pLvlLoad); + CopyChar(tbuff, &pPlayer->pBattleNet); + + CopyChar(tbuff, &pPlayer->pManaShield); + CopyBytes(tbuff, 3, &pPlayer->bReserved); + + CopyShorts(tbuff, 8, &pPlayer->wReserved); + + CopyInt(tbuff, &pPlayer->pDiabloKillLevel); + CopyInts(tbuff, 7, &pPlayer->dwReserved); + + // Omit 10 pointers +} + +void SavePlayer(int i) +{ + PlayerStruct *pPlayer = &plr[i]; + + CopyInt(&pPlayer->_pmode, tbuff); + + CopyBytes(&pPlayer->walkpath, 25, tbuff); + CopyBytes(&pPlayer->plractive, 1, tbuff); + tbuff += 2; + + CopyInt(&pPlayer->destAction, tbuff); + CopyInt(&pPlayer->destParam1, tbuff); + CopyInt(&pPlayer->destParam2, tbuff); + CopyInt(&pPlayer->destParam3, tbuff); + CopyInt(&pPlayer->destParam4, tbuff); + CopyInt(&pPlayer->plrlevel, tbuff); + CopyInt(&pPlayer->WorldX, tbuff); + CopyInt(&pPlayer->WorldY, tbuff); + CopyInt(&pPlayer->_px, tbuff); + CopyInt(&pPlayer->_py, tbuff); + CopyInt(&pPlayer->_ptargx, tbuff); + CopyInt(&pPlayer->_ptargy, tbuff); + CopyInt(&pPlayer->_pownerx, tbuff); + CopyInt(&pPlayer->_pownery, tbuff); + CopyInt(&pPlayer->_poldx, tbuff); + CopyInt(&pPlayer->_poldy, tbuff); + CopyInt(&pPlayer->_pxoff, tbuff); + CopyInt(&pPlayer->_pyoff, tbuff); + CopyInt(&pPlayer->_pxvel, tbuff); + CopyInt(&pPlayer->_pyvel, tbuff); + CopyInt(&pPlayer->_pdir, tbuff); + CopyInt(&pPlayer->_nextdir, tbuff); + CopyInt(&pPlayer->_pgfxnum, tbuff); + tbuff += 4; // Skip pointers + CopyInt(&pPlayer->_pAnimDelay, tbuff); + CopyInt(&pPlayer->_pAnimCnt, tbuff); + CopyInt(&pPlayer->_pAnimLen, tbuff); + CopyInt(&pPlayer->_pAnimFrame, tbuff); + CopyInt(&pPlayer->_pAnimWidth, tbuff); + CopyInt(&pPlayer->_pAnimWidth2, tbuff); + CopyInt(&pPlayer->_peflag, tbuff); + CopyInt(&pPlayer->_plid, tbuff); + CopyInt(&pPlayer->_pvid, tbuff); + + CopyInt(&pPlayer->_pSpell, tbuff); + + CopyChar(&pPlayer->_pSplType, tbuff); + CopyChar(&pPlayer->_pSplFrom, tbuff); + tbuff += 2; + + CopyInt(&pPlayer->_pTSpell, tbuff); + CopyChar(&pPlayer->_pTSplType, tbuff); + tbuff += 3; + CopyInt(&pPlayer->_pRSpell, tbuff); + CopyChar(&pPlayer->_pRSplType, tbuff); + tbuff += 3; + CopyInt(&pPlayer->_pSBkSpell, tbuff); + CopyChar(&pPlayer->_pSBkSplType, tbuff); + + CopyBytes(&pPlayer->_pSplLvl, 64, tbuff); + tbuff += 7; + CopyInt64(&pPlayer->_pMemSpells, tbuff); + CopyInt64(&pPlayer->_pAblSpells, tbuff); + CopyInt64(&pPlayer->_pScrlSpells, tbuff); + CopyChar(&pPlayer->_pSpellFlags, tbuff); + tbuff += 3; + CopyInts(&pPlayer->_pSplHotKey, 4, tbuff); + CopyBytes(&pPlayer->_pSplTHotKey, 4, tbuff); + CopyInt(&pPlayer->_pwtype, tbuff); + CopyChar(&pPlayer->_pBlockFlag, tbuff); + CopyChar(&pPlayer->_pInvincible, tbuff); + CopyChar(&pPlayer->_pLightRad, tbuff); + CopyChar(&pPlayer->_pLvlChanging, tbuff); + CopyBytes(&pPlayer->_pName, PLR_NAME_LEN, tbuff); + CopyChar(&pPlayer->_pClass, tbuff); + tbuff += 3; + CopyInt(&pPlayer->_pStrength, tbuff); + CopyInt(&pPlayer->_pBaseStr, tbuff); + CopyInt(&pPlayer->_pMagic, tbuff); + CopyInt(&pPlayer->_pBaseMag, tbuff); + CopyInt(&pPlayer->_pDexterity, tbuff); + CopyInt(&pPlayer->_pBaseDex, tbuff); + CopyInt(&pPlayer->_pVitality, tbuff); + CopyInt(&pPlayer->_pBaseVit, tbuff); + CopyInt(&pPlayer->_pStatPts, tbuff); + CopyInt(&pPlayer->_pDamageMod, tbuff); + CopyInt(&pPlayer->_pBaseToBlk, tbuff); + CopyInt(&pPlayer->_pHPBase, tbuff); + CopyInt(&pPlayer->_pMaxHPBase, tbuff); + CopyInt(&pPlayer->_pHitPoints, tbuff); + CopyInt(&pPlayer->_pMaxHP, tbuff); + CopyInt(&pPlayer->_pHPPer, tbuff); + CopyInt(&pPlayer->_pManaBase, tbuff); + CopyInt(&pPlayer->_pMaxManaBase, tbuff); + CopyInt(&pPlayer->_pMana, tbuff); + CopyInt(&pPlayer->_pMaxMana, tbuff); + CopyInt(&pPlayer->_pManaPer, tbuff); + CopyChar(&pPlayer->_pLevel, tbuff); + CopyChar(&pPlayer->_pMaxLvl, tbuff); + tbuff += 2; + CopyInt(&pPlayer->_pExperience, tbuff); + CopyInt(&pPlayer->_pMaxExp, tbuff); + CopyInt(&pPlayer->_pNextExper, tbuff); + CopyChar(&pPlayer->_pArmorClass, tbuff); + CopyChar(&pPlayer->_pMagResist, tbuff); + CopyChar(&pPlayer->_pFireResist, tbuff); + CopyChar(&pPlayer->_pLghtResist, tbuff); + CopyInt(&pPlayer->_pGold, tbuff); + CopyInt(&pPlayer->_pInfraFlag, tbuff); + CopyInt(&pPlayer->_pVar1, tbuff); + CopyInt(&pPlayer->_pVar2, tbuff); + CopyInt(&pPlayer->_pVar3, tbuff); + CopyInt(&pPlayer->_pVar4, tbuff); + CopyInt(&pPlayer->_pVar5, tbuff); + CopyInt(&pPlayer->_pVar6, tbuff); + CopyInt(&pPlayer->_pVar7, tbuff); + CopyInt(&pPlayer->_pVar8, tbuff); + CopyBytes(&pPlayer->_pLvlVisited, NUMLEVELS, tbuff); + CopyBytes(&pPlayer->_pSLvlVisited, NUMLEVELS, tbuff); // only 10 used + tbuff += 2; + CopyInt(&pPlayer->_pGFXLoad, tbuff); + + tbuff += sizeof(__uint32_t) * 8; // Skip 8 pointers + CopyInt(&pPlayer->_pNFrames, tbuff); + CopyInt(&pPlayer->_pNWidth, tbuff); + + tbuff += sizeof(__uint32_t) * 8; // Skip 8 pointers + + CopyInt(&pPlayer->_pWFrames, tbuff); + CopyInt(&pPlayer->_pWWidth, tbuff); + + tbuff += sizeof(__uint32_t) * 8; // Skip 8 pointers + + CopyInt(&pPlayer->_pAFrames, tbuff); + CopyInt(&pPlayer->_pAWidth, tbuff); + CopyInt(&pPlayer->_pAFNum, tbuff); + + tbuff += sizeof(__uint32_t) * 24; // Skip 24 pointers + + CopyInt(&pPlayer->_pSFrames, tbuff); + CopyInt(&pPlayer->_pSWidth, tbuff); + CopyInt(&pPlayer->_pSFNum, tbuff); + + tbuff += sizeof(__uint32_t) * 8; // Skip 8 pointers + + CopyInt(&pPlayer->_pHFrames, tbuff); + CopyInt(&pPlayer->_pHWidth, tbuff); + + tbuff += sizeof(__uint32_t) * 8; // Skip 8 pointers + + CopyInt(&pPlayer->_pDFrames, tbuff); + CopyInt(&pPlayer->_pDWidth, tbuff); + + tbuff += sizeof(__uint32_t) * 8; // Skip 8 pointers + + CopyInt(&pPlayer->_pBFrames, tbuff); + CopyInt(&pPlayer->_pBWidth, tbuff); + SaveItems(pPlayer->InvBody, NUM_INVLOC); + SaveItems(pPlayer->InvList, NUM_INV_GRID_ELEM); + CopyInt(&pPlayer->_pNumInv, tbuff); + CopyBytes(pPlayer->InvGrid, NUM_INV_GRID_ELEM, tbuff); + SaveItems(pPlayer->SpdList, MAXBELTITEMS); + SaveItem(&pPlayer->HoldItem); + CopyInt(&pPlayer->_pIMinDam, tbuff); + CopyInt(&pPlayer->_pIMaxDam, tbuff); + CopyInt(&pPlayer->_pIAC, tbuff); + CopyInt(&pPlayer->_pIBonusDam, tbuff); + CopyInt(&pPlayer->_pIBonusToHit, tbuff); + CopyInt(&pPlayer->_pIBonusAC, tbuff); + CopyInt(&pPlayer->_pIBonusDamMod, tbuff); + tbuff += 4; + CopyInt64(&pPlayer->_pISpells, tbuff); + CopyInt(&pPlayer->_pIFlags, tbuff); + CopyInt(&pPlayer->_pIGetHit, tbuff); + + CopyChar(&pPlayer->_pISplLvlAdd, tbuff); + CopyChar(&pPlayer->_pISplCost, tbuff); + tbuff += 2; + + CopyInt(&pPlayer->_pISplDur, tbuff); + CopyInt(&pPlayer->_pIEnAc, tbuff); + CopyInt(&pPlayer->_pIFMinDam, tbuff); + CopyInt(&pPlayer->_pIFMaxDam, tbuff); + CopyInt(&pPlayer->_pILMinDam, tbuff); + CopyInt(&pPlayer->_pILMaxDam, tbuff); + CopyInt(&pPlayer->_pOilType, tbuff); + + CopyChar(&pPlayer->pTownWarps, tbuff); + CopyChar(&pPlayer->pDungMsgs, tbuff); + CopyChar(&pPlayer->pLvlLoad, tbuff); + CopyChar(&pPlayer->pBattleNet, tbuff); + + CopyChar(&pPlayer->pManaShield, tbuff); + CopyBytes(&pPlayer->bReserved, 3, tbuff); + + CopyShorts(&pPlayer->wReserved, 8, tbuff); + + CopyInt(&pPlayer->pDiabloKillLevel, tbuff); + CopyInts(&pPlayer->dwReserved, 7, tbuff); + + // Omit 10 pointers +} + +void LoadMonster(int i) +{ + MonsterStruct *pMonster = &monster[i]; + + CopyInt(tbuff, &pMonster->_mMTidx); + CopyInt(tbuff, &pMonster->_mmode); + + CopyChar(tbuff, &pMonster->_mgoal); + tbuff += 3; + + CopyInt(tbuff, &pMonster->_mgoalvar1); + CopyInt(tbuff, &pMonster->_mgoalvar2); + CopyInt(tbuff, &pMonster->_mgoalvar3); + CopyInt(tbuff, &pMonster->field_18); + + CopyChar(tbuff, &pMonster->_pathcount); + tbuff += 3; + + CopyInt(tbuff, &pMonster->_mx); + CopyInt(tbuff, &pMonster->_my); + CopyInt(tbuff, &pMonster->_mfutx); + CopyInt(tbuff, &pMonster->_mfuty); + CopyInt(tbuff, &pMonster->_moldx); + CopyInt(tbuff, &pMonster->_moldy); + CopyInt(tbuff, &pMonster->_mxoff); + CopyInt(tbuff, &pMonster->_myoff); + CopyInt(tbuff, &pMonster->_mxvel); + CopyInt(tbuff, &pMonster->_myvel); + CopyInt(tbuff, &pMonster->_mdir); + CopyInt(tbuff, &pMonster->_menemy); + + CopyChar(tbuff, &pMonster->_menemyx); + CopyChar(tbuff, &pMonster->_menemyy); + CopyShort(tbuff, &pMonster->falign_52); + + tbuff += 4; // Skip pointer + CopyInt(tbuff, &pMonster->_mAnimDelay); + CopyInt(tbuff, &pMonster->_mAnimCnt); + CopyInt(tbuff, &pMonster->_mAnimLen); + CopyInt(tbuff, &pMonster->_mAnimFrame); + CopyInt(tbuff, &pMonster->_meflag); + CopyInt(tbuff, &pMonster->_mDelFlag); + CopyInt(tbuff, &pMonster->_mVar1); + CopyInt(tbuff, &pMonster->_mVar2); + CopyInt(tbuff, &pMonster->_mVar3); + CopyInt(tbuff, &pMonster->_mVar4); + CopyInt(tbuff, &pMonster->_mVar5); + CopyInt(tbuff, &pMonster->_mVar6); + CopyInt(tbuff, &pMonster->_mVar7); + CopyInt(tbuff, &pMonster->_mVar8); + CopyInt(tbuff, &pMonster->_mmaxhp); + CopyInt(tbuff, &pMonster->_mhitpoints); + + CopyChar(tbuff, &pMonster->_mAi); + CopyChar(tbuff, &pMonster->_mint); + CopyShort(tbuff, &pMonster->falign_9A); + + CopyInt(tbuff, &pMonster->_mFlags); + + CopyChar(tbuff, &pMonster->_msquelch); + tbuff += 3; + + CopyInt(tbuff, &pMonster->falign_A4); + CopyInt(tbuff, &pMonster->_lastx); + CopyInt(tbuff, &pMonster->_lasty); + CopyInt(tbuff, &pMonster->_mRndSeed); + CopyInt(tbuff, &pMonster->_mAISeed); + CopyInt(tbuff, &pMonster->falign_B8); + + CopyChar(tbuff, &pMonster->_uniqtype); + CopyChar(tbuff, &pMonster->_uniqtrans); + CopyChar(tbuff, &pMonster->_udeadval); + CopyChar(tbuff, &pMonster->mWhoHit); + + CopyChar(tbuff, &pMonster->mLevel); + CopyShort(tbuff, &pMonster->mExp); + tbuff += 1; + + CopyChar(tbuff, &pMonster->mHit); + CopyChar(tbuff, &pMonster->mMinDamage); + CopyChar(tbuff, &pMonster->mMaxDamage); + CopyChar(tbuff, &pMonster->mHit2); + + CopyChar(tbuff, &pMonster->mMinDamage2); + CopyChar(tbuff, &pMonster->mMaxDamage2); + CopyChar(tbuff, &pMonster->mArmorClass); + CopyChar(tbuff, &pMonster->falign_CB); + + CopyShort(tbuff, &pMonster->mMagicRes); + tbuff += 2; + + CopyInt(tbuff, &pMonster->mtalkmsg); + + CopyChar(tbuff, &pMonster->leader); + CopyChar(tbuff, &pMonster->leaderflag); + CopyChar(tbuff, &pMonster->packsize); + CopyChar(tbuff, &pMonster->mlid); + + SyncMonsterAnim(i); +} + +void LoadMissile(int i) +{ + MissileStruct *pMissile = &missile[i]; + + CopyInt(tbuff, &pMissile->_mitype); + CopyInt(tbuff, &pMissile->_mix); + CopyInt(tbuff, &pMissile->_miy); + CopyInt(tbuff, &pMissile->_mixoff); + CopyInt(tbuff, &pMissile->_miyoff); + CopyInt(tbuff, &pMissile->_mixvel); + CopyInt(tbuff, &pMissile->_miyvel); + CopyInt(tbuff, &pMissile->_misx); + CopyInt(tbuff, &pMissile->_misy); + CopyInt(tbuff, &pMissile->_mitxoff); + CopyInt(tbuff, &pMissile->_mityoff); + CopyInt(tbuff, &pMissile->_mimfnum); + CopyInt(tbuff, &pMissile->_mispllvl); + CopyInt(tbuff, &pMissile->_miDelFlag); + CopyChar(tbuff, &pMissile->_miAnimType); + tbuff += 3; + + CopyInt(tbuff, &pMissile->_miAnimFlags); + tbuff += 4; + CopyInt(tbuff, &pMissile->_miAnimDelay); + CopyInt(tbuff, &pMissile->_miAnimLen); + CopyInt(tbuff, &pMissile->_miAnimWidth); + CopyInt(tbuff, &pMissile->_miAnimWidth2); + CopyInt(tbuff, &pMissile->_miAnimCnt); + CopyInt(tbuff, &pMissile->_miAnimAdd); + CopyInt(tbuff, &pMissile->_miAnimFrame); + CopyInt(tbuff, &pMissile->_miDrawFlag); + CopyInt(tbuff, &pMissile->_miLightFlag); + CopyInt(tbuff, &pMissile->_miPreFlag); + CopyInt(tbuff, &pMissile->_miUniqTrans); + CopyInt(tbuff, &pMissile->_mirange); + CopyInt(tbuff, &pMissile->_misource); + CopyInt(tbuff, &pMissile->_micaster); + CopyInt(tbuff, &pMissile->_midam); + CopyInt(tbuff, &pMissile->_miHitFlag); + CopyInt(tbuff, &pMissile->_midist); + CopyInt(tbuff, &pMissile->_mlid); + CopyInt(tbuff, &pMissile->_mirnd); + CopyInt(tbuff, &pMissile->_miVar1); + CopyInt(tbuff, &pMissile->_miVar2); + CopyInt(tbuff, &pMissile->_miVar3); + CopyInt(tbuff, &pMissile->_miVar4); + CopyInt(tbuff, &pMissile->_miVar5); + CopyInt(tbuff, &pMissile->_miVar6); + CopyInt(tbuff, &pMissile->_miVar7); + CopyInt(tbuff, &pMissile->_miVar8); +} + +void LoadObject(int i) +{ + ObjectStruct *pObject = &object[i]; + CopyInt(tbuff, &pObject->_otype); + CopyInt(tbuff, &pObject->_ox); + CopyInt(tbuff, &pObject->_oy); + CopyInt(tbuff, &pObject->_oLight); + CopyInt(tbuff, &pObject->_oAnimFlag); + tbuff += 4; + CopyInt(tbuff, &pObject->_oAnimDelay); + CopyInt(tbuff, &pObject->_oAnimCnt); + CopyInt(tbuff, &pObject->_oAnimLen); + CopyInt(tbuff, &pObject->_oAnimFrame); + CopyInt(tbuff, &pObject->_oAnimWidth); + CopyInt(tbuff, &pObject->_oAnimWidth2); + CopyInt(tbuff, &pObject->_oDelFlag); + + CopyChar(tbuff, &pObject->_oBreak); + tbuff += 3; + + CopyInt(tbuff, &pObject->_oSolidFlag); + CopyInt(tbuff, &pObject->_oMissFlag); + + CopyChar(tbuff, &pObject->_oSelFlag); + tbuff += 3; + + CopyInt(tbuff, &pObject->_oPreFlag); + CopyInt(tbuff, &pObject->_oTrapFlag); + CopyInt(tbuff, &pObject->_oDoorFlag); + CopyInt(tbuff, &pObject->_olid); + CopyInt(tbuff, &pObject->_oRndSeed); + CopyInt(tbuff, &pObject->_oVar1); + CopyInt(tbuff, &pObject->_oVar2); + CopyInt(tbuff, &pObject->_oVar3); + CopyInt(tbuff, &pObject->_oVar4); + CopyInt(tbuff, &pObject->_oVar5); + CopyInt(tbuff, &pObject->_oVar6); + CopyInt(tbuff, &pObject->_oVar7); + CopyInt(tbuff, &pObject->_oVar8); +} + +void LoadItem(int i) +{ + CopyItem(&item[i]); + GetItemFrm(i); +} + +void CopyItem(ItemStruct *pItem) +{ + CopyInt(tbuff, &pItem->_iSeed); + CopyShort(tbuff, &pItem->_iCreateInfo); + tbuff += 2; + CopyInt(tbuff, &pItem->_itype); + CopyInt(tbuff, &pItem->_ix); + CopyInt(tbuff, &pItem->_iy); + CopyInt(tbuff, &pItem->_iAnimFlag); + tbuff += 4; // Skip pointer _iAnimData + CopyInt(tbuff, &pItem->_iAnimLen); + CopyInt(tbuff, &pItem->_iAnimFrame); + CopyInt(tbuff, &pItem->_iAnimWidth); + CopyInt(tbuff, &pItem->_iAnimWidth2); + CopyInt(tbuff, &pItem->_isin); + CopyChar(tbuff, &pItem->_iSelFlag); + tbuff += 3; + CopyInt(tbuff, &pItem->_iPostDraw); + CopyInt(tbuff, &pItem->_iIdentified); + CopyChar(tbuff, &pItem->_iMagical); + CopyBytes(tbuff, 64, &pItem->_iName); + CopyBytes(tbuff, 64, &pItem->_iIName); + CopyChar(tbuff, &pItem->_iLoc); + CopyChar(tbuff, &pItem->_iClass); + tbuff += 1; + CopyInt(tbuff, &pItem->_iCurs); + CopyInt(tbuff, &pItem->_ivalue); + CopyInt(tbuff, &pItem->_iIvalue); + CopyInt(tbuff, &pItem->_iMinDam); + CopyInt(tbuff, &pItem->_iMaxDam); + CopyInt(tbuff, &pItem->_iAC); + CopyInt(tbuff, &pItem->_iFlags); + CopyInt(tbuff, &pItem->_iMiscId); + CopyInt(tbuff, &pItem->_iSpell); + CopyInt(tbuff, &pItem->_iCharges); + CopyInt(tbuff, &pItem->_iMaxCharges); + CopyInt(tbuff, &pItem->_iDurability); + CopyInt(tbuff, &pItem->_iMaxDur); + CopyInt(tbuff, &pItem->_iPLDam); + CopyInt(tbuff, &pItem->_iPLToHit); + CopyInt(tbuff, &pItem->_iPLAC); + CopyInt(tbuff, &pItem->_iPLStr); + CopyInt(tbuff, &pItem->_iPLMag); + CopyInt(tbuff, &pItem->_iPLDex); + CopyInt(tbuff, &pItem->_iPLVit); + CopyInt(tbuff, &pItem->_iPLFR); + CopyInt(tbuff, &pItem->_iPLLR); + CopyInt(tbuff, &pItem->_iPLMR); + CopyInt(tbuff, &pItem->_iPLMana); + CopyInt(tbuff, &pItem->_iPLHP); + CopyInt(tbuff, &pItem->_iPLDamMod); + CopyInt(tbuff, &pItem->_iPLGetHit); + CopyInt(tbuff, &pItem->_iPLLight); + CopyChar(tbuff, &pItem->_iSplLvlAdd); + CopyChar(tbuff, &pItem->_iRequest); + tbuff += 2; + CopyInt(tbuff, &pItem->_iUid); + CopyInt(tbuff, &pItem->_iFMinDam); + CopyInt(tbuff, &pItem->_iFMaxDam); + CopyInt(tbuff, &pItem->_iLMinDam); + CopyInt(tbuff, &pItem->_iLMaxDam); + CopyInt(tbuff, &pItem->_iPLEnAc); + CopyChar(tbuff, &pItem->_iPrePower); + CopyChar(tbuff, &pItem->_iSufPower); + tbuff += 2; + CopyInt(tbuff, &pItem->_iVAdd1); + CopyInt(tbuff, &pItem->_iVMult1); + CopyInt(tbuff, &pItem->_iVAdd2); + CopyInt(tbuff, &pItem->_iVMult2); + CopyChar(tbuff, &pItem->_iMinStr); + CopyChar(tbuff, &pItem->_iMinMag); + CopyChar(tbuff, &pItem->_iMinDex); + tbuff += 1; + CopyInt(tbuff, &pItem->_iStatFlag); + CopyInt(tbuff, &pItem->IDidx); + CopyInt(tbuff, &pItem->offs016C); +} + +void CopyItems(const int n, ItemStruct *pItem) +{ + for (int i = 0; i < n; i++) { + CopyItem(&pItem[i]); + } +} + +void SaveItem(ItemStruct *pItem) +{ + CopyInt(&pItem->_iSeed, tbuff); + CopyShort(&pItem->_iCreateInfo, tbuff); + tbuff += 2; + CopyInt(&pItem->_itype, tbuff); + CopyInt(&pItem->_ix, tbuff); + CopyInt(&pItem->_iy, tbuff); + CopyInt(&pItem->_iAnimFlag, tbuff); + tbuff += 4; // Skip pointer _iAnimData + CopyInt(&pItem->_iAnimLen, tbuff); + CopyInt(&pItem->_iAnimFrame, tbuff); + CopyInt(&pItem->_iAnimWidth, tbuff); + CopyInt(&pItem->_iAnimWidth2, tbuff); // width 2? + CopyInt(&pItem->_isin, tbuff); // set when item is flagged for deletion, deprecated in 1.02 + CopyChar(&pItem->_iSelFlag, tbuff); + tbuff += 3; + CopyInt(&pItem->_iPostDraw, tbuff); + CopyInt(&pItem->_iIdentified, tbuff); + CopyChar(&pItem->_iMagical, tbuff); + CopyBytes(&pItem->_iName, 64, tbuff); + CopyBytes(&pItem->_iIName, 64, tbuff); + CopyChar(&pItem->_iLoc, tbuff); + CopyChar(&pItem->_iClass, tbuff); + tbuff += 1; + CopyInt(&pItem->_iCurs, tbuff); + CopyInt(&pItem->_ivalue, tbuff); + CopyInt(&pItem->_iIvalue, tbuff); + CopyInt(&pItem->_iMinDam, tbuff); + CopyInt(&pItem->_iMaxDam, tbuff); + CopyInt(&pItem->_iAC, tbuff); + CopyInt(&pItem->_iFlags, tbuff); + CopyInt(&pItem->_iMiscId, tbuff); + CopyInt(&pItem->_iSpell, tbuff); + CopyInt(&pItem->_iCharges, tbuff); + CopyInt(&pItem->_iMaxCharges, tbuff); + CopyInt(&pItem->_iDurability, tbuff); + CopyInt(&pItem->_iMaxDur, tbuff); + CopyInt(&pItem->_iPLDam, tbuff); + CopyInt(&pItem->_iPLToHit, tbuff); + CopyInt(&pItem->_iPLAC, tbuff); + CopyInt(&pItem->_iPLStr, tbuff); + CopyInt(&pItem->_iPLMag, tbuff); + CopyInt(&pItem->_iPLDex, tbuff); + CopyInt(&pItem->_iPLVit, tbuff); + CopyInt(&pItem->_iPLFR, tbuff); + CopyInt(&pItem->_iPLLR, tbuff); + CopyInt(&pItem->_iPLMR, tbuff); + CopyInt(&pItem->_iPLMana, tbuff); + CopyInt(&pItem->_iPLHP, tbuff); + CopyInt(&pItem->_iPLDamMod, tbuff); + CopyInt(&pItem->_iPLGetHit, tbuff); + CopyInt(&pItem->_iPLLight, tbuff); + CopyChar(&pItem->_iSplLvlAdd, tbuff); + CopyChar(&pItem->_iRequest, tbuff); + tbuff += 2; + CopyInt(&pItem->_iUid, tbuff); + CopyInt(&pItem->_iFMinDam, tbuff); + CopyInt(&pItem->_iFMaxDam, tbuff); + CopyInt(&pItem->_iLMinDam, tbuff); + CopyInt(&pItem->_iLMaxDam, tbuff); + CopyInt(&pItem->_iPLEnAc, tbuff); + CopyChar(&pItem->_iPrePower, tbuff); + CopyChar(&pItem->_iSufPower, tbuff); + tbuff += 2; + CopyInt(&pItem->_iVAdd1, tbuff); + CopyInt(&pItem->_iVMult1, tbuff); + CopyInt(&pItem->_iVAdd2, tbuff); + CopyInt(&pItem->_iVMult2, tbuff); + CopyChar(&pItem->_iMinStr, tbuff); + CopyChar(&pItem->_iMinMag, tbuff); + CopyChar(&pItem->_iMinDex, tbuff); + tbuff += 1; + CopyInt(&pItem->_iStatFlag, tbuff); + CopyInt(&pItem->IDidx, tbuff); + CopyInt(&pItem->offs016C, tbuff); +} + +void SaveItems(ItemStruct *pItem, const int n) +{ + for (int i = 0; i < n; i++) { + SaveItem(&pItem[i]); + } +} + +void LoadPremium(int i) +{ + CopyItem(&item[i]); +} + +void LoadQuest(int i) +{ + memcpy(&quests[i], tbuff, sizeof(*quests)); + tbuff += sizeof(*quests); + ReturnLvlX = WLoad(); + ReturnLvlY = WLoad(); + ReturnLvl = WLoad(); + ReturnLvlT = WLoad(); + DoomQuestState = WLoad(); +} + +void LoadLighting(int i) +{ + memcpy(&LightList[i], tbuff, sizeof(*LightList)); + tbuff += sizeof(*LightList); +} + +void LoadVision(int i) +{ + memcpy(&VisionList[i], tbuff, sizeof(*VisionList)); + tbuff += sizeof(*VisionList); +} + +void LoadPortal(int i) +{ + memcpy(&portal[i], tbuff, sizeof(*portal)); + tbuff += sizeof(*portal); +} + +void SaveGame() +{ + int i, j; + char szName[MAX_PATH]; + + DWORD dwLen = codec_get_encoded_len(FILEBUFF); + BYTE *SaveBuff = DiabloAllocPtr(dwLen); + tbuff = SaveBuff; + + ISave('RETL'); + OSave((unsigned char)setlevel); + WSave(setlvlnum); + WSave(currlevel); + WSave((unsigned char)leveltype); + WSave(ViewX); + WSave(ViewY); + OSave(invflag); + OSave(chrflag); + WSave(nummonsters); + WSave(numitems); + WSave(nummissiles); + WSave(nobjects); + + for (i = 0; i < NUMLEVELS; i++) { + ISave(glSeedTbl[i]); + WSave(gnLevelTypeTbl[i]); + } + + SavePlayer(myplr); + + for (i = 0; i < MAXQUESTS; i++) + SaveQuest(i); + for (i = 0; i < MAXPORTAL; i++) + SavePortal(i); + for (i = 0; i < MAXMONSTERS; i++) + ISave(monstkills[i]); + + if (leveltype != DTYPE_TOWN) { + for (i = 0; i < MAXMONSTERS; i++) + WSave(monstactive[i]); + for (i = 0; i < nummonsters; i++) + SaveMonster(monstactive[i]); + for (i = 0; i < MAXMISSILES; i++) + BSave(missileactive[i]); + for (i = 0; i < MAXMISSILES; i++) + BSave(missileavail[i]); + for (i = 0; i < nummissiles; i++) + SaveMissile(missileactive[i]); + for (i = 0; i < MAXOBJECTS; i++) + BSave(objectactive[i]); + for (i = 0; i < MAXOBJECTS; i++) + BSave(objectavail[i]); + for (i = 0; i < nobjects; i++) + SaveObject(objectactive[i]); + + WSave(numlights); + + for (i = 0; i < MAXLIGHTS; i++) + BSave(lightactive[i]); + for (i = 0; i < numlights; i++) + SaveLighting(lightactive[i]); + + WSave(visionid); + WSave(numvision); + + for (i = 0; i < numvision; i++) + SaveVision(i); + } + + for (i = 0; i < MAXITEMS; i++) + BSave(itemactive[i]); + for (i = 0; i < MAXITEMS; i++) + BSave(itemavail[i]); + for (i = 0; i < numitems; i++) + SaveItem(&item[itemactive[i]]); + for (i = 0; i < 128; i++) + OSave(UniqueItemFlag[i]); + + for (j = 0; j < MAXDUNY; j++) { + for (i = 0; i < MAXDUNX; i++) + BSave(dLight[i][j]); + } + for (j = 0; j < MAXDUNY; j++) { + for (i = 0; i < MAXDUNX; i++) + BSave(dFlags[i][j] & ~(BFLAG_MISSILE | BFLAG_VISIBLE | BFLAG_DEAD_PLAYER)); + } + for (j = 0; j < MAXDUNY; j++) { + for (i = 0; i < MAXDUNX; i++) + BSave(dPlayer[i][j]); + } + for (j = 0; j < MAXDUNY; j++) { + for (i = 0; i < MAXDUNX; i++) + BSave(dItem[i][j]); + } + + if (leveltype != DTYPE_TOWN) { + for (j = 0; j < MAXDUNY; j++) { + for (i = 0; i < MAXDUNX; i++) + WSave(dMonster[i][j]); + } + for (j = 0; j < MAXDUNY; j++) { + for (i = 0; i < MAXDUNX; i++) + BSave(dDead[i][j]); + } + for (j = 0; j < MAXDUNY; j++) { + for (i = 0; i < MAXDUNX; i++) + BSave(dObject[i][j]); + } + for (j = 0; j < MAXDUNY; j++) { + for (i = 0; i < MAXDUNX; i++) + BSave(dLight[i][j]); + } + for (j = 0; j < MAXDUNY; j++) { + for (i = 0; i < MAXDUNX; i++) + BSave(dPreLight[i][j]); + } + for (j = 0; j < DMAXY; j++) { + for (i = 0; i < DMAXX; i++) + OSave(automapview[i][j]); + } + for (j = 0; j < MAXDUNY; j++) { + for (i = 0; i < MAXDUNX; i++) + BSave(dMissile[i][j]); + } + } + + WSave(numpremium); + WSave(premiumlevel); + + for (i = 0; i < 6; i++) + SavePremium(i); + + OSave(automapflag); + WSave(AutoMapScale); + pfile_get_game_name(szName); + dwLen = codec_get_encoded_len(tbuff - SaveBuff); + pfile_write_save_file(szName, SaveBuff, tbuff - SaveBuff, dwLen); + mem_free_dbg(SaveBuff); + gbValidSaveFile = TRUE; + pfile_rename_temp_to_perm(); + pfile_write_hero(); +} + +void BSave(char v) +{ + *tbuff++ = v; +} + +void WSave(int v) +{ + *tbuff++ = v >> 24; + *tbuff++ = v >> 16; + *tbuff++ = v >> 8; + *tbuff++ = v; +} + +void ISave(int v) +{ + *tbuff++ = v >> 24; + *tbuff++ = v >> 16; + *tbuff++ = v >> 8; + *tbuff++ = v; +} + +void OSave(BOOL v) +{ + if (v != FALSE) + *tbuff++ = TRUE; + else + *tbuff++ = FALSE; +} + +void SaveMonster(int i) +{ + MonsterStruct *pMonster = &monster[i]; + + CopyInt(&pMonster->_mMTidx, tbuff); + CopyInt(&pMonster->_mmode, tbuff); + + CopyChar(&pMonster->_mgoal, tbuff); + tbuff += 3; + + CopyInt(&pMonster->_mgoalvar1, tbuff); + CopyInt(&pMonster->_mgoalvar2, tbuff); + CopyInt(&pMonster->_mgoalvar3, tbuff); + CopyInt(&pMonster->field_18, tbuff); + + CopyChar(&pMonster->_pathcount, tbuff); + tbuff += 3; + + CopyInt(&pMonster->_mx, tbuff); + CopyInt(&pMonster->_my, tbuff); + CopyInt(&pMonster->_mfutx, tbuff); + CopyInt(&pMonster->_mfuty, tbuff); + CopyInt(&pMonster->_moldx, tbuff); + CopyInt(&pMonster->_moldy, tbuff); + CopyInt(&pMonster->_mxoff, tbuff); + CopyInt(&pMonster->_myoff, tbuff); + CopyInt(&pMonster->_mxvel, tbuff); + CopyInt(&pMonster->_myvel, tbuff); + CopyInt(&pMonster->_mdir, tbuff); + CopyInt(&pMonster->_menemy, tbuff); + + CopyChar(&pMonster->_menemyx, tbuff); + CopyChar(&pMonster->_menemyy, tbuff); + CopyShort(&pMonster->falign_52, tbuff); + + tbuff += 4; // Skip pointer + CopyInt(&pMonster->_mAnimDelay, tbuff); + CopyInt(&pMonster->_mAnimCnt, tbuff); + CopyInt(&pMonster->_mAnimLen, tbuff); + CopyInt(&pMonster->_mAnimFrame, tbuff); + CopyInt(&pMonster->_meflag, tbuff); + CopyInt(&pMonster->_mDelFlag, tbuff); + CopyInt(&pMonster->_mVar1, tbuff); + CopyInt(&pMonster->_mVar2, tbuff); + CopyInt(&pMonster->_mVar3, tbuff); + CopyInt(&pMonster->_mVar4, tbuff); + CopyInt(&pMonster->_mVar5, tbuff); + CopyInt(&pMonster->_mVar6, tbuff); + CopyInt(&pMonster->_mVar7, tbuff); + CopyInt(&pMonster->_mVar8, tbuff); + CopyInt(&pMonster->_mmaxhp, tbuff); + CopyInt(&pMonster->_mhitpoints, tbuff); + + CopyChar(&pMonster->_mAi, tbuff); + CopyChar(&pMonster->_mint, tbuff); + CopyShort(&pMonster->falign_9A, tbuff); + + CopyInt(&pMonster->_mFlags, tbuff); + + CopyChar(&pMonster->_msquelch, tbuff); + tbuff += 3; + + CopyInt(&pMonster->falign_A4, tbuff); + CopyInt(&pMonster->_lastx, tbuff); + CopyInt(&pMonster->_lasty, tbuff); + CopyInt(&pMonster->_mRndSeed, tbuff); + CopyInt(&pMonster->_mAISeed, tbuff); + CopyInt(&pMonster->falign_B8, tbuff); + + CopyChar(&pMonster->_uniqtype, tbuff); + CopyChar(&pMonster->_uniqtrans, tbuff); + CopyChar(&pMonster->_udeadval, tbuff); + CopyChar(&pMonster->mWhoHit, tbuff); + + CopyChar(&pMonster->mLevel, tbuff); + CopyShort(&pMonster->mExp, tbuff); + tbuff += 1; + + CopyChar(&pMonster->mHit, tbuff); + CopyChar(&pMonster->mMinDamage, tbuff); + CopyChar(&pMonster->mMaxDamage, tbuff); + CopyChar(&pMonster->mHit2, tbuff); + + CopyChar(&pMonster->mMinDamage2, tbuff); + CopyChar(&pMonster->mMaxDamage2, tbuff); + CopyChar(&pMonster->mArmorClass, tbuff); + CopyChar(&pMonster->falign_CB, tbuff); + + CopyShort(&pMonster->mMagicRes, tbuff); + tbuff += 2; + + CopyInt(&pMonster->mtalkmsg, tbuff); + + CopyChar(&pMonster->leader, tbuff); + CopyChar(&pMonster->leaderflag, tbuff); + CopyChar(&pMonster->packsize, tbuff); + CopyChar(&pMonster->mlid, tbuff); +} + +void SaveMissile(int i) +{ + MissileStruct *pMissile = &missile[i]; + + CopyInt(&pMissile->_mitype, tbuff); + CopyInt(&pMissile->_mix, tbuff); + CopyInt(&pMissile->_miy, tbuff); + CopyInt(&pMissile->_mixoff, tbuff); + CopyInt(&pMissile->_miyoff, tbuff); + CopyInt(&pMissile->_mixvel, tbuff); + CopyInt(&pMissile->_miyvel, tbuff); + CopyInt(&pMissile->_misx, tbuff); + CopyInt(&pMissile->_misy, tbuff); + CopyInt(&pMissile->_mitxoff, tbuff); + CopyInt(&pMissile->_mityoff, tbuff); + CopyInt(&pMissile->_mimfnum, tbuff); + CopyInt(&pMissile->_mispllvl, tbuff); + CopyInt(&pMissile->_miDelFlag, tbuff); + CopyChar(&pMissile->_miAnimType, tbuff); + tbuff += 3; + + CopyInt(&pMissile->_miAnimFlags, tbuff); + tbuff += 4; + CopyInt(&pMissile->_miAnimDelay, tbuff); + CopyInt(&pMissile->_miAnimLen, tbuff); + CopyInt(&pMissile->_miAnimWidth, tbuff); + CopyInt(&pMissile->_miAnimWidth2, tbuff); + CopyInt(&pMissile->_miAnimCnt, tbuff); + CopyInt(&pMissile->_miAnimAdd, tbuff); + CopyInt(&pMissile->_miAnimFrame, tbuff); + CopyInt(&pMissile->_miDrawFlag, tbuff); + CopyInt(&pMissile->_miLightFlag, tbuff); + CopyInt(&pMissile->_miPreFlag, tbuff); + CopyInt(&pMissile->_miUniqTrans, tbuff); + CopyInt(&pMissile->_mirange, tbuff); + CopyInt(&pMissile->_misource, tbuff); + CopyInt(&pMissile->_micaster, tbuff); + CopyInt(&pMissile->_midam, tbuff); + CopyInt(&pMissile->_miHitFlag, tbuff); + CopyInt(&pMissile->_midist, tbuff); + CopyInt(&pMissile->_mlid, tbuff); + CopyInt(&pMissile->_mirnd, tbuff); + CopyInt(&pMissile->_miVar1, tbuff); + CopyInt(&pMissile->_miVar2, tbuff); + CopyInt(&pMissile->_miVar3, tbuff); + CopyInt(&pMissile->_miVar4, tbuff); + CopyInt(&pMissile->_miVar5, tbuff); + CopyInt(&pMissile->_miVar6, tbuff); + CopyInt(&pMissile->_miVar7, tbuff); + CopyInt(&pMissile->_miVar8, tbuff); +} + +void SaveObject(int i) +{ + ObjectStruct *pObject = &object[i]; + CopyInt(tbuff, &pObject->_otype); + CopyInt(&pObject->_ox, tbuff); + CopyInt(&pObject->_oy, tbuff); + CopyInt(&pObject->_oLight, tbuff); + CopyInt(&pObject->_oAnimFlag, tbuff); + tbuff += 4; + CopyInt(&pObject->_oAnimDelay, tbuff); + CopyInt(&pObject->_oAnimCnt, tbuff); + CopyInt(&pObject->_oAnimLen, tbuff); + CopyInt(&pObject->_oAnimFrame, tbuff); + CopyInt(&pObject->_oAnimWidth, tbuff); + CopyInt(&pObject->_oAnimWidth2, tbuff); + CopyInt(&pObject->_oDelFlag, tbuff); + + CopyChar(&pObject->_oBreak, tbuff); + tbuff += 3; + + CopyInt(&pObject->_oSolidFlag, tbuff); + CopyInt(&pObject->_oMissFlag, tbuff); + + CopyChar(&pObject->_oSelFlag, tbuff); + tbuff += 3; + + CopyInt(&pObject->_oPreFlag, tbuff); + CopyInt(&pObject->_oTrapFlag, tbuff); + CopyInt(&pObject->_oDoorFlag, tbuff); + CopyInt(&pObject->_olid, tbuff); + CopyInt(&pObject->_oRndSeed, tbuff); + CopyInt(&pObject->_oVar1, tbuff); + CopyInt(&pObject->_oVar2, tbuff); + CopyInt(&pObject->_oVar3, tbuff); + CopyInt(&pObject->_oVar4, tbuff); + CopyInt(&pObject->_oVar5, tbuff); + CopyInt(&pObject->_oVar6, tbuff); + CopyInt(&pObject->_oVar7, tbuff); + CopyInt(&pObject->_oVar8, tbuff); +} + +void SavePremium(int i) +{ + SaveItem(&item[i]); +} + +void SaveQuest(int i) +{ + memcpy(tbuff, &quests[i], sizeof(*quests)); + tbuff += sizeof(*quests); + WSave(ReturnLvlX); + WSave(ReturnLvlY); + WSave(ReturnLvl); + WSave(ReturnLvlT); + WSave(DoomQuestState); +} + +void SaveLighting(int i) +{ + memcpy(tbuff, &LightList[i], sizeof(*LightList)); + tbuff += sizeof(*LightList); +} + +void SaveVision(int i) +{ + memcpy(tbuff, &VisionList[i], sizeof(*VisionList)); + tbuff += sizeof(*VisionList); +} + +void SavePortal(int i) +{ + memcpy(tbuff, &portal[i], sizeof(*portal)); + tbuff += sizeof(*portal); +} + +void SaveLevel() +{ + int i, j; + char szName[MAX_PATH]; + int dwLen; + unsigned char *SaveBuff; + + if (!currlevel) + glSeedTbl[0] = GetRndSeed(); + + dwLen = codec_get_encoded_len(FILEBUFF); + SaveBuff = DiabloAllocPtr(dwLen); + tbuff = SaveBuff; + + if (leveltype != DTYPE_TOWN) { + for (j = 0; j < MAXDUNY; j++) { + for (i = 0; i < MAXDUNX; i++) + BSave(dDead[i][j]); + } + } + + WSave(nummonsters); + WSave(numitems); + WSave(nobjects); + + if (leveltype != DTYPE_TOWN) { + for (i = 0; i < MAXMONSTERS; i++) + WSave(monstactive[i]); + for (i = 0; i < nummonsters; i++) + SaveMonster(monstactive[i]); + for (i = 0; i < MAXOBJECTS; i++) + BSave(objectactive[i]); + for (i = 0; i < MAXOBJECTS; i++) + BSave(objectavail[i]); + for (i = 0; i < nobjects; i++) + SaveObject(objectactive[i]); + } + + for (i = 0; i < MAXITEMS; i++) + BSave(itemactive[i]); + for (i = 0; i < MAXITEMS; i++) + BSave(itemavail[i]); + for (i = 0; i < numitems; i++) + SaveItem(&item[itemactive[i]]); + + for (j = 0; j < MAXDUNY; j++) { + for (i = 0; i < MAXDUNX; i++) + BSave(dFlags[i][j] & ~(BFLAG_MISSILE | BFLAG_VISIBLE | BFLAG_DEAD_PLAYER)); + } + for (j = 0; j < MAXDUNY; j++) { + for (i = 0; i < MAXDUNX; i++) + BSave(dItem[i][j]); + } + + if (leveltype != DTYPE_TOWN) { + for (j = 0; j < MAXDUNY; j++) { + for (i = 0; i < MAXDUNX; i++) + WSave(dMonster[i][j]); + } + for (j = 0; j < MAXDUNY; j++) { + for (i = 0; i < MAXDUNX; i++) + BSave(dObject[i][j]); + } + for (j = 0; j < MAXDUNY; j++) { + for (i = 0; i < MAXDUNX; i++) + BSave(dLight[i][j]); + } + for (j = 0; j < MAXDUNY; j++) { + for (i = 0; i < MAXDUNX; i++) + BSave(dPreLight[i][j]); + } + for (j = 0; j < DMAXY; j++) { + for (i = 0; i < DMAXX; i++) + OSave(automapview[i][j]); + } + for (j = 0; j < MAXDUNY; j++) { + for (i = 0; i < MAXDUNX; i++) + BSave(dMissile[i][j]); + } + } + + GetTempLevelNames(szName); + dwLen = codec_get_encoded_len(tbuff - SaveBuff); + pfile_write_save_file(szName, SaveBuff, tbuff - SaveBuff, dwLen); + mem_free_dbg(SaveBuff); + + if (setlevel == 0) + plr[myplr]._pLvlVisited[currlevel] = 1; + else + plr[myplr]._pSLvlVisited[setlvlnum] = 1; +} + +void LoadLevel() +{ + int i, j; + DWORD dwLen; + char szName[MAX_PATH]; + BYTE *LoadBuff; + + GetPermLevelNames(szName); + LoadBuff = pfile_read(szName, &dwLen); + tbuff = LoadBuff; + + if (leveltype != DTYPE_TOWN) { + for (j = 0; j < MAXDUNY; j++) { + for (i = 0; i < MAXDUNX; i++) + dDead[i][j] = BLoad(); + } + SetDead(); + } + + nummonsters = WLoad(); + numitems = WLoad(); + nobjects = WLoad(); + + if (leveltype != DTYPE_TOWN) { + for (i = 0; i < MAXMONSTERS; i++) + monstactive[i] = WLoad(); + for (i = 0; i < nummonsters; i++) + LoadMonster(monstactive[i]); + for (i = 0; i < MAXOBJECTS; i++) + objectactive[i] = BLoad(); + for (i = 0; i < MAXOBJECTS; i++) + objectavail[i] = BLoad(); + for (i = 0; i < nobjects; i++) + LoadObject(objectactive[i]); + for (i = 0; i < nobjects; i++) + SyncObjectAnim(objectactive[i]); + } + + for (i = 0; i < MAXITEMS; i++) + itemactive[i] = BLoad(); + for (i = 0; i < MAXITEMS; i++) + itemavail[i] = BLoad(); + for (i = 0; i < numitems; i++) + LoadItem(itemactive[i]); + + for (j = 0; j < MAXDUNY; j++) { + for (i = 0; i < MAXDUNX; i++) + dFlags[i][j] = BLoad(); + } + for (j = 0; j < MAXDUNY; j++) { + for (i = 0; i < MAXDUNX; i++) + dItem[i][j] = BLoad(); + } + + if (leveltype != DTYPE_TOWN) { + for (j = 0; j < MAXDUNY; j++) { + for (i = 0; i < MAXDUNX; i++) + dMonster[i][j] = WLoad(); + } + for (j = 0; j < MAXDUNY; j++) { + for (i = 0; i < MAXDUNX; i++) + dObject[i][j] = BLoad(); + } + for (j = 0; j < MAXDUNY; j++) { + for (i = 0; i < MAXDUNX; i++) + dLight[i][j] = BLoad(); + } + for (j = 0; j < MAXDUNY; j++) { + for (i = 0; i < MAXDUNX; i++) + dPreLight[i][j] = BLoad(); + } + for (j = 0; j < DMAXY; j++) { + for (i = 0; i < DMAXX; i++) + automapview[i][j] = OLoad(); + } + for (j = 0; j < MAXDUNY; j++) { + for (i = 0; i < MAXDUNX; i++) + dMissile[i][j] = 0; /// BUGFIX: supposed to load saved missiles with "BLoad()"? + } + } + + AutomapZoomReset(); + ResyncQuests(); + SyncPortals(); + dolighting = 1; + + for (i = 0; i < MAX_PLRS; i++) { + if (plr[i].plractive && currlevel == plr[i].plrlevel) + LightList[plr[i]._plid]._lunflag = 1; + } + + mem_free_dbg(LoadBuff); +} + +DEVILUTION_END_NAMESPACE diff --git a/structs.h b/structs.h index eb2cb92aea8..7d995dc2fc0 100644 --- a/structs.h +++ b/structs.h @@ -174,7 +174,7 @@ typedef struct ItemStruct { ////////////////////////////////////////////////// #pragma pack(push, 4) -typedef struct PlayerStruct { +typedef struct PlayerStruct { int _pmode; char walkpath[25]; uint8_t plractive; @@ -376,8 +376,8 @@ typedef struct TextDataStruct { typedef struct MissileData { unsigned char mName; - void(* mAddProc)(int, int, int, int, int, int, char, int, int); - void(* mProc)(int); + void (*mAddProc)(int, int, int, int, int, int, char, int, int); + void (*mProc)(int); BOOL mDraw; unsigned char mType; unsigned char mResist; @@ -1017,7 +1017,7 @@ typedef struct QuestData { typedef struct TMenuItem { DWORD dwFlags; char *pszStr; - void(* fnMenu)(BOOL); /* fix, should have one arg */ + void (*fnMenu)(BOOL); /* fix, should have one arg */ } TMenuItem; // TPDEF PTR FCN VOID TMenuUpdateFcn @@ -1331,21 +1331,21 @@ typedef struct _SNETUIDATA { int size; int uiflags; HWND parentwindow; - void(* artcallback)(); - void(* authcallback)(); - void(* createcallback)(); - void(* drawdesccallback)(); - void(* selectedcallback)(); - void(* messageboxcallback)(); - void(* soundcallback)(); - void(* statuscallback)(); - void(* getdatacallback)(); - void(* categorycallback)(); - void(* categorylistcallback)(); - void(* newaccountcallback)(); - void(* profilecallback)(); + void (*artcallback)(); + void (*authcallback)(); + void (*createcallback)(); + void (*drawdesccallback)(); + void (*selectedcallback)(); + void (*messageboxcallback)(); + void (*soundcallback)(); + void (*statuscallback)(); + void (*getdatacallback)(); + void (*categorycallback)(); + void (*categorylistcallback)(); + void (*newaccountcallback)(); + void (*profilecallback)(); int profilefields; - void(* profilebitmapcallback)(); + void (*profilebitmapcallback)(); int(__stdcall *selectnamecallback)( const struct _SNETPROGRAMDATA *, const struct _SNETPLAYERDATA *, @@ -1355,8 +1355,8 @@ typedef struct _SNETUIDATA { char *, DWORD, /* character name will be copied here */ char *, DWORD, /* character "description" will be copied here (used to advertise games) */ BOOL * /* new character? - unsure about this */ - ); - void(* changenamecallback)(); + ); + void (*changenamecallback)(); } _SNETUIDATA; typedef struct _SNETVERSIONDATA { From 3f82acec5231ba8b5358b2281631bc0356410d39 Mon Sep 17 00:00:00 2001 From: Alex Sweet Date: Mon, 8 Jul 2019 07:17:15 -0700 Subject: [PATCH 33/42] Use filthy Windows types --- Source/loadsave.cpp | 28 ++++++++++++++-------------- 1 file changed, 14 insertions(+), 14 deletions(-) diff --git a/Source/loadsave.cpp b/Source/loadsave.cpp index 1d2ddeb958f..42ba89f4a06 100644 --- a/Source/loadsave.cpp +++ b/Source/loadsave.cpp @@ -369,38 +369,38 @@ void LoadPlayer(int i) tbuff += 2; CopyInt(tbuff, &pPlayer->_pGFXLoad); - tbuff += sizeof(__uint32_t) * 8; + tbuff += sizeof(DWORD) * 8; CopyInt(tbuff, &pPlayer->_pNFrames); CopyInt(tbuff, &pPlayer->_pNWidth); - tbuff += sizeof(__uint32_t) * 8; + tbuff += sizeof(DWORD) * 8; CopyInt(tbuff, &pPlayer->_pWFrames); CopyInt(tbuff, &pPlayer->_pWWidth); - tbuff += sizeof(__uint32_t) * 8; + tbuff += sizeof(DWORD) * 8; CopyInt(tbuff, &pPlayer->_pAFrames); CopyInt(tbuff, &pPlayer->_pAWidth); CopyInt(tbuff, &pPlayer->_pAFNum); - tbuff += sizeof(__uint32_t) * 24; + tbuff += sizeof(DWORD) * 24; CopyInt(tbuff, &pPlayer->_pSFrames); CopyInt(tbuff, &pPlayer->_pSWidth); CopyInt(tbuff, &pPlayer->_pSFNum); - tbuff += sizeof(__uint32_t) * 8; + tbuff += sizeof(DWORD) * 8; CopyInt(tbuff, &pPlayer->_pHFrames); CopyInt(tbuff, &pPlayer->_pHWidth); - tbuff += sizeof(__uint32_t) * 8; + tbuff += sizeof(DWORD) * 8; CopyInt(tbuff, &pPlayer->_pDFrames); CopyInt(tbuff, &pPlayer->_pDWidth); - tbuff += sizeof(__uint32_t) * 8; + tbuff += sizeof(DWORD) * 8; CopyInt(tbuff, &pPlayer->_pBFrames); CopyInt(tbuff, &pPlayer->_pBWidth); @@ -572,38 +572,38 @@ void SavePlayer(int i) tbuff += 2; CopyInt(&pPlayer->_pGFXLoad, tbuff); - tbuff += sizeof(__uint32_t) * 8; // Skip 8 pointers + tbuff += sizeof(DWORD) * 8; // Skip 8 pointers CopyInt(&pPlayer->_pNFrames, tbuff); CopyInt(&pPlayer->_pNWidth, tbuff); - tbuff += sizeof(__uint32_t) * 8; // Skip 8 pointers + tbuff += sizeof(DWORD) * 8; // Skip 8 pointers CopyInt(&pPlayer->_pWFrames, tbuff); CopyInt(&pPlayer->_pWWidth, tbuff); - tbuff += sizeof(__uint32_t) * 8; // Skip 8 pointers + tbuff += sizeof(DWORD) * 8; // Skip 8 pointers CopyInt(&pPlayer->_pAFrames, tbuff); CopyInt(&pPlayer->_pAWidth, tbuff); CopyInt(&pPlayer->_pAFNum, tbuff); - tbuff += sizeof(__uint32_t) * 24; // Skip 24 pointers + tbuff += sizeof(DWORD) * 24; // Skip 24 pointers CopyInt(&pPlayer->_pSFrames, tbuff); CopyInt(&pPlayer->_pSWidth, tbuff); CopyInt(&pPlayer->_pSFNum, tbuff); - tbuff += sizeof(__uint32_t) * 8; // Skip 8 pointers + tbuff += sizeof(DWORD) * 8; // Skip 8 pointers CopyInt(&pPlayer->_pHFrames, tbuff); CopyInt(&pPlayer->_pHWidth, tbuff); - tbuff += sizeof(__uint32_t) * 8; // Skip 8 pointers + tbuff += sizeof(DWORD) * 8; // Skip 8 pointers CopyInt(&pPlayer->_pDFrames, tbuff); CopyInt(&pPlayer->_pDWidth, tbuff); - tbuff += sizeof(__uint32_t) * 8; // Skip 8 pointers + tbuff += sizeof(DWORD) * 8; // Skip 8 pointers CopyInt(&pPlayer->_pBFrames, tbuff); CopyInt(&pPlayer->_pBWidth, tbuff); From 636a8108f9e81b3aef73819f5bd60e17e3a47127 Mon Sep 17 00:00:00 2001 From: Alex Sweet Date: Mon, 8 Jul 2019 08:06:02 -0700 Subject: [PATCH 34/42] Fix line endings --- Source/loadsave.cpp | 3288 +++++++++++++++++++++---------------------- 1 file changed, 1644 insertions(+), 1644 deletions(-) diff --git a/Source/loadsave.cpp b/Source/loadsave.cpp index 42ba89f4a06..68dc56c5e52 100644 --- a/Source/loadsave.cpp +++ b/Source/loadsave.cpp @@ -1,1644 +1,1644 @@ -#include "diablo.h" - -DEVILUTION_BEGIN_NAMESPACE - -BYTE *tbuff; - -void LoadGame(BOOL firstflag) -{ - int i, j; - DWORD dwLen; - char szName[MAX_PATH]; - BYTE *LoadBuff; - int _ViewX, _ViewY, _nummonsters, _numitems, _nummissiles, _nobjects; - - FreeGameMem(); - pfile_remove_temp_files(); - pfile_get_game_name(szName); - LoadBuff = pfile_read(szName, &dwLen); - tbuff = LoadBuff; - - if (ILoad() != 'RETL') - app_fatal("Invalid save file"); - - setlevel = OLoad(); - setlvlnum = WLoad(); - currlevel = WLoad(); - leveltype = WLoad(); - _ViewX = WLoad(); - _ViewY = WLoad(); - invflag = OLoad(); - chrflag = OLoad(); - _nummonsters = WLoad(); - _numitems = WLoad(); - _nummissiles = WLoad(); - _nobjects = WLoad(); - - for (i = 0; i < NUMLEVELS; i++) { - glSeedTbl[i] = ILoad(); - gnLevelTypeTbl[i] = WLoad(); - } - - LoadPlayer(myplr); - - for (i = 0; i < MAXQUESTS; i++) - LoadQuest(i); - for (i = 0; i < MAXPORTAL; i++) - LoadPortal(i); - - LoadGameLevel(firstflag, 4); - SyncInitPlr(myplr); - SyncPlrAnim(myplr); - - ViewX = _ViewX; - ViewY = _ViewY; - nummonsters = _nummonsters; - numitems = _numitems; - nummissiles = _nummissiles; - nobjects = _nobjects; - - for (i = 0; i < MAXMONSTERS; i++) - monstkills[i] = ILoad(); - - if (leveltype != DTYPE_TOWN) { - for (i = 0; i < MAXMONSTERS; i++) - monstactive[i] = WLoad(); - for (i = 0; i < nummonsters; i++) - LoadMonster(monstactive[i]); - for (i = 0; i < MAXMISSILES; i++) - missileactive[i] = BLoad(); - for (i = 0; i < MAXMISSILES; i++) - missileavail[i] = BLoad(); - for (i = 0; i < nummissiles; i++) - LoadMissile(missileactive[i]); - for (i = 0; i < MAXOBJECTS; i++) - objectactive[i] = BLoad(); - for (i = 0; i < MAXOBJECTS; i++) - objectavail[i] = BLoad(); - for (i = 0; i < nobjects; i++) - LoadObject(objectactive[i]); - for (i = 0; i < nobjects; i++) - SyncObjectAnim(objectactive[i]); - - numlights = WLoad(); - - for (i = 0; i < MAXLIGHTS; i++) - lightactive[i] = BLoad(); - for (i = 0; i < numlights; i++) - LoadLighting(lightactive[i]); - - visionid = WLoad(); - numvision = WLoad(); - - for (i = 0; i < numvision; i++) - LoadVision(i); - } - - for (i = 0; i < MAXITEMS; i++) - itemactive[i] = BLoad(); - for (i = 0; i < MAXITEMS; i++) - itemavail[i] = BLoad(); - for (i = 0; i < numitems; i++) - LoadItem(itemactive[i]); - for (i = 0; i < 128; i++) - UniqueItemFlag[i] = OLoad(); - - for (j = 0; j < MAXDUNY; j++) { - for (i = 0; i < MAXDUNX; i++) - dLight[i][j] = BLoad(); - } - for (j = 0; j < MAXDUNY; j++) { - for (i = 0; i < MAXDUNX; i++) - dFlags[i][j] = BLoad(); - } - for (j = 0; j < MAXDUNY; j++) { - for (i = 0; i < MAXDUNX; i++) - dPlayer[i][j] = BLoad(); - } - for (j = 0; j < MAXDUNY; j++) { - for (i = 0; i < MAXDUNX; i++) - dItem[i][j] = BLoad(); - } - - if (leveltype != DTYPE_TOWN) { - for (j = 0; j < MAXDUNY; j++) { - for (i = 0; i < MAXDUNX; i++) - dMonster[i][j] = WLoad(); - } - for (j = 0; j < MAXDUNY; j++) { - for (i = 0; i < MAXDUNX; i++) - dDead[i][j] = BLoad(); - } - for (j = 0; j < MAXDUNY; j++) { - for (i = 0; i < MAXDUNX; i++) - dObject[i][j] = BLoad(); - } - for (j = 0; j < MAXDUNY; j++) { - for (i = 0; i < MAXDUNX; i++) - dLight[i][j] = BLoad(); - } - for (j = 0; j < MAXDUNY; j++) { - for (i = 0; i < MAXDUNX; i++) - dPreLight[i][j] = BLoad(); - } - for (j = 0; j < DMAXY; j++) { - for (i = 0; i < DMAXX; i++) - automapview[i][j] = OLoad(); - } - for (j = 0; j < MAXDUNY; j++) { - for (i = 0; i < MAXDUNX; i++) - dMissile[i][j] = BLoad(); - } - } - - numpremium = WLoad(); - premiumlevel = WLoad(); - - for (i = 0; i < 6; i++) - LoadPremium(i); - - automapflag = OLoad(); - AutoMapScale = WLoad(); - mem_free_dbg(LoadBuff); - AutomapZoomReset(); - ResyncQuests(); - - if (leveltype != DTYPE_TOWN) - ProcessLightList(); - - RedoPlayerVision(); - ProcessVisionList(); - missiles_process_charge(); - ResetPal(); - SetCursor_(CURSOR_HAND); - gbProcessPlayers = TRUE; -} - -char BLoad() -{ - return *tbuff++; -} - -int WLoad() -{ - int rv = *tbuff++ << 24; - rv |= *tbuff++ << 16; - rv |= *tbuff++ << 8; - rv |= *tbuff++; - - return rv; -} - -int ILoad() -{ - int rv = *tbuff++ << 24; - rv |= *tbuff++ << 16; - rv |= *tbuff++ << 8; - rv |= *tbuff++; - - return rv; -} - -BOOL OLoad() -{ - if (*tbuff++ == TRUE) - return TRUE; - else - return FALSE; -} - -void CopyInt(const void *src, void *dst) -{ - memcpy(dst, src, 4); - tbuff += 4; -} - -void CopyShort(const void *src, void *dst) -{ - memcpy(dst, src, 2); - tbuff += 2; -} - -void CopyShorts(const void *src, const int n, void *dst) -{ - memcpy(dst, src, 2 * n); - tbuff += 2 * n; -} - -void CopyInts(const void *src, const int n, void *dst) -{ - memcpy(dst, src, 4 * n); - tbuff += 4 * n; -} - -void CopyBytes(const void *src, const int n, void *dst) -{ - memcpy(dst, src, n); - tbuff += n; -} - -void CopyChar(const void *src, void *dst) -{ - memcpy(dst, src, 1); - tbuff += 1; -} - -void CopyInt64(const void *src, void *dst) -{ - memcpy(dst, src, 8); - tbuff += 8; -} - -void LoadPlayer(int i) -{ - PlayerStruct *pPlayer = &plr[i]; - - CopyInt(tbuff, &pPlayer->_pmode); - - CopyBytes(tbuff, 25, pPlayer->walkpath); - CopyBytes(tbuff, 1, &pPlayer->plractive); - tbuff += 2; - - CopyInt(tbuff, &pPlayer->destAction); - CopyInt(tbuff, &pPlayer->destParam1); - CopyInt(tbuff, &pPlayer->destParam2); - CopyInt(tbuff, &pPlayer->destParam3); - CopyInt(tbuff, &pPlayer->destParam4); - CopyInt(tbuff, &pPlayer->plrlevel); - CopyInt(tbuff, &pPlayer->WorldX); - CopyInt(tbuff, &pPlayer->WorldY); - CopyInt(tbuff, &pPlayer->_px); - CopyInt(tbuff, &pPlayer->_py); - CopyInt(tbuff, &pPlayer->_ptargx); - CopyInt(tbuff, &pPlayer->_ptargy); - CopyInt(tbuff, &pPlayer->_pownerx); - CopyInt(tbuff, &pPlayer->_pownery); - CopyInt(tbuff, &pPlayer->_poldx); - CopyInt(tbuff, &pPlayer->_poldy); - CopyInt(tbuff, &pPlayer->_pxoff); - CopyInt(tbuff, &pPlayer->_pyoff); - CopyInt(tbuff, &pPlayer->_pxvel); - CopyInt(tbuff, &pPlayer->_pyvel); - CopyInt(tbuff, &pPlayer->_pdir); - CopyInt(tbuff, &pPlayer->_nextdir); - CopyInt(tbuff, &pPlayer->_pgfxnum); - tbuff += 4; // Skip pointers - CopyInt(tbuff, &pPlayer->_pAnimDelay); - CopyInt(tbuff, &pPlayer->_pAnimCnt); - CopyInt(tbuff, &pPlayer->_pAnimLen); - CopyInt(tbuff, &pPlayer->_pAnimFrame); - CopyInt(tbuff, &pPlayer->_pAnimWidth); - CopyInt(tbuff, &pPlayer->_pAnimWidth2); - CopyInt(tbuff, &pPlayer->_peflag); - CopyInt(tbuff, &pPlayer->_plid); - CopyInt(tbuff, &pPlayer->_pvid); - - CopyInt(tbuff, &pPlayer->_pSpell); - CopyChar(tbuff, &pPlayer->_pSplType); - CopyChar(tbuff, &pPlayer->_pSplFrom); - tbuff += 2; - CopyInt(tbuff, &pPlayer->_pTSpell); - CopyChar(tbuff, &pPlayer->_pTSplType); - tbuff += 3; - CopyInt(tbuff, &pPlayer->_pRSpell); - CopyChar(tbuff, &pPlayer->_pRSplType); - tbuff += 3; - CopyInt(tbuff, &pPlayer->_pSBkSpell); - CopyChar(tbuff, &pPlayer->_pSBkSplType); - - CopyBytes(tbuff, 64, &pPlayer->_pSplLvl); - tbuff += 7; - CopyInt64(tbuff, &pPlayer->_pMemSpells); - CopyInt64(tbuff, &pPlayer->_pAblSpells); - CopyInt64(tbuff, &pPlayer->_pScrlSpells); - CopyChar(tbuff, &pPlayer->_pSpellFlags); - tbuff += 3; - CopyInts(tbuff, 4, &pPlayer->_pSplHotKey); - CopyBytes(tbuff, 4, &pPlayer->_pSplTHotKey); - CopyInt(tbuff, &pPlayer->_pwtype); - CopyChar(tbuff, &pPlayer->_pBlockFlag); - CopyChar(tbuff, &pPlayer->_pInvincible); - CopyChar(tbuff, &pPlayer->_pLightRad); - CopyChar(tbuff, &pPlayer->_pLvlChanging); - CopyBytes(tbuff, PLR_NAME_LEN, &pPlayer->_pName); - CopyChar(tbuff, &pPlayer->_pClass); - tbuff += 3; - CopyInt(tbuff, &pPlayer->_pStrength); - CopyInt(tbuff, &pPlayer->_pBaseStr); - CopyInt(tbuff, &pPlayer->_pMagic); - CopyInt(tbuff, &pPlayer->_pBaseMag); - CopyInt(tbuff, &pPlayer->_pDexterity); - CopyInt(tbuff, &pPlayer->_pBaseDex); - CopyInt(tbuff, &pPlayer->_pVitality); - CopyInt(tbuff, &pPlayer->_pBaseVit); - CopyInt(tbuff, &pPlayer->_pStatPts); - CopyInt(tbuff, &pPlayer->_pDamageMod); - CopyInt(tbuff, &pPlayer->_pBaseToBlk); - CopyInt(tbuff, &pPlayer->_pHPBase); - CopyInt(tbuff, &pPlayer->_pMaxHPBase); - CopyInt(tbuff, &pPlayer->_pHitPoints); - CopyInt(tbuff, &pPlayer->_pMaxHP); - CopyInt(tbuff, &pPlayer->_pHPPer); - CopyInt(tbuff, &pPlayer->_pManaBase); - CopyInt(tbuff, &pPlayer->_pMaxManaBase); - CopyInt(tbuff, &pPlayer->_pMana); - CopyInt(tbuff, &pPlayer->_pMaxMana); - CopyInt(tbuff, &pPlayer->_pManaPer); - CopyChar(tbuff, &pPlayer->_pLevel); - CopyChar(tbuff, &pPlayer->_pMaxLvl); - tbuff += 2; - CopyInt(tbuff, &pPlayer->_pExperience); - CopyInt(tbuff, &pPlayer->_pMaxExp); - CopyInt(tbuff, &pPlayer->_pNextExper); - CopyChar(tbuff, &pPlayer->_pArmorClass); - CopyChar(tbuff, &pPlayer->_pMagResist); - CopyChar(tbuff, &pPlayer->_pFireResist); - CopyChar(tbuff, &pPlayer->_pLghtResist); - CopyInt(tbuff, &pPlayer->_pGold); - CopyInt(tbuff, &pPlayer->_pInfraFlag); - CopyInt(tbuff, &pPlayer->_pVar1); - CopyInt(tbuff, &pPlayer->_pVar2); - CopyInt(tbuff, &pPlayer->_pVar3); - CopyInt(tbuff, &pPlayer->_pVar4); - CopyInt(tbuff, &pPlayer->_pVar5); - CopyInt(tbuff, &pPlayer->_pVar6); - CopyInt(tbuff, &pPlayer->_pVar7); - CopyInt(tbuff, &pPlayer->_pVar8); - CopyBytes(tbuff, NUMLEVELS, &pPlayer->_pLvlVisited); - CopyBytes(tbuff, NUMLEVELS, &pPlayer->_pSLvlVisited); - tbuff += 2; - CopyInt(tbuff, &pPlayer->_pGFXLoad); - - tbuff += sizeof(DWORD) * 8; - CopyInt(tbuff, &pPlayer->_pNFrames); - CopyInt(tbuff, &pPlayer->_pNWidth); - - tbuff += sizeof(DWORD) * 8; - - CopyInt(tbuff, &pPlayer->_pWFrames); - CopyInt(tbuff, &pPlayer->_pWWidth); - - tbuff += sizeof(DWORD) * 8; - - CopyInt(tbuff, &pPlayer->_pAFrames); - CopyInt(tbuff, &pPlayer->_pAWidth); - CopyInt(tbuff, &pPlayer->_pAFNum); - - tbuff += sizeof(DWORD) * 24; - - CopyInt(tbuff, &pPlayer->_pSFrames); - CopyInt(tbuff, &pPlayer->_pSWidth); - CopyInt(tbuff, &pPlayer->_pSFNum); - - tbuff += sizeof(DWORD) * 8; - - CopyInt(tbuff, &pPlayer->_pHFrames); - CopyInt(tbuff, &pPlayer->_pHWidth); - - tbuff += sizeof(DWORD) * 8; - - CopyInt(tbuff, &pPlayer->_pDFrames); - CopyInt(tbuff, &pPlayer->_pDWidth); - - tbuff += sizeof(DWORD) * 8; - - CopyInt(tbuff, &pPlayer->_pBFrames); - CopyInt(tbuff, &pPlayer->_pBWidth); - CopyItems(NUM_INVLOC, pPlayer->InvBody); - CopyItems(NUM_INV_GRID_ELEM, pPlayer->InvList); - CopyInt(tbuff, &pPlayer->_pNumInv); - CopyBytes(tbuff, NUM_INV_GRID_ELEM, pPlayer->InvGrid); - CopyItems(MAXBELTITEMS, pPlayer->SpdList); - CopyItem(&pPlayer->HoldItem); - CopyInt(tbuff, &pPlayer->_pIMinDam); - CopyInt(tbuff, &pPlayer->_pIMaxDam); - CopyInt(tbuff, &pPlayer->_pIAC); - CopyInt(tbuff, &pPlayer->_pIBonusDam); - CopyInt(tbuff, &pPlayer->_pIBonusToHit); - CopyInt(tbuff, &pPlayer->_pIBonusAC); - CopyInt(tbuff, &pPlayer->_pIBonusDamMod); - tbuff += 4; - CopyInt64(tbuff, &pPlayer->_pISpells); - CopyInt(tbuff, &pPlayer->_pIFlags); - CopyInt(tbuff, &pPlayer->_pIGetHit); - - CopyChar(tbuff, &pPlayer->_pISplLvlAdd); - CopyChar(tbuff, &pPlayer->_pISplCost); - tbuff += 2; - - CopyInt(tbuff, &pPlayer->_pISplDur); - CopyInt(tbuff, &pPlayer->_pIEnAc); - CopyInt(tbuff, &pPlayer->_pIFMinDam); - CopyInt(tbuff, &pPlayer->_pIFMaxDam); - CopyInt(tbuff, &pPlayer->_pILMinDam); - CopyInt(tbuff, &pPlayer->_pILMaxDam); - CopyInt(tbuff, &pPlayer->_pOilType); - - CopyChar(tbuff, &pPlayer->pTownWarps); - CopyChar(tbuff, &pPlayer->pDungMsgs); - CopyChar(tbuff, &pPlayer->pLvlLoad); - CopyChar(tbuff, &pPlayer->pBattleNet); - - CopyChar(tbuff, &pPlayer->pManaShield); - CopyBytes(tbuff, 3, &pPlayer->bReserved); - - CopyShorts(tbuff, 8, &pPlayer->wReserved); - - CopyInt(tbuff, &pPlayer->pDiabloKillLevel); - CopyInts(tbuff, 7, &pPlayer->dwReserved); - - // Omit 10 pointers -} - -void SavePlayer(int i) -{ - PlayerStruct *pPlayer = &plr[i]; - - CopyInt(&pPlayer->_pmode, tbuff); - - CopyBytes(&pPlayer->walkpath, 25, tbuff); - CopyBytes(&pPlayer->plractive, 1, tbuff); - tbuff += 2; - - CopyInt(&pPlayer->destAction, tbuff); - CopyInt(&pPlayer->destParam1, tbuff); - CopyInt(&pPlayer->destParam2, tbuff); - CopyInt(&pPlayer->destParam3, tbuff); - CopyInt(&pPlayer->destParam4, tbuff); - CopyInt(&pPlayer->plrlevel, tbuff); - CopyInt(&pPlayer->WorldX, tbuff); - CopyInt(&pPlayer->WorldY, tbuff); - CopyInt(&pPlayer->_px, tbuff); - CopyInt(&pPlayer->_py, tbuff); - CopyInt(&pPlayer->_ptargx, tbuff); - CopyInt(&pPlayer->_ptargy, tbuff); - CopyInt(&pPlayer->_pownerx, tbuff); - CopyInt(&pPlayer->_pownery, tbuff); - CopyInt(&pPlayer->_poldx, tbuff); - CopyInt(&pPlayer->_poldy, tbuff); - CopyInt(&pPlayer->_pxoff, tbuff); - CopyInt(&pPlayer->_pyoff, tbuff); - CopyInt(&pPlayer->_pxvel, tbuff); - CopyInt(&pPlayer->_pyvel, tbuff); - CopyInt(&pPlayer->_pdir, tbuff); - CopyInt(&pPlayer->_nextdir, tbuff); - CopyInt(&pPlayer->_pgfxnum, tbuff); - tbuff += 4; // Skip pointers - CopyInt(&pPlayer->_pAnimDelay, tbuff); - CopyInt(&pPlayer->_pAnimCnt, tbuff); - CopyInt(&pPlayer->_pAnimLen, tbuff); - CopyInt(&pPlayer->_pAnimFrame, tbuff); - CopyInt(&pPlayer->_pAnimWidth, tbuff); - CopyInt(&pPlayer->_pAnimWidth2, tbuff); - CopyInt(&pPlayer->_peflag, tbuff); - CopyInt(&pPlayer->_plid, tbuff); - CopyInt(&pPlayer->_pvid, tbuff); - - CopyInt(&pPlayer->_pSpell, tbuff); - - CopyChar(&pPlayer->_pSplType, tbuff); - CopyChar(&pPlayer->_pSplFrom, tbuff); - tbuff += 2; - - CopyInt(&pPlayer->_pTSpell, tbuff); - CopyChar(&pPlayer->_pTSplType, tbuff); - tbuff += 3; - CopyInt(&pPlayer->_pRSpell, tbuff); - CopyChar(&pPlayer->_pRSplType, tbuff); - tbuff += 3; - CopyInt(&pPlayer->_pSBkSpell, tbuff); - CopyChar(&pPlayer->_pSBkSplType, tbuff); - - CopyBytes(&pPlayer->_pSplLvl, 64, tbuff); - tbuff += 7; - CopyInt64(&pPlayer->_pMemSpells, tbuff); - CopyInt64(&pPlayer->_pAblSpells, tbuff); - CopyInt64(&pPlayer->_pScrlSpells, tbuff); - CopyChar(&pPlayer->_pSpellFlags, tbuff); - tbuff += 3; - CopyInts(&pPlayer->_pSplHotKey, 4, tbuff); - CopyBytes(&pPlayer->_pSplTHotKey, 4, tbuff); - CopyInt(&pPlayer->_pwtype, tbuff); - CopyChar(&pPlayer->_pBlockFlag, tbuff); - CopyChar(&pPlayer->_pInvincible, tbuff); - CopyChar(&pPlayer->_pLightRad, tbuff); - CopyChar(&pPlayer->_pLvlChanging, tbuff); - CopyBytes(&pPlayer->_pName, PLR_NAME_LEN, tbuff); - CopyChar(&pPlayer->_pClass, tbuff); - tbuff += 3; - CopyInt(&pPlayer->_pStrength, tbuff); - CopyInt(&pPlayer->_pBaseStr, tbuff); - CopyInt(&pPlayer->_pMagic, tbuff); - CopyInt(&pPlayer->_pBaseMag, tbuff); - CopyInt(&pPlayer->_pDexterity, tbuff); - CopyInt(&pPlayer->_pBaseDex, tbuff); - CopyInt(&pPlayer->_pVitality, tbuff); - CopyInt(&pPlayer->_pBaseVit, tbuff); - CopyInt(&pPlayer->_pStatPts, tbuff); - CopyInt(&pPlayer->_pDamageMod, tbuff); - CopyInt(&pPlayer->_pBaseToBlk, tbuff); - CopyInt(&pPlayer->_pHPBase, tbuff); - CopyInt(&pPlayer->_pMaxHPBase, tbuff); - CopyInt(&pPlayer->_pHitPoints, tbuff); - CopyInt(&pPlayer->_pMaxHP, tbuff); - CopyInt(&pPlayer->_pHPPer, tbuff); - CopyInt(&pPlayer->_pManaBase, tbuff); - CopyInt(&pPlayer->_pMaxManaBase, tbuff); - CopyInt(&pPlayer->_pMana, tbuff); - CopyInt(&pPlayer->_pMaxMana, tbuff); - CopyInt(&pPlayer->_pManaPer, tbuff); - CopyChar(&pPlayer->_pLevel, tbuff); - CopyChar(&pPlayer->_pMaxLvl, tbuff); - tbuff += 2; - CopyInt(&pPlayer->_pExperience, tbuff); - CopyInt(&pPlayer->_pMaxExp, tbuff); - CopyInt(&pPlayer->_pNextExper, tbuff); - CopyChar(&pPlayer->_pArmorClass, tbuff); - CopyChar(&pPlayer->_pMagResist, tbuff); - CopyChar(&pPlayer->_pFireResist, tbuff); - CopyChar(&pPlayer->_pLghtResist, tbuff); - CopyInt(&pPlayer->_pGold, tbuff); - CopyInt(&pPlayer->_pInfraFlag, tbuff); - CopyInt(&pPlayer->_pVar1, tbuff); - CopyInt(&pPlayer->_pVar2, tbuff); - CopyInt(&pPlayer->_pVar3, tbuff); - CopyInt(&pPlayer->_pVar4, tbuff); - CopyInt(&pPlayer->_pVar5, tbuff); - CopyInt(&pPlayer->_pVar6, tbuff); - CopyInt(&pPlayer->_pVar7, tbuff); - CopyInt(&pPlayer->_pVar8, tbuff); - CopyBytes(&pPlayer->_pLvlVisited, NUMLEVELS, tbuff); - CopyBytes(&pPlayer->_pSLvlVisited, NUMLEVELS, tbuff); // only 10 used - tbuff += 2; - CopyInt(&pPlayer->_pGFXLoad, tbuff); - - tbuff += sizeof(DWORD) * 8; // Skip 8 pointers - CopyInt(&pPlayer->_pNFrames, tbuff); - CopyInt(&pPlayer->_pNWidth, tbuff); - - tbuff += sizeof(DWORD) * 8; // Skip 8 pointers - - CopyInt(&pPlayer->_pWFrames, tbuff); - CopyInt(&pPlayer->_pWWidth, tbuff); - - tbuff += sizeof(DWORD) * 8; // Skip 8 pointers - - CopyInt(&pPlayer->_pAFrames, tbuff); - CopyInt(&pPlayer->_pAWidth, tbuff); - CopyInt(&pPlayer->_pAFNum, tbuff); - - tbuff += sizeof(DWORD) * 24; // Skip 24 pointers - - CopyInt(&pPlayer->_pSFrames, tbuff); - CopyInt(&pPlayer->_pSWidth, tbuff); - CopyInt(&pPlayer->_pSFNum, tbuff); - - tbuff += sizeof(DWORD) * 8; // Skip 8 pointers - - CopyInt(&pPlayer->_pHFrames, tbuff); - CopyInt(&pPlayer->_pHWidth, tbuff); - - tbuff += sizeof(DWORD) * 8; // Skip 8 pointers - - CopyInt(&pPlayer->_pDFrames, tbuff); - CopyInt(&pPlayer->_pDWidth, tbuff); - - tbuff += sizeof(DWORD) * 8; // Skip 8 pointers - - CopyInt(&pPlayer->_pBFrames, tbuff); - CopyInt(&pPlayer->_pBWidth, tbuff); - SaveItems(pPlayer->InvBody, NUM_INVLOC); - SaveItems(pPlayer->InvList, NUM_INV_GRID_ELEM); - CopyInt(&pPlayer->_pNumInv, tbuff); - CopyBytes(pPlayer->InvGrid, NUM_INV_GRID_ELEM, tbuff); - SaveItems(pPlayer->SpdList, MAXBELTITEMS); - SaveItem(&pPlayer->HoldItem); - CopyInt(&pPlayer->_pIMinDam, tbuff); - CopyInt(&pPlayer->_pIMaxDam, tbuff); - CopyInt(&pPlayer->_pIAC, tbuff); - CopyInt(&pPlayer->_pIBonusDam, tbuff); - CopyInt(&pPlayer->_pIBonusToHit, tbuff); - CopyInt(&pPlayer->_pIBonusAC, tbuff); - CopyInt(&pPlayer->_pIBonusDamMod, tbuff); - tbuff += 4; - CopyInt64(&pPlayer->_pISpells, tbuff); - CopyInt(&pPlayer->_pIFlags, tbuff); - CopyInt(&pPlayer->_pIGetHit, tbuff); - - CopyChar(&pPlayer->_pISplLvlAdd, tbuff); - CopyChar(&pPlayer->_pISplCost, tbuff); - tbuff += 2; - - CopyInt(&pPlayer->_pISplDur, tbuff); - CopyInt(&pPlayer->_pIEnAc, tbuff); - CopyInt(&pPlayer->_pIFMinDam, tbuff); - CopyInt(&pPlayer->_pIFMaxDam, tbuff); - CopyInt(&pPlayer->_pILMinDam, tbuff); - CopyInt(&pPlayer->_pILMaxDam, tbuff); - CopyInt(&pPlayer->_pOilType, tbuff); - - CopyChar(&pPlayer->pTownWarps, tbuff); - CopyChar(&pPlayer->pDungMsgs, tbuff); - CopyChar(&pPlayer->pLvlLoad, tbuff); - CopyChar(&pPlayer->pBattleNet, tbuff); - - CopyChar(&pPlayer->pManaShield, tbuff); - CopyBytes(&pPlayer->bReserved, 3, tbuff); - - CopyShorts(&pPlayer->wReserved, 8, tbuff); - - CopyInt(&pPlayer->pDiabloKillLevel, tbuff); - CopyInts(&pPlayer->dwReserved, 7, tbuff); - - // Omit 10 pointers -} - -void LoadMonster(int i) -{ - MonsterStruct *pMonster = &monster[i]; - - CopyInt(tbuff, &pMonster->_mMTidx); - CopyInt(tbuff, &pMonster->_mmode); - - CopyChar(tbuff, &pMonster->_mgoal); - tbuff += 3; - - CopyInt(tbuff, &pMonster->_mgoalvar1); - CopyInt(tbuff, &pMonster->_mgoalvar2); - CopyInt(tbuff, &pMonster->_mgoalvar3); - CopyInt(tbuff, &pMonster->field_18); - - CopyChar(tbuff, &pMonster->_pathcount); - tbuff += 3; - - CopyInt(tbuff, &pMonster->_mx); - CopyInt(tbuff, &pMonster->_my); - CopyInt(tbuff, &pMonster->_mfutx); - CopyInt(tbuff, &pMonster->_mfuty); - CopyInt(tbuff, &pMonster->_moldx); - CopyInt(tbuff, &pMonster->_moldy); - CopyInt(tbuff, &pMonster->_mxoff); - CopyInt(tbuff, &pMonster->_myoff); - CopyInt(tbuff, &pMonster->_mxvel); - CopyInt(tbuff, &pMonster->_myvel); - CopyInt(tbuff, &pMonster->_mdir); - CopyInt(tbuff, &pMonster->_menemy); - - CopyChar(tbuff, &pMonster->_menemyx); - CopyChar(tbuff, &pMonster->_menemyy); - CopyShort(tbuff, &pMonster->falign_52); - - tbuff += 4; // Skip pointer - CopyInt(tbuff, &pMonster->_mAnimDelay); - CopyInt(tbuff, &pMonster->_mAnimCnt); - CopyInt(tbuff, &pMonster->_mAnimLen); - CopyInt(tbuff, &pMonster->_mAnimFrame); - CopyInt(tbuff, &pMonster->_meflag); - CopyInt(tbuff, &pMonster->_mDelFlag); - CopyInt(tbuff, &pMonster->_mVar1); - CopyInt(tbuff, &pMonster->_mVar2); - CopyInt(tbuff, &pMonster->_mVar3); - CopyInt(tbuff, &pMonster->_mVar4); - CopyInt(tbuff, &pMonster->_mVar5); - CopyInt(tbuff, &pMonster->_mVar6); - CopyInt(tbuff, &pMonster->_mVar7); - CopyInt(tbuff, &pMonster->_mVar8); - CopyInt(tbuff, &pMonster->_mmaxhp); - CopyInt(tbuff, &pMonster->_mhitpoints); - - CopyChar(tbuff, &pMonster->_mAi); - CopyChar(tbuff, &pMonster->_mint); - CopyShort(tbuff, &pMonster->falign_9A); - - CopyInt(tbuff, &pMonster->_mFlags); - - CopyChar(tbuff, &pMonster->_msquelch); - tbuff += 3; - - CopyInt(tbuff, &pMonster->falign_A4); - CopyInt(tbuff, &pMonster->_lastx); - CopyInt(tbuff, &pMonster->_lasty); - CopyInt(tbuff, &pMonster->_mRndSeed); - CopyInt(tbuff, &pMonster->_mAISeed); - CopyInt(tbuff, &pMonster->falign_B8); - - CopyChar(tbuff, &pMonster->_uniqtype); - CopyChar(tbuff, &pMonster->_uniqtrans); - CopyChar(tbuff, &pMonster->_udeadval); - CopyChar(tbuff, &pMonster->mWhoHit); - - CopyChar(tbuff, &pMonster->mLevel); - CopyShort(tbuff, &pMonster->mExp); - tbuff += 1; - - CopyChar(tbuff, &pMonster->mHit); - CopyChar(tbuff, &pMonster->mMinDamage); - CopyChar(tbuff, &pMonster->mMaxDamage); - CopyChar(tbuff, &pMonster->mHit2); - - CopyChar(tbuff, &pMonster->mMinDamage2); - CopyChar(tbuff, &pMonster->mMaxDamage2); - CopyChar(tbuff, &pMonster->mArmorClass); - CopyChar(tbuff, &pMonster->falign_CB); - - CopyShort(tbuff, &pMonster->mMagicRes); - tbuff += 2; - - CopyInt(tbuff, &pMonster->mtalkmsg); - - CopyChar(tbuff, &pMonster->leader); - CopyChar(tbuff, &pMonster->leaderflag); - CopyChar(tbuff, &pMonster->packsize); - CopyChar(tbuff, &pMonster->mlid); - - SyncMonsterAnim(i); -} - -void LoadMissile(int i) -{ - MissileStruct *pMissile = &missile[i]; - - CopyInt(tbuff, &pMissile->_mitype); - CopyInt(tbuff, &pMissile->_mix); - CopyInt(tbuff, &pMissile->_miy); - CopyInt(tbuff, &pMissile->_mixoff); - CopyInt(tbuff, &pMissile->_miyoff); - CopyInt(tbuff, &pMissile->_mixvel); - CopyInt(tbuff, &pMissile->_miyvel); - CopyInt(tbuff, &pMissile->_misx); - CopyInt(tbuff, &pMissile->_misy); - CopyInt(tbuff, &pMissile->_mitxoff); - CopyInt(tbuff, &pMissile->_mityoff); - CopyInt(tbuff, &pMissile->_mimfnum); - CopyInt(tbuff, &pMissile->_mispllvl); - CopyInt(tbuff, &pMissile->_miDelFlag); - CopyChar(tbuff, &pMissile->_miAnimType); - tbuff += 3; - - CopyInt(tbuff, &pMissile->_miAnimFlags); - tbuff += 4; - CopyInt(tbuff, &pMissile->_miAnimDelay); - CopyInt(tbuff, &pMissile->_miAnimLen); - CopyInt(tbuff, &pMissile->_miAnimWidth); - CopyInt(tbuff, &pMissile->_miAnimWidth2); - CopyInt(tbuff, &pMissile->_miAnimCnt); - CopyInt(tbuff, &pMissile->_miAnimAdd); - CopyInt(tbuff, &pMissile->_miAnimFrame); - CopyInt(tbuff, &pMissile->_miDrawFlag); - CopyInt(tbuff, &pMissile->_miLightFlag); - CopyInt(tbuff, &pMissile->_miPreFlag); - CopyInt(tbuff, &pMissile->_miUniqTrans); - CopyInt(tbuff, &pMissile->_mirange); - CopyInt(tbuff, &pMissile->_misource); - CopyInt(tbuff, &pMissile->_micaster); - CopyInt(tbuff, &pMissile->_midam); - CopyInt(tbuff, &pMissile->_miHitFlag); - CopyInt(tbuff, &pMissile->_midist); - CopyInt(tbuff, &pMissile->_mlid); - CopyInt(tbuff, &pMissile->_mirnd); - CopyInt(tbuff, &pMissile->_miVar1); - CopyInt(tbuff, &pMissile->_miVar2); - CopyInt(tbuff, &pMissile->_miVar3); - CopyInt(tbuff, &pMissile->_miVar4); - CopyInt(tbuff, &pMissile->_miVar5); - CopyInt(tbuff, &pMissile->_miVar6); - CopyInt(tbuff, &pMissile->_miVar7); - CopyInt(tbuff, &pMissile->_miVar8); -} - -void LoadObject(int i) -{ - ObjectStruct *pObject = &object[i]; - CopyInt(tbuff, &pObject->_otype); - CopyInt(tbuff, &pObject->_ox); - CopyInt(tbuff, &pObject->_oy); - CopyInt(tbuff, &pObject->_oLight); - CopyInt(tbuff, &pObject->_oAnimFlag); - tbuff += 4; - CopyInt(tbuff, &pObject->_oAnimDelay); - CopyInt(tbuff, &pObject->_oAnimCnt); - CopyInt(tbuff, &pObject->_oAnimLen); - CopyInt(tbuff, &pObject->_oAnimFrame); - CopyInt(tbuff, &pObject->_oAnimWidth); - CopyInt(tbuff, &pObject->_oAnimWidth2); - CopyInt(tbuff, &pObject->_oDelFlag); - - CopyChar(tbuff, &pObject->_oBreak); - tbuff += 3; - - CopyInt(tbuff, &pObject->_oSolidFlag); - CopyInt(tbuff, &pObject->_oMissFlag); - - CopyChar(tbuff, &pObject->_oSelFlag); - tbuff += 3; - - CopyInt(tbuff, &pObject->_oPreFlag); - CopyInt(tbuff, &pObject->_oTrapFlag); - CopyInt(tbuff, &pObject->_oDoorFlag); - CopyInt(tbuff, &pObject->_olid); - CopyInt(tbuff, &pObject->_oRndSeed); - CopyInt(tbuff, &pObject->_oVar1); - CopyInt(tbuff, &pObject->_oVar2); - CopyInt(tbuff, &pObject->_oVar3); - CopyInt(tbuff, &pObject->_oVar4); - CopyInt(tbuff, &pObject->_oVar5); - CopyInt(tbuff, &pObject->_oVar6); - CopyInt(tbuff, &pObject->_oVar7); - CopyInt(tbuff, &pObject->_oVar8); -} - -void LoadItem(int i) -{ - CopyItem(&item[i]); - GetItemFrm(i); -} - -void CopyItem(ItemStruct *pItem) -{ - CopyInt(tbuff, &pItem->_iSeed); - CopyShort(tbuff, &pItem->_iCreateInfo); - tbuff += 2; - CopyInt(tbuff, &pItem->_itype); - CopyInt(tbuff, &pItem->_ix); - CopyInt(tbuff, &pItem->_iy); - CopyInt(tbuff, &pItem->_iAnimFlag); - tbuff += 4; // Skip pointer _iAnimData - CopyInt(tbuff, &pItem->_iAnimLen); - CopyInt(tbuff, &pItem->_iAnimFrame); - CopyInt(tbuff, &pItem->_iAnimWidth); - CopyInt(tbuff, &pItem->_iAnimWidth2); - CopyInt(tbuff, &pItem->_isin); - CopyChar(tbuff, &pItem->_iSelFlag); - tbuff += 3; - CopyInt(tbuff, &pItem->_iPostDraw); - CopyInt(tbuff, &pItem->_iIdentified); - CopyChar(tbuff, &pItem->_iMagical); - CopyBytes(tbuff, 64, &pItem->_iName); - CopyBytes(tbuff, 64, &pItem->_iIName); - CopyChar(tbuff, &pItem->_iLoc); - CopyChar(tbuff, &pItem->_iClass); - tbuff += 1; - CopyInt(tbuff, &pItem->_iCurs); - CopyInt(tbuff, &pItem->_ivalue); - CopyInt(tbuff, &pItem->_iIvalue); - CopyInt(tbuff, &pItem->_iMinDam); - CopyInt(tbuff, &pItem->_iMaxDam); - CopyInt(tbuff, &pItem->_iAC); - CopyInt(tbuff, &pItem->_iFlags); - CopyInt(tbuff, &pItem->_iMiscId); - CopyInt(tbuff, &pItem->_iSpell); - CopyInt(tbuff, &pItem->_iCharges); - CopyInt(tbuff, &pItem->_iMaxCharges); - CopyInt(tbuff, &pItem->_iDurability); - CopyInt(tbuff, &pItem->_iMaxDur); - CopyInt(tbuff, &pItem->_iPLDam); - CopyInt(tbuff, &pItem->_iPLToHit); - CopyInt(tbuff, &pItem->_iPLAC); - CopyInt(tbuff, &pItem->_iPLStr); - CopyInt(tbuff, &pItem->_iPLMag); - CopyInt(tbuff, &pItem->_iPLDex); - CopyInt(tbuff, &pItem->_iPLVit); - CopyInt(tbuff, &pItem->_iPLFR); - CopyInt(tbuff, &pItem->_iPLLR); - CopyInt(tbuff, &pItem->_iPLMR); - CopyInt(tbuff, &pItem->_iPLMana); - CopyInt(tbuff, &pItem->_iPLHP); - CopyInt(tbuff, &pItem->_iPLDamMod); - CopyInt(tbuff, &pItem->_iPLGetHit); - CopyInt(tbuff, &pItem->_iPLLight); - CopyChar(tbuff, &pItem->_iSplLvlAdd); - CopyChar(tbuff, &pItem->_iRequest); - tbuff += 2; - CopyInt(tbuff, &pItem->_iUid); - CopyInt(tbuff, &pItem->_iFMinDam); - CopyInt(tbuff, &pItem->_iFMaxDam); - CopyInt(tbuff, &pItem->_iLMinDam); - CopyInt(tbuff, &pItem->_iLMaxDam); - CopyInt(tbuff, &pItem->_iPLEnAc); - CopyChar(tbuff, &pItem->_iPrePower); - CopyChar(tbuff, &pItem->_iSufPower); - tbuff += 2; - CopyInt(tbuff, &pItem->_iVAdd1); - CopyInt(tbuff, &pItem->_iVMult1); - CopyInt(tbuff, &pItem->_iVAdd2); - CopyInt(tbuff, &pItem->_iVMult2); - CopyChar(tbuff, &pItem->_iMinStr); - CopyChar(tbuff, &pItem->_iMinMag); - CopyChar(tbuff, &pItem->_iMinDex); - tbuff += 1; - CopyInt(tbuff, &pItem->_iStatFlag); - CopyInt(tbuff, &pItem->IDidx); - CopyInt(tbuff, &pItem->offs016C); -} - -void CopyItems(const int n, ItemStruct *pItem) -{ - for (int i = 0; i < n; i++) { - CopyItem(&pItem[i]); - } -} - -void SaveItem(ItemStruct *pItem) -{ - CopyInt(&pItem->_iSeed, tbuff); - CopyShort(&pItem->_iCreateInfo, tbuff); - tbuff += 2; - CopyInt(&pItem->_itype, tbuff); - CopyInt(&pItem->_ix, tbuff); - CopyInt(&pItem->_iy, tbuff); - CopyInt(&pItem->_iAnimFlag, tbuff); - tbuff += 4; // Skip pointer _iAnimData - CopyInt(&pItem->_iAnimLen, tbuff); - CopyInt(&pItem->_iAnimFrame, tbuff); - CopyInt(&pItem->_iAnimWidth, tbuff); - CopyInt(&pItem->_iAnimWidth2, tbuff); // width 2? - CopyInt(&pItem->_isin, tbuff); // set when item is flagged for deletion, deprecated in 1.02 - CopyChar(&pItem->_iSelFlag, tbuff); - tbuff += 3; - CopyInt(&pItem->_iPostDraw, tbuff); - CopyInt(&pItem->_iIdentified, tbuff); - CopyChar(&pItem->_iMagical, tbuff); - CopyBytes(&pItem->_iName, 64, tbuff); - CopyBytes(&pItem->_iIName, 64, tbuff); - CopyChar(&pItem->_iLoc, tbuff); - CopyChar(&pItem->_iClass, tbuff); - tbuff += 1; - CopyInt(&pItem->_iCurs, tbuff); - CopyInt(&pItem->_ivalue, tbuff); - CopyInt(&pItem->_iIvalue, tbuff); - CopyInt(&pItem->_iMinDam, tbuff); - CopyInt(&pItem->_iMaxDam, tbuff); - CopyInt(&pItem->_iAC, tbuff); - CopyInt(&pItem->_iFlags, tbuff); - CopyInt(&pItem->_iMiscId, tbuff); - CopyInt(&pItem->_iSpell, tbuff); - CopyInt(&pItem->_iCharges, tbuff); - CopyInt(&pItem->_iMaxCharges, tbuff); - CopyInt(&pItem->_iDurability, tbuff); - CopyInt(&pItem->_iMaxDur, tbuff); - CopyInt(&pItem->_iPLDam, tbuff); - CopyInt(&pItem->_iPLToHit, tbuff); - CopyInt(&pItem->_iPLAC, tbuff); - CopyInt(&pItem->_iPLStr, tbuff); - CopyInt(&pItem->_iPLMag, tbuff); - CopyInt(&pItem->_iPLDex, tbuff); - CopyInt(&pItem->_iPLVit, tbuff); - CopyInt(&pItem->_iPLFR, tbuff); - CopyInt(&pItem->_iPLLR, tbuff); - CopyInt(&pItem->_iPLMR, tbuff); - CopyInt(&pItem->_iPLMana, tbuff); - CopyInt(&pItem->_iPLHP, tbuff); - CopyInt(&pItem->_iPLDamMod, tbuff); - CopyInt(&pItem->_iPLGetHit, tbuff); - CopyInt(&pItem->_iPLLight, tbuff); - CopyChar(&pItem->_iSplLvlAdd, tbuff); - CopyChar(&pItem->_iRequest, tbuff); - tbuff += 2; - CopyInt(&pItem->_iUid, tbuff); - CopyInt(&pItem->_iFMinDam, tbuff); - CopyInt(&pItem->_iFMaxDam, tbuff); - CopyInt(&pItem->_iLMinDam, tbuff); - CopyInt(&pItem->_iLMaxDam, tbuff); - CopyInt(&pItem->_iPLEnAc, tbuff); - CopyChar(&pItem->_iPrePower, tbuff); - CopyChar(&pItem->_iSufPower, tbuff); - tbuff += 2; - CopyInt(&pItem->_iVAdd1, tbuff); - CopyInt(&pItem->_iVMult1, tbuff); - CopyInt(&pItem->_iVAdd2, tbuff); - CopyInt(&pItem->_iVMult2, tbuff); - CopyChar(&pItem->_iMinStr, tbuff); - CopyChar(&pItem->_iMinMag, tbuff); - CopyChar(&pItem->_iMinDex, tbuff); - tbuff += 1; - CopyInt(&pItem->_iStatFlag, tbuff); - CopyInt(&pItem->IDidx, tbuff); - CopyInt(&pItem->offs016C, tbuff); -} - -void SaveItems(ItemStruct *pItem, const int n) -{ - for (int i = 0; i < n; i++) { - SaveItem(&pItem[i]); - } -} - -void LoadPremium(int i) -{ - CopyItem(&item[i]); -} - -void LoadQuest(int i) -{ - memcpy(&quests[i], tbuff, sizeof(*quests)); - tbuff += sizeof(*quests); - ReturnLvlX = WLoad(); - ReturnLvlY = WLoad(); - ReturnLvl = WLoad(); - ReturnLvlT = WLoad(); - DoomQuestState = WLoad(); -} - -void LoadLighting(int i) -{ - memcpy(&LightList[i], tbuff, sizeof(*LightList)); - tbuff += sizeof(*LightList); -} - -void LoadVision(int i) -{ - memcpy(&VisionList[i], tbuff, sizeof(*VisionList)); - tbuff += sizeof(*VisionList); -} - -void LoadPortal(int i) -{ - memcpy(&portal[i], tbuff, sizeof(*portal)); - tbuff += sizeof(*portal); -} - -void SaveGame() -{ - int i, j; - char szName[MAX_PATH]; - - DWORD dwLen = codec_get_encoded_len(FILEBUFF); - BYTE *SaveBuff = DiabloAllocPtr(dwLen); - tbuff = SaveBuff; - - ISave('RETL'); - OSave((unsigned char)setlevel); - WSave(setlvlnum); - WSave(currlevel); - WSave((unsigned char)leveltype); - WSave(ViewX); - WSave(ViewY); - OSave(invflag); - OSave(chrflag); - WSave(nummonsters); - WSave(numitems); - WSave(nummissiles); - WSave(nobjects); - - for (i = 0; i < NUMLEVELS; i++) { - ISave(glSeedTbl[i]); - WSave(gnLevelTypeTbl[i]); - } - - SavePlayer(myplr); - - for (i = 0; i < MAXQUESTS; i++) - SaveQuest(i); - for (i = 0; i < MAXPORTAL; i++) - SavePortal(i); - for (i = 0; i < MAXMONSTERS; i++) - ISave(monstkills[i]); - - if (leveltype != DTYPE_TOWN) { - for (i = 0; i < MAXMONSTERS; i++) - WSave(monstactive[i]); - for (i = 0; i < nummonsters; i++) - SaveMonster(monstactive[i]); - for (i = 0; i < MAXMISSILES; i++) - BSave(missileactive[i]); - for (i = 0; i < MAXMISSILES; i++) - BSave(missileavail[i]); - for (i = 0; i < nummissiles; i++) - SaveMissile(missileactive[i]); - for (i = 0; i < MAXOBJECTS; i++) - BSave(objectactive[i]); - for (i = 0; i < MAXOBJECTS; i++) - BSave(objectavail[i]); - for (i = 0; i < nobjects; i++) - SaveObject(objectactive[i]); - - WSave(numlights); - - for (i = 0; i < MAXLIGHTS; i++) - BSave(lightactive[i]); - for (i = 0; i < numlights; i++) - SaveLighting(lightactive[i]); - - WSave(visionid); - WSave(numvision); - - for (i = 0; i < numvision; i++) - SaveVision(i); - } - - for (i = 0; i < MAXITEMS; i++) - BSave(itemactive[i]); - for (i = 0; i < MAXITEMS; i++) - BSave(itemavail[i]); - for (i = 0; i < numitems; i++) - SaveItem(&item[itemactive[i]]); - for (i = 0; i < 128; i++) - OSave(UniqueItemFlag[i]); - - for (j = 0; j < MAXDUNY; j++) { - for (i = 0; i < MAXDUNX; i++) - BSave(dLight[i][j]); - } - for (j = 0; j < MAXDUNY; j++) { - for (i = 0; i < MAXDUNX; i++) - BSave(dFlags[i][j] & ~(BFLAG_MISSILE | BFLAG_VISIBLE | BFLAG_DEAD_PLAYER)); - } - for (j = 0; j < MAXDUNY; j++) { - for (i = 0; i < MAXDUNX; i++) - BSave(dPlayer[i][j]); - } - for (j = 0; j < MAXDUNY; j++) { - for (i = 0; i < MAXDUNX; i++) - BSave(dItem[i][j]); - } - - if (leveltype != DTYPE_TOWN) { - for (j = 0; j < MAXDUNY; j++) { - for (i = 0; i < MAXDUNX; i++) - WSave(dMonster[i][j]); - } - for (j = 0; j < MAXDUNY; j++) { - for (i = 0; i < MAXDUNX; i++) - BSave(dDead[i][j]); - } - for (j = 0; j < MAXDUNY; j++) { - for (i = 0; i < MAXDUNX; i++) - BSave(dObject[i][j]); - } - for (j = 0; j < MAXDUNY; j++) { - for (i = 0; i < MAXDUNX; i++) - BSave(dLight[i][j]); - } - for (j = 0; j < MAXDUNY; j++) { - for (i = 0; i < MAXDUNX; i++) - BSave(dPreLight[i][j]); - } - for (j = 0; j < DMAXY; j++) { - for (i = 0; i < DMAXX; i++) - OSave(automapview[i][j]); - } - for (j = 0; j < MAXDUNY; j++) { - for (i = 0; i < MAXDUNX; i++) - BSave(dMissile[i][j]); - } - } - - WSave(numpremium); - WSave(premiumlevel); - - for (i = 0; i < 6; i++) - SavePremium(i); - - OSave(automapflag); - WSave(AutoMapScale); - pfile_get_game_name(szName); - dwLen = codec_get_encoded_len(tbuff - SaveBuff); - pfile_write_save_file(szName, SaveBuff, tbuff - SaveBuff, dwLen); - mem_free_dbg(SaveBuff); - gbValidSaveFile = TRUE; - pfile_rename_temp_to_perm(); - pfile_write_hero(); -} - -void BSave(char v) -{ - *tbuff++ = v; -} - -void WSave(int v) -{ - *tbuff++ = v >> 24; - *tbuff++ = v >> 16; - *tbuff++ = v >> 8; - *tbuff++ = v; -} - -void ISave(int v) -{ - *tbuff++ = v >> 24; - *tbuff++ = v >> 16; - *tbuff++ = v >> 8; - *tbuff++ = v; -} - -void OSave(BOOL v) -{ - if (v != FALSE) - *tbuff++ = TRUE; - else - *tbuff++ = FALSE; -} - -void SaveMonster(int i) -{ - MonsterStruct *pMonster = &monster[i]; - - CopyInt(&pMonster->_mMTidx, tbuff); - CopyInt(&pMonster->_mmode, tbuff); - - CopyChar(&pMonster->_mgoal, tbuff); - tbuff += 3; - - CopyInt(&pMonster->_mgoalvar1, tbuff); - CopyInt(&pMonster->_mgoalvar2, tbuff); - CopyInt(&pMonster->_mgoalvar3, tbuff); - CopyInt(&pMonster->field_18, tbuff); - - CopyChar(&pMonster->_pathcount, tbuff); - tbuff += 3; - - CopyInt(&pMonster->_mx, tbuff); - CopyInt(&pMonster->_my, tbuff); - CopyInt(&pMonster->_mfutx, tbuff); - CopyInt(&pMonster->_mfuty, tbuff); - CopyInt(&pMonster->_moldx, tbuff); - CopyInt(&pMonster->_moldy, tbuff); - CopyInt(&pMonster->_mxoff, tbuff); - CopyInt(&pMonster->_myoff, tbuff); - CopyInt(&pMonster->_mxvel, tbuff); - CopyInt(&pMonster->_myvel, tbuff); - CopyInt(&pMonster->_mdir, tbuff); - CopyInt(&pMonster->_menemy, tbuff); - - CopyChar(&pMonster->_menemyx, tbuff); - CopyChar(&pMonster->_menemyy, tbuff); - CopyShort(&pMonster->falign_52, tbuff); - - tbuff += 4; // Skip pointer - CopyInt(&pMonster->_mAnimDelay, tbuff); - CopyInt(&pMonster->_mAnimCnt, tbuff); - CopyInt(&pMonster->_mAnimLen, tbuff); - CopyInt(&pMonster->_mAnimFrame, tbuff); - CopyInt(&pMonster->_meflag, tbuff); - CopyInt(&pMonster->_mDelFlag, tbuff); - CopyInt(&pMonster->_mVar1, tbuff); - CopyInt(&pMonster->_mVar2, tbuff); - CopyInt(&pMonster->_mVar3, tbuff); - CopyInt(&pMonster->_mVar4, tbuff); - CopyInt(&pMonster->_mVar5, tbuff); - CopyInt(&pMonster->_mVar6, tbuff); - CopyInt(&pMonster->_mVar7, tbuff); - CopyInt(&pMonster->_mVar8, tbuff); - CopyInt(&pMonster->_mmaxhp, tbuff); - CopyInt(&pMonster->_mhitpoints, tbuff); - - CopyChar(&pMonster->_mAi, tbuff); - CopyChar(&pMonster->_mint, tbuff); - CopyShort(&pMonster->falign_9A, tbuff); - - CopyInt(&pMonster->_mFlags, tbuff); - - CopyChar(&pMonster->_msquelch, tbuff); - tbuff += 3; - - CopyInt(&pMonster->falign_A4, tbuff); - CopyInt(&pMonster->_lastx, tbuff); - CopyInt(&pMonster->_lasty, tbuff); - CopyInt(&pMonster->_mRndSeed, tbuff); - CopyInt(&pMonster->_mAISeed, tbuff); - CopyInt(&pMonster->falign_B8, tbuff); - - CopyChar(&pMonster->_uniqtype, tbuff); - CopyChar(&pMonster->_uniqtrans, tbuff); - CopyChar(&pMonster->_udeadval, tbuff); - CopyChar(&pMonster->mWhoHit, tbuff); - - CopyChar(&pMonster->mLevel, tbuff); - CopyShort(&pMonster->mExp, tbuff); - tbuff += 1; - - CopyChar(&pMonster->mHit, tbuff); - CopyChar(&pMonster->mMinDamage, tbuff); - CopyChar(&pMonster->mMaxDamage, tbuff); - CopyChar(&pMonster->mHit2, tbuff); - - CopyChar(&pMonster->mMinDamage2, tbuff); - CopyChar(&pMonster->mMaxDamage2, tbuff); - CopyChar(&pMonster->mArmorClass, tbuff); - CopyChar(&pMonster->falign_CB, tbuff); - - CopyShort(&pMonster->mMagicRes, tbuff); - tbuff += 2; - - CopyInt(&pMonster->mtalkmsg, tbuff); - - CopyChar(&pMonster->leader, tbuff); - CopyChar(&pMonster->leaderflag, tbuff); - CopyChar(&pMonster->packsize, tbuff); - CopyChar(&pMonster->mlid, tbuff); -} - -void SaveMissile(int i) -{ - MissileStruct *pMissile = &missile[i]; - - CopyInt(&pMissile->_mitype, tbuff); - CopyInt(&pMissile->_mix, tbuff); - CopyInt(&pMissile->_miy, tbuff); - CopyInt(&pMissile->_mixoff, tbuff); - CopyInt(&pMissile->_miyoff, tbuff); - CopyInt(&pMissile->_mixvel, tbuff); - CopyInt(&pMissile->_miyvel, tbuff); - CopyInt(&pMissile->_misx, tbuff); - CopyInt(&pMissile->_misy, tbuff); - CopyInt(&pMissile->_mitxoff, tbuff); - CopyInt(&pMissile->_mityoff, tbuff); - CopyInt(&pMissile->_mimfnum, tbuff); - CopyInt(&pMissile->_mispllvl, tbuff); - CopyInt(&pMissile->_miDelFlag, tbuff); - CopyChar(&pMissile->_miAnimType, tbuff); - tbuff += 3; - - CopyInt(&pMissile->_miAnimFlags, tbuff); - tbuff += 4; - CopyInt(&pMissile->_miAnimDelay, tbuff); - CopyInt(&pMissile->_miAnimLen, tbuff); - CopyInt(&pMissile->_miAnimWidth, tbuff); - CopyInt(&pMissile->_miAnimWidth2, tbuff); - CopyInt(&pMissile->_miAnimCnt, tbuff); - CopyInt(&pMissile->_miAnimAdd, tbuff); - CopyInt(&pMissile->_miAnimFrame, tbuff); - CopyInt(&pMissile->_miDrawFlag, tbuff); - CopyInt(&pMissile->_miLightFlag, tbuff); - CopyInt(&pMissile->_miPreFlag, tbuff); - CopyInt(&pMissile->_miUniqTrans, tbuff); - CopyInt(&pMissile->_mirange, tbuff); - CopyInt(&pMissile->_misource, tbuff); - CopyInt(&pMissile->_micaster, tbuff); - CopyInt(&pMissile->_midam, tbuff); - CopyInt(&pMissile->_miHitFlag, tbuff); - CopyInt(&pMissile->_midist, tbuff); - CopyInt(&pMissile->_mlid, tbuff); - CopyInt(&pMissile->_mirnd, tbuff); - CopyInt(&pMissile->_miVar1, tbuff); - CopyInt(&pMissile->_miVar2, tbuff); - CopyInt(&pMissile->_miVar3, tbuff); - CopyInt(&pMissile->_miVar4, tbuff); - CopyInt(&pMissile->_miVar5, tbuff); - CopyInt(&pMissile->_miVar6, tbuff); - CopyInt(&pMissile->_miVar7, tbuff); - CopyInt(&pMissile->_miVar8, tbuff); -} - -void SaveObject(int i) -{ - ObjectStruct *pObject = &object[i]; - CopyInt(tbuff, &pObject->_otype); - CopyInt(&pObject->_ox, tbuff); - CopyInt(&pObject->_oy, tbuff); - CopyInt(&pObject->_oLight, tbuff); - CopyInt(&pObject->_oAnimFlag, tbuff); - tbuff += 4; - CopyInt(&pObject->_oAnimDelay, tbuff); - CopyInt(&pObject->_oAnimCnt, tbuff); - CopyInt(&pObject->_oAnimLen, tbuff); - CopyInt(&pObject->_oAnimFrame, tbuff); - CopyInt(&pObject->_oAnimWidth, tbuff); - CopyInt(&pObject->_oAnimWidth2, tbuff); - CopyInt(&pObject->_oDelFlag, tbuff); - - CopyChar(&pObject->_oBreak, tbuff); - tbuff += 3; - - CopyInt(&pObject->_oSolidFlag, tbuff); - CopyInt(&pObject->_oMissFlag, tbuff); - - CopyChar(&pObject->_oSelFlag, tbuff); - tbuff += 3; - - CopyInt(&pObject->_oPreFlag, tbuff); - CopyInt(&pObject->_oTrapFlag, tbuff); - CopyInt(&pObject->_oDoorFlag, tbuff); - CopyInt(&pObject->_olid, tbuff); - CopyInt(&pObject->_oRndSeed, tbuff); - CopyInt(&pObject->_oVar1, tbuff); - CopyInt(&pObject->_oVar2, tbuff); - CopyInt(&pObject->_oVar3, tbuff); - CopyInt(&pObject->_oVar4, tbuff); - CopyInt(&pObject->_oVar5, tbuff); - CopyInt(&pObject->_oVar6, tbuff); - CopyInt(&pObject->_oVar7, tbuff); - CopyInt(&pObject->_oVar8, tbuff); -} - -void SavePremium(int i) -{ - SaveItem(&item[i]); -} - -void SaveQuest(int i) -{ - memcpy(tbuff, &quests[i], sizeof(*quests)); - tbuff += sizeof(*quests); - WSave(ReturnLvlX); - WSave(ReturnLvlY); - WSave(ReturnLvl); - WSave(ReturnLvlT); - WSave(DoomQuestState); -} - -void SaveLighting(int i) -{ - memcpy(tbuff, &LightList[i], sizeof(*LightList)); - tbuff += sizeof(*LightList); -} - -void SaveVision(int i) -{ - memcpy(tbuff, &VisionList[i], sizeof(*VisionList)); - tbuff += sizeof(*VisionList); -} - -void SavePortal(int i) -{ - memcpy(tbuff, &portal[i], sizeof(*portal)); - tbuff += sizeof(*portal); -} - -void SaveLevel() -{ - int i, j; - char szName[MAX_PATH]; - int dwLen; - unsigned char *SaveBuff; - - if (!currlevel) - glSeedTbl[0] = GetRndSeed(); - - dwLen = codec_get_encoded_len(FILEBUFF); - SaveBuff = DiabloAllocPtr(dwLen); - tbuff = SaveBuff; - - if (leveltype != DTYPE_TOWN) { - for (j = 0; j < MAXDUNY; j++) { - for (i = 0; i < MAXDUNX; i++) - BSave(dDead[i][j]); - } - } - - WSave(nummonsters); - WSave(numitems); - WSave(nobjects); - - if (leveltype != DTYPE_TOWN) { - for (i = 0; i < MAXMONSTERS; i++) - WSave(monstactive[i]); - for (i = 0; i < nummonsters; i++) - SaveMonster(monstactive[i]); - for (i = 0; i < MAXOBJECTS; i++) - BSave(objectactive[i]); - for (i = 0; i < MAXOBJECTS; i++) - BSave(objectavail[i]); - for (i = 0; i < nobjects; i++) - SaveObject(objectactive[i]); - } - - for (i = 0; i < MAXITEMS; i++) - BSave(itemactive[i]); - for (i = 0; i < MAXITEMS; i++) - BSave(itemavail[i]); - for (i = 0; i < numitems; i++) - SaveItem(&item[itemactive[i]]); - - for (j = 0; j < MAXDUNY; j++) { - for (i = 0; i < MAXDUNX; i++) - BSave(dFlags[i][j] & ~(BFLAG_MISSILE | BFLAG_VISIBLE | BFLAG_DEAD_PLAYER)); - } - for (j = 0; j < MAXDUNY; j++) { - for (i = 0; i < MAXDUNX; i++) - BSave(dItem[i][j]); - } - - if (leveltype != DTYPE_TOWN) { - for (j = 0; j < MAXDUNY; j++) { - for (i = 0; i < MAXDUNX; i++) - WSave(dMonster[i][j]); - } - for (j = 0; j < MAXDUNY; j++) { - for (i = 0; i < MAXDUNX; i++) - BSave(dObject[i][j]); - } - for (j = 0; j < MAXDUNY; j++) { - for (i = 0; i < MAXDUNX; i++) - BSave(dLight[i][j]); - } - for (j = 0; j < MAXDUNY; j++) { - for (i = 0; i < MAXDUNX; i++) - BSave(dPreLight[i][j]); - } - for (j = 0; j < DMAXY; j++) { - for (i = 0; i < DMAXX; i++) - OSave(automapview[i][j]); - } - for (j = 0; j < MAXDUNY; j++) { - for (i = 0; i < MAXDUNX; i++) - BSave(dMissile[i][j]); - } - } - - GetTempLevelNames(szName); - dwLen = codec_get_encoded_len(tbuff - SaveBuff); - pfile_write_save_file(szName, SaveBuff, tbuff - SaveBuff, dwLen); - mem_free_dbg(SaveBuff); - - if (setlevel == 0) - plr[myplr]._pLvlVisited[currlevel] = 1; - else - plr[myplr]._pSLvlVisited[setlvlnum] = 1; -} - -void LoadLevel() -{ - int i, j; - DWORD dwLen; - char szName[MAX_PATH]; - BYTE *LoadBuff; - - GetPermLevelNames(szName); - LoadBuff = pfile_read(szName, &dwLen); - tbuff = LoadBuff; - - if (leveltype != DTYPE_TOWN) { - for (j = 0; j < MAXDUNY; j++) { - for (i = 0; i < MAXDUNX; i++) - dDead[i][j] = BLoad(); - } - SetDead(); - } - - nummonsters = WLoad(); - numitems = WLoad(); - nobjects = WLoad(); - - if (leveltype != DTYPE_TOWN) { - for (i = 0; i < MAXMONSTERS; i++) - monstactive[i] = WLoad(); - for (i = 0; i < nummonsters; i++) - LoadMonster(monstactive[i]); - for (i = 0; i < MAXOBJECTS; i++) - objectactive[i] = BLoad(); - for (i = 0; i < MAXOBJECTS; i++) - objectavail[i] = BLoad(); - for (i = 0; i < nobjects; i++) - LoadObject(objectactive[i]); - for (i = 0; i < nobjects; i++) - SyncObjectAnim(objectactive[i]); - } - - for (i = 0; i < MAXITEMS; i++) - itemactive[i] = BLoad(); - for (i = 0; i < MAXITEMS; i++) - itemavail[i] = BLoad(); - for (i = 0; i < numitems; i++) - LoadItem(itemactive[i]); - - for (j = 0; j < MAXDUNY; j++) { - for (i = 0; i < MAXDUNX; i++) - dFlags[i][j] = BLoad(); - } - for (j = 0; j < MAXDUNY; j++) { - for (i = 0; i < MAXDUNX; i++) - dItem[i][j] = BLoad(); - } - - if (leveltype != DTYPE_TOWN) { - for (j = 0; j < MAXDUNY; j++) { - for (i = 0; i < MAXDUNX; i++) - dMonster[i][j] = WLoad(); - } - for (j = 0; j < MAXDUNY; j++) { - for (i = 0; i < MAXDUNX; i++) - dObject[i][j] = BLoad(); - } - for (j = 0; j < MAXDUNY; j++) { - for (i = 0; i < MAXDUNX; i++) - dLight[i][j] = BLoad(); - } - for (j = 0; j < MAXDUNY; j++) { - for (i = 0; i < MAXDUNX; i++) - dPreLight[i][j] = BLoad(); - } - for (j = 0; j < DMAXY; j++) { - for (i = 0; i < DMAXX; i++) - automapview[i][j] = OLoad(); - } - for (j = 0; j < MAXDUNY; j++) { - for (i = 0; i < MAXDUNX; i++) - dMissile[i][j] = 0; /// BUGFIX: supposed to load saved missiles with "BLoad()"? - } - } - - AutomapZoomReset(); - ResyncQuests(); - SyncPortals(); - dolighting = 1; - - for (i = 0; i < MAX_PLRS; i++) { - if (plr[i].plractive && currlevel == plr[i].plrlevel) - LightList[plr[i]._plid]._lunflag = 1; - } - - mem_free_dbg(LoadBuff); -} - -DEVILUTION_END_NAMESPACE +#include "diablo.h" + +DEVILUTION_BEGIN_NAMESPACE + +BYTE *tbuff; + +void LoadGame(BOOL firstflag) +{ + int i, j; + DWORD dwLen; + char szName[MAX_PATH]; + BYTE *LoadBuff; + int _ViewX, _ViewY, _nummonsters, _numitems, _nummissiles, _nobjects; + + FreeGameMem(); + pfile_remove_temp_files(); + pfile_get_game_name(szName); + LoadBuff = pfile_read(szName, &dwLen); + tbuff = LoadBuff; + + if (ILoad() != 'RETL') + app_fatal("Invalid save file"); + + setlevel = OLoad(); + setlvlnum = WLoad(); + currlevel = WLoad(); + leveltype = WLoad(); + _ViewX = WLoad(); + _ViewY = WLoad(); + invflag = OLoad(); + chrflag = OLoad(); + _nummonsters = WLoad(); + _numitems = WLoad(); + _nummissiles = WLoad(); + _nobjects = WLoad(); + + for (i = 0; i < NUMLEVELS; i++) { + glSeedTbl[i] = ILoad(); + gnLevelTypeTbl[i] = WLoad(); + } + + LoadPlayer(myplr); + + for (i = 0; i < MAXQUESTS; i++) + LoadQuest(i); + for (i = 0; i < MAXPORTAL; i++) + LoadPortal(i); + + LoadGameLevel(firstflag, 4); + SyncInitPlr(myplr); + SyncPlrAnim(myplr); + + ViewX = _ViewX; + ViewY = _ViewY; + nummonsters = _nummonsters; + numitems = _numitems; + nummissiles = _nummissiles; + nobjects = _nobjects; + + for (i = 0; i < MAXMONSTERS; i++) + monstkills[i] = ILoad(); + + if (leveltype != DTYPE_TOWN) { + for (i = 0; i < MAXMONSTERS; i++) + monstactive[i] = WLoad(); + for (i = 0; i < nummonsters; i++) + LoadMonster(monstactive[i]); + for (i = 0; i < MAXMISSILES; i++) + missileactive[i] = BLoad(); + for (i = 0; i < MAXMISSILES; i++) + missileavail[i] = BLoad(); + for (i = 0; i < nummissiles; i++) + LoadMissile(missileactive[i]); + for (i = 0; i < MAXOBJECTS; i++) + objectactive[i] = BLoad(); + for (i = 0; i < MAXOBJECTS; i++) + objectavail[i] = BLoad(); + for (i = 0; i < nobjects; i++) + LoadObject(objectactive[i]); + for (i = 0; i < nobjects; i++) + SyncObjectAnim(objectactive[i]); + + numlights = WLoad(); + + for (i = 0; i < MAXLIGHTS; i++) + lightactive[i] = BLoad(); + for (i = 0; i < numlights; i++) + LoadLighting(lightactive[i]); + + visionid = WLoad(); + numvision = WLoad(); + + for (i = 0; i < numvision; i++) + LoadVision(i); + } + + for (i = 0; i < MAXITEMS; i++) + itemactive[i] = BLoad(); + for (i = 0; i < MAXITEMS; i++) + itemavail[i] = BLoad(); + for (i = 0; i < numitems; i++) + LoadItem(itemactive[i]); + for (i = 0; i < 128; i++) + UniqueItemFlag[i] = OLoad(); + + for (j = 0; j < MAXDUNY; j++) { + for (i = 0; i < MAXDUNX; i++) + dLight[i][j] = BLoad(); + } + for (j = 0; j < MAXDUNY; j++) { + for (i = 0; i < MAXDUNX; i++) + dFlags[i][j] = BLoad(); + } + for (j = 0; j < MAXDUNY; j++) { + for (i = 0; i < MAXDUNX; i++) + dPlayer[i][j] = BLoad(); + } + for (j = 0; j < MAXDUNY; j++) { + for (i = 0; i < MAXDUNX; i++) + dItem[i][j] = BLoad(); + } + + if (leveltype != DTYPE_TOWN) { + for (j = 0; j < MAXDUNY; j++) { + for (i = 0; i < MAXDUNX; i++) + dMonster[i][j] = WLoad(); + } + for (j = 0; j < MAXDUNY; j++) { + for (i = 0; i < MAXDUNX; i++) + dDead[i][j] = BLoad(); + } + for (j = 0; j < MAXDUNY; j++) { + for (i = 0; i < MAXDUNX; i++) + dObject[i][j] = BLoad(); + } + for (j = 0; j < MAXDUNY; j++) { + for (i = 0; i < MAXDUNX; i++) + dLight[i][j] = BLoad(); + } + for (j = 0; j < MAXDUNY; j++) { + for (i = 0; i < MAXDUNX; i++) + dPreLight[i][j] = BLoad(); + } + for (j = 0; j < DMAXY; j++) { + for (i = 0; i < DMAXX; i++) + automapview[i][j] = OLoad(); + } + for (j = 0; j < MAXDUNY; j++) { + for (i = 0; i < MAXDUNX; i++) + dMissile[i][j] = BLoad(); + } + } + + numpremium = WLoad(); + premiumlevel = WLoad(); + + for (i = 0; i < 6; i++) + LoadPremium(i); + + automapflag = OLoad(); + AutoMapScale = WLoad(); + mem_free_dbg(LoadBuff); + AutomapZoomReset(); + ResyncQuests(); + + if (leveltype != DTYPE_TOWN) + ProcessLightList(); + + RedoPlayerVision(); + ProcessVisionList(); + missiles_process_charge(); + ResetPal(); + SetCursor_(CURSOR_HAND); + gbProcessPlayers = TRUE; +} + +char BLoad() +{ + return *tbuff++; +} + +int WLoad() +{ + int rv = *tbuff++ << 24; + rv |= *tbuff++ << 16; + rv |= *tbuff++ << 8; + rv |= *tbuff++; + + return rv; +} + +int ILoad() +{ + int rv = *tbuff++ << 24; + rv |= *tbuff++ << 16; + rv |= *tbuff++ << 8; + rv |= *tbuff++; + + return rv; +} + +BOOL OLoad() +{ + if (*tbuff++ == TRUE) + return TRUE; + else + return FALSE; +} + +void CopyInt(const void *src, void *dst) +{ + memcpy(dst, src, 4); + tbuff += 4; +} + +void CopyShort(const void *src, void *dst) +{ + memcpy(dst, src, 2); + tbuff += 2; +} + +void CopyShorts(const void *src, const int n, void *dst) +{ + memcpy(dst, src, 2 * n); + tbuff += 2 * n; +} + +void CopyInts(const void *src, const int n, void *dst) +{ + memcpy(dst, src, 4 * n); + tbuff += 4 * n; +} + +void CopyBytes(const void *src, const int n, void *dst) +{ + memcpy(dst, src, n); + tbuff += n; +} + +void CopyChar(const void *src, void *dst) +{ + memcpy(dst, src, 1); + tbuff += 1; +} + +void CopyInt64(const void *src, void *dst) +{ + memcpy(dst, src, 8); + tbuff += 8; +} + +void LoadPlayer(int i) +{ + PlayerStruct *pPlayer = &plr[i]; + + CopyInt(tbuff, &pPlayer->_pmode); + + CopyBytes(tbuff, 25, pPlayer->walkpath); + CopyBytes(tbuff, 1, &pPlayer->plractive); + tbuff += 2; + + CopyInt(tbuff, &pPlayer->destAction); + CopyInt(tbuff, &pPlayer->destParam1); + CopyInt(tbuff, &pPlayer->destParam2); + CopyInt(tbuff, &pPlayer->destParam3); + CopyInt(tbuff, &pPlayer->destParam4); + CopyInt(tbuff, &pPlayer->plrlevel); + CopyInt(tbuff, &pPlayer->WorldX); + CopyInt(tbuff, &pPlayer->WorldY); + CopyInt(tbuff, &pPlayer->_px); + CopyInt(tbuff, &pPlayer->_py); + CopyInt(tbuff, &pPlayer->_ptargx); + CopyInt(tbuff, &pPlayer->_ptargy); + CopyInt(tbuff, &pPlayer->_pownerx); + CopyInt(tbuff, &pPlayer->_pownery); + CopyInt(tbuff, &pPlayer->_poldx); + CopyInt(tbuff, &pPlayer->_poldy); + CopyInt(tbuff, &pPlayer->_pxoff); + CopyInt(tbuff, &pPlayer->_pyoff); + CopyInt(tbuff, &pPlayer->_pxvel); + CopyInt(tbuff, &pPlayer->_pyvel); + CopyInt(tbuff, &pPlayer->_pdir); + CopyInt(tbuff, &pPlayer->_nextdir); + CopyInt(tbuff, &pPlayer->_pgfxnum); + tbuff += 4; // Skip pointers + CopyInt(tbuff, &pPlayer->_pAnimDelay); + CopyInt(tbuff, &pPlayer->_pAnimCnt); + CopyInt(tbuff, &pPlayer->_pAnimLen); + CopyInt(tbuff, &pPlayer->_pAnimFrame); + CopyInt(tbuff, &pPlayer->_pAnimWidth); + CopyInt(tbuff, &pPlayer->_pAnimWidth2); + CopyInt(tbuff, &pPlayer->_peflag); + CopyInt(tbuff, &pPlayer->_plid); + CopyInt(tbuff, &pPlayer->_pvid); + + CopyInt(tbuff, &pPlayer->_pSpell); + CopyChar(tbuff, &pPlayer->_pSplType); + CopyChar(tbuff, &pPlayer->_pSplFrom); + tbuff += 2; + CopyInt(tbuff, &pPlayer->_pTSpell); + CopyChar(tbuff, &pPlayer->_pTSplType); + tbuff += 3; + CopyInt(tbuff, &pPlayer->_pRSpell); + CopyChar(tbuff, &pPlayer->_pRSplType); + tbuff += 3; + CopyInt(tbuff, &pPlayer->_pSBkSpell); + CopyChar(tbuff, &pPlayer->_pSBkSplType); + + CopyBytes(tbuff, 64, &pPlayer->_pSplLvl); + tbuff += 7; + CopyInt64(tbuff, &pPlayer->_pMemSpells); + CopyInt64(tbuff, &pPlayer->_pAblSpells); + CopyInt64(tbuff, &pPlayer->_pScrlSpells); + CopyChar(tbuff, &pPlayer->_pSpellFlags); + tbuff += 3; + CopyInts(tbuff, 4, &pPlayer->_pSplHotKey); + CopyBytes(tbuff, 4, &pPlayer->_pSplTHotKey); + CopyInt(tbuff, &pPlayer->_pwtype); + CopyChar(tbuff, &pPlayer->_pBlockFlag); + CopyChar(tbuff, &pPlayer->_pInvincible); + CopyChar(tbuff, &pPlayer->_pLightRad); + CopyChar(tbuff, &pPlayer->_pLvlChanging); + CopyBytes(tbuff, PLR_NAME_LEN, &pPlayer->_pName); + CopyChar(tbuff, &pPlayer->_pClass); + tbuff += 3; + CopyInt(tbuff, &pPlayer->_pStrength); + CopyInt(tbuff, &pPlayer->_pBaseStr); + CopyInt(tbuff, &pPlayer->_pMagic); + CopyInt(tbuff, &pPlayer->_pBaseMag); + CopyInt(tbuff, &pPlayer->_pDexterity); + CopyInt(tbuff, &pPlayer->_pBaseDex); + CopyInt(tbuff, &pPlayer->_pVitality); + CopyInt(tbuff, &pPlayer->_pBaseVit); + CopyInt(tbuff, &pPlayer->_pStatPts); + CopyInt(tbuff, &pPlayer->_pDamageMod); + CopyInt(tbuff, &pPlayer->_pBaseToBlk); + CopyInt(tbuff, &pPlayer->_pHPBase); + CopyInt(tbuff, &pPlayer->_pMaxHPBase); + CopyInt(tbuff, &pPlayer->_pHitPoints); + CopyInt(tbuff, &pPlayer->_pMaxHP); + CopyInt(tbuff, &pPlayer->_pHPPer); + CopyInt(tbuff, &pPlayer->_pManaBase); + CopyInt(tbuff, &pPlayer->_pMaxManaBase); + CopyInt(tbuff, &pPlayer->_pMana); + CopyInt(tbuff, &pPlayer->_pMaxMana); + CopyInt(tbuff, &pPlayer->_pManaPer); + CopyChar(tbuff, &pPlayer->_pLevel); + CopyChar(tbuff, &pPlayer->_pMaxLvl); + tbuff += 2; + CopyInt(tbuff, &pPlayer->_pExperience); + CopyInt(tbuff, &pPlayer->_pMaxExp); + CopyInt(tbuff, &pPlayer->_pNextExper); + CopyChar(tbuff, &pPlayer->_pArmorClass); + CopyChar(tbuff, &pPlayer->_pMagResist); + CopyChar(tbuff, &pPlayer->_pFireResist); + CopyChar(tbuff, &pPlayer->_pLghtResist); + CopyInt(tbuff, &pPlayer->_pGold); + CopyInt(tbuff, &pPlayer->_pInfraFlag); + CopyInt(tbuff, &pPlayer->_pVar1); + CopyInt(tbuff, &pPlayer->_pVar2); + CopyInt(tbuff, &pPlayer->_pVar3); + CopyInt(tbuff, &pPlayer->_pVar4); + CopyInt(tbuff, &pPlayer->_pVar5); + CopyInt(tbuff, &pPlayer->_pVar6); + CopyInt(tbuff, &pPlayer->_pVar7); + CopyInt(tbuff, &pPlayer->_pVar8); + CopyBytes(tbuff, NUMLEVELS, &pPlayer->_pLvlVisited); + CopyBytes(tbuff, NUMLEVELS, &pPlayer->_pSLvlVisited); + tbuff += 2; + CopyInt(tbuff, &pPlayer->_pGFXLoad); + + tbuff += sizeof(DWORD) * 8; + CopyInt(tbuff, &pPlayer->_pNFrames); + CopyInt(tbuff, &pPlayer->_pNWidth); + + tbuff += sizeof(DWORD) * 8; + + CopyInt(tbuff, &pPlayer->_pWFrames); + CopyInt(tbuff, &pPlayer->_pWWidth); + + tbuff += sizeof(DWORD) * 8; + + CopyInt(tbuff, &pPlayer->_pAFrames); + CopyInt(tbuff, &pPlayer->_pAWidth); + CopyInt(tbuff, &pPlayer->_pAFNum); + + tbuff += sizeof(DWORD) * 24; + + CopyInt(tbuff, &pPlayer->_pSFrames); + CopyInt(tbuff, &pPlayer->_pSWidth); + CopyInt(tbuff, &pPlayer->_pSFNum); + + tbuff += sizeof(DWORD) * 8; + + CopyInt(tbuff, &pPlayer->_pHFrames); + CopyInt(tbuff, &pPlayer->_pHWidth); + + tbuff += sizeof(DWORD) * 8; + + CopyInt(tbuff, &pPlayer->_pDFrames); + CopyInt(tbuff, &pPlayer->_pDWidth); + + tbuff += sizeof(DWORD) * 8; + + CopyInt(tbuff, &pPlayer->_pBFrames); + CopyInt(tbuff, &pPlayer->_pBWidth); + CopyItems(NUM_INVLOC, pPlayer->InvBody); + CopyItems(NUM_INV_GRID_ELEM, pPlayer->InvList); + CopyInt(tbuff, &pPlayer->_pNumInv); + CopyBytes(tbuff, NUM_INV_GRID_ELEM, pPlayer->InvGrid); + CopyItems(MAXBELTITEMS, pPlayer->SpdList); + CopyItem(&pPlayer->HoldItem); + CopyInt(tbuff, &pPlayer->_pIMinDam); + CopyInt(tbuff, &pPlayer->_pIMaxDam); + CopyInt(tbuff, &pPlayer->_pIAC); + CopyInt(tbuff, &pPlayer->_pIBonusDam); + CopyInt(tbuff, &pPlayer->_pIBonusToHit); + CopyInt(tbuff, &pPlayer->_pIBonusAC); + CopyInt(tbuff, &pPlayer->_pIBonusDamMod); + tbuff += 4; + CopyInt64(tbuff, &pPlayer->_pISpells); + CopyInt(tbuff, &pPlayer->_pIFlags); + CopyInt(tbuff, &pPlayer->_pIGetHit); + + CopyChar(tbuff, &pPlayer->_pISplLvlAdd); + CopyChar(tbuff, &pPlayer->_pISplCost); + tbuff += 2; + + CopyInt(tbuff, &pPlayer->_pISplDur); + CopyInt(tbuff, &pPlayer->_pIEnAc); + CopyInt(tbuff, &pPlayer->_pIFMinDam); + CopyInt(tbuff, &pPlayer->_pIFMaxDam); + CopyInt(tbuff, &pPlayer->_pILMinDam); + CopyInt(tbuff, &pPlayer->_pILMaxDam); + CopyInt(tbuff, &pPlayer->_pOilType); + + CopyChar(tbuff, &pPlayer->pTownWarps); + CopyChar(tbuff, &pPlayer->pDungMsgs); + CopyChar(tbuff, &pPlayer->pLvlLoad); + CopyChar(tbuff, &pPlayer->pBattleNet); + + CopyChar(tbuff, &pPlayer->pManaShield); + CopyBytes(tbuff, 3, &pPlayer->bReserved); + + CopyShorts(tbuff, 8, &pPlayer->wReserved); + + CopyInt(tbuff, &pPlayer->pDiabloKillLevel); + CopyInts(tbuff, 7, &pPlayer->dwReserved); + + // Omit 10 pointers +} + +void SavePlayer(int i) +{ + PlayerStruct *pPlayer = &plr[i]; + + CopyInt(&pPlayer->_pmode, tbuff); + + CopyBytes(&pPlayer->walkpath, 25, tbuff); + CopyBytes(&pPlayer->plractive, 1, tbuff); + tbuff += 2; + + CopyInt(&pPlayer->destAction, tbuff); + CopyInt(&pPlayer->destParam1, tbuff); + CopyInt(&pPlayer->destParam2, tbuff); + CopyInt(&pPlayer->destParam3, tbuff); + CopyInt(&pPlayer->destParam4, tbuff); + CopyInt(&pPlayer->plrlevel, tbuff); + CopyInt(&pPlayer->WorldX, tbuff); + CopyInt(&pPlayer->WorldY, tbuff); + CopyInt(&pPlayer->_px, tbuff); + CopyInt(&pPlayer->_py, tbuff); + CopyInt(&pPlayer->_ptargx, tbuff); + CopyInt(&pPlayer->_ptargy, tbuff); + CopyInt(&pPlayer->_pownerx, tbuff); + CopyInt(&pPlayer->_pownery, tbuff); + CopyInt(&pPlayer->_poldx, tbuff); + CopyInt(&pPlayer->_poldy, tbuff); + CopyInt(&pPlayer->_pxoff, tbuff); + CopyInt(&pPlayer->_pyoff, tbuff); + CopyInt(&pPlayer->_pxvel, tbuff); + CopyInt(&pPlayer->_pyvel, tbuff); + CopyInt(&pPlayer->_pdir, tbuff); + CopyInt(&pPlayer->_nextdir, tbuff); + CopyInt(&pPlayer->_pgfxnum, tbuff); + tbuff += 4; // Skip pointers + CopyInt(&pPlayer->_pAnimDelay, tbuff); + CopyInt(&pPlayer->_pAnimCnt, tbuff); + CopyInt(&pPlayer->_pAnimLen, tbuff); + CopyInt(&pPlayer->_pAnimFrame, tbuff); + CopyInt(&pPlayer->_pAnimWidth, tbuff); + CopyInt(&pPlayer->_pAnimWidth2, tbuff); + CopyInt(&pPlayer->_peflag, tbuff); + CopyInt(&pPlayer->_plid, tbuff); + CopyInt(&pPlayer->_pvid, tbuff); + + CopyInt(&pPlayer->_pSpell, tbuff); + + CopyChar(&pPlayer->_pSplType, tbuff); + CopyChar(&pPlayer->_pSplFrom, tbuff); + tbuff += 2; + + CopyInt(&pPlayer->_pTSpell, tbuff); + CopyChar(&pPlayer->_pTSplType, tbuff); + tbuff += 3; + CopyInt(&pPlayer->_pRSpell, tbuff); + CopyChar(&pPlayer->_pRSplType, tbuff); + tbuff += 3; + CopyInt(&pPlayer->_pSBkSpell, tbuff); + CopyChar(&pPlayer->_pSBkSplType, tbuff); + + CopyBytes(&pPlayer->_pSplLvl, 64, tbuff); + tbuff += 7; + CopyInt64(&pPlayer->_pMemSpells, tbuff); + CopyInt64(&pPlayer->_pAblSpells, tbuff); + CopyInt64(&pPlayer->_pScrlSpells, tbuff); + CopyChar(&pPlayer->_pSpellFlags, tbuff); + tbuff += 3; + CopyInts(&pPlayer->_pSplHotKey, 4, tbuff); + CopyBytes(&pPlayer->_pSplTHotKey, 4, tbuff); + CopyInt(&pPlayer->_pwtype, tbuff); + CopyChar(&pPlayer->_pBlockFlag, tbuff); + CopyChar(&pPlayer->_pInvincible, tbuff); + CopyChar(&pPlayer->_pLightRad, tbuff); + CopyChar(&pPlayer->_pLvlChanging, tbuff); + CopyBytes(&pPlayer->_pName, PLR_NAME_LEN, tbuff); + CopyChar(&pPlayer->_pClass, tbuff); + tbuff += 3; + CopyInt(&pPlayer->_pStrength, tbuff); + CopyInt(&pPlayer->_pBaseStr, tbuff); + CopyInt(&pPlayer->_pMagic, tbuff); + CopyInt(&pPlayer->_pBaseMag, tbuff); + CopyInt(&pPlayer->_pDexterity, tbuff); + CopyInt(&pPlayer->_pBaseDex, tbuff); + CopyInt(&pPlayer->_pVitality, tbuff); + CopyInt(&pPlayer->_pBaseVit, tbuff); + CopyInt(&pPlayer->_pStatPts, tbuff); + CopyInt(&pPlayer->_pDamageMod, tbuff); + CopyInt(&pPlayer->_pBaseToBlk, tbuff); + CopyInt(&pPlayer->_pHPBase, tbuff); + CopyInt(&pPlayer->_pMaxHPBase, tbuff); + CopyInt(&pPlayer->_pHitPoints, tbuff); + CopyInt(&pPlayer->_pMaxHP, tbuff); + CopyInt(&pPlayer->_pHPPer, tbuff); + CopyInt(&pPlayer->_pManaBase, tbuff); + CopyInt(&pPlayer->_pMaxManaBase, tbuff); + CopyInt(&pPlayer->_pMana, tbuff); + CopyInt(&pPlayer->_pMaxMana, tbuff); + CopyInt(&pPlayer->_pManaPer, tbuff); + CopyChar(&pPlayer->_pLevel, tbuff); + CopyChar(&pPlayer->_pMaxLvl, tbuff); + tbuff += 2; + CopyInt(&pPlayer->_pExperience, tbuff); + CopyInt(&pPlayer->_pMaxExp, tbuff); + CopyInt(&pPlayer->_pNextExper, tbuff); + CopyChar(&pPlayer->_pArmorClass, tbuff); + CopyChar(&pPlayer->_pMagResist, tbuff); + CopyChar(&pPlayer->_pFireResist, tbuff); + CopyChar(&pPlayer->_pLghtResist, tbuff); + CopyInt(&pPlayer->_pGold, tbuff); + CopyInt(&pPlayer->_pInfraFlag, tbuff); + CopyInt(&pPlayer->_pVar1, tbuff); + CopyInt(&pPlayer->_pVar2, tbuff); + CopyInt(&pPlayer->_pVar3, tbuff); + CopyInt(&pPlayer->_pVar4, tbuff); + CopyInt(&pPlayer->_pVar5, tbuff); + CopyInt(&pPlayer->_pVar6, tbuff); + CopyInt(&pPlayer->_pVar7, tbuff); + CopyInt(&pPlayer->_pVar8, tbuff); + CopyBytes(&pPlayer->_pLvlVisited, NUMLEVELS, tbuff); + CopyBytes(&pPlayer->_pSLvlVisited, NUMLEVELS, tbuff); // only 10 used + tbuff += 2; + CopyInt(&pPlayer->_pGFXLoad, tbuff); + + tbuff += sizeof(DWORD) * 8; // Skip 8 pointers + CopyInt(&pPlayer->_pNFrames, tbuff); + CopyInt(&pPlayer->_pNWidth, tbuff); + + tbuff += sizeof(DWORD) * 8; // Skip 8 pointers + + CopyInt(&pPlayer->_pWFrames, tbuff); + CopyInt(&pPlayer->_pWWidth, tbuff); + + tbuff += sizeof(DWORD) * 8; // Skip 8 pointers + + CopyInt(&pPlayer->_pAFrames, tbuff); + CopyInt(&pPlayer->_pAWidth, tbuff); + CopyInt(&pPlayer->_pAFNum, tbuff); + + tbuff += sizeof(DWORD) * 24; // Skip 24 pointers + + CopyInt(&pPlayer->_pSFrames, tbuff); + CopyInt(&pPlayer->_pSWidth, tbuff); + CopyInt(&pPlayer->_pSFNum, tbuff); + + tbuff += sizeof(DWORD) * 8; // Skip 8 pointers + + CopyInt(&pPlayer->_pHFrames, tbuff); + CopyInt(&pPlayer->_pHWidth, tbuff); + + tbuff += sizeof(DWORD) * 8; // Skip 8 pointers + + CopyInt(&pPlayer->_pDFrames, tbuff); + CopyInt(&pPlayer->_pDWidth, tbuff); + + tbuff += sizeof(DWORD) * 8; // Skip 8 pointers + + CopyInt(&pPlayer->_pBFrames, tbuff); + CopyInt(&pPlayer->_pBWidth, tbuff); + SaveItems(pPlayer->InvBody, NUM_INVLOC); + SaveItems(pPlayer->InvList, NUM_INV_GRID_ELEM); + CopyInt(&pPlayer->_pNumInv, tbuff); + CopyBytes(pPlayer->InvGrid, NUM_INV_GRID_ELEM, tbuff); + SaveItems(pPlayer->SpdList, MAXBELTITEMS); + SaveItem(&pPlayer->HoldItem); + CopyInt(&pPlayer->_pIMinDam, tbuff); + CopyInt(&pPlayer->_pIMaxDam, tbuff); + CopyInt(&pPlayer->_pIAC, tbuff); + CopyInt(&pPlayer->_pIBonusDam, tbuff); + CopyInt(&pPlayer->_pIBonusToHit, tbuff); + CopyInt(&pPlayer->_pIBonusAC, tbuff); + CopyInt(&pPlayer->_pIBonusDamMod, tbuff); + tbuff += 4; + CopyInt64(&pPlayer->_pISpells, tbuff); + CopyInt(&pPlayer->_pIFlags, tbuff); + CopyInt(&pPlayer->_pIGetHit, tbuff); + + CopyChar(&pPlayer->_pISplLvlAdd, tbuff); + CopyChar(&pPlayer->_pISplCost, tbuff); + tbuff += 2; + + CopyInt(&pPlayer->_pISplDur, tbuff); + CopyInt(&pPlayer->_pIEnAc, tbuff); + CopyInt(&pPlayer->_pIFMinDam, tbuff); + CopyInt(&pPlayer->_pIFMaxDam, tbuff); + CopyInt(&pPlayer->_pILMinDam, tbuff); + CopyInt(&pPlayer->_pILMaxDam, tbuff); + CopyInt(&pPlayer->_pOilType, tbuff); + + CopyChar(&pPlayer->pTownWarps, tbuff); + CopyChar(&pPlayer->pDungMsgs, tbuff); + CopyChar(&pPlayer->pLvlLoad, tbuff); + CopyChar(&pPlayer->pBattleNet, tbuff); + + CopyChar(&pPlayer->pManaShield, tbuff); + CopyBytes(&pPlayer->bReserved, 3, tbuff); + + CopyShorts(&pPlayer->wReserved, 8, tbuff); + + CopyInt(&pPlayer->pDiabloKillLevel, tbuff); + CopyInts(&pPlayer->dwReserved, 7, tbuff); + + // Omit 10 pointers +} + +void LoadMonster(int i) +{ + MonsterStruct *pMonster = &monster[i]; + + CopyInt(tbuff, &pMonster->_mMTidx); + CopyInt(tbuff, &pMonster->_mmode); + + CopyChar(tbuff, &pMonster->_mgoal); + tbuff += 3; + + CopyInt(tbuff, &pMonster->_mgoalvar1); + CopyInt(tbuff, &pMonster->_mgoalvar2); + CopyInt(tbuff, &pMonster->_mgoalvar3); + CopyInt(tbuff, &pMonster->field_18); + + CopyChar(tbuff, &pMonster->_pathcount); + tbuff += 3; + + CopyInt(tbuff, &pMonster->_mx); + CopyInt(tbuff, &pMonster->_my); + CopyInt(tbuff, &pMonster->_mfutx); + CopyInt(tbuff, &pMonster->_mfuty); + CopyInt(tbuff, &pMonster->_moldx); + CopyInt(tbuff, &pMonster->_moldy); + CopyInt(tbuff, &pMonster->_mxoff); + CopyInt(tbuff, &pMonster->_myoff); + CopyInt(tbuff, &pMonster->_mxvel); + CopyInt(tbuff, &pMonster->_myvel); + CopyInt(tbuff, &pMonster->_mdir); + CopyInt(tbuff, &pMonster->_menemy); + + CopyChar(tbuff, &pMonster->_menemyx); + CopyChar(tbuff, &pMonster->_menemyy); + CopyShort(tbuff, &pMonster->falign_52); + + tbuff += 4; // Skip pointer + CopyInt(tbuff, &pMonster->_mAnimDelay); + CopyInt(tbuff, &pMonster->_mAnimCnt); + CopyInt(tbuff, &pMonster->_mAnimLen); + CopyInt(tbuff, &pMonster->_mAnimFrame); + CopyInt(tbuff, &pMonster->_meflag); + CopyInt(tbuff, &pMonster->_mDelFlag); + CopyInt(tbuff, &pMonster->_mVar1); + CopyInt(tbuff, &pMonster->_mVar2); + CopyInt(tbuff, &pMonster->_mVar3); + CopyInt(tbuff, &pMonster->_mVar4); + CopyInt(tbuff, &pMonster->_mVar5); + CopyInt(tbuff, &pMonster->_mVar6); + CopyInt(tbuff, &pMonster->_mVar7); + CopyInt(tbuff, &pMonster->_mVar8); + CopyInt(tbuff, &pMonster->_mmaxhp); + CopyInt(tbuff, &pMonster->_mhitpoints); + + CopyChar(tbuff, &pMonster->_mAi); + CopyChar(tbuff, &pMonster->_mint); + CopyShort(tbuff, &pMonster->falign_9A); + + CopyInt(tbuff, &pMonster->_mFlags); + + CopyChar(tbuff, &pMonster->_msquelch); + tbuff += 3; + + CopyInt(tbuff, &pMonster->falign_A4); + CopyInt(tbuff, &pMonster->_lastx); + CopyInt(tbuff, &pMonster->_lasty); + CopyInt(tbuff, &pMonster->_mRndSeed); + CopyInt(tbuff, &pMonster->_mAISeed); + CopyInt(tbuff, &pMonster->falign_B8); + + CopyChar(tbuff, &pMonster->_uniqtype); + CopyChar(tbuff, &pMonster->_uniqtrans); + CopyChar(tbuff, &pMonster->_udeadval); + CopyChar(tbuff, &pMonster->mWhoHit); + + CopyChar(tbuff, &pMonster->mLevel); + CopyShort(tbuff, &pMonster->mExp); + tbuff += 1; + + CopyChar(tbuff, &pMonster->mHit); + CopyChar(tbuff, &pMonster->mMinDamage); + CopyChar(tbuff, &pMonster->mMaxDamage); + CopyChar(tbuff, &pMonster->mHit2); + + CopyChar(tbuff, &pMonster->mMinDamage2); + CopyChar(tbuff, &pMonster->mMaxDamage2); + CopyChar(tbuff, &pMonster->mArmorClass); + CopyChar(tbuff, &pMonster->falign_CB); + + CopyShort(tbuff, &pMonster->mMagicRes); + tbuff += 2; + + CopyInt(tbuff, &pMonster->mtalkmsg); + + CopyChar(tbuff, &pMonster->leader); + CopyChar(tbuff, &pMonster->leaderflag); + CopyChar(tbuff, &pMonster->packsize); + CopyChar(tbuff, &pMonster->mlid); + + SyncMonsterAnim(i); +} + +void LoadMissile(int i) +{ + MissileStruct *pMissile = &missile[i]; + + CopyInt(tbuff, &pMissile->_mitype); + CopyInt(tbuff, &pMissile->_mix); + CopyInt(tbuff, &pMissile->_miy); + CopyInt(tbuff, &pMissile->_mixoff); + CopyInt(tbuff, &pMissile->_miyoff); + CopyInt(tbuff, &pMissile->_mixvel); + CopyInt(tbuff, &pMissile->_miyvel); + CopyInt(tbuff, &pMissile->_misx); + CopyInt(tbuff, &pMissile->_misy); + CopyInt(tbuff, &pMissile->_mitxoff); + CopyInt(tbuff, &pMissile->_mityoff); + CopyInt(tbuff, &pMissile->_mimfnum); + CopyInt(tbuff, &pMissile->_mispllvl); + CopyInt(tbuff, &pMissile->_miDelFlag); + CopyChar(tbuff, &pMissile->_miAnimType); + tbuff += 3; + + CopyInt(tbuff, &pMissile->_miAnimFlags); + tbuff += 4; + CopyInt(tbuff, &pMissile->_miAnimDelay); + CopyInt(tbuff, &pMissile->_miAnimLen); + CopyInt(tbuff, &pMissile->_miAnimWidth); + CopyInt(tbuff, &pMissile->_miAnimWidth2); + CopyInt(tbuff, &pMissile->_miAnimCnt); + CopyInt(tbuff, &pMissile->_miAnimAdd); + CopyInt(tbuff, &pMissile->_miAnimFrame); + CopyInt(tbuff, &pMissile->_miDrawFlag); + CopyInt(tbuff, &pMissile->_miLightFlag); + CopyInt(tbuff, &pMissile->_miPreFlag); + CopyInt(tbuff, &pMissile->_miUniqTrans); + CopyInt(tbuff, &pMissile->_mirange); + CopyInt(tbuff, &pMissile->_misource); + CopyInt(tbuff, &pMissile->_micaster); + CopyInt(tbuff, &pMissile->_midam); + CopyInt(tbuff, &pMissile->_miHitFlag); + CopyInt(tbuff, &pMissile->_midist); + CopyInt(tbuff, &pMissile->_mlid); + CopyInt(tbuff, &pMissile->_mirnd); + CopyInt(tbuff, &pMissile->_miVar1); + CopyInt(tbuff, &pMissile->_miVar2); + CopyInt(tbuff, &pMissile->_miVar3); + CopyInt(tbuff, &pMissile->_miVar4); + CopyInt(tbuff, &pMissile->_miVar5); + CopyInt(tbuff, &pMissile->_miVar6); + CopyInt(tbuff, &pMissile->_miVar7); + CopyInt(tbuff, &pMissile->_miVar8); +} + +void LoadObject(int i) +{ + ObjectStruct *pObject = &object[i]; + CopyInt(tbuff, &pObject->_otype); + CopyInt(tbuff, &pObject->_ox); + CopyInt(tbuff, &pObject->_oy); + CopyInt(tbuff, &pObject->_oLight); + CopyInt(tbuff, &pObject->_oAnimFlag); + tbuff += 4; + CopyInt(tbuff, &pObject->_oAnimDelay); + CopyInt(tbuff, &pObject->_oAnimCnt); + CopyInt(tbuff, &pObject->_oAnimLen); + CopyInt(tbuff, &pObject->_oAnimFrame); + CopyInt(tbuff, &pObject->_oAnimWidth); + CopyInt(tbuff, &pObject->_oAnimWidth2); + CopyInt(tbuff, &pObject->_oDelFlag); + + CopyChar(tbuff, &pObject->_oBreak); + tbuff += 3; + + CopyInt(tbuff, &pObject->_oSolidFlag); + CopyInt(tbuff, &pObject->_oMissFlag); + + CopyChar(tbuff, &pObject->_oSelFlag); + tbuff += 3; + + CopyInt(tbuff, &pObject->_oPreFlag); + CopyInt(tbuff, &pObject->_oTrapFlag); + CopyInt(tbuff, &pObject->_oDoorFlag); + CopyInt(tbuff, &pObject->_olid); + CopyInt(tbuff, &pObject->_oRndSeed); + CopyInt(tbuff, &pObject->_oVar1); + CopyInt(tbuff, &pObject->_oVar2); + CopyInt(tbuff, &pObject->_oVar3); + CopyInt(tbuff, &pObject->_oVar4); + CopyInt(tbuff, &pObject->_oVar5); + CopyInt(tbuff, &pObject->_oVar6); + CopyInt(tbuff, &pObject->_oVar7); + CopyInt(tbuff, &pObject->_oVar8); +} + +void LoadItem(int i) +{ + CopyItem(&item[i]); + GetItemFrm(i); +} + +void CopyItem(ItemStruct *pItem) +{ + CopyInt(tbuff, &pItem->_iSeed); + CopyShort(tbuff, &pItem->_iCreateInfo); + tbuff += 2; + CopyInt(tbuff, &pItem->_itype); + CopyInt(tbuff, &pItem->_ix); + CopyInt(tbuff, &pItem->_iy); + CopyInt(tbuff, &pItem->_iAnimFlag); + tbuff += 4; // Skip pointer _iAnimData + CopyInt(tbuff, &pItem->_iAnimLen); + CopyInt(tbuff, &pItem->_iAnimFrame); + CopyInt(tbuff, &pItem->_iAnimWidth); + CopyInt(tbuff, &pItem->_iAnimWidth2); + CopyInt(tbuff, &pItem->_isin); + CopyChar(tbuff, &pItem->_iSelFlag); + tbuff += 3; + CopyInt(tbuff, &pItem->_iPostDraw); + CopyInt(tbuff, &pItem->_iIdentified); + CopyChar(tbuff, &pItem->_iMagical); + CopyBytes(tbuff, 64, &pItem->_iName); + CopyBytes(tbuff, 64, &pItem->_iIName); + CopyChar(tbuff, &pItem->_iLoc); + CopyChar(tbuff, &pItem->_iClass); + tbuff += 1; + CopyInt(tbuff, &pItem->_iCurs); + CopyInt(tbuff, &pItem->_ivalue); + CopyInt(tbuff, &pItem->_iIvalue); + CopyInt(tbuff, &pItem->_iMinDam); + CopyInt(tbuff, &pItem->_iMaxDam); + CopyInt(tbuff, &pItem->_iAC); + CopyInt(tbuff, &pItem->_iFlags); + CopyInt(tbuff, &pItem->_iMiscId); + CopyInt(tbuff, &pItem->_iSpell); + CopyInt(tbuff, &pItem->_iCharges); + CopyInt(tbuff, &pItem->_iMaxCharges); + CopyInt(tbuff, &pItem->_iDurability); + CopyInt(tbuff, &pItem->_iMaxDur); + CopyInt(tbuff, &pItem->_iPLDam); + CopyInt(tbuff, &pItem->_iPLToHit); + CopyInt(tbuff, &pItem->_iPLAC); + CopyInt(tbuff, &pItem->_iPLStr); + CopyInt(tbuff, &pItem->_iPLMag); + CopyInt(tbuff, &pItem->_iPLDex); + CopyInt(tbuff, &pItem->_iPLVit); + CopyInt(tbuff, &pItem->_iPLFR); + CopyInt(tbuff, &pItem->_iPLLR); + CopyInt(tbuff, &pItem->_iPLMR); + CopyInt(tbuff, &pItem->_iPLMana); + CopyInt(tbuff, &pItem->_iPLHP); + CopyInt(tbuff, &pItem->_iPLDamMod); + CopyInt(tbuff, &pItem->_iPLGetHit); + CopyInt(tbuff, &pItem->_iPLLight); + CopyChar(tbuff, &pItem->_iSplLvlAdd); + CopyChar(tbuff, &pItem->_iRequest); + tbuff += 2; + CopyInt(tbuff, &pItem->_iUid); + CopyInt(tbuff, &pItem->_iFMinDam); + CopyInt(tbuff, &pItem->_iFMaxDam); + CopyInt(tbuff, &pItem->_iLMinDam); + CopyInt(tbuff, &pItem->_iLMaxDam); + CopyInt(tbuff, &pItem->_iPLEnAc); + CopyChar(tbuff, &pItem->_iPrePower); + CopyChar(tbuff, &pItem->_iSufPower); + tbuff += 2; + CopyInt(tbuff, &pItem->_iVAdd1); + CopyInt(tbuff, &pItem->_iVMult1); + CopyInt(tbuff, &pItem->_iVAdd2); + CopyInt(tbuff, &pItem->_iVMult2); + CopyChar(tbuff, &pItem->_iMinStr); + CopyChar(tbuff, &pItem->_iMinMag); + CopyChar(tbuff, &pItem->_iMinDex); + tbuff += 1; + CopyInt(tbuff, &pItem->_iStatFlag); + CopyInt(tbuff, &pItem->IDidx); + CopyInt(tbuff, &pItem->offs016C); +} + +void CopyItems(const int n, ItemStruct *pItem) +{ + for (int i = 0; i < n; i++) { + CopyItem(&pItem[i]); + } +} + +void SaveItem(ItemStruct *pItem) +{ + CopyInt(&pItem->_iSeed, tbuff); + CopyShort(&pItem->_iCreateInfo, tbuff); + tbuff += 2; + CopyInt(&pItem->_itype, tbuff); + CopyInt(&pItem->_ix, tbuff); + CopyInt(&pItem->_iy, tbuff); + CopyInt(&pItem->_iAnimFlag, tbuff); + tbuff += 4; // Skip pointer _iAnimData + CopyInt(&pItem->_iAnimLen, tbuff); + CopyInt(&pItem->_iAnimFrame, tbuff); + CopyInt(&pItem->_iAnimWidth, tbuff); + CopyInt(&pItem->_iAnimWidth2, tbuff); // width 2? + CopyInt(&pItem->_isin, tbuff); // set when item is flagged for deletion, deprecated in 1.02 + CopyChar(&pItem->_iSelFlag, tbuff); + tbuff += 3; + CopyInt(&pItem->_iPostDraw, tbuff); + CopyInt(&pItem->_iIdentified, tbuff); + CopyChar(&pItem->_iMagical, tbuff); + CopyBytes(&pItem->_iName, 64, tbuff); + CopyBytes(&pItem->_iIName, 64, tbuff); + CopyChar(&pItem->_iLoc, tbuff); + CopyChar(&pItem->_iClass, tbuff); + tbuff += 1; + CopyInt(&pItem->_iCurs, tbuff); + CopyInt(&pItem->_ivalue, tbuff); + CopyInt(&pItem->_iIvalue, tbuff); + CopyInt(&pItem->_iMinDam, tbuff); + CopyInt(&pItem->_iMaxDam, tbuff); + CopyInt(&pItem->_iAC, tbuff); + CopyInt(&pItem->_iFlags, tbuff); + CopyInt(&pItem->_iMiscId, tbuff); + CopyInt(&pItem->_iSpell, tbuff); + CopyInt(&pItem->_iCharges, tbuff); + CopyInt(&pItem->_iMaxCharges, tbuff); + CopyInt(&pItem->_iDurability, tbuff); + CopyInt(&pItem->_iMaxDur, tbuff); + CopyInt(&pItem->_iPLDam, tbuff); + CopyInt(&pItem->_iPLToHit, tbuff); + CopyInt(&pItem->_iPLAC, tbuff); + CopyInt(&pItem->_iPLStr, tbuff); + CopyInt(&pItem->_iPLMag, tbuff); + CopyInt(&pItem->_iPLDex, tbuff); + CopyInt(&pItem->_iPLVit, tbuff); + CopyInt(&pItem->_iPLFR, tbuff); + CopyInt(&pItem->_iPLLR, tbuff); + CopyInt(&pItem->_iPLMR, tbuff); + CopyInt(&pItem->_iPLMana, tbuff); + CopyInt(&pItem->_iPLHP, tbuff); + CopyInt(&pItem->_iPLDamMod, tbuff); + CopyInt(&pItem->_iPLGetHit, tbuff); + CopyInt(&pItem->_iPLLight, tbuff); + CopyChar(&pItem->_iSplLvlAdd, tbuff); + CopyChar(&pItem->_iRequest, tbuff); + tbuff += 2; + CopyInt(&pItem->_iUid, tbuff); + CopyInt(&pItem->_iFMinDam, tbuff); + CopyInt(&pItem->_iFMaxDam, tbuff); + CopyInt(&pItem->_iLMinDam, tbuff); + CopyInt(&pItem->_iLMaxDam, tbuff); + CopyInt(&pItem->_iPLEnAc, tbuff); + CopyChar(&pItem->_iPrePower, tbuff); + CopyChar(&pItem->_iSufPower, tbuff); + tbuff += 2; + CopyInt(&pItem->_iVAdd1, tbuff); + CopyInt(&pItem->_iVMult1, tbuff); + CopyInt(&pItem->_iVAdd2, tbuff); + CopyInt(&pItem->_iVMult2, tbuff); + CopyChar(&pItem->_iMinStr, tbuff); + CopyChar(&pItem->_iMinMag, tbuff); + CopyChar(&pItem->_iMinDex, tbuff); + tbuff += 1; + CopyInt(&pItem->_iStatFlag, tbuff); + CopyInt(&pItem->IDidx, tbuff); + CopyInt(&pItem->offs016C, tbuff); +} + +void SaveItems(ItemStruct *pItem, const int n) +{ + for (int i = 0; i < n; i++) { + SaveItem(&pItem[i]); + } +} + +void LoadPremium(int i) +{ + CopyItem(&item[i]); +} + +void LoadQuest(int i) +{ + memcpy(&quests[i], tbuff, sizeof(*quests)); + tbuff += sizeof(*quests); + ReturnLvlX = WLoad(); + ReturnLvlY = WLoad(); + ReturnLvl = WLoad(); + ReturnLvlT = WLoad(); + DoomQuestState = WLoad(); +} + +void LoadLighting(int i) +{ + memcpy(&LightList[i], tbuff, sizeof(*LightList)); + tbuff += sizeof(*LightList); +} + +void LoadVision(int i) +{ + memcpy(&VisionList[i], tbuff, sizeof(*VisionList)); + tbuff += sizeof(*VisionList); +} + +void LoadPortal(int i) +{ + memcpy(&portal[i], tbuff, sizeof(*portal)); + tbuff += sizeof(*portal); +} + +void SaveGame() +{ + int i, j; + char szName[MAX_PATH]; + + DWORD dwLen = codec_get_encoded_len(FILEBUFF); + BYTE *SaveBuff = DiabloAllocPtr(dwLen); + tbuff = SaveBuff; + + ISave('RETL'); + OSave((unsigned char)setlevel); + WSave(setlvlnum); + WSave(currlevel); + WSave((unsigned char)leveltype); + WSave(ViewX); + WSave(ViewY); + OSave(invflag); + OSave(chrflag); + WSave(nummonsters); + WSave(numitems); + WSave(nummissiles); + WSave(nobjects); + + for (i = 0; i < NUMLEVELS; i++) { + ISave(glSeedTbl[i]); + WSave(gnLevelTypeTbl[i]); + } + + SavePlayer(myplr); + + for (i = 0; i < MAXQUESTS; i++) + SaveQuest(i); + for (i = 0; i < MAXPORTAL; i++) + SavePortal(i); + for (i = 0; i < MAXMONSTERS; i++) + ISave(monstkills[i]); + + if (leveltype != DTYPE_TOWN) { + for (i = 0; i < MAXMONSTERS; i++) + WSave(monstactive[i]); + for (i = 0; i < nummonsters; i++) + SaveMonster(monstactive[i]); + for (i = 0; i < MAXMISSILES; i++) + BSave(missileactive[i]); + for (i = 0; i < MAXMISSILES; i++) + BSave(missileavail[i]); + for (i = 0; i < nummissiles; i++) + SaveMissile(missileactive[i]); + for (i = 0; i < MAXOBJECTS; i++) + BSave(objectactive[i]); + for (i = 0; i < MAXOBJECTS; i++) + BSave(objectavail[i]); + for (i = 0; i < nobjects; i++) + SaveObject(objectactive[i]); + + WSave(numlights); + + for (i = 0; i < MAXLIGHTS; i++) + BSave(lightactive[i]); + for (i = 0; i < numlights; i++) + SaveLighting(lightactive[i]); + + WSave(visionid); + WSave(numvision); + + for (i = 0; i < numvision; i++) + SaveVision(i); + } + + for (i = 0; i < MAXITEMS; i++) + BSave(itemactive[i]); + for (i = 0; i < MAXITEMS; i++) + BSave(itemavail[i]); + for (i = 0; i < numitems; i++) + SaveItem(&item[itemactive[i]]); + for (i = 0; i < 128; i++) + OSave(UniqueItemFlag[i]); + + for (j = 0; j < MAXDUNY; j++) { + for (i = 0; i < MAXDUNX; i++) + BSave(dLight[i][j]); + } + for (j = 0; j < MAXDUNY; j++) { + for (i = 0; i < MAXDUNX; i++) + BSave(dFlags[i][j] & ~(BFLAG_MISSILE | BFLAG_VISIBLE | BFLAG_DEAD_PLAYER)); + } + for (j = 0; j < MAXDUNY; j++) { + for (i = 0; i < MAXDUNX; i++) + BSave(dPlayer[i][j]); + } + for (j = 0; j < MAXDUNY; j++) { + for (i = 0; i < MAXDUNX; i++) + BSave(dItem[i][j]); + } + + if (leveltype != DTYPE_TOWN) { + for (j = 0; j < MAXDUNY; j++) { + for (i = 0; i < MAXDUNX; i++) + WSave(dMonster[i][j]); + } + for (j = 0; j < MAXDUNY; j++) { + for (i = 0; i < MAXDUNX; i++) + BSave(dDead[i][j]); + } + for (j = 0; j < MAXDUNY; j++) { + for (i = 0; i < MAXDUNX; i++) + BSave(dObject[i][j]); + } + for (j = 0; j < MAXDUNY; j++) { + for (i = 0; i < MAXDUNX; i++) + BSave(dLight[i][j]); + } + for (j = 0; j < MAXDUNY; j++) { + for (i = 0; i < MAXDUNX; i++) + BSave(dPreLight[i][j]); + } + for (j = 0; j < DMAXY; j++) { + for (i = 0; i < DMAXX; i++) + OSave(automapview[i][j]); + } + for (j = 0; j < MAXDUNY; j++) { + for (i = 0; i < MAXDUNX; i++) + BSave(dMissile[i][j]); + } + } + + WSave(numpremium); + WSave(premiumlevel); + + for (i = 0; i < 6; i++) + SavePremium(i); + + OSave(automapflag); + WSave(AutoMapScale); + pfile_get_game_name(szName); + dwLen = codec_get_encoded_len(tbuff - SaveBuff); + pfile_write_save_file(szName, SaveBuff, tbuff - SaveBuff, dwLen); + mem_free_dbg(SaveBuff); + gbValidSaveFile = TRUE; + pfile_rename_temp_to_perm(); + pfile_write_hero(); +} + +void BSave(char v) +{ + *tbuff++ = v; +} + +void WSave(int v) +{ + *tbuff++ = v >> 24; + *tbuff++ = v >> 16; + *tbuff++ = v >> 8; + *tbuff++ = v; +} + +void ISave(int v) +{ + *tbuff++ = v >> 24; + *tbuff++ = v >> 16; + *tbuff++ = v >> 8; + *tbuff++ = v; +} + +void OSave(BOOL v) +{ + if (v != FALSE) + *tbuff++ = TRUE; + else + *tbuff++ = FALSE; +} + +void SaveMonster(int i) +{ + MonsterStruct *pMonster = &monster[i]; + + CopyInt(&pMonster->_mMTidx, tbuff); + CopyInt(&pMonster->_mmode, tbuff); + + CopyChar(&pMonster->_mgoal, tbuff); + tbuff += 3; + + CopyInt(&pMonster->_mgoalvar1, tbuff); + CopyInt(&pMonster->_mgoalvar2, tbuff); + CopyInt(&pMonster->_mgoalvar3, tbuff); + CopyInt(&pMonster->field_18, tbuff); + + CopyChar(&pMonster->_pathcount, tbuff); + tbuff += 3; + + CopyInt(&pMonster->_mx, tbuff); + CopyInt(&pMonster->_my, tbuff); + CopyInt(&pMonster->_mfutx, tbuff); + CopyInt(&pMonster->_mfuty, tbuff); + CopyInt(&pMonster->_moldx, tbuff); + CopyInt(&pMonster->_moldy, tbuff); + CopyInt(&pMonster->_mxoff, tbuff); + CopyInt(&pMonster->_myoff, tbuff); + CopyInt(&pMonster->_mxvel, tbuff); + CopyInt(&pMonster->_myvel, tbuff); + CopyInt(&pMonster->_mdir, tbuff); + CopyInt(&pMonster->_menemy, tbuff); + + CopyChar(&pMonster->_menemyx, tbuff); + CopyChar(&pMonster->_menemyy, tbuff); + CopyShort(&pMonster->falign_52, tbuff); + + tbuff += 4; // Skip pointer + CopyInt(&pMonster->_mAnimDelay, tbuff); + CopyInt(&pMonster->_mAnimCnt, tbuff); + CopyInt(&pMonster->_mAnimLen, tbuff); + CopyInt(&pMonster->_mAnimFrame, tbuff); + CopyInt(&pMonster->_meflag, tbuff); + CopyInt(&pMonster->_mDelFlag, tbuff); + CopyInt(&pMonster->_mVar1, tbuff); + CopyInt(&pMonster->_mVar2, tbuff); + CopyInt(&pMonster->_mVar3, tbuff); + CopyInt(&pMonster->_mVar4, tbuff); + CopyInt(&pMonster->_mVar5, tbuff); + CopyInt(&pMonster->_mVar6, tbuff); + CopyInt(&pMonster->_mVar7, tbuff); + CopyInt(&pMonster->_mVar8, tbuff); + CopyInt(&pMonster->_mmaxhp, tbuff); + CopyInt(&pMonster->_mhitpoints, tbuff); + + CopyChar(&pMonster->_mAi, tbuff); + CopyChar(&pMonster->_mint, tbuff); + CopyShort(&pMonster->falign_9A, tbuff); + + CopyInt(&pMonster->_mFlags, tbuff); + + CopyChar(&pMonster->_msquelch, tbuff); + tbuff += 3; + + CopyInt(&pMonster->falign_A4, tbuff); + CopyInt(&pMonster->_lastx, tbuff); + CopyInt(&pMonster->_lasty, tbuff); + CopyInt(&pMonster->_mRndSeed, tbuff); + CopyInt(&pMonster->_mAISeed, tbuff); + CopyInt(&pMonster->falign_B8, tbuff); + + CopyChar(&pMonster->_uniqtype, tbuff); + CopyChar(&pMonster->_uniqtrans, tbuff); + CopyChar(&pMonster->_udeadval, tbuff); + CopyChar(&pMonster->mWhoHit, tbuff); + + CopyChar(&pMonster->mLevel, tbuff); + CopyShort(&pMonster->mExp, tbuff); + tbuff += 1; + + CopyChar(&pMonster->mHit, tbuff); + CopyChar(&pMonster->mMinDamage, tbuff); + CopyChar(&pMonster->mMaxDamage, tbuff); + CopyChar(&pMonster->mHit2, tbuff); + + CopyChar(&pMonster->mMinDamage2, tbuff); + CopyChar(&pMonster->mMaxDamage2, tbuff); + CopyChar(&pMonster->mArmorClass, tbuff); + CopyChar(&pMonster->falign_CB, tbuff); + + CopyShort(&pMonster->mMagicRes, tbuff); + tbuff += 2; + + CopyInt(&pMonster->mtalkmsg, tbuff); + + CopyChar(&pMonster->leader, tbuff); + CopyChar(&pMonster->leaderflag, tbuff); + CopyChar(&pMonster->packsize, tbuff); + CopyChar(&pMonster->mlid, tbuff); +} + +void SaveMissile(int i) +{ + MissileStruct *pMissile = &missile[i]; + + CopyInt(&pMissile->_mitype, tbuff); + CopyInt(&pMissile->_mix, tbuff); + CopyInt(&pMissile->_miy, tbuff); + CopyInt(&pMissile->_mixoff, tbuff); + CopyInt(&pMissile->_miyoff, tbuff); + CopyInt(&pMissile->_mixvel, tbuff); + CopyInt(&pMissile->_miyvel, tbuff); + CopyInt(&pMissile->_misx, tbuff); + CopyInt(&pMissile->_misy, tbuff); + CopyInt(&pMissile->_mitxoff, tbuff); + CopyInt(&pMissile->_mityoff, tbuff); + CopyInt(&pMissile->_mimfnum, tbuff); + CopyInt(&pMissile->_mispllvl, tbuff); + CopyInt(&pMissile->_miDelFlag, tbuff); + CopyChar(&pMissile->_miAnimType, tbuff); + tbuff += 3; + + CopyInt(&pMissile->_miAnimFlags, tbuff); + tbuff += 4; + CopyInt(&pMissile->_miAnimDelay, tbuff); + CopyInt(&pMissile->_miAnimLen, tbuff); + CopyInt(&pMissile->_miAnimWidth, tbuff); + CopyInt(&pMissile->_miAnimWidth2, tbuff); + CopyInt(&pMissile->_miAnimCnt, tbuff); + CopyInt(&pMissile->_miAnimAdd, tbuff); + CopyInt(&pMissile->_miAnimFrame, tbuff); + CopyInt(&pMissile->_miDrawFlag, tbuff); + CopyInt(&pMissile->_miLightFlag, tbuff); + CopyInt(&pMissile->_miPreFlag, tbuff); + CopyInt(&pMissile->_miUniqTrans, tbuff); + CopyInt(&pMissile->_mirange, tbuff); + CopyInt(&pMissile->_misource, tbuff); + CopyInt(&pMissile->_micaster, tbuff); + CopyInt(&pMissile->_midam, tbuff); + CopyInt(&pMissile->_miHitFlag, tbuff); + CopyInt(&pMissile->_midist, tbuff); + CopyInt(&pMissile->_mlid, tbuff); + CopyInt(&pMissile->_mirnd, tbuff); + CopyInt(&pMissile->_miVar1, tbuff); + CopyInt(&pMissile->_miVar2, tbuff); + CopyInt(&pMissile->_miVar3, tbuff); + CopyInt(&pMissile->_miVar4, tbuff); + CopyInt(&pMissile->_miVar5, tbuff); + CopyInt(&pMissile->_miVar6, tbuff); + CopyInt(&pMissile->_miVar7, tbuff); + CopyInt(&pMissile->_miVar8, tbuff); +} + +void SaveObject(int i) +{ + ObjectStruct *pObject = &object[i]; + CopyInt(tbuff, &pObject->_otype); + CopyInt(&pObject->_ox, tbuff); + CopyInt(&pObject->_oy, tbuff); + CopyInt(&pObject->_oLight, tbuff); + CopyInt(&pObject->_oAnimFlag, tbuff); + tbuff += 4; + CopyInt(&pObject->_oAnimDelay, tbuff); + CopyInt(&pObject->_oAnimCnt, tbuff); + CopyInt(&pObject->_oAnimLen, tbuff); + CopyInt(&pObject->_oAnimFrame, tbuff); + CopyInt(&pObject->_oAnimWidth, tbuff); + CopyInt(&pObject->_oAnimWidth2, tbuff); + CopyInt(&pObject->_oDelFlag, tbuff); + + CopyChar(&pObject->_oBreak, tbuff); + tbuff += 3; + + CopyInt(&pObject->_oSolidFlag, tbuff); + CopyInt(&pObject->_oMissFlag, tbuff); + + CopyChar(&pObject->_oSelFlag, tbuff); + tbuff += 3; + + CopyInt(&pObject->_oPreFlag, tbuff); + CopyInt(&pObject->_oTrapFlag, tbuff); + CopyInt(&pObject->_oDoorFlag, tbuff); + CopyInt(&pObject->_olid, tbuff); + CopyInt(&pObject->_oRndSeed, tbuff); + CopyInt(&pObject->_oVar1, tbuff); + CopyInt(&pObject->_oVar2, tbuff); + CopyInt(&pObject->_oVar3, tbuff); + CopyInt(&pObject->_oVar4, tbuff); + CopyInt(&pObject->_oVar5, tbuff); + CopyInt(&pObject->_oVar6, tbuff); + CopyInt(&pObject->_oVar7, tbuff); + CopyInt(&pObject->_oVar8, tbuff); +} + +void SavePremium(int i) +{ + SaveItem(&item[i]); +} + +void SaveQuest(int i) +{ + memcpy(tbuff, &quests[i], sizeof(*quests)); + tbuff += sizeof(*quests); + WSave(ReturnLvlX); + WSave(ReturnLvlY); + WSave(ReturnLvl); + WSave(ReturnLvlT); + WSave(DoomQuestState); +} + +void SaveLighting(int i) +{ + memcpy(tbuff, &LightList[i], sizeof(*LightList)); + tbuff += sizeof(*LightList); +} + +void SaveVision(int i) +{ + memcpy(tbuff, &VisionList[i], sizeof(*VisionList)); + tbuff += sizeof(*VisionList); +} + +void SavePortal(int i) +{ + memcpy(tbuff, &portal[i], sizeof(*portal)); + tbuff += sizeof(*portal); +} + +void SaveLevel() +{ + int i, j; + char szName[MAX_PATH]; + int dwLen; + unsigned char *SaveBuff; + + if (!currlevel) + glSeedTbl[0] = GetRndSeed(); + + dwLen = codec_get_encoded_len(FILEBUFF); + SaveBuff = DiabloAllocPtr(dwLen); + tbuff = SaveBuff; + + if (leveltype != DTYPE_TOWN) { + for (j = 0; j < MAXDUNY; j++) { + for (i = 0; i < MAXDUNX; i++) + BSave(dDead[i][j]); + } + } + + WSave(nummonsters); + WSave(numitems); + WSave(nobjects); + + if (leveltype != DTYPE_TOWN) { + for (i = 0; i < MAXMONSTERS; i++) + WSave(monstactive[i]); + for (i = 0; i < nummonsters; i++) + SaveMonster(monstactive[i]); + for (i = 0; i < MAXOBJECTS; i++) + BSave(objectactive[i]); + for (i = 0; i < MAXOBJECTS; i++) + BSave(objectavail[i]); + for (i = 0; i < nobjects; i++) + SaveObject(objectactive[i]); + } + + for (i = 0; i < MAXITEMS; i++) + BSave(itemactive[i]); + for (i = 0; i < MAXITEMS; i++) + BSave(itemavail[i]); + for (i = 0; i < numitems; i++) + SaveItem(&item[itemactive[i]]); + + for (j = 0; j < MAXDUNY; j++) { + for (i = 0; i < MAXDUNX; i++) + BSave(dFlags[i][j] & ~(BFLAG_MISSILE | BFLAG_VISIBLE | BFLAG_DEAD_PLAYER)); + } + for (j = 0; j < MAXDUNY; j++) { + for (i = 0; i < MAXDUNX; i++) + BSave(dItem[i][j]); + } + + if (leveltype != DTYPE_TOWN) { + for (j = 0; j < MAXDUNY; j++) { + for (i = 0; i < MAXDUNX; i++) + WSave(dMonster[i][j]); + } + for (j = 0; j < MAXDUNY; j++) { + for (i = 0; i < MAXDUNX; i++) + BSave(dObject[i][j]); + } + for (j = 0; j < MAXDUNY; j++) { + for (i = 0; i < MAXDUNX; i++) + BSave(dLight[i][j]); + } + for (j = 0; j < MAXDUNY; j++) { + for (i = 0; i < MAXDUNX; i++) + BSave(dPreLight[i][j]); + } + for (j = 0; j < DMAXY; j++) { + for (i = 0; i < DMAXX; i++) + OSave(automapview[i][j]); + } + for (j = 0; j < MAXDUNY; j++) { + for (i = 0; i < MAXDUNX; i++) + BSave(dMissile[i][j]); + } + } + + GetTempLevelNames(szName); + dwLen = codec_get_encoded_len(tbuff - SaveBuff); + pfile_write_save_file(szName, SaveBuff, tbuff - SaveBuff, dwLen); + mem_free_dbg(SaveBuff); + + if (setlevel == 0) + plr[myplr]._pLvlVisited[currlevel] = 1; + else + plr[myplr]._pSLvlVisited[setlvlnum] = 1; +} + +void LoadLevel() +{ + int i, j; + DWORD dwLen; + char szName[MAX_PATH]; + BYTE *LoadBuff; + + GetPermLevelNames(szName); + LoadBuff = pfile_read(szName, &dwLen); + tbuff = LoadBuff; + + if (leveltype != DTYPE_TOWN) { + for (j = 0; j < MAXDUNY; j++) { + for (i = 0; i < MAXDUNX; i++) + dDead[i][j] = BLoad(); + } + SetDead(); + } + + nummonsters = WLoad(); + numitems = WLoad(); + nobjects = WLoad(); + + if (leveltype != DTYPE_TOWN) { + for (i = 0; i < MAXMONSTERS; i++) + monstactive[i] = WLoad(); + for (i = 0; i < nummonsters; i++) + LoadMonster(monstactive[i]); + for (i = 0; i < MAXOBJECTS; i++) + objectactive[i] = BLoad(); + for (i = 0; i < MAXOBJECTS; i++) + objectavail[i] = BLoad(); + for (i = 0; i < nobjects; i++) + LoadObject(objectactive[i]); + for (i = 0; i < nobjects; i++) + SyncObjectAnim(objectactive[i]); + } + + for (i = 0; i < MAXITEMS; i++) + itemactive[i] = BLoad(); + for (i = 0; i < MAXITEMS; i++) + itemavail[i] = BLoad(); + for (i = 0; i < numitems; i++) + LoadItem(itemactive[i]); + + for (j = 0; j < MAXDUNY; j++) { + for (i = 0; i < MAXDUNX; i++) + dFlags[i][j] = BLoad(); + } + for (j = 0; j < MAXDUNY; j++) { + for (i = 0; i < MAXDUNX; i++) + dItem[i][j] = BLoad(); + } + + if (leveltype != DTYPE_TOWN) { + for (j = 0; j < MAXDUNY; j++) { + for (i = 0; i < MAXDUNX; i++) + dMonster[i][j] = WLoad(); + } + for (j = 0; j < MAXDUNY; j++) { + for (i = 0; i < MAXDUNX; i++) + dObject[i][j] = BLoad(); + } + for (j = 0; j < MAXDUNY; j++) { + for (i = 0; i < MAXDUNX; i++) + dLight[i][j] = BLoad(); + } + for (j = 0; j < MAXDUNY; j++) { + for (i = 0; i < MAXDUNX; i++) + dPreLight[i][j] = BLoad(); + } + for (j = 0; j < DMAXY; j++) { + for (i = 0; i < DMAXX; i++) + automapview[i][j] = OLoad(); + } + for (j = 0; j < MAXDUNY; j++) { + for (i = 0; i < MAXDUNX; i++) + dMissile[i][j] = 0; /// BUGFIX: supposed to load saved missiles with "BLoad()"? + } + } + + AutomapZoomReset(); + ResyncQuests(); + SyncPortals(); + dolighting = 1; + + for (i = 0; i < MAX_PLRS; i++) { + if (plr[i].plractive && currlevel == plr[i].plrlevel) + LightList[plr[i]._plid]._lunflag = 1; + } + + mem_free_dbg(LoadBuff); +} + +DEVILUTION_END_NAMESPACE From 74011382b49e25feb5631e81d293e4168f8fe6dc Mon Sep 17 00:00:00 2001 From: Alex Sweet Date: Mon, 8 Jul 2019 08:35:08 -0700 Subject: [PATCH 35/42] Removed unused #pragma packs --- structs.h | 10 ---------- 1 file changed, 10 deletions(-) diff --git a/structs.h b/structs.h index 7d995dc2fc0..b949f8487e8 100644 --- a/structs.h +++ b/structs.h @@ -92,7 +92,6 @@ typedef struct ItemGetRecordStruct { unsigned int dwTimestamp; } ItemGetRecordStruct; -#pragma pack(push, 4) typedef struct ItemStruct { int _iSeed; WORD _iCreateInfo; @@ -167,13 +166,11 @@ typedef struct ItemStruct { int IDidx; int offs016C; // _oldlight or _iInvalid } ItemStruct; -#pragma pack(pop) ////////////////////////////////////////////////// // player ////////////////////////////////////////////////// -#pragma pack(push, 4) typedef struct PlayerStruct { int _pmode; char walkpath[25]; @@ -354,7 +351,6 @@ typedef struct PlayerStruct { unsigned char *_pBData; void *pReserved; } PlayerStruct; -#pragma pack(pop) ////////////////////////////////////////////////// // textdat @@ -404,7 +400,6 @@ typedef struct ChainStruct { int _mirange; } ChainStruct; -#pragma pack(push, 4) typedef struct MissileStruct { int _mitype; int _mix; @@ -451,7 +446,6 @@ typedef struct MissileStruct { int _miVar7; int _miVar8; } MissileStruct; -#pragma pack(pop) ////////////////////////////////////////////////// // effects/sound @@ -545,7 +539,6 @@ typedef struct CMonster { BYTE *trans_file; } CMonster; -#pragma pack(push, 4) typedef struct MonsterStruct { // note: missing field _mAFNum int _mMTidx; int _mmode; /* MON_MODE */ @@ -622,7 +615,6 @@ typedef struct MonsterStruct { // note: missing field _mAFNum CMonster *MType; MonsterData *MData; } MonsterStruct; -#pragma pack(pop) typedef struct UniqMonstStruct { char mtype; @@ -1189,7 +1181,6 @@ typedef struct InvXY { // lighting ////////////////////////////////////////////////// -#pragma pack(push, 4) typedef struct LightListStruct { int _lx; int _ly; @@ -1205,7 +1196,6 @@ typedef struct LightListStruct { int _yoff; int _lflags; } LightListStruct; -#pragma pack(pop) ////////////////////////////////////////////////// // dead From 0386165da7ea66e18e2a70e3c86112b2b8cb1779 Mon Sep 17 00:00:00 2001 From: Alex Sweet Date: Mon, 8 Jul 2019 08:41:37 -0700 Subject: [PATCH 36/42] Fix incorrect arg name in forward declarations --- Source/loadsave.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Source/loadsave.h b/Source/loadsave.h index 3d04e987670..fa03d7dbbea 100644 --- a/Source/loadsave.h +++ b/Source/loadsave.h @@ -18,8 +18,8 @@ void LoadPlayer(int i); void LoadMonster(int i); void LoadMissile(int i); void LoadObject(int i); -void LoadItem(int t); -void LoadPremium(int t); +void LoadItem(int i); +void LoadPremium(int i); void LoadQuest(int i); void LoadLighting(int i); void LoadVision(int i); From a0f9a9b758ecf63547589fadef72db6d02103cf0 Mon Sep 17 00:00:00 2001 From: Alex Sweet Date: Mon, 8 Jul 2019 08:51:18 -0700 Subject: [PATCH 37/42] Move SavePlayer and SaveItem down --- Source/loadsave.cpp | 580 ++++++++++++++++++++++---------------------- 1 file changed, 291 insertions(+), 289 deletions(-) diff --git a/Source/loadsave.cpp b/Source/loadsave.cpp index 68dc56c5e52..ea7aa3f715d 100644 --- a/Source/loadsave.cpp +++ b/Source/loadsave.cpp @@ -450,209 +450,6 @@ void LoadPlayer(int i) // Omit 10 pointers } -void SavePlayer(int i) -{ - PlayerStruct *pPlayer = &plr[i]; - - CopyInt(&pPlayer->_pmode, tbuff); - - CopyBytes(&pPlayer->walkpath, 25, tbuff); - CopyBytes(&pPlayer->plractive, 1, tbuff); - tbuff += 2; - - CopyInt(&pPlayer->destAction, tbuff); - CopyInt(&pPlayer->destParam1, tbuff); - CopyInt(&pPlayer->destParam2, tbuff); - CopyInt(&pPlayer->destParam3, tbuff); - CopyInt(&pPlayer->destParam4, tbuff); - CopyInt(&pPlayer->plrlevel, tbuff); - CopyInt(&pPlayer->WorldX, tbuff); - CopyInt(&pPlayer->WorldY, tbuff); - CopyInt(&pPlayer->_px, tbuff); - CopyInt(&pPlayer->_py, tbuff); - CopyInt(&pPlayer->_ptargx, tbuff); - CopyInt(&pPlayer->_ptargy, tbuff); - CopyInt(&pPlayer->_pownerx, tbuff); - CopyInt(&pPlayer->_pownery, tbuff); - CopyInt(&pPlayer->_poldx, tbuff); - CopyInt(&pPlayer->_poldy, tbuff); - CopyInt(&pPlayer->_pxoff, tbuff); - CopyInt(&pPlayer->_pyoff, tbuff); - CopyInt(&pPlayer->_pxvel, tbuff); - CopyInt(&pPlayer->_pyvel, tbuff); - CopyInt(&pPlayer->_pdir, tbuff); - CopyInt(&pPlayer->_nextdir, tbuff); - CopyInt(&pPlayer->_pgfxnum, tbuff); - tbuff += 4; // Skip pointers - CopyInt(&pPlayer->_pAnimDelay, tbuff); - CopyInt(&pPlayer->_pAnimCnt, tbuff); - CopyInt(&pPlayer->_pAnimLen, tbuff); - CopyInt(&pPlayer->_pAnimFrame, tbuff); - CopyInt(&pPlayer->_pAnimWidth, tbuff); - CopyInt(&pPlayer->_pAnimWidth2, tbuff); - CopyInt(&pPlayer->_peflag, tbuff); - CopyInt(&pPlayer->_plid, tbuff); - CopyInt(&pPlayer->_pvid, tbuff); - - CopyInt(&pPlayer->_pSpell, tbuff); - - CopyChar(&pPlayer->_pSplType, tbuff); - CopyChar(&pPlayer->_pSplFrom, tbuff); - tbuff += 2; - - CopyInt(&pPlayer->_pTSpell, tbuff); - CopyChar(&pPlayer->_pTSplType, tbuff); - tbuff += 3; - CopyInt(&pPlayer->_pRSpell, tbuff); - CopyChar(&pPlayer->_pRSplType, tbuff); - tbuff += 3; - CopyInt(&pPlayer->_pSBkSpell, tbuff); - CopyChar(&pPlayer->_pSBkSplType, tbuff); - - CopyBytes(&pPlayer->_pSplLvl, 64, tbuff); - tbuff += 7; - CopyInt64(&pPlayer->_pMemSpells, tbuff); - CopyInt64(&pPlayer->_pAblSpells, tbuff); - CopyInt64(&pPlayer->_pScrlSpells, tbuff); - CopyChar(&pPlayer->_pSpellFlags, tbuff); - tbuff += 3; - CopyInts(&pPlayer->_pSplHotKey, 4, tbuff); - CopyBytes(&pPlayer->_pSplTHotKey, 4, tbuff); - CopyInt(&pPlayer->_pwtype, tbuff); - CopyChar(&pPlayer->_pBlockFlag, tbuff); - CopyChar(&pPlayer->_pInvincible, tbuff); - CopyChar(&pPlayer->_pLightRad, tbuff); - CopyChar(&pPlayer->_pLvlChanging, tbuff); - CopyBytes(&pPlayer->_pName, PLR_NAME_LEN, tbuff); - CopyChar(&pPlayer->_pClass, tbuff); - tbuff += 3; - CopyInt(&pPlayer->_pStrength, tbuff); - CopyInt(&pPlayer->_pBaseStr, tbuff); - CopyInt(&pPlayer->_pMagic, tbuff); - CopyInt(&pPlayer->_pBaseMag, tbuff); - CopyInt(&pPlayer->_pDexterity, tbuff); - CopyInt(&pPlayer->_pBaseDex, tbuff); - CopyInt(&pPlayer->_pVitality, tbuff); - CopyInt(&pPlayer->_pBaseVit, tbuff); - CopyInt(&pPlayer->_pStatPts, tbuff); - CopyInt(&pPlayer->_pDamageMod, tbuff); - CopyInt(&pPlayer->_pBaseToBlk, tbuff); - CopyInt(&pPlayer->_pHPBase, tbuff); - CopyInt(&pPlayer->_pMaxHPBase, tbuff); - CopyInt(&pPlayer->_pHitPoints, tbuff); - CopyInt(&pPlayer->_pMaxHP, tbuff); - CopyInt(&pPlayer->_pHPPer, tbuff); - CopyInt(&pPlayer->_pManaBase, tbuff); - CopyInt(&pPlayer->_pMaxManaBase, tbuff); - CopyInt(&pPlayer->_pMana, tbuff); - CopyInt(&pPlayer->_pMaxMana, tbuff); - CopyInt(&pPlayer->_pManaPer, tbuff); - CopyChar(&pPlayer->_pLevel, tbuff); - CopyChar(&pPlayer->_pMaxLvl, tbuff); - tbuff += 2; - CopyInt(&pPlayer->_pExperience, tbuff); - CopyInt(&pPlayer->_pMaxExp, tbuff); - CopyInt(&pPlayer->_pNextExper, tbuff); - CopyChar(&pPlayer->_pArmorClass, tbuff); - CopyChar(&pPlayer->_pMagResist, tbuff); - CopyChar(&pPlayer->_pFireResist, tbuff); - CopyChar(&pPlayer->_pLghtResist, tbuff); - CopyInt(&pPlayer->_pGold, tbuff); - CopyInt(&pPlayer->_pInfraFlag, tbuff); - CopyInt(&pPlayer->_pVar1, tbuff); - CopyInt(&pPlayer->_pVar2, tbuff); - CopyInt(&pPlayer->_pVar3, tbuff); - CopyInt(&pPlayer->_pVar4, tbuff); - CopyInt(&pPlayer->_pVar5, tbuff); - CopyInt(&pPlayer->_pVar6, tbuff); - CopyInt(&pPlayer->_pVar7, tbuff); - CopyInt(&pPlayer->_pVar8, tbuff); - CopyBytes(&pPlayer->_pLvlVisited, NUMLEVELS, tbuff); - CopyBytes(&pPlayer->_pSLvlVisited, NUMLEVELS, tbuff); // only 10 used - tbuff += 2; - CopyInt(&pPlayer->_pGFXLoad, tbuff); - - tbuff += sizeof(DWORD) * 8; // Skip 8 pointers - CopyInt(&pPlayer->_pNFrames, tbuff); - CopyInt(&pPlayer->_pNWidth, tbuff); - - tbuff += sizeof(DWORD) * 8; // Skip 8 pointers - - CopyInt(&pPlayer->_pWFrames, tbuff); - CopyInt(&pPlayer->_pWWidth, tbuff); - - tbuff += sizeof(DWORD) * 8; // Skip 8 pointers - - CopyInt(&pPlayer->_pAFrames, tbuff); - CopyInt(&pPlayer->_pAWidth, tbuff); - CopyInt(&pPlayer->_pAFNum, tbuff); - - tbuff += sizeof(DWORD) * 24; // Skip 24 pointers - - CopyInt(&pPlayer->_pSFrames, tbuff); - CopyInt(&pPlayer->_pSWidth, tbuff); - CopyInt(&pPlayer->_pSFNum, tbuff); - - tbuff += sizeof(DWORD) * 8; // Skip 8 pointers - - CopyInt(&pPlayer->_pHFrames, tbuff); - CopyInt(&pPlayer->_pHWidth, tbuff); - - tbuff += sizeof(DWORD) * 8; // Skip 8 pointers - - CopyInt(&pPlayer->_pDFrames, tbuff); - CopyInt(&pPlayer->_pDWidth, tbuff); - - tbuff += sizeof(DWORD) * 8; // Skip 8 pointers - - CopyInt(&pPlayer->_pBFrames, tbuff); - CopyInt(&pPlayer->_pBWidth, tbuff); - SaveItems(pPlayer->InvBody, NUM_INVLOC); - SaveItems(pPlayer->InvList, NUM_INV_GRID_ELEM); - CopyInt(&pPlayer->_pNumInv, tbuff); - CopyBytes(pPlayer->InvGrid, NUM_INV_GRID_ELEM, tbuff); - SaveItems(pPlayer->SpdList, MAXBELTITEMS); - SaveItem(&pPlayer->HoldItem); - CopyInt(&pPlayer->_pIMinDam, tbuff); - CopyInt(&pPlayer->_pIMaxDam, tbuff); - CopyInt(&pPlayer->_pIAC, tbuff); - CopyInt(&pPlayer->_pIBonusDam, tbuff); - CopyInt(&pPlayer->_pIBonusToHit, tbuff); - CopyInt(&pPlayer->_pIBonusAC, tbuff); - CopyInt(&pPlayer->_pIBonusDamMod, tbuff); - tbuff += 4; - CopyInt64(&pPlayer->_pISpells, tbuff); - CopyInt(&pPlayer->_pIFlags, tbuff); - CopyInt(&pPlayer->_pIGetHit, tbuff); - - CopyChar(&pPlayer->_pISplLvlAdd, tbuff); - CopyChar(&pPlayer->_pISplCost, tbuff); - tbuff += 2; - - CopyInt(&pPlayer->_pISplDur, tbuff); - CopyInt(&pPlayer->_pIEnAc, tbuff); - CopyInt(&pPlayer->_pIFMinDam, tbuff); - CopyInt(&pPlayer->_pIFMaxDam, tbuff); - CopyInt(&pPlayer->_pILMinDam, tbuff); - CopyInt(&pPlayer->_pILMaxDam, tbuff); - CopyInt(&pPlayer->_pOilType, tbuff); - - CopyChar(&pPlayer->pTownWarps, tbuff); - CopyChar(&pPlayer->pDungMsgs, tbuff); - CopyChar(&pPlayer->pLvlLoad, tbuff); - CopyChar(&pPlayer->pBattleNet, tbuff); - - CopyChar(&pPlayer->pManaShield, tbuff); - CopyBytes(&pPlayer->bReserved, 3, tbuff); - - CopyShorts(&pPlayer->wReserved, 8, tbuff); - - CopyInt(&pPlayer->pDiabloKillLevel, tbuff); - CopyInts(&pPlayer->dwReserved, 7, tbuff); - - // Omit 10 pointers -} - void LoadMonster(int i) { MonsterStruct *pMonster = &monster[i]; @@ -938,92 +735,7 @@ void CopyItems(const int n, ItemStruct *pItem) } } -void SaveItem(ItemStruct *pItem) -{ - CopyInt(&pItem->_iSeed, tbuff); - CopyShort(&pItem->_iCreateInfo, tbuff); - tbuff += 2; - CopyInt(&pItem->_itype, tbuff); - CopyInt(&pItem->_ix, tbuff); - CopyInt(&pItem->_iy, tbuff); - CopyInt(&pItem->_iAnimFlag, tbuff); - tbuff += 4; // Skip pointer _iAnimData - CopyInt(&pItem->_iAnimLen, tbuff); - CopyInt(&pItem->_iAnimFrame, tbuff); - CopyInt(&pItem->_iAnimWidth, tbuff); - CopyInt(&pItem->_iAnimWidth2, tbuff); // width 2? - CopyInt(&pItem->_isin, tbuff); // set when item is flagged for deletion, deprecated in 1.02 - CopyChar(&pItem->_iSelFlag, tbuff); - tbuff += 3; - CopyInt(&pItem->_iPostDraw, tbuff); - CopyInt(&pItem->_iIdentified, tbuff); - CopyChar(&pItem->_iMagical, tbuff); - CopyBytes(&pItem->_iName, 64, tbuff); - CopyBytes(&pItem->_iIName, 64, tbuff); - CopyChar(&pItem->_iLoc, tbuff); - CopyChar(&pItem->_iClass, tbuff); - tbuff += 1; - CopyInt(&pItem->_iCurs, tbuff); - CopyInt(&pItem->_ivalue, tbuff); - CopyInt(&pItem->_iIvalue, tbuff); - CopyInt(&pItem->_iMinDam, tbuff); - CopyInt(&pItem->_iMaxDam, tbuff); - CopyInt(&pItem->_iAC, tbuff); - CopyInt(&pItem->_iFlags, tbuff); - CopyInt(&pItem->_iMiscId, tbuff); - CopyInt(&pItem->_iSpell, tbuff); - CopyInt(&pItem->_iCharges, tbuff); - CopyInt(&pItem->_iMaxCharges, tbuff); - CopyInt(&pItem->_iDurability, tbuff); - CopyInt(&pItem->_iMaxDur, tbuff); - CopyInt(&pItem->_iPLDam, tbuff); - CopyInt(&pItem->_iPLToHit, tbuff); - CopyInt(&pItem->_iPLAC, tbuff); - CopyInt(&pItem->_iPLStr, tbuff); - CopyInt(&pItem->_iPLMag, tbuff); - CopyInt(&pItem->_iPLDex, tbuff); - CopyInt(&pItem->_iPLVit, tbuff); - CopyInt(&pItem->_iPLFR, tbuff); - CopyInt(&pItem->_iPLLR, tbuff); - CopyInt(&pItem->_iPLMR, tbuff); - CopyInt(&pItem->_iPLMana, tbuff); - CopyInt(&pItem->_iPLHP, tbuff); - CopyInt(&pItem->_iPLDamMod, tbuff); - CopyInt(&pItem->_iPLGetHit, tbuff); - CopyInt(&pItem->_iPLLight, tbuff); - CopyChar(&pItem->_iSplLvlAdd, tbuff); - CopyChar(&pItem->_iRequest, tbuff); - tbuff += 2; - CopyInt(&pItem->_iUid, tbuff); - CopyInt(&pItem->_iFMinDam, tbuff); - CopyInt(&pItem->_iFMaxDam, tbuff); - CopyInt(&pItem->_iLMinDam, tbuff); - CopyInt(&pItem->_iLMaxDam, tbuff); - CopyInt(&pItem->_iPLEnAc, tbuff); - CopyChar(&pItem->_iPrePower, tbuff); - CopyChar(&pItem->_iSufPower, tbuff); - tbuff += 2; - CopyInt(&pItem->_iVAdd1, tbuff); - CopyInt(&pItem->_iVMult1, tbuff); - CopyInt(&pItem->_iVAdd2, tbuff); - CopyInt(&pItem->_iVMult2, tbuff); - CopyChar(&pItem->_iMinStr, tbuff); - CopyChar(&pItem->_iMinMag, tbuff); - CopyChar(&pItem->_iMinDex, tbuff); - tbuff += 1; - CopyInt(&pItem->_iStatFlag, tbuff); - CopyInt(&pItem->IDidx, tbuff); - CopyInt(&pItem->offs016C, tbuff); -} - -void SaveItems(ItemStruct *pItem, const int n) -{ - for (int i = 0; i < n; i++) { - SaveItem(&pItem[i]); - } -} - -void LoadPremium(int i) +void LoadPremium(int i) { CopyItem(&item[i]); } @@ -1229,6 +941,211 @@ void OSave(BOOL v) *tbuff++ = FALSE; } + + +void SavePlayer(int i) +{ + PlayerStruct *pPlayer = &plr[i]; + + CopyInt(&pPlayer->_pmode, tbuff); + + CopyBytes(&pPlayer->walkpath, 25, tbuff); + CopyBytes(&pPlayer->plractive, 1, tbuff); + tbuff += 2; + + CopyInt(&pPlayer->destAction, tbuff); + CopyInt(&pPlayer->destParam1, tbuff); + CopyInt(&pPlayer->destParam2, tbuff); + CopyInt(&pPlayer->destParam3, tbuff); + CopyInt(&pPlayer->destParam4, tbuff); + CopyInt(&pPlayer->plrlevel, tbuff); + CopyInt(&pPlayer->WorldX, tbuff); + CopyInt(&pPlayer->WorldY, tbuff); + CopyInt(&pPlayer->_px, tbuff); + CopyInt(&pPlayer->_py, tbuff); + CopyInt(&pPlayer->_ptargx, tbuff); + CopyInt(&pPlayer->_ptargy, tbuff); + CopyInt(&pPlayer->_pownerx, tbuff); + CopyInt(&pPlayer->_pownery, tbuff); + CopyInt(&pPlayer->_poldx, tbuff); + CopyInt(&pPlayer->_poldy, tbuff); + CopyInt(&pPlayer->_pxoff, tbuff); + CopyInt(&pPlayer->_pyoff, tbuff); + CopyInt(&pPlayer->_pxvel, tbuff); + CopyInt(&pPlayer->_pyvel, tbuff); + CopyInt(&pPlayer->_pdir, tbuff); + CopyInt(&pPlayer->_nextdir, tbuff); + CopyInt(&pPlayer->_pgfxnum, tbuff); + tbuff += 4; // Skip pointers + CopyInt(&pPlayer->_pAnimDelay, tbuff); + CopyInt(&pPlayer->_pAnimCnt, tbuff); + CopyInt(&pPlayer->_pAnimLen, tbuff); + CopyInt(&pPlayer->_pAnimFrame, tbuff); + CopyInt(&pPlayer->_pAnimWidth, tbuff); + CopyInt(&pPlayer->_pAnimWidth2, tbuff); + CopyInt(&pPlayer->_peflag, tbuff); + CopyInt(&pPlayer->_plid, tbuff); + CopyInt(&pPlayer->_pvid, tbuff); + + CopyInt(&pPlayer->_pSpell, tbuff); + + CopyChar(&pPlayer->_pSplType, tbuff); + CopyChar(&pPlayer->_pSplFrom, tbuff); + tbuff += 2; + + CopyInt(&pPlayer->_pTSpell, tbuff); + CopyChar(&pPlayer->_pTSplType, tbuff); + tbuff += 3; + CopyInt(&pPlayer->_pRSpell, tbuff); + CopyChar(&pPlayer->_pRSplType, tbuff); + tbuff += 3; + CopyInt(&pPlayer->_pSBkSpell, tbuff); + CopyChar(&pPlayer->_pSBkSplType, tbuff); + + CopyBytes(&pPlayer->_pSplLvl, 64, tbuff); + tbuff += 7; + CopyInt64(&pPlayer->_pMemSpells, tbuff); + CopyInt64(&pPlayer->_pAblSpells, tbuff); + CopyInt64(&pPlayer->_pScrlSpells, tbuff); + CopyChar(&pPlayer->_pSpellFlags, tbuff); + tbuff += 3; + CopyInts(&pPlayer->_pSplHotKey, 4, tbuff); + CopyBytes(&pPlayer->_pSplTHotKey, 4, tbuff); + CopyInt(&pPlayer->_pwtype, tbuff); + CopyChar(&pPlayer->_pBlockFlag, tbuff); + CopyChar(&pPlayer->_pInvincible, tbuff); + CopyChar(&pPlayer->_pLightRad, tbuff); + CopyChar(&pPlayer->_pLvlChanging, tbuff); + CopyBytes(&pPlayer->_pName, PLR_NAME_LEN, tbuff); + CopyChar(&pPlayer->_pClass, tbuff); + tbuff += 3; + CopyInt(&pPlayer->_pStrength, tbuff); + CopyInt(&pPlayer->_pBaseStr, tbuff); + CopyInt(&pPlayer->_pMagic, tbuff); + CopyInt(&pPlayer->_pBaseMag, tbuff); + CopyInt(&pPlayer->_pDexterity, tbuff); + CopyInt(&pPlayer->_pBaseDex, tbuff); + CopyInt(&pPlayer->_pVitality, tbuff); + CopyInt(&pPlayer->_pBaseVit, tbuff); + CopyInt(&pPlayer->_pStatPts, tbuff); + CopyInt(&pPlayer->_pDamageMod, tbuff); + CopyInt(&pPlayer->_pBaseToBlk, tbuff); + CopyInt(&pPlayer->_pHPBase, tbuff); + CopyInt(&pPlayer->_pMaxHPBase, tbuff); + CopyInt(&pPlayer->_pHitPoints, tbuff); + CopyInt(&pPlayer->_pMaxHP, tbuff); + CopyInt(&pPlayer->_pHPPer, tbuff); + CopyInt(&pPlayer->_pManaBase, tbuff); + CopyInt(&pPlayer->_pMaxManaBase, tbuff); + CopyInt(&pPlayer->_pMana, tbuff); + CopyInt(&pPlayer->_pMaxMana, tbuff); + CopyInt(&pPlayer->_pManaPer, tbuff); + CopyChar(&pPlayer->_pLevel, tbuff); + CopyChar(&pPlayer->_pMaxLvl, tbuff); + tbuff += 2; + CopyInt(&pPlayer->_pExperience, tbuff); + CopyInt(&pPlayer->_pMaxExp, tbuff); + CopyInt(&pPlayer->_pNextExper, tbuff); + CopyChar(&pPlayer->_pArmorClass, tbuff); + CopyChar(&pPlayer->_pMagResist, tbuff); + CopyChar(&pPlayer->_pFireResist, tbuff); + CopyChar(&pPlayer->_pLghtResist, tbuff); + CopyInt(&pPlayer->_pGold, tbuff); + CopyInt(&pPlayer->_pInfraFlag, tbuff); + CopyInt(&pPlayer->_pVar1, tbuff); + CopyInt(&pPlayer->_pVar2, tbuff); + CopyInt(&pPlayer->_pVar3, tbuff); + CopyInt(&pPlayer->_pVar4, tbuff); + CopyInt(&pPlayer->_pVar5, tbuff); + CopyInt(&pPlayer->_pVar6, tbuff); + CopyInt(&pPlayer->_pVar7, tbuff); + CopyInt(&pPlayer->_pVar8, tbuff); + CopyBytes(&pPlayer->_pLvlVisited, NUMLEVELS, tbuff); + CopyBytes(&pPlayer->_pSLvlVisited, NUMLEVELS, tbuff); // only 10 used + tbuff += 2; + CopyInt(&pPlayer->_pGFXLoad, tbuff); + + tbuff += sizeof(DWORD) * 8; // Skip 8 pointers + CopyInt(&pPlayer->_pNFrames, tbuff); + CopyInt(&pPlayer->_pNWidth, tbuff); + + tbuff += sizeof(DWORD) * 8; // Skip 8 pointers + + CopyInt(&pPlayer->_pWFrames, tbuff); + CopyInt(&pPlayer->_pWWidth, tbuff); + + tbuff += sizeof(DWORD) * 8; // Skip 8 pointers + + CopyInt(&pPlayer->_pAFrames, tbuff); + CopyInt(&pPlayer->_pAWidth, tbuff); + CopyInt(&pPlayer->_pAFNum, tbuff); + + tbuff += sizeof(DWORD) * 24; // Skip 24 pointers + + CopyInt(&pPlayer->_pSFrames, tbuff); + CopyInt(&pPlayer->_pSWidth, tbuff); + CopyInt(&pPlayer->_pSFNum, tbuff); + + tbuff += sizeof(DWORD) * 8; // Skip 8 pointers + + CopyInt(&pPlayer->_pHFrames, tbuff); + CopyInt(&pPlayer->_pHWidth, tbuff); + + tbuff += sizeof(DWORD) * 8; // Skip 8 pointers + + CopyInt(&pPlayer->_pDFrames, tbuff); + CopyInt(&pPlayer->_pDWidth, tbuff); + + tbuff += sizeof(DWORD) * 8; // Skip 8 pointers + + CopyInt(&pPlayer->_pBFrames, tbuff); + CopyInt(&pPlayer->_pBWidth, tbuff); + SaveItems(pPlayer->InvBody, NUM_INVLOC); + SaveItems(pPlayer->InvList, NUM_INV_GRID_ELEM); + CopyInt(&pPlayer->_pNumInv, tbuff); + CopyBytes(pPlayer->InvGrid, NUM_INV_GRID_ELEM, tbuff); + SaveItems(pPlayer->SpdList, MAXBELTITEMS); + SaveItem(&pPlayer->HoldItem); + CopyInt(&pPlayer->_pIMinDam, tbuff); + CopyInt(&pPlayer->_pIMaxDam, tbuff); + CopyInt(&pPlayer->_pIAC, tbuff); + CopyInt(&pPlayer->_pIBonusDam, tbuff); + CopyInt(&pPlayer->_pIBonusToHit, tbuff); + CopyInt(&pPlayer->_pIBonusAC, tbuff); + CopyInt(&pPlayer->_pIBonusDamMod, tbuff); + tbuff += 4; + CopyInt64(&pPlayer->_pISpells, tbuff); + CopyInt(&pPlayer->_pIFlags, tbuff); + CopyInt(&pPlayer->_pIGetHit, tbuff); + + CopyChar(&pPlayer->_pISplLvlAdd, tbuff); + CopyChar(&pPlayer->_pISplCost, tbuff); + tbuff += 2; + + CopyInt(&pPlayer->_pISplDur, tbuff); + CopyInt(&pPlayer->_pIEnAc, tbuff); + CopyInt(&pPlayer->_pIFMinDam, tbuff); + CopyInt(&pPlayer->_pIFMaxDam, tbuff); + CopyInt(&pPlayer->_pILMinDam, tbuff); + CopyInt(&pPlayer->_pILMaxDam, tbuff); + CopyInt(&pPlayer->_pOilType, tbuff); + + CopyChar(&pPlayer->pTownWarps, tbuff); + CopyChar(&pPlayer->pDungMsgs, tbuff); + CopyChar(&pPlayer->pLvlLoad, tbuff); + CopyChar(&pPlayer->pBattleNet, tbuff); + + CopyChar(&pPlayer->pManaShield, tbuff); + CopyBytes(&pPlayer->bReserved, 3, tbuff); + + CopyShorts(&pPlayer->wReserved, 8, tbuff); + + CopyInt(&pPlayer->pDiabloKillLevel, tbuff); + CopyInts(&pPlayer->dwReserved, 7, tbuff); + + // Omit 10 pointers +} + void SaveMonster(int i) { MonsterStruct *pMonster = &monster[i]; @@ -1421,6 +1338,91 @@ void SaveObject(int i) CopyInt(&pObject->_oVar8, tbuff); } +void SaveItem(ItemStruct *pItem) +{ + CopyInt(&pItem->_iSeed, tbuff); + CopyShort(&pItem->_iCreateInfo, tbuff); + tbuff += 2; + CopyInt(&pItem->_itype, tbuff); + CopyInt(&pItem->_ix, tbuff); + CopyInt(&pItem->_iy, tbuff); + CopyInt(&pItem->_iAnimFlag, tbuff); + tbuff += 4; // Skip pointer _iAnimData + CopyInt(&pItem->_iAnimLen, tbuff); + CopyInt(&pItem->_iAnimFrame, tbuff); + CopyInt(&pItem->_iAnimWidth, tbuff); + CopyInt(&pItem->_iAnimWidth2, tbuff); // width 2? + CopyInt(&pItem->_isin, tbuff); // set when item is flagged for deletion, deprecated in 1.02 + CopyChar(&pItem->_iSelFlag, tbuff); + tbuff += 3; + CopyInt(&pItem->_iPostDraw, tbuff); + CopyInt(&pItem->_iIdentified, tbuff); + CopyChar(&pItem->_iMagical, tbuff); + CopyBytes(&pItem->_iName, 64, tbuff); + CopyBytes(&pItem->_iIName, 64, tbuff); + CopyChar(&pItem->_iLoc, tbuff); + CopyChar(&pItem->_iClass, tbuff); + tbuff += 1; + CopyInt(&pItem->_iCurs, tbuff); + CopyInt(&pItem->_ivalue, tbuff); + CopyInt(&pItem->_iIvalue, tbuff); + CopyInt(&pItem->_iMinDam, tbuff); + CopyInt(&pItem->_iMaxDam, tbuff); + CopyInt(&pItem->_iAC, tbuff); + CopyInt(&pItem->_iFlags, tbuff); + CopyInt(&pItem->_iMiscId, tbuff); + CopyInt(&pItem->_iSpell, tbuff); + CopyInt(&pItem->_iCharges, tbuff); + CopyInt(&pItem->_iMaxCharges, tbuff); + CopyInt(&pItem->_iDurability, tbuff); + CopyInt(&pItem->_iMaxDur, tbuff); + CopyInt(&pItem->_iPLDam, tbuff); + CopyInt(&pItem->_iPLToHit, tbuff); + CopyInt(&pItem->_iPLAC, tbuff); + CopyInt(&pItem->_iPLStr, tbuff); + CopyInt(&pItem->_iPLMag, tbuff); + CopyInt(&pItem->_iPLDex, tbuff); + CopyInt(&pItem->_iPLVit, tbuff); + CopyInt(&pItem->_iPLFR, tbuff); + CopyInt(&pItem->_iPLLR, tbuff); + CopyInt(&pItem->_iPLMR, tbuff); + CopyInt(&pItem->_iPLMana, tbuff); + CopyInt(&pItem->_iPLHP, tbuff); + CopyInt(&pItem->_iPLDamMod, tbuff); + CopyInt(&pItem->_iPLGetHit, tbuff); + CopyInt(&pItem->_iPLLight, tbuff); + CopyChar(&pItem->_iSplLvlAdd, tbuff); + CopyChar(&pItem->_iRequest, tbuff); + tbuff += 2; + CopyInt(&pItem->_iUid, tbuff); + CopyInt(&pItem->_iFMinDam, tbuff); + CopyInt(&pItem->_iFMaxDam, tbuff); + CopyInt(&pItem->_iLMinDam, tbuff); + CopyInt(&pItem->_iLMaxDam, tbuff); + CopyInt(&pItem->_iPLEnAc, tbuff); + CopyChar(&pItem->_iPrePower, tbuff); + CopyChar(&pItem->_iSufPower, tbuff); + tbuff += 2; + CopyInt(&pItem->_iVAdd1, tbuff); + CopyInt(&pItem->_iVMult1, tbuff); + CopyInt(&pItem->_iVAdd2, tbuff); + CopyInt(&pItem->_iVMult2, tbuff); + CopyChar(&pItem->_iMinStr, tbuff); + CopyChar(&pItem->_iMinMag, tbuff); + CopyChar(&pItem->_iMinDex, tbuff); + tbuff += 1; + CopyInt(&pItem->_iStatFlag, tbuff); + CopyInt(&pItem->IDidx, tbuff); + CopyInt(&pItem->offs016C, tbuff); +} + +void SaveItems(ItemStruct *pItem, const int n) +{ + for (int i = 0; i < n; i++) { + SaveItem(&pItem[i]); + } +} + void SavePremium(int i) { SaveItem(&item[i]); From e1bc0c40eb13884db7a016048ba72f8569802949 Mon Sep 17 00:00:00 2001 From: Alex Sweet Date: Mon, 8 Jul 2019 09:36:04 -0700 Subject: [PATCH 38/42] Undo style changes --- structs.h | 43 +++++++++++++++++++++---------------------- 1 file changed, 21 insertions(+), 22 deletions(-) diff --git a/structs.h b/structs.h index b949f8487e8..051fa76dbe1 100644 --- a/structs.h +++ b/structs.h @@ -1,5 +1,3 @@ -#pragma once - ////////////////////////////////////////////////// // control ////////////////////////////////////////////////// @@ -174,7 +172,7 @@ typedef struct ItemStruct { typedef struct PlayerStruct { int _pmode; char walkpath[25]; - uint8_t plractive; + BOOLEAN plractive; int destAction; int destParam1; int destParam2; @@ -372,8 +370,8 @@ typedef struct TextDataStruct { typedef struct MissileData { unsigned char mName; - void (*mAddProc)(int, int, int, int, int, int, char, int, int); - void (*mProc)(int); + void(* mAddProc)(int, int, int, int, int, int, char, int, int); + void(* mProc)(int); BOOL mDraw; unsigned char mType; unsigned char mResist; @@ -971,6 +969,7 @@ typedef struct TBuffer { ////////////////////////////////////////////////// // quests ////////////////////////////////////////////////// + #pragma pack(push, 4) typedef struct QuestStruct { unsigned char _qlevel; @@ -1009,7 +1008,7 @@ typedef struct QuestData { typedef struct TMenuItem { DWORD dwFlags; char *pszStr; - void (*fnMenu)(BOOL); /* fix, should have one arg */ + void(* fnMenu)(BOOL); /* fix, should have one arg */ } TMenuItem; // TPDEF PTR FCN VOID TMenuUpdateFcn @@ -1321,21 +1320,21 @@ typedef struct _SNETUIDATA { int size; int uiflags; HWND parentwindow; - void (*artcallback)(); - void (*authcallback)(); - void (*createcallback)(); - void (*drawdesccallback)(); - void (*selectedcallback)(); - void (*messageboxcallback)(); - void (*soundcallback)(); - void (*statuscallback)(); - void (*getdatacallback)(); - void (*categorycallback)(); - void (*categorylistcallback)(); - void (*newaccountcallback)(); - void (*profilecallback)(); + void(* artcallback)(); + void(* authcallback)(); + void(* createcallback)(); + void(* drawdesccallback)(); + void(* selectedcallback)(); + void(* messageboxcallback)(); + void(* soundcallback)(); + void(* statuscallback)(); + void(* getdatacallback)(); + void(* categorycallback)(); + void(* categorylistcallback)(); + void(* newaccountcallback)(); + void(* profilecallback)(); int profilefields; - void (*profilebitmapcallback)(); + void(* profilebitmapcallback)(); int(__stdcall *selectnamecallback)( const struct _SNETPROGRAMDATA *, const struct _SNETPLAYERDATA *, @@ -1345,8 +1344,8 @@ typedef struct _SNETUIDATA { char *, DWORD, /* character name will be copied here */ char *, DWORD, /* character "description" will be copied here (used to advertise games) */ BOOL * /* new character? - unsure about this */ - ); - void (*changenamecallback)(); + ); + void(* changenamecallback)(); } _SNETUIDATA; typedef struct _SNETVERSIONDATA { From 15d046dc644cc1661483cd68bcc8de8888a17f7a Mon Sep 17 00:00:00 2001 From: Sergey Semushin Date: Fri, 12 Jul 2019 23:28:14 +0300 Subject: [PATCH 39/42] Fix typo in SaveObject. --- Source/loadsave.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Source/loadsave.cpp b/Source/loadsave.cpp index ea7aa3f715d..07a04e31fb4 100644 --- a/Source/loadsave.cpp +++ b/Source/loadsave.cpp @@ -1300,7 +1300,7 @@ void SaveMissile(int i) void SaveObject(int i) { ObjectStruct *pObject = &object[i]; - CopyInt(tbuff, &pObject->_otype); + CopyInt(&pObject->_otype, tbuff); CopyInt(&pObject->_ox, tbuff); CopyInt(&pObject->_oy, tbuff); CopyInt(&pObject->_oLight, tbuff); From 6e3619022144a39c57de8aab83ee07326ac61694 Mon Sep 17 00:00:00 2001 From: Sergey Semushin Date: Sat, 13 Jul 2019 14:45:55 +0300 Subject: [PATCH 40/42] Fix typo in LoadPremium, SavePremium. --- Source/loadsave.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Source/loadsave.cpp b/Source/loadsave.cpp index 07a04e31fb4..54fa5e974ba 100644 --- a/Source/loadsave.cpp +++ b/Source/loadsave.cpp @@ -737,7 +737,7 @@ void CopyItems(const int n, ItemStruct *pItem) void LoadPremium(int i) { - CopyItem(&item[i]); + CopyItem(&premiumitem[i]); } void LoadQuest(int i) @@ -1425,7 +1425,7 @@ void SaveItems(ItemStruct *pItem, const int n) void SavePremium(int i) { - SaveItem(&item[i]); + SaveItem(&premiumitem[i]); } void SaveQuest(int i) From 10ebca4efd422bbf46bad6d12ea4cdade9038b01 Mon Sep 17 00:00:00 2001 From: Alex Sweet Date: Mon, 15 Jul 2019 01:51:29 -0700 Subject: [PATCH 41/42] Fix load/save monster padding --- Source/loadsave.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Source/loadsave.cpp b/Source/loadsave.cpp index 54fa5e974ba..c227c5b8f30 100644 --- a/Source/loadsave.cpp +++ b/Source/loadsave.cpp @@ -525,8 +525,8 @@ void LoadMonster(int i) CopyChar(tbuff, &pMonster->mWhoHit); CopyChar(tbuff, &pMonster->mLevel); - CopyShort(tbuff, &pMonster->mExp); tbuff += 1; + CopyShort(tbuff, &pMonster->mExp); CopyChar(tbuff, &pMonster->mHit); CopyChar(tbuff, &pMonster->mMinDamage); @@ -1221,8 +1221,8 @@ void SaveMonster(int i) CopyChar(&pMonster->mWhoHit, tbuff); CopyChar(&pMonster->mLevel, tbuff); - CopyShort(&pMonster->mExp, tbuff); tbuff += 1; + CopyShort(&pMonster->mExp, tbuff); CopyChar(&pMonster->mHit, tbuff); CopyChar(&pMonster->mMinDamage, tbuff); From 98aa9b0b3f00ff873a5ecf00f35b929e953506b6 Mon Sep 17 00:00:00 2001 From: Anders Jenbo Date: Tue, 16 Jul 2019 01:53:13 +0200 Subject: [PATCH 42/42] Remove unused docker files --- docker/arch/Dockerfile | 9 --------- docker/build.sh | 10 ---------- docker/ubuntu/Dockerfile | 10 ---------- 3 files changed, 29 deletions(-) delete mode 100644 docker/arch/Dockerfile delete mode 100644 docker/build.sh delete mode 100644 docker/ubuntu/Dockerfile diff --git a/docker/arch/Dockerfile b/docker/arch/Dockerfile deleted file mode 100644 index ea199b7ea53..00000000000 --- a/docker/arch/Dockerfile +++ /dev/null @@ -1,9 +0,0 @@ -FROM base/archlinux - -RUN echo -e "[multilib]\nInclude = /etc/pacman.d/mirrorlist" >> /etc/pacman.conf -RUN pacman -Sy -RUN pacman --noconfirm -Sy \ - make gcc cmake pkg-config nasm lib32-gcc-libs lib32-sdl2 - -WORKDIR /build -VOLUME /src diff --git a/docker/build.sh b/docker/build.sh deleted file mode 100644 index 04db988da35..00000000000 --- a/docker/build.sh +++ /dev/null @@ -1,10 +0,0 @@ -#!/bin/bash - -# -# Build script to run inside a Docker container -# - -set -e - -cmake /src -make -j$(nproc) diff --git a/docker/ubuntu/Dockerfile b/docker/ubuntu/Dockerfile deleted file mode 100644 index 7f6da8a978c..00000000000 --- a/docker/ubuntu/Dockerfile +++ /dev/null @@ -1,10 +0,0 @@ -FROM ubuntu:16.04 - -RUN dpkg --add-architecture i386 - -RUN apt-get update -RUN apt-get update && apt-get install -y --no-install-recommends \ - g++-multilib cmake nasm pkg-config libsdl2-dev:i386 - -WORKDIR /build -VOLUME /src