Browse Source

[hellfire] Fix bugs related to using the wrong player index

- Firewall damage was incorrect for player 0 (host or single player)
- Town Shrine would always cast TP from the host instead of the user
- Oily Shrine and Sparkling Shrine would cast there traps as player 0
- The farmer would always think he was talking to the local player
pull/986/head
Anders Jenbo 5 years ago
parent
commit
a1281d8b54
  1. 11
      Source/missiles.cpp
  2. 6
      Source/objects.cpp
  3. 18
      Source/towners.cpp

11
Source/missiles.cpp

@ -2271,11 +2271,8 @@ void AddFirewall(int mi, int sx, int sy, int dx, int dy, int midir, char mienemy
{
int i;
#ifdef HELLFIRE
missile[mi]._midam = (random_(53, 10) + random_(53, 10) + 2 + ((id > 0) ? plr[id]._pLevel : currlevel)); // BUGFIX: missing parenthesis around ternary (fixed)
#else
missile[mi]._midam = (random_(53, 10) + random_(53, 10) + 2 + plr[id]._pLevel);
#endif
missile[mi]._midam = random_(53, 10) + random_(53, 10) + 2;
missile[mi]._midam += id >= 0 ? plr[id]._pLevel : currlevel; // BUGFIX: missing parenthesis around ternary (fixed)
missile[mi]._midam <<= 4;
missile[mi]._midam >>= 1;
GetMissileVel(mi, sx, sy, dx, dy, 16);
@ -2285,9 +2282,11 @@ void AddFirewall(int mi, int sx, int sy, int dx, int dy, int midir, char mienemy
missile[mi]._mirange *= i + 1;
#ifdef HELLFIRE
if (mienemy != TARGET_MONSTERS || id < 0)
#else
if (id < 0)
#endif
missile[mi]._mirange += currlevel;
else
#endif
missile[mi]._mirange += (plr[id]._pISplDur * missile[mi]._mirange) >> 7;
missile[mi]._mirange <<= 4;
missile[mi]._miVar1 = missile[mi]._mirange - missile[mi]._miAnimLen;

6
Source/objects.cpp

@ -3955,7 +3955,7 @@ void OperateShrine(int pnum, int i, int sType)
plr[myplr]._pdir,
MIS_FIREWALL,
TARGET_PLAYERS,
0,
-1,
2 * currlevel + 2,
0);
break;
@ -4006,7 +4006,7 @@ void OperateShrine(int pnum, int i, int sType)
plr[myplr]._pdir,
MIS_FLASH,
TARGET_PLAYERS,
0,
-1,
3 * currlevel + 2,
0);
CheckStats(pnum);
@ -4025,7 +4025,7 @@ void OperateShrine(int pnum, int i, int sType)
plr[myplr]._pdir,
MIS_TOWN,
TARGET_PLAYERS,
0,
pnum,
0,
0);
break;

18
Source/towners.cpp

@ -1099,13 +1099,13 @@ void TalkToTowner(int p, int t)
quests[Q_FARMER]._qlog = 1;
quests[Q_FARMER]._qmsg = TEXT_FARMER1;
break;
} else if (!plr[myplr]._pLvlVisited[9] && plr[myplr]._pLevel < 15) {
} else if (!plr[p]._pLvlVisited[9] && plr[p]._pLevel < 15) {
qt = 309;
if (plr[myplr]._pLvlVisited[2])
if (plr[p]._pLvlVisited[2])
qt = 281;
if (plr[myplr]._pLvlVisited[5])
if (plr[p]._pLvlVisited[5])
qt = 308;
if (plr[myplr]._pLvlVisited[7])
if (plr[p]._pLvlVisited[7])
qt = 310;
} else {
qt = TEXT_FARMER1;
@ -1130,15 +1130,15 @@ void TalkToTowner(int p, int t)
quests[Q_FARMER]._qvar1 = 1;
quests[Q_FARMER]._qmsg = TEXT_FARMER1;
quests[Q_FARMER]._qlog = 1;
} else if (!plr[myplr]._pLvlVisited[9] && plr[myplr]._pLevel < 15) {
} else if (!plr[p]._pLvlVisited[9] && plr[p]._pLevel < 15) {
qt = TEXT_FARMER8;
if (plr[myplr]._pLvlVisited[2]) {
if (plr[p]._pLvlVisited[2]) {
qt = TEXT_FARMER5;
}
if (plr[myplr]._pLvlVisited[5]) {
if (plr[p]._pLvlVisited[5]) {
qt = TEXT_FARMER7;
}
if (plr[myplr]._pLvlVisited[7]) {
if (plr[p]._pLvlVisited[7]) {
qt = TEXT_FARMER9;
}
} else {
@ -1219,7 +1219,7 @@ void TalkToTowner(int p, int t)
quests[Q_JERSEY]._qactive = 9;
break;
case 9:
if (!plr[myplr]._pLvlVisited[9] && plr[myplr]._pLevel < 15) {
if (!plr[p]._pLvlVisited[9] && plr[p]._pLevel < 15) {
switch (random_(0, 4) + 9) {
case 9:
qt = TEXT_JERSEY9;

Loading…
Cancel
Save