mirror of
https://github.com/DrBeef/Raze.git
synced 2025-03-21 17:00:52 +00:00
- scriptified RR's UFO teleporter.
This commit is contained in:
parent
5a155730b4
commit
dc06a93a4f
10 changed files with 90 additions and 71 deletions
|
@ -875,6 +875,24 @@ DEFINE_ACTION_FUNCTION_NATIVE(DCoreActor, isAwayFromWall, isAwayFromWall)
|
|||
return 0;
|
||||
}
|
||||
|
||||
DEFINE_ACTION_FUNCTION_NATIVE(DCoreActor, ChangeSector, ChangeActorSect)
|
||||
{
|
||||
PARAM_SELF_PROLOGUE(DCoreActor);
|
||||
PARAM_POINTER(sec, sectortype);
|
||||
PARAM_INT(tail);
|
||||
ChangeActorSect(self, sec, tail);
|
||||
return 0;
|
||||
}
|
||||
|
||||
DEFINE_ACTION_FUNCTION_NATIVE(DCoreActor, ChangeStat, ChangeActorStat)
|
||||
{
|
||||
PARAM_SELF_PROLOGUE(DCoreActor);
|
||||
PARAM_INT(stat);
|
||||
PARAM_INT(tail);
|
||||
ChangeActorStat(self, stat, tail);
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
|
|
@ -1174,47 +1174,6 @@ void resetswitch(int tag)
|
|||
}
|
||||
}
|
||||
|
||||
void rr_specialstats()
|
||||
{
|
||||
tickstat(STAT_LUMBERMILL);
|
||||
|
||||
if (ud.chickenplant)
|
||||
{
|
||||
tickstat(STAT_CHICKENPLANT);
|
||||
}
|
||||
|
||||
tickstat(STAT_BOWLING);
|
||||
|
||||
DukeStatIterator it(STAT_TELEPORT);
|
||||
while (auto act = it.Next())
|
||||
{
|
||||
if (act->spr.picnum == RRTELEPORT)
|
||||
{
|
||||
double xx;
|
||||
int p = findplayer(act, &xx);
|
||||
if (xx < 128)
|
||||
{
|
||||
DukeStatIterator it2(STAT_TELEPORT);
|
||||
while (auto act2 = it2.Next())
|
||||
{
|
||||
if (act2->spr.picnum == RRTELEPORTDEST)
|
||||
{
|
||||
ps[p].Angles.setYaw(act2->spr.Angles.Yaw, true);
|
||||
ps[p].GetActor()->spr.pos = act2->spr.pos.plusZ(-36 + gs.playerheight);
|
||||
ps[p].GetActor()->backuppos();
|
||||
ps[p].setbobpos();
|
||||
auto pact = ps[p].GetActor();
|
||||
ChangeActorSect(pact, act2->sector());
|
||||
ps[p].setCursector(pact->sector());
|
||||
S_PlayActorSound(70, act2);
|
||||
act2->Destroy();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------
|
||||
//
|
||||
//
|
||||
|
@ -1234,13 +1193,14 @@ void moveactors_r(void)
|
|||
{
|
||||
rrra_specialstats();
|
||||
}
|
||||
rr_specialstats();
|
||||
tickstat(STAT_LUMBERMILL);
|
||||
if (ud.chickenplant) tickstat(STAT_CHICKENPLANT);
|
||||
tickstat(STAT_BOWLING);
|
||||
tickstat(STAT_TELEPORT);
|
||||
|
||||
DukeStatIterator it(STAT_ACTOR);
|
||||
while (auto act = it.Next())
|
||||
{
|
||||
bool deleteafterexecute = false; // taking a cue here from RedNukem to not run scripts on deleted sprites.
|
||||
|
||||
if( act->spr.scale.X == 0 || !act->insector() || actorflag(act, SFLAG2_DIENOW))
|
||||
{
|
||||
act->Destroy();
|
||||
|
@ -1291,7 +1251,6 @@ void moveactors_r(void)
|
|||
p = findplayer(act, &xx);
|
||||
|
||||
execute(act,p,xx);
|
||||
if (deleteafterexecute) act->Destroy();
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -157,12 +157,6 @@ DDukeActor* spawninit_r(DDukeActor* actj, DDukeActor* act, TArray<DDukeActor*>*
|
|||
act->clipdist = 8;
|
||||
ChangeActorStat(act, STAT_ZOMBIEACTOR);
|
||||
break;
|
||||
case RRTELEPORT:
|
||||
case RRTELEPORTDEST:
|
||||
act->spr.scale = DVector2(1, 1);
|
||||
act->clipdist = 16;
|
||||
ChangeActorStat(act, STAT_TELEPORT);
|
||||
break;
|
||||
case DUKELYINGDEAD:
|
||||
if (actj && actj->isPlayer())
|
||||
{
|
||||
|
|
|
@ -528,24 +528,6 @@ DEFINE_ACTION_FUNCTION_NATIVE(DDukeActor, hitasprite, hitasprite)
|
|||
return min(numret, 2);
|
||||
}
|
||||
|
||||
DEFINE_ACTION_FUNCTION_NATIVE(DDukeActor, ChangeSector, ChangeActorSect)
|
||||
{
|
||||
PARAM_SELF_PROLOGUE(DDukeActor);
|
||||
PARAM_POINTER(sec, sectortype);
|
||||
PARAM_INT(tail);
|
||||
ChangeActorSect(self, sec, tail);
|
||||
return 0;
|
||||
}
|
||||
|
||||
DEFINE_ACTION_FUNCTION_NATIVE(DDukeActor, ChangeStat, ChangeActorStat)
|
||||
{
|
||||
PARAM_SELF_PROLOGUE(DDukeActor);
|
||||
PARAM_INT(stat);
|
||||
PARAM_INT(tail);
|
||||
ChangeActorStat(self, stat, tail);
|
||||
return 0;
|
||||
}
|
||||
|
||||
void DukeActor_detonate(DDukeActor* origin, int intname)
|
||||
{
|
||||
// all callers use "EXPLOSION2", so ignore the parameter for now. This should be fixed once EXPLOSION2 gets scriptified.
|
||||
|
@ -1123,6 +1105,19 @@ DEFINE_ACTION_FUNCTION_NATIVE(_DukePlayer, GetPitchwithView, DukePlayer_GetPitch
|
|||
ACTION_RETURN_FLOAT(DukePlayer_GetPitchwithView(self));
|
||||
}
|
||||
|
||||
inline void DukePlayer_setbobpos(player_struct* pl)
|
||||
{
|
||||
return pl->setbobpos();
|
||||
}
|
||||
|
||||
DEFINE_ACTION_FUNCTION_NATIVE(_DukePlayer, setbobpos, DukePlayer_setbobpos)
|
||||
{
|
||||
PARAM_SELF_STRUCT_PROLOGUE(player_struct);
|
||||
self->setbobpos();
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
static DDukeActor* duke_firstStat(DukeStatIterator* it, int statnum)
|
||||
|
|
|
@ -139,6 +139,8 @@ spawnclasses
|
|||
3440 = RedneckBowlingPin
|
||||
3430 = RedneckBowlingBall
|
||||
4897 = RedneckHenstand
|
||||
296 = RedneckTeleport
|
||||
297 = RedneckTeleportDest
|
||||
|
||||
3114 = DukeGenericDestructible, "RRTILE3114", "RRTILE3117", "GLASS_BREAKING", spawnglass
|
||||
2876 = DukeGenericDestructible, "RRTILE2876", "RRTILE2990", "GLASS_BREAKING", spawnglass
|
||||
|
|
|
@ -101,6 +101,7 @@ version "4.10"
|
|||
|
||||
|
||||
#include "zscript/games/duke/actors/redneckmisc.zs"
|
||||
#include "zscript/games/duke/actors/rrteleport.zs"
|
||||
#include "zscript/games/duke/actors/bowling.zs"
|
||||
#include "zscript/games/duke/actors/rabbitspawner.zs"
|
||||
#include "zscript/games/duke/actors/chickenplant.zs"
|
||||
|
|
|
@ -69,6 +69,9 @@ class CoreActor native
|
|||
native void setPositionZ(Vector3 pos);
|
||||
native bool isAwayFromWall(double dist);
|
||||
|
||||
native void ChangeSector(sectortype s, bool forcetail = false);
|
||||
native void ChangeStat(int s, bool forcetail = false);
|
||||
|
||||
native clearscope static double deltaangle(double ang1, double ang2);
|
||||
native clearscope static double absangle(double ang1, double ang2);
|
||||
native clearscope static double Normalize180(double ang);
|
||||
|
|
48
wadsrc/static/zscript/games/duke/actors/rrteleport.zs
Normal file
48
wadsrc/static/zscript/games/duke/actors/rrteleport.zs
Normal file
|
@ -0,0 +1,48 @@
|
|||
|
||||
class RedneckTeleportDest : DukeActor
|
||||
{
|
||||
default
|
||||
{
|
||||
pic "RRTELEPORTDEST";
|
||||
statnum STAT_TELEPORT;
|
||||
ScaleX 1;
|
||||
ScaleY 1;
|
||||
clipdist 16;
|
||||
}
|
||||
}
|
||||
|
||||
class RedneckTeleport : RedneckTeleportDest
|
||||
{
|
||||
default
|
||||
{
|
||||
pic "RRTELEPORT";
|
||||
}
|
||||
|
||||
override void Tick()
|
||||
{
|
||||
double xx;
|
||||
DukePlayer p;
|
||||
[p, xx] = self.findplayer();
|
||||
if (xx < 128)
|
||||
{
|
||||
DukeStatIterator it;
|
||||
for(let act2 = it.First(STAT_TELEPORT); act2; act2 = it.Next())
|
||||
{
|
||||
if (act2.GetClassName() == 'RedneckTeleportDest')
|
||||
{
|
||||
p.setTargetAngle(act2.angle, true);
|
||||
let pactor = p.actor;
|
||||
pactor.pos = act2.pos.plusZ(-36 + gs.playerheight);
|
||||
pactor.backuppos();
|
||||
p.setbobpos();
|
||||
pactor.ChangeSector(act2.sector);
|
||||
p.cursector = pactor.sector;
|
||||
act2.PlayActorSound("TELEPORTER");
|
||||
act2.cstat = CSTAT_SPRITE_INVISIBLE;
|
||||
act2.cstat2 |= CSTAT2_SPRITE_NOFIND;
|
||||
act2.ChangeStat(STAT_REMOVED); // this is still needed for the sound so don't destroy.
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
|
@ -203,8 +203,6 @@ class DukeActor : CoreActor native
|
|||
native void RandomScrap();
|
||||
native void hitradius(int r, int hp1, int hp2, int hp3, int hp4);
|
||||
native double, DukeActor hitasprite();
|
||||
native void ChangeSector(sectortype s, bool forcetail = false);
|
||||
native void ChangeStat(int s, bool forcetail = false);
|
||||
native int badguy();
|
||||
native int isplayer();
|
||||
native void lotsofstuff(Name type, int count);
|
||||
|
|
|
@ -358,6 +358,7 @@ struct DukePlayer native
|
|||
native void addweapon(int type, bool switchit);
|
||||
native bool hitablockingwall();
|
||||
native double getPitchWithView();
|
||||
native void setbobpos();
|
||||
|
||||
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue