mirror of
https://github.com/diasurgical/DevilutionX.git
synced 2026-10-12 02:13:06 +00:00
🚚 Move defines to there proper files
This commit is contained in:
+14
-2
@@ -7,10 +7,22 @@
|
||||
|
||||
#include <SDL.h>
|
||||
|
||||
#include "../defs.h"
|
||||
|
||||
namespace devilution {
|
||||
|
||||
#define ErrSdl() ErrDlg("SDL Error", SDL_GetError(), __FILE__, __LINE__)
|
||||
|
||||
#undef assert
|
||||
|
||||
#ifndef _DEBUG
|
||||
#define assert(exp)
|
||||
#define assurance(exp, value) if (!(exp)) return
|
||||
#define commitment(exp, value) if (!(exp)) return false
|
||||
#else
|
||||
#define assert(exp) (void)((exp) || (assert_fail(__LINE__, __FILE__, #exp), 0))
|
||||
#define assurance(exp, value) (void)((exp) || (app_fatal("%s: %s was %i", __func__, #exp, value), 0))
|
||||
#define commitment(exp, value) (void)((exp) || (app_fatal("%s: %s was %i", __func__, #exp, value), 0))
|
||||
#endif
|
||||
|
||||
[[noreturn]] void app_fatal(const char *pszFmt, ...) DVL_PRINTF_ATTRIBUTE(1, 2);
|
||||
void DrawDlg(const char *pszFmt, ...) DVL_PRINTF_ATTRIBUTE(1, 2);
|
||||
#ifdef _DEBUG
|
||||
|
||||
+7
-1
@@ -3,7 +3,13 @@
|
||||
*
|
||||
* Implementation of the in-game map overlay.
|
||||
*/
|
||||
#include "all.h"
|
||||
#include "automap.h"
|
||||
#include "control.h"
|
||||
#include "player.h"
|
||||
#include "palette.h"
|
||||
#include "inv.h"
|
||||
#include "monster.h"
|
||||
#include "setmaps.h"
|
||||
|
||||
namespace devilution {
|
||||
|
||||
|
||||
@@ -6,6 +6,7 @@
|
||||
#pragma once
|
||||
|
||||
#include "engine.h"
|
||||
#include "gendung.h"
|
||||
|
||||
namespace devilution {
|
||||
|
||||
|
||||
+3
-3
@@ -1681,9 +1681,9 @@ void ReleaseChrBtns(bool addAllStatPoints)
|
||||
|
||||
chrbtn[static_cast<size_t>(i)] = false;
|
||||
if (MouseX >= ChrBtnsRect[static_cast<size_t>(i)].x
|
||||
&& MouseX <= ChrBtnsRect[static_cast<size_t>(i)].x + ChrBtnsRect[static_cast<size_t>(i)].w
|
||||
&& MouseY >= ChrBtnsRect[static_cast<size_t>(i)].y
|
||||
&& MouseY <= ChrBtnsRect[static_cast<size_t>(i)].y + ChrBtnsRect[static_cast<size_t>(i)].h) {
|
||||
&& MouseX <= ChrBtnsRect[static_cast<size_t>(i)].x + ChrBtnsRect[static_cast<size_t>(i)].w
|
||||
&& MouseY >= ChrBtnsRect[static_cast<size_t>(i)].y
|
||||
&& MouseY <= ChrBtnsRect[static_cast<size_t>(i)].y + ChrBtnsRect[static_cast<size_t>(i)].h) {
|
||||
PlayerStruct &player = plr[myplr];
|
||||
int statPointsToAdd = 1;
|
||||
if (addAllStatPoints)
|
||||
|
||||
@@ -13,6 +13,18 @@
|
||||
|
||||
namespace devilution {
|
||||
|
||||
#define PANEL_WIDTH 640
|
||||
#define PANEL_HEIGHT 128
|
||||
#define PANEL_TOP (gnScreenHeight - PANEL_HEIGHT)
|
||||
#define PANEL_LEFT (gnScreenWidth - PANEL_WIDTH) / 2
|
||||
#define PANEL_X PANEL_LEFT
|
||||
#define PANEL_Y PANEL_TOP
|
||||
|
||||
#define SPANEL_WIDTH 320
|
||||
#define SPANEL_HEIGHT 352
|
||||
#define RIGHT_PANEL (gnScreenWidth - SPANEL_WIDTH)
|
||||
#define RIGHT_PANEL_X RIGHT_PANEL
|
||||
|
||||
enum text_color : uint8_t {
|
||||
COL_WHITE,
|
||||
COL_BLUE,
|
||||
|
||||
@@ -7,6 +7,8 @@
|
||||
|
||||
namespace devilution {
|
||||
|
||||
#define MAXDEAD 31
|
||||
|
||||
struct DeadStruct {
|
||||
Uint8 *_deadData[8];
|
||||
int _deadFrame;
|
||||
|
||||
@@ -8,12 +8,20 @@
|
||||
#include "console.h"
|
||||
#include "options.h"
|
||||
#include "multi.h"
|
||||
#include "sound.h"
|
||||
#include "../3rdParty/Storm/Source/storm.h"
|
||||
#include "../DiabloUI/diabloui.h"
|
||||
#include <config.h>
|
||||
|
||||
namespace devilution {
|
||||
|
||||
#ifndef DEFAULT_WIDTH
|
||||
#define DEFAULT_WIDTH 640
|
||||
#endif
|
||||
#ifndef DEFAULT_HEIGHT
|
||||
#define DEFAULT_HEIGHT 480
|
||||
#endif
|
||||
|
||||
SDL_Window *ghMainWnd;
|
||||
DWORD glSeedTbl[NUMLEVELS];
|
||||
dungeon_type gnLevelTypeTbl[NUMLEVELS];
|
||||
|
||||
+4
-8
@@ -7,7 +7,6 @@
|
||||
|
||||
#include <stdint.h>
|
||||
|
||||
#include "pack.h"
|
||||
#include "gendung.h"
|
||||
#ifdef _DEBUG
|
||||
#include "monstdat.h"
|
||||
@@ -15,19 +14,16 @@
|
||||
|
||||
namespace devilution {
|
||||
|
||||
#define GAME_ID (gbIsHellfire ? (gbIsSpawn ? LOAD_BE32("HSHR") : LOAD_BE32("HRTL")) : (gbIsSpawn ? LOAD_BE32("DSHR") : LOAD_BE32("DRTL")))
|
||||
|
||||
#define NUMLEVELS 25
|
||||
|
||||
enum clicktype : int8_t {
|
||||
CLICK_NONE,
|
||||
CLICK_LEFT,
|
||||
CLICK_RIGHT,
|
||||
};
|
||||
|
||||
#ifndef DEFAULT_WIDTH
|
||||
#define DEFAULT_WIDTH 640
|
||||
#endif
|
||||
#ifndef DEFAULT_HEIGHT
|
||||
#define DEFAULT_HEIGHT 480
|
||||
#endif
|
||||
|
||||
extern SDL_Window *ghMainWnd;
|
||||
extern DWORD glSeedTbl[NUMLEVELS];
|
||||
extern dungeon_type gnLevelTypeTbl[NUMLEVELS];
|
||||
|
||||
@@ -4,6 +4,7 @@
|
||||
* Implementation of functions for loading and playing sounds.
|
||||
*/
|
||||
#include "all.h"
|
||||
#include "sound.h"
|
||||
#include <SDL_mixer.h>
|
||||
|
||||
namespace devilution {
|
||||
|
||||
+2
-2
@@ -16,7 +16,7 @@ void Decrypt(DWORD *castBlock, DWORD size, DWORD key)
|
||||
|
||||
seed = 0xEEEEEEEE;
|
||||
for (i = 0; i < (size >> 2); i++) {
|
||||
DWORD t = SwapLE32(*castBlock);
|
||||
DWORD t = SDL_SwapLE32(*castBlock);
|
||||
seed += hashtable[4][(key & 0xFF)];
|
||||
t ^= seed + key;
|
||||
*castBlock = t;
|
||||
@@ -35,7 +35,7 @@ void Encrypt(DWORD *castBlock, DWORD size, DWORD key)
|
||||
DWORD t = ch = *castBlock;
|
||||
seed += hashtable[4][(key & 0xFF)];
|
||||
t ^= seed + key;
|
||||
*castBlock = SwapLE32(t);
|
||||
*castBlock = SDL_SwapLE32(t);
|
||||
castBlock++;
|
||||
seed += ch + (seed << 5) + 3;
|
||||
key = ((key << 0x15) ^ 0xFFE00000) + 0x11111111 | (key >> 0x0B);
|
||||
|
||||
+10
-2
@@ -27,6 +27,14 @@
|
||||
|
||||
namespace devilution {
|
||||
|
||||
#define MemFreeDbg(p) \
|
||||
{ \
|
||||
void *p__p; \
|
||||
p__p = p; \
|
||||
p = NULL; \
|
||||
mem_free_dbg(p__p); \
|
||||
}
|
||||
|
||||
enum direction : uint8_t {
|
||||
DIR_S,
|
||||
DIR_SW,
|
||||
@@ -63,7 +71,7 @@ inline BYTE *CelGetFrameStart(BYTE *pCelBuff, int nCel)
|
||||
|
||||
pFrameTable = (DWORD *)pCelBuff;
|
||||
|
||||
return pCelBuff + SwapLE32(pFrameTable[nCel]);
|
||||
return pCelBuff + SDL_SwapLE32(pFrameTable[nCel]);
|
||||
}
|
||||
|
||||
#define LOAD_LE32(b) (((DWORD)(b)[3] << 24) | ((DWORD)(b)[2] << 16) | ((DWORD)(b)[1] << 8) | (DWORD)(b)[0])
|
||||
@@ -452,4 +460,4 @@ DWORD LoadFileWithMem(const char *pszName, BYTE *p);
|
||||
void Cl2ApplyTrans(BYTE *p, BYTE *ttbl, int nCel);
|
||||
void PlayInGameMovie(const char *pszMovie);
|
||||
|
||||
}
|
||||
} // namespace devilution
|
||||
|
||||
@@ -101,6 +101,8 @@ void ClrDiabloMsg()
|
||||
msgcnt = 0;
|
||||
}
|
||||
|
||||
#define DIALOG_Y ((gnScreenHeight - PANEL_HEIGHT) / 2 - 18)
|
||||
|
||||
void DrawDiabloMsg(CelOutputBuffer out)
|
||||
{
|
||||
int i, len, width, sx, sy;
|
||||
|
||||
@@ -6,6 +6,7 @@
|
||||
*/
|
||||
#include "all.h"
|
||||
#include "options.h"
|
||||
#include "sound.h"
|
||||
|
||||
namespace devilution {
|
||||
|
||||
|
||||
@@ -11,6 +11,15 @@
|
||||
|
||||
namespace devilution {
|
||||
|
||||
#define DMAXX 40
|
||||
#define DMAXY 40
|
||||
|
||||
#define MAXDUNX (16 + DMAXX * 2 + 16)
|
||||
#define MAXDUNY (16 + DMAXY * 2 + 16)
|
||||
|
||||
#define MAXTHEMES 50
|
||||
#define MAXTILES 2048
|
||||
|
||||
enum _setlevels : int8_t {
|
||||
SL_NONE,
|
||||
SL_SKELKING,
|
||||
|
||||
@@ -9,6 +9,9 @@
|
||||
|
||||
namespace devilution {
|
||||
|
||||
#define GMENU_SLIDER 0x40000000
|
||||
#define GMENU_ENABLED 0x80000000
|
||||
|
||||
struct TMenuItem {
|
||||
Uint32 dwFlags;
|
||||
const char *pszStr;
|
||||
|
||||
@@ -9,6 +9,8 @@
|
||||
|
||||
namespace devilution {
|
||||
|
||||
#define UI_OFFSET_Y ((Sint16)((gnScreenHeight - 480) / 2))
|
||||
|
||||
enum interface_mode : uint16_t {
|
||||
// clang-format off
|
||||
WM_DIABNEXTLVL = 0x402, // WM_USER+2
|
||||
|
||||
+4
-1
@@ -8,10 +8,13 @@
|
||||
#include <stdint.h>
|
||||
|
||||
#include "items.h"
|
||||
#include "palette.h"
|
||||
#include "player.h"
|
||||
|
||||
namespace devilution {
|
||||
|
||||
#define INV_SLOT_SIZE_PX 28
|
||||
|
||||
enum inv_item : int8_t {
|
||||
// clang-format off
|
||||
INVITEM_HEAD = 0,
|
||||
@@ -127,4 +130,4 @@ bool DropItemBeforeTrig();
|
||||
|
||||
extern int AP2x2Tbl[10];
|
||||
|
||||
}
|
||||
} // namespace devilution
|
||||
|
||||
@@ -11,6 +11,8 @@
|
||||
|
||||
namespace devilution {
|
||||
|
||||
#define ITEMTYPES 43
|
||||
|
||||
enum anim_armor_id : uint8_t {
|
||||
// clang-format off
|
||||
ANIM_ID_LIGHT_ARMOR = 0,
|
||||
|
||||
+11
-2
@@ -11,6 +11,15 @@
|
||||
|
||||
namespace devilution {
|
||||
|
||||
#define MAXITEMS 127
|
||||
|
||||
#define GOLD_SMALL_LIMIT 1000
|
||||
#define GOLD_MEDIUM_LIMIT 2500
|
||||
#define GOLD_MAX_LIMIT 5000
|
||||
|
||||
// Item indestructible durability
|
||||
#define DUR_INDESTRUCTIBLE 255
|
||||
|
||||
enum item_quality : uint8_t {
|
||||
ITEM_QUALITY_NORMAL,
|
||||
ITEM_QUALITY_MAGIC,
|
||||
@@ -159,7 +168,7 @@ struct ItemStruct {
|
||||
Sint16 _ix;
|
||||
Sint16 _iy;
|
||||
bool _iAnimFlag;
|
||||
Uint8 *_iAnimData; // PSX name -> ItemFrame
|
||||
Uint8 *_iAnimData; // PSX name -> ItemFrame
|
||||
Uint8 _iAnimLen; // Number of frames in current animation
|
||||
Uint8 _iAnimFrame; // Current frame of animation.
|
||||
Sint32 _iAnimWidth;
|
||||
@@ -439,4 +448,4 @@ extern int MaxGold;
|
||||
extern BYTE ItemCAnimTbl[];
|
||||
extern _sfx_id ItemInvSnds[];
|
||||
|
||||
}
|
||||
} // namespace devilution
|
||||
|
||||
+6
-1
@@ -7,6 +7,11 @@
|
||||
|
||||
namespace devilution {
|
||||
|
||||
#define MAXLIGHTS 32
|
||||
#define MAXVISION 32
|
||||
#define LIGHTSIZE (27 * 256)
|
||||
#define NO_LIGHT -1
|
||||
|
||||
struct LightListStruct {
|
||||
int _lx;
|
||||
int _ly;
|
||||
@@ -64,4 +69,4 @@ void lighting_color_cycling();
|
||||
extern const char CrawlTable[2749];
|
||||
extern const BYTE vCrawlTable[23][30];
|
||||
|
||||
}
|
||||
} // namespace devilution
|
||||
|
||||
@@ -1749,6 +1749,10 @@ void SaveHeroItems(PlayerStruct *pPlayer)
|
||||
SaveItems(&file, pPlayer->SpdList, MAXBELTITEMS);
|
||||
}
|
||||
|
||||
// 256 kilobytes + 3 bytes (demo leftover) for file magic (262147)
|
||||
// final game uses 4-byte magic instead of 3
|
||||
#define FILEBUFF ((256 * 1024) + 3)
|
||||
|
||||
void SaveGameData()
|
||||
{
|
||||
SaveHelper file("game", FILEBUFF);
|
||||
|
||||
@@ -11,6 +11,8 @@
|
||||
|
||||
namespace devilution {
|
||||
|
||||
#define MAXMISSILES 125
|
||||
|
||||
struct ChainStruct {
|
||||
Sint32 idx;
|
||||
Sint32 _mitype;
|
||||
|
||||
+7
-2
@@ -11,6 +11,12 @@
|
||||
|
||||
namespace devilution {
|
||||
|
||||
#define NIGHTMARE_TO_HIT_BONUS 85
|
||||
#define HELL_TO_HIT_BONUS 120
|
||||
|
||||
#define NIGHTMARE_AC_BONUS 50
|
||||
#define HELL_AC_BONUS 80
|
||||
|
||||
/** Tracks which missile files are already loaded */
|
||||
int MissileFileFlag;
|
||||
|
||||
@@ -2895,8 +2901,7 @@ bool M_CallWalk(int i, int md)
|
||||
bool M_PathWalk(int i)
|
||||
{
|
||||
Sint8 path[MAX_PATH_LENGTH];
|
||||
bool(*Check)
|
||||
(int, int, int);
|
||||
bool (*Check)(int, int, int);
|
||||
|
||||
/** Maps from walking path step to facing direction. */
|
||||
const Sint8 plr2monst[9] = { 0, 5, 3, 7, 1, 4, 6, 0, 2 };
|
||||
|
||||
@@ -7,8 +7,13 @@
|
||||
|
||||
#include <stdint.h>
|
||||
|
||||
#include "monstdat.h"
|
||||
|
||||
namespace devilution {
|
||||
|
||||
#define MAXMONSTERS 200
|
||||
#define MAX_LVLMTYPES 24
|
||||
|
||||
enum monster_flag : uint16_t {
|
||||
// clang-format off
|
||||
MFLAG_HIDDEN = 1 << 0,
|
||||
|
||||
+2
-2
@@ -584,7 +584,7 @@ static bool mpqapi_write_file_contents(const char *pszName, const BYTE *pbData,
|
||||
len = PkwareCompress(mpq_buf, len);
|
||||
if (!cur_archive.stream.write((char *)mpq_buf, len))
|
||||
return false;
|
||||
sectoroffsettable[cur_sector++] = SwapLE32(destsize);
|
||||
sectoroffsettable[cur_sector++] = SDL_SwapLE32(destsize);
|
||||
destsize += len; // compressed length
|
||||
if (dwLen > kSectorSize)
|
||||
dwLen -= kSectorSize;
|
||||
@@ -592,7 +592,7 @@ static bool mpqapi_write_file_contents(const char *pszName, const BYTE *pbData,
|
||||
break;
|
||||
}
|
||||
|
||||
sectoroffsettable[num_sectors] = SwapLE32(destsize);
|
||||
sectoroffsettable[num_sectors] = SDL_SwapLE32(destsize);
|
||||
if (!cur_archive.stream.seekp(pBlk->offset, std::ios::beg))
|
||||
return false;
|
||||
if (!cur_archive.stream.write(reinterpret_cast<const char *>(sectoroffsettable.get()), offset_table_bytesize))
|
||||
|
||||
+5
-2
@@ -6,10 +6,13 @@
|
||||
#include "all.h"
|
||||
#include "../3rdParty/Storm/Source/storm.h"
|
||||
#include "../DiabloUI/diabloui.h"
|
||||
#include "objects.h"
|
||||
#include "options.h"
|
||||
|
||||
namespace devilution {
|
||||
|
||||
#define MAX_CHUNKS (NUMLEVELS + 4)
|
||||
|
||||
static DWORD sgdwOwnerWait;
|
||||
static DWORD sgdwRecvOffset;
|
||||
static int sgnCurrMegaPlayer;
|
||||
@@ -859,7 +862,7 @@ void NetSendCmdGolem(BYTE mx, BYTE my, BYTE dir, BYTE menemy, int hp, BYTE cl)
|
||||
|
||||
void NetSendCmdLoc(int playerId, bool bHiPri, _cmd_id bCmd, BYTE x, BYTE y)
|
||||
{
|
||||
ALIGN_BY_1 TCmdLoc cmd;
|
||||
TCmdLoc cmd;
|
||||
|
||||
cmd.bCmd = bCmd;
|
||||
cmd.x = x;
|
||||
@@ -917,7 +920,7 @@ void NetSendCmdLocParam3(bool bHiPri, _cmd_id bCmd, BYTE x, BYTE y, WORD wParam1
|
||||
|
||||
void NetSendCmdParam1(bool bHiPri, _cmd_id bCmd, WORD wParam1)
|
||||
{
|
||||
ALIGN_BY_1 TCmdParam1 cmd;
|
||||
TCmdParam1 cmd;
|
||||
|
||||
cmd.bCmd = bCmd;
|
||||
cmd.wParam1 = wParam1;
|
||||
|
||||
@@ -8,9 +8,15 @@
|
||||
#include <stdint.h>
|
||||
|
||||
#include "quests.h"
|
||||
#include "objects.h"
|
||||
#include "monster.h"
|
||||
#include "portal.h"
|
||||
|
||||
namespace devilution {
|
||||
|
||||
#define MAX_SEND_STR_LEN 80
|
||||
#define MAXMULTIQUESTS 10
|
||||
|
||||
enum _cmd_id : uint8_t {
|
||||
CMD_STAND,
|
||||
CMD_WALKXY,
|
||||
|
||||
@@ -4,6 +4,7 @@
|
||||
* Implementation of functions for keeping multiplaye games in sync.
|
||||
*/
|
||||
#include "all.h"
|
||||
#include "diablo.h"
|
||||
#include "options.h"
|
||||
#include "../3rdParty/Storm/Source/storm.h"
|
||||
#include "../DiabloUI/diabloui.h"
|
||||
|
||||
@@ -11,6 +11,9 @@
|
||||
|
||||
namespace devilution {
|
||||
|
||||
// must be unsigned to generate unsigned comparisons with pnum
|
||||
#define MAX_PLRS 4
|
||||
|
||||
enum event_type : uint8_t {
|
||||
EVENT_TYPE_PLAYER_CREATE_GAME,
|
||||
EVENT_TYPE_PLAYER_LEAVE_GAME,
|
||||
|
||||
@@ -141,6 +141,9 @@ char shrinemin[] = {
|
||||
1, // Solar,
|
||||
1, // Murphy's
|
||||
};
|
||||
|
||||
#define MAX_LVLS 24
|
||||
|
||||
/** Specifies the maximum dungeon level on which each shrine will appear. */
|
||||
char shrinemax[] = {
|
||||
MAX_LVLS, // Mysterious
|
||||
|
||||
+4
-1
@@ -5,10 +5,13 @@
|
||||
*/
|
||||
#pragma once
|
||||
|
||||
#include "objdat.h"
|
||||
#include "textdat.h"
|
||||
|
||||
namespace devilution {
|
||||
|
||||
#define MAXOBJECTS 127
|
||||
|
||||
struct ObjectStruct {
|
||||
_object_id _otype;
|
||||
Sint32 _ox;
|
||||
@@ -84,4 +87,4 @@ void objects_454BA8();
|
||||
void objects_rnd_454BEA();
|
||||
bool objects_lv_24_454B04(int s);
|
||||
|
||||
}
|
||||
} // namespace devilution
|
||||
|
||||
+33
-33
@@ -17,7 +17,7 @@ void PackItem(PkItemStruct *id, const ItemStruct *is)
|
||||
if (!gbIsHellfire) {
|
||||
idx = RemapItemIdxToDiablo(idx);
|
||||
}
|
||||
id->idx = SwapLE16(idx);
|
||||
id->idx = SDL_SwapLE16(idx);
|
||||
if (is->IDidx == IDI_EAR) {
|
||||
id->iCreateInfo = is->_iName[8] | (is->_iName[7] << 8);
|
||||
id->iSeed = LOAD_BE32(&is->_iName[9]);
|
||||
@@ -26,18 +26,18 @@ void PackItem(PkItemStruct *id, const ItemStruct *is)
|
||||
id->bMDur = is->_iName[15];
|
||||
id->bCh = is->_iName[16];
|
||||
id->bMCh = is->_iName[17];
|
||||
id->wValue = SwapLE16(is->_ivalue | (is->_iName[18] << 8) | ((is->_iCurs - ICURS_EAR_SORCERER) << 6));
|
||||
id->wValue = SDL_SwapLE16(is->_ivalue | (is->_iName[18] << 8) | ((is->_iCurs - ICURS_EAR_SORCERER) << 6));
|
||||
id->dwBuff = LOAD_BE32(&is->_iName[19]);
|
||||
} else {
|
||||
id->iSeed = SwapLE32(is->_iSeed);
|
||||
id->iCreateInfo = SwapLE16(is->_iCreateInfo);
|
||||
id->iSeed = SDL_SwapLE32(is->_iSeed);
|
||||
id->iCreateInfo = SDL_SwapLE16(is->_iCreateInfo);
|
||||
id->bId = is->_iIdentified + 2 * is->_iMagical;
|
||||
id->bDur = is->_iDurability;
|
||||
id->bMDur = is->_iMaxDur;
|
||||
id->bCh = is->_iCharges;
|
||||
id->bMCh = is->_iMaxCharges;
|
||||
if (is->IDidx == IDI_GOLD)
|
||||
id->wValue = SwapLE16(is->_ivalue);
|
||||
id->wValue = SDL_SwapLE16(is->_ivalue);
|
||||
id->dwBuff = is->dwBuff;
|
||||
}
|
||||
}
|
||||
@@ -68,12 +68,12 @@ void PackPlayer(PkPlayerStruct *pPack, int pnum, bool manashield)
|
||||
pPack->pBaseVit = pPlayer->_pBaseVit;
|
||||
pPack->pLevel = pPlayer->_pLevel;
|
||||
pPack->pStatPts = pPlayer->_pStatPts;
|
||||
pPack->pExperience = SwapLE32(pPlayer->_pExperience);
|
||||
pPack->pGold = SwapLE32(pPlayer->_pGold);
|
||||
pPack->pHPBase = SwapLE32(pPlayer->_pHPBase);
|
||||
pPack->pMaxHPBase = SwapLE32(pPlayer->_pMaxHPBase);
|
||||
pPack->pManaBase = SwapLE32(pPlayer->_pManaBase);
|
||||
pPack->pMaxManaBase = SwapLE32(pPlayer->_pMaxManaBase);
|
||||
pPack->pExperience = SDL_SwapLE32(pPlayer->_pExperience);
|
||||
pPack->pGold = SDL_SwapLE32(pPlayer->_pGold);
|
||||
pPack->pHPBase = SDL_SwapLE32(pPlayer->_pHPBase);
|
||||
pPack->pMaxHPBase = SDL_SwapLE32(pPlayer->_pMaxHPBase);
|
||||
pPack->pManaBase = SDL_SwapLE32(pPlayer->_pManaBase);
|
||||
pPack->pMaxManaBase = SDL_SwapLE32(pPlayer->_pMaxManaBase);
|
||||
pPack->pMemSpells = SDL_SwapLE64(pPlayer->_pMemSpells);
|
||||
|
||||
for (i = 0; i < 37; i++) // Should be MAX_SPELLS but set to 37 to make save games compatible
|
||||
@@ -112,14 +112,14 @@ void PackPlayer(PkPlayerStruct *pPack, int pnum, bool manashield)
|
||||
pi++;
|
||||
}
|
||||
|
||||
pPack->wReflections = SwapLE16(pPlayer->wReflections);
|
||||
pPack->pDifficulty = SwapLE32(pPlayer->pDifficulty);
|
||||
pPack->pDamAcFlags = SwapLE32(pPlayer->pDamAcFlags);
|
||||
pPack->pDiabloKillLevel = SwapLE32(pPlayer->pDiabloKillLevel);
|
||||
pPack->wReflections = SDL_SwapLE16(pPlayer->wReflections);
|
||||
pPack->pDifficulty = SDL_SwapLE32(pPlayer->pDifficulty);
|
||||
pPack->pDamAcFlags = SDL_SwapLE32(pPlayer->pDamAcFlags);
|
||||
pPack->pDiabloKillLevel = SDL_SwapLE32(pPlayer->pDiabloKillLevel);
|
||||
pPack->bIsHellfire = gbIsHellfire;
|
||||
|
||||
if (!gbIsMultiplayer || manashield)
|
||||
pPack->pManaShield = SwapLE32(pPlayer->pManaShield);
|
||||
pPack->pManaShield = SDL_SwapLE32(pPlayer->pManaShield);
|
||||
else
|
||||
pPack->pManaShield = false;
|
||||
}
|
||||
@@ -134,7 +134,7 @@ void PackPlayer(PkPlayerStruct *pPack, int pnum, bool manashield)
|
||||
*/
|
||||
void UnPackItem(const PkItemStruct *is, ItemStruct *id, bool isHellfire)
|
||||
{
|
||||
WORD idx = SwapLE16(is->idx);
|
||||
WORD idx = SDL_SwapLE16(is->idx);
|
||||
if (idx == 0xFFFF) {
|
||||
id->_itype = ITYPE_NONE;
|
||||
return;
|
||||
@@ -152,18 +152,18 @@ void UnPackItem(const PkItemStruct *is, ItemStruct *id, bool isHellfire)
|
||||
if (idx == IDI_EAR) {
|
||||
RecreateEar(
|
||||
MAXITEMS,
|
||||
SwapLE16(is->iCreateInfo),
|
||||
SwapLE32(is->iSeed),
|
||||
SDL_SwapLE16(is->iCreateInfo),
|
||||
SDL_SwapLE32(is->iSeed),
|
||||
is->bId,
|
||||
is->bDur,
|
||||
is->bMDur,
|
||||
is->bCh,
|
||||
is->bMCh,
|
||||
SwapLE16(is->wValue),
|
||||
SwapLE32(is->dwBuff));
|
||||
SDL_SwapLE16(is->wValue),
|
||||
SDL_SwapLE32(is->dwBuff));
|
||||
} else {
|
||||
memset(&items[MAXITEMS], 0, sizeof(*items));
|
||||
RecreateItem(MAXITEMS, idx, SwapLE16(is->iCreateInfo), SwapLE32(is->iSeed), SwapLE16(is->wValue), isHellfire);
|
||||
RecreateItem(MAXITEMS, idx, SDL_SwapLE16(is->iCreateInfo), SDL_SwapLE32(is->iSeed), SDL_SwapLE16(is->wValue), isHellfire);
|
||||
items[MAXITEMS]._iMagical = is->bId >> 1;
|
||||
items[MAXITEMS]._iIdentified = is->bId & 1;
|
||||
items[MAXITEMS]._iDurability = is->bDur;
|
||||
@@ -229,17 +229,17 @@ void UnPackPlayer(PkPlayerStruct *pPack, int pnum, bool netSync)
|
||||
pPlayer->_pVitality = pPack->pBaseVit;
|
||||
pPlayer->_pLevel = pPack->pLevel;
|
||||
pPlayer->_pStatPts = pPack->pStatPts;
|
||||
pPlayer->_pExperience = SwapLE32(pPack->pExperience);
|
||||
pPlayer->_pGold = SwapLE32(pPack->pGold);
|
||||
pPlayer->_pMaxHPBase = SwapLE32(pPack->pMaxHPBase);
|
||||
pPlayer->_pHPBase = SwapLE32(pPack->pHPBase);
|
||||
pPlayer->_pExperience = SDL_SwapLE32(pPack->pExperience);
|
||||
pPlayer->_pGold = SDL_SwapLE32(pPack->pGold);
|
||||
pPlayer->_pMaxHPBase = SDL_SwapLE32(pPack->pMaxHPBase);
|
||||
pPlayer->_pHPBase = SDL_SwapLE32(pPack->pHPBase);
|
||||
pPlayer->_pBaseToBlk = ToBlkTbl[static_cast<std::size_t>(pPlayer->_pClass)];
|
||||
if (!netSync)
|
||||
if ((int)(pPlayer->_pHPBase & 0xFFFFFFC0) < 64)
|
||||
pPlayer->_pHPBase = 64;
|
||||
|
||||
pPlayer->_pMaxManaBase = SwapLE32(pPack->pMaxManaBase);
|
||||
pPlayer->_pManaBase = SwapLE32(pPack->pManaBase);
|
||||
pPlayer->_pMaxManaBase = SDL_SwapLE32(pPack->pMaxManaBase);
|
||||
pPlayer->_pManaBase = SDL_SwapLE32(pPack->pManaBase);
|
||||
pPlayer->_pMemSpells = SDL_SwapLE64(pPack->pMemSpells);
|
||||
|
||||
for (i = 0; i < 37; i++) // Should be MAX_SPELLS but set to 36 to make save games compatible
|
||||
@@ -289,16 +289,16 @@ void UnPackPlayer(PkPlayerStruct *pPack, int pnum, bool netSync)
|
||||
}
|
||||
|
||||
CalcPlrInv(pnum, false);
|
||||
pPlayer->wReflections = SwapLE16(pPack->wReflections);
|
||||
pPlayer->wReflections = SDL_SwapLE16(pPack->wReflections);
|
||||
pPlayer->pTownWarps = 0;
|
||||
pPlayer->pDungMsgs = 0;
|
||||
pPlayer->pDungMsgs2 = 0;
|
||||
pPlayer->pLvlLoad = 0;
|
||||
pPlayer->pDiabloKillLevel = SwapLE32(pPack->pDiabloKillLevel);
|
||||
pPlayer->pDiabloKillLevel = SDL_SwapLE32(pPack->pDiabloKillLevel);
|
||||
pPlayer->pBattleNet = pPack->pBattleNet;
|
||||
pPlayer->pManaShield = SwapLE32(pPack->pManaShield);
|
||||
pPlayer->pDifficulty = (_difficulty)SwapLE32(pPack->pDifficulty);
|
||||
pPlayer->pDamAcFlags = SwapLE32(pPack->pDamAcFlags);
|
||||
pPlayer->pManaShield = SDL_SwapLE32(pPack->pManaShield);
|
||||
pPlayer->pDifficulty = (_difficulty)SDL_SwapLE32(pPack->pDifficulty);
|
||||
pPlayer->pDamAcFlags = SDL_SwapLE32(pPack->pDamAcFlags);
|
||||
}
|
||||
|
||||
} // namespace devilution
|
||||
|
||||
@@ -5,6 +5,7 @@
|
||||
*/
|
||||
#pragma once
|
||||
|
||||
#include "player.h"
|
||||
#include "inv.h"
|
||||
#include "items.h"
|
||||
|
||||
|
||||
@@ -7,6 +7,26 @@
|
||||
|
||||
namespace devilution {
|
||||
|
||||
// Diablo uses a 256 color palette
|
||||
// Entry 0-127 (0x00-0x7F) are level specific
|
||||
// Entry 128-255 (0x80-0xFF) are global
|
||||
|
||||
// standard palette for all levels
|
||||
// 8 or 16 shades per color
|
||||
// example (dark blue): PAL16_BLUE+14, PAL8_BLUE+7
|
||||
// example (light red): PAL16_RED+2, PAL8_RED
|
||||
// example (orange): PAL16_ORANGE+8, PAL8_ORANGE+4
|
||||
#define PAL8_BLUE 128
|
||||
#define PAL8_RED 136
|
||||
#define PAL8_YELLOW 144
|
||||
#define PAL8_ORANGE 152
|
||||
#define PAL16_BEIGE 160
|
||||
#define PAL16_BLUE 176
|
||||
#define PAL16_YELLOW 192
|
||||
#define PAL16_ORANGE 208
|
||||
#define PAL16_RED 224
|
||||
#define PAL16_GRAY 240
|
||||
|
||||
extern SDL_Color logical_palette[256];
|
||||
extern SDL_Color system_palette[256];
|
||||
extern SDL_Color orig_palette[256];
|
||||
|
||||
@@ -6,6 +6,9 @@
|
||||
#include "all.h"
|
||||
|
||||
namespace devilution {
|
||||
|
||||
#define MAXPATHNODES 300
|
||||
|
||||
/** Notes visisted by the path finding algorithm. */
|
||||
PATHNODE path_nodes[MAXPATHNODES];
|
||||
/** size of the pnode_tblptr stack */
|
||||
|
||||
@@ -7,6 +7,8 @@
|
||||
|
||||
namespace devilution {
|
||||
|
||||
#define MAX_PATH_LENGTH 25
|
||||
|
||||
struct PATHNODE {
|
||||
Uint8 f;
|
||||
Uint8 h;
|
||||
|
||||
@@ -10,6 +10,8 @@
|
||||
|
||||
namespace devilution {
|
||||
|
||||
#define MAX_CHARACTERS 99
|
||||
|
||||
extern bool gbValidSaveFile;
|
||||
|
||||
class PFileScopedArchiveWriter {
|
||||
|
||||
@@ -874,6 +874,8 @@ void NextPlrLevel(int pnum)
|
||||
CalcPlrInv(pnum, true);
|
||||
}
|
||||
|
||||
#define MAXEXP 2000000000
|
||||
|
||||
void AddPlrExperience(int pnum, int lvl, int exp)
|
||||
{
|
||||
int powerLvlCap, expCap, newLvl, i;
|
||||
|
||||
+14
-3
@@ -7,14 +7,25 @@
|
||||
|
||||
#include <stdint.h>
|
||||
|
||||
#include "diablo.h"
|
||||
#include "enum_traits.h"
|
||||
#include "gendung.h"
|
||||
#include "items.h"
|
||||
#include "multi.h"
|
||||
#include "spelldat.h"
|
||||
#include "path.h"
|
||||
#include "interfac.h"
|
||||
|
||||
namespace devilution {
|
||||
|
||||
// number of inventory grid cells
|
||||
#define NUM_INV_GRID_ELEM 40
|
||||
#define MAXBELTITEMS 8
|
||||
#define MAXRESIST 75
|
||||
#define MAXCHARLEVEL 51
|
||||
#define MAX_SPELL_LEVEL 15
|
||||
#define PLR_NAME_LEN 32
|
||||
|
||||
/** Walking directions */
|
||||
enum {
|
||||
// clang-format off
|
||||
@@ -168,9 +179,9 @@ struct PlayerStruct {
|
||||
Sint32 _pAnimFrame; // Current frame of animation.
|
||||
Sint32 _pAnimWidth;
|
||||
Sint32 _pAnimWidth2;
|
||||
Sint32 _pAnimNumSkippedFrames; // Number of Frames that will be skipped (for example with modifier "faster attack")
|
||||
Sint32 _pAnimNumSkippedFrames; // Number of Frames that will be skipped (for example with modifier "faster attack")
|
||||
Sint32 _pAnimGameTicksSinceSequenceStarted; // Number of GameTicks after the current animation sequence started
|
||||
Sint32 _pAnimStopDistributingAfterFrame; // Distribute the NumSkippedFrames only before this frame
|
||||
Sint32 _pAnimStopDistributingAfterFrame; // Distribute the NumSkippedFrames only before this frame
|
||||
Sint32 _plid;
|
||||
Sint32 _pvid;
|
||||
spell_id _pSpell;
|
||||
@@ -419,4 +430,4 @@ extern int DexterityTbl[enum_size<HeroClass>::value];
|
||||
extern int VitalityTbl[enum_size<HeroClass>::value];
|
||||
extern int ExpLvlsTbl[MAXCHARLEVEL];
|
||||
|
||||
}
|
||||
} // namespace devilution
|
||||
|
||||
@@ -7,6 +7,8 @@
|
||||
|
||||
namespace devilution {
|
||||
|
||||
#define PMSG_COUNT 8
|
||||
|
||||
static BYTE plr_msg_slot;
|
||||
_plrmsg plr_msgs[PMSG_COUNT];
|
||||
|
||||
|
||||
@@ -7,6 +7,8 @@
|
||||
|
||||
namespace devilution {
|
||||
|
||||
#define MAXPORTAL 4
|
||||
|
||||
struct PortalStruct {
|
||||
bool open;
|
||||
Sint32 x;
|
||||
|
||||
@@ -4,6 +4,7 @@
|
||||
* Implementation of functionality for handling quests.
|
||||
*/
|
||||
#include "all.h"
|
||||
#include "gendung.h"
|
||||
#include "options.h"
|
||||
|
||||
namespace devilution {
|
||||
|
||||
@@ -12,6 +12,8 @@
|
||||
|
||||
namespace devilution {
|
||||
|
||||
#define MAXQUESTS 24
|
||||
|
||||
/** States of the mushroom quest */
|
||||
enum {
|
||||
QS_INIT,
|
||||
|
||||
+3
-1
@@ -430,7 +430,9 @@ inline void DoRenderLine(BYTE *dst, BYTE *src, int n, BYTE *tbl, DWORD mask)
|
||||
}
|
||||
}
|
||||
|
||||
DVL_ATTRIBUTE_ALWAYS_INLINE
|
||||
#if DVL_HAVE_ATTRIBUTE(always_inline) || (defined(__GNUC__) && !defined(__clang__))
|
||||
__attribute__((always_inline))
|
||||
#endif
|
||||
inline void RenderLine(BYTE *dst_begin, BYTE *dst_end, BYTE **dst, BYTE **src, int n, BYTE *tbl, DWORD mask)
|
||||
{
|
||||
#ifdef NO_OVERDRAW
|
||||
|
||||
@@ -9,6 +9,14 @@
|
||||
|
||||
namespace devilution {
|
||||
|
||||
#define BUFFER_BORDER_LEFT 64
|
||||
#define BUFFER_BORDER_TOP 160
|
||||
#define BUFFER_BORDER_RIGHT devilution::borderRight
|
||||
#define BUFFER_BORDER_BOTTOM 16
|
||||
|
||||
#define TILE_WIDTH 64
|
||||
#define TILE_HEIGHT 32
|
||||
|
||||
/**
|
||||
* @brief Blit current world CEL to the given buffer
|
||||
* @param out Target buffer
|
||||
|
||||
@@ -9,6 +9,8 @@
|
||||
|
||||
namespace devilution {
|
||||
|
||||
#define PANELS_COVER (gnScreenWidth <= PANEL_WIDTH && gnScreenHeight <= SPANEL_HEIGHT + PANEL_HEIGHT)
|
||||
|
||||
enum _scroll_direction : uint8_t {
|
||||
SDIR_NONE,
|
||||
SDIR_N,
|
||||
|
||||
+2
-2
@@ -54,7 +54,7 @@ static void SHA1ProcessMessageBlock(SHA1Context *context)
|
||||
|
||||
DWORD *buf = (DWORD *)context->buffer;
|
||||
for (i = 0; i < 16; i++)
|
||||
W[i] = SwapLE32(buf[i]);
|
||||
W[i] = SDL_SwapLE32(buf[i]);
|
||||
|
||||
for (i = 16; i < 80; i++) {
|
||||
W[i] = W[i - 16] ^ W[i - 14] ^ W[i - 8] ^ W[i - 3];
|
||||
@@ -140,7 +140,7 @@ void SHA1Result(int n, char Message_Digest[SHA1HashSize])
|
||||
Message_Digest_Block = (DWORD *)Message_Digest;
|
||||
if (Message_Digest) {
|
||||
for (i = 0; i < 5; i++) {
|
||||
*Message_Digest_Block = SwapLE32(sgSHA1[n].state[i]);
|
||||
*Message_Digest_Block = SDL_SwapLE32(sgSHA1[n].state[i]);
|
||||
Message_Digest_Block++;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -9,6 +9,9 @@
|
||||
|
||||
namespace devilution {
|
||||
|
||||
#define VOLUME_MIN -1600
|
||||
#define VOLUME_MAX 0
|
||||
|
||||
enum _music_id : uint8_t {
|
||||
TMUSIC_TOWN,
|
||||
TMUSIC_L1,
|
||||
|
||||
@@ -11,6 +11,8 @@
|
||||
|
||||
namespace devilution {
|
||||
|
||||
#define MAX_SPELLS 52
|
||||
|
||||
enum spell_type : uint8_t {
|
||||
RSPLTYPE_SKILL,
|
||||
RSPLTYPE_SPELL,
|
||||
|
||||
@@ -9,6 +9,11 @@
|
||||
|
||||
namespace devilution {
|
||||
|
||||
#define WITCH_ITEMS 25
|
||||
#define SMITH_ITEMS 25
|
||||
#define SMITH_PREMIUM_ITEMS 15
|
||||
#define STORE_LINES 104
|
||||
|
||||
enum talk_id : uint8_t {
|
||||
STORE_NONE,
|
||||
STORE_SMITH,
|
||||
|
||||
@@ -7,8 +7,12 @@
|
||||
|
||||
#include <stdint.h>
|
||||
|
||||
#include "quests.h"
|
||||
|
||||
namespace devilution {
|
||||
|
||||
#define NUM_TOWNERS 16
|
||||
|
||||
enum _talker_id : uint8_t {
|
||||
TOWN_SMITH,
|
||||
TOWN_HEALER,
|
||||
|
||||
@@ -7,6 +7,8 @@
|
||||
|
||||
namespace devilution {
|
||||
|
||||
#define MAXTRIGGERS 7
|
||||
|
||||
struct TriggerStruct {
|
||||
int _tx;
|
||||
int _ty;
|
||||
|
||||
+1
-1
@@ -3,7 +3,7 @@
|
||||
#include <cstdarg>
|
||||
#include <cstddef>
|
||||
|
||||
#include "../defs.h"
|
||||
#include "miniwin/misc.h"
|
||||
|
||||
namespace devilution {
|
||||
|
||||
|
||||
@@ -1,7 +1,22 @@
|
||||
#pragma once
|
||||
|
||||
#include <stdint.h>
|
||||
|
||||
namespace devilution {
|
||||
|
||||
#ifdef __has_attribute
|
||||
#define DVL_HAVE_ATTRIBUTE(x) __has_attribute(x)
|
||||
#else
|
||||
#define DVL_HAVE_ATTRIBUTE(x) 0
|
||||
#endif
|
||||
|
||||
#if DVL_HAVE_ATTRIBUTE(format) || (defined(__GNUC__) && !defined(__clang__))
|
||||
#define DVL_PRINTF_ATTRIBUTE(fmtargnum, firstarg) \
|
||||
__attribute__((__format__(__printf__, fmtargnum, firstarg)))
|
||||
#else
|
||||
#define DVL_PRINTF_ATTRIBUTE(fmtargnum)
|
||||
#endif
|
||||
|
||||
typedef uint16_t SHORT;
|
||||
typedef int32_t LONG;
|
||||
|
||||
@@ -49,6 +64,11 @@ bool TranslateMessage(const MSG *lpMsg);
|
||||
void PushMessage(const MSG *lpMsg);
|
||||
bool PostMessage(UINT Msg, WPARAM wParam, LPARAM lParam);
|
||||
|
||||
#ifdef _MSC_VER
|
||||
#define strcasecmp _stricmp
|
||||
#define strncasecmp _strnicmp
|
||||
#endif
|
||||
|
||||
//
|
||||
// MSCVRT emulation
|
||||
//
|
||||
|
||||
@@ -10,7 +10,6 @@
|
||||
#include <cstddef>
|
||||
|
||||
#include "console.h"
|
||||
#include "../defs.h"
|
||||
#include "../SourceX/stubs.h"
|
||||
|
||||
#define WINDOW_ICON_NAME 0
|
||||
|
||||
@@ -2,7 +2,6 @@
|
||||
#include "display.h"
|
||||
#include "options.h"
|
||||
#include "touch.h"
|
||||
#include "../../defs.h"
|
||||
#include <math.h>
|
||||
|
||||
static int visible_width;
|
||||
|
||||
@@ -1,212 +0,0 @@
|
||||
/**
|
||||
* @file defs.h
|
||||
*
|
||||
* Global definitions and Macros.
|
||||
*/
|
||||
|
||||
#define DMAXX 40
|
||||
#define DMAXY 40
|
||||
|
||||
#define LIGHTSIZE 6912 // 27 * 256
|
||||
#define NO_LIGHT -1
|
||||
|
||||
#define GMENU_SLIDER 0x40000000
|
||||
#define GMENU_ENABLED 0x80000000
|
||||
|
||||
// must be unsigned to generate unsigned comparisons with pnum
|
||||
#define MAX_PLRS 4
|
||||
|
||||
#define MAX_CHARACTERS 99
|
||||
#define MAX_LVLS 24
|
||||
#define MAX_LVLMTYPES 24
|
||||
#define MAX_SPELLS 52
|
||||
#define MAX_SPELL_LEVEL 15
|
||||
|
||||
#define MAX_CHUNKS (MAX_LVLS + 5)
|
||||
|
||||
// #define MAX_PATH 260
|
||||
#define MAX_SEND_STR_LEN 80
|
||||
|
||||
#define MAXDEAD 31
|
||||
#define MAXDUNX 112
|
||||
#define MAXDUNY 112
|
||||
#define MAXITEMS 127
|
||||
#define MAXBELTITEMS 8
|
||||
#define MAXLIGHTS 32
|
||||
#define MAXMISSILES 125
|
||||
#define MAXMONSTERS 200
|
||||
#define MAXOBJECTS 127
|
||||
#define MAXPORTAL 4
|
||||
|
||||
#define MAXQUESTS 24
|
||||
#define MAXMULTIQUESTS 10
|
||||
|
||||
#define MAXTHEMES 50
|
||||
#define MAXTILES 2048
|
||||
|
||||
#define MAXTRIGGERS 7
|
||||
|
||||
#define MAXVISION 32
|
||||
#define MDMAXX 40
|
||||
#define MDMAXY 40
|
||||
#define MAXCHARLEVEL 51
|
||||
#define ITEMTYPES 43
|
||||
|
||||
// number of inventory grid cells
|
||||
#define NUM_INV_GRID_ELEM 40
|
||||
#define INV_SLOT_SIZE_PX 28
|
||||
|
||||
// Item indestructible durability
|
||||
#define DUR_INDESTRUCTIBLE 255
|
||||
|
||||
#define VOLUME_MIN -1600
|
||||
#define VOLUME_MAX 0
|
||||
|
||||
#define NUM_TOWNERS 16
|
||||
|
||||
// todo: enums
|
||||
#define NUMLEVELS 25
|
||||
#define WITCH_ITEMS 25
|
||||
#define SMITH_ITEMS 25
|
||||
#define SMITH_PREMIUM_ITEMS 15
|
||||
#define STORE_LINES 104
|
||||
|
||||
// from diablo 2 beta
|
||||
#define MAXEXP 2000000000
|
||||
#define MAXRESIST 75
|
||||
|
||||
#define GOLD_SMALL_LIMIT 1000
|
||||
#define GOLD_MEDIUM_LIMIT 2500
|
||||
#define GOLD_MAX_LIMIT 5000
|
||||
|
||||
#define PLR_NAME_LEN 32
|
||||
|
||||
#define MAXPATHNODES 300
|
||||
|
||||
#define MAX_PATH_LENGTH 25
|
||||
|
||||
// 256 kilobytes + 3 bytes (demo leftover) for file magic (262147)
|
||||
// final game uses 4-byte magic instead of 3
|
||||
#define FILEBUFF ((256 * 1024) + 3)
|
||||
|
||||
#define PMSG_COUNT 8
|
||||
|
||||
#define GAME_ID (gbIsHellfire ? (gbIsSpawn ? LOAD_BE32("HSHR") : LOAD_BE32("HRTL")) : (gbIsSpawn ? LOAD_BE32("DSHR") : LOAD_BE32("DRTL")))
|
||||
|
||||
// Diablo uses a 256 color palette
|
||||
// Entry 0-127 (0x00-0x7F) are level specific
|
||||
// Entry 128-255 (0x80-0xFF) are global
|
||||
|
||||
// standard palette for all levels
|
||||
// 8 or 16 shades per color
|
||||
// example (dark blue): PAL16_BLUE+14, PAL8_BLUE+7
|
||||
// example (light red): PAL16_RED+2, PAL8_RED
|
||||
// example (orange): PAL16_ORANGE+8, PAL8_ORANGE+4
|
||||
#define PAL8_BLUE 128
|
||||
#define PAL8_RED 136
|
||||
#define PAL8_YELLOW 144
|
||||
#define PAL8_ORANGE 152
|
||||
#define PAL16_BEIGE 160
|
||||
#define PAL16_BLUE 176
|
||||
#define PAL16_YELLOW 192
|
||||
#define PAL16_ORANGE 208
|
||||
#define PAL16_RED 224
|
||||
#define PAL16_GRAY 240
|
||||
|
||||
// If defined, use 32-bit colors instead of 8-bit [Default -> Undefined]
|
||||
//#define RGBMODE
|
||||
|
||||
#ifndef RGBMODE
|
||||
#define SCREEN_BPP 8
|
||||
#else
|
||||
#define SCREEN_BPP 32
|
||||
#endif
|
||||
|
||||
#define BUFFER_BORDER_LEFT 64
|
||||
#define BUFFER_BORDER_TOP 160
|
||||
#define BUFFER_BORDER_RIGHT devilution::borderRight
|
||||
#define BUFFER_BORDER_BOTTOM 16
|
||||
|
||||
#define UI_OFFSET_Y ((Sint16)((gnScreenHeight - 480) / 2))
|
||||
|
||||
#define TILE_WIDTH 64
|
||||
#define TILE_HEIGHT 32
|
||||
|
||||
#define PANEL_WIDTH 640
|
||||
#define PANEL_HEIGHT 128
|
||||
#define PANEL_TOP (gnScreenHeight - PANEL_HEIGHT)
|
||||
#define PANEL_LEFT (gnScreenWidth - PANEL_WIDTH) / 2
|
||||
#define PANEL_X PANEL_LEFT
|
||||
#define PANEL_Y PANEL_TOP
|
||||
|
||||
#define SPANEL_WIDTH 320
|
||||
#define SPANEL_HEIGHT 352
|
||||
#define PANELS_COVER (gnScreenWidth <= PANEL_WIDTH && gnScreenHeight <= SPANEL_HEIGHT + PANEL_HEIGHT)
|
||||
|
||||
#define RIGHT_PANEL (gnScreenWidth - SPANEL_WIDTH)
|
||||
#define RIGHT_PANEL_X RIGHT_PANEL
|
||||
|
||||
#define DIALOG_TOP ((gnScreenHeight - PANEL_HEIGHT) / 2 - 18)
|
||||
#define DIALOG_Y DIALOG_TOP
|
||||
|
||||
#define NIGHTMARE_TO_HIT_BONUS 85
|
||||
#define HELL_TO_HIT_BONUS 120
|
||||
|
||||
#define NIGHTMARE_AC_BONUS 50
|
||||
#define HELL_AC_BONUS 80
|
||||
|
||||
#define MemFreeDbg(p) \
|
||||
{ \
|
||||
void *p__p; \
|
||||
p__p = p; \
|
||||
p = NULL; \
|
||||
mem_free_dbg(p__p); \
|
||||
}
|
||||
|
||||
#undef assert
|
||||
|
||||
#ifndef _DEBUG
|
||||
#define assert(exp)
|
||||
#define assurance(exp, value) if (!(exp)) return
|
||||
#define commitment(exp, value) if (!(exp)) return false
|
||||
#else
|
||||
#define assert(exp) (void)((exp) || (assert_fail(__LINE__, __FILE__, #exp), 0))
|
||||
#define assurance(exp, value) (void)((exp) || (app_fatal("%s: %s was %i", __func__, #exp, value), 0))
|
||||
#define commitment(exp, value) (void)((exp) || (app_fatal("%s: %s was %i", __func__, #exp, value), 0))
|
||||
#endif
|
||||
|
||||
// To apply to certain functions which have local variables aligned by 1 for unknown yet reason
|
||||
#if (_MSC_VER == 1200)
|
||||
#define ALIGN_BY_1 __declspec(align(1))
|
||||
#else
|
||||
#define ALIGN_BY_1
|
||||
#endif
|
||||
|
||||
#define SwapLE32 SDL_SwapLE32
|
||||
#define SwapLE16 SDL_SwapLE16
|
||||
|
||||
#define ErrSdl() ErrDlg("SDL Error", SDL_GetError(), __FILE__, __LINE__)
|
||||
|
||||
#ifdef _MSC_VER
|
||||
#define strcasecmp _stricmp
|
||||
#define strncasecmp _strnicmp
|
||||
#endif
|
||||
|
||||
#ifdef __has_attribute
|
||||
#define DVL_HAVE_ATTRIBUTE(x) __has_attribute(x)
|
||||
#else
|
||||
#define DVL_HAVE_ATTRIBUTE(x) 0
|
||||
#endif
|
||||
|
||||
#if DVL_HAVE_ATTRIBUTE(always_inline) || (defined(__GNUC__) && !defined(__clang__))
|
||||
#define DVL_ATTRIBUTE_ALWAYS_INLINE __attribute__((always_inline))
|
||||
#else
|
||||
#define DVL_ATTRIBUTE_ALWAYS_INLINE
|
||||
#endif
|
||||
|
||||
#if DVL_HAVE_ATTRIBUTE(format) || (defined(__GNUC__) && !defined(__clang__))
|
||||
#define DVL_PRINTF_ATTRIBUTE(fmtargnum, firstarg) \
|
||||
__attribute__((__format__(__printf__, fmtargnum, firstarg)))
|
||||
#else
|
||||
#define DVL_PRINTF_ATTRIBUTE(fmtargnum)
|
||||
#endif
|
||||
Reference in New Issue
Block a user