From df1e5eb9b76386d336df2e0695769c4ae825df1f Mon Sep 17 00:00:00 2001 From: toasterbabe Date: Thu, 26 Oct 2017 16:58:18 +0100 Subject: [PATCH] * Optimise the new static code further. * Update all the other V_DrawCroppedPatch calls to match the new behaviour. * Fix the OGL version of V_DrawCroppedPatch to match the new behaviour. (To justify my changes: It's not exposed to Lua, and the function signature was a mess. This way it's easier to mentally map how it would work.) --- src/hardware/hw_draw.c | 12 ++++++------ src/m_menu.c | 40 ++++++++++++++++++++++++---------------- src/y_inter.c | 2 +- 3 files changed, 31 insertions(+), 23 deletions(-) diff --git a/src/hardware/hw_draw.c b/src/hardware/hw_draw.c index 9c912495a..dc97f7014 100644 --- a/src/hardware/hw_draw.c +++ b/src/hardware/hw_draw.c @@ -281,16 +281,16 @@ void HWR_DrawCroppedPatch(GLPatch_t *gpatch, fixed_t x, fixed_t y, fixed_t pscal sdupx = sdupy = 2.0f; v[0].x = v[3].x = (cx*sdupx - gpatch->leftoffset * pdupx) / vid.width - 1; - v[2].x = v[1].x = (cx*sdupx + ((w-sx) - gpatch->leftoffset) * pdupx) / vid.width - 1; + v[2].x = v[1].x = (cx*sdupx + ((w) - gpatch->leftoffset) * pdupx) / vid.width - 1; v[0].y = v[1].y = 1 - (cy*sdupy - gpatch->topoffset * pdupy) / vid.height; - v[2].y = v[3].y = 1 - (cy*sdupy + ((h-sy) - gpatch->topoffset) * pdupy) / vid.height; + v[2].y = v[3].y = 1 - (cy*sdupy + ((h) - gpatch->topoffset) * pdupy) / vid.height; v[0].z = v[1].z = v[2].z = v[3].z = 1.0f; - v[0].sow = v[3].sow = ((sx)/(float)gpatch->width )*gpatch->max_s; - v[2].sow = v[1].sow = ((w )/(float)gpatch->width )*gpatch->max_s; - v[0].tow = v[1].tow = ((sy)/(float)gpatch->height)*gpatch->max_t; - v[2].tow = v[3].tow = ((h )/(float)gpatch->height)*gpatch->max_t; + v[0].sow = v[3].sow = ((sx )/(float)gpatch->width )*gpatch->max_s; + v[2].sow = v[1].sow = ((sx+w)/(float)gpatch->width )*gpatch->max_s; + v[0].tow = v[1].tow = ((sy )/(float)gpatch->height)*gpatch->max_t; + v[2].tow = v[3].tow = ((sy+h)/(float)gpatch->height)*gpatch->max_t; flags = BLENDMODE|PF_Clip|PF_NoZClip|PF_NoDepthTest; diff --git a/src/m_menu.c b/src/m_menu.c index 5025c4185..9403dabc4 100644 --- a/src/m_menu.c +++ b/src/m_menu.c @@ -3085,26 +3085,34 @@ void M_DrawTextBox(INT32 x, INT32 y, INT32 width, INT32 boxlines) */ } -#define scale FRACUNIT/2 - static fixed_t staticalong = 0; static void M_DrawStaticBox(fixed_t x, fixed_t y, INT32 flags, fixed_t w, fixed_t h) { - patch_t *patch = W_CachePatchName("LSSTATIC", PU_CACHE); - INT32 pw = SHORT(patch->width); - fixed_t sw = FixedDiv(w, scale); + patch_t *patch; + fixed_t sw, pw; - if (staticalong >= (pw - sw)) - staticalong = 0; + patch = W_CachePatchName("LSSTATIC", PU_CACHE); + pw = SHORT(patch->width) - (sw = w*2); //FixedDiv(w, scale); -- for scale FRACUNIT/2 - V_DrawCroppedPatch(x< 0) -- model code for modders providing weird LSSTATIC + { + if (staticalong > pw) + staticalong -= pw; + } + else + staticalong = 0;*/ - staticalong += M_RandomRange(sw/2, 2*sw); + if (staticalong > pw) // simplified for base LSSTATIC + staticalong -= pw; + + V_DrawCroppedPatch(x<width) >= 256) - V_DrawCroppedPatch(8<height) - 64 + o*2, SHORT(patch->width), SHORT(patch->height)); + V_DrawCroppedPatch(8<height) + 2*(o-32), SHORT(patch->width), 32 - o); else - V_DrawCroppedPatch(8<height) - 32 + o, SHORT(patch->width), SHORT(patch->height)); + V_DrawCroppedPatch(8<height) + o - 32, SHORT(patch->width), 32 - o); W_UnlockCachedPatch(patch); } @@ -6957,7 +6965,7 @@ static void M_DrawSetupChoosePlayerMenu(void) { patch = W_CachePatchName(description[next].picname, PU_CACHE); if (SHORT(patch->width) >= 256) - V_DrawCroppedPatch(8<width), o*2); + V_DrawCroppedPatch(8<width)/2, o); else V_DrawCroppedPatch(8<width), o); W_UnlockCachedPatch(patch); @@ -6975,9 +6983,9 @@ static void M_DrawSetupChoosePlayerMenu(void) else { if (SHORT(patch->width) >= 256) - V_DrawCroppedPatch(8<width), SHORT(patch->height)); + V_DrawCroppedPatch(8<width)/2, SHORT(patch->height)/2 - (o-32)); else - V_DrawCroppedPatch(8<width), SHORT(patch->height)); + V_DrawCroppedPatch(8<width), SHORT(patch->height) - (o-32)); } W_UnlockCachedPatch(patch); diff --git a/src/y_inter.c b/src/y_inter.c index 0ed225584..0812ba80f 100644 --- a/src/y_inter.c +++ b/src/y_inter.c @@ -205,7 +205,7 @@ static void Y_IntermissionTokenDrawer(void) calc = (lowy - y)*2; if (calc > 0) - V_DrawCroppedPatch(32<width), calc); + V_DrawCroppedPatch(32<width), calc); } //