- Add blzut3's morphed status bar patch.

SVN r2283 (trunk)
This commit is contained in:
Randy Heit 2010-04-17 02:06:26 +00:00
parent 08b931006f
commit 87a7ff7b6d
8 changed files with 9 additions and 121 deletions

View File

@ -774,10 +774,6 @@ void D_ReadUserInfoStrings (int i, BYTE **stream, bool update)
// Rebuild translation in case the new skin uses a different range // Rebuild translation in case the new skin uses a different range
// than the old one. // than the old one.
R_BuildPlayerTranslation (i); R_BuildPlayerTranslation (i);
if (StatusBar != NULL && i == StatusBar->GetPlayer())
{
StatusBar->SetFace (&skins[info->skin]);
}
break; break;
case INFO_Gender: case INFO_Gender:

View File

@ -312,7 +312,7 @@ public:
short fixedlightlevel; short fixedlightlevel;
pspdef_t psprites[NUMPSPRITES]; // view sprites (gun, etc) pspdef_t psprites[NUMPSPRITES]; // view sprites (gun, etc)
int morphTics; // player is a chicken/pig if > 0 int morphTics; // player is a chicken/pig if > 0
BYTE MorphedPlayerClass; // [MH] (for SBARINFO) class # for this player instance when morphed const PClass *MorphedPlayerClass; // [MH] (for SBARINFO) class # for this player instance when morphed
int MorphStyle; // which effects to apply for this player instance when morphed int MorphStyle; // which effects to apply for this player instance when morphed
const PClass *MorphExitFlash; // flash to apply when demorphing (cache of value given to P_MorphPlayer) const PClass *MorphExitFlash; // flash to apply when demorphing (cache of value given to P_MorphPlayer)
TObjPtr<AWeapon> PremorphWeapon; // ready weapon before morphing TObjPtr<AWeapon> PremorphWeapon; // ready weapon before morphing

View File

@ -99,15 +99,7 @@ bool P_MorphPlayer (player_t *activator, player_t *p, const PClass *spawntype, i
p->morphTics = (duration) ? duration : MORPHTICS; p->morphTics = (duration) ? duration : MORPHTICS;
// [MH] Used by SBARINFO to speed up face drawing // [MH] Used by SBARINFO to speed up face drawing
p->MorphedPlayerClass = 0; p->MorphedPlayerClass = spawntype;
for (unsigned int i = 1; i < PlayerClasses.Size(); i++)
{
if (PlayerClasses[i].Type == spawntype)
{
p->MorphedPlayerClass = i;
break;
}
}
p->MorphStyle = style; p->MorphStyle = style;
p->MorphExitFlash = (exit_flash) ? exit_flash : RUNTIME_CLASS(ATeleportFog); p->MorphExitFlash = (exit_flash) ? exit_flash : RUNTIME_CLASS(ATeleportFog);
@ -149,21 +141,6 @@ bool P_MorphPlayer (player_t *activator, player_t *p, const PClass *spawntype, i
p->camera = morphed; p->camera = morphed;
} }
morphed->ScoreIcon = actor->ScoreIcon; // [GRB] morphed->ScoreIcon = actor->ScoreIcon; // [GRB]
// [MH]
// If the player that was morphed is the one
// taking events, set up the face, if any;
// this is only needed for old-skool skins
// and for the original DOOM status bar.
if (p == &players[consoleplayer])
{
const char *face = spawntype->Meta.GetMetaString (APMETA_Face);
if (face != NULL && strcmp(face, "None") != 0)
{
StatusBar->SetFace(&skins[p->MorphedPlayerClass]);
}
}
return true; return true;
} }
@ -309,7 +286,6 @@ bool P_UndoPlayerMorph (player_t *activator, player_t *player, int unmorphflag,
} }
} }
} }
StatusBar->SetFace(&skins[skinindex]);
} }
} }

View File

@ -165,7 +165,7 @@ struct FMugShotFrame
FMugShotFrame(); FMugShotFrame();
~FMugShotFrame(); ~FMugShotFrame();
FTexture *GetTexture(const char *default_face, FPlayerSkin *skin, int random, int level=0, FTexture *GetTexture(const char *default_face, const char *skin_face, int random, int level=0,
int direction=0, bool usesLevels=false, bool health2=false, bool healthspecial=false, int direction=0, bool usesLevels=false, bool health2=false, bool healthspecial=false,
bool directional=false); bool directional=false);
}; };
@ -189,9 +189,9 @@ struct FMugShotState
void Tick(); void Tick();
void Reset(); void Reset();
FMugShotFrame &GetCurrentFrame() { return Frames[Position]; } FMugShotFrame &GetCurrentFrame() { return Frames[Position]; }
FTexture *GetCurrentFrameTexture(const char *default_face, FPlayerSkin *skin, int level=0, int direction=0) FTexture *GetCurrentFrameTexture(const char *default_face, const char *skin_face, int level=0, int direction=0)
{ {
return GetCurrentFrame().GetTexture(default_face, skin, Random, level, direction, bUsesLevels, bHealth2, bHealthSpecial, bDirectional); return GetCurrentFrame().GetTexture(default_face, skin_face, Random, level, direction, bUsesLevels, bHealth2, bHealthSpecial, bDirectional);
} }
private: private:
FMugShotState(); FMugShotState();
@ -300,8 +300,6 @@ public:
virtual void AttachToPlayer (player_t *player); virtual void AttachToPlayer (player_t *player);
virtual void FlashCrosshair (); virtual void FlashCrosshair ();
virtual void BlendView (float blend[4]); virtual void BlendView (float blend[4]);
virtual void SetFace (void *skn); // Takes a FPlayerSkin as input
virtual void AddFaceToImageCollection (void *skn, FImageCollection *images); // Takes a FPlayerSkin as input
virtual void NewGame (); virtual void NewGame ();
virtual void ScreenSizeChanged (); virtual void ScreenSizeChanged ();
virtual void MultiplayerChanged (); virtual void MultiplayerChanged ();
@ -334,8 +332,6 @@ protected:
void GetCurrentAmmo (AAmmo *&ammo1, AAmmo *&ammo2, int &ammocount1, int &ammocount2) const; void GetCurrentAmmo (AAmmo *&ammo1, AAmmo *&ammo2, int &ammocount1, int &ammocount2) const;
void AddFaceToImageCollectionActual (void *skn, FImageCollection *images, bool isDoom);
public: public:
AInventory *ValidateInvFirst (int numVisible) const; AInventory *ValidateInvFirst (int numVisible) const;
void DrawCrosshair (); void DrawCrosshair ();

View File

@ -76,7 +76,7 @@ FMugShotFrame::~FMugShotFrame()
// //
//=========================================================================== //===========================================================================
FTexture *FMugShotFrame::GetTexture(const char *default_face, FPlayerSkin *skin, int random, int level, FTexture *FMugShotFrame::GetTexture(const char *default_face, const char *skin_face, int random, int level,
int direction, bool uses_levels, bool health2, bool healthspecial, bool directional) int direction, bool uses_levels, bool health2, bool healthspecial, bool directional)
{ {
int index = !directional ? random % Graphic.Size() : direction; int index = !directional ? random % Graphic.Size() : direction;
@ -84,7 +84,7 @@ FTexture *FMugShotFrame::GetTexture(const char *default_face, FPlayerSkin *skin,
{ {
index = Graphic.Size() - 1; index = Graphic.Size() - 1;
} }
FString sprite(skin->face[0] != 0 ? skin->face : default_face, 3); FString sprite(skin_face[0] != 0 ? skin_face : default_face, 3);
sprite += Graphic[index]; sprite += Graphic[index];
if (uses_levels) //change the last character to the level if (uses_levels) //change the last character to the level
{ {
@ -492,8 +492,8 @@ FTexture *FMugShot::GetFace(player_t *player, const char *default_face, int accu
} }
if (CurrentState != NULL) if (CurrentState != NULL)
{ {
FPlayerSkin *skin = &skins[player->morphTics ? player->MorphedPlayerClass : player->userinfo.skin]; const char *skin_face = player->morphTics ? player->MorphedPlayerClass->Meta.GetMetaString(APMETA_Face) : skins[player->userinfo.skin].face;
return CurrentState->GetCurrentFrameTexture(default_face, skin, level, angle); return CurrentState->GetCurrentFrameTexture(default_face, skin_face, level, angle);
} }
return NULL; return NULL;
} }

View File

@ -861,10 +861,6 @@ public:
{ {
patchnames[i+script->Images.Size()] = InventoryBarLumps[i]; patchnames[i+script->Images.Size()] = InventoryBarLumps[i];
} }
for (i = 0;i < numskins;i++)
{
AddFaceToImageCollection (&skins[i], &Images);
}
invBarOffset = script->Images.Size(); invBarOffset = script->Images.Size();
Images.Init(&patchnames[0], patchnames.Size()); Images.Init(&patchnames[0], patchnames.Size());
} }

