Browse Source

🚚 Rename speech functions to 'Say' variations

pull/2041/head
Juliano Leal Goncalves 5 years ago committed by Anders Jenbo
parent
commit
5350250a76
  1. 2
      Source/controls/plrctrls.cpp
  2. 28
      Source/inv.cpp
  3. 2
      Source/miniwin/misc_msg.cpp
  4. 10
      Source/missiles.cpp
  5. 8
      Source/objects.cpp
  6. 32
      Source/player.cpp
  7. 14
      Source/player.h
  8. 14
      Source/quests.cpp
  9. 4
      Source/towners.cpp
  10. 2
      Source/trigs.cpp

2
Source/controls/plrctrls.cpp

@ -1491,7 +1491,7 @@ void PerformSpellAction()
int spl = plr[myplr]._pRSpell;
if ((pcursplr == -1 && (spl == SPL_RESURRECT || spl == SPL_HEALOTHER))
|| (pcursobj == -1 && spl == SPL_DISARM)) {
plr[myplr].PlaySpeach(HeroSpeech::N27);
plr[myplr].Say(HeroSpeech::N27);
return;
}

28
Source/inv.cpp

@ -963,7 +963,7 @@ void CheckInvPaste(int pnum, int mx, int my)
if (il != ILOC_UNEQUIPABLE && il != ILOC_BELT && !plr[pnum].HoldItem._iStatFlag) {
done = false;
plr[pnum].PlaySpeach(HeroSpeech::N13);
plr[pnum].Say(HeroSpeech::N13);
}
if (!done)
@ -1448,9 +1448,9 @@ void CheckInvCut(int pnum, int mx, int my, bool automaticMove)
if (automaticMove) {
if (!automaticallyMoved) {
if (CanBePlacedOnBelt(holdItem) || automaticallyUnequip) {
player.PlaySpecificSpeach(HeroSpeech::N15);
player.SaySpecific(HeroSpeech::N15);
} else {
player.PlaySpecificSpeach(HeroSpeech::N37);
player.SaySpecific(HeroSpeech::N37);
}
}
@ -1540,7 +1540,7 @@ void CheckQuestItem(int pnum)
if (plr[pnum].HoldItem.IDidx == IDI_OPTAMULET && quests[Q_BLIND]._qactive == QUEST_ACTIVE)
quests[Q_BLIND]._qactive = QUEST_DONE;
if (plr[pnum].HoldItem.IDidx == IDI_MUSHROOM && quests[Q_MUSHROOM]._qactive == QUEST_ACTIVE && quests[Q_MUSHROOM]._qvar1 == QS_MUSHSPAWNED) {
plr[pnum].PlaySpeach(HeroSpeech::N95, 10); // BUGFIX: Voice for this quest might be wrong in MP
plr[pnum].Say(HeroSpeech::N95, 10); // BUGFIX: Voice for this quest might be wrong in MP
quests[Q_MUSHROOM]._qvar1 = QS_MUSHPICKED;
}
if (plr[pnum].HoldItem.IDidx == IDI_ANVIL && quests[Q_ANVIL]._qactive != QUEST_NOTAVAIL) {
@ -1548,29 +1548,29 @@ void CheckQuestItem(int pnum)
quests[Q_ANVIL]._qactive = QUEST_ACTIVE;
}
if (quests[Q_ANVIL]._qlog) {
plr[myplr].PlaySpeach(HeroSpeech::N89, 10);
plr[myplr].Say(HeroSpeech::N89, 10);
}
}
if (plr[pnum].HoldItem.IDidx == IDI_GLDNELIX && quests[Q_VEIL]._qactive != QUEST_NOTAVAIL) {
plr[myplr].PlaySpeach(HeroSpeech::N88, 30);
plr[myplr].Say(HeroSpeech::N88, 30);
}
if (plr[pnum].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) {
plr[myplr].PlaySpeach(HeroSpeech::N87, 10);
plr[myplr].Say(HeroSpeech::N87, 10);
}
}
if (plr[pnum].HoldItem.IDidx == IDI_ARMOFVAL && quests[Q_BLOOD]._qactive == QUEST_ACTIVE) {
quests[Q_BLOOD]._qactive = QUEST_DONE;
plr[myplr].PlaySpeach(HeroSpeech::N91, 20);
plr[myplr].Say(HeroSpeech::N91, 20);
}
if (plr[pnum].HoldItem.IDidx == IDI_MAPOFDOOM) {
quests[Q_GRAVE]._qlog = false;
quests[Q_GRAVE]._qactive = QUEST_ACTIVE;
quests[Q_GRAVE]._qvar1 = 1;
plr[myplr].PlaySpeach(HeroSpeech::N79, 10);
plr[myplr].Say(HeroSpeech::N79, 10);
}
if (plr[pnum].HoldItem.IDidx == IDI_NOTE1 || plr[pnum].HoldItem.IDidx == IDI_NOTE2 || plr[pnum].HoldItem.IDidx == IDI_NOTE3) {
int mask, idx, item_num;
@ -1585,7 +1585,7 @@ void CheckQuestItem(int pnum)
mask |= 4;
if (mask == 7) {
int n1, n2, n3;
plr[myplr].PlaySpeach(HeroSpeech::N46, 10);
plr[myplr].Say(HeroSpeech::N46, 10);
switch (idx) {
case IDI_NOTE1:
plr[pnum].HasItem(IDI_NOTE2, &n2);
@ -1713,7 +1713,7 @@ void AutoGetItem(int pnum, ItemStruct *item, int ii)
}
if (pnum == myplr) {
plr[pnum].PlaySpeach(HeroSpeech::N14);
plr[pnum].Say(HeroSpeech::N14);
}
plr[pnum].HoldItem = *item;
RespawnItem(item, true);
@ -2189,11 +2189,11 @@ bool UseInvItem(int pnum, int cii)
switch (Item->IDidx) {
case IDI_MUSHROOM:
plr[pnum].PlaySpeach(HeroSpeech::N95, 10);
plr[pnum].Say(HeroSpeech::N95, 10);
return true;
case IDI_FUNGALTM:
PlaySFX(IS_IBOOK);
plr[pnum].PlaySpeach(HeroSpeech::N29, 10);
plr[pnum].Say(HeroSpeech::N29, 10);
return true;
}
@ -2201,7 +2201,7 @@ bool UseInvItem(int pnum, int cii)
return false;
if (!Item->_iStatFlag) {
plr[pnum].PlaySpeach(HeroSpeech::N13);
plr[pnum].Say(HeroSpeech::N13);
return true;
}

2
Source/miniwin/misc_msg.cpp

@ -281,7 +281,7 @@ bool BlurInventory()
{
if (pcurs >= CURSOR_FIRSTITEM) {
if (!TryDropItem()) {
plr[myplr].PlaySpeach(HeroSpeech::N16); // "Where would I put this?"
plr[myplr].Say(HeroSpeech::N16); // "Where would I put this?"
return false;
}
}

10
Source/missiles.cpp

@ -810,7 +810,7 @@ bool PlayerMHit(int pnum, int m, int dist, int mind, int maxd, int mtype, bool s
}
if (plr[pnum]._pHitPoints >> 6 > 0) {
plr[pnum].PlaySpeach(HeroSpeech::N69);
plr[pnum].Say(HeroSpeech::N69);
}
return true;
}
@ -920,7 +920,7 @@ bool Plr2PlrMHit(int pnum, int p, int mindam, int maxdam, int dist, int mtype, b
dam -= (dam * resper) / 100;
if (pnum == myplr)
NetSendCmdDamage(true, p, dam);
plr[pnum].PlaySpeach(HeroSpeech::N69);
plr[pnum].Say(HeroSpeech::N69);
return true;
}
if (blkper < blk) {
@ -2919,7 +2919,7 @@ void AddBlodboil(int mi, int sx, int sy, int dx, int dy, int midir, int8_t miene
missile[mi]._mirange = lvl + 10 * missile[mi]._mispllvl + 245;
CalcPlrItemVals(id, true);
force_redraw = 255;
plr[id].PlaySpeach(HeroSpeech::N70);
plr[id].Say(HeroSpeech::N70);
}
}
@ -4848,7 +4848,7 @@ void MI_Blodboil(int i)
CalcPlrItemVals(id, true);
ApplyPlrDamage(id, 0, 1, hpdif);
force_redraw = 255;
plr[id].PlaySpeach(HeroSpeech::N72);
plr[id].Say(HeroSpeech::N72);
} else {
missile[i]._miDelFlag = true;
plr[id]._pSpellFlags &= ~0x4;
@ -4856,7 +4856,7 @@ void MI_Blodboil(int i)
CalcPlrItemVals(id, true);
ApplyPlrDamage(id, 0, 1, hpdif + missile[i]._miVar2);
force_redraw = 255;
plr[id].PlaySpeach(HeroSpeech::N72);
plr[id].Say(HeroSpeech::N72);
}
}
}

