Compare commits
2
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
44ecb677ad | ||
|
|
3e99f4d142 |
No files matched your search
-12
@@ -192,18 +192,6 @@ from `0` to `#musicdefs-1`, or string indices (which is equal to calling `S_Find
|
|||||||
Hook is called whenever `S_ShowMusicCredit` (either from game or mod) is called. Takes musicdef as only argument, returning true
|
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.
|
will overwrite vanilla behavior (not show music credit), can be used to implement custom music credit pop-ups.
|
||||||
|
|
||||||
## addHook("SetupVote", function(result, gt, secondgt, prevmap))
|
|
||||||
|
|
||||||
Hook is called whenever server sets up options for vote screen. `result` is table where lua can store options to,
|
|
||||||
(for example, `result[1] = 1` will force green hills as first option), gt is current gametype, secondgt is
|
|
||||||
alternative gametype picked for 3rd entry (for example, gt can be `GT_RACE`, and secondgt can be `GT_MATCH`)
|
|
||||||
prevmap is the previous map that was played (small note - in game code, it is offset by -1, but for lua its offset back,
|
|
||||||
so if previous gamemap was 1, prevmap would also be 1. Which means you can safely do mapheaderinfo[prevmap] to get info on previous map)
|
|
||||||
|
|
||||||
Limitations: currently, game can only change gametype for 3rd option in map (meaning for example, if current gametype is race, and you
|
|
||||||
put battle map in first option, when it gets picked that map will be still run in race gametype). That means, game will only handle maps with
|
|
||||||
different gametype if it is put in 3rd vote option.
|
|
||||||
|
|
||||||
# Other changes
|
# Other changes
|
||||||
|
|
||||||
## P_PlayRinglossSound(source, damager)
|
## P_PlayRinglossSound(source, damager)
|
||||||
|
|||||||
+1
-1
@@ -49,7 +49,7 @@
|
|||||||
# Already enabled by default for 32-bit
|
# Already enabled by default for 32-bit
|
||||||
# Windows.
|
# Windows.
|
||||||
# NOCURL=1 - Disable libcurl--HTTP capability.
|
# NOCURL=1 - Disable libcurl--HTTP capability.
|
||||||
# NOLIBGME=1 - Disable game music emu, retro VGM support.
|
# NOGME=1 - Disable game music emu, retro VGM support.
|
||||||
# NOOPENMPT=1 - Disable module (tracker) music support.
|
# NOOPENMPT=1 - Disable module (tracker) music support.
|
||||||
# NOMIXER=1 - Disable SDL Mixer (audio playback).
|
# NOMIXER=1 - Disable SDL Mixer (audio playback).
|
||||||
# NOTHREADS=1 - Disable multithreading.
|
# NOTHREADS=1 - Disable multithreading.
|
||||||
|
|||||||
@@ -14,6 +14,6 @@ sources+=dedicated/i_threads.c
|
|||||||
endif
|
endif
|
||||||
|
|
||||||
NOOPENMPT=1
|
NOOPENMPT=1
|
||||||
NOLIBGME=1
|
NOGME=1
|
||||||
NOHW=1
|
NOHW=1
|
||||||
NOUPNP=1
|
NOUPNP=1
|
||||||
@@ -73,6 +73,13 @@ libs+=-lbacktrace
|
|||||||
opts+=-DHAVE_LIBBACKTRACE
|
opts+=-DHAVE_LIBBACKTRACE
|
||||||
endif
|
endif
|
||||||
|
|
||||||
|
#windoze hack
|
||||||
|
ifdef MINGW
|
||||||
|
ifndef NODISCORDRPC
|
||||||
|
HAVE_DISCORDRPC=1
|
||||||
|
endif
|
||||||
|
endif
|
||||||
|
|
||||||
ifdef HAVE_DISCORDRPC
|
ifdef HAVE_DISCORDRPC
|
||||||
$(eval $(call Propogate_flags,DISCORDRPC))
|
$(eval $(call Propogate_flags,DISCORDRPC))
|
||||||
libs+=-ldiscord-rpc
|
libs+=-ldiscord-rpc
|
||||||
|
|||||||
@@ -15,7 +15,6 @@ endif
|
|||||||
|
|
||||||
sources+=win32/Srb2win.rc
|
sources+=win32/Srb2win.rc
|
||||||
opts+=-DSTDC_HEADERS
|
opts+=-DSTDC_HEADERS
|
||||||
libs+=-Wl,-Bstatic -lstdc++ -lpthread -lgcc -Wl,-Bdynamic
|
|
||||||
libs+=-ladvapi32 -lkernel32 -lmsvcrt -luser32
|
libs+=-ladvapi32 -lkernel32 -lmsvcrt -luser32
|
||||||
|
|
||||||
ifndef DEDICATED
|
ifndef DEDICATED
|
||||||
@@ -43,10 +42,6 @@ libs+=-Wl,--large-address-aware
|
|||||||
NOLIBBACKTRACE=1
|
NOLIBBACKTRACE=1
|
||||||
endif
|
endif
|
||||||
|
|
||||||
ifndef NODISCORDRPC
|
|
||||||
HAVE_DISCORDRPC=1
|
|
||||||
endif
|
|
||||||
|
|
||||||
ifndef MINGW64
|
ifndef MINGW64
|
||||||
32=32
|
32=32
|
||||||
x86=x86
|
x86=x86
|
||||||
|
|||||||
+33
-8
@@ -121,8 +121,11 @@ INT32 postimgparam[MAXSPLITSCREENPLAYERS];
|
|||||||
// These variables are only true if
|
// These variables are only true if
|
||||||
// whether the respective sound system is disabled
|
// whether the respective sound system is disabled
|
||||||
// or they're init'ed, but the player just toggled them
|
// or they're init'ed, but the player just toggled them
|
||||||
|
#ifndef NO_MIDI
|
||||||
|
boolean midi_disabled = false;
|
||||||
|
#endif
|
||||||
boolean sound_disabled = false;
|
boolean sound_disabled = false;
|
||||||
boolean music_disabled = false;
|
boolean digital_disabled = false;
|
||||||
|
|
||||||
#ifdef DEBUGFILE
|
#ifdef DEBUGFILE
|
||||||
INT32 debugload = 0;
|
INT32 debugload = 0;
|
||||||
@@ -1986,23 +1989,45 @@ void D_SRB2Main(void)
|
|||||||
if (dedicated)
|
if (dedicated)
|
||||||
{
|
{
|
||||||
sound_disabled = true;
|
sound_disabled = true;
|
||||||
music_disabled = true;
|
digital_disabled = true;
|
||||||
|
#ifndef NO_MIDI
|
||||||
|
midi_disabled = true;
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
if (M_CheckParm("-noaudio")) // combines -nosound and -nomusic
|
if (M_CheckParm("-noaudio")) // combines -nosound and -nomusic
|
||||||
{
|
{
|
||||||
sound_disabled = true;
|
sound_disabled = true;
|
||||||
music_disabled = true;
|
digital_disabled = true;
|
||||||
|
#ifndef NO_MIDI
|
||||||
|
midi_disabled = true;
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
if (M_CheckParm("-nosound"))
|
if (M_CheckParm("-nosound"))
|
||||||
sound_disabled = true;
|
sound_disabled = true;
|
||||||
if (M_CheckParm("-nomusic"))
|
if (M_CheckParm("-nomusic")) // combines -nomidimusic and -nodigmusic
|
||||||
music_disabled = true;
|
{
|
||||||
|
digital_disabled = true;
|
||||||
|
#ifndef NO_MIDI
|
||||||
|
midi_disabled = true;
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
#ifndef NO_MIDI
|
||||||
|
if (M_CheckParm("-nomidimusic"))
|
||||||
|
midi_disabled = true; // WARNING: DOS version initmusic in I_StartupSound
|
||||||
|
#endif
|
||||||
|
if (M_CheckParm("-nodigmusic"))
|
||||||
|
digital_disabled = true; // WARNING: DOS version initmusic in I_StartupSound
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
if (!( sound_disabled && digital_disabled
|
||||||
if (!(sound_disabled && music_disabled))
|
#ifndef NO_MIDI
|
||||||
|
&& midi_disabled
|
||||||
|
#endif
|
||||||
|
))
|
||||||
{
|
{
|
||||||
CONS_Printf("S_InitSfxChannels(): Setting up sound channels.\n");
|
CONS_Printf("S_InitSfxChannels(): Setting up sound channels.\n");
|
||||||
I_StartupSound();
|
I_StartupSound();
|
||||||
|
|||||||
+1
-12
@@ -2505,14 +2505,6 @@ void D_SetupVote(void)
|
|||||||
UINT8 gt = (cv_kartgametypepreference.value == -1) ? gametype : cv_kartgametypepreference.value;
|
UINT8 gt = (cv_kartgametypepreference.value == -1) ? gametype : cv_kartgametypepreference.value;
|
||||||
UINT8 secondgt = G_SometimesGetDifferentGametype(gt);
|
UINT8 secondgt = G_SometimesGetDifferentGametype(gt);
|
||||||
INT16 votebuffer[4] = {-1,-1,-1,0};
|
INT16 votebuffer[4] = {-1,-1,-1,0};
|
||||||
INT16 luamaps[4] = {0, 0, 0, 0};
|
|
||||||
|
|
||||||
LUA_HookSetupVote(luamaps, sizeof(luamaps)/sizeof(luamaps[0]), gt, secondgt);
|
|
||||||
|
|
||||||
// Correct secondgt if needed
|
|
||||||
UINT8 typeoflevel = mapheaderinfo[luamaps[2]-1]->typeoflevel;
|
|
||||||
if (luamaps[2] && (typeoflevel & G_TOLFlag(secondgt&(~0x80))) == 0)
|
|
||||||
secondgt = ((typeoflevel & TOL_RACE) ? GT_RACE : GT_MATCH)|(secondgt&0x80);
|
|
||||||
|
|
||||||
if (cv_kartencore.value && gt == GT_RACE)
|
if (cv_kartencore.value && gt == GT_RACE)
|
||||||
WRITEUINT8(p, (gt|0x80));
|
WRITEUINT8(p, (gt|0x80));
|
||||||
@@ -2521,13 +2513,10 @@ void D_SetupVote(void)
|
|||||||
WRITEUINT8(p, secondgt);
|
WRITEUINT8(p, secondgt);
|
||||||
secondgt &= ~0x80;
|
secondgt &= ~0x80;
|
||||||
|
|
||||||
|
|
||||||
for (i = 0; i < 4; i++)
|
for (i = 0; i < 4; i++)
|
||||||
{
|
{
|
||||||
UINT16 m;
|
UINT16 m;
|
||||||
if (luamaps[i])
|
if (i == 2) // sometimes a different gametype
|
||||||
m = luamaps[i]-1;
|
|
||||||
else if (i == 2) // sometimes a different gametype
|
|
||||||
m = G_RandMap(G_TOLFlag(secondgt), prevmap, false, 0, true, votebuffer);
|
m = G_RandMap(G_TOLFlag(secondgt), prevmap, false, 0, true, votebuffer);
|
||||||
else if (i >= 3) // unknown-random and force-unknown MAP HELL
|
else if (i >= 3) // unknown-random and force-unknown MAP HELL
|
||||||
m = G_RandMap(G_TOLFlag(gt), prevmap, false, (i-2), (i < 4), votebuffer);
|
m = G_RandMap(G_TOLFlag(gt), prevmap, false, (i-2), (i < 4), votebuffer);
|
||||||
|
|||||||
+13
-35
@@ -1173,41 +1173,7 @@ filestatus_t findfile(char *filename, const UINT8 *wantedmd5sum, boolean complet
|
|||||||
filestatus_t homecheck; // store result of last file search
|
filestatus_t homecheck; // store result of last file search
|
||||||
boolean badmd5 = false; // store whether md5 was bad from either of the first two searches (if nothing was found in the third)
|
boolean badmd5 = false; // store whether md5 was bad from either of the first two searches (if nothing was found in the third)
|
||||||
|
|
||||||
// skip for startup, our mainwads wont be in there
|
// first, check SRB2's "home" directory
|
||||||
if (loaded_config)
|
|
||||||
{
|
|
||||||
if (cv_addons_option.value == 3 && *cv_addons_folder.string != '\0')
|
|
||||||
{
|
|
||||||
// first, 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
|
|
||||||
}
|
|
||||||
|
|
||||||
// next, check "DOWNLOAD" directory
|
|
||||||
homecheck = filesearch(filename, "DOWNLOAD", 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
|
|
||||||
|
|
||||||
// next, check "addons" directory
|
|
||||||
homecheck = filesearch(filename, "addons", 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
|
|
||||||
}
|
|
||||||
|
|
||||||
// next, check SRB2's "home" directory
|
|
||||||
homecheck = filesearch(filename, srb2home, wantedmd5sum, completepath, 10);
|
homecheck = filesearch(filename, srb2home, wantedmd5sum, completepath, 10);
|
||||||
|
|
||||||
if (homecheck == FS_FOUND) // we found the file, so return that we have :)
|
if (homecheck == FS_FOUND) // we found the file, so return that we have :)
|
||||||
@@ -1225,6 +1191,18 @@ filestatus_t findfile(char *filename, const UINT8 *wantedmd5sum, boolean complet
|
|||||||
badmd5 = true;
|
badmd5 = true;
|
||||||
// if not found at all, just move on without doing anything
|
// 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
|
// finally check "." directory
|
||||||
homecheck = filesearch(filename, ".", wantedmd5sum, completepath, 10);
|
homecheck = filesearch(filename, ".", wantedmd5sum, completepath, 10);
|
||||||
|
|
||||||
|
|||||||
@@ -69,11 +69,13 @@ void I_ShutdownSound(void){}
|
|||||||
|
|
||||||
\return sfx handle
|
\return sfx handle
|
||||||
*/
|
*/
|
||||||
INT32 I_StartSound(sfxenum_t id, UINT8 vol, UINT8 sep, INT32 channel)
|
INT32 I_StartSound(sfxenum_t id, UINT8 vol, UINT8 sep, UINT8 pitch, UINT8 priority, INT32 channel)
|
||||||
{
|
{
|
||||||
(void)id;
|
(void)id;
|
||||||
(void)vol;
|
(void)vol;
|
||||||
(void)sep;
|
(void)sep;
|
||||||
|
(void)pitch;
|
||||||
|
(void)priority;
|
||||||
(void)channel;
|
(void)channel;
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
@@ -114,11 +116,12 @@ boolean I_SoundIsPlaying(INT32 handle)
|
|||||||
|
|
||||||
\return void
|
\return void
|
||||||
*/
|
*/
|
||||||
void I_UpdateSoundParams(INT32 handle, UINT8 vol, UINT8 sep)
|
void I_UpdateSoundParams(INT32 handle, UINT8 vol, UINT8 sep, UINT8 pitch)
|
||||||
{
|
{
|
||||||
(void)handle;
|
(void)handle;
|
||||||
(void)vol;
|
(void)vol;
|
||||||
(void)sep;
|
(void)sep;
|
||||||
|
(void)pitch;
|
||||||
}
|
}
|
||||||
|
|
||||||
/** \brief The I_SetSfxVolume function
|
/** \brief The I_SetSfxVolume function
|
||||||
|
|||||||
@@ -1899,7 +1899,7 @@ static const char *searchWad(const char *searchDir)
|
|||||||
filestatus_t fstemp;
|
filestatus_t fstemp;
|
||||||
|
|
||||||
strcpy(tempsw, WADKEYWORD1);
|
strcpy(tempsw, WADKEYWORD1);
|
||||||
fstemp = filesearch(tempsw, searchDir, NULL, true, 20);
|
fstemp = filesearch(tempsw,searchDir,NULL,true,20);
|
||||||
if (fstemp == FS_FOUND)
|
if (fstemp == FS_FOUND)
|
||||||
{
|
{
|
||||||
pathonly(tempsw);
|
pathonly(tempsw);
|
||||||
|
|||||||
+1
-10
@@ -178,9 +178,6 @@ FUNCPRINTF static void deh_warning(const char *first, ...)
|
|||||||
else
|
else
|
||||||
CONS_Alert(CONS_WARNING, "Line %u: %s\n", dbg_line, buf);
|
CONS_Alert(CONS_WARNING, "Line %u: %s\n", dbg_line, buf);
|
||||||
|
|
||||||
if (dbg_line != -1 && (M_CheckParm("-strict") || M_CheckParm("-strict-soc")))
|
|
||||||
I_Error("deh_warning: %s", buf);
|
|
||||||
|
|
||||||
deh_num_warning++;
|
deh_num_warning++;
|
||||||
|
|
||||||
Z_Free(buf);
|
Z_Free(buf);
|
||||||
@@ -2858,7 +2855,7 @@ static void DEH_LoadDehackedFile(MYFILE *f, UINT16 wad)
|
|||||||
dbg_line = -1; // start at -1 so the first line is 0.
|
dbg_line = -1; // start at -1 so the first line is 0.
|
||||||
while (!myfeof(f))
|
while (!myfeof(f))
|
||||||
{
|
{
|
||||||
char origpos[256];
|
char origpos[128];
|
||||||
INT32 size = 0;
|
INT32 size = 0;
|
||||||
char *traverse;
|
char *traverse;
|
||||||
|
|
||||||
@@ -2874,12 +2871,6 @@ static void DEH_LoadDehackedFile(MYFILE *f, UINT16 wad)
|
|||||||
size++;
|
size++;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (size > (int)sizeof(origpos))
|
|
||||||
{
|
|
||||||
deh_warning("Line is too long");
|
|
||||||
size = sizeof(origpos)-1;
|
|
||||||
}
|
|
||||||
|
|
||||||
strncpy(origpos, s, size);
|
strncpy(origpos, s, size);
|
||||||
origpos[size] = '\0';
|
origpos[size] = '\0';
|
||||||
|
|
||||||
|
|||||||
+1
-2
@@ -650,8 +650,7 @@ extern const char *compdate, *comptime, *comprevision, *compbranch;
|
|||||||
#define NOCLIPCAM
|
#define NOCLIPCAM
|
||||||
|
|
||||||
/// SRB2Kart: MIDI support is shitty and busted and we don't want it, lets throw it behind a define
|
/// SRB2Kart: MIDI support is shitty and busted and we don't want it, lets throw it behind a define
|
||||||
// yall didnt properly disable it so it always worked lol (:
|
#define NO_MIDI
|
||||||
//#define NO_MIDI
|
|
||||||
|
|
||||||
/// Sprite rotation
|
/// Sprite rotation
|
||||||
#define ROTSPRITE
|
#define ROTSPRITE
|
||||||
|
|||||||
+6
-1
@@ -102,8 +102,13 @@ extern boolean forceresetplayers, deferencoremode;
|
|||||||
// Internal parameters for sound rendering.
|
// Internal parameters for sound rendering.
|
||||||
// ========================================
|
// ========================================
|
||||||
|
|
||||||
|
#ifdef NO_MIDI
|
||||||
|
#define midi_disabled true
|
||||||
|
#else
|
||||||
|
extern boolean midi_disabled;
|
||||||
|
#endif
|
||||||
extern boolean sound_disabled;
|
extern boolean sound_disabled;
|
||||||
extern boolean music_disabled;
|
extern boolean digital_disabled;
|
||||||
|
|
||||||
// =========================
|
// =========================
|
||||||
// Status flags for refresh.
|
// Status flags for refresh.
|
||||||
|
|||||||
+72
-163
@@ -341,7 +341,6 @@ char *refreshdirname = NULL;
|
|||||||
// direrror is set if there was an error.
|
// direrror is set if there was an error.
|
||||||
INT32 pathisdirectory(const char *path)
|
INT32 pathisdirectory(const char *path)
|
||||||
{
|
{
|
||||||
#ifndef _WIN32
|
|
||||||
struct stat fsstat;
|
struct stat fsstat;
|
||||||
|
|
||||||
if (stat(path, &fsstat) < 0)
|
if (stat(path, &fsstat) < 0)
|
||||||
@@ -349,67 +348,39 @@ INT32 pathisdirectory(const char *path)
|
|||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
else if (S_ISDIR(fsstat.st_mode))
|
else if (S_ISDIR(fsstat.st_mode))
|
||||||
{
|
|
||||||
return 1;
|
return 1;
|
||||||
}
|
|
||||||
|
|
||||||
#else
|
|
||||||
DWORD fileattr = GetFileAttributes(path);
|
|
||||||
if (fileattr == INVALID_FILE_ATTRIBUTES)
|
|
||||||
{
|
|
||||||
return -1;
|
|
||||||
}
|
|
||||||
else if (fileattr & FILE_ATTRIBUTE_DIRECTORY)
|
|
||||||
{
|
|
||||||
return 1;
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
// skip those folders, they will not have any addons
|
|
||||||
static const char *exclude_paths[] = {
|
|
||||||
"logs",
|
|
||||||
"luafiles",
|
|
||||||
"replay",
|
|
||||||
"mdls",
|
|
||||||
"gifs",
|
|
||||||
"screenshots",
|
|
||||||
NULL
|
|
||||||
};
|
|
||||||
|
|
||||||
filestatus_t filesearch(char *filename, const char *startpath, const UINT8 *wantedmd5sum, boolean completepath, int maxsearchdepth)
|
filestatus_t filesearch(char *filename, const char *startpath, const UINT8 *wantedmd5sum, boolean completepath, int maxsearchdepth)
|
||||||
{
|
{
|
||||||
filestatus_t retval = FS_NOTFOUND;
|
filestatus_t retval = FS_NOTFOUND;
|
||||||
DIR **dirhandle;
|
DIR **dirhandle;
|
||||||
struct dirent *dent;
|
struct dirent *dent;
|
||||||
#ifndef _WIN32
|
|
||||||
struct stat fsstat;
|
struct stat fsstat;
|
||||||
#endif
|
|
||||||
int found = 0;
|
int found = 0;
|
||||||
char *searchname;
|
char *searchname = strdup(filename);
|
||||||
int depthleft = maxsearchdepth;
|
int depthleft = maxsearchdepth;
|
||||||
char searchpath[1024];
|
char searchpath[1024];
|
||||||
size_t *searchpathindex;
|
size_t *searchpathindex;
|
||||||
|
|
||||||
dirhandle = (DIR**)malloc(maxsearchdepth * sizeof(DIR*));
|
dirhandle = (DIR**) malloc(maxsearchdepth * sizeof(DIR*));
|
||||||
searchpathindex = (size_t *)malloc(maxsearchdepth * sizeof(size_t));
|
searchpathindex = (size_t *) malloc(maxsearchdepth * sizeof(size_t));
|
||||||
|
|
||||||
strcpy(searchpath, startpath);
|
strcpy(searchpath,startpath);
|
||||||
searchpathindex[--depthleft] = strlen(searchpath) + 1;
|
searchpathindex[--depthleft] = strlen(searchpath) + 1;
|
||||||
|
|
||||||
dirhandle[depthleft] = opendir(searchpath);
|
dirhandle[depthleft] = opendir(searchpath);
|
||||||
|
|
||||||
if (dirhandle[depthleft] == NULL)
|
if (dirhandle[depthleft] == NULL)
|
||||||
{
|
{
|
||||||
|
free(searchname);
|
||||||
free(dirhandle);
|
free(dirhandle);
|
||||||
free(searchpathindex);
|
free(searchpathindex);
|
||||||
return FS_NOTFOUND;
|
return FS_NOTFOUND;
|
||||||
}
|
}
|
||||||
|
|
||||||
searchname = strdup(filename);
|
|
||||||
|
|
||||||
if (searchpath[searchpathindex[depthleft]-2] != PATHSEP[0])
|
if (searchpath[searchpathindex[depthleft]-2] != PATHSEP[0])
|
||||||
{
|
{
|
||||||
searchpath[searchpathindex[depthleft]-1] = PATHSEP[0];
|
searchpath[searchpathindex[depthleft]-1] = PATHSEP[0];
|
||||||
@@ -441,88 +412,62 @@ filestatus_t filesearch(char *filename, const char *startpath, const UINT8 *want
|
|||||||
// okay, now we actually want searchpath to incorporate d_name
|
// okay, now we actually want searchpath to incorporate d_name
|
||||||
strcpy(&searchpath[searchpathindex[depthleft]], dent->d_name);
|
strcpy(&searchpath[searchpathindex[depthleft]], dent->d_name);
|
||||||
|
|
||||||
#if defined(__linux__) || defined(__FreeBSD__) || defined(__OpenBSD__)
|
#if defined(__linux__) || defined(__FreeBSD__)
|
||||||
if (dent->d_type == DT_UNKNOWN || dent->d_type == DT_LNK)
|
if (dent->d_type == DT_UNKNOWN && lstat(searchpath, &fsstat) == 0)
|
||||||
if (stat(searchpath, &fsstat) == 0 && S_ISDIR(fsstat.st_mode))
|
|
||||||
dent->d_type = DT_DIR;
|
|
||||||
|
|
||||||
// Linux and FreeBSD has a special field for file type on dirent, so use that to speed up lookups.
|
|
||||||
if (dent->d_type == DT_DIR)
|
|
||||||
#elif defined (_WIN32)
|
|
||||||
// if we wanna follow symlinks we can check with FILE_ATTRIBUTE_REPARSE_POINT
|
|
||||||
DWORD fileattr = GetFileAttributes(searchpath);
|
|
||||||
if (fileattr == INVALID_FILE_ATTRIBUTES)
|
|
||||||
continue; // was the file (re)moved? can't stat it
|
|
||||||
|
|
||||||
if (fileattr & FILE_ATTRIBUTE_DIRECTORY)
|
|
||||||
#else
|
|
||||||
if (stat(searchpath,&fsstat) < 0) // do we want to follow symlinks? if not: change it to lstat
|
|
||||||
continue; // was the file (re)moved? can't stat it
|
|
||||||
|
|
||||||
if (S_ISDIR(fsstat.st_mode))
|
|
||||||
#endif
|
|
||||||
{
|
{
|
||||||
// I am a folder!
|
if (S_ISDIR(fsstat.st_mode))
|
||||||
|
dent->d_type = DT_DIR;
|
||||||
if (!depthleft)
|
else if (S_ISLNK(fsstat.st_mode))
|
||||||
continue; // No additional folder delving permitted...
|
dent->d_type = DT_LNK;
|
||||||
|
|
||||||
const char **path = exclude_paths;
|
|
||||||
|
|
||||||
if (depthleft == maxsearchdepth-1)
|
|
||||||
{
|
|
||||||
// When we're at the root of the search, we exclude certain folders.
|
|
||||||
|
|
||||||
boolean skipfolder = false;
|
|
||||||
|
|
||||||
for (; *path != NULL; path++)
|
|
||||||
{
|
|
||||||
if (strcasecmp(*path, dent->d_name) == 0)
|
|
||||||
{
|
|
||||||
skipfolder = true;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (skipfolder)
|
|
||||||
{
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (strcasecmp(".git", dent->d_name) // sanity if you're weird like me
|
|
||||||
&& (dirhandle[depthleft-1] = opendir(searchpath)) != NULL)
|
|
||||||
{
|
|
||||||
// Got read permissions!
|
|
||||||
searchpathindex[--depthleft] = strlen(searchpath) + 1;
|
|
||||||
|
|
||||||
searchpath[searchpathindex[depthleft]-1] = PATHSEP[0];
|
|
||||||
searchpath[searchpathindex[depthleft]] = 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
continue;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// I am a file!
|
// Symlinks aren't always directory symlinks. Dunno if this would resolve recursive
|
||||||
|
// symlinks, but i think stat already does that
|
||||||
if (strcasecmp(searchname, dent->d_name))
|
if (dent->d_type == DT_LNK && stat(searchpath,&fsstat) == 0 && !S_ISDIR(fsstat.st_mode))
|
||||||
continue; // Not what we're looking for!
|
|
||||||
|
|
||||||
switch (checkfilemd5(searchpath, wantedmd5sum))
|
|
||||||
{
|
{
|
||||||
case FS_FOUND:
|
dent->d_type = DT_UNKNOWN;
|
||||||
if (completepath)
|
}
|
||||||
strcpy(filename, searchpath);
|
|
||||||
else
|
// Linux and FreeBSD has a special field for file type on dirent, so use that to speed up lookups.
|
||||||
strcpy(filename, dent->d_name);
|
// FIXME: should we also follow symlinks?
|
||||||
retval = FS_FOUND;
|
if ((dent->d_type == DT_DIR && depthleft) || (dent->d_type == DT_LNK && depthleft))
|
||||||
found = 1;
|
#else
|
||||||
break;
|
if (stat(searchpath,&fsstat) < 0) // do we want to follow symlinks? if not: change it to lstat
|
||||||
case FS_MD5SUMBAD:
|
; // was the file (re)moved? can't stat it
|
||||||
retval = FS_MD5SUMBAD;
|
else if (S_ISDIR(fsstat.st_mode) && depthleft)
|
||||||
break;
|
#endif
|
||||||
default: // prevent some compiler warnings
|
{
|
||||||
break;
|
searchpathindex[--depthleft] = strlen(searchpath) + 1;
|
||||||
|
dirhandle[depthleft] = opendir(searchpath);
|
||||||
|
|
||||||
|
if (!dirhandle[depthleft])
|
||||||
|
{
|
||||||
|
// can't open it... maybe no read-permissions
|
||||||
|
// go back to previous dir
|
||||||
|
depthleft++;
|
||||||
|
}
|
||||||
|
|
||||||
|
searchpath[searchpathindex[depthleft]-1] = PATHSEP[0];
|
||||||
|
searchpath[searchpathindex[depthleft]] = 0;
|
||||||
|
}
|
||||||
|
else if (!strcasecmp(searchname, dent->d_name))
|
||||||
|
{
|
||||||
|
switch (checkfilemd5(searchpath, wantedmd5sum))
|
||||||
|
{
|
||||||
|
case FS_FOUND:
|
||||||
|
if (completepath)
|
||||||
|
strcpy(filename, searchpath);
|
||||||
|
else
|
||||||
|
strcpy(filename, dent->d_name);
|
||||||
|
retval = FS_FOUND;
|
||||||
|
found = 1;
|
||||||
|
break;
|
||||||
|
case FS_MD5SUMBAD:
|
||||||
|
retval = FS_MD5SUMBAD;
|
||||||
|
break;
|
||||||
|
default: // prevent some compiler warnings
|
||||||
|
break;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -699,9 +644,7 @@ boolean preparefilemenu(boolean samedepth, boolean replayhut)
|
|||||||
{
|
{
|
||||||
DIR *dirhandle;
|
DIR *dirhandle;
|
||||||
struct dirent *dent;
|
struct dirent *dent;
|
||||||
#ifndef _WIN32
|
|
||||||
struct stat fsstat;
|
struct stat fsstat;
|
||||||
#endif
|
|
||||||
size_t pos = 0, folderpos = 0, numfolders = 0;
|
size_t pos = 0, folderpos = 0, numfolders = 0;
|
||||||
char *tempname = NULL;
|
char *tempname = NULL;
|
||||||
|
|
||||||
@@ -737,44 +680,30 @@ boolean preparefilemenu(boolean samedepth, boolean replayhut)
|
|||||||
if (!dent)
|
if (!dent)
|
||||||
break;
|
break;
|
||||||
else if (dent->d_name[0]=='.' &&
|
else if (dent->d_name[0]=='.' &&
|
||||||
(dent->d_name[1]=='\0' ||
|
(dent->d_name[1]=='\0' ||
|
||||||
(dent->d_name[1]=='.' &&
|
(dent->d_name[1]=='.' &&
|
||||||
dent->d_name[2]=='\0')))
|
dent->d_name[2]=='\0')))
|
||||||
continue; // we don't want to scan uptree
|
continue; // we don't want to scan uptree
|
||||||
|
|
||||||
strcpy(&menupath[menupathindex[menudepthleft]],dent->d_name);
|
strcpy(&menupath[menupathindex[menudepthleft]],dent->d_name);
|
||||||
|
|
||||||
#ifndef _WIN32
|
if (stat(menupath,&fsstat) < 0) // do we want to follow symlinks? if not: change it to lstat
|
||||||
if (stat(menupath, &fsstat) < 0)
|
|
||||||
#else
|
|
||||||
// if we wanna follow symlinks we can check with FILE_ATTRIBUTE_REPARSE_POINT
|
|
||||||
DWORD fileattr = GetFileAttributes(menupath);
|
|
||||||
if (fileattr == INVALID_FILE_ATTRIBUTES)
|
|
||||||
#endif
|
|
||||||
; // was the file (re)moved? can't stat it
|
; // was the file (re)moved? can't stat it
|
||||||
else // is a file or directory
|
else // is a file or directory
|
||||||
{
|
{
|
||||||
#ifndef _WIN32
|
|
||||||
if (!S_ISDIR(fsstat.st_mode)) // file
|
if (!S_ISDIR(fsstat.st_mode)) // file
|
||||||
#else
|
|
||||||
if (!(fileattr & FILE_ATTRIBUTE_DIRECTORY))
|
|
||||||
#endif
|
|
||||||
{
|
{
|
||||||
size_t len = strlen(dent->d_name)+1;
|
size_t len = strlen(dent->d_name)+1;
|
||||||
if (replayhut)
|
if (replayhut)
|
||||||
{
|
{
|
||||||
if (strcasecmp(".lmp", dent->d_name+len-5))
|
if (strcasecmp(".lmp", dent->d_name+len-5)) continue; // Not a replay
|
||||||
continue; // Not a replay
|
|
||||||
}
|
}
|
||||||
else if (!cv_addons_showall.value)
|
else if (!cv_addons_showall.value)
|
||||||
{
|
{
|
||||||
UINT8 ext;
|
UINT8 ext;
|
||||||
for (ext = 0; ext < NUM_EXT_TABLE; ext++)
|
for (ext = 0; ext < NUM_EXT_TABLE; ext++)
|
||||||
if (!strcasecmp(exttable[ext]+1, dent->d_name+len-(exttable[ext][0])))
|
if (!strcasecmp(exttable[ext]+1, dent->d_name+len-(exttable[ext][0]))) break; // extension comparison
|
||||||
break; // extension comparison
|
if (ext == NUM_EXT_TABLE) continue; // not an addfile-able (or exec-able) file
|
||||||
|
|
||||||
if (ext == NUM_EXT_TABLE)
|
|
||||||
continue; // not an addfile-able (or exec-able) file
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else // directory
|
else // directory
|
||||||
@@ -819,20 +748,14 @@ boolean preparefilemenu(boolean samedepth, boolean replayhut)
|
|||||||
if (!dent)
|
if (!dent)
|
||||||
break;
|
break;
|
||||||
else if (dent->d_name[0]=='.' &&
|
else if (dent->d_name[0]=='.' &&
|
||||||
(dent->d_name[1]=='\0' ||
|
(dent->d_name[1]=='\0' ||
|
||||||
(dent->d_name[1]=='.' &&
|
(dent->d_name[1]=='.' &&
|
||||||
dent->d_name[2]=='\0')))
|
dent->d_name[2]=='\0')))
|
||||||
continue; // we don't want to scan uptree
|
continue; // we don't want to scan uptree
|
||||||
|
|
||||||
strcpy(&menupath[menupathindex[menudepthleft]],dent->d_name);
|
strcpy(&menupath[menupathindex[menudepthleft]],dent->d_name);
|
||||||
|
|
||||||
#ifndef _WIN32
|
if (stat(menupath,&fsstat) < 0) // do we want to follow symlinks? if not: change it to lstat
|
||||||
if (stat(menupath, &fsstat) < 0)
|
|
||||||
#else
|
|
||||||
// if we wanna follow symlinks we can check with FILE_ATTRIBUTE_REPARSE_POINT
|
|
||||||
DWORD fileattr = GetFileAttributes(menupath);
|
|
||||||
if (fileattr == INVALID_FILE_ATTRIBUTES)
|
|
||||||
#endif
|
|
||||||
; // was the file (re)moved? can't stat it
|
; // was the file (re)moved? can't stat it
|
||||||
else // is a file or directory
|
else // is a file or directory
|
||||||
{
|
{
|
||||||
@@ -841,31 +764,20 @@ boolean preparefilemenu(boolean samedepth, boolean replayhut)
|
|||||||
UINT8 ext = EXT_FOLDER;
|
UINT8 ext = EXT_FOLDER;
|
||||||
UINT8 folder;
|
UINT8 folder;
|
||||||
|
|
||||||
#ifndef _WIN32
|
|
||||||
if (!S_ISDIR(fsstat.st_mode)) // file
|
if (!S_ISDIR(fsstat.st_mode)) // file
|
||||||
#else
|
|
||||||
if (!(fileattr & FILE_ATTRIBUTE_DIRECTORY))
|
|
||||||
#endif
|
|
||||||
{
|
{
|
||||||
if (!((numfolders+pos) < sizecoredirmenu))
|
if (!((numfolders+pos) < sizecoredirmenu)) continue; // crash prevention
|
||||||
continue; // crash prevention
|
|
||||||
|
|
||||||
if (replayhut)
|
if (replayhut)
|
||||||
{
|
{
|
||||||
if (strcasecmp(".lmp", dent->d_name+len-5))
|
if (strcasecmp(".lmp", dent->d_name+len-5)) continue; // Not a replay
|
||||||
continue; // Not a replay
|
|
||||||
|
|
||||||
ext = EXT_TXT; // This isn't used anywhere but better safe than sorry for messing with this...
|
ext = EXT_TXT; // This isn't used anywhere but better safe than sorry for messing with this...
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
for (; ext < NUM_EXT_TABLE; ext++)
|
for (; ext < NUM_EXT_TABLE; ext++)
|
||||||
if (!strcasecmp(exttable[ext]+1, dent->d_name+len-(exttable[ext][0])))
|
if (!strcasecmp(exttable[ext]+1, dent->d_name+len-(exttable[ext][0]))) break; // extension comparison
|
||||||
break; // extension comparison
|
if (ext == NUM_EXT_TABLE && !cv_addons_showall.value) continue; // not an addfile-able (or exec-able) file
|
||||||
|
|
||||||
if (ext == NUM_EXT_TABLE && !cv_addons_showall.value)
|
|
||||||
continue; // not an addfile-able (or exec-able) file
|
|
||||||
|
|
||||||
ext += EXT_START; // moving to be appropriate position
|
ext += EXT_START; // moving to be appropriate position
|
||||||
|
|
||||||
if (ext >= EXT_LOADSTART)
|
if (ext >= EXT_LOADSTART)
|
||||||
@@ -882,7 +794,6 @@ boolean preparefilemenu(boolean samedepth, boolean replayhut)
|
|||||||
|
|
||||||
if (strcmp(dent->d_name, filenamebuf[i]))
|
if (strcmp(dent->d_name, filenamebuf[i]))
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
if (cv_addons_md5.value && !checkfilemd5(menupath, wadfiles[i]->md5sum))
|
if (cv_addons_md5.value && !checkfilemd5(menupath, wadfiles[i]->md5sum))
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
@@ -909,11 +820,9 @@ boolean preparefilemenu(boolean samedepth, boolean replayhut)
|
|||||||
|
|
||||||
if (!(temp = Z_Malloc((len+DIR_STRING+folder) * sizeof (char), PU_STATIC, NULL)))
|
if (!(temp = Z_Malloc((len+DIR_STRING+folder) * sizeof (char), PU_STATIC, NULL)))
|
||||||
I_Error("preparefilemenu(): could not create file entry.");
|
I_Error("preparefilemenu(): could not create file entry.");
|
||||||
|
|
||||||
temp[DIR_TYPE] = ext;
|
temp[DIR_TYPE] = ext;
|
||||||
temp[DIR_LEN] = (UINT8)(len);
|
temp[DIR_LEN] = (UINT8)(len);
|
||||||
strlcpy(temp+DIR_STRING, dent->d_name, len);
|
strlcpy(temp+DIR_STRING, dent->d_name, len);
|
||||||
|
|
||||||
if (folder)
|
if (folder)
|
||||||
{
|
{
|
||||||
strcpy(temp+len, PATHSEP);
|
strcpy(temp+len, PATHSEP);
|
||||||
|
|||||||
+2
-1
@@ -30,7 +30,8 @@ extern consvar_t cv_addons_option, cv_addons_folder, cv_addons_md5, cv_addons_sh
|
|||||||
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
filestatus_t filesearch(char *filename, const char *startpath, const UINT8 *wantedmd5sum, boolean completepath, int maxsearchdepth);
|
filestatus_t filesearch(char *filename, const char *startpath, const UINT8 *wantedmd5sum,
|
||||||
|
boolean completepath, int maxsearchdepth);
|
||||||
|
|
||||||
#define menudepth 20
|
#define menudepth 20
|
||||||
|
|
||||||
|
|||||||
+1
-1
@@ -883,7 +883,7 @@ void G_BuildTiccmd(ticcmd_t *cmd, INT32 realtics, UINT8 ssplayer)
|
|||||||
return;
|
return;
|
||||||
|
|
||||||
const UINT8 forplayer = (ssplayer-1);
|
const UINT8 forplayer = (ssplayer-1);
|
||||||
player_t *player = P_GetLocalPlayerForNum(forplayer);
|
player_t *player = ((ssplayer == 1) ? &players[consoleplayer] : &players[displayplayers[forplayer]]);
|
||||||
|
|
||||||
camera_t *thiscam = &camera[forplayer];
|
camera_t *thiscam = &camera[forplayer];
|
||||||
const boolean freecam = camera[forplayer].freecam;
|
const boolean freecam = camera[forplayer].freecam;
|
||||||
|
|||||||
+84
-52
@@ -328,7 +328,7 @@ static void HWR_GenerateTexture(INT32 texnum, GLMapTexture_t *gltex, boolean noe
|
|||||||
gltex->mipmap.format = textureformat;
|
gltex->mipmap.format = textureformat;
|
||||||
|
|
||||||
// hack the Legacy skies..
|
// hack the Legacy skies..
|
||||||
if (UNLIKELY(memcmp(texture->name, "SKY", 3) == 0 &&
|
if (UNLIKELY(strncmp(texture->name, "SKY", 3) == 0 &&
|
||||||
(texture->name[4] == 0 || texture->name[5] == 0)))
|
(texture->name[4] == 0 || texture->name[5] == 0)))
|
||||||
{
|
{
|
||||||
skyspecial = true;
|
skyspecial = true;
|
||||||
@@ -600,6 +600,7 @@ void HWR_FreeMapTextures(void)
|
|||||||
|
|
||||||
static void HWR_PrecacheLevelFlats(void)
|
static void HWR_PrecacheLevelFlats(void)
|
||||||
{
|
{
|
||||||
|
levelflat_t levelflat;
|
||||||
lumpnum_t lump;
|
lumpnum_t lump;
|
||||||
size_t i, j;
|
size_t i, j;
|
||||||
INT32 k;
|
INT32 k;
|
||||||
@@ -613,22 +614,28 @@ static void HWR_PrecacheLevelFlats(void)
|
|||||||
{
|
{
|
||||||
sector_t *sec = §ors[i];
|
sector_t *sec = §ors[i];
|
||||||
|
|
||||||
|
// sector checked already?
|
||||||
|
if (sec->validcount == validcount)
|
||||||
|
continue;
|
||||||
|
|
||||||
|
sec->validcount = validcount;
|
||||||
|
|
||||||
// gotta check sector floor and ceiling
|
// gotta check sector floor and ceiling
|
||||||
for (j = 0; j < 2; j++)
|
for (j = 0; j < 2; j++)
|
||||||
{
|
{
|
||||||
const boolean ceiling = (j == 0);
|
const boolean ceiling = (j == 0);
|
||||||
const INT32 pic = ceiling ? sec->ceilingpic : sec->floorpic;
|
INT32 pic = ceiling ? sec->ceilingpic : sec->floorpic;
|
||||||
|
|
||||||
const levelflat_t *levelflat = &levelflats[pic];
|
levelflat = levelflats[pic];
|
||||||
|
|
||||||
lump = levelflat->lumpnum;
|
lump = levelflat.lumpnum;
|
||||||
HWR_GetFlat(lump, R_NoEncore(sec, ceiling));
|
HWR_GetFlat(lump, R_NoEncore(sec, ceiling));
|
||||||
|
|
||||||
if (levelflat->speed) // it is an animated flat
|
if (levelflat.speed) // it is an animated flat
|
||||||
{
|
{
|
||||||
for (k = 1; k < levelflat->numpics; k++)
|
for (k = 1; k < levelflat.numpics; k++)
|
||||||
{
|
{
|
||||||
lump = levelflat->baselumpnum + k;
|
lump = levelflat.baselumpnum + k;
|
||||||
HWR_GetFlat(lump, R_NoEncore(sec, ceiling));
|
HWR_GetFlat(lump, R_NoEncore(sec, ceiling));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -642,18 +649,18 @@ static void HWR_PrecacheLevelFlats(void)
|
|||||||
// just load every flat in the level
|
// just load every flat in the level
|
||||||
for (i = 0; i < numlevelflats; i++)
|
for (i = 0; i < numlevelflats; i++)
|
||||||
{
|
{
|
||||||
const levelflat_t *levelflat = &levelflats[i];
|
levelflat = levelflats[i];
|
||||||
lump = levelflat->lumpnum;
|
lump = levelflat.lumpnum;
|
||||||
|
|
||||||
HWR_GetFlat(lump, false);
|
HWR_GetFlat(lump, false);
|
||||||
|
|
||||||
if (!levelflat->speed) // is it an animated flat ?
|
if (levelflat.speed) // it is an animated flat
|
||||||
continue;
|
|
||||||
|
|
||||||
for (k = 1; k < levelflat->numpics; k++)
|
|
||||||
{
|
{
|
||||||
lump = levelflat->baselumpnum + k;
|
for (k = 1; k < levelflat.numpics; k++)
|
||||||
HWR_GetFlat(lump, false);
|
{
|
||||||
|
lump = levelflat.baselumpnum + k;
|
||||||
|
HWR_GetFlat(lump, false);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -663,55 +670,52 @@ static void HWR_PrecacheLevelTextures(void)
|
|||||||
{
|
{
|
||||||
char *texturepresent;
|
char *texturepresent;
|
||||||
anim_t *anim;
|
anim_t *anim;
|
||||||
size_t i, j, f;
|
size_t i, j;
|
||||||
INT32 h;
|
INT32 h;
|
||||||
|
|
||||||
texturepresent = calloc(numtextures, sizeof (*texturepresent));
|
texturepresent = calloc(numtextures, sizeof (*texturepresent));
|
||||||
if (texturepresent == NULL)
|
if (texturepresent == NULL) I_Error("%s: Out of memory looking up textures", "HWR_PrecacheLevel");
|
||||||
I_Error("%s: Out of memory looking up textures", "HWR_PrecacheLevel");
|
|
||||||
|
|
||||||
// Sky texture is always present.
|
|
||||||
// Note that F_SKY1 is the name used to indicate a sky floor/ceiling as a flat,
|
|
||||||
// while the sky texture is stored like a wall texture, with a skynum dependent name.
|
|
||||||
texturepresent[skytexture] = 1;
|
|
||||||
HWR_GetTexture(skytexture, false);
|
|
||||||
|
|
||||||
for (i = 0; i < numlines; i++)
|
for (i = 0; i < numlines; i++)
|
||||||
{
|
{
|
||||||
const line_t *line = &lines[i];
|
line_t *line = &lines[i];
|
||||||
#ifdef GLENCORE
|
#ifdef GLENCORE
|
||||||
const int noencoremap = ((encoremap && (line->flags & ML_TFERLINE)) ? 2 : 1);
|
const int noencoremap = ((line->flags & ML_TFERLINE) ? 2 : 1);
|
||||||
#else
|
#else
|
||||||
const int noencoremap = 1;
|
const int noencoremap = 1;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
// line checked already?
|
||||||
|
if (line->validcount == validcount)
|
||||||
|
continue;
|
||||||
|
|
||||||
|
line->validcount = validcount;
|
||||||
|
|
||||||
// two sides
|
// two sides
|
||||||
for (j = 0; j < 2; j++)
|
for (j = 0; j < 2; j++)
|
||||||
{
|
{
|
||||||
// check if single-sided linedef
|
side_t *side = &sides[line->sidenum[j]];
|
||||||
|
|
||||||
|
// Single-side linedef
|
||||||
if (line->sidenum[j] == 0xffff)
|
if (line->sidenum[j] == 0xffff)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
const side_t *side = &sides[line->sidenum[j]];
|
if (side->toptexture >= 0 && side->toptexture < numtextures)
|
||||||
const INT32 sidetex[] = {side->toptexture, side->midtexture, side->bottomtexture};
|
|
||||||
|
|
||||||
// gotta check from top to bottom uwu
|
|
||||||
for (f = 0; f < 3; f++)
|
|
||||||
{
|
{
|
||||||
const INT32 texnum = sidetex[f];
|
texturepresent[side->toptexture] = 1|noencoremap;
|
||||||
if (texnum < 0 || texnum >= numtextures || texturepresent[texnum])
|
}
|
||||||
continue;
|
if (side->midtexture >= 0 && side->midtexture < numtextures)
|
||||||
|
{
|
||||||
texturepresent[texnum] = 1|noencoremap;
|
texturepresent[side->midtexture] = 1|noencoremap;
|
||||||
|
}
|
||||||
HWR_GetTexture(texnum, false);
|
if (side->bottomtexture >= 0 && side->bottomtexture < numtextures)
|
||||||
#ifdef GLENCORE
|
{
|
||||||
if (noencoremap & 2)
|
texturepresent[side->bottomtexture] = 1|noencoremap;
|
||||||
HWR_GetTexture(texnum, true);
|
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// check for animated textures
|
||||||
for (anim = anims; anim < lastanim; anim++)
|
for (anim = anims; anim < lastanim; anim++)
|
||||||
{
|
{
|
||||||
if (!anim->istexture)
|
if (!anim->istexture)
|
||||||
@@ -722,21 +726,47 @@ static void HWR_PrecacheLevelTextures(void)
|
|||||||
if (!texpresent)
|
if (!texpresent)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
for (h = 1; h < anim->numpics; h++)
|
if (texpresent & 1)
|
||||||
{
|
{
|
||||||
if (texpresent & 1)
|
for (h = 1; h < anim->numpics; h++)
|
||||||
{
|
{
|
||||||
HWR_GetTexture(anim->basepic+h, false);
|
HWR_GetTexture(anim->basepic+h, false);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
#ifdef GLENCORE
|
#ifdef GLENCORE
|
||||||
if (texpresent & 2)
|
if (texpresent & 2)
|
||||||
|
{
|
||||||
|
for (h = 1; h < anim->numpics; h++)
|
||||||
{
|
{
|
||||||
HWR_GetTexture(anim->basepic+h, true);
|
HWR_GetTexture(anim->basepic+h, true);
|
||||||
}
|
}
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Sky texture is always present.
|
||||||
|
// Note that F_SKY1 is the name used to indicate a sky floor/ceiling as a flat,
|
||||||
|
// while the sky texture is stored like a wall texture, with a skynum dependent name.
|
||||||
|
texturepresent[skytexture] = 1;
|
||||||
|
|
||||||
|
for (i = 0; i < (unsigned)numtextures; i++)
|
||||||
|
{
|
||||||
|
const char texpresent = texturepresent[i];
|
||||||
|
|
||||||
|
if (!texpresent)
|
||||||
|
continue;
|
||||||
|
|
||||||
|
if (texpresent & 1)
|
||||||
|
{
|
||||||
|
HWR_GetTexture(i, false);
|
||||||
|
}
|
||||||
|
#ifdef GLENCORE
|
||||||
|
if (texpresent & 2)
|
||||||
|
{
|
||||||
|
HWR_GetTexture(i, true);
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
}
|
||||||
free(texturepresent);
|
free(texturepresent);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -745,19 +775,21 @@ static void HWR_PrecacheLevelSprites(void)
|
|||||||
patch_t *spritepatch;
|
patch_t *spritepatch;
|
||||||
char *spritepresent;
|
char *spritepresent;
|
||||||
size_t i, j, k;
|
size_t i, j, k;
|
||||||
|
lumpnum_t lump;
|
||||||
|
|
||||||
thinker_t *th;
|
thinker_t *th;
|
||||||
|
mobj_t *mo;
|
||||||
|
spriteframe_t *sf;
|
||||||
|
|
||||||
spritepresent = calloc(numsprites, sizeof (*spritepresent));
|
spritepresent = calloc(numsprites, sizeof (*spritepresent));
|
||||||
if (spritepresent == NULL)
|
if (spritepresent == NULL) I_Error("%s: Out of memory looking up sprites", "HWR_PrecacheLevel");
|
||||||
I_Error("%s: Out of memory looking up sprites", "HWR_PrecacheLevel");
|
|
||||||
|
|
||||||
for (th = thinkercap.next; th != &thinkercap; th = th->next)
|
for (th = thinkercap.next; th != &thinkercap; th = th->next)
|
||||||
{
|
{
|
||||||
if (th->function != (actionf_p1)P_MobjThinker)
|
if (th->function != (actionf_p1)P_MobjThinker)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
const mobj_t *mo = (mobj_t *)th;
|
mo = (mobj_t *)th;
|
||||||
|
|
||||||
// ogl is weird
|
// ogl is weird
|
||||||
// for some reason it does not want to preload sprites with colormaps
|
// for some reason it does not want to preload sprites with colormaps
|
||||||
@@ -775,10 +807,10 @@ static void HWR_PrecacheLevelSprites(void)
|
|||||||
|
|
||||||
for (j = 0; j < sprites[i].numframes; j++)
|
for (j = 0; j < sprites[i].numframes; j++)
|
||||||
{
|
{
|
||||||
const spriteframe_t *sf = &sprites[i].spriteframes[j];
|
sf = &sprites[i].spriteframes[j];
|
||||||
|
|
||||||
#define cacheang(a) {\
|
#define cacheang(a) {\
|
||||||
const lumpnum_t lump = sf->lumppat[a];\
|
lump = sf->lumppat[a];\
|
||||||
spritepatch = (patch_t *)W_CachePatchNum(lump, PU_SPRITE);\
|
spritepatch = (patch_t *)W_CachePatchNum(lump, PU_SPRITE);\
|
||||||
if (spritepatch != NULL)\
|
if (spritepatch != NULL)\
|
||||||
HWR_GetPatch(spritepatch);\
|
HWR_GetPatch(spritepatch);\
|
||||||
|
|||||||
+78
-123
@@ -1138,33 +1138,6 @@ static boolean K_UseColorSpeedo(int speedostyle)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
enum
|
|
||||||
{
|
|
||||||
GAUGE_DEFAULT = 1,
|
|
||||||
GAUGE_SMALL,
|
|
||||||
GAUGE_BIGNUM,
|
|
||||||
GAUGE_NUMONLY,
|
|
||||||
GAUGE_EXTRA,
|
|
||||||
};
|
|
||||||
|
|
||||||
static SINT8 K_GetDriftgaugeStyle(void)
|
|
||||||
{
|
|
||||||
if (driftgaugegfx)
|
|
||||||
{
|
|
||||||
if (cv_driftgaugestyle.value == 1)
|
|
||||||
return GAUGE_DEFAULT;
|
|
||||||
else if (cv_driftgaugestyle.value == 2)
|
|
||||||
return GAUGE_SMALL;
|
|
||||||
else if (cv_driftgaugestyle.value == 3)
|
|
||||||
return GAUGE_BIGNUM;
|
|
||||||
else if (cv_driftgaugestyle.value == 5 && xtra_speedo3)
|
|
||||||
return GAUGE_EXTRA;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Fallback
|
|
||||||
return GAUGE_NUMONLY; // (cv_driftgaugestyle.value == 4)
|
|
||||||
}
|
|
||||||
|
|
||||||
static boolean K_IsHighResolution(void)
|
static boolean K_IsHighResolution(void)
|
||||||
{
|
{
|
||||||
return (vid.width >= 640 && vid.height >= 400);
|
return (vid.width >= 640 && vid.height >= 400);
|
||||||
@@ -1340,76 +1313,40 @@ static void K_drawKartStats(void)
|
|||||||
spdxoffset = 0;
|
spdxoffset = 0;
|
||||||
spdoffset = 0;
|
spdoffset = 0;
|
||||||
|
|
||||||
|
flags = V_SNAPTOBOTTOM|V_SNAPTOLEFT;
|
||||||
|
|
||||||
if (!LUA_HudEnabled(hud_statdisplay))
|
if (!LUA_HudEnabled(hud_statdisplay))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
flags = V_SNAPTOBOTTOM|V_SNAPTOLEFT;
|
|
||||||
|
|
||||||
//Internal offset for speedometer
|
//Internal offset for speedometer
|
||||||
|
|
||||||
const UINT8 speedostyle = K_GetSpeedometerStyle();
|
const UINT8 speedostyle = K_GetSpeedometerStyle();
|
||||||
|
|
||||||
if (cv_kartspeedometer.value && (!splitscreen))
|
if (cv_kartspeedometer.value && (!splitscreen))
|
||||||
{
|
{
|
||||||
switch (speedostyle)
|
if ((speedostyle == SPEEDO_EXTRA) || (speedostyle == SPEEDO_ACHII) || (speedostyle == SPEEDO_EXTRA3))
|
||||||
|
spdoffset = -10;
|
||||||
|
else if (speedostyle == SPEEDO_DIAL)
|
||||||
{
|
{
|
||||||
case SPEEDO_EXTRA:
|
spdxoffset = 11;
|
||||||
case SPEEDO_ACHII:
|
spdoffset = 14;
|
||||||
case SPEEDO_EXTRA3:
|
|
||||||
spdoffset = -10;
|
|
||||||
break;
|
|
||||||
case SPEEDO_DIAL:
|
|
||||||
spdxoffset = 11;
|
|
||||||
spdoffset = 14;
|
|
||||||
break;
|
|
||||||
default:
|
|
||||||
spdoffset = -14;
|
|
||||||
break;
|
|
||||||
}
|
}
|
||||||
|
else
|
||||||
|
spdoffset = -14;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
spdoffset = 0;
|
spdoffset = 0;
|
||||||
|
|
||||||
if (G_BattleGametype() && ((speedostyle != SPEEDO_DIAL) || splitscreen))
|
if ((speedostyle != SPEEDO_DIAL) || (splitscreen))
|
||||||
spdoffset += ((stplyr->kartstuff[k_bumper] ? -5 : -8));
|
spdoffset += (G_BattleGametype() ? (stplyr->kartstuff[k_bumper] ? -5 : -8) : 0);
|
||||||
|
|
||||||
// Customizations c:
|
// Customizations c:
|
||||||
if (!splitscreen)
|
if (!splitscreen)
|
||||||
{
|
{
|
||||||
skin_t *fakeskin;
|
|
||||||
INT32 flags2;
|
|
||||||
|
|
||||||
x += 18 + cv_stat_xoffset.value + spdxoffset;
|
x += 18 + cv_stat_xoffset.value + spdxoffset;
|
||||||
y += cv_stat_yoffset.value + spdoffset;
|
y += cv_stat_yoffset.value + spdoffset;
|
||||||
|
|
||||||
flags |= V_HUDTRANS;
|
|
||||||
flags2 = flags|V_ALLOWLOWERCASE|V_SkinColorToHighlightcolor(stplyr->skincolor);
|
|
||||||
|
|
||||||
fakeskin = K_GetPlayerSkin(stplyr);
|
|
||||||
|
|
||||||
// Skin name
|
|
||||||
if (K_IsHighResolution()) // V_DrawSmallString becomes a mess at low resolutions lel
|
|
||||||
{
|
|
||||||
V_DrawSmallString(x+20, y+12, flags2, fakeskin->realname);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
V_DrawThinString(x+20, y+7, flags2, fakeskin->realname);
|
|
||||||
}
|
|
||||||
|
|
||||||
// Icon and stats
|
|
||||||
if (K_UseHighResPortraits())
|
|
||||||
V_DrawSmallMappedPatch(x, y, flags, R_GetSkinFaceWant(stplyr), R_GetLocalTranslationColormap(fakeskin, fakeskin, stplyr->skincolor, GTC_CACHE, stplyr->skinlocal));
|
|
||||||
else
|
|
||||||
V_DrawMappedPatch(x, y, flags, R_GetSkinFaceRank(stplyr), R_GetLocalTranslationColormap(fakeskin, fakeskin, stplyr->skincolor, GTC_CACHE, stplyr->skinlocal));
|
|
||||||
|
|
||||||
V_DrawMappedPatch(x-3, y-2, flags, kp_facenum[min(9, max(1, stplyr->kartspeed))], R_GetTranslationColormap(TC_RAINBOW, SKINCOLOR_BLUEBERRY, GTC_CACHE));
|
|
||||||
V_DrawMappedPatch(x+10, y+10, flags, kp_facenum[min(9, max(1, stplyr->kartweight))], R_GetTranslationColormap(TC_RAINBOW, SKINCOLOR_BURGUNDY, GTC_CACHE));
|
|
||||||
|
|
||||||
return;
|
|
||||||
}
|
}
|
||||||
|
else if (splitscreen == 1) // I tried my best, but this is still mess :/ < :Blobcatpats: c:
|
||||||
if (splitscreen == 1) // I tried my best, but this is still mess :/ < :Blobcatpats: c:
|
|
||||||
{
|
{
|
||||||
x -= 10;
|
x -= 10;
|
||||||
y -= 40;
|
y -= 40;
|
||||||
@@ -1447,8 +1384,35 @@ static void K_drawKartStats(void)
|
|||||||
|
|
||||||
flags |= V_HUDTRANS;
|
flags |= V_HUDTRANS;
|
||||||
|
|
||||||
// In splitscreen, just draw a string with stats
|
if (!splitscreen)
|
||||||
V_DrawString(x, y+10, flags, va("\x84%dS \x87%dW", stplyr->kartspeed, stplyr->kartweight));
|
{
|
||||||
|
skin_t *fakeskin;
|
||||||
|
fakeskin = K_GetPlayerSkin(stplyr);
|
||||||
|
|
||||||
|
// Skin name
|
||||||
|
if (K_IsHighResolution()) // V_DrawSmallString becomes a mess at low resolutions lel
|
||||||
|
{
|
||||||
|
V_DrawSmallString(x+20, y+12, flags|V_ALLOWLOWERCASE|V_SkinColorToHighlightcolor(stplyr->skincolor), fakeskin->realname);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
V_DrawThinString(x+20, y+7, flags|V_ALLOWLOWERCASE|V_SkinColorToHighlightcolor(stplyr->skincolor), fakeskin->realname);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Icon and stats
|
||||||
|
if (K_UseHighResPortraits())
|
||||||
|
V_DrawSmallMappedPatch(x, y, flags, R_GetSkinFaceWant(stplyr), R_GetLocalTranslationColormap(fakeskin, fakeskin, stplyr->skincolor, GTC_CACHE, stplyr->skinlocal));
|
||||||
|
else
|
||||||
|
V_DrawMappedPatch(x, y, flags, R_GetSkinFaceRank(stplyr), R_GetLocalTranslationColormap(fakeskin, fakeskin, stplyr->skincolor, GTC_CACHE, stplyr->skinlocal));
|
||||||
|
|
||||||
|
V_DrawMappedPatch(x-3, y-2, flags, kp_facenum[min(9, max(1, stplyr->kartspeed))], R_GetTranslationColormap(TC_RAINBOW, SKINCOLOR_BLUEBERRY, GTC_CACHE));
|
||||||
|
V_DrawMappedPatch(x+10, y+10, flags, kp_facenum[min(9, max(1, stplyr->kartweight))], R_GetTranslationColormap(TC_RAINBOW, SKINCOLOR_BURGUNDY, GTC_CACHE));
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
// In splitscreen, just draw a string with stats
|
||||||
|
V_DrawString(x, y+10, flags, va("\x84%dS \x87%dW", stplyr->kartspeed, stplyr->kartweight));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static void K_drawKartItem(void)
|
static void K_drawKartItem(void)
|
||||||
@@ -1735,7 +1699,7 @@ static void K_drawKartItem(void)
|
|||||||
switch (stplyr->kartstuff[k_itemblinkmode])
|
switch (stplyr->kartstuff[k_itemblinkmode])
|
||||||
{
|
{
|
||||||
case 2:
|
case 2:
|
||||||
localcolor = K_RainbowColor();
|
localcolor = (UINT8)(1 + (leveltime % (MAXSKINCOLORS-1)));
|
||||||
break;
|
break;
|
||||||
case 1:
|
case 1:
|
||||||
localcolor = SKINCOLOR_RED;
|
localcolor = SKINCOLOR_RED;
|
||||||
@@ -3185,7 +3149,7 @@ static void K_drawDriftGauge(void)
|
|||||||
fixed_t basex, basey;
|
fixed_t basex, basey;
|
||||||
const int dup = vid.dupx;
|
const int dup = vid.dupx;
|
||||||
int i;
|
int i;
|
||||||
UINT8 *colormap = NULL;
|
UINT8 *cmap;
|
||||||
|
|
||||||
static const UINT8 driftcolors[3][4] = {
|
static const UINT8 driftcolors[3][4] = {
|
||||||
{0, 0, 10, 16}, // no drift
|
{0, 0, 10, 16}, // no drift
|
||||||
@@ -3231,21 +3195,23 @@ skipcrap:
|
|||||||
const INT32 driftcharge = min(driftval*4, stplyr->kartstuff[k_driftcharge]);
|
const INT32 driftcharge = min(driftval*4, stplyr->kartstuff[k_driftcharge]);
|
||||||
const INT32 driftlevel = min(driftcharge / driftval, 2);
|
const INT32 driftlevel = min(driftcharge / driftval, 2);
|
||||||
const INT32 drifttrans = ((cv_driftgaugetrans.value) ? V_LocalTransFlag() : 0);
|
const INT32 drifttrans = ((cv_driftgaugetrans.value) ? V_LocalTransFlag() : 0);
|
||||||
const SINT8 gaugestyle = K_GetDriftgaugeStyle();
|
|
||||||
|
|
||||||
basex = pos.x>>FRACBITS;
|
basex = pos.x>>FRACBITS;
|
||||||
basey = pos.y>>FRACBITS;
|
basey = pos.y>>FRACBITS;
|
||||||
|
|
||||||
switch (gaugestyle)
|
switch (cv_driftgaugestyle.value)
|
||||||
{
|
{
|
||||||
case GAUGE_DEFAULT:
|
case 1:
|
||||||
case GAUGE_SMALL:
|
case 2:
|
||||||
case GAUGE_EXTRA:
|
case 3:
|
||||||
case GAUGE_BIGNUM:
|
case 5:
|
||||||
{
|
{
|
||||||
patch_t *driftpatch = NULL;
|
if (!driftgaugegfx)
|
||||||
|
break;
|
||||||
|
|
||||||
if (gaugestyle == GAUGE_DEFAULT || gaugestyle == GAUGE_BIGNUM || gaugestyle == GAUGE_EXTRA)
|
const boolean usescaledpatch = (cv_driftgaugestyle.value == 5 && xtra_speedo3);
|
||||||
|
|
||||||
|
if (cv_driftgaugestyle.value == 1 || cv_driftgaugestyle.value == 3 || usescaledpatch)
|
||||||
{
|
{
|
||||||
barx = basex - dup*23;
|
barx = basex - dup*23;
|
||||||
BAR_WIDTH = dup*47;
|
BAR_WIDTH = dup*47;
|
||||||
@@ -3258,44 +3224,40 @@ skipcrap:
|
|||||||
|
|
||||||
bary = basey - dup*2;
|
bary = basey - dup*2;
|
||||||
|
|
||||||
if (gaugestyle == GAUGE_EXTRA) // i hate hud code i hate hud code i hate hud code i hate hud code i hate hud code.....
|
if (usescaledpatch) // i hate hud code i hate hud code i hate hud code i hate hud code i hate hud code.....
|
||||||
{
|
{
|
||||||
if (K_UseColorSpeedo(SPEEDO_EXTRA3)) // We reuse the extra speedometer patch hence this check
|
if (K_UseColorSpeedo(SPEEDO_EXTRA3)) // Colourized hud
|
||||||
{
|
{
|
||||||
colormap = R_GetTranslationColormap(TC_DEFAULT, K_GetHudColor(), GTC_CACHE);
|
UINT8 *colormap = R_GetTranslationColormap(TC_DEFAULT, K_GetHudColor(), GTC_CACHE);
|
||||||
driftpatch = skp_smallstickerclr3;
|
V_DrawStretchyFixedPatch((basex - dup*30)<<FRACBITS, ((basey<<FRACBITS) - FixedMul(dup<<FRACBITS, 21*FRACUNIT/10)), XTRA3PSCALE, XTRA3VSCALE, V_NOSCALESTART|V_OFFSET|drifttrans, skp_smallstickerclr3, colormap, 0);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
driftpatch = skp_smallsticker3;
|
V_DrawStretchyFixedPatch((basex - dup*30)<<FRACBITS, ((basey<<FRACBITS) - FixedMul(dup<<FRACBITS, 21*FRACUNIT/10)), XTRA3PSCALE, XTRA3VSCALE, V_NOSCALESTART|V_OFFSET|drifttrans, skp_smallsticker3, NULL, 0);
|
||||||
|
|
||||||
V_DrawStretchyFixedPatch((basex - dup*30)<<FRACBITS, ((basey<<FRACBITS) - FixedMul(dup<<FRACBITS, 21*FRACUNIT/10)), XTRA3PSCALE, XTRA3VSCALE, V_NOSCALESTART|V_OFFSET|drifttrans, driftpatch, colormap, 0);
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
if (K_UseColorHud()) // Colourized hud
|
if (K_UseColorHud()) // Colourized hud
|
||||||
{
|
{
|
||||||
colormap = R_GetTranslationColormap(TC_DEFAULT, K_GetHudColor(), GTC_CACHE);
|
UINT8 *colormap = R_GetTranslationColormap(TC_DEFAULT, K_GetHudColor(), GTC_CACHE);
|
||||||
driftpatch = (gaugestyle == GAUGE_SMALL ? driftgaugesmallcolor : driftgaugecolor);
|
V_DrawMappedPatch(cv_driftgaugestyle.value == 2 ? basex + dup*11 : basex, basey, V_NOSCALESTART|V_OFFSET|drifttrans, cv_driftgaugestyle.value == 2 ? driftgaugesmallcolor : driftgaugecolor, colormap);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
driftpatch = (gaugestyle == GAUGE_SMALL ? driftgaugesmall : driftgauge);
|
V_DrawMappedPatch(cv_driftgaugestyle.value == 2 ? basex + dup*11 : basex, basey, V_NOSCALESTART|V_OFFSET|drifttrans, cv_driftgaugestyle.value == 2 ? driftgaugesmall : driftgauge, NULL);
|
||||||
|
|
||||||
V_DrawMappedPatch(gaugestyle == GAUGE_SMALL ? basex + dup*11 : basex, basey, V_NOSCALESTART|V_OFFSET|drifttrans, driftpatch, colormap);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (driftcharge >= driftval*4) // rainbow sparks
|
if (driftcharge >= driftval*4) // rainbow sparks
|
||||||
{
|
{
|
||||||
colormap = R_GetTranslationColormap(TC_RAINBOW, K_RainbowColor(), GTC_CACHE);
|
cmap = R_GetTranslationColormap(TC_RAINBOW, 1 + leveltime % (MAXSKINCOLORS-1),GTC_CACHE);
|
||||||
|
|
||||||
for (i = 0; i < 4; i++)
|
for (i = 0; i < 4; i++)
|
||||||
V_DrawFill(barx, bary+dup*1+dup*i, BAR_WIDTH, dup, (driftrainbow[min((leveltime % 18) + 1, 17)] + i*2) | V_NOSCALESTART|drifttrans);
|
V_DrawFill(barx, bary+dup*1+dup*i, BAR_WIDTH, dup, (driftrainbow[min((leveltime % 18) + 1, 18 - 1)] + i*2) | V_NOSCALESTART|drifttrans);
|
||||||
}
|
}
|
||||||
else // none/blue/red
|
else // none/blue/red
|
||||||
{
|
{
|
||||||
const INT32 limit = (driftval * (driftcharge >= driftval*2 ? 2 : 1));
|
const INT32 limit = (driftval * (driftcharge >= driftval*2 ? 2 : 1));
|
||||||
const INT32 width = ((driftcharge - (driftcharge >= driftval ? limit : 0)) * BAR_WIDTH) / limit;
|
const INT32 width = ((driftcharge - (driftcharge >= driftval ? limit : 0)) * BAR_WIDTH) / limit;
|
||||||
|
|
||||||
colormap = R_GetTranslationColormap(TC_RAINBOW, driftskins[driftlevel], GTC_CACHE);
|
cmap = R_GetTranslationColormap(TC_RAINBOW, driftskins[driftlevel],GTC_CACHE);
|
||||||
|
|
||||||
for (i = 0; i < 4; i++)
|
for (i = 0; i < 4; i++)
|
||||||
{
|
{
|
||||||
@@ -3307,20 +3269,20 @@ skipcrap:
|
|||||||
}
|
}
|
||||||
|
|
||||||
// right, also draw a cool number
|
// right, also draw a cool number
|
||||||
if (gaugestyle == GAUGE_BIGNUM)
|
if (cv_driftgaugestyle.value == 3)
|
||||||
V_DrawPaddedTallColorNum(basex + (dup*32), basey, V_NOSCALESTART|V_OFFSET|drifttrans, driftcharge*100 / driftval, 3, colormap);
|
V_DrawPaddedTallColorNum(basex + (dup*32), basey, V_NOSCALESTART|V_OFFSET|drifttrans, driftcharge*100 / driftval, 3, cmap);
|
||||||
else
|
else
|
||||||
V_DrawPingNum((gaugestyle == GAUGE_SMALL ? basex + (dup*22) : basex + (dup*32)), basey, V_NOSCALESTART|V_OFFSET|drifttrans, driftcharge*100 / driftval, colormap);
|
V_DrawPingNum(cv_driftgaugestyle.value == 2 ? basex + (dup*22) : basex + (dup*32), basey, V_NOSCALESTART|V_OFFSET|drifttrans, driftcharge*100 / driftval, cmap);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case GAUGE_NUMONLY:
|
case 4:
|
||||||
{
|
{
|
||||||
if (driftcharge >= driftval*4)
|
if (driftcharge >= driftval*4)
|
||||||
colormap = R_GetTranslationColormap(TC_RAINBOW, K_RainbowColor(), GTC_CACHE);
|
cmap = R_GetTranslationColormap(TC_RAINBOW, 1 + leveltime % (MAXSKINCOLORS-1),GTC_CACHE);
|
||||||
else
|
else
|
||||||
colormap = R_GetTranslationColormap(TC_RAINBOW, driftskins[driftlevel], GTC_CACHE);
|
cmap = R_GetTranslationColormap(TC_RAINBOW, driftskins[driftlevel],GTC_CACHE);
|
||||||
|
|
||||||
V_DrawPaddedTallColorNum(basex + (dup*16), basey, V_NOSCALESTART|V_OFFSET|drifttrans, driftcharge*100 / driftval, 3, colormap);
|
V_DrawPaddedTallColorNum(basex + (dup*16), basey, V_NOSCALESTART|V_OFFSET|drifttrans, driftcharge*100 / driftval, 3, cmap);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
@@ -3381,7 +3343,6 @@ static void K_drawKartWanted(void)
|
|||||||
{
|
{
|
||||||
basex = WANT_X;
|
basex = WANT_X;
|
||||||
basey = WANT_Y;
|
basey = WANT_Y;
|
||||||
|
|
||||||
if (splitscreen == 2)
|
if (splitscreen == 2)
|
||||||
{
|
{
|
||||||
basey += 16; // slight adjust for 3P
|
basey += 16; // slight adjust for 3P
|
||||||
@@ -4131,23 +4092,17 @@ static void K_drawKartFirstPerson(void)
|
|||||||
x -= xoffs;
|
x -= xoffs;
|
||||||
else
|
else
|
||||||
x += xoffs;
|
x += xoffs;
|
||||||
|
|
||||||
if (!splitscreen)
|
if (!splitscreen)
|
||||||
y += yoffs;
|
y += yoffs;
|
||||||
}
|
}
|
||||||
|
|
||||||
const INT32 driftcharge = stplyr->kartstuff[k_driftcharge];
|
|
||||||
|
|
||||||
// drift sparks!
|
// drift sparks!
|
||||||
if ((leveltime & 1) && driftcharge)
|
if ((leveltime & 1) && (stplyr->kartstuff[k_driftcharge] >= dsthree))
|
||||||
{
|
colmap = R_GetTranslationColormap(TC_RAINBOW, (UINT8)(1 + (leveltime % (MAXSKINCOLORS-1))), GTC_CACHE);
|
||||||
if (driftcharge >= dsthree)
|
else if ((leveltime & 1) && (stplyr->kartstuff[k_driftcharge] >= dstwo))
|
||||||
colmap = R_GetTranslationColormap(TC_RAINBOW, K_RainbowColor(), GTC_CACHE);
|
colmap = R_GetTranslationColormap(TC_RAINBOW, SKINCOLOR_KETCHUP, GTC_CACHE);
|
||||||
else if (driftcharge >= dstwo)
|
else if ((leveltime & 1) && (stplyr->kartstuff[k_driftcharge] >= dsone))
|
||||||
colmap = R_GetTranslationColormap(TC_RAINBOW, SKINCOLOR_KETCHUP, GTC_CACHE);
|
colmap = R_GetTranslationColormap(TC_RAINBOW, SKINCOLOR_SAPPHIRE, GTC_CACHE);
|
||||||
else if (driftcharge >= dsone)
|
|
||||||
colmap = R_GetTranslationColormap(TC_RAINBOW, SKINCOLOR_SAPPHIRE, GTC_CACHE);
|
|
||||||
}
|
|
||||||
else
|
else
|
||||||
#endif
|
#endif
|
||||||
// invincibility/grow/shrink!
|
// invincibility/grow/shrink!
|
||||||
@@ -4176,7 +4131,7 @@ static void K_drawInput(void)
|
|||||||
|
|
||||||
const UINT8 hudcolor = K_GetHudColor();
|
const UINT8 hudcolor = K_GetHudColor();
|
||||||
const INT32 accent1 = splitflags|colortranslations[hudcolor][5];
|
const INT32 accent1 = splitflags|colortranslations[hudcolor][5];
|
||||||
const INT32 accent2 = splitflags|colortranslations[hudcolor][7];
|
const INT32 accent2 = splitflags|colortranslations[hudcolor][9];
|
||||||
const UINT8 *hudcolormap = R_GetTranslationColormap(0, hudcolor, GTC_CACHE);
|
const UINT8 *hudcolormap = R_GetTranslationColormap(0, hudcolor, GTC_CACHE);
|
||||||
|
|
||||||
const ticcmd_t *cmd = &stplyr->cmd;
|
const ticcmd_t *cmd = &stplyr->cmd;
|
||||||
|
|||||||
+2
-21
@@ -484,15 +484,6 @@ UINT8 colortranslations[MAXTRANSLATIONS][16] = {
|
|||||||
{120, 120, 96, 96, 97, 98, 98, 99, 81, 81, 69, 71, 73, 75, 77, 79}, // SKINCOLOR_CSUPER5
|
{120, 120, 96, 96, 97, 98, 98, 99, 81, 81, 69, 71, 73, 75, 77, 79}, // SKINCOLOR_CSUPER5
|
||||||
};
|
};
|
||||||
|
|
||||||
//
|
|
||||||
// Gives you a color to use for rainbow effects (like invincibility).
|
|
||||||
// Return: Skincolor value.
|
|
||||||
//
|
|
||||||
UINT8 K_RainbowColor(void)
|
|
||||||
{
|
|
||||||
return (UINT8)(1 + (leveltime % (MAXSKINCOLORS-1)));
|
|
||||||
}
|
|
||||||
|
|
||||||
// Define for getting accurate color brightness readings according to how the human eye sees them.
|
// Define for getting accurate color brightness readings according to how the human eye sees them.
|
||||||
// https://en.wikipedia.org/wiki/Relative_luminance
|
// https://en.wikipedia.org/wiki/Relative_luminance
|
||||||
// 0.2126 to red
|
// 0.2126 to red
|
||||||
@@ -654,46 +645,36 @@ UINT8 K_GetKartColorByName(const char *name)
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
//
|
|
||||||
// returns the players skinnumber
|
// returns the players skinnumber
|
||||||
// accounts for localskins
|
// accounts for localskins
|
||||||
//
|
|
||||||
INT32 K_GetSkinNum(player_t *player)
|
INT32 K_GetSkinNum(player_t *player)
|
||||||
{
|
{
|
||||||
return player->localskin ? (player->localskin - 1) : player->skin;
|
return player->localskin ? (player->localskin - 1) : player->skin;
|
||||||
}
|
}
|
||||||
|
|
||||||
//
|
|
||||||
// returns the mobj skinnumber
|
// returns the mobj skinnumber
|
||||||
// accounts for localskins
|
// accounts for localskins
|
||||||
//
|
|
||||||
INT32 K_GetMobjSkinNum(const skin_t *skin, boolean local)
|
INT32 K_GetMobjSkinNum(const skin_t *skin, boolean local)
|
||||||
{
|
{
|
||||||
return skin - K_GetSkinArray(local);
|
return skin - K_GetSkinArray(local);
|
||||||
}
|
}
|
||||||
|
|
||||||
//
|
|
||||||
// returns the players skinnumber
|
// returns the players skinnumber
|
||||||
// accounts for localskins
|
// accounts for localskins
|
||||||
//
|
|
||||||
skin_t *K_GetMobjSkin(const mobj_t *mobj)
|
skin_t *K_GetMobjSkin(const mobj_t *mobj)
|
||||||
{
|
{
|
||||||
return mobj->localskin ? mobj->localskin : mobj->skin;
|
return mobj->localskin ? mobj->localskin : mobj->skin;
|
||||||
}
|
}
|
||||||
|
|
||||||
//
|
|
||||||
// returns the skin array to use
|
// returns the skin array to use
|
||||||
// accounts for localskins
|
// accounts for localskins
|
||||||
//
|
|
||||||
skin_t *K_GetSkinArray(boolean local)
|
skin_t *K_GetSkinArray(boolean local)
|
||||||
{
|
{
|
||||||
return local ? localskins : skins;
|
return local ? localskins : skins;
|
||||||
}
|
}
|
||||||
|
|
||||||
//
|
|
||||||
// returns the players skin
|
// returns the players skin
|
||||||
// accounts for localskins
|
// accounts for localskins
|
||||||
//
|
|
||||||
skin_t *K_GetPlayerSkin(player_t *player)
|
skin_t *K_GetPlayerSkin(player_t *player)
|
||||||
{
|
{
|
||||||
return &K_GetSkinArray(player->skinlocal)[K_GetSkinNum(player)];
|
return &K_GetSkinArray(player->skinlocal)[K_GetSkinNum(player)];
|
||||||
@@ -3103,7 +3084,7 @@ static UINT16 K_DriftSparkColor(player_t *player, INT32 charge)
|
|||||||
|
|
||||||
if (charge >= K_GetKartDriftSparkValue(player)*4)
|
if (charge >= K_GetKartDriftSparkValue(player)*4)
|
||||||
{
|
{
|
||||||
color = K_RainbowColor();
|
color = (UINT8)(1 + (leveltime % (MAXSKINCOLORS-1)));
|
||||||
}
|
}
|
||||||
else if (charge >= K_GetKartDriftSparkValue(player)*2)
|
else if (charge >= K_GetKartDriftSparkValue(player)*2)
|
||||||
{
|
{
|
||||||
@@ -5390,7 +5371,7 @@ static UINT8 K_GetSpeedLineColor(player_t *player, boolean colorSpeed)
|
|||||||
else if (player->kartstuff[k_driftboost] <= 50)
|
else if (player->kartstuff[k_driftboost] <= 50)
|
||||||
speedcolor = SKINCOLOR_RASPBERRY;
|
speedcolor = SKINCOLOR_RASPBERRY;
|
||||||
else if (player->kartstuff[k_driftboost] <= 125)
|
else if (player->kartstuff[k_driftboost] <= 125)
|
||||||
speedcolor = K_RainbowColor();
|
speedcolor = (UINT8)(1 + (leveltime % (MAXSKINCOLORS-1)));
|
||||||
|
|
||||||
if (cv_coloredspeedlines.value == 2)
|
if (cv_coloredspeedlines.value == 2)
|
||||||
speedcolor = (leveltime & 1) ? playercolor : speedcolor;
|
speedcolor = (leveltime & 1) ? playercolor : speedcolor;
|
||||||
|
|||||||
@@ -19,7 +19,6 @@ extern "C" {
|
|||||||
extern UINT8 colortranslations[MAXTRANSLATIONS][16];
|
extern UINT8 colortranslations[MAXTRANSLATIONS][16];
|
||||||
extern const char *KartColor_Names[MAXSKINCOLORS];
|
extern const char *KartColor_Names[MAXSKINCOLORS];
|
||||||
extern const UINT8 KartColor_Opposite[MAXSKINCOLORS*2];
|
extern const UINT8 KartColor_Opposite[MAXSKINCOLORS*2];
|
||||||
UINT8 K_RainbowColor(void);
|
|
||||||
void K_RainbowColormap(UINT8 *dest_colormap, UINT8 skincolor);
|
void K_RainbowColormap(UINT8 *dest_colormap, UINT8 skincolor);
|
||||||
void K_GenerateKartColormap(UINT8 *dest_colormap, INT32 skinnum, UINT8 color, boolean local);
|
void K_GenerateKartColormap(UINT8 *dest_colormap, INT32 skinnum, UINT8 color, boolean local);
|
||||||
UINT8 K_GetKartColorByName(const char *name);
|
UINT8 K_GetKartColorByName(const char *name);
|
||||||
|
|||||||
@@ -66,7 +66,6 @@
|
|||||||
X (IntermissionThinker),/* Y_Ticker */\
|
X (IntermissionThinker),/* Y_Ticker */\
|
||||||
X (VoteThinker),/*SRB2KART*/\
|
X (VoteThinker),/*SRB2KART*/\
|
||||||
X (ServerJoin),/* SRB2KART - Saturn 32p*/\
|
X (ServerJoin),/* SRB2KART - Saturn 32p*/\
|
||||||
X (SetupVote),/*SRB2KART - Saturn*/
|
|
||||||
|
|
||||||
#define STRING_HOOK_LIST(X) \
|
#define STRING_HOOK_LIST(X) \
|
||||||
X (BotAI),/* B_BuildTailsTiccmd by skin name */\
|
X (BotAI),/* B_BuildTailsTiccmd by skin name */\
|
||||||
@@ -141,8 +140,3 @@ int LUA_HookShouldSquish(player_t *player, mobj_t *inflictor, mobj_t *source); /
|
|||||||
boolean LUA_HookPlayerSpin(player_t *player, mobj_t *inflictor, mobj_t *source); // SRB2KART: Hook for K_SpinPlayer. Allows Lua to execute code and/or overwrite its behavior.
|
boolean LUA_HookPlayerSpin(player_t *player, mobj_t *inflictor, mobj_t *source); // SRB2KART: Hook for K_SpinPlayer. Allows Lua to execute code and/or overwrite its behavior.
|
||||||
boolean LUA_HookPlayerExplode(player_t *player, mobj_t *inflictor, mobj_t *source); // SRB2KART: Hook for K_ExplodePlayer. Allows Lua to execute code and/or overwrite its behavior.
|
boolean LUA_HookPlayerExplode(player_t *player, mobj_t *inflictor, mobj_t *source); // SRB2KART: Hook for K_ExplodePlayer. Allows Lua to execute code and/or overwrite its behavior.
|
||||||
boolean LUA_HookPlayerSquish(player_t *player, mobj_t *inflictor, mobj_t *source); // SRB2KART: Hook for K_SquishPlayer. Allows Lua to execute code and/or overwrite its behavior.
|
boolean LUA_HookPlayerSquish(player_t *player, mobj_t *inflictor, mobj_t *source); // SRB2KART: Hook for K_SquishPlayer. Allows Lua to execute code and/or overwrite its behavior.
|
||||||
|
|
||||||
// SRB2KART - Saturn: Allows changing vote level picks
|
|
||||||
// (note: function format in lua doesn't include maxresults, so its function(result, gametype, secondgametype, prevmap)
|
|
||||||
// to get maxresults use #result)
|
|
||||||
void LUA_HookSetupVote(INT16 result[], INT16 maxresults, UINT8 gt, UINT8 secondgt);
|
|
||||||
@@ -1138,43 +1138,3 @@ boolean LUA_HookPlayerExplode(player_t *player, mobj_t *inflictor, mobj_t *sourc
|
|||||||
{
|
{
|
||||||
return kartdamage_hook(player, inflictor, source, HOOK(PlayerExplode), res_true);
|
return kartdamage_hook(player, inflictor, source, HOOK(PlayerExplode), res_true);
|
||||||
}
|
}
|
||||||
|
|
||||||
void LUA_HookSetupVote(INT16 result[], INT16 maxresults, UINT8 gt, UINT8 secondgt)
|
|
||||||
{
|
|
||||||
Hook_State hook;
|
|
||||||
if (prepare_hook(&hook, 0, HOOK(SetupVote)))
|
|
||||||
{
|
|
||||||
// { 0, 0, 0, 0, }
|
|
||||||
lua_newtable(gL);
|
|
||||||
for (int i = 1; i <= maxresults; ++i)
|
|
||||||
{
|
|
||||||
lua_pushinteger(gL, 0);
|
|
||||||
lua_rawseti(gL, -2, i);
|
|
||||||
}
|
|
||||||
|
|
||||||
// call_hooks does lua_settop(gL, 0) so we need to store our table somewhere
|
|
||||||
lua_pushvalue(gL, -1);
|
|
||||||
lua_setfield(gL, LUA_REGISTRYINDEX, "SetupVoteResults");
|
|
||||||
|
|
||||||
lua_pushinteger(gL, gt);
|
|
||||||
lua_pushinteger(gL, secondgt);
|
|
||||||
lua_pushinteger(gL, prevmap+1); // prevmap is gamemap-1 so we offset it back
|
|
||||||
|
|
||||||
call_hooks(&hook, 0, res_none);
|
|
||||||
|
|
||||||
lua_getfield(gL, LUA_REGISTRYINDEX, "SetupVoteResults");
|
|
||||||
for (int i = 1; i <= maxresults; ++i)
|
|
||||||
{
|
|
||||||
lua_rawgeti(gL, -1, i);
|
|
||||||
result[i-1] = lua_tointeger(gL, -1);
|
|
||||||
lua_pop(gL, 1);
|
|
||||||
|
|
||||||
if (result[i-1] && (result[i-1] < 0 || !mapheaderinfo[result[i-1]-1]))
|
|
||||||
{
|
|
||||||
CONS_Alert(CONS_WARNING, "Unknown map #%d for vote\n", result[i-1]);
|
|
||||||
result[i-1] = 0;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
lua_pop(gL, 1);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
+7
-12
@@ -24,7 +24,6 @@
|
|||||||
#include "p_slopes.h" // for P_SlopeById
|
#include "p_slopes.h" // for P_SlopeById
|
||||||
#include "s_sound.h"
|
#include "s_sound.h"
|
||||||
#include "m_menu.h"
|
#include "m_menu.h"
|
||||||
#include "m_argv.h"
|
|
||||||
#ifdef LUA_ALLOW_BYTECODE
|
#ifdef LUA_ALLOW_BYTECODE
|
||||||
#include "d_netfil.h" // for LUA_DumpFile
|
#include "d_netfil.h" // for LUA_DumpFile
|
||||||
#endif
|
#endif
|
||||||
@@ -253,11 +252,7 @@ static inline void LUA_LoadFile(MYFILE *f, char *name)
|
|||||||
|
|
||||||
lua_pushcfunction(gL, LUA_GetErrorMessage);
|
lua_pushcfunction(gL, LUA_GetErrorMessage);
|
||||||
if (luaL_loadbuffer(gL, f->data, f->size, va("@%s",name)) || lua_pcall(gL, 0, 0, lua_gettop(gL) - 1)) {
|
if (luaL_loadbuffer(gL, f->data, f->size, va("@%s",name)) || lua_pcall(gL, 0, 0, lua_gettop(gL) - 1)) {
|
||||||
if (M_CheckParm("-strict") || M_CheckParm("-strict-lua"))
|
CONS_Alert(CONS_WARNING,"%s\n",lua_tostring(gL,-1));
|
||||||
I_Error("Lua error: %s", lua_tostring(gL, -1));
|
|
||||||
else
|
|
||||||
CONS_Alert(CONS_WARNING,"%s\n",lua_tostring(gL,-1));
|
|
||||||
|
|
||||||
lua_pop(gL,1);
|
lua_pop(gL,1);
|
||||||
}
|
}
|
||||||
lua_gc(gL, LUA_GCCOLLECT, 0);
|
lua_gc(gL, LUA_GCCOLLECT, 0);
|
||||||
@@ -1028,8 +1023,8 @@ static UINT8 UnArchiveValue(UINT8 **p, int TABLESINDEX, boolean network)
|
|||||||
case ARCH_MOBJ:
|
case ARCH_MOBJ:
|
||||||
if (network == false) // for replays :chaosleep:
|
if (network == false) // for replays :chaosleep:
|
||||||
{
|
{
|
||||||
*p += sizeof(UINT32); // Skip this data, we can't read a mobj here, it'd point to garbage and crash the game.
|
*p += sizeof(UINT32); // Skip this data, we can't read a mobj here, it'd point to garbage and crash the game.
|
||||||
return 3; // Don't set the field
|
return 3; // Don't set the field
|
||||||
}
|
}
|
||||||
|
|
||||||
LUA_PushUserdata(gL, P_FindNewPosition(READUINT32(*p)), META_MOBJ);
|
LUA_PushUserdata(gL, P_FindNewPosition(READUINT32(*p)), META_MOBJ);
|
||||||
@@ -1104,9 +1099,9 @@ static void UnArchiveExtVars(UINT8 **p, void *pointer, boolean network)
|
|||||||
CONS_Alert(CONS_ERROR, "Unexpected end marker when reading ExtVars (field '%s')\n", field);
|
CONS_Alert(CONS_ERROR, "Unexpected end marker when reading ExtVars (field '%s')\n", field);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
else if (ret == 3) // This will return 3 if we shouldn't set this field.
|
else if (ret == 3) // This will return 3 if we shouldn't set this field.
|
||||||
{
|
{
|
||||||
//CONS_Alert(CONS_WARNING,"Cannot read mobj_t stored in player variable \'%s\'. Desyncs may occur.\n", field);
|
CONS_Alert(CONS_WARNING,"Cannot read mobj_t stored in player variable \'%s\'. Desyncs may occur.\n", field);
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1160,7 +1155,7 @@ static void UnArchiveTables(UINT8 **p, boolean network)
|
|||||||
ret = UnArchiveValue(p, TABLESINDEX, network);
|
ret = UnArchiveValue(p, TABLESINDEX, network);
|
||||||
if (ret == 3)
|
if (ret == 3)
|
||||||
{
|
{
|
||||||
//CONS_Alert(CONS_WARNING,"Couldn't read mobj_t\n");
|
CONS_Alert(CONS_WARNING,"Couldn't read mobj_t\n");
|
||||||
lua_pushnil(gL);
|
lua_pushnil(gL);
|
||||||
}
|
}
|
||||||
else if (ret == 1) // read key
|
else if (ret == 1) // read key
|
||||||
@@ -1175,7 +1170,7 @@ static void UnArchiveTables(UINT8 **p, boolean network)
|
|||||||
}
|
}
|
||||||
else if (ret == 3)
|
else if (ret == 3)
|
||||||
{
|
{
|
||||||
//CONS_Alert(CONS_WARNING,"Couldn't read mobj_t\n");
|
CONS_Alert(CONS_WARNING,"Couldn't read mobj_t\n");
|
||||||
lua_pushnil(gL);
|
lua_pushnil(gL);
|
||||||
}
|
}
|
||||||
else if (ret == 2) // read value
|
else if (ret == 2) // read value
|
||||||
|
|||||||
+14
-3
@@ -5271,13 +5271,24 @@ static void M_DrawSkyRoom(void)
|
|||||||
|
|
||||||
V_DrawRightAlignedString(BASEVIDWIDTH - currentMenu->x,
|
V_DrawRightAlignedString(BASEVIDWIDTH - currentMenu->x,
|
||||||
currentMenu->y+currentMenu->menuitems[2].alphaKey,
|
currentMenu->y+currentMenu->menuitems[2].alphaKey,
|
||||||
(music_disabled ? warningflags : highlightflags),
|
(digital_disabled ? warningflags : highlightflags),
|
||||||
(music_disabled ? "OFF" : "ON"));
|
(digital_disabled ? "OFF" : "ON"));
|
||||||
|
|
||||||
|
#ifndef NO_MIDI
|
||||||
|
V_DrawRightAlignedString(BASEVIDWIDTH - currentMenu->x,
|
||||||
|
currentMenu->y+currentMenu->menuitems[5].alphaKey,
|
||||||
|
(midi_disabled ? warningflags : highlightflags),
|
||||||
|
(midi_disabled ? "OFF" : "ON"));
|
||||||
|
#endif
|
||||||
|
|
||||||
if (itemOn == 0)
|
if (itemOn == 0)
|
||||||
lengthstring = 8*(sound_disabled ? 3 : 2);
|
lengthstring = 8*(sound_disabled ? 3 : 2);
|
||||||
else if (itemOn == 2)
|
else if (itemOn == 2)
|
||||||
lengthstring = 8*(music_disabled ? 3 : 2);
|
lengthstring = 8*(digital_disabled ? 3 : 2);
|
||||||
|
#ifndef NO_MIDI
|
||||||
|
else if (itemOn == 5)
|
||||||
|
lengthstring = 8*(midi_disabled ? 3 : 2);
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
for (i = 0; i < currentMenu->numitems; ++i)
|
for (i = 0; i < currentMenu->numitems; ++i)
|
||||||
|
|||||||
+18
-15
@@ -1070,26 +1070,29 @@ enum
|
|||||||
static menuitem_t OP_SoundOptionsMenu[] =
|
static menuitem_t OP_SoundOptionsMenu[] =
|
||||||
{
|
{
|
||||||
{IT_STRING|IT_CVAR|IT_CV_NOPRINT, NULL, "SFX", &cv_gamesounds, 10},
|
{IT_STRING|IT_CVAR|IT_CV_NOPRINT, NULL, "SFX", &cv_gamesounds, 10},
|
||||||
{IT_STRING|IT_CVAR|IT_CV_SLIDER, NULL, "SFX Volume", &cv_soundvolume, 18},
|
{IT_STRING|IT_CVAR|IT_CV_SLIDER,
|
||||||
|
NULL, "SFX Volume", &cv_soundvolume, 18},
|
||||||
|
|
||||||
{IT_STRING|IT_CVAR|IT_CV_NOPRINT, NULL, "Music", &cv_gamedigimusic, 30},
|
{IT_STRING|IT_CVAR|IT_CV_NOPRINT, NULL, "Music", &cv_gamedigimusic, 30},
|
||||||
{IT_STRING|IT_CVAR|IT_CV_SLIDER, NULL, "Music Volume", &cv_digmusicvolume, 38},
|
{IT_STRING|IT_CVAR|IT_CV_SLIDER,
|
||||||
|
NULL, "Music Volume", &cv_digmusicvolume, 38},
|
||||||
|
|
||||||
//#ifndef NO_MIDI
|
#ifndef NO_MIDI
|
||||||
#if 0
|
{IT_STRING|IT_CVAR, NULL, "MIDI", &cv_gamemidimusic, 50},
|
||||||
{IT_STRING|IT_CVAR|IT_CV_SLIDER, NULL, "MIDI Volume", &cv_midimusicvolume, 46},
|
{IT_STRING|IT_CVAR|IT_CV_SLIDER,
|
||||||
|
NULL, "MIDI Volume", &cv_midimusicvolume, 58},
|
||||||
|
|
||||||
{IT_STRING|IT_CVAR, NULL, "Reverse L/R Channels", &stereoreverse, 60},
|
{IT_STRING|IT_CVAR, NULL, "Reverse L/R Channels", &stereoreverse, 50},
|
||||||
|
|
||||||
{IT_STRING|IT_CVAR, NULL, "Chat Notifications", &cv_chatnotifications, 75},
|
{IT_STRING|IT_CVAR, NULL, "Chat Notifications", &cv_chatnotifications, 65},
|
||||||
{IT_STRING|IT_CVAR, NULL, "Character voices", &cv_kartvoices, 85},
|
{IT_STRING|IT_CVAR, NULL, "Character voices", &cv_kartvoices, 75},
|
||||||
{IT_STRING|IT_CVAR, NULL, "Hit Em Delay", &cv_karthitemdialog, 95},
|
{IT_STRING|IT_CVAR, NULL, "Hit Em Delay", &cv_karthitemdialog, 85},
|
||||||
{IT_STRING|IT_CVAR, NULL, "Powerup Warning", &cv_kartinvinsfx, 105},
|
{IT_STRING|IT_CVAR, NULL, "Powerup Warning", &cv_kartinvinsfx, 95},
|
||||||
|
|
||||||
{IT_KEYHANDLER|IT_STRING, NULL, "Sound Test", M_HandleSoundTest, 115},
|
{IT_KEYHANDLER|IT_STRING, NULL, "Sound Test", M_HandleSoundTest, 105},
|
||||||
{IT_STRING|IT_CALL, NULL, "Music Test", M_MusicTest, 125},
|
{IT_STRING|IT_CALL, NULL, "Music Test", M_MusicTest, 115},
|
||||||
|
|
||||||
{IT_STRING|IT_SUBMENU, NULL, "Advanced Settings...", &OP_SoundAdvancedDef, 135}
|
{IT_STRING|IT_SUBMENU, NULL, "Advanced Settings...", &OP_SoundAdvancedDef, 125}
|
||||||
#else
|
#else
|
||||||
{IT_STRING|IT_CVAR, NULL, "Reverse L/R Channels", &stereoreverse, 60},
|
{IT_STRING|IT_CVAR, NULL, "Reverse L/R Channels", &stereoreverse, 60},
|
||||||
|
|
||||||
@@ -1111,8 +1114,8 @@ static const char* OP_SoundTooltips[] =
|
|||||||
"Volume of Sound effects.",
|
"Volume of Sound effects.",
|
||||||
"Turn Music on or off.",
|
"Turn Music on or off.",
|
||||||
"Volume of Music.",
|
"Volume of Music.",
|
||||||
//#ifndef NO_MIDI
|
#ifndef NO_MIDI
|
||||||
#if 0
|
"Turn Midi Music on or off.",
|
||||||
"Volume of Midi Music.",
|
"Volume of Midi Music.",
|
||||||
#endif
|
#endif
|
||||||
"Reverse left and right channels of audio.",
|
"Reverse left and right channels of audio.",
|
||||||
|
|||||||
@@ -180,7 +180,6 @@ void P_CalcChasePostImg(player_t *player, camera_t *thiscam);
|
|||||||
boolean P_PlayerInPain(player_t *player);
|
boolean P_PlayerInPain(player_t *player);
|
||||||
void P_DoPlayerPain(player_t *player, mobj_t *source, mobj_t *inflictor);
|
void P_DoPlayerPain(player_t *player, mobj_t *source, mobj_t *inflictor);
|
||||||
void P_ResetPlayer(player_t *player);
|
void P_ResetPlayer(player_t *player);
|
||||||
player_t *P_GetLocalPlayerForNum(UINT8 pnum);
|
|
||||||
boolean P_IsLocalPlayer(const player_t *player);
|
boolean P_IsLocalPlayer(const player_t *player);
|
||||||
boolean P_IsDisplayPlayer(const player_t *player);
|
boolean P_IsDisplayPlayer(const player_t *player);
|
||||||
|
|
||||||
|
|||||||
+3
-3
@@ -6964,7 +6964,7 @@ static boolean P_MobjDeadThink(mobj_t *mobj)
|
|||||||
if (mobj->flags2 & MF2_AMBUSH)
|
if (mobj->flags2 & MF2_AMBUSH)
|
||||||
{
|
{
|
||||||
mobj->colorized = true;
|
mobj->colorized = true;
|
||||||
mobj->color = K_RainbowColor();
|
mobj->color = (1 + (leveltime % (MAXSKINCOLORS-1)));
|
||||||
mobj->frame |= FF_FULLBRIGHT;
|
mobj->frame |= FF_FULLBRIGHT;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
@@ -7806,7 +7806,7 @@ static boolean P_MobjRegularThink(mobj_t *mobj)
|
|||||||
P_SetScale(mobj, (mobj->destscale = mobj->target->scale));
|
P_SetScale(mobj, (mobj->destscale = mobj->target->scale));
|
||||||
|
|
||||||
if (mobj->target->player->kartstuff[k_driftcharge] >= K_GetKartDriftSparkValue(mobj->target->player)*4)
|
if (mobj->target->player->kartstuff[k_driftcharge] >= K_GetKartDriftSparkValue(mobj->target->player)*4)
|
||||||
mobj->color = K_RainbowColor();
|
mobj->color = (UINT8)(1 + (leveltime % (MAXSKINCOLORS-1)));
|
||||||
else if (mobj->target->player->kartstuff[k_driftcharge] >= K_GetKartDriftSparkValue(mobj->target->player)*2)
|
else if (mobj->target->player->kartstuff[k_driftcharge] >= K_GetKartDriftSparkValue(mobj->target->player)*2)
|
||||||
mobj->color = SKINCOLOR_KETCHUP;
|
mobj->color = SKINCOLOR_KETCHUP;
|
||||||
else if (mobj->target->player->kartstuff[k_driftcharge] >= K_GetKartDriftSparkValue(mobj->target->player))
|
else if (mobj->target->player->kartstuff[k_driftcharge] >= K_GetKartDriftSparkValue(mobj->target->player))
|
||||||
@@ -8505,7 +8505,7 @@ static boolean P_MobjRegularThink(mobj_t *mobj)
|
|||||||
if (mobj->flags2 & MF2_AMBUSH)
|
if (mobj->flags2 & MF2_AMBUSH)
|
||||||
{
|
{
|
||||||
mobj->colorized = true;
|
mobj->colorized = true;
|
||||||
mobj->color = K_RainbowColor();
|
mobj->color = (1 + (leveltime % (MAXSKINCOLORS-1)));
|
||||||
mobj->frame |= FF_FULLBRIGHT;
|
mobj->frame |= FF_FULLBRIGHT;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
|||||||
+1
-1
@@ -1511,7 +1511,7 @@ static polyobj_t *Polyobj_GetParent(polyobj_t *po)
|
|||||||
// Iteratively retrieves the children POs of a parent,
|
// Iteratively retrieves the children POs of a parent,
|
||||||
// sorta like P_FindSectorSpecialFromTag.
|
// sorta like P_FindSectorSpecialFromTag.
|
||||||
//
|
//
|
||||||
polyobj_t *Polyobj_GetChild(polyobj_t *po, INT32 *start)
|
static polyobj_t *Polyobj_GetChild(polyobj_t *po, INT32 *start)
|
||||||
{
|
{
|
||||||
for (; *start < numPolyObjects; (*start)++)
|
for (; *start < numPolyObjects; (*start)++)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -269,7 +269,6 @@ typedef struct polydisplacedata_s
|
|||||||
//
|
//
|
||||||
|
|
||||||
polyobj_t *Polyobj_GetForNum(INT32 id);
|
polyobj_t *Polyobj_GetForNum(INT32 id);
|
||||||
polyobj_t *Polyobj_GetChild(polyobj_t *po, INT32 *start);
|
|
||||||
void Polyobj_InitLevel(void);
|
void Polyobj_InitLevel(void);
|
||||||
void Polyobj_MoveOnLoad(polyobj_t *po, angle_t angle, fixed_t x, fixed_t y);
|
void Polyobj_MoveOnLoad(polyobj_t *po, angle_t angle, fixed_t x, fixed_t y);
|
||||||
boolean P_PointInsidePolyobj(polyobj_t *po, fixed_t x, fixed_t y);
|
boolean P_PointInsidePolyobj(polyobj_t *po, fixed_t x, fixed_t y);
|
||||||
|
|||||||
-119
@@ -2234,12 +2234,6 @@ static void LoadSpecialLevelThinker(savebuffer_t *save, actionf_p1 thinker, UINT
|
|||||||
}
|
}
|
||||||
|
|
||||||
P_AddThinker(&ht->thinker);
|
P_AddThinker(&ht->thinker);
|
||||||
|
|
||||||
// interpolation
|
|
||||||
if (floorOrCeiling & 2)
|
|
||||||
R_CreateInterpolator_SectorPlane(&ht->thinker, ht->sector, true);
|
|
||||||
if (floorOrCeiling & 1)
|
|
||||||
R_CreateInterpolator_SectorPlane(&ht->thinker, ht->sector, false);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
@@ -2269,9 +2263,6 @@ static void LoadCeilingThinker(savebuffer_t *save, actionf_p1 thinker)
|
|||||||
if (ht->sector)
|
if (ht->sector)
|
||||||
ht->sector->ceilingdata = ht;
|
ht->sector->ceilingdata = ht;
|
||||||
P_AddThinker(&ht->thinker);
|
P_AddThinker(&ht->thinker);
|
||||||
|
|
||||||
// interpolation
|
|
||||||
R_CreateInterpolator_SectorPlane(&ht->thinker, ht->sector, true);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
@@ -2296,9 +2287,6 @@ static void LoadFloormoveThinker(savebuffer_t *save, actionf_p1 thinker)
|
|||||||
if (ht->sector)
|
if (ht->sector)
|
||||||
ht->sector->floordata = ht;
|
ht->sector->floordata = ht;
|
||||||
P_AddThinker(&ht->thinker);
|
P_AddThinker(&ht->thinker);
|
||||||
|
|
||||||
// interpolation
|
|
||||||
R_CreateInterpolator_SectorPlane(&ht->thinker, ht->sector, false);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
@@ -2412,12 +2400,6 @@ static void LoadElevatorThinker(savebuffer_t *save, actionf_p1 thinker, UINT8 fl
|
|||||||
}
|
}
|
||||||
|
|
||||||
P_AddThinker(&ht->thinker);
|
P_AddThinker(&ht->thinker);
|
||||||
|
|
||||||
// interpolation
|
|
||||||
if (floorOrCeiling & 2)
|
|
||||||
R_CreateInterpolator_SectorPlane(&ht->thinker, ht->sector, true);
|
|
||||||
if (floorOrCeiling & 1)
|
|
||||||
R_CreateInterpolator_SectorPlane(&ht->thinker, ht->sector, false);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
@@ -2440,22 +2422,6 @@ static void LoadScrollThinker(savebuffer_t *save, actionf_p1 thinker)
|
|||||||
ht->exclusive = READINT32(save->p);
|
ht->exclusive = READINT32(save->p);
|
||||||
ht->type = READUINT8(save->p);
|
ht->type = READUINT8(save->p);
|
||||||
P_AddThinker(&ht->thinker);
|
P_AddThinker(&ht->thinker);
|
||||||
|
|
||||||
// interpolation
|
|
||||||
switch (ht->type)
|
|
||||||
{
|
|
||||||
case sc_side:
|
|
||||||
R_CreateInterpolator_SideScroll(&ht->thinker, &sides[ht->affectee]);
|
|
||||||
break;
|
|
||||||
case sc_floor:
|
|
||||||
R_CreateInterpolator_SectorScroll(&ht->thinker, §ors[ht->affectee], false);
|
|
||||||
break;
|
|
||||||
case sc_ceiling:
|
|
||||||
R_CreateInterpolator_SectorScroll(&ht->thinker, §ors[ht->affectee], true);
|
|
||||||
break;
|
|
||||||
default:
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
@@ -2587,17 +2553,6 @@ static inline void LoadPolyrotatetThinker(savebuffer_t *save, actionf_p1 thinker
|
|||||||
ht->distance = READINT32(save->p);
|
ht->distance = READINT32(save->p);
|
||||||
ht->turnobjs = READUINT8(save->p);
|
ht->turnobjs = READUINT8(save->p);
|
||||||
P_AddThinker(&ht->thinker);
|
P_AddThinker(&ht->thinker);
|
||||||
|
|
||||||
// interpolation
|
|
||||||
polyobj_t *po;
|
|
||||||
|
|
||||||
if (!(po = Polyobj_GetForNum(ht->polyObjNum)))
|
|
||||||
{
|
|
||||||
CONS_Debug(DBG_POLYOBJ, "EV_DoPolyObjRotate: bad polyobj %d\n", ht->polyObjNum);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
R_CreateInterpolator_Polyobj(&ht->thinker, po);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
@@ -2616,17 +2571,6 @@ static void LoadPolymoveThinker(savebuffer_t *save, actionf_p1 thinker)
|
|||||||
ht->distance = READINT32(save->p);
|
ht->distance = READINT32(save->p);
|
||||||
ht->angle = READANGLE(save->p);
|
ht->angle = READANGLE(save->p);
|
||||||
P_AddThinker(&ht->thinker);
|
P_AddThinker(&ht->thinker);
|
||||||
|
|
||||||
// interpolation
|
|
||||||
polyobj_t *po;
|
|
||||||
|
|
||||||
if (!(po = Polyobj_GetForNum(ht->polyObjNum)))
|
|
||||||
{
|
|
||||||
CONS_Debug(DBG_POLYOBJ, "EV_DoPolyObjRotate: bad polyobj %d\n", ht->polyObjNum);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
R_CreateInterpolator_Polyobj(&ht->thinker, po);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
@@ -2651,36 +2595,6 @@ static inline void LoadPolywaypointThinker(savebuffer_t *save, actionf_p1 thinke
|
|||||||
ht->diffy = READFIXED(save->p);
|
ht->diffy = READFIXED(save->p);
|
||||||
ht->diffz = READFIXED(save->p);
|
ht->diffz = READFIXED(save->p);
|
||||||
P_AddThinker(&ht->thinker);
|
P_AddThinker(&ht->thinker);
|
||||||
|
|
||||||
// interpolation
|
|
||||||
polyobj_t *po;
|
|
||||||
polyobj_t *oldpo;
|
|
||||||
INT32 start;
|
|
||||||
|
|
||||||
if (!(po = Polyobj_GetForNum(ht->polyObjNum)))
|
|
||||||
{
|
|
||||||
CONS_Debug(DBG_POLYOBJ, "EV_DoPolyObjRotate: bad polyobj %d\n", ht->polyObjNum);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
R_CreateInterpolator_Polyobj(&ht->thinker, po);
|
|
||||||
// T_PolyObjWaypoint is the only polyobject movement
|
|
||||||
// that can adjust z, so we add these ones too.
|
|
||||||
R_CreateInterpolator_SectorPlane(&ht->thinker, po->lines[0]->backsector, false);
|
|
||||||
R_CreateInterpolator_SectorPlane(&ht->thinker, po->lines[0]->backsector, true);
|
|
||||||
|
|
||||||
// Most other polyobject functions handle children by recursively
|
|
||||||
// giving each child another thinker. T_PolyObjWaypoint handles
|
|
||||||
// it manually though, which means we need to manually give them
|
|
||||||
// interpolation here instead.
|
|
||||||
start = 0;
|
|
||||||
oldpo = po;
|
|
||||||
while ((po = Polyobj_GetChild(oldpo, &start)))
|
|
||||||
{
|
|
||||||
R_CreateInterpolator_Polyobj(&ht->thinker, po);
|
|
||||||
R_CreateInterpolator_SectorPlane(&ht->thinker, po->lines[0]->backsector, false);
|
|
||||||
R_CreateInterpolator_SectorPlane(&ht->thinker, po->lines[0]->backsector, true);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
@@ -2706,17 +2620,6 @@ static inline void LoadPolyslidedoorThinker(savebuffer_t *save, actionf_p1 think
|
|||||||
ht->momy = READFIXED(save->p);
|
ht->momy = READFIXED(save->p);
|
||||||
ht->closing = READUINT8(save->p);
|
ht->closing = READUINT8(save->p);
|
||||||
P_AddThinker(&ht->thinker);
|
P_AddThinker(&ht->thinker);
|
||||||
|
|
||||||
// interpolation
|
|
||||||
polyobj_t *po;
|
|
||||||
|
|
||||||
if (!(po = Polyobj_GetForNum(ht->polyObjNum)))
|
|
||||||
{
|
|
||||||
CONS_Debug(DBG_POLYOBJ, "EV_DoPolyObjRotate: bad polyobj %d\n", ht->polyObjNum);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
R_CreateInterpolator_Polyobj(&ht->thinker, po);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
@@ -2737,17 +2640,6 @@ static inline void LoadPolyswingdoorThinker(savebuffer_t *save, actionf_p1 think
|
|||||||
ht->distance = READINT32(save->p);
|
ht->distance = READINT32(save->p);
|
||||||
ht->closing = READUINT8(save->p);
|
ht->closing = READUINT8(save->p);
|
||||||
P_AddThinker(&ht->thinker);
|
P_AddThinker(&ht->thinker);
|
||||||
|
|
||||||
// interpolation
|
|
||||||
polyobj_t *po;
|
|
||||||
|
|
||||||
if (!(po = Polyobj_GetForNum(ht->polyObjNum)))
|
|
||||||
{
|
|
||||||
CONS_Debug(DBG_POLYOBJ, "EV_DoPolyObjRotate: bad polyobj %d\n", ht->polyObjNum);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
R_CreateInterpolator_Polyobj(&ht->thinker, po);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
@@ -2765,17 +2657,6 @@ static inline void LoadPolydisplaceThinker(savebuffer_t *save, actionf_p1 thinke
|
|||||||
ht->dy = READFIXED(save->p);
|
ht->dy = READFIXED(save->p);
|
||||||
ht->oldHeights = READFIXED(save->p);
|
ht->oldHeights = READFIXED(save->p);
|
||||||
P_AddThinker(&ht->thinker);
|
P_AddThinker(&ht->thinker);
|
||||||
|
|
||||||
// interpolation
|
|
||||||
polyobj_t *po;
|
|
||||||
|
|
||||||
if (!(po = Polyobj_GetForNum(ht->polyObjNum)))
|
|
||||||
{
|
|
||||||
CONS_Debug(DBG_POLYOBJ, "EV_DoPolyObjRotate: bad polyobj %d\n", ht->polyObjNum);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
R_CreateInterpolator_Polyobj(&ht->thinker, po);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
|
|||||||
+38
-34
@@ -650,27 +650,6 @@ size_t P_PrecacheLevelFlats(void)
|
|||||||
return flatmem;
|
return flatmem;
|
||||||
}
|
}
|
||||||
|
|
||||||
// check if our flat contains cyan pixels
|
|
||||||
// not sure if this is the best way to do it but it works
|
|
||||||
static void P_CheckCyanFlat(levelflat_t *levelflat)
|
|
||||||
{
|
|
||||||
// only need this for software
|
|
||||||
if (rendermode != render_soft)
|
|
||||||
return;
|
|
||||||
|
|
||||||
const UINT8 *flat = R_GetFlat(levelflat->lumpnum);
|
|
||||||
const size_t size = W_LumpLength(levelflat->lumpnum);
|
|
||||||
|
|
||||||
for (size_t steppy = 0; steppy < size; steppy++)
|
|
||||||
{
|
|
||||||
if (flat[steppy] == TRANSPARENTPIXEL)
|
|
||||||
{
|
|
||||||
levelflat->cyan = true;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// help function for P_LoadSectors, find a flat in the active wad files,
|
// help function for P_LoadSectors, find a flat in the active wad files,
|
||||||
// allocate an id for it, and set the levelflat (to speedup search)
|
// allocate an id for it, and set the levelflat (to speedup search)
|
||||||
//
|
//
|
||||||
@@ -682,7 +661,7 @@ INT32 P_AddLevelFlat(const char *flatname, levelflat_t *levelflat)
|
|||||||
// first scan through the already found flats
|
// first scan through the already found flats
|
||||||
//
|
//
|
||||||
for (i = 0; i < numlevelflats; i++, levelflat++)
|
for (i = 0; i < numlevelflats; i++, levelflat++)
|
||||||
if (strnicmp(levelflat->name, flatname, 8) == 0)
|
if (strnicmp(levelflat->name,flatname,8) == 0)
|
||||||
break;
|
break;
|
||||||
|
|
||||||
// that flat was already found in the level, return the id
|
// that flat was already found in the level, return the id
|
||||||
@@ -696,7 +675,20 @@ INT32 P_AddLevelFlat(const char *flatname, levelflat_t *levelflat)
|
|||||||
levelflat->lumpnum = R_GetFlatNumForName(flatname);
|
levelflat->lumpnum = R_GetFlatNumForName(flatname);
|
||||||
levelflat->baselumpnum = LUMPERROR;
|
levelflat->baselumpnum = LUMPERROR;
|
||||||
|
|
||||||
P_CheckCyanFlat(levelflat);
|
// check if our flat contains cyan pixels
|
||||||
|
// not sure if this is the best way to do it but it works
|
||||||
|
{
|
||||||
|
const UINT8 *flat = (UINT8 *)W_CacheLumpNum(levelflat->lumpnum, PU_LEVEL);
|
||||||
|
size_t size = W_LumpLength(levelflat->lumpnum);
|
||||||
|
for (size_t steppy = 0; steppy < size; steppy++)
|
||||||
|
{
|
||||||
|
if (flat[steppy] == TRANSPARENTPIXEL)
|
||||||
|
{
|
||||||
|
levelflat->cyan = true;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
#ifndef ZDEBUG
|
#ifndef ZDEBUG
|
||||||
CONS_Debug(DBG_SETUP, "flat #%03d: %s\n", atoi(sizeu1(numlevelflats)), levelflat->name);
|
CONS_Debug(DBG_SETUP, "flat #%03d: %s\n", atoi(sizeu1(numlevelflats)), levelflat->name);
|
||||||
@@ -743,7 +735,20 @@ INT32 P_AddLevelFlatRuntime(const char *flatname)
|
|||||||
levelflat->lumpnum = R_GetFlatNumForName(flatname);
|
levelflat->lumpnum = R_GetFlatNumForName(flatname);
|
||||||
levelflat->baselumpnum = LUMPERROR;
|
levelflat->baselumpnum = LUMPERROR;
|
||||||
|
|
||||||
P_CheckCyanFlat(levelflat);
|
// check if our flat contains cyan pixels
|
||||||
|
// not sure if this is the best way to do it but it works
|
||||||
|
{
|
||||||
|
const UINT8 *flat = (UINT8 *)W_CacheLumpNum(levelflat->lumpnum, PU_LEVEL);
|
||||||
|
size_t size = W_LumpLength(levelflat->lumpnum);
|
||||||
|
for (size_t steppy = 0; steppy < size; steppy++)
|
||||||
|
{
|
||||||
|
if (flat[steppy] == TRANSPARENTPIXEL)
|
||||||
|
{
|
||||||
|
levelflat->cyan = true;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
#ifndef ZDEBUG
|
#ifndef ZDEBUG
|
||||||
CONS_Debug(DBG_SETUP, "flat #%03d: %s\n", atoi(sizeu1(numlevelflats)), levelflat->name);
|
CONS_Debug(DBG_SETUP, "flat #%03d: %s\n", atoi(sizeu1(numlevelflats)), levelflat->name);
|
||||||
@@ -2340,9 +2345,7 @@ static void P_RunLevelScript(const char *scriptname)
|
|||||||
lumpnum_t lumpnum;
|
lumpnum_t lumpnum;
|
||||||
char newname[9];
|
char newname[9];
|
||||||
|
|
||||||
strncpy(newname, scriptname, 8);
|
strlcpy(newname, scriptname, sizeof(newname));
|
||||||
|
|
||||||
newname[8] = '\0';
|
|
||||||
|
|
||||||
lumpnum = W_CheckNumForName(newname);
|
lumpnum = W_CheckNumForName(newname);
|
||||||
|
|
||||||
@@ -3309,6 +3312,12 @@ UINT16 P_PartialAddWadFile(const char *wadfilename, boolean local)
|
|||||||
if (!mapsadded)
|
if (!mapsadded)
|
||||||
CONS_Printf(M_GetText("No maps added\n"));
|
CONS_Printf(M_GetText("No maps added\n"));
|
||||||
|
|
||||||
|
#ifdef HWRENDER
|
||||||
|
// Free GPU textures before freeing patches.
|
||||||
|
if (rendermode == render_opengl && (vid.glstate == VID_GL_LIBRARY_LOADED))
|
||||||
|
HWR_ClearAllTextures();
|
||||||
|
#endif
|
||||||
|
|
||||||
//
|
//
|
||||||
// search for sprite replacements
|
// search for sprite replacements
|
||||||
//
|
//
|
||||||
@@ -3319,7 +3328,7 @@ UINT16 P_PartialAddWadFile(const char *wadfilename, boolean local)
|
|||||||
// Reload it all anyway, just in case they
|
// Reload it all anyway, just in case they
|
||||||
// added some textures but didn't insert a
|
// added some textures but didn't insert a
|
||||||
// TEXTURES/etc. list.
|
// TEXTURES/etc. list.
|
||||||
//R_LoadTexturesPwad(wadnum);
|
R_LoadTexturesPwad(wadnum);
|
||||||
|
|
||||||
// everything from MultiSetupWadFile until ST_Start was here originally
|
// everything from MultiSetupWadFile until ST_Start was here originally
|
||||||
|
|
||||||
@@ -3383,13 +3392,8 @@ boolean P_MultiSetupWadFiles(boolean fullsetup)
|
|||||||
|
|
||||||
if (partadd_stage == 1)
|
if (partadd_stage == 1)
|
||||||
{
|
{
|
||||||
#ifdef HWRENDER
|
|
||||||
// Free GPU textures before freeing patches.
|
|
||||||
if (rendermode == render_opengl && (vid.glstate == VID_GL_LIBRARY_LOADED))
|
|
||||||
HWR_ClearAllTextures();
|
|
||||||
#endif
|
|
||||||
// Reload all textures, unconditionally for better or worse.
|
// Reload all textures, unconditionally for better or worse.
|
||||||
R_LoadTextures();
|
//R_LoadTextures();
|
||||||
|
|
||||||
if (fullsetup)
|
if (fullsetup)
|
||||||
++partadd_stage;
|
++partadd_stage;
|
||||||
|
|||||||
+1
-1
@@ -488,7 +488,7 @@ static void P_DeviceRumbleTick(void)
|
|||||||
UINT16 low = 0, high = 0;
|
UINT16 low = 0, high = 0;
|
||||||
UINT16 lenght = 57; // in ms
|
UINT16 lenght = 57; // in ms
|
||||||
|
|
||||||
const player_t *player = P_GetLocalPlayerForNum(i);
|
const player_t *player = ((i == 0) ? &players[consoleplayer] : &players[displayplayers[i]]);
|
||||||
|
|
||||||
// allow lua to do some crap for spectators
|
// allow lua to do some crap for spectators
|
||||||
if (player->spectator || !player->mo)
|
if (player->spectator || !player->mo)
|
||||||
|
|||||||
+2
-13
@@ -972,17 +972,6 @@ fixed_t P_GetPlayerSpinHeight(player_t *player)
|
|||||||
return FixedMul(FixedMul(player->mo->info->height, player->mo->scale),2*FRACUNIT/3);
|
return FixedMul(FixedMul(player->mo->info->height, player->mo->scale),2*FRACUNIT/3);
|
||||||
}
|
}
|
||||||
|
|
||||||
//
|
|
||||||
// P_GetLocalPlayerForNum
|
|
||||||
//
|
|
||||||
// Returns the player
|
|
||||||
// on the local machine for given number.
|
|
||||||
//
|
|
||||||
player_t *P_GetLocalPlayerForNum(UINT8 pnum)
|
|
||||||
{
|
|
||||||
return (pnum == 0 ? &players[consoleplayer] : &players[displayplayers[pnum]]);
|
|
||||||
}
|
|
||||||
|
|
||||||
//
|
//
|
||||||
// P_IsLocalPlayer
|
// P_IsLocalPlayer
|
||||||
//
|
//
|
||||||
@@ -1652,7 +1641,7 @@ static void P_CheckInvincibilityTimer(player_t *player)
|
|||||||
if (!player->powers[pw_invulnerability] && !player->kartstuff[k_invincibilitytimer])
|
if (!player->powers[pw_invulnerability] && !player->kartstuff[k_invincibilitytimer])
|
||||||
return;
|
return;
|
||||||
|
|
||||||
player->mo->color = K_RainbowColor();
|
player->mo->color = (UINT8)(1 + (leveltime % (MAXSKINCOLORS-1)));
|
||||||
|
|
||||||
// Resume normal music stuff.
|
// Resume normal music stuff.
|
||||||
if (player->powers[pw_invulnerability] == 1 || player->kartstuff[k_invincibilitytimer] == 1)
|
if (player->powers[pw_invulnerability] == 1 || player->kartstuff[k_invincibilitytimer] == 1)
|
||||||
@@ -3684,7 +3673,7 @@ static boolean P_CheckNoclipCameraPosition(player_t *player, camera_t *thiscam,
|
|||||||
static void P_MoveCameraToSpawn(UINT8 playernum)
|
static void P_MoveCameraToSpawn(UINT8 playernum)
|
||||||
{
|
{
|
||||||
camera_t *thiscam = &camera[playernum];
|
camera_t *thiscam = &camera[playernum];
|
||||||
player_t *player = P_GetLocalPlayerForNum(playernum);
|
player_t *player = playernum == 0 ? &players[consoleplayer] : &players[displayplayers[playernum]];
|
||||||
|
|
||||||
if (!thiscam || !player->mo)
|
if (!thiscam || !player->mo)
|
||||||
return;
|
return;
|
||||||
|
|||||||
+242
-149
@@ -235,6 +235,7 @@ UINT32 ASTBlendTexturePixel(RGBA_t background, RGBA_t foreground, int style, UIN
|
|||||||
// Painfully simple texture id cacheing to make maps load faster. :3
|
// Painfully simple texture id cacheing to make maps load faster. :3
|
||||||
static struct {
|
static struct {
|
||||||
char name[9];
|
char name[9];
|
||||||
|
UINT32 hash;
|
||||||
INT32 id;
|
INT32 id;
|
||||||
} *tidcache = NULL;
|
} *tidcache = NULL;
|
||||||
static INT32 tidcachelen = 0;
|
static INT32 tidcachelen = 0;
|
||||||
@@ -520,32 +521,151 @@ void R_FlushTextureCache(void)
|
|||||||
int R_CountTexturesInTEXTURESLump(UINT16 wadNum, UINT16 lumpNum);
|
int R_CountTexturesInTEXTURESLump(UINT16 wadNum, UINT16 lumpNum);
|
||||||
void R_ParseTEXTURESLump(UINT16 wadNum, UINT16 lumpNum, INT32 *index);
|
void R_ParseTEXTURESLump(UINT16 wadNum, UINT16 lumpNum, INT32 *index);
|
||||||
|
|
||||||
//
|
|
||||||
// R_LoadTextures
|
|
||||||
// Initializes the texture list with the textures from the world map.
|
|
||||||
//
|
|
||||||
#define TX_START "TX_START"
|
#define TX_START "TX_START"
|
||||||
#define TX_END "TX_END"
|
#define TX_END "TX_END"
|
||||||
void R_LoadTextures(void)
|
|
||||||
|
static INT32
|
||||||
|
Rloadtextures (INT32 i, INT32 w)
|
||||||
{
|
{
|
||||||
INT32 i, k, w;
|
|
||||||
UINT16 j;
|
UINT16 j;
|
||||||
|
INT32 k;
|
||||||
UINT16 texstart, texend, texturesLumpPos;
|
UINT16 texstart, texend, texturesLumpPos;
|
||||||
softwarepatch_t *patchlump;
|
softwarepatch_t *patchlump;
|
||||||
texpatch_t *patch;
|
texpatch_t *patch;
|
||||||
texture_t *texture;
|
texture_t *texture;
|
||||||
|
|
||||||
// Free previous memory before numtextures change.
|
// Get the lump numbers for the markers in the WAD, if they exist.
|
||||||
if (numtextures)
|
if (W_FileHasFolders(wadfiles[w]))
|
||||||
{
|
{
|
||||||
for (i = 0; i < numtextures; i++)
|
texstart = W_CheckNumForFolderStartPK3("textures/", (UINT16)w, 0);
|
||||||
|
texend = W_CheckNumForFolderEndPK3("textures/", (UINT16)w, texstart);
|
||||||
|
texturesLumpPos = W_CheckNumForNamePwad("TEXTURES", (UINT16)w, 0);
|
||||||
|
while (texturesLumpPos != INT16_MAX)
|
||||||
{
|
{
|
||||||
Z_Free(textures[i]);
|
R_ParseTEXTURESLump(w, texturesLumpPos, &i);
|
||||||
Z_Free(texturecache[i]);
|
texturesLumpPos = W_CheckNumForNamePwad("TEXTURES", (UINT16)w, texturesLumpPos + 1);
|
||||||
}
|
}
|
||||||
Z_Free(texturetranslation);
|
|
||||||
Z_Free(textures);
|
|
||||||
}
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
texstart = W_CheckNumForMarkerStartPwad(TX_START, (UINT16)w, 0);
|
||||||
|
texend = W_CheckNumForNamePwad(TX_END, (UINT16)w, 0);
|
||||||
|
texturesLumpPos = W_CheckNumForNamePwad("TEXTURES", (UINT16)w, 0);
|
||||||
|
if (texturesLumpPos != INT16_MAX)
|
||||||
|
R_ParseTEXTURESLump(w, texturesLumpPos, &i);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (texstart == INT16_MAX || texend == INT16_MAX)
|
||||||
|
return i;
|
||||||
|
|
||||||
|
// Work through each lump between the markers in the WAD.
|
||||||
|
for (j = 0; j < (texend - texstart); j++)
|
||||||
|
{
|
||||||
|
UINT16 wadnum = (UINT16)w;
|
||||||
|
lumpnum_t lumpnum = texstart + j;
|
||||||
|
|
||||||
|
if (W_FileHasFolders(wadfiles[w]))
|
||||||
|
{
|
||||||
|
if (W_IsLumpFolder(wadnum, lumpnum)) // Check if lump is a folder
|
||||||
|
continue; // If it is then SKIP IT
|
||||||
|
}
|
||||||
|
|
||||||
|
patchlump = (softwarepatch_t *)W_CacheLumpNumPwad(wadnum, lumpnum, PU_STATIC);
|
||||||
|
|
||||||
|
//CONS_Printf("\n\"%s\" is a single patch, dimensions %d x %d",W_CheckNameForNumPwad((wadnum, lumpnum), patchlump->width, patchlump->height);
|
||||||
|
texture = textures[i] = Z_Calloc(sizeof(texture_t) + sizeof(texpatch_t), PU_STATIC, NULL);
|
||||||
|
|
||||||
|
// Set texture properties.
|
||||||
|
M_Memcpy(texture->name, W_CheckNameForNumPwad(wadnum, lumpnum), sizeof(texture->name));
|
||||||
|
texture->hash = quickncasehash(texture->name, 8);
|
||||||
|
texture->width = SHORT(patchlump->width);
|
||||||
|
texture->height = SHORT(patchlump->height);
|
||||||
|
texture->type = TEXTURETYPE_SINGLEPATCH;
|
||||||
|
texture->patchcount = 1;
|
||||||
|
texture->holes = false;
|
||||||
|
|
||||||
|
// Allocate information for the texture's patches.
|
||||||
|
patch = &texture->patches[0];
|
||||||
|
|
||||||
|
patch->originx = patch->originy = 0;
|
||||||
|
patch->wad = wadnum;
|
||||||
|
patch->lump = texstart + j;
|
||||||
|
|
||||||
|
Z_Free(patchlump);
|
||||||
|
|
||||||
|
// determine width power of 2
|
||||||
|
#if 1
|
||||||
|
// [WDJ] only need to determine if exact power of 2.
|
||||||
|
k = 1;
|
||||||
|
while (k < texture->width)
|
||||||
|
k<<=1;
|
||||||
|
#else
|
||||||
|
// Largest power of 2 that fits within width.
|
||||||
|
k = 1;
|
||||||
|
while (k << 1 <= texture->width)
|
||||||
|
k <<= 1;
|
||||||
|
#endif
|
||||||
|
if (k != texture->width)
|
||||||
|
{
|
||||||
|
// Odd width
|
||||||
|
k = 1; // make texturewidthmask = 0
|
||||||
|
}
|
||||||
|
|
||||||
|
texturewidthmask[i] = k - 1;
|
||||||
|
textureheight[i] = texture->height << FRACBITS;
|
||||||
|
i++;
|
||||||
|
}
|
||||||
|
|
||||||
|
return i;
|
||||||
|
}
|
||||||
|
|
||||||
|
static INT32
|
||||||
|
count_range
|
||||||
|
( const char * marker_start,
|
||||||
|
const char * marker_end,
|
||||||
|
const char * folder,
|
||||||
|
UINT16 wadnum)
|
||||||
|
{
|
||||||
|
UINT16 j;
|
||||||
|
UINT16 texstart, texend;
|
||||||
|
INT32 count = 0;
|
||||||
|
|
||||||
|
// Count flats
|
||||||
|
if (W_FileHasFolders(wadfiles[wadnum]))
|
||||||
|
{
|
||||||
|
texstart = W_CheckNumForFolderStartPK3(folder, wadnum, 0);
|
||||||
|
texend = W_CheckNumForFolderEndPK3(folder, wadnum, texstart);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
texstart = W_CheckNumForMarkerStartPwad(marker_start, wadnum, 0);
|
||||||
|
texend = W_CheckNumForNamePwad(marker_end, wadnum, texstart);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (texstart != INT16_MAX && texend != INT16_MAX)
|
||||||
|
{
|
||||||
|
// PK3s have subfolders, so we can't just make a simple sum
|
||||||
|
if (W_FileHasFolders(wadfiles[wadnum]))
|
||||||
|
{
|
||||||
|
for (j = texstart; j < texend; j++)
|
||||||
|
{
|
||||||
|
if (!W_IsLumpFolder(wadnum, j)) // Check if lump is a folder; if not, then count it
|
||||||
|
count++;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else // Add all the textures between markers
|
||||||
|
{
|
||||||
|
count += (texend - texstart);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return count;
|
||||||
|
}
|
||||||
|
|
||||||
|
static INT32 R_CountTextures(UINT16 wadnum)
|
||||||
|
{
|
||||||
|
UINT16 texturesLumpPos;
|
||||||
|
INT32 count = 0;
|
||||||
|
|
||||||
// Load patches and textures.
|
// Load patches and textures.
|
||||||
|
|
||||||
@@ -554,159 +674,127 @@ void R_LoadTextures(void)
|
|||||||
// the markers.
|
// the markers.
|
||||||
// This system will allocate memory for all duplicate/patched textures even if it never uses them,
|
// This system will allocate memory for all duplicate/patched textures even if it never uses them,
|
||||||
// but the alternative is to spend a ton of time checking and re-checking all previous entries just to skip any potentially patched textures.
|
// but the alternative is to spend a ton of time checking and re-checking all previous entries just to skip any potentially patched textures.
|
||||||
for (w = 0, numtextures = 0; w < numwadfiles; w++)
|
|
||||||
|
// Count the textures from TEXTURES lumps
|
||||||
|
texturesLumpPos = W_CheckNumForNamePwad("TEXTURES", wadnum, 0);
|
||||||
|
|
||||||
|
while (texturesLumpPos != INT16_MAX)
|
||||||
{
|
{
|
||||||
if (W_FileHasFolders(wadfiles[w]))
|
count += R_CountTexturesInTEXTURESLump(wadnum, texturesLumpPos);
|
||||||
{
|
texturesLumpPos = W_CheckNumForNamePwad("TEXTURES", wadnum, texturesLumpPos + 1);
|
||||||
texstart = W_CheckNumForFolderStartPK3("textures/", (UINT16)w, 0);
|
|
||||||
texend = W_CheckNumForFolderEndPK3("textures/", (UINT16)w, texstart);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
texstart = W_CheckNumForNamePwad(TX_START, (UINT16)w, 0) + 1;
|
|
||||||
texend = W_CheckNumForNamePwad(TX_END, (UINT16)w, 0);
|
|
||||||
}
|
|
||||||
|
|
||||||
texturesLumpPos = W_CheckNumForNamePwad("TEXTURES", (UINT16)w, 0);
|
|
||||||
while (texturesLumpPos != INT16_MAX)
|
|
||||||
{
|
|
||||||
numtextures += R_CountTexturesInTEXTURESLump((UINT16)w, (UINT16)texturesLumpPos);
|
|
||||||
texturesLumpPos = W_CheckNumForNamePwad("TEXTURES", (UINT16)w, texturesLumpPos + 1);
|
|
||||||
}
|
|
||||||
|
|
||||||
// Add all the textures between TX_START and TX_END
|
|
||||||
if (texstart == INT16_MAX || texend == INT16_MAX)
|
|
||||||
continue;
|
|
||||||
|
|
||||||
// PK3s have subfolders, so we can't just make a simple sum
|
|
||||||
if (W_FileHasFolders(wadfiles[w]))
|
|
||||||
{
|
|
||||||
for (j = texstart; j < texend; j++)
|
|
||||||
{
|
|
||||||
if (W_IsLumpFolder((UINT16)w, j)) // Check if lump is a folder; if not, then count it
|
|
||||||
continue;
|
|
||||||
|
|
||||||
numtextures++;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
numtextures += (UINT32)(texend - texstart);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// If no textures found by this point, bomb out
|
// Count single-patch textures
|
||||||
if (!numtextures)
|
count += count_range(TX_START, TX_END, "textures/", wadnum);
|
||||||
I_Error("No textures detected in any WADs!\n");
|
|
||||||
|
return count;
|
||||||
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
recallocuser
|
||||||
|
( void * user,
|
||||||
|
size_t old,
|
||||||
|
size_t new)
|
||||||
|
{
|
||||||
|
char *p = Z_Realloc(*(void**)user,
|
||||||
|
new, PU_STATIC, user);
|
||||||
|
|
||||||
|
if (new > old)
|
||||||
|
memset(&p[old], 0, (new - old));
|
||||||
|
}
|
||||||
|
|
||||||
|
static void R_AllocateTextures(INT32 add)
|
||||||
|
{
|
||||||
|
const INT32 newtextures = (numtextures + add);
|
||||||
|
const size_t newsize = newtextures * sizeof (void*);
|
||||||
|
const size_t oldsize = numtextures * sizeof (void*);
|
||||||
|
|
||||||
|
INT32 i;
|
||||||
|
|
||||||
// Allocate memory and initialize to 0 for all the textures we are initialising.
|
// Allocate memory and initialize to 0 for all the textures we are initialising.
|
||||||
// There are actually 5 buffers allocated in one for convenience.
|
recallocuser(&textures, oldsize, newsize);
|
||||||
textures = Z_Calloc((numtextures * sizeof(void *)) * 5, PU_STATIC, NULL);
|
|
||||||
|
|
||||||
// Allocate texture column offset table.
|
// Allocate texture column offset table.
|
||||||
texturecolumnofs = (void *)((UINT8 *)textures + (numtextures * sizeof(void *)));
|
recallocuser(&texturecolumnofs, oldsize, newsize);
|
||||||
// Allocate texture referencing cache.
|
// Allocate texture referencing cache.
|
||||||
texturecache = (void *)((UINT8 *)textures + ((numtextures * sizeof(void *)) * 2));
|
recallocuser(&texturecache, oldsize, newsize);
|
||||||
// Allocate texture width mask table.
|
// Allocate texture width table.
|
||||||
texturewidthmask = (void *)((UINT8 *)textures + ((numtextures * sizeof(void *)) * 3));
|
recallocuser(&texturewidthmask, oldsize, newsize);
|
||||||
// Allocate texture height mask table.
|
// Allocate texture height table.
|
||||||
textureheight = (void *)((UINT8 *)textures + ((numtextures * sizeof(void *)) * 4));
|
recallocuser(&textureheight, oldsize, newsize);
|
||||||
// Create translation table for global animation.
|
// Create translation table for global animation.
|
||||||
texturetranslation = Z_Malloc((numtextures + 1) * sizeof(*texturetranslation), PU_STATIC, NULL);
|
Z_Realloc(texturetranslation, (newtextures + 1) * sizeof(*texturetranslation), PU_STATIC, &texturetranslation);
|
||||||
|
|
||||||
for (i = 0; i < numtextures; i++)
|
for (i = 0; i < numtextures; ++i)
|
||||||
texturetranslation[i] = i;
|
|
||||||
|
|
||||||
for (i = 0, w = 0; w < numwadfiles; w++)
|
|
||||||
{
|
{
|
||||||
// Get the lump numbers for the markers in the WAD, if they exist.
|
// R_FlushTextureCache relies on the user for
|
||||||
if (W_FileHasFolders(wadfiles[w]))
|
// Z_Free, texturecache has been reallocated so the
|
||||||
{
|
// user is now garbage memory.
|
||||||
texstart = W_CheckNumForFolderStartPK3("textures/", (UINT16)w, 0);
|
Z_SetUser(texturecache[i], (void**)&texturecache[i]);
|
||||||
texend = W_CheckNumForFolderEndPK3("textures/", (UINT16)w, texstart);
|
|
||||||
texturesLumpPos = W_CheckNumForNamePwad("TEXTURES", (UINT16)w, 0);
|
|
||||||
while (texturesLumpPos != INT16_MAX)
|
|
||||||
{
|
|
||||||
R_ParseTEXTURESLump(w, texturesLumpPos, &i);
|
|
||||||
texturesLumpPos = W_CheckNumForNamePwad("TEXTURES", (UINT16)w, texturesLumpPos + 1);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
texstart = W_CheckNumForNamePwad(TX_START, (UINT16)w, 0) + 1;
|
|
||||||
texend = W_CheckNumForNamePwad(TX_END, (UINT16)w, 0);
|
|
||||||
texturesLumpPos = W_CheckNumForNamePwad("TEXTURES", (UINT16)w, 0);
|
|
||||||
if (texturesLumpPos != INT16_MAX)
|
|
||||||
R_ParseTEXTURESLump(w, texturesLumpPos, &i);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (texstart == INT16_MAX || texend == INT16_MAX)
|
|
||||||
continue;
|
|
||||||
|
|
||||||
// Work through each lump between the markers in the WAD.
|
|
||||||
for (j = 0; j < (texend - texstart); j++)
|
|
||||||
{
|
|
||||||
UINT16 wadnum = (UINT16)w;
|
|
||||||
lumpnum_t lumpnum = texstart + j;
|
|
||||||
|
|
||||||
if (W_FileHasFolders(wadfiles[w]))
|
|
||||||
{
|
|
||||||
if (W_IsLumpFolder(wadnum, lumpnum)) // Check if lump is a folder
|
|
||||||
continue; // If it is then SKIP IT
|
|
||||||
}
|
|
||||||
|
|
||||||
patchlump = (softwarepatch_t *)W_CacheLumpNumPwad(wadnum, lumpnum, PU_STATIC);
|
|
||||||
|
|
||||||
//CONS_Printf("\n\"%s\" is a single patch, dimensions %d x %d",W_CheckNameForNumPwad(wadnum, lumpnum), patchlump->width, patchlump->height);
|
|
||||||
texture = textures[i] = Z_Calloc(sizeof(texture_t) + sizeof(texpatch_t), PU_STATIC, NULL);
|
|
||||||
|
|
||||||
// Set texture properties.
|
|
||||||
M_Memcpy(texture->name, W_CheckNameForNumPwad(wadnum, lumpnum), sizeof(texture->name));
|
|
||||||
texture->width = SHORT(patchlump->width);
|
|
||||||
texture->height = SHORT(patchlump->height);
|
|
||||||
texture->type = TEXTURETYPE_SINGLEPATCH;
|
|
||||||
texture->patchcount = 1;
|
|
||||||
texture->holes = false;
|
|
||||||
|
|
||||||
// Allocate information for the texture's patches.
|
|
||||||
patch = &texture->patches[0];
|
|
||||||
|
|
||||||
patch->originx = patch->originy = 0;
|
|
||||||
patch->wad = wadnum;
|
|
||||||
patch->lump = texstart + j;
|
|
||||||
|
|
||||||
Z_Free(patchlump);
|
|
||||||
|
|
||||||
// determine width power of 2
|
|
||||||
#if 1
|
|
||||||
// [WDJ] only need to determine if exact power of 2.
|
|
||||||
k = 1;
|
|
||||||
while (k < texture->width)
|
|
||||||
k<<=1;
|
|
||||||
#else
|
|
||||||
// Largest power of 2 that fits within width.
|
|
||||||
k = 1;
|
|
||||||
while (k << 1 <= texture->width)
|
|
||||||
k <<= 1;
|
|
||||||
#endif
|
|
||||||
if (k != texture->width)
|
|
||||||
{
|
|
||||||
// Odd width
|
|
||||||
k = 1; // make texturewidthmask = 0
|
|
||||||
}
|
|
||||||
|
|
||||||
texturewidthmask[i] = k - 1;
|
|
||||||
textureheight[i] = texture->height << FRACBITS;
|
|
||||||
i++;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
while (i < newtextures)
|
||||||
|
{
|
||||||
|
texturetranslation[i] = i;
|
||||||
|
i++;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
static INT32 R_DefineTextures(INT32 i, UINT16 w)
|
||||||
|
{
|
||||||
|
return Rloadtextures(i, w);
|
||||||
|
}
|
||||||
|
|
||||||
|
static void R_FinishLoadingTextures(INT32 add)
|
||||||
|
{
|
||||||
|
numtextures += add;
|
||||||
|
|
||||||
#ifdef HWRENDER
|
#ifdef HWRENDER
|
||||||
if (rendermode == render_opengl)
|
if (rendermode == render_opengl)
|
||||||
HWR_LoadMapTextures(numtextures);
|
HWR_LoadMapTextures(numtextures);
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
// R_LoadTextures
|
||||||
|
// Initializes the texture list with the textures from the world map.
|
||||||
|
//
|
||||||
|
void R_LoadTextures(void)
|
||||||
|
{
|
||||||
|
INT32 i, w;
|
||||||
|
INT32 newtextures = 0;
|
||||||
|
|
||||||
|
for (w = 0; w < numwadfiles; w++)
|
||||||
|
{
|
||||||
|
newtextures += R_CountTextures((UINT16)w);
|
||||||
|
}
|
||||||
|
|
||||||
|
// If no textures found by this point, bomb out
|
||||||
|
if (!newtextures)
|
||||||
|
I_Error("No textures detected in any WADs!\n");
|
||||||
|
|
||||||
|
R_AllocateTextures(newtextures);
|
||||||
|
|
||||||
|
for (i = 0, w = 0; w < numwadfiles; w++)
|
||||||
|
{
|
||||||
|
i = R_DefineTextures(i, w);
|
||||||
|
}
|
||||||
|
|
||||||
|
R_FinishLoadingTextures(i);
|
||||||
|
}
|
||||||
|
|
||||||
|
void R_LoadTexturesPwad(UINT16 wadnum)
|
||||||
|
{
|
||||||
|
INT32 newtextures = R_CountTextures(wadnum);
|
||||||
|
|
||||||
|
if (!newtextures)
|
||||||
|
return;
|
||||||
|
|
||||||
|
R_AllocateTextures(newtextures);
|
||||||
|
newtextures = R_DefineTextures(numtextures, wadnum) - numtextures;
|
||||||
|
R_FinishLoadingTextures(newtextures);
|
||||||
|
}
|
||||||
|
|
||||||
static texpatch_t *R_ParsePatch(boolean actuallyLoadPatch)
|
static texpatch_t *R_ParsePatch(boolean actuallyLoadPatch)
|
||||||
{
|
{
|
||||||
char *texturesToken;
|
char *texturesToken;
|
||||||
@@ -958,6 +1046,7 @@ static texture_t *R_ParseTexture(boolean actuallyLoadTexture)
|
|||||||
// Allocate memory for a zero-patch texture. Obviously, we'll be adding patches momentarily.
|
// Allocate memory for a zero-patch texture. Obviously, we'll be adding patches momentarily.
|
||||||
resultTexture = (texture_t *)Z_Calloc(sizeof(texture_t), PU_STATIC, NULL);
|
resultTexture = (texture_t *)Z_Calloc(sizeof(texture_t), PU_STATIC, NULL);
|
||||||
M_Memcpy(resultTexture->name, newTextureName, 8);
|
M_Memcpy(resultTexture->name, newTextureName, 8);
|
||||||
|
resultTexture->hash = quickncasehash(newTextureName, 8);
|
||||||
resultTexture->width = newTextureWidth;
|
resultTexture->width = newTextureWidth;
|
||||||
resultTexture->height = newTextureHeight;
|
resultTexture->height = newTextureHeight;
|
||||||
resultTexture->type = TEXTURETYPE_COMPOSITE;
|
resultTexture->type = TEXTURETYPE_COMPOSITE;
|
||||||
@@ -1741,19 +1830,22 @@ void R_ClearTextureNumCache(boolean btell)
|
|||||||
INT32 R_CheckTextureNumForName(const char *name)
|
INT32 R_CheckTextureNumForName(const char *name)
|
||||||
{
|
{
|
||||||
INT32 i;
|
INT32 i;
|
||||||
|
UINT32 hash;
|
||||||
|
|
||||||
// "NoTexture" marker.
|
// "NoTexture" marker.
|
||||||
if (name[0] == '-')
|
if (name[0] == '-')
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
|
hash = quickncasehash(name, 8);
|
||||||
|
|
||||||
for (i = 0; i < tidcachelen; i++)
|
for (i = 0; i < tidcachelen; i++)
|
||||||
if (!strncasecmp(tidcache[i].name, name, 8))
|
if (tidcache[i].hash == hash && !strncasecmp(tidcache[i].name, name, 8))
|
||||||
return tidcache[i].id;
|
return tidcache[i].id;
|
||||||
|
|
||||||
// Need to parse the list backwards, so textures loaded more recently are used in lieu of ones loaded earlier
|
// Need to parse the list backwards, so textures loaded more recently are used in lieu of ones loaded earlier
|
||||||
//for (i = 0; i < numtextures; i++) <- old
|
//for (i = 0; i < numtextures; i++) <- old
|
||||||
for (i = (numtextures - 1); i >= 0; i--) // <- new
|
for (i = (numtextures - 1); i >= 0; i--) // <- new
|
||||||
if (!strncasecmp(textures[i]->name, name, 8))
|
if (textures[i]->hash == hash && !strncasecmp(textures[i]->name, name, 8))
|
||||||
{
|
{
|
||||||
tidcachelen++;
|
tidcachelen++;
|
||||||
Z_Realloc(tidcache, tidcachelen * sizeof(*tidcache), PU_STATIC, &tidcache);
|
Z_Realloc(tidcache, tidcachelen * sizeof(*tidcache), PU_STATIC, &tidcache);
|
||||||
@@ -1762,6 +1854,7 @@ INT32 R_CheckTextureNumForName(const char *name)
|
|||||||
#ifndef ZDEBUG
|
#ifndef ZDEBUG
|
||||||
CONS_Debug(DBG_SETUP, "texture #%s: %s\n", sizeu1(tidcachelen), tidcache[tidcachelen-1].name);
|
CONS_Debug(DBG_SETUP, "texture #%s: %s\n", sizeu1(tidcachelen), tidcache[tidcachelen-1].name);
|
||||||
#endif
|
#endif
|
||||||
|
tidcache[tidcachelen-1].hash = hash;
|
||||||
tidcache[tidcachelen-1].id = i;
|
tidcache[tidcachelen-1].id = i;
|
||||||
return i;
|
return i;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -53,6 +53,7 @@ typedef struct
|
|||||||
// Keep name for switch changing, etc.
|
// Keep name for switch changing, etc.
|
||||||
char name[8];
|
char name[8];
|
||||||
UINT8 type; // TEXTURETYPE_
|
UINT8 type; // TEXTURETYPE_
|
||||||
|
UINT32 hash;
|
||||||
INT16 width, height;
|
INT16 width, height;
|
||||||
boolean holes;
|
boolean holes;
|
||||||
// All the patches[patchcount] are drawn back to front into the cached texture.
|
// All the patches[patchcount] are drawn back to front into the cached texture.
|
||||||
@@ -76,6 +77,7 @@ extern CV_PossibleValue_t Color_cons_t[];
|
|||||||
|
|
||||||
// Load TEXTURE1/TEXTURE2/PNAMES definitions, create lookup tables
|
// Load TEXTURE1/TEXTURE2/PNAMES definitions, create lookup tables
|
||||||
void R_LoadTextures(void);
|
void R_LoadTextures(void);
|
||||||
|
void R_LoadTexturesPwad(UINT16 wadnum);
|
||||||
void R_FlushTextureCache(void);
|
void R_FlushTextureCache(void);
|
||||||
|
|
||||||
UINT8 *R_GenerateTexture(size_t texnum);
|
UINT8 *R_GenerateTexture(size_t texnum);
|
||||||
|
|||||||
+3
-1
@@ -1182,7 +1182,7 @@ void R_DrawSinglePlane(drawspandata_t* ds, visplane_t *pl, boolean allow_paralle
|
|||||||
levelflat = &levelflats[pl->picnum];
|
levelflat = &levelflats[pl->picnum];
|
||||||
|
|
||||||
// Get the texture
|
// Get the texture
|
||||||
ds->source = R_GetFlat(levelflat->lumpnum);
|
ds->source = (UINT8 *)W_CacheLumpNum(levelflat->lumpnum, PU_STATIC); // Stay here until Z_ChangeTag
|
||||||
|
|
||||||
if (ds->source == NULL)
|
if (ds->source == NULL)
|
||||||
return;
|
return;
|
||||||
@@ -1387,6 +1387,8 @@ using the palette colors.
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
Z_ChangeTag(ds->source, PU_CACHE);
|
||||||
}
|
}
|
||||||
|
|
||||||
void R_PlaneBounds(visplane_t *plane)
|
void R_PlaneBounds(visplane_t *plane)
|
||||||
|
|||||||
+173
-58
@@ -42,10 +42,12 @@ static void Command_RestartMusic_f(void); //mhhhm amiga type filters here i come
|
|||||||
static void Command_ShowMusicCredit_f(void);
|
static void Command_ShowMusicCredit_f(void);
|
||||||
|
|
||||||
// Sound system toggles
|
// Sound system toggles
|
||||||
|
#ifndef NO_MIDI
|
||||||
|
static void GameMIDIMusic_OnChange(void);
|
||||||
|
#endif
|
||||||
static void GameSounds_OnChange(void);
|
static void GameSounds_OnChange(void);
|
||||||
static void GameMusic_OnChange(void);
|
|
||||||
|
|
||||||
static void SoundPrecache_OnChange(void);
|
static void SoundPrecache_OnChange(void);
|
||||||
|
static void GameDigiMusic_OnChange(void);
|
||||||
static void BufferSize_OnChange(void);
|
static void BufferSize_OnChange(void);
|
||||||
|
|
||||||
#ifdef HAVE_OPENMPT
|
#ifdef HAVE_OPENMPT
|
||||||
@@ -88,8 +90,11 @@ consvar_t cv_samesoundlimit = {"samesoundlimit", "0", CV_SAVE, samesoundlimit_co
|
|||||||
//consvar_t cv_resetmusic = {"resetmusic", "No", CV_SAVE|CV_NOSHOWHELP, CV_YesNo, NULL, 0, NULL, NULL, 0, 0, NULL};
|
//consvar_t cv_resetmusic = {"resetmusic", "No", CV_SAVE|CV_NOSHOWHELP, CV_YesNo, NULL, 0, NULL, NULL, 0, 0, NULL};
|
||||||
|
|
||||||
// Sound system toggles, saved into the config
|
// Sound system toggles, saved into the config
|
||||||
consvar_t cv_gamedigimusic = {"digimusic", "On", CV_SAVE|CV_CALL|CV_NOINIT, CV_OnOff, GameMusic_OnChange, 0, NULL, NULL, 0, 0, NULL};
|
consvar_t cv_gamedigimusic = {"digimusic", "On", CV_SAVE|CV_CALL|CV_NOINIT, CV_OnOff, GameDigiMusic_OnChange, 0, NULL, NULL, 0, 0, NULL};
|
||||||
consvar_t cv_gamesounds = {"sounds", "On", CV_SAVE|CV_CALL|CV_NOINIT, CV_OnOff, GameSounds_OnChange, 0, NULL, NULL, 0, 0, NULL};
|
#ifndef NO_MIDI
|
||||||
|
consvar_t cv_gamemidimusic = {"midimusic", "On", CV_SAVE|CV_CALL|CV_NOINIT, CV_OnOff, GameMIDIMusic_OnChange, 0, NULL, NULL, 0, 0, NULL};
|
||||||
|
#endif
|
||||||
|
consvar_t cv_gamesounds = {"sounds", "On", CV_SAVE|CV_CALL|CV_NOINIT, CV_OnOff, GameSounds_OnChange, 0, NULL, NULL, 0, 0, NULL};
|
||||||
|
|
||||||
consvar_t cv_playmusicifunfocused = {"playmusicifunfocused", "No", CV_SAVE, CV_YesNo, NULL, 0, NULL, NULL, 0, 0, NULL};
|
consvar_t cv_playmusicifunfocused = {"playmusicifunfocused", "No", CV_SAVE, CV_YesNo, NULL, 0, NULL, NULL, 0, 0, NULL};
|
||||||
consvar_t cv_playsoundifunfocused = {"playsoundsifunfocused", "No", CV_SAVE, CV_YesNo, NULL, 0, NULL, NULL, 0, 0, NULL};
|
consvar_t cv_playsoundifunfocused = {"playsoundsifunfocused", "No", CV_SAVE, CV_YesNo, NULL, 0, NULL, NULL, 0, 0, NULL};
|
||||||
@@ -281,6 +286,9 @@ void S_RegisterSoundStuff(void)
|
|||||||
//CV_RegisterVar(&cv_resetmusic);
|
//CV_RegisterVar(&cv_resetmusic);
|
||||||
CV_RegisterVar(&cv_gamesounds);
|
CV_RegisterVar(&cv_gamesounds);
|
||||||
CV_RegisterVar(&cv_gamedigimusic);
|
CV_RegisterVar(&cv_gamedigimusic);
|
||||||
|
#ifndef NO_MIDI
|
||||||
|
CV_RegisterVar(&cv_gamemidimusic);
|
||||||
|
#endif
|
||||||
|
|
||||||
CV_RegisterVar(&cv_samesoundlimit);
|
CV_RegisterVar(&cv_samesoundlimit);
|
||||||
|
|
||||||
@@ -359,7 +367,10 @@ lumpnum_t S_GetSfxLumpNum(sfxinfo_t *sfx)
|
|||||||
|
|
||||||
boolean S_SoundDisabled(void)
|
boolean S_SoundDisabled(void)
|
||||||
{
|
{
|
||||||
return (sound_disabled || (window_notinfocus && !cv_playsoundifunfocused.value));
|
return (
|
||||||
|
sound_disabled ||
|
||||||
|
( window_notinfocus && ! cv_playsoundifunfocused.value )
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
boolean S_PrecacheSound(void)
|
boolean S_PrecacheSound(void)
|
||||||
@@ -678,7 +689,10 @@ void S_StopSound(void *origin)
|
|||||||
// Updates music & sounds
|
// Updates music & sounds
|
||||||
//
|
//
|
||||||
static INT32 actualsfxvolume; // check for change through console
|
static INT32 actualsfxvolume; // check for change through console
|
||||||
static INT32 actualmusicvolume;
|
static INT32 actualdigmusicvolume;
|
||||||
|
#ifndef NO_MIDI
|
||||||
|
static INT32 actualmidimusicvolume;
|
||||||
|
#endif
|
||||||
|
|
||||||
void S_UpdateSounds(void)
|
void S_UpdateSounds(void)
|
||||||
{
|
{
|
||||||
@@ -690,19 +704,15 @@ void S_UpdateSounds(void)
|
|||||||
listener_t listener[MAXSPLITSCREENPLAYERS];
|
listener_t listener[MAXSPLITSCREENPLAYERS];
|
||||||
mobj_t *listenmobj[MAXSPLITSCREENPLAYERS];
|
mobj_t *listenmobj[MAXSPLITSCREENPLAYERS];
|
||||||
|
|
||||||
#ifndef NO_MIDI
|
|
||||||
const boolean currentmidi = (I_SongType() == MU_MID);
|
|
||||||
#endif
|
|
||||||
|
|
||||||
// Update sound/music volumes, if changed manually at console
|
// Update sound/music volumes, if changed manually at console
|
||||||
if (actualsfxvolume != cv_soundvolume.value)
|
if (actualsfxvolume != cv_soundvolume.value)
|
||||||
S_SetSfxVolume(cv_soundvolume.value);
|
S_SetSfxVolume(cv_soundvolume.value);
|
||||||
|
if (actualdigmusicvolume != cv_digmusicvolume.value)
|
||||||
|
S_SetDigMusicVolume(cv_digmusicvolume.value);
|
||||||
#ifndef NO_MIDI
|
#ifndef NO_MIDI
|
||||||
if (actualmusicvolume != (currentmidi ? cv_midimusicvolume.value : cv_digmusicvolume.value))
|
if (actualmidimusicvolume != cv_midimusicvolume.value)
|
||||||
#else
|
S_SetMIDIMusicVolume(cv_midimusicvolume.value);
|
||||||
if (actualmusicvolume != cv_digmusicvolume.value)
|
|
||||||
#endif
|
#endif
|
||||||
S_SetMusicVolume(-1);
|
|
||||||
|
|
||||||
memset(listener, 0, sizeof(listener));
|
memset(listener, 0, sizeof(listener));
|
||||||
|
|
||||||
@@ -1502,8 +1512,7 @@ void S_ShowSpecifiedMusicCredit(const char *musname)
|
|||||||
{
|
{
|
||||||
musicdef_t *def;
|
musicdef_t *def;
|
||||||
|
|
||||||
if (music_disabled)
|
if (digital_disabled) return;
|
||||||
return;
|
|
||||||
|
|
||||||
if (!cv_songcredits.value || demo.rewinding)
|
if (!cv_songcredits.value || demo.rewinding)
|
||||||
return;
|
return;
|
||||||
@@ -1533,9 +1542,19 @@ void S_ShowMusicCredit(void)
|
|||||||
/// Music Status
|
/// Music Status
|
||||||
/// ------------------------
|
/// ------------------------
|
||||||
|
|
||||||
|
boolean S_DigMusicDisabled(void)
|
||||||
|
{
|
||||||
|
return digital_disabled;
|
||||||
|
}
|
||||||
|
|
||||||
|
boolean S_MIDIMusicDisabled(void)
|
||||||
|
{
|
||||||
|
return midi_disabled; // SRB2Kart: defined as "true" w/ NO_MIDI
|
||||||
|
}
|
||||||
|
|
||||||
boolean S_MusicDisabled(void)
|
boolean S_MusicDisabled(void)
|
||||||
{
|
{
|
||||||
return (music_disabled);
|
return (midi_disabled && digital_disabled);
|
||||||
}
|
}
|
||||||
|
|
||||||
boolean S_MusicPlaying(void)
|
boolean S_MusicPlaying(void)
|
||||||
@@ -1624,25 +1643,6 @@ UINT32 S_GetMusicPosition(void)
|
|||||||
/// Music Playback
|
/// Music Playback
|
||||||
/// ------------------------
|
/// ------------------------
|
||||||
|
|
||||||
static lumpnum_t S_GetMusicLumpNum(const char *mname)
|
|
||||||
{
|
|
||||||
if (S_MusicExists(mname, false, true)) // check non midis first
|
|
||||||
return W_GetNumForName(va("o_%s", mname));
|
|
||||||
else if (S_MusicExists(mname, true, false))
|
|
||||||
{
|
|
||||||
#ifdef NO_MIDI
|
|
||||||
CONS_Alert(CONS_ERROR, "A MIDI music lump %.6s was found,\nbut SRB2Kart does not support MIDI output.\nWe apologise for the inconvenience.\n", mname);
|
|
||||||
return LUMPERROR;
|
|
||||||
#else
|
|
||||||
return W_GetNumForName(va("d_%s", mname));
|
|
||||||
#endif
|
|
||||||
}
|
|
||||||
|
|
||||||
CONS_Alert(CONS_ERROR, "Music %.6s could not be loaded: lump not found!\n", mname);
|
|
||||||
|
|
||||||
return LUMPERROR;
|
|
||||||
}
|
|
||||||
|
|
||||||
static boolean S_LoadMusic(const char *mname)
|
static boolean S_LoadMusic(const char *mname)
|
||||||
{
|
{
|
||||||
lumpnum_t mlumpnum;
|
lumpnum_t mlumpnum;
|
||||||
@@ -1651,10 +1651,27 @@ static boolean S_LoadMusic(const char *mname)
|
|||||||
if (S_MusicDisabled())
|
if (S_MusicDisabled())
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
mlumpnum = S_GetMusicLumpNum(mname);
|
if (!S_DigMusicDisabled() && S_DigExists(mname))
|
||||||
|
mlumpnum = W_GetNumForName(va("o_%s", mname));
|
||||||
if (mlumpnum == LUMPERROR)
|
else if (!S_MIDIMusicDisabled() && S_MIDIExists(mname))
|
||||||
|
mlumpnum = W_GetNumForName(va("d_%s", mname));
|
||||||
|
else if (S_DigMusicDisabled() && S_DigExists(mname))
|
||||||
{
|
{
|
||||||
|
CONS_Alert(CONS_NOTICE, "Digital music is disabled!\n");
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
else if (S_MIDIMusicDisabled() && S_MIDIExists(mname))
|
||||||
|
{
|
||||||
|
#ifdef NO_MIDI
|
||||||
|
CONS_Alert(CONS_ERROR, "A MIDI music lump %.6s was found,\nbut SRB2Kart does not support MIDI output.\nWe apologise for the inconvenience.\n", mname);
|
||||||
|
#else
|
||||||
|
CONS_Alert(CONS_NOTICE, "MIDI music is disabled!\n");
|
||||||
|
#endif
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
CONS_Alert(CONS_ERROR, M_GetText("Music lump %.6s not found!\n"), mname);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1702,7 +1719,7 @@ static boolean S_PlayMusic(boolean looping, UINT32 fadeinms)
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
S_SetMusicVolume(-1); // initialize music volume
|
S_InitMusicVolume(); // switch between digi and sequence volume
|
||||||
|
|
||||||
if (S_MusicNotInFocus())
|
if (S_MusicNotInFocus())
|
||||||
I_SetMusicVolume(0);
|
I_SetMusicVolume(0);
|
||||||
@@ -1858,24 +1875,47 @@ void S_ResumeAudio(void)
|
|||||||
I_ResumeSong();
|
I_ResumeSong();
|
||||||
}
|
}
|
||||||
|
|
||||||
void S_SetMusicVolume(INT32 volume)
|
void S_SetMusicVolume(INT32 digvolume, INT32 seqvolume)
|
||||||
{
|
{
|
||||||
|
if (digvolume < 0)
|
||||||
|
digvolume = cv_digmusicvolume.value;
|
||||||
|
|
||||||
#ifdef NO_MIDI
|
#ifdef NO_MIDI
|
||||||
consvar_t *musicvolume = &cv_digmusicvolume;
|
(void)seqvolume;
|
||||||
#else
|
#else
|
||||||
consvar_t *musicvolume = (I_SongType() == MU_MID) ? &cv_midimusicvolume : &cv_digmusicvolume;
|
if (seqvolume < 0)
|
||||||
|
seqvolume = cv_midimusicvolume.value;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
if (volume < 0)
|
if (digvolume < 0 || digvolume > 31)
|
||||||
volume = musicvolume->value;
|
CONS_Alert(CONS_WARNING, "digmusicvolume should be between 0-31\n");
|
||||||
|
CV_SetValue(&cv_digmusicvolume, digvolume&31);
|
||||||
|
actualdigmusicvolume = cv_digmusicvolume.value; //check for change of var
|
||||||
|
|
||||||
if (volume < 0 || volume > 31)
|
#ifndef NO_MIDI
|
||||||
CONS_Alert(CONS_WARNING, "Music volume should be between 0-31\n");
|
if (seqvolume < 0 || seqvolume > 31)
|
||||||
|
CONS_Alert(CONS_WARNING, "midimusicvolume should be between 0-31\n");
|
||||||
|
CV_SetValue(&cv_midimusicvolume, seqvolume&31);
|
||||||
|
actualmidimusicvolume = cv_midimusicvolume.value; //check for change of var
|
||||||
|
#endif
|
||||||
|
|
||||||
CV_SetValue(musicvolume, volume&31);
|
#ifndef NO_MIDI
|
||||||
actualmusicvolume = musicvolume->value; //check for change of var
|
seqvolume = 31;
|
||||||
|
#endif
|
||||||
|
|
||||||
I_SetMusicVolume(volume&31);
|
switch(I_SongType())
|
||||||
|
{
|
||||||
|
#ifndef NO_MIDI
|
||||||
|
case MU_MID:
|
||||||
|
//case MU_MOD:
|
||||||
|
//case MU_GME:
|
||||||
|
I_SetMusicVolume(seqvolume&31);
|
||||||
|
break;
|
||||||
|
#endif
|
||||||
|
default:
|
||||||
|
I_SetMusicVolume(digvolume&31);
|
||||||
|
break;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void S_SetRestoreMusicFadeInCvar(consvar_t *cv)
|
void S_SetRestoreMusicFadeInCvar(consvar_t *cv)
|
||||||
@@ -2116,7 +2156,11 @@ void S_RestartMusic(void)
|
|||||||
I_ShutdownMusic();
|
I_ShutdownMusic();
|
||||||
I_InitMusic();
|
I_InitMusic();
|
||||||
|
|
||||||
S_SetMusicVolume(-1);
|
#ifdef NO_MIDI
|
||||||
|
S_SetMusicVolume(cv_digmusicvolume.value, -1);
|
||||||
|
#else
|
||||||
|
S_SetMusicVolume(cv_digmusicvolume.value, cv_midimusicvolume.value);
|
||||||
|
#endif
|
||||||
|
|
||||||
S_ResetKeepAndSpecialMus();
|
S_ResetKeepAndSpecialMus();
|
||||||
|
|
||||||
@@ -2217,7 +2261,11 @@ static void Command_RestartAudio_f(void)
|
|||||||
// These must be called or no sound and music until manually set.
|
// These must be called or no sound and music until manually set.
|
||||||
|
|
||||||
I_SetSfxVolume(cv_soundvolume.value);
|
I_SetSfxVolume(cv_soundvolume.value);
|
||||||
S_SetMusicVolume(-1);
|
#ifdef NO_MIDI
|
||||||
|
S_SetMusicVolume(cv_digmusicvolume.value, -1);
|
||||||
|
#else
|
||||||
|
S_SetMusicVolume(cv_digmusicvolume.value, cv_midimusicvolume.value);
|
||||||
|
#endif
|
||||||
|
|
||||||
S_StartSound(NULL, sfx_strpst);
|
S_StartSound(NULL, sfx_strpst);
|
||||||
|
|
||||||
@@ -2287,14 +2335,16 @@ static void SoundPrecache_OnChange(void)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void GameMusic_OnChange(void)
|
static void GameDigiMusic_OnChange(void)
|
||||||
{
|
{
|
||||||
if (M_CheckParm("-nomusic") || M_CheckParm("-noaudio"))
|
if (M_CheckParm("-nomusic") || M_CheckParm("-noaudio"))
|
||||||
return;
|
return;
|
||||||
|
else if (M_CheckParm("-nodigmusic"))
|
||||||
|
return;
|
||||||
|
|
||||||
if (music_disabled && cv_gamedigimusic.value)
|
if (digital_disabled && cv_gamedigimusic.value)
|
||||||
{
|
{
|
||||||
music_disabled = false;
|
digital_disabled = false;
|
||||||
I_StartupSound(); // will return early if initialised
|
I_StartupSound(); // will return early if initialised
|
||||||
I_InitMusic();
|
I_InitMusic();
|
||||||
|
|
||||||
@@ -2305,13 +2355,32 @@ void GameMusic_OnChange(void)
|
|||||||
else
|
else
|
||||||
S_ChangeMusicInternal("titles", looptitle);
|
S_ChangeMusicInternal("titles", looptitle);
|
||||||
}
|
}
|
||||||
else if (!music_disabled && !cv_gamedigimusic.value)
|
else if (!digital_disabled && !cv_gamedigimusic.value)
|
||||||
{
|
{
|
||||||
music_disabled = true;
|
digital_disabled = true;
|
||||||
S_StopMusic();
|
if (S_MusicType() != MU_MID)
|
||||||
|
{
|
||||||
|
if (midi_disabled)
|
||||||
|
S_StopMusic();
|
||||||
|
else
|
||||||
|
{
|
||||||
|
char mmusic[7];
|
||||||
|
UINT16 mflags;
|
||||||
|
boolean looping;
|
||||||
|
|
||||||
|
if (S_MusicInfo(mmusic, &mflags, &looping) && S_MIDIExists(mmusic))
|
||||||
|
{
|
||||||
|
S_StopMusic();
|
||||||
|
S_ChangeMusic(mmusic, mflags, looping);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
S_StopMusic();
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
#ifdef HAVE_OPENMPT
|
#ifdef HAVE_OPENMPT
|
||||||
static void ModFilter_OnChange(void)
|
static void ModFilter_OnChange(void)
|
||||||
{
|
{
|
||||||
@@ -2353,3 +2422,49 @@ static void BufferSize_OnChange(void)
|
|||||||
if (sound_started)
|
if (sound_started)
|
||||||
COM_ImmedExecute("restartaudio");
|
COM_ImmedExecute("restartaudio");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#ifndef NO_MIDI
|
||||||
|
static void GameMIDIMusic_OnChange(void)
|
||||||
|
{
|
||||||
|
if (M_CheckParm("-nomusic") || M_CheckParm("-noaudio"))
|
||||||
|
return;
|
||||||
|
else if (M_CheckParm("-nomidimusic"))
|
||||||
|
return;
|
||||||
|
|
||||||
|
if (midi_disabled && cv_gamemidimusic.value)
|
||||||
|
{
|
||||||
|
midi_disabled = false;
|
||||||
|
I_InitMusic();
|
||||||
|
|
||||||
|
S_ResetKeepAndSpecialMus();
|
||||||
|
|
||||||
|
if (Playing())
|
||||||
|
P_RestoreMusic(&players[consoleplayer]);
|
||||||
|
else
|
||||||
|
S_ChangeMusicInternal("titles", looptitle);
|
||||||
|
}
|
||||||
|
else if (!midi_disabled && !cv_gamemidimusic.value)
|
||||||
|
{
|
||||||
|
midi_disabled = true;
|
||||||
|
if (S_MusicType() == MU_MID)
|
||||||
|
{
|
||||||
|
if (digital_disabled)
|
||||||
|
S_StopMusic();
|
||||||
|
else
|
||||||
|
{
|
||||||
|
char mmusic[7];
|
||||||
|
UINT16 mflags;
|
||||||
|
boolean looping;
|
||||||
|
|
||||||
|
if (S_MusicInfo(mmusic, &mflags, &looping) && S_DigExists(mmusic))
|
||||||
|
{
|
||||||
|
S_StopMusic();
|
||||||
|
S_ChangeMusic(mmusic, mflags, looping);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
S_StopMusic();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
#endif
|
||||||
+9
-2
@@ -38,7 +38,7 @@ extern consvar_t cv_audbuffersize;
|
|||||||
//extern consvar_t cv_resetmusic;
|
//extern consvar_t cv_resetmusic;
|
||||||
extern consvar_t cv_gamedigimusic;
|
extern consvar_t cv_gamedigimusic;
|
||||||
#ifndef NO_MIDI
|
#ifndef NO_MIDI
|
||||||
extern consvar_t cv_midimusicvolume;
|
extern consvar_t cv_gamemidimusic, cv_midimusicvolume;
|
||||||
#endif
|
#endif
|
||||||
extern consvar_t cv_gamesounds;
|
extern consvar_t cv_gamesounds;
|
||||||
extern consvar_t cv_playmusicifunfocused;
|
extern consvar_t cv_playmusicifunfocused;
|
||||||
@@ -148,6 +148,8 @@ void S_StopSound(void *origin);
|
|||||||
// Music Status
|
// Music Status
|
||||||
//
|
//
|
||||||
|
|
||||||
|
boolean S_DigMusicDisabled(void);
|
||||||
|
boolean S_MIDIMusicDisabled(void);
|
||||||
boolean S_MusicDisabled(void);
|
boolean S_MusicDisabled(void);
|
||||||
boolean S_MusicPlaying(void);
|
boolean S_MusicPlaying(void);
|
||||||
boolean S_MusicPaused(void);
|
boolean S_MusicPaused(void);
|
||||||
@@ -157,6 +159,8 @@ musictype_t S_MusicType(void);
|
|||||||
const char *S_MusicName(void);
|
const char *S_MusicName(void);
|
||||||
boolean S_MusicInfo(char *mname, UINT16 *mflags, boolean *looping);
|
boolean S_MusicInfo(char *mname, UINT16 *mflags, boolean *looping);
|
||||||
boolean S_MusicExists(const char *mname, boolean checkMIDI, boolean checkDigi);
|
boolean S_MusicExists(const char *mname, boolean checkMIDI, boolean checkDigi);
|
||||||
|
#define S_DigExists(a) S_MusicExists(a, false, true)
|
||||||
|
#define S_MIDIExists(a) S_MusicExists(a, true, false)
|
||||||
|
|
||||||
//
|
//
|
||||||
// Music Effects
|
// Music Effects
|
||||||
@@ -277,7 +281,10 @@ void S_UpdateSounds(void);
|
|||||||
FUNCMATH fixed_t S_CalculateSoundDistance(fixed_t px1, fixed_t py1, fixed_t pz1, fixed_t px2, fixed_t py2, fixed_t pz2);
|
FUNCMATH fixed_t S_CalculateSoundDistance(fixed_t px1, fixed_t py1, fixed_t pz1, fixed_t px2, fixed_t py2, fixed_t pz2);
|
||||||
|
|
||||||
void S_SetSfxVolume(INT32 volume);
|
void S_SetSfxVolume(INT32 volume);
|
||||||
void S_SetMusicVolume(INT32 volume);
|
void S_SetMusicVolume(INT32 digvolume, INT32 seqvolume);
|
||||||
|
#define S_SetDigMusicVolume(a) S_SetMusicVolume(a,-1)
|
||||||
|
#define S_SetMIDIMusicVolume(a) S_SetMusicVolume(-1,a)
|
||||||
|
#define S_InitMusicVolume() S_SetMusicVolume(-1,-1)
|
||||||
|
|
||||||
INT32 S_OriginPlaying(void *origin);
|
INT32 S_OriginPlaying(void *origin);
|
||||||
INT32 S_IdPlaying(sfxenum_t id);
|
INT32 S_IdPlaying(sfxenum_t id);
|
||||||
|
|||||||
@@ -2486,7 +2486,7 @@ static const char *searchWad(const char *searchDir)
|
|||||||
filestatus_t fstemp;
|
filestatus_t fstemp;
|
||||||
|
|
||||||
strcpy(tempsw, WADKEYWORD1);
|
strcpy(tempsw, WADKEYWORD1);
|
||||||
fstemp = filesearch(tempsw, searchDir, NULL, true, 20);
|
fstemp = filesearch(tempsw,searchDir,NULL,true,20);
|
||||||
if (fstemp == FS_FOUND)
|
if (fstemp == FS_FOUND)
|
||||||
{
|
{
|
||||||
pathonly(tempsw);
|
pathonly(tempsw);
|
||||||
|
|||||||
+2
-2
@@ -718,10 +718,10 @@ static void Impl_HandleWindowEvent(SDL_WindowEvent evt)
|
|||||||
// Tell game we got focus back, resume music if necessary
|
// Tell game we got focus back, resume music if necessary
|
||||||
window_notinfocus = false;
|
window_notinfocus = false;
|
||||||
|
|
||||||
S_SetMusicVolume(-1);
|
S_InitMusicVolume();
|
||||||
|
|
||||||
if (cv_gamesounds.value)
|
if (cv_gamesounds.value)
|
||||||
S_ResumeAudio(); // resume it
|
S_ResumeAudio(); //resume it
|
||||||
|
|
||||||
if (!firsttimeonmouse)
|
if (!firsttimeonmouse)
|
||||||
{
|
{
|
||||||
|
|||||||
+8
-4
@@ -189,7 +189,7 @@ static void Snd_LockAudio(void) //Alam: Lock audio data and uninstall audio call
|
|||||||
{
|
{
|
||||||
if (Snd_Mutex) SDL_LockMutex(Snd_Mutex);
|
if (Snd_Mutex) SDL_LockMutex(Snd_Mutex);
|
||||||
else if (sound_disabled) return;
|
else if (sound_disabled) return;
|
||||||
else if (music_disabled) SDL_LockAudio();
|
else if (midi_disabled && digital_disabled) SDL_LockAudio();
|
||||||
#ifdef HAVE_MIXER
|
#ifdef HAVE_MIXER
|
||||||
else if (musicStarted) Mix_SetPostMix(NULL, NULL);
|
else if (musicStarted) Mix_SetPostMix(NULL, NULL);
|
||||||
#endif
|
#endif
|
||||||
@@ -199,7 +199,7 @@ static void Snd_UnlockAudio(void) //Alam: Unlock audio data and reinstall audio
|
|||||||
{
|
{
|
||||||
if (Snd_Mutex) SDL_UnlockMutex(Snd_Mutex);
|
if (Snd_Mutex) SDL_UnlockMutex(Snd_Mutex);
|
||||||
else if (sound_disabled) return;
|
else if (sound_disabled) return;
|
||||||
else if (music_disabled) SDL_UnlockAudio();
|
else if (midi_disabled && digital_disabled) SDL_UnlockAudio();
|
||||||
#ifdef HAVE_MIXER
|
#ifdef HAVE_MIXER
|
||||||
else if (musicStarted) Mix_SetPostMix(audio.callback, audio.userdata);
|
else if (musicStarted) Mix_SetPostMix(audio.callback, audio.userdata);
|
||||||
#endif
|
#endif
|
||||||
@@ -1061,7 +1061,7 @@ void I_ShutdownSound(void)
|
|||||||
|
|
||||||
CONS_Printf("I_ShutdownSound: ");
|
CONS_Printf("I_ShutdownSound: ");
|
||||||
|
|
||||||
if (music_disabled)
|
if (midi_disabled && digital_disabled)
|
||||||
SDL_CloseAudio();
|
SDL_CloseAudio();
|
||||||
CONS_Printf("%s", M_GetText("shut down\n"));
|
CONS_Printf("%s", M_GetText("shut down\n"));
|
||||||
sound_started = false;
|
sound_started = false;
|
||||||
@@ -1078,7 +1078,11 @@ void I_UpdateSound(void)
|
|||||||
void I_StartupSound(void)
|
void I_StartupSound(void)
|
||||||
{
|
{
|
||||||
#ifndef HAVE_MIXER
|
#ifndef HAVE_MIXER
|
||||||
music_disabled = true;
|
#ifndef NO_MIDI
|
||||||
|
midi_disabled =
|
||||||
|
#endif
|
||||||
|
digital_disabled = true;
|
||||||
|
#endif
|
||||||
|
|
||||||
memset(channels, 0, sizeof (channels)); //Alam: Clean it
|
memset(channels, 0, sizeof (channels)); //Alam: Clean it
|
||||||
|
|
||||||
|
|||||||
+2
-15
@@ -367,7 +367,7 @@ static void ST_drawDebugInfo(void)
|
|||||||
{
|
{
|
||||||
INT32 height = 192;
|
INT32 height = 192;
|
||||||
|
|
||||||
if (!cv_debug || !stplyr->mo)
|
if (!stplyr->mo)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if (cv_debug & DBG_BASIC)
|
if (cv_debug & DBG_BASIC)
|
||||||
@@ -438,21 +438,9 @@ static void ST_drawLevelTitle(void)
|
|||||||
zonttl = mapheaderinfo[gamemap-1]->zonttl; // SRB2kart
|
zonttl = mapheaderinfo[gamemap-1]->zonttl; // SRB2kart
|
||||||
actnum = mapheaderinfo[gamemap-1]->actnum;
|
actnum = mapheaderinfo[gamemap-1]->actnum;
|
||||||
dupcalc = (vid.width/vid.dupx);
|
dupcalc = (vid.width/vid.dupx);
|
||||||
|
gtc = G_GetGametypeColor(gametype);
|
||||||
bary = (splitscreen) ? BASEVIDHEIGHT/2 : 163;
|
bary = (splitscreen) ? BASEVIDHEIGHT/2 : 163;
|
||||||
|
|
||||||
if (K_UseColorHud())
|
|
||||||
{
|
|
||||||
if (gametype == GT_RACE)
|
|
||||||
gtc = colortranslations[K_GetHudColor()][7]; // idk if this should also apply to other gametypes?
|
|
||||||
else if (modeattacking || gamestate == GS_TIMEATTACK)
|
|
||||||
gtc = colortranslations[K_GetHudColor()][4];
|
|
||||||
else
|
|
||||||
gtc = G_GetGametypeColor(gametype);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
gtc = G_GetGametypeColor(gametype);
|
|
||||||
|
|
||||||
lvlw = V_LevelNameWidth(lvlttl);
|
lvlw = V_LevelNameWidth(lvlttl);
|
||||||
|
|
||||||
if (actnum[0])
|
if (actnum[0])
|
||||||
@@ -803,6 +791,5 @@ void ST_Drawer(void)
|
|||||||
else
|
else
|
||||||
V_DrawFadeScreen(120, 15-timeinmap); // Then gradually fade out from there
|
V_DrawFadeScreen(120, 15-timeinmap); // Then gradually fade out from there
|
||||||
}
|
}
|
||||||
|
|
||||||
ST_drawDebugInfo();
|
ST_drawDebugInfo();
|
||||||
}
|
}
|
||||||
+61
-15
@@ -73,6 +73,7 @@ static huddrawlist_h luahuddrawlist_intermission = NULL;
|
|||||||
static huddrawlist_h luahuddrawlist_vote = NULL;
|
static huddrawlist_h luahuddrawlist_vote = NULL;
|
||||||
|
|
||||||
static void Y_FollowIntermission(void);
|
static void Y_FollowIntermission(void);
|
||||||
|
static void Y_UnloadData(void);
|
||||||
|
|
||||||
// SRB2Kart: voting stuff
|
// SRB2Kart: voting stuff
|
||||||
// Level images
|
// Level images
|
||||||
@@ -111,6 +112,8 @@ static y_voteclient voteclient;
|
|||||||
static INT32 votetic;
|
static INT32 votetic;
|
||||||
static INT32 voteendtic = -1;
|
static INT32 voteendtic = -1;
|
||||||
|
|
||||||
|
static void Y_UnloadVoteData(void);
|
||||||
|
|
||||||
//
|
//
|
||||||
// SRB2Kart - Y_CalculateMatchData and ancillary functions
|
// SRB2Kart - Y_CalculateMatchData and ancillary functions
|
||||||
//
|
//
|
||||||
@@ -786,7 +789,7 @@ void Y_StartIntermission(void)
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
bgtile = W_CachePatchName("SRB2BACK", PU_PATCH_LOWPRIORITY);
|
bgtile = W_CachePatchName("SRB2BACK", PU_PATCH);
|
||||||
|
|
||||||
LUA_HUD_DestroyDrawList(luahuddrawlist_intermission);
|
LUA_HUD_DestroyDrawList(luahuddrawlist_intermission);
|
||||||
luahuddrawlist_intermission = LUA_HUD_CreateDrawList();
|
luahuddrawlist_intermission = LUA_HUD_CreateDrawList();
|
||||||
@@ -799,6 +802,9 @@ void Y_StartIntermission(void)
|
|||||||
//
|
//
|
||||||
void Y_EndIntermission(void)
|
void Y_EndIntermission(void)
|
||||||
{
|
{
|
||||||
|
if (!dedicated)
|
||||||
|
Y_UnloadData();
|
||||||
|
|
||||||
endtic = -1;
|
endtic = -1;
|
||||||
sorttic = -1;
|
sorttic = -1;
|
||||||
intertype = int_none;
|
intertype = int_none;
|
||||||
@@ -815,6 +821,20 @@ static void Y_FollowIntermission(void)
|
|||||||
G_AfterIntermission();
|
G_AfterIntermission();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#define UNLOAD(x) {if ((x) != NULL) {Patch_Free(x);} x = NULL;}
|
||||||
|
|
||||||
|
//
|
||||||
|
// Y_UnloadData
|
||||||
|
//
|
||||||
|
static void Y_UnloadData(void)
|
||||||
|
{
|
||||||
|
// unload the background patches
|
||||||
|
UNLOAD(VoteScreen.bgpatch);
|
||||||
|
UNLOAD(VoteScreen.widebgpatch);
|
||||||
|
UNLOAD(bgtile);
|
||||||
|
//UNLOAD(interpic);
|
||||||
|
}
|
||||||
|
|
||||||
// SRB2Kart: Voting!
|
// SRB2Kart: Voting!
|
||||||
|
|
||||||
//
|
//
|
||||||
@@ -857,8 +877,8 @@ static void Y_VoteScreenCheck(void)
|
|||||||
|
|
||||||
// non lua vote background handling
|
// non lua vote background handling
|
||||||
boolean prefbattletype = ((votelevels[0][1] & ~0x80) == GT_MATCH);
|
boolean prefbattletype = ((votelevels[0][1] & ~0x80) == GT_MATCH);
|
||||||
VoteScreen.widebgpatch = W_CachePatchName((prefbattletype ? "BATTLSCW" : "INTERSCW"), PU_PATCH_LOWPRIORITY);
|
VoteScreen.widebgpatch = W_CachePatchName((prefbattletype ? "BATTLSCW" : "INTERSCW"), PU_PATCH);
|
||||||
VoteScreen.bgpatch = W_CachePatchName((prefbattletype ? "BATTLSCR" : "INTERSCR"), PU_PATCH_LOWPRIORITY);
|
VoteScreen.bgpatch = W_CachePatchName((prefbattletype ? "BATTLSCR" : "INTERSCR"), PU_PATCH);
|
||||||
}
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
@@ -906,7 +926,7 @@ static void Y_DrawLuaVoteScreenPatch(boolean widePatch)
|
|||||||
// Draw non animated patch
|
// Draw non animated patch
|
||||||
if (!tempfoundAnimLuaVoteFrames)
|
if (!tempfoundAnimLuaVoteFrames)
|
||||||
{
|
{
|
||||||
votebg = W_CachePatchName(va("%s1", tempPrefix), PU_PATCH_LOWPRIORITY);
|
votebg = W_CachePatchName(va("%s1", tempPrefix), PU_PATCH);
|
||||||
Y_VoteBackgroundDrawer(votebg);
|
Y_VoteBackgroundDrawer(votebg);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@@ -919,7 +939,7 @@ static void Y_DrawLuaVoteScreenPatch(boolean widePatch)
|
|||||||
|
|
||||||
nextframe = (VoteScreen.currentAnimFrame + 1);
|
nextframe = (VoteScreen.currentAnimFrame + 1);
|
||||||
|
|
||||||
votebg = W_CachePatchName(va("%s%d", tempPrefix, nextframe), PU_PATCH_LOWPRIORITY);
|
votebg = W_CachePatchName(va("%s%d", tempPrefix, nextframe), PU_PATCH);
|
||||||
|
|
||||||
Y_VoteBackgroundDrawer(votebg);
|
Y_VoteBackgroundDrawer(votebg);
|
||||||
|
|
||||||
@@ -1461,14 +1481,14 @@ static void Y_InitVoteDrawing(void)
|
|||||||
// setup the background patches
|
// setup the background patches
|
||||||
Y_VoteScreenCheck();
|
Y_VoteScreenCheck();
|
||||||
|
|
||||||
VoteScreen.cursor[0] = W_CachePatchName("M_CURSOR", PU_PATCH_LOWPRIORITY);
|
VoteScreen.cursor[0] = W_CachePatchName("M_CURSOR", PU_PATCH);
|
||||||
VoteScreen.cursor[1] = W_CachePatchName("P1CURSOR", PU_PATCH_LOWPRIORITY);
|
VoteScreen.cursor[1] = W_CachePatchName("P1CURSOR", PU_PATCH);
|
||||||
VoteScreen.cursor[2] = W_CachePatchName("P2CURSOR", PU_PATCH_LOWPRIORITY);
|
VoteScreen.cursor[2] = W_CachePatchName("P2CURSOR", PU_PATCH);
|
||||||
VoteScreen.cursor[3] = W_CachePatchName("P3CURSOR", PU_PATCH_LOWPRIORITY);
|
VoteScreen.cursor[3] = W_CachePatchName("P3CURSOR", PU_PATCH);
|
||||||
VoteScreen.cursor[4] = W_CachePatchName("P4CURSOR", PU_PATCH_LOWPRIORITY);
|
VoteScreen.cursor[4] = W_CachePatchName("P4CURSOR", PU_PATCH);
|
||||||
|
|
||||||
VoteScreen.randomlvl = W_CachePatchName("RANDOMLV", PU_PATCH_LOWPRIORITY);
|
VoteScreen.randomlvl = W_CachePatchName("RANDOMLV", PU_PATCH);
|
||||||
VoteScreen.rubyicon = W_CachePatchName("RUBYICON", PU_PATCH_LOWPRIORITY);
|
VoteScreen.rubyicon = W_CachePatchName("RUBYICON", PU_PATCH);
|
||||||
}
|
}
|
||||||
|
|
||||||
void Y_StartVote(void)
|
void Y_StartVote(void)
|
||||||
@@ -1553,9 +1573,9 @@ void Y_StartVote(void)
|
|||||||
{
|
{
|
||||||
lumpnum = W_CheckNumForName(va("%sP", G_BuildMapName(votelevels[i][0]+1)));
|
lumpnum = W_CheckNumForName(va("%sP", G_BuildMapName(votelevels[i][0]+1)));
|
||||||
if (lumpnum != LUMPERROR)
|
if (lumpnum != LUMPERROR)
|
||||||
levelinfo[i].pic = W_CachePatchName(va("%sP", G_BuildMapName(votelevels[i][0]+1)), PU_PATCH_LOWPRIORITY);
|
levelinfo[i].pic = W_CachePatchName(va("%sP", G_BuildMapName(votelevels[i][0]+1)), PU_PATCH);
|
||||||
else
|
else
|
||||||
levelinfo[i].pic = W_CachePatchName("BLANKLVL", PU_PATCH_LOWPRIORITY);
|
levelinfo[i].pic = W_CachePatchName("BLANKLVL", PU_PATCH);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1570,10 +1590,36 @@ void Y_StartVote(void)
|
|||||||
//
|
//
|
||||||
void Y_EndVote(void)
|
void Y_EndVote(void)
|
||||||
{
|
{
|
||||||
voteclient.loaded = false;
|
Y_UnloadVoteData();
|
||||||
voteendtic = -1;
|
voteendtic = -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
// Y_UnloadVoteData
|
||||||
|
//
|
||||||
|
static void Y_UnloadVoteData(void)
|
||||||
|
{
|
||||||
|
voteclient.loaded = false;
|
||||||
|
|
||||||
|
if (dedicated)
|
||||||
|
return;
|
||||||
|
|
||||||
|
UNLOAD(VoteScreen.widebgpatch);
|
||||||
|
UNLOAD(VoteScreen.bgpatch);
|
||||||
|
UNLOAD(VoteScreen.cursor[0]);
|
||||||
|
UNLOAD(VoteScreen.cursor[1]);
|
||||||
|
UNLOAD(VoteScreen.cursor[2]);
|
||||||
|
UNLOAD(VoteScreen.cursor[3]);
|
||||||
|
UNLOAD(VoteScreen.cursor[4]);
|
||||||
|
UNLOAD(VoteScreen.randomlvl);
|
||||||
|
UNLOAD(VoteScreen.rubyicon);
|
||||||
|
|
||||||
|
UNLOAD(levelinfo[3].pic);
|
||||||
|
UNLOAD(levelinfo[2].pic);
|
||||||
|
UNLOAD(levelinfo[1].pic);
|
||||||
|
UNLOAD(levelinfo[0].pic);
|
||||||
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
// Y_SetupVoteFinish
|
// Y_SetupVoteFinish
|
||||||
//
|
//
|
||||||
|
|||||||
+17
-17
@@ -503,7 +503,7 @@ void Z_CheckHeap(INT32 tag)
|
|||||||
{
|
{
|
||||||
I_Error("Z_CheckHeap %d: block %u"
|
I_Error("Z_CheckHeap %d: block %u"
|
||||||
#ifdef ZDEBUG
|
#ifdef ZDEBUG
|
||||||
" (owned by %s:%d)"
|
"(owned by %s:%d)"
|
||||||
#endif
|
#endif
|
||||||
" should not exist", i, blocknumon
|
" should not exist", i, blocknumon
|
||||||
#ifdef ZDEBUG
|
#ifdef ZDEBUG
|
||||||
@@ -514,13 +514,13 @@ void Z_CheckHeap(INT32 tag)
|
|||||||
#endif
|
#endif
|
||||||
if (block->user != NULL && *(block->user) != given)
|
if (block->user != NULL && *(block->user) != given)
|
||||||
{
|
{
|
||||||
I_Error("Z_CheckHeap :"
|
I_Error("Z_CheckHeap"
|
||||||
#ifdef ZDEBUG
|
#ifdef ZDEBUG
|
||||||
" %s %d"
|
"at %s %d :"
|
||||||
#endif
|
#endif
|
||||||
" block %u"
|
"block %u"
|
||||||
#ifdef ZDEBUG
|
#ifdef ZDEBUG
|
||||||
" (owned by %s:%d)"
|
"(owned by %s:%d)"
|
||||||
#endif
|
#endif
|
||||||
" doesn't have a proper user"
|
" doesn't have a proper user"
|
||||||
#ifdef ZDEBUG
|
#ifdef ZDEBUG
|
||||||
@@ -534,13 +534,13 @@ void Z_CheckHeap(INT32 tag)
|
|||||||
}
|
}
|
||||||
if (block->next->prev != block)
|
if (block->next->prev != block)
|
||||||
{
|
{
|
||||||
I_Error("Z_CheckHeap :"
|
I_Error("Z_CheckHeap"
|
||||||
#ifdef ZDEBUG
|
#ifdef ZDEBUG
|
||||||
" %s %d"
|
"at %s %d :"
|
||||||
#endif
|
#endif
|
||||||
" block %u"
|
"block %u"
|
||||||
#ifdef ZDEBUG
|
#ifdef ZDEBUG
|
||||||
" (owned by %s:%d)"
|
"(owned by %s:%d)"
|
||||||
#endif
|
#endif
|
||||||
" lacks proper backlink"
|
" lacks proper backlink"
|
||||||
#ifdef ZDEBUG
|
#ifdef ZDEBUG
|
||||||
@@ -554,13 +554,13 @@ void Z_CheckHeap(INT32 tag)
|
|||||||
}
|
}
|
||||||
if (block->prev->next != block)
|
if (block->prev->next != block)
|
||||||
{
|
{
|
||||||
I_Error("Z_CheckHeap :"
|
I_Error("Z_CheckHeap"
|
||||||
#ifdef ZDEBUG
|
#ifdef ZDEBUG
|
||||||
" %s %d"
|
"at %s %d :"
|
||||||
#endif
|
#endif
|
||||||
" block %u"
|
"block %u"
|
||||||
#ifdef ZDEBUG
|
#ifdef ZDEBUG
|
||||||
" (owned by %s:%d)"
|
"(owned by %s:%d)"
|
||||||
#endif
|
#endif
|
||||||
" lacks proper forward link"
|
" lacks proper forward link"
|
||||||
#ifdef ZDEBUG
|
#ifdef ZDEBUG
|
||||||
@@ -574,13 +574,13 @@ void Z_CheckHeap(INT32 tag)
|
|||||||
}
|
}
|
||||||
if (block->id != ZONEID)
|
if (block->id != ZONEID)
|
||||||
{
|
{
|
||||||
I_Error("Z_CheckHeap :"
|
I_Error("Z_CheckHeap"
|
||||||
#ifdef ZDEBUG
|
#ifdef ZDEBUG
|
||||||
" %s %d"
|
"at %s %d :"
|
||||||
#endif
|
#endif
|
||||||
" block %u"
|
"block %u"
|
||||||
#ifdef ZDEBUG
|
#ifdef ZDEBUG
|
||||||
" (owned by %s:%d)"
|
"(owned by %s:%d)"
|
||||||
#endif
|
#endif
|
||||||
" have the wrong ID"
|
" have the wrong ID"
|
||||||
#ifdef ZDEBUG
|
#ifdef ZDEBUG
|
||||||
|
|||||||
Reference in new issue
Block a user