mirror of
https://github.com/DrBeef/Raze.git
synced 2024-11-15 00:41:55 +00:00
- converted all FuncObjects to classes.
This commit is contained in:
parent
3bda4d5b07
commit
f13e1f2127
2 changed files with 913 additions and 878 deletions
|
@ -513,6 +513,47 @@ struct AIMummy : public ExhumedAI
|
|||
void RadialDamage(RunListEvent* ev) override;
|
||||
};
|
||||
|
||||
struct AIElev : public ExhumedAI
|
||||
{
|
||||
void ProcessChannel(RunListEvent* ev) override;
|
||||
void Tick(RunListEvent* ev) override;
|
||||
};
|
||||
|
||||
struct AIWallFace : public ExhumedAI
|
||||
{
|
||||
void ProcessChannel(RunListEvent* ev) override;
|
||||
};
|
||||
|
||||
struct AISlide : public ExhumedAI
|
||||
{
|
||||
void ProcessChannel(RunListEvent* ev) override;
|
||||
void Tick(RunListEvent* ev) override;
|
||||
};
|
||||
|
||||
struct AITrap : public ExhumedAI
|
||||
{
|
||||
void ProcessChannel(RunListEvent* ev) override;
|
||||
void Tick(RunListEvent* ev) override;
|
||||
};
|
||||
|
||||
struct AISpark : public ExhumedAI
|
||||
{
|
||||
void Tick(RunListEvent* ev) override;
|
||||
};
|
||||
|
||||
struct AIEnergyBlock : public ExhumedAI
|
||||
{
|
||||
virtual void Damage(RunListEvent* ev) override;
|
||||
virtual void RadialDamage(RunListEvent* ev) override;
|
||||
};
|
||||
|
||||
struct AIObject : public ExhumedAI
|
||||
{
|
||||
void Tick(RunListEvent* ev) override;
|
||||
void Damage(RunListEvent* ev) override;
|
||||
void Draw(RunListEvent* ev) override;
|
||||
void RadialDamage(RunListEvent* ev) override;
|
||||
};
|
||||
|
||||
void runlist_DispatchEvent(ExhumedAI* ai, int nObject, int nMessage, int nDamage, int nRun);
|
||||
|
||||
|
|
|
@ -607,7 +607,7 @@ int BuildElevC(int arg1, int nChannel, int nSector, int nWallSprite, int arg5, i
|
|||
// TODO - tidy me up
|
||||
// RENAME param A - not always Z
|
||||
// Confirmed 100% correct with original .exe
|
||||
int LongSeek(int *pZVal, int a2, int a3, int a4)
|
||||
int LongSeek(int* pZVal, int a2, int a3, int a4)
|
||||
{
|
||||
int v4; // edx@1
|
||||
int v5; // ebx@2
|
||||
|
@ -717,8 +717,9 @@ void StartElevSound(short nSprite, int nVal)
|
|||
D3PlayFX(StaticSound[nSound], nSprite);
|
||||
}
|
||||
|
||||
void FuncElev(int nObject, int nMessage, int, int nRun)
|
||||
void AIElev::ProcessChannel(RunListEvent* ev)
|
||||
{
|
||||
int nRun = ev->nRun;
|
||||
short nElev = RunData[nRun].nVal;
|
||||
assert(nElev >= 0 && nElev < (int)Elevator.Size());
|
||||
|
||||
|
@ -727,22 +728,7 @@ void FuncElev(int nObject, int nMessage, int, int nRun)
|
|||
|
||||
assert(nChannel >= 0 && nChannel < kMaxChannels);
|
||||
|
||||
if (nMessage < 0x10000) {
|
||||
return;
|
||||
}
|
||||
|
||||
// int var_24 = var_18 & 0x10; // floor based?
|
||||
|
||||
switch (nMessage)
|
||||
{
|
||||
default:
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
case 0x10000:
|
||||
{
|
||||
// short ax = var_18 & 8;
|
||||
// short ax = var_18 & 8;
|
||||
short dx = sRunChannels[nChannel].c;
|
||||
|
||||
int edi = 999; // FIXME CHECKME - this isn't default set to anything in the ASM that I can see - if ax is 0 and var_24 is 0, this will never be set to a known value otherwise!
|
||||
|
@ -811,12 +797,19 @@ void FuncElev(int nObject, int nMessage, int, int nRun)
|
|||
Elevator[nElev].field_32 = -1;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return;
|
||||
}
|
||||
void AIElev::Tick(RunListEvent* ev)
|
||||
{
|
||||
int nRun = ev->nRun;
|
||||
short nElev = RunData[nRun].nVal;
|
||||
assert(nElev >= 0 && nElev < (int)Elevator.Size());
|
||||
|
||||
short nChannel = Elevator[nElev].nChannel;
|
||||
short var_18 = Elevator[nElev].field_0;
|
||||
|
||||
assert(nChannel >= 0 && nChannel < kMaxChannels);
|
||||
|
||||
case 0x20000:
|
||||
{
|
||||
short nSector = Elevator[nElev].nSector;
|
||||
short di = Elevator[nElev].nSprite;
|
||||
|
||||
|
@ -866,7 +859,7 @@ void FuncElev(int nObject, int nMessage, int, int nRun)
|
|||
{
|
||||
// loc_20FC3:
|
||||
int ceilZ = sector[nSector].ceilingz;
|
||||
sectortype *cursect = §or[nSector];
|
||||
sectortype* cursect = §or[nSector];
|
||||
|
||||
int nZOffset = Elevator[nElev].nCurZOffset;
|
||||
int zVal = Elevator[nElev].zOffsets[nZOffset];
|
||||
|
@ -931,10 +924,13 @@ void FuncElev(int nObject, int nMessage, int, int nRun)
|
|||
sprite[di].z += ebp;
|
||||
di = sprite[di].owner;
|
||||
}
|
||||
}
|
||||
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
void FuncElev(int nObject, int nMessage, int nDamage, int nRun)
|
||||
{
|
||||
AIElev ai;
|
||||
runlist_DispatchEvent(&ai, nObject, nMessage, nDamage, nRun);
|
||||
}
|
||||
|
||||
// done
|
||||
|
@ -970,16 +966,13 @@ int BuildWallFace(short nChannel, short nWall, int nCount, ...)
|
|||
return WallFaceCount;
|
||||
}
|
||||
|
||||
void FuncWallFace(int, int nMessage, int, int nRun)
|
||||
void AIWallFace::ProcessChannel(RunListEvent* ev)
|
||||
{
|
||||
int nWallFace = RunData[nRun].nVal;
|
||||
int nWallFace = RunData[ev->nRun].nVal;
|
||||
assert(nWallFace >= 0 && nWallFace < (int)WallFace.Size());
|
||||
|
||||
short nChannel = WallFace[nWallFace].nChannel;
|
||||
|
||||
if (nMessage != 0x10000)
|
||||
return;
|
||||
|
||||
short si = sRunChannels[nChannel].c;
|
||||
|
||||
if ((si <= WallFace[nWallFace].field_4) && (si >= 0))
|
||||
|
@ -988,6 +981,12 @@ void FuncWallFace(int, int nMessage, int, int nRun)
|
|||
}
|
||||
}
|
||||
|
||||
void FuncWallFace(int nObject, int nMessage, int nDamage, int nRun)
|
||||
{
|
||||
AIWallFace ai;
|
||||
runlist_DispatchEvent(&ai, nObject, nMessage, nDamage, nRun);
|
||||
}
|
||||
|
||||
// done
|
||||
void InitPoint()
|
||||
{
|
||||
|
@ -1127,21 +1126,14 @@ int BuildSlide(int nChannel, int nStartWall, int nWall1, int ecx, int nWall2, in
|
|||
return nSlide;
|
||||
}
|
||||
|
||||
void FuncSlide(int, int nMessage , int, int nRun)
|
||||
void AISlide::ProcessChannel(RunListEvent* ev)
|
||||
{
|
||||
int nRun = ev->nRun;
|
||||
int nSlide = RunData[nRun].nVal;
|
||||
assert(nSlide >= 0 && nSlide < (int)SlideData.Size());
|
||||
|
||||
short nChannel = SlideData[nSlide].nChannel;
|
||||
|
||||
int ebp = 0;
|
||||
|
||||
short cx = sRunChannels[nChannel].c;
|
||||
|
||||
switch (nMessage)
|
||||
{
|
||||
case 0x10000:
|
||||
{
|
||||
if (SlideData[nSlide].field_4a >= 0)
|
||||
{
|
||||
runlist_SubRunRec(SlideData[nSlide].field_4a);
|
||||
|
@ -1159,12 +1151,19 @@ void FuncSlide(int, int nMessage , int, int nRun)
|
|||
D3PlayFX(StaticSound[kSound23], SlideData[nSlide].nSprite);
|
||||
SlideData[nSlide].field_8a = sRunChannels[nChannel].c;
|
||||
}
|
||||
}
|
||||
|
||||
return;
|
||||
}
|
||||
void AISlide::Tick(RunListEvent* ev)
|
||||
{
|
||||
int nRun = ev->nRun;
|
||||
int nSlide = RunData[nRun].nVal;
|
||||
assert(nSlide >= 0 && nSlide < (int)SlideData.Size());
|
||||
|
||||
short nChannel = SlideData[nSlide].nChannel;
|
||||
int ebp = 0;
|
||||
|
||||
short cx = sRunChannels[nChannel].c;
|
||||
|
||||
case 0x20000:
|
||||
{
|
||||
int clipmask = ebp + 1; // RENAME
|
||||
|
||||
if (cx == 1)
|
||||
|
@ -1289,10 +1288,12 @@ void FuncSlide(int, int nMessage , int, int nRun)
|
|||
|
||||
runlist_ReadyChannel(nChannel);
|
||||
}
|
||||
}
|
||||
|
||||
return;
|
||||
}
|
||||
}
|
||||
void FuncSlide(int nObject, int nMessage, int nDamage, int nRun)
|
||||
{
|
||||
AISlide ai;
|
||||
runlist_DispatchEvent(&ai, nObject, nMessage, nDamage, nRun);
|
||||
}
|
||||
|
||||
int BuildTrap(int nSprite, int edx, int ebx, int ecx)
|
||||
|
@ -1316,7 +1317,7 @@ int BuildTrap(int nSprite, int edx, int ebx, int ecx)
|
|||
pSprite->hitag = runlist_AddRunRec(NewRun, nTrap, 0x1F0000);
|
||||
pSprite->owner = runlist_AddRunRec(pSprite->lotag - 1, nTrap, 0x1F0000);
|
||||
|
||||
// GrabTimeSlot(3);
|
||||
// GrabTimeSlot(3);
|
||||
|
||||
sTrap[nTrap].nSprite = nSprite;
|
||||
sTrap[nTrap].nType = (var_14 == 0) + 14;
|
||||
|
@ -1370,17 +1371,10 @@ int BuildTrap(int nSprite, int edx, int ebx, int ecx)
|
|||
|
||||
}
|
||||
|
||||
void FuncTrap(int nObject, int nMessage, int, int nRun)
|
||||
void AITrap::ProcessChannel(RunListEvent* ev)
|
||||
{
|
||||
short nTrap = RunData[nRun].nVal;
|
||||
short nSprite = sTrap[nTrap].nSprite;
|
||||
auto pSprite = &sprite[nSprite];
|
||||
|
||||
switch (nMessage)
|
||||
{
|
||||
case 0x10000:
|
||||
{
|
||||
short nChannel = nObject & 0x3FFF;
|
||||
short nChannel = ev->nIndex & 0x3FFF;
|
||||
short nTrap = RunData[ev->nRun].nVal;
|
||||
|
||||
if (sRunChannels[nChannel].c > 0)
|
||||
{
|
||||
|
@ -1390,12 +1384,14 @@ void FuncTrap(int nObject, int nMessage, int, int nRun)
|
|||
{
|
||||
sTrap[nTrap].field_0 = -1;
|
||||
}
|
||||
}
|
||||
|
||||
return;
|
||||
}
|
||||
void AITrap::Tick(RunListEvent* ev)
|
||||
{
|
||||
short nTrap = RunData[ev->nRun].nVal;
|
||||
short nSprite = sTrap[nTrap].nSprite;
|
||||
auto pSprite = &sprite[nSprite];
|
||||
|
||||
case 0x20000:
|
||||
{
|
||||
if (sTrap[nTrap].field_0 >= 0)
|
||||
{
|
||||
sTrap[nTrap].field_0--;
|
||||
|
@ -1463,20 +1459,12 @@ void FuncTrap(int nObject, int nMessage, int, int nRun)
|
|||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
case 0x30000:
|
||||
case 0x90000:
|
||||
case 0x80000:
|
||||
case 0xA0000:
|
||||
return;
|
||||
|
||||
default:
|
||||
DebugOut("unknown msg %d for trap\n", nMessage);
|
||||
return;
|
||||
}
|
||||
void FuncTrap(int nObject, int nMessage, int nDamage, int nRun)
|
||||
{
|
||||
AITrap ai;
|
||||
runlist_DispatchEvent(&ai, nObject, nMessage, nDamage, nRun);
|
||||
}
|
||||
|
||||
int BuildArrow(int nSprite, int nVal)
|
||||
|
@ -1552,7 +1540,7 @@ int BuildSpark(int nSprite, int nVal)
|
|||
spr->hitag = 0;
|
||||
spr->backuppos();
|
||||
|
||||
// GrabTimeSlot(3);
|
||||
// GrabTimeSlot(3);
|
||||
|
||||
spr->extra = -1;
|
||||
spr->owner = runlist_AddRunRec(spr->lotag - 1, var_14, 0x260000);
|
||||
|
@ -1561,17 +1549,13 @@ int BuildSpark(int nSprite, int nVal)
|
|||
return var_14;
|
||||
}
|
||||
|
||||
void FuncSpark(int, int nMessage, int, int nRun)
|
||||
void AISpark::Tick(RunListEvent* ev)
|
||||
{
|
||||
int nSprite = RunData[nRun].nVal;
|
||||
int nSprite = RunData[ev->nRun].nVal;
|
||||
auto pSprite = &sprite[nSprite];
|
||||
|
||||
assert(nSprite >= 0 && nSprite < kMaxSprites);
|
||||
|
||||
if (nMessage != 0x20000) {
|
||||
return;
|
||||
}
|
||||
|
||||
pSprite->shade += 3;
|
||||
pSprite->xrepeat -= 2;
|
||||
|
||||
|
@ -1615,6 +1599,13 @@ void FuncSpark(int, int nMessage, int, int nRun)
|
|||
mydeletesprite(nSprite);
|
||||
}
|
||||
|
||||
|
||||
void FuncSpark(int nObject, int nMessage, int nDamage, int nRun)
|
||||
{
|
||||
AISpark ai;
|
||||
runlist_DispatchEvent(&ai, nObject, nMessage, nDamage, nRun);
|
||||
}
|
||||
|
||||
void DimLights()
|
||||
{
|
||||
static short word_96786 = 0;
|
||||
|
@ -1741,7 +1732,7 @@ int BuildEnergyBlock(short nSector)
|
|||
|
||||
sector[nSector].extra = nSprite;
|
||||
|
||||
// GrabTimeSlot(3);
|
||||
// GrabTimeSlot(3);
|
||||
|
||||
spr->z = sector[nextsector].floorz;
|
||||
|
||||
|
@ -1898,62 +1889,24 @@ void ExplodeEnergyBlock(int nSprite)
|
|||
changespritestat(nSprite, 0);
|
||||
}
|
||||
|
||||
void FuncEnergyBlock(int nObject, int nMessage, int nDamage, int nRun)
|
||||
void AIEnergyBlock::Damage(RunListEvent* ev)
|
||||
{
|
||||
int const nSprite = RunData[nRun].nVal;
|
||||
int const nSprite = RunData[ev->nRun].nVal;
|
||||
auto spr = &sprite[nSprite];
|
||||
|
||||
switch (nMessage)
|
||||
{
|
||||
case 0x20000:
|
||||
case 0x30000:
|
||||
case 0x90000:
|
||||
{
|
||||
ev->nDamage >>= 2;
|
||||
if (ev->nDamage <= 0) {
|
||||
return;
|
||||
}
|
||||
|
||||
case 0xA0000:
|
||||
if (ev->nDamage < spr->xrepeat)
|
||||
{
|
||||
short nSector = spr->sectnum;
|
||||
|
||||
if (sector[nSector].extra == -1) {
|
||||
return;
|
||||
}
|
||||
|
||||
int nFloorZ = sector[nSector].floorz;
|
||||
|
||||
sector[nSector].floorz = spr->z;
|
||||
spr->z -= 256;
|
||||
|
||||
nDamage = runlist_CheckRadialDamage(nSprite);
|
||||
|
||||
// restore previous values
|
||||
sector[nSector].floorz = nFloorZ;
|
||||
spr->z += 256;
|
||||
|
||||
if (nDamage <= 0) {
|
||||
return;
|
||||
}
|
||||
|
||||
// fall through to case 0x80000
|
||||
fallthrough__;
|
||||
}
|
||||
|
||||
case 0x80000:
|
||||
{
|
||||
nDamage >>= 2;
|
||||
if (nDamage <= 0) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (nDamage < spr->xrepeat)
|
||||
{
|
||||
spr->xrepeat -= nDamage;
|
||||
spr->xrepeat -= ev->nDamage;
|
||||
|
||||
int nSprite2 = insertsprite(lasthitsect, 0);
|
||||
auto pSprite2 = &sprite[nSprite2];
|
||||
|
||||
pSprite2->ang = nObject;
|
||||
pSprite2->ang = ev->nIndex;
|
||||
pSprite2->x = lasthitx;
|
||||
pSprite2->y = lasthity;
|
||||
pSprite2->z = lasthitz;
|
||||
|
@ -1966,10 +1919,44 @@ void FuncEnergyBlock(int nObject, int nMessage, int nDamage, int nRun)
|
|||
spr->xrepeat = 0; // using xrepeat to store health
|
||||
ExplodeEnergyBlock(nSprite);
|
||||
}
|
||||
}
|
||||
|
||||
void AIEnergyBlock::RadialDamage(RunListEvent* ev)
|
||||
{
|
||||
int const nSprite = RunData[ev->nRun].nVal;
|
||||
auto spr = &sprite[nSprite];
|
||||
|
||||
short nSector = spr->sectnum;
|
||||
|
||||
if (sector[nSector].extra == -1) {
|
||||
return;
|
||||
}
|
||||
|
||||
int nFloorZ = sector[nSector].floorz;
|
||||
|
||||
sector[nSector].floorz = spr->z;
|
||||
spr->z -= 256;
|
||||
|
||||
ev->nDamage = runlist_CheckRadialDamage(nSprite);
|
||||
|
||||
// restore previous values
|
||||
sector[nSector].floorz = nFloorZ;
|
||||
spr->z += 256;
|
||||
|
||||
if (ev->nDamage <= 0) {
|
||||
return;
|
||||
}
|
||||
|
||||
// fall through to case 0x80000
|
||||
Damage(ev);
|
||||
}
|
||||
|
||||
|
||||
|
||||
void FuncEnergyBlock(int nObject, int nMessage, int nDamage, int nRun)
|
||||
{
|
||||
AIEnergyBlock ai;
|
||||
runlist_DispatchEvent(&ai, nObject, nMessage, nDamage, nRun);
|
||||
}
|
||||
|
||||
int BuildObject(int const nSprite, int nOjectType, int nHitag)
|
||||
|
@ -1990,7 +1977,7 @@ int BuildObject(int const nSprite, int nOjectType, int nHitag)
|
|||
spr->hitag = 0;
|
||||
spr->owner = runlist_AddRunRec(spr->lotag - 1, nObject, 0x170000);
|
||||
|
||||
// GrabTimeSlot(3);
|
||||
// GrabTimeSlot(3);
|
||||
|
||||
if (spr->statnum == kStatDestructibleSprite) {
|
||||
ObjectList[nObject].nHealth = 4;
|
||||
|
@ -2053,9 +2040,9 @@ void ExplodeScreen(short nSprite)
|
|||
PlayFX2(StaticSound[kSound78], nSprite);
|
||||
}
|
||||
|
||||
void FuncObject(int nMessageParm, int nMessage, int b, int nRun)
|
||||
void AIObject::Tick(RunListEvent* ev)
|
||||
{
|
||||
short nObject = RunData[nRun].nVal;
|
||||
short nObject = RunData[ev->nRun].nVal;
|
||||
auto pObject = &ObjectList[nObject];
|
||||
|
||||
short nSprite = pObject->nSprite;
|
||||
|
@ -2063,19 +2050,124 @@ void FuncObject(int nMessageParm, int nMessage, int b, int nRun)
|
|||
short nStat = pSprite->statnum;
|
||||
short bx = pObject->field_8;
|
||||
|
||||
switch (nMessage)
|
||||
{
|
||||
default:
|
||||
{
|
||||
DebugOut("unknown msg %d for Object\n", nMessage);
|
||||
if (nStat == 97 || (!(pSprite->cstat & 0x101))) {
|
||||
return;
|
||||
}
|
||||
|
||||
case 0x30000:
|
||||
return;
|
||||
if (nStat != kStatExplodeTarget) {
|
||||
Gravity(nSprite);
|
||||
}
|
||||
|
||||
case 0x80000:
|
||||
// do animation
|
||||
if (bx != -1)
|
||||
{
|
||||
pObject->field_0++;
|
||||
if (pObject->field_0 >= SeqSize[bx]) {
|
||||
pObject->field_0 = 0;
|
||||
}
|
||||
|
||||
pSprite->picnum = seq_GetSeqPicnum2(bx, pObject->field_0);
|
||||
}
|
||||
|
||||
if (pObject->nHealth >= 0) {
|
||||
goto FUNCOBJECT_GOTO;
|
||||
}
|
||||
|
||||
pObject->nHealth++;
|
||||
|
||||
if (pObject->nHealth)
|
||||
{
|
||||
FUNCOBJECT_GOTO:
|
||||
if (nStat != kStatExplodeTarget)
|
||||
{
|
||||
int nMov = movesprite(nSprite, pSprite->xvel << 6, pSprite->yvel << 6, pSprite->zvel, 0, 0, CLIPMASK0);
|
||||
|
||||
if (pSprite->statnum == kStatExplodeTrigger) {
|
||||
pSprite->pal = 1;
|
||||
}
|
||||
|
||||
if (nMov & 0x20000)
|
||||
{
|
||||
pSprite->xvel -= pSprite->xvel >> 3;
|
||||
pSprite->yvel -= pSprite->yvel >> 3;
|
||||
}
|
||||
|
||||
if (((nMov & 0xC000) > 0x8000) && ((nMov & 0xC000) == 0xC000))
|
||||
{
|
||||
pSprite->yvel = 0;
|
||||
pSprite->xvel = 0;
|
||||
}
|
||||
}
|
||||
|
||||
return;
|
||||
}
|
||||
else
|
||||
{
|
||||
int var_18;
|
||||
|
||||
// red branch
|
||||
if ((nStat == kStatExplodeTarget) || (pSprite->z < sector[pSprite->sectnum].floorz))
|
||||
{
|
||||
var_18 = 36;
|
||||
}
|
||||
else
|
||||
{
|
||||
var_18 = 34;
|
||||
}
|
||||
|
||||
AddFlash(pSprite->sectnum, pSprite->x, pSprite->y, pSprite->z, 128);
|
||||
BuildAnim(-1, var_18, 0, pSprite->x, pSprite->y, sector[pSprite->sectnum].floorz, pSprite->sectnum, 240, 4);
|
||||
|
||||
// int edi = nSprite | 0x4000;
|
||||
|
||||
if (nStat == kStatExplodeTrigger)
|
||||
{
|
||||
for (int i = 4; i < 8; i++) {
|
||||
BuildCreatureChunk(nSprite | 0x4000, seq_GetSeqPicnum(kSeqFirePot, (i >> 2) + 1, 0));
|
||||
}
|
||||
|
||||
runlist_RadialDamageEnemy(nSprite, 200, 20);
|
||||
}
|
||||
else if (nStat == kStatExplodeTarget)
|
||||
{
|
||||
for (int i = 0; i < 8; i++) {
|
||||
BuildCreatureChunk(nSprite | 0x4000, seq_GetSeqPicnum(kSeqFirePot, (i >> 1) + 3, 0));
|
||||
}
|
||||
}
|
||||
|
||||
if (!(currentLevel->gameflags & LEVEL_EX_MULTI) || nStat != kStatExplodeTrigger)
|
||||
{
|
||||
runlist_SubRunRec(pSprite->owner);
|
||||
runlist_SubRunRec(pObject->field_4);
|
||||
|
||||
mydeletesprite(nSprite);
|
||||
return;
|
||||
}
|
||||
else
|
||||
{
|
||||
StartRegenerate(nSprite);
|
||||
pObject->nHealth = 120;
|
||||
|
||||
pSprite->x = sprite[pObject->field_10].x;
|
||||
pSprite->y = sprite[pObject->field_10].y;
|
||||
pSprite->z = sprite[pObject->field_10].z;
|
||||
|
||||
mychangespritesect(nSprite, sprite[pObject->field_10].sectnum);
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void AIObject::Damage(RunListEvent* ev)
|
||||
{
|
||||
short nObject = RunData[ev->nRun].nVal;
|
||||
auto pObject = &ObjectList[nObject];
|
||||
|
||||
short nSprite = pObject->nSprite;
|
||||
auto pSprite = &sprite[nSprite];
|
||||
short nStat = pSprite->statnum;
|
||||
short bx = pObject->field_8;
|
||||
|
||||
if (nStat >= 150 || pObject->nHealth <= 0) {
|
||||
return;
|
||||
}
|
||||
|
@ -2086,7 +2178,7 @@ void FuncObject(int nMessageParm, int nMessage, int b, int nRun)
|
|||
return;
|
||||
}
|
||||
|
||||
pObject->nHealth -= (short)b;
|
||||
pObject->nHealth -= (short)ev->nDamage;
|
||||
if (pObject->nHealth > 0) {
|
||||
return;
|
||||
}
|
||||
|
@ -2099,21 +2191,30 @@ void FuncObject(int nMessageParm, int nMessage, int b, int nRun)
|
|||
{
|
||||
pObject->nHealth = -(RandomSize(3) + 1);
|
||||
}
|
||||
}
|
||||
|
||||
return;
|
||||
}
|
||||
void AIObject::Draw(RunListEvent* ev)
|
||||
{
|
||||
short nObject = RunData[ev->nRun].nVal;
|
||||
auto pObject = &ObjectList[nObject];
|
||||
short bx = pObject->field_8;
|
||||
|
||||
case 0x90000:
|
||||
{
|
||||
if (bx > -1)
|
||||
{
|
||||
seq_PlotSequence(nMessageParm, bx, pObject->field_0, 1);
|
||||
seq_PlotSequence(ev->nIndex, bx, pObject->field_0, 1);
|
||||
}
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
void AIObject::RadialDamage(RunListEvent* ev)
|
||||
{
|
||||
short nObject = RunData[ev->nRun].nVal;
|
||||
auto pObject = &ObjectList[nObject];
|
||||
|
||||
short nSprite = pObject->nSprite;
|
||||
auto pSprite = &sprite[nSprite];
|
||||
short nStat = pSprite->statnum;
|
||||
|
||||
case 0xA0000:
|
||||
{
|
||||
if (pObject->nHealth > 0 && pSprite->cstat & 0x101
|
||||
&& (nStat != kStatExplodeTarget
|
||||
|| sprite[nRadialSpr].statnum == 201
|
||||
|
@ -2168,120 +2269,13 @@ void FuncObject(int nMessageParm, int nMessage, int b, int nRun)
|
|||
pObject->nHealth = -(RandomSize(4) + 1);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
case 0x20000:
|
||||
{
|
||||
if (nStat == 97 || (!(pSprite->cstat & 0x101))) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (nStat != kStatExplodeTarget) {
|
||||
Gravity(nSprite);
|
||||
}
|
||||
|
||||
// do animation
|
||||
if (bx != -1)
|
||||
{
|
||||
pObject->field_0++;
|
||||
if (pObject->field_0 >= SeqSize[bx]) {
|
||||
pObject->field_0 = 0;
|
||||
}
|
||||
|
||||
pSprite->picnum = seq_GetSeqPicnum2(bx, pObject->field_0);
|
||||
}
|
||||
|
||||
if (pObject->nHealth >= 0) {
|
||||
goto FUNCOBJECT_GOTO;
|
||||
}
|
||||
|
||||
pObject->nHealth++;
|
||||
|
||||
if (pObject->nHealth)
|
||||
{
|
||||
FUNCOBJECT_GOTO:
|
||||
if (nStat != kStatExplodeTarget)
|
||||
{
|
||||
int nMov = movesprite(nSprite, pSprite->xvel << 6, pSprite->yvel << 6, pSprite->zvel, 0, 0, CLIPMASK0);
|
||||
|
||||
if (pSprite->statnum == kStatExplodeTrigger) {
|
||||
pSprite->pal = 1;
|
||||
}
|
||||
|
||||
if (nMov & 0x20000)
|
||||
{
|
||||
pSprite->xvel -= pSprite->xvel >> 3;
|
||||
pSprite->yvel -= pSprite->yvel >> 3;
|
||||
}
|
||||
|
||||
if (((nMov & 0xC000) > 0x8000) && ((nMov & 0xC000) == 0xC000))
|
||||
{
|
||||
pSprite->yvel = 0;
|
||||
pSprite->xvel = 0;
|
||||
}
|
||||
}
|
||||
|
||||
return;
|
||||
}
|
||||
else
|
||||
{
|
||||
int var_18;
|
||||
|
||||
// red branch
|
||||
if ((nStat == kStatExplodeTarget) || (pSprite->z < sector[pSprite->sectnum].floorz))
|
||||
{
|
||||
var_18 = 36;
|
||||
}
|
||||
else
|
||||
{
|
||||
var_18 = 34;
|
||||
}
|
||||
|
||||
AddFlash(pSprite->sectnum, pSprite->x, pSprite->y, pSprite->z, 128);
|
||||
BuildAnim(-1, var_18, 0, pSprite->x, pSprite->y, sector[pSprite->sectnum].floorz, pSprite->sectnum, 240, 4);
|
||||
|
||||
// int edi = nSprite | 0x4000;
|
||||
|
||||
if (nStat == kStatExplodeTrigger)
|
||||
{
|
||||
for (int i = 4; i < 8; i++) {
|
||||
BuildCreatureChunk(nSprite | 0x4000, seq_GetSeqPicnum(kSeqFirePot, (i >> 2) + 1, 0));
|
||||
}
|
||||
|
||||
runlist_RadialDamageEnemy(nSprite, 200, 20);
|
||||
}
|
||||
else if (nStat == kStatExplodeTarget)
|
||||
{
|
||||
for (int i = 0; i < 8; i++) {
|
||||
BuildCreatureChunk(nSprite | 0x4000, seq_GetSeqPicnum(kSeqFirePot, (i >> 1) + 3, 0));
|
||||
}
|
||||
}
|
||||
|
||||
if (!(currentLevel->gameflags & LEVEL_EX_MULTI) || nStat != kStatExplodeTrigger)
|
||||
{
|
||||
runlist_SubRunRec(pSprite->owner);
|
||||
runlist_SubRunRec(pObject->field_4);
|
||||
|
||||
mydeletesprite(nSprite);
|
||||
return;
|
||||
}
|
||||
else
|
||||
{
|
||||
StartRegenerate(nSprite);
|
||||
pObject->nHealth = 120;
|
||||
|
||||
pSprite->x = sprite[pObject->field_10].x;
|
||||
pSprite->y = sprite[pObject->field_10].y;
|
||||
pSprite->z = sprite[pObject->field_10].z;
|
||||
|
||||
mychangespritesect(nSprite, sprite[pObject->field_10].sectnum);
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
void FuncObject(int nObject, int nMessage, int nDamage, int nRun)
|
||||
{
|
||||
AIObject ai;
|
||||
runlist_DispatchEvent(&ai, nObject, nMessage, nDamage, nRun);
|
||||
}
|
||||
|
||||
void BuildDrip(int nSprite)
|
||||
|
@ -2341,8 +2335,8 @@ void SnapBobs(short nSectorA, short nSectorB)
|
|||
{
|
||||
int ecx = -1;
|
||||
int ebx = ecx;
|
||||
// int var_14 = nSector;
|
||||
// int edi = edx;
|
||||
// int var_14 = nSector;
|
||||
// int edi = edx;
|
||||
|
||||
for (unsigned i = 0; i < sBob.Size(); i++)
|
||||
{
|
||||
|
@ -2397,7 +2391,7 @@ void AddSectorBob(int nSector, int nHitag, int bx)
|
|||
sBob[nBobs].sBobID = nHitag;
|
||||
|
||||
sBob[nBobs].nSector = nSector;
|
||||
StartInterpolation(nSector, bx == 0? Interp_Sect_Floorz : Interp_Sect_Ceilingz);
|
||||
StartInterpolation(nSector, bx == 0 ? Interp_Sect_Floorz : Interp_Sect_Ceilingz);
|
||||
|
||||
SectFlag[nSector] |= 0x0010;
|
||||
}
|
||||
|
@ -2487,7 +2481,7 @@ void AddMovingSector(int nSector, int edx, int ebx, int ecx)
|
|||
|
||||
|
||||
auto nMoveSects = sMoveSect.Reserve(1);
|
||||
MoveSect *pMoveSect = &sMoveSect[nMoveSects];
|
||||
MoveSect* pMoveSect = &sMoveSect[nMoveSects];
|
||||
|
||||
pMoveSect->sMoveDir = 1;
|
||||
pMoveSect->nTrail = nTrail;
|
||||
|
@ -2524,7 +2518,7 @@ void DoMovingSects()
|
|||
short nSector = sMoveSect[i].nSector;
|
||||
short nBlock = sector[nSector].extra;
|
||||
|
||||
BlockInfo *pBlockInfo = &sBlockInfo[nBlock];
|
||||
BlockInfo* pBlockInfo = &sBlockInfo[nBlock];
|
||||
|
||||
if (sMoveSect[i].nTrailPoint == -1)
|
||||
{
|
||||
|
@ -2556,7 +2550,7 @@ void DoMovingSects()
|
|||
}
|
||||
|
||||
short nTrail = sMoveSect[i].nTrailPoint;
|
||||
// TrailPoint *pTrail = &sTrailPoint[nTrail];
|
||||
// TrailPoint *pTrail = &sTrailPoint[nTrail];
|
||||
|
||||
// loc_23872:
|
||||
int nAngle = GetMyAngle(sTrailPoint[nTrail].x - pBlockInfo->x, sTrailPoint[nTrail].y - pBlockInfo->y);
|
||||
|
@ -2648,7 +2642,7 @@ void DoMovingSects()
|
|||
|
||||
void PostProcess()
|
||||
{
|
||||
int i,j;
|
||||
int i, j;
|
||||
|
||||
for (unsigned i = 0; i < sMoveSect.Size(); i++)
|
||||
{
|
||||
|
|
Loading…
Reference in a new issue