From 1f8e471eba67a3198542ef3d4a194c3da3f32b50 Mon Sep 17 00:00:00 2001 From: Randy Heit Date: Sun, 27 Apr 2008 22:33:19 +0000 Subject: [PATCH] - Separated the skin scale values into separate X and Y values so that skins automatically generated for different player classes can use both the scaling values that can be set for the actor. SVN r947 (trunk) --- docs/rh-log.txt | 5 +++++ src/d_netinfo.cpp | 3 ++- src/m_menu.cpp | 12 +++++++----- src/p_mobj.cpp | 6 ++++-- src/p_user.cpp | 2 +- src/r_defs.h | 3 ++- src/r_things.cpp | 9 ++++++--- 7 files changed, 27 insertions(+), 13 deletions(-) diff --git a/docs/rh-log.txt b/docs/rh-log.txt index 93fcc0be8..34fa683bc 100644 --- a/docs/rh-log.txt +++ b/docs/rh-log.txt @@ -1,3 +1,8 @@ +April 27, 2008 +- Separated the skin scale values into separate X and Y values so that skins + automatically generated for different player classes can use both the + scaling values that can be set for the actor. + April 26, 2008 - Fixed: Any MIDI ticks that contain only events that are interpreted by the MIDI parser and not passed on to the MIDI device would mess up timing diff --git a/src/d_netinfo.cpp b/src/d_netinfo.cpp index 0b3066d76..1f9468147 100644 --- a/src/d_netinfo.cpp +++ b/src/d_netinfo.cpp @@ -731,7 +731,8 @@ void D_ReadUserInfoStrings (int i, BYTE **stream, bool update) GetDefaultByType (players[i].cls)->SpawnState->sprite.index) { // Only change the sprite if the player is using a standard one players[i].mo->sprite = skins[info->skin].sprite; - players[i].mo->scaleX = players[i].mo->scaleY = skins[info->skin].Scale; + players[i].mo->scaleX = skins[info->skin].ScaleX; + players[i].mo->scaleY = skins[info->skin].ScaleY; } } // Rebuild translation in case the new skin uses a different range diff --git a/src/m_menu.cpp b/src/m_menu.cpp index e3afe73c3..3c3537cd5 100644 --- a/src/m_menu.cpp +++ b/src/m_menu.cpp @@ -2129,19 +2129,21 @@ static void M_PlayerSetupDrawer () } { spriteframe_t *sprframe; - fixed_t Scale; + fixed_t ScaleX, ScaleY; if (GetDefaultByType (PlayerClass->Type)->flags4 & MF4_NOSKIN || players[consoleplayer].userinfo.PlayerClass == -1 || PlayerState->sprite.index != GetDefaultByType (PlayerClass->Type)->SpawnState->sprite.index) { sprframe = &SpriteFrames[sprites[PlayerState->sprite.index].spriteframes + PlayerState->GetFrame()]; - Scale = GetDefaultByType (PlayerClass->Type)->scaleX; + ScaleX = GetDefaultByType(PlayerClass->Type)->scaleX; + ScaleY = GetDefaultByType(PlayerClass->Type)->scaleY; } else { sprframe = &SpriteFrames[sprites[skins[PlayerSkin].sprite].spriteframes + PlayerState->GetFrame()]; - Scale = skins[PlayerSkin].Scale; + ScaleX = skins[PlayerSkin].ScaleX; + ScaleY = skins[PlayerSkin].ScaleY; } if (sprframe != NULL) @@ -2156,8 +2158,8 @@ static void M_PlayerSetupDrawer () screen->DrawTexture (tex, (320 - 52 - 32 + xo - 160)*CleanXfac + (SCREENWIDTH)/2, (PSetupDef.y + LINEHEIGHT*3 + 57 - 104)*CleanYfac + (SCREENHEIGHT/2), - DTA_DestWidth, MulScale16 (tex->GetWidth() * CleanXfac, Scale), - DTA_DestHeight, MulScale16 (tex->GetHeight() * CleanYfac, Scale), + DTA_DestWidth, MulScale16 (tex->GetWidth() * CleanXfac, ScaleX), + DTA_DestHeight, MulScale16 (tex->GetHeight() * CleanYfac, ScaleY), DTA_Translation, translationtables[TRANSLATION_Players](MAXPLAYERS), TAG_DONE); } diff --git a/src/p_mobj.cpp b/src/p_mobj.cpp index 000022177..b0f8aa683 100644 --- a/src/p_mobj.cpp +++ b/src/p_mobj.cpp @@ -399,7 +399,8 @@ void AActor::Serialize (FArchive &arc) GetDefaultByType (player->cls)->SpawnState->sprite.index) { // Give player back the skin sprite = skins[player->userinfo.skin].sprite; - scaleX = scaleY = skins[player->userinfo.skin].Scale; + scaleX = skins[player->userinfo.skin].ScaleX; + scaleY = skins[player->userinfo.skin].ScaleY; } if (Speed == 0) { @@ -3613,7 +3614,8 @@ APlayerPawn *P_SpawnPlayer (mapthing2_t *mthing, bool tempplayer) // [RH] Set player sprite based on skin mobj->sprite = skins[p->userinfo.skin].sprite; - mobj->scaleX = mobj->scaleY = skins[p->userinfo.skin].Scale; + mobj->scaleX = skins[p->userinfo.skin].ScaleX; + mobj->scaleY = skins[p->userinfo.skin].ScaleY; p->DesiredFOV = p->FOV = 90.f; p->camera = p->mo; diff --git a/src/p_user.cpp b/src/p_user.cpp index e215277bb..500a5bfd8 100644 --- a/src/p_user.cpp +++ b/src/p_user.cpp @@ -1329,7 +1329,7 @@ void P_CheckPlayerSprites() if (player->userinfo.skin != 0) { - defscaleY = skins[player->userinfo.skin].Scale; + defscaleY = skins[player->userinfo.skin].ScaleY; } // Set the crouch sprite diff --git a/src/r_defs.h b/src/r_defs.h index ab96d5e22..cf3e419c7 100644 --- a/src/r_defs.h +++ b/src/r_defs.h @@ -1063,7 +1063,8 @@ public: BYTE range0start; BYTE range0end; bool othergame; // [GRB] - fixed_t Scale; + fixed_t ScaleX; + fixed_t ScaleY; int sprite; int crouchsprite; int namespc; // namespace for this skin diff --git a/src/r_things.cpp b/src/r_things.cpp index 9d33ce6a9..eb8e0e041 100644 --- a/src/r_things.cpp +++ b/src/r_things.cpp @@ -509,7 +509,8 @@ void R_InitSkins (void) } else if (0 == stricmp (key, "scale")) { - skins[i].Scale = clamp (FLOAT2FIXED(atof (sc.String)), 1, 256*FRACUNIT); + skins[i].ScaleX = clamp (FLOAT2FIXED(atof (sc.String)), 1, 256*FRACUNIT); + skins[i].ScaleY = skins[i].ScaleX; } else if (0 == stricmp (key, "game")) { @@ -875,7 +876,8 @@ void R_InitSprites () const PClass *type = PlayerClasses[0].Type; skins[i].range0start = type->Meta.GetMetaInt (APMETA_ColorRange) & 255; skins[i].range0end = type->Meta.GetMetaInt (APMETA_ColorRange) >> 8; - skins[i].Scale = GetDefaultByType (type)->scaleX; + skins[i].ScaleX = GetDefaultByType (type)->scaleX; + skins[i].ScaleY = GetDefaultByType (type)->scaleY; } R_InitSpriteDefs (); @@ -903,7 +905,8 @@ void R_InitSprites () } skins[i].range0start = basetype->Meta.GetMetaInt (APMETA_ColorRange) & 255; skins[i].range0end = basetype->Meta.GetMetaInt (APMETA_ColorRange) >> 8; - skins[i].Scale = GetDefaultByType (basetype)->scaleX; + skins[i].ScaleX = GetDefaultByType (basetype)->scaleX; + skins[i].ScaleY = GetDefaultByType (basetype)->scaleY; skins[i].sprite = GetDefaultByType (basetype)->SpawnState->sprite.index; skins[i].namespc = ns_global;