Browse Source

Rename quest globals

pull/2319/head
Anders Jenbo 5 years ago
parent
commit
9b8bf92575
  1. 6
      Source/automap.cpp
  2. 10
      Source/control.cpp
  3. 10
      Source/controls/game_controls.cpp
  4. 18
      Source/controls/plrctrls.cpp
  5. 4
      Source/cursor.cpp
  6. 2
      Source/debug.cpp
  7. 40
      Source/diablo.cpp
  8. 2
      Source/drlg_l1.cpp
  9. 10
      Source/drlg_l2.cpp
  10. 16
      Source/drlg_l4.cpp
  11. 48
      Source/inv.cpp
  12. 6
      Source/items.cpp
  13. 14
      Source/loadsave.cpp
  14. 2
      Source/minitext.cpp
  15. 8
      Source/miniwin/misc_msg.cpp
  16. 76
      Source/monster.cpp
  17. 24
      Source/msg.cpp
  18. 66
      Source/objects.cpp
  19. 10
      Source/player.cpp
  20. 2
      Source/plrmsg.cpp
  21. 2
      Source/qol/itemlabels.cpp
  22. 2
      Source/qol/monhealthbar.cpp
  23. 314
      Source/quests.cpp
  24. 12
      Source/quests.h
  25. 18
      Source/scrollrt.cpp
  26. 18
      Source/setmaps.cpp
  27. 16
      Source/stores.cpp
  28. 8
      Source/town.cpp
  29. 256
      Source/towners.cpp
  30. 4
      Source/towners.h
  31. 14
      Source/trigs.cpp

6
Source/automap.cpp

@ -241,7 +241,7 @@ void SearchAutomapItem(const Surface &out)
if (CanPanelsCoverView()) {
if (invflag || sbookflag)
screen.x -= 160;
if (chrflag || questlog)
if (chrflag || QuestLogIsOpen)
screen.x += 160;
}
screen.y -= AmLine8;
@ -278,7 +278,7 @@ void DrawAutomapPlr(const Surface &out, int playerId)
if (CanPanelsCoverView()) {
if (invflag || sbookflag)
base.x -= gnScreenWidth / 4;
if (chrflag || questlog)
if (chrflag || QuestLogIsOpen)
base.x += gnScreenWidth / 4;
}
base.y -= AmLine8;
@ -588,7 +588,7 @@ void DrawAutomap(const Surface &out)
if (invflag || sbookflag) {
screen.x -= gnScreenWidth / 4;
}
if (chrflag || questlog) {
if (chrflag || QuestLogIsOpen) {
screen.x += gnScreenWidth / 4;
}
}

10
Source/control.cpp

@ -1011,15 +1011,15 @@ void CheckBtnUp()
switch (i) {
case PanelButtonCharinfo:
questlog = false;
QuestLogIsOpen = false;
chrflag = !chrflag;
break;
case PanelButtonQlog:
chrflag = false;
if (!questlog)
if (!QuestLogIsOpen)
StartQuestlog();
else
questlog = false;
QuestLogIsOpen = false;
break;
case PanelButtonAutomap:
DoAutoMap();
@ -1144,7 +1144,7 @@ void DrawInfoBox(const Surface &out)
PrintMonstHistory(Monsters[pcursmonst].MType->mtype);
}
} else if (pcursitem == -1) {
string_view townerName = towners[pcursmonst]._tName;
string_view townerName = Towners[pcursmonst]._tName;
strncpy(infostr, townerName.data(), townerName.length());
infostr[townerName.length()] = '\0';
}
@ -1513,7 +1513,7 @@ void DrawDurIcon(const Surface &out)
bool hasRoomUnderPanels = gnScreenHeight >= SPANEL_HEIGHT + PANEL_HEIGHT + 16 + 32 + 16;
if (!hasRoomBetweenPanels && !hasRoomUnderPanels) {
if ((chrflag || questlog) && (invflag || sbookflag))
if ((chrflag || QuestLogIsOpen) && (invflag || sbookflag))
return;
}

10
Source/controls/game_controls.cpp

