Skip to content

Commit

Permalink
- use texture names for special player sprites,
Browse files Browse the repository at this point in the history
  • Loading branch information
coelckers committed Mar 27, 2023
1 parent bf42d72 commit eb17381
Show file tree
Hide file tree
Showing 4 changed files with 37 additions and 34 deletions.
2 changes: 1 addition & 1 deletion source/games/duke/src/animatesprites.cpp
Expand Up @@ -204,7 +204,7 @@ void applyanimations(tspritetype* t, DDukeActor* h, const DVector2& viewVec, DAn

if (!tex)
{
t->setspritetexture(-1);
t->setspritetexture(FNullTextureID());
t->scale = DVector2(0, 0);
}

Expand Down
31 changes: 15 additions & 16 deletions source/games/duke/src/animatesprites_d.cpp
Expand Up @@ -82,7 +82,7 @@ void animatesprites_d(tspriteArray& tsprites, const DVector2& viewVec, DAngle vi
{
if (t->lotag == SE_27_DEMO_CAM && ud.recstat == 1)
{
t->picnum = 11 + ((PlayClock >> 3) & 1);
t->setspritetexture(TexMan.CheckForTexture("DEMOCAM", ETextureType::Any));
t->cstat |= CSTAT_SPRITE_YCENTER;
}
else
Expand Down Expand Up @@ -147,24 +147,23 @@ void animatesprites_d(tspriteArray& tsprites, const DVector2& viewVec, DAngle vi
newtspr->shade = t->shade;
newtspr->cstat = 0;

const char* texname = nullptr;
switch (ps[p].curr_weapon)
{
case PISTOL_WEAPON: newtspr->picnum = DTILE_FIRSTGUNSPRITE; break;
case SHOTGUN_WEAPON: newtspr->picnum = DTILE_SHOTGUNSPRITE; break;
case CHAINGUN_WEAPON: newtspr->picnum = DTILE_CHAINGUNSPRITE; break;
case RPG_WEAPON: newtspr->picnum = DTILE_RPGSPRITE; break;
case HANDREMOTE_WEAPON:
case HANDBOMB_WEAPON: newtspr->picnum = DTILE_HEAVYHBOMB; break;
case TRIPBOMB_WEAPON: newtspr->picnum = DTILE_TRIPBOMBSPRITE; break;
case GROW_WEAPON: newtspr->picnum = DTILE_GROWSPRITEICON; break;
case SHRINKER_WEAPON: newtspr->picnum = DTILE_SHRINKERSPRITE; break;
case FREEZE_WEAPON: newtspr->picnum = DTILE_FREEZESPRITE; break;
case FLAMETHROWER_WEAPON: //Twentieth Anniversary World Tour
if (isWorldTour())
newtspr->picnum = DTILE_FLAMETHROWERSPRITE;
break;
case DEVISTATOR_WEAPON: newtspr->picnum = DTILE_DEVISTATORSPRITE; break;
case PISTOL_WEAPON: texname = "FIRSTGUNSPRITE"; break;
case SHOTGUN_WEAPON: texname = "SHOTGUNSPRITE"; break;
case CHAINGUN_WEAPON: texname = "CHAINGUNSPRITE"; break;
case RPG_WEAPON: texname = "RPGSPRITE"; break;
case HANDREMOTE_WEAPON:
case HANDBOMB_WEAPON: texname = "HEAVYHBOMB"; break;
case TRIPBOMB_WEAPON: texname = "TRIPBOMBSPRITE"; break;
case GROW_WEAPON: texname = "GROWSPRITEICON"; break;
case SHRINKER_WEAPON: texname = "SHRINKERSPRITE"; break;
case FREEZE_WEAPON: texname = "FREEZESPRITE"; break;
case FLAMETHROWER_WEAPON:texname = "FLAMETHROWERSPRITE"; break;
case DEVISTATOR_WEAPON: texname = "DEVISTATORSPRITE"; break;
}
t->setspritetexture(TexMan.CheckForTexture(texname, ETextureType::Any));

if (h->GetOwner()) newtspr->pos.Z = ps[p].GetActor()->getOffsetZ() - 12;
else newtspr->pos.Z = h->spr.pos.Z - 51;
Expand Down
37 changes: 20 additions & 17 deletions source/games/duke/src/animatesprites_r.cpp
Expand Up @@ -75,11 +75,12 @@ void animatesprites_r(tspriteArray& tsprites, const DVector2& viewVec, DAngle vi
{
if (t->lotag == SE_27_DEMO_CAM && ud.recstat == 1)
{
t->picnum = 11 + ((PlayClock >> 3) & 1);
t->setspritetexture(TexMan.CheckForTexture("DEMOCAM", ETextureType::Any));
t->cstat |= CSTAT_SPRITE_YCENTER;
}
else
t->scale = DVector2(0, 0);
break;
}

if (t->statnum == STAT_TEMP) continue;
Expand Down Expand Up @@ -145,22 +146,24 @@ void animatesprites_r(tspriteArray& tsprites, const DVector2& viewVec, DAngle vi
newtspr->shade = t->shade;
newtspr->cstat = 0;

const char* texname = nullptr;
switch (ps[p].curr_weapon)
{
case PISTOL_WEAPON: newtspr->picnum = RTILE_FIRSTGUNSPRITE; break;
case SHOTGUN_WEAPON: newtspr->picnum = RTILE_SHOTGUNSPRITE; break;
case RIFLEGUN_WEAPON: newtspr->picnum = RTILE_RIFLEGUNSPRITE; break;
case CROSSBOW_WEAPON: newtspr->picnum = RTILE_CROSSBOWSPRITE; break;
case CHICKEN_WEAPON: newtspr->picnum = RTILE_CROSSBOWSPRITE; break;
case PISTOL_WEAPON: texname = "FIRSTGUNSPRITE"; break;
case SHOTGUN_WEAPON: texname = "SHOTGUNSPRITE"; break;
case RIFLEGUN_WEAPON: texname = "RIFLEGUNSPRITE"; break;
case CROSSBOW_WEAPON: texname = "CROSSBOWSPRITE"; break;
case CHICKEN_WEAPON: texname = "CROSSBOWSPRITE"; break;
case THROWINGDYNAMITE_WEAPON:
case DYNAMITE_WEAPON: newtspr->picnum = RTILE_DYNAMITE; break;
case POWDERKEG_WEAPON: newtspr->picnum = RTILE_POWDERKEG; break;
case BOWLING_WEAPON: newtspr->picnum = RTILE_BOWLINGBALLSPRITE; break;
case THROWSAW_WEAPON: newtspr->picnum = RTILE_RIPSAWSPRITE; break;
case BUZZSAW_WEAPON: newtspr->picnum = RTILE_RIPSAWSPRITE; break;
case ALIENBLASTER_WEAPON: newtspr->picnum = RTILE_ALIENBLASTERSPRITE; break;
case TIT_WEAPON: newtspr->picnum = RTILE_TITSPRITE; break;
case DYNAMITE_WEAPON: texname = "DYNAMITE"; break;
case POWDERKEG_WEAPON: texname = "POWDERKEG"; break;
case BOWLING_WEAPON: texname = "BOWLINGBALLSPRITE"; break;
case THROWSAW_WEAPON: texname = "RIPSAWSPRITE"; break;
case BUZZSAW_WEAPON: texname = "RIPSAWSPRITE"; break;
case ALIENBLASTER_WEAPON: texname = "ALIENBLASTERSPRITE"; break;
case TIT_WEAPON: texname = "TITSPRITE"; break;
}
t->setspritetexture(TexMan.CheckForTexture(texname, ETextureType::Any));

if (h->GetOwner()) newtspr->pos.Z = ps[p].GetActor()->getOffsetZ() - 12;
else newtspr->pos.Z = h->spr.pos.Z - 51;
Expand Down Expand Up @@ -201,29 +204,29 @@ void animatesprites_r(tspriteArray& tsprites, const DVector2& viewVec, DAngle vi

if (ps[p].OnMotorcycle && p == screenpeek)
{
t->picnum = RTILE_PLAYERONBIKEBACK;
t->setspritetexture(TexMan.CheckForTexture("PLAYERONBIKEBACK", ETextureType::Any));
t->scale = DVector2(0.28125, 0.28125);
drawshadows(tsprites, t, h);
continue;
}
else if (ps[p].OnMotorcycle)
{
t->picnum = RTILE_PLAYERONBIKE;
t->setspritetexture(TexMan.CheckForTexture("PLAYERONBIKE", ETextureType::Any));
applyRotation2(h, t, viewang);
t->scale = DVector2(0.28125, 0.28125);
drawshadows(tsprites, t, h);
continue;
}
else if (ps[p].OnBoat && p == screenpeek)
{
t->picnum = RTILE_PLAYERONBOATBACK;
t->setspritetexture(TexMan.CheckForTexture("PLAYERONBOATBACK", ETextureType::Any));
t->scale = DVector2(0.5, 0.5);
drawshadows(tsprites, t, h);
continue;
}
else if (ps[p].OnBoat)
{
t->picnum = RTILE_PLAYERONBOAT;
t->setspritetexture(TexMan.CheckForTexture("PLAYERONBOAT", ETextureType::Any));
k = angletorotation2(h->spr.Angles.Yaw, viewang);
applyRotation2(h, t, viewang);
t->scale = DVector2(0.5, 0.5);
Expand Down
1 change: 1 addition & 0 deletions source/games/duke/src/namelist_d.h
@@ -1,3 +1,4 @@
x(DEMOCAM1, 11)
x(ARROW, 20)
x(FIRSTGUNSPRITE, 21)
x(CHAINGUNSPRITE, 22)
Expand Down

0 comments on commit eb17381

Please sign in to comment.