Merge remote-tracking branch 'origin/Saturn' into paletteshader
This commit is contained in:
commit
e5b16c7aa0
11 files changed
+1242
-1222
No files matched your search
+1
-1
@@ -512,7 +512,7 @@ consvar_t cv_ps_descriptor = {"ps_descriptor", "Average", 0, ps_descriptor_cons_
|
||||
|
||||
consvar_t cv_showtrackaddon = {"showtrackaddon", "Yes", CV_SAVE, CV_YesNo, NULL, 0, NULL, NULL, 0, 0, NULL};
|
||||
|
||||
static CV_PossibleValue_t skinselectmenu_t[] = {{SKINMENUTYPE_SCROLL, "Scoll"}, {SKINMENUTYPE_2D, "2d"}, {SKINMENUTYPE_GRID, "Grid"}, {0, NULL}};
|
||||
static CV_PossibleValue_t skinselectmenu_t[] = {{SKINMENUTYPE_SCROLL, "Scroll"}, {SKINMENUTYPE_2D, "2d"}, {SKINMENUTYPE_GRID, "Grid"}, {0, NULL}};
|
||||
consvar_t cv_skinselectmenu = {"skinselectmenu", "Grid", CV_SAVE, skinselectmenu_t, NULL, 0, NULL, NULL, 0, 0, NULL};
|
||||
|
||||
static CV_PossibleValue_t skinselectgridsort_t[] ={
|
||||
|
||||
@@ -371,6 +371,7 @@ typedef struct player_s
|
||||
|
||||
angle_t viewrollangle;
|
||||
angle_t tilt;
|
||||
angle_t tilt_sprite;
|
||||
|
||||
// Mouse aiming, where the guy is looking at!
|
||||
// It is updated with cmd->aiming.
|
||||
|
||||
+11
-11
@@ -122,7 +122,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);
|
||||
HWD.pfnDrawPolygon(NULL, v, 4, flags, false);
|
||||
}
|
||||
|
||||
void HWR_DrawStretchyFixedPatch(GLPatch_t *gpatch, fixed_t x, fixed_t y, fixed_t pscale, fixed_t vscale, INT32 option, const UINT8 *colormap)
|
||||
@@ -300,10 +300,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);
|
||||
HWD.pfnDrawPolygon(&Surf, v, 4, flags, false);
|
||||
}
|
||||
else
|
||||
HWD.pfnDrawPolygon(NULL, v, 4, flags);
|
||||
HWD.pfnDrawPolygon(NULL, v, 4, flags, false);
|
||||
}
|
||||
|
||||
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)
|
||||
@@ -454,10 +454,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);
|
||||
HWD.pfnDrawPolygon(&Surf, v, 4, flags, false);
|
||||
}
|
||||
else
|
||||
HWD.pfnDrawPolygon(NULL, v, 4, flags);
|
||||
HWD.pfnDrawPolygon(NULL, v, 4, flags, false);
|
||||
}
|
||||
|
||||
// ==========================================================================
|
||||
@@ -533,7 +533,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);
|
||||
HWD.pfnDrawPolygon(NULL, v, 4, PF_NoDepthTest, false); //PF_Translucent);
|
||||
}
|
||||
|
||||
|
||||
@@ -570,7 +570,7 @@ void HWR_FadeScreenMenuBack(UINT16 color, UINT8 strength)
|
||||
Surf.PolyColor.rgba = pLocalPalette[color].rgba;
|
||||
Surf.PolyColor.s.alpha = (UINT8)(strength*25.5f);
|
||||
}
|
||||
HWD.pfnDrawPolygon(&Surf, v, 4, PF_NoTexture|PF_Modulated|PF_Translucent|PF_NoDepthTest);
|
||||
HWD.pfnDrawPolygon(&Surf, v, 4, PF_NoTexture|PF_Modulated|PF_Translucent|PF_NoDepthTest, false);
|
||||
}
|
||||
|
||||
// Draw the console background with translucency support
|
||||
@@ -597,7 +597,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);
|
||||
HWD.pfnDrawPolygon(&Surf, v, 4, PF_NoTexture|PF_Modulated|PF_Translucent|PF_NoDepthTest, false);
|
||||
}
|
||||
|
||||
|
||||
@@ -846,7 +846,7 @@ void HWR_DrawDiag(INT32 x, INT32 y, INT32 wh, INT32 color)
|
||||
Surf.PolyColor = V_GetColor(color);
|
||||
|
||||
HWD.pfnDrawPolygon(&Surf, v, 4,
|
||||
PF_Modulated|PF_NoTexture|PF_NoDepthTest);
|
||||
PF_Modulated|PF_NoTexture|PF_NoDepthTest, false);
|
||||
}
|
||||
|
||||
// -------------------+
|
||||
@@ -954,7 +954,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);
|
||||
HWD.pfnDrawPolygon(&Surf, v, 4, PF_NoTexture|PF_Modulated|PF_Translucent|PF_NoDepthTest, false);
|
||||
}
|
||||
|
||||
// -----------------+
|
||||
@@ -1062,7 +1062,7 @@ void HWR_DrawFill(INT32 x, INT32 y, INT32 w, INT32 h, INT32 color)
|
||||
Surf.PolyColor = V_GetColor(color);
|
||||
|
||||
HWD.pfnDrawPolygon(&Surf, v, 4,
|
||||
PF_Modulated|PF_NoTexture|PF_NoDepthTest);
|
||||
PF_Modulated|PF_NoTexture|PF_NoDepthTest, false);
|
||||
}
|
||||
|
||||
#ifdef HAVE_PNG
|
||||
|
||||
@@ -21,6 +21,7 @@
|
||||
#include "hw_md2.h"
|
||||
|
||||
#include "hw_dll.h"
|
||||
#include "../doomdef.h"
|
||||
|
||||
// ==========================================================================
|
||||
// STANDARD DLL EXPORTS
|
||||
@@ -34,7 +35,7 @@ EXPORT void HWRAPI(SetPalette) (RGBA_t *ppal, RGBA_t *pgamma);
|
||||
#endif
|
||||
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(DrawPolygon) (FSurfaceInfo *pSurf, FOutVector *pOutVerts, FUINT iNumPts, FBITFIELD PolyFlags, boolean horizonSpecial);
|
||||
EXPORT void HWRAPI(SetBlend) (FBITFIELD PolyFlags);
|
||||
EXPORT void HWRAPI(ClearBuffer) (FBOOLEAN ColorMask, FBOOLEAN DepthMask, FBOOLEAN StencilMask, FRGBAFloat *ClearColor);
|
||||
EXPORT void HWRAPI(SetTexture) (FTextureInfo *TexInfo);
|
||||
|
||||
+97
-24
@@ -771,7 +771,80 @@ void HWR_RenderPlane(extrasubsector_t *xsub, boolean isceiling, fixed_t fixedhei
|
||||
else
|
||||
HWD.pfnSetShader(gr_use_palette_shader ? 9 : 1); // floor shader
|
||||
|
||||
HWD.pfnDrawPolygon(&Surf, planeVerts, nrPlaneVerts, PolyFlags);
|
||||
HWD.pfnDrawPolygon(&Surf, planeVerts, nrPlaneVerts, PolyFlags, false);
|
||||
|
||||
if (subsector)
|
||||
{
|
||||
// Horizon lines
|
||||
FOutVector horizonpts[6];
|
||||
float dist, vx, vy;
|
||||
float x1, y1, xd, yd;
|
||||
UINT8 numplanes, j;
|
||||
vertex_t v; // For determining the closest distance from the line to the camera, to split render planes for minimum distortion;
|
||||
|
||||
const float renderdist = 27000.0f; // How far out to properly render the plane
|
||||
const float farrenderdist = 32768.0f; // From here, raise plane to horizon level to fill in the line with some texture distortion
|
||||
|
||||
seg_t *line = &segs[subsector->firstline];
|
||||
|
||||
for (i = 0; i < subsector->numlines; i++, line++)
|
||||
{
|
||||
if (line->linedef->special == 41 && R_PointOnSegSide(dup_viewx, dup_viewy, line) == 0)
|
||||
{
|
||||
P_ClosestPointOnLine(viewx, viewy, line->linedef, &v);
|
||||
dist = FIXED_TO_FLOAT(R_PointToDist(v.x, v.y));
|
||||
|
||||
x1 = ((polyvertex_t *)line->pv1)->x;
|
||||
y1 = ((polyvertex_t *)line->pv1)->y;
|
||||
xd = ((polyvertex_t *)line->pv2)->x - x1;
|
||||
yd = ((polyvertex_t *)line->pv2)->y - y1;
|
||||
|
||||
// Based on the seg length and the distance from the line, split horizon into multiple poly sets to reduce distortion
|
||||
dist = sqrtf((xd*xd) + (yd*yd)) / dist / 16.0f;
|
||||
if (dist > 100.0f)
|
||||
numplanes = 100;
|
||||
else
|
||||
numplanes = (UINT8)dist + 1;
|
||||
|
||||
for (j = 0; j < numplanes; j++)
|
||||
{
|
||||
// Left side
|
||||
vx = x1 + xd * j / numplanes;
|
||||
vy = y1 + yd * j / numplanes;
|
||||
SETUP3DVERT((&horizonpts[1]), vx, vy);
|
||||
|
||||
dist = sqrtf(powf(vx - gr_viewx, 2) + powf(vy - gr_viewy, 2));
|
||||
vx = (vx - gr_viewx) * renderdist / dist + gr_viewx;
|
||||
vy = (vy - gr_viewy) * renderdist / dist + gr_viewy;
|
||||
SETUP3DVERT((&horizonpts[0]), vx, vy);
|
||||
|
||||
// Right side
|
||||
vx = x1 + xd * (j+1) / numplanes;
|
||||
vy = y1 + yd * (j+1) / numplanes;
|
||||
SETUP3DVERT((&horizonpts[2]), vx, vy);
|
||||
|
||||
dist = sqrtf(powf(vx - gr_viewx, 2) + powf(vy - gr_viewy, 2));
|
||||
vx = (vx - gr_viewx) * renderdist / dist + gr_viewx;
|
||||
vy = (vy - gr_viewy) * renderdist / dist + gr_viewy;
|
||||
SETUP3DVERT((&horizonpts[3]), vx, vy);
|
||||
|
||||
// Horizon fills
|
||||
vx = (horizonpts[0].x - gr_viewx) * farrenderdist / renderdist + gr_viewx;
|
||||
vy = (horizonpts[0].z - gr_viewy) * farrenderdist / renderdist + gr_viewy;
|
||||
SETUP3DVERT((&horizonpts[5]), vx, vy);
|
||||
horizonpts[5].y = gr_viewz;
|
||||
|
||||
vx = (horizonpts[3].x - gr_viewx) * farrenderdist / renderdist + gr_viewx;
|
||||
vy = (horizonpts[3].z - gr_viewy) * farrenderdist / renderdist + gr_viewy;
|
||||
SETUP3DVERT((&horizonpts[4]), vx, vy);
|
||||
horizonpts[4].y = gr_viewz;
|
||||
|
||||
// Draw
|
||||
HWD.pfnDrawPolygon(&Surf, horizonpts, 6, PolyFlags, true);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#ifdef WALLSPLATS
|
||||
@@ -835,7 +908,7 @@ static void HWR_DrawSegsSplats(FSurfaceInfo * pSurf)
|
||||
}
|
||||
|
||||
HWD.pfnSetShader(gr_use_palette_shader ? 10 : 2); // wall shader
|
||||
HWD.pfnDrawPolygon(&pSurf, wallVerts, 4, i|PF_Modulated|PF_Decal);
|
||||
HWD.pfnDrawPolygon(&pSurf, wallVerts, 4, i|PF_Modulated|PF_Decal, false);
|
||||
}
|
||||
}
|
||||
#endif
|
||||
@@ -877,7 +950,7 @@ void HWR_ProjectWall(FOutVector *wallVerts, FSurfaceInfo *pSurf, FBITFIELD blend
|
||||
blendmode &= ~PF_Masked;
|
||||
}
|
||||
|
||||
HWD.pfnDrawPolygon(pSurf, wallVerts, 4, blendmode|PF_Modulated|PF_Occlude);
|
||||
HWD.pfnDrawPolygon(pSurf, wallVerts, 4, blendmode|PF_Modulated|PF_Occlude, false);
|
||||
|
||||
#ifdef WALLSPLATS
|
||||
if (gr_curline->linedef->splats && cv_splats.value)
|
||||
@@ -1173,7 +1246,7 @@ void HWR_DrawSkyWallList()
|
||||
HWD.pfnUnSetShader();
|
||||
for (i = 0; i < skyWallVertexArraySize; i++)
|
||||
{
|
||||
HWD.pfnDrawPolygon(&surf, skyWallVertexArray + i * 4, 4, PF_Occlude|PF_Invisible|PF_NoTexture);
|
||||
HWD.pfnDrawPolygon(&surf, skyWallVertexArray + i * 4, 4, PF_Occlude|PF_Invisible|PF_NoTexture, false);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -3003,7 +3076,7 @@ void HWR_RenderPolyObjectPlane(polyobj_t *polysector, boolean isceiling, fixed_t
|
||||
blendmode |= PF_Masked|PF_Modulated;
|
||||
|
||||
HWD.pfnSetShader(gr_use_palette_shader ? 9 : 1); // floor shader
|
||||
HWD.pfnDrawPolygon(&Surf, planeVerts, nrPlaneVerts, blendmode);
|
||||
HWD.pfnDrawPolygon(&Surf, planeVerts, nrPlaneVerts, blendmode, false);
|
||||
}
|
||||
|
||||
void HWR_AddPolyObjectPlanes(void)
|
||||
@@ -3802,7 +3875,7 @@ static void HWR_DrawSpriteShadow(gr_vissprite_t *spr, GLPatch_t *gpatch, float t
|
||||
{
|
||||
sSurf.PolyColor.s.alpha = (UINT8)(sSurf.PolyColor.s.alpha - floorheight/4);
|
||||
HWD.pfnSetShader(gr_use_palette_shader ? 9 : 1); // floor shader
|
||||
HWD.pfnDrawPolygon(&sSurf, swallVerts, 4, PF_Translucent|PF_Modulated);
|
||||
HWD.pfnDrawPolygon(&sSurf, swallVerts, 4, PF_Translucent|PF_Modulated, false);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -4169,7 +4242,7 @@ static void HWR_SplitSprite(gr_vissprite_t *spr)
|
||||
Surf.PolyColor.s.alpha = alpha;
|
||||
|
||||
HWD.pfnSetShader(gr_use_palette_shader ? 10 : 3); // sprite shader
|
||||
HWD.pfnDrawPolygon(&Surf, wallVerts, 4, blend|PF_Modulated);
|
||||
HWD.pfnDrawPolygon(&Surf, wallVerts, 4, blend|PF_Modulated, false);
|
||||
|
||||
top = bot;
|
||||
#ifdef ESLOPE
|
||||
@@ -4209,7 +4282,7 @@ static void HWR_SplitSprite(gr_vissprite_t *spr)
|
||||
Surf.PolyColor.s.alpha = alpha;
|
||||
|
||||
HWD.pfnSetShader(gr_use_palette_shader ? 10 : 3); // sprite shader
|
||||
HWD.pfnDrawPolygon(&Surf, wallVerts, 4, blend|PF_Modulated);
|
||||
HWD.pfnDrawPolygon(&Surf, wallVerts, 4, blend|PF_Modulated, false);
|
||||
}
|
||||
|
||||
// -----------------+
|
||||
@@ -4362,7 +4435,7 @@ static void HWR_DrawSprite(gr_vissprite_t *spr)
|
||||
}
|
||||
|
||||
HWD.pfnSetShader(gr_use_palette_shader ? 10 : 3); // sprite shader
|
||||
HWD.pfnDrawPolygon(&Surf, wallVerts, 4, blend|PF_Modulated);
|
||||
HWD.pfnDrawPolygon(&Surf, wallVerts, 4, blend|PF_Modulated, false);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -4456,7 +4529,7 @@ static inline void HWR_DrawPrecipitationSprite(gr_vissprite_t *spr)
|
||||
}
|
||||
|
||||
HWD.pfnSetShader(gr_use_palette_shader ? 10 : 3); // sprite shader
|
||||
HWD.pfnDrawPolygon(&Surf, wallVerts, 4, blend|PF_Modulated);
|
||||
HWD.pfnDrawPolygon(&Surf, wallVerts, 4, blend|PF_Modulated, false);
|
||||
}
|
||||
|
||||
// --------------------------------------------------------------------------
|
||||
@@ -5117,7 +5190,7 @@ void HWR_ProjectSprite(mobj_t *thing)
|
||||
rollsum = (thing->rollangle)+(thing->sloperoll);
|
||||
|
||||
rollangle = R_GetRollAngle(rollsum);
|
||||
rotsprite = Patch_GetRotatedSprite(sprframe, (thing->frame & FF_FRAMEMASK), rot, flip, sprinfo, rollangle);
|
||||
rotsprite = Patch_GetRotatedSprite(sprframe, (thing->frame & FF_FRAMEMASK), rot, flip, false, sprinfo, rollangle);
|
||||
|
||||
if (rotsprite != NULL)
|
||||
{
|
||||
@@ -5748,8 +5821,18 @@ void RecursivePortalRendering(portal_t *rootportal, const float fpov, player_t *
|
||||
HWR_SetTransform(fpov, player);// restore transform
|
||||
}
|
||||
gr_collect_skywalls = false;
|
||||
|
||||
ps_numsprites.value.i = gr_visspritecount;
|
||||
PS_START_TIMING(ps_hw_spritesorttime);
|
||||
HWR_SortVisSprites();
|
||||
PS_STOP_TIMING(ps_hw_spritesorttime);
|
||||
PS_START_TIMING(ps_hw_spritedrawtime);
|
||||
HWR_DrawSprites();
|
||||
PS_STOP_TIMING(ps_hw_spritedrawtime);
|
||||
|
||||
ps_numdrawnodes.value.i = 0;
|
||||
ps_hw_nodesorttime.value.p = 0;
|
||||
ps_hw_nodedrawtime.value.p = 0;
|
||||
HWR_RenderDrawNodes();
|
||||
}
|
||||
// free memory from portal list allocated by calls to Add2Lines
|
||||
@@ -5765,6 +5848,7 @@ void RecursivePortalRendering(portal_t *rootportal, const float fpov, player_t *
|
||||
// TODO: is it okay if stencil test is on all the time even when its not needed?
|
||||
}
|
||||
|
||||
|
||||
// ==========================================================================
|
||||
// Render the current frame.
|
||||
// ==========================================================================
|
||||
@@ -5885,7 +5969,6 @@ void HWR_RenderFrame(INT32 viewnumber, player_t *player, boolean skybox)
|
||||
HWD.pfnSetSpecialState(HWD_SET_SHADERS, cv_grshaders.value);
|
||||
HWD.pfnSetShader(0);
|
||||
|
||||
//drawcount = 0;
|
||||
validcount++;
|
||||
|
||||
portalclipline = NULL;
|
||||
@@ -5923,18 +6006,8 @@ void HWR_RenderSinglePortal(portal_t *portal, size_t portalnum, float fpov, play
|
||||
portalcullsector = gr_portalcullsectors[portalnum];
|
||||
HWR_RenderBSPNode((INT32)numnodes - 1);
|
||||
|
||||
// Draw MD2 and sprites
|
||||
ps_numsprites.value.i = gr_visspritecount;
|
||||
PS_START_TIMING(ps_hw_spritesorttime);
|
||||
HWR_SortVisSprites();
|
||||
PS_STOP_TIMING(ps_hw_spritesorttime);
|
||||
PS_START_TIMING(ps_hw_spritedrawtime);
|
||||
HWR_DrawSprites();
|
||||
PS_STOP_TIMING(ps_hw_spritedrawtime);
|
||||
|
||||
ps_numdrawnodes.value.i = 0;
|
||||
ps_hw_nodesorttime.value.p = 0;
|
||||
ps_hw_nodedrawtime.value.p = 0;
|
||||
HWR_RenderDrawNodes();
|
||||
}
|
||||
|
||||
@@ -6080,7 +6153,7 @@ void HWR_RenderWall(FOutVector *wallVerts, FSurfaceInfo *pSurf, FBITFIELD blend,
|
||||
|
||||
blendmode |= PF_Modulated; // No PF_Occlude means overlapping (incorrect) transparency
|
||||
|
||||
HWD.pfnDrawPolygon(pSurf, wallVerts, 4, blendmode);
|
||||
HWD.pfnDrawPolygon(pSurf, wallVerts, 4, blendmode, false);
|
||||
|
||||
#ifdef WALLSPLATS
|
||||
if (gr_curline->linedef->splats && cv_splats.value)
|
||||
@@ -6131,7 +6204,7 @@ 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);
|
||||
HWD.pfnDrawPolygon(&Surf, v, 4, PF_Modulated|PF_Translucent|PF_NoTexture|PF_NoDepthTest, false);
|
||||
}
|
||||
|
||||
if (!cv_grscreentextures.value) // screen textures are needed for the rest of the effects
|
||||
|
||||
@@ -2092,6 +2092,8 @@ typedef struct
|
||||
FBITFIELD polyFlags;
|
||||
GLuint texNum;
|
||||
GLuint shader;
|
||||
// this tells batching that the plane belongs to a horizon line and must be drawn in correct order with the skywalls
|
||||
boolean horizonSpecial;
|
||||
} PolygonArrayEntry;
|
||||
|
||||
FOutVector* finalVertexArray = NULL;// contains subset of sorted vertices and texture coordinates to be sent to gpu
|
||||
@@ -2131,21 +2133,27 @@ EXPORT void HWRAPI(StartBatching) (void)
|
||||
|
||||
static int comparePolygons(const void *p1, const void *p2)
|
||||
{
|
||||
PolygonArrayEntry* poly1 = &polygonArray[*(const unsigned int*)p1];
|
||||
PolygonArrayEntry* poly2 = &polygonArray[*(const unsigned int*)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;
|
||||
|
||||
int shader1 = poly1->shader;
|
||||
int shader2 = poly2->shader;
|
||||
// make skywalls first in order
|
||||
if (poly1->polyFlags & PF_NoTexture)
|
||||
// make skywalls and horizon lines first in order
|
||||
if (poly1->polyFlags & PF_NoTexture || poly1->horizonSpecial)
|
||||
shader1 = -1;
|
||||
if (poly2->polyFlags & PF_NoTexture)
|
||||
if (poly2->polyFlags & PF_NoTexture || poly2->horizonSpecial)
|
||||
shader2 = -1;
|
||||
diff = shader1 - shader2;
|
||||
if (diff != 0) return diff;
|
||||
|
||||
// skywalls and horizon lines must retain their order for horizon lines to work
|
||||
if (shader1 == -1 && shader2 == -1)
|
||||
return index1 - index2;
|
||||
|
||||
diff = poly1->texNum - poly2->texNum;
|
||||
if (diff != 0) return diff;
|
||||
|
||||
@@ -2172,20 +2180,26 @@ static int comparePolygons(const void *p1, const void *p2)
|
||||
|
||||
static int comparePolygonsNoShaders(const void *p1, const void *p2)
|
||||
{
|
||||
PolygonArrayEntry* poly1 = &polygonArray[*(const unsigned int*)p1];
|
||||
PolygonArrayEntry* poly2 = &polygonArray[*(const unsigned int*)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;
|
||||
|
||||
GLuint texNum1 = poly1->texNum;
|
||||
GLuint texNum2 = poly2->texNum;
|
||||
if (poly1->polyFlags & PF_NoTexture)
|
||||
if (poly1->polyFlags & PF_NoTexture || poly1->horizonSpecial)
|
||||
texNum1 = 0;
|
||||
if (poly2->polyFlags & PF_NoTexture)
|
||||
if (poly2->polyFlags & PF_NoTexture || poly2->horizonSpecial)
|
||||
texNum2 = 0;
|
||||
diff = texNum1 - texNum2;
|
||||
if (diff != 0) return diff;
|
||||
|
||||
// skywalls and horizon lines must retain their order for horizon lines to work
|
||||
if (texNum1 == 0 && texNum2 == 0)
|
||||
return index1 - index2;
|
||||
|
||||
diff = poly1->polyFlags - poly2->polyFlags;
|
||||
if (diff != 0) return diff;
|
||||
|
||||
@@ -2559,7 +2573,7 @@ EXPORT void HWRAPI(RenderBatches) (precise_t *sSortTime, precise_t *sDrawTime, i
|
||||
// -----------------+
|
||||
// DrawPolygon : Render a polygon, set the texture, set render mode
|
||||
// -----------------+
|
||||
EXPORT void HWRAPI(DrawPolygon) (FSurfaceInfo *pSurf, FOutVector *pOutVerts, FUINT iNumPts, FBITFIELD PolyFlags)
|
||||
EXPORT void HWRAPI(DrawPolygon) (FSurfaceInfo *pSurf, FOutVector *pOutVerts, FUINT iNumPts, FBITFIELD PolyFlags, boolean horizonSpecial)
|
||||
{
|
||||
if (gl_batching)
|
||||
{
|
||||
@@ -2599,6 +2613,7 @@ EXPORT void HWRAPI(DrawPolygon) (FSurfaceInfo *pSurf, FOutVector *pOutVerts, FUI
|
||||
polygonArray[polygonArraySize].polyFlags = PolyFlags;
|
||||
polygonArray[polygonArraySize].texNum = tex_downloaded;
|
||||
polygonArray[polygonArraySize].shader = gl_currentshaderprogram;
|
||||
polygonArray[polygonArraySize].horizonSpecial = horizonSpecial;
|
||||
polygonArraySize++;
|
||||
|
||||
memcpy(&unsortedVertexArray[unsortedVertexArraySize], pOutVerts, iNumPts * sizeof(FOutVector));
|
||||
|
||||
+11
-3
@@ -3100,7 +3100,7 @@ static void K_QuiteSaltyHop(player_t *p)
|
||||
p->mo->spriteyscale += (mos/8);
|
||||
p->mo->spritexscale -= (mos/8);
|
||||
}
|
||||
p->mo->spriteyoffset = p->mo->salty_zoffset*P_MobjFlip(p->mo);
|
||||
p->mo->spriteyoffset = p->mo->salty_zoffset;
|
||||
if (S_SoundPlaying(p->mo, sfx_screec))
|
||||
S_StopSoundByID(p->mo, sfx_screec);
|
||||
if (S_SoundPlaying(p->mo, sfx_drift))
|
||||
@@ -3132,6 +3132,7 @@ static angle_t K_GetSlopeRollAngle(player_t *p, boolean dontflip, boolean useRes
|
||||
angle_t zangle = 0;
|
||||
angle_t xydirection = 0;
|
||||
angle_t an;
|
||||
angle_t final_slope;
|
||||
INT32 pNum = K_FindPlayerNum(p);
|
||||
|
||||
I_Assert(p != NULL);
|
||||
@@ -3171,7 +3172,14 @@ static angle_t K_GetSlopeRollAngle(player_t *p, boolean dontflip, boolean useRes
|
||||
zangle = InvAngle(zangle);
|
||||
|
||||
an = (lookAngle - xydirection);
|
||||
return FixedMul(zangle, FINESINE(an>>ANGLETOFINESHIFT));
|
||||
final_slope = -(FixedMul(FINESINE(an>>ANGLETOFINESHIFT), zangle));
|
||||
an = (INT32)(final_slope - p->tilt_sprite) / 3; // instead of just a direct snap
|
||||
|
||||
if (an)
|
||||
p->tilt_sprite += an;
|
||||
else
|
||||
p->tilt_sprite = final_slope;
|
||||
return -p->tilt_sprite;
|
||||
}
|
||||
|
||||
static void K_RollPlayerBySlopes(player_t *p, boolean usedistance)
|
||||
@@ -6647,7 +6655,7 @@ void K_CheckBumpers(void)
|
||||
if (winnernum > -1 && playeringame[winnernum])
|
||||
{
|
||||
players[winnernum].marescore += winnerscoreadd;
|
||||
CONS_Printf(M_GetText("%s recieved %d point%s for winning!\n"), player_names[winnernum], winnerscoreadd, (winnerscoreadd == 1 ? "" : "s"));
|
||||
CONS_Printf(M_GetText("%s received %d point%s for winning!\n"), player_names[winnernum], winnerscoreadd, (winnerscoreadd == 1 ? "" : "s"));
|
||||
}
|
||||
|
||||
for (i = 0; i < MAXPLAYERS; i++) // This can't go in the earlier loop because winning adds points
|
||||
|
||||
+1018
-1102
File diff suppressed because it is too large.
Load diff
+68
-69
@@ -1,69 +1,68 @@
|
||||
// SONIC ROBO BLAST 2
|
||||
//-----------------------------------------------------------------------------
|
||||
// Copyright (C) 1993-1996 by id Software, Inc.
|
||||
// Copyright (C) 2018-2019 by Jaime "Lactozilla" Passos.
|
||||
// Copyright (C) 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 r_patch.h
|
||||
/// \brief Patch generation.
|
||||
|
||||
#ifndef __R_PATCH__
|
||||
#define __R_PATCH__
|
||||
|
||||
#include "r_defs.h"
|
||||
#include "doomdef.h"
|
||||
|
||||
// Structs
|
||||
typedef enum
|
||||
{
|
||||
ROTAXIS_X, // Roll (the default)
|
||||
ROTAXIS_Y, // Pitch
|
||||
ROTAXIS_Z // Yaw
|
||||
} rotaxis_t;
|
||||
|
||||
typedef struct
|
||||
{
|
||||
INT32 x, y;
|
||||
rotaxis_t rotaxis;
|
||||
} spriteframepivot_t;
|
||||
|
||||
typedef struct
|
||||
{
|
||||
spriteframepivot_t pivot[64];
|
||||
boolean available;
|
||||
} spriteinfo_t;
|
||||
|
||||
// Conversions between patches / flats / textures...
|
||||
boolean R_CheckIfPatch(lumpnum_t lump);
|
||||
void R_TextureToFlat(size_t tex, UINT8 *flat);
|
||||
void R_PatchToFlat(patch_t *patch, UINT8 *flat);
|
||||
void R_PatchToMaskedFlat(patch_t *patch, UINT16 *raw, boolean flip);
|
||||
patch_t *R_FlatToPatch(UINT8 *raw, UINT16 width, UINT16 height, UINT16 leftoffset, UINT16 topoffset, size_t *destsize, boolean transparency);
|
||||
patch_t *R_MaskedFlatToPatch(UINT16 *raw, UINT16 width, UINT16 height, UINT16 leftoffset, UINT16 topoffset, size_t *destsize);
|
||||
|
||||
// SpriteInfo
|
||||
extern spriteinfo_t spriteinfo[NUMSPRITES];
|
||||
void R_LoadSpriteInfoLumps(UINT16 wadnum, UINT16 numlumps);
|
||||
void R_ParseSPRTINFOLump(UINT16 wadNum, UINT16 lumpNum);
|
||||
|
||||
// Sprite rotation
|
||||
#ifdef ROTSPRITE
|
||||
INT32 R_GetRollAngle(angle_t rollangle);
|
||||
patch_t *Patch_GetRotatedSprite(
|
||||
spriteframe_t *sprite,
|
||||
size_t frame, size_t spriteangle,
|
||||
boolean flip, void *info,
|
||||
INT32 rotationangle);
|
||||
rotsprite_t *RotatedPatch_Create(INT32 numangles);
|
||||
void RotatedPatch_DoRotation(rotsprite_t *rotsprite, patch_t *patch, INT32 angle, INT32 xpivot, INT32 ypivot, UINT8 flip);
|
||||
//void R_FreeSkinRotSprite(size_t skinnum);
|
||||
extern fixed_t rollcosang[ROTANGLES];
|
||||
extern fixed_t rollsinang[ROTANGLES];
|
||||
void R_FreeAllRotSprite(void);
|
||||
#endif
|
||||
|
||||
#endif // __R_PATCH__
|
||||
// SONIC ROBO BLAST 2
|
||||
//-----------------------------------------------------------------------------
|
||||
// Copyright (C) 1993-1996 by id Software, Inc.
|
||||
// Copyright (C) 2018-2019 by Jaime "Lactozilla" Passos.
|
||||
// Copyright (C) 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 r_patch.h
|
||||
/// \brief Patch generation.
|
||||
|
||||
#ifndef __R_PATCH__
|
||||
#define __R_PATCH__
|
||||
|
||||
#include "r_defs.h"
|
||||
#include "doomdef.h"
|
||||
|
||||
// Structs
|
||||
typedef enum
|
||||
{
|
||||
ROTAXIS_X, // Roll (the default)
|
||||
ROTAXIS_Y, // Pitch
|
||||
ROTAXIS_Z // Yaw
|
||||
} rotaxis_t;
|
||||
|
||||
typedef struct
|
||||
{
|
||||
INT32 x, y;
|
||||
rotaxis_t rotaxis;
|
||||
} spriteframepivot_t;
|
||||
|
||||
typedef struct
|
||||
{
|
||||
spriteframepivot_t pivot[64];
|
||||
boolean available;
|
||||
} spriteinfo_t;
|
||||
|
||||
// Conversions between patches / flats / textures...
|
||||
boolean R_CheckIfPatch(lumpnum_t lump);
|
||||
void R_TextureToFlat(size_t tex, UINT8 *flat);
|
||||
void R_PatchToFlat(patch_t *patch, UINT8 *flat);
|
||||
void R_PatchToMaskedFlat(patch_t *patch, UINT16 *raw, boolean flip);
|
||||
patch_t *R_FlatToPatch(UINT8 *raw, UINT16 width, UINT16 height, UINT16 leftoffset, UINT16 topoffset, size_t *destsize, boolean transparency);
|
||||
patch_t *R_MaskedFlatToPatch(UINT16 *raw, UINT16 width, UINT16 height, UINT16 leftoffset, UINT16 topoffset, size_t *destsize);
|
||||
|
||||
// SpriteInfo
|
||||
extern spriteinfo_t spriteinfo[NUMSPRITES];
|
||||
void R_LoadSpriteInfoLumps(UINT16 wadnum, UINT16 numlumps);
|
||||
void R_ParseSPRTINFOLump(UINT16 wadNum, UINT16 lumpNum);
|
||||
|
||||
// Sprite rotation
|
||||
#ifdef ROTSPRITE
|
||||
INT32 R_GetRollAngle(angle_t rollangle);
|
||||
patch_t *Patch_GetRotatedSprite(
|
||||
spriteframe_t *sprite,
|
||||
size_t frame, size_t spriteangle,
|
||||
boolean flip, boolean adjustfeet,
|
||||
void *info, INT32 rotationangle);
|
||||
rotsprite_t *RotatedPatch_Create(INT32 numangles);
|
||||
void RotatedPatch_DoRotation(rotsprite_t *rotsprite, patch_t *patch, INT32 angle, INT32 xpivot, INT32 ypivot, boolean flip);
|
||||
|
||||
extern fixed_t rollcosang[ROTANGLES];
|
||||
extern fixed_t rollsinang[ROTANGLES];
|
||||
#endif
|
||||
|
||||
#endif // __R_PATCH__
|
||||
+1
-1
@@ -1373,7 +1373,7 @@ static void R_ProjectSprite(mobj_t *thing)
|
||||
rollsum = (thing->rollangle) + (thing->sloperoll);
|
||||
|
||||
rollangle = R_GetRollAngle(rollsum);
|
||||
rotsprite = Patch_GetRotatedSprite(sprframe, (thing->frame & FF_FRAMEMASK), rot, flip, sprinfo, rollangle);
|
||||
rotsprite = Patch_GetRotatedSprite(sprframe, (thing->frame & FF_FRAMEMASK), rot, flip, false, sprinfo, rollangle);
|
||||
|
||||
if (rotsprite != NULL)
|
||||
{
|
||||
|
||||
@@ -59,6 +59,7 @@
|
||||
#endif
|
||||
|
||||
#include "../doomstat.h"
|
||||
#include "../p_setup.h"
|
||||
#include "../i_system.h"
|
||||
#include "../v_video.h"
|
||||
#include "../m_argv.h"
|
||||
@@ -969,6 +970,7 @@ static void Impl_HandleControllerButtonEvent(SDL_ControllerButtonEvent evt, Uint
|
||||
void I_GetEvent(void)
|
||||
{
|
||||
SDL_Event evt;
|
||||
char* dropped_filedir;
|
||||
// We only want the first motion event,
|
||||
// otherwise we'll end up catching the warp back to center.
|
||||
//int mouseMotionOnce = 0;
|
||||
@@ -1293,6 +1295,11 @@ void I_GetEvent(void)
|
||||
if (currentMenu == &OP_JoystickSetDef)
|
||||
M_SetupJoystickMenu(0);
|
||||
break;
|
||||
case SDL_DROPFILE:
|
||||
dropped_filedir = evt.drop.file;
|
||||
P_AddWadFile(dropped_filedir);
|
||||
SDL_free(dropped_filedir); // Free dropped_filedir memory
|
||||
break;
|
||||
case SDL_QUIT:
|
||||
I_Quit();
|
||||
M_QuitResponse('y');
|
||||
|
||||
Reference in new issue
Block a user