mirror of
https://github.com/ZDoom/Raze.git
synced 2025-03-13 04:24:39 +00:00
- Exhumed: Initial conversion of seq_PlotSequence()
to new backend hashtable.
This commit is contained in:
parent
4d1466217b
commit
f404708f51
26 changed files with 197 additions and 196 deletions
|
@ -259,7 +259,7 @@ void AIAnim::Draw(RunListEvent* ev)
|
|||
const auto pActor = ev->pObjActor;
|
||||
if (!pActor) return;
|
||||
|
||||
seq_PlotSequence(ev->nParam, pActor->nSeq, pActor->nFrame, 0x101);
|
||||
//seq_PlotSequence(ev->nParam, pActor->nSeq, pActor->nFrame, 0x101);
|
||||
ev->pTSprite->ownerActor = nullptr;
|
||||
}
|
||||
|
||||
|
|
|
@ -106,6 +106,8 @@ void BuildAnubis(DExhumedActor* ap, const DVector3& pos, sectortype* pSector, DA
|
|||
|
||||
ap->spr.intowner = runlist_AddRunRec(ap->spr.lotag - 1, ap, 0x90000);
|
||||
|
||||
ap->nSeqFile = "anubis";
|
||||
|
||||
runlist_AddRunRec(NewRun, ap, 0x90000);
|
||||
nCreaturesTotal++;
|
||||
}
|
||||
|
@ -337,10 +339,11 @@ void AIAnubis::Tick(RunListEvent* ev)
|
|||
|
||||
void AIAnubis::Draw(RunListEvent* ev)
|
||||
{
|
||||
const auto ap = ev->pObjActor;
|
||||
if (!ap) return;
|
||||
|
||||
seq_PlotSequence(ev->nParam, getSeqFromId(kSeqAnubis, AnubisSeq[ap->nAction].nSeqId), ap->nFrame, AnubisSeq[ap->nAction].nFlags);
|
||||
if (const auto ap = ev->pObjActor)
|
||||
{
|
||||
const auto anubisSeq = &AnubisSeq[ap->nAction];
|
||||
seq_PlotSequence(ev->nParam, ap->nSeqFile, anubisSeq->nSeqId, ap->nFrame, anubisSeq->nFlags);
|
||||
}
|
||||
}
|
||||
|
||||
void AIAnubis::RadialDamage(RunListEvent* ev)
|
||||
|
|
|
@ -130,7 +130,7 @@ void AIBubble::Draw(RunListEvent* ev)
|
|||
const auto pActor = ev->pObjActor;
|
||||
if (!pActor) return;
|
||||
|
||||
seq_PlotSequence(ev->nParam, pActor->nSeq, pActor->nFrame, 1);
|
||||
//seq_PlotSequence(ev->nParam, pActor->nSeq, pActor->nFrame, 1);
|
||||
ev->pTSprite->ownerActor = nullptr;
|
||||
}
|
||||
|
||||
|
|
|
@ -854,7 +854,7 @@ void AIBullet::Draw(RunListEvent* ev)
|
|||
}
|
||||
else
|
||||
{
|
||||
seq_PlotSequence(ev->nParam, nSeq, BulletList[nBullet].nFrame, 0);
|
||||
//seq_PlotSequence(ev->nParam, nSeq, BulletList[nBullet].nFrame, 0);
|
||||
ev->pTSprite->ownerActor = nullptr;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -580,6 +580,7 @@ void DExhumedActor::Serialize(FSerializer& arc)
|
|||
("channel", nChannel)
|
||||
("damage", nDamage)
|
||||
("seq", nSeq)
|
||||
("seqfile", nSeqFile)
|
||||
("flags", nFlags)
|
||||
("angle2", pitch)
|
||||
|
||||
|
|
|
@ -25,7 +25,8 @@ public:
|
|||
|
||||
int16_t nHealth;
|
||||
int16_t nSeq;
|
||||
int16_t nFrame;
|
||||
FName nSeqFile;
|
||||
uint16_t nFrame;
|
||||
int16_t nFlags;
|
||||
int16_t nAction;
|
||||
int16_t nCount;
|
||||
|
|
|
@ -74,6 +74,8 @@ void BuildFishLimb(DExhumedActor* pActor, int anim)
|
|||
pChunkActor->spr.extra = -1;
|
||||
pChunkActor->spr.intowner = runlist_AddRunRec(pChunkActor->spr.lotag - 1, pChunkActor, 0x200000);
|
||||
pChunkActor->spr.hitag = runlist_AddRunRec(NewRun, pChunkActor, 0x200000);
|
||||
|
||||
pChunkActor->nSeqFile = "fish";
|
||||
}
|
||||
|
||||
void BuildBlood(const DVector3& pos, sectortype* pSector)
|
||||
|
@ -147,10 +149,10 @@ void AIFishLimb::Tick(RunListEvent* ev)
|
|||
|
||||
void AIFishLimb::Draw(RunListEvent* ev)
|
||||
{
|
||||
auto pActor = ev->pObjActor;
|
||||
if (pActor == nullptr) return;
|
||||
int nSeq = getSeqFromId(kSeqFish, pActor->nCount);
|
||||
seq_PlotSequence(ev->nParam, nSeq, pActor->nFrame, 1);
|
||||
if (const auto pActor = ev->pObjActor)
|
||||
{
|
||||
seq_PlotSequence(ev->nParam, pActor->nSeqFile, pActor->nCount, pActor->nFrame, 1);
|
||||
}
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------
|
||||
|
@ -199,6 +201,8 @@ void BuildFish(DExhumedActor* pActor, const DVector3& pos, sectortype* pSector,
|
|||
pActor->spr.intowner = runlist_AddRunRec(pActor->spr.lotag - 1, pActor, 0x120000);
|
||||
pActor->nRun = runlist_AddRunRec(NewRun, pActor, 0x120000);
|
||||
|
||||
pActor->nSeqFile = "fish";
|
||||
|
||||
nCreaturesTotal++;
|
||||
}
|
||||
|
||||
|
@ -254,13 +258,12 @@ void DestroyFish(DExhumedActor* pActor)
|
|||
|
||||
void AIFish::Draw(RunListEvent* ev)
|
||||
{
|
||||
auto pActor = ev->pObjActor;
|
||||
if (pActor == nullptr) return;
|
||||
int nAction = pActor->nAction;
|
||||
|
||||
seq_PlotSequence(ev->nParam, getSeqFromId(kSeqFish, FishSeq[nAction].nSeqId), pActor->nFrame, FishSeq[nAction].nFlags);
|
||||
ev->pTSprite->ownerActor = nullptr;
|
||||
return;
|
||||
if (const auto pActor = ev->pObjActor)
|
||||
{
|
||||
const auto fishSeq = &FishSeq[pActor->nAction];
|
||||
seq_PlotSequence(ev->nParam, pActor->nSeqFile, fishSeq->nSeqId, pActor->nFrame, fishSeq->nFlags);
|
||||
ev->pTSprite->ownerActor = nullptr;
|
||||
}
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------
|
||||
|
|
|
@ -234,14 +234,19 @@ void ExplodeGrenade(DExhumedActor* pActor)
|
|||
|
||||
void AIGrenade::Draw(RunListEvent* ev)
|
||||
{
|
||||
auto pActor = ev->pObjActor;
|
||||
if (!pActor) return;
|
||||
|
||||
int nSeq = pActor->nFrame ? getSeqFromId(kSeqGrenBoom) : getSeqFromId(kSeqGrenRoll, pActor->nIndex);
|
||||
seq_PlotSequence(ev->nParam, nSeq, pActor->nHealth >> 8, 1);
|
||||
if (const auto pActor = ev->pObjActor)
|
||||
{
|
||||
if (pActor->nFrame)
|
||||
{
|
||||
seq_PlotSequence(ev->nParam, "grenboom", 0, pActor->nHealth >> 8, 1);
|
||||
}
|
||||
else
|
||||
{
|
||||
seq_PlotSequence(ev->nParam, "grenroll", pActor->nIndex, pActor->nHealth >> 8, 1);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
//---------------------------------------------------------------------------
|
||||
//
|
||||
//
|
||||
|
|
|
@ -62,6 +62,8 @@ DExhumedActor* BuildLavaLimb(DExhumedActor* pActor, int move, double height)
|
|||
pLimbActor->spr.intowner = runlist_AddRunRec(pLimbActor->spr.lotag - 1, pLimbActor, 0x160000);
|
||||
pLimbActor->spr.hitag = runlist_AddRunRec(NewRun, pLimbActor, 0x160000);
|
||||
|
||||
pLimbActor->nSeqFile = "lavag";
|
||||
|
||||
return pLimbActor;
|
||||
}
|
||||
|
||||
|
@ -90,9 +92,10 @@ void AILavaDudeLimb::Tick(RunListEvent* ev)
|
|||
|
||||
void AILavaDudeLimb::Draw(RunListEvent* ev)
|
||||
{
|
||||
auto pActor = ev->pObjActor;
|
||||
if (!pActor) return;
|
||||
seq_PlotSequence(ev->nParam, getSeqFromId(kSeqLavag, 30) + pActor->spr.picnum, 0, 1);
|
||||
if (const auto pActor = ev->pObjActor)
|
||||
{
|
||||
seq_PlotSequence(ev->nParam, pActor->nSeqFile, 30 + pActor->spr.picnum, 0, 1);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
@ -119,6 +122,7 @@ void BuildLava(DExhumedActor* pActor, const DVector3& pos, sectortype* pSector,
|
|||
pActor->clipdist = 31.75;
|
||||
pActor->spr.xoffset = 0;
|
||||
pActor->spr.yoffset = 0;
|
||||
pActor->nSeqFile = "lavag";
|
||||
pActor->spr.picnum = seq_GetSeqPicnum(kSeqLavag, LavadudeSeq[3].nSeqId, 0);
|
||||
pActor->vel.X = 0;
|
||||
pActor->vel.Y = 0;
|
||||
|
@ -146,15 +150,12 @@ void BuildLava(DExhumedActor* pActor, const DVector3& pos, sectortype* pSector,
|
|||
|
||||
void AILavaDude::Draw(RunListEvent* ev)
|
||||
{
|
||||
auto pActor = ev->pObjActor;
|
||||
if (!pActor) return;
|
||||
|
||||
int nAction = pActor->nAction;
|
||||
int nSeq = getSeqFromId(kSeqLavag, LavadudeSeq[nAction].nSeqId);
|
||||
|
||||
seq_PlotSequence(ev->nParam, nSeq, pActor->nFrame, LavadudeSeq[nAction].nFlags);
|
||||
ev->pTSprite->ownerActor = nullptr;
|
||||
return;
|
||||
if (const auto pActor = ev->pObjActor)
|
||||
{
|
||||
const auto lavadudeSeq = &LavadudeSeq[pActor->nAction];
|
||||
seq_PlotSequence(ev->nParam, pActor->nSeqFile, lavadudeSeq->nSeqId, pActor->nFrame, lavadudeSeq->nFlags);
|
||||
ev->pTSprite->ownerActor = nullptr;
|
||||
}
|
||||
}
|
||||
|
||||
void AILavaDude::Damage(RunListEvent* ev)
|
||||
|
|
|
@ -84,16 +84,18 @@ void BuildLion(DExhumedActor* pActor, const DVector3& pos, sectortype* pSector,
|
|||
|
||||
pActor->nRun = runlist_AddRunRec(NewRun, pActor, 0x130000);
|
||||
|
||||
pActor->nSeqFile = "lion";
|
||||
|
||||
nCreaturesTotal++;
|
||||
}
|
||||
|
||||
void AILion::Draw(RunListEvent* ev)
|
||||
{
|
||||
auto pActor = ev->pObjActor;
|
||||
if (!pActor) return;
|
||||
int nAction = pActor->nAction;
|
||||
|
||||
seq_PlotSequence(ev->nParam, getSeqFromId(kSeqLion, LionSeq[nAction].nSeqId), pActor->nFrame, LionSeq[nAction].nFlags);
|
||||
if (const auto pActor = ev->pObjActor)
|
||||
{
|
||||
const auto lionSeq = &LionSeq[pActor->nAction];
|
||||
seq_PlotSequence(ev->nParam, pActor->nSeqFile, lionSeq->nSeqId, pActor->nFrame, lionSeq->nFlags);
|
||||
}
|
||||
}
|
||||
|
||||
void AILion::RadialDamage(RunListEvent* ev)
|
||||
|
|
|
@ -85,6 +85,8 @@ void BuildMummy(DExhumedActor* pActor, const DVector3& pos, sectortype* pSector,
|
|||
|
||||
pActor->nRun = runlist_AddRunRec(NewRun, pActor, 0xE0000);
|
||||
|
||||
pActor->nSeqFile = "mummy";
|
||||
|
||||
nCreaturesTotal++;
|
||||
}
|
||||
|
||||
|
@ -415,12 +417,11 @@ void AIMummy::Tick(RunListEvent* ev)
|
|||
|
||||
void AIMummy::Draw(RunListEvent* ev)
|
||||
{
|
||||
auto pActor = ev->pObjActor;
|
||||
if (!pActor) return;
|
||||
int nAction = pActor->nAction;
|
||||
|
||||
seq_PlotSequence(ev->nParam, getSeqFromId(kSeqMummy, MummySeq[nAction].nSeqId), pActor->nFrame, MummySeq[nAction].nFlags);
|
||||
return;
|
||||
if (const auto pActor = ev->pObjActor)
|
||||
{
|
||||
const auto mummySeq = &MummySeq[pActor->nAction];
|
||||
seq_PlotSequence(ev->nParam, pActor->nSeqFile, mummySeq->nSeqId, pActor->nFrame, mummySeq->nFlags);
|
||||
}
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------
|
||||
|
|
|
@ -31,8 +31,8 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
|||
|
||||
BEGIN_PS_NS
|
||||
|
||||
static const int8_t ObjectSeq[] = {
|
||||
46, -1, 72, -1
|
||||
static const FName ObjectSeq[] = {
|
||||
"firepot", NAME_None, "drum", NAME_None
|
||||
};
|
||||
|
||||
static const int16_t ObjectStatnum[] = {
|
||||
|
@ -1884,19 +1884,16 @@ DExhumedActor* BuildObject(DExhumedActor* pActor, int nOjectType, int nHitag)
|
|||
}
|
||||
|
||||
pActor->nRun = runlist_AddRunRec(NewRun, pActor, 0x170000);
|
||||
pActor->nSeqFile = ObjectSeq[nOjectType];
|
||||
|
||||
int nSeq = ObjectSeq[nOjectType];
|
||||
|
||||
if (nSeq > -1)
|
||||
if (pActor->nSeqFile != NAME_None)
|
||||
{
|
||||
pActor->nSeq = getSeqFromId(nSeq);
|
||||
|
||||
if (!nOjectType) // if not Explosion Trigger (e.g. Exploding Fire Cauldron)
|
||||
{
|
||||
pActor->nFrame = RandomSize(4) % (getSeqFrameCount(pActor->nSeq) - 1);
|
||||
pActor->nFrame = RandomSize(4) % (getSequence(pActor->nSeqFile).Size() - 1);
|
||||
}
|
||||
|
||||
auto pActor2 = insertActor(pActor->sector(), 0);
|
||||
auto pActor2 = insertActor(pActor->sector(), 0);
|
||||
pActor->pTarget = pActor2;
|
||||
pActor->nIndex2 = -1;
|
||||
|
||||
|
@ -1906,7 +1903,6 @@ DExhumedActor* BuildObject(DExhumedActor* pActor, int nOjectType, int nHitag)
|
|||
else
|
||||
{
|
||||
pActor->nFrame = 0;
|
||||
pActor->nSeq = -1;
|
||||
|
||||
if (pActor->spr.statnum == kStatDestructibleSprite) {
|
||||
pActor->nIndex2 = -1;
|
||||
|
@ -1949,7 +1945,6 @@ void AIObject::Tick(RunListEvent* ev)
|
|||
auto pActor = ev->pObjActor;
|
||||
if (!pActor) return;
|
||||
int nStat = pActor->spr.statnum;
|
||||
int nSeq = pActor->nSeq;
|
||||
|
||||
if (nStat == 97 || (!(pActor->spr.cstat & CSTAT_SPRITE_BLOCK_ALL))) {
|
||||
return;
|
||||
|
@ -1960,14 +1955,14 @@ void AIObject::Tick(RunListEvent* ev)
|
|||
}
|
||||
|
||||
// do animation
|
||||
if (nSeq != -1)
|
||||
if (pActor->nSeqFile != NAME_None)
|
||||
{
|
||||
pActor->nFrame++;
|
||||
if (pActor->nFrame >= getSeqFrameCount(nSeq)) {
|
||||
pActor->nFrame = 0;
|
||||
}
|
||||
const auto& nSeqFrames = getSequence(pActor->nSeqFile);
|
||||
|
||||
pActor->spr.picnum = seq_GetSeqPicnum2(nSeq, pActor->nFrame);
|
||||
if (++pActor->nFrame >= nSeqFrames.Size())
|
||||
pActor->nFrame = 0;
|
||||
|
||||
pActor->spr.picnum = nSeqFrames[pActor->nFrame].chunks[0].picnum;
|
||||
}
|
||||
|
||||
if (pActor->nHealth >= 0) {
|
||||
|
@ -2100,15 +2095,10 @@ void AIObject::Damage(RunListEvent* ev)
|
|||
|
||||
void AIObject::Draw(RunListEvent* ev)
|
||||
{
|
||||
auto pActor = ev->pObjActor;
|
||||
if (!pActor) return;
|
||||
int nSeq = pActor->nSeq;
|
||||
|
||||
if (nSeq > -1)
|
||||
if (ev->pObjActor && ev->pObjActor->nSeqFile != NAME_None)
|
||||
{
|
||||
seq_PlotSequence(ev->nParam, nSeq, pActor->nFrame, 1);
|
||||
seq_PlotSequence(ev->nParam, ev->pObjActor->nSeqFile, 0, ev->pObjActor->nFrame, 1);
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------
|
||||
|
|
|
@ -228,6 +228,7 @@ void RestartPlayer(int nPlayer)
|
|||
pPlayerActor->vel.Z = 0;
|
||||
pPlayerActor->spr.Angles.Pitch = nullAngle;
|
||||
pPlayerActor->spr.intowner = runlist_AddRunRec(pPlayerActor->spr.lotag - 1, nPlayer, 0xA0000);
|
||||
pPlayerActor->nSeqFile = "joe";
|
||||
ChangeActorStat(pPlayerActor, 100);
|
||||
|
||||
if (nTotalPlayers > 1)
|
||||
|
@ -460,11 +461,13 @@ void SetPlayerMummified(int nPlayer, int bIsMummified)
|
|||
{
|
||||
pPlayer->nAction = 13;
|
||||
pPlayer->nSeq = kSeqMummy;
|
||||
pPlayerActor->nSeqFile = "mummy";
|
||||
}
|
||||
else
|
||||
{
|
||||
pPlayer->nAction = 0;
|
||||
pPlayer->nSeq = kSeqJoe;
|
||||
pPlayerActor->nSeqFile = "joe";
|
||||
}
|
||||
|
||||
pPlayer->nSeqSize = 0;
|
||||
|
@ -483,6 +486,7 @@ void ShootStaff(int nPlayer)
|
|||
pPlayer->nAction = 15;
|
||||
pPlayer->nSeqSize = 0;
|
||||
pPlayer->nSeq = kSeqJoe;
|
||||
pPlayer->pActor->nSeqFile = "joe";
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------
|
||||
|
@ -527,9 +531,9 @@ void AIPlayer::Draw(RunListEvent* ev)
|
|||
assert(nPlayer >= 0 && nPlayer < kMaxPlayers);
|
||||
|
||||
const auto pPlayer = &PlayerList[nPlayer];
|
||||
const auto nAction = pPlayer->nAction;
|
||||
|
||||
seq_PlotSequence(ev->nParam, getSeqFromId(pPlayer->nSeq, PlayerSeq[nAction].nSeqId), pPlayer->nSeqSize, PlayerSeq[nAction].nFlags);
|
||||
const auto pPlayerActor = pPlayer->pActor;
|
||||
const auto playerSeq = &PlayerSeq[pPlayer->nAction];
|
||||
seq_PlotSequence(ev->nParam, pPlayerActor->nSeqFile, playerSeq->nSeqId, pPlayer->nSeqSize, playerSeq->nFlags);
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------
|
||||
|
@ -2062,6 +2066,7 @@ FSerializer& Serialize(FSerializer& arc, const char* keyname, Player& w, Player*
|
|||
("invincible", w.invincibility)
|
||||
("air", w.nAir)
|
||||
("seq", w.nSeq)
|
||||
("seqfile", w.nSeqFile)
|
||||
("item", w.nItem)
|
||||
("maskamount", w.nMaskAmount)
|
||||
("keys", w.keys)
|
||||
|
@ -2074,7 +2079,6 @@ FSerializer& Serialize(FSerializer& arc, const char* keyname, Player& w, Player*
|
|||
("field38", w.nNextWeapon)
|
||||
("field3a", w.nState)
|
||||
("field3c", w.nLastWeapon)
|
||||
("seq", w.nSeq)
|
||||
("angles", w.Angles)
|
||||
("lives", w.nLives)
|
||||
("double", w.nDouble)
|
||||
|
|
|
@ -61,6 +61,7 @@ struct Player
|
|||
int16_t invincibility;
|
||||
int16_t nAir;
|
||||
int16_t nSeq;
|
||||
FName nSeqFile;
|
||||
int16_t nMaskAmount;
|
||||
uint16_t keys;
|
||||
int16_t nMagic;
|
||||
|
|
|
@ -494,6 +494,7 @@ void BuildQueenEgg(int nQueen, int nVal)
|
|||
pActor2->spr.lotag = runlist_HeadRun() + 1;
|
||||
pActor2->spr.extra = -1;
|
||||
pActor2->spr.hitag = 0;
|
||||
pActor2->nSeqFile = "queenegg";
|
||||
|
||||
GrabTimeSlot(3);
|
||||
|
||||
|
@ -723,9 +724,10 @@ void AIQueenEgg::Damage(RunListEvent* ev)
|
|||
|
||||
void AIQueenEgg::Draw(RunListEvent* ev)
|
||||
{
|
||||
int nEgg = RunData[ev->nRun].nObjIndex;
|
||||
Egg* pEgg = &QueenEgg[nEgg];
|
||||
seq_PlotSequence(ev->nParam, getSeqFromId(kSeqQueenEgg, EggSeq[pEgg->nAction].nSeqId), pEgg->nFrame, EggSeq[pEgg->nAction].nFlags);
|
||||
const auto nEgg = RunData[ev->nRun].nObjIndex;
|
||||
const auto pEgg = &QueenEgg[nEgg];
|
||||
const auto eggSeq = &EggSeq[pEgg->nAction];
|
||||
seq_PlotSequence(ev->nParam, pEgg->pActor->nSeqFile, eggSeq->nSeqId, pEgg->nFrame, eggSeq->nFlags);
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------
|
||||
|
@ -762,6 +764,7 @@ void BuildQueenHead(int nQueen)
|
|||
pActor2->spr.lotag = runlist_HeadRun() + 1;
|
||||
pActor2->spr.hitag = 0;
|
||||
pActor2->spr.extra = -1;
|
||||
pActor2->nSeqFile = "queen";
|
||||
|
||||
GrabTimeSlot(3);
|
||||
|
||||
|
@ -1126,25 +1129,15 @@ void AIQueenHead::Damage(RunListEvent* ev)
|
|||
|
||||
void AIQueenHead::Draw(RunListEvent* ev)
|
||||
{
|
||||
int nHead = RunData[ev->nRun].nObjIndex;
|
||||
int nAction = QueenHead.nAction;
|
||||
|
||||
int nSeq = getSeqFromId(kSeqQueen);
|
||||
|
||||
int edx;
|
||||
|
||||
if (nHead == 0)
|
||||
if (RunData[ev->nRun].nObjIndex == 0)
|
||||
{
|
||||
edx = HeadSeq[nAction].nFlags;
|
||||
nSeq += HeadSeq[nAction].nSeqId;
|
||||
const auto headSeq = &HeadSeq[QueenHead.nAction];
|
||||
seq_PlotSequence(ev->nParam, QueenHead.pActor->nSeqFile, headSeq->nSeqId, QueenHead.nFrame, headSeq->nFlags);
|
||||
}
|
||||
else
|
||||
{
|
||||
edx = 1;
|
||||
nSeq += 73;
|
||||
seq_PlotSequence(ev->nParam, QueenHead.pActor->nSeqFile, 73, QueenHead.nFrame, 1);
|
||||
}
|
||||
|
||||
seq_PlotSequence(ev->nParam, nSeq, QueenHead.nFrame, edx);
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------
|
||||
|
@ -1189,6 +1182,7 @@ void BuildQueen(DExhumedActor* pActor, const DVector3& pos, sectortype* pSector,
|
|||
pActor->spr.lotag = runlist_HeadRun() + 1;
|
||||
pActor->spr.extra = -1;
|
||||
pActor->spr.hitag = 0;
|
||||
pActor->nSeqFile = "queen";
|
||||
|
||||
GrabTimeSlot(3);
|
||||
|
||||
|
@ -1569,10 +1563,12 @@ void AIQueen::Damage(RunListEvent* ev)
|
|||
|
||||
void AIQueen::Draw(RunListEvent* ev)
|
||||
{
|
||||
int nQueen = RunData[ev->nRun].nObjIndex;
|
||||
const int nQueen = RunData[ev->nRun].nObjIndex;
|
||||
assert(nQueen >= 0 && nQueen < kMaxQueens);
|
||||
int nAction = QueenList[nQueen].nAction;
|
||||
seq_PlotSequence(ev->nParam, getSeqFromId(kSeqQueen, QueenSeq[nAction].nSeqId), QueenList[nQueen].nFrame, QueenSeq[nAction].nFlags);
|
||||
|
||||
const auto thisQueen = &QueenList[nQueen];
|
||||
const auto queenSeq = &QueenSeq[thisQueen->nAction];
|
||||
seq_PlotSequence(ev->nParam, thisQueen->pActor->nSeqFile, queenSeq->nSeqId, thisQueen->nFrame, queenSeq->nFlags);
|
||||
}
|
||||
|
||||
END_PS_NS
|
||||
|
|
|
@ -123,6 +123,7 @@ void BuildRa(int nPlayer)
|
|||
pActor->spr.pal = 1;
|
||||
pActor->spr.scale = DVector2(1, 1);
|
||||
pActor->spr.pos = pPlayerActor->spr.pos;
|
||||
pActor->nSeqFile = "eyehit";
|
||||
|
||||
// GrabTimeSlot(3);
|
||||
|
||||
|
@ -335,10 +336,9 @@ void AIRa::Tick(RunListEvent* ev)
|
|||
|
||||
void AIRa::Draw(RunListEvent* ev)
|
||||
{
|
||||
int nPlayer = RunData[ev->nRun].nObjIndex;
|
||||
int nSeq = getSeqFromId(kSeqEyeHit, RaSeq[Ra[nPlayer].nAction].nSeqId);
|
||||
|
||||
seq_PlotSequence(ev->nParam, nSeq, Ra[nPlayer].nFrame, 1);
|
||||
const auto nPlayer = RunData[ev->nRun].nObjIndex;
|
||||
const auto pRa = &Ra[nPlayer];
|
||||
seq_PlotSequence(ev->nParam, "eyehit", RaSeq[pRa->nAction].nSeqId, pRa->nFrame, 1);
|
||||
ev->pTSprite->ownerActor = nullptr;
|
||||
}
|
||||
|
||||
|
|
|
@ -135,6 +135,8 @@ void BuildRat(DExhumedActor* pActor, const DVector3& pos, sectortype* pSector, D
|
|||
pActor->spr.intowner = runlist_AddRunRec(pActor->spr.lotag - 1, pActor, 0x240000);
|
||||
|
||||
pActor->nRun = runlist_AddRunRec(NewRun, pActor, 0x240000);
|
||||
|
||||
pActor->nSeqFile = "rat";
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------
|
||||
|
@ -220,11 +222,11 @@ void AIRat::Damage(RunListEvent* ev)
|
|||
|
||||
void AIRat::Draw(RunListEvent* ev)
|
||||
{
|
||||
auto pActor = ev->pObjActor;
|
||||
if (!pActor) return;
|
||||
int nAction = pActor->nAction;
|
||||
|
||||
seq_PlotSequence(ev->nParam, getSeqFromId(kSeqRat, RatSeq[nAction].nSeqId), pActor->nFrame, RatSeq[nAction].nFlags);
|
||||
if (const auto pActor = ev->pObjActor)
|
||||
{
|
||||
const auto ratSeq = &RatSeq[pActor->nAction];
|
||||
seq_PlotSequence(ev->nParam, pActor->nSeqFile, ratSeq->nSeqId, pActor->nFrame, ratSeq->nFlags);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -86,6 +86,8 @@ void BuildRex(DExhumedActor* pActor, const DVector3& pos, sectortype* pSector, D
|
|||
|
||||
pActor->spr.intowner = runlist_AddRunRec(pActor->spr.lotag - 1, pActor, 0x180000);
|
||||
|
||||
pActor->nSeqFile = "rex";
|
||||
|
||||
// this isn't stored anywhere.
|
||||
runlist_AddRunRec(NewRun, pActor, 0x180000);
|
||||
|
||||
|
@ -166,13 +168,11 @@ void AIRex::Damage(RunListEvent* ev)
|
|||
|
||||
void AIRex::Draw(RunListEvent* ev)
|
||||
{
|
||||
auto pActor = ev->pObjActor;
|
||||
if (!pActor) return;
|
||||
|
||||
int nAction = pActor->nAction;
|
||||
|
||||
seq_PlotSequence(ev->nParam, getSeqFromId(kSeqRex, RexSeq[nAction].nSeqId), pActor->nFrame, RexSeq[nAction].nFlags);
|
||||
return;
|
||||
if (const auto pActor = ev->pObjActor)
|
||||
{
|
||||
const auto rexSeq = &RexSeq[pActor->nAction];
|
||||
seq_PlotSequence(ev->nParam, pActor->nSeqFile, rexSeq->nSeqId, pActor->nFrame, rexSeq->nFlags);
|
||||
}
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------
|
||||
|
|
|
@ -90,6 +90,8 @@ void BuildRoach(int nType, DExhumedActor* pActor, const DVector3& pos, sectortyp
|
|||
pActor->spr.intowner = runlist_AddRunRec(pActor->spr.lotag - 1, pActor, 0x1C0000);
|
||||
pActor->nRun = runlist_AddRunRec(NewRun, pActor, 0x1C0000);
|
||||
|
||||
pActor->nSeqFile = "roach";
|
||||
|
||||
nCreaturesTotal++;
|
||||
}
|
||||
|
||||
|
@ -106,12 +108,11 @@ void GoRoach(DExhumedActor* pActor)
|
|||
|
||||
void AIRoach::Draw(RunListEvent* ev)
|
||||
{
|
||||
auto pActor = ev->pObjActor;
|
||||
if (!pActor) return;
|
||||
int nAction = pActor->nAction;
|
||||
|
||||
seq_PlotSequence(ev->nParam, getSeqFromId(kSeqRoach, RoachSeq[nAction].nSeqId), pActor->nFrame, RoachSeq[nAction].nFlags);
|
||||
return;
|
||||
if (const auto pActor = ev->pObjActor)
|
||||
{
|
||||
const auto roachSeq = &RoachSeq[pActor->nAction];
|
||||
seq_PlotSequence(ev->nParam, pActor->nSeqFile, roachSeq->nSeqId, pActor->nFrame, roachSeq->nFlags);
|
||||
}
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------
|
||||
|
|
|
@ -89,6 +89,8 @@ void BuildScorp(DExhumedActor* pActor, const DVector3& pos, sectortype* pSector,
|
|||
pActor->spr.intowner = runlist_AddRunRec(pActor->spr.lotag - 1, pActor, 0x220000);
|
||||
pActor->nRun = runlist_AddRunRec(NewRun, pActor, 0x220000);
|
||||
|
||||
pActor->nSeqFile = "scorp";
|
||||
|
||||
nCreaturesTotal++;
|
||||
}
|
||||
|
||||
|
@ -100,12 +102,11 @@ void BuildScorp(DExhumedActor* pActor, const DVector3& pos, sectortype* pSector,
|
|||
|
||||
void AIScorp::Draw(RunListEvent* ev)
|
||||
{
|
||||
auto pActor = ev->pObjActor;
|
||||
if (!pActor) return;
|
||||
|
||||
int nAction = pActor->nAction;
|
||||
|
||||
seq_PlotSequence(ev->nParam, getSeqFromId(kSeqScorp, ScorpSeq[nAction].nSeqId), pActor->nFrame, ScorpSeq[nAction].nFlags);
|
||||
if (const auto pActor = ev->pObjActor)
|
||||
{
|
||||
const auto scorpSeq = &ScorpSeq[pActor->nAction];
|
||||
seq_PlotSequence(ev->nParam, pActor->nSeqFile, scorpSeq->nSeqId, pActor->nFrame, scorpSeq->nFlags);
|
||||
}
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------
|
||||
|
|
|
@ -149,7 +149,7 @@ const char *SeqNames[kMaxSEQFiles] =
|
|||
};
|
||||
|
||||
static int16_t SeqOffsets[kMaxSEQFiles];
|
||||
static TMap<FName, TArray<TArray<SeqFrame>>> FileSeqMap;
|
||||
static TMap<FName, SeqArray> FileSeqMap;
|
||||
|
||||
|
||||
//---------------------------------------------------------------------------
|
||||
|
@ -279,6 +279,17 @@ int getSeqFrameChunkFlags(const int nChunk)
|
|||
//
|
||||
//---------------------------------------------------------------------------
|
||||
|
||||
const SeqFrameArray& getSequence(const FName nSeqFile, const unsigned nSeqIndex)
|
||||
{
|
||||
return FileSeqMap.CheckKey(nSeqFile)->operator[](nSeqIndex);
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------
|
||||
//
|
||||
//
|
||||
//
|
||||
//---------------------------------------------------------------------------
|
||||
|
||||
int addSeq(const char *seqName)
|
||||
{
|
||||
const FStringf seqfilename("%s.seq", seqName);
|
||||
|
@ -390,7 +401,7 @@ int addSeq(const char *seqName)
|
|||
}
|
||||
|
||||
// Add hastable entry for the amount of sequences this file contains.
|
||||
auto& gSequences = FileSeqMap.Insert(FName(seqName), TArray<TArray<SeqFrame>>(nSeqs, true));
|
||||
auto& gSequences = FileSeqMap.Insert(FName(seqName), SeqArray(nSeqs, true));
|
||||
|
||||
// Read all this data into something sane.
|
||||
for (int nSeq = 0; nSeq < nSeqs; nSeq++)
|
||||
|
@ -841,52 +852,32 @@ int seq_PlotArrowSequence(int nSprite, int16_t nSeq, int nVal)
|
|||
//
|
||||
//---------------------------------------------------------------------------
|
||||
|
||||
int seq_PlotSequence(int nSprite, int16_t nSeq, int16_t nFrame, int16_t nFlags)
|
||||
void seq_PlotSequence(const int nSprite, const FName seqFile, const int16_t seqIndex, const int16_t frameIndex, const int16_t nFlags)
|
||||
{
|
||||
tspritetype* pTSprite = mytspriteArray->get(nSprite);
|
||||
|
||||
int nSeqOffset = 0;
|
||||
int seqOffset = 0;
|
||||
|
||||
if (!(nFlags & 1))
|
||||
{
|
||||
DAngle nAngle = (nCamerapos.XY() - pTSprite->pos.XY()).Angle();
|
||||
nSeqOffset = (((pTSprite->Angles.Yaw + DAngle22_5 - nAngle).Buildang()) & kAngleMask) >> 8;
|
||||
const DAngle nAngle = (nCamerapos.XY() - pTSprite->pos.XY()).Angle();
|
||||
seqOffset = (((pTSprite->Angles.Yaw + DAngle22_5 - nAngle).Buildang()) & kAngleMask) >> 8;
|
||||
}
|
||||
|
||||
int nBaseFrame = getSeqFrame(nSeq, nFrame);
|
||||
int nOffsetFrame = getSeqFrame(nSeq + nSeqOffset, nFrame);
|
||||
const auto& baseFrame = getSequence(seqFile, seqIndex)[frameIndex];
|
||||
const auto& drawFrame = getSequence(seqFile, seqIndex + seqOffset)[frameIndex];
|
||||
const auto chunkCount = drawFrame.chunks.Size();
|
||||
|
||||
int16_t nBase = getSeqFrameChunk(nOffsetFrame);
|
||||
int16_t nSize = getSeqFrameChunkCount(nOffsetFrame);
|
||||
const auto nShade = (baseFrame.flags & 4) ? pTSprite->shade - 100 : pTSprite->shade;
|
||||
const auto nStatnum = (nFlags & 0x100) ? -3 : 100;
|
||||
|
||||
int8_t shade = pTSprite->shade;
|
||||
|
||||
if (getSeqFrameFlags(nBaseFrame) & 4)
|
||||
for (unsigned i = 0; i < chunkCount; i++)
|
||||
{
|
||||
shade -= 100;
|
||||
}
|
||||
|
||||
int16_t nPict = getSeqFrameChunkPicnum(nBase);
|
||||
|
||||
int nStatOffset = (nFlags & 0x100) ? -3 : 100;
|
||||
int nStat = nSize + 1;
|
||||
nStat += nStatOffset;
|
||||
|
||||
int nMinStat = nStatOffset + 1;
|
||||
|
||||
while (1)
|
||||
{
|
||||
nStat--;
|
||||
nSize--;
|
||||
|
||||
if (nStat < nMinStat) {
|
||||
break;
|
||||
}
|
||||
const auto& seqFrameChunk = drawFrame.chunks[i];
|
||||
|
||||
tspritetype* tsp = mytspriteArray->newTSprite();
|
||||
tsp->pos = pTSprite->pos;
|
||||
|
||||
tsp->shade = shade;
|
||||
tsp->shade = nShade;
|
||||
tsp->pal = pTSprite->pal;
|
||||
tsp->scale = pTSprite->scale;
|
||||
tsp->Angles.Yaw = pTSprite->Angles.Yaw;
|
||||
|
@ -894,22 +885,20 @@ int seq_PlotSequence(int nSprite, int16_t nSeq, int16_t nFrame, int16_t nFlags)
|
|||
tsp->sectp = pTSprite->sectp;
|
||||
tsp->cstat = pTSprite->cstat |= CSTAT_SPRITE_YCENTER;
|
||||
tsp->clipdist = pTSprite->clipdist;
|
||||
tsp->statnum = nStat;
|
||||
tsp->statnum = chunkCount - i + nStatnum + 1;
|
||||
|
||||
if (getSeqFrameChunkFlags(nBase) & 1)
|
||||
if (seqFrameChunk.flags & 1)
|
||||
{
|
||||
tsp->xoffset = (int8_t)getSeqFrameChunkPosX(nBase);
|
||||
tsp->xoffset = (int8_t)seqFrameChunk.xpos;
|
||||
tsp->cstat |= CSTAT_SPRITE_XFLIP; // x-flipped
|
||||
}
|
||||
else
|
||||
{
|
||||
tsp->xoffset = -getSeqFrameChunkPosX(nBase);
|
||||
tsp->xoffset = -seqFrameChunk.xpos;
|
||||
}
|
||||
|
||||
tsp->yoffset = -getSeqFrameChunkPosY(nBase);
|
||||
tsp->picnum = getSeqFrameChunkPicnum(nBase);
|
||||
|
||||
nBase++;
|
||||
tsp->yoffset = -seqFrameChunk.ypos;
|
||||
tsp->picnum = seqFrameChunk.picnum;
|
||||
}
|
||||
|
||||
if (!(pTSprite->cstat & CSTAT_SPRITE_BLOCK_ALL) || (pTSprite->ownerActor->spr.statnum == 100 && nNetPlayerCount))
|
||||
|
@ -929,6 +918,7 @@ int seq_PlotSequence(int nSprite, int16_t nSeq, int16_t nFrame, int16_t nFlags)
|
|||
{
|
||||
pTSprite->picnum = nShadowPic;
|
||||
|
||||
const auto nPict = drawFrame.chunks[0].picnum;
|
||||
const auto nScale = max(((tileWidth(nPict) << 5) / nShadowWidth) - int16_t((nFloorZ - pTSprite->pos.Z) * 2.), 1) * REPEAT_SCALE;
|
||||
|
||||
pTSprite->cstat = CSTAT_SPRITE_ALIGNMENT_FLOOR | CSTAT_SPRITE_TRANSLUCENT;
|
||||
|
@ -938,8 +928,6 @@ int seq_PlotSequence(int nSprite, int16_t nSeq, int16_t nFrame, int16_t nFlags)
|
|||
pTSprite->pal = 0;
|
||||
}
|
||||
}
|
||||
|
||||
return nPict;
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------
|
||||
|
|
|
@ -123,6 +123,9 @@ struct SeqFrame
|
|||
TArray<SeqFrameChunk> chunks;
|
||||
};
|
||||
|
||||
using SeqFrameArray = TArray<SeqFrame>;
|
||||
using SeqArray = TArray<SeqFrameArray>;
|
||||
|
||||
extern int16_t frames;
|
||||
|
||||
extern int16_t nShadowWidth;
|
||||
|
@ -140,7 +143,7 @@ int seq_GetSeqPicnum(int16_t nSeq, int16_t edx, int16_t ebx);
|
|||
void seq_DrawStatusSequence(int16_t nSequence, uint16_t edx, int16_t ebx);
|
||||
|
||||
int seq_DrawGunSequence(int nSeqOffset, int16_t dx, double xOffs, double yOffs, int nShade, int nPal, DAngle angle, bool align = false);
|
||||
int seq_PlotSequence(int nSprite, int16_t nSeq, int16_t nFrame, int16_t nFlags);
|
||||
void seq_PlotSequence(const int nSprite, const FName seqFile, const int16_t seqIndex, const int16_t frameIndex, const int16_t nFlags);
|
||||
int seq_PlotArrowSequence(int nSprite, int16_t nSeq, int nVal);
|
||||
void seq_DrawPilotLightSeq(double xOffset, double yOffset);
|
||||
|
||||
|
@ -155,5 +158,7 @@ int getSeqFrameChunkPosY(const int nChunk);
|
|||
int getSeqFrameChunkPicnum(const int nChunk);
|
||||
int getSeqFrameChunkFlags(const int nChunk);
|
||||
|
||||
const SeqFrameArray& getSequence(const FName nSeqFile, const unsigned nSeqIndex = 0);
|
||||
|
||||
END_PS_NS
|
||||
|
||||
|
|
|
@ -90,6 +90,8 @@ void BuildSet(DExhumedActor* pActor, const DVector3& pos, sectortype* pSector, D
|
|||
|
||||
pActor->spr.intowner = runlist_AddRunRec(pActor->spr.lotag - 1, pActor, 0x190000);
|
||||
|
||||
pActor->nSeqFile = "set";
|
||||
|
||||
// this isn't stored anywhere.
|
||||
runlist_AddRunRec(NewRun, pActor, 0x190000);
|
||||
|
||||
|
@ -244,12 +246,11 @@ void AISet::Damage(RunListEvent* ev)
|
|||
|
||||
void AISet::Draw(RunListEvent* ev)
|
||||
{
|
||||
auto pActor = ev->pObjActor;
|
||||
if (!pActor) return;
|
||||
int nAction = pActor->nAction;
|
||||
|
||||
seq_PlotSequence(ev->nParam, getSeqFromId(kSeqSet, SetSeq[nAction].nSeqId), pActor->nFrame, SetSeq[nAction].nFlags);
|
||||
return;
|
||||
if (const auto pActor = ev->pObjActor)
|
||||
{
|
||||
const auto setSeq = &SetSeq[pActor->nAction];
|
||||
seq_PlotSequence(ev->nParam, pActor->nSeqFile, setSeq->nSeqId, pActor->nFrame, setSeq->nFlags);
|
||||
}
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------
|
||||
|
|
|
@ -424,15 +424,8 @@ void AISnake::Tick(RunListEvent* ev)
|
|||
|
||||
void AISnake::Draw(RunListEvent* ev)
|
||||
{
|
||||
int nSnake = RunData[ev->nRun].nObjIndex;
|
||||
int nSprite = ev->nParam;
|
||||
|
||||
if ((nSnake & 0xFF) == 0) {
|
||||
seq_PlotSequence(nSprite, getSeqFromId(kSeqSnakehed), 0, 0);
|
||||
}
|
||||
else {
|
||||
seq_PlotSequence(nSprite, getSeqFromId(kSeqSnakBody), 0, 0);
|
||||
}
|
||||
const int nSnake = RunData[ev->nRun].nObjIndex;
|
||||
seq_PlotSequence(ev->nParam, (nSnake & 0xFF) == 0 ? "snakehed" : "snakbody", 0, 0, 0);
|
||||
|
||||
ev->pTSprite->ownerActor = nullptr;
|
||||
}
|
||||
|
|
|
@ -85,6 +85,8 @@ DExhumedActor* BuildSpider(DExhumedActor* spp, const DVector3& pos, sectortype*
|
|||
|
||||
spp->nRun = runlist_AddRunRec(NewRun, spp, 0xC0000);
|
||||
|
||||
spp->nSeqFile = "spider";
|
||||
|
||||
nCreaturesTotal++;
|
||||
|
||||
return spp;
|
||||
|
@ -349,12 +351,11 @@ void AISpider::Tick(RunListEvent* ev)
|
|||
|
||||
void AISpider::Draw(RunListEvent* ev)
|
||||
{
|
||||
auto spp = ev->pObjActor;
|
||||
if (!spp) return;
|
||||
|
||||
int nAction = spp->nAction;
|
||||
|
||||
seq_PlotSequence(ev->nParam, getSeqFromId(kSeqSpider, SpiderSeq[nAction].nSeqId), spp->nFrame, SpiderSeq[nAction].nFlags);
|
||||
if (const auto spp = ev->pObjActor)
|
||||
{
|
||||
const auto spiderSeq = &SpiderSeq[spp->nAction];
|
||||
seq_PlotSequence(ev->nParam, spp->nSeqFile, spiderSeq->nSeqId, spp->nFrame, spiderSeq->nFlags);
|
||||
}
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------
|
||||
|
|
|
@ -106,6 +106,8 @@ DExhumedActor* BuildWasp(DExhumedActor* pActor, const DVector3& pos, sectortype*
|
|||
|
||||
pActor->nRun = runlist_AddRunRec(NewRun, pActor, 0x1E0000);
|
||||
|
||||
pActor->nSeqFile = "wasp";
|
||||
|
||||
nCreaturesTotal++;
|
||||
return pActor;
|
||||
}
|
||||
|
@ -118,12 +120,11 @@ DExhumedActor* BuildWasp(DExhumedActor* pActor, const DVector3& pos, sectortype*
|
|||
|
||||
void AIWasp::Draw(RunListEvent* ev)
|
||||
{
|
||||
auto pActor = ev->pObjActor;
|
||||
if (!pActor) return;
|
||||
int nAction = pActor->nAction;
|
||||
|
||||
seq_PlotSequence(ev->nParam, getSeqFromId(kSeqWasp, WaspSeq[nAction].nSeqId), pActor->nFrame, WaspSeq[nAction].nFlags);
|
||||
return;
|
||||
if (const auto pActor = ev->pObjActor)
|
||||
{
|
||||
const auto waspSeq = &WaspSeq[pActor->nAction];
|
||||
seq_PlotSequence(ev->nParam, pActor->nSeqFile, waspSeq->nSeqId, pActor->nFrame, waspSeq->nFlags);
|
||||
}
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------
|
||||
|
|
Loading…
Reference in a new issue