Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
- scriptified the jibs
  • Loading branch information
coelckers authored and mjr4077au committed Nov 26, 2022
1 parent a047de5 commit fdf7360
Show file tree
Hide file tree
Showing 19 changed files with 616 additions and 350 deletions.
8 changes: 6 additions & 2 deletions source/core/thingdef_properties.cpp
Expand Up @@ -305,13 +305,17 @@ static bool PointerCheck(PType *symtype, PType *checktype)

//==========================================================================
//
// Unlike 'spriteset' this only replaces the first image so that it
// can reuse the previously defined set, except for the base image.
//
//==========================================================================
DEFINE_PROPERTY(pic, S, CoreActor)
{
PROP_STRING_PARM(str, 0);
info->ActorInfo()->SpriteSetNames.Clear();
info->ActorInfo()->SpriteSetNames.Push(str);
if (info->ActorInfo()->SpriteSetNames.Size() == 0)
info->ActorInfo()->SpriteSetNames.Push(str);
else
info->ActorInfo()->SpriteSetNames[0] = str;
bag.Info->ActorInfo()->DefaultFlags |= DEFF_PICNUM;
}

Expand Down
19 changes: 19 additions & 0 deletions source/core/vmexports.cpp
Expand Up @@ -379,6 +379,25 @@ DEFINE_ACTION_FUNCTION_NATIVE(_sectortype, ceilingslope, sector_ceilingslope)
ACTION_RETURN_INT(self->getceilingslope());
}

double sector_getslopes(sectortype* sect, double x, double y, double *pf)
{
if (!sect) ThrowAbortException(X_READ_NIL, nullptr);
double pc;
calcSlope(sect, x, y, &pc, pf);
return pc;
}

DEFINE_ACTION_FUNCTION_NATIVE(_sectortype, getslopes, sector_getslopes)
{
PARAM_SELF_STRUCT_PROLOGUE(sectortype);
PARAM_FLOAT(x);
PARAM_FLOAT(y);
double c, f;
calcSlope(self, x, y, &c, &f);
if (numret > 0) ret[0].SetFloat(c);
if (numret > 1) ret[1].SetFloat(f);
return min(numret, 2);
}

//=============================================================================

Expand Down
128 changes: 0 additions & 128 deletions source/games/duke/src/actors.cpp
Expand Up @@ -1410,134 +1410,6 @@ bool money(DDukeActor* actor, int BLOODPOOL)
//
//---------------------------------------------------------------------------

bool jibs(DDukeActor *actor, int JIBS6, bool timeout, bool callsetsprite, bool floorcheck, bool zcheck1, bool zcheck2)
{
auto sectp = actor->sector();

if(actor->vel.X > 0) actor->vel.X -= 1/16.;
else actor->vel.X = 0;

if (timeout)
{
if (actor->temp_data[5] < 30 * 10)
actor->temp_data[5]++;
else
{
actor->Destroy();
return false;
}
}

if (actor->vel.Z > 4 && actor->vel.Z < 5)
{
SetActor(actor, actor->spr.pos);
sectp = actor->sector();
}

if (callsetsprite) SetActor(actor, actor->spr.pos);

// this was after the slope calls, but we should avoid calling that for invalid sectors.
if (!actor->insector())
{
actor->Destroy();
return false;
}

double fz = getflorzofslopeptr(sectp, actor->spr.pos);
double cz = getceilzofslopeptr(sectp, actor->spr.pos);
if (cz == fz)
{
actor->Destroy();
return false;
}

if (actor->spr.pos.Z < fz - 2)
{
if (actor->temp_data[1] < 2) actor->temp_data[1]++;
else if (sectp->lotag != 2)
{
actor->temp_data[1] = 0;
if (zcheck1)
{
if (actor->temp_data[0] > 6) actor->temp_data[0] = 0;
else actor->temp_data[0]++;
}
else
{
if (actor->temp_data[0] > 2)
actor->temp_data[0] = 0;
else actor->temp_data[0]++;
}
}

if (actor->vel.Z < 24)
{
if (sectp->lotag == 2)
{
if (actor->vel.Z < 4)
actor->vel.Z += 3 / 16.;
else actor->vel.Z = 4;
}
else actor->vel.Z += ( gs.gravity - 50/256.);
}

actor->spr.pos += actor->spr.Angles.Yaw.ToVector() * actor->vel.X;
actor->spr.pos.Z += actor->vel.Z;

if (floorcheck && actor->spr.pos.Z >= actor->sector()->floorz)
{
actor->Destroy();
return false;
}
}
else
{
if (zcheck2)
{
actor->Destroy();
return false;
}
if (actor->temp_data[2] == 0)
{
if (!actor->insector())
{
actor->Destroy();
return false;
}
if ((actor->sector()->floorstat & CSTAT_SECTOR_SLOPE))
{
actor->Destroy();
return false;
}
actor->temp_data[2]++;
}
double ll = getflorzofslopeptr(actor->sector(), actor->spr.pos);

actor->spr.pos.Z = ll - 2;
actor->vel.X = 0;

if (actor->spr.picnum == JIBS6)
{
actor->temp_data[1]++;
if ((actor->temp_data[1] & 3) == 0 && actor->temp_data[0] < 7)
actor->temp_data[0]++;
if (actor->temp_data[1] > 20)
{
actor->Destroy();
return false;
}
}
else { actor->spr.picnum = JIBS6; actor->temp_data[0] = 0; actor->temp_data[1] = 0; }
}
return true;
}

