Devilution
Diablo devolved - magic behind the 1996 computer game
|
Go to the documentation of this file.
22 const char WepChar[10] = {
'N',
'U',
'S',
'D',
'B',
'A',
'M',
'H',
'T', 0 };
32 int plrxoff[9] = { 0, 2, 0, 2, 1, 0, 1, 2, 1 };
33 int plryoff[9] = { 0, 2, 2, 0, 1, 1, 0, 1, 2 };
34 int plrxoff2[9] = { 0, 1, 0, 1, 2, 0, 1, 2, 2 };
35 int plryoff2[9] = { 0, 0, 1, 1, 0, 2, 2, 1, 2 };
37 { 10, 16, 8, 2, 20, 20, 6, 20, 8, 9, 14 },
38 { 8, 18, 8, 4, 20, 16, 7, 20, 8, 10, 12 },
39 { 8, 16, 8, 6, 20, 12, 8, 20, 8, 12, 8 },
123 BYTE
fix[9] = { 0, 0, 3, 3, 3, 6, 6, 6, 8 };
129 for (i = 0; i < 8; i++) {
145 app_fatal(
"LoadPlrGFX: illegal player %d", pnum);
153 if (!(i & gfxflag)) {
239 sprintf(pszName,
"PlrGFX\\%s\\%s\\%s%s.CL2", cs, prefix, prefix, szCel);
249 app_fatal(
"InitPlayerGFX: illegal player %d", pnum);
252 if (
plr[pnum]._pHitPoints >> 6 == 0) {
263 app_fatal(
"InitPlrGFXMem: illegal player %d", pnum);
335 DWORD dwSize, dwMaxSize;
352 for (w = &
WepChar[0]; *w; w++) {
353 if (szCel[0] ==
'D' && szCel[1] ==
'T' && *w !=
'N') {
356 if (szCel[0] ==
'B' && szCel[1] ==
'L' && (*w !=
'U' && *w !=
'D' && *w !=
'H')) {
359 sprintf(Type,
"%c%c%c",
CharChar[c], *a, *w);
360 sprintf(pszName,
"PlrGFX\\%s\\%s\\%s%s.CL2",
ClassStrTbl[c], Type, Type, szCel);
365 if (dwMaxSize <= dwSize) {
379 app_fatal(
"FreePlayerGFX: illegal player %d", pnum);
394 void NewPlrAnim(
int pnum, BYTE *Peq,
int numFrames,
int Delay,
int width)
397 app_fatal(
"NewPlrAnim: illegal player %d", pnum);
412 app_fatal(
"ClearPlrPVars: illegal player %d", pnum);
430 app_fatal(
"SetPlrAnims: illegal player %d", pnum);
540 app_fatal(
"CreatePlayer: illegal player %d", pnum);
640 for (i = 0; i <
sizeof(
plr[pnum].
_pSplLvl) /
sizeof(
plr[pnum]._pSplLvl[0]); i++) {
652 for (i = 0; i < 3; i++) {
670 for (i = 0; i < 10; i++) {
705 app_fatal(
"NextPlrLevel: illegal player %d", pnum);
758 int powerLvlCap, expCap, newLvl, i;
773 exp *= 1 + ((double)lvl -
plr[pnum]._pLevel) / 10;
781 if (powerLvlCap >= 50) {
789 expCap = 200 * powerLvlCap;
810 if (newLvl !=
plr[pnum]._pLevel) {
811 for (i = newLvl -
plr[pnum]._pLevel; i > 0; i--) {
825 if ((1 << i) & pmask) {
832 if (pmask & (1 <<
myplr))
842 app_fatal(
"InitPlayer: illegal player %d", pnum);
872 if (
plr[pnum]._pHitPoints >> 6 > 0) {
926 if (debug_mode_dollar_sign && FirstTime) {
932 if (debug_mode_key_inverted_v && FirstTime) {
974 app_fatal(
"PlrDirOK: illegal player %d", pnum);
989 if (isOk && dir ==
DIR_W) {
1000 for (i = y - 1; i <= y + 1; i++) {
1001 for (j = x - 1; j <= x + 1; j++) {
1014 for (i = y - 1; i <= y + 1; i++) {
1015 for (j = x - 1; j <= x + 1; j++) {
1027 app_fatal(
"SetPlayerOld: illegal player %d", pnum);
1037 app_fatal(
"FixPlayerLocation: illegal player %d", pnum);
1047 if (pnum ==
myplr) {
1059 app_fatal(
"StartStand: illegal player %d", pnum);
1062 if (!
plr[pnum]._pInvincible ||
plr[pnum]._pHitPoints || pnum !=
myplr) {
1081 app_fatal(
"StartWalkStand: illegal player %d", pnum);
1090 if (pnum ==
myplr) {
1108 app_fatal(
"PM_ChangeLightOff: illegal player %d", pnum);
1112 if(
plr[pnum]._plid == -1)
1131 x = (x >> 3) * xmul;
1132 y = (y >> 3) * ymul;
1133 lx = x + (l->
_lx << 3);
1134 ly = y + (l->
_ly << 3);
1138 if (abs(lx - offx) < 3 && abs(ly - offy) < 3)
1149 app_fatal(
"PM_ChangeOffset: illegal player %d", pnum);
1169 void StartWalk(
int pnum,
int xvel,
int yvel,
int xadd,
int yadd,
int EndDir,
int sdir)
1174 app_fatal(
"StartWalk: illegal player %d", pnum);
1177 if (
plr[pnum]._pInvincible && !
plr[pnum]._pHitPoints && pnum ==
myplr) {
1194 if (pnum ==
myplr) {
1199 dPlayer[px][py] = -(pnum + 1);
1220 if (pnum !=
myplr) {
1237 #if defined(__clang__) || defined(__GNUC__)
1238 __attribute__((no_sanitize(
"shift-base")))
1240 void StartWalk2(
int pnum,
int xvel,
int yvel,
int xoff,
int yoff,
int xadd,
int yadd,
int EndDir,
int sdir)
1245 app_fatal(
"StartWalk2: illegal player %d", pnum);
1248 if (
plr[pnum]._pInvincible && !
plr[pnum]._pHitPoints && pnum ==
myplr) {
1264 if (pnum ==
myplr) {
1296 if (pnum !=
myplr) {
1313 #if defined(__clang__) || defined(__GNUC__)
1314 __attribute__((no_sanitize(
"shift-base")))
1316 void StartWalk3(
int pnum,
int xvel,
int yvel,
int xoff,
int yoff,
int xadd,
int yadd,
int mapx,
int mapy,
int EndDir,
int sdir)
1321 app_fatal(
"StartWalk3: illegal player %d", pnum);
1324 if (
plr[pnum]._pInvincible && !
plr[pnum]._pHitPoints && pnum ==
myplr) {
1342 if (pnum ==
myplr) {
1377 if (pnum !=
myplr) {
1397 app_fatal(
"StartAttack: illegal player %d", pnum);
1400 if (
plr[pnum]._pInvincible && !
plr[pnum]._pHitPoints && pnum ==
myplr) {
1418 app_fatal(
"StartRangeAttack: illegal player %d", pnum);
1421 if (
plr[pnum]._pInvincible && !
plr[pnum]._pHitPoints && pnum ==
myplr) {
1441 app_fatal(
"StartPlrBlock: illegal player %d", pnum);
1444 if (
plr[pnum]._pInvincible && !
plr[pnum]._pHitPoints && pnum ==
myplr) {
1464 app_fatal(
"StartSpell: illegal player %d", pnum);
1466 if (
plr[pnum]._pInvincible && !
plr[pnum]._pHitPoints && pnum ==
myplr) {
1513 app_fatal(
"FixPlrWalkTags: illegal player %d", pnum);
1520 for (y = dy - 1; y <= dy + 1; y++) {
1521 for (x = dx - 1; x <= dx + 1; x++) {
1522 if (x >= 0 && x < MAXDUNX && y >= 0 && y <
MAXDUNY && (
dPlayer[x][y] == pp ||
dPlayer[x][y] == pn)) {
1528 if (dx >= 0 && dx < MAXDUNX - 1 && dy >= 0 && dy <
MAXDUNY - 1) {
1559 app_fatal(
"StartPlrHit: illegal player %d", pnum);
1562 if (
plr[pnum]._pInvincible && !
plr[pnum]._pHitPoints && pnum ==
myplr) {
1578 if (dam >> 6 >=
plr[pnum]._pLevel || forcehit) {
1604 DrawInvMsg(
"A duplicate item has been detected. Destroying duplicate...");
1609 dItem[x][y] = ii + 1;
1620 #if defined(__clang__) || defined(__GNUC__)
1621 __attribute__((no_sanitize(
"shift-base")))
1631 if (
plr[pnum]._pHitPoints <= 0 &&
plr[pnum]._pmode ==
PM_DEATH) {
1635 if (
myplr == pnum) {
1642 app_fatal(
"StartPlayerKill: illegal player %d", pnum);
1655 if (
plr[pnum]._pgfxnum) {
1674 if (pnum !=
myplr && !earflag && !diablolevel) {
1687 if (pnum ==
myplr) {
1698 if (earflag != -1) {
1745 app_fatal(
"PlrDeadItem: illegal player %d", pnum);
1757 for (k = 1; k < 50; k++) {
1758 for (j = -k; j <= k; j++) {
1760 for (i = -k; i <= k; i++) {
1778 app_fatal(
"DropHalfPlayersGold: illegal player %d", pnum);
1782 for (i = 0; i < MAXBELTITEMS && hGold > 0; i++) {
1784 if (hGold <
plr[pnum].SpdList[i]._ivalue) {
1806 for (i = 0; i < MAXBELTITEMS && hGold > 0; i++) {
1808 if (hGold <
plr[pnum].SpdList[i]._ivalue) {
1832 for (i = 0; i <
plr[pnum].
_pNumInv && hGold > 0; i++) {
1834 if (hGold <
plr[pnum].InvList[i]._ivalue) {
1857 for (i = 0; i <
plr[pnum].
_pNumInv && hGold > 0; i++) {
1859 if (hGold <
plr[pnum].InvList[i]._ivalue) {
1896 if (earflag != -1) {
1949 if (pnum ==
myplr) {
1959 if (pnum ==
myplr) {
1964 #if defined(__clang__) || defined(__GNUC__)
1965 __attribute__((no_sanitize(
"shift-base")))
1972 app_fatal(
"StartNewLvl: illegal player %d", pnum);
1998 if (pnum ==
myplr) {
2001 PostMessage(fom, 0, 0);
2011 app_fatal(
"RestartTownLvl: illegal player %d", pnum);
2024 if (pnum ==
myplr) {
2036 if (
plr[pnum].plrlevel != 0) {
2043 if (pnum ==
myplr) {
2061 app_fatal(
"PM_DoWalk: illegal player %d", pnum);
2064 if (
plr[pnum]._pAnimFrame == 3
2065 || (
plr[pnum]._pWFrames == 8 &&
plr[pnum]._pAnimFrame == 7)
2066 || (
plr[pnum]._pWFrames != 8 &&
plr[pnum]._pAnimFrame == 4)) {
2075 if (
plr[pnum]._pVar8 == anim_len) {
2115 app_fatal(
"PM_DoWalk2: illegal player %d", pnum);
2118 if (
plr[pnum]._pAnimFrame == 3
2119 || (
plr[pnum]._pWFrames == 8 &&
plr[pnum]._pAnimFrame == 7)
2120 || (
plr[pnum]._pWFrames != 8 &&
plr[pnum]._pAnimFrame == 4)) {
2129 if (
plr[pnum]._pVar8 == anim_len) {
2166 app_fatal(
"PM_DoWalk3: illegal player %d", pnum);
2169 if (
plr[pnum]._pAnimFrame == 3
2170 || (
plr[pnum]._pWFrames == 8 &&
plr[pnum]._pAnimFrame == 7)
2171 || (
plr[pnum]._pWFrames != 8 &&
plr[pnum]._pAnimFrame == 4)) {
2180 if (
plr[pnum]._pVar8 == anim_len) {
2218 if (pnum !=
myplr) {
2222 if (
random_(3, durrnd) != 0) {
2227 app_fatal(
"WeaponDur: illegal player %d", pnum);
2292 int hit, hper, mind, maxd, ddp, dam, skdam, phanditype, tmac;
2295 app_fatal(
"PlrHitMonst: illegal monster %d", m);
2298 if ((
monster[m]._mhitpoints >> 6) <= 0) {
2311 app_fatal(
"PlrHitMonst: illegal player %d", pnum);
2338 if (hit < hper || debug_mode_key_inverted_v || debug_mode_dollar_sign) {
2344 dam =
random_(5, maxd - mind + 1) + mind;
2362 switch (
monster[m].MData->mMonstClass) {
2386 if (pnum ==
myplr) {
2393 if (
plr[pnum]._pHitPoints >
plr[pnum]._pMaxHP) {
2397 if (
plr[pnum]._pHPBase >
plr[pnum]._pMaxHPBase) {
2404 skdam = 3 * dam / 100;
2407 skdam = 5 * dam / 100;
2410 if (
plr[pnum]._pMana >
plr[pnum]._pMaxMana) {
2414 if (
plr[pnum]._pManaBase >
plr[pnum]._pMaxManaBase) {
2421 skdam = 3 * dam / 100;
2424 skdam = 5 * dam / 100;
2427 if (
plr[pnum]._pHitPoints >
plr[pnum]._pMaxHP) {
2431 if (
plr[pnum]._pHPBase >
plr[pnum]._pMaxHPBase) {
2440 if (debug_mode_dollar_sign || debug_mode_key_inverted_v) {
2444 if ((
monster[m]._mhitpoints >> 6) <= 0) {
2471 int hit, hper, blk, blkper, dir, mind, maxd, dam, lvl, skdam, tac;
2474 app_fatal(
"PlrHitPlr: illegal target player %d", p);
2479 if (
plr[p]._pInvincible) {
2483 if (
plr[p]._pSpellFlags & 1) {
2488 app_fatal(
"PlrHitPlr: illegal attacking player %d", pnum);
2526 maxd =
random_(5,
plr[pnum]._pIMaxDam - mind + 1);
2540 if (
plr[pnum]._pHitPoints >
plr[pnum]._pMaxHP) {
2544 if (
plr[pnum]._pHPBase >
plr[pnum]._pMaxHPBase) {
2549 if (pnum ==
myplr) {
2571 if (
object[oi]._oBreak == 1) {
2581 int frame, dir, dx, dy, m;
2585 app_fatal(
"PM_DoAttack: illegal player %d", pnum);
2601 if (
plr[pnum]._pAnimFrame ==
plr[pnum]._pAFNum - 1) {
2605 if (
plr[pnum]._pAnimFrame ==
plr[pnum]._pAFNum) {
2646 }
else if (
dObject[dx][dy] > 0) {
2657 if (
plr[pnum]._pAnimFrame ==
plr[pnum]._pAFrames) {
2668 int origFrame, mistype;
2671 app_fatal(
"PM_DoRangeAttack: illegal player %d", pnum);
2682 if (
plr[pnum]._pAnimFrame ==
plr[pnum]._pAFNum) {
2711 if (
plr[pnum]._pAnimFrame >=
plr[pnum]._pAFrames) {
2722 if (pnum !=
myplr) {
2727 app_fatal(
"ShieldDur: illegal player %d", pnum);
2758 app_fatal(
"PM_DoBlock: illegal player %d", pnum);
2765 if (
plr[pnum]._pAnimFrame >=
plr[pnum]._pBFrames) {
2781 app_fatal(
"PM_DoSpell: illegal player %d", pnum);
2784 if (
plr[pnum]._pVar8 ==
plr[pnum]._pSFNum) {
2795 if (!
plr[pnum]._pSplFrom) {
2797 if (!(
plr[pnum]._pScrlSpells
2798 & (
unsigned __int64)1 << (
plr[pnum]._pRSpell - 1))) {
2806 if (!(
plr[pnum]._pISpells
2807 & (
unsigned __int64)1 << (
plr[pnum]._pRSpell - 1))) {
2819 if (
plr[pnum]._pVar8 >
plr[pnum]._pSFrames) {
2824 }
else if (
plr[pnum]._pAnimFrame ==
plr[pnum]._pSFrames) {
2838 app_fatal(
"PM_DoGotHit: illegal player %d", pnum);
2852 if (
plr[pnum]._pAnimFrame >=
plr[pnum]._pHFrames) {
2871 if (pnum !=
myplr) {
2876 app_fatal(
"ArmorDur: illegal player %d", pnum);
2918 app_fatal(
"PM_DoDeath: illegal player %d", pnum);
2921 if (
plr[pnum]._pVar8 >= 2 *
plr[pnum]._pDFrames) {
2937 if (
plr[pnum]._pVar8 < 100) {
2952 int xvel3, xvel, yvel;
2955 app_fatal(
"CheckNewPath: illegal player %d", pnum);
2968 if (pnum ==
myplr) {
2977 x = abs(
plr[pnum]._px -
plr[i]._px);
2978 y = abs(
plr[pnum]._py -
plr[i]._py);
2982 if (x < 2 && y < 2) {
3004 switch (
plr[pnum].walkpath[0]) {
3012 StartWalk3(pnum, xvel3, 0, -32, -16, 1, -1, 1, 0,
DIR_E,
SDIR_E);
3024 StartWalk3(pnum, -xvel3, 0, 32, -16, -1, 1, 0, 1,
DIR_W,
SDIR_W);
3050 switch (
plr[pnum].destAction) {
3057 x = abs(
plr[pnum].WorldX -
monster[i]._mfutx);
3058 y = abs(
plr[pnum].WorldY -
monster[i]._mfuty);
3059 if (x <= 1 && y <= 1) {
3070 x = abs(
plr[pnum].WorldX -
plr[i]._px);
3071 y = abs(
plr[pnum].WorldY -
plr[i]._py);
3072 if (x <= 1 && y <= 1) {
3119 x = abs(
plr[pnum].WorldX -
object[i]._ox);
3120 y = abs(
plr[pnum].WorldY -
object[i]._oy);
3121 if (y > 1 &&
dObject[
object[i]._ox][
object[i]._oy - 1] == -1 - i) {
3122 y = abs(
plr[pnum].WorldY -
object[i]._oy + 1);
3124 if (x <= 1 && y <= 1) {
3125 if (
object[i]._oBreak == 1) {
3135 x = abs(
plr[pnum].WorldX -
object[i]._ox);
3136 y = abs(
plr[pnum].WorldY -
object[i]._oy);
3137 if (y > 1 &&
dObject[
object[i]._ox][
object[i]._oy - 1] == -1 - i) {
3138 y = abs(
plr[pnum].WorldY -
object[i]._oy + 1);
3140 if (x <= 1 && y <= 1) {
3141 if (
object[i]._oBreak == 1) {
3152 if (
object[i]._oBreak != 1) {
3157 if (pnum ==
myplr) {
3159 x = abs(
plr[pnum].WorldX -
item[i]._ix);
3160 y = abs(
plr[pnum].WorldY -
item[i]._iy);
3168 if (pnum ==
myplr) {
3170 x = abs(
plr[pnum].WorldX -
item[i]._ix);
3171 y = abs(
plr[pnum].WorldY -
item[i]._iy);
3178 if (pnum ==
myplr) {
3197 x = abs(
plr[pnum].WorldX -
monster[i]._mfutx);
3198 y = abs(
plr[pnum].WorldY -
monster[i]._mfuty);
3199 if (x <= 1 && y <= 1) {
3206 x = abs(
plr[pnum].WorldX -
plr[i]._px);
3207 y = abs(
plr[pnum].WorldY -
plr[i]._py);
3208 if (x <= 1 && y <= 1) {
3215 x = abs(
plr[pnum].WorldX -
object[i]._ox);
3216 y = abs(
plr[pnum].WorldY -
object[i]._oy);
3217 if (y > 1 &&
dObject[
object[i]._ox][
object[i]._oy - 1] == -1 - i) {
3218 y = abs(
plr[pnum].WorldY -
object[i]._oy + 1);
3220 if (x <= 1 && y <= 1) {
3221 if (
object[i]._oBreak == 1) {
3249 if (
plr[pnum]._pmode ==
PM_SPELL &&
plr[pnum]._pAnimFrame >
plr[pnum]._pSFNum) {
3275 app_fatal(
"PlrDeathModeOK: illegal player %d", p);
3332 msk |= (__int64)1 << (b - 1);
3363 for (pnum = 0; pnum <
MAX_PLRS; pnum++) {
3371 if (pnum ==
myplr) {
3375 if ((
plr[pnum]._pHitPoints >> 6) <= 0) {
3389 switch (
plr[pnum]._pmode) {
3428 if (
plr[pnum]._pAnimCnt >
plr[pnum]._pAnimDelay) {
3431 if (
plr[pnum]._pAnimFrame >
plr[pnum]._pAnimLen) {
3441 if (
plr[pnum]._pStrength > 750) {
3445 if (
plr[pnum]._pDexterity > 750) {
3449 if (
plr[pnum]._pMagic > 750) {
3453 if (
plr[pnum]._pVitality > 750) {
3457 if (
plr[pnum]._pHitPoints > 128000) {
3461 if (
plr[pnum]._pMana > 128000) {
3469 app_fatal(
"ClrPlrPath: illegal player %d", pnum);
3490 if (p != pnum && p <
MAX_PLRS &&
plr[p]._pHitPoints) {
3513 if (
object[bv]._oSolidFlag) {
3531 app_fatal(
"MakePlrPath: illegal player %d", pnum);
3536 if (
plr[pnum]._px == xx &&
plr[pnum]._py == yy) {
3548 switch (
plr[pnum].walkpath[path]) {
3686 app_fatal(
"SyncPlrAnim: illegal player %d", pnum);
3690 switch (
plr[pnum]._pmode) {
3740 int x, y, xx, yy, range;
3751 for (i = 0; i < 8; i++) {
3761 for (range = 1; range < 50 && !posOk; range++) {
3762 for (yy = -range; yy <= range && !posOk; yy++) {
3764 for (xx = -range; xx <= range && !posOk; xx++) {
3778 if (pnum ==
myplr) {
3791 app_fatal(
"SyncInitPlr: illegal player %d", pnum);
3803 app_fatal(
"CheckStats: illegal player %d", p);
3814 for (i = 0; i < 4; i++) {
3819 }
else if (
plr[p]._pBaseStr < 0) {
3826 }
else if (
plr[p]._pBaseMag < 0) {
3833 }
else if (
plr[p]._pBaseDex < 0) {
3840 }
else if (
plr[p]._pBaseVit < 0) {
3853 app_fatal(
"ModifyPlrStr: illegal player %d", p);
3857 if (
plr[p]._pBaseStr + l > max) {
3882 app_fatal(
"ModifyPlrMag: illegal player %d", p);
3886 if (
plr[p]._pBaseMag + l > max) {
3917 app_fatal(
"ModifyPlrDex: illegal player %d", p);
3921 if (
plr[p]._pBaseDex + l > max) {
3943 app_fatal(
"ModifyPlrVit: illegal player %d", p);
3947 if (
plr[p]._pBaseVit + l > max) {
3974 app_fatal(
"SetPlayerHitPoints: illegal player %d", pnum);
3980 if (pnum ==
myplr) {
3990 app_fatal(
"SetPlrStr: illegal player %d", p);
4010 app_fatal(
"SetPlrMag: illegal player %d", p);
4030 app_fatal(
"SetPlrDex: illegal player %d", p);
4050 app_fatal(
"SetPlrVit: illegal player %d", p);
4068 app_fatal(
"InitDungMsgs: illegal player %d", pnum);
unsigned char mArmorClass
int AddLight(int x, int y, int r)
void OperateObject(int pnum, int i, BOOL TeleFlag)
void AddDead(int dx, int dy, char dv, int ddir)
void CreatePlrItems(int p)
BOOL PosOkPlayer(int pnum, int x, int y)
void InitPlrGFXMem(int pnum)
void StartPlrHit(int pnum, int dam, BOOL forcehit)
BOOL PM_DoWalk3(int pnum)
void SetPlayerHitPoints(int pnum, int val)
void SetPlrDex(int p, int v)
void CheckCheatStats(int pnum)
void SetGoldCurs(int pnum, int i)
void SetRndSeed(int s)
Set the RNG seed.
void M_GetKnockback(int i)
void StartWalk2(int pnum, int xvel, int yvel, int xoff, int yoff, int xadd, int yadd, int EndDir, int sdir)
BYTE * CelGetFrameStart(BYTE *pCelBuff, int nCel)
void ChangeLightOff(int i, int x, int y)
void FreePlayerGFX(int pnum)
void BreakObject(int pnum, int oi)
void NetSendCmdDelItem(BOOL bHiPri, BYTE bLoc)
void InitLevelChange(int pnum)
void FixPlrWalkTags(int pnum)
void MakePlrPath(int pnum, int xx, int yy, BOOL endspace)
ItemStruct item[MAXITEMS+1]
DWORD GetPlrGFXSize(char *szCel)
int GetDirection(int x1, int y1, int x2, int y2)
Calculate the best fit direction between two points.
void NetSendCmdLocParam2(BOOL bHiPri, BYTE bCmd, BYTE x, BYTE y, WORD wParam1, WORD wParam2)
void FixPlayerLocation(int pnum, int bDir)
DEVILUTION_BEGIN_NAMESPACE int itemactive[MAXITEMS]
#define DUR_INDESTRUCTIBLE
BOOL PM_DoNewLvl(int pnum)
unsigned char * _pAAnim[8]
MissileStruct missile[MAXMISSILES]
DEVILUTION_BEGIN_NAMESPACE PortalStruct portal[MAXPORTAL]
In-game state of portals.
LightListStruct LightList[MAXLIGHTS]
BOOL CanTalkToMonst(int m)
ItemStruct InvList[NUM_INV_GRID_ELEM]
void ChangeLightXY(int i, int x, int y)
int ExpLvlsTbl[MAXCHARLEVEL]
LONG WGetFileSize(HANDLE hsFile, DWORD *lpFileSizeHigh, const char *FileName)
void ClrPlrPath(int pnum)
BOOL PM_DoDeath(int pnum)
void InitDungMsgs(int pnum)
void NetSendCmdGItem(BOOL bHiPri, BYTE bCmd, BYTE mast, BYTE pnum, BYTE ii)
void CalcPlrInv(int p, BOOL Loadgfx)
void SyncPlrKill(int pnum, int earflag)
unsigned char * _pWAnim[8]
unsigned char * _pHAnim[8]
int CalcStatDiff(int pnum)
void NetSendCmdDamage(BOOL bHiPri, BYTE bPlr, DWORD dwDam)
void SetSpdbarGoldCurs(int pnum, int i)
ItemStruct SpdList[MAXBELTITEMS]
void GetGoldSeed(int pnum, ItemStruct *h)
char dObject[MAXDUNX][MAXDUNY]
BOOL PM_DoAttack(int pnum)
void StartSpell(int pnum, int d, int cx, int cy)
void RespawnItem(int i, BOOL FlipFlag)
char walkpath[MAX_PATH_LENGTH]
void ModifyPlrDex(int p, int l)
BOOL SolidLoc(int x, int y)
void ClearMissileSpot(int mi)
void StartWalkStand(int pnum)
BOOL WeaponDur(int pnum, int durrnd)
DEVILUTION_BEGIN_NAMESPACE SpellData spelldata[]
Data related to each spell ID.
DWORD LoadFileWithMem(const char *pszName, void *p)
Load a file in to the given buffer.
BYTE gbMaxPlayers
Specifies the maximum number of players in a game, where 1 represents a single player game and 4 repr...
BOOL WOpenFile(const char *FileName, HANDLE *phsFile, BOOL mayNotExist)
unsigned char * _pBAnim[8]
BOOLEAN _pLvlVisited[NUMLEVELS]
void SetPlayerOld(int pnum)
int AddMissile(int sx, int sy, int dx, int dy, int midir, int mitype, char micaster, int id, int midam, int spllvl)
void NewPlrAnim(int pnum, BYTE *Peq, int numFrames, int Delay, int width)
void RemovePlrFromMap(int pnum)
void TalkToTowner(int p, int t)
void M_StartKill(int i, int pnum)
void ChangeVisionXY(int id, int x, int y)
BOOL PM_DoBlock(int pnum)
void SyncGetItem(int x, int y, int idx, WORD ci, int iseed)
int dPiece[MAXDUNX][MAXDUNY]
BOOL CheckMonsterHit(int m, BOOL *ret)
BOOL ItemSpaceOk(int i, int j)
BOOLEAN nSolidTable[2049]
List of path blocking dPieces.
void NetSendCmdParam1(BOOL bHiPri, BYTE bCmd, WORD wParam1)
void ModifyPlrMag(int p, int l)
void AddPlrMonstExper(int lvl, int exp, char pmask)
void SyncInitPlr(int pnum)
void PlrDoTrans(int x, int y)
void app_fatal(const char *pszFmt,...)
void SetPlrAnims(int pnum)
#define DEVILUTION_END_NAMESPACE
BOOL PlrHitMonst(int pnum, int m)
void SyncPlrAnim(int pnum)
BOOL FriendlyMode
Specifies whether players are in non-PvP mode.
void RestartTownLvl(int pnum)
void PM_ChangeLightOff(int pnum)
unsigned char * _pAnimData
MonsterStruct monster[MAXMONSTERS]
void SetPlrHandItem(ItemStruct *h, int idata)
int FindGetItem(int idx, WORD ci, int iseed)
void StartRangeAttack(int pnum, int d, int cx, int cy)
void StartStand(int pnum, int dir)
void DropHalfPlayersGold(int pnum)
void RemoveInvItem(int pnum, int iv)
BOOL PM_DoGotHit(int pnum)
void ModifyPlrStr(int p, int l)
int CalculateGold(int pnum)
void NextPlrLevel(int pnum)
char dItem[MAXDUNX][MAXDUNY]
void SetPlrMag(int p, int v)
void DeleteMissile(int mi, int i)
void StartWalk(int pnum, int xvel, int yvel, int xadd, int yadd, int EndDir, int sdir)
unsigned char * _pTAnim[8]
void TalktoMonster(int i)
void RespawnDeadItem(ItemStruct *itm, int x, int y)
void StartPlayerKill(int pnum, int earflag)
BOOL PM_DoStand(int pnum)
DEVILUTION_BEGIN_NAMESPACE int missileactive[MAXMISSILES]
BOOLEAN _pSLvlVisited[NUMLEVELS]
DEVILUTION_BEGIN_NAMESPACE int sfxdelay
int AddVision(int x, int y, int r, BOOL mine)
int GetSpellLevel(int id, int sn)
BOOL PM_DoRangeAttack(int pnum)
BOOL CheckSpell(int id, int sn, char st, BOOL manaonly)
void StartPlrBlock(int pnum, int dir)
DEVILUTION_BEGIN_NAMESPACE BOOL WCloseFile(HANDLE file)
void NetSendCmdParam3(BOOL bHiPri, BYTE bCmd, WORD wParam1, WORD wParam2, WORD wParam3)
void SetPlrStr(int p, int v)
void PlrClrTrans(int x, int y)
BOOL PlrHitPlr(int pnum, char p)
BOOL PM_DoWalk2(int pnum)
void SyncInitPlrPos(int pnum)
void PlrDeadItem(int pnum, ItemStruct *itm, int xx, int yy)
DEVILUTION_BEGIN_NAMESPACE BOOL invflag
int FindPath(BOOL(*PosOk)(int, int, int), int PosOkArg, int sx, int sy, int dx, int dy, char *path)
find the shortest path from (sx,sy) to (dx,dy), using PosOk(PosOkArg,x,y) to check that each step is ...
unsigned char * _pDAnim[8]
void RemovePlrMissiles(int pnum)
BYTE * DiabloAllocPtr(DWORD dwBytes)
Multithreaded safe malloc.
ItemStruct InvBody[NUM_INVLOC]
char dTransVal[MAXDUNX][MAXDUNY]
int AnimLenFromClass[3]
Total number of frames in walk animation.
void ClearPlrRVars(PlayerStruct *p)
BOOL PlrDeathModeOK(int p)
void M_StartHit(int i, int pnum, int dam)
void ClearPlrPVars(int pnum)
void CreatePlayer(int pnum, char c)
int random_(BYTE idx, int v)
Main RNG function.
char PlrGFXAnimLens[][11]
unsigned char * _pFAnim[8]
void StartNewLvl(int pnum, int fom, int lvl)
int dMonster[MAXDUNX][MAXDUNY]
void NetSendCmdLocParam3(BOOL bHiPri, BYTE bCmd, BYTE x, BYTE y, WORD wParam1, WORD wParam2, WORD wParam3)
void PlaySfxLoc(int psfx, int x, int y)
void NetSendCmdParam2(BOOL bHiPri, BYTE bCmd, WORD wParam1, WORD wParam2)
void CastSpell(int id, int spl, int sx, int sy, int dx, int dy, int caster, int spllvl)
void TryDisarm(int pnum, int i)
BOOL PlrHitObj(int pnum, int mx, int my)
void DrawInvMsg(char *msg)
unsigned char * _pNAnim[8]
DEVILUTION_BEGIN_NAMESPACE int plr_lframe_size
char dPlayer[MAXDUNX][MAXDUNY]
char dFlags[MAXDUNX][MAXDUNY]
BOOL PM_DoSpell(int pnum)
void AddPlrExperience(int pnum, int lvl, int exp)
BOOL PosOkPortal(int lvl, int x, int y)
BOOL PlrDirOK(int pnum, int dir)
char _pName[PLR_NAME_LEN]
void SetPlayerGPtrs(BYTE *pData, BYTE **pAnim)
void CheckNewPath(int pnum)
void InitPlayerGFX(int pnum)
void StartWalk3(int pnum, int xvel, int yvel, int xoff, int yoff, int xadd, int yadd, int mapx, int mapy, int EndDir, int sdir)
void SetCurrentPortal(int p)
void PM_ChangeOffset(int pnum)
void SetPlrVit(int p, int v)
PlayerStruct plr[MAX_PLRS]
void RemoveSpdBarItem(int pnum, int iv)
void LoadPlrGFX(int pnum, player_graphic gfxflag)
void ModifyPlrVit(int p, int l)
void SetPlrHandGoldCurs(ItemStruct *h)
void StartAttack(int pnum, int d)
unsigned char * _pLAnim[8]
void InitPlayer(int pnum, BOOL FirstTime)
void NetSendCmdPItem(BOOL bHiPri, BYTE bCmd, BYTE x, BYTE y)
void StartWarpLvl(int pnum, int pidx)