8
Source/objects.cpp

@ -2144,7 +2144,7 @@ void Obj_BCrossDamage(int i)
ApplyPlrDamage(myplr, 0, 0, damage[leveltype - 1]);
if (plr[myplr]._pHitPoints >> 6 > 0) {
plr[myplr].PlaySpeach(HeroSpeech::N68);
plr[myplr].Say(HeroSpeech::N68);
}
}
@ -3139,7 +3139,7 @@ void OperateMushPatch(int pnum, int i)
if (quests[Q_MUSHROOM]._qactive != QUEST_ACTIVE) {
if (!deltaload && pnum == myplr) {
plr[myplr].PlaySpeach(HeroSpeech::N13);
plr[myplr].Say(HeroSpeech::N13);
}
return;
}
@ -3165,7 +3165,7 @@ void OperateInnSignChest(int pnum, int i)
if (quests[Q_LTBANNER]._qvar1 != 2) {
if (!deltaload && pnum == myplr) {
plr[myplr].PlaySpeach(HeroSpeech::N24);
plr[myplr].Say(HeroSpeech::N24);
}
} else {
if (object[i]._oSelFlag != 0) {
@ -3199,7 +3199,7 @@ void OperateSlainHero(int pnum, int i)
} else if (plr[pnum]._pClass == HeroClass::Barbarian) {
CreateMagicWeapon(object[i].position, ITYPE_AXE, ICURS_BATTLE_AXE, false, true);
}
plr[myplr].PlaySpeach(HeroSpeech::N9);
plr[myplr].Say(HeroSpeech::N9);
if (pnum == myplr)
NetSendCmdParam1(false, CMD_OPERATEOBJ, i);
}