View File

@ -1591,15 +1591,6 @@ void DBaseStatusBar::FlashItem (const PClass *itemtype)
{ {
} }
void DBaseStatusBar::SetFace (void *skn)
{
}
void DBaseStatusBar::AddFaceToImageCollection (void *skn, FImageCollection *images)
{
AddFaceToImageCollectionActual (skn, images, false);
}
void DBaseStatusBar::NewGame () void DBaseStatusBar::NewGame ()
{ {
} }
@ -1635,72 +1626,6 @@ void DBaseStatusBar::ScreenSizeChanged ()
} }
} }
//---------------------------------------------------------------------------
//
// AddFaceToImageCollectionActual
//
// Adds face graphics for specified skin to the specified image collection.
// If not in DOOM statusbar and no face in current skin, do NOT default STF*
//
//---------------------------------------------------------------------------
void DBaseStatusBar::AddFaceToImageCollectionActual (void *skn, FImageCollection *images, bool isDoom)
{
const char *nameptrs[ST_NUMFACES];
char names[ST_NUMFACES][9];
char prefix[4];
int i, j;
int namespc;
int facenum;
FPlayerSkin *skin = (FPlayerSkin *)skn;
if ((skin->face[0] == 0) && !isDoom)
{
return;
}
for (i = 0; i < ST_NUMFACES; i++)
{
nameptrs[i] = names[i];
}
if (skin->face[0] != 0)
{
prefix[0] = skin->face[0];
prefix[1] = skin->face[1];
prefix[2] = skin->face[2];
prefix[3] = 0;
namespc = skin->namespc;
}
else
{
prefix[0] = 'S';
prefix[1] = 'T';
prefix[2] = 'F';
prefix[3] = 0;
namespc = ns_global;
}
facenum = 0;
for (i = 0; i < ST_NUMPAINFACES; i++)
{
for (j = 0; j < ST_NUMSTRAIGHTFACES; j++)
{
mysnprintf (names[facenum++], countof(names[0]), "%sST%d%d", prefix, i, j);
}
mysnprintf (names[facenum++], countof(names[0]), "%sTR%d0", prefix, i); // turn right
mysnprintf (names[facenum++], countof(names[0]), "%sTL%d0", prefix, i); // turn left
mysnprintf (names[facenum++], countof(names[0]), "%sOUCH%d", prefix, i); // ouch!
mysnprintf (names[facenum++], countof(names[0]), "%sEVL%d", prefix, i); // evil grin ;)
mysnprintf (names[facenum++], countof(names[0]), "%sKILL%d", prefix, i); // pissed off
}
mysnprintf (names[facenum++], countof(names[0]), "%sGOD0", prefix);
mysnprintf (names[facenum++], countof(names[0]), "%sDEAD0", prefix);
images->Add (nameptrs, ST_NUMFACES, namespc);
}
//--------------------------------------------------------------------------- //---------------------------------------------------------------------------
// //
// ValidateInvFirst // ValidateInvFirst

View File

@ -4020,7 +4020,6 @@ APlayerPawn *P_SpawnPlayer (FMapThing *mthing, bool tempplayer)
// [GRB] Reset skin // [GRB] Reset skin
p->userinfo.skin = R_FindSkin (skins[p->userinfo.skin].name, p->CurrentPlayerClass); p->userinfo.skin = R_FindSkin (skins[p->userinfo.skin].name, p->CurrentPlayerClass);
StatusBar->SetFace (&skins[p->userinfo.skin]);
if (!(mobj->flags2 & MF2_DONTTRANSLATE)) if (!(mobj->flags2 & MF2_DONTTRANSLATE))