From c678220857a718117aeb1df218e509f14bff2ab9 Mon Sep 17 00:00:00 2001 From: toasterbabe Date: Sat, 6 Aug 2016 23:18:37 +0100 Subject: [PATCH] New S_SKIN attribute - "camerascale", another float. Acts as a scale modifier to t_cam_dist and t_cam_height. --- src/lua_skinlib.c | 5 +++++ src/p_user.c | 8 ++++---- src/r_things.c | 2 ++ src/r_things.h | 1 + 4 files changed, 12 insertions(+), 4 deletions(-) diff --git a/src/lua_skinlib.c b/src/lua_skinlib.c index 91735337d..7ff21151c 100644 --- a/src/lua_skinlib.c +++ b/src/lua_skinlib.c @@ -48,6 +48,7 @@ enum skin { skin_height, skin_spinheight, skin_shieldscale, + skin_camerascale, skin_starttranscolor, skin_prefcolor, skin_prefoppositecolor, @@ -84,6 +85,7 @@ static const char *const skin_opt[] = { "height", "spinheight", "shieldscale", + "camerascale", "starttranscolor", "prefcolor", "prefoppositecolor", @@ -197,6 +199,9 @@ static int skin_get(lua_State *L) case skin_shieldscale: lua_pushfixed(L, skin->shieldscale); break; + case skin_camerascale: + lua_pushfixed(L, skin->camerascale); + break; case skin_starttranscolor: lua_pushinteger(L, skin->starttranscolor); break; diff --git a/src/p_user.c b/src/p_user.c index cacf26a15..b85e83d78 100644 --- a/src/p_user.c +++ b/src/p_user.c @@ -8002,16 +8002,16 @@ boolean P_MoveChaseCamera(player_t *player, camera_t *thiscam, boolean resetcall camspeed = cv_cam_speed.value; camstill = cv_cam_still.value; camrotate = cv_cam_rotate.value; - camdist = FixedMul(cv_cam_dist.value, mo->scale); - camheight = FixedMul(cv_cam_height.value, mo->scale); + camdist = FixedMul(cv_cam_dist.value, FixedMul(skins[player->skin].camerascale, mo->scale)); + camheight = FixedMul(cv_cam_height.value, FixedMul(skins[player->skin].camerascale, mo->scale)); } else // Camera 2 { camspeed = cv_cam2_speed.value; camstill = cv_cam2_still.value; camrotate = cv_cam2_rotate.value; - camdist = FixedMul(cv_cam2_dist.value, mo->scale); - camheight = FixedMul(cv_cam2_height.value, mo->scale); + camdist = FixedMul(cv_cam2_dist.value, FixedMul(skins[player->skin].camerascale, mo->scale)); + camheight = FixedMul(cv_cam2_height.value, FixedMul(skins[player->skin].camerascale, mo->scale)); } #ifdef REDSANALOG diff --git a/src/r_things.c b/src/r_things.c index dd0cf34ef..c3a7ac271 100644 --- a/src/r_things.c +++ b/src/r_things.c @@ -2308,6 +2308,7 @@ static void Sk_SetDefaultValue(skin_t *skin) skin->spinheight = FixedMul(skin->height, 2*FRACUNIT/3); skin->shieldscale = FRACUNIT; + skin->camerascale = FRACUNIT; skin->thokitem = -1; skin->spinitem = -1; @@ -2662,6 +2663,7 @@ void R_AddSkins(UINT16 wadnum) GETFLOAT(jumpfactor) GETFLOAT(highresscale) GETFLOAT(shieldscale) + GETFLOAT(camerascale) #undef GETFLOAT else // let's check if it's a sound, otherwise error out diff --git a/src/r_things.h b/src/r_things.h index 15f9eb774..651950f05 100644 --- a/src/r_things.h +++ b/src/r_things.h @@ -98,6 +98,7 @@ typedef struct fixed_t spinheight; fixed_t shieldscale; // no change to bounding box, but helps set the shield's sprite size + fixed_t camerascale; // Definable color translation table UINT8 starttranscolor;