- a lot of simple picnum or TILE_* replacements.

This commit is contained in:
Christoph Oelckers 2022-12-30 21:45:31 +01:00
parent 5d43975467
commit a6600c200f
13 changed files with 41 additions and 39 deletions

View file

@ -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;

View file

@ -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)

View file

@ -19,7 +19,6 @@ inline int player_struct::GetPlayerNum()
return actor->PlayerIndex();
}
DDukeActor* spawn(DDukeActor* spawner, int type);
DDukeActor* spawn(DDukeActor* spawner, PClassActor* pname);
// return type is int for scripting - the value must still be true or false!

View file

@ -1894,7 +1894,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:
@ -2388,7 +2388,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;
@ -2398,7 +2398,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;

View file

@ -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;

View file

@ -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;
@ -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;
@ -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;
@ -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:
@ -1966,7 +1966,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)
{
@ -2369,7 +2369,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;
}
@ -2418,7 +2418,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)
{
@ -2463,7 +2463,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)
{

View file

@ -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 ) )

View file

@ -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)
@ -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();

View file

@ -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)
@ -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;

View file

@ -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)

View file

@ -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;
}

View file

@ -371,5 +371,6 @@ spawnclasses
1990 = RedneckTikilamp
3845 = DukePlayerPawn, noskill
380 = RedneckWaterSurface, noskill
}

View file

@ -164,3 +164,11 @@ class RedneckTikiLamp : DukeItemBase
+FULLBRIGHT
}
}
class RedneckWaterSurface : DukeActor
{
default
{
pic "WATERSURFACE";
}
}