diff --git a/source/games/duke/src/actors.cpp b/source/games/duke/src/actors.cpp index 8e153bb55..77b757e92 100644 --- a/source/games/duke/src/actors.cpp +++ b/source/games/duke/src/actors.cpp @@ -681,36 +681,6 @@ void rpgexplode(DDukeActor *actor, int hit, const DVector3 &pos, int EXPLOSION2, // //--------------------------------------------------------------------------- -bool rat(DDukeActor* actor, bool makesound) -{ - makeitfall(actor); - if (ssp(actor, CLIPMASK0)) - { - if (makesound && (krand() & 255) == 0) S_PlayActorSound(RATTY, actor); - actor->spr.Angles.Yaw += mapangle((krand() & 31) - 15 + int(BobVal(actor->temp_data[0] << 8) * 8)); - } - else - { - actor->temp_data[0]++; - if (actor->temp_data[0] > 1) - { - actor->Destroy(); - return false; - } - else actor->spr.Angles.Yaw = randomAngle(); - } - if (actor->vel.X < 8) - actor->vel.X += 1/8.; - actor->spr.Angles.Yaw += mapangle((krand() & 3) - 6); - return true; -} - -//--------------------------------------------------------------------------- -// -// -// -//--------------------------------------------------------------------------- - bool queball(DDukeActor *actor, int pocket, int queball, int stripeball) { if(actor->vel.X != 0) diff --git a/source/games/duke/src/actors_d.cpp b/source/games/duke/src/actors_d.cpp index af8bb1273..8932dd8c5 100644 --- a/source/games/duke/src/actors_d.cpp +++ b/source/games/duke/src/actors_d.cpp @@ -2305,9 +2305,6 @@ void moveactors_d(void) spawn(act, EXPLOSION2); ssp(act, CLIPMASK0); break; - case RAT: - if (!rat(act, true)) continue; - break; case QUEBALL: case STRIPEBALL: if (!queball(act, POCKET, QUEBALL, STRIPEBALL)) continue; diff --git a/source/games/duke/src/actors_r.cpp b/source/games/duke/src/actors_r.cpp index 50d0221ec..9d738954e 100644 --- a/source/games/duke/src/actors_r.cpp +++ b/source/games/duke/src/actors_r.cpp @@ -2037,9 +2037,6 @@ void moveactors_r(void) } else switch(act->spr.picnum) { - case RAT: - if (!rat(act, !isRRRA())) continue; - break; case BOWLINGBALL: if (act->vel.X != 0) { diff --git a/source/games/duke/src/animatesprites_d.cpp b/source/games/duke/src/animatesprites_d.cpp index 8e798577d..7854a732e 100644 --- a/source/games/duke/src/animatesprites_d.cpp +++ b/source/games/duke/src/animatesprites_d.cpp @@ -649,22 +649,6 @@ void animatesprites_d(tspriteArray& tsprites, const DVector2& viewVec, DAngle vi } break; - case RAT: - if (hw_models && modelManager.CheckModel(h->spr.picnum, h->spr.pal)) - { - t->cstat &= ~CSTAT_SPRITE_XFLIP; - break; - } - - k = angletorotation1(t->Angles.Yaw, viewang); - if (k > 4) - { - k = 8 - k; - t->cstat |= CSTAT_SPRITE_XFLIP; - } - else t->cstat &= ~CSTAT_SPRITE_XFLIP; - t->picnum = h->spr.picnum + k; - break; } h->dispicnum = t->picnum; diff --git a/source/games/duke/src/animatesprites_r.cpp b/source/games/duke/src/animatesprites_r.cpp index 402131ca8..5610ba3c5 100644 --- a/source/games/duke/src/animatesprites_r.cpp +++ b/source/games/duke/src/animatesprites_r.cpp @@ -846,16 +846,6 @@ void animatesprites_r(tspriteArray& tsprites, const DVector2& viewVec, DAngle vi } break; - case RAT: - k = angletorotation1(t->Angles.Yaw, viewang); - if (k > 4) - { - k = 8 - k; - t->cstat |= CSTAT_SPRITE_XFLIP; - } - else t->cstat &= ~CSTAT_SPRITE_XFLIP; - t->picnum = h->spr.picnum + k; - break; } h->dispicnum = t->picnum; diff --git a/source/games/duke/src/funct.h b/source/games/duke/src/funct.h index 198c47a2a..bd6ddd5c1 100644 --- a/source/games/duke/src/funct.h +++ b/source/games/duke/src/funct.h @@ -41,7 +41,6 @@ void bounce(DDukeActor* i); void rpgexplode(DDukeActor* i, int j, const DVector3& pos, int EXPLOSION2, int EXPLOSIONBOT2, int newextra, int playsound); void lotsofstuff(DDukeActor* s, int n, int spawntype); bool respawnmarker(DDukeActor* i, int yellow, int green); -bool rat(DDukeActor* i, bool makesound); bool queball(DDukeActor* i, int pocket, int queball, int stripeball); void forcesphere(DDukeActor* i, int forcesphere); void recon(DDukeActor* i, int explosion, int firelaser, int attacksnd, int painsnd, int roamsnd, int shift, int (*getspawn)(DDukeActor* i)); diff --git a/source/games/duke/src/spawn_d.cpp b/source/games/duke/src/spawn_d.cpp index f10da68f8..f959ca4fa 100644 --- a/source/games/duke/src/spawn_d.cpp +++ b/source/games/duke/src/spawn_d.cpp @@ -627,7 +627,6 @@ DDukeActor* spawninit_d(DDukeActor* actj, DDukeActor* act, TArray* case LIZMANFEEDING: case LIZMANJUMP: case ORGANTIC: - case RAT: case SHARK: if (act->spr.pal == 0) @@ -688,19 +687,9 @@ DDukeActor* spawninit_d(DDukeActor* actj, DDukeActor* act, TArray* { makeitfall(act); - if (act->spr.picnum == RAT) - { - act->spr.Angles.Yaw = randomAngle(); - act->spr.scale = DVector2(0.75, 0.75); - act->spr.cstat = 0; - } - else - { - act->spr.cstat |= CSTAT_SPRITE_BLOCK_ALL; - - if (act->spr.picnum != SHARK) - ps[myconnectindex].max_actors_killed++; - } + act->spr.cstat |= CSTAT_SPRITE_BLOCK_ALL; + if (act->spr.picnum != SHARK) + ps[myconnectindex].max_actors_killed++; if (act->spr.picnum == ORGANTIC) act->spr.cstat |= CSTAT_SPRITE_YCENTER; diff --git a/source/games/duke/src/spawn_r.cpp b/source/games/duke/src/spawn_r.cpp index ca385d9fa..d8f7b5592 100644 --- a/source/games/duke/src/spawn_r.cpp +++ b/source/games/duke/src/spawn_r.cpp @@ -510,7 +510,6 @@ DDukeActor* spawninit_r(DDukeActor* actj, DDukeActor* act, TArray* [[fallthrough]]; case BOULDER: case BOULDER1: - case RAT: case TORNADO: case BILLYCOCK: case BILLYRAY: @@ -726,20 +725,11 @@ DDukeActor* spawninit_r(DDukeActor* actj, DDukeActor* act, TArray* { makeitfall(act); - if (act->spr.picnum == RAT) - { - act->spr.Angles.Yaw = randomAngle(); - act->spr.scale = DVector2(0.75, 0.75); - act->spr.cstat = 0; - } - else - { - act->spr.cstat |= CSTAT_SPRITE_BLOCK_ALL; + act->spr.cstat |= CSTAT_SPRITE_BLOCK_ALL; - if (act->spr.picnum != 5501) - if (actorfella(act)) - ps[myconnectindex].max_actors_killed++; - } + if (act->spr.picnum != 5501) + if (actorfella(act)) + ps[myconnectindex].max_actors_killed++; if (actj) { diff --git a/wadsrc/static/filter/dukelike/engine/engine.def b/wadsrc/static/filter/dukelike/engine/engine.def index 4e2abba80..5c63ee7b1 100644 --- a/wadsrc/static/filter/dukelike/engine/engine.def +++ b/wadsrc/static/filter/dukelike/engine/engine.def @@ -43,6 +43,7 @@ spawnclasses 624 = DukeCamera 625 = DukeCamera 3190 = DukeRespawnmarker + 1267 = DukeRat 1272 = DukeTrash 634 = DukeBolt1 diff --git a/wadsrc/static/filter/redneck/engine/engine.def b/wadsrc/static/filter/redneck/engine/engine.def index 2041c6f03..6c84427ab 100644 --- a/wadsrc/static/filter/redneck/engine/engine.def +++ b/wadsrc/static/filter/redneck/engine/engine.def @@ -49,6 +49,7 @@ spawnclasses 1439 = DukeInnerJaw 1440 = DukeInnerJaw1 866 = RedneckRespawnMarker + 1344 = DukeRat 285 = RedneckChickenSpawner1 286 = RedneckChickenSpawner2 diff --git a/wadsrc/static/zscript.txt b/wadsrc/static/zscript.txt index f4168dda2..db942bacb 100644 --- a/wadsrc/static/zscript.txt +++ b/wadsrc/static/zscript.txt @@ -58,6 +58,7 @@ version "4.10" #include "zscript/games/duke/actors/respawncontroller.zs" #include "zscript/games/duke/actors/respawnmarker.zs" +#include "zscript/games/duke/actors/rat.zs" #include "zscript/games/duke/actors/jibs.zs" #include "zscript/games/duke/actors/crane.zs" #include "zscript/games/duke/actors/waterfountain.zs" diff --git a/wadsrc/static/zscript/games/duke/actors/rat.zs b/wadsrc/static/zscript/games/duke/actors/rat.zs new file mode 100644 index 000000000..3aa833564 --- /dev/null +++ b/wadsrc/static/zscript/games/duke/actors/rat.zs @@ -0,0 +1,61 @@ + + +class DukeRat : DukeActor +{ + default + { + pic "RAT"; + clipdist 10; + scaleX 0.75; + scaleY 0.75; + } + + override void Initialize() + { + if (ownerActor) self.lotag = 0; + + if ((self.lotag > ud.player_skill) || ud.monsters_off == 1) + { + self.scale = (0, 0); + self.ChangeStat(STAT_MISC); + } + else + { + self.makeitfall(); + self.angle = frandom(0, 360); + self.cstat = 0; + + if (self.ownerActor) + { + self.timetosleep = 0; + self.ChangeStat(STAT_ACTOR); + if (Raze.isRR()) self.shade = self.ownerActor.shade; + } + else self.ChangeStat(STAT_ZOMBIEACTOR); + + } + } + + override void Tick() + { + self.makeitfall(); + if (self.DoMove(CLIPMASK0)) + { + if (!Raze.isRRRA() && random(0, 255) == 0) self.PlayActorSound("RATTY"); + self.angle += Raze.BAngToDegree * (random(-15, 15) + Raze.BobVal(self.temp_data[0] << 8) * 8); + } + else + { + self.temp_data[0]++; + if (self.temp_data[0] > 1) + { + self.Destroy(); + return; + } + else self.angle = frandom(0, 360); + } + if (self.vel.X < 8) + self.vel.X += 1/8.; + self.angle += Raze.BAngToDegree * (random(0, 3) - 6); + } +}