allow Blood to compile with NOONE_EXTENSIONS disabled.

This commit is contained in:
Christoph Oelckers 2023-10-07 21:32:03 +02:00
parent c4ded2f133
commit 495e236764
14 changed files with 189 additions and 145 deletions

View file

@ -1,6 +1,13 @@
#ifdef NOONE_EXTENSIONS
#undef NOONE_EXTENSIONS
#endif
/*
#ifndef NOONE_EXTENSIONS
#define NOONE_EXTENSIONS
#endif
*/
#include "src/actor.cpp"
#include "src/ai.cpp"

View file

@ -3487,7 +3487,7 @@ void MoveDude(DBloodActor* actor)
trTriggerSprite(coll.actor(), kCmdSpriteTouch, actor);
#else
if (hitActor->hasX() && hitActor->xspr.Touch && !hitActor->xspr.state && !hitActor->xspr.isTriggered)
trTriggerSprite(coll.actor, kCmdSpriteTouch);
trTriggerSprite(coll.actor(), kCmdSpriteTouch);
#endif
if (pDudeInfo->lockOut && hitActor->hasX() && hitActor->xspr.Push && !hitActor->xspr.key && !hitActor->xspr.DudeLockout && !hitActor->xspr.state && !hitActor->xspr.busy && !pPlayer)
@ -4636,6 +4636,32 @@ static void actCheckTraps()
//
//---------------------------------------------------------------------------
bool IsBurningDude(DBloodActor* actor)
{
if (actor == NULL) return false;
switch (actor->GetType())
{
case kDudeBurningInnocent:
case kDudeBurningCultist:
case kDudeBurningZombieAxe:
case kDudeBurningZombieButcher:
case kDudeBurningTinyCaleb:
case kDudeBurningBeast:
#ifdef NOONE_EXTENSIONS
case kDudeModernCustomBurning:
#endif
return true;
}
return false;
}
//---------------------------------------------------------------------------
//
//
//
//---------------------------------------------------------------------------
static void actCheckDudes()
{
BloodStatIterator it(kStatDude);

View file

@ -1612,8 +1612,8 @@ void aiProcessDudes(void)
actor->xspr.aiState->thinkFunc(actor);
}
switch (actor->GetType()) {
#ifdef NOONE_EXTENSIONS
switch (actor->GetType()) {
case kDudeModernCustom:
case kDudeModernCustomBurning: {
GENDUDEEXTRA* pExtra = &actor->genDudeExtra;
@ -1630,8 +1630,8 @@ void aiProcessDudes(void)
RecoilDude(actor);
break;
}
#endif
default:
#endif
if (actor->xspr.stateTimer == 0 && actor->xspr.aiState && actor->xspr.aiState->nextState) {
if (actor->xspr.aiState->stateTicks > 0)
aiNewState(actor, actor->xspr.aiState->nextState);
@ -1644,8 +1644,10 @@ void aiProcessDudes(void)
actor->xspr.data3 = actor->cumulDamage;
RecoilDude(actor);
}
#ifdef NOONE_EXTENSIONS
break;
}
#endif
}
it.Reset(kStatDude);
@ -1936,4 +1938,5 @@ void aiInitSprite(DBloodActor* actor)
#endif
}
END_BLD_NS

View file

