Browse Source

🚚 Rename 'MonsterData' global to 'MonstersData'

This avoids conflicts with the struct name as we'll be renaming that next.
pull/2789/head
Juliano Leal Goncalves 5 years ago committed by Anders Jenbo
parent
commit
6146b828e9
  1. 4
      Source/effects.cpp
  2. 2
      Source/items.cpp
  3. 2
      Source/monstdat.cpp
  4. 2
      Source/monstdat.h
  5. 42
      Source/monster.cpp

4
Source/effects.cpp

@ -1215,10 +1215,10 @@ void InitMonsterSND(int monst)
const int mtype = LevelMonsterTypes[monst].mtype;
for (int i = 0; i < 4; i++) {
if (MonstSndChar[i] != 's' || MonsterData[mtype].snd_special) {
if (MonstSndChar[i] != 's' || MonstersData[mtype].snd_special) {
for (int j = 0; j < 2; j++) {
char path[MAX_PATH];
sprintf(path, MonsterData[mtype].sndfile, MonstSndChar[i], j + 1);
sprintf(path, MonstersData[mtype].sndfile, MonstSndChar[i], j + 1);
LevelMonsterTypes[monst].Snds[i][j] = sound_file_load(path);
}
}

2
Source/items.cpp

@ -4884,7 +4884,7 @@ std::string DebugSpawnItem(std::string itemName, bool unique)
uint32_t begin = SDL_GetTicks();
Monster fake_m;
fake_m.MData = &MonsterData[0];
fake_m.MData = &MonstersData[0];
fake_m._uniqtype = 0;
int i = 0;
for (;; i++) {

2
Source/monstdat.cpp

@ -13,7 +13,7 @@
namespace devilution {
/** Contains the data related to each monster ID. */
const MonsterDataStruct MonsterData[] = {
const MonsterDataStruct MonstersData[] = {
// clang-format off
// mName, GraphicType, sndfile, TransFile, width, mImage, has_special, snd_special, has_trans, Frames[6], Rate[6], mMinDLvl, mMaxDLvl, mLevel, mMinHP, mMaxHP, mAi, mFlags , mInt, mHit, mAFNum, mMinDamage, mMaxDamage, mHit2, mAFNum2, mMinDamage2, mMaxDamage2, mArmorClass, mMonstClass, mMagicRes , mMagicRes2 , mSelFlag, mTreasure, mExp
// TRANSLATORS: Monster Block start

2
Source/monstdat.h

@ -312,7 +312,7 @@ struct UniqMonstStruct {
_speech_id mtalkmsg;
};
extern const MonsterDataStruct MonsterData[];
extern const MonsterDataStruct MonstersData[];
extern const _monster_id MonstConvTbl[];
extern const char MonstAvailTbl[];
extern const UniqMonstStruct UniqMonst[];

42
Source/monster.cpp

@ -618,7 +618,7 @@ int AddMonsterType(_monster_id type, placeflag placeflag)
i = LevelMonsterTypeCount;
LevelMonsterTypeCount++;
LevelMonsterTypes[i].mtype = type;
monstimgtot += MonsterData[type].mImage;
monstimgtot += MonstersData[type].mImage;
InitMonsterGFX(i);
InitMonsterSND(i);
}
@ -3628,8 +3628,8 @@ void GetLevelMTypes()
nt = 0;
for (int i = MT_WSKELAX; i <= MT_WSKELAX + numskeltypes; i++) {
if (IsSkel(i)) {
minl = 15 * MonsterData[i].mMinDLvl / 30 + 1;
maxl = 15 * MonsterData[i].mMaxDLvl / 30 + 1;
minl = 15 * MonstersData[i].mMinDLvl / 30 + 1;
maxl = 15 * MonstersData[i].mMaxDLvl / 30 + 1;
if (currlevel >= minl && currlevel <= maxl) {
if ((MonstAvailTbl[i] & mamask) != 0) {
@ -3643,8 +3643,8 @@ void GetLevelMTypes()
nt = 0;
for (int i = MT_NZOMBIE; i < NUM_MTYPES; i++) {
minl = 15 * MonsterData[i].mMinDLvl / 30 + 1;
maxl = 15 * MonsterData[i].mMaxDLvl / 30 + 1;
minl = 15 * MonstersData[i].mMinDLvl / 30 + 1;
maxl = 15 * MonstersData[i].mMaxDLvl / 30 + 1;
if (currlevel >= minl && currlevel <= maxl) {
if ((MonstAvailTbl[i] & mamask) != 0) {
@ -3663,7 +3663,7 @@ void GetLevelMTypes()
while (nt > 0 && LevelMonsterTypeCount < MAX_LVLMTYPES && monstimgtot < 4000) {
for (int i = 0; i < nt;) {
if (MonsterData[typelist[i]].mImage > 4000 - monstimgtot) {
if (MonstersData[typelist[i]].mImage > 4000 - monstimgtot) {
typelist[i] = typelist[--nt];
continue;
}
@ -3689,14 +3689,14 @@ void GetLevelMTypes()
void InitMonsterGFX(int monst)
{
int mtype = LevelMonsterTypes[monst].mtype;
int width = MonsterData[mtype].width;
int width = MonstersData[mtype].width;
for (int anim = 0; anim < 6; anim++) {
int frames = MonsterData[mtype].Frames[anim];
int frames = MonstersData[mtype].Frames[anim];
if ((animletter[anim] != 's' || MonsterData[mtype].has_special) && frames > 0) {
if ((animletter[anim] != 's' || MonstersData[mtype].has_special) && frames > 0) {
char strBuff[256];
sprintf(strBuff, MonsterData[mtype].GraphicType, animletter[anim]);
sprintf(strBuff, MonstersData[mtype].GraphicType, animletter[anim]);
byte *celBuf;
{
@ -3718,19 +3718,19 @@ void InitMonsterGFX(int monst)
}
LevelMonsterTypes[monst].Anims[anim].Frames = frames;
LevelMonsterTypes[monst].Anims[anim].Rate = MonsterData[mtype].Rate[anim];
LevelMonsterTypes[monst].Anims[anim].Rate = MonstersData[mtype].Rate[anim];
}
LevelMonsterTypes[monst].mMinHP = MonsterData[mtype].mMinHP;
LevelMonsterTypes[monst].mMaxHP = MonsterData[mtype].mMaxHP;
LevelMonsterTypes[monst].mMinHP = MonstersData[mtype].mMinHP;
LevelMonsterTypes[monst].mMaxHP = MonstersData[mtype].mMaxHP;
if (!gbIsHellfire && mtype == MT_DIABLO) {
LevelMonsterTypes[monst].mMinHP -= 2000;
LevelMonsterTypes[monst].mMaxHP -= 2000;
}
LevelMonsterTypes[monst].mAFNum = MonsterData[mtype].mAFNum;
LevelMonsterTypes[monst].MData = &MonsterData[mtype];
LevelMonsterTypes[monst].mAFNum = MonstersData[mtype].mAFNum;
LevelMonsterTypes[monst].MData = &MonstersData[mtype];
if (MonsterData[mtype].has_trans) {
if (MonstersData[mtype].has_trans) {
InitMonsterTRN(LevelMonsterTypes[monst]);
}
@ -4394,7 +4394,7 @@ void FreeMonsters()
for (int i = 0; i < LevelMonsterTypeCount; i++) {
int mtype = LevelMonsterTypes[i].mtype;
for (int j = 0; j < 6; j++) {
if (animletter[j] != 's' || MonsterData[mtype].has_special) {
if (animletter[j] != 's' || MonstersData[mtype].has_special) {
LevelMonsterTypes[i].Anims[j].CMem = nullptr;
}
}
@ -4632,15 +4632,15 @@ void M_FallenFear(Point position)
void PrintMonstHistory(int mt)
{
if (sgOptions.Gameplay.bShowMonsterType) {
strcpy(tempstr, fmt::format(_("Type: {:s} Kills: {:d}"), GetMonsterTypeText(MonsterData[mt]), MonsterKillCounts[mt]).c_str());
strcpy(tempstr, fmt::format(_("Type: {:s} Kills: {:d}"), GetMonsterTypeText(MonstersData[mt]), MonsterKillCounts[mt]).c_str());
} else {
strcpy(tempstr, fmt::format(_("Total kills: {:d}"), MonsterKillCounts[mt]).c_str());
}
AddPanelString(tempstr);
if (MonsterKillCounts[mt] >= 30) {
int minHP = MonsterData[mt].mMinHP;
int maxHP = MonsterData[mt].mMaxHP;
int minHP = MonstersData[mt].mMinHP;
int maxHP = MonstersData[mt].mMaxHP;
if (!gbIsHellfire && mt == MT_DIABLO) {
minHP -= 2000;
maxHP -= 2000;
@ -4671,7 +4671,7 @@ void PrintMonstHistory(int mt)
AddPanelString(tempstr);
}
if (MonsterKillCounts[mt] >= 15) {
int res = (sgGameInitInfo.nDifficulty != DIFF_HELL) ? MonsterData[mt].mMagicRes : MonsterData[mt].mMagicRes2;
int res = (sgGameInitInfo.nDifficulty != DIFF_HELL) ? MonstersData[mt].mMagicRes : MonstersData[mt].mMagicRes2;
if ((res & (RESIST_MAGIC | RESIST_FIRE | RESIST_LIGHTNING | IMMUNE_MAGIC | IMMUNE_FIRE | IMMUNE_LIGHTNING)) == 0) {
strcpy(tempstr, _("No magic resistance"));
AddPanelString(tempstr);

Loading…
Cancel
Save