mirror of
https://git.do.srb2.org/KartKrew/Kart-Public.git
synced 2024-11-15 01:01:43 +00:00
Merge branch 'gl-qol' into v1.2-frankeinstein
This commit is contained in:
commit
d43ed7f74c
15 changed files with 200 additions and 45 deletions
|
@ -379,6 +379,14 @@ static void HWR_GenerateTexture(INT32 texnum, GLTexture_t *grtex)
|
||||||
grtex->mipmap.height = (UINT16)blockheight;
|
grtex->mipmap.height = (UINT16)blockheight;
|
||||||
grtex->mipmap.grInfo.format = textureformat;
|
grtex->mipmap.grInfo.format = textureformat;
|
||||||
|
|
||||||
|
grtex->mipmap.colormap = colormaps;
|
||||||
|
|
||||||
|
#ifdef GLENCORE
|
||||||
|
if (encoremap)
|
||||||
|
grtex->mipmap.colormap += (256*32);
|
||||||
|
#endif
|
||||||
|
|
||||||
|
|
||||||
block = MakeBlock(&grtex->mipmap);
|
block = MakeBlock(&grtex->mipmap);
|
||||||
|
|
||||||
if (skyspecial) //Hurdler: not efficient, but better than holes in the sky (and it's done only at level loading)
|
if (skyspecial) //Hurdler: not efficient, but better than holes in the sky (and it's done only at level loading)
|
||||||
|
@ -613,6 +621,12 @@ static void HWR_CacheFlat(GLMipmap_t *grMipmap, lumpnum_t flatlumpnum)
|
||||||
{
|
{
|
||||||
size_t size, pflatsize;
|
size_t size, pflatsize;
|
||||||
|
|
||||||
|
#ifdef GLENCORE
|
||||||
|
UINT8 *flat;
|
||||||
|
UINT32 steppy;
|
||||||
|
#endif
|
||||||
|
|
||||||
|
|
||||||
// setup the texture info
|
// setup the texture info
|
||||||
grMipmap->grInfo.smallLodLog2 = GR_LOD_LOG2_64;
|
grMipmap->grInfo.smallLodLog2 = GR_LOD_LOG2_64;
|
||||||
grMipmap->grInfo.largeLodLog2 = GR_LOD_LOG2_64;
|
grMipmap->grInfo.largeLodLog2 = GR_LOD_LOG2_64;
|
||||||
|
@ -652,16 +666,31 @@ static void HWR_CacheFlat(GLMipmap_t *grMipmap, lumpnum_t flatlumpnum)
|
||||||
// the flat raw data needn't be converted with palettized textures
|
// the flat raw data needn't be converted with palettized textures
|
||||||
W_ReadLump(flatlumpnum, Z_Malloc(W_LumpLength(flatlumpnum),
|
W_ReadLump(flatlumpnum, Z_Malloc(W_LumpLength(flatlumpnum),
|
||||||
PU_HWRCACHE, &grMipmap->grInfo.data));
|
PU_HWRCACHE, &grMipmap->grInfo.data));
|
||||||
|
|
||||||
|
#ifdef GLENCORE
|
||||||
|
flat = grMipmap->grInfo.data;
|
||||||
|
for (steppy = 0; steppy < size; steppy++)
|
||||||
|
if (flat[steppy] != HWR_PATCHES_CHROMAKEY_COLORINDEX)
|
||||||
|
flat[steppy] = grMipmap->colormap[flat[steppy]];
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// Download a Doom 'flat' to the hardware cache and make it ready for use
|
// Download a Doom 'flat' to the hardware cache and make it ready for use
|
||||||
void HWR_GetFlat(lumpnum_t flatlumpnum)
|
void HWR_GetFlat(lumpnum_t flatlumpnum, boolean noencoremap)
|
||||||
{
|
{
|
||||||
GLMipmap_t *grmip;
|
GLMipmap_t *grmip;
|
||||||
|
|
||||||
grmip = &HWR_GetCachedGLPatch(flatlumpnum)->mipmap;
|
grmip = &HWR_GetCachedGLPatch(flatlumpnum)->mipmap;
|
||||||
|
|
||||||
|
grmip->colormap = colormaps;
|
||||||
|
|
||||||
|
#ifdef GLENCORE
|
||||||
|
if (!noencoremap && encoremap)
|
||||||
|
grmip->colormap += (256*32);
|
||||||
|
#endif
|
||||||
|
|
||||||
|
|
||||||
if (!grmip->downloaded && !grmip->grInfo.data)
|
if (!grmip->downloaded && !grmip->grInfo.data)
|
||||||
HWR_CacheFlat(grmip, flatlumpnum);
|
HWR_CacheFlat(grmip, flatlumpnum);
|
||||||
|
|
||||||
|
|
|
@ -568,7 +568,7 @@ void HWR_DrawFlatFill (INT32 x, INT32 y, INT32 w, INT32 h, lumpnum_t flatlumpnum
|
||||||
v[0].tow = v[1].tow = (float)((y & flatflag)/dflatsize);
|
v[0].tow = v[1].tow = (float)((y & flatflag)/dflatsize);
|
||||||
v[2].tow = v[3].tow = (float)(v[0].tow + h/dflatsize);
|
v[2].tow = v[3].tow = (float)(v[0].tow + h/dflatsize);
|
||||||
|
|
||||||
HWR_GetFlat(flatlumpnum);
|
HWR_GetFlat(flatlumpnum, false);
|
||||||
|
|
||||||
//Hurdler: Boris, the same comment as above... but maybe for pics
|
//Hurdler: Boris, the same comment as above... but maybe for pics
|
||||||
// it not a problem since they don't have any transparent pixel
|
// it not a problem since they don't have any transparent pixel
|
||||||
|
|
|
@ -100,7 +100,9 @@ void HWR_InitTextureCache(void);
|
||||||
void HWR_FreeTextureCache(void);
|
void HWR_FreeTextureCache(void);
|
||||||
void HWR_FreeExtraSubsectors(void);
|
void HWR_FreeExtraSubsectors(void);
|
||||||
|
|
||||||
void HWR_GetFlat(lumpnum_t flatlumpnum);
|
void HWR_GetFlat(lumpnum_t flatlumpnum, boolean noencore);
|
||||||
|
// ^ some flats must NOT be remapped to encore, since we remap them as we cache them for ease, adding a toggle here seems wise.
|
||||||
|
|
||||||
GLTexture_t *HWR_GetTexture(INT32 tex);
|
GLTexture_t *HWR_GetTexture(INT32 tex);
|
||||||
void HWR_GetPatch(GLPatch_t *gpatch);
|
void HWR_GetPatch(GLPatch_t *gpatch);
|
||||||
void HWR_GetMappedPatch(GLPatch_t *gpatch, const UINT8 *colormap);
|
void HWR_GetMappedPatch(GLPatch_t *gpatch, const UINT8 *colormap);
|
||||||
|
|
|
@ -30,7 +30,7 @@
|
||||||
#include "../p_local.h"
|
#include "../p_local.h"
|
||||||
#include "../p_setup.h"
|
#include "../p_setup.h"
|
||||||
#include "../r_local.h"
|
#include "../r_local.h"
|
||||||
#include "../r_bsp.h"
|
#include "../r_bsp.h" // R_NoEncore
|
||||||
#include "../d_clisrv.h"
|
#include "../d_clisrv.h"
|
||||||
#include "../w_wad.h"
|
#include "../w_wad.h"
|
||||||
#include "../z_zone.h"
|
#include "../z_zone.h"
|
||||||
|
@ -581,7 +581,7 @@ static void HWR_RenderPlane(sector_t *sector, extrasubsector_t *xsub, boolean is
|
||||||
if (nrPlaneVerts < 3) //not even a triangle ?
|
if (nrPlaneVerts < 3) //not even a triangle ?
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if ((UINT32)nrPlaneVerts > UINT16_MAX) // FIXME: exceeds plVerts size
|
if (nrPlaneVerts > INT16_MAX) // FIXME: exceeds plVerts size
|
||||||
{
|
{
|
||||||
CONS_Debug(DBG_RENDER, "polygon size of %d exceeds max value of %d vertices\n", nrPlaneVerts, UINT16_MAX);
|
CONS_Debug(DBG_RENDER, "polygon size of %d exceeds max value of %d vertices\n", nrPlaneVerts, UINT16_MAX);
|
||||||
return;
|
return;
|
||||||
|
@ -3228,7 +3228,7 @@ static void HWR_RenderPolyObjectPlane(polyobj_t *polysector, boolean isceiling,
|
||||||
if (nrPlaneVerts < 3) //not even a triangle ?
|
if (nrPlaneVerts < 3) //not even a triangle ?
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if (nrPlaneVerts > UINT16_MAX) // FIXME: exceeds plVerts size
|
if (nrPlaneVerts > INT16_MAX) // FIXME: exceeds plVerts size
|
||||||
{
|
{
|
||||||
CONS_Debug(DBG_RENDER, "polygon size of %s exceeds max value of %d vertices\n", sizeu1(nrPlaneVerts), UINT16_MAX);
|
CONS_Debug(DBG_RENDER, "polygon size of %s exceeds max value of %d vertices\n", sizeu1(nrPlaneVerts), UINT16_MAX);
|
||||||
return;
|
return;
|
||||||
|
@ -3397,7 +3397,7 @@ static void HWR_AddPolyObjectPlanes(void)
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
HWR_GetFlat(levelflats[polyobjsector->floorpic].lumpnum);
|
HWR_GetFlat(levelflats[polyobjsector->floorpic].lumpnum, R_NoEncore(polyobjsector, false));
|
||||||
HWR_RenderPolyObjectPlane(po_ptrs[i], false, polyobjsector->floorheight, PF_Occlude,
|
HWR_RenderPolyObjectPlane(po_ptrs[i], false, polyobjsector->floorheight, PF_Occlude,
|
||||||
polyobjsector->lightlevel, levelflats[polyobjsector->floorpic].lumpnum,
|
polyobjsector->lightlevel, levelflats[polyobjsector->floorpic].lumpnum,
|
||||||
polyobjsector, 255, NULL);
|
polyobjsector, 255, NULL);
|
||||||
|
@ -3419,7 +3419,7 @@ static void HWR_AddPolyObjectPlanes(void)
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
HWR_GetFlat(levelflats[polyobjsector->ceilingpic].lumpnum);
|
HWR_GetFlat(levelflats[polyobjsector->ceilingpic].lumpnum, R_NoEncore(polyobjsector, false));
|
||||||
HWR_RenderPolyObjectPlane(po_ptrs[i], true, polyobjsector->ceilingheight, PF_Occlude,
|
HWR_RenderPolyObjectPlane(po_ptrs[i], true, polyobjsector->ceilingheight, PF_Occlude,
|
||||||
polyobjsector->lightlevel, levelflats[polyobjsector->floorpic].lumpnum,
|
polyobjsector->lightlevel, levelflats[polyobjsector->floorpic].lumpnum,
|
||||||
polyobjsector, 255, NULL);
|
polyobjsector, 255, NULL);
|
||||||
|
@ -3572,7 +3572,7 @@ static void HWR_Subsector(size_t num)
|
||||||
{
|
{
|
||||||
if (sub->validcount != validcount)
|
if (sub->validcount != validcount)
|
||||||
{
|
{
|
||||||
HWR_GetFlat(levelflats[gr_frontsector->floorpic].lumpnum);
|
HWR_GetFlat(levelflats[gr_frontsector->floorpic].lumpnum, R_NoEncore(gr_frontsector, false));
|
||||||
HWR_RenderPlane(gr_frontsector, &extrasubsectors[num], false,
|
HWR_RenderPlane(gr_frontsector, &extrasubsectors[num], false,
|
||||||
// Hack to make things continue to work around slopes.
|
// Hack to make things continue to work around slopes.
|
||||||
locFloorHeight == cullFloorHeight ? locFloorHeight : gr_frontsector->floorheight,
|
locFloorHeight == cullFloorHeight ? locFloorHeight : gr_frontsector->floorheight,
|
||||||
|
@ -3594,7 +3594,7 @@ static void HWR_Subsector(size_t num)
|
||||||
{
|
{
|
||||||
if (sub->validcount != validcount)
|
if (sub->validcount != validcount)
|
||||||
{
|
{
|
||||||
HWR_GetFlat(levelflats[gr_frontsector->ceilingpic].lumpnum);
|
HWR_GetFlat(levelflats[gr_frontsector->ceilingpic].lumpnum, R_NoEncore(gr_frontsector, false));
|
||||||
HWR_RenderPlane(NULL, &extrasubsectors[num], true,
|
HWR_RenderPlane(NULL, &extrasubsectors[num], true,
|
||||||
// Hack to make things continue to work around slopes.
|
// Hack to make things continue to work around slopes.
|
||||||
locCeilingHeight == cullCeilingHeight ? locCeilingHeight : gr_frontsector->ceilingheight,
|
locCeilingHeight == cullCeilingHeight ? locCeilingHeight : gr_frontsector->ceilingheight,
|
||||||
|
@ -3687,7 +3687,7 @@ static void HWR_Subsector(size_t num)
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
HWR_GetFlat(levelflats[*rover->bottompic].lumpnum);
|
HWR_GetFlat(levelflats[*rover->bottompic].lumpnum, R_NoEncore(gr_frontsector, false));
|
||||||
light = R_GetPlaneLight(gr_frontsector, centerHeight, dup_viewz < cullHeight ? true : false);
|
light = R_GetPlaneLight(gr_frontsector, centerHeight, dup_viewz < cullHeight ? true : false);
|
||||||
HWR_RenderPlane(NULL, &extrasubsectors[num], false, *rover->bottomheight, PF_Occlude, *gr_frontsector->lightlist[light].lightlevel, levelflats[*rover->bottompic].lumpnum,
|
HWR_RenderPlane(NULL, &extrasubsectors[num], false, *rover->bottomheight, PF_Occlude, *gr_frontsector->lightlist[light].lightlevel, levelflats[*rover->bottompic].lumpnum,
|
||||||
rover->master->frontsector, 255, false, gr_frontsector->lightlist[light].extra_colormap);
|
rover->master->frontsector, 255, false, gr_frontsector->lightlist[light].extra_colormap);
|
||||||
|
@ -3751,7 +3751,7 @@ static void HWR_Subsector(size_t num)
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
HWR_GetFlat(levelflats[*rover->toppic].lumpnum);
|
HWR_GetFlat(levelflats[*rover->toppic].lumpnum, R_NoEncore(gr_frontsector, false));
|
||||||
light = R_GetPlaneLight(gr_frontsector, centerHeight, dup_viewz < cullHeight ? true : false);
|
light = R_GetPlaneLight(gr_frontsector, centerHeight, dup_viewz < cullHeight ? true : false);
|
||||||
HWR_RenderPlane(NULL, &extrasubsectors[num], true, *rover->topheight, PF_Occlude, *gr_frontsector->lightlist[light].lightlevel, levelflats[*rover->toppic].lumpnum,
|
HWR_RenderPlane(NULL, &extrasubsectors[num], true, *rover->topheight, PF_Occlude, *gr_frontsector->lightlist[light].lightlevel, levelflats[*rover->toppic].lumpnum,
|
||||||
rover->master->frontsector, 255, false, gr_frontsector->lightlist[light].extra_colormap);
|
rover->master->frontsector, 255, false, gr_frontsector->lightlist[light].extra_colormap);
|
||||||
|
@ -5348,7 +5348,7 @@ static void HWR_CreateDrawNodes(void)
|
||||||
gr_frontsector = NULL;
|
gr_frontsector = NULL;
|
||||||
|
|
||||||
if (!(sortnode[sortindex[i]].plane->blend & PF_NoTexture))
|
if (!(sortnode[sortindex[i]].plane->blend & PF_NoTexture))
|
||||||
HWR_GetFlat(sortnode[sortindex[i]].plane->lumpnum);
|
HWR_GetFlat(sortnode[sortindex[i]].plane->lumpnum, R_NoEncore(sortnode[sortindex[i]].plane->FOFSector, sortnode[sortindex[i]].plane->isceiling));
|
||||||
HWR_RenderPlane(NULL, sortnode[sortindex[i]].plane->xsub, sortnode[sortindex[i]].plane->isceiling, sortnode[sortindex[i]].plane->fixedheight, sortnode[sortindex[i]].plane->blend, sortnode[sortindex[i]].plane->lightlevel,
|
HWR_RenderPlane(NULL, sortnode[sortindex[i]].plane->xsub, sortnode[sortindex[i]].plane->isceiling, sortnode[sortindex[i]].plane->fixedheight, sortnode[sortindex[i]].plane->blend, sortnode[sortindex[i]].plane->lightlevel,
|
||||||
sortnode[sortindex[i]].plane->lumpnum, sortnode[sortindex[i]].plane->FOFSector, sortnode[sortindex[i]].plane->alpha, sortnode[sortindex[i]].plane->fogplane, sortnode[sortindex[i]].plane->planecolormap);
|
sortnode[sortindex[i]].plane->lumpnum, sortnode[sortindex[i]].plane->FOFSector, sortnode[sortindex[i]].plane->alpha, sortnode[sortindex[i]].plane->fogplane, sortnode[sortindex[i]].plane->planecolormap);
|
||||||
}
|
}
|
||||||
|
@ -5358,7 +5358,7 @@ static void HWR_CreateDrawNodes(void)
|
||||||
gr_frontsector = NULL;
|
gr_frontsector = NULL;
|
||||||
|
|
||||||
if (!(sortnode[sortindex[i]].polyplane->blend & PF_NoTexture))
|
if (!(sortnode[sortindex[i]].polyplane->blend & PF_NoTexture))
|
||||||
HWR_GetFlat(sortnode[sortindex[i]].polyplane->lumpnum);
|
HWR_GetFlat(sortnode[sortindex[i]].polyplane->lumpnum, R_NoEncore(sortnode[sortindex[i]].polyplane->FOFSector, sortnode[sortindex[i]].polyplane->isceiling));
|
||||||
HWR_RenderPolyObjectPlane(sortnode[sortindex[i]].polyplane->polysector, sortnode[sortindex[i]].polyplane->isceiling, sortnode[sortindex[i]].polyplane->fixedheight, sortnode[sortindex[i]].polyplane->blend, sortnode[sortindex[i]].polyplane->lightlevel,
|
HWR_RenderPolyObjectPlane(sortnode[sortindex[i]].polyplane->polysector, sortnode[sortindex[i]].polyplane->isceiling, sortnode[sortindex[i]].polyplane->fixedheight, sortnode[sortindex[i]].polyplane->blend, sortnode[sortindex[i]].polyplane->lightlevel,
|
||||||
sortnode[sortindex[i]].polyplane->lumpnum, sortnode[sortindex[i]].polyplane->FOFSector, sortnode[sortindex[i]].polyplane->alpha, sortnode[sortindex[i]].polyplane->planecolormap);
|
sortnode[sortindex[i]].polyplane->lumpnum, sortnode[sortindex[i]].polyplane->FOFSector, sortnode[sortindex[i]].polyplane->alpha, sortnode[sortindex[i]].polyplane->planecolormap);
|
||||||
}
|
}
|
||||||
|
@ -5785,7 +5785,7 @@ static void HWR_ProjectSprite(mobj_t *thing)
|
||||||
{
|
{
|
||||||
vis->colormap = colormaps;
|
vis->colormap = colormaps;
|
||||||
#ifdef GLENCORE
|
#ifdef GLENCORE
|
||||||
if (encoremap && (thing->flags & (MF_SCENERY|MF_NOTHINK)))
|
if (encoremap && (thing->flags & (MF_SCENERY|MF_NOTHINK)) && !(thing->flags & MF_DONTENCOREMAP))
|
||||||
vis->colormap += (256*32);
|
vis->colormap += (256*32);
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
@ -5903,7 +5903,7 @@ static void HWR_ProjectPrecipitationSprite(precipmobj_t *thing)
|
||||||
|
|
||||||
vis->colormap = colormaps;
|
vis->colormap = colormaps;
|
||||||
#ifdef GLENCORE
|
#ifdef GLENCORE
|
||||||
if (encoremap)
|
if (encoremap && !(thing->flags & MF_DONTENCOREMAP))
|
||||||
vis->colormap += (256*32);
|
vis->colormap += (256*32);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
|
@ -17,6 +17,8 @@
|
||||||
/// \file
|
/// \file
|
||||||
/// \brief 3D render mode functions
|
/// \brief 3D render mode functions
|
||||||
|
|
||||||
|
#define GLENCORE
|
||||||
|
|
||||||
#ifndef __HWR_MAIN_H__
|
#ifndef __HWR_MAIN_H__
|
||||||
#define __HWR_MAIN_H__
|
#define __HWR_MAIN_H__
|
||||||
|
|
||||||
|
|
|
@ -19,6 +19,10 @@
|
||||||
#include "v_video.h"
|
#include "v_video.h"
|
||||||
#include "i_video.h"
|
#include "i_video.h"
|
||||||
|
|
||||||
|
#ifdef HWRENDER
|
||||||
|
#include "hardware/hw_main.h"
|
||||||
|
#endif
|
||||||
|
|
||||||
// GIFs are always little-endian
|
// GIFs are always little-endian
|
||||||
#include "byteptr.h"
|
#include "byteptr.h"
|
||||||
|
|
||||||
|
@ -452,6 +456,32 @@ const UINT8 gifframe_gchead[4] = {0x21,0xF9,0x04,0x04}; // GCE, bytes, packed by
|
||||||
static UINT8 *gifframe_data = NULL;
|
static UINT8 *gifframe_data = NULL;
|
||||||
static size_t gifframe_size = 8192;
|
static size_t gifframe_size = 8192;
|
||||||
|
|
||||||
|
#ifdef HWRENDER
|
||||||
|
static void hwrconvert(void)
|
||||||
|
{
|
||||||
|
UINT8 *linear = HWR_GetScreenshot();
|
||||||
|
UINT8 *dest = screens[2];
|
||||||
|
UINT8 r, g, b;
|
||||||
|
INT32 x, y;
|
||||||
|
size_t i = 0;
|
||||||
|
|
||||||
|
InitColorLUT();
|
||||||
|
|
||||||
|
for (y = 0; y < vid.height; y++)
|
||||||
|
{
|
||||||
|
for (x = 0; x < vid.width; x++, i += 3)
|
||||||
|
{
|
||||||
|
r = (UINT8)linear[i];
|
||||||
|
g = (UINT8)linear[i + 1];
|
||||||
|
b = (UINT8)linear[i + 2];
|
||||||
|
dest[(y * vid.width) + x] = colorlookup[r >> SHIFTCOLORBITS][g >> SHIFTCOLORBITS][b >> SHIFTCOLORBITS];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
free(linear);
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
//
|
//
|
||||||
// GIF_framewrite
|
// GIF_framewrite
|
||||||
// writes a frame into the file.
|
// writes a frame into the file.
|
||||||
|
@ -477,7 +507,12 @@ static void GIF_framewrite(void)
|
||||||
GIF_optimizeregion(cur_screen, movie_screen, &blitx, &blity, &blitw, &blith);
|
GIF_optimizeregion(cur_screen, movie_screen, &blitx, &blity, &blitw, &blith);
|
||||||
|
|
||||||
// blit to temp screen
|
// blit to temp screen
|
||||||
I_ReadScreen(movie_screen);
|
if (rendermode == render_soft)
|
||||||
|
I_ReadScreen(movie_screen);
|
||||||
|
#ifdef HWRENDER
|
||||||
|
else if (rendermode == render_opengl)
|
||||||
|
hwrconvert();
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
@ -486,7 +521,18 @@ static void GIF_framewrite(void)
|
||||||
blith = vid.height;
|
blith = vid.height;
|
||||||
|
|
||||||
if (gif_frames == 0)
|
if (gif_frames == 0)
|
||||||
I_ReadScreen(movie_screen);
|
{
|
||||||
|
if (rendermode == render_soft)
|
||||||
|
I_ReadScreen(movie_screen);
|
||||||
|
#ifdef HWRENDER
|
||||||
|
else if (rendermode == render_opengl)
|
||||||
|
{
|
||||||
|
hwrconvert();
|
||||||
|
VID_BlitLinearScreen(screens[2], screens[0], vid.width*vid.bpp, vid.height, vid.width*vid.bpp, vid.rowbytes);
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
|
||||||
movie_screen = screens[0];
|
movie_screen = screens[0];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -575,7 +621,7 @@ static void GIF_framewrite(void)
|
||||||
//
|
//
|
||||||
INT32 GIF_open(const char *filename)
|
INT32 GIF_open(const char *filename)
|
||||||
{
|
{
|
||||||
#ifdef HWRENDER
|
#if 0
|
||||||
if (rendermode != render_soft)
|
if (rendermode != render_soft)
|
||||||
{
|
{
|
||||||
CONS_Alert(CONS_WARNING, M_GetText("GIFs cannot be taken in non-software modes!\n"));
|
CONS_Alert(CONS_WARNING, M_GetText("GIFs cannot be taken in non-software modes!\n"));
|
||||||
|
|
|
@ -1100,12 +1100,8 @@ void M_StartMovie(void)
|
||||||
switch (cv_moviemode.value)
|
switch (cv_moviemode.value)
|
||||||
{
|
{
|
||||||
case MM_GIF:
|
case MM_GIF:
|
||||||
if (rendermode == render_soft)
|
moviemode = M_StartMovieGIF(pathname);
|
||||||
{
|
break;
|
||||||
moviemode = M_StartMovieGIF(pathname);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
/* FALLTHRU */
|
|
||||||
case MM_APNG:
|
case MM_APNG:
|
||||||
moviemode = M_StartMovieAPNG(pathname);
|
moviemode = M_StartMovieAPNG(pathname);
|
||||||
break;
|
break;
|
||||||
|
|
|
@ -1407,11 +1407,12 @@ static inline void P_LoadSideDefs(lumpnum_t lumpnum)
|
||||||
P_LoadRawSideDefs(W_LumpLength(lumpnum));
|
P_LoadRawSideDefs(W_LumpLength(lumpnum));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
static void P_LoadRawSideDefs2(void *data)
|
static void P_LoadRawSideDefs2(void *data)
|
||||||
{
|
{
|
||||||
UINT16 i;
|
UINT16 i;
|
||||||
INT32 num;
|
INT32 num;
|
||||||
|
size_t j;
|
||||||
|
UINT32 cr, cg, cb;
|
||||||
|
|
||||||
for (i = 0; i < numsides; i++)
|
for (i = 0; i < numsides; i++)
|
||||||
{
|
{
|
||||||
|
@ -1490,16 +1491,43 @@ static void P_LoadRawSideDefs2(void *data)
|
||||||
{
|
{
|
||||||
col = msd->toptexture;
|
col = msd->toptexture;
|
||||||
|
|
||||||
sec->extra_colormap->rgba =
|
// encore mode colormaps!
|
||||||
(HEX2INT(col[1]) << 4) + (HEX2INT(col[2]) << 0) +
|
// do it like software by aproximating a color to a palette index, and then convert it to its encore variant and then back to a color code.
|
||||||
(HEX2INT(col[3]) << 12) + (HEX2INT(col[4]) << 8) +
|
// do this for both the start and fade colormaps.
|
||||||
(HEX2INT(col[5]) << 20) + (HEX2INT(col[6]) << 16);
|
|
||||||
|
cr = (HEX2INT(col[1]) << 4) + (HEX2INT(col[2]) << 0);
|
||||||
|
cg = (HEX2INT(col[3]) << 12) + (HEX2INT(col[4]) << 8);
|
||||||
|
cb = (HEX2INT(col[5]) << 20) + (HEX2INT(col[6]) << 16);
|
||||||
|
|
||||||
|
#ifdef GLENCORE
|
||||||
|
if (encoremap)
|
||||||
|
{
|
||||||
|
j = encoremap[NearestColor((UINT8)cr, (UINT8)cg, (UINT8)cb)];
|
||||||
|
//CONS_Printf("R_CreateColormap: encoremap[%d] = %d\n", j, encoremap[j]); -- moved encoremap upwards for optimisation
|
||||||
|
cr = pLocalPalette[j].s.red;
|
||||||
|
cg = pLocalPalette[j].s.green;
|
||||||
|
cb = pLocalPalette[j].s.blue;
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
|
sec->extra_colormap->rgba = cr + cg + cb;
|
||||||
|
|
||||||
// alpha
|
// alpha
|
||||||
if (msd->toptexture[7])
|
if (msd->toptexture[7])
|
||||||
sec->extra_colormap->rgba += (ALPHA2INT(col[7]) << 24);
|
sec->extra_colormap->rgba += (ALPHA2INT(col[7]) << 24);
|
||||||
else
|
else
|
||||||
sec->extra_colormap->rgba += (25 << 24);
|
sec->extra_colormap->rgba += (25 << 24);
|
||||||
|
|
||||||
|
/*nearest = NearestColor(
|
||||||
|
(HEX2INT(col[1]) << 4) + (HEX2INT(col[2]) << 0),
|
||||||
|
(HEX2INT(col[3]) << 4) + (HEX2INT(col[4]) << 0),
|
||||||
|
(HEX2INT(col[5]) << 4) + (HEX2INT(col[6]) << 0)
|
||||||
|
);
|
||||||
|
|
||||||
|
sec->extra_colormap->rgba =
|
||||||
|
pLocalPalette[nearest].s.red +
|
||||||
|
(pLocalPalette[nearest].s.green << 8) +
|
||||||
|
(pLocalPalette[nearest].s.blue << 16);*/
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
sec->extra_colormap->rgba = 0;
|
sec->extra_colormap->rgba = 0;
|
||||||
|
@ -1508,10 +1536,24 @@ static void P_LoadRawSideDefs2(void *data)
|
||||||
{
|
{
|
||||||
col = msd->bottomtexture;
|
col = msd->bottomtexture;
|
||||||
|
|
||||||
sec->extra_colormap->fadergba =
|
// do the exact same thing as above here.
|
||||||
(HEX2INT(col[1]) << 4) + (HEX2INT(col[2]) << 0) +
|
|
||||||
(HEX2INT(col[3]) << 12) + (HEX2INT(col[4]) << 8) +
|
cr = (HEX2INT(col[1]) << 4) + (HEX2INT(col[2]) << 0);
|
||||||
(HEX2INT(col[5]) << 20) + (HEX2INT(col[6]) << 16);
|
cg = (HEX2INT(col[3]) << 12) + (HEX2INT(col[4]) << 8);
|
||||||
|
cb = (HEX2INT(col[5]) << 20) + (HEX2INT(col[6]) << 16);
|
||||||
|
|
||||||
|
#ifdef GLENCORE
|
||||||
|
if (encoremap)
|
||||||
|
{
|
||||||
|
j = encoremap[NearestColor((UINT8)cr, (UINT8)cg, (UINT8)cb)];
|
||||||
|
//CONS_Printf("R_CreateColormap: encoremap[%d] = %d\n", j, encoremap[j]); -- moved encoremap upwards for optimisation
|
||||||
|
cr = pLocalPalette[j].s.red;
|
||||||
|
cg = pLocalPalette[j].s.green;
|
||||||
|
cb = pLocalPalette[j].s.blue;
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
|
sec->extra_colormap->fadergba = cr + cg + cb;
|
||||||
|
|
||||||
// alpha
|
// alpha
|
||||||
if (msd->bottomtexture[7])
|
if (msd->bottomtexture[7])
|
||||||
|
@ -1658,6 +1700,7 @@ static void P_LoadRawSideDefs2(void *data)
|
||||||
R_ClearTextureNumCache(true);
|
R_ClearTextureNumCache(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// Delay loading texture names until after loaded linedefs.
|
// Delay loading texture names until after loaded linedefs.
|
||||||
static void P_LoadSideDefs2(lumpnum_t lumpnum)
|
static void P_LoadSideDefs2(lumpnum_t lumpnum)
|
||||||
{
|
{
|
||||||
|
|
|
@ -37,7 +37,7 @@ drawseg_t *ds_p = NULL;
|
||||||
// indicates doors closed wrt automap bugfix:
|
// indicates doors closed wrt automap bugfix:
|
||||||
INT32 doorclosed;
|
INT32 doorclosed;
|
||||||
|
|
||||||
static boolean R_NoEncore(sector_t *sector, boolean ceiling)
|
boolean R_NoEncore(sector_t *sector, boolean ceiling)
|
||||||
{
|
{
|
||||||
boolean invertencore = (GETSECSPECIAL(sector->special, 2) == 15);
|
boolean invertencore = (GETSECSPECIAL(sector->special, 2) == 15);
|
||||||
#if 0 // perfect implementation
|
#if 0 // perfect implementation
|
||||||
|
|
|
@ -40,6 +40,11 @@ void R_ClearDrawSegs(void);
|
||||||
void R_RenderBSPNode(INT32 bspnum);
|
void R_RenderBSPNode(INT32 bspnum);
|
||||||
void R_AddPortal(INT32 line1, INT32 line2, INT32 x1, INT32 x2);
|
void R_AddPortal(INT32 line1, INT32 line2, INT32 x1, INT32 x2);
|
||||||
|
|
||||||
|
// determines when a given sector shouldn't abide by the encoremap's palette.
|
||||||
|
// no longer a static since this is used for encore in hw_main.c as well now:
|
||||||
|
boolean R_NoEncore(sector_t *sector, boolean ceiling);
|
||||||
|
|
||||||
|
|
||||||
#ifdef POLYOBJECTS
|
#ifdef POLYOBJECTS
|
||||||
void R_SortPolyObjects(subsector_t *sub);
|
void R_SortPolyObjects(subsector_t *sub);
|
||||||
|
|
||||||
|
|
|
@ -1177,7 +1177,7 @@ void R_ClearColormaps(void)
|
||||||
//
|
//
|
||||||
static double deltas[256][3], map[256][3];
|
static double deltas[256][3], map[256][3];
|
||||||
|
|
||||||
static UINT8 NearestColor(UINT8 r, UINT8 g, UINT8 b);
|
UINT8 NearestColor(UINT8 r, UINT8 g, UINT8 b);
|
||||||
static int RoundUp(double number);
|
static int RoundUp(double number);
|
||||||
|
|
||||||
#ifdef HASINVERT
|
#ifdef HASINVERT
|
||||||
|
@ -1403,7 +1403,7 @@ INT32 R_CreateColormap(char *p1, char *p2, char *p3)
|
||||||
|
|
||||||
// Thanks to quake2 source!
|
// Thanks to quake2 source!
|
||||||
// utils3/qdata/images.c
|
// utils3/qdata/images.c
|
||||||
static UINT8 NearestColor(UINT8 r, UINT8 g, UINT8 b)
|
UINT8 NearestColor(UINT8 r, UINT8 g, UINT8 b)
|
||||||
{
|
{
|
||||||
int dr, dg, db;
|
int dr, dg, db;
|
||||||
int distortion, bestdistortion = 256 * 256 * 4, bestcolor = 0, i;
|
int distortion, bestdistortion = 256 * 256 * 4, bestcolor = 0, i;
|
||||||
|
|
|
@ -98,6 +98,8 @@ void R_MakeInvertmap(void);
|
||||||
#endif
|
#endif
|
||||||
const char *R_ColormapNameForNum(INT32 num);
|
const char *R_ColormapNameForNum(INT32 num);
|
||||||
|
|
||||||
|
UINT8 NearestColor(UINT8 r, UINT8 g, UINT8 b);
|
||||||
|
|
||||||
extern INT32 numtextures;
|
extern INT32 numtextures;
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -1641,6 +1641,7 @@ INT32 VID_SetMode(INT32 modeNum)
|
||||||
//Impl_SetWindowName("SRB2Kart "VERSIONSTRING);
|
//Impl_SetWindowName("SRB2Kart "VERSIONSTRING);
|
||||||
|
|
||||||
SDLSetMode(vid.width, vid.height, USE_FULLSCREEN);
|
SDLSetMode(vid.width, vid.height, USE_FULLSCREEN);
|
||||||
|
Impl_VideoSetupBuffer();
|
||||||
|
|
||||||
if (rendermode == render_soft)
|
if (rendermode == render_soft)
|
||||||
{
|
{
|
||||||
|
@ -1649,8 +1650,6 @@ INT32 VID_SetMode(INT32 modeNum)
|
||||||
SDL_FreeSurface(bufSurface);
|
SDL_FreeSurface(bufSurface);
|
||||||
bufSurface = NULL;
|
bufSurface = NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
Impl_VideoSetupBuffer();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return SDL_TRUE;
|
return SDL_TRUE;
|
||||||
|
@ -1773,7 +1772,7 @@ static void Impl_VideoSetupSDLBuffer(void)
|
||||||
static void Impl_VideoSetupBuffer(void)
|
static void Impl_VideoSetupBuffer(void)
|
||||||
{
|
{
|
||||||
// Set up game's software render buffer
|
// Set up game's software render buffer
|
||||||
if (rendermode == render_soft)
|
//if (rendermode == render_soft)
|
||||||
{
|
{
|
||||||
vid.rowbytes = vid.width * vid.bpp;
|
vid.rowbytes = vid.width * vid.bpp;
|
||||||
vid.direct = NULL;
|
vid.direct = NULL;
|
||||||
|
|
|
@ -2593,6 +2593,29 @@ Unoptimized version
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Taken from my videos-in-SRB2 project
|
||||||
|
// Generates a color look-up table
|
||||||
|
// which has up to 64 colors at each channel
|
||||||
|
// (see the defines in v_video.h)
|
||||||
|
|
||||||
|
UINT8 colorlookup[CLUTSIZE][CLUTSIZE][CLUTSIZE];
|
||||||
|
|
||||||
|
void InitColorLUT(void)
|
||||||
|
{
|
||||||
|
UINT8 r, g, b;
|
||||||
|
static boolean clutinit = false;
|
||||||
|
static RGBA_t *lastpalette = NULL;
|
||||||
|
if ((!clutinit) || (lastpalette != pLocalPalette))
|
||||||
|
{
|
||||||
|
for (r = 0; r < CLUTSIZE; r++)
|
||||||
|
for (g = 0; g < CLUTSIZE; g++)
|
||||||
|
for (b = 0; b < CLUTSIZE; b++)
|
||||||
|
colorlookup[r][g][b] = NearestColor(r << SHIFTCOLORBITS, g << SHIFTCOLORBITS, b << SHIFTCOLORBITS);
|
||||||
|
clutinit = true;
|
||||||
|
lastpalette = pLocalPalette;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// V_Init
|
// V_Init
|
||||||
// old software stuff, buffers are allocated at video mode setup
|
// old software stuff, buffers are allocated at video mode setup
|
||||||
// here we set the screens[x] pointers accordingly
|
// here we set the screens[x] pointers accordingly
|
||||||
|
@ -2604,13 +2627,9 @@ void V_Init(void)
|
||||||
const INT32 screensize = vid.rowbytes * vid.height;
|
const INT32 screensize = vid.rowbytes * vid.height;
|
||||||
|
|
||||||
LoadMapPalette();
|
LoadMapPalette();
|
||||||
// hardware modes do not use screens[] pointers
|
|
||||||
for (i = 0; i < NUMSCREENS; i++)
|
for (i = 0; i < NUMSCREENS; i++)
|
||||||
screens[i] = NULL;
|
screens[i] = NULL;
|
||||||
if (rendermode != render_soft)
|
|
||||||
{
|
|
||||||
return; // be sure to cause a NULL read/write error so we detect it, in case of..
|
|
||||||
}
|
|
||||||
|
|
||||||
// start address of NUMSCREENS * width*height vidbuffers
|
// start address of NUMSCREENS * width*height vidbuffers
|
||||||
if (base)
|
if (base)
|
||||||
|
|
|
@ -33,6 +33,18 @@ extern consvar_t cv_ticrate, cv_usegamma, cv_allcaps, cv_constextsize;
|
||||||
// Allocates buffer screens, call before R_Init.
|
// Allocates buffer screens, call before R_Init.
|
||||||
void V_Init(void);
|
void V_Init(void);
|
||||||
|
|
||||||
|
// Taken from my videos-in-SRB2 project
|
||||||
|
// Generates a color look-up table
|
||||||
|
// which has up to 64 colors at each channel
|
||||||
|
|
||||||
|
#define COLORBITS 6
|
||||||
|
#define SHIFTCOLORBITS (8-COLORBITS)
|
||||||
|
#define CLUTSIZE (1<<COLORBITS)
|
||||||
|
|
||||||
|
extern UINT8 colorlookup[CLUTSIZE][CLUTSIZE][CLUTSIZE];
|
||||||
|
|
||||||
|
void InitColorLUT(void);
|
||||||
|
|
||||||
// Set the current RGB palette lookup to use for palettized graphics
|
// Set the current RGB palette lookup to use for palettized graphics
|
||||||
void V_SetPalette(INT32 palettenum);
|
void V_SetPalette(INT32 palettenum);
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue