diff --git a/source/games/duke/src/actors.cpp b/source/games/duke/src/actors.cpp index a946a3cf7..b27abb5ff 100644 --- a/source/games/duke/src/actors.cpp +++ b/source/games/duke/src/actors.cpp @@ -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; diff --git a/source/games/duke/src/actors_d.cpp b/source/games/duke/src/actors_d.cpp index e150e8c18..5c873b488 100644 --- a/source/games/duke/src/actors_d.cpp +++ b/source/games/duke/src/actors_d.cpp @@ -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)) { diff --git a/source/games/duke/src/actors_r.cpp b/source/games/duke/src/actors_r.cpp index 6a4521d9b..df021b82f 100644 --- a/source/games/duke/src/actors_r.cpp +++ b/source/games/duke/src/actors_r.cpp @@ -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); diff --git a/source/games/duke/src/funct.h b/source/games/duke/src/funct.h index 7b067b68c..67cb1df8e 100644 --- a/source/games/duke/src/funct.h +++ b/source/games/duke/src/funct.h @@ -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); diff --git a/source/games/duke/src/namelist_d.h b/source/games/duke/src/namelist_d.h index 7d816a3bf..961c82b5f 100644 --- a/source/games/duke/src/namelist_d.h +++ b/source/games/duke/src/namelist_d.h @@ -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) diff --git a/source/games/duke/src/namelist_r.h b/source/games/duke/src/namelist_r.h index 209e4216c..7e348242f 100644 --- a/source/games/duke/src/namelist_r.h +++ b/source/games/duke/src/namelist_r.h @@ -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) diff --git a/source/games/duke/src/sectors_d.cpp b/source/games/duke/src/sectors_d.cpp index 77e9b29c5..676ff5db5 100644 --- a/source/games/duke/src/sectors_d.cpp +++ b/source/games/duke/src/sectors_d.cpp @@ -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); diff --git a/source/games/duke/src/sectors_r.cpp b/source/games/duke/src/sectors_r.cpp index 4b0b9b29d..995160067 100644 --- a/source/games/duke/src/sectors_r.cpp +++ b/source/games/duke/src/sectors_r.cpp @@ -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); diff --git a/source/games/duke/src/spawn_d.cpp b/source/games/duke/src/spawn_d.cpp index 8272f2076..6d6cf817f 100644 --- a/source/games/duke/src/spawn_d.cpp +++ b/source/games/duke/src/spawn_d.cpp @@ -1031,10 +1031,6 @@ DDukeActor* spawninit_d(DDukeActor* actj, DDukeActor* act, TArray* } break; - case WATERFOUNTAIN: - act->spr.lotag = 1; - [[fallthrough]]; - case TREE1: case TREE2: case TIRE: diff --git a/source/games/duke/src/spawn_r.cpp b/source/games/duke/src/spawn_r.cpp index 75dd97d8d..45b101875 100644 --- a/source/games/duke/src/spawn_r.cpp +++ b/source/games/duke/src/spawn_r.cpp @@ -1237,9 +1237,6 @@ DDukeActor* spawninit_r(DDukeActor* actj, DDukeActor* act, TArray* } act->spr.shade = act->sector()->floorshade; break; - case WATERFOUNTAIN: - act->spr.lotag = 1; - [[fallthrough]]; case TREE1: case TREE2: case TIRE: diff --git a/wadsrc/static/filter/duke/engine/engine.def b/wadsrc/static/filter/duke/engine/engine.def index 84378fcd5..ae0aaf69c 100644 --- a/wadsrc/static/filter/duke/engine/engine.def +++ b/wadsrc/static/filter/duke/engine/engine.def @@ -2,4 +2,10 @@ spawnclasses { 1221 = DukeCranePole 1222 = DukeCrane + 563 = DukeWaterFountain + 564 = DukeWaterFountain + 565 = DukeWaterFountain + 566 = DukeWaterFountain + 567 = DukeWaterFountainBroke + } diff --git a/wadsrc/static/filter/redneck/engine/engine.def b/wadsrc/static/filter/redneck/engine/engine.def index 3ced7d61a..5afc46377 100644 --- a/wadsrc/static/filter/redneck/engine/engine.def +++ b/wadsrc/static/filter/redneck/engine/engine.def @@ -2,4 +2,9 @@ spawnclasses { 1298 = DukeCranePole 1299 = DukeCrane + 1092 = DukeWaterFountain + 1093 = DukeWaterFountain + 1094 = DukeWaterFountain + 1095 = DukeWaterFountain + 1096 = DukeWaterFountainBroke } diff --git a/wadsrc/static/zscript.txt b/wadsrc/static/zscript.txt index 245f1ef5a..accb3f2f6 100644 --- a/wadsrc/static/zscript.txt +++ b/wadsrc/static/zscript.txt @@ -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" diff --git a/wadsrc/static/zscript/games/duke/actors/waterfountain.zs b/wadsrc/static/zscript/games/duke/actors/waterfountain.zs new file mode 100644 index 000000000..1601da673 --- /dev/null +++ b/wadsrc/static/zscript/games/duke/actors/waterfountain.zs @@ -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(); + } +} diff --git a/wadsrc/static/zscript/games/duke/dukeactor.zs b/wadsrc/static/zscript/games/duke/dukeactor.zs index 96df6387a..47c593d06 100644 --- a/wadsrc/static/zscript/games/duke/dukeactor.zs +++ b/wadsrc/static/zscript/games/duke/dukeactor.zs @@ -83,7 +83,7 @@ class DukeActor : CoreActor native extend struct _ { - native DukeGameInfo gs; + native @DukeGameInfo gs; native DukeLevel dlevel; }