mirror of
https://github.com/ZDoom/Raze.git
synced 2024-11-15 08:51:24 +00:00
- Exhumed: pActor->s() in scorp.cpp
This commit is contained in:
parent
013cf05042
commit
b34a4af15e
1 changed files with 51 additions and 62 deletions
|
@ -40,43 +40,39 @@ static actionSeq ScorpSeq[] = {
|
||||||
|
|
||||||
void BuildScorp(DExhumedActor* pActor, int x, int y, int z, sectortype* pSector, int nAngle, int nChannel)
|
void BuildScorp(DExhumedActor* pActor, int x, int y, int z, sectortype* pSector, int nAngle, int nChannel)
|
||||||
{
|
{
|
||||||
spritetype* pSprite;
|
|
||||||
|
|
||||||
if (pActor == nullptr)
|
if (pActor == nullptr)
|
||||||
{
|
{
|
||||||
pActor = insertActor(pSector, 122);
|
pActor = insertActor(pSector, 122);
|
||||||
pSprite = &pActor->s();
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
ChangeActorStat(pActor, 122);
|
ChangeActorStat(pActor, 122);
|
||||||
|
|
||||||
pSprite = &pActor->s();
|
x = pActor->spr.pos.X;
|
||||||
x = pSprite->pos.X;
|
y = pActor->spr.pos.Y;
|
||||||
y = pSprite->pos.Y;
|
z = pActor->spr.sector()->floorz;
|
||||||
z = pSprite->sector()->floorz;
|
nAngle = pActor->spr.ang;
|
||||||
nAngle = pSprite->ang;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
pSprite->pos.X = x;
|
pActor->spr.pos.X = x;
|
||||||
pSprite->pos.Y = y;
|
pActor->spr.pos.Y = y;
|
||||||
pSprite->pos.Z = z;
|
pActor->spr.pos.Z = z;
|
||||||
pSprite->cstat = CSTAT_SPRITE_BLOCK_ALL;
|
pActor->spr.cstat = CSTAT_SPRITE_BLOCK_ALL;
|
||||||
pSprite->clipdist = 70;
|
pActor->spr.clipdist = 70;
|
||||||
pSprite->shade = -12;
|
pActor->spr.shade = -12;
|
||||||
pSprite->xrepeat = 80;
|
pActor->spr.xrepeat = 80;
|
||||||
pSprite->yrepeat = 80;
|
pActor->spr.yrepeat = 80;
|
||||||
pSprite->picnum = 1;
|
pActor->spr.picnum = 1;
|
||||||
pSprite->pal = pSprite->sector()->ceilingpal;
|
pActor->spr.pal = pActor->spr.sector()->ceilingpal;
|
||||||
pSprite->xoffset = 0;
|
pActor->spr.xoffset = 0;
|
||||||
pSprite->yoffset = 0;
|
pActor->spr.yoffset = 0;
|
||||||
pSprite->ang = nAngle;
|
pActor->spr.ang = nAngle;
|
||||||
pSprite->xvel = 0;
|
pActor->spr.xvel = 0;
|
||||||
pSprite->yvel = 0;
|
pActor->spr.yvel = 0;
|
||||||
pSprite->zvel = 0;
|
pActor->spr.zvel = 0;
|
||||||
pSprite->lotag = runlist_HeadRun() + 1;
|
pActor->spr.lotag = runlist_HeadRun() + 1;
|
||||||
pSprite->extra = -1;
|
pActor->spr.extra = -1;
|
||||||
pSprite->hitag = 0;
|
pActor->spr.hitag = 0;
|
||||||
|
|
||||||
// GrabTimeSlot(3);
|
// GrabTimeSlot(3);
|
||||||
|
|
||||||
|
@ -90,7 +86,7 @@ void BuildScorp(DExhumedActor* pActor, int x, int y, int z, sectortype* pSector,
|
||||||
|
|
||||||
pActor->nChannel = nChannel;
|
pActor->nChannel = nChannel;
|
||||||
|
|
||||||
pSprite->owner = runlist_AddRunRec(pSprite->lotag - 1, pActor, 0x220000);
|
pActor->spr.owner = runlist_AddRunRec(pActor->spr.lotag - 1, pActor, 0x220000);
|
||||||
pActor->nRun = runlist_AddRunRec(NewRun, pActor, 0x220000);
|
pActor->nRun = runlist_AddRunRec(NewRun, pActor, 0x220000);
|
||||||
|
|
||||||
nCreaturesTotal++;
|
nCreaturesTotal++;
|
||||||
|
@ -121,9 +117,6 @@ void AIScorp::Damage(RunListEvent* ev)
|
||||||
auto pActor = ev->pObjActor;
|
auto pActor = ev->pObjActor;
|
||||||
if (!pActor) return;
|
if (!pActor) return;
|
||||||
|
|
||||||
auto pSprite = &pActor->s();
|
|
||||||
|
|
||||||
|
|
||||||
DExhumedActor* pTarget = nullptr;
|
DExhumedActor* pTarget = nullptr;
|
||||||
|
|
||||||
if (pActor->nHealth <= 0) {
|
if (pActor->nHealth <= 0) {
|
||||||
|
@ -139,10 +132,10 @@ void AIScorp::Damage(RunListEvent* ev)
|
||||||
pActor->nFrame = 0;
|
pActor->nFrame = 0;
|
||||||
pActor->nCount = 10;
|
pActor->nCount = 10;
|
||||||
|
|
||||||
pSprite->xvel = 0;
|
pActor->spr.xvel = 0;
|
||||||
pSprite->yvel = 0;
|
pActor->spr.yvel = 0;
|
||||||
pSprite->zvel = 0;
|
pActor->spr.zvel = 0;
|
||||||
pSprite->cstat &= ~CSTAT_SPRITE_BLOCK_ALL;
|
pActor->spr.cstat &= ~CSTAT_SPRITE_BLOCK_ALL;
|
||||||
|
|
||||||
nCreaturesKilled++;
|
nCreaturesKilled++;
|
||||||
return;
|
return;
|
||||||
|
@ -153,7 +146,7 @@ void AIScorp::Damage(RunListEvent* ev)
|
||||||
|
|
||||||
if (pTarget)
|
if (pTarget)
|
||||||
{
|
{
|
||||||
if (pSprite->statnum == 100 || (pSprite->statnum < 199 && !RandomSize(5)))
|
if (pActor->spr.statnum == 100 || (pActor->spr.statnum < 199 && !RandomSize(5)))
|
||||||
{
|
{
|
||||||
pActor->pTarget = pTarget;
|
pActor->pTarget = pTarget;
|
||||||
}
|
}
|
||||||
|
@ -180,10 +173,7 @@ void AIScorp::Tick(RunListEvent* ev)
|
||||||
auto pActor = ev->pObjActor;
|
auto pActor = ev->pObjActor;
|
||||||
if (!pActor) return;
|
if (!pActor) return;
|
||||||
|
|
||||||
|
|
||||||
int nAction = pActor->nAction;
|
int nAction = pActor->nAction;
|
||||||
auto pSprite = &pActor->s();
|
|
||||||
|
|
||||||
bool bVal = false;
|
bool bVal = false;
|
||||||
|
|
||||||
DExhumedActor* pTarget = nullptr;
|
DExhumedActor* pTarget = nullptr;
|
||||||
|
@ -194,7 +184,7 @@ void AIScorp::Tick(RunListEvent* ev)
|
||||||
|
|
||||||
int nSeq = SeqOffsets[kSeqScorp] + ScorpSeq[nAction].a;
|
int nSeq = SeqOffsets[kSeqScorp] + ScorpSeq[nAction].a;
|
||||||
|
|
||||||
pSprite->picnum = seq_GetSeqPicnum2(nSeq, pActor->nFrame);
|
pActor->spr.picnum = seq_GetSeqPicnum2(nSeq, pActor->nFrame);
|
||||||
seq_MoveSequence(pActor, nSeq, pActor->nFrame);
|
seq_MoveSequence(pActor, nSeq, pActor->nFrame);
|
||||||
|
|
||||||
pActor->nFrame++;
|
pActor->nFrame++;
|
||||||
|
@ -232,8 +222,8 @@ void AIScorp::Tick(RunListEvent* ev)
|
||||||
D3PlayFX(StaticSound[kSound41], pActor);
|
D3PlayFX(StaticSound[kSound41], pActor);
|
||||||
|
|
||||||
pActor->nFrame = 0;
|
pActor->nFrame = 0;
|
||||||
pSprite->xvel = bcos(pSprite->ang);
|
pActor->spr.xvel = bcos(pActor->spr.ang);
|
||||||
pSprite->yvel = bsin(pSprite->ang);
|
pActor->spr.yvel = bsin(pActor->spr.ang);
|
||||||
|
|
||||||
pActor->nAction = 1;
|
pActor->nAction = 1;
|
||||||
pActor->pTarget = pTarget;
|
pActor->pTarget = pTarget;
|
||||||
|
@ -260,8 +250,8 @@ void AIScorp::Tick(RunListEvent* ev)
|
||||||
{
|
{
|
||||||
if (pTarget == nMov.actor())
|
if (pTarget == nMov.actor())
|
||||||
{
|
{
|
||||||
int nAngle = getangle(pTarget->spr.pos.X - pSprite->pos.X, pTarget->spr.pos.Y - pSprite->pos.Y);
|
int nAngle = getangle(pTarget->spr.pos.X - pActor->spr.pos.X, pTarget->spr.pos.Y - pActor->spr.pos.Y);
|
||||||
if (AngleDiff(pSprite->ang, nAngle) < 64)
|
if (AngleDiff(pActor->spr.ang, nAngle) < 64)
|
||||||
{
|
{
|
||||||
pActor->nAction = 2;
|
pActor->nAction = 2;
|
||||||
pActor->nFrame = 0;
|
pActor->nFrame = 0;
|
||||||
|
@ -317,8 +307,8 @@ void AIScorp::Tick(RunListEvent* ev)
|
||||||
{
|
{
|
||||||
pActor->nAction = 1;
|
pActor->nAction = 1;
|
||||||
|
|
||||||
pSprite->xvel = bcos(pSprite->ang);
|
pActor->spr.xvel = bcos(pActor->spr.ang);
|
||||||
pSprite->yvel = bsin(pSprite->ang);
|
pActor->spr.yvel = bsin(pActor->spr.ang);
|
||||||
|
|
||||||
pActor->nFrame = 0;
|
pActor->nFrame = 0;
|
||||||
return;
|
return;
|
||||||
|
@ -329,7 +319,7 @@ void AIScorp::Tick(RunListEvent* ev)
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
auto nBulletSprite = BuildBullet(pActor, 16, -1, pSprite->ang, pTarget, 1);
|
auto nBulletSprite = BuildBullet(pActor, 16, -1, pActor->spr.ang, pTarget, 1);
|
||||||
if (nBulletSprite)
|
if (nBulletSprite)
|
||||||
{
|
{
|
||||||
PlotCourseToSprite(nBulletSprite, pTarget);
|
PlotCourseToSprite(nBulletSprite, pTarget);
|
||||||
|
@ -379,7 +369,7 @@ void AIScorp::Tick(RunListEvent* ev)
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
auto pSpiderActor = BuildSpider(nullptr, pSprite->pos.X, pSprite->pos.Y, pSprite->pos.Z, pSprite->sector(), pSprite->ang);
|
auto pSpiderActor = BuildSpider(nullptr, pActor->spr.pos.X, pActor->spr.pos.Y, pActor->spr.pos.Z, pActor->spr.sector(), pActor->spr.ang);
|
||||||
if (pSpiderActor)
|
if (pSpiderActor)
|
||||||
{
|
{
|
||||||
auto pSpiderSprite = &pSpiderActor->s();
|
auto pSpiderSprite = &pSpiderActor->s();
|
||||||
|
@ -397,13 +387,13 @@ void AIScorp::Tick(RunListEvent* ev)
|
||||||
|
|
||||||
case 9:
|
case 9:
|
||||||
{
|
{
|
||||||
pSprite->cstat &= ~CSTAT_SPRITE_BLOCK_ALL;
|
pActor->spr.cstat &= ~CSTAT_SPRITE_BLOCK_ALL;
|
||||||
|
|
||||||
if (bVal)
|
if (bVal)
|
||||||
{
|
{
|
||||||
runlist_SubRunRec(pActor->nRun);
|
runlist_SubRunRec(pActor->nRun);
|
||||||
runlist_DoSubRunRec(pSprite->owner);
|
runlist_DoSubRunRec(pActor->spr.owner);
|
||||||
runlist_FreeRun(pSprite->lotag - 1);
|
runlist_FreeRun(pActor->spr.lotag - 1);
|
||||||
|
|
||||||
DeleteActor(pActor);
|
DeleteActor(pActor);
|
||||||
}
|
}
|
||||||
|
@ -419,16 +409,15 @@ void AIScorp::Effect(RunListEvent* ev, DExhumedActor* pTarget, int mode)
|
||||||
if (!pActor) return;
|
if (!pActor) return;
|
||||||
|
|
||||||
int nAction = pActor->nAction;
|
int nAction = pActor->nAction;
|
||||||
auto pSprite = &pActor->s();
|
|
||||||
|
|
||||||
if (mode == 0)
|
if (mode == 0)
|
||||||
{
|
{
|
||||||
PlotCourseToSprite(pActor, pTarget);
|
PlotCourseToSprite(pActor, pTarget);
|
||||||
pSprite->ang += RandomSize(7) - 63;
|
pActor->spr.ang += RandomSize(7) - 63;
|
||||||
pSprite->ang &= kAngleMask;
|
pActor->spr.ang &= kAngleMask;
|
||||||
|
|
||||||
pSprite->xvel = bcos(pSprite->ang);
|
pActor->spr.xvel = bcos(pActor->spr.ang);
|
||||||
pSprite->yvel = bsin(pSprite->ang);
|
pActor->spr.yvel = bsin(pActor->spr.ang);
|
||||||
}
|
}
|
||||||
if (mode <= 1)
|
if (mode <= 1)
|
||||||
{
|
{
|
||||||
|
@ -440,12 +429,12 @@ void AIScorp::Effect(RunListEvent* ev, DExhumedActor* pTarget, int mode)
|
||||||
{
|
{
|
||||||
pActor->nCount = 45;
|
pActor->nCount = 45;
|
||||||
|
|
||||||
if (cansee(pSprite->pos.X, pSprite->pos.Y, pSprite->pos.Z - GetActorHeight(pActor), pSprite->sector(),
|
if (cansee(pActor->spr.pos.X, pActor->spr.pos.Y, pActor->spr.pos.Z - GetActorHeight(pActor), pActor->spr.sector(),
|
||||||
pTarget->spr.pos.X, pTarget->spr.pos.Y, pTarget->spr.pos.Z - GetActorHeight(pTarget), pTarget->spr.sector()))
|
pTarget->spr.pos.X, pTarget->spr.pos.Y, pTarget->spr.pos.Z - GetActorHeight(pTarget), pTarget->spr.sector()))
|
||||||
{
|
{
|
||||||
pSprite->xvel = 0;
|
pActor->spr.xvel = 0;
|
||||||
pSprite->yvel = 0;
|
pActor->spr.yvel = 0;
|
||||||
pSprite->ang = GetMyAngle(pTarget->spr.pos.X - pSprite->pos.X, pTarget->spr.pos.Y - pSprite->pos.Y);
|
pActor->spr.ang = GetMyAngle(pTarget->spr.pos.X - pActor->spr.pos.X, pTarget->spr.pos.Y - pActor->spr.pos.Y);
|
||||||
|
|
||||||
pActor->nIndex = RandomSize(2) + RandomSize(3);
|
pActor->nIndex = RandomSize(2) + RandomSize(3);
|
||||||
|
|
||||||
|
@ -472,8 +461,8 @@ void AIScorp::Effect(RunListEvent* ev, DExhumedActor* pTarget, int mode)
|
||||||
pActor->nCount = 30;
|
pActor->nCount = 30;
|
||||||
pActor->pTarget = nullptr;
|
pActor->pTarget = nullptr;
|
||||||
|
|
||||||
pSprite->xvel = 0;
|
pActor->spr.xvel = 0;
|
||||||
pSprite->yvel = 0;
|
pActor->spr.yvel = 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue