Compare commits

...
Author SHA1 Message Date
Alug 4676885521 fixup: replace stricmp with fasticmp
actually replace everything correctly
my dumbass forgor about the fast both strcmp and stricmp matter in sort stuff so we cannot use the fastcmp stuff there, which means we should not redifine stricmp as fasticmp in case something relies on that behaviour ugh
2025-11-01 23:45:06 +01:00
Alug df10855483 fix oopsie that broke name change 2025-11-01 23:15:38 +01:00
Alug dc6bf05f35 experiment: replace every strcasecmp with fasticmp
same as before, tho this is not twice as fast but atleast 1/3 faster
2025-11-01 23:15:26 +01:00
Alug 871545024d experiment: replace every strcmp with fastcmp
did some profiling and in basically every single test fastcmp was twice as fast as strcmp
maybe this speeds up some things
2025-11-01 23:15:21 +01:00
Alug aeb172f2ab do some smol cleanup r_skins
mostly style fixes, some minor caching for some things
2025-11-01 22:35:34 +01:00
Alug 4fccb48d2a fix wonky variable names 2025-11-01 20:58:04 +01:00
Alug 3e0150d4f3 remove auto/postload check variables
we can just check our counts since D_FindAddonsToAutoload will never be called again
2025-11-01 20:53:31 +01:00
Alug 7c1f17bb8d pass our file counts to W_InitMultipleFiles
smol opzimiation, skips some ptr deref
2025-11-01 20:49:03 +01:00
Alug c8ae4a89d9 throw motion blur effect stuff behind an ifdef
so we can get rid of the unused array
prob could just remove it at this point, but maybe ill fix it someday for the funnis
2025-11-01 20:08:36 +01:00
Alug 42b1f849c0 cleanup and optimize startup wad handling 2025-11-01 20:08:33 +01:00
Alug c0f24ebbbc postautoloaded can be static
not used outside of d_main
2025-11-01 20:08:30 +01:00
Alug de73c53665 optimize addon autoload handling 2025-11-01 20:08:25 +01:00
Alug 908e073628 removed unused autoload variables
M_ConnectMenuModChecks been checking an uninitialized bool the whole time Zzz...
2025-11-01 18:29:10 +01:00
Gustaf Alhäll eaee95a026 Add -workdir 2025-11-01 18:15:20 +01:00
Alug 456a380e3a HWR_PrecacheLevel: disable sprite precaching
in some cases this may lead to crashes, its mostly useless in gl eitherway due to how colourmapped sprites work
2025-11-01 16:32:27 +01:00
Alug c428472c6f dont precache anything ever in HWR_PrecacheLevel if disabled
before some cvar callbacks called this unconditionally
2025-11-01 16:32:19 +01:00
Alug feff5a7c17 make a toggle for using angleturn in replays
while this is more accurate to how the player experienced stuff in the actual game, this also can be somewhat jittery and stuttery depending on the net conditions the replay was recorded in, so make this toggable if someone wants it
2025-11-01 16:32:16 +01:00
Alug ae306351ba add cv_precachetextures to advanced video options 2025-11-01 16:32:13 +01:00
Alug 03de30df3e SV_StopServer: reset textcmdbuf
fixes an issue where in some rare cases, the game may get stuck in a weird limbo state due to the text command buffer being full and never be cleared, so net commands can never be executed
2025-11-01 03:01:40 +01:00
toaster e45c72f525 SV_StopServer: Use G_SetGamestate instead of a direct write
An apparent oversight identified while working on the previous commit.
2025-11-01 03:01:17 +01:00
Alug 36c43d89e6 GL encore: use struct for encore texture handling
struct with two sets of maptextures, one for normal another for encore textures
functionally identical, hopefully also performancewise
more explicit than doing this with just one set and indexing stuff :bloblcatpats:
2025-10-31 15:10:39 +01:00
Alug f34a47c50d HWR_PrecacheLevelFlats: only run flat encore case when having an "encoremap"
not when its just encore mode
might save some time on some maps, as we dont need to check for remapping
2025-10-31 15:10:32 +01:00
Alug 24895874ed UDP_Bind: check socket send buffer size aswell
if to small than adjust, like receive buffer
2025-10-30 18:04:04 +01:00
Gustaf Alhäll 129f88b6a7 Fix buffer underflow when querying invalid nodes 2025-10-30 18:03:47 +01:00
Alug cb5c4e482e SOCK_GetAddr: freeaddrinfo does not need to be called on getaddrinfo failure 2025-10-30 18:03:43 +01:00
Alug db2062ed1d some i_tcp fixes
- SOCK_Get return true when receiving good packet from a lan player
- SOCK_GetAddr fix handling of ipv6 addresses, so ipv6 servers can be found in the serverlist

taken from srb2/classic
2025-10-30 18:03:38 +01:00
Alug 45ee50b47d remove reduntant stuff from D_ClearState and G_StopDemo
we only need R_ExecuteSetViewSize from splitscreen_onchange, the rest doesent do anything due to SV_StopServer call earlier setting cl_mode to CL_ABORTED
SV_StopServer also calls Y_EndIntermission and Y_EndVote if necessary
2025-10-28 01:21:38 +01:00
Alug 694a8eeb69 P_TryMove: save one R_PointInSubsector call per player
by reusing the special sector calculated earlier, this didnt change for when its checked another time
also one fixedmul in P_SceneryTryMove in some cases
2025-10-28 00:50:02 +01:00
Alug 908bba2c8a rename subsector variable in P_TryCameraMove to be more descriptive 2025-10-28 00:49:58 +01:00
Alug 88363cf45d add NOHOLEPUNCH flag to disable holepunch entirely 2025-10-27 22:58:42 +01:00
Alug 509e7140e3 use strlcpy for filling playerinfo names
MAXPLAYERNAME+1 so it copies 21 and null terminates the last
2025-10-27 21:21:39 +01:00
Alug 056f919bbe DrawTiltedSpan: more micro optimize
- do pointerdiff outside the loops, no need to do them 16 times per span
- cache tiltilighting and planezlight, mark as const and restrict
2025-10-27 00:56:21 +01:00
Alug 548cad76b2 drawspan: some type fixes, mark const and reordering 2025-10-26 14:05:12 +01:00
Alug e26fb91350 simplify vhs effect interpolation 2025-10-25 22:32:58 +02:00
Alug 28685ea658 fix some tooltips issues, wording and inconsistencies
fbo also now supports from gl 2.1
2025-10-25 20:39:01 +02:00
Alug a69df8807d fix some messed up whitespaces lel 2025-10-24 21:57:57 +02:00
Alug 26fc417555 forgor about localskin menu
Zzz....
2025-10-24 16:09:53 +02:00
Alug bb3dd435f0 oop didnt mean to move this 2025-10-24 15:49:40 +02:00
indev 16a531272f Skip repeating backslashes in HU_DoCEcho when printing to console 2025-10-24 16:36:50 +03:00
Alug ba5b79e48a dont double print kitchen sink message to log
we already handle this in HU_DoCEcho
2025-10-24 15:37:11 +02:00
Alug 59470ddbd4 fix oob access in D_SetupVote
check if luamaps was set before
2025-10-24 15:37:08 +02:00
Alug 82c4191516 Revert "SDLSetMode: render immediately after resolution change to avoid 1-frame of texture presented at wrong size"
This reverts commit 0e2ffdeb1d.
2025-10-24 04:09:43 +02:00
Alug 8a305d3c79 move those to D_ClearState 2025-10-24 03:47:59 +02:00
Alug 7c507c7b3b do some cleanup g_demo
:shook:
use the CLEANUP macro everywhere
init some things that may not be initialized
and make this more readable
lets hope didnt break anything Zzz...
TODO: if there are still issues with demo records and stuff crashing might consider porting some of the fixes from RR
2025-10-24 03:44:56 +02:00
Alug ca27dad6c1 use D_ClearState in G_StopDemo
actually fixes issues with crashes AND palette reset
also resets a bunch of more stuff which def is good
2025-10-24 03:44:53 +02:00
Alug 383d55cac6 smol cleanup V_DrawVhsEffect
dont need to assign all the software stuff in gl mode
2025-10-24 03:37:45 +02:00
James R. 0e2ffdeb1d SDLSetMode: render immediately after resolution change to avoid 1-frame of texture presented at wrong size 2025-10-24 01:55:20 +02:00
Alug b84d101337 initialize sdl window,renderer and texture to something 2025-10-24 01:55:17 +02:00
Alug 852aa74d62 random style fixes and stuff 2025-10-23 21:01:20 +02:00
Alug aa06459c09 set special case for console key when using native keyboard input
ALWAYS make sure that remains in the same physical place
otherwise things might get very annoying
it already does so with my german layout
2025-10-23 21:01:20 +02:00
Alug c07502bf5a use strl instead of strn stuff to copy cecho text
ALOT safer than whatever this did before
2025-10-23 20:51:24 +02:00
Alug f751161693 fix CECHO text being overwritten with nothing
strlcat not strlcpy
2025-10-23 20:37:57 +02:00
toaster ed16c4fd9f Simplify intermission timer code
- We had two ways of ending the intermission, but only one would actually be used, and it resulted in code duplication.
- Combine the two ways.
- Disable the reached-but-didn't-do-anything-before-now code path for setting endtic.
2025-10-22 23:08:43 +02:00
Alug 41407538d4 cleanup + optimizations mixer_sound
thx indev for the better ms rounding code <3
2025-10-22 22:53:14 +02:00
Alug 5f394cd938 handle more memory allocation failure cases
reported with -Wformat-overflow
2025-10-22 16:02:35 +02:00
Alug e5bae89d0f fix namescrollbuf and mapmusic.name copies
ensure those are properly null terminated
as reported by ubsan
2025-10-22 15:34:43 +02:00
Alug f749800276 fix playersetup skin speen reading out of bounds
reported by ubsan
2025-10-22 15:34:40 +02:00
Alug 5289027272 uninline ctf resynch stuff
this wont ever be used and just makes lto and others complain occasionally (maybe frenmod uses ctf? forgor)
2025-10-22 15:34:38 +02:00
Alug 77f4d4ef3b fix replays occasionally crashing when stopping
due to R_ReInitColormaps our extra_colormaps pointer may be freed
so ensure it only gets called after gamestate has been set to GS_NULL so we dont risk doing this mid renderframe
fixes crashes in software and palette render mode
2025-10-22 13:48:56 +02:00
AJ Martinez a94740f5e9 Fix unsteady camera movement in demos 2025-10-22 13:44:32 +02:00
toaster ab27090ecf Don't send a netxcmd when using addfile outside of netgame
Was supposed to be happening already, but `multiplayer` is a useless variable...
2025-10-22 11:32:49 +02:00
Alug 93d0106c28 remove erronous ";" 2025-10-22 11:32:46 +02:00
63 changed files with 1397 additions and 931 deletions

No files matched your search

+1
View File
@@ -49,6 +49,7 @@
# Already enabled by default for 32-bit # Already enabled by default for 32-bit
# Windows. # Windows.
# NOCURL=1 - Disable libcurl--HTTP capability. # NOCURL=1 - Disable libcurl--HTTP capability.
# NOHOLEPUNCH=1 - Disable holepunch capability.
# NOLIBGME=1 - Disable game music emu, retro VGM support. # NOLIBGME=1 - Disable game music emu, retro VGM support.
# NOOPENMPT=1 - Disable module (tracker) music support. # NOOPENMPT=1 - Disable module (tracker) music support.
# NOMIXER=1 - Disable SDL Mixer (audio playback). # NOMIXER=1 - Disable SDL Mixer (audio playback).
+2 -1
View File
@@ -6,7 +6,8 @@ passthru_opts+=\
NOHW NOMD5 NOPOSTPROCESSING\ NOHW NOMD5 NOPOSTPROCESSING\
MOBJCONSISTANCY PACKETDROP ZDEBUG\ MOBJCONSISTANCY PACKETDROP ZDEBUG\
HAVE_MINIUPNPC\ HAVE_MINIUPNPC\
HAVE_DISCORDRPC DEVELOP HAVE_DISCORDRPC DEVELOP\
NOHOLEPUNCH\
# build with debugging information # build with debugging information
ifdef DEBUGMODE ifdef DEBUGMODE
+4 -2
View File
@@ -24,6 +24,8 @@
#include "lauxlib.h" #include "lauxlib.h"
#include "../doomdef.h"
#define FREELIST_REF 0 /* free list of references */ #define FREELIST_REF 0 /* free list of references */
@@ -40,7 +42,7 @@ LUALIB_API int luaL_argerror (lua_State *L, int narg, const char *extramsg) {
if (!lua_getstack(L, 0, &ar)) /* no stack frame? */ if (!lua_getstack(L, 0, &ar)) /* no stack frame? */
return luaL_error(L, "bad argument #%d (%s)", narg, extramsg); return luaL_error(L, "bad argument #%d (%s)", narg, extramsg);
lua_getinfo(L, "n", &ar); lua_getinfo(L, "n", &ar);
if (strcmp(ar.namewhat, "method") == 0) { if (fastcmp(ar.namewhat, "method")) {
narg--; /* do not count `self' */ narg--; /* do not count `self' */
if (narg == 0) /* error is in the self argument itself? */ if (narg == 0) /* error is in the self argument itself? */
return luaL_error(L, "calling " LUA_QS " on bad self (%s)", return luaL_error(L, "calling " LUA_QS " on bad self (%s)",
@@ -97,7 +99,7 @@ LUALIB_API int luaL_checkoption (lua_State *L, int narg, const char *def,
luaL_checkstring(L, narg); luaL_checkstring(L, narg);
int i; int i;
for (i=0; lst[i]; i++) for (i=0; lst[i]; i++)
if (strcmp(lst[i], name) == 0) if (fastcmp(lst[i], name))
return i; return i;
return luaL_argerror(L, narg, return luaL_argerror(L, narg,
lua_pushfstring(L, "invalid option " LUA_QS, name)); lua_pushfstring(L, "invalid option " LUA_QS, name));
+5 -3
View File
@@ -161,12 +161,13 @@ static int io_tostring (lua_State *L) {
static int StartsWith(const char *a, const char *b) // this is wolfs being lazy yet again static int StartsWith(const char *a, const char *b) // this is wolfs being lazy yet again
{ {
if(strncmp(a, b, strlen(b)) == 0) return 1; if (strncmp(a, b, strlen(b)) == 0) return 1;
return 0; return 0;
} }
static int io_open (lua_State *L) { static int io_open(lua_State *L)
{
FILE **pf; FILE **pf;
const char *filename = luaL_checkstring(L, 1); const char *filename = luaL_checkstring(L, 1);
int pass = 0; int pass = 0;
@@ -178,12 +179,13 @@ static int io_open (lua_State *L) {
for (i = 0; i < (sizeof (whitelist) / sizeof(const char *)); i++) for (i = 0; i < (sizeof (whitelist) / sizeof(const char *)); i++)
{ {
if (!stricmp(&filename[length - strlen(whitelist[i])], whitelist[i])) if (fasticmp(&filename[length - strlen(whitelist[i])], whitelist[i]))
{ {
pass = 1; pass = 1;
break; break;
} }
} }
if (l_unlikely(strstr(filename, "..") || strchr(filename, ':') || StartsWith(filename, "\\") if (l_unlikely(strstr(filename, "..") || strchr(filename, ':') || StartsWith(filename, "\\")
|| StartsWith(filename, "/") || !pass)) || StartsWith(filename, "/") || !pass))
{ {
+47 -44
View File
@@ -359,7 +359,7 @@ size_t COM_CheckParm(const char *check)
size_t i; size_t i;
for (i = 1; i < com_argc; i++) for (i = 1; i < com_argc; i++)
if (!strcasecmp(check, com_argv[i])) if (fasticmp(check, com_argv[i]))
return i; return i;
return 0; return 0;
} }
@@ -456,7 +456,7 @@ void COM_AddCommand(const char *name, com_func_t func)
// fail if the command already exists // fail if the command already exists
for (cmd = com_commands; cmd; cmd = cmd->next) for (cmd = com_commands; cmd; cmd = cmd->next)
{ {
if (!stricmp(name, cmd->name)) //case insensitive now that we have lower and uppercase! if (fasticmp(name, cmd->name)) //case insensitive now that we have lower and uppercase!
{ {
// don't I_Error for Lua commands // don't I_Error for Lua commands
// Lua commands can replace game commands, and they have priority. // Lua commands can replace game commands, and they have priority.
@@ -492,7 +492,7 @@ int COM_AddLuaCommand(const char *name)
// command already exists // command already exists
for (cmd = com_commands; cmd; cmd = cmd->next) for (cmd = com_commands; cmd; cmd = cmd->next)
{ {
if (!stricmp(name, cmd->name)) //case insensitive now that we have lower and uppercase! if (fasticmp(name, cmd->name)) //case insensitive now that we have lower and uppercase!
{ {
// replace the built in command. // replace the built in command.
cmd->function = COM_Lua_f; cmd->function = COM_Lua_f;
@@ -519,7 +519,7 @@ static boolean COM_Exists(const char *com_name)
xcommand_t *cmd; xcommand_t *cmd;
for (cmd = com_commands; cmd; cmd = cmd->next) for (cmd = com_commands; cmd; cmd = cmd->next)
if (!stricmp(com_name, cmd->name)) if (fasticmp(com_name, cmd->name))
return true; return true;
return false; return false;
@@ -571,7 +571,7 @@ static void COM_ExecuteString(char *ptext)
// check functions // check functions
for (cmd = com_commands; cmd; cmd = cmd->next) for (cmd = com_commands; cmd; cmd = cmd->next)
{ {
if (!stricmp(com_argv[0], cmd->name)) //case insensitive now that we have lower and uppercase! if (fasticmp(com_argv[0], cmd->name)) //case insensitive now that we have lower and uppercase!
{ {
cmd->function(); cmd->function();
return; return;
@@ -581,7 +581,7 @@ static void COM_ExecuteString(char *ptext)
// check aliases // check aliases
for (a = com_alias; a; a = a->next) for (a = com_alias; a; a = a->next)
{ {
if (!stricmp(com_argv[0], a->name)) if (fasticmp(com_argv[0], a->name))
{ {
if (recursion > MAX_ALIAS_RECURSION) if (recursion > MAX_ALIAS_RECURSION)
CONS_Alert(CONS_WARNING, M_GetText("Alias recursion cycle detected!\n")); CONS_Alert(CONS_WARNING, M_GetText("Alias recursion cycle detected!\n"));
@@ -700,6 +700,7 @@ static void COM_Echo_f(void)
for (i = 1; i < COM_Argc(); i++) for (i = 1; i < COM_Argc(); i++)
CONS_Printf("%s ", COM_Argv(i)); CONS_Printf("%s ", COM_Argv(i));
CONS_Printf("\n"); CONS_Printf("\n");
} }
@@ -708,11 +709,11 @@ static void COM_Echo_f(void)
static void COM_CEcho_f(void) static void COM_CEcho_f(void)
{ {
size_t i; size_t i;
char cechotext[1024] = ""; char cechotext[1024] = {0};
for (i = 1; i < COM_Argc(); i++) for (i = 1; i < COM_Argc(); i++)
{ {
strlcpy(cechotext, COM_Argv(i), sizeof(cechotext)-1); strlcat(cechotext, COM_Argv(i), sizeof(cechotext)-1);
strlcat(cechotext, " ", sizeof(cechotext)-1); strlcat(cechotext, " ", sizeof(cechotext)-1);
} }
@@ -835,7 +836,7 @@ static void COM_Help_f(void)
if (cvar->PossibleValue) if (cvar->PossibleValue)
{ {
{ {
if (!stricmp(cvar->PossibleValue[0].strvalue, "MIN") && !stricmp(cvar->PossibleValue[1].strvalue, "MAX")) if (fasticmp(cvar->PossibleValue[0].strvalue, "MIN") && fasticmp(cvar->PossibleValue[1].strvalue, "MAX"))
{ {
if (floatmode) if (floatmode)
{ {
@@ -878,7 +879,7 @@ static void COM_Help_f(void)
{ {
for (cmd = com_commands; cmd; cmd = cmd->next) for (cmd = com_commands; cmd; cmd = cmd->next)
{ {
if (strcmp(cmd->name, help)) if (!fastcmp(cmd->name, help))
continue; continue;
CONS_Printf("\x82""Command %s:\n", cmd->name); CONS_Printf("\x82""Command %s:\n", cmd->name);
@@ -938,6 +939,8 @@ static void COM_Find_f(void)
} }
help = COM_Argv(1); help = COM_Argv(1);
if (!help)
return;
helplen = strlen(help); helplen = strlen(help);
CONS_Printf("\x82""Variables:\n"); CONS_Printf("\x82""Variables:\n");
matchesany = false; matchesany = false;
@@ -1173,7 +1176,7 @@ consvar_t *CV_FindVar(const char *name)
consvar_t *cvar; consvar_t *cvar;
for (cvar = consvar_vars; cvar; cvar = cvar->next) for (cvar = consvar_vars; cvar; cvar = cvar->next)
if (!stricmp(name,cvar->name)) if (fasticmp(name,cvar->name))
return cvar; return cvar;
return NULL; return NULL;
@@ -1363,7 +1366,7 @@ static void Setvalue(consvar_t *var, const char *valstr, boolean stealth)
v = INT32_MIN; // Invalid integer trigger v = INT32_MIN; // Invalid integer trigger
} }
if (var->PossibleValue[0].strvalue && !stricmp(var->PossibleValue[0].strvalue, "MIN")) // bounded cvar if (var->PossibleValue[0].strvalue && fasticmp(var->PossibleValue[0].strvalue, "MIN")) // bounded cvar
{ {
#define MINVAL 0 #define MINVAL 0
#define MAXVAL 1 #define MAXVAL 1
@@ -1376,21 +1379,21 @@ static void Setvalue(consvar_t *var, const char *valstr, boolean stealth)
// search for other // search for other
for (i = MAXVAL+1; var->PossibleValue[i].strvalue; i++) for (i = MAXVAL+1; var->PossibleValue[i].strvalue; i++)
if (v == var->PossibleValue[i].value || !stricmp(var->PossibleValue[i].strvalue, valstr)) if (v == var->PossibleValue[i].value || fasticmp(var->PossibleValue[i].strvalue, valstr))
{ {
var->value = var->PossibleValue[i].value; var->value = var->PossibleValue[i].value;
var->string = var->PossibleValue[i].strvalue; var->string = var->PossibleValue[i].strvalue;
goto finish; goto finish;
} }
if ((v != INT32_MIN && v < var->PossibleValue[MINVAL].value) || !stricmp(valstr, "MIN")) if ((v != INT32_MIN && v < var->PossibleValue[MINVAL].value) || fasticmp(valstr, "MIN"))
{ {
v = var->PossibleValue[MINVAL].value; v = var->PossibleValue[MINVAL].value;
valstr = var->PossibleValue[MINVAL].strvalue; valstr = var->PossibleValue[MINVAL].strvalue;
override = true; override = true;
overrideval = v; overrideval = v;
} }
else if ((v != INT32_MIN && v > var->PossibleValue[MAXVAL].value) || !stricmp(valstr, "MAX")) else if ((v != INT32_MIN && v > var->PossibleValue[MAXVAL].value) || fasticmp(valstr, "MAX"))
{ {
v = var->PossibleValue[MAXVAL].value; v = var->PossibleValue[MAXVAL].value;
valstr = var->PossibleValue[MAXVAL].strvalue; valstr = var->PossibleValue[MAXVAL].strvalue;
@@ -1408,7 +1411,7 @@ static void Setvalue(consvar_t *var, const char *valstr, boolean stealth)
// check first strings // check first strings
for (i = 0; var->PossibleValue[i].strvalue; i++) for (i = 0; var->PossibleValue[i].strvalue; i++)
if (!stricmp(var->PossibleValue[i].strvalue, valstr)) if (fasticmp(var->PossibleValue[i].strvalue, valstr))
goto found; goto found;
if (v != INT32_MIN) if (v != INT32_MIN)
{ {
@@ -1421,9 +1424,9 @@ static void Setvalue(consvar_t *var, const char *valstr, boolean stealth)
if (var->PossibleValue == CV_OnOff || var->PossibleValue == CV_YesNo) if (var->PossibleValue == CV_OnOff || var->PossibleValue == CV_YesNo)
{ {
overrideval = -1; overrideval = -1;
if (!stricmp(valstr, "on") || !stricmp(valstr, "yes")) if (fasticmp(valstr, "on") || fasticmp(valstr, "yes"))
overrideval = 1; overrideval = 1;
else if (!stricmp(valstr, "off") || !stricmp(valstr, "no")) else if (fasticmp(valstr, "off") || fasticmp(valstr, "no"))
overrideval = 0; overrideval = 0;
if (overrideval != -1) if (overrideval != -1)
@@ -1607,7 +1610,7 @@ void CV_ResetCheatNetVars(void)
// Returns true if the variable's current value is its default value // Returns true if the variable's current value is its default value
boolean CV_IsSetToDefault(consvar_t *v) boolean CV_IsSetToDefault(consvar_t *v)
{ {
return (!(strcmp(v->defaultvalue, v->string))); return (fastcmp(v->defaultvalue, v->string));
} }
// If any cheats CVars are not at their default settings, return true. // If any cheats CVars are not at their default settings, return true.
@@ -1619,7 +1622,7 @@ UINT8 CV_CheatsEnabled(void)
consvar_t *cvar; consvar_t *cvar;
for (cvar = consvar_vars; cvar; cvar = cvar->next) for (cvar = consvar_vars; cvar; cvar = cvar->next)
if ((cvar->flags & CV_CHEAT) && strcmp(cvar->defaultvalue, cvar->string)) if ((cvar->flags & CV_CHEAT) && !fastcmp(cvar->defaultvalue, cvar->string))
return 1; return 1;
return 0; return 0;
} }
@@ -1640,7 +1643,7 @@ static void CV_SetCVar(consvar_t *var, const char *value, boolean stealth)
if (!var->string) if (!var->string)
I_Error("CV_Set: %s no string set!\n", var->name); I_Error("CV_Set: %s no string set!\n", var->name);
#endif #endif
if (!var || !var->string || !value || !stricmp(var->string, value)) if (!var || !var->string || !value || fasticmp(var->string, value))
return; // no changes return; // no changes
if (var->flags & CV_NETVAR) if (var->flags & CV_NETVAR)
@@ -1662,7 +1665,7 @@ static void CV_SetCVar(consvar_t *var, const char *value, boolean stealth)
if (var == &cv_kartspeed && !M_SecretUnlocked(SECRET_HARDSPEED)) if (var == &cv_kartspeed && !M_SecretUnlocked(SECRET_HARDSPEED))
{ {
if (!stricmp(value, "Hard") || atoi(value) == 2) if (fasticmp(value, "Hard") || atoi(value) == 2)
{ {
CONS_Alert(CONS_NOTICE, "You haven't unlocked this yet!\n"); CONS_Alert(CONS_NOTICE, "You haven't unlocked this yet!\n");
return; return;
@@ -1796,7 +1799,7 @@ void CV_AddValue(consvar_t *var, INT32 increment)
} }
#define MINVAL 0 #define MINVAL 0
#define MAXVAL 1 #define MAXVAL 1
else if (var->PossibleValue[MINVAL].strvalue && !strcmp(var->PossibleValue[MINVAL].strvalue, "MIN")) else if (var->PossibleValue[MINVAL].strvalue && fastcmp(var->PossibleValue[MINVAL].strvalue, "MIN"))
{ // SRB2Kart { // SRB2Kart
#ifdef PARANOIA #ifdef PARANOIA
if (!var->PossibleValue[MAXVAL].strvalue) if (!var->PossibleValue[MAXVAL].strvalue)
@@ -1968,12 +1971,12 @@ static boolean CV_FilterJoyAxisVars(consvar_t *v, const char *valstr)
{ {
if (joyaxis_default[i]) if (joyaxis_default[i])
{ {
if (!stricmp(v->name, "joyaxis_fire")) if (fasticmp(v->name, "joyaxis_fire"))
{ {
if (joyaxis_count[i] > 7) return false; if (joyaxis_count[i] > 7) return false;
else if (joyaxis_count[i] == 7) return true; else if (joyaxis_count[i] == 7) return true;
if (!stricmp(valstr, "None")) joyaxis_count[i]++; if (fasticmp(valstr, "None")) joyaxis_count[i]++;
else joyaxis_default[i] = false; else joyaxis_default[i] = false;
} }
// reset all axis settings to defaults // reset all axis settings to defaults
@@ -2005,37 +2008,37 @@ static boolean CV_FilterJoyAxisVars(consvar_t *v, const char *valstr)
// Block the Xbox DInput default axes and reset to the current defaults // Block the Xbox DInput default axes and reset to the current defaults
static boolean CV_FilterJoyAxisVars2(consvar_t *v, const char *valstr) static boolean CV_FilterJoyAxisVars2(consvar_t *v, const char *valstr)
{ {
if (!stricmp(v->name, "joyaxis_turn") && !stricmp(valstr, "X-Axis")) if (fasticmp(v->name, "joyaxis_turn") && fasticmp(valstr, "X-Axis"))
return false; return false;
if (!stricmp(v->name, "joyaxis2_turn") && !stricmp(valstr, "X-Axis")) if (fasticmp(v->name, "joyaxis2_turn") && fasticmp(valstr, "X-Axis"))
return false; return false;
if (!stricmp(v->name, "joyaxis3_turn") && !stricmp(valstr, "X-Axis")) if (fasticmp(v->name, "joyaxis3_turn") && fasticmp(valstr, "X-Axis"))
return false; return false;
if (!stricmp(v->name, "joyaxis4_turn") && !stricmp(valstr, "X-Axis")) if (fasticmp(v->name, "joyaxis4_turn") && fasticmp(valstr, "X-Axis"))
return false; return false;
if (!stricmp(v->name, "joyaxis_aim") && !stricmp(valstr, "Y-Axis")) if (fasticmp(v->name, "joyaxis_aim") && fasticmp(valstr, "Y-Axis"))
return false; return false;
if (!stricmp(v->name, "joyaxis2_aim") && !stricmp(valstr, "Y-Axis")) if (fasticmp(v->name, "joyaxis2_aim") && fasticmp(valstr, "Y-Axis"))
return false; return false;
if (!stricmp(v->name, "joyaxis3_aim") && !stricmp(valstr, "Y-Axis")) if (fasticmp(v->name, "joyaxis3_aim") && fasticmp(valstr, "Y-Axis"))
return false; return false;
if (!stricmp(v->name, "joyaxis4_aim") && !stricmp(valstr, "Y-Axis")) if (fasticmp(v->name, "joyaxis4_aim") && fasticmp(valstr, "Y-Axis"))
return false; return false;
if (!stricmp(v->name, "joyaxis_fire") && !stricmp(valstr, "None")) if (fasticmp(v->name, "joyaxis_fire") && fasticmp(valstr, "None"))
return false; return false;
if (!stricmp(v->name, "joyaxis2_fire") && !stricmp(valstr, "None")) if (fasticmp(v->name, "joyaxis2_fire") && fasticmp(valstr, "None"))
return false; return false;
if (!stricmp(v->name, "joyaxis3_fire") && !stricmp(valstr, "None")) if (fasticmp(v->name, "joyaxis3_fire") && fasticmp(valstr, "None"))
return false; return false;
if (!stricmp(v->name, "joyaxis4_fire") && !stricmp(valstr, "None")) if (fasticmp(v->name, "joyaxis4_fire") && fasticmp(valstr, "None"))
return false; return false;
if (!stricmp(v->name, "joyaxis_drift") && !stricmp(valstr, "None")) if (fasticmp(v->name, "joyaxis_drift") && fasticmp(valstr, "None"))
return false; return false;
if (!stricmp(v->name, "joyaxis2_drift") && !stricmp(valstr, "None")) if (fasticmp(v->name, "joyaxis2_drift") && fasticmp(valstr, "None"))
return false; return false;
if (!stricmp(v->name, "joyaxis3_drift") && !stricmp(valstr, "None")) if (fasticmp(v->name, "joyaxis3_drift") && fasticmp(valstr, "None"))
return false; return false;
if (!stricmp(v->name, "joyaxis4_drift") && !stricmp(valstr, "None")) if (fasticmp(v->name, "joyaxis4_drift") && fasticmp(valstr, "None"))
return false; return false;
return true; return true;
@@ -2052,8 +2055,8 @@ static boolean CV_FilterVarByVersion(consvar_t *v, const char *valstr)
if (GETMAJOREXECVERSION(cv_execversion.value) < 8) // 8 = 1.4 if (GETMAJOREXECVERSION(cv_execversion.value) < 8) // 8 = 1.4
{ {
if (!stricmp(v->name, "masterserver") // Replaces a hack in MasterServer_OnChange for the original SRB2 MS. if (fasticmp(v->name, "masterserver") // Replaces a hack in MasterServer_OnChange for the original SRB2 MS.
|| !stricmp(v->name, "gamma")) // Too easy to accidentially change in prior versions. || fasticmp(v->name, "gamma")) // Too easy to accidentially change in prior versions.
return false; return false;
} }
@@ -2136,7 +2139,7 @@ void CV_SaveVariables(FILE *f)
char stringtowrite[MAXTEXTCMD+1]; char stringtowrite[MAXTEXTCMD+1];
// Silly hack for Min/Max vars // Silly hack for Min/Max vars
if (!strcmp(cvar->string, "MAX") || !strcmp(cvar->string, "MIN")) if (fastcmp(cvar->string, "MAX") || fastcmp(cvar->string, "MIN"))
{ {
if (cvar->flags & CV_FLOAT) if (cvar->flags & CV_FLOAT)
sprintf(stringtowrite, "%f", FixedToFloat(cvar->value)); sprintf(stringtowrite, "%f", FixedToFloat(cvar->value));
+1 -1
View File
@@ -1010,7 +1010,7 @@ boolean CON_Responder(event_t *ev)
Lock_state(); Lock_state();
// Only add command to history if it differs from previous one // Only add command to history if it differs from previous one
if (strcmp(input.buffer, inputlines[(inputline-1) & 31])) if (!fastcmp(input.buffer, inputlines[(inputline-1) & 31]))
{ {
inputline = (inputline+1) & 31; inputline = (inputline+1) & 31;
M_TextInputInit(&input, inputlines[inputline], CON_MAXPROMPTCHARS); M_TextInputInit(&input, inputlines[inputline], CON_MAXPROMPTCHARS);
+21 -14
View File
@@ -823,7 +823,7 @@ static void resynch_read_player(resynch_pak *rsp)
P_SetThingPosition(players[i].mo); P_SetThingPosition(players[i].mo);
} }
static inline void resynch_write_ctf(resynchend_pak *rst) static void resynch_write_ctf(resynchend_pak *rst)
{ {
mobj_t *mflag; mobj_t *mflag;
UINT8 i, j; UINT8 i, j;
@@ -863,7 +863,7 @@ static inline void resynch_write_ctf(resynchend_pak *rst)
} }
} }
static inline void resynch_read_ctf(resynchend_pak *p) static void resynch_read_ctf(resynchend_pak *p)
{ {
UINT8 i; UINT8 i;
@@ -1656,12 +1656,7 @@ static void SV_SendPlayerInfo(INT32 node)
netbuffer->u.playerinfo[i].node = i; netbuffer->u.playerinfo[i].node = i;
// Can't really change this because net compatibility, but the warning is annoying strlcpy(netbuffer->u.playerinfo[i].name, (const char *)&player_names[i], MAXPLAYERNAME+1);
#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 //fetch IP address
//No, don't do that, you fuckface. //No, don't do that, you fuckface.
@@ -2179,7 +2174,7 @@ static void SL_InsertServer(serverinfo_pak* info, SINT8 node)
if (info->subversion != SUBVERSION) if (info->subversion != SUBVERSION)
return; // Close, but no cigar. return; // Close, but no cigar.
if (strcmp(info->application, SRB2APPLICATION)) if (!fastcmp(info->application, SRB2APPLICATION))
return;/* that's a different mod */ return;/* that's a different mod */
i = serverlistcount++; i = serverlistcount++;
@@ -2224,7 +2219,7 @@ void CL_QueryServerList (msg_server_t *server_list)
// thwart nefarious servers who lie to the MS. // thwart nefarious servers who lie to the MS.
/* lol bruh, that version COMES from the servers */ /* lol bruh, that version COMES from the servers */
//if (strcmp(version, server_list[i].version) == 0) //if (fastcmp(version, server_list[i].version))
{ {
INT32 node = I_NetMakeNodewPort(server_list[i].ip, server_list[i].port); INT32 node = I_NetMakeNodewPort(server_list[i].ip, server_list[i].port);
if (node == -1) if (node == -1)
@@ -3220,7 +3215,7 @@ static void Command_connect(void)
server = false; server = false;
if (!stricmp(COM_Argv(1), "self")) if (fasticmp(COM_Argv(1), "self"))
{ {
servernode = 0; servernode = 0;
server = true; server = true;
@@ -3230,7 +3225,7 @@ static void Command_connect(void)
else else
{ {
// used in menu to connect to a server in the list // used in menu to connect to a server in the list
if (netgame && !stricmp(COM_Argv(1), "node")) if (netgame && fasticmp(COM_Argv(1), "node"))
{ {
servernode = (SINT8)atoi(COM_Argv(2)); servernode = (SINT8)atoi(COM_Argv(2));
} }
@@ -3245,7 +3240,7 @@ static void Command_connect(void)
netgame = true; netgame = true;
multiplayer = true; multiplayer = true;
if (!stricmp(COM_Argv(1), "any")) if (fasticmp(COM_Argv(1), "any"))
servernode = BROADCASTADDR; servernode = BROADCASTADDR;
else if (I_NetMakeNodewPort && COM_Argc() >= 3) else if (I_NetMakeNodewPort && COM_Argc() >= 3)
servernode = I_NetMakeNodewPort(COM_Argv(1), COM_Argv(2)); servernode = I_NetMakeNodewPort(COM_Argv(1), COM_Argv(2));
@@ -3269,6 +3264,7 @@ static void Command_connect(void)
splitscreen = cv_splitplayers.value-1; splitscreen = cv_splitplayers.value-1;
SplitScreen_OnChange(); SplitScreen_OnChange();
} }
botingame = false; botingame = false;
botskin = 0; botskin = 0;
CL_ConnectToServer(); CL_ConnectToServer();
@@ -4654,11 +4650,22 @@ void SV_StopServer(void)
Y_EndIntermission(); Y_EndIntermission();
if (gamestate == GS_VOTING) if (gamestate == GS_VOTING)
Y_EndVote(); Y_EndVote();
gamestate = wipegamestate = GS_NULL;
G_SetGamestate(GS_NULL);
wipegamestate = GS_NULL;
for (i = 0; i < MAXSPLITSCREENPLAYERS; i++) for (i = 0; i < MAXSPLITSCREENPLAYERS; i++)
{
localtextcmd[i][0] = 0; 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++) for (i = firstticstosend; i < firstticstosend + BACKUPTICS; i++)
D_Clearticcmd(i); D_Clearticcmd(i);
+137 -111
View File
@@ -97,15 +97,15 @@
UINT8 window_notinfocus = false; UINT8 window_notinfocus = false;
static char *startupiwadfiles[MAX_WADFILES]; static char *startupiwadfiles[MAX_WADFILES];
static size_t startupiwadcount = 0;
static char *startuppwads[MAX_WADFILES]; static char *startuppwads[MAX_WADFILES];
static size_t startuppwadcount = 0;
// autoloading // autoloading
static char *autoloadwadfiles[MAX_WADFILES]; static char *autoloadwadfiles[MAX_WADFILES];
static char *autoloadwadfilespost[MAX_WADFILES]; static char *autoloadwadfilespost[MAX_WADFILES];
boolean autoloading; static size_t autoloadcount = 0;
boolean autoloaded; static size_t postloadcount = 0;
boolean postautoloaded = false;
boolean wasautoloaded = false;
// //
boolean devparm = false; // started game with -devparm boolean devparm = false; // started game with -devparm
@@ -113,7 +113,9 @@ boolean devparm = false; // started game with -devparm
boolean singletics = false; // timedemo boolean singletics = false; // timedemo
boolean lastdraw = false; boolean lastdraw = false;
#ifdef MOTIONBLUR
INT32 postimgparam[MAXSPLITSCREENPLAYERS]; INT32 postimgparam[MAXSPLITSCREENPLAYERS];
#endif
// These variables are only true if // These variables are only true if
// whether the respective sound system is disabled // whether the respective sound system is disabled
@@ -397,7 +399,11 @@ static void D_Renderview(void)
if (i == 0) if (i == 0)
R_ApplyViewMorph(); R_ApplyViewMorph();
#ifdef MOTIONBLUR
V_DoPostProcessor(i, postimgparam[i]); V_DoPostProcessor(i, postimgparam[i]);
#else
V_DoPostProcessor(i, 0);
#endif
} }
} }
@@ -961,8 +967,11 @@ void D_ClearState(void)
{ {
INT32 i; INT32 i;
demo.title = false;
// okay, stop now // okay, stop now
// (otherwise the game still thinks we're playing!) // (otherwise the game still thinks we're playing!)
CURLAbortFile();
SV_StopServer(); SV_StopServer();
SV_ResetServer(); SV_ResetServer();
serverlistultimatecount = 0; serverlistultimatecount = 0;
@@ -971,7 +980,10 @@ void D_ClearState(void)
CL_ClearPlayer(i); CL_ClearPlayer(i);
splitscreen = 0; splitscreen = 0;
SplitScreen_OnChange();
// recompute screen size
R_ExecuteSetViewSize();
botingame = false; botingame = false;
botskin = 0; botskin = 0;
cv_debug = 0; cv_debug = 0;
@@ -990,7 +1002,6 @@ void D_ClearState(void)
gameaction = ga_nothing; gameaction = ga_nothing;
memset(displayplayers, 0, sizeof(displayplayers)); memset(displayplayers, 0, sizeof(displayplayers));
consoleplayer = 0; consoleplayer = 0;
//demosequence = -1;
gametype = GT_RACE; // SRB2kart gametype = GT_RACE; // SRB2kart
paused = false; paused = false;
@@ -1013,6 +1024,11 @@ void D_ClearState(void)
G_SetGamestate(GS_NULL); G_SetGamestate(GS_NULL);
wipegamestate = GS_NULL; wipegamestate = GS_NULL;
M_ClearMenus(true);
// map palettes affect this
D_ResetDeviceLED();
} }
// //
@@ -1020,25 +1036,18 @@ void D_ClearState(void)
// //
void D_StartTitle(void) void D_StartTitle(void)
{ {
demo.title = false;
D_ClearState(); D_ClearState();
netgame = false; // title menu shouldnt be a netgame lmao multiplayer = netgame = false; // title menu shouldnt be a netgame or multiplayer lmao
M_ClearMenus(true);
F_StartTitleScreen(); F_StartTitleScreen();
D_ResetDeviceLED();
} }
// //
// D_AddFile // D_AddFile
// //
static void D_AddFile(const char *file, char **filearray) static void D_AddFile(const char *file, char **filearray, size_t index)
{ {
size_t pnumwadfiles;
char *newfile; char *newfile;
for (pnumwadfiles = 0; filearray[pnumwadfiles]; pnumwadfiles++)
;
newfile = malloc(strlen(file) + 1); newfile = malloc(strlen(file) + 1);
if (!newfile) if (!newfile)
{ {
@@ -1046,16 +1055,17 @@ static void D_AddFile(const char *file, char **filearray)
} }
strcpy(newfile, file); strcpy(newfile, file);
filearray[pnumwadfiles] = newfile; filearray[index] = newfile;
} }
static void D_CleanFile(char **filearray) static void D_CleanFile(char **filearray, size_t count)
{ {
size_t pnumwadfiles; size_t i;
for (pnumwadfiles = 0; filearray[pnumwadfiles]; pnumwadfiles++)
for (i = 0; i < count; i++)
{ {
free(filearray[pnumwadfiles]); free(filearray[i]);
filearray[pnumwadfiles] = NULL; filearray[i] = NULL;
} }
} }
@@ -1068,28 +1078,27 @@ static INT32 D_DetectFileType(const char* filename)
const size_t len = strlen(filename); const size_t len = strlen(filename);
if (!stricmp(&filename[len - 4], ".wad")) if (fasticmp(&filename[len - 4], ".wad"))
return 2; return 2;
else if (!stricmp(&filename[len - 4], ".pk3")) else if (fasticmp(&filename[len - 4], ".pk3"))
return 3; return 3;
else if (!stricmp(&filename[len - 5], ".kart")) else if (fasticmp(&filename[len - 5], ".kart"))
return 4; return 4;
else if (!stricmp(&filename[len - 4], ".lua")) else if (fasticmp(&filename[len - 4], ".lua"))
return 5; return 5;
else if (!stricmp(&filename[len - 4], ".soc")) else if (fasticmp(&filename[len - 4], ".soc"))
return 6; return 6;
else if (!stricmp(&filename[len - 4], ".cfg")) else if (fasticmp(&filename[len - 4], ".cfg"))
return 7; return 7;
else if (!stricmp(&filename[len - 4], ".txt")) else if (fasticmp(&filename[len - 4], ".txt"))
return 8; return 8;
return 0; return 0;
} }
// autoload that shit // autoload that shit
static void D_AutoloadFile(const char *file, char **filearray) static void D_AutoloadFile(const char *file, char **filearray, size_t index)
{ {
size_t pnumwadfiles;
char *newfile; char *newfile;
INT32 fileType = D_DetectFileType(file); INT32 fileType = D_DetectFileType(file);
@@ -1099,9 +1108,6 @@ static void D_AutoloadFile(const char *file, char **filearray)
return; return;
} }
for (pnumwadfiles = 0; filearray[pnumwadfiles]; pnumwadfiles++)
;
if (fileType <= 6) if (fileType <= 6)
{ {
newfile = malloc(strlen(file) + 1); newfile = malloc(strlen(file) + 1);
@@ -1109,7 +1115,7 @@ static void D_AutoloadFile(const char *file, char **filearray)
I_Error("No more free memory to AutoloadFile %s",file); I_Error("No more free memory to AutoloadFile %s",file);
strcpy(newfile, file); strcpy(newfile, file);
filearray[pnumwadfiles] = newfile; filearray[index] = newfile;
} }
else else
{ {
@@ -1139,42 +1145,44 @@ static void D_FindAddonsToAutoload(void)
{ {
FILE *autoloadconfigfile; FILE *autoloadconfigfile;
const char *autoloadpath; const char *autoloadpath;
char *newline;
boolean postload; boolean postload;
INT32 i;
char wadsToAutoload[256] = ""; char wadsToAutoload[256] = "";
// does it exist tho // does it exist tho
autoloadpath = va("%s"PATHSEP"%s",srb2home,AUTOLOADCONFIGFILENAME); autoloadpath = va("%s"PATHSEP"%s", srb2home, AUTOLOADCONFIGFILENAME);
autoloadconfigfile = fopen(autoloadpath, "r"); autoloadconfigfile = fopen(autoloadpath, "r");
// If the file is found, run our shit // If the file is found, run our shit
if (!autoloadconfigfile) // nope outta here if (!autoloadconfigfile) // nope outta here
{ {
wasautoloaded = postautoloaded = true; // so D_AddAutoloadFiles can skip everything since nothings there to autoload autoloadcount = postloadcount = 0; // so D_AddAutoloadFiles can skip everything since nothings there to autoload
return; return;
} }
while (fgets(wadsToAutoload, sizeof wadsToAutoload, autoloadconfigfile) != NULL) while (fgets(wadsToAutoload, sizeof(wadsToAutoload), autoloadconfigfile) != NULL)
{ {
postload = false; postload = false;
// skip if commented or empty // skip if commented or empty
if ((wadsToAutoload[1] == '\0' || wadsToAutoload[1] == '\n') if (wadsToAutoload[0] == '\n' ||
|| (wadsToAutoload[0] == '#')) wadsToAutoload[0] == '#' ||
wadsToAutoload[0] == '\0')
continue; continue;
// this marks it so that it loads after loading server addons // this marks it so that it loads after loading server addons
else if (fastncmp(wadsToAutoload, "postload ", 9)) if (fastncmp(wadsToAutoload, "postload ", 9))
{ {
strremove(wadsToAutoload, "postload "); strremove(wadsToAutoload, "postload ");
postload = true; postload = true;
} }
// Remove Any Empty or Skipped Lines // Remove Any Empty or Skipped Lines
for (i = 0; wadsToAutoload[i] != '\0'; i++) newline = strchr(wadsToAutoload, '\n');
{ if (newline)
if (wadsToAutoload[i] == '\n') *newline = '\0';
wadsToAutoload[i] = '\0';
}
if (!postload && W_CheckPostLoadList(wadsToAutoload)) if (!postload && W_CheckPostLoadList(wadsToAutoload))
{ {
@@ -1184,14 +1192,19 @@ static void D_FindAddonsToAutoload(void)
// LOAD IT // LOAD IT
if (!postload) if (!postload)
D_AutoloadFile(wadsToAutoload, autoloadwadfiles); {
else D_AutoloadFile(wadsToAutoload, autoloadwadfiles, autoloadcount);
D_AutoloadFile(wadsToAutoload, autoloadwadfilespost); autoloadcount++;
// end it here
for (i = 0; wadsToAutoload[i] != '\0'; i++)
wadsToAutoload[i] = '\0';
} }
else
{
D_AutoloadFile(wadsToAutoload, autoloadwadfilespost, postloadcount);
postloadcount++;
}
}
autoloadwadfiles[autoloadcount] = NULL;
autoloadwadfilespost[postloadcount] = NULL;
// we dont want memory leaks around here do we? // we dont want memory leaks around here do we?
fclose(autoloadconfigfile); fclose(autoloadconfigfile);
@@ -1199,41 +1212,47 @@ static void D_FindAddonsToAutoload(void)
static void D_AddAutoloadFiles(void) static void D_AddAutoloadFiles(void)
{ {
if (wasautoloaded) // nothing to autoload
if (autoloadcount == 0)
return; return;
CONS_Printf("D_AutoloadFile(): Loading autoloaded addons...\n"); CONS_Printf("D_AutoloadFile(): Loading autoloaded addons...\n");
if (W_AddAutoloadedLocalFiles(autoloadwadfiles) == 0) if (W_AddAutoloadedLocalFiles(autoloadwadfiles) == 0)
CONS_Printf("D_AutoloadFile(): Are you sure you put in valid files or what?\n"); CONS_Printf("D_AutoloadFile(): Are you sure you put in valid files or what?\n");
D_CleanFile(autoloadwadfiles);
wasautoloaded = true; D_CleanFile(autoloadwadfiles, autoloadcount);
autoloadcount = 0;
} }
void D_AddPostloadFiles(void) void D_AddPostloadFiles(void)
{ {
if (postautoloaded || !netgame) // nothing to postload
if (postloadcount == 0 || !netgame)
return; return;
CONS_Printf("D_AddPostloadFiles(): Loading postloaded addons...\n"); CONS_Printf("D_AddPostloadFiles(): Loading postloaded addons...\n");
if (W_AddAutoloadedLocalFiles(autoloadwadfilespost) == 0) if (W_AddAutoloadedLocalFiles(autoloadwadfilespost) == 0)
CONS_Printf("D_AddPostloadFiles(): Are you sure you put in valid files or what?\n"); CONS_Printf("D_AddPostloadFiles(): Are you sure you put in valid files or what?\n");
D_CleanFile(autoloadwadfilespost);
postautoloaded = true; D_CleanFile(autoloadwadfilespost, postloadcount);
postloadcount = 0;
} }
// ========================================================================== // ==========================================================================
// Identify the SRB2 version, and IWAD file to use. // Identify the SRB2 version, and IWAD file to use.
// ========================================================================== // ==========================================================================
static boolean AddIWAD(void) static boolean AddIWAD(const char * file, const char *dir)
{ {
char * path = va(pandf, srb2path, "srb2.srb"); char * path = va(pandf, dir, file);
if (FIL_ReadFileOK(path)) if (FIL_ReadFileOK(path))
{ {
D_AddFile(path, startupiwadfiles); D_AddFile(path, startupiwadfiles, startupiwadcount++);
return true; return true;
} }
@@ -1269,14 +1288,14 @@ static void IdentifyVersion(void)
} }
#if (1) // reduce the amount of findfile by only using full cwd in this func #if (1) // reduce the amount of findfile by only using full cwd in this func
if (strcmp(tempsrb2path, srb2waddir)) if (!fastcmp(tempsrb2path, srb2waddir))
#endif #endif
{ {
strlcpy(srb2path, srb2waddir, sizeof (srb2path)); strlcpy(srb2path, srb2waddir, sizeof (srb2path));
} }
// Load the IWAD // Load the IWAD
if (!AddIWAD()) if (!AddIWAD("srb2.srb", srb2path)) // not sure why this uses srb2path and not srb2waddir?
{ {
I_Error("SRB2.SRB not found! Expected in %s\n", srb2waddir); I_Error("SRB2.SRB not found! Expected in %s\n", srb2waddir);
} }
@@ -1290,57 +1309,60 @@ static void IdentifyVersion(void)
#ifdef USE_PATCH_DTA #ifdef USE_PATCH_DTA
// Add our crappy patches to fix our bugs // Add our crappy patches to fix our bugs
D_AddFile(va(pandf,srb2waddir,"patch.dta")); if (!AddIWAD("patch.dta", srb2waddir))
{
I_Error("patch.dta not found! Expected in %s\n", srb2waddir);
}
#endif #endif
if (!AddIWAD("gfx.kart", srb2waddir))
{
I_Error("gfx.kart not found! Expected in %s\n", srb2waddir);
}
D_AddFile(va(pandf, srb2waddir, "gfx.kart"), startupiwadfiles); if (!AddIWAD("textures.kart", srb2waddir))
D_AddFile(va(pandf, srb2waddir, "textures.kart"), startupiwadfiles); {
D_AddFile(va(pandf, srb2waddir, "chars.kart"), startupiwadfiles); I_Error("textures.kart not found! Expected in %s\n", srb2waddir);
D_AddFile(va(pandf, srb2waddir, "maps.kart"), startupiwadfiles); }
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);
}
#ifdef USE_PATCH_KART #ifdef USE_PATCH_KART
D_AddFile(va(pandf,srb2waddir,"patch.kart"), startupiwadfiles); if (!AddIWAD("patch.kart", srb2waddir))
{
I_Error("patch.kart not found! Expected in %s\n", srb2waddir);
}
#endif #endif
const char *path = NULL;
path = va(pandf, srb2waddir, "extra.kart");
// completely optional // completely optional
if (FIL_ReadFileOK(path)) if (AddIWAD("extra.kart", srb2waddir))
{
D_AddFile(path, startupiwadfiles);
found_extra_kart = true; found_extra_kart = true;
}
path = va(pandf, srb2waddir, "extra2.kart");
// completely optional 2: Back with a vengence // completely optional 2: Back with a vengence
if (FIL_ReadFileOK(path)) if (AddIWAD("extra2.kart", srb2waddir))
{
D_AddFile(path, startupiwadfiles);
found_extra2_kart = true; found_extra2_kart = true;
}
path = va(pandf, srb2waddir, "extra3.kart"); if (AddIWAD("extra3.kart", srb2waddir))
if (FIL_ReadFileOK(path))
{
D_AddFile(path, startupiwadfiles);
found_extra3_kart = true; found_extra3_kart = true;
}
#if !defined (HAVE_SDL) || defined (HAVE_MIXER) #if !defined (HAVE_SDL) || defined (HAVE_MIXER)
#define MUSICTEST(str) \ #define MUSICTEST(str) \
musicpath = va(pandf,srb2waddir,str);\ musicpath = va(pandf, srb2waddir, str);\
handle = W_OpenWadFile(&musicpath, false); \ handle = W_OpenWadFile(&musicpath, false); \
if (handle) \ if (handle) \
{\ { \
int ms = W_VerifyNMUSlumps(musicpath, handle, false); \ int ms = W_VerifyNMUSlumps(musicpath, handle, false); \
fclose(handle); \ fclose(handle); \
if (ms == 0) \ if (ms == 0) \
I_Error("File " str " has been modified with non-music/sound lumps"); \ I_Error("File " str " has been modified with non-music/sound lumps"); \
if (ms == 1) \ if (ms == 1) \
D_AddFile(musicpath, startupiwadfiles); \ D_AddFile(musicpath, startupiwadfiles, startupiwadcount++); \
} }
{ {
const char *musicpath; const char *musicpath;
@@ -1714,8 +1736,14 @@ void D_SRB2Main(void)
else else
{ {
// use user specific config file // use user specific config file
if (M_CheckParm("-workdir") && M_IsNextParm())
snprintf(srb2home, sizeof srb2home, "%s", M_GetNextParm());
else
#ifdef DEFAULTDIR #ifdef DEFAULTDIR
snprintf(srb2home, sizeof srb2home, "%s" PATHSEP DEFAULTDIR, userhome); snprintf(srb2home, sizeof srb2home, "%s" PATHSEP DEFAULTDIR, userhome);
#else // DEFAULTDIR
snprintf(srb2home, sizeof srb2home, "%s", userhome);
#endif // DEFAULTDIR
snprintf(downloaddir, sizeof downloaddir, "%s" PATHSEP "DOWNLOAD", srb2home); snprintf(downloaddir, sizeof downloaddir, "%s" PATHSEP "DOWNLOAD", srb2home);
if (dedicated) if (dedicated)
snprintf(configfile, sizeof configfile, "%s" PATHSEP "d"CONFIGFILENAME, srb2home); snprintf(configfile, sizeof configfile, "%s" PATHSEP "d"CONFIGFILENAME, srb2home);
@@ -1724,17 +1752,6 @@ void D_SRB2Main(void)
// can't use sprintf since there is %u in savegamename // can't use sprintf since there is %u in savegamename
strcatbf(savegamename, srb2home, PATHSEP); 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'; configfile[sizeof configfile - 1] = '\0';
@@ -1760,6 +1777,9 @@ void D_SRB2Main(void)
} }
} }
// make sure workdir exists
I_mkdir(srb2home, 0755);
// Create addons dir // Create addons dir
snprintf(addonsdir, sizeof addonsdir, "%s%s%s", srb2home, PATHSEP, "addons"); snprintf(addonsdir, sizeof addonsdir, "%s%s%s", srb2home, PATHSEP, "addons");
I_mkdir(addonsdir, 0755); I_mkdir(addonsdir, 0755);
@@ -1788,7 +1808,7 @@ void D_SRB2Main(void)
const char *s = M_GetNextParm(); const char *s = M_GetNextParm();
if (s) // Check for NULL? if (s) // Check for NULL?
D_AddFile(s, startuppwads); D_AddFile(s, startuppwads, startuppwadcount++);
} }
} }
} }
@@ -1821,8 +1841,10 @@ void D_SRB2Main(void)
// load wad, including the main wad file // load wad, including the main wad file
CONS_Printf("W_InitMultipleFiles(): Adding IWAD and main PWADs.\n"); CONS_Printf("W_InitMultipleFiles(): Adding IWAD and main PWADs.\n");
W_InitMultipleFiles(startupiwadfiles, false); W_InitMultipleFiles(startupiwadfiles, startupiwadcount, false);
D_CleanFile(startupiwadfiles); //mainwads = startupiwadcount - musicwads;
D_CleanFile(startupiwadfiles, startupiwadcount);
startupiwadcount = 0;
mainwads = 0; mainwads = 0;
#ifndef DEVELOP #ifndef DEVELOP
@@ -1861,15 +1883,16 @@ void D_SRB2Main(void)
D_CheckMaps(false); D_CheckMaps(false);
W_InitMultipleFiles(startuppwads, true); W_InitMultipleFiles(startuppwads, startuppwadcount, true);
// Only search for pwad maps if we actually have a pwad added // Only search for pwad maps if we actually have a pwad added
if (startuppwads[0] != NULL) if (startuppwadcount > 0)
{ {
D_CheckMaps(true); D_CheckMaps(true);
} }
D_CleanFile(startuppwads); D_CleanFile(startuppwads, startuppwadcount);
startuppwadcount = 0;
cht_Init(); cht_Init();
@@ -2133,11 +2156,14 @@ void D_SRB2Main(void)
const char *sskill = M_GetNextParm(); const char *sskill = M_GetNextParm();
for (j = 0; kartspeed_cons_t[j].strvalue; j++) for (j = 0; kartspeed_cons_t[j].strvalue; j++)
if (!strcasecmp(kartspeed_cons_t[j].strvalue, sskill)) {
if (fasticmp(kartspeed_cons_t[j].strvalue, sskill))
{ {
newskill = (INT16)kartspeed_cons_t[j].value; newskill = (INT16)kartspeed_cons_t[j].value;
break; break;
} }
}
if (!kartspeed_cons_t[j].strvalue) // reached end of the list with no match if (!kartspeed_cons_t[j].strvalue) // reached end of the list with no match
{ {
j = atoi(sskill); // assume they gave us a skill number, which is okay too j = atoi(sskill); // assume they gave us a skill number, which is okay too
-3
View File
@@ -61,9 +61,6 @@ extern boolean minilighticon; // mkwii-style minimap headlight
// //
// autoload stuff // autoload stuff
extern boolean autoloading;
extern boolean autoloaded;
extern boolean postautoloaded;
void D_AddPostloadFiles(void); void D_AddPostloadFiles(void);
// the infinite loop of D_SRB2Loop() called from win_main for windows version // the infinite loop of D_SRB2Loop() called from win_main for windows version
+2 -3
View File
@@ -1127,9 +1127,7 @@ boolean HGetPacket(void)
while (true) while (true)
{ {
I_NetGet(); if (!I_NetGet()) // No packets received
if (doomcom->remotenode == -1) // No packet received
return false; return false;
getbytes += packetheaderlength + doomcom->datalength; // For stat getbytes += packetheaderlength + doomcom->datalength; // For stat
@@ -1165,6 +1163,7 @@ boolean HGetPacket(void)
GotAcks(); GotAcks();
continue; continue;
} }
doomcom->datalength -= BASEPACKETSIZE; doomcom->datalength -= BASEPACKETSIZE;
break; break;
} }
+69 -48
View File
@@ -292,6 +292,10 @@ consvar_t cv_mouseturn = {"mouseturn", "Off", CV_SAVE, CV_OnOff, NULL, 0, NULL,
// Lagless camera! Yay! // Lagless camera! Yay!
consvar_t cv_laglesscam = {"lagless_camera", "Off", CV_SAVE, CV_OnOff, NULL, 0, NULL, NULL, 0, 0, NULL}; 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] = { consvar_t cv_verticallook[MAXSPLITSCREENPLAYERS] = {
{"verticallook", "On", CV_SAVE, CV_OnOff, NULL, 0, NULL, NULL, 0, 0, NULL}, {"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}, {"verticallook2", "On", CV_SAVE, CV_OnOff, NULL, 0, NULL, NULL, 0, 0, NULL},
@@ -1043,6 +1047,7 @@ void D_RegisterClientCommands(void)
CV_RegisterVar(&cv_betainterscreen); CV_RegisterVar(&cv_betainterscreen);
CV_RegisterVar(&cv_laglesscam); CV_RegisterVar(&cv_laglesscam);
CV_RegisterVar(&cv_demoangturn);
for (i = 0; i < MAXSPLITSCREENPLAYERS; i++) for (i = 0; i < MAXSPLITSCREENPLAYERS; i++)
{ {
@@ -1214,7 +1219,7 @@ static boolean EnsurePlayerNameIsGood(char *name, INT32 playernum)
for (ix = 0; ix < MAXPLAYERS; ix++) for (ix = 0; ix < MAXPLAYERS; ix++)
{ {
if (ix != playernum && playeringame[ix] if (ix != playernum && playeringame[ix]
&& strcasecmp(name, player_names[ix]) == 0) && fasticmp(name, player_names[ix]))
{ {
// We shouldn't kick people out just because // We shouldn't kick people out just because
// they joined the game with the same name // they joined the game with the same name
@@ -1331,7 +1336,7 @@ static void CleanupPlayerName(INT32 playernum, const char *newname)
for (i = 0; i < MAXPLAYERS; i++) for (i = 0; i < MAXPLAYERS; i++)
{ {
if (i != playernum && playeringame[i] if (i != playernum && playeringame[i]
&& strcasecmp(tmpname, player_names[i]) == 0) && fasticmp(tmpname, player_names[i]))
{ {
break; break;
} }
@@ -1381,7 +1386,7 @@ static void SetPlayerName(INT32 playernum, char *newname)
{ {
if (EnsurePlayerNameIsGood(newname, playernum)) if (EnsurePlayerNameIsGood(newname, playernum))
{ {
if (strcasecmp(newname, player_names[playernum]) != 0) if (!fasticmp(newname, player_names[playernum]))
{ {
if (netgame) if (netgame)
HU_AddChatText(va("\x82*%s renamed to %s", player_names[playernum], newname), false); HU_AddChatText(va("\x82*%s renamed to %s", player_names[playernum], newname), false);
@@ -1503,9 +1508,9 @@ static void SendNameAndColor(void)
CV_StealthSet(&cv_playercolor, cv_playercolor.defaultvalue); CV_StealthSet(&cv_playercolor, cv_playercolor.defaultvalue);
} }
if (!strcmp(cv_playername.string, player_names[consoleplayer]) if (fastcmp(cv_playername.string, player_names[consoleplayer])
&& cv_playercolor.value == players[consoleplayer].skincolor && cv_playercolor.value == players[consoleplayer].skincolor
&& !strcmp(cv_skin.string, skins[players[consoleplayer].skin].name)) && fastcmp(cv_skin.string, skins[players[consoleplayer].skin].name))
return; return;
// We'll handle it later if we're not playing. // We'll handle it later if we're not playing.
@@ -1940,7 +1945,7 @@ static void Got_NameAndColor(UINT8 **cp, INT32 playernum)
// set name // set name
if (player_name_changes[playernum] < MAXNAMECHANGES) if (player_name_changes[playernum] < MAXNAMECHANGES)
{ {
if (strcasecmp(player_names[playernum], name) != 0) if (!fasticmp(player_names[playernum], name))
SetPlayerName(playernum, name); SetPlayerName(playernum, name);
} }
@@ -2317,8 +2322,8 @@ static void Command_Playdemo_f(void)
CONS_Printf(M_GetText("Playing back demo '%s'.\n"), name); CONS_Printf(M_GetText("Playing back demo '%s'.\n"), name);
demo.loadfiles = strcmp(COM_Argv(2), "-addfiles") == 0; demo.loadfiles = fastcmp(COM_Argv(2), "-addfiles");
demo.ignorefiles = strcmp(COM_Argv(2), "-force") == 0; demo.ignorefiles = fastcmp(COM_Argv(2), "-force");
// Internal if no extension, external if one exists // Internal if no extension, external if one exists
// If external, convert the file name to a path in SRB2's home directory // If external, convert the file name to a path in SRB2's home directory
@@ -2487,15 +2492,18 @@ void D_SetupVote(void)
INT32 i; INT32 i;
UINT8 gt = (cv_kartgametypepreference.value == -1) ? gametype : cv_kartgametypepreference.value; UINT8 gt = (cv_kartgametypepreference.value == -1) ? gametype : cv_kartgametypepreference.value;
UINT8 secondgt = G_SometimesGetDifferentGametype(gt); 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}; INT16 luamaps[4] = {0, 0, 0, 0};
LUA_HookSetupVote(luamaps, sizeof(luamaps)/sizeof(luamaps[0]), gt, secondgt); LUA_HookSetupVote(luamaps, sizeof(luamaps)/sizeof(luamaps[0]), gt, secondgt);
// Correct secondgt if needed // Correct secondgt if needed
if (luamaps[2])
{
UINT8 typeoflevel = mapheaderinfo[luamaps[2]-1]->typeoflevel; UINT8 typeoflevel = mapheaderinfo[luamaps[2]-1]->typeoflevel;
if (luamaps[2] && (typeoflevel & G_TOLFlag(secondgt&(~0x80))) == 0) if ((typeoflevel & G_TOLFlag(secondgt&(~0x80))) == 0)
secondgt = ((typeoflevel & TOL_RACE) ? GT_RACE : GT_MATCH)|(secondgt&0x80); secondgt = ((typeoflevel & TOL_RACE) ? GT_RACE : GT_MATCH)|(secondgt&0x80);
}
if (cv_kartencore.value && gt == GT_RACE) if (cv_kartencore.value && gt == GT_RACE)
WRITEUINT8(p, (gt|0x80)); WRITEUINT8(p, (gt|0x80));
@@ -2596,14 +2604,18 @@ ConcatCommandArgv (int start, int end)
size += strlen(COM_Argv(i)) + 1; size += strlen(COM_Argv(i)) + 1;
} }
final = ZZ_Alloc(size); p = final = ZZ_Alloc(size);
p = final;
if (!p)
I_Error("ConcatCommandArgv: Out of memory!\n");
--end;/* handle the final argument separately */ --end;/* handle the final argument separately */
for (i = start; i < end; ++i) for (i = start; i < end; ++i)
{ {
p += sprintf(p, "%s ", COM_Argv(i)); p += sprintf(p, "%s ", COM_Argv(i));
} }
/* at this point "end" is actually the last argument's position */ /* at this point "end" is actually the last argument's position */
strcpy(p, COM_Argv(end)); strcpy(p, COM_Argv(end));
@@ -3182,20 +3194,20 @@ static void Command_Teamchange_f(void)
if (G_GametypeHasTeams()) if (G_GametypeHasTeams())
{ {
if (!strcasecmp(COM_Argv(1), "red") || !strcasecmp(COM_Argv(1), "1")) if (fasticmp(COM_Argv(1), "red") || fasticmp(COM_Argv(1), "1"))
NetPacket.packet.newteam = 1; NetPacket.packet.newteam = 1;
else if (!strcasecmp(COM_Argv(1), "blue") || !strcasecmp(COM_Argv(1), "2")) else if (fasticmp(COM_Argv(1), "blue") || fasticmp(COM_Argv(1), "2"))
NetPacket.packet.newteam = 2; NetPacket.packet.newteam = 2;
else if (!strcasecmp(COM_Argv(1), "spectator") || !strcasecmp(COM_Argv(1), "0")) else if (fasticmp(COM_Argv(1), "spectator") || fasticmp(COM_Argv(1), "0"))
NetPacket.packet.newteam = 0; NetPacket.packet.newteam = 0;
else else
error = true; error = true;
} }
else if (G_GametypeHasSpectators()) else if (G_GametypeHasSpectators())
{ {
if (!strcasecmp(COM_Argv(1), "spectator") || !strcasecmp(COM_Argv(1), "0")) if (fasticmp(COM_Argv(1), "spectator") || fasticmp(COM_Argv(1), "0"))
NetPacket.packet.newteam = 0; NetPacket.packet.newteam = 0;
else if (!strcasecmp(COM_Argv(1), "playing") || !strcasecmp(COM_Argv(1), "1")) else if (fasticmp(COM_Argv(1), "playing") || fasticmp(COM_Argv(1), "1"))
NetPacket.packet.newteam = 3; NetPacket.packet.newteam = 3;
else else
error = true; error = true;
@@ -3272,20 +3284,20 @@ static void Command_Teamchange2_f(void)
if (G_GametypeHasTeams()) if (G_GametypeHasTeams())
{ {
if (!strcasecmp(COM_Argv(1), "red") || !strcasecmp(COM_Argv(1), "1")) if (fasticmp(COM_Argv(1), "red") || fasticmp(COM_Argv(1), "1"))
NetPacket.packet.newteam = 1; NetPacket.packet.newteam = 1;
else if (!strcasecmp(COM_Argv(1), "blue") || !strcasecmp(COM_Argv(1), "2")) else if (fasticmp(COM_Argv(1), "blue") || fasticmp(COM_Argv(1), "2"))
NetPacket.packet.newteam = 2; NetPacket.packet.newteam = 2;
else if (!strcasecmp(COM_Argv(1), "spectator") || !strcasecmp(COM_Argv(1), "0")) else if (fasticmp(COM_Argv(1), "spectator") || fasticmp(COM_Argv(1), "0"))
NetPacket.packet.newteam = 0; NetPacket.packet.newteam = 0;
else else
error = true; error = true;
} }
else if (G_GametypeHasSpectators()) else if (G_GametypeHasSpectators())
{ {
if (!strcasecmp(COM_Argv(1), "spectator") || !strcasecmp(COM_Argv(1), "0")) if (fasticmp(COM_Argv(1), "spectator") || fasticmp(COM_Argv(1), "0"))
NetPacket.packet.newteam = 0; NetPacket.packet.newteam = 0;
else if (!strcasecmp(COM_Argv(1), "playing") || !strcasecmp(COM_Argv(1), "1")) else if (fasticmp(COM_Argv(1), "playing") || fasticmp(COM_Argv(1), "1"))
NetPacket.packet.newteam = 3; NetPacket.packet.newteam = 3;
else else
error = true; error = true;
@@ -3363,20 +3375,20 @@ static void Command_Teamchange3_f(void)
if (G_GametypeHasTeams()) if (G_GametypeHasTeams())
{ {
if (!strcasecmp(COM_Argv(1), "red") || !strcasecmp(COM_Argv(1), "1")) if (fasticmp(COM_Argv(1), "red") || fasticmp(COM_Argv(1), "1"))
NetPacket.packet.newteam = 1; NetPacket.packet.newteam = 1;
else if (!strcasecmp(COM_Argv(1), "blue") || !strcasecmp(COM_Argv(1), "2")) else if (fasticmp(COM_Argv(1), "blue") || fasticmp(COM_Argv(1), "2"))
NetPacket.packet.newteam = 2; NetPacket.packet.newteam = 2;
else if (!strcasecmp(COM_Argv(1), "spectator") || !strcasecmp(COM_Argv(1), "0")) else if (fasticmp(COM_Argv(1), "spectator") || fasticmp(COM_Argv(1), "0"))
NetPacket.packet.newteam = 0; NetPacket.packet.newteam = 0;
else else
error = true; error = true;
} }
else if (G_GametypeHasSpectators()) else if (G_GametypeHasSpectators())
{ {
if (!strcasecmp(COM_Argv(1), "spectator") || !strcasecmp(COM_Argv(1), "0")) if (fasticmp(COM_Argv(1), "spectator") || fasticmp(COM_Argv(1), "0"))
NetPacket.packet.newteam = 0; NetPacket.packet.newteam = 0;
else if (!strcasecmp(COM_Argv(1), "playing") || !strcasecmp(COM_Argv(1), "1")) else if (fasticmp(COM_Argv(1), "playing") || fasticmp(COM_Argv(1), "1"))
NetPacket.packet.newteam = 3; NetPacket.packet.newteam = 3;
else else
error = true; error = true;
@@ -3454,20 +3466,20 @@ static void Command_Teamchange4_f(void)
if (G_GametypeHasTeams()) if (G_GametypeHasTeams())
{ {
if (!strcasecmp(COM_Argv(1), "red") || !strcasecmp(COM_Argv(1), "1")) if (fasticmp(COM_Argv(1), "red") || fasticmp(COM_Argv(1), "1"))
NetPacket.packet.newteam = 1; NetPacket.packet.newteam = 1;
else if (!strcasecmp(COM_Argv(1), "blue") || !strcasecmp(COM_Argv(1), "2")) else if (fasticmp(COM_Argv(1), "blue") || fasticmp(COM_Argv(1), "2"))
NetPacket.packet.newteam = 2; NetPacket.packet.newteam = 2;
else if (!strcasecmp(COM_Argv(1), "spectator") || !strcasecmp(COM_Argv(1), "0")) else if (fasticmp(COM_Argv(1), "spectator") || fasticmp(COM_Argv(1), "0"))
NetPacket.packet.newteam = 0; NetPacket.packet.newteam = 0;
else else
error = true; error = true;
} }
else if (G_GametypeHasSpectators()) else if (G_GametypeHasSpectators())
{ {
if (!strcasecmp(COM_Argv(1), "spectator") || !strcasecmp(COM_Argv(1), "0")) if (fasticmp(COM_Argv(1), "spectator") || fasticmp(COM_Argv(1), "0"))
NetPacket.packet.newteam = 0; NetPacket.packet.newteam = 0;
else if (!strcasecmp(COM_Argv(1), "playing") || !strcasecmp(COM_Argv(1), "1")) else if (fasticmp(COM_Argv(1), "playing") || fasticmp(COM_Argv(1), "1"))
NetPacket.packet.newteam = 3; NetPacket.packet.newteam = 3;
else else
error = true; error = true;
@@ -3553,33 +3565,33 @@ static void Command_ServerTeamChange_f(void)
if (G_TagGametype()) if (G_TagGametype())
{ {
if (!strcasecmp(COM_Argv(2), "it") || !strcasecmp(COM_Argv(2), "1")) if (fasticmp(COM_Argv(2), "it") || fasticmp(COM_Argv(2), "1"))
NetPacket.packet.newteam = 1; NetPacket.packet.newteam = 1;
else if (!strcasecmp(COM_Argv(2), "notit") || !strcasecmp(COM_Argv(2), "2")) else if (fasticmp(COM_Argv(2), "notit") || fasticmp(COM_Argv(2), "2"))
NetPacket.packet.newteam = 2; NetPacket.packet.newteam = 2;
else if (!strcasecmp(COM_Argv(2), "playing") || !strcasecmp(COM_Argv(2), "3")) else if (fasticmp(COM_Argv(2), "playing") || fasticmp(COM_Argv(2), "3"))
NetPacket.packet.newteam = 3; NetPacket.packet.newteam = 3;
else if (!strcasecmp(COM_Argv(2), "spectator") || !strcasecmp(COM_Argv(2), "0")) else if (fasticmp(COM_Argv(2), "spectator") || fasticmp(COM_Argv(2), "0"))
NetPacket.packet.newteam = 0; NetPacket.packet.newteam = 0;
else else
error = true; error = true;
} }
else if (G_GametypeHasTeams()) else if (G_GametypeHasTeams())
{ {
if (!strcasecmp(COM_Argv(2), "red") || !strcasecmp(COM_Argv(2), "1")) if (fasticmp(COM_Argv(2), "red") || fasticmp(COM_Argv(2), "1"))
NetPacket.packet.newteam = 1; NetPacket.packet.newteam = 1;
else if (!strcasecmp(COM_Argv(2), "blue") || !strcasecmp(COM_Argv(2), "2")) else if (fasticmp(COM_Argv(2), "blue") || fasticmp(COM_Argv(2), "2"))
NetPacket.packet.newteam = 2; NetPacket.packet.newteam = 2;
else if (!strcasecmp(COM_Argv(2), "spectator") || !strcasecmp(COM_Argv(2), "0")) else if (fasticmp(COM_Argv(2), "spectator") || fasticmp(COM_Argv(2), "0"))
NetPacket.packet.newteam = 0; NetPacket.packet.newteam = 0;
else else
error = true; error = true;
} }
else if (G_GametypeHasSpectators()) else if (G_GametypeHasSpectators())
{ {
if (!strcasecmp(COM_Argv(2), "spectator") || !strcasecmp(COM_Argv(2), "0")) if (fasticmp(COM_Argv(2), "spectator") || fasticmp(COM_Argv(2), "0"))
NetPacket.packet.newteam = 0; NetPacket.packet.newteam = 0;
else if (!strcasecmp(COM_Argv(2), "playing") || !strcasecmp(COM_Argv(2), "1")) else if (fasticmp(COM_Argv(2), "playing") || fasticmp(COM_Argv(2), "1"))
NetPacket.packet.newteam = 3; NetPacket.packet.newteam = 3;
else else
error = true; error = true;
@@ -4214,23 +4226,32 @@ static void Command_MotD_f(void)
mymotd = Z_Malloc(sizeof(motd), PU_STATIC, NULL); mymotd = Z_Malloc(sizeof(motd), PU_STATIC, NULL);
strlcpy(mymotd, COM_Argv(1), sizeof motd); 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));
for (i = 2; i < j; i++) for (i = 2; i < j; i++)
{ {
strlcat(mymotd, " ", sizeof motd); strlcat(mymotd, " ", sizeof(motd));
strlcat(mymotd, COM_Argv(i), sizeof motd); strlcat(mymotd, COM_Argv(i), sizeof(motd));
} }
// Disallow non-printing characters and semicolons. // Disallow non-printing characters and semicolons.
for (i = 0; mymotd[i] != '\0'; i++) for (i = 0; mymotd[i] != '\0'; i++)
{
if (!isprint(mymotd[i]) || mymotd[i] == ';') if (!isprint(mymotd[i]) || mymotd[i] == ';')
{ {
Z_Free(mymotd); Z_Free(mymotd);
return; return;
} }
}
if ((netgame || multiplayer) && client) if ((netgame || multiplayer) && client)
{
SendNetXCmd(XD_SETMOTD, mymotd, i); // send the actual size of the motd string, not the full buffer's size SendNetXCmd(XD_SETMOTD, mymotd, i); // send the actual size of the motd string, not the full buffer's size
}
else else
{ {
strcpy(motd, mymotd); strcpy(motd, mymotd);
@@ -4429,7 +4450,7 @@ static void Command_Addfile(void)
} }
// Add file on your client directly if it is trivial, or you aren't in a netgame. // Add file on your client directly if it is trivial, or you aren't in a netgame.
if (!(netgame || multiplayer) || musiconly) if (!netgame || musiconly)
{ {
P_AddWadFile(fn, false); P_AddWadFile(fn, false);
return; return;
@@ -4472,7 +4493,7 @@ static void Command_Addfile(void)
if (IsPlayerAdmin(consoleplayer) && (!server)) // Request to add file if (IsPlayerAdmin(consoleplayer) && (!server)) // Request to add file
SendNetXCmd(XD_REQADDFILE, buf, buf_p - buf); SendNetXCmd(XD_REQADDFILE, buf, buf_p - buf);
else else
SendNetXCmd(XD_ADDFILE, buf, buf_p - buf);; SendNetXCmd(XD_ADDFILE, buf, buf_p - buf);
} }
/** Adds something at runtime. /** Adds something at runtime.
@@ -5188,14 +5209,14 @@ static void Ringslinger_OnChange(void)
static void Gravity_OnChange(void) static void Gravity_OnChange(void)
{ {
if (!M_SecretUnlocked(SECRET_PANDORA) && !netgame && !cv_debug if (!M_SecretUnlocked(SECRET_PANDORA) && !netgame && !cv_debug
&& strcmp(cv_gravity.string, cv_gravity.defaultvalue)) && !fastcmp(cv_gravity.string, cv_gravity.defaultvalue))
{ {
CONS_Printf(M_GetText("You haven't earned this yet.\n")); CONS_Printf(M_GetText("You haven't earned this yet.\n"));
CV_StealthSet(&cv_gravity, cv_gravity.defaultvalue); CV_StealthSet(&cv_gravity, cv_gravity.defaultvalue);
return; return;
} }
#ifndef NETGAME_GRAVITY #ifndef NETGAME_GRAVITY
if(netgame) if (netgame)
{ {
CV_StealthSet(&cv_gravity, cv_gravity.defaultvalue); CV_StealthSet(&cv_gravity, cv_gravity.defaultvalue);
return; return;
+2
View File
@@ -209,6 +209,8 @@ extern consvar_t cv_betainterscreen;
extern consvar_t cv_laglesscam; extern consvar_t cv_laglesscam;
extern consvar_t cv_demoangturn;
typedef enum typedef enum
{ {
SKINMENUTYPE_SCROLL = 0, SKINMENUTYPE_SCROLL = 0,
+17 -16
View File
@@ -550,7 +550,8 @@ INT32 CL_CheckFiles(void)
for (j = mainwads+1; j < numwadfiles; j++) for (j = mainwads+1; j < numwadfiles; j++)
{ {
nameonly(strcpy(wadfilename, wadfiles[j]->filename)); nameonly(strcpy(wadfilename, wadfiles[j]->filename));
if (!stricmp(wadfilename, fileneeded[i].filename) &&
if (fasticmp(wadfilename, fileneeded[i].filename) &&
!memcmp(wadfiles[j]->md5sum, fileneeded[i].md5sum, 16)) !memcmp(wadfiles[j]->md5sum, fileneeded[i].md5sum, 16))
{ {
CONS_Debug(DBG_NETPLAY, "already loaded\n"); CONS_Debug(DBG_NETPLAY, "already loaded\n");
@@ -665,7 +666,7 @@ static boolean SV_SendFile(INT32 node, const char *filename, UINT8 fileid)
strlcpy(wadfilename, wadfiles[wadnum]->filename, MAX_WADPATH); strlcpy(wadfilename, wadfiles[wadnum]->filename, MAX_WADPATH);
nameonly(wadfilename); nameonly(wadfilename);
if (!stricmp(wadfilename, p->id.filename)) if (fasticmp(wadfilename, p->id.filename))
{ {
// Copy file name with full path // Copy file name with full path
strlcpy(p->id.filename, wadfiles[wadnum]->filename, MAX_WADPATH); strlcpy(p->id.filename, wadfiles[wadnum]->filename, MAX_WADPATH);
@@ -946,17 +947,17 @@ void Got_Filetxpak(void)
char *filename = file->filename; char *filename = file->filename;
static INT32 filetime = 0; static INT32 filetime = 0;
if (!(strcmp(filename, "srb2.srb") if ((fastcmp(filename, "srb2.srb")
//&& strcmp(filename, "srb2.wad") //|| fastcmp(filename, "srb2.wad")
//&& strcmp(filename, "patch.dta") //|| fastcmp(filename, "patch.dta")
//&& strcmp(filename, "music.dta") //|| fastcmp(filename, "music.dta")
&& strcmp(filename, "gfx.kart") || fastcmp(filename, "gfx.kart")
&& strcmp(filename, "textures.kart") || fastcmp(filename, "textures.kart")
&& strcmp(filename, "chars.kart") || fastcmp(filename, "chars.kart")
&& strcmp(filename, "maps.kart") || fastcmp(filename, "maps.kart")
&& strcmp(filename, "sounds.kart") || fastcmp(filename, "sounds.kart")
&& strcmp(filename, "music.kart") || fastcmp(filename, "music.kart")
&& strcmp(filename, "patch.kart") || fastcmp(filename, "patch.kart")
)) ))
I_Error("Tried to download \"%s\"", filename); I_Error("Tried to download \"%s\"", filename);
@@ -1197,7 +1198,7 @@ filestatus_t findfile(char *filename, const UINT8 *wantedmd5sum, boolean complet
} }
// next, check SRB2's "home" directory (if non-'.') // next, check SRB2's "home" directory (if non-'.')
if (strcmp(srb2home, ".")) if (!fastcmp(srb2home, "."))
{ {
homecheck = filesearch(filename, srb2home, wantedmd5sum, completepath, 10); homecheck = filesearch(filename, srb2home, wantedmd5sum, completepath, 10);
@@ -1209,7 +1210,7 @@ filestatus_t findfile(char *filename, const UINT8 *wantedmd5sum, boolean complet
} }
// next, check SRB2's "path" directory (also if non-'.') // next, check SRB2's "path" directory (also if non-'.')
if (strcmp(srb2path, ".")) if (!fastcmp(srb2path, "."))
{ {
homecheck = filesearch(filename, srb2path, wantedmd5sum, completepath, 10); homecheck = filesearch(filename, srb2path, wantedmd5sum, completepath, 10);
@@ -1554,7 +1555,7 @@ CURLGetLogin (const char *url, HTTP_login ***return_prev_next)
( login = (*prev_next)); ( login = (*prev_next));
prev_next = &login->next prev_next = &login->next
){ ){
if (strcmp(login->url, url) == 0) if (fastcmp(login->url, url) != 0)
{ {
if (return_prev_next) if (return_prev_next)
(*return_prev_next) = prev_next; (*return_prev_next) = prev_next;
+2 -2
View File
@@ -211,12 +211,12 @@ void D_SetupProtocol(void)
if (result) if (result)
{ {
if (strcmp(buffer, "no") == 0) if (!fastcmp(buffer, "no"))
{ {
fclose(fp); fclose(fp);
return; return;
} }
else if (strcmp(buffer, exe_path) != 0) else if (fastcmp(buffer, exe_path))
{ {
// overwrite // overwrite
fclose(fp); fclose(fp);
+3 -3
View File
@@ -1442,7 +1442,7 @@ static INT32 errorcount = 0;
*/ */
static boolean shutdowning = false; static boolean shutdowning = false;
void I_Error(const char *error, ...) FUNCIERROR void ATTRNORETURN I_Error(const char *error, ...)
{ {
va_list argptr; va_list argptr;
char buffer[8192]; char buffer[8192];
@@ -1709,9 +1709,9 @@ char *I_GetUserName(void)
strncpy(username, p, MAXPLAYERNAME); strncpy(username, p, MAXPLAYERNAME);
} }
if (!fastcmp(username, ""))
if (strcmp(username, "") != 0)
return username; return username;
return NULL; // dummy for platform independent version return NULL; // dummy for platform independent version
} }
+3 -3
View File
@@ -277,7 +277,7 @@ static void DRPC_HandleJoinRequest(const DiscordUser *requestUser)
while (append != NULL) while (append != NULL)
{ {
// CHECK FOR DUPES!! Ignore any that already exist from the same user. // CHECK FOR DUPES!! Ignore any that already exist from the same user.
if (!strcmp(newRequest->userID, append->userID)) if (fastcmp(newRequest->userID, append->userID))
{ {
Discord_Respond(newRequest->userID, DISCORD_REPLY_IGNORE); Discord_Respond(newRequest->userID, DISCORD_REPLY_IGNORE);
DRPC_RemoveRequest(newRequest); DRPC_RemoveRequest(newRequest);
@@ -419,7 +419,7 @@ static const char *DRPC_GetServerIP(void)
// If you're connected // If you're connected
if (I_GetNodeAddress && (address = I_GetNodeAddress(servernode)) != NULL) if (I_GetNodeAddress && (address = I_GetNodeAddress(servernode)) != NULL)
{ {
if (strcmp(address, "self")) if (!fastcmp(address, "self"))
{ {
// We're not the server, so we could successfully get the IP! // We're not the server, so we could successfully get the IP!
// No need to do anything else :) // No need to do anything else :)
@@ -684,7 +684,7 @@ void DRPC_UpdatePresence(void)
// Character image // Character image
while (supportedSkins[checkSkin] != NULL) while (supportedSkins[checkSkin] != NULL)
{ {
if (!strcmp(skins[players[consoleplayer].skin].name, supportedSkins[checkSkin])) if (fastcmp(skins[players[consoleplayer].skin].name, supportedSkins[checkSkin]))
{ {
snprintf(charimg, 21, "char%s", supportedSkins[checkSkin]); snprintf(charimg, 21, "char%s", supportedSkins[checkSkin]);
discordPresence.smallImageKey = charimg; discordPresence.smallImageKey = charimg;
+4
View File
@@ -69,6 +69,8 @@ extern "C" {
#include <sys/stat.h> #include <sys/stat.h>
#include <ctype.h> #include <ctype.h>
#include "fastcmp.h"
#ifdef _WIN32 #ifdef _WIN32
#include <io.h> #include <io.h>
#endif #endif
@@ -651,7 +653,9 @@ extern const char *compdate, *comptime, *comprevision, *compbranch;
#if defined (HAVE_CURL) #if defined (HAVE_CURL)
#define MASTERSERVER #define MASTERSERVER
#ifndef NOHOLEPUNCH
#define HOLEPUNCH #define HOLEPUNCH
#endif
#else #else
#undef UPDATE_ALERT #undef UPDATE_ALERT
#endif #endif
+3
View File
@@ -116,7 +116,10 @@ extern UINT8 window_notinfocus; // are we in focus? (backend independant -- hand
extern boolean nodrawers; extern boolean nodrawers;
extern boolean noblit; extern boolean noblit;
extern boolean lastdraw; extern boolean lastdraw;
#ifdef MOTIONBLUR
extern INT32 postimgparam[MAXSPLITSCREENPLAYERS]; extern INT32 postimgparam[MAXSPLITSCREENPLAYERS];
#endif
extern INT32 viewwindowx, viewwindowy; extern INT32 viewwindowx, viewwindowy;
extern INT32 viewwidth; extern INT32 viewwidth;
+1
View File
@@ -963,6 +963,7 @@ void F_StartTitleScreen(void)
finalecount = 0; finalecount = 0;
else else
wipegamestate = GS_TITLESCREEN; wipegamestate = GS_TITLESCREEN;
G_SetGamestate(GS_TITLESCREEN); G_SetGamestate(GS_TITLESCREEN);
CON_ClearHUD(); CON_ClearHUD();
+12 -12
View File
@@ -198,7 +198,7 @@ filestatus_t filesearch(char *filename, const char *startpath, const UINT8 *want
for (; *path != NULL; path++) for (; *path != NULL; path++)
{ {
if (strcasecmp(*path, dent->d_name) == 0) if (fasticmp(*path, dent->d_name))
{ {
skipfolder = true; skipfolder = true;
break; break;
@@ -212,7 +212,7 @@ filestatus_t filesearch(char *filename, const char *startpath, const UINT8 *want
} }
} }
if (strcasecmp(".git", dent->d_name) // sanity if you're weird like me if (!fasticmp(".git", dent->d_name) // sanity if you're weird like me
&& (dirhandle[depthleft-1] = opendir(searchpath)) != NULL) && (dirhandle[depthleft-1] = opendir(searchpath)) != NULL)
{ {
// Got read permissions! // Got read permissions!
@@ -227,7 +227,7 @@ filestatus_t filesearch(char *filename, const char *startpath, const UINT8 *want
// I am a file! // I am a file!
if (strcasecmp(searchname, dent->d_name)) if (!fasticmp(searchname, dent->d_name))
continue; // Not what we're looking for! continue; // Not what we're looking for!
switch (checkfilemd5(searchpath, wantedmd5sum)) switch (checkfilemd5(searchpath, wantedmd5sum))
@@ -353,7 +353,7 @@ void searchfilemenu(char *tempname)
{ {
for (i = first; i < sizedirmenu; i++) for (i = first; i < sizedirmenu; i++)
{ {
if (!strcmp(dirmenu[i]+DIR_STRING, tempname)) if (fastcmp(dirmenu[i]+DIR_STRING, tempname))
{ {
dir_on[menudepthleft] = i; dir_on[menudepthleft] = i;
break; break;
@@ -400,7 +400,7 @@ void searchfilemenu(char *tempname)
{ {
if (filemenucmp(coredirmenu[i]+DIR_STRING, localmenusearch)) if (filemenucmp(coredirmenu[i]+DIR_STRING, localmenusearch))
{ {
if (tempname && !strcmp(coredirmenu[i]+DIR_STRING, tempname)) if (tempname && fastcmp(coredirmenu[i]+DIR_STRING, tempname))
{ {
dir_on[menudepthleft] = sizedirmenu; dir_on[menudepthleft] = sizedirmenu;
Z_Free(tempname); Z_Free(tempname);
@@ -478,14 +478,14 @@ boolean preparefilemenu(boolean samedepth, boolean replayhut)
if (replayhut) if (replayhut)
{ {
if (strcasecmp(".lmp", dent->d_name+len-5)) if (!fasticmp(".lmp", dent->d_name+len-5))
continue; // Not a replay continue; // Not a replay
} }
else if (!cv_addons_showall.value) else if (!cv_addons_showall.value)
{ {
UINT8 ext; UINT8 ext;
for (ext = 0; ext < NUM_EXT_TABLE; ext++) for (ext = 0; ext < NUM_EXT_TABLE; ext++)
if (!strcasecmp(exttable[ext]+1, dent->d_name+len-(exttable[ext][0]))) if (fasticmp(exttable[ext]+1, dent->d_name+len-(exttable[ext][0])))
break; // extension comparison break; // extension comparison
if (ext == NUM_EXT_TABLE) if (ext == NUM_EXT_TABLE)
@@ -559,7 +559,7 @@ boolean preparefilemenu(boolean samedepth, boolean replayhut)
if (replayhut) if (replayhut)
{ {
if (strcasecmp(".lmp", dent->d_name+len-5)) if (!fasticmp(".lmp", dent->d_name+len-5))
continue; // Not a replay continue; // Not a replay
ext = EXT_TXT; // This isn't used anywhere but better safe than sorry for messing with this... ext = EXT_TXT; // This isn't used anywhere but better safe than sorry for messing with this...
@@ -567,7 +567,7 @@ boolean preparefilemenu(boolean samedepth, boolean replayhut)
else else
{ {
for (; ext < NUM_EXT_TABLE; ext++) for (; ext < NUM_EXT_TABLE; ext++)
if (!strcasecmp(exttable[ext]+1, dent->d_name+len-(exttable[ext][0]))) if (fasticmp(exttable[ext]+1, dent->d_name+len-(exttable[ext][0])))
break; // extension comparison break; // extension comparison
if (ext == NUM_EXT_TABLE && !cv_addons_showall.value) if (ext == NUM_EXT_TABLE && !cv_addons_showall.value)
@@ -587,7 +587,7 @@ boolean preparefilemenu(boolean samedepth, boolean replayhut)
nameonly(filenamebuf[i]); nameonly(filenamebuf[i]);
} }
if (strcmp(dent->d_name, filenamebuf[i])) if (!fastcmp(dent->d_name, filenamebuf[i]))
continue; continue;
if (cv_addons_md5.value && !checkfilemd5(menupath, wadfiles[i]->md5sum)) if (cv_addons_md5.value && !checkfilemd5(menupath, wadfiles[i]->md5sum))
@@ -598,11 +598,11 @@ boolean preparefilemenu(boolean samedepth, boolean replayhut)
} }
else if (ext == EXT_TXT) else if (ext == EXT_TXT)
{ {
if (!strncmp(dent->d_name, "log-", 4) || !strcmp(dent->d_name, "errorlog.txt")) if (!strncmp(dent->d_name, "log-", 4) || fastcmp(dent->d_name, "errorlog.txt"))
ext |= EXT_LOADED; ext |= EXT_LOADED;
} }
if (!strcmp(dent->d_name, configfile)) if (fastcmp(dent->d_name, configfile))
ext |= EXT_LOADED; ext |= EXT_LOADED;
} }
+222 -155
View File
File diff suppressed because it is too large. Load diff
+12 -5
View File
@@ -2768,7 +2768,7 @@ INT32 G_GetGametypeByName(const char *gametypestr)
INT32 i; INT32 i;
for (i = 0; i < NUMGAMETYPES; i++) for (i = 0; i < NUMGAMETYPES; i++)
if (!stricmp(gametypestr, Gametype_Names[i])) if (fasticmp(gametypestr, Gametype_Names[i]))
return i; return i;
return -1; // unknown gametype return -1; // unknown gametype
@@ -3463,7 +3463,8 @@ void G_LoadGameData(void)
if (READUINT32(save.p) != 0xFCAFE211) if (READUINT32(save.p) != 0xFCAFE211)
{ {
const char *gdfolder = "the SRB2Kart folder"; const char *gdfolder = "the SRB2Kart folder";
if (strcmp(srb2home,"."))
if (!fastcmp(srb2home,"."))
gdfolder = srb2home; gdfolder = srb2home;
Z_Free(save.buffer); Z_Free(save.buffer);
@@ -3547,7 +3548,8 @@ void G_LoadGameData(void)
datacorrupt: datacorrupt:
{ {
const char *gdfolder = "the SRB2Kart folder"; const char *gdfolder = "the SRB2Kart folder";
if (strcmp(srb2home,"."))
if (!fastcmp(srb2home,"."))
gdfolder = srb2home; gdfolder = srb2home;
Z_Free(save.buffer); Z_Free(save.buffer);
@@ -3758,7 +3760,8 @@ void G_LoadGame(UINT32 slot, INT16 mapoverride)
memset(vcheck, 0, sizeof (vcheck)); memset(vcheck, 0, sizeof (vcheck));
sprintf(vcheck, "version %d", VERSION); sprintf(vcheck, "version %d", VERSION);
if (strcmp((const char *)save.p, (const char *)vcheck))
if (!fastcmp((const char *)save.p, (const char *)vcheck))
{ {
#ifdef SAVEGAME_OTHERVERSIONS #ifdef SAVEGAME_OTHERVERSIONS
M_StartMessage(M_GetText("Save game from different version.\nYou can load this savegame, but\nsaving afterwards will be disabled.\n\nDo you want to continue anyway?\n\n(Press 'Y' to confirm)\n"), M_StartMessage(M_GetText("Save game from different version.\nYou can load this savegame, but\nsaving afterwards will be disabled.\n\nDo you want to continue anyway?\n\n(Press 'Y' to confirm)\n"),
@@ -4036,7 +4039,7 @@ char *G_BuildMapTitle(INT32 mapnum)
if (!mapheaderinfo[mapnum-1]) if (!mapheaderinfo[mapnum-1])
P_AllocMapHeader(mapnum-1); P_AllocMapHeader(mapnum-1);
if (strcmp(mapheaderinfo[mapnum-1]->lvlttl, "")) if (!fastcmp(mapheaderinfo[mapnum-1]->lvlttl, ""))
{ {
size_t len = 1; size_t len = 1;
const char *zonetext = NULL; const char *zonetext = NULL;
@@ -4061,7 +4064,11 @@ char *G_BuildMapTitle(INT32 mapnum)
title = Z_Malloc(len, PU_STATIC, NULL); title = Z_Malloc(len, PU_STATIC, NULL);
if (!title)
return NULL;
sprintf(title, "%s", mapheaderinfo[mapnum-1]->lvlttl); sprintf(title, "%s", mapheaderinfo[mapnum-1]->lvlttl);
if (zonetext) sprintf(title + strlen(title), " %s", zonetext); if (zonetext) sprintf(title + strlen(title), " %s", zonetext);
if (actnum) sprintf(title + strlen(title), " %s", actnum); if (actnum) sprintf(title + strlen(title), " %s", actnum);
} }
+4 -3
View File
@@ -1033,7 +1033,7 @@ INT32 G_KeyStringtoNum(const char *keystr)
return atoi(&keystr[3]); return atoi(&keystr[3]);
for (j = 0; j < NUMKEYNAMES; j++) for (j = 0; j < NUMKEYNAMES; j++)
if (!stricmp(keynames[j].name, keystr)) if (fasticmp(keynames[j].name, keystr))
return keynames[j].keynum; return keynames[j].keynum;
return 0; return 0;
@@ -1333,14 +1333,15 @@ static void setcontrol(INT32 (*gc)[2])
player = 0; player = 0;
namectrl = COM_Argv(1); namectrl = COM_Argv(1);
for (numctrl = 0; numctrl < num_gamecontrols && stricmp(namectrl, gamecontrolname[numctrl]); for (numctrl = 0; numctrl < num_gamecontrols && !fasticmp(namectrl, gamecontrolname[numctrl]); numctrl++)
numctrl++)
; ;
if (numctrl == num_gamecontrols) if (numctrl == num_gamecontrols)
{ {
CONS_Printf(M_GetText("Control '%s' unknown\n"), namectrl); CONS_Printf(M_GetText("Control '%s' unknown\n"), namectrl);
return; return;
} }
keynum1 = G_KeyStringtoNum(COM_Argv(2)); keynum1 = G_KeyStringtoNum(COM_Argv(2));
keynum2 = G_KeyStringtoNum(COM_Argv(3)); keynum2 = G_KeyStringtoNum(COM_Argv(3));
keynum = G_FilterKeyByVersion(numctrl, 0, player, &keynum1, &keynum2, &nestedoverride); keynum = G_FilterKeyByVersion(numctrl, 0, player, &keynum1, &keynum2, &nestedoverride);
+26 -21
View File
@@ -437,8 +437,16 @@ void HWR_MakePatch(const patch_t *patch, GLPatch_t *glPatch, GLMipmap_t *glMipma
// CACHING HANDLING // 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 size_t gl_numtextures = 0; // Texture count
static GLMapTexture_t *gl_textures; // For all textures static GLMapTextureSet_t *gl_textures; // For all textures
static void HWR_FreeTextureData(patch_t *patch) static void HWR_FreeTextureData(patch_t *patch)
{ {
@@ -578,13 +586,12 @@ void HWR_FreeMapTextures(void)
{ {
size_t i; size_t i;
#ifdef GLENCORE
for (i = 0; i < gl_numtextures*2; i++)
#else
for (i = 0; i < gl_numtextures; i++) for (i = 0; i < gl_numtextures; i++)
#endif
{ {
FreeMapTexture(&gl_textures[i]); FreeMapTexture(&gl_textures[i].normal);
#ifdef GLENCORE
FreeMapTexture(&gl_textures[i].encore);
#endif
} }
// now the heap don't have any 'user' pointing to our // now the heap don't have any 'user' pointing to our
@@ -603,7 +610,7 @@ static void HWR_PrecacheLevelFlats(void)
// special case for encore // special case for encore
#ifdef GLENCORE #ifdef GLENCORE
if (encoremode) if (encoremap)
{ {
// go through all sectors to determine if it should be remapped for encore // go through all sectors to determine if it should be remapped for encore
for (i = 0; i < numsectors; i++) for (i = 0; i < numsectors; i++)
@@ -678,8 +685,6 @@ static void HWR_PrecacheLevelTextures(void)
const line_t *line = &lines[i]; const line_t *line = &lines[i];
#ifdef GLENCORE #ifdef GLENCORE
const int noencoremap = ((encoremap && (line->flags & ML_TFERLINE)) ? 2 : 1); const int noencoremap = ((encoremap && (line->flags & ML_TFERLINE)) ? 2 : 1);
#else
const int noencoremap = 1;
#endif #endif
// two sides // two sides
for (j = 0; j < 2; j++) for (j = 0; j < 2; j++)
@@ -695,11 +700,14 @@ static void HWR_PrecacheLevelTextures(void)
for (f = 0; f < 3; f++) for (f = 0; f < 3; f++)
{ {
const INT32 texnum = sidetex[f]; const INT32 texnum = sidetex[f];
if (texnum < 0 || texnum >= numtextures || texturepresent[texnum]) if (texnum < 0 || texnum >= numtextures || texturepresent[texnum])
continue; continue;
#ifdef GLENCORE
texturepresent[texnum] = 1|noencoremap; texturepresent[texnum] = 1|noencoremap;
#else
texturepresent[texnum] = 1;
#endif
HWR_GetTexture(texnum, false); HWR_GetTexture(texnum, false);
#ifdef GLENCORE #ifdef GLENCORE
if (noencoremap & 2) if (noencoremap & 2)
@@ -737,7 +745,7 @@ static void HWR_PrecacheLevelTextures(void)
free(texturepresent); free(texturepresent);
} }
static void HWR_PrecacheLevelSprites(void) /*static void HWR_PrecacheLevelSprites(void)
{ {
patch_t *spritepatch; patch_t *spritepatch;
char *spritepresent; char *spritepresent;
@@ -800,11 +808,11 @@ static void HWR_PrecacheLevelSprites(void)
} }
} }
free(spritepresent); free(spritepresent);
} }*/
void HWR_PrecacheLevel(void) void HWR_PrecacheLevel(void)
{ {
if (gamestate != GS_LEVEL) if (gamestate != GS_LEVEL || !cv_precachetextures.value)
return; return;
// Precache flats. // Precache flats.
@@ -814,7 +822,7 @@ void HWR_PrecacheLevel(void)
HWR_PrecacheLevelTextures(); HWR_PrecacheLevelTextures();
// Precache sprites. // Precache sprites.
HWR_PrecacheLevelSprites(); //HWR_PrecacheLevelSprites();
} }
void HWR_LoadMapTextures(size_t pnumtextures) void HWR_LoadMapTextures(size_t pnumtextures)
@@ -823,11 +831,8 @@ void HWR_LoadMapTextures(size_t pnumtextures)
HWR_FreeMapTextures(); HWR_FreeMapTextures();
gl_numtextures = pnumtextures; gl_numtextures = pnumtextures;
#ifdef GLENCORE 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
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) if (gl_textures == NULL)
I_Error("HWR_LoadMapTextures: ran out of memory for OpenGL textures. Sad!"); I_Error("HWR_LoadMapTextures: ran out of memory for OpenGL textures. Sad!");
} }
@@ -851,7 +856,7 @@ GLMapTexture_t *HWR_GetTexture(INT32 tex, boolean noencore)
// Every texture in memory, stored in the // Every texture in memory, stored in the
// hardware renderer's bit depth format. Wow! // hardware renderer's bit depth format. Wow!
#ifdef GLENCORE #ifdef GLENCORE
gltex = &gl_textures[tex*2 + (encoremap && !noencore ? 0 : 1)]; gltex = (encoremap && !noencore) ? &gl_textures[tex].encore : &gl_textures[tex].normal;
#else #else
gltex = &gl_textures[tex]; gltex = &gl_textures[tex];
#endif #endif
+8 -7
View File
@@ -46,9 +46,9 @@ typedef struct
UINT8 image_descriptor; //18 UINT8 image_descriptor; //18
} ATTRPACK TGAHeader; // sizeof is 18 } ATTRPACK TGAHeader; // sizeof is 18
static UINT8 softwaretranstogl[11] = { 0, 25, 51, 76,102,127,153,178,204,229,255}; static const 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 const 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 UINT8 softwaretranstogl_lo[11] = { 0, 12, 24, 36, 48, 60, 71, 83, 95,111,127};
static const float FLOATBASEVIDWIDTH = (float)BASEVIDWIDTH; static const float FLOATBASEVIDWIDTH = (float)BASEVIDWIDTH;
static const float FLOATBASEVIDHEIGHT = (float)BASEVIDHEIGHT; static const float FLOATBASEVIDHEIGHT = (float)BASEVIDHEIGHT;
@@ -506,7 +506,7 @@ void HWR_FadeScreenMenuBack(UINT16 color, UINT8 strength)
if (color & 0xFF00) // Do COLORMAP fade. if (color & 0xFF00) // Do COLORMAP fade.
{ {
if (HWR_ShouldUsePaletteRendering() && cv_glscreentextures.value) if (cv_glscreentextures.value && HWR_ShouldUsePaletteRendering())
{ {
const hwdscreentexture_t scr_tex = HWD_SCREENTEXTURE_GENERIC2; const hwdscreentexture_t scr_tex = HWD_SCREENTEXTURE_GENERIC2;
@@ -518,13 +518,11 @@ void HWR_FadeScreenMenuBack(UINT16 color, UINT8 strength)
GL_UnSetShader(); GL_UnSetShader();
return; return;
} }
else
{
Surf.PolyColor.rgba = UINT2RGBA(0x01010160); Surf.PolyColor.rgba = UINT2RGBA(0x01010160);
Surf.PolyColor.s.alpha = (strength*8); Surf.PolyColor.s.alpha = (strength*8);
poly_flags |= PF_Translucent; poly_flags |= PF_Translucent;
} }
}
else // Do TRANSMAP** fade. else // Do TRANSMAP** fade.
{ {
const RGBA_t *palette = HWR_GetTexturePalette(); const RGBA_t *palette = HWR_GetTexturePalette();
@@ -890,11 +888,13 @@ void HWR_DrawFill(INT32 x, INT32 y, INT32 w, INT32 h, INT32 color)
if (fx >= vid.width || fy >= vid.height) if (fx >= vid.width || fy >= vid.height)
return; return;
if (fx < 0) if (fx < 0)
{ {
fw += fx; fw += fx;
fx = 0; fx = 0;
} }
if (fy < 0) if (fy < 0)
{ {
fh += fy; fh += fy;
@@ -906,6 +906,7 @@ void HWR_DrawFill(INT32 x, INT32 y, INT32 w, INT32 h, INT32 color)
if (fx + fw > vid.width) if (fx + fw > vid.width)
fw = fvw - fx; fw = fvw - fx;
if (fy + fh > vid.height) if (fy + fh > vid.height)
fh = fvh - fy; fh = fvh - fy;
+1 -1
View File
@@ -5840,7 +5840,7 @@ static void COM_HWR_glinfo(void)
{ {
argv = COM_Argv(i); argv = COM_Argv(i);
if (strcmp(argv, "--list-extensions") == 0 || strcmp(argv, "-l") == 0) if (fastcmp(argv, "--list-extensions")|| fastcmp(argv, "-l"))
{ {
list_extensions = 1; list_extensions = 1;
} }
+7 -5
View File
@@ -549,7 +549,7 @@ void HWR_InitMD2(void)
{ {
for (i = 0; i < NUMSPRITES; i++) for (i = 0; i < NUMSPRITES; i++)
{ {
if (stricmp(name, sprnames[i]) == 0) if (fasticmp(name, sprnames[i]))
{ {
md2_models[i].scale = scale; md2_models[i].scale = scale;
md2_models[i].offset = offset; md2_models[i].offset = offset;
@@ -561,7 +561,7 @@ void HWR_InitMD2(void)
for (s = 0; s < MAXSKINS; s++) for (s = 0; s < MAXSKINS; s++)
{ {
if (stricmp(name, skins[s].name) == 0) if (fasticmp(name, skins[s].name))
{ {
md2_playermodels[s].skin = s; md2_playermodels[s].skin = s;
md2_playermodels[s].scale = scale; md2_playermodels[s].scale = scale;
@@ -607,11 +607,12 @@ void HWR_AddPlayerMD2(int skin, boolean local) // For MD2's that were added afte
} }
} }
md2s = ( (local) ? md2_localplayermodels : md2_playermodels ); md2s = (local ? md2_localplayermodels : md2_playermodels);
// Check for any MD2s that match the names of player skins! // Check for any MD2s that match the names of player skins!
while (fscanf(f, "%19s %31s %f %f", name, filename, &scale, &offset) == 4) while (fscanf(f, "%19s %31s %f %f", name, filename, &scale, &offset) == 4)
{ {
if (stricmp(name, K_GetSkinArray(local)[skin].name) == 0) if (fasticmp(name, K_GetSkinArray(local)[skin].name))
{ {
md2s[skin].skin = skin; md2s[skin].skin = skin;
md2s[skin].scale = scale; md2s[skin].scale = scale;
@@ -650,6 +651,7 @@ void HWR_AddSpriteMD2(size_t spritenum) // For MD2s that were added after startu
if (!f) if (!f)
{ {
f = fopen(va("%s"PATHSEP"%s", srb2path, "mdls.dat"), "rt"); f = fopen(va("%s"PATHSEP"%s", srb2path, "mdls.dat"), "rt");
if (!f) if (!f)
{ {
CONS_Printf("%s %s\n", M_GetText("Error while loading mdls.dat:"), strerror(errno)); CONS_Printf("%s %s\n", M_GetText("Error while loading mdls.dat:"), strerror(errno));
@@ -661,7 +663,7 @@ void HWR_AddSpriteMD2(size_t spritenum) // For MD2s that were added after startu
// Check for any MD2s that match the names of sprite names! // Check for any MD2s that match the names of sprite names!
while (fscanf(f, "%19s %31s %f %f", name, filename, &scale, &offset) == 4) while (fscanf(f, "%19s %31s %f %f", name, filename, &scale, &offset) == 4)
{ {
if (stricmp(name, sprnames[spritenum]) == 0) if (fasticmp(name, sprnames[spritenum]))
{ {
md2_models[spritenum].scale = scale; md2_models[spritenum].scale = scale;
md2_models[spritenum].offset = offset; md2_models[spritenum].offset = offset;
+5 -5
View File
@@ -126,7 +126,7 @@ tag_t *GetTagByName(model_t *model, char *name, int frame)
int i; int i;
for (i = 0; i < model->numTags; i++) for (i = 0; i < model->numTags; i++)
{ {
if (!stricmp(iterator[i].name, name)) if (fasticmp(iterator[i].name, name))
return &iterator[i]; return &iterator[i];
} }
} }
@@ -163,22 +163,22 @@ model_t *LoadModel(const char *filename, int ztag)
return NULL; return NULL;
} }
if (!strcmp(extension, ".md3")) if (fastcmp(extension, ".md3"))
{ {
if (!(model = MD3_LoadModel(filename, ztag, false))) if (!(model = MD3_LoadModel(filename, ztag, false)))
return NULL; return NULL;
} }
else if (!strcmp(extension, ".md3s")) // MD3 that will be converted in memory to use full floats else if (fastcmp(extension, ".md3s")) // MD3 that will be converted in memory to use full floats
{ {
if (!(model = MD3_LoadModel(filename, ztag, true))) if (!(model = MD3_LoadModel(filename, ztag, true)))
return NULL; return NULL;
} }
else if (!strcmp(extension, ".md2")) else if (fastcmp(extension, ".md2"))
{ {
if (!(model = MD2_LoadModel(filename, ztag, false))) if (!(model = MD2_LoadModel(filename, ztag, false)))
return NULL; return NULL;
} }
else if (!strcmp(extension, ".md2s")) else if (fastcmp(extension, ".md2s"))
{ {
if (!(model = MD2_LoadModel(filename, ztag, true))) if (!(model = MD2_LoadModel(filename, ztag, true)))
return NULL; return NULL;
+4 -4
View File
@@ -586,7 +586,7 @@ void HWR_LoadCustomShadersFromFile(UINT16 wadnum, boolean PK3)
goto skip_field; goto skip_field;
} }
if (!stricmp(stoken, "GLSL")) if (fasticmp(stoken, "GLSL"))
{ {
value = strtok(NULL, "\r\n "); value = strtok(NULL, "\r\n ");
if (!value) if (!value)
@@ -596,9 +596,9 @@ void HWR_LoadCustomShadersFromFile(UINT16 wadnum, boolean PK3)
goto skip_lump; goto skip_lump;
} }
if (!stricmp(value, "VERTEX")) if (fasticmp(value, "VERTEX"))
shadertype = 1; shadertype = 1;
else if (!stricmp(value, "FRAGMENT")) else if (fasticmp(value, "FRAGMENT"))
shadertype = 2; shadertype = 2;
skip_lump: skip_lump:
@@ -624,7 +624,7 @@ skip_lump:
for (i = 0; shaderxlat[i].type; i++) for (i = 0; shaderxlat[i].type; i++)
{ {
if (!stricmp(shaderxlat[i].type, stoken)) if (fasticmp(shaderxlat[i].type, stoken))
{ {
size_t shader_string_length; size_t shader_string_length;
char *shader_source; char *shader_source;
+24 -16
View File
@@ -431,7 +431,7 @@ void HU_Start(void)
void HU_Shiftform(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) static void HU_removeChatText_Mini(void)
{ {
// MPC: Don't create new arrays, just iterate through an existing one // MPC: Don't create new arrays, just iterate through an existing one
size_t i; for (size_t i = 0; i < chat_nummsg_min - 1; i++)
for(i=0;i<chat_nummsg_min-1;i++) { {
strcpy(chat_mini[i], chat_mini[i+1]); strcpy(chat_mini[i], chat_mini[i+1]);
chat_timers[i] = chat_timers[i+1]; chat_timers[i] = chat_timers[i+1];
} }
@@ -485,8 +485,8 @@ static void HU_removeChatText_Log(void)
return; return;
free(chat_log[0]); free(chat_log[0]);
size_t i;
for(i=0;i<chat_nummsg_log-1;i++) for (size_t i = 0; i < chat_nummsg_log - 1;i++)
{ {
chat_log[i] = chat_log[i+1]; chat_log[i] = chat_log[i+1];
} }
@@ -1101,14 +1101,14 @@ void HU_Ticker(void)
size_t i = 0; size_t i = 0;
// handle spam while we're at it: // handle spam while we're at it:
for(; (i<MAXPLAYERS); i++) for(; (i < MAXPLAYERS); i++)
{ {
if (stop_spamming[i] > 0) if (stop_spamming[i] > 0)
stop_spamming[i]--; stop_spamming[i]--;
} }
// handle chat timers // handle chat timers
for (i=0; (i<chat_nummsg_min); i++) for (i = 0; (i < chat_nummsg_min); i++)
{ {
if (chat_timers[i] > 0) if (chat_timers[i] > 0)
chat_timers[i]--; chat_timers[i]--;
@@ -1499,7 +1499,7 @@ static void HU_drawMiniChat(void)
if (splitscreen > 1) if (splitscreen > 1)
boxw = max(64, boxw/2); 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]); char *msg = CHAT_WordWrap(x+2, boxw-(charwidth*2), V_SNAPTOBOTTOM|V_SNAPTOLEFT|V_ALLOWLOWERCASE, chat_mini[i-1]);
size_t j = 0; size_t j = 0;
@@ -1572,7 +1572,7 @@ static void HU_drawMiniChat(void)
i = 0; i = 0;
prev_linereturn = false; 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 clrflag = 0;
INT32 timer = ((cv_chattime.value*TICRATE)-chat_timers[i]) - cv_chattime.value*TICRATE+9; // see below... INT32 timer = ((cv_chattime.value*TICRATE)-chat_timers[i]) - cv_chattime.value*TICRATE+9; // see below...
@@ -1749,7 +1749,6 @@ static void HU_drawChatLog(INT32 offset)
Z_Free(msg); 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. 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 atbottom = true; // we should scroll
@@ -2284,6 +2283,7 @@ static void HU_DrawSongCreditsBox(void)
V_DrawFill(x, y, strwidth*dup, BOXCREDITHEIGHT*dup, 28|flags|(bgt<<V_ALPHASHIFT)); 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)); V_DrawFill(x+dup, y+dup, (strwidth-2)*dup, (BOXCREDITHEIGHT-2)*dup, 30|flags|(bgt<<V_ALPHASHIFT));
} }
if (cursongcredit.trans < NUMTRANSMAPS) if (cursongcredit.trans < NUMTRANSMAPS)
{ {
V_DrawSmallString(x+2*dup, y+2*dup, V_ALLOWLOWERCASE|flags|(cursongcredit.trans<<V_ALPHASHIFT), str); V_DrawSmallString(x+2*dup, y+2*dup, V_ALLOWLOWERCASE|flags|(cursongcredit.trans<<V_ALPHASHIFT), str);
@@ -2845,12 +2845,8 @@ void HU_SetCEchoFlags(INT32 flags)
void HU_DoCEcho(const char *msg) void HU_DoCEcho(const char *msg)
{ {
#pragma GCC diagnostic push strlcpy(cechotext, msg, sizeof(cechotext));
#pragma GCC diagnostic ignored "-Wstringop-truncation" // This is fine, we set null byte later strlcat(cechotext, "\\", sizeof(cechotext));
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 // just print it to console
if (cv_cechotoggle.value == 2) if (cv_cechotoggle.value == 2)
@@ -2859,8 +2855,20 @@ void HU_DoCEcho(const char *msg)
strncpy(temp, cechotext, sizeof(temp)); strncpy(temp, cechotext, sizeof(temp));
for (char *p = temp; *p != '\0'; ++p) for (char *p = temp; *p != '\0'; ++p)
{
if (*p == '\\') if (*p == '\\')
{
*p = '\n'; *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); CONS_Printf("%s\n", temp);
+66 -34
View File
@@ -28,14 +28,14 @@
#endif #endif
#ifdef _WIN32 #ifdef _WIN32
#define USE_WINSOCK #define USE_WINSOCK
#endif //WIN32 OS #endif //WIN32 OS
#ifdef USE_WINSOCK #ifdef USE_WINSOCK
#include <ws2tcpip.h> #include <ws2tcpip.h>
#define addrinfo_t ADDRINFOA #define addrinfo_t ADDRINFOA
#else #else
#define addrinfo_t struct addrinfo #define addrinfo_t struct addrinfo
#endif #endif
#include "doomdef.h" #include "doomdef.h"
@@ -148,16 +148,16 @@ static UINT8 UPNP_support = TRUE;
#define DEFAULTPORT "5029" #define DEFAULTPORT "5029"
#if defined (USE_WINSOCK) #ifdef USE_WINSOCK
typedef SOCKET SOCKET_TYPE; typedef SOCKET SOCKET_TYPE;
#define ERRSOCKET (SOCKET_ERROR) #define ERRSOCKET (SOCKET_ERROR)
#else #else
#if defined (__unix__) || defined (__APPLE__) || defined (__HAIKU__) #if defined (__unix__) || defined (__APPLE__) || defined (__HAIKU__)
typedef int SOCKET_TYPE; typedef int SOCKET_TYPE;
#else #else
typedef unsigned long SOCKET_TYPE; typedef unsigned long SOCKET_TYPE;
#endif #endif
#define ERRSOCKET (-1) #define ERRSOCKET (-1)
#endif #endif
#define IPV6_MULTICAST_ADDRESS "ff15::57e1:1a12" #define IPV6_MULTICAST_ADDRESS "ff15::57e1:1a12"
@@ -345,17 +345,15 @@ static const char *SOCK_AddrToStr(mysockaddr_t *sk)
{ {
static char s[64]; // 255.255.255.255:65535 or static char s[64]; // 255.255.255.255:65535 or
// [ffff:ffff:ffff:ffff:ffff:ffff:ffff:ffff]:65535 // [ffff:ffff:ffff:ffff:ffff:ffff:ffff:ffff]:65535
#ifdef HAVE_IPV6 #ifdef HAVE_IPV6
int v6 = (sk->any.sa_family == AF_INET6); int v6 = (sk->any.sa_family == AF_INET6);
#else #else
int v6 = 0; int v6 = 0;
#endif #endif
void *addr; void *addr;
int e = 0; // save error code so it can't be modified later code and avoid calling WSAGetLastError() more then once 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; addr = &sk->ip4.sin_addr;
#ifdef HAVE_IPV6 #ifdef HAVE_IPV6
else if(sk->any.sa_family == AF_INET6) else if(sk->any.sa_family == AF_INET6)
@@ -364,9 +362,11 @@ static const char *SOCK_AddrToStr(mysockaddr_t *sk)
else else
addr = NULL; addr = NULL;
if(addr == NULL) if (addr == NULL)
{
sprintf(s, "No address"); 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; e = errno;
sprintf(s, "Unknown family type, error #%u: %s", e, strerror(e)); 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))); strcat(s, va(":%d", ntohs(sk->ip6.sin6_port)));
} }
#endif #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))); strcat(s, va(":%d", ntohs(sk->ip4.sin_port)));
return s; return s;
@@ -481,7 +481,6 @@ static boolean SOCK_cmpaddr(mysockaddr_t *a, mysockaddr_t *b, UINT8 mask)
return false; return false;
} }
// This is a hack. For some reason, nodes aren't being freed properly. // 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. // 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. /** \warning This function causes the file downloading to stop if someone joins.
@@ -636,7 +635,7 @@ static boolean SOCK_Get(void)
c = recvfrom(mysockets[n], (char *)&doomcom->data, MAXPACKETLENGTH, 0, c = recvfrom(mysockets[n], (char *)&doomcom->data, MAXPACKETLENGTH, 0,
(void *)&fromaddress, &fromlen); (void *)&fromaddress, &fromlen);
if (c > 0) if (c != ERRSOCKET)
{ {
#ifdef USE_STUN #ifdef USE_STUN
if (STUN_got_response(doomcom->data, c)) if (STUN_got_response(doomcom->data, c))
@@ -652,20 +651,21 @@ static boolean SOCK_Get(void)
#endif #endif
// find remote node number // 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)) if (SOCK_cmpaddr(&fromaddress, &clientaddress[j], 0))
{ {
doomcom->remotenode = (INT16)j; // good packet from a game player doomcom->remotenode = (INT16)j; // good packet from a game player
doomcom->datalength = (INT16)c; doomcom->datalength = (INT16)c;
nodesocket[j] = mysockets[n]; nodesocket[j] = mysockets[n];
return false; return true;
} }
} }
// not found // not found
// find a free slot // find a free slot
j = getfreenode(); j = getfreenode();
if (j > 0) if (j > 0)
{ {
const time_t curTime = time(NULL); 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 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; size_t i, j;
if (!nodeconnected[doomcom->remotenode]) if (doomcom->remotenode < 0 || !nodeconnected[doomcom->remotenode])
return; return;
if (doomcom->remotenode == BROADCASTADDR) if (doomcom->remotenode == BROADCASTADDR)
@@ -970,7 +970,7 @@ static SOCKET_TYPE UDP_Bind(int family, struct sockaddr *addr, socklen_t addrlen
e = errno; e = errno;
I_OutputMsg("getting SO_RCVBUF failed: #%u, %s\n", e, strerror(e)); I_OutputMsg("getting SO_RCVBUF failed: #%u, %s\n", e, strerror(e));
} }
CONS_Printf(M_GetText("Network system buffer: %dKb\n"), opt>>10); CONS_Printf(M_GetText("Network receive buffer: %dKb\n"), opt>>10);
if (opt < 64<<10) // 64k if (opt < 64<<10) // 64k
{ {
@@ -991,9 +991,44 @@ static SOCKET_TYPE UDP_Bind(int family, struct sockaddr *addr, socklen_t addrlen
} }
if (opt < 64<<10) if (opt < 64<<10)
CONS_Alert(CONS_WARNING, M_GetText("Can't set buffer length to 64k, file transfer will be bad\n")); CONS_Alert(CONS_WARNING, M_GetText("Can't set receive buffer length to 64k, file transfer will be bad\n"));
else else
CONS_Printf(M_GetText("Network system buffer set to: %dKb\n"), opt>>10); 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);
} }
rc = getsockname(s, &straddr.any, &len); rc = getsockname(s, &straddr.any, &len);
@@ -1269,9 +1304,9 @@ void I_ShutdownTcpDriver(void)
init_tcp_driver = false; init_tcp_driver = false;
} }
static boolean SOCK_GetAddr(struct sockaddr_in *sin, const char *address, const char *port, boolean test) static boolean SOCK_GetAddr(mysockaddr_t *sin, const char *address, const char *port, boolean test)
{ {
addrinfo_t *ai = NULL, *runp, hints; addrinfo_t *ai, *runp, hints;
int gaie; int gaie;
size_t i; size_t i;
@@ -1287,10 +1322,7 @@ static boolean SOCK_GetAddr(struct sockaddr_in *sin, const char *address, const
gaie = getaddrinfo(address, port, &hints, &ai); gaie = getaddrinfo(address, port, &hints, &ai);
if (gaie != 0) if (gaie != 0)
{
freeaddrinfo(ai);
return false; return false;
}
runp = ai; runp = ai;
@@ -1330,7 +1362,7 @@ static SINT8 SOCK_NetMakeNodewPort(const char *address, const char *port)
if (newnode != -1) if (newnode != -1)
{ {
if (!SOCK_GetAddr(&clientaddress[newnode].ip4, address, port, true)) if (!SOCK_GetAddr(&clientaddress[newnode], address, port, true))
{ {
nodeconnected[newnode] = false; nodeconnected[newnode] = false;
return -1; return -1;
@@ -1358,7 +1390,7 @@ static void rendezvous(int size)
if (tic != refreshtic) if (tic != refreshtic)
{ {
if (SOCK_GetAddr(&rzv.ip4, host, (port ? port : "7777"), false)) if (SOCK_GetAddr(&rzv, host, (port ? port : "7777"), false))
{ {
refreshtic = tic; refreshtic = tic;
} }
+4 -4
View File
@@ -608,9 +608,6 @@ void K_GenerateKartColormap(UINT8 *dest_colormap, INT32 skinnum, UINT8 color, bo
if (color >= MAXTRANSLATIONS) if (color >= MAXTRANSLATIONS)
I_Error("Invalid skin color #%hu.", (UINT16)color); 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; starttranscolor = (skinnum != TC_DEFAULT) ? K_GetSkinArray(local)[skinnum].starttranscolor : DEFAULT_STARTTRANSCOLOR;
if (starttranscolor >= NUM_PALETTE_ENTRIES) if (starttranscolor >= NUM_PALETTE_ENTRIES)
@@ -640,11 +637,14 @@ void K_GenerateKartColormap(UINT8 *dest_colormap, INT32 skinnum, UINT8 color, bo
UINT8 K_GetKartColorByName(const char *name) UINT8 K_GetKartColorByName(const char *name)
{ {
UINT8 color = (UINT8)atoi(name); UINT8 color = (UINT8)atoi(name);
if (color > 0 && color < MAXSKINCOLORS) if (color > 0 && color < MAXSKINCOLORS)
return color; return color;
for (color = 1; color < MAXSKINCOLORS; color++) for (color = 1; color < MAXSKINCOLORS; color++)
if (!stricmp(KartColor_Names[color], name)) if (fasticmp(KartColor_Names[color], name))
return color; return color;
return 0; return 0;
} }
+1 -1
View File
@@ -453,7 +453,7 @@ static int lib_cvRegisterVar(lua_State *L)
if (cvar->flags & CV_MODIFIED) if (cvar->flags & CV_MODIFIED)
return luaL_error(L, "failed to register cvar (probable conflict with internal variable/command names)"); return luaL_error(L, "failed to register cvar (probable conflict with internal variable/command names)");
if (!(((cvar->flags & CV_HIDEN)) || (cvar->flags & CV_NOSHOWHELP)) && (cvar->PossibleValue || !(cvar->value == 0 && stricmp(cvar->string, "0")))) if (!(((cvar->flags & CV_HIDEN)) || (cvar->flags & CV_NOSHOWHELP)) && (cvar->PossibleValue || !(cvar->value == 0 && !fasticmp(cvar->string, "0"))))
{ {
if (!category) if (!category)
{ {
+3 -3
View File
@@ -83,7 +83,7 @@ FUNCINLINE static ATTRINLINE unsigned hook_in_list
for (type = 0; list[type] != NULL; ++type) for (type = 0; list[type] != NULL; ++type)
{ {
if (strcmp(name, list[type]) == 0) if (fastcmp(name, list[type]))
break; break;
} }
@@ -240,7 +240,7 @@ static int lib_addHook(lua_State *L)
{ {
add_hook(&hookIds[type]); add_hook(&hookIds[type]);
} }
/*else if (strcmp(name, "HUD") == 0) // ehh this is cool and all, but i dont want modders potentially breaking vanilla clients lol /*else if (fastcmp(name, "HUD")) // ehh this is cool and all, but i dont want modders potentially breaking vanilla clients lol
{ {
add_hud_hook(L, 3); add_hud_hook(L, 3);
}*/ }*/
@@ -818,7 +818,7 @@ typedef struct {
FUNCINLINE static ATTRINLINE boolean checkbotkey(const char *field) FUNCINLINE static ATTRINLINE boolean checkbotkey(const char *field)
{ {
return lua_toboolean(gL, -1) && strcmp(lua_tostring(gL, -2), field) == 0; return lua_toboolean(gL, -1) && fastcmp(lua_tostring(gL, -2), field);
} }
static void res_botai(Hook_State *hook) static void res_botai(Hook_State *hook)
+3 -3
View File
@@ -455,12 +455,12 @@ int mobj_localskin_setter(lua_State *L)
strlcpy(skin, luaL_optstring(L, 2, "none"), sizeof skin); strlcpy(skin, luaL_optstring(L, 2, "none"), sizeof skin);
strlwr(skin); // all skin names are lowercase strlwr(skin); // all skin names are lowercase
if (stricmp(skin, "none")) if (!fasticmp(skin, "none"))
{ {
// Try localskins // Try localskins
for (i = 0; i < numlocalskins; i++) for (i = 0; i < numlocalskins; i++)
{ {
if (stricmp(localskins[i].name, skin) == 0) if (fasticmp(localskins[i].name, skin))
{ {
mo->localskin = &localskins[i]; mo->localskin = &localskins[i];
mo->skinlocal = true; mo->skinlocal = true;
@@ -471,7 +471,7 @@ int mobj_localskin_setter(lua_State *L)
// Try other skins // Try other skins
for (i = 0; i < numskins; i++) for (i = 0; i < numskins; i++)
{ {
if (stricmp(skins[i].name, skin) == 0) if (fasticmp(skins[i].name, skin))
{ {
mo->localskin = &skins[i]; mo->localskin = &skins[i];
mo->skinlocal = false; mo->skinlocal = false;
+4
View File
@@ -288,6 +288,10 @@ void LUA_LoadLump(UINT16 wad, UINT16 lump)
lumpinfo_t *lump_p = &wadfiles[wad]->lumpinfo[lump]; lumpinfo_t *lump_p = &wadfiles[wad]->lumpinfo[lump];
len += 1 + strlen(lump_p->fullname); // length of file name, '|', and lump name len += 1 + strlen(lump_p->fullname); // length of file name, '|', and lump name
name = malloc(len+1); name = malloc(len+1);
if (!name)
I_Error("LUA_LoadLump: Out of memory!\n");
sprintf(name, "%s|%s", wadfiles[wad]->filename, lump_p->fullname); sprintf(name, "%s|%s", wadfiles[wad]->filename, lump_p->fullname);
name[len] = '\0'; name[len] = '\0';
} }
+2 -2
View File
@@ -183,7 +183,7 @@ static aatree_node_t *M_AATreeSetString_Node(aatree_node_t *node, UINT32 flags,
else else
{ {
aatree_entry_t *entry = node->value; aatree_entry_t *entry = node->value;
if (entry != NULL && strcmp(entry->key, key) != 0) if (entry != NULL && !fastcmp(entry->key, key))
entry = entry->next; entry = entry->next;
if (entry != NULL) if (entry != NULL)
{ {
@@ -252,7 +252,7 @@ void *M_AATreeGetString(aatree_t *aatree, const char *key)
I_Assert((aatree->flags & AATREE_STRING) == AATREE_STRING); I_Assert((aatree->flags & AATREE_STRING) == AATREE_STRING);
UINT32 hash = FNV1a_HashString(key); UINT32 hash = FNV1a_HashString(key);
aatree_entry_t *entry = M_AATreeGet_Node(aatree->root, hash); aatree_entry_t *entry = M_AATreeGet_Node(aatree->root, hash);
while (entry != NULL && strcmp(entry->key, key) != 0) while (entry != NULL && !fastcmp(entry->key, key))
entry = entry->next; entry = entry->next;
return entry != NULL ? entry->value : NULL; return entry != NULL ? entry->value : NULL;
} }
+4 -2
View File
@@ -49,7 +49,7 @@ INT32 M_CheckParm(const char *check)
for (i = 1; i < myargc; i++) for (i = 1; i < myargc; i++)
{ {
if (!strcasecmp(check, myargv[i])) if (fasticmp(check, myargv[i]))
{ {
found = i; found = i;
return i; return i;
@@ -71,14 +71,16 @@ INT32 M_CheckProtoParam(const char *check)
{ {
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; found = i;
return i; return i;
} }
} }
} }
found = 0; found = 0;
return 0; return 0;
} }
+2 -2
View File
@@ -112,7 +112,7 @@ void M_LoadEmotes(UINT16 wadnum)
trim(field); trim(field);
trim(value); trim(value);
if (stricmp(field.c_str(), "frames") == 0) if (fasticmp(field.c_str(), "frames"))
{ {
UINT8 numframes = 0; UINT8 numframes = 0;
@@ -158,7 +158,7 @@ void M_LoadEmotes(UINT16 wadnum)
emote->numframes = numframes; emote->numframes = numframes;
} }
else if (stricmp(field.c_str(), "timeperframe") == 0) else if (fasticmp(field.c_str(), "timeperframe"))
{ {
emote->timeperframe = std::stoi(value); emote->timeperframe = std::stoi(value);
+20 -16
View File
@@ -3719,10 +3719,10 @@ static void M_HandleAddons(INT32 choice)
break; break;
case EXT_TXT: case EXT_TXT:
case EXT_CFG: case EXT_CFG:
if ((strcmp(dirmenu[dir_on[menudepthleft]]+DIR_STRING, CONFIGFILENAME) == 0) if (fastcmp(dirmenu[dir_on[menudepthleft]]+DIR_STRING, CONFIGFILENAME)
|| (strcmp(dirmenu[dir_on[menudepthleft]]+DIR_STRING, AUTOLOADCONFIGFILENAME) == 0) || fastcmp(dirmenu[dir_on[menudepthleft]]+DIR_STRING, AUTOLOADCONFIGFILENAME)
|| (strcmp(dirmenu[dir_on[menudepthleft]]+DIR_STRING, "kartserv.cfg") == 0) || fastcmp(dirmenu[dir_on[menudepthleft]]+DIR_STRING, "kartserv.cfg")
|| (strcmp(dirmenu[dir_on[menudepthleft]]+DIR_STRING, "kartexec.cfg") == 0)) || fastcmp(dirmenu[dir_on[menudepthleft]]+DIR_STRING, "kartexec.cfg"))
{ {
M_StartMessage(va("%c%s\x80\nYou can't autoload this builds' base console scripts, silly!\n They're already autoloaded on startup! \n\n(Press a key)\n", ('\x80' + (highlightflags>>V_CHARCOLORSHIFT)), dirmenu[dir_on[menudepthleft]]+DIR_STRING),NULL,MM_NOTHING); M_StartMessage(va("%c%s\x80\nYou can't autoload this builds' base console scripts, silly!\n They're already autoloaded on startup! \n\n(Press a key)\n", ('\x80' + (highlightflags>>V_CHARCOLORSHIFT)), dirmenu[dir_on[menudepthleft]]+DIR_STRING),NULL,MM_NOTHING);
S_StartSound(NULL, sfx_s26d); S_StartSound(NULL, sfx_s26d);
@@ -3830,7 +3830,7 @@ static void ReplayNamesLoadThread(void* userdata)
Lock_search_state(); Lock_search_state();
if (strcmp(menupath, replaydirpath) == 0) if (fastcmp(menupath, replaydirpath))
{ {
memcpy(demolist_all, demolist_all_local, sizeof(menudemo_t)*sizedirmenu); memcpy(demolist_all, demolist_all_local, sizeof(menudemo_t)*sizedirmenu);
replaynamesloaded = true; replaynamesloaded = true;
@@ -6956,9 +6956,9 @@ static void M_ConnectMenuModChecks(INT32 choice)
(void)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 // 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 || autoloaded) if (modifiedgame)
{ {
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); 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);
return; return;
} }
@@ -7179,17 +7179,21 @@ static void M_DrawLevelSelectOnly(boolean leftfade, boolean rightfade)
namescroll = 0; namescroll = 0;
} }
if (renderisnewtic) namescroll++; if (renderisnewtic)
namescroll++;
char *addonname = wadfiles[mapwads[cv_nextmap.value-1]]->filename; char *addonname = wadfiles[mapwads[cv_nextmap.value-1]]->filename;
INT32 len; INT32 len;
INT32 charlimit = min((size_t)(21 + (dupadjust/5)), sizeof(namescrollbuf)-1); INT32 charlimit = min((size_t)(21 + (dupadjust/5)), sizeof(namescrollbuf)-1);
nameonly(addonname); nameonly(addonname);
len = strlen(addonname); len = strlen(addonname);
if (len > charlimit) if (len > charlimit)
M_ScrollString(addonname, len, namescrollbuf, charlimit, namescroll); M_ScrollString(addonname, len, namescrollbuf, charlimit, namescroll);
else else
strncpy(namescrollbuf, addonname, sizeof(namescrollbuf)); strncpy(namescrollbuf, addonname, sizeof(namescrollbuf) - 1);
V_DrawThinString(x+w+5, y+i-8, V_TRANSLUCENT|MENUCAPS, namescrollbuf); // variable reuse... V_DrawThinString(x+w+5, y+i-8, V_TRANSLUCENT|MENUCAPS, namescrollbuf); // variable reuse...
} }
@@ -8279,12 +8283,12 @@ static void M_DrawSetupMultiPlayerMenu(void)
sprframe = &sprdef->spriteframes[frame]; 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; speenframe = (I_GetTime()*cv_skinselectspin.value/TICRATE + 1)%8;
//this is a very shitty solution for checking if a sprite needs flipping // this is a very shitty solution for checking if a sprite needs flipping
//but it works // but it works
if ((sprframe->lumppat[speenframe] == sprframe->lumppat[8-speenframe]) && (speenframe > 4)) if ((speenframe > 4) && (sprframe->lumppat[speenframe] == sprframe->lumppat[8-speenframe]))
flags = V_FLIP; // This sprite is left/right flipped! flags = V_FLIP; // This sprite is left/right flipped!
patch = (patch_t *)W_CachePatchNum(sprframe->lumppat[speenframe], PU_PATCH); patch = (patch_t *)W_CachePatchNum(sprframe->lumppat[speenframe], PU_PATCH);
@@ -8804,7 +8808,7 @@ static boolean M_QuitMultiPlayerMenu(void)
size_t l; size_t l;
// send name if changed // send name if changed
if (strcmp(setupm_name, setupm_cvname->string)) if (!fastcmp(setupm_name, setupm_cvname->string))
{ {
// remove trailing whitespaces // remove trailing whitespaces
for (l= strlen(setupm_name)-1; for (l= strlen(setupm_name)-1;
@@ -9465,7 +9469,7 @@ static void M_VideoModeMenu(INT32 choice)
// VESA mode, which is always a higher modenum // VESA mode, which is always a higher modenum
for (j = 0; j < vidm_nummodes; j++) for (j = 0; j < vidm_nummodes; j++)
{ {
if (!strcmp(modedescs[j].desc, desc)) if (fastcmp(modedescs[j].desc, desc))
{ {
// mode(0): 320x200 is always standard VGA, not vesa // mode(0): 320x200 is always standard VGA, not vesa
if (modedescs[j].modenum) if (modedescs[j].modenum)
@@ -9639,7 +9643,7 @@ static void M_DrawLocalSkinMenu(void)
//this is a very shitty solution for checking if a sprite needs flipping //this is a very shitty solution for checking if a sprite needs flipping
//but it works //but it works
if ((sprframe->lumppat[speenframe] == sprframe->lumppat[8-speenframe]) && (speenframe > 4)) if ((speenframe > 4) && (sprframe->lumppat[speenframe] == sprframe->lumppat[8-speenframe]))
{ {
flags = V_FLIP; // This sprite is left/right flipped! flags = V_FLIP; // This sprite is left/right flipped!
} }
+25 -21
View File
@@ -944,21 +944,23 @@ static menuitem_t OP_ExpOptionsMenu[] =
{IT_STRING | IT_CVAR, NULL, "Skyboxes", &cv_skybox, 40}, {IT_STRING | IT_CVAR, NULL, "Skyboxes", &cv_skybox, 40},
{IT_STRING | IT_CVAR, NULL, "FPS counter sampling", &cv_accuratefps, 50}, {IT_STRING | IT_CVAR, NULL, "Precache Level Textures", &cv_precachetextures, 50},
{IT_STRING | IT_CVAR, NULL, "Frameskip", &cv_frameskip, 60}, {IT_STRING | IT_CVAR, NULL, "FPS counter sampling", &cv_accuratefps, 60},
{IT_STRING | IT_CVAR, NULL, "Votescreen Scaling", &cv_votebgscaling, 70}, {IT_STRING | IT_CVAR, NULL, "Frameskip", &cv_frameskip, 70},
{IT_STRING | IT_CVAR, NULL, "Votescreen Scaling", &cv_votebgscaling, 80},
#ifdef HWRENDER #ifdef HWRENDER
{IT_STRING | IT_CVAR, NULL, "Screen Textures", &cv_glscreentextures, 80}, {IT_STRING | IT_CVAR, NULL, "Screen Textures", &cv_glscreentextures, 90},
#ifdef USE_FBO_OGL #ifdef USE_FBO_OGL
{IT_STRING | IT_CVAR, NULL, "FBO Downsampling support", &cv_glframebuffer, 85}, {IT_STRING | IT_CVAR, NULL, "FBO Downsampling support", &cv_glframebuffer, 95},
{IT_STRING | IT_CVAR, NULL, "Palette Depth", &cv_glpalettedepth, 95}, {IT_STRING | IT_CVAR, NULL, "Palette Depth", &cv_glpalettedepth, 105},
{IT_DISABLED, NULL, "", NULL, 105}, // dummy text {IT_DISABLED, NULL, "", NULL, 115}, // dummy text
#else #else
{IT_STRING | IT_CVAR, NULL, "Palette Depth", &cv_glpalettedepth, 90}, {IT_STRING | IT_CVAR, NULL, "Palette Depth", &cv_glpalettedepth, 100},
{IT_DISABLED, NULL, "", NULL, 100}, // dummy text {IT_DISABLED, NULL, "", NULL, 110}, // dummy text
#endif #endif
#endif #endif
}; };
@@ -968,16 +970,17 @@ static const char* OP_ExpTooltips[] =
NULL, NULL,
"How far Mobj interpolation should take effect.", "How far Mobj interpolation should take effect.",
"When weather is on this will cut the object amount used in half.", "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.", //"Should the directional lightning be randomized each map?\nTakes effect on next map load.",
"Toggle being able to see the sky.", "Toggle being able to see the sky.",
"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?? "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.",
"Skips rendering frames if game logic takes too long preventing issues during performance drops." // idk im shit as describing things "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
"Different methods of scaling the votescreen backgrounds.", "Different methods of scaling the votescreen backgrounds.",
#ifdef HWRENDER #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.", "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 #ifdef USE_FBO_OGL
"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.", "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.",
#endif #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.", "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 #endif
@@ -991,6 +994,7 @@ enum
op_exp_secbright, op_exp_secbright,
//op_exp_dirlight, //op_exp_dirlight,
op_exp_skybox, op_exp_skybox,
op_exp_texcache,
op_exp_accuratefps, op_exp_accuratefps,
op_exp_frameskip, op_exp_frameskip,
op_exp_votescrn, op_exp_votescrn,
@@ -1375,15 +1379,15 @@ static menuitem_t OP_Player4CamOptionsMenu[] =
static const char* OP_PlayerCamOptionsTooltips[] = static const char* OP_PlayerCamOptionsTooltips[] =
{ {
NULL, NULL,
"Should the Camera flip on gravity flipped sections?.", "Should the Camera flip on gravity flipped sections?",
"Camera distance relative to the Player.", "Camera distance relative to the Player.",
"Height of the Camera", "Height of the Camera.",
"Pitch Camera on Upwards or Downhill Slopes", "Pitch Camera on Upwards or Downhill Slopes.",
"Speed of the Camera", "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", "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.", "Allows looking up/down by holding\naim forward/backward while standing still.",
"Speed of the Freecam/Spectator Camera", "Speed of the Freecam/Spectator Camera.",
"Toggle between Third or First Person 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 // Ok it's still called chatoptions but we'll put ping display in here to be clean
@@ -1763,7 +1767,7 @@ static const char* OP_PlayerDistortTooltips[] =
"Distance object rotation should be visable.", "Distance object rotation should be visable.",
"Player rotation when sliptiding.", "Player rotation when sliptiding.",
"Rotation of a player's boost trails and drift sparks.", "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 squash and stretch.",
"Player landing sound effect.", "Player landing sound effect.",
"Kart hopping while drifting. This is purely visual.", "Kart hopping while drifting. This is purely visual.",
+1 -1
View File
@@ -423,7 +423,7 @@ void Command_SaveConfig_f(void)
FIL_ForceExtension(tmpstr, ".cfg"); FIL_ForceExtension(tmpstr, ".cfg");
M_SaveConfig(tmpstr); M_SaveConfig(tmpstr);
if (stricmp(COM_Argv(2), "-silent")) if (!fasticmp(COM_Argv(2), "-silent"))
CONS_Printf(M_GetText("config saved as %s\n"), configfile); CONS_Printf(M_GetText("config saved as %s\n"), configfile);
} }
+1 -1
View File
@@ -916,7 +916,7 @@ static void draw_think_frame_stats(int hook_length, ps_hookinfo_t *hook)
int len = (int)strlen(str); int len = (int)strlen(str);
char* str_ptr; char* str_ptr;
if (strcmp(".lua", str + len - 4) == 0) if (fastcmp(".lua", str + len - 4))
{ {
str[len-4] = '\0'; // remove .lua at end str[len-4] = '\0'; // remove .lua at end
} }
+41 -23
View File
@@ -708,7 +708,7 @@ static boolean PIT_CheckThing(mobj_t *thing)
HU_SetCEchoFlags(0); HU_SetCEchoFlags(0);
HU_SetCEchoDuration(5); HU_SetCEchoDuration(5);
HU_DoCEcho(va("%s\\was hit by a kitchen sink.\\\\\\\\", player_names[thing->player-players])); 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_DamageMobj(thing, tmthing, tmthing->target, DMG_INSTAKILL);
P_KillMobj(tmthing, thing, thing); P_KillMobj(tmthing, thing, thing);
} }
@@ -977,7 +977,7 @@ static boolean PIT_CheckThing(mobj_t *thing)
HU_SetCEchoFlags(0); HU_SetCEchoFlags(0);
HU_SetCEchoDuration(5); HU_SetCEchoDuration(5);
HU_DoCEcho(va("%s\\was hit by a kitchen sink.\\\\\\\\", player_names[tmthing->player-players])); 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_DamageMobj(tmthing, thing, thing->target, DMG_INSTAKILL);
P_KillMobj(thing, tmthing, tmthing); 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) boolean P_TryCameraMove(fixed_t x, fixed_t y, camera_t *thiscam)
{ {
subsector_t *s; subsector_t *subsec;
UINT8 i; UINT8 i;
floatok = false; floatok = false;
@@ -2198,9 +2198,9 @@ boolean P_TryCameraMove(fixed_t x, fixed_t y, camera_t *thiscam)
return false; return false;
if (thiscam->x != x || thiscam->y != y || thiscam->subsector == NULL) if (thiscam->x != x || thiscam->y != y || thiscam->subsector == NULL)
s = R_PointInSubsectorFast(x, y); subsec = R_PointInSubsectorFast(x, y);
else else
s = thiscam->subsector; subsec = thiscam->subsector;
if (players[displayplayers[0]].mo) 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->ceilingz = thiscam->z + thiscam->height;
thiscam->x = x; thiscam->x = x;
thiscam->y = y; thiscam->y = y;
thiscam->subsector = s; thiscam->subsector = subsec;
return true; return true;
} }
} }
@@ -2232,6 +2232,7 @@ boolean P_TryCameraMove(fixed_t x, fixed_t y, camera_t *thiscam)
tryx -= MAXRADIUS; tryx -= MAXRADIUS;
else else
tryx = x; tryx = x;
if (y-tryy > MAXRADIUS) if (y-tryy > MAXRADIUS)
tryy += MAXRADIUS; tryy += MAXRADIUS;
else if (y-tryy < -MAXRADIUS) else if (y-tryy < -MAXRADIUS)
@@ -2249,14 +2250,14 @@ boolean P_TryCameraMove(fixed_t x, fixed_t y, camera_t *thiscam)
if (tmceilingz - thiscam->z < thiscam->height) if (tmceilingz - thiscam->z < thiscam->height)
{ {
if (s == thiscam->subsector && tmceilingz >= thiscam->z) if (subsec == thiscam->subsector && tmceilingz >= thiscam->z)
{ {
floatok = true; floatok = true;
thiscam->floorz = tmfloorz; thiscam->floorz = tmfloorz;
thiscam->ceilingz = tmfloorz + thiscam->height; thiscam->ceilingz = tmfloorz + thiscam->height;
thiscam->x = x; thiscam->x = x;
thiscam->y = y; thiscam->y = y;
thiscam->subsector = s; thiscam->subsector = subsec;
return true; return true;
} }
else else
@@ -2281,7 +2282,7 @@ boolean P_TryCameraMove(fixed_t x, fixed_t y, camera_t *thiscam)
thiscam->ceilingz = tmceilingz; thiscam->ceilingz = tmceilingz;
thiscam->x = x; thiscam->x = x;
thiscam->y = y; thiscam->y = y;
thiscam->subsector = s; thiscam->subsector = subsec;
return true; return true;
} }
@@ -2394,6 +2395,7 @@ boolean P_TryMove(mobj_t *thing, fixed_t x, fixed_t y, boolean allowdropoff)
tryx -= radius; tryx -= radius;
else else
tryx = x; tryx = x;
if (y-tryy > radius) if (y-tryy > radius)
tryy += radius; tryy += radius;
else if (y-tryy < -radius) else if (y-tryy < -radius)
@@ -2409,28 +2411,34 @@ boolean P_TryMove(mobj_t *thing, fixed_t x, fixed_t y, boolean allowdropoff)
{ {
//All things are affected by their scale. //All things are affected by their scale.
fixed_t maxstep = FixedMul(MAXSTEPMOVE, mapobjectscale); fixed_t maxstep = FixedMul(MAXSTEPMOVE, mapobjectscale);
INT32 special = 0;
if (thing->player) if (thing->player)
{ {
const INT32 special = GETSECSPECIAL(R_PointInSubsector(x, y)->sector->special, 1); special = GETSECSPECIAL(R_PointInSubsector(x, y)->sector->special, 1);
// If using type Section1:13, double the maxstep. // If using type Section1:13, double the maxstep.
if (P_PlayerTouchingSectorSpecial(thing->player, 1, 13) if (P_PlayerTouchingSectorSpecial(thing->player, 1, 13) || special == 13)
|| special == 13) {
maxstep <<= 1; 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) // 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) else if (P_PlayerTouchingSectorSpecial(thing->player, 1, 12) || special == 12)
|| special == 12) {
maxstep = 0; maxstep = 0;
} }
}
if (thing->type == MT_SKIM) if (thing->type == MT_SKIM)
{
maxstep = 0; maxstep = 0;
}
if (tmceilingz - tmfloorz < thing->height) if (tmceilingz - tmfloorz < thing->height)
{ {
if (tmfloorthing) if (tmfloorthing)
tmhitthing = tmfloorthing; tmhitthing = tmfloorthing;
return false; // doesn't fit return false; // doesn't fit
} }
@@ -2463,11 +2471,8 @@ boolean P_TryMove(mobj_t *thing, fixed_t x, fixed_t y, boolean allowdropoff)
return false; // mobj must lower itself to fit return false; // mobj must lower itself to fit
} }
} }
else if (maxstep > 0 && !( else if (maxstep > 0 && !(thing->player &&
thing->player && ( (P_PlayerTouchingSectorSpecial(thing->player, 1, 14) || special == 14))) // Step down
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 // 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. // step down! Formerly required a Section1:13 sector for the full MAXSTEPMOVE, but no more.
@@ -2489,12 +2494,16 @@ boolean P_TryMove(mobj_t *thing, fixed_t x, fixed_t y, boolean allowdropoff)
if (thing->eflags & MFE_VERTICALFLIP) if (thing->eflags & MFE_VERTICALFLIP)
{ {
if (tmdrpoffceilz - tmceilingz > maxstep) if (tmdrpoffceilz - tmceilingz > maxstep)
{
return false; return false;
} }
}
else if (tmfloorz - tmdropoffz > maxstep) else if (tmfloorz - tmdropoffz > maxstep)
{
return false; // don't stand over a dropoff return false; // don't stand over a dropoff
} }
} }
}
} while (tryx != x || tryy != y); } while (tryx != x || tryy != y);
// The move is ok! // The move is ok!
@@ -2568,6 +2577,7 @@ boolean P_SceneryTryMove(mobj_t *thing, fixed_t x, fixed_t y)
tryx = thing->x; tryx = thing->x;
tryy = thing->y; tryy = thing->y;
do { do {
if (x-tryx > MAXRADIUS) if (x-tryx > MAXRADIUS)
tryx += MAXRADIUS; tryx += MAXRADIUS;
@@ -2575,6 +2585,7 @@ boolean P_SceneryTryMove(mobj_t *thing, fixed_t x, fixed_t y)
tryx -= MAXRADIUS; tryx -= MAXRADIUS;
else else
tryx = x; tryx = x;
if (y-tryy > MAXRADIUS) if (y-tryy > MAXRADIUS)
tryy += MAXRADIUS; tryy += MAXRADIUS;
else if (y-tryy < -MAXRADIUS) else if (y-tryy < -MAXRADIUS)
@@ -2587,14 +2598,14 @@ boolean P_SceneryTryMove(mobj_t *thing, fixed_t x, fixed_t y)
if (!(thing->flags & MF_NOCLIP)) if (!(thing->flags & MF_NOCLIP))
{ {
const fixed_t maxstep = FixedMul(MAXSTEPMOVE, mapobjectscale);
if (tmceilingz - tmfloorz < thing->height) if (tmceilingz - tmfloorz < thing->height)
return false; // doesn't fit return false; // doesn't fit
if (tmceilingz - thing->z < thing->height) if (tmceilingz - thing->z < thing->height)
return false; // mobj must lower itself to fit return false; // mobj must lower itself to fit
const fixed_t maxstep = FixedMul(MAXSTEPMOVE, mapobjectscale);
if (tmfloorz - thing->z > maxstep) if (tmfloorz - thing->z > maxstep)
return false; // too big a step up return false; // too big a step up
} }
@@ -2928,6 +2939,7 @@ static boolean PTR_SlideTraverse(intercept_t *in)
{ {
if (P_PointOnLineSide(slidemo->x, slidemo->y, li)) if (P_PointOnLineSide(slidemo->x, slidemo->y, li))
return true; // don't hit the back side return true; // don't hit the back side
goto isblocking; goto isblocking;
} }
@@ -3346,10 +3358,12 @@ void P_BouncePlayerMove(mobj_t *mo)
{ {
mobj_t *fx = P_SpawnMobj(mo->x, mo->y, mo->z, MT_BUMP); mobj_t *fx = P_SpawnMobj(mo->x, mo->y, mo->z, MT_BUMP);
if (mo->eflags & MFE_VERTICALFLIP) if (mo->eflags & MFE_VERTICALFLIP)
fx->eflags |= MFE_VERTICALFLIP; fx->eflags |= MFE_VERTICALFLIP;
else else
fx->eflags &= ~MFE_VERTICALFLIP; fx->eflags &= ~MFE_VERTICALFLIP;
fx->scale = mo->scale; fx->scale = mo->scale;
S_StartSound(mo, sfx_s3k49); S_StartSound(mo, sfx_s3k49);
@@ -3363,7 +3377,8 @@ void P_BouncePlayerMove(mobj_t *mo)
mo->player->cmomx = tmxmove; mo->player->cmomx = tmxmove;
mo->player->cmomy = tmymove; 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); P_TryMove(mo, mo->x - oldmomx, mo->y - oldmomy, true);
} }
} }
@@ -3740,6 +3755,7 @@ boolean P_CheckSector(sector_t *sector, boolean crunch)
{ {
size_t i; size_t i;
sector_t *sec; sector_t *sec;
for (i = 0; i < sector->numattached; i++) for (i = 0; i < sector->numattached; i++)
{ {
sec = &sectors[sector->attached[i]]; sec = &sectors[sector->attached[i]];
@@ -3946,6 +3962,7 @@ static msecnode_t *P_DelSecnode(msecnode_t *node)
tp = node->m_sectorlist_prev; tp = node->m_sectorlist_prev;
tn = node->m_sectorlist_next; tn = node->m_sectorlist_next;
if (tp) if (tp)
tp->m_sectorlist_next = tn; tp->m_sectorlist_next = tn;
if (tn) if (tn)
@@ -3956,6 +3973,7 @@ static msecnode_t *P_DelSecnode(msecnode_t *node)
sp = node->m_thinglist_prev; sp = node->m_thinglist_prev;
sn = node->m_thinglist_next; sn = node->m_thinglist_next;
if (sp) if (sp)
sp->m_thinglist_next = sn; sp->m_thinglist_next = sn;
else else
@@ -4003,7 +4021,7 @@ static inline boolean PIT_GetSectors(line_t *ld)
// allowed to move to this position, then the sector_list // allowed to move to this position, then the sector_list
// will be attached to the Thing's mobj_t at touching_sectorlist. // 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 // Don't assume all lines are 2-sided, since some Things
// like MT_TFOG are allowed regardless of whether their radius takes // like MT_TFOG are allowed regardless of whether their radius takes
+1 -1
View File
@@ -3391,7 +3391,7 @@ FUNCINLINE static ATTRINLINE void P_UnArchiveSPGame(savebuffer_t *save, INT16 ma
READSTRINGN(save->p, testname, sizeof(testname)); READSTRINGN(save->p, testname, sizeof(testname));
if (strcmp(testname, timeattackfolder)) if (!fastcmp(testname, timeattackfolder))
{ {
if (modifiedgame) if (modifiedgame)
I_Error("Save game not for this modification."); I_Error("Save game not for this modification.");
+39 -16
View File
@@ -324,6 +324,7 @@ void P_InitPicAnims(void)
lastanim->speed = LONG(animdefs[i].speed); lastanim->speed = LONG(animdefs[i].speed);
lastanim++; lastanim++;
} }
lastanim->istexture = -1; lastanim->istexture = -1;
R_ClearTextureNumCache(false); R_ClearTextureNumCache(false);
@@ -331,6 +332,7 @@ void P_InitPicAnims(void)
// We'll only be using anims from now on. // We'll only be using anims from now on.
if (animdefs != harddefs) if (animdefs != harddefs)
Z_Free(animdefs); Z_Free(animdefs);
animdefs = NULL; animdefs = NULL;
} }
@@ -361,20 +363,21 @@ void P_ParseANIMDEFSLump(INT32 wadNum, UINT16 lumpnum)
// Now, let's start parsing this thing // Now, let's start parsing this thing
p = animdefsText; p = animdefsText;
animdefsToken = M_GetToken(p); animdefsToken = M_GetToken(p);
while (animdefsToken != NULL) while (animdefsToken != NULL)
{ {
if (stricmp(animdefsToken, "TEXTURE") == 0) if (fasticmp(animdefsToken, "TEXTURE"))
{ {
Z_Free(animdefsToken); Z_Free(animdefsToken);
P_ParseAnimationDefintion(1); P_ParseAnimationDefintion(1);
} }
else if (stricmp(animdefsToken, "FLAT") == 0) else if (fasticmp(animdefsToken, "FLAT"))
{ {
Z_Free(animdefsToken); Z_Free(animdefsToken);
P_ParseAnimationDefintion(0); P_ParseAnimationDefintion(0);
} }
else if (stricmp(animdefsToken, "OSCILLATE") == 0) else if (fasticmp(animdefsToken, "OSCILLATE"))
{ {
// This probably came off the tail of an earlier definition. It's technically legal syntax, but we don't support it. // This probably came off the tail of an earlier definition. It's technically legal syntax, but we don't support it.
I_Error("Error parsing ANIMDEFS lump: Animation definitions utilizing \"OSCILLATE\" (the animation plays in reverse when it reaches the end) are not supported by SRB2"); I_Error("Error parsing ANIMDEFS lump: Animation definitions utilizing \"OSCILLATE\" (the animation plays in reverse when it reaches the end) are not supported by SRB2");
@@ -383,11 +386,17 @@ void P_ParseANIMDEFSLump(INT32 wadNum, UINT16 lumpnum)
{ {
I_Error("Error parsing ANIMDEFS lump: Expected \"TEXTURE\" or \"FLAT\", got \"%s\"",animdefsToken); I_Error("Error parsing ANIMDEFS lump: Expected \"TEXTURE\" or \"FLAT\", got \"%s\"",animdefsToken);
} }
// parse next line // parse next line
while (*p != '\0' && *p != '\n') ++p; while (*p != '\0' && *p != '\n')
if (*p == '\n') ++p; ++p;
if (*p == '\n')
++p;
animdefsToken = M_GetToken(p); animdefsToken = M_GetToken(p);
} }
Z_Free(animdefsToken); Z_Free(animdefsToken);
Z_Free((void *)animdefsText); Z_Free((void *)animdefsText);
} }
@@ -406,7 +415,8 @@ void P_ParseAnimationDefintion(SINT8 istexture)
{ {
I_Error("Error parsing ANIMDEFS lump: Unexpected end of file where start texture/flat name should be"); I_Error("Error parsing ANIMDEFS lump: Unexpected end of file where start texture/flat name should be");
} }
if (stricmp(animdefsToken, "OPTIONAL") == 0)
if (fasticmp(animdefsToken, "OPTIONAL"))
{ {
// This is meaningful to ZDoom - it tells the program NOT to bomb out // This is meaningful to ZDoom - it tells the program NOT to bomb out
// if the textures can't be found - but it's useless in SRB2, so we'll // if the textures can't be found - but it's useless in SRB2, so we'll
@@ -418,7 +428,7 @@ void P_ParseAnimationDefintion(SINT8 istexture)
{ {
I_Error("Error parsing ANIMDEFS lump: Unexpected end of file where start texture/flat name should be"); I_Error("Error parsing ANIMDEFS lump: Unexpected end of file where start texture/flat name should be");
} }
else if (stricmp(animdefsToken, "RANGE") == 0) else if (fasticmp(animdefsToken, "RANGE"))
{ {
// Oh. Um. Apparently "OPTIONAL" is a texture name. Naughty. // Oh. Um. Apparently "OPTIONAL" is a texture name. Naughty.
// I should probably handle this more gracefully, but right now // I should probably handle this more gracefully, but right now
@@ -427,15 +437,17 @@ void P_ParseAnimationDefintion(SINT8 istexture)
I_Error("Error parsing ANIMDEFS lump: \"OPTIONAL\" is a keyword; you cannot use it as the startname of an animation"); I_Error("Error parsing ANIMDEFS lump: \"OPTIONAL\" is a keyword; you cannot use it as the startname of an animation");
} }
} }
animdefsTokenLength = strlen(animdefsToken); animdefsTokenLength = strlen(animdefsToken);
if (animdefsTokenLength>8) if (animdefsTokenLength > 8)
{ {
I_Error("Error parsing ANIMDEFS lump: lump name \"%s\" exceeds 8 characters", animdefsToken); I_Error("Error parsing ANIMDEFS lump: lump name \"%s\" exceeds 8 characters", animdefsToken);
} }
// Search for existing animdef // Search for existing animdef
for (i = 0; i < maxanims; i++) for (i = 0; i < maxanims; i++)
if (stricmp(animdefsToken, animdefs[i].startname) == 0) {
if (fasticmp(animdefsToken, animdefs[i].startname))
{ {
//CONS_Alert(CONS_NOTICE, "Duplicate animation: %s\n", animdefsToken); //CONS_Alert(CONS_NOTICE, "Duplicate animation: %s\n", animdefsToken);
@@ -444,6 +456,7 @@ void P_ParseAnimationDefintion(SINT8 istexture)
Z_Free(animdefsToken); Z_Free(animdefsToken);
return; return;
} }
}
// Not found // Not found
if (i == maxanims) if (i == maxanims)
@@ -467,21 +480,25 @@ void P_ParseAnimationDefintion(SINT8 istexture)
{ {
I_Error("Error parsing ANIMDEFS lump: Unexpected end of file where \"RANGE\" after \"%s\"'s startname should be", animdefs[i].startname); I_Error("Error parsing ANIMDEFS lump: Unexpected end of file where \"RANGE\" after \"%s\"'s startname should be", animdefs[i].startname);
} }
if (stricmp(animdefsToken, "ALLOWDECALS") == 0)
if (fasticmp(animdefsToken, "ALLOWDECALS"))
{ {
// Another ZDoom keyword, ho-hum. Skip it, move on to the next token. // Another ZDoom keyword, ho-hum. Skip it, move on to the next token.
Z_Free(animdefsToken); Z_Free(animdefsToken);
animdefsToken = M_GetToken(NULL); animdefsToken = M_GetToken(NULL);
} }
if (stricmp(animdefsToken, "PIC") == 0)
if (fasticmp(animdefsToken, "PIC"))
{ {
// This is technically legitimate ANIMDEFS syntax, but SRB2 doesn't support it. // This is technically legitimate ANIMDEFS syntax, but SRB2 doesn't support it.
I_Error("Error parsing ANIMDEFS lump: Animation definitions utilizing \"PIC\" (specific frames instead of a consecutive range) are not supported by SRB2"); I_Error("Error parsing ANIMDEFS lump: Animation definitions utilizing \"PIC\" (specific frames instead of a consecutive range) are not supported by SRB2");
} }
if (stricmp(animdefsToken, "RANGE") != 0)
if (!fasticmp(animdefsToken, "RANGE"))
{ {
I_Error("Error parsing ANIMDEFS lump: Expected \"RANGE\" after \"%s\"'s startname, got \"%s\"", animdefs[i].startname, animdefsToken); I_Error("Error parsing ANIMDEFS lump: Expected \"RANGE\" after \"%s\"'s startname, got \"%s\"", animdefs[i].startname, animdefsToken);
} }
Z_Free(animdefsToken); Z_Free(animdefsToken);
// Endname // Endname
@@ -490,11 +507,13 @@ void P_ParseAnimationDefintion(SINT8 istexture)
{ {
I_Error("Error parsing ANIMDEFS lump: Unexpected end of file where \"%s\"'s end texture/flat name should be", animdefs[i].startname); I_Error("Error parsing ANIMDEFS lump: Unexpected end of file where \"%s\"'s end texture/flat name should be", animdefs[i].startname);
} }
animdefsTokenLength = strlen(animdefsToken); animdefsTokenLength = strlen(animdefsToken);
if (animdefsTokenLength>8) if (animdefsTokenLength>8)
{ {
I_Error("Error parsing ANIMDEFS lump: lump name \"%s\" exceeds 8 characters", animdefsToken); I_Error("Error parsing ANIMDEFS lump: lump name \"%s\" exceeds 8 characters", animdefsToken);
} }
strncpy(animdefs[i].endname, animdefsToken, 9); strncpy(animdefs[i].endname, animdefsToken, 9);
Z_Free(animdefsToken); Z_Free(animdefsToken);
@@ -504,15 +523,18 @@ void P_ParseAnimationDefintion(SINT8 istexture)
{ {
I_Error("Error parsing ANIMDEFS lump: Unexpected end of file where \"%s\"'s \"TICS\" should be", animdefs[i].startname); I_Error("Error parsing ANIMDEFS lump: Unexpected end of file where \"%s\"'s \"TICS\" should be", animdefs[i].startname);
} }
if (stricmp(animdefsToken, "RAND") == 0)
if (fasticmp(animdefsToken, "RAND"))
{ {
// This is technically legitimate ANIMDEFS syntax, but SRB2 doesn't support it. // This is technically legitimate ANIMDEFS syntax, but SRB2 doesn't support it.
I_Error("Error parsing ANIMDEFS lump: Animation definitions utilizing \"RAND\" (random duration per frame) are not supported by SRB2"); I_Error("Error parsing ANIMDEFS lump: Animation definitions utilizing \"RAND\" (random duration per frame) are not supported by SRB2");
} }
if (stricmp(animdefsToken, "TICS") != 0)
if (!fasticmp(animdefsToken, "TICS"))
{ {
I_Error("Error parsing ANIMDEFS lump: Expected \"TICS\" in animation definition for \"%s\", got \"%s\"", animdefs[i].startname, animdefsToken); I_Error("Error parsing ANIMDEFS lump: Expected \"TICS\" in animation definition for \"%s\", got \"%s\"", animdefs[i].startname, animdefsToken);
} }
Z_Free(animdefsToken); Z_Free(animdefsToken);
// Speed // Speed
@@ -521,6 +543,7 @@ void P_ParseAnimationDefintion(SINT8 istexture)
{ {
I_Error("Error parsing ANIMDEFS lump: Unexpected end of file where \"%s\"'s animation speed should be", animdefs[i].startname); I_Error("Error parsing ANIMDEFS lump: Unexpected end of file where \"%s\"'s animation speed should be", animdefs[i].startname);
} }
endPos = NULL; endPos = NULL;
#ifndef AVOID_ERRNO #ifndef AVOID_ERRNO
errno = 0; errno = 0;
@@ -535,6 +558,7 @@ void P_ParseAnimationDefintion(SINT8 istexture)
{ {
I_Error("Error parsing ANIMDEFS lump: Expected a positive integer for \"%s\"'s animation speed, got \"%s\"", animdefs[i].startname, animdefsToken); I_Error("Error parsing ANIMDEFS lump: Expected a positive integer for \"%s\"'s animation speed, got \"%s\"", animdefs[i].startname, animdefsToken);
} }
animdefs[i].speed = animSpeed; animdefs[i].speed = animSpeed;
Z_Free(animdefsToken); Z_Free(animdefsToken);
} }
@@ -2091,8 +2115,7 @@ static void P_ProcessLineSpecial(line_t *line, mobj_t *mo, sector_t *callsec)
// Change the music and apply position/fade operations // Change the music and apply position/fade operations
else else
{ {
strncpy(mapmusic.name, sides[line->sidenum[0]].text, 7); strlcpy(mapmusic.name, sides[line->sidenum[0]].text, sizeof(mapmusic.name));
mapmusic.name[6] = 0;
mapmusic.flags = tracknum & MUSIC_TRACKMASK; mapmusic.flags = tracknum & MUSIC_TRACKMASK;
if (!(line->flags & ML_BLOCKMONSTERS)) if (!(line->flags & ML_BLOCKMONSTERS))
+17 -7
View File
@@ -3315,7 +3315,7 @@ static ticcmd_t *P_CameraCmd(camera_t *cam, UINT8 num)
cmd->sidemove = (SINT8)(cmd->sidemove + side); cmd->sidemove = (SINT8)(cmd->sidemove + side);
} }
lang += (cmd->angleturn<<16); lang += (cmd->angleturn << 16);
cam->localangle = lang; cam->localangle = lang;
if (!cam->reset_aiming) if (!cam->reset_aiming)
@@ -3821,7 +3821,13 @@ boolean P_MoveChaseCamera(player_t *player, camera_t *thiscam, boolean resetcall
if (demo.playback) if (demo.playback)
{ {
focusangle = mo->angle; // 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.
focusaiming = 0; focusaiming = 0;
} }
else if (P_IsLocalPlayer(player)) else if (P_IsLocalPlayer(player))
@@ -4309,17 +4315,19 @@ static void P_CalcPostImg(player_t *player, camera_t *thiscam)
{ {
sector_t *sector = NULL; sector_t *sector = NULL;
UINT8 postimgtype = 0; UINT8 postimgtype = 0;
//INT32 *param;
fixed_t pviewheight = 0; 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]]) if (player == &players[displayplayers[i]])
{ {
param = &postimgparam[i]; param = &postimgparam[i];
break; break;
} }
}*/ }
#endif
if (encoremode) // srb2kart if (encoremode) // srb2kart
postimgtype |= POSTIMG_MIRROR; postimgtype |= POSTIMG_MIRROR;
@@ -4355,16 +4363,18 @@ static void P_CalcPostImg(player_t *player, camera_t *thiscam)
else if (P_CameraCheckHeatFirstperson(player, sector, pviewheight)) else if (P_CameraCheckHeatFirstperson(player, sector, pviewheight))
postimgtype |= POSTIMG_HEAT; postimgtype |= POSTIMG_HEAT;
#ifdef MOTIONBLUR
// Motion blur // Motion blur
// unused // unused
/*if (player->speed > (35<<FRACBITS)) if (player->speed > (35<<FRACBITS))
{ {
postimgtype |= POSTIMG_MOTION; postimgtype |= POSTIMG_MOTION;
*param = (player->speed - 32)/4; *param = (player->speed - 32)/4;
if (*param > 5) if (*param > 5)
*param = 5; *param = 5;
}*/ }
#endif
thiscam->postimg = postimgtype; thiscam->postimg = postimgtype;
} }
+31 -13
View File
@@ -867,7 +867,7 @@ static texpatch_t *R_ParsePatch(boolean actuallyLoadPatch)
I_Error("Error parsing TEXTURES lump: Unexpected end of file where comma after \"%s\"'s patch name should be",patchName); I_Error("Error parsing TEXTURES lump: Unexpected end of file where comma after \"%s\"'s patch name should be",patchName);
} }
if (strcmp(texturesToken,",")!=0) if (!fastcmp(texturesToken,","))
{ {
I_Error("Error parsing TEXTURES lump: Expected \",\" after %s's patch name, got \"%s\"",patchName,texturesToken); I_Error("Error parsing TEXTURES lump: Expected \",\" after %s's patch name, got \"%s\"",patchName,texturesToken);
} }
@@ -907,7 +907,7 @@ static texpatch_t *R_ParsePatch(boolean actuallyLoadPatch)
I_Error("Error parsing TEXTURES lump: Unexpected end of file where comma after patch \"%s\"'s x coordinate should be",patchName); I_Error("Error parsing TEXTURES lump: Unexpected end of file where comma after patch \"%s\"'s x coordinate should be",patchName);
} }
if (strcmp(texturesToken,",")!=0) if (!fastcmp(texturesToken,","))
{ {
I_Error("Error parsing TEXTURES lump: Expected \",\" after patch \"%s\"'s x coordinate, got \"%s\"",patchName,texturesToken); I_Error("Error parsing TEXTURES lump: Expected \",\" after patch \"%s\"'s x coordinate, got \"%s\"",patchName,texturesToken);
} }
@@ -976,8 +976,9 @@ static texture_t *R_ParseTexture(boolean actuallyLoadTexture)
{ {
I_Error("Error parsing TEXTURES lump: Unexpected end of file where texture name should be"); I_Error("Error parsing TEXTURES lump: Unexpected end of file where texture name should be");
} }
texturesTokenLength = strlen(texturesToken); texturesTokenLength = strlen(texturesToken);
if (texturesTokenLength>8) if (texturesTokenLength > 8)
{ {
I_Error("Error parsing TEXTURES lump: Texture name \"%s\" exceeds 8 characters",texturesToken); I_Error("Error parsing TEXTURES lump: Texture name \"%s\" exceeds 8 characters",texturesToken);
} }
@@ -988,6 +989,7 @@ static texture_t *R_ParseTexture(boolean actuallyLoadTexture)
// ^^ we've confirmed that the token is <= 8 characters so it will never overflow a 9 byte char buffer // ^^ we've confirmed that the token is <= 8 characters so it will never overflow a 9 byte char buffer
strupr(newTextureName); // Just do this now so we don't have to worry about it strupr(newTextureName); // Just do this now so we don't have to worry about it
} }
Z_Free(texturesToken); Z_Free(texturesToken);
// Comma 1 // Comma 1
@@ -996,10 +998,11 @@ static texture_t *R_ParseTexture(boolean actuallyLoadTexture)
{ {
I_Error("Error parsing TEXTURES lump: Unexpected end of file where comma after texture \"%s\"'s name should be",newTextureName); I_Error("Error parsing TEXTURES lump: Unexpected end of file where comma after texture \"%s\"'s name should be",newTextureName);
} }
else if (strcmp(texturesToken,",")!=0) else if (!fastcmp(texturesToken, ","))
{ {
I_Error("Error parsing TEXTURES lump: Expected \",\" after texture \"%s\"'s name, got \"%s\"",newTextureName,texturesToken); I_Error("Error parsing TEXTURES lump: Expected \",\" after texture \"%s\"'s name, got \"%s\"",newTextureName,texturesToken);
} }
Z_Free(texturesToken); Z_Free(texturesToken);
// Width // Width
@@ -1030,10 +1033,12 @@ static texture_t *R_ParseTexture(boolean actuallyLoadTexture)
{ {
I_Error("Error parsing TEXTURES lump: Unexpected end of file where comma after texture \"%s\"'s width should be",newTextureName); I_Error("Error parsing TEXTURES lump: Unexpected end of file where comma after texture \"%s\"'s width should be",newTextureName);
} }
if (strcmp(texturesToken,",")!=0)
if (!fastcmp(texturesToken, ","))
{ {
I_Error("Error parsing TEXTURES lump: Expected \",\" after texture \"%s\"'s width, got \"%s\"",newTextureName,texturesToken); I_Error("Error parsing TEXTURES lump: Expected \",\" after texture \"%s\"'s width, got \"%s\"",newTextureName,texturesToken);
} }
Z_Free(texturesToken); Z_Free(texturesToken);
// Height // Height
@@ -1066,7 +1071,7 @@ static texture_t *R_ParseTexture(boolean actuallyLoadTexture)
I_Error("Error parsing TEXTURES lump: Unexpected end of file where open curly brace for texture \"%s\" should be",newTextureName); I_Error("Error parsing TEXTURES lump: Unexpected end of file where open curly brace for texture \"%s\" should be",newTextureName);
} }
if (strcmp(texturesToken,"{")==0) if (fastcmp(texturesToken, "{"))
{ {
if (actuallyLoadTexture) if (actuallyLoadTexture)
{ {
@@ -1078,15 +1083,18 @@ static texture_t *R_ParseTexture(boolean actuallyLoadTexture)
resultTexture->height = newTextureHeight; resultTexture->height = newTextureHeight;
resultTexture->type = TEXTURETYPE_COMPOSITE; resultTexture->type = TEXTURETYPE_COMPOSITE;
} }
Z_Free(texturesToken); Z_Free(texturesToken);
texturesToken = M_GetToken(NULL); texturesToken = M_GetToken(NULL);
if (texturesToken == NULL) if (texturesToken == NULL)
{ {
I_Error("Error parsing TEXTURES lump: Unexpected end of file where patch definition for texture \"%s\" should be",newTextureName); I_Error("Error parsing TEXTURES lump: Unexpected end of file where patch definition for texture \"%s\" should be",newTextureName);
} }
while (strcmp(texturesToken,"}")!=0)
while (!fastcmp(texturesToken, "}"))
{ {
if (stricmp(texturesToken, "PATCH")==0) if (fasticmp(texturesToken, "PATCH"))
{ {
Z_Free(texturesToken); Z_Free(texturesToken);
if (resultTexture) if (resultTexture)
@@ -1118,6 +1126,7 @@ static texture_t *R_ParseTexture(boolean actuallyLoadTexture)
I_Error("Error parsing TEXTURES lump: Unexpected end of file where patch declaration or right curly brace for texture \"%s\" should be",newTextureName); I_Error("Error parsing TEXTURES lump: Unexpected end of file where patch declaration or right curly brace for texture \"%s\" should be",newTextureName);
} }
} }
if (resultTexture && resultTexture->patchcount == 0) if (resultTexture && resultTexture->patchcount == 0)
{ {
I_Error("Error parsing TEXTURES lump: Texture \"%s\" must have at least one patch",newTextureName); I_Error("Error parsing TEXTURES lump: Texture \"%s\" must have at least one patch",newTextureName);
@@ -1127,10 +1136,13 @@ static texture_t *R_ParseTexture(boolean actuallyLoadTexture)
{ {
I_Error("Error parsing TEXTURES lump: Expected \"{\" for texture \"%s\", got \"%s\"",newTextureName,texturesToken); I_Error("Error parsing TEXTURES lump: Expected \"{\" for texture \"%s\", got \"%s\"",newTextureName,texturesToken);
} }
Z_Free(texturesToken); Z_Free(texturesToken);
if (actuallyLoadTexture) return resultTexture; if (actuallyLoadTexture)
else return NULL; return resultTexture;
return NULL;
} }
// Parses the TEXTURES lump... but just to count the number of textures. // Parses the TEXTURES lump... but just to count the number of textures.
@@ -1162,7 +1174,7 @@ int R_CountTexturesInTEXTURESLump(UINT16 wadNum, UINT16 lumpNum)
texturesToken = M_GetToken(texturesText); texturesToken = M_GetToken(texturesText);
while (texturesToken != NULL) while (texturesToken != NULL)
{ {
if (stricmp(texturesToken, "WALLTEXTURE")==0) if (fasticmp(texturesToken, "WALLTEXTURE"))
{ {
numTexturesInLump++; numTexturesInLump++;
Z_Free(texturesToken); Z_Free(texturesToken);
@@ -1172,8 +1184,10 @@ int R_CountTexturesInTEXTURESLump(UINT16 wadNum, UINT16 lumpNum)
{ {
I_Error("Error parsing TEXTURES lump: Expected \"WALLTEXTURE\", got \"%s\"",texturesToken); I_Error("Error parsing TEXTURES lump: Expected \"WALLTEXTURE\", got \"%s\"",texturesToken);
} }
texturesToken = M_GetToken(NULL); texturesToken = M_GetToken(NULL);
} }
Z_Free(texturesToken); Z_Free(texturesToken);
Z_Free((void *)texturesText); Z_Free((void *)texturesText);
@@ -1211,7 +1225,7 @@ void R_ParseTEXTURESLump(UINT16 wadNum, UINT16 lumpNum, INT32 *texindex)
texturesToken = M_GetToken(texturesText); texturesToken = M_GetToken(texturesText);
while (texturesToken != NULL) while (texturesToken != NULL)
{ {
if (stricmp(texturesToken, "WALLTEXTURE")==0) if (fasticmp(texturesToken, "WALLTEXTURE"))
{ {
Z_Free(texturesToken); Z_Free(texturesToken);
// Get the new texture // Get the new texture
@@ -1227,8 +1241,10 @@ void R_ParseTEXTURESLump(UINT16 wadNum, UINT16 lumpNum, INT32 *texindex)
{ {
I_Error("Error parsing TEXTURES lump: Expected \"WALLTEXTURE\", got \"%s\"",texturesToken); I_Error("Error parsing TEXTURES lump: Expected \"WALLTEXTURE\", got \"%s\"",texturesToken);
} }
texturesToken = M_GetToken(NULL); texturesToken = M_GetToken(NULL);
} }
Z_Free(texturesToken); Z_Free(texturesToken);
Z_Free((void *)texturesText); Z_Free((void *)texturesText);
} }
@@ -1334,8 +1350,9 @@ lumpnum_t R_GetFlatNumForName(const char *name)
if (lump == LUMPERROR) if (lump == LUMPERROR)
{ {
if (strcmp(name, SKYFLATNAME)) if (!fastcmp(name, SKYFLATNAME))
CONS_Debug(DBG_SETUP, "R_GetFlatNumForName: Could not find flat %.8s\n", name); CONS_Debug(DBG_SETUP, "R_GetFlatNumForName: Could not find flat %.8s\n", name);
lump = W_CheckNumForName("REDFLR"); lump = W_CheckNumForName("REDFLR");
} }
@@ -1391,6 +1408,7 @@ void R_ReInitColormaps(UINT16 num, lumpnum_t newencoremap)
// Load in the light tables, now 64k aligned for smokie... // Load in the light tables, now 64k aligned for smokie...
lump = W_GetNumForName(colormap); lump = W_GetNumForName(colormap);
if (lump == LUMPERROR) if (lump == LUMPERROR)
lump = basecolormaplump; lump = basecolormaplump;
else else
+1 -1
View File
@@ -260,7 +260,7 @@ static void R_DrawColumnTemplate(drawcolumndata_t *dc)
// texture has no height, so just go // texture has no height, so just go
while (--count >= 0) 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; dest += stride;
frac += fracstep; frac += fracstep;
+24 -18
View File
@@ -208,15 +208,15 @@ static void R_CalcTiltedLighting(std::vector<INT32>& lightbuffer, INT32 x1, INT3
for (i = x1; i <= x2; i++) for (i = x1; i <= x2; i++)
{ {
fixed_t light = start >> FRACBITS; const fixed_t light = start >> FRACBITS;
lightbuffer[i] = CLAMP(light, 0, MAXLIGHTSCALE - 1); lightbuffer[i] = CLAMP(light, 0, MAXLIGHTSCALE - 1);
start += step; start += step;
} }
} }
static void R_GetTiltedLighting(std::vector<INT32>& tiltlighting, const drawspandata_t* ds, const float iz, const int width, const INT32 stride) static void R_GetTiltedLighting(std::vector<INT32>& tiltlighting, const drawspandata_t* ds, const float iz, const INT32 width, const INT32 stride)
{ {
float planelightfloat = PLANELIGHTFLOAT; const float planelightfloat = PLANELIGHTFLOAT;
const fixed_t lightstart = FloatToFixed(iz * planelightfloat); const fixed_t lightstart = FloatToFixed(iz * planelightfloat);
const fixed_t lightend = FloatToFixed((iz + ds->szp.x * width) * 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> template<DrawSpanType Type>
static void R_DrawTiltedSpanTemplate(drawspandata_t* ds) static void R_DrawTiltedSpanTemplate(drawspandata_t* ds)
{ {
int width = ds->x2 - ds->x1; INT32 width = ds->x2 - ds->x1;
float iz, uz, vz; float iz, uz, vz;
UINT32 u, v; UINT32 u, v;
int i; int i;
@@ -246,7 +246,6 @@ static void R_DrawTiltedSpanTemplate(drawspandata_t* ds)
UINT32 stepu, stepv; UINT32 stepu, stepv;
UINT32 bit; UINT32 bit;
INT32 x1 = ds->x1;
const INT32 nflatxshift = ds->nflatxshift; const INT32 nflatxshift = ds->nflatxshift;
const INT32 nflatyshift = ds->nflatyshift; const INT32 nflatyshift = ds->nflatyshift;
const INT32 nflatmask = ds->nflatmask; const INT32 nflatmask = ds->nflatmask;
@@ -263,6 +262,11 @@ static void R_DrawTiltedSpanTemplate(drawspandata_t* ds)
const UINT8 * restrict source = ds->source; const UINT8 * restrict source = ds->source;
const UINT8 * restrict colormap = ds->colormap; 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) if constexpr (Type & DS_RIPPLE)
{ {
dsrc = vid.screens[1] + (ds->y + ds->bgofs) * stride + ds->x1; dsrc = vid.screens[1] + (ds->y + ds->bgofs) * stride + ds->x1;
@@ -300,7 +304,6 @@ static void R_DrawTiltedSpanTemplate(drawspandata_t* ds)
izstep = ds->szp.x * SPANSIZE; izstep = ds->szp.x * SPANSIZE;
uzstep = ds->sup.x * SPANSIZE; uzstep = ds->sup.x * SPANSIZE;
vzstep = ds->svp.x * SPANSIZE; vzstep = ds->svp.x * SPANSIZE;
//x1 = 0;
width++; width++;
while (width >= SPANSIZE) while (width >= SPANSIZE)
@@ -317,12 +320,12 @@ static void R_DrawTiltedSpanTemplate(drawspandata_t* ds)
u = (INT64)(startu); u = (INT64)(startu);
v = (INT64)(startv); v = (INT64)(startv);
x1 = ds->x1; const INT32 x1 = ds->x1;
for (i = 0; i < SPANSIZE; i++) for (i = 0; i < SPANSIZE; i++)
{ {
bit = (((v + stepv * i) >> nflatyshift) & nflatmask) | ((u + stepu * i) >> nflatxshift); bit = (((v + stepv * i) >> nflatyshift) & nflatmask) | ((u + stepu * i) >> nflatxshift);
colormap = ds->planezlight[tiltlighting[x1 + i]] + (ds->colormap - colormaps); colormap = planezlight[tiltlight[x1 + i]] + colormap_diff;
if constexpr (Type & DS_RIPPLE) if constexpr (Type & DS_RIPPLE)
dest[i] = R_DrawSpanPixel<Type>(ds, &dsrc[i], colormap, bit, source); dest[i] = R_DrawSpanPixel<Type>(ds, &dsrc[i], colormap, bit, source);
else else
@@ -345,7 +348,7 @@ static void R_DrawTiltedSpanTemplate(drawspandata_t* ds)
u = (INT64)(startu); u = (INT64)(startu);
v = (INT64)(startv); v = (INT64)(startv);
bit = ((v >> nflatyshift) & nflatmask) | (u >> nflatxshift); bit = ((v >> nflatyshift) & nflatmask) | (u >> nflatxshift);
colormap = ds->planezlight[tiltlighting[ds->x1]] + (ds->colormap - colormaps); colormap = planezlight[tiltlight[ds->x1]] + colormap_diff;
if constexpr (Type & DS_RIPPLE) if constexpr (Type & DS_RIPPLE)
*dest = R_DrawSpanPixel<Type>(ds, dsrc, colormap, bit, source); *dest = R_DrawSpanPixel<Type>(ds, dsrc, colormap, bit, source);
else else
@@ -371,7 +374,7 @@ static void R_DrawTiltedSpanTemplate(drawspandata_t* ds)
for (; width != 0; width--) for (; width != 0; width--)
{ {
bit = ((v >> ds->nflatyshift) & ds->nflatmask) | (u >> ds->nflatxshift); bit = ((v >> ds->nflatyshift) & ds->nflatmask) | (u >> ds->nflatxshift);
colormap = ds->planezlight[tiltlighting[ds->x1]] + (ds->colormap - colormaps); colormap = planezlight[tiltlight[ds->x1]] + colormap_diff;
if constexpr (Type & DS_RIPPLE) if constexpr (Type & DS_RIPPLE)
*dest = R_DrawSpanPixel<Type>(ds, dsrc, colormap, bit, source); *dest = R_DrawSpanPixel<Type>(ds, dsrc, colormap, bit, source);
else else
@@ -410,7 +413,7 @@ DEFINE_SPAN_COMBO(R_DrawTranslucentWaterSpan, DS_TRANSMAP|DS_RIPPLE)
*/ */
void R_DrawFogSpan(drawspandata_t* ds) void R_DrawFogSpan(drawspandata_t* ds)
{ {
INT32 count = ds->x2 - ds->x1 + 1; intptr_t count = ds->x2 - ds->x1 + 1;
const UINT8 * restrict colormap = ds->colormap; const UINT8 * restrict colormap = ds->colormap;
UINT8 * restrict dest = R_Address(ds->x1, ds->y); UINT8 * restrict dest = R_Address(ds->x1, ds->y);
@@ -435,20 +438,23 @@ void R_DrawFogSpan(drawspandata_t* ds)
void R_DrawFogSpan_Tilted(drawspandata_t* ds) void R_DrawFogSpan_Tilted(drawspandata_t* ds)
{ {
int width = ds->x2 - ds->x1; INT32 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; 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);
local_for_thread std::vector<INT32> tiltlighting;
// Lighting is simple. It's just linear interpolation from start to end // Lighting is simple. It's just linear interpolation from start to end
R_GetTiltedLighting(tiltlighting, ds, iz, width, stride); R_GetTiltedLighting(tiltlighting, ds, iz, width, stride);
const INT32 * restrict tiltlight = tiltlighting.data();
lighttable_t * const * restrict planezlight = ds->planezlight;
do do
{ {
UINT8 *colormap = ds->planezlight[tiltlighting[ds->x1++]] + (ds->colormap - colormaps); UINT8 *colormap = planezlight[tiltlight[ds->x1++]] + colormap_diff;
*dest = colormap[*dest]; *dest = colormap[*dest];
dest++; dest++;
} }
+4 -1
View File
@@ -253,6 +253,7 @@ void SplitScreen_OnChange(void)
if (playeringame[i] && i != consoleplayer) if (playeringame[i] && i != consoleplayer)
{ {
UINT8 j; UINT8 j;
for (j = 1; j < MAXSPLITSCREENPLAYERS; j++) for (j = 1; j < MAXSPLITSCREENPLAYERS; j++)
{ {
if (displayplayers[j] == consoleplayer) if (displayplayers[j] == consoleplayer)
@@ -268,6 +269,7 @@ void SplitScreen_OnChange(void)
} }
} }
} }
static void Fov_OnChange(void) static void Fov_OnChange(void)
{ {
R_SetViewSize(); R_SetViewSize();
@@ -943,9 +945,10 @@ void R_ExecuteSetViewSize(void)
memset(scalelight, 0xFF, sizeof(scalelight)); memset(scalelight, 0xFF, sizeof(scalelight));
// Calculate the light levels to use for each level/scale combination. // 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; startmapl = ((LIGHTLEVELS - 1 - i)*2)*NUMCOLORMAPS/LIGHTLEVELS;
for (j = 0; j < MAXLIGHTSCALE; j++) for (j = 0; j < MAXLIGHTSCALE; j++)
{ {
level = startmapl - j*vid.width/(viewwidth)/DISTMAP; level = startmapl - j*vid.width/(viewwidth)/DISTMAP;
+31 -19
View File
@@ -46,12 +46,13 @@ static void R_ParseSpriteInfoFrame(spriteinfo_t *info)
{ {
I_Error("Error parsing SPRTINFO lump: Unexpected end of file where sprite frame should be"); I_Error("Error parsing SPRTINFO lump: Unexpected end of file where sprite frame should be");
} }
sprinfoTokenLength = strlen(sprinfoToken); sprinfoTokenLength = strlen(sprinfoToken);
if (sprinfoTokenLength != 1) if (sprinfoTokenLength != 1)
{ {
I_Error("Error parsing SPRTINFO lump: Invalid frame \"%s\"",sprinfoToken); I_Error("Error parsing SPRTINFO lump: Invalid frame \"%s\"",sprinfoToken);
} }
else
frameChar = sprinfoToken; frameChar = sprinfoToken;
frameFrame = R_Char2Frame(frameChar[0]); frameFrame = R_Char2Frame(frameChar[0]);
@@ -61,9 +62,8 @@ static void R_ParseSpriteInfoFrame(spriteinfo_t *info)
sprinfoToken = M_GetToken(NULL); sprinfoToken = M_GetToken(NULL);
if (sprinfoToken == NULL) if (sprinfoToken == NULL)
I_Error("Error parsing SPRTINFO lump: Missing sprite info"); I_Error("Error parsing SPRTINFO lump: Missing sprite info");
else
{ if (fastcmp(sprinfoToken, "{"))
if (strcmp(sprinfoToken,"{")==0)
{ {
Z_Free(sprinfoToken); Z_Free(sprinfoToken);
sprinfoToken = M_GetToken(NULL); sprinfoToken = M_GetToken(NULL);
@@ -71,31 +71,32 @@ static void R_ParseSpriteInfoFrame(spriteinfo_t *info)
{ {
I_Error("Error parsing SPRTINFO lump: Unexpected end of file where sprite info should be"); I_Error("Error parsing SPRTINFO lump: Unexpected end of file where sprite info should be");
} }
while (strcmp(sprinfoToken,"}")!=0) while (!fastcmp(sprinfoToken, "}"))
{ {
if (stricmp(sprinfoToken, "XPIVOT")==0) if (fasticmp(sprinfoToken, "XPIVOT"))
{ {
Z_Free(sprinfoToken); Z_Free(sprinfoToken);
sprinfoToken = M_GetToken(NULL); sprinfoToken = M_GetToken(NULL);
frameXPivot = atoi(sprinfoToken); frameXPivot = atoi(sprinfoToken);
} }
else if (stricmp(sprinfoToken, "YPIVOT")==0) else if (fasticmp(sprinfoToken, "YPIVOT"))
{ {
Z_Free(sprinfoToken); Z_Free(sprinfoToken);
sprinfoToken = M_GetToken(NULL); sprinfoToken = M_GetToken(NULL);
frameYPivot = atoi(sprinfoToken); frameYPivot = atoi(sprinfoToken);
} }
else if (stricmp(sprinfoToken, "ROTAXIS")==0) else if (fasticmp(sprinfoToken, "ROTAXIS"))
{ {
Z_Free(sprinfoToken); Z_Free(sprinfoToken);
sprinfoToken = M_GetToken(NULL); sprinfoToken = M_GetToken(NULL);
if ((stricmp(sprinfoToken, "X")==0) || (stricmp(sprinfoToken, "XAXIS")==0) || (stricmp(sprinfoToken, "ROLL")==0)) if (fasticmp(sprinfoToken, "X") || fasticmp(sprinfoToken, "XAXIS") || fasticmp(sprinfoToken, "ROLL"))
frameRotAxis = ROTAXIS_X; frameRotAxis = ROTAXIS_X;
else if ((stricmp(sprinfoToken, "Y")==0) || (stricmp(sprinfoToken, "YAXIS")==0) || (stricmp(sprinfoToken, "PITCH")==0)) else if (fasticmp(sprinfoToken, "Y") || fasticmp(sprinfoToken, "YAXIS") || fasticmp(sprinfoToken, "PITCH"))
frameRotAxis = ROTAXIS_Y; frameRotAxis = ROTAXIS_Y;
else if ((stricmp(sprinfoToken, "Z")==0) || (stricmp(sprinfoToken, "ZAXIS")==0) || (stricmp(sprinfoToken, "YAW")==0)) else if (fasticmp(sprinfoToken, "Z") || fasticmp(sprinfoToken, "ZAXIS") || fasticmp(sprinfoToken, "YAW"))
frameRotAxis = ROTAXIS_Z; frameRotAxis = ROTAXIS_Z;
} }
Z_Free(sprinfoToken); Z_Free(sprinfoToken);
sprinfoToken = M_GetToken(NULL); sprinfoToken = M_GetToken(NULL);
@@ -105,8 +106,8 @@ static void R_ParseSpriteInfoFrame(spriteinfo_t *info)
} }
} }
} }
Z_Free(sprinfoToken); Z_Free(sprinfoToken);
}
// set fields // set fields
info->pivot[frameFrame].x = frameXPivot; info->pivot[frameFrame].x = frameXPivot;
@@ -137,6 +138,7 @@ static void R_ParseSpriteInfo(boolean spr2)
{ {
I_Error("Error parsing SPRTINFO lump: Unexpected end of file where sprite name should be"); I_Error("Error parsing SPRTINFO lump: Unexpected end of file where sprite name should be");
} }
sprinfoTokenLength = strlen(sprinfoToken); sprinfoTokenLength = strlen(sprinfoToken);
if (sprinfoTokenLength != 4) if (sprinfoTokenLength != 4)
{ {
@@ -149,6 +151,7 @@ static void R_ParseSpriteInfo(boolean spr2)
// ^^ we've confirmed that the token is == 4 characters so it will never overflow a 5 byte char buffer // ^^ we've confirmed that the token is == 4 characters so it will never overflow a 5 byte char buffer
strupr(newSpriteName); // Just do this now so we don't have to worry about it strupr(newSpriteName); // Just do this now so we don't have to worry about it
} }
Z_Free(sprinfoToken); Z_Free(sprinfoToken);
if (!spr2) if (!spr2)
@@ -157,7 +160,8 @@ static void R_ParseSpriteInfo(boolean spr2)
{ {
if (i == NUMSPRITES) if (i == NUMSPRITES)
I_Error("Error parsing SPRTINFO lump: Unknown sprite name \"%s\"", newSpriteName); I_Error("Error parsing SPRTINFO lump: Unknown sprite name \"%s\"", newSpriteName);
if (!memcmp(newSpriteName,sprnames[i],4))
if (!memcmp(newSpriteName,sprnames[i], 4))
{ {
sprnum = static_cast<spritenum_t>(i); sprnum = static_cast<spritenum_t>(i);
break; break;
@@ -175,17 +179,20 @@ static void R_ParseSpriteInfo(boolean spr2)
{ {
I_Error("Error parsing SPRTINFO lump: Unexpected end of file where open curly brace for sprite \"%s\" should be",newSpriteName); I_Error("Error parsing SPRTINFO lump: Unexpected end of file where open curly brace for sprite \"%s\" should be",newSpriteName);
} }
if (strcmp(sprinfoToken,"{")==0)
if (fastcmp(sprinfoToken, "{"))
{ {
Z_Free(sprinfoToken); Z_Free(sprinfoToken);
sprinfoToken = M_GetToken(NULL); sprinfoToken = M_GetToken(NULL);
if (sprinfoToken == NULL) if (sprinfoToken == NULL)
{ {
I_Error("Error parsing SPRTINFO lump: Unexpected end of file where definition for sprite \"%s\" should be",newSpriteName); I_Error("Error parsing SPRTINFO lump: Unexpected end of file where definition for sprite \"%s\" should be",newSpriteName);
} }
while (strcmp(sprinfoToken,"}")!=0)
while (!fastcmp(sprinfoToken, "}"))
{ {
if (stricmp(sprinfoToken, "SKIN")==0) if (fasticmp(sprinfoToken, "SKIN"))
{ {
INT32 skinnum; INT32 skinnum;
char *skinName = NULL; char *skinName = NULL;
@@ -216,10 +223,11 @@ static void R_ParseSpriteInfo(boolean spr2)
skinnumbers[foundskins] = skinnum; skinnumbers[foundskins] = skinnum;
foundskins++; foundskins++;
} }
else if (stricmp(sprinfoToken, "FRAME")==0) else if (fasticmp(sprinfoToken, "FRAME"))
{ {
R_ParseSpriteInfoFrame(info); R_ParseSpriteInfoFrame(info);
Z_Free(sprinfoToken); Z_Free(sprinfoToken);
if (spr2) if (spr2)
{ {
if (!foundskins) if (!foundskins)
@@ -254,6 +262,7 @@ static void R_ParseSpriteInfo(boolean spr2)
{ {
I_Error("Error parsing SPRTINFO lump: Expected \"{\" for sprite \"%s\", got \"%s\"",newSpriteName,sprinfoToken); I_Error("Error parsing SPRTINFO lump: Expected \"{\" for sprite \"%s\", got \"%s\"",newSpriteName,sprinfoToken);
} }
Z_Free(sprinfoToken); Z_Free(sprinfoToken);
Z_Free(info); Z_Free(info);
} }
@@ -291,15 +300,18 @@ void R_ParseSPRTINFOLump(UINT16 wadNum, UINT16 lumpNum)
while (sprinfoToken != NULL) while (sprinfoToken != NULL)
{ {
CONS_Printf("Attempting to parse le SPRTINFO lump for ya..\n"); CONS_Printf("Attempting to parse le SPRTINFO lump for ya..\n");
if (!stricmp(sprinfoToken, "SPRITE"))
if (fasticmp(sprinfoToken, "SPRITE"))
R_ParseSpriteInfo(false); R_ParseSpriteInfo(false);
else if (!stricmp(sprinfoToken, "SPRITE2")) else if (fasticmp(sprinfoToken, "SPRITE2"))
R_ParseSpriteInfo(true); R_ParseSpriteInfo(true);
else else
I_Error("Error parsing SPRTINFO lump: Unknown keyword \"%s\"", sprinfoToken); I_Error("Error parsing SPRTINFO lump: Unknown keyword \"%s\"", sprinfoToken);
Z_Free(sprinfoToken); Z_Free(sprinfoToken);
sprinfoToken = M_GetToken(NULL); sprinfoToken = M_GetToken(NULL);
} }
Z_Free((void *)sprinfoText); Z_Free((void *)sprinfoText);
} }
+142 -122
View File
@@ -33,7 +33,7 @@
#include "qs22j.h" #include "qs22j.h"
CV_PossibleValue_t Forceskin_cons_t[MAXSKINS+2]; CV_PossibleValue_t Forceskin_cons_t[MAXSKINS+2]; // huehuehuehuehue
#include "discord.h" #include "discord.h"
@@ -41,6 +41,7 @@ INT32 numskins = 0;
INT32 numallskins = 0; INT32 numallskins = 0;
INT32 numlocalskins = 0; INT32 numlocalskins = 0;
skin_t skins[MAXSKINS]; skin_t skins[MAXSKINS];
UINT8 skinstats[9][9][MAXSKINS]; UINT8 skinstats[9][9][MAXSKINS];
UINT8 skinstatscount[9][9] = { UINT8 skinstatscount[9][9] = {
{0, 0, 0, 0, 0, 0, 0, 0, 0}, {0, 0, 0, 0, 0, 0, 0, 0, 0},
@@ -53,6 +54,7 @@ UINT8 skinstatscount[9][9] = {
{0, 1, 0, 0, 0, 0, 0, 0, 0}, {0, 1, 0, 0, 0, 0, 0, 0, 0},
{0, 0, 0, 0, 0, 0, 0, 0, 0} {0, 0, 0, 0, 0, 0, 0, 0, 0}
}; };
UINT8 skinsorted[MAXSKINS]; UINT8 skinsorted[MAXSKINS];
skin_t localskins[MAXLOCALSKINS]; skin_t localskins[MAXLOCALSKINS];
skin_t allskins[MAXSKINS+MAXLOCALSKINS]; skin_t allskins[MAXSKINS+MAXLOCALSKINS];
@@ -70,13 +72,14 @@ static void Sk_SetDefaultValue(skin_t *skin, boolean local)
// //
// set default skin values // set default skin values
// //
memset(skin, 0, sizeof (skin_t)); memset(skin, 0, sizeof(skin_t));
snprintf(skin->name, sizeof skin->name, "skin %u", K_GetMobjSkinNum(skin, local)); snprintf(skin->name, sizeof skin->name, "skin %u", K_GetMobjSkinNum(skin, local));
skin->name[sizeof skin->name - 1] = '\0'; skin->name[sizeof skin->name - 1] = '\0';
skin->wadnum = INT16_MAX;
strcpy(skin->sprite, "");
skin->flags = 0; skin->wadnum = INT16_MAX;
strcpy(skin->sprite, "");
strcpy(skin->realname, "Someone"); strcpy(skin->realname, "Someone");
strcpy(skin->hudname, "???"); strcpy(skin->hudname, "???");
@@ -95,8 +98,12 @@ static void Sk_SetDefaultValue(skin_t *skin, boolean local)
skin->highresscale = FRACUNIT>>1; skin->highresscale = FRACUNIT>>1;
for (i = 0; i < sfx_skinsoundslot0; i++) for (i = 0; i < sfx_skinsoundslot0; i++)
if (S_sfx[i].skinsound != -1) {
skin->soundsid[S_sfx[i].skinsound] = i; const INT32 skinsound = S_sfx[i].skinsound;
if (skinsound != -1)
skin->soundsid[skinsound] = i;
}
} }
// //
@@ -124,6 +131,7 @@ void R_InitSkins(void)
skin = &skins[0]; skin = &skins[0];
numskins = 1; numskins = 1;
Sk_SetDefaultValue(skin, false); Sk_SetDefaultValue(skin, false);
memset(skinstats, 0, sizeof(skinstats)); memset(skinstats, 0, sizeof(skinstats));
memset(skinsorted, 0, sizeof(skinsorted)); memset(skinsorted, 0, sizeof(skinsorted));
@@ -132,13 +140,16 @@ void R_InitSkins(void)
#ifdef SKINVALUES #ifdef SKINVALUES
skin_cons_t[0].strvalue = skins[0].name; skin_cons_t[0].strvalue = skins[0].name;
#endif #endif
skin->flags = 0;
strcpy(skin->realname, "Sonic"); strcpy(skin->realname, "Sonic");
strcpy(skin->hudname, "SONIC"); strcpy(skin->hudname, "SONIC");
strncpy(skin->facerank, "PLAYRANK", 9); strncpy(skin->facerank, "PLAYRANK", 9);
strncpy(skin->facewant, "PLAYWANT", 9); strncpy(skin->facewant, "PLAYWANT", 9);
strncpy(skin->facemmap, "PLAYMMAP", 9); strncpy(skin->facemmap, "PLAYMMAP", 9);
skin->flags = 0;
skin->wadnum = 0; // god what have you brought to this world skin->wadnum = 0; // god what have you brought to this world
skin->prefcolor = SKINCOLOR_BLUE; skin->prefcolor = SKINCOLOR_BLUE;
skin->localskin = false; skin->localskin = false;
@@ -177,9 +188,10 @@ INT32 R_SkinAvailable(const char *name)
for (i = 0; i < numskins; i++) for (i = 0; i < numskins; i++)
{ {
if (stricmp(skins[i].name,name) == 0) if (fasticmp(skins[i].name, name))
return i; return i;
} }
return -1; return -1;
} }
@@ -191,9 +203,10 @@ INT32 R_AnySkinAvailable(const char *name)
for (i = 0; i < numallskins; i++) for (i = 0; i < numallskins; i++)
{ {
if (stricmp(allskins[i].name,name) == 0) if (fasticmp(allskins[i].name, name))
return i; return i;
} }
return -1; return -1;
} }
@@ -205,12 +218,13 @@ INT32 R_LocalSkinAvailable(const char *name, boolean local)
{ {
for (i = 0; i < numlocalskins; i++) for (i = 0; i < numlocalskins; i++)
{ {
if (stricmp(localskins[i].name,name) == 0) if (fasticmp(localskins[i].name, name))
return i; return i;
} }
return -1; return -1;
} }
else
return R_SkinAvailable(name); return R_SkinAvailable(name);
} }
@@ -218,19 +232,18 @@ INT32 R_LocalSkinAvailable(const char *name, boolean local)
boolean SetPlayerSkin(INT32 playernum, const char *skinname) boolean SetPlayerSkin(INT32 playernum, const char *skinname)
{ {
INT32 i; INT32 i;
player_t *player = &players[playernum];
for (i = 0; i < numskins; i++) for (i = 0; i < numskins; i++)
{ {
// search in the skin list // search in the skin list
if (stricmp(skins[i].name, skinname) == 0) if (fasticmp(skins[i].name, skinname))
{ {
SetPlayerSkinByNum(playernum, i); SetPlayerSkinByNum(playernum, i);
return true; return true;
} }
} }
if (P_IsLocalPlayer(player)) if (P_IsLocalPlayer(&players[playernum]))
CONS_Alert(CONS_WARNING, M_GetText("Skin '%s' not found.\n"), skinname); CONS_Alert(CONS_WARNING, M_GetText("Skin '%s' not found.\n"), skinname);
else if (server || IsPlayerAdmin(consoleplayer)) else if (server || IsPlayerAdmin(consoleplayer))
CONS_Alert(CONS_WARNING, M_GetText("Player %d (%s) skin '%s' not found\n"), playernum, player_names[playernum], skinname); CONS_Alert(CONS_WARNING, M_GetText("Player %d (%s) skin '%s' not found\n"), playernum, player_names[playernum], skinname);
@@ -244,15 +257,16 @@ void SetLocalPlayerSkin(INT32 playernum, const char *skinname, consvar_t *cvar)
INT32 i; INT32 i;
player_t *player = &players[playernum]; player_t *player = &players[playernum];
if (stricmp(skinname, "none")) if (!fasticmp(skinname, "none"))
{ {
for (i = 0; i < numlocalskins; i++) for (i = 0; i < numlocalskins; i++)
{ {
// search in the localskin list // search in the localskin list
if (stricmp(localskins[i].name, skinname) == 0) if (fasticmp(localskins[i].name, skinname))
{ {
player->localskin = 1 + i; player->localskin = 1 + i;
player->skinlocal = true; player->skinlocal = true;
if (player->mo) if (player->mo)
{ {
player->mo->localskin = &localskins[i]; player->mo->localskin = &localskins[i];
@@ -266,10 +280,11 @@ void SetLocalPlayerSkin(INT32 playernum, const char *skinname, consvar_t *cvar)
for (i = 0; i < numskins; i++) for (i = 0; i < numskins; i++)
{ {
// search in the skin list // search in the skin list
if (stricmp(skins[i].name, skinname) == 0) if (fasticmp(skins[i].name, skinname))
{ {
player->localskin = 1 + i; player->localskin = 1 + i;
player->skinlocal = false; player->skinlocal = false;
if (player->mo) if (player->mo)
{ {
player->mo->localskin = &skins[i]; player->mo->localskin = &skins[i];
@@ -284,6 +299,7 @@ void SetLocalPlayerSkin(INT32 playernum, const char *skinname, consvar_t *cvar)
{ {
player->localskin = 0; player->localskin = 0;
player->skinlocal = false; player->skinlocal = false;
if (player->mo) if (player->mo)
{ {
player->mo->localskin = 0; player->mo->localskin = 0;
@@ -318,6 +334,7 @@ void SetPlayerSkinByNum(INT32 playernum, INT32 skinnum)
if (skinnum >= 0 && skinnum < numskins) // Make sure it exists! if (skinnum >= 0 && skinnum < numskins) // Make sure it exists!
{ {
player->skin = skinnum; player->skin = skinnum;
if (player->mo) if (player->mo)
player->mo->skin = skin; player->mo->skin = skin;
@@ -360,117 +377,97 @@ void SetPlayerSkinByNum(INT32 playernum, INT32 skinnum)
static UINT16 W_CheckForSkinMarkerInPwad(UINT16 wadid, UINT16 startlump) static UINT16 W_CheckForSkinMarkerInPwad(UINT16 wadid, UINT16 startlump)
{ {
UINT16 i; UINT16 i;
const char *S_SKIN = "S_SKIN";
lumpinfo_t *lump_p; lumpinfo_t *lump_p;
// scan forward, start at <startlump> // scan forward, start at <startlump>
if (startlump < wadfiles[wadid]->numlumps) if (startlump < wadfiles[wadid]->numlumps)
{ {
lump_p = wadfiles[wadid]->lumpinfo + startlump; lump_p = wadfiles[wadid]->lumpinfo + startlump;
for (i = startlump; i < wadfiles[wadid]->numlumps; i++, lump_p++) for (i = startlump; i < wadfiles[wadid]->numlumps; i++, lump_p++)
if (memcmp(lump_p->name,S_SKIN,6)==0) {
if (memcmp(lump_p->name, "S_SKIN", 6) == 0)
return i; return i;
} }
}
return INT16_MAX; // not found return INT16_MAX; // not found
} }
//sort function for sorting skin names //sort function for sorting skin names
static int skinSortFunc(const void *a, const void *b) //tbh i have no clue what the naming conventions for local functions are static int skinSortFunc(const void *a, const void *b) // tbh i have no clue what the naming conventions for local functions are
{ {
const skin_t *in1 = &skins[*(const UINT8 *)a]; int diff = 0;
const skin_t *in2 = &skins[*(const UINT8 *)b]; const UINT8 val_a = *(const UINT8 *)a;
INT32 temp = 0; const UINT8 val_b = *(const UINT8 *)b;
const UINT8 val_a = *((const UINT8 *)a); const skin_t *in1 = &skins[val_a];
const UINT8 val_b = *((const UINT8 *)b); const skin_t *in2 = &skins[val_b];
//return (strcmp(in1->realname, in2->realname) < 0) || (strcmp(in1->realname, in2->realname) ==); // return (strcmp(in1->realname, in2->realname) < 0) || (strcmp(in1->realname, in2->realname) ==);
switch (cv_skinselectgridsort.value) switch (cv_skinselectgridsort.value)
{ {
case SKINMENUSORT_REALNAME: case SKINMENUSORT_REALNAME:
//CONS_Printf("Sorting by realname\n"); // CONS_Printf("Sorting by realname\n");
// check name // check name
if ((temp = strcmp(in1->realname, in2->realname))) diff = strcmp(in1->realname, in2->realname);
return temp; if (diff != 0) return diff;
// sort by internal name
return strcmp(in1->name, in2->name);
break;
case SKINMENUSORT_NAME:
//CONS_Printf("Sorting by name\n");
return strcmp(in1->name, in2->name);
break; break;
case SKINMENUSORT_SPEED: case SKINMENUSORT_SPEED:
//CONS_Printf("Sorting by speed\n"); // CONS_Printf("Sorting by speed\n");
// check speed // check speed
if (in1->kartspeed < in2->kartspeed) diff = in1->kartspeed - in2->kartspeed;
return -1; if (diff != 0) return diff;
else if (in2->kartspeed < in1->kartspeed)
return 1;
// then check weight // then check weight
if (in1->kartweight < in2->kartweight) diff = in1->kartweight - in2->kartweight;
return -1; if (diff != 0) return diff;
else if (in2->kartweight < in1->kartweight)
return 1;
// then check name
if ((temp = strcmp(in1->realname, in2->realname)))
return temp;
// sort by internal name
return strcmp(in1->name, in2->name);
break;
// then check name
diff = strcmp(in1->realname, in2->realname);
if (diff != 0) return diff;
break;
case SKINMENUSORT_WEIGHT: case SKINMENUSORT_WEIGHT:
//CONS_Printf("Sorting by weight\n"); // CONS_Printf("Sorting by weight\n");
// check weight // check weight
if (in1->kartweight < in2->kartweight) diff = in1->kartweight - in2->kartweight;
return -1; if (diff != 0) return diff;
else if (in2->kartweight < in1->kartweight)
return 1;
// then check speed // then check speed
if (in1->kartspeed < in2->kartspeed) diff = in1->kartspeed - in2->kartspeed;
return -1; if (diff != 0) return diff;
else if (in2->kartspeed < in1->kartspeed)
return 1;
// then check name
if ((temp = strcmp(in1->realname, in2->realname)))
return temp;
// sort by internal name
return strcmp(in1->name, in2->name);
break;
// then check name
diff = strcmp(in1->realname, in2->realname);
if (diff != 0) return diff;
break;
case SKINMENUSORT_PREFCOLOR: case SKINMENUSORT_PREFCOLOR:
//CONS_Printf("Sorting by prefcolor\n"); // CONS_Printf("Sorting by prefcolor\n");
// check prefcolor // check prefcolor
if (in1->prefcolor < in2->prefcolor) diff = in1->prefcolor - in2->prefcolor;
return -1; if (diff != 0) return diff;
else if (in2->prefcolor < in1->prefcolor)
return 1;
// then check name // then check name
if ((temp = strcmp(in1->realname, in2->realname))) diff = strcmp(in1->realname, in2->realname);
return temp; if (diff != 0) return diff;
// sort by internal name
return strcmp(in1->name, in2->name);
break; break;
case SKINMENUSORT_ID: case SKINMENUSORT_ID:
//CONS_Printf("Sorting by id\n"); // CONS_Printf("Sorting by id\n");
//how do i do by ID????? // how do i do by ID?????
//wait why dont i just convert the inputs to UINT32s // wait why dont i just convert the inputs to UINT32s
//please tell me im allowed to define variables in here since its a block // please tell me im allowed to define variables in here since its a block
return (int)val_a - (int)val_b;
if (val_a == val_b) case SKINMENUSORT_NAME:
return 0;
else if (val_a < val_b)
return -1;
else
return 1;
default: default:
return strcmp(in1->name, in2->name);
break; break;
} }
//im scared this somehow will sometimes end up here so im gonna add this here just to be safe
// im scared this somehow will sometimes end up here so im gonna add this here just to be safe
// now it will often end up here >:3
return strcmp(in1->name, in2->name); return strcmp(in1->name, in2->name);
} }
@@ -531,8 +528,9 @@ void R_AddSkins(UINT16 wadnum, boolean local)
Sk_SetDefaultValue(skin, local); Sk_SetDefaultValue(skin, local);
skin->wadnum = wadnum; skin->wadnum = wadnum;
hudname = realname = false; hudname = realname = false;
// parse // parse
stoken = strtok (buf2, "\r\n= "); stoken = strtok(buf2, "\r\n= ");
while (stoken) while (stoken)
{ {
if ((stoken[0] == '/' && stoken[1] == '/') if ((stoken[0] == '/' && stoken[1] == '/')
@@ -548,7 +546,7 @@ void R_AddSkins(UINT16 wadnum, boolean local)
if (!value) if (!value)
I_Error("R_AddSkins: syntax error in S_SKIN lump# %d(%s) in WAD %s\n", lump, W_CheckNameForNumPwad(wadnum,lump), wadfiles[wadnum]->filename); I_Error("R_AddSkins: syntax error in S_SKIN lump# %d(%s) in WAD %s\n", lump, W_CheckNameForNumPwad(wadnum,lump), wadfiles[wadnum]->filename);
if (!stricmp(stoken, "name")) if (fasticmp(stoken, "name"))
{ {
// the skin name must uniquely identify a single skin // the skin name must uniquely identify a single skin
// I'm lazy so if name is already used I leave the 'skin x' // I'm lazy so if name is already used I leave the 'skin x'
@@ -562,18 +560,18 @@ void R_AddSkins(UINT16 wadnum, boolean local)
// using the default skin name's number set above // using the default skin name's number set above
else else
{ {
const size_t stringspace = const size_t stringspace = strlen(value) + sizeof lnumskins + 1;
strlen(value) + sizeof lnumskins + 1;
char *value2 = Z_Malloc(stringspace, PU_STATIC, NULL); char *value2 = Z_Malloc(stringspace, PU_STATIC, NULL);
snprintf(value2, stringspace,
"%s%d", value, lnumskins); snprintf(value2, stringspace, "%s%d", value, lnumskins);
value2[stringspace - 1] = '\0'; value2[stringspace - 1] = '\0';
if (R_LocalSkinAvailable(value2, local) == -1) if (R_LocalSkinAvailable(value2, local) == -1)
{ {
STRBUFCPY(skin->name, STRBUFCPY(skin->name, value2);
value2);
strlwr(skin->name); strlwr(skin->name);
} }
Z_Free(value2); Z_Free(value2);
} }
@@ -589,115 +587,134 @@ void R_AddSkins(UINT16 wadnum, boolean local)
{ {
STRBUFCPY(skin->hudname, skin->name); STRBUFCPY(skin->hudname, skin->name);
strupr(skin->hudname); strupr(skin->hudname);
for (value = skin->hudname; *value; value++) for (value = skin->hudname; *value; value++)
if (*value == '_') *value = ' '; // turn _ into spaces. if (*value == '_') *value = ' '; // turn _ into spaces.
} }
} }
else if (!stricmp(stoken, "realname")) else if (fasticmp(stoken, "realname"))
{ // Display name (eg. "Knuckles") { // Display name (eg. "Knuckles")
realname = true; realname = true;
STRBUFCPY(skin->realname, value); STRBUFCPY(skin->realname, value);
for (value = skin->realname; *value; value++) for (value = skin->realname; *value; value++)
if (*value == '_') *value = ' '; // turn _ into spaces. if (*value == '_') *value = ' '; // turn _ into spaces.
if (!hudname) if (!hudname)
STRBUFCPY(skin->hudname, skin->realname); STRBUFCPY(skin->hudname, skin->realname);
} }
else if (!stricmp(stoken, "hudname")) else if (fasticmp(stoken, "hudname"))
{ // Life icon name (eg. "K.T.E") { // Life icon name (eg. "K.T.E")
hudname = true; hudname = true;
STRBUFCPY(skin->hudname, value); STRBUFCPY(skin->hudname, value);
for (value = skin->hudname; *value; value++) for (value = skin->hudname; *value; value++)
if (*value == '_') *value = ' '; // turn _ into spaces. if (*value == '_') *value = ' '; // turn _ into spaces.
if (!realname) if (!realname)
STRBUFCPY(skin->realname, skin->hudname); STRBUFCPY(skin->realname, skin->hudname);
} }
else if (fasticmp(stoken, "sprite"))
else if (!stricmp(stoken, "sprite"))
{ {
strupr(value); strupr(value);
memcpy(skin->sprite, value, sizeof skin->sprite); memcpy(skin->sprite, value, sizeof skin->sprite);
} }
else if (!stricmp(stoken, "facerank")) else if (fasticmp(stoken, "facerank"))
{ {
strupr(value); strupr(value);
memcpy(skin->facerank, value, sizeof(skin->facerank)-1); memcpy(skin->facerank, value, sizeof(skin->facerank)-1);
skin->facerank[sizeof(skin->facerank)-1] = '\0'; skin->facerank[sizeof(skin->facerank)-1] = '\0';
} }
else if (!stricmp(stoken, "facewant")) else if (fasticmp(stoken, "facewant"))
{ {
strupr(value); strupr(value);
memcpy(skin->facewant, value, sizeof(skin->facewant)-1); memcpy(skin->facewant, value, sizeof(skin->facewant)-1);
skin->facewant[sizeof(skin->facewant)-1] = '\0'; skin->facewant[sizeof(skin->facewant)-1] = '\0';
} }
else if (!stricmp(stoken, "facemmap")) else if (fasticmp(stoken, "facemmap"))
{ {
strupr(value); strupr(value);
strncpy(skin->facemmap, value, sizeof(skin->facemmap)-1); strncpy(skin->facemmap, value, sizeof(skin->facemmap)-1);
skin->facemmap[sizeof(skin->facemmap)-1] = '\0'; skin->facemmap[sizeof(skin->facemmap)-1] = '\0';
} }
else if (!stricmp(stoken, "flags")) // character type identification else if (fasticmp(stoken, "flags")) // character type identification
{ {
skin->flags = get_number(value); skin->flags = get_number(value);
} }
else if (!stricmp(stoken, "kartspeed")) else if (fasticmp(stoken, "kartspeed"))
{ {
skin->kartspeed = atoi(value); skin->kartspeed = atoi(value);
if (skin->kartspeed < 1) if (skin->kartspeed < 1)
skin->kartspeed = 1; skin->kartspeed = 1;
if (skin->kartspeed > 9) if (skin->kartspeed > 9)
skin->kartspeed = 9; skin->kartspeed = 9;
} }
else if (!stricmp(stoken, "kartweight")) else if (fasticmp(stoken, "kartweight"))
{ {
skin->kartweight = atoi(value); skin->kartweight = atoi(value);
if (skin->kartweight < 1) if (skin->kartweight < 1)
skin->kartweight = 1; skin->kartweight = 1;
if (skin->kartweight > 9) if (skin->kartweight > 9)
skin->kartweight = 9; skin->kartweight = 9;
} }
// custom translation table // custom translation table
else if (!stricmp(stoken, "startcolor")) else if (fasticmp(stoken, "startcolor"))
{
skin->starttranscolor = atoi(value); skin->starttranscolor = atoi(value);
else if (!stricmp(stoken, "prefcolor")) }
else if (fasticmp(stoken, "prefcolor"))
{
skin->prefcolor = K_GetKartColorByName(value); skin->prefcolor = K_GetKartColorByName(value);
else if (!stricmp(stoken, "highresscale")) }
else if (fasticmp(stoken, "highresscale"))
{
skin->highresscale = FLOAT_TO_FIXED(atof(value)); skin->highresscale = FLOAT_TO_FIXED(atof(value));
}
else else
{ {
INT32 found = false; INT32 found = false;
sfxenum_t i; sfxenum_t i;
// copy name of sounds that are remapped // copy name of sounds that are remapped
// for this skin // for this skin
for (i = 0; i < sfx_skinsoundslot0; i++) for (i = 0; i < sfx_skinsoundslot0; i++)
{ {
if (!S_sfx[i].name) const sfxinfo_t *sfx = &S_sfx[i];
if (!sfx->name)
continue; continue;
if (S_sfx[i].skinsound != -1
&& !stricmp(S_sfx[i].name, if (sfx->skinsound != -1
stoken + 2)) && fasticmp(sfx->name, stoken + 2))
{ {
skin->soundsid[S_sfx[i].skinsound] = skin->soundsid[sfx->skinsound] = S_AddSoundFx(value+2, sfx->singularity, sfx->pitch, true);
S_AddSoundFx(value+2, S_sfx[i].singularity, S_sfx[i].pitch, true);
found = true; found = true;
} }
} }
if (!found) if (!found)
CONS_Debug(DBG_SETUP, "R_AddSkins: Unknown keyword '%s' in S_SKIN lump# %d (WAD %s)\n", stoken, lump, wadfiles[wadnum]->filename); CONS_Debug(DBG_SETUP, "R_AddSkins: Unknown keyword '%s' in S_SKIN lump# %d (WAD %s)\n", stoken, lump, wadfiles[wadnum]->filename);
} }
stoken = strtok(NULL, "\r\n= "); stoken = strtok(NULL, "\r\n= ");
} }
free(buf2); free(buf2);
lump++; // if no sprite defined use spirte just after this one lump++; // if no sprite defined use spirte just after this one
if (skin->sprite[0] == '\0') if (skin->sprite[0] == '\0')
{ {
const char *csprname = W_CheckNameForNumPwad(wadnum, lump); const char *csprname = W_CheckNameForNumPwad(wadnum, lump);
// skip to end of this skin's frames // skip to end of this skin's frames
lastlump = lump; lastlump = lump;
while (W_CheckNameForNumPwad(wadnum, lastlump) && memcmp(W_CheckNameForNumPwad(wadnum, lastlump), csprname,4)==0) while (W_CheckNameForNumPwad(wadnum, lastlump) && memcmp(W_CheckNameForNumPwad(wadnum, lastlump), csprname,4)==0)
lastlump++; lastlump++;
// allocate (or replace) sprite frames, and set spritedef // allocate (or replace) sprite frames, and set spritedef
R_AddSingleSpriteDef(csprname, &skin->spritedef, wadnum, lump, lastlump); R_AddSingleSpriteDef(csprname, &skin->spritedef, wadnum, lump, lastlump);
} }
@@ -707,11 +724,14 @@ void R_AddSkins(UINT16 wadnum, boolean local)
size_t name; size_t name;
boolean found = false; boolean found = false;
const char *sprname = skin->sprite; const char *sprname = skin->sprite;
for (name = 0;sprnames[name][0] != '\0';name++)
for (name = 0; sprnames[name][0] != '\0'; name++)
{
if (strncmp(sprnames[name], sprname, 4) == 0) if (strncmp(sprnames[name], sprname, 4) == 0)
{ {
found = true;
skin->spritedef = sprites[name]; skin->spritedef = sprites[name];
found = true;
}
} }
// not found so make a new one // not found so make a new one
@@ -726,7 +746,7 @@ void R_AddSkins(UINT16 wadnum, boolean local)
while ((lname = W_CheckNameForNumPwad(wadnum, localllump))) while ((lname = W_CheckNameForNumPwad(wadnum, localllump)))
{ {
// If this is a valid sprite... // If this is a valid sprite...
if (!memcmp(lname, sprname,4) && lname[4] && lname[5] && lname[5] >= '0' && lname[5] <= '8') if (!memcmp(lname, sprname, 4) && lname[4] && lname[5] && lname[5] >= '0' && lname[5] <= '8')
{ {
if (lstart == UINT16_MAX) if (lstart == UINT16_MAX)
lstart = localllump; lstart = localllump;
@@ -741,6 +761,7 @@ void R_AddSkins(UINT16 wadnum, boolean local)
} }
// If not already set do nothing // If not already set do nothing
} }
++localllump; ++localllump;
} }
@@ -760,7 +781,6 @@ void R_AddSkins(UINT16 wadnum, boolean local)
(local ? localskin_cons_t : skin_cons_t)[lnumskins].value = lnumskins; (local ? localskin_cons_t : skin_cons_t)[lnumskins].value = lnumskins;
(local ? localskin_cons_t : skin_cons_t)[lnumskins].strvalue = skin->name; (local ? localskin_cons_t : skin_cons_t)[lnumskins].strvalue = skin->name;
#endif #endif
if (!local) if (!local)
{ {
// Update the forceskin possiblevalues // Update the forceskin possiblevalues
+23 -18
View File
@@ -1095,9 +1095,12 @@ void S_StartSoundName(void *mo, const char *soundname)
// Search existing sounds... // Search existing sounds...
for (i = sfx_None + 1; i < NUMSFX; i++) for (i = sfx_None + 1; i < NUMSFX; i++)
{ {
if (!S_sfx[i].name) const sfxinfo_t *sfx = &S_sfx[i];
if (!sfx->name)
continue; continue;
if (!stricmp(S_sfx[i].name, soundname))
if (fasticmp(sfx->name, soundname))
{ {
soundnum = i; soundnum = i;
break; break;
@@ -1110,6 +1113,7 @@ void S_StartSoundName(void *mo, const char *soundname)
{ {
if (newsounds[i] == 0) if (newsounds[i] == 0)
break; break;
if (!S_IdPlaying(newsounds[i])) if (!S_IdPlaying(newsounds[i]))
{ {
S_RemoveSoundFx(newsounds[i]); S_RemoveSoundFx(newsounds[i]);
@@ -1266,7 +1270,7 @@ ReadMusicDefFields (UINT16 wadnum, int line, char *stoken, musicdef_t **defp)
char *value; char *value;
char *textline; char *textline;
if (!stricmp(stoken, "lump")) if (fasticmp(stoken, "lump"))
{ {
value = strtok(NULL, " "); value = strtok(NULL, " ");
@@ -1341,24 +1345,24 @@ skip_lump:
for (textline = def->field; *textline; textline++)\ for (textline = def->field; *textline; textline++)\
if (*textline == '_') *textline = ' '; if (*textline == '_') *textline = ' ';
if (!stricmp(stoken, "usage")) if (fasticmp(stoken, "usage"))
{ {
ADDDEF(usage); ADDDEF(usage);
} }
else if (!stricmp(stoken, "source")) else if (fasticmp(stoken, "source"))
{ {
ADDDEF(source); ADDDEF(source);
} }
else if (!stricmp(stoken, "title")) else if (fasticmp(stoken, "title"))
{ {
def->use_info = true; def->use_info = true;
ADDDEF(title); ADDDEF(title);
} }
else if (!stricmp(stoken, "alttitle")) else if (fasticmp(stoken, "alttitle"))
{ {
ADDDEF(alttitle); ADDDEF(alttitle);
} }
else if (!stricmp(stoken, "authors")) else if (fasticmp(stoken, "authors"))
{ {
ADDDEF(authors); ADDDEF(authors);
} }
@@ -1479,7 +1483,8 @@ musicdef_t *S_FindMusicCredit(const char *musname)
if (hash != def->hash) if (hash != def->hash)
continue; continue;
if (stricmp(def->name, musname))
if (!fasticmp(def->name, musname))
continue; continue;
return def; return def;
@@ -1828,7 +1833,7 @@ void S_StopMusic(void)
|| demo.title) // SRB2Kart: Demos don't interrupt title screen music || demo.title) // SRB2Kart: Demos don't interrupt title screen music
return; return;
mapmusic.resume = (cv_birdmusic.value && (strcasecmp(music.name, mapmusic.name) == 0)) ? I_GetSongPosition() : 0; mapmusic.resume = (cv_birdmusic.value && fasticmp(music.name, mapmusic.name)) ? I_GetSongPosition() : 0;
S_SetKeepMusResume(); S_SetKeepMusResume();
@@ -1934,7 +1939,7 @@ static const char *musicexception_list[] = {
// check if the current music is smth we dont want to keep (vote music, etc) // check if the current music is smth we dont want to keep (vote music, etc)
static boolean S_CheckMusicException(void) static boolean S_CheckMusicException(void)
{ {
if (stricmp(music.name, mapmusic.name)) if (!fasticmp(music.name, mapmusic.name))
return true; return true;
// dumb hack but dont keepmusic music that is supposed to reset // dumb hack but dont keepmusic music that is supposed to reset
@@ -1944,7 +1949,7 @@ static boolean S_CheckMusicException(void)
// in case somehow the mapmusic was replaced with smth we dont want to keep // in case somehow the mapmusic was replaced with smth we dont want to keep
for (size_t i = 0; i < sizeof(musicexception_list)/sizeof(musicexception_list[0]); i++) for (size_t i = 0; i < sizeof(musicexception_list)/sizeof(musicexception_list[0]); i++)
{ {
if (!stricmp(music.name, musicexception_list[i]) || !stricmp(checkmusic, musicexception_list[i])) if (fasticmp(music.name, musicexception_list[i]) || fasticmp(checkmusic, musicexception_list[i]))
{ {
return true; return true;
} }
@@ -1964,7 +1969,7 @@ static void S_SetKeepMusResume(void)
{ {
keepmusic.resume = 0; keepmusic.resume = 0;
if (strcasecmp(music.name, mapmusic.name) == 0) if (fasticmp(music.name, mapmusic.name))
{ {
keepmusic.resume = I_GetSongPosition(); keepmusic.resume = I_GetSongPosition();
} }
@@ -2030,12 +2035,12 @@ static boolean S_SkipIntroMusic(void)
return false; return false;
// check if menu music is playing, otherwise it may continue playing // check if menu music is playing, otherwise it may continue playing
if (!stricmp(music.name, "titles")) if (fasticmp(music.name, "titles"))
return false; return false;
char *maptitle = G_BuildMapTitle(gamemap); // Zzz... char *maptitle = G_BuildMapTitle(gamemap); // Zzz...
if (maptitle && !stricmp(maptitle, "Wandering Falls")) // wandering balls changes its song when the race starts Zzz... if (maptitle && fasticmp(maptitle, "Wandering Falls")) // wandering balls changes its song when the race starts Zzz...
{ {
Z_Free(maptitle); Z_Free(maptitle);
return false; return false;
@@ -2148,19 +2153,19 @@ static void Command_Tunes_f(void)
tunenum = (UINT16)atoi(tunearg); tunenum = (UINT16)atoi(tunearg);
track = 0; track = 0;
if (!strcasecmp(tunearg, "-show")) if (fasticmp(tunearg, "-show"))
{ {
CONS_Printf(M_GetText("The current tune is: %s [track %d]\n"), CONS_Printf(M_GetText("The current tune is: %s [track %d]\n"),
mapmusic.name, (mapmusic.flags & MUSIC_TRACKMASK)); mapmusic.name, (mapmusic.flags & MUSIC_TRACKMASK));
return; return;
} }
if (!strcasecmp(tunearg, "-none")) if (fasticmp(tunearg, "-none"))
{ {
S_StopMusic(); S_StopMusic();
return; return;
} }
else if (!strcasecmp(tunearg, "-default")) else if (fasticmp(tunearg, "-default"))
{ {
tunearg = mapheaderinfo[gamemap-1]->musname; tunearg = mapheaderinfo[gamemap-1]->musname;
track = mapheaderinfo[gamemap-1]->mustrack; track = mapheaderinfo[gamemap-1]->mustrack;
-3
View File
@@ -35,9 +35,6 @@
#define _CREATE_DLL_ // necessary for Unix AND Windows #define _CREATE_DLL_ // necessary for Unix AND Windows
#define GETFUNC(func) \
else if (0 == strcmp(#func, funcName)) \
funcPointer = &func \
// //
// //
/** \brief The *hwSym function /** \brief The *hwSym function
+10 -2
View File
@@ -545,7 +545,7 @@ static inline void I_ShutdownConsole(void){}
// //
//I_OutputMsg // I_OutputMsg
// //
void I_OutputMsg(const char *fmt, ...) void I_OutputMsg(const char *fmt, ...)
{ {
@@ -553,6 +553,9 @@ void I_OutputMsg(const char *fmt, ...)
char *txt; char *txt;
va_list argptr; va_list argptr;
if (!fmt)
return;
va_start(argptr,fmt); va_start(argptr,fmt);
len = vsnprintf(NULL, 0, fmt, argptr); len = vsnprintf(NULL, 0, fmt, argptr);
va_end(argptr); va_end(argptr);
@@ -560,6 +563,10 @@ void I_OutputMsg(const char *fmt, ...)
return; return;
txt = static_cast<char*>(malloc(len+1)); txt = static_cast<char*>(malloc(len+1));
if (!txt)
I_Error("I_OutputMsg: Out of memory!\n");
va_start(argptr,fmt); va_start(argptr,fmt);
vsprintf(txt, fmt, argptr); vsprintf(txt, fmt, argptr);
va_end(argptr); va_end(argptr);
@@ -2281,8 +2288,9 @@ char *I_GetUserName(void)
} }
if (strcmp(username, "") != 0) if (!fastcmp(username, ""))
return username; return username;
return NULL; // dummy for platform independent version return NULL; // dummy for platform independent version
} }
+23 -12
View File
@@ -156,9 +156,9 @@ static SDL_bool usesdl2soft = SDL_FALSE;
static SDL_bool borderlesswindow = SDL_FALSE; static SDL_bool borderlesswindow = SDL_FALSE;
// SDL2 vars // SDL2 vars
SDL_Window *window; SDL_Window *window = NULL;
SDL_Renderer *renderer; SDL_Renderer *renderer = NULL;
static SDL_Texture *texture; static SDL_Texture *texture = NULL;
static SDL_bool havefocus = SDL_TRUE; static SDL_bool havefocus = SDL_TRUE;
static const char *fallback_resolution_name = "Fallback"; static const char *fallback_resolution_name = "Fallback";
@@ -412,6 +412,10 @@ static INT32 GetTypedChar(SDL_Keysym keysym)
break; 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 (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 if (next_event.text.text[1] == '\0') // limit to ASCII
@@ -901,10 +905,11 @@ static void Impl_HandleControllerAddedEvent(SDL_Event evt)
for (i = 0; i < MAXSPLITSCREENPLAYERS; i++) for (i = 0; i < MAXSPLITSCREENPLAYERS; i++)
{ {
if (!strcmp(cv_usejoystick[i].string, "0") || !cv_usejoystick[i].value) if (fastcmp(cv_usejoystick[i].string, "0") || !cv_usejoystick[i].value)
cv_usejoystick[i].value = 0; cv_usejoystick[i].value = 0;
else if (atoi(cv_usejoystick[i].string) <= I_NumJoys() // don't mess if we intentionally set higher than NumJoys 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_usejoystick[i].value) // update the cvar ONLY if a device exists
CV_SetValue(&cv_usejoystick[i], cv_usejoystick[i].value); CV_SetValue(&cv_usejoystick[i], cv_usejoystick[i].value);
} }
@@ -972,7 +977,7 @@ static void Impl_HandleControllerRemovedEvent(void)
for (i = 0; i < MAXSPLITSCREENPLAYERS; i++) for (i = 0; i < MAXSPLITSCREENPLAYERS; i++)
{ {
if (!strcmp(cv_usejoystick[i].string, "0")) if (fastcmp(cv_usejoystick[i].string, "0"))
{ {
cv_usejoystick[i].value = 0; cv_usejoystick[i].value = 0;
} }
@@ -1107,9 +1112,11 @@ void I_OsPolling(void)
I_GetEvent(); I_GetEvent();
mod = SDL_GetModState(); mod = SDL_GetModState();
/* Handle here so that our state is always synched with the system. */ /* Handle here so that our state is always synched with the system. */
shiftdown = ctrldown = altdown = 0; shiftdown = ctrldown = altdown = 0;
capslock = false; capslock = false;
if (mod & KMOD_LSHIFT) shiftdown |= 1; if (mod & KMOD_LSHIFT) shiftdown |= 1;
if (mod & KMOD_RSHIFT) shiftdown |= 2; if (mod & KMOD_RSHIFT) shiftdown |= 2;
if (mod & KMOD_LCTRL) ctrldown |= 1; if (mod & KMOD_LCTRL) ctrldown |= 1;
@@ -1143,7 +1150,7 @@ static void VID_Command_Mode_f (void)
{ {
INT32 modenum; 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); CONS_Printf("vid_mode <modenum> : set video mode, current video mode %i\n", vid.modenum);
return; return;
@@ -1288,8 +1295,8 @@ static void SDLSetMode(INT32 width, INT32 height, SDL_bool fullscreen)
#endif #endif
OglSdlSurface(vid.width, vid.height); OglSdlSurface(vid.width, vid.height);
} }
else
#endif #endif
if (rendermode == render_soft) if (rendermode == render_soft)
{ {
SDL_RenderClear(renderer); SDL_RenderClear(renderer);
@@ -1354,7 +1361,8 @@ void I_FinishUpdate(void)
const boolean isserverplayer = consoleplayer == serverplayer; 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(); SCR_DisplayLocalPing();
} }
@@ -1621,11 +1629,13 @@ static SDL_bool Impl_CreateContext(void)
if (!renderer) if (!renderer)
renderer = SDL_CreateRenderer(window, -1, flags); renderer = SDL_CreateRenderer(window, -1, flags);
if (renderer == NULL) if (renderer == NULL)
{ {
CONS_Printf(M_GetText("Couldn't create rendering context: %s\n"), SDL_GetError()); CONS_Printf(M_GetText("Couldn't create rendering context: %s\n"), SDL_GetError());
return SDL_FALSE; return SDL_FALSE;
} }
SDL_RenderSetLogicalSize(renderer, BASEVIDWIDTH, BASEVIDHEIGHT); SDL_RenderSetLogicalSize(renderer, BASEVIDWIDTH, BASEVIDHEIGHT);
} }
@@ -1728,6 +1738,7 @@ void I_StartupGraphics(void)
#endif #endif
{ {
const char *vd = SDL_GetCurrentVideoDriver(); const char *vd = SDL_GetCurrentVideoDriver();
//CONS_Printf(M_GetText("Starting up with video driver: %s\n"), vd); //CONS_Printf(M_GetText("Starting up with video driver: %s\n"), vd);
if (vd && (strncasecmp(vd, "fbcon", 6) == 0)) if (vd && (strncasecmp(vd, "fbcon", 6) == 0))
framebuffer = SDL_TRUE; framebuffer = SDL_TRUE;
@@ -1774,11 +1785,11 @@ void I_StartupGraphics(void)
if (rendermode == render_none) if (rendermode == render_none)
{ {
if (strcasecmp(word, "software") == 0) if (fasticmp(word, "software"))
{ {
rendermode = render_soft; rendermode = render_soft;
} }
else if (strcasecmp(word, "opengl") == 0) else if (fasticmp(word, "opengl"))
{ {
rendermode = render_opengl; rendermode = render_opengl;
} }
@@ -1791,7 +1802,7 @@ void I_StartupGraphics(void)
if (!msaa_set) if (!msaa_set)
{ {
if (strcasecmp(word, "msaa") == 0) if (fasticmp(word, "msaa"))
{ {
const char *nextword = strtok(NULL, " \n"); const char *nextword = strtok(NULL, " \n");
@@ -1808,7 +1819,7 @@ void I_StartupGraphics(void)
if (!a2c_set) if (!a2c_set)
{ {
if (strcasecmp(word, "a2c") == 0) if (fasticmp(word, "a2c"))
{ {
a2c = true; a2c = true;
CONS_Printf("Using a2c because it was specified to be used earlier\n"); CONS_Printf("Using a2c because it was specified to be used earlier\n");
+154 -42
View File
@@ -123,13 +123,12 @@ static int result;
static void var_cleanup(void) static void var_cleanup(void)
{ {
song_length = loop_point = 0.0f; song_length = loop_point = 0.0f;
music_bytes = fading_source = fading_target =\ music_bytes = fading_source = fading_target =
fading_timer = fading_duration = 0; fading_timer = fading_duration = 0;
music_end_bytes = 0; music_end_bytes = 0;
music_stutter_bytes = 0; music_stutter_bytes = 0;
songpaused = is_looping =\ songpaused = is_looping = is_fading = false;
is_fading = false;
fading_callback = NULL; fading_callback = NULL;
fading_do_callback = false; fading_do_callback = false;
@@ -229,6 +228,7 @@ void I_ShutdownSound(void)
{ {
if (!sound_started) if (!sound_started)
return; // not an error condition return; // not an error condition
sound_started = false; sound_started = false;
Mix_CloseAudio(); Mix_CloseAudio();
@@ -254,6 +254,7 @@ void I_UpdateSound(void)
{ {
if (fading_callback) if (fading_callback)
(*fading_callback)(); (*fading_callback)();
fading_callback = NULL; fading_callback = NULL;
fading_do_callback = false; fading_do_callback = false;
} }
@@ -280,6 +281,7 @@ static Mix_Chunk *ds2chunk(void *stream)
ver = READUINT16(stream); // sound version format? ver = READUINT16(stream); // sound version format?
if (ver != 3) // It should be 3 if it's a doomsound... if (ver != 3) // It should be 3 if it's a doomsound...
return NULL; // onos! it's not a doomsound! return NULL; // onos! it's not a doomsound!
freq = READUINT16(stream); freq = READUINT16(stream);
samples = READUINT32(stream); samples = READUINT32(stream);
@@ -287,39 +289,47 @@ static Mix_Chunk *ds2chunk(void *stream)
return NULL; // division by zero return NULL; // division by zero
// convert from signed 8bit ???hz to signed 16bit 44100hz. // convert from signed 8bit ???hz to signed 16bit 44100hz.
switch(freq) switch (freq)
{ {
case 44100: case 44100:
if (samples >= UINT32_MAX>>2) if (samples >= UINT32_MAX>>2)
return NULL; // would wrap, can't store. return NULL; // would wrap, can't store.
newsamples = samples; newsamples = samples;
break; break;
case 22050: case 22050:
if (samples >= UINT32_MAX>>3) if (samples >= UINT32_MAX>>3)
return NULL; // would wrap, can't store. return NULL; // would wrap, can't store.
newsamples = samples<<1; newsamples = samples<<1;
break; break;
case 11025: case 11025:
if (samples >= UINT32_MAX>>4) if (samples >= UINT32_MAX>>4)
return NULL; // would wrap, can't store. return NULL; // would wrap, can't store.
newsamples = samples<<2; newsamples = samples<<2;
break; break;
default: default:
frac = (44100 << FRACBITS) / (UINT32)freq; frac = (44100 << FRACBITS) / (UINT32)freq;
if (!(frac & 0xFFFF)) // other solid multiples (change if FRACBITS != 16) if (!(frac & 0xFFFF)) // other solid multiples (change if FRACBITS != 16)
newsamples = samples * (frac >> FRACBITS); newsamples = samples * (frac >> FRACBITS);
else // strange and unusual fractional frequency steps, plus anything higher than 44100hz. else // strange and unusual fractional frequency steps, plus anything higher than 44100hz.
newsamples = FixedMul(FixedDiv(samples, freq), 44100) + 1; // add 1 to counter truncation. newsamples = FixedMul(FixedDiv(samples, freq), 44100) + 1; // add 1 to counter truncation.
if (newsamples >= UINT32_MAX>>2) if (newsamples >= UINT32_MAX>>2)
return NULL; // would and/or did wrap, can't store. return NULL; // would and/or did wrap, can't store.
break; break;
} }
sound = Z_Malloc(newsamples<<2, PU_SOUND, NULL); // samples * frequency shift * bytes per sample * channels sound = Z_Malloc(newsamples<<2, PU_SOUND, NULL); // samples * frequency shift * bytes per sample * channels
s = (SINT8 *)stream; s = (SINT8 *)stream;
d = (INT16 *)sound; d = (INT16 *)sound;
i = 0; i = 0;
switch(freq) switch(freq)
{ {
case 44100: // already at the same rate? well that makes it simple. case 44100: // already at the same rate? well that makes it simple.
@@ -357,6 +367,7 @@ static Mix_Chunk *ds2chunk(void *stream)
default: // convert arbitrary hz to 44100. default: // convert arbitrary hz to 44100.
step = 0; step = 0;
frac = ((UINT32)freq << FRACBITS) / 44100 + 1; //Add 1 to counter truncation. frac = ((UINT32)freq << FRACBITS) / 44100 + 1; //Add 1 to counter truncation.
while (i < samples) while (i < samples)
{ {
o = (INT16)(*s+0x80)<<8; // changed signedness and shift up to 16 bits o = (INT16)(*s+0x80)<<8; // changed signedness and shift up to 16 bits
@@ -390,12 +401,14 @@ void *I_GetSfx(sfxinfo_t *sfx)
if (sfx->lumpnum == LUMPERROR) if (sfx->lumpnum == LUMPERROR)
sfx->lumpnum = S_GetSfxLumpNum(sfx); sfx->lumpnum = S_GetSfxLumpNum(sfx);
sfx->length = W_LumpLength(sfx->lumpnum); sfx->length = W_LumpLength(sfx->lumpnum);
lump = W_CacheLumpNum(sfx->lumpnum, PU_SOUND); lump = W_CacheLumpNum(sfx->lumpnum, PU_SOUND);
// convert from standard DoomSound format. // convert from standard DoomSound format.
chunk = ds2chunk(lump); chunk = ds2chunk(lump);
if (chunk) if (chunk)
{ {
Z_Free(lump); Z_Free(lump);
@@ -415,6 +428,7 @@ void *I_GetSfx(sfxinfo_t *sfx)
int zErr; // Somewhere to handle any error messages zlib tosses out int zErr; // Somewhere to handle any error messages zlib tosses out
memset(&stream, 0x00, sizeof (z_stream)); // Init zlib stream memset(&stream, 0x00, sizeof (z_stream)); // Init zlib stream
// Begin the inflation process // Begin the inflation process
inflatedLen = *(UINT32 *)lump + (sfx->length-4); // Last 4 bytes are the decompressed size, typically 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 inflatedData = (UINT8 *)Z_Malloc(inflatedLen, PU_SOUND, NULL); // Make room for the decompressed data
@@ -424,10 +438,13 @@ void *I_GetSfx(sfxinfo_t *sfx)
stream.next_out = inflatedData; stream.next_out = inflatedData;
zErr = inflateInit2(&stream, 32 + MAX_WBITS); zErr = inflateInit2(&stream, 32 + MAX_WBITS);
if (zErr == Z_OK) // We're good to go if (zErr == Z_OK) // We're good to go
{ {
zErr = inflate(&stream, Z_FINISH); zErr = inflate(&stream, Z_FINISH);
if (zErr == Z_STREAM_END) {
if (zErr == Z_STREAM_END)
{
// Run GME on new data // Run GME on new data
if (!gme_open_data(inflatedData, inflatedLen, &emu, SAMPLERATE)) if (!gme_open_data(inflatedData, inflatedLen, &emu, SAMPLERATE))
{ {
@@ -444,6 +461,7 @@ void *I_GetSfx(sfxinfo_t *sfx)
len = (info->play_length * 441 / 10) << 2; len = (info->play_length * 441 / 10) << 2;
mem = Z_Malloc(len, PU_SOUND, 0); mem = Z_Malloc(len, PU_SOUND, 0);
gme_play(emu, len >> 1, mem); gme_play(emu, len >> 1, mem);
gme_free_info(info); gme_free_info(info);
gme_delete(emu); gme_delete(emu);
@@ -453,10 +471,14 @@ void *I_GetSfx(sfxinfo_t *sfx)
} }
else else
CONS_Alert(CONS_ERROR,"Encountered %s when running inflate: %s\n", get_zlib_error(zErr), stream.msg); CONS_Alert(CONS_ERROR,"Encountered %s when running inflate: %s\n", get_zlib_error(zErr), stream.msg);
(void)inflateEnd(&stream); (void)inflateEnd(&stream);
} }
else // Hold up, zlib's got a problem 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); 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 Z_Free(inflatedData); // GME didn't open jack, but don't let that stop us from freeing this up
#else #else
return NULL; // No zlib support return NULL; // No zlib support
@@ -477,6 +499,7 @@ void *I_GetSfx(sfxinfo_t *sfx)
len = (info->play_length * 441 / 10) << 2; len = (info->play_length * 441 / 10) << 2;
mem = Z_Malloc(len, PU_SOUND, 0); mem = Z_Malloc(len, PU_SOUND, 0);
gme_play(emu, len >> 1, mem); gme_play(emu, len >> 1, mem);
gme_free_info(info); gme_free_info(info);
gme_delete(emu); gme_delete(emu);
@@ -487,6 +510,7 @@ void *I_GetSfx(sfxinfo_t *sfx)
// Try to load it as a WAVE or OGG using Mixer. // Try to load it as a WAVE or OGG using Mixer.
rw = SDL_RWFromMem(lump, sfx->length); rw = SDL_RWFromMem(lump, sfx->length);
if (rw != NULL) if (rw != NULL)
{ {
chunk = Mix_LoadWAV_RW(rw, 1); chunk = Mix_LoadWAV_RW(rw, 1);
@@ -502,19 +526,23 @@ void I_FreeSfx(sfxinfo_t *sfx)
{ {
Mix_Chunk *chunk = (Mix_Chunk*)sfx->data; Mix_Chunk *chunk = (Mix_Chunk*)sfx->data;
UINT8 *abufdata = NULL; UINT8 *abufdata = NULL;
if (chunk->allocated == 0) 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 // 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 // I believe this should ensure the sound is not playing when we free it
abufdata = chunk->abuf; abufdata = chunk->abuf;
} }
Mix_FreeChunk(sfx->data); Mix_FreeChunk(sfx->data);
if (abufdata) if (abufdata)
{ {
// I'm going to assume we used Z_Malloc to allocate this data. // I'm going to assume we used Z_Malloc to allocate this data.
Z_Free(abufdata); Z_Free(abufdata);
} }
} }
sfx->data = NULL; sfx->data = NULL;
sfx->lumpnum = LUMPERROR; sfx->lumpnum = LUMPERROR;
} }
@@ -572,9 +600,12 @@ static UINT32 get_adjusted_position(UINT32 position)
{ {
// all in milliseconds // all in milliseconds
UINT32 length = I_GetSongLength(); UINT32 length = I_GetSongLength();
UINT32 looppoint = I_GetSongLoopPoint();
if (length) if (length)
{
UINT32 looppoint = I_GetSongLoopPoint();
return position >= length ? (position % (length-looppoint)) : position; return position >= length ? (position % (length-looppoint)) : position;
}
else else
return position; return position;
} }
@@ -589,8 +620,7 @@ static void do_fading_callback(void)
/// Music Hooks /// Music Hooks
/// ------------------------ /// ------------------------
static void static void Countstutter(int len)
Countstutter (int len)
{ {
UINT32 bytes; UINT32 bytes;
@@ -617,7 +647,7 @@ Countstutter (int len)
else else
bytes = ( music_bytes - music_stutter_bytes ); bytes = ( music_bytes - music_stutter_bytes );
I_SetSongPosition((int)( (float)bytes/4/44100.0f*1000 )); I_SetSongPosition((int)((float)bytes/4/44100.0f*1000));
} }
} }
} }
@@ -628,7 +658,9 @@ static void count_music_bytes(int chan, void *stream, int len, void *udata)
(void)stream; (void)stream;
(void)udata; (void)udata;
if (!music || I_SongType() == MU_GME || I_SongType() == MU_MOD || I_SongType() == MU_MID) const musictype_t mustype = I_SongType();
if (!music || mustype == MU_GME || mustype == MU_MOD || mustype == MU_MID)
return; return;
music_bytes += len; music_bytes += len;
@@ -662,7 +694,9 @@ static UINT32 music_fade(UINT32 interval, void *param)
return 0; return 0;
} }
else if (songpaused) // don't decrement timer else if (songpaused) // don't decrement timer
{
return interval; return interval;
}
else if ((fading_timer -= 10) <= 0) else if ((fading_timer -= 10) <= 0)
{ {
internal_volume = fading_target; internal_volume = fading_target;
@@ -675,11 +709,14 @@ static UINT32 music_fade(UINT32 interval, void *param)
{ {
UINT8 delta = abs(fading_target - fading_source); UINT8 delta = abs(fading_target - fading_source);
fixed_t factor = FixedDiv(fading_duration - fading_timer, fading_duration); fixed_t factor = FixedDiv(fading_duration - fading_timer, fading_duration);
if (fading_target < fading_source) if (fading_target < fading_source)
internal_volume = max(min(internal_volume, fading_source - FixedMul(delta, factor)), fading_target); internal_volume = max(min(internal_volume, fading_source - FixedMul(delta, factor)), fading_target);
else if (fading_target > fading_source) else if (fading_target > fading_source)
internal_volume = min(max(internal_volume, fading_source + FixedMul(delta, factor)), fading_target); internal_volume = min(max(internal_volume, fading_source + FixedMul(delta, factor)), fading_target);
Mix_VolumeMusic(get_real_volume(music_volume)); Mix_VolumeMusic(get_real_volume(music_volume));
return interval; return interval;
} }
} }
@@ -763,14 +800,22 @@ musictype_t I_SongType(void)
#endif #endif
if (!music) if (!music)
return MU_NONE; return MU_NONE;
else if (Mix_GetMusicType(music) == MUS_MID)
const Mix_MusicType mustype = Mix_GetMusicType(music);
switch (mustype)
{
case MUS_MID:
return MU_MID; return MU_MID;
else if (Mix_GetMusicType(music) == MUS_MOD || Mix_GetMusicType(music) == MUS_MODPLUG) case MUS_MOD:
case MUS_MODPLUG:
return MU_MOD; return MU_MOD;
else if (Mix_GetMusicType(music) == MUS_MP3 || Mix_GetMusicType(music) == MUS_MP3_MAD) case MUS_MP3:
case MUS_MP3_MAD:
return MU_MP3; return MU_MP3;
else default:
return (musictype_t)Mix_GetMusicType(music); return (musictype_t)mustype;
}
} }
boolean I_SongPlaying(void) boolean I_SongPlaying(void)
@@ -799,6 +844,7 @@ boolean I_SetSongSpeed(float speed)
{ {
if (speed > 250.0f) if (speed > 250.0f)
speed = 250.0f; //limit speed up to 250x speed = 250.0f; //limit speed up to 250x
#ifdef HAVE_LIBGME #ifdef HAVE_LIBGME
if (gme) if (gme)
{ {
@@ -857,43 +903,56 @@ UINT32 I_GetSongLength(void)
// reconstruct info->play_length, from GME source // reconstruct info->play_length, from GME source
// we only want intro + 1 loop, not 2 // we only want intro + 1 loop, not 2
length = info->length; length = info->length;
if (length <= 0) if (length <= 0)
{ {
length = info->intro_length + info->loop_length; // intro + 1 loop length = info->intro_length + info->loop_length; // intro + 1 loop
if (length <= 0) if (length <= 0)
length = 150 * 1000; // 2.5 minutes length = 150 * 1000; // 2.5 minutes
} }
} }
gme_free_info(info); gme_free_info(info);
return max(length, 0); return max(length, 0);
} }
else else
#endif #endif
#ifdef HAVE_OPENMPT #ifdef HAVE_OPENMPT
if (openmpt_mhandle) if (openmpt_mhandle)
{
return (UINT32)(openmpt_module_get_duration_seconds(openmpt_mhandle) * 1000.); return (UINT32)(openmpt_module_get_duration_seconds(openmpt_mhandle) * 1000.);
}
else else
#endif #endif
if (!music || I_SongType() == MU_MOD || I_SongType() == MU_MID) if (!music || I_SongType() == MU_MOD || I_SongType() == MU_MID)
{
return 0; return 0;
}
else else
{ {
// VERY IMPORTANT to set your LENGTHMS= in your song files, folks! // VERY IMPORTANT to set your LENGTHMS= in your song files, folks!
// SDL mixer can't read music length itself. // SDL mixer can't read music length itself.
length = (UINT32)(song_length*1000); length = (UINT32)(song_length*1000);
if (!length) if (!length)
CONS_Debug(DBG_DETAILED, "Getting music length: music is missing LENGTHMS= tag. Needed for seeking.\n"); CONS_Debug(DBG_DETAILED, "Getting music length: music is missing LENGTHMS= tag. Needed for seeking.\n");
return length; return length;
} }
} }
boolean I_SetSongLoopPoint(UINT32 looppoint) boolean I_SetSongLoopPoint(UINT32 looppoint)
{ {
if (!music || I_SongType() == MU_GME || I_SongType() == MU_MOD || I_SongType() == MU_MID || !is_looping) if (!music|| !is_looping)
return false; return false;
else
{ const musictype_t mustype = I_SongType();
if (mustype == MU_GME || mustype == MU_MOD || mustype == MU_MID)
return false;
UINT32 length = I_GetSongLength(); UINT32 length = I_GetSongLength();
if (length > 0) if (length > 0)
@@ -901,7 +960,6 @@ boolean I_SetSongLoopPoint(UINT32 looppoint)
loop_point = max((float)(looppoint / 1000.0L), 0); loop_point = max((float)(looppoint / 1000.0L), 0);
return true; return true;
}
} }
UINT32 I_GetSongLoopPoint(void) UINT32 I_GetSongLoopPoint(void)
@@ -927,14 +985,19 @@ UINT32 I_GetSongLoopPoint(void)
else else
#endif #endif
if (!music || I_SongType() == MU_MOD || I_SongType() == MU_MID) if (!music || I_SongType() == MU_MOD || I_SongType() == MU_MID)
{
return 0; return 0;
}
else else
{
return (UINT32)(loop_point * 1000); return (UINT32)(loop_point * 1000);
}
} }
boolean I_SetSongPosition(UINT32 position) boolean I_SetSongPosition(UINT32 position)
{ {
UINT32 length; UINT32 length;
#ifdef HAVE_LIBGME #ifdef HAVE_LIBGME
if (gme) if (gme)
{ {
@@ -971,9 +1034,13 @@ boolean I_SetSongPosition(UINT32 position)
else else
#endif #endif
if (!music || I_SongType() == MU_MID) if (!music || I_SongType() == MU_MID)
{
return false; return false;
}
else if (I_SongType() == MU_MOD) else if (I_SongType() == MU_MOD)
{
return Mix_SetMusicPosition(position); // Goes by channels return Mix_SetMusicPosition(position); // Goes by channels
}
else else
{ {
// Because SDL mixer can't identify song length, if you have // Because SDL mixer can't identify song length, if you have
@@ -981,11 +1048,13 @@ boolean I_SetSongPosition(UINT32 position)
// music_bytes becomes inaccurate. // music_bytes becomes inaccurate.
length = I_GetSongLength(); // get it in MS length = I_GetSongLength(); // get it in MS
if (length) if (length)
position = get_adjusted_position(position); position = get_adjusted_position(position);
Mix_RewindMusic(); // needed for mp3 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) music_bytes = (UINT32)(position/1000.0L*44100.0L*4); //assume 44.1khz, 4-byte length (see I_GetSongPosition)
else else
// NOTE: This block fires on incorrect song format, // NOTE: This block fires on incorrect song format,
@@ -1025,6 +1094,7 @@ UINT32 I_GetSongPosition(void)
} }
gme_free_info(info); gme_free_info(info);
return max(position, 0); return max(position, 0);
} }
else else
@@ -1038,12 +1108,16 @@ UINT32 I_GetSongPosition(void)
else else
#endif #endif
if (!music || I_SongType() == MU_MID) if (!music || I_SongType() == MU_MID)
{
return 0; return 0;
}
else else
{
return (UINT32)(music_bytes/44100.0L*1000.0L/4); //assume 44.1khz return (UINT32)(music_bytes/44100.0L*1000.0L/4); //assume 44.1khz
// 4 = byte length for 16-bit samples (AUDIO_S16SYS), stereo (2-channel) // 4 = byte length for 16-bit samples (AUDIO_S16SYS), stereo (2-channel)
// This is hardcoded in I_StartupSound. Other formats for factor: // This is hardcoded in I_StartupSound. Other formats for factor:
// 8M: 1 | 8S: 2 | 16M: 2 | 16S: 4 // 8M: 1 | 8S: 2 | 16M: 2 | 16S: 4
}
} }
void I_UpdateSongLagThreshold(void) void I_UpdateSongLagThreshold(void)
@@ -1057,12 +1131,16 @@ void I_UpdateSongLagThreshold(void)
boolean I_LoadSong(char *data, size_t len) boolean I_LoadSong(char *data, size_t len)
{ {
const char *key1 = "LOOP"; static const char *key1 = "LOOP";
const char *key2 = "POINT="; static const char *key2 = "POINT=";
const char *key3 = "MS="; static const char *key3 = "MS=";
const size_t key1len = strlen(key1); static const size_t key1len = sizeof("LOOP")-1;
const size_t key2len = strlen(key2); static const size_t key2len = sizeof("POINT=")-1;
const size_t key3len = strlen(key3); 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);
char *p = data; char *p = data;
SDL_RWops *rw; SDL_RWops *rw;
@@ -1099,6 +1177,7 @@ boolean I_LoadSong(char *data, size_t len)
stream.next_out = inflatedData; stream.next_out = inflatedData;
zErr = inflateInit2(&stream, 32 + MAX_WBITS); zErr = inflateInit2(&stream, 32 + MAX_WBITS);
if (zErr == Z_OK) // We're good to go if (zErr == Z_OK) // We're good to go
{ {
zErr = inflate(&stream, Z_FINISH); zErr = inflate(&stream, Z_FINISH);
@@ -1114,10 +1193,12 @@ boolean I_LoadSong(char *data, size_t len)
} }
else else
CONS_Alert(CONS_ERROR, "Encountered %s when running inflate: %s\n", get_zlib_error(zErr), stream.msg); CONS_Alert(CONS_ERROR, "Encountered %s when running inflate: %s\n", get_zlib_error(zErr), stream.msg);
(void)inflateEnd(&stream); (void)inflateEnd(&stream);
} }
else // Hold up, zlib's got a problem 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); 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 Z_Free(inflatedData); // GME didn't open jack, but don't let that stop us from freeing this up
return false; return false;
#else #else
@@ -1146,6 +1227,7 @@ 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. 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); 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! if (!openmpt_mhandle) // Failed to create module handle? Show error and return!
{ {
mod_err = openmpt_module_error_get_last(openmpt_mhandle); mod_err = openmpt_module_error_get_last(openmpt_mhandle);
@@ -1160,10 +1242,12 @@ boolean I_LoadSong(char *data, size_t len)
// Let's see if Mixer is able to load this. // Let's see if Mixer is able to load this.
rw = SDL_RWFromMem(data, len); rw = SDL_RWFromMem(data, len);
if (rw != NULL) if (rw != NULL)
{ {
music = Mix_LoadMUS_RW(rw, 1); music = Mix_LoadMUS_RW(rw, 1);
} }
if (!music) if (!music)
{ {
CONS_Alert(CONS_ERROR, "Mix_LoadMUS_RW: %s\n", Mix_GetError()); CONS_Alert(CONS_ERROR, "Mix_LoadMUS_RW: %s\n", Mix_GetError());
@@ -1191,7 +1275,7 @@ boolean I_LoadSong(char *data, size_t len)
else if (!strncmp(p, key3, key3len)) // is it LOOPMS=? else if (!strncmp(p, key3, key3len)) // is it LOOPMS=?
{ {
p += key3len; // skip MS= p += key3len; // skip MS=
loop_point = (float)(atoi(p) / 1000.0L); // LOOPMS works by real time, as miliseconds. loop_point = (float)(atof(p) / 1000.0); // LOOPMS works by real time, as miliseconds.
// Everything that uses LOOPMS will work perfectly with SDL_Mixer. // Everything that uses LOOPMS will work perfectly with SDL_Mixer.
} }
} }
@@ -1201,6 +1285,7 @@ boolean I_LoadSong(char *data, size_t len)
else // continue searching else // continue searching
p++; p++;
} }
return true; return true;
} }
@@ -1243,6 +1328,7 @@ boolean I_PlaySong(boolean looping)
gme_start_track(gme, 0); gme_start_track(gme, 0);
current_track = 0; current_track = 0;
Mix_HookMusic(mix_gme, gme); Mix_HookMusic(mix_gme, gme);
return true; return true;
} }
else else
@@ -1282,15 +1368,17 @@ boolean I_PlaySong(boolean looping)
if (!music) if (!music)
return false; return false;
if (fpclassify(song_length) == FP_ZERO && (I_SongType() == MU_OGG || I_SongType() == MU_MP3 || I_SongType() == MU_FLAC)) const musictype_t mustype = I_SongType();
if (fpclassify(song_length) == FP_ZERO && (mustype == MU_OGG || mustype == MU_MP3 || mustype == MU_FLAC))
CONS_Debug(DBG_DETAILED, "This song is missing a LENGTHMS= tag! Required to make seeking work properly.\n"); CONS_Debug(DBG_DETAILED, "This song is missing a LENGTHMS= tag! Required to make seeking work properly.\n");
if (I_SongType() != MU_MOD && I_SongType() != MU_MID && Mix_PlayMusic(music, 0) == -1) if (mustype != MU_MOD && mustype != MU_MID && Mix_PlayMusic(music, 0) == -1)
{ {
CONS_Alert(CONS_ERROR, "Mix_PlayMusic: %s\n", Mix_GetError()); CONS_Alert(CONS_ERROR, "Mix_PlayMusic: %s\n", Mix_GetError());
return false; return false;
} }
else if ((I_SongType() == MU_MOD || I_SongType() == MU_MID) && Mix_PlayMusic(music, looping ? -1 : 0) == -1) // if MOD, loop forever else if ((mustype == MU_MOD || mustype == MU_MID) && Mix_PlayMusic(music, looping ? -1 : 0) == -1) // if MOD, loop forever
{ {
CONS_Alert(CONS_ERROR, "Mix_PlayMusic: %s\n", Mix_GetError()); CONS_Alert(CONS_ERROR, "Mix_PlayMusic: %s\n", Mix_GetError());
return false; return false;
@@ -1300,10 +1388,10 @@ boolean I_PlaySong(boolean looping)
I_SetMusicVolume(music_volume); I_SetMusicVolume(music_volume);
if (I_SongType() != MU_MOD && I_SongType() != MU_MID) if (mustype != MU_MOD && mustype != MU_MID)
Mix_HookMusicFinished(music_loop); // don't bother counting if MOD Mix_HookMusicFinished(music_loop); // don't bother counting if MOD
if(I_SongType() != MU_MOD && I_SongType() != MU_MID && !Mix_RegisterEffect(MIX_CHANNEL_POST, count_music_bytes, NULL, NULL)) if (mustype != MU_MOD && mustype != 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()); CONS_Alert(CONS_WARNING, "Error registering SDL music position counter: %s\n", Mix_GetError());
return true; return true;
@@ -1339,10 +1427,12 @@ void I_StopSong(void)
void I_PauseSong(void) void I_PauseSong(void)
{ {
if(I_SongType() == MU_MID) // really, SDL Mixer? why can't you pause MIDI??? const musictype_t mustype = I_SongType();
if (mustype == MU_MID) // really, SDL Mixer? why can't you pause MIDI???
return; return;
if(I_SongType() != MU_GME && I_SongType() != MU_MOD && I_SongType() != MU_MID) if (mustype != MU_GME && mustype != MU_MOD && mustype != MU_MID)
Mix_UnregisterEffect(MIX_CHANNEL_POST, count_music_bytes); Mix_UnregisterEffect(MIX_CHANNEL_POST, count_music_bytes);
Mix_PauseMusic(); Mix_PauseMusic();
@@ -1351,15 +1441,17 @@ void I_PauseSong(void)
void I_ResumeSong(void) void I_ResumeSong(void)
{ {
if (I_SongType() == MU_MID) const musictype_t mustype = I_SongType();
if (mustype == MU_MID)
return; return;
if (I_SongType() != MU_GME && I_SongType() != MU_MOD && I_SongType() != MU_MID) if (mustype != MU_GME && mustype != MU_MOD && mustype != 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 // HACK: fixes issue of multiple effect callbacks being registered
if(music && I_SongType() != MU_MOD && I_SongType() != MU_MID && !Mix_RegisterEffect(MIX_CHANNEL_POST, count_music_bytes, NULL, NULL)) if (music && mustype != MU_MOD && mustype != 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()); CONS_Alert(CONS_WARNING, "Error registering SDL music position counter: %s\n", Mix_GetError());
} }
@@ -1392,20 +1484,24 @@ boolean I_SetSongTrack(INT32 track)
{ {
if (current_track == track) if (current_track == track)
return false; return false;
SDL_LockAudio(); SDL_LockAudio();
if (track >= 0 && track < gme_track_count(gme)-1) if (track >= 0 && track < gme_track_count(gme)-1)
{ {
gme_err_t gme_e = gme_start_track(gme, track); gme_err_t gme_e = gme_start_track(gme, track);
if (gme_e != NULL) if (gme_e != NULL)
{ {
CONS_Alert(CONS_ERROR, "GME error: %s\n", gme_e); CONS_Alert(CONS_ERROR, "GME error: %s\n", gme_e);
return false; return false;
} }
current_track = track; current_track = track;
SDL_UnlockAudio(); SDL_UnlockAudio();
return true; return true;
} }
SDL_UnlockAudio(); SDL_UnlockAudio();
return false; return false;
} }
else else
@@ -1415,6 +1511,7 @@ boolean I_SetSongTrack(INT32 track)
{ {
if (current_subsong == track) if (current_subsong == track)
return false; return false;
SDL_LockAudio(); SDL_LockAudio();
if (track >= 0 && track < openmpt_module_get_num_subsongs(openmpt_mhandle)) if (track >= 0 && track < openmpt_module_get_num_subsongs(openmpt_mhandle))
{ {
@@ -1428,8 +1525,10 @@ boolean I_SetSongTrack(INT32 track)
return false; return false;
} }
#endif #endif
if (I_SongType() == MU_MOD) if (I_SongType() == MU_MOD)
return !Mix_SetMusicPosition(track); return !Mix_SetMusicPosition(track);
(void)track; (void)track;
return false; return false;
} }
@@ -1441,8 +1540,10 @@ boolean I_SetSongTrack(INT32 track)
void I_SetInternalMusicVolume(UINT8 volume) void I_SetInternalMusicVolume(UINT8 volume)
{ {
internal_volume = volume; internal_volume = volume;
if (!I_SongPlaying()) if (!I_SongPlaying())
return; return;
Mix_VolumeMusic(get_real_volume(music_volume)); Mix_VolumeMusic(get_real_volume(music_volume));
} }
@@ -1450,6 +1551,7 @@ void I_StopFadingSong(void)
{ {
if (fading_id) if (fading_id)
SDL_RemoveTimer(fading_id); SDL_RemoveTimer(fading_id);
is_fading = false; is_fading = false;
fading_source = fading_target = fading_timer = fading_duration = fading_id = 0; fading_source = fading_target = fading_timer = fading_duration = fading_id = 0;
} }
@@ -1466,8 +1568,10 @@ boolean I_FadeSongFromVolume(UINT8 target_volume, UINT8 source_volume, UINT32 ms
if (!ms && volume_delta) if (!ms && volume_delta)
{ {
I_SetInternalMusicVolume(target_volume); I_SetInternalMusicVolume(target_volume);
if (callback) if (callback)
(*callback)(); (*callback)();
return true; return true;
} }
@@ -1475,20 +1579,28 @@ boolean I_FadeSongFromVolume(UINT8 target_volume, UINT8 source_volume, UINT32 ms
{ {
if (callback) if (callback)
(*callback)(); (*callback)();
return true; return true;
} }
// Round MS to nearest 10 // Round MS to nearest 10
// If n - lower > higher - n, then round up // If n - lower > higher - n, then round up
ms = (ms - ((ms / 10) * 10) > (((ms / 10) * 10) + 10) - ms) ? //ms = (ms - ((ms / 10) * 10) > (((ms / 10) * 10) + 10) - ms) ?
(((ms / 10) * 10) + 10) // higher // (((ms / 10) * 10) + 10) // higher
: ((ms / 10) * 10); // lower // : ((ms / 10) * 10); // lower
const int lower = (ms / 10) * 10;
const int upper = lower + 10;
ms = (ms - lower > upper - ms) ? upper : lower;
if (!ms) if (!ms)
{
I_SetInternalMusicVolume(target_volume); I_SetInternalMusicVolume(target_volume);
}
else if (source_volume != target_volume) else if (source_volume != target_volume)
{ {
fading_id = SDL_AddTimer(10, music_fade, NULL); fading_id = SDL_AddTimer(10, music_fade, NULL);
if (fading_id) if (fading_id)
{ {
is_fading = true; is_fading = true;
@@ -1519,7 +1631,7 @@ boolean I_FadeInPlaySong(UINT32 ms, boolean looping)
{ {
if (I_PlaySong(looping)) if (I_PlaySong(looping))
return I_FadeSongFromVolume(100, 0, ms, NULL); return I_FadeSongFromVolume(100, 0, ms, NULL);
else
return false; return false;
} }
#endif #endif
+2 -2
View File
@@ -170,8 +170,8 @@ boolean OglSdlSurface(INT32 w, INT32 h)
} }
} }
if (strcmp((const char*)gl_renderer, "GDI Generic") == 0 && if (fastcmp((const char*)gl_renderer, "GDI Generic") &&
strcmp((const char*)gl_version, "1.1.0") == 0) fastcmp((const char*)gl_version, "1.1.0"))
{ {
// Oh no... Windows gave us the GDI Generic rasterizer, so something is wrong... // Oh no... Windows gave us the GDI Generic rasterizer, so something is wrong...
// The game will crash later on when unsupported OpenGL commands are encountered. // The game will crash later on when unsupported OpenGL commands are encountered.
+47 -28
View File
@@ -23,7 +23,6 @@
#include "r_main.h" #include "r_main.h"
#include "r_fps.h" #include "r_fps.h"
#include "console.h" #include "console.h"
#include "i_video.h" // rendermode #include "i_video.h" // rendermode
#include "z_zone.h" #include "z_zone.h"
#include "m_misc.h" #include "m_misc.h"
@@ -134,7 +133,7 @@ static boolean InitCube(void)
if (!loaded_config) if (!loaded_config)
return false; return false;
#define diffcons(cv) (strcmp(cv.string, cv.defaultvalue)) #define diffcons(cv) (!fastcmp(cv.string, cv.defaultvalue))
#define diffconsgamma(cv) (cv.value != 0) #define diffconsgamma(cv) (cv.value != 0)
#define diffconssat(cv) (cv.value != 10) #define diffconssat(cv) (cv.value != 10)
@@ -596,7 +595,7 @@ void V_ResetPaletteCVars(void)
if (!loaded_config) if (!loaded_config)
return; return;
#define diffcons(cv) (strcmp(cv.string, cv.defaultvalue)) #define diffcons(cv) (!fastcmp(cv.string, cv.defaultvalue))
if diffcons(cv_palette) if diffcons(cv_palette)
CV_StealthSetValue(&cv_palette, atoi(cv_palette.defaultvalue)); CV_StealthSetValue(&cv_palette, atoi(cv_palette.defaultvalue));
if diffcons(cv_palettenum) if diffcons(cv_palettenum)
@@ -641,8 +640,8 @@ void VID_BlitLinearScreen(const UINT8 *restrict srcptr, UINT8 *restrict destptr,
} }
} }
static UINT8 hudplusalpha[11] = { 10, 8, 6, 4, 2, 0, 0, 0, 0, 0, 0}; static const 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}; static const UINT8 hudminusalpha[11] = { 10, 9, 9, 8, 8, 7, 7, 6, 6, 5, 5};
UINT8 hudtrans = 0; UINT8 hudtrans = 0;
static const UINT8 *v_colormap = NULL; static const UINT8 *v_colormap = NULL;
@@ -1739,59 +1738,69 @@ void V_DrawHorizontallyScaledFullScreenPatch(patch_t *patch)
void V_DrawVhsEffect(boolean rewind) void V_DrawVhsEffect(boolean rewind)
{ {
static fixed_t upbary = 100*FRACUNIT, downbary = 150*FRACUNIT; static fixed_t upbary = 100, downbary = 150;
UINT8 barsize, updistort, downdistort;
UINT8 *buf = vid.screens[0], *tmp = vid.screens[4];
UINT16 y; UINT16 y;
UINT32 x, pos = 0; UINT32 x, pos;
UINT8 *normalmapstart = ((UINT8 *)transtables + (8<<FF_TRANSSHIFT|(19<<8))); UINT8 *buf, *tmp;
UINT8 *normalmapstart, *thismapstart;
#ifdef HQ_VHS #ifdef HQ_VHS
UINT8 *tmapstart = ((UINT8 *)transtables + (6<<FF_TRANSSHIFT)); UINT8 *tmapstart;
#endif #endif
UINT8 *thismapstart;
SINT8 offs; SINT8 offs;
UINT8 barsize = vid.dup<<5; barsize = vid.dup << 5;
UINT8 updistort = vid.dup<<(rewind ? 5 : 3); updistort = vid.dup << (rewind ? 5 : 3);
UINT8 downdistort = updistort>>1; downdistort = updistort >> 1;
if (rewind) if (rewind)
V_DrawVhsEffect(false); // experimentation V_DrawVhsEffect(false); // experimentation
upbary -= renderdeltatics * (vid.dup * (rewind ? 3 : 1.8f)); upbary -= FixedMul(vid.dup * (rewind ? 3 : 1.8f), renderdeltatics);
downbary += renderdeltatics * (vid.dup * (rewind ? 2 : 1)); downbary += FixedMul(vid.dup * (rewind ? 2 : 1), renderdeltatics);
if (upbary < -barsize*FRACUNIT) if (upbary < -barsize)
upbary = vid.height<<FRACBITS; upbary = vid.height;
if (downbary > vid.height<<FRACBITS)
downbary = -barsize*FRACUNIT;
fixed_t uby = upbary>>FRACBITS, dby = downbary>>FRACBITS; if (downbary > vid.height)
downbary = -barsize;
#ifdef HWRENDER #ifdef HWRENDER
if (rendermode == render_opengl) if (rendermode == render_opengl)
{ {
HWR_RenderVhsEffect(uby, dby, updistort, downdistort, barsize); HWR_RenderVhsEffect(upbary, downbary, updistort, downdistort, barsize);
return; return;
} }
#endif #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) for (y = 0; y < vid.height; y+=2)
{ {
thismapstart = normalmapstart; thismapstart = normalmapstart;
offs = 0; offs = 0;
if (y >= uby && y < uby+barsize) if (y >= upbary && y < upbary+barsize)
{ {
thismapstart -= (2<<FF_TRANSSHIFT) - (5<<8); thismapstart -= (2<<FF_TRANSSHIFT) - (5<<8);
offs += updistort * 2.0f * min(y-uby, uby+barsize-y) / barsize; offs += updistort * 2.0f * min(y-upbary, upbary+barsize-y) / barsize;
} }
if (y >= dby && y < dby+barsize) if (y >= downbary && y < downbary+barsize)
{ {
thismapstart -= (2<<FF_TRANSSHIFT) - (5<<8); thismapstart -= (2<<FF_TRANSSHIFT) - (5<<8);
offs -= downdistort * 2.0f * min(y-dby, dby+barsize-y) / barsize; offs -= downdistort * 2.0f * min(y-downbary, downbary+barsize-y) / barsize;
} }
offs += M_RandomKey(vid.dup<<1); offs += M_RandomKey(vid.dup<<1);
@@ -1909,8 +1918,10 @@ UINT8 *V_GetStringColormap(INT32 colorflags)
} }
#else // optimised #else // optimised
colorflags = ((colorflags & V_CHARCOLORMASK) >> V_CHARCOLORSHIFT); colorflags = ((colorflags & V_CHARCOLORMASK) >> V_CHARCOLORSHIFT);
if (!colorflags || colorflags > 15) // INT32 is signed, but V_CHARCOLORMASK is a very restrictive mask. if (!colorflags || colorflags > 15) // INT32 is signed, but V_CHARCOLORMASK is a very restrictive mask.
return NULL; return NULL;
return (purplemap+((colorflags-1)<<8)); return (purplemap+((colorflags-1)<<8));
#endif #endif
} }
@@ -2000,6 +2011,7 @@ char *V_WordWrap(INT32 x, INT32 w, INT32 option, const char *string)
for (i = 0; i < slen; ++i) for (i = 0; i < slen; ++i)
{ {
c = newstring[i]; c = newstring[i];
if ((UINT8)c >= 0x80 && (UINT8)c <= 0x8F) //color parsing! -Inuyasha 2.16.09 if ((UINT8)c >= 0x80 && (UINT8)c <= 0x8F) //color parsing! -Inuyasha 2.16.09
continue; continue;
@@ -3568,6 +3580,9 @@ boolean *heatshifter = NULL;
INT32 lastheight = 0; INT32 lastheight = 0;
INT32 heatindex[MAXSPLITSCREENPLAYERS] = {0, 0, 0, 0}; INT32 heatindex[MAXSPLITSCREENPLAYERS] = {0, 0, 0, 0};
// unused motion blur effect, probably non functional
//#define MOTIONBLUR
// //
// V_DoPostProcessor // V_DoPostProcessor
// //
@@ -3582,7 +3597,9 @@ void V_DoPostProcessor(INT32 view, INT32 param)
(void)type; (void)type;
(void)param; (void)param;
#else #else
#ifndef MOTIONBLUR
(void)param; // unused motion blur stuff (void)param; // unused motion blur stuff
#endif
INT32 yoffset, xoffset; INT32 yoffset, xoffset;
#ifdef HWRENDER #ifdef HWRENDER
@@ -3717,7 +3734,8 @@ void V_DoPostProcessor(INT32 view, INT32 param)
srcscr = tmp; srcscr = tmp;
} }
/*if (thiscam->postimg & POSTIMG_MOTION) // Motion Blur! #ifdef MOTIONBLUR
if (thiscam->postimg & POSTIMG_MOTION) // Motion Blur!
{ {
INT32 x, y; INT32 x, y;
@@ -3729,7 +3747,8 @@ void V_DoPostProcessor(INT32 view, INT32 param)
for (x = xoffset; x < xoffset+viewwidth; x++) 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]))]; 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 if ((thiscam->postimg & POSTIMG_FLIP) && !(thiscam->postimg & POSTIMG_MIRROR)) // Flip the screen upside-down
{ {
+19 -12
View File
@@ -259,9 +259,12 @@ static inline void W_LoadDehackedLumpsPK3(UINT16 wadnum)
size_t length = len + 1 + strlen(lump_p->fullname); // length of file name, '|', and lump name size_t length = len + 1 + strlen(lump_p->fullname); // length of file name, '|', and lump name
char *name = malloc(length + 1); 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); sprintf(name, "%s|%s", wadfiles[wadnum]->filename, lump_p->fullname);
name[length] = '\0'; name[length] = '\0';
CONS_Printf(M_GetText("Loading SOC from %s\n"), name); CONS_Printf("Loading SOC from %s\n", name);
DEH_LoadDehackedLumpPwad(wadnum, posStart); DEH_LoadDehackedLumpPwad(wadnum, posStart);
free(name); free(name);
} }
@@ -292,6 +295,9 @@ static inline void W_LoadDehackedLumps(UINT16 wadnum)
size_t length = len + 1 + strlen(lump_p->fullname); // length of file name, '|', and lump name size_t length = len + 1 + strlen(lump_p->fullname); // length of file name, '|', and lump name
char *name = malloc(length + 1); 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); sprintf(name, "%s|%s", wadfiles[wadnum]->filename, lump_p->fullname);
name[length] = '\0'; name[length] = '\0';
@@ -369,11 +375,11 @@ static restype_t ResourceFileDetect(const char* filename)
{ {
size_t len = strlen(filename) - 4; size_t len = strlen(filename) - 4;
if (!stricmp(&filename[len], ".pk3")) if (fasticmp(&filename[len], ".pk3"))
return RET_PK3; return RET_PK3;
if (!stricmp(&filename[len], ".soc")) if (fasticmp(&filename[len], ".soc"))
return RET_SOC; return RET_SOC;
if (!stricmp(&filename[len], ".lua")) if (fasticmp(&filename[len], ".lua"))
return RET_LUA; return RET_LUA;
return RET_WAD; return RET_WAD;
@@ -965,24 +971,25 @@ 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 * \return 1 if all files were loaded, 0 if at least one was missing or
* invalid. * invalid.
*/ */
INT32 W_InitMultipleFiles(char **filenames, boolean addons) INT32 W_InitMultipleFiles(char **filenames, size_t count, boolean addons)
{ {
INT32 rc = 1; INT32 rc = 1;
INT32 overallrc = 1; INT32 overallrc = 1;
size_t i;
(void)addons; (void)addons;
// will be realloced as lumps are added for (i = 0; i < count; i++)
for (; *filenames; filenames++)
{ {
const char *filename = filenames[i];
// Previously, W_VerifyNMUSlumps was called to mark game modified // Previously, W_VerifyNMUSlumps was called to mark game modified
// for addons... but W_InitFile already does exactly that! // for addons... but W_InitFile already does exactly that!
//CONS_Debug(DBG_SETUP, "Loading %s\n", *filenames); //CONS_Debug(DBG_SETUP, "Loading %s\n", *filenames);
rc = W_InitFile(*filenames, false, true); rc = W_InitFile(filename, false, true);
if (rc == INT16_MAX) if (rc == INT16_MAX)
CONS_Printf(M_GetText("Errors occurred while loading %s; not added.\n"), *filenames); CONS_Printf(M_GetText("Errors occurred while loading %s; not added.\n"), filename);
overallrc &= (rc != INT16_MAX) ? 1 : 0; overallrc &= (rc != INT16_MAX) ? 1 : 0;
} }
@@ -1123,7 +1130,7 @@ UINT16 W_CheckNumForLongNamePwad(const char *name, UINT16 wad, UINT16 startlump)
{ {
if (lump_p->longnamelength == namelen if (lump_p->longnamelength == namelen
&& lump_p->hash.longname == hash && lump_p->hash.longname == hash
&& !stricmp(lump_p->longname, name)) && fasticmp(lump_p->longname, name))
return i; return i;
} }
} }
@@ -1223,7 +1230,7 @@ static lumpnum_t CheckLumpInCache(const char *name, boolean longname)
for (INT32 i = lumpnumcacheindex + LUMPNUMCACHESIZE; i > lumpnumcacheindex; i--) for (INT32 i = lumpnumcacheindex + LUMPNUMCACHESIZE; i > lumpnumcacheindex; i--)
{ {
if (lumpnumcache[i & (LUMPNUMCACHESIZE - 1)].hash == hash if (lumpnumcache[i & (LUMPNUMCACHESIZE - 1)].hash == hash
&& stricmp(lumpnumcache[i & (LUMPNUMCACHESIZE - 1)].lumpname, name) == 0) && fasticmp(lumpnumcache[i & (LUMPNUMCACHESIZE - 1)].lumpname, name))
{ {
lumpnumcacheindex = i & (LUMPNUMCACHESIZE - 1); lumpnumcacheindex = i & (LUMPNUMCACHESIZE - 1);
return lumpnumcache[lumpnumcacheindex].lumpnum; return lumpnumcache[lumpnumcacheindex].lumpnum;
+1 -1
View File
@@ -167,7 +167,7 @@ UINT16 W_InitFile(const char *filename, boolean local, boolean startup);
// W_InitMultipleFiles returns 1 if all is okay, 0 otherwise, // 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. // so that it stops with a message if a file was not found, but not if all is okay.
INT32 W_InitMultipleFiles(char **filenames, boolean addons); INT32 W_InitMultipleFiles(char **filenames, size_t count, boolean addons);
// Used for autoload. Uses P_AddWadFileLocal instead of W_InitFiles. // Used for autoload. Uses P_AddWadFileLocal instead of W_InitFiles.
INT32 W_AddAutoloadedLocalFiles(char **filenames); INT32 W_AddAutoloadedLocalFiles(char **filenames);
+2 -12
View File
@@ -552,18 +552,8 @@ void Y_Ticker(void)
intertic++; intertic++;
// multiplayer uses timer (based on cv_inttime) if ((timer && !--timer)
if (timer) || (intertic == endtic))
{
if (!--timer)
{
Y_EndIntermission();
Y_FollowIntermission();
return;
}
}
// single player is hardcoded to go away after awhile
else if (intertic == endtic)
{ {
Y_EndIntermission(); Y_EndIntermission();
Y_FollowIntermission(); Y_FollowIntermission();