Merge branch 'Saturn-Next' into mobjcache2
This commit is contained in:
18 files changed
+212
-223
No files matched your search
+34
-51
@@ -1796,7 +1796,7 @@ static boolean SV_ResendingSavegameToAnyone(void)
|
||||
INT32 i;
|
||||
|
||||
for (i = 0; i < MAXNETNODES; i++)
|
||||
if (resendingsavegame[i])
|
||||
if (nodeingame[i] && resendingsavegame[i])
|
||||
return true;
|
||||
return false;
|
||||
}
|
||||
@@ -3240,7 +3240,7 @@ void CL_RemovePlayer(INT32 playernum, INT32 reason)
|
||||
|
||||
demo_extradata[playernum] |= DXD_PLAYSTATE;
|
||||
|
||||
if (server && !demo.playback)
|
||||
if (server && !demo.playback && playernode[playernum] != UINT8_MAX)
|
||||
{
|
||||
INT32 node = playernode[playernum];
|
||||
//playerpernode[node] = 0; // It'd be better to remove them all at once, but ghosting happened, so continue to let CL_RemovePlayer do it one-by-one
|
||||
@@ -3249,13 +3249,7 @@ void CL_RemovePlayer(INT32 playernum, INT32 reason)
|
||||
{
|
||||
SV_InitResynchVars(node); // If a resynch was in progress, well, it no longer needs to be.
|
||||
|
||||
nodeingame[node] = false;
|
||||
#ifdef SATURNPAK
|
||||
is_client_saturn[node] = false;
|
||||
#endif
|
||||
#ifdef SATURNSYNCH
|
||||
can_receive_gamestate[node] = false;
|
||||
#endif
|
||||
nodeingame[node] = false; // do we even need this?
|
||||
Net_CloseConnection(node);
|
||||
ResetNode(node);
|
||||
}
|
||||
@@ -3361,9 +3355,6 @@ void CL_Reset(void)
|
||||
if (servernode > 0 && servernode < MAXNETNODES)
|
||||
{
|
||||
nodeingame[(UINT8)servernode] = false;
|
||||
#ifdef SATURNPAK
|
||||
is_client_saturn[(UINT8)servernode] = false;
|
||||
#endif
|
||||
Net_CloseConnection(servernode);
|
||||
}
|
||||
D_CloseConnection(); // netgame = false
|
||||
@@ -3708,16 +3699,13 @@ static void Command_Kick(void)
|
||||
if (pn == -1 || pn == 0)
|
||||
return;
|
||||
|
||||
if (server)
|
||||
// Special case if we are trying to kick a player who is downloading the game state:
|
||||
// trigger a timeout instead of kicking them, because a kick would only
|
||||
// take effect after they have finished downloading
|
||||
if (server && playernode[pn] != UINT8_MAX && sendingsavegame[playernode[pn]])
|
||||
{
|
||||
// Special case if we are trying to kick a player who is downloading the game state:
|
||||
// trigger a timeout instead of kicking them, because a kick would only
|
||||
// take effect after they have finished downloading
|
||||
if (sendingsavegame[playernode[pn]])
|
||||
{
|
||||
Net_ConnectionTimeout(playernode[pn]);
|
||||
return;
|
||||
}
|
||||
Net_ConnectionTimeout(playernode[pn]);
|
||||
return;
|
||||
}
|
||||
|
||||
WRITESINT8(p, pn);
|
||||
@@ -3773,7 +3761,7 @@ static void Got_KickCmd(UINT8 **p, INT32 playernum)
|
||||
|
||||
// Is playernum authorized to make this kick?
|
||||
if (playernum != serverplayer && !IsPlayerAdmin(playernum)
|
||||
/*&& !(playerpernode[playernode[playernum]] == 2
|
||||
/*&& !(playernode[playernum] != UINT8_MAX && playerpernode[playernode[playernum]] == 2
|
||||
//&& nodetoplayer2[playernode[playernum]] == pnum)*/)
|
||||
{
|
||||
// We received a kick command from someone who isn't the
|
||||
@@ -5399,11 +5387,10 @@ static void HandlePacketFromPlayer(SINT8 node)
|
||||
}
|
||||
|
||||
// Check player consistancy during the level
|
||||
if (((!can_receive_gamestate[node]) && realstart <= gametic && realstart > gametic - TICQUEUE+1 && gamestate == GS_LEVEL
|
||||
&& consistancy[realstart%TICQUEUE] != SHORT(netbuffer->u.clientpak.consistancy)) || (can_receive_gamestate[node] && realstart <= gametic && realstart + TICQUEUE - 1 > gametic && gamestate == GS_LEVEL
|
||||
if (gamestate == GS_LEVEL
|
||||
&& (realstart > gametic - TICQUEUE+1 && realstart <= gametic)
|
||||
&& consistancy[realstart%TICQUEUE] != SHORT(netbuffer->u.clientpak.consistancy)
|
||||
&& !resendingsavegame[node] && savegameresendcooldown[node] <= I_GetTime()
|
||||
&& !SV_ResendingSavegameToAnyone()))
|
||||
&& (!can_receive_gamestate[node] || (!resendingsavegame[node] && savegameresendcooldown[node] <= I_GetTime() && !SV_ResendingSavegameToAnyone())))
|
||||
{
|
||||
//#ifndef SATURNPAK // lug: keep this behaviour for v7.1 atleast
|
||||
// we need to send this so the client can tell us if it can receive the savegame
|
||||
@@ -5615,12 +5602,6 @@ static void HandlePacketFromPlayer(SINT8 node)
|
||||
}
|
||||
Net_CloseConnection(node);
|
||||
nodeingame[node] = false;
|
||||
#ifdef SATURNPAK
|
||||
is_client_saturn[node] = false;
|
||||
#endif
|
||||
#ifdef SATURNSYNCH
|
||||
can_receive_gamestate[node] = false;
|
||||
#endif
|
||||
break;
|
||||
// -------------------------------------------- CLIENT RECEIVE ----------
|
||||
case PT_RESYNCHEND:
|
||||
@@ -6334,29 +6315,31 @@ static void SV_Maketic(void)
|
||||
INT32 j;
|
||||
|
||||
for (j = 0; j < MAXNETNODES; j++)
|
||||
if (playerpernode[j])
|
||||
{
|
||||
INT32 player = nodetoplayer[j];
|
||||
if ((netcmds[maketic%TICQUEUE][player].angleturn & TICCMD_RECEIVED) == 0)
|
||||
{ // we didn't receive this tic
|
||||
INT32 i;
|
||||
{
|
||||
if (!playerpernode[j])
|
||||
continue;
|
||||
|
||||
DEBFILE(va("MISS tic%4d for node %d\n", maketic, j));
|
||||
INT32 player = nodetoplayer[j];
|
||||
if ((netcmds[maketic%TICQUEUE][player].angleturn & TICCMD_RECEIVED) == 0)
|
||||
{ // we didn't receive this tic
|
||||
INT32 i;
|
||||
|
||||
DEBFILE(va("MISS tic%4d for node %d\n", maketic, j));
|
||||
#if defined(PARANOIA) && 0
|
||||
CONS_Debug(DBG_NETPLAY, "Client Misstic %d\n", maketic);
|
||||
CONS_Debug(DBG_NETPLAY, "Client Misstic %d\n", maketic);
|
||||
#endif
|
||||
// copy the old tic
|
||||
for (i = 0; i < playerpernode[j]; i++)
|
||||
{
|
||||
if (i == 0) player = nodetoplayer[j];
|
||||
else if (i == 1) player = nodetoplayer2[j];
|
||||
else if (i == 2) player = nodetoplayer3[j];
|
||||
else if (i == 3) player = nodetoplayer4[j];
|
||||
netcmds[maketic%TICQUEUE][player] = netcmds[(maketic-1)%TICQUEUE][player];
|
||||
netcmds[maketic%TICQUEUE][player].angleturn &= ~TICCMD_RECEIVED;
|
||||
}
|
||||
// copy the old tic
|
||||
for (i = 0; i < playerpernode[j]; i++)
|
||||
{
|
||||
if (i == 0) player = nodetoplayer[j];
|
||||
else if (i == 1) player = nodetoplayer2[j];
|
||||
else if (i == 2) player = nodetoplayer3[j];
|
||||
else if (i == 3) player = nodetoplayer4[j];
|
||||
netcmds[maketic%TICQUEUE][player] = netcmds[(maketic-1)%TICQUEUE][player];
|
||||
netcmds[maketic%TICQUEUE][player].angleturn &= ~TICCMD_RECEIVED;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// all tic are now proceed make the next
|
||||
maketic++;
|
||||
@@ -6585,7 +6568,7 @@ static void UpdatePingTable(void)
|
||||
PingUpdate();
|
||||
// update node latency values so we can take an average later.
|
||||
for (i = 0; i < MAXPLAYERS; i++)
|
||||
if (playeringame[i])
|
||||
if (playeringame[i] && playernode[i] != UINT8_MAX)
|
||||
realpingtable[i] += GetLag(playernode[i]);
|
||||
pingmeasurecount++;
|
||||
}
|
||||
|
||||
+4
-8
@@ -2515,9 +2515,9 @@ static void Command_Playdemo_f(void)
|
||||
return;
|
||||
}
|
||||
|
||||
if (netgame)
|
||||
if (gamestate == GS_LEVEL)
|
||||
{
|
||||
CONS_Printf(M_GetText("You can't play a demo while in a netgame.\n"));
|
||||
CONS_Printf(M_GetText("You can't play a demo while in a game.\n"));
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -2554,9 +2554,9 @@ static void Command_Timedemo_f(void)
|
||||
return;
|
||||
}
|
||||
|
||||
if (netgame)
|
||||
if (gamestate == GS_LEVEL)
|
||||
{
|
||||
CONS_Printf(M_GetText("You can't play a demo while in a netgame.\n"));
|
||||
CONS_Printf(M_GetText("You can't time a demo while in a game.\n"));
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -4886,10 +4886,6 @@ static void Got_RequestAddfilecmd(UINT8 **cp, INT32 playernum)
|
||||
boolean kick = false;
|
||||
boolean toomany = false;
|
||||
INT32 i,j;
|
||||
serverinfo_pak *dummycheck = NULL;
|
||||
|
||||
// Shut the compiler up.
|
||||
(void)dummycheck;
|
||||
|
||||
READSTRINGN(*cp, filename, 240);
|
||||
READMEM(*cp, md5sum, 16);
|
||||
|
||||
+6
-5
@@ -327,7 +327,8 @@ char menupath[1024];
|
||||
size_t menupathindex[menudepth];
|
||||
size_t menudepthleft = menudepth;
|
||||
|
||||
char menusearch[MAXSTRINGLENGTH+1];
|
||||
char menusearchbuf[MAXSTRINGLENGTH+1];
|
||||
textinput_t menusearch;
|
||||
|
||||
char **dirmenu, **coredirmenu; // core only local for this file
|
||||
size_t sizedirmenu, sizecoredirmenu; // ditto
|
||||
@@ -497,7 +498,7 @@ static boolean filemenucmp(char *haystack, char *needle)
|
||||
strupr(localhaystack);
|
||||
if (cv_addons_search_type.value)
|
||||
return (strstr(localhaystack, needle) != 0);
|
||||
return (!strncmp(localhaystack, needle, menusearch[0]));
|
||||
return (!strncmp(localhaystack, needle, menusearch.length));
|
||||
}
|
||||
|
||||
void closefilemenu(boolean validsize)
|
||||
@@ -563,7 +564,7 @@ void searchfilemenu(char *tempname)
|
||||
|
||||
first = (((UINT8)(coredirmenu[0][DIR_TYPE]) == EXT_UP) ? 1 : 0); // skip UP...
|
||||
|
||||
if (!menusearch[0])
|
||||
if (!menusearch.length)
|
||||
{
|
||||
if (dirmenu)
|
||||
Z_Free(dirmenu);
|
||||
@@ -590,7 +591,7 @@ void searchfilemenu(char *tempname)
|
||||
return;
|
||||
}
|
||||
|
||||
strcpy(localmenusearch, menusearch+1);
|
||||
strcpy(localmenusearch, menusearch.buffer);
|
||||
if (!cv_addons_search_case.value)
|
||||
strupr(localmenusearch);
|
||||
|
||||
@@ -652,7 +653,7 @@ boolean preparefilemenu(boolean samedepth, boolean replayhut)
|
||||
tempname = Z_StrDup(dirmenu[dir_on[menudepthleft]]+DIR_STRING); // don't need to I_Error if can't make - not important, just QoL
|
||||
}
|
||||
else
|
||||
menusearch[0] = menusearch[1] = 0; // clear search
|
||||
M_TextInputInit(&menusearch, menusearchbuf, MAXSTRINGLENGTH+1);
|
||||
|
||||
if (!(dirhandle = opendir(menupath))) // get directory
|
||||
{
|
||||
|
||||
+3
-1
@@ -7,6 +7,7 @@
|
||||
#include "doomdef.h"
|
||||
#include "d_netfil.h"
|
||||
#include "m_menu.h" // MAXSTRINGLENGTH
|
||||
#include "m_textinput.h"
|
||||
|
||||
extern consvar_t cv_addons_option, cv_addons_folder, cv_addons_md5, cv_addons_showall, cv_addons_search_case, cv_addons_search_type;
|
||||
|
||||
@@ -34,7 +35,8 @@ extern char menupath[1024];
|
||||
extern size_t menupathindex[menudepth];
|
||||
extern size_t menudepthleft;
|
||||
|
||||
extern char menusearch[MAXSTRINGLENGTH+1];
|
||||
extern char menusearchbuf[MAXSTRINGLENGTH+1];
|
||||
extern textinput_t menusearch;
|
||||
|
||||
extern char **dirmenu;
|
||||
extern size_t sizedirmenu;
|
||||
|
||||
@@ -340,6 +340,7 @@ enum hwdscreentexture
|
||||
HWD_SCREENTEXTURE_WIPE_END, // destination image for the wipe/fade effect
|
||||
HWD_SCREENTEXTURE_GENERIC1, // underwater/heat effect, intermission background
|
||||
HWD_SCREENTEXTURE_GENERIC2, // palette-based colormap fade, final screen texture
|
||||
HWD_SCREENTEXTURE_VHS,
|
||||
NUMSCREENTEXTURES, // (generic3 is unused if palette rendering is disabled)
|
||||
};
|
||||
typedef enum hwdscreentexture hwdscreentexture_t;
|
||||
|
||||
@@ -60,7 +60,7 @@ EXPORT void HWRAPI(FlushScreenTextures) (void);
|
||||
EXPORT void HWRAPI(DoScreenWipe) (int wipeStart, int wipeEnd);
|
||||
EXPORT void HWRAPI(DrawScreenTexture) (int tex, FSurfaceInfo *surf, FBITFIELD polyflags);
|
||||
EXPORT void HWRAPI(MakeScreenTexture) (int tex);
|
||||
EXPORT void HWRAPI(DrawScreenFinalTexture) (int tex, INT32 width, INT32 height);
|
||||
EXPORT void HWRAPI(DrawScreenFinalTexture) (int tex, INT32 width, INT32 height, boolean useshader);
|
||||
|
||||
EXPORT void HWRAPI(RenderVhsEffect) (fixed_t upbary, fixed_t downbary, UINT8 updistort, UINT8 downdistort, UINT8 barsize);
|
||||
|
||||
|
||||
+88
-75
@@ -3381,72 +3381,106 @@ static void HWR_DrawSpriteShadow(gl_vissprite_t *spr, GLPatch_t *gpatch)
|
||||
// This is expecting a pointer to an array containing 4 wallVerts for a sprite
|
||||
static void HWR_RotateSpritePolyToAim(gl_vissprite_t *spr, FOutVector *wallVerts, const boolean precip)
|
||||
{
|
||||
if (cv_glspritebillboarding.value && spr && spr->mobj && !(spr->mobj->frame & FF_PAPERSPRITE) && wallVerts)
|
||||
if (!cv_glspritebillboarding.value || !spr || !spr->mobj || !wallVerts)
|
||||
{
|
||||
// uncapped/interpolation
|
||||
interpmobjstate_t interp = {0};
|
||||
float basey, lowy;
|
||||
INT32 dist = -1;
|
||||
return;
|
||||
}
|
||||
|
||||
if (cv_maxinterpdist.value)
|
||||
dist = R_QuickCamDist(spr->mobj->x, spr->mobj->y);
|
||||
// uncapped/interpolation
|
||||
interpmobjstate_t interp = {0};
|
||||
float basey, lowy;
|
||||
INT32 dist = -1;
|
||||
|
||||
// do interpolation
|
||||
if (R_UsingFrameInterpolation() && !paused && (!cv_maxinterpdist.value || dist < cv_maxinterpdist.value))
|
||||
if (cv_maxinterpdist.value)
|
||||
dist = R_QuickCamDist(spr->mobj->x, spr->mobj->y);
|
||||
|
||||
// do interpolation
|
||||
if (R_UsingFrameInterpolation() && !paused && (!cv_maxinterpdist.value || dist < cv_maxinterpdist.value))
|
||||
{
|
||||
if (precip)
|
||||
{
|
||||
if (precip)
|
||||
{
|
||||
R_InterpolatePrecipMobjState((precipmobj_t *)spr->mobj, rendertimefrac, &interp);
|
||||
}
|
||||
else
|
||||
{
|
||||
R_InterpolateMobjState(spr->mobj, rendertimefrac, &interp);
|
||||
}
|
||||
R_InterpolatePrecipMobjState((precipmobj_t *)spr->mobj, rendertimefrac, &interp);
|
||||
}
|
||||
else
|
||||
{
|
||||
if (precip)
|
||||
{
|
||||
R_InterpolatePrecipMobjState((precipmobj_t *)spr->mobj, FRACUNIT, &interp);
|
||||
}
|
||||
else
|
||||
{
|
||||
R_InterpolateMobjState(spr->mobj, FRACUNIT, &interp);
|
||||
}
|
||||
R_InterpolateMobjState(spr->mobj, rendertimefrac, &interp);
|
||||
}
|
||||
|
||||
if (!precip && P_MobjFlip(spr->mobj) == -1) // precip doesn't have eflags so they can't flip
|
||||
}
|
||||
else
|
||||
{
|
||||
if (precip)
|
||||
{
|
||||
basey = FIXED_TO_FLOAT(interp.z + spr->mobj->height);
|
||||
R_InterpolatePrecipMobjState((precipmobj_t *)spr->mobj, FRACUNIT, &interp);
|
||||
}
|
||||
else
|
||||
{
|
||||
basey = FIXED_TO_FLOAT(interp.z);
|
||||
R_InterpolateMobjState(spr->mobj, FRACUNIT, &interp);
|
||||
}
|
||||
lowy = wallVerts[0].y;
|
||||
}
|
||||
|
||||
// Rotate sprites to fully billboard with the camera
|
||||
// X, Y, AND Z need to be manipulated for the polys to rotate around the
|
||||
// origin, because of how the origin setting works I believe that should
|
||||
// be mobj->z or mobj->z + mobj->height
|
||||
wallVerts[2].y = wallVerts[3].y = (spr->gzt - basey) * gl_viewludsin + basey;
|
||||
wallVerts[0].y = wallVerts[1].y = (lowy - basey) * gl_viewludsin + basey;
|
||||
// translate back to be around 0 before translating back
|
||||
wallVerts[3].x += ((spr->gzt - basey) * gl_viewludcos) * gl_viewcos;
|
||||
wallVerts[2].x += ((spr->gzt - basey) * gl_viewludcos) * gl_viewcos;
|
||||
if (!precip && P_MobjFlip(spr->mobj) == -1) // precip doesn't have eflags so they can't flip
|
||||
{
|
||||
basey = FIXED_TO_FLOAT(interp.z + spr->mobj->height);
|
||||
}
|
||||
else
|
||||
{
|
||||
basey = FIXED_TO_FLOAT(interp.z);
|
||||
}
|
||||
lowy = wallVerts[0].y;
|
||||
|
||||
wallVerts[0].x += ((lowy - basey) * gl_viewludcos) * gl_viewcos;
|
||||
wallVerts[1].x += ((lowy - basey) * gl_viewludcos) * gl_viewcos;
|
||||
// Rotate sprites to fully billboard with the camera
|
||||
// X, Y, AND Z need to be manipulated for the polys to rotate around the
|
||||
// origin, because of how the origin setting works I believe that should
|
||||
// be mobj->z or mobj->z + mobj->height
|
||||
wallVerts[2].y = wallVerts[3].y = (spr->gzt - basey) * gl_viewludsin + basey;
|
||||
wallVerts[0].y = wallVerts[1].y = (lowy - basey) * gl_viewludsin + basey;
|
||||
// translate back to be around 0 before translating back
|
||||
wallVerts[3].x += ((spr->gzt - basey) * gl_viewludcos) * gl_viewcos;
|
||||
wallVerts[2].x += ((spr->gzt - basey) * gl_viewludcos) * gl_viewcos;
|
||||
|
||||
wallVerts[3].z += ((spr->gzt - basey) * gl_viewludcos) * gl_viewsin;
|
||||
wallVerts[2].z += ((spr->gzt - basey) * gl_viewludcos) * gl_viewsin;
|
||||
wallVerts[0].x += ((lowy - basey) * gl_viewludcos) * gl_viewcos;
|
||||
wallVerts[1].x += ((lowy - basey) * gl_viewludcos) * gl_viewcos;
|
||||
|
||||
wallVerts[0].z += ((lowy - basey) * gl_viewludcos) * gl_viewsin;
|
||||
wallVerts[1].z += ((lowy - basey) * gl_viewludcos) * gl_viewsin;
|
||||
wallVerts[3].z += ((spr->gzt - basey) * gl_viewludcos) * gl_viewsin;
|
||||
wallVerts[2].z += ((spr->gzt - basey) * gl_viewludcos) * gl_viewsin;
|
||||
|
||||
wallVerts[0].z += ((lowy - basey) * gl_viewludcos) * gl_viewsin;
|
||||
wallVerts[1].z += ((lowy - basey) * gl_viewludcos) * gl_viewsin;
|
||||
}
|
||||
|
||||
static inline void HWR_ApplyDispoffset(gl_vissprite_t *spr, FOutVector *wallVerts, const boolean papersprite)
|
||||
{
|
||||
// dont push papersprites near the cam unless they have a dispoffset
|
||||
if (papersprite)
|
||||
{
|
||||
// if it has a dispoffset, push it a little towards the camera
|
||||
if (spr->dispoffset)
|
||||
{
|
||||
float co = -gl_viewcos*(0.05f*spr->dispoffset);
|
||||
float si = -gl_viewsin*(0.05f*spr->dispoffset);
|
||||
wallVerts[0].z = wallVerts[3].z = wallVerts[0].z+si;
|
||||
wallVerts[1].z = wallVerts[2].z = wallVerts[1].z+si;
|
||||
wallVerts[0].x = wallVerts[3].x = wallVerts[0].x+co;
|
||||
wallVerts[1].x = wallVerts[2].x = wallVerts[1].x+co;
|
||||
}
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
HWR_RotateSpritePolyToAim(spr, wallVerts, false);
|
||||
|
||||
float sprdist = sqrtf((spr->x1 - gl_viewx)*(spr->x1 - gl_viewx) + (spr->z1 - gl_viewy)*(spr->z1 - gl_viewy) + (spr->gzt - gl_viewz)*(spr->gzt - gl_viewz));
|
||||
float distfact = ((2.0f*spr->dispoffset) + 20.0f) / sprdist;
|
||||
|
||||
for (size_t i = 0; i < 4; i++)
|
||||
{
|
||||
wallVerts[i].x += (gl_viewx - wallVerts[i].x)*distfact;
|
||||
wallVerts[i].z += (gl_viewy - wallVerts[i].z)*distfact;
|
||||
wallVerts[i].y += (gl_viewz - wallVerts[i].y)*distfact;
|
||||
}
|
||||
}
|
||||
|
||||
static void HWR_SplitSprite(gl_vissprite_t *spr)
|
||||
static void HWR_SplitSprite(gl_vissprite_t *spr, const boolean papersprite)
|
||||
{
|
||||
FOutVector wallVerts[4];
|
||||
FOutVector baseWallVerts[4]; // This is what the verts should end up as
|
||||
@@ -3526,18 +3560,8 @@ static void HWR_SplitSprite(gl_vissprite_t *spr)
|
||||
baseWallVerts[0].t = baseWallVerts[1].t = gpatch->max_t;
|
||||
}
|
||||
|
||||
// Let dispoffset work first since this adjust each vertex
|
||||
HWR_RotateSpritePolyToAim(spr, baseWallVerts, false);
|
||||
|
||||
// push it toward the camera to mitigate floor-clipping sprites
|
||||
float sprdist = sqrtf((spr->x1 - gl_viewx)*(spr->x1 - gl_viewx) + (spr->z1 - gl_viewy)*(spr->z1 - gl_viewy) + (spr->gzt - gl_viewz)*(spr->gzt - gl_viewz));
|
||||
float distfact = ((2.0f*spr->dispoffset) + 20.0f) / sprdist;
|
||||
for (i = 0; i < 4; i++)
|
||||
{
|
||||
baseWallVerts[i].x += (gl_viewx - baseWallVerts[i].x)*distfact;
|
||||
baseWallVerts[i].z += (gl_viewy - baseWallVerts[i].z)*distfact;
|
||||
baseWallVerts[i].y += (gl_viewz - baseWallVerts[i].y)*distfact;
|
||||
}
|
||||
HWR_ApplyDispoffset(spr, baseWallVerts, papersprite);
|
||||
|
||||
realtop = top = baseWallVerts[3].y;
|
||||
realbot = bot = baseWallVerts[0].y;
|
||||
@@ -3655,7 +3679,7 @@ static void HWR_SplitSprite(gl_vissprite_t *spr)
|
||||
wallVerts[1].y = endbot;
|
||||
|
||||
// The x and y only need to be adjusted in the case that it's not a papersprite
|
||||
if (cv_glspritebillboarding.value && spr->mobj && !(spr->mobj->frame & FF_PAPERSPRITE))
|
||||
if (cv_glspritebillboarding.value && spr->mobj && !papersprite)
|
||||
{
|
||||
// Get the x and z of the vertices so billboarding draws correctly
|
||||
realheight = realbot - realtop;
|
||||
@@ -3731,9 +3755,11 @@ static void HWR_DrawSprite(gl_vissprite_t *spr)
|
||||
if (!spr->mobj->subsector)
|
||||
return;
|
||||
|
||||
const boolean papersprite = (spr->mobj->frame & FF_PAPERSPRITE);
|
||||
|
||||
if (spr->mobj->subsector->sector->numlights)
|
||||
{
|
||||
HWR_SplitSprite(spr);
|
||||
HWR_SplitSprite(spr, papersprite);
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -3799,20 +3825,8 @@ static void HWR_DrawSprite(gl_vissprite_t *spr)
|
||||
HWR_DrawSpriteShadow(spr, gpatch);
|
||||
}
|
||||
|
||||
// Let dispoffset work first since this adjust each vertex
|
||||
// ...nah
|
||||
HWR_RotateSpritePolyToAim(spr, wallVerts, false);
|
||||
|
||||
// push it toward the camera to mitigate floor-clipping sprites
|
||||
float sprdist = sqrtf((spr->x1 - gl_viewx)*(spr->x1 - gl_viewx) + (spr->z1 - gl_viewy)*(spr->z1 - gl_viewy) + (spr->gzt - gl_viewz)*(spr->gzt - gl_viewz));
|
||||
float distfact = ((2.0f*spr->dispoffset) + 20.0f) / sprdist;
|
||||
size_t i;
|
||||
for (i = 0; i < 4; i++)
|
||||
{
|
||||
wallVerts[i].x += (gl_viewx - wallVerts[i].x)*distfact;
|
||||
wallVerts[i].z += (gl_viewy - wallVerts[i].z)*distfact;
|
||||
wallVerts[i].y += (gl_viewz - wallVerts[i].y)*distfact;
|
||||
}
|
||||
HWR_ApplyDispoffset(spr, wallVerts, papersprite);
|
||||
|
||||
// This needs to be AFTER the shadows so that the regular sprites aren't drawn completely black.
|
||||
// sprite lighting by modulating the RGB components
|
||||
@@ -3894,7 +3908,6 @@ static inline void HWR_DrawPrecipitationSprite(gl_vissprite_t *spr)
|
||||
wallVerts[0].z = wallVerts[3].z = spr->z1;
|
||||
wallVerts[1].z = wallVerts[2].z = spr->z2;
|
||||
|
||||
// Let dispoffset work first since this adjust each vertex
|
||||
HWR_RotateSpritePolyToAim(spr, wallVerts, true);
|
||||
|
||||
wallVerts[0].s = wallVerts[3].s = 0;
|
||||
@@ -5613,9 +5626,9 @@ void HWR_MakeScreenFinalTexture(void)
|
||||
HWD.pfnMakeScreenTexture(HWD_SCREENTEXTURE_GENERIC2);
|
||||
}
|
||||
|
||||
void HWR_DrawScreenFinalTexture(INT32 width, INT32 height)
|
||||
void HWR_DrawScreenFinalTexture(INT32 width, INT32 height, boolean useshader)
|
||||
{
|
||||
HWD.pfnDrawScreenFinalTexture(HWD_SCREENTEXTURE_GENERIC2, width, height);
|
||||
HWD.pfnDrawScreenFinalTexture(HWD_SCREENTEXTURE_GENERIC2, width, height, useshader);
|
||||
}
|
||||
|
||||
#endif // HWRENDER
|
||||
@@ -131,7 +131,7 @@ void HWR_DrawIntermissionBG(void);
|
||||
void HWR_DoWipe(UINT8 wipenum, UINT8 scrnnum);
|
||||
void HWR_RenderVhsEffect(fixed_t upbary, fixed_t downbary, UINT8 updistort, UINT8 downdistort, UINT8 barsize);
|
||||
void HWR_MakeScreenFinalTexture(void);
|
||||
void HWR_DrawScreenFinalTexture(INT32 width, INT32 height);
|
||||
void HWR_DrawScreenFinalTexture(INT32 width, INT32 height, boolean useshader);
|
||||
|
||||
// hw_main.c: Segs
|
||||
void HWR_ProcessSeg(void); // Sort of like GLWall::Process in GZDoom
|
||||
|
||||
@@ -3109,10 +3109,8 @@ EXPORT void HWRAPI(PostImgRedraw) (float points[SCREENVERTS][SCREENVERTS][2])
|
||||
// a new size
|
||||
EXPORT void HWRAPI(FlushScreenTextures) (void)
|
||||
{
|
||||
int i;
|
||||
pglDeleteTextures(NUMSCREENTEXTURES, screenTextures);
|
||||
for (i = 0; i < NUMSCREENTEXTURES; i++)
|
||||
screenTextures[i] = 0;
|
||||
memset(screenTextures, 0 , sizeof(screenTextures));
|
||||
}
|
||||
|
||||
EXPORT void HWRAPI(DrawScreenTexture)(int tex, FSurfaceInfo *surf, FBITFIELD polyflags)
|
||||
@@ -3263,6 +3261,7 @@ EXPORT void HWRAPI(DoScreenWipe)(int wipeStart, int wipeEnd)
|
||||
EXPORT void HWRAPI(RenderVhsEffect) (fixed_t upbary, fixed_t downbary, UINT8 updistort, UINT8 downdistort, UINT8 barsize)
|
||||
{
|
||||
INT32 texsize = 512;
|
||||
int tex = HWD_SCREENTEXTURE_VHS;
|
||||
float xfix, yfix;
|
||||
float fix[8];
|
||||
GLubyte color[4] = {255, 255, 255, 255};
|
||||
@@ -3287,9 +3286,9 @@ EXPORT void HWRAPI(RenderVhsEffect) (fixed_t upbary, fixed_t downbary, UINT8 upd
|
||||
yfix = 1/((float)(texsize)/((float)((screen_height))));
|
||||
|
||||
// Slight fuzziness
|
||||
MakeScreenTexture(HWD_SCREENTEXTURE_GENERIC1);
|
||||
MakeScreenTexture(tex);
|
||||
SetBlend(PF_Modulated|PF_Translucent|PF_NoDepthTest);
|
||||
//pglBindTexture(GL_TEXTURE_2D, screentexture);
|
||||
pglBindTexture(GL_TEXTURE_2D, screenTextures[tex]);
|
||||
|
||||
for (i = 0; i < 1; i += 2.f/vid.height)
|
||||
{
|
||||
@@ -3311,8 +3310,9 @@ EXPORT void HWRAPI(RenderVhsEffect) (fixed_t upbary, fixed_t downbary, UINT8 upd
|
||||
}
|
||||
|
||||
// Upward bar
|
||||
MakeScreenTexture(HWD_SCREENTEXTURE_GENERIC1);
|
||||
//pglBindTexture(GL_TEXTURE_2D, screentexture);
|
||||
MakeScreenTexture(tex);
|
||||
pglBindTexture(GL_TEXTURE_2D, screenTextures[tex]);
|
||||
|
||||
color[0] = color[1] = color[2] = 190;
|
||||
color[3] = 250;
|
||||
pglColor4ubv(color);
|
||||
@@ -3339,8 +3339,8 @@ EXPORT void HWRAPI(RenderVhsEffect) (fixed_t upbary, fixed_t downbary, UINT8 upd
|
||||
pglDrawArrays(GL_TRIANGLE_FAN, 0, 4);
|
||||
|
||||
// Downward bar
|
||||
MakeScreenTexture(HWD_SCREENTEXTURE_GENERIC1);
|
||||
//pglBindTexture(GL_TEXTURE_2D, screentexture);
|
||||
MakeScreenTexture(tex);
|
||||
pglBindTexture(GL_TEXTURE_2D, screenTextures[tex]);
|
||||
|
||||
fix[0] = 0.0f;
|
||||
fix[6] = xfix;
|
||||
@@ -3396,7 +3396,7 @@ EXPORT void HWRAPI(MakeScreenTexture) (int tex)
|
||||
tex_downloaded = screenTextures[tex];
|
||||
}
|
||||
|
||||
EXPORT void HWRAPI(DrawScreenFinalTexture)(int tex, INT32 width, INT32 height)
|
||||
EXPORT void HWRAPI(DrawScreenFinalTexture)(int tex, INT32 width, INT32 height, boolean useshader)
|
||||
{
|
||||
float xfix, yfix;
|
||||
float origaspect, newaspect;
|
||||
@@ -3463,7 +3463,7 @@ EXPORT void HWRAPI(DrawScreenFinalTexture)(int tex, INT32 width, INT32 height)
|
||||
|
||||
pglBindTexture(GL_TEXTURE_2D, screenTextures[tex]);
|
||||
|
||||
if (HWR_ShouldUsePaletteRendering())
|
||||
if (useshader)
|
||||
pglUseProgram(gl_shaders[SHADER_PALETTE_POSTPROCESS].program); // palette postprocess shader
|
||||
|
||||
pglColor4ubv(white);
|
||||
@@ -3473,7 +3473,7 @@ EXPORT void HWRAPI(DrawScreenFinalTexture)(int tex, INT32 width, INT32 height)
|
||||
|
||||
pglDrawArrays(GL_TRIANGLE_FAN, 0, 4);
|
||||
|
||||
if (HWR_ShouldUsePaletteRendering())
|
||||
if (useshader)
|
||||
pglUseProgram(0);
|
||||
|
||||
tex_downloaded = screenTextures[tex];
|
||||
|
||||
@@ -139,6 +139,8 @@ UINT32 I_GetRefreshRate(void);
|
||||
|
||||
boolean I_UseNativeKeyboard(void);
|
||||
|
||||
boolean I_CheckNativeRes(void);
|
||||
|
||||
#ifdef USE_FBO_OGL
|
||||
#if defined (__unix__)
|
||||
extern boolean xwaylandcrap;
|
||||
|
||||
+7
-44
@@ -6371,16 +6371,14 @@ static void M_DrawAddons(void)
|
||||
y = BASEVIDHEIGHT - currentMenu->y + 1;
|
||||
|
||||
M_DrawTextBox(x - (21 + 5), y, MAXSTRINGLENGTH, 1);
|
||||
if (menusearch[0])
|
||||
V_DrawString(x - 18, y + 8, V_ALLOWLOWERCASE, menusearch+1);
|
||||
|
||||
if (menusearch.length)
|
||||
M_DrawTextInput(x - 18, y + 8, &menusearch, 0);
|
||||
else
|
||||
V_DrawString(x - 18, y + 8, V_ALLOWLOWERCASE|V_TRANSLUCENT, "Type to search...");
|
||||
if (skullAnimCounter < 4)
|
||||
V_DrawCharacter(x - 18 + V_StringWidth(menusearch+1, 0), y + 8,
|
||||
'_' | 0x80, false);
|
||||
|
||||
x -= (21 + 5 + 16);
|
||||
V_DrawSmallScaledPatch(x, y + 4, (menusearch[0] ? 0 : V_TRANSLUCENT), addonsp[NUM_EXT+3]);
|
||||
V_DrawSmallScaledPatch(x, y + 4, (menusearch.length ? 0 : V_TRANSLUCENT), addonsp[NUM_EXT+3]);
|
||||
|
||||
x = BASEVIDWIDTH - x - 16;
|
||||
V_DrawSmallScaledPatch(x, y + 4, ((!majormods) ? 0 : V_TRANSLUCENT), addonsp[NUM_EXT+4]);
|
||||
@@ -6456,43 +6454,6 @@ static void M_AddonAutoLoad(INT32 ch)
|
||||
fclose(autoloadconfigfile);
|
||||
}
|
||||
|
||||
#define len menusearch[0]
|
||||
static boolean M_ChangeStringAddons(INT32 choice)
|
||||
{
|
||||
choice = M_ShiftChar(choice);
|
||||
|
||||
switch (choice)
|
||||
{
|
||||
case KEY_DEL:
|
||||
if (len)
|
||||
{
|
||||
len = menusearch[1] = 0;
|
||||
return true;
|
||||
}
|
||||
break;
|
||||
case KEY_BACKSPACE:
|
||||
if (len)
|
||||
{
|
||||
menusearch[1+--len] = 0;
|
||||
return true;
|
||||
}
|
||||
break;
|
||||
default:
|
||||
if (choice >= 32 && choice <= 127)
|
||||
{
|
||||
if (len < MAXSTRINGLENGTH - 1)
|
||||
{
|
||||
menusearch[1+len++] = (char)choice;
|
||||
menusearch[1+len] = 0;
|
||||
return true;
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
#undef len
|
||||
|
||||
// i hate myself
|
||||
static boolean DumbStartsWith(const char *pre, const char *str)
|
||||
{
|
||||
@@ -6505,8 +6466,10 @@ static void M_HandleAddons(INT32 choice)
|
||||
{
|
||||
boolean exitmenu = false; // exit to previous menu
|
||||
|
||||
if (M_ChangeStringAddons(choice))
|
||||
if (M_TextInputHandle(&menusearch, choice))
|
||||
{
|
||||
S_StartSound(NULL,sfx_menu1);
|
||||
|
||||
char *tempname = NULL;
|
||||
if (dirmenu && dirmenu[dir_on[menudepthleft]])
|
||||
tempname = Z_StrDup(dirmenu[dir_on[menudepthleft]]+DIR_STRING); // don't need to I_Error if can't make - not important, just QoL
|
||||
|
||||
@@ -140,6 +140,8 @@ void M_TextInputClear(textinput_t *input)
|
||||
input->cursor = 0;
|
||||
input->select = 0;
|
||||
input->length = 0;
|
||||
|
||||
input->buffer[0] = 0;
|
||||
}
|
||||
|
||||
void M_TextInputSetString(textinput_t *input, const char *c)
|
||||
|
||||
+1
-1
@@ -266,7 +266,7 @@ void P_SceneryThinker(mobj_t *mobj);
|
||||
// To test it in Lua, check mobj.valid
|
||||
FUNCINLINE static ATTRINLINE boolean P_MobjWasRemoved(const mobj_t *mobj)
|
||||
{
|
||||
return !(mobj && mobj->thinker.function.acp1 == (actionf_p1)P_MobjThinker);
|
||||
return (!mobj || mobj->thinker.function.acp1 != (actionf_p1)P_MobjThinker);
|
||||
}
|
||||
|
||||
fixed_t P_MobjFloorZ(mobj_t *mobj, sector_t *sector, sector_t *boundsec, fixed_t x, fixed_t y, line_t *line, boolean lowest, boolean perfect);
|
||||
|
||||
@@ -2173,11 +2173,6 @@ static void LoadMobjThinker(actionf_p1 thinker)
|
||||
mobj->realyscale = FRACUNIT;
|
||||
mobj->stretchslam = 0;
|
||||
|
||||
mobj->stretchslam = 0;
|
||||
mobj->slamsoundtimer = 0;
|
||||
|
||||
mobj->mirrored = 0;
|
||||
|
||||
// Timer for slam sound effect
|
||||
mobj->slamsoundtimer = 0;
|
||||
|
||||
|
||||
+3
-3
@@ -350,7 +350,7 @@ static inline void P_RunThinkers(void)
|
||||
}
|
||||
}
|
||||
|
||||
static inline void P_DeviceRumbleTick(void)
|
||||
static void P_DeviceRumbleTick(void)
|
||||
{
|
||||
UINT8 i;
|
||||
|
||||
@@ -420,7 +420,7 @@ void P_RunChaseCameras(void)
|
||||
}
|
||||
}
|
||||
|
||||
static inline void P_RunQuakes(void)
|
||||
static void P_RunQuakes(void)
|
||||
{
|
||||
fixed_t ir;
|
||||
|
||||
@@ -457,7 +457,7 @@ void P_Ticker(boolean run)
|
||||
{
|
||||
INT32 i;
|
||||
|
||||
// Increment jointime and quittime even if paused
|
||||
// Increment jointime even if paused
|
||||
for (i = 0; i < MAXPLAYERS; i++)
|
||||
{
|
||||
if (playeringame[i])
|
||||
|
||||
+14
-13
@@ -2191,11 +2191,11 @@ static boolean oldencore = false;
|
||||
static boolean skipmusic = false;
|
||||
boolean skipintromus = false;
|
||||
|
||||
static const char *musicexception_list[16] = {
|
||||
static const char *musicexception_list[17] = {
|
||||
"vote", "voteea", "voteeb", "racent", "krwin",
|
||||
"krok", "krlose", "krfail", "kbwin", "kbok",
|
||||
"kblose", "kstart", "estart", "wait2j", "CHRSHP",
|
||||
"CHRSHF"
|
||||
"kblose", "kstart", "estart", "wait2j", "titles",
|
||||
"CHRSHF", "CHRSHP" // no clue what those are tbh
|
||||
};
|
||||
|
||||
//checks for any kind of event music like intermission, vote etc.
|
||||
@@ -2207,7 +2207,7 @@ static void S_CheckEventMus(const char *newmus)
|
||||
if (!cv_keepmusic.value)
|
||||
return;
|
||||
|
||||
for (int i = 0; i < 16; i++)
|
||||
for (int i = 0; i < 17; i++)
|
||||
if (stricmp(music_name, musicexception_list[i]) == 0 || stricmp(newmus, musicexception_list[i]) == 0) // weird? sure! but were lucky enough newmus reflects whats being replaced
|
||||
{
|
||||
skipmusic = true;
|
||||
@@ -2242,15 +2242,7 @@ void S_CheckMap(void)
|
||||
//
|
||||
void S_InitMapMusic(void)
|
||||
{
|
||||
if (!cv_skipintromusic.value)
|
||||
skipintromus = false;
|
||||
else
|
||||
{
|
||||
char *maptitle = G_BuildMapTitle(gamemap);
|
||||
skipintromus = cv_skipintromusic.value && stricmp(maptitle, "Wandering Falls") != 0; // thanks diggle!
|
||||
if (maptitle)
|
||||
Z_Free(maptitle);
|
||||
}
|
||||
skipintromus = false;
|
||||
|
||||
if (mapmusflags & MUSIC_RELOADRESET)
|
||||
{
|
||||
@@ -2268,6 +2260,15 @@ void S_InitMapMusic(void)
|
||||
// lug: but not when we keep the map music lol
|
||||
S_StopMusic();
|
||||
|
||||
if (cv_skipintromusic.value)
|
||||
{
|
||||
char *maptitle = G_BuildMapTitle(gamemap);
|
||||
// for some reason, occasionally the title screen music doesent seem to be reset in time, so skipping the intro may make it just continue playing it instead, weird..
|
||||
skipintromus = (stricmp(music_name, "titles") != 0) && (stricmp(maptitle, "Wandering Falls") != 0); // thanks diggle!
|
||||
if (maptitle)
|
||||
Z_Free(maptitle);
|
||||
}
|
||||
|
||||
if (skipintromus)
|
||||
return;
|
||||
|
||||
|
||||
+26
-1
@@ -755,10 +755,35 @@ static INT32 SDLJoyAxis(const Sint16 axis, evtype_t which)
|
||||
return raxis;
|
||||
}
|
||||
|
||||
boolean I_CheckNativeRes(void)
|
||||
{
|
||||
static int oldwidth = 0, oldheight = 0;
|
||||
static boolean resstate = false;
|
||||
int currentDisplayIndex = 0;
|
||||
SDL_DisplayMode curmode;
|
||||
|
||||
if (oldwidth == vid.width && oldheight == vid.height)
|
||||
{
|
||||
return resstate;
|
||||
}
|
||||
|
||||
currentDisplayIndex = SDL_GetWindowDisplayIndex(window);
|
||||
|
||||
if (SDL_GetCurrentDisplayMode(currentDisplayIndex, &curmode) != 0)
|
||||
{
|
||||
return resstate;
|
||||
}
|
||||
|
||||
resstate = ((vid.width == curmode.w) && (vid.height == curmode.h));
|
||||
oldwidth = vid.width;
|
||||
oldheight = vid.height;
|
||||
return resstate;
|
||||
}
|
||||
|
||||
#ifdef USE_FBO_OGL
|
||||
void I_DownSample(void)
|
||||
{
|
||||
if (!cv_glframebuffer.value || !supportFBO) //no sense to do this crap if we cant benefit from it
|
||||
if (!cv_glframebuffer.value || !supportFBO || I_CheckNativeRes()) //no sense to do this crap if we cant benefit from it
|
||||
{
|
||||
downsample = false;
|
||||
return;
|
||||
|
||||
+7
-2
@@ -258,7 +258,7 @@ void OglSdlFinishUpdate(boolean waitvbl)
|
||||
GLFramebuffer_Unbind();
|
||||
#endif
|
||||
|
||||
HWR_DrawScreenFinalTexture(sdlw, sdlh);
|
||||
HWR_DrawScreenFinalTexture(sdlw, sdlh, HWR_ShouldUsePaletteRendering());
|
||||
|
||||
#ifdef USE_FBO_OGL
|
||||
if (UseScreenFBO())
|
||||
@@ -271,7 +271,12 @@ void OglSdlFinishUpdate(boolean waitvbl)
|
||||
|
||||
// Sryder: We need to draw the final screen texture again into the other buffer in the original position so that
|
||||
// effects that want to take the old screen can do so after this
|
||||
HWR_DrawScreenFinalTexture(realwidth, realheight);
|
||||
if ((!I_CheckNativeRes()) // well we dont need it on native res it seems
|
||||
#ifdef USE_FBO_OGL
|
||||
&& (!UseScreenFBO())
|
||||
#endif
|
||||
)
|
||||
HWR_DrawScreenFinalTexture(realwidth, realheight, false);
|
||||
}
|
||||
|
||||
EXPORT void HWRAPI(OglSdlSetPalette) (RGBA_t *palette)
|
||||
|
||||
Reference in new issue
Block a user