mirror of
https://github.com/DrBeef/Raze.git
synced 2024-11-15 00:41:55 +00:00
- scriptified the waterdrip
This commit is contained in:
parent
11acb92553
commit
15cd80cad3
13 changed files with 88 additions and 100 deletions
|
@ -249,7 +249,7 @@ static void AddSectTail(DCoreActor *actor, sectortype* sect)
|
|||
//
|
||||
//==========================================================================
|
||||
|
||||
static void AddSectHead(DCoreActor *actor, sectortype* sect)
|
||||
static void AddSectHead(DCoreActor* actor, sectortype* sect)
|
||||
{
|
||||
assert(actor->prevSect == nullptr && actor->nextSect == nullptr);
|
||||
|
||||
|
@ -280,8 +280,8 @@ static void RemoveActorSect(DCoreActor* actor)
|
|||
assert(actor->prevSect == nullptr && actor->nextSect == nullptr);
|
||||
return;
|
||||
}
|
||||
DCoreActor *prev = actor->prevSect;
|
||||
DCoreActor *next = actor->nextSect;
|
||||
DCoreActor* prev = actor->prevSect;
|
||||
DCoreActor* next = actor->nextSect;
|
||||
|
||||
auto& firstEntry = actor->link_sector->firstEntry;
|
||||
auto& lastEntry = actor->link_sector->lastEntry;
|
||||
|
@ -346,6 +346,10 @@ void ChangeActorSect(DCoreActor* actor, sectortype* sect, bool tail)
|
|||
DCoreActor* InsertActor(PClass* type, sectortype* sector, int stat, bool tail)
|
||||
{
|
||||
assert(type->IsDescendantOf(RUNTIME_CLASS(DCoreActor)));
|
||||
if (!type->IsDescendantOf(RUNTIME_CLASS(DCoreActor)))
|
||||
{
|
||||
I_Error("Tried to spawn object of non - actor class %s", type->TypeName.GetChars());
|
||||
}
|
||||
|
||||
auto actor = static_cast<DCoreActor*>(type->CreateNew());
|
||||
auto defaults = GetDefaultByType(type);
|
||||
|
|
|
@ -452,8 +452,8 @@ DEFINE_PROPERTY(clipdist, I, CoreActor)
|
|||
//==========================================================================
|
||||
DEFINE_PROPERTY(scalex, F, CoreActor)
|
||||
{
|
||||
PROP_INT_PARM(i, 0);
|
||||
defaults->spr.scale.X = (i);
|
||||
PROP_FLOAT_PARM(i, 0);
|
||||
defaults->spr.scale.X = i;
|
||||
bag.Info->ActorInfo()->DefaultFlags |= DEFF_XREPEAT;
|
||||
}
|
||||
|
||||
|
@ -462,8 +462,8 @@ DEFINE_PROPERTY(scalex, F, CoreActor)
|
|||
//==========================================================================
|
||||
DEFINE_PROPERTY(scaley, F, CoreActor)
|
||||
{
|
||||
PROP_INT_PARM(i, 0);
|
||||
defaults->spr.scale.Y = (i);
|
||||
PROP_FLOAT_PARM(i, 0);
|
||||
defaults->spr.scale.Y = i;
|
||||
bag.Info->ActorInfo()->DefaultFlags |= DEFF_YREPEAT;
|
||||
}
|
||||
|
||||
|
|
|
@ -673,48 +673,6 @@ void detonate(DDukeActor *actor, int explosion)
|
|||
//
|
||||
//---------------------------------------------------------------------------
|
||||
|
||||
void movewaterdrip(DDukeActor *actor, int drip)
|
||||
{
|
||||
if (actor->temp_data[1])
|
||||
{
|
||||
actor->temp_data[1]--;
|
||||
if (actor->temp_data[1] == 0)
|
||||
actor->spr.cstat &= ~CSTAT_SPRITE_INVISIBLE;
|
||||
}
|
||||
else
|
||||
{
|
||||
makeitfall(actor);
|
||||
ssp(actor, CLIPMASK0);
|
||||
if(actor->vel.X > 0) actor->vel.X -= 1/8.;
|
||||
|
||||
if (actor->vel.Z == 0)
|
||||
{
|
||||
actor->spr.cstat |= CSTAT_SPRITE_INVISIBLE;
|
||||
|
||||
if (actor->spr.pal != 2 && (isRR() || actor->spr.hitag == 0))
|
||||
S_PlayActorSound(SOMETHING_DRIPPING, actor);
|
||||
|
||||
auto Owner = actor->GetOwner();
|
||||
if (!Owner || Owner->spr.picnum != drip)
|
||||
{
|
||||
deletesprite(actor);
|
||||
}
|
||||
else
|
||||
{
|
||||
actor->spr.pos.Z = actor->temp_pos.Z;
|
||||
actor->backupz();
|
||||
actor->temp_data[1] = 48 + (krand() & 31);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------
|
||||
//
|
||||
//
|
||||
//
|
||||
//---------------------------------------------------------------------------
|
||||
|
||||
void movedoorshock(DDukeActor* actor)
|
||||
{
|
||||
auto sectp = actor->sector();
|
||||
|
|
|
@ -849,11 +849,6 @@ void movestandables_d(void)
|
|||
moveviewscreen(act);
|
||||
}
|
||||
|
||||
else if (picnum == WATERDRIP)
|
||||
{
|
||||
movewaterdrip(act, WATERDRIP);
|
||||
}
|
||||
|
||||
else if (picnum == DOORSHOCK)
|
||||
{
|
||||
movedoorshock(act);
|
||||
|
|
|
@ -732,11 +732,6 @@ void movestandables_r(void)
|
|||
continue;
|
||||
}
|
||||
|
||||
else if (picnum == WATERDRIP)
|
||||
{
|
||||
movewaterdrip(act, WATERDRIP);
|
||||
}
|
||||
|
||||
else if (picnum == DOORSHOCK)
|
||||
{
|
||||
movedoorshock(act);
|
||||
|
|
|
@ -32,7 +32,6 @@ void movefta();
|
|||
void clearcameras(int i, player_struct* p);
|
||||
void RANDOMSCRAP(DDukeActor* i);
|
||||
void detonate(DDukeActor* i, int explosion);
|
||||
void movewaterdrip(DDukeActor* i, int drip);
|
||||
void movedoorshock(DDukeActor* i);
|
||||
void movetouchplate(DDukeActor* i, int plate);
|
||||
void movecanwithsomething(DDukeActor* i);
|
||||
|
@ -191,7 +190,6 @@ void spawntransporter(DDukeActor* actj, DDukeActor* acti, bool beam);
|
|||
int spawnbloodpoolpart1(DDukeActor* acti);
|
||||
void initfootprint(DDukeActor* actj, DDukeActor* acti);
|
||||
void initshell(DDukeActor* actj, DDukeActor* acti, bool isshell);
|
||||
void initwaterdrip(DDukeActor* actj, DDukeActor* acti);
|
||||
int initreactor(DDukeActor* actj, DDukeActor* acti, bool isrecon);
|
||||
void spawneffector(DDukeActor* actor, TArray<DDukeActor*>* actors);
|
||||
int startrts(int lumpNum, int localPlayer);
|
||||
|
|
|
@ -462,38 +462,6 @@ void initshell(DDukeActor* actj, DDukeActor* act, bool isshell)
|
|||
}
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------
|
||||
//
|
||||
//
|
||||
//
|
||||
//---------------------------------------------------------------------------
|
||||
|
||||
void initwaterdrip(DDukeActor* actj, DDukeActor* actor)
|
||||
{
|
||||
if (actj && (actj->spr.statnum == 10 || actj->spr.statnum == 1))
|
||||
{
|
||||
actor->spr.shade = 32;
|
||||
if (actj->spr.pal != 1)
|
||||
{
|
||||
actor->spr.pal = 2;
|
||||
actor->spr.pos.Z -= 18;
|
||||
}
|
||||
else actor->spr.pos.Z -= 13;
|
||||
actor->spr.angle = (ps[connecthead].pos.XY() - actor->spr.pos.XY()).Angle();
|
||||
actor->vel.X = 3 - krandf(2);
|
||||
ssp(actor, CLIPMASK0);
|
||||
}
|
||||
else if (!actj)
|
||||
{
|
||||
actor->spr.pos.Z += 4;
|
||||
actor->temp_pos.Z = actor->spr.pos.Z;
|
||||
if (!isRR()) actor->temp_data[1] = krand() & 127;
|
||||
}
|
||||
actor->spr.scale = DVector2(0.375, 0.375);
|
||||
ChangeActorStat(actor, STAT_STANDABLE);
|
||||
}
|
||||
|
||||
|
||||
//---------------------------------------------------------------------------
|
||||
//
|
||||
//
|
||||
|
|
|
@ -638,10 +638,6 @@ DDukeActor* spawninit_d(DDukeActor* actj, DDukeActor* act, TArray<DDukeActor*>*
|
|||
ChangeActorStat(act, STAT_MISC);
|
||||
break;
|
||||
|
||||
case WATERDRIP:
|
||||
initwaterdrip(actj, act);
|
||||
break;
|
||||
|
||||
case WATERDRIPSPLASH:
|
||||
act->spr.scale = DVector2(0.375, 0.375);
|
||||
ChangeActorStat(act, STAT_STANDABLE);
|
||||
|
|
|
@ -668,9 +668,6 @@ DDukeActor* spawninit_r(DDukeActor* actj, DDukeActor* act, TArray<DDukeActor*>*
|
|||
act->spr.scale = DVector2(0.5, 0.5);
|
||||
ChangeActorStat(act, STAT_MISC);
|
||||
break;
|
||||
case WATERDRIP:
|
||||
initwaterdrip(actj, act);
|
||||
break;
|
||||
|
||||
case PLUG:
|
||||
act->spr.lotag = 9999;
|
||||
|
|
|
@ -34,4 +34,5 @@ spawnclasses
|
|||
4526 = DukeSideBolt2
|
||||
4527 = DukeSideBolt3
|
||||
4528 = DukeSideBolt4
|
||||
660 = DukeWaterdrip
|
||||
}
|
||||
|
|
|
@ -26,5 +26,6 @@ spawnclasses
|
|||
1128 = DukeBolt2
|
||||
1129 = DukeBolt3
|
||||
1130 = DukeBolt4
|
||||
239 = DukeWaterdrip
|
||||
}
|
||||
|
||||
|
|
|
@ -62,6 +62,7 @@ version "4.10"
|
|||
#include "zscript/games/duke/actors/oozfilter.zs"
|
||||
#include "zscript/games/duke/actors/trash.zs"
|
||||
#include "zscript/games/duke/actors/bolt.zs"
|
||||
#include "zscript/games/duke/actors/waterdrip.zs"
|
||||
|
||||
#include "zscript/games/blood/bloodgame.zs"
|
||||
#include "zscript/games/blood/ui/menu.zs"
|
||||
|
|
74
wadsrc/static/zscript/games/duke/actors/waterdrip.zs
Normal file
74
wadsrc/static/zscript/games/duke/actors/waterdrip.zs
Normal file
|
@ -0,0 +1,74 @@
|
|||
class DukeWaterDrip : DukeActor
|
||||
{
|
||||
default
|
||||
{
|
||||
ScaleX 0.375;
|
||||
ScaleY 0.375;
|
||||
statnum STAT_STANDABLE;
|
||||
pic "WATERDRIP";
|
||||
}
|
||||
|
||||
override void Initialize()
|
||||
{
|
||||
let owner = self.ownerActor;
|
||||
if (owner && (owner.statnum == STAT_PLAYER || owner.statnum == STAT_ACTOR))
|
||||
{
|
||||
self.shade = 32;
|
||||
if (owner.pal != 1)
|
||||
{
|
||||
self.pal = 2;
|
||||
self.pos.Z -= 18;
|
||||
}
|
||||
else self.pos.Z -= 13;
|
||||
self.angle = (Duke.GetViewPlayer().actor.pos.XY - self.pos.XY).Angle();
|
||||
self.vel.X = frandom(1, 3);
|
||||
self.DoMove(CLIPMASK0);
|
||||
}
|
||||
else if (owner == self)
|
||||
{
|
||||
self.pos.Z += 4;
|
||||
self.temp_pos.Z = self.pos.Z;
|
||||
self.temp_data[1] = random(0, 127);
|
||||
}
|
||||
}
|
||||
|
||||
override void Tick()
|
||||
{
|
||||
if (self.temp_data[1])
|
||||
{
|
||||
self.temp_data[1]--;
|
||||
if (self.temp_data[1] == 0)
|
||||
self.cstat &= ~CSTAT_SPRITE_INVISIBLE;
|
||||
}
|
||||
else
|
||||
{
|
||||
self.makeitfall();
|
||||
self.DoMove(CLIPMASK0);
|
||||
if(self.vel.X > 0) self.vel.X -= 1/8.;
|
||||
|
||||
if (self.vel.Z == 0)
|
||||
{
|
||||
self.cstat |= CSTAT_SPRITE_INVISIBLE;
|
||||
|
||||
if (self.pal != 2 && (self.hitag == 0 || Raze.isRR()))
|
||||
self.PlayActorSound(DukeSnd.SOMETHING_DRIPPING);
|
||||
|
||||
if (self.ownerActor != self)
|
||||
{
|
||||
self.Destroy();
|
||||
}
|
||||
else
|
||||
{
|
||||
self.pos.Z = self.temp_pos.Z;
|
||||
self.backuppos();
|
||||
self.temp_data[1] = random(48, 79);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
Loading…
Reference in a new issue