- scriptified ooz.

This commit is contained in:
Christoph Oelckers 2022-11-28 19:55:28 +01:00
parent 9d1384449c
commit 8a921c98bd
17 changed files with 68 additions and 72 deletions

View file

@ -302,6 +302,10 @@ CUSTOM_CVAR(Int, playergender, 0, CVAR_USERINFO|CVAR_ARCHIVE)
if (self < 0 || self > 3) self = 0; if (self < 0 || self > 3) self = 0;
} }
CUSTOM_CVAR(Int, cl_maxdecalamount, 1024, CVAR_ARCHIVE)
{
if (self < 0) self = 0;
}

View file

@ -106,6 +106,8 @@ EXTERN_CVAR(Int, m_ffire)
EXTERN_CVAR(Int, m_noexits) EXTERN_CVAR(Int, m_noexits)
EXTERN_CVAR(Int, playercolor) EXTERN_CVAR(Int, playercolor)
EXTERN_CVAR(Int, cl_maxdecalamount)
inline const char* PlayerName(size_t pindex) inline const char* PlayerName(size_t pindex)
{ {
// Todo: proper implementation of user CVARs. // Todo: proper implementation of user CVARs.

View file

@ -681,23 +681,6 @@ void rpgexplode(DDukeActor *actor, int hit, const DVector3 &pos, int EXPLOSION2,
// //
//--------------------------------------------------------------------------- //---------------------------------------------------------------------------
void ooz(DDukeActor *actor)
{
getglobalz(actor);
double y = min((actor->floorz - actor->ceilingz) / 128, 4.);
double x = clamp(0.390625 - y * 0.5, 0.125, 0.75);
actor->spr.scale = DVector2(x, y);
actor->spr.pos.Z = actor->floorz;
}
//---------------------------------------------------------------------------
//
//
//
//---------------------------------------------------------------------------
void reactor(DDukeActor* const actor, int REACTOR, int REACTOR2, int REACTORBURNT, int REACTOR2BURNT, int REACTORSPARK, int REACTOR2SPARK) void reactor(DDukeActor* const actor, int REACTOR, int REACTOR2, int REACTORBURNT, int REACTOR2BURNT, int REACTORSPARK, int REACTOR2SPARK)
{ {
auto sectp = actor->sector(); auto sectp = actor->sector();

View file

@ -2301,11 +2301,6 @@ void moveactors_d(void)
ssp(act, CLIPMASK0); ssp(act, CLIPMASK0);
break; break;
case OOZ:
case OOZ2:
ooz(act);
continue;
case GREENSLIME: case GREENSLIME:
case GREENSLIME + 1: case GREENSLIME + 1:
case GREENSLIME + 2: case GREENSLIME + 2:

View file

@ -2062,10 +2062,6 @@ void moveactors_r(void)
break; break;
} }
case OOZ:
ooz(act);
continue;
case EMPTYBIKE: case EMPTYBIKE:
if (!isRRRA()) break; if (!isRRRA()) break;
makeitfall(act); makeitfall(act);

View file

@ -375,6 +375,7 @@ enum sflags2_t
SFLAG2_IGNOREHITOWNER = 0x00200000, SFLAG2_IGNOREHITOWNER = 0x00200000,
SFLAG2_DONTDIVE = 0x00400000, SFLAG2_DONTDIVE = 0x00400000,
SFLAG2_FLOATING = 0x00800000, SFLAG2_FLOATING = 0x00800000,
SFLAG2_PAL8OOZ = 0x01000000, // dirty hack - only needed because this needs to work from CON.
}; };
using EDukeFlags2 = TFlags<sflags2_t, uint32_t>; using EDukeFlags2 = TFlags<sflags2_t, uint32_t>;

View file

@ -43,7 +43,6 @@ void lotsofstuff(DDukeActor* s, int n, int spawntype);
bool respawnmarker(DDukeActor* i, int yellow, int green); bool respawnmarker(DDukeActor* i, int yellow, int green);
void forcesphere(DDukeActor* i, int forcesphere); void forcesphere(DDukeActor* i, int forcesphere);
void recon(DDukeActor* i, int explosion, int firelaser, int attacksnd, int painsnd, int roamsnd, int shift, int (*getspawn)(DDukeActor* i)); void recon(DDukeActor* i, int explosion, int firelaser, int attacksnd, int painsnd, int roamsnd, int shift, int (*getspawn)(DDukeActor* i));
void ooz(DDukeActor* i);
void reactor(DDukeActor* i, int REACTOR, int REACTOR2, int REACTORBURNT, int REACTOR2BURNT, int REACTORSPARK, int REACTOR2SPARK); void reactor(DDukeActor* i, int REACTOR, int REACTOR2, int REACTORBURNT, int REACTOR2BURNT, int REACTORSPARK, int REACTOR2SPARK);
void bloodsplats(DDukeActor* actor); void bloodsplats(DDukeActor* actor);
void forcesphereexplode(DDukeActor* i); void forcesphereexplode(DDukeActor* i);

View file

@ -77,7 +77,7 @@ static void markgcroots()
{ {
GC::Mark(camsprite); GC::Mark(camsprite);
GC::Mark(BellSprite); GC::Mark(BellSprite);
GC::MarkArray(spriteq, countof(spriteq)); GC::MarkArray(spriteq, 1024);
GC::Mark(currentCommentarySprite); GC::Mark(currentCommentarySprite);
GC::Mark(ud.cameraactor); GC::Mark(ud.cameraactor);
for (auto& pl : ps) for (auto& pl : ps)

View file

@ -391,12 +391,11 @@ void resetinventory(int snum)
void resetprestat(int snum,int g) void resetprestat(int snum,int g)
{ {
player_struct* p; player_struct* p;
int i;
p = &ps[snum]; p = &ps[snum];
spriteqloc = 0; spriteqloc = 0;
for(i=0;i<spriteqamount;i++) spriteq[i] = nullptr; for(auto& p : spriteq) p = nullptr;
p->hbomb_on = 0; p->hbomb_on = 0;
p->pals.a = 0; p->pals.a = 0;

View file

@ -681,29 +681,6 @@ DDukeActor* spawninit_d(DDukeActor* actj, DDukeActor* act, TArray<DDukeActor*>*
break; break;
case OOZ:
case OOZ2:
{
act->spr.shade = -12;
if (actj)
{
if (actj->spr.picnum == NUKEBARREL)
act->spr.pal = 8;
insertspriteq(act);
}
ChangeActorStat(act, STAT_ACTOR);
getglobalz(act);
double j = ((act->floorz - act->ceilingz) / 128.);
act->spr.scale = DVector2(max(0., 0.390625 - j * 0.5), j);
if (krand() & 4) act->spr.cstat |= CSTAT_SPRITE_XFLIP;
break;
}
case HEAVYHBOMB: case HEAVYHBOMB:
if (actj) act->SetOwner(actj); if (actj) act->SetOwner(actj);
else act->SetOwner(act); else act->SetOwner(act);

View file

@ -695,24 +695,6 @@ DDukeActor* spawninit_r(DDukeActor* actj, DDukeActor* act, TArray<DDukeActor*>*
break; break;
case OOZ:
{
act->spr.shade = -12;
if (actj)
if (actj->spr.picnum == NUKEBARREL)
act->spr.pal = 8;
ChangeActorStat(act, STAT_STANDABLE);
getglobalz(act);
double j = ((act->floorz - act->ceilingz) / 128.);
act->spr.scale = DVector2(max(0., 0.390625 - j * 0.5), j);
if(krand() & 4) act->spr.cstat |= CSTAT_SPRITE_XFLIP;
break;
}
case DYNAMITE: case DYNAMITE:
act->SetOwner(act); act->SetOwner(act);
act->spr.scale = DVector2(0.140625, 0.140625); act->spr.scale = DVector2(0.140625, 0.140625);

View file

@ -648,6 +648,12 @@ DEFINE_ACTION_FUNCTION_NATIVE(DDukeActor, setclipDistFromTile, DukeActor_setclip
return 0; return 0;
} }
DEFINE_ACTION_FUNCTION_NATIVE(DDukeActor, insertspriteq, insertspriteq)
{
PARAM_SELF_PROLOGUE(DDukeActor);
insertspriteq(self);
return 0;
}
// temporary helpers to hide the fact that these flags are not part of the actor yet. // temporary helpers to hide the fact that these flags are not part of the actor yet.

View file

@ -49,7 +49,8 @@ spawnclasses
903 = DukePoolPocket 903 = DukePoolPocket
2590 = DukeForceSphere 2590 = DukeForceSphere
1960 = DukeRecon 1960 = DukeRecon
2300 = DukeOoz
2309 = DukeOoz2
1272 = DukeTrash 1272 = DukeTrash
634 = DukeBolt1 634 = DukeBolt1

View file

@ -51,6 +51,7 @@ spawnclasses
866 = RedneckRespawnMarker 866 = RedneckRespawnMarker
1344 = DukeRat 1344 = DukeRat
1759 = DukeForceSphere 1759 = DukeForceSphere
1529 = DukeOoz
285 = RedneckChickenSpawner1 285 = RedneckChickenSpawner1
286 = RedneckChickenSpawner2 286 = RedneckChickenSpawner2

View file

@ -79,6 +79,7 @@ version "4.10"
#include "zscript/games/duke/actors/queball.zs" #include "zscript/games/duke/actors/queball.zs"
#include "zscript/games/duke/actors/forcesphere.zs" #include "zscript/games/duke/actors/forcesphere.zs"
#include "zscript/games/duke/actors/recon.zs" #include "zscript/games/duke/actors/recon.zs"
#include "zscript/games/duke/actors/ooz.zs"
#include "zscript/games/duke/actors/genericdestructible.zs" #include "zscript/games/duke/actors/genericdestructible.zs"
#include "zscript/games/duke/actors/redneckmisc.zs" #include "zscript/games/duke/actors/redneckmisc.zs"

View file

@ -0,0 +1,47 @@
class DukeOoz : DukeActor
{
default
{
shade -12;
statnum STAT_ACTOR;
pic "OOZ";
}
override void Initialize()
{
self.shade = -12;
if (self.ownerActor && self.OwnerActor != self)
{
if (self.actorflag2(SFLAG2_PAL8OOZ))
self.pal = 8;
if (!Raze.IsRR()) self.insertspriteq();
}
self.getglobalz();
double z = ((self.floorz - self.ceilingz) / 128.);
self.scale = (max(0., 0.390625 - z * 0.5), z);
self.cstat |= randomXFlip();
}
override void Tick()
{
self.getglobalz();
double y = min((self.floorz - self.ceilingz) / 128, 4.);
double x = clamp(0.390625 - y * 0.5, 0.125, 0.75);
self.scale = (x, y);
self.pos.Z = self.floorz;
}
}
class DukeOoz2 : DukeActor
{
default
{
pic "OOZ2";
}
}

View file

@ -204,6 +204,7 @@ class DukeActor : CoreActor native
native int monsterCheatCheck(); native int monsterCheatCheck();
native void shoot(Name spawnclass); native void shoot(Name spawnclass);
native void setClipDistFromTile(); native void setClipDistFromTile();
native void insertspriteq();
// temporary flag accessors - need to be eliminated once we can have true actor flags // temporary flag accessors - need to be eliminated once we can have true actor flags
@ -328,4 +329,5 @@ enum sflags2_t
SFLAG2_IGNOREHITOWNER = 0x00200000, SFLAG2_IGNOREHITOWNER = 0x00200000,
SFLAG2_DONTDIVE = 0x00400000, SFLAG2_DONTDIVE = 0x00400000,
SFLAG2_FLOATING = 0x00800000, SFLAG2_FLOATING = 0x00800000,
SFLAG2_PAL8OOZ = 0x01000000, // dirty hack - only needed because this needs to work from CON.
}; };