@ -25,9 +25,9 @@ DWORD TranslateControllerButtonToKey(ControllerButton controllerButton)
{
switch (controllerButton) {
case ControllerButton_BUTTON_A: // Bottom button
return questlog ? DVL_VK_SPACE : DVL_VK_ESCAPE;
return QuestLogIsOpen ? DVL_VK_SPACE : DVL_VK_ESCAPE;
case ControllerButton_BUTTON_B: // Right button
return (sgpCurrentMenu != nullptr || stextflag != STORE_NONE || questlog) ? DVL_VK_RETURN : DVL_VK_SPACE;
return (sgpCurrentMenu != nullptr || stextflag != STORE_NONE || QuestLogIsOpen) ? DVL_VK_RETURN : DVL_VK_SPACE;
case ControllerButton_BUTTON_Y: // Top button
return DVL_VK_RETURN;
case ControllerButton_BUTTON_LEFTSTICK:
@ -253,7 +253,7 @@ bool GetGameAction(const SDL_Event &event, ControllerButtonEvent ctrlEvent, Game
*action = GameAction(GameActionType_TOGGLE_INVENTORY);
else if (sbookflag)
*action = GameAction(GameActionType_TOGGLE_SPELL_BOOK);
else if (questlog)
else if (QuestLogIsOpen)
*action = GameAction(GameActionType_TOGGLE_QUEST_LOG);
else if (chrflag)
*action = GameAction(GameActionType_TOGGLE_CHARACTER_INFO);
@ -262,7 +262,7 @@ bool GetGameAction(const SDL_Event &event, ControllerButtonEvent ctrlEvent, Game
return true;
}
if (!questlog && !sbookflag) {
if (!QuestLogIsOpen && !sbookflag) {
switch (ctrlEvent.button) {
case ControllerButton_IGNORE:
return true;
@ -315,7 +315,7 @@ bool GetGameAction(const SDL_Event &event, ControllerButtonEvent ctrlEvent, Game
}
// DPad navigation is handled separately for these.
if (gmenu_is_active() || questlog || stextflag != STORE_NONE) {
if (gmenu_is_active() || QuestLogIsOpen || stextflag != STORE_NONE) {
switch (ctrlEvent.button) {
case ControllerButton_BUTTON_DPAD_UP:
case ControllerButton_BUTTON_DPAD_DOWN:

18
Source/controls/plrctrls.cpp

@ -167,7 +167,7 @@ void FindItemOrObject()
void CheckTownersNearby()
{
for (int i = 0; i < 16; i++) {
int distance = GetDistance(towners[i].position, 2);
int distance = GetDistance(Towners[i].position, 2);
if (distance == 0)
continue;
pcursmonst = i;
@ -417,13 +417,13 @@ void FindTrigger()
if (pcurstrig == -1) {
for (int i = 0; i < MAXQUESTS; i++) {
if (i == Q_BETRAYER || currlevel != quests[i]._qlevel || quests[i]._qslvl == 0)
if (i == Q_BETRAYER || currlevel != Quests[i]._qlevel || Quests[i]._qslvl == 0)
continue;
const int newDistance = GetDistance(quests[i].position, 2);
const int newDistance = GetDistance(Quests[i].position, 2);
if (newDistance == 0)
continue;
cursmx = quests[i].position.x;
cursmy = quests[i].position.y;
cursmx = Quests[i].position.x;
cursmy = Quests[i].position.y;
pcursquest = i;
}
}
@ -440,7 +440,7 @@ void FindTrigger()
void Interact()
{
if (leveltype == DTYPE_TOWN && pcursmonst != -1) {
NetSendCmdLocParam1(true, CMD_TALKXY, towners[pcursmonst].position, pcursmonst);
NetSendCmdLocParam1(true, CMD_TALKXY, Towners[pcursmonst].position, pcursmonst);
} else if (pcursmonst != -1) {
if (Players[MyPlayerId]._pwtype != WT_RANGED || CanTalkToMonst(pcursmonst)) {
NetSendCmdParam1(true, CMD_ATTACKID, pcursmonst);
@ -1127,7 +1127,7 @@ HandleLeftStickOrDPadFn GetLeftStickOrDPadGameUIHandler()
if (sbookflag) {
return &SpellBookMove;
}
if (questlog) {
if (QuestLogIsOpen) {
return &QuestLogMove;
}
if (stextflag != STORE_NONE) {
@ -1443,7 +1443,7 @@ bool TryDropItem()
void PerformSpellAction()
{
if (InGameMenu() || questlog || sbookflag)
if (InGameMenu() || QuestLogIsOpen || sbookflag)
return;
if (invflag) {
@ -1530,7 +1530,7 @@ void PerformSecondaryAction()
MakePlrPath(MyPlayerId, trigs[pcurstrig].position, true);
Players[MyPlayerId].destAction = ACTION_WALK;
} else if (pcursquest != -1) {
MakePlrPath(MyPlayerId, quests[pcursquest].position, true);
MakePlrPath(MyPlayerId, Quests[pcursquest].position, true);
Players[MyPlayerId].destAction = ACTION_WALK;
}
}

4
Source/cursor.cpp

@ -273,7 +273,7 @@ void CheckCursMove()
int sy = MousePosition.y;
if (CanPanelsCoverView()) {
if (chrflag || questlog) {
if (chrflag || QuestLogIsOpen) {
if (sx >= gnScreenWidth / 2) { /// BUGFIX: (sx >= gnScreenWidth / 2) (fixed)
sx -= gnScreenWidth / 4;
} else {
@ -410,7 +410,7 @@ void CheckCursMove()
if (sbookflag && MousePosition.x > RIGHT_PANEL && MousePosition.y <= SPANEL_HEIGHT) {
return;
}
if ((chrflag || questlog) && MousePosition.x < SPANEL_WIDTH && MousePosition.y <= SPANEL_HEIGHT) {
if ((chrflag || QuestLogIsOpen) && MousePosition.x < SPANEL_WIDTH && MousePosition.y <= SPANEL_HEIGHT) {
return;
}

2
Source/debug.cpp

@ -168,7 +168,7 @@ void PrintDebugQuest()
{
char dstr[128];
sprintf(dstr, "Quest %i : Active = %i, Var1 = %i", DebugQuestId, quests[DebugQuestId]._qactive, quests[DebugQuestId]._qvar1);
sprintf(dstr, "Quest %i : Active = %i, Var1 = %i", DebugQuestId, Quests[DebugQuestId]._qactive, Quests[DebugQuestId]._qvar1);
NetSendCmdString(1 << MyPlayerId, dstr);
DebugQuestId++;

40
Source/diablo.cpp

@ -770,7 +770,7 @@ static bool LeftMouseDown(int wParam)
if (MousePosition.y < PANEL_TOP || MousePosition.x < PANEL_LEFT || MousePosition.x >= PANEL_LEFT + PANEL_WIDTH) {
if (!gmenu_is_active() && !TryIconCurs()) {
if (questlog && MousePosition.x > 32 && MousePosition.x < 288 && MousePosition.y > 32 && MousePosition.y < 308) {
if (QuestLogIsOpen && MousePosition.x > 32 && MousePosition.x < 288 && MousePosition.y > 32 && MousePosition.y < 308) {
QuestlogESC();
} else if (qtextflag) {
qtextflag = false;
@ -895,16 +895,16 @@ static void ReleaseKey(int vkey)
static void ClosePanels()
{
if (CanPanelsCoverView()) {
if (!chrflag && !questlog && (invflag || sbookflag) && MousePosition.x < 480 && MousePosition.y < PANEL_TOP) {
if (!chrflag && !QuestLogIsOpen && (invflag || sbookflag) && MousePosition.x < 480 && MousePosition.y < PANEL_TOP) {
SetCursorPos(MousePosition.x + 160, MousePosition.y);
} else if (!invflag && !sbookflag && (chrflag || questlog) && MousePosition.x > 160 && MousePosition.y < PANEL_TOP) {
} else if (!invflag && !sbookflag && (chrflag || QuestLogIsOpen) && MousePosition.x > 160 && MousePosition.y < PANEL_TOP) {
SetCursorPos(MousePosition.x - 160, MousePosition.y);
}
}
invflag = false;
chrflag = false;
sbookflag = false;
questlog = false;
QuestLogIsOpen = false;
}
bool PressEscKey()
@ -952,7 +952,7 @@ bool PressEscKey()
rv = true;
}
if (invflag || chrflag || sbookflag || questlog) {
if (invflag || chrflag || sbookflag || QuestLogIsOpen) {
ClosePanels();
rv = true;
}
@ -1012,7 +1012,7 @@ static void PressKey(int vkey)
dx_reinit();
} else if (stextflag != STORE_NONE) {
StoreEnter();
} else if (questlog) {
} else if (QuestLogIsOpen) {
QuestlogEnter();
} else {
control_type_message();
@ -1020,7 +1020,7 @@ static void PressKey(int vkey)
} else if (vkey == DVL_VK_UP) {
if (stextflag != STORE_NONE) {
StoreUp();
} else if (questlog) {
} else if (QuestLogIsOpen) {
QuestlogUp();
} else if (HelpFlag) {
HelpScrollUp();
@ -1030,7 +1030,7 @@ static void PressKey(int vkey)
} else if (vkey == DVL_VK_DOWN) {
if (stextflag != STORE_NONE) {
StoreDown();
} else if (questlog) {
} else if (QuestLogIsOpen) {
QuestlogDown();
} else if (HelpFlag) {
HelpScrollDown();
@ -1690,7 +1690,7 @@ void LoadGameLevel(bool firstflag, lvl_entry lvldir)
if (currlevel == 21) {
CornerstoneLoad(CornerStone.position);
}
if (quests[Q_NAKRUL]._qactive == QUEST_DONE && currlevel == 24) {
if (Quests[Q_NAKRUL]._qactive == QUEST_DONE && currlevel == 24) {
SyncNakrulRoom();
}
}
@ -1703,7 +1703,7 @@ void LoadGameLevel(bool firstflag, lvl_entry lvldir)
while (!IncProgress())
;
if (!gbIsSpawn && setlevel && setlvlnum == SL_SKELKING && quests[Q_SKELKING]._qactive == QUEST_ACTIVE)
if (!gbIsSpawn && setlevel && setlvlnum == SL_SKELKING && Quests[Q_SKELKING]._qactive == QUEST_ACTIVE)
PlaySFX(USFX_SKING1);
}
@ -1805,7 +1805,7 @@ void diablo_color_cyc_logic()
palette_update_crypt();
} else if (currlevel >= 17) {
palette_update_hive();
} else if (setlevel && setlvlnum == quests[Q_PWATER]._qslvl) {
} else if (setlevel && setlvlnum == Quests[Q_PWATER]._qslvl) {
UpdatePWaterPalette();
} else if (leveltype == DTYPE_CAVES) {
palette_update_caves();
@ -1830,7 +1830,7 @@ void helpKeyPressed()
qtextflag = false;
stream_stop();
}
questlog = false;
QuestLogIsOpen = false;
AutomapActive = false;
msgdelay = 0;
gamemenu_off();
@ -1861,7 +1861,7 @@ void inventoryKeyPressed()
if (stextflag != STORE_NONE)
return;
invflag = !invflag;
if (!chrflag && !questlog && CanPanelsCoverView()) {
if (!chrflag && !QuestLogIsOpen && CanPanelsCoverView()) {
if (!invflag) { // We closed the invetory
if (MousePosition.x < 480 && MousePosition.y < PANEL_TOP) {
SetCursorPos(MousePosition.x + 160, MousePosition.y);
@ -1885,26 +1885,26 @@ void characterSheetKeyPressed()
if (MousePosition.x > 160 && MousePosition.y < PANEL_TOP) {
SetCursorPos(MousePosition.x - 160, MousePosition.y);
}
} else if (!questlog) { // We opened the character sheet
} else if (!QuestLogIsOpen) { // We opened the character sheet
if (MousePosition.x < 480 && MousePosition.y < PANEL_TOP) {
SetCursorPos(MousePosition.x + 160, MousePosition.y);
}
}
}
questlog = false;
QuestLogIsOpen = false;
}
void questLogKeyPressed()
{
if (stextflag != STORE_NONE)
return;
if (!questlog) {
if (!QuestLogIsOpen) {
StartQuestlog();
} else {
questlog = false;
QuestLogIsOpen = false;
}
if (!invflag && !sbookflag && CanPanelsCoverView()) {
if (!questlog) { // We closed the quest log
if (!QuestLogIsOpen) { // We closed the quest log
if (MousePosition.x > 160 && MousePosition.y < PANEL_TOP) {
SetCursorPos(MousePosition.x - 160, MousePosition.y);
}
@ -1922,7 +1922,7 @@ void displaySpellsKeyPressed()
if (stextflag != STORE_NONE)
return;
chrflag = false;
questlog = false;
QuestLogIsOpen = false;
invflag = false;
sbookflag = false;
if (!spselflag) {
@ -1938,7 +1938,7 @@ void spellBookKeyPressed()
if (stextflag != STORE_NONE)
return;
sbookflag = !sbookflag;
if (!chrflag && !questlog && CanPanelsCoverView()) {
if (!chrflag && !QuestLogIsOpen && CanPanelsCoverView()) {
if (!sbookflag) { // We closed the invetory
if (MousePosition.x < 480 && MousePosition.y < PANEL_TOP) {
SetCursorPos(MousePosition.x + 160, MousePosition.y);

2
Source/drlg_l1.cpp

@ -847,7 +847,7 @@ static int DrlgPlaceMiniSet(const BYTE *miniset, int tmin, int tmax, int cx, int
DRLG_MRectTrans(sx, sy + 2, sx + 5, sy + 4);
TransVal = t;
quests[Q_PWATER].position = { 2 * sx + 21, 2 * sy + 22 };
Quests[Q_PWATER].position = { 2 * sx + 21, 2 * sy + 22 };
}
if (setview) {

10
Source/drlg_l2.cpp

@ -2675,21 +2675,21 @@ static bool CreateDungeon()
switch (currlevel) {
case 5:
if (quests[Q_BLOOD]._qactive != QUEST_NOTAVAIL) {
if (Quests[Q_BLOOD]._qactive != QUEST_NOTAVAIL) {
forceHW = true;
forceH = 20;
forceW = 14;
}
break;
case 6:
if (quests[Q_SCHAMB]._qactive != QUEST_NOTAVAIL) {
if (Quests[Q_SCHAMB]._qactive != QUEST_NOTAVAIL) {
forceHW = true;
forceW = 10;
forceH = 10;
}
break;
case 7:
if (quests[Q_BLIND]._qactive != QUEST_NOTAVAIL) {
if (Quests[Q_BLIND]._qactive != QUEST_NOTAVAIL) {
forceHW = true;
forceW = 15;
forceH = 15;
@ -3244,13 +3244,13 @@ void LoadPreL2Dungeon(const char *path)
void CreateL2Dungeon(uint32_t rseed, lvl_entry entry)
{
if (!gbIsMultiplayer) {
if (currlevel == 7 && quests[Q_BLIND]._qactive == QUEST_NOTAVAIL) {
if (currlevel == 7 && Quests[Q_BLIND]._qactive == QUEST_NOTAVAIL) {
currlevel = 6;
CreateL2Dungeon(glSeedTbl[6], ENTRY_LOAD);
currlevel = 7;
}
if (currlevel == 8) {
if (quests[Q_BLIND]._qactive == QUEST_NOTAVAIL) {
if (Quests[Q_BLIND]._qactive == QUEST_NOTAVAIL) {
currlevel = 6;
CreateL2Dungeon(glSeedTbl[6], ENTRY_LOAD);
currlevel = 8;

16
Source/drlg_l4.cpp

@ -1010,11 +1010,11 @@ static void L4firstRoom()
int w = 14;
int h = 14;
if (currlevel != 16) {
if (currlevel == quests[Q_WARLORD]._qlevel && quests[Q_WARLORD]._qactive != QUEST_NOTAVAIL) {
if (currlevel == Quests[Q_WARLORD]._qlevel && Quests[Q_WARLORD]._qactive != QUEST_NOTAVAIL) {
assert(!gbIsMultiplayer);
w = 11;
h = 11;
} else if (currlevel == quests[Q_BETRAYER]._qlevel && gbIsMultiplayer) {
} else if (currlevel == Quests[Q_BETRAYER]._qlevel && gbIsMultiplayer) {
w = 11;
h = 11;
} else {
@ -1035,7 +1035,7 @@ static void L4firstRoom()
l4holdx = x;
l4holdy = y;
}
if (QuestStatus(Q_WARLORD) || (currlevel == quests[Q_BETRAYER]._qlevel && gbIsMultiplayer)) {
if (QuestStatus(Q_WARLORD) || (currlevel == Quests[Q_BETRAYER]._qlevel && gbIsMultiplayer)) {
SP4x1 = x + 1;
SP4y1 = y + 1;
SP4x2 = SP4x1 + w;
@ -1165,8 +1165,8 @@ static bool DrlgL4PlaceMiniSet(const BYTE *miniset, int tmin, int tmax, int cx,
}
}
if (currlevel == 15 && quests[Q_BETRAYER]._qactive >= QUEST_ACTIVE) { /// Lazarus staff skip bug fixed
quests[Q_BETRAYER].position = { sx + 1, sy + 1 };
if (currlevel == 15 && Quests[Q_BETRAYER]._qactive >= QUEST_ACTIVE) { /// Lazarus staff skip bug fixed
Quests[Q_BETRAYER].position = { sx + 1, sy + 1 };
}
if (setview) {
ViewX = 2 * sx + 21;
@ -1375,7 +1375,7 @@ static void DrlgL4(lvl_entry entry)
if (currlevel == 16) {
L4SaveQuads();
}
if (QuestStatus(Q_WARLORD) || (currlevel == quests[Q_BETRAYER]._qlevel && gbIsMultiplayer)) {
if (QuestStatus(Q_WARLORD) || (currlevel == Quests[Q_BETRAYER]._qlevel && gbIsMultiplayer)) {
for (int spi = SP4x1; spi < SP4x2; spi++) {
for (int spj = SP4y1; spj < SP4y2; spj++) {
dflags[spi][spj] = 1;
@ -1445,7 +1445,7 @@ static void DrlgL4(lvl_entry entry)
if (entry == ENTRY_MAIN) {
doneflag = DrlgL4PlaceMiniSet(L4USTAIRS, 1, 1, -1, -1, true, 0);
if (doneflag) {
if (!gbIsMultiplayer && quests[Q_DIABLO]._qactive != QUEST_ACTIVE) {
if (!gbIsMultiplayer && Quests[Q_DIABLO]._qactive != QUEST_ACTIVE) {
doneflag = DrlgL4PlaceMiniSet(L4PENTA, 1, 1, -1, -1, false, 1);
} else {
doneflag = DrlgL4PlaceMiniSet(L4PENTA2, 1, 1, -1, -1, false, 1);
@ -1455,7 +1455,7 @@ static void DrlgL4(lvl_entry entry)
} else {
doneflag = DrlgL4PlaceMiniSet(L4USTAIRS, 1, 1, -1, -1, false, 0);
if (doneflag) {
if (!gbIsMultiplayer && quests[Q_DIABLO]._qactive != QUEST_ACTIVE) {
if (!gbIsMultiplayer && Quests[Q_DIABLO]._qactive != QUEST_ACTIVE) {
doneflag = DrlgL4PlaceMiniSet(L4PENTA, 1, 1, -1, -1, true, 1);
} else {
doneflag = DrlgL4PlaceMiniSet(L4PENTA2, 1, 1, -1, -1, true, 1);

48
Source/inv.cpp

@ -1468,45 +1468,45 @@ static void CheckQuestItem(PlayerStruct &player)
{
auto &myPlayer = Players[MyPlayerId];
if (player.HoldItem.IDidx == IDI_OPTAMULET && quests[Q_BLIND]._qactive == QUEST_ACTIVE)
quests[Q_BLIND]._qactive = QUEST_DONE;
if (player.HoldItem.IDidx == IDI_OPTAMULET && Quests[Q_BLIND]._qactive == QUEST_ACTIVE)
Quests[Q_BLIND]._qactive = QUEST_DONE;
if (player.HoldItem.IDidx == IDI_MUSHROOM && quests[Q_MUSHROOM]._qactive == QUEST_ACTIVE && quests[Q_MUSHROOM]._qvar1 == QS_MUSHSPAWNED) {
if (player.HoldItem.IDidx == IDI_MUSHROOM && Quests[Q_MUSHROOM]._qactive == QUEST_ACTIVE && Quests[Q_MUSHROOM]._qvar1 == QS_MUSHSPAWNED) {
player.Say(HeroSpeech::NowThatsOneBigMushroom, 10); // BUGFIX: Voice for this quest might be wrong in MP
quests[Q_MUSHROOM]._qvar1 = QS_MUSHPICKED;
Quests[Q_MUSHROOM]._qvar1 = QS_MUSHPICKED;
}
if (player.HoldItem.IDidx == IDI_ANVIL && quests[Q_ANVIL]._qactive != QUEST_NOTAVAIL) {
if (quests[Q_ANVIL]._qactive == QUEST_INIT) {
quests[Q_ANVIL]._qactive = QUEST_ACTIVE;
if (player.HoldItem.IDidx == IDI_ANVIL && Quests[Q_ANVIL]._qactive != QUEST_NOTAVAIL) {
if (Quests[Q_ANVIL]._qactive == QUEST_INIT) {
Quests[Q_ANVIL]._qactive = QUEST_ACTIVE;
}
if (quests[Q_ANVIL]._qlog) {
if (Quests[Q_ANVIL]._qlog) {
myPlayer.Say(HeroSpeech::INeedToGetThisToGriswold, 10);
}
}
if (player.HoldItem.IDidx == IDI_GLDNELIX && quests[Q_VEIL]._qactive != QUEST_NOTAVAIL) {
if (player.HoldItem.IDidx == IDI_GLDNELIX && Quests[Q_VEIL]._qactive != QUEST_NOTAVAIL) {
myPlayer.Say(HeroSpeech::INeedToGetThisToLachdanan, 30);
}
if (player.HoldItem.IDidx == IDI_ROCK && quests[Q_ROCK]._qactive != QUEST_NOTAVAIL) {
if (quests[Q_ROCK]._qactive == QUEST_INIT) {
quests[Q_ROCK]._qactive = QUEST_ACTIVE;
if (player.HoldItem.IDidx == IDI_ROCK && Quests[Q_ROCK]._qactive != QUEST_NOTAVAIL) {
if (Quests[Q_ROCK]._qactive == QUEST_INIT) {
Quests[Q_ROCK]._qactive = QUEST_ACTIVE;
}
if (quests[Q_ROCK]._qlog) {
if (Quests[Q_ROCK]._qlog) {
myPlayer.Say(HeroSpeech::ThisMustBeWhatGriswoldWanted, 10);
}
}
if (player.HoldItem.IDidx == IDI_ARMOFVAL && quests[Q_BLOOD]._qactive == QUEST_ACTIVE) {
quests[Q_BLOOD]._qactive = QUEST_DONE;
if (player.HoldItem.IDidx == IDI_ARMOFVAL && Quests[Q_BLOOD]._qactive == QUEST_ACTIVE) {
Quests[Q_BLOOD]._qactive = QUEST_DONE;
myPlayer.Say(HeroSpeech::MayTheSpiritOfArkaineProtectMe, 20);
}
if (player.HoldItem.IDidx == IDI_MAPOFDOOM) {
quests[Q_GRAVE]._qlog = false;
quests[Q_GRAVE]._qactive = QUEST_ACTIVE;
quests[Q_GRAVE]._qvar1 = 1;
Quests[Q_GRAVE]._qlog = false;
Quests[Q_GRAVE]._qactive = QUEST_ACTIVE;
Quests[Q_GRAVE]._qvar1 = 1;
Players[MyPlayerId].Say(HeroSpeech::UhHuh, 10);
}
@ -1773,7 +1773,7 @@ int InvPutItem(PlayerStruct &player, Point position)
if (player.HoldItem._iCurs == ICURS_RUNE_BOMB && xp >= 79 && xp <= 82 && yp >= 61 && yp <= 64) {
Displacement relativePosition = position - player.position.tile;
NetSendCmdLocParam2(false, CMD_OPENHIVE, player.position.tile, relativePosition.deltaX, relativePosition.deltaY);
quests[Q_FARMER]._qactive = QUEST_DONE;
Quests[Q_FARMER]._qactive = QUEST_DONE;
if (gbIsMultiplayer) {
NetSendCmdQuest(true, Q_FARMER);
return -1;
@ -1782,7 +1782,7 @@ int InvPutItem(PlayerStruct &player, Point position)
}
if (player.HoldItem.IDidx == IDI_MAPOFDOOM && xp >= 35 && xp <= 38 && yp >= 20 && yp <= 24) {
NetSendCmd(false, CMD_OPENCRYPT);
quests[Q_GRAVE]._qactive = QUEST_DONE;
Quests[Q_GRAVE]._qactive = QUEST_DONE;
if (gbIsMultiplayer) {
NetSendCmdQuest(true, Q_GRAVE);
}
@ -1802,8 +1802,8 @@ int InvPutItem(PlayerStruct &player, Point position)
if (currlevel == 21 && position == CornerStone.position) {
CornerStone.item = Items[ii];
InitQTextMsg(TEXT_CORNSTN);
quests[Q_CORNSTN]._qlog = false;
quests[Q_CORNSTN]._qactive = QUEST_DONE;
Quests[Q_CORNSTN]._qlog = false;
Quests[Q_CORNSTN]._qactive = QUEST_DONE;
}
NewCursor(CURSOR_HAND);
@ -1846,8 +1846,8 @@ int SyncPutItem(PlayerStruct &player, Point position, int idx, uint16_t icreatei
if (currlevel == 21 && position == CornerStone.position) {
CornerStone.item = Items[ii];
InitQTextMsg(TEXT_CORNSTN);
quests[Q_CORNSTN]._qlog = false;
quests[Q_CORNSTN]._qactive = QUEST_DONE;
Quests[Q_CORNSTN]._qlog = false;
Quests[Q_CORNSTN]._qactive = QUEST_DONE;
}
return ii;
}

6
Source/items.cpp

@ -2501,7 +2501,7 @@ void SpawnItem(int m, Point position, bool sendmsg)
return;
}
onlygood = true;
} else if (quests[Q_MUSHROOM]._qactive != QUEST_ACTIVE || quests[Q_MUSHROOM]._qvar1 != QS_MUSHGIVEN) {
} else if (Quests[Q_MUSHROOM]._qactive != QUEST_ACTIVE || Quests[Q_MUSHROOM]._qvar1 != QS_MUSHGIVEN) {
idx = RndItem(m);
if (idx == 0)
return;
@ -2514,7 +2514,7 @@ void SpawnItem(int m, Point position, bool sendmsg)
}
} else {
idx = IDI_BRAIN;
quests[Q_MUSHROOM]._qvar1 = QS_BRAINSPAWNED;
Quests[Q_MUSHROOM]._qvar1 = QS_BRAINSPAWNED;
}
if (ActiveItemCount >= MAXITEMS)
@ -3648,7 +3648,7 @@ static void DrawULine(const Surface &out, int y)
void DrawUniqueInfo(const Surface &out)
{
if ((chrflag || questlog) && gnScreenWidth < SPANEL_WIDTH * 3) {
if ((chrflag || QuestLogIsOpen) && gnScreenWidth < SPANEL_WIDTH * 3) {
return;
}

14
Source/loadsave.cpp

@ -758,7 +758,7 @@ static void LoadPremium(LoadHelper *file, int i)
static void LoadQuest(LoadHelper *file, int i)
{
QuestStruct *pQuest = &quests[i];
QuestStruct *pQuest = &Quests[i];
pQuest->_qlevel = file->NextLE<uint8_t>();
pQuest->_qtype = file->NextLE<uint8_t>();
@ -783,8 +783,8 @@ static void LoadQuest(LoadHelper *file, int i)
ReturnLvlX = file->NextBE<int32_t>();
ReturnLvlY = file->NextBE<int32_t>();
ReturnLvl = file->NextBE<int32_t>();
ReturnLvlT = static_cast<dungeon_type>(file->NextBE<int32_t>());
ReturnLevel = file->NextBE<int32_t>();
ReturnLevelType = static_cast<dungeon_type>(file->NextBE<int32_t>());
file->Skip(sizeof(int32_t)); // Skip DoomQuestState
}
@ -967,7 +967,7 @@ static void ConvertLevels()
}
setlevel = true; // Convert quest levels
for (auto &quest : quests) {
for (auto &quest : Quests) {
if (quest._qactive == QUEST_NOTAVAIL) {
continue;
}
@ -1794,7 +1794,7 @@ static void SavePremium(SaveHelper *file, int i)
static void SaveQuest(SaveHelper *file, int i)
{
QuestStruct *pQuest = &quests[i];
QuestStruct *pQuest = &Quests[i];
file->WriteLE<uint8_t>(pQuest->_qlevel);
file->WriteLE<uint8_t>(pQuest->_qtype);
@ -1819,8 +1819,8 @@ static void SaveQuest(SaveHelper *file, int i)
file->WriteBE<int32_t>(ReturnLvlX);
file->WriteBE<int32_t>(ReturnLvlY);
file->WriteBE<int32_t>(ReturnLvl);
file->WriteBE<int32_t>(ReturnLvlT);
file->WriteBE<int32_t>(ReturnLevel);
file->WriteBE<int32_t>(ReturnLevelType);
file->Skip(sizeof(int32_t)); // Skip DoomQuestState
}

2
Source/minitext.cpp

@ -147,7 +147,7 @@ void InitQuestText()
void InitQTextMsg(_speech_id m)
{
if (Texts[m].scrlltxt) {
questlog = false;
QuestLogIsOpen = false;
LoadText(_(Texts[m].txtstr));
qtextflag = true;
qtextSpd = CalculateTextSpeed(Texts[m].sfxnr);

8
Source/miniwin/misc_msg.cpp

@ -385,7 +385,7 @@ bool FetchMessage(tagMSG *lpMsg)
else
spselflag = false;
chrflag = false;
questlog = false;
QuestLogIsOpen = false;
sbookflag = false;
StoreSpellCoords();
}
@ -393,7 +393,7 @@ bool FetchMessage(tagMSG *lpMsg)
case GameActionType_TOGGLE_CHARACTER_INFO:
chrflag = !chrflag;
if (chrflag) {
questlog = false;
QuestLogIsOpen = false;
spselflag = false;
if (pcurs == CURSOR_DISARM)
NewCursor(CURSOR_HAND);
@ -401,12 +401,12 @@ bool FetchMessage(tagMSG *lpMsg)
}
break;
case GameActionType_TOGGLE_QUEST_LOG:
if (!questlog) {
if (!QuestLogIsOpen) {
StartQuestlog();
chrflag = false;
spselflag = false;
} else {
questlog = false;
QuestLogIsOpen = false;
}
break;
case GameActionType_TOGGLE_INVENTORY:

76
Source/monster.cpp

@ -304,7 +304,7 @@ void GetLevelMTypes()
if (QuestStatus(Q_WARLORD))
AddMonsterType(UniqMonst[UMT_WARLORD].mtype, PLACE_UNIQUE);
if (gbIsMultiplayer && currlevel == quests[Q_SKELKING]._qlevel) {
if (gbIsMultiplayer && currlevel == Quests[Q_SKELKING]._qlevel) {
AddMonsterType(MT_SKING, PLACE_UNIQUE);
@ -663,7 +663,7 @@ void monster_some_crypt()
if (currlevel == 24 && UberDiabloMonsterIndex >= 0 && UberDiabloMonsterIndex < ActiveMonsterCount) {
mon = &Monsters[UberDiabloMonsterIndex];
PlayEffect(UberDiabloMonsterIndex, 2);
quests[Q_NAKRUL]._qlog = false;
Quests[Q_NAKRUL]._qlog = false;
mon->mArmorClass -= 50;
hp = mon->_mmaxhp / 2;
mon->mMagicRes = 0;
@ -836,7 +836,7 @@ void PlaceUniqueMonst(int uniqindex, int miniontype, int bosspacksize)
if (gbIsMultiplayer) {
if (monst->_mAi == AI_LAZHELP)
monst->mtalkmsg = TEXT_NONE;
if (monst->_mAi == AI_LAZURUS && quests[Q_BETRAYER]._qvar1 > 3) {
if (monst->_mAi == AI_LAZURUS && Quests[Q_BETRAYER]._qvar1 > 3) {
monst->_mgoal = MGOAL_NORMAL;
} else if (monst->mtalkmsg != TEXT_NONE) {
monst->_mgoal = MGOAL_INQUIRING;
@ -927,15 +927,15 @@ static void PlaceUniques()
if (done)
break;
}
if (u == UMT_GARBUD && quests[Q_GARBUD]._qactive == QUEST_NOTAVAIL)
if (u == UMT_GARBUD && Quests[Q_GARBUD]._qactive == QUEST_NOTAVAIL)
done = false;
if (u == UMT_ZHAR && quests[Q_ZHAR]._qactive == QUEST_NOTAVAIL)
if (u == UMT_ZHAR && Quests[Q_ZHAR]._qactive == QUEST_NOTAVAIL)
done = false;
if (u == UMT_SNOTSPIL && quests[Q_LTBANNER]._qactive == QUEST_NOTAVAIL)
if (u == UMT_SNOTSPIL && Quests[Q_LTBANNER]._qactive == QUEST_NOTAVAIL)
done = false;
if (u == UMT_LACHDAN && quests[Q_VEIL]._qactive == QUEST_NOTAVAIL)
if (u == UMT_LACHDAN && Quests[Q_VEIL]._qactive == QUEST_NOTAVAIL)
done = false;
if (u == UMT_WARLORD && quests[Q_WARLORD]._qactive == QUEST_NOTAVAIL)
if (u == UMT_WARLORD && Quests[Q_WARLORD]._qactive == QUEST_NOTAVAIL)
done = false;
if (done)
PlaceUniqueMonst(u, mt, 8);
@ -951,7 +951,7 @@ void PlaceQuestMonsters()
PlaceUniqueMonst(UMT_BUTCHER, 0, 0);
}
if (currlevel == quests[Q_SKELKING]._qlevel && gbIsMultiplayer) {
if (currlevel == Quests[Q_SKELKING]._qlevel && gbIsMultiplayer) {
skeltype = 0;
for (skeltype = 0; skeltype < LevelMonsterTypeCount; skeltype++) {
@ -988,10 +988,10 @@ void PlaceQuestMonsters()
AddMonsterType(UniqMonst[UMT_LACHDAN].mtype, PLACE_SCATTER);
}
if (QuestStatus(Q_ZHAR) && zharlib == -1) {
quests[Q_ZHAR]._qactive = QUEST_NOTAVAIL;
Quests[Q_ZHAR]._qactive = QUEST_NOTAVAIL;
}
if (currlevel == quests[Q_BETRAYER]._qlevel && gbIsMultiplayer) {
if (currlevel == Quests[Q_BETRAYER]._qlevel && gbIsMultiplayer) {
AddMonsterType(UniqMonst[UMT_LAZURUS].mtype, PLACE_UNIQUE);
AddMonsterType(UniqMonst[UMT_RED_VEX].mtype, PLACE_UNIQUE);
PlaceUniqueMonst(UMT_LAZURUS, 0, 0);
@ -1623,7 +1623,7 @@ void M_DiabloDeath(int i, bool sendmsg)
{
MonsterStruct *monst = &Monsters[i];
PlaySFX(USFX_DIABLOD);
quests[Q_DIABLO]._qactive = QUEST_DONE;
Quests[Q_DIABLO]._qactive = QUEST_DONE;
if (sendmsg)
NetSendCmdQuest(true, Q_DIABLO);
sgbSaveSoundOn = gbSoundOn;
@ -1661,7 +1661,7 @@ void SpawnLoot(int i, bool sendmsg)
} else if (monst->_uniqtype - 1 == UMT_DEFILER) {
if (effect_is_playing(USFX_DEFILER8))
stream_stop();
quests[Q_DEFILER]._qlog = false;
Quests[Q_DEFILER]._qlog = false;
SpawnMapOfDoom(monst->position.tile);
} else if (monst->_uniqtype - 1 == UMT_HORKDMN) {
if (sgGameInitInfo.bTheoQuest != 0) {
@ -1676,7 +1676,7 @@ void SpawnLoot(int i, bool sendmsg)
nSFX = USFX_NAKRUL6;
if (effect_is_playing(nSFX))
stream_stop();
quests[Q_NAKRUL]._qlog = false;
Quests[Q_NAKRUL]._qlog = false;
UberDiabloMonsterIndex = -2;
CreateMagicWeapon(monst->position.tile, ITYPE_SWORD, ICURS_GREAT_SWORD, false, true);
CreateMagicWeapon(monst->position.tile, ITYPE_STAFF, ICURS_WAR_STAFF, false, true);
@ -2353,8 +2353,8 @@ bool M_DoTalk(int i)
InitQTextMsg(Monsters[i].mtalkmsg);
if (Monsters[i]._uniqtype - 1 == UMT_GARBUD) {
if (Monsters[i].mtalkmsg == TEXT_GARBUD1) {
quests[Q_GARBUD]._qactive = QUEST_ACTIVE;
quests[Q_GARBUD]._qlog = true; // BUGFIX: (?) for other quests qactive and qlog go together, maybe this should actually go into the if above (fixed)
Quests[Q_GARBUD]._qactive = QUEST_ACTIVE;
Quests[Q_GARBUD]._qlog = true; // BUGFIX: (?) for other quests qactive and qlog go together, maybe this should actually go into the if above (fixed)
}
if (Monsters[i].mtalkmsg == TEXT_GARBUD2 && (Monsters[i]._mFlags & MFLAG_QUEST_COMPLETE) == 0) {
SpawnItem(i, Monsters[i].position.tile + Displacement { 1, 1 }, true);
@ -2364,8 +2364,8 @@ bool M_DoTalk(int i)
if (Monsters[i]._uniqtype - 1 == UMT_ZHAR
&& Monsters[i].mtalkmsg == TEXT_ZHAR1
&& (Monsters[i]._mFlags & MFLAG_QUEST_COMPLETE) == 0) {
quests[Q_ZHAR]._qactive = QUEST_ACTIVE;
quests[Q_ZHAR]._qlog = true;
Quests[Q_ZHAR]._qactive = QUEST_ACTIVE;
Quests[Q_ZHAR]._qlog = true;
CreateTypeItem(Monsters[i].position.tile + Displacement { 1, 1 }, false, ITYPE_MISC, IMISC_BOOK, true, false);
Monsters[i]._mFlags |= MFLAG_QUEST_COMPLETE;
}
@ -2376,19 +2376,19 @@ bool M_DoTalk(int i)
TransVal = 9;
DRLG_MRectTrans(setpc_x, setpc_y, (setpc_w / 2) + setpc_x + 4, setpc_y + (setpc_h / 2));
TransVal = tren;
quests[Q_LTBANNER]._qvar1 = 2;
if (quests[Q_LTBANNER]._qactive == QUEST_INIT)
quests[Q_LTBANNER]._qactive = QUEST_ACTIVE;
Quests[Q_LTBANNER]._qvar1 = 2;
if (Quests[Q_LTBANNER]._qactive == QUEST_INIT)
Quests[Q_LTBANNER]._qactive = QUEST_ACTIVE;
Monsters[i]._mFlags |= MFLAG_QUEST_COMPLETE;
}
if (quests[Q_LTBANNER]._qvar1 < 2) {
if (Quests[Q_LTBANNER]._qvar1 < 2) {
app_fatal("SS Talk = %i, Flags = %i", Monsters[i].mtalkmsg, Monsters[i]._mFlags);
}
}
if (Monsters[i]._uniqtype - 1 == UMT_LACHDAN) {
if (Monsters[i].mtalkmsg == TEXT_VEIL9) {
quests[Q_VEIL]._qactive = QUEST_ACTIVE;
quests[Q_VEIL]._qlog = true;
Quests[Q_VEIL]._qactive = QUEST_ACTIVE;
Quests[Q_VEIL]._qlog = true;
}
if (Monsters[i].mtalkmsg == TEXT_VEIL11 && (Monsters[i]._mFlags & MFLAG_QUEST_COMPLETE) == 0) {
SpawnUnique(UITEM_STEELVEIL, Monsters[i].position.tile + DIR_S);
@ -2396,9 +2396,9 @@ bool M_DoTalk(int i)
}
}
if (Monsters[i]._uniqtype - 1 == UMT_WARLORD)
quests[Q_WARLORD]._qvar1 = 2;
Quests[Q_WARLORD]._qvar1 = 2;
if (Monsters[i]._uniqtype - 1 == UMT_LAZURUS && gbIsMultiplayer) {
quests[Q_BETRAYER]._qvar1 = 6;
Quests[Q_BETRAYER]._qvar1 = 6;
Monsters[i]._mgoal = MGOAL_NORMAL;
Monsters[i]._msquelch = UINT8_MAX;
Monsters[i].mtalkmsg = TEXT_NONE;
@ -4162,7 +4162,7 @@ void MAI_SnotSpil(int i)
monst->_mgoal = MGOAL_INQUIRING;
}
if (monst->mtalkmsg == TEXT_BANNER11 && quests[Q_LTBANNER]._qvar1 == 3) {
if (monst->mtalkmsg == TEXT_BANNER11 && Quests[Q_LTBANNER]._qvar1 == 3) {
monst->mtalkmsg = TEXT_NONE;
monst->_mgoal = MGOAL_NORMAL;
}
@ -4171,14 +4171,14 @@ void MAI_SnotSpil(int i)
if (monst->mtalkmsg == TEXT_BANNER12) {
if (!effect_is_playing(USFX_SNOT3) && monst->_mgoal == MGOAL_TALKING) {
ObjChangeMap(setpc_x, setpc_y, setpc_x + setpc_w + 1, setpc_y + setpc_h + 1);
quests[Q_LTBANNER]._qvar1 = 3;
Quests[Q_LTBANNER]._qvar1 = 3;
RedoPlayerVision();
monst->_msquelch = UINT8_MAX;
monst->mtalkmsg = TEXT_NONE;
monst->_mgoal = MGOAL_NORMAL;
}
}
if (quests[Q_LTBANNER]._qvar1 == 3) {
if (Quests[Q_LTBANNER]._qvar1 == 3) {
if (monst->_mgoal == MGOAL_NORMAL || monst->_mgoal == MGOAL_ATTACK2)
MAI_Fallen(i);
}
@ -4206,29 +4206,29 @@ void MAI_Lazurus(int i)
if (monst->mtalkmsg == TEXT_VILE13 && monst->_mgoal == MGOAL_INQUIRING && Players[MyPlayerId].position.tile.x == 35 && Players[MyPlayerId].position.tile.y == 46) {
PlayInGameMovie("gendata\\fprst3.smk");
monst->_mmode = MM_TALK;
quests[Q_BETRAYER]._qvar1 = 5;
Quests[Q_BETRAYER]._qvar1 = 5;
}
if (monst->mtalkmsg == TEXT_VILE13 && !effect_is_playing(USFX_LAZ1) && monst->_mgoal == MGOAL_TALKING) {
ObjChangeMapResync(1, 18, 20, 24);
RedoPlayerVision();
quests[Q_BETRAYER]._qvar1 = 6;
Quests[Q_BETRAYER]._qvar1 = 6;
monst->_mgoal = MGOAL_NORMAL;
monst->_msquelch = UINT8_MAX;
monst->mtalkmsg = TEXT_NONE;
}
}
if (gbIsMultiplayer && monst->mtalkmsg == TEXT_VILE13 && monst->_mgoal == MGOAL_INQUIRING && quests[Q_BETRAYER]._qvar1 <= 3) {
if (gbIsMultiplayer && monst->mtalkmsg == TEXT_VILE13 && monst->_mgoal == MGOAL_INQUIRING && Quests[Q_BETRAYER]._qvar1 <= 3) {
monst->_mmode = MM_TALK;
}
}
if (monst->_mgoal == MGOAL_NORMAL || monst->_mgoal == MGOAL_RETREAT || monst->_mgoal == MGOAL_MOVE) {
if (!gbIsMultiplayer && quests[Q_BETRAYER]._qvar1 == 4 && monst->mtalkmsg == TEXT_NONE) { // Fix save games affected by teleport bug
if (!gbIsMultiplayer && Quests[Q_BETRAYER]._qvar1 == 4 && monst->mtalkmsg == TEXT_NONE) { // Fix save games affected by teleport bug
ObjChangeMapResync(1, 18, 20, 24);
RedoPlayerVision();
quests[Q_BETRAYER]._qvar1 = 6;
Quests[Q_BETRAYER]._qvar1 = 6;
}
monst->mtalkmsg = TEXT_NONE;
MAI_Counselor(i);
@ -4252,7 +4252,7 @@ void MAI_Lazhelp(int i)
if ((dFlags[mx][my] & BFLAG_VISIBLE) != 0) {
if (!gbIsMultiplayer) {
if (quests[Q_BETRAYER]._qvar1 <= 5) {
if (Quests[Q_BETRAYER]._qvar1 <= 5) {
monst->_mgoal = MGOAL_INQUIRING;
} else {
monst->_mgoal = MGOAL_NORMAL;
@ -4290,7 +4290,7 @@ void MAI_Lachdanan(int i)
if (monst->mtalkmsg == TEXT_VEIL11) {
if (!effect_is_playing(USFX_LACH3) && monst->_mgoal == MGOAL_TALKING) {
monst->mtalkmsg = TEXT_NONE;
quests[Q_VEIL]._qactive = QUEST_DONE;
Quests[Q_VEIL]._qactive = QUEST_DONE;
M_StartKill(i, -1);
}
}
@ -5106,9 +5106,9 @@ void TalktoMonster(int i)
return;
}
if (QuestStatus(Q_LTBANNER) && quests[Q_LTBANNER]._qvar1 == 2) {
if (QuestStatus(Q_LTBANNER) && Quests[Q_LTBANNER]._qvar1 == 2) {
if (Players[pnum].TryRemoveInvItemById(IDI_BANNER)) {
quests[Q_LTBANNER]._qactive = QUEST_DONE;
Quests[Q_LTBANNER]._qactive = QUEST_DONE;
monst->mtalkmsg = TEXT_BANNER12;
monst->_mgoal = MGOAL_INQUIRING;
}

24
Source/msg.cpp

@ -244,10 +244,10 @@ byte *DeltaExportJunk(byte *dst)
int q = 0;
for (int i = 0; i < MAXQUESTS; i++) {
if (!questlist[i].isSinglePlayerOnly) {
sgJunk.quests[q].qlog = quests[i]._qlog ? 1 : 0;
sgJunk.quests[q].qstate = quests[i]._qactive;
sgJunk.quests[q].qvar1 = quests[i]._qvar1;
if (!QuestData[i].isSinglePlayerOnly) {
sgJunk.quests[q].qlog = Quests[i]._qlog ? 1 : 0;
sgJunk.quests[q].qstate = Quests[i]._qactive;
sgJunk.quests[q].qvar1 = Quests[i]._qvar1;
memcpy(dst, &sgJunk.quests[q], sizeof(MultiQuests));
dst += sizeof(MultiQuests);
q++;
@ -279,12 +279,12 @@ void DeltaImportJunk(byte *src)
int q = 0;
for (int i = 0; i < MAXQUESTS; i++) {
if (!questlist[i].isSinglePlayerOnly) {
if (!QuestData[i].isSinglePlayerOnly) {
memcpy(&sgJunk.quests[q], src, sizeof(MultiQuests));
src += sizeof(MultiQuests);
quests[i]._qlog = sgJunk.quests[q].qlog != 0;
quests[i]._qactive = sgJunk.quests[q].qstate;
quests[i]._qvar1 = sgJunk.quests[q].qvar1;
Quests[i]._qlog = sgJunk.quests[q].qlog != 0;
Quests[i]._qactive = sgJunk.quests[q].qstate;
Quests[i]._qvar1 = sgJunk.quests[q].qvar1;
q++;
}
}
@ -1778,7 +1778,7 @@ DWORD OnNakrul(TCmd *pCmd)
if (gbBufferMsgs != 1) {
OperateNakrulLever();
IsUberRoomOpened = true;
quests[Q_NAKRUL]._qactive = QUEST_DONE;
Quests[Q_NAKRUL]._qactive = QUEST_DONE;
monster_some_crypt();
}
return sizeof(*pCmd);
@ -2279,9 +2279,9 @@ void NetSendCmdQuest(bool bHiPri, BYTE q)
cmd.q = q;
cmd.bCmd = CMD_SYNCQUEST;
cmd.qstate = quests[q]._qactive;
cmd.qlog = quests[q]._qlog ? 1 : 0;
cmd.qvar1 = quests[q]._qvar1;
cmd.qstate = Quests[q]._qactive;
cmd.qlog = Quests[q]._qlog ? 1 : 0;
cmd.qvar1 = Quests[q]._qvar1;
if (bHiPri)
NetSendHiPri(MyPlayerId, (byte *)&cmd, sizeof(cmd));
else

66
Source/objects.cpp

@ -470,8 +470,8 @@ void AddTortures()
}
void AddCandles()
{
int tx = quests[Q_PWATER].position.x;
int ty = quests[Q_PWATER].position.y;
int tx = Quests[Q_PWATER].position.x;
int ty = Quests[Q_PWATER].position.y;
AddObject(OBJ_STORYCANDLE, tx - 2, ty + 1);
AddObject(OBJ_STORYCANDLE, tx + 3, ty + 1);
AddObject(OBJ_STORYCANDLE, tx - 1, ty + 2);
@ -1001,7 +1001,7 @@ void InitObjects()
AdvanceRndSeed();
if (currlevel == 9 && !gbIsMultiplayer)
AddSlainHero();
if (currlevel == quests[Q_MUSHROOM]._qlevel && quests[Q_MUSHROOM]._qactive == QUEST_INIT)
if (currlevel == Quests[Q_MUSHROOM]._qlevel && Quests[Q_MUSHROOM]._qactive == QUEST_INIT)
AddMushPatch();
if (currlevel == 4 || currlevel == 8 || currlevel == 12)
@ -1061,7 +1061,7 @@ void InitObjects()
spId = TEXT_BLINDING;
break;
}
quests[Q_BLIND]._qmsg = spId;
Quests[Q_BLIND]._qmsg = spId;
AddBookLever(setpc_x, setpc_y, setpc_w + setpc_x + 1, setpc_h + setpc_y + 1, spId);
LoadMapObjs("Levels\\L2Data\\Blind2.DUN", 2 * setpc_x, 2 * setpc_y);
}
@ -1087,7 +1087,7 @@ void InitObjects()
spId = TEXT_BLOODY;
break;
}
quests[Q_BLOOD]._qmsg = spId;
Quests[Q_BLOOD]._qmsg = spId;
AddBookLever(setpc_x, setpc_y + 3, setpc_x + 2, setpc_y + 7, spId);
AddObject(OBJ_PEDISTAL, 2 * setpc_x + 25, 2 * setpc_y + 32);
}
@ -1120,7 +1120,7 @@ void InitObjects()
spId = TEXT_BLOODWAR;
break;
}
quests[Q_WARLORD]._qmsg = spId;
Quests[Q_WARLORD]._qmsg = spId;
AddBookLever(setpc_x, setpc_y, setpc_x + setpc_w, setpc_y + setpc_h, spId);
LoadMapObjs("Levels\\L4Data\\Warlord.DUN", 2 * setpc_x, 2 * setpc_y);
}
@ -1903,8 +1903,8 @@ void Obj_Circle(int i)
if (ox == 35 && oy == 36 && object[i]._oVar5 == 3) {
object[i]._oVar6 = 4;
ObjChangeMapResync(object[i]._oVar1, object[i]._oVar2, object[i]._oVar3, object[i]._oVar4);
if (quests[Q_BETRAYER]._qactive == QUEST_ACTIVE && quests[Q_BETRAYER]._qvar1 <= 4) // BUGFIX stepping on the circle again will break the quest state (fixed)
quests[Q_BETRAYER]._qvar1 = 4;
if (Quests[Q_BETRAYER]._qactive == QUEST_ACTIVE && Quests[Q_BETRAYER]._qvar1 <= 4) // BUGFIX stepping on the circle again will break the quest state (fixed)
Quests[Q_BETRAYER]._qvar1 = 4;
AddMissile(Players[MyPlayerId].position.tile, { 35, 46 }, Players[MyPlayerId]._pdir, MIS_RNDTELEPORT, TARGET_MONSTERS, MyPlayerId, 0, 0);
track_repeat_walk(false);
sgbMouseDown = CLICK_NONE;
@ -2809,7 +2809,7 @@ void OperateLever(int pnum, int i)
OperateNakrulLever();
IsUberLeverActivated = true;
mapflag = false;
quests[Q_NAKRUL]._qactive = QUEST_DONE;
Quests[Q_NAKRUL]._qactive = QUEST_DONE;
}
if (mapflag)
ObjChangeMap(object[i]._oVar1, object[i]._oVar2, object[i]._oVar3, object[i]._oVar4);
@ -2861,7 +2861,7 @@ void OperateBook(int pnum, int i)
Players[pnum]._pMemSpells |= GetSpellBitmask(SPL_GUARDIAN);
if (Players[pnum]._pSplLvl[SPL_GUARDIAN] < MAX_SPELL_LEVEL)
Players[pnum]._pSplLvl[SPL_GUARDIAN]++;
quests[Q_SCHAMB]._qactive = QUEST_DONE;
Quests[Q_SCHAMB]._qactive = QUEST_DONE;
if (!deltaload)
PlaySfxLoc(IS_QUESTDN, object[i].position);
InitDiabloMsg(EMSG_BONECHAMB);
@ -2894,22 +2894,22 @@ void OperateBookLever(int pnum, int i)
return;
}
if (object[i]._oSelFlag != 0 && !qtextflag) {
if (object[i]._otype == OBJ_BLINDBOOK && quests[Q_BLIND]._qvar1 == 0) {
quests[Q_BLIND]._qactive = QUEST_ACTIVE;
quests[Q_BLIND]._qlog = true;
quests[Q_BLIND]._qvar1 = 1;
if (object[i]._otype == OBJ_BLINDBOOK && Quests[Q_BLIND]._qvar1 == 0) {
Quests[Q_BLIND]._qactive = QUEST_ACTIVE;
Quests[Q_BLIND]._qlog = true;
Quests[Q_BLIND]._qvar1 = 1;
}
if (object[i]._otype == OBJ_BLOODBOOK && quests[Q_BLOOD]._qvar1 == 0) {
quests[Q_BLOOD]._qactive = QUEST_ACTIVE;
quests[Q_BLOOD]._qlog = true;
quests[Q_BLOOD]._qvar1 = 1;
if (object[i]._otype == OBJ_BLOODBOOK && Quests[Q_BLOOD]._qvar1 == 0) {
Quests[Q_BLOOD]._qactive = QUEST_ACTIVE;
Quests[Q_BLOOD]._qlog = true;
Quests[Q_BLOOD]._qvar1 = 1;
SpawnQuestItem(IDI_BLDSTONE, { 2 * setpc_x + 25, 2 * setpc_y + 33 }, 0, 1);
}
object[i]._otype = object[i]._otype;
if (object[i]._otype == OBJ_STEELTOME && quests[Q_WARLORD]._qvar1 == 0) {
quests[Q_WARLORD]._qactive = QUEST_ACTIVE;
quests[Q_WARLORD]._qlog = true;
quests[Q_WARLORD]._qvar1 = 1;
if (object[i]._otype == OBJ_STEELTOME && Quests[Q_WARLORD]._qvar1 == 0) {
Quests[Q_WARLORD]._qactive = QUEST_ACTIVE;
Quests[Q_WARLORD]._qlog = true;
Quests[Q_WARLORD]._qvar1 = 1;
}
if (object[i]._oAnimFrame != object[i]._oVar6) {
if (object[i]._otype != OBJ_BLOODBOOK)
@ -2941,9 +2941,9 @@ void OperateSChambBk(int i)
SyncObjectAnim(objectactive[j]);
}
object[i]._oAnimFrame = object[i]._oVar6;
if (quests[Q_SCHAMB]._qactive == QUEST_INIT) {
quests[Q_SCHAMB]._qactive = QUEST_ACTIVE;
quests[Q_SCHAMB]._qlog = true;
if (Quests[Q_SCHAMB]._qactive == QUEST_INIT) {
Quests[Q_SCHAMB]._qactive = QUEST_ACTIVE;
Quests[Q_SCHAMB]._qlog = true;
}
_speech_id textdef;
@ -2967,7 +2967,7 @@ void OperateSChambBk(int i)
textdef = TEXT_BONER;
break;
}
quests[Q_SCHAMB]._qmsg = textdef;
Quests[Q_SCHAMB]._qmsg = textdef;
InitQTextMsg(textdef);
}
@ -3035,7 +3035,7 @@ void OperateMushPatch(int pnum, int i)
return;
}
if (quests[Q_MUSHROOM]._qactive != QUEST_ACTIVE) {
if (Quests[Q_MUSHROOM]._qactive != QUEST_ACTIVE) {
if (!deltaload && pnum == MyPlayerId) {
Players[MyPlayerId].Say(HeroSpeech::ICantUseThisYet);
}
@ -3050,7 +3050,7 @@ void OperateMushPatch(int pnum, int i)
if (!deltaload) {
Point pos = GetSuperItemLoc(object[i].position);
SpawnQuestItem(IDI_MUSHROOM, pos, 0, 0);
quests[Q_MUSHROOM]._qvar1 = QS_MUSHSPAWNED;
Quests[Q_MUSHROOM]._qvar1 = QS_MUSHSPAWNED;
}
}
}
@ -3061,7 +3061,7 @@ void OperateInnSignChest(int pnum, int i)
return;
}
if (quests[Q_LTBANNER]._qvar1 != 2) {
if (Quests[Q_LTBANNER]._qvar1 != 2) {
if (!deltaload && pnum == MyPlayerId) {
Players[MyPlayerId].Say(HeroSpeech::ICantOpenThisYet);
}
@ -4643,14 +4643,14 @@ void OperateStoryBook(int pnum, int i)
PlaySfxLoc(IS_ISCROL, object[i].position);
auto msg = static_cast<_speech_id>(object[i]._oVar2);
if (object[i]._oVar8 != 0 && currlevel == 24) {
if (!IsUberLeverActivated && quests[Q_NAKRUL]._qactive != QUEST_DONE && OperateNakrulBook(object[i]._oVar8)) {
if (!IsUberLeverActivated && Quests[Q_NAKRUL]._qactive != QUEST_DONE && OperateNakrulBook(object[i]._oVar8)) {
NetSendCmd(false, CMD_NAKRUL);
return;
}
} else if (currlevel >= 21) {
quests[Q_NAKRUL]._qactive = QUEST_ACTIVE;
quests[Q_NAKRUL]._qlog = true;
quests[Q_NAKRUL]._qmsg = msg;
Quests[Q_NAKRUL]._qactive = QUEST_ACTIVE;
Quests[Q_NAKRUL]._qlog = true;
Quests[Q_NAKRUL]._qmsg = msg;
}
InitQTextMsg(msg);
NetSendCmdParam1(false, CMD_OPERATEOBJ, i);

10
Source/player.cpp

@ -3598,8 +3598,8 @@ void CheckPlrSpell()
return;
if (
((chrflag || questlog) && MousePosition.x < SPANEL_WIDTH && MousePosition.y < SPANEL_HEIGHT) // inside left panel
|| ((invflag || sbookflag) && MousePosition.x > RIGHT_PANEL && MousePosition.y < SPANEL_HEIGHT) // inside right panel
((chrflag || QuestLogIsOpen) && MousePosition.x < SPANEL_WIDTH && MousePosition.y < SPANEL_HEIGHT) // inside left panel
|| ((invflag || sbookflag) && MousePosition.x > RIGHT_PANEL && MousePosition.y < SPANEL_HEIGHT) // inside right panel
) {
if (rspell != SPL_HEAL
&& rspell != SPL_IDENTIFY
@ -4056,9 +4056,9 @@ void PlayDungMsgs()
} else if (currlevel == 17 && !myPlayer._pLvlVisited[17] && !gbIsMultiplayer && (myPlayer.pDungMsgs2 & 1) == 0) {
sfxdelay = 10;
sfxdnum = USFX_DEFILER1;
quests[Q_DEFILER]._qactive = QUEST_ACTIVE;
quests[Q_DEFILER]._qlog = true;
quests[Q_DEFILER]._qmsg = TEXT_DEFILER1;
Quests[Q_DEFILER]._qactive = QUEST_ACTIVE;
Quests[Q_DEFILER]._qlog = true;
Quests[Q_DEFILER]._qmsg = TEXT_DEFILER1;
myPlayer.pDungMsgs2 |= 1;
} else if (currlevel == 19 && !myPlayer._pLvlVisited[19] && !gbIsMultiplayer && (myPlayer.pDungMsgs2 & 4) == 0) {
sfxdelay = 10;

2
Source/plrmsg.cpp

@ -112,7 +112,7 @@ void DrawPlrMsg(const Surface &out)
DWORD width = gnScreenWidth - 20;
_plrmsg *pMsg;
if (chrflag || questlog) {
if (chrflag || QuestLogIsOpen) {
x += SPANEL_WIDTH;
width -= SPANEL_WIDTH;
}

2
Source/qol/itemlabels.cpp

@ -95,7 +95,7 @@ bool IsMouseOverGameArea()
{
if ((invflag || sbookflag) && MousePosition.x > RIGHT_PANEL && MousePosition.y <= SPANEL_HEIGHT)
return false;
if ((chrflag || questlog) && MousePosition.x < SPANEL_WIDTH && MousePosition.y <= SPANEL_HEIGHT)
if ((chrflag || QuestLogIsOpen) && MousePosition.x < SPANEL_WIDTH && MousePosition.y <= SPANEL_HEIGHT)
return false;
if (MousePosition.y >= PANEL_TOP && MousePosition.x >= PANEL_LEFT && MousePosition.x <= PANEL_LEFT + PANEL_WIDTH)
return false;

2
Source/qol/monhealthbar.cpp

@ -68,7 +68,7 @@ void DrawMonsterHealthBar(const Surface &out)
if (CanPanelsCoverView()) {
if (invflag || sbookflag)
xPos -= SPANEL_WIDTH / 2;
if (chrflag || questlog)
if (chrflag || QuestLogIsOpen)
xPos += SPANEL_WIDTH / 2;
}

314
Source/quests.cpp

@ -26,21 +26,21 @@
namespace devilution {
int qtopline;
bool questlog;
bool QuestLogIsOpen;
std::optional<CelSprite> pQLogCel;
/** Contains the quests of the current game. */
QuestStruct quests[MAXQUESTS];
QuestStruct Quests[MAXQUESTS];
int qline;
int qlist[MAXQUESTS];
int numqlines;
int WaterDone;
int ReturnLvlX;
int ReturnLvlY;
dungeon_type ReturnLvlT;
int ReturnLvl;
dungeon_type ReturnLevelType;
int ReturnLevel;
/** Contains the data related to each quest_id. */
QuestData questlist[] = {
QuestDataStruct QuestData[] = {
// clang-format off
// _qdlvl, _qdmultlvl, _qlvlt, _qdtype, _qdrnd, _qslvl, isSinglePlayerOnly, _qdmsg, _qlstr
{ 5, -1, DTYPE_NONE, Q_ROCK, 100, SL_NONE, true, TEXT_INFRA5, N_( /* TRANSLATORS: Quest Name Block */ "The Magic Rock") },
@ -114,81 +114,81 @@ int QuestGroup4[2] = { Q_VEIL, Q_WARLORD };
void InitQuests()
{
if (!gbIsMultiplayer) {
for (auto &quest : quests) {
for (auto &quest : Quests) {
quest._qactive = QUEST_NOTAVAIL;
}
} else {
for (int i = 0; i < MAXQUESTS; i++) {
if (questlist[i].isSinglePlayerOnly) {
quests[i]._qactive = QUEST_NOTAVAIL;
if (QuestData[i].isSinglePlayerOnly) {
Quests[i]._qactive = QUEST_NOTAVAIL;
}
}
}
Qtalklist[TOWN_HEALER][Q_MUSHROOM] = TEXT_NONE;
Qtalklist[TOWN_WITCH][Q_MUSHROOM] = TEXT_MUSH9;
QuestDialogTable[TOWN_HEALER][Q_MUSHROOM] = TEXT_NONE;
QuestDialogTable[TOWN_WITCH][Q_MUSHROOM] = TEXT_MUSH9;
questlog = false;
QuestLogIsOpen = false;
WaterDone = 0;
int initiatedQuests = 0;
for (int i = 0; i < MAXQUESTS; i++) {
if (gbIsMultiplayer && questlist[i].isSinglePlayerOnly)
if (gbIsMultiplayer && QuestData[i].isSinglePlayerOnly)
continue;
quests[i]._qtype = questlist[i]._qdtype;
Quests[i]._qtype = QuestData[i]._qdtype;
if (gbIsMultiplayer) {
quests[i]._qlevel = questlist[i]._qdmultlvl;
Quests[i]._qlevel = QuestData[i]._qdmultlvl;
if (!delta_quest_inited(initiatedQuests)) {
quests[i]._qactive = QUEST_INIT;
quests[i]._qvar1 = 0;
quests[i]._qlog = false;
Quests[i]._qactive = QUEST_INIT;
Quests[i]._qvar1 = 0;
Quests[i]._qlog = false;
}
initiatedQuests++;
} else {
quests[i]._qactive = QUEST_INIT;
quests[i]._qlevel = questlist[i]._qdlvl;
quests[i]._qvar1 = 0;
quests[i]._qlog = false;
Quests[i]._qactive = QUEST_INIT;
Quests[i]._qlevel = QuestData[i]._qdlvl;
Quests[i]._qvar1 = 0;
Quests[i]._qlog = false;
}
quests[i]._qslvl = questlist[i]._qslvl;
quests[i].position = { 0, 0 };
quests[i]._qidx = i;
quests[i]._qlvltype = questlist[i]._qlvlt;
quests[i]._qvar2 = 0;
quests[i]._qmsg = questlist[i]._qdmsg;
Quests[i]._qslvl = QuestData[i]._qslvl;
Quests[i].position = { 0, 0 };
Quests[i]._qidx = i;
Quests[i]._qlvltype = QuestData[i]._qlvlt;
Quests[i]._qvar2 = 0;
Quests[i]._qmsg = QuestData[i]._qdmsg;
}
if (!gbIsMultiplayer && sgOptions.Gameplay.bRandomizeQuests) {
SetRndSeed(glSeedTbl[15]);
if (GenerateRnd(2) != 0)
quests[Q_PWATER]._qactive = QUEST_NOTAVAIL;
Quests[Q_PWATER]._qactive = QUEST_NOTAVAIL;
else
quests[Q_SKELKING]._qactive = QUEST_NOTAVAIL;
Quests[Q_SKELKING]._qactive = QUEST_NOTAVAIL;
quests[QuestGroup1[GenerateRnd(sizeof(QuestGroup1) / sizeof(int))]]._qactive = QUEST_NOTAVAIL;
quests[QuestGroup2[GenerateRnd(sizeof(QuestGroup2) / sizeof(int))]]._qactive = QUEST_NOTAVAIL;
quests[QuestGroup3[GenerateRnd(sizeof(QuestGroup3) / sizeof(int))]]._qactive = QUEST_NOTAVAIL;
quests[QuestGroup4[GenerateRnd(sizeof(QuestGroup4) / sizeof(int))]]._qactive = QUEST_NOTAVAIL;
Quests[QuestGroup1[GenerateRnd(sizeof(QuestGroup1) / sizeof(int))]]._qactive = QUEST_NOTAVAIL;
Quests[QuestGroup2[GenerateRnd(sizeof(QuestGroup2) / sizeof(int))]]._qactive = QUEST_NOTAVAIL;
Quests[QuestGroup3[GenerateRnd(sizeof(QuestGroup3) / sizeof(int))]]._qactive = QUEST_NOTAVAIL;
Quests[QuestGroup4[GenerateRnd(sizeof(QuestGroup4) / sizeof(int))]]._qactive = QUEST_NOTAVAIL;
}
#ifdef _DEBUG
if (questdebug != -1)
quests[questdebug]._qactive = QUEST_ACTIVE;
Quests[questdebug]._qactive = QUEST_ACTIVE;
#endif
if (gbIsSpawn) {
for (auto &quest : quests) {
for (auto &quest : Quests) {
quest._qactive = QUEST_NOTAVAIL;
}
}
if (quests[Q_SKELKING]._qactive == QUEST_NOTAVAIL)
quests[Q_SKELKING]._qvar2 = 2;
if (quests[Q_ROCK]._qactive == QUEST_NOTAVAIL)
quests[Q_ROCK]._qvar2 = 2;
quests[Q_LTBANNER]._qvar1 = 1;
if (Quests[Q_SKELKING]._qactive == QUEST_NOTAVAIL)
Quests[Q_SKELKING]._qvar2 = 2;
if (Quests[Q_ROCK]._qactive == QUEST_NOTAVAIL)
Quests[Q_ROCK]._qvar2 = 2;
Quests[Q_LTBANNER]._qvar1 = 1;
if (gbIsMultiplayer)
quests[Q_BETRAYER]._qvar1 = 2;
Quests[Q_BETRAYER]._qvar1 = 2;
}
void CheckQuests()
@ -196,9 +196,9 @@ void CheckQuests()
if (gbIsSpawn)
return;
if (QuestStatus(Q_BETRAYER) && gbIsMultiplayer && quests[Q_BETRAYER]._qvar1 == 2) {
if (QuestStatus(Q_BETRAYER) && gbIsMultiplayer && Quests[Q_BETRAYER]._qvar1 == 2) {
AddObject(OBJ_ALTBOY, 2 * setpc_x + 20, 2 * setpc_y + 22);
quests[Q_BETRAYER]._qvar1 = 3;
Quests[Q_BETRAYER]._qvar1 = 3;
NetSendCmdQuest(true, Q_BETRAYER);
}
@ -206,46 +206,46 @@ void CheckQuests()
return;
}
if (currlevel == quests[Q_BETRAYER]._qlevel
if (currlevel == Quests[Q_BETRAYER]._qlevel
&& !setlevel
&& quests[Q_BETRAYER]._qvar1 >= 2
&& (quests[Q_BETRAYER]._qactive == QUEST_ACTIVE || quests[Q_BETRAYER]._qactive == QUEST_DONE)
&& (quests[Q_BETRAYER]._qvar2 == 0 || quests[Q_BETRAYER]._qvar2 == 2)) {
quests[Q_BETRAYER].position.x = 2 * quests[Q_BETRAYER].position.x + 16;
quests[Q_BETRAYER].position.y = 2 * quests[Q_BETRAYER].position.y + 16;
int rportx = quests[Q_BETRAYER].position.x;
int rporty = quests[Q_BETRAYER].position.y;
&& Quests[Q_BETRAYER]._qvar1 >= 2
&& (Quests[Q_BETRAYER]._qactive == QUEST_ACTIVE || Quests[Q_BETRAYER]._qactive == QUEST_DONE)
&& (Quests[Q_BETRAYER]._qvar2 == 0 || Quests[Q_BETRAYER]._qvar2 == 2)) {
Quests[Q_BETRAYER].position.x = 2 * Quests[Q_BETRAYER].position.x + 16;
Quests[Q_BETRAYER].position.y = 2 * Quests[Q_BETRAYER].position.y + 16;
int rportx = Quests[Q_BETRAYER].position.x;
int rporty = Quests[Q_BETRAYER].position.y;
AddMissile({ rportx, rporty }, { rportx, rporty }, 0, MIS_RPORTAL, TARGET_MONSTERS, MyPlayerId, 0, 0);
quests[Q_BETRAYER]._qvar2 = 1;
if (quests[Q_BETRAYER]._qactive == QUEST_ACTIVE) {
quests[Q_BETRAYER]._qvar1 = 3;
Quests[Q_BETRAYER]._qvar2 = 1;
if (Quests[Q_BETRAYER]._qactive == QUEST_ACTIVE) {
Quests[Q_BETRAYER]._qvar1 = 3;
}
}
if (quests[Q_BETRAYER]._qactive == QUEST_DONE
if (Quests[Q_BETRAYER]._qactive == QUEST_DONE
&& setlevel
&& setlvlnum == SL_VILEBETRAYER
&& quests[Q_BETRAYER]._qvar2 == 4) {
&& Quests[Q_BETRAYER]._qvar2 == 4) {
int rportx = 35;
int rporty = 32;
AddMissile({ rportx, rporty }, { rportx, rporty }, 0, MIS_RPORTAL, TARGET_MONSTERS, MyPlayerId, 0, 0);
quests[Q_BETRAYER]._qvar2 = 3;
Quests[Q_BETRAYER]._qvar2 = 3;
}
if (setlevel) {
if (setlvlnum == quests[Q_PWATER]._qslvl
&& quests[Q_PWATER]._qactive != QUEST_INIT
&& leveltype == quests[Q_PWATER]._qlvltype
if (setlvlnum == Quests[Q_PWATER]._qslvl
&& Quests[Q_PWATER]._qactive != QUEST_INIT
&& leveltype == Quests[Q_PWATER]._qlvltype
&& ActiveMonsterCount == 4
&& quests[Q_PWATER]._qactive != QUEST_DONE) {
quests[Q_PWATER]._qactive = QUEST_DONE;
&& Quests[Q_PWATER]._qactive != QUEST_DONE) {
Quests[Q_PWATER]._qactive = QUEST_DONE;
PlaySfxLoc(IS_QUESTDN, Players[MyPlayerId].position.tile);
LoadPalette("Levels\\L3Data\\L3pwater.pal", false);
UpdatePWaterPalette();
WaterDone = 32;
}
} else if (Players[MyPlayerId]._pmode == PM_STAND) {
for (auto &quest : quests) {
for (auto &quest : Quests) {
if (currlevel == quest._qlevel
&& quest._qslvl != 0
&& quest._qactive != QUEST_NOTAVAIL
@ -269,10 +269,10 @@ bool ForceQuests()
}
for (int i = 0; i < MAXQUESTS; i++) {
if (i != Q_BETRAYER && currlevel == quests[i]._qlevel && quests[i]._qslvl != 0) {
int ql = quests[quests[i]._qidx]._qslvl - 1;
int qx = quests[i].position.x;
int qy = quests[i].position.y;
if (i != Q_BETRAYER && currlevel == Quests[i]._qlevel && Quests[i]._qslvl != 0) {
int ql = Quests[Quests[i]._qidx]._qslvl - 1;
int qx = Quests[i].position.x;
int qy = Quests[i].position.y;
for (int j = 0; j < 7; j++) {
if (qx + questxoff[j] == cursmx && qy + questyoff[j] == cursmy) {
@ -292,11 +292,11 @@ bool QuestStatus(int i)
{
if (setlevel)
return false;
if (currlevel != quests[i]._qlevel)
if (currlevel != Quests[i]._qlevel)
return false;
if (quests[i]._qactive == QUEST_NOTAVAIL)
if (Quests[i]._qactive == QUEST_NOTAVAIL)
return false;
if (gbIsMultiplayer && questlist[i].isSinglePlayerOnly)
if (gbIsMultiplayer && QuestData[i].isSinglePlayerOnly)
return false;
return true;
}
@ -307,26 +307,26 @@ void CheckQuestKill(int m, bool sendmsg)
return;
if (Monsters[m].MType->mtype == MT_SKING) {
quests[Q_SKELKING]._qactive = QUEST_DONE;
Quests[Q_SKELKING]._qactive = QUEST_DONE;
Players[MyPlayerId].Say(HeroSpeech::RestWellLeoricIllFindYourSon, 30);
if (sendmsg)
NetSendCmdQuest(true, Q_SKELKING);
} else if (Monsters[m].MType->mtype == MT_CLEAVER) {
quests[Q_BUTCHER]._qactive = QUEST_DONE;
Quests[Q_BUTCHER]._qactive = QUEST_DONE;
Players[MyPlayerId].Say(HeroSpeech::TheSpiritsOfTheDeadAreNowAvenged, 30);
if (sendmsg)
NetSendCmdQuest(true, Q_BUTCHER);
} else if (Monsters[m]._uniqtype - 1 == UMT_GARBUD) { //"Gharbad the Weak"
quests[Q_GARBUD]._qactive = QUEST_DONE;
Quests[Q_GARBUD]._qactive = QUEST_DONE;
Players[MyPlayerId].Say(HeroSpeech::ImNotImpressed, 30);
} else if (Monsters[m]._uniqtype - 1 == UMT_ZHAR) { //"Zhar the Mad"
quests[Q_ZHAR]._qactive = QUEST_DONE;
Quests[Q_ZHAR]._qactive = QUEST_DONE;
Players[MyPlayerId].Say(HeroSpeech::ImSorryDidIBreakYourConcentration, 30);
} else if (Monsters[m]._uniqtype - 1 == UMT_LAZURUS && gbIsMultiplayer) { //"Arch-Bishop Lazarus"
quests[Q_BETRAYER]._qactive = QUEST_DONE;
quests[Q_BETRAYER]._qvar1 = 7;
quests[Q_DIABLO]._qactive = QUEST_ACTIVE;
Quests[Q_BETRAYER]._qactive = QUEST_DONE;
Quests[Q_BETRAYER]._qvar1 = 7;
Quests[Q_DIABLO]._qactive = QUEST_ACTIVE;
for (int j = 0; j < MAXDUNY; j++) {
for (int i = 0; i < MAXDUNX; i++) {
@ -343,15 +343,15 @@ void CheckQuestKill(int m, bool sendmsg)
NetSendCmdQuest(true, Q_DIABLO);
}
} else if (Monsters[m]._uniqtype - 1 == UMT_LAZURUS && !gbIsMultiplayer) { //"Arch-Bishop Lazarus"
quests[Q_BETRAYER]._qactive = QUEST_DONE;
Quests[Q_BETRAYER]._qactive = QUEST_DONE;
InitVPTriggers();
quests[Q_BETRAYER]._qvar1 = 7;
quests[Q_BETRAYER]._qvar2 = 4;
quests[Q_DIABLO]._qactive = QUEST_ACTIVE;
Quests[Q_BETRAYER]._qvar1 = 7;
Quests[Q_BETRAYER]._qvar2 = 4;
Quests[Q_DIABLO]._qactive = QUEST_ACTIVE;
AddMissile({ 35, 32 }, { 35, 32 }, 0, MIS_RPORTAL, TARGET_MONSTERS, MyPlayerId, 0, 0);
Players[MyPlayerId].Say(HeroSpeech::YourMadnessEndsHereBetrayer, 30);
} else if (Monsters[m]._uniqtype - 1 == UMT_WARLORD) { //"Warlord of Blood"
quests[Q_WARLORD]._qactive = QUEST_DONE;
Quests[Q_WARLORD]._qactive = QUEST_DONE;
Players[MyPlayerId].Say(HeroSpeech::YourReignOfPainHasEnded, 30);
}
}
@ -365,7 +365,7 @@ void DrawButcher()
void DrawSkelKing(int q, int x, int y)
{
quests[q].position = { 2 * x + 28, 2 * y + 23 };
Quests[q].position = { 2 * x + 28, 2 * y + 23 };
}
void DrawWarLord(int x, int y)
@ -411,7 +411,7 @@ void DrawSChamber(int q, int x, int y)
}
}
quests[q].position = { 2 * x + 22, 2 * y + 23 };
Quests[q].position = { 2 * x + 22, 2 * y + 23 };
}
void DrawLTBanner(int x, int y)
@ -492,7 +492,7 @@ void DRLG_CheckQuests(int x, int y)
for (i = 0; i < MAXQUESTS; i++) {
if (QuestStatus(i)) {
switch (quests[i]._qtype) {
switch (Quests[i]._qtype) {
case Q_BUTCHER:
DrawButcher();
break;
@ -523,30 +523,30 @@ void SetReturnLvlPos()
{
switch (setlvlnum) {
case SL_SKELKING:
ReturnLvlX = quests[Q_SKELKING].position.x + 1;
ReturnLvlY = quests[Q_SKELKING].position.y;
ReturnLvl = quests[Q_SKELKING]._qlevel;
ReturnLvlT = DTYPE_CATHEDRAL;
ReturnLvlX = Quests[Q_SKELKING].position.x + 1;
ReturnLvlY = Quests[Q_SKELKING].position.y;
ReturnLevel = Quests[Q_SKELKING]._qlevel;
ReturnLevelType = DTYPE_CATHEDRAL;
break;
case SL_BONECHAMB:
ReturnLvlX = quests[Q_SCHAMB].position.x + 1;
ReturnLvlY = quests[Q_SCHAMB].position.y;
ReturnLvl = quests[Q_SCHAMB]._qlevel;
ReturnLvlT = DTYPE_CATACOMBS;
ReturnLvlX = Quests[Q_SCHAMB].position.x + 1;
ReturnLvlY = Quests[Q_SCHAMB].position.y;
ReturnLevel = Quests[Q_SCHAMB]._qlevel;
ReturnLevelType = DTYPE_CATACOMBS;
break;
case SL_MAZE:
break;
case SL_POISONWATER:
ReturnLvlX = quests[Q_PWATER].position.x;
ReturnLvlY = quests[Q_PWATER].position.y + 1;
ReturnLvl = quests[Q_PWATER]._qlevel;
ReturnLvlT = DTYPE_CATHEDRAL;
ReturnLvlX = Quests[Q_PWATER].position.x;
ReturnLvlY = Quests[Q_PWATER].position.y + 1;
ReturnLevel = Quests[Q_PWATER]._qlevel;
ReturnLevelType = DTYPE_CATHEDRAL;
break;
case SL_VILEBETRAYER:
ReturnLvlX = quests[Q_BETRAYER].position.x + 1;
ReturnLvlY = quests[Q_BETRAYER].position.y - 1;
ReturnLvl = quests[Q_BETRAYER]._qlevel;
ReturnLvlT = DTYPE_HELL;
ReturnLvlX = Quests[Q_BETRAYER].position.x + 1;
ReturnLvlY = Quests[Q_BETRAYER].position.y - 1;
ReturnLevel = Quests[Q_BETRAYER]._qlevel;
ReturnLevelType = DTYPE_HELL;
break;
case SL_NONE:
break;
@ -555,20 +555,20 @@ void SetReturnLvlPos()
void GetReturnLvlPos()
{
if (quests[Q_BETRAYER]._qactive == QUEST_DONE)
quests[Q_BETRAYER]._qvar2 = 2;
if (Quests[Q_BETRAYER]._qactive == QUEST_DONE)
Quests[Q_BETRAYER]._qvar2 = 2;
ViewX = ReturnLvlX;
ViewY = ReturnLvlY;
currlevel = ReturnLvl;
leveltype = ReturnLvlT;
currlevel = ReturnLevel;
leveltype = ReturnLevelType;
}
void LoadPWaterPalette()
{
if (!setlevel || setlvlnum != quests[Q_PWATER]._qslvl || quests[Q_PWATER]._qactive == QUEST_INIT || leveltype != quests[Q_PWATER]._qlvltype)
if (!setlevel || setlvlnum != Quests[Q_PWATER]._qslvl || Quests[Q_PWATER]._qactive == QUEST_INIT || leveltype != Quests[Q_PWATER]._qlvltype)
return;
if (quests[Q_PWATER]._qactive == QUEST_DONE)
if (Quests[Q_PWATER]._qactive == QUEST_DONE)
LoadPalette("Levels\\L3Data\\L3pwater.pal");
else
LoadPalette("Levels\\L3Data\\L3pfoul.pal");
@ -589,38 +589,38 @@ void ResyncMPQuests()
if (gbIsSpawn)
return;
if (quests[Q_SKELKING]._qactive == QUEST_INIT
&& currlevel >= quests[Q_SKELKING]._qlevel - 1
&& currlevel <= quests[Q_SKELKING]._qlevel + 1) {
quests[Q_SKELKING]._qactive = QUEST_ACTIVE;
if (Quests[Q_SKELKING]._qactive == QUEST_INIT
&& currlevel >= Quests[Q_SKELKING]._qlevel - 1
&& currlevel <= Quests[Q_SKELKING]._qlevel + 1) {
Quests[Q_SKELKING]._qactive = QUEST_ACTIVE;
NetSendCmdQuest(true, Q_SKELKING);
}
if (quests[Q_BUTCHER]._qactive == QUEST_INIT
&& currlevel >= quests[Q_BUTCHER]._qlevel - 1
&& currlevel <= quests[Q_BUTCHER]._qlevel + 1) {
quests[Q_BUTCHER]._qactive = QUEST_ACTIVE;
if (Quests[Q_BUTCHER]._qactive == QUEST_INIT
&& currlevel >= Quests[Q_BUTCHER]._qlevel - 1
&& currlevel <= Quests[Q_BUTCHER]._qlevel + 1) {
Quests[Q_BUTCHER]._qactive = QUEST_ACTIVE;
NetSendCmdQuest(true, Q_BUTCHER);
}
if (quests[Q_BETRAYER]._qactive == QUEST_INIT && currlevel == quests[Q_BETRAYER]._qlevel - 1) {
quests[Q_BETRAYER]._qactive = QUEST_ACTIVE;
if (Quests[Q_BETRAYER]._qactive == QUEST_INIT && currlevel == Quests[Q_BETRAYER]._qlevel - 1) {
Quests[Q_BETRAYER]._qactive = QUEST_ACTIVE;
NetSendCmdQuest(true, Q_BETRAYER);
}
if (QuestStatus(Q_BETRAYER))
AddObject(OBJ_ALTBOY, 2 * setpc_x + 20, 2 * setpc_y + 22);
if (quests[Q_GRAVE]._qactive == QUEST_INIT && currlevel == quests[Q_GRAVE]._qlevel - 1) {
quests[Q_GRAVE]._qactive = QUEST_ACTIVE;
if (Quests[Q_GRAVE]._qactive == QUEST_INIT && currlevel == Quests[Q_GRAVE]._qlevel - 1) {
Quests[Q_GRAVE]._qactive = QUEST_ACTIVE;
NetSendCmdQuest(true, Q_GRAVE);
}
if (quests[Q_DEFILER]._qactive == QUEST_INIT && currlevel == quests[Q_DEFILER]._qlevel - 1) {
quests[Q_DEFILER]._qactive = QUEST_ACTIVE;
if (Quests[Q_DEFILER]._qactive == QUEST_INIT && currlevel == Quests[Q_DEFILER]._qlevel - 1) {
Quests[Q_DEFILER]._qactive = QUEST_ACTIVE;
NetSendCmdQuest(true, Q_DEFILER);
}
if (quests[Q_NAKRUL]._qactive == QUEST_INIT && currlevel == quests[Q_NAKRUL]._qlevel - 1) {
quests[Q_NAKRUL]._qactive = QUEST_ACTIVE;
if (Quests[Q_NAKRUL]._qactive == QUEST_INIT && currlevel == Quests[Q_NAKRUL]._qlevel - 1) {
Quests[Q_NAKRUL]._qactive = QUEST_ACTIVE;
NetSendCmdQuest(true, Q_NAKRUL);
}
if (quests[Q_JERSEY]._qactive == QUEST_INIT && currlevel == quests[Q_JERSEY]._qlevel - 1) {
quests[Q_JERSEY]._qactive = QUEST_ACTIVE;
if (Quests[Q_JERSEY]._qactive == QUEST_INIT && currlevel == Quests[Q_JERSEY]._qlevel - 1) {
Quests[Q_JERSEY]._qactive = QUEST_ACTIVE;
NetSendCmdQuest(true, Q_JERSEY);
}
}
@ -631,14 +631,14 @@ void ResyncQuests()
return;
if (QuestStatus(Q_LTBANNER)) {
if (quests[Q_LTBANNER]._qvar1 == 1) {
if (Quests[Q_LTBANNER]._qvar1 == 1) {
ObjChangeMapResync(
setpc_w + setpc_x - 2,
setpc_h + setpc_y - 2,
setpc_w + setpc_x + 1,
setpc_h + setpc_y + 1);
}
if (quests[Q_LTBANNER]._qvar1 == 2) {
if (Quests[Q_LTBANNER]._qvar1 == 2) {
ObjChangeMapResync(
setpc_w + setpc_x - 2,
setpc_h + setpc_y - 2,
@ -652,7 +652,7 @@ void ResyncQuests()
DRLG_MRectTrans(setpc_x, setpc_y, (setpc_w / 2) + setpc_x + 4, setpc_y + (setpc_h / 2));
TransVal = tren;
}
if (quests[Q_LTBANNER]._qvar1 == 3) {
if (Quests[Q_LTBANNER]._qvar1 == 3) {
int x = setpc_x;
int y = setpc_y;
ObjChangeMapResync(x, y, x + setpc_w + 1, y + setpc_h + 1);
@ -664,40 +664,40 @@ void ResyncQuests()
TransVal = tren;
}
}
if (currlevel == quests[Q_MUSHROOM]._qlevel) {
if (quests[Q_MUSHROOM]._qactive == QUEST_INIT && quests[Q_MUSHROOM]._qvar1 == QS_INIT) {
if (currlevel == Quests[Q_MUSHROOM]._qlevel) {
if (Quests[Q_MUSHROOM]._qactive == QUEST_INIT && Quests[Q_MUSHROOM]._qvar1 == QS_INIT) {
SpawnQuestItem(IDI_FUNGALTM, { 0, 0 }, 5, 1);
quests[Q_MUSHROOM]._qvar1 = QS_TOMESPAWNED;
Quests[Q_MUSHROOM]._qvar1 = QS_TOMESPAWNED;
} else {
if (quests[Q_MUSHROOM]._qactive == QUEST_ACTIVE) {
if (quests[Q_MUSHROOM]._qvar1 >= QS_MUSHGIVEN) {
Qtalklist[TOWN_WITCH][Q_MUSHROOM] = TEXT_NONE;
Qtalklist[TOWN_HEALER][Q_MUSHROOM] = TEXT_MUSH3;
} else if (quests[Q_MUSHROOM]._qvar1 >= QS_BRAINGIVEN) {
Qtalklist[TOWN_HEALER][Q_MUSHROOM] = TEXT_NONE;
if (Quests[Q_MUSHROOM]._qactive == QUEST_ACTIVE) {
if (Quests[Q_MUSHROOM]._qvar1 >= QS_MUSHGIVEN) {
QuestDialogTable[TOWN_WITCH][Q_MUSHROOM] = TEXT_NONE;
QuestDialogTable[TOWN_HEALER][Q_MUSHROOM] = TEXT_MUSH3;
} else if (Quests[Q_MUSHROOM]._qvar1 >= QS_BRAINGIVEN) {
QuestDialogTable[TOWN_HEALER][Q_MUSHROOM] = TEXT_NONE;
}
}
}
}
if (currlevel == quests[Q_VEIL]._qlevel + 1 && quests[Q_VEIL]._qactive == QUEST_ACTIVE && quests[Q_VEIL]._qvar1 == 0) {
quests[Q_VEIL]._qvar1 = 1;
if (currlevel == Quests[Q_VEIL]._qlevel + 1 && Quests[Q_VEIL]._qactive == QUEST_ACTIVE && Quests[Q_VEIL]._qvar1 == 0) {
Quests[Q_VEIL]._qvar1 = 1;
SpawnQuestItem(IDI_GLDNELIX, { 0, 0 }, 5, 1);
}
if (setlevel && setlvlnum == SL_VILEBETRAYER) {
if (quests[Q_BETRAYER]._qvar1 >= 4)
if (Quests[Q_BETRAYER]._qvar1 >= 4)
ObjChangeMapResync(1, 11, 20, 18);
if (quests[Q_BETRAYER]._qvar1 >= 6)
if (Quests[Q_BETRAYER]._qvar1 >= 6)
ObjChangeMapResync(1, 18, 20, 24);
if (quests[Q_BETRAYER]._qvar1 >= 7)
if (Quests[Q_BETRAYER]._qvar1 >= 7)
InitVPTriggers();
for (int i = 0; i < nobjects; i++)
SyncObjectAnim(objectactive[i]);
}
if (currlevel == quests[Q_BETRAYER]._qlevel
if (currlevel == Quests[Q_BETRAYER]._qlevel
&& !setlevel
&& (quests[Q_BETRAYER]._qvar2 == 1 || quests[Q_BETRAYER]._qvar2 >= 3)
&& (quests[Q_BETRAYER]._qactive == QUEST_ACTIVE || quests[Q_BETRAYER]._qactive == QUEST_DONE)) {
quests[Q_BETRAYER]._qvar2 = 2;
&& (Quests[Q_BETRAYER]._qvar2 == 1 || Quests[Q_BETRAYER]._qvar2 >= 3)
&& (Quests[Q_BETRAYER]._qactive == QUEST_ACTIVE || Quests[Q_BETRAYER]._qactive == QUEST_DONE)) {
Quests[Q_BETRAYER]._qvar2 = 2;
}
}
@ -721,7 +721,7 @@ void DrawQuestLog(const Surface &out)
CelDrawTo(out, { 0, 351 }, *pQLogCel, 1);
int line = qtopline;
for (int i = 0; i < numqlines; i++) {
PrintQLString(out, 32, line, _(questlist[qlist[i]]._qlstr));
PrintQLString(out, 32, line, _(QuestData[qlist[i]]._qlstr));
line += 2;
}
PrintQLString(out, 32, 22, _("Close Quest Log"));
@ -733,7 +733,7 @@ void StartQuestlog()
numqlines = 0;
for (i = 0; i < MAXQUESTS; i++) {
if (quests[i]._qactive == QUEST_ACTIVE && quests[i]._qlog) {
if (Quests[i]._qactive == QUEST_ACTIVE && Quests[i]._qlog) {
qlist[numqlines] = i;
numqlines++;
}
@ -746,7 +746,7 @@ void StartQuestlog()
qline = 22;
if (numqlines != 0)
qline = qtopline;
questlog = true;
QuestLogIsOpen = true;
}
void QuestlogUp()
@ -781,8 +781,8 @@ void QuestlogEnter()
{
PlaySFX(IS_TITLSLCT);
if (numqlines != 0 && qline != 22)
InitQTextMsg(quests[qlist[(qline - qtopline) / 2]]._qmsg);
questlog = false;
InitQTextMsg(Quests[qlist[(qline - qtopline) / 2]]._qmsg);
QuestLogIsOpen = false;
}
void QuestlogESC()
@ -805,13 +805,13 @@ void SetMultiQuest(int q, quest_state s, bool log, int v1)
if (gbIsSpawn)
return;
if (quests[q]._qactive != QUEST_DONE) {
if (s > quests[q]._qactive)
quests[q]._qactive = s;
if (Quests[q]._qactive != QUEST_DONE) {
if (s > Quests[q]._qactive)
Quests[q]._qactive = s;
if (log)
quests[q]._qlog = true;
if (v1 > quests[q]._qvar1)
quests[q]._qvar1 = v1;
Quests[q]._qlog = true;
if (v1 > Quests[q]._qvar1)
Quests[q]._qvar1 = v1;
}
}

12
Source/quests.h

@ -56,7 +56,7 @@ struct QuestStruct {
bool _qlog;
};
struct QuestData {
struct QuestDataStruct {
uint8_t _qdlvl;
int8_t _qdmultlvl;
dungeon_type _qlvlt;
@ -68,13 +68,13 @@ struct QuestData {
const char *_qlstr;
};
extern bool questlog;
extern bool QuestLogIsOpen;
extern std::optional<CelSprite> pQLogCel;
extern QuestStruct quests[MAXQUESTS];
extern QuestStruct Quests[MAXQUESTS];
extern int ReturnLvlX;
extern int ReturnLvlY;
extern dungeon_type ReturnLvlT;
extern int ReturnLvl;
extern dungeon_type ReturnLevelType;
extern int ReturnLevel;
void InitQuests();
void CheckQuests();
@ -97,6 +97,6 @@ void QuestlogESC();
void SetMultiQuest(int q, quest_state s, bool log, int v1);
/* rdata */
extern QuestData questlist[];
extern QuestDataStruct QuestData[];
} // namespace devilution

18
Source/scrollrt.cpp

@ -774,13 +774,13 @@ static void DrawMonsterHelper(const Surface &out, int x, int y, int oy, int sx,
mi = mi > 0 ? mi - 1 : -(mi + 1);
if (leveltype == DTYPE_TOWN) {
int px = sx - CalculateWidth2(towners[mi]._tAnimWidth);
int px = sx - CalculateWidth2(Towners[mi]._tAnimWidth);
const Point position { px, sy };
if (mi == pcursmonst) {
CelBlitOutlineTo(out, 166, position, CelSprite(towners[mi]._tAnimData, towners[mi]._tAnimWidth), towners[mi]._tAnimFrame);
CelBlitOutlineTo(out, 166, position, CelSprite(Towners[mi]._tAnimData, Towners[mi]._tAnimWidth), Towners[mi]._tAnimFrame);
}
assert(towners[mi]._tAnimData);
CelClippedDrawTo(out, position, CelSprite(towners[mi]._tAnimData, towners[mi]._tAnimWidth), towners[mi]._tAnimFrame);
assert(Towners[mi]._tAnimData);
CelClippedDrawTo(out, position, CelSprite(Towners[mi]._tAnimData, Towners[mi]._tAnimWidth), Towners[mi]._tAnimFrame);
return;
}
@ -1069,7 +1069,7 @@ static void Zoom(const Surface &out)
int viewportWidth = out.w();
int viewportOffsetX = 0;
if (CanPanelsCoverView()) {
if (chrflag || questlog) {
if (chrflag || QuestLogIsOpen) {
viewportWidth -= SPANEL_WIDTH;
viewportOffsetX = SPANEL_WIDTH;
} else if (invflag || sbookflag) {
@ -1286,7 +1286,7 @@ static void DrawGame(const Surface &fullOut, int x, int y)
// Skip rendering parts covered by the panels
if (CanPanelsCoverView()) {
if (zoomflag) {
if (chrflag || questlog) {
if (chrflag || QuestLogIsOpen) {
ShiftGrid(&x, &y, 2, 0);
columns -= 4;
sx += SPANEL_WIDTH - TILE_WIDTH / 2;
@ -1297,7 +1297,7 @@ static void DrawGame(const Surface &fullOut, int x, int y)
sx += -TILE_WIDTH / 2;
}
} else {
if (chrflag || questlog) {
if (chrflag || QuestLogIsOpen) {
ShiftGrid(&x, &y, 1, 0);
columns -= 2;
sx += -TILE_WIDTH / 2 / 2; // SPANEL_WIDTH accounted for in Zoom()
@ -1389,11 +1389,11 @@ void DrawView(const Surface &out, int startX, int startY)
if (chrflag) {
DrawChr(out);
} else if (questlog) {
} else if (QuestLogIsOpen) {
DrawQuestLog(out);
}
if (!chrflag && Players[MyPlayerId]._pStatPts != 0 && !spselflag
&& (!questlog || gnScreenHeight >= SPANEL_HEIGHT + PANEL_HEIGHT + 74 || gnScreenWidth >= 4 * SPANEL_WIDTH)) {
&& (!QuestLogIsOpen || gnScreenHeight >= SPANEL_HEIGHT + PANEL_HEIGHT + 74 || gnScreenWidth >= 4 * SPANEL_WIDTH)) {
DrawLevelUpIcon(out);
}
if (ShowUniqueItemInfoBox) {

18
Source/setmaps.cpp

@ -148,9 +148,9 @@ void LoadSetMap()
{
switch (setlvlnum) {
case SL_SKELKING:
if (quests[Q_SKELKING]._qactive == QUEST_INIT) {
quests[Q_SKELKING]._qactive = QUEST_ACTIVE;
quests[Q_SKELKING]._qvar1 = 1;
if (Quests[Q_SKELKING]._qactive == QUEST_INIT) {
Quests[Q_SKELKING]._qactive = QUEST_ACTIVE;
Quests[Q_SKELKING]._qvar1 = 1;
}
LoadPreL1Dungeon("Levels\\L1Data\\SklKng1.DUN");
LoadL1Dungeon("Levels\\L1Data\\SklKng2.DUN", 83, 45);
@ -182,18 +182,18 @@ void LoadSetMap()
DRLG_SetMapTrans("Levels\\L1Data\\Lv1MazeA.DUN");
break;
case SL_POISONWATER:
if (quests[Q_PWATER]._qactive == QUEST_INIT)
quests[Q_PWATER]._qactive = QUEST_ACTIVE;
if (Quests[Q_PWATER]._qactive == QUEST_INIT)
Quests[Q_PWATER]._qactive = QUEST_ACTIVE;
LoadPreL3Dungeon("Levels\\L3Data\\Foulwatr.DUN");
LoadL3Dungeon("Levels\\L3Data\\Foulwatr.DUN", 31, 83);
LoadPalette("Levels\\L3Data\\L3pfoul.pal");
InitPWaterTriggers();
break;
case SL_VILEBETRAYER:
if (quests[Q_BETRAYER]._qactive == QUEST_DONE) {
quests[Q_BETRAYER]._qvar2 = 4;
} else if (quests[Q_BETRAYER]._qactive == QUEST_ACTIVE) {
quests[Q_BETRAYER]._qvar2 = 3;
if (Quests[Q_BETRAYER]._qactive == QUEST_DONE) {
Quests[Q_BETRAYER]._qvar2 = 4;
} else if (Quests[Q_BETRAYER]._qactive == QUEST_ACTIVE) {
Quests[Q_BETRAYER]._qvar2 = 3;
}
LoadPreL1Dungeon("Levels\\L1Data\\Vile1.DUN");
LoadL1Dungeon("Levels\\L1Data\\Vile2.DUN", 35, 36);

16
Source/stores.cpp

@ -1199,7 +1199,7 @@ void StartTalk()
int sn = 0;
for (int i = 0; i < MAXQUESTS; i++) {
if (quests[i]._qactive == QUEST_ACTIVE && Qtalklist[talker][i] != TEXT_NONE && quests[i]._qlog)
if (Quests[i]._qactive == QUEST_ACTIVE && QuestDialogTable[talker][i] != TEXT_NONE && Quests[i]._qlog)
sn++;
}
@ -1214,8 +1214,8 @@ void StartTalk()
int sn2 = sn - 2;
for (int i = 0; i < MAXQUESTS; i++) {
if (quests[i]._qactive == QUEST_ACTIVE && Qtalklist[talker][i] != TEXT_NONE && quests[i]._qlog) {
AddSText(0, sn, _(questlist[i]._qlstr), UIS_SILVER | UIS_CENTER, true);
if (Quests[i]._qactive == QUEST_ACTIVE && QuestDialogTable[talker][i] != TEXT_NONE && Quests[i]._qlog) {
AddSText(0, sn, _(QuestData[i]._qlstr), UIS_SILVER | UIS_CENTER, true);
sn += la;
}
}
@ -2044,7 +2044,7 @@ void TalkEnter()
int sn = 0;
for (int i = 0; i < MAXQUESTS; i++) {
if (quests[i]._qactive == QUEST_ACTIVE && Qtalklist[talker][i] != TEXT_NONE && quests[i]._qlog)
if (Quests[i]._qactive == QUEST_ACTIVE && QuestDialogTable[talker][i] != TEXT_NONE && Quests[i]._qlog)
sn++;
}
int la = 2;
@ -2056,16 +2056,16 @@ void TalkEnter()
}
if (stextsel == sn - 2) {
SetRndSeed(towners[talker]._tSeed);
SetRndSeed(Towners[talker]._tSeed);
auto tq = static_cast<_speech_id>(gossipstart + GenerateRnd(gossipend - gossipstart + 1));
InitQTextMsg(tq);
return;
}
for (int i = 0; i < MAXQUESTS; i++) {
if (quests[i]._qactive == QUEST_ACTIVE && Qtalklist[talker][i] != TEXT_NONE && quests[i]._qlog) {
if (Quests[i]._qactive == QUEST_ACTIVE && QuestDialogTable[talker][i] != TEXT_NONE && Quests[i]._qlog) {
if (sn == stextsel) {
InitQTextMsg(Qtalklist[talker][i]);
InitQTextMsg(QuestDialogTable[talker][i]);
}
sn += la;
}
@ -2327,7 +2327,7 @@ void StartStore(talk_id s)
sbookflag = false;
invflag = false;
chrflag = false;
questlog = false;
QuestLogIsOpen = false;
dropGoldFlag = false;
ClearSText(0, STORE_LINES);
ReleaseStoreBtn();

8
Source/town.cpp

@ -182,19 +182,19 @@ void DrlgTPass3()
}
}
if (gbIsHellfire) {
if (quests[Q_FARMER]._qactive == QUEST_DONE || quests[Q_FARMER]._qactive == QUEST_HIVE_DONE
|| quests[Q_JERSEY]._qactive == QUEST_DONE || quests[Q_JERSEY]._qactive == QUEST_HIVE_DONE) {
if (Quests[Q_FARMER]._qactive == QUEST_DONE || Quests[Q_FARMER]._qactive == QUEST_HIVE_DONE
|| Quests[Q_JERSEY]._qactive == QUEST_DONE || Quests[Q_JERSEY]._qactive == QUEST_HIVE_DONE) {
TownOpenHive();
} else {
TownCloseHive();
}
if (quests[Q_GRAVE]._qactive == QUEST_DONE || Players[MyPlayerId]._pLvlVisited[21])
if (Quests[Q_GRAVE]._qactive == QUEST_DONE || Players[MyPlayerId]._pLvlVisited[21])
TownOpenGrave();
else
TownCloseGrave();
}
if (quests[Q_PWATER]._qactive != QUEST_DONE && quests[Q_PWATER]._qactive != QUEST_NOTAVAIL) {
if (Quests[Q_PWATER]._qactive != QUEST_DONE && Quests[Q_PWATER]._qactive != QUEST_NOTAVAIL) {
FillTile(60, 70, 342);
} else {
FillTile(60, 70, 71);

256
Source/towners.cpp

@ -45,7 +45,7 @@ void NewTownerAnim(TownerStruct &towner, byte *pAnim, uint8_t numFrames, int del
void InitTownerInfo(int i, const TownerInit &initData)
{
auto &towner = towners[i];
auto &towner = Towners[i];
towner._ttype = initData.type;
towner.position = initData.position;
@ -250,7 +250,7 @@ void InitFarmer(TownerStruct &towner, const TownerInit &initData)
void InitCowFarmer(TownerStruct &towner, const TownerInit &initData)
{
const char *celPath = "Towners\\Farmer\\cfrmrn2.CEL";
if (quests[Q_JERSEY]._qactive == QUEST_DONE) {
if (Quests[Q_JERSEY]._qactive == QUEST_DONE) {
celPath = "Towners\\Farmer\\mfrmrn2.CEL";
}
towner._tAnimWidth = 96;
@ -263,7 +263,7 @@ void InitCowFarmer(TownerStruct &towner, const TownerInit &initData)
void InitGirl(TownerStruct &towner, const TownerInit &initData)
{
const char *celPath = "Towners\\Girl\\Girlw1.CEL";
if (quests[Q_GIRL]._qactive == QUEST_DONE) {
if (Quests[Q_GIRL]._qactive == QUEST_DONE) {
celPath = "Towners\\Girl\\Girls1.CEL";
}
towner._tAnimWidth = 96;
@ -276,12 +276,12 @@ void InitGirl(TownerStruct &towner, const TownerInit &initData)
void TownDead(TownerStruct &towner)
{
if (qtextflag) {
if (quests[Q_BUTCHER]._qvar1 == 1)
if (Quests[Q_BUTCHER]._qvar1 == 1)
towner._tAnimCnt = 0; // Freeze while speaking
return;
}
if ((quests[Q_BUTCHER]._qactive == QUEST_DONE || quests[Q_BUTCHER]._qvar1 == 1) && towner._tAnimLen != 1) {
if ((Quests[Q_BUTCHER]._qactive == QUEST_DONE || Quests[Q_BUTCHER]._qvar1 == 1) && towner._tAnimLen != 1) {
towner._tAnimLen = 1;
towner._tName = _("Slain Townsman");
}
@ -301,22 +301,22 @@ void TalkToBarOwner(PlayerStruct &player, TownerStruct &barOwner)
return;
}
if (quests[Q_SKELKING]._qactive != QUEST_NOTAVAIL) {
if (Quests[Q_SKELKING]._qactive != QUEST_NOTAVAIL) {
if (player._pLvlVisited[2] || player._pLvlVisited[4]) {
if (quests[Q_SKELKING]._qvar2 == 0) {
quests[Q_SKELKING]._qvar2 = 1;
quests[Q_SKELKING]._qlog = true;
if (quests[Q_SKELKING]._qactive == QUEST_INIT) {
quests[Q_SKELKING]._qactive = QUEST_ACTIVE;
quests[Q_SKELKING]._qvar1 = 1;
if (Quests[Q_SKELKING]._qvar2 == 0) {
Quests[Q_SKELKING]._qvar2 = 1;
Quests[Q_SKELKING]._qlog = true;
if (Quests[Q_SKELKING]._qactive == QUEST_INIT) {
Quests[Q_SKELKING]._qactive = QUEST_ACTIVE;
Quests[Q_SKELKING]._qvar1 = 1;
}
InitQTextMsg(TEXT_KING2);
NetSendCmdQuest(true, Q_SKELKING);
return;
}
if (quests[Q_SKELKING]._qactive == QUEST_DONE && quests[Q_SKELKING]._qvar2 == 1) {
quests[Q_SKELKING]._qvar2 = 2;
quests[Q_SKELKING]._qvar1 = 2;
if (Quests[Q_SKELKING]._qactive == QUEST_DONE && Quests[Q_SKELKING]._qvar2 == 1) {
Quests[Q_SKELKING]._qvar2 = 2;
Quests[Q_SKELKING]._qvar1 = 2;
InitQTextMsg(TEXT_KING4);
NetSendCmdQuest(true, Q_SKELKING);
return;
@ -324,22 +324,22 @@ void TalkToBarOwner(PlayerStruct &player, TownerStruct &barOwner)
}
}
if (quests[Q_LTBANNER]._qactive != QUEST_NOTAVAIL) {
if (player._pLvlVisited[3] && quests[Q_LTBANNER]._qactive != QUEST_DONE) {
if (quests[Q_LTBANNER]._qvar2 == 0) {
quests[Q_LTBANNER]._qvar2 = 1;
if (quests[Q_LTBANNER]._qactive == QUEST_INIT) {
quests[Q_LTBANNER]._qvar1 = 1;
quests[Q_LTBANNER]._qactive = QUEST_ACTIVE;
if (Quests[Q_LTBANNER]._qactive != QUEST_NOTAVAIL) {
if (player._pLvlVisited[3] && Quests[Q_LTBANNER]._qactive != QUEST_DONE) {
if (Quests[Q_LTBANNER]._qvar2 == 0) {
Quests[Q_LTBANNER]._qvar2 = 1;
if (Quests[Q_LTBANNER]._qactive == QUEST_INIT) {
Quests[Q_LTBANNER]._qvar1 = 1;
Quests[Q_LTBANNER]._qactive = QUEST_ACTIVE;
}
quests[Q_LTBANNER]._qlog = true;
Quests[Q_LTBANNER]._qlog = true;
InitQTextMsg(TEXT_BANNER2);
return;
}
if (quests[Q_LTBANNER]._qvar2 == 1 && player.TryRemoveInvItemById(IDI_BANNER)) {
quests[Q_LTBANNER]._qactive = QUEST_DONE;
quests[Q_LTBANNER]._qvar1 = 3;
if (Quests[Q_LTBANNER]._qvar2 == 1 && player.TryRemoveInvItemById(IDI_BANNER)) {
Quests[Q_LTBANNER]._qactive = QUEST_DONE;
Quests[Q_LTBANNER]._qvar1 = 3;
SpawnUnique(UITEM_HARCREST, barOwner.position + DIR_SW);
InitQTextMsg(TEXT_BANNER3);
return;
@ -353,58 +353,58 @@ void TalkToBarOwner(PlayerStruct &player, TownerStruct &barOwner)
void TalkToDeadguy(PlayerStruct &player, TownerStruct & /*deadguy*/)
{
if (quests[Q_BUTCHER]._qactive == QUEST_DONE)
if (Quests[Q_BUTCHER]._qactive == QUEST_DONE)
return;
if (quests[Q_BUTCHER]._qvar1 == 1) {
if (Quests[Q_BUTCHER]._qvar1 == 1) {
player.SaySpecific(HeroSpeech::YourDeathWillBeAvenged);
return;
}
quests[Q_BUTCHER]._qactive = QUEST_ACTIVE;
quests[Q_BUTCHER]._qlog = true;
quests[Q_BUTCHER]._qmsg = TEXT_BUTCH9;
quests[Q_BUTCHER]._qvar1 = 1;
Quests[Q_BUTCHER]._qactive = QUEST_ACTIVE;
Quests[Q_BUTCHER]._qlog = true;
Quests[Q_BUTCHER]._qmsg = TEXT_BUTCH9;
Quests[Q_BUTCHER]._qvar1 = 1;
InitQTextMsg(TEXT_BUTCH9);
NetSendCmdQuest(true, Q_BUTCHER);
}
void TalkToBlackSmith(PlayerStruct &player, TownerStruct &blackSmith)
{
if (quests[Q_ROCK]._qactive != QUEST_NOTAVAIL) {
if (player._pLvlVisited[4] && quests[Q_ROCK]._qactive != QUEST_DONE) {
if (quests[Q_ROCK]._qvar2 == 0) {
quests[Q_ROCK]._qvar2 = 1;
quests[Q_ROCK]._qlog = true;
if (quests[Q_ROCK]._qactive == QUEST_INIT) {
quests[Q_ROCK]._qactive = QUEST_ACTIVE;
if (Quests[Q_ROCK]._qactive != QUEST_NOTAVAIL) {
if (player._pLvlVisited[4] && Quests[Q_ROCK]._qactive != QUEST_DONE) {
if (Quests[Q_ROCK]._qvar2 == 0) {
Quests[Q_ROCK]._qvar2 = 1;
Quests[Q_ROCK]._qlog = true;
if (Quests[Q_ROCK]._qactive == QUEST_INIT) {
Quests[Q_ROCK]._qactive = QUEST_ACTIVE;
}
InitQTextMsg(TEXT_INFRA5);
return;
}
if (quests[Q_ROCK]._qvar2 == 1 && player.TryRemoveInvItemById(IDI_ROCK)) {
quests[Q_ROCK]._qactive = QUEST_DONE;
if (Quests[Q_ROCK]._qvar2 == 1 && player.TryRemoveInvItemById(IDI_ROCK)) {
Quests[Q_ROCK]._qactive = QUEST_DONE;
SpawnUnique(UITEM_INFRARING, blackSmith.position + DIR_SW);
InitQTextMsg(TEXT_INFRA7);
return;
}
}
}
if (quests[Q_ANVIL]._qactive != QUEST_NOTAVAIL) {
if (player._pLvlVisited[9] && quests[Q_ANVIL]._qactive != QUEST_DONE) {
if (quests[Q_ANVIL]._qvar2 == 0 && quests[Q_ROCK]._qactive != QUEST_INIT) {
quests[Q_ANVIL]._qvar2 = 1;
quests[Q_ANVIL]._qlog = true;
if (quests[Q_ANVIL]._qactive == QUEST_INIT) {
quests[Q_ANVIL]._qactive = QUEST_ACTIVE;
if (Quests[Q_ANVIL]._qactive != QUEST_NOTAVAIL) {
if (player._pLvlVisited[9] && Quests[Q_ANVIL]._qactive != QUEST_DONE) {
if (Quests[Q_ANVIL]._qvar2 == 0 && Quests[Q_ROCK]._qactive != QUEST_INIT) {
Quests[Q_ANVIL]._qvar2 = 1;
Quests[Q_ANVIL]._qlog = true;
if (Quests[Q_ANVIL]._qactive == QUEST_INIT) {
Quests[Q_ANVIL]._qactive = QUEST_ACTIVE;
}
InitQTextMsg(TEXT_ANVIL5);
return;
}
if (quests[Q_ANVIL]._qvar2 == 1 && player.TryRemoveInvItemById(IDI_ANVIL)) {
quests[Q_ANVIL]._qactive = QUEST_DONE;
if (Quests[Q_ANVIL]._qvar2 == 1 && player.TryRemoveInvItemById(IDI_ANVIL)) {
Quests[Q_ANVIL]._qactive = QUEST_DONE;
SpawnUnique(UITEM_GRISWOLD, blackSmith.position + DIR_SW);
InitQTextMsg(TEXT_ANVIL7);
return;
@ -418,39 +418,39 @@ void TalkToBlackSmith(PlayerStruct &player, TownerStruct &blackSmith)
void TalkToWitch(PlayerStruct &player, TownerStruct & /*witch*/)
{
if (quests[Q_MUSHROOM]._qactive != QUEST_NOTAVAIL) {
if (quests[Q_MUSHROOM]._qactive == QUEST_INIT && player.TryRemoveInvItemById(IDI_FUNGALTM)) {
quests[Q_MUSHROOM]._qactive = QUEST_ACTIVE;
quests[Q_MUSHROOM]._qlog = true;
quests[Q_MUSHROOM]._qvar1 = QS_TOMEGIVEN;
if (Quests[Q_MUSHROOM]._qactive != QUEST_NOTAVAIL) {
if (Quests[Q_MUSHROOM]._qactive == QUEST_INIT && player.TryRemoveInvItemById(IDI_FUNGALTM)) {
Quests[Q_MUSHROOM]._qactive = QUEST_ACTIVE;
Quests[Q_MUSHROOM]._qlog = true;
Quests[Q_MUSHROOM]._qvar1 = QS_TOMEGIVEN;
InitQTextMsg(TEXT_MUSH8);
return;
}
if (quests[Q_MUSHROOM]._qactive == QUEST_ACTIVE) {
if (quests[Q_MUSHROOM]._qvar1 >= QS_TOMEGIVEN && quests[Q_MUSHROOM]._qvar1 < QS_MUSHGIVEN) {
if (Quests[Q_MUSHROOM]._qactive == QUEST_ACTIVE) {
if (Quests[Q_MUSHROOM]._qvar1 >= QS_TOMEGIVEN && Quests[Q_MUSHROOM]._qvar1 < QS_MUSHGIVEN) {
if (player.TryRemoveInvItemById(IDI_MUSHROOM)) {
quests[Q_MUSHROOM]._qvar1 = QS_MUSHGIVEN;
Qtalklist[TOWN_HEALER][Q_MUSHROOM] = TEXT_MUSH3;
Qtalklist[TOWN_WITCH][Q_MUSHROOM] = TEXT_NONE;
quests[Q_MUSHROOM]._qmsg = TEXT_MUSH10;
Quests[Q_MUSHROOM]._qvar1 = QS_MUSHGIVEN;
QuestDialogTable[TOWN_HEALER][Q_MUSHROOM] = TEXT_MUSH3;
QuestDialogTable[TOWN_WITCH][Q_MUSHROOM] = TEXT_NONE;
Quests[Q_MUSHROOM]._qmsg = TEXT_MUSH10;
InitQTextMsg(TEXT_MUSH10);
return;
}
if (quests[Q_MUSHROOM]._qmsg != TEXT_MUSH9) {
quests[Q_MUSHROOM]._qmsg = TEXT_MUSH9;
if (Quests[Q_MUSHROOM]._qmsg != TEXT_MUSH9) {
Quests[Q_MUSHROOM]._qmsg = TEXT_MUSH9;
InitQTextMsg(TEXT_MUSH9);
return;
}
}
if (quests[Q_MUSHROOM]._qvar1 >= QS_MUSHGIVEN) {
if (Quests[Q_MUSHROOM]._qvar1 >= QS_MUSHGIVEN) {
if (player.HasItem(IDI_BRAIN)) {
quests[Q_MUSHROOM]._qmsg = TEXT_MUSH11;
Quests[Q_MUSHROOM]._qmsg = TEXT_MUSH11;
InitQTextMsg(TEXT_MUSH11);
return;
}
if (player.HasItem(IDI_SPECELIX)) {
InitQTextMsg(TEXT_MUSH12);
quests[Q_MUSHROOM]._qactive = QUEST_DONE;
Quests[Q_MUSHROOM]._qactive = QUEST_DONE;
AllItemsList[IDI_SPECELIX].iUsable = true; /// BUGFIX: This will cause the elixir to be usable in the next game
return;
}
@ -465,9 +465,9 @@ void TalkToWitch(PlayerStruct &player, TownerStruct & /*witch*/)
void TalkToBarmaid(PlayerStruct &player, TownerStruct & /*barmaid*/)
{
if (!player._pLvlVisited[21] && player.HasItem(IDI_MAPOFDOOM)) {
quests[Q_GRAVE]._qactive = QUEST_ACTIVE;
quests[Q_GRAVE]._qlog = true;
quests[Q_GRAVE]._qmsg = TEXT_GRAVE8;
Quests[Q_GRAVE]._qactive = QUEST_ACTIVE;
Quests[Q_GRAVE]._qlog = true;
Quests[Q_GRAVE]._qmsg = TEXT_GRAVE8;
InitQTextMsg(TEXT_GRAVE8);
return;
}
@ -484,27 +484,27 @@ void TalkToDrunk(PlayerStruct & /*player*/, TownerStruct & /*drunk*/)
void TalkToHealer(PlayerStruct &player, TownerStruct &healer)
{
if (quests[Q_PWATER]._qactive != QUEST_NOTAVAIL) {
if ((player._pLvlVisited[1] || player._pLvlVisited[5]) && quests[Q_PWATER]._qactive == QUEST_INIT) {
quests[Q_PWATER]._qactive = QUEST_ACTIVE;
quests[Q_PWATER]._qlog = true;
quests[Q_PWATER]._qmsg = TEXT_POISON3;
if (Quests[Q_PWATER]._qactive != QUEST_NOTAVAIL) {
if ((player._pLvlVisited[1] || player._pLvlVisited[5]) && Quests[Q_PWATER]._qactive == QUEST_INIT) {
Quests[Q_PWATER]._qactive = QUEST_ACTIVE;
Quests[Q_PWATER]._qlog = true;
Quests[Q_PWATER]._qmsg = TEXT_POISON3;
InitQTextMsg(TEXT_POISON3);
return;
}
if (quests[Q_PWATER]._qactive == QUEST_DONE && quests[Q_PWATER]._qvar1 != 2) {
quests[Q_PWATER]._qvar1 = 2;
if (Quests[Q_PWATER]._qactive == QUEST_DONE && Quests[Q_PWATER]._qvar1 != 2) {
Quests[Q_PWATER]._qvar1 = 2;
InitQTextMsg(TEXT_POISON5);
SpawnUnique(UITEM_TRING, healer.position + DIR_SW);
return;
}
}
if (quests[Q_MUSHROOM]._qactive == QUEST_ACTIVE) {
if (quests[Q_MUSHROOM]._qvar1 >= QS_MUSHGIVEN && quests[Q_MUSHROOM]._qvar1 < QS_BRAINGIVEN && player.TryRemoveInvItemById(IDI_BRAIN)) {
if (Quests[Q_MUSHROOM]._qactive == QUEST_ACTIVE) {
if (Quests[Q_MUSHROOM]._qvar1 >= QS_MUSHGIVEN && Quests[Q_MUSHROOM]._qvar1 < QS_BRAINGIVEN && player.TryRemoveInvItemById(IDI_BRAIN)) {
SpawnQuestItem(IDI_SPECELIX, healer.position + Displacement { 0, 1 }, 0, 0);
InitQTextMsg(TEXT_MUSH4);
quests[Q_MUSHROOM]._qvar1 = QS_BRAINGIVEN;
Qtalklist[TOWN_HEALER][Q_MUSHROOM] = TEXT_NONE;
Quests[Q_MUSHROOM]._qvar1 = QS_BRAINGIVEN;
QuestDialogTable[TOWN_HEALER][Q_MUSHROOM] = TEXT_NONE;
return;
}
}
@ -522,25 +522,25 @@ void TalkToBoy(PlayerStruct & /*player*/, TownerStruct & /*boy*/)
void TalkToStoryteller(PlayerStruct &player, TownerStruct & /*storyteller*/)
{
if (!gbIsMultiplayer) {
if (quests[Q_BETRAYER]._qactive == QUEST_INIT && player.TryRemoveInvItemById(IDI_LAZSTAFF)) {
if (Quests[Q_BETRAYER]._qactive == QUEST_INIT && player.TryRemoveInvItemById(IDI_LAZSTAFF)) {
InitQTextMsg(TEXT_VILE1);
quests[Q_BETRAYER]._qlog = true;
quests[Q_BETRAYER]._qactive = QUEST_ACTIVE;
quests[Q_BETRAYER]._qvar1 = 2;
Quests[Q_BETRAYER]._qlog = true;
Quests[Q_BETRAYER]._qactive = QUEST_ACTIVE;
Quests[Q_BETRAYER]._qvar1 = 2;
return;
}
} else {
if (quests[Q_BETRAYER]._qactive == QUEST_ACTIVE && !quests[Q_BETRAYER]._qlog) {
if (Quests[Q_BETRAYER]._qactive == QUEST_ACTIVE && !Quests[Q_BETRAYER]._qlog) {
InitQTextMsg(TEXT_VILE1);
quests[Q_BETRAYER]._qlog = true;
Quests[Q_BETRAYER]._qlog = true;
NetSendCmdQuest(true, Q_BETRAYER);
return;
}
}
if (quests[Q_BETRAYER]._qactive == QUEST_DONE && quests[Q_BETRAYER]._qvar1 == 7) {
quests[Q_BETRAYER]._qvar1 = 8;
if (Quests[Q_BETRAYER]._qactive == QUEST_DONE && Quests[Q_BETRAYER]._qvar1 == 7) {
Quests[Q_BETRAYER]._qvar1 = 8;
InitQTextMsg(TEXT_VILE3);
quests[Q_DIABLO]._qlog = true;
Quests[Q_DIABLO]._qlog = true;
if (gbIsMultiplayer) {
NetSendCmdQuest(true, Q_BETRAYER);
NetSendCmdQuest(true, Q_DIABLO);
@ -584,15 +584,15 @@ void TalkToCow(PlayerStruct &player, TownerStruct &cow)
void TalkToFarmer(PlayerStruct &player, TownerStruct &farmer)
{
switch (quests[Q_FARMER]._qactive) {
switch (Quests[Q_FARMER]._qactive) {
case QUEST_NOTAVAIL:
case QUEST_INIT:
if (player.HasItem(IDI_RUNEBOMB)) {
InitQTextMsg(TEXT_FARMER2);
quests[Q_FARMER]._qactive = QUEST_ACTIVE;
quests[Q_FARMER]._qvar1 = 1;
quests[Q_FARMER]._qmsg = TEXT_FARMER1;
quests[Q_FARMER]._qlog = true;
Quests[Q_FARMER]._qactive = QUEST_ACTIVE;
Quests[Q_FARMER]._qvar1 = 1;
Quests[Q_FARMER]._qmsg = TEXT_FARMER1;
Quests[Q_FARMER]._qlog = true;
if (gbIsMultiplayer)
NetSendCmdQuest(true, Q_FARMER);
break;
@ -611,10 +611,10 @@ void TalkToFarmer(PlayerStruct &player, TownerStruct &farmer)
}
InitQTextMsg(TEXT_FARMER1);
quests[Q_FARMER]._qactive = QUEST_ACTIVE;
quests[Q_FARMER]._qvar1 = 1;
quests[Q_FARMER]._qlog = true;
quests[Q_FARMER]._qmsg = TEXT_FARMER1;
Quests[Q_FARMER]._qactive = QUEST_ACTIVE;
Quests[Q_FARMER]._qvar1 = 1;
Quests[Q_FARMER]._qlog = true;
Quests[Q_FARMER]._qmsg = TEXT_FARMER1;
SpawnRuneBomb(farmer.position + Displacement { 1, 0 });
if (gbIsMultiplayer)
NetSendCmdQuest(true, Q_FARMER);
@ -625,8 +625,8 @@ void TalkToFarmer(PlayerStruct &player, TownerStruct &farmer)
case QUEST_DONE:
InitQTextMsg(TEXT_FARMER4);
SpawnRewardItem(IDI_AURIC, farmer.position + Displacement { 1, 0 });
quests[Q_FARMER]._qactive = QUEST_HIVE_DONE;
quests[Q_FARMER]._qlog = false;
Quests[Q_FARMER]._qactive = QUEST_HIVE_DONE;
Quests[Q_FARMER]._qlog = false;
if (gbIsMultiplayer)
NetSendCmdQuest(true, Q_FARMER);
break;
@ -645,24 +645,24 @@ void TalkToCowFarmer(PlayerStruct &player, TownerStruct &cowFarmer)
if (player.TryRemoveInvItemById(IDI_BROWNSUIT)) {
SpawnUnique(UITEM_BOVINE, cowFarmer.position + DIR_SE);
InitQTextMsg(TEXT_JERSEY8);
quests[Q_JERSEY]._qactive = QUEST_DONE;
Quests[Q_JERSEY]._qactive = QUEST_DONE;
return;
}
if (player.HasItem(IDI_RUNEBOMB)) {
InitQTextMsg(TEXT_JERSEY5);
quests[Q_JERSEY]._qactive = QUEST_ACTIVE;
quests[Q_JERSEY]._qvar1 = 1;
quests[Q_JERSEY]._qmsg = TEXT_JERSEY4;
quests[Q_JERSEY]._qlog = true;
Quests[Q_JERSEY]._qactive = QUEST_ACTIVE;
Quests[Q_JERSEY]._qvar1 = 1;
Quests[Q_JERSEY]._qmsg = TEXT_JERSEY4;
Quests[Q_JERSEY]._qlog = true;
return;
}
switch (quests[Q_JERSEY]._qactive) {
switch (Quests[Q_JERSEY]._qactive) {
case QUEST_NOTAVAIL:
case QUEST_INIT:
InitQTextMsg(TEXT_JERSEY1);
quests[Q_JERSEY]._qactive = QUEST_HIVE_TEASE1;
Quests[Q_JERSEY]._qactive = QUEST_HIVE_TEASE1;
if (gbIsMultiplayer)
NetSendCmdQuest(true, Q_JERSEY);
break;
@ -674,13 +674,13 @@ void TalkToCowFarmer(PlayerStruct &player, TownerStruct &cowFarmer)
break;
case QUEST_HIVE_TEASE1:
InitQTextMsg(TEXT_JERSEY2);
quests[Q_JERSEY]._qactive = QUEST_HIVE_TEASE2;
Quests[Q_JERSEY]._qactive = QUEST_HIVE_TEASE2;
if (gbIsMultiplayer)
NetSendCmdQuest(true, Q_JERSEY);
break;
case QUEST_HIVE_TEASE2:
InitQTextMsg(TEXT_JERSEY3);
quests[Q_JERSEY]._qactive = QUEST_HIVE_ACTIVE;
Quests[Q_JERSEY]._qactive = QUEST_HIVE_ACTIVE;
if (gbIsMultiplayer)
NetSendCmdQuest(true, Q_JERSEY);
break;
@ -703,10 +703,10 @@ void TalkToCowFarmer(PlayerStruct &player, TownerStruct &cowFarmer)
}
InitQTextMsg(TEXT_JERSEY4);
quests[Q_JERSEY]._qactive = QUEST_ACTIVE;
quests[Q_JERSEY]._qvar1 = 1;
quests[Q_JERSEY]._qmsg = TEXT_JERSEY4;
quests[Q_JERSEY]._qlog = true;
Quests[Q_JERSEY]._qactive = QUEST_ACTIVE;
Quests[Q_JERSEY]._qvar1 = 1;
Quests[Q_JERSEY]._qmsg = TEXT_JERSEY4;
Quests[Q_JERSEY]._qlog = true;
SpawnRuneBomb(cowFarmer.position + Displacement { 1, 0 });
if (gbIsMultiplayer)
NetSendCmdQuest(true, Q_JERSEY);
@ -719,23 +719,23 @@ void TalkToCowFarmer(PlayerStruct &player, TownerStruct &cowFarmer)
void TalkToGirl(PlayerStruct &player, TownerStruct &girl)
{
if (quests[Q_GIRL]._qactive != QUEST_DONE && player.TryRemoveInvItemById(IDI_THEODORE)) {
if (Quests[Q_GIRL]._qactive != QUEST_DONE && player.TryRemoveInvItemById(IDI_THEODORE)) {
InitQTextMsg(TEXT_GIRL4);
CreateAmulet(girl.position, 13, false, true);
quests[Q_GIRL]._qlog = false;
quests[Q_GIRL]._qactive = QUEST_DONE;
Quests[Q_GIRL]._qlog = false;
Quests[Q_GIRL]._qactive = QUEST_DONE;
if (gbIsMultiplayer)
NetSendCmdQuest(true, Q_GIRL);
}
switch (quests[Q_GIRL]._qactive) {
switch (Quests[Q_GIRL]._qactive) {
case QUEST_NOTAVAIL:
case QUEST_INIT:
InitQTextMsg(TEXT_GIRL2);
quests[Q_GIRL]._qactive = QUEST_ACTIVE;
quests[Q_GIRL]._qvar1 = 1;
quests[Q_GIRL]._qlog = true;
quests[Q_GIRL]._qmsg = TEXT_GIRL2;
Quests[Q_GIRL]._qactive = QUEST_ACTIVE;
Quests[Q_GIRL]._qvar1 = 1;
Quests[Q_GIRL]._qlog = true;
Quests[Q_GIRL]._qmsg = TEXT_GIRL2;
if (gbIsMultiplayer)
NetSendCmdQuest(true, Q_GIRL);
return;
@ -771,10 +771,10 @@ const TownerInit TownerInitList[] = {
} // namespace
TownerStruct towners[NUM_TOWNERS];
TownerStruct Towners[NUM_TOWNERS];
/** Contains the data related to quest gossip for each towner ID. */
_speech_id Qtalklist[NUM_TOWNER_TYPES][MAXQUESTS] = {
_speech_id QuestDialogTable[NUM_TOWNER_TYPES][MAXQUESTS] = {
// clang-format off
// Q_ROCK, Q_MUSHROOM, Q_GARBUD, Q_ZHAR, Q_VEIL, Q_DIABLO, Q_BUTCHER, Q_LTBANNER, Q_BLIND, Q_BLOOD, Q_ANVIL, Q_WARLORD, Q_SKELKING, Q_PWATER, Q_SCHAMB, Q_BETRAYER, Q_GRAVE, Q_FARMER, Q_GIRL, Q_TRADER, Q_DEFILER, Q_NAKRUL, Q_CORNSTN, Q_JERSEY
/*TOWN_SMITH*/ { TEXT_INFRA6, TEXT_MUSH6, TEXT_NONE, TEXT_NONE, TEXT_VEIL5, TEXT_NONE, TEXT_BUTCH5, TEXT_BANNER6, TEXT_BLIND5, TEXT_BLOOD5, TEXT_ANVIL6, TEXT_WARLRD5, TEXT_KING7, TEXT_POISON7, TEXT_BONE5, TEXT_VILE9, TEXT_GRAVE2, TEXT_NONE, TEXT_NONE, TEXT_NONE, TEXT_NONE, TEXT_NONE, TEXT_NONE, TEXT_NONE },
@ -803,7 +803,7 @@ void InitTowners()
for (const auto &townerInit : TownerInitList) {
switch (townerInit.type) {
case TOWN_DEADGUY:
if (quests[Q_BUTCHER]._qactive == QUEST_NOTAVAIL || quests[Q_BUTCHER]._qactive == QUEST_DONE)
if (Quests[Q_BUTCHER]._qactive == QUEST_NOTAVAIL || Quests[Q_BUTCHER]._qactive == QUEST_DONE)
continue;
break;
case TOWN_FARMER:
@ -811,7 +811,7 @@ void InitTowners()
continue;
break;
case TOWN_COWFARM:
if (!gbIsHellfire || sgGameInitInfo.bCowQuest == 0 || quests[Q_FARMER]._qactive == 10)
if (!gbIsHellfire || sgGameInitInfo.bCowQuest == 0 || Quests[Q_FARMER]._qactive == 10)
continue;
break;
case TOWN_GIRL:
@ -829,7 +829,7 @@ void InitTowners()
void FreeTownerGFX()
{
for (auto &towner : towners) {
for (auto &towner : Towners) {
towner._tNData = nullptr;
}
@ -839,7 +839,7 @@ void FreeTownerGFX()
void ProcessTowners()
{
// BUGFIX: should be `i < numtowners`, was `i < NUM_TOWNERS`
for (auto &towner : towners) {
for (auto &towner : Towners) {
if (towner._ttype == TOWN_DEADGUY) {
TownDead(towner);
}
@ -868,7 +868,7 @@ void ProcessTowners()
void TalkToTowner(PlayerStruct &player, int t)
{
auto &towner = towners[t];
auto &towner = Towners[t];
if (player.position.tile.WalkingDistance(towner.position) >= 2)
return;

4
Source/towners.h

@ -58,13 +58,13 @@ struct TownerStruct {
_talker_id _ttype;
};
extern TownerStruct towners[NUM_TOWNERS];
extern TownerStruct Towners[NUM_TOWNERS];
void InitTowners();
void FreeTownerGFX();
void ProcessTowners();
void TalkToTowner(PlayerStruct &player, int t);
extern _speech_id Qtalklist[NUM_TOWNER_TYPES][MAXQUESTS];
extern _speech_id QuestDialogTable[NUM_TOWNER_TYPES][MAXQUESTS];
} // namespace devilution

14
Source/trigs.cpp

@ -109,7 +109,7 @@ void InitTownTriggers()
trigs[numtrigs]._tmsg = WM_DIABTOWNWARP;
trigs[numtrigs]._tlvl = 17;
numtrigs++;
if (gbIsMultiplayer || quests[Q_GRAVE]._qactive == QUEST_DONE) {
if (gbIsMultiplayer || Quests[Q_GRAVE]._qactive == QUEST_DONE) {
trigs[numtrigs].position = { 36, 24 };
trigs[numtrigs]._tmsg = WM_DIABTOWNWARP;
trigs[numtrigs]._tlvl = 21;
@ -168,7 +168,7 @@ void InitL2Triggers()
numtrigs = 0;
for (int j = 0; j < MAXDUNY; j++) {
for (int i = 0; i < MAXDUNX; i++) {
if (dPiece[i][j] == 267 && (i != quests[Q_SCHAMB].position.x || j != quests[Q_SCHAMB].position.y)) {
if (dPiece[i][j] == 267 && (i != Quests[Q_SCHAMB].position.x || j != Quests[Q_SCHAMB].position.y)) {
trigs[numtrigs].position = { i, j };
trigs[numtrigs]._tmsg = WM_DIABPREVLVL;
numtrigs++;
@ -271,7 +271,7 @@ void InitL4Triggers()
for (int j = 0; j < MAXDUNY; j++) {
for (int i = 0; i < MAXDUNX; i++) {
if (dPiece[i][j] == 370 && quests[Q_BETRAYER]._qactive == QUEST_DONE) {
if (dPiece[i][j] == 370 && Quests[Q_BETRAYER]._qactive == QUEST_DONE) {
trigs[numtrigs].position = { i, j };
trigs[numtrigs]._tmsg = WM_DIABNEXTLVL;
numtrigs++;
@ -699,7 +699,7 @@ bool ForceSKingTrig()
for (i = 0; L1UpList[i] != -1; i++) {
if (dPiece[cursmx][cursmy] == L1UpList[i]) {
strcpy(infostr, fmt::format(_("Back to Level {:d}"), quests[Q_SKELKING]._qlevel).c_str());
strcpy(infostr, fmt::format(_("Back to Level {:d}"), Quests[Q_SKELKING]._qlevel).c_str());
cursmx = trigs[0].position.x;
cursmy = trigs[0].position.y;
@ -716,7 +716,7 @@ bool ForceSChambTrig()
for (i = 0; L2DownList[i] != -1; i++) {
if (dPiece[cursmx][cursmy] == L2DownList[i]) {
strcpy(infostr, fmt::format(_("Back to Level {:d}"), quests[Q_SCHAMB]._qlevel).c_str());
strcpy(infostr, fmt::format(_("Back to Level {:d}"), Quests[Q_SCHAMB]._qlevel).c_str());
cursmx = trigs[0].position.x;
cursmy = trigs[0].position.y;
@ -733,7 +733,7 @@ bool ForcePWaterTrig()
for (i = 0; L3DownList[i] != -1; i++) {
if (dPiece[cursmx][cursmy] == L3DownList[i]) {
strcpy(infostr, fmt::format(_("Back to Level {:d}"), quests[Q_PWATER]._qlevel).c_str());
strcpy(infostr, fmt::format(_("Back to Level {:d}"), Quests[Q_PWATER]._qlevel).c_str());
cursmx = trigs[0].position.x;
cursmy = trigs[0].position.y;
@ -822,7 +822,7 @@ void CheckTriggers()
StartNewLvl(MyPlayerId, trigs[i]._tmsg, currlevel - 1);
break;
case WM_DIABRTNLVL:
StartNewLvl(MyPlayerId, trigs[i]._tmsg, ReturnLvl);
StartNewLvl(MyPlayerId, trigs[i]._tmsg, ReturnLevel);
break;
case WM_DIABTOWNWARP:
if (gbIsMultiplayer) {

Loading…
Cancel
Save