mirror of
https://github.com/ZDoom/Raze.git
synced 2024-11-16 01:11:44 +00:00
- use EventObject in SEQINST
This commit is contained in:
parent
2721a59dc4
commit
45a8654fc2
5 changed files with 133 additions and 131 deletions
|
@ -195,7 +195,7 @@ void setPortalFlags(int mode)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Note: wall range checks on wall[] need to be disabled because this writes beyond the regular part.
|
// Note: debug range checks on wall [] need to be disabled because this deliberately writes beyond the regular part.
|
||||||
|
|
||||||
void DrawMirrors(int x, int y, int z, fixed_t a, fixed_t horiz, int smooth, int viewPlayer)
|
void DrawMirrors(int x, int y, int z, fixed_t a, fixed_t horiz, int smooth, int viewPlayer)
|
||||||
{
|
{
|
||||||
|
|
|
@ -3515,49 +3515,51 @@ void useSeqSpawnerGen(DBloodActor* sourceactor, int objType, int index, DBloodAc
|
||||||
switch (objType)
|
switch (objType)
|
||||||
{
|
{
|
||||||
case OBJ_SECTOR:
|
case OBJ_SECTOR:
|
||||||
|
{
|
||||||
|
auto pSector = §or[index];
|
||||||
if (pXSource->data2 <= 0)
|
if (pXSource->data2 <= 0)
|
||||||
{
|
{
|
||||||
if (pXSource->data3 == 3 || pXSource->data3 == 1)
|
if (pXSource->data3 == 3 || pXSource->data3 == 1)
|
||||||
seqKill(2, index);
|
seqKill(SS_FLOOR, pSector);
|
||||||
if (pXSource->data3 == 3 || pXSource->data3 == 2)
|
if (pXSource->data3 == 3 || pXSource->data3 == 2)
|
||||||
seqKill(1, index);
|
seqKill(SS_CEILING, pSector);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
if (pXSource->data3 == 3 || pXSource->data3 == 1)
|
if (pXSource->data3 == 3 || pXSource->data3 == 1)
|
||||||
seqSpawn(pXSource->data2, SS_FLOOR, index, -1);
|
seqSpawn(pXSource->data2, SS_FLOOR, pSector, -1);
|
||||||
if (pXSource->data3 == 3 || pXSource->data3 == 2)
|
if (pXSource->data3 == 3 || pXSource->data3 == 2)
|
||||||
seqSpawn(pXSource->data2, SS_CEILING, index, -1);
|
seqSpawn(pXSource->data2, SS_CEILING, pSector, -1);
|
||||||
}
|
}
|
||||||
return;
|
return;
|
||||||
|
}
|
||||||
case OBJ_WALL:
|
case OBJ_WALL:
|
||||||
{
|
{
|
||||||
auto pWall = &wall[index];
|
auto pWall = &wall[index];
|
||||||
if (pXSource->data2 <= 0)
|
if (pXSource->data2 <= 0)
|
||||||
{
|
{
|
||||||
if (pXSource->data3 == 3 || pXSource->data3 == 1)
|
if (pXSource->data3 == 3 || pXSource->data3 == 1)
|
||||||
seqKill(0, index);
|
seqKill(SS_WALL, pWall);
|
||||||
if ((pXSource->data3 == 3 || pXSource->data3 == 2) && (pWall->cstat & CSTAT_WALL_MASKED))
|
if ((pXSource->data3 == 3 || pXSource->data3 == 2) && (pWall->cstat & CSTAT_WALL_MASKED))
|
||||||
seqKill(4, index);
|
seqKill(SS_MASKED, pWall);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
if (pXSource->data3 == 3 || pXSource->data3 == 1)
|
if (pXSource->data3 == 3 || pXSource->data3 == 1)
|
||||||
seqSpawn(pXSource->data2, SS_WALL, index, -1);
|
seqSpawn(pXSource->data2, SS_WALL, pWall, -1);
|
||||||
|
|
||||||
if (pXSource->data3 == 3 || pXSource->data3 == 2) {
|
if (pXSource->data3 == 3 || pXSource->data3 == 2) {
|
||||||
|
|
||||||
if (pWall->nextwall < 0) {
|
if (pWall->nextwall < 0) {
|
||||||
if (pXSource->data3 == 3)
|
if (pXSource->data3 == 3)
|
||||||
seqSpawn(pXSource->data2, SS_WALL, index, -1);
|
seqSpawn(pXSource->data2, SS_WALL, pWall, -1);
|
||||||
|
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
if (!(pWall->cstat & CSTAT_WALL_MASKED))
|
if (!(pWall->cstat & CSTAT_WALL_MASKED))
|
||||||
pWall->cstat |= CSTAT_WALL_MASKED;
|
pWall->cstat |= CSTAT_WALL_MASKED;
|
||||||
|
|
||||||
seqSpawn(pXSource->data2, SS_MASKED, index, -1);
|
seqSpawn(pXSource->data2, SS_MASKED, pWall, -1);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -3904,17 +3906,17 @@ bool condCheckMixed(DBloodActor* aCond, const EVENT& event, int cmpOp, bool PUSH
|
||||||
case 70:
|
case 70:
|
||||||
switch (arg3)
|
switch (arg3)
|
||||||
{
|
{
|
||||||
default: return (condCmp(seqGetID(0, wallnum(pObj)), arg1, arg2, cmpOp) || condCmp(seqGetID(4, wallnum(pObj)), arg1, arg2, cmpOp));
|
default: return (condCmp(seqGetID(SS_WALL, pObj), arg1, arg2, cmpOp) || condCmp(seqGetID(SS_MASKED, pObj), arg1, arg2, cmpOp));
|
||||||
case 1: return condCmp(seqGetID(0, wallnum(pObj)), arg1, arg2, cmpOp);
|
case 1: return condCmp(seqGetID(SS_WALL, pObj), arg1, arg2, cmpOp);
|
||||||
case 2: return condCmp(seqGetID(4, wallnum(pObj)), arg1, arg2, cmpOp);
|
case 2: return condCmp(seqGetID(SS_MASKED, pObj), arg1, arg2, cmpOp);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case 71:
|
case 71:
|
||||||
switch (arg3)
|
switch (arg3)
|
||||||
{
|
{
|
||||||
default: return (condCmp(seqGetStatus(0, wallnum(pObj)), arg1, arg2, cmpOp) || condCmp(seqGetStatus(4, wallnum(pObj)), arg1, arg2, cmpOp));
|
default: return (condCmp(seqGetStatus(SS_WALL, pObj), arg1, arg2, cmpOp) || condCmp(seqGetStatus(SS_MASKED, pObj), arg1, arg2, cmpOp));
|
||||||
case 1: return condCmp(seqGetStatus(0, wallnum(pObj)), arg1, arg2, cmpOp);
|
case 1: return condCmp(seqGetStatus(SS_WALL, pObj), arg1, arg2, cmpOp);
|
||||||
case 2: return condCmp(seqGetStatus(4, wallnum(pObj)), arg1, arg2, cmpOp);
|
case 2: return condCmp(seqGetStatus(SS_MASKED, pObj), arg1, arg2, cmpOp);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
@ -3969,17 +3971,17 @@ bool condCheckMixed(DBloodActor* aCond, const EVENT& event, int cmpOp, bool PUSH
|
||||||
// wall???
|
// wall???
|
||||||
switch (arg3)
|
switch (arg3)
|
||||||
{
|
{
|
||||||
default: return (condCmp(seqGetID(1, sectnum(pObj)), arg1, arg2, cmpOp) || condCmp(seqGetID(2, sectnum(pObj)), arg1, arg2, cmpOp));
|
default: return (condCmp(seqGetID(SS_CEILING, pObj), arg1, arg2, cmpOp) || condCmp(seqGetID(SS_FLOOR, pObj), arg1, arg2, cmpOp));
|
||||||
case 1: return condCmp(seqGetID(1, sectnum(pObj)), arg1, arg2, cmpOp);
|
case 1: return condCmp(seqGetID(SS_CEILING, pObj), arg1, arg2, cmpOp);
|
||||||
case 2: return condCmp(seqGetID(2, sectnum(pObj)), arg1, arg2, cmpOp);
|
case 2: return condCmp(seqGetID(SS_FLOOR, pObj), arg1, arg2, cmpOp);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case 71:
|
case 71:
|
||||||
switch (arg3)
|
switch (arg3)
|
||||||
{
|
{
|
||||||
default: return (condCmp(seqGetStatus(1, sectnum(pObj)), arg1, arg2, cmpOp) || condCmp(seqGetStatus(2, sectnum(pObj)), arg1, arg2, cmpOp));
|
default: return (condCmp(seqGetStatus(SS_CEILING, pObj), arg1, arg2, cmpOp) || condCmp(seqGetStatus(SS_FLOOR, pObj), arg1, arg2, cmpOp));
|
||||||
case 1: return condCmp(seqGetStatus(1, sectnum(pObj)), arg1, arg2, cmpOp);
|
case 1: return condCmp(seqGetStatus(SS_CEILING, pObj), arg1, arg2, cmpOp);
|
||||||
case 2: return condCmp(seqGetStatus(2, sectnum(pObj)), arg1, arg2, cmpOp);
|
case 2: return condCmp(seqGetStatus(SS_FLOOR, pObj), arg1, arg2, cmpOp);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
|
@ -126,10 +126,8 @@ void seqPrecacheId(int id, int palette)
|
||||||
//
|
//
|
||||||
//---------------------------------------------------------------------------
|
//---------------------------------------------------------------------------
|
||||||
|
|
||||||
void UpdateCeiling(int nSector, SEQFRAME* pFrame)
|
void UpdateCeiling(sectortype* pSector, SEQFRAME* pFrame)
|
||||||
{
|
{
|
||||||
assert(validSectorIndex(nSector));
|
|
||||||
sectortype* pSector = §or[nSector];
|
|
||||||
pSector->ceilingpicnum = seqGetTile(pFrame);
|
pSector->ceilingpicnum = seqGetTile(pFrame);
|
||||||
pSector->ceilingshade = pFrame->shade;
|
pSector->ceilingshade = pFrame->shade;
|
||||||
if (pFrame->palette)
|
if (pFrame->palette)
|
||||||
|
@ -142,10 +140,8 @@ void UpdateCeiling(int nSector, SEQFRAME* pFrame)
|
||||||
//
|
//
|
||||||
//---------------------------------------------------------------------------
|
//---------------------------------------------------------------------------
|
||||||
|
|
||||||
void UpdateFloor(int nSector, SEQFRAME* pFrame)
|
void UpdateFloor(sectortype* pSector, SEQFRAME* pFrame)
|
||||||
{
|
{
|
||||||
assert(validSectorIndex(nSector));
|
|
||||||
sectortype* pSector = §or[nSector];
|
|
||||||
pSector->floorpicnum = seqGetTile(pFrame);
|
pSector->floorpicnum = seqGetTile(pFrame);
|
||||||
pSector->floorshade = pFrame->shade;
|
pSector->floorshade = pFrame->shade;
|
||||||
if (pFrame->palette)
|
if (pFrame->palette)
|
||||||
|
@ -158,10 +154,8 @@ void UpdateFloor(int nSector, SEQFRAME* pFrame)
|
||||||
//
|
//
|
||||||
//---------------------------------------------------------------------------
|
//---------------------------------------------------------------------------
|
||||||
|
|
||||||
void UpdateWall(int nWall, SEQFRAME* pFrame)
|
void UpdateWall(walltype* pWall, SEQFRAME* pFrame)
|
||||||
{
|
{
|
||||||
assert(validWallIndex(nWall));
|
|
||||||
walltype* pWall = &wall[nWall];
|
|
||||||
assert(pWall->hasX());
|
assert(pWall->hasX());
|
||||||
pWall->picnum = seqGetTile(pFrame);
|
pWall->picnum = seqGetTile(pFrame);
|
||||||
if (pFrame->palette)
|
if (pFrame->palette)
|
||||||
|
@ -190,10 +184,8 @@ void UpdateWall(int nWall, SEQFRAME* pFrame)
|
||||||
//
|
//
|
||||||
//---------------------------------------------------------------------------
|
//---------------------------------------------------------------------------
|
||||||
|
|
||||||
void UpdateMasked(int nWall, SEQFRAME* pFrame)
|
void UpdateMasked(walltype* pWall, SEQFRAME* pFrame)
|
||||||
{
|
{
|
||||||
assert(validWallIndex(nWall));
|
|
||||||
walltype* pWall = &wall[nWall];
|
|
||||||
assert(pWall->hasX());
|
assert(pWall->hasX());
|
||||||
walltype* pWallNext = pWall->nextWall();
|
walltype* pWallNext = pWall->nextWall();
|
||||||
pWall->overpicnum = pWallNext->overpicnum = seqGetTile(pFrame);
|
pWall->overpicnum = pWallNext->overpicnum = seqGetTile(pFrame);
|
||||||
|
@ -326,17 +318,22 @@ void SEQINST::Update()
|
||||||
assert(frameIndex < pSequence->nFrames);
|
assert(frameIndex < pSequence->nFrames);
|
||||||
switch (type)
|
switch (type)
|
||||||
{
|
{
|
||||||
case 0:
|
case SS_WALL:
|
||||||
UpdateWall(seqindex, &pSequence->frames[frameIndex]);
|
assert(target.isWall());
|
||||||
|
UpdateWall(target.wall(), &pSequence->frames[frameIndex]);
|
||||||
break;
|
break;
|
||||||
case 1:
|
case SS_CEILING:
|
||||||
UpdateCeiling(seqindex, &pSequence->frames[frameIndex]);
|
assert(target.isSector());
|
||||||
|
UpdateCeiling(target.sector(), &pSequence->frames[frameIndex]);
|
||||||
break;
|
break;
|
||||||
case 2:
|
case SS_FLOOR:
|
||||||
UpdateFloor(seqindex, &pSequence->frames[frameIndex]);
|
assert(target.isSector());
|
||||||
|
UpdateFloor(target.sector(), &pSequence->frames[frameIndex]);
|
||||||
break;
|
break;
|
||||||
case 3:
|
case SS_SPRITE:
|
||||||
{
|
{
|
||||||
|
assert(target.isActor());
|
||||||
|
auto actor = target.actor();
|
||||||
if (!actor) break;
|
if (!actor) break;
|
||||||
UpdateSprite(actor, &pSequence->frames[frameIndex]);
|
UpdateSprite(actor, &pSequence->frames[frameIndex]);
|
||||||
if (pSequence->frames[frameIndex].playsound) {
|
if (pSequence->frames[frameIndex].playsound) {
|
||||||
|
@ -388,16 +385,17 @@ void SEQINST::Update()
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case 4:
|
case SS_MASKED:
|
||||||
UpdateMasked(seqindex, &pSequence->frames[frameIndex]);
|
assert(target.isWall());
|
||||||
|
UpdateMasked(target.wall(), &pSequence->frames[frameIndex]);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
// all seq callbacks are for sprites, but there's no sanity checks here that what gets passed is meant to be for a sprite...
|
// all seq callbacks are for sprites, but there's no sanity checks here that what gets passed is meant to be for a sprite...
|
||||||
if (pSequence->frames[frameIndex].trigger && callback != -1)
|
if (pSequence->frames[frameIndex].trigger && callback != -1)
|
||||||
{
|
{
|
||||||
assert(type == 3);
|
assert(type == SS_SPRITE);
|
||||||
if (type == 3) seqClientCallback[callback](type, actor);
|
if (target.isActor()) seqClientCallback[callback](type, target.actor());
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -415,8 +413,8 @@ struct ActiveList
|
||||||
void clear() { list.Clear(); }
|
void clear() { list.Clear(); }
|
||||||
int getSize() { return list.Size(); }
|
int getSize() { return list.Size(); }
|
||||||
SEQINST* getInst(int num) { return &list[num]; }
|
SEQINST* getInst(int num) { return &list[num]; }
|
||||||
int getIndex(int num) { return list[num].seqindex; }
|
EventObject getElement(int num) { return list[num].target; }
|
||||||
DBloodActor* getActor(int num) { return list[num].actor; }
|
//DBloodActor* getActor(int num) { return list[num].actor; }
|
||||||
int getType(int num) { return list[num].type; }
|
int getType(int num) { return list[num].type; }
|
||||||
|
|
||||||
void remove(int num)
|
void remove(int num)
|
||||||
|
@ -431,30 +429,26 @@ struct ActiveList
|
||||||
return &list.Last();
|
return &list.Last();
|
||||||
}
|
}
|
||||||
|
|
||||||
SEQINST* get(int type, int index)
|
SEQINST* get(int type, const EventObject& eob)
|
||||||
{
|
{
|
||||||
for (auto& n : list)
|
for (auto& n : list)
|
||||||
{
|
{
|
||||||
if (n.type == type && n.seqindex == index) return &n;
|
if (n.type == type && n.target == eob) return &n;
|
||||||
}
|
}
|
||||||
return nullptr;
|
return nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
SEQINST* get(DBloodActor* actor)
|
SEQINST* get(DBloodActor* actor)
|
||||||
{
|
{
|
||||||
for (auto& n : list)
|
return get(SS_SPRITE, EventObject(actor));
|
||||||
{
|
|
||||||
if (n.type == 3 && n.actor == actor) return &n;
|
|
||||||
}
|
|
||||||
return nullptr;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void remove(int type, int index)
|
void remove(int type, const EventObject& eob)
|
||||||
{
|
{
|
||||||
for (unsigned i = 0; i < list.Size(); i++)
|
for (unsigned i = 0; i < list.Size(); i++)
|
||||||
{
|
{
|
||||||
auto& n = list[i];
|
auto& n = list[i];
|
||||||
if (n.type == type && n.seqindex == index)
|
if (n.type == type && n.target == eob)
|
||||||
{
|
{
|
||||||
remove(i);
|
remove(i);
|
||||||
return;
|
return;
|
||||||
|
@ -464,15 +458,7 @@ struct ActiveList
|
||||||
|
|
||||||
void remove(DBloodActor* actor)
|
void remove(DBloodActor* actor)
|
||||||
{
|
{
|
||||||
for (unsigned i = 0; i < list.Size(); i++)
|
remove(SS_SPRITE, EventObject(actor));
|
||||||
{
|
|
||||||
auto& n = list[i];
|
|
||||||
if (n.type == 3 && n.actor == actor)
|
|
||||||
{
|
|
||||||
remove(i);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
};
|
};
|
||||||
|
@ -485,9 +471,9 @@ static ActiveList activeList;
|
||||||
//
|
//
|
||||||
//---------------------------------------------------------------------------
|
//---------------------------------------------------------------------------
|
||||||
|
|
||||||
SEQINST* GetInstance(int type, int nIndex)
|
SEQINST* GetInstance(int type, const EventObject& eob)
|
||||||
{
|
{
|
||||||
return activeList.get(type, nIndex);
|
return activeList.get(type, eob);
|
||||||
}
|
}
|
||||||
|
|
||||||
SEQINST* GetInstance(DBloodActor* actor)
|
SEQINST* GetInstance(DBloodActor* actor)
|
||||||
|
@ -495,23 +481,8 @@ SEQINST* GetInstance(DBloodActor* actor)
|
||||||
return activeList.get(actor);
|
return activeList.get(actor);
|
||||||
}
|
}
|
||||||
|
|
||||||
int seqGetStatus(DBloodActor* actor)
|
void seqKill(int type, const EventObject& nIndex)
|
||||||
{
|
{
|
||||||
SEQINST* pInst = activeList.get(actor);
|
|
||||||
if (pInst) return pInst->frameIndex;
|
|
||||||
return -1;
|
|
||||||
}
|
|
||||||
|
|
||||||
int seqGetID(DBloodActor* actor)
|
|
||||||
{
|
|
||||||
SEQINST* pInst = activeList.get(actor);
|
|
||||||
if (pInst) return pInst->nSeqID;
|
|
||||||
return -1;
|
|
||||||
}
|
|
||||||
|
|
||||||
void seqKill(int type, int nIndex)
|
|
||||||
{
|
|
||||||
assert(type != SS_SPRITE);
|
|
||||||
activeList.remove(type, nIndex);
|
activeList.remove(type, nIndex);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -520,6 +491,16 @@ void seqKillAll()
|
||||||
activeList.clear();
|
activeList.clear();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void seqKill(int type, sectortype* actor)
|
||||||
|
{
|
||||||
|
activeList.remove(type, EventObject(actor));
|
||||||
|
}
|
||||||
|
|
||||||
|
void seqKill(int type, walltype* actor)
|
||||||
|
{
|
||||||
|
activeList.remove(type, EventObject(actor));
|
||||||
|
}
|
||||||
|
|
||||||
void seqKill(DBloodActor* actor)
|
void seqKill(DBloodActor* actor)
|
||||||
{
|
{
|
||||||
activeList.remove(actor);
|
activeList.remove(actor);
|
||||||
|
@ -595,14 +576,13 @@ Seq* getSequence(int res_id)
|
||||||
//
|
//
|
||||||
//---------------------------------------------------------------------------
|
//---------------------------------------------------------------------------
|
||||||
|
|
||||||
void seqSpawn(int nSeqID, int type, int nIndex, int callback)
|
void seqSpawn_(int nSeqID, int type, const EventObject& eob, int callback)
|
||||||
{
|
{
|
||||||
assert(type != SS_SPRITE);
|
|
||||||
Seq* pSequence = getSequence(nSeqID);
|
Seq* pSequence = getSequence(nSeqID);
|
||||||
|
|
||||||
if (pSequence == nullptr) return;
|
if (pSequence == nullptr) return;
|
||||||
|
|
||||||
SEQINST* pInst = activeList.get(type, nIndex);
|
SEQINST* pInst = activeList.get(type, eob);
|
||||||
if (!pInst)
|
if (!pInst)
|
||||||
{
|
{
|
||||||
pInst = activeList.getNew();
|
pInst = activeList.getNew();
|
||||||
|
@ -620,38 +600,25 @@ void seqSpawn(int nSeqID, int type, int nIndex, int callback)
|
||||||
pInst->timeCounter = (short)pSequence->ticksPerFrame;
|
pInst->timeCounter = (short)pSequence->ticksPerFrame;
|
||||||
pInst->frameIndex = 0;
|
pInst->frameIndex = 0;
|
||||||
pInst->type = type;
|
pInst->type = type;
|
||||||
pInst->seqindex = nIndex;
|
pInst->target = eob;
|
||||||
pInst->actor = nullptr;
|
|
||||||
pInst->Update();
|
pInst->Update();
|
||||||
}
|
}
|
||||||
|
|
||||||
void seqSpawn(int nSeqID, DBloodActor* actor, int callback)
|
void seqSpawn(int nSeqID, DBloodActor* actor, int callback)
|
||||||
{
|
{
|
||||||
Seq* pSequence = getSequence(nSeqID);
|
seqSpawn_(nSeqID, SS_SPRITE, EventObject(actor), callback);
|
||||||
|
}
|
||||||
|
|
||||||
if (pSequence == nullptr) return;
|
void seqSpawn(int nSeqID, int type, sectortype* sect, int callback)
|
||||||
|
{
|
||||||
|
assert(type == SS_FLOOR || type == SS_CEILING);
|
||||||
|
seqSpawn_(nSeqID, type, EventObject(sect), callback);
|
||||||
|
}
|
||||||
|
|
||||||
SEQINST* pInst = activeList.get(actor);
|
void seqSpawn(int nSeqID, int type, walltype* wal, int callback)
|
||||||
if (!pInst)
|
{
|
||||||
{
|
assert(type == SS_WALL || type == SS_MASKED);
|
||||||
pInst = activeList.getNew();
|
seqSpawn_(nSeqID, type, EventObject(wal), callback);
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
// already playing this sequence?
|
|
||||||
if (pInst->nSeqID == nSeqID)
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
pInst->pSequence = pSequence;
|
|
||||||
pInst->nSeqID = nSeqID;
|
|
||||||
pInst->callback = callback;
|
|
||||||
pInst->timeCounter = (short)pSequence->ticksPerFrame;
|
|
||||||
pInst->frameIndex = 0;
|
|
||||||
pInst->type = SS_SPRITE;
|
|
||||||
pInst->seqindex = 0;
|
|
||||||
pInst->actor = actor;
|
|
||||||
pInst->Update();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
//---------------------------------------------------------------------------
|
//---------------------------------------------------------------------------
|
||||||
|
@ -660,20 +627,49 @@ void seqSpawn(int nSeqID, DBloodActor* actor, int callback)
|
||||||
//
|
//
|
||||||
//---------------------------------------------------------------------------
|
//---------------------------------------------------------------------------
|
||||||
|
|
||||||
int seqGetStatus(int type, int nIndex)
|
int seqGetStatus(int type, sectortype* nIndex)
|
||||||
{
|
{
|
||||||
SEQINST* pInst = activeList.get(type, nIndex);
|
SEQINST* pInst = activeList.get(type, EventObject(nIndex));
|
||||||
if (pInst) return pInst->frameIndex;
|
if (pInst) return pInst->frameIndex;
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
int seqGetID(int type, int nIndex)
|
int seqGetID(int type, sectortype* nIndex)
|
||||||
{
|
{
|
||||||
SEQINST* pInst = activeList.get(type, nIndex);
|
SEQINST* pInst = activeList.get(type, EventObject(nIndex));
|
||||||
if (pInst) return pInst->nSeqID;
|
if (pInst) return pInst->nSeqID;
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
int seqGetStatus(int type, walltype* nIndex)
|
||||||
|
{
|
||||||
|
SEQINST* pInst = activeList.get(type, EventObject(nIndex));
|
||||||
|
if (pInst) return pInst->frameIndex;
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
|
||||||
|
int seqGetID(int type, walltype* nIndex)
|
||||||
|
{
|
||||||
|
SEQINST* pInst = activeList.get(type, EventObject(nIndex));
|
||||||
|
if (pInst) return pInst->nSeqID;
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
|
||||||
|
int seqGetStatus(DBloodActor* actor)
|
||||||
|
{
|
||||||
|
SEQINST* pInst = activeList.get(actor);
|
||||||
|
if (pInst) return pInst->frameIndex;
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
|
||||||
|
int seqGetID(DBloodActor* actor)
|
||||||
|
{
|
||||||
|
SEQINST* pInst = activeList.get(actor);
|
||||||
|
if (pInst) return pInst->nSeqID;
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
//---------------------------------------------------------------------------
|
//---------------------------------------------------------------------------
|
||||||
//
|
//
|
||||||
//
|
//
|
||||||
|
@ -686,8 +682,7 @@ void seqProcess(int nTicks)
|
||||||
{
|
{
|
||||||
SEQINST* pInst = activeList.getInst(i);
|
SEQINST* pInst = activeList.getInst(i);
|
||||||
Seq* pSeq = pInst->pSequence;
|
Seq* pSeq = pInst->pSequence;
|
||||||
int index = pInst->seqindex;
|
auto target = pInst->target;
|
||||||
auto actor = pInst->actor;
|
|
||||||
|
|
||||||
assert(pInst->frameIndex < pSeq->nFrames);
|
assert(pInst->frameIndex < pSeq->nFrames);
|
||||||
|
|
||||||
|
@ -705,6 +700,8 @@ void seqProcess(int nTicks)
|
||||||
{
|
{
|
||||||
if (pInst->type == SS_SPRITE)
|
if (pInst->type == SS_SPRITE)
|
||||||
{
|
{
|
||||||
|
assert(target.isActor());
|
||||||
|
auto actor = target.actor();
|
||||||
if (actor)
|
if (actor)
|
||||||
{
|
{
|
||||||
evKillActor(actor);
|
evKillActor(actor);
|
||||||
|
@ -716,8 +713,8 @@ void seqProcess(int nTicks)
|
||||||
|
|
||||||
else if (pInst->type == SS_MASKED)
|
else if (pInst->type == SS_MASKED)
|
||||||
{
|
{
|
||||||
assert(validWallIndex(index));
|
assert(target.isWall());
|
||||||
auto pWall = &wall[index];
|
auto pWall = target.wall();
|
||||||
pWall->cstat &= ~(8 + 16 + 32);
|
pWall->cstat &= ~(8 + 16 + 32);
|
||||||
if (pWall->twoSided())
|
if (pWall->twoSided())
|
||||||
pWall->nextWall()->cstat &= ~(8 + 16 + 32);
|
pWall->nextWall()->cstat &= ~(8 + 16 + 32);
|
||||||
|
@ -746,13 +743,12 @@ FSerializer& Serialize(FSerializer& arc, const char* keyname, SEQINST& w, SEQINS
|
||||||
{
|
{
|
||||||
if (arc.BeginObject(keyname))
|
if (arc.BeginObject(keyname))
|
||||||
{
|
{
|
||||||
arc ("type", w.type)
|
arc("type", w.type)
|
||||||
("callback", w.callback)
|
("callback", w.callback)
|
||||||
("seqid", w.nSeqID)
|
("seqid", w.nSeqID)
|
||||||
("timecounter", w.timeCounter)
|
("timecounter", w.timeCounter)
|
||||||
("frameindex", w.frameIndex)
|
("frameindex", w.frameIndex)
|
||||||
("index", w.seqindex)
|
("target", w.target);
|
||||||
("actor", w.actor);
|
|
||||||
|
|
||||||
arc.EndObject();
|
arc.EndObject();
|
||||||
}
|
}
|
||||||
|
|
|
@ -76,8 +76,8 @@ class DBloodActor;
|
||||||
struct SEQINST
|
struct SEQINST
|
||||||
{
|
{
|
||||||
Seq* pSequence;
|
Seq* pSequence;
|
||||||
DBloodActor* actor;
|
EventObject target;
|
||||||
int seqindex, type;
|
int type;
|
||||||
|
|
||||||
int nSeqID;
|
int nSeqID;
|
||||||
int callback;
|
int callback;
|
||||||
|
@ -93,18 +93,22 @@ inline int seqGetTile(SEQFRAME* pFrame)
|
||||||
|
|
||||||
int seqRegisterClient(void(*pClient)(int, int));
|
int seqRegisterClient(void(*pClient)(int, int));
|
||||||
void seqPrecacheId(int id, int palette);
|
void seqPrecacheId(int id, int palette);
|
||||||
SEQINST* GetInstance(int a1, int a2);
|
SEQINST* GetInstance(int a1, EventObject& a2);
|
||||||
SEQINST* GetInstance(DBloodActor* actor);
|
SEQINST* GetInstance(DBloodActor* actor);
|
||||||
void UnlockInstance(SEQINST* pInst);
|
void UnlockInstance(SEQINST* pInst);
|
||||||
void seqSpawn(int a1, int a2, int a3, int a4 = -1);
|
void seqSpawn(int a1, int ty, walltype* a2, int a4 = -1);
|
||||||
|
void seqSpawn(int a1, int ty, sectortype* a2, int a4 = -1);
|
||||||
void seqSpawn(int a1, DBloodActor* actor, int a4 = -1);
|
void seqSpawn(int a1, DBloodActor* actor, int a4 = -1);
|
||||||
|
|
||||||
void seqKill(int a1, int a2);
|
void seqKill(int a1, walltype* a2);
|
||||||
|
void seqKill(int a1, sectortype* a2);
|
||||||
void seqKill(DBloodActor* actor);
|
void seqKill(DBloodActor* actor);
|
||||||
void seqKillAll(void);
|
void seqKillAll(void);
|
||||||
int seqGetStatus(int a1, int a2);
|
int seqGetStatus(int a1, walltype* a2);
|
||||||
|
int seqGetStatus(int a1, sectortype* a2);
|
||||||
int seqGetStatus(DBloodActor*);
|
int seqGetStatus(DBloodActor*);
|
||||||
int seqGetID(int a1, int a2);
|
int seqGetID(int a1, walltype* a2);
|
||||||
|
int seqGetID(int a1, sectortype* a2);
|
||||||
int seqGetID(DBloodActor*);
|
int seqGetID(DBloodActor*);
|
||||||
void seqProcess(int a1);
|
void seqProcess(int a1);
|
||||||
|
|
||||||
|
|
|
@ -1834,7 +1834,7 @@ void trMessageSprite(DBloodActor* actor, EVENT event)
|
||||||
break;
|
break;
|
||||||
#ifdef NOONE_EXTENSIONS
|
#ifdef NOONE_EXTENSIONS
|
||||||
case kCmdModernUse:
|
case kCmdModernUse:
|
||||||
modernTypeTrigger(SS_SPRITE, 0, actor, event);
|
modernTypeTrigger(OBJ_SPRITE, 0, actor, event);
|
||||||
break;
|
break;
|
||||||
#endif
|
#endif
|
||||||
default:
|
default:
|
||||||
|
|
Loading…
Reference in a new issue