mirror of
https://github.com/ZDoom/Raze.git
synced 2024-11-15 00:42:08 +00:00
- scriptified Dukes water fountain.
That's this thingy in the first corridor of E2L1.
This commit is contained in:
parent
ef6c39ec55
commit
190fd1827e
15 changed files with 130 additions and 91 deletions
|
@ -620,39 +620,6 @@ void movefx(void)
|
|||
//
|
||||
//---------------------------------------------------------------------------
|
||||
|
||||
void movefountain(DDukeActor *actor, int fountain)
|
||||
{
|
||||
if (actor->temp_data[0] > 0)
|
||||
{
|
||||
if (actor->temp_data[0] < 20)
|
||||
{
|
||||
actor->temp_data[0]++;
|
||||
|
||||
actor->spr.picnum++;
|
||||
|
||||
if (actor->spr.picnum == fountain + 3)
|
||||
actor->spr.picnum = fountain + 1;
|
||||
}
|
||||
else
|
||||
{
|
||||
double x;
|
||||
findplayer(actor, &x);
|
||||
|
||||
if (x > 32)
|
||||
{
|
||||
actor->temp_data[0] = 0;
|
||||
actor->spr.picnum = fountain;
|
||||
}
|
||||
else actor->temp_data[0] = 1;
|
||||
}
|
||||
}
|
||||
}
|
||||
//---------------------------------------------------------------------------
|
||||
//
|
||||
//
|
||||
//
|
||||
//---------------------------------------------------------------------------
|
||||
|
||||
void moveflammable(DDukeActor* actor, int pool)
|
||||
{
|
||||
double scale;
|
||||
|
|
|
@ -1187,10 +1187,6 @@ void movestandables_d(void)
|
|||
CallTick(act);
|
||||
continue;
|
||||
}
|
||||
else if (picnum >= WATERFOUNTAIN && picnum <= WATERFOUNTAIN + 3)
|
||||
{
|
||||
movefountain(act, WATERFOUNTAIN);
|
||||
}
|
||||
|
||||
else if (AFLAMABLE(picnum))
|
||||
{
|
||||
|
|
|
@ -826,11 +826,6 @@ void movestandables_r(void)
|
|||
continue;
|
||||
}
|
||||
|
||||
else if (picnum >= WATERFOUNTAIN && picnum <= WATERFOUNTAIN + 3)
|
||||
{
|
||||
movefountain(act, WATERFOUNTAIN);
|
||||
}
|
||||
|
||||
else if (AFLAMABLE(picnum))
|
||||
{
|
||||
moveflammable(act, BLOODPOOL);
|
||||
|
|
|
@ -32,7 +32,6 @@ void movefta();
|
|||
void clearcameras(int i, player_struct* p);
|
||||
void RANDOMSCRAP(DDukeActor* i);
|
||||
void movecrane(DDukeActor* i, int crane);
|
||||
void movefountain(DDukeActor* i, int fountain);
|
||||
void moveflammable(DDukeActor* i, int pool);
|
||||
void detonate(DDukeActor* i, int explosion);
|
||||
void movemasterswitch(DDukeActor* i);
|
||||
|
|
|
@ -152,6 +152,9 @@ x(CHAIR2, 557)
|
|||
x(BROKENCHAIR, 559)
|
||||
x(MIRROR, 560)
|
||||
x(WATERFOUNTAIN, 563)
|
||||
x(WATERFOUNTAIN1, 564)
|
||||
x(WATERFOUNTAIN2, 565)
|
||||
x(WATERFOUNTAIN3, 566)
|
||||
x(WATERFOUNTAINBROKE, 567)
|
||||
x(FEMMAG1, 568)
|
||||
x(TOILET, 569)
|
||||
|
|
|
@ -277,6 +277,9 @@ x(CHAIR2, 1086)
|
|||
x(BROKENCHAIR, 1088)
|
||||
x(MIRROR, 1089)
|
||||
x(WATERFOUNTAIN, 1092)
|
||||
x(WATERFOUNTAIN1, 1093)
|
||||
x(WATERFOUNTAIN2, 1094)
|
||||
x(WATERFOUNTAIN3, 1095)
|
||||
x(WATERFOUNTAINBROKE, 1096)
|
||||
x(FEMMAG1, 1097)
|
||||
x(TOILET, 1098)
|
||||
|
|
|
@ -1122,13 +1122,6 @@ void checkhitsprite_d(DDukeActor* targ, DDukeActor* proj)
|
|||
S_PlayActorSound(GLASS_HEAVYBREAK, targ);
|
||||
for (j = 0; j < 16; j++) RANDOMSCRAP(targ);
|
||||
|
||||
break;
|
||||
case WATERFOUNTAIN:
|
||||
case WATERFOUNTAIN + 1:
|
||||
case WATERFOUNTAIN + 2:
|
||||
case WATERFOUNTAIN + 3:
|
||||
targ->spr.picnum = WATERFOUNTAINBROKE;
|
||||
spawn(targ, TOILETWATER);
|
||||
break;
|
||||
case SATELITE:
|
||||
case FUELPOD:
|
||||
|
@ -1166,7 +1159,6 @@ void checkhitsprite_d(DDukeActor* targ, DDukeActor* proj)
|
|||
case BOTTLE17:
|
||||
case BOTTLE18:
|
||||
case BOTTLE19:
|
||||
case WATERFOUNTAINBROKE:
|
||||
case DOMELITE:
|
||||
case SUSHIPLATE1:
|
||||
case SUSHIPLATE2:
|
||||
|
@ -1709,19 +1701,6 @@ void checksectors_d(int snum)
|
|||
}
|
||||
return;
|
||||
}
|
||||
case WATERFOUNTAIN:
|
||||
if (neartagsprite->temp_data[0] != 1)
|
||||
{
|
||||
neartagsprite->temp_data[0] = 1;
|
||||
neartagsprite->SetOwner(p->GetActor());
|
||||
|
||||
if (p->GetActor()->spr.extra < gs.max_player_health)
|
||||
{
|
||||
p->GetActor()->spr.extra++;
|
||||
S_PlayActorSound(DUKE_DRINKING, p->GetActor());
|
||||
}
|
||||
}
|
||||
return;
|
||||
case PLUG:
|
||||
S_PlayActorSound(SHORT_CIRCUIT, pact);
|
||||
p->GetActor()->spr.extra -= 2 + (krand() & 3);
|
||||
|
|
|
@ -2151,12 +2151,6 @@ void checkhitsprite_r(DDukeActor* targ, DDukeActor* proj)
|
|||
S_PlayActorSound(GLASS_HEAVYBREAK, targ);
|
||||
for (j = 0; j < 16; j++) RANDOMSCRAP(targ);
|
||||
|
||||
break;
|
||||
case WATERFOUNTAIN:
|
||||
case WATERFOUNTAIN + 1:
|
||||
case WATERFOUNTAIN + 2:
|
||||
case WATERFOUNTAIN + 3:
|
||||
spawn(targ, TOILETWATER);
|
||||
break;
|
||||
case SATELITE:
|
||||
case FUELPOD:
|
||||
|
@ -2675,19 +2669,6 @@ void checksectors_r(int snum)
|
|||
else if (S_CheckActorSoundPlaying(pact, DUKE_GRUNT) == 0)
|
||||
S_PlayActorSound(DUKE_GRUNT, pact);
|
||||
return;
|
||||
case WATERFOUNTAIN:
|
||||
if (neartagsprite->temp_data[0] != 1)
|
||||
{
|
||||
neartagsprite->temp_data[0] = 1;
|
||||
neartagsprite->SetOwner(p->GetActor());
|
||||
|
||||
if (p->GetActor()->spr.extra < gs.max_player_health)
|
||||
{
|
||||
p->GetActor()->spr.extra++;
|
||||
S_PlayActorSound(DUKE_DRINKING, pact);
|
||||
}
|
||||
}
|
||||
return;
|
||||
case PLUG:
|
||||
S_PlayActorSound(SHORT_CIRCUIT, pact);
|
||||
p->GetActor()->spr.extra -= 2 + (krand() & 3);
|
||||
|
|
|
@ -1031,10 +1031,6 @@ DDukeActor* spawninit_d(DDukeActor* actj, DDukeActor* act, TArray<DDukeActor*>*
|
|||
}
|
||||
break;
|
||||
|
||||
case WATERFOUNTAIN:
|
||||
act->spr.lotag = 1;
|
||||
[[fallthrough]];
|
||||
|
||||
case TREE1:
|
||||
case TREE2:
|
||||
case TIRE:
|
||||
|
|
|
@ -1237,9 +1237,6 @@ DDukeActor* spawninit_r(DDukeActor* actj, DDukeActor* act, TArray<DDukeActor*>*
|
|||
}
|
||||
act->spr.shade = act->sector()->floorshade;
|
||||
break;
|
||||
case WATERFOUNTAIN:
|
||||
act->spr.lotag = 1;
|
||||
[[fallthrough]];
|
||||
case TREE1:
|
||||
case TREE2:
|
||||
case TIRE:
|
||||
|
|
|
@ -2,4 +2,10 @@ spawnclasses
|
|||
{
|
||||
1221 = DukeCranePole
|
||||
1222 = DukeCrane
|
||||
563 = DukeWaterFountain
|
||||
564 = DukeWaterFountain
|
||||
565 = DukeWaterFountain
|
||||
566 = DukeWaterFountain
|
||||
567 = DukeWaterFountainBroke
|
||||
|
||||
}
|
||||
|
|
|
@ -2,4 +2,9 @@ spawnclasses
|
|||
{
|
||||
1298 = DukeCranePole
|
||||
1299 = DukeCrane
|
||||
1092 = DukeWaterFountain
|
||||
1093 = DukeWaterFountain
|
||||
1094 = DukeWaterFountain
|
||||
1095 = DukeWaterFountain
|
||||
1096 = DukeWaterFountainBroke
|
||||
}
|
||||
|
|
|
@ -51,6 +51,7 @@ version "4.9"
|
|||
#include "zscript/games/duke/ui/cutscenes.zs"
|
||||
#include "zscript/games/duke/ui/menu.zs"
|
||||
#include "zscript/games/duke/actors/crane.zs"
|
||||
#include "zscript/games/duke/actors/waterfountain.zs"
|
||||
|
||||
#include "zscript/games/blood/bloodgame.zs"
|
||||
#include "zscript/games/blood/ui/menu.zs"
|
||||
|
|
111
wadsrc/static/zscript/games/duke/actors/waterfountain.zs
Normal file
111
wadsrc/static/zscript/games/duke/actors/waterfountain.zs
Normal file
|
@ -0,0 +1,111 @@
|
|||
|
||||
|
||||
|
||||
class DukeWaterFountain : DukeActor
|
||||
{
|
||||
default
|
||||
{
|
||||
spriteset "WATERFOUNTAIN", "WATERFOUNTAIN1", "WATERFOUNTAIN2", "WATERFOUNTAIN3", "WATERFOUNTAINBROKE";
|
||||
statnum STAT_STANDABLE;
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------
|
||||
//
|
||||
// RR implements this but the sprites are empty.
|
||||
//
|
||||
//---------------------------------------------------------------------------
|
||||
|
||||
override void Initialize()
|
||||
{
|
||||
self.setSpritePic(0);
|
||||
self.lotag = 1;
|
||||
self.cstat = CSTAT_SPRITE_BLOCK_ALL; // Make it hitable
|
||||
self.extra = 1;
|
||||
}
|
||||
|
||||
override void Tick()
|
||||
{
|
||||
if (self.temp_data[0] > 0 && self.spritesetindex < 4)
|
||||
{
|
||||
int frame = self.spritesetindex;
|
||||
if (self.temp_data[0] < 20)
|
||||
{
|
||||
self.temp_data[0]++;
|
||||
|
||||
frame++;
|
||||
|
||||
if (frame == 3)
|
||||
frame = 1;
|
||||
|
||||
self.setSpritePic(frame);
|
||||
}
|
||||
else
|
||||
{
|
||||
let p = self.findplayer();
|
||||
// this does not really work, but fixing this will probably draw complaints for not being authentic.
|
||||
if ((self.pos - p.actor.pos.plusZ(28)).Sum() > 32)
|
||||
{
|
||||
self.temp_data[0] = 0;
|
||||
self.setSpritePic(0);
|
||||
}
|
||||
else self.temp_data[0] = 1;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
override void onHit(DukeActor hitter)
|
||||
{
|
||||
if (self.spritesetindex < 4)
|
||||
{
|
||||
self.setSpritePic(4);
|
||||
self.spawn("DukeToiletWater");
|
||||
}
|
||||
else
|
||||
{
|
||||
self.PlayActorSound(DukeSnd.GLASS_BREAKING);
|
||||
self.angle = FRandom(0., 360.);
|
||||
self.lotsofglass(8);
|
||||
self.Destroy();
|
||||
}
|
||||
}
|
||||
|
||||
override void onUse(DukePlayer user)
|
||||
{
|
||||
if (self.temp_data[0] != 1)
|
||||
{
|
||||
self.temp_data[0] = 1;
|
||||
let act = user.actor;
|
||||
self.ownerActor = act;
|
||||
|
||||
if (act.extra < gs.max_player_health)
|
||||
{
|
||||
act.extra++;
|
||||
act.PlayActorSound(DukeSnd.DUKE_DRINKING);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
//---------------------------------------------------------------------------
|
||||
//
|
||||
//
|
||||
//
|
||||
//---------------------------------------------------------------------------
|
||||
|
||||
class DukeWaterFountainBroke : DukeActor
|
||||
{
|
||||
default
|
||||
{
|
||||
pic "WATERFOUNTAINBROKE";
|
||||
statnum STAT_STANDABLE;
|
||||
}
|
||||
|
||||
override void onHit(DukeActor hitter)
|
||||
{
|
||||
self.PlayActorSound(DukeSnd.GLASS_BREAKING);
|
||||
self.angle = FRandom(0., 360.);
|
||||
self.lotsofglass(8);
|
||||
self.Destroy();
|
||||
}
|
||||
}
|
|
@ -83,7 +83,7 @@ class DukeActor : CoreActor native
|
|||
|
||||
extend struct _
|
||||
{
|
||||
native DukeGameInfo gs;
|
||||
native @DukeGameInfo gs;
|
||||
native DukeLevel dlevel;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue