Skip to content

Commit

Permalink
- a lot of simple picnum or TILE_* replacements.
Browse files Browse the repository at this point in the history
  • Loading branch information
coelckers committed Mar 27, 2023
1 parent a6f9c27 commit a2bd09c
Show file tree
Hide file tree
Showing 13 changed files with 41 additions and 39 deletions.
2 changes: 1 addition & 1 deletion source/games/duke/src/actors_r.cpp
Expand Up @@ -553,7 +553,7 @@ void handle_se06_r(DDukeActor *actor)
ns->spr.pal = 7;
ns->spr.scale = DVector2(1.25, 3.984375);
}
ns = spawn(actor, 296);
ns = spawn(actor, RedneckTeleportClass);
if (ns)
{
ns->spr.cstat = 0;
Expand Down
9 changes: 9 additions & 0 deletions source/games/duke/src/classnames.h
Expand Up @@ -120,3 +120,12 @@ xx(RedneckRock)
xx(RedneckRock2)
xx(RedneckDestroyTags)
xx(RedneckDestructo)
xx(RedneckDynamite)
xx(RedneckWaterSurface)
xx(RedneckLadder)
xx(RedneckTeleport)
xx(RedneckRevolver)
xx(RedneckShotgun)
xx(RedneckRipsaw)
xx(RedneckBlaster)
xx(RedneckPowderKeg)
1 change: 0 additions & 1 deletion source/games/duke/src/dukeactor.h
Expand Up @@ -19,7 +19,6 @@ inline int player_struct::GetPlayerNum()
return actor->PlayerIndex();
}

DDukeActor* spawn(DDukeActor* spawner, int type);
DDukeActor* spawn(DDukeActor* spawner, PClassActor* pname);

inline int badguy(DDukeActor* pSprite)
Expand Down
6 changes: 3 additions & 3 deletions source/games/duke/src/gameexec.cpp
Expand Up @@ -1904,7 +1904,7 @@ int ParseState::parse(void)
case concmd_spawn:
insptr++;
if(g_ac->insector())
spawn(g_ac,*insptr);
spawn(g_ac, GetSpawnType(*insptr));
insptr++;
break;
case concmd_ifwasweapon:
Expand Down Expand Up @@ -2397,7 +2397,7 @@ int ParseState::parse(void)
lIn = *insptr++;
lIn = GetGameVarID(lIn, g_ac, g_p).safeValue();
if(g_ac->insector())
lReturn = spawn(g_ac, lIn);
lReturn = spawn(g_ac, GetSpawnType(lIn));

SetGameVarID(g_iReturnVarID, (lReturn), g_ac, g_p);
break;
Expand All @@ -2407,7 +2407,7 @@ int ParseState::parse(void)
DDukeActor* lReturn = nullptr;
insptr++;
if(g_ac->insector())
lReturn = spawn(g_ac, *insptr);
lReturn = spawn(g_ac, GetSpawnType(*insptr));
insptr++;
SetGameVarID(g_iReturnVarID, (lReturn), g_ac, g_p);
break;
Expand Down
2 changes: 1 addition & 1 deletion source/games/duke/src/player_d.cpp
Expand Up @@ -221,7 +221,7 @@ void selectweapon_d(int snum, int weap) // playernum, weaponnum
DukeStatIterator it(STAT_ACTOR);
while (auto act = it.Next())
{
if (act->spr.picnum == DTILE_HEAVYHBOMB && act->GetOwner() == p->GetActor())
if (act->GetClass() == DukePipeBombClass && act->GetOwner() == p->GetActor())
{
p->gotweapon[HANDBOMB_WEAPON] = true;
j = HANDREMOTE_WEAPON;
Expand Down
22 changes: 11 additions & 11 deletions source/games/duke/src/player_r.cpp
Expand Up @@ -194,7 +194,7 @@ void selectweapon_r(int snum, int weap)
DukeStatIterator it(STAT_ACTOR);
while (auto act = it.Next())
{
if (act->spr.picnum == RTILE_DYNAMITE && act->GetOwner() == p->GetActor())
if (act->GetClass() == RedneckDynamiteClass && act->GetOwner() == p->GetActor())
{
p->gotweapon[DYNAMITE_WEAPON] = true;
j = THROWINGDYNAMITE_WEAPON;
Expand Down Expand Up @@ -600,15 +600,15 @@ int doincrements_r(player_struct* p)

void checkweapons_r(player_struct* p)
{
static const uint16_t weapon_sprites[MAX_WEAPONS] = { RTILE_KNEE, RTILE_FIRSTGUNSPRITE, RTILE_SHOTGUNSPRITE,
RTILE_RIFLEGUNSPRITE, RTILE_DYNAMITE, RTILE_CROSSBOWSPRITE, RTILE_RIPSAWSPRITE, RTILE_ALIENBLASTERSPRITE,
RTILE_POWDERKEG, RTILE_BOWLINGBALLSPRITE, RTILE_TITSPRITE, RTILE_DYNAMITE };
static PClassActor* const* const weapon_sprites[MAX_WEAPONS] = { &DukeMeleeAttackClass, &RedneckRevolverClass, &RedneckShotgunClass,
&RedneckRiflegunClass, &RedneckDynamiteClass, &RedneckCrossbowClass, &RedneckRipsawClass, &RedneckBlasterClass,
&RedneckPowderKegClass, &RedneckBowlingBallClass, &RedneckTitgunClass, &RedneckDynamiteClass };

if (isRRRA())
{
if (p->OnMotorcycle && numplayers > 1)
{
auto j = spawn(p->GetActor(), 7220);
auto j = spawn(p->GetActor(), RedneckEmptyBikeClass);
if (j)
{
j->spr.Angles.Yaw = p->GetActor()->spr.Angles.Yaw;
Expand All @@ -627,7 +627,7 @@ void checkweapons_r(player_struct* p)
}
else if (p->OnBoat && numplayers > 1)
{
auto j = spawn(p->GetActor(), 7233);
auto j = spawn(p->GetActor(), RedneckEmptyBoatClass);
if (j)
{
j->spr.Angles.Yaw = p->GetActor()->spr.Angles.Yaw;
Expand All @@ -649,7 +649,7 @@ void checkweapons_r(player_struct* p)
if (p->curr_weapon > 0)
{
if (krand() & 1)
spawn(p->GetActor(), weapon_sprites[p->curr_weapon]);
spawn(p->GetActor(), *weapon_sprites[p->curr_weapon]);
else switch (p->curr_weapon)
{
case CHICKEN_WEAPON:
Expand Down Expand Up @@ -1951,7 +1951,7 @@ static void operateweapon(int snum, ESyncBits actions, sectortype* psectp)

if ((p->kickback_pic % 3) == 0)
{
auto j = spawn(pact, RTILE_SHELL);
auto j = spawn(pact, DukeShellClass);
if (j)
{

Expand Down Expand Up @@ -2350,7 +2350,7 @@ void processinput_r(int snum)
DukeSectIterator it(psectp);
while (auto act2 = it.Next())
{
if (act2->spr.picnum == RTILE_WATERSURFACE)
if (act2->GetClass() == RedneckWaterSurfaceClass)
if (act2->spr.pos.Z - 8 < p->GetActor()->getOffsetZ())
psectlotag = ST_2_UNDERWATER;
}
Expand Down Expand Up @@ -2399,7 +2399,7 @@ void processinput_r(int snum)
chz.setNone();
ceilingz = p->truecz;
}
else if (chz.actor()->spr.picnum == RTILE_LADDER)
else if (chz.actor()->GetClass() == RedneckLadderClass)
{
if (!p->stairs)
{
Expand Down Expand Up @@ -2444,7 +2444,7 @@ void processinput_r(int snum)
auto ang = (clz.actor()->spr.pos.XY() - p->GetActor()->spr.pos.XY()).Angle();
p->vel.XY() -= ang.ToVector();
}
if (clz.actor()->spr.picnum == RTILE_LADDER)
if (clz.actor()->GetClass() == RedneckLadderClass)
{
if (!p->stairs)
{
Expand Down
2 changes: 1 addition & 1 deletion source/games/duke/src/player_w.cpp
Expand Up @@ -111,7 +111,7 @@ void DoSpawn(player_struct *p, int snum)
if(!aplWeaponSpawn(p->curr_weapon, snum))
return;

auto j = spawn(p->GetActor(), aplWeaponSpawn(p->curr_weapon, snum));
auto j = spawn(p->GetActor(), GetSpawnType(aplWeaponSpawn(p->curr_weapon, snum)));
if (!j) return;

if((aplWeaponFlags(p->curr_weapon, snum) & WEAPON_FLAG_SPAWNTYPE2 ) )
Expand Down
3 changes: 1 addition & 2 deletions source/games/duke/src/sectors_d.cpp
Expand Up @@ -175,7 +175,6 @@ void checkhitdefault_d(DDukeActor* targ, DDukeActor* proj)

if ((targ->spr.picnum != DTILE_DRONE) && (targ->spr.picnum != DTILE_ROTATEGUN) && (targ->spr.picnum != DTILE_COMMANDER) && targ->spr.picnum != DTILE_GREENSLIME)
if (proj->spr.picnum != DTILE_FREEZEBLAST)
//if (actortype[targ->spr.picnum] == 0) //TRANSITIONAL.
{
auto spawned = spawn(proj, DukeJibs6Class);
if (spawned)
Expand Down Expand Up @@ -260,7 +259,7 @@ void checkhitdefault_d(DDukeActor* targ, DDukeActor* proj)
}
}

if (targ->spr.scale.X < 0.375 && proj->spr.picnum == DTILE_SHRINKSPARK)
if (targ->spr.scale.X < 0.375 && proj->GetClass() == DukeShrinkSparkClass)
return;

auto hitowner = targ->GetHitOwner();
Expand Down
3 changes: 1 addition & 2 deletions source/games/duke/src/sectors_r.cpp
Expand Up @@ -173,7 +173,6 @@ void checkhitdefault_r(DDukeActor* targ, DDukeActor* proj)

if ((targ->spr.picnum != RTILE_DRONE))
if (proj->spr.picnum != RTILE_FREEZEBLAST)
//if (actortype[targ->spr.picnum] == 0)
{
auto spawned = spawn(proj, DukeJibs6Class);
if (spawned)
Expand Down Expand Up @@ -622,7 +621,7 @@ void tearitup(sectortype* sect)
DukeSectIterator it(sect);
while (auto act = it.Next())
{
if (act->spr.picnum == RTILE_DESTRUCTO)
if (act->GetClass() == RedneckDestructoClass)
{
act->attackertype = DukeShotSparkClass;
act->hitextra = 1;
Expand Down
14 changes: 0 additions & 14 deletions source/games/duke/src/spawn.cpp
Expand Up @@ -260,20 +260,6 @@ bool initspriteforspawn(DDukeActor* act)
//
//---------------------------------------------------------------------------

DDukeActor* spawn(DDukeActor* actj, int pn)
{
if (actj)
{
auto spawned = CreateActor(actj->sector(), actj->spr.pos, pn, 0, DVector2(0, 0), nullAngle, 0., 0., actj, 0);
if (spawned)
{
spawned->attackertype = static_cast<PClassActor*>(actj->GetClass());
return spawninit(actj, spawned, nullptr);
}
}
return nullptr;
}

DDukeActor* spawn(DDukeActor* actj, PClassActor * cls)
{
if (actj && cls)
Expand Down
7 changes: 4 additions & 3 deletions source/games/duke/src/vmexports.cpp
Expand Up @@ -491,11 +491,12 @@ DEFINE_ACTION_FUNCTION_NATIVE(DDukeActor, movesprite_ex, DukeActor_movesprite_ex
ACTION_RETURN_INT(DukeActor_movesprite_ex(self, velx, vely, velz, clipmask, coll));
}

DDukeActor* DukeActor_Spawnsprite(DDukeActor* origin, int picnum)
DDukeActor* DukeActor_Spawnsprite(DDukeActor* origin, int typeId)
{
if (picnum >= 0 && picnum < MAXTILES)
auto st = GetSpawnType(typeId);
if (st)
{
return spawn(origin, picnum);
return spawn(origin, st);
}
return nullptr;
}
Expand Down
1 change: 1 addition & 0 deletions wadsrc/static/filter/redneck/rmapinfo.spawnclasses
Expand Up @@ -372,5 +372,6 @@ spawnclasses
1990 = RedneckTikilamp

3845 = DukePlayerPawn
380 = RedneckWaterSurface

}
8 changes: 8 additions & 0 deletions wadsrc/static/zscript/games/duke/actors/redneckmisc.zs
Expand Up @@ -164,3 +164,11 @@ class RedneckTikiLamp : DukeItemBase
+FULLBRIGHT
}
}

class RedneckWaterSurface : DukeActor
{
default
{
pic "WATERSURFACE";
}
}

0 comments on commit a2bd09c

Please sign in to comment.