mirror of
https://git.do.srb2.org/STJr/SRB2.git
synced 2025-03-11 03:42:43 +00:00
initial stuff
This commit is contained in:
parent
c6af108d8c
commit
2863ede7bf
33 changed files with 507 additions and 287 deletions
|
@ -51,6 +51,11 @@ INT32 VID_SetMode(INT32 modenum)
|
|||
return 0;
|
||||
}
|
||||
|
||||
void VID_CheckRenderer(void)
|
||||
{
|
||||
// ..............
|
||||
}
|
||||
|
||||
const char *VID_GetModeName(INT32 modenum)
|
||||
{
|
||||
return "A320x240";
|
||||
|
|
|
@ -1288,7 +1288,7 @@ void CONS_Printf(const char *fmt, ...)
|
|||
if (con_startup)
|
||||
{
|
||||
#ifdef _WINDOWS
|
||||
patch_t *con_backpic = W_CachePatchName("CONSBACK", PU_CACHE);
|
||||
patch_t *con_backpic = W_CachePatchName("CONSBACK", PU_PATCH);
|
||||
|
||||
// Jimita: CON_DrawBackpic just called V_DrawScaledPatch
|
||||
V_DrawScaledPatch(0, 0, 0, con_backpic);
|
||||
|
@ -1545,7 +1545,7 @@ static void CON_DrawConsole(void)
|
|||
// draw console background
|
||||
if (cons_backpic.value || con_forcepic)
|
||||
{
|
||||
patch_t *con_backpic = W_CachePatchName("CONSBACK", PU_CACHE);
|
||||
patch_t *con_backpic = W_CachePatchName("CONSBACK", PU_PATCH);
|
||||
|
||||
// Jimita: CON_DrawBackpic just called V_DrawScaledPatch
|
||||
V_DrawScaledPatch(0, 0, 0, con_backpic);
|
||||
|
@ -1602,6 +1602,12 @@ void CON_Drawer(void)
|
|||
if (!con_started || !graphics_started)
|
||||
return;
|
||||
|
||||
if (needpatchrecache)
|
||||
{
|
||||
W_FlushCachedPatches();
|
||||
HU_LoadGraphics();
|
||||
}
|
||||
|
||||
if (con_recalc)
|
||||
CON_RecalcSize();
|
||||
|
||||
|
|
19
src/d_main.c
19
src/d_main.c
|
@ -211,6 +211,7 @@ INT16 wipetypepost = -1;
|
|||
|
||||
static void D_Display(void)
|
||||
{
|
||||
INT32 setrenderstillneeded = setrenderneeded;
|
||||
boolean forcerefresh = false;
|
||||
static boolean wipe = false;
|
||||
INT32 wipedefindex = 0;
|
||||
|
@ -221,15 +222,19 @@ static void D_Display(void)
|
|||
if (nodrawers)
|
||||
return; // for comparative timing/profiling
|
||||
|
||||
// stop movie if needs to change renderer
|
||||
if (setrenderneeded && (moviemode != MM_OFF))
|
||||
M_StopMovie();
|
||||
|
||||
// check for change of screen size (video mode)
|
||||
if (setmodeneeded && !wipe)
|
||||
if ((setmodeneeded || setrenderneeded) && !wipe)
|
||||
SCR_SetMode(); // change video mode
|
||||
|
||||
if (vid.recalc)
|
||||
if (vid.recalc || setrenderstillneeded)
|
||||
SCR_Recalc(); // NOTE! setsizeneeded is set by SCR_Recalc()
|
||||
|
||||
// change the view size if needed
|
||||
if (setsizeneeded)
|
||||
if (setsizeneeded || setrenderstillneeded)
|
||||
{
|
||||
R_ExecuteSetViewSize();
|
||||
forcerefresh = true; // force background redraw
|
||||
|
@ -445,7 +450,7 @@ static void D_Display(void)
|
|||
py = 4;
|
||||
else
|
||||
py = viewwindowy + 4;
|
||||
patch = W_CachePatchName("M_PAUSE", PU_CACHE);
|
||||
patch = W_CachePatchName("M_PAUSE", PU_PATCH);
|
||||
V_DrawScaledPatch(viewwindowx + (BASEVIDWIDTH - SHORT(patch->width))/2, py, 0, patch);
|
||||
#else
|
||||
INT32 y = ((automapactive) ? (32) : (BASEVIDHEIGHT/2));
|
||||
|
@ -520,6 +525,12 @@ static void D_Display(void)
|
|||
|
||||
I_FinishUpdate(); // page flip or blit buffer
|
||||
}
|
||||
|
||||
if (needpatchrecache)
|
||||
R_ReloadHUDGraphics();
|
||||
|
||||
needpatchflush = false;
|
||||
needpatchrecache = false;
|
||||
}
|
||||
|
||||
// =========================================================================
|
||||
|
|
|
@ -812,6 +812,7 @@ void D_RegisterClientCommands(void)
|
|||
// screen.c
|
||||
CV_RegisterVar(&cv_fullscreen);
|
||||
CV_RegisterVar(&cv_renderview);
|
||||
CV_RegisterVar(&cv_renderer);
|
||||
CV_RegisterVar(&cv_scr_depth);
|
||||
CV_RegisterVar(&cv_scr_width);
|
||||
CV_RegisterVar(&cv_scr_height);
|
||||
|
|
|
@ -378,6 +378,11 @@ INT32 VID_SetMode (INT32 modenum) //, UINT8 *palette)
|
|||
return 1;
|
||||
}
|
||||
|
||||
void VID_CheckRenderer(void)
|
||||
{
|
||||
// ..............
|
||||
}
|
||||
|
||||
|
||||
|
||||
// converts a segm:offs 32bit pair to a 32bit flat ptr
|
||||
|
|
|
@ -39,6 +39,11 @@ INT32 VID_SetMode(INT32 modenum)
|
|||
return 0;
|
||||
}
|
||||
|
||||
void VID_CheckRenderer(void)
|
||||
{
|
||||
// ..............
|
||||
}
|
||||
|
||||
const char *VID_GetModeName(INT32 modenum)
|
||||
{
|
||||
(void)modenum;
|
||||
|
|
138
src/f_finale.c
138
src/f_finale.c
|
@ -424,16 +424,16 @@ static void F_IntroDrawScene(void)
|
|||
// DRAW A FULL PIC INSTEAD OF FLAT!
|
||||
if (intro_scenenum == 0);
|
||||
else if (intro_scenenum == 1)
|
||||
background = W_CachePatchName("INTRO1", PU_CACHE);
|
||||
background = W_CachePatchName("INTRO1", PU_PATCH);
|
||||
else if (intro_scenenum == 2)
|
||||
{
|
||||
background = W_CachePatchName("INTRO2", PU_CACHE);
|
||||
background = W_CachePatchName("INTRO2", PU_PATCH);
|
||||
highres = true;
|
||||
}
|
||||
else if (intro_scenenum == 3)
|
||||
background = W_CachePatchName("INTRO3", PU_CACHE);
|
||||
background = W_CachePatchName("INTRO3", PU_PATCH);
|
||||
else if (intro_scenenum == 4)
|
||||
background = W_CachePatchName("INTRO4", PU_CACHE);
|
||||
background = W_CachePatchName("INTRO4", PU_PATCH);
|
||||
else if (intro_scenenum == 5)
|
||||
{
|
||||
if (intro_curtime >= 5*TICRATE)
|
||||
|
@ -708,8 +708,8 @@ static void F_IntroDrawScene(void)
|
|||
y += (30*(FRACUNIT-scale));
|
||||
}
|
||||
|
||||
rockpat = W_CachePatchName(va("ROID00%.2d", 34 - (worktics % 35)), PU_LEVEL);
|
||||
glow = W_CachePatchName(va("ENDGLOW%.1d", 2+(worktics & 1)), PU_LEVEL);
|
||||
rockpat = W_CachePatchName(va("ROID00%.2d", 34 - (worktics % 35)), PU_PATCH);
|
||||
glow = W_CachePatchName(va("ENDGLOW%.1d", 2+(worktics & 1)), PU_PATCH);
|
||||
|
||||
if (worktics >= 5)
|
||||
trans = (worktics-5)>>1;
|
||||
|
@ -1350,14 +1350,14 @@ void F_GameEvaluationDrawer(void)
|
|||
|
||||
if (goodending)
|
||||
{
|
||||
rockpat = W_CachePatchName(va("ROID00%.2d", 34 - (finalecount % 35)), PU_LEVEL);
|
||||
glow = W_CachePatchName(va("ENDGLOW%.1d", 2+(finalecount & 1)), PU_LEVEL);
|
||||
rockpat = W_CachePatchName(va("ROID00%.2d", 34 - (finalecount % 35)), PU_PATCH);
|
||||
glow = W_CachePatchName(va("ENDGLOW%.1d", 2+(finalecount & 1)), PU_PATCH);
|
||||
x -= FRACUNIT;
|
||||
}
|
||||
else
|
||||
{
|
||||
rockpat = W_CachePatchName("ROID0000", PU_LEVEL);
|
||||
glow = W_CachePatchName(va("ENDGLOW%.1d", (finalecount & 1)), PU_LEVEL);
|
||||
glow = W_CachePatchName(va("ENDGLOW%.1d", (finalecount & 1)), PU_PATCH);
|
||||
}
|
||||
|
||||
if (finalecount >= 5)
|
||||
|
@ -1389,20 +1389,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_LEVEL), 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), R_GetTranslationColormap(TC_DEFAULT, SKINCOLOR_AQUA, GTC_CACHE));
|
||||
}
|
||||
j--;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
patch_t *eggrock = W_CachePatchName("ENDEGRK5", PU_LEVEL);
|
||||
patch_t *eggrock = W_CachePatchName("ENDEGRK5", PU_PATCH);
|
||||
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_LEVEL), colormap[1]);
|
||||
W_CachePatchName("ENDEGRK0", PU_PATCH), colormap[1]);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1416,7 +1416,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_LEVEL), NULL);
|
||||
V_DrawFixedPatch(x, y, FRACUNIT, ((emeralds & (1<<i)) ? 0 : V_80TRANS), W_CachePatchName(patchname, PU_PATCH), NULL);
|
||||
}
|
||||
|
||||
V_DrawCreditString((BASEVIDWIDTH - V_CreditStringWidth(endingtext))<<(FRACBITS-1), (BASEVIDHEIGHT-100)<<(FRACBITS-1), 0, endingtext);
|
||||
|
@ -1551,32 +1551,32 @@ void F_StartEnding(void)
|
|||
memset(sparkloffs, 0, sizeof(INT32)*3*2);
|
||||
sparklloop = 0;
|
||||
|
||||
endbrdr[1] = W_CachePatchName("ENDBRDR1", PU_LEVEL);
|
||||
endbrdr[1] = W_CachePatchName("ENDBRDR1", PU_PATCH);
|
||||
|
||||
endegrk[0] = W_CachePatchName("ENDEGRK0", PU_LEVEL);
|
||||
endegrk[1] = W_CachePatchName("ENDEGRK1", PU_LEVEL);
|
||||
endegrk[0] = W_CachePatchName("ENDEGRK0", PU_PATCH);
|
||||
endegrk[1] = W_CachePatchName("ENDEGRK1", PU_PATCH);
|
||||
|
||||
endglow[0] = W_CachePatchName("ENDGLOW0", PU_LEVEL);
|
||||
endglow[1] = W_CachePatchName("ENDGLOW1", PU_LEVEL);
|
||||
endglow[0] = W_CachePatchName("ENDGLOW0", PU_PATCH);
|
||||
endglow[1] = W_CachePatchName("ENDGLOW1", PU_PATCH);
|
||||
|
||||
endbgsp[0] = W_CachePatchName("ENDBGSP0", PU_LEVEL);
|
||||
endbgsp[1] = W_CachePatchName("ENDBGSP1", PU_LEVEL);
|
||||
endbgsp[2] = W_CachePatchName("ENDBGSP2", PU_LEVEL);
|
||||
endbgsp[0] = W_CachePatchName("ENDBGSP0", PU_PATCH);
|
||||
endbgsp[1] = W_CachePatchName("ENDBGSP1", PU_PATCH);
|
||||
endbgsp[2] = W_CachePatchName("ENDBGSP2", PU_PATCH);
|
||||
|
||||
endspkl[0] = W_CachePatchName("ENDSPKL0", PU_LEVEL);
|
||||
endspkl[1] = W_CachePatchName("ENDSPKL1", PU_LEVEL);
|
||||
endspkl[2] = W_CachePatchName("ENDSPKL2", PU_LEVEL);
|
||||
endspkl[0] = W_CachePatchName("ENDSPKL0", PU_PATCH);
|
||||
endspkl[1] = W_CachePatchName("ENDSPKL1", PU_PATCH);
|
||||
endspkl[2] = W_CachePatchName("ENDSPKL2", PU_PATCH);
|
||||
|
||||
endxpld[0] = W_CachePatchName("ENDXPLD0", PU_LEVEL);
|
||||
endxpld[1] = W_CachePatchName("ENDXPLD1", PU_LEVEL);
|
||||
endxpld[2] = W_CachePatchName("ENDXPLD2", PU_LEVEL);
|
||||
endxpld[3] = W_CachePatchName("ENDXPLD3", PU_LEVEL);
|
||||
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);
|
||||
|
||||
endescp[0] = W_CachePatchName("ENDESCP0", PU_LEVEL);
|
||||
endescp[1] = W_CachePatchName("ENDESCP1", PU_LEVEL);
|
||||
endescp[2] = W_CachePatchName("ENDESCP2", PU_LEVEL);
|
||||
endescp[3] = W_CachePatchName("ENDESCP3", PU_LEVEL);
|
||||
endescp[4] = W_CachePatchName("ENDESCP4", PU_LEVEL);
|
||||
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);
|
||||
|
||||
// so we only need to check once
|
||||
if ((goodending = ALL7EMERALDS(emeralds)))
|
||||
|
@ -1589,27 +1589,27 @@ void F_StartEnding(void)
|
|||
sprdef = &skins[skinnum].sprites[SPR2_XTRA];
|
||||
// character head, skin specific
|
||||
sprframe = &sprdef->spriteframes[2];
|
||||
endfwrk[0] = W_CachePatchNum(sprframe->lumppat[0], PU_LEVEL);
|
||||
endfwrk[0] = W_CachePatchNum(sprframe->lumppat[0], PU_PATCH);
|
||||
sprframe = &sprdef->spriteframes[3];
|
||||
endfwrk[1] = W_CachePatchNum(sprframe->lumppat[0], PU_LEVEL);
|
||||
endfwrk[1] = W_CachePatchNum(sprframe->lumppat[0], PU_PATCH);
|
||||
sprframe = &sprdef->spriteframes[4];
|
||||
endfwrk[2] = W_CachePatchNum(sprframe->lumppat[0], PU_LEVEL);
|
||||
endfwrk[2] = W_CachePatchNum(sprframe->lumppat[0], PU_PATCH);
|
||||
}
|
||||
else // eh, yknow what? too lazy to put MISSINGs here. eggman wins if you don't give your character an ending firework display.
|
||||
{
|
||||
endfwrk[0] = W_CachePatchName("ENDFWRK0", PU_LEVEL);
|
||||
endfwrk[1] = W_CachePatchName("ENDFWRK1", PU_LEVEL);
|
||||
endfwrk[2] = W_CachePatchName("ENDFWRK2", PU_LEVEL);
|
||||
endfwrk[0] = W_CachePatchName("ENDFWRK0", PU_PATCH);
|
||||
endfwrk[1] = W_CachePatchName("ENDFWRK1", PU_PATCH);
|
||||
endfwrk[2] = W_CachePatchName("ENDFWRK2", PU_PATCH);
|
||||
}
|
||||
|
||||
endbrdr[0] = W_CachePatchName("ENDBRDR2", PU_LEVEL);
|
||||
endbrdr[0] = W_CachePatchName("ENDBRDR2", PU_PATCH);
|
||||
}
|
||||
else
|
||||
{
|
||||
// eggman, skin nonspecific
|
||||
endfwrk[0] = W_CachePatchName("ENDFWRK0", PU_LEVEL);
|
||||
endfwrk[1] = W_CachePatchName("ENDFWRK1", PU_LEVEL);
|
||||
endfwrk[2] = W_CachePatchName("ENDFWRK2", PU_LEVEL);
|
||||
endfwrk[0] = W_CachePatchName("ENDFWRK0", PU_PATCH);
|
||||
endfwrk[1] = W_CachePatchName("ENDFWRK1", PU_PATCH);
|
||||
endfwrk[2] = W_CachePatchName("ENDFWRK2", PU_PATCH);
|
||||
|
||||
endbrdr[0] = W_CachePatchName("ENDBRDR0", PU_LEVEL);
|
||||
}
|
||||
|
@ -1626,13 +1626,13 @@ void F_EndingTicker(void)
|
|||
|
||||
if (goodending && finalecount == INFLECTIONPOINT) // time to swap some assets
|
||||
{
|
||||
endegrk[0] = W_CachePatchName("ENDEGRK2", PU_LEVEL);
|
||||
endegrk[1] = W_CachePatchName("ENDEGRK3", PU_LEVEL);
|
||||
endegrk[0] = W_CachePatchName("ENDEGRK2", PU_PATCH);
|
||||
endegrk[1] = W_CachePatchName("ENDEGRK3", PU_PATCH);
|
||||
|
||||
endglow[0] = W_CachePatchName("ENDGLOW2", PU_LEVEL);
|
||||
endglow[1] = W_CachePatchName("ENDGLOW3", PU_LEVEL);
|
||||
endglow[0] = W_CachePatchName("ENDGLOW2", PU_PATCH);
|
||||
endglow[1] = W_CachePatchName("ENDGLOW3", PU_PATCH);
|
||||
|
||||
endxpld[0] = W_CachePatchName("ENDEGRK4", PU_LEVEL);
|
||||
endxpld[0] = W_CachePatchName("ENDEGRK4", PU_PATCH);
|
||||
}
|
||||
|
||||
if (++sparklloop == SPARKLLOOPTIME) // time to roll the randomisation again
|
||||
|
@ -1653,9 +1653,9 @@ void F_EndingDrawer(void)
|
|||
patch_t *rockpat;
|
||||
|
||||
if (!goodending || finalecount < INFLECTIONPOINT)
|
||||
rockpat = W_CachePatchName("ROID0000", PU_LEVEL);
|
||||
rockpat = W_CachePatchName("ROID0000", PU_PATCH);
|
||||
else
|
||||
rockpat = W_CachePatchName(va("ROID00%.2d", 34 - ((finalecount - INFLECTIONPOINT) % 35)), PU_LEVEL);
|
||||
rockpat = W_CachePatchName(va("ROID00%.2d", 34 - ((finalecount - INFLECTIONPOINT) % 35)), PU_PATCH);
|
||||
|
||||
V_DrawFill(0, 0, BASEVIDWIDTH, BASEVIDHEIGHT, 31);
|
||||
|
||||
|
@ -2171,6 +2171,25 @@ void F_SkyScroll(INT32 scrollxspeed, INT32 scrollyspeed, const char *patchname)
|
|||
W_UnlockCachedPatch(pat);
|
||||
}
|
||||
|
||||
static void F_CacheTitleScreen(void)
|
||||
{
|
||||
ttbanner = W_CachePatchName("TTBANNER", PU_PATCH);
|
||||
ttwing = W_CachePatchName("TTWING", PU_PATCH);
|
||||
ttsonic = W_CachePatchName("TTSONIC", PU_PATCH);
|
||||
ttswave1 = W_CachePatchName("TTSWAVE1", PU_PATCH);
|
||||
ttswave2 = W_CachePatchName("TTSWAVE2", PU_PATCH);
|
||||
ttswip1 = W_CachePatchName("TTSWIP1", PU_PATCH);
|
||||
ttsprep1 = W_CachePatchName("TTSPREP1", PU_PATCH);
|
||||
ttsprep2 = W_CachePatchName("TTSPREP2", PU_PATCH);
|
||||
ttspop1 = W_CachePatchName("TTSPOP1", PU_PATCH);
|
||||
ttspop2 = W_CachePatchName("TTSPOP2", PU_PATCH);
|
||||
ttspop3 = W_CachePatchName("TTSPOP3", PU_PATCH);
|
||||
ttspop4 = W_CachePatchName("TTSPOP4", PU_PATCH);
|
||||
ttspop5 = W_CachePatchName("TTSPOP5", PU_PATCH);
|
||||
ttspop6 = W_CachePatchName("TTSPOP6", PU_PATCH);
|
||||
ttspop7 = W_CachePatchName("TTSPOP7", PU_PATCH);
|
||||
}
|
||||
|
||||
void F_StartTitleScreen(void)
|
||||
{
|
||||
if (menupres[MN_MAIN].musname[0])
|
||||
|
@ -2255,21 +2274,7 @@ void F_StartTitleScreen(void)
|
|||
demoDelayLeft = demoDelayTime;
|
||||
demoIdleLeft = demoIdleTime;
|
||||
|
||||
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);
|
||||
F_CacheTitleScreen();
|
||||
}
|
||||
|
||||
// (no longer) De-Demo'd Title Screen
|
||||
|
@ -2280,6 +2285,9 @@ void F_TitleScreenDrawer(void)
|
|||
if (modeattacking)
|
||||
return; // We likely came here from retrying. Don't do a damn thing.
|
||||
|
||||
if (needpatchrecache)
|
||||
F_CacheTitleScreen();
|
||||
|
||||
// Draw that sky!
|
||||
if (curbgcolor >= 0)
|
||||
V_DrawFill(0, 0, BASEVIDWIDTH, BASEVIDHEIGHT, curbgcolor);
|
||||
|
|
|
@ -754,16 +754,14 @@ void HWR_MakePatch (const patch_t *patch, GLPatch_t *grPatch, GLMipmap_t *grMipm
|
|||
// CACHING HANDLING
|
||||
// =================================================
|
||||
|
||||
static size_t gr_numtextures;
|
||||
static size_t gr_numtextures = 0;
|
||||
static GLTexture_t *gr_textures; // for ALL Doom textures
|
||||
|
||||
void HWR_InitTextureCache(void)
|
||||
{
|
||||
gr_numtextures = 0;
|
||||
gr_textures = NULL;
|
||||
}
|
||||
|
||||
|
||||
// Callback function for HWR_FreeTextureCache.
|
||||
static void FreeMipmapColormap(INT32 patchnum, void *patch)
|
||||
{
|
||||
|
@ -792,15 +790,17 @@ void HWR_FreeTextureCache(void)
|
|||
// Alam: free the Z_Blocks before freeing it's users
|
||||
|
||||
// free all skin after each level: must be done after pfnClearMipMapCache!
|
||||
for (i = 0; i < numwadfiles; i++)
|
||||
M_AATreeIterate(wadfiles[i]->hwrcache, FreeMipmapColormap);
|
||||
// temp fix, idk why this crashes
|
||||
// is it because the colormaps were already freed anyway?
|
||||
if (!needpatchrecache)
|
||||
for (i = 0; i < numwadfiles; i++)
|
||||
M_AATreeIterate(wadfiles[i]->hwrcache, FreeMipmapColormap);
|
||||
|
||||
// now the heap don't have any 'user' pointing to our
|
||||
// texturecache info, we can free it
|
||||
if (gr_textures)
|
||||
free(gr_textures);
|
||||
gr_textures = NULL;
|
||||
gr_numtextures = 0;
|
||||
}
|
||||
|
||||
void HWR_PrepLevelCache(size_t pnumtextures)
|
||||
|
@ -847,8 +847,11 @@ GLTexture_t *HWR_GetTexture(INT32 tex)
|
|||
GLTexture_t *grtex;
|
||||
#ifdef PARANOIA
|
||||
if ((unsigned)tex >= gr_numtextures)
|
||||
I_Error(" HWR_GetTexture: tex >= numtextures\n");
|
||||
I_Error("HWR_GetTexture: tex >= numtextures\n");
|
||||
#endif
|
||||
if (needpatchrecache && (!gr_textures))
|
||||
HWR_PrepLevelCache(gr_numtextures);
|
||||
|
||||
grtex = &gr_textures[tex];
|
||||
|
||||
if (!grtex->mipmap.grInfo.data && !grtex->mipmap.downloaded)
|
||||
|
@ -914,6 +917,9 @@ void HWR_GetFlat(lumpnum_t flatlumpnum)
|
|||
{
|
||||
GLMipmap_t *grmip;
|
||||
|
||||
if (needpatchflush)
|
||||
W_FlushCachedPatches();
|
||||
|
||||
grmip = &HWR_GetCachedGLPatch(flatlumpnum)->mipmap;
|
||||
|
||||
if (!grmip->downloaded && !grmip->grInfo.data)
|
||||
|
@ -950,6 +956,9 @@ static void HWR_LoadMappedPatch(GLMipmap_t *grmip, GLPatch_t *gpatch)
|
|||
// -----------------+
|
||||
void HWR_GetPatch(GLPatch_t *gpatch)
|
||||
{
|
||||
if (needpatchflush)
|
||||
W_FlushCachedPatches();
|
||||
|
||||
// is it in hardware cache
|
||||
if (!gpatch->mipmap.downloaded && !gpatch->mipmap.grInfo.data)
|
||||
{
|
||||
|
@ -977,6 +986,9 @@ void HWR_GetMappedPatch(GLPatch_t *gpatch, const UINT8 *colormap)
|
|||
{
|
||||
GLMipmap_t *grmip, *newmip;
|
||||
|
||||
if (needpatchflush)
|
||||
W_FlushCachedPatches();
|
||||
|
||||
if (colormap == colormaps || colormap == NULL)
|
||||
{
|
||||
// Load the default (green) color in doom cache (temporary?) AND hardware cache
|
||||
|
@ -1102,6 +1114,9 @@ GLPatch_t *HWR_GetPic(lumpnum_t lumpnum)
|
|||
{
|
||||
GLPatch_t *grpatch;
|
||||
|
||||
if (needpatchflush)
|
||||
W_FlushCachedPatches();
|
||||
|
||||
grpatch = HWR_GetCachedGLPatch(lumpnum);
|
||||
|
||||
if (!grpatch->mipmap.downloaded && !grpatch->mipmap.grInfo.data)
|
||||
|
@ -1299,6 +1314,9 @@ void HWR_GetFadeMask(lumpnum_t fademasklumpnum)
|
|||
{
|
||||
GLMipmap_t *grmip;
|
||||
|
||||
if (needpatchflush)
|
||||
W_FlushCachedPatches();
|
||||
|
||||
grmip = &HWR_GetCachedGLPatch(fademasklumpnum)->mipmap;
|
||||
|
||||
if (!grmip->downloaded && !grmip->grInfo.data)
|
||||
|
|
|
@ -990,7 +990,7 @@ void HWR_DrawViewBorder(INT32 clearlines)
|
|||
// top edge
|
||||
if (clearlines > basewindowy - 8)
|
||||
{
|
||||
patch = W_CachePatchNum(viewborderlump[BRDR_T], PU_CACHE);
|
||||
patch = W_CachePatchNum(viewborderlump[BRDR_T], PU_PATCH);
|
||||
for (x = 0; x < baseviewwidth; x += 8)
|
||||
HWR_DrawPatch(patch, basewindowx + x, basewindowy - 8,
|
||||
0);
|
||||
|
@ -999,7 +999,7 @@ void HWR_DrawViewBorder(INT32 clearlines)
|
|||
// bottom edge
|
||||
if (clearlines > basewindowy + baseviewheight)
|
||||
{
|
||||
patch = W_CachePatchNum(viewborderlump[BRDR_B], PU_CACHE);
|
||||
patch = W_CachePatchNum(viewborderlump[BRDR_B], PU_PATCH);
|
||||
for (x = 0; x < baseviewwidth; x += 8)
|
||||
HWR_DrawPatch(patch, basewindowx + x,
|
||||
basewindowy + baseviewheight, 0);
|
||||
|
@ -1008,7 +1008,7 @@ void HWR_DrawViewBorder(INT32 clearlines)
|
|||
// left edge
|
||||
if (clearlines > basewindowy)
|
||||
{
|
||||
patch = W_CachePatchNum(viewborderlump[BRDR_L], PU_CACHE);
|
||||
patch = W_CachePatchNum(viewborderlump[BRDR_L], PU_PATCH);
|
||||
for (y = 0; y < baseviewheight && basewindowy + y < clearlines;
|
||||
y += 8)
|
||||
{
|
||||
|
@ -1020,7 +1020,7 @@ void HWR_DrawViewBorder(INT32 clearlines)
|
|||
// right edge
|
||||
if (clearlines > basewindowy)
|
||||
{
|
||||
patch = W_CachePatchNum(viewborderlump[BRDR_R], PU_CACHE);
|
||||
patch = W_CachePatchNum(viewborderlump[BRDR_R], PU_PATCH);
|
||||
for (y = 0; y < baseviewheight && basewindowy+y < clearlines;
|
||||
y += 8)
|
||||
{
|
||||
|
@ -1032,22 +1032,22 @@ void HWR_DrawViewBorder(INT32 clearlines)
|
|||
// Draw beveled corners.
|
||||
if (clearlines > basewindowy - 8)
|
||||
HWR_DrawPatch(W_CachePatchNum(viewborderlump[BRDR_TL],
|
||||
PU_CACHE),
|
||||
PU_PATCH),
|
||||
basewindowx - 8, basewindowy - 8, 0);
|
||||
|
||||
if (clearlines > basewindowy - 8)
|
||||
HWR_DrawPatch(W_CachePatchNum(viewborderlump[BRDR_TR],
|
||||
PU_CACHE),
|
||||
PU_PATCH),
|
||||
basewindowx + baseviewwidth, basewindowy - 8, 0);
|
||||
|
||||
if (clearlines > basewindowy+baseviewheight)
|
||||
HWR_DrawPatch(W_CachePatchNum(viewborderlump[BRDR_BL],
|
||||
PU_CACHE),
|
||||
PU_PATCH),
|
||||
basewindowx - 8, basewindowy + baseviewheight, 0);
|
||||
|
||||
if (clearlines > basewindowy + baseviewheight)
|
||||
HWR_DrawPatch(W_CachePatchNum(viewborderlump[BRDR_BR],
|
||||
PU_CACHE),
|
||||
PU_PATCH),
|
||||
basewindowx + baseviewwidth,
|
||||
basewindowy + baseviewheight, 0);
|
||||
}
|
||||
|
|
|
@ -866,7 +866,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_CACHE);
|
||||
gpatch = W_CachePatchNum(splat->patch, PU_PATCH);
|
||||
HWR_GetPatch(gpatch);
|
||||
|
||||
wallVerts[0].x = wallVerts[3].x = FIXED_TO_FLOAT(splat->v1.x);
|
||||
|
@ -4332,7 +4332,7 @@ static void HWR_SplitSprite(gr_vissprite_t *spr)
|
|||
if (hires)
|
||||
this_scale = this_scale * FIXED_TO_FLOAT(((skin_t *)spr->mobj->skin)->highresscale);
|
||||
|
||||
gpatch = W_CachePatchNum(spr->patchlumpnum, PU_CACHE);
|
||||
gpatch = W_CachePatchNum(spr->patchlumpnum, PU_PATCH);
|
||||
|
||||
// cache the patch in the graphics card memory
|
||||
//12/12/99: Hurdler: same comment as above (for md2)
|
||||
|
@ -4688,7 +4688,7 @@ static void HWR_DrawSprite(gr_vissprite_t *spr)
|
|||
// sure to do it the right way. So actually, we keep normal sprite
|
||||
// in memory and we add the md2 model if it exists for that sprite
|
||||
|
||||
gpatch = W_CachePatchNum(spr->patchlumpnum, PU_CACHE);
|
||||
gpatch = W_CachePatchNum(spr->patchlumpnum, PU_PATCH);
|
||||
|
||||
#ifdef ALAM_LIGHTING
|
||||
if (!(spr->mobj->flags2 & MF2_DEBRIS) && (spr->mobj->sprite != SPR_PLAY ||
|
||||
|
@ -4833,7 +4833,7 @@ static inline void HWR_DrawPrecipitationSprite(gr_vissprite_t *spr)
|
|||
return;
|
||||
|
||||
// cache sprite graphics
|
||||
gpatch = W_CachePatchNum(spr->patchlumpnum, PU_CACHE);
|
||||
gpatch = W_CachePatchNum(spr->patchlumpnum, PU_PATCH);
|
||||
|
||||
// create the sprite billboard
|
||||
//
|
||||
|
|
|
@ -1401,7 +1401,7 @@ void HWR_DrawMD2(gr_vissprite_t *spr)
|
|||
else
|
||||
{
|
||||
// Sprite
|
||||
gpatch = W_CachePatchNum(spr->patchlumpnum, PU_CACHE);
|
||||
gpatch = W_CachePatchNum(spr->patchlumpnum, PU_PATCH);
|
||||
HWR_GetMappedPatch(gpatch, spr->colormap);
|
||||
}
|
||||
|
||||
|
|
|
@ -2087,6 +2087,9 @@ static void HU_DrawDemoInfo(void)
|
|||
//
|
||||
void HU_Drawer(void)
|
||||
{
|
||||
if (needpatchrecache)
|
||||
R_ReloadHUDGraphics();
|
||||
|
||||
#ifndef NONET
|
||||
// draw chat string plus cursor
|
||||
if (chat_on)
|
||||
|
|
|
@ -84,6 +84,7 @@ INT32 VID_GetModeForSize(INT32 w, INT32 h);
|
|||
\return currect video mode
|
||||
*/
|
||||
INT32 VID_SetMode(INT32 modenum);
|
||||
void VID_CheckRenderer(void);
|
||||
|
||||
/** \brief The VID_GetModeName function
|
||||
|
||||
|
|
|
@ -407,7 +407,7 @@ static int libd_getSpritePatch(lua_State *L)
|
|||
return 0;
|
||||
|
||||
// push both the patch and it's "flip" value
|
||||
LUA_PushUserdata(L, W_CachePatchNum(sprframe->lumppat[angle], PU_STATIC), META_PATCH);
|
||||
LUA_PushUserdata(L, W_CachePatchNum(sprframe->lumppat[angle], PU_PATCH), META_PATCH);
|
||||
lua_pushboolean(L, (sprframe->flip & (1<<angle)) != 0);
|
||||
return 2;
|
||||
}
|
||||
|
@ -502,7 +502,7 @@ static int libd_getSprite2Patch(lua_State *L)
|
|||
return 0;
|
||||
|
||||
// push both the patch and it's "flip" value
|
||||
LUA_PushUserdata(L, W_CachePatchNum(sprframe->lumppat[angle], PU_STATIC), META_PATCH);
|
||||
LUA_PushUserdata(L, W_CachePatchNum(sprframe->lumppat[angle], PU_PATCH), META_PATCH);
|
||||
lua_pushboolean(L, (sprframe->flip & (1<<angle)) != 0);
|
||||
return 2;
|
||||
}
|
||||
|
|
120
src/m_menu.c
120
src/m_menu.c
|
@ -1161,10 +1161,7 @@ static menuitem_t OP_VideoOptionsMenu[] =
|
|||
{IT_STRING|IT_CVAR, NULL, "Fullscreen", &cv_fullscreen, 11},
|
||||
#endif
|
||||
{IT_STRING | IT_CVAR, NULL, "Vertical Sync", &cv_vidwait, 16},
|
||||
|
||||
#ifdef HWRENDER
|
||||
{IT_SUBMENU|IT_STRING, NULL, "OpenGL Options...", &OP_OpenGLOptionsDef, 21},
|
||||
#endif
|
||||
{IT_STRING | IT_CVAR, NULL, "Renderer", &cv_renderer, 21},
|
||||
|
||||
{IT_HEADER, NULL, "Color Profile", NULL, 30},
|
||||
{IT_STRING | IT_CVAR | IT_CV_SLIDER, NULL, "Brightness (F11)", &cv_globalgamma,36},
|
||||
|
@ -1202,6 +1199,11 @@ static menuitem_t OP_VideoOptionsMenu[] =
|
|||
{IT_HEADER, NULL, "Diagnostic", NULL, 180},
|
||||
{IT_STRING | IT_CVAR, NULL, "Show FPS", &cv_ticrate, 186},
|
||||
{IT_STRING | IT_CVAR, NULL, "Clear Before Redraw", &cv_homremoval, 191},
|
||||
|
||||
#ifdef HWRENDER
|
||||
{IT_HEADER, NULL, "Renderer", NULL, 200},
|
||||
{IT_SUBMENU|IT_STRING, NULL, "OpenGL Options...", &OP_OpenGLOptionsDef, 206},
|
||||
#endif
|
||||
};
|
||||
|
||||
static menuitem_t OP_VideoModeMenu[] =
|
||||
|
@ -3588,19 +3590,19 @@ static void M_DrawThermo(INT32 x, INT32 y, consvar_t *cv)
|
|||
centerlump[1] = W_GetNumForName("M_THERMM");
|
||||
cursorlump = W_GetNumForName("M_THERMO");
|
||||
|
||||
V_DrawScaledPatch(xx, y, 0, p = W_CachePatchNum(leftlump,PU_CACHE));
|
||||
V_DrawScaledPatch(xx, y, 0, p = W_CachePatchNum(leftlump,PU_PATCH));
|
||||
xx += SHORT(p->width) - SHORT(p->leftoffset);
|
||||
for (i = 0; i < 16; i++)
|
||||
{
|
||||
V_DrawScaledPatch(xx, y, V_WRAPX, W_CachePatchNum(centerlump[i & 1], PU_CACHE));
|
||||
V_DrawScaledPatch(xx, y, V_WRAPX, W_CachePatchNum(centerlump[i & 1], PU_PATCH));
|
||||
xx += 8;
|
||||
}
|
||||
V_DrawScaledPatch(xx, y, 0, W_CachePatchNum(rightlump, PU_CACHE));
|
||||
V_DrawScaledPatch(xx, y, 0, W_CachePatchNum(rightlump, PU_PATCH));
|
||||
|
||||
xx = (cv->value - cv->PossibleValue[0].value) * (15*8) /
|
||||
(cv->PossibleValue[1].value - cv->PossibleValue[0].value);
|
||||
|
||||
V_DrawScaledPatch((x + 8) + xx, y, 0, W_CachePatchNum(cursorlump, PU_CACHE));
|
||||
V_DrawScaledPatch((x + 8) + xx, y, 0, W_CachePatchNum(cursorlump, PU_PATCH));
|
||||
}
|
||||
|
||||
// A smaller 'Thermo', with range given as percents (0-100)
|
||||
|
@ -3678,15 +3680,15 @@ void M_DrawTextBox(INT32 x, INT32 y, INT32 width, INT32 boxlines)
|
|||
// draw left side
|
||||
cx = x;
|
||||
cy = y;
|
||||
V_DrawScaledPatch(cx, cy, 0, W_CachePatchNum(viewborderlump[BRDR_TL], PU_CACHE));
|
||||
V_DrawScaledPatch(cx, cy, 0, W_CachePatchNum(viewborderlump[BRDR_TL], PU_PATCH));
|
||||
cy += boff;
|
||||
p = W_CachePatchNum(viewborderlump[BRDR_L], PU_CACHE);
|
||||
p = W_CachePatchNum(viewborderlump[BRDR_L], PU_PATCH);
|
||||
for (n = 0; n < boxlines; n++)
|
||||
{
|
||||
V_DrawScaledPatch(cx, cy, V_WRAPY, p);
|
||||
cy += step;
|
||||
}
|
||||
V_DrawScaledPatch(cx, cy, 0, W_CachePatchNum(viewborderlump[BRDR_BL], PU_CACHE));
|
||||
V_DrawScaledPatch(cx, cy, 0, W_CachePatchNum(viewborderlump[BRDR_BL], PU_PATCH));
|
||||
|
||||
// draw middle
|
||||
V_DrawFlatFill(x + boff, y + boff, width*step, boxlines*step, st_borderpatchnum);
|
||||
|
@ -3695,23 +3697,23 @@ void M_DrawTextBox(INT32 x, INT32 y, INT32 width, INT32 boxlines)
|
|||
cy = y;
|
||||
while (width > 0)
|
||||
{
|
||||
V_DrawScaledPatch(cx, cy, V_WRAPX, W_CachePatchNum(viewborderlump[BRDR_T], PU_CACHE));
|
||||
V_DrawScaledPatch(cx, y + boff + boxlines*step, V_WRAPX, W_CachePatchNum(viewborderlump[BRDR_B], PU_CACHE));
|
||||
V_DrawScaledPatch(cx, cy, V_WRAPX, W_CachePatchNum(viewborderlump[BRDR_T], PU_PATCH));
|
||||
V_DrawScaledPatch(cx, y + boff + boxlines*step, V_WRAPX, W_CachePatchNum(viewborderlump[BRDR_B], PU_PATCH));
|
||||
width--;
|
||||
cx += step;
|
||||
}
|
||||
|
||||
// draw right side
|
||||
cy = y;
|
||||
V_DrawScaledPatch(cx, cy, 0, W_CachePatchNum(viewborderlump[BRDR_TR], PU_CACHE));
|
||||
V_DrawScaledPatch(cx, cy, 0, W_CachePatchNum(viewborderlump[BRDR_TR], PU_PATCH));
|
||||
cy += boff;
|
||||
p = W_CachePatchNum(viewborderlump[BRDR_R], PU_CACHE);
|
||||
p = W_CachePatchNum(viewborderlump[BRDR_R], PU_PATCH);
|
||||
for (n = 0; n < boxlines; n++)
|
||||
{
|
||||
V_DrawScaledPatch(cx, cy, V_WRAPY, p);
|
||||
cy += step;
|
||||
}
|
||||
V_DrawScaledPatch(cx, cy, 0, W_CachePatchNum(viewborderlump[BRDR_BR], PU_CACHE));
|
||||
V_DrawScaledPatch(cx, cy, 0, W_CachePatchNum(viewborderlump[BRDR_BR], PU_PATCH));
|
||||
*/
|
||||
}
|
||||
|
||||
|
@ -4781,13 +4783,13 @@ static boolean M_PrepareLevelPlatter(INT32 gt, boolean nextmappick)
|
|||
W_UnlockCachedPatch(levselp[1][2]);
|
||||
}
|
||||
|
||||
levselp[0][0] = W_CachePatchName("SLCT1LVL", PU_STATIC);
|
||||
levselp[0][1] = W_CachePatchName("SLCT2LVL", PU_STATIC);
|
||||
levselp[0][2] = W_CachePatchName("BLANKLVL", PU_STATIC);
|
||||
levselp[0][0] = W_CachePatchName("SLCT1LVL", PU_PATCH);
|
||||
levselp[0][1] = W_CachePatchName("SLCT2LVL", PU_PATCH);
|
||||
levselp[0][2] = W_CachePatchName("BLANKLVL", PU_PATCH);
|
||||
|
||||
levselp[1][0] = W_CachePatchName("SLCT1LVW", PU_STATIC);
|
||||
levselp[1][1] = W_CachePatchName("SLCT2LVW", PU_STATIC);
|
||||
levselp[1][2] = W_CachePatchName("BLANKLVW", PU_STATIC);
|
||||
levselp[1][0] = W_CachePatchName("SLCT1LVW", PU_PATCH);
|
||||
levselp[1][1] = W_CachePatchName("SLCT2LVW", PU_PATCH);
|
||||
levselp[1][2] = W_CachePatchName("BLANKLVW", PU_PATCH);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
@ -5435,6 +5437,27 @@ static void M_AddonsOptions(INT32 choice)
|
|||
#define LOCATIONSTRING1 "Visit \x83SRB2.ORG/MODS\x80 to get & make add-ons!"
|
||||
//#define LOCATIONSTRING2 "Visit \x88SRB2.ORG/MODS\x80 to get & make add-ons!"
|
||||
|
||||
static void M_LoadAddonsPatches(void)
|
||||
{
|
||||
addonsp[EXT_FOLDER] = W_CachePatchName("M_FFLDR", PU_PATCH);
|
||||
addonsp[EXT_UP] = W_CachePatchName("M_FBACK", PU_PATCH);
|
||||
addonsp[EXT_NORESULTS] = W_CachePatchName("M_FNOPE", PU_PATCH);
|
||||
addonsp[EXT_TXT] = W_CachePatchName("M_FTXT", PU_PATCH);
|
||||
addonsp[EXT_CFG] = W_CachePatchName("M_FCFG", PU_PATCH);
|
||||
addonsp[EXT_WAD] = W_CachePatchName("M_FWAD", PU_PATCH);
|
||||
#ifdef USE_KART
|
||||
addonsp[EXT_KART] = W_CachePatchName("M_FKART", PU_PATCH);
|
||||
#endif
|
||||
addonsp[EXT_PK3] = W_CachePatchName("M_FPK3", PU_PATCH);
|
||||
addonsp[EXT_SOC] = W_CachePatchName("M_FSOC", PU_PATCH);
|
||||
addonsp[EXT_LUA] = W_CachePatchName("M_FLUA", PU_PATCH);
|
||||
addonsp[NUM_EXT] = W_CachePatchName("M_FUNKN", PU_PATCH);
|
||||
addonsp[NUM_EXT+1] = W_CachePatchName("M_FSEL", PU_PATCH);
|
||||
addonsp[NUM_EXT+2] = W_CachePatchName("M_FLOAD", PU_PATCH);
|
||||
addonsp[NUM_EXT+3] = W_CachePatchName("M_FSRCH", PU_PATCH);
|
||||
addonsp[NUM_EXT+4] = W_CachePatchName("M_FSAVE", PU_PATCH);
|
||||
}
|
||||
|
||||
static void M_Addons(INT32 choice)
|
||||
{
|
||||
const char *pathname = ".";
|
||||
|
@ -5485,23 +5508,7 @@ static void M_Addons(INT32 choice)
|
|||
W_UnlockCachedPatch(addonsp[i]);
|
||||
}
|
||||
|
||||
addonsp[EXT_FOLDER] = W_CachePatchName("M_FFLDR", PU_STATIC);
|
||||
addonsp[EXT_UP] = W_CachePatchName("M_FBACK", PU_STATIC);
|
||||
addonsp[EXT_NORESULTS] = W_CachePatchName("M_FNOPE", PU_STATIC);
|
||||
addonsp[EXT_TXT] = W_CachePatchName("M_FTXT", PU_STATIC);
|
||||
addonsp[EXT_CFG] = W_CachePatchName("M_FCFG", PU_STATIC);
|
||||
addonsp[EXT_WAD] = W_CachePatchName("M_FWAD", PU_STATIC);
|
||||
#ifdef USE_KART
|
||||
addonsp[EXT_KART] = W_CachePatchName("M_FKART", PU_STATIC);
|
||||
#endif
|
||||
addonsp[EXT_PK3] = W_CachePatchName("M_FPK3", PU_STATIC);
|
||||
addonsp[EXT_SOC] = W_CachePatchName("M_FSOC", PU_STATIC);
|
||||
addonsp[EXT_LUA] = W_CachePatchName("M_FLUA", PU_STATIC);
|
||||
addonsp[NUM_EXT] = W_CachePatchName("M_FUNKN", PU_STATIC);
|
||||
addonsp[NUM_EXT+1] = W_CachePatchName("M_FSEL", PU_STATIC);
|
||||
addonsp[NUM_EXT+2] = W_CachePatchName("M_FLOAD", PU_STATIC);
|
||||
addonsp[NUM_EXT+3] = W_CachePatchName("M_FSRCH", PU_STATIC);
|
||||
addonsp[NUM_EXT+4] = W_CachePatchName("M_FSAVE", PU_STATIC);
|
||||
M_LoadAddonsPatches();
|
||||
|
||||
MISC_AddonsDef.prevMenu = currentMenu;
|
||||
M_SetupNextMenu(&MISC_AddonsDef);
|
||||
|
@ -5640,6 +5647,9 @@ static void M_DrawAddons(void)
|
|||
return;
|
||||
}
|
||||
|
||||
if (needpatchrecache)
|
||||
M_LoadAddonsPatches();
|
||||
|
||||
if (Playing())
|
||||
V_DrawCenteredString(BASEVIDWIDTH/2, 5, warningflags, "Adding files mid-game may cause problems.");
|
||||
else
|
||||
|
@ -7015,7 +7025,7 @@ static void M_DrawLoadGameData(void)
|
|||
{
|
||||
lumpnum_t lumpnum = W_CheckNumForName(va("%sP", G_BuildMapName((savegameinfo[savetodraw].gamemap) & 8191)));
|
||||
if (lumpnum != LUMPERROR)
|
||||
patch = W_CachePatchNum(lumpnum, PU_CACHE);
|
||||
patch = W_CachePatchNum(lumpnum, PU_PATCH);
|
||||
else
|
||||
patch = savselp[5];
|
||||
}
|
||||
|
@ -7071,7 +7081,7 @@ static void M_DrawLoadGameData(void)
|
|||
goto skipbot;
|
||||
colormap = R_GetTranslationColormap(savegameinfo[savetodraw].botskin, charbotskin->prefcolor, 0);
|
||||
sprframe = &sprdef->spriteframes[0];
|
||||
patch = W_CachePatchNum(sprframe->lumppat[0], PU_CACHE);
|
||||
patch = W_CachePatchNum(sprframe->lumppat[0], PU_PATCH);
|
||||
|
||||
V_DrawFixedPatch(
|
||||
tempx + (18<<FRACBITS),
|
||||
|
@ -7093,7 +7103,7 @@ skipbot:
|
|||
if (!sprdef->numframes)
|
||||
goto skipsign;
|
||||
sprframe = &sprdef->spriteframes[0];
|
||||
patch = W_CachePatchNum(sprframe->lumppat[0], PU_CACHE);
|
||||
patch = W_CachePatchNum(sprframe->lumppat[0], PU_PATCH);
|
||||
if ((calc = SHORT(patch->topoffset) - 42) > 0)
|
||||
tempy += ((4+calc)<<FRACBITS);
|
||||
|
||||
|
@ -7119,7 +7129,7 @@ skipsign:
|
|||
if (!sprdef->numframes)
|
||||
goto skiplife;
|
||||
sprframe = &sprdef->spriteframes[0];
|
||||
patch = W_CachePatchNum(sprframe->lumppat[0], PU_CACHE);
|
||||
patch = W_CachePatchNum(sprframe->lumppat[0], PU_PATCH);
|
||||
|
||||
V_DrawFixedPatch(
|
||||
(tempx + 4)<<FRACBITS,
|
||||
|
@ -7374,13 +7384,13 @@ static void M_ReadSaveStrings(void)
|
|||
W_UnlockCachedPatch(savselp[5]);
|
||||
}
|
||||
|
||||
savselp[0] = W_CachePatchName("SAVEBACK", PU_STATIC);
|
||||
savselp[1] = W_CachePatchName("SAVENONE", PU_STATIC);
|
||||
savselp[2] = W_CachePatchName("ULTIMATE", PU_STATIC);
|
||||
savselp[0] = W_CachePatchName("SAVEBACK", PU_PATCH);
|
||||
savselp[1] = W_CachePatchName("SAVENONE", PU_PATCH);
|
||||
savselp[2] = W_CachePatchName("ULTIMATE", PU_PATCH);
|
||||
|
||||
savselp[3] = W_CachePatchName("GAMEDONE", PU_STATIC);
|
||||
savselp[4] = W_CachePatchName("BLACXLVL", PU_STATIC);
|
||||
savselp[5] = W_CachePatchName("BLANKLVL", PU_STATIC);
|
||||
savselp[3] = W_CachePatchName("GAMEDONE", PU_PATCH);
|
||||
savselp[4] = W_CachePatchName("BLACXLVL", PU_PATCH);
|
||||
savselp[5] = W_CachePatchName("BLANKLVL", PU_PATCH);
|
||||
}
|
||||
|
||||
//
|
||||
|
@ -7597,13 +7607,13 @@ static void M_SetupChoosePlayer(INT32 choice)
|
|||
{
|
||||
spritedef_t *sprdef = &skins[skinnum].sprites[SPR2_XTRA];
|
||||
spriteframe_t *sprframe = &sprdef->spriteframes[1];
|
||||
description[i].pic = W_CachePatchNum(sprframe->lumppat[0], PU_CACHE);
|
||||
description[i].pic = W_CachePatchNum(sprframe->lumppat[0], PU_PATCH);
|
||||
}
|
||||
else
|
||||
description[i].pic = W_CachePatchName("MISSING", PU_CACHE);
|
||||
description[i].pic = W_CachePatchName("MISSING", PU_PATCH);
|
||||
}
|
||||
else
|
||||
description[i].pic = W_CachePatchName(description[i].picname, PU_CACHE);
|
||||
description[i].pic = W_CachePatchName(description[i].picname, PU_PATCH);
|
||||
}
|
||||
// else -- Technically, character select icons without corresponding skins get bundled away behind this too. Sucks to be them.
|
||||
Z_Free(name);
|
||||
|
@ -8044,7 +8054,7 @@ static void M_DrawLevelStats(void)
|
|||
V_DrawString(20, 56, V_GREENMAP, "(complete)");
|
||||
|
||||
V_DrawString(36, 64, 0, va("x %d/%d", M_CountEmblems(), numemblems+numextraemblems));
|
||||
V_DrawSmallScaledPatch(20, 64, 0, W_CachePatchName("EMBLICON", PU_STATIC));
|
||||
V_DrawSmallScaledPatch(20, 64, 0, W_CachePatchName("EMBLICON", PU_PATCH));
|
||||
|
||||
sprintf(beststr, "%u", bestscore);
|
||||
V_DrawString(BASEVIDWIDTH/2, 48, V_YELLOWMAP, "SCORE:");
|
||||
|
@ -9481,7 +9491,7 @@ static void M_DrawSetupMultiPlayerMenu(void)
|
|||
multi_frame = 0;
|
||||
|
||||
sprframe = &sprdef->spriteframes[multi_frame];
|
||||
patch = W_CachePatchNum(sprframe->lumppat[0], PU_CACHE);
|
||||
patch = W_CachePatchNum(sprframe->lumppat[0], PU_PATCH);
|
||||
if (sprframe->flip & 1) // Only for first sprite
|
||||
flags |= V_FLIP; // This sprite is left/right flipped!
|
||||
|
||||
|
@ -9502,7 +9512,7 @@ faildraw:
|
|||
return; // Can't render!
|
||||
|
||||
sprframe = &sprdef->spriteframes[0];
|
||||
patch = W_CachePatchNum(sprframe->lumppat[0], PU_CACHE);
|
||||
patch = W_CachePatchNum(sprframe->lumppat[0], PU_PATCH);
|
||||
if (sprframe->flip & 1) // Only for first sprite
|
||||
flags |= V_FLIP; // This sprite is left/right flipped!
|
||||
|
||||
|
|
|
@ -2955,16 +2955,8 @@ boolean P_SetupLevel(boolean skipprecip)
|
|||
P_SpawnPrecipitation();
|
||||
|
||||
#ifdef HWRENDER // not win32 only 19990829 by Kin
|
||||
if (rendermode != render_soft && rendermode != render_none)
|
||||
{
|
||||
#ifdef ALAM_LIGHTING
|
||||
// BP: reset light between levels (we draw preview frame lights on current frame)
|
||||
HWR_ResetLights();
|
||||
#endif
|
||||
// Correct missing sidedefs & deep water trick
|
||||
HWR_CorrectSWTricks();
|
||||
HWR_CreatePlanePolygons((INT32)numnodes - 1);
|
||||
}
|
||||
if (rendermode == render_opengl)
|
||||
HWR_SetupLevel();
|
||||
#endif
|
||||
|
||||
// oh god I hope this helps
|
||||
|
@ -3119,10 +3111,8 @@ boolean P_SetupLevel(boolean skipprecip)
|
|||
|
||||
// preload graphics
|
||||
#ifdef HWRENDER // not win32 only 19990829 by Kin
|
||||
if (rendermode != render_soft && rendermode != render_none)
|
||||
{
|
||||
if (rendermode == render_opengl)
|
||||
HWR_PrepLevelCache(numtextures);
|
||||
}
|
||||
#endif
|
||||
|
||||
P_MapEnd();
|
||||
|
@ -3220,6 +3210,19 @@ boolean P_SetupLevel(boolean skipprecip)
|
|||
return true;
|
||||
}
|
||||
|
||||
#ifdef HWRENDER
|
||||
void HWR_SetupLevel(void)
|
||||
{
|
||||
#ifdef ALAM_LIGHTING
|
||||
// BP: reset light between levels (we draw preview frame lights on current frame)
|
||||
HWR_ResetLights();
|
||||
#endif
|
||||
// Correct missing sidedefs & deep water trick
|
||||
HWR_CorrectSWTricks();
|
||||
HWR_CreatePlanePolygons((INT32)numnodes - 1);
|
||||
}
|
||||
#endif
|
||||
|
||||
//
|
||||
// P_RunSOC
|
||||
//
|
||||
|
|
|
@ -60,6 +60,9 @@ void P_ScanThings(INT16 mapnum, INT16 wadnum, INT16 lumpnum);
|
|||
#endif
|
||||
void P_LoadThingsOnly(void);
|
||||
boolean P_SetupLevel(boolean skipprecip);
|
||||
#ifdef HWRENDER
|
||||
void HWR_SetupLevel(void);
|
||||
#endif
|
||||
boolean P_AddWadFile(const char *wadfilename);
|
||||
boolean P_RunSOC(const char *socfilename);
|
||||
void P_LoadSoundsRange(UINT16 wadnum, UINT16 first, UINT16 num);
|
||||
|
|
|
@ -95,6 +95,8 @@ size_t numspritelumps, max_spritelumps;
|
|||
|
||||
// textures
|
||||
INT32 numtextures = 0; // total number of textures found,
|
||||
boolean needpatchflush = false;
|
||||
boolean needpatchrecache = false;
|
||||
// size of following tables
|
||||
|
||||
texture_t **textures = NULL;
|
||||
|
@ -1672,7 +1674,7 @@ lighttable_t *R_CreateLightTable(extracolormap_t *extra_colormap)
|
|||
/////////////////////
|
||||
// This code creates the colormap array used by software renderer
|
||||
/////////////////////
|
||||
if (rendermode == render_soft)
|
||||
//if (rendermode == render_soft)
|
||||
{
|
||||
double r, g, b, cbrightness;
|
||||
int p;
|
||||
|
@ -2294,7 +2296,7 @@ void R_PrecacheLevel(void)
|
|||
lump = sf->lumppat[k];
|
||||
if (devparm)
|
||||
spritememory += W_LumpLength(lump);
|
||||
W_CachePatchNum(lump, PU_CACHE);
|
||||
W_CachePatchNum(lump, PU_PATCH);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -149,5 +149,7 @@ const char *R_NameForColormap(extracolormap_t *extra_colormap);
|
|||
#define R_PutRgbaRGBA(r, g, b, a) (R_PutRgbaRGB(r, g, b) + R_PutRgbaA(a))
|
||||
|
||||
extern INT32 numtextures;
|
||||
extern boolean needpatchflush;
|
||||
extern boolean needpatchrecache;
|
||||
|
||||
#endif
|
||||
|
|
21
src/r_main.c
21
src/r_main.c
|
@ -19,6 +19,7 @@
|
|||
#include "r_local.h"
|
||||
#include "r_splats.h" // faB(21jan): testing
|
||||
#include "r_sky.h"
|
||||
#include "hu_stuff.h"
|
||||
#include "st_stuff.h"
|
||||
#include "p_local.h"
|
||||
#include "keys.h"
|
||||
|
@ -28,6 +29,7 @@
|
|||
#include "d_main.h"
|
||||
#include "v_video.h"
|
||||
#include "p_spec.h" // skyboxmo
|
||||
#include "p_setup.h"
|
||||
#include "z_zone.h"
|
||||
#include "m_random.h" // quake camera shake
|
||||
#include "r_portal.h"
|
||||
|
@ -1148,6 +1150,25 @@ void R_RenderPlayerView(player_t *player)
|
|||
free(masks);
|
||||
}
|
||||
|
||||
#ifdef HWRENDER
|
||||
void R_InitHardwareMode(void)
|
||||
{
|
||||
if (gamestate == GS_LEVEL)
|
||||
{
|
||||
HWR_SetupLevel();
|
||||
HWR_PrepLevelCache(numtextures);
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
void R_ReloadHUDGraphics(void)
|
||||
{
|
||||
W_FlushCachedPatches();
|
||||
ST_LoadGraphics();
|
||||
HU_LoadGraphics();
|
||||
ST_ReloadSkinFaceGraphics();
|
||||
}
|
||||
|
||||
// =========================================================================
|
||||
// ENGINE COMMANDS & VARS
|
||||
// =========================================================================
|
||||
|
|
|
@ -84,6 +84,10 @@ extern consvar_t cv_tailspickup;
|
|||
|
||||
// Called by startup code.
|
||||
void R_Init(void);
|
||||
#ifdef HWRENDER
|
||||
void R_InitHardwareMode(void);
|
||||
#endif
|
||||
void R_ReloadHUDGraphics(void);
|
||||
|
||||
// just sets setsizeneeded true
|
||||
extern boolean setsizeneeded;
|
||||
|
|
|
@ -165,7 +165,7 @@ static void R_DrawWallSplats(void)
|
|||
mfloorclip = floorclip;
|
||||
mceilingclip = ceilingclip;
|
||||
|
||||
patch = W_CachePatchNum(splat->patch, PU_CACHE);
|
||||
patch = W_CachePatchNum(splat->patch, PU_PATCH);
|
||||
|
||||
dc_texturemid = splat->top + (SHORT(patch->height)<<(FRACBITS-1)) - viewz;
|
||||
if (splat->yoffset)
|
||||
|
|
|
@ -147,7 +147,7 @@ void R_AddWallSplat(line_t *wallline, INT16 sectorside, const char *patchname, f
|
|||
splat->flags = flags;
|
||||
|
||||
// bad.. but will be needed for drawing anyway..
|
||||
patch = W_CachePatchNum(splat->patch, PU_CACHE);
|
||||
patch = W_CachePatchNum(splat->patch, PU_PATCH);
|
||||
|
||||
// offset needed by draw code for texture mapping
|
||||
linelength = P_SegLength((seg_t *)wallline);
|
||||
|
|
65
src/screen.c
65
src/screen.c
|
@ -60,6 +60,7 @@ void (*twosmultipatchtransfunc)(void); // for cols with transparent pixels AND t
|
|||
// ------------------
|
||||
viddef_t vid;
|
||||
INT32 setmodeneeded; //video mode change needed if > 0 (the mode number to set + 1)
|
||||
INT32 setrenderneeded = 0;
|
||||
|
||||
static CV_PossibleValue_t scr_depth_cons_t[] = {{8, "8 bits"}, {16, "16 bits"}, {24, "24 bits"}, {32, "32 bits"}, {0, NULL}};
|
||||
|
||||
|
@ -69,6 +70,10 @@ consvar_t cv_scr_height = {"scr_height", "800", CV_SAVE, CV_Unsigned, NULL, 0, N
|
|||
consvar_t cv_scr_depth = {"scr_depth", "16 bits", CV_SAVE, scr_depth_cons_t, NULL, 0, NULL, NULL, 0, 0, NULL};
|
||||
consvar_t cv_renderview = {"renderview", "On", 0, CV_OnOff, NULL, 0, NULL, NULL, 0, 0, NULL};
|
||||
|
||||
static void SCR_ChangeRenderer (void);
|
||||
static CV_PossibleValue_t cv_renderer_t[] = {{1, "Software"}, {2, "OpenGL"}, {0, NULL}};
|
||||
consvar_t cv_renderer = {"renderer", "Software", CV_CALL, cv_renderer_t, SCR_ChangeRenderer, 0, NULL, NULL, 0, 0, NULL};
|
||||
|
||||
static void SCR_ChangeFullscreen (void);
|
||||
|
||||
consvar_t cv_fullscreen = {"fullscreen", "Yes", CV_SAVE|CV_CALL, CV_YesNo, SCR_ChangeFullscreen, 0, NULL, NULL, 0, 0, NULL};
|
||||
|
@ -94,19 +99,8 @@ boolean R_3DNow = false;
|
|||
boolean R_MMXExt = false;
|
||||
boolean R_SSE2 = false;
|
||||
|
||||
|
||||
void SCR_SetMode(void)
|
||||
void SCR_SetDrawFuncs(void)
|
||||
{
|
||||
if (dedicated)
|
||||
return;
|
||||
|
||||
if (!setmodeneeded || WipeInAction)
|
||||
return; // should never happen and don't change it during a wipe, BAD!
|
||||
|
||||
VID_SetMode(--setmodeneeded);
|
||||
|
||||
V_SetPalette(0);
|
||||
|
||||
//
|
||||
// setup the right draw routines for either 8bpp or 16bpp
|
||||
//
|
||||
|
@ -166,9 +160,33 @@ void SCR_SetMode(void)
|
|||
*/
|
||||
|
||||
wallcolfunc = walldrawerfunc;
|
||||
}
|
||||
|
||||
void SCR_SetMode(void)
|
||||
{
|
||||
if (dedicated)
|
||||
return;
|
||||
|
||||
if (!(setmodeneeded || setrenderneeded) || WipeInAction)
|
||||
return; // should never happen and don't change it during a wipe, BAD!
|
||||
|
||||
if (setrenderneeded)
|
||||
{
|
||||
needpatchflush = true;
|
||||
needpatchrecache = true;
|
||||
VID_CheckRenderer();
|
||||
}
|
||||
|
||||
if (setmodeneeded)
|
||||
VID_SetMode(--setmodeneeded);
|
||||
|
||||
V_SetPalette(0);
|
||||
|
||||
SCR_SetDrawFuncs();
|
||||
|
||||
// set the apprpriate drawer for the sky (tall or INT16)
|
||||
setmodeneeded = 0;
|
||||
setrenderneeded = 0;
|
||||
}
|
||||
|
||||
// do some initial settings for the game loading screen
|
||||
|
@ -385,6 +403,29 @@ void SCR_ChangeFullscreen(void)
|
|||
#endif
|
||||
}
|
||||
|
||||
void SCR_ChangeRenderer(void)
|
||||
{
|
||||
setrenderneeded = 0;
|
||||
|
||||
if (con_startup)
|
||||
{
|
||||
if (rendermode == render_soft)
|
||||
CV_StealthSetValue(&cv_renderer, 1);
|
||||
else if (rendermode == render_opengl)
|
||||
CV_StealthSetValue(&cv_renderer, 2);
|
||||
return;
|
||||
}
|
||||
|
||||
if (cv_renderer.value == 1)
|
||||
setrenderneeded = render_soft;
|
||||
else if (cv_renderer.value == 2)
|
||||
setrenderneeded = render_opengl;
|
||||
|
||||
// setting the same renderer twice WILL crash your game, so let's not, please
|
||||
if (rendermode == setrenderneeded)
|
||||
setrenderneeded = 0;
|
||||
}
|
||||
|
||||
boolean SCR_IsAspectCorrect(INT32 width, INT32 height)
|
||||
{
|
||||
return
|
||||
|
|
|
@ -144,11 +144,12 @@ extern boolean R_SSE2;
|
|||
// ----------------
|
||||
extern viddef_t vid;
|
||||
extern INT32 setmodeneeded; // mode number to set if needed, or 0
|
||||
extern INT32 setrenderneeded;
|
||||
|
||||
extern INT32 scr_bpp;
|
||||
extern UINT8 *scr_borderpatch; // patch used to fill the view borders
|
||||
|
||||
extern consvar_t cv_scr_width, cv_scr_height, cv_scr_depth, cv_renderview, cv_fullscreen;
|
||||
extern consvar_t cv_scr_width, cv_scr_height, cv_scr_depth, cv_renderview, cv_renderer, cv_fullscreen;
|
||||
// wait for page flipping to end or not
|
||||
extern consvar_t cv_vidwait;
|
||||
|
||||
|
@ -157,6 +158,7 @@ extern void (*walldrawerfunc)(void);
|
|||
|
||||
// Change video mode, only at the start of a refresh.
|
||||
void SCR_SetMode(void);
|
||||
void SCR_SetDrawFuncs(void);
|
||||
// Recalc screen size dependent stuff
|
||||
void SCR_Recalc(void);
|
||||
// Check parms once at startup
|
||||
|
|
|
@ -70,6 +70,7 @@
|
|||
#include "../i_video.h"
|
||||
#include "../console.h"
|
||||
#include "../command.h"
|
||||
#include "../r_main.h"
|
||||
#include "sdlmain.h"
|
||||
#ifdef HWRENDER
|
||||
#include "../hardware/hw_main.h"
|
||||
|
@ -169,6 +170,7 @@ static void Impl_VideoSetupBuffer(void);
|
|||
static SDL_bool Impl_CreateWindow(SDL_bool fullscreen);
|
||||
//static void Impl_SetWindowName(const char *title);
|
||||
static void Impl_SetWindowIcon(void);
|
||||
static void I_StartupGraphicsGL(void);
|
||||
|
||||
static void SDLSetMode(INT32 width, INT32 height, SDL_bool fullscreen)
|
||||
{
|
||||
|
@ -1062,7 +1064,6 @@ void I_FinishUpdate(void)
|
|||
SDL_RenderCopy(renderer, texture, NULL, NULL);
|
||||
SDL_RenderPresent(renderer);
|
||||
}
|
||||
|
||||
#ifdef HWRENDER
|
||||
else if (rendermode == render_opengl)
|
||||
{
|
||||
|
@ -1262,6 +1263,81 @@ void VID_PrepareModeList(void)
|
|||
#endif
|
||||
}
|
||||
|
||||
// SOMETIME IN
|
||||
// THE FUTURE
|
||||
// WHEN I ACTUALLY RENDER
|
||||
// THIS FRAME
|
||||
static int renderflags;
|
||||
static SDL_bool Impl_CreateContext(int flags)
|
||||
{
|
||||
// Renderer-specific stuff
|
||||
#ifdef HWRENDER
|
||||
if (rendermode == render_opengl)
|
||||
{
|
||||
if (!sdlglcontext)
|
||||
sdlglcontext = SDL_GL_CreateContext(window);
|
||||
if (sdlglcontext == NULL)
|
||||
{
|
||||
SDL_DestroyWindow(window);
|
||||
I_Error("Failed to create a GL context: %s\n", SDL_GetError());
|
||||
}
|
||||
SDL_GL_MakeCurrent(window, sdlglcontext);
|
||||
}
|
||||
else
|
||||
#endif
|
||||
if (rendermode == render_soft)
|
||||
{
|
||||
flags = 0; // Use this to set SDL_RENDERER_* flags now
|
||||
if (usesdl2soft)
|
||||
flags |= SDL_RENDERER_SOFTWARE;
|
||||
else if (cv_vidwait.value)
|
||||
flags |= SDL_RENDERER_PRESENTVSYNC;
|
||||
|
||||
if (!renderer)
|
||||
renderer = SDL_CreateRenderer(window, -1, flags);
|
||||
if (renderer == NULL)
|
||||
{
|
||||
CONS_Printf(M_GetText("Couldn't create rendering context: %s\n"), SDL_GetError());
|
||||
return SDL_FALSE;
|
||||
}
|
||||
SDL_RenderSetLogicalSize(renderer, BASEVIDWIDTH, BASEVIDHEIGHT);
|
||||
}
|
||||
return SDL_TRUE;
|
||||
}
|
||||
|
||||
void VID_CheckRenderer(void)
|
||||
{
|
||||
if (setrenderneeded)
|
||||
{
|
||||
rendermode = setrenderneeded;
|
||||
Impl_CreateContext(renderflags);
|
||||
if (rendermode == render_soft)
|
||||
{
|
||||
#ifdef HWRENDER
|
||||
HWR_FreeTextureCache();
|
||||
#endif
|
||||
SCR_SetDrawFuncs();
|
||||
}
|
||||
}
|
||||
|
||||
SDLSetMode(vid.width, vid.height, USE_FULLSCREEN);
|
||||
|
||||
if (rendermode == render_soft)
|
||||
{
|
||||
if (bufSurface)
|
||||
{
|
||||
SDL_FreeSurface(bufSurface);
|
||||
bufSurface = NULL;
|
||||
}
|
||||
Impl_VideoSetupBuffer();
|
||||
}
|
||||
else if (rendermode == render_opengl)
|
||||
{
|
||||
I_StartupGraphicsGL();
|
||||
R_InitHardwareMode();
|
||||
}
|
||||
}
|
||||
|
||||
INT32 VID_SetMode(INT32 modeNum)
|
||||
{
|
||||
SDLdoUngrabMouse();
|
||||
|
@ -1293,20 +1369,7 @@ INT32 VID_SetMode(INT32 modeNum)
|
|||
vid.modenum = -1;
|
||||
}
|
||||
//Impl_SetWindowName("SRB2 "VERSIONSTRING);
|
||||
|
||||
SDLSetMode(vid.width, vid.height, USE_FULLSCREEN);
|
||||
|
||||
if (rendermode == render_soft)
|
||||
{
|
||||
if (bufSurface)
|
||||
{
|
||||
SDL_FreeSurface(bufSurface);
|
||||
bufSurface = NULL;
|
||||
}
|
||||
|
||||
Impl_VideoSetupBuffer();
|
||||
}
|
||||
|
||||
VID_CheckRenderer();
|
||||
return SDL_TRUE;
|
||||
}
|
||||
|
||||
|
@ -1341,38 +1404,8 @@ static SDL_bool Impl_CreateWindow(SDL_bool fullscreen)
|
|||
return SDL_FALSE;
|
||||
}
|
||||
|
||||
// Renderer-specific stuff
|
||||
#ifdef HWRENDER
|
||||
if (rendermode == render_opengl)
|
||||
{
|
||||
sdlglcontext = SDL_GL_CreateContext(window);
|
||||
if (sdlglcontext == NULL)
|
||||
{
|
||||
SDL_DestroyWindow(window);
|
||||
I_Error("Failed to create a GL context: %s\n", SDL_GetError());
|
||||
}
|
||||
SDL_GL_MakeCurrent(window, sdlglcontext);
|
||||
}
|
||||
else
|
||||
#endif
|
||||
if (rendermode == render_soft)
|
||||
{
|
||||
flags = 0; // Use this to set SDL_RENDERER_* flags now
|
||||
if (usesdl2soft)
|
||||
flags |= SDL_RENDERER_SOFTWARE;
|
||||
else if (cv_vidwait.value)
|
||||
flags |= SDL_RENDERER_PRESENTVSYNC;
|
||||
|
||||
renderer = SDL_CreateRenderer(window, -1, flags);
|
||||
if (renderer == NULL)
|
||||
{
|
||||
CONS_Printf(M_GetText("Couldn't create rendering context: %s\n"), SDL_GetError());
|
||||
return SDL_FALSE;
|
||||
}
|
||||
SDL_RenderSetLogicalSize(renderer, BASEVIDWIDTH, BASEVIDHEIGHT);
|
||||
}
|
||||
|
||||
return SDL_TRUE;
|
||||
renderflags = flags;
|
||||
return Impl_CreateContext(flags);
|
||||
}
|
||||
|
||||
/*
|
||||
|
@ -1441,6 +1474,51 @@ static void Impl_VideoSetupBuffer(void)
|
|||
}
|
||||
}
|
||||
|
||||
static void I_StartupGraphicsGL(void)
|
||||
{
|
||||
#ifdef HWRENDER
|
||||
static boolean glstartup = false;
|
||||
if (!glstartup)
|
||||
{
|
||||
HWD.pfnInit = hwSym("Init",NULL);
|
||||
HWD.pfnFinishUpdate = NULL;
|
||||
HWD.pfnDraw2DLine = hwSym("Draw2DLine",NULL);
|
||||
HWD.pfnDrawPolygon = hwSym("DrawPolygon",NULL);
|
||||
HWD.pfnSetBlend = hwSym("SetBlend",NULL);
|
||||
HWD.pfnClearBuffer = hwSym("ClearBuffer",NULL);
|
||||
HWD.pfnSetTexture = hwSym("SetTexture",NULL);
|
||||
HWD.pfnReadRect = hwSym("ReadRect",NULL);
|
||||
HWD.pfnGClipRect = hwSym("GClipRect",NULL);
|
||||
HWD.pfnClearMipMapCache = hwSym("ClearMipMapCache",NULL);
|
||||
HWD.pfnSetSpecialState = hwSym("SetSpecialState",NULL);
|
||||
HWD.pfnSetPalette = hwSym("SetPalette",NULL);
|
||||
HWD.pfnGetTextureUsed = hwSym("GetTextureUsed",NULL);
|
||||
HWD.pfnDrawMD2 = hwSym("DrawMD2",NULL);
|
||||
HWD.pfnDrawMD2i = hwSym("DrawMD2i",NULL);
|
||||
HWD.pfnSetTransform = hwSym("SetTransform",NULL);
|
||||
HWD.pfnGetRenderVersion = hwSym("GetRenderVersion",NULL);
|
||||
#ifdef SHUFFLE
|
||||
HWD.pfnPostImgRedraw = hwSym("PostImgRedraw",NULL);
|
||||
#endif
|
||||
HWD.pfnFlushScreenTextures=hwSym("FlushScreenTextures",NULL);
|
||||
HWD.pfnStartScreenWipe = hwSym("StartScreenWipe",NULL);
|
||||
HWD.pfnEndScreenWipe = hwSym("EndScreenWipe",NULL);
|
||||
HWD.pfnDoScreenWipe = hwSym("DoScreenWipe",NULL);
|
||||
HWD.pfnDrawIntermissionBG=hwSym("DrawIntermissionBG",NULL);
|
||||
HWD.pfnMakeScreenTexture= hwSym("MakeScreenTexture",NULL);
|
||||
HWD.pfnMakeScreenFinalTexture=hwSym("MakeScreenFinalTexture",NULL);
|
||||
HWD.pfnDrawScreenFinalTexture=hwSym("DrawScreenFinalTexture",NULL);
|
||||
// check gl renderer lib
|
||||
if (HWD.pfnGetRenderVersion() != VERSION)
|
||||
I_Error("%s", M_GetText("The version of the renderer doesn't match the version of the executable\nBe sure you have installed SRB2 properly.\n"));
|
||||
if (!HWD.pfnInit(I_Error)) // let load the OpenGL library
|
||||
rendermode = render_soft;
|
||||
else
|
||||
glstartup = true;
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
void I_StartupGraphics(void)
|
||||
{
|
||||
if (dedicated)
|
||||
|
@ -1481,10 +1559,11 @@ void I_StartupGraphics(void)
|
|||
))
|
||||
framebuffer = SDL_TRUE;
|
||||
}
|
||||
if (M_CheckParm("-software"))
|
||||
{
|
||||
|
||||
if (M_CheckParm("-opengl"))
|
||||
rendermode = render_opengl;
|
||||
else if (M_CheckParm("software"))
|
||||
rendermode = render_soft;
|
||||
}
|
||||
|
||||
usesdl2soft = M_CheckParm("-softblit");
|
||||
borderlesswindow = M_CheckParm("-borderless");
|
||||
|
@ -1492,45 +1571,7 @@ void I_StartupGraphics(void)
|
|||
//SDL_EnableKeyRepeat(SDL_DEFAULT_REPEAT_DELAY>>1,SDL_DEFAULT_REPEAT_INTERVAL<<2);
|
||||
VID_Command_ModeList_f();
|
||||
#ifdef HWRENDER
|
||||
if (M_CheckParm("-opengl") || rendermode == render_opengl)
|
||||
{
|
||||
rendermode = render_opengl;
|
||||
HWD.pfnInit = hwSym("Init",NULL);
|
||||
HWD.pfnFinishUpdate = NULL;
|
||||
HWD.pfnDraw2DLine = hwSym("Draw2DLine",NULL);
|
||||
HWD.pfnDrawPolygon = hwSym("DrawPolygon",NULL);
|
||||
HWD.pfnSetBlend = hwSym("SetBlend",NULL);
|
||||
HWD.pfnClearBuffer = hwSym("ClearBuffer",NULL);
|
||||
HWD.pfnSetTexture = hwSym("SetTexture",NULL);
|
||||
HWD.pfnReadRect = hwSym("ReadRect",NULL);
|
||||
HWD.pfnGClipRect = hwSym("GClipRect",NULL);
|
||||
HWD.pfnClearMipMapCache = hwSym("ClearMipMapCache",NULL);
|
||||
HWD.pfnSetSpecialState = hwSym("SetSpecialState",NULL);
|
||||
HWD.pfnSetPalette = hwSym("SetPalette",NULL);
|
||||
HWD.pfnGetTextureUsed = hwSym("GetTextureUsed",NULL);
|
||||
HWD.pfnDrawMD2 = hwSym("DrawMD2",NULL);
|
||||
HWD.pfnDrawMD2i = hwSym("DrawMD2i",NULL);
|
||||
HWD.pfnSetTransform = hwSym("SetTransform",NULL);
|
||||
HWD.pfnGetRenderVersion = hwSym("GetRenderVersion",NULL);
|
||||
#ifdef SHUFFLE
|
||||
HWD.pfnPostImgRedraw = hwSym("PostImgRedraw",NULL);
|
||||
#endif
|
||||
HWD.pfnFlushScreenTextures=hwSym("FlushScreenTextures",NULL);
|
||||
HWD.pfnStartScreenWipe = hwSym("StartScreenWipe",NULL);
|
||||
HWD.pfnEndScreenWipe = hwSym("EndScreenWipe",NULL);
|
||||
HWD.pfnDoScreenWipe = hwSym("DoScreenWipe",NULL);
|
||||
HWD.pfnDrawIntermissionBG=hwSym("DrawIntermissionBG",NULL);
|
||||
HWD.pfnMakeScreenTexture= hwSym("MakeScreenTexture",NULL);
|
||||
HWD.pfnMakeScreenFinalTexture=hwSym("MakeScreenFinalTexture",NULL);
|
||||
HWD.pfnDrawScreenFinalTexture=hwSym("DrawScreenFinalTexture",NULL);
|
||||
// check gl renderer lib
|
||||
if (HWD.pfnGetRenderVersion() != VERSION)
|
||||
I_Error("%s", M_GetText("The version of the renderer doesn't match the version of the executable\nBe sure you have installed SRB2 properly.\n"));
|
||||
if (!HWD.pfnInit(I_Error)) // let load the OpenGL library
|
||||
{
|
||||
rendermode = render_soft;
|
||||
}
|
||||
}
|
||||
I_StartupGraphicsGL();
|
||||
#endif
|
||||
|
||||
// Fury: we do window initialization after GL setup to allow
|
||||
|
|
|
@ -2554,6 +2554,9 @@ static void ST_overlayDrawer(void)
|
|||
|
||||
void ST_Drawer(void)
|
||||
{
|
||||
if (needpatchrecache)
|
||||
R_ReloadHUDGraphics();
|
||||
|
||||
#ifdef SEENAMES
|
||||
if (cv_seenames.value && cv_allowseenames.value && displayplayer == consoleplayer && seenplayer && seenplayer->mo)
|
||||
{
|
||||
|
|
|
@ -1069,7 +1069,7 @@ void V_DrawContinueIcon(INT32 x, INT32 y, INT32 flags, INT32 skinnum, UINT8 skin
|
|||
else
|
||||
{
|
||||
spriteframe_t *sprframe = &skins[skinnum].sprites[SPR2_WAIT].spriteframes[0];
|
||||
patch_t *patch = W_CachePatchNum(sprframe->lumppat[0], PU_CACHE);
|
||||
patch_t *patch = W_CachePatchNum(sprframe->lumppat[0], PU_PATCH);
|
||||
const UINT8 *colormap = R_GetTranslationColormap(skinnum, skincolor, GTC_CACHE);
|
||||
|
||||
// No variant for translucency
|
||||
|
|
20
src/w_wad.c
20
src/w_wad.c
|
@ -53,6 +53,7 @@
|
|||
#include "dehacked.h"
|
||||
#include "d_clisrv.h"
|
||||
#include "r_defs.h"
|
||||
#include "r_data.h"
|
||||
#include "i_system.h"
|
||||
#include "md5.h"
|
||||
#include "lua_script.h"
|
||||
|
@ -1401,7 +1402,6 @@ void *W_CacheLumpNumPwad(UINT16 wad, UINT16 lump, INT32 tag)
|
|||
|
||||
void *W_CacheLumpNum(lumpnum_t lumpnum, INT32 tag)
|
||||
{
|
||||
|
||||
return W_CacheLumpNumPwad(WADFILENUM(lumpnum),LUMPNUM(lumpnum),tag);
|
||||
}
|
||||
|
||||
|
@ -1482,12 +1482,30 @@ void *W_CacheLumpName(const char *name, INT32 tag)
|
|||
// Cache a patch into heap memory, convert the patch format as necessary
|
||||
//
|
||||
|
||||
void W_FlushCachedPatches(void)
|
||||
{
|
||||
if (needpatchflush)
|
||||
{
|
||||
Z_FreeTag(PU_CACHE);
|
||||
Z_FreeTag(PU_PATCH);
|
||||
Z_FreeTag(PU_HUDGFX);
|
||||
Z_FreeTag(PU_HWRPATCHINFO);
|
||||
Z_FreeTag(PU_HWRPATCHCOLMIPMAP);
|
||||
Z_FreeTag(PU_HWRCACHE);
|
||||
Z_FreeTags(PU_HWRCACHE_UNLOCKED, PU_HWRPATCHINFO_UNLOCKED);
|
||||
}
|
||||
needpatchflush = false;
|
||||
}
|
||||
|
||||
// Software-only compile cache the data without conversion
|
||||
#ifdef HWRENDER
|
||||
static inline void *W_CachePatchNumPwad(UINT16 wad, UINT16 lump, INT32 tag)
|
||||
{
|
||||
GLPatch_t *grPatch;
|
||||
|
||||
if (needpatchflush)
|
||||
W_FlushCachedPatches();
|
||||
|
||||
if (rendermode == render_soft || rendermode == render_none)
|
||||
return W_CacheLumpNumPwad(wad, lump, tag);
|
||||
|
||||
|
|
|
@ -180,6 +180,7 @@ void *W_CachePatchNum(lumpnum_t lumpnum, INT32 tag); // return a patch_t
|
|||
#endif
|
||||
|
||||
void W_UnlockCachedPatch(void *patch);
|
||||
void W_FlushCachedPatches(void);
|
||||
|
||||
void W_VerifyFileMD5(UINT16 wadfilenum, const char *matchmd5);
|
||||
|
||||
|
|
|
@ -943,6 +943,11 @@ INT32 VID_SetMode(INT32 modenum)
|
|||
return 1;
|
||||
}
|
||||
|
||||
void VID_CheckRenderer(void)
|
||||
{
|
||||
// ..............
|
||||
}
|
||||
|
||||
// ========================================================================
|
||||
// Free the video buffer of the last video mode,
|
||||
// allocate a new buffer for the video mode to set.
|
||||
|
|
|
@ -1221,20 +1221,20 @@ void Y_StartIntermission(void)
|
|||
}
|
||||
|
||||
for (i = 0; i < 4; ++i)
|
||||
data.coop.bonuspatches[i] = W_CachePatchName(data.coop.bonuses[i].patch, PU_STATIC);
|
||||
data.coop.ptotal = W_CachePatchName("YB_TOTAL", PU_STATIC);
|
||||
data.coop.bonuspatches[i] = W_CachePatchName(data.coop.bonuses[i].patch, PU_PATCH);
|
||||
data.coop.ptotal = W_CachePatchName("YB_TOTAL", PU_PATCH);
|
||||
|
||||
// get act number
|
||||
data.coop.actnum = mapheaderinfo[gamemap-1]->actnum;
|
||||
|
||||
// get background patches
|
||||
widebgpatch = W_CachePatchName("INTERSCW", PU_STATIC);
|
||||
bgpatch = W_CachePatchName("INTERSCR", PU_STATIC);
|
||||
widebgpatch = W_CachePatchName("INTERSCW", PU_PATCH);
|
||||
bgpatch = W_CachePatchName("INTERSCR", PU_PATCH);
|
||||
|
||||
// grab an interscreen if appropriate
|
||||
if (mapheaderinfo[gamemap-1]->interscreen[0] != '#')
|
||||
{
|
||||
interpic = W_CachePatchName(mapheaderinfo[gamemap-1]->interscreen, PU_STATIC);
|
||||
interpic = W_CachePatchName(mapheaderinfo[gamemap-1]->interscreen, PU_PATCH);
|
||||
useinterpic = true;
|
||||
usebuffer = false;
|
||||
}
|
||||
|
@ -1324,18 +1324,18 @@ void Y_StartIntermission(void)
|
|||
Y_AwardSpecialStageBonus();
|
||||
|
||||
for (i = 0; i < 2; ++i)
|
||||
data.spec.bonuspatches[i] = W_CachePatchName(data.spec.bonuses[i].patch, PU_STATIC);
|
||||
data.spec.bonuspatches[i] = W_CachePatchName(data.spec.bonuses[i].patch, PU_PATCH);
|
||||
|
||||
data.spec.pscore = W_CachePatchName("YB_SCORE", PU_STATIC);
|
||||
data.spec.pcontinues = W_CachePatchName("YB_CONTI", PU_STATIC);
|
||||
data.spec.pscore = W_CachePatchName("YB_SCORE", PU_PATCH);
|
||||
data.spec.pcontinues = W_CachePatchName("YB_CONTI", PU_PATCH);
|
||||
|
||||
// get background tile
|
||||
bgtile = W_CachePatchName("SPECTILE", PU_STATIC);
|
||||
bgtile = W_CachePatchName("SPECTILE", PU_PATCH);
|
||||
|
||||
// grab an interscreen if appropriate
|
||||
if (mapheaderinfo[gamemap-1]->interscreen[0] != '#')
|
||||
{
|
||||
interpic = W_CachePatchName(mapheaderinfo[gamemap-1]->interscreen, PU_STATIC);
|
||||
interpic = W_CachePatchName(mapheaderinfo[gamemap-1]->interscreen, PU_PATCH);
|
||||
useinterpic = true;
|
||||
}
|
||||
else
|
||||
|
@ -1347,14 +1347,14 @@ void Y_StartIntermission(void)
|
|||
// get special stage specific patches
|
||||
/* if (!stagefailed && ALL7EMERALDS(emeralds))
|
||||
{
|
||||
data.spec.cemerald = W_CachePatchName("GOTEMALL", PU_STATIC);
|
||||
data.spec.cemerald = W_CachePatchName("GOTEMALL", PU_PATCH);
|
||||
data.spec.headx = 70;
|
||||
data.spec.nowsuper = players[consoleplayer].skin
|
||||
? NULL : W_CachePatchName("NOWSUPER", PU_STATIC);
|
||||
}
|
||||
else
|
||||
{
|
||||
data.spec.cemerald = W_CachePatchName("CEMERALD", PU_STATIC);
|
||||
data.spec.cemerald = W_CachePatchName("CEMERALD", PU_PATCH);
|
||||
data.spec.headx = 48;
|
||||
data.spec.nowsuper = NULL;
|
||||
} */
|
||||
|
@ -1432,9 +1432,9 @@ void Y_StartIntermission(void)
|
|||
|
||||
// get RESULT header
|
||||
data.match.result =
|
||||
W_CachePatchName("RESULT", PU_STATIC);
|
||||
W_CachePatchName("RESULT", PU_PATCH);
|
||||
|
||||
bgtile = W_CachePatchName("SRB2BACK", PU_STATIC);
|
||||
bgtile = W_CachePatchName("SRB2BACK", PU_PATCH);
|
||||
usetile = true;
|
||||
useinterpic = false;
|
||||
break;
|
||||
|
@ -1460,9 +1460,9 @@ void Y_StartIntermission(void)
|
|||
data.match.levelstring[sizeof data.match.levelstring - 1] = '\0';
|
||||
|
||||
// get RESULT header
|
||||
data.match.result = W_CachePatchName("RESULT", PU_STATIC);
|
||||
data.match.result = W_CachePatchName("RESULT", PU_PATCH);
|
||||
|
||||
bgtile = W_CachePatchName("SRB2BACK", PU_STATIC);
|
||||
bgtile = W_CachePatchName("SRB2BACK", PU_PATCH);
|
||||
usetile = true;
|
||||
useinterpic = false;
|
||||
break;
|
||||
|
@ -1499,7 +1499,7 @@ void Y_StartIntermission(void)
|
|||
data.match.blueflag = bmatcico;
|
||||
}
|
||||
|
||||
bgtile = W_CachePatchName("SRB2BACK", PU_STATIC);
|
||||
bgtile = W_CachePatchName("SRB2BACK", PU_PATCH);
|
||||
usetile = true;
|
||||
useinterpic = false;
|
||||
break;
|
||||
|
@ -1525,7 +1525,7 @@ void Y_StartIntermission(void)
|
|||
data.competition.levelstring[sizeof data.competition.levelstring - 1] = '\0';
|
||||
|
||||
// get background tile
|
||||
bgtile = W_CachePatchName("SRB2BACK", PU_STATIC);
|
||||
bgtile = W_CachePatchName("SRB2BACK", PU_PATCH);
|
||||
usetile = true;
|
||||
useinterpic = false;
|
||||
break;
|
||||
|
|
|
@ -43,6 +43,7 @@ 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_HWRPATCHINFO = 21, // Hardware GLPatch_t struct for OpenGL texture cache
|
||||
PU_HWRPATCHCOLMIPMAP = 22, // Hardware GLMipmap_t struct colormap variation of patch
|
||||
|
|
Loading…
Reference in a new issue