mirror of
https://git.do.srb2.org/KartKrew/Kart-Public.git
synced 2025-01-17 23:21:05 +00:00
Match Kart-Public's next since it got merged anyway
and fix something else
This commit is contained in:
parent
6b6485159f
commit
2ff4a3ca75
5 changed files with 48 additions and 41 deletions
|
@ -428,13 +428,17 @@ INT32 I_GetKey(void);
|
|||
#define max(x, y) (((x) > (y)) ? (x) : (y))
|
||||
#endif
|
||||
|
||||
#ifndef M_PIl
|
||||
#define M_PIl 3.1415926535897932384626433832795029L
|
||||
#endif
|
||||
|
||||
// Floating point comparison epsilons from float.h
|
||||
#ifndef FLT_EPSILON
|
||||
#define FLT_EPSILON 1.1920928955078125e-7f
|
||||
#endif
|
||||
|
||||
#ifndef DBL_EPSILON
|
||||
#define DBL_EPSILON 2.2204460492503131e-16
|
||||
#define DBL_EPSILON 2.2204460492503131e-16l
|
||||
#endif
|
||||
|
||||
// An assert-type mechanism.
|
||||
|
|
|
@ -114,7 +114,7 @@ static polyvertex_t *fracdivline(fdivline_t *bsp, polyvertex_t *v1,
|
|||
// (do not accept hit with the extensions)
|
||||
num = (v2x - v1x)*v2dy + (v1y - v2y)*v2dx;
|
||||
frac = num / den;
|
||||
if (frac < 0.0 || frac > 1.0)
|
||||
if (frac < 0.0l || frac > 1.0l)
|
||||
return NULL;
|
||||
|
||||
// now get the frac along the BSP line
|
||||
|
|
|
@ -59,9 +59,6 @@
|
|||
// ==========================================================================
|
||||
|
||||
// Constants
|
||||
#ifndef M_PIl
|
||||
#define M_PIl 3.1415926535897932384626433832795029L
|
||||
#endif
|
||||
#define DEGREE (0.017453292519943295769236907684883l) // 2*PI/360
|
||||
|
||||
void GL_DBG_Printf(const char *format, ...) /*FUNCPRINTF*/;
|
||||
|
|
|
@ -1894,6 +1894,10 @@ static void CreateModelVBO(mesh_t *mesh, mdlframe_t *frame)
|
|||
pglBindBuffer(GL_ARRAY_BUFFER, frame->vboID);
|
||||
pglBufferData(GL_ARRAY_BUFFER, bufferSize, buffer, GL_STATIC_DRAW);
|
||||
free(buffer);
|
||||
|
||||
// Don't leave the array buffer bound to the model,
|
||||
// since this is called mid-frame
|
||||
pglBindBuffer(GL_ARRAY_BUFFER, 0);
|
||||
}
|
||||
|
||||
static void CreateModelVBOTiny(mesh_t *mesh, tinyframe_t *frame)
|
||||
|
@ -1935,6 +1939,10 @@ static void CreateModelVBOTiny(mesh_t *mesh, tinyframe_t *frame)
|
|||
pglBindBuffer(GL_ARRAY_BUFFER, frame->vboID);
|
||||
pglBufferData(GL_ARRAY_BUFFER, bufferSize, buffer, GL_STATIC_DRAW);
|
||||
free(buffer);
|
||||
|
||||
// Don't leave the array buffer bound to the model,
|
||||
// since this is called mid-frame
|
||||
pglBindBuffer(GL_ARRAY_BUFFER, 0);
|
||||
}
|
||||
|
||||
EXPORT void HWRAPI(CreateModelVBOs) (model_t *model)
|
||||
|
@ -2181,10 +2189,13 @@ EXPORT void HWRAPI(DrawModel) (model_t *model, INT32 frameIndex, INT32 duration,
|
|||
EXPORT void HWRAPI(SetTransform) (FTransform *stransform, angle_t viewaiming)
|
||||
{
|
||||
static boolean special_splitscreen;
|
||||
GLdouble used_fov;
|
||||
boolean shearing = false;
|
||||
pglLoadIdentity();
|
||||
if (stransform)
|
||||
{
|
||||
boolean fovx90;
|
||||
used_fov = stransform->fovxangle;
|
||||
shearing = stransform->shearing;
|
||||
// keep a trace of the transformation for md2
|
||||
memcpy(&md2_transform, stransform, sizeof (md2_transform));
|
||||
|
||||
|
@ -2204,13 +2215,22 @@ EXPORT void HWRAPI(SetTransform) (FTransform *stransform, angle_t viewaiming)
|
|||
pglRotatef(stransform->angley+270.0f, 0.0f, 1.0f, 0.0f);
|
||||
pglTranslatef(-stransform->x, -stransform->z, -stransform->y);
|
||||
|
||||
special_splitscreen = (stransform->splitscreen == 1);
|
||||
}
|
||||
else
|
||||
{
|
||||
//Hurdler: is "fov" correct?
|
||||
used_fov = fov;
|
||||
pglScalef(1.0f, 1.0f, -1.0f);
|
||||
}
|
||||
|
||||
pglMatrixMode(GL_PROJECTION);
|
||||
pglLoadIdentity();
|
||||
|
||||
// jimita 14042019
|
||||
// Simulate Software's y-shearing
|
||||
// https://zdoom.org/wiki/Y-shearing
|
||||
if (stransform->shearing)
|
||||
if (shearing)
|
||||
{
|
||||
float tilt = (float)(viewaiming>>ANGLETOFINESHIFT)*(360.0f/(float)FINEANGLES);
|
||||
if (tilt >= 270.0f)
|
||||
|
@ -2220,29 +2240,15 @@ EXPORT void HWRAPI(SetTransform) (FTransform *stransform, angle_t viewaiming)
|
|||
pglTranslatef(0.0f, -tilt, 0.0f);
|
||||
}
|
||||
|
||||
fovx90 = stransform->fovxangle > 0.0f && fabsf(stransform->fovxangle - 90.0f) < 0.5f;
|
||||
special_splitscreen = (stransform->splitscreen && fovx90);
|
||||
if (special_splitscreen)
|
||||
GLPerspective(53.13f, 2*ASPECT_RATIO); // 53.13 = 2*atan(0.5)
|
||||
else
|
||||
GLPerspective(stransform->fovxangle, ASPECT_RATIO);
|
||||
pglGetFloatv(GL_PROJECTION_MATRIX, projMatrix); // added for new coronas' code (without depth buffer)
|
||||
pglMatrixMode(GL_MODELVIEW);
|
||||
}
|
||||
else
|
||||
{
|
||||
pglScalef(1.0f, 1.0f, -1.0f);
|
||||
|
||||
pglMatrixMode(GL_PROJECTION);
|
||||
pglLoadIdentity();
|
||||
if (special_splitscreen)
|
||||
GLPerspective(53.13f, 2*ASPECT_RATIO); // 53.13 = 2*atan(0.5)
|
||||
used_fov = atan(tan(used_fov*M_PIl/360)*0.8)*360/M_PIl;
|
||||
GLPerspective((GLfloat)used_fov, 2*ASPECT_RATIO);
|
||||
}
|
||||
else
|
||||
//Hurdler: is "fov" correct?
|
||||
GLPerspective(fov, ASPECT_RATIO);
|
||||
GLPerspective((GLfloat)used_fov, ASPECT_RATIO);
|
||||
pglGetFloatv(GL_PROJECTION_MATRIX, projMatrix); // added for new coronas' code (without depth buffer)
|
||||
pglMatrixMode(GL_MODELVIEW);
|
||||
}
|
||||
|
||||
pglGetFloatv(GL_MODELVIEW_MATRIX, modelMatrix); // added for new coronas' code (without depth buffer)
|
||||
}
|
||||
|
|
|
@ -973,7 +973,7 @@ void R_DrawSinglePlane(visplane_t *pl)
|
|||
temp = P_GetZAt(pl->slope, pl->viewx, pl->viewy);
|
||||
zeroheight = FIXED_TO_FLOAT(temp);
|
||||
|
||||
#define ANG2RAD(angle) ((float)((angle)*M_PI)/ANGLE_180)
|
||||
#define ANG2RAD(angle) ((float)((angle)*M_PIl)/ANGLE_180)
|
||||
|
||||
// p is the texture origin in view space
|
||||
// Don't add in the offsets at this stage, because doing so can result in
|
||||
|
|
Loading…
Reference in a new issue