Compare commits
2
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
eb04271c83 | ||
|
|
54e7ad571e |
No files matched your search
@@ -49,7 +49,6 @@
|
||||
# Already enabled by default for 32-bit
|
||||
# Windows.
|
||||
# NOCURL=1 - Disable libcurl--HTTP capability.
|
||||
# NOHOLEPUNCH=1 - Disable holepunch capability.
|
||||
# NOLIBGME=1 - Disable game music emu, retro VGM support.
|
||||
# NOOPENMPT=1 - Disable module (tracker) music support.
|
||||
# NOMIXER=1 - Disable SDL Mixer (audio playback).
|
||||
|
||||
@@ -6,8 +6,7 @@ passthru_opts+=\
|
||||
NOHW NOMD5 NOPOSTPROCESSING\
|
||||
MOBJCONSISTANCY PACKETDROP ZDEBUG\
|
||||
HAVE_MINIUPNPC\
|
||||
HAVE_DISCORDRPC DEVELOP\
|
||||
NOHOLEPUNCH\
|
||||
HAVE_DISCORDRPC DEVELOP
|
||||
|
||||
# build with debugging information
|
||||
ifdef DEBUGMODE
|
||||
|
||||
+30
-32
@@ -1,8 +1,7 @@
|
||||
// SONIC ROBO BLAST 2 KART
|
||||
// SONIC ROBO BLAST 2
|
||||
//-----------------------------------------------------------------------------
|
||||
// Copyright (C) 2025 by Kart Krew.
|
||||
// Copyright (C) 2020 by Sonic Team Junior.
|
||||
// Copyright (C) 2000 by DooM Legacy Team.
|
||||
// Copyright (C) 1998-2000 by DooM Legacy Team.
|
||||
// Copyright (C) 1999-2025 by Sonic Team Junior.
|
||||
//
|
||||
// This program is free software distributed under the
|
||||
// terms of the GNU General Public License, version 2.
|
||||
@@ -25,7 +24,6 @@ extern "C" {
|
||||
//
|
||||
// Little-endian machines
|
||||
//
|
||||
|
||||
#define WRITEUINT8(p,b) do { UINT8 *p_tmp = ( UINT8 *)p; const UINT8 tv = ( UINT8)(b); memcpy(p, &tv, sizeof( UINT8)); p_tmp++; *(void**)(&(p)) = (void *)p_tmp; } while (0)
|
||||
#define WRITESINT8(p,b) do { SINT8 *p_tmp = ( SINT8 *)p; const SINT8 tv = ( UINT8)(b); memcpy(p, &tv, sizeof( UINT8)); p_tmp++; *(void**)(&(p)) = (void *)p_tmp; } while (0)
|
||||
#define WRITEINT16(p,b) do { INT16 *p_tmp = ( INT16 *)p; const INT16 tv = ( INT16)(b); memcpy(p, &tv, sizeof( INT16)); p_tmp++; *(void**)(&(p)) = (void *)p_tmp; } while (0)
|
||||
@@ -38,25 +36,25 @@ extern "C" {
|
||||
|
||||
// what is this?
|
||||
#if defined (__GNUC__)
|
||||
#define READUINT8(p) ({ const UINT8 *p_tmp = (const UINT8 *)p; UINT8 b; memcpy(&b, p, sizeof( UINT8)); p_tmp++; *(const void**)(&(p)) = (const void *)p_tmp; b; })
|
||||
#define READSINT8(p) ({ const SINT8 *p_tmp = (const SINT8 *)p; SINT8 b; memcpy(&b, p, sizeof( SINT8)); p_tmp++; *(const void**)(&(p)) = (const void *)p_tmp; b; })
|
||||
#define READINT16(p) ({ const INT16 *p_tmp = (const INT16 *)p; INT16 b; memcpy(&b, p, sizeof( INT16)); p_tmp++; *(const void**)(&(p)) = (const void *)p_tmp; b; })
|
||||
#define READUINT16(p) ({ const UINT16 *p_tmp = (const UINT16 *)p; UINT16 b; memcpy(&b, p, sizeof( UINT16)); p_tmp++; *(const void**)(&(p)) = (const void *)p_tmp; b; })
|
||||
#define READINT32(p) ({ const INT32 *p_tmp = (const INT32 *)p; INT32 b; memcpy(&b, p, sizeof( INT32)); p_tmp++; *(const void**)(&(p)) = (const void *)p_tmp; b; })
|
||||
#define READUINT32(p) ({ const UINT32 *p_tmp = (const UINT32 *)p; UINT32 b; memcpy(&b, p, sizeof( UINT32)); p_tmp++; *(const void**)(&(p)) = (const void *)p_tmp; b; })
|
||||
#define READCHAR(p) ({ const char *p_tmp = (const char *)p; char b; memcpy(&b, p, sizeof( char)); p_tmp++; *(const void**)(&(p)) = (const void *)p_tmp; b; })
|
||||
#define READFIXED(p) ({ const fixed_t *p_tmp = (const fixed_t *)p; fixed_t b; memcpy(&b, p, sizeof(fixed_t)); p_tmp++; *(const void**)(&(p)) = (const void *)p_tmp; b; })
|
||||
#define READANGLE(p) ({ const angle_t *p_tmp = (const angle_t *)p; angle_t b; memcpy(&b, p, sizeof(angle_t)); p_tmp++; *(const void**)(&(p)) = (const void *)p_tmp; b; })
|
||||
#define READUINT8(p) ({ UINT8 *p_tmp = (UINT8 *)p; UINT8 b; memcpy(&b, p, sizeof( UINT8)); p_tmp++; *(void**)(&(p)) = (void *)p_tmp; b; })
|
||||
#define READSINT8(p) ({ SINT8 *p_tmp = (SINT8 *)p; SINT8 b; memcpy(&b, p, sizeof( SINT8)); p_tmp++; *(void**)(&(p)) = (void *)p_tmp; b; })
|
||||
#define READINT16(p) ({ INT16 *p_tmp = (INT16 *)p; INT16 b; memcpy(&b, p, sizeof( INT16)); p_tmp++; *(void**)(&(p)) = (void *)p_tmp; b; })
|
||||
#define READUINT16(p) ({ UINT16 *p_tmp = (UINT16 *)p; UINT16 b; memcpy(&b, p, sizeof( UINT16)); p_tmp++; *(void**)(&(p)) = (void *)p_tmp; b; })
|
||||
#define READINT32(p) ({ INT32 *p_tmp = (INT32 *)p; INT32 b; memcpy(&b, p, sizeof( INT32)); p_tmp++; *(void**)(&(p)) = (void *)p_tmp; b; })
|
||||
#define READUINT32(p) ({ UINT32 *p_tmp = (UINT32 *)p; UINT32 b; memcpy(&b, p, sizeof( UINT32)); p_tmp++; *(void**)(&(p)) = (void *)p_tmp; b; })
|
||||
#define READCHAR(p) ({ char *p_tmp = (char *)p; char b; memcpy(&b, p, sizeof( char)); p_tmp++; *(void**)(&(p)) = (void *)p_tmp; b; })
|
||||
#define READFIXED(p) ({ fixed_t *p_tmp = (fixed_t *)p; fixed_t b; memcpy(&b, p, sizeof(fixed_t)); p_tmp++; *(void**)(&(p)) = (void *)p_tmp; b; })
|
||||
#define READANGLE(p) ({ angle_t *p_tmp = (angle_t *)p; angle_t b; memcpy(&b, p, sizeof(angle_t)); p_tmp++; *(void**)(&(p)) = (void *)p_tmp; b; })
|
||||
#else
|
||||
#define READUINT8(p) ((const UINT8*) (*(const void**)(&(p)) = (const void*)&((const UINT8*) (p))[1]))[-1]
|
||||
#define READSINT8(p) ((const SINT8*) (*(const void**)(&(p)) = (const void*)&((const SINT8*) (p))[1]))[-1]
|
||||
#define READINT16(p) ((const INT16*) (*(const void**)(&(p)) = (const void*)&((const INT16*) (p))[1]))[-1]
|
||||
#define READUINT16(p) ((const UINT16*) (*(const void**)(&(p)) = (const void*)&((const UINT16*) (p))[1]))[-1]
|
||||
#define READINT32(p) ((const INT32*) (*(const void**)(&(p)) = (const void*)&((const INT32*) (p))[1]))[-1]
|
||||
#define READUINT32(p) ((const UINT32*) (*(const void**)(&(p)) = (const void*)&((const UINT32*) (p))[1]))[-1]
|
||||
#define READCHAR(p) ((const char*) (*(const void**)(&(p)) = (const void*)&((const char*) (p))[1]))[-1]
|
||||
#define READFIXED(p) ((const fixed_t*)(*(const void**)(&(p)) = (const void*)&((const fixed_t*)(p))[1]))[-1]
|
||||
#define READANGLE(p) ((const angle_t*)(*(const void**)(&(p)) = (const void*)&((const angle_t*)(p))[1]))[-1]
|
||||
#define READUINT8(p) ((UINT8*)(*(void**)(&(p)) = (void*)&((UINT8*)(p))[1]))[-1]
|
||||
#define READSINT8(p) ((SINT8*)(*(void**)(&(p)) = (void*)&((SINT8*)(p))[1]))[-1]
|
||||
#define READINT16(p) ((INT16*)(*(void**)(&(p)) = (void*)&((INT16*)(p))[1]))[-1]
|
||||
#define READUINT16(p) ((UINT16*)(*(void**)(&(p)) = (void*)&((UINT16*)(p))[1]))[-1]
|
||||
#define READINT32(p) ((INT32*)(*(void**)(&(p)) = (void*)&((INT32*)(p))[1]))[-1]
|
||||
#define READUINT32(p) ((UINT32*)(*(void**)(&(p)) = (void*)&((UINT32*)(p))[1]))[-1]
|
||||
#define READCHAR(p) ((char*)(*(void**)(&(p)) = (void*)&((char*)(p))[1]))[-1]
|
||||
#define READFIXED(p) ((fixed_t*)(*(void**)(&(p)) = (void*)&((fixed_t*)(p))[1]))[-1]
|
||||
#define READANGLE(p) ((angle_t*)(*(void**)(&(p)) = (void*)&((angle_t*)(p))[1]))[-1]
|
||||
#endif
|
||||
|
||||
#else //SRB2_BIG_ENDIAN
|
||||
@@ -119,15 +117,15 @@ FUNCINLINE static ATTRINLINE UINT32 readulong(void *ptr)
|
||||
return (ucp[3] << 24) | (ucp[2] << 16) | (ucp[1] << 8) | ucp[0];
|
||||
}
|
||||
|
||||
#define READUINT8(p) ((const UINT8*)(p = (const void*)&((const UINT8*)p)[1]))[-1]
|
||||
#define READSINT8(p) ((const SINT8*)(p = (const void*)&((const SINT8*)p)[1]))[-1]
|
||||
#define READINT16(p) readshort(&((const INT16*)(p = (const void*)&((const INT16*)p)[1]))[-1])
|
||||
#define READUINT16(p) readushort(&((const UINT16*)(p = (const void*)&((const UINT16*)p)[1]))[-1])
|
||||
#define READINT32(p) readlong(&((const INT32*)(p = (const void*)&((const INT32*)p)[1]))[-1])
|
||||
#define READUINT32(p) readulong(&((const UINT32*)(p = (const void*)&((const UINT32*)p)[1]))
|
||||
#define READCHAR(p) ((const char*)(p = (const void*)&((const char*)p)[1]))[-1]
|
||||
#define READFIXED(p) readlong(&((const fixed_t*)(p = (const void*)&((const fixed_t*)p)[1]))[-1])
|
||||
#define READANGLE(p) readulong(&((const angle_t*)(p = (const void*)&((const angle_t*)p)[1]))[-1])
|
||||
#define READUINT8(p) ((UINT8*)(p = (void*)&((UINT8*)p)[1]))[-1]
|
||||
#define READSINT8(p) ((SINT8*)(p = (void*)&((SINT8*)p)[1]))[-1]
|
||||
#define READINT16(p) readshort(&((INT16*)(p = (void*)&((INT16*)p)[1]))[-1])
|
||||
#define READUINT16(p) readushort(&((UINT16*)(p = (void*)&((UINT16*)p)[1]))[-1])
|
||||
#define READINT32(p) readlong(&((INT32*)(p = (void*)&((INT32*)p)[1]))[-1])
|
||||
#define READUINT32(p) readulong(&((UINT32*)(p = (void*)&((UINT32*)p)[1]))
|
||||
#define READCHAR(p) ((char*)(p = (void*)&((char*)p)[1]))[-1]
|
||||
#define READFIXED(p) readlong(&((fixed_t*)(p = (void*)&((fixed_t*)p)[1]))[-1])
|
||||
#define READANGLE(p) readulong(&((angle_t*)(p = (void*)&((angle_t*)p)[1]))[-1])
|
||||
#endif //SRB2_BIG_ENDIAN
|
||||
|
||||
#define WRITESTRINGN(p, s, n) do { \
|
||||
|
||||
+10
-17
@@ -281,7 +281,7 @@ char *com_argv[MAX_ARGS];
|
||||
static const char *com_null_string = "";
|
||||
static char *com_args = NULL; // current command args or NULL
|
||||
|
||||
static void Got_NetVar(const UINT8 **p, INT32 playernum);
|
||||
static void Got_NetVar(UINT8 **p, INT32 playernum);
|
||||
|
||||
/** Initializes command buffer and adds basic commands.
|
||||
*/
|
||||
@@ -700,7 +700,6 @@ static void COM_Echo_f(void)
|
||||
|
||||
for (i = 1; i < COM_Argc(); i++)
|
||||
CONS_Printf("%s ", COM_Argv(i));
|
||||
|
||||
CONS_Printf("\n");
|
||||
}
|
||||
|
||||
@@ -709,11 +708,11 @@ static void COM_Echo_f(void)
|
||||
static void COM_CEcho_f(void)
|
||||
{
|
||||
size_t i;
|
||||
char cechotext[1024] = {0};
|
||||
char cechotext[1024] = "";
|
||||
|
||||
for (i = 1; i < COM_Argc(); i++)
|
||||
{
|
||||
strlcat(cechotext, COM_Argv(i), sizeof(cechotext)-1);
|
||||
strlcpy(cechotext, COM_Argv(i), sizeof(cechotext)-1);
|
||||
strlcat(cechotext, " ", sizeof(cechotext)-1);
|
||||
}
|
||||
|
||||
@@ -939,8 +938,6 @@ static void COM_Find_f(void)
|
||||
}
|
||||
|
||||
help = COM_Argv(1);
|
||||
if (!help)
|
||||
return;
|
||||
helplen = strlen(help);
|
||||
CONS_Printf("\x82""Variables:\n");
|
||||
matchesany = false;
|
||||
@@ -1474,7 +1471,7 @@ finish:
|
||||
var->flags |= CV_MODIFIED;
|
||||
|
||||
// raise 'on change' code
|
||||
LUA_CVarChanged(var); // let consolelib know what cvar this is.
|
||||
LUA_CVarChanged(var->name); // let consolelib know what cvar this is.
|
||||
|
||||
if (var->flags & CV_CALL && !stealth)
|
||||
var->func();
|
||||
@@ -1500,11 +1497,11 @@ badinput:
|
||||
|
||||
static boolean serverloading = false;
|
||||
|
||||
static void Got_NetVar(const UINT8 **p, INT32 playernum)
|
||||
static void Got_NetVar(UINT8 **p, INT32 playernum)
|
||||
{
|
||||
consvar_t *cvar;
|
||||
UINT16 netid;
|
||||
const char *svalue;
|
||||
char *svalue;
|
||||
UINT8 stealth = false;
|
||||
|
||||
if (playernum != serverplayer && !IsPlayerAdmin(playernum) && !serverloading)
|
||||
@@ -1518,10 +1515,9 @@ static void Got_NetVar(const UINT8 **p, INT32 playernum)
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
netid = READUINT16(*p);
|
||||
cvar = CV_FindNetVar(netid);
|
||||
svalue = (const char *)*p;
|
||||
svalue = (char *)*p;
|
||||
SKIPSTRING(*p);
|
||||
stealth = READUINT8(*p);
|
||||
|
||||
@@ -1577,9 +1573,8 @@ void CV_SaveNetVars(UINT8 **p, boolean isdemorecording)
|
||||
WRITEUINT16(count_p, count);
|
||||
}
|
||||
|
||||
size_t CV_LoadNetVars(const UINT8 *bufstart)
|
||||
void CV_LoadNetVars(UINT8 **p)
|
||||
{
|
||||
const UINT8 *p = bufstart;
|
||||
consvar_t *cvar;
|
||||
UINT16 count;
|
||||
|
||||
@@ -1590,13 +1585,11 @@ size_t CV_LoadNetVars(const UINT8 *bufstart)
|
||||
if (cvar->flags & CV_NETVAR)
|
||||
Setvalue(cvar, cvar->defaultvalue, true);
|
||||
|
||||
count = READUINT16(p);
|
||||
count = READUINT16(*p);
|
||||
while (count--)
|
||||
Got_NetVar(&p, 0);
|
||||
Got_NetVar(p, 0);
|
||||
|
||||
serverloading = false;
|
||||
|
||||
return p - bufstart;
|
||||
}
|
||||
|
||||
static void CV_SetCVar(consvar_t *var, const char *value, boolean stealth);
|
||||
|
||||
+1
-1
@@ -182,7 +182,7 @@ void CV_SaveVariables(FILE *f);
|
||||
|
||||
// load/save gamesate (load and save option and for network join in game)
|
||||
void CV_SaveNetVars(UINT8 **p, boolean isdemorecording);
|
||||
size_t CV_LoadNetVars(const UINT8 *p);
|
||||
void CV_LoadNetVars(UINT8 **p);
|
||||
|
||||
// reset cheat netvars after cheats is deactivated
|
||||
void CV_ResetCheatNetVars(void);
|
||||
|
||||
+20
-26
@@ -312,9 +312,9 @@ static inline tic_t ExpandTics(INT32 low, tic_t basetic)
|
||||
// Some extra data function for handle textcmd buffer
|
||||
// -----------------------------------------------------------------
|
||||
|
||||
static void (*listnetxcmd[MAXNETXCMD])(const UINT8 **p, INT32 playernum);
|
||||
static void (*listnetxcmd[MAXNETXCMD])(UINT8 **p, INT32 playernum);
|
||||
|
||||
void RegisterNetXCmd(netxcmd_t id, void (*cmd_f)(const UINT8 **p, INT32 playernum))
|
||||
void RegisterNetXCmd(netxcmd_t id, void (*cmd_f)(UINT8 **p, INT32 playernum))
|
||||
{
|
||||
#ifdef PARANOIA
|
||||
if (id >= MAXNETXCMD)
|
||||
@@ -460,12 +460,12 @@ static void ExtraDataTicker(void)
|
||||
{
|
||||
if (playeringame[i] || i == 0)
|
||||
{
|
||||
const UINT8 *bufferstart = D_GetExistingTextcmd(gametic, i);
|
||||
UINT8 *bufferstart = D_GetExistingTextcmd(gametic, i);
|
||||
|
||||
if (bufferstart)
|
||||
{
|
||||
const UINT8 *curpos = bufferstart;
|
||||
const UINT8 *bufferend = &curpos[curpos[0]+1];
|
||||
UINT8 *curpos = bufferstart;
|
||||
UINT8 *bufferend = &curpos[curpos[0]+1];
|
||||
|
||||
curpos++;
|
||||
while (curpos < bufferend)
|
||||
@@ -823,7 +823,7 @@ static void resynch_read_player(resynch_pak *rsp)
|
||||
P_SetThingPosition(players[i].mo);
|
||||
}
|
||||
|
||||
static void resynch_write_ctf(resynchend_pak *rst)
|
||||
static inline void resynch_write_ctf(resynchend_pak *rst)
|
||||
{
|
||||
mobj_t *mflag;
|
||||
UINT8 i, j;
|
||||
@@ -863,7 +863,7 @@ static void resynch_write_ctf(resynchend_pak *rst)
|
||||
}
|
||||
}
|
||||
|
||||
static void resynch_read_ctf(resynchend_pak *p)
|
||||
static inline void resynch_read_ctf(resynchend_pak *p)
|
||||
{
|
||||
UINT8 i;
|
||||
|
||||
@@ -1656,7 +1656,12 @@ static void SV_SendPlayerInfo(INT32 node)
|
||||
|
||||
netbuffer->u.playerinfo[i].node = i;
|
||||
|
||||
strlcpy(netbuffer->u.playerinfo[i].name, (const char *)&player_names[i], MAXPLAYERNAME+1);
|
||||
// Can't really change this because net compatibility, but the warning is annoying
|
||||
#pragma GCC diagnostic push
|
||||
#pragma GCC diagnostic ignored "-Wstringop-truncation"
|
||||
strncpy(netbuffer->u.playerinfo[i].name, (const char *)&player_names[i], MAXPLAYERNAME+1);
|
||||
#pragma GCC diagnostic pop
|
||||
netbuffer->u.playerinfo[i].name[MAXPLAYERNAME] = '\0';
|
||||
|
||||
//fetch IP address
|
||||
//No, don't do that, you fuckface.
|
||||
@@ -3756,7 +3761,7 @@ static void Command_Kick(void)
|
||||
CONS_Printf(M_GetText("Only the server or a remote admin can use this.\n"));
|
||||
}
|
||||
|
||||
static void Got_KickCmd(const UINT8 **p, INT32 playernum)
|
||||
static void Got_KickCmd(UINT8 **p, INT32 playernum)
|
||||
{
|
||||
INT32 pnum, msg;
|
||||
char buf[3 + MAX_REASONLENGTH];
|
||||
@@ -4146,8 +4151,8 @@ consvar_t cv_connectawaittime = {"connectawaittime", "5", CV_SAVE, connectawaitt
|
||||
|
||||
consvar_t cv_serverinfoscreen = {"serverinfoscreen", "On", CV_SAVE, CV_OnOff, NULL, 0, NULL, NULL, 0, 0, NULL};
|
||||
|
||||
static void Got_AddPlayer(const UINT8 **p, INT32 playernum);
|
||||
static void Got_RemovePlayer(const UINT8 **p, INT32 playernum);
|
||||
static void Got_AddPlayer(UINT8 **p, INT32 playernum);
|
||||
static void Got_RemovePlayer(UINT8 **p, INT32 playernum);
|
||||
|
||||
static void Joinable_OnChange(void)
|
||||
{
|
||||
@@ -4399,7 +4404,7 @@ static inline void SV_AddNode(INT32 node)
|
||||
}
|
||||
|
||||
// Xcmd XD_ADDPLAYER
|
||||
static void Got_AddPlayer(const UINT8 **p, INT32 playernum)
|
||||
static void Got_AddPlayer(UINT8 **p, INT32 playernum)
|
||||
{
|
||||
INT16 node, newplayernum;
|
||||
UINT8 splitscreenplayer = 0;
|
||||
@@ -4486,7 +4491,7 @@ static void Got_AddPlayer(const UINT8 **p, INT32 playernum)
|
||||
}
|
||||
|
||||
// Xcmd XD_REMOVEPLAYER
|
||||
static void Got_RemovePlayer(const UINT8 **p, INT32 playernum)
|
||||
static void Got_RemovePlayer(UINT8 **p, INT32 playernum)
|
||||
{
|
||||
SINT8 pnum, reason;
|
||||
|
||||
@@ -4649,22 +4654,11 @@ void SV_StopServer(void)
|
||||
Y_EndIntermission();
|
||||
if (gamestate == GS_VOTING)
|
||||
Y_EndVote();
|
||||
|
||||
G_SetGamestate(GS_NULL);
|
||||
wipegamestate = GS_NULL;
|
||||
gamestate = wipegamestate = GS_NULL;
|
||||
|
||||
for (i = 0; i < MAXSPLITSCREENPLAYERS; i++)
|
||||
{
|
||||
localtextcmd[i][0] = 0;
|
||||
|
||||
while (textcmdbuf[i] != NULL)
|
||||
{
|
||||
textcmdbuf_t *buf = textcmdbuf[i];
|
||||
textcmdbuf[i] = textcmdbuf[i]->next;
|
||||
Z_Free(buf);
|
||||
}
|
||||
}
|
||||
|
||||
for (i = firstticstosend; i < firstticstosend + BACKUPTICS; i++)
|
||||
D_Clearticcmd(i);
|
||||
|
||||
@@ -5226,7 +5220,7 @@ static void PT_ServerCFG(SINT8 node)
|
||||
|
||||
scp = netbuffer->u.servercfg.varlengthinputs;
|
||||
CV_LoadPlayerNames(&scp);
|
||||
scp += CV_LoadNetVars(scp);
|
||||
CV_LoadNetVars(&scp);
|
||||
|
||||
/// \note Wait. What if a Lua script uses some global custom variables synched with the NetVars hook?
|
||||
/// Shouldn't them be downloaded even at intermission time?
|
||||
|
||||
+1
-1
@@ -604,7 +604,7 @@ extern consvar_t cv_serverinfoscreen;
|
||||
void D_ClientServerInit(void);
|
||||
|
||||
// Initialise the other field
|
||||
void RegisterNetXCmd(netxcmd_t id, void (*cmd_f)(const UINT8 **p, INT32 playernum));
|
||||
void RegisterNetXCmd(netxcmd_t id, void (*cmd_f)(UINT8 **p, INT32 playernum));
|
||||
void SendNetXCmdForPlayer(UINT8 playerid, netxcmd_t id, const void *param, size_t nparam);
|
||||
#define SendNetXCmd(id, param, nparam) SendNetXCmdForPlayer(0, id, param, nparam) // Shortcut for P1
|
||||
void SendKick(UINT8 playernum, UINT8 msg);
|
||||
|
||||
+102
-125
@@ -97,15 +97,15 @@
|
||||
UINT8 window_notinfocus = false;
|
||||
|
||||
static char *startupiwadfiles[MAX_WADFILES];
|
||||
static size_t startupiwadcount = 0;
|
||||
static char *startuppwads[MAX_WADFILES];
|
||||
static size_t startuppwadcount = 0;
|
||||
|
||||
// autoloading
|
||||
static char *autoloadwadfiles[MAX_WADFILES];
|
||||
static char *autoloadwadfilespost[MAX_WADFILES];
|
||||
static size_t autoloadcount = 0;
|
||||
static size_t postloadcount = 0;
|
||||
boolean autoloading;
|
||||
boolean autoloaded;
|
||||
boolean postautoloaded = false;
|
||||
boolean wasautoloaded = false;
|
||||
//
|
||||
|
||||
boolean devparm = false; // started game with -devparm
|
||||
@@ -113,9 +113,7 @@ boolean devparm = false; // started game with -devparm
|
||||
boolean singletics = false; // timedemo
|
||||
boolean lastdraw = false;
|
||||
|
||||
#ifdef MOTIONBLUR
|
||||
INT32 postimgparam[MAXSPLITSCREENPLAYERS];
|
||||
#endif
|
||||
|
||||
// These variables are only true if
|
||||
// whether the respective sound system is disabled
|
||||
@@ -399,11 +397,7 @@ static void D_Renderview(void)
|
||||
if (i == 0)
|
||||
R_ApplyViewMorph();
|
||||
|
||||
#ifdef MOTIONBLUR
|
||||
V_DoPostProcessor(i, postimgparam[i]);
|
||||
#else
|
||||
V_DoPostProcessor(i, 0);
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
||||
@@ -967,11 +961,8 @@ void D_ClearState(void)
|
||||
{
|
||||
INT32 i;
|
||||
|
||||
demo.title = false;
|
||||
|
||||
// okay, stop now
|
||||
// (otherwise the game still thinks we're playing!)
|
||||
CURLAbortFile();
|
||||
SV_StopServer();
|
||||
SV_ResetServer();
|
||||
serverlistultimatecount = 0;
|
||||
@@ -980,10 +971,7 @@ void D_ClearState(void)
|
||||
CL_ClearPlayer(i);
|
||||
|
||||
splitscreen = 0;
|
||||
|
||||
// recompute screen size
|
||||
R_ExecuteSetViewSize();
|
||||
|
||||
SplitScreen_OnChange();
|
||||
botingame = false;
|
||||
botskin = 0;
|
||||
cv_debug = 0;
|
||||
@@ -1002,6 +990,7 @@ void D_ClearState(void)
|
||||
gameaction = ga_nothing;
|
||||
memset(displayplayers, 0, sizeof(displayplayers));
|
||||
consoleplayer = 0;
|
||||
//demosequence = -1;
|
||||
gametype = GT_RACE; // SRB2kart
|
||||
paused = false;
|
||||
|
||||
@@ -1024,11 +1013,6 @@ void D_ClearState(void)
|
||||
|
||||
G_SetGamestate(GS_NULL);
|
||||
wipegamestate = GS_NULL;
|
||||
|
||||
M_ClearMenus(true);
|
||||
|
||||
// map palettes affect this
|
||||
D_ResetDeviceLED();
|
||||
}
|
||||
|
||||
//
|
||||
@@ -1036,18 +1020,25 @@ void D_ClearState(void)
|
||||
//
|
||||
void D_StartTitle(void)
|
||||
{
|
||||
demo.title = false;
|
||||
D_ClearState();
|
||||
multiplayer = netgame = false; // title menu shouldnt be a netgame or multiplayer lmao
|
||||
netgame = false; // title menu shouldnt be a netgame lmao
|
||||
M_ClearMenus(true);
|
||||
F_StartTitleScreen();
|
||||
D_ResetDeviceLED();
|
||||
}
|
||||
|
||||
//
|
||||
// D_AddFile
|
||||
//
|
||||
static void D_AddFile(const char *file, char **filearray, size_t index)
|
||||
static void D_AddFile(const char *file, char **filearray)
|
||||
{
|
||||
size_t pnumwadfiles;
|
||||
char *newfile;
|
||||
|
||||
for (pnumwadfiles = 0; filearray[pnumwadfiles]; pnumwadfiles++)
|
||||
;
|
||||
|
||||
newfile = malloc(strlen(file) + 1);
|
||||
if (!newfile)
|
||||
{
|
||||
@@ -1055,17 +1046,16 @@ static void D_AddFile(const char *file, char **filearray, size_t index)
|
||||
}
|
||||
strcpy(newfile, file);
|
||||
|
||||
filearray[index] = newfile;
|
||||
filearray[pnumwadfiles] = newfile;
|
||||
}
|
||||
|
||||
static void D_CleanFile(char **filearray, size_t count)
|
||||
static void D_CleanFile(char **filearray)
|
||||
{
|
||||
size_t i;
|
||||
|
||||
for (i = 0; i < count; i++)
|
||||
size_t pnumwadfiles;
|
||||
for (pnumwadfiles = 0; filearray[pnumwadfiles]; pnumwadfiles++)
|
||||
{
|
||||
free(filearray[i]);
|
||||
filearray[i] = NULL;
|
||||
free(filearray[pnumwadfiles]);
|
||||
filearray[pnumwadfiles] = NULL;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1097,8 +1087,9 @@ static INT32 D_DetectFileType(const char* filename)
|
||||
}
|
||||
|
||||
// autoload that shit
|
||||
static void D_AutoloadFile(const char *file, char **filearray, size_t index)
|
||||
static void D_AutoloadFile(const char *file, char **filearray)
|
||||
{
|
||||
size_t pnumwadfiles;
|
||||
char *newfile;
|
||||
INT32 fileType = D_DetectFileType(file);
|
||||
|
||||
@@ -1108,6 +1099,9 @@ static void D_AutoloadFile(const char *file, char **filearray, size_t index)
|
||||
return;
|
||||
}
|
||||
|
||||
for (pnumwadfiles = 0; filearray[pnumwadfiles]; pnumwadfiles++)
|
||||
;
|
||||
|
||||
if (fileType <= 6)
|
||||
{
|
||||
newfile = malloc(strlen(file) + 1);
|
||||
@@ -1115,7 +1109,7 @@ static void D_AutoloadFile(const char *file, char **filearray, size_t index)
|
||||
I_Error("No more free memory to AutoloadFile %s",file);
|
||||
|
||||
strcpy(newfile, file);
|
||||
filearray[index] = newfile;
|
||||
filearray[pnumwadfiles] = newfile;
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -1145,44 +1139,42 @@ static void D_FindAddonsToAutoload(void)
|
||||
{
|
||||
FILE *autoloadconfigfile;
|
||||
const char *autoloadpath;
|
||||
char *newline;
|
||||
|
||||
boolean postload;
|
||||
|
||||
INT32 i;
|
||||
char wadsToAutoload[256] = "";
|
||||
|
||||
// does it exist tho
|
||||
autoloadpath = va("%s"PATHSEP"%s", srb2home, AUTOLOADCONFIGFILENAME);
|
||||
autoloadpath = va("%s"PATHSEP"%s",srb2home,AUTOLOADCONFIGFILENAME);
|
||||
autoloadconfigfile = fopen(autoloadpath, "r");
|
||||
|
||||
// If the file is found, run our shit
|
||||
if (!autoloadconfigfile) // nope outta here
|
||||
{
|
||||
autoloadcount = postloadcount = 0; // so D_AddAutoloadFiles can skip everything since nothings there to autoload
|
||||
wasautoloaded = postautoloaded = true; // so D_AddAutoloadFiles can skip everything since nothings there to autoload
|
||||
return;
|
||||
}
|
||||
|
||||
while (fgets(wadsToAutoload, sizeof(wadsToAutoload), autoloadconfigfile) != NULL)
|
||||
while (fgets(wadsToAutoload, sizeof wadsToAutoload, autoloadconfigfile) != NULL)
|
||||
{
|
||||
postload = false;
|
||||
|
||||
// skip if commented or empty
|
||||
if (wadsToAutoload[0] == '\n' ||
|
||||
wadsToAutoload[0] == '#' ||
|
||||
wadsToAutoload[0] == '\0')
|
||||
if ((wadsToAutoload[1] == '\0' || wadsToAutoload[1] == '\n')
|
||||
|| (wadsToAutoload[0] == '#'))
|
||||
continue;
|
||||
|
||||
// this marks it so that it loads after loading server addons
|
||||
if (fastncmp(wadsToAutoload, "postload ", 9))
|
||||
else if (fastncmp(wadsToAutoload, "postload ", 9))
|
||||
{
|
||||
strremove(wadsToAutoload, "postload ");
|
||||
postload = true;
|
||||
}
|
||||
|
||||
// Remove Any Empty or Skipped Lines
|
||||
newline = strchr(wadsToAutoload, '\n');
|
||||
if (newline)
|
||||
*newline = '\0';
|
||||
for (i = 0; wadsToAutoload[i] != '\0'; i++)
|
||||
{
|
||||
if (wadsToAutoload[i] == '\n')
|
||||
wadsToAutoload[i] = '\0';
|
||||
}
|
||||
|
||||
if (!postload && W_CheckPostLoadList(wadsToAutoload))
|
||||
{
|
||||
@@ -1192,19 +1184,14 @@ static void D_FindAddonsToAutoload(void)
|
||||
|
||||
// LOAD IT
|
||||
if (!postload)
|
||||
{
|
||||
D_AutoloadFile(wadsToAutoload, autoloadwadfiles, autoloadcount);
|
||||
autoloadcount++;
|
||||
}
|
||||
D_AutoloadFile(wadsToAutoload, autoloadwadfiles);
|
||||
else
|
||||
{
|
||||
D_AutoloadFile(wadsToAutoload, autoloadwadfilespost, postloadcount);
|
||||
postloadcount++;
|
||||
}
|
||||
}
|
||||
D_AutoloadFile(wadsToAutoload, autoloadwadfilespost);
|
||||
|
||||
autoloadwadfiles[autoloadcount] = NULL;
|
||||
autoloadwadfilespost[postloadcount] = NULL;
|
||||
// end it here
|
||||
for (i = 0; wadsToAutoload[i] != '\0'; i++)
|
||||
wadsToAutoload[i] = '\0';
|
||||
}
|
||||
|
||||
// we dont want memory leaks around here do we?
|
||||
fclose(autoloadconfigfile);
|
||||
@@ -1212,47 +1199,41 @@ static void D_FindAddonsToAutoload(void)
|
||||
|
||||
static void D_AddAutoloadFiles(void)
|
||||
{
|
||||
// nothing to autoload
|
||||
if (autoloadcount == 0)
|
||||
if (wasautoloaded)
|
||||
return;
|
||||
|
||||
CONS_Printf("D_AutoloadFile(): Loading autoloaded addons...\n");
|
||||
|
||||
if (W_AddAutoloadedLocalFiles(autoloadwadfiles) == 0)
|
||||
CONS_Printf("D_AutoloadFile(): Are you sure you put in valid files or what?\n");
|
||||
D_CleanFile(autoloadwadfiles);
|
||||
|
||||
D_CleanFile(autoloadwadfiles, autoloadcount);
|
||||
|
||||
autoloadcount = 0;
|
||||
wasautoloaded = true;
|
||||
}
|
||||
|
||||
void D_AddPostloadFiles(void)
|
||||
{
|
||||
// nothing to postload
|
||||
if (postloadcount == 0 || !netgame)
|
||||
if (postautoloaded || !netgame)
|
||||
return;
|
||||
|
||||
CONS_Printf("D_AddPostloadFiles(): Loading postloaded addons...\n");
|
||||
|
||||
if (W_AddAutoloadedLocalFiles(autoloadwadfilespost) == 0)
|
||||
CONS_Printf("D_AddPostloadFiles(): Are you sure you put in valid files or what?\n");
|
||||
D_CleanFile(autoloadwadfilespost);
|
||||
|
||||
D_CleanFile(autoloadwadfilespost, postloadcount);
|
||||
|
||||
postloadcount = 0;
|
||||
postautoloaded = true;
|
||||
}
|
||||
|
||||
// ==========================================================================
|
||||
// Identify the SRB2 version, and IWAD file to use.
|
||||
// ==========================================================================
|
||||
|
||||
static boolean AddIWAD(const char * file, const char *dir)
|
||||
static boolean AddIWAD(void)
|
||||
{
|
||||
char * path = va(pandf, dir, file);
|
||||
char * path = va(pandf, srb2path, "srb2.srb");
|
||||
|
||||
if (FIL_ReadFileOK(path))
|
||||
{
|
||||
D_AddFile(path, startupiwadfiles, startupiwadcount++);
|
||||
D_AddFile(path, startupiwadfiles);
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -1295,7 +1276,7 @@ static void IdentifyVersion(void)
|
||||
}
|
||||
|
||||
// Load the IWAD
|
||||
if (!AddIWAD("srb2.srb", srb2path)) // not sure why this uses srb2path and not srb2waddir?
|
||||
if (!AddIWAD())
|
||||
{
|
||||
I_Error("SRB2.SRB not found! Expected in %s\n", srb2waddir);
|
||||
}
|
||||
@@ -1309,60 +1290,57 @@ static void IdentifyVersion(void)
|
||||
|
||||
#ifdef USE_PATCH_DTA
|
||||
// Add our crappy patches to fix our bugs
|
||||
if (!AddIWAD("patch.dta", srb2waddir))
|
||||
{
|
||||
I_Error("patch.dta not found! Expected in %s\n", srb2waddir);
|
||||
}
|
||||
D_AddFile(va(pandf,srb2waddir,"patch.dta"));
|
||||
#endif
|
||||
if (!AddIWAD("gfx.kart", srb2waddir))
|
||||
{
|
||||
I_Error("gfx.kart not found! Expected in %s\n", srb2waddir);
|
||||
}
|
||||
|
||||
if (!AddIWAD("textures.kart", srb2waddir))
|
||||
{
|
||||
I_Error("textures.kart not found! Expected in %s\n", srb2waddir);
|
||||
}
|
||||
|
||||
if (!AddIWAD("chars.kart", srb2waddir))
|
||||
{
|
||||
I_Error("chars.kart not found! Expected in %s\n", srb2waddir);
|
||||
}
|
||||
|
||||
if (!AddIWAD("maps.kart", srb2waddir))
|
||||
{
|
||||
I_Error("maps.kart not found! Expected in %s\n", srb2waddir);
|
||||
}
|
||||
D_AddFile(va(pandf, srb2waddir, "gfx.kart"), startupiwadfiles);
|
||||
D_AddFile(va(pandf, srb2waddir, "textures.kart"), startupiwadfiles);
|
||||
D_AddFile(va(pandf, srb2waddir, "chars.kart"), startupiwadfiles);
|
||||
D_AddFile(va(pandf, srb2waddir, "maps.kart"), startupiwadfiles);
|
||||
#ifdef USE_PATCH_KART
|
||||
if (!AddIWAD("patch.kart", srb2waddir))
|
||||
{
|
||||
I_Error("patch.kart not found! Expected in %s\n", srb2waddir);
|
||||
}
|
||||
D_AddFile(va(pandf,srb2waddir,"patch.kart"), startupiwadfiles);
|
||||
#endif
|
||||
|
||||
const char *path = NULL;
|
||||
|
||||
path = va(pandf, srb2waddir, "extra.kart");
|
||||
|
||||
// completely optional
|
||||
if (AddIWAD("extra.kart", srb2waddir))
|
||||
if (FIL_ReadFileOK(path))
|
||||
{
|
||||
D_AddFile(path, startupiwadfiles);
|
||||
found_extra_kart = true;
|
||||
}
|
||||
|
||||
path = va(pandf, srb2waddir, "extra2.kart");
|
||||
|
||||
// completely optional 2: Back with a vengence
|
||||
if (AddIWAD("extra2.kart", srb2waddir))
|
||||
if (FIL_ReadFileOK(path))
|
||||
{
|
||||
D_AddFile(path, startupiwadfiles);
|
||||
found_extra2_kart = true;
|
||||
}
|
||||
|
||||
if (AddIWAD("extra3.kart", srb2waddir))
|
||||
path = va(pandf, srb2waddir, "extra3.kart");
|
||||
|
||||
if (FIL_ReadFileOK(path))
|
||||
{
|
||||
D_AddFile(path, startupiwadfiles);
|
||||
found_extra3_kart = true;
|
||||
}
|
||||
|
||||
#if !defined (HAVE_SDL) || defined (HAVE_MIXER)
|
||||
#define MUSICTEST(str) \
|
||||
musicpath = va(pandf, srb2waddir, str);\
|
||||
musicpath = va(pandf,srb2waddir,str);\
|
||||
handle = W_OpenWadFile(&musicpath, false); \
|
||||
if (handle) \
|
||||
{ \
|
||||
{\
|
||||
int ms = W_VerifyNMUSlumps(musicpath, handle, false); \
|
||||
fclose(handle); \
|
||||
if (ms == 0) \
|
||||
I_Error("File " str " has been modified with non-music/sound lumps"); \
|
||||
if (ms == 1) \
|
||||
D_AddFile(musicpath, startupiwadfiles, startupiwadcount++); \
|
||||
D_AddFile(musicpath, startupiwadfiles); \
|
||||
}
|
||||
{
|
||||
const char *musicpath;
|
||||
@@ -1736,14 +1714,8 @@ void D_SRB2Main(void)
|
||||
else
|
||||
{
|
||||
// use user specific config file
|
||||
if (M_CheckParm("-workdir") && M_IsNextParm())
|
||||
snprintf(srb2home, sizeof srb2home, "%s", M_GetNextParm());
|
||||
else
|
||||
#ifdef DEFAULTDIR
|
||||
snprintf(srb2home, sizeof srb2home, "%s" PATHSEP DEFAULTDIR, userhome);
|
||||
#else // DEFAULTDIR
|
||||
snprintf(srb2home, sizeof srb2home, "%s", userhome);
|
||||
#endif // DEFAULTDIR
|
||||
snprintf(srb2home, sizeof srb2home, "%s" PATHSEP DEFAULTDIR, userhome);
|
||||
snprintf(downloaddir, sizeof downloaddir, "%s" PATHSEP "DOWNLOAD", srb2home);
|
||||
if (dedicated)
|
||||
snprintf(configfile, sizeof configfile, "%s" PATHSEP "d"CONFIGFILENAME, srb2home);
|
||||
@@ -1752,6 +1724,17 @@ void D_SRB2Main(void)
|
||||
|
||||
// can't use sprintf since there is %u in savegamename
|
||||
strcatbf(savegamename, srb2home, PATHSEP);
|
||||
#else
|
||||
snprintf(srb2home, sizeof srb2home, "%s", userhome);
|
||||
snprintf(downloaddir, sizeof downloaddir, "%s", userhome);
|
||||
if (dedicated)
|
||||
snprintf(configfile, sizeof configfile, "%s" PATHSEP "d"CONFIGFILENAME, userhome);
|
||||
else
|
||||
snprintf(configfile, sizeof configfile, "%s" PATHSEP CONFIGFILENAME, userhome);
|
||||
|
||||
// can't use sprintf since there is %u in savegamename
|
||||
strcatbf(savegamename, userhome, PATHSEP);
|
||||
#endif
|
||||
}
|
||||
|
||||
configfile[sizeof configfile - 1] = '\0';
|
||||
@@ -1777,9 +1760,6 @@ void D_SRB2Main(void)
|
||||
}
|
||||
}
|
||||
|
||||
// make sure workdir exists
|
||||
I_mkdir(srb2home, 0755);
|
||||
|
||||
// Create addons dir
|
||||
snprintf(addonsdir, sizeof addonsdir, "%s%s%s", srb2home, PATHSEP, "addons");
|
||||
I_mkdir(addonsdir, 0755);
|
||||
@@ -1808,7 +1788,7 @@ void D_SRB2Main(void)
|
||||
const char *s = M_GetNextParm();
|
||||
|
||||
if (s) // Check for NULL?
|
||||
D_AddFile(s, startuppwads, startuppwadcount++);
|
||||
D_AddFile(s, startuppwads);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1841,10 +1821,8 @@ void D_SRB2Main(void)
|
||||
// load wad, including the main wad file
|
||||
CONS_Printf("W_InitMultipleFiles(): Adding IWAD and main PWADs.\n");
|
||||
|
||||
W_InitMultipleFiles(startupiwadfiles, startupiwadcount, false);
|
||||
//mainwads = startupiwadcount - musicwads;
|
||||
D_CleanFile(startupiwadfiles, startupiwadcount);
|
||||
startupiwadcount = 0;
|
||||
W_InitMultipleFiles(startupiwadfiles, false);
|
||||
D_CleanFile(startupiwadfiles);
|
||||
mainwads = 0;
|
||||
|
||||
#ifndef DEVELOP
|
||||
@@ -1883,16 +1861,15 @@ void D_SRB2Main(void)
|
||||
|
||||
D_CheckMaps(false);
|
||||
|
||||
W_InitMultipleFiles(startuppwads, startuppwadcount, true);
|
||||
W_InitMultipleFiles(startuppwads, true);
|
||||
|
||||
// Only search for pwad maps if we actually have a pwad added
|
||||
if (startuppwadcount > 0)
|
||||
if (startuppwads[0] != NULL)
|
||||
{
|
||||
D_CheckMaps(true);
|
||||
}
|
||||
|
||||
D_CleanFile(startuppwads, startuppwadcount);
|
||||
startuppwadcount = 0;
|
||||
D_CleanFile(startuppwads);
|
||||
|
||||
cht_Init();
|
||||
|
||||
|
||||
@@ -61,6 +61,9 @@ extern boolean minilighticon; // mkwii-style minimap headlight
|
||||
//
|
||||
|
||||
// autoload stuff
|
||||
extern boolean autoloading;
|
||||
extern boolean autoloaded;
|
||||
extern boolean postautoloaded;
|
||||
void D_AddPostloadFiles(void);
|
||||
|
||||
// the infinite loop of D_SRB2Loop() called from win_main for windows version
|
||||
|
||||
+3
-2
@@ -1127,7 +1127,9 @@ boolean HGetPacket(void)
|
||||
|
||||
while (true)
|
||||
{
|
||||
if (!I_NetGet()) // No packets received
|
||||
I_NetGet();
|
||||
|
||||
if (doomcom->remotenode == -1) // No packet received
|
||||
return false;
|
||||
|
||||
getbytes += packetheaderlength + doomcom->datalength; // For stat
|
||||
@@ -1163,7 +1165,6 @@ boolean HGetPacket(void)
|
||||
GotAcks();
|
||||
continue;
|
||||
}
|
||||
|
||||
doomcom->datalength -= BASEPACKETSIZE;
|
||||
break;
|
||||
}
|
||||
|
||||
+54
-77
@@ -68,22 +68,22 @@
|
||||
// protos
|
||||
// ------
|
||||
|
||||
static void Got_NameAndColor(const UINT8 **cp, INT32 playernum);
|
||||
static void Got_WeaponPref(const UINT8 **cp, INT32 playernum);
|
||||
static void Got_Mapcmd(const UINT8 **cp, INT32 playernum);
|
||||
static void Got_ExitLevelcmd(const UINT8 **cp, INT32 playernum);
|
||||
static void Got_SetupVotecmd(const UINT8 **cp, INT32 playernum);
|
||||
static void Got_ModifyVotecmd(const UINT8 **cp, INT32 playernum);
|
||||
static void Got_PickVotecmd(const UINT8 **cp, INT32 playernum);
|
||||
static void Got_RequestAddfilecmd(const UINT8 **cp, INT32 playernum);
|
||||
static void Got_Addfilecmd(const UINT8 **cp, INT32 playernum);
|
||||
static void Got_Pause(const UINT8 **cp, INT32 playernum);
|
||||
static void Got_Respawn(const UINT8 **cp, INT32 playernum);
|
||||
static void Got_RandomSeed(const UINT8 **cp, INT32 playernum);
|
||||
static void Got_RunSOCcmd(const UINT8 **cp, INT32 playernum);
|
||||
static void Got_Teamchange(const UINT8 **cp, INT32 playernum);
|
||||
static void Got_Clearscores(const UINT8 **cp, INT32 playernum);
|
||||
static void Got_DiscordInfo(const UINT8 **cp, INT32 playernum);
|
||||
static void Got_NameAndColor(UINT8 **cp, INT32 playernum);
|
||||
static void Got_WeaponPref(UINT8 **cp, INT32 playernum);
|
||||
static void Got_Mapcmd(UINT8 **cp, INT32 playernum);
|
||||
static void Got_ExitLevelcmd(UINT8 **cp, INT32 playernum);
|
||||
static void Got_SetupVotecmd(UINT8 **cp, INT32 playernum);
|
||||
static void Got_ModifyVotecmd(UINT8 **cp, INT32 playernum);
|
||||
static void Got_PickVotecmd(UINT8 **cp, INT32 playernum);
|
||||
static void Got_RequestAddfilecmd(UINT8 **cp, INT32 playernum);
|
||||
static void Got_Addfilecmd(UINT8 **cp, INT32 playernum);
|
||||
static void Got_Pause(UINT8 **cp, INT32 playernum);
|
||||
static void Got_Respawn(UINT8 **cp, INT32 playernum);
|
||||
static void Got_RandomSeed(UINT8 **cp, INT32 playernum);
|
||||
static void Got_RunSOCcmd(UINT8 **cp, INT32 playernum);
|
||||
static void Got_Teamchange(UINT8 **cp, INT32 playernum);
|
||||
static void Got_Clearscores(UINT8 **cp, INT32 playernum);
|
||||
static void Got_DiscordInfo(UINT8 **cp, INT32 playernum);
|
||||
|
||||
static void PointLimit_OnChange(void);
|
||||
static void TimeLimit_OnChange(void);
|
||||
@@ -178,13 +178,13 @@ static void Command_Clearscores_f(void);
|
||||
// Remote Administration
|
||||
static void Command_Changepassword_f(void);
|
||||
static void Command_Login_f(void);
|
||||
static void Got_Login(const UINT8 **cp, INT32 playernum);
|
||||
static void Got_Verification(const UINT8 **cp, INT32 playernum);
|
||||
static void Got_Removal(const UINT8 **cp, INT32 playernum);
|
||||
static void Got_Login(UINT8 **cp, INT32 playernum);
|
||||
static void Got_Verification(UINT8 **cp, INT32 playernum);
|
||||
static void Got_Removal(UINT8 **cp, INT32 playernum);
|
||||
static void Command_Verify_f(void);
|
||||
static void Command_RemoveAdmin_f(void);
|
||||
static void Command_MotD_f(void);
|
||||
static void Got_MotD_f(const UINT8 **cp, INT32 playernum);
|
||||
static void Got_MotD_f(UINT8 **cp, INT32 playernum);
|
||||
|
||||
static void Command_ShowScores_f(void);
|
||||
static void Command_ShowTime_f(void);
|
||||
@@ -292,10 +292,6 @@ consvar_t cv_mouseturn = {"mouseturn", "Off", CV_SAVE, CV_OnOff, NULL, 0, NULL,
|
||||
// Lagless camera! Yay!
|
||||
consvar_t cv_laglesscam = {"lagless_camera", "Off", CV_SAVE, CV_OnOff, NULL, 0, NULL, NULL, 0, 0, NULL};
|
||||
|
||||
// makes the camera use the saved angleturn in replays instead of the players angle
|
||||
// more accurate to how the recording player seen things in game, but may be jittery if they encountered net issues
|
||||
consvar_t cv_demoangturn = {"useangleturninreplays", "Off", CV_SAVE, CV_OnOff, NULL, 0, NULL, NULL, 0, 0, NULL};
|
||||
|
||||
consvar_t cv_verticallook[MAXSPLITSCREENPLAYERS] = {
|
||||
{"verticallook", "On", CV_SAVE, CV_OnOff, NULL, 0, NULL, NULL, 0, 0, NULL},
|
||||
{"verticallook2", "On", CV_SAVE, CV_OnOff, NULL, 0, NULL, NULL, 0, 0, NULL},
|
||||
@@ -1047,7 +1043,6 @@ void D_RegisterClientCommands(void)
|
||||
CV_RegisterVar(&cv_betainterscreen);
|
||||
|
||||
CV_RegisterVar(&cv_laglesscam);
|
||||
CV_RegisterVar(&cv_demoangturn);
|
||||
|
||||
for (i = 0; i < MAXSPLITSCREENPLAYERS; i++)
|
||||
{
|
||||
@@ -1913,7 +1908,7 @@ static void SendNameAndColor4(void)
|
||||
SendNetXCmdForPlayer(3, XD_NAMEANDCOLOR, buf, p - buf);
|
||||
}
|
||||
|
||||
static void Got_NameAndColor(const UINT8 **cp, INT32 playernum)
|
||||
static void Got_NameAndColor(UINT8 **cp, INT32 playernum)
|
||||
{
|
||||
player_t *p = &players[playernum];
|
||||
char name[MAXPLAYERNAME+1];
|
||||
@@ -2041,17 +2036,15 @@ void SendWeaponPref4(void)
|
||||
SendNetXCmdForPlayer(3, XD_WEAPONPREF, buf, 1);
|
||||
}
|
||||
|
||||
static void Got_WeaponPref(const UINT8 **cp, INT32 playernum)
|
||||
static void Got_WeaponPref(UINT8 **cp,INT32 playernum)
|
||||
{
|
||||
player_t *player = &players[playernum];
|
||||
|
||||
UINT8 prefs = READUINT8(*cp);
|
||||
|
||||
player->pflags &= ~(PF_FLIPCAM|PF_ANALOGMODE);
|
||||
players[playernum].pflags &= ~(PF_FLIPCAM|PF_ANALOGMODE);
|
||||
if (prefs & 1)
|
||||
player->pflags |= PF_FLIPCAM;
|
||||
players[playernum].pflags |= PF_FLIPCAM;
|
||||
if (prefs & 2)
|
||||
player->pflags |= PF_ANALOGMODE;
|
||||
players[playernum].pflags |= PF_ANALOGMODE;
|
||||
}
|
||||
|
||||
void D_SendPlayerConfig(void)
|
||||
@@ -2494,18 +2487,15 @@ void D_SetupVote(void)
|
||||
INT32 i;
|
||||
UINT8 gt = (cv_kartgametypepreference.value == -1) ? gametype : cv_kartgametypepreference.value;
|
||||
UINT8 secondgt = G_SometimesGetDifferentGametype(gt);
|
||||
INT16 votebuffer[4] = {-1,-1,-1, 0};
|
||||
INT16 votebuffer[4] = {-1,-1,-1,0};
|
||||
INT16 luamaps[4] = {0, 0, 0, 0};
|
||||
|
||||
LUA_HookSetupVote(luamaps, sizeof(luamaps)/sizeof(luamaps[0]), gt, secondgt);
|
||||
|
||||
// Correct secondgt if needed
|
||||
if (luamaps[2])
|
||||
{
|
||||
UINT8 typeoflevel = mapheaderinfo[luamaps[2]-1]->typeoflevel;
|
||||
if ((typeoflevel & G_TOLFlag(secondgt&(~0x80))) == 0)
|
||||
secondgt = ((typeoflevel & TOL_RACE) ? GT_RACE : GT_MATCH)|(secondgt&0x80);
|
||||
}
|
||||
UINT8 typeoflevel = mapheaderinfo[luamaps[2]-1]->typeoflevel;
|
||||
if (luamaps[2] && (typeoflevel & G_TOLFlag(secondgt&(~0x80))) == 0)
|
||||
secondgt = ((typeoflevel & TOL_RACE) ? GT_RACE : GT_MATCH)|(secondgt&0x80);
|
||||
|
||||
if (cv_kartencore.value && gt == GT_RACE)
|
||||
WRITEUINT8(p, (gt|0x80));
|
||||
@@ -2606,18 +2596,14 @@ ConcatCommandArgv (int start, int end)
|
||||
size += strlen(COM_Argv(i)) + 1;
|
||||
}
|
||||
|
||||
p = final = ZZ_Alloc(size);
|
||||
|
||||
if (!p)
|
||||
I_Error("ConcatCommandArgv: Out of memory!\n");
|
||||
final = ZZ_Alloc(size);
|
||||
p = final;
|
||||
|
||||
--end;/* handle the final argument separately */
|
||||
|
||||
for (i = start; i < end; ++i)
|
||||
{
|
||||
p += sprintf(p, "%s ", COM_Argv(i));
|
||||
}
|
||||
|
||||
/* at this point "end" is actually the last argument's position */
|
||||
strcpy(p, COM_Argv(end));
|
||||
|
||||
@@ -2850,7 +2836,7 @@ static void Command_Map_f(void)
|
||||
* ::serverplayer or ::adminplayer.
|
||||
* \sa D_MapChange
|
||||
*/
|
||||
static void Got_Mapcmd(const UINT8 **cp, INT32 playernum)
|
||||
static void Got_Mapcmd(UINT8 **cp, INT32 playernum)
|
||||
{
|
||||
char mapname[MAX_WADPATH+1];
|
||||
UINT8 flags;
|
||||
@@ -2969,7 +2955,7 @@ static void Command_Pause(void)
|
||||
CONS_Printf(M_GetText("Only the server or a remote admin can use this.\n"));
|
||||
}
|
||||
|
||||
static void Got_Pause(const UINT8 **cp, INT32 playernum)
|
||||
static void Got_Pause(UINT8 **cp, INT32 playernum)
|
||||
{
|
||||
UINT8 dedicatedpause = false;
|
||||
const char *playername;
|
||||
@@ -3081,7 +3067,7 @@ static void Command_Respawn(void)
|
||||
SendNetXCmd(XD_RESPAWN, &buf, 4);
|
||||
}
|
||||
|
||||
static void Got_Respawn(const UINT8 **cp, INT32 playernum)
|
||||
static void Got_Respawn(UINT8 **cp, INT32 playernum)
|
||||
{
|
||||
INT32 respawnplayer = READINT32(*cp);
|
||||
|
||||
@@ -3116,7 +3102,7 @@ static void Got_Respawn(const UINT8 **cp, INT32 playernum)
|
||||
* \param playernum Player responsible for the message. Must be ::serverplayer.
|
||||
* \author Graue <graue@oceanbase.org>
|
||||
*/
|
||||
static void Got_RandomSeed(const UINT8 **cp, INT32 playernum)
|
||||
static void Got_RandomSeed(UINT8 **cp, INT32 playernum)
|
||||
{
|
||||
UINT32 seed;
|
||||
|
||||
@@ -3151,7 +3137,7 @@ static void Command_Clearscores_f(void)
|
||||
* \sa XD_CLEARSCORES, Command_Clearscores_f
|
||||
* \author SSNTails <http://www.ssntails.org>
|
||||
*/
|
||||
static void Got_Clearscores(const UINT8 **cp, INT32 playernum)
|
||||
static void Got_Clearscores(UINT8 **cp, INT32 playernum)
|
||||
{
|
||||
INT32 i;
|
||||
|
||||
@@ -3668,7 +3654,7 @@ static void Command_ServerTeamChange_f(void)
|
||||
}
|
||||
|
||||
//todo: This and the other teamchange functions are getting too long and messy. Needs cleaning.
|
||||
static void Got_Teamchange(const UINT8 **cp, INT32 playernum)
|
||||
static void Got_Teamchange(UINT8 **cp, INT32 playernum)
|
||||
{
|
||||
changeteam_union NetPacket;
|
||||
boolean error = false, wasspectator = false;
|
||||
@@ -4025,7 +4011,7 @@ static void Command_Login_f(void)
|
||||
#endif
|
||||
}
|
||||
|
||||
static void Got_Login(const UINT8 **cp, INT32 playernum)
|
||||
static void Got_Login(UINT8 **cp, INT32 playernum)
|
||||
{
|
||||
#ifdef NOMD5
|
||||
// If we have no MD5 support then completely disable XD_LOGIN responses for security.
|
||||
@@ -4135,7 +4121,7 @@ static void Command_Verify_f(void)
|
||||
SendNetXCmd(XD_VERIFIED, buf, 1);
|
||||
}
|
||||
|
||||
static void Got_Verification(const UINT8 **cp, INT32 playernum)
|
||||
static void Got_Verification(UINT8 **cp, INT32 playernum)
|
||||
{
|
||||
INT16 num = READUINT8(*cp);
|
||||
|
||||
@@ -4187,7 +4173,7 @@ static void Command_RemoveAdmin_f(void)
|
||||
SendNetXCmd(XD_DEMOTED, buf, 1);
|
||||
}
|
||||
|
||||
static void Got_Removal(const UINT8 **cp, INT32 playernum)
|
||||
static void Got_Removal(UINT8 **cp, INT32 playernum)
|
||||
{
|
||||
INT16 num = READUINT8(*cp);
|
||||
|
||||
@@ -4228,32 +4214,23 @@ static void Command_MotD_f(void)
|
||||
|
||||
mymotd = Z_Malloc(sizeof(motd), PU_STATIC, NULL);
|
||||
|
||||
if (!mymotd)
|
||||
return;
|
||||
//I_Error("Command_MotD_f: Out of memory!\n"); // idk if this aint a bit too much lel
|
||||
|
||||
strlcpy(mymotd, COM_Argv(1), sizeof(motd));
|
||||
|
||||
strlcpy(mymotd, COM_Argv(1), sizeof motd);
|
||||
for (i = 2; i < j; i++)
|
||||
{
|
||||
strlcat(mymotd, " ", sizeof(motd));
|
||||
strlcat(mymotd, COM_Argv(i), sizeof(motd));
|
||||
strlcat(mymotd, " ", sizeof motd);
|
||||
strlcat(mymotd, COM_Argv(i), sizeof motd);
|
||||
}
|
||||
|
||||
// Disallow non-printing characters and semicolons.
|
||||
for (i = 0; mymotd[i] != '\0'; i++)
|
||||
{
|
||||
if (!isprint(mymotd[i]) || mymotd[i] == ';')
|
||||
{
|
||||
Z_Free(mymotd);
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
if ((netgame || multiplayer) && client)
|
||||
{
|
||||
SendNetXCmd(XD_SETMOTD, mymotd, i); // send the actual size of the motd string, not the full buffer's size
|
||||
}
|
||||
else
|
||||
{
|
||||
strcpy(motd, mymotd);
|
||||
@@ -4263,7 +4240,7 @@ static void Command_MotD_f(void)
|
||||
Z_Free(mymotd);
|
||||
}
|
||||
|
||||
static void Got_MotD_f(const UINT8 **cp, INT32 playernum)
|
||||
static void Got_MotD_f(UINT8 **cp, INT32 playernum)
|
||||
{
|
||||
char *mymotd = Z_Malloc(sizeof(motd), PU_STATIC, NULL);
|
||||
INT32 i;
|
||||
@@ -4330,7 +4307,7 @@ static void Command_RunSOC(void)
|
||||
SendNetXCmd(XD_RUNSOC, buf, length);
|
||||
}
|
||||
|
||||
static void Got_RunSOCcmd(const UINT8 **cp, INT32 playernum)
|
||||
static void Got_RunSOCcmd(UINT8 **cp, INT32 playernum)
|
||||
{
|
||||
char filename[256];
|
||||
filestatus_t ncs = FS_NOTCHECKED;
|
||||
@@ -4452,7 +4429,7 @@ static void Command_Addfile(void)
|
||||
}
|
||||
|
||||
// Add file on your client directly if it is trivial, or you aren't in a netgame.
|
||||
if (!netgame || musiconly)
|
||||
if (!(netgame || multiplayer) || musiconly)
|
||||
{
|
||||
P_AddWadFile(fn, false);
|
||||
return;
|
||||
@@ -4495,7 +4472,7 @@ static void Command_Addfile(void)
|
||||
if (IsPlayerAdmin(consoleplayer) && (!server)) // Request to add file
|
||||
SendNetXCmd(XD_REQADDFILE, buf, buf_p - buf);
|
||||
else
|
||||
SendNetXCmd(XD_ADDFILE, buf, buf_p - buf);
|
||||
SendNetXCmd(XD_ADDFILE, buf, buf_p - buf);;
|
||||
}
|
||||
|
||||
/** Adds something at runtime.
|
||||
@@ -4608,7 +4585,7 @@ static void Command_GLocalSkin (void)
|
||||
}
|
||||
}
|
||||
|
||||
static void Got_RequestAddfilecmd(const UINT8 **cp, INT32 playernum)
|
||||
static void Got_RequestAddfilecmd(UINT8 **cp, INT32 playernum)
|
||||
{
|
||||
char filename[241];
|
||||
filestatus_t ncs = FS_NOTCHECKED;
|
||||
@@ -4667,7 +4644,7 @@ static void Got_RequestAddfilecmd(const UINT8 **cp, INT32 playernum)
|
||||
COM_BufAddText(va("addfile %s\n", filename));
|
||||
}
|
||||
|
||||
static void Got_Addfilecmd(const UINT8 **cp, INT32 playernum)
|
||||
static void Got_Addfilecmd(UINT8 **cp, INT32 playernum)
|
||||
{
|
||||
char filename[241];
|
||||
filestatus_t ncs = FS_NOTCHECKED;
|
||||
@@ -5467,7 +5444,7 @@ static void Command_ExitLevel_f(void)
|
||||
SendNetXCmd(XD_EXITLEVEL, NULL, 0);
|
||||
}
|
||||
|
||||
static void Got_ExitLevelcmd(const UINT8 **cp, INT32 playernum)
|
||||
static void Got_ExitLevelcmd(UINT8 **cp, INT32 playernum)
|
||||
{
|
||||
(void)cp;
|
||||
|
||||
@@ -5488,7 +5465,7 @@ static void Got_ExitLevelcmd(const UINT8 **cp, INT32 playernum)
|
||||
G_ExitLevel();
|
||||
}
|
||||
|
||||
static void Got_SetupVotecmd(const UINT8 **cp, INT32 playernum)
|
||||
static void Got_SetupVotecmd(UINT8 **cp, INT32 playernum)
|
||||
{
|
||||
INT32 i;
|
||||
UINT8 gt, secondgt;
|
||||
@@ -5540,7 +5517,7 @@ static void Got_SetupVotecmd(const UINT8 **cp, INT32 playernum)
|
||||
Y_StartVote();
|
||||
}
|
||||
|
||||
static void Got_ModifyVotecmd(const UINT8 **cp, INT32 playernum)
|
||||
static void Got_ModifyVotecmd(UINT8 **cp, INT32 playernum)
|
||||
{
|
||||
SINT8 voted = READSINT8(*cp);
|
||||
UINT8 p = READUINT8(*cp);
|
||||
@@ -5549,7 +5526,7 @@ static void Got_ModifyVotecmd(const UINT8 **cp, INT32 playernum)
|
||||
votes[p] = voted;
|
||||
}
|
||||
|
||||
static void Got_PickVotecmd(const UINT8 **cp, INT32 playernum)
|
||||
static void Got_PickVotecmd(UINT8 **cp, INT32 playernum)
|
||||
{
|
||||
SINT8 pick = READSINT8(*cp);
|
||||
SINT8 level = READSINT8(*cp);
|
||||
@@ -6189,7 +6166,7 @@ static void KartEliminateLast_OnChange(void)
|
||||
P_CheckRacers();
|
||||
}
|
||||
|
||||
void Got_DiscordInfo(const UINT8 **p, INT32 playernum)
|
||||
void Got_DiscordInfo(UINT8 **p, INT32 playernum)
|
||||
{
|
||||
if (playernum != serverplayer /*&& !IsPlayerAdmin(playernum)*/)
|
||||
{
|
||||
|
||||
@@ -209,8 +209,6 @@ extern consvar_t cv_betainterscreen;
|
||||
|
||||
extern consvar_t cv_laglesscam;
|
||||
|
||||
extern consvar_t cv_demoangturn;
|
||||
|
||||
typedef enum
|
||||
{
|
||||
SKINMENUTYPE_SCROLL = 0,
|
||||
|
||||
@@ -1442,7 +1442,7 @@ static INT32 errorcount = 0;
|
||||
*/
|
||||
static boolean shutdowning = false;
|
||||
|
||||
FUNCIERROR void ATTRNORETURN I_Error(const char *error, ...)
|
||||
void I_Error(const char *error, ...)
|
||||
{
|
||||
va_list argptr;
|
||||
char buffer[8192];
|
||||
|
||||
@@ -651,9 +651,7 @@ extern const char *compdate, *comptime, *comprevision, *compbranch;
|
||||
|
||||
#if defined (HAVE_CURL)
|
||||
#define MASTERSERVER
|
||||
#ifndef NOHOLEPUNCH
|
||||
#define HOLEPUNCH
|
||||
#endif
|
||||
#else
|
||||
#undef UPDATE_ALERT
|
||||
#endif
|
||||
|
||||
@@ -116,10 +116,7 @@ extern UINT8 window_notinfocus; // are we in focus? (backend independant -- hand
|
||||
extern boolean nodrawers;
|
||||
extern boolean noblit;
|
||||
extern boolean lastdraw;
|
||||
|
||||
#ifdef MOTIONBLUR
|
||||
extern INT32 postimgparam[MAXSPLITSCREENPLAYERS];
|
||||
#endif
|
||||
|
||||
extern INT32 viewwindowx, viewwindowy;
|
||||
extern INT32 viewwidth;
|
||||
|
||||
@@ -963,7 +963,6 @@ void F_StartTitleScreen(void)
|
||||
finalecount = 0;
|
||||
else
|
||||
wipegamestate = GS_TITLESCREEN;
|
||||
|
||||
G_SetGamestate(GS_TITLESCREEN);
|
||||
CON_ClearHUD();
|
||||
|
||||
|
||||
+317
-384
File diff suppressed because it is too large.
Load diff
@@ -4061,11 +4061,7 @@ char *G_BuildMapTitle(INT32 mapnum)
|
||||
|
||||
title = Z_Malloc(len, PU_STATIC, NULL);
|
||||
|
||||
if (!title)
|
||||
return NULL;
|
||||
|
||||
sprintf(title, "%s", mapheaderinfo[mapnum-1]->lvlttl);
|
||||
|
||||
if (zonetext) sprintf(title + strlen(title), " %s", zonetext);
|
||||
if (actnum) sprintf(title + strlen(title), " %s", actnum);
|
||||
}
|
||||
|
||||
+21
-26
@@ -437,16 +437,8 @@ void HWR_MakePatch(const patch_t *patch, GLPatch_t *glPatch, GLMipmap_t *glMipma
|
||||
// CACHING HANDLING
|
||||
// =================================================
|
||||
|
||||
typedef struct
|
||||
{
|
||||
GLMapTexture_t normal;
|
||||
#ifdef GLENCORE
|
||||
GLMapTexture_t encore;
|
||||
#endif
|
||||
} GLMapTextureSet_t; // idk i suck at naming things
|
||||
|
||||
static size_t gl_numtextures = 0; // Texture count
|
||||
static GLMapTextureSet_t *gl_textures; // For all textures
|
||||
static GLMapTexture_t *gl_textures; // For all textures
|
||||
|
||||
static void HWR_FreeTextureData(patch_t *patch)
|
||||
{
|
||||
@@ -586,12 +578,13 @@ void HWR_FreeMapTextures(void)
|
||||
{
|
||||
size_t i;
|
||||
|
||||
for (i = 0; i < gl_numtextures; i++)
|
||||
{
|
||||
FreeMapTexture(&gl_textures[i].normal);
|
||||
#ifdef GLENCORE
|
||||
FreeMapTexture(&gl_textures[i].encore);
|
||||
for (i = 0; i < gl_numtextures*2; i++)
|
||||
#else
|
||||
for (i = 0; i < gl_numtextures; i++)
|
||||
#endif
|
||||
{
|
||||
FreeMapTexture(&gl_textures[i]);
|
||||
}
|
||||
|
||||
// now the heap don't have any 'user' pointing to our
|
||||
@@ -610,7 +603,7 @@ static void HWR_PrecacheLevelFlats(void)
|
||||
|
||||
// special case for encore
|
||||
#ifdef GLENCORE
|
||||
if (encoremap)
|
||||
if (encoremode)
|
||||
{
|
||||
// go through all sectors to determine if it should be remapped for encore
|
||||
for (i = 0; i < numsectors; i++)
|
||||
@@ -685,6 +678,8 @@ static void HWR_PrecacheLevelTextures(void)
|
||||
const line_t *line = &lines[i];
|
||||
#ifdef GLENCORE
|
||||
const int noencoremap = ((encoremap && (line->flags & ML_TFERLINE)) ? 2 : 1);
|
||||
#else
|
||||
const int noencoremap = 1;
|
||||
#endif
|
||||
// two sides
|
||||
for (j = 0; j < 2; j++)
|
||||
@@ -700,14 +695,11 @@ static void HWR_PrecacheLevelTextures(void)
|
||||
for (f = 0; f < 3; f++)
|
||||
{
|
||||
const INT32 texnum = sidetex[f];
|
||||
|
||||
if (texnum < 0 || texnum >= numtextures || texturepresent[texnum])
|
||||
continue;
|
||||
#ifdef GLENCORE
|
||||
|
||||
texturepresent[texnum] = 1|noencoremap;
|
||||
#else
|
||||
texturepresent[texnum] = 1;
|
||||
#endif
|
||||
|
||||
HWR_GetTexture(texnum, false);
|
||||
#ifdef GLENCORE
|
||||
if (noencoremap & 2)
|
||||
@@ -745,7 +737,7 @@ static void HWR_PrecacheLevelTextures(void)
|
||||
free(texturepresent);
|
||||
}
|
||||
|
||||
/*static void HWR_PrecacheLevelSprites(void)
|
||||
static void HWR_PrecacheLevelSprites(void)
|
||||
{
|
||||
patch_t *spritepatch;
|
||||
char *spritepresent;
|
||||
@@ -808,11 +800,11 @@ static void HWR_PrecacheLevelTextures(void)
|
||||
}
|
||||
}
|
||||
free(spritepresent);
|
||||
}*/
|
||||
}
|
||||
|
||||
void HWR_PrecacheLevel(void)
|
||||
{
|
||||
if (gamestate != GS_LEVEL || !cv_precachetextures.value)
|
||||
if (gamestate != GS_LEVEL)
|
||||
return;
|
||||
|
||||
// Precache flats.
|
||||
@@ -822,7 +814,7 @@ void HWR_PrecacheLevel(void)
|
||||
HWR_PrecacheLevelTextures();
|
||||
|
||||
// Precache sprites.
|
||||
//HWR_PrecacheLevelSprites();
|
||||
HWR_PrecacheLevelSprites();
|
||||
}
|
||||
|
||||
void HWR_LoadMapTextures(size_t pnumtextures)
|
||||
@@ -831,8 +823,11 @@ void HWR_LoadMapTextures(size_t pnumtextures)
|
||||
HWR_FreeMapTextures();
|
||||
|
||||
gl_numtextures = pnumtextures;
|
||||
gl_textures = calloc(gl_numtextures, sizeof(*gl_textures)); // *2 - 1 for encore-remapped texture and another for noencore texture (unused when not in encore), see: GLMapTextureSet_t
|
||||
|
||||
#ifdef GLENCORE
|
||||
gl_textures = calloc(gl_numtextures, sizeof (*gl_textures)*2); // *2 - 1 for encore-remapped texture and another for noencore texture (unused when not in encore)
|
||||
#else
|
||||
gl_textures = calloc(gl_numtextures, sizeof (*gl_textures));
|
||||
#endif
|
||||
if (gl_textures == NULL)
|
||||
I_Error("HWR_LoadMapTextures: ran out of memory for OpenGL textures. Sad!");
|
||||
}
|
||||
@@ -856,7 +851,7 @@ GLMapTexture_t *HWR_GetTexture(INT32 tex, boolean noencore)
|
||||
// Every texture in memory, stored in the
|
||||
// hardware renderer's bit depth format. Wow!
|
||||
#ifdef GLENCORE
|
||||
gltex = (encoremap && !noencore) ? &gl_textures[tex].encore : &gl_textures[tex].normal;
|
||||
gltex = &gl_textures[tex*2 + (encoremap && !noencore ? 0 : 1)];
|
||||
#else
|
||||
gltex = &gl_textures[tex];
|
||||
#endif
|
||||
|
||||
+28
-29
@@ -46,9 +46,9 @@ typedef struct
|
||||
UINT8 image_descriptor; //18
|
||||
} ATTRPACK TGAHeader; // sizeof is 18
|
||||
|
||||
static const UINT8 softwaretranstogl[11] = { 0, 25, 51, 76,102,127,153,178,204,229,255};
|
||||
static const UINT8 softwaretranstogl_hi[11] = { 0, 51,102,153,204,255,255,255,255,255,255};
|
||||
static const UINT8 softwaretranstogl_lo[11] = { 0, 12, 24, 36, 48, 60, 71, 83, 95,111,127};
|
||||
static UINT8 softwaretranstogl[11] = { 0, 25, 51, 76,102,127,153,178,204,229,255};
|
||||
static UINT8 softwaretranstogl_hi[11] = { 0, 51,102,153,204,255,255,255,255,255,255};
|
||||
static UINT8 softwaretranstogl_lo[11] = { 0, 12, 24, 36, 48, 60, 71, 83, 95,111,127};
|
||||
|
||||
static const float FLOATBASEVIDWIDTH = (float)BASEVIDWIDTH;
|
||||
static const float FLOATBASEVIDHEIGHT = (float)BASEVIDHEIGHT;
|
||||
@@ -87,15 +87,15 @@ void HWR_DrawStretchyFixedPatch(patch_t *gpatch, fixed_t x, fixed_t y, fixed_t p
|
||||
|
||||
switch (option & V_SCALEPATCHMASK)
|
||||
{
|
||||
case V_NOSCALEPATCH:
|
||||
dup = 1.0f;
|
||||
break;
|
||||
case V_SMALLSCALEPATCH:
|
||||
dup = (float)vid.smalldup;
|
||||
break;
|
||||
case V_MEDSCALEPATCH:
|
||||
dup = (float)vid.meddup;
|
||||
break;
|
||||
case V_NOSCALEPATCH:
|
||||
dup = 1.0f;
|
||||
break;
|
||||
case V_SMALLSCALEPATCH:
|
||||
dup = (float)vid.smalldup;
|
||||
break;
|
||||
case V_MEDSCALEPATCH:
|
||||
dup = (float)vid.meddup;
|
||||
break;
|
||||
}
|
||||
|
||||
fscalew = fscaleh = FIXED_TO_FLOAT(pscale);
|
||||
@@ -269,15 +269,15 @@ void HWR_DrawCroppedPatch(patch_t *gpatch, fixed_t x, fixed_t y, fixed_t pscale,
|
||||
|
||||
switch (option & V_SCALEPATCHMASK)
|
||||
{
|
||||
case V_NOSCALEPATCH:
|
||||
dup = 1.0f;
|
||||
break;
|
||||
case V_SMALLSCALEPATCH:
|
||||
dup = (float)vid.smalldup;
|
||||
break;
|
||||
case V_MEDSCALEPATCH:
|
||||
dup = (float)vid.meddup;
|
||||
break;
|
||||
case V_NOSCALEPATCH:
|
||||
dup = 1.0f;
|
||||
break;
|
||||
case V_SMALLSCALEPATCH:
|
||||
dup = (float)vid.smalldup;
|
||||
break;
|
||||
case V_MEDSCALEPATCH:
|
||||
dup = (float)vid.meddup;
|
||||
break;
|
||||
}
|
||||
|
||||
fscale = FIXED_TO_FLOAT(pscale);
|
||||
@@ -506,7 +506,7 @@ void HWR_FadeScreenMenuBack(UINT16 color, UINT8 strength)
|
||||
|
||||
if (color & 0xFF00) // Do COLORMAP fade.
|
||||
{
|
||||
if (cv_glscreentextures.value && HWR_ShouldUsePaletteRendering())
|
||||
if (HWR_ShouldUsePaletteRendering() && cv_glscreentextures.value)
|
||||
{
|
||||
const hwdscreentexture_t scr_tex = HWD_SCREENTEXTURE_GENERIC2;
|
||||
|
||||
@@ -518,10 +518,12 @@ void HWR_FadeScreenMenuBack(UINT16 color, UINT8 strength)
|
||||
GL_UnSetShader();
|
||||
return;
|
||||
}
|
||||
|
||||
Surf.PolyColor.rgba = UINT2RGBA(0x01010160);
|
||||
Surf.PolyColor.s.alpha = (strength*8);
|
||||
poly_flags |= PF_Translucent;
|
||||
else
|
||||
{
|
||||
Surf.PolyColor.rgba = UINT2RGBA(0x01010160);
|
||||
Surf.PolyColor.s.alpha = (strength*8);
|
||||
poly_flags |= PF_Translucent;
|
||||
}
|
||||
}
|
||||
else // Do TRANSMAP** fade.
|
||||
{
|
||||
@@ -888,13 +890,11 @@ void HWR_DrawFill(INT32 x, INT32 y, INT32 w, INT32 h, INT32 color)
|
||||
|
||||
if (fx >= vid.width || fy >= vid.height)
|
||||
return;
|
||||
|
||||
if (fx < 0)
|
||||
{
|
||||
fw += fx;
|
||||
fx = 0;
|
||||
}
|
||||
|
||||
if (fy < 0)
|
||||
{
|
||||
fh += fy;
|
||||
@@ -906,7 +906,6 @@ void HWR_DrawFill(INT32 x, INT32 y, INT32 w, INT32 h, INT32 color)
|
||||
|
||||
if (fx + fw > vid.width)
|
||||
fw = fvw - fx;
|
||||
|
||||
if (fy + fh > vid.height)
|
||||
fh = fvh - fy;
|
||||
|
||||
|
||||
+21
-30
@@ -280,7 +280,7 @@ static void Command_Say_f(void);
|
||||
static void Command_Sayto_f(void);
|
||||
static void Command_Sayteam_f(void);
|
||||
static void Command_CSay_f(void);
|
||||
static void Got_Saycmd(const UINT8 **p, INT32 playernum);
|
||||
static void Got_Saycmd(UINT8 **p, INT32 playernum);
|
||||
|
||||
void HU_LoadGraphics(void)
|
||||
{
|
||||
@@ -431,7 +431,7 @@ void HU_Start(void)
|
||||
|
||||
void HU_Shiftform(void)
|
||||
{
|
||||
shiftxform = (cv_keyboardlayout.value == 3) ? french_shiftxform : english_shiftxform;
|
||||
shiftxform = cv_keyboardlayout.value == 3 ? french_shiftxform : english_shiftxform;
|
||||
}
|
||||
|
||||
//======================================================================
|
||||
@@ -465,8 +465,8 @@ static INT16 addy = 0; // use this to make the messages scroll smoothly when one
|
||||
static void HU_removeChatText_Mini(void)
|
||||
{
|
||||
// MPC: Don't create new arrays, just iterate through an existing one
|
||||
for (size_t i = 0; i < chat_nummsg_min - 1; i++)
|
||||
{
|
||||
size_t i;
|
||||
for(i=0;i<chat_nummsg_min-1;i++) {
|
||||
strcpy(chat_mini[i], chat_mini[i+1]);
|
||||
chat_timers[i] = chat_timers[i+1];
|
||||
}
|
||||
@@ -485,8 +485,8 @@ static void HU_removeChatText_Log(void)
|
||||
return;
|
||||
|
||||
free(chat_log[0]);
|
||||
|
||||
for (size_t i = 0; i < chat_nummsg_log - 1;i++)
|
||||
size_t i;
|
||||
for(i=0;i<chat_nummsg_log-1;i++)
|
||||
{
|
||||
chat_log[i] = chat_log[i+1];
|
||||
}
|
||||
@@ -879,12 +879,11 @@ const char *HU_SkinColorToConsoleColor(skincolors_t color)
|
||||
* \sa DoSayCommand
|
||||
* \author Graue <graue@oceanbase.org>
|
||||
*/
|
||||
static void Got_Saycmd(const UINT8 **p, INT32 playernum)
|
||||
static void Got_Saycmd(UINT8 **p, INT32 playernum)
|
||||
{
|
||||
SINT8 target;
|
||||
UINT8 flags;
|
||||
const char *dispname;
|
||||
char buf[HU_MAXMSGLEN + 1];
|
||||
char *msg;
|
||||
boolean action = false;
|
||||
char *ptr;
|
||||
@@ -894,8 +893,8 @@ static void Got_Saycmd(const UINT8 **p, INT32 playernum)
|
||||
|
||||
target = READSINT8(*p);
|
||||
flags = READUINT8(*p);
|
||||
msg = buf;
|
||||
READSTRINGL(*p, msg, HU_MAXMSGLEN + 1);
|
||||
msg = (char *)*p;
|
||||
SKIPSTRINGL(*p, HU_MAXMSGLEN + 1);
|
||||
|
||||
if ((cv_mute.value || flags & (HU_CSAY|HU_SERVER_SAY)) && playernum != serverplayer && !(IsPlayerAdmin(playernum)))
|
||||
{
|
||||
@@ -1102,14 +1101,14 @@ void HU_Ticker(void)
|
||||
size_t i = 0;
|
||||
|
||||
// handle spam while we're at it:
|
||||
for(; (i < MAXPLAYERS); i++)
|
||||
for(; (i<MAXPLAYERS); i++)
|
||||
{
|
||||
if (stop_spamming[i] > 0)
|
||||
stop_spamming[i]--;
|
||||
}
|
||||
|
||||
// handle chat timers
|
||||
for (i = 0; (i < chat_nummsg_min); i++)
|
||||
for (i=0; (i<chat_nummsg_min); i++)
|
||||
{
|
||||
if (chat_timers[i] > 0)
|
||||
chat_timers[i]--;
|
||||
@@ -1232,7 +1231,7 @@ static void HU_SendChatMessage(void)
|
||||
nodenum[2] = '\0';
|
||||
|
||||
// check for undesirable characters in our "number"
|
||||
if (((nodenum[0] < '0') || (nodenum[0] > '9')) || ((nodenum[1] < '0') || (nodenum[1] > '9')))
|
||||
if (((nodenum[0] < '0') || (nodenum[0] > '9')) || ((nodenum[1] < '0') || (nodenum[1] > '9')))
|
||||
{
|
||||
// check if nodenum[1] is a space
|
||||
if (nodenum[1] == ' ')
|
||||
@@ -1500,7 +1499,7 @@ static void HU_drawMiniChat(void)
|
||||
if (splitscreen > 1)
|
||||
boxw = max(64, boxw/2);
|
||||
|
||||
for (; i > 0; i--)
|
||||
for (; i>0; i--)
|
||||
{
|
||||
char *msg = CHAT_WordWrap(x+2, boxw-(charwidth*2), V_SNAPTOBOTTOM|V_SNAPTOLEFT|V_ALLOWLOWERCASE, chat_mini[i-1]);
|
||||
size_t j = 0;
|
||||
@@ -1573,7 +1572,7 @@ static void HU_drawMiniChat(void)
|
||||
i = 0;
|
||||
prev_linereturn = false;
|
||||
|
||||
for (; i <= (chat_nummsg_min-1); i++) // iterate through our hot messages
|
||||
for (; i<=(chat_nummsg_min-1); i++) // iterate through our hot messages
|
||||
{
|
||||
INT32 clrflag = 0;
|
||||
INT32 timer = ((cv_chattime.value*TICRATE)-chat_timers[i]) - cv_chattime.value*TICRATE+9; // see below...
|
||||
@@ -1750,6 +1749,7 @@ static void HU_drawChatLog(INT32 offset)
|
||||
Z_Free(msg);
|
||||
}
|
||||
|
||||
|
||||
if (((chat_scroll >= chat_maxscroll) || (chat_scrollmedown)) && !(justscrolleddown || justscrolledup || chat_scrolltime)) // was already at the bottom of the page before new maxscroll calculation and was NOT scrolling.
|
||||
{
|
||||
atbottom = true; // we should scroll
|
||||
@@ -2284,7 +2284,6 @@ static void HU_DrawSongCreditsBox(void)
|
||||
V_DrawFill(x, y, strwidth*dup, BOXCREDITHEIGHT*dup, 28|flags|(bgt<<V_ALPHASHIFT));
|
||||
V_DrawFill(x+dup, y+dup, (strwidth-2)*dup, (BOXCREDITHEIGHT-2)*dup, 30|flags|(bgt<<V_ALPHASHIFT));
|
||||
}
|
||||
|
||||
if (cursongcredit.trans < NUMTRANSMAPS)
|
||||
{
|
||||
V_DrawSmallString(x+2*dup, y+2*dup, V_ALLOWLOWERCASE|flags|(cursongcredit.trans<<V_ALPHASHIFT), str);
|
||||
@@ -2846,8 +2845,12 @@ void HU_SetCEchoFlags(INT32 flags)
|
||||
|
||||
void HU_DoCEcho(const char *msg)
|
||||
{
|
||||
strlcpy(cechotext, msg, sizeof(cechotext));
|
||||
strlcat(cechotext, "\\", sizeof(cechotext));
|
||||
#pragma GCC diagnostic push
|
||||
#pragma GCC diagnostic ignored "-Wstringop-truncation" // This is fine, we set null byte later
|
||||
strncpy(cechotext, msg, sizeof(cechotext));
|
||||
#pragma GCC diagnostic pop
|
||||
strncat(cechotext, "\\", sizeof(cechotext) - strlen(cechotext) - 1);
|
||||
cechotext[sizeof(cechotext) - 1] = '\0';
|
||||
|
||||
// just print it to console
|
||||
if (cv_cechotoggle.value == 2)
|
||||
@@ -2856,20 +2859,8 @@ void HU_DoCEcho(const char *msg)
|
||||
strncpy(temp, cechotext, sizeof(temp));
|
||||
|
||||
for (char *p = temp; *p != '\0'; ++p)
|
||||
{
|
||||
if (*p == '\\')
|
||||
{
|
||||
*p = '\n';
|
||||
++p;
|
||||
char *skip_p = p; // Point at which we will move part of string after all \'s
|
||||
|
||||
while (*p == '\\')
|
||||
++p;
|
||||
|
||||
memmove(skip_p, p, strlen(p)+1); // move the rest of string with null byte
|
||||
p = skip_p; // Restore p
|
||||
}
|
||||
}
|
||||
|
||||
CONS_Printf("%s\n", temp);
|
||||
|
||||
|
||||
+34
-66
@@ -28,14 +28,14 @@
|
||||
#endif
|
||||
|
||||
#ifdef _WIN32
|
||||
#define USE_WINSOCK
|
||||
#define USE_WINSOCK
|
||||
#endif //WIN32 OS
|
||||
|
||||
#ifdef USE_WINSOCK
|
||||
#include <ws2tcpip.h>
|
||||
#define addrinfo_t ADDRINFOA
|
||||
#include <ws2tcpip.h>
|
||||
#define addrinfo_t ADDRINFOA
|
||||
#else
|
||||
#define addrinfo_t struct addrinfo
|
||||
#define addrinfo_t struct addrinfo
|
||||
#endif
|
||||
|
||||
#include "doomdef.h"
|
||||
@@ -148,16 +148,16 @@ static UINT8 UPNP_support = TRUE;
|
||||
|
||||
#define DEFAULTPORT "5029"
|
||||
|
||||
#ifdef USE_WINSOCK
|
||||
typedef SOCKET SOCKET_TYPE;
|
||||
#define ERRSOCKET (SOCKET_ERROR)
|
||||
#if defined (USE_WINSOCK)
|
||||
typedef SOCKET SOCKET_TYPE;
|
||||
#define ERRSOCKET (SOCKET_ERROR)
|
||||
#else
|
||||
#if defined (__unix__) || defined (__APPLE__) || defined (__HAIKU__)
|
||||
typedef int SOCKET_TYPE;
|
||||
#else
|
||||
typedef unsigned long SOCKET_TYPE;
|
||||
#endif
|
||||
#define ERRSOCKET (-1)
|
||||
#if defined (__unix__) || defined (__APPLE__) || defined (__HAIKU__)
|
||||
typedef int SOCKET_TYPE;
|
||||
#else
|
||||
typedef unsigned long SOCKET_TYPE;
|
||||
#endif
|
||||
#define ERRSOCKET (-1)
|
||||
#endif
|
||||
|
||||
#define IPV6_MULTICAST_ADDRESS "ff15::57e1:1a12"
|
||||
@@ -345,15 +345,17 @@ static const char *SOCK_AddrToStr(mysockaddr_t *sk)
|
||||
{
|
||||
static char s[64]; // 255.255.255.255:65535 or
|
||||
// [ffff:ffff:ffff:ffff:ffff:ffff:ffff:ffff]:65535
|
||||
|
||||
#ifdef HAVE_IPV6
|
||||
int v6 = (sk->any.sa_family == AF_INET6);
|
||||
#else
|
||||
int v6 = 0;
|
||||
#endif
|
||||
|
||||
void *addr;
|
||||
int e = 0; // save error code so it can't be modified later code and avoid calling WSAGetLastError() more then once
|
||||
|
||||
if (sk->any.sa_family == AF_INET)
|
||||
if(sk->any.sa_family == AF_INET)
|
||||
addr = &sk->ip4.sin_addr;
|
||||
#ifdef HAVE_IPV6
|
||||
else if(sk->any.sa_family == AF_INET6)
|
||||
@@ -362,11 +364,9 @@ static const char *SOCK_AddrToStr(mysockaddr_t *sk)
|
||||
else
|
||||
addr = NULL;
|
||||
|
||||
if (addr == NULL)
|
||||
{
|
||||
if(addr == NULL)
|
||||
sprintf(s, "No address");
|
||||
}
|
||||
else if (inet_ntop(sk->any.sa_family, addr, &s[v6], sizeof (s) - v6) == NULL)
|
||||
else if(inet_ntop(sk->any.sa_family, addr, &s[v6], sizeof (s) - v6) == NULL)
|
||||
{
|
||||
e = errno;
|
||||
sprintf(s, "Unknown family type, error #%u: %s", e, strerror(e));
|
||||
@@ -381,7 +381,7 @@ static const char *SOCK_AddrToStr(mysockaddr_t *sk)
|
||||
strcat(s, va(":%d", ntohs(sk->ip6.sin6_port)));
|
||||
}
|
||||
#endif
|
||||
else if (sk->any.sa_family == AF_INET && sk->ip4.sin_port != 0)
|
||||
else if(sk->any.sa_family == AF_INET && sk->ip4.sin_port != 0)
|
||||
strcat(s, va(":%d", ntohs(sk->ip4.sin_port)));
|
||||
|
||||
return s;
|
||||
@@ -481,6 +481,7 @@ static boolean SOCK_cmpaddr(mysockaddr_t *a, mysockaddr_t *b, UINT8 mask)
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
// This is a hack. For some reason, nodes aren't being freed properly.
|
||||
// This goes through and cleans up what nodes were supposed to be freed.
|
||||
/** \warning This function causes the file downloading to stop if someone joins.
|
||||
@@ -635,7 +636,7 @@ static boolean SOCK_Get(void)
|
||||
c = recvfrom(mysockets[n], (char *)&doomcom->data, MAXPACKETLENGTH, 0,
|
||||
(void *)&fromaddress, &fromlen);
|
||||
|
||||
if (c != ERRSOCKET)
|
||||
if (c > 0)
|
||||
{
|
||||
#ifdef USE_STUN
|
||||
if (STUN_got_response(doomcom->data, c))
|
||||
@@ -651,21 +652,20 @@ static boolean SOCK_Get(void)
|
||||
#endif
|
||||
|
||||
// find remote node number
|
||||
for (j = 1; j <= MAXNETNODES; j++) // include LAN
|
||||
for (j = 1; j <= MAXNETNODES; j++) //include LAN
|
||||
{
|
||||
if (SOCK_cmpaddr(&fromaddress, &clientaddress[j], 0))
|
||||
{
|
||||
doomcom->remotenode = (INT16)j; // good packet from a game player
|
||||
doomcom->datalength = (INT16)c;
|
||||
nodesocket[j] = mysockets[n];
|
||||
return true;
|
||||
return false;
|
||||
}
|
||||
}
|
||||
// not found
|
||||
|
||||
// find a free slot
|
||||
j = getfreenode();
|
||||
|
||||
if (j > 0)
|
||||
{
|
||||
const time_t curTime = time(NULL);
|
||||
@@ -752,7 +752,7 @@ static void SOCK_Send(void)
|
||||
int e = 0; // save error code so it can't be modified later code and avoid calling WSAGetLastError() more then once
|
||||
size_t i, j;
|
||||
|
||||
if (doomcom->remotenode < 0 || !nodeconnected[doomcom->remotenode])
|
||||
if (!nodeconnected[doomcom->remotenode])
|
||||
return;
|
||||
|
||||
if (doomcom->remotenode == BROADCASTADDR)
|
||||
@@ -970,7 +970,7 @@ static SOCKET_TYPE UDP_Bind(int family, struct sockaddr *addr, socklen_t addrlen
|
||||
e = errno;
|
||||
I_OutputMsg("getting SO_RCVBUF failed: #%u, %s\n", e, strerror(e));
|
||||
}
|
||||
CONS_Printf(M_GetText("Network receive buffer: %dKb\n"), opt>>10);
|
||||
CONS_Printf(M_GetText("Network system buffer: %dKb\n"), opt>>10);
|
||||
|
||||
if (opt < 64<<10) // 64k
|
||||
{
|
||||
@@ -991,44 +991,9 @@ static SOCKET_TYPE UDP_Bind(int family, struct sockaddr *addr, socklen_t addrlen
|
||||
}
|
||||
|
||||
if (opt < 64<<10)
|
||||
CONS_Alert(CONS_WARNING, M_GetText("Can't set receive buffer length to 64k, file transfer will be bad\n"));
|
||||
CONS_Alert(CONS_WARNING, M_GetText("Can't set buffer length to 64k, file transfer will be bad\n"));
|
||||
else
|
||||
CONS_Printf(M_GetText("Network receive buffer set to: %dKb\n"), opt>>10);
|
||||
}
|
||||
|
||||
opt = 0;
|
||||
opts = (socklen_t)sizeof(opt);
|
||||
rc = getsockopt(s, SOL_SOCKET, SO_SNDBUF, (char *)&opt, &opts);
|
||||
if (rc <= -1)
|
||||
{
|
||||
e = errno;
|
||||
I_OutputMsg("getting SO_SNDBUF failed: #%u, %s\n", e, strerror(e));
|
||||
}
|
||||
CONS_Printf(M_GetText("Network send buffer: %dKb\n"), opt>>10);
|
||||
|
||||
if (opt < 64<<10) // 64k
|
||||
{
|
||||
opt = 64<<10;
|
||||
opts = (socklen_t)sizeof(opt);
|
||||
rc = setsockopt(s, SOL_SOCKET, SO_SNDBUF, (char *)&opt, opts);
|
||||
if (rc <= -1)
|
||||
{
|
||||
e = errno;
|
||||
I_OutputMsg("setting SO_SNDBUF to %dKb failed: #%u, %s\n", opt>>10, e, strerror(e));
|
||||
}
|
||||
|
||||
opt = 0;
|
||||
rc = getsockopt(s, SOL_SOCKET, SO_SNDBUF, (char *)&opt, &opts);
|
||||
if (rc <= -1)
|
||||
{
|
||||
e = errno;
|
||||
I_OutputMsg("getting SO_SNDBUF failed: #%u, %s\n", e, strerror(e));
|
||||
}
|
||||
|
||||
if (opt < 64<<10)
|
||||
CONS_Alert(CONS_WARNING, M_GetText("Can't set send buffer length to 64k, file transfer will be bad\n"));
|
||||
else
|
||||
CONS_Printf(M_GetText("Network send system buffer set to: %dKb\n"), opt>>10);
|
||||
CONS_Printf(M_GetText("Network system buffer set to: %dKb\n"), opt>>10);
|
||||
}
|
||||
|
||||
rc = getsockname(s, &straddr.any, &len);
|
||||
@@ -1304,9 +1269,9 @@ void I_ShutdownTcpDriver(void)
|
||||
init_tcp_driver = false;
|
||||
}
|
||||
|
||||
static boolean SOCK_GetAddr(mysockaddr_t *sin, const char *address, const char *port, boolean test)
|
||||
static boolean SOCK_GetAddr(struct sockaddr_in *sin, const char *address, const char *port, boolean test)
|
||||
{
|
||||
addrinfo_t *ai, *runp, hints;
|
||||
addrinfo_t *ai = NULL, *runp, hints;
|
||||
int gaie;
|
||||
size_t i;
|
||||
|
||||
@@ -1322,7 +1287,10 @@ static boolean SOCK_GetAddr(mysockaddr_t *sin, const char *address, const char *
|
||||
gaie = getaddrinfo(address, port, &hints, &ai);
|
||||
|
||||
if (gaie != 0)
|
||||
{
|
||||
freeaddrinfo(ai);
|
||||
return false;
|
||||
}
|
||||
|
||||
runp = ai;
|
||||
|
||||
@@ -1362,7 +1330,7 @@ static SINT8 SOCK_NetMakeNodewPort(const char *address, const char *port)
|
||||
|
||||
if (newnode != -1)
|
||||
{
|
||||
if (!SOCK_GetAddr(&clientaddress[newnode], address, port, true))
|
||||
if (!SOCK_GetAddr(&clientaddress[newnode].ip4, address, port, true))
|
||||
{
|
||||
nodeconnected[newnode] = false;
|
||||
return -1;
|
||||
@@ -1390,7 +1358,7 @@ static void rendezvous(int size)
|
||||
|
||||
if (tic != refreshtic)
|
||||
{
|
||||
if (SOCK_GetAddr(&rzv, host, (port ? port : "7777"), false))
|
||||
if (SOCK_GetAddr(&rzv.ip4, host, (port ? port : "7777"), false))
|
||||
{
|
||||
refreshtic = tic;
|
||||
}
|
||||
|
||||
@@ -608,6 +608,9 @@ void K_GenerateKartColormap(UINT8 *dest_colormap, INT32 skinnum, UINT8 color, bo
|
||||
if (color >= MAXTRANSLATIONS)
|
||||
I_Error("Invalid skin color #%hu.", (UINT16)color);
|
||||
|
||||
if (skinnum < 0 && skinnum > TC_DEFAULT)
|
||||
I_Error("Invalid translation colormap index %d.", skinnum);
|
||||
|
||||
starttranscolor = (skinnum != TC_DEFAULT) ? K_GetSkinArray(local)[skinnum].starttranscolor : DEFAULT_STARTTRANSCOLOR;
|
||||
|
||||
if (starttranscolor >= NUM_PALETTE_ENTRIES)
|
||||
|
||||
+21
-7
@@ -377,7 +377,9 @@ static int lib_pSpawnMobj(lua_State *L)
|
||||
NOHUD
|
||||
if (type >= NUMMOBJTYPES)
|
||||
return luaL_error(L, "mobj type %d out of range (0 - %d)", type, NUMMOBJTYPES-1);
|
||||
LUA_PushUserdata(L, P_SpawnMobj(x, y, z, type), META_MOBJ);
|
||||
mobj_t *th = P_SpawnMobj(x, y, z, type);
|
||||
th->islocal = !hook_important;
|
||||
LUA_PushUserdata(L, th, META_MOBJ);
|
||||
return 1;
|
||||
}
|
||||
|
||||
@@ -403,7 +405,9 @@ static int lib_pSpawnMissile(lua_State *L)
|
||||
return LUA_ErrInvalid(L, "mobj_t");
|
||||
if (type >= NUMMOBJTYPES)
|
||||
return luaL_error(L, "mobj type %d out of range (0 - %d)", type, NUMMOBJTYPES-1);
|
||||
LUA_PushUserdata(L, P_SpawnMissile(source, dest, type), META_MOBJ);
|
||||
mobj_t *th = P_SpawnMissile(source, dest, type);
|
||||
th->islocal = !hook_important;
|
||||
LUA_PushUserdata(L, th, META_MOBJ);
|
||||
return 1;
|
||||
}
|
||||
|
||||
@@ -420,7 +424,9 @@ static int lib_pSpawnXYZMissile(lua_State *L)
|
||||
return LUA_ErrInvalid(L, "mobj_t");
|
||||
if (type >= NUMMOBJTYPES)
|
||||
return luaL_error(L, "mobj type %d out of range (0 - %d)", type, NUMMOBJTYPES-1);
|
||||
LUA_PushUserdata(L, P_SpawnXYZMissile(source, dest, type, x, y, z), META_MOBJ);
|
||||
mobj_t *th = P_SpawnXYZMissile(source, dest, type, x, y, z);
|
||||
th->islocal = !hook_important;
|
||||
LUA_PushUserdata(L, th, META_MOBJ);
|
||||
return 1;
|
||||
}
|
||||
|
||||
@@ -439,7 +445,9 @@ static int lib_pSpawnPointMissile(lua_State *L)
|
||||
return LUA_ErrInvalid(L, "mobj_t");
|
||||
if (type >= NUMMOBJTYPES)
|
||||
return luaL_error(L, "mobj type %d out of range (0 - %d)", type, NUMMOBJTYPES-1);
|
||||
LUA_PushUserdata(L, P_SpawnPointMissile(source, xa, ya, za, type, x, y, z), META_MOBJ);
|
||||
mobj_t *th = P_SpawnPointMissile(source, xa, ya, za, type, x, y, z);
|
||||
th->islocal = !hook_important;
|
||||
LUA_PushUserdata(L, th, META_MOBJ);
|
||||
return 1;
|
||||
}
|
||||
|
||||
@@ -456,7 +464,9 @@ static int lib_pSpawnAlteredDirectionMissile(lua_State *L)
|
||||
return LUA_ErrInvalid(L, "mobj_t");
|
||||
if (type >= NUMMOBJTYPES)
|
||||
return luaL_error(L, "mobj type %d out of range (0 - %d)", type, NUMMOBJTYPES-1);
|
||||
LUA_PushUserdata(L, P_SpawnAlteredDirectionMissile(source, type, x, y, z, shiftingAngle), META_MOBJ);
|
||||
mobj_t *th = P_SpawnAlteredDirectionMissile(source, type, x, y, z, shiftingAngle);
|
||||
th->islocal = !hook_important;
|
||||
LUA_PushUserdata(L, th, META_MOBJ);
|
||||
return 1;
|
||||
}
|
||||
|
||||
@@ -485,7 +495,9 @@ static int lib_pSPMAngle(lua_State *L)
|
||||
return LUA_ErrInvalid(L, "mobj_t");
|
||||
if (type >= NUMMOBJTYPES)
|
||||
return luaL_error(L, "mobj type %d out of range (0 - %d)", type, NUMMOBJTYPES-1);
|
||||
LUA_PushUserdata(L, P_SPMAngle(source, type, angle, allowaim, flags2), META_MOBJ);
|
||||
mobj_t *th = P_SPMAngle(source, type, angle, allowaim, flags2);
|
||||
th->islocal = !hook_important;
|
||||
LUA_PushUserdata(L, th, META_MOBJ);
|
||||
return 1;
|
||||
}
|
||||
|
||||
@@ -499,7 +511,9 @@ static int lib_pSpawnPlayerMissile(lua_State *L)
|
||||
return LUA_ErrInvalid(L, "mobj_t");
|
||||
if (type >= NUMMOBJTYPES)
|
||||
return luaL_error(L, "mobj type %d out of range (0 - %d)", type, NUMMOBJTYPES-1);
|
||||
LUA_PushUserdata(L, P_SpawnPlayerMissile(source, type, flags2), META_MOBJ);
|
||||
mobj_t *th = P_SpawnPlayerMissile(source, type, flags2);
|
||||
th->islocal = !hook_important;
|
||||
LUA_PushUserdata(L, th, META_MOBJ);
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
||||
+56
-61
@@ -28,29 +28,13 @@
|
||||
|
||||
#define NOHUD if (hud_running) return luaL_error(L, "HUD rendering code should not call this function!");
|
||||
|
||||
static consvar_t *this_cvar;
|
||||
static const char *cvname = NULL;
|
||||
|
||||
static void clear_lua_stack(void)
|
||||
{
|
||||
if (gL) // check if Lua is actually turned on first, you dummmy -- Monster Iestyn 04/07/18
|
||||
lua_settop(gL, 0); // clear stack
|
||||
}
|
||||
|
||||
void Got_Luacmd(const UINT8 **cp, INT32 playernum)
|
||||
void Got_Luacmd(UINT8 **cp, INT32 playernum)
|
||||
{
|
||||
UINT8 i, argc, flags;
|
||||
const char *argv[256];
|
||||
char buf[256];
|
||||
|
||||
argc = READUINT8(*cp);
|
||||
argv[0] = (const char*)*cp;
|
||||
SKIPSTRINGN(*cp, 255);
|
||||
for (i = 1; i < argc; i++)
|
||||
{
|
||||
argv[i] = (const char*)*cp;
|
||||
SKIPSTRINGN(*cp, 255);
|
||||
}
|
||||
|
||||
// don't use I_Assert here, goto the deny code below
|
||||
// to clean up and kick people who try nefarious exploits
|
||||
// like sending random junk lua commands to crash the server
|
||||
@@ -63,7 +47,8 @@ void Got_Luacmd(const UINT8 **cp, INT32 playernum)
|
||||
lua_getfield(gL, LUA_REGISTRYINDEX, "COM_Command"); // push COM_Command
|
||||
if (!lua_istable(gL, -1)) goto deny;
|
||||
|
||||
strlcpy(buf, argv[0], 255);
|
||||
argc = READUINT8(*cp);
|
||||
READSTRINGN(*cp, buf, 255);
|
||||
strlwr(buf); // must lowercase buffer
|
||||
lua_getfield(gL, -1, buf); // push command info table
|
||||
if (!lua_istable(gL, -1)) goto deny;
|
||||
@@ -89,17 +74,10 @@ void Got_Luacmd(const UINT8 **cp, INT32 playernum)
|
||||
|
||||
lua_remove(gL, -2); // pop command info table
|
||||
|
||||
if (!lua_checkstack(gL, argc)) // player + command arguments
|
||||
{
|
||||
clear_lua_stack();
|
||||
CONS_Alert(CONS_WARNING, "lua command stack overflow from %s (%d, need %d more)\n", player_names[playernum], lua_gettop(gL), argc);
|
||||
return;
|
||||
}
|
||||
|
||||
LUA_PushUserdata(gL, &players[playernum], META_PLAYER);
|
||||
for (i = 1; i < argc; i++)
|
||||
{
|
||||
strlcpy(buf, argv[i], 255);
|
||||
READSTRINGN(*cp, buf, 255);
|
||||
lua_pushstring(gL, buf);
|
||||
}
|
||||
LUA_Call(gL, (int)argc, 0, 1); // argc is 1-based, so this will cover the player we passed too.
|
||||
@@ -110,7 +88,8 @@ void Got_Luacmd(const UINT8 **cp, INT32 playernum)
|
||||
|
||||
deny:
|
||||
//must be hacked/buggy client
|
||||
clear_lua_stack();
|
||||
if (gL) // check if Lua is actually turned on first, you dummmy -- Monster Iestyn 04/07/18
|
||||
lua_settop(gL, 0); // clear stack
|
||||
|
||||
CONS_Alert(CONS_WARNING, M_GetText("Illegal lua command received from %s\n"), player_names[playernum]);
|
||||
if (server)
|
||||
@@ -154,7 +133,7 @@ void COM_Lua_f(void)
|
||||
{
|
||||
if (!splitscreen)
|
||||
{
|
||||
lua_pop(gL, 2); // pop command info table and LUA_GetErrorMessage
|
||||
lua_pop(gL, 1); // pop command info table
|
||||
return; // can't execute splitscreen command without player 2!
|
||||
}
|
||||
|
||||
@@ -199,13 +178,6 @@ void COM_Lua_f(void)
|
||||
I_Assert(lua_isfunction(gL, -1));
|
||||
lua_remove(gL, -2); // pop command info table
|
||||
|
||||
if (!lua_checkstack(gL, COM_Argc() + 1))
|
||||
{
|
||||
CONS_Alert(CONS_WARNING, "lua command stack overflow (%d, need %s more)\n", lua_gettop(gL), sizeu1(COM_Argc() + 1));
|
||||
lua_pop(gL, 2); // pop function and LUA_GetErrorMessage
|
||||
return;
|
||||
}
|
||||
|
||||
LUA_PushUserdata(gL, &players[playernum], META_PLAYER);
|
||||
for (i = 1; i < COM_Argc(); i++)
|
||||
lua_pushstring(gL, COM_Argv(i));
|
||||
@@ -312,13 +284,16 @@ static int lib_comBufInsertText(lua_State *L)
|
||||
return 0;
|
||||
}
|
||||
|
||||
void LUA_CVarChanged(void *cvar)
|
||||
void LUA_CVarChanged(const char *name)
|
||||
{
|
||||
this_cvar = cvar;
|
||||
cvname = name;
|
||||
}
|
||||
|
||||
static void Lua_OnChange(void)
|
||||
{
|
||||
I_Assert(gL != NULL);
|
||||
I_Assert(cvname != NULL);
|
||||
|
||||
/// \todo Network this! XD_LUAVAR
|
||||
|
||||
// Why?..
|
||||
@@ -330,10 +305,13 @@ static void Lua_OnChange(void)
|
||||
// From CV_OnChange registry field, get the function for this cvar by name.
|
||||
lua_getfield(gL, LUA_REGISTRYINDEX, "CV_OnChange");
|
||||
I_Assert(lua_istable(gL, -1));
|
||||
lua_pushlightuserdata(gL, this_cvar);
|
||||
lua_rawget(gL, -2); // get function
|
||||
lua_getfield(gL, -1, cvname); // get function
|
||||
|
||||
LUA_RawPushUserdata(gL, this_cvar);
|
||||
// From the CV_Vars registry field, get the cvar's userdata by name.
|
||||
lua_getfield(gL, LUA_REGISTRYINDEX, "CV_Vars");
|
||||
I_Assert(lua_istable(gL, -1));
|
||||
lua_getfield(gL, -1, cvname); // get consvar_t* userdata.
|
||||
lua_remove(gL, -2); // pop the CV_Vars table.
|
||||
|
||||
LUA_Call(gL, 1, 0, error_handler_i); // call function(cvar)
|
||||
lua_pop(gL, 2); // pop CV_OnChange table and error handler
|
||||
@@ -351,8 +329,9 @@ static int lib_cvRegisterVar(lua_State *L)
|
||||
luaL_checktype(L, 1, LUA_TTABLE);
|
||||
lua_settop(L, 1); // Clear out all other possible arguments, leaving only the first one.
|
||||
NOHUD
|
||||
cvar = ZZ_Calloc(sizeof(consvar_t));
|
||||
LUA_PushUserdata(L, cvar, META_CVAR);
|
||||
cvar = lua_newuserdata(L, sizeof(consvar_t));
|
||||
luaL_getmetatable(L, META_CVAR);
|
||||
lua_setmetatable(L, -2);
|
||||
|
||||
#define FIELDERROR(f, e) luaL_error(L, "bad value for " LUA_QL(f) " in table passed to " LUA_QL("CV_RegisterVar") " (%s)", e);
|
||||
#define TYPEERROR(f, t) FIELDERROR(f, va("%s expected, got %s", lua_typename(L, t), luaL_typename(L, -1)))
|
||||
@@ -405,7 +384,7 @@ static int lib_cvRegisterVar(lua_State *L)
|
||||
|
||||
lua_getfield(L, LUA_REGISTRYINDEX, "CV_PossibleValue");
|
||||
I_Assert(lua_istable(L, 5));
|
||||
lua_pushlightuserdata(L, cvar);
|
||||
lua_pushvalue(L, 2); // cvar userdata
|
||||
cvpv = lua_newuserdata(L, sizeof(CV_PossibleValue_t) * (count+1));
|
||||
lua_rawset(L, 5);
|
||||
lua_pop(L, 1); // pop CV_PossibleValue registry table
|
||||
@@ -433,14 +412,13 @@ static int lib_cvRegisterVar(lua_State *L)
|
||||
TYPEERROR("func", LUA_TFUNCTION)
|
||||
lua_getfield(L, LUA_REGISTRYINDEX, "CV_OnChange");
|
||||
I_Assert(lua_istable(L, 5));
|
||||
lua_pushlightuserdata(L, cvar);
|
||||
lua_pushvalue(L, 4);
|
||||
lua_rawset(L, 5);
|
||||
lua_setfield(L, 5, cvar->name);
|
||||
lua_pop(L, 1);
|
||||
cvar->func = Lua_OnChange;
|
||||
}
|
||||
else if (((i == 5 && !(cvar->flags & CV_CALL))
|
||||
|| (cvar->flags & CV_CALL && i == 6))
|
||||
|| (cvar->flags & CV_CALL && i == 6))
|
||||
|| (k && fasticmp(k, "category")))
|
||||
{
|
||||
category = lua_isnoneornil(L, 4) ? NULL : lua_tostring(L, 4);
|
||||
@@ -456,12 +434,18 @@ static int lib_cvRegisterVar(lua_State *L)
|
||||
#undef FIELDERROR
|
||||
#undef TYPEERROR
|
||||
|
||||
if (!cvar->name)
|
||||
return luaL_error(L, M_GetText("Variable has no name!\n"));
|
||||
if ((cvar->flags & CV_NOINIT) && !(cvar->flags & CV_CALL))
|
||||
return luaL_error(L, M_GetText("Variable %s has CV_NOINIT without CV_CALL\n"), cvar->name);
|
||||
if ((cvar->flags & CV_CALL) && !cvar->func)
|
||||
return luaL_error(L, M_GetText("Variable %s has CV_CALL without a function\n"), cvar->name);
|
||||
// stack: cvar table, cvar userdata
|
||||
lua_getfield(L, LUA_REGISTRYINDEX, "CV_Vars");
|
||||
I_Assert(lua_istable(L, 3));
|
||||
|
||||
lua_getfield(L, 3, cvar->name);
|
||||
if (lua_type(L, -1) != LUA_TNIL)
|
||||
return luaL_error(L, M_GetText("Variable %s is already defined\n"), cvar->name);
|
||||
lua_pop(L, 1);
|
||||
|
||||
lua_pushvalue(L, 2);
|
||||
lua_setfield(L, 3, cvar->name);
|
||||
lua_pop(L, 1);
|
||||
|
||||
// actually time to register it to the console now! Finally!
|
||||
cvar->flags |= CV_MODIFIED;
|
||||
@@ -493,9 +477,22 @@ static int lib_cvRegisterVar(lua_State *L)
|
||||
|
||||
static int lib_cvFindVar(lua_State *L)
|
||||
{
|
||||
const char *name = luaL_checkstring(L, 1);
|
||||
LUA_PushUserdata(L, CV_FindVar(name), META_CVAR);
|
||||
return 1;
|
||||
consvar_t *cv;
|
||||
if (( cv = CV_FindVar(luaL_checkstring(L,1)) ))
|
||||
{
|
||||
lua_settop(L,1);/* We only want one argument in the stack. */
|
||||
lua_pushlightuserdata(L, cv);/* Now the second value on stack. */
|
||||
luaL_getmetatable(L, META_CVAR);
|
||||
/*
|
||||
The metatable is the last value on the stack, so this
|
||||
applies it to the second value, which is the cvar.
|
||||
*/
|
||||
lua_setmetatable(L,2);
|
||||
lua_pushvalue(L,2);
|
||||
return 1;
|
||||
}
|
||||
else
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int CVarSetFunction
|
||||
@@ -504,7 +501,7 @@ static int CVarSetFunction
|
||||
void (*Set)(consvar_t *, const char *),
|
||||
void (*SetValue)(consvar_t *, INT32)
|
||||
){
|
||||
consvar_t *cvar = *(consvar_t **)luaL_checkudata(L, 1, META_CVAR);
|
||||
consvar_t *cvar = (consvar_t *)luaL_checkudata(L, 1, META_CVAR);
|
||||
|
||||
switch (lua_type(L, 2))
|
||||
{
|
||||
@@ -533,8 +530,7 @@ static int lib_cvStealthSet(lua_State *L)
|
||||
|
||||
static int lib_cvAddValue(lua_State *L)
|
||||
{
|
||||
consvar_t *cvar = *(consvar_t **)luaL_checkudata(L, 1, META_CVAR);
|
||||
|
||||
consvar_t *cvar = (consvar_t *)luaL_checkudata(L, 1, META_CVAR);
|
||||
CV_AddValue(cvar, (INT32)luaL_checknumber(L, 2));
|
||||
return 0;
|
||||
}
|
||||
@@ -549,7 +545,6 @@ static int lib_consPrintf(lua_State *L)
|
||||
if (n < 2)
|
||||
return luaL_error(L, "CONS_Printf requires at least two arguments: player and text.");
|
||||
//HUDSAFE
|
||||
|
||||
plr = *((player_t **)luaL_checkudata(L, 1, META_PLAYER));
|
||||
if (!plr)
|
||||
return LUA_ErrInvalid(L, "player_t");
|
||||
@@ -610,7 +605,7 @@ static int cvar_fields_ref = LUA_NOREF;
|
||||
|
||||
static int cvar_get(lua_State *L)
|
||||
{
|
||||
consvar_t *cvar = *(consvar_t **)luaL_checkudata(L, 1, META_CVAR);
|
||||
consvar_t *cvar = (consvar_t *)luaL_checkudata(L, 1, META_CVAR);
|
||||
enum cvar_e field = Lua_optoption(L, 2, -1, cvar_fields_ref);
|
||||
|
||||
switch (field)
|
||||
|
||||
@@ -109,6 +109,7 @@ ENUM (STRING_HOOK);
|
||||
|
||||
extern boolean hook_cmd_running; // This is used by PlayerCmd and lua_playerlib to prevent anything from being wirtten to player while we run PlayerCmd.
|
||||
extern int hook_defrosting;
|
||||
extern bool hook_important;
|
||||
|
||||
void LUA_HookVoid(int hook);
|
||||
void LUA_HookHUD(int hook, huddrawlist_h drawlist);
|
||||
|
||||
+26
-4
@@ -19,6 +19,7 @@
|
||||
#include "b_bot.h"
|
||||
#include "z_zone.h"
|
||||
#include "m_perfstats.h"
|
||||
#include "w_wad.h"
|
||||
|
||||
#include "lua_script.h"
|
||||
#include "lua_libs.h"
|
||||
@@ -39,14 +40,20 @@ LIST (stringHookNames, STRING_HOOK_LIST);
|
||||
|
||||
#undef LIST
|
||||
|
||||
typedef struct {
|
||||
int id;
|
||||
bool important;
|
||||
} hookinfo_t;
|
||||
|
||||
typedef struct {
|
||||
int numHooks;
|
||||
int *ids;
|
||||
hookinfo_t *ids;
|
||||
} hook_t;
|
||||
|
||||
typedef struct {
|
||||
int numGeneric;
|
||||
int ref;
|
||||
bool important;
|
||||
} stringhook_t;
|
||||
|
||||
static hook_t hookIds[HOOK(MAX)];
|
||||
@@ -56,6 +63,8 @@ static hook_t mobjHookIds[NUMMOBJTYPES][MOBJ_HOOK(MAX)];
|
||||
// Lua tables are used to lookup string hook ids.
|
||||
static stringhook_t stringHooks[STRING_HOOK(MAX)];
|
||||
|
||||
bool hook_important = true;
|
||||
|
||||
// This will be indexed by hook id, the value of which fetches the registry.
|
||||
static int * hookRefs;
|
||||
static int nextid;
|
||||
@@ -109,7 +118,11 @@ static void get_table(lua_State *L)
|
||||
|
||||
FUNCINLINE static ATTRINLINE void add_hook_to_table(lua_State *L, int n)
|
||||
{
|
||||
lua_newtable(L);
|
||||
lua_pushnumber(L, nextid);
|
||||
lua_rawseti(L, -2, 1);
|
||||
lua_pushboolean(L, wadfiles[numwadfiles-1]->important);
|
||||
lua_rawseti(L, -2, 2);
|
||||
lua_rawseti(L, -2, n);
|
||||
}
|
||||
|
||||
@@ -180,7 +193,8 @@ FUNCINLINE static ATTRINLINE void add_hook(hook_t *map)
|
||||
{
|
||||
Z_Realloc(map->ids, (map->numHooks + 1) * sizeof *map->ids,
|
||||
PU_STATIC, &map->ids);
|
||||
map->ids[map->numHooks++] = nextid;
|
||||
map->ids[map->numHooks].important = wadfiles[numwadfiles-1]->important;
|
||||
map->ids[map->numHooks++].id = nextid;
|
||||
}
|
||||
|
||||
FUNCINLINE static ATTRINLINE void add_mobj_hook(lua_State *L, int hook_type)
|
||||
@@ -287,6 +301,7 @@ struct Hook_State {
|
||||
const char * string;/* used to fetch table, ran first if set */
|
||||
int top;/* index of last argument passed to hook */
|
||||
int id;/* id to fetch ref */
|
||||
boolean important;/* is this hook from local addon */
|
||||
int values;/* num arguments passed to hook */
|
||||
int results;/* num values returned by hook */
|
||||
Hook_Callback results_handler;/* callback when hook successfully returns */
|
||||
@@ -416,22 +431,29 @@ FUNCINLINE static ATTRINLINE void init_hook_call
|
||||
hook->results_handler = results_handler;
|
||||
}
|
||||
|
||||
FUNCINLINE static ATTRINLINE void get_hook(Hook_State *hook, const int *ids, int n)
|
||||
FUNCINLINE static ATTRINLINE void get_hook(Hook_State *hook, const hookinfo_t *ids, int n)
|
||||
{
|
||||
hook->id = ids[n];
|
||||
hook->id = ids[n].id;
|
||||
hook->important = ids[n].important;
|
||||
lua_getref(gL, hookRefs[hook->id]);
|
||||
}
|
||||
|
||||
FUNCINLINE static ATTRINLINE void get_hook_from_table(Hook_State *hook, int n)
|
||||
{
|
||||
lua_rawgeti(gL, -1, n);
|
||||
lua_rawgeti(gL, -1, 1);
|
||||
hook->id = lua_tonumber(gL, -1);
|
||||
lua_pop(gL, 1);
|
||||
lua_rawgeti(gL, -2, 2);
|
||||
hook->important = lua_toboolean(gL, -1);
|
||||
lua_pop(gL, 2);
|
||||
lua_getref(gL, hookRefs[hook->id]);
|
||||
}
|
||||
|
||||
static int call_single_hook_no_copy(Hook_State *hook)
|
||||
{
|
||||
hook_important = hook->important;
|
||||
|
||||
if (lua_pcall(gL, hook->values, hook->results, EINDEX) == 0)
|
||||
{
|
||||
if (hook->results > 0)
|
||||
|
||||
+3
-26
@@ -288,10 +288,6 @@ void LUA_LoadLump(UINT16 wad, UINT16 lump)
|
||||
lumpinfo_t *lump_p = &wadfiles[wad]->lumpinfo[lump];
|
||||
len += 1 + strlen(lump_p->fullname); // length of file name, '|', and lump name
|
||||
name = malloc(len+1);
|
||||
|
||||
if (!name)
|
||||
I_Error("LUA_LoadLump: Out of memory!\n");
|
||||
|
||||
sprintf(name, "%s|%s", wadfiles[wad]->filename, lump_p->fullname);
|
||||
name[len] = '\0';
|
||||
}
|
||||
@@ -492,37 +488,25 @@ void LUA_InvalidateMathlibCache(const char *name)
|
||||
// Pushes it to the stack and stores it in the registry.
|
||||
void LUA_PushUserdata(lua_State *L, void *data, const char *meta)
|
||||
{
|
||||
if (LUA_RawPushUserdata(L, data) == LPUSHED_NEW)
|
||||
{
|
||||
luaL_getmetatable(L, meta);
|
||||
lua_setmetatable(L, -2);
|
||||
}
|
||||
}
|
||||
|
||||
// Same as LUA_PushUserdata but don't set a metatable yet.
|
||||
lpushed_t LUA_RawPushUserdata(lua_State *L, void *data)
|
||||
{
|
||||
lpushed_t status = LPUSHED_NIL;
|
||||
|
||||
void **userdata;
|
||||
|
||||
if (!data) { // push a NULL
|
||||
lua_pushnil(L);
|
||||
return status;
|
||||
return;
|
||||
}
|
||||
|
||||
lua_getfield(L, LUA_REGISTRYINDEX, LREG_VALID);
|
||||
I_Assert(lua_istable(L, -1));
|
||||
|
||||
lua_pushlightuserdata(L, data);
|
||||
lua_rawget(L, -2);
|
||||
|
||||
if (lua_isnil(L, -1)) { // no userdata? deary me, we'll have to make one.
|
||||
lua_pop(L, 1); // pop the nil
|
||||
|
||||
// create the userdata
|
||||
userdata = lua_newuserdata(L, sizeof(void *));
|
||||
*userdata = data;
|
||||
luaL_getmetatable(L, meta);
|
||||
lua_setmetatable(L, -2);
|
||||
|
||||
// Set it in the registry so we can find it again
|
||||
lua_pushlightuserdata(L, data); // k (store the userdata via the data's pointer)
|
||||
@@ -530,15 +514,8 @@ lpushed_t LUA_RawPushUserdata(lua_State *L, void *data)
|
||||
lua_rawset(L, -4);
|
||||
|
||||
// stack is left with the userdata on top, as if getting it had originally succeeded.
|
||||
|
||||
status = LPUSHED_NEW;
|
||||
}
|
||||
else
|
||||
status = LPUSHED_EXISTING;
|
||||
|
||||
lua_remove(L, -2); // remove LREG_VALID
|
||||
|
||||
return status;
|
||||
}
|
||||
|
||||
// When userdata is freed, use this function to remove it from Lua.
|
||||
|
||||
+2
-10
@@ -59,15 +59,7 @@ fixed_t LUA_GetConstant(const char *word);
|
||||
// Need better name for this ;-;
|
||||
void LUA_InvalidateMathlibCache(const char *name);
|
||||
|
||||
typedef enum {
|
||||
LPUSHED_NIL,
|
||||
LPUSHED_NEW,
|
||||
LPUSHED_EXISTING,
|
||||
} lpushed_t;
|
||||
|
||||
void LUA_PushUserdata(lua_State *L, void *data, const char *meta);
|
||||
lpushed_t LUA_RawPushUserdata(lua_State *L, void *data);
|
||||
|
||||
void LUA_InvalidateUserdata(void *data);
|
||||
void LUA_InvalidateLevel(void);
|
||||
void LUA_InvalidateMapthings(void);
|
||||
@@ -76,8 +68,8 @@ void LUA_InvalidatePlayer(player_t *player);
|
||||
void LUA_Archive(savebuffer_t *save, boolean network);
|
||||
void LUA_UnArchive(savebuffer_t *save, boolean network);
|
||||
|
||||
void Got_Luacmd(const UINT8 **cp, INT32 playernum); // lua_consolelib.c
|
||||
void LUA_CVarChanged(void *cvar); // lua_consolelib.c
|
||||
void Got_Luacmd(UINT8 **cp, INT32 playernum); // lua_consolelib.c
|
||||
void LUA_CVarChanged(const char *name); // lua_consolelib.c
|
||||
int Lua_optoption(lua_State *L, int narg, int def, int list_ref);
|
||||
int Lua_CreateFieldTable(lua_State *L, const char *const lst[]);
|
||||
void LUA_HookNetArchive(lua_CFunction archFunc, savebuffer_t *save);
|
||||
|
||||
+3
-5
@@ -69,18 +69,16 @@ INT32 M_CheckProtoParam(const char *check)
|
||||
|
||||
for (i = 1; i < myargc; i++)
|
||||
{
|
||||
if (strncmp(myargv[i], "srb2kart://", 11) == 0)
|
||||
if (strncmp(myargv[i], "srb2kart://", 11) == 0)
|
||||
{
|
||||
if (strncmp(myargv[i]+11, check, strlen(check)) == 0)
|
||||
if (strncmp(myargv[i]+11, check, strlen(check))==0)
|
||||
{
|
||||
found = i;
|
||||
return i;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
found = 0;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -95,7 +93,7 @@ const char *M_GetProtoParam(void)
|
||||
|
||||
for (i = 1; i < myargc; i++)
|
||||
{
|
||||
if (strncmp(myargv[i], "srb2kart://", 11) == 0)
|
||||
if (strncmp(myargv[i], "srb2kart://", 11) == 0)
|
||||
{
|
||||
string = strchr(myargv[i], '/');
|
||||
string = strchr(string+1, '/');
|
||||
|
||||
+9
-13
@@ -6956,9 +6956,9 @@ static void M_ConnectMenuModChecks(INT32 choice)
|
||||
(void)choice;
|
||||
// okay never mind we want to COMMUNICATE to the player pre-emptively instead of letting them try and then get confused when it doesn't work
|
||||
|
||||
if (modifiedgame)
|
||||
if (modifiedgame || autoloaded)
|
||||
{
|
||||
M_StartMessage("You have addons loaded.\nYou won't be able to join netgames!\n\nTo play online, restart the game\nand don't load any addons.\nSRB2Kart will automatically add\neverything you need when you join.\n\n(Press a key)\n", M_ConnectMenu, MM_EVENTHANDLER);
|
||||
M_StartMessage(M_GetText("You have addons loaded.\nYou won't be able to join netgames!\n\nTo play online, restart the game\nand don't load any addons.\nSRB2Kart will automatically add\neverything you need when you join.\n\n(Press a key)\n"),M_ConnectMenu,MM_EVENTHANDLER);
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -7179,21 +7179,17 @@ static void M_DrawLevelSelectOnly(boolean leftfade, boolean rightfade)
|
||||
namescroll = 0;
|
||||
}
|
||||
|
||||
if (renderisnewtic)
|
||||
namescroll++;
|
||||
if (renderisnewtic) namescroll++;
|
||||
|
||||
char *addonname = wadfiles[mapwads[cv_nextmap.value-1]]->filename;
|
||||
INT32 len;
|
||||
INT32 charlimit = min((size_t)(21 + (dupadjust/5)), sizeof(namescrollbuf)-1);
|
||||
|
||||
nameonly(addonname);
|
||||
len = strlen(addonname);
|
||||
|
||||
if (len > charlimit)
|
||||
M_ScrollString(addonname, len, namescrollbuf, charlimit, namescroll);
|
||||
else
|
||||
strncpy(namescrollbuf, addonname, sizeof(namescrollbuf) - 1);
|
||||
|
||||
strncpy(namescrollbuf, addonname, sizeof(namescrollbuf));
|
||||
V_DrawThinString(x+w+5, y+i-8, V_TRANSLUCENT|MENUCAPS, namescrollbuf); // variable reuse...
|
||||
}
|
||||
|
||||
@@ -8283,12 +8279,12 @@ static void M_DrawSetupMultiPlayerMenu(void)
|
||||
|
||||
sprframe = &sprdef->spriteframes[frame];
|
||||
|
||||
// minenice's speen css, it's a piece of shit but hey
|
||||
//minenice's speen css, it's a piece of shit but hey
|
||||
speenframe = (I_GetTime()*cv_skinselectspin.value/TICRATE + 1)%8;
|
||||
|
||||
// this is a very shitty solution for checking if a sprite needs flipping
|
||||
// but it works
|
||||
if ((speenframe > 4) && (sprframe->lumppat[speenframe] == sprframe->lumppat[8-speenframe]))
|
||||
//this is a very shitty solution for checking if a sprite needs flipping
|
||||
//but it works
|
||||
if ((sprframe->lumppat[speenframe] == sprframe->lumppat[8-speenframe]) && (speenframe > 4))
|
||||
flags = V_FLIP; // This sprite is left/right flipped!
|
||||
|
||||
patch = (patch_t *)W_CachePatchNum(sprframe->lumppat[speenframe], PU_PATCH);
|
||||
@@ -9643,7 +9639,7 @@ static void M_DrawLocalSkinMenu(void)
|
||||
|
||||
//this is a very shitty solution for checking if a sprite needs flipping
|
||||
//but it works
|
||||
if ((speenframe > 4) && (sprframe->lumppat[speenframe] == sprframe->lumppat[8-speenframe]))
|
||||
if ((sprframe->lumppat[speenframe] == sprframe->lumppat[8-speenframe]) && (speenframe > 4))
|
||||
{
|
||||
flags = V_FLIP; // This sprite is left/right flipped!
|
||||
}
|
||||
|
||||
+21
-25
@@ -944,23 +944,21 @@ static menuitem_t OP_ExpOptionsMenu[] =
|
||||
|
||||
{IT_STRING | IT_CVAR, NULL, "Skyboxes", &cv_skybox, 40},
|
||||
|
||||
{IT_STRING | IT_CVAR, NULL, "Precache Level Textures", &cv_precachetextures, 50},
|
||||
{IT_STRING | IT_CVAR, NULL, "FPS counter sampling", &cv_accuratefps, 50},
|
||||
|
||||
{IT_STRING | IT_CVAR, NULL, "FPS counter sampling", &cv_accuratefps, 60},
|
||||
{IT_STRING | IT_CVAR, NULL, "Frameskip", &cv_frameskip, 60},
|
||||
|
||||
{IT_STRING | IT_CVAR, NULL, "Frameskip", &cv_frameskip, 70},
|
||||
|
||||
{IT_STRING | IT_CVAR, NULL, "Votescreen Scaling", &cv_votebgscaling, 80},
|
||||
{IT_STRING | IT_CVAR, NULL, "Votescreen Scaling", &cv_votebgscaling, 70},
|
||||
|
||||
#ifdef HWRENDER
|
||||
{IT_STRING | IT_CVAR, NULL, "Screen Textures", &cv_glscreentextures, 90},
|
||||
{IT_STRING | IT_CVAR, NULL, "Screen Textures", &cv_glscreentextures, 80},
|
||||
#ifdef USE_FBO_OGL
|
||||
{IT_STRING | IT_CVAR, NULL, "FBO Downsampling support", &cv_glframebuffer, 95},
|
||||
{IT_STRING | IT_CVAR, NULL, "Palette Depth", &cv_glpalettedepth, 105},
|
||||
{IT_DISABLED, NULL, "", NULL, 115}, // dummy text
|
||||
{IT_STRING | IT_CVAR, NULL, "FBO Downsampling support", &cv_glframebuffer, 85},
|
||||
{IT_STRING | IT_CVAR, NULL, "Palette Depth", &cv_glpalettedepth, 95},
|
||||
{IT_DISABLED, NULL, "", NULL, 105}, // dummy text
|
||||
#else
|
||||
{IT_STRING | IT_CVAR, NULL, "Palette Depth", &cv_glpalettedepth, 100},
|
||||
{IT_DISABLED, NULL, "", NULL, 110}, // dummy text
|
||||
{IT_STRING | IT_CVAR, NULL, "Palette Depth", &cv_glpalettedepth, 90},
|
||||
{IT_DISABLED, NULL, "", NULL, 100}, // dummy text
|
||||
#endif
|
||||
#endif
|
||||
};
|
||||
@@ -970,17 +968,16 @@ static const char* OP_ExpTooltips[] =
|
||||
NULL,
|
||||
"How far Mobj interpolation should take effect.",
|
||||
"When weather is on this will cut the object amount used in half.",
|
||||
"Sets minimum sector brightness, useful for dark areas.",
|
||||
"Sets minimum sector brightness, useful for dark areas",
|
||||
//"Should the directional lightning be randomized each map?\nTakes effect on next map load.",
|
||||
"Toggle being able to see the sky.",
|
||||
"Preload all level textures on level load.\nMassively reduces texture related stuttering during gameplay\nat the cost of longer level loading times.\nDisable this if you experience timeouts during level switches.",
|
||||
"Change the FPS counter sampling method\nInaccurate updates slower\nand might miss sudden framerate changes and drops,\nproviding a more averaged result.\nAccurate updates faster, but might be less readable.", // how to ingles??
|
||||
"Skips rendering frames if game logic takes too long\npreventing gameplay issues during performance drops.", // idk im shit as describing things
|
||||
"Change the FPS counter sampling method\nInaccurate updates slower and might miss frame drops and such\nAccurate updates faster and is more accurate, but might be less readable", // how to ingles??
|
||||
"Skips rendering frames if game logic takes too long preventing issues during performance drops." // idk im shit as describing things
|
||||
"Different methods of scaling the votescreen backgrounds.",
|
||||
#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.",
|
||||
#ifdef USE_FBO_OGL
|
||||
"Allows the game to downsample from a higher resolution\nthan your display in OpenGL renderer mode.\nRequires a GPU with atleast OpenGL 2.1 support.",
|
||||
"Allows the game to downsample from a higher resolution than your display\nin OpenGL renderer mode. Requires a GPU with atleast OpenGL 3.0 support.",
|
||||
#endif
|
||||
"Change the bit depth of the Lookup Palette in Palette rendering mode\n 16 bits is like software looks ingame\nwhile 24 bits is how software looks in screenshots.",
|
||||
#endif
|
||||
@@ -994,7 +991,6 @@ enum
|
||||
op_exp_secbright,
|
||||
//op_exp_dirlight,
|
||||
op_exp_skybox,
|
||||
op_exp_texcache,
|
||||
op_exp_accuratefps,
|
||||
op_exp_frameskip,
|
||||
op_exp_votescrn,
|
||||
@@ -1379,15 +1375,15 @@ static menuitem_t OP_Player4CamOptionsMenu[] =
|
||||
static const char* OP_PlayerCamOptionsTooltips[] =
|
||||
{
|
||||
NULL,
|
||||
"Should the Camera flip on gravity flipped sections?",
|
||||
"Should the Camera flip on gravity flipped sections?.",
|
||||
"Camera distance relative to the Player.",
|
||||
"Height of the Camera.",
|
||||
"Pitch Camera on Upwards or Downhill Slopes.",
|
||||
"Speed of the Camera.",
|
||||
"Should looking back inherit the Players Momentum?\nEither inherit Player Momentum or double of it\nmay make looking back while boosting or going in high speed less jarring.",
|
||||
"Height of the Camera",
|
||||
"Pitch Camera on Upwards or Downhill Slopes",
|
||||
"Speed of the Camera",
|
||||
"Should looking back inherit the Players Momentum?\nEither inherit Player Momentum or double of it\nmay make looking back while boosting or going in high speed less jarring",
|
||||
"Allows looking up/down by holding\naim forward/backward while standing still.",
|
||||
"Speed of the Freecam/Spectator Camera.",
|
||||
"Toggle between Third or First Person camera.",
|
||||
"Speed of the Freecam/Spectator Camera",
|
||||
"Toggle between Third or First Person camera",
|
||||
};
|
||||
|
||||
// Ok it's still called chatoptions but we'll put ping display in here to be clean
|
||||
@@ -1767,7 +1763,7 @@ static const char* OP_PlayerDistortTooltips[] =
|
||||
"Distance object rotation should be visable.",
|
||||
"Player rotation when sliptiding.",
|
||||
"Rotation of a player's boost trails and drift sparks.",
|
||||
"Should banans rotate when thrown?\nAnd should they stay rotated when on the ground?",
|
||||
"Should banans rotate when thrown?\nAnd should they stay rotated when on the ground?.",
|
||||
"Player squash and stretch.",
|
||||
"Player landing sound effect.",
|
||||
"Kart hopping while drifting. This is purely visual.",
|
||||
|
||||
+23
-41
@@ -708,7 +708,7 @@ static boolean PIT_CheckThing(mobj_t *thing)
|
||||
HU_SetCEchoFlags(0);
|
||||
HU_SetCEchoDuration(5);
|
||||
HU_DoCEcho(va("%s\\was hit by a kitchen sink.\\\\\\\\", player_names[thing->player-players]));
|
||||
//I_OutputMsg("%s was hit by a kitchen sink.\n", player_names[thing->player-players]);
|
||||
I_OutputMsg("%s was hit by a kitchen sink.\n", player_names[thing->player-players]);
|
||||
P_DamageMobj(thing, tmthing, tmthing->target, DMG_INSTAKILL);
|
||||
P_KillMobj(tmthing, thing, thing);
|
||||
}
|
||||
@@ -977,7 +977,7 @@ static boolean PIT_CheckThing(mobj_t *thing)
|
||||
HU_SetCEchoFlags(0);
|
||||
HU_SetCEchoDuration(5);
|
||||
HU_DoCEcho(va("%s\\was hit by a kitchen sink.\\\\\\\\", player_names[tmthing->player-players]));
|
||||
//I_OutputMsg("%s was hit by a kitchen sink.\n", player_names[tmthing->player-players]);
|
||||
I_OutputMsg("%s was hit by a kitchen sink.\n", player_names[tmthing->player-players]);
|
||||
P_DamageMobj(tmthing, thing, thing->target, DMG_INSTAKILL);
|
||||
P_KillMobj(thing, tmthing, tmthing);
|
||||
}
|
||||
@@ -2189,7 +2189,7 @@ static boolean P_CheckCameraPosition(fixed_t x, fixed_t y, camera_t *thiscam)
|
||||
//
|
||||
boolean P_TryCameraMove(fixed_t x, fixed_t y, camera_t *thiscam)
|
||||
{
|
||||
subsector_t *subsec;
|
||||
subsector_t *s;
|
||||
UINT8 i;
|
||||
|
||||
floatok = false;
|
||||
@@ -2198,9 +2198,9 @@ boolean P_TryCameraMove(fixed_t x, fixed_t y, camera_t *thiscam)
|
||||
return false;
|
||||
|
||||
if (thiscam->x != x || thiscam->y != y || thiscam->subsector == NULL)
|
||||
subsec = R_PointInSubsectorFast(x, y);
|
||||
s = R_PointInSubsectorFast(x, y);
|
||||
else
|
||||
subsec = thiscam->subsector;
|
||||
s = thiscam->subsector;
|
||||
|
||||
if (players[displayplayers[0]].mo)
|
||||
{
|
||||
@@ -2220,7 +2220,7 @@ boolean P_TryCameraMove(fixed_t x, fixed_t y, camera_t *thiscam)
|
||||
thiscam->ceilingz = thiscam->z + thiscam->height;
|
||||
thiscam->x = x;
|
||||
thiscam->y = y;
|
||||
thiscam->subsector = subsec;
|
||||
thiscam->subsector = s;
|
||||
return true;
|
||||
}
|
||||
}
|
||||
@@ -2232,7 +2232,6 @@ boolean P_TryCameraMove(fixed_t x, fixed_t y, camera_t *thiscam)
|
||||
tryx -= MAXRADIUS;
|
||||
else
|
||||
tryx = x;
|
||||
|
||||
if (y-tryy > MAXRADIUS)
|
||||
tryy += MAXRADIUS;
|
||||
else if (y-tryy < -MAXRADIUS)
|
||||
@@ -2250,14 +2249,14 @@ boolean P_TryCameraMove(fixed_t x, fixed_t y, camera_t *thiscam)
|
||||
|
||||
if (tmceilingz - thiscam->z < thiscam->height)
|
||||
{
|
||||
if (subsec == thiscam->subsector && tmceilingz >= thiscam->z)
|
||||
if (s == thiscam->subsector && tmceilingz >= thiscam->z)
|
||||
{
|
||||
floatok = true;
|
||||
thiscam->floorz = tmfloorz;
|
||||
thiscam->ceilingz = tmfloorz + thiscam->height;
|
||||
thiscam->x = x;
|
||||
thiscam->y = y;
|
||||
thiscam->subsector = subsec;
|
||||
thiscam->subsector = s;
|
||||
return true;
|
||||
}
|
||||
else
|
||||
@@ -2282,7 +2281,7 @@ boolean P_TryCameraMove(fixed_t x, fixed_t y, camera_t *thiscam)
|
||||
thiscam->ceilingz = tmceilingz;
|
||||
thiscam->x = x;
|
||||
thiscam->y = y;
|
||||
thiscam->subsector = subsec;
|
||||
thiscam->subsector = s;
|
||||
|
||||
return true;
|
||||
}
|
||||
@@ -2395,7 +2394,6 @@ boolean P_TryMove(mobj_t *thing, fixed_t x, fixed_t y, boolean allowdropoff)
|
||||
tryx -= radius;
|
||||
else
|
||||
tryx = x;
|
||||
|
||||
if (y-tryy > radius)
|
||||
tryy += radius;
|
||||
else if (y-tryy < -radius)
|
||||
@@ -2411,34 +2409,28 @@ boolean P_TryMove(mobj_t *thing, fixed_t x, fixed_t y, boolean allowdropoff)
|
||||
{
|
||||
//All things are affected by their scale.
|
||||
fixed_t maxstep = FixedMul(MAXSTEPMOVE, mapobjectscale);
|
||||
INT32 special = 0;
|
||||
|
||||
if (thing->player)
|
||||
{
|
||||
special = GETSECSPECIAL(R_PointInSubsector(x, y)->sector->special, 1);
|
||||
const INT32 special = GETSECSPECIAL(R_PointInSubsector(x, y)->sector->special, 1);
|
||||
|
||||
// If using type Section1:13, double the maxstep.
|
||||
if (P_PlayerTouchingSectorSpecial(thing->player, 1, 13) || special == 13)
|
||||
{
|
||||
if (P_PlayerTouchingSectorSpecial(thing->player, 1, 13)
|
||||
|| special == 13)
|
||||
maxstep <<= 1;
|
||||
}
|
||||
// If using type Section1:12, no maxstep. For ledges you don't want the player to climb! (see: Egg Zeppelin & SMK port walls)
|
||||
else if (P_PlayerTouchingSectorSpecial(thing->player, 1, 12) || special == 12)
|
||||
{
|
||||
else if (P_PlayerTouchingSectorSpecial(thing->player, 1, 12)
|
||||
|| special == 12)
|
||||
maxstep = 0;
|
||||
}
|
||||
}
|
||||
|
||||
if (thing->type == MT_SKIM)
|
||||
{
|
||||
maxstep = 0;
|
||||
}
|
||||
|
||||
if (tmceilingz - tmfloorz < thing->height)
|
||||
{
|
||||
if (tmfloorthing)
|
||||
tmhitthing = tmfloorthing;
|
||||
|
||||
return false; // doesn't fit
|
||||
}
|
||||
|
||||
@@ -2471,8 +2463,11 @@ boolean P_TryMove(mobj_t *thing, fixed_t x, fixed_t y, boolean allowdropoff)
|
||||
return false; // mobj must lower itself to fit
|
||||
}
|
||||
}
|
||||
else if (maxstep > 0 && !(thing->player &&
|
||||
(P_PlayerTouchingSectorSpecial(thing->player, 1, 14) || special == 14))) // Step down
|
||||
else if (maxstep > 0 && !(
|
||||
thing->player && (
|
||||
P_PlayerTouchingSectorSpecial(thing->player, 1, 14)
|
||||
|| GETSECSPECIAL(R_PointInSubsector(x, y)->sector->special, 1) == 14)
|
||||
)) // Step down
|
||||
{
|
||||
// If the floor difference is MAXSTEPMOVE or less, and the sector isn't Section1:14, ALWAYS
|
||||
// step down! Formerly required a Section1:13 sector for the full MAXSTEPMOVE, but no more.
|
||||
@@ -2494,14 +2489,10 @@ boolean P_TryMove(mobj_t *thing, fixed_t x, fixed_t y, boolean allowdropoff)
|
||||
if (thing->eflags & MFE_VERTICALFLIP)
|
||||
{
|
||||
if (tmdrpoffceilz - tmceilingz > maxstep)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
else if (tmfloorz - tmdropoffz > maxstep)
|
||||
{
|
||||
return false; // don't stand over a dropoff
|
||||
}
|
||||
}
|
||||
}
|
||||
} while (tryx != x || tryy != y);
|
||||
@@ -2577,7 +2568,6 @@ boolean P_SceneryTryMove(mobj_t *thing, fixed_t x, fixed_t y)
|
||||
|
||||
tryx = thing->x;
|
||||
tryy = thing->y;
|
||||
|
||||
do {
|
||||
if (x-tryx > MAXRADIUS)
|
||||
tryx += MAXRADIUS;
|
||||
@@ -2585,7 +2575,6 @@ boolean P_SceneryTryMove(mobj_t *thing, fixed_t x, fixed_t y)
|
||||
tryx -= MAXRADIUS;
|
||||
else
|
||||
tryx = x;
|
||||
|
||||
if (y-tryy > MAXRADIUS)
|
||||
tryy += MAXRADIUS;
|
||||
else if (y-tryy < -MAXRADIUS)
|
||||
@@ -2598,14 +2587,14 @@ boolean P_SceneryTryMove(mobj_t *thing, fixed_t x, fixed_t y)
|
||||
|
||||
if (!(thing->flags & MF_NOCLIP))
|
||||
{
|
||||
const fixed_t maxstep = FixedMul(MAXSTEPMOVE, mapobjectscale);
|
||||
|
||||
if (tmceilingz - tmfloorz < thing->height)
|
||||
return false; // doesn't fit
|
||||
|
||||
if (tmceilingz - thing->z < thing->height)
|
||||
return false; // mobj must lower itself to fit
|
||||
|
||||
const fixed_t maxstep = FixedMul(MAXSTEPMOVE, mapobjectscale);
|
||||
|
||||
if (tmfloorz - thing->z > maxstep)
|
||||
return false; // too big a step up
|
||||
}
|
||||
@@ -2939,7 +2928,6 @@ static boolean PTR_SlideTraverse(intercept_t *in)
|
||||
{
|
||||
if (P_PointOnLineSide(slidemo->x, slidemo->y, li))
|
||||
return true; // don't hit the back side
|
||||
|
||||
goto isblocking;
|
||||
}
|
||||
|
||||
@@ -3358,12 +3346,10 @@ void P_BouncePlayerMove(mobj_t *mo)
|
||||
|
||||
{
|
||||
mobj_t *fx = P_SpawnMobj(mo->x, mo->y, mo->z, MT_BUMP);
|
||||
|
||||
if (mo->eflags & MFE_VERTICALFLIP)
|
||||
fx->eflags |= MFE_VERTICALFLIP;
|
||||
else
|
||||
fx->eflags &= ~MFE_VERTICALFLIP;
|
||||
|
||||
fx->scale = mo->scale;
|
||||
|
||||
S_StartSound(mo, sfx_s3k49);
|
||||
@@ -3377,8 +3363,7 @@ void P_BouncePlayerMove(mobj_t *mo)
|
||||
mo->player->cmomx = tmxmove;
|
||||
mo->player->cmomy = tmymove;
|
||||
|
||||
if (!P_TryMove(mo, mo->x + tmxmove, mo->y + tmymove, true))
|
||||
{
|
||||
if (!P_TryMove(mo, mo->x + tmxmove, mo->y + tmymove, true)) {
|
||||
P_TryMove(mo, mo->x - oldmomx, mo->y - oldmomy, true);
|
||||
}
|
||||
}
|
||||
@@ -3755,7 +3740,6 @@ boolean P_CheckSector(sector_t *sector, boolean crunch)
|
||||
{
|
||||
size_t i;
|
||||
sector_t *sec;
|
||||
|
||||
for (i = 0; i < sector->numattached; i++)
|
||||
{
|
||||
sec = §ors[sector->attached[i]];
|
||||
@@ -3962,7 +3946,6 @@ static msecnode_t *P_DelSecnode(msecnode_t *node)
|
||||
|
||||
tp = node->m_sectorlist_prev;
|
||||
tn = node->m_sectorlist_next;
|
||||
|
||||
if (tp)
|
||||
tp->m_sectorlist_next = tn;
|
||||
if (tn)
|
||||
@@ -3973,7 +3956,6 @@ static msecnode_t *P_DelSecnode(msecnode_t *node)
|
||||
|
||||
sp = node->m_thinglist_prev;
|
||||
sn = node->m_thinglist_next;
|
||||
|
||||
if (sp)
|
||||
sp->m_thinglist_next = sn;
|
||||
else
|
||||
@@ -4021,7 +4003,7 @@ static inline boolean PIT_GetSectors(line_t *ld)
|
||||
// allowed to move to this position, then the sector_list
|
||||
// will be attached to the Thing's mobj_t at touching_sectorlist.
|
||||
|
||||
sector_list = P_AddSecnode(ld->frontsector, tmthing, sector_list);
|
||||
sector_list = P_AddSecnode(ld->frontsector,tmthing,sector_list);
|
||||
|
||||
// Don't assume all lines are 2-sided, since some Things
|
||||
// like MT_TFOG are allowed regardless of whether their radius takes
|
||||
|
||||
+26
-4
@@ -1203,7 +1203,7 @@ static void SaveMobjThinker(savebuffer_t *save, const thinker_t *th, const UINT8
|
||||
if (diff & MD_MORE)
|
||||
WRITEUINT16(save->p, diff2);
|
||||
|
||||
// keep here for vanilla compat
|
||||
// save pointer, at load time we will search this pointer to reinitilize pointers
|
||||
WRITEUINT32(save->p, (size_t)mobj);
|
||||
|
||||
WRITEFIXED(save->p, mobj->z); // Force this so 3dfloor problems don't arise.
|
||||
@@ -1982,6 +1982,7 @@ static void CalculateDoomednumToMobjtype(void)
|
||||
|
||||
static void LoadMobjThinker(savebuffer_t *save, actionf_p1 thinker)
|
||||
{
|
||||
thinker_t *next;
|
||||
mobj_t *mobj;
|
||||
UINT32 diff;
|
||||
UINT16 diff2;
|
||||
@@ -1994,8 +1995,7 @@ static void LoadMobjThinker(savebuffer_t *save, actionf_p1 thinker)
|
||||
else
|
||||
diff2 = 0;
|
||||
|
||||
// here for vanilla compat
|
||||
save->p += sizeof(UINT32);
|
||||
next = (void *)(size_t)READUINT32(save->p);
|
||||
|
||||
z = READFIXED(save->p); // Force this so 3dfloor problems don't arise.
|
||||
floorz = READFIXED(save->p);
|
||||
@@ -2234,6 +2234,8 @@ static void LoadMobjThinker(savebuffer_t *save, actionf_p1 thinker)
|
||||
if (diff2 & MD2_WAYPOINTCAP)
|
||||
P_SetTarget(&waypointcap, mobj);
|
||||
|
||||
mobj->info = (mobjinfo_t *)next; // temporarily, set when leave this function
|
||||
|
||||
R_AddMobjInterpolator(mobj);
|
||||
}
|
||||
|
||||
@@ -3198,6 +3200,25 @@ FUNCINLINE static ATTRINLINE void P_UnArchivePolyObjects(savebuffer_t *save)
|
||||
for (i = 0; i < numSavedPolys; ++i)
|
||||
P_UnArchivePolyObj(save, &PolyObjects[i]);
|
||||
}
|
||||
//
|
||||
// P_FinishMobjs
|
||||
//
|
||||
FUNCINLINE static ATTRINLINE void P_FinishMobjs(void)
|
||||
{
|
||||
thinker_t *currentthinker;
|
||||
mobj_t *mobj;
|
||||
|
||||
// put info field there real value
|
||||
for (currentthinker = thinkercap.next; currentthinker != &thinkercap;
|
||||
currentthinker = currentthinker->next)
|
||||
{
|
||||
if (currentthinker->function != (actionf_p1)P_MobjThinker)
|
||||
continue;
|
||||
|
||||
mobj = (mobj_t *)currentthinker;
|
||||
mobj->info = &mobjinfo[mobj->type];
|
||||
}
|
||||
}
|
||||
|
||||
FUNCINLINE static ATTRINLINE mobj_t *RelinkMobj(mobj_t **ptr)
|
||||
{
|
||||
@@ -3772,7 +3793,7 @@ boolean P_LoadGame(savebuffer_t *save, INT16 mapoverride)
|
||||
|
||||
boolean P_LoadNetGame(savebuffer_t *save, boolean reloading)
|
||||
{
|
||||
save->p += CV_LoadNetVars(save->p);
|
||||
CV_LoadNetVars(&save->p);
|
||||
|
||||
if (!P_NetUnArchiveMisc(save, reloading))
|
||||
return false;
|
||||
@@ -3786,6 +3807,7 @@ boolean P_LoadNetGame(savebuffer_t *save, boolean reloading)
|
||||
P_NetUnArchiveThinkers(save);
|
||||
P_NetUnArchiveSpecials(save);
|
||||
P_RelinkPointers();
|
||||
P_FinishMobjs();
|
||||
}
|
||||
|
||||
LUA_UnArchive(save, true);
|
||||
|
||||
+2
-1
@@ -2091,7 +2091,8 @@ static void P_ProcessLineSpecial(line_t *line, mobj_t *mo, sector_t *callsec)
|
||||
// Change the music and apply position/fade operations
|
||||
else
|
||||
{
|
||||
strlcpy(mapmusic.name, sides[line->sidenum[0]].text, sizeof(mapmusic.name));
|
||||
strncpy(mapmusic.name, sides[line->sidenum[0]].text, 7);
|
||||
mapmusic.name[6] = 0;
|
||||
|
||||
mapmusic.flags = tracknum & MUSIC_TRACKMASK;
|
||||
if (!(line->flags & ML_BLOCKMONSTERS))
|
||||
|
||||
+7
-17
@@ -3315,7 +3315,7 @@ static ticcmd_t *P_CameraCmd(camera_t *cam, UINT8 num)
|
||||
cmd->sidemove = (SINT8)(cmd->sidemove + side);
|
||||
}
|
||||
|
||||
lang += (cmd->angleturn << 16);
|
||||
lang += (cmd->angleturn<<16);
|
||||
|
||||
cam->localangle = lang;
|
||||
if (!cam->reset_aiming)
|
||||
@@ -3821,13 +3821,7 @@ boolean P_MoveChaseCamera(player_t *player, camera_t *thiscam, boolean resetcall
|
||||
|
||||
if (demo.playback)
|
||||
{
|
||||
// Hack-adjacent.
|
||||
// Sometimes stale ticcmds send a weird angle at the start of the race.
|
||||
// P_UpdatePlayerAngle knows to ignore cmd angle when you literally can't turn, so we do the same here.
|
||||
if (cv_demoangturn.value && leveltime > starttime)
|
||||
focusangle = player->cmd.angleturn << 16;
|
||||
else
|
||||
focusangle = mo->angle; // Just use something known sane.
|
||||
focusangle = mo->angle;
|
||||
focusaiming = 0;
|
||||
}
|
||||
else if (P_IsLocalPlayer(player))
|
||||
@@ -4315,19 +4309,17 @@ static void P_CalcPostImg(player_t *player, camera_t *thiscam)
|
||||
{
|
||||
sector_t *sector = NULL;
|
||||
UINT8 postimgtype = 0;
|
||||
//INT32 *param;
|
||||
fixed_t pviewheight = 0;
|
||||
#ifdef MOTIONBLUR
|
||||
INT32 *param;
|
||||
|
||||
for (i = 0; i <= splitscreen; i++)
|
||||
/*for (i = 0; i <= splitscreen; i++)
|
||||
{
|
||||
if (player == &players[displayplayers[i]])
|
||||
{
|
||||
param = &postimgparam[i];
|
||||
break;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
}*/
|
||||
|
||||
if (encoremode) // srb2kart
|
||||
postimgtype |= POSTIMG_MIRROR;
|
||||
@@ -4363,18 +4355,16 @@ static void P_CalcPostImg(player_t *player, camera_t *thiscam)
|
||||
else if (P_CameraCheckHeatFirstperson(player, sector, pviewheight))
|
||||
postimgtype |= POSTIMG_HEAT;
|
||||
|
||||
#ifdef MOTIONBLUR
|
||||
// Motion blur
|
||||
// unused
|
||||
if (player->speed > (35<<FRACBITS))
|
||||
/*if (player->speed > (35<<FRACBITS))
|
||||
{
|
||||
postimgtype |= POSTIMG_MOTION;
|
||||
*param = (player->speed - 32)/4;
|
||||
|
||||
if (*param > 5)
|
||||
*param = 5;
|
||||
}
|
||||
#endif
|
||||
}*/
|
||||
|
||||
thiscam->postimg = postimgtype;
|
||||
}
|
||||
|
||||
@@ -1391,7 +1391,6 @@ void R_ReInitColormaps(UINT16 num, lumpnum_t newencoremap)
|
||||
|
||||
// Load in the light tables, now 64k aligned for smokie...
|
||||
lump = W_GetNumForName(colormap);
|
||||
|
||||
if (lump == LUMPERROR)
|
||||
lump = basecolormaplump;
|
||||
else
|
||||
|
||||
@@ -260,7 +260,7 @@ static void R_DrawColumnTemplate(drawcolumndata_t *dc)
|
||||
// texture has no height, so just go
|
||||
while (--count >= 0)
|
||||
{
|
||||
*dest = R_DrawColumnPixel<Type>(dc, dest, (frac>>FRACBITS), source, colormap);
|
||||
*dest = R_DrawColumnPixel<Type>(dc, dest, frac>>FRACBITS, source, colormap);
|
||||
|
||||
dest += stride;
|
||||
frac += fracstep;
|
||||
|
||||
+18
-24
@@ -208,15 +208,15 @@ static void R_CalcTiltedLighting(std::vector<INT32>& lightbuffer, INT32 x1, INT3
|
||||
|
||||
for (i = x1; i <= x2; i++)
|
||||
{
|
||||
const fixed_t light = start >> FRACBITS;
|
||||
fixed_t light = start >> FRACBITS;
|
||||
lightbuffer[i] = CLAMP(light, 0, MAXLIGHTSCALE - 1);
|
||||
start += step;
|
||||
}
|
||||
}
|
||||
|
||||
static void R_GetTiltedLighting(std::vector<INT32>& tiltlighting, const drawspandata_t* ds, const float iz, const INT32 width, const INT32 stride)
|
||||
static void R_GetTiltedLighting(std::vector<INT32>& tiltlighting, const drawspandata_t* ds, const float iz, const int width, const INT32 stride)
|
||||
{
|
||||
const float planelightfloat = PLANELIGHTFLOAT;
|
||||
float planelightfloat = PLANELIGHTFLOAT;
|
||||
const fixed_t lightstart = FloatToFixed(iz * planelightfloat);
|
||||
const fixed_t lightend = FloatToFixed((iz + ds->szp.x * width) * planelightfloat);
|
||||
|
||||
@@ -232,7 +232,7 @@ static void R_GetTiltedLighting(std::vector<INT32>& tiltlighting, const drawspan
|
||||
template<DrawSpanType Type>
|
||||
static void R_DrawTiltedSpanTemplate(drawspandata_t* ds)
|
||||
{
|
||||
INT32 width = ds->x2 - ds->x1;
|
||||
int width = ds->x2 - ds->x1;
|
||||
float iz, uz, vz;
|
||||
UINT32 u, v;
|
||||
int i;
|
||||
@@ -246,6 +246,7 @@ static void R_DrawTiltedSpanTemplate(drawspandata_t* ds)
|
||||
UINT32 stepu, stepv;
|
||||
UINT32 bit;
|
||||
|
||||
INT32 x1 = ds->x1;
|
||||
const INT32 nflatxshift = ds->nflatxshift;
|
||||
const INT32 nflatyshift = ds->nflatyshift;
|
||||
const INT32 nflatmask = ds->nflatmask;
|
||||
@@ -262,11 +263,6 @@ static void R_DrawTiltedSpanTemplate(drawspandata_t* ds)
|
||||
const UINT8 * restrict source = ds->source;
|
||||
const UINT8 * restrict colormap = ds->colormap;
|
||||
|
||||
const ptrdiff_t colormap_diff = (colormap - colormaps);
|
||||
|
||||
const INT32 * restrict tiltlight = tiltlighting.data();
|
||||
lighttable_t * const * restrict planezlight = ds->planezlight;
|
||||
|
||||
if constexpr (Type & DS_RIPPLE)
|
||||
{
|
||||
dsrc = vid.screens[1] + (ds->y + ds->bgofs) * stride + ds->x1;
|
||||
@@ -304,6 +300,7 @@ static void R_DrawTiltedSpanTemplate(drawspandata_t* ds)
|
||||
izstep = ds->szp.x * SPANSIZE;
|
||||
uzstep = ds->sup.x * SPANSIZE;
|
||||
vzstep = ds->svp.x * SPANSIZE;
|
||||
//x1 = 0;
|
||||
width++;
|
||||
|
||||
while (width >= SPANSIZE)
|
||||
@@ -320,12 +317,12 @@ static void R_DrawTiltedSpanTemplate(drawspandata_t* ds)
|
||||
u = (INT64)(startu);
|
||||
v = (INT64)(startv);
|
||||
|
||||
const INT32 x1 = ds->x1;
|
||||
x1 = ds->x1;
|
||||
|
||||
for (i = 0; i < SPANSIZE; i++)
|
||||
{
|
||||
bit = (((v + stepv * i) >> nflatyshift) & nflatmask) | ((u + stepu * i) >> nflatxshift);
|
||||
colormap = planezlight[tiltlight[x1 + i]] + colormap_diff;
|
||||
colormap = ds->planezlight[tiltlighting[x1 + i]] + (ds->colormap - colormaps);
|
||||
if constexpr (Type & DS_RIPPLE)
|
||||
dest[i] = R_DrawSpanPixel<Type>(ds, &dsrc[i], colormap, bit, source);
|
||||
else
|
||||
@@ -348,7 +345,7 @@ static void R_DrawTiltedSpanTemplate(drawspandata_t* ds)
|
||||
u = (INT64)(startu);
|
||||
v = (INT64)(startv);
|
||||
bit = ((v >> nflatyshift) & nflatmask) | (u >> nflatxshift);
|
||||
colormap = planezlight[tiltlight[ds->x1]] + colormap_diff;
|
||||
colormap = ds->planezlight[tiltlighting[ds->x1]] + (ds->colormap - colormaps);
|
||||
if constexpr (Type & DS_RIPPLE)
|
||||
*dest = R_DrawSpanPixel<Type>(ds, dsrc, colormap, bit, source);
|
||||
else
|
||||
@@ -374,7 +371,7 @@ static void R_DrawTiltedSpanTemplate(drawspandata_t* ds)
|
||||
for (; width != 0; width--)
|
||||
{
|
||||
bit = ((v >> ds->nflatyshift) & ds->nflatmask) | (u >> ds->nflatxshift);
|
||||
colormap = planezlight[tiltlight[ds->x1]] + colormap_diff;
|
||||
colormap = ds->planezlight[tiltlighting[ds->x1]] + (ds->colormap - colormaps);
|
||||
if constexpr (Type & DS_RIPPLE)
|
||||
*dest = R_DrawSpanPixel<Type>(ds, dsrc, colormap, bit, source);
|
||||
else
|
||||
@@ -413,7 +410,7 @@ DEFINE_SPAN_COMBO(R_DrawTranslucentWaterSpan, DS_TRANSMAP|DS_RIPPLE)
|
||||
*/
|
||||
void R_DrawFogSpan(drawspandata_t* ds)
|
||||
{
|
||||
intptr_t count = ds->x2 - ds->x1 + 1;
|
||||
INT32 count = ds->x2 - ds->x1 + 1;
|
||||
|
||||
const UINT8 * restrict colormap = ds->colormap;
|
||||
UINT8 * restrict dest = R_Address(ds->x1, ds->y);
|
||||
@@ -438,23 +435,20 @@ void R_DrawFogSpan(drawspandata_t* ds)
|
||||
|
||||
void R_DrawFogSpan_Tilted(drawspandata_t* ds)
|
||||
{
|
||||
INT32 width = ds->x2 - ds->x1;
|
||||
const INT32 stride = vid.width;
|
||||
const float iz = ds->szp.z + ds->szp.y*(centery-ds->y) + ds->szp.x*(ds->x1-centerx);
|
||||
UINT8 * restrict dest = R_Address(ds->x1, ds->y);
|
||||
const ptrdiff_t colormap_diff = (ds->colormap - colormaps);
|
||||
|
||||
int width = ds->x2 - ds->x1;
|
||||
float iz = ds->szp.z + ds->szp.y*(centery-ds->y) + ds->szp.x*(ds->x1-centerx);
|
||||
UINT8 * restrict dest;
|
||||
local_for_thread std::vector<INT32> tiltlighting;
|
||||
|
||||
dest = R_Address(ds->x1, ds->y);
|
||||
const INT32 stride = vid.width;
|
||||
|
||||
// Lighting is simple. It's just linear interpolation from start to end
|
||||
R_GetTiltedLighting(tiltlighting, ds, iz, width, stride);
|
||||
|
||||
const INT32 * restrict tiltlight = tiltlighting.data();
|
||||
lighttable_t * const * restrict planezlight = ds->planezlight;
|
||||
|
||||
do
|
||||
{
|
||||
UINT8 *colormap = planezlight[tiltlight[ds->x1++]] + colormap_diff;
|
||||
UINT8 *colormap = ds->planezlight[tiltlighting[ds->x1++]] + (ds->colormap - colormaps);
|
||||
*dest = colormap[*dest];
|
||||
dest++;
|
||||
}
|
||||
|
||||
+1
-4
@@ -253,7 +253,6 @@ void SplitScreen_OnChange(void)
|
||||
if (playeringame[i] && i != consoleplayer)
|
||||
{
|
||||
UINT8 j;
|
||||
|
||||
for (j = 1; j < MAXSPLITSCREENPLAYERS; j++)
|
||||
{
|
||||
if (displayplayers[j] == consoleplayer)
|
||||
@@ -269,7 +268,6 @@ void SplitScreen_OnChange(void)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
static void Fov_OnChange(void)
|
||||
{
|
||||
R_SetViewSize();
|
||||
@@ -945,10 +943,9 @@ void R_ExecuteSetViewSize(void)
|
||||
memset(scalelight, 0xFF, sizeof(scalelight));
|
||||
|
||||
// Calculate the light levels to use for each level/scale combination.
|
||||
for (i = 0; i < LIGHTLEVELS; i++)
|
||||
for (i = 0; i< LIGHTLEVELS; i++)
|
||||
{
|
||||
startmapl = ((LIGHTLEVELS - 1 - i)*2)*NUMCOLORMAPS/LIGHTLEVELS;
|
||||
|
||||
for (j = 0; j < MAXLIGHTSCALE; j++)
|
||||
{
|
||||
level = startmapl - j*vid.width/(viewwidth)/DISTMAP;
|
||||
|
||||
@@ -545,7 +545,7 @@ static inline void I_ShutdownConsole(void){}
|
||||
|
||||
|
||||
//
|
||||
// I_OutputMsg
|
||||
//I_OutputMsg
|
||||
//
|
||||
void I_OutputMsg(const char *fmt, ...)
|
||||
{
|
||||
@@ -553,9 +553,6 @@ void I_OutputMsg(const char *fmt, ...)
|
||||
char *txt;
|
||||
va_list argptr;
|
||||
|
||||
if (!fmt)
|
||||
return;
|
||||
|
||||
va_start(argptr,fmt);
|
||||
len = vsnprintf(NULL, 0, fmt, argptr);
|
||||
va_end(argptr);
|
||||
@@ -563,10 +560,6 @@ void I_OutputMsg(const char *fmt, ...)
|
||||
return;
|
||||
|
||||
txt = static_cast<char*>(malloc(len+1));
|
||||
|
||||
if (!txt)
|
||||
I_Error("I_OutputMsg: Out of memory!\n");
|
||||
|
||||
va_start(argptr,fmt);
|
||||
vsprintf(txt, fmt, argptr);
|
||||
va_end(argptr);
|
||||
|
||||
+7
-18
@@ -156,9 +156,9 @@ static SDL_bool usesdl2soft = SDL_FALSE;
|
||||
static SDL_bool borderlesswindow = SDL_FALSE;
|
||||
|
||||
// SDL2 vars
|
||||
SDL_Window *window = NULL;
|
||||
SDL_Renderer *renderer = NULL;
|
||||
static SDL_Texture *texture = NULL;
|
||||
SDL_Window *window;
|
||||
SDL_Renderer *renderer;
|
||||
static SDL_Texture *texture;
|
||||
static SDL_bool havefocus = SDL_TRUE;
|
||||
static const char *fallback_resolution_name = "Fallback";
|
||||
|
||||
@@ -412,10 +412,6 @@ static INT32 GetTypedChar(SDL_Keysym keysym)
|
||||
break;
|
||||
}
|
||||
|
||||
// Special case for console key
|
||||
if (scancode == SDL_SCANCODE_GRAVE)
|
||||
return '`';
|
||||
|
||||
if (SDL_PeepEvents(&next_event, 1, SDL_PEEKEVENT, SDL_FIRSTEVENT, SDL_LASTEVENT) == 1 && next_event.type == SDL_TEXTINPUT)
|
||||
{
|
||||
if (next_event.text.text[1] == '\0') // limit to ASCII
|
||||
@@ -909,7 +905,6 @@ static void Impl_HandleControllerAddedEvent(SDL_Event evt)
|
||||
cv_usejoystick[i].value = 0;
|
||||
else if (atoi(cv_usejoystick[i].string) <= I_NumJoys() // don't mess if we intentionally set higher than NumJoys
|
||||
&& cv_usejoystick[i].value) // update the cvar ONLY if a device exists
|
||||
|
||||
CV_SetValue(&cv_usejoystick[i], cv_usejoystick[i].value);
|
||||
}
|
||||
|
||||
@@ -1112,11 +1107,9 @@ void I_OsPolling(void)
|
||||
I_GetEvent();
|
||||
|
||||
mod = SDL_GetModState();
|
||||
|
||||
/* Handle here so that our state is always synched with the system. */
|
||||
shiftdown = ctrldown = altdown = 0;
|
||||
capslock = false;
|
||||
|
||||
if (mod & KMOD_LSHIFT) shiftdown |= 1;
|
||||
if (mod & KMOD_RSHIFT) shiftdown |= 2;
|
||||
if (mod & KMOD_LCTRL) ctrldown |= 1;
|
||||
@@ -1150,7 +1143,7 @@ static void VID_Command_Mode_f (void)
|
||||
{
|
||||
INT32 modenum;
|
||||
|
||||
if (COM_Argc() != 2)
|
||||
if (COM_Argc()!= 2)
|
||||
{
|
||||
CONS_Printf("vid_mode <modenum> : set video mode, current video mode %i\n", vid.modenum);
|
||||
return;
|
||||
@@ -1295,8 +1288,8 @@ static void SDLSetMode(INT32 width, INT32 height, SDL_bool fullscreen)
|
||||
#endif
|
||||
OglSdlSurface(vid.width, vid.height);
|
||||
}
|
||||
else
|
||||
#endif
|
||||
|
||||
if (rendermode == render_soft)
|
||||
{
|
||||
SDL_RenderClear(renderer);
|
||||
@@ -1361,8 +1354,7 @@ void I_FinishUpdate(void)
|
||||
|
||||
const boolean isserverplayer = consoleplayer == serverplayer;
|
||||
|
||||
if (cv_showping.value && ((netgame && !isserverplayer) ||
|
||||
(simulated_lag != 0 && isserverplayer && Playing())))
|
||||
if (cv_showping.value && ((netgame && !isserverplayer) || (simulated_lag != 0 && isserverplayer && Playing())))
|
||||
SCR_DisplayLocalPing();
|
||||
}
|
||||
|
||||
@@ -1629,13 +1621,11 @@ static SDL_bool Impl_CreateContext(void)
|
||||
|
||||
if (!renderer)
|
||||
renderer = SDL_CreateRenderer(window, -1, flags);
|
||||
|
||||
if (renderer == NULL)
|
||||
{
|
||||
CONS_Printf(M_GetText("Couldn't create rendering context: %s\n"), SDL_GetError());
|
||||
return SDL_FALSE;
|
||||
}
|
||||
|
||||
SDL_RenderSetLogicalSize(renderer, BASEVIDWIDTH, BASEVIDHEIGHT);
|
||||
}
|
||||
|
||||
@@ -1738,7 +1728,6 @@ void I_StartupGraphics(void)
|
||||
#endif
|
||||
{
|
||||
const char *vd = SDL_GetCurrentVideoDriver();
|
||||
|
||||
//CONS_Printf(M_GetText("Starting up with video driver: %s\n"), vd);
|
||||
if (vd && (strncasecmp(vd, "fbcon", 6) == 0))
|
||||
framebuffer = SDL_TRUE;
|
||||
@@ -1969,7 +1958,7 @@ static void Impl_SetVsync(void)
|
||||
#endif
|
||||
#ifdef HWRENDER
|
||||
if (!renderer && rendermode == render_opengl &&
|
||||
sdlglcontext != NULL && SDL_GL_GetCurrentContext() == sdlglcontext)
|
||||
sdlglcontext != NULL && SDL_GL_GetCurrentContext() == sdlglcontext)
|
||||
{
|
||||
SDL_GL_SetSwapInterval(cv_vidwait.value ? 1 : 0);
|
||||
}
|
||||
|
||||
+125
-237
@@ -123,12 +123,13 @@ static int result;
|
||||
static void var_cleanup(void)
|
||||
{
|
||||
song_length = loop_point = 0.0f;
|
||||
music_bytes = fading_source = fading_target =
|
||||
fading_timer = fading_duration = 0;
|
||||
music_bytes = fading_source = fading_target =\
|
||||
fading_timer = fading_duration = 0;
|
||||
music_end_bytes = 0;
|
||||
music_stutter_bytes = 0;
|
||||
|
||||
songpaused = is_looping = is_fading = false;
|
||||
songpaused = is_looping =\
|
||||
is_fading = false;
|
||||
|
||||
fading_callback = NULL;
|
||||
fading_do_callback = false;
|
||||
@@ -228,7 +229,6 @@ void I_ShutdownSound(void)
|
||||
{
|
||||
if (!sound_started)
|
||||
return; // not an error condition
|
||||
|
||||
sound_started = false;
|
||||
|
||||
Mix_CloseAudio();
|
||||
@@ -254,7 +254,6 @@ void I_UpdateSound(void)
|
||||
{
|
||||
if (fading_callback)
|
||||
(*fading_callback)();
|
||||
|
||||
fading_callback = NULL;
|
||||
fading_do_callback = false;
|
||||
}
|
||||
@@ -266,13 +265,13 @@ void I_UpdateSound(void)
|
||||
|
||||
// this is as fast as I can possibly make it.
|
||||
// sorry. more asm needed.
|
||||
static Mix_Chunk *ds2chunk(const void *stream)
|
||||
static Mix_Chunk *ds2chunk(void *stream)
|
||||
{
|
||||
UINT16 ver, freq;
|
||||
UINT32 samples, i, newsamples;
|
||||
UINT8 *sound;
|
||||
|
||||
const SINT8 *s;
|
||||
SINT8 *s;
|
||||
INT16 *d;
|
||||
INT16 o;
|
||||
fixed_t step, frac;
|
||||
@@ -281,7 +280,6 @@ static Mix_Chunk *ds2chunk(const void *stream)
|
||||
ver = READUINT16(stream); // sound version format?
|
||||
if (ver != 3) // It should be 3 if it's a doomsound...
|
||||
return NULL; // onos! it's not a doomsound!
|
||||
|
||||
freq = READUINT16(stream);
|
||||
samples = READUINT32(stream);
|
||||
|
||||
@@ -289,100 +287,91 @@ static Mix_Chunk *ds2chunk(const void *stream)
|
||||
return NULL; // division by zero
|
||||
|
||||
// convert from signed 8bit ???hz to signed 16bit 44100hz.
|
||||
switch (freq)
|
||||
switch(freq)
|
||||
{
|
||||
case 44100:
|
||||
if (samples >= UINT32_MAX>>2)
|
||||
return NULL; // would wrap, can't store.
|
||||
|
||||
newsamples = samples;
|
||||
break;
|
||||
case 22050:
|
||||
if (samples >= UINT32_MAX>>3)
|
||||
return NULL; // would wrap, can't store.
|
||||
|
||||
newsamples = samples<<1;
|
||||
break;
|
||||
case 11025:
|
||||
if (samples >= UINT32_MAX>>4)
|
||||
return NULL; // would wrap, can't store.
|
||||
|
||||
newsamples = samples<<2;
|
||||
break;
|
||||
default:
|
||||
frac = (44100 << FRACBITS) / (UINT32)freq;
|
||||
|
||||
if (!(frac & 0xFFFF)) // other solid multiples (change if FRACBITS != 16)
|
||||
newsamples = samples * (frac >> FRACBITS);
|
||||
else // strange and unusual fractional frequency steps, plus anything higher than 44100hz.
|
||||
newsamples = FixedMul(FixedDiv(samples, freq), 44100) + 1; // add 1 to counter truncation.
|
||||
|
||||
if (newsamples >= UINT32_MAX>>2)
|
||||
return NULL; // would and/or did wrap, can't store.
|
||||
|
||||
break;
|
||||
case 44100:
|
||||
if (samples >= UINT32_MAX>>2)
|
||||
return NULL; // would wrap, can't store.
|
||||
newsamples = samples;
|
||||
break;
|
||||
case 22050:
|
||||
if (samples >= UINT32_MAX>>3)
|
||||
return NULL; // would wrap, can't store.
|
||||
newsamples = samples<<1;
|
||||
break;
|
||||
case 11025:
|
||||
if (samples >= UINT32_MAX>>4)
|
||||
return NULL; // would wrap, can't store.
|
||||
newsamples = samples<<2;
|
||||
break;
|
||||
default:
|
||||
frac = (44100 << FRACBITS) / (UINT32)freq;
|
||||
if (!(frac & 0xFFFF)) // other solid multiples (change if FRACBITS != 16)
|
||||
newsamples = samples * (frac >> FRACBITS);
|
||||
else // strange and unusual fractional frequency steps, plus anything higher than 44100hz.
|
||||
newsamples = FixedMul(FixedDiv(samples, freq), 44100) + 1; // add 1 to counter truncation.
|
||||
if (newsamples >= UINT32_MAX>>2)
|
||||
return NULL; // would and/or did wrap, can't store.
|
||||
break;
|
||||
}
|
||||
|
||||
sound = Z_Malloc(newsamples<<2, PU_SOUND, NULL); // samples * frequency shift * bytes per sample * channels
|
||||
|
||||
s = (const SINT8 *)stream;
|
||||
s = (SINT8 *)stream;
|
||||
d = (INT16 *)sound;
|
||||
|
||||
i = 0;
|
||||
|
||||
switch(freq)
|
||||
{
|
||||
case 44100: // already at the same rate? well that makes it simple.
|
||||
while(i++ < samples)
|
||||
case 44100: // already at the same rate? well that makes it simple.
|
||||
while(i++ < samples)
|
||||
{
|
||||
o = ((INT16)(*s++)+0x80)<<8; // changed signedness and shift up to 16 bits
|
||||
*d++ = o; // left channel
|
||||
*d++ = o; // right channel
|
||||
}
|
||||
break;
|
||||
case 22050: // unwrap 2x
|
||||
while(i++ < samples)
|
||||
{
|
||||
o = ((INT16)(*s++)+0x80)<<8; // changed signedness and shift up to 16 bits
|
||||
*d++ = o; // left channel
|
||||
*d++ = o; // right channel
|
||||
*d++ = o; // left channel
|
||||
*d++ = o; // right channel
|
||||
}
|
||||
break;
|
||||
case 11025: // unwrap 4x
|
||||
while(i++ < samples)
|
||||
{
|
||||
o = ((INT16)(*s++)+0x80)<<8; // changed signedness and shift up to 16 bits
|
||||
*d++ = o; // left channel
|
||||
*d++ = o; // right channel
|
||||
*d++ = o; // left channel
|
||||
*d++ = o; // right channel
|
||||
*d++ = o; // left channel
|
||||
*d++ = o; // right channel
|
||||
*d++ = o; // left channel
|
||||
*d++ = o; // right channel
|
||||
}
|
||||
break;
|
||||
default: // convert arbitrary hz to 44100.
|
||||
step = 0;
|
||||
frac = ((UINT32)freq << FRACBITS) / 44100 + 1; //Add 1 to counter truncation.
|
||||
while (i < samples)
|
||||
{
|
||||
o = (INT16)(*s+0x80)<<8; // changed signedness and shift up to 16 bits
|
||||
while (step < FRACUNIT) // this is as fast as I can make it.
|
||||
{
|
||||
o = ((INT16)(*s++)+0x80)<<8; // changed signedness and shift up to 16 bits
|
||||
*d++ = o; // left channel
|
||||
*d++ = o; // right channel
|
||||
step += frac;
|
||||
}
|
||||
break;
|
||||
case 22050: // unwrap 2x
|
||||
while(i++ < samples)
|
||||
{
|
||||
o = ((INT16)(*s++)+0x80)<<8; // changed signedness and shift up to 16 bits
|
||||
*d++ = o; // left channel
|
||||
*d++ = o; // right channel
|
||||
*d++ = o; // left channel
|
||||
*d++ = o; // right channel
|
||||
}
|
||||
break;
|
||||
case 11025: // unwrap 4x
|
||||
while(i++ < samples)
|
||||
{
|
||||
o = ((INT16)(*s++)+0x80)<<8; // changed signedness and shift up to 16 bits
|
||||
*d++ = o; // left channel
|
||||
*d++ = o; // right channel
|
||||
*d++ = o; // left channel
|
||||
*d++ = o; // right channel
|
||||
*d++ = o; // left channel
|
||||
*d++ = o; // right channel
|
||||
*d++ = o; // left channel
|
||||
*d++ = o; // right channel
|
||||
}
|
||||
break;
|
||||
default: // convert arbitrary hz to 44100.
|
||||
step = 0;
|
||||
frac = ((UINT32)freq << FRACBITS) / 44100 + 1; //Add 1 to counter truncation.
|
||||
|
||||
while (i < samples)
|
||||
{
|
||||
o = (INT16)(*s+0x80)<<8; // changed signedness and shift up to 16 bits
|
||||
while (step < FRACUNIT) // this is as fast as I can make it.
|
||||
{
|
||||
*d++ = o; // left channel
|
||||
*d++ = o; // right channel
|
||||
step += frac;
|
||||
}
|
||||
do {
|
||||
i++; s++;
|
||||
step -= FRACUNIT;
|
||||
} while (step >= FRACUNIT);
|
||||
}
|
||||
break;
|
||||
do {
|
||||
i++; s++;
|
||||
step -= FRACUNIT;
|
||||
} while (step >= FRACUNIT);
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
// return Mixer Chunk.
|
||||
@@ -401,14 +390,12 @@ void *I_GetSfx(sfxinfo_t *sfx)
|
||||
|
||||
if (sfx->lumpnum == LUMPERROR)
|
||||
sfx->lumpnum = S_GetSfxLumpNum(sfx);
|
||||
|
||||
sfx->length = W_LumpLength(sfx->lumpnum);
|
||||
|
||||
lump = W_CacheLumpNum(sfx->lumpnum, PU_SOUND);
|
||||
|
||||
// convert from standard DoomSound format.
|
||||
chunk = ds2chunk(lump);
|
||||
|
||||
if (chunk)
|
||||
{
|
||||
Z_Free(lump);
|
||||
@@ -428,7 +415,6 @@ void *I_GetSfx(sfxinfo_t *sfx)
|
||||
int zErr; // Somewhere to handle any error messages zlib tosses out
|
||||
|
||||
memset(&stream, 0x00, sizeof (z_stream)); // Init zlib stream
|
||||
|
||||
// Begin the inflation process
|
||||
inflatedLen = *(UINT32 *)lump + (sfx->length-4); // Last 4 bytes are the decompressed size, typically
|
||||
inflatedData = (UINT8 *)Z_Malloc(inflatedLen, PU_SOUND, NULL); // Make room for the decompressed data
|
||||
@@ -438,13 +424,10 @@ void *I_GetSfx(sfxinfo_t *sfx)
|
||||
stream.next_out = inflatedData;
|
||||
|
||||
zErr = inflateInit2(&stream, 32 + MAX_WBITS);
|
||||
|
||||
if (zErr == Z_OK) // We're good to go
|
||||
{
|
||||
zErr = inflate(&stream, Z_FINISH);
|
||||
|
||||
if (zErr == Z_STREAM_END)
|
||||
{
|
||||
if (zErr == Z_STREAM_END) {
|
||||
// Run GME on new data
|
||||
if (!gme_open_data(inflatedData, inflatedLen, &emu, SAMPLERATE))
|
||||
{
|
||||
@@ -461,7 +444,6 @@ void *I_GetSfx(sfxinfo_t *sfx)
|
||||
|
||||
len = (info->play_length * 441 / 10) << 2;
|
||||
mem = Z_Malloc(len, PU_SOUND, 0);
|
||||
|
||||
gme_play(emu, len >> 1, mem);
|
||||
gme_free_info(info);
|
||||
gme_delete(emu);
|
||||
@@ -471,14 +453,10 @@ void *I_GetSfx(sfxinfo_t *sfx)
|
||||
}
|
||||
else
|
||||
CONS_Alert(CONS_ERROR,"Encountered %s when running inflate: %s\n", get_zlib_error(zErr), stream.msg);
|
||||
|
||||
(void)inflateEnd(&stream);
|
||||
}
|
||||
else // Hold up, zlib's got a problem
|
||||
{
|
||||
CONS_Alert(CONS_ERROR,"Encountered %s when running inflateInit: %s\n", get_zlib_error(zErr), stream.msg);
|
||||
}
|
||||
|
||||
Z_Free(inflatedData); // GME didn't open jack, but don't let that stop us from freeing this up
|
||||
#else
|
||||
return NULL; // No zlib support
|
||||
@@ -499,7 +477,6 @@ void *I_GetSfx(sfxinfo_t *sfx)
|
||||
|
||||
len = (info->play_length * 441 / 10) << 2;
|
||||
mem = Z_Malloc(len, PU_SOUND, 0);
|
||||
|
||||
gme_play(emu, len >> 1, mem);
|
||||
gme_free_info(info);
|
||||
gme_delete(emu);
|
||||
@@ -510,7 +487,6 @@ void *I_GetSfx(sfxinfo_t *sfx)
|
||||
|
||||
// Try to load it as a WAVE or OGG using Mixer.
|
||||
rw = SDL_RWFromMem(lump, sfx->length);
|
||||
|
||||
if (rw != NULL)
|
||||
{
|
||||
chunk = Mix_LoadWAV_RW(rw, 1);
|
||||
@@ -526,23 +502,19 @@ void I_FreeSfx(sfxinfo_t *sfx)
|
||||
{
|
||||
Mix_Chunk *chunk = (Mix_Chunk*)sfx->data;
|
||||
UINT8 *abufdata = NULL;
|
||||
|
||||
if (chunk->allocated == 0)
|
||||
{
|
||||
// We allocated the data in this chunk, so get the abuf from mixer, then let it free the chunk, THEN we free the data
|
||||
// I believe this should ensure the sound is not playing when we free it
|
||||
abufdata = chunk->abuf;
|
||||
}
|
||||
|
||||
Mix_FreeChunk(sfx->data);
|
||||
|
||||
if (abufdata)
|
||||
{
|
||||
// I'm going to assume we used Z_Malloc to allocate this data.
|
||||
Z_Free(abufdata);
|
||||
}
|
||||
}
|
||||
|
||||
sfx->data = NULL;
|
||||
sfx->lumpnum = LUMPERROR;
|
||||
}
|
||||
@@ -600,12 +572,9 @@ static UINT32 get_adjusted_position(UINT32 position)
|
||||
{
|
||||
// all in milliseconds
|
||||
UINT32 length = I_GetSongLength();
|
||||
|
||||
UINT32 looppoint = I_GetSongLoopPoint();
|
||||
if (length)
|
||||
{
|
||||
UINT32 looppoint = I_GetSongLoopPoint();
|
||||
return position >= length ? (position % (length-looppoint)) : position;
|
||||
}
|
||||
else
|
||||
return position;
|
||||
}
|
||||
@@ -620,7 +589,8 @@ static void do_fading_callback(void)
|
||||
/// Music Hooks
|
||||
/// ------------------------
|
||||
|
||||
static void Countstutter(int len)
|
||||
static void
|
||||
Countstutter (int len)
|
||||
{
|
||||
UINT32 bytes;
|
||||
|
||||
@@ -647,7 +617,7 @@ static void Countstutter(int len)
|
||||
else
|
||||
bytes = ( music_bytes - music_stutter_bytes );
|
||||
|
||||
I_SetSongPosition((int)((float)bytes/4/44100.0f*1000));
|
||||
I_SetSongPosition((int)( (float)bytes/4/44100.0f*1000 ));
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -658,9 +628,7 @@ static void count_music_bytes(int chan, void *stream, int len, void *udata)
|
||||
(void)stream;
|
||||
(void)udata;
|
||||
|
||||
const musictype_t mustype = I_SongType();
|
||||
|
||||
if (!music || mustype == MU_GME || mustype == MU_MOD || mustype == MU_MID)
|
||||
if (!music || I_SongType() == MU_GME || I_SongType() == MU_MOD || I_SongType() == MU_MID)
|
||||
return;
|
||||
|
||||
music_bytes += len;
|
||||
@@ -694,9 +662,7 @@ static UINT32 music_fade(UINT32 interval, void *param)
|
||||
return 0;
|
||||
}
|
||||
else if (songpaused) // don't decrement timer
|
||||
{
|
||||
return interval;
|
||||
}
|
||||
else if ((fading_timer -= 10) <= 0)
|
||||
{
|
||||
internal_volume = fading_target;
|
||||
@@ -709,14 +675,11 @@ static UINT32 music_fade(UINT32 interval, void *param)
|
||||
{
|
||||
UINT8 delta = abs(fading_target - fading_source);
|
||||
fixed_t factor = FixedDiv(fading_duration - fading_timer, fading_duration);
|
||||
|
||||
if (fading_target < fading_source)
|
||||
internal_volume = max(min(internal_volume, fading_source - FixedMul(delta, factor)), fading_target);
|
||||
else if (fading_target > fading_source)
|
||||
internal_volume = min(max(internal_volume, fading_source + FixedMul(delta, factor)), fading_target);
|
||||
|
||||
Mix_VolumeMusic(get_real_volume(music_volume));
|
||||
|
||||
return interval;
|
||||
}
|
||||
}
|
||||
@@ -800,22 +763,14 @@ musictype_t I_SongType(void)
|
||||
#endif
|
||||
if (!music)
|
||||
return MU_NONE;
|
||||
|
||||
const Mix_MusicType mustype = Mix_GetMusicType(music);
|
||||
|
||||
switch (mustype)
|
||||
{
|
||||
case MUS_MID:
|
||||
return MU_MID;
|
||||
case MUS_MOD:
|
||||
case MUS_MODPLUG:
|
||||
return MU_MOD;
|
||||
case MUS_MP3:
|
||||
case MUS_MP3_MAD:
|
||||
return MU_MP3;
|
||||
default:
|
||||
return (musictype_t)mustype;
|
||||
}
|
||||
else if (Mix_GetMusicType(music) == MUS_MID)
|
||||
return MU_MID;
|
||||
else if (Mix_GetMusicType(music) == MUS_MOD || Mix_GetMusicType(music) == MUS_MODPLUG)
|
||||
return MU_MOD;
|
||||
else if (Mix_GetMusicType(music) == MUS_MP3 || Mix_GetMusicType(music) == MUS_MP3_MAD)
|
||||
return MU_MP3;
|
||||
else
|
||||
return (musictype_t)Mix_GetMusicType(music);
|
||||
}
|
||||
|
||||
boolean I_SongPlaying(void)
|
||||
@@ -844,7 +799,6 @@ boolean I_SetSongSpeed(float speed)
|
||||
{
|
||||
if (speed > 250.0f)
|
||||
speed = 250.0f; //limit speed up to 250x
|
||||
|
||||
#ifdef HAVE_LIBGME
|
||||
if (gme)
|
||||
{
|
||||
@@ -903,63 +857,51 @@ UINT32 I_GetSongLength(void)
|
||||
// reconstruct info->play_length, from GME source
|
||||
// we only want intro + 1 loop, not 2
|
||||
length = info->length;
|
||||
|
||||
if (length <= 0)
|
||||
{
|
||||
length = info->intro_length + info->loop_length; // intro + 1 loop
|
||||
|
||||
if (length <= 0)
|
||||
length = 150 * 1000; // 2.5 minutes
|
||||
}
|
||||
}
|
||||
|
||||
gme_free_info(info);
|
||||
|
||||
return max(length, 0);
|
||||
}
|
||||
else
|
||||
#endif
|
||||
#ifdef HAVE_OPENMPT
|
||||
if (openmpt_mhandle)
|
||||
{
|
||||
return (UINT32)(openmpt_module_get_duration_seconds(openmpt_mhandle) * 1000.);
|
||||
}
|
||||
else
|
||||
#endif
|
||||
if (!music || I_SongType() == MU_MOD || I_SongType() == MU_MID)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
else
|
||||
{
|
||||
// VERY IMPORTANT to set your LENGTHMS= in your song files, folks!
|
||||
// SDL mixer can't read music length itself.
|
||||
length = (UINT32)(song_length*1000);
|
||||
|
||||
if (!length)
|
||||
CONS_Debug(DBG_DETAILED, "Getting music length: music is missing LENGTHMS= tag. Needed for seeking.\n");
|
||||
|
||||
return length;
|
||||
}
|
||||
}
|
||||
|
||||
boolean I_SetSongLoopPoint(UINT32 looppoint)
|
||||
{
|
||||
if (!music|| !is_looping)
|
||||
if (!music || I_SongType() == MU_GME || I_SongType() == MU_MOD || I_SongType() == MU_MID || !is_looping)
|
||||
return false;
|
||||
else
|
||||
{
|
||||
UINT32 length = I_GetSongLength();
|
||||
|
||||
const musictype_t mustype = I_SongType();
|
||||
if (length > 0)
|
||||
looppoint %= length;
|
||||
|
||||
if (mustype == MU_GME || mustype == MU_MOD || mustype == MU_MID)
|
||||
return false;
|
||||
|
||||
UINT32 length = I_GetSongLength();
|
||||
|
||||
if (length > 0)
|
||||
looppoint %= length;
|
||||
|
||||
loop_point = max((float)(looppoint / 1000.0L), 0);
|
||||
return true;
|
||||
loop_point = max((float)(looppoint / 1000.0L), 0);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
UINT32 I_GetSongLoopPoint(void)
|
||||
@@ -985,19 +927,14 @@ UINT32 I_GetSongLoopPoint(void)
|
||||
else
|
||||
#endif
|
||||
if (!music || I_SongType() == MU_MOD || I_SongType() == MU_MID)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
else
|
||||
{
|
||||
return (UINT32)(loop_point * 1000);
|
||||
}
|
||||
}
|
||||
|
||||
boolean I_SetSongPosition(UINT32 position)
|
||||
{
|
||||
UINT32 length;
|
||||
|
||||
#ifdef HAVE_LIBGME
|
||||
if (gme)
|
||||
{
|
||||
@@ -1034,13 +971,9 @@ boolean I_SetSongPosition(UINT32 position)
|
||||
else
|
||||
#endif
|
||||
if (!music || I_SongType() == MU_MID)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
else if (I_SongType() == MU_MOD)
|
||||
{
|
||||
return Mix_SetMusicPosition(position); // Goes by channels
|
||||
}
|
||||
else
|
||||
{
|
||||
// Because SDL mixer can't identify song length, if you have
|
||||
@@ -1048,13 +981,11 @@ boolean I_SetSongPosition(UINT32 position)
|
||||
// music_bytes becomes inaccurate.
|
||||
|
||||
length = I_GetSongLength(); // get it in MS
|
||||
|
||||
if (length)
|
||||
position = get_adjusted_position(position);
|
||||
|
||||
Mix_RewindMusic(); // needed for mp3
|
||||
|
||||
if (Mix_SetMusicPosition((float)(position/1000.0L)) == 0)
|
||||
if(Mix_SetMusicPosition((float)(position/1000.0L)) == 0)
|
||||
music_bytes = (UINT32)(position/1000.0L*44100.0L*4); //assume 44.1khz, 4-byte length (see I_GetSongPosition)
|
||||
else
|
||||
// NOTE: This block fires on incorrect song format,
|
||||
@@ -1094,7 +1025,6 @@ UINT32 I_GetSongPosition(void)
|
||||
}
|
||||
|
||||
gme_free_info(info);
|
||||
|
||||
return max(position, 0);
|
||||
}
|
||||
else
|
||||
@@ -1108,16 +1038,12 @@ UINT32 I_GetSongPosition(void)
|
||||
else
|
||||
#endif
|
||||
if (!music || I_SongType() == MU_MID)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
else
|
||||
{
|
||||
return (UINT32)(music_bytes/44100.0L*1000.0L/4); //assume 44.1khz
|
||||
// 4 = byte length for 16-bit samples (AUDIO_S16SYS), stereo (2-channel)
|
||||
// This is hardcoded in I_StartupSound. Other formats for factor:
|
||||
// 8M: 1 | 8S: 2 | 16M: 2 | 16S: 4
|
||||
}
|
||||
}
|
||||
|
||||
void I_UpdateSongLagThreshold(void)
|
||||
@@ -1131,16 +1057,12 @@ void I_UpdateSongLagThreshold(void)
|
||||
|
||||
boolean I_LoadSong(char *data, size_t len)
|
||||
{
|
||||
static const char *key1 = "LOOP";
|
||||
static const char *key2 = "POINT=";
|
||||
static const char *key3 = "MS=";
|
||||
static const size_t key1len = sizeof("LOOP")-1;
|
||||
static const size_t key2len = sizeof("POINT=")-1;
|
||||
static const size_t key3len = sizeof("MS=")-1;
|
||||
//const size_t key1len = strlen(key1);
|
||||
//const size_t key2len = strlen(key2);
|
||||
//const size_t key3len = strlen(key3);
|
||||
|
||||
const char *key1 = "LOOP";
|
||||
const char *key2 = "POINT=";
|
||||
const char *key3 = "MS=";
|
||||
const size_t key1len = strlen(key1);
|
||||
const size_t key2len = strlen(key2);
|
||||
const size_t key3len = strlen(key3);
|
||||
char *p = data;
|
||||
SDL_RWops *rw;
|
||||
|
||||
@@ -1177,7 +1099,6 @@ boolean I_LoadSong(char *data, size_t len)
|
||||
stream.next_out = inflatedData;
|
||||
|
||||
zErr = inflateInit2(&stream, 32 + MAX_WBITS);
|
||||
|
||||
if (zErr == Z_OK) // We're good to go
|
||||
{
|
||||
zErr = inflate(&stream, Z_FINISH);
|
||||
@@ -1193,12 +1114,10 @@ boolean I_LoadSong(char *data, size_t len)
|
||||
}
|
||||
else
|
||||
CONS_Alert(CONS_ERROR, "Encountered %s when running inflate: %s\n", get_zlib_error(zErr), stream.msg);
|
||||
|
||||
(void)inflateEnd(&stream);
|
||||
}
|
||||
else // Hold up, zlib's got a problem
|
||||
CONS_Alert(CONS_ERROR, "Encountered %s when running inflateInit: %s\n", get_zlib_error(zErr), stream.msg);
|
||||
|
||||
Z_Free(inflatedData); // GME didn't open jack, but don't let that stop us from freeing this up
|
||||
return false;
|
||||
#else
|
||||
@@ -1227,7 +1146,6 @@ boolean I_LoadSong(char *data, size_t len)
|
||||
if (result == OPENMPT_PROBE_FILE_HEADER_RESULT_SUCCESS) // We only cared if it succeeded, continue on if not.
|
||||
{
|
||||
openmpt_mhandle = openmpt_module_create_from_memory2(data, len, NULL, NULL, NULL, NULL, NULL, NULL, NULL);
|
||||
|
||||
if (!openmpt_mhandle) // Failed to create module handle? Show error and return!
|
||||
{
|
||||
mod_err = openmpt_module_error_get_last(openmpt_mhandle);
|
||||
@@ -1242,12 +1160,10 @@ boolean I_LoadSong(char *data, size_t len)
|
||||
|
||||
// Let's see if Mixer is able to load this.
|
||||
rw = SDL_RWFromMem(data, len);
|
||||
|
||||
if (rw != NULL)
|
||||
{
|
||||
music = Mix_LoadMUS_RW(rw, 1);
|
||||
}
|
||||
|
||||
if (!music)
|
||||
{
|
||||
CONS_Alert(CONS_ERROR, "Mix_LoadMUS_RW: %s\n", Mix_GetError());
|
||||
@@ -1275,7 +1191,7 @@ boolean I_LoadSong(char *data, size_t len)
|
||||
else if (!strncmp(p, key3, key3len)) // is it LOOPMS=?
|
||||
{
|
||||
p += key3len; // skip MS=
|
||||
loop_point = (float)(atof(p) / 1000.0); // LOOPMS works by real time, as miliseconds.
|
||||
loop_point = (float)(atoi(p) / 1000.0L); // LOOPMS works by real time, as miliseconds.
|
||||
// Everything that uses LOOPMS will work perfectly with SDL_Mixer.
|
||||
}
|
||||
}
|
||||
@@ -1285,7 +1201,6 @@ boolean I_LoadSong(char *data, size_t len)
|
||||
else // continue searching
|
||||
p++;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -1328,7 +1243,6 @@ boolean I_PlaySong(boolean looping)
|
||||
gme_start_track(gme, 0);
|
||||
current_track = 0;
|
||||
Mix_HookMusic(mix_gme, gme);
|
||||
|
||||
return true;
|
||||
}
|
||||
else
|
||||
@@ -1368,17 +1282,15 @@ boolean I_PlaySong(boolean looping)
|
||||
if (!music)
|
||||
return false;
|
||||
|
||||
const musictype_t mustype = I_SongType();
|
||||
|
||||
if (fpclassify(song_length) == FP_ZERO && (mustype == MU_OGG || mustype == MU_MP3 || mustype == MU_FLAC))
|
||||
if (fpclassify(song_length) == FP_ZERO && (I_SongType() == MU_OGG || I_SongType() == MU_MP3 || I_SongType() == MU_FLAC))
|
||||
CONS_Debug(DBG_DETAILED, "This song is missing a LENGTHMS= tag! Required to make seeking work properly.\n");
|
||||
|
||||
if (mustype != MU_MOD && mustype != MU_MID && Mix_PlayMusic(music, 0) == -1)
|
||||
if (I_SongType() != MU_MOD && I_SongType() != MU_MID && Mix_PlayMusic(music, 0) == -1)
|
||||
{
|
||||
CONS_Alert(CONS_ERROR, "Mix_PlayMusic: %s\n", Mix_GetError());
|
||||
return false;
|
||||
}
|
||||
else if ((mustype == MU_MOD || mustype == MU_MID) && Mix_PlayMusic(music, looping ? -1 : 0) == -1) // if MOD, loop forever
|
||||
else if ((I_SongType() == MU_MOD || I_SongType() == MU_MID) && Mix_PlayMusic(music, looping ? -1 : 0) == -1) // if MOD, loop forever
|
||||
{
|
||||
CONS_Alert(CONS_ERROR, "Mix_PlayMusic: %s\n", Mix_GetError());
|
||||
return false;
|
||||
@@ -1388,10 +1300,10 @@ boolean I_PlaySong(boolean looping)
|
||||
|
||||
I_SetMusicVolume(music_volume);
|
||||
|
||||
if (mustype != MU_MOD && mustype != MU_MID)
|
||||
if (I_SongType() != MU_MOD && I_SongType() != MU_MID)
|
||||
Mix_HookMusicFinished(music_loop); // don't bother counting if MOD
|
||||
|
||||
if (mustype != MU_MOD && mustype != MU_MID && !Mix_RegisterEffect(MIX_CHANNEL_POST, count_music_bytes, NULL, NULL))
|
||||
if(I_SongType() != MU_MOD && I_SongType() != MU_MID && !Mix_RegisterEffect(MIX_CHANNEL_POST, count_music_bytes, NULL, NULL))
|
||||
CONS_Alert(CONS_WARNING, "Error registering SDL music position counter: %s\n", Mix_GetError());
|
||||
|
||||
return true;
|
||||
@@ -1427,12 +1339,10 @@ void I_StopSong(void)
|
||||
|
||||
void I_PauseSong(void)
|
||||
{
|
||||
const musictype_t mustype = I_SongType();
|
||||
|
||||
if (mustype == MU_MID) // really, SDL Mixer? why can't you pause MIDI???
|
||||
if(I_SongType() == MU_MID) // really, SDL Mixer? why can't you pause MIDI???
|
||||
return;
|
||||
|
||||
if (mustype != MU_GME && mustype != MU_MOD && mustype != MU_MID)
|
||||
if(I_SongType() != MU_GME && I_SongType() != MU_MOD && I_SongType() != MU_MID)
|
||||
Mix_UnregisterEffect(MIX_CHANNEL_POST, count_music_bytes);
|
||||
|
||||
Mix_PauseMusic();
|
||||
@@ -1441,17 +1351,15 @@ void I_PauseSong(void)
|
||||
|
||||
void I_ResumeSong(void)
|
||||
{
|
||||
const musictype_t mustype = I_SongType();
|
||||
|
||||
if (mustype == MU_MID)
|
||||
if (I_SongType() == MU_MID)
|
||||
return;
|
||||
|
||||
if (mustype != MU_GME && mustype != MU_MOD && mustype != MU_MID)
|
||||
if (I_SongType() != MU_GME && I_SongType() != MU_MOD && I_SongType() != MU_MID)
|
||||
{
|
||||
while (Mix_UnregisterEffect(MIX_CHANNEL_POST, count_music_bytes) != 0) { }
|
||||
while(Mix_UnregisterEffect(MIX_CHANNEL_POST, count_music_bytes) != 0) { }
|
||||
// HACK: fixes issue of multiple effect callbacks being registered
|
||||
|
||||
if (music && mustype != MU_MOD && mustype != MU_MID && !Mix_RegisterEffect(MIX_CHANNEL_POST, count_music_bytes, NULL, NULL))
|
||||
if(music && I_SongType() != MU_MOD && I_SongType() != MU_MID && !Mix_RegisterEffect(MIX_CHANNEL_POST, count_music_bytes, NULL, NULL))
|
||||
CONS_Alert(CONS_WARNING, "Error registering SDL music position counter: %s\n", Mix_GetError());
|
||||
}
|
||||
|
||||
@@ -1484,24 +1392,20 @@ boolean I_SetSongTrack(INT32 track)
|
||||
{
|
||||
if (current_track == track)
|
||||
return false;
|
||||
|
||||
SDL_LockAudio();
|
||||
if (track >= 0 && track < gme_track_count(gme)-1)
|
||||
{
|
||||
gme_err_t gme_e = gme_start_track(gme, track);
|
||||
|
||||
if (gme_e != NULL)
|
||||
{
|
||||
CONS_Alert(CONS_ERROR, "GME error: %s\n", gme_e);
|
||||
return false;
|
||||
}
|
||||
|
||||
current_track = track;
|
||||
SDL_UnlockAudio();
|
||||
return true;
|
||||
}
|
||||
SDL_UnlockAudio();
|
||||
|
||||
return false;
|
||||
}
|
||||
else
|
||||
@@ -1511,7 +1415,6 @@ boolean I_SetSongTrack(INT32 track)
|
||||
{
|
||||
if (current_subsong == track)
|
||||
return false;
|
||||
|
||||
SDL_LockAudio();
|
||||
if (track >= 0 && track < openmpt_module_get_num_subsongs(openmpt_mhandle))
|
||||
{
|
||||
@@ -1525,10 +1428,8 @@ boolean I_SetSongTrack(INT32 track)
|
||||
return false;
|
||||
}
|
||||
#endif
|
||||
|
||||
if (I_SongType() == MU_MOD)
|
||||
return !Mix_SetMusicPosition(track);
|
||||
|
||||
(void)track;
|
||||
return false;
|
||||
}
|
||||
@@ -1540,10 +1441,8 @@ boolean I_SetSongTrack(INT32 track)
|
||||
void I_SetInternalMusicVolume(UINT8 volume)
|
||||
{
|
||||
internal_volume = volume;
|
||||
|
||||
if (!I_SongPlaying())
|
||||
return;
|
||||
|
||||
Mix_VolumeMusic(get_real_volume(music_volume));
|
||||
}
|
||||
|
||||
@@ -1551,7 +1450,6 @@ void I_StopFadingSong(void)
|
||||
{
|
||||
if (fading_id)
|
||||
SDL_RemoveTimer(fading_id);
|
||||
|
||||
is_fading = false;
|
||||
fading_source = fading_target = fading_timer = fading_duration = fading_id = 0;
|
||||
}
|
||||
@@ -1568,10 +1466,8 @@ boolean I_FadeSongFromVolume(UINT8 target_volume, UINT8 source_volume, UINT32 ms
|
||||
if (!ms && volume_delta)
|
||||
{
|
||||
I_SetInternalMusicVolume(target_volume);
|
||||
|
||||
if (callback)
|
||||
(*callback)();
|
||||
|
||||
return true;
|
||||
|
||||
}
|
||||
@@ -1579,28 +1475,20 @@ boolean I_FadeSongFromVolume(UINT8 target_volume, UINT8 source_volume, UINT32 ms
|
||||
{
|
||||
if (callback)
|
||||
(*callback)();
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
// Round MS to nearest 10
|
||||
// If n - lower > higher - n, then round up
|
||||
//ms = (ms - ((ms / 10) * 10) > (((ms / 10) * 10) + 10) - ms) ?
|
||||
// (((ms / 10) * 10) + 10) // higher
|
||||
// : ((ms / 10) * 10); // lower
|
||||
|
||||
const int lower = (ms / 10) * 10;
|
||||
const int upper = lower + 10;
|
||||
ms = (ms - lower > upper - ms) ? upper : lower;
|
||||
ms = (ms - ((ms / 10) * 10) > (((ms / 10) * 10) + 10) - ms) ?
|
||||
(((ms / 10) * 10) + 10) // higher
|
||||
: ((ms / 10) * 10); // lower
|
||||
|
||||
if (!ms)
|
||||
{
|
||||
I_SetInternalMusicVolume(target_volume);
|
||||
}
|
||||
else if (source_volume != target_volume)
|
||||
{
|
||||
fading_id = SDL_AddTimer(10, music_fade, NULL);
|
||||
|
||||
if (fading_id)
|
||||
{
|
||||
is_fading = true;
|
||||
@@ -1631,7 +1519,7 @@ boolean I_FadeInPlaySong(UINT32 ms, boolean looping)
|
||||
{
|
||||
if (I_PlaySong(looping))
|
||||
return I_FadeSongFromVolume(100, 0, ms, NULL);
|
||||
|
||||
return false;
|
||||
else
|
||||
return false;
|
||||
}
|
||||
#endif
|
||||
+25
-45
@@ -641,8 +641,8 @@ void VID_BlitLinearScreen(const UINT8 *restrict srcptr, UINT8 *restrict destptr,
|
||||
}
|
||||
}
|
||||
|
||||
static const UINT8 hudplusalpha[11] = { 10, 8, 6, 4, 2, 0, 0, 0, 0, 0, 0};
|
||||
static const UINT8 hudminusalpha[11] = { 10, 9, 9, 8, 8, 7, 7, 6, 6, 5, 5};
|
||||
static UINT8 hudplusalpha[11] = { 10, 8, 6, 4, 2, 0, 0, 0, 0, 0, 0};
|
||||
static UINT8 hudminusalpha[11] = { 10, 9, 9, 8, 8, 7, 7, 6, 6, 5, 5};
|
||||
UINT8 hudtrans = 0;
|
||||
|
||||
static const UINT8 *v_colormap = NULL;
|
||||
@@ -1739,69 +1739,59 @@ void V_DrawHorizontallyScaledFullScreenPatch(patch_t *patch)
|
||||
|
||||
void V_DrawVhsEffect(boolean rewind)
|
||||
{
|
||||
static fixed_t upbary = 100, downbary = 150;
|
||||
|
||||
UINT8 barsize, updistort, downdistort;
|
||||
static fixed_t upbary = 100*FRACUNIT, downbary = 150*FRACUNIT;
|
||||
|
||||
UINT8 *buf = vid.screens[0], *tmp = vid.screens[4];
|
||||
UINT16 y;
|
||||
UINT32 x, pos;
|
||||
UINT32 x, pos = 0;
|
||||
|
||||
UINT8 *buf, *tmp;
|
||||
UINT8 *normalmapstart, *thismapstart;
|
||||
UINT8 *normalmapstart = ((UINT8 *)transtables + (8<<FF_TRANSSHIFT|(19<<8)));
|
||||
#ifdef HQ_VHS
|
||||
UINT8 *tmapstart;
|
||||
UINT8 *tmapstart = ((UINT8 *)transtables + (6<<FF_TRANSSHIFT));
|
||||
#endif
|
||||
UINT8 *thismapstart;
|
||||
SINT8 offs;
|
||||
|
||||
barsize = vid.dup << 5;
|
||||
updistort = vid.dup << (rewind ? 5 : 3);
|
||||
downdistort = updistort >> 1;
|
||||
UINT8 barsize = vid.dup<<5;
|
||||
UINT8 updistort = vid.dup<<(rewind ? 5 : 3);
|
||||
UINT8 downdistort = updistort>>1;
|
||||
|
||||
if (rewind)
|
||||
V_DrawVhsEffect(false); // experimentation
|
||||
|
||||
upbary -= FixedMul(vid.dup * (rewind ? 3 : 1.8f), renderdeltatics);
|
||||
downbary += FixedMul(vid.dup * (rewind ? 2 : 1), renderdeltatics);
|
||||
upbary -= renderdeltatics * (vid.dup * (rewind ? 3 : 1.8f));
|
||||
downbary += renderdeltatics * (vid.dup * (rewind ? 2 : 1));
|
||||
|
||||
if (upbary < -barsize)
|
||||
upbary = vid.height;
|
||||
if (upbary < -barsize*FRACUNIT)
|
||||
upbary = vid.height<<FRACBITS;
|
||||
if (downbary > vid.height<<FRACBITS)
|
||||
downbary = -barsize*FRACUNIT;
|
||||
|
||||
if (downbary > vid.height)
|
||||
downbary = -barsize;
|
||||
fixed_t uby = upbary>>FRACBITS, dby = downbary>>FRACBITS;
|
||||
|
||||
#ifdef HWRENDER
|
||||
if (rendermode == render_opengl)
|
||||
{
|
||||
HWR_RenderVhsEffect(upbary, downbary, updistort, downdistort, barsize);
|
||||
HWR_RenderVhsEffect(uby, dby, updistort, downdistort, barsize);
|
||||
return;
|
||||
}
|
||||
#endif
|
||||
|
||||
buf = vid.screens[0];
|
||||
tmp = vid.screens[4];
|
||||
|
||||
normalmapstart = ((UINT8 *)transtables + (8<<FF_TRANSSHIFT|(19<<8)));
|
||||
#ifdef HQ_VHS
|
||||
tmapstart = ((UINT8 *)transtables + (6<<FF_TRANSSHIFT));
|
||||
#endif
|
||||
|
||||
pos = 0;
|
||||
|
||||
for (y = 0; y < vid.height; y+=2)
|
||||
{
|
||||
thismapstart = normalmapstart;
|
||||
offs = 0;
|
||||
|
||||
if (y >= upbary && y < upbary+barsize)
|
||||
if (y >= uby && y < uby+barsize)
|
||||
{
|
||||
thismapstart -= (2<<FF_TRANSSHIFT) - (5<<8);
|
||||
offs += updistort * 2.0f * min(y-upbary, upbary+barsize-y) / barsize;
|
||||
offs += updistort * 2.0f * min(y-uby, uby+barsize-y) / barsize;
|
||||
}
|
||||
|
||||
if (y >= downbary && y < downbary+barsize)
|
||||
if (y >= dby && y < dby+barsize)
|
||||
{
|
||||
thismapstart -= (2<<FF_TRANSSHIFT) - (5<<8);
|
||||
offs -= downdistort * 2.0f * min(y-downbary, downbary+barsize-y) / barsize;
|
||||
offs -= downdistort * 2.0f * min(y-dby, dby+barsize-y) / barsize;
|
||||
}
|
||||
|
||||
offs += M_RandomKey(vid.dup<<1);
|
||||
@@ -1919,10 +1909,8 @@ UINT8 *V_GetStringColormap(INT32 colorflags)
|
||||
}
|
||||
#else // optimised
|
||||
colorflags = ((colorflags & V_CHARCOLORMASK) >> V_CHARCOLORSHIFT);
|
||||
|
||||
if (!colorflags || colorflags > 15) // INT32 is signed, but V_CHARCOLORMASK is a very restrictive mask.
|
||||
return NULL;
|
||||
|
||||
return (purplemap+((colorflags-1)<<8));
|
||||
#endif
|
||||
}
|
||||
@@ -2012,7 +2000,6 @@ char *V_WordWrap(INT32 x, INT32 w, INT32 option, const char *string)
|
||||
for (i = 0; i < slen; ++i)
|
||||
{
|
||||
c = newstring[i];
|
||||
|
||||
if ((UINT8)c >= 0x80 && (UINT8)c <= 0x8F) //color parsing! -Inuyasha 2.16.09
|
||||
continue;
|
||||
|
||||
@@ -3581,9 +3568,6 @@ boolean *heatshifter = NULL;
|
||||
INT32 lastheight = 0;
|
||||
INT32 heatindex[MAXSPLITSCREENPLAYERS] = {0, 0, 0, 0};
|
||||
|
||||
// unused motion blur effect, probably non functional
|
||||
//#define MOTIONBLUR
|
||||
|
||||
//
|
||||
// V_DoPostProcessor
|
||||
//
|
||||
@@ -3598,9 +3582,7 @@ void V_DoPostProcessor(INT32 view, INT32 param)
|
||||
(void)type;
|
||||
(void)param;
|
||||
#else
|
||||
#ifndef MOTIONBLUR
|
||||
(void)param; // unused motion blur stuff
|
||||
#endif
|
||||
INT32 yoffset, xoffset;
|
||||
|
||||
#ifdef HWRENDER
|
||||
@@ -3735,8 +3717,7 @@ void V_DoPostProcessor(INT32 view, INT32 param)
|
||||
srcscr = tmp;
|
||||
}
|
||||
|
||||
#ifdef MOTIONBLUR
|
||||
if (thiscam->postimg & POSTIMG_MOTION) // Motion Blur!
|
||||
/*if (thiscam->postimg & POSTIMG_MOTION) // Motion Blur!
|
||||
{
|
||||
INT32 x, y;
|
||||
|
||||
@@ -3748,8 +3729,7 @@ void V_DoPostProcessor(INT32 view, INT32 param)
|
||||
for (x = xoffset; x < xoffset+viewwidth; x++)
|
||||
tmpscr[y*vid.width + x] = colormaps[*(transme + (srcscr [(y*vid.width)+x ] <<8) + (tmpscr[(y*vid.width)+x]))];
|
||||
}
|
||||
}
|
||||
#endif
|
||||
}*/
|
||||
|
||||
if ((thiscam->postimg & POSTIMG_FLIP) && !(thiscam->postimg & POSTIMG_MIRROR)) // Flip the screen upside-down
|
||||
{
|
||||
|
||||
+7
-14
@@ -259,12 +259,9 @@ static inline void W_LoadDehackedLumpsPK3(UINT16 wadnum)
|
||||
size_t length = len + 1 + strlen(lump_p->fullname); // length of file name, '|', and lump name
|
||||
char *name = malloc(length + 1);
|
||||
|
||||
if (!name)
|
||||
I_Error("W_LoadDehackedLumpsPK3: Out of memory!\n");
|
||||
|
||||
sprintf(name, "%s|%s", wadfiles[wadnum]->filename, lump_p->fullname);
|
||||
name[length] = '\0';
|
||||
CONS_Printf("Loading SOC from %s\n", name);
|
||||
CONS_Printf(M_GetText("Loading SOC from %s\n"), name);
|
||||
DEH_LoadDehackedLumpPwad(wadnum, posStart);
|
||||
free(name);
|
||||
}
|
||||
@@ -295,9 +292,6 @@ static inline void W_LoadDehackedLumps(UINT16 wadnum)
|
||||
size_t length = len + 1 + strlen(lump_p->fullname); // length of file name, '|', and lump name
|
||||
char *name = malloc(length + 1);
|
||||
|
||||
if (!name)
|
||||
I_Error("W_LoadDehackedLumps: Out of memory!\n");
|
||||
|
||||
sprintf(name, "%s|%s", wadfiles[wadnum]->filename, lump_p->fullname);
|
||||
name[length] = '\0';
|
||||
|
||||
@@ -971,25 +965,24 @@ UINT16 W_InitFile(const char *filename, boolean local, boolean startup)
|
||||
* \return 1 if all files were loaded, 0 if at least one was missing or
|
||||
* invalid.
|
||||
*/
|
||||
INT32 W_InitMultipleFiles(char **filenames, size_t count, boolean addons)
|
||||
INT32 W_InitMultipleFiles(char **filenames, boolean addons)
|
||||
{
|
||||
INT32 rc = 1;
|
||||
INT32 overallrc = 1;
|
||||
size_t i;
|
||||
|
||||
(void)addons;
|
||||
|
||||
for (i = 0; i < count; i++)
|
||||
// will be realloced as lumps are added
|
||||
for (; *filenames; filenames++)
|
||||
{
|
||||
const char *filename = filenames[i];
|
||||
|
||||
// Previously, W_VerifyNMUSlumps was called to mark game modified
|
||||
// for addons... but W_InitFile already does exactly that!
|
||||
|
||||
//CONS_Debug(DBG_SETUP, "Loading %s\n", *filenames);
|
||||
rc = W_InitFile(filename, false, true);
|
||||
rc = W_InitFile(*filenames, false, true);
|
||||
|
||||
if (rc == INT16_MAX)
|
||||
CONS_Printf(M_GetText("Errors occurred while loading %s; not added.\n"), filename);
|
||||
CONS_Printf(M_GetText("Errors occurred while loading %s; not added.\n"), *filenames);
|
||||
|
||||
overallrc &= (rc != INT16_MAX) ? 1 : 0;
|
||||
}
|
||||
|
||||
+1
-1
@@ -167,7 +167,7 @@ UINT16 W_InitFile(const char *filename, boolean local, boolean startup);
|
||||
|
||||
// W_InitMultipleFiles returns 1 if all is okay, 0 otherwise,
|
||||
// so that it stops with a message if a file was not found, but not if all is okay.
|
||||
INT32 W_InitMultipleFiles(char **filenames, size_t count, boolean addons);
|
||||
INT32 W_InitMultipleFiles(char **filenames, boolean addons);
|
||||
|
||||
// Used for autoload. Uses P_AddWadFileLocal instead of W_InitFiles.
|
||||
INT32 W_AddAutoloadedLocalFiles(char **filenames);
|
||||
|
||||
+12
-2
@@ -552,8 +552,18 @@ void Y_Ticker(void)
|
||||
|
||||
intertic++;
|
||||
|
||||
if ((timer && !--timer)
|
||||
|| (intertic == endtic))
|
||||
// multiplayer uses timer (based on cv_inttime)
|
||||
if (timer)
|
||||
{
|
||||
if (!--timer)
|
||||
{
|
||||
Y_EndIntermission();
|
||||
Y_FollowIntermission();
|
||||
return;
|
||||
}
|
||||
}
|
||||
// single player is hardcoded to go away after awhile
|
||||
else if (intertic == endtic)
|
||||
{
|
||||
Y_EndIntermission();
|
||||
Y_FollowIntermission();
|
||||
|
||||
Reference in new issue
Block a user