mirror of
https://github.com/ZDoom/Raze.git
synced 2024-11-15 00:42:08 +00:00
- scriptified Duke's shooting gallery targets.
This commit is contained in:
parent
e69772637c
commit
f1d6e0e6bb
7 changed files with 86 additions and 53 deletions
|
@ -1826,52 +1826,6 @@ void moveactors_d(void)
|
|||
if (isWorldTour()) flamethrowerflame(act);
|
||||
continue;
|
||||
|
||||
case DUCK:
|
||||
case TARGET:
|
||||
if (act->spr.cstat & CSTAT_SPRITE_ALIGNMENT_FLOOR)
|
||||
{
|
||||
act->temp_data[0]++;
|
||||
if (act->temp_data[0] > 60)
|
||||
{
|
||||
act->temp_data[0] = 0;
|
||||
act->spr.cstat = CSTAT_SPRITE_YCENTER | CSTAT_SPRITE_BLOCK_ALL | CSTAT_SPRITE_ALIGNMENT_WALL;
|
||||
act->spr.extra = 1;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
int j = fi.ifhitbyweapon(act);
|
||||
if (j >= 0)
|
||||
{
|
||||
act->spr.cstat = CSTAT_SPRITE_ALIGNMENT_FLOOR | CSTAT_SPRITE_YCENTER;
|
||||
k = 1;
|
||||
|
||||
DukeStatIterator itr(STAT_ACTOR);
|
||||
while (auto act2 = itr.Next())
|
||||
{
|
||||
if (act2->spr.lotag == act->spr.lotag &&
|
||||
act2->spr.picnum == act->spr.picnum)
|
||||
{
|
||||
if ((act2->spr.hitag && !(act2->spr.cstat & CSTAT_SPRITE_ALIGNMENT_FLOOR)) ||
|
||||
(!act2->spr.hitag && (act2->spr.cstat & CSTAT_SPRITE_ALIGNMENT_FLOOR))
|
||||
)
|
||||
{
|
||||
k = 0;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (k == 1)
|
||||
{
|
||||
operateactivators(act->spr.lotag, nullptr);
|
||||
fi.operateforcefields(act, act->spr.lotag);
|
||||
operatemasterswitches(act->spr.lotag);
|
||||
}
|
||||
}
|
||||
}
|
||||
continue;
|
||||
|
||||
case HELECOPT:
|
||||
case DUKECAR:
|
||||
|
||||
|
|
|
@ -513,13 +513,6 @@ DDukeActor* spawninit_d(DDukeActor* actj, DDukeActor* act, TArray<DDukeActor*>*
|
|||
act->spr.cstat |= CSTAT_SPRITE_INVISIBLE;
|
||||
ChangeActorStat(act, STAT_STANDABLE);
|
||||
break;
|
||||
case TARGET:
|
||||
case DUCK:
|
||||
case LETTER:
|
||||
act->spr.extra = 1;
|
||||
act->spr.cstat |= CSTAT_SPRITE_BLOCK_ALL;
|
||||
ChangeActorStat(act, STAT_ACTOR);
|
||||
break;
|
||||
case OCTABRAINSTAYPUT:
|
||||
case LIZTROOPSTAYPUT:
|
||||
case PIGCOPSTAYPUT:
|
||||
|
|
|
@ -668,6 +668,19 @@ DEFINE_ACTION_FUNCTION_NATIVE(DDukeActor, insertspriteq, insertspriteq)
|
|||
return 0;
|
||||
}
|
||||
|
||||
void DukeActor_operateforcefields(DDukeActor* self, int tag)
|
||||
{
|
||||
fi.operateforcefields(self, tag);
|
||||
}
|
||||
|
||||
DEFINE_ACTION_FUNCTION_NATIVE(DDukeActor, operateforcefields, DukeActor_operateforcefields)
|
||||
{
|
||||
PARAM_SELF_PROLOGUE(DDukeActor);
|
||||
PARAM_INT(tag);
|
||||
fi.operateforcefields(self, tag);
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
// temporary helpers to hide the fact that these flags are not part of the actor yet.
|
||||
DEFINE_ACTION_FUNCTION(DDukeActor, actorflag1)
|
||||
|
|
|
@ -71,6 +71,9 @@ spawnclasses
|
|||
753 = DukeStatue
|
||||
1157 = DukeBottle10
|
||||
765 = DukeVase
|
||||
4502 = DukeLetter
|
||||
4361 = DukeDuck
|
||||
4359 = DukeTarget
|
||||
|
||||
1272 = DukeTrash
|
||||
634 = DukeBolt1
|
||||
|
|
|
@ -85,6 +85,7 @@ version "4.10"
|
|||
#include "zscript/games/duke/actors/bloodsplats.zs"
|
||||
#include "zscript/games/duke/actors/reactor.zs"
|
||||
#include "zscript/games/duke/actors/destructibles.zs"
|
||||
#include "zscript/games/duke/actors/ducktarget.zs"
|
||||
|
||||
#include "zscript/games/duke/actors/redneckmisc.zs"
|
||||
#include "zscript/games/duke/actors/rabbitspawner.zs"
|
||||
|
|
68
wadsrc/static/zscript/games/duke/actors/ducktarget.zs
Normal file
68
wadsrc/static/zscript/games/duke/actors/ducktarget.zs
Normal file
|
@ -0,0 +1,68 @@
|
|||
class DukeLetter : DukeActor
|
||||
{
|
||||
default
|
||||
{
|
||||
pic "LETTER";
|
||||
statnum STAT_ACTOR;
|
||||
extra 1;
|
||||
}
|
||||
|
||||
override void Initialize()
|
||||
{
|
||||
self.cstat |= CSTAT_SPRITE_BLOCK_ALL;
|
||||
}
|
||||
}
|
||||
|
||||
class DukeDuck : DukeLetter // shooting gallery target
|
||||
{
|
||||
default
|
||||
{
|
||||
pic "DUCK";
|
||||
}
|
||||
override void Tick()
|
||||
{
|
||||
if (self.cstat & CSTAT_SPRITE_ALIGNMENT_FLOOR)
|
||||
{
|
||||
self.temp_data[0]++;
|
||||
if (self.temp_data[0] > 60)
|
||||
{
|
||||
self.temp_data[0] = 0;
|
||||
self.cstat = CSTAT_SPRITE_YCENTER | CSTAT_SPRITE_BLOCK_ALL | CSTAT_SPRITE_ALIGNMENT_WALL;
|
||||
self.extra = 1;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
int j = self.ifhitbyweapon();
|
||||
if (j >= 0)
|
||||
{
|
||||
self.cstat = CSTAT_SPRITE_ALIGNMENT_FLOOR | CSTAT_SPRITE_YCENTER;
|
||||
|
||||
DukeStatIterator itr;
|
||||
for(let act2 = itr.First(STAT_ACTOR); act2; act2 = itr.Next())
|
||||
{
|
||||
if (act2.lotag == self.lotag && act2.GetClass() == self.GetClass())
|
||||
{
|
||||
if ((act2.hitag && !(act2.cstat & CSTAT_SPRITE_ALIGNMENT_FLOOR)) ||
|
||||
(!act2.hitag && (act2.cstat & CSTAT_SPRITE_ALIGNMENT_FLOOR))
|
||||
)
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
// got the last one. Receive your reward!
|
||||
dlevel.operateactivators(self.lotag, nullptr);
|
||||
self.operateforcefields(self.lotag);
|
||||
dlevel.operatemasterswitches(self.lotag);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
class DukeTarget : DukeDuck
|
||||
{
|
||||
default
|
||||
{
|
||||
pic "TARGET";
|
||||
}
|
||||
}
|
|
@ -210,6 +210,7 @@ class DukeActor : CoreActor native
|
|||
native void shoot(Name spawnclass);
|
||||
native void setClipDistFromTile();
|
||||
native void insertspriteq();
|
||||
native void operateforcefields(int tag);
|
||||
|
||||
|
||||
// temporary flag accessors - need to be eliminated once we can have true actor flags
|
||||
|
|
Loading…
Reference in a new issue