@ -120,6 +120,7 @@ static tspritetype* viewAddEffect(tspriteArray& tsprites, int nTSprite, VIEW_EFF
auto pTTex = TexMan.GetGameTexture(pTSprite->spritetexture());
switch (nViewEffect)
{
#ifdef NOONE_EXTENSIONS
case kViewEffectSpotProgress: {
int perc = (100 * owneractor->xspr.data3) / kMaxPatrolSpotValue;
int width = (94 * owneractor->xspr.data3) / kMaxPatrolSpotValue;
@ -142,6 +143,7 @@ static tspritetype* viewAddEffect(tspriteArray& tsprites, int nTSprite, VIEW_EFF
pNSprite2->shade = -128;
break;
}
#endif
case kViewEffectAtom:
for (int i = 0; i < 16; i++)
{
@ -874,10 +876,12 @@ void viewProcessSprites(tspriteArray& tsprites, const DVector3& cPos, DAngle cA,
}
}
#ifdef NOONE_EXTENSIONS
if (gModernMap && owneractor->hasX()) { // add target spot indicator for patrol dudes
if (owneractor->xspr.dudeFlag4 && aiInPatrolState(owneractor->xspr.aiState) && owneractor->xspr.data3 > 0 && owneractor->xspr.data3 <= kMaxPatrolSpotValue)
viewAddEffect(tsprites, nTSprite, kViewEffectSpotProgress);
}
#endif
break;
}
case kStatTraps: {

View file

@ -57,6 +57,7 @@ BEGIN_BLD_NS
IMPLEMENT_CLASS(DBloodActor, false, true)
IMPLEMENT_POINTERS_START(DBloodActor)
#ifdef NOONE_EXTENSIONS
IMPLEMENT_POINTER(prevmarker)
IMPLEMENT_POINTER(ownerActor)
IMPLEMENT_POINTER(genDudeExtra.pLifeLeech)
@ -67,6 +68,7 @@ IMPLEMENT_POINTER(genDudeExtra.slave[3])
IMPLEMENT_POINTER(genDudeExtra.slave[4])
IMPLEMENT_POINTER(genDudeExtra.slave[5])
IMPLEMENT_POINTER(genDudeExtra.slave[6])
#endif
IMPLEMENT_POINTER(xspr.burnSource)
IMPLEMENT_POINTER(xspr.target)
IMPLEMENT_POINTERS_END
@ -110,26 +112,30 @@ size_t DBloodActor::PropagateMark()
if (hit.hit.type == kHitSprite) GC::Mark(hit.hit.hitActor);
if (hit.ceilhit.type == kHitSprite) GC::Mark(hit.ceilhit.hitActor);
if (hit.florhit.type == kHitSprite) GC::Mark(hit.florhit.hitActor);
#ifdef NOONE_EXTENSIONS
condition[0].Mark();
condition[1].Mark();
#endif
return Super::PropagateMark();
}
static void markgcroots()
{
#ifdef NOONE_EXTENSIONS
GC::MarkArray(gProxySpritesList, gProxySpritesCount);
GC::MarkArray(gSightSpritesList, gSightSpritesCount);
GC::MarkArray(gPhysSpritesList, gPhysSpritesCount);
GC::MarkArray(gImpactSpritesList, gImpactSpritesCount);
MarkSprInSect();
for (auto& evobj : rxBucket)
{
evobj.Mark();
}
for (auto& cond : gConditions)
{
for (auto& obj : cond.objects) obj.obj.Mark();
}
MarkSprInSect();
#endif
for (auto& evobj : rxBucket)
{
evobj.Mark();
}
MarkSeq();
}

View file

@ -61,7 +61,6 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
BEGIN_BLD_NS
// ai callbacks
DEF_ANIMATOR(aiGenDudeMoveForward)
DEF_ANIMATOR(aiMoveDodge)
DEF_ANIMATOR(aiMoveForward)
DEF_ANIMATOR(aiMoveTurn)
@ -117,7 +116,6 @@ DEF_ANIMATOR(entryEStand)
DEF_ANIMATOR(entryEZombie)
DEF_ANIMATOR(entryFStatue)
DEF_ANIMATOR(entrySStatue)
DEF_ANIMATOR(forcePunch)
DEF_ANIMATOR(gargMoveDodgeDown)
DEF_ANIMATOR(gargMoveDodgeUp)
DEF_ANIMATOR(gargMoveFly)
@ -175,9 +173,6 @@ DEF_ANIMATOR(sub_72580)
DEF_ANIMATOR(sub_725A4)
DEF_ANIMATOR(sub_72850)
DEF_ANIMATOR(tchernobogThinkChase)
DEF_ANIMATOR(unicultThinkChase)
DEF_ANIMATOR(unicultThinkGoto)
DEF_ANIMATOR(unicultThinkSearch)
DEF_ANIMATOR(zombaThinkChase)
DEF_ANIMATOR(zombaThinkGoto)
DEF_ANIMATOR(zombaThinkPonder)
@ -241,11 +236,6 @@ DEF_ANIMATOR(FireballTrapSeqCallback)
DEF_ANIMATOR(MGunFireSeqCallback)
DEF_ANIMATOR(MGunOpenSeqCallback)
// nnext
DEF_ANIMATOR(genDudeAttack1)
DEF_ANIMATOR(punchCallback)
DEF_ANIMATOR(ThrowCallback1)
DEF_ANIMATOR(ThrowCallback2)
// event callbacks
DEF_ANIMATOR(fxFlameLick) // 0
@ -269,10 +259,22 @@ DEF_ANIMATOR(fxPodBloodSpray) // 18
DEF_ANIMATOR(fxPodBloodSplat) // 19
DEF_ANIMATOR(LeechStateTimer) // 20
DEF_ANIMATOR(DropVoodooCb) // unused
DEF_ANIMATOR(callbackMakeMissileBlocking) // 23
DEF_ANIMATOR(callbackMissileBurst)
DEF_ANIMATOR(callbackMakeMissileBlocking)
#ifdef NOONE_EXTENSIONS
DEF_ANIMATOR(forcePunch)
DEF_ANIMATOR(aiGenDudeMoveForward)
DEF_ANIMATOR(unicultThinkChase)
DEF_ANIMATOR(unicultThinkGoto)
DEF_ANIMATOR(unicultThinkSearch)
DEF_ANIMATOR(genDudeAttack1)
DEF_ANIMATOR(punchCallback)
DEF_ANIMATOR(ThrowCallback1)
DEF_ANIMATOR(ThrowCallback2)
DEF_ANIMATOR(callbackGenDudeUpdate)
DEF_ANIMATOR(callbackUniMissileBurst)
#endif
enum EFeatureFlags
{

View file

@ -29,11 +29,13 @@ public:
TObjPtr<DBloodActor*> ownerActor; // was previously stored in the sprite's owner field.
// nnext stuff. For now not exported to scripting.
#ifdef NOONE_EXTENSIONS
SPRITEMASS spriteMass;
GENDUDEEXTRA genDudeExtra;
TObjPtr<DBloodActor*> prevmarker; // needed by the nnext marker code. This originally hijacked targetX in XSPRITE
DVector3 basePoint;
EventObject condition[2];
TObjPtr<DBloodActor*> prevmarker; // needed by the nnext marker code. This originally hijacked targetX in XSPRITE
#endif
DVector3 basePoint;
int16_t dmgControl[kDamageMax]; // combination of the ones in DUDEINFO, THINGINFO and GENDUDEEXTRA, needs to be modifiable
// transient data (not written to savegame)

View file

@ -828,4 +828,64 @@ void DropVoodooCb(DBloodActor* actor) // unused
}
}
//---------------------------------------------------------------------------
//
//
//
//---------------------------------------------------------------------------
void callbackMissileBurst(DBloodActor* actor) // 22
{
if (!actor) return;
if (actor->spr.statnum != kStatProjectile) return;
auto nAngVec = actor->vel.XY().Angle().ToVector();
double nRadius = FixedToFloat(0x55555);
for (int i = 0; i < 8; i++)
{
auto burstactor = actSpawnSprite(actor, kStatProjectile, actor->GetClass(), actor->GetType());
if (!burstactor) break;
burstactor->spr.shade = actor->spr.shade;
burstactor->spr.setspritetexture(actor->spr.spritetexture());
burstactor->spr.cstat = actor->spr.cstat;
if ((burstactor->spr.cstat & CSTAT_SPRITE_BLOCK))
{
burstactor->spr.cstat &= ~CSTAT_SPRITE_BLOCK; // we don't want missiles impact each other
evPostActor(burstactor, 100, AF(callbackMakeMissileBlocking)); // so set blocking flag a bit later
}
burstactor->spr.pal = actor->spr.pal;
burstactor->clipdist = actor->clipdist * 0.25;
burstactor->spr.flags = actor->spr.flags;
burstactor->spr.scale = actor->spr.scale;
burstactor->spr.scale *= 0.5;
burstactor->spr.Angles.Yaw = actor->spr.Angles.Yaw + DAngle::fromDeg(actor->FloatVar("angleofs"));
burstactor->SetOwner(actor);
IFVIRTUALPTRNAME(burstactor, NAME_BloodMissileBase, initMissile) // note: delete the name if this get scriptified.
{
VMValue p[] = { burstactor, actor };
VMCall(func, p, 2, nullptr, 0);
}
auto spAngVec = DAngle::fromBam(i << 29).ToVector().Rotated90CW() * nRadius;
if (i & 1) spAngVec *= 0.5;
burstactor->vel += DVector3(DVector2(0, spAngVec.X).Rotated(nAngVec.X, nAngVec.Y), spAngVec.Y);
evPostActor(burstactor, 960, AF(RemoveActor));
}
evPostActor(actor, 0, AF(RemoveActor));
}
void callbackMakeMissileBlocking(DBloodActor* actor) // 23
{
if (!actor || actor->spr.statnum != kStatProjectile) return;
actor->spr.cstat |= CSTAT_SPRITE_BLOCK;
}
END_BLD_NS

View file

@ -143,7 +143,7 @@ void hudDraw(DBloodPlayer* pPlayer, sectortype* pSector, double bobx, double bob
pPlayer->qavTimer = pPlayer->weaponTimer = pPlayer->curWeapon = 0;
}
#else
WeaponDraw(pPlayer, nShade, cX, cY, nPalette);
WeaponDraw(pPlayer, nShade, cXY.X, cXY.Y, nPalette, angle);
#endif
}
if (gViewPos == 0 && pPlayer->GetActor()->xspr.burnTime > 60)

