Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion Source/towners.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
#include "cursor.h"
#include "engine/clx_sprite.hpp"
#include "engine/load_cel.hpp"
#include "engine/load_file.hpp"

Check warning on line 10 in Source/towners.cpp

View workflow job for this annotation

GitHub Actions / tidy-check

Source/towners.cpp:10:1 [misc-include-cleaner]

included header load_file.hpp is not used directly
#include "engine/random.hpp"
#include "game_mode.hpp"
#include "inv.h"
Expand All @@ -17,7 +17,7 @@
#include "tables/townerdat.hpp"
#include "utils/is_of.hpp"
#include "utils/language.h"
#include "utils/str_case.hpp"

Check warning on line 20 in Source/towners.cpp

View workflow job for this annotation

GitHub Actions / tidy-check

Source/towners.cpp:20:1 [misc-include-cleaner]

included header str_case.hpp is not used directly

namespace devilution {
namespace {
Expand All @@ -27,10 +27,10 @@
int CowClicks;

/** Specifies the active sound effect ID for interacting with cows. */
SfxID CowPlaying = SfxID::None;

Check warning on line 30 in Source/towners.cpp

View workflow job for this annotation

GitHub Actions / tidy-check

Source/towners.cpp:30:1 [misc-include-cleaner]

no header providing "devilution::SfxID" is directly included

/** Storage for animation order data loaded from TSV (needs stable addresses for span). */
std::vector<std::vector<uint8_t>> TownerAnimOrderStorage;

Check warning on line 33 in Source/towners.cpp

View workflow job for this annotation

GitHub Actions / tidy-check

Source/towners.cpp:33:6 [misc-include-cleaner]

no header providing "std::vector" is directly included

/**
* @brief Defines the behavior (init and talk functions) for each towner type.
Expand Down Expand Up @@ -85,7 +85,7 @@
towner._tAnimLen = numFrames;
towner._tAnimFrame = 0;
towner._tAnimCnt = 0;
towner._tAnimDelay = delay;

Check warning on line 88 in Source/towners.cpp

View workflow job for this annotation

GitHub Actions / tidy-check

Source/towners.cpp:88:23 [bugprone-narrowing-conversions]

narrowing conversion from 'int' to signed type 'int16_t' (aka 'short') is implementation-defined
}

void InitTownerInfo(Towner &towner, const TownerData &townerData, const TownerDataEntry &entry)
Expand All @@ -105,7 +105,7 @@

void LoadTownerAnimations(Towner &towner, const char *path, int frames, int delay)
{
towner.ownedAnim = std::nullopt;

Check warning on line 108 in Source/towners.cpp

View workflow job for this annotation

GitHub Actions / tidy-check

Source/towners.cpp:108:26 [misc-include-cleaner]

no header providing "std::nullopt" is directly included
towner.ownedAnim = LoadCel(path, towner._tAnimWidth);
NewTownerAnim(towner, *towner.ownedAnim, frames, delay);
}
Expand Down Expand Up @@ -150,19 +150,19 @@
towner._tAnimWidth = entry.animWidth;
towner.animOrder = {};

NewTownerAnim(towner, (*CowSprites)[static_cast<size_t>(entry.direction)], 12, 3);

Check warning on line 153 in Source/towners.cpp

View workflow job for this annotation

GitHub Actions / tidy-check

Source/towners.cpp:153:50 [misc-include-cleaner]

no header providing "size_t" is directly included
towner._tAnimFrame = GenerateRnd(11);

const Point position = entry.position;
const int16_t cowId = dMonster[position.x][position.y];

Check warning on line 157 in Source/towners.cpp

View workflow job for this annotation

GitHub Actions / tidy-check

Source/towners.cpp:157:24 [misc-include-cleaner]

no header providing "devilution::dMonster" is directly included

// Cows are large sprites so take up multiple tiles. Vanilla Diablo/Hellfire allowed the player to stand adjacent
// to a cow facing an ordinal direction (the two top-right cows) which leads to visual clipping. It's easier to
// treat all cows as 4 tile sprites since this works for all facings.
// The active tile is always the south tile as this is closest to the camera, we mark the other 3 tiles as occupied
// using -id to match the convention used for moving/large monsters and players.
Point offset = position + Direction::NorthWest;

Check warning on line 164 in Source/towners.cpp

View workflow job for this annotation

GitHub Actions / tidy-check

Source/towners.cpp:164:28 [misc-include-cleaner]

no header providing "devilution::Direction" is directly included
dMonster[offset.x][offset.y] = -cowId;

Check warning on line 165 in Source/towners.cpp

View workflow job for this annotation

GitHub Actions / tidy-check

Source/towners.cpp:165:33 [bugprone-narrowing-conversions]

narrowing conversion from 'int' to signed type 'int16_t' (aka 'short') is implementation-defined
offset = position + Direction::NorthEast;
dMonster[offset.x][offset.y] = -cowId;
offset = position + Direction::North;
Expand Down Expand Up @@ -367,8 +367,9 @@
}
}
if (Quests[Q_MUSHROOM]._qvar1 >= QS_MUSHGIVEN) {
if (HasInventoryItemWithId(player, IDI_BRAIN)) {
if (HasInventoryItemWithId(player, IDI_BRAIN) && Quests[Q_MUSHROOM]._qvar2 != TEXT_MUSH11) {
Quests[Q_MUSHROOM]._qmsg = TEXT_MUSH11;
Quests[Q_MUSHROOM]._qvar2 = TEXT_MUSH11;
NetSendCmdQuest(true, Quests[Q_MUSHROOM]);
InitQTextMsg(TEXT_MUSH11);
return;
Expand Down
Loading