|
|
|
|
@ -12,22 +12,22 @@
|
|
|
|
|
|
|
|
|
|
namespace devilution { |
|
|
|
|
|
|
|
|
|
DeadStruct Dead[MaxDead]; |
|
|
|
|
Corpse Corpses[MaxCorpses]; |
|
|
|
|
int8_t stonendx; |
|
|
|
|
|
|
|
|
|
namespace { |
|
|
|
|
void InitDeadAnimationFromMonster(DeadStruct &dead, const CMonster &mon) |
|
|
|
|
void InitDeadAnimationFromMonster(Corpse &corpse, const CMonster &mon) |
|
|
|
|
{ |
|
|
|
|
int i = 0; |
|
|
|
|
const auto &animData = mon.GetAnimData(MonsterGraphic::Death); |
|
|
|
|
for (const auto &celSprite : animData.CelSpritesForDirections) |
|
|
|
|
dead.data[i++] = celSprite->Data(); |
|
|
|
|
dead.frame = animData.Frames; |
|
|
|
|
dead.width = animData.CelSpritesForDirections[0]->Width(); |
|
|
|
|
corpse.data[i++] = celSprite->Data(); |
|
|
|
|
corpse.frame = animData.Frames; |
|
|
|
|
corpse.width = animData.CelSpritesForDirections[0]->Width(); |
|
|
|
|
} |
|
|
|
|
} // namespace
|
|
|
|
|
|
|
|
|
|
void InitDead() |
|
|
|
|
void InitCorpses() |
|
|
|
|
{ |
|
|
|
|
int8_t mtypes[MAXMONSTERS] = {}; |
|
|
|
|
|
|
|
|
|
@ -37,8 +37,8 @@ void InitDead()
|
|
|
|
|
if (mtypes[LevelMonsterTypes[i].mtype] != 0) |
|
|
|
|
continue; |
|
|
|
|
|
|
|
|
|
InitDeadAnimationFromMonster(Dead[nd], LevelMonsterTypes[i]); |
|
|
|
|
Dead[nd].translationPaletteIndex = 0; |
|
|
|
|
InitDeadAnimationFromMonster(Corpses[nd], LevelMonsterTypes[i]); |
|
|
|
|
Corpses[nd].translationPaletteIndex = 0; |
|
|
|
|
nd++; |
|
|
|
|
|
|
|
|
|
LevelMonsterTypes[i].mdeadval = nd; |
|
|
|
|
@ -47,12 +47,12 @@ void InitDead()
|
|
|
|
|
|
|
|
|
|
nd++; // Unused blood spatter
|
|
|
|
|
|
|
|
|
|
for (auto &dead : Dead[nd].data) |
|
|
|
|
dead = MissileSpriteData[MFILE_SHATTER1].animData[0].get(); |
|
|
|
|
for (auto &corpse : Corpses[nd].data) |
|
|
|
|
corpse = MissileSpriteData[MFILE_SHATTER1].animData[0].get(); |
|
|
|
|
|
|
|
|
|
Dead[nd].frame = 12; |
|
|
|
|
Dead[nd].width = 128; |
|
|
|
|
Dead[nd].translationPaletteIndex = 0; |
|
|
|
|
Corpses[nd].frame = 12; |
|
|
|
|
Corpses[nd].width = 128; |
|
|
|
|
Corpses[nd].translationPaletteIndex = 0; |
|
|
|
|
nd++; |
|
|
|
|
|
|
|
|
|
stonendx = nd; |
|
|
|
|
@ -60,20 +60,20 @@ void InitDead()
|
|
|
|
|
for (int i = 0; i < ActiveMonsterCount; i++) { |
|
|
|
|
auto &monster = Monsters[ActiveMonsters[i]]; |
|
|
|
|
if (monster._uniqtype != 0) { |
|
|
|
|
InitDeadAnimationFromMonster(Dead[nd], *monster.MType); |
|
|
|
|
Dead[nd].translationPaletteIndex = monster._uniqtrans + 4; |
|
|
|
|
InitDeadAnimationFromMonster(Corpses[nd], *monster.MType); |
|
|
|
|
Corpses[nd].translationPaletteIndex = monster._uniqtrans + 4; |
|
|
|
|
nd++; |
|
|
|
|
|
|
|
|
|
monster._udeadval = nd; |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
assert(static_cast<unsigned>(nd) <= MaxDead); |
|
|
|
|
assert(static_cast<unsigned>(nd) <= MaxCorpses); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
void AddDead(Point tilePosition, int8_t dv, Direction ddir) |
|
|
|
|
void AddCorpse(Point tilePosition, int8_t dv, Direction ddir) |
|
|
|
|
{ |
|
|
|
|
dDead[tilePosition.x][tilePosition.y] = (dv & 0x1F) + (ddir << 5); |
|
|
|
|
dCorpse[tilePosition.x][tilePosition.y] = (dv & 0x1F) + (ddir << 5); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
void SyncUniqDead() |
|
|
|
|
@ -84,7 +84,7 @@ void SyncUniqDead()
|
|
|
|
|
continue; |
|
|
|
|
for (int dx = 0; dx < MAXDUNX; dx++) { |
|
|
|
|
for (int dy = 0; dy < MAXDUNY; dy++) { |
|
|
|
|
if ((dDead[dx][dy] & 0x1F) == monster._udeadval) |
|
|
|
|
if ((dCorpse[dx][dy] & 0x1F) == monster._udeadval) |
|
|
|
|
ChangeLightXY(monster.mlid, { dx, dy }); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|