View file

@ -324,6 +324,35 @@ static AISTATE* const allAIStates[] =
&tcherno13A9F0,
&tcherno13AA0C,
&tcherno13AA28,
&zombieAIdle,
&zombieAChase,
&zombieAPonder,
&zombieAGoto,
&zombieAHack,
&zombieASearch,
&zombieARecoil,
&zombieATeslaRecoil,
&zombieARecoil2,
&zombieAStand,
&zombieEIdle,
&zombieEUp2,
&zombieEUp,
&zombie2Idle,
&zombie2Search,
&zombieSIdle,
&zombie13AC2C,
&zombieFIdle,
&zombieFChase,
&zombieFGoto,
&zombieFDodge,
&zombieFHack,
&zombieFPuke,
&zombieFThrow,
&zombieFSearch,
&zombieFRecoil,
&zombieFTeslaRecoil,
#ifdef NOONE_EXTENSIONS
&genDudeIdleL,
&genDudeIdleW,
&genDudeSearchL,
@ -359,33 +388,8 @@ static AISTATE* const allAIStates[] =
&genDudeThrow,
&genDudeThrow2,
&genDudePunch,
&zombieAIdle,
&zombieAChase,
&zombieAPonder,
&zombieAGoto,
&zombieAHack,
&zombieASearch,
&zombieARecoil,
&zombieATeslaRecoil,
&zombieARecoil2,
&zombieAStand,
&zombieEIdle,
&zombieEUp2,
&zombieEUp,
&zombie2Idle,
&zombie2Search,
&zombieSIdle,
&zombie13AC2C,
&zombieFIdle,
&zombieFChase,
&zombieFGoto,
&zombieFDodge,
&zombieFHack,
&zombieFPuke,
&zombieFThrow,
&zombieFSearch,
&zombieFRecoil,
&zombieFTeslaRecoil,
#endif
};
//---------------------------------------------------------------------------
@ -409,11 +413,13 @@ FSerializer& Serialize(FSerializer& arc, const char* keyname, AISTATE*& w, AISTA
}
i++;
}
#ifdef NOONE_EXTENSIONS
if (w >= genPatrolStates && w < genPatrolStates + kPatrolStateSize)
{
i = int(w - genPatrolStates) + 1000;
arc(keyname, i);
}
#endif
}
else
{
@ -422,10 +428,12 @@ FSerializer& Serialize(FSerializer& arc, const char* keyname, AISTATE*& w, AISTA
{
w = allAIStates[i];
}
#ifdef NOONE_EXTENSIONS
else if (i >= 1000 && i < 1000 + kPatrolStateSize)
{
w = genPatrolStates + (i - 1000);
}
#endif
else
{
w = nullptr;

View file

@ -6552,7 +6552,7 @@ void useUniMissileGen(DBloodActor* sourceactor, DBloodActor* actor)
// add bursting for missiles
if (missileactor->GetType() != kMissileFlareAlt && sourceactor->xspr.data4 > 0)
evPostActor(missileactor, ClipHigh(sourceactor->xspr.data4, 500), AF(callbackUniMissileBurst));
evPostActor(missileactor, ClipHigh(sourceactor->xspr.data4, 500), AF(callbackMissileBurst));
}
}
@ -7439,30 +7439,6 @@ DBloodPlayer* getPlayerById(int id)
return NULL;
}
//---------------------------------------------------------------------------
//
//
//
//---------------------------------------------------------------------------
bool IsBurningDude(DBloodActor* actor)
{
if (actor == NULL) return false;
switch (actor->GetType())
{
case kDudeBurningInnocent:
case kDudeBurningCultist:
case kDudeBurningZombieAxe:
case kDudeBurningZombieButcher:
case kDudeBurningTinyCaleb:
case kDudeBurningBeast:
case kDudeModernCustomBurning:
return true;
}
return false;
}
bool IsKillableDude(DBloodActor* actor)
{
switch (actor->GetType())
@ -9163,58 +9139,6 @@ void levelEndLevelCustom(int nLevel)
gNextLevel = FindMapByIndex(currentLevel->cluster, nLevel + 1);
}
//---------------------------------------------------------------------------
//
//
//
//---------------------------------------------------------------------------
void callbackUniMissileBurst(DBloodActor* actor) // 22
{
if (!actor) return;
if (actor->spr.statnum != kStatProjectile) return;
auto nAngVec = actor->vel.XY().Angle().ToVector();
double nRadius = FixedToFloat(0x55555);
for (int i = 0; i < 8; i++)
{
auto burstactor = actSpawnSprite(actor, kStatProjectile, actor->GetClass(), actor->GetType());
if (!burstactor) break;
burstactor->spr.shade = actor->spr.shade;
burstactor->spr.setspritetexture(actor->spr.spritetexture());
burstactor->spr.cstat = actor->spr.cstat;
if ((burstactor->spr.cstat & CSTAT_SPRITE_BLOCK))
{
burstactor->spr.cstat &= ~CSTAT_SPRITE_BLOCK; // we don't want missiles impact each other
evPostActor(burstactor, 100, AF(callbackMakeMissileBlocking)); // so set blocking flag a bit later
}
burstactor->spr.pal = actor->spr.pal;
burstactor->clipdist = actor->clipdist * 0.25;
burstactor->spr.flags = actor->spr.flags;
burstactor->spr.scale = actor->spr.scale;
burstactor->spr.scale *= 0.5;
burstactor->spr.Angles.Yaw = actor->spr.Angles.Yaw + DAngle::fromDeg(actor->FloatVar("angleofs"));
burstactor->SetOwner(actor);
IFVIRTUALPTRNAME(burstactor, NAME_BloodMissileBase, initMissile) // note: delete the name if this get scriptified.
{
VMValue p[] = { burstactor, actor };
VMCall(func, p, 2, nullptr, 0);
}
auto spAngVec = DAngle::fromBam(i << 29).ToVector().Rotated90CW() * nRadius;
if (i & 1) spAngVec *= 0.5;
burstactor->vel += DVector3(DVector2(0, spAngVec.X).Rotated(nAngVec.X, nAngVec.Y), spAngVec.Y);
evPostActor(burstactor, 960, AF(RemoveActor));
}
evPostActor(actor, 0, AF(RemoveActor));
}
//---------------------------------------------------------------------------
//
@ -9222,12 +9146,6 @@ void callbackUniMissileBurst(DBloodActor* actor) // 22
//
//---------------------------------------------------------------------------
void callbackMakeMissileBlocking(DBloodActor* actor) // 23
{
if (!actor || actor->spr.statnum != kStatProjectile) return;
actor->spr.cstat |= CSTAT_SPRITE_BLOCK;
}
void callbackGenDudeUpdate(DBloodActor* actor) // 24
{
if (actor)

View file

@ -351,7 +351,7 @@ void playerQavScenePlay(DBloodPlayer* pPlayer);
void playerQavSceneDraw(DBloodPlayer* pPlayer, int shade, double xpos, double ypos, int palnum, DAngle angle);
void playerQavSceneReset(DBloodPlayer* pPlayer);
// ------------------------------------------------------------------------- //
void callbackUniMissileBurst(DBloodActor* actor);
void callbackMissileBurst(DBloodActor* actor);
void callbackMakeMissileBlocking(DBloodActor* actor);
void callbackGenDudeUpdate(DBloodActor* actor);
// ------------------------------------------------------------------------- //
@ -423,7 +423,6 @@ bool isMovableSector(int nType);
bool isMovableSector(sectortype* pSect);
void killEffectGenCallbacks(DBloodActor* actor);
bool xsprIsFine(DBloodActor* pSpr);
#endif
inline bool valueIsBetween(int val, int min, int max)
{
@ -437,3 +436,4 @@ inline bool valueIsBetween(int val, int min, int max)
////////////////////////////////////////////////////////////////////////////////////
END_BLD_NS
#endif

View file

@ -2208,7 +2208,7 @@ void trProcessBusy(void)
if (!gModernMap || !gBusy[i].sect->xs().pauseMotion) nStatus = gBusyProc[gBusy[i].type](gBusy[i].sect, gBusy[i].busy, nullptr);
else nStatus = 3; // allow to pause/continue motion for sectors any time by sending special command
#else
nStatus = gBusyProc[gBusy[i].type](gBusy[i].at0, gBusy[i].at8);
nStatus = gBusyProc[gBusy[i].type](gBusy[i].sect, gBusy[i].busy, nullptr);
#endif
switch (nStatus) {
case 1:

View file

@ -119,9 +119,12 @@ class BloodActor : CoreActor native
kStatFree = 1024,
};
states
{
}
// all callbacks, this is to allow using VM functions for all of them
native void aiGenDudeMoveForward();
native void aiMoveDodge();
native void aiMoveForward();
native void aiMoveTurn();
@ -177,7 +180,6 @@ native void entryEStand();
native void entryEZombie();
native void entryFStatue();
native void entrySStatue();
native void forcePunch();
native void gargMoveDodgeDown();
native void gargMoveDodgeUp();
native void gargMoveFly();
@ -235,9 +237,6 @@ native void sub_72580();
native void sub_725A4();
native void sub_72850();
native void tchernobogThinkChase();
native void unicultThinkChase();
native void unicultThinkGoto();
native void unicultThinkSearch();
native void zombaThinkChase();
native void zombaThinkGoto();
native void zombaThinkPonder();
@ -289,10 +288,6 @@ native void SpidBirthSeqCallback();
native void tchernobogFire();
native void tchernobogBurnSeqCallback();
native void tchernobogBurnSeqCallback2();
native void genDudeAttack1();
native void punchCallback();
native void ThrowCallback1();
native void ThrowCallback2();
native void HackSeqCallback();
native void StandSeqCallback();
native void zombfHackSeqCallback();
@ -324,6 +319,19 @@ native void fxPodBloodSpray(); // 18
native void fxPodBloodSplat(); // 19
native void LeechStateTimer(); // 20
native void DropVoodooCb(); // unused
native void callbackMakeMissileBlocking(); // 23
native void callbackMissileBurst();
//native void unicultThinkChase();
//native void unicultThinkGoto();
//native void unicultThinkSearch();
//native void forcePunch();
//native void aiGenDudeMoveForward();
//native void genDudeAttack1();
//native void punchCallback();
//native void ThrowCallback1();
//native void ThrowCallback2();
native double dudeSlope;
native readonly bool hasx;