Compare commits

..
16 Commits
Author SHA1 Message Date
indev 8fb1775606 Forgot MusicCredit hook 2025-05-31 19:15:04 +03:00
indev fab7635373 Add musicdef lua stuff into LUASTUFF.md 2025-05-31 19:10:58 +03:00
indev b29ca13916 Add musicdefs table into lua 2025-05-31 18:54:07 +03:00
indev 68ae880979 Change the way how musicdefs are stored (preparing for exposing them to lua) 2025-05-31 18:04:08 +03:00
indev 359befd857 Add MusicCredit lua hook 2025-05-28 23:27:30 +03:00
indev 279dfcafc4 Expose S_FindMusicCredit and musiccredit_t to lua 2025-05-28 22:10:25 +03:00
Alug f15d3be263 forgor the hw state lel 2025-05-28 18:39:20 +02:00
Alug 19e5366c5b add wireframe mode for ogl 2025-05-28 18:31:55 +02:00
Alug 346dee019c fix compiler warning bout playeringame 2025-05-28 18:31:37 +02:00
Alug 18914f22f2 remove crappy memcpy redifine from md5 2025-05-28 18:31:33 +02:00
Alug 1219ecf818 check for 32bit with __SIZEOF_POINTER__ for precip drawdistance
thx @chromaticpipe for the tip!
2025-05-28 16:27:40 +02:00
Alug b6923d0d0d readd flexible array for softwarepatch columnofs
how did this ever work lel
2025-05-28 16:21:57 +02:00
Alug e8969b0645 dont always print openmpt version to console
just use I_OutputMsg instead
2025-05-27 18:31:20 +02:00
Alug 7932c1af6f Print the current SDL_mixer version
when initializing the sound system
2025-05-27 18:30:55 +02:00
Alug 95b4228d3c update windoze libbacktrace
never was updated since we added this 2 years ago lel
2025-05-26 11:03:56 +01:00
Alug a0ff44043f Merge branch 'Saturn' into Saturn-Next 2025-05-25 17:37:40 +02:00
61 changed files with 642 additions and 749 deletions

No files matched your search

