Merge branch 'Saturn-Next' into newpalshader
This commit is contained in:
commit
1b7870e905
15 files changed
+110
-128
No files matched your search
+1
-1
@@ -141,7 +141,7 @@ DECL_HUD_OFFSET(item); // Item box
|
||||
DECL_HUD_OFFSET(time); // Time
|
||||
DECL_HUD_OFFSET(laps); // Number of laps
|
||||
DECL_HUD_OFFSET(dnft); // Countdown (did not finish timer)
|
||||
DECL_HUD_OFFSET(spdm); // Speedometer
|
||||
DECL_HUD_OFFSET(speed); // Speedometer
|
||||
DECL_HUD_OFFSET(posi); // Position in race
|
||||
DECL_HUD_OFFSET(face); // Mini rankings
|
||||
DECL_HUD_OFFSET(stcd); // Starting countdown
|
||||
|
||||
@@ -1079,10 +1079,9 @@ void HWR_DrawFill(INT32 x, INT32 y, INT32 w, INT32 h, INT32 color)
|
||||
else if (alphalevel == 14) Surf.PolyColor.s.alpha = softwaretranstogl[hudtrans];
|
||||
else if (alphalevel == 15) Surf.PolyColor.s.alpha = softwaretranstogl_hi[hudtrans];
|
||||
else Surf.PolyColor.s.alpha = softwaretranstogl[10-alphalevel];
|
||||
HWD.pfnDrawPolygon(&Surf, v, 4, PF_NoTexture|PF_Modulated|PF_Translucent|PF_NoDepthTest, false);
|
||||
}
|
||||
else
|
||||
HWD.pfnDrawPolygon(&Surf, v, 4, PF_Modulated|PF_NoTexture|PF_NoDepthTest, false);
|
||||
|
||||
HWD.pfnDrawPolygon(&Surf, v, 4, PF_NoTexture|PF_Modulated|PF_Translucent|PF_NoDepthTest, false);
|
||||
}
|
||||
|
||||
#ifdef HAVE_PNG
|
||||
|
||||
+20
-9
@@ -123,7 +123,6 @@ consvar_t cv_secbright = {"secbright", "0", CV_SAVE, secbright_cons_t,
|
||||
|
||||
consvar_t cv_grfovchange = {"gr_fovchange", "Off", CV_SAVE, CV_OnOff, NULL, 0, NULL, NULL, 0, 0, NULL};
|
||||
|
||||
consvar_t cv_grvhseffect = {"gr_vhseffect", "Off", CV_SAVE, CV_OnOff, NULL, 0, NULL, NULL, 0, 0, NULL};
|
||||
|
||||
// values for the far clipping plane
|
||||
static float clipping_distances[] = {1024.0f, 2048.0f, 4096.0f, 6144.0f, 8192.0f, 12288.0f, 16384.0f};
|
||||
@@ -2859,8 +2858,8 @@ void HWR_AddLine(seg_t *line)
|
||||
}
|
||||
|
||||
// OPTIMIZE: quickly reject orthogonal back sides.
|
||||
angle1 = R_PointToAngleEx64(viewx, viewy, v1x, v1y);
|
||||
angle2 = R_PointToAngleEx64(viewx, viewy, v2x, v2y);
|
||||
angle1 = R_PointToAngle64(v1x, v1y);
|
||||
angle2 = R_PointToAngle64(v2x, v2y);
|
||||
|
||||
// do an extra culling check when rendering portals
|
||||
// check if any line vertex is on the viewable side of the portal target line
|
||||
@@ -3053,8 +3052,8 @@ boolean HWR_CheckBBox(fixed_t *bspcoord)
|
||||
if (mindist > current_bsp_culling_distance) return false;
|
||||
}
|
||||
|
||||
angle1 = R_PointToAngleEx64(viewx, viewy, px1, py1);
|
||||
angle2 = R_PointToAngleEx64(viewx, viewy, px2, py2);
|
||||
angle1 = R_PointToAngle64(px1, py1);
|
||||
angle2 = R_PointToAngle64(px2, py2);
|
||||
return gld_clipper_SafeCheckRange(angle2, angle1);
|
||||
}
|
||||
|
||||
@@ -5913,8 +5912,8 @@ static void HWR_PortalClipping(gl_portal_t *portal)
|
||||
|
||||
line_t *line = &lines[portal->clipline];
|
||||
|
||||
angle1 = R_PointToAngleEx64(viewx, viewy, line->v1->x, line->v1->y);
|
||||
angle2 = R_PointToAngleEx64(viewx, viewy, line->v2->x, line->v2->y);
|
||||
angle1 = R_PointToAngleEx(viewx, viewy, line->v1->x, line->v1->y);
|
||||
angle2 = R_PointToAngleEx(viewx, viewy, line->v2->x, line->v2->y);
|
||||
|
||||
// clip things that are not inside the portal window from our viewpoint
|
||||
gld_clipper_SafeAddClipRange(angle2, angle1);
|
||||
@@ -6144,6 +6143,20 @@ void HWR_RenderFrame(INT32 viewnumber, player_t *player, boolean skybox)
|
||||
gr_windowcenterx += gr_viewwidth;
|
||||
}
|
||||
|
||||
if (splitscreen == 2 && player == &players[displayplayers[2]])
|
||||
{
|
||||
// V_DrawPatchFill, but for the fourth screen only
|
||||
GLPatch_t *gpatch = W_CachePatchName("SRB2BACK", PU_CACHE);
|
||||
INT32 dupz = (vid.dupx < vid.dupy ? vid.dupx : vid.dupy);
|
||||
INT32 x, y, pw = SHORT(gpatch->width) * dupz, ph = SHORT(gpatch->height) * dupz;
|
||||
|
||||
for (x = vid.width>>1; x < vid.width; x += pw)
|
||||
{
|
||||
for (y = vid.height>>1; y < vid.height; y += ph)
|
||||
HWR_DrawStretchyFixedPatch(gpatch, (x)<<FRACBITS, (y)<<FRACBITS, FRACUNIT, FRACUNIT, V_NOSCALESTART, NULL);
|
||||
}
|
||||
}
|
||||
|
||||
// check for new console commands.
|
||||
NetUpdate();
|
||||
|
||||
@@ -6385,8 +6398,6 @@ void HWR_AddCommands(void)
|
||||
CV_RegisterVar(&cv_grpaletterendering);
|
||||
CV_RegisterVar(&cv_grpalettedepth);
|
||||
CV_RegisterVar(&cv_grflashpal);
|
||||
|
||||
CV_RegisterVar(&cv_grvhseffect);
|
||||
}
|
||||
|
||||
// --------------------------------------------------------------------------
|
||||
|
||||
@@ -195,7 +195,6 @@ extern consvar_t cv_grscreentextures;
|
||||
extern consvar_t cv_grportals;
|
||||
extern consvar_t cv_nostencil;
|
||||
extern consvar_t cv_secbright;
|
||||
extern consvar_t cv_grvhseffect;
|
||||
|
||||
extern CV_PossibleValue_t granisotropicmode_cons_t[];
|
||||
|
||||
|
||||
@@ -2210,7 +2210,7 @@ int finalVertexArrayAllocSize = 65536;
|
||||
|
||||
PolygonArrayEntry* polygonArray = NULL;// contains the polygon data from DrawPolygon, waiting to be processed
|
||||
int polygonArraySize = 0;
|
||||
PolygonArrayEntry **polygonArraySorted = NULL;// contains sorted pointers to polygonArray
|
||||
UINT32* polygonIndexArray = NULL;// contains sorting pointers for polygonArray
|
||||
int polygonArrayAllocSize = 65536;
|
||||
|
||||
FOutVector* unsortedVertexArray = NULL;// contains unsorted vertices and texture coordinates from DrawPolygon
|
||||
@@ -2226,7 +2226,7 @@ EXPORT void HWRAPI(StartBatching) (void)
|
||||
finalVertexArray = malloc(finalVertexArrayAllocSize * sizeof(FOutVector));
|
||||
finalVertexIndexArray = malloc(finalVertexArrayAllocSize * 3 * sizeof(UINT32));
|
||||
polygonArray = malloc(polygonArrayAllocSize * sizeof(PolygonArrayEntry));
|
||||
polygonArraySorted = malloc(polygonArrayAllocSize * sizeof(PolygonArrayEntry *));
|
||||
polygonIndexArray = malloc(polygonArrayAllocSize * sizeof(UINT32));
|
||||
unsortedVertexArray = malloc(unsortedVertexArrayAllocSize * sizeof(FOutVector));
|
||||
}
|
||||
// drawing functions will now collect the drawing data instead of passing it to opengl
|
||||
@@ -2236,8 +2236,10 @@ EXPORT void HWRAPI(StartBatching) (void)
|
||||
|
||||
static int comparePolygons(const void *p1, const void *p2)
|
||||
{
|
||||
PolygonArrayEntry *poly1 = *(PolygonArrayEntry *const *)p1;
|
||||
PolygonArrayEntry *poly2 = *(PolygonArrayEntry *const *)p2;
|
||||
unsigned int index1 = *(const unsigned int*)p1;
|
||||
unsigned int index2 = *(const unsigned int*)p2;
|
||||
PolygonArrayEntry* poly1 = &polygonArray[index1];
|
||||
PolygonArrayEntry* poly2 = &polygonArray[index2];
|
||||
int diff;
|
||||
INT64 diff64;
|
||||
|
||||
@@ -2253,7 +2255,7 @@ static int comparePolygons(const void *p1, const void *p2)
|
||||
|
||||
// skywalls and horizon lines must retain their order for horizon lines to work
|
||||
if (shader1 == -1 && shader2 == -1)
|
||||
return poly1 - poly2;
|
||||
return index1 - index2;
|
||||
|
||||
diff = poly1->texNum - poly2->texNum;
|
||||
if (diff != 0) return diff;
|
||||
@@ -2284,8 +2286,10 @@ static int comparePolygons(const void *p1, const void *p2)
|
||||
|
||||
static int comparePolygonsNoShaders(const void *p1, const void *p2)
|
||||
{
|
||||
PolygonArrayEntry *poly1 = *(PolygonArrayEntry *const *)p1;
|
||||
PolygonArrayEntry *poly2 = *(PolygonArrayEntry *const *)p2;
|
||||
unsigned int index1 = *(const unsigned int*)p1;
|
||||
unsigned int index2 = *(const unsigned int*)p2;
|
||||
PolygonArrayEntry* poly1 = &polygonArray[index1];
|
||||
PolygonArrayEntry* poly2 = &polygonArray[index2];
|
||||
int diff;
|
||||
INT64 diff64;
|
||||
|
||||
@@ -2300,7 +2304,7 @@ static int comparePolygonsNoShaders(const void *p1, const void *p2)
|
||||
|
||||
// skywalls and horizon lines must retain their order for horizon lines to work
|
||||
if (texNum1 == 0 && texNum2 == 0)
|
||||
return poly1 - poly2;
|
||||
return index1 - index2;
|
||||
|
||||
diff = poly1->polyFlags - poly2->polyFlags;
|
||||
if (diff != 0) return diff;
|
||||
@@ -2317,7 +2321,7 @@ EXPORT void HWRAPI(RenderBatches) (precise_t *sSortTime, precise_t *sDrawTime, i
|
||||
int finalVertexWritePos = 0;// position in finalVertexArray
|
||||
int finalIndexWritePos = 0;// position in finalVertexIndexArray
|
||||
|
||||
int polygonReadPos = 0;// position in polygonArraySorted
|
||||
int polygonReadPos = 0;// position in polygonIndexArray
|
||||
|
||||
GLuint currentShader;
|
||||
GLuint currentTexture;
|
||||
@@ -2343,19 +2347,19 @@ EXPORT void HWRAPI(RenderBatches) (precise_t *sSortTime, precise_t *sDrawTime, i
|
||||
*sNumPolys = polygonArraySize;
|
||||
*sNumCalls = *sNumVerts = 0;
|
||||
*sNumShaders = *sNumTextures = *sNumPolyFlags = *sNumColors = 1;
|
||||
// init polygonArraySorted
|
||||
// init polygonIndexArray
|
||||
for (i = 0; i < polygonArraySize; i++)
|
||||
{
|
||||
polygonArraySorted[i] = &polygonArray[i];
|
||||
polygonIndexArray[i] = i;
|
||||
}
|
||||
|
||||
// sort polygons
|
||||
//CONS_Printf("qsort polys\n");
|
||||
*sSortTime = I_GetPreciseTime();
|
||||
if (gl_allowshaders)
|
||||
qsort(polygonArraySorted, polygonArraySize, sizeof(PolygonArrayEntry *), comparePolygons);
|
||||
qsort(polygonIndexArray, polygonArraySize, sizeof(unsigned int), comparePolygons);
|
||||
else
|
||||
qsort(polygonArraySorted, polygonArraySize, sizeof(PolygonArrayEntry *), comparePolygonsNoShaders);
|
||||
qsort(polygonIndexArray, polygonArraySize, sizeof(unsigned int), comparePolygonsNoShaders);
|
||||
*sSortTime = I_GetPreciseTime() - *sSortTime;
|
||||
//CONS_Printf("sort done\n");
|
||||
// sort order
|
||||
@@ -2367,10 +2371,10 @@ EXPORT void HWRAPI(RenderBatches) (precise_t *sSortTime, precise_t *sDrawTime, i
|
||||
|
||||
*sDrawTime = I_GetPreciseTime();
|
||||
|
||||
currentShader = polygonArraySorted[0]->shader;
|
||||
currentTexture = polygonArraySorted[0]->texNum;
|
||||
currentPolyFlags = polygonArraySorted[0]->polyFlags;
|
||||
currentSurfaceInfo = polygonArraySorted[0]->surf;
|
||||
currentShader = polygonArray[polygonIndexArray[0]].shader;
|
||||
currentTexture = polygonArray[polygonIndexArray[0]].texNum;
|
||||
currentPolyFlags = polygonArray[polygonIndexArray[0]].polyFlags;
|
||||
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.
|
||||
|
||||
@@ -2451,8 +2455,8 @@ EXPORT void HWRAPI(RenderBatches) (precise_t *sSortTime, precise_t *sDrawTime, i
|
||||
// reset write pos
|
||||
// repeat loop
|
||||
|
||||
PolygonArrayEntry *entry = polygonArraySorted[polygonReadPos++];
|
||||
int numVerts = entry->numVerts;
|
||||
int index = polygonIndexArray[polygonReadPos++];
|
||||
int numVerts = polygonArray[index].numVerts;
|
||||
// before writing, check if there is enough room
|
||||
// using 'while' instead of 'if' here makes sure that there will *always* be enough room.
|
||||
// probably never will this loop run more than once though
|
||||
@@ -2477,7 +2481,7 @@ EXPORT void HWRAPI(RenderBatches) (precise_t *sSortTime, precise_t *sDrawTime, i
|
||||
}
|
||||
//CONS_Printf("write verts to final\n");
|
||||
// write the vertices of the polygon
|
||||
memcpy(&finalVertexArray[finalVertexWritePos], &unsortedVertexArray[entry->vertsIndex],
|
||||
memcpy(&finalVertexArray[finalVertexWritePos], &unsortedVertexArray[polygonArray[index].vertsIndex],
|
||||
numVerts * sizeof(FOutVector));
|
||||
// write the indexes, pointing to the fan vertexes but in triangles format
|
||||
firstIndex = finalVertexWritePos;
|
||||
@@ -2499,11 +2503,11 @@ EXPORT void HWRAPI(RenderBatches) (precise_t *sSortTime, precise_t *sDrawTime, i
|
||||
{
|
||||
//CONS_Printf("state change check\n");
|
||||
// check if a state change is required, set the change bools and next vars
|
||||
PolygonArrayEntry *nextEntry = polygonArraySorted[polygonReadPos];
|
||||
nextShader = nextEntry->shader;
|
||||
nextTexture = nextEntry->texNum;
|
||||
nextPolyFlags = nextEntry->polyFlags;
|
||||
nextSurfaceInfo = nextEntry->surf;
|
||||
int nextIndex = polygonIndexArray[polygonReadPos];
|
||||
nextShader = polygonArray[nextIndex].shader;
|
||||
nextTexture = polygonArray[nextIndex].texNum;
|
||||
nextPolyFlags = polygonArray[nextIndex].polyFlags;
|
||||
nextSurfaceInfo = polygonArray[nextIndex].surf;
|
||||
if (nextPolyFlags & PF_NoTexture)
|
||||
nextTexture = 0;
|
||||
if (currentShader != nextShader)
|
||||
@@ -2711,8 +2715,8 @@ EXPORT void HWRAPI(DrawPolygon) (FSurfaceInfo *pSurf, FOutVector *pOutVerts, FUI
|
||||
free(polygonArray);
|
||||
polygonArray = new_array;
|
||||
// also need to redo the index array, dont need to copy it though
|
||||
free(polygonArraySorted);
|
||||
polygonArraySorted = malloc(polygonArrayAllocSize * sizeof(PolygonArrayEntry *));
|
||||
free(polygonIndexArray);
|
||||
polygonIndexArray = malloc(polygonArrayAllocSize * sizeof(unsigned int));
|
||||
}
|
||||
|
||||
while (unsortedVertexArraySize + (int)iNumPts > unsortedVertexArrayAllocSize)
|
||||
|
||||
+4
-4
@@ -40,7 +40,7 @@ IMPL_HUD_OFFSET(item); // Item box
|
||||
IMPL_HUD_OFFSET(time); // Time
|
||||
IMPL_HUD_OFFSET(laps); // Number of laps
|
||||
IMPL_HUD_OFFSET(dnft); // Countdown (did not finish timer)
|
||||
IMPL_HUD_OFFSET(spdm); // Speedometer
|
||||
IMPL_HUD_OFFSET(speed); // Speedometer
|
||||
IMPL_HUD_OFFSET(posi); // Position in race
|
||||
IMPL_HUD_OFFSET(face); // Mini rankings
|
||||
IMPL_HUD_OFFSET(stcd); // Starting countdown
|
||||
@@ -685,7 +685,7 @@ void K_RegisterKartStuff(void)
|
||||
REG_HUD_OFFSET(time); // Time
|
||||
REG_HUD_OFFSET(laps); // Number of laps
|
||||
REG_HUD_OFFSET(dnft); // Countdown (did not finish timer)
|
||||
REG_HUD_OFFSET(spdm); // Speedometer
|
||||
REG_HUD_OFFSET(speed); // Speedometer
|
||||
REG_HUD_OFFSET(posi); // Position in race
|
||||
REG_HUD_OFFSET(face); // Mini rankings
|
||||
REG_HUD_OFFSET(stcd); // Starting countdown
|
||||
@@ -7451,8 +7451,8 @@ static void K_initKartHUD(void)
|
||||
LAPS_X = 9 + cv_laps_xoffset.value; // 9
|
||||
LAPS_Y = BASEVIDHEIGHT - 29 + cv_laps_yoffset.value; // 171
|
||||
// Speedometer
|
||||
SPDM_X = 9 + cv_spdm_xoffset.value; // 9
|
||||
SPDM_Y = BASEVIDHEIGHT - 45 + cv_spdm_yoffset.value; // 155
|
||||
SPDM_X = 9 + cv_speed_xoffset.value; // 9
|
||||
SPDM_Y = BASEVIDHEIGHT - 45 + cv_speed_yoffset.value; // 155
|
||||
// Position Number
|
||||
POSI_X = BASEVIDWIDTH - 9 + cv_posi_xoffset.value; // 268
|
||||
POSI_Y = BASEVIDHEIGHT - 9 + cv_posi_yoffset.value; // 138
|
||||
|
||||
+6
-11
@@ -1440,8 +1440,7 @@ static menuitem_t OP_ExpOptionsMenu[] =
|
||||
{IT_STRING | IT_CVAR, NULL, "FFloorclip", &cv_ffloorclip, 85},
|
||||
{IT_STRING | IT_CVAR, NULL, "Spriteclip", &cv_spriteclip, 95},
|
||||
#ifdef HWRENDER
|
||||
{IT_STRING | IT_CVAR, NULL, "Screen Textures", &cv_grscreentextures, 65},
|
||||
{IT_STRING | IT_CVAR, NULL, "VHS effect", &cv_grvhseffect, 75},
|
||||
{IT_STRING | IT_CVAR, NULL, "Screen Textures", &cv_grscreentextures, 75},
|
||||
|
||||
{IT_STRING | IT_CVAR, NULL, "Splitwall/Slope texture fix", &cv_splitwallfix, 95},
|
||||
{IT_STRING | IT_CVAR, NULL, "Slope midtexture peg fix", &cv_slopepegfix, 105},
|
||||
@@ -1455,15 +1454,14 @@ static const char* OP_ExpTooltips[] =
|
||||
NULL,
|
||||
"Should weather be interpolated? Weather should look about the\nsame but perform a bit better when disabled.",
|
||||
"When weather is on this will cut the object amount used in half.",
|
||||
"Show a VHS-like effect when the game is paused or youre rewinding replays.",
|
||||
"Show a VHS-like effect when the game is paused\n or youre rewinding replays.",
|
||||
"Hides 3DFloors which are not visible\npotentially resulting in a performance boost.",
|
||||
"Hides Sprites which are not visible\npotentially resulting in a performance boost.",
|
||||
#ifdef HWRENDER
|
||||
"Should the game do Screen Textures? Provides a good boost to frames\nat the cost of some visual effects not working when disabled.",
|
||||
"Show a VHS-like effect when the game is paused or youre rewinding replays.",
|
||||
"Fixes issues that resulted in Textures sticking from the ground sometimes.\n This may be CPU heavy and result in worse performance in some cases.",
|
||||
"Fixes issues that resulted in Textures sticking from the\nground sometimes.\nThis may be CPU heavy and result in worse performance in some cases.",
|
||||
"Fixes issues that resulted in Textures not being properly skewed\n example: Fences on slopes that didnt show proper.\n This may be CPU heavy and result in worse performance in some cases.",
|
||||
"Fixes issues that resulted in Textures on Floor over Floors ZFighting heavily.",
|
||||
"Fixes issues that resulted in Textures on Floor over Floors\nZFighting heavily.",
|
||||
"Toggle for FOF wall cutoff with slopes.",
|
||||
#endif
|
||||
};
|
||||
@@ -1478,7 +1476,6 @@ enum
|
||||
op_exp_sprclip,
|
||||
#ifdef HWRENDER
|
||||
op_exp_grscrtx,
|
||||
op_exp_grvhs,
|
||||
op_exp_spltwal,
|
||||
op_exp_pegging,
|
||||
op_exp_fofzfight,
|
||||
@@ -2108,8 +2105,8 @@ static menuitem_t OP_HudOffsetMenu[] =
|
||||
{IT_STRING | IT_CVAR, NULL, "Vertical Offset", &cv_laps_yoffset, 60},
|
||||
|
||||
{IT_HEADER, NULL, "Speedometer", NULL, 70},
|
||||
{IT_STRING | IT_CVAR, NULL, "Horizontal Offset", &cv_spdm_xoffset, 75},
|
||||
{IT_STRING | IT_CVAR, NULL, "Vertical Offset", &cv_spdm_yoffset, 80},
|
||||
{IT_STRING | IT_CVAR, NULL, "Horizontal Offset", &cv_speed_xoffset, 75},
|
||||
{IT_STRING | IT_CVAR, NULL, "Vertical Offset", &cv_speed_yoffset, 80},
|
||||
|
||||
{IT_HEADER, NULL, "Mini Rankings", NULL, 90},
|
||||
{IT_STRING | IT_CVAR, NULL, "Horizontal Offset", &cv_face_xoffset, 95},
|
||||
@@ -4401,7 +4398,6 @@ void M_Init(void)
|
||||
{
|
||||
OP_VideoOptionsMenu[op_video_ogl].status = IT_DISABLED;
|
||||
OP_ExpOptionsMenu[op_exp_grscrtx].status = IT_DISABLED;
|
||||
OP_ExpOptionsMenu[op_exp_grvhs].status = IT_DISABLED;
|
||||
OP_ExpOptionsMenu[op_exp_spltwal].status = IT_DISABLED;
|
||||
OP_ExpOptionsMenu[op_exp_pegging].status = IT_DISABLED;
|
||||
OP_ExpOptionsMenu[op_exp_fofzfight].status = IT_DISABLED;
|
||||
@@ -4409,7 +4405,6 @@ void M_Init(void)
|
||||
}
|
||||
|
||||
if (rendermode == render_opengl){
|
||||
OP_ExpOptionsMenu[op_exp_vhs].status = IT_DISABLED;
|
||||
OP_ExpOptionsMenu[op_exp_ffclip].status = IT_DISABLED;
|
||||
OP_ExpOptionsMenu[op_exp_sprclip].status = IT_DISABLED;
|
||||
}
|
||||
|
||||
+1
-1
@@ -11507,7 +11507,7 @@ void P_SpawnMapThing(mapthing_t *mthing)
|
||||
mobj = P_SpawnMobj(x, y, z, i);
|
||||
|
||||
if (!mobj || P_MobjWasRemoved(mobj)) {
|
||||
CONS_Alert(CONS_WARNING, "Failed to spawn map thing #%d at %d, %d\n", mthing->type, x>>FRACBITS, y>>FRACBITS);
|
||||
CONS_Alert(CONS_ERROR, "Failed to spawn map thing #%d at %d, %d. This will crash vanilla clients!\n", mthing->type, x>>FRACBITS, y>>FRACBITS);
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
+4
-4
@@ -410,8 +410,8 @@ static void R_AddLine(seg_t *line)
|
||||
return;
|
||||
|
||||
// big room fix
|
||||
angle1 = R_PointToAngleEx64(viewx, viewy, line->v1->x, line->v1->y);
|
||||
angle2 = R_PointToAngleEx64(viewx, viewy, line->v2->x, line->v2->y);
|
||||
angle1 = R_PointToAngle64(line->v1->x, line->v1->y);
|
||||
angle2 = R_PointToAngle64(line->v2->x, line->v2->y);
|
||||
curline = line;
|
||||
|
||||
// Clip to view edges.
|
||||
@@ -613,8 +613,8 @@ static boolean R_CheckBBox(const fixed_t *bspcoord)
|
||||
check = checkcoord[boxpos];
|
||||
|
||||
// big room fix
|
||||
angle1 = R_PointToAngleEx64(viewx, viewy, bspcoord[check[0]], bspcoord[check[1]]) - viewangle;
|
||||
angle2 = R_PointToAngleEx64(viewx, viewy, bspcoord[check[2]], bspcoord[check[3]]) - viewangle;
|
||||
angle1 = R_PointToAngle64(bspcoord[check[0]], bspcoord[check[1]]) - viewangle;
|
||||
angle2 = R_PointToAngle64(bspcoord[check[2]], bspcoord[check[3]]) - viewangle;
|
||||
|
||||
if ((signed)angle1 < (signed)angle2)
|
||||
{
|
||||
|
||||
+17
-26
@@ -395,6 +395,23 @@ angle_t R_PointToAngle(fixed_t x, fixed_t y)
|
||||
0;
|
||||
}
|
||||
|
||||
// This version uses 64-bit variables to avoid overflows with large values.
|
||||
angle_t R_PointToAngle64(INT64 x, INT64 y)
|
||||
{
|
||||
return (y -= viewy, (x -= viewx) || y) ?
|
||||
x >= 0 ?
|
||||
y >= 0 ?
|
||||
(x > y) ? tantoangle[SlopeDivEx(y,x)] : // octant 0
|
||||
ANGLE_90-tantoangle[SlopeDivEx(x,y)] : // octant 1
|
||||
x > (y = -y) ? 0-tantoangle[SlopeDivEx(y,x)] : // octant 8
|
||||
ANGLE_270+tantoangle[SlopeDivEx(x,y)] : // octant 7
|
||||
y >= 0 ? (x = -x) > y ? ANGLE_180-tantoangle[SlopeDivEx(y,x)] : // octant 3
|
||||
ANGLE_90 + tantoangle[SlopeDivEx(x,y)] : // octant 2
|
||||
(x = -x) > (y = -y) ? ANGLE_180+tantoangle[SlopeDivEx(y,x)] : // octant 4
|
||||
ANGLE_270-tantoangle[SlopeDivEx(x,y)] : // octant 5
|
||||
0;
|
||||
}
|
||||
|
||||
angle_t R_PointToAngle2(fixed_t pviewx, fixed_t pviewy, fixed_t x, fixed_t y)
|
||||
{
|
||||
return (y -= pviewy, (x -= pviewx) || y) ?
|
||||
@@ -489,32 +506,6 @@ angle_t R_PointToAngleEx(INT32 x2, INT32 y2, INT32 x1, INT32 y1)
|
||||
0;
|
||||
}
|
||||
|
||||
angle_t R_PointToAngleEx64(INT64 x2, INT64 y2, INT64 x1, INT64 y1)
|
||||
{
|
||||
INT64 dx = x1 - x2;
|
||||
INT64 dy = y1 - y2;
|
||||
|
||||
// Check for potential overflow or underflow
|
||||
if (dx < INT64_MIN || dx > INT64_MAX || dy < INT64_MIN || dy > INT64_MAX)
|
||||
{
|
||||
x1 = (INT64)(dx / 2 + x2);
|
||||
y1 = (INT64)(dy / 2 + y2);
|
||||
}
|
||||
|
||||
return (y1 -= y2, (x1 -= x2) || y1) ?
|
||||
x1 >= 0 ?
|
||||
y1 >= 0 ?
|
||||
(x1 > y1) ? tantoangle[SlopeDivEx(y1, x1)] : // octant 0
|
||||
ANGLE_90 - tantoangle[SlopeDivEx(x1, y1)] : // octant 1
|
||||
x1 > (y1 = -y1) ? 0 - tantoangle[SlopeDivEx(y1, x1)] : // octant 8
|
||||
ANGLE_270 + tantoangle[SlopeDivEx(x1, y1)] : // octant 7
|
||||
y1 >= 0 ? (x1 = -x1) > y1 ? ANGLE_180 - tantoangle[SlopeDivEx(y1, x1)] : // octant 3
|
||||
ANGLE_90 + tantoangle[SlopeDivEx(x1, y1)] : // octant 2
|
||||
(x1 = -x1) > (y1 = -y1) ? ANGLE_180 + tantoangle[SlopeDivEx(y1, x1)] : // octant 4
|
||||
ANGLE_270 - tantoangle[SlopeDivEx(x1, y1)] : // octant 5
|
||||
0;
|
||||
}
|
||||
|
||||
//
|
||||
// R_ScaleFromGlobalAngle
|
||||
// Returns the texture mapping scale for the current line (horizontal span)
|
||||
|
||||
+1
-1
@@ -68,9 +68,9 @@ extern lighttable_t *zlight[LIGHTLEVELS][MAXLIGHTZ];
|
||||
INT32 R_PointOnSide(fixed_t x, fixed_t y, node_t *node);
|
||||
INT32 R_PointOnSegSide(fixed_t x, fixed_t y, seg_t *line);
|
||||
angle_t R_PointToAngle(fixed_t x, fixed_t y);
|
||||
angle_t R_PointToAngle64(INT64 x, INT64 y);
|
||||
angle_t R_PointToAngle2(fixed_t px2, fixed_t py2, fixed_t px1, fixed_t py1);
|
||||
angle_t R_PointToAngleEx(INT32 x2, INT32 y2, INT32 x1, INT32 y1);
|
||||
angle_t R_PointToAngleEx64(INT64 x2, INT64 y2, INT64 x1, INT64 y1);
|
||||
fixed_t R_PointToDist(fixed_t x, fixed_t y);
|
||||
fixed_t R_PointToDist2(fixed_t px2, fixed_t py2, fixed_t px1, fixed_t py1);
|
||||
angle_t R_PlayerSliptideAngle(player_t *player);
|
||||
|
||||
+1
-1
@@ -2669,7 +2669,7 @@ static boolean R_CheckSpriteVisible(vissprite_t *spr, INT32 x1, INT32 x2)
|
||||
|
||||
// R_ClipVisSprite
|
||||
// Clips vissprites without drawing, so that portals can work. -Red
|
||||
void R_ClipVisSprite(vissprite_t *spr, INT32 x1, INT32 x2)
|
||||
static void R_ClipVisSprite(vissprite_t *spr, INT32 x1, INT32 x2)
|
||||
{
|
||||
drawseg_t *ds;
|
||||
INT32 x;
|
||||
|
||||
@@ -182,7 +182,6 @@ typedef struct vissprite_s
|
||||
extern UINT32 visspritecount, numvisiblesprites;
|
||||
|
||||
void R_ClipSprites(void);
|
||||
void R_ClipVisSprite(vissprite_t *spr, INT32 x1, INT32 x2);
|
||||
|
||||
UINT8 *R_GetSpriteTranslation(vissprite_t *vis);
|
||||
|
||||
|
||||
+18
-31
@@ -20,8 +20,6 @@
|
||||
#include "r_draw.h"
|
||||
#include "console.h"
|
||||
|
||||
#include "r_fps.h" //vhs effect stuff
|
||||
|
||||
#include "i_video.h" // rendermode
|
||||
#include "z_zone.h"
|
||||
#include "m_misc.h"
|
||||
@@ -683,8 +681,7 @@ void V_DrawFill(INT32 x, INT32 y, INT32 w, INT32 h, INT32 c)
|
||||
{
|
||||
UINT8 *dest;
|
||||
const UINT8 *deststop;
|
||||
INT32 u, v;
|
||||
UINT32 alphalevel = 0;
|
||||
UINT32 alphalevel = ((c & V_ALPHAMASK) >> V_ALPHASHIFT);
|
||||
|
||||
if (rendermode == render_none)
|
||||
return;
|
||||
@@ -761,7 +758,7 @@ void V_DrawFill(INT32 x, INT32 y, INT32 w, INT32 h, INT32 c)
|
||||
dest = screens[0] + y*vid.width + x;
|
||||
deststop = screens[0] + vid.rowbytes * vid.height;
|
||||
|
||||
if ((alphalevel = ((c & V_ALPHAMASK) >> V_ALPHASHIFT)))
|
||||
if (alphalevel)
|
||||
{
|
||||
if (alphalevel == 13)
|
||||
alphalevel = hudminusalpha[cv_translucenthud.value];
|
||||
@@ -775,21 +772,20 @@ void V_DrawFill(INT32 x, INT32 y, INT32 w, INT32 h, INT32 c)
|
||||
}
|
||||
|
||||
c &= 255;
|
||||
|
||||
if (!alphalevel) {
|
||||
|
||||
if (alphalevel)
|
||||
{
|
||||
const UINT8 *fadetable = ((UINT8 *)transtables + ((alphalevel-1)<<FF_TRANSSHIFT) + (c*256));
|
||||
for (;(--h >= 0) && dest < deststop; dest += vid.width)
|
||||
{
|
||||
for (x = 0; x < w; x++)
|
||||
dest[x] = fadetable[dest[x]];
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
for (;(--h >= 0) && dest < deststop; dest += vid.width)
|
||||
memset(dest, c, w * vid.bpp);
|
||||
} else { // holy fuck i hope this doesent break lmao
|
||||
const UINT8 *fadetable = ((UINT8 *)transtables + ((alphalevel-1)<<FF_TRANSSHIFT) + (c*256));
|
||||
#define clip(x,y) (x>y) ? y : x
|
||||
w = clip(w,vid.width);
|
||||
h = clip(h,vid.height);
|
||||
#undef clip
|
||||
for (v = 0; v < h; v++, dest += vid.width) {
|
||||
for (u = 0; u < w; u++) {
|
||||
dest[u] = fadetable[dest[u]];
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1169,26 +1165,17 @@ void V_DrawVhsEffect(boolean rewind)
|
||||
if (rewind)
|
||||
V_DrawVhsEffect(false); // experimentation
|
||||
|
||||
if (R_UsingFrameInterpolation()) // omg i fucking hate interp so much, its a bit smoother but still not great whatever, atleast like this shit wont completely go nuts when youre on high framerates
|
||||
if (renderisnewtic)
|
||||
{
|
||||
if (renderisnewtic)
|
||||
{
|
||||
upbary -= FixedMul(vid.dupy * (rewind ? 3 : 1.8f), 22937*3);
|
||||
downbary += FixedMul(vid.dupy * (rewind ? 2 : 1), 22937*3);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
upbary -= vid.dupy * (rewind ? 3 : 1.8f);
|
||||
downbary += vid.dupy * (rewind ? 2 : 1);
|
||||
upbary -= (vid.dupy * (rewind ? 3 : 1.8f));
|
||||
downbary += (vid.dupy * (rewind ? 2 : 1));
|
||||
}
|
||||
|
||||
|
||||
if (upbary < -barsize) upbary = vid.height;
|
||||
if (downbary > vid.height) downbary = -barsize;
|
||||
|
||||
#ifdef HWRENDER
|
||||
if ((rendermode == render_opengl) && (cv_grvhseffect.value))
|
||||
if (rendermode == render_opengl)
|
||||
{
|
||||
HWR_RenderVhsEffect(upbary, downbary, updistort, downdistort, barsize);
|
||||
return;
|
||||
|
||||
+4
-7
@@ -769,13 +769,10 @@ UINT16 W_InitFile(const char *filename, const char *lumpname, UINT16 *wadnump, b
|
||||
{
|
||||
if (!memcmp(wadfiles[i]->md5sum, md5sum, 16))
|
||||
{
|
||||
if (!local) {
|
||||
CONS_Alert(CONS_ERROR, M_GetText("%s is already loaded\n"), filename);
|
||||
if (handle)
|
||||
fclose(handle);
|
||||
return INT16_MAX;
|
||||
}
|
||||
CONS_Alert(CONS_WARNING, M_GetText("%s is a local skin that is already loaded\n"), filename);
|
||||
CONS_Alert(CONS_ERROR, M_GetText("%s is already loaded\n"), filename);
|
||||
if (handle)
|
||||
fclose(handle);
|
||||
return INT16_MAX;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
Reference in new issue
Block a user