Merge remote-tracking branch 'birdhouse/motion-sickness' into Galaxy-Redux

This commit is contained in:
Galactice committed 2022-11-08 10:54:14 -05:00
commit eaff01f9f6
22 files changed
+155 -37

No files matched your search

+8
View File
@@ -110,6 +110,8 @@ int snprintf(char *str, size_t n, const char *fmt, ...);
// platform independant focus loss
UINT8 window_notinfocus = false;
INT32 window_x;
INT32 window_y;
//
// DEMO LOOP
@@ -288,6 +290,9 @@ static void D_Display(void)
if (vid.recalc)
SCR_Recalc(); // NOTE! setsizeneeded is set by SCR_Recalc()
if (rendermode == render_soft && !splitscreen)
R_CheckViewMorph();
// change the view size if needed
if (setsizeneeded)
{
@@ -499,6 +504,9 @@ static void D_Display(void)
if (rendermode == render_soft)
{
if (!splitscreen)
R_ApplyViewMorph();
for (i = 0; i <= splitscreen; i++)
{
if (postimgtype[i])
+3
View File
@@ -369,6 +369,9 @@ typedef struct player_s
// bounded/scaled total momentum.
//fixed_t bob;
angle_t viewrollangle;
angle_t tilt;
// Mouse aiming, where the guy is looking at!
// It is updated with cmd->aiming.
angle_t aiming;
+2 -1
View File
@@ -518,6 +518,7 @@ extern INT32 cv_debug;
#define DBG_MEMORY 0x0200
#define DBG_SETUP 0x0400
#define DBG_LUA 0x0800
#define DBG_VIEWMORPH 0x2000
// =======================
// Misc stuff for later...
@@ -528,7 +529,7 @@ extern UINT8 shiftdown, ctrldown, altdown;
extern boolean capslock;
// WARNING: a should be unsigned but to add with 2048, it isn't!
#define AIMINGTODY(a) (FINETANGENT((2048+(((INT32)a)>>ANGLETOFINESHIFT)) & FINEMASK)*160)
#define AIMINGTODY(a) FixedDiv((FINETANGENT((2048+(((INT32)a)>>ANGLETOFINESHIFT)) & FINEMASK)*160), fovtan)
// if we ever make our alloc stuff...
#define ZZ_Alloc(x) Z_Malloc(x, PU_STATIC, NULL)
+3
View File
@@ -108,6 +108,8 @@ extern boolean digital_disabled;
extern boolean menuactive; // Menu overlaid?
extern UINT8 paused; // Game paused?
extern UINT8 window_notinfocus; // are we in focus? (backend independant -- handles auto pausing and display of "focus lost" message)
extern INT32 window_x;
extern INT32 window_y;
extern boolean nodrawers;
extern boolean noblit;
@@ -191,6 +193,7 @@ extern struct quake
{
// camera offsets and duration
fixed_t x,y,z;
angle_t roll;
UINT16 time;
// location, radius, and intensity...
+2
View File
@@ -155,6 +155,8 @@ typedef struct
FLOAT fovxangle, fovyangle;
UINT8 splitscreen;
boolean flip; // screenflip
boolean roll;
FLOAT rollangle;
#ifdef USE_FTRANSFORM_MIRROR
boolean mirror; // SRB2Kart: Encore Mode
#endif
+10 -3
View File
@@ -2298,8 +2298,11 @@ void HWR_RenderPolyObjectPlane(polyobj_t *polysector, boolean isceiling, fixed_t
}
// reference point for flat texture coord for each vertex around the polygon
flatxref = (float)(((fixed_t)FIXED_TO_FLOAT(polysector->origVerts[0].x) & (~flatflag)) / fflatsize);
flatyref = (float)(((fixed_t)FIXED_TO_FLOAT(polysector->origVerts[0].y) & (~flatflag)) / fflatsize);
flatxref = FIXED_TO_FLOAT(polysector->origVerts[0].x);
flatyref = FIXED_TO_FLOAT(polysector->origVerts[0].y);
flatxref = (float)(((fixed_t)flatxref & (~flatflag)) / fflatsize);
flatyref = (float)(((fixed_t)flatyref & (~flatflag)) / fflatsize);
// transform
v3d = planeVerts;
@@ -4662,6 +4665,8 @@ void HWR_DrawSkyBackground(float fpov)
dometransform.scalez = 1;
dometransform.fovxangle = fpov; // Tails
dometransform.fovyangle = fpov; // Tails
dometransform.rollangle = atransform.rollangle;
dometransform.roll = atransform.roll;
dometransform.splitscreen = splitscreen;
HWR_GetTexture(texturetranslation[skytexture]);
@@ -4755,6 +4760,8 @@ void HWR_RenderFrame(INT32 viewnumber, player_t *player, boolean skybox)
gr_viewsin = FIXED_TO_FLOAT(viewsin);
gr_viewcos = FIXED_TO_FLOAT(viewcos);
memset(&atransform, 0x00, sizeof(FTransform));
// Set T&L transform
atransform.x = gr_viewx;
atransform.y = gr_viewy;
@@ -4785,7 +4792,7 @@ void HWR_RenderFrame(INT32 viewnumber, player_t *player, boolean skybox)
atransform.fovyangle = fpov; // Tails
if (player->viewrollangle != 0)
{
fixed_t rol = AngleFixed(R_LerpAngle(player, viewrollangle));
fixed_t rol = AngleFixed(player->viewrollangle);
atransform.rollangle = FIXED_TO_FLOAT(rol);
atransform.roll = true;
}
+2
View File
@@ -1093,6 +1093,8 @@ void HWR_DrawMD2(gr_vissprite_t *spr)
if (spr->precip)
return;
memset(&p, 0x00, sizeof(FTransform));
// MD2 colormap fix
// colormap test
if (spr->mobj->subsector)
+4 -1
View File
@@ -28,6 +28,8 @@
#include "../../p_tick.h" // for leveltime (NOTE: THIS IS BAD, FIGURE OUT HOW TO PROPERLY IMPLEMENT gl_leveltime)
extern fixed_t fovtan; // also extremely bad, I'm just too lazy!!!
#if defined (HWRENDER) && !defined (NOROPENGL)
struct GLRGBAFloat
@@ -3098,7 +3100,8 @@ EXPORT void HWRAPI(SetTransform) (FTransform *stransform)
else
pglScalef(stransform->scalex, stransform->scaley, -stransform->scalez);
pglMatrixMode(GL_MODELVIEW);
if (stransform->roll)
pglRotatef(stransform->rollangle, 0.0f, 0.0f, 1.0f);
pglRotatef(stransform->anglex, 1.0f, 0.0f, 0.0f);
pglRotatef(stransform->angley+270.0f, 0.0f, 1.0f, 0.0f);
pglTranslatef(-stransform->x, -stransform->z, -stransform->y);
+2
View File
@@ -369,4 +369,6 @@ const char *I_ClipboardPaste(void);
void I_RegisterSysCommands(void);
void I_CursedWindowMovement(int xd, int yd);
#endif
+14 -2
View File
@@ -43,8 +43,20 @@ typedef INT32 fixed_t;
/*!
\brief convert fixed_t into floating number
*/
#define FIXED_TO_FLOAT(x) (((float)(x)) / ((float)FRACUNIT))
#define FLOAT_TO_FIXED(f) (fixed_t)((f) * ((float)FRACUNIT))
FUNCMATH FUNCINLINE static ATTRINLINE float FixedToFloat(fixed_t x)
{
return x / (float)FRACUNIT;
}
FUNCMATH FUNCINLINE static ATTRINLINE fixed_t FloatToFixed(float f)
{
return (fixed_t)(f * FRACUNIT);
}
// for backwards compat
#define FIXED_TO_FLOAT(x) FixedToFloat(x) // (((float)(x)) / ((float)FRACUNIT))
#define FLOAT_TO_FIXED(f) FloatToFixed(f) // (fixed_t)((f) * ((float)FRACUNIT))
#if defined (__WATCOMC__) && FRACBITS == 16
+11 -1
View File
@@ -23,6 +23,7 @@
#include "lua_script.h"
#include "lua_hook.h"
#include "k_kart.h"
#include "i_system.h"
#include "r_main.h"
#include "r_fps.h"
#include "i_video.h" // rendermode
@@ -761,10 +762,19 @@ void P_Ticker(boolean run)
quake.x = M_RandomRange(-ir,ir);
quake.y = M_RandomRange(-ir,ir);
quake.z = M_RandomRange(-ir,ir);
if (cv_windowquake.value)
I_CursedWindowMovement(FixedInt(quake.x), FixedInt(quake.y));
ir >>= 2;
ir = M_RandomRange(-ir,ir);
if (ir < 0)
ir = ANGLE_MAX - FixedAngle(-ir);
else
ir = FixedAngle(ir);
quake.roll = ir;
--quake.time;
}
else
quake.x = quake.y = quake.z = 0;
quake.x = quake.y = quake.z = quake.roll = 0;
if (metalplayback)
G_ReadMetalTic(metalplayback);
+4
View File
@@ -5192,6 +5192,8 @@ static void P_NiGHTSMovement(player_t *player)
else // AngleFixed(R_PointToAngle2()) results in slight inaccuracy! Don't use it unless movement is on both axises.
newangle = (INT16)FixedInt(AngleFixed(R_PointToAngle2(0,0, cmd->sidemove*FRACUNIT, cmd->forwardmove*FRACUNIT)));
newangle -= player->viewrollangle / ANG1;
if (newangle < 0 && moved)
newangle = (INT16)(360+newangle);
}
@@ -8993,6 +8995,8 @@ void P_PlayerThink(player_t *player)
K_KartPlayerThink(player, cmd); // SRB2kart
DoABarrelRoll(player);
#ifdef HAVE_BLUA
LUAh_PlayerThink(player);
#endif
+2
View File
@@ -62,6 +62,8 @@ extern fixed_t ds_xfrac, ds_yfrac, ds_xstep, ds_ystep;
extern UINT8 *ds_source; // start of a 64*64 tile image
extern UINT8 *ds_transmap;
extern INT32 ds_bgofs;
typedef struct {
float x, y, z;
} floatv3_t;
+4 -3
View File
@@ -643,6 +643,7 @@ void R_CalcTiltedLighting(fixed_t start, fixed_t end)
}
}
#define PLANELIGHTFLOAT (BASEVIDWIDTH * BASEVIDWIDTH / vid.width / (zeroheight - FIXED_TO_FLOAT(viewz)) / 21.0f * FIXED_TO_FLOAT(fovtan))
/** \brief The R_DrawTiltedSpan_8 function
Draw slopes! Holy sheit!
@@ -668,7 +669,7 @@ void R_DrawTiltedSpan_8(void)
// Lighting is simple. It's just linear interpolation from start to end
{
float planelightfloat = BASEVIDWIDTH*BASEVIDWIDTH/vid.width / (zeroheight - FIXED_TO_FLOAT(viewz)) / 21.0f;
float planelightfloat = PLANELIGHTFLOAT;
float lightstart, lightend;
lightend = (iz + ds_sz.x*width) * planelightfloat;
@@ -804,7 +805,7 @@ void R_DrawTiltedTranslucentSpan_8(void)
// Lighting is simple. It's just linear interpolation from start to end
{
float planelightfloat = BASEVIDWIDTH*BASEVIDWIDTH/vid.width / (zeroheight - FIXED_TO_FLOAT(viewz)) / 21.0f;
float planelightfloat = PLANELIGHTFLOAT;
float lightstart, lightend;
lightend = (iz + ds_sz.x*width) * planelightfloat;
@@ -938,7 +939,7 @@ void R_DrawTiltedSplat_8(void)
// Lighting is simple. It's just linear interpolation from start to end
{
float planelightfloat = BASEVIDWIDTH*BASEVIDWIDTH/vid.width / (zeroheight - FIXED_TO_FLOAT(viewz)) / 21.0f;
float planelightfloat = PLANELIGHTFLOAT;
float lightstart, lightend;
lightend = (iz + ds_sz.x*width) * planelightfloat;
+50 -4
View File
@@ -605,6 +605,8 @@ static inline void R_InitLightTables(void)
}
}
//#define WOUGHMP_WOUGHMP // I got a fish-eye lens - I'll make a rap video with a couple of friends
// it's kinda laggy sometimes
static struct {
angle_t rollangle; // pre-shifted by fineshift
@@ -647,7 +649,7 @@ void R_CheckViewMorph(void)
float fisheyemap[MAXVIDWIDTH/2 + 1];
#endif
angle_t rollangle = R_LerpAngle(&players[displayplayers[0]], viewrollangle);
angle_t rollangle = players[displayplayers[0]].viewrollangle;
#ifdef WOUGHMP_WOUGHMP
fixed_t fisheye = cv_cam2_turnmultiplier.value; // temporary test value
#endif
@@ -954,7 +956,7 @@ void R_ExecuteSetViewSize(void)
centeryfrac = centery<<FRACBITS;
fov = FixedAngle(cv_fov.value/2) + ANGLE_90;
fovtan = FINETANGENT(fov >> ANGLETOFINESHIFT);
fovtan = FixedMul(FINETANGENT(fov >> ANGLETOFINESHIFT), viewmorph.zoomneeded);
if (splitscreen == 1) // Splitscreen FOV should be adjusted to maintain expected vertical view
fovtan = 17*fovtan/10;
@@ -1093,6 +1095,31 @@ subsector_t *R_IsPointInSubsector(fixed_t x, fixed_t y)
static mobj_t *viewmobj;
// recalc necessary stuff for mouseaiming
// slopes are already calculated for the full possible view (which is 4*viewheight).
// 18/08/18: (No it's actually 16*viewheight, thanks Jimita for finding this out)
static void R_SetupFreelook(void)
{
INT32 dy = 0;
// clip it in the case we are looking a hardware 90 degrees full aiming
// (lmps, network and use F12...)
if (rendermode == render_soft
#ifdef HWRENDER
|| cv_grshearing.value
#endif
)
G_SoftwareClipAimingPitch((INT32 *)&aimingangle);
if (rendermode == render_soft)
{
dy = (AIMINGTODY(aimingangle)>>FRACBITS) * viewwidth/BASEVIDWIDTH;
yslope = &yslopetab[viewheight*8 - (viewheight/2 + dy)];
}
centery = (viewheight/2) + dy;
centeryfrac = centery<<FRACBITS;
}
void R_SkyboxFrame(player_t *player)
{
camera_t *thiscam = &camera[0];
@@ -1671,9 +1698,22 @@ void R_RenderPlayerView(player_t *player)
validcount++;
// Clear buffers.
R_ClearClipSegs();
R_ClearDrawSegs();
R_ClearPlanes();
if (viewmorph.use)
{
portalclipstart = viewmorph.x1;
portalclipend = viewwidth-viewmorph.x1-1;
R_PortalClearClipSegs(portalclipstart, portalclipend);
memcpy(ceilingclip, viewmorph.ceilingclip, sizeof(INT16)*vid.width);
memcpy(floorclip, viewmorph.floorclip, sizeof(INT16)*vid.width);
}
else
{
portalclipstart = 0;
portalclipend = viewwidth-1;
R_ClearClipSegs();
}
R_ClearDrawSegs();
R_ClearSprites();
#ifdef FLOORSPLATS
R_ClearVisibleFloorSplats();
@@ -1823,6 +1863,12 @@ void R_RegisterEngineStuff(void)
CV_RegisterVar(&cv_driftsparkpulse);
CV_RegisterVar(&cv_tilting);
CV_RegisterVar(&cv_quaketilt);
CV_RegisterVar(&cv_tiltsmoothing);
CV_RegisterVar(&cv_actionmovie);
CV_RegisterVar(&cv_windowquake);
CV_RegisterVar(&cv_showhud);
CV_RegisterVar(&cv_translucenthud);
+6
View File
@@ -26,6 +26,7 @@ extern INT32 centerx, centery;
extern fixed_t centerxfrac, centeryfrac;
extern fixed_t projection, projectiony;
extern fixed_t fovtan; // field of view
extern size_t validcount, linecount, loopcount, framecount;
@@ -52,6 +53,8 @@ extern boolean renderisnewtic;
#define MAXLIGHTZ 128
#define LIGHTZSHIFT 20
#define LIGHTRESOLUTIONFIX (640*fovtan/vid.width)
extern lighttable_t *scalelight[LIGHTLEVELS][MAXLIGHTSCALE];
extern lighttable_t *scalelightfixed[MAXLIGHTSCALE];
extern lighttable_t *zlight[LIGHTLEVELS][MAXLIGHTZ];
@@ -93,6 +96,9 @@ extern consvar_t cv_tailspickup;
// Called by startup code.
void R_Init(void);
void R_CheckViewMorph(void);
void R_ApplyViewMorph(void);
// just sets setsizeneeded true
extern boolean setsizeneeded;
void R_SetViewSize(void);
+9 -9
View File
@@ -177,7 +177,7 @@ void R_PortalRestoreClipValues(INT32 start, INT32 end, INT16 *ceil, INT16 *floor
// viewheight
#ifndef NOWATER
static INT32 bgofs;
INT32 ds_bgofs;
static INT32 wtofs=0;
static INT32 waterofs;
static boolean itswater;
@@ -210,7 +210,7 @@ static void R_DrawTranslucentWaterSpan_8(void)
source = ds_source;
colormap = ds_colormap;
dest = ylookup[ds_y] + columnofs[ds_x1];
dsrc = screens[1] + (ds_y+bgofs)*vid.width + ds_x1;
dsrc = screens[1] + (ds_y+ds_bgofs)*vid.width + ds_x1;
count = ds_x2 - ds_x1 + 1;
while (count >= 8)
@@ -308,17 +308,17 @@ void R_MapPlane(INT32 y, INT32 x1, INT32 x2)
{
const INT32 yay = (wtofs + (distance>>9) ) & 8191;
// ripples da water texture
bgofs = FixedDiv(FINESINE(yay), (1<<12) + (distance>>11))>>FRACBITS;
ds_bgofs = FixedDiv(FINESINE(yay), (1<<12) + (distance>>11))>>FRACBITS;
angle = (currentplane->viewangle + currentplane->plangle + xtoviewangle[x1])>>ANGLETOFINESHIFT;
angle = (angle + 2048) & 8191; // 90 degrees
ds_xfrac += FixedMul(FINECOSINE(angle), (bgofs<<FRACBITS));
ds_yfrac += FixedMul(FINESINE(angle), (bgofs<<FRACBITS));
ds_xfrac += FixedMul(FINECOSINE(angle), (ds_bgofs<<FRACBITS));
ds_yfrac += FixedMul(FINESINE(angle), (ds_bgofs<<FRACBITS));
if (y+bgofs>=viewheight)
bgofs = viewheight-y-1;
if (y+bgofs<0)
bgofs = -y;
if (y+ds_bgofs>=viewheight)
ds_bgofs = viewheight-y-1;
if (y+ds_bgofs<0)
ds_bgofs = -y;
}
#endif
+7 -7
View File
@@ -194,7 +194,7 @@ static void R_DrawWallSplats(void)
// draw the columns
for (dc_x = x1; dc_x <= x2; dc_x++, spryscale += rw_scalestep)
{
pindex = FixedMul(spryscale, FixedDiv(640, vid.width))>>LIGHTSCALESHIFT;
pindex = FixedMul(spryscale, LIGHTRESOLUTIONFIX)>>LIGHTSCALESHIFT;
if (pindex >= MAXLIGHTSCALE)
pindex = MAXLIGHTSCALE - 1;
dc_colormap = walllights[pindex];
@@ -547,7 +547,7 @@ void R_RenderMaskedSegRange(drawseg_t *ds, INT32 x1, INT32 x2)
else
xwalllights = scalelight[rlight->lightnum];
pindex = FixedMul(spryscale, FixedDiv(640, vid.width))>>LIGHTSCALESHIFT;
pindex = FixedMul(spryscale, LIGHTRESOLUTIONFIX)>>LIGHTSCALESHIFT;
if (pindex >= MAXLIGHTSCALE)
pindex = MAXLIGHTSCALE - 1;
@@ -596,7 +596,7 @@ void R_RenderMaskedSegRange(drawseg_t *ds, INT32 x1, INT32 x2)
}
// calculate lighting
pindex = FixedMul(spryscale, FixedDiv(640, vid.width))>>LIGHTSCALESHIFT;
pindex = FixedMul(spryscale, LIGHTRESOLUTIONFIX)>>LIGHTSCALESHIFT;
if (pindex >= MAXLIGHTSCALE)
pindex = MAXLIGHTSCALE - 1;
@@ -1080,7 +1080,7 @@ void R_RenderThickSideRange(drawseg_t *ds, INT32 x1, INT32 x2, ffloor_t *pfloor)
else
xwalllights = scalelight[lightnum];
pindex = FixedMul(spryscale, FixedDiv(640, vid.width))>>LIGHTSCALESHIFT;
pindex = FixedMul(spryscale, LIGHTRESOLUTIONFIX)>>LIGHTSCALESHIFT;
if (pindex >= MAXLIGHTSCALE)
pindex = MAXLIGHTSCALE-1;
@@ -1181,7 +1181,7 @@ void R_RenderThickSideRange(drawseg_t *ds, INT32 x1, INT32 x2, ffloor_t *pfloor)
}
// calculate lighting
pindex = FixedMul(spryscale, FixedDiv(640, vid.width))>>LIGHTSCALESHIFT;
pindex = FixedMul(spryscale, LIGHTRESOLUTIONFIX)>>LIGHTSCALESHIFT;
if (pindex >= MAXLIGHTSCALE)
pindex = MAXLIGHTSCALE - 1;
@@ -1374,7 +1374,7 @@ static void R_RenderSegLoop (void)
if (segtextured)
{
// calculate lighting
pindex = FixedMul(rw_scale, FixedDiv(640, vid.width))>>LIGHTSCALESHIFT;
pindex = FixedMul(rw_scale, LIGHTRESOLUTIONFIX)>>LIGHTSCALESHIFT;
if (pindex >= MAXLIGHTSCALE)
pindex = MAXLIGHTSCALE-1;
@@ -1411,7 +1411,7 @@ static void R_RenderSegLoop (void)
else
xwalllights = scalelight[lightnum];
pindex = FixedMul(rw_scale, FixedDiv(640, vid.width))>>LIGHTSCALESHIFT;
pindex = FixedMul(rw_scale, LIGHTRESOLUTIONFIX)>>LIGHTSCALESHIFT;
if (pindex >= MAXLIGHTSCALE)
pindex = MAXLIGHTSCALE-1;
+1 -4
View File
@@ -80,8 +80,5 @@ void R_SetupSkyDraw(void)
void R_SetSkyScale(void)
{
fixed_t difference = vid.fdupx-(vid.dupx<<FRACBITS);
fixed_t scr = FRACUNIT;
if (splitscreen > 1)
scr *= 2;
skyscale = FixedDiv(scr, vid.fdupx+difference);
skyscale = FixedDiv(fovtan, vid.fdupx+difference);
}
+2 -2
View File
@@ -1117,7 +1117,7 @@ static void R_SplitSprite(vissprite_t *sprite, mobj_t *thing)
if (!((thing->frame & (FF_FULLBRIGHT|FF_TRANSMASK) || thing->flags2 & MF2_SHADOW)
&& (!newsprite->extra_colormap || !(newsprite->extra_colormap->fog & 1))))
{
lindex = FixedMul(sprite->xscale, FixedDiv(640, vid.width))>>(LIGHTSCALESHIFT);
lindex = FixedMul(sprite->xscale, LIGHTRESOLUTIONFIX)>>(LIGHTSCALESHIFT);
if (lindex >= MAXLIGHTSCALE)
lindex = MAXLIGHTSCALE-1;
@@ -1514,7 +1514,7 @@ static void R_ProjectSprite(mobj_t *thing)
else
{
// diminished light
lindex = FixedMul(xscale, FixedDiv(640, vid.width))>>(LIGHTSCALESHIFT);
lindex = FixedMul(xscale, LIGHTRESOLUTIONFIX)>>(LIGHTSCALESHIFT);
if (lindex >= MAXLIGHTSCALE)
lindex = MAXLIGHTSCALE-1;
+6
View File
@@ -842,6 +842,12 @@ INT32 I_GetKey (void)
return rc;
}
void
I_CursedWindowMovement (int xd, int yd)
{
SDL_SetWindowPosition(window, window_x + xd, window_y + yd);
}
//
// I_JoyScale
//
+3
View File
@@ -623,6 +623,9 @@ static void Impl_HandleWindowEvent(SDL_WindowEvent evt)
break;
case SDL_WINDOWEVENT_MAXIMIZED:
break;
case SDL_WINDOWEVENT_MOVED:
window_x = evt.data1;
window_y = evt.data2;
}
if (mousefocus && kbfocus)