From 87a7ff7b6dd8129caeab9ba086ce3413919e4f55 Mon Sep 17 00:00:00 2001 From: Randy Heit Date: Sat, 17 Apr 2010 02:06:26 +0000 Subject: [PATCH] - Add blzut3's morphed status bar patch. SVN r2283 (trunk) --- src/d_netinfo.cpp | 4 -- src/d_player.h | 2 +- src/g_shared/a_morph.cpp | 26 +----------- src/g_shared/sbar.h | 10 ++--- src/g_shared/sbar_mugshot.cpp | 8 ++-- src/g_shared/sbarinfo.cpp | 4 -- src/g_shared/shared_sbar.cpp | 75 ----------------------------------- src/p_mobj.cpp | 1 - 8 files changed, 9 insertions(+), 121 deletions(-) diff --git a/src/d_netinfo.cpp b/src/d_netinfo.cpp index c415ebe4a..51467369c 100644 --- a/src/d_netinfo.cpp +++ b/src/d_netinfo.cpp @@ -774,10 +774,6 @@ void D_ReadUserInfoStrings (int i, BYTE **stream, bool update) // Rebuild translation in case the new skin uses a different range // than the old one. R_BuildPlayerTranslation (i); - if (StatusBar != NULL && i == StatusBar->GetPlayer()) - { - StatusBar->SetFace (&skins[info->skin]); - } break; case INFO_Gender: diff --git a/src/d_player.h b/src/d_player.h index 2c77872e8..28b240c10 100644 --- a/src/d_player.h +++ b/src/d_player.h @@ -312,7 +312,7 @@ public: short fixedlightlevel; pspdef_t psprites[NUMPSPRITES]; // view sprites (gun, etc) 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 const PClass *MorphExitFlash; // flash to apply when demorphing (cache of value given to P_MorphPlayer) TObjPtr PremorphWeapon; // ready weapon before morphing diff --git a/src/g_shared/a_morph.cpp b/src/g_shared/a_morph.cpp index a807ad70b..2fa69b03e 100644 --- a/src/g_shared/a_morph.cpp +++ b/src/g_shared/a_morph.cpp @@ -99,15 +99,7 @@ bool P_MorphPlayer (player_t *activator, player_t *p, const PClass *spawntype, i p->morphTics = (duration) ? duration : MORPHTICS; // [MH] Used by SBARINFO to speed up face drawing - p->MorphedPlayerClass = 0; - for (unsigned int i = 1; i < PlayerClasses.Size(); i++) - { - if (PlayerClasses[i].Type == spawntype) - { - p->MorphedPlayerClass = i; - break; - } - } + p->MorphedPlayerClass = spawntype; p->MorphStyle = style; 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; } 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; } @@ -309,7 +286,6 @@ bool P_UndoPlayerMorph (player_t *activator, player_t *player, int unmorphflag, } } } - StatusBar->SetFace(&skins[skinindex]); } } diff --git a/src/g_shared/sbar.h b/src/g_shared/sbar.h index d3e72c79e..cf677771a 100644 --- a/src/g_shared/sbar.h +++ b/src/g_shared/sbar.h @@ -165,7 +165,7 @@ struct 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, bool directional=false); }; @@ -189,9 +189,9 @@ struct FMugShotState void Tick(); void Reset(); 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: FMugShotState(); @@ -300,8 +300,6 @@ public: virtual void AttachToPlayer (player_t *player); virtual void FlashCrosshair (); 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 ScreenSizeChanged (); virtual void MultiplayerChanged (); @@ -334,8 +332,6 @@ protected: void GetCurrentAmmo (AAmmo *&ammo1, AAmmo *&ammo2, int &ammocount1, int &ammocount2) const; - void AddFaceToImageCollectionActual (void *skn, FImageCollection *images, bool isDoom); - public: AInventory *ValidateInvFirst (int numVisible) const; void DrawCrosshair (); diff --git a/src/g_shared/sbar_mugshot.cpp b/src/g_shared/sbar_mugshot.cpp index a41476576..73d469eac 100644 --- a/src/g_shared/sbar_mugshot.cpp +++ b/src/g_shared/sbar_mugshot.cpp @@ -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 index = !directional ? random % Graphic.Size() : direction; @@ -84,7 +84,7 @@ FTexture *FMugShotFrame::GetTexture(const char *default_face, FPlayerSkin *skin, { 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]; 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) { - FPlayerSkin *skin = &skins[player->morphTics ? player->MorphedPlayerClass : player->userinfo.skin]; - return CurrentState->GetCurrentFrameTexture(default_face, skin, level, angle); + const char *skin_face = player->morphTics ? player->MorphedPlayerClass->Meta.GetMetaString(APMETA_Face) : skins[player->userinfo.skin].face; + return CurrentState->GetCurrentFrameTexture(default_face, skin_face, level, angle); } return NULL; } diff --git a/src/g_shared/sbarinfo.cpp b/src/g_shared/sbarinfo.cpp index e020d4258..8ec68982d 100644 --- a/src/g_shared/sbarinfo.cpp +++ b/src/g_shared/sbarinfo.cpp @@ -861,10 +861,6 @@ public: { patchnames[i+script->Images.Size()] = InventoryBarLumps[i]; } - for (i = 0;i < numskins;i++) - { - AddFaceToImageCollection (&skins[i], &Images); - } invBarOffset = script->Images.Size(); Images.Init(&patchnames[0], patchnames.Size()); } diff --git a/src/g_shared/shared_sbar.cpp b/src/g_shared/shared_sbar.cpp index 1bbe490ca..96074390c 100644 --- a/src/g_shared/shared_sbar.cpp +++ b/src/g_shared/shared_sbar.cpp @@ -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 () { } @@ -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 diff --git a/src/p_mobj.cpp b/src/p_mobj.cpp index 37276c949..278fd27a7 100644 --- a/src/p_mobj.cpp +++ b/src/p_mobj.cpp @@ -4020,7 +4020,6 @@ APlayerPawn *P_SpawnPlayer (FMapThing *mthing, bool tempplayer) // [GRB] Reset skin p->userinfo.skin = R_FindSkin (skins[p->userinfo.skin].name, p->CurrentPlayerClass); - StatusBar->SetFace (&skins[p->userinfo.skin]); if (!(mobj->flags2 & MF2_DONTTRANSLATE))