Merge branch 'awful-mix-httpfixes' into 'awful-mix'

Fix super lol compile errors

See merge request SinnamonLat/Kart-Public!7
This commit is contained in:
wolfs 2020-04-18 23:34:41 -04:00
commit 783a1c78bd
5 changed files with 44 additions and 45 deletions

View file

@ -1307,7 +1307,6 @@ void D_SRB2Main(void)
#ifdef HWRENDER
if (rendermode == render_opengl)
{
INT32 i;
for (i = 0; i < numwadfiles; i++)
HWR_LoadShaders(i, (wadfiles[i]->type == RET_PK3));
}

View file

@ -135,10 +135,10 @@ static void HWR_DrawPatchInCache(GLMipmap_t *mipmap,
//Hurdler: not perfect, but better than holes
if (texel == HWR_PATCHES_CHROMAKEY_COLORINDEX && (mipmap->flags & TF_CHROMAKEYED))
alpha = 0x00;
//texel = HWR_CHROMAKEY_EQUIVALENTCOLORINDEX;
// Lat: Don't do that, some weirdos still use CYAN on their WALLTEXTURES for translucency :V
//Hurdler: 25/04/2000: now support colormap in hardware mode
if (mipmap->colormap)
texel = mipmap->colormap[texel];
@ -307,7 +307,7 @@ static UINT8 *MakeBlock(GLMipmap_t *grMipmap)
// fill background with chromakey, alpha = 0
for (i = 0; i < blocksize; i++)
memcpy(block+i*sizeof(UINT16), &bu16, sizeof(UINT16));
break;
case 4: memset(block, 0x00, blocksize*sizeof(UINT32)); break;
}
@ -351,7 +351,7 @@ static void HWR_GenerateTexture(INT32 texnum, GLTexture_t *grtex)
grtex->mipmap.grInfo.format = textureformat;
grtex->mipmap.colormap = colormaps;
#ifdef GLENCORE
if (encoremap)
grtex->mipmap.colormap += (256*32);
@ -579,7 +579,7 @@ static void HWR_CacheFlat(GLMipmap_t *grMipmap, lumpnum_t flatlumpnum)
{
#ifdef GLENCORE
UINT8 *flat;
INT32 steppy;
size_t steppy;
#endif
size_t size, pflatsize;
@ -639,9 +639,9 @@ void HWR_GetFlat(lumpnum_t flatlumpnum, boolean noencoremap)
GLMipmap_t *grmip;
grmip = HWR_GetCachedGLPatch(flatlumpnum)->mipmap;
grmip->colormap = colormaps;
#ifdef GLENCORE
if (!noencoremap && encoremap)
grmip->colormap += (256*32);

View file

@ -74,7 +74,7 @@ EXPORT void HWRAPI(InitCustomShaders) (void);
EXPORT void HWRAPI(StartBatching) (void);
EXPORT void HWRAPI(RenderBatches) (int *sNumPolys, int *sNumVerts, int *sNumCalls, int *sNumShaders, int *sNumTextures, int *sNumPolyFlags, int *sNumColors, int *sSortTime, int *sDrawTime);
EXPORT void HWRAPI(RenderBatches) (int *sNumPolys, int *sNumVerts, int *sNumCalls, int *sNumShaders, int *sNumTextures, int *sNumPolyFlags, int *sNumColors);
// ==========================================================================
@ -118,7 +118,7 @@ struct hwdriver_s
LoadCustomShader pfnLoadCustomShader;
InitCustomShaders pfnInitCustomShaders;
StartBatching pfnStartBatching;
RenderBatches pfnRenderBatches;
};

View file

