mirror of
https://github.com/ZDoom/Raze.git
synced 2025-01-19 07:01:09 +00:00
- scriptified SHRINKEREXPLOSION and WATERBUBBLE.
This commit is contained in:
parent
673ea69d35
commit
7b4d5eb26d
15 changed files with 84 additions and 61 deletions
|
@ -422,7 +422,7 @@ inline int shadeToLight(int shade)
|
|||
|
||||
inline void copyfloorpal(tspritetype* spr, const sectortype* sect)
|
||||
{
|
||||
if (!lookups.noFloorPal(sect->floorpal)) spr->pal = sect->floorpal;
|
||||
if (sect && !lookups.noFloorPal(sect->floorpal)) spr->pal = sect->floorpal;
|
||||
}
|
||||
|
||||
inline int I_GetBuildTime()
|
||||
|
|
|
@ -907,8 +907,6 @@ void movetransports_d(void)
|
|||
[[fallthrough]];
|
||||
|
||||
case DTILE_WATERBUBBLE:
|
||||
//if( rnd(192) && a2->s.picnum == DTILE_WATERBUBBLE)
|
||||
// break;
|
||||
|
||||
if (sectlotag > 0)
|
||||
{
|
||||
|
|
|
@ -272,13 +272,6 @@ void animatesprites_d(tspriteArray& tsprites, const DVector2& viewVec, DAngle vi
|
|||
|
||||
break;
|
||||
|
||||
case DTILE_WATERBUBBLE:
|
||||
if (tilesurface(t->sectp->floortexture) == TSURF_SLIME)
|
||||
{
|
||||
t->pal = 7;
|
||||
break;
|
||||
}
|
||||
[[fallthrough]];
|
||||
default:
|
||||
|
||||
if (sectp->floorpal && !actorflag(h, SFLAG2_NOFLOORPAL))
|
||||
|
@ -302,7 +295,6 @@ void animatesprites_d(tspriteArray& tsprites, const DVector2& viewVec, DAngle vi
|
|||
{
|
||||
case DTILE_GROWSPARK:
|
||||
case DTILE_CHAINGUN:
|
||||
case DTILE_SHRINKEREXPLOSION:
|
||||
case DTILE_FLOORFLAME:
|
||||
t->shade = -127;
|
||||
break;
|
||||
|
|
|
@ -319,13 +319,6 @@ void animatesprites_r(tspriteArray& tsprites, const DVector2& viewVec, DAngle vi
|
|||
|
||||
break;
|
||||
|
||||
case RTILE_WATERBUBBLE:
|
||||
if (tilesurface(t->sectp->floortexture) == TSURF_SLIME)
|
||||
{
|
||||
t->pal = 7;
|
||||
break;
|
||||
}
|
||||
[[fallthrough]];
|
||||
default:
|
||||
|
||||
if (sectp->floorpal)
|
||||
|
|
|
@ -147,6 +147,7 @@ void initactorflags_d()
|
|||
DTILE_SHRINKSPARK,
|
||||
DTILE_GROWSPARK,
|
||||
DTILE_RPG,
|
||||
DTILE_WATERBUBBLE,
|
||||
DTILE_RECON });
|
||||
|
||||
setflag(SFLAG2_EXPLOSIVE, { DTILE_FIREEXT, DTILE_RPG, DTILE_RADIUSEXPLOSION, DTILE_SEENINE, DTILE_OOZFILTER });
|
||||
|
|
|
@ -230,7 +230,8 @@ void initactorflags_r()
|
|||
RTILE_SHITBALL,
|
||||
RTILE_RPG,
|
||||
RTILE_RECON,
|
||||
RTILE_POWDERKEG
|
||||
RTILE_POWDERKEG,
|
||||
RTILE_WATERBUBBLE,
|
||||
});
|
||||
// Animals were not supposed to have this, but due to a coding bug the logic was unconditional for everything in the game.
|
||||
for (auto& ainf : gs.actorinfo)
|
||||
|
|
|
@ -228,7 +228,6 @@ DDukeActor* spawninit_d(DDukeActor* actj, DDukeActor* act, TArray<DDukeActor*>*
|
|||
break;
|
||||
[[fallthrough]];
|
||||
case DTILE_SMALLSMOKE:
|
||||
case DTILE_SHRINKEREXPLOSION:
|
||||
|
||||
if (actj)
|
||||
{
|
||||
|
@ -236,15 +235,7 @@ DDukeActor* spawninit_d(DDukeActor* actj, DDukeActor* act, TArray<DDukeActor*>*
|
|||
act->spr.shade = -64;
|
||||
act->spr.cstat = CSTAT_SPRITE_YCENTER | randomXFlip();
|
||||
}
|
||||
|
||||
else if (act->spr.picnum == DTILE_SHRINKEREXPLOSION)
|
||||
{
|
||||
act->spr.scale = DVector2(0.5, 0.5);
|
||||
}
|
||||
else if (act->spr.picnum == DTILE_SMALLSMOKE || act->spr.picnum == DTILE_ONFIRE)
|
||||
{
|
||||
act->spr.scale = DVector2(0.375, 0.375);
|
||||
}
|
||||
act->spr.scale = DVector2(0.375, 0.375);
|
||||
|
||||
if (actj)
|
||||
{
|
||||
|
@ -288,20 +279,6 @@ DDukeActor* spawninit_d(DDukeActor* actj, DDukeActor* act, TArray<DDukeActor*>*
|
|||
ChangeActorStat(act, STAT_PLAYER);
|
||||
break;
|
||||
}
|
||||
case DTILE_WATERBUBBLE:
|
||||
if (actj && actj->isPlayer())
|
||||
act->spr.pos.Z -= 16;
|
||||
if (act->spr.picnum == DTILE_WATERBUBBLE)
|
||||
{
|
||||
if (actj)
|
||||
act->spr.Angles.Yaw = actj->spr.Angles.Yaw;
|
||||
act->spr.scale = DVector2(0.0625, 0.0625);
|
||||
}
|
||||
else act->spr.scale = DVector2(0.5, 0.5);
|
||||
|
||||
ChangeActorStat(act, STAT_MISC);
|
||||
break;
|
||||
|
||||
case DTILE_WATERDRIPSPLASH: // ok
|
||||
act->spr.scale = DVector2(0.375, 0.375);
|
||||
ChangeActorStat(act, STAT_STANDABLE);
|
||||
|
|
|
@ -172,21 +172,6 @@ DDukeActor* spawninit_r(DDukeActor* actj, DDukeActor* act, TArray<DDukeActor*>*
|
|||
ChangeActorStat(act, STAT_PLAYER);
|
||||
break;
|
||||
}
|
||||
case RTILE_WATERBUBBLE:
|
||||
if (actj && actj->isPlayer())
|
||||
act->spr.pos.Z -= 16;
|
||||
if (act->spr.picnum == RTILE_WATERBUBBLE)
|
||||
{
|
||||
if (actj)
|
||||
act->spr.Angles.Yaw = actj->spr.Angles.Yaw;
|
||||
double s = REPEAT_SCALE + (krand() & 7) * REPEAT_SCALE;
|
||||
act->spr.scale = DVector2(s, s);
|
||||
}
|
||||
else
|
||||
act->spr.scale = DVector2(0.5, 0.5);
|
||||
ChangeActorStat(act, STAT_MISC);
|
||||
break;
|
||||
|
||||
case RTILE_WATERBUBBLEMAKER:
|
||||
act->spr.cstat |= CSTAT_SPRITE_INVISIBLE;
|
||||
ChangeActorStat(act, STAT_STANDABLE);
|
||||
|
|
|
@ -14,9 +14,6 @@ int PicForName(int intname)
|
|||
if (classnameToTile.CountUsed() == 0)
|
||||
{
|
||||
static std::pair<const char*, const char*> classes[] = {
|
||||
{"DukeAtomicHealth", "ATOMICHEALTH"},
|
||||
{"DukeShrinkerExplosion", "SHRINKEREXPLOSION" },
|
||||
{"DukeWaterBubble", "WATERBUBBLE"},
|
||||
{"DukeLavaPool", "LAVAPOOL"},
|
||||
{"RedneckCircleStuck", "CIRCLESTUCK"},
|
||||
{"DukePigCop", "PIGCOP"},
|
||||
|
@ -1552,6 +1549,14 @@ DEFINE_ACTION_FUNCTION_NATIVE(_tspritetype, setWeaponOrAmmoSprite, tspritetype_s
|
|||
return 0;
|
||||
}
|
||||
|
||||
DEFINE_ACTION_FUNCTION_NATIVE(_tspritetype, copyfloorpal, copyfloorpal)
|
||||
{
|
||||
PARAM_SELF_STRUCT_PROLOGUE(tspritetype);
|
||||
PARAM_POINTER(s, sectortype);
|
||||
copyfloorpal(self, s);
|
||||
return 0;
|
||||
}
|
||||
|
||||
// this must still work around the lack of proper texture support on the script side.
|
||||
DEFINE_ACTION_FUNCTION(DDukeGenericDestructible, SetBroken)
|
||||
{
|
||||
|
|
|
@ -247,4 +247,7 @@ spawnclasses
|
|||
41 = DukeBatteryAmmo
|
||||
52 = DukeSixpak
|
||||
100 = DukeAtomicHealth
|
||||
1656 = DukeShrinkerExplosion
|
||||
661 = DukeWaterBubble
|
||||
|
||||
}
|
||||
|
|
|
@ -281,6 +281,7 @@ spawnclasses
|
|||
41 = RedneckRifleAmmo
|
||||
52 = RedneckPorkRinds
|
||||
5595 = RedneckGoogooCluster
|
||||
240 = DukeWaterBubble
|
||||
|
||||
}
|
||||
|
||||
|
|
|
@ -106,6 +106,7 @@ version "4.10"
|
|||
#include "zscript/games/duke/actors/toiletwater.zs"
|
||||
#include "zscript/games/duke/actors/burning.zs"
|
||||
#include "zscript/games/duke/actors/explosion2.zs"
|
||||
#include "zscript/games/duke/actors/waterbubble.zs"
|
||||
|
||||
#include "zscript/games/duke/actors/batteryammo.zs"
|
||||
#include "zscript/games/duke/actors/sixpak.zs"
|
||||
|
|
|
@ -284,6 +284,37 @@ class DukeShrinkSpark : DukeProjectile
|
|||
}
|
||||
|
||||
|
||||
class DukeShrinkerExplosion : DukeActor
|
||||
{
|
||||
default
|
||||
{
|
||||
spriteset "SHRINKEREXPLOSION";
|
||||
}
|
||||
|
||||
override bool animate(tspritetype tspr)
|
||||
{
|
||||
tspr.shade = -127;
|
||||
return false;
|
||||
}
|
||||
|
||||
override void Initialize()
|
||||
{
|
||||
let owner = self.ownerActor;
|
||||
if (owner != self)
|
||||
{
|
||||
self.Angle = owner.Angle;
|
||||
self.cstat = CSTAT_SPRITE_YCENTER | randomXFlip();
|
||||
double c,f;
|
||||
[c, f] = self.sector.getSlopes(self.pos.XY);
|
||||
self.pos.Z = min(self.pos.Z, f - 12);
|
||||
}
|
||||
self.shade = -64;
|
||||
self.scale = (0.5, 0.5);
|
||||
self.ChangeStat(STAT_MISC);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------
|
||||
//
|
||||
//
|
||||
|
|
34
wadsrc/static/zscript/games/duke/actors/waterbubble.zs
Normal file
34
wadsrc/static/zscript/games/duke/actors/waterbubble.zs
Normal file
|
@ -0,0 +1,34 @@
|
|||
class DukeWaterBubble : DukeActor
|
||||
{
|
||||
default
|
||||
{
|
||||
pic "WATERBUBBLE";
|
||||
}
|
||||
|
||||
override void Initialize()
|
||||
{
|
||||
let owner = self.ownerActor;
|
||||
if (owner && owner.isPlayer())
|
||||
self.pos.Z -= 16;
|
||||
if (owner != self)
|
||||
self.angle = owner.angle;
|
||||
|
||||
self.scale = (0.0625, 0.0625);
|
||||
self.ChangeStat(STAT_MISC);
|
||||
}
|
||||
|
||||
override bool animate(tspritetype t)
|
||||
{
|
||||
if (dlevel.floorsurface(t.sector) == Duke.TSURF_SLIME)
|
||||
{
|
||||
t.pal = 7;
|
||||
}
|
||||
else
|
||||
{
|
||||
t.copyfloorpal(t.sector);
|
||||
}
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -343,6 +343,7 @@ struct tspritetype native
|
|||
|
||||
native void setSpritePic(CoreActor actor, int index); // index into actor's spriteset.
|
||||
native void setWeaponOrAmmoSprite(int num);
|
||||
native void copyfloorpal(sectortype sect);
|
||||
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue