mirror of
https://github.com/DrBeef/Raze.git
synced 2025-03-21 17:00:52 +00:00
- scriptified the rat.
This commit is contained in:
parent
99413651b3
commit
f138798e26
12 changed files with 71 additions and 91 deletions
|
@ -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)
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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)
|
||||
{
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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));
|
||||
|
|
|
@ -627,7 +627,6 @@ DDukeActor* spawninit_d(DDukeActor* actj, DDukeActor* act, TArray<DDukeActor*>*
|
|||
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<DDukeActor*>*
|
|||
{
|
||||
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;
|
||||
|
||||
|
|
|
@ -510,7 +510,6 @@ DDukeActor* spawninit_r(DDukeActor* actj, DDukeActor* act, TArray<DDukeActor*>*
|
|||
[[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<DDukeActor*>*
|
|||
{
|
||||
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)
|
||||
{
|
||||
|
|
|
@ -43,6 +43,7 @@ spawnclasses
|
|||
624 = DukeCamera
|
||||
625 = DukeCamera
|
||||
3190 = DukeRespawnmarker
|
||||
1267 = DukeRat
|
||||
|
||||
1272 = DukeTrash
|
||||
634 = DukeBolt1
|
||||
|
|
|
@ -49,6 +49,7 @@ spawnclasses
|
|||
1439 = DukeInnerJaw
|
||||
1440 = DukeInnerJaw1
|
||||
866 = RedneckRespawnMarker
|
||||
1344 = DukeRat
|
||||
|
||||
285 = RedneckChickenSpawner1
|
||||
286 = RedneckChickenSpawner2
|
||||
|
|
|
@ -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"
|
||||
|
|
61
wadsrc/static/zscript/games/duke/actors/rat.zs
Normal file
61
wadsrc/static/zscript/games/duke/actors/rat.zs
Normal file
|
@ -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);
|
||||
}
|
||||
}
|
Loading…
Reference in a new issue