//---------------------------------------------------------------------------
//
//
//
//---------------------------------------------------------------------------

bool bloodpool(DDukeActor* actor, bool puke)
{
auto sectp = actor->sector();
Expand Down
18 changes: 0 additions & 18 deletions source/games/duke/src/actors_d.cpp
Expand Up @@ -2576,24 +2576,6 @@ void moveexplosions_d(void) // STATNUM 5
money(act, BLOODPOOL);
break;

case JIBS1:
case JIBS2:
case JIBS3:
case JIBS4:
case JIBS5:
case JIBS6:
case HEADJIB1:
case ARMJIB1:
case LEGJIB1:
case LIZMANHEAD1:
case LIZMANARM1:
case LIZMANLEG1:
case DUKETORSO:
case DUKEGUN:
case DUKELEG:
jibs(act, JIBS6, true, false, false, act->spr.picnum == DUKELEG || act->spr.picnum == DUKETORSO || act->spr.picnum == DUKEGUN, false);

continue;
case BLOODPOOL:
case PUKE:
bloodpool(act, act->spr.picnum == PUKE);
Expand Down
52 changes: 0 additions & 52 deletions source/games/duke/src/actors_r.cpp
Expand Up @@ -2536,58 +2536,6 @@ void moveexplosions_r(void) // STATNUM 5

break;

case BIKEJIBA:
case BIKEJIBB:
case BIKEJIBC:
case BIKERJIBA:
case BIKERJIBB:
case BIKERJIBC:
case BIKERJIBD:
case CHEERJIBA:
case CHEERJIBB:
case CHEERJIBC:
case CHEERJIBD:
case FBOATJIBA:
case FBOATJIBB:
case RABBITJIBA:
case RABBITJIBB:
case RABBITJIBC:
case MAMAJIBA:
case MAMAJIBB:
if (!isRRRA()) break;
[[fallthrough]];

case BILLYJIBA:
case BILLYJIBB:
case HULKJIBA:
case HULKJIBB:
case HULKJIBC:
case MINJIBA:
case MINJIBB:
case MINJIBC:
case COOTJIBA:
case COOTJIBB:
case COOTJIBC:
case JIBS1:
case JIBS2:
case JIBS3:
case JIBS4:
case JIBS5:
case JIBS6:
case DUKETORSO:
case DUKEGUN:
case DUKELEG:
if (!jibs(act, JIBS6, false, true, true, act->spr.picnum == DUKELEG || act->spr.picnum == DUKETORSO || act->spr.picnum == DUKEGUN, false)) continue;

if (act->sector()->lotag == 800)
if (act->spr.pos.Z >= act->sector()->floorz - 8)
{
act->Destroy();
continue;
}

continue;

case BLOODPOOL:
if (!bloodpool(act, false)) continue;

Expand Down
18 changes: 0 additions & 18 deletions source/games/duke/src/animatesprites_d.cpp
Expand Up @@ -421,24 +421,6 @@ void animatesprites_d(tspriteArray& tsprites, const DVector2& viewVec, DAngle vi

break;

case JIBS1:
case JIBS2:
case JIBS3:
case JIBS4:
case JIBS5:
case JIBS6:
case HEADJIB1:
case LEGJIB1:
case ARMJIB1:
case LIZMANHEAD1:
case LIZMANARM1:
case LIZMANLEG1:
case DUKELEG:
case DUKEGUN:
case DUKETORSO:
if (t->pal == 6) t->shade = -120;
[[fallthrough]];

case WATERBUBBLE:
if (t->sectp->floorpicnum == FLOORSLIME)
{
Expand Down
51 changes: 0 additions & 51 deletions source/games/duke/src/animatesprites_r.cpp
Expand Up @@ -526,57 +526,6 @@ void animatesprites_r(tspriteArray& tsprites, const DVector2& viewVec, DAngle vi

break;

case BIKEJIBA:
case BIKEJIBB:
case BIKEJIBC:
case BIKERJIBA:
case BIKERJIBB:
case BIKERJIBC:
case BIKERJIBD:
case CHEERJIBA:
case CHEERJIBB:
case CHEERJIBC:
case CHEERJIBD:
case FBOATJIBA:
case FBOATJIBB:
case RABBITJIBA:
case RABBITJIBB:
case RABBITJIBC:
case MAMAJIBA:
case MAMAJIBB:
if (isRRRA()) goto stuff;
else goto default_case;

case MINJIBA:
case MINJIBB:
case MINJIBC:
if (isRRRA() && t->pal == 19)
t->shade = -127;
[[fallthrough]];
case JIBS1:
case JIBS2:
case JIBS3:
case JIBS4:
case JIBS5:
case JIBS6:
case DUKEGUN:
case DUKETORSO:
case DUKELEG:
case BILLYJIBA:
case BILLYJIBB:
case HULKJIBA:
case HULKJIBB:
case HULKJIBC:
case COOTJIBA:
case COOTJIBB:
case COOTJIBC:
stuff:
if (t->pal == 6) t->shade = -120;

if (h->sector()->shadedsector == 1)
t->shade = 16;
[[fallthrough]];

case WATERBUBBLE:
if (t->sectp->floorpicnum == FLOORSLIME)
{
Expand Down
1 change: 0 additions & 1 deletion source/games/duke/src/funct.h
Expand Up @@ -52,7 +52,6 @@ void forcesphereexplode(DDukeActor* i);
void watersplash2(DDukeActor* i);
void frameeffect1(DDukeActor* i);
bool money(DDukeActor* i, int BLOODPOOL);
bool jibs(DDukeActor* i, int JIBS6, bool timeout, bool callsetsprite, bool floorcheck, bool zcheck1, bool zcheck2);
bool bloodpool(DDukeActor* i, bool puke);
void shell(DDukeActor* i, bool morecheck);
void glasspieces(DDukeActor* i);
Expand Down
24 changes: 0 additions & 24 deletions source/games/duke/src/spawn_d.cpp
Expand Up @@ -187,32 +187,8 @@ DDukeActor* spawninit_d(DDukeActor* actj, DDukeActor* act, TArray<DDukeActor*>*
case NUKEBUTTON:
if (act->spr.picnum == DOMELITE)
act->spr.cstat |= CSTAT_SPRITE_BLOCK_ALL;
[[fallthrough]];
case JIBS1:
case JIBS2:
case JIBS3:
case JIBS4:
case JIBS5:
case JIBS6:
case HEADJIB1:
case ARMJIB1:
case LEGJIB1:
case LIZMANHEAD1:
case LIZMANARM1:
case LIZMANLEG1:
case DUKETORSO:
case DUKEGUN:
case DUKELEG:
ChangeActorStat(act, STAT_MISC);
break;
case TONGUE:
if (actj)
act->spr.Angles.Yaw = actj->spr.Angles.Yaw;
act->spr.pos.Z -= gs.playerheight;
act->vel.Z = 1 - krandf(2);
act->vel.X = 4 - krandf(8);
ChangeActorStat(act, STAT_PROJECTILE);
break;
case NATURALLIGHTNING:
act->spr.cstat &= ~CSTAT_SPRITE_BLOCK_ALL;
act->spr.cstat |= CSTAT_SPRITE_INVISIBLE;
Expand Down

0 comments on commit fdf7360

Please sign in to comment.