32
Source/player.cpp

@ -326,16 +326,16 @@ _sfx_id herosounds[enum_size<HeroClass>::value][enum_size<HeroSpeech>::value] =
// clang-format on
};
void PlayerStruct::PlaySpeach(HeroSpeech speachId) const
void PlayerStruct::Say(HeroSpeech speechId) const
{
_sfx_id soundEffect = herosounds[static_cast<size_t>(_pClass)][static_cast<size_t>(speachId)];
_sfx_id soundEffect = herosounds[static_cast<size_t>(_pClass)][static_cast<size_t>(speechId)];
PlaySfxLoc(soundEffect, position.tile.x, position.tile.y);
}
void PlayerStruct::PlaySpecificSpeach(HeroSpeech speachId) const
void PlayerStruct::SaySpecific(HeroSpeech speechId) const
{
_sfx_id soundEffect = herosounds[static_cast<size_t>(_pClass)][static_cast<size_t>(speachId)];
_sfx_id soundEffect = herosounds[static_cast<size_t>(_pClass)][static_cast<size_t>(speechId)];
if (effect_is_playing(soundEffect))
return;
@ -343,10 +343,10 @@ void PlayerStruct::PlaySpecificSpeach(HeroSpeech speachId) const
PlaySfxLoc(soundEffect, position.tile.x, position.tile.y, false);
}
void PlayerStruct::PlaySpeach(HeroSpeech speachId, int delay) const
void PlayerStruct::Say(HeroSpeech speechId, int delay) const
{
sfxdelay = delay;
sfxdnum = herosounds[static_cast<size_t>(_pClass)][static_cast<size_t>(speachId)];
sfxdnum = herosounds[static_cast<size_t>(_pClass)][static_cast<size_t>(speechId)];
}
void PlayerStruct::Stop()
@ -1725,7 +1725,7 @@ void StartPlrHit(int pnum, int dam, bool forcehit)
return;
}
player.PlaySpeach(HeroSpeech::N69);
player.Say(HeroSpeech::N69);
drawhpflag = true;
if (player._pClass == HeroClass::Barbarian) {
@ -1839,7 +1839,7 @@ StartPlayerKill(int pnum, int earflag)
diablolevel = gbIsMultiplayer && player.plrlevel == 16;
player.PlaySpeach(HeroSpeech::N71);
player.Say(HeroSpeech::N71);
if (player._pgfxnum) {
player._pgfxnum = 0;
@ -3813,12 +3813,12 @@ void CheckPlrSpell()
spell_id rspell = myPlayer._pRSpell;
if (rspell == SPL_INVALID) {
myPlayer.PlaySpeach(HeroSpeech::N34);
myPlayer.Say(HeroSpeech::N34);
return;
}
if (leveltype == DTYPE_TOWN && !spelldata[rspell].sTownSpell) {
myPlayer.PlaySpeach(HeroSpeech::N27);
myPlayer.Say(HeroSpeech::N27);
return;
}
@ -3876,7 +3876,7 @@ void CheckPlrSpell()
}
if (myPlayer._pRSplType == RSPLTYPE_SPELL) {
myPlayer.PlaySpeach(HeroSpeech::N35);
myPlayer.Say(HeroSpeech::N35);
}
}
@ -4280,16 +4280,16 @@ void PlayDungMsgs()
auto &myPlayer = plr[myplr];
if (currlevel == 1 && !myPlayer._pLvlVisited[1] && !gbIsMultiplayer && !(myPlayer.pDungMsgs & DMSG_CATHEDRAL)) {
myPlayer.PlaySpeach(HeroSpeech::N97, 40);
myPlayer.Say(HeroSpeech::N97, 40);
myPlayer.pDungMsgs = myPlayer.pDungMsgs | DMSG_CATHEDRAL;
} else if (currlevel == 5 && !myPlayer._pLvlVisited[5] && !gbIsMultiplayer && !(myPlayer.pDungMsgs & DMSG_CATACOMBS)) {
myPlayer.PlaySpeach(HeroSpeech::N96, 40);
myPlayer.Say(HeroSpeech::N96, 40);
myPlayer.pDungMsgs |= DMSG_CATACOMBS;
} else if (currlevel == 9 && !myPlayer._pLvlVisited[9] && !gbIsMultiplayer && !(myPlayer.pDungMsgs & DMSG_CAVES)) {
myPlayer.PlaySpeach(HeroSpeech::N98, 40);
myPlayer.Say(HeroSpeech::N98, 40);
myPlayer.pDungMsgs |= DMSG_CAVES;
} else if (currlevel == 13 && !myPlayer._pLvlVisited[13] && !gbIsMultiplayer && !(myPlayer.pDungMsgs & DMSG_HELL)) {
myPlayer.PlaySpeach(HeroSpeech::N99, 40);
myPlayer.Say(HeroSpeech::N99, 40);
myPlayer.pDungMsgs |= DMSG_HELL;
} else if (currlevel == 16 && !myPlayer._pLvlVisited[15] && !gbIsMultiplayer && !(myPlayer.pDungMsgs & DMSG_DIABLO)) { // BUGFIX: _pLvlVisited should check 16 or this message will never play
sfxdelay = 40;
@ -4307,7 +4307,7 @@ void PlayDungMsgs()
sfxdnum = USFX_DEFILER3;
myPlayer.pDungMsgs2 |= 4;
} else if (currlevel == 21 && !myPlayer._pLvlVisited[21] && !gbIsMultiplayer && !(myPlayer.pDungMsgs & 32)) {
myPlayer.PlaySpeach(HeroSpeech::N92, 30);
myPlayer.Say(HeroSpeech::N92, 30);
myPlayer.pDungMsgs |= 32;
} else {
sfxdelay = 0;

14
Source/player.h

@ -369,19 +369,19 @@ struct PlayerStruct {
Point GetTargetPosition() const;
/**
* @brief Play a speach file.
* @brief Says a speech line.
* @todo BUGFIX Prevent more then one speech to be played at a time (reject new requests).
*/
void PlaySpeach(HeroSpeech speachId) const;
void Say(HeroSpeech speechId) const;
/**
* @brief Play a speach file after a given delay.
* @param delay Multiple of 20ms waith before starting the speach
* @brief Says a speech line after a given delay.
* @param delay Multiple of 20ms wait before starting the speech
*/
void PlaySpeach(HeroSpeech speachId, int delay) const;
void Say(HeroSpeech speechId, int delay) const;
/**
* @brief Play a player speach file, with out random variants.
* @brief Says a speech line, without random variants.
*/
void PlaySpecificSpeach(HeroSpeech speachId) const;
void SaySpecific(HeroSpeech speechId) const;
/**
* @brief Attempts to stop the player from performing any queued up action. If the player is currently walking, his walking will

14
Source/quests.cpp

@ -315,21 +315,21 @@ void CheckQuestKill(int m, bool sendmsg)
if (monster[m].MType->mtype == MT_SKING) {
quests[Q_SKELKING]._qactive = QUEST_DONE;
plr[myplr].PlaySpeach(HeroSpeech::N82, 30);
plr[myplr].Say(HeroSpeech::N82, 30);
if (sendmsg)
NetSendCmdQuest(true, Q_SKELKING);
} else if (monster[m].MType->mtype == MT_CLEAVER) {
quests[Q_BUTCHER]._qactive = QUEST_DONE;
plr[myplr].PlaySpeach(HeroSpeech::N80, 30);
plr[myplr].Say(HeroSpeech::N80, 30);
if (sendmsg)
NetSendCmdQuest(true, Q_BUTCHER);
} else if (monster[m]._uniqtype - 1 == UMT_GARBUD) { //"Gharbad the Weak"
quests[Q_GARBUD]._qactive = QUEST_DONE;
plr[myplr].PlaySpeach(HeroSpeech::N61, 30);
plr[myplr].Say(HeroSpeech::N61, 30);
} else if (monster[m]._uniqtype - 1 == UMT_ZHAR) { //"Zhar the Mad"
quests[Q_ZHAR]._qactive = QUEST_DONE;
plr[myplr].PlaySpeach(HeroSpeech::N62, 30);
plr[myplr].Say(HeroSpeech::N62, 30);
} else if (monster[m]._uniqtype - 1 == UMT_LAZURUS && gbIsMultiplayer) { //"Arch-Bishop Lazarus"
quests[Q_BETRAYER]._qactive = QUEST_DONE;
quests[Q_BETRAYER]._qvar1 = 7;
@ -344,7 +344,7 @@ void CheckQuestKill(int m, bool sendmsg)
}
}
}
plr[myplr].PlaySpeach(HeroSpeech::N83, 30);
plr[myplr].Say(HeroSpeech::N83, 30);
if (sendmsg) {
NetSendCmdQuest(true, Q_BETRAYER);
NetSendCmdQuest(true, Q_DIABLO);
@ -356,10 +356,10 @@ void CheckQuestKill(int m, bool sendmsg)
quests[Q_BETRAYER]._qvar2 = 4;
quests[Q_DIABLO]._qactive = QUEST_ACTIVE;
AddMissile(35, 32, 35, 32, 0, MIS_RPORTAL, TARGET_MONSTERS, myplr, 0, 0);
plr[myplr].PlaySpeach(HeroSpeech::N83, 30);
plr[myplr].Say(HeroSpeech::N83, 30);
} else if (monster[m]._uniqtype - 1 == UMT_WARLORD) { //"Warlord of Blood"
quests[Q_WARLORD]._qactive = QUEST_DONE;
plr[myplr].PlaySpeach(HeroSpeech::N94, 30);
plr[myplr].Say(HeroSpeech::N94, 30);
}
}

4
Source/towners.cpp

@ -376,7 +376,7 @@ void TalkToDeadguy(PlayerStruct &player, TownerStruct & /*deadguy*/)
return;
if (quests[Q_BUTCHER]._qvar1 == 1) {
player.PlaySpecificSpeach(HeroSpeech::N8);
player.SaySpecific(HeroSpeech::N8);
return;
}
@ -598,7 +598,7 @@ void TalkToCow(PlayerStruct &player, TownerStruct &cow)
CowClicks = 4;
static const HeroSpeech snSfx[3] = { HeroSpeech::N52, HeroSpeech::N49, HeroSpeech::N50 };
player.PlaySpecificSpeach(snSfx[CowMsg]);
player.SaySpecific(snSfx[CowMsg]);
CowMsg++;
if (CowMsg >= 3)
CowMsg = 0;

2
Source/trigs.cpp

@ -865,7 +865,7 @@ void CheckTriggers()
}
if (abort) {
plr[myplr].PlaySpeach(HeroSpeech::N43);
plr[myplr].Say(HeroSpeech::N43);
InitDiabloMsg(abortflag);
NetSendCmdLoc(myplr, true, CMD_WALKXY, position);

Loading…
Cancel
Save