Browse Source

merge devilution

pull/136/head
Anders Jenbo 7 years ago
parent
commit
4ff5197291
  1. 12
      Source/dx.cpp
  2. 2
      Source/gendung.cpp
  3. 10
      Source/gmenu.cpp
  4. 22
      Source/loadsave.cpp
  5. 2
      Source/multi.cpp
  6. 4
      Source/objects.cpp
  7. 49
      Source/player.cpp
  8. 2
      Source/portal.cpp
  9. 8
      Source/quests.cpp
  10. 4
      Source/themes.cpp

12
Source/dx.cpp

@ -34,9 +34,9 @@ void dx_init(HWND hWnd)
SetFocus(hWnd);
ShowWindow(hWnd, SW_SHOWNORMAL);
lpGUID = (GUID *)DDCREATE_EMULATIONONLY;
if(!gbEmulate) {
lpGUID = NULL;
lpGUID = NULL;
if(gbEmulate) {
lpGUID = (GUID *)DDCREATE_EMULATIONONLY;
}
hDDVal = dx_DirectDrawCreate(lpGUID, &lpDDInterface, NULL);
if(hDDVal != DD_OK) {
@ -90,9 +90,9 @@ void dx_init(HWND hWnd)
#else
hDDVal = lpDDInterface->lpVtbl->SetDisplayMode(lpDDInterface, winw, winh, SCREEN_BPP);
#endif
if(hDDVal != DD_OK) {
ErrDlg(IDD_DIALOG1, hDDVal, "C:\\Src\\Diablo\\Source\\dx.cpp", 183);
}
}
if(hDDVal != DD_OK) {
ErrDlg(IDD_DIALOG1, hDDVal, "C:\\Src\\Diablo\\Source\\dx.cpp", 183);
}
}

2
Source/gendung.cpp

@ -967,7 +967,7 @@ void InitLevels()
{
if (!leveldebug) {
currlevel = 0;
leveltype = 0;
leveltype = DTYPE_TOWN;
setlevel = 0;
}
}

10
Source/gmenu.cpp

@ -175,18 +175,18 @@ void gmenu_draw()
void gmenu_draw_menu_item(TMenuItem *pItem, int y)
{
DWORD x, w, nSteps, step, pos;
DWORD x, w, nSteps, step, pos, t;
t = y - 2;
w = gmenu_get_lfont(pItem);
if (pItem->dwFlags & GMENU_SLIDER) {
x = 16 + w / 2 + SCREEN_X;
CelDecodeOnly(x, y - 10, optbar_cel, 1, 287);
CelDecodeOnly(x, t - 8, optbar_cel, 1, 287);
step = pItem->dwFlags & 0xFFF;
nSteps = (pItem->dwFlags & 0xFFF000) >> 12;
if (nSteps < 2)
nSteps = 2;
step = pItem->dwFlags & 0xFFF;
pos = step * 256 / nSteps;
gmenu_clear_buffer(x + 2, y - 12, pos + 13, 28);
gmenu_clear_buffer(x + 2, t - 10, pos + 13, 28);
CelDecodeOnly(x + 2 + pos, y - 12, option_cel, 1, 27);
}
x = SCREEN_WIDTH / 2 - w / 2 + SCREEN_X;

22
Source/loadsave.cpp

@ -60,7 +60,7 @@ void LoadGame(BOOL firstflag)
for (i = 0; i < MAXMONSTERS; i++)
monstkills[i] = ILoad();
if (leveltype) {
if (leveltype != DTYPE_TOWN) {
for (i = 0; i < MAXMONSTERS; i++)
monstactive[i] = WLoad();
for (i = 0; i < nummonsters; i++)
@ -120,7 +120,7 @@ void LoadGame(BOOL firstflag)
dItem[i][j] = BLoad();
}
if (leveltype) {
if (leveltype != DTYPE_TOWN) {
for (j = 0; j < MAXDUNY; j++) {
for (i = 0; i < MAXDUNX; i++)
dMonster[i][j] = WLoad();
@ -163,7 +163,7 @@ void LoadGame(BOOL firstflag)
AutomapZoomReset();
ResyncQuests();
if (leveltype)
if (leveltype != DTYPE_TOWN)
ProcessLightList();
RedoPlayerVision();
@ -311,7 +311,7 @@ void SaveGame()
for (i = 0; i < MAXMONSTERS; i++)
ISave(monstkills[i]);
if (leveltype) {
if (leveltype != DTYPE_TOWN) {
for (i = 0; i < MAXMONSTERS; i++)
WSave(monstactive[i]);
for (i = 0; i < nummonsters; i++)
@ -369,7 +369,7 @@ void SaveGame()
BSave(dItem[i][j]);
}
if (leveltype) {
if (leveltype != DTYPE_TOWN) {
for (j = 0; j < MAXDUNY; j++) {
for (i = 0; i < MAXDUNX; i++)
WSave(dMonster[i][j]);
@ -525,7 +525,7 @@ void SaveLevel()
SaveBuff = DiabloAllocPtr(dwLen);
tbuff = SaveBuff;
if (leveltype) {
if (leveltype != DTYPE_TOWN) {
for (j = 0; j < MAXDUNY; j++) {
for (i = 0; i < MAXDUNX; i++)
BSave(dDead[i][j]);
@ -536,7 +536,7 @@ void SaveLevel()
WSave(numitems);
WSave(nobjects);
if (leveltype) {
if (leveltype != DTYPE_TOWN) {
for (i = 0; i < MAXMONSTERS; i++)
WSave(monstactive[i]);
for (i = 0; i < nummonsters; i++)
@ -565,7 +565,7 @@ void SaveLevel()
BSave(dItem[i][j]);
}
if (leveltype) {
if (leveltype != DTYPE_TOWN) {
for (j = 0; j < MAXDUNY; j++) {
for (i = 0; i < MAXDUNX; i++)
WSave(dMonster[i][j]);
@ -614,7 +614,7 @@ void LoadLevel()
LoadBuff = pfile_read(szName, &dwLen);
tbuff = LoadBuff;
if (leveltype) {
if (leveltype != DTYPE_TOWN) {
for (j = 0; j < MAXDUNY; j++) {
for (i = 0; i < MAXDUNX; i++)
dDead[i][j] = BLoad();
@ -626,7 +626,7 @@ void LoadLevel()
numitems = WLoad();
nobjects = WLoad();
if (leveltype) {
if (leveltype != DTYPE_TOWN) {
for (i = 0; i < MAXMONSTERS; i++)
monstactive[i] = WLoad();
for (i = 0; i < nummonsters; i++)
@ -657,7 +657,7 @@ void LoadLevel()
dItem[i][j] = BLoad();
}
if (leveltype) {
if (leveltype != DTYPE_TOWN) {
for (j = 0; j < MAXDUNY; j++) {
for (i = 0; i < MAXDUNX; i++)
dMonster[i][j] = WLoad();

2
Source/multi.cpp

@ -780,7 +780,7 @@ void SetupLocalCoords()
if (!leveldebug || gbMaxPlayers > 1) {
currlevel = 0;
leveltype = 0;
leveltype = DTYPE_TOWN;
setlevel = 0;
}
x = 75;

4
Source/objects.cpp

@ -136,7 +136,7 @@ BOOL RndLocOk(int xp, int yp)
return FALSE;
if (nSolidTable[dPiece[xp][yp]])
return FALSE;
if (leveltype != 1 || dPiece[xp][yp] <= 126 || dPiece[xp][yp] >= 144)
if (leveltype != DTYPE_CATHEDRAL || dPiece[xp][yp] <= 126 || dPiece[xp][yp] >= 144)
return TRUE;
return FALSE;
}
@ -831,7 +831,7 @@ void InitObjects()
InitRndLocObj(5, 10, 5);
InitRndLocObj(3, 6, 6);
InitRndLocObj(1, 5, 7);
if (leveltype != 4)
if (leveltype != DTYPE_HELL)
AddObjTraps();
if (leveltype > 1u)
AddChestTraps();

49
Source/player.cpp

@ -2305,7 +2305,7 @@ BOOL WeaponDur(int pnum, int durrnd)
BOOL PlrHitMonst(int pnum, int m)
{
BOOL rv, ret;
int hit, hper, mind, maxd, dam, lvl, phanditype, mClass, skdam, tac;
int hit, hper, mind, maxd, ddp, dam, skdam, phanditype, tmac;
if ((DWORD)m >= MAXMONSTERS) {
app_fatal("PlrHitMonst: illegal monster %d", m);
@ -2334,7 +2334,8 @@ BOOL PlrHitMonst(int pnum, int m)
hit = 0;
}
hper = (plr[pnum]._pDexterity >> 1) + plr[pnum]._pLevel + 50 - (monster[m].mArmorClass - plr[pnum]._pIEnAc);
tmac = monster[m].mArmorClass - plr[pnum]._pIEnAc;
hper = (plr[pnum]._pDexterity >> 1) + plr[pnum]._pLevel + 50 - tmac;
if (plr[pnum]._pClass == PC_WARRIOR) {
hper += 20;
}
@ -2355,12 +2356,13 @@ BOOL PlrHitMonst(int pnum, int m)
if (hit < hper) {
#endif
mind = plr[pnum]._pIMinDam;
maxd = random(5, plr[pnum]._pIMaxDam - mind + 1);
dam = maxd + mind;
dam += plr[pnum]._pDamageMod + plr[pnum]._pIBonusDamMod + dam * plr[pnum]._pIBonusDam / 100;
maxd = plr[pnum]._pIMaxDam;
dam = random(5, maxd - mind + 1) + mind;
dam += dam * plr[pnum]._pIBonusDam / 100;
dam += plr[pnum]._pDamageMod + plr[pnum]._pIBonusDamMod;
if (plr[pnum]._pClass == PC_WARRIOR) {
lvl = plr[pnum]._pLevel;
if (random(6, 100) < lvl) {
ddp = plr[pnum]._pLevel;
if (random(6, 100) < ddp) {
dam *= 2;
}
}
@ -2373,8 +2375,7 @@ BOOL PlrHitMonst(int pnum, int m)
phanditype = ITYPE_MACE;
}
mClass = monster[m].MData->mMonstClass;
switch (mClass) {
switch (monster[m].MData->mMonstClass) {
case MC_UNDEAD:
if (phanditype == ITYPE_SWORD) {
dam -= dam >> 1;
@ -2397,18 +2398,18 @@ BOOL PlrHitMonst(int pnum, int m)
dam *= 3;
}
skdam = dam << 6;
dam <<= 6;
if (pnum == myplr) {
monster[m]._mhitpoints -= skdam;
monster[m]._mhitpoints -= dam;
}
if (plr[pnum]._pIFlags & ISPL_RNDSTEALLIFE) {
tac = random(7, skdam >> 3);
plr[pnum]._pHitPoints += tac;
skdam = random(7, dam >> 3);
plr[pnum]._pHitPoints += skdam;
if (plr[pnum]._pHitPoints > plr[pnum]._pMaxHP) {
plr[pnum]._pHitPoints = plr[pnum]._pMaxHP;
}
plr[pnum]._pHPBase += tac;
plr[pnum]._pHPBase += skdam;
if (plr[pnum]._pHPBase > plr[pnum]._pMaxHPBase) {
plr[pnum]._pHPBase = plr[pnum]._pMaxHPBase;
}
@ -2416,16 +2417,16 @@ BOOL PlrHitMonst(int pnum, int m)
}
if (plr[pnum]._pIFlags & (ISPL_STEALMANA_3 | ISPL_STEALMANA_5) && !(plr[pnum]._pIFlags & ISPL_NOMANA)) {
if (plr[pnum]._pIFlags & ISPL_STEALMANA_3) {
tac = 3 * skdam / 100;
skdam = 3 * dam / 100;
}
if (plr[pnum]._pIFlags & ISPL_STEALMANA_5) {
tac = 5 * skdam / 100;
skdam = 5 * dam / 100;
}
plr[pnum]._pMana += tac;
plr[pnum]._pMana += skdam;
if (plr[pnum]._pMana > plr[pnum]._pMaxMana) {
plr[pnum]._pMana = plr[pnum]._pMaxMana;
}
plr[pnum]._pManaBase += tac;
plr[pnum]._pManaBase += skdam;
if (plr[pnum]._pManaBase > plr[pnum]._pMaxManaBase) {
plr[pnum]._pManaBase = plr[pnum]._pMaxManaBase;
}
@ -2433,16 +2434,16 @@ BOOL PlrHitMonst(int pnum, int m)
}
if (plr[pnum]._pIFlags & (ISPL_STEALLIFE_3 | ISPL_STEALLIFE_5)) {
if (plr[pnum]._pIFlags & ISPL_STEALLIFE_3) {
tac = 3 * skdam / 100;
skdam = 3 * dam / 100;
}
if (plr[pnum]._pIFlags & ISPL_STEALLIFE_5) {
tac = 5 * skdam / 100;
skdam = 5 * dam / 100;
}
plr[pnum]._pHitPoints += tac;
plr[pnum]._pHitPoints += skdam;
if (plr[pnum]._pHitPoints > plr[pnum]._pMaxHP) {
plr[pnum]._pHitPoints = plr[pnum]._pMaxHP;
}
plr[pnum]._pHPBase += tac;
plr[pnum]._pHPBase += skdam;
if (plr[pnum]._pHPBase > plr[pnum]._pMaxHPBase) {
plr[pnum]._pHPBase = plr[pnum]._pMaxHPBase;
}
@ -2465,13 +2466,13 @@ BOOL PlrHitMonst(int pnum, int m)
}
} else {
if (monster[m]._mmode == MM_STONE) {
M_StartHit(m, pnum, skdam);
M_StartHit(m, pnum, dam);
monster[m]._mmode = MM_STONE;
} else {
if (plr[pnum]._pIFlags & ISPL_KNOCKBACK) {
M_GetKnockback(m);
}
M_StartHit(m, pnum, skdam);
M_StartHit(m, pnum, dam);
}
}
rv = TRUE;

2
Source/portal.cpp

@ -126,7 +126,7 @@ void GetPortalLevel()
setlevel = 0;
currlevel = 0;
plr[myplr].plrlevel = 0;
leveltype = 0;
leveltype = DTYPE_TOWN;
} else {
if (portal[portalindex].setlvl) {
setlevel = 1;

8
Source/quests.cpp

@ -545,25 +545,25 @@ void SetReturnLvlPos()
case SL_SKELKING:
ReturnLvlX = quests[QTYPE_KING]._qtx + 1;
ReturnLvlY = quests[QTYPE_KING]._qty;
ReturnLvlT = 1;
ReturnLvlT = DTYPE_CATHEDRAL;
ReturnLvl = quests[QTYPE_KING]._qlevel;
break;
case SL_BONECHAMB:
ReturnLvlX = quests[QTYPE_BONE]._qtx + 1;
ReturnLvlY = quests[QTYPE_BONE]._qty;
ReturnLvlT = 2;
ReturnLvlT = DTYPE_CATACOMBS;
ReturnLvl = quests[QTYPE_BONE]._qlevel;
break;
case SL_POISONWATER:
ReturnLvlX = quests[QTYPE_PW]._qtx;
ReturnLvlY = quests[QTYPE_PW]._qty + 1;
ReturnLvlT = 1;
ReturnLvlT = DTYPE_CATHEDRAL;
ReturnLvl = quests[QTYPE_PW]._qlevel;
break;
case SL_VILEBETRAYER:
ReturnLvlX = quests[QTYPE_VB]._qtx + 1;
ReturnLvlY = quests[QTYPE_VB]._qty - 1;
ReturnLvlT = 4;
ReturnLvlT = DTYPE_HELL;
ReturnLvl = quests[QTYPE_VB]._qlevel;
break;
}

4
Source/themes.cpp

@ -146,7 +146,7 @@ BOOL TFit_SkelRoom(int t)
{
int i;
if (leveltype != 1 && leveltype != 2) {
if (leveltype != DTYPE_CATHEDRAL && leveltype != DTYPE_CATACOMBS) {
return FALSE;
}
@ -425,7 +425,7 @@ void InitThemes()
}
}
}
if (leveltype == 2 || leveltype == 3 || leveltype == 4) {
if (leveltype == DTYPE_CATACOMBS || leveltype == DTYPE_CAVES || leveltype == DTYPE_HELL) {
for (i = 0; i < themeCount; i++)
themes[i].ttype = THEME_NONE;
if (QuestStatus(QTYPE_ZHAR)) {

Loading…
Cancel
Save