mirror of
https://git.do.srb2.org/STJr/SRB2.git
synced 2025-03-21 18:32:08 +00:00
Improved memory management for patches
This commit is contained in:
parent
92c4993d67
commit
dcaad758f4
18 changed files with 344 additions and 368 deletions
|
@ -1046,11 +1046,6 @@ static void readspriteinfo(MYFILE *f, INT32 num, boolean sprite2)
|
|||
spriteinfo_t *info = Z_Calloc(sizeof(spriteinfo_t), PU_STATIC, NULL);
|
||||
info->available = true;
|
||||
|
||||
#ifdef ROTSPRITE
|
||||
if ((sprites != NULL) && (!sprite2))
|
||||
R_FreeRotSprite(&sprites[num]);
|
||||
#endif
|
||||
|
||||
do
|
||||
{
|
||||
lastline = f->curpos;
|
||||
|
@ -1179,9 +1174,6 @@ static void readspriteinfo(MYFILE *f, INT32 num, boolean sprite2)
|
|||
size_t skinnum = skinnumbers[i];
|
||||
skin_t *skin = &skins[skinnum];
|
||||
spriteinfo_t *sprinfo = skin->sprinfo;
|
||||
#ifdef ROTSPRITE
|
||||
R_FreeSkinRotSprite(skinnum);
|
||||
#endif
|
||||
M_Memcpy(&sprinfo[num], info, sizeof(spriteinfo_t));
|
||||
}
|
||||
}
|
||||
|
|
294
src/f_finale.c
294
src/f_finale.c
|
@ -528,78 +528,78 @@ static void F_IntroDrawScene(void)
|
|||
case 0:
|
||||
break;
|
||||
case 1:
|
||||
background = W_CachePatchName("INTRO1", PU_PATCH);
|
||||
background = W_CachePatchName("INTRO1", PU_PATCH_LOWPRIORITY);
|
||||
break;
|
||||
case 2:
|
||||
background = W_CachePatchName("INTRO2", PU_PATCH);
|
||||
background = W_CachePatchName("INTRO2", PU_PATCH_LOWPRIORITY);
|
||||
break;
|
||||
case 3:
|
||||
background = W_CachePatchName("INTRO3", PU_PATCH);
|
||||
background = W_CachePatchName("INTRO3", PU_PATCH_LOWPRIORITY);
|
||||
break;
|
||||
case 4:
|
||||
background = W_CachePatchName("INTRO4", PU_PATCH);
|
||||
background = W_CachePatchName("INTRO4", PU_PATCH_LOWPRIORITY);
|
||||
break;
|
||||
case 5:
|
||||
if (intro_curtime >= 5*TICRATE)
|
||||
background = W_CachePatchName("RADAR", PU_PATCH);
|
||||
background = W_CachePatchName("RADAR", PU_PATCH_LOWPRIORITY);
|
||||
else
|
||||
background = W_CachePatchName("DRAT", PU_PATCH);
|
||||
background = W_CachePatchName("DRAT", PU_PATCH_LOWPRIORITY);
|
||||
break;
|
||||
case 6:
|
||||
background = W_CachePatchName("INTRO6", PU_PATCH);
|
||||
background = W_CachePatchName("INTRO6", PU_PATCH_LOWPRIORITY);
|
||||
cx = 180;
|
||||
cy = 8;
|
||||
break;
|
||||
case 7:
|
||||
{
|
||||
if (intro_curtime >= 7*TICRATE + ((TICRATE/7)*2))
|
||||
background = W_CachePatchName("SGRASS5", PU_PATCH);
|
||||
background = W_CachePatchName("SGRASS5", PU_PATCH_LOWPRIORITY);
|
||||
else if (intro_curtime >= 7*TICRATE + (TICRATE/7))
|
||||
background = W_CachePatchName("SGRASS4", PU_PATCH);
|
||||
background = W_CachePatchName("SGRASS4", PU_PATCH_LOWPRIORITY);
|
||||
else if (intro_curtime >= 7*TICRATE)
|
||||
background = W_CachePatchName("SGRASS3", PU_PATCH);
|
||||
background = W_CachePatchName("SGRASS3", PU_PATCH_LOWPRIORITY);
|
||||
else if (intro_curtime >= 6*TICRATE)
|
||||
background = W_CachePatchName("SGRASS2", PU_PATCH);
|
||||
background = W_CachePatchName("SGRASS2", PU_PATCH_LOWPRIORITY);
|
||||
else
|
||||
background = W_CachePatchName("SGRASS1", PU_PATCH);
|
||||
background = W_CachePatchName("SGRASS1", PU_PATCH_LOWPRIORITY);
|
||||
break;
|
||||
}
|
||||
case 8:
|
||||
background = W_CachePatchName("WATCHING", PU_PATCH);
|
||||
background = W_CachePatchName("WATCHING", PU_PATCH_LOWPRIORITY);
|
||||
break;
|
||||
case 9:
|
||||
background = W_CachePatchName("ZOOMING", PU_PATCH);
|
||||
background = W_CachePatchName("ZOOMING", PU_PATCH_LOWPRIORITY);
|
||||
break;
|
||||
case 10:
|
||||
break;
|
||||
case 11:
|
||||
background = W_CachePatchName("INTRO5", PU_PATCH);
|
||||
background = W_CachePatchName("INTRO5", PU_PATCH_LOWPRIORITY);
|
||||
break;
|
||||
case 12:
|
||||
background = W_CachePatchName("REVENGE", PU_PATCH);
|
||||
background = W_CachePatchName("REVENGE", PU_PATCH_LOWPRIORITY);
|
||||
cx = 208;
|
||||
cy = 8;
|
||||
break;
|
||||
case 13:
|
||||
background = W_CachePatchName("CONFRONT", PU_PATCH);
|
||||
background = W_CachePatchName("CONFRONT", PU_PATCH_LOWPRIORITY);
|
||||
cy += 48;
|
||||
break;
|
||||
case 14:
|
||||
background = W_CachePatchName("TAILSSAD", PU_PATCH);
|
||||
background = W_CachePatchName("TAILSSAD", PU_PATCH_LOWPRIORITY);
|
||||
bgxoffs = 144;
|
||||
cx = 8;
|
||||
cy = 8;
|
||||
break;
|
||||
case 15:
|
||||
if (intro_curtime >= 7*TICRATE)
|
||||
background = W_CachePatchName("SONICDO2", PU_PATCH);
|
||||
background = W_CachePatchName("SONICDO2", PU_PATCH_LOWPRIORITY);
|
||||
else
|
||||
background = W_CachePatchName("SONICDO1", PU_PATCH);
|
||||
background = W_CachePatchName("SONICDO1", PU_PATCH_LOWPRIORITY);
|
||||
cx = 224;
|
||||
cy = 8;
|
||||
break;
|
||||
case 16:
|
||||
background = W_CachePatchName("INTRO7", PU_PATCH);
|
||||
background = W_CachePatchName("INTRO7", PU_PATCH_LOWPRIORITY);
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
|
@ -629,30 +629,30 @@ static void F_IntroDrawScene(void)
|
|||
S_ChangeMusicInternal("_stjr", false);
|
||||
x = (BASEVIDWIDTH<<FRACBITS)/2 - FixedMul(334<<FRACBITS, aspect)/2;
|
||||
y = (BASEVIDHEIGHT<<FRACBITS)/2 - FixedMul(358<<FRACBITS, aspect)/2;
|
||||
V_DrawSciencePatch(x, y, 0, (patch = W_CachePatchName("WAHH1", PU_PATCH)), aspect);
|
||||
V_DrawSciencePatch(x, y, 0, (patch = W_CachePatchName("WAHH1", PU_PATCH_LOWPRIORITY)), aspect);
|
||||
W_UnlockCachedPatch(patch);
|
||||
if (finalecount > 6) {
|
||||
V_DrawSciencePatch(x, y, 0, (patch = W_CachePatchName("WAHH2", PU_PATCH)), aspect);
|
||||
V_DrawSciencePatch(x, y, 0, (patch = W_CachePatchName("WAHH2", PU_PATCH_LOWPRIORITY)), aspect);
|
||||
W_UnlockCachedPatch(patch);
|
||||
}
|
||||
if (finalecount > 10) {
|
||||
V_DrawSciencePatch(x, y, 0, (patch = W_CachePatchName("WAHH3", PU_PATCH)), aspect);
|
||||
V_DrawSciencePatch(x, y, 0, (patch = W_CachePatchName("WAHH3", PU_PATCH_LOWPRIORITY)), aspect);
|
||||
W_UnlockCachedPatch(patch);
|
||||
}
|
||||
if (finalecount > 14) {
|
||||
V_DrawSciencePatch(x, y, 0, (patch = W_CachePatchName("WAHH4", PU_PATCH)), aspect);
|
||||
V_DrawSciencePatch(x, y, 0, (patch = W_CachePatchName("WAHH4", PU_PATCH_LOWPRIORITY)), aspect);
|
||||
W_UnlockCachedPatch(patch);
|
||||
}
|
||||
}
|
||||
else if (finalecount-30 < 20) { // Big eggy
|
||||
background = W_CachePatchName("FEEDIN", PU_PATCH);
|
||||
background = W_CachePatchName("FEEDIN", PU_PATCH_LOWPRIORITY);
|
||||
x = (BASEVIDWIDTH<<FRACBITS)/2 - FixedMul(560<<FRACBITS, aspect)/2;
|
||||
y = (BASEVIDHEIGHT<<FRACBITS) - FixedMul(477<<FRACBITS, aspect);
|
||||
V_DrawSciencePatch(x, y, V_SNAPTOBOTTOM, background, aspect);
|
||||
}
|
||||
else if (finalecount-50 < 30) { // Zoom out
|
||||
fixed_t scale = FixedDiv(aspect, FixedDiv((finalecount-50)<<FRACBITS, (15<<FRACBITS))+FRACUNIT);
|
||||
background = W_CachePatchName("FEEDIN", PU_PATCH);
|
||||
background = W_CachePatchName("FEEDIN", PU_PATCH_LOWPRIORITY);
|
||||
x = (BASEVIDWIDTH<<FRACBITS)/2 - FixedMul(560<<FRACBITS, aspect)/2 + (FixedMul(560<<FRACBITS, aspect) - FixedMul(560<<FRACBITS, scale));
|
||||
y = (BASEVIDHEIGHT<<FRACBITS) - FixedMul(477<<FRACBITS, scale);
|
||||
V_DrawSciencePatch(x, y, V_SNAPTOBOTTOM, background, scale);
|
||||
|
@ -662,7 +662,7 @@ static void F_IntroDrawScene(void)
|
|||
{
|
||||
// Draw tiny eggy
|
||||
fixed_t scale = FixedMul(FRACUNIT/3, aspect);
|
||||
background = W_CachePatchName("FEEDIN", PU_PATCH);
|
||||
background = W_CachePatchName("FEEDIN", PU_PATCH_LOWPRIORITY);
|
||||
x = (BASEVIDWIDTH<<FRACBITS)/2 - FixedMul(560<<FRACBITS, aspect)/2 + (FixedMul(560<<FRACBITS, aspect) - FixedMul(560<<FRACBITS, scale));
|
||||
y = (BASEVIDHEIGHT<<FRACBITS) - FixedMul(477<<FRACBITS, scale);
|
||||
V_DrawSciencePatch(x, y, V_SNAPTOBOTTOM, background, scale);
|
||||
|
@ -673,34 +673,34 @@ static void F_IntroDrawScene(void)
|
|||
x = (-189*FRACUNIT) + (FixedMul((6<<FRACBITS)+FRACUNIT/3, ftime<<FRACBITS) - FixedMul((6<<FRACBITS)+FRACUNIT/3, FixedDiv(FixedMul(ftime<<FRACBITS, ftime<<FRACBITS), 120<<FRACBITS)));
|
||||
y = (BASEVIDHEIGHT<<FRACBITS) - FixedMul(417<<FRACBITS, aspect);
|
||||
// Draw the body
|
||||
V_DrawSciencePatch(x, y, V_SNAPTOLEFT|V_SNAPTOBOTTOM, (patch = W_CachePatchName("PUREFAT1", PU_PATCH)), aspect);
|
||||
V_DrawSciencePatch(x, y, V_SNAPTOLEFT|V_SNAPTOBOTTOM, (patch = W_CachePatchName("PUREFAT1", PU_PATCH_LOWPRIORITY)), aspect);
|
||||
W_UnlockCachedPatch(patch);
|
||||
// Draw the door
|
||||
V_DrawSciencePatch(x+FixedMul(344<<FRACBITS, aspect), y+FixedMul(292<<FRACBITS, aspect), V_SNAPTOLEFT|V_SNAPTOBOTTOM, (patch = W_CachePatchName("PUREFAT2", PU_PATCH)), aspect);
|
||||
V_DrawSciencePatch(x+FixedMul(344<<FRACBITS, aspect), y+FixedMul(292<<FRACBITS, aspect), V_SNAPTOLEFT|V_SNAPTOBOTTOM, (patch = W_CachePatchName("PUREFAT2", PU_PATCH_LOWPRIORITY)), aspect);
|
||||
W_UnlockCachedPatch(patch);
|
||||
// Draw the wheel
|
||||
V_DrawSciencePatch(x+FixedMul(178<<FRACBITS, aspect), y+FixedMul(344<<FRACBITS, aspect), V_SNAPTOLEFT|V_SNAPTOBOTTOM, (patch = W_CachePatchName(va("TYRE%02u",(abs(finalecount-144)/3)%16), PU_PATCH)), aspect);
|
||||
V_DrawSciencePatch(x+FixedMul(178<<FRACBITS, aspect), y+FixedMul(344<<FRACBITS, aspect), V_SNAPTOLEFT|V_SNAPTOBOTTOM, (patch = W_CachePatchName(va("TYRE%02u",(abs(finalecount-144)/3)%16), PU_PATCH_LOWPRIORITY)), aspect);
|
||||
W_UnlockCachedPatch(patch);
|
||||
// Draw the wheel cover
|
||||
V_DrawSciencePatch(x+FixedMul(88<<FRACBITS, aspect), y+FixedMul(238<<FRACBITS, aspect), V_SNAPTOLEFT|V_SNAPTOBOTTOM, (patch = W_CachePatchName("PUREFAT3", PU_PATCH)), aspect);
|
||||
V_DrawSciencePatch(x+FixedMul(88<<FRACBITS, aspect), y+FixedMul(238<<FRACBITS, aspect), V_SNAPTOLEFT|V_SNAPTOBOTTOM, (patch = W_CachePatchName("PUREFAT3", PU_PATCH_LOWPRIORITY)), aspect);
|
||||
W_UnlockCachedPatch(patch);
|
||||
} else { // Pure Fat has stopped!
|
||||
y = (BASEVIDHEIGHT<<FRACBITS) - FixedMul(417<<FRACBITS, aspect);
|
||||
// Draw the body
|
||||
V_DrawSciencePatch(0, y, V_SNAPTOLEFT|V_SNAPTOBOTTOM, (patch = W_CachePatchName("PUREFAT1", PU_PATCH)), aspect);
|
||||
V_DrawSciencePatch(0, y, V_SNAPTOLEFT|V_SNAPTOBOTTOM, (patch = W_CachePatchName("PUREFAT1", PU_PATCH_LOWPRIORITY)), aspect);
|
||||
W_UnlockCachedPatch(patch);
|
||||
// Draw the wheel
|
||||
V_DrawSciencePatch(FixedMul(178<<FRACBITS, aspect), y+FixedMul(344<<FRACBITS, aspect), V_SNAPTOLEFT|V_SNAPTOBOTTOM, (patch = W_CachePatchName("TYRE00", PU_PATCH)), aspect);
|
||||
V_DrawSciencePatch(FixedMul(178<<FRACBITS, aspect), y+FixedMul(344<<FRACBITS, aspect), V_SNAPTOLEFT|V_SNAPTOBOTTOM, (patch = W_CachePatchName("TYRE00", PU_PATCH_LOWPRIORITY)), aspect);
|
||||
W_UnlockCachedPatch(patch);
|
||||
// Draw the wheel cover
|
||||
V_DrawSciencePatch(FixedMul(88<<FRACBITS, aspect), y+FixedMul(238<<FRACBITS, aspect), V_SNAPTOLEFT|V_SNAPTOBOTTOM, (patch = W_CachePatchName("PUREFAT3", PU_PATCH)), aspect);
|
||||
V_DrawSciencePatch(FixedMul(88<<FRACBITS, aspect), y+FixedMul(238<<FRACBITS, aspect), V_SNAPTOLEFT|V_SNAPTOBOTTOM, (patch = W_CachePatchName("PUREFAT3", PU_PATCH_LOWPRIORITY)), aspect);
|
||||
W_UnlockCachedPatch(patch);
|
||||
// Draw the door
|
||||
if (finalecount-TICRATE/2 > 4*TICRATE) { // Door is being raised!
|
||||
int ftime = (finalecount-TICRATE/2-4*TICRATE);
|
||||
y -= FixedDiv((ftime*ftime)<<FRACBITS, 23<<FRACBITS);
|
||||
}
|
||||
V_DrawSciencePatch(FixedMul(344<<FRACBITS, aspect), y+FixedMul(292<<FRACBITS, aspect), V_SNAPTOLEFT|V_SNAPTOBOTTOM, (patch = W_CachePatchName("PUREFAT2", PU_PATCH)), aspect);
|
||||
V_DrawSciencePatch(FixedMul(344<<FRACBITS, aspect), y+FixedMul(292<<FRACBITS, aspect), V_SNAPTOLEFT|V_SNAPTOBOTTOM, (patch = W_CachePatchName("PUREFAT2", PU_PATCH_LOWPRIORITY)), aspect);
|
||||
W_UnlockCachedPatch(patch);
|
||||
}
|
||||
}
|
||||
|
@ -714,27 +714,27 @@ static void F_IntroDrawScene(void)
|
|||
if (timetonext > 5*TICRATE && timetonext < 6*TICRATE)
|
||||
{
|
||||
if (!(finalecount & 3))
|
||||
background = W_CachePatchName("BRITEGG1", PU_PATCH);
|
||||
background = W_CachePatchName("BRITEGG1", PU_PATCH_LOWPRIORITY);
|
||||
else
|
||||
background = W_CachePatchName("DARKEGG1", PU_PATCH);
|
||||
background = W_CachePatchName("DARKEGG1", PU_PATCH_LOWPRIORITY);
|
||||
|
||||
V_DrawSmallScaledPatch(0, 0, 0, background);
|
||||
}
|
||||
else if (timetonext > 3*TICRATE && timetonext < 4*TICRATE)
|
||||
{
|
||||
if (!(finalecount & 3))
|
||||
background = W_CachePatchName("BRITEGG2", PU_PATCH);
|
||||
background = W_CachePatchName("BRITEGG2", PU_PATCH_LOWPRIORITY);
|
||||
else
|
||||
background = W_CachePatchName("DARKEGG2", PU_PATCH);
|
||||
background = W_CachePatchName("DARKEGG2", PU_PATCH_LOWPRIORITY);
|
||||
|
||||
V_DrawSmallScaledPatch(0, 0, 0, background);
|
||||
}
|
||||
else if (timetonext > 1*TICRATE && timetonext < 2*TICRATE)
|
||||
{
|
||||
if (!(finalecount & 3))
|
||||
background = W_CachePatchName("BRITEGG3", PU_PATCH);
|
||||
background = W_CachePatchName("BRITEGG3", PU_PATCH_LOWPRIORITY);
|
||||
else
|
||||
background = W_CachePatchName("DARKEGG3", PU_PATCH);
|
||||
background = W_CachePatchName("DARKEGG3", PU_PATCH_LOWPRIORITY);
|
||||
|
||||
V_DrawSmallScaledPatch(0, 0, 0, background);
|
||||
}
|
||||
|
@ -766,79 +766,79 @@ static void F_IntroDrawScene(void)
|
|||
knucklesx += sonicx;
|
||||
sonicx += P_ReturnThrustX(NULL, finalecount * ANG10, 3);
|
||||
|
||||
V_DrawSmallScaledPatch(skyx, 0, 0, (patch = W_CachePatchName("INTROSKY", PU_PATCH)));
|
||||
V_DrawSmallScaledPatch(skyx, 0, 0, (patch = W_CachePatchName("INTROSKY", PU_PATCH_LOWPRIORITY)));
|
||||
V_DrawSmallScaledPatch(skyx - 320, 0, 0, patch);
|
||||
W_UnlockCachedPatch(patch);
|
||||
V_DrawSmallScaledPatch(grassx, 0, 0, (patch = W_CachePatchName("INTROGRS", PU_PATCH)));
|
||||
V_DrawSmallScaledPatch(grassx, 0, 0, (patch = W_CachePatchName("INTROGRS", PU_PATCH_LOWPRIORITY)));
|
||||
V_DrawSmallScaledPatch(grassx - 320, 0, 0, patch);
|
||||
W_UnlockCachedPatch(patch);
|
||||
|
||||
if (finalecount & 1)
|
||||
{
|
||||
// Sonic
|
||||
V_DrawSmallScaledPatch(sonicx, 54, 0, (patch = W_CachePatchName("RUN2", PU_PATCH)));
|
||||
V_DrawSmallScaledPatch(sonicx, 54, 0, (patch = W_CachePatchName("RUN2", PU_PATCH_LOWPRIORITY)));
|
||||
W_UnlockCachedPatch(patch);
|
||||
|
||||
// Appendages
|
||||
if (finalecount & 2)
|
||||
{
|
||||
// Sonic's feet
|
||||
V_DrawSmallScaledPatch(sonicx - 8, 92, 0, (patch = W_CachePatchName("PEELOUT4", PU_PATCH)));
|
||||
V_DrawSmallScaledPatch(sonicx - 8, 92, 0, (patch = W_CachePatchName("PEELOUT4", PU_PATCH_LOWPRIORITY)));
|
||||
W_UnlockCachedPatch(patch);
|
||||
// Tails' tails
|
||||
V_DrawSmallScaledPatch(tailsx, tailsy, 0, (patch = W_CachePatchName("HELICOP2", PU_PATCH)));
|
||||
V_DrawSmallScaledPatch(tailsx, tailsy, 0, (patch = W_CachePatchName("HELICOP2", PU_PATCH_LOWPRIORITY)));
|
||||
W_UnlockCachedPatch(patch);
|
||||
}
|
||||
else
|
||||
{
|
||||
// Sonic's feet
|
||||
V_DrawSmallScaledPatch(sonicx - 8, 92, 0, (patch = W_CachePatchName("PEELOUT2", PU_PATCH)));
|
||||
V_DrawSmallScaledPatch(sonicx - 8, 92, 0, (patch = W_CachePatchName("PEELOUT2", PU_PATCH_LOWPRIORITY)));
|
||||
W_UnlockCachedPatch(patch);
|
||||
// Tails' tails
|
||||
V_DrawSmallScaledPatch(tailsx, tailsy, 0, (patch = W_CachePatchName("HELICOP1", PU_PATCH)));
|
||||
V_DrawSmallScaledPatch(tailsx, tailsy, 0, (patch = W_CachePatchName("HELICOP1", PU_PATCH_LOWPRIORITY)));
|
||||
W_UnlockCachedPatch(patch);
|
||||
}
|
||||
|
||||
// Tails
|
||||
V_DrawSmallScaledPatch(tailsx, tailsy, 0, (patch = W_CachePatchName("FLY2", PU_PATCH)));
|
||||
V_DrawSmallScaledPatch(tailsx, tailsy, 0, (patch = W_CachePatchName("FLY2", PU_PATCH_LOWPRIORITY)));
|
||||
W_UnlockCachedPatch(patch);
|
||||
|
||||
// Knuckles
|
||||
V_DrawSmallScaledPatch(knucklesx, knucklesy, 0, (patch = W_CachePatchName("GLIDE2", PU_PATCH)));
|
||||
V_DrawSmallScaledPatch(knucklesx, knucklesy, 0, (patch = W_CachePatchName("GLIDE2", PU_PATCH_LOWPRIORITY)));
|
||||
W_UnlockCachedPatch(patch);
|
||||
}
|
||||
else
|
||||
{
|
||||
// Sonic
|
||||
V_DrawSmallScaledPatch(sonicx, 54, 0, (patch = W_CachePatchName("RUN1", PU_PATCH)));
|
||||
V_DrawSmallScaledPatch(sonicx, 54, 0, (patch = W_CachePatchName("RUN1", PU_PATCH_LOWPRIORITY)));
|
||||
W_UnlockCachedPatch(patch);
|
||||
|
||||
// Appendages
|
||||
if (finalecount & 2)
|
||||
{
|
||||
// Sonic's feet
|
||||
V_DrawSmallScaledPatch(sonicx - 8, 92, 0, (patch = W_CachePatchName("PEELOUT3", PU_PATCH)));
|
||||
V_DrawSmallScaledPatch(sonicx - 8, 92, 0, (patch = W_CachePatchName("PEELOUT3", PU_PATCH_LOWPRIORITY)));
|
||||
W_UnlockCachedPatch(patch);
|
||||
// Tails' tails
|
||||
V_DrawSmallScaledPatch(tailsx, tailsy, 0, (patch = W_CachePatchName("HELICOP2", PU_PATCH)));
|
||||
V_DrawSmallScaledPatch(tailsx, tailsy, 0, (patch = W_CachePatchName("HELICOP2", PU_PATCH_LOWPRIORITY)));
|
||||
W_UnlockCachedPatch(patch);
|
||||
}
|
||||
else
|
||||
{
|
||||
// Sonic's feet
|
||||
V_DrawSmallScaledPatch(sonicx - 8, 92, 0, (patch = W_CachePatchName("PEELOUT1", PU_PATCH)));
|
||||
V_DrawSmallScaledPatch(sonicx - 8, 92, 0, (patch = W_CachePatchName("PEELOUT1", PU_PATCH_LOWPRIORITY)));
|
||||
W_UnlockCachedPatch(patch);
|
||||
// Tails' tails
|
||||
V_DrawSmallScaledPatch(tailsx, tailsy, 0, (patch = W_CachePatchName("HELICOP1", PU_PATCH)));
|
||||
V_DrawSmallScaledPatch(tailsx, tailsy, 0, (patch = W_CachePatchName("HELICOP1", PU_PATCH_LOWPRIORITY)));
|
||||
W_UnlockCachedPatch(patch);
|
||||
}
|
||||
|
||||
// Tails
|
||||
V_DrawSmallScaledPatch(tailsx, tailsy, 0, (patch = W_CachePatchName("FLY1", PU_PATCH)));
|
||||
V_DrawSmallScaledPatch(tailsx, tailsy, 0, (patch = W_CachePatchName("FLY1", PU_PATCH_LOWPRIORITY)));
|
||||
W_UnlockCachedPatch(patch);
|
||||
|
||||
// Knuckles
|
||||
V_DrawSmallScaledPatch(knucklesx, knucklesy, 0, (patch = W_CachePatchName("GLIDE1", PU_PATCH)));
|
||||
V_DrawSmallScaledPatch(knucklesx, knucklesy, 0, (patch = W_CachePatchName("GLIDE1", PU_PATCH_LOWPRIORITY)));
|
||||
W_UnlockCachedPatch(patch);
|
||||
}
|
||||
|
||||
|
@ -871,8 +871,8 @@ static void F_IntroDrawScene(void)
|
|||
y += (30*(FRACUNIT-scale));
|
||||
}
|
||||
|
||||
rockpat = W_CachePatchName(va("ROID00%.2d", 34 - (worktics % 35)), PU_PATCH);
|
||||
glow = W_CachePatchName(va("ENDGLOW%.1d", 2+(worktics & 1)), PU_PATCH);
|
||||
rockpat = W_CachePatchName(va("ROID00%.2d", 34 - (worktics % 35)), PU_PATCH_LOWPRIORITY);
|
||||
glow = W_CachePatchName(va("ENDGLOW%.1d", 2+(worktics & 1)), PU_PATCH_LOWPRIORITY);
|
||||
|
||||
if (worktics >= 5)
|
||||
trans = (worktics-5)>>1;
|
||||
|
@ -986,7 +986,7 @@ void F_IntroDrawer(void)
|
|||
{
|
||||
if (intro_scenenum == 5 && intro_curtime == 5*TICRATE)
|
||||
{
|
||||
patch_t *radar = W_CachePatchName("RADAR", PU_PATCH);
|
||||
patch_t *radar = W_CachePatchName("RADAR", PU_PATCH_LOWPRIORITY);
|
||||
|
||||
F_WipeStartScreen();
|
||||
F_WipeColorFill(31);
|
||||
|
@ -999,7 +999,7 @@ void F_IntroDrawer(void)
|
|||
}
|
||||
else if (intro_scenenum == 7 && intro_curtime == 6*TICRATE) // Force a wipe here
|
||||
{
|
||||
patch_t *grass = W_CachePatchName("SGRASS2", PU_PATCH);
|
||||
patch_t *grass = W_CachePatchName("SGRASS2", PU_PATCH_LOWPRIORITY);
|
||||
|
||||
F_WipeStartScreen();
|
||||
F_WipeColorFill(31);
|
||||
|
@ -1012,7 +1012,7 @@ void F_IntroDrawer(void)
|
|||
}
|
||||
/*else if (intro_scenenum == 12 && intro_curtime == 7*TICRATE)
|
||||
{
|
||||
patch_t *confront = W_CachePatchName("CONFRONT", PU_PATCH);
|
||||
patch_t *confront = W_CachePatchName("CONFRONT", PU_PATCH_LOWPRIORITY);
|
||||
|
||||
F_WipeStartScreen();
|
||||
F_WipeColorFill(31);
|
||||
|
@ -1025,7 +1025,7 @@ void F_IntroDrawer(void)
|
|||
}*/
|
||||
if (intro_scenenum == 15 && intro_curtime == 7*TICRATE)
|
||||
{
|
||||
patch_t *sdo = W_CachePatchName("SONICDO2", PU_PATCH);
|
||||
patch_t *sdo = W_CachePatchName("SONICDO2", PU_PATCH_LOWPRIORITY);
|
||||
|
||||
F_WipeStartScreen();
|
||||
F_WipeColorFill(31);
|
||||
|
@ -1361,14 +1361,14 @@ void F_CreditDrawer(void)
|
|||
V_DrawFill(0, 0, BASEVIDWIDTH, BASEVIDHEIGHT, 31);
|
||||
|
||||
// Zig Zagz
|
||||
V_DrawScaledPatch(-16, zagpos, V_SNAPTOLEFT, W_CachePatchName("LTZIGZAG", PU_PATCH));
|
||||
V_DrawScaledPatch(-16, zagpos - 320, V_SNAPTOLEFT, W_CachePatchName("LTZIGZAG", PU_PATCH));
|
||||
V_DrawScaledPatch(BASEVIDWIDTH + 16, zagpos, V_SNAPTORIGHT|V_FLIP, W_CachePatchName("LTZIGZAG", PU_PATCH));
|
||||
V_DrawScaledPatch(BASEVIDWIDTH + 16, zagpos - 320, V_SNAPTORIGHT|V_FLIP, W_CachePatchName("LTZIGZAG", PU_PATCH));
|
||||
V_DrawScaledPatch(-16, zagpos, V_SNAPTOLEFT, W_CachePatchName("LTZIGZAG", PU_PATCH_LOWPRIORITY));
|
||||
V_DrawScaledPatch(-16, zagpos - 320, V_SNAPTOLEFT, W_CachePatchName("LTZIGZAG", PU_PATCH_LOWPRIORITY));
|
||||
V_DrawScaledPatch(BASEVIDWIDTH + 16, zagpos, V_SNAPTORIGHT|V_FLIP, W_CachePatchName("LTZIGZAG", PU_PATCH_LOWPRIORITY));
|
||||
V_DrawScaledPatch(BASEVIDWIDTH + 16, zagpos - 320, V_SNAPTORIGHT|V_FLIP, W_CachePatchName("LTZIGZAG", PU_PATCH_LOWPRIORITY));
|
||||
|
||||
// Draw background pictures first
|
||||
for (i = 0; credits_pics[i].patch; i++)
|
||||
V_DrawSciencePatch(credits_pics[i].x<<FRACBITS, (280<<FRACBITS) + (((i*credits_height)<<FRACBITS)/(credits_numpics)) - 4*(animtimer<<FRACBITS)/5, 0, W_CachePatchName(credits_pics[i].patch, PU_PATCH), FRACUNIT>>1);
|
||||
V_DrawSciencePatch(credits_pics[i].x<<FRACBITS, (280<<FRACBITS) + (((i*credits_height)<<FRACBITS)/(credits_numpics)) - 4*(animtimer<<FRACBITS)/5, 0, W_CachePatchName(credits_pics[i].patch, PU_PATCH_LOWPRIORITY), FRACUNIT>>1);
|
||||
|
||||
// Dim the background
|
||||
V_DrawFadeScreen(0xFF00, 16);
|
||||
|
@ -1577,14 +1577,14 @@ void F_GameEvaluationDrawer(void)
|
|||
|
||||
if (goodending)
|
||||
{
|
||||
rockpat = W_CachePatchName(va("ROID00%.2d", 34 - (finalecount % 35)), PU_PATCH);
|
||||
glow = W_CachePatchName(va("ENDGLOW%.1d", 2+(finalecount & 1)), PU_PATCH);
|
||||
rockpat = W_CachePatchName(va("ROID00%.2d", 34 - (finalecount % 35)), PU_PATCH_LOWPRIORITY);
|
||||
glow = W_CachePatchName(va("ENDGLOW%.1d", 2+(finalecount & 1)), PU_PATCH_LOWPRIORITY);
|
||||
x -= FRACUNIT;
|
||||
}
|
||||
else
|
||||
{
|
||||
rockpat = W_CachePatchName("ROID0000", PU_LEVEL);
|
||||
glow = W_CachePatchName(va("ENDGLOW%.1d", (finalecount & 1)), PU_PATCH);
|
||||
rockpat = W_CachePatchName("ROID0000", PU_PATCH_LOWPRIORITY);
|
||||
glow = W_CachePatchName(va("ENDGLOW%.1d", (finalecount & 1)), PU_PATCH_LOWPRIORITY);
|
||||
}
|
||||
|
||||
if (finalecount >= 5)
|
||||
|
@ -1616,20 +1616,20 @@ void F_GameEvaluationDrawer(void)
|
|||
// if j == 0 - alternate between 0 and 1
|
||||
// 1 - 1 and 2
|
||||
// 2 - 2 and not rendered
|
||||
V_DrawFixedPatch(x+sparkloffs[j-1][0], y+sparkloffs[j-1][1], FRACUNIT, 0, W_CachePatchName(va("ENDSPKL%.1d", (j - ((sparklloop & 1) ? 0 : 1))), PU_PATCH), R_GetTranslationColormap(TC_DEFAULT, SKINCOLOR_AQUA, GTC_CACHE));
|
||||
V_DrawFixedPatch(x+sparkloffs[j-1][0], y+sparkloffs[j-1][1], FRACUNIT, 0, W_CachePatchName(va("ENDSPKL%.1d", (j - ((sparklloop & 1) ? 0 : 1))), PU_PATCH_LOWPRIORITY), R_GetTranslationColormap(TC_DEFAULT, SKINCOLOR_AQUA, GTC_CACHE));
|
||||
}
|
||||
j--;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
patch_t *eggrock = W_CachePatchName("ENDEGRK5", PU_PATCH);
|
||||
patch_t *eggrock = W_CachePatchName("ENDEGRK5", PU_PATCH_LOWPRIORITY);
|
||||
V_DrawFixedPatch(x, y, scale, 0, eggrock, colormap[0]);
|
||||
if (trans < 10)
|
||||
V_DrawFixedPatch(x, y, scale, trans<<V_ALPHASHIFT, eggrock, colormap[1]);
|
||||
else if (sparklloop)
|
||||
V_DrawFixedPatch(x, y, scale, (10-sparklloop)<<V_ALPHASHIFT,
|
||||
W_CachePatchName("ENDEGRK0", PU_PATCH), colormap[1]);
|
||||
W_CachePatchName("ENDEGRK0", PU_PATCH_LOWPRIORITY), colormap[1]);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1643,7 +1643,7 @@ void F_GameEvaluationDrawer(void)
|
|||
eemeralds_cur += (360<<FRACBITS)/7;
|
||||
|
||||
patchname[4] = 'A'+(char)i;
|
||||
V_DrawFixedPatch(x, y, FRACUNIT, ((emeralds & (1<<i)) ? 0 : V_80TRANS), W_CachePatchName(patchname, PU_PATCH), NULL);
|
||||
V_DrawFixedPatch(x, y, FRACUNIT, ((emeralds & (1<<i)) ? 0 : V_80TRANS), W_CachePatchName(patchname, PU_PATCH_LOWPRIORITY), NULL);
|
||||
}
|
||||
|
||||
V_DrawCreditString((BASEVIDWIDTH - V_CreditStringWidth(endingtext))<<(FRACBITS-1), (BASEVIDHEIGHT-100)<<(FRACBITS-1), 0, endingtext);
|
||||
|
@ -1772,32 +1772,32 @@ void F_GameEvaluationTicker(void)
|
|||
|
||||
static void F_CacheEnding(void)
|
||||
{
|
||||
endbrdr[1] = W_CachePatchName("ENDBRDR1", PU_PATCH);
|
||||
endbrdr[1] = W_CachePatchName("ENDBRDR1", PU_PATCH_LOWPRIORITY);
|
||||
|
||||
endegrk[0] = W_CachePatchName("ENDEGRK0", PU_PATCH);
|
||||
endegrk[1] = W_CachePatchName("ENDEGRK1", PU_PATCH);
|
||||
endegrk[0] = W_CachePatchName("ENDEGRK0", PU_PATCH_LOWPRIORITY);
|
||||
endegrk[1] = W_CachePatchName("ENDEGRK1", PU_PATCH_LOWPRIORITY);
|
||||
|
||||
endglow[0] = W_CachePatchName("ENDGLOW0", PU_PATCH);
|
||||
endglow[1] = W_CachePatchName("ENDGLOW1", PU_PATCH);
|
||||
endglow[0] = W_CachePatchName("ENDGLOW0", PU_PATCH_LOWPRIORITY);
|
||||
endglow[1] = W_CachePatchName("ENDGLOW1", PU_PATCH_LOWPRIORITY);
|
||||
|
||||
endbgsp[0] = W_CachePatchName("ENDBGSP0", PU_PATCH);
|
||||
endbgsp[1] = W_CachePatchName("ENDBGSP1", PU_PATCH);
|
||||
endbgsp[2] = W_CachePatchName("ENDBGSP2", PU_PATCH);
|
||||
endbgsp[0] = W_CachePatchName("ENDBGSP0", PU_PATCH_LOWPRIORITY);
|
||||
endbgsp[1] = W_CachePatchName("ENDBGSP1", PU_PATCH_LOWPRIORITY);
|
||||
endbgsp[2] = W_CachePatchName("ENDBGSP2", PU_PATCH_LOWPRIORITY);
|
||||
|
||||
endspkl[0] = W_CachePatchName("ENDSPKL0", PU_PATCH);
|
||||
endspkl[1] = W_CachePatchName("ENDSPKL1", PU_PATCH);
|
||||
endspkl[2] = W_CachePatchName("ENDSPKL2", PU_PATCH);
|
||||
endspkl[0] = W_CachePatchName("ENDSPKL0", PU_PATCH_LOWPRIORITY);
|
||||
endspkl[1] = W_CachePatchName("ENDSPKL1", PU_PATCH_LOWPRIORITY);
|
||||
endspkl[2] = W_CachePatchName("ENDSPKL2", PU_PATCH_LOWPRIORITY);
|
||||
|
||||
endxpld[0] = W_CachePatchName("ENDXPLD0", PU_PATCH);
|
||||
endxpld[1] = W_CachePatchName("ENDXPLD1", PU_PATCH);
|
||||
endxpld[2] = W_CachePatchName("ENDXPLD2", PU_PATCH);
|
||||
endxpld[3] = W_CachePatchName("ENDXPLD3", PU_PATCH);
|
||||
endxpld[0] = W_CachePatchName("ENDXPLD0", PU_PATCH_LOWPRIORITY);
|
||||
endxpld[1] = W_CachePatchName("ENDXPLD1", PU_PATCH_LOWPRIORITY);
|
||||
endxpld[2] = W_CachePatchName("ENDXPLD2", PU_PATCH_LOWPRIORITY);
|
||||
endxpld[3] = W_CachePatchName("ENDXPLD3", PU_PATCH_LOWPRIORITY);
|
||||
|
||||
endescp[0] = W_CachePatchName("ENDESCP0", PU_PATCH);
|
||||
endescp[1] = W_CachePatchName("ENDESCP1", PU_PATCH);
|
||||
endescp[2] = W_CachePatchName("ENDESCP2", PU_PATCH);
|
||||
endescp[3] = W_CachePatchName("ENDESCP3", PU_PATCH);
|
||||
endescp[4] = W_CachePatchName("ENDESCP4", PU_PATCH);
|
||||
endescp[0] = W_CachePatchName("ENDESCP0", PU_PATCH_LOWPRIORITY);
|
||||
endescp[1] = W_CachePatchName("ENDESCP1", PU_PATCH_LOWPRIORITY);
|
||||
endescp[2] = W_CachePatchName("ENDESCP2", PU_PATCH_LOWPRIORITY);
|
||||
endescp[3] = W_CachePatchName("ENDESCP3", PU_PATCH_LOWPRIORITY);
|
||||
endescp[4] = W_CachePatchName("ENDESCP4", PU_PATCH_LOWPRIORITY);
|
||||
|
||||
// so we only need to check once
|
||||
if ((goodending = ALL7EMERALDS(emeralds)))
|
||||
|
@ -1810,41 +1810,41 @@ static void F_CacheEnding(void)
|
|||
sprdef = &skins[skinnum].sprites[SPR2_XTRA];
|
||||
// character head, skin specific
|
||||
sprframe = &sprdef->spriteframes[XTRA_ENDING];
|
||||
endfwrk[0] = W_CachePatchNum(sprframe->lumppat[0], PU_PATCH);
|
||||
endfwrk[0] = W_CachePatchNum(sprframe->lumppat[0], PU_PATCH_LOWPRIORITY);
|
||||
sprframe = &sprdef->spriteframes[XTRA_ENDING+1];
|
||||
endfwrk[1] = W_CachePatchNum(sprframe->lumppat[0], PU_PATCH);
|
||||
endfwrk[1] = W_CachePatchNum(sprframe->lumppat[0], PU_PATCH_LOWPRIORITY);
|
||||
sprframe = &sprdef->spriteframes[XTRA_ENDING+2];
|
||||
endfwrk[2] = W_CachePatchNum(sprframe->lumppat[0], PU_PATCH);
|
||||
endfwrk[2] = W_CachePatchNum(sprframe->lumppat[0], PU_PATCH_LOWPRIORITY);
|
||||
}
|
||||
else // Show a star if your character doesn't have an ending firework display. (Basically the MISSINGs for this)
|
||||
{
|
||||
endfwrk[0] = W_CachePatchName("ENDFWRK3", PU_PATCH);
|
||||
endfwrk[1] = W_CachePatchName("ENDFWRK4", PU_PATCH);
|
||||
endfwrk[2] = W_CachePatchName("ENDFWRK5", PU_PATCH);
|
||||
endfwrk[0] = W_CachePatchName("ENDFWRK3", PU_PATCH_LOWPRIORITY);
|
||||
endfwrk[1] = W_CachePatchName("ENDFWRK4", PU_PATCH_LOWPRIORITY);
|
||||
endfwrk[2] = W_CachePatchName("ENDFWRK5", PU_PATCH_LOWPRIORITY);
|
||||
}
|
||||
|
||||
endbrdr[0] = W_CachePatchName("ENDBRDR2", PU_PATCH);
|
||||
endbrdr[0] = W_CachePatchName("ENDBRDR2", PU_PATCH_LOWPRIORITY);
|
||||
}
|
||||
else
|
||||
{
|
||||
// eggman, skin nonspecific
|
||||
endfwrk[0] = W_CachePatchName("ENDFWRK0", PU_PATCH);
|
||||
endfwrk[1] = W_CachePatchName("ENDFWRK1", PU_PATCH);
|
||||
endfwrk[2] = W_CachePatchName("ENDFWRK2", PU_PATCH);
|
||||
endfwrk[0] = W_CachePatchName("ENDFWRK0", PU_PATCH_LOWPRIORITY);
|
||||
endfwrk[1] = W_CachePatchName("ENDFWRK1", PU_PATCH_LOWPRIORITY);
|
||||
endfwrk[2] = W_CachePatchName("ENDFWRK2", PU_PATCH_LOWPRIORITY);
|
||||
|
||||
endbrdr[0] = W_CachePatchName("ENDBRDR0", PU_LEVEL);
|
||||
endbrdr[0] = W_CachePatchName("ENDBRDR0", PU_PATCH_LOWPRIORITY);
|
||||
}
|
||||
}
|
||||
|
||||
static void F_CacheGoodEnding(void)
|
||||
{
|
||||
endegrk[0] = W_CachePatchName("ENDEGRK2", PU_PATCH);
|
||||
endegrk[1] = W_CachePatchName("ENDEGRK3", PU_PATCH);
|
||||
endegrk[0] = W_CachePatchName("ENDEGRK2", PU_PATCH_LOWPRIORITY);
|
||||
endegrk[1] = W_CachePatchName("ENDEGRK3", PU_PATCH_LOWPRIORITY);
|
||||
|
||||
endglow[0] = W_CachePatchName("ENDGLOW2", PU_PATCH);
|
||||
endglow[1] = W_CachePatchName("ENDGLOW3", PU_PATCH);
|
||||
endglow[0] = W_CachePatchName("ENDGLOW2", PU_PATCH_LOWPRIORITY);
|
||||
endglow[1] = W_CachePatchName("ENDGLOW3", PU_PATCH_LOWPRIORITY);
|
||||
|
||||
endxpld[0] = W_CachePatchName("ENDEGRK4", PU_PATCH);
|
||||
endxpld[0] = W_CachePatchName("ENDEGRK4", PU_PATCH_LOWPRIORITY);
|
||||
}
|
||||
|
||||
void F_StartEnding(void)
|
||||
|
@ -1902,9 +1902,9 @@ void F_EndingDrawer(void)
|
|||
patch_t *rockpat;
|
||||
|
||||
if (!goodending || finalecount < INFLECTIONPOINT)
|
||||
rockpat = W_CachePatchName("ROID0000", PU_PATCH);
|
||||
rockpat = W_CachePatchName("ROID0000", PU_PATCH_LOWPRIORITY);
|
||||
else
|
||||
rockpat = W_CachePatchName(va("ROID00%.2d", 34 - ((finalecount - INFLECTIONPOINT) % 35)), PU_PATCH);
|
||||
rockpat = W_CachePatchName(va("ROID00%.2d", 34 - ((finalecount - INFLECTIONPOINT) % 35)), PU_PATCH_LOWPRIORITY);
|
||||
|
||||
V_DrawFill(0, 0, BASEVIDWIDTH, BASEVIDHEIGHT, 31);
|
||||
|
||||
|
@ -2241,7 +2241,7 @@ void F_EndingDrawer(void)
|
|||
eemeralds_cur[0] += (360<<FRACBITS)/7;
|
||||
|
||||
patchname[4] = 'A'+(char)i;
|
||||
V_DrawFixedPatch(x, y, FRACUNIT, 0, W_CachePatchName(patchname, PU_LEVEL), NULL);
|
||||
V_DrawFixedPatch(x, y, FRACUNIT, 0, W_CachePatchName(patchname, PU_PATCH_LOWPRIORITY), NULL);
|
||||
}
|
||||
} // if (goodending...
|
||||
} // (finalecount > 20)
|
||||
|
@ -2388,11 +2388,11 @@ void F_SkyScroll(INT32 scrollxspeed, INT32 scrollyspeed, const char *patchname)
|
|||
|
||||
if (!scrollxspeed && !scrollyspeed)
|
||||
{
|
||||
V_DrawPatchFill(W_CachePatchName(patchname, PU_PATCH));
|
||||
V_DrawPatchFill(W_CachePatchName(patchname, PU_PATCH_LOWPRIORITY));
|
||||
return;
|
||||
}
|
||||
|
||||
pat = W_CachePatchName(patchname, PU_PATCH);
|
||||
pat = W_CachePatchName(patchname, PU_PATCH_LOWPRIORITY);
|
||||
|
||||
patwidth = SHORT(pat->width);
|
||||
patheight = SHORT(pat->height);
|
||||
|
@ -2431,7 +2431,7 @@ void F_SkyScroll(INT32 scrollxspeed, INT32 scrollyspeed, const char *patchname)
|
|||
lumpnum = W_CheckNumForName(name); \
|
||||
if (lumpnum != LUMPERROR) \
|
||||
{ \
|
||||
arr[0] = W_CachePatchName(name, PU_LEVEL); \
|
||||
arr[0] = W_CachePatchName(name, PU_PATCH_LOWPRIORITY); \
|
||||
arr[min(1, maxf-1)] = 0; \
|
||||
} \
|
||||
else if (strlen(name) <= 6) \
|
||||
|
@ -2444,7 +2444,7 @@ else if (strlen(name) <= 6) \
|
|||
lumpname[8] = 0; \
|
||||
lumpnum = W_CheckNumForName(lumpname); \
|
||||
if (lumpnum != LUMPERROR) \
|
||||
arr[i] = W_CachePatchName(lumpname, PU_LEVEL); \
|
||||
arr[i] = W_CachePatchName(lumpname, PU_PATCH_LOWPRIORITY); \
|
||||
else \
|
||||
break; \
|
||||
} \
|
||||
|
@ -2459,21 +2459,21 @@ static void F_CacheTitleScreen(void)
|
|||
{
|
||||
case TTMODE_OLD:
|
||||
case TTMODE_NONE:
|
||||
ttbanner = W_CachePatchName("TTBANNER", PU_LEVEL);
|
||||
ttwing = W_CachePatchName("TTWING", PU_LEVEL);
|
||||
ttsonic = W_CachePatchName("TTSONIC", PU_LEVEL);
|
||||
ttswave1 = W_CachePatchName("TTSWAVE1", PU_LEVEL);
|
||||
ttswave2 = W_CachePatchName("TTSWAVE2", PU_LEVEL);
|
||||
ttswip1 = W_CachePatchName("TTSWIP1", PU_LEVEL);
|
||||
ttsprep1 = W_CachePatchName("TTSPREP1", PU_LEVEL);
|
||||
ttsprep2 = W_CachePatchName("TTSPREP2", PU_LEVEL);
|
||||
ttspop1 = W_CachePatchName("TTSPOP1", PU_LEVEL);
|
||||
ttspop2 = W_CachePatchName("TTSPOP2", PU_LEVEL);
|
||||
ttspop3 = W_CachePatchName("TTSPOP3", PU_LEVEL);
|
||||
ttspop4 = W_CachePatchName("TTSPOP4", PU_LEVEL);
|
||||
ttspop5 = W_CachePatchName("TTSPOP5", PU_LEVEL);
|
||||
ttspop6 = W_CachePatchName("TTSPOP6", PU_LEVEL);
|
||||
ttspop7 = W_CachePatchName("TTSPOP7", PU_LEVEL);
|
||||
ttbanner = W_CachePatchName("TTBANNER", PU_PATCH_LOWPRIORITY);
|
||||
ttwing = W_CachePatchName("TTWING", PU_PATCH_LOWPRIORITY);
|
||||
ttsonic = W_CachePatchName("TTSONIC", PU_PATCH_LOWPRIORITY);
|
||||
ttswave1 = W_CachePatchName("TTSWAVE1", PU_PATCH_LOWPRIORITY);
|
||||
ttswave2 = W_CachePatchName("TTSWAVE2", PU_PATCH_LOWPRIORITY);
|
||||
ttswip1 = W_CachePatchName("TTSWIP1", PU_PATCH_LOWPRIORITY);
|
||||
ttsprep1 = W_CachePatchName("TTSPREP1", PU_PATCH_LOWPRIORITY);
|
||||
ttsprep2 = W_CachePatchName("TTSPREP2", PU_PATCH_LOWPRIORITY);
|
||||
ttspop1 = W_CachePatchName("TTSPOP1", PU_PATCH_LOWPRIORITY);
|
||||
ttspop2 = W_CachePatchName("TTSPOP2", PU_PATCH_LOWPRIORITY);
|
||||
ttspop3 = W_CachePatchName("TTSPOP3", PU_PATCH_LOWPRIORITY);
|
||||
ttspop4 = W_CachePatchName("TTSPOP4", PU_PATCH_LOWPRIORITY);
|
||||
ttspop5 = W_CachePatchName("TTSPOP5", PU_PATCH_LOWPRIORITY);
|
||||
ttspop6 = W_CachePatchName("TTSPOP6", PU_PATCH_LOWPRIORITY);
|
||||
ttspop7 = W_CachePatchName("TTSPOP7", PU_PATCH_LOWPRIORITY);
|
||||
break;
|
||||
|
||||
// don't load alacroix gfx yet; we do that upon first draw.
|
||||
|
@ -2593,7 +2593,7 @@ void F_StartTitleScreen(void)
|
|||
|
||||
static void F_UnloadAlacroixGraphics(SINT8 oldttscale)
|
||||
{
|
||||
// This all gets freed by PU_LEVEL when exiting the menus.
|
||||
// This all gets freed by PU_PATCH_LOWPRIORITY when exiting the menus.
|
||||
// When re-visiting the menus (e.g., from exiting in-game), the gfx are force-reloaded.
|
||||
// So leftover addresses here should not be a problem.
|
||||
|
||||
|
@ -3701,7 +3701,7 @@ void F_ContinueDrawer(void)
|
|||
V_DrawLevelTitle(x - (V_LevelNameWidth("Continue?")>>1), 16, 0, "Continue?");
|
||||
|
||||
// Two stars...
|
||||
patch = W_CachePatchName("CONTSTAR", PU_PATCH);
|
||||
patch = W_CachePatchName("CONTSTAR", PU_PATCH_LOWPRIORITY);
|
||||
V_DrawScaledPatch(x-32, 160, 0, patch);
|
||||
V_DrawScaledPatch(x+32, 160, 0, patch);
|
||||
|
||||
|
@ -3709,14 +3709,14 @@ void F_ContinueDrawer(void)
|
|||
if (timeleft > 9)
|
||||
{
|
||||
numbuf[7] = '1';
|
||||
V_DrawScaledPatch(x - 10, 160, 0, W_CachePatchName(numbuf, PU_PATCH));
|
||||
V_DrawScaledPatch(x - 10, 160, 0, W_CachePatchName(numbuf, PU_PATCH_LOWPRIORITY));
|
||||
numbuf[7] = '0';
|
||||
V_DrawScaledPatch(x + 10, 160, 0, W_CachePatchName(numbuf, PU_PATCH));
|
||||
V_DrawScaledPatch(x + 10, 160, 0, W_CachePatchName(numbuf, PU_PATCH_LOWPRIORITY));
|
||||
}
|
||||
else
|
||||
{
|
||||
numbuf[7] = '0'+timeleft;
|
||||
V_DrawScaledPatch(x, 160, 0, W_CachePatchName(numbuf, PU_PATCH));
|
||||
V_DrawScaledPatch(x, 160, 0, W_CachePatchName(numbuf, PU_PATCH_LOWPRIORITY));
|
||||
}
|
||||
|
||||
// Draw the continue markers! Show continues.
|
||||
|
@ -3745,7 +3745,7 @@ void F_ContinueDrawer(void)
|
|||
}
|
||||
|
||||
// Spotlight
|
||||
V_DrawScaledPatch(x, 140, 0, W_CachePatchName("CONTSPOT", PU_PATCH));
|
||||
V_DrawScaledPatch(x, 140, 0, W_CachePatchName("CONTSPOT", PU_PATCH_LOWPRIORITY));
|
||||
|
||||
// warping laser
|
||||
if (continuetime)
|
||||
|
@ -3782,7 +3782,7 @@ void F_ContinueDrawer(void)
|
|||
#define drawchar(dx, dy, n) {\
|
||||
sprdef = &contskins[n]->sprites[cont_spr2[n][0]];\
|
||||
sprframe = &sprdef->spriteframes[cont_spr2[n][1]];\
|
||||
patch = W_CachePatchNum(sprframe->lumppat[cont_spr2[n][2]], PU_PATCH);\
|
||||
patch = W_CachePatchNum(sprframe->lumppat[cont_spr2[n][2]], PU_PATCH_LOWPRIORITY);\
|
||||
V_DrawFixedPatch((dx), (dy), contskins[n]->highresscale, (sprframe->flip & (1<<cont_spr2[n][2])) ? V_FLIP : 0, patch, contcolormaps[n]);\
|
||||
}
|
||||
|
||||
|
@ -4047,10 +4047,10 @@ void F_CutsceneDrawer(void)
|
|||
{
|
||||
if (cutscenes[cutnum]->scene[scenenum].pichires[picnum])
|
||||
V_DrawSmallScaledPatch(picxpos, picypos, 0,
|
||||
W_CachePatchName(cutscenes[cutnum]->scene[scenenum].picname[picnum], PU_PATCH));
|
||||
W_CachePatchName(cutscenes[cutnum]->scene[scenenum].picname[picnum], PU_PATCH_LOWPRIORITY));
|
||||
else
|
||||
V_DrawScaledPatch(picxpos,picypos, 0,
|
||||
W_CachePatchName(cutscenes[cutnum]->scene[scenenum].picname[picnum], PU_PATCH));
|
||||
W_CachePatchName(cutscenes[cutnum]->scene[scenenum].picname[picnum], PU_PATCH_LOWPRIORITY));
|
||||
}
|
||||
|
||||
if (dofadenow && rendermode != render_none)
|
||||
|
@ -4536,10 +4536,10 @@ void F_TextPromptDrawer(void)
|
|||
{
|
||||
if (textprompts[cutnum]->page[scenenum].pichires[picnum])
|
||||
V_DrawSmallScaledPatch(picxpos, picypos, 0,
|
||||
W_CachePatchName(textprompts[cutnum]->page[scenenum].picname[picnum], PU_PATCH));
|
||||
W_CachePatchName(textprompts[cutnum]->page[scenenum].picname[picnum], PU_PATCH_LOWPRIORITY));
|
||||
else
|
||||
V_DrawScaledPatch(picxpos,picypos, 0,
|
||||
W_CachePatchName(textprompts[cutnum]->page[scenenum].picname[picnum], PU_PATCH));
|
||||
W_CachePatchName(textprompts[cutnum]->page[scenenum].picname[picnum], PU_PATCH_LOWPRIORITY));
|
||||
}
|
||||
|
||||
// Draw background
|
||||
|
@ -4549,7 +4549,7 @@ void F_TextPromptDrawer(void)
|
|||
if (iconlump != LUMPERROR)
|
||||
{
|
||||
INT32 iconx, icony, scale, scaledsize;
|
||||
patch = W_CachePatchName(textprompts[cutnum]->page[scenenum].iconname, PU_PATCH);
|
||||
patch = W_CachePatchName(textprompts[cutnum]->page[scenenum].iconname, PU_PATCH_LOWPRIORITY);
|
||||
|
||||
// scale and center
|
||||
if (patch->width > patch->height)
|
||||
|
|
|
@ -733,7 +733,7 @@ static void HWR_DrawSegsSplats(FSurfaceInfo * pSurf)
|
|||
if (!M_PointInBox(segbbox,splat->v1.x,splat->v1.y) && !M_PointInBox(segbbox,splat->v2.x,splat->v2.y))
|
||||
continue;
|
||||
|
||||
gpatch = W_CachePatchNum(splat->patch, PU_PATCH);
|
||||
gpatch = W_CachePatchNum(splat->patch, PU_SPRITE);
|
||||
HWR_GetPatch(gpatch);
|
||||
|
||||
wallVerts[0].x = wallVerts[3].x = FIXED_TO_FLOAT(splat->v1.x);
|
||||
|
@ -3586,7 +3586,7 @@ static void HWR_DrawDropShadow(mobj_t *thing, fixed_t scale)
|
|||
if (alpha >= 255) return;
|
||||
alpha = 255 - alpha;
|
||||
|
||||
gpatch = (patch_t *)W_CachePatchName("DSHADOW", PU_CACHE);
|
||||
gpatch = (patch_t *)W_CachePatchName("DSHADOW", PU_SPRITE);
|
||||
if (!(gpatch && ((GLPatch_t *)gpatch->hardware)->mipmap->format)) return;
|
||||
HWR_GetPatch(gpatch);
|
||||
|
||||
|
@ -4901,8 +4901,8 @@ static void HWR_ProjectSprite(mobj_t *thing)
|
|||
if (thing->rollangle)
|
||||
{
|
||||
rollangle = R_GetRollAngle(thing->rollangle);
|
||||
if (!(sprframe->rotsprite.cached & (1<<rot)))
|
||||
R_CacheRotSprite(thing->sprite, (thing->frame & FF_FRAMEMASK), sprinfo, sprframe, rot, flip);
|
||||
if (sprframe->rotsprite.patch[rot][rollangle] == NULL)
|
||||
R_CacheRotSprite(thing->sprite, (thing->frame & FF_FRAMEMASK), sprinfo, sprframe, rot, rollangle, flip);
|
||||
rotsprite = sprframe->rotsprite.patch[rot][rollangle];
|
||||
if (rotsprite != NULL)
|
||||
{
|
||||
|
@ -5030,7 +5030,7 @@ static void HWR_ProjectSprite(mobj_t *thing)
|
|||
vis->gpatch = (patch_t *)rotsprite;
|
||||
else
|
||||
#endif
|
||||
vis->gpatch = (patch_t *)W_CachePatchNum(sprframe->lumppat[rot], PU_CACHE);
|
||||
vis->gpatch = (patch_t *)W_CachePatchNum(sprframe->lumppat[rot], PU_SPRITE);
|
||||
vis->flip = flip;
|
||||
vis->mobj = thing;
|
||||
vis->z1 = z1;
|
||||
|
@ -5165,7 +5165,7 @@ static void HWR_ProjectPrecipitationSprite(precipmobj_t *thing)
|
|||
vis->z2 = z2;
|
||||
vis->tz = tz;
|
||||
vis->dispoffset = 0; // Monster Iestyn: 23/11/15: HARDWARE SUPPORT AT LAST
|
||||
vis->gpatch = (patch_t *)W_CachePatchNum(sprframe->lumppat[rot], PU_CACHE);
|
||||
vis->gpatch = (patch_t *)W_CachePatchNum(sprframe->lumppat[rot], PU_SPRITE);
|
||||
vis->flip = flip;
|
||||
vis->mobj = (mobj_t *)thing;
|
||||
|
||||
|
|
|
@ -458,8 +458,8 @@ static int libd_getSpritePatch(lua_State *L)
|
|||
INT32 rot = R_GetRollAngle(rollangle);
|
||||
|
||||
if (rot) {
|
||||
if (!(sprframe->rotsprite.cached & (1<<angle)))
|
||||
R_CacheRotSprite(i, frame, NULL, sprframe, angle, sprframe->flip & (1<<angle));
|
||||
if (sprframe->rotsprite.patch[angle][rot] == NULL)
|
||||
R_CacheRotSprite(i, frame, NULL, sprframe, angle, rot, sprframe->flip & (1<<angle));
|
||||
LUA_PushUserdata(L, sprframe->rotsprite.patch[angle][rot], META_PATCH);
|
||||
lua_pushboolean(L, false);
|
||||
lua_pushboolean(L, true);
|
||||
|
@ -469,7 +469,7 @@ static int libd_getSpritePatch(lua_State *L)
|
|||
#endif
|
||||
|
||||
// push both the patch and it's "flip" value
|
||||
LUA_PushUserdata(L, W_CachePatchNum(sprframe->lumppat[angle], PU_PATCH), META_PATCH);
|
||||
LUA_PushUserdata(L, W_CachePatchNum(sprframe->lumppat[angle], PU_SPRITE), META_PATCH);
|
||||
lua_pushboolean(L, (sprframe->flip & (1<<angle)) != 0);
|
||||
return 2;
|
||||
}
|
||||
|
@ -571,8 +571,8 @@ static int libd_getSprite2Patch(lua_State *L)
|
|||
INT32 rot = R_GetRollAngle(rollangle);
|
||||
|
||||
if (rot) {
|
||||
if (!(sprframe->rotsprite.cached & (1<<angle)))
|
||||
R_CacheRotSprite(SPR_PLAY, frame, &skins[i].sprinfo[j], sprframe, angle, sprframe->flip & (1<<angle));
|
||||
if (sprframe->rotsprite.patch[angle][rot] == NULL)
|
||||
R_CacheRotSprite(SPR_PLAY, frame, &skins[i].sprinfo[j], sprframe, angle, rot, sprframe->flip & (1<<angle));
|
||||
LUA_PushUserdata(L, sprframe->rotsprite.patch[angle][rot], META_PATCH);
|
||||
lua_pushboolean(L, false);
|
||||
lua_pushboolean(L, true);
|
||||
|
@ -582,7 +582,7 @@ static int libd_getSprite2Patch(lua_State *L)
|
|||
#endif
|
||||
|
||||
// push both the patch and it's "flip" value
|
||||
LUA_PushUserdata(L, W_CachePatchNum(sprframe->lumppat[angle], PU_PATCH), META_PATCH);
|
||||
LUA_PushUserdata(L, W_CachePatchNum(sprframe->lumppat[angle], PU_SPRITE), META_PATCH);
|
||||
lua_pushboolean(L, (sprframe->flip & (1<<angle)) != 0);
|
||||
return 2;
|
||||
}
|
||||
|
|
|
@ -378,10 +378,6 @@ static int lib_setSpriteInfo(lua_State *L)
|
|||
UINT32 i = luaL_checkinteger(L, 1);
|
||||
if (i == 0 || i >= NUMSPRITES)
|
||||
return luaL_error(L, "spriteinfo[] index %d out of range (1 - %d)", i, NUMSPRITES-1);
|
||||
#ifdef ROTSPRITE
|
||||
if (sprites != NULL)
|
||||
R_FreeRotSprite(&sprites[i]);
|
||||
#endif
|
||||
info = &spriteinfo[i]; // get the spriteinfo to assign to.
|
||||
}
|
||||
luaL_checktype(L, 2, LUA_TTABLE); // check that we've been passed a table.
|
||||
|
@ -463,11 +459,6 @@ static int spriteinfo_set(lua_State *L)
|
|||
lua_remove(L, 1); // remove field
|
||||
lua_settop(L, 1); // leave only one value
|
||||
|
||||
#ifdef ROTSPRITE
|
||||
if (sprites != NULL)
|
||||
R_FreeRotSprite(&sprites[sprinfo-spriteinfo]);
|
||||
#endif
|
||||
|
||||
if (fastcmp(field, "pivot"))
|
||||
{
|
||||
// pivot[] is a table
|
||||
|
|
|
@ -5840,8 +5840,6 @@ static void M_DrawNightsAttackSuperSonic(void)
|
|||
const UINT8 *colormap = R_GetTranslationColormap(TC_DEFAULT, SKINCOLOR_YELLOW, GTC_CACHE);
|
||||
INT32 timer = (ntsatkdrawtimer/4) % 2;
|
||||
angle_t fa = (FixedAngle(((ntsatkdrawtimer * 4) % 360)<<FRACBITS)>>ANGLETOFINESHIFT) & FINEMASK;
|
||||
ntssupersonic[0] = W_CachePatchName("NTSSONC1", PU_PATCH);
|
||||
ntssupersonic[1] = W_CachePatchName("NTSSONC2", PU_PATCH);
|
||||
V_DrawFixedPatch(235<<FRACBITS, (120<<FRACBITS) - (8*FINESINE(fa)), FRACUNIT, 0, ntssupersonic[timer], colormap);
|
||||
}
|
||||
|
||||
|
@ -6185,7 +6183,7 @@ static void M_StopMessage(INT32 choice)
|
|||
static void M_DrawImageDef(void)
|
||||
{
|
||||
// Grr. Need to autodetect for pic_ts.
|
||||
pic_t *pictest = (pic_t *)W_CachePatchName(currentMenu->menuitems[itemOn].text,PU_CACHE);
|
||||
pic_t *pictest = (pic_t *)W_CacheLumpName(currentMenu->menuitems[itemOn].text,PU_CACHE);
|
||||
if (!pictest->zero)
|
||||
V_DrawScaledPic(0,0,0,W_GetNumForName(currentMenu->menuitems[itemOn].text));
|
||||
else
|
||||
|
@ -10153,6 +10151,9 @@ static void M_NightsAttack(INT32 choice)
|
|||
// This is really just to make sure Sonic is the played character, just in case
|
||||
M_PatchSkinNameTable();
|
||||
|
||||
ntssupersonic[0] = W_CachePatchName("NTSSONC1", PU_PATCH);
|
||||
ntssupersonic[1] = W_CachePatchName("NTSSONC2", PU_PATCH);
|
||||
|
||||
G_SetGamestate(GS_TIMEATTACK); // do this before M_SetupNextMenu so that menu meta state knows that we're switching
|
||||
titlemapinaction = TITLEMAP_OFF; // Nope don't give us HOMs please
|
||||
M_SetupNextMenu(&SP_NightsAttackDef);
|
||||
|
|
|
@ -4090,6 +4090,8 @@ boolean P_LoadLevel(boolean fromnetsave)
|
|||
// Clear pointers that would be left dangling by the purge
|
||||
R_FlushTranslationColormapCache();
|
||||
|
||||
Patch_FreeTag(PU_PATCH_LOWPRIORITY);
|
||||
Patch_FreeTag(PU_SPRITE_ROTATED);
|
||||
Z_FreeTags(PU_LEVEL, PU_PURGELEVEL - 1);
|
||||
|
||||
#if defined (WALLSPLATS) || defined (FLOORSPLATS)
|
||||
|
@ -4475,6 +4477,8 @@ boolean P_AddWadFile(const char *wadfilename)
|
|||
//
|
||||
// search for sprite replacements
|
||||
//
|
||||
Patch_FreeTag(PU_SPRITE);
|
||||
Patch_FreeTag(PU_SPRITE_ROTATED);
|
||||
R_AddSpriteDefs(wadnum);
|
||||
|
||||
// Reload it all anyway, just in case they
|
||||
|
|
|
@ -1308,7 +1308,7 @@ void R_PrecacheLevel(void)
|
|||
lump = sf->lumppat[a];\
|
||||
if (devparm)\
|
||||
spritememory += W_LumpLength(lump);\
|
||||
W_CachePatchNum(lump, PU_PATCH);\
|
||||
W_CachePatchNum(lump, PU_SPRITE);\
|
||||
}
|
||||
// see R_InitSprites for more about lumppat,lumpid
|
||||
switch (sf->rotate)
|
||||
|
|
|
@ -711,7 +711,6 @@ typedef struct
|
|||
typedef struct
|
||||
{
|
||||
patch_t *patch[16][ROTANGLES];
|
||||
UINT16 cached;
|
||||
} rotsprite_t;
|
||||
#endif/*ROTSPRITE*/
|
||||
|
||||
|
|
|
@ -64,7 +64,7 @@ patch_t *Patch_Create(softwarepatch_t *source, size_t srcsize, void *dest)
|
|||
// Frees a patch from memory.
|
||||
//
|
||||
|
||||
void Patch_Free(patch_t *patch)
|
||||
static void Patch_FreeData(patch_t *patch)
|
||||
{
|
||||
#ifdef HWRENDER
|
||||
if (patch->hardware)
|
||||
|
@ -75,10 +75,30 @@ void Patch_Free(patch_t *patch)
|
|||
Z_Free(patch->columnofs);
|
||||
if (patch->columns)
|
||||
Z_Free(patch->columns);
|
||||
}
|
||||
|
||||
void Patch_Free(patch_t *patch)
|
||||
{
|
||||
Patch_FreeData(patch);
|
||||
Z_Free(patch);
|
||||
}
|
||||
|
||||
//
|
||||
// Frees patches with a tag range.
|
||||
//
|
||||
|
||||
static boolean Patch_FreeTagsCallback(void *mem)
|
||||
{
|
||||
patch_t *patch = (patch_t *)mem;
|
||||
Patch_FreeData(patch);
|
||||
return true;
|
||||
}
|
||||
|
||||
void Patch_FreeTags(INT32 lowtag, INT32 hightag)
|
||||
{
|
||||
Z_IterateTags(lowtag, hightag, Patch_FreeTagsCallback);
|
||||
}
|
||||
|
||||
#ifdef HWRENDER
|
||||
//
|
||||
// Allocates a hardware patch.
|
||||
|
|
|
@ -19,6 +19,9 @@
|
|||
patch_t *Patch_Create(softwarepatch_t *source, size_t srcsize, void *dest);
|
||||
void Patch_Free(patch_t *patch);
|
||||
|
||||
#define Patch_FreeTag(tagnum) Patch_FreeTags(tagnum, tagnum)
|
||||
void Patch_FreeTags(INT32 lowtag, INT32 hightag);
|
||||
|
||||
#ifdef HWRENDER
|
||||
void *Patch_AllocateHardwarePatch(patch_t *patch);
|
||||
void *Patch_CreateGL(patch_t *patch);
|
||||
|
|
|
@ -1350,11 +1350,6 @@ static void R_ParseSpriteInfo(boolean spr2)
|
|||
info = Z_Calloc(sizeof(spriteinfo_t), PU_STATIC, NULL);
|
||||
info->available = true;
|
||||
|
||||
#ifdef ROTSPRITE
|
||||
if ((sprites != NULL) && (!spr2))
|
||||
R_FreeRotSprite(&sprites[sprnum]);
|
||||
#endif
|
||||
|
||||
// Left Curly Brace
|
||||
sprinfoToken = M_GetToken(NULL);
|
||||
if (sprinfoToken == NULL)
|
||||
|
@ -1415,9 +1410,6 @@ static void R_ParseSpriteInfo(boolean spr2)
|
|||
size_t skinnum = skinnumbers[i];
|
||||
skin_t *skin = &skins[skinnum];
|
||||
spriteinfo_t *sprinfo = skin->sprinfo;
|
||||
#ifdef ROTSPRITE
|
||||
R_FreeSkinRotSprite(skinnum);
|
||||
#endif
|
||||
M_Memcpy(&sprinfo[spr2num], info, sizeof(spriteinfo_t));
|
||||
}
|
||||
}
|
||||
|
@ -1532,24 +1524,28 @@ INT32 R_GetRollAngle(angle_t rollangle)
|
|||
//
|
||||
// Create a rotated sprite.
|
||||
//
|
||||
void R_CacheRotSprite(spritenum_t sprnum, UINT8 frame, spriteinfo_t *sprinfo, spriteframe_t *sprframe, INT32 rot, UINT8 flip)
|
||||
void R_CacheRotSprite(spritenum_t sprnum, UINT8 frame, spriteinfo_t *sprinfo, spriteframe_t *sprframe, INT32 rot, INT32 angle, UINT8 flip)
|
||||
{
|
||||
INT32 angle;
|
||||
patch_t *patch, *newpatch;
|
||||
UINT16 *rawdst;
|
||||
size_t size;
|
||||
pictureflags_t bflip = (flip) ? PICFLAGS_XFLIP : 0;
|
||||
|
||||
// Don't cache angle = 0
|
||||
if (angle < 1 || angle >= ROTANGLES)
|
||||
return;
|
||||
|
||||
#define SPRITE_XCENTER (leftoffset)
|
||||
#define SPRITE_YCENTER (height / 2)
|
||||
#define ROTSPRITE_XCENTER (newwidth / 2)
|
||||
#define ROTSPRITE_YCENTER (newheight / 2)
|
||||
|
||||
if (!(sprframe->rotsprite.cached & (1<<rot)))
|
||||
if (sprframe->rotsprite.patch[rot][angle] == NULL)
|
||||
{
|
||||
INT32 dx, dy;
|
||||
INT32 px, py;
|
||||
INT32 width, height, leftoffset;
|
||||
INT32 newwidth, newheight;
|
||||
fixed_t ca, sa;
|
||||
lumpnum_t lump = sprframe->lumppat[rot];
|
||||
|
||||
|
@ -1579,172 +1575,116 @@ void R_CacheRotSprite(spritenum_t sprnum, UINT8 frame, spriteinfo_t *sprinfo, sp
|
|||
leftoffset = width - leftoffset;
|
||||
}
|
||||
|
||||
// Don't cache angle = 0
|
||||
for (angle = 1; angle < ROTANGLES; angle++)
|
||||
ca = rollcosang[angle];
|
||||
sa = rollsinang[angle];
|
||||
|
||||
// Find the dimensions of the rotated patch.
|
||||
{
|
||||
INT32 newwidth, newheight;
|
||||
INT32 w1 = abs(FixedMul(width << FRACBITS, ca) - FixedMul(height << FRACBITS, sa));
|
||||
INT32 w2 = abs(FixedMul(-(width << FRACBITS), ca) - FixedMul(height << FRACBITS, sa));
|
||||
INT32 h1 = abs(FixedMul(width << FRACBITS, sa) + FixedMul(height << FRACBITS, ca));
|
||||
INT32 h2 = abs(FixedMul(-(width << FRACBITS), sa) + FixedMul(height << FRACBITS, ca));
|
||||
w1 = FixedInt(FixedCeil(w1 + (FRACUNIT/2)));
|
||||
w2 = FixedInt(FixedCeil(w2 + (FRACUNIT/2)));
|
||||
h1 = FixedInt(FixedCeil(h1 + (FRACUNIT/2)));
|
||||
h2 = FixedInt(FixedCeil(h2 + (FRACUNIT/2)));
|
||||
newwidth = max(width, max(w1, w2));
|
||||
newheight = max(height, max(h1, h2));
|
||||
}
|
||||
|
||||
ca = rollcosang[angle];
|
||||
sa = rollsinang[angle];
|
||||
// check boundaries
|
||||
{
|
||||
fixed_t top[2][2];
|
||||
fixed_t bottom[2][2];
|
||||
|
||||
// Find the dimensions of the rotated patch.
|
||||
{
|
||||
INT32 w1 = abs(FixedMul(width << FRACBITS, ca) - FixedMul(height << FRACBITS, sa));
|
||||
INT32 w2 = abs(FixedMul(-(width << FRACBITS), ca) - FixedMul(height << FRACBITS, sa));
|
||||
INT32 h1 = abs(FixedMul(width << FRACBITS, sa) + FixedMul(height << FRACBITS, ca));
|
||||
INT32 h2 = abs(FixedMul(-(width << FRACBITS), sa) + FixedMul(height << FRACBITS, ca));
|
||||
w1 = FixedInt(FixedCeil(w1 + (FRACUNIT/2)));
|
||||
w2 = FixedInt(FixedCeil(w2 + (FRACUNIT/2)));
|
||||
h1 = FixedInt(FixedCeil(h1 + (FRACUNIT/2)));
|
||||
h2 = FixedInt(FixedCeil(h2 + (FRACUNIT/2)));
|
||||
newwidth = max(width, max(w1, w2));
|
||||
newheight = max(height, max(h1, h2));
|
||||
}
|
||||
top[0][0] = FixedMul((-ROTSPRITE_XCENTER) << FRACBITS, ca) + FixedMul((-ROTSPRITE_YCENTER) << FRACBITS, sa) + (px << FRACBITS);
|
||||
top[0][1] = FixedMul((-ROTSPRITE_XCENTER) << FRACBITS, sa) + FixedMul((-ROTSPRITE_YCENTER) << FRACBITS, ca) + (py << FRACBITS);
|
||||
top[1][0] = FixedMul((newwidth-ROTSPRITE_XCENTER) << FRACBITS, ca) + FixedMul((-ROTSPRITE_YCENTER) << FRACBITS, sa) + (px << FRACBITS);
|
||||
top[1][1] = FixedMul((newwidth-ROTSPRITE_XCENTER) << FRACBITS, sa) + FixedMul((-ROTSPRITE_YCENTER) << FRACBITS, ca) + (py << FRACBITS);
|
||||
|
||||
// check boundaries
|
||||
{
|
||||
fixed_t top[2][2];
|
||||
fixed_t bottom[2][2];
|
||||
bottom[0][0] = FixedMul((-ROTSPRITE_XCENTER) << FRACBITS, ca) + FixedMul((newheight-ROTSPRITE_YCENTER) << FRACBITS, sa) + (px << FRACBITS);
|
||||
bottom[0][1] = -FixedMul((-ROTSPRITE_XCENTER) << FRACBITS, sa) + FixedMul((newheight-ROTSPRITE_YCENTER) << FRACBITS, ca) + (py << FRACBITS);
|
||||
bottom[1][0] = FixedMul((newwidth-ROTSPRITE_XCENTER) << FRACBITS, ca) + FixedMul((newheight-ROTSPRITE_YCENTER) << FRACBITS, sa) + (px << FRACBITS);
|
||||
bottom[1][1] = -FixedMul((newwidth-ROTSPRITE_XCENTER) << FRACBITS, sa) + FixedMul((newheight-ROTSPRITE_YCENTER) << FRACBITS, ca) + (py << FRACBITS);
|
||||
|
||||
top[0][0] = FixedMul((-ROTSPRITE_XCENTER) << FRACBITS, ca) + FixedMul((-ROTSPRITE_YCENTER) << FRACBITS, sa) + (px << FRACBITS);
|
||||
top[0][1] = FixedMul((-ROTSPRITE_XCENTER) << FRACBITS, sa) + FixedMul((-ROTSPRITE_YCENTER) << FRACBITS, ca) + (py << FRACBITS);
|
||||
top[1][0] = FixedMul((newwidth-ROTSPRITE_XCENTER) << FRACBITS, ca) + FixedMul((-ROTSPRITE_YCENTER) << FRACBITS, sa) + (px << FRACBITS);
|
||||
top[1][1] = FixedMul((newwidth-ROTSPRITE_XCENTER) << FRACBITS, sa) + FixedMul((-ROTSPRITE_YCENTER) << FRACBITS, ca) + (py << FRACBITS);
|
||||
top[0][0] >>= FRACBITS;
|
||||
top[0][1] >>= FRACBITS;
|
||||
top[1][0] >>= FRACBITS;
|
||||
top[1][1] >>= FRACBITS;
|
||||
|
||||
bottom[0][0] = FixedMul((-ROTSPRITE_XCENTER) << FRACBITS, ca) + FixedMul((newheight-ROTSPRITE_YCENTER) << FRACBITS, sa) + (px << FRACBITS);
|
||||
bottom[0][1] = -FixedMul((-ROTSPRITE_XCENTER) << FRACBITS, sa) + FixedMul((newheight-ROTSPRITE_YCENTER) << FRACBITS, ca) + (py << FRACBITS);
|
||||
bottom[1][0] = FixedMul((newwidth-ROTSPRITE_XCENTER) << FRACBITS, ca) + FixedMul((newheight-ROTSPRITE_YCENTER) << FRACBITS, sa) + (px << FRACBITS);
|
||||
bottom[1][1] = -FixedMul((newwidth-ROTSPRITE_XCENTER) << FRACBITS, sa) + FixedMul((newheight-ROTSPRITE_YCENTER) << FRACBITS, ca) + (py << FRACBITS);
|
||||
|
||||
top[0][0] >>= FRACBITS;
|
||||
top[0][1] >>= FRACBITS;
|
||||
top[1][0] >>= FRACBITS;
|
||||
top[1][1] >>= FRACBITS;
|
||||
|
||||
bottom[0][0] >>= FRACBITS;
|
||||
bottom[0][1] >>= FRACBITS;
|
||||
bottom[1][0] >>= FRACBITS;
|
||||
bottom[1][1] >>= FRACBITS;
|
||||
bottom[0][0] >>= FRACBITS;
|
||||
bottom[0][1] >>= FRACBITS;
|
||||
bottom[1][0] >>= FRACBITS;
|
||||
bottom[1][1] >>= FRACBITS;
|
||||
|
||||
#define BOUNDARYWCHECK(b) (b[0] < 0 || b[0] >= width)
|
||||
#define BOUNDARYHCHECK(b) (b[1] < 0 || b[1] >= height)
|
||||
#define BOUNDARYADJUST(x) x *= 2
|
||||
// top left/right
|
||||
if (BOUNDARYWCHECK(top[0]) || BOUNDARYWCHECK(top[1]))
|
||||
BOUNDARYADJUST(newwidth);
|
||||
// bottom left/right
|
||||
else if (BOUNDARYWCHECK(bottom[0]) || BOUNDARYWCHECK(bottom[1]))
|
||||
BOUNDARYADJUST(newwidth);
|
||||
// top left/right
|
||||
if (BOUNDARYHCHECK(top[0]) || BOUNDARYHCHECK(top[1]))
|
||||
BOUNDARYADJUST(newheight);
|
||||
// bottom left/right
|
||||
else if (BOUNDARYHCHECK(bottom[0]) || BOUNDARYHCHECK(bottom[1]))
|
||||
BOUNDARYADJUST(newheight);
|
||||
// top left/right
|
||||
if (BOUNDARYWCHECK(top[0]) || BOUNDARYWCHECK(top[1]))
|
||||
BOUNDARYADJUST(newwidth);
|
||||
// bottom left/right
|
||||
else if (BOUNDARYWCHECK(bottom[0]) || BOUNDARYWCHECK(bottom[1]))
|
||||
BOUNDARYADJUST(newwidth);
|
||||
// top left/right
|
||||
if (BOUNDARYHCHECK(top[0]) || BOUNDARYHCHECK(top[1]))
|
||||
BOUNDARYADJUST(newheight);
|
||||
// bottom left/right
|
||||
else if (BOUNDARYHCHECK(bottom[0]) || BOUNDARYHCHECK(bottom[1]))
|
||||
BOUNDARYADJUST(newheight);
|
||||
#undef BOUNDARYWCHECK
|
||||
#undef BOUNDARYHCHECK
|
||||
#undef BOUNDARYADJUST
|
||||
}
|
||||
|
||||
// Draw the rotated sprite to a temporary buffer.
|
||||
size = (newwidth * newheight);
|
||||
if (!size)
|
||||
size = (width * height);
|
||||
rawdst = Z_Calloc(size * sizeof(UINT16), PU_STATIC, NULL);
|
||||
|
||||
for (dy = 0; dy < newheight; dy++)
|
||||
{
|
||||
for (dx = 0; dx < newwidth; dx++)
|
||||
{
|
||||
INT32 x = (dx-ROTSPRITE_XCENTER) << FRACBITS;
|
||||
INT32 y = (dy-ROTSPRITE_YCENTER) << FRACBITS;
|
||||
INT32 sx = FixedMul(x, ca) + FixedMul(y, sa) + (px << FRACBITS);
|
||||
INT32 sy = -FixedMul(x, sa) + FixedMul(y, ca) + (py << FRACBITS);
|
||||
sx >>= FRACBITS;
|
||||
sy >>= FRACBITS;
|
||||
if (sx >= 0 && sy >= 0 && sx < width && sy < height)
|
||||
{
|
||||
void *input = Picture_GetPatchPixel(patch, PICFMT_PATCH, sx, sy, bflip);
|
||||
if (input != NULL)
|
||||
rawdst[(dy*newwidth)+dx] = (0xFF00 | (*(UINT8 *)input));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// make patch
|
||||
newpatch = (patch_t *)Picture_Convert(PICFMT_FLAT16, rawdst, PICFMT_PATCH, 0, &size, newwidth, newheight, 0, 0, 0);
|
||||
{
|
||||
newpatch->leftoffset = (newpatch->width / 2) + (leftoffset - px);
|
||||
newpatch->topoffset = (newpatch->height / 2) + (patch->topoffset - py);
|
||||
}
|
||||
|
||||
//BP: we cannot use special tric in hardware mode because feet in ground caused by z-buffer
|
||||
if (rendermode != render_none) // not for psprite
|
||||
newpatch->topoffset += FEETADJUST>>FRACBITS;
|
||||
|
||||
// P_PrecacheLevel
|
||||
if (devparm) spritememory += size;
|
||||
|
||||
sprframe->rotsprite.patch[rot][angle] = newpatch;
|
||||
|
||||
// free rotated image data
|
||||
Z_Free(rawdst);
|
||||
}
|
||||
|
||||
// This rotation is cached now
|
||||
sprframe->rotsprite.cached |= (1<<rot);
|
||||
// Draw the rotated sprite to a temporary buffer.
|
||||
size = (newwidth * newheight);
|
||||
if (!size)
|
||||
size = (width * height);
|
||||
rawdst = Z_Calloc(size * sizeof(UINT16), PU_STATIC, NULL);
|
||||
|
||||
for (dy = 0; dy < newheight; dy++)
|
||||
{
|
||||
for (dx = 0; dx < newwidth; dx++)
|
||||
{
|
||||
INT32 x = (dx-ROTSPRITE_XCENTER) << FRACBITS;
|
||||
INT32 y = (dy-ROTSPRITE_YCENTER) << FRACBITS;
|
||||
INT32 sx = FixedMul(x, ca) + FixedMul(y, sa) + (px << FRACBITS);
|
||||
INT32 sy = -FixedMul(x, sa) + FixedMul(y, ca) + (py << FRACBITS);
|
||||
sx >>= FRACBITS;
|
||||
sy >>= FRACBITS;
|
||||
if (sx >= 0 && sy >= 0 && sx < width && sy < height)
|
||||
{
|
||||
void *input = Picture_GetPatchPixel(patch, PICFMT_PATCH, sx, sy, bflip);
|
||||
if (input != NULL)
|
||||
rawdst[(dy*newwidth)+dx] = (0xFF00 | (*(UINT8 *)input));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// make patch
|
||||
newpatch = (patch_t *)Picture_Convert(PICFMT_FLAT16, rawdst, PICFMT_PATCH, 0, &size, newwidth, newheight, 0, 0, 0);
|
||||
Z_ChangeTag(newpatch, PU_SPRITE_ROTATED);
|
||||
{
|
||||
newpatch->leftoffset = (newpatch->width / 2) + (leftoffset - px);
|
||||
newpatch->topoffset = (newpatch->height / 2) + (patch->topoffset - py);
|
||||
}
|
||||
|
||||
//BP: we cannot use special tric in hardware mode because feet in ground caused by z-buffer
|
||||
if (rendermode != render_none) // not for psprite
|
||||
newpatch->topoffset += FEETADJUST>>FRACBITS;
|
||||
|
||||
// P_PrecacheLevel
|
||||
if (devparm) spritememory += size;
|
||||
|
||||
Z_SetUser(newpatch, &sprframe->rotsprite.patch[rot][angle]);
|
||||
|
||||
// free rotated image data
|
||||
Z_Free(rawdst);
|
||||
}
|
||||
#undef SPRITE_XCENTER
|
||||
#undef SPRITE_YCENTER
|
||||
#undef ROTSPRITE_XCENTER
|
||||
#undef ROTSPRITE_YCENTER
|
||||
}
|
||||
|
||||
//
|
||||
// R_FreeRotSprite
|
||||
//
|
||||
// Free sprite rotation data from memory, for a single spritedef.
|
||||
//
|
||||
void R_FreeRotSprite(spritedef_t *spritedef)
|
||||
{
|
||||
UINT8 frame;
|
||||
INT32 rot, ang;
|
||||
|
||||
for (frame = 0; frame < spritedef->numframes; frame++)
|
||||
{
|
||||
spriteframe_t *sprframe = &spritedef->spriteframes[frame];
|
||||
for (rot = 0; rot < 16; rot++)
|
||||
{
|
||||
if (sprframe->rotsprite.cached & (1<<rot))
|
||||
{
|
||||
for (ang = 0; ang < ROTANGLES; ang++)
|
||||
{
|
||||
patch_t *rotsprite = sprframe->rotsprite.patch[rot][ang];
|
||||
if (rotsprite)
|
||||
Patch_Free(rotsprite);
|
||||
rotsprite = NULL;
|
||||
}
|
||||
sprframe->rotsprite.cached &= ~(1<<rot);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//
|
||||
// R_FreeSkinRotSprite
|
||||
//
|
||||
// Free sprite rotation data from memory, for a skin.
|
||||
// Calls R_FreeRotSprite.
|
||||
//
|
||||
void R_FreeSkinRotSprite(size_t skinnum)
|
||||
{
|
||||
size_t i;
|
||||
skin_t *skin = &skins[skinnum];
|
||||
spritedef_t *skinsprites = skin->sprites;
|
||||
for (i = 0; i < NUMPLAYERSPRITES*2; i++)
|
||||
{
|
||||
R_FreeRotSprite(skinsprites);
|
||||
skinsprites++;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
|
|
@ -126,9 +126,7 @@ void R_ParseSPRTINFOLump(UINT16 wadNum, UINT16 lumpNum);
|
|||
// Sprite rotation
|
||||
#ifdef ROTSPRITE
|
||||
INT32 R_GetRollAngle(angle_t rollangle);
|
||||
void R_CacheRotSprite(spritenum_t sprnum, UINT8 frame, spriteinfo_t *sprinfo, spriteframe_t *sprframe, INT32 rot, UINT8 flip);
|
||||
void R_FreeRotSprite(spritedef_t *spritedef);
|
||||
void R_FreeSkinRotSprite(size_t skinnum);
|
||||
void R_CacheRotSprite(spritenum_t sprnum, UINT8 frame, spriteinfo_t *sprinfo, spriteframe_t *sprframe, INT32 rot, INT32 angle, UINT8 flip);
|
||||
extern fixed_t rollcosang[ROTANGLES];
|
||||
extern fixed_t rollsinang[ROTANGLES];
|
||||
#endif
|
||||
|
|
|
@ -107,7 +107,6 @@ static void R_InstallSpriteLump(UINT16 wad, // graphics patch
|
|||
|
||||
// rotsprite
|
||||
#ifdef ROTSPRITE
|
||||
sprtemp[frame].rotsprite.cached = 0;
|
||||
for (r = 0; r < 16; r++)
|
||||
{
|
||||
for (ang = 0; ang < ROTANGLES; ang++)
|
||||
|
@ -241,9 +240,6 @@ boolean R_AddSingleSpriteDef(const char *sprname, spritedef_t *spritedef, UINT16
|
|||
// if so, it might patch only certain frames, not all
|
||||
if (spritedef->numframes) // (then spriteframes is not null)
|
||||
{
|
||||
#ifdef ROTSPRITE
|
||||
R_FreeRotSprite(spritedef);
|
||||
#endif
|
||||
// copy the already defined sprite frames
|
||||
M_Memcpy(sprtemp, spritedef->spriteframes,
|
||||
spritedef->numframes * sizeof (spriteframe_t));
|
||||
|
@ -402,9 +398,6 @@ boolean R_AddSingleSpriteDef(const char *sprname, spritedef_t *spritedef, UINT16
|
|||
if (spritedef->numframes && // has been allocated
|
||||
spritedef->numframes < maxframe) // more frames are defined ?
|
||||
{
|
||||
#ifdef ROTSPRITE
|
||||
R_FreeRotSprite(spritedef);
|
||||
#endif
|
||||
Z_Free(spritedef->spriteframes);
|
||||
spritedef->spriteframes = NULL;
|
||||
}
|
||||
|
@ -1237,7 +1230,7 @@ static void R_ProjectDropShadow(mobj_t *thing, vissprite_t *vis, fixed_t scale,
|
|||
|
||||
scalemul = FixedMul(FRACUNIT - floordiff/640, scale);
|
||||
|
||||
patch = W_CachePatchName("DSHADOW", PU_CACHE);
|
||||
patch = W_CachePatchName("DSHADOW", PU_SPRITE);
|
||||
xscale = FixedDiv(projection, tz);
|
||||
yscale = FixedDiv(projectiony, tz);
|
||||
shadowxscale = FixedMul(thing->radius*2, scalemul);
|
||||
|
@ -1533,8 +1526,8 @@ static void R_ProjectSprite(mobj_t *thing)
|
|||
if (thing->rollangle)
|
||||
{
|
||||
rollangle = R_GetRollAngle(thing->rollangle);
|
||||
if (!(sprframe->rotsprite.cached & (1<<rot)))
|
||||
R_CacheRotSprite(thing->sprite, frame, sprinfo, sprframe, rot, flip);
|
||||
if (sprframe->rotsprite.patch[rot][rollangle] == NULL)
|
||||
R_CacheRotSprite(thing->sprite, frame, sprinfo, sprframe, rot, rollangle, flip);
|
||||
rotsprite = sprframe->rotsprite.patch[rot][rollangle];
|
||||
if (rotsprite != NULL)
|
||||
{
|
||||
|
@ -1823,7 +1816,7 @@ static void R_ProjectSprite(mobj_t *thing)
|
|||
vis->patch = rotsprite;
|
||||
else
|
||||
#endif
|
||||
vis->patch = W_CachePatchNum(sprframe->lumppat[rot], PU_CACHE);
|
||||
vis->patch = W_CachePatchNum(sprframe->lumppat[rot], PU_SPRITE);
|
||||
|
||||
//
|
||||
// determine the colormap (lightlevel & special effects)
|
||||
|
@ -2006,7 +1999,7 @@ static void R_ProjectPrecipitationSprite(precipmobj_t *thing)
|
|||
|
||||
//Fab: lumppat is the lump number of the patch to use, this is different
|
||||
// than lumpid for sprites-in-pwad : the graphics are patched
|
||||
vis->patch = W_CachePatchNum(sprframe->lumppat[0], PU_CACHE);
|
||||
vis->patch = W_CachePatchNum(sprframe->lumppat[0], PU_SPRITE);
|
||||
|
||||
// specific translucency
|
||||
if (thing->frame & FF_TRANSMASK)
|
||||
|
|
|
@ -232,7 +232,7 @@ void ST_doPaletteStuff(void)
|
|||
|
||||
void ST_UnloadGraphics(void)
|
||||
{
|
||||
Z_FreeTag(PU_HUDGFX);
|
||||
Patch_FreeTag(PU_HUDGFX);
|
||||
}
|
||||
|
||||
void ST_LoadGraphics(void)
|
||||
|
@ -2080,21 +2080,21 @@ static void ST_drawNiGHTSHUD(void)
|
|||
if (stplyr->powers[pw_nights_superloop])
|
||||
{
|
||||
pwr = stplyr->powers[pw_nights_superloop];
|
||||
V_DrawSmallScaledPatch(110, 44, 0, W_CachePatchName("NPRUA0",PU_CACHE));
|
||||
V_DrawSmallScaledPatch(110, 44, 0, W_CachePatchName("NPRUA0",PU_SPRITE));
|
||||
V_DrawThinString(106, 52, V_MONOSPACE, va("%2d.%02d", pwr/TICRATE, G_TicsToCentiseconds(pwr)));
|
||||
}
|
||||
|
||||
if (stplyr->powers[pw_nights_helper])
|
||||
{
|
||||
pwr = stplyr->powers[pw_nights_helper];
|
||||
V_DrawSmallScaledPatch(150, 44, 0, W_CachePatchName("NPRUC0",PU_CACHE));
|
||||
V_DrawSmallScaledPatch(150, 44, 0, W_CachePatchName("NPRUC0",PU_SPRITE));
|
||||
V_DrawThinString(146, 52, V_MONOSPACE, va("%2d.%02d", pwr/TICRATE, G_TicsToCentiseconds(pwr)));
|
||||
}
|
||||
|
||||
if (stplyr->powers[pw_nights_linkfreeze])
|
||||
{
|
||||
pwr = stplyr->powers[pw_nights_linkfreeze];
|
||||
V_DrawSmallScaledPatch(190, 44, 0, W_CachePatchName("NPRUE0",PU_CACHE));
|
||||
V_DrawSmallScaledPatch(190, 44, 0, W_CachePatchName("NPRUE0",PU_SPRITE));
|
||||
V_DrawThinString(186, 52, V_MONOSPACE, va("%2d.%02d", pwr/TICRATE, G_TicsToCentiseconds(pwr)));
|
||||
}
|
||||
}
|
||||
|
|
|
@ -2044,18 +2044,13 @@ void Y_EndIntermission(void)
|
|||
usebuffer = false;
|
||||
}
|
||||
|
||||
#define UNLOAD(x) if (x) {Z_ChangeTag(x, PU_CACHE);} x = NULL;
|
||||
#define UNLOAD(x) if (x) {Patch_Free(x);} x = NULL;
|
||||
|
||||
//
|
||||
// Y_UnloadData
|
||||
//
|
||||
static void Y_UnloadData(void)
|
||||
{
|
||||
// In hardware mode, don't Z_ChangeTag a pointer returned by W_CachePatchName().
|
||||
// It doesn't work and is unnecessary.
|
||||
if (rendermode != render_soft)
|
||||
return;
|
||||
|
||||
// unload the background patches
|
||||
UNLOAD(bgpatch);
|
||||
UNLOAD(bgtile);
|
||||
|
|
32
src/z_zone.c
32
src/z_zone.c
|
@ -496,6 +496,33 @@ void Z_FreeTags(INT32 lowtag, INT32 hightag)
|
|||
}
|
||||
}
|
||||
|
||||
/** Iterates through all memory for a given set of tags.
|
||||
*
|
||||
* \param lowtag The lowest tag to consider.
|
||||
* \param hightag The highest tag to consider.
|
||||
* \param iterfunc The iterator function.
|
||||
*/
|
||||
void Z_IterateTags(INT32 lowtag, INT32 hightag, boolean (*iterfunc)(void *))
|
||||
{
|
||||
memblock_t *block, *next;
|
||||
|
||||
if (!iterfunc)
|
||||
I_Error("Z_IterateTags: no iterator function was given");
|
||||
|
||||
for (block = head.next; block != &head; block = next)
|
||||
{
|
||||
next = block->next; // get link before possibly freeing
|
||||
|
||||
if (block->tag >= lowtag && block->tag <= hightag)
|
||||
{
|
||||
void *mem = (UINT8 *)block->hdr + sizeof *block->hdr;
|
||||
boolean free = iterfunc(mem);
|
||||
if (free)
|
||||
Z_Free(mem);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// -----------------
|
||||
// Utility functions
|
||||
// -----------------
|
||||
|
@ -772,6 +799,11 @@ static void Command_Memfree_f(void)
|
|||
CONS_Printf(M_GetText("Static : %7s KB\n"), sizeu1(Z_TagUsage(PU_STATIC)>>10));
|
||||
CONS_Printf(M_GetText("Static (sound) : %7s KB\n"), sizeu1(Z_TagUsage(PU_SOUND)>>10));
|
||||
CONS_Printf(M_GetText("Static (music) : %7s KB\n"), sizeu1(Z_TagUsage(PU_MUSIC)>>10));
|
||||
CONS_Printf(M_GetText("Patches : %7s KB\n"), sizeu1(Z_TagUsage(PU_PATCH)>>10));
|
||||
CONS_Printf(M_GetText("Patches (low) : %7s KB\n"), sizeu1(Z_TagUsage(PU_PATCH_LOWPRIORITY)>>10));
|
||||
CONS_Printf(M_GetText("Sprites : %7s KB\n"), sizeu1(Z_TagUsage(PU_SPRITE)>>10));
|
||||
CONS_Printf(M_GetText("Sprites (rotated) : %7s KB\n"), sizeu1(Z_TagUsage(PU_SPRITE_ROTATED)>>10));
|
||||
CONS_Printf(M_GetText("HUD graphics : %7s KB\n"), sizeu1(Z_TagUsage(PU_HUDGFX)>>10));
|
||||
CONS_Printf(M_GetText("Locked cache : %7s KB\n"), sizeu1(Z_TagUsage(PU_CACHE)>>10));
|
||||
CONS_Printf(M_GetText("Level : %7s KB\n"), sizeu1(Z_TagUsage(PU_LEVEL)>>10));
|
||||
CONS_Printf(M_GetText("Special thinker : %7s KB\n"), sizeu1(Z_TagUsage(PU_LEVSPEC)>>10));
|
||||
|
|
14
src/z_zone.h
14
src/z_zone.h
|
@ -42,8 +42,12 @@ enum
|
|||
|
||||
PU_SOUND = 11, // static while playing
|
||||
PU_MUSIC = 12, // static while playing
|
||||
PU_HUDGFX = 13, // static until WAD added
|
||||
PU_PATCH = 14, // static until renderer change
|
||||
|
||||
PU_PATCH = 14, // static entire execution time
|
||||
PU_PATCH_LOWPRIORITY = 15, // lower priority patch, static until level exited
|
||||
PU_SPRITE = 16, // sprite patch, static until WAD added
|
||||
PU_SPRITE_ROTATED = 17, // sprite patch, static until level exited or WAD added
|
||||
PU_HUDGFX = 18, // HUD patch, static until WAD added
|
||||
|
||||
PU_HWRPATCHINFO = 21, // Hardware GLPatch_t struct for OpenGL texture cache
|
||||
PU_HWRPATCHCOLMIPMAP = 22, // Hardware GLMipmap_t struct colormap variation of patch
|
||||
|
@ -63,7 +67,7 @@ enum
|
|||
PU_HWRCACHE_UNLOCKED = 102, // 'unlocked' PU_HWRCACHE memory:
|
||||
// 'second-level' cache for graphics
|
||||
// stored in hardware format and downloaded as needed
|
||||
PU_HWRPATCHINFO_UNLOCKED = 103, // 'unlocked' PU_HWRPATCHINFO memory
|
||||
PU_HWRPATCHINFO_UNLOCKED = 103, // 'unlocked' PU_HWRPATCHINFO memory
|
||||
PU_HWRMODELTEXTURE_UNLOCKED = 104, // 'unlocked' PU_HWRMODELTEXTURE memory
|
||||
};
|
||||
|
||||
|
@ -107,6 +111,10 @@ void *Z_ReallocAlign(void *ptr, size_t size, INT32 tag, void *user, INT32 alignb
|
|||
#define Z_FreeTag(tagnum) Z_FreeTags(tagnum, tagnum)
|
||||
void Z_FreeTags(INT32 lowtag, INT32 hightag);
|
||||
|
||||
// Iterate memory by tag
|
||||
#define Z_IterateTag(tagnum, func) Z_IterateTags(tagnum, tagnum, func)
|
||||
void Z_IterateTags(INT32 lowtag, INT32 hightag, boolean (*iterfunc)(void *));
|
||||
|
||||
//
|
||||
// Utility functions
|
||||
//
|
||||
|
|
Loading…
Reference in a new issue