Compare commits
46
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
3204b5c3b4 | ||
|
|
cd02242a01 | ||
|
|
e35dc9e097 | ||
|
|
f4dc161831 | ||
|
|
1d6c27baca | ||
|
|
009df228d6 | ||
|
|
7746e494cf | ||
|
|
90a88983f1 | ||
|
|
22a4fe63db | ||
|
|
d77508f481 | ||
|
|
53321d33d5 | ||
|
|
5c28f6afd8 | ||
|
|
d49001143f | ||
|
|
513e5a7e3f | ||
|
|
6f75fab7ff | ||
|
|
38fc6d6ba1 | ||
|
|
02f2464a00 | ||
|
|
86b286fb0b | ||
|
|
ecef8913b1 | ||
|
|
277b202020 | ||
|
|
6ba97bc43c | ||
|
|
0fbde146a9 | ||
|
|
16e0c6f0f6 | ||
|
|
8cab07a4b2 | ||
|
|
6cbb8a36cf | ||
|
|
bf1aa47854 | ||
|
|
be423b2910 | ||
|
|
3bf3bdf641 | ||
|
|
e923777eb6 | ||
|
|
cf6eb0010e | ||
|
|
5184115216 | ||
|
|
39a46e8f79 | ||
|
|
d9712cf85e | ||
|
|
0691e2d9e2 | ||
|
|
08864e27b2 | ||
|
|
4a3c9ccfbb | ||
|
|
cedd789a27 | ||
|
|
8f91707164 | ||
|
|
37eba186f5 | ||
|
|
7eb2ad1e35 | ||
|
|
f49e57a38c | ||
|
|
265f4a50ef | ||
|
|
e83e2659a7 | ||
|
|
c680dd3222 | ||
|
|
96aaaf5261 | ||
|
|
efb29e6be5 |
No files matched your search
@@ -191,7 +191,6 @@ set(SRB2_CORE_GAME_SOURCES
|
|||||||
k_kart.c
|
k_kart.c
|
||||||
k_stats.c
|
k_stats.c
|
||||||
i_time.c
|
i_time.c
|
||||||
i_threads.c
|
|
||||||
|
|
||||||
p_local.h
|
p_local.h
|
||||||
p_maputl.h
|
p_maputl.h
|
||||||
|
|||||||
@@ -8,6 +8,11 @@ ifdef MINGW
|
|||||||
libs+=-mconsole
|
libs+=-mconsole
|
||||||
endif
|
endif
|
||||||
|
|
||||||
|
ifndef NOTHREADS
|
||||||
|
opts+=-DHAVE_THREADS
|
||||||
|
sources+=dedicated/i_threads.c
|
||||||
|
endif
|
||||||
|
|
||||||
NOOPENMPT=1
|
NOOPENMPT=1
|
||||||
NOLIBGME=1
|
NOLIBGME=1
|
||||||
NOHW=1
|
NOHW=1
|
||||||
|
|||||||
@@ -27,11 +27,6 @@ endif
|
|||||||
sources+=$(call List,hardware/Sourcefile)
|
sources+=$(call List,hardware/Sourcefile)
|
||||||
endif
|
endif
|
||||||
|
|
||||||
ifndef NOTHREADS
|
|
||||||
opts+=-DHAVE_THREADS
|
|
||||||
sources+=i_threads.c
|
|
||||||
endif
|
|
||||||
|
|
||||||
ifndef NOMD5
|
ifndef NOMD5
|
||||||
sources+=md5.c
|
sources+=md5.c
|
||||||
endif
|
endif
|
||||||
|
|||||||
@@ -40,6 +40,11 @@ sources+=sdl/mixer_sound.c
|
|||||||
endif
|
endif
|
||||||
endif
|
endif
|
||||||
|
|
||||||
|
ifndef NOTHREADS
|
||||||
|
opts+=-DHAVE_THREADS
|
||||||
|
sources+=sdl/i_threads.c
|
||||||
|
endif
|
||||||
|
|
||||||
ifdef SDL_PKGCONFIG
|
ifdef SDL_PKGCONFIG
|
||||||
$(eval $(call Use_pkg_config,SDL))
|
$(eval $(call Use_pkg_config,SDL))
|
||||||
else
|
else
|
||||||
|
|||||||
+1
-1
@@ -434,7 +434,7 @@ LUA_API void lua_pushnumber (lua_State *L, lua_Number n) {
|
|||||||
LUA_API void lua_pushlstring (lua_State *L, const char *s, size_t len) {
|
LUA_API void lua_pushlstring (lua_State *L, const char *s, size_t len) {
|
||||||
lua_lock(L);
|
lua_lock(L);
|
||||||
luaC_checkGC(L);
|
luaC_checkGC(L);
|
||||||
setsvalue2s(L, L->top, (len == 0) ? luaS_new(L, "") : luaS_newlstr(L, s, len));
|
setsvalue2s(L, L->top, (len == 0) ? luaS_newlstr(L, "", 0) : luaS_newlstr(L, s, len));
|
||||||
api_incr_top(L);
|
api_incr_top(L);
|
||||||
lua_unlock(L);
|
lua_unlock(L);
|
||||||
}
|
}
|
||||||
|
|||||||
+2
-2
@@ -1178,7 +1178,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 (fasticmp(name,cvar->name))
|
if (fasticmp(name, cvar->name))
|
||||||
return cvar;
|
return cvar;
|
||||||
|
|
||||||
return NULL;
|
return NULL;
|
||||||
@@ -1793,7 +1793,7 @@ void CV_AddValue(consvar_t *var, INT32 increment)
|
|||||||
if (newvalue == oldvalue)
|
if (newvalue == oldvalue)
|
||||||
break; // don't loop forever if there's none of a certain gametype
|
break; // don't loop forever if there's none of a certain gametype
|
||||||
|
|
||||||
if (newvalue >= 0 && !mapheaderinfo[newvalue])
|
if (newvalue >= 0 && newvalue < NUMMAPS && !mapheaderinfo[newvalue])
|
||||||
continue; // Don't allocate the header. That just makes memory usage skyrocket.
|
continue; // Don't allocate the header. That just makes memory usage skyrocket.
|
||||||
|
|
||||||
} while (!M_CanShowLevelInList(newvalue, gt));
|
} while (!M_CanShowLevelInList(newvalue, gt));
|
||||||
|
|||||||
+6
-6
@@ -44,18 +44,18 @@
|
|||||||
#define MAXHUDLINES 20
|
#define MAXHUDLINES 20
|
||||||
|
|
||||||
#ifdef HAVE_THREADS
|
#ifdef HAVE_THREADS
|
||||||
I_Mutex con_mutex;
|
I_mutex con_mutex;
|
||||||
|
|
||||||
// g_in_exiting_signal_handler is an evil hack
|
// I_In_Exiting_Signal_Handler is an evil hack
|
||||||
// to avoid infinite SIGABRT recursion in the signal handler
|
// to avoid infinite SIGABRT recursion in the signal handler
|
||||||
// due to poisoned locks or mach-o kernel not supporting locks in signals
|
// due to poisoned locks or mach-o kernel not supporting locks in signals
|
||||||
// or something like that. idk
|
// or something like that. idk
|
||||||
# define Lock_state() if (!g_in_exiting_signal_handler) { I_LockMutex(&con_mutex); }
|
# define Lock_state() if (!I_In_Exiting_Signal_Handler()) { I_LockMutex(&con_mutex); }
|
||||||
# define Unlock_state() if (!g_in_exiting_signal_handler) { I_UnlockMutex(con_mutex); }
|
# define Unlock_state() if (!I_In_Exiting_Signal_Handler()) { I_UnlockMutex(con_mutex); }
|
||||||
#else/*HAVE_THREADS*/
|
#else /*HAVE_THREADS*/
|
||||||
# define Lock_state()
|
# define Lock_state()
|
||||||
# define Unlock_state()
|
# define Unlock_state()
|
||||||
#endif/*HAVE_THREADS*/
|
#endif /*HAVE_THREADS*/
|
||||||
|
|
||||||
static boolean con_started = false; // console has been initialised
|
static boolean con_started = false; // console has been initialised
|
||||||
boolean con_startup = false; // true at game startup, screen need refreshing
|
boolean con_startup = false; // true at game startup, screen need refreshing
|
||||||
|
|||||||
+1
-1
@@ -22,7 +22,7 @@ void CON_Init(void);
|
|||||||
boolean CON_Responder(event_t *ev);
|
boolean CON_Responder(event_t *ev);
|
||||||
|
|
||||||
#ifdef HAVE_THREADS
|
#ifdef HAVE_THREADS
|
||||||
extern I_Mutex con_mutex;
|
extern I_mutex con_mutex;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
// set true when screen size has changed, to adapt console
|
// set true when screen size has changed, to adapt console
|
||||||
|
|||||||
+350
-320
File diff suppressed because it is too large.
Load diff
+3
-1
@@ -660,9 +660,11 @@ extern UINT8 hu_redownloadinggamestate;
|
|||||||
#endif
|
#endif
|
||||||
extern boolean hu_stopped; // kart, true when the game is stopped for players due to a disconnecting or connecting player
|
extern boolean hu_stopped; // kart, true when the game is stopped for players due to a disconnecting or connecting player
|
||||||
|
|
||||||
|
#define SAVEGAMESIZE (768*1024)
|
||||||
|
|
||||||
typedef struct rewind_s
|
typedef struct rewind_s
|
||||||
{
|
{
|
||||||
UINT8 savebuffer[(768*1024)];
|
UINT8 savebuffer[SAVEGAMESIZE];
|
||||||
tic_t leveltime;
|
tic_t leveltime;
|
||||||
size_t demopos;
|
size_t demopos;
|
||||||
|
|
||||||
|
|||||||
+33
-39
@@ -223,13 +223,13 @@ void D_ProcessEvents(void)
|
|||||||
|
|
||||||
// Menu input
|
// Menu input
|
||||||
#ifdef HAVE_THREADS
|
#ifdef HAVE_THREADS
|
||||||
I_LockMutex(&m_menu_mutex);
|
I_lock_mutex(&m_menu_mutex);
|
||||||
#endif
|
#endif
|
||||||
{
|
{
|
||||||
eaten = M_Responder(ev);
|
eaten = M_Responder(ev);
|
||||||
}
|
}
|
||||||
#ifdef HAVE_THREADS
|
#ifdef HAVE_THREADS
|
||||||
I_UnlockMutex(m_menu_mutex);
|
I_unlock_mutex(m_menu_mutex);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
if (eaten)
|
if (eaten)
|
||||||
@@ -244,13 +244,13 @@ void D_ProcessEvents(void)
|
|||||||
|
|
||||||
// console input
|
// console input
|
||||||
#ifdef HAVE_THREADS
|
#ifdef HAVE_THREADS
|
||||||
I_LockMutex(&con_mutex);
|
I_lock_mutex(&con_mutex);
|
||||||
#endif
|
#endif
|
||||||
{
|
{
|
||||||
eaten = CON_Responder(ev);
|
eaten = CON_Responder(ev);
|
||||||
}
|
}
|
||||||
#ifdef HAVE_THREADS
|
#ifdef HAVE_THREADS
|
||||||
I_UnlockMutex(con_mutex);
|
I_unlock_mutex(con_mutex);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
if (eaten)
|
if (eaten)
|
||||||
@@ -274,21 +274,17 @@ static void D_Renderview(void)
|
|||||||
|
|
||||||
R_ApplyLevelInterpolators(R_GetTimeFrac(RTF_LEVEL));
|
R_ApplyLevelInterpolators(R_GetTimeFrac(RTF_LEVEL));
|
||||||
|
|
||||||
if (rendermode == render_soft)
|
if (rendermode == render_soft && cv_homremoval.value)
|
||||||
{
|
{
|
||||||
// if this is display player 1
|
if (cv_homremoval.value == 1)
|
||||||
if (cv_homremoval.value)
|
|
||||||
{
|
{
|
||||||
if (cv_homremoval.value == 1)
|
// Clear the software screen buffer to remove HOM
|
||||||
{
|
memset(vid.screens[0], 31, vid.width * vid.height);
|
||||||
// Clear the software screen buffer to remove HOM
|
}
|
||||||
memset(vid.screens[0], 31, vid.width * vid.height);
|
else if (cv_homremoval.value == 2)
|
||||||
}
|
{
|
||||||
else if (cv_homremoval.value == 2)
|
//'development' HOM removal -- makes it blindingly obvious if HOM is spotted.
|
||||||
{
|
memset(vid.screens[0], 32+(timeinmap&15), vid.width * vid.height);
|
||||||
//'development' HOM removal -- makes it blindingly obvious if HOM is spotted.
|
|
||||||
memset(vid.screens[0], 32+(timeinmap&15), vid.width * vid.height);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -322,7 +318,6 @@ static void D_Renderview(void)
|
|||||||
break;
|
break;
|
||||||
default: // Initialize for P1
|
default: // Initialize for P1
|
||||||
viewwindowy = viewwindowx = 0;
|
viewwindowy = viewwindowx = 0;
|
||||||
objectsdrawn = 0;
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -333,19 +328,17 @@ static void D_Renderview(void)
|
|||||||
}
|
}
|
||||||
else if (rendermode == render_soft)
|
else if (rendermode == render_soft)
|
||||||
#endif
|
#endif
|
||||||
|
{
|
||||||
R_RenderPlayerView(&players[displayplayers[i]]);
|
R_RenderPlayerView(&players[displayplayers[i]]);
|
||||||
}
|
|
||||||
|
|
||||||
if (rendermode == render_soft)
|
|
||||||
{
|
|
||||||
if (i == 0)
|
|
||||||
R_ApplyViewMorph();
|
|
||||||
|
|
||||||
|
if (i == 0)
|
||||||
|
R_ApplyViewMorph();
|
||||||
#ifdef MOTIONBLUR
|
#ifdef MOTIONBLUR
|
||||||
V_DoPostProcessor(i, postimgparam[i]);
|
V_DoPostProcessor(i, postimgparam[i]);
|
||||||
#else
|
#else
|
||||||
V_DoPostProcessor(i, 0);
|
V_DoPostProcessor(i, 0);
|
||||||
#endif
|
#endif
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -577,11 +570,11 @@ static boolean D_Display(void)
|
|||||||
vid.recalc = false;
|
vid.recalc = false;
|
||||||
|
|
||||||
#ifdef HAVE_THREADS
|
#ifdef HAVE_THREADS
|
||||||
I_LockMutex(&m_menu_mutex);
|
I_lock_mutex(&m_menu_mutex);
|
||||||
#endif
|
#endif
|
||||||
M_Drawer(); // menu is drawn even on top of everything...
|
M_Drawer(); // menu is drawn even on top of everything...
|
||||||
#ifdef HAVE_THREADS
|
#ifdef HAVE_THREADS
|
||||||
I_UnlockMutex(m_menu_mutex);
|
I_unlock_mutex(m_menu_mutex);
|
||||||
#endif
|
#endif
|
||||||
// focus lost moved to M_Drawer
|
// focus lost moved to M_Drawer
|
||||||
|
|
||||||
@@ -704,6 +697,11 @@ void D_SRB2Loop(void)
|
|||||||
|
|
||||||
for (;;)
|
for (;;)
|
||||||
{
|
{
|
||||||
|
if (I_Interrupted())
|
||||||
|
{
|
||||||
|
I_Quit();
|
||||||
|
}
|
||||||
|
|
||||||
// capbudget is the minimum precise_t duration of a single loop iteration
|
// capbudget is the minimum precise_t duration of a single loop iteration
|
||||||
precise_t capbudget;
|
precise_t capbudget;
|
||||||
precise_t elapsed;
|
precise_t elapsed;
|
||||||
@@ -783,11 +781,6 @@ void D_SRB2Loop(void)
|
|||||||
|
|
||||||
doDisplay = true;
|
doDisplay = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!dedicated)
|
|
||||||
{
|
|
||||||
G_DeviceLEDTick();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (interp)
|
if (interp)
|
||||||
@@ -829,6 +822,13 @@ void D_SRB2Loop(void)
|
|||||||
if (takescreenshot)
|
if (takescreenshot)
|
||||||
M_DoScreenShot();
|
M_DoScreenShot();
|
||||||
|
|
||||||
|
#ifndef DEDICATED
|
||||||
|
if (!dedicated && renderisnewtic)
|
||||||
|
{
|
||||||
|
G_DeviceLEDTick();
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
// consoleplayer -> displayplayers (hear sounds from viewpoint)
|
// consoleplayer -> displayplayers (hear sounds from viewpoint)
|
||||||
S_UpdateSounds(); // move positional sounds
|
S_UpdateSounds(); // move positional sounds
|
||||||
|
|
||||||
@@ -1643,12 +1643,6 @@ void D_SRB2Main(void)
|
|||||||
strcpy(srb2, "SRB2Kart");
|
strcpy(srb2, "SRB2Kart");
|
||||||
D_MakeTitleString(srb2);
|
D_MakeTitleString(srb2);
|
||||||
|
|
||||||
#if defined (__OS2__) && !defined (HAVE_SDL)
|
|
||||||
// set PM window title
|
|
||||||
snprintf(pmData->title, sizeof (pmData->title), "SRB2Kart" VERSIONSTRING ": %s", title);
|
|
||||||
pmData->title[sizeof (pmData->title) - 1] = '\0';
|
|
||||||
#endif
|
|
||||||
|
|
||||||
if (devparm)
|
if (devparm)
|
||||||
CONS_Printf(M_GetText("Development mode ON.\n"));
|
CONS_Printf(M_GetText("Development mode ON.\n"));
|
||||||
|
|
||||||
|
|||||||
+1
-5
@@ -612,12 +612,8 @@ void Net_WaitAllAckReceived(UINT32 timeout)
|
|||||||
|
|
||||||
static void InitNode(node_t *node)
|
static void InitNode(node_t *node)
|
||||||
{
|
{
|
||||||
node->acktosend_head = node->acktosend_tail = 0;
|
memset(node, 0, sizeof(node_t));
|
||||||
memset(node->acktosend, 0, sizeof(node->acktosend));
|
|
||||||
node->firstacktosend = 0;
|
|
||||||
node->nextacknum = 1;
|
node->nextacknum = 1;
|
||||||
node->remotefirstack = 0;
|
|
||||||
node->flags = 0;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static void InitAck(void)
|
static void InitAck(void)
|
||||||
|
|||||||
+144
-482
@@ -1208,11 +1208,11 @@ static boolean AllowedPlayerNameChar(char ch)
|
|||||||
|
|
||||||
static boolean EnsurePlayerNameIsGood(char *name, INT32 playernum)
|
static boolean EnsurePlayerNameIsGood(char *name, INT32 playernum)
|
||||||
{
|
{
|
||||||
INT32 ix;
|
size_t ix, len = strlen(name);
|
||||||
|
|
||||||
if (strlen(name) == 0 || strlen(name) > MAXPLAYERNAME)
|
if (len == 0 || len > MAXPLAYERNAME)
|
||||||
return false; // Empty or too long.
|
return false; // Empty or too long.
|
||||||
if (name[0] == ' ' || name[strlen(name)-1] == ' ')
|
if (name[0] == ' ' || name[len-1] == ' ')
|
||||||
return false; // Starts or ends with a space.
|
return false; // Starts or ends with a space.
|
||||||
if (isdigit(name[0]))
|
if (isdigit(name[0]))
|
||||||
return false; // Starts with a digit.
|
return false; // Starts with a digit.
|
||||||
@@ -1226,20 +1226,19 @@ static boolean EnsurePlayerNameIsGood(char *name, INT32 playernum)
|
|||||||
|
|
||||||
// Also, anything over 0x80 is disallowed too, since compilers love to
|
// Also, anything over 0x80 is disallowed too, since compilers love to
|
||||||
// differ on whether they're printable characters or not.
|
// differ on whether they're printable characters or not.
|
||||||
for (ix = 0; name[ix] != '\0'; ix++)
|
for (ix = 0; ix < len; ix++)
|
||||||
if (!AllowedPlayerNameChar(name[ix]))
|
if (!AllowedPlayerNameChar(name[ix]))
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
// Check if a player is currently using the name, case-insensitively.
|
// Check if a player is currently using the name, case-insensitively.
|
||||||
for (ix = 0; ix < MAXPLAYERS; ix++)
|
for (ix = 0; ix < MAXPLAYERS; ix++)
|
||||||
{
|
{
|
||||||
if (ix != playernum && playeringame[ix]
|
if (ix != (size_t)playernum && playeringame[ix]
|
||||||
&& fasticmp(name, player_names[ix]))
|
&& 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
|
||||||
// as someone else -- modify the name instead.
|
// as someone else -- modify the name instead.
|
||||||
size_t len = strlen(name);
|
|
||||||
|
|
||||||
// Recursion!
|
// Recursion!
|
||||||
// Slowly strip characters off the end of the
|
// Slowly strip characters off the end of the
|
||||||
@@ -1458,7 +1457,9 @@ UINT8 CanChangeSkin(INT32 playernum)
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (players[playernum].spectator || players[playernum].playerstate == PST_DEAD || players[playernum].playerstate == PST_REBORN)
|
if (players[playernum].spectator ||
|
||||||
|
players[playernum].playerstate == PST_DEAD ||
|
||||||
|
players[playernum].playerstate == PST_REBORN)
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
@@ -1492,445 +1493,144 @@ static void ForceAllSkins(INT32 forcedskin)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static INT32 snacpending = 0, snac2pending = 0, snac3pending = 0, snac4pending = 0, chmappending = 0;
|
static INT32 chmappending;
|
||||||
|
static INT32 snacpending[MAXSPLITSCREENPLAYERS];
|
||||||
|
|
||||||
|
// wonky compat, idk if anything uses this....
|
||||||
|
#define playerisbot (splitplayer == 1 && botingame)
|
||||||
|
|
||||||
// name, color, or skin has changed
|
// name, color, or skin has changed
|
||||||
//
|
//
|
||||||
static void SendNameAndColor(void)
|
static void SendNameAndColor(UINT8 splitplayer)
|
||||||
{
|
{
|
||||||
char buf[MAXPLAYERNAME+2];
|
char buf[MAXPLAYERNAME+2];
|
||||||
char *p;
|
char *p;
|
||||||
|
|
||||||
p = buf;
|
p = buf;
|
||||||
|
|
||||||
|
// splitscreen
|
||||||
|
if (splitscreen < splitplayer && !playerisbot)
|
||||||
|
return;
|
||||||
|
|
||||||
|
const INT32 pnum = P_GetLocalPlayerNumForNum(splitplayer);
|
||||||
|
|
||||||
|
player_t *player = &players[pnum];
|
||||||
|
|
||||||
|
// TODO: make those cvars arrays
|
||||||
|
consvar_t *playercolor, *playername, *playerskin;
|
||||||
|
consvar_t *colorvars[] = {&cv_playercolor, &cv_playercolor2, &cv_playercolor3, &cv_playercolor4};
|
||||||
|
consvar_t *namevars[] = {&cv_playername, &cv_playername2, &cv_playername3, &cv_playername4};
|
||||||
|
consvar_t *skinvars[] = {&cv_skin, &cv_skin2, &cv_skin3, &cv_skin4};
|
||||||
|
|
||||||
|
playercolor = colorvars[splitplayer];
|
||||||
|
playername = namevars[splitplayer];
|
||||||
|
playerskin = skinvars[splitplayer];
|
||||||
|
|
||||||
// normal player colors
|
// normal player colors
|
||||||
if (G_GametypeHasTeams())
|
if (G_GametypeHasTeams())
|
||||||
{
|
{
|
||||||
if (players[consoleplayer].ctfteam == 1 && cv_playercolor.value != skincolor_redteam)
|
if (player->ctfteam == 1 && playercolor->value != skincolor_redteam)
|
||||||
CV_StealthSetValue(&cv_playercolor, skincolor_redteam);
|
CV_StealthSetValue(playercolor, skincolor_redteam);
|
||||||
else if (players[consoleplayer].ctfteam == 2 && cv_playercolor.value != skincolor_blueteam)
|
else if (player->ctfteam == 2 && playercolor->value != skincolor_blueteam)
|
||||||
CV_StealthSetValue(&cv_playercolor, skincolor_blueteam);
|
CV_StealthSetValue(playercolor, skincolor_blueteam);
|
||||||
}
|
}
|
||||||
|
|
||||||
// never allow the color "none"
|
// never allow the color "none"
|
||||||
if (!cv_playercolor.value)
|
if (!playercolor->value)
|
||||||
{
|
{
|
||||||
if (players[consoleplayer].skincolor)
|
if (player->skincolor)
|
||||||
CV_StealthSetValue(&cv_playercolor, players[consoleplayer].skincolor);
|
CV_StealthSetValue(playercolor, player->skincolor);
|
||||||
else if (skins[players[consoleplayer].skin].prefcolor)
|
else if (skins[player->skin].prefcolor)
|
||||||
CV_StealthSetValue(&cv_playercolor, skins[players[consoleplayer].skin].prefcolor);
|
CV_StealthSetValue(playercolor, skins[player->skin].prefcolor);
|
||||||
else
|
else
|
||||||
CV_StealthSet(&cv_playercolor, cv_playercolor.defaultvalue);
|
CV_StealthSet(playercolor, playercolor->defaultvalue);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (fastcmp(cv_playername.string, player_names[consoleplayer])
|
|
||||||
&& cv_playercolor.value == players[consoleplayer].skincolor
|
|
||||||
&& fastcmp(cv_skin.string, skins[players[consoleplayer].skin].name))
|
|
||||||
return;
|
|
||||||
|
|
||||||
// We'll handle it later if we're not playing.
|
// We'll handle it later if we're not playing.
|
||||||
if (!Playing())
|
if (!Playing())
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
if (fastcmp(playername->string, player_names[pnum])
|
||||||
|
&& playercolor->value == player->skincolor
|
||||||
|
&& fastcmp(playerskin->string, skins[player->skin].name))
|
||||||
|
return;
|
||||||
|
|
||||||
|
if (playerisbot)
|
||||||
|
{
|
||||||
|
players[pnum].skincolor = botcolor;
|
||||||
|
if (players[pnum].mo)
|
||||||
|
players[pnum].mo->color = players[pnum].skincolor;
|
||||||
|
SetPlayerSkinByNum(pnum, botskin-1);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
// If you're not in a netgame, merely update the skin, color, and name.
|
// If you're not in a netgame, merely update the skin, color, and name.
|
||||||
if (!netgame)
|
if (!netgame)
|
||||||
{
|
{
|
||||||
INT32 foundskin;
|
INT32 foundskin;
|
||||||
|
|
||||||
CleanupPlayerName(consoleplayer, cv_playername.zstring);
|
CleanupPlayerName(pnum, playername->zstring);
|
||||||
strcpy(player_names[consoleplayer], cv_playername.zstring);
|
strcpy(player_names[pnum], playername->zstring);
|
||||||
|
|
||||||
players[consoleplayer].skincolor = cv_playercolor.value;
|
player->skincolor = playercolor->value;
|
||||||
|
|
||||||
if (players[consoleplayer].mo)
|
if (player->mo)
|
||||||
players[consoleplayer].mo->color = players[consoleplayer].skincolor;
|
player->mo->color = player->skincolor;
|
||||||
|
|
||||||
if ((foundskin = R_SkinAvailable(cv_skin.string)) != -1)
|
if ((foundskin = R_SkinAvailable(playerskin->string)) != -1)
|
||||||
{
|
{
|
||||||
cv_skin.value = foundskin;
|
playerskin->value = foundskin;
|
||||||
SetPlayerSkin(consoleplayer, cv_skin.string);
|
SetPlayerSkin(pnum, playerskin->string);
|
||||||
CV_StealthSet(&cv_skin, skins[cv_skin.value].name);
|
CV_StealthSet(playerskin, skins[playerskin->value].name);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
cv_skin.value = players[consoleplayer].skin;
|
playerskin->value = player->skin;
|
||||||
CV_StealthSet(&cv_skin, skins[players[consoleplayer].skin].name);
|
CV_StealthSet(playerskin, skins[player->skin].name);
|
||||||
// will always be same as current
|
// will always be same as current
|
||||||
SetPlayerSkin(consoleplayer, cv_skin.string);
|
SetPlayerSkin(pnum, playerskin->string);
|
||||||
}
|
}
|
||||||
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
snacpending++;
|
snacpending[splitplayer]++;
|
||||||
|
|
||||||
// Don't change name if muted
|
// Don't change name if muted
|
||||||
if (player_name_changes[consoleplayer] >= MAXNAMECHANGES)
|
if (player_name_changes[pnum] >= MAXNAMECHANGES)
|
||||||
{
|
{
|
||||||
CV_StealthSet(&cv_playername, player_names[consoleplayer]);
|
CV_StealthSet(playername, player_names[pnum]);
|
||||||
HU_AddChatText("\x85*You must wait to change your name again", false);
|
HU_AddChatText("\x85*You must wait to change your name again", false);
|
||||||
}
|
}
|
||||||
else if (cv_mute.value && !(server || IsPlayerAdmin(consoleplayer)))
|
else if (cv_mute.value && !(server || IsPlayerAdmin(pnum)))
|
||||||
CV_StealthSet(&cv_playername, player_names[consoleplayer]);
|
CV_StealthSet(playername, player_names[pnum]);
|
||||||
else // Cleanup name if changing it
|
else // Cleanup name if changing it
|
||||||
CleanupPlayerName(consoleplayer, cv_playername.zstring);
|
CleanupPlayerName(pnum, playername->zstring);
|
||||||
|
|
||||||
// Don't change skin if the server doesn't want you to.
|
// Don't change skin if the server doesn't want you to.
|
||||||
if (!CanChangeSkin(consoleplayer))
|
if (!CanChangeSkin(pnum))
|
||||||
CV_StealthSet(&cv_skin, skins[players[consoleplayer].skin].name);
|
CV_StealthSet(playerskin, skins[player->skin].name);
|
||||||
|
|
||||||
// check if player has the skin loaded (cv_skin may have
|
// check if player has the skin loaded (cv_skin may have
|
||||||
// the name of a skin that was available in the previous game)
|
// the name of a skin that was available in the previous game)
|
||||||
cv_skin.value = R_SkinAvailable(cv_skin.string);
|
playerskin->value = R_SkinAvailable(playerskin->string);
|
||||||
if (cv_skin.value < 0)
|
if (playerskin->value < 0)
|
||||||
{
|
{
|
||||||
INT32 skinnum = players[consoleplayer].skin;
|
INT32 skinnum = player->skin;
|
||||||
CV_StealthSet(&cv_skin, skins[skinnum].name);
|
CV_StealthSet(playerskin, skins[skinnum].name);
|
||||||
cv_skin.value = skinnum;
|
playerskin->value = skinnum;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Finally write out the complete packet and send it off.
|
// Finally write out the complete packet and send it off.
|
||||||
WRITESTRINGN(p, cv_playername.zstring, MAXPLAYERNAME);
|
WRITESTRINGN(p, playername->zstring, MAXPLAYERNAME);
|
||||||
WRITEUINT8(p, (UINT8)cv_playercolor.value);
|
WRITEUINT8(p, (UINT8)playercolor->value);
|
||||||
WRITEUINT8(p, (UINT8)cv_skin.value);
|
WRITEUINT8(p, (UINT8)playerskin->value);
|
||||||
SendNetXCmdForPlayer(0, XD_NAMEANDCOLOR, buf, p - buf);
|
SendNetXCmdForPlayer(splitplayer, XD_NAMEANDCOLOR, buf, p - buf);
|
||||||
}
|
|
||||||
|
|
||||||
// splitscreen
|
|
||||||
static void SendNameAndColor2(void)
|
|
||||||
{
|
|
||||||
INT32 secondplaya = -1;
|
|
||||||
char buf[MAXPLAYERNAME+2];
|
|
||||||
char *p;
|
|
||||||
|
|
||||||
if (splitscreen < 1 && !botingame)
|
|
||||||
return; // can happen if skin2/color2/name2 changed
|
|
||||||
|
|
||||||
if (displayplayers[1] != consoleplayer)
|
|
||||||
secondplaya = displayplayers[1];
|
|
||||||
else if (!netgame) // HACK
|
|
||||||
secondplaya = 1;
|
|
||||||
|
|
||||||
if (secondplaya == -1)
|
|
||||||
return;
|
|
||||||
|
|
||||||
p = buf;
|
|
||||||
|
|
||||||
// normal player colors
|
|
||||||
if (G_GametypeHasTeams())
|
|
||||||
{
|
|
||||||
if (players[secondplaya].ctfteam == 1 && cv_playercolor2.value != skincolor_redteam)
|
|
||||||
CV_StealthSetValue(&cv_playercolor2, skincolor_redteam);
|
|
||||||
else if (players[secondplaya].ctfteam == 2 && cv_playercolor2.value != skincolor_blueteam)
|
|
||||||
CV_StealthSetValue(&cv_playercolor2, skincolor_blueteam);
|
|
||||||
}
|
|
||||||
|
|
||||||
// never allow the color "none"
|
|
||||||
if (!cv_playercolor2.value)
|
|
||||||
{
|
|
||||||
if (players[secondplaya].skincolor)
|
|
||||||
CV_StealthSetValue(&cv_playercolor2, players[secondplaya].skincolor);
|
|
||||||
else if (skins[players[secondplaya].skin].prefcolor)
|
|
||||||
CV_StealthSetValue(&cv_playercolor2, skins[players[secondplaya].skin].prefcolor);
|
|
||||||
else
|
|
||||||
CV_StealthSet(&cv_playercolor2, cv_playercolor2.defaultvalue);
|
|
||||||
}
|
|
||||||
|
|
||||||
// We'll handle it later if we're not playing.
|
|
||||||
if (!Playing())
|
|
||||||
return;
|
|
||||||
|
|
||||||
// If you're not in a netgame, merely update the skin, color, and name.
|
|
||||||
if (botingame)
|
|
||||||
{
|
|
||||||
players[secondplaya].skincolor = botcolor;
|
|
||||||
if (players[secondplaya].mo)
|
|
||||||
players[secondplaya].mo->color = players[secondplaya].skincolor;
|
|
||||||
SetPlayerSkinByNum(secondplaya, botskin-1);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
else if (!netgame)
|
|
||||||
{
|
|
||||||
INT32 foundskin;
|
|
||||||
|
|
||||||
CleanupPlayerName(secondplaya, cv_playername2.zstring);
|
|
||||||
strcpy(player_names[secondplaya], cv_playername2.zstring);
|
|
||||||
|
|
||||||
// don't use displayplayers[1]: the second player must be 1
|
|
||||||
players[secondplaya].skincolor = cv_playercolor2.value;
|
|
||||||
if (players[secondplaya].mo)
|
|
||||||
players[secondplaya].mo->color = players[secondplaya].skincolor;
|
|
||||||
|
|
||||||
if ((foundskin = R_SkinAvailable(cv_skin2.string)) != -1)
|
|
||||||
{
|
|
||||||
cv_skin2.value = foundskin;
|
|
||||||
SetPlayerSkin(secondplaya, cv_skin2.string);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
cv_skin2.value = players[secondplaya].skin;
|
|
||||||
CV_StealthSet(&cv_skin2, skins[players[secondplaya].skin].name);
|
|
||||||
// will always be same as current
|
|
||||||
SetPlayerSkin(secondplaya, cv_skin2.string);
|
|
||||||
}
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
snac2pending++;
|
|
||||||
|
|
||||||
// Don't change name if muted
|
|
||||||
if (player_name_changes[displayplayers[1]] >= MAXNAMECHANGES)
|
|
||||||
{
|
|
||||||
CV_StealthSet(&cv_playername2, player_names[displayplayers[1]]);
|
|
||||||
HU_AddChatText("\x85*You must wait to change your name again", false);
|
|
||||||
}
|
|
||||||
else if (cv_mute.value && !(server || IsPlayerAdmin(displayplayers[1])))
|
|
||||||
CV_StealthSet(&cv_playername2, player_names[displayplayers[1]]);
|
|
||||||
else // Cleanup name if changing it
|
|
||||||
CleanupPlayerName(displayplayers[1], cv_playername2.zstring);
|
|
||||||
|
|
||||||
// Don't change skin if the server doesn't want you to.
|
|
||||||
if (!CanChangeSkin(displayplayers[1]))
|
|
||||||
CV_StealthSet(&cv_skin2, skins[players[displayplayers[1]].skin].name);
|
|
||||||
|
|
||||||
// check if player has the skin loaded (cv_skin2 may have
|
|
||||||
// the name of a skin that was available in the previous game)
|
|
||||||
cv_skin2.value = R_SkinAvailable(cv_skin2.string);
|
|
||||||
if (cv_skin2.value < 0)
|
|
||||||
{
|
|
||||||
INT32 skinnum = players[displayplayers[1]].skin;
|
|
||||||
CV_StealthSet(&cv_skin2, skins[skinnum].name);
|
|
||||||
cv_skin2.value = skinnum;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Finally write out the complete packet and send it off.
|
|
||||||
WRITESTRINGN(p, cv_playername2.zstring, MAXPLAYERNAME);
|
|
||||||
WRITEUINT8(p, (UINT8)cv_playercolor2.value);
|
|
||||||
WRITEUINT8(p, (UINT8)cv_skin2.value);
|
|
||||||
SendNetXCmdForPlayer(1, XD_NAMEANDCOLOR, buf, p - buf);
|
|
||||||
}
|
|
||||||
|
|
||||||
static void SendNameAndColor3(void)
|
|
||||||
{
|
|
||||||
INT32 thirdplaya = -1;
|
|
||||||
char buf[MAXPLAYERNAME+2];
|
|
||||||
char *p;
|
|
||||||
|
|
||||||
if (splitscreen < 2)
|
|
||||||
return; // can happen if skin3/color3/name3 changed
|
|
||||||
|
|
||||||
if (displayplayers[2] != consoleplayer)
|
|
||||||
thirdplaya = displayplayers[2];
|
|
||||||
else if (!netgame) // HACK
|
|
||||||
thirdplaya = 2;
|
|
||||||
|
|
||||||
if (thirdplaya == -1)
|
|
||||||
return;
|
|
||||||
|
|
||||||
p = buf;
|
|
||||||
|
|
||||||
// normal player colors
|
|
||||||
if (G_GametypeHasTeams())
|
|
||||||
{
|
|
||||||
if (players[thirdplaya].ctfteam == 1 && cv_playercolor3.value != skincolor_redteam)
|
|
||||||
CV_StealthSetValue(&cv_playercolor3, skincolor_redteam);
|
|
||||||
else if (players[thirdplaya].ctfteam == 2 && cv_playercolor3.value != skincolor_blueteam)
|
|
||||||
CV_StealthSetValue(&cv_playercolor3, skincolor_blueteam);
|
|
||||||
}
|
|
||||||
|
|
||||||
// never allow the color "none"
|
|
||||||
if (!cv_playercolor3.value)
|
|
||||||
{
|
|
||||||
if (players[thirdplaya].skincolor)
|
|
||||||
CV_StealthSetValue(&cv_playercolor3, players[thirdplaya].skincolor);
|
|
||||||
else if (skins[players[thirdplaya].skin].prefcolor)
|
|
||||||
CV_StealthSetValue(&cv_playercolor3, skins[players[thirdplaya].skin].prefcolor);
|
|
||||||
else
|
|
||||||
CV_StealthSet(&cv_playercolor3, cv_playercolor3.defaultvalue);
|
|
||||||
}
|
|
||||||
|
|
||||||
// We'll handle it later if we're not playing.
|
|
||||||
if (!Playing())
|
|
||||||
return;
|
|
||||||
|
|
||||||
// If you're not in a netgame, merely update the skin, color, and name.
|
|
||||||
if (!netgame)
|
|
||||||
{
|
|
||||||
INT32 foundskin;
|
|
||||||
|
|
||||||
CleanupPlayerName(thirdplaya, cv_playername3.zstring);
|
|
||||||
strcpy(player_names[thirdplaya], cv_playername3.zstring);
|
|
||||||
|
|
||||||
// don't use displayplayers[2]: the third player must be 2
|
|
||||||
players[thirdplaya].skincolor = cv_playercolor3.value;
|
|
||||||
if (players[thirdplaya].mo)
|
|
||||||
players[thirdplaya].mo->color = players[thirdplaya].skincolor;
|
|
||||||
|
|
||||||
if ((foundskin = R_SkinAvailable(cv_skin3.string)) != -1)
|
|
||||||
{
|
|
||||||
cv_skin3.value = foundskin;
|
|
||||||
SetPlayerSkin(thirdplaya, cv_skin3.string);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
cv_skin3.value = players[thirdplaya].skin;
|
|
||||||
CV_StealthSet(&cv_skin3, skins[players[thirdplaya].skin].name);
|
|
||||||
// will always be same as current
|
|
||||||
SetPlayerSkin(thirdplaya, cv_skin3.string);
|
|
||||||
}
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
snac3pending++;
|
|
||||||
|
|
||||||
// Don't change name if muted
|
|
||||||
if (player_name_changes[displayplayers[2]] >= MAXNAMECHANGES)
|
|
||||||
{
|
|
||||||
CV_StealthSet(&cv_playername3, player_names[displayplayers[2]]);
|
|
||||||
HU_AddChatText("\x85*You must wait to change your name again", false);
|
|
||||||
}
|
|
||||||
else if (cv_mute.value && !(server || IsPlayerAdmin(displayplayers[2])))
|
|
||||||
CV_StealthSet(&cv_playername3, player_names[displayplayers[2]]);
|
|
||||||
else // Cleanup name if changing it
|
|
||||||
CleanupPlayerName(displayplayers[2], cv_playername3.zstring);
|
|
||||||
|
|
||||||
// Don't change skin if the server doesn't want you to.
|
|
||||||
if (!CanChangeSkin(displayplayers[2]))
|
|
||||||
CV_StealthSet(&cv_skin3, skins[players[displayplayers[2]].skin].name);
|
|
||||||
|
|
||||||
// check if player has the skin loaded (cv_skin3 may have
|
|
||||||
// the name of a skin that was available in the previous game)
|
|
||||||
cv_skin3.value = R_SkinAvailable(cv_skin3.string);
|
|
||||||
if (cv_skin3.value < 0)
|
|
||||||
{
|
|
||||||
INT32 skinnum = players[displayplayers[2]].skin;
|
|
||||||
CV_StealthSet(&cv_skin3, skins[skinnum].name);
|
|
||||||
cv_skin3.value = skinnum;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Finally write out the complete packet and send it off.
|
|
||||||
WRITESTRINGN(p, cv_playername3.zstring, MAXPLAYERNAME);
|
|
||||||
WRITEUINT8(p, (UINT8)cv_playercolor3.value);
|
|
||||||
WRITEUINT8(p, (UINT8)cv_skin3.value);
|
|
||||||
SendNetXCmdForPlayer(2, XD_NAMEANDCOLOR, buf, p - buf);
|
|
||||||
}
|
|
||||||
|
|
||||||
static void SendNameAndColor4(void)
|
|
||||||
{
|
|
||||||
INT32 fourthplaya = -1;
|
|
||||||
char buf[MAXPLAYERNAME+2];
|
|
||||||
char *p;
|
|
||||||
|
|
||||||
if (splitscreen < 3)
|
|
||||||
return; // can happen if skin4/color4/name4 changed
|
|
||||||
|
|
||||||
if (displayplayers[3] != consoleplayer)
|
|
||||||
fourthplaya = displayplayers[3];
|
|
||||||
else if (!netgame) // HACK
|
|
||||||
fourthplaya = 3;
|
|
||||||
|
|
||||||
if (fourthplaya == -1)
|
|
||||||
return;
|
|
||||||
|
|
||||||
p = buf;
|
|
||||||
|
|
||||||
// normal player colors
|
|
||||||
if (G_GametypeHasTeams())
|
|
||||||
{
|
|
||||||
if (players[fourthplaya].ctfteam == 1 && cv_playercolor4.value != skincolor_redteam)
|
|
||||||
CV_StealthSetValue(&cv_playercolor4, skincolor_redteam);
|
|
||||||
else if (players[fourthplaya].ctfteam == 2 && cv_playercolor4.value != skincolor_blueteam)
|
|
||||||
CV_StealthSetValue(&cv_playercolor4, skincolor_blueteam);
|
|
||||||
}
|
|
||||||
|
|
||||||
// never allow the color "none"
|
|
||||||
if (!cv_playercolor4.value)
|
|
||||||
{
|
|
||||||
if (players[fourthplaya].skincolor)
|
|
||||||
CV_StealthSetValue(&cv_playercolor4, players[fourthplaya].skincolor);
|
|
||||||
else if (skins[players[fourthplaya].skin].prefcolor)
|
|
||||||
CV_StealthSetValue(&cv_playercolor4, skins[players[fourthplaya].skin].prefcolor);
|
|
||||||
else
|
|
||||||
CV_StealthSet(&cv_playercolor4, cv_playercolor4.defaultvalue);
|
|
||||||
}
|
|
||||||
|
|
||||||
// We'll handle it later if we're not playing.
|
|
||||||
if (!Playing())
|
|
||||||
return;
|
|
||||||
|
|
||||||
// If you're not in a netgame, merely update the skin, color, and name.
|
|
||||||
if (botingame)
|
|
||||||
{
|
|
||||||
players[fourthplaya].skincolor = botcolor;
|
|
||||||
if (players[fourthplaya].mo)
|
|
||||||
players[fourthplaya].mo->color = players[fourthplaya].skincolor;
|
|
||||||
SetPlayerSkinByNum(fourthplaya, botskin-1);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
else if (!netgame)
|
|
||||||
{
|
|
||||||
INT32 foundskin;
|
|
||||||
|
|
||||||
CleanupPlayerName(fourthplaya, cv_playername4.zstring);
|
|
||||||
strcpy(player_names[fourthplaya], cv_playername4.zstring);
|
|
||||||
|
|
||||||
// don't use displayplayers[3]: the second player must be 4
|
|
||||||
players[fourthplaya].skincolor = cv_playercolor4.value;
|
|
||||||
if (players[fourthplaya].mo)
|
|
||||||
players[fourthplaya].mo->color = players[fourthplaya].skincolor;
|
|
||||||
|
|
||||||
if ((foundskin = R_SkinAvailable(cv_skin4.string)) != -1)
|
|
||||||
{
|
|
||||||
cv_skin4.value = foundskin;
|
|
||||||
SetPlayerSkin(fourthplaya, cv_skin4.string);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
cv_skin4.value = players[fourthplaya].skin;
|
|
||||||
CV_StealthSet(&cv_skin4, skins[players[fourthplaya].skin].name);
|
|
||||||
// will always be same as current
|
|
||||||
SetPlayerSkin(fourthplaya, cv_skin4.string);
|
|
||||||
}
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
snac4pending++;
|
|
||||||
|
|
||||||
// Don't change name if muted
|
|
||||||
if (player_name_changes[displayplayers[3]] >= MAXNAMECHANGES)
|
|
||||||
{
|
|
||||||
CV_StealthSet(&cv_playername4, player_names[displayplayers[3]]);
|
|
||||||
HU_AddChatText("\x85*You must wait to change your name again", false);
|
|
||||||
}
|
|
||||||
else if (cv_mute.value && !(server || IsPlayerAdmin(displayplayers[3])))
|
|
||||||
CV_StealthSet(&cv_playername4, player_names[displayplayers[3]]);
|
|
||||||
else // Cleanup name if changing it
|
|
||||||
CleanupPlayerName(displayplayers[3], cv_playername4.zstring);
|
|
||||||
|
|
||||||
// Don't change skin if the server doesn't want you to.
|
|
||||||
if (!CanChangeSkin(displayplayers[3]))
|
|
||||||
CV_StealthSet(&cv_skin4, skins[players[displayplayers[3]].skin].name);
|
|
||||||
|
|
||||||
// check if player has the skin loaded (cv_skin4 may have
|
|
||||||
// the name of a skin that was available in the previous game)
|
|
||||||
cv_skin4.value = R_SkinAvailable(cv_skin4.string);
|
|
||||||
if (cv_skin4.value < 0)
|
|
||||||
{
|
|
||||||
INT32 skinnum = players[displayplayers[3]].skin;
|
|
||||||
CV_StealthSet(&cv_skin4, skins[skinnum].name);
|
|
||||||
cv_skin4.value = skinnum;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Finally write out the complete packet and send it off.
|
|
||||||
WRITESTRINGN(p, cv_playername4.zstring, MAXPLAYERNAME);
|
|
||||||
WRITEUINT8(p, (UINT8)cv_playercolor4.value);
|
|
||||||
WRITEUINT8(p, (UINT8)cv_skin4.value);
|
|
||||||
SendNetXCmdForPlayer(3, XD_NAMEANDCOLOR, buf, p - buf);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static void Got_NameAndColor(const UINT8 **cp, INT32 playernum)
|
static void Got_NameAndColor(const UINT8 **cp, INT32 playernum)
|
||||||
{
|
{
|
||||||
player_t *p = &players[playernum];
|
player_t *player = &players[playernum];
|
||||||
char name[MAXPLAYERNAME+1];
|
char name[MAXPLAYERNAME+1];
|
||||||
UINT8 color, skin;
|
UINT8 color, skin;
|
||||||
|
|
||||||
@@ -1939,19 +1639,14 @@ static void Got_NameAndColor(const UINT8 **cp, INT32 playernum)
|
|||||||
I_Error("There is no player %d!", playernum);
|
I_Error("There is no player %d!", playernum);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
if (playernum == consoleplayer)
|
if (P_IsLocalPlayer(player))
|
||||||
snacpending--; // TODO: make snacpending an array instead of 4 separate vars?
|
{
|
||||||
else if (playernum == displayplayers[1])
|
snacpending[playernum]--;
|
||||||
snac2pending--;
|
|
||||||
else if (playernum == displayplayers[2])
|
|
||||||
snac3pending--;
|
|
||||||
else if (playernum == displayplayers[3])
|
|
||||||
snac4pending--;
|
|
||||||
|
|
||||||
#ifdef PARANOIA
|
#ifdef PARANOIA
|
||||||
if (snacpending < 0 || snac2pending < 0 || snac3pending < 0 || snac4pending < 0)
|
if (snacpending[playernum] < 0)
|
||||||
I_Error("snacpending negative!");
|
I_Error("snacpending negative!");
|
||||||
#endif
|
#endif
|
||||||
|
}
|
||||||
|
|
||||||
READSTRINGN(*cp, name, MAXPLAYERNAME);
|
READSTRINGN(*cp, name, MAXPLAYERNAME);
|
||||||
color = READUINT8(*cp);
|
color = READUINT8(*cp);
|
||||||
@@ -1965,33 +1660,32 @@ static void Got_NameAndColor(const UINT8 **cp, INT32 playernum)
|
|||||||
}
|
}
|
||||||
|
|
||||||
// set color
|
// set color
|
||||||
p->skincolor = color % MAXSKINCOLORS;
|
player->skincolor = color % MAXSKINCOLORS;
|
||||||
if (p->mo)
|
if (player->mo)
|
||||||
p->mo->color = (UINT8)p->skincolor;
|
player->mo->color = (UINT8)player->skincolor;
|
||||||
demo_extradata[playernum] |= DXD_COLOR;
|
demo_extradata[playernum] |= DXD_COLOR;
|
||||||
|
|
||||||
// normal player colors
|
// normal player colors
|
||||||
if (server && (p != &players[consoleplayer] && p != &players[displayplayers[1]]
|
if (server && !P_IsLocalPlayer(player))
|
||||||
&& p != &players[displayplayers[2]] && p != &players[displayplayers[3]]))
|
|
||||||
{
|
{
|
||||||
boolean kick = false;
|
boolean kick = false;
|
||||||
|
|
||||||
// team colors
|
// team colors
|
||||||
if (G_GametypeHasTeams())
|
if (G_GametypeHasTeams())
|
||||||
{
|
{
|
||||||
if (p->ctfteam == 1 && p->skincolor != skincolor_redteam)
|
if (player->ctfteam == 1 && player->skincolor != skincolor_redteam)
|
||||||
kick = true;
|
kick = true;
|
||||||
else if (p->ctfteam == 2 && p->skincolor != skincolor_blueteam)
|
else if (player->ctfteam == 2 && player->skincolor != skincolor_blueteam)
|
||||||
kick = true;
|
kick = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
// don't allow color "none"
|
// don't allow color "none"
|
||||||
if (!p->skincolor)
|
if (!player->skincolor)
|
||||||
kick = true;
|
kick = true;
|
||||||
|
|
||||||
if (kick)
|
if (kick)
|
||||||
{
|
{
|
||||||
CONS_Alert(CONS_WARNING, M_GetText("Illegal color change received from %s (team: %d), color: %d)\n"), player_names[playernum], p->ctfteam, p->skincolor);
|
CONS_Alert(CONS_WARNING, M_GetText("Illegal color change received from %s (team: %d), color: %d)\n"), player_names[playernum], player->ctfteam, player->skincolor);
|
||||||
SendKick(playernum, KICK_MSG_CON_FAIL);
|
SendKick(playernum, KICK_MSG_CON_FAIL);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@@ -2003,6 +1697,7 @@ static void Got_NameAndColor(const UINT8 **cp, INT32 playernum)
|
|||||||
const INT32 forcedskin = cv_forceskin.value;
|
const INT32 forcedskin = cv_forceskin.value;
|
||||||
SetPlayerSkinByNum(playernum, forcedskin);
|
SetPlayerSkinByNum(playernum, forcedskin);
|
||||||
|
|
||||||
|
// TODO: make cv_skin an array
|
||||||
if (playernum == consoleplayer)
|
if (playernum == consoleplayer)
|
||||||
CV_StealthSet(&cv_skin, skins[forcedskin].name);
|
CV_StealthSet(&cv_skin, skins[forcedskin].name);
|
||||||
else if (playernum == displayplayers[1])
|
else if (playernum == displayplayers[1])
|
||||||
@@ -2016,44 +1711,16 @@ static void Got_NameAndColor(const UINT8 **cp, INT32 playernum)
|
|||||||
SetPlayerSkinByNum(playernum, skin);
|
SetPlayerSkinByNum(playernum, skin);
|
||||||
}
|
}
|
||||||
|
|
||||||
void SendWeaponPref(void)
|
void SendWeaponPref(UINT8 splitplayer)
|
||||||
{
|
{
|
||||||
UINT8 buf[1];
|
UINT8 buf[1];
|
||||||
|
|
||||||
buf[0] = 0;
|
buf[0] = 0;
|
||||||
if (cv_flipcam[0].value)
|
|
||||||
|
if (cv_flipcam[splitplayer].value)
|
||||||
buf[0] |= 1;
|
buf[0] |= 1;
|
||||||
SendNetXCmdForPlayer(0, XD_WEAPONPREF, buf, 1);
|
|
||||||
}
|
|
||||||
|
|
||||||
void SendWeaponPref2(void)
|
SendNetXCmdForPlayer(splitplayer, XD_WEAPONPREF, buf, 1);
|
||||||
{
|
|
||||||
UINT8 buf[1];
|
|
||||||
|
|
||||||
buf[0] = 0;
|
|
||||||
if (cv_flipcam[1].value)
|
|
||||||
buf[0] |= 1;
|
|
||||||
SendNetXCmdForPlayer(1, XD_WEAPONPREF, buf, 1);
|
|
||||||
}
|
|
||||||
|
|
||||||
void SendWeaponPref3(void)
|
|
||||||
{
|
|
||||||
UINT8 buf[1];
|
|
||||||
|
|
||||||
buf[0] = 0;
|
|
||||||
if (cv_flipcam[2].value)
|
|
||||||
buf[0] |= 1;
|
|
||||||
SendNetXCmdForPlayer(2, XD_WEAPONPREF, buf, 1);
|
|
||||||
}
|
|
||||||
|
|
||||||
void SendWeaponPref4(void)
|
|
||||||
{
|
|
||||||
UINT8 buf[1];
|
|
||||||
|
|
||||||
buf[0] = 0;
|
|
||||||
if (cv_flipcam[3].value)
|
|
||||||
buf[0] |= 1;
|
|
||||||
SendNetXCmdForPlayer(3, XD_WEAPONPREF, buf, 1);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static void Got_WeaponPref(const UINT8 **cp, INT32 playernum)
|
static void Got_WeaponPref(const UINT8 **cp, INT32 playernum)
|
||||||
@@ -2069,23 +1736,10 @@ static void Got_WeaponPref(const UINT8 **cp, INT32 playernum)
|
|||||||
player->pflags |= PF_ANALOGMODE;
|
player->pflags |= PF_ANALOGMODE;
|
||||||
}
|
}
|
||||||
|
|
||||||
void D_SendPlayerConfig(void)
|
void D_SendPlayerConfig(UINT8 splitplayer)
|
||||||
{
|
{
|
||||||
SendNameAndColor();
|
SendNameAndColor(splitplayer);
|
||||||
if (splitscreen || botingame)
|
SendWeaponPref(splitplayer);
|
||||||
SendNameAndColor2();
|
|
||||||
if (splitscreen > 1)
|
|
||||||
SendNameAndColor3();
|
|
||||||
if (splitscreen > 2)
|
|
||||||
SendNameAndColor4();
|
|
||||||
|
|
||||||
SendWeaponPref();
|
|
||||||
if (splitscreen)
|
|
||||||
SendWeaponPref2();
|
|
||||||
if (splitscreen > 1)
|
|
||||||
SendWeaponPref3();
|
|
||||||
if (splitscreen > 2)
|
|
||||||
SendWeaponPref4();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Only works for displayplayer, sorry!
|
// Only works for displayplayer, sorry!
|
||||||
@@ -2108,10 +1762,12 @@ INT32 D_LookupPlayer(const char *s)
|
|||||||
return playernum;
|
return playernum;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const size_t len = strlen(s);
|
||||||
|
|
||||||
for (playernum = 0; playernum < MAXPLAYERS; ++playernum)
|
for (playernum = 0; playernum < MAXPLAYERS; ++playernum)
|
||||||
{
|
{
|
||||||
/* Match name case-insensitively: fully, or partially the start. */
|
/* Match name case-insensitively: fully, or partially the start. */
|
||||||
if (playeringame[playernum] && (strnicmp(player_names[playernum], s, strlen(s)) == 0))
|
if (playeringame[playernum] && (strnicmp(player_names[playernum], s, len) == 0))
|
||||||
{
|
{
|
||||||
return playernum;
|
return playernum;
|
||||||
}
|
}
|
||||||
@@ -2151,13 +1807,15 @@ static void GetViewablePlayerPlaceRange(INT32 *first, INT32 *last)
|
|||||||
(*last) = 0;
|
(*last) = 0;
|
||||||
|
|
||||||
for (i = 0; i < MAXPLAYERS; ++i)
|
for (i = 0; i < MAXPLAYERS; ++i)
|
||||||
if (G_CouldView(i))
|
|
||||||
{
|
{
|
||||||
place = players[i].kartstuff[k_position];
|
if (G_CouldView(i))
|
||||||
if (place < (*first))
|
{
|
||||||
(*first) = place;
|
place = players[i].kartstuff[k_position];
|
||||||
if (place > (*last))
|
if (place < (*first))
|
||||||
(*last) = place;
|
(*first) = place;
|
||||||
|
if (place > (*last))
|
||||||
|
(*last) = place;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -2491,7 +2149,7 @@ void D_MapChange(INT32 mapnum, INT32 newgametype, boolean pencoremode, boolean r
|
|||||||
displayplayers[1] = 1;
|
displayplayers[1] = 1;
|
||||||
playeringame[1] = true;
|
playeringame[1] = true;
|
||||||
players[1].bot = 1;
|
players[1].bot = 1;
|
||||||
SendNameAndColor2();
|
SendNameAndColor(1);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -5768,50 +5426,54 @@ static void ForceSkin_OnChange(void)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
//Allows the player's name to be changed if cv_mute is off.
|
// Allows the player's name to be changed if cv_mute is off.
|
||||||
static void Name_OnChange(void)
|
static void Name_OnChange(void)
|
||||||
{
|
{
|
||||||
if (cv_mute.value && !(server || IsPlayerAdmin(consoleplayer)))
|
if (cv_mute.value && !(server || IsPlayerAdmin(consoleplayer)))
|
||||||
{
|
{
|
||||||
CONS_Alert(CONS_NOTICE, M_GetText("You may not change your name when chat is muted.\n"));
|
CONS_Alert(CONS_NOTICE, M_GetText("You may not change your name when chat is muted.\n"));
|
||||||
CV_StealthSet(&cv_playername, player_names[consoleplayer]);
|
CV_StealthSet(&cv_playername, player_names[consoleplayer]);
|
||||||
|
return;
|
||||||
}
|
}
|
||||||
else
|
|
||||||
SendNameAndColor();
|
SendNameAndColor(0);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static void Name2_OnChange(void)
|
static void Name2_OnChange(void)
|
||||||
{
|
{
|
||||||
if (cv_mute.value) //Secondary player can't be admin.
|
if (cv_mute.value) // Secondary player can't be admin.
|
||||||
{
|
{
|
||||||
CONS_Alert(CONS_NOTICE, M_GetText("You may not change your name when chat is muted.\n"));
|
CONS_Alert(CONS_NOTICE, M_GetText("You may not change your name when chat is muted.\n"));
|
||||||
CV_StealthSet(&cv_playername2, player_names[displayplayers[1]]);
|
CV_StealthSet(&cv_playername2, player_names[displayplayers[1]]);
|
||||||
|
return;
|
||||||
}
|
}
|
||||||
else
|
|
||||||
SendNameAndColor2();
|
SendNameAndColor(1);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void Name3_OnChange(void)
|
static void Name3_OnChange(void)
|
||||||
{
|
{
|
||||||
if (cv_mute.value) //Third player can't be admin.
|
if (cv_mute.value) // Third player can't be admin.
|
||||||
{
|
{
|
||||||
CONS_Alert(CONS_NOTICE, M_GetText("You may not change your name when chat is muted.\n"));
|
CONS_Alert(CONS_NOTICE, M_GetText("You may not change your name when chat is muted.\n"));
|
||||||
CV_StealthSet(&cv_playername3, player_names[displayplayers[2]]);
|
CV_StealthSet(&cv_playername3, player_names[displayplayers[2]]);
|
||||||
|
return;
|
||||||
}
|
}
|
||||||
else
|
|
||||||
SendNameAndColor3();
|
SendNameAndColor(2);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void Name4_OnChange(void)
|
static void Name4_OnChange(void)
|
||||||
{
|
{
|
||||||
if (cv_mute.value) //Secondary player can't be admin.
|
if (cv_mute.value) // Secondary player can't be admin.
|
||||||
{
|
{
|
||||||
CONS_Alert(CONS_NOTICE, M_GetText("You may not change your name when chat is muted.\n"));
|
CONS_Alert(CONS_NOTICE, M_GetText("You may not change your name when chat is muted.\n"));
|
||||||
CV_StealthSet(&cv_playername4, player_names[displayplayers[3]]);
|
CV_StealthSet(&cv_playername4, player_names[displayplayers[3]]);
|
||||||
|
return;
|
||||||
}
|
}
|
||||||
else
|
|
||||||
SendNameAndColor4();
|
SendNameAndColor(3);
|
||||||
}
|
}
|
||||||
|
|
||||||
/** Sends a skin change for the console player, unless that player is moving.
|
/** Sends a skin change for the console player, unless that player is moving.
|
||||||
@@ -5833,7 +5495,7 @@ static void Skin_OnChange(void)
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (CanChangeSkin(consoleplayer) && !P_PlayerMoving(consoleplayer))
|
if (CanChangeSkin(consoleplayer) && !P_PlayerMoving(consoleplayer))
|
||||||
SendNameAndColor();
|
SendNameAndColor(0);
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
CONS_Alert(CONS_NOTICE, M_GetText("You can't change your skin at the moment.\n"));
|
CONS_Alert(CONS_NOTICE, M_GetText("You can't change your skin at the moment.\n"));
|
||||||
@@ -5854,7 +5516,7 @@ static void Skin2_OnChange(void)
|
|||||||
return; // do whatever you want
|
return; // do whatever you want
|
||||||
|
|
||||||
if (CanChangeSkin(displayplayers[1]) && !P_PlayerMoving(displayplayers[1]))
|
if (CanChangeSkin(displayplayers[1]) && !P_PlayerMoving(displayplayers[1]))
|
||||||
SendNameAndColor2();
|
SendNameAndColor(1);
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
CONS_Alert(CONS_NOTICE, M_GetText("You can't change your skin at the moment.\n"));
|
CONS_Alert(CONS_NOTICE, M_GetText("You can't change your skin at the moment.\n"));
|
||||||
@@ -5870,7 +5532,7 @@ static void Skin3_OnChange(void)
|
|||||||
return; // do whatever you want
|
return; // do whatever you want
|
||||||
|
|
||||||
if (CanChangeSkin(displayplayers[2]) && !P_PlayerMoving(displayplayers[2]))
|
if (CanChangeSkin(displayplayers[2]) && !P_PlayerMoving(displayplayers[2]))
|
||||||
SendNameAndColor3();
|
SendNameAndColor(2);
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
CONS_Alert(CONS_NOTICE, M_GetText("You can't change your skin at the moment.\n"));
|
CONS_Alert(CONS_NOTICE, M_GetText("You can't change your skin at the moment.\n"));
|
||||||
@@ -5886,7 +5548,7 @@ static void Skin4_OnChange(void)
|
|||||||
return; // do whatever you want
|
return; // do whatever you want
|
||||||
|
|
||||||
if (CanChangeSkin(displayplayers[3]) && !P_PlayerMoving(displayplayers[3]))
|
if (CanChangeSkin(displayplayers[3]) && !P_PlayerMoving(displayplayers[3]))
|
||||||
SendNameAndColor4();
|
SendNameAndColor(3);
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
CONS_Alert(CONS_NOTICE, M_GetText("You can't change your skin at the moment.\n"));
|
CONS_Alert(CONS_NOTICE, M_GetText("You can't change your skin at the moment.\n"));
|
||||||
@@ -5999,7 +5661,7 @@ static void Color_OnChange(void)
|
|||||||
if (!P_PlayerMoving(consoleplayer))
|
if (!P_PlayerMoving(consoleplayer))
|
||||||
{
|
{
|
||||||
// Color change menu scrolling fix is no longer necessary
|
// Color change menu scrolling fix is no longer necessary
|
||||||
SendNameAndColor();
|
SendNameAndColor(0);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@@ -6021,7 +5683,7 @@ static void Color2_OnChange(void)
|
|||||||
if (!P_PlayerMoving(displayplayers[1]))
|
if (!P_PlayerMoving(displayplayers[1]))
|
||||||
{
|
{
|
||||||
// Color change menu scrolling fix is no longer necessary
|
// Color change menu scrolling fix is no longer necessary
|
||||||
SendNameAndColor2();
|
SendNameAndColor(1);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@@ -6038,7 +5700,7 @@ static void Color3_OnChange(void)
|
|||||||
if (!P_PlayerMoving(displayplayers[2]))
|
if (!P_PlayerMoving(displayplayers[2]))
|
||||||
{
|
{
|
||||||
// Color change menu scrolling fix is no longer necessary
|
// Color change menu scrolling fix is no longer necessary
|
||||||
SendNameAndColor3();
|
SendNameAndColor(2);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@@ -6055,7 +5717,7 @@ static void Color4_OnChange(void)
|
|||||||
if (!P_PlayerMoving(displayplayers[3]))
|
if (!P_PlayerMoving(displayplayers[3]))
|
||||||
{
|
{
|
||||||
// Color change menu scrolling fix is no longer necessary
|
// Color change menu scrolling fix is no longer necessary
|
||||||
SendNameAndColor4();
|
SendNameAndColor(3);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
|||||||
+2
-5
@@ -21,10 +21,7 @@ extern "C" {
|
|||||||
|
|
||||||
#include "command.h"
|
#include "command.h"
|
||||||
|
|
||||||
void SendWeaponPref(void);
|
void SendWeaponPref(UINT8 splitplayer);
|
||||||
void SendWeaponPref2(void);
|
|
||||||
void SendWeaponPref3(void);
|
|
||||||
void SendWeaponPref4(void);
|
|
||||||
|
|
||||||
// console vars
|
// console vars
|
||||||
extern consvar_t cv_playername;
|
extern consvar_t cv_playername;
|
||||||
@@ -295,7 +292,7 @@ typedef union {
|
|||||||
// add game commands, needs cleanup
|
// add game commands, needs cleanup
|
||||||
void D_RegisterServerCommands(void);
|
void D_RegisterServerCommands(void);
|
||||||
void D_RegisterClientCommands(void);
|
void D_RegisterClientCommands(void);
|
||||||
void D_SendPlayerConfig(void);
|
void D_SendPlayerConfig(UINT8 splitplayer);
|
||||||
void Command_ExitGame_f(void);
|
void Command_ExitGame_f(void);
|
||||||
void Command_Retry_f(void);
|
void Command_Retry_f(void);
|
||||||
void D_GameTypeChanged(INT32 lastgametype); // not a real _OnChange function anymore
|
void D_GameTypeChanged(INT32 lastgametype); // not a real _OnChange function anymore
|
||||||
|
|||||||
+22
-22
@@ -112,7 +112,7 @@ static fileused_t transferFiles[UINT8_MAX + 1];
|
|||||||
INT32 fileneedednum = 0; // Number of files needed to join the server
|
INT32 fileneedednum = 0; // Number of files needed to join the server
|
||||||
fileneeded_t fileneeded[MAX_WADFILES] = {}; // List of needed files
|
fileneeded_t fileneeded[MAX_WADFILES] = {}; // List of needed files
|
||||||
#ifdef HAVE_THREADS
|
#ifdef HAVE_THREADS
|
||||||
static I_Mutex downloadmutex;
|
static I_mutex downloadmutex;
|
||||||
#endif
|
#endif
|
||||||
char downloaddir[512] = "DOWNLOAD";
|
char downloaddir[512] = "DOWNLOAD";
|
||||||
|
|
||||||
@@ -960,7 +960,7 @@ void Got_Filetxpak(void)
|
|||||||
|| fastcmp(filename, "music.kart")
|
|| fastcmp(filename, "music.kart")
|
||||||
|| fastcmp(filename, "patch.kart")
|
|| fastcmp(filename, "patch.kart")
|
||||||
))
|
))
|
||||||
I_Error("Tried to download \"%s\"", filename);
|
I_Error("Tried to download base-game file: \"%s\"", filename);
|
||||||
|
|
||||||
if (filenum >= fileneedednum)
|
if (filenum >= fileneedednum)
|
||||||
{
|
{
|
||||||
@@ -1019,21 +1019,21 @@ void Got_Filetxpak(void)
|
|||||||
|
|
||||||
switch(file->status)
|
switch(file->status)
|
||||||
{
|
{
|
||||||
case FS_NOTFOUND:
|
case FS_NOTFOUND:
|
||||||
s = "FS_NOTFOUND";
|
s = "FS_NOTFOUND";
|
||||||
break;
|
break;
|
||||||
case FS_FOUND:
|
case FS_FOUND:
|
||||||
s = "FS_FOUND";
|
s = "FS_FOUND";
|
||||||
break;
|
break;
|
||||||
case FS_OPEN:
|
case FS_OPEN:
|
||||||
s = "FS_OPEN";
|
s = "FS_OPEN";
|
||||||
break;
|
break;
|
||||||
case FS_MD5SUMBAD:
|
case FS_MD5SUMBAD:
|
||||||
s = "FS_MD5SUMBAD";
|
s = "FS_MD5SUMBAD";
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
s = "unknown";
|
s = "unknown";
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
I_Error("Received a file not requested (file id: %d, file status: %s)\n", filenum, s);
|
I_Error("Received a file not requested (file id: %d, file status: %s)\n", filenum, s);
|
||||||
@@ -1427,7 +1427,7 @@ void CURLPrepareFile(const char* url, int dfilenum)
|
|||||||
filedownload.http_running = true;
|
filedownload.http_running = true;
|
||||||
|
|
||||||
#ifdef HAVE_THREADS
|
#ifdef HAVE_THREADS
|
||||||
(void)!I_SpawnThread("http-download", (I_ThreadFn)CURLGetFile, NULL);
|
I_spawn_thread("http-download", (I_thread_fn)CURLGetFile, NULL);
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
@@ -1440,15 +1440,15 @@ void CURLAbortFile(void)
|
|||||||
|
|
||||||
#ifdef HAVE_THREADS
|
#ifdef HAVE_THREADS
|
||||||
// lock and unlock to wait for the download thread to exit
|
// lock and unlock to wait for the download thread to exit
|
||||||
I_LockMutex(&downloadmutex);
|
I_lock_mutex(&downloadmutex);
|
||||||
I_UnlockMutex(downloadmutex);
|
I_unlock_mutex(downloadmutex);
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
static void CURLGetFile(void)
|
static void CURLGetFile(void)
|
||||||
{
|
{
|
||||||
#ifdef HAVE_THREADS
|
#ifdef HAVE_THREADS
|
||||||
I_LockMutex(&downloadmutex);
|
I_lock_mutex(&downloadmutex);
|
||||||
#endif
|
#endif
|
||||||
CURLMcode mc; /* return code used by curl_multi_wait() */
|
CURLMcode mc; /* return code used by curl_multi_wait() */
|
||||||
CURLcode easyres; /* Return from easy interface */
|
CURLcode easyres; /* Return from easy interface */
|
||||||
@@ -1549,7 +1549,7 @@ static void CURLGetFile(void)
|
|||||||
|
|
||||||
filedownload.http_running = false;
|
filedownload.http_running = false;
|
||||||
#ifdef HAVE_THREADS
|
#ifdef HAVE_THREADS
|
||||||
I_UnlockMutex(downloadmutex);
|
I_unlock_mutex(downloadmutex);
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -2,5 +2,6 @@ i_system.c
|
|||||||
i_main.c
|
i_main.c
|
||||||
i_video.c
|
i_video.c
|
||||||
i_sound.c
|
i_sound.c
|
||||||
|
i_threads.c
|
||||||
dosstr.c
|
dosstr.c
|
||||||
endtxt.c
|
endtxt.c
|
||||||
@@ -984,7 +984,7 @@ void I_SleepDuration(precise_t duration)
|
|||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
boolean g_in_exiting_signal_handler = false;
|
static volatile sig_atomic_t g_in_exiting_signal_handler = false;
|
||||||
|
|
||||||
static void I_PrintSignal(INT32 signal_num, boolean core_dumped, char *signal_msg)
|
static void I_PrintSignal(INT32 signal_num, boolean core_dumped, char *signal_msg)
|
||||||
{
|
{
|
||||||
@@ -1048,6 +1048,11 @@ static void I_ReportSignal(int num, int coredumped)
|
|||||||
I_OutputMsg("\nProcess killed by signal: %s\n\n", sigmsg);
|
I_OutputMsg("\nProcess killed by signal: %s\n\n", sigmsg);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
boolean I_In_Exiting_Signal_Handler(void)
|
||||||
|
{
|
||||||
|
return g_in_exiting_signal_handler;
|
||||||
|
}
|
||||||
|
|
||||||
#ifndef NEWSIGNALHANDLER
|
#ifndef NEWSIGNALHANDLER
|
||||||
FUNCNORETURN static ATTRNORETURN void signal_handler(INT32 num)
|
FUNCNORETURN static ATTRNORETURN void signal_handler(INT32 num)
|
||||||
{
|
{
|
||||||
@@ -1067,11 +1072,17 @@ FUNCNORETURN static ATTRNORETURN void signal_handler(INT32 num)
|
|||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
FUNCNORETURN static ATTRNORETURN void quit_handler(int num)
|
static volatile sig_atomic_t interrupted = 0;
|
||||||
|
|
||||||
|
boolean I_Interrupted(void)
|
||||||
{
|
{
|
||||||
signal(num, SIG_DFL); //default signal action
|
return interrupted;
|
||||||
raise(num);
|
}
|
||||||
I_Quit();
|
|
||||||
|
static void quit_handler(int num)
|
||||||
|
{
|
||||||
|
(void)num;
|
||||||
|
interrupted = 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef HAVE_LIBBACKTRACE
|
#ifdef HAVE_LIBBACKTRACE
|
||||||
@@ -1381,8 +1392,8 @@ INT32 I_StartupSystem(void)
|
|||||||
I_Fork();
|
I_Fork();
|
||||||
#endif
|
#endif
|
||||||
#ifdef HAVE_THREADS
|
#ifdef HAVE_THREADS
|
||||||
I_StartThreads();
|
I_start_threads();
|
||||||
I_AddExitFunc(I_StopThreads);
|
I_AddExitFunc(I_stop_threads);
|
||||||
#endif
|
#endif
|
||||||
I_RegisterSignals();
|
I_RegisterSignals();
|
||||||
#ifndef NOMUMBLE
|
#ifndef NOMUMBLE
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
// SONIC ROBO BLAST 2 KART
|
// SONIC ROBO BLAST 2
|
||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
// Copyright (C) 2020-2023 by James R.
|
// Copyright (C) 2020-2023 by James R.
|
||||||
//
|
//
|
||||||
@@ -9,14 +9,12 @@
|
|||||||
/// \file i_threads.c
|
/// \file i_threads.c
|
||||||
/// \brief Multithreading abstraction
|
/// \brief Multithreading abstraction
|
||||||
|
|
||||||
#ifdef HAVE_THREADS
|
#if defined (__unix__) || (!defined(__APPLE__) && defined (UNIXCOMMON))
|
||||||
#if defined (__unix__) || defined(UNIXCOMMON)
|
|
||||||
|
|
||||||
#include <pthread.h>
|
#include <pthread.h>
|
||||||
|
|
||||||
#include "i_threads.h"
|
#include "../i_threads.h"
|
||||||
#include "doomdef.h"
|
#include "../doomdef.h"
|
||||||
#include "doomtype.h"
|
|
||||||
|
|
||||||
typedef struct thread_s thread_t;
|
typedef struct thread_s thread_t;
|
||||||
|
|
||||||
@@ -24,7 +22,7 @@ struct thread_s
|
|||||||
{
|
{
|
||||||
thread_t *next;
|
thread_t *next;
|
||||||
void *userdata;
|
void *userdata;
|
||||||
I_ThreadFn func;
|
I_thread_fn func;
|
||||||
pthread_t thread;
|
pthread_t thread;
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -43,8 +41,12 @@ static void *HandleThread(void *data)
|
|||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
FUNCWARNRV
|
void
|
||||||
int I_SpawnThread(const char *name, I_ThreadFn entry, void *userdata)
|
I_spawn_thread (
|
||||||
|
const char * name,
|
||||||
|
I_thread_fn entry,
|
||||||
|
void * userdata
|
||||||
|
)
|
||||||
{
|
{
|
||||||
thread_t *thread;
|
thread_t *thread;
|
||||||
(void)name;
|
(void)name;
|
||||||
@@ -64,20 +66,17 @@ int I_SpawnThread(const char *name, I_ThreadFn entry, void *userdata)
|
|||||||
if (thread == NULL)
|
if (thread == NULL)
|
||||||
{
|
{
|
||||||
thread = malloc(sizeof(thread_t));
|
thread = malloc(sizeof(thread_t));
|
||||||
if (thread == NULL)
|
|
||||||
return false;
|
|
||||||
thread->next = thread_list;
|
thread->next = thread_list;
|
||||||
thread_list = thread;
|
thread_list = thread;
|
||||||
}
|
}
|
||||||
|
|
||||||
thread->func = entry;
|
thread->func = entry;
|
||||||
thread->userdata = userdata;
|
thread->userdata = userdata;
|
||||||
int err = pthread_create(&thread->thread, NULL, HandleThread, thread);
|
pthread_create(&thread->thread, NULL, HandleThread, thread);
|
||||||
pthread_mutex_unlock(&thread_lock);
|
pthread_mutex_unlock(&thread_lock);
|
||||||
return err == 0;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
int I_ThreadIsStopped(void)
|
int I_thread_is_stopped(void)
|
||||||
{
|
{
|
||||||
thread_t *thread;
|
thread_t *thread;
|
||||||
pthread_mutex_lock(&thread_lock);
|
pthread_mutex_lock(&thread_lock);
|
||||||
@@ -95,11 +94,11 @@ int I_ThreadIsStopped(void)
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
void I_StartThreads(void)
|
void I_start_threads(void)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
void I_StopThreads(void)
|
void I_stop_threads(void)
|
||||||
{
|
{
|
||||||
thread_t *thread = thread_list;
|
thread_t *thread = thread_list;
|
||||||
while (thread != NULL)
|
while (thread != NULL)
|
||||||
@@ -110,7 +109,7 @@ void I_StopThreads(void)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void I_LockMutex(I_Mutex *anchor)
|
void I_lock_mutex(I_mutex *anchor)
|
||||||
{
|
{
|
||||||
pthread_mutex_lock(&thread_lock);
|
pthread_mutex_lock(&thread_lock);
|
||||||
if (*anchor == NULL)
|
if (*anchor == NULL)
|
||||||
@@ -128,25 +127,25 @@ void I_LockMutex(I_Mutex *anchor)
|
|||||||
pthread_mutex_lock(*anchor);
|
pthread_mutex_lock(*anchor);
|
||||||
}
|
}
|
||||||
|
|
||||||
void I_UnlockMutex(I_Mutex id)
|
void I_unlock_mutex(I_mutex id)
|
||||||
{
|
{
|
||||||
pthread_mutex_unlock(id);
|
pthread_mutex_unlock(id);
|
||||||
}
|
}
|
||||||
|
|
||||||
void I_HoldCond(I_Cond *condAnchor, I_Mutex mutexId)
|
void I_hold_cond(I_cond *cond_anchor, I_mutex mutex_id)
|
||||||
{
|
{
|
||||||
I_Assert(mutexId != NULL);
|
I_Assert(mutex_id != NULL);
|
||||||
pthread_mutex_lock(&thread_lock);
|
pthread_mutex_lock(&thread_lock);
|
||||||
if (*condAnchor == NULL)
|
if (*cond_anchor == NULL)
|
||||||
{
|
{
|
||||||
*condAnchor = malloc(sizeof(pthread_cond_t));
|
*cond_anchor = malloc(sizeof(pthread_cond_t));
|
||||||
pthread_cond_init(*condAnchor, NULL);
|
pthread_cond_init(*cond_anchor, NULL);
|
||||||
}
|
}
|
||||||
pthread_mutex_unlock(&thread_lock);
|
pthread_mutex_unlock(&thread_lock);
|
||||||
pthread_cond_wait(*condAnchor, mutexId);
|
pthread_cond_wait(*cond_anchor, mutex_id);
|
||||||
}
|
}
|
||||||
|
|
||||||
void I_WakeOneCond(I_Cond *anchor)
|
void I_wake_one_cond(I_cond *anchor)
|
||||||
{
|
{
|
||||||
pthread_mutex_lock(&thread_lock);
|
pthread_mutex_lock(&thread_lock);
|
||||||
if (*anchor == NULL)
|
if (*anchor == NULL)
|
||||||
@@ -158,7 +157,7 @@ void I_WakeOneCond(I_Cond *anchor)
|
|||||||
pthread_cond_signal(*anchor);
|
pthread_cond_signal(*anchor);
|
||||||
}
|
}
|
||||||
|
|
||||||
void I_WakeAllCond(I_Cond *anchor)
|
void I_wake_all_cond(I_cond *anchor)
|
||||||
{
|
{
|
||||||
pthread_mutex_lock(&thread_lock);
|
pthread_mutex_lock(&thread_lock);
|
||||||
if (*anchor == NULL)
|
if (*anchor == NULL)
|
||||||
@@ -169,17 +168,12 @@ void I_WakeAllCond(I_Cond *anchor)
|
|||||||
pthread_mutex_unlock(&thread_lock);
|
pthread_mutex_unlock(&thread_lock);
|
||||||
pthread_cond_broadcast(*anchor);
|
pthread_cond_broadcast(*anchor);
|
||||||
}
|
}
|
||||||
|
|
||||||
thread_handle_t I_GetCurrentThread(void)
|
|
||||||
{
|
|
||||||
return pthread_self();
|
|
||||||
}
|
|
||||||
#elif defined (_WIN32)
|
#elif defined (_WIN32)
|
||||||
#include <windows.h>
|
#include <windows.h>
|
||||||
|
|
||||||
#include "i_threads.h"
|
#include "../i_threads.h"
|
||||||
#include "doomdef.h"
|
#include "../doomdef.h"
|
||||||
#include "doomtype.h"
|
#include "../doomtype.h"
|
||||||
|
|
||||||
typedef struct thread_s thread_t;
|
typedef struct thread_s thread_t;
|
||||||
|
|
||||||
@@ -187,9 +181,9 @@ struct thread_s
|
|||||||
{
|
{
|
||||||
thread_t *next;
|
thread_t *next;
|
||||||
void *userdata;
|
void *userdata;
|
||||||
I_ThreadFn func;
|
I_thread_fn func;
|
||||||
HANDLE thread;
|
HANDLE thread;
|
||||||
DWORD threadId;
|
DWORD thread_id;
|
||||||
};
|
};
|
||||||
|
|
||||||
// we use a linked list to avoid moving memory blocks when allocating new threads.
|
// we use a linked list to avoid moving memory blocks when allocating new threads.
|
||||||
@@ -207,8 +201,7 @@ static DWORD __stdcall HandleThread(void *data)
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
FUNCWARNRV
|
void I_spawn_thread(const char *name, I_thread_fn entry, void *userdata)
|
||||||
int I_SpawnThread(const char *name, I_ThreadFn entry, void *userdata)
|
|
||||||
{
|
{
|
||||||
thread_t *thread;
|
thread_t *thread;
|
||||||
(void)name;
|
(void)name;
|
||||||
@@ -226,20 +219,17 @@ int I_SpawnThread(const char *name, I_ThreadFn entry, void *userdata)
|
|||||||
if (thread == NULL)
|
if (thread == NULL)
|
||||||
{
|
{
|
||||||
thread = malloc(sizeof(thread_t));
|
thread = malloc(sizeof(thread_t));
|
||||||
if (thread == NULL)
|
|
||||||
return false;
|
|
||||||
thread->next = thread_list;
|
thread->next = thread_list;
|
||||||
thread_list = thread;
|
thread_list = thread;
|
||||||
}
|
}
|
||||||
|
|
||||||
thread->func = entry;
|
thread->func = entry;
|
||||||
thread->userdata = userdata;
|
thread->userdata = userdata;
|
||||||
thread->thread = CreateThread(NULL, 0, HandleThread, thread, 0, &thread->threadId);
|
thread->thread = CreateThread(NULL, 0, HandleThread, thread, 0, &thread->thread_id);
|
||||||
LeaveCriticalSection(&thread_lock);
|
LeaveCriticalSection(&thread_lock);
|
||||||
return thread->thread != NULL;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
int I_ThreadIsStopped(void)
|
int I_thread_is_stopped(void)
|
||||||
{
|
{
|
||||||
thread_t *thread;
|
thread_t *thread;
|
||||||
EnterCriticalSection(&thread_lock);
|
EnterCriticalSection(&thread_lock);
|
||||||
@@ -257,12 +247,12 @@ int I_ThreadIsStopped(void)
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
void I_StartThreads(void)
|
void I_start_threads(void)
|
||||||
{
|
{
|
||||||
InitializeCriticalSection(&thread_lock);
|
InitializeCriticalSection(&thread_lock);
|
||||||
}
|
}
|
||||||
|
|
||||||
void I_StopThreads(void)
|
void I_stop_threads(void)
|
||||||
{
|
{
|
||||||
thread_t *thread = thread_list;
|
thread_t *thread = thread_list;
|
||||||
while (thread != NULL)
|
while (thread != NULL)
|
||||||
@@ -274,7 +264,7 @@ void I_StopThreads(void)
|
|||||||
DeleteCriticalSection(&thread_lock);
|
DeleteCriticalSection(&thread_lock);
|
||||||
}
|
}
|
||||||
|
|
||||||
void I_LockMutex(I_Mutex *anchor)
|
void I_lock_mutex(I_mutex *anchor)
|
||||||
{
|
{
|
||||||
EnterCriticalSection(&thread_lock);
|
EnterCriticalSection(&thread_lock);
|
||||||
if (*anchor == NULL)
|
if (*anchor == NULL)
|
||||||
@@ -286,25 +276,25 @@ void I_LockMutex(I_Mutex *anchor)
|
|||||||
EnterCriticalSection(*anchor);
|
EnterCriticalSection(*anchor);
|
||||||
}
|
}
|
||||||
|
|
||||||
void I_UnlockMutex(I_Mutex id)
|
void I_unlock_mutex(I_mutex id)
|
||||||
{
|
{
|
||||||
LeaveCriticalSection(id);
|
LeaveCriticalSection(id);
|
||||||
}
|
}
|
||||||
|
|
||||||
void I_HoldCond(I_Cond *condAnchor, I_Mutex mutexId)
|
void I_hold_cond(I_cond *cond_anchor, I_mutex mutex_id)
|
||||||
{
|
{
|
||||||
I_Assert(mutexId != NULL);
|
I_Assert(mutex_id != NULL);
|
||||||
EnterCriticalSection(&thread_lock);
|
EnterCriticalSection(&thread_lock);
|
||||||
if (*condAnchor == NULL)
|
if (*cond_anchor == NULL)
|
||||||
{
|
{
|
||||||
*condAnchor = malloc(sizeof(CONDITION_VARIABLE));
|
*cond_anchor = malloc(sizeof(CONDITION_VARIABLE));
|
||||||
InitializeConditionVariable(*condAnchor);
|
InitializeConditionVariable(*cond_anchor);
|
||||||
}
|
}
|
||||||
LeaveCriticalSection(&thread_lock);
|
LeaveCriticalSection(&thread_lock);
|
||||||
SleepConditionVariableCS(*condAnchor, mutexId, INFINITE);
|
SleepConditionVariableCS(*cond_anchor, mutex_id, INFINITE);
|
||||||
}
|
}
|
||||||
|
|
||||||
void I_WakeOneCond(I_Cond *anchor)
|
void I_wake_one_cond(I_cond *anchor)
|
||||||
{
|
{
|
||||||
EnterCriticalSection(&thread_lock);
|
EnterCriticalSection(&thread_lock);
|
||||||
if (*anchor == NULL)
|
if (*anchor == NULL)
|
||||||
@@ -316,7 +306,7 @@ void I_WakeOneCond(I_Cond *anchor)
|
|||||||
WakeConditionVariable(*anchor);
|
WakeConditionVariable(*anchor);
|
||||||
}
|
}
|
||||||
|
|
||||||
void I_WakeAllCond(I_Cond *anchor)
|
void I_wake_all_cond(I_cond *anchor)
|
||||||
{
|
{
|
||||||
EnterCriticalSection(&thread_lock);
|
EnterCriticalSection(&thread_lock);
|
||||||
if (*anchor == NULL)
|
if (*anchor == NULL)
|
||||||
@@ -327,66 +317,48 @@ void I_WakeAllCond(I_Cond *anchor)
|
|||||||
LeaveCriticalSection(&thread_lock);
|
LeaveCriticalSection(&thread_lock);
|
||||||
WakeAllConditionVariable(*anchor);
|
WakeAllConditionVariable(*anchor);
|
||||||
}
|
}
|
||||||
|
|
||||||
void *I_GetCurrentThread(void)
|
|
||||||
{
|
|
||||||
return GetCurrentThread();
|
|
||||||
}
|
|
||||||
#else
|
#else
|
||||||
#include "i_threads.h"
|
void I_spawn_thread(const char *name, I_thread_fn entry, void *userdata)
|
||||||
|
|
||||||
FUNCWARNRV
|
|
||||||
int I_SpawnThread(const char *name, I_ThreadFn entry, void *userdata)
|
|
||||||
{
|
{
|
||||||
(void)name;
|
(void)name;
|
||||||
entry(userdata);
|
entry(userdata);
|
||||||
return true;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
int I_ThreadIsStopped(void)
|
int I_thread_is_stopped(void)
|
||||||
{
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
void I_StartThreads(void)
|
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
void I_StopThreads(void)
|
void I_start_threads(void)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
void I_LockMutex(I_Mutex *anchor)
|
void I_stop_threads(void)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
void I_lock_mutex(I_mutex *anchor)
|
||||||
{
|
{
|
||||||
(void)anchor;
|
(void)anchor;
|
||||||
}
|
}
|
||||||
|
|
||||||
void I_UnlockMutex(I_Mutex id)
|
void I_unlock_mutex(I_mutex id)
|
||||||
{
|
{
|
||||||
(void)id;
|
(void)id;
|
||||||
}
|
}
|
||||||
|
|
||||||
void I_HoldCond(I_Cond *condAnchor, I_Mutex mutexId)
|
void I_hold_cond(I_cond *cond_anchor, I_mutex mutex_id)
|
||||||
{
|
{
|
||||||
(void)condAnchor;
|
(void)cond_anchor;
|
||||||
(void)mutexId;
|
(void)mutex_id;
|
||||||
}
|
}
|
||||||
|
|
||||||
void I_WakeOneCond(I_Cond *anchor)
|
void I_wake_one_cond(I_cond *anchor)
|
||||||
{
|
{
|
||||||
(void)anchor;
|
(void)anchor;
|
||||||
}
|
}
|
||||||
|
|
||||||
void I_WakeAllCond(I_Cond *anchor)
|
void I_wake_all_cond(I_cond *anchor)
|
||||||
{
|
{
|
||||||
(void)anchor;
|
(void)anchor;
|
||||||
}
|
}
|
||||||
|
|
||||||
void *I_GetCurrentThread(void)
|
|
||||||
{
|
|
||||||
return NULL;
|
|
||||||
}
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
||||||
#endif // HAVE_THREADS
|
|
||||||
+2
-2
@@ -173,7 +173,7 @@ FUNCPRINTF static void deh_warning(const char *first, ...)
|
|||||||
vsnprintf(buf, 1000, first, argptr); // sizeof only returned 4 here. it didn't like that pointer.
|
vsnprintf(buf, 1000, first, argptr); // sizeof only returned 4 here. it didn't like that pointer.
|
||||||
va_end(argptr);
|
va_end(argptr);
|
||||||
|
|
||||||
if(dbg_line == -1) // Not in a SOC, line number unknown.
|
if (dbg_line == -1) // Not in a SOC, line number unknown.
|
||||||
CONS_Alert(CONS_WARNING, "%s\n", buf);
|
CONS_Alert(CONS_WARNING, "%s\n", buf);
|
||||||
else
|
else
|
||||||
CONS_Alert(CONS_WARNING, "Line %u: %s\n", dbg_line, buf);
|
CONS_Alert(CONS_WARNING, "Line %u: %s\n", dbg_line, buf);
|
||||||
@@ -8545,7 +8545,7 @@ static inline int lib_action(lua_State *L)
|
|||||||
|
|
||||||
// Hardcoded A_Action name to call for super() or NULL if super() would be invalid.
|
// Hardcoded A_Action name to call for super() or NULL if super() would be invalid.
|
||||||
// Set in lua_infolib.
|
// Set in lua_infolib.
|
||||||
const char *superactions[MAXRECURSION];
|
const char *superactions[MAXRECURSION] = {};
|
||||||
UINT8 superstack = 0;
|
UINT8 superstack = 0;
|
||||||
|
|
||||||
static int lib_dummysuper(lua_State *L)
|
static int lib_dummysuper(lua_State *L)
|
||||||
|
|||||||
@@ -223,8 +223,6 @@ typedef int32_t boolean;
|
|||||||
|
|
||||||
#define FUNCNOINLINE __attribute__((noinline))
|
#define FUNCNOINLINE __attribute__((noinline))
|
||||||
|
|
||||||
#define FUNCWARNRV __attribute__((warn_unused_result))
|
|
||||||
|
|
||||||
#if (__GNUC__ > 4) || (__GNUC__ == 4 && __GNUC_MINOR__ >= 4) // >= GCC 4.4
|
#if (__GNUC__ > 4) || (__GNUC__ == 4 && __GNUC_MINOR__ >= 4) // >= GCC 4.4
|
||||||
#ifdef __i386__ // i386 only
|
#ifdef __i386__ // i386 only
|
||||||
#define FUNCTARGET(X) __attribute__ ((__target__ (X)))
|
#define FUNCTARGET(X) __attribute__ ((__target__ (X)))
|
||||||
@@ -270,9 +268,6 @@ typedef int32_t boolean;
|
|||||||
#ifndef FUNCTARGET
|
#ifndef FUNCTARGET
|
||||||
#define FUNCTARGET(x)
|
#define FUNCTARGET(x)
|
||||||
#endif
|
#endif
|
||||||
#ifndef FUNCWARNRV
|
|
||||||
#define FUNCWARNRV
|
|
||||||
#endif
|
|
||||||
#ifndef ATTRPACK
|
#ifndef ATTRPACK
|
||||||
#define ATTRPACK
|
#define ATTRPACK
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
+2
-2
@@ -388,11 +388,11 @@ void F_RunWipe(UINT8 wipetype, boolean drawMenu)
|
|||||||
if (rendermode != render_none && drawMenu)
|
if (rendermode != render_none && drawMenu)
|
||||||
{
|
{
|
||||||
#ifdef HAVE_THREADS
|
#ifdef HAVE_THREADS
|
||||||
I_LockMutex(&m_menu_mutex);
|
I_lock_mutex(&m_menu_mutex);
|
||||||
#endif
|
#endif
|
||||||
M_Drawer(); // menu is drawn even on top of wipes
|
M_Drawer(); // menu is drawn even on top of wipes
|
||||||
#ifdef HAVE_THREADS
|
#ifdef HAVE_THREADS
|
||||||
I_UnlockMutex(m_menu_mutex);
|
I_unlock_mutex(m_menu_mutex);
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
+1
-1
@@ -2605,7 +2605,7 @@ void G_DoPlayDemo(char *defdemoname)
|
|||||||
boolean skiperrors = false;
|
boolean skiperrors = false;
|
||||||
#endif
|
#endif
|
||||||
boolean spectator;
|
boolean spectator;
|
||||||
UINT8 slots[MAXPLAYERS], kartspeed[MAXPLAYERS], kartweight[MAXPLAYERS], numslots = 0;
|
UINT8 slots[MAXPLAYERS] = {}, kartspeed[MAXPLAYERS] = {}, kartweight[MAXPLAYERS] = {}, numslots = 0;
|
||||||
|
|
||||||
G_InitDemoRewind();
|
G_InitDemoRewind();
|
||||||
|
|
||||||
|
|||||||
+1
-4
@@ -69,9 +69,6 @@ UINT8 botcolor = 0;
|
|||||||
|
|
||||||
JoyType_t Joystick[MAXSPLITSCREENPLAYERS] = {};
|
JoyType_t Joystick[MAXSPLITSCREENPLAYERS] = {};
|
||||||
|
|
||||||
// 1024 bytes is plenty for a savegame
|
|
||||||
#define SAVEGAMESIZE (1024)
|
|
||||||
|
|
||||||
// SRB2kart
|
// SRB2kart
|
||||||
char gamedatafilename[64] = "kartdata.dat";
|
char gamedatafilename[64] = "kartdata.dat";
|
||||||
char timeattackfolder[64] = "kart";
|
char timeattackfolder[64] = "kart";
|
||||||
@@ -3902,7 +3899,7 @@ void G_SaveGame(UINT32 savegameslot)
|
|||||||
char name[VERSIONSIZE];
|
char name[VERSIONSIZE];
|
||||||
size_t length;
|
size_t length;
|
||||||
|
|
||||||
save.p = save.buffer = (UINT8 *)Z_Malloc(SAVEGAMESIZE, PU_STATIC, NULL);
|
save.p = save.buffer = (UINT8 *)Z_Malloc(1024, PU_STATIC, NULL); // 1024 bytes is plenty for a savegame
|
||||||
if (!save.p)
|
if (!save.p)
|
||||||
{
|
{
|
||||||
CONS_Alert(CONS_ERROR, M_GetText("No more free memory for saving game data\n"));
|
CONS_Alert(CONS_ERROR, M_GetText("No more free memory for saving game data\n"));
|
||||||
|
|||||||
@@ -1378,8 +1378,7 @@ void HWR_ProcessSeg(void) // Sort of like GLWall::Process in GZDoom
|
|||||||
|
|
||||||
FSurfaceInfo Surf;
|
FSurfaceInfo Surf;
|
||||||
|
|
||||||
if (gl_frontsector)
|
Surf.PolyColor.s.alpha = 255;
|
||||||
Surf.PolyColor.s.alpha = 255;
|
|
||||||
|
|
||||||
const INT32 gl_midtexture = R_GetTextureNum(gl_sidedef->midtexture);
|
const INT32 gl_midtexture = R_GetTextureNum(gl_sidedef->midtexture);
|
||||||
GLMapTexture_t *glTex = NULL;
|
GLMapTexture_t *glTex = NULL;
|
||||||
|
|||||||
+9
-16
@@ -693,17 +693,15 @@ static void HWR_CreateBlendedTexture(patch_t *gpatch, patch_t *blendgpatch, GLMi
|
|||||||
GLPatch_t *hwrBlendPatch = blendgpatch->hardware;
|
GLPatch_t *hwrBlendPatch = blendgpatch->hardware;
|
||||||
UINT16 w = gpatch->width, h = gpatch->height;
|
UINT16 w = gpatch->width, h = gpatch->height;
|
||||||
UINT32 size = w*h;
|
UINT32 size = w*h;
|
||||||
RGBA_t *image, *blendimage, *cur, blendcolor;
|
RGBA_t *image, *blendimage, *cur;
|
||||||
|
RGBA_t blendcolor = {};
|
||||||
RGBA_t *palette = HWR_GetTexturePalette();
|
RGBA_t *palette = HWR_GetTexturePalette();
|
||||||
UINT8 translation[17]; // First the color index
|
UINT8 translation[17] = {}; // First the color index
|
||||||
UINT8 cutoff[17]; // Brightness cutoff before using the next color
|
UINT8 cutoff[17] = {}; // Brightness cutoff before using the next color
|
||||||
UINT8 translen = 0;
|
UINT8 translen = 0;
|
||||||
UINT8 i;
|
UINT8 i;
|
||||||
UINT8 colorbrightnesses[17];
|
UINT8 colorbrightnesses[17] = {};
|
||||||
UINT8 color_match_lookup[256]; // optimization attempt
|
UINT8 color_match_lookup[256] = {}; // optimization attempt
|
||||||
|
|
||||||
memset(translation, 0, sizeof(translation));
|
|
||||||
memset(cutoff, 0, sizeof(cutoff));
|
|
||||||
|
|
||||||
if (glMipmap->width == 0)
|
if (glMipmap->width == 0)
|
||||||
{
|
{
|
||||||
@@ -716,14 +714,10 @@ static void HWR_CreateBlendedTexture(patch_t *gpatch, patch_t *blendgpatch, GLMi
|
|||||||
glMipmap->format = GL_TEXFMT_RGBA;
|
glMipmap->format = GL_TEXFMT_RGBA;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (glMipmap->data)
|
Z_Free(glMipmap->data);
|
||||||
{
|
glMipmap->data = NULL;
|
||||||
Z_Free(glMipmap->data);
|
|
||||||
glMipmap->data = NULL;
|
|
||||||
}
|
|
||||||
|
|
||||||
cur = Z_Malloc(size*4, PU_HWRMODELTEXTURE, &glMipmap->data);
|
cur = Z_Calloc(size*4, PU_HWRMODELTEXTURE, &glMipmap->data);
|
||||||
memset(cur, 0x00, size*4);
|
|
||||||
|
|
||||||
image = hwrPatch->mipmap->data;
|
image = hwrPatch->mipmap->data;
|
||||||
blendimage = hwrBlendPatch->mipmap->data;
|
blendimage = hwrBlendPatch->mipmap->data;
|
||||||
@@ -1037,7 +1031,6 @@ static void HWR_GetBlendedTexture(patch_t *patch, patch_t *blendgpatch, INT32 sk
|
|||||||
GLPatch_t *glPatch = patch->hardware;
|
GLPatch_t *glPatch = patch->hardware;
|
||||||
GLMipmap_t *glMipmap, *newMipmap;
|
GLMipmap_t *glMipmap, *newMipmap;
|
||||||
|
|
||||||
|
|
||||||
if (blendgpatch == NULL || colormap == colormaps || colormap == NULL)
|
if (blendgpatch == NULL || colormap == colormaps || colormap == NULL)
|
||||||
{
|
{
|
||||||
// Don't do any blending
|
// Don't do any blending
|
||||||
|
|||||||
+12
-10
@@ -62,7 +62,7 @@ static int hms_started;
|
|||||||
|
|
||||||
static char *hms_api;
|
static char *hms_api;
|
||||||
#ifdef HAVE_THREADS
|
#ifdef HAVE_THREADS
|
||||||
static I_Mutex hms_api_mutex;
|
static I_mutex hms_api_mutex;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
static char *hms_server_token;
|
static char *hms_server_token;
|
||||||
@@ -90,9 +90,9 @@ Printf_url (const char *url)
|
|||||||
boolean startup;
|
boolean startup;
|
||||||
|
|
||||||
#ifdef HAVE_THREADS
|
#ifdef HAVE_THREADS
|
||||||
I_LockMutex(&con_mutex);
|
I_lock_mutex(&con_mutex);
|
||||||
startup = con_startup;
|
startup = con_startup;
|
||||||
I_UnlockMutex(con_mutex);
|
I_unlock_mutex(con_mutex);
|
||||||
#else
|
#else
|
||||||
startup = con_startup;
|
startup = con_startup;
|
||||||
#endif
|
#endif
|
||||||
@@ -183,7 +183,7 @@ HMS_connect (const char *format, ...)
|
|||||||
}
|
}
|
||||||
|
|
||||||
#ifdef HAVE_THREADS
|
#ifdef HAVE_THREADS
|
||||||
I_LockMutex(&hms_api_mutex);
|
I_lock_mutex(&hms_api_mutex);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
seek = strlen(hms_api) + 1;/* + '/' */
|
seek = strlen(hms_api) + 1;/* + '/' */
|
||||||
@@ -195,7 +195,7 @@ HMS_connect (const char *format, ...)
|
|||||||
sprintf(url, "%s/", hms_api);
|
sprintf(url, "%s/", hms_api);
|
||||||
|
|
||||||
#ifdef HAVE_THREADS
|
#ifdef HAVE_THREADS
|
||||||
I_UnlockMutex(hms_api_mutex);
|
I_unlock_mutex(hms_api_mutex);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
va_start (ap, format);
|
va_start (ap, format);
|
||||||
@@ -225,9 +225,10 @@ HMS_connect (const char *format, ...)
|
|||||||
{
|
{
|
||||||
cc = curl_easy_setopt(curl, CURLOPT_VERBOSE, 1L);
|
cc = curl_easy_setopt(curl, CURLOPT_VERBOSE, 1L);
|
||||||
if (cc != CURLE_OK) I_OutputMsg("libcurl: %s\n", buffer->errbuf);
|
if (cc != CURLE_OK) I_OutputMsg("libcurl: %s\n", buffer->errbuf);
|
||||||
|
#ifdef LOGMESSAGES
|
||||||
cc = curl_easy_setopt(curl, CURLOPT_STDERR, logstream);
|
cc = curl_easy_setopt(curl, CURLOPT_STDERR, logstream);
|
||||||
if (cc != CURLE_OK) I_OutputMsg("libcurl: %s\n", buffer->errbuf);
|
if (cc != CURLE_OK) I_OutputMsg("libcurl: %s\n", buffer->errbuf);
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
if (M_CheckParm("-bindaddr") && M_IsNextParm())
|
if (M_CheckParm("-bindaddr") && M_IsNextParm())
|
||||||
@@ -317,6 +318,7 @@ static void
|
|||||||
HMS_end (struct HMS_buffer *buffer)
|
HMS_end (struct HMS_buffer *buffer)
|
||||||
{
|
{
|
||||||
curl_easy_cleanup(buffer->curl);
|
curl_easy_cleanup(buffer->curl);
|
||||||
|
free(buffer->errbuf);
|
||||||
free(buffer->buffer);
|
free(buffer->buffer);
|
||||||
free(buffer);
|
free(buffer);
|
||||||
}
|
}
|
||||||
@@ -477,12 +479,12 @@ HMS_fetch_servers (msg_server_t *list, int query_id)
|
|||||||
if (address && port)
|
if (address && port)
|
||||||
{
|
{
|
||||||
#ifdef HAVE_THREADS
|
#ifdef HAVE_THREADS
|
||||||
I_LockMutex(&ms_QueryId_mutex);
|
I_lock_mutex(&ms_QueryId_mutex);
|
||||||
{
|
{
|
||||||
if (query_id != ms_QueryId)
|
if (query_id != ms_QueryId)
|
||||||
doing_shit = 0;
|
doing_shit = 0;
|
||||||
}
|
}
|
||||||
I_UnlockMutex(ms_QueryId_mutex);
|
I_unlock_mutex(ms_QueryId_mutex);
|
||||||
|
|
||||||
if (! doing_shit)
|
if (! doing_shit)
|
||||||
break;
|
break;
|
||||||
@@ -611,14 +613,14 @@ void
|
|||||||
HMS_set_api (char *api)
|
HMS_set_api (char *api)
|
||||||
{
|
{
|
||||||
#ifdef HAVE_THREADS
|
#ifdef HAVE_THREADS
|
||||||
I_LockMutex(&hms_api_mutex);
|
I_lock_mutex(&hms_api_mutex);
|
||||||
#endif
|
#endif
|
||||||
{
|
{
|
||||||
free(hms_api);
|
free(hms_api);
|
||||||
hms_api = Strip_trailing_slashes(api);
|
hms_api = Strip_trailing_slashes(api);
|
||||||
}
|
}
|
||||||
#ifdef HAVE_THREADS
|
#ifdef HAVE_THREADS
|
||||||
I_UnlockMutex(hms_api_mutex);
|
I_unlock_mutex(hms_api_mutex);
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -497,7 +497,9 @@ static void HU_removeChatText_Log(void)
|
|||||||
{
|
{
|
||||||
chat_log[i] = chat_log[i+1];
|
chat_log[i] = chat_log[i+1];
|
||||||
}
|
}
|
||||||
|
|
||||||
chat_nummsg_log--; // lost 1 msg.
|
chat_nummsg_log--; // lost 1 msg.
|
||||||
|
chat_log[chat_nummsg_log] = NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void Chatlogsize_OnChange(void)
|
static void Chatlogsize_OnChange(void)
|
||||||
@@ -516,6 +518,7 @@ static void Chatlogsize_OnChange(void)
|
|||||||
if (new_chat_log == NULL)
|
if (new_chat_log == NULL)
|
||||||
{
|
{
|
||||||
free(chat_log);
|
free(chat_log);
|
||||||
|
chat_log = NULL;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
chat_log = new_chat_log;
|
chat_log = new_chat_log;
|
||||||
|
|||||||
+5
-1
@@ -43,7 +43,7 @@ extern UINT8 graphics_started;
|
|||||||
extern UINT8 keyboard_started;
|
extern UINT8 keyboard_started;
|
||||||
|
|
||||||
/** \brief Set to true when inside a signal handler that will exit the program. */
|
/** \brief Set to true when inside a signal handler that will exit the program. */
|
||||||
extern boolean g_in_exiting_signal_handler;
|
boolean I_In_Exiting_Signal_Handler(void);
|
||||||
|
|
||||||
/** \brief The I_GetFreeMem function
|
/** \brief The I_GetFreeMem function
|
||||||
|
|
||||||
@@ -195,6 +195,10 @@ INT32 I_StartupSystem(void);
|
|||||||
*/
|
*/
|
||||||
void I_ShutdownSystem(void);
|
void I_ShutdownSystem(void);
|
||||||
|
|
||||||
|
/** \brief To check if a Interrupt or Terminate Signal was fired
|
||||||
|
*/
|
||||||
|
boolean I_Interrupted(void);
|
||||||
|
|
||||||
/** \brief The I_GetDiskFreeSpace function
|
/** \brief The I_GetDiskFreeSpace function
|
||||||
|
|
||||||
\param freespace a INT64 pointer to hold the free space amount
|
\param freespace a INT64 pointer to hold the free space amount
|
||||||
|
|||||||
+9
-7
@@ -496,8 +496,10 @@ static void cleanupnodes(void)
|
|||||||
|
|
||||||
// Why can't I start at zero?
|
// Why can't I start at zero?
|
||||||
for (j = 1; j < MAXNETNODES; j++)
|
for (j = 1; j < MAXNETNODES; j++)
|
||||||
|
{
|
||||||
if (!(nodeingame[j] || SV_SendingFile(j)))
|
if (!(nodeingame[j] || SV_SendingFile(j)))
|
||||||
nodeconnected[j] = false;
|
nodeconnected[j] = false;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static SINT8 getfreenode(void)
|
static SINT8 getfreenode(void)
|
||||||
@@ -507,11 +509,13 @@ static SINT8 getfreenode(void)
|
|||||||
cleanupnodes();
|
cleanupnodes();
|
||||||
|
|
||||||
for (j = 0; j < MAXNETNODES; j++)
|
for (j = 0; j < MAXNETNODES; j++)
|
||||||
|
{
|
||||||
if (!nodeconnected[j])
|
if (!nodeconnected[j])
|
||||||
{
|
{
|
||||||
nodeconnected[j] = true;
|
nodeconnected[j] = true;
|
||||||
return j;
|
return j;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/** \warning No free node? Just in case a node might not have been freed properly,
|
/** \warning No free node? Just in case a node might not have been freed properly,
|
||||||
* look if there are connected nodes that aren't in game, and forget them.
|
* look if there are connected nodes that aren't in game, and forget them.
|
||||||
@@ -812,7 +816,7 @@ static void SOCK_Send(void)
|
|||||||
static void SOCK_FreeNodenum(INT32 numnode)
|
static void SOCK_FreeNodenum(INT32 numnode)
|
||||||
{
|
{
|
||||||
// can't disconnect from self :)
|
// can't disconnect from self :)
|
||||||
if (!numnode || numnode > MAXNETNODES)
|
if (numnode <= 0 || numnode > MAXNETNODES)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
DEBFILE(va("Free node %d (%s)\n", numnode, SOCK_GetNodeAddress(numnode)));
|
DEBFILE(va("Free node %d (%s)\n", numnode, SOCK_GetNodeAddress(numnode)));
|
||||||
@@ -1432,14 +1436,12 @@ static void SOCK_RegisterHolePunch(void)
|
|||||||
|
|
||||||
static boolean SOCK_OpenSocket(void)
|
static boolean SOCK_OpenSocket(void)
|
||||||
{
|
{
|
||||||
size_t i;
|
memset(clientaddress, 0, sizeof(clientaddress));
|
||||||
|
|
||||||
memset(clientaddress, 0, sizeof (clientaddress));
|
|
||||||
|
|
||||||
|
memset(nodeconnected, false, sizeof(nodeconnected));
|
||||||
nodeconnected[0] = true; // always connected to self
|
nodeconnected[0] = true; // always connected to self
|
||||||
for (i = 1; i < MAXNETNODES; i++)
|
|
||||||
nodeconnected[i] = false;
|
|
||||||
nodeconnected[BROADCASTADDR] = true;
|
nodeconnected[BROADCASTADDR] = true;
|
||||||
|
|
||||||
I_NetSend = SOCK_Send;
|
I_NetSend = SOCK_Send;
|
||||||
I_NetGet = SOCK_Get;
|
I_NetGet = SOCK_Get;
|
||||||
I_NetCloseSocket = SOCK_CloseSocket;
|
I_NetCloseSocket = SOCK_CloseSocket;
|
||||||
@@ -1479,7 +1481,7 @@ static boolean SOCK_Ban(INT32 node)
|
|||||||
{
|
{
|
||||||
INT32 ban;
|
INT32 ban;
|
||||||
|
|
||||||
if (node > MAXNETNODES)
|
if (node < 0 || node > MAXNETNODES)
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
ban = numbans;
|
ban = numbans;
|
||||||
|
|||||||
+13
-25
@@ -1,6 +1,6 @@
|
|||||||
// SONIC ROBO BLAST 2 KART
|
// SONIC ROBO BLAST 2 KART
|
||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
// Copyright (C) 2020-2023 by James R.
|
// Copyright (C) 2020 by James R.
|
||||||
//
|
//
|
||||||
// This program is free software distributed under the
|
// This program is free software distributed under the
|
||||||
// terms of the GNU General Public License, version 2.
|
// terms of the GNU General Public License, version 2.
|
||||||
@@ -14,46 +14,34 @@
|
|||||||
#ifndef I_THREADS_H
|
#ifndef I_THREADS_H
|
||||||
#define I_THREADS_H
|
#define I_THREADS_H
|
||||||
|
|
||||||
#include "doomtype.h"
|
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
extern "C" {
|
extern "C" {
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
typedef void (*I_ThreadFn)(void *userdata);
|
typedef void (*I_thread_fn)(void *userdata);
|
||||||
|
|
||||||
typedef void * I_Mutex;
|
typedef void * I_mutex;
|
||||||
typedef void * I_Cond;
|
typedef void * I_cond;
|
||||||
|
|
||||||
#ifdef __linux__
|
void I_start_threads (void);
|
||||||
typedef long unsigned int thread_handle_t;
|
void I_stop_threads (void);
|
||||||
#else
|
|
||||||
typedef void *thread_handle_t;
|
|
||||||
#endif
|
|
||||||
|
|
||||||
void I_StartThreads (void);
|
void I_spawn_thread (const char *name, I_thread_fn, void *userdata);
|
||||||
void I_StopThreads (void);
|
|
||||||
|
|
||||||
FUNCWARNRV
|
|
||||||
int I_SpawnThread (const char *name, I_ThreadFn, void *userdata);
|
|
||||||
|
|
||||||
/* check in your thread whether to return early */
|
/* check in your thread whether to return early */
|
||||||
int I_ThreadIsStopped (void);
|
int I_thread_is_stopped (void);
|
||||||
|
|
||||||
void I_LockMutex (I_Mutex *);
|
void I_lock_mutex (I_mutex *);
|
||||||
void I_UnlockMutex (I_Mutex);
|
void I_unlock_mutex (I_mutex);
|
||||||
|
|
||||||
void I_HoldCond (I_Cond *, I_Mutex);
|
void I_hold_cond (I_cond *, I_mutex);
|
||||||
|
|
||||||
void I_WakeOneCond (I_Cond *);
|
void I_wake_one_cond (I_cond *);
|
||||||
void I_WakeAllCond (I_Cond *);
|
void I_wake_all_cond (I_cond *);
|
||||||
|
|
||||||
thread_handle_t I_GetCurrentThread(void);
|
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
} // extern "C"
|
} // extern "C"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#endif/*I_THREADS_H*/
|
#endif/*I_THREADS_H*/
|
||||||
|
|
||||||
#endif/*HAVE_THREADS*/
|
#endif/*HAVE_THREADS*/
|
||||||
+35
-20
@@ -931,21 +931,21 @@ const char *K_GetItemPatch(UINT8 item, boolean tiny)
|
|||||||
|
|
||||||
//}
|
//}
|
||||||
|
|
||||||
INT32 ITEM_X, ITEM_Y; // Item Window
|
static INT32 ITEM_X, ITEM_Y; // Item Window
|
||||||
INT32 TIME_X, TIME_Y; // Time Sticker
|
static INT32 TIME_X, TIME_Y; // Time Sticker
|
||||||
INT32 LAPS_X, LAPS_Y; // Lap Sticker
|
static INT32 LAPS_X, LAPS_Y; // Lap Sticker
|
||||||
INT32 SPDM_X, SPDM_Y; // Speedometer
|
static INT32 SPDM_X, SPDM_Y; // Speedometer
|
||||||
INT32 POSI_X, POSI_Y; // Position Number
|
static INT32 POSI_X, POSI_Y; // Position Number
|
||||||
INT32 FACE_X, FACE_Y; // Top-four Faces
|
static INT32 FACE_X, FACE_Y; // Top-four Faces
|
||||||
INT32 STCD_X, STCD_Y; // Starting countdown
|
static INT32 STCD_X, STCD_Y; // Starting countdown
|
||||||
INT32 CHEK_Y; // CHECK graphic
|
static INT32 CHEK_Y; // CHECK graphic
|
||||||
INT32 MINI_X, MINI_Y; // Minimap
|
static INT32 MINI_X, MINI_Y; // Minimap
|
||||||
INT32 WANT_X, WANT_Y; // Battle WANTED poster
|
static INT32 WANT_X, WANT_Y; // Battle WANTED poster
|
||||||
|
|
||||||
// This is for the P2 and P4 side of splitscreen. Then we'll flip P1's and P2's to the bottom with V_SPLITSCREEN.
|
// This is for the P2 and P4 side of splitscreen. Then we'll flip P1's and P2's to the bottom with V_SPLITSCREEN.
|
||||||
INT32 ITEM2_X, ITEM2_Y;
|
static INT32 ITEM2_X, ITEM2_Y;
|
||||||
INT32 LAPS2_X, LAPS2_Y;
|
static INT32 LAPS2_X, LAPS2_Y;
|
||||||
INT32 POSI2_X, POSI2_Y;
|
static INT32 POSI2_X, POSI2_Y;
|
||||||
|
|
||||||
static void K_initKartHUD(void)
|
static void K_initKartHUD(void)
|
||||||
{
|
{
|
||||||
@@ -1415,8 +1415,6 @@ static void K_drawKartStats(void)
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
|
||||||
spdoffset = 0;
|
|
||||||
|
|
||||||
if (G_BattleGametype() && ((speedostyle != SPEEDO_DIAL) || splitscreen))
|
if (G_BattleGametype() && ((speedostyle != SPEEDO_DIAL) || splitscreen))
|
||||||
spdoffset += ((stplyr->kartstuff[k_bumper] ? -5 : -8));
|
spdoffset += ((stplyr->kartstuff[k_bumper] ? -5 : -8));
|
||||||
@@ -3818,7 +3816,7 @@ static void K_drawKartMinimap(void)
|
|||||||
|
|
||||||
if (cv_showminimapangle.value && (minidoticon || minilighticon) && !playertimedout)
|
if (cv_showminimapangle.value && (minidoticon || minilighticon) && !playertimedout)
|
||||||
{
|
{
|
||||||
UINT8 *colormap;
|
UINT8 *colormap = NULL;
|
||||||
drawinfo_t dims;
|
drawinfo_t dims;
|
||||||
fixed_t interpx, interpy;
|
fixed_t interpx, interpy;
|
||||||
fixed_t xoff = 0, yoff = 0;
|
fixed_t xoff = 0, yoff = 0;
|
||||||
@@ -3829,10 +3827,27 @@ static void K_drawKartMinimap(void)
|
|||||||
if (encoremode)
|
if (encoremode)
|
||||||
ang = ANGLE_180 - ang;
|
ang = ANGLE_180 - ang;
|
||||||
|
|
||||||
if (mobj->colorized)
|
if (mobj->color)
|
||||||
colormap = R_GetTranslationColormap(TC_RAINBOW, mobj->color, GTC_CACHE);
|
{
|
||||||
else
|
if (mobj->colorized)
|
||||||
colormap = R_GetLocalTranslationColormap(mobj->skin, mobj->localskin, mobj->color, GTC_CACHE, mobj->skinlocal);
|
{
|
||||||
|
colormap = R_GetTranslationColormap(TC_RAINBOW, mobj->color, GTC_CACHE);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
const INT32 skinnum = K_GetMobjLocalSkinNum(mobj->skin, mobj->localskin, mobj->skinlocal);
|
||||||
|
|
||||||
|
// special case if startcolor is not the default (160 / Green)
|
||||||
|
if (skinnum && skins[skinnum].starttranscolor != skins[0].starttranscolor)
|
||||||
|
{
|
||||||
|
colormap = R_GetTranslationColormap(TC_DEFAULT, mobj->color, GTC_CACHE);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
colormap = R_GetLocalTranslationColormap(mobj->skin, mobj->localskin, mobj->color, GTC_CACHE, mobj->skinlocal);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
interpx = lerp(mobj->old_x, mobj->x);
|
interpx = lerp(mobj->old_x, mobj->x);
|
||||||
interpy = lerp(mobj->old_y, mobj->y);
|
interpy = lerp(mobj->old_y, mobj->y);
|
||||||
|
|||||||
+10
-2
@@ -660,13 +660,22 @@ INT32 K_GetSkinNum(player_t *player)
|
|||||||
|
|
||||||
//
|
//
|
||||||
// returns the mobj skinnumber
|
// returns the mobj skinnumber
|
||||||
// accounts for localskins
|
// accounts for localskins ?
|
||||||
//
|
//
|
||||||
INT32 K_GetMobjSkinNum(const skin_t *skin, boolean local)
|
INT32 K_GetMobjSkinNum(const skin_t *skin, boolean local)
|
||||||
{
|
{
|
||||||
return skin - K_GetSkinArray(local);
|
return skin - K_GetSkinArray(local);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
// returns the mobj skinnumber
|
||||||
|
// accounts for localskins
|
||||||
|
//
|
||||||
|
INT32 K_GetMobjLocalSkinNum(const skin_t *skin, const skin_t *localskin, boolean local)
|
||||||
|
{
|
||||||
|
return localskin ? (localskin - K_GetSkinArray(local)) : (skin - skins);
|
||||||
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
// returns the players skinnumber
|
// returns the players skinnumber
|
||||||
// accounts for localskins
|
// accounts for localskins
|
||||||
@@ -1480,7 +1489,6 @@ void K_KartBouncing(mobj_t *mobj1, mobj_t *mobj2, boolean bounce, boolean solid)
|
|||||||
fixed_t nx = FixedDiv(distx, dist);
|
fixed_t nx = FixedDiv(distx, dist);
|
||||||
fixed_t ny = FixedDiv(disty, dist);
|
fixed_t ny = FixedDiv(disty, dist);
|
||||||
|
|
||||||
dist = dist ? dist : 1;
|
|
||||||
distx = FixedMul(mobj1->radius+mobj2->radius, nx);
|
distx = FixedMul(mobj1->radius+mobj2->radius, nx);
|
||||||
disty = FixedMul(mobj1->radius+mobj2->radius, ny);
|
disty = FixedMul(mobj1->radius+mobj2->radius, ny);
|
||||||
|
|
||||||
|
|||||||
+22
-22
@@ -615,7 +615,7 @@ FUNCINLINE static ATTRINLINE void res_hud(Hook_State *hook)
|
|||||||
|
|
||||||
int LUA_HookMobj(mobj_t *mobj, int hook_type)
|
int LUA_HookMobj(mobj_t *mobj, int hook_type)
|
||||||
{
|
{
|
||||||
Hook_State hook;
|
Hook_State hook = {};
|
||||||
if (prepare_mobj_hook(&hook, false, hook_type, mobj))
|
if (prepare_mobj_hook(&hook, false, hook_type, mobj))
|
||||||
{
|
{
|
||||||
LUA_PushUserdata(gL, mobj, META_MOBJ);
|
LUA_PushUserdata(gL, mobj, META_MOBJ);
|
||||||
@@ -626,7 +626,7 @@ int LUA_HookMobj(mobj_t *mobj, int hook_type)
|
|||||||
|
|
||||||
int LUA_Hook2Mobj(mobj_t *t1, mobj_t *t2, int hook_type)
|
int LUA_Hook2Mobj(mobj_t *t1, mobj_t *t2, int hook_type)
|
||||||
{
|
{
|
||||||
Hook_State hook;
|
Hook_State hook = {};
|
||||||
if (prepare_mobj_hook(&hook, 0, hook_type, t1))
|
if (prepare_mobj_hook(&hook, 0, hook_type, t1))
|
||||||
{
|
{
|
||||||
LUA_PushUserdata(gL, t1, META_MOBJ);
|
LUA_PushUserdata(gL, t1, META_MOBJ);
|
||||||
@@ -638,14 +638,14 @@ int LUA_Hook2Mobj(mobj_t *t1, mobj_t *t2, int hook_type)
|
|||||||
|
|
||||||
void LUA_HookVoid(int type)
|
void LUA_HookVoid(int type)
|
||||||
{
|
{
|
||||||
Hook_State hook;
|
Hook_State hook = {};
|
||||||
if (prepare_hook(&hook, 0, type))
|
if (prepare_hook(&hook, 0, type))
|
||||||
call_hooks(&hook, 0, res_none);
|
call_hooks(&hook, 0, res_none);
|
||||||
}
|
}
|
||||||
|
|
||||||
void LUA_HookInt(INT32 number, int hook_type)
|
void LUA_HookInt(INT32 number, int hook_type)
|
||||||
{
|
{
|
||||||
Hook_State hook;
|
Hook_State hook = {};
|
||||||
if (prepare_hook(&hook, 0, hook_type))
|
if (prepare_hook(&hook, 0, hook_type))
|
||||||
{
|
{
|
||||||
lua_pushinteger(gL, number);
|
lua_pushinteger(gL, number);
|
||||||
@@ -655,7 +655,7 @@ void LUA_HookInt(INT32 number, int hook_type)
|
|||||||
|
|
||||||
/*void LUA_HookBool(boolean value, int hook_type)
|
/*void LUA_HookBool(boolean value, int hook_type)
|
||||||
{
|
{
|
||||||
Hook_State hook;
|
Hook_State hook = {};
|
||||||
if (prepare_hook(&hook, 0, hook_type))
|
if (prepare_hook(&hook, 0, hook_type))
|
||||||
{
|
{
|
||||||
//lua_pushboolean(gL, value);
|
//lua_pushboolean(gL, value);
|
||||||
@@ -665,7 +665,7 @@ void LUA_HookInt(INT32 number, int hook_type)
|
|||||||
|
|
||||||
int LUA_HookPlayer(player_t *player, int hook_type)
|
int LUA_HookPlayer(player_t *player, int hook_type)
|
||||||
{
|
{
|
||||||
Hook_State hook;
|
Hook_State hook = {};
|
||||||
if (prepare_hook(&hook, false, hook_type))
|
if (prepare_hook(&hook, false, hook_type))
|
||||||
{
|
{
|
||||||
LUA_PushUserdata(gL, player, META_PLAYER);
|
LUA_PushUserdata(gL, player, META_PLAYER);
|
||||||
@@ -676,7 +676,7 @@ int LUA_HookPlayer(player_t *player, int hook_type)
|
|||||||
|
|
||||||
int LUA_HookTiccmd(player_t *player, ticcmd_t *cmd, int hook_type)
|
int LUA_HookTiccmd(player_t *player, ticcmd_t *cmd, int hook_type)
|
||||||
{
|
{
|
||||||
Hook_State hook;
|
Hook_State hook = {};
|
||||||
if (prepare_hook(&hook, false, hook_type))
|
if (prepare_hook(&hook, false, hook_type))
|
||||||
{
|
{
|
||||||
LUA_PushUserdata(gL, player, META_PLAYER);
|
LUA_PushUserdata(gL, player, META_PLAYER);
|
||||||
@@ -695,7 +695,7 @@ int LUA_HookTiccmd(player_t *player, ticcmd_t *cmd, int hook_type)
|
|||||||
|
|
||||||
void LUA_HookHUD(int hook_type, huddrawlist_h list)
|
void LUA_HookHUD(int hook_type, huddrawlist_h list)
|
||||||
{
|
{
|
||||||
Hook_State hook;
|
Hook_State hook = {};
|
||||||
if (prepare_hud_hook(&hook, hook_type))
|
if (prepare_hud_hook(&hook, hook_type))
|
||||||
{
|
{
|
||||||
LUA_SetHudHook(hook_type, list);
|
LUA_SetHudHook(hook_type, list);
|
||||||
@@ -723,7 +723,7 @@ static void hook_think_frame(int type)
|
|||||||
int hook_index = 0;
|
int hook_index = 0;
|
||||||
precise_t time_taken = 0;
|
precise_t time_taken = 0;
|
||||||
|
|
||||||
Hook_State hook;
|
Hook_State hook = {};
|
||||||
|
|
||||||
const hook_t * map = &hookIds[type];
|
const hook_t * map = &hookIds[type];
|
||||||
int k;
|
int k;
|
||||||
@@ -783,7 +783,7 @@ void LUA_HookPostThinkFrame(void)
|
|||||||
|
|
||||||
int LUA_HookTouchSpecial(mobj_t *special, mobj_t *toucher)
|
int LUA_HookTouchSpecial(mobj_t *special, mobj_t *toucher)
|
||||||
{
|
{
|
||||||
Hook_State hook;
|
Hook_State hook = {};
|
||||||
if (prepare_mobj_hook(&hook, false, MOBJ_HOOK(TouchSpecial), special))
|
if (prepare_mobj_hook(&hook, false, MOBJ_HOOK(TouchSpecial), special))
|
||||||
{
|
{
|
||||||
LUA_PushUserdata(gL, special, META_MOBJ);
|
LUA_PushUserdata(gL, special, META_MOBJ);
|
||||||
@@ -802,7 +802,7 @@ static int damage_hook
|
|||||||
int hook_type,
|
int hook_type,
|
||||||
Hook_Callback results_handler
|
Hook_Callback results_handler
|
||||||
){
|
){
|
||||||
Hook_State hook;
|
Hook_State hook = {};
|
||||||
if (prepare_mobj_hook(&hook, 0, hook_type, target))
|
if (prepare_mobj_hook(&hook, 0, hook_type, target))
|
||||||
{
|
{
|
||||||
LUA_PushUserdata(gL, target, META_MOBJ);
|
LUA_PushUserdata(gL, target, META_MOBJ);
|
||||||
@@ -890,8 +890,8 @@ int LUA_HookBotAI(mobj_t *sonic, mobj_t *tails, ticcmd_t *cmd)
|
|||||||
{
|
{
|
||||||
const char *skin = ((skin_t *)tails->skin)->name;
|
const char *skin = ((skin_t *)tails->skin)->name;
|
||||||
|
|
||||||
Hook_State hook;
|
Hook_State hook = {};
|
||||||
BotAI_State botai;
|
BotAI_State botai = {};
|
||||||
|
|
||||||
if (prepare_string_hook(&hook, false, STRING_HOOK(BotAI), skin))
|
if (prepare_string_hook(&hook, false, STRING_HOOK(BotAI), skin))
|
||||||
{
|
{
|
||||||
@@ -911,7 +911,7 @@ int LUA_HookBotAI(mobj_t *sonic, mobj_t *tails, ticcmd_t *cmd)
|
|||||||
|
|
||||||
void LUA_HookLinedefExecute(line_t *line, mobj_t *mo, sector_t *sector)
|
void LUA_HookLinedefExecute(line_t *line, mobj_t *mo, sector_t *sector)
|
||||||
{
|
{
|
||||||
Hook_State hook;
|
Hook_State hook = {};
|
||||||
if (prepare_string_hook
|
if (prepare_string_hook
|
||||||
(&hook, 0, STRING_HOOK(LinedefExecute), line->text))
|
(&hook, 0, STRING_HOOK(LinedefExecute), line->text))
|
||||||
{
|
{
|
||||||
@@ -924,7 +924,7 @@ void LUA_HookLinedefExecute(line_t *line, mobj_t *mo, sector_t *sector)
|
|||||||
|
|
||||||
int LUA_HookPlayerMsg(int source, int target, int flags, char *msg, int mute)
|
int LUA_HookPlayerMsg(int source, int target, int flags, char *msg, int mute)
|
||||||
{
|
{
|
||||||
Hook_State hook;
|
Hook_State hook = {};
|
||||||
if (prepare_hook(&hook, false, HOOK(PlayerMsg)))
|
if (prepare_hook(&hook, false, HOOK(PlayerMsg)))
|
||||||
{
|
{
|
||||||
LUA_PushUserdata(gL, &players[source], META_PLAYER); // Source player
|
LUA_PushUserdata(gL, &players[source], META_PLAYER); // Source player
|
||||||
@@ -953,7 +953,7 @@ int LUA_HookPlayerMsg(int source, int target, int flags, char *msg, int mute)
|
|||||||
|
|
||||||
int LUA_HookHurtMsg(player_t *player, mobj_t *inflictor, mobj_t *source)
|
int LUA_HookHurtMsg(player_t *player, mobj_t *inflictor, mobj_t *source)
|
||||||
{
|
{
|
||||||
Hook_State hook;
|
Hook_State hook = {};
|
||||||
if (prepare_mobj_hook(&hook, false, MOBJ_HOOK(HurtMsg), inflictor))
|
if (prepare_mobj_hook(&hook, false, MOBJ_HOOK(HurtMsg), inflictor))
|
||||||
{
|
{
|
||||||
LUA_PushUserdata(gL, player, META_PLAYER);
|
LUA_PushUserdata(gL, player, META_PLAYER);
|
||||||
@@ -967,7 +967,7 @@ int LUA_HookHurtMsg(player_t *player, mobj_t *inflictor, mobj_t *source)
|
|||||||
void LUA_HookNetArchive(lua_CFunction archFunc, savebuffer_t *save)
|
void LUA_HookNetArchive(lua_CFunction archFunc, savebuffer_t *save)
|
||||||
{
|
{
|
||||||
const hook_t * map = &hookIds[HOOK(NetVars)];
|
const hook_t * map = &hookIds[HOOK(NetVars)];
|
||||||
Hook_State hook;
|
Hook_State hook = {};
|
||||||
/* this is a remarkable case where the stack isn't reset */
|
/* this is a remarkable case where the stack isn't reset */
|
||||||
if (map->numHooks > 0)
|
if (map->numHooks > 0)
|
||||||
{
|
{
|
||||||
@@ -997,7 +997,7 @@ void LUA_HookNetArchive(lua_CFunction archFunc, savebuffer_t *save)
|
|||||||
|
|
||||||
void LUA_HookPlayerQuit(player_t *plr, int reason)
|
void LUA_HookPlayerQuit(player_t *plr, int reason)
|
||||||
{
|
{
|
||||||
Hook_State hook;
|
Hook_State hook = {};
|
||||||
if (prepare_hook(&hook, 0, HOOK(PlayerQuit)))
|
if (prepare_hook(&hook, 0, HOOK(PlayerQuit)))
|
||||||
{
|
{
|
||||||
LUA_PushUserdata(gL, plr, META_PLAYER); // Player that quit
|
LUA_PushUserdata(gL, plr, META_PLAYER); // Player that quit
|
||||||
@@ -1060,7 +1060,7 @@ int LUA_HookMusicChange(const char *oldname, struct MusicChange *param)
|
|||||||
const int type = HOOK(MusicChange);
|
const int type = HOOK(MusicChange);
|
||||||
const hook_t * map = &hookIds[type];
|
const hook_t * map = &hookIds[type];
|
||||||
|
|
||||||
Hook_State hook;
|
Hook_State hook = {};
|
||||||
|
|
||||||
int k;
|
int k;
|
||||||
|
|
||||||
@@ -1096,7 +1096,7 @@ int LUA_HookMusicChange(const char *oldname, struct MusicChange *param)
|
|||||||
|
|
||||||
int LUA_HookMusicCredit(musicdef_t *musicdef)
|
int LUA_HookMusicCredit(musicdef_t *musicdef)
|
||||||
{
|
{
|
||||||
Hook_State hook;
|
Hook_State hook = {};
|
||||||
if (prepare_hook(&hook, 0, HOOK(MusicCredit)))
|
if (prepare_hook(&hook, 0, HOOK(MusicCredit)))
|
||||||
{
|
{
|
||||||
LUA_PushUserdata(gL, musicdef, META_MUSICDEF);
|
LUA_PushUserdata(gL, musicdef, META_MUSICDEF);
|
||||||
@@ -1114,7 +1114,7 @@ static int kartdamage_hook
|
|||||||
int hook_type,
|
int hook_type,
|
||||||
Hook_Callback results_handler
|
Hook_Callback results_handler
|
||||||
){
|
){
|
||||||
Hook_State hook;
|
Hook_State hook = {};
|
||||||
if (prepare_hook(&hook, 0, hook_type))
|
if (prepare_hook(&hook, 0, hook_type))
|
||||||
{
|
{
|
||||||
LUA_PushUserdata(gL, player, META_PLAYER);
|
LUA_PushUserdata(gL, player, META_PLAYER);
|
||||||
@@ -1163,7 +1163,7 @@ boolean LUA_HookPlayerExplode(player_t *player, mobj_t *inflictor, mobj_t *sourc
|
|||||||
|
|
||||||
void LUA_HookSetupVote(INT16 result[], INT16 maxresults, UINT8 gt, UINT8 secondgt)
|
void LUA_HookSetupVote(INT16 result[], INT16 maxresults, UINT8 gt, UINT8 secondgt)
|
||||||
{
|
{
|
||||||
Hook_State hook;
|
Hook_State hook = {};
|
||||||
if (prepare_hook(&hook, 0, HOOK(SetupVote)))
|
if (prepare_hook(&hook, 0, HOOK(SetupVote)))
|
||||||
{
|
{
|
||||||
// { 0, 0, 0, 0, }
|
// { 0, 0, 0, 0, }
|
||||||
|
|||||||
+1
-1
@@ -556,7 +556,7 @@ static void GIF_framewrite(void)
|
|||||||
}
|
}
|
||||||
else if (gif_dynamicdelay ==(UINT8) 1)
|
else if (gif_dynamicdelay ==(UINT8) 1)
|
||||||
{
|
{
|
||||||
float delayf = ceil(100.0f/NEWTICRATE);
|
float delayf = ceilf(100.0f/NEWTICRATE);
|
||||||
|
|
||||||
delay = (UINT16)((I_GetPreciseTime() - gif_prevframetime)) / (I_GetPrecisePrecision() / 1000000) /10/1000;
|
delay = (UINT16)((I_GetPreciseTime() - gif_prevframetime)) / (I_GetPrecisePrecision() / 1000000) /10/1000;
|
||||||
|
|
||||||
|
|||||||
+30
-45
@@ -142,7 +142,7 @@ typedef enum
|
|||||||
} text_enum;
|
} text_enum;
|
||||||
|
|
||||||
#ifdef HAVE_THREADS
|
#ifdef HAVE_THREADS
|
||||||
I_Mutex m_menu_mutex;
|
I_mutex m_menu_mutex;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
M_waiting_mode_t m_waiting_mode = M_NOT_WAITING;
|
M_waiting_mode_t m_waiting_mode = M_NOT_WAITING;
|
||||||
@@ -1967,7 +1967,7 @@ void M_Ticker(void)
|
|||||||
}
|
}
|
||||||
|
|
||||||
#if defined (MASTERSERVER) && defined (HAVE_THREADS)
|
#if defined (MASTERSERVER) && defined (HAVE_THREADS)
|
||||||
I_LockMutex(&ms_ServerList_mutex);
|
I_lock_mutex(&ms_ServerList_mutex);
|
||||||
{
|
{
|
||||||
if (ms_ServerList)
|
if (ms_ServerList)
|
||||||
{
|
{
|
||||||
@@ -1976,7 +1976,7 @@ void M_Ticker(void)
|
|||||||
ms_ServerList = NULL;
|
ms_ServerList = NULL;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
I_UnlockMutex(ms_ServerList_mutex);
|
I_unlock_mutex(ms_ServerList_mutex);
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -2936,7 +2936,7 @@ static void M_PrepareLevelSelect(void)
|
|||||||
boolean M_CanShowLevelInList(INT32 mapnum, INT32 gt)
|
boolean M_CanShowLevelInList(INT32 mapnum, INT32 gt)
|
||||||
{
|
{
|
||||||
// invalid mapnum
|
// invalid mapnum
|
||||||
if (mapnum < -1)
|
if (mapnum < -1 || mapnum >= NUMMAPS)
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
// Random map!
|
// Random map!
|
||||||
@@ -4014,18 +4014,18 @@ size_t demolist_all_size = 0;
|
|||||||
boolean replaynamesloaded = false;
|
boolean replaynamesloaded = false;
|
||||||
|
|
||||||
#ifdef HAVE_THREADS
|
#ifdef HAVE_THREADS
|
||||||
I_Mutex replayquerymutex;
|
I_mutex replayquerymutex;
|
||||||
|
|
||||||
// g_in_exiting_signal_handler is an evil hack
|
// I_In_Exiting_Signal_Handler is an evil hack
|
||||||
// to avoid infinite SIGABRT recursion in the signal handler
|
// to avoid infinite SIGABRT recursion in the signal handler
|
||||||
// due to poisoned locks or mach-o kernel not supporting locks in signals
|
// due to poisoned locks or mach-o kernel not supporting locks in signals
|
||||||
// or something like that. idk
|
// or something like that. idk
|
||||||
# define Lock_search_state() if (!g_in_exiting_signal_handler) { I_LockMutex(&replayquerymutex); }
|
# define Lock_search_state() if (!I_In_Exiting_Signal_Handler()) { I_LockMutex(&replayquerymutex); }
|
||||||
# define Unlock_search_state() if (!g_in_exiting_signal_handler) { I_UnlockMutex(replayquerymutex); }
|
# define Unlock_search_state() if (!I_In_Exiting_Signal_Handler()) { I_UnlockMutex(replayquerymutex); }
|
||||||
#else/*HAVE_THREADS*/
|
#else /*HAVE_THREADS*/
|
||||||
# define Lock_search_state()
|
# define Lock_search_state()
|
||||||
# define Unlock_search_state()
|
# define Unlock_search_state()
|
||||||
#endif/*HAVE_THREADS*/
|
#endif /*HAVE_THREADS*/
|
||||||
|
|
||||||
|
|
||||||
#define MAXREPLAYQUERY 37
|
#define MAXREPLAYQUERY 37
|
||||||
@@ -4088,10 +4088,7 @@ static void LoadReplayNames(void)
|
|||||||
Unlock_search_state();
|
Unlock_search_state();
|
||||||
|
|
||||||
#ifdef HAVE_THREADS
|
#ifdef HAVE_THREADS
|
||||||
if (!I_SpawnThread("replay-names-load", ReplayNamesLoadThread, replaydirpath))
|
I_spawn_thread("replay-names-load", ReplayNamesLoadThread, replaydirpath);
|
||||||
{
|
|
||||||
free(replaydirpath);
|
|
||||||
}
|
|
||||||
#else
|
#else
|
||||||
ReplayNamesLoadThread(replaydirpath);
|
ReplayNamesLoadThread(replaydirpath);
|
||||||
#endif
|
#endif
|
||||||
@@ -5525,7 +5522,6 @@ static void M_DrawChecklist(void)
|
|||||||
|
|
||||||
if (conditionSets[unlockables[i].conditionset - 1].numconditions)
|
if (conditionSets[unlockables[i].conditionset - 1].numconditions)
|
||||||
{
|
{
|
||||||
c = 0;
|
|
||||||
lastid = -1;
|
lastid = -1;
|
||||||
|
|
||||||
for (c = 0; c < conditionSets[unlockables[i].conditionset - 1].numconditions; c++)
|
for (c = 0; c < conditionSets[unlockables[i].conditionset - 1].numconditions; c++)
|
||||||
@@ -5685,9 +5681,6 @@ static void M_DrawMusicTest(void)
|
|||||||
{
|
{
|
||||||
INT32 x, y, i;
|
INT32 x, y, i;
|
||||||
|
|
||||||
x = 90<<FRACBITS;
|
|
||||||
y = (BASEVIDHEIGHT-32)<<FRACBITS;
|
|
||||||
|
|
||||||
y = (BASEVIDWIDTH-vid.scaledwidth)/2;
|
y = (BASEVIDWIDTH-vid.scaledwidth)/2;
|
||||||
|
|
||||||
V_DrawFill(y-1, 20, vid.scaledwidth+1, 24, 239);
|
V_DrawFill(y-1, 20, vid.scaledwidth+1, 24, 239);
|
||||||
@@ -6687,11 +6680,11 @@ static void M_EndGame(INT32 choice)
|
|||||||
void M_SetWaitingMode(int mode)
|
void M_SetWaitingMode(int mode)
|
||||||
{
|
{
|
||||||
#ifdef HAVE_THREADS
|
#ifdef HAVE_THREADS
|
||||||
I_LockMutex(&m_menu_mutex);
|
I_lock_mutex(&m_menu_mutex);
|
||||||
#endif
|
#endif
|
||||||
m_waiting_mode = mode;
|
m_waiting_mode = mode;
|
||||||
#ifdef HAVE_THREADS
|
#ifdef HAVE_THREADS
|
||||||
I_UnlockMutex(m_menu_mutex);
|
I_unlock_mutex(m_menu_mutex);
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -6700,11 +6693,11 @@ int M_GetWaitingMode(void)
|
|||||||
int mode;
|
int mode;
|
||||||
|
|
||||||
#ifdef HAVE_THREADS
|
#ifdef HAVE_THREADS
|
||||||
I_LockMutex(&m_menu_mutex);
|
I_lock_mutex(&m_menu_mutex);
|
||||||
#endif
|
#endif
|
||||||
mode = m_waiting_mode;
|
mode = m_waiting_mode;
|
||||||
#ifdef HAVE_THREADS
|
#ifdef HAVE_THREADS
|
||||||
I_UnlockMutex(m_menu_mutex);
|
I_unlock_mutex(m_menu_mutex);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
return mode;
|
return mode;
|
||||||
@@ -6716,23 +6709,20 @@ static void Spawn_masterserver_thread(const char *name, void (*thread)(int*))
|
|||||||
{
|
{
|
||||||
int *id = malloc(sizeof *id);
|
int *id = malloc(sizeof *id);
|
||||||
|
|
||||||
I_LockMutex(&ms_QueryId_mutex);
|
I_lock_mutex(&ms_QueryId_mutex);
|
||||||
*id = ms_QueryId;
|
*id = ms_QueryId;
|
||||||
I_UnlockMutex(ms_QueryId_mutex);
|
I_unlock_mutex(ms_QueryId_mutex);
|
||||||
|
|
||||||
if (!I_SpawnThread(name, (I_ThreadFn)thread, id))
|
I_spawn_thread(name, (I_thread_fn)thread, id);
|
||||||
{
|
|
||||||
free(id);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static int Same_instance(int id)
|
static int Same_instance(int id)
|
||||||
{
|
{
|
||||||
int okay;
|
int okay;
|
||||||
|
|
||||||
I_LockMutex(&ms_QueryId_mutex);
|
I_lock_mutex(&ms_QueryId_mutex);
|
||||||
okay = ( id == ms_QueryId );
|
okay = ( id == ms_QueryId );
|
||||||
I_UnlockMutex(ms_QueryId_mutex);
|
I_unlock_mutex(ms_QueryId_mutex);
|
||||||
|
|
||||||
return okay;
|
return okay;
|
||||||
}
|
}
|
||||||
@@ -6761,9 +6751,9 @@ static void Fetch_servers_thread(int *id)
|
|||||||
M_SetWaitingMode(M_NOT_WAITING);
|
M_SetWaitingMode(M_NOT_WAITING);
|
||||||
|
|
||||||
#ifdef HAVE_THREADS
|
#ifdef HAVE_THREADS
|
||||||
I_LockMutex(&ms_ServerList_mutex);
|
I_lock_mutex(&ms_ServerList_mutex);
|
||||||
ms_ServerList = server_list;
|
ms_ServerList = server_list;
|
||||||
I_UnlockMutex(ms_ServerList_mutex);
|
I_unlock_mutex(ms_ServerList_mutex);
|
||||||
#else
|
#else
|
||||||
CL_QueryServerList(server_list);
|
CL_QueryServerList(server_list);
|
||||||
free(server_list);
|
free(server_list);
|
||||||
@@ -6796,7 +6786,7 @@ static void M_SearchServerList(void)
|
|||||||
serverlistsearchedcount = 0;
|
serverlistsearchedcount = 0;
|
||||||
|
|
||||||
#ifdef HAVE_THREADS
|
#ifdef HAVE_THREADS
|
||||||
I_LockMutex(&ms_ServerList_mutex);
|
I_lock_mutex(&ms_ServerList_mutex);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
for (UINT32 i = 0; i < serverlistcount; ++i)
|
for (UINT32 i = 0; i < serverlistcount; ++i)
|
||||||
@@ -6807,7 +6797,7 @@ static void M_SearchServerList(void)
|
|||||||
}
|
}
|
||||||
|
|
||||||
#ifdef HAVE_THREADS
|
#ifdef HAVE_THREADS
|
||||||
I_UnlockMutex(ms_ServerList_mutex);
|
I_unlock_mutex(ms_ServerList_mutex);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
if (menuinput.length > 0)
|
if (menuinput.length > 0)
|
||||||
@@ -7173,11 +7163,11 @@ static void M_CheckMODVersion(int id)
|
|||||||
{
|
{
|
||||||
sprintf(updatestring, UPDATE_ALERT_STRING, VERSIONSTRING, updatecheck);
|
sprintf(updatestring, UPDATE_ALERT_STRING, VERSIONSTRING, updatecheck);
|
||||||
#ifdef HAVE_THREADS
|
#ifdef HAVE_THREADS
|
||||||
I_LockMutex(&m_menu_mutex);
|
I_lock_mutex(&m_menu_mutex);
|
||||||
#endif
|
#endif
|
||||||
M_StartMessage(updatestring, NULL, MM_NOTHING);
|
M_StartMessage(updatestring, NULL, MM_NOTHING);
|
||||||
#ifdef HAVE_THREADS
|
#ifdef HAVE_THREADS
|
||||||
I_UnlockMutex(m_menu_mutex);
|
I_unlock_mutex(m_menu_mutex);
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -7223,13 +7213,13 @@ static void M_ConnectMenu(INT32 choice)
|
|||||||
itemOn = 0;
|
itemOn = 0;
|
||||||
|
|
||||||
#if defined (MASTERSERVER) && defined (HAVE_THREADS)
|
#if defined (MASTERSERVER) && defined (HAVE_THREADS)
|
||||||
I_LockMutex(&ms_QueryId_mutex);
|
I_lock_mutex(&ms_QueryId_mutex);
|
||||||
{
|
{
|
||||||
ms_QueryId++;
|
ms_QueryId++;
|
||||||
}
|
}
|
||||||
I_UnlockMutex(ms_QueryId_mutex);
|
I_unlock_mutex(ms_QueryId_mutex);
|
||||||
|
|
||||||
I_LockMutex(&ms_ServerList_mutex);
|
I_lock_mutex(&ms_ServerList_mutex);
|
||||||
{
|
{
|
||||||
if (ms_ServerList)
|
if (ms_ServerList)
|
||||||
{
|
{
|
||||||
@@ -7237,7 +7227,7 @@ static void M_ConnectMenu(INT32 choice)
|
|||||||
ms_ServerList = NULL;
|
ms_ServerList = NULL;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
I_UnlockMutex(ms_ServerList_mutex);
|
I_unlock_mutex(ms_ServerList_mutex);
|
||||||
|
|
||||||
#ifdef UPDATE_ALERT
|
#ifdef UPDATE_ALERT
|
||||||
Spawn_masterserver_thread("check-new-version", Check_new_version_thread);
|
Spawn_masterserver_thread("check-new-version", Check_new_version_thread);
|
||||||
@@ -8006,14 +7996,9 @@ static void M_DrawSetupMultiPlayerMenu(void)
|
|||||||
#define GETSELECTEDSPEED (itemOn == 1 && setupm_skinselect < numskins ? skins[skinsorted[setupm_skinselect]].kartspeed : skins[setupm_fakeskin].kartspeed)
|
#define GETSELECTEDSPEED (itemOn == 1 && setupm_skinselect < numskins ? skins[skinsorted[setupm_skinselect]].kartspeed : skins[setupm_fakeskin].kartspeed)
|
||||||
#define GETSELECTEDWEIGHT (itemOn == 1 && setupm_skinselect < numskins ? skins[skinsorted[setupm_skinselect]].kartweight : skins[setupm_fakeskin].kartweight)
|
#define GETSELECTEDWEIGHT (itemOn == 1 && setupm_skinselect < numskins ? skins[skinsorted[setupm_skinselect]].kartweight : skins[setupm_fakeskin].kartweight)
|
||||||
|
|
||||||
statoffset = 0;
|
|
||||||
tw = V_StringWidth("Character", 0);//V_StringWidth(GETSELECTEDSKINNAME, 0);
|
tw = V_StringWidth("Character", 0);//V_StringWidth(GETSELECTEDSKINNAME, 0);
|
||||||
st = V_StringWidth(GETSELECTEDSKINNAME, 0);
|
st = V_StringWidth(GETSELECTEDSKINNAME, 0);
|
||||||
|
|
||||||
INT32 selectedskin = (itemOn == 1 && setupm_skinselect < numskins ? skinsorted[setupm_skinselect] : setupm_fakeskin);
|
|
||||||
speed = skins[selectedskin].kartspeed;
|
|
||||||
weight = skins[selectedskin].kartweight;
|
|
||||||
|
|
||||||
V_DrawString((mx+(tw/2)) - (st/2), my + 37,
|
V_DrawString((mx+(tw/2)) - (st/2), my + 37,
|
||||||
((MP_PlayerSetupMenu[2].status & IT_TYPE) == IT_SPACE ? V_TRANSLUCENT : 0) | highlightflags | V_ALLOWLOWERCASE,
|
((MP_PlayerSetupMenu[2].status & IT_TYPE) == IT_SPACE ? V_TRANSLUCENT : 0) | highlightflags | V_ALLOWLOWERCASE,
|
||||||
GETSELECTEDSKINNAME);
|
GETSELECTEDSKINNAME);
|
||||||
|
|||||||
+1
-1
@@ -215,7 +215,7 @@ void M_SetupNextMenu(menu_t *menudef);
|
|||||||
void M_ClearMenus(boolean callexitmenufunc);
|
void M_ClearMenus(boolean callexitmenufunc);
|
||||||
|
|
||||||
#ifdef HAVE_THREADS
|
#ifdef HAVE_THREADS
|
||||||
extern I_Mutex m_menu_mutex;
|
extern I_mutex m_menu_mutex;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
extern menu_t *currentMenu;
|
extern menu_t *currentMenu;
|
||||||
|
|||||||
+13
-20
@@ -986,7 +986,7 @@ static const char* OP_ExpTooltips[] =
|
|||||||
"Skips rendering frames if game logic takes too long\npreventing gameplay issues during performance drops.", // idk im shit as describing things
|
"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.",
|
"Disabling Screen Textures may result in a performance boost\nbut will break certain effects.\nScreen textures are required at resolutions lower than your desktop resolution!"
|
||||||
#ifdef USE_FBO_OGL
|
#ifdef USE_FBO_OGL
|
||||||
"Allows the game to downsample from a higher resolution\nthan your display in OpenGL renderer mode.\nRequires a GPU with atleast OpenGL 2.1 support.",
|
"Allows the game to downsample from a higher resolution\nthan your display in OpenGL renderer mode.\nRequires a GPU with atleast OpenGL 2.1 support.",
|
||||||
#endif
|
#endif
|
||||||
@@ -1644,29 +1644,25 @@ static menuitem_t OP_AccessibilityMenu[] =
|
|||||||
|
|
||||||
{IT_STRING|IT_CVAR, NULL, "Minimum Sector Brightness", &cv_secbright, 45},
|
{IT_STRING|IT_CVAR, NULL, "Minimum Sector Brightness", &cv_secbright, 45},
|
||||||
|
|
||||||
#ifdef HWRENDER
|
{IT_STRING|IT_CVAR, NULL, "Water Surface Ripples", &cv_ripplewater, 50},
|
||||||
{IT_STRING|IT_CVAR, NULL, "Screen Textures", &cv_glscreentextures, 50},
|
|
||||||
#endif
|
|
||||||
|
|
||||||
{IT_STRING|IT_CVAR, NULL, "Water Surface Ripples", &cv_ripplewater, 55},
|
{IT_STRING|IT_CVAR, NULL, "Fade Players near Camera", &cv_playerfade, 55},
|
||||||
|
|
||||||
{IT_STRING|IT_CVAR, NULL, "Fade Players near Camera", &cv_playerfade, 60},
|
{IT_STRING|IT_CVAR, NULL, "Quake Screenshakes", &cv_screenquake, 60},
|
||||||
|
|
||||||
{IT_STRING|IT_CVAR, NULL, "Quake Screenshakes", &cv_screenquake, 65},
|
{IT_CALL|IT_STRING, NULL, "Camera Options...", M_CameraMenu, 65},
|
||||||
|
|
||||||
{IT_CALL|IT_STRING, NULL, "Camera Options...", M_CameraMenu, 70},
|
{IT_HEADER, NULL, "Audio", NULL, 75},
|
||||||
|
|
||||||
{IT_HEADER, NULL, "Audio", NULL, 80},
|
{IT_STRING|IT_CVAR, NULL, "Reverse L/R Channels", &stereoreverse, 85},
|
||||||
|
{IT_STRING|IT_CVAR, NULL, "Same Sound Limit", &cv_samesoundlimit, 90},
|
||||||
|
|
||||||
{IT_STRING|IT_CVAR, NULL, "Reverse L/R Channels", &stereoreverse, 90},
|
{IT_HEADER, NULL, "Controls", NULL, 100},
|
||||||
{IT_STRING|IT_CVAR, NULL, "Same Sound Limit", &cv_samesoundlimit, 95},
|
|
||||||
|
|
||||||
{IT_HEADER, NULL, "Controls", NULL, 105},
|
{IT_STRING|IT_CVAR, NULL, "Automatic Acceleration (P1)", &cv_autoaccel[0], 110},
|
||||||
|
{IT_STRING|IT_CVAR, NULL, "Automatic Acceleration (P2)", &cv_autoaccel[1], 115},
|
||||||
{IT_STRING|IT_CVAR, NULL, "Automatic Acceleration (P1)", &cv_autoaccel[0], 115},
|
{IT_STRING|IT_CVAR, NULL, "Automatic Acceleration (P3)", &cv_autoaccel[2], 120},
|
||||||
{IT_STRING|IT_CVAR, NULL, "Automatic Acceleration (P2)", &cv_autoaccel[1], 120},
|
{IT_STRING|IT_CVAR, NULL, "Automatic Acceleration (P4)", &cv_autoaccel[3], 125},
|
||||||
{IT_STRING|IT_CVAR, NULL, "Automatic Acceleration (P3)", &cv_autoaccel[2], 125},
|
|
||||||
{IT_STRING|IT_CVAR, NULL, "Automatic Acceleration (P4)", &cv_autoaccel[3], 130},
|
|
||||||
};
|
};
|
||||||
|
|
||||||
static const char* OP_AccessibilityTooltips[] =
|
static const char* OP_AccessibilityTooltips[] =
|
||||||
@@ -1679,9 +1675,6 @@ static const char* OP_AccessibilityTooltips[] =
|
|||||||
"Reduces or disables certain effects players might be sensitive to\nSuch as flashing, flickering, certain screen effects and more.",
|
"Reduces or disables certain effects players might be sensitive to\nSuch as flashing, flickering, certain screen effects and more.",
|
||||||
"Disables the flicker effect on Midnight Channel.",
|
"Disables the flicker effect on Midnight Channel.",
|
||||||
"Sets minimum sector brightness, useful for dark areas",
|
"Sets minimum sector brightness, useful for dark areas",
|
||||||
#ifdef HWRENDER
|
|
||||||
"Disabling Screen Textures will disable the Underwater and Heat screen effects.",
|
|
||||||
#endif
|
|
||||||
"Toggles the ripple effect on water surfaces",
|
"Toggles the ripple effect on water surfaces",
|
||||||
"Fades other Players that are close to the camera in and out",
|
"Fades other Players that are close to the camera in and out",
|
||||||
"Toggles the screen shake effect during Earthquakes",
|
"Toggles the screen shake effect during Earthquakes",
|
||||||
|
|||||||
+30
-33
@@ -41,11 +41,11 @@ static time_t MSLastPing;
|
|||||||
static char *MSRules;
|
static char *MSRules;
|
||||||
|
|
||||||
#ifdef HAVE_THREADS
|
#ifdef HAVE_THREADS
|
||||||
static I_Mutex MSMutex;
|
static I_mutex MSMutex;
|
||||||
static I_Cond MSCond;
|
static I_cond MSCond;
|
||||||
|
|
||||||
# define Lock_state() I_LockMutex (&MSMutex)
|
# define Lock_state() I_lock_mutex (&MSMutex)
|
||||||
# define Unlock_state() I_UnlockMutex (MSMutex)
|
# define Unlock_state() I_unlock_mutex (MSMutex)
|
||||||
#else/*HAVE_THREADS*/
|
#else/*HAVE_THREADS*/
|
||||||
# define Lock_state()
|
# define Lock_state()
|
||||||
# define Unlock_state()
|
# define Unlock_state()
|
||||||
@@ -90,10 +90,10 @@ consvar_t cv_masterserver_nagattempts = {"masterserver_nagattempts", "5", CV_SAV
|
|||||||
|
|
||||||
#if defined (MASTERSERVER) && defined (HAVE_THREADS)
|
#if defined (MASTERSERVER) && defined (HAVE_THREADS)
|
||||||
int ms_QueryId = 0;
|
int ms_QueryId = 0;
|
||||||
I_Mutex ms_QueryId_mutex;
|
I_mutex ms_QueryId_mutex;
|
||||||
|
|
||||||
msg_server_t *ms_ServerList = NULL;
|
msg_server_t *ms_ServerList = NULL;
|
||||||
I_Mutex ms_ServerList_mutex;
|
I_mutex ms_ServerList_mutex;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
UINT16 current_port = 0;
|
UINT16 current_port = 0;
|
||||||
@@ -129,11 +129,11 @@ void AddMServCommands(void)
|
|||||||
static void WarnGUI (void)
|
static void WarnGUI (void)
|
||||||
{
|
{
|
||||||
#ifdef HAVE_THREADS
|
#ifdef HAVE_THREADS
|
||||||
I_LockMutex(&m_menu_mutex);
|
I_lock_mutex(&m_menu_mutex);
|
||||||
#endif
|
#endif
|
||||||
M_PopupMasterServerConnectError();
|
M_PopupMasterServerConnectError();
|
||||||
#ifdef HAVE_THREADS
|
#ifdef HAVE_THREADS
|
||||||
I_UnlockMutex(m_menu_mutex);
|
I_unlock_mutex(m_menu_mutex);
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -168,12 +168,12 @@ char *GetMODVersion(int id)
|
|||||||
c = HMS_compare_mod_version(buffer, 16);
|
c = HMS_compare_mod_version(buffer, 16);
|
||||||
|
|
||||||
#ifdef HAVE_THREADS
|
#ifdef HAVE_THREADS
|
||||||
I_LockMutex(&ms_QueryId_mutex);
|
I_lock_mutex(&ms_QueryId_mutex);
|
||||||
{
|
{
|
||||||
if (id != ms_QueryId)
|
if (id != ms_QueryId)
|
||||||
c = -1;
|
c = -1;
|
||||||
}
|
}
|
||||||
I_UnlockMutex(ms_QueryId_mutex);
|
I_unlock_mutex(ms_QueryId_mutex);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
if (c > 0)
|
if (c > 0)
|
||||||
@@ -262,6 +262,7 @@ Finish_registration (void)
|
|||||||
{
|
{
|
||||||
CONS_Printf("\n");
|
CONS_Printf("\n");
|
||||||
CONS_Alert(CONS_NOTICE, "%s\n", rules);
|
CONS_Alert(CONS_NOTICE, "%s\n", rules);
|
||||||
|
free(rules);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (registered)
|
if (registered)
|
||||||
@@ -341,7 +342,7 @@ Finish_unlist (void)
|
|||||||
Unlock_state();
|
Unlock_state();
|
||||||
|
|
||||||
#ifdef HAVE_THREADS
|
#ifdef HAVE_THREADS
|
||||||
I_WakeAllCond(&MSCond);
|
I_wake_all_cond(&MSCond);
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -377,7 +378,7 @@ New_server_id (void)
|
|||||||
Lock_state();
|
Lock_state();
|
||||||
{
|
{
|
||||||
*id = ++MSId;
|
*id = ++MSId;
|
||||||
I_WakeAllCond(&MSCond);
|
I_wake_all_cond(&MSCond);
|
||||||
}
|
}
|
||||||
Unlock_state();
|
Unlock_state();
|
||||||
return id;
|
return id;
|
||||||
@@ -392,7 +393,7 @@ Register_server_thread (int *id)
|
|||||||
{
|
{
|
||||||
/* wait for previous unlist to finish */
|
/* wait for previous unlist to finish */
|
||||||
while (*id == MSId && MSRegistered)
|
while (*id == MSId && MSRegistered)
|
||||||
I_HoldCond(&MSCond, MSMutex);
|
I_hold_cond(&MSCond, MSMutex);
|
||||||
|
|
||||||
same = ( *id == MSId );/* it could have been a while */
|
same = ( *id == MSId );/* it could have been a while */
|
||||||
}
|
}
|
||||||
@@ -444,7 +445,7 @@ Change_masterserver_thread (char *api)
|
|||||||
Lock_state();
|
Lock_state();
|
||||||
{
|
{
|
||||||
while (MSRegistered)
|
while (MSRegistered)
|
||||||
I_HoldCond(&MSCond, MSMutex);
|
I_hold_cond(&MSCond, MSMutex);
|
||||||
}
|
}
|
||||||
Unlock_state();
|
Unlock_state();
|
||||||
|
|
||||||
@@ -464,9 +465,9 @@ void RegisterServer(void)
|
|||||||
{
|
{
|
||||||
#ifdef MASTERSERVER
|
#ifdef MASTERSERVER
|
||||||
#ifdef HAVE_THREADS
|
#ifdef HAVE_THREADS
|
||||||
(void)!I_SpawnThread(
|
I_spawn_thread(
|
||||||
"register-server",
|
"register-server",
|
||||||
(I_ThreadFn)Register_server_thread,
|
(I_thread_fn)Register_server_thread,
|
||||||
New_server_id()
|
New_server_id()
|
||||||
);
|
);
|
||||||
#else
|
#else
|
||||||
@@ -478,9 +479,9 @@ void RegisterServer(void)
|
|||||||
static void UpdateServer(void)
|
static void UpdateServer(void)
|
||||||
{
|
{
|
||||||
#ifdef HAVE_THREADS
|
#ifdef HAVE_THREADS
|
||||||
(void)!I_SpawnThread(
|
I_spawn_thread(
|
||||||
"update-server",
|
"update-server",
|
||||||
(I_ThreadFn)Update_server_thread,
|
(I_thread_fn)Update_server_thread,
|
||||||
Server_id()
|
Server_id()
|
||||||
);
|
);
|
||||||
#else
|
#else
|
||||||
@@ -492,9 +493,9 @@ void UnregisterServer(void)
|
|||||||
{
|
{
|
||||||
#ifdef MASTERSERVER
|
#ifdef MASTERSERVER
|
||||||
#ifdef HAVE_THREADS
|
#ifdef HAVE_THREADS
|
||||||
(void)!I_SpawnThread(
|
I_spawn_thread(
|
||||||
"unlist-server",
|
"unlist-server",
|
||||||
(I_ThreadFn)Unlist_server_thread,
|
(I_thread_fn)Unlist_server_thread,
|
||||||
Server_id()
|
Server_id()
|
||||||
);
|
);
|
||||||
#else
|
#else
|
||||||
@@ -557,18 +558,14 @@ void MasterClient_Ticker(void)
|
|||||||
static void
|
static void
|
||||||
Set_api (const char *api)
|
Set_api (const char *api)
|
||||||
{
|
{
|
||||||
char *dapi = strdup(api);
|
|
||||||
#ifdef HAVE_THREADS
|
#ifdef HAVE_THREADS
|
||||||
if (!I_SpawnThread(
|
I_spawn_thread(
|
||||||
"change-masterserver",
|
"change-masterserver",
|
||||||
(I_ThreadFn)Change_masterserver_thread,
|
(I_thread_fn)Change_masterserver_thread,
|
||||||
dapi
|
strdup(api)
|
||||||
))
|
);
|
||||||
{
|
|
||||||
free(dapi);
|
|
||||||
}
|
|
||||||
#else
|
#else
|
||||||
Finish_masterserver_change(dapi);
|
Finish_masterserver_change(strdup(api));
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -576,9 +573,9 @@ void
|
|||||||
Get_rules (void)
|
Get_rules (void)
|
||||||
{
|
{
|
||||||
#ifdef HAVE_THREADS
|
#ifdef HAVE_THREADS
|
||||||
(void)!I_SpawnThread(
|
I_spawn_thread(
|
||||||
"get-masterserver-rules",
|
"get-masterserver-rules",
|
||||||
(I_ThreadFn)Get_masterserver_rules_thread,
|
(I_thread_fn)Get_masterserver_rules_thread,
|
||||||
NULL
|
NULL
|
||||||
);
|
);
|
||||||
#else
|
#else
|
||||||
|
|||||||
+2
-2
@@ -69,10 +69,10 @@ extern consvar_t cv_rendezvousserver;
|
|||||||
|
|
||||||
#ifdef HAVE_THREADS
|
#ifdef HAVE_THREADS
|
||||||
extern int ms_QueryId;
|
extern int ms_QueryId;
|
||||||
extern I_Mutex ms_QueryId_mutex;
|
extern I_mutex ms_QueryId_mutex;
|
||||||
|
|
||||||
extern msg_server_t *ms_ServerList;
|
extern msg_server_t *ms_ServerList;
|
||||||
extern I_Mutex ms_ServerList_mutex;
|
extern I_mutex ms_ServerList_mutex;
|
||||||
#endif
|
#endif
|
||||||
#ifdef MASTERSERVER
|
#ifdef MASTERSERVER
|
||||||
void RegisterServer(void);
|
void RegisterServer(void);
|
||||||
|
|||||||
+2
-3
@@ -831,7 +831,7 @@ void P_TouchSpecialThing(mobj_t *special, mobj_t *toucher, boolean heightcheck)
|
|||||||
{
|
{
|
||||||
S_StartSound(toucher, special->info->seesound);
|
S_StartSound(toucher, special->info->seesound);
|
||||||
|
|
||||||
if (player->pflags & PF_NIGHTSMODE)
|
if (UNLIKELY(player->pflags & PF_NIGHTSMODE))
|
||||||
{
|
{
|
||||||
player->bumpertime = TICRATE/2;
|
player->bumpertime = TICRATE/2;
|
||||||
if (special->threshold > 0)
|
if (special->threshold > 0)
|
||||||
@@ -1131,7 +1131,7 @@ void P_TouchSpecialThing(mobj_t *special, mobj_t *toucher, boolean heightcheck)
|
|||||||
S_StartSound(toucher, special->info->painsound);
|
S_StartSound(toucher, special->info->painsound);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
else if (((player->pflags & PF_NIGHTSMODE) && (player->pflags & PF_DRILLING)) || (player->pflags & (PF_JUMPED|PF_SPINNING|PF_GLIDING))
|
else if (UNLIKELY((player->pflags & PF_NIGHTSMODE) && (player->pflags & PF_DRILLING)) || (player->pflags & (PF_JUMPED|PF_SPINNING|PF_GLIDING))
|
||||||
|| player->powers[pw_invulnerability] || player->powers[pw_super]) // Do you possess the ability to subdue the object?
|
|| player->powers[pw_invulnerability] || player->powers[pw_super]) // Do you possess the ability to subdue the object?
|
||||||
{
|
{
|
||||||
// Shatter the shield!
|
// Shatter the shield!
|
||||||
@@ -2420,7 +2420,6 @@ boolean P_DamageMobj(mobj_t *target, mobj_t *inflictor, mobj_t *source, INT32 da
|
|||||||
{
|
{
|
||||||
player->kartstuff[k_sneakertimer] = 0;
|
player->kartstuff[k_sneakertimer] = 0;
|
||||||
K_SpinPlayer(player, source, 1, inflictor, false);
|
K_SpinPlayer(player, source, 1, inflictor, false);
|
||||||
damage = player->mo->health - 1;
|
|
||||||
P_RingDamage(player, inflictor, source);
|
P_RingDamage(player, inflictor, source);
|
||||||
P_PlayerRingBurst(player, 5);
|
P_PlayerRingBurst(player, 5);
|
||||||
|
|
||||||
|
|||||||
@@ -30,8 +30,6 @@ extern "C" {
|
|||||||
|
|
||||||
#define FLOATSPEED (FRACUNIT*4)
|
#define FLOATSPEED (FRACUNIT*4)
|
||||||
|
|
||||||
//#define VIEWHEIGHTS "41"
|
|
||||||
|
|
||||||
// Maximum player score.
|
// Maximum player score.
|
||||||
#define MAXSCORE 999999990
|
#define MAXSCORE 999999990
|
||||||
|
|
||||||
@@ -239,14 +237,10 @@ void P_InstaThrustEvenIn2D(mobj_t *mo, angle_t angle, fixed_t move);
|
|||||||
boolean P_LookForEnemies(player_t *player);
|
boolean P_LookForEnemies(player_t *player);
|
||||||
void P_NukeEnemies(mobj_t *inflictor, mobj_t *source, fixed_t radius);
|
void P_NukeEnemies(mobj_t *inflictor, mobj_t *source, fixed_t radius);
|
||||||
void P_HomingAttack(mobj_t *source, mobj_t *enemy); /// \todo doesn't belong in p_user
|
void P_HomingAttack(mobj_t *source, mobj_t *enemy); /// \todo doesn't belong in p_user
|
||||||
//boolean P_SuperReady(player_t *player);
|
|
||||||
boolean P_AnalogMove(player_t *player);
|
boolean P_AnalogMove(player_t *player);
|
||||||
/*boolean P_TransferToNextMare(player_t *player);
|
|
||||||
UINT8 P_FindLowestMare(void);*/
|
|
||||||
UINT8 P_FindLowestLap(void);
|
UINT8 P_FindLowestLap(void);
|
||||||
UINT8 P_FindHighestLap(void);
|
UINT8 P_FindHighestLap(void);
|
||||||
void P_FindEmerald(void);
|
void P_FindEmerald(void);
|
||||||
//void P_TransferToAxis(player_t *player, INT32 axisnum);
|
|
||||||
boolean P_PlayerMoving(INT32 pnum);
|
boolean P_PlayerMoving(INT32 pnum);
|
||||||
void P_Telekinesis(player_t *player, fixed_t thrust, fixed_t range);
|
void P_Telekinesis(player_t *player, fixed_t thrust, fixed_t range);
|
||||||
|
|
||||||
|
|||||||
+14
-14
@@ -335,7 +335,7 @@ static boolean P_SetPrecipMobjState(precipmobj_t *mobj, statenum_t state)
|
|||||||
mobj->tics = st->tics;
|
mobj->tics = st->tics;
|
||||||
mobj->sprite = st->sprite;
|
mobj->sprite = st->sprite;
|
||||||
mobj->frame = st->frame;
|
mobj->frame = st->frame;
|
||||||
mobj->anim_duration = (UINT16)st->var2; // only used if FF_ANIMATE is set
|
//mobj->anim_duration = (UINT16)st->var2; // only used if FF_ANIMATE is set
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
@@ -919,12 +919,7 @@ static void P_PlayerFlip(mobj_t *mo)
|
|||||||
G_GhostAddFlip((INT32) (mo->player - players));
|
G_GhostAddFlip((INT32) (mo->player - players));
|
||||||
// Flip aiming to match!
|
// Flip aiming to match!
|
||||||
|
|
||||||
if (UNLIKELY(mo->player->pflags & PF_NIGHTSMODE)) // NiGHTS doesn't use flipcam
|
if (mo->player->pflags & PF_FLIPCAM)
|
||||||
{
|
|
||||||
if (mo->tracer)
|
|
||||||
mo->tracer->eflags ^= MFE_VERTICALFLIP;
|
|
||||||
}
|
|
||||||
else if (mo->player->pflags & PF_FLIPCAM)
|
|
||||||
{
|
{
|
||||||
UINT8 i;
|
UINT8 i;
|
||||||
|
|
||||||
@@ -946,6 +941,11 @@ static void P_PlayerFlip(mobj_t *mo)
|
|||||||
camera[i].z += FixedMul(20*FRACUNIT, mo->scale);
|
camera[i].z += FixedMul(20*FRACUNIT, mo->scale);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
else if (UNLIKELY(mo->player->pflags & PF_NIGHTSMODE)) // NiGHTS doesn't use flipcam
|
||||||
|
{
|
||||||
|
if (mo->tracer)
|
||||||
|
mo->tracer->eflags ^= MFE_VERTICALFLIP;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
@@ -3252,7 +3252,7 @@ void P_CalcChasePostImg(player_t *player, camera_t *thiscam)
|
|||||||
player_flipcam = cv_flipcam[pnum].value;
|
player_flipcam = cv_flipcam[pnum].value;
|
||||||
}
|
}
|
||||||
|
|
||||||
const boolean flipcam = (player_flipcam && !(player->pflags & PF_NIGHTSMODE) && player->mo->eflags & MFE_VERTICALFLIP);
|
const boolean flipcam = (player_flipcam && player->mo->eflags & MFE_VERTICALFLIP && LIKELY(!(player->pflags & PF_NIGHTSMODE)));
|
||||||
UINT8 postimgtype = 0;
|
UINT8 postimgtype = 0;
|
||||||
|
|
||||||
if (encoremode)
|
if (encoremode)
|
||||||
@@ -3620,7 +3620,7 @@ boolean P_PrecipThinker(precipmobj_t *mobj)
|
|||||||
mobj->lastThink = leveltime;
|
mobj->lastThink = leveltime;
|
||||||
|
|
||||||
R_ResetPrecipitationMobjInterpolationState(mobj);
|
R_ResetPrecipitationMobjInterpolationState(mobj);
|
||||||
P_CycleStateAnimation((mobj_t *)mobj);
|
//P_CycleStateAnimation((mobj_t *)mobj); // if we ever want animated precip, readd a specific function which does not need casting
|
||||||
|
|
||||||
if (mobj->state == &states[S_RAINRETURN])
|
if (mobj->state == &states[S_RAINRETURN])
|
||||||
{
|
{
|
||||||
@@ -6986,7 +6986,7 @@ static boolean P_MobjDeadThink(mobj_t *mobj)
|
|||||||
fixed_t ns;
|
fixed_t ns;
|
||||||
mobj_t *mo2;
|
mobj_t *mo2;
|
||||||
|
|
||||||
i = P_RandomByte();
|
i = P_RandomByte(); // grrrrrr
|
||||||
z = mobj->subsector->sector->floorheight + ((P_RandomByte()&63)*FRACUNIT);
|
z = mobj->subsector->sector->floorheight + ((P_RandomByte()&63)*FRACUNIT);
|
||||||
|
|
||||||
for (j = 0; j < 2; j++)
|
for (j = 0; j < 2; j++)
|
||||||
@@ -8553,7 +8553,7 @@ static boolean P_MobjRegularThink(mobj_t *mobj)
|
|||||||
|
|
||||||
if (mobj->tracer && mobj->tracer->player)
|
if (mobj->tracer && mobj->tracer->player)
|
||||||
{
|
{
|
||||||
if (!(mobj->tracer->player->pflags & PF_NIGHTSMODE))
|
if (LIKELY(!(mobj->tracer->player->pflags & PF_NIGHTSMODE)))
|
||||||
{
|
{
|
||||||
mobj->flags &= ~MF_NOGRAVITY;
|
mobj->flags &= ~MF_NOGRAVITY;
|
||||||
mobj->flags2 &= ~MF2_DONTDRAW;
|
mobj->flags2 &= ~MF2_DONTDRAW;
|
||||||
@@ -8577,7 +8577,7 @@ static boolean P_MobjRegularThink(mobj_t *mobj)
|
|||||||
P_SetTarget(&mobj->target, NULL);
|
P_SetTarget(&mobj->target, NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (mobj->tracer->player->pflags & PF_NIGHTSMODE)
|
if (UNLIKELY(mobj->tracer->player->pflags & PF_NIGHTSMODE))
|
||||||
{
|
{
|
||||||
if (mobj->tracer->player->bonustime)
|
if (mobj->tracer->player->bonustime)
|
||||||
{
|
{
|
||||||
@@ -10034,7 +10034,7 @@ static precipmobj_t *P_SpawnPrecipMobj(fixed_t x, fixed_t y, fixed_t z, mobjtype
|
|||||||
|
|
||||||
mobj->x = x;
|
mobj->x = x;
|
||||||
mobj->y = y;
|
mobj->y = y;
|
||||||
mobj->flags = info->flags;
|
//mobj->flags = info->flags;
|
||||||
|
|
||||||
// do not set the state with P_SetMobjState,
|
// do not set the state with P_SetMobjState,
|
||||||
// because action routines can not be called yet
|
// because action routines can not be called yet
|
||||||
@@ -10044,7 +10044,7 @@ static precipmobj_t *P_SpawnPrecipMobj(fixed_t x, fixed_t y, fixed_t z, mobjtype
|
|||||||
mobj->tics = st->tics;
|
mobj->tics = st->tics;
|
||||||
mobj->sprite = st->sprite;
|
mobj->sprite = st->sprite;
|
||||||
mobj->frame = st->frame; // FF_FRAMEMASK for frame, and other bits..
|
mobj->frame = st->frame; // FF_FRAMEMASK for frame, and other bits..
|
||||||
mobj->anim_duration = (UINT16)st->var2; // only used if FF_ANIMATE is set
|
//mobj->anim_duration = (UINT16)st->var2; // only used if FF_ANIMATE is set
|
||||||
|
|
||||||
// set subsector and/or block links
|
// set subsector and/or block links
|
||||||
P_SetPrecipitationThingPosition(mobj);
|
P_SetPrecipitationThingPosition(mobj);
|
||||||
|
|||||||
+2
-5
@@ -444,12 +444,10 @@ typedef struct precipmobj_s
|
|||||||
// More drawing info: to determine current sprite.
|
// More drawing info: to determine current sprite.
|
||||||
spritenum_t sprite; // used to find patch_t and flip value
|
spritenum_t sprite; // used to find patch_t and flip value
|
||||||
UINT32 frame; // frame number, plus bits see p_pspr.h
|
UINT32 frame; // frame number, plus bits see p_pspr.h
|
||||||
UINT16 anim_duration; // for FF_ANIMATE states
|
//UINT16 anim_duration; // for FF_ANIMATE states
|
||||||
|
|
||||||
INT16 lightlevel; // Add to sector lightlevel, -255 - 255
|
INT16 lightlevel; // Add to sector lightlevel, -255 - 255
|
||||||
|
|
||||||
struct mprecipsecnode_s *touching_sectorlist; // a linked list of sectors where this object appears
|
|
||||||
|
|
||||||
struct subsector_s *subsector; // Subsector the mobj resides in.
|
struct subsector_s *subsector; // Subsector the mobj resides in.
|
||||||
|
|
||||||
// The closest interval over all contacted sectors (or things).
|
// The closest interval over all contacted sectors (or things).
|
||||||
@@ -458,11 +456,10 @@ typedef struct precipmobj_s
|
|||||||
|
|
||||||
// Momentums, used to update position.
|
// Momentums, used to update position.
|
||||||
fixed_t momx, momy, momz;
|
fixed_t momx, momy, momz;
|
||||||
fixed_t precipflags; // fixed_t so it uses the same spot as "pmomz" even as we use precipflags_t for it
|
precipflag_t precipflags;
|
||||||
|
|
||||||
state_t *state;
|
state_t *state;
|
||||||
INT32 tics; // state tic counter
|
INT32 tics; // state tic counter
|
||||||
UINT32 flags; // flags from mobjinfo tables
|
|
||||||
tic_t lastThink;
|
tic_t lastThink;
|
||||||
} precipmobj_t;
|
} precipmobj_t;
|
||||||
|
|
||||||
|
|||||||
+19
-22
@@ -1702,7 +1702,7 @@ void P_SwitchWeather(INT32 weathernum)
|
|||||||
|
|
||||||
precipmobj->type = type; // proper set the type
|
precipmobj->type = type; // proper set the type
|
||||||
precipmobj->info = &mobjinfo[type];
|
precipmobj->info = &mobjinfo[type];
|
||||||
precipmobj->flags = mobjinfo[type].flags;
|
//precipmobj->flags = mobjinfo[type].flags;
|
||||||
|
|
||||||
st = &states[mobjinfo[type].spawnstate+z];
|
st = &states[mobjinfo[type].spawnstate+z];
|
||||||
|
|
||||||
@@ -3161,11 +3161,6 @@ void P_ProcessSpecialSector(player_t *player, sector_t *sector, sector_t *rovers
|
|||||||
INT32 section1, section2, section3, section4;
|
INT32 section1, section2, section3, section4;
|
||||||
INT32 special;
|
INT32 special;
|
||||||
|
|
||||||
section1 = GETSECSPECIAL(sector->special, 1);
|
|
||||||
section2 = GETSECSPECIAL(sector->special, 2);
|
|
||||||
section3 = GETSECSPECIAL(sector->special, 3);
|
|
||||||
section4 = GETSECSPECIAL(sector->special, 4);
|
|
||||||
|
|
||||||
// Ignore spectators
|
// Ignore spectators
|
||||||
if (player->spectator)
|
if (player->spectator)
|
||||||
return;
|
return;
|
||||||
@@ -3176,6 +3171,11 @@ void P_ProcessSpecialSector(player_t *player, sector_t *sector, sector_t *rovers
|
|||||||
if (player->playerstate == PST_DEAD)
|
if (player->playerstate == PST_DEAD)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
section1 = GETSECSPECIAL(sector->special, 1);
|
||||||
|
section2 = GETSECSPECIAL(sector->special, 2);
|
||||||
|
section3 = GETSECSPECIAL(sector->special, 3);
|
||||||
|
section4 = GETSECSPECIAL(sector->special, 4);
|
||||||
|
|
||||||
// Conveyor stuff
|
// Conveyor stuff
|
||||||
if (section3 == 2 || section3 == 4)
|
if (section3 == 2 || section3 == 4)
|
||||||
player->onconveyor = section3;
|
player->onconveyor = section3;
|
||||||
@@ -4381,8 +4381,6 @@ static void P_PlayerOnSpecial3DFloor(player_t *player, sector_t *sector)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#define VDOORSPEED (FRACUNIT*2)
|
|
||||||
|
|
||||||
//
|
//
|
||||||
// P_RunSpecialSectorCheck
|
// P_RunSpecialSectorCheck
|
||||||
//
|
//
|
||||||
@@ -4401,7 +4399,7 @@ static void P_RunSpecialSectorCheck(player_t *player, sector_t *sector)
|
|||||||
|
|
||||||
// The list of specials that activate without floor touch
|
// The list of specials that activate without floor touch
|
||||||
// Check Section 1
|
// Check Section 1
|
||||||
switch(GETSECSPECIAL(sector->special, 1))
|
switch (GETSECSPECIAL(sector->special, 1))
|
||||||
{
|
{
|
||||||
//case 2: // Damage (water)
|
//case 2: // Damage (water)
|
||||||
case 8: // Instant kill
|
case 8: // Instant kill
|
||||||
@@ -4412,7 +4410,7 @@ static void P_RunSpecialSectorCheck(player_t *player, sector_t *sector)
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Check Section 2
|
// Check Section 2
|
||||||
switch(GETSECSPECIAL(sector->special, 2))
|
switch (GETSECSPECIAL(sector->special, 2))
|
||||||
{
|
{
|
||||||
case 2: // Linedef executor (All players needed)
|
case 2: // Linedef executor (All players needed)
|
||||||
case 4: // Linedef executor
|
case 4: // Linedef executor
|
||||||
@@ -4423,7 +4421,7 @@ static void P_RunSpecialSectorCheck(player_t *player, sector_t *sector)
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Check Section 4
|
// Check Section 4
|
||||||
switch(GETSECSPECIAL(sector->special, 4))
|
switch (GETSECSPECIAL(sector->special, 4))
|
||||||
{
|
{
|
||||||
case 2: // Level Exit / GOAL Sector / Flag Return
|
case 2: // Level Exit / GOAL Sector / Flag Return
|
||||||
case 1: // Starpost activator
|
case 1: // Starpost activator
|
||||||
@@ -4512,9 +4510,7 @@ void P_UpdateSpecials(void)
|
|||||||
{
|
{
|
||||||
anim_t *anim;
|
anim_t *anim;
|
||||||
INT32 i;
|
INT32 i;
|
||||||
INT32 pic;
|
|
||||||
size_t j;
|
size_t j;
|
||||||
|
|
||||||
levelflat_t *foundflats; // for flat animation
|
levelflat_t *foundflats; // for flat animation
|
||||||
|
|
||||||
// LEVEL TIMER
|
// LEVEL TIMER
|
||||||
@@ -4532,9 +4528,11 @@ void P_UpdateSpecials(void)
|
|||||||
{
|
{
|
||||||
for (i = 0; i < anim->numpics; i++)
|
for (i = 0; i < anim->numpics; i++)
|
||||||
{
|
{
|
||||||
pic = anim->basepic + ((leveltime/anim->speed + i) % anim->numpics);
|
|
||||||
if (anim->istexture)
|
if (anim->istexture)
|
||||||
texturetranslation[anim->basepic+i] = pic;
|
{
|
||||||
|
texturetranslation[anim->basepic+i] = anim->basepic +
|
||||||
|
((leveltime/anim->speed + i) % anim->numpics);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -4629,8 +4627,8 @@ static ffloor_t *P_AddFakeFloor(sector_t *sec, sector_t *sec2, line_t *master, f
|
|||||||
|
|
||||||
if (sec2->numattached == 0)
|
if (sec2->numattached == 0)
|
||||||
{
|
{
|
||||||
sec2->attached = Z_Malloc(sizeof (*sec2->attached) * sec2->maxattached, PU_STATIC, NULL);
|
sec2->attached = Z_Malloc(sizeof(*sec2->attached) * sec2->maxattached, PU_STATIC, NULL);
|
||||||
sec2->attachedsolid = Z_Malloc(sizeof (*sec2->attachedsolid) * sec2->maxattached, PU_STATIC, NULL);
|
sec2->attachedsolid = Z_Malloc(sizeof(*sec2->attachedsolid) * sec2->maxattached, PU_STATIC, NULL);
|
||||||
sec2->attached[0] = sec - sectors;
|
sec2->attached[0] = sec - sectors;
|
||||||
sec2->numattached = 1;
|
sec2->numattached = 1;
|
||||||
sec2->attachedsolid[0] = (flags & FF_SOLID);
|
sec2->attachedsolid[0] = (flags & FF_SOLID);
|
||||||
@@ -4644,8 +4642,8 @@ static ffloor_t *P_AddFakeFloor(sector_t *sec, sector_t *sec2, line_t *master, f
|
|||||||
if (sec2->numattached >= sec2->maxattached)
|
if (sec2->numattached >= sec2->maxattached)
|
||||||
{
|
{
|
||||||
sec2->maxattached *= 2;
|
sec2->maxattached *= 2;
|
||||||
sec2->attached = Z_Realloc(sec2->attached, sizeof (*sec2->attached) * sec2->maxattached, PU_STATIC, NULL);
|
sec2->attached = Z_Realloc(sec2->attached, sizeof(*sec2->attached) * sec2->maxattached, PU_STATIC, NULL);
|
||||||
sec2->attachedsolid = Z_Realloc(sec2->attachedsolid, sizeof (*sec2->attachedsolid) * sec2->maxattached, PU_STATIC, NULL);
|
sec2->attachedsolid = Z_Realloc(sec2->attachedsolid, sizeof(*sec2->attachedsolid) * sec2->maxattached, PU_STATIC, NULL);
|
||||||
}
|
}
|
||||||
sec2->attached[sec2->numattached] = sec - sectors;
|
sec2->attached[sec2->numattached] = sec - sectors;
|
||||||
sec2->attachedsolid[sec2->numattached] = (flags & FF_SOLID);
|
sec2->attachedsolid[sec2->numattached] = (flags & FF_SOLID);
|
||||||
@@ -4653,7 +4651,7 @@ static ffloor_t *P_AddFakeFloor(sector_t *sec, sector_t *sec2, line_t *master, f
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Add the floor
|
// Add the floor
|
||||||
ffloor = Z_Calloc(sizeof (*ffloor), PU_LEVEL, NULL);
|
ffloor = Z_Calloc(sizeof(*ffloor), PU_LEVEL, NULL);
|
||||||
ffloor->secnum = sec2 - sectors;
|
ffloor->secnum = sec2 - sectors;
|
||||||
ffloor->target = sec;
|
ffloor->target = sec;
|
||||||
ffloor->bottomheight = &sec2->floorheight;
|
ffloor->bottomheight = &sec2->floorheight;
|
||||||
@@ -5468,7 +5466,6 @@ void P_SpawnSpecials(INT32 fromnetsave, boolean reloadinggamestate)
|
|||||||
break;
|
break;
|
||||||
|
|
||||||
case 10: // Vertical culling plane for sprites and FOFs
|
case 10: // Vertical culling plane for sprites and FOFs
|
||||||
sec = sides[*lines[i].sidenum].sector - sectors;
|
|
||||||
for (s = -1; (s = P_FindSectorFromLineTag(lines + i, s)) >= 0 ;)
|
for (s = -1; (s = P_FindSectorFromLineTag(lines + i, s)) >= 0 ;)
|
||||||
sectors[s].cullheight = &lines[i]; // This allows it to change in realtime!
|
sectors[s].cullheight = &lines[i]; // This allows it to change in realtime!
|
||||||
break;
|
break;
|
||||||
@@ -5989,7 +5986,7 @@ void P_SpawnSpecials(INT32 fromnetsave, boolean reloadinggamestate)
|
|||||||
if (!virt)
|
if (!virt)
|
||||||
virt = vres_GetMap(lastloadedmaplumpnum);
|
virt = vres_GetMap(lastloadedmaplumpnum);
|
||||||
|
|
||||||
data = (UINT8*) vres_Find(virt, "SIDEDEFS")->data;
|
data = (UINT8*)vres_Find(virt, "SIDEDEFS")->data;
|
||||||
|
|
||||||
for (b = 0; b < (INT16)numsides; b++)
|
for (b = 0; b < (INT16)numsides; b++)
|
||||||
{
|
{
|
||||||
|
|||||||
+4
-3
@@ -728,11 +728,12 @@ void P_Ticker(boolean run)
|
|||||||
|
|
||||||
if (cv_recordmultiplayerdemos.value)
|
if (cv_recordmultiplayerdemos.value)
|
||||||
{
|
{
|
||||||
const INT32 axis = JoyAxis(AXISLOOKBACK, 1);
|
|
||||||
|
|
||||||
if (demo.savemode == DSM_NOTSAVING || demo.savemode == DSM_WILLAUTOSAVE)
|
if (demo.savemode == DSM_NOTSAVING || demo.savemode == DSM_WILLAUTOSAVE)
|
||||||
if (demo.savebutton && demo.savebutton + 3*TICRATE < leveltime && (InputDown(gc_lookback, 1) || (cv_usejoystick[0].value && axis > 0)))
|
{
|
||||||
|
const INT32 axis = cv_usejoystick[0].value ? JoyAxis(AXISLOOKBACK, 1) : -1;
|
||||||
|
if (demo.savebutton && demo.savebutton + 3*TICRATE < leveltime && (InputDown(gc_lookback, 1) || (axis > 0)))
|
||||||
demo.savemode = DSM_TITLEENTRY;
|
demo.savemode = DSM_TITLEENTRY;
|
||||||
|
}
|
||||||
|
|
||||||
// if there are no players left at all, stop demo recording
|
// if there are no players left at all, stop demo recording
|
||||||
// Demos that that dont have any players crash during playback, which can happen with dedicated servers
|
// Demos that that dont have any players crash during playback, which can happen with dedicated servers
|
||||||
|
|||||||
+2
-13
@@ -1822,7 +1822,6 @@ void P_DoJumpShield(player_t *player)
|
|||||||
|
|
||||||
player->pflags &= ~PF_JUMPED;
|
player->pflags &= ~PF_JUMPED;
|
||||||
//P_DoJump(player, false);
|
//P_DoJump(player, false);
|
||||||
player->pflags &= ~PF_JUMPED;
|
|
||||||
player->secondjump = 0;
|
player->secondjump = 0;
|
||||||
player->jumping = 0;
|
player->jumping = 0;
|
||||||
player->pflags |= PF_THOKKED;
|
player->pflags |= PF_THOKKED;
|
||||||
@@ -1894,7 +1893,6 @@ static void P_3dMovement(player_t *player)
|
|||||||
ticcmd_t *cmd;
|
ticcmd_t *cmd;
|
||||||
angle_t movepushangle, movepushsideangle; // Analog
|
angle_t movepushangle, movepushsideangle; // Analog
|
||||||
fixed_t movepushforward = 0, movepushside = 0;
|
fixed_t movepushforward = 0, movepushside = 0;
|
||||||
angle_t dangle; // replaces old quadrants bits
|
|
||||||
boolean analogmove = false;
|
boolean analogmove = false;
|
||||||
fixed_t oldMagnitude, newMagnitude;
|
fixed_t oldMagnitude, newMagnitude;
|
||||||
vector3_t totalthrust;
|
vector3_t totalthrust;
|
||||||
@@ -1952,15 +1950,6 @@ static void P_3dMovement(player_t *player)
|
|||||||
// Calculates player's speed based on distance-of-a-line formula
|
// Calculates player's speed based on distance-of-a-line formula
|
||||||
player->speed = R_PointToDist2(0, 0, player->rmomx, player->rmomy);
|
player->speed = R_PointToDist2(0, 0, player->rmomx, player->rmomy);
|
||||||
|
|
||||||
// Monster Iestyn - 04-11-13
|
|
||||||
// Quadrants are stupid, excessive and broken, let's do this a much simpler way!
|
|
||||||
// Get delta angle from rmom angle and player angle first
|
|
||||||
dangle = R_PointToAngle2(0,0, player->rmomx, player->rmomy) - player->mo->angle;
|
|
||||||
if (dangle > ANGLE_180) //flip to keep to one side
|
|
||||||
{
|
|
||||||
dangle = InvAngle(dangle);
|
|
||||||
}
|
|
||||||
|
|
||||||
// When sliding, don't allow forward/back
|
// When sliding, don't allow forward/back
|
||||||
if (player->pflags & PF_SLIDING)
|
if (player->pflags & PF_SLIDING)
|
||||||
cmd->forwardmove = 0;
|
cmd->forwardmove = 0;
|
||||||
@@ -4120,7 +4109,7 @@ boolean P_MoveChaseCamera(player_t *player, camera_t *thiscam, boolean resetcall
|
|||||||
angle -= (angle - thiscam->pitch)/2;
|
angle -= (angle - thiscam->pitch)/2;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (player->playerstate != PST_DEAD && !((player->pflags & PF_NIGHTSMODE) && player->exiting))
|
if (player->playerstate != PST_DEAD && LIKELY(!((player->pflags & PF_NIGHTSMODE) && player->exiting)))
|
||||||
angle += (focusaiming < ANGLE_180 ? focusaiming/2 : InvAngle(InvAngle(focusaiming)/2)); // overcomplicated version of '((signed)focusaiming)/2;'
|
angle += (focusaiming < ANGLE_180 ? focusaiming/2 : InvAngle(InvAngle(focusaiming)/2)); // overcomplicated version of '((signed)focusaiming)/2;'
|
||||||
|
|
||||||
if (!camstill && !timeover) // Keep the view still...
|
if (!camstill && !timeover) // Keep the view still...
|
||||||
@@ -4464,7 +4453,7 @@ static INT32 Quaketilt(player_t *player)
|
|||||||
|
|
||||||
lowb = FixedMul(lowb, player->mo->scale);
|
lowb = FixedMul(lowb, player->mo->scale);
|
||||||
moma = FixedMul(FixedDiv(delta, ANGLE_90), tilt);
|
moma = FixedMul(FixedDiv(delta, ANGLE_90), tilt);
|
||||||
speed = abs( player->mo->momx + player->mo->momy );
|
speed = abs(player->mo->momx + player->mo->momy);
|
||||||
|
|
||||||
if (speed < lowb)
|
if (speed < lowb)
|
||||||
{
|
{
|
||||||
|
|||||||
+3
-10
@@ -289,14 +289,8 @@ void R_GenerateBlendTables(void)
|
|||||||
state->LocalPalette = static_cast<RGBA_t *>(memcpy(malloc(palsize), pLocalPalette, palsize));
|
state->LocalPalette = static_cast<RGBA_t *>(memcpy(malloc(palsize), pLocalPalette, palsize));
|
||||||
state->gammaCorrectedPalette = static_cast<RGBA_t *>(memcpy(malloc(palsize), pGammaCorrectedPalette, palsize));
|
state->gammaCorrectedPalette = static_cast<RGBA_t *>(memcpy(malloc(palsize), pGammaCorrectedPalette, palsize));
|
||||||
|
|
||||||
if (!I_SpawnThread("blend-tables",
|
I_spawn_thread("blend-tables",
|
||||||
R_GenerateBlendTables_Thread, state))
|
R_GenerateBlendTables_Thread, state);
|
||||||
{
|
|
||||||
free(state->gammaCorrectedPalette);
|
|
||||||
free(state->LocalPalette);
|
|
||||||
free(state);
|
|
||||||
I_Error("R_GenerateBlendTables: Failed to generate BlendTables\n"); // should we just retry on main thread instead?
|
|
||||||
}
|
|
||||||
#else
|
#else
|
||||||
struct GenerateBlendTables_State state = {pLocalPalette, pGammaCorrectedPalette};
|
struct GenerateBlendTables_State state = {pLocalPalette, pGammaCorrectedPalette};
|
||||||
R_GenerateBlendTables_Core(&state);
|
R_GenerateBlendTables_Core(&state);
|
||||||
@@ -443,8 +437,7 @@ UINT8* R_GetTranslationColormap(INT32 skinnum, skincolors_t color, UINT8 flags)
|
|||||||
|
|
||||||
UINT8* R_GetLocalTranslationColormap(skin_t *skin, skin_t *localskin, skincolors_t color, UINT8 flags, boolean local)
|
UINT8* R_GetLocalTranslationColormap(skin_t *skin, skin_t *localskin, skincolors_t color, UINT8 flags, boolean local)
|
||||||
{
|
{
|
||||||
const INT32 skinnum = localskin ? (localskin - K_GetSkinArray(local)) : (skin - skins);
|
return RGetTranslationColormap(K_GetMobjLocalSkinNum(skin, localskin, local), color, flags, (localskin && local));
|
||||||
return RGetTranslationColormap(skinnum, color, flags, (localskin && local));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
patch_t* R_GetSkinFaceRank(player_t* ply)
|
patch_t* R_GetSkinFaceRank(player_t* ply)
|
||||||
|
|||||||
+4
-4
@@ -280,22 +280,22 @@ static void Fov_OnChange(void)
|
|||||||
|
|
||||||
static void FlipCam_OnChange(void)
|
static void FlipCam_OnChange(void)
|
||||||
{
|
{
|
||||||
SendWeaponPref();
|
SendWeaponPref(0);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void FlipCam2_OnChange(void)
|
static void FlipCam2_OnChange(void)
|
||||||
{
|
{
|
||||||
SendWeaponPref2();
|
SendWeaponPref(1);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void FlipCam3_OnChange(void)
|
static void FlipCam3_OnChange(void)
|
||||||
{
|
{
|
||||||
SendWeaponPref3();
|
SendWeaponPref(2);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void FlipCam4_OnChange(void)
|
static void FlipCam4_OnChange(void)
|
||||||
{
|
{
|
||||||
SendWeaponPref4();
|
SendWeaponPref(3);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void Precipstuff_OnChange(void)
|
static void Precipstuff_OnChange(void)
|
||||||
|
|||||||
@@ -92,6 +92,7 @@ INT32 R_LocalSkinAvailable(const char *name, boolean local);
|
|||||||
// had to move those here Zzz...
|
// had to move those here Zzz...
|
||||||
INT32 K_GetSkinNum(player_t *player);
|
INT32 K_GetSkinNum(player_t *player);
|
||||||
INT32 K_GetMobjSkinNum(const skin_t *skin, boolean local);
|
INT32 K_GetMobjSkinNum(const skin_t *skin, boolean local);
|
||||||
|
INT32 K_GetMobjLocalSkinNum(const skin_t *skin, const skin_t *localskin, boolean local);
|
||||||
skin_t *K_GetPlayerSkin(player_t *player);
|
skin_t *K_GetPlayerSkin(player_t *player);
|
||||||
skin_t *K_GetMobjSkin(const mobj_t *mobj);
|
skin_t *K_GetMobjSkin(const mobj_t *mobj);
|
||||||
patch_t *K_GetFacePrefix(player_t *player, INT32 skinnum);
|
patch_t *K_GetFacePrefix(player_t *player, INT32 skinnum);
|
||||||
|
|||||||
@@ -1855,9 +1855,6 @@ static void R_ProjectSprite(mobj_t *thing)
|
|||||||
|
|
||||||
if (thing->subsector->sector->numlights)
|
if (thing->subsector->sector->numlights)
|
||||||
R_SplitSprite(vis);
|
R_SplitSprite(vis);
|
||||||
|
|
||||||
// Debug
|
|
||||||
++objectsdrawn;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static void R_ProjectPrecipitationSprite(precipmobj_t *thing)
|
static void R_ProjectPrecipitationSprite(precipmobj_t *thing)
|
||||||
|
|||||||
+1
-2
@@ -473,13 +473,12 @@ void S_StartSoundAtVolume(const void *origin_p, sfxenum_t sfx_id, INT32 volume)
|
|||||||
return;
|
return;
|
||||||
|
|
||||||
memset(listener, 0, sizeof(listener));
|
memset(listener, 0, sizeof(listener));
|
||||||
|
memset(listenmobj, 0, sizeof(listenmobj));
|
||||||
|
|
||||||
for (i = 0; i <= splitscreen; i++)
|
for (i = 0; i <= splitscreen; i++)
|
||||||
{
|
{
|
||||||
player_t *player = &players[displayplayers[i]];
|
player_t *player = &players[displayplayers[i]];
|
||||||
|
|
||||||
listenmobj[i] = NULL;
|
|
||||||
|
|
||||||
if (player->awayviewtics)
|
if (player->awayviewtics)
|
||||||
{
|
{
|
||||||
listenmobj[i] = player->awayviewmobj;
|
listenmobj[i] = player->awayviewmobj;
|
||||||
|
|||||||
@@ -35,6 +35,7 @@ set(SRB2_SDL2_SOURCES
|
|||||||
i_system.cpp
|
i_system.cpp
|
||||||
i_ttf.c
|
i_ttf.c
|
||||||
i_video.c
|
i_video.c
|
||||||
|
i_threads.c
|
||||||
#IMG_xpm.c
|
#IMG_xpm.c
|
||||||
ogl_sdl.c
|
ogl_sdl.c
|
||||||
|
|
||||||
|
|||||||
+20
-22
@@ -1577,7 +1577,7 @@ static void write_backtrace(bt_crash_reason_t reason)
|
|||||||
static std::thread::id g_main_thread_id;
|
static std::thread::id g_main_thread_id;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
boolean g_in_exiting_signal_handler = false;
|
static volatile sig_atomic_t g_in_exiting_signal_handler = false;
|
||||||
|
|
||||||
static void I_PrintSignal(INT32 signal_num, boolean core_dumped, char *signal_msg, char *signal_name)
|
static void I_PrintSignal(INT32 signal_num, boolean core_dumped, char *signal_msg, char *signal_name)
|
||||||
{
|
{
|
||||||
@@ -1712,6 +1712,11 @@ static void I_ReportSignal(int num, int coredumped)
|
|||||||
I_ShowErrorBox(sigttl, sigmsg);
|
I_ShowErrorBox(sigttl, sigmsg);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
boolean I_In_Exiting_Signal_Handler(void)
|
||||||
|
{
|
||||||
|
return g_in_exiting_signal_handler;
|
||||||
|
}
|
||||||
|
|
||||||
#ifndef NEWSIGNALHANDLER
|
#ifndef NEWSIGNALHANDLER
|
||||||
FUNCNORETURN static ATTRNORETURN void signal_handler(INT32 num)
|
FUNCNORETURN static ATTRNORETURN void signal_handler(INT32 num)
|
||||||
{
|
{
|
||||||
@@ -1741,21 +1746,17 @@ FUNCNORETURN static ATTRNORETURN void signal_handler(INT32 num)
|
|||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
FUNCNORETURN static ATTRNORETURN void quit_handler(int num)
|
static volatile sig_atomic_t interrupted = false;
|
||||||
{
|
|
||||||
#ifdef HAVE_THREADS
|
|
||||||
if (g_main_thread_id != std::this_thread::get_id())
|
|
||||||
{
|
|
||||||
// Do not attempt any sort of recovery if this signal triggers off the main thread
|
|
||||||
signal(num, SIG_DFL);
|
|
||||||
raise(num);
|
|
||||||
exit(-2);
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
signal(num, SIG_DFL); //default signal action
|
boolean I_Interrupted(void)
|
||||||
raise(num);
|
{
|
||||||
I_Quit();
|
return interrupted;
|
||||||
|
}
|
||||||
|
|
||||||
|
static void quit_handler(int num)
|
||||||
|
{
|
||||||
|
(void)num;
|
||||||
|
interrupted = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void I_RegisterSignals(void)
|
static void I_RegisterSignals(void)
|
||||||
@@ -1841,18 +1842,15 @@ static void I_Fork(void)
|
|||||||
I_RegisterChildSignals();
|
I_RegisterChildSignals();
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
|
#ifdef LOGMESSAGES
|
||||||
if (logstream)
|
if (logstream)
|
||||||
fclose(logstream);/* the child has this */
|
fclose(logstream);/* the child has this */
|
||||||
|
#endif
|
||||||
c = wait(&status);
|
c = wait(&status);
|
||||||
|
|
||||||
#ifdef LOGMESSAGES
|
#ifdef LOGMESSAGES
|
||||||
/* By the way, exit closes files. */
|
/* By the way, exit closes files. */
|
||||||
logstream = fopen(logfilename, "at");
|
logstream = fopen(logfilename, "at");
|
||||||
#else
|
|
||||||
logstream = 0;
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
if (c == -1)
|
if (c == -1)
|
||||||
{
|
{
|
||||||
kill(child, SIGKILL);
|
kill(child, SIGKILL);
|
||||||
@@ -1896,8 +1894,8 @@ INT32 I_StartupSystem(void)
|
|||||||
I_Fork();
|
I_Fork();
|
||||||
#endif
|
#endif
|
||||||
#ifdef HAVE_THREADS
|
#ifdef HAVE_THREADS
|
||||||
I_StartThreads();
|
I_start_threads();
|
||||||
I_AddExitFunc(I_StopThreads);
|
I_AddExitFunc(I_stop_threads);
|
||||||
I_ThreadPoolInit();
|
I_ThreadPoolInit();
|
||||||
I_AddExitFunc(I_ThreadPoolShutdown);
|
I_AddExitFunc(I_ThreadPoolShutdown);
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
@@ -0,0 +1,360 @@
|
|||||||
|
// SONIC ROBO BLAST 2 KART
|
||||||
|
//-----------------------------------------------------------------------------
|
||||||
|
// Copyright (C) 2020 by James R.
|
||||||
|
//
|
||||||
|
// This program is free software distributed under the
|
||||||
|
// terms of the GNU General Public License, version 2.
|
||||||
|
// See the 'LICENSE' file for more details.
|
||||||
|
//-----------------------------------------------------------------------------
|
||||||
|
/// \file i_threads.c
|
||||||
|
/// \brief Multithreading abstraction
|
||||||
|
|
||||||
|
#ifdef HAVE_THREADS
|
||||||
|
|
||||||
|
#include "../doomdef.h"
|
||||||
|
#include "../i_threads.h"
|
||||||
|
|
||||||
|
#include <SDL.h>
|
||||||
|
|
||||||
|
typedef void * (*Create_fn)(void);
|
||||||
|
|
||||||
|
struct Link;
|
||||||
|
struct Thread;
|
||||||
|
|
||||||
|
typedef struct Link * Link;
|
||||||
|
typedef struct Thread * Thread;
|
||||||
|
|
||||||
|
struct Link
|
||||||
|
{
|
||||||
|
void * data;
|
||||||
|
Link next;
|
||||||
|
Link prev;
|
||||||
|
};
|
||||||
|
|
||||||
|
struct Thread
|
||||||
|
{
|
||||||
|
I_thread_fn entry;
|
||||||
|
void * userdata;
|
||||||
|
|
||||||
|
SDL_Thread * thread;
|
||||||
|
};
|
||||||
|
|
||||||
|
static Link i_thread_pool;
|
||||||
|
static Link i_mutex_pool;
|
||||||
|
static Link i_cond_pool;
|
||||||
|
|
||||||
|
static I_mutex i_thread_pool_mutex;
|
||||||
|
static I_mutex i_mutex_pool_mutex;
|
||||||
|
static I_mutex i_cond_pool_mutex;
|
||||||
|
|
||||||
|
static SDL_atomic_t i_threads_running = {1};
|
||||||
|
|
||||||
|
static Link
|
||||||
|
Insert_link (
|
||||||
|
Link * head,
|
||||||
|
Link link
|
||||||
|
){
|
||||||
|
link->prev = NULL;
|
||||||
|
link->next = (*head);
|
||||||
|
if ((*head))
|
||||||
|
(*head)->prev = link;
|
||||||
|
(*head) = link;
|
||||||
|
return link;
|
||||||
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
Free_link (
|
||||||
|
Link * head,
|
||||||
|
Link link
|
||||||
|
){
|
||||||
|
if (link->prev)
|
||||||
|
link->prev->next = link->next;
|
||||||
|
else
|
||||||
|
(*head) = link->next;
|
||||||
|
|
||||||
|
if (link->next)
|
||||||
|
link->next->prev = link->prev;
|
||||||
|
|
||||||
|
free(link->data);
|
||||||
|
free(link);
|
||||||
|
}
|
||||||
|
|
||||||
|
static Link
|
||||||
|
New_link (void *data)
|
||||||
|
{
|
||||||
|
Link link;
|
||||||
|
|
||||||
|
link = malloc(sizeof *link);
|
||||||
|
|
||||||
|
if (! link)
|
||||||
|
abort();
|
||||||
|
|
||||||
|
link->data = data;
|
||||||
|
|
||||||
|
return link;
|
||||||
|
}
|
||||||
|
|
||||||
|
static void *
|
||||||
|
Identity (
|
||||||
|
Link * pool_anchor,
|
||||||
|
I_mutex pool_mutex,
|
||||||
|
|
||||||
|
void ** anchor,
|
||||||
|
|
||||||
|
Create_fn create_fn
|
||||||
|
){
|
||||||
|
void * id;
|
||||||
|
|
||||||
|
id = SDL_AtomicGetPtr(anchor);
|
||||||
|
|
||||||
|
if (! id)
|
||||||
|
{
|
||||||
|
I_lock_mutex(&pool_mutex);
|
||||||
|
{
|
||||||
|
id = SDL_AtomicGetPtr(anchor);
|
||||||
|
|
||||||
|
if (! id)
|
||||||
|
{
|
||||||
|
id = (*create_fn)();
|
||||||
|
|
||||||
|
if (! id)
|
||||||
|
abort();
|
||||||
|
|
||||||
|
Insert_link(pool_anchor, New_link(id));
|
||||||
|
|
||||||
|
SDL_AtomicSetPtr(anchor, id);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
I_unlock_mutex(pool_mutex);
|
||||||
|
}
|
||||||
|
|
||||||
|
return id;
|
||||||
|
}
|
||||||
|
|
||||||
|
static int
|
||||||
|
Worker (
|
||||||
|
Link link
|
||||||
|
){
|
||||||
|
Thread th;
|
||||||
|
|
||||||
|
th = link->data;
|
||||||
|
|
||||||
|
(*th->entry)(th->userdata);
|
||||||
|
|
||||||
|
if (SDL_AtomicGet(&i_threads_running))
|
||||||
|
{
|
||||||
|
I_lock_mutex(&i_thread_pool_mutex);
|
||||||
|
{
|
||||||
|
if (SDL_AtomicGet(&i_threads_running))
|
||||||
|
{
|
||||||
|
SDL_DetachThread(th->thread);
|
||||||
|
Free_link(&i_thread_pool, link);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
I_unlock_mutex(i_thread_pool_mutex);
|
||||||
|
}
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
I_spawn_thread (
|
||||||
|
const char * name,
|
||||||
|
I_thread_fn entry,
|
||||||
|
void * userdata
|
||||||
|
){
|
||||||
|
Link link;
|
||||||
|
Thread th;
|
||||||
|
|
||||||
|
th = malloc(sizeof *th);
|
||||||
|
|
||||||
|
if (! th)
|
||||||
|
abort();/* this is pretty GNU of me */
|
||||||
|
|
||||||
|
th->entry = entry;
|
||||||
|
th->userdata = userdata;
|
||||||
|
|
||||||
|
I_lock_mutex(&i_thread_pool_mutex);
|
||||||
|
{
|
||||||
|
link = Insert_link(&i_thread_pool, New_link(th));
|
||||||
|
|
||||||
|
if (SDL_AtomicGet(&i_threads_running))
|
||||||
|
{
|
||||||
|
th->thread = SDL_CreateThread(
|
||||||
|
(SDL_ThreadFunction)Worker,
|
||||||
|
name,
|
||||||
|
link
|
||||||
|
);
|
||||||
|
|
||||||
|
if (! th->thread)
|
||||||
|
abort();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
I_unlock_mutex(i_thread_pool_mutex);
|
||||||
|
}
|
||||||
|
|
||||||
|
int
|
||||||
|
I_thread_is_stopped (void)
|
||||||
|
{
|
||||||
|
return ( ! SDL_AtomicGet(&i_threads_running) );
|
||||||
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
I_start_threads (void)
|
||||||
|
{
|
||||||
|
i_thread_pool_mutex = SDL_CreateMutex();
|
||||||
|
i_mutex_pool_mutex = SDL_CreateMutex();
|
||||||
|
i_cond_pool_mutex = SDL_CreateMutex();
|
||||||
|
|
||||||
|
if (!(
|
||||||
|
i_thread_pool_mutex &&
|
||||||
|
i_mutex_pool_mutex &&
|
||||||
|
i_cond_pool_mutex
|
||||||
|
)){
|
||||||
|
abort();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
I_stop_threads (void)
|
||||||
|
{
|
||||||
|
Link link;
|
||||||
|
Link next;
|
||||||
|
|
||||||
|
Thread th;
|
||||||
|
SDL_mutex * mutex;
|
||||||
|
SDL_cond * cond;
|
||||||
|
|
||||||
|
if (i_threads_running.value)
|
||||||
|
{
|
||||||
|
/* rely on the good will of thread-san */
|
||||||
|
SDL_AtomicSet(&i_threads_running, 0);
|
||||||
|
|
||||||
|
I_lock_mutex(&i_thread_pool_mutex);
|
||||||
|
{
|
||||||
|
for (
|
||||||
|
link = i_thread_pool;
|
||||||
|
link;
|
||||||
|
link = next
|
||||||
|
){
|
||||||
|
next = link->next;
|
||||||
|
th = link->data;
|
||||||
|
|
||||||
|
SDL_WaitThread(th->thread, NULL);
|
||||||
|
|
||||||
|
free(th);
|
||||||
|
free(link);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
I_unlock_mutex(i_thread_pool_mutex);
|
||||||
|
|
||||||
|
for (
|
||||||
|
link = i_mutex_pool;
|
||||||
|
link;
|
||||||
|
link = next
|
||||||
|
){
|
||||||
|
next = link->next;
|
||||||
|
mutex = link->data;
|
||||||
|
|
||||||
|
SDL_DestroyMutex(mutex);
|
||||||
|
|
||||||
|
free(link);
|
||||||
|
}
|
||||||
|
|
||||||
|
for (
|
||||||
|
link = i_cond_pool;
|
||||||
|
link;
|
||||||
|
link = next
|
||||||
|
){
|
||||||
|
next = link->next;
|
||||||
|
cond = link->data;
|
||||||
|
|
||||||
|
SDL_DestroyCond(cond);
|
||||||
|
|
||||||
|
free(link);
|
||||||
|
}
|
||||||
|
|
||||||
|
SDL_DestroyMutex(i_thread_pool_mutex);
|
||||||
|
SDL_DestroyMutex(i_mutex_pool_mutex);
|
||||||
|
SDL_DestroyMutex(i_cond_pool_mutex);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
I_lock_mutex (
|
||||||
|
I_mutex * anchor
|
||||||
|
){
|
||||||
|
SDL_mutex * mutex;
|
||||||
|
|
||||||
|
mutex = Identity(
|
||||||
|
&i_mutex_pool,
|
||||||
|
i_mutex_pool_mutex,
|
||||||
|
anchor,
|
||||||
|
(Create_fn)SDL_CreateMutex
|
||||||
|
);
|
||||||
|
|
||||||
|
if (SDL_LockMutex(mutex) == -1)
|
||||||
|
abort();
|
||||||
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
I_unlock_mutex (
|
||||||
|
I_mutex id
|
||||||
|
){
|
||||||
|
if (SDL_UnlockMutex(id) == -1)
|
||||||
|
abort();
|
||||||
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
I_hold_cond (
|
||||||
|
I_cond * cond_anchor,
|
||||||
|
I_mutex mutex_id
|
||||||
|
){
|
||||||
|
SDL_cond * cond;
|
||||||
|
|
||||||
|
cond = Identity(
|
||||||
|
&i_cond_pool,
|
||||||
|
i_cond_pool_mutex,
|
||||||
|
cond_anchor,
|
||||||
|
(Create_fn)SDL_CreateCond
|
||||||
|
);
|
||||||
|
|
||||||
|
if (SDL_CondWait(cond, mutex_id) == -1)
|
||||||
|
abort();
|
||||||
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
I_wake_one_cond (
|
||||||
|
I_cond * anchor
|
||||||
|
){
|
||||||
|
SDL_cond * cond;
|
||||||
|
|
||||||
|
cond = Identity(
|
||||||
|
&i_cond_pool,
|
||||||
|
i_cond_pool_mutex,
|
||||||
|
anchor,
|
||||||
|
(Create_fn)SDL_CreateCond
|
||||||
|
);
|
||||||
|
|
||||||
|
if (SDL_CondSignal(cond) == -1)
|
||||||
|
abort();
|
||||||
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
I_wake_all_cond (
|
||||||
|
I_cond * anchor
|
||||||
|
){
|
||||||
|
SDL_cond * cond;
|
||||||
|
|
||||||
|
cond = Identity(
|
||||||
|
&i_cond_pool,
|
||||||
|
i_cond_pool_mutex,
|
||||||
|
anchor,
|
||||||
|
(Create_fn)SDL_CreateCond
|
||||||
|
);
|
||||||
|
|
||||||
|
if (SDL_CondBroadcast(cond) == -1)
|
||||||
|
abort();
|
||||||
|
}
|
||||||
|
|
||||||
|
#endif // HAVE_THREADS
|
||||||
+4
-3
@@ -1164,8 +1164,8 @@ void I_GetEvent(void)
|
|||||||
SDL_GetWindowSize(window, &wwidth, &wheight);
|
SDL_GetWindowSize(window, &wwidth, &wheight);
|
||||||
event.type = ev_mouse;
|
event.type = ev_mouse;
|
||||||
event.data1 = 0;
|
event.data1 = 0;
|
||||||
event.data2 = (INT32)lround(mousemovex * ((float)wwidth / (float)realwidth));
|
event.data2 = (INT32)lroundf(mousemovex * ((float)wwidth / (float)realwidth));
|
||||||
event.data3 = (INT32)lround(mousemovey * ((float)wheight / (float)realheight));
|
event.data3 = (INT32)lroundf(mousemovey * ((float)wheight / (float)realheight));
|
||||||
D_PostEvent(&event);
|
D_PostEvent(&event);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -2027,7 +2027,8 @@ void I_ShutdownGraphics(void)
|
|||||||
SDL_DestroyWindow(window);
|
SDL_DestroyWindow(window);
|
||||||
window = NULL;
|
window = NULL;
|
||||||
|
|
||||||
SDL_QuitSubSystem(SDL_INIT_VIDEO);
|
if (SDL_WasInit(SDL_INIT_VIDEO) == SDL_INIT_VIDEO)
|
||||||
|
SDL_QuitSubSystem(SDL_INIT_VIDEO);
|
||||||
framebuffer = SDL_FALSE;
|
framebuffer = SDL_FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -237,7 +237,8 @@ void I_ShutdownSound(void)
|
|||||||
Mix_Quit();
|
Mix_Quit();
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
SDL_QuitSubSystem(SDL_INIT_AUDIO);
|
if (SDL_WasInit(SDL_INIT_AUDIO) == SDL_INIT_AUDIO)
|
||||||
|
SDL_QuitSubSystem(SDL_INIT_AUDIO);
|
||||||
|
|
||||||
#ifdef HAVE_LIBGME
|
#ifdef HAVE_LIBGME
|
||||||
if (gme)
|
if (gme)
|
||||||
|
|||||||
@@ -52,8 +52,6 @@
|
|||||||
|
|
||||||
#include "r_fps.h"
|
#include "r_fps.h"
|
||||||
|
|
||||||
UINT16 objectsdrawn = 0;
|
|
||||||
|
|
||||||
// dumb fade thing for director toggle
|
// dumb fade thing for director toggle
|
||||||
tic_t directortoggletimer = 0;
|
tic_t directortoggletimer = 0;
|
||||||
|
|
||||||
|
|||||||
@@ -134,8 +134,6 @@ typedef enum
|
|||||||
|
|
||||||
extern hudinfo_t hudinfo[NUMHUDITEMS];
|
extern hudinfo_t hudinfo[NUMHUDITEMS];
|
||||||
|
|
||||||
extern UINT16 objectsdrawn;
|
|
||||||
|
|
||||||
// variable to stop mayonaka static from flickering
|
// variable to stop mayonaka static from flickering
|
||||||
extern consvar_t cv_lessflicker;
|
extern consvar_t cv_lessflicker;
|
||||||
extern consvar_t cv_stagetitle;
|
extern consvar_t cv_stagetitle;
|
||||||
|
|||||||
+1
-1
@@ -455,7 +455,7 @@ static lumpinfo_t* ResGetLumpsWad(FILE* handle, UINT16* nlmp, const char* filena
|
|||||||
header.infotableofs = LONG(header.infotableofs);
|
header.infotableofs = LONG(header.infotableofs);
|
||||||
|
|
||||||
// read wad file directory
|
// read wad file directory
|
||||||
i = header.numlumps * sizeof (*fileinfo);
|
i = header.numlumps * sizeof(*fileinfo);
|
||||||
fileinfov = fileinfo = malloc(i);
|
fileinfov = fileinfo = malloc(i);
|
||||||
|
|
||||||
if (fseek(handle, header.infotableofs, SEEK_SET) == -1
|
if (fseek(handle, header.infotableofs, SEEK_SET) == -1
|
||||||
|
|||||||
@@ -75,8 +75,6 @@ typedef struct memblock_s
|
|||||||
#define MEMORY(x) (void *)((uintptr_t)(x) + sizeof(memblock_t) + ALIGNPAD)
|
#define MEMORY(x) (void *)((uintptr_t)(x) + sizeof(memblock_t) + ALIGNPAD)
|
||||||
#define MEMBLOCK(x) (memblock_t *)((uintptr_t)(x) - ALIGNPAD - sizeof(memblock_t))
|
#define MEMBLOCK(x) (memblock_t *)((uintptr_t)(x) - ALIGNPAD - sizeof(memblock_t))
|
||||||
|
|
||||||
static thread_handle_t main_thread;
|
|
||||||
|
|
||||||
// both the head and tail of the zone memory block list
|
// both the head and tail of the zone memory block list
|
||||||
static memblock_t head;
|
static memblock_t head;
|
||||||
|
|
||||||
@@ -110,7 +108,6 @@ static void Command_Memdump_f(void);
|
|||||||
void Z_Init(void)
|
void Z_Init(void)
|
||||||
{
|
{
|
||||||
size_t total, memfree;
|
size_t total, memfree;
|
||||||
main_thread = I_GetCurrentThread();
|
|
||||||
|
|
||||||
memset(&head, 0x00, sizeof(head));
|
memset(&head, 0x00, sizeof(head));
|
||||||
|
|
||||||
@@ -146,8 +143,6 @@ void Z_Free(void *ptr)
|
|||||||
{
|
{
|
||||||
memblock_t *block;
|
memblock_t *block;
|
||||||
|
|
||||||
I_Assert(I_GetCurrentThread() == main_thread);
|
|
||||||
|
|
||||||
if (ptr == NULL)
|
if (ptr == NULL)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
@@ -242,8 +237,6 @@ void *Z_Malloc(size_t size, INT32 tag, void *user)
|
|||||||
memblock_t *block;
|
memblock_t *block;
|
||||||
void *ptr;
|
void *ptr;
|
||||||
|
|
||||||
I_Assert(I_GetCurrentThread() == main_thread);
|
|
||||||
|
|
||||||
#ifdef ZDEBUG2
|
#ifdef ZDEBUG2
|
||||||
CONS_Debug(DBG_MEMORY, "Z_Malloc %s:%d\n", file, line);
|
CONS_Debug(DBG_MEMORY, "Z_Malloc %s:%d\n", file, line);
|
||||||
#endif
|
#endif
|
||||||
@@ -307,8 +300,6 @@ void *Z_Calloc2(size_t size, INT32 tag, void *user, const char *file, INT32 line
|
|||||||
void *Z_Calloc(size_t size, INT32 tag, void *user)
|
void *Z_Calloc(size_t size, INT32 tag, void *user)
|
||||||
#endif
|
#endif
|
||||||
{
|
{
|
||||||
I_Assert(I_GetCurrentThread() == main_thread);
|
|
||||||
|
|
||||||
#ifdef VALGRIND_MEMPOOL_ALLOC
|
#ifdef VALGRIND_MEMPOOL_ALLOC
|
||||||
Z_calloc = true;
|
Z_calloc = true;
|
||||||
#endif
|
#endif
|
||||||
@@ -344,8 +335,6 @@ void *Z_Realloc(void *ptr, size_t size, INT32 tag, void *user)
|
|||||||
memblock_t *block;
|
memblock_t *block;
|
||||||
size_t copysize;
|
size_t copysize;
|
||||||
|
|
||||||
I_Assert(I_GetCurrentThread() == main_thread);
|
|
||||||
|
|
||||||
#ifdef ZDEBUG2
|
#ifdef ZDEBUG2
|
||||||
CONS_Debug(DBG_MEMORY, "Z_Realloc %s:%d\n", file, line);
|
CONS_Debug(DBG_MEMORY, "Z_Realloc %s:%d\n", file, line);
|
||||||
#endif
|
#endif
|
||||||
@@ -425,8 +414,6 @@ void Z_FreeTags(INT32 lowtag, INT32 hightag)
|
|||||||
{
|
{
|
||||||
memblock_t *block, *next;
|
memblock_t *block, *next;
|
||||||
|
|
||||||
I_Assert(I_GetCurrentThread() == main_thread);
|
|
||||||
|
|
||||||
#ifdef ZDEBUG
|
#ifdef ZDEBUG
|
||||||
Z_CheckHeap2(file, line);
|
Z_CheckHeap2(file, line);
|
||||||
#else
|
#else
|
||||||
@@ -460,8 +447,6 @@ void Z_IterateTags(INT32 lowtag, INT32 hightag, boolean (*iterfunc)(void *))
|
|||||||
{
|
{
|
||||||
memblock_t *block, *next;
|
memblock_t *block, *next;
|
||||||
|
|
||||||
I_Assert(I_GetCurrentThread() == main_thread);
|
|
||||||
|
|
||||||
if (!iterfunc)
|
if (!iterfunc)
|
||||||
I_Error("Z_IterateTags: no iterator function was given");
|
I_Error("Z_IterateTags: no iterator function was given");
|
||||||
|
|
||||||
|
|||||||
Reference in new issue
Block a user