@ -142,6 +142,7 @@ void HWR_Lighting(FSurfaceInfo *Surface, INT32 light_level, UINT32 mixcolor, UIN
RGBA_t mix_color, fog_color, final_color;
INT32 mix;
float fog_alpha;
float red, green, blue;
mix_color.rgba = mixcolor;
fog_color.rgba = fadecolor;
@ -177,9 +178,9 @@ void HWR_Lighting(FSurfaceInfo *Surface, INT32 light_level, UINT32 mixcolor, UIN
if (fog < 0)
fog = 0;
float red = ((fog_color.s.red/255.0f) * fog) + ((final_color.s.red/255.0f) * (1.0f - fog));
float green = ((fog_color.s.green/255.0f) * fog) + ((final_color.s.green/255.0f) * (1.0f - fog));
float blue = ((fog_color.s.blue/255.0f) * fog) + ((final_color.s.blue/255.0f) * (1.0f - fog));
red = ((fog_color.s.red/255.0f) * fog) + ((final_color.s.red/255.0f) * (1.0f - fog));
green = ((fog_color.s.green/255.0f) * fog) + ((final_color.s.green/255.0f) * (1.0f - fog));
blue = ((fog_color.s.blue/255.0f) * fog) + ((final_color.s.blue/255.0f) * (1.0f - fog));
final_color.s.red = (UINT8)(red*255.0f);
final_color.s.green = (UINT8)(green*255.0f);
final_color.s.blue = (UINT8)(blue*255.0f);
@ -1873,7 +1874,7 @@ void HWR_ProcessSeg(void) // Sort of like GLWall::Process in GZDoom
boolean checkforemptylines = true;
// Don't modify anything here, just check
// Kalaron: Modified for sloped linedefs
static boolean CheckClip(seg_t * seg, sector_t * afrontsector, sector_t * abacksector)
static boolean CheckClip(sector_t * afrontsector, sector_t * abacksector)
{
fixed_t frontf1,frontf2, frontc1, frontc2; // front floor/ceiling ends
fixed_t backf1, backf2, backc1, backc2; // back floor ceiling ends
@ -2008,7 +2009,7 @@ void HWR_AddLine(seg_t *line)
else
{
gr_backsector = R_FakeFlat(gr_backsector, &tempsec, NULL, NULL, true);
if (CheckClip(line, gr_frontsector, gr_backsector))
if (CheckClip(gr_frontsector, gr_backsector))
{
gld_clipper_SafeAddClipRange(angle2, angle1);
checkforemptylines = false;
@ -3102,7 +3103,6 @@ static void HWR_SplitSprite(gr_vissprite_t *spr)
{
float sprdist = sqrtf((spr->x1 - gr_viewx)*(spr->x1 - gr_viewx) + (spr->z1 - gr_viewy)*(spr->z1 - gr_viewy) + (spr->ty - gr_viewz)*(spr->ty - gr_viewz));
float distfact = ((2.0f*spr->dispoffset) + 20.0f) / sprdist;
size_t i;
for (i = 0; i < 4; i++)
{
baseWallVerts[i].x += (gr_viewx - baseWallVerts[i].x)*distfact;
@ -4808,12 +4808,12 @@ void HWR_RenderFrame(INT32 viewnumber, player_t *player, boolean skybox)
// Recursively "render" the BSP tree.
HWR_RenderBSPNode((INT32)numnodes-1);
if (cv_grbatching.value)
{
int dummy = 0;// the vars in RenderBatches are meant for render stats. But we don't have that stuff in this branch
// so that stuff could be removed...
HWD.pfnRenderBatches(&dummy, &dummy, &dummy, &dummy, &dummy, &dummy, &dummy, &dummy, &dummy);
HWD.pfnRenderBatches(&dummy, &dummy, &dummy, &dummy, &dummy, &dummy, &dummy);
}
// Check for new console commands.
@ -4907,7 +4907,7 @@ void HWR_AddCommands(void)
CV_RegisterVar(&cv_granisotropicmode);
CV_RegisterVar(&cv_grcorrecttricks);
CV_RegisterVar(&cv_grsolvetjoin);
CV_RegisterVar(&cv_grbatching);
}

View file

@ -1719,7 +1719,7 @@ static void load_shaders(FSurfaceInfo *Surface, GLRGBAFloat *mix, GLRGBAFloat *f
// Note: could use realloc in the array reallocation code
typedef struct
typedef struct
{
FSurfaceInfo surf;// surf also has its own polyflags for some reason, but it seems unused
unsigned int vertsIndex;// location of verts in unsortedVertexArray
@ -1770,7 +1770,7 @@ static int comparePolygons(const void *p1, const void *p2)
PolygonArrayEntry* poly2 = &polygonArray[*(const unsigned int*)p2];
int diff;
INT64 diff64;
int shader1 = poly1->shader;
int shader2 = poly2->shader;
// make skywalls first in order
@ -1780,18 +1780,18 @@ static int comparePolygons(const void *p1, const void *p2)
shader2 = -1;
diff = shader1 - shader2;
if (diff != 0) return diff;
diff = poly1->texNum - poly2->texNum;
if (diff != 0) return diff;
diff = poly1->polyFlags - poly2->polyFlags;
if (diff != 0) return diff;
diff64 = poly1->surf.PolyColor.rgba - poly2->surf.PolyColor.rgba;
if (diff64 < 0) return -1; else if (diff64 > 0) return 1;
diff64 = poly1->surf.FadeColor.rgba - poly2->surf.FadeColor.rgba;
if (diff64 < 0) return -1; else if (diff64 > 0) return 1;
diff = poly1->surf.LightInfo.light_level - poly2->surf.LightInfo.light_level;
return diff;
}
@ -1802,7 +1802,7 @@ static int comparePolygonsNoShaders(const void *p1, const void *p2)
PolygonArrayEntry* poly2 = &polygonArray[*(const unsigned int*)p2];
int diff;
INT64 diff64;
GLuint texNum1 = poly1->texNum;
GLuint texNum2 = poly2->texNum;
if (poly1->polyFlags & PF_NoTexture)
@ -1811,10 +1811,10 @@ static int comparePolygonsNoShaders(const void *p1, const void *p2)
texNum2 = 0;
diff = texNum1 - texNum2;
if (diff != 0) return diff;
diff = poly1->polyFlags - poly2->polyFlags;
if (diff != 0) return diff;
diff64 = poly1->surf.PolyColor.rgba - poly2->surf.PolyColor.rgba;
if (diff64 < 0) return -1; else if (diff64 > 0) return 1;
@ -1822,7 +1822,7 @@ static int comparePolygonsNoShaders(const void *p1, const void *p2)
}
// the parameters for this functions (numPolys etc.) are used to return rendering stats
EXPORT void HWRAPI(RenderBatches) (int *sNumPolys, int *sNumVerts, int *sNumCalls, int *sNumShaders, int *sNumTextures, int *sNumPolyFlags, int *sNumColors, int *sSortTime, int *sDrawTime)
EXPORT void HWRAPI(RenderBatches) (int *sNumPolys, int *sNumVerts, int *sNumCalls, int *sNumShaders, int *sNumTextures, int *sNumPolyFlags, int *sNumColors)
{
int finalVertexWritePos = 0;// position in finalVertexArray
int finalIndexWritePos = 0;// position in finalVertexIndexArray
@ -1882,7 +1882,7 @@ EXPORT void HWRAPI(RenderBatches) (int *sNumPolys, int *sNumVerts, int *sNumCall
currentSurfaceInfo = polygonArray[polygonIndexArray[0]].surf;
// For now, will sort and track the colors. Vertex attributes could be used instead of uniforms
// and a color array could replace the color calls.
// set state for first batch
//CONS_Printf("set first state\n");
gl_currentshaderprogram = currentShader;
@ -1901,21 +1901,21 @@ EXPORT void HWRAPI(RenderBatches) (int *sNumPolys, int *sNumVerts, int *sNumCall
firstFade.green = byte2float[currentSurfaceInfo.FadeColor.s.green];
firstFade.blue = byte2float[currentSurfaceInfo.FadeColor.s.blue];
firstFade.alpha = byte2float[currentSurfaceInfo.FadeColor.s.alpha];
if (gl_allowshaders)
load_shaders(&currentSurfaceInfo, &firstPoly, &firstFade);
if (currentPolyFlags & PF_NoTexture)
currentTexture = 0;
pglBindTexture(GL_TEXTURE_2D, currentTexture);
tex_downloaded = currentTexture;
SetBlend(currentPolyFlags);
//CONS_Printf("first pointers to ogl\n");
pglVertexPointer(3, GL_FLOAT, sizeof(FOutVector), &finalVertexArray[0].x);
pglTexCoordPointer(2, GL_FLOAT, sizeof(FOutVector), &finalVertexArray[0].s);
while (1)// note: remember handling notexture polyflag as having texture number 0 (also in comparePolygons)
{
int firstIndex;
@ -1943,7 +1943,7 @@ EXPORT void HWRAPI(RenderBatches) (int *sNumPolys, int *sNumVerts, int *sNumCall
// change states according to next vars and change bools, updating the current vars and reseting the bools
// reset write pos
// repeat loop
int index = polygonIndexArray[polygonReadPos++];
int numVerts = polygonArray[index].numVerts;
// before writing, check if there is enough room
@ -1983,7 +1983,7 @@ EXPORT void HWRAPI(RenderBatches) (int *sNumPolys, int *sNumVerts, int *sNumCall
finalVertexIndexArray[finalIndexWritePos++] = finalVertexWritePos - 1;
finalVertexIndexArray[finalIndexWritePos++] = finalVertexWritePos++;
}
if (polygonReadPos >= polygonArraySize)
{
stopFlag = true;
@ -2033,7 +2033,7 @@ EXPORT void HWRAPI(RenderBatches) (int *sNumPolys, int *sNumVerts, int *sNumCall
}
}
}
if (changeState || stopFlag)
{
if (needRebind)
@ -2055,12 +2055,12 @@ EXPORT void HWRAPI(RenderBatches) (int *sNumPolys, int *sNumVerts, int *sNumCall
finalIndexWritePos = 0;
}
else continue;
// if we're here then either its time to stop or time to change state
if (stopFlag) break;
//CONS_Printf("state change\n");
// change state according to change bools and next vars, update current vars and reset bools
if (changeShader)
{
@ -2081,7 +2081,7 @@ EXPORT void HWRAPI(RenderBatches) (int *sNumPolys, int *sNumVerts, int *sNumCall
fade.green = byte2float[nextSurfaceInfo.FadeColor.s.green];
fade.blue = byte2float[nextSurfaceInfo.FadeColor.s.blue];
fade.alpha = byte2float[nextSurfaceInfo.FadeColor.s.alpha];
load_shaders(&nextSurfaceInfo, &poly, &fade);
currentShader = nextShader;
changeShader = false;
@ -2127,7 +2127,7 @@ EXPORT void HWRAPI(RenderBatches) (int *sNumPolys, int *sNumVerts, int *sNumCall
fade.green = byte2float[nextSurfaceInfo.FadeColor.s.green];
fade.blue = byte2float[nextSurfaceInfo.FadeColor.s.blue];
fade.alpha = byte2float[nextSurfaceInfo.FadeColor.s.alpha];
load_shaders(&nextSurfaceInfo, &poly, &fade);
}
currentSurfaceInfo = nextSurfaceInfo;
@ -2140,7 +2140,7 @@ EXPORT void HWRAPI(RenderBatches) (int *sNumPolys, int *sNumVerts, int *sNumCall
// reset the arrays (set sizes to 0)
polygonArraySize = 0;
unsortedVertexArraySize = 0;
//*sDrawTime = I_GetTimeMicros() - *sDrawTime;
}
@ -2177,7 +2177,7 @@ EXPORT void HWRAPI(DrawPolygon) (FSurfaceInfo *pSurf, FOutVector *pOutVerts, FUI
memcpy(new_array, unsortedVertexArray, unsortedVertexArraySize * sizeof(FOutVector));
free(unsortedVertexArray);
unsortedVertexArray = new_array;
}
}
// add the polygon data to the arrays