+31
View File
@@ -161,6 +161,37 @@ Duration is in milliseconds and is optional to set, default value is 84ms.
Exactly same as P_CheckSight but uses cheaper algorithm, useful for things like nametags. Doesn't work exactly
like P_CheckSight so don't use it for anything gameplay-related.
## musicdef_t
Userdata structure representing a musicdef. Fields:
`musicdef.name` - song identifier ("kmap01" for example).
`musicdef.usage`, `musicdef.source` - fields from vanilla MUSICDEFS lump.
`musicdef.filename` - unused for now.
`musicdef.title`, `musicdef.alttitle`, `musicdef.authors` - fields from MUSCINFO lump.
`#musicdef` - returns integer id for musicdef (which can be used as index in `musicdefs`).
All fields are read-only.
## S_FindMusicCredit(name)
Returns musicdef corresponding to music with given identifier. For example, `S_FindMusicCredit("kmap01")` will return
musicdef for green hills music.
## musicdefs
Global table for all musicdefs, similar to mobjinfo, states, etc. Can take either integer indices,
from `0` to `#musicdefs-1`, or string indices (which is equal to calling `S_FindMusicCredit`).
## addHook("MusicCredit", function(musicdef))
Hook is called whenever `S_ShowMusicCredit` (either from game or mod) is called. Takes musicdef as only argument, returning true
will overwrite vanilla behavior (not show music credit), can be used to implement custom music credit pop-ups.
# Other changes
## P_PlayRinglossSound(source, damager)
+9 -8
View File
@@ -1,5 +1,5 @@
/* backtrace.h -- Public header file for stack backtrace library.
Copyright (C) 2012-2020 Free Software Foundation, Inc.
Copyright (C) 2012-2024 Free Software Foundation, Inc.
Written by Ian Lance Taylor, Google.
Redistribution and use in source and binary forms, with or without
@@ -54,13 +54,14 @@ struct backtrace_state;
invalid after this function returns.
As a special case, the ERRNUM argument will be passed as -1 if no
debug info can be found for the executable, but the function
requires debug info (e.g., backtrace_full, backtrace_pcinfo). The
MSG in this case will be something along the lines of "no debug
info". Similarly, ERRNUM will be passed as -1 if there is no
symbol table, but the function requires a symbol table (e.g.,
backtrace_syminfo). This may be used as a signal that some other
approach should be tried. */
debug info can be found for the executable, or if the debug info
exists but has an unsupported version, but the function requires
debug info (e.g., backtrace_full, backtrace_pcinfo). The MSG in
this case will be something along the lines of "no debug info".
Similarly, ERRNUM will be passed as -1 if there is no symbol table,
but the function requires a symbol table (e.g., backtrace_syminfo).
This may be used as a signal that some other approach should be
tried. */
typedef void (*backtrace_error_callback) (void *data, const char *msg,
int errnum);
Binary file not shown.
+3 -7
View File
@@ -197,7 +197,7 @@ static fixed_t scale_mtof = (fixed_t)INITSCALEMTOF;
// used by FTOM to scale from frame-buffer-to-map coords (=1/scale_mtof)
static fixed_t scale_ftom;
static player_t *plr = NULL; // the player represented by an arrow
static player_t *plr; // the player represented by an arrow
static boolean followplayer = true; // specifies whether to follow the player around
@@ -237,7 +237,7 @@ static inline void AM_restoreScaleAndLoc(void)
m_x = old_m_x;
m_y = old_m_y;
}
else if (plr && plr->mo)
else
{
m_x = (plr->mo->x >> FRACTOMAPBITS) - m_w/2;
m_y = (plr->mo->y >> FRACTOMAPBITS) - m_h/2;
@@ -318,8 +318,7 @@ static void AM_initVariables(void)
break;
plr = &players[pnum];
if (plr && plr->mo)
if (plr != NULL && plr->mo != NULL)
{
m_x = (plr->mo->x >> FRACTOMAPBITS) - m_w/2;
m_y = (plr->mo->y >> FRACTOMAPBITS) - m_h/2;
@@ -598,9 +597,6 @@ static inline void AM_changeWindowScale(void)
static inline void AM_doFollowPlayer(void)
{
if (!plr || !plr->mo)
return;
if (f_oldloc.x != plr->mo->x || f_oldloc.y != plr->mo->y)
{
m_x = FTOM(MTOF(plr->mo->x >> FRACTOMAPBITS)) - m_w/2;
+15 -35
View File
@@ -240,6 +240,7 @@ void COM_ImmedExecute(const char *ptext)
while (i < strlen(ptext))
{
quotes = 0;
for (j = 0; i < strlen(ptext); i++,j++)
{
@@ -816,17 +817,12 @@ static void COM_Help_f(void)
cvar = CV_FindVar(help);
if (cvar)
{
boolean floatmode = false;
const char *cvalue = NULL;
CONS_Printf("\x82""Variable %s:\n", cvar->name);
CONS_Printf(M_GetText(" flags: "));
if (cvar->flags & CV_SAVE)
CONS_Printf("AUTOSAVE ");
if (cvar->flags & CV_FLOAT)
{
CONS_Printf("FLOAT ");
floatmode = true;
}
if (cvar->flags & CV_NETVAR)
CONS_Printf("NETVAR ");
if (cvar->flags & CV_CALL)
@@ -836,43 +832,30 @@ static void COM_Help_f(void)
CONS_Printf("\n");
if (cvar->PossibleValue)
{
if (!stricmp(cvar->PossibleValue[0].strvalue, "MIN") && !stricmp(cvar->PossibleValue[1].strvalue, "MAX"))
{
if (!stricmp(cvar->PossibleValue[0].strvalue, "MIN") && !stricmp(cvar->PossibleValue[1].strvalue, "MAX"))
{
if (floatmode)
{
float fu = FIXED_TO_FLOAT(cvar->PossibleValue[0].value);
float ck = FIXED_TO_FLOAT(cvar->PossibleValue[1].value);
CONS_Printf(" range from %ld%s to %ld%s\n",
(long)fu, M_Ftrim(fu),
(long)ck, M_Ftrim(ck));
}
else
CONS_Printf(" range from %d to %d\n", cvar->PossibleValue[0].value,
cvar->PossibleValue[1].value);
i = 2;
}
CONS_Printf(" range from %d to %d\n", cvar->PossibleValue[0].value,
cvar->PossibleValue[1].value);
i = 2;
}
{
const char *cvalue = NULL;
//CONS_Printf(M_GetText(" possible value : %s\n"), cvar->name);
while (cvar->PossibleValue[i].strvalue)
{
if (floatmode)
CONS_Printf(" %-2f : %s\n", FIXED_TO_FLOAT(cvar->PossibleValue[i].value),
cvar->PossibleValue[i].strvalue);
else
CONS_Printf(" %-2d : %s\n", cvar->PossibleValue[i].value,
cvar->PossibleValue[i].strvalue);
CONS_Printf(" %-2d : %s\n", cvar->PossibleValue[i].value,
cvar->PossibleValue[i].strvalue);
if (cvar->PossibleValue[i].value == cvar->value)
cvalue = cvar->PossibleValue[i].strvalue;
i++;
}
if (cvalue)
CONS_Printf(" Current value: %s\n", cvalue);
else
CONS_Printf(" Current value: %d\n", cvar->value);
}
}
if (cvalue)
CONS_Printf(" Current value: %s\n", cvalue);
else if (cvar->string)
CONS_Printf(" Current value: %s\n", cvar->string);
else
CONS_Printf(" Current value: %d\n", cvar->value);
}
@@ -1043,10 +1026,7 @@ static void COM_Add_f(void)
}
if (( cvar->flags & CV_FLOAT ))
{
float n =FIXED_TO_FLOAT (cvar->value) + atof(COM_Argv(2));
CV_Set(cvar, va("%ld%s", (long)n, M_Ftrim(n)));
}
CV_Set(cvar, va("%f", FIXED_TO_FLOAT (cvar->value) + atof(COM_Argv(2))));
else
CV_AddValue(cvar, atoi(COM_Argv(2)));
}
+24 -44
View File
@@ -95,7 +95,7 @@ UINT8 playernode[MAXPLAYERS];
tic_t jointimeout = (3*TICRATE);
static boolean sendingsavegame[MAXNETNODES]; // Are we sending the savegame?
#ifdef SATURNPAK
static tic_t resendingsavegame[MAXNETNODES]; // Are we resending the savegame?
static boolean resendingsavegame[MAXNETNODES]; // Are we resending the savegame?
static tic_t savegameresendcooldown[MAXNETNODES]; // How long before we can resend again?
#endif
static tic_t freezetimeout[MAXNETNODES]; // Until when can this node freeze the server before getting a timeout?
@@ -1068,7 +1068,6 @@ static void SV_RequireResynch(INT32 node)
// Initial setup
memset(resynch_sent[node], 0, MAXPLAYERS);
for (i = 0; i < MAXPLAYERS; ++i)
{
if (!playeringame[i]) // Player not in game so just drop it from required synch
@@ -1688,7 +1687,13 @@ static void SV_SendPlayerInfo(INT32 node)
for (i = 0; i < MSCOMPAT_MAXPLAYERS; i++)
{
if ((i >= MAXPLAYERS) || !playeringame[i])
if (i >= MAXPLAYERS)
{
netbuffer->u.playerinfo[i].node = 255;
continue;
}
if (playernode[i] == UINT8_MAX || !playeringame[i])
{
netbuffer->u.playerinfo[i].node = 255; // This slot is empty.
continue;
@@ -1773,6 +1778,8 @@ static boolean SV_SendServerConfig(INT32 node)
memset(netbuffer->u.servercfg.playerskins, 0xFF, sizeof(netbuffer->u.servercfg.playerskins));
memset(netbuffer->u.servercfg.playercolor, 0xFF, sizeof(netbuffer->u.servercfg.playercolor));
memset(netbuffer->u.servercfg.adminplayers, -1, sizeof(netbuffer->u.servercfg.adminplayers));
for (i = 0; i < MAXPLAYERS; i++)
{
netbuffer->u.servercfg.adminplayers[i] = (SINT8)adminplayers[i];
@@ -3268,7 +3275,7 @@ void CL_ClearPlayer(INT32 playernum)
P_RemoveMobj(players[playernum].mo);
}
memset(&players[playernum], 0, sizeof(player_t));
memset(&players[playernum], 0, sizeof (player_t));
}
//
@@ -4244,7 +4251,7 @@ static void ResetNode(INT32 node)
// SATURN
#ifdef SATURNPAK
is_client_saturn[node] = false;
resendingsavegame[node] = 0;
resendingsavegame[node] = false;
savegameresendcooldown[node] = 0;
gamestate_resend_counter[node] = 0;
#endif
@@ -4277,14 +4284,14 @@ void SV_ResetServer(void)
sprintf(player_names[i], "Player %d", i + 1);
}
memset(player_name_changes, 0, sizeof(player_name_changes));
memset(player_name_changes, 0, sizeof player_name_changes);
memset(playeringame, false, sizeof(playeringame));
memset(playernode, UINT8_MAX, sizeof(playernode));
memset(playeringame, false, sizeof playeringame);
memset(playernode, UINT8_MAX, sizeof playernode);
pingmeasurecount = 1;
memset(realpingtable, 0, sizeof(realpingtable));
memset(playerpingtable, 0, sizeof(playerpingtable));
memset(realpingtable, 0, sizeof realpingtable);
memset(playerpingtable, 0, sizeof playerpingtable);
ClearAdminPlayers();
@@ -4945,7 +4952,7 @@ static void PT_CanReceiveGamestate(SINT8 node)
CONS_Printf(M_GetText("Resending game state to %s...\n"), player_names[nodetoplayer[node]]);
SV_SendSaveGame(node, true); // Resend a complete game state
resendingsavegame[node] = 1;
resendingsavegame[node] = true;
}
#endif
@@ -5388,11 +5395,11 @@ static void HandlePacketFromPlayer(SINT8 node)
// Check player consistancy during the level
if (gamestate == GS_LEVEL
&& (realstart <= gametic && realstart + TICQUEUE - 1 > gametic)
&& (realstart > gametic - TICQUEUE+1 && realstart <= gametic)
&& consistancy[realstart%TICQUEUE] != SHORT(netbuffer->u.clientpak.consistancy)
&& (!UseSaturnSynch(node) || (!resendingsavegame[node] && savegameresendcooldown[node] <= I_GetTime() && !SV_ResendingSavegameToAnyone())))
{
resendingsavegame[node] = 0; // reset this before just in case
resendingsavegame[node] = false; // reset this before just in case
// Check if a client is saturn before sending ANYTHING!
// this way we only send stuff to clients we know can use the gamestate resend
@@ -5402,7 +5409,7 @@ static void HandlePacketFromPlayer(SINT8 node)
// Tell the client we are about to resend them the gamestate
netbuffer->packettype = PT_WILLRESENDGAMESTATE;
HSendPacket(node, true, 0, 0);
resendingsavegame[node] = 1;
resendingsavegame[node] = true;
}
else if (UseVanillaSynch(node))
{
@@ -5418,13 +5425,10 @@ static void HandlePacketFromPlayer(SINT8 node)
}
if (cv_blamecfail.value)
{
CONS_Printf(M_GetText("Synch failure for player %d (%s); expected %hd, got %hd\n"),
netconsole+1, player_names[netconsole],
consistancy[realstart%TICQUEUE],
SHORT(netbuffer->u.clientpak.consistancy));
}
DEBFILE(va("Restoring player %d (synch failure) [%update] %d!=%d\n",
netconsole, realstart, consistancy[realstart%TICQUEUE],
SHORT(netbuffer->u.clientpak.consistancy)));
@@ -5696,7 +5700,7 @@ static void HandlePacketFromPlayer(SINT8 node)
break;
}
// Update client ping table from the server.
//Update client ping table from the server.
if (client)
{
UINT8 i;
@@ -5732,7 +5736,7 @@ static void HandlePacketFromPlayer(SINT8 node)
break;
case PT_RECEIVEDGAMESTATE:
sendingsavegame[node] = false;
resendingsavegame[node] = 0;
resendingsavegame[node] = false;
savegameresendcooldown[node] = I_GetTime() + cv_resynchcooldown.value * TICRATE; // I_GetTime() + 5 * TICRATE;
break;
case PT_WILLRESENDGAMESTATE:
@@ -6362,35 +6366,10 @@ static void SV_Maketic(void)
maketic++;
}
#ifdef SATURNPAK
static void SV_UpdateResendGamestateTimeout(void)
{
for (INT32 i = 0; i < MAXNETNODES; ++i)
{
if (!resendingsavegame[i])
continue;
resendingsavegame[i]++;
// Resending savegame took too long
if (resendingsavegame[i] > (tic_t)TICRATE*cv_pingtimeout.value)
{
resendingsavegame[i] = 0;
SendKick(i, KICK_MSG_CON_FAIL);
}
}
}
#endif
boolean TryRunTics(tic_t realtics)
{
boolean ticking;
#ifdef SATURNPAK
if (server)
SV_UpdateResendGamestateTimeout();
#endif
// the machine has lagged but it is not so bad
if (realtics > TICRATE/7) // FIXME: consistency failure!!
{
@@ -6531,6 +6510,7 @@ static inline void PingUpdate(void)
if (pingtimeout[i] > 0)
pingtimeout[i]--;
}
}
//kick lagging players... unless everyone but the server's ping sucks.
+5 -22
View File
@@ -149,8 +149,6 @@ boolean dedicated = false;
boolean loaded_config = false; // true once config.cfg loaded AND executed
static void D_CleanFile(char **filearray);
//
// D_PostEvent
// Called by the I/O functions when input is detected
@@ -868,24 +866,9 @@ void D_SRB2Loop(void)
rendertimefrac_unpaused = FRACUNIT;
}
if (interp || doDisplay)
if ((interp || doDisplay) && !frameskip)
{
if (!frameskip)
{
ranwipe = D_Display();
}
else if (!dedicated)
{
// always update console and hud
// otherwise it may take minutes to open it
CON_Drawer();
if (gamestate == GS_LEVEL)
{
ST_Drawer();
HU_Drawer();
}
}
ranwipe = D_Display();
}
// Only take screenshots after drawing.
@@ -1202,7 +1185,7 @@ void D_AddPostloadFiles(void)
postautoloaded = true;
}
static void D_CleanFile(char **filearray)
void D_CleanFile(char **filearray)
{
size_t pnumwadfiles;
for (pnumwadfiles = 0; filearray[pnumwadfiles]; pnumwadfiles++)
@@ -1826,7 +1809,7 @@ void D_SRB2Main(void)
{
name = lumpinfo->name;
if (memcmp(name, "MAP", 3) == 0) // Ignore the headers
if (name[0] == 'M' && name[1] == 'A' && name[2] == 'P') // Ignore the headers
{
INT16 num;
if (name[5] != '\0')
@@ -1856,7 +1839,7 @@ void D_SRB2Main(void)
{
name = lumpinfo->name;
if (memcmp(name, "MAP", 3) == 0) // Ignore the headers
if (name[0] == 'M' && name[1] == 'A' && name[2] == 'P') // Ignore the headers
{
INT16 num;
if (name[5] != '\0')
+2
View File
@@ -81,6 +81,8 @@ void D_PostEvent(const event_t *ev);
void D_ProcessEvents(void);
void D_CleanFile(char **filearray);
const char *D_Home(void);
//
+2 -7
View File
@@ -2774,7 +2774,7 @@ static void Command_Map_f(void)
// G_TOLFlag handles both multiplayer gametype and ignores it for !multiplayer
else
{
if (!mapheaderinfo[newmapnum-1])
if (!mapheaderinfo[newmapnum-1] || mapheaderinfo[newmapnum-1] == NULL)
{
CONS_Alert(CONS_WARNING, M_GetText("Invalid mapheaderinfo for Course %s (%s)\n"), realmapname, G_BuildMapName(newmapnum));
Z_Free(realmapname);
@@ -3028,14 +3028,9 @@ static void Command_ReplayMarker(void)
adjustedleveltime = 0;
char *title = G_BuildMapTitle(gamemap);
snprintf(demo.titlename, 64, "%s [%i:%02d/%.5s]", title, G_TicsToMinutes(adjustedleveltime, false), G_TicsToSeconds(adjustedleveltime), modeattacking ? "Record Attack" : connectedservername);
if (title)
{
snprintf(demo.titlename, 64, "%s [%i:%02d/%.5s]", title, G_TicsToMinutes(adjustedleveltime, false), G_TicsToSeconds(adjustedleveltime), modeattacking ? "Record Attack" : connectedservername);
Z_Free(title);
}
else
snprintf(demo.titlename, 64, "[%i:%02d/%.5s]", G_TicsToMinutes(adjustedleveltime, false), G_TicsToSeconds(adjustedleveltime), modeattacking ? "Record Attack" : connectedservername);
CONS_Printf("Replay will be saved!\n");
}
-12
View File
@@ -1183,18 +1183,6 @@ filestatus_t findfile(char *filename, const UINT8 *wantedmd5sum, boolean complet
badmd5 = true;
// if not found at all, just move on without doing anything
if (cv_addons_option.value == 3 && *cv_addons_folder.string != '\0')
{
// next, check any custom directory if specified
homecheck = filesearch(filename, cv_addons_folder.string, wantedmd5sum, completepath, 10);
if (homecheck == FS_FOUND) // we found the file, so return that we have :)
return FS_FOUND;
else if (homecheck == FS_MD5SUMBAD) // file has a bad md5; move on and look for a file with the right md5
badmd5 = true;
// if not found at all, just move on without doing anything
}
// finally check "." directory
homecheck = filesearch(filename, ".", wantedmd5sum, completepath, 10);
+4 -10
View File
@@ -388,7 +388,7 @@ static void DRPC_GotServerIP(UINT32 address)
--------------------------------------------------*/
static const char *DRPC_GetServerIP(void)
{
const char *address;
const char *address;
// If you're connected
if (I_GetNodeAddress && (address = I_GetNodeAddress(servernode)) != NULL)
@@ -489,7 +489,7 @@ void DRPC_UpdatePresence(void)
{
#endif
discordPresence.state = "Private";
#ifdef MASTERSERVER
#ifdef MASTERSERVER
}
#endif
@@ -571,15 +571,9 @@ void DRPC_UpdatePresence(void)
{
// Map name on tool tip
char *title = G_BuildMapTitle(gamemap);
if (title)
{
snprintf(mapname, 48, "Map: %s", title);
Z_Free(title);
}
else
snprintf(mapname, 48, "Map: UNKNOWN");
snprintf(mapname, 48, "Map: %s", title);
discordPresence.largeImageText = mapname;
Z_Free(title);
}
if (gamestate == GS_LEVEL && Playing())
+2 -2
View File
@@ -113,8 +113,8 @@ extern char logfilename[1024];
#else
#define VERSION 1 // Game version
#define SUBVERSION 6 // more precise version number
#define VERSIONSTRING "Saturn v8.3"
#define VERSIONSTRINGW L"Saturn v8.3"
#define VERSIONSTRING "Saturn v8.2"
#define VERSIONSTRINGW L"Saturn v8.2"
// Hey! If you change this, add 1 to the MODVERSION below! Otherwise we can't force updates!
// And change CMakeLists.txt (not src/, but in root), for CMake users!
// AND appveyor.yml, for the build bots!
-2
View File
@@ -540,8 +540,6 @@ static const char *credits[] = {
"\"Jin\"",
"\"riomccloud\"",
"\"chromaticpipe\"",
"\"PAS\"",
"\"$HOME\"",
"\"Achii\"",
"\"Anonimus\"",
"\"scizor300\"",
+62 -71
View File
@@ -124,7 +124,7 @@ boolean addedtogame;
player_t players[MAXPLAYERS];
INT32 consoleplayer; // player taking events and displaying
INT32 displayplayers[MAXSPLITSCREENPLAYERS] = {0}; // view being displayed
INT32 displayplayers[MAXSPLITSCREENPLAYERS]; // view being displayed
tic_t gametic;
tic_t levelstarttic; // gametic at level start
@@ -751,49 +751,47 @@ INT32 JoyAxis(axis_input_e axissel, UINT8 player)
INT32 axisval;
boolean flp = false;
UINT8 pnum = player-1;
//find what axis to get
switch (axissel)
{
case AXISTURN:
axisval = cv_turnaxis[pnum].value;
axisval = cv_turnaxis[player-1].value;
break;
case AXISMOVE:
axisval = cv_moveaxis[pnum].value;
axisval = cv_moveaxis[player-1].value;
break;
case AXISCAMTURN:
axisval = cv_camturnaxis[pnum].value;
axisval = cv_camturnaxis[player-1].value;
break;
case AXISCAMSTRAFE:
axisval = cv_camstrafeaxis[pnum].value;
axisval = cv_camstrafeaxis[player-1].value;
break;
case AXISBRAKE:
axisval = cv_brakeaxis[pnum].value;
axisval = cv_brakeaxis[player-1].value;
break;
case AXISAIM:
axisval = cv_aimaxis[pnum].value;
axisval = cv_aimaxis[player-1].value;
break;
case AXISLOOK:
axisval = cv_lookaxis[pnum].value;
axisval = cv_lookaxis[player-1].value;
break;
case AXISFIRE:
axisval = cv_fireaxis[pnum].value;
axisval = cv_fireaxis[player-1].value;
break;
case AXISDRIFT:
axisval = cv_driftaxis[pnum].value;
axisval = cv_driftaxis[player-1].value;
break;
case AXISLOOKBACK:
axisval = cv_lookbackaxis[pnum].value;
axisval = cv_lookbackaxis[player-1].value;
break;
case AXISCUSTOM1:
axisval = cv_custom1axis[pnum].value;
axisval = cv_custom1axis[player-1].value;
break;
case AXISCUSTOM2:
axisval = cv_custom2axis[pnum].value;
axisval = cv_custom2axis[player-1].value;
break;
case AXISCUSTOM3:
axisval = cv_custom3axis[pnum].value;
axisval = cv_custom3axis[player-1].value;
break;
default:
return 0;
@@ -804,51 +802,44 @@ INT32 JoyAxis(axis_input_e axissel, UINT8 player)
axisval = -axisval;
flp = true;
}
if (axisval > JOYAXISSET*2 || axisval == 0) //not there in array or None
return 0;
if (axisval % 2)
if (axisval%2)
{
axisval /= 2;
retaxis = joyxmove[pnum][axisval];
retaxis = joyxmove[axisval];
if (retaxis < (-JOYAXISRANGE))
retaxis = -JOYAXISRANGE;
if (retaxis > (+JOYAXISRANGE))
retaxis = +JOYAXISRANGE;
if (!Joystick[pnum].bGamepadStyle && axissel < AXISDEAD)
if (!Joystick[player-1].bGamepadStyle && axissel < AXISDEAD)
{
const INT32 jdeadzone = ((JOYAXISRANGE-1) * cv_xdeadzone[pnum].value) >> FRACBITS;
const INT32 jdeadzone = ((JOYAXISRANGE-1) * cv_xdeadzone[player-1].value) >> FRACBITS;
if (abs(retaxis) <= jdeadzone)
return 0;
}
if (flp)
retaxis = -retaxis; // flip it around
if (flp) retaxis = -retaxis; //flip it around
return retaxis;
}
else
{
axisval--;
axisval /= 2;
retaxis = joyymove[pnum][axisval];
retaxis = joyymove[axisval];
if (retaxis < (-JOYAXISRANGE))
retaxis = -JOYAXISRANGE;
if (retaxis > (+JOYAXISRANGE))
retaxis = +JOYAXISRANGE;
if (!Joystick[pnum].bGamepadStyle && axissel < AXISDEAD)
if (!Joystick[player-1].bGamepadStyle && axissel < AXISDEAD)
{
const INT32 jdeadzone = ((JOYAXISRANGE-1) * cv_ydeadzone[pnum].value) >> FRACBITS;
const INT32 jdeadzone = ((JOYAXISRANGE-1) * cv_ydeadzone[player-1].value) >> FRACBITS;
if (abs(retaxis) <= jdeadzone)
return 0;
}
if (flp)
retaxis = -retaxis; // flip it around
if (flp) retaxis = -retaxis; //flip it around
return retaxis;
}
}
@@ -1295,9 +1286,15 @@ static void G_DoLoadLevel(boolean resetplayer)
}
// clear cmd building stuff
memset(gamekeydown, 0, sizeof(gamekeydown));
memset(joyxmove, 0, sizeof(joyxmove));
memset(joyymove, 0, sizeof(joyymove));
memset(gamekeydown, 0, sizeof (gamekeydown));
for (i = 0; i < JOYAXISSET; i++)
{
joyxmove[i] = joyymove[i] = 0;
joy2xmove[i] = joy2ymove[i] = 0;
joy3xmove[i] = joy3ymove[i] = 0;
joy4xmove[i] = joy4ymove[i] = 0;
}
mousex = mousey = 0;
// clear hud messages remains (usually from game startup)
@@ -4001,6 +3998,7 @@ void G_InitNew(UINT8 pencoremode, const char *mapname, boolean resetplayer, bool
}
}
char *G_BuildMapTitle(INT32 mapnum)
{
char *title = NULL;
@@ -5467,36 +5465,33 @@ void G_GhostTicker(void)
break;
}
}
if (type != -1)
if (type == MT_GHOST)
{
if (type == MT_GHOST)
{
mobj = P_SpawnGhostMobj(g->mo); // does a large portion of the work for us
mobj->frame = (mobj->frame & ~FF_FRAMEMASK)|tr_trans60<<FF_TRANSSHIFT; // P_SpawnGhostMobj sets trans50, we want trans60
}
else
{
mobj = P_SpawnMobj(g->mo->x, g->mo->y, g->mo->z - FixedDiv(FixedMul(g->mo->info->height, g->mo->scale) - g->mo->height,3*FRACUNIT), MT_THOK);
mobj->sprite = states[mobjinfo[type].spawnstate].sprite;
mobj->frame = (states[mobjinfo[type].spawnstate].frame & FF_FRAMEMASK) | tr_trans60<<FF_TRANSSHIFT;
mobj->tics = -1; // nope.
mobj->color = g->mo->color;
if (g->mo->eflags & MFE_VERTICALFLIP)
{
mobj->flags2 |= MF2_OBJECTFLIP;
mobj->eflags |= MFE_VERTICALFLIP;
}
P_SetScale(mobj, g->mo->scale);
mobj->destscale = g->mo->scale;
}
mobj->floorz = mobj->z;
mobj->ceilingz = mobj->z+mobj->height;
P_UnsetThingPosition(mobj);
mobj->flags = MF_NOBLOCKMAP|MF_NOCLIP|MF_NOCLIPHEIGHT|MF_NOGRAVITY; // make an ATTEMPT to curb crazy SOCs fucking stuff up...
P_SetThingPosition(mobj);
mobj->fuse = 8;
P_SetTarget(&mobj->target, g->mo);
mobj = P_SpawnGhostMobj(g->mo); // does a large portion of the work for us
mobj->frame = (mobj->frame & ~FF_FRAMEMASK)|tr_trans60<<FF_TRANSSHIFT; // P_SpawnGhostMobj sets trans50, we want trans60
}
else
{
mobj = P_SpawnMobj(g->mo->x, g->mo->y, g->mo->z - FixedDiv(FixedMul(g->mo->info->height, g->mo->scale) - g->mo->height,3*FRACUNIT), MT_THOK);
mobj->sprite = states[mobjinfo[type].spawnstate].sprite;
mobj->frame = (states[mobjinfo[type].spawnstate].frame & FF_FRAMEMASK) | tr_trans60<<FF_TRANSSHIFT;
mobj->tics = -1; // nope.
mobj->color = g->mo->color;
if (g->mo->eflags & MFE_VERTICALFLIP)
{
mobj->flags2 |= MF2_OBJECTFLIP;
mobj->eflags |= MFE_VERTICALFLIP;
}
P_SetScale(mobj, g->mo->scale);
mobj->destscale = g->mo->scale;
}
mobj->floorz = mobj->z;
mobj->ceilingz = mobj->z+mobj->height;
P_UnsetThingPosition(mobj);
mobj->flags = MF_NOBLOCKMAP|MF_NOCLIP|MF_NOCLIPHEIGHT|MF_NOGRAVITY; // make an ATTEMPT to curb crazy SOCs fucking stuff up...
P_SetThingPosition(mobj);
mobj->fuse = 8;
P_SetTarget(&mobj->target, g->mo);
}
if (ziptic & EZT_HIT)
{ // Spawn hit poofs for killing things!
@@ -6073,19 +6068,15 @@ void G_BeginRecording(void)
char *title = G_BuildMapTitle(gamemap);
// Print to a separate temp buffer instead of demo.titlename, so we can use it in M_TextInputSetString
if (title)
{
snprintf(demotitlename, 64, "%s - %s", title, modeattacking ? "Time Attack" : connectedservername);
Z_Free(title);
}
else
snprintf(demotitlename, 64, "%s", modeattacking ? "Time Attack" : connectedservername);
snprintf(demotitlename, 64, "%s - %s", title, modeattacking ? "Time Attack" : connectedservername);
// Init just in case it isn't initialized already
M_TextInputInit(&demo.titlenameinput, demo.titlename, sizeof(demo.titlename));
// This will indirectly assign to demo.titlename too
M_TextInputSetString(&demo.titlenameinput, demotitlename);
Z_Free(title);
}
// demo checksum
@@ -8149,7 +8140,7 @@ void G_SaveDemo(void)
size_t i, strindex = 0;
boolean dash = true;
for (i = 0; demo.titlename[i] && i < 127; i++)
for (i = 0; i < 127 && demo.titlename[i]; i++)
{
if ((demo.titlename[i] >= 'a' && demo.titlename[i] <= 'z') ||
(demo.titlename[i] >= '0' && demo.titlename[i] <= '9'))
+20 -10
View File
@@ -114,7 +114,8 @@ INT32 mousex, mousey;
INT32 mlooky; // like mousey but with a custom sensitivity for mlook
// joystick values are repeated
INT32 joyxmove[MAXSPLITSCREENPLAYERS][JOYAXISSET], joyymove[MAXSPLITSCREENPLAYERS][JOYAXISSET];
INT32 joyxmove[JOYAXISSET], joyymove[JOYAXISSET], joy2xmove[JOYAXISSET], joy2ymove[JOYAXISSET],
joy3xmove[JOYAXISSET], joy3ymove[JOYAXISSET], joy4xmove[JOYAXISSET], joy4ymove[JOYAXISSET];
// current state of the keys: true if pushed
UINT8 gamekeydown[NUMINPUTS];
@@ -186,32 +187,32 @@ void G_MapEventsToControls(event_t *ev)
i = ev->data1;
if (i >= JOYAXISSET || menuactive || CON_Ready() || chat_on)
break;
if (ev->data2 != INT32_MAX) joyxmove[0][i] = ev->data2;
if (ev->data3 != INT32_MAX) joyymove[0][i] = ev->data3;
if (ev->data2 != INT32_MAX) joyxmove[i] = ev->data2;
if (ev->data3 != INT32_MAX) joyymove[i] = ev->data3;
break;
case ev_joystick2: // buttons are virtual keys
i = ev->data1;
if (i >= JOYAXISSET || menuactive)
break;
if (ev->data2 != INT32_MAX) joyxmove[1][i] = ev->data2;
if (ev->data3 != INT32_MAX) joyymove[1][i] = ev->data3;
if (ev->data2 != INT32_MAX) joy2xmove[i] = ev->data2;
if (ev->data3 != INT32_MAX) joy2ymove[i] = ev->data3;
break;
case ev_joystick3:
i = ev->data1;
if (i >= JOYAXISSET)
break;
if (ev->data2 != INT32_MAX) joyxmove[2][i] = ev->data2;
if (ev->data3 != INT32_MAX) joyymove[2][i] = ev->data3;
if (ev->data2 != INT32_MAX) joy3xmove[i] = ev->data2;
if (ev->data3 != INT32_MAX) joy3ymove[i] = ev->data3;
break;
case ev_joystick4:
i = ev->data1;
if (i >= JOYAXISSET)
break;
if (ev->data2 != INT32_MAX) joyxmove[3][i] = ev->data2;
if (ev->data3 != INT32_MAX) joyymove[3][i] = ev->data3;
if (ev->data2 != INT32_MAX) joy4xmove[i] = ev->data2;
if (ev->data3 != INT32_MAX) joy4ymove[i] = ev->data3;
break;
default:
@@ -257,6 +258,15 @@ void G_ResetControls(void)
memset(joyxmove, 0, sizeof(joyxmove));
memset(joyymove, 0, sizeof(joyymove));
memset(joy2xmove, 0, sizeof(joy2xmove));
memset(joy2ymove, 0, sizeof(joy2ymove));
memset(joy3xmove, 0, sizeof(joy3xmove));
memset(joy3ymove, 0, sizeof(joy3ymove));
memset(joy4xmove, 0, sizeof(joy4xmove));
memset(joy4ymove, 0, sizeof(joy4ymove));
// reset those just in case the game missed the keyup event
memset(dpadscrollstate, false, sizeof(dpadscrollstate));
}
@@ -1020,7 +1030,7 @@ INT32 G_KeyStringtoNum(const char *keystr)
if (!keystr[0])
return 0;
if (!keystr[1] && keystr[0] > ' ' && keystr[0] <= 'z')
if (!keystr[0] || (!keystr[1] && keystr[0] > ' ' && keystr[0] <= 'z'))
return keystr[0];
if (!strncmp(keystr, "KEY", 3) && keystr[3] >= '0' && keystr[3] <= '9')
+5 -8
View File
@@ -41,12 +41,10 @@ typedef enum
KEY_DBLJOY1 = KEY_DBLMOUSE1 + MOUSEBUTTONS,
KEY_DBLHAT1 = KEY_DBLJOY1 + JOYBUTTONS,
KEY_2MOUSE1 = KEY_DBLHAT1 + JOYHATS*4,
KEY_2JOY1 = KEY_2MOUSE1 + MOUSEBUTTONS,
KEY_2JOY1 = KEY_DBLHAT1 + MOUSEBUTTONS,
KEY_2HAT1 = KEY_2JOY1 + JOYBUTTONS,
KEY_DBL2MOUSE1 = KEY_2HAT1 + JOYHATS*4,
KEY_DBL2JOY1 = KEY_DBL2MOUSE1 + MOUSEBUTTONS,
KEY_DBL2JOY1 = KEY_2HAT1 + MOUSEBUTTONS,
KEY_DBL2HAT1 = KEY_DBL2JOY1 + JOYBUTTONS,
KEY_3JOY1 = KEY_DBL2HAT1 + JOYHATS*4,
@@ -63,10 +61,8 @@ typedef enum
KEY_MOUSEWHEELUP = KEY_DBL4HAT1 + JOYHATS*4,
KEY_MOUSEWHEELDOWN = KEY_MOUSEWHEELUP + 1,
KEY_2MOUSEWHEELUP = KEY_MOUSEWHEELDOWN + 1,
KEY_2MOUSEWHEELDOWN = KEY_2MOUSEWHEELUP + 1,
NUMINPUTS = KEY_2MOUSEWHEELDOWN + 1, // FIXME: all the mouse 2 stuff should be removed, but it screws up mappings somehow
NUMINPUTS = KEY_MOUSEWHEELDOWN + 1,
} key_input_e;
typedef enum
@@ -117,7 +113,8 @@ extern consvar_t cv_gamepadled[MAXSPLITSCREENPLAYERS];
extern INT32 mousex, mousey;
extern INT32 mlooky; //mousey with mlookSensitivity
extern INT32 joyxmove[MAXSPLITSCREENPLAYERS][JOYAXISSET], joyymove[MAXSPLITSCREENPLAYERS][JOYAXISSET];
extern INT32 joyxmove[JOYAXISSET], joyymove[JOYAXISSET], joy2xmove[JOYAXISSET], joy2ymove[JOYAXISSET],
joy3xmove[JOYAXISSET], joy3ymove[JOYAXISSET], joy4xmove[JOYAXISSET], joy4ymove[JOYAXISSET];
// current state of the keys: true if pushed
extern UINT8 gamekeydown[NUMINPUTS];
+1 -1
View File
@@ -124,7 +124,7 @@ void HWR_ProcessPolygon(FSurfaceInfo *pSurf, FOutVector *pOutVerts, FUINT iNumPt
polygonArray[polygonArraySize].numVerts = iNumPts;
polygonArray[polygonArraySize].polyFlags = PolyFlags;
polygonArray[polygonArraySize].texture = current_texture;
polygonArray[polygonArraySize].shader = (shader_target != SHADER_NONE) ? HWR_GetShaderFromTarget(shader_target) : shader_target;
polygonArray[polygonArraySize].shader = (shader_target != -1) ? HWR_GetShaderFromTarget(shader_target) : shader_target;
polygonArray[polygonArraySize].horizonSpecial = horizonSpecial;
polygonArraySize++;
+9 -14
View File
@@ -46,16 +46,12 @@ RGBA_t *HWR_GetTexturePalette(void)
static INT32 format2bpp(GLTextureFormat_t format)
{
switch (format)
{
case GL_TEXFMT_RGBA:
return 4;
case GL_TEXFMT_ALPHA_INTENSITY_88:
case GL_TEXFMT_AP_88:
return 2;
default:
return 1;
}
if (format == GL_TEXFMT_RGBA)
return 4;
else if (format == GL_TEXFMT_ALPHA_INTENSITY_88 || format == GL_TEXFMT_AP_88)
return 2;
else
return 1;
}
// This code was originally placed directly in HWR_DrawPatchInCache.
@@ -225,6 +221,8 @@ static void HWR_DrawTexturePatchInCache(GLMipmap_t *mipmap,
if (texture->width <= 0 || texture->height <= 0)
return;
palette = HWR_GetTexturePalette();
x1 = patch->originx;
width = SHORT(realpatch->width);
height = SHORT(realpatch->height);
@@ -236,8 +234,6 @@ static void HWR_DrawTexturePatchInCache(GLMipmap_t *mipmap,
if (patch->originy > texture->height || (patch->originy + height) < 0)
return; // patch not located within texture's y bounds, ignore
palette = HWR_GetTexturePalette();
// patch is actually inside the texture!
// now check if texture is partly off-screen and adjust accordingly
@@ -327,6 +323,7 @@ static void HWR_GenerateTexture(INT32 texnum, GLMapTexture_t *gltex, boolean noe
boolean skyspecial = false; // poor hack for Legacy large skies..
RGBA_t *palette;
palette = HWR_GetTexturePalette();
texture = textures[texnum];
@@ -364,8 +361,6 @@ static void HWR_GenerateTexture(INT32 texnum, GLMapTexture_t *gltex, boolean noe
INT32 j;
RGBA_t col;
palette = HWR_GetTexturePalette();
col = palette[HWR_CHROMAKEY_EQUIVALENTCOLORINDEX];
for (idx = 0, j = 0; j < blockheight; j++)
+2
View File
@@ -318,6 +318,8 @@ enum hwdsetspecialstate
HWD_SET_TEXTUREFILTERMODE,
HWD_SET_TEXTUREANISOTROPICMODE,
HWD_SET_WIREFRAME,
HWD_SET_MSAA,
HWD_SET_SCREEN_TEXTURES,
+21 -14
View File
@@ -226,6 +226,8 @@ consvar_t cv_glsolvetjoin = {"gr_solvetjoin", "On", 0, CV_OnOff, NULL, 0, NULL,
consvar_t cv_glbatching = {"gr_batching", "On", 0, CV_OnOff, NULL, 0, NULL, NULL, 0, 0, NULL};
consvar_t cv_glwireframe = {"gr_wireframe", "Off", 0, CV_OnOff, NULL, 0, NULL, NULL, 0, 0, NULL};
consvar_t cv_glrenderdistance = {"gr_renderdistance", "Max", CV_SAVE, glrenderdistance_cons_t, NULL, 0, NULL, NULL, 0, 0, NULL};
consvar_t cv_glhorizonlines = {"gr_horizonlines", "On", CV_SAVE, CV_OnOff, NULL, 0, NULL, NULL, 0, 0, NULL};
@@ -338,6 +340,12 @@ static void HWR_SetShaderState(void)
GL_SetSpecialState(HWD_SET_SHADERS, HWR_UseShader() ? 1 : 0);
}
static boolean HWR_IsWireframeMode(void)
{
return (cv_glwireframe.value /*&& cv_debug*/);
}
static boolean HWR_OverrideObjectLightLevel(mobj_t *thing, INT32 *lightlevel)
{
if (R_ThingIsFullBright(thing))
@@ -3707,9 +3715,6 @@ static void HWR_SplitSprite(gl_vissprite_t *spr, const boolean papersprite)
blend = HWR_GetBlendModeFlag(blendmode)|PF_Occlude;
}
if (cv_playerfade.value && spr->mobj->player)
Surf.PolyColor.s.alpha = FixedMul(R_DoPlayerFade(spr->mobj), Surf.PolyColor.s.alpha);
if (HWR_UseShader())
{
shader = SHADER_SPRITE;
@@ -3997,9 +4002,6 @@ static void HWR_DrawSprite(gl_vissprite_t *spr)
blend = HWR_GetBlendModeFlag(blendmode)|PF_Occlude;
}
if (cv_playerfade.value && spr->mobj->player)
Surf.PolyColor.s.alpha = FixedMul(R_DoPlayerFade(spr->mobj), Surf.PolyColor.s.alpha);
if (HWR_UseShader())
{
shader = SHADER_SPRITE;
@@ -4464,10 +4466,7 @@ static void HWR_DrawModels(void)
continue;
}
if (!spr->mobj)
continue;
if (spr->mobj->skin && spr->mobj->sprite == SPR_PLAY)
if (spr->mobj && spr->mobj->skin && spr->mobj->sprite == SPR_PLAY)
{
md2_t *md2;
@@ -5268,6 +5267,9 @@ static void HWR_DrawSkyBackground(void)
if (drewsky)
return;
if (HWR_IsWireframeMode())
return;
GL_SetBlend(PF_Translucent|PF_NoDepthTest|PF_Modulated);
memcpy(&dometransform, &atransform, sizeof(FTransform));
@@ -5470,8 +5472,8 @@ void HWR_RenderViewpoint(gl_portal_t *rootportal, const float fpov, player_t *pl
HWR_PortalClipping(rootportal);
}
// Set transform.
GL_SetTransform(&atransform);
if (HWR_IsWireframeMode())
GL_SetSpecialState(HWD_SET_WIREFRAME, 1);
ps_numbspcalls.value.i = 0;
ps_numpolyobjects.value.i = 0;
@@ -5536,6 +5538,9 @@ void HWR_RenderViewpoint(gl_portal_t *rootportal, const float fpov, player_t *pl
ps_hw_nodedrawtime.value.p = 0;
HWR_RenderDrawNodes();
if (HWR_IsWireframeMode())
GL_SetSpecialState(HWD_SET_WIREFRAME, 0);
HWR_FreePortalList(portallist);
}
@@ -5759,7 +5764,7 @@ static void HWR_TogglePaletteRendering(void)
// If the r_opengl "texture palette" stays the same during this switch, these textures
// will not be cleared out. However they are still out of date since the
// composite texture blending method has changed. Therefore they need to be cleared.
HWR_LoadMapTextures(numtextures);
GL_ClearMipMapCache();
}
}
else
@@ -5773,7 +5778,7 @@ static void HWR_TogglePaletteRendering(void)
// If the r_opengl "texture palette" stays the same during this switch, these textures
// will not be cleared out. However they are still out of date since the
// composite texture blending method has changed. Therefore they need to be cleared.
HWR_LoadMapTextures(numtextures);
GL_ClearMipMapCache();
}
}
}
@@ -5810,6 +5815,8 @@ void HWR_AddCommands(void)
CV_RegisterVar(&cv_glbatching);
CV_RegisterVar(&cv_glwireframe);
CV_RegisterVar(&cv_glrenderdistance);
CV_RegisterVar(&cv_glhorizonlines);
+3 -1
View File
@@ -202,6 +202,8 @@ extern consvar_t cv_glsolvetjoin;
extern consvar_t cv_glbatching;
extern consvar_t cv_glwireframe;
extern consvar_t cv_glrenderdistance;
extern consvar_t cv_glhorizonlines;
@@ -223,7 +225,7 @@ FUNCINLINE static ATTRINLINE boolean HWR_ShouldUsePaletteRendering(void)
FUNCINLINE static ATTRINLINE boolean HWR_PalRenderFlashpal(void)
{
return (cv_glflashpal.value && HWR_ShouldUsePaletteRendering());
return (HWR_ShouldUsePaletteRendering() && cv_glflashpal.value);
}
#endif
+1 -6
View File
@@ -1227,9 +1227,6 @@ void HWR_DrawMD2(gl_vissprite_t *spr)
Surf.PolyFlags = HWR_GetBlendModeFlag(blendmode);
}
if (cv_playerfade.value && spr->mobj->player)
Surf.PolyColor.s.alpha = FixedMul(R_DoPlayerFade(spr->mobj), Surf.PolyColor.s.alpha);
// dont forget to enabled the depth test because we can't do this like
// before: polygons models are not sorted
@@ -1244,7 +1241,7 @@ void HWR_DrawMD2(gl_vissprite_t *spr)
else
{
md2s = md2_playermodels;
skinnum = (skin_t *)spr->mobj->localskin - skins;
skinnum = (skin_t *)spr->mobj->localskin - skins;
}
}
else
@@ -1269,7 +1266,6 @@ void HWR_DrawMD2(gl_vissprite_t *spr)
if (md2->error)
return; // we already failed loading this before :(
if (!md2->model)
{
CONS_Debug(DBG_RENDER, "Loading model... (%s, %s)", sprnames[spr->mobj->sprite], md2->filename);
@@ -1288,7 +1284,6 @@ void HWR_DrawMD2(gl_vissprite_t *spr)
return;
}
}
//Hurdler: arf, I don't like that implementation at all... too much crappy
gpatch = md2->glpatch;
if (gpatch)
+7
View File
@@ -350,6 +350,8 @@ typedef void (APIENTRY * PFNglDisable) (GLenum cap);
static PFNglDisable pglDisable;
typedef void (APIENTRY * PFNglGetFloatv) (GLenum pname, GLfloat *params);
static PFNglGetFloatv pglGetFloatv;
typedef void (APIENTRY * PFNglPolygonMode) (GLenum, GLenum);
static PFNglPolygonMode pglPolygonMode;
/* Depth Buffer */
typedef void (APIENTRY * PFNglClearDepth) (GLclampd depth);
@@ -549,6 +551,7 @@ boolean SetupGLfunc(void)
GETOPENGLFUNC(pglGetFloatv, glGetFloatv)
GETOPENGLFUNC(pglGetIntegerv, glGetIntegerv)
GETOPENGLFUNC(pglGetString, glGetString)
GETOPENGLFUNC(pglPolygonMode, glPolygonMode)
GETOPENGLFUNC(pglClearDepth, glClearDepth)
GETOPENGLFUNC(pglDepthFunc, glDepthFunc)
@@ -2364,6 +2367,10 @@ void GL_SetSpecialState(hwdspecialstate_t IdState, INT32 Value)
GL_Flush(); //??? if we want to change filter mode by texture, remove this
break;
case HWD_SET_WIREFRAME:
pglPolygonMode(GL_FRONT_AND_BACK, Value ? GL_LINE : GL_FILL);
break;
case HWD_SET_TEXTURE_FORMAT:
gltexformat = (Value == 32) ? GL_RGBA : GL_RGB5_A1;
GL_Flush();
+4 -4
View File
@@ -220,9 +220,9 @@ HMS_connect (const char *format, ...)
curl_easy_setopt(curl, CURLOPT_URL, url);
curl_easy_setopt(curl, CURLOPT_FOLLOWLOCATION, 1L);
curl_easy_setopt(curl, CURLOPT_IPRESOLVE, (long)CURL_IPRESOLVE_V4);
curl_easy_setopt(curl, CURLOPT_IPRESOLVE, CURL_IPRESOLVE_V4);
curl_easy_setopt(curl, CURLOPT_TIMEOUT, (long)cv_masterserver_timeout.value);
curl_easy_setopt(curl, CURLOPT_TIMEOUT, cv_masterserver_timeout.value);
curl_easy_setopt(curl, CURLOPT_WRITEFUNCTION, HMS_on_read);
curl_easy_setopt(curl, CURLOPT_WRITEDATA, buffer);
@@ -339,8 +339,8 @@ HMS_unlist (void)
if (! hms)
return 0;
curl_easy_setopt(hms->curl, CURLOPT_POST, (long)1);
curl_easy_setopt(hms->curl, CURLOPT_POSTFIELDSIZE, (long)0);
curl_easy_setopt(hms->curl, CURLOPT_POST, 1);
curl_easy_setopt(hms->curl, CURLOPT_POSTFIELDSIZE, 0);
okay = HMS_do(hms);
HMS_end(hms);
+8 -6
View File
@@ -311,7 +311,7 @@ void HU_LoadGraphics(void)
lt_font[0] = (patch_t *)W_CachePatchName("LTFNT039", PU_HUDGFX); /// \note fake start hack
// Number support
lt_font[9] = (patch_t *)W_CachePatchName("LTFNT048", PU_HUDGFX);
lt_font[9] = (patch_t *)W_CachePatchName("LTFNT048", PU_HUDGFX);
lt_font[10] = (patch_t *)W_CachePatchName("LTFNT049", PU_HUDGFX);
lt_font[11] = (patch_t *)W_CachePatchName("LTFNT050", PU_HUDGFX);
lt_font[12] = (patch_t *)W_CachePatchName("LTFNT051", PU_HUDGFX);
@@ -748,7 +748,7 @@ static void Command_CSay_f(void)
return;
}
if (!server && !IsPlayerAdmin(consoleplayer))
if(!server && !IsPlayerAdmin(consoleplayer))
{
CONS_Alert(CONS_NOTICE, M_GetText("Only servers and admins can use csay.\n"));
return;
@@ -2789,11 +2789,13 @@ void HU_DoCEcho(const char *msg)
*p = '\n';
CONS_Printf("%s\n", temp);
return;
}
else if (cv_cechotoggle.value)
cechotimer = cechoduration;
I_OutputMsg("%s\n", msg); // ALWAYS print to log
I_OutputMsg("%s\n", msg); // print to log
if (!cv_cechotoggle.value)
return;
cechotimer = cechoduration;
}
-2
View File
@@ -141,8 +141,6 @@ boolean I_UseNativeKeyboard(void);
boolean I_CheckNativeRes(void);
void I_SetBorderlessWindow(void);
#ifdef USE_FBO_OGL
void RefreshOGLSDLSurface(void);
+2 -3
View File
@@ -10525,12 +10525,11 @@ static void K_drawKartWanted(void)
{
INT32 x = basex+(splitscreen > 1 ? 13 : 8), y = basey+(splitscreen > 1 ? 16 : 21);
fixed_t scale = FRACUNIT/2;
player_t *p = &players[battlewanted[i]];
if (battlewanted[i] == -1)
break;
player_t *p = &players[battlewanted[i]];
if (numwanted == 1)
scale = FRACUNIT;
else
@@ -10541,7 +10540,7 @@ static void K_drawKartWanted(void)
y += 16;
}
if (p->skincolor)
if (players[battlewanted[i]].skincolor)
{
colormap = R_GetTranslationColormap(TC_RAINBOW, p->skincolor, GTC_CACHE);
V_DrawFixedPatch(x<<FRACBITS, y<<FRACBITS, FRACUNIT, V_HUDTRANS|(splitscreen < 3 ? V_SNAPTORIGHT : 0)|V_SNAPTOBOTTOM, (scale == FRACUNIT ? R_GetSkinFaceWant(p) : R_GetSkinFaceRank(p)), colormap);
+2
View File
@@ -55,6 +55,7 @@
X (PlayerQuit),\
X (PlayerThink),/* P_PlayerThink */\
X (MusicChange),\
X (MusicCredit),\
X (ShouldSpin),/*SRB2KART*/\
X (ShouldExplode),/*SRB2KART*/\
X (ShouldSquish),/*SRB2KART*/\
@@ -130,6 +131,7 @@ int LUA_HookPlayerCanDamage(player_t *, mobj_t *);
void LUA_HookPlayerQuit(player_t *, int);
int LUA_HookPlayerCmd(player_t *, ticcmd_t *);
int LUA_HookMusicChange(const char *oldname, struct MusicChange *);
int LUA_HookMusicCredit(musicdef_t *musicdef);
int LUA_HookShouldSpin(player_t *player, mobj_t *inflictor, mobj_t *source); // SRB2KART: Should player be spun out?
int LUA_HookShouldExplode(player_t *player, mobj_t *inflictor, mobj_t *source); // SRB2KART: Should player be exploded?
+12
View File
@@ -1065,6 +1065,18 @@ int LUA_HookMusicChange(const char *oldname, struct MusicChange *param)
return hook.status;
}
int LUA_HookMusicCredit(musicdef_t *musicdef)
{
Hook_State hook;
if (prepare_hook(&hook, 0, HOOK(MusicCredit)))
{
LUA_PushUserdata(gL, musicdef, META_MUSICDEF);
call_hooks(&hook, 1, res_true);
}
return hook.status;
}
static int kartdamage_hook
(
player_t *player,
+130
View File
@@ -16,6 +16,7 @@
#include "dehacked.h"
#include "p_mobj.h"
#include "p_local.h"
#include "s_sound.h"
#include "z_zone.h"
#include "lua_script.h"
@@ -1072,6 +1073,109 @@ static int sfxinfo_num(lua_State *L)
return 1;
}
enum musicdef_e {
musicdef_name = 0,
musicdef_usage,
musicdef_source,
musicdef_filename,
musicdef_title,
musicdef_alttitle,
musicdef_authors,
};
const char *const musicdef_opt[] = {
"name",
"usage",
"source",
"filename",
"title",
"alttitle",
"authors",
NULL
};
static int musicdef_fields_ref = LUA_NOREF;
static int lib_sFindMusicCredit(lua_State *L)
{
const char *name = luaL_checkstring(L, 1);
LUA_PushUserdata(L, S_FindMusicCredit(name), META_MUSICDEF);
return 1;
}
static int lib_getMusicDef(lua_State *L)
{
musicdef_t *def = NULL;
if (lua_isnumber(L, 2))
def = S_GetMusicCredit(lua_tonumber(L, 2));
else if (lua_isstring(L, 2))
def = S_FindMusicCredit(lua_tostring(L, 2));
else
return luaL_error(L, "musicdefs index must be number or string (got %s)", luaL_typename(L, 2));
LUA_PushUserdata(L, def, META_MUSICDEF);
return 1;
}
static int lib_setMusicDef(lua_State *L)
{
return luaL_error(L, "musicdefs is read only");
}
static int lib_musicdefslen(lua_State *L)
{
lua_pushinteger(L, nummusicdefs);
return 1;
}
static int musicdef_get(lua_State *L)
{
musicdef_t *musicdef = *((musicdef_t **)luaL_checkudata(L, 1, META_MUSICDEF));
enum musicdef_e field = Lua_optoption(L, 2, -1, musicdef_fields_ref);
I_Assert(musicdef != NULL);
switch (field)
{
case musicdef_name:
lua_pushstring(L, musicdef->name);
return 1;
case musicdef_usage:
lua_pushstring(L, musicdef->usage);
return 1;
case musicdef_source:
lua_pushstring(L, musicdef->source);
return 1;
case musicdef_filename:
lua_pushstring(L, musicdef->filename);
return 1;
case musicdef_title:
lua_pushstring(L, musicdef->title);
return 1;
case musicdef_alttitle:
lua_pushstring(L, musicdef->alttitle);
return 1;
case musicdef_authors:
lua_pushstring(L, musicdef->authors);
return 1;
default:
return luaL_error(L, LUA_QL("musicdef_t") " has no field named " LUA_QS, lua_tostring(L, 2));
}
return 0;
}
static int musicdef_num(lua_State *L)
{
musicdef_t *musicdef = *((musicdef_t **)luaL_checkudata(L, 1, META_MUSICDEF));
I_Assert(musicdef != NULL);
lua_pushinteger(L, musicdef->num);
return 1;
}
//////////////////////////////
//
// Now push all these functions into the Lua state!
@@ -1126,6 +1230,18 @@ int LUA_InfoLib(lua_State *L)
sfxinfo_fields_ref = Lua_CreateFieldTable(L, sfxinfo_opt);
luaL_newmetatable(L, META_MUSICDEF);
lua_pushcfunction(L, musicdef_get);
lua_setfield(L, -2, "__index");
lua_pushcfunction(L, musicdef_num);
lua_setfield(L, -2, "__len");
lua_pop(L, 1);
musicdef_fields_ref = Lua_CreateFieldTable(L, musicdef_opt);
lua_register(L, "S_FindMusicCredit", lib_sFindMusicCredit);
lua_newuserdata(L, 0);
lua_createtable(L, 0, 2);
lua_pushcfunction(L, lib_getSprname);
@@ -1176,5 +1292,19 @@ int LUA_InfoLib(lua_State *L)
lua_pushvalue(L, -1);
lua_setglobal(L, "S_sfx");
lua_setglobal(L, "sfxinfo");
lua_newuserdata(L, 0);
lua_createtable(L, 0, 2);
lua_pushcfunction(L, lib_getMusicDef);
lua_setfield(L, -2, "__index");
lua_pushcfunction(L, lib_setMusicDef);
lua_setfield(L, -2, "__newindex");
lua_pushcfunction(L, lib_musicdefslen);
lua_setfield(L, -2, "__len");
lua_setmetatable(L, -2);
lua_setglobal(L, "musicdefs");
return 0;
}
+5 -1
View File
@@ -10,6 +10,9 @@
/// \file lua_libs.h
/// \brief libraries for Lua scripting
#include "doomtype.h"
#include "blua/lua.h"
extern lua_State *gL;
#define LREG_VALID "VALID_USERDATA"
@@ -20,6 +23,7 @@ extern lua_State *gL;
#define META_STATE "STATE_T*"
#define META_MOBJINFO "MOBJINFO_T*"
#define META_SFXINFO "SFXINFO_T*"
#define META_MUSICDEF "MUSICDEF_T*"
#define META_MOBJ "MOBJ_T*"
#define META_MAPTHING "MAPTHING_T*"
@@ -68,4 +72,4 @@ int LUA_SkinLib(lua_State *L);
int LUA_ThinkerLib(lua_State *L);
int LUA_MapLib(lua_State *L);
int LUA_BlockmapLib(lua_State *L);
int LUA_HudLib(lua_State *L);
int LUA_HudLib(lua_State *L);
+63 -98
View File
@@ -1521,7 +1521,6 @@ enum
//op_exp_dirlight,
op_exp_skybox,
op_exp_accuratefps,
op_exp_votescrn,
#ifdef HWRENDER
op_exp_glscrtx,
#ifdef USE_FBO_OGL
@@ -2465,38 +2464,32 @@ static menuitem_t OP_HudOffsetMenu[] =
{IT_STRING | IT_CVAR, NULL, "Vertical Offset", &cv_stat_yoffset, 185},
};
// FIXME: WE EFFECTIVELY HAVE NO MORE SPACE FOR GREEN RES
// i had to put multiple names into single lines at this point
// we ought to really do something better for this at this point
// absolutely crazy how many people put work into this at this point <3
static menuitem_t OP_SaturnCreditsMenu[] =
{
{IT_HEADER, NULL, "Thanks to all contributers <3", NULL, 0},
{IT_HEADER, NULL, "Saturn Credits", NULL, 0},
{IT_STRING2+IT_SPACE, NULL, "Alug", NULL, 10},
{IT_STRING2+IT_SPACE, NULL, "Indev", NULL, 20},
{IT_STRING2+IT_SPACE, NULL, "Haya", NULL, 30},
{IT_STRING2+IT_SPACE, NULL, "Nepdisk", NULL, 40},
{IT_STRING2+IT_SPACE, NULL, "GenericHeroGuy", NULL, 50},
{IT_STRING2+IT_SPACE, NULL, "xyzzy", NULL, 60},
{IT_STRING2+IT_SPACE, NULL, "Chearii", NULL, 70},
{IT_STRING2+IT_SPACE, NULL, "riomccloud", NULL, 80},
{IT_STRING2+IT_SPACE, NULL, "chromaticpipe", NULL, 90},
{IT_STRING2+IT_SPACE, NULL, "PAS", NULL, 100},
{IT_STRING2+IT_SPACE, NULL, "$HOME", NULL, 110},
{IT_STRING2+IT_SPACE, NULL, "Achii", NULL, 120},
{IT_STRING2+IT_SPACE, NULL, "Anonimus", NULL, 130},
{IT_STRING2+IT_SPACE, NULL, "scizor300", NULL, 140},
{IT_STRING2+IT_SPACE, NULL, "Lugent", NULL, 150},
{IT_HEADER, NULL, "Thanks to all contributers <3", NULL, 7},
{IT_HEADER, NULL, "", NULL, 124},
{IT_STRING2+IT_SPACE, NULL, "Alug", NULL, 17},
{IT_STRING2+IT_SPACE, NULL, "Indev", NULL, 27},
{IT_STRING2+IT_SPACE, NULL, "Haya", NULL, 37},
{IT_STRING2+IT_SPACE, NULL, "Nepdisk", NULL, 47},
{IT_STRING2+IT_SPACE, NULL, "GenericHeroGuy", NULL, 57},
{IT_STRING2+IT_SPACE, NULL, "xyzzy", NULL, 67},
{IT_STRING2+IT_SPACE, NULL, "Chearii", NULL, 77},
{IT_STRING2+IT_SPACE, NULL, "Sunflower Yuz", NULL, 180},
{IT_STRING2+IT_SPACE, NULL, "Democrab EXpand", NULL, 190},
{IT_STRING2+IT_SPACE, NULL, "Nexit Spee", NULL, 200},
{IT_STRING2+IT_SPACE, NULL, "jin", NULL, 210},
{IT_HEADER, NULL, "Special Thanks <3", NULL, 168},
{IT_STRING2+IT_SPACE, NULL, "Sunflower aka AnimeSonic", NULL, 87},
{IT_STRING2+IT_SPACE, NULL, "Yuz aka Yuzler", NULL, 97},
{IT_STRING2+IT_SPACE, NULL, "Democrab", NULL, 107},
{IT_STRING2+IT_SPACE, NULL, "EXpand", NULL, 117},
{IT_STRING2+IT_SPACE, NULL, "Nexit", NULL, 127},
{IT_STRING2+IT_SPACE, NULL, "Spee", NULL, 137},
{IT_STRING2+IT_SPACE, NULL, "jin", NULL, 147},
{IT_STRING2+IT_SPACE, NULL, "riomccloud", NULL, 157},
{IT_STRING2+IT_SPACE, NULL, "chromaticpipe", NULL, 167},
{IT_STRING2+IT_SPACE, NULL, "Achii", NULL, 177},
{IT_STRING2+IT_SPACE, NULL, "Anonimus", NULL, 187},
{IT_STRING2+IT_SPACE, NULL, "scizor300", NULL, 197},
{IT_HEADER, NULL, "Special Thanks <3", NULL, 167},
@@ -2508,7 +2501,7 @@ static menuitem_t OP_SaturnCreditsMenu[] =
{IT_STRING, NULL, "", NULL, 267}, // dummy text II
};
// sry we dont have space for this anymore :c
// sry we dont have space for this anymore :/
/*static const char* OP_CreditTooltips[] =
{
NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,
@@ -3607,8 +3600,8 @@ static void M_ChangeCvar(INT32 choice)
char s[20];
float increment;
increment = FIXED_TO_FLOAT(cv->value)+(choice)*((currentMenu->menuitems[itemOn].status & IT_CV_BIGFLOAT) ? 0.5f : (1.0f/16.0f));
sprintf(s,"%ld%s",(long)increment,M_Ftrim(increment));
increment = (currentMenu->menuitems[itemOn].status & IT_CV_BIGFLOAT) ? 0.5f : (1.0f/16.0f);
sprintf(s, "%f",FIXED_TO_FLOAT(cv->value)+(choice)*increment);
CV_Set(cv, s);
}
else
@@ -5723,16 +5716,8 @@ boolean M_CanShowLevelInList(INT32 mapnum, INT32 gt)
{
case LLM_CREATESERVER:
// Should the map be hidden? <-- well imma wanna toggle it, its just annoying being unable to select hell maps in mapselect
if (mapheaderinfo[mapnum]->menuflags & LF2_HIDEINMENU && mapnum+1 != gamemap)
{
if (cv_showallmaps.value &&
((gt == GT_RACE && (mapheaderinfo[mapnum]->typeoflevel & TOL_RACE)) || // race map hell
((gt == GT_MATCH || gt == GT_TEAMMATCH) && (mapheaderinfo[mapnum]->typeoflevel & TOL_MATCH)))) // battle map hell
return true;
else
return false;
}
if ((mapheaderinfo[mapnum]->menuflags & LF2_HIDEINMENU && mapnum+1 != gamemap) && (gt == GT_RACE && (mapheaderinfo[mapnum]->typeoflevel & TOL_RACE))) // map hell
return cv_showallmaps.value;
// same goes here, just show every map if i want to
if (M_MapLocked(mapnum+1)) // not unlocked
@@ -6074,8 +6059,8 @@ static void M_AddonsOptions(INT32 choice)
M_SetupNextMenu(&OP_AddonsOptionsDef);
}
#define LOCATIONSTRING1 "Visit \x83mb.srb2.org/addons\x80 to get & make addons!"
#define LOCATIONSTRING2 "Visit \x88mb.srb2.org/addons\x80 to get & make addons!"
#define LOCATIONSTRING1 "Visit \x83SRB2.ORG/MODS\x80 to get & make addons!"
#define LOCATIONSTRING2 "Visit \x88SRB2.ORG/MODS\x80 to get & make addons!"
static void M_AddonsInternal(void)
{
@@ -7182,11 +7167,8 @@ static void DrawReplayHutReplayInfo(void)
if (mapheaderinfo[demolist[dir_on[menudepthleft]].map-1])
{
char *title = G_BuildMapTitle(demolist[dir_on[menudepthleft]].map);
if (title)
{
V_DrawString(x, y, V_SNAPTOTOP|MENUCAPS, title);
Z_Free(title);
}
V_DrawString(x, y, V_SNAPTOTOP|MENUCAPS, title);
Z_Free(title);
}
else
V_DrawString(x, y, V_SNAPTOTOP|V_ALLOWLOWERCASE|V_TRANSLUCENT, "Level is not loaded.");
@@ -8138,9 +8120,6 @@ UINT8 skyRoomMenuTranslations[MAXUNLOCKABLES];
static char *M_GetConditionString(condition_t cond)
{
char *title = NULL;
char *response = NULL;
switch(cond.type)
{
case UC_PLAYTIME:
@@ -8167,45 +8146,33 @@ static char *M_GetConditionString(condition_t cond)
G_TicsToSeconds(cond.requirement));
case UC_MAPVISITED:
{
title = G_BuildMapTitle(cond.requirement-1);
if (title)
{
response = va("Visit %s", title);
Z_Free(title);
}
char *title = G_BuildMapTitle(cond.requirement-1);
char *response = va("Visit %s", title);
Z_Free(title);
return response;
}
case UC_MAPBEATEN:
{
title = G_BuildMapTitle(cond.requirement-1);
if (title)
{
response = va("Beat %s", title);
Z_Free(title);
}
char *title = G_BuildMapTitle(cond.requirement-1);
char *response = va("Beat %s", title);
Z_Free(title);
return response;
}
case UC_MAPALLEMERALDS:
{
title = G_BuildMapTitle(cond.requirement-1);
if (title)
{
response = va("Beat %s w/ all emeralds", title);
Z_Free(title);
}
char *title = G_BuildMapTitle(cond.requirement-1);
char *response = va("Beat %s w/ all emeralds", title);
Z_Free(title);
return response;
}
case UC_MAPTIME:
{
title = G_BuildMapTitle(cond.extrainfo1-1);
if (title)
{
response = va("Beat %s in %i:%02i.%02i", title,
G_TicsToMinutes(cond.requirement, true),
G_TicsToSeconds(cond.requirement),
G_TicsToCentiseconds(cond.requirement));
Z_Free(title);
}
char *title = G_BuildMapTitle(cond.extrainfo1-1);
char *response = va("Beat %s in %i:%02i.%02i", title,
G_TicsToMinutes(cond.requirement, true),
G_TicsToSeconds(cond.requirement),
G_TicsToCentiseconds(cond.requirement));
Z_Free(title);
return response;
}
case UC_TOTALEMBLEMS:
@@ -8491,7 +8458,7 @@ static void M_MusicTest(INT32 choice)
{
(void)choice;
if (!S_PrepareSoundTest())
if (!nummusicdefs)
{
M_StartMessage(M_GetText("No selectable tracks found.\n"),NULL,MM_NOTHING);
return;
@@ -8570,33 +8537,33 @@ static void M_DrawMusicTest(void)
{
INT32 t, b, q, m = 128;
if (numsoundtestdefs <= 8)
if (nummusicdefs <= 8)
{
t = 0;
b = numsoundtestdefs - 1;
b = nummusicdefs - 1;
i = 0;
}
else
{
q = m;
m = (5*m)/numsoundtestdefs;
m = (5*m)/nummusicdefs;
if (st_sel < 3)
{
t = 0;
b = 7;
i = 0;
}
else if (st_sel >= numsoundtestdefs-4)
else if (st_sel >= nummusicdefs-4)
{
t = numsoundtestdefs - 8;
b = numsoundtestdefs - 1;
t = nummusicdefs - 8;
b = nummusicdefs - 1;
i = q-m;
}
else
{
t = st_sel - 3;
b = st_sel + 4;
i = (t * (q-m))/(numsoundtestdefs - 8);
i = (t * (q-m))/(nummusicdefs - 8);
}
}
@@ -8605,7 +8572,7 @@ static void M_DrawMusicTest(void)
if (t != 0)
V_DrawString(20+280+4, 60+4 - (skullAnimCounter/5), V_YELLOWMAP, "\x1A");
if (b != numsoundtestdefs - 1)
if (b != nummusicdefs - 1)
V_DrawString(20+280+4, 60+128-12 + (skullAnimCounter/5), V_YELLOWMAP, "\x1B");
x = 24;
@@ -8619,8 +8586,9 @@ static void M_DrawMusicTest(void)
V_DrawFill(20, y-4, 280-1, 16, 237);
{
const musicdef_t *def = S_GetMusicCredit(t);
const size_t MAXLENGTH = 34;
const char *songname = soundtestdefs[t]->title[0] ? soundtestdefs[t]->title : soundtestdefs[t]->source;
const char *songname = def->title[0] ? def->title : def->source;
size_t namelength = strlen(songname);
@@ -8633,7 +8601,7 @@ static void M_DrawMusicTest(void)
buf[MAXLENGTH] = 0;
V_DrawString(x, y, (t == st_sel ? V_YELLOWMAP : 0)|V_ALLOWLOWERCASE|V_MONOSPACE, buf);
if (curplaying == soundtestdefs[t])
if (curplaying == def)
{
V_DrawFill(20+280-9, y-4, 8, 16, 230);
}
@@ -8651,7 +8619,7 @@ static void M_HandleMusicTest(INT32 choice)
switch (choice)
{
case KEY_DOWNARROW:
if (st_sel++ >= numsoundtestdefs-1)
if (st_sel++ >= nummusicdefs-1)
st_sel = 0;
{
S_StartSound(NULL, sfx_menu1);
@@ -8660,18 +8628,18 @@ static void M_HandleMusicTest(INT32 choice)
break;
case KEY_UPARROW:
if (!st_sel--)
st_sel = numsoundtestdefs-1;
st_sel = nummusicdefs-1;
{
S_StartSound(NULL, sfx_menu1);
}
st_musictime = 0;
break;
case KEY_PGDN:
if (st_sel < numsoundtestdefs-1)
if (st_sel < nummusicdefs-1)
{
st_sel += 3;
if (st_sel >= numsoundtestdefs-1)
st_sel = numsoundtestdefs-1;
if (st_sel >= nummusicdefs-1)
st_sel = nummusicdefs-1;
S_StartSound(NULL, sfx_menu1);
}
st_musictime = 0;
@@ -8705,7 +8673,7 @@ static void M_HandleMusicTest(INT32 choice)
case KEY_ENTER:
S_StopSounds();
S_StopMusic();
curplaying = soundtestdefs[st_sel];
curplaying = S_GetMusicCredit(st_sel);
S_ChangeMusicInternal(curplaying->name, true);
break;
@@ -8714,9 +8682,6 @@ static void M_HandleMusicTest(INT32 choice)
}
if (exitmenu)
{
Z_Free(soundtestdefs);
soundtestdefs = NULL;
if (currentMenu->prevMenu)
M_SetupNextMenu(currentMenu->prevMenu);
else
-19
View File
@@ -1965,25 +1965,6 @@ char *M_GetToken(const char *inputString)
return texturesToken;
}
const char * M_Ftrim (double f)
{
static char dig[9];/* "0." + 6 digits (6 is printf's default) */
int i;
/* I know I said it's the default, but just in case... */
sprintf(dig, "%.6f", fabs(modf(f, &f)));
/* trim trailing zeroes */
for (i = strlen(dig)-1; dig[i] == '0'; --i)
;
if (dig[i] == '.')/* :NOTHING: */
return "";
else
{
dig[i + 1] = '\0';
return &dig[1];/* skip the 0 */
}
}
/** Count bits in a number.
*/
UINT8 M_CountBits(UINT32 num, UINT8 size)
-6
View File
@@ -104,12 +104,6 @@ boolean M_IsPathAbsolute (const char *path);
void M_MkdirEach (const char *path, int start, int mode);
void M_MkdirEachUntil (const char *path, int start, int end, int mode);
/*
Return dot and then the fractional part of a float, without
trailing zeros, or "" if the fractional part is zero.
*/
const char * M_Ftrim (double);
// counting bits, for weapon ammo code, usually
FUNCMATH UINT8 M_CountBits(UINT32 num, UINT8 size);
-6
View File
@@ -26,12 +26,6 @@
#if defined (STDC_HEADERS) || defined (_LIBC)
#include <stdlib.h>
#else
#ifndef HAVE_MEMCPY
#if !(defined (_WIN32) && !defined (__CYGWIN__)) && !defined (__APPLE__)
#define memcpy(d, s, n) bcopy ((s), (d), (n))
#endif
#endif
#endif
#include "md5.h"
+1 -3
View File
@@ -1542,17 +1542,15 @@ void P_KillMobj(mobj_t *target, mobj_t *inflictor, mobj_t *source)
{
if (target->target->hnext)
K_KillBananaChain(target->target->hnext, inflictor, source);
target->target->player->kartstuff[k_itemamount] = 0;
}
else
else if (target->target->player->kartstuff[k_itemamount])
target->target->player->kartstuff[k_itemamount]--;
}
else if ((target->type == MT_ORBINAUT_SHIELD && target->target->player->kartstuff[k_itemtype] == KITEM_ORBINAUT) // orbit items
|| (target->type == MT_JAWZ_SHIELD && target->target->player->kartstuff[k_itemtype] == KITEM_JAWZ))
{
target->target->player->kartstuff[k_itemamount]--;
if (target->lastlook != 0)
{
K_RepairOrbitChain(target);
-2
View File
@@ -158,8 +158,6 @@ extern consvar_t cv_tiltsmoothing;
extern consvar_t cv_actionmovie;
extern consvar_t cv_screenquake;
extern consvar_t cv_lookbackmom[MAXSPLITSCREENPLAYERS];
extern consvar_t cv_verticallook[MAXSPLITSCREENPLAYERS];
+7 -2
View File
@@ -2747,6 +2747,8 @@ static void P_SetupPlayer(void)
I_mkdir(va("%s"PATHSEP"replay", srb2home), 0755);
I_mkdir(va("%s"PATHSEP"replay"PATHSEP"online", srb2home), 0755);
G_RecordDemo(buf);
if (dedicated)
G_BeginRecording(); //this has to move here, since dedicated servers dont run got_mapcmd
}
wantedcalcdelay = wantedfrequency*2;
@@ -2866,9 +2868,12 @@ boolean P_SetupLevel(boolean fromnetsave, boolean reloadinggamestate)
F_WipeStartScreen();
V_DrawFill(0, 0, BASEVIDWIDTH, BASEVIDHEIGHT, levelfadecol);
F_WipeEndScreen();
F_RunWipe(wipedefs[(encoremode ? wipe_level_final : wipe_level_toblack)], false);
}
else //dedicated servers
{
F_RunWipe(wipedefs[(encoremode ? wipe_level_final : wipe_level_toblack)], false);
}
F_RunWipe(wipedefs[(encoremode ? wipe_level_final : wipe_level_toblack)], false);
}
// Reset the palette now all fades have been done
+3 -4
View File
@@ -573,7 +573,7 @@ static void P_RunQuakes(void)
{
fixed_t ir;
if (!cv_screenquake.value || quake.time <= 0)
if (quake.time <= 0)
{
quake.x = quake.y = quake.z = quake.roll = 0;
return;
@@ -618,8 +618,8 @@ static inline void P_ResetSpriteStuff(void)
if (!mo || (mo->sprite == SPR_NULL) || (mo->flags2 & MF2_DONTDRAW) || (mo->type == MT_SHADOW))
continue;
mo->spritexscale = mo->realxscale;
mo->spriteyscale = mo->realyscale;
mo->spritexscale = mo->realxscale;
mo->spriteyscale = mo->realyscale;
mo->spritexoffset = mo->realxoffset;
mo->spriteyoffset = mo->realyoffset;
}
@@ -654,7 +654,6 @@ void P_Ticker(boolean run)
{
P_MapStart();
R_UpdateMobjInterpolators();
R_UpdateLevelInterpolators();
OP_ObjectplaceMovement(&players[0]);
P_MoveChaseCamera(&players[0], &camera[0], false);
R_UpdateViewInterpolation();
-2
View File
@@ -3044,8 +3044,6 @@ consvar_t cv_tiltsmoothing = {"tiltsmoothing", "32", CV_SAVE, CV_Natural, NULL,
consvar_t cv_actionmovie = {"actionmovie", "Off", CV_SAVE, CV_OnOff, NULL, 0, NULL, NULL, 0, 0, NULL};
consvar_t cv_screenquake = {"quakescreenshake", "On", CV_SAVE, CV_OnOff, NULL, 0, NULL, NULL, 0, 0, NULL};
static CV_PossibleValue_t lookbackmom_cons_t[] = {{0, "Off"}, {1, "On"}, {2, "Double"}, {0, NULL}};
consvar_t cv_lookbackmom[MAXSPLITSCREENPLAYERS] = {
+5 -5
View File
@@ -264,12 +264,12 @@ sector_t *R_FakeFlat(sector_t *sec, sector_t *tempsec, INT32 *floorlightlevel,
mobj_t *pviewmobj = viewplayer->mo;
INT32 heightsec;
boolean underwater;
camera_t *thiscam = &camera[R_GetViewNumber()];
UINT8 i = R_GetViewNumber();
if (thiscam->chase)
heightsec = thiscam->subsector->sector->heightsec;
else if (viewmobj)
heightsec = pviewmobj->subsector->sector->heightsec;
if (viewplayer == &players[displayplayers[i]] && camera[i].chase)
heightsec = R_PointInSubsector(camera[i].x, camera[i].y)->sector->heightsec;
else if (i > splitscreen && viewmobj)
heightsec = R_PointInSubsector(pviewmobj->x, pviewmobj->y)->sector->heightsec;
else
return sec;
+5 -16
View File
@@ -690,15 +690,12 @@ static texpatch_t *R_ParsePatch(boolean actuallyLoadPatch)
// Patch identifier
texturesToken = M_GetToken(NULL);
if (texturesToken == NULL)
{
I_Error("Error parsing TEXTURES lump: Unexpected end of file where patch name should be");
}
texturesTokenLength = strlen(texturesToken);
if (texturesTokenLength > 8)
if (texturesTokenLength>8)
{
I_Error("Error parsing TEXTURES lump: Patch name \"%s\" exceeds 8 characters",texturesToken);
}
@@ -716,12 +713,10 @@ static texpatch_t *R_ParsePatch(boolean actuallyLoadPatch)
// Comma 1
Z_Free(texturesToken);
texturesToken = M_GetToken(NULL);
if (texturesToken == NULL)
{
I_Error("Error parsing TEXTURES lump: Unexpected end of file where comma after \"%s\"'s patch name should be",patchName);
}
if (strcmp(texturesToken,",")!=0)
{
I_Error("Error parsing TEXTURES lump: Expected \",\" after %s's patch name, got \"%s\"",patchName,texturesToken);
@@ -730,17 +725,14 @@ static texpatch_t *R_ParsePatch(boolean actuallyLoadPatch)
// XPos
Z_Free(texturesToken);
texturesToken = M_GetToken(NULL);
if (texturesToken == NULL)
{
I_Error("Error parsing TEXTURES lump: Unexpected end of file where patch \"%s\"'s x coordinate should be",patchName);
}
endPos = NULL;
#ifndef AVOID_ERRNO
errno = 0;
#endif
patchXPos = strtol(texturesToken,&endPos,10);
(void)patchXPos; //unused for now
if (endPos == texturesToken // Empty string
@@ -756,12 +748,10 @@ static texpatch_t *R_ParsePatch(boolean actuallyLoadPatch)
// Comma 2
Z_Free(texturesToken);
texturesToken = M_GetToken(NULL);
if (texturesToken == NULL)
{
I_Error("Error parsing TEXTURES lump: Unexpected end of file where comma after patch \"%s\"'s x coordinate should be",patchName);
}
if (strcmp(texturesToken,",")!=0)
{
I_Error("Error parsing TEXTURES lump: Expected \",\" after patch \"%s\"'s x coordinate, got \"%s\"",patchName,texturesToken);
@@ -770,7 +760,6 @@ static texpatch_t *R_ParsePatch(boolean actuallyLoadPatch)
// YPos
Z_Free(texturesToken);
texturesToken = M_GetToken(NULL);
if (texturesToken == NULL)
{
I_Error("Error parsing TEXTURES lump: Unexpected end of file where patch \"%s\"'s y coordinate should be",patchName);
@@ -1142,9 +1131,9 @@ static void R_InitExtraColormaps(void)
lumpnum_t R_GetFlatNumForName(const char *name)
{
INT32 i;
lumpnum_t lump = LUMPERROR;
lumpnum_t start = LUMPERROR;
lumpnum_t end = LUMPERROR;
lumpnum_t lump;
lumpnum_t start;
lumpnum_t end;
// Scan wad files backwards so patched flats take preference.
for (i = numwadfiles - 1; i >= 0; i--)
@@ -1619,7 +1608,7 @@ const char *R_ColormapNameForNum(INT32 num)
if (num == -1)
return "NONE";
if (num < 0 || num >= MAXCOLORMAPS)
if (num < 0 || num > MAXCOLORMAPS)
I_Error("R_ColormapNameForNum: num %d is invalid!\n", num);
if (foundcolormaps[num] == LUMPERROR)
+20 -8
View File
@@ -42,13 +42,13 @@ static CV_PossibleValue_t fpscap_cons_t[] = {
{0, NULL}
};
consvar_t cv_fpscap = {"fpscap", "Match refresh rate", CV_SAVE, fpscap_cons_t, NULL, 0, NULL, NULL, 0, 0, NULL};
consvar_t cv_fpscap = {"fpscap", "Match refresh rate", CV_SAVE, fpscap_cons_t, NULL, 0, NULL, NULL, 0, 0, NULL};
consvar_t cv_fpscapbg = {"fpscapbackground", "Match refresh rate", CV_SAVE, fpscap_cons_t, NULL, 0, NULL, NULL, 0, 0, NULL};
consvar_t cv_precipinterp = {"precipinterpolation", "On", CV_SAVE, CV_OnOff, NULL, 0, NULL, NULL, 0, 0, NULL};
ps_metric_t ps_interp_frac = {0};
ps_metric_t ps_interp_lag = {0};
ps_metric_t ps_interp_lag = {0};
static boolean R_UseBackgroundFramerateCap(void)
{
@@ -67,21 +67,21 @@ static boolean R_UseBackgroundFramerateCap(void)
return false;
}
static UINT32 R_GetFrameCap(INT32 val)
static UINT32 R_GetBackgroundFramerateCap(void)
{
if (val == 0)
if (cv_fpscapbg.value == 0)
{
// 0: Match refresh rate
return I_GetRefreshRate();
}
if (val < 0)
if (cv_fpscapbg.value < 0)
{
// -1: Unlimited
return 0;
}
return val;
return cv_fpscapbg.value;
}
UINT32 R_GetFramerateCap(void)
@@ -95,10 +95,22 @@ UINT32 R_GetFramerateCap(void)
if (R_UseBackgroundFramerateCap())
{
return R_GetFrameCap(cv_fpscapbg.value);
return R_GetBackgroundFramerateCap();
}
return R_GetFrameCap(cv_fpscap.value);
if (cv_fpscap.value == 0)
{
// 0: Match refresh rate
return I_GetRefreshRate();
}
if (cv_fpscap.value < 0)
{
// -1: Unlimited
return 0;
}
return cv_fpscap.value;
}
boolean R_UsingFrameInterpolation(void)
+27 -30
View File
@@ -125,23 +125,24 @@ static CV_PossibleValue_t drawdist_cons_t[] = {
{8192, "8192"}, {12288, "12288"}, {20480, "20480"},
{24576, "24576"},{0, "Infinite"}, {0, NULL}};
#if defined(__x86_64__) || defined(__amd64__) || defined(__aarch64__) || defined(__arm64__) // only for 64bit (idk how else to proper check lmao)
#if __SIZEOF_POINTER__ < 8 // only for 64bit
static CV_PossibleValue_t drawdist_precip_cons_t[] = {
{256, "256"}, {512, "512"}, {768, "768"},
{256, "256"}, {512, "512"}, {768, "768"},
{1024, "1024"}, {1536, "1536"}, {2048, "2048"},
{3072, "3072"}, {4096, "4096"}, {0, "None"}, {0, NULL}};
{0, "None"}, {0, NULL}};
#else
static CV_PossibleValue_t drawdist_precip_cons_t[] = {
{256, "256"}, {512, "512"}, {768, "768"},
{1024, "1024"}, {1536, "1536"}, {2048, "2048"},
{0, "None"}, {0, NULL}};
{256, "256"}, {512, "512"}, {768, "768"},
{1024, "1024"}, {1536, "1536"}, {2048, "2048"},
{3072, "3072"}, {4096, "4096"}, {0, "None"}, {0, NULL}};
#endif
static CV_PossibleValue_t maxinterpdist_cons_t[] = {
/*{256, "256"},*/ {512, "512"}, {768, "768"},
{1024, "1024"}, {1536, "1536"}, {2048, "2048"},
{3072, "3072"}, {4096, "4096"}, {6144, "6144"},
{8192, "8192"}, {0, "Infinite"}, {0, NULL}};
/*{256, "256"},*/ {512, "512"}, {768, "768"},
{1024, "1024"}, {1536, "1536"}, {2048, "2048"},
{3072, "3072"}, {4096, "4096"}, {6144, "6144"},
{8192, "8192"}, {0, "Infinite"}, {0, NULL}};
static CV_PossibleValue_t fov_cons_t[] = {{MINFOV*FRACUNIT, "MIN"}, {MAXFOV*FRACUNIT, "MAX"}, {0, NULL}};
@@ -171,14 +172,14 @@ consvar_t cv_tailspickup = {"tailspickup", "On", CV_NETVAR|CV_NOSHOWHELP, CV_OnO
consvar_t cv_precachetextures = {"precachetextures", "On", CV_SAVE, CV_OnOff, NULL, 0, NULL, NULL, 0, 0, NULL};
consvar_t cv_chasecam[MAXSPLITSCREENPLAYERS] = {
{"chasecam", "On", 0, CV_OnOff, NULL, 0, NULL, NULL, 0, 0, NULL},
{"chasecam", "On", 0, CV_OnOff, NULL, 0, NULL, NULL, 0, 0, NULL},
{"chasecam2", "On", 0, CV_OnOff, NULL, 0, NULL, NULL, 0, 0, NULL},
{"chasecam3", "On", 0, CV_OnOff, NULL, 0, NULL, NULL, 0, 0, NULL},
{"chasecam4", "On", 0, CV_OnOff, NULL, 0, NULL, NULL, 0, 0, NULL}
};
consvar_t cv_flipcam[MAXSPLITSCREENPLAYERS] = {
{"flipcam", "No", CV_SAVE|CV_CALL|CV_NOINIT, CV_YesNo, FlipCam_OnChange, 0, NULL, NULL, 0, 0, NULL},
{"flipcam", "No", CV_SAVE|CV_CALL|CV_NOINIT, CV_YesNo, FlipCam_OnChange, 0, NULL, NULL, 0, 0, NULL},
{"flipcam2", "No", CV_SAVE|CV_CALL|CV_NOINIT, CV_YesNo, FlipCam2_OnChange, 0, NULL, NULL, 0, 0, NULL},
{"flipcam3", "No", CV_SAVE|CV_CALL|CV_NOINIT, CV_YesNo, FlipCam3_OnChange, 0, NULL, NULL, 0, 0, NULL},
{"flipcam4", "No", CV_SAVE|CV_CALL|CV_NOINIT, CV_YesNo, FlipCam4_OnChange, 0, NULL, NULL, 0, 0, NULL}
@@ -200,7 +201,6 @@ consvar_t cv_drawdist = {"drawdist", "Infinite", CV_SAVE, drawdist_cons_t, NULL,
consvar_t cv_drawdist_precip = {"drawdist_precip", "1024", CV_SAVE|CV_CALL|CV_NOINIT, drawdist_precip_cons_t, Precipstuff_OnChange, 0, NULL, NULL, 0, 0, NULL};
consvar_t cv_lessprecip = {"lessweathereffects", "Off", CV_SAVE|CV_CALL|CV_NOINIT, CV_OnOff, Precipstuff_OnChange, 0, NULL, NULL, 0, 0, NULL};
consvar_t cv_mobjscaleprecip = {"scaleprecipmobjscale", "Off", CV_SAVE|CV_CALL|CV_NOINIT, CV_OnOff, Precipstuff_OnChange, 0, NULL, NULL, 0, 0, NULL};
consvar_t cv_playerfade = {"playerfade", "Off", CV_SAVE, CV_OnOff, NULL, 0, NULL, NULL, 0, 0, NULL};
consvar_t cv_maxinterpdist = {"maxinterpdist", "Infinite", CV_SAVE, maxinterpdist_cons_t, NULL, 0, NULL, NULL, 0, 0, NULL};
@@ -403,8 +403,7 @@ angle_t R_PlayerSliptideAngle(player_t *player)
sprframe = &sprdef->spriteframes[rot];
// No sprite frame? I guess it is possible
if (!sprframe)
return 0;
if (!sprframe) return 0;
if (sprframe->rotate != SRF_SINGLE || (mo->frame & FF_PAPERSPRITE))
ang = R_PointToAngle(mo->x, mo->y) - mo->angle;
@@ -464,7 +463,6 @@ boolean R_DoCulling(line_t *cullheight, line_t *viewcullheight, fixed_t vz, fixe
return false;
cullplane = cullheight->frontsector->floorheight;
if (cullheight->flags & ML_NOCLIMB) // Group culling
{
if (!viewcullheight)
@@ -1065,7 +1063,7 @@ static void R_SetupCommonFrame(player_t * player, sector_t * sector)
static void R_SetupAimingFrame(player_t *player, camera_t *thiscam)
{
if (player->awayviewtics && player->awayviewmobj)
if (player->awayviewtics)
{
newview->aim = player->awayviewaiming;
newview->angle = player->awayviewmobj->angle;
@@ -1171,7 +1169,7 @@ void R_SkyboxFrame(int s)
{
mapheader_t *mh = mapheaderinfo[gamemap-1];
if (player->awayviewtics && player->awayviewmobj)
if (player->awayviewtics)
{
SETUPSKYVIEW(player->awayviewmobj, (player->awayviewmobj->z + 20*FRACUNIT));
}
@@ -1228,7 +1226,7 @@ void R_SetupFrame(int s, boolean skybox)
R_SetupAimingFrame(player, thiscam);
if (player->awayviewtics && player->awayviewmobj) // cut-away view stuff
if (player->awayviewtics) // cut-away view stuff
{
viewmobj = player->awayviewmobj; // should be a MT_ALTVIEWMAN
I_Assert(viewmobj != NULL);
@@ -1237,7 +1235,7 @@ void R_SetupFrame(int s, boolean skybox)
newview->y = viewmobj->y;
newview->z = viewmobj->z + 20*FRACUNIT;
if (viewmobj->subsector && viewmobj->subsector->sector)
if (!P_MobjWasRemoved(viewmobj) && viewmobj->subsector && viewmobj->subsector->sector)
sector = viewmobj->subsector->sector;
R_SetupCommonFrame(player, sector);
@@ -1255,7 +1253,7 @@ void R_SetupFrame(int s, boolean skybox)
R_SetupCommonFrame(player, sector);
}
else if (player->mo) // use the player's eyes view
else // use the player's eyes view
{
viewmobj = player->mo;
I_Assert(viewmobj != NULL);
@@ -1264,7 +1262,7 @@ void R_SetupFrame(int s, boolean skybox)
newview->y = viewmobj->y;
newview->z = player->viewz;
if (viewmobj->subsector && viewmobj->subsector->sector)
if (!P_MobjWasRemoved(viewmobj) && viewmobj->subsector && viewmobj->subsector->sector)
sector = viewmobj->subsector->sector;
R_SetupCommonFrame(player, sector);
@@ -1352,10 +1350,10 @@ void R_RenderPlayerView(player_t *player)
for (UINT8 j = 0; j <= splitscreen; j++)
{
if (player == &players[displayplayers[j]]
&& viewfov[j] != fov)
if (player == &players[displayplayers[i]]
&& viewfov[i] != fov)
{
viewfov[j] = fov;
viewfov[i] = fov;
R_SetFov(fov);
}
}
@@ -1525,6 +1523,10 @@ void R_RegisterEngineStuff(void)
CV_RegisterVar(&cv_fovchange);
CV_RegisterVar(&cv_fov);
for (i = 0; i < MAXSPLITSCREENPLAYERS; i++)
{
CV_RegisterVar(&cv_chasecam[i]);
}
CV_RegisterVar(&cv_shadow);
CV_RegisterVar(&cv_shadowoffs);
CV_RegisterVar(&cv_skybox);
@@ -1533,8 +1535,6 @@ void R_RegisterEngineStuff(void)
for (i = 0; i < MAXSPLITSCREENPLAYERS; i++)
{
CV_RegisterVar(&cv_chasecam[i]);
CV_RegisterVar(&cv_cam_dist[i]);
CV_RegisterVar(&cv_cam_still[i]);
CV_RegisterVar(&cv_cam_height[i]);
@@ -1551,8 +1551,6 @@ void R_RegisterEngineStuff(void)
CV_RegisterVar(&cv_tiltsmoothing);
CV_RegisterVar(&cv_actionmovie);
CV_RegisterVar(&cv_screenquake);
CV_RegisterVar(&cv_driftsparkpulse);
CV_RegisterVar(&cv_gravstretch);
CV_RegisterVar(&cv_sloperoll);
@@ -1570,7 +1568,6 @@ void R_RegisterEngineStuff(void)
CV_RegisterVar(&cv_randomdirlight);
CV_RegisterVar(&cv_maxinterpdist);
CV_RegisterVar(&cv_playerfade);
CV_RegisterVar(&cv_ripplewater);
-1
View File
@@ -213,7 +213,6 @@ extern consvar_t cv_fov, cv_fovchange;
extern consvar_t cv_skybox;
extern consvar_t cv_tailspickup;
extern consvar_t cv_maxinterpdist;
extern consvar_t cv_playerfade;
extern consvar_t cv_ripplewater;
extern consvar_t cv_randomdirlight;
+2 -38
View File
@@ -716,13 +716,6 @@ static void R_DrawFlippedMaskedColumn(column_t *column)
dc_texturemid = basetexturemid;
}
// Based off of R_GetLinedefTransTable
static transnum_t R_GetThingTransTable(fixed_t alpha, transnum_t transmap)
{
return (20*(FRACUNIT - ((alpha * (10 - transmap))/10) - 1) + FRACUNIT) >> (FRACBITS+1);
}
//
// R_DrawVisSprite
// mfloorclip and mceilingclip should also be set.
@@ -830,8 +823,8 @@ static void R_DrawVisSprite(vissprite_t *vis)
frac = vis->startfrac;
windowtop = windowbottom = sprbotscreen = INT32_MAX;
//if ((vis->mobj->skin || vis->mobj->localskin) && K_GetMobjSkin(vis->mobj)->flags & SF_HIRES)
// this_scale = FixedMul(this_scale, K_GetMobjSkin(vis->mobj)->highresscale);
if ((vis->mobj->skin || vis->mobj->localskin) && K_GetMobjSkin(vis->mobj)->flags & SF_HIRES)
this_scale = FixedMul(this_scale, K_GetMobjSkin(vis->mobj)->highresscale);
if (this_scale <= 0)
this_scale = 1;
@@ -1586,9 +1579,6 @@ static void R_ProjectSprite(mobj_t *thing)
else
trans = 0;
if (cv_playerfade.value && oldthing->player)
trans = R_GetThingTransTable(R_DoPlayerFade(oldthing), trans);
//SoM: 3/17/2000: Disregard sprites that are out of view..
if (vflip)
{
@@ -2898,32 +2888,6 @@ boolean R_ThingWithinDist(mobj_t *thing, INT32 limit_dist)
return true;
}
fixed_t R_DoPlayerFade(mobj_t *thing)
{
fixed_t fadealpha = FRACUNIT;
static const tic_t countdownstarttime = (15 * TICRATE) / 4; // starttime - (3*TICRATE)
if (thing->player == viewplayer || viewplayer->exiting || camera[R_GetViewNumber()].freecam || leveltime < countdownstarttime)
return fadealpha;
const INT32 playerdist = (FixedMul((thing->x - viewx), viewcos) + FixedMul((thing->y - viewy), viewsin)) >> FRACBITS;
const INT32 viewplayerdist = (FixedMul((viewplayer->mo->x - viewx), viewcos) + FixedMul((viewplayer->mo->y - viewy), viewsin)) >> FRACBITS;
if (playerdist < viewplayerdist)
{
if (playerdist < viewplayerdist / 2) // stronger fade when very close
{
fadealpha = (playerdist * FRACUNIT) / (viewplayerdist / 2) / 3;
}
else
{
fadealpha = (playerdist * FRACUNIT) / viewplayerdist;
}
}
return fadealpha;
}
boolean R_ThingIsFullBright(mobj_t *thing)
{
return ((thing->frame & FF_BRIGHTMASK) == FF_FULLBRIGHT);
-2
View File
@@ -76,8 +76,6 @@ void R_InitSprites(void);
void R_ClearSprites(void);
void R_DrawMasked(void);
fixed_t R_DoPlayerFade(mobj_t *thing);
boolean R_ThingVisible (mobj_t *thing);
boolean R_ThingWithinDist (mobj_t *thing, INT32 limit_dist);
+65 -54
View File
@@ -32,6 +32,7 @@
#include "m_menu.h" // bird music stuff
#include "lua_hook.h" // MusicChange hook
#include "lua_hud.h" // LUA_HudEnabled(hud_musiccredit)
static boolean S_AdjustSoundParams(const mobj_t *listener, const mobj_t *source, INT32 *vol, INT32 *sep, INT32 *pitch, sfxinfo_t *sfxinfo);
static void SetChannelsNum(void);
@@ -1202,8 +1203,58 @@ static consvar_t *music_refade_cv;
/// Music Definitions
/// ------------------------
musicdef_t *musicdefstart = NULL; // First music definition
struct cursongcredit cursongcredit; // Currently displayed song credit info
// Similar system to vissprite allocation. Exists so external pointers to musicdefs are not invalidated
// when allocating more space for musicdefs
#define MUSICDEFCHUNKBITS 6
#define MUSICDEFSPERCHUNK (1 << MUSICDEFCHUNKBITS)
#define MUSICDEFINDEXMASK (MUSICDEFSPERCHUNK - 1)
static musicdef_t **musicdefs = NULL;
static INT32 numchunks = 0;
INT32 nummusicdefs = 0;
//
// S_GetMusicCredit
//
// Return music credit with given index.
//
musicdef_t *S_GetMusicCredit(INT32 i)
{
if (i < 0 || i >= nummusicdefs)
return NULL;
INT32 chunk = i >> MUSICDEFCHUNKBITS;
i &= MUSICDEFINDEXMASK;
return &musicdefs[chunk][i];
}
//
// S_AddMusicCredit
//
// Return new music credit, allocates memory for it if needed.
//
static musicdef_t *S_AddMusicCredit(void)
{
INT32 chunk = nummusicdefs >> MUSICDEFCHUNKBITS;
INT32 i = nummusicdefs & MUSICDEFINDEXMASK;
// Allocate new chunk if needed. Other chunks stay valid
if (chunk == numchunks)
{
++numchunks;
musicdefs = (musicdef_t**)Z_Realloc(musicdefs, sizeof(musicdef_t*)*numchunks, PU_STATIC, NULL);
musicdefs[chunk] = Z_Calloc(sizeof(musicdef_t)*MUSICDEFSPERCHUNK, PU_STATIC, NULL);
}
// Store "id" of new musicdef (mostly exists only for lua)
musicdefs[chunk][i].num = nummusicdefs;
++nummusicdefs;
return &musicdefs[chunk][i];
}
struct cursongcredit cursongcredit = {0}; // Currently displayed song credit info
static boolean
ReadMusicDefFields (UINT16 wadnum, int line, char *stoken, musicdef_t **defp)
@@ -1231,14 +1282,11 @@ ReadMusicDefFields (UINT16 wadnum, int line, char *stoken, musicdef_t **defp)
// Nothing found, add to the end.
if (!def)
{
def = Z_Calloc(sizeof (musicdef_t), PU_STATIC, NULL);
def = S_AddMusicCredit();
STRBUFCPY(def->name, value);
strlwr(def->name);
def->hash = quickncasehash (def->name, 6);
def->next = musicdefstart;
musicdefstart = def;
}
(*defp) = def;
@@ -1423,8 +1471,10 @@ musicdef_t *S_FindMusicCredit(const char *musname)
UINT32 hash = quickncasehash (musname, 6);
musicdef_t *def;
for (def = musicdefstart; def; def = def->next)
for (INT32 i = 0; i < nummusicdefs; ++i)
{
def = S_GetMusicCredit(i);
if (hash != def->hash)
continue;
if (stricmp(def->name, musname))
@@ -1452,7 +1502,7 @@ void S_ShowSpecifiedMusicCredit(const char *musname)
def = S_FindMusicCredit(musname);
if (def)
if (def && !LUA_HookMusicCredit(def))
{
cursongcredit.def = def;
cursongcredit.anim = 5*TICRATE;
@@ -1471,41 +1521,6 @@ void S_ShowMusicCredit(void)
S_ShowSpecifiedMusicCredit(music.name);
}
musicdef_t **soundtestdefs = NULL;
INT32 numsoundtestdefs = 0;
//
// S_PrepareSoundTest
//
// Prepare sound test. What am I, your butler?
//
boolean S_PrepareSoundTest(void)
{
musicdef_t *def;
INT32 pos = numsoundtestdefs = 0;
for (def = musicdefstart; def; def = def->next)
{
numsoundtestdefs++;
}
if (!numsoundtestdefs)
return false;
if (soundtestdefs)
Z_Free(soundtestdefs);
if (!(soundtestdefs = Z_Malloc(numsoundtestdefs*sizeof(musicdef_t *), PU_STATIC, NULL)))
I_Error("S_PrepareSoundTest(): could not allocate soundtestdefs.");
for (def = musicdefstart; def /*&& i < numsoundtestdefs*/; def = def->next)
{
soundtestdefs[pos++] = def;
}
return true;
}
/// ------------------------
/// Music Status
/// ------------------------
@@ -2010,7 +2025,7 @@ void S_KeepMusic(void)
}
// Sets up the map music in case it should be reloaded
// Special case for keepmusic
// Special case for keep music
void S_HandleReloadResetMusic(void)
{
if (!(mapmusic.flags & MUSIC_RELOADRESET))
@@ -2035,24 +2050,20 @@ void S_HandleReloadResetMusic(void)
static boolean S_SkipIntroMusic(void)
{
if (!cv_skipintromusic.value)
return false;
boolean skip = cv_skipintromusic.value;
// check if menu music is playing, otherwise it may continue playing
if (!stricmp(music.name, "titles"))
if (!skip)
return false;
char *maptitle = G_BuildMapTitle(gamemap); // Zzz...
if (maptitle && !stricmp(maptitle, "Wandering Falls")) // wandering balls changes its song when the race starts Zzz...
{
Z_Free(maptitle);
return false;
}
// check if menu music is playing, otherwise it may continue playing
if (!stricmp(music.name, "titles") || (maptitle && (!stricmp(maptitle, "Wandering Falls")))) // wandering balls changes its song when the race starts Zzz...
skip = false;
Z_Free(maptitle);
return true;
return skip;
}
//
+3 -8
View File
@@ -182,14 +182,9 @@ typedef struct musicdef_s
char alttitle[256];
char authors[256];
boolean use_info;
struct musicdef_s *next;
size_t num;
} musicdef_t;
extern musicdef_t *musicdefstart;
extern musicdef_t **soundtestdefs;
extern INT32 numsoundtestdefs;
extern UINT8 soundtestpage;
extern struct cursongcredit
{
musicdef_t *def;
@@ -198,17 +193,17 @@ extern struct cursongcredit
UINT8 trans;
} cursongcredit;
extern INT32 nummusicdefs;
void S_LoadMusicDefs(UINT16 wadnum);
void S_InitMusicDefs(void);
void S_LoadMTDefs(UINT16 wadnum);
void S_InitMTDefs(void);
musicdef_t *S_GetMusicCredit(INT32 i);
musicdef_t *S_FindMusicCredit(const char *musname);
void S_ShowSpecifiedMusicCredit(const char *musname);
void S_ShowMusicCredit(void);
boolean S_PrepareSoundTest(void);
//
// Music Seeking
//
+1 -5
View File
@@ -80,9 +80,7 @@ static void Highreshudscale_OnChange(void)
static void SCR_ChangeFullscreen (void);
static CV_PossibleValue_t fullscreen_cons_t[] = {{0, "No"}, {1, "Yes"}, {2, "Borderless Window"}, {0, NULL}};
consvar_t cv_fullscreen = {"fullscreen", "Yes", CV_SAVE|CV_CALL, fullscreen_cons_t, SCR_ChangeFullscreen, 0, NULL, NULL, 0, 0, NULL};
consvar_t cv_fullscreen = {"fullscreen", "Yes", CV_SAVE|CV_CALL, CV_YesNo, SCR_ChangeFullscreen, 0, NULL, NULL, 0, 0, NULL};
static CV_PossibleValue_t accuratefps_cons_t[] = {{0, "Inaccurate"}, {1, "Accurate"}, {0, NULL}};
consvar_t cv_accuratefps = {"fpssampling", "1", CV_SAVE, accuratefps_cons_t, NULL, 0, NULL, NULL, 0, 0, NULL};
@@ -312,8 +310,6 @@ void SCR_SetDefaultMode(void)
void SCR_ChangeFullscreen(void)
{
#ifdef DIRECTFULLSCREEN
I_SetBorderlessWindow(); // Running this here so we can have borderless window at startup
// allow_fullscreen is set by VID_PrepareModeList
// it is used to prevent switching to fullscreen during startup
if (!allow_fullscreen)
+1 -1
View File
@@ -27,7 +27,7 @@
#include <unistd.h>
#endif
#if defined (__unix__) || defined(__APPLE__) || defined (UNIXCOMMON)
#ifdef __unix__
#include <errno.h>
#endif
+1 -4
View File
@@ -110,11 +110,8 @@ typedef LPVOID (WINAPI *p_MapViewOfFile) (HANDLE, DWORD, DWORD, DWORD, SIZE_T);
#endif
#endif
#if defined(UNIXCOMMON)
#include <poll.h>
#endif
#if defined (__unix__) || (defined (UNIXCOMMON) && !defined (__APPLE__))
#include <poll.h>
#include <errno.h>
#include <sys/wait.h>
#define NEWSIGNALHANDLER
+1 -8
View File
@@ -150,7 +150,7 @@ UINT8 graphics_started = 0; // Is used in console.c and screen.c
// To disable fullscreen at startup; is set in VID_PrepareModeList
boolean allow_fullscreen = false;
static SDL_bool disable_fullscreen = SDL_FALSE;
#define USE_FULLSCREEN (disable_fullscreen||!allow_fullscreen)? 0: (cv_fullscreen.value == 1)
#define USE_FULLSCREEN (disable_fullscreen||!allow_fullscreen)?0:cv_fullscreen.value
static SDL_bool disable_mouse = SDL_FALSE;
#define USE_MOUSEINPUT (!disable_mouse && cv_usemouse.value && havefocus)
#define MOUSE_MENU false //(!disable_mouse && cv_usemouse.value && menuactive && !USE_FULLSCREEN)
@@ -273,7 +273,6 @@ static void SDLSetMode(INT32 width, INT32 height, SDL_bool fullscreen)
{
wasfullscreen = SDL_TRUE;
SDL_SetWindowFullscreen(window, SDL_WINDOW_FULLSCREEN_DESKTOP);
I_SetBorderlessWindow();
}
else // windowed mode
{
@@ -2290,10 +2289,4 @@ static void Impl_SetVsync(void)
#endif
}
void I_SetBorderlessWindow(void)
{
SDL_bool borderless = (cv_fullscreen.value == 2) ? SDL_FALSE : SDL_TRUE;
SDL_SetWindowBordered(window, borderless);
}
#endif
+13 -3
View File
@@ -213,10 +213,20 @@ void I_StartupSound(void)
// call to start audio failed -- we do not have it
return;
}
SDL_version SDLmixcompiled;
const SDL_version *SDLmixlinked;
SDL_MIXER_VERSION(&SDLmixcompiled)
SDLmixlinked = Mix_Linked_Version();
I_OutputMsg("Compiled for SDL_mixer version: %d.%d.%d\n",
SDLmixcompiled.major, SDLmixcompiled.minor, SDLmixcompiled.patch);
I_OutputMsg("Linked with SDL_mixer version: %d.%d.%d\n",
SDLmixlinked->major, SDLmixlinked->minor, SDLmixlinked->patch);
#ifdef HAVE_OPENMPT
CONS_Printf("libopenmpt version: %s\n", openmpt_get_string("library_version"));
CONS_Printf("libopenmpt build date: %s\n", openmpt_get_string("build"));
I_OutputMsg("libopenmpt version: %s\n", openmpt_get_string("library_version"));
I_OutputMsg("libopenmpt build date: %s\n", openmpt_get_string("build"));
#endif
sound_started = true;
-1
View File
@@ -1037,7 +1037,6 @@ sfxenum_t S_AddSoundFx(const char *name, boolean singular, INT32 flags, boolean
S_sfx[i].data = I_GetSfx(&S_sfx[i]);
else
S_sfx[i].data = NULL;
return i;
}
}
+17 -18
View File
@@ -187,7 +187,7 @@ void ST_doPaletteStuff(void)
#ifdef HWRENDER
if (rendermode == render_opengl && !HWR_PalRenderFlashpal())
palette = 0; // Don't set the palette to a flashpal in OpenGL's truecolor mode
palette = 0; // No flashpals here in OpenGL
#endif
palette = min(max(palette, 0), 13);
@@ -418,28 +418,27 @@ static void ST_drawDebugInfo(void)
static void ST_drawLevelTitle(void)
{
char *lvlttl, *subttl, *zonttl, *actnum;
INT32 lvlttlxpos, ttlnumxpos, zonexpos;
INT32 dupcalc;
UINT8 gtc;
char *lvlttl = mapheaderinfo[gamemap-1]->lvlttl;
char *subttl = mapheaderinfo[gamemap-1]->subttl;
char *zonttl = mapheaderinfo[gamemap-1]->zonttl; // SRB2kart
char *actnum = mapheaderinfo[gamemap-1]->actnum;
INT32 lvlttlxpos;
INT32 ttlnumxpos;
INT32 zonexpos;
INT32 dupcalc = (vid.width/vid.dupx);
UINT8 gtc = G_GetGametypeColor(gametype);
INT32 sub = 0;
INT32 bary;
INT32 bary = (splitscreen)
? BASEVIDHEIGHT/2
: 163;
INT32 lvlw;
if (!cv_stagetitle.value || (timeinmap > 113))
if (!cv_stagetitle.value)
return;
if (*mapheaderinfo[gamemap-1]->lvlttl == '\0')
if (timeinmap > 113)
return;
lvlttl = mapheaderinfo[gamemap-1]->lvlttl;
subttl = mapheaderinfo[gamemap-1]->subttl;
zonttl = mapheaderinfo[gamemap-1]->zonttl; // SRB2kart
actnum = mapheaderinfo[gamemap-1]->actnum;
dupcalc = (vid.width/vid.dupx);
gtc = G_GetGametypeColor(gametype);
bary = (splitscreen) ? BASEVIDHEIGHT/2 : 163;
lvlw = V_LevelNameWidth(lvlttl);
if (actnum[0])
@@ -603,7 +602,7 @@ static void ST_overlayDrawer(void)
}
// draw level title Tails
if (!(hu_showscores && (netgame || multiplayer) && !mapreset) && LUA_HudEnabled(hud_stagetitle) && !forceshowhud)
if (*mapheaderinfo[gamemap-1]->lvlttl != '\0' && !(hu_showscores && (netgame || multiplayer) && !mapreset) && LUA_HudEnabled(hud_stagetitle) && !forceshowhud)
ST_drawLevelTitle();
if (!hu_showscores && netgame && !mapreset)
@@ -740,7 +739,7 @@ void ST_Drawer(void)
UINT8 i;
#ifdef SEENAMES
if (UNLIKELY(cv_seenames.value && cv_allowseenames.value && displayplayers[0] == consoleplayer && seenplayer && seenplayer->mo && !mapreset))
if (cv_seenames.value && cv_allowseenames.value && displayplayers[0] == consoleplayer && seenplayer && seenplayer->mo && !mapreset)
{
if (cv_seenames.value == 1)
V_DrawCenteredString(BASEVIDWIDTH/2, BASEVIDHEIGHT/2 + 15, V_HUDTRANSHALF, player_names[seenplayer-players]);
-3
View File
@@ -457,9 +457,6 @@ static void LoadPalette(const char *lumpname)
#endif
pLocalPalette[i].s.alpha = 0xFF;
if (!Cubeapply)
continue;
// lerp of colour cubing! if you want, make it smoother yourself
V_CubeApply(&pLocalPalette[i].s.red, &pLocalPalette[i].s.green, &pLocalPalette[i].s.blue);
}
+2 -35
View File
@@ -2039,7 +2039,8 @@ static lumpchecklist_t folderblacklist[] =
{NULL, 0},
};
static int W_VerifyPK3(FILE *fp, lumpchecklist_t *checklist, boolean status)
static int
W_VerifyPK3 (FILE *fp, lumpchecklist_t *checklist, boolean status)
{
int verified = true;
@@ -2081,10 +2082,7 @@ static int W_VerifyPK3(FILE *fp, lumpchecklist_t *checklist, boolean status)
char *cdir = (char*)(malloc(LONG(zend.cdirsize)));
if (fread(cdir, 1, LONG(zend.cdirsize), fp) < (UINT32)(LONG(zend.cdirsize)))
{
free(cdir);
return true;
}
size_t offset = 0;
@@ -2096,10 +2094,7 @@ static int W_VerifyPK3(FILE *fp, lumpchecklist_t *checklist, boolean status)
char* dotpos;
if (memcmp(zentry->signature, pat_central, 4) != 0)
{
free(cdir);
return true;
}
if (verified == true)
{
@@ -2137,16 +2132,10 @@ static int W_VerifyPK3(FILE *fp, lumpchecklist_t *checklist, boolean status)
sizeof *zentry + SHORT(zentry->namelen) + SHORT(zentry->xtralen) + SHORT(zentry->commlen);
if (fseek(fp, LONG(zentry->offset), SEEK_SET) != 0)
{
free(cdir);
return true;
}
if (fread(&zlentry, 1, sizeof(zlentry_t), fp) < sizeof (zlentry_t))
{
free(cdir);
return true;
}
data_size +=
sizeof zlentry + SHORT(zlentry.namelen) + SHORT(zlentry.xtralen) + LONG(zlentry.compsize);
@@ -2197,9 +2186,7 @@ static int W_VerifyFile(const char *filename, lumpchecklist_t *checklist,
goodfile = W_VerifyWAD(handle, checklist, status);
}
}
fclose(handle);
return goodfile;
}
@@ -2354,10 +2341,7 @@ static int W_CheckPK3Contains(FILE *fp, lumpchecklist_t *checklist)
char *cdir = (char*)(malloc(LONG(zend.cdirsize)));
if (fread(cdir, 1, LONG(zend.cdirsize), fp) < (UINT32)(LONG(zend.cdirsize)))
{
free(cdir);
return true;
}
size_t offset = 0;
@@ -2369,10 +2353,7 @@ static int W_CheckPK3Contains(FILE *fp, lumpchecklist_t *checklist)
char* dotpos;
if (memcmp(zentry->signature, pat_central, 4) != 0)
{
free(cdir);
return false;
}
fullname = (char*)(malloc(SHORT(zentry->namelen) + 1));
strlcpy(fullname, (char*)(zentry + 1), SHORT(zentry->namelen) + 1);
@@ -2392,19 +2373,11 @@ static int W_CheckPK3Contains(FILE *fp, lumpchecklist_t *checklist)
strncpy(lumpname, trimname, min(8, dotpos - trimname));
if (W_NameStartsWith(lumpname, checklist))
{
free(fullname);
free(cdir);
return true;
}
}
if (W_NameStartsWith(fullname, checklist))
{
free(fullname);
free(cdir);
return true;
}
free(fullname);
@@ -2414,16 +2387,10 @@ static int W_CheckPK3Contains(FILE *fp, lumpchecklist_t *checklist)
sizeof *zentry + SHORT(zentry->namelen) + SHORT(zentry->xtralen) + SHORT(zentry->commlen);
if (fseek(fp, LONG(zentry->offset), SEEK_SET) != 0)
{
free(cdir);
return false;
}
if (fread(&zlentry, 1, sizeof(zlentry_t), fp) < sizeof (zlentry_t))
{
free(cdir);
return false;
}
data_size +=
sizeof zlentry + SHORT(zlentry.namelen) + SHORT(zlentry.xtralen) + LONG(zlentry.compsize);
+2
View File
@@ -1,3 +1,5 @@
#include <winuser.h>
//Microsoft Developer Studio generated resource script.
//
#include "resource.h"
+10 -63
View File
@@ -149,12 +149,9 @@ void Z_Free(void *ptr)
#endif
#endif
#ifdef ZDEBUG2
#ifdef ZDEBUG
// Write every Z_Free call to a debug file.
CONS_Debug(DBG_MEMORY, "Z_Free at %s:%d\n", file, line);
#elif defined(ZDEBUG)
(void)file;
(void)line;
#endif
// anything that isn't by lua gets passed to lua just in case.
@@ -361,10 +358,8 @@ void *Z_ReallocAlign(void *ptr, size_t size, INT32 tag, void *user, INT32 alignb
return NULL;
#ifdef ZDEBUG
#ifdef ZDEBUG2
// Write every Z_Realloc call to a debug file.
DEBFILE(va("Z_Realloc at %s:%d\n", file, line));
#endif
rez = Z_Malloc2(size, tag, user, alignbits, file, line);
#else
rez = Z_MallocAlign(size, tag, user, alignbits);
@@ -399,19 +394,11 @@ void *Z_ReallocAlign(void *ptr, size_t size, INT32 tag, void *user, INT32 alignb
* \param lowtag The lowest tag to consider.
* \param hightag The highest tag to consider.
*/
#ifdef ZDEBUG
void Z_FreeTags2(INT32 lowtag, INT32 hightag, const char *file, INT32 line)
#else
void Z_FreeTags(INT32 lowtag, INT32 hightag)
#endif
{
memblock_t *block, *next;
#ifdef ZDEBUG
Z_CheckHeap2(file, line);
#else
Z_CheckHeap(420);
#endif
for (block = head.next; block != &head; block = next)
{
next = block->next; // get link before freeing
@@ -481,20 +468,12 @@ void Z_CheckMemCleanup(void)
* \param i Identifies from where in the code Z_CheckHeap was called.
* \author Graue <graue@oceanbase.org>
*/
#ifdef ZDEBUG
void Z_CheckHeap2(const char *file, INT32 line)
#else
void Z_CheckHeap(INT32 tag)
#endif
void Z_CheckHeap(INT32 i)
{
memblock_t *block;
UINT32 blocknumon = 0;
void *given;
#ifndef ZDEBUG
(void)tag;
#endif
for (block = head.next; block != &head; block = block->next)
{
blocknumon++;
@@ -519,19 +498,11 @@ void Z_CheckHeap(INT32 tag)
#endif
if (block->user != NULL && *(block->user) != given)
{
I_Error("Z_CheckHeap"
#ifdef ZDEBUG
"at %s %d :"
#endif
"block %u"
I_Error("Z_CheckHeap %d: block %u"
#ifdef ZDEBUG
"(owned by %s:%d)"
#endif
" doesn't have a proper user"
#ifdef ZDEBUG
, file, line
#endif
, blocknumon
" doesn't have a proper user", i, blocknumon
#ifdef ZDEBUG
, block->ownerfile, block->ownerline
#endif
@@ -539,19 +510,11 @@ void Z_CheckHeap(INT32 tag)
}
if (block->next->prev != block)
{
I_Error("Z_CheckHeap"
#ifdef ZDEBUG
"at %s %d :"
#endif
"block %u"
I_Error("Z_CheckHeap %d: block %u"
#ifdef ZDEBUG
"(owned by %s:%d)"
#endif
" lacks proper backlink"
#ifdef ZDEBUG
, file, line
#endif
, blocknumon
" lacks proper backlink", i, blocknumon
#ifdef ZDEBUG
, block->ownerfile, block->ownerline
#endif
@@ -559,19 +522,11 @@ void Z_CheckHeap(INT32 tag)
}
if (block->prev->next != block)
{
I_Error("Z_CheckHeap"
#ifdef ZDEBUG
"at %s %d :"
#endif
"block %u"
I_Error("Z_CheckHeap %d: block %u"
#ifdef ZDEBUG
"(owned by %s:%d)"
#endif
" lacks proper forward link"
#ifdef ZDEBUG
, file, line
#endif
, blocknumon
" lacks proper forward link", i, blocknumon
#ifdef ZDEBUG
, block->ownerfile, block->ownerline
#endif
@@ -579,19 +534,11 @@ void Z_CheckHeap(INT32 tag)
}
if (block->id != ZONEID)
{
I_Error("Z_CheckHeap"
#ifdef ZDEBUG
"at %s %d :"
#endif
"block %u"
I_Error("Z_CheckHeap %d: block %u"
#ifdef ZDEBUG
"(owned by %s:%d)"
#endif
" have the wrong ID"
#ifdef ZDEBUG
, file, line
#endif
, blocknumon
" have the wrong ID", i, blocknumon
#ifdef ZDEBUG
, block->ownerfile, block->ownerline
#endif
+2 -14
View File
@@ -28,7 +28,7 @@
#define FUNCALLOC(x)
#endif
#define ZDEBUG
//#define ZDEBUG
//
// Purge tags
@@ -110,14 +110,8 @@ void *Z_ReallocAlign(void *ptr, size_t size, INT32 tag, void *user, INT32 alignb
// Free all memory by tag
// these don't give line numbers for ZDEBUG currently though
// (perhaps this should be changed in future?)
#ifdef ZDEBUG
#define Z_FreeTag(tagnum) Z_FreeTags2(tagnum, tagnum, __FILE__, __LINE__)
#define Z_FreeTags(tagnum, tagnum2) Z_FreeTags2(tagnum, tagnum2, __FILE__, __LINE__)
void Z_FreeTags2(INT32 lowtag, INT32 hightag, const char *file, INT32 line);
#else
#define Z_FreeTag(tagnum) Z_FreeTags(tagnum, tagnum)
void Z_FreeTags(INT32 lowtag, INT32 hightag);
#endif
// Iterate memory by tag
#define Z_IterateTag(tagnum, func) Z_IterateTags(tagnum, tagnum, func)
@@ -127,13 +121,7 @@ void Z_IterateTags(INT32 lowtag, INT32 hightag, boolean (*iterfunc)(void *));
// Utility functions
//
void Z_CheckMemCleanup(void);
#ifdef ZDEBUG
#define Z_CheckHeap(tag) Z_CheckHeap2(__FILE__, __LINE__)
void Z_CheckHeap2(const char *file, INT32 line);
#else
void Z_CheckHeap(INT32 tag);
#endif
void Z_CheckHeap(INT32 i);
//
// Zone memory modification