Merge branch 'Saturn-Next' into delaynetxcommand

This commit is contained in:
Alug committed 2024-12-29 16:16:33 +01:00
commit e5ee978eb2
40 files changed
+2394 -2897

No files matched your search

+1 -1
View File
@@ -487,7 +487,7 @@ if(${SRB2_CONFIG_HWRENDER})
${CMAKE_CURRENT_SOURCE_DIR}/hardware/hw_data.h
${CMAKE_CURRENT_SOURCE_DIR}/hardware/hw_defs.h
${CMAKE_CURRENT_SOURCE_DIR}/hardware/hw_dll.h
${CMAKE_CURRENT_SOURCE_DIR}/hardware/hw_drv.h
${CMAKE_CURRENT_SOURCE_DIR}/hardware/hw_gl.h
${CMAKE_CURRENT_SOURCE_DIR}/hardware/hw_glob.h
${CMAKE_CURRENT_SOURCE_DIR}/hardware/hw_main.h
${CMAKE_CURRENT_SOURCE_DIR}/hardware/hw_portal.h
+2 -2
View File
@@ -738,7 +738,7 @@ else
ifdef SDL
ifdef MINGW
$(OBJDIR)/r_opengl.o: hardware/r_opengl/r_opengl.c hardware/r_opengl/r_opengl.h \
doomdef.h doomtype.h g_state.h m_swap.h hardware/hw_drv.h screen.h \
doomdef.h doomtype.h g_state.h m_swap.h hardware/hw_gl.h screen.h \
command.h hardware/hw_data.h hardware/hw_defs.h hardware/hw_md2.h \
hardware/hw_glob.h hardware/hw_main.h hardware/hw_clip.h hardware/hw_portal.h\
hardware/hw_md2load.h hardware/hw_md3load.h hardware/hw_model.h hardware/u_list.h \
@@ -747,7 +747,7 @@ $(OBJDIR)/r_opengl.o: hardware/r_opengl/r_opengl.c hardware/r_opengl/r_opengl.h
$(CC) $(CFLAGS) $(WFLAGS) -c $< -o $@
else
$(OBJDIR)/r_opengl.o: hardware/r_opengl/r_opengl.c hardware/r_opengl/r_opengl.h \
doomdef.h doomtype.h g_state.h m_swap.h hardware/hw_drv.h screen.h \
doomdef.h doomtype.h g_state.h m_swap.h hardware/hw_gl.h screen.h \
command.h hardware/hw_data.h hardware/hw_defs.h hardware/hw_md2.h \
hardware/hw_glob.h hardware/hw_main.h hardware/hw_clip.h hardware/hw_portal.h \
hardware/hw_md2load.h hardware/hw_md3load.h hardware/hw_model.h hardware/u_list.h \
+46 -42
View File
@@ -1795,34 +1795,34 @@ static boolean SV_ResendingSavegameToAnyone(void)
static void SV_SendSaveGame(INT32 node, boolean resending)
{
size_t length, compressedlen;
UINT8 *savebuffer;
savebuffer_t save;
UINT8 *compressedsave;
UINT8 *buffertosend;
// first save it in a malloced buffer
savebuffer = (UINT8 *)malloc(SAVEGAMESIZE);
if (!savebuffer)
save.buffer = (UINT8 *)malloc(SAVEGAMESIZE);
if (!save.buffer)
{
CONS_Alert(CONS_ERROR, M_GetText("No more free memory for savegame\n"));
return;
}
// Leave room for the uncompressed length.
save_p = savebuffer + sizeof(UINT32);
save.p = save.buffer + sizeof(UINT32);
P_SaveNetGame(resending);
P_SaveNetGame(&save, resending);
length = save_p - savebuffer;
length = save.p - save.buffer;
if (length > SAVEGAMESIZE)
{
free(savebuffer);
save_p = NULL;
free(save.buffer);
save.p = NULL;
I_Error("Savegame buffer overrun");
}
// Allocate space for compressed save: one byte fewer than for the
// uncompressed data to ensure that the compression is worthwhile.
compressedsave = malloc(length - 1);
compressedsave = Z_Malloc(length - 1, PU_STATIC, NULL);
if (!compressedsave)
{
CONS_Alert(CONS_ERROR, M_GetText("No more free memory for savegame\n"));
@@ -1830,11 +1830,11 @@ static void SV_SendSaveGame(INT32 node, boolean resending)
}
// Attempt to compress it.
if((compressedlen = lzf_compress(savebuffer + sizeof(UINT32), length - sizeof(UINT32), compressedsave + sizeof(UINT32), length - sizeof(UINT32) - 1)))
if ((compressedlen = lzf_compress(save.buffer + sizeof(UINT32), length - sizeof(UINT32), compressedsave + sizeof(UINT32), length - sizeof(UINT32) - 1)))
{
// Compressing succeeded; send compressed data
free(savebuffer);
free(save.buffer);
// State that we're compressed.
buffertosend = compressedsave;
@@ -1844,16 +1844,15 @@ static void SV_SendSaveGame(INT32 node, boolean resending)
else
{
// Compression failed to make it smaller; send original
free(compressedsave);
Z_Free(compressedsave);
// State that we're not compressed
buffertosend = savebuffer;
WRITEUINT32(savebuffer, 0);
buffertosend = save.buffer;
WRITEUINT32(save.buffer, 0);
}
SV_SendRam(node, buffertosend, length, SF_RAM, 0);
save_p = NULL;
SV_SendRam(node, buffertosend, length, SF_Z_RAM, 0);
save.p = NULL;
// Remember when we started sending the savegame so we can handle timeouts
sendingsavegame[node] = true;
@@ -1867,7 +1866,7 @@ static consvar_t cv_dumpconsistency = {"dumpconsistency", "Off", CV_NETVAR, CV_O
static void SV_SavedGame(void)
{
size_t length;
UINT8 *savebuffer;
savebuffer_t save;
char tmpsave[264];
if (!cv_dumpconsistency.value)
@@ -1876,29 +1875,29 @@ static void SV_SavedGame(void)
sprintf(tmpsave, "%s" PATHSEP TMPSAVENAME, srb2home);
// first save it in a malloced buffer
save_p = savebuffer = (UINT8 *)malloc(SAVEGAMESIZE);
if (!save_p)
save.p = save.buffer = (UINT8 *)malloc(SAVEGAMESIZE);
if (!save.p)
{
CONS_Alert(CONS_ERROR, M_GetText("No more free memory for savegame\n"));
return;
}
P_SaveNetGame(false);
P_SaveNetGame(&save);
length = save_p - savebuffer;
length = save.p - save.buffer;
if (length > SAVEGAMESIZE)
{
free(savebuffer);
save_p = NULL;
free(save.buffer);
save.p = NULL;
I_Error("Savegame buffer overrun");
}
// then save it!
if (!FIL_WriteFile(tmpsave, savebuffer, length))
if (!FIL_WriteFile(tmpsave, save.buffer, length))
CONS_Printf(M_GetText("Didn't save %s for netgame"), tmpsave);
free(savebuffer);
save_p = NULL;
free(save.buffer);
save.p = NULL;
}
#undef TMPSAVENAME
@@ -1907,13 +1906,13 @@ static void SV_SavedGame(void)
static void CL_LoadReceivedSavegame(boolean reloading)
{
UINT8 *savebuffer = NULL;
savebuffer_t save;
size_t length, decompressedlen;
char tmpsave[264];
sprintf(tmpsave, "%s" PATHSEP TMPSAVENAME, srb2home);
length = FIL_ReadFile(tmpsave, &savebuffer);
length = FIL_ReadFile(tmpsave, &save.buffer);
CONS_Printf(M_GetText("Loading savegame length %s\n"), sizeu1(length));
if (!length)
@@ -1922,16 +1921,17 @@ static void CL_LoadReceivedSavegame(boolean reloading)
return;
}
save_p = savebuffer;
save.p = save.buffer;
// Decompress saved game if necessary.
decompressedlen = READUINT32(save_p);
if(decompressedlen > 0)
decompressedlen = READUINT32(save.p);
if (decompressedlen > 0)
{
UINT8 *decompressedbuffer = Z_Malloc(decompressedlen, PU_STATIC, NULL);
lzf_decompress(save_p, length - sizeof(UINT32), decompressedbuffer, decompressedlen);
Z_Free(savebuffer);
save_p = savebuffer = decompressedbuffer;
lzf_decompress(save.p, length - sizeof(UINT32), decompressedbuffer, decompressedlen);
Z_Free(save.buffer);
save.p = save.buffer = decompressedbuffer;
}
paused = false;
@@ -1940,7 +1940,7 @@ static void CL_LoadReceivedSavegame(boolean reloading)
automapactive = false;
// load a base level
if (P_LoadNetGame(reloading))
if (P_LoadNetGame(&save, reloading))
{
if (!reloading)
{
@@ -1960,8 +1960,8 @@ static void CL_LoadReceivedSavegame(boolean reloading)
}
// done
Z_Free(savebuffer);
save_p = NULL;
Z_Free(save.buffer);
save.p = NULL;
if (unlink(tmpsave) == -1)
CONS_Alert(CONS_ERROR, M_GetText("Can't delete %s\n"), tmpsave);
consistancy[gametic%TICQUEUE] = Consistancy();
@@ -6855,6 +6855,7 @@ void CL_ClearRewinds(void)
rewind_t *CL_SaveRewindPoint(size_t demopos)
{
savebuffer_t save;
rewind_t *rewind;
if (rewindhead && rewindhead->leveltime + REWIND_POINT_INTERVAL > leveltime)
@@ -6864,8 +6865,9 @@ rewind_t *CL_SaveRewindPoint(size_t demopos)
if (!rewind)
return NULL;
save_p = rewind->savebuffer;
P_SaveNetGame(false);
save.buffer = save.p = rewind->savebuffer;
P_SaveNetGame(&save, false);
rewind->leveltime = leveltime;
rewind->next = rewindhead;
rewind->demopos = demopos;
@@ -6876,6 +6878,7 @@ rewind_t *CL_SaveRewindPoint(size_t demopos)
rewind_t *CL_RewindToTime(tic_t time)
{
savebuffer_t save;
rewind_t *rewind;
while (rewindhead && rewindhead->leveltime > time)
@@ -6888,8 +6891,9 @@ rewind_t *CL_RewindToTime(tic_t time)
if (!rewindhead)
return NULL;
save_p = rewindhead->savebuffer;
P_LoadNetGame(false);
save.buffer = save.p = rewindhead->savebuffer;
P_LoadNetGame(&save, false);
wipegamestate = gamestate; // No fading back in!
timeinmap = leveltime;
+11 -12
View File
@@ -5896,10 +5896,9 @@ static void Command_Togglemodified_f(void)
modifiedgame = !modifiedgame;
}
extern UINT8 *save_p;
static void Command_Archivetest_f(void)
{
UINT8 *buf;
savebuffer_t save;
UINT32 i, wrote;
thinker_t *th;
if (gamestate != GS_LEVEL)
@@ -5915,28 +5914,28 @@ static void Command_Archivetest_f(void)
((mobj_t *)th)->mobjnum = i++;
// allocate buffer
buf = save_p = ZZ_Alloc(1024);
save.buffer = save.p = ZZ_Alloc(1024);
// test archive
CONS_Printf("LUA_Archive...\n");
LUA_Archive();
WRITEUINT8(save_p, 0x7F);
wrote = (UINT32)(save_p-buf);
LUA_Archive(&save, true);
WRITEUINT8(save.p, 0x7F);
wrote = (UINT32)(save.p - save.buffer);
// clear Lua state, so we can really see what happens!
CONS_Printf("Clearing state!\n");
LUA_ClearExtVars();
// test unarchive
save_p = buf;
save.p = save.buffer;
CONS_Printf("LUA_UnArchive...\n");
LUA_UnArchive();
i = READUINT8(save_p);
if (i != 0x7F || wrote != (UINT32)(save_p-buf))
CONS_Printf("Savegame corrupted. (write %u, read %u)\n", wrote, (UINT32)(save_p-buf));
LUA_UnArchive(&save, true);
i = READUINT8(save.p);
if (i != 0x7F || wrote != (UINT32)(save.p - save.buffer))
CONS_Printf("Savegame corrupted. (write %u, read %u)\n", wrote, (UINT32)(save.p - save.buffer));
// free buffer
Z_Free(buf);
Z_Free(save.buffer);
CONS_Printf("Done. No crash.\n");
}
#endif
+374 -347
View File
File diff suppressed because it is too large. Load diff
+2 -1
View File
@@ -17,6 +17,7 @@
#include "doomdef.h"
#include "doomstat.h"
#include "d_event.h"
#include "p_saveg.h"
#include "m_textinput.h"
extern char gamedatafilename[64];
@@ -33,7 +34,7 @@ extern INT32 player_name_changes[MAXPLAYERS];
extern player_t players[MAXPLAYERS];
extern boolean playeringame[MAXPLAYERS];
extern UINT8 *demo_p;
extern savebuffer_t demobuf;
// ======================================
// DEMO playback/recording related stuff.
+12 -10
View File
@@ -15,6 +15,8 @@
#include "hw_main.h"
#include "../i_system.h"
#include "../doomdef.h"
#include "../qs22j.h"
// The texture for the next polygon given to HWR_ProcessPolygon.
@@ -63,7 +65,7 @@ void HWR_StartBatching(void)
currently_batching = true;
}
// This replaces the direct calls to pfnSetTexture in cases where batching is available.
// This replaces the direct calls to GL_SetTexture in cases where batching is available.
// The texture selection is saved for the next HWR_ProcessPolygon call.
// Doing this was easier than getting a texture pointer to HWR_ProcessPolygon.
void HWR_SetCurrentTexture(GLMipmap_t *texture)
@@ -74,7 +76,7 @@ void HWR_SetCurrentTexture(GLMipmap_t *texture)
}
else
{
HWD.pfnSetTexture(texture);
GL_SetTexture(texture);
}
}
@@ -128,8 +130,8 @@ void HWR_ProcessPolygon(FSurfaceInfo *pSurf, FOutVector *pOutVerts, FUINT iNumPt
}
else
{
HWD.pfnSetShader((shader_target != SHADER_NONE) ? HWR_GetShaderFromTarget(shader_target) : shader_target);
HWD.pfnDrawPolygon(pSurf, pOutVerts, iNumPts, PolyFlags);
GL_SetShader((shader_target != SHADER_NONE) ? HWR_GetShaderFromTarget(shader_target) : shader_target);
GL_DrawPolygon(pSurf, pOutVerts, iNumPts, PolyFlags);
}
}
@@ -290,13 +292,13 @@ void HWR_RenderBatches(void)
if (cv_glshaders.value && gl_shadersavailable)
{
HWD.pfnSetShader(currentShader);
GL_SetShader(currentShader);
}
if (currentPolyFlags & PF_NoTexture)
currentTexture = NULL;
else
HWD.pfnSetTexture(currentTexture);
GL_SetTexture(currentTexture);
while (1)// note: remember handling notexture polyflag as having texture number 0 (also in comparePolygons)
{
@@ -411,7 +413,7 @@ void HWR_RenderBatches(void)
if (changeState || stopFlag)
{
// execute draw call
HWD.pfnDrawIndexedTriangles(&currentSurfaceInfo, finalVertexArray, finalIndexWritePos, currentPolyFlags, finalVertexIndexArray);
GL_DrawIndexedTriangles(&currentSurfaceInfo, finalVertexArray, finalIndexWritePos, currentPolyFlags, finalVertexIndexArray);
// update stats
ps_hw_numcalls.value.i++;
ps_hw_numverts.value.i += finalIndexWritePos;
@@ -429,7 +431,7 @@ void HWR_RenderBatches(void)
{
if (changeShader)
{
HWD.pfnSetShader(nextShader);
GL_SetShader(nextShader);
currentShader = nextShader;
changeShader = false;
@@ -437,8 +439,8 @@ void HWR_RenderBatches(void)
}
if (changeTexture)
{
// texture should be already ready for use from calls to SetTexture during batch collection
HWD.pfnSetTexture(nextTexture);
// texture should be already ready for use from calls to GL_SetTexture during batch collection
GL_SetTexture(nextTexture);
currentTexture = nextTexture;
changeTexture = false;
+3 -1
View File
@@ -15,7 +15,9 @@
#include "hw_defs.h"
#include "hw_data.h"
#include "hw_drv.h"
#include "hw_gl.h"
extern boolean currently_batching;
typedef struct
{
+21 -17
View File
@@ -14,9 +14,10 @@
#include "../doomdef.h"
#ifdef HWRENDER
#include "hw_main.h"
#include "hw_glob.h"
#include "hw_drv.h"
#include "hw_gl.h"
#include "hw_batching.h"
#include "../doomstat.h" //gamemode
@@ -73,6 +74,9 @@ static void HWR_DrawColumnInCache(const column_t *patchcol, UINT8 *block, GLMipm
(void)patchheight; // This parameter is unused
if (!mipmap)
return;
if (originPatch) // originPatch can be NULL here, unlike in the software version
originy = originPatch->originy;
@@ -111,11 +115,11 @@ static void HWR_DrawColumnInCache(const column_t *patchcol, UINT8 *block, GLMipm
alpha = 0xFF;
// Make pixel transparent if chroma keyed
if ((mipmap->flags & TF_CHROMAKEYED) && (texel == HWR_PATCHES_CHROMAKEY_COLORINDEX))
if ((mipmap && mipmap->flags & TF_CHROMAKEYED) && (texel == HWR_PATCHES_CHROMAKEY_COLORINDEX))
alpha = 0x00;
//Hurdler: 25/04/2000: now support colormap in hardware mode
if (mipmap->colormap)
if (mipmap && mipmap->colormap)
texel = mipmap->colormap[texel];
// hope compiler will get this switch out of the loops (dreams...)
@@ -496,7 +500,7 @@ static void FreeMipmapColormap(INT32 patchnum, void *patch)
if (next->data)
Z_Free(next->data);
next->data = NULL;
HWD.pfnDeleteTexture(next);
GL_DeleteTexture(next);
// Free the old colormap mipmap from memory.
free(next);
@@ -507,7 +511,7 @@ void HWR_FreeMipmapCache(void)
{
INT32 i;
// free references to the textures
HWD.pfnClearMipMapCache();
GL_ClearMipMapCache();
// free all hardware-converted graphics cached in the heap
// our gool is only the textures since user of the texture is the texture cache
@@ -574,7 +578,7 @@ GLMapTexture_t *HWR_GetTexture(INT32 tex, boolean noencore)
// If hardware does not have the texture, then call pfnSetTexture to upload it
if (!gltex->mipmap.downloaded)
HWD.pfnSetTexture(&gltex->mipmap);
GL_SetTexture(&gltex->mipmap);
HWR_SetCurrentTexture(&gltex->mipmap);
// The system-memory data can be purged now.
@@ -662,7 +666,7 @@ void HWR_GetFlat(lumpnum_t flatlumpnum, boolean noencoremap)
// If hardware does not have the texture, then call pfnSetTexture to upload it
if (!glMipmap->downloaded)
HWD.pfnSetTexture(glMipmap);
GL_SetTexture(glMipmap);
HWR_SetCurrentTexture(glMipmap);
// The system-memory data can be purged now.
@@ -691,7 +695,7 @@ static void HWR_LoadMappedPatch(GLMipmap_t *glMipmap, GLPatch_t *glPatch)
// If hardware does not have the texture, then call pfnSetTexture to upload it
if (!glMipmap->downloaded)
HWD.pfnSetTexture(glMipmap);
GL_SetTexture(glMipmap);
HWR_SetCurrentTexture(glMipmap);
// The system-memory data can be purged now.
@@ -721,7 +725,7 @@ void HWR_GetPatch(GLPatch_t *glPatch)
// If hardware does not have the texture, then call pfnSetTexture to upload it
if (!glPatch->mipmap->downloaded)
HWD.pfnSetTexture(glPatch->mipmap);
GL_SetTexture(glPatch->mipmap);
HWR_SetCurrentTexture(glPatch->mipmap);
// The system-memory patch data can be purged now.
@@ -896,7 +900,7 @@ void HWR_GetFadeMask(lumpnum_t fademasklumpnum)
if (!glMipmap->downloaded && !glMipmap->data)
HWR_CacheFadeMask(glMipmap, fademasklumpnum);
HWD.pfnSetTexture(glMipmap);
GL_SetTexture(glMipmap);
// The system-memory data can be purged now.
Z_ChangeTag(glMipmap->data, PU_HWRCACHE_UNLOCKED);
@@ -929,11 +933,11 @@ void HWR_SetPalette(RGBA_t *palette)
crushed_palette[i].s.blue = (UINT8)(fblue / 31.0f * 255.0f);
crushed_palette[i].s.alpha = 255;
}
HWD.pfnSetScreenPalette(crushed_palette);
GL_SetScreenPalette(crushed_palette);
}
else
{
HWD.pfnSetScreenPalette(palette);
GL_SetScreenPalette(palette);
}
// this part is responsible for keeping track of the palette OUTSIDE of a level.
@@ -943,7 +947,7 @@ void HWR_SetPalette(RGBA_t *palette)
else
{
// set the palette for the textures
HWD.pfnSetTexturePalette(palette);
GL_SetPalette(palette);
// reset mapPalette so next call to HWR_SetMapPalette will update everything correctly
memset(mapPalette, 0, sizeof(mapPalette));
// hardware driver will flush there own cache if cache is non paletized
@@ -976,7 +980,7 @@ static void HWR_SetPaletteLookup(RGBA_t *palette)
}
}
#undef STEP_SIZE
HWD.pfnSetPaletteLookup(lut);
GL_SetPaletteLookup(lut);
Z_Free(lut);
}
@@ -1024,7 +1028,7 @@ void HWR_SetMapPalette(void)
// in palette rendering mode, this means that all rgba textures now have wrong colors
// and the lookup table is outdated
HWR_SetPaletteLookup(mapPalette);
HWD.pfnSetTexturePalette(mapPalette);
GL_SetPalette(mapPalette);
if (patchformat == GL_TEXFMT_RGBA || textureformat == GL_TEXFMT_RGBA)
{
@@ -1047,7 +1051,7 @@ UINT32 HWR_CreateLightTable(UINT8 *lighttable)
for (i = 0; i < 256 * 32; i++)
hw_lighttable[i] = palette[lighttable[i]];
id = HWD.pfnCreateLightTable(hw_lighttable);
id = GL_CreateLightTable(hw_lighttable);
Z_Free(hw_lighttable);
return id;
}
@@ -1083,7 +1087,7 @@ UINT32 HWR_GetLightTableID(extracolormap_t *colormap)
void HWR_ClearLightTables(void)
{
if (vid.glstate == VID_GL_LIBRARY_LOADED)
HWD.pfnClearLightTables();
GL_ClearLightTables();
}
#endif //HWRENDER
+22 -21
View File
@@ -18,9 +18,10 @@
#include "../doomdef.h"
#ifdef HWRENDER
#include "hw_main.h"
#include "hw_glob.h"
#include "hw_drv.h"
#include "hw_gl.h"
#include "../m_misc.h" //FIL_WriteFile()
#include "../r_draw.h" //viewborderlump
@@ -122,7 +123,7 @@ void HWR_DrawPatch(GLPatch_t *gpatch, INT32 x, INT32 y, INT32 option)
flags |= PF_ForceWrapY;
// clip it since it is used for bunny scroll in doom I
HWD.pfnDrawPolygon(NULL, v, 4, flags);
GL_DrawPolygon(NULL, v, 4, flags);
}
void HWR_DrawStretchyFixedPatch(GLPatch_t *gpatch, fixed_t x, fixed_t y, fixed_t pscale, fixed_t vscale, INT32 option, const UINT8 *colormap)
@@ -303,10 +304,10 @@ void HWR_DrawStretchyFixedPatch(GLPatch_t *gpatch, fixed_t x, fixed_t y, fixed_t
else if (alphalevel == 15) Surf.PolyColor.s.alpha = softwaretranstogl_hi[hudtrans];
else Surf.PolyColor.s.alpha = softwaretranstogl[10-alphalevel];
flags |= PF_Modulated;
HWD.pfnDrawPolygon(&Surf, v, 4, flags);
GL_DrawPolygon(&Surf, v, 4, flags);
}
else
HWD.pfnDrawPolygon(NULL, v, 4, flags);
GL_DrawPolygon(NULL, v, 4, flags);
}
void HWR_DrawCroppedPatch(GLPatch_t *gpatch, fixed_t x, fixed_t y, fixed_t pscale, INT32 option, fixed_t sx, fixed_t sy, fixed_t w, fixed_t h)
@@ -460,10 +461,10 @@ void HWR_DrawCroppedPatch(GLPatch_t *gpatch, fixed_t x, fixed_t y, fixed_t pscal
else if (alphalevel == 15) Surf.PolyColor.s.alpha = softwaretranstogl_hi[cv_translucenthud.value];
else Surf.PolyColor.s.alpha = softwaretranstogl[10-alphalevel];
flags |= PF_Modulated;
HWD.pfnDrawPolygon(&Surf, v, 4, flags);
GL_DrawPolygon(&Surf, v, 4, flags);
}
else
HWD.pfnDrawPolygon(NULL, v, 4, flags);
GL_DrawPolygon(NULL, v, 4, flags);
}
// ==========================================================================
@@ -539,7 +540,7 @@ void HWR_DrawFlatFill (INT32 x, INT32 y, INT32 w, INT32 h, lumpnum_t flatlumpnum
// BTW, I see we put 0 for PFs, and If I'm right, that
// means we take the previous PFs as default
// how can we be sure they are ok?
HWD.pfnDrawPolygon(NULL, v, 4, PF_NoDepthTest); //PF_Translucent);
GL_DrawPolygon(NULL, v, 4, PF_NoDepthTest); //PF_Translucent);
}
@@ -575,10 +576,10 @@ void HWR_FadeScreenMenuBack(UINT16 color, UINT8 strength)
Surf.LightTableId = HWR_GetLightTableID(NULL);
Surf.LightInfo.light_level = strength;
HWD.pfnMakeScreenTexture(scr_tex);
HWD.pfnSetShader(HWR_GetShaderFromTarget(SHADER_UI_COLORMAP_FADE));
HWD.pfnDrawScreenTexture(scr_tex, &Surf, PF_ColorMapped|PF_NoDepthTest);
HWD.pfnUnSetShader();
GL_MakeScreenTexture(scr_tex);
GL_SetShader(HWR_GetShaderFromTarget(SHADER_UI_COLORMAP_FADE));
GL_DrawScreenTexture(scr_tex, &Surf, PF_ColorMapped|PF_NoDepthTest);
GL_UnSetShader();
return;
}
@@ -602,7 +603,7 @@ void HWR_FadeScreenMenuBack(UINT16 color, UINT8 strength)
poly_flags |= PF_Translucent;
}
HWD.pfnDrawPolygon(&Surf, v, 4, poly_flags);
GL_DrawPolygon(&Surf, v, 4, poly_flags);
}
// Draw the console background with translucency support
@@ -629,7 +630,7 @@ void HWR_DrawConsoleBack(UINT32 color, INT32 height)
Surf.PolyColor.rgba = UINT2RGBA(color);
Surf.PolyColor.s.alpha = 0x80;
HWD.pfnDrawPolygon(&Surf, v, 4, PF_NoTexture|PF_Modulated|PF_Translucent|PF_NoDepthTest);
GL_DrawPolygon(&Surf, v, 4, PF_NoTexture|PF_Modulated|PF_Translucent|PF_NoDepthTest);
}
@@ -785,7 +786,7 @@ void HWR_drawAMline(const fline_t *fl, INT32 color)
v2.x = ((float)fl->b.x-(vid.width/2.0f))*(2.0f/vid.width);
v2.y = ((float)fl->b.y-(vid.height/2.0f))*(2.0f/vid.height);
HWD.pfnDraw2DLine(&v1, &v2, color_rgba);
GL_Draw2DLine(&v1, &v2, color_rgba);
}
// -----------------+
@@ -879,7 +880,7 @@ void HWR_DrawDiag(INT32 x, INT32 y, INT32 wh, INT32 color)
Surf.PolyColor = palette[color&0xFF];
HWD.pfnDrawPolygon(&Surf, v, 4,
GL_DrawPolygon(&Surf, v, 4,
PF_Modulated|PF_NoTexture|PF_NoDepthTest);
}
@@ -918,7 +919,7 @@ void HWR_DrawConsoleFill(INT32 x, INT32 y, INT32 w, INT32 h, UINT32 color, INT32
clearColour.green = (float)rgbaColour.s.green / 255;
clearColour.blue = (float)rgbaColour.s.blue / 255;
clearColour.alpha = 1;
HWD.pfnClearBuffer(true, false, false, &clearColour);
GL_ClearBuffer(true, false, false, &clearColour);
return;
}
@@ -989,7 +990,7 @@ void HWR_DrawConsoleFill(INT32 x, INT32 y, INT32 w, INT32 h, UINT32 color, INT32
Surf.PolyColor.rgba = UINT2RGBA(color);
Surf.PolyColor.s.alpha = 0x80;
HWD.pfnDrawPolygon(&Surf, v, 4, PF_NoTexture|PF_Modulated|PF_Translucent|PF_NoDepthTest);
GL_DrawPolygon(&Surf, v, 4, PF_NoTexture|PF_Modulated|PF_Translucent|PF_NoDepthTest);
}
// -----------------+
@@ -1029,7 +1030,7 @@ void HWR_DrawFill(INT32 x, INT32 y, INT32 w, INT32 h, INT32 color)
clearColour.green = (float)rgbaColour.s.green / 255;
clearColour.blue = (float)rgbaColour.s.blue / 255;
clearColour.alpha = 1;
HWD.pfnClearBuffer(true, false, false, &clearColour);
GL_ClearBuffer(true, false, false, &clearColour);
return;
}
@@ -1107,7 +1108,7 @@ void HWR_DrawFill(INT32 x, INT32 y, INT32 w, INT32 h, INT32 color)
else Surf.PolyColor.s.alpha = softwaretranstogl[10-alphalevel];
}
HWD.pfnDrawPolygon(&Surf, v, 4, PF_NoTexture|PF_Modulated|PF_Translucent|PF_NoDepthTest);
GL_DrawPolygon(&Surf, v, 4, PF_NoTexture|PF_Modulated|PF_Translucent|PF_NoDepthTest);
}
#ifdef HAVE_PNG
@@ -1191,7 +1192,7 @@ UINT8 *HWR_GetScreenshot(void)
return NULL;
// returns 24bit 888 RGB
HWD.pfnReadScreenTexture(HWD_SCREENTEXTURE_GENERIC2, (void *)buf);
GL_ReadScreenTexture(HWD_SCREENTEXTURE_GENERIC2, (void *)buf);
return buf;
}
@@ -1207,7 +1208,7 @@ boolean HWR_Screenshot(const char *pathname)
}
// returns 24bit 888 RGB
HWD.pfnReadScreenTexture(HWD_SCREENTEXTURE_GENERIC2, (void *)buf);
GL_ReadScreenTexture(HWD_SCREENTEXTURE_GENERIC2, (void *)buf);
#ifdef USE_PNG
ret = M_SavePNG(pathname, buf, vid.width, vid.height, NULL);
-142
View File
@@ -1,142 +0,0 @@
// SONIC ROBO BLAST 2
//-----------------------------------------------------------------------------
// Copyright (C) 1993-1996 by id Software, Inc.
// Copyright (C) 1998-2000 by DooM Legacy Team.
// Copyright (C) 1999-2019 by Sonic Team Junior.
//
// This program is free software distributed under the
// terms of the GNU General Public License, version 2.
// See the 'LICENSE' file for more details.
//-----------------------------------------------------------------------------
/// \file
/// \brief imports/exports for the GPU hardware low-level interface API
#ifndef __HWR_DRV_H__
#define __HWR_DRV_H__
// this must be here 19991024 by Kin
#include "../screen.h"
#include "hw_data.h"
#include "hw_defs.h"
#include "hw_md2.h"
#include "hw_dll.h"
#include "../doomdef.h"
// ==========================================================================
// STANDARD DLL EXPORTS
// ==========================================================================
EXPORT boolean HWRAPI(Init) (void);
EXPORT void HWRAPI(SetupGLInfo) (void);
EXPORT void HWRAPI(SetTexturePalette) (RGBA_t *ppal);
EXPORT void HWRAPI(FinishUpdate) (INT32 waitvbl);
EXPORT void HWRAPI(Draw2DLine) (F2DCoord *v1, F2DCoord *v2, RGBA_t Color);
EXPORT void HWRAPI(DrawPolygon) (FSurfaceInfo *pSurf, FOutVector *pOutVerts, FUINT iNumPts, FBITFIELD PolyFlags);
EXPORT void HWRAPI(DrawIndexedTriangles) (FSurfaceInfo *pSurf, FOutVector *pOutVerts, FUINT iNumPts, FBITFIELD PolyFlags, unsigned int *IndexArray);
EXPORT void HWRAPI(SetBlend) (FBITFIELD PolyFlags);
EXPORT void HWRAPI(ClearBuffer) (FBOOLEAN ColorMask, FBOOLEAN DepthMask, FBOOLEAN StencilMask, FRGBAFloat *ClearColor);
EXPORT void HWRAPI(SetTexture) (GLMipmap_t *TexInfo);
EXPORT void HWRAPI(UpdateTexture) (GLMipmap_t *TexInfo);
EXPORT void HWRAPI(DeleteTexture) (GLMipmap_t *TexInfo);
EXPORT void HWRAPI(ReadScreenTexture) (int tex, UINT16 *dst_data);
EXPORT void HWRAPI(GClipRect) (INT32 minx, INT32 miny, INT32 maxx, INT32 maxy, float nearclip, float farclip);
EXPORT void HWRAPI(ClearMipMapCache) (void);
//Hurdler: added for backward compatibility
EXPORT void HWRAPI(SetSpecialState) (hwdspecialstate_t IdState, INT32 Value);
//Hurdler: added for new development
EXPORT void HWRAPI(DrawModel) (model_t *model, INT32 frameIndex, float duration, float tics, INT32 nextFrameIndex, FTransform *pos, float hscale, float vscale, UINT8 flipped, UINT8 hflipped, FSurfaceInfo *Surface);
EXPORT void HWRAPI(CreateModelVBOs) (model_t *model);
EXPORT void HWRAPI(SetTransform) (FTransform *stransform);
EXPORT INT32 HWRAPI(GetTextureUsed) (void);
EXPORT void HWRAPI(RenderSkyDome) (gl_sky_t *sky);
EXPORT void HWRAPI(FlushScreenTextures) (void);
EXPORT void HWRAPI(DoScreenWipe) (int wipeStart, int wipeEnd);
EXPORT void HWRAPI(DrawScreenTexture) (int tex, FSurfaceInfo *surf, FBITFIELD polyflags);
EXPORT void HWRAPI(MakeScreenTexture) (int tex);
EXPORT void HWRAPI(DrawScreenFinalTexture) (int tex, INT32 width, INT32 height, boolean useshader);
EXPORT void HWRAPI(RenderVhsEffect) (fixed_t upbary, fixed_t downbary, UINT8 updistort, UINT8 downdistort, UINT8 barsize);
#define SCREENVERTS 10
EXPORT void HWRAPI(PostImgRedraw) (float points[SCREENVERTS][SCREENVERTS][2]);
// jimita
EXPORT boolean HWRAPI(InitShaders) (void);
EXPORT void HWRAPI(LoadShader) (int slot, char *code, hwdshaderstage_t stage);
EXPORT boolean HWRAPI(CompileShader) (int slot);
EXPORT void HWRAPI(SetShader) (int slot);
EXPORT void HWRAPI(UnSetShader) (void);
EXPORT void HWRAPI(SetShaderInfo) (hwdshaderinfo_t info, INT32 value);
EXPORT void HWRAPI(SetPaletteLookup)(UINT8 *lut);
EXPORT UINT32 HWRAPI(CreateLightTable)(RGBA_t *hw_lighttable);
EXPORT void HWRAPI(ClearLightTables)(void);
EXPORT void HWRAPI(SetScreenPalette)(RGBA_t *palette);
// ==========================================================================
// HWR DRIVER OBJECT, FOR CLIENT PROGRAM
// ==========================================================================
#if !defined (_CREATE_DLL_)
struct hwdriver_s
{
Init pfnInit;
SetupGLInfo pfnSetupGLInfo;
SetTexturePalette pfnSetTexturePalette;
FinishUpdate pfnFinishUpdate;
Draw2DLine pfnDraw2DLine;
DrawPolygon pfnDrawPolygon;
DrawIndexedTriangles pfnDrawIndexedTriangles;
SetBlend pfnSetBlend;
ClearBuffer pfnClearBuffer;
SetTexture pfnSetTexture;
UpdateTexture pfnUpdateTexture;
DeleteTexture pfnDeleteTexture;
ReadScreenTexture pfnReadScreenTexture;
GClipRect pfnGClipRect;
ClearMipMapCache pfnClearMipMapCache;
SetSpecialState pfnSetSpecialState;
DrawModel pfnDrawModel;
CreateModelVBOs pfnCreateModelVBOs;
SetTransform pfnSetTransform;
GetTextureUsed pfnGetTextureUsed;
PostImgRedraw pfnPostImgRedraw;
FlushScreenTextures pfnFlushScreenTextures;
DoScreenWipe pfnDoScreenWipe;
DrawScreenTexture pfnDrawScreenTexture;
MakeScreenTexture pfnMakeScreenTexture;
RenderVhsEffect pfnRenderVhsEffect;
DrawScreenFinalTexture pfnDrawScreenFinalTexture;
RenderSkyDome pfnRenderSkyDome;
InitShaders pfnInitShaders;
LoadShader pfnLoadShader;
CompileShader pfnCompileShader;
SetShader pfnSetShader;
UnSetShader pfnUnSetShader;
SetShaderInfo pfnSetShaderInfo;
SetPaletteLookup pfnSetPaletteLookup;
CreateLightTable pfnCreateLightTable;
ClearLightTables pfnClearLightTables;
SetScreenPalette pfnSetScreenPalette;
};
extern struct hwdriver_s hwdriver;
#define HWD hwdriver
#endif //not defined _CREATE_DLL_
#endif //__HWR_DRV_H__
+79
View File
@@ -0,0 +1,79 @@
// SONIC ROBO BLAST 2 Kart
//-----------------------------------------------------------------------------
// Copyright (C) 2020 by Jaime "Lactozilla" Passos.
// Copyright (C) 2020 by Sonic Team Junior.
//
// This program is free software distributed under the
// terms of the GNU General Public License, version 2.
// See the 'LICENSE' file for more details.
//-----------------------------------------------------------------------------
/// \file hw_gl.h
/// \brief OpenGL low-level interface API
#ifndef __HWR_GL_H__
#define __HWR_GL_H__
#include "../screen.h"
#include "hw_data.h"
#include "hw_defs.h"
#include "hw_md2.h"
#define SCREENVERTS 10
boolean GL_Init(void);
void GL_FinishUpdate(INT32 waitvbl);
void SetupGLInfo(void);
void GL_SetSpecialState(hwdspecialstate_t IdState, INT32 Value);
void GL_SetTransform(FTransform *stransform);
void GL_SetBlend(FBITFIELD PolyFlags);
void GL_SetPalette(RGBA_t *palette);
void GL_ClearBuffer(FBOOLEAN ColorMask, FBOOLEAN DepthMask, FBOOLEAN StencilMask, FRGBAFloat * ClearColor);
void GL_DrawPolygon(FSurfaceInfo *pSurf, FOutVector *pOutVerts, FUINT iNumPts, FBITFIELD PolyFlags);
void GL_DrawIndexedTriangles(FSurfaceInfo *pSurf, FOutVector *pOutVerts, FUINT iNumPts, FBITFIELD PolyFlags, unsigned int *IndexArray);
void GL_Draw2DLine(F2DCoord *v1, F2DCoord *v2, RGBA_t Color);
void GL_DrawModelEx(model_t *model, INT32 frameIndex, float duration, float tics, INT32 nextFrameIndex, FTransform *pos, float hscale, float vscale, UINT8 flipped, UINT8 hflipped, FSurfaceInfo *Surface);
#define GL_DrawModel(model, frameIndex, duration, tics, nextFrameIndex, pos, hscale, vscale, flipped, hflipped, Surface) GL_DrawModelEx(model, frameIndex, duration, tics, nextFrameIndex, pos, hscale, vscale, flipped, hflipped, Surface)
void GL_RenderSkyDome(gl_sky_t *sky);
void GL_SetTexture(GLMipmap_t *pTexInfo);
void GL_DeleteTexture(GLMipmap_t *pTexInfo);
void GL_Flush(void);
#define GL_ClearMipMapCache GL_Flush
INT32 GL_GetTextureUsed(void);
void GL_CreateModelVBOs(model_t *model);
void GL_ReadScreenTexture(int tex, UINT16 *dst_data);
void GL_GClipRect(INT32 minx, INT32 miny, INT32 maxx, INT32 maxy, float nearclip, float farclip);
void GL_MakeScreenTexture(int tex);
void GL_FlushScreenTextures(void);
void GL_DrawScreenTexture(int tex, FSurfaceInfo *surf, FBITFIELD polyflags);
void GL_DoScreenWipe(int wipeStart, int wipeEnd);
void GL_RenderVhsEffect(fixed_t upbary, fixed_t downbary, UINT8 updistort, UINT8 downdistort, UINT8 barsize);
void GL_DrawScreenFinalTexture(int tex, INT32 width, INT32 height, boolean useshader);
void GL_PostImgRedraw(float points[SCREENVERTS][SCREENVERTS][2]);
boolean GL_InitShaders(void);
void GL_LoadShader(int slot, char *code, hwdshaderstage_t stage);
boolean GL_CompileShader(int slot);
void GL_SetShader(int slot);
void GL_UnSetShader(void);
void GL_SetShaderInfo(hwdshaderinfo_t info, INT32 value);
void GL_SetPaletteLookup(UINT8 *lut);
UINT32 GL_CreateLightTable(RGBA_t *hw_lighttable);
void GL_ClearLightTables(void);
void GL_SetScreenPalette(RGBA_t *palette);
#endif // __HWR_GL_H__
+92 -79
View File
@@ -14,13 +14,13 @@
#include <math.h>
#include "../doomstat.h"
#include "../qs22j.h"
#include "../doomdef.h"
#ifdef HWRENDER
#include "hw_main.h"
#include "hw_glob.h"
#include "hw_drv.h"
#include "hw_gl.h"
#include "hw_batching.h"
#include "hw_md2.h"
#include "hw_clip.h"
@@ -56,6 +56,8 @@
#include "../w_wad.h"
#include "../z_zone.h"
#include "../qs22j.h" // fast qsort
// ==========================================================================
// Globals
// ==========================================================================
@@ -63,8 +65,6 @@
#define ABS(x) ((x) < 0 ? -(x) : (x))
#define SOFTLIGHT(llevel) HWR_ShouldUsePaletteRendering() ? ((llevel) >> LIGHTSEGSHIFT) << LIGHTSEGSHIFT : (llevel)
struct hwdriver_s hwdriver;
// false if shaders have not been initialized yet, or if shaders are not available
boolean gl_shadersavailable = false;
@@ -244,7 +244,7 @@ static void CV_screentextures_OnChange(void)
CV_SetValue(&cv_glframebuffer, 0);
#endif
}
HWD.pfnSetSpecialState(HWD_SET_SCREEN_TEXTURES, cv_glscreentextures.value);
GL_SetSpecialState(HWD_SET_SCREEN_TEXTURES, cv_glscreentextures.value);
M_UpdateOGLMenu();
}
@@ -285,13 +285,13 @@ static void CV_gllightdithering_OnChange(void)
static void CV_filtermode_OnChange(void)
{
ONLY_IF_GL_LOADED
HWD.pfnSetSpecialState(HWD_SET_TEXTUREFILTERMODE, cv_glfiltermode.value);
GL_SetSpecialState(HWD_SET_TEXTUREFILTERMODE, cv_glfiltermode.value);
}
static void CV_anisotropic_OnChange(void)
{
ONLY_IF_GL_LOADED
HWD.pfnSetSpecialState(HWD_SET_TEXTUREANISOTROPICMODE, cv_glanisotropicmode.value);
GL_SetSpecialState(HWD_SET_TEXTUREANISOTROPICMODE, cv_glanisotropicmode.value);
}
static void CV_glpaletterendering_OnChange(void)
@@ -326,7 +326,7 @@ boolean HWR_UseShader(void)
static void HWR_SetShaderState(void)
{
HWD.pfnSetSpecialState(HWD_SET_SHADERS, HWR_UseShader() ? 1 : 0);
GL_SetSpecialState(HWD_SET_SHADERS, HWR_UseShader() ? 1 : 0);
}
boolean HWR_ShouldUsePaletteRendering(void)
@@ -1116,10 +1116,10 @@ static void HWR_DrawSkyWallList(void)
surf.PolyColor.rgba = 0xFFFFFFFF;
HWR_SetCurrentTexture(NULL);
HWD.pfnUnSetShader();
GL_UnSetShader();
for (i = 0; i < skyWallVertexArraySize; i++)
{
HWD.pfnDrawPolygon(&surf, skyWallVertexArray + i * 4, 4, PF_Occlude|PF_Invisible|PF_NoTexture);
GL_DrawPolygon(&surf, skyWallVertexArray + i * 4, 4, PF_Occlude|PF_Invisible|PF_NoTexture);
}
}
@@ -2471,16 +2471,16 @@ static void HWR_RenderPolyObjectPlane(polyobj_t *polysector, boolean isceiling,
{
float height; //constant y for all points on the convex flat polygon
FOutVector *v3d;
INT32 i;
INT32 i;
float flatxref,flatyref;
float fflatsize;
INT32 flatflag;
size_t len;
float scrollx = 0.0f, scrolly = 0.0f;
angle_t angle = 0;
float fflatsize;
INT32 flatflag;
size_t len;
float scrollx = 0.0f, scrolly = 0.0f;
angle_t angle = 0;
FSurfaceInfo Surf;
fixed_t tempxsow, tempytow;
size_t nrPlaneVerts;
fixed_t tempxsow, tempytow;
size_t nrPlaneVerts;
static FOutVector *planeVerts = NULL;
static UINT16 numAllocedPlaneVerts = 0;
@@ -2489,8 +2489,6 @@ static void HWR_RenderPolyObjectPlane(polyobj_t *polysector, boolean isceiling,
nrPlaneVerts = polysector->numVertices;
height = FIXED_TO_FLOAT(fixedheight);
if (nrPlaneVerts < 3) //not even a triangle ?
return;
@@ -2508,6 +2506,8 @@ static void HWR_RenderPolyObjectPlane(polyobj_t *polysector, boolean isceiling,
Z_Malloc(numAllocedPlaneVerts * sizeof (FOutVector), PU_LEVEL, &planeVerts);
}
height = FIXED_TO_FLOAT(fixedheight);
len = W_LumpLength(lumpnum);
switch (len)
@@ -2705,7 +2705,6 @@ static void HWR_AddPolyObjectPlanes(void)
}
}
//
// HWR_DoCulling
// Hardware version of R_DoCulling
@@ -2718,6 +2717,7 @@ static boolean HWR_DoCulling(line_t *cullheight, line_t *viewcullheight, float v
return false;
cullplane = FIXED_TO_FLOAT(cullheight->frontsector->floorheight);
if (cullheight->flags & ML_NOCLIMB) // Group culling
{
if (!viewcullheight)
@@ -3429,6 +3429,7 @@ static void HWR_RotateSpritePolyToAim(gl_vissprite_t *spr, FOutVector *wallVerts
// be mobj->z or mobj->z + mobj->height
wallVerts[2].y = wallVerts[3].y = (spr->gzt - basey) * gl_viewludsin + basey;
wallVerts[0].y = wallVerts[1].y = (lowy - basey) * gl_viewludsin + basey;
// translate back to be around 0 before translating back
wallVerts[3].x += ((spr->gzt - basey) * gl_viewludcos) * gl_viewcos;
wallVerts[2].x += ((spr->gzt - basey) * gl_viewludcos) * gl_viewcos;
@@ -3725,7 +3726,7 @@ static void HWR_DrawSprite(gl_vissprite_t *spr)
INT32 shader = SHADER_NONE;
if (!spr->mobj)
if (P_MobjWasRemoved(spr->mobj))
return;
if (!spr->mobj->subsector)
@@ -3812,8 +3813,9 @@ static void HWR_DrawSprite(gl_vissprite_t *spr)
sector_t *sector = spr->mobj->subsector->sector;
UINT8 lightlevel = 255;
extracolormap_t *colormap = sector->extra_colormap;
const boolean fullbright = (spr->mobj->frame & FF_FULLBRIGHT);
if (!(spr->mobj->frame & FF_FULLBRIGHT))
if (!fullbright)
lightlevel = min(sector->lightlevel, 255);
HWR_Lighting(&Surf, lightlevel, colormap);
@@ -4202,7 +4204,7 @@ static void HWR_RenderDrawNodes(void)
PS_START_TIMING(ps_hw_nodedrawtime);
// Okay! Let's draw it all! Woo!
HWD.pfnSetTransform(&atransform);
GL_SetTransform(&atransform);
for (i = 0; i < numdrawnodes; i++)
{
@@ -4274,6 +4276,7 @@ static void HWR_DrawSprites(void)
if (spr->mobj && spr->mobj->skin && spr->mobj->sprite == SPR_PLAY)
{
md2_t *md2;
if (spr->mobj->localskin)
{
if (spr->mobj->skinlocal)
@@ -4351,20 +4354,27 @@ static void HWR_AddSprites(sector_t *sec)
// --------------------------------------------------------------------------
static void HWR_AddPrecipitationSprites(void)
{
fixed_t drawdist;
fixed_t precipscale = (cv_mobjscaleprecip.value ? mapobjectscale : FRACUNIT);
//const fixed_t drawdist = cv_drawdist_precip.value * mapobjectscale;
INT32 xl, xh, yl, yh, bx, by;
precipmobj_t *th;
fixed_t drawdist;
// save a little time on invisible weather
if (curWeather == PRECIP_BLANK || curWeather == PRECIP_STORM_NORAIN)
{
return;
}
const fixed_t precipscale = (cv_mobjscaleprecip.value ? mapobjectscale : FRACUNIT);
//const fixed_t drawdist = cv_drawdist_precip.value * mapobjectscale;
if (current_bsp_culling_distance)
drawdist = min((fixed_t)current_bsp_culling_distance, (fixed_t)(cv_drawdist_precip.value) * precipscale);
else
drawdist = ((fixed_t)(cv_drawdist_precip.value) * precipscale);
// No to infinite precipitation draw distance.
if (drawdist == 0 || curWeather == PRECIP_BLANK || curWeather == PRECIP_STORM_NORAIN)
if (drawdist == 0)
{
return;
}
@@ -4433,11 +4443,6 @@ static void HWR_ProjectSprite(mobj_t *thing)
// uncapped/interpolation
interpmobjstate_t interp = {0};
const boolean mirrored = thing->mirrored;
const boolean vflip = (thing->eflags & MFE_VERTICALFLIP);
const boolean hflip = (!(thing->frame & FF_HORIZONTALFLIP) != !mirrored);
const boolean papersprite = (thing->frame & FF_PAPERSPRITE);
if (cv_maxinterpdist.value)
dist = R_QuickCamDist(thing->x, thing->y);
@@ -4453,6 +4458,11 @@ static void HWR_ProjectSprite(mobj_t *thing)
if (interp.spritexscale < 1 || interp.spriteyscale < 1)
return;
const boolean mirrored = thing->mirrored;
const boolean vflip = (thing->eflags & MFE_VERTICALFLIP);
const boolean hflip = (!(thing->frame & FF_HORIZONTALFLIP) != !mirrored);
const boolean papersprite = (thing->frame & FF_PAPERSPRITE);
this_scale = FIXED_TO_FLOAT(interp.scale);
spritexscale = FIXED_TO_FLOAT(interp.spritexscale);
spriteyscale = FIXED_TO_FLOAT(interp.spriteyscale);
@@ -5042,7 +5052,7 @@ static void HWR_DrawSkyBackground(void)
if (drewsky)
return;
HWD.pfnSetBlend(PF_Translucent|PF_NoDepthTest|PF_Modulated);
GL_SetBlend(PF_Translucent|PF_NoDepthTest|PF_Modulated);
memcpy(&dometransform, &atransform, sizeof(FTransform));
@@ -5064,9 +5074,9 @@ static void HWR_DrawSkyBackground(void)
}
if (HWR_UseShader())
HWD.pfnSetShader(HWR_GetShaderFromTarget(SHADER_SKY));
HWD.pfnSetTransform(&dometransform);
HWD.pfnRenderSkyDome(&gl_sky);
GL_SetShader(HWR_GetShaderFromTarget(SHADER_SKY));
GL_SetTransform(&dometransform);
GL_RenderSkyDome(&gl_sky);
}
// -----------------+
@@ -5074,12 +5084,12 @@ static void HWR_DrawSkyBackground(void)
// -----------------+
static inline void HWR_ClearView(void)
{
HWD.pfnGClipRect((INT32)gl_viewwindowx,
(INT32)gl_viewwindowy,
(INT32)(gl_viewwindowx + gl_viewwidth),
(INT32)(gl_viewwindowy + gl_viewheight),
ZCLIP_PLANE, FAR_ZCLIP_DEFAULT);
HWD.pfnClearBuffer(false, true, true, NULL);
GL_GClipRect((INT32)gl_viewwindowx,
(INT32)gl_viewwindowy,
(INT32)(gl_viewwindowx + gl_viewwidth),
(INT32)(gl_viewwindowy + gl_viewheight),
ZCLIP_PLANE, FAR_ZCLIP_DEFAULT);
GL_ClearBuffer(false, true, true, NULL);
}
@@ -5101,7 +5111,7 @@ void HWR_SetViewSize(void)
gl_baseviewwindowy = 0;
gl_baseviewwindowx = 0;
HWD.pfnFlushScreenTextures();
GL_FlushScreenTextures();
}
// Set view aiming, for the sky dome, the skybox,
@@ -5166,7 +5176,7 @@ void HWR_SetTransform(float fpov, player_t *player)
atransform.mirrorflip = true;
// Set transform.
HWD.pfnSetTransform(&atransform);
GL_SetTransform(&atransform);
}
void HWR_ClearClipper(void)
@@ -5183,8 +5193,8 @@ void HWR_ClearClipper(void)
void HWR_SetStencilState(int state, int level)
{
if (level > -1)
HWD.pfnSetSpecialState(HWD_SET_STENCIL_LEVEL, level);
HWD.pfnSetSpecialState(HWD_SET_PORTAL_MODE, state);
GL_SetSpecialState(HWD_SET_STENCIL_LEVEL, level);
GL_SetSpecialState(HWD_SET_PORTAL_MODE, state);
}
// Renders the current viewpoint, though takes portal arguments for recursive portals.
@@ -5220,6 +5230,7 @@ void HWR_RenderViewpoint(gl_portal_t *rootportal, const float fpov, player_t *pl
{
HWR_RenderPortal(portal, rootportal, fpov, player, stencil_level);
}
HWR_SetPortalState(GLPORTAL_INSIDE); // when portal walls are encountered in following bsp traversal, nothing should be drawn
}
else
@@ -5240,7 +5251,7 @@ void HWR_RenderViewpoint(gl_portal_t *rootportal, const float fpov, player_t *pl
}
// Set transform.
HWD.pfnSetTransform(&atransform);
GL_SetTransform(&atransform);
validcount++;
@@ -5284,7 +5295,7 @@ void HWR_RenderViewpoint(gl_portal_t *rootportal, const float fpov, player_t *pl
drewsky = false;
HWR_DrawSkyBackground();
HWR_SetStencilState(HWR_STENCIL_NORMAL, 0);
HWD.pfnClearBuffer(false, false, true, 0);// clear skywall markings from the stencil buffer
GL_ClearBuffer(false, false, true, 0);// clear skywall markings from the stencil buffer
HWR_SetTransform(fpov, player);// restore transform
}
gl_collect_skywalls = false;
@@ -5355,11 +5366,11 @@ static void HWR_RenderFrame(INT32 viewnumber, player_t *player, boolean skybox)
if (!skybox && cv_glrenderdistance.value)
{
HWD.pfnGClipRect((INT32)gl_viewwindowx,
(INT32)gl_viewwindowy,
(INT32)(gl_viewwindowx + gl_viewwidth),
(INT32)(gl_viewwindowy + gl_viewheight),
ZCLIP_PLANE, clipping_distances[cv_glrenderdistance.value - 1]);
GL_GClipRect((INT32)gl_viewwindowx,
(INT32)gl_viewwindowy,
(INT32)(gl_viewwindowx + gl_viewwidth),
(INT32)(gl_viewwindowy + gl_viewheight),
ZCLIP_PLANE, clipping_distances[cv_glrenderdistance.value - 1]);
current_bsp_culling_distance = bsp_culling_distances[cv_glrenderdistance.value - 1];
}
@@ -5367,8 +5378,8 @@ static void HWR_RenderFrame(INT32 viewnumber, player_t *player, boolean skybox)
HWR_RenderViewpoint(NULL, fpov, player, 0, !skybox);
// Unset transform and shader
HWD.pfnSetTransform(NULL);
HWD.pfnUnSetShader();
GL_SetTransform(NULL);
GL_UnSetShader();
// Run post processor effects
if (!skybox)
@@ -5376,7 +5387,7 @@ static void HWR_RenderFrame(INT32 viewnumber, player_t *player, boolean skybox)
// added by Hurdler for correct splitscreen
// moved here by hurdler so it works with the new near clipping plane
HWD.pfnGClipRect(0, 0, vid.width, vid.height, NZCLIP_PLANE, FAR_ZCLIP_DEFAULT);
GL_GClipRect(0, 0, vid.width, vid.height, NZCLIP_PLANE, FAR_ZCLIP_DEFAULT);
}
// ==========================================================================
@@ -5406,11 +5417,13 @@ void HWR_RenderPlayerView(INT32 viewnumber, player_t *player)
ClearColor.blue = 0.0f;
ClearColor.alpha = 1.0f;
HWD.pfnClearBuffer(true, false, false, &ClearColor);
GL_ClearBuffer(true, false, false, &ClearColor);
}
if (HWR_UseShader() && cv_ripplewater.value)
HWD.pfnSetShaderInfo(HWD_SHADERINFO_LEVELTIME, (INT32)leveltime); // The water surface shader needs the leveltime.
{
GL_SetShaderInfo(HWD_SHADERINFO_LEVELTIME, (INT32)leveltime); // The water surface shader needs the leveltime.
}
if (viewnumber > 3)
return;
@@ -5477,7 +5490,7 @@ static void HWR_TogglePaletteRendering(void)
// If the r_opengl "texture palette" stays the same during this switch, these textures
// will not be cleared out. However they are still out of date since the
// composite texture blending method has changed. Therefore they need to be cleared.
HWD.pfnClearMipMapCache();
GL_ClearMipMapCache();
}
}
else
@@ -5491,7 +5504,7 @@ static void HWR_TogglePaletteRendering(void)
// If the r_opengl "texture palette" stays the same during this switch, these textures
// will not be cleared out. However they are still out of date since the
// composite texture blending method has changed. Therefore they need to be cleared.
HWD.pfnClearMipMapCache();
GL_ClearMipMapCache();
}
}
}
@@ -5561,7 +5574,7 @@ void HWR_Startup(void)
HWR_TogglePaletteRendering();
if (msaa)
HWD.pfnSetSpecialState(HWD_SET_MSAA, a2c ? 2 : 1);
GL_SetSpecialState(HWD_SET_MSAA, a2c ? 2 : 1);
HWR_RegisterCommands();
}
@@ -5645,9 +5658,9 @@ void HWR_Shutdown(void)
HWR_FreeExtraSubsectors();
HWR_FreeMipmapCache();
HWR_FreeTextureCache();
HWD.pfnFlushScreenTextures();
GL_FlushScreenTextures();
#ifdef USE_FBO_OGL
GLFramebuffer_Disable();
GL_Framebuffer_Disable();
#endif
}
@@ -5690,12 +5703,12 @@ static void HWR_RenderWall(FOutVector *wallVerts, FSurfaceInfo *pSurf, FBITFIELD
INT32 HWR_GetTextureUsed(void)
{
return HWD.pfnGetTextureUsed();
return GL_GetTextureUsed();
}
static void HWR_DoPostProcessor(player_t *player)
{
HWD.pfnUnSetShader();
GL_UnSetShader();
// Armageddon Blast Flash!
// Could this even be considered postprocessor?
@@ -5719,7 +5732,7 @@ static void HWR_DoPostProcessor(player_t *player)
Surf.PolyColor.s.alpha = 0xc0; // match software mode
HWD.pfnDrawPolygon(&Surf, v, 4, PF_Modulated|PF_Translucent|PF_NoTexture|PF_NoDepthTest);
GL_DrawPolygon(&Surf, v, 4, PF_Modulated|PF_Translucent|PF_NoTexture|PF_NoDepthTest);
}
if (cv_glscreentextures.value != 2) // screen textures are needed for the rest of the effects
@@ -5727,7 +5740,7 @@ static void HWR_DoPostProcessor(player_t *player)
// Capture the screen for intermission and screen waving
if (gamestate != GS_INTERMISSION)
HWD.pfnMakeScreenTexture(HWD_SCREENTEXTURE_GENERIC1);
GL_MakeScreenTexture(HWD_SCREENTEXTURE_GENERIC1);
if (splitscreen) // Not supported in splitscreen - someone want to add support?
return;
@@ -5767,28 +5780,28 @@ static void HWR_DoPostProcessor(player_t *player)
v[x][y][1] = (y/((float)(SCREENVERTS-1.0f)/9.0f))-4.5f;
}
}
HWD.pfnPostImgRedraw(v);
GL_PostImgRedraw(v);
// Capture the screen again for screen waving on the intermission
if (gamestate != GS_INTERMISSION)
HWD.pfnMakeScreenTexture(HWD_SCREENTEXTURE_GENERIC1);
GL_MakeScreenTexture(HWD_SCREENTEXTURE_GENERIC1);
}
// Flipping of the screen isn't done here anymore
}
void HWR_StartScreenWipe(void)
{
HWD.pfnMakeScreenTexture(HWD_SCREENTEXTURE_WIPE_START);
GL_MakeScreenTexture(HWD_SCREENTEXTURE_WIPE_START);
}
void HWR_EndScreenWipe(void)
{
HWD.pfnMakeScreenTexture(HWD_SCREENTEXTURE_WIPE_END);
GL_MakeScreenTexture(HWD_SCREENTEXTURE_WIPE_END);
}
void HWR_DrawIntermissionBG(void)
{
HWD.pfnDrawScreenTexture(HWD_SCREENTEXTURE_GENERIC1, NULL, 0);
GL_DrawScreenTexture(HWD_SCREENTEXTURE_GENERIC1, NULL, 0);
}
void HWR_DoWipe(UINT8 wipenum, UINT8 scrnnum)
@@ -5822,22 +5835,22 @@ void HWR_DoWipe(UINT8 wipenum, UINT8 scrnnum)
}
HWR_GetFadeMask(lumpnum);
HWD.pfnDoScreenWipe(HWD_SCREENTEXTURE_WIPE_START, HWD_SCREENTEXTURE_WIPE_END);
GL_DoScreenWipe(HWD_SCREENTEXTURE_WIPE_START, HWD_SCREENTEXTURE_WIPE_END);
}
void HWR_RenderVhsEffect(fixed_t upbary, fixed_t downbary, UINT8 updistort, UINT8 downdistort, UINT8 barsize)
{
HWD.pfnRenderVhsEffect(upbary, downbary, updistort, downdistort, barsize);
GL_RenderVhsEffect(upbary, downbary, updistort, downdistort, barsize);
}
void HWR_MakeScreenFinalTexture(void)
{
HWD.pfnMakeScreenTexture(HWD_SCREENTEXTURE_GENERIC2);
GL_MakeScreenTexture(HWD_SCREENTEXTURE_GENERIC2);
}
void HWR_DrawScreenFinalTexture(INT32 width, INT32 height, boolean useshader)
{
HWD.pfnDrawScreenFinalTexture(HWD_SCREENTEXTURE_GENERIC2, width, height, useshader);
GL_DrawScreenFinalTexture(HWD_SCREENTEXTURE_GENERIC2, width, height, useshader);
}
#endif // HWRENDER
+13 -11
View File
@@ -25,12 +25,14 @@
#include "../doomstat.h"
#ifdef HWRENDER
#include "hw_drv.h"
#include "hw_gl.h"
#include "hw_md2.h"
#include "../d_main.h"
#include "../r_bsp.h"
#include "../r_fps.h"
#include "../r_main.h"
#include "../p_setup.h"
#include "../m_misc.h"
#include "../w_wad.h"
#include "../z_zone.h"
@@ -43,8 +45,8 @@
#include "hw_main.h"
#include "../v_video.h"
#ifdef HAVE_PNG
#ifdef HAVE_PNG
#ifndef _MSC_VER
#ifndef _LARGEFILE64_SOURCE
#define _LARGEFILE64_SOURCE
@@ -417,7 +419,7 @@ static void md2_loadTexture(md2_t *model)
}
}
}
HWD.pfnSetTexture(glpatch->mipmap);
GL_SetTexture(glpatch->mipmap);
HWR_UnlockCachedPatch(glpatch);
}
@@ -467,7 +469,7 @@ static void md2_loadBlendTexture(md2_t *model)
glpatch->mipmap->width = (UINT16)w;
glpatch->mipmap->height = (UINT16)h;
}
HWD.pfnSetTexture(glpatch->mipmap); // We do need to do this so that it can be cleared and knows to recreate it when necessary
GL_SetTexture(glpatch->mipmap); // We do need to do this so that it can be cleared and knows to recreate it when necessary
HWR_UnlockCachedPatch(glpatch);
Z_Free(filename);
@@ -1048,7 +1050,7 @@ static void HWR_GetBlendedTexture(GLPatch_t *gpatch, GLPatch_t *blendgpatch, INT
if (colormap == colormaps || colormap == NULL)
{
// Don't do any blending
HWD.pfnSetTexture(gpatch->mipmap);
GL_SetTexture(gpatch->mipmap);
return;
}
@@ -1063,7 +1065,7 @@ static void HWR_GetBlendedTexture(GLPatch_t *gpatch, GLPatch_t *blendgpatch, INT
if (glMipmap->downloaded && glMipmap->data)
{
HWD.pfnSetTexture(glMipmap); // found the colormap, set it to the correct texture
GL_SetTexture(glMipmap); // found the colormap, set it to the correct texture
Z_ChangeTag(glMipmap->data, PU_HWRCACHE_UNLOCKED);
return;
}
@@ -1084,7 +1086,7 @@ static void HWR_GetBlendedTexture(GLPatch_t *gpatch, GLPatch_t *blendgpatch, INT
HWR_CreateBlendedTexture(gpatch, blendgpatch, newMipmap, skinnum, color);
HWD.pfnSetTexture(newMipmap);
GL_SetTexture(newMipmap);
Z_ChangeTag(newMipmap->data, PU_HWRCACHE_UNLOCKED);
}
@@ -1233,7 +1235,7 @@ void HWR_DrawMD2(gl_vissprite_t *spr)
if (md2->model)
{
md2_printModelInfo(md2->model);
HWD.pfnCreateModelVBOs(md2->model);
GL_CreateModelVBOs(md2->model);
}
else
{
@@ -1288,7 +1290,7 @@ void HWR_DrawMD2(gl_vissprite_t *spr)
else
{
// This is safe, since we know the texture has been downloaded
HWD.pfnSetTexture(gpatch->mipmap);
GL_SetTexture(gpatch->mipmap);
}
}
else
@@ -1461,7 +1463,7 @@ void HWR_DrawMD2(gl_vissprite_t *spr)
p.mirror = atransform.mirror; // from Kart
#endif
HWD.pfnSetShader(SHADER_MODEL); // model shader
GL_SetShader(SHADER_MODEL); // model shader
{
SINT8 flipfactor = flip ? -1 : 1;
@@ -1478,7 +1480,7 @@ void HWR_DrawMD2(gl_vissprite_t *spr)
p.y += ox * gl_viewcos;
p.z += oy;
HWD.pfnDrawModel(md2->model, frame, durs, tics, nextFrame, &p, md2->scale * xs, md2->scale * ys, flip, hflip, &Surf);
GL_DrawModel(md2->model, frame, durs, tics, nextFrame, &p, md2->scale * xs, md2->scale * ys, flip, hflip, &Surf);
}
}
}
+2 -2
View File
@@ -23,7 +23,7 @@
#include "../z_zone.h"
#include "hw_clip.h"
#include "hw_drv.h"
#include "hw_gl.h"
#include "hw_defs.h"
#include "hw_main.h"
#include "hw_portal.h"
@@ -153,7 +153,7 @@ static void HWR_RenderPortalSeg(gl_portal_t* portal, SINT8 state)
// need to work around the r_opengl PF_Invisible bug with this call
// similarly as in the linkdraw hack in HWR_DrawSprites
HWD.pfnSetBlend(PF_Translucent|PF_Occlude|PF_Masked);
GL_SetBlend(PF_Translucent|PF_Occlude|PF_Masked);
}
// Renders a single portal from the current viewpoint.
+5 -5
View File
@@ -13,7 +13,7 @@
#include "hw_main.h"
#include "hw_glob.h"
#include "hw_drv.h"
#include "hw_gl.h"
#include "hw_shaders.h"
#include "../z_zone.h"
@@ -87,7 +87,7 @@ boolean HWR_InitShaders(void)
{
int i;
if (!HWD.pfnInitShaders())
if (!GL_InitShaders())
return false;
for (i = 0; i < NUMSHADERTARGETS; i++)
@@ -366,16 +366,16 @@ static void HWR_CompileShader(int index)
{
char *preprocessed = HWR_PreprocessShader(vertex_source);
if (!preprocessed) return;
HWD.pfnLoadShader(index, preprocessed, HWD_SHADERSTAGE_VERTEX);
GL_LoadShader(index, preprocessed, HWD_SHADERSTAGE_VERTEX);
}
if (fragment_source)
{
char *preprocessed = HWR_PreprocessShader(fragment_source);
if (!preprocessed) return;
HWD.pfnLoadShader(index, preprocessed, HWD_SHADERSTAGE_FRAGMENT);
GL_LoadShader(index, preprocessed, HWD_SHADERSTAGE_FRAGMENT);
}
gl_shaders[index].compiled = HWD.pfnCompileShader(index);
gl_shaders[index].compiled = GL_CompileShader(index);
}
// compile or recompile shaders
+1
View File
@@ -99,6 +99,7 @@
GLSL_DOOM_COLORMAP_NODITHER \
"#endif\n" \
"}\n"
// lighting cap adjustment:
// first num (155.0), increase to make it start to go dark sooner
// second num (0.26), increase to make it go dark faster
+3 -22
View File
@@ -358,8 +358,8 @@ static INT32 WINAPI SetRes(viddef_t *lvid, vmode_t *pcurrentmode)
else
textureformatGL = GL_RGB5_A1;
SetModelView(lvid->width, lvid->height);
SetStates();
GL_SetModelView(lvid->width, lvid->height);
GL_SetStates();
// we need to clear the depth buffer. Very important!!!
pglClear(GL_COLOR_BUFFER_BIT|GL_DEPTH_BUFFER_BIT);
@@ -526,7 +526,7 @@ EXPORT void HWRAPI(Shutdown) (void)
// -----------------+
// FinishUpdate : Swap front and back buffers
// -----------------+
EXPORT void HWRAPI(FinishUpdate) (INT32 waitvbl)
void GL_FinishUpdate (INT32 waitvbl)
{
#ifdef USE_WGL_SWAP
static INT32 oldwaitvbl = 0;
@@ -547,23 +547,4 @@ EXPORT void HWRAPI(FinishUpdate) (INT32 waitvbl)
SwapBuffers(hDC);
}
// -----------------+
// SetPalette : Set the color lookup table for paletted textures
// : in OpenGL, we store values for conversion of paletted graphics when
// : they are downloaded to the 3D card.
// -----------------+
EXPORT void HWRAPI(SetPalette) (RGBA_t *pal)
{
INT32 i;
for (i = 0; i < 256; i++)
{
myPaletteData[i].s.red = pal[i].s.red;
myPaletteData[i].s.green = pal[i].s.green;
myPaletteData[i].s.blue = pal[i].s.blue;
myPaletteData[i].s.alpha = pal[i].s.alpha;
}
}
#endif
File diff suppressed because it is too large. Load diff
+12 -10
View File
@@ -43,8 +43,9 @@
#endif
#define _CREATE_DLL_ // necessary for Unix AND Windows
#include "../../doomdef.h"
#include "../hw_drv.h"
#include "../hw_gl.h"
#include "../../z_zone.h"
// ==========================================================================
@@ -65,14 +66,15 @@ extern FILE *gllogstream;
// PROTOS
// ==========================================================================
boolean LoadGL(void);
FUNCPRINTF void GL_DBG_Printf(const char *format, ...);
void *GetGLFunc(const char *proc);
boolean SetupGLfunc(void);
void SetupGLFunc4(void);
void Flush(void);
INT32 isExtAvailable(const char *extension, const GLubyte *start);
void SetModelView(GLint w, GLint h);
void SetStates(void);
void GL_Flush(void);
INT32 GL_isExtAvailable(const char *extension, const GLubyte *start);
void GL_SetModelView(GLint w, GLint h);
void GL_SetStates(void);
#ifndef GL_EXT_texture_filter_anisotropic
#define GL_TEXTURE_MAX_ANISOTROPY_EXT 0x84FE
@@ -101,11 +103,11 @@ extern PFNglGetString pglGetString;
#endif
#ifdef USE_FBO_OGL
void GLFramebuffer_DeleteAttachments(void);
void GL_Framebuffer_DeleteAttachments(void);
void GLFramebuffer_Unbind(void);
void GLFramebuffer_Enable(void);
void GLFramebuffer_Disable(void);
void GL_Framebuffer_Unbind(void);
void GL_Framebuffer_Enable(void);
void GL_Framebuffer_Disable(void);
extern GLuint FramebufferObject, FramebufferTexture, RenderbufferObject;
extern GLboolean FrameBufferEnabled, RenderToFramebuffer;
-1
View File
@@ -21,7 +21,6 @@
#include "d_player.h"
#include "lzf.h"
// Hey, moron! If you change this table, don't forget about the sprite enum in info.h and the sprite lights in hw_light.c!
char sprnames[NUMSPRITES + 1][5] =
{
"NULL","UNKN","THOK","PLAY","POSS","SPOS","FISH","BUZZ","RBUZ","JETB",
-1
View File
@@ -457,7 +457,6 @@ extern boolean actionsoverridden[NUMACTIONS];
#define NUMSPRITEFREESLOTS NUMMOBJFREESLOTS
#define NUMSTATEFREESLOTS (NUMMOBJFREESLOTS*8)
// Hey, moron! If you change this table, don't forget about sprnames in info.c and the sprite lights in hw_light.c!
typedef enum sprite
{
SPR_NULL, // invisible object
+44 -32
View File
@@ -7106,7 +7106,8 @@ void K_LoadKartHUDGraphics(void)
skp_speedpatchesachi[4] = W_CachePatchName("SP_APERC", PU_HUDGFX);
}
if (big_lap){
if (big_lap)
{
kp_lapstickerbig = W_CachePatchName("K_STLAPB", PU_HUDGFX);
kp_lapstickerbig2 = W_CachePatchName("K_STLA2B", PU_HUDGFX);
}
@@ -7171,14 +7172,14 @@ void K_LoadKartHUDGraphics(void)
// Nametags
if (nametaggfx)
{
nametagpic = W_CachePatchName("NTLINE", PU_HUDGFX);
nametagline = W_CachePatchName("NTLINEV", PU_HUDGFX);
nametagspeed = W_CachePatchName("NTSP", PU_HUDGFX);
nametagweight = W_CachePatchName("NTWH", PU_HUDGFX);
}
if (driftgaugegfx){
if (driftgaugegfx)
{
driftgauge = W_CachePatchName("K_DGAU", PU_HUDGFX);
driftgaugecolor = W_CachePatchName("K_DCAU", PU_HUDGFX);
driftgaugesmall = W_CachePatchName("K_DGSU", PU_HUDGFX);
@@ -8164,13 +8165,13 @@ void K_drawKartTimestamp(tic_t drawtime, INT32 TX, INT32 TY, INT16 emblemmap, UI
}
}
if (!K_UseColorHud())
V_DrawScaledPatch(TX, TY, splitflags, ((mode == 2) ? kp_lapstickerwide : kp_timestickerwide));
else //Colourized hud
if (K_UseColorHud()) // Colourized hud
{
UINT8 *colormap = R_GetTranslationColormap(TC_DEFAULT, K_GetHudColor(), GTC_CACHE);
V_DrawMappedPatch(TX, TY, splitflags, ((mode == 2) ? kp_lapstickerwideclr : kp_timestickerwideclr), colormap);
}
else
V_DrawScaledPatch(TX, TY, splitflags, ((mode == 2) ? kp_lapstickerwide : kp_timestickerwide));
TX += 33;
@@ -8673,12 +8674,9 @@ void HU_DrawTabRankings(INT32 x, INT32 y, playersort_t *tab, INT32 scorelines, I
}
}
static boolean K_BigLapSticker(void)
static boolean K_BigLap(void)
{
if (K_UseColorHud())
return ((cv_numlaps.value > 9) && (big_lap_color) && (cv_biglaps.value) && (!stplyr->exiting));
else
return ((cv_numlaps.value > 9) && (big_lap) && (cv_biglaps.value) && (!stplyr->exiting));
return (cv_biglaps.value && (cv_numlaps.value > 9) && (K_UseColorHud() ? big_lap_color : big_lap) && (!stplyr->exiting));
}
static void K_drawKartLaps(void)
@@ -8717,20 +8715,16 @@ static void K_drawKartLaps(void)
}
else
{
if (!K_UseColorHud())
{
if (K_BigLapSticker())
V_DrawScaledPatch(fx, fy, V_HUDTRANS|splitflags, ((stplyr->laps + 1 > 9) ? kp_lapstickerbig2 : kp_lapstickerbig));
else
V_DrawScaledPatch(fx, fy, V_HUDTRANS|splitflags, kp_lapsticker);
}
else //Colourized hud
if (K_UseColorHud()) // Colourized hud
{
UINT8 *colormap = R_GetTranslationColormap(TC_DEFAULT, K_GetHudColor(), GTC_CACHE);
if (K_BigLapSticker())
V_DrawMappedPatch(fx, fy, V_HUDTRANS|splitflags, ((stplyr->laps + 1 > 9) ? kp_lapstickerbig2clr : kp_lapstickerbigclr), colormap);
else
V_DrawMappedPatch(fx, fy, V_HUDTRANS|splitflags, kp_lapstickerclr, colormap);
patch_t *biglapclr = (K_BigLap() ? ((stplyr->laps + 1 > 9) ? kp_lapstickerbig2clr : kp_lapstickerbigclr) : kp_lapstickerclr);
V_DrawMappedPatch(fx, fy, V_HUDTRANS|splitflags, biglapclr, colormap);
}
else
{
patch_t *biglap = (K_BigLap() ? ((stplyr->laps + 1 > 9) ? kp_lapstickerbig2 : kp_lapstickerbig) : kp_lapsticker);
V_DrawScaledPatch(fx, fy, V_HUDTRANS|splitflags, biglap);
}
if (stplyr->exiting)
@@ -9351,11 +9345,14 @@ skipcrap:
case 1:
case 2:
case 3:
case 5:
{
if (!driftgaugegfx)
break;
if (cv_driftgaugestyle.value == 1 || cv_driftgaugestyle.value == 3 || (cv_driftgaugestyle.value == 5 && xtra_speedo3))
const boolean usescaledpatch = (cv_driftgaugestyle.value == 5 && xtra_speedo3);
if (cv_driftgaugestyle.value == 1 || cv_driftgaugestyle.value == 3 || usescaledpatch)
{
barx = basex - dup*23;
BAR_WIDTH = dup*47;
@@ -9373,12 +9370,26 @@ skipcrap:
const INT32 width = ((driftcharge - (driftcharge >= driftval ? limit : 0)) * BAR_WIDTH) / limit;
const INT32 level = min(driftcharge / driftval, 2);
if (!K_UseColorHud())
V_DrawMappedPatch(cv_driftgaugestyle.value == 2 ? basex + dup*11 : basex, basey, V_NOSCALESTART|V_OFFSET|drifttrans, cv_driftgaugestyle.value == 2 ? driftgaugesmall : driftgauge, NULL);
else //Colourized hud
if (usescaledpatch) // i hate hud code i hate hud code i hate hud code i hate hud code i hate hud code.....
{
UINT8 *colormap = R_GetTranslationColormap(TC_DEFAULT, K_GetHudColor(), GTC_CACHE);
V_DrawMappedPatch(cv_driftgaugestyle.value == 2 ? basex + dup*11 : basex, basey, V_NOSCALESTART|V_OFFSET|drifttrans, cv_driftgaugestyle.value == 2 ? driftgaugesmallcolor : driftgaugecolor, colormap);
if (K_UseColorHud() && xtra_speedo_clr3) // Colourized hud
{
UINT8 *colormap = R_GetTranslationColormap(TC_DEFAULT, K_GetHudColor(), GTC_CACHE);
V_DrawStretchyFixedPatch((basex - dup*30)<<FRACBITS, ((basey<<FRACBITS) - FixedMul(dup<<FRACBITS, 21*FRACUNIT/10)), FRACUNIT*0.765, FRACUNIT*0.55, V_NOSCALESTART|V_OFFSET|drifttrans, skp_smallstickerclr3, colormap);
}
else
V_DrawStretchyFixedPatch((basex - dup*30)<<FRACBITS, ((basey<<FRACBITS) - FixedMul(dup<<FRACBITS, 21*FRACUNIT/10)), FRACUNIT*0.765, FRACUNIT*0.55, V_NOSCALESTART|V_OFFSET|drifttrans, skp_smallsticker3, NULL);
}
else
{
if (K_UseColorHud()) // Colourized hud
{
UINT8 *colormap = R_GetTranslationColormap(TC_DEFAULT, K_GetHudColor(), GTC_CACHE);
V_DrawMappedPatch(cv_driftgaugestyle.value == 2 ? basex + dup*11 : basex, basey, V_NOSCALESTART|V_OFFSET|drifttrans, cv_driftgaugestyle.value == 2 ? driftgaugesmallcolor : driftgaugecolor, colormap);
}
else
V_DrawMappedPatch(cv_driftgaugestyle.value == 2 ? basex + dup*11 : basex, basey, V_NOSCALESTART|V_OFFSET|drifttrans, cv_driftgaugestyle.value == 2 ? driftgaugesmall : driftgauge, NULL);
}
if (driftcharge >= driftval*4) // rainbow sparks
@@ -9930,13 +9941,14 @@ static void K_drawBattleFullscreen(void)
V_DrawString(x-txoff, ty, 0, va("%d", stplyr->kartstuff[k_comebacktimer]/TICRATE));
else
{
if (!K_UseColorHud())
V_DrawFixedPatch(x<<FRACBITS, ty<<FRACBITS, scale, 0, kp_timeoutsticker, NULL);
else //Colourized hud
if (K_UseColorHud()) // Colourized hud
{
UINT8 *colormap = R_GetTranslationColormap(TC_DEFAULT, K_GetHudColor(), GTC_CACHE);
V_DrawFixedPatch(x<<FRACBITS, ty<<FRACBITS, scale, 0, kp_timeoutstickerclr, colormap);
}
else
V_DrawFixedPatch(x<<FRACBITS, ty<<FRACBITS, scale, 0, kp_timeoutsticker, NULL);
V_DrawKartString(x-txoff, ty, 0, va("%d", stplyr->kartstuff[k_comebacktimer]/TICRATE));
}
+2 -2
View File
@@ -1829,7 +1829,7 @@ static int lib_sStartSoundAtVolume(lua_State *L)
return LUA_ErrInvalid(L, "player_t");
}
if (!player || P_IsLocalPlayer(player))
S_StartSoundAtVolume(origin, sound_id, volume);
S_StartSoundAtVolume(origin, sound_id, volume);
return 0;
}
@@ -1931,7 +1931,7 @@ static int lib_sChangeMusic(lua_State *L)
music_flags = (UINT16)((music_num & 0x7FFF0000) >> 16);
else
#endif
music_flags = (UINT16)luaL_optinteger(L, 4, 0);
music_flags = (UINT16)luaL_optinteger(L, 4, 0);
position = (UINT32)luaL_optinteger(L, 5, 0);
prefadems = (UINT32)luaL_optinteger(L, 6, 0);
+33
View File
@@ -934,6 +934,7 @@ int LUA_HookHurtMsg(player_t *player, mobj_t *inflictor, mobj_t *source)
return hook.status;
}
#if 0
void LUA_HookNetArchive(lua_CFunction archFunc)
{
const hook_t * map = &hookIds[HOOK(NetVars)];
@@ -964,6 +965,38 @@ void LUA_HookNetArchive(lua_CFunction archFunc)
// stack: tables
}
}
#endif
void LUA_HookNetArchive(lua_CFunction archFunc, savebuffer_t *save) //
{
const hook_t * map = &hookIds[HOOK(NetVars)];
Hook_State hook;
/* this is a remarkable case where the stack isn't reset */
if (map->numHooks > 0)
{
// stack: tables
I_Assert(lua_gettop(gL) > 0);
I_Assert(lua_istable(gL, -1));
push_error_handler();
lua_insert(gL, EINDEX);
begin_hook_values(&hook);
// tables becomes an upvalue of archFunc
lua_pushvalue(gL, -1);
lua_pushlightuserdata(gL, save);
lua_pushcclosure(gL, archFunc, 2);
// stack: tables, savebuffer_t, archFunc
init_hook_call(&hook, 0, res_none);
call_mapped(&hook, map);
lua_pop(gL, 1); // pop archFunc
lua_remove(gL, EINDEX); // pop error handler
// stack: tables
}
}
void LUA_HookPlayerQuit(player_t *plr, int reason)
{
+189 -573
View File
File diff suppressed because it is too large. Load diff
+5 -6
View File
@@ -13,6 +13,7 @@
#include "m_fixed.h"
#include "doomtype.h"
#include "d_player.h"
#include "p_saveg.h"
#include "blua/lua.h"
#include "blua/lualib.h"
@@ -55,17 +56,15 @@ void LUA_InvalidateLevel(void);
void LUA_InvalidateMapthings(void);
void LUA_InvalidatePlayer(player_t *player);
void LUA_Step(void);
void LUA_Archive(void);
void LUA_UnArchive(void);
void LUA_ArchiveDemo(void);
void LUA_UnArchiveDemo(void);
void LUA_Archive(savebuffer_t *save, boolean network);
void LUA_UnArchive(savebuffer_t *save, boolean network);
void Got_Luacmd(UINT8 **cp, INT32 playernum); // lua_consolelib.c
void LUA_CVarChanged(const char *name); // lua_consolelib.c
int Lua_optoption(lua_State *L, int narg, int def, int list_ref);
int Lua_CreateFieldTable(lua_State *L, const char *const lst[]);
void LUA_HookNetArchive(lua_CFunction archFunc);
void LUA_HookNetArchive(lua_CFunction archFunc, savebuffer_t *save);
//void LUA_HookNetArchive(lua_CFunction archFunc);
// Console wrapper
void COM_Lua_f(void);
+987 -1014
View File
File diff suppressed because it is too large. Load diff
+16 -8
View File
@@ -21,13 +21,6 @@
// Persistent storage/archiving.
// These are the load / save game routines.
void P_SaveGame(void);
void P_SaveNetGame(boolean resending);
boolean P_LoadGame(INT16 mapoverride);
boolean P_LoadNetGame(boolean resending);
mobj_t *P_FindNewPosition(UINT32 oldposition);
typedef struct
{
UINT8 skincolor;
@@ -41,6 +34,21 @@ typedef struct
} savedata_t;
extern savedata_t savedata;
extern UINT8 *save_p;
typedef struct
{
UINT8 *buffer;
UINT8 *p;
} savebuffer_t;
// Persistent storage/archiving.
// These are the load / save game routines.
void P_SaveGame(savebuffer_t *save);
void P_SaveNetGame(savebuffer_t *save, boolean resending);
boolean P_LoadGame(savebuffer_t *save, INT16 mapoverride);
boolean P_LoadNetGame(savebuffer_t *save, boolean reloading);
mobj_t *P_FindNewPosition(UINT32 oldposition);
#endif
+15 -14
View File
@@ -1001,14 +1001,14 @@ void P_WriteThings(lumpnum_t lumpnum)
size_t i, length;
mapthing_t *mt;
UINT8 *data;
UINT8 *savebuffer, *savebuf_p;
savebuffer_t save;
INT16 temp;
data = W_CacheLumpNum(lumpnum, PU_LEVEL);
savebuf_p = savebuffer = (UINT8 *)malloc(nummapthings * sizeof (mapthing_t));
save.p = save.buffer = (UINT8 *)malloc(nummapthings * sizeof (mapthing_t));
if (!savebuf_p)
if (!save.p)
{
CONS_Alert(CONS_ERROR, M_GetText("No more free memory for thing writing!\n"));
return;
@@ -1017,23 +1017,23 @@ void P_WriteThings(lumpnum_t lumpnum)
mt = mapthings;
for (i = 0; i < nummapthings; i++, mt++)
{
WRITEINT16(savebuf_p, mt->x);
WRITEINT16(savebuf_p, mt->y);
WRITEINT16(save.p, mt->x);
WRITEINT16(save.p, mt->y);
WRITEINT16(savebuf_p, mt->angle);
WRITEINT16(save.p, mt->angle);
temp = (INT16)(mt->type + ((INT16)mt->extrainfo << 12));
WRITEINT16(savebuf_p, temp);
WRITEUINT16(savebuf_p, mt->options);
WRITEINT16(save.p, temp);
WRITEUINT16(save.p, mt->options);
}
Z_Free(data);
length = savebuf_p - savebuffer;
length = save.p - save.buffer;
FIL_WriteFile(va("newthings%d.lmp", gamemap), savebuffer, length);
free(savebuffer);
savebuf_p = NULL;
FIL_WriteFile(va("newthings%d.lmp", gamemap), save.buffer, length);
free(save.buffer);
save.p = NULL;
CONS_Printf(M_GetText("newthings%d.lmp saved.\n"), gamemap);
}
@@ -2908,8 +2908,9 @@ boolean P_SetupLevel(boolean skipprecip, boolean reloadinggamestate)
: mapheaderinfo[gamemap - 1]->numlaps);
// Start recording replay in multiplayer with a temp filename
//Ensure dedis only record a replay if there is a player at the start of the map, otherwise we get invalid replays!
if (!demo.playback && multiplayer && D_NumPlayers()) {
// Ensure dedis only record a replay if there is a player at the start of the map, otherwise we get invalid replays!
if (!demo.playback && multiplayer && D_NumPlayers())
{
static char buf[256];
sprintf(buf, "replay"PATHSEP"online"PATHSEP"%d-%s", (int) (time(NULL)), G_BuildMapName(gamemap));
+14 -4
View File
@@ -3383,8 +3383,15 @@ void P_ResetCamera(player_t *player, camera_t *thiscam)
thiscam->z = z;
thiscam->reset = true;
thiscam->angle = player->mo->angle;
thiscam->aiming = 0;
if (!(thiscam == &camera[0] && (cv_cam_still[0].value))
&& !(thiscam == &camera[1] && (cv_cam_still[1].value))
&& !(thiscam == &camera[2] && (cv_cam_still[2].value))
&& !(thiscam == &camera[3] && (cv_cam_still[3].value)))
{
thiscam->angle = player->mo->angle;
thiscam->aiming = 0;
}
thiscam->relativex = 0;
thiscam->subsector = R_PointInSubsectorFast(thiscam->x,thiscam->y);
@@ -3500,7 +3507,10 @@ boolean P_MoveChaseCamera(player_t *player, camera_t *thiscam, boolean resetcall
focusangle = mo->angle;
}
camrotate = cv_cam_rotate[num].value;
if (thiscam == &camera[num])
camrotate = cv_cam_rotate[num].value;
else
camrotate = 0;
if (leveltime < introtime) // Whoooshy camera!
{
@@ -3604,7 +3614,7 @@ boolean P_MoveChaseCamera(player_t *player, camera_t *thiscam, boolean resetcall
}
if (!resetcalled && (leveltime > starttime && timeover != 2)
&& (t_cam_rotate[num] != -42))
&& (thiscam == &camera[num] && t_cam_rotate[num] != -42))
{
angle = FixedAngle(camrotate*FRACUNIT);
thiscam->angle = angle;
+2 -2
View File
@@ -583,10 +583,10 @@ static void R_AddLine(seg_t *line)
clippass:
g_walloffscreen = false;
R_ClipPassWallSegment(x1, x2 - 1, false);
if (g_walloffscreen)
R_ClipPassWallSegment(x1, x2 - 1, true);
else
R_ClipPassWallSegment(x1, x2 - 1, false);
return;
clipsolid:
+7
View File
@@ -935,6 +935,7 @@ void S_ClearSfx(void)
static void S_StopChannel(INT32 cnum)
{
INT32 i;
channel_t *c = &channels[cnum];
if (c->sfxinfo)
@@ -943,6 +944,12 @@ static void S_StopChannel(INT32 cnum)
if (I_SoundIsPlaying(c->handle))
I_StopSound(c->handle);
// check to see
// if other channels are playing the sound
for (i = 0; i < numofchannels; i++)
if (cnum != i && c->sfxinfo == channels[i].sfxinfo)
break;
// degrade usefulness of sound data
c->sfxinfo->usefulness--;
c->sfxinfo = 0;
+1 -1
View File
@@ -572,7 +572,7 @@ SOURCE=..\hardware\hw_draw.c
# End Source File
# Begin Source File
SOURCE=..\hardware\hw_drv.h
SOURCE=..\hardware\hw_gl.h
# End Source File
# Begin Source File
+1 -57
View File
@@ -43,14 +43,6 @@
#define _CREATE_DLL_ // necessary for Unix AND Windows
#ifdef HWRENDER
#include "../hardware/hw_drv.h"
#include "ogl_sdl.h"
#ifdef STATIC_OPENGL
#include "../hardware/r_opengl/r_opengl.h"
#endif
#endif
#ifdef HW3SOUND
#include "../hardware/hw3dsdrv.h"
#endif
@@ -73,55 +65,7 @@
void *hwSym(const char *funcName,void *handle)
{
void *funcPointer = NULL;
#ifdef HWRENDER
if (0 == strcmp("SetTexturePalette", funcName))
funcPointer = &OglSdlSetPalette;
GETFUNC(Init);
GETFUNC(SetupGLInfo);
GETFUNC(Draw2DLine);
GETFUNC(DrawPolygon);
GETFUNC(DrawIndexedTriangles);
GETFUNC(SetBlend);
GETFUNC(ClearBuffer);
GETFUNC(SetTexture);
GETFUNC(UpdateTexture);
GETFUNC(DeleteTexture);
GETFUNC(ReadScreenTexture);
GETFUNC(GClipRect);
GETFUNC(ClearMipMapCache);
GETFUNC(SetSpecialState);
GETFUNC(GetTextureUsed);
GETFUNC(DrawModel);
GETFUNC(CreateModelVBOs);
GETFUNC(SetTransform);
GETFUNC(PostImgRedraw);
GETFUNC(FlushScreenTextures);
GETFUNC(DoScreenWipe);
GETFUNC(DrawScreenTexture);
GETFUNC(MakeScreenTexture);
GETFUNC(RenderVhsEffect);
GETFUNC(DrawScreenFinalTexture);
GETFUNC(RenderSkyDome);
GETFUNC(InitShaders);
GETFUNC(LoadShader);
GETFUNC(CompileShader);
GETFUNC(SetShader);
GETFUNC(UnSetShader);
GETFUNC(SetShaderInfo);
GETFUNC(SetPaletteLookup);
GETFUNC(CreateLightTable);
GETFUNC(ClearLightTables);
GETFUNC(SetScreenPalette);
#else //HWRENDER
if (0 == strcmp("FinishUpdate", funcName))
return funcPointer; //&FinishUpdate;
#endif //!HWRENDER
if (0) ;
#ifdef STATIC3DS
GETFUNC(Startup);
GETFUNC(AddSfx);
+7 -47
View File
@@ -74,15 +74,17 @@
#include "../i_video.h"
#include "../console.h"
#include "../command.h"
#include "sdlmain.h"
#include "../i_system.h"
#include "../hu_stuff.h" // for chat_on
#include "sdlmain.h"
#ifdef HWRENDER
#include "../hardware/hw_main.h"
#include "../hardware/hw_drv.h"
#include "../hardware/hw_gl.h"
#include "../hardware/r_opengl/r_opengl.h" //for supportFBO
// For dynamic referencing of HW rendering functions
#include "hwsym_sdl.h"
#include "hwsym_sdl.h" // For dynamic referencing of HW rendering functions
#include "ogl_sdl.h"
#endif
@@ -2144,50 +2146,8 @@ void I_StartupGraphics(void)
#ifdef HWRENDER
if (rendermode == render_opengl)
{
HWD.pfnInit = hwSym("Init",NULL);
HWD.pfnSetupGLInfo = hwSym("SetupGLInfo",NULL);
HWD.pfnFinishUpdate = NULL;
HWD.pfnDraw2DLine = hwSym("Draw2DLine",NULL);
HWD.pfnDrawPolygon = hwSym("DrawPolygon",NULL);
HWD.pfnDrawIndexedTriangles = hwSym("DrawIndexedTriangles",NULL);
HWD.pfnSetBlend = hwSym("SetBlend",NULL);
HWD.pfnClearBuffer = hwSym("ClearBuffer",NULL);
HWD.pfnSetTexture = hwSym("SetTexture",NULL);
HWD.pfnUpdateTexture = hwSym("UpdateTexture",NULL);
HWD.pfnDeleteTexture = hwSym("DeleteTexture",NULL);
HWD.pfnReadScreenTexture= hwSym("ReadScreenTexture",NULL);
HWD.pfnGClipRect = hwSym("GClipRect",NULL);
HWD.pfnClearMipMapCache = hwSym("ClearMipMapCache",NULL);
HWD.pfnSetSpecialState = hwSym("SetSpecialState",NULL);
HWD.pfnSetTexturePalette= hwSym("SetTexturePalette",NULL);
HWD.pfnGetTextureUsed = hwSym("GetTextureUsed",NULL);
HWD.pfnDrawModel = hwSym("DrawModel",NULL);
HWD.pfnCreateModelVBOs = hwSym("CreateModelVBOs",NULL);
HWD.pfnSetTransform = hwSym("SetTransform",NULL);
HWD.pfnPostImgRedraw = hwSym("PostImgRedraw",NULL);
HWD.pfnFlushScreenTextures=hwSym("FlushScreenTextures",NULL);
HWD.pfnDoScreenWipe = hwSym("DoScreenWipe",NULL);
HWD.pfnDrawScreenTexture= hwSym("DrawScreenTexture",NULL);
HWD.pfnMakeScreenTexture= hwSym("MakeScreenTexture",NULL);
HWD.pfnRenderVhsEffect = hwSym("RenderVhsEffect",NULL);
HWD.pfnDrawScreenFinalTexture=hwSym("DrawScreenFinalTexture",NULL);
vid.glstate = (VID_LoadOGLAPI() && GL_Init()) ? VID_GL_LIBRARY_LOADED : VID_GL_LIBRARY_ERROR;
HWD.pfnRenderSkyDome = hwSym("RenderSkyDome",NULL);
HWD.pfnInitShaders = hwSym("InitShaders",NULL);
HWD.pfnLoadShader = hwSym("LoadShader",NULL);
HWD.pfnCompileShader = hwSym("CompileShader",NULL);
HWD.pfnSetShader = hwSym("SetShader",NULL);
HWD.pfnUnSetShader = hwSym("UnSetShader",NULL);
HWD.pfnSetShaderInfo = hwSym("SetShaderInfo",NULL);
HWD.pfnSetPaletteLookup = hwSym("SetPaletteLookup",NULL);
HWD.pfnCreateLightTable = hwSym("CreateLightTable",NULL);
HWD.pfnClearLightTables = hwSym("ClearLightTables",NULL);
HWD.pfnSetScreenPalette = hwSym("SetScreenPalette",NULL);
vid.glstate = HWD.pfnInit() ? VID_GL_LIBRARY_LOADED : VID_GL_LIBRARY_ERROR; // let load the OpenGL library
if (vid.glstate == VID_GL_LIBRARY_ERROR)
{
rendermode = render_soft;
@@ -1060,8 +1060,8 @@
8417773A085A106C000C01D8 = {
fileEncoding = 30;
isa = PBXFileReference;
name = hw_drv.h;
path = ../../hardware/hw_drv.h;
name = hw_gl.h;
path = ../../hardware/hw_gl.h;
refType = 2;
};
8417773C085A106C000C01D8 = {
@@ -180,7 +180,7 @@
1E44AE630B67CC2B00BAD059 /* hw3sound.c */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.c; name = hw3sound.c; path = ../../hardware/hw3sound.c; sourceTree = SOURCE_ROOT; };
1E44AE640B67CC2B00BAD059 /* hw_cache.c */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.c; name = hw_cache.c; path = ../../hardware/hw_cache.c; sourceTree = SOURCE_ROOT; };
1E44AE650B67CC2B00BAD059 /* hw_dll.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; name = hw_dll.h; path = ../../hardware/hw_dll.h; sourceTree = SOURCE_ROOT; };
1E44AE660B67CC2B00BAD059 /* hw_drv.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; name = hw_drv.h; path = ../../hardware/hw_drv.h; sourceTree = SOURCE_ROOT; };
1E44AE660B67CC2B00BAD059 /* hw_gl.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; name = hw_gl.h; path = ../../hardware/hw_gl.h; sourceTree = SOURCE_ROOT; };
1E44AE680B67CC2B00BAD059 /* hw_light.c */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.c; name = hw_light.c; path = ../../hardware/hw_light.c; sourceTree = SOURCE_ROOT; };
1E44AE690B67CC2B00BAD059 /* hw_light.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; name = hw_light.h; path = ../../hardware/hw_light.h; sourceTree = SOURCE_ROOT; };
1E44AE6A0B67CC2B00BAD059 /* hw3sound.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; name = hw3sound.h; path = ../../hardware/hw3sound.h; sourceTree = SOURCE_ROOT; };
@@ -533,7 +533,7 @@
1E44AE630B67CC2B00BAD059 /* hw3sound.c */,
1E44AE640B67CC2B00BAD059 /* hw_cache.c */,
1E44AE650B67CC2B00BAD059 /* hw_dll.h */,
1E44AE660B67CC2B00BAD059 /* hw_drv.h */,
1E44AE660B67CC2B00BAD059 /* hw_gl.h */,
1E44AE680B67CC2B00BAD059 /* hw_light.c */,
1E44AE690B67CC2B00BAD059 /* hw_light.h */,
1E44AE6A0B67CC2B00BAD059 /* hw3sound.h */,
+17 -28
View File
@@ -38,12 +38,15 @@
#ifdef HWRENDER
#include "../hardware/r_opengl/r_opengl.h"
#include "../hardware/hw_main.h"
#include "../hardware/hw_gl.h"
#include "ogl_sdl.h"
#include "../i_system.h"
#include "hwsym_sdl.h"
#include "../m_argv.h"
#include "../i_video.h"
#include "../f_finale.h"
#ifdef DEBUG_TO_FILE
#include <stdarg.h>
#if defined (_WIN32) && !defined (__CYGWIN__)
@@ -94,7 +97,7 @@ void *GetGLFunc(const char *proc)
return SDL_GL_GetProcAddress(proc);
}
boolean LoadGL(void)
boolean VID_LoadOGLAPI(void)
{
#ifndef STATIC_OPENGL
const char *OGLLibname = NULL;
@@ -111,7 +114,7 @@ boolean LoadGL(void)
return 0;
}
#endif
return SetupGLfunc();
return true;
}
/** \brief The OglSdlSurface function
@@ -179,7 +182,7 @@ boolean OglSdlSurface(INT32 w, INT32 h)
else
supportMipMap = true;
if (isExtAvailable("GL_EXT_texture_filter_anisotropic", gl_extensions))
if (GL_isExtAvailable("GL_EXT_texture_filter_anisotropic", gl_extensions))
pglGetIntegerv(GL_MAX_TEXTURE_MAX_ANISOTROPY_EXT, &maximumAnisotropy);
else
maximumAnisotropy = 1;
@@ -199,25 +202,25 @@ boolean OglSdlSurface(INT32 w, INT32 h)
// The screen textures need to be flushed if the width or height change so that they be remade for the correct size
if (screen_width != w || screen_height != h)
{
FlushScreenTextures();
GL_FlushScreenTextures();
#ifdef USE_FBO_OGL
GLFramebuffer_DeleteAttachments();
GL_Framebuffer_DeleteAttachments();
#endif
}
screen_width = (GLint)w;
screen_height = (GLint)h;
SetModelView(w, h);
SetStates();
GL_SetModelView(w, h);
GL_SetStates();
pglClear(GL_COLOR_BUFFER_BIT|GL_DEPTH_BUFFER_BIT|GL_STENCIL_BUFFER_BIT);
#ifdef USE_FBO_OGL
if (UseScreenFBO())
GLFramebuffer_Enable();
GL_Framebuffer_Enable();
else
GLFramebuffer_Disable();
GL_Framebuffer_Disable();
#endif
if (!first_init)
@@ -257,22 +260,22 @@ void OglSdlFinishUpdate(boolean waitvbl)
#ifdef USE_FBO_OGL
if (usefbo)
{
GLFramebuffer_Unbind();
GL_Framebuffer_Unbind();
}
#endif
HWR_DrawScreenFinalTexture(sdlw, sdlh, HWR_ShouldUsePaletteRendering());
GL_DrawScreenFinalTexture(HWD_SCREENTEXTURE_GENERIC2, sdlw, sdlh, HWR_ShouldUsePaletteRendering());
#ifdef USE_FBO_OGL
if (usefbo)
{
GLFramebuffer_Enable();
GL_Framebuffer_Enable();
}
#endif
SDL_GL_SwapWindow(window);
GClipRect(0, 0, realwidth, realheight, NZCLIP_PLANE, FAR_ZCLIP_DEFAULT);
GL_GClipRect(0, 0, realwidth, realheight, NZCLIP_PLANE, FAR_ZCLIP_DEFAULT);
// Sryder: We need to draw the final screen texture again into the other buffer in the original position so that
// effects that want to take the old screen can do so after this
@@ -291,19 +294,5 @@ void OglSdlFinishUpdate(boolean waitvbl)
#endif
}
EXPORT void HWRAPI(OglSdlSetPalette) (RGBA_t *palette)
{
INT32 i;
for (i = 0; i < 256; i++)
{
myPaletteData[i].s.red = palette[i].s.red;
myPaletteData[i].s.green = palette[i].s.green;
myPaletteData[i].s.blue = palette[i].s.blue;
myPaletteData[i].s.alpha = palette[i].s.alpha;
}
Flush();
}
#endif //HWRENDER
#endif //SDL
+1 -3
View File
@@ -21,12 +21,10 @@
boolean OglSdlSurface(INT32 w, INT32 h);
void OglSdlFinishUpdate(boolean vidwait);
boolean VID_LoadOGLAPI(void);
extern SDL_Renderer *renderer;
extern SDL_GLContext sdlglcontext;
extern Uint16 realwidth;
extern Uint16 realheight;
#ifdef _CREATE_DLL_
EXPORT void HWRAPI( OglSdlSetPalette ) (RGBA_t *palette);
#endif