mirror of
https://github.com/ZDoom/Raze.git
synced 2025-01-31 12:30:40 +00:00
- scriptied the cracks.
This commit is contained in:
parent
8ce358fc24
commit
f9826241ef
12 changed files with 110 additions and 118 deletions
|
@ -800,39 +800,6 @@ void movefallers_d(void)
|
|||
//
|
||||
//---------------------------------------------------------------------------
|
||||
|
||||
//---------------------------------------------------------------------------
|
||||
//
|
||||
//
|
||||
//
|
||||
//---------------------------------------------------------------------------
|
||||
|
||||
static void movecrack(DDukeActor* actor)
|
||||
{
|
||||
if (actor->spr.hitag > 0)
|
||||
{
|
||||
actor->temp_data[0] = actor->spr.cstat;
|
||||
actor->temp_angle = actor->spr.angle;
|
||||
int j = fi.ifhitbyweapon(actor);
|
||||
if (gs.actorinfo[j].flags2 & SFLAG2_EXPLOSIVE)
|
||||
{
|
||||
DukeStatIterator it(STAT_STANDABLE);
|
||||
while (auto a1 = it.Next())
|
||||
{
|
||||
if (actor->spr.hitag == a1->spr.hitag && actorflag(a1, SFLAG2_BRIGHTEXPLODE))
|
||||
if (a1->spr.shade != -32)
|
||||
a1->spr.shade = -32;
|
||||
}
|
||||
detonate(actor, EXPLOSION2);
|
||||
}
|
||||
else
|
||||
{
|
||||
actor->spr.cstat = ESpriteFlags::FromInt(actor->temp_data[0]);
|
||||
actor->spr.angle = actor->temp_angle;
|
||||
actor->spr.extra = 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------
|
||||
//
|
||||
// Duke only
|
||||
|
@ -1035,11 +1002,6 @@ void movestandables_d(void)
|
|||
continue;
|
||||
}
|
||||
|
||||
else if (picnum >= CRACK1 && picnum <= CRACK1 + 3)
|
||||
{
|
||||
movecrack(act);
|
||||
}
|
||||
|
||||
else if (picnum == FIREEXT)
|
||||
{
|
||||
movefireext(act);
|
||||
|
|
|
@ -713,39 +713,6 @@ void movefallers_r(void)
|
|||
//
|
||||
//---------------------------------------------------------------------------
|
||||
|
||||
static void movecrack(DDukeActor* actor)
|
||||
{
|
||||
if (actor->spr.hitag > 0)
|
||||
{
|
||||
actor->temp_data[0] = actor->spr.cstat;
|
||||
actor->temp_angle = actor->spr.angle;
|
||||
int j = fi.ifhitbyweapon(actor);
|
||||
if (gs.actorinfo[j].flags2 & SFLAG2_EXPLOSIVE)
|
||||
{
|
||||
DukeStatIterator it(STAT_STANDABLE);
|
||||
while (auto a1 = it.Next())
|
||||
{
|
||||
if (actor->spr.hitag == a1->spr.hitag && actorflag(a1, SFLAG2_BRIGHTEXPLODE))
|
||||
if (a1->spr.shade != -32)
|
||||
a1->spr.shade = -32;
|
||||
}
|
||||
detonate(actor, EXPLOSION2);
|
||||
}
|
||||
else
|
||||
{
|
||||
actor->spr.cstat = ESpriteFlags::FromInt(actor->temp_data[0]);
|
||||
actor->spr.angle = actor->temp_angle;
|
||||
actor->spr.extra = 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------
|
||||
//
|
||||
//
|
||||
//
|
||||
//---------------------------------------------------------------------------
|
||||
|
||||
static void movebolt(DDukeActor* actor)
|
||||
{
|
||||
double xx;
|
||||
|
@ -826,11 +793,6 @@ void movestandables_r(void)
|
|||
continue;
|
||||
}
|
||||
|
||||
else if (picnum >= CRACK1 && picnum <= CRACK1 + 3)
|
||||
{
|
||||
movecrack(act);
|
||||
}
|
||||
|
||||
else if (picnum == OOZFILTER || picnum == SEENINE || picnum == SEENINEDEAD || picnum == (SEENINEDEAD + 1))
|
||||
{
|
||||
moveooz(act, SEENINE, SEENINEDEAD, OOZFILTER, EXPLOSION2);
|
||||
|
|
|
@ -106,10 +106,6 @@ void animatesprites_d(tspriteArray& tsprites, const DVector2& viewVec, DAngle vi
|
|||
}
|
||||
[[fallthrough]];
|
||||
case BULLETHOLE:
|
||||
case CRACK1:
|
||||
case CRACK2:
|
||||
case CRACK3:
|
||||
case CRACK4:
|
||||
t->shade = 16;
|
||||
continue;
|
||||
case NEON1:
|
||||
|
|
|
@ -84,10 +84,6 @@ void animatesprites_r(tspriteArray& tsprites, const DVector2& viewVec, DAngle vi
|
|||
}
|
||||
[[fallthrough]];
|
||||
case BULLETHOLE:
|
||||
case CRACK1:
|
||||
case CRACK2:
|
||||
case CRACK3:
|
||||
case CRACK4:
|
||||
t->shade = 16;
|
||||
continue;
|
||||
|
||||
|
|
|
@ -1060,21 +1060,9 @@ DDukeActor* spawninit_d(DDukeActor* actj, DDukeActor* act, TArray<DDukeActor*>*
|
|||
ChangeActorStat(act, STAT_STANDABLE);
|
||||
break;
|
||||
|
||||
case CRACK1:
|
||||
case CRACK2:
|
||||
case CRACK3:
|
||||
case CRACK4:
|
||||
case FIREEXT:
|
||||
if (act->spr.picnum == FIREEXT)
|
||||
{
|
||||
act->spr.cstat = CSTAT_SPRITE_BLOCK_ALL;
|
||||
act->spr.extra = gs.impact_damage << 2;
|
||||
}
|
||||
else
|
||||
{
|
||||
act->spr.cstat |= (act->spr.cstat & CSTAT_SPRITE_ALIGNMENT_MASK) ? CSTAT_SPRITE_BLOCK : (CSTAT_SPRITE_BLOCK | CSTAT_SPRITE_ALIGNMENT_WALL);
|
||||
act->spr.extra = 1;
|
||||
}
|
||||
act->spr.cstat = CSTAT_SPRITE_BLOCK_ALL;
|
||||
act->spr.extra = gs.impact_damage << 2;
|
||||
|
||||
if (ud.multimode < 2 && act->spr.pal != 0)
|
||||
{
|
||||
|
|
|
@ -1286,26 +1286,6 @@ DDukeActor* spawninit_r(DDukeActor* actj, DDukeActor* act, TArray<DDukeActor*>*
|
|||
ChangeActorStat(act, STAT_STANDABLE);
|
||||
break;
|
||||
|
||||
case CRACK1:
|
||||
case CRACK2:
|
||||
case CRACK3:
|
||||
case CRACK4:
|
||||
act->spr.cstat |= CSTAT_SPRITE_BLOCK | CSTAT_SPRITE_ALIGNMENT_WALL;
|
||||
act->spr.extra = 1;
|
||||
if (ud.multimode < 2 && act->spr.pal != 0)
|
||||
{
|
||||
act->spr.scale = DVector2(0, 0);
|
||||
ChangeActorStat(act, STAT_MISC);
|
||||
break;
|
||||
}
|
||||
|
||||
act->spr.pal = 0;
|
||||
act->SetOwner(act);
|
||||
ChangeActorStat(act, STAT_STANDABLE);
|
||||
act->vel.X = 0.5;
|
||||
ssp(act, CLIPMASK0);
|
||||
break;
|
||||
|
||||
case EMPTYBIKE:
|
||||
if (!isRRRA()) goto default_case;
|
||||
if (ud.multimode < 2 && act->spr.pal == 1)
|
||||
|
|
|
@ -317,6 +317,21 @@ DEFINE_ACTION_FUNCTION_NATIVE(DDukeActor, ChangeStat, ChangeActorStat)
|
|||
return 0;
|
||||
}
|
||||
|
||||
void DukeActor_detonate(DDukeActor* origin, int intname)
|
||||
{
|
||||
// all callers use "EXPLOSION2", so ignore the parameter for now
|
||||
int picnum = TileFiles.tileForName("EXPLOSION2");
|
||||
detonate(origin, picnum);
|
||||
}
|
||||
|
||||
DEFINE_ACTION_FUNCTION_NATIVE(DDukeActor, detonate, DukeActor_detonate)
|
||||
{
|
||||
PARAM_SELF_PROLOGUE(DDukeActor);
|
||||
PARAM_INT(type);
|
||||
DukeActor_detonate(self, type);
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
// temporary helpers to hide the fact that these flags are not part of the actor yet.
|
||||
DEFINE_ACTION_FUNCTION(DDukeActor, actorflag1)
|
||||
|
|
|
@ -16,4 +16,8 @@ spawnclasses
|
|||
939 = DukeCactusBroke
|
||||
2566 = DukeTripbombPlaced
|
||||
2567 = DukeLaserline
|
||||
546 = DukeCrack1
|
||||
547 = DukeCrack2
|
||||
548 = DukeCrack3
|
||||
549 = DukeCrack4
|
||||
}
|
||||
|
|
|
@ -13,5 +13,9 @@ spawnclasses
|
|||
1230 = DukeTire
|
||||
1194 = DukeCactus
|
||||
1203 = DukeCactusBroke
|
||||
1075 = DukeCrack1
|
||||
1076 = DukeCrack2
|
||||
1077 = DukeCrack3
|
||||
1078 = DukeCrack4
|
||||
}
|
||||
|
||||
|
|
|
@ -56,6 +56,7 @@ version "4.10"
|
|||
#include "zscript/games/duke/actors/scrap.zs"
|
||||
#include "zscript/games/duke/actors/cactus.zs"
|
||||
#include "zscript/games/duke/actors/tripbomb.zs"
|
||||
#include "zscript/games/duke/actors/crack.zs"
|
||||
|
||||
#include "zscript/games/blood/bloodgame.zs"
|
||||
#include "zscript/games/blood/ui/menu.zs"
|
||||
|
|
83
wadsrc/static/zscript/games/duke/actors/crack.zs
Normal file
83
wadsrc/static/zscript/games/duke/actors/crack.zs
Normal file
|
@ -0,0 +1,83 @@
|
|||
|
||||
class DukeCrack1 : DukeActor
|
||||
{
|
||||
default
|
||||
{
|
||||
statnum STAT_STANDABLE;
|
||||
pic "CRACK1";
|
||||
}
|
||||
|
||||
override void Initialize()
|
||||
{
|
||||
self.cstat |= (self.cstat & CSTAT_SPRITE_ALIGNMENT_MASK) ? CSTAT_SPRITE_BLOCK : (CSTAT_SPRITE_BLOCK | CSTAT_SPRITE_ALIGNMENT_WALL);
|
||||
self.extra = 1;
|
||||
|
||||
if (ud.multimode < 2 && self.pal != 0)
|
||||
{
|
||||
self.scale = (0, 0);
|
||||
self.ChangeStat(STAT_MISC);
|
||||
return;
|
||||
}
|
||||
|
||||
self.pal = 0;
|
||||
self.ownerActor = self;
|
||||
self.vel.X = 0.5;
|
||||
self.DoMove(CLIPMASK0);
|
||||
}
|
||||
|
||||
override void Tick()
|
||||
{
|
||||
if (self.hitag > 0)
|
||||
{
|
||||
self.temp_data[0] = self.cstat;
|
||||
self.temp_angle = self.angle;
|
||||
if (self.ifhitbyweapon() >= 0 && self.attackerflag2(SFLAG2_EXPLOSIVE))
|
||||
{
|
||||
DukeStatIterator it;
|
||||
for(let a1 = it.First(STAT_STANDABLE); a1; a1 = it.Next())
|
||||
{
|
||||
if (self.hitag == a1.hitag && a1.actorflag2(SFLAG2_BRIGHTEXPLODE))
|
||||
if (a1.shade != -32)
|
||||
a1.shade = -32;
|
||||
}
|
||||
self.detonate('DukeExplosion2');
|
||||
}
|
||||
else
|
||||
{
|
||||
self.cstat = self.temp_data[0];
|
||||
self.angle = self.temp_angle;
|
||||
self.extra = 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
override bool animate(tspritetype tspr)
|
||||
{
|
||||
tspr.shade = 16;
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
class DukeCrack2 : DukeCrack1
|
||||
{
|
||||
default
|
||||
{
|
||||
pic "CRACK2";
|
||||
}
|
||||
}
|
||||
|
||||
class DukeCrack3 : DukeCrack1
|
||||
{
|
||||
default
|
||||
{
|
||||
pic "CRACK3";
|
||||
}
|
||||
}
|
||||
|
||||
class DukeCrack4 : DukeCrack1
|
||||
{
|
||||
default
|
||||
{
|
||||
pic "CRACK4";
|
||||
}
|
||||
}
|
|
@ -75,6 +75,7 @@ class DukeActor : CoreActor native
|
|||
native DukeActor spawnweaponorammo(int type);
|
||||
native void lotsofglass(int count);
|
||||
native void makeitfall();
|
||||
native void detonate(name type);
|
||||
|
||||
virtual void BeginPlay() {}
|
||||
virtual void Initialize() {}
|
||||
|
|
Loading…
Reference in a new issue