Merge branch 'next' of http://git.magicalgirl.moe/STJr/SRB2.git into closestpointonline

This commit is contained in:
Monster Iestyn 2016-03-26 18:32:51 +00:00
commit bc8ea700ed
49 changed files with 957 additions and 2904 deletions

View file

@ -2,14 +2,17 @@ language: c
sudo: required sudo: required
dist: trusty dist: trusty
env: os:
- CFLAGS=-Wno-absolute-value -Werror - linux
- osx
compiler: compiler:
- gcc - gcc
- clang - clang
cache: cache:
apt: true
ccache: true
directories: directories:
- $HOME/srb2_cache - $HOME/srb2_cache
@ -30,4 +33,10 @@ before_script:
- cd build - cd build
- cmake .. - cmake ..
before_install:
- if [[ "$TRAVIS_OS_NAME" == "osx" ]]; then brew update ; fi
- if [[ "$TRAVIS_OS_NAME" == "osx" ]]; then brew install sdl2_mixer game-music-emu p7zip ; fi
- if [[ "$TRAVIS_OS_NAME" == "osx" ]]; then curl -O -L https://www.libsdl.org/release/SDL2-2.0.4.dmg; hdiutil attach SDL2-2.0.4.dmg; sudo cp -a /Volumes/SDL2/SDL2.framework /Library/Frameworks/; fi
- if [[ "$TRAVIS_OS_NAME" == "osx" ]]; then curl -O -L https://www.libsdl.org/projects/SDL_mixer/release/SDL2_mixer-2.0.1.dmg; hdiutil attach SDL2_mixer-2.0.1.dmg; sudo cp -a /Volumes/SDL2_mixer/SDL2_mixer.framework /Library/Frameworks/; fi
script: make script: make

View file

@ -6,16 +6,16 @@ find_path(GME_INCLUDE_DIR
NAMES gme.h NAMES gme.h
PATHS PATHS
${GME_PKGCONF_INCLUDE_DIRS} ${GME_PKGCONF_INCLUDE_DIRS}
/usr/include/gme "/usr/include/gme"
/usr/local/include/gme "/usr/local/include/gme"
) )
find_library(GME_LIBRARY find_library(GME_LIBRARY
NAMES gme NAMES gme
PATHS PATHS
${GME_PKGCONF_LIBRARY_DIRS} ${GME_PKGCONF_LIBRARY_DIRS}
/usr/lib "/usr/lib"
/usr/local/lib "/usr/local/lib"
) )
set(GME_PROCESS_INCLUDES GME_INCLUDE_DIR) set(GME_PROCESS_INCLUDES GME_INCLUDE_DIR)

View file

@ -1,4 +1,4 @@
@ECHO OFF @echo off
set BRA=Unknown set BRA=Unknown
set REV=illegal set REV=illegal
@ -13,20 +13,20 @@ goto filwri
:gitrev :gitrev
set GIT=%2 set GIT=%2
if "%GIT%"=="" set GIT=git if "%GIT%"=="" set GIT=git
FOR /F "usebackq" %%s IN (`%GIT% rev-parse --abbrev-ref HEAD`) DO @SET BRA=%%s for /f "usebackq" %%s in (`%GIT% rev-parse --abbrev-ref HEAD`) do @set BRA=%%s
FOR /F "usebackq" %%s IN (`%GIT% rev-parse HEAD`) DO @SET REV=%%s for /f "usebackq" %%s in (`%GIT% rev-parse HEAD`) do @set REV=%%s
set REV=%REV:~0,8% set REV=%REV:~0,8%
goto filwri goto filwri
:svnrev :svnrev
set BRA=Subversion set BRA=Subversion
FOR /F "usebackq" %%s IN (`svnversion .`) DO @SET REV=%%s for /f "usebackq" %%s in (`svnversion .`) do @set REV=%%s
set REV=r%REV% set REV=r%REV%
goto filwri goto filwri
:filwri :filwri
ECHO // Do not edit! This file was autogenerated > %1\comptime.h echo // Do not edit! This file was autogenerated > %1\comptime.h
ECHO // by the %0 batch file >> %1\comptime.h echo // by the %0 batch file >> %1\comptime.h
ECHO // >> %1\comptime.h echo // >> %1\comptime.h
ECHO const char* compbranch = "%BRA%"; >> %1\comptime.h echo const char* compbranch = "%BRA%"; >> %1\comptime.h
ECHO const char* comprevision = "%REV%"; >> %1\comptime.h echo const char* comprevision = "%REV%"; >> %1\comptime.h

View file

@ -316,6 +316,7 @@ if(${SRB2_CONFIG_HAVE_GME})
find_package(GME) find_package(GME)
if(${GME_FOUND}) if(${GME_FOUND})
set(SRB2_HAVE_GME ON) set(SRB2_HAVE_GME ON)
add_definitions(-DHAVE_LIBGME)
else() else()
message(WARNING "You have specified that GME is available but it was not found.") message(WARNING "You have specified that GME is available but it was not found.")
endif() endif()

View file

@ -262,9 +262,7 @@ else
OBJS+=$(OBJDIR)/hw3sound.o OBJS+=$(OBJDIR)/hw3sound.o
endif endif
ifndef NOVERSION
OPTS += -DCOMPVERSION OPTS += -DCOMPVERSION
endif
ifndef NONX86 ifndef NONX86
ifndef GCC29 ifndef GCC29
@ -551,15 +549,11 @@ cleandep:
$(REMOVE) comptime.h $(REMOVE) comptime.h
pre-build: pre-build:
ifdef NOVERSION
-@touch comptime.c
else
ifdef WINDOWSHELL ifdef WINDOWSHELL
-..\comptime.bat . -..\comptime.bat .
else else
-@../comptime.sh . -@../comptime.sh .
endif endif
endif
clean: clean:
$(REMOVE) *~ *.flc $(REMOVE) *~ *.flc

View file

@ -15,7 +15,9 @@
#define ASSET_HASH_PLAYER_DTA "${SRB2_ASSET_player.dta_HASH}" #define ASSET_HASH_PLAYER_DTA "${SRB2_ASSET_player.dta_HASH}"
#define ASSET_HASH_RINGS_DTA "${SRB2_ASSET_rings.dta_HASH}" #define ASSET_HASH_RINGS_DTA "${SRB2_ASSET_rings.dta_HASH}"
#define ASSET_HASH_ZONES_DTA "${SRB2_ASSET_zones.dta_HASH}" #define ASSET_HASH_ZONES_DTA "${SRB2_ASSET_zones.dta_HASH}"
#ifdef USE_PATCH_DTA
#define ASSET_HASH_PATCH_DTA "${SRB2_ASSET_patch.dta_HASH}" #define ASSET_HASH_PATCH_DTA "${SRB2_ASSET_patch.dta_HASH}"
#endif
#define SRB2_COMP_REVISION "${SRB2_COMP_REVISION}" #define SRB2_COMP_REVISION "${SRB2_COMP_REVISION}"
#define SRB2_COMP_BRANCH "${SRB2_COMP_BRANCH}" #define SRB2_COMP_BRANCH "${SRB2_COMP_BRANCH}"
@ -26,10 +28,16 @@
#else #else
/* Manually defined asset hashes for non-CMake builds
* Last updated 2000 / 00 / 00
*/
#define ASSET_HASH_SRB2_SRB "c1b9577687f8a795104aef4600720ea7" #define ASSET_HASH_SRB2_SRB "c1b9577687f8a795104aef4600720ea7"
#define ASSET_HASH_ZONES_DTA "303838c6c534d9540288360fa49cca60" #define ASSET_HASH_ZONES_DTA "303838c6c534d9540288360fa49cca60"
#define ASSET_HASH_PLAYER_DTA "cfca0f1c73023cbbd8f844f45480f799" #define ASSET_HASH_PLAYER_DTA "cfca0f1c73023cbbd8f844f45480f799"
#define ASSET_HASH_RINGS_DTA "85901ad4bf94637e5753d2ac2c03ea26" #define ASSET_HASH_RINGS_DTA "85901ad4bf94637e5753d2ac2c03ea26"
#ifdef USE_PATCH_DTA
#define ASSET_HASH_PATCH_DTA "0c66790502e648bfce90fdc5bb15722e"
#endif
#endif #endif
#endif #endif

View file

@ -513,7 +513,6 @@ static void D_Display(void)
// ========================================================================= // =========================================================================
tic_t rendergametic; tic_t rendergametic;
boolean supdate;
void D_SRB2Loop(void) void D_SRB2Loop(void)
{ {
@ -604,7 +603,6 @@ void D_SRB2Loop(void)
// Update display, next frame, with current state. // Update display, next frame, with current state.
D_Display(); D_Display();
supdate = false;
if (moviemode) if (moviemode)
M_SaveFrame(); M_SaveFrame();
@ -841,8 +839,10 @@ static void IdentifyVersion(void)
// Add the weapons // Add the weapons
D_AddFile(va(pandf,srb2waddir,"rings.dta")); D_AddFile(va(pandf,srb2waddir,"rings.dta"));
#ifdef USE_PATCH_DTA
// Add our crappy patches to fix our bugs // Add our crappy patches to fix our bugs
// D_AddFile(va(pandf,srb2waddir,"patch.dta")); D_AddFile(va(pandf,srb2waddir,"patch.dta"));
#endif
#if !defined (HAVE_SDL) || defined (HAVE_MIXER) #if !defined (HAVE_SDL) || defined (HAVE_MIXER)
{ {
@ -1133,12 +1133,18 @@ void D_SRB2Main(void)
W_VerifyFileMD5(1, ASSET_HASH_ZONES_DTA); // zones.dta W_VerifyFileMD5(1, ASSET_HASH_ZONES_DTA); // zones.dta
W_VerifyFileMD5(2, ASSET_HASH_PLAYER_DTA); // player.dta W_VerifyFileMD5(2, ASSET_HASH_PLAYER_DTA); // player.dta
W_VerifyFileMD5(3, ASSET_HASH_RINGS_DTA); // rings.dta W_VerifyFileMD5(3, ASSET_HASH_RINGS_DTA); // rings.dta
//W_VerifyFileMD5(4, "0c66790502e648bfce90fdc5bb15722e"); // patch.dta #ifdef USE_PATCH_DTA
// don't check music.dta because people like to modify it, and it doesn't matter if they do W_VerifyFileMD5(4, ASSET_HASH_PATCH_DTA); // patch.dta
// ...except it does if they slip maps in there, and that's what W_VerifyNMUSlumps is for.
#endif #endif
mainwads = 4; // there are 5 wads not to unload // don't check music.dta because people like to modify it, and it doesn't matter if they do
// ...except it does if they slip maps in there, and that's what W_VerifyNMUSlumps is for.
#endif //ifndef DEVELOP
mainwads = 4; // there are 4 wads not to unload
#ifdef USE_PATCH_DTA
++mainwads; // patch.dta adds one more
#endif
cht_Init(); cht_Init();

View file

@ -17,7 +17,6 @@
#include "d_event.h" #include "d_event.h"
#include "w_wad.h" // for MAX_WADFILES #include "w_wad.h" // for MAX_WADFILES
extern boolean supdate;
extern boolean advancedemo; extern boolean advancedemo;
// make sure not to write back the config until it's been correctly loaded // make sure not to write back the config until it's been correctly loaded

View file

@ -1854,10 +1854,10 @@ static void Got_Pause(UINT8 **cp, INT32 playernum)
if (paused) if (paused)
{ {
if (!menuactive || netgame) if (!menuactive || netgame)
S_PauseSound(); S_PauseAudio();
} }
else else
S_ResumeSound(); S_ResumeAudio();
} }
} }
@ -3761,50 +3761,66 @@ static void Command_Displayplayer_f(void)
static void Command_Tunes_f(void) static void Command_Tunes_f(void)
{ {
const char *tunearg; const char *tunearg;
UINT16 tune, track = 0; UINT16 tunenum, track = 0;
const size_t argc = COM_Argc(); const size_t argc = COM_Argc();
if (argc < 2) //tunes slot ... if (argc < 2) //tunes slot ...
{ {
CONS_Printf("tunes <slot #/map name/\"default\"> <speed> <track>:\n"); CONS_Printf("tunes <name/num> [track] [speed] / <-show> / <-default> / <-none>:\n");
CONS_Printf(M_GetText("Play a music slot at a set speed (\"1\" being normal speed).\n")); CONS_Printf(M_GetText("Play an arbitrary music lump. If a map number is used, 'MAP##M' is played.\n"));
CONS_Printf(M_GetText("If the format supports multiple songs, you can specify which one to play.\n")); CONS_Printf(M_GetText("If the format supports multiple songs, you can specify which one to play.\n\n"));
CONS_Printf(M_GetText("The current tune is: %d\nThe current track is: %d\n"), CONS_Printf(M_GetText("* With \"-show\", shows the currently playing tune and track.\n"));
(mapmusic & MUSIC_SONGMASK), ((mapmusic & MUSIC_TRACKMASK) >> MUSIC_TRACKSHIFT)); CONS_Printf(M_GetText("* With \"-default\", returns to the default music for the map.\n"));
CONS_Printf(M_GetText("* With \"-none\", any music playing will be stopped.\n"));
return; return;
} }
tunearg = COM_Argv(1); tunearg = COM_Argv(1);
tune = (UINT16)atoi(tunearg); tunenum = (UINT16)atoi(tunearg);
track = 0; track = 0;
if (!strcasecmp(tunearg, "default")) if (!strcasecmp(tunearg, "-show"))
{ {
tune = mapheaderinfo[gamemap-1]->musicslot; CONS_Printf(M_GetText("The current tune is: %s [track %d]\n"),
track = mapheaderinfo[gamemap-1]->musicslottrack; mapmusname, (mapmusflags & MUSIC_TRACKMASK));
}
else if (toupper(tunearg[0]) >= 'A' && toupper(tunearg[0]) <= 'Z')
tune = (UINT16)M_MapNumber(tunearg[0], tunearg[1]);
if (tune >= NUMMUSIC)
{
CONS_Alert(CONS_NOTICE, M_GetText("Valid slots are 1 to %d, or 0 to stop music\n"), NUMMUSIC - 1);
return; return;
} }
if (!strcasecmp(tunearg, "-none"))
if (argc > 3) {
track = (UINT16)atoi(COM_Argv(3))-1;
mapmusic = tune | (track << MUSIC_TRACKSHIFT);
if (tune == mus_None)
S_StopMusic(); S_StopMusic();
else return;
S_ChangeMusic(mapmusic, true); }
else if (!strcasecmp(tunearg, "-default"))
{
tunearg = mapheaderinfo[gamemap-1]->musname;
track = mapheaderinfo[gamemap-1]->mustrack;
}
else if (!tunearg[2] && toupper(tunearg[0]) >= 'A' && toupper(tunearg[0]) <= 'Z')
tunenum = (UINT16)M_MapNumber(tunearg[0], tunearg[1]);
if (tunenum && tunenum >= 1036)
{
CONS_Alert(CONS_NOTICE, M_GetText("Valid music slots are 1 to 1035.\n"));
return;
}
if (!tunenum && strlen(tunearg) > 6) // This is automatic -- just show the error just in case
CONS_Alert(CONS_NOTICE, M_GetText("Music name too long - truncated to six characters.\n"));
if (argc > 2) if (argc > 2)
track = (UINT16)atoi(COM_Argv(2))-1;
if (tunenum)
snprintf(mapmusname, 7, "%sM", G_BuildMapName(tunenum));
else
strncpy(mapmusname, tunearg, 7);
mapmusname[6] = 0;
mapmusflags = (track & MUSIC_TRACKMASK);
S_ChangeMusic(mapmusname, mapmusflags, true);
if (argc > 3)
{ {
float speed = (float)atof(COM_Argv(2)); float speed = (float)atof(COM_Argv(3));
if (speed > 0.0f) if (speed > 0.0f)
S_SpeedMusic(speed); S_SpeedMusic(speed);
} }

View file

@ -65,7 +65,9 @@ static mobjtype_t get_mobjtype(const char *word);
static statenum_t get_state(const char *word); static statenum_t get_state(const char *word);
static spritenum_t get_sprite(const char *word); static spritenum_t get_sprite(const char *word);
static sfxenum_t get_sfx(const char *word); static sfxenum_t get_sfx(const char *word);
static UINT16 get_mus(const char *word); #ifdef MUSICSLOT_COMPATIBILITY
static UINT16 get_mus(const char *word, UINT8 dehacked_mode);
#endif
static hudnum_t get_huditem(const char *word); static hudnum_t get_huditem(const char *word);
#ifndef HAVE_BLUA #ifndef HAVE_BLUA
static powertype_t get_power(const char *word); static powertype_t get_power(const char *word);
@ -1164,19 +1166,31 @@ static void readlevelheader(MYFILE *f, INT32 num)
mapheaderinfo[num-1]->typeoflevel = tol; mapheaderinfo[num-1]->typeoflevel = tol;
} }
} }
else if (fastcmp(word, "MUSIC"))
{
if (fastcmp(word2, "NONE"))
mapheaderinfo[num-1]->musname[0] = 0; // becomes empty string
else
{
deh_strlcpy(mapheaderinfo[num-1]->musname, word2,
sizeof(mapheaderinfo[num-1]->musname), va("Level header %d: music", num));
}
}
#ifdef MUSICSLOT_COMPATIBILITY
else if (fastcmp(word, "MUSICSLOT")) else if (fastcmp(word, "MUSICSLOT"))
{ {
// Convert to map number i = get_mus(word2, true);
if (word2[0] >= 'A' && word2[0] <= 'Z' && word2[2] == '\0') if (i && i <= 1035)
i = M_MapNumber(word2[0], word2[1]); snprintf(mapheaderinfo[num-1]->musname, 7, "%sM", G_BuildMapName(i));
else if (i && i <= 1050)
if (i) // it's just a number strncpy(mapheaderinfo[num-1]->musname, compat_special_music_slots[i - 1036], 7);
mapheaderinfo[num-1]->musicslot = (UINT16)i; else
else // No? Okay, now we'll get technical. mapheaderinfo[num-1]->musname[0] = 0; // becomes empty string
mapheaderinfo[num-1]->musicslot = get_mus(word2); // accepts all of O_CHRSEL, mus_chrsel, or just plain ChrSel mapheaderinfo[num-1]->musname[6] = 0;
} }
else if (fastcmp(word, "MUSICSLOTTRACK")) #endif
mapheaderinfo[num-1]->musicslottrack = ((UINT16)i - 1); else if (fastcmp(word, "MUSICTRACK"))
mapheaderinfo[num-1]->mustrack = ((UINT16)i - 1);
else if (fastcmp(word, "FORCECHARACTER")) else if (fastcmp(word, "FORCECHARACTER"))
{ {
strlcpy(mapheaderinfo[num-1]->forcecharacter, word2, SKINNAMESIZE+1); strlcpy(mapheaderinfo[num-1]->forcecharacter, word2, SKINNAMESIZE+1);
@ -1443,10 +1457,30 @@ static void readcutscenescene(MYFILE *f, INT32 num, INT32 scenenum)
else else
deh_warning("CutSceneScene %d: unknown word '%s'", num, word); deh_warning("CutSceneScene %d: unknown word '%s'", num, word);
} }
else if (fastcmp(word, "MUSIC"))
{
DEH_WriteUndoline(word, cutscenes[num]->scene[scenenum].musswitch, UNDO_NONE);
strncpy(cutscenes[num]->scene[scenenum].musswitch, word2, 7);
cutscenes[num]->scene[scenenum].musswitch[6] = 0;
}
#ifdef MUSICSLOT_COMPATIBILITY
else if (fastcmp(word, "MUSICSLOT")) else if (fastcmp(word, "MUSICSLOT"))
{ {
DEH_WriteUndoline(word, va("%u", cutscenes[num]->scene[scenenum].musicslot), UNDO_NONE); DEH_WriteUndoline(word, cutscenes[num]->scene[scenenum].musswitch, UNDO_NONE);
cutscenes[num]->scene[scenenum].musicslot = get_mus(word2); // accepts all of O_MAP01M, mus_map01m, or just plain MAP01M i = get_mus(word2, true);
if (i && i <= 1035)
snprintf(cutscenes[num]->scene[scenenum].musswitch, 7, "%sM", G_BuildMapName(i));
else if (i && i <= 1050)
strncpy(cutscenes[num]->scene[scenenum].musswitch, compat_special_music_slots[i - 1036], 7);
else
cutscenes[num]->scene[scenenum].musswitch[0] = 0; // becomes empty string
cutscenes[num]->scene[scenenum].musswitch[6] = 0;
}
#endif
else if (fastcmp(word, "MUSICTRACK"))
{
DEH_WriteUndoline(word, va("%u", cutscenes[num]->scene[scenenum].musswitchflags), UNDO_NONE);
cutscenes[num]->scene[scenenum].musswitchflags = ((UINT16)i) & MUSIC_TRACKMASK;
} }
else if (fastcmp(word, "MUSICLOOP")) else if (fastcmp(word, "MUSICLOOP"))
{ {
@ -6195,9 +6229,7 @@ static const char *const MOBJTYPE_LIST[] = { // array length left dynamic for s
// Collectible Items // Collectible Items
"MT_RING", "MT_RING",
"MT_FLINGRING", // Lost ring "MT_FLINGRING", // Lost ring
#ifdef BLUE_SPHERES
"MT_BLUEBALL", // Blue sphere replacement for special stages "MT_BLUEBALL", // Blue sphere replacement for special stages
#endif
"MT_REDTEAMRING", //Rings collectable by red team. "MT_REDTEAMRING", //Rings collectable by red team.
"MT_BLUETEAMRING", //Rings collectable by blue team. "MT_BLUETEAMRING", //Rings collectable by blue team.
"MT_EMMY", // emerald token for special stage "MT_EMMY", // emerald token for special stage
@ -6650,6 +6682,7 @@ static const char *const MOBJFLAG2_LIST[] = {
"EXPLOSION", // Thrown ring has explosive properties "EXPLOSION", // Thrown ring has explosive properties
"SCATTER", // Thrown ring has scatter properties "SCATTER", // Thrown ring has scatter properties
"BEYONDTHEGRAVE",// Source of this missile has died and has since respawned. "BEYONDTHEGRAVE",// Source of this missile has died and has since respawned.
"PUSHED", // Mobj was already pushed this tic
"SLIDEPUSH", // MF_PUSHABLE that pushes continuously. "SLIDEPUSH", // MF_PUSHABLE that pushes continuously.
"CLASSICPUSH", // Drops straight down when object has negative Z. "CLASSICPUSH", // Drops straight down when object has negative Z.
"STANDONME", // While not pushable, stand on me anyway. "STANDONME", // While not pushable, stand on me anyway.
@ -6678,7 +6711,7 @@ static const char *const MOBJEFLAG_LIST[] = {
"JUSTSTEPPEDDOWN", // used for ramp sectors "JUSTSTEPPEDDOWN", // used for ramp sectors
"VERTICALFLIP", // Vertically flip sprite/allow upside-down physics "VERTICALFLIP", // Vertically flip sprite/allow upside-down physics
"GOOWATER", // Goo water "GOOWATER", // Goo water
"PUSHED", // Mobj was already pushed this tic "\x01", // free: 1<<7 (name un-matchable)
"SPRUNG", // Mobj was already sprung this tic "SPRUNG", // Mobj was already sprung this tic
"APPLYPMOMZ", // Platform movement "APPLYPMOMZ", // Platform movement
NULL NULL
@ -6941,6 +6974,8 @@ struct {
{"PUSHACCEL",PUSHACCEL}, {"PUSHACCEL",PUSHACCEL},
{"MODID",MODID}, // I don't know, I just thought it would be cool for a wad to potentially know what mod it was loaded into. {"MODID",MODID}, // I don't know, I just thought it would be cool for a wad to potentially know what mod it was loaded into.
{"CODEBASE",CODEBASE}, // or what release of SRB2 this is. {"CODEBASE",CODEBASE}, // or what release of SRB2 this is.
{"VERSION",VERSION}, // Grab the game's version!
{"SUBVERSION",SUBVERSION}, // more precise version number
// Special linedef executor tag numbers! // Special linedef executor tag numbers!
{"LE_PINCHPHASE",LE_PINCHPHASE}, // A boss entered pinch phase (and, in most cases, is preparing their pinch phase attack!) {"LE_PINCHPHASE",LE_PINCHPHASE}, // A boss entered pinch phase (and, in most cases, is preparing their pinch phase attack!)
@ -7231,36 +7266,36 @@ struct {
{"FF_GOOWATER",FF_GOOWATER}, ///< Used with ::FF_SWIMMABLE. Makes thick bouncey goop. {"FF_GOOWATER",FF_GOOWATER}, ///< Used with ::FF_SWIMMABLE. Makes thick bouncey goop.
// Angles // Angles
{"ANG1",ANG1>>16}, {"ANG1",ANG1},
{"ANG2",ANG2>>16}, {"ANG2",ANG2},
{"ANG10",ANG10>>16}, {"ANG10",ANG10},
{"ANG15",ANG15>>16}, {"ANG15",ANG15},
{"ANG20",ANG20>>16}, {"ANG20",ANG20},
{"ANG30",ANG30>>16}, {"ANG30",ANG30},
{"ANG60",ANG60>>16}, {"ANG60",ANG60},
{"ANG64h",ANG64h>>16}, {"ANG64h",ANG64h},
{"ANG105",ANG105>>16}, {"ANG105",ANG105},
{"ANG210",ANG210>>16}, {"ANG210",ANG210},
{"ANG255",ANG255>>16}, {"ANG255",ANG255},
{"ANG340",ANG340>>16}, {"ANG340",ANG340},
{"ANG350",ANG350>>16}, {"ANG350",ANG350},
{"ANGLE_11hh",ANGLE_11hh>>16}, {"ANGLE_11hh",ANGLE_11hh},
{"ANGLE_22h",ANGLE_22h>>16}, {"ANGLE_22h",ANGLE_22h},
{"ANGLE_45",ANGLE_45>>16}, {"ANGLE_45",ANGLE_45},
{"ANGLE_67h",ANGLE_67h>>16}, {"ANGLE_67h",ANGLE_67h},
{"ANGLE_90",ANGLE_90>>16}, {"ANGLE_90",ANGLE_90},
{"ANGLE_112h",ANGLE_112h>>16}, {"ANGLE_112h",ANGLE_112h},
{"ANGLE_135",ANGLE_135>>16}, {"ANGLE_135",ANGLE_135},
{"ANGLE_157h",ANGLE_157h>>16}, {"ANGLE_157h",ANGLE_157h},
{"ANGLE_180",ANGLE_180>>16}, {"ANGLE_180",ANGLE_180},
{"ANGLE_202h",ANGLE_202h>>16}, {"ANGLE_202h",ANGLE_202h},
{"ANGLE_225",ANGLE_225>>16}, {"ANGLE_225",ANGLE_225},
{"ANGLE_247h",ANGLE_247h>>16}, {"ANGLE_247h",ANGLE_247h},
{"ANGLE_270",ANGLE_270>>16}, {"ANGLE_270",ANGLE_270},
{"ANGLE_292h",ANGLE_292h>>16}, {"ANGLE_292h",ANGLE_292h},
{"ANGLE_315",ANGLE_315>>16}, {"ANGLE_315",ANGLE_315},
{"ANGLE_337h",ANGLE_337h>>16}, {"ANGLE_337h",ANGLE_337h},
{"ANGLE_MAX",ANGLE_MAX>>16}, {"ANGLE_MAX",ANGLE_MAX},
// P_Chase directions (dirtype_t) // P_Chase directions (dirtype_t)
{"DI_NODIR",DI_NODIR}, {"DI_NODIR",DI_NODIR},
@ -7428,21 +7463,45 @@ static sfxenum_t get_sfx(const char *word)
return sfx_None; return sfx_None;
} }
static UINT16 get_mus(const char *word) #ifdef MUSICSLOT_COMPATIBILITY
{ // Returns the value of SFX_ enumerations static UINT16 get_mus(const char *word, UINT8 dehacked_mode)
{ // Returns the value of MUS_ enumerations
UINT16 i; UINT16 i;
char lumptmp[4];
if (*word >= '0' && *word <= '9') if (*word >= '0' && *word <= '9')
return atoi(word); return atoi(word);
if (!word[2] && toupper(word[0]) >= 'A' && toupper(word[0]) <= 'Z')
return (UINT16)M_MapNumber(word[0], word[1]);
if (fastncmp("MUS_",word,4)) if (fastncmp("MUS_",word,4))
word += 4; // take off the MUS_ word += 4; // take off the MUS_
else if (fastncmp("O_",word,2) || fastncmp("D_",word,2)) else if (fastncmp("O_",word,2) || fastncmp("D_",word,2))
word += 2; // take off the O_ or D_ word += 2; // take off the O_ or D_
for (i = 0; i < NUMMUSIC; i++)
if (S_music[i].name && fasticmp(word, S_music[i].name)) strncpy(lumptmp, word, 4);
lumptmp[3] = 0;
if (fasticmp("MAP",lumptmp))
{
word += 3;
if (toupper(word[0]) >= 'A' && toupper(word[0]) <= 'Z')
return (UINT16)M_MapNumber(word[0], word[1]);
else if ((i = atoi(word)))
return i; return i;
deh_warning("Couldn't find music named 'MUS_%s'",word);
return mus_None; word -= 3;
if (dehacked_mode)
deh_warning("Couldn't find music named 'MUS_%s'",word);
return 0;
}
for (i = 0; compat_special_music_slots[i][0]; ++i)
if (fasticmp(word, compat_special_music_slots[i]))
return i + 1036;
if (dehacked_mode)
deh_warning("Couldn't find music named 'MUS_%s'",word);
return 0;
} }
#endif
static hudnum_t get_huditem(const char *word) static hudnum_t get_huditem(const char *word)
{ // Returns the value of HUD_ enumerations { // Returns the value of HUD_ enumerations
@ -7642,11 +7701,13 @@ static fixed_t find_const(const char **rword)
free(word); free(word);
return r; return r;
} }
#ifdef MUSICSLOT_COMPATIBILITY
else if (fastncmp("MUS_",word,4) || fastncmp("O_",word,2)) { else if (fastncmp("MUS_",word,4) || fastncmp("O_",word,2)) {
r = get_mus(word); r = get_mus(word, true);
free(word); free(word);
return r; return r;
} }
#endif
else if (fastncmp("PW_",word,3)) { else if (fastncmp("PW_",word,3)) {
r = get_power(word); r = get_power(word);
free(word); free(word);
@ -8016,33 +8077,29 @@ static inline int lib_getenum(lua_State *L)
if (mathlib) return luaL_error(L, "sfx '%s' could not be found.\n", word); if (mathlib) return luaL_error(L, "sfx '%s' could not be found.\n", word);
return 0; return 0;
} }
#ifdef MUSICSLOT_COMPATIBILITY
else if (!mathlib && fastncmp("mus_",word,4)) { else if (!mathlib && fastncmp("mus_",word,4)) {
p = word+4; p = word+4;
for (i = 0; i < NUMMUSIC; i++) if ((i = get_mus(p, false)) == 0)
if (S_music[i].name && fastcmp(p, S_music[i].name)) { return 0;
lua_pushinteger(L, i); lua_pushinteger(L, i);
return 1; return 1;
}
return 0;
} }
else if (mathlib && fastncmp("MUS_",word,4)) { // SOCs are ALL CAPS! else if (mathlib && fastncmp("MUS_",word,4)) { // SOCs are ALL CAPS!
p = word+4; p = word+4;
for (i = 0; i < NUMMUSIC; i++) if ((i = get_mus(p, false)) == 0)
if (S_music[i].name && fasticmp(p, S_music[i].name)) { return luaL_error(L, "music '%s' could not be found.\n", word);
lua_pushinteger(L, i); lua_pushinteger(L, i);
return 1; return 1;
}
return luaL_error(L, "music '%s' could not be found.\n", word);
} }
else if (mathlib && (fastncmp("O_",word,2) || fastncmp("D_",word,2))) { else if (mathlib && (fastncmp("O_",word,2) || fastncmp("D_",word,2))) {
p = word+2; p = word+2;
for (i = 0; i < NUMMUSIC; i++) if ((i = get_mus(p, false)) == 0)
if (S_music[i].name && fasticmp(p, S_music[i].name)) { return luaL_error(L, "music '%s' could not be found.\n", word);
lua_pushinteger(L, i); lua_pushinteger(L, i);
return 1; return 1;
}
return luaL_error(L, "music '%s' could not be found.\n", word);
} }
#endif
else if (!mathlib && fastncmp("pw_",word,3)) { else if (!mathlib && fastncmp("pw_",word,3)) {
p = word+3; p = word+3;
for (i = 0; i < NUMPOWERS; i++) for (i = 0; i < NUMPOWERS; i++)
@ -8194,8 +8251,11 @@ static inline int lib_getenum(lua_State *L)
} else if (fastcmp(word,"globallevelskynum")) { } else if (fastcmp(word,"globallevelskynum")) {
lua_pushinteger(L, globallevelskynum); lua_pushinteger(L, globallevelskynum);
return 1; return 1;
} else if (fastcmp(word,"mapmusic")) { } else if (fastcmp(word,"mapmusname")) {
lua_pushinteger(L, mapmusic); lua_pushstring(L, mapmusname);
return 1;
} else if (fastcmp(word,"mapmusflags")) {
lua_pushinteger(L, mapmusflags);
return 1; return 1;
} else if (fastcmp(word,"server")) { } else if (fastcmp(word,"server")) {
if ((!multiplayer || !netgame) && !playeringame[serverplayer]) if ((!multiplayer || !netgame) && !playeringame[serverplayer])
@ -8213,6 +8273,9 @@ static inline int lib_getenum(lua_State *L)
} else if (fastcmp(word,"gravity")) { } else if (fastcmp(word,"gravity")) {
lua_pushinteger(L, gravity); lua_pushinteger(L, gravity);
return 1; return 1;
} else if (fastcmp(word,"VERSIONSTRING")) {
lua_pushstring(L, VERSIONSTRING);
return 1;
} }
return 0; return 0;

View file

@ -148,13 +148,17 @@ extern FILE *logstream;
// we use comprevision and compbranch instead. // we use comprevision and compbranch instead.
#else #else
#define VERSION 201 // Game version #define VERSION 201 // Game version
#define SUBVERSION 14 // more precise version number #define SUBVERSION 15 // more precise version number
#define VERSIONSTRING "v2.1.14" #define VERSIONSTRING "v2.1.15"
#define VERSIONSTRINGW L"v2.1.14" #define VERSIONSTRINGW L"v2.1.15"
// Hey! If you change this, add 1 to the MODVERSION below! // Hey! If you change this, add 1 to the MODVERSION below!
// Otherwise we can't force updates! // Otherwise we can't force updates!
#endif #endif
// Does this version require an added patch file?
// Comment or uncomment this as necessary.
#define USE_PATCH_DTA
// Modification options // Modification options
// If you want to take advantage of the Master Server's ability to force clients to update // If you want to take advantage of the Master Server's ability to force clients to update
// to the latest version, fill these out. Otherwise, just comment out UPDATE_ALERT and leave // to the latest version, fill these out. Otherwise, just comment out UPDATE_ALERT and leave
@ -208,7 +212,7 @@ extern FILE *logstream;
// it's only for detection of the version the player is using so the MS can alert them of an update. // it's only for detection of the version the player is using so the MS can alert them of an update.
// Only set it higher, not lower, obviously. // Only set it higher, not lower, obviously.
// Note that we use this to help keep internal testing in check; this is why v2.1.0 is not version "1". // Note that we use this to help keep internal testing in check; this is why v2.1.0 is not version "1".
#define MODVERSION 19 #define MODVERSION 20
// ========================================================================= // =========================================================================
@ -427,9 +431,6 @@ extern const char *compdate, *comptime, *comprevision, *compbranch;
/// \note obsoleted by cv_maxportals /// \note obsoleted by cv_maxportals
//#define PORTAL_LIMIT 8 //#define PORTAL_LIMIT 8
/// Fun experimental slope stuff!
//#define SLOPENESS
/// Kalaron/Eternity Engine slope code (SRB2CB ported) /// Kalaron/Eternity Engine slope code (SRB2CB ported)
#define ESLOPE #define ESLOPE
@ -449,10 +450,6 @@ extern const char *compdate, *comptime, *comprevision, *compbranch;
/// Polyobject fake flat code /// Polyobject fake flat code
#define POLYOBJECTS_PLANES #define POLYOBJECTS_PLANES
/// Blue spheres for future use.
/// \todo Remove this define.
#define BLUE_SPHERES // Blue spheres for future use.
/// Improved way of dealing with ping values and a ping limit. /// Improved way of dealing with ping values and a ping limit.
#define NEWPING #define NEWPING
@ -490,4 +487,8 @@ extern const char *compdate, *comptime, *comprevision, *compbranch;
/// Experimental tweaks to analog mode. (Needs a lot of work before it's ready for primetime.) /// Experimental tweaks to analog mode. (Needs a lot of work before it's ready for primetime.)
//#define REDSANALOG //#define REDSANALOG
/// Backwards compatibility with musicslots.
/// \note You should leave this enabled unless you're working with a future SRB2 version.
#define MUSICSLOT_COMPATIBILITY
#endif // __DOOMDEF__ #endif // __DOOMDEF__

View file

@ -31,15 +31,11 @@
// Selected by user. // Selected by user.
extern INT16 gamemap; extern INT16 gamemap;
extern char mapmusname[7];
// ----------------xxxxxxxxxxxxxxxx = music slot extern UINT16 mapmusflags;
// -xxxxxxxxxxxxxxx---------------- = track slot #define MUSIC_TRACKMASK 0x0FFF // ----************
// x------------------------------- = reset music bit #define MUSIC_RELOADRESET 0x8000 // *---------------
extern UINT32 mapmusic; // Use other bits if necessary.
#define MUSIC_TRACKSHIFT 16
#define MUSIC_SONGMASK 0x0000FFFF
#define MUSIC_TRACKMASK 0x7FFF0000
#define MUSIC_RELOADRESET 0x80000000
extern INT16 maptol; extern INT16 maptol;
extern UINT8 globalweather; extern UINT8 globalweather;
@ -146,11 +142,13 @@ typedef struct
UINT16 xcoord[8]; UINT16 xcoord[8];
UINT16 ycoord[8]; UINT16 ycoord[8];
UINT16 picduration[8]; UINT16 picduration[8];
UINT16 musicslot;
UINT8 musicloop; UINT8 musicloop;
UINT16 textxpos; UINT16 textxpos;
UINT16 textypos; UINT16 textypos;
char musswitch[7];
UINT16 musswitchflags;
UINT8 fadecolor; // Color number for fade, 0 means don't do the first fade UINT8 fadecolor; // Color number for fade, 0 means don't do the first fade
UINT8 fadeinid; // ID of the first fade, to a color -- ignored if fadecolor is 0 UINT8 fadeinid; // ID of the first fade, to a color -- ignored if fadecolor is 0
UINT8 fadeoutid; // ID of the second fade, to the new screen UINT8 fadeoutid; // ID of the second fade, to the new screen
@ -218,8 +216,8 @@ typedef struct
UINT8 actnum; ///< Act number or 0 for none. UINT8 actnum; ///< Act number or 0 for none.
UINT16 typeoflevel; ///< Combination of typeoflevel flags. UINT16 typeoflevel; ///< Combination of typeoflevel flags.
INT16 nextlevel; ///< Map number of next level, or 1100-1102 to end. INT16 nextlevel; ///< Map number of next level, or 1100-1102 to end.
UINT16 musicslot; ///< Music slot number to play. 0 for no music. char musname[7]; ///< Music track to play. "" for no music.
UINT16 musicslottrack; ///< Subsong to play. Only really relevant for music modules and specific formats supported by GME. 0 to ignore. UINT16 mustrack; ///< Subsong to play. Only really relevant for music modules and specific formats supported by GME. 0 to ignore.
char forcecharacter[17]; ///< (SKINNAMESIZE+1) Skin to switch to or "" to disable. char forcecharacter[17]; ///< (SKINNAMESIZE+1) Skin to switch to or "" to disable.
UINT8 weather; ///< 0 = sunny day, 1 = storm, 2 = snow, 3 = rain, 4 = blank, 5 = thunder w/o rain, 6 = rain w/o lightning, 7 = heat wave. UINT8 weather; ///< 0 = sunny day, 1 = storm, 2 = snow, 3 = rain, 4 = blank, 5 = thunder w/o rain, 6 = rain w/o lightning, 7 = heat wave.
INT16 skynum; ///< Sky number to use. INT16 skynum; ///< Sky number to use.

View file

@ -94,7 +94,6 @@ typedef long ssize_t;
#ifdef __APPLE_CC__ #ifdef __APPLE_CC__
#define DIRECTFULLSCREEN #define DIRECTFULLSCREEN
#define DEBUG_LOG #define DEBUG_LOG
#define HWRENDER
#define NOIPX #define NOIPX
#endif #endif

View file

@ -559,7 +559,7 @@ static void F_IntroDrawScene(void)
if (finalecount < 4) if (finalecount < 4)
S_StopMusic(); S_StopMusic();
if (finalecount == 4) if (finalecount == 4)
S_ChangeMusic(mus_stjr, false); S_ChangeMusicInternal("stjr", false);
x = (BASEVIDWIDTH<<FRACBITS)/2 - FixedMul(334<<FRACBITS, aspect)/2; x = (BASEVIDWIDTH<<FRACBITS)/2 - FixedMul(334<<FRACBITS, aspect)/2;
y = (BASEVIDHEIGHT<<FRACBITS)/2 - FixedMul(358<<FRACBITS, aspect)/2; y = (BASEVIDHEIGHT<<FRACBITS)/2 - FixedMul(358<<FRACBITS, aspect)/2;
V_DrawSciencePatch(x, y, 0, (patch = W_CachePatchName("WAHH1", PU_CACHE)), aspect); V_DrawSciencePatch(x, y, 0, (patch = W_CachePatchName("WAHH1", PU_CACHE)), aspect);
@ -771,7 +771,7 @@ void F_IntroDrawer(void)
F_RunWipe(99,true); F_RunWipe(99,true);
} }
S_ChangeMusic(mus_read_m, false); S_ChangeMusicInternal("read_m", false);
} }
else if (intro_scenenum == 3) else if (intro_scenenum == 3)
roidtics = BASEVIDWIDTH - 64; roidtics = BASEVIDWIDTH - 64;
@ -1126,7 +1126,7 @@ void F_StartCredits(void)
CON_ClearHUD(); CON_ClearHUD();
S_StopMusic(); S_StopMusic();
S_ChangeMusic(mus_credit, false); S_ChangeMusicInternal("credit", false);
finalecount = 0; finalecount = 0;
animtimer = 0; animtimer = 0;
@ -1423,7 +1423,7 @@ void F_StartTitleScreen(void)
// IWAD dependent stuff. // IWAD dependent stuff.
S_ChangeMusic(mus_titles, looptitle); S_ChangeMusicInternal("titles", looptitle);
animtimer = 0; animtimer = 0;
@ -1589,7 +1589,7 @@ void F_StartContinue(void)
// In case menus are still up?!! // In case menus are still up?!!
M_ClearMenus(true); M_ClearMenus(true);
S_ChangeMusic(mus_contsc, false); S_ChangeMusicInternal("contsc", false);
S_StopSounds(); S_StopSounds();
timetonext = TICRATE*11; timetonext = TICRATE*11;
@ -1703,8 +1703,10 @@ static void F_AdvanceToNextScene(void)
picxpos = cutscenes[cutnum]->scene[scenenum].xcoord[picnum]; picxpos = cutscenes[cutnum]->scene[scenenum].xcoord[picnum];
picypos = cutscenes[cutnum]->scene[scenenum].ycoord[picnum]; picypos = cutscenes[cutnum]->scene[scenenum].ycoord[picnum];
if (cutscenes[cutnum]->scene[scenenum].musicslot != 0) if (cutscenes[cutnum]->scene[scenenum].musswitch[0])
S_ChangeMusic(cutscenes[cutnum]->scene[scenenum].musicslot, cutscenes[cutnum]->scene[scenenum].musicloop); S_ChangeMusic(cutscenes[cutnum]->scene[scenenum].musswitch,
cutscenes[cutnum]->scene[scenenum].musswitchflags,
cutscenes[cutnum]->scene[scenenum].musicloop);
// Fade to the next // Fade to the next
dofadenow = true; dofadenow = true;
@ -1775,8 +1777,10 @@ void F_StartCustomCutscene(INT32 cutscenenum, boolean precutscene, boolean reset
animtimer = cutscenes[cutnum]->scene[0].picduration[0]; // Picture duration animtimer = cutscenes[cutnum]->scene[0].picduration[0]; // Picture duration
stoptimer = 0; stoptimer = 0;
if (cutscenes[cutnum]->scene[scenenum].musicslot != 0) if (cutscenes[cutnum]->scene[0].musswitch[0])
S_ChangeMusic(cutscenes[cutnum]->scene[scenenum].musicslot, cutscenes[cutnum]->scene[scenenum].musicloop); S_ChangeMusic(cutscenes[cutnum]->scene[0].musswitch,
cutscenes[cutnum]->scene[0].musswitchflags,
cutscenes[cutnum]->scene[0].musicloop);
else else
S_StopMusic(); S_StopMusic();
} }

View file

@ -69,8 +69,10 @@ static void G_DoStartContinue(void);
static void G_DoContinued(void); static void G_DoContinued(void);
static void G_DoWorldDone(void); static void G_DoWorldDone(void);
char mapmusname[7]; // Music name
UINT16 mapmusflags; // Track and reset bit
INT16 gamemap = 1; INT16 gamemap = 1;
UINT32 mapmusic; // music, track, and reset bit
INT16 maptol; INT16 maptol;
UINT8 globalweather = 0; UINT8 globalweather = 0;
INT32 curWeather = PRECIP_NONE; INT32 curWeather = PRECIP_NONE;
@ -2182,12 +2184,13 @@ void G_PlayerReborn(INT32 player)
if (p-players == consoleplayer) if (p-players == consoleplayer)
{ {
if (mapmusic & MUSIC_RELOADRESET) // TODO: Might not need this here if (mapmusflags & MUSIC_RELOADRESET)
{ {
mapmusic = mapheaderinfo[gamemap-1]->musicslot strncpy(mapmusname, mapheaderinfo[gamemap-1]->musname, 7);
| (mapheaderinfo[gamemap-1]->musicslottrack << MUSIC_TRACKSHIFT); mapmusname[6] = 0;
mapmusflags = mapheaderinfo[gamemap-1]->mustrack & MUSIC_TRACKMASK;
} }
S_ChangeMusic(mapmusic, true); S_ChangeMusic(mapmusname, mapmusflags, true);
} }
if (gametype == GT_COOP) if (gametype == GT_COOP)
@ -2328,6 +2331,11 @@ void G_SpawnPlayer(INT32 playernum, boolean starpost)
} }
} }
P_MovePlayerToSpawn(playernum, spawnpoint); P_MovePlayerToSpawn(playernum, spawnpoint);
#ifdef HAVE_BLUA
LUAh_PlayerSpawn(&players[playernum]); // Lua hook for player spawning :)
#endif
} }
mapthing_t *G_FindCTFStart(INT32 playernum) mapthing_t *G_FindCTFStart(INT32 playernum)
@ -2871,7 +2879,8 @@ static void G_DoCompleted(void)
// We are committed to this map now. // We are committed to this map now.
// We may as well allocate its header if it doesn't exist // We may as well allocate its header if it doesn't exist
if(!mapheaderinfo[nextmap]) // (That is, if it's a real map)
if (nextmap < NUMMAPS && !mapheaderinfo[nextmap])
P_AllocMapHeader(nextmap); P_AllocMapHeader(nextmap);
if (skipstats) if (skipstats)
@ -3521,7 +3530,7 @@ void G_InitNew(UINT8 pultmode, const char *mapname, boolean resetplayer, boolean
if (paused) if (paused)
{ {
paused = false; paused = false;
S_ResumeSound(); S_ResumeAudio();
} }
if (netgame || multiplayer) // Nice try, haxor. if (netgame || multiplayer) // Nice try, haxor.
@ -3595,7 +3604,7 @@ void G_InitNew(UINT8 pultmode, const char *mapname, boolean resetplayer, boolean
globalweather = mapheaderinfo[gamemap-1]->weather; globalweather = mapheaderinfo[gamemap-1]->weather;
// Don't carry over custom music change to another map. // Don't carry over custom music change to another map.
mapmusic |= MUSIC_RELOADRESET; mapmusflags |= MUSIC_RELOADRESET;
ultimatemode = pultmode; ultimatemode = pultmode;
playerdeadview = false; playerdeadview = false;

View file

@ -36,9 +36,7 @@ typedef struct
{ {
float x; float x;
float y; float y;
//#ifdef SLOPENESS
float z; float z;
//#endif
} polyvertex_t; } polyvertex_t;
#ifdef _MSC_VER #ifdef _MSC_VER

View file

@ -539,6 +539,8 @@ static void HWR_RenderPlane(sector_t *sector, extrasubsector_t *xsub, fixed_t fi
static FOutVector *planeVerts = NULL; static FOutVector *planeVerts = NULL;
static UINT16 numAllocedPlaneVerts = 0; static UINT16 numAllocedPlaneVerts = 0;
(void)sector;
// no convex poly were generated for this subsector // no convex poly were generated for this subsector
if (!xsub->planepoly) if (!xsub->planepoly)
return; return;
@ -678,25 +680,6 @@ static void HWR_RenderPlane(sector_t *sector, extrasubsector_t *xsub, fixed_t fi
v3d->x = pv->x; v3d->x = pv->x;
v3d->y = height; v3d->y = height;
v3d->z = pv->y; v3d->z = pv->y;
#ifdef SLOPENESS
if (sector && sector->special == 65535)
{
size_t q;
for (q = 0; q < sector->linecount; q++)
{
if (v3d->x == sector->lines[q]->v1->x>>FRACBITS)
{
if (v3d->z == sector->lines[q]->v1->y>>FRACBITS)
{
v3d->y += sector->lines[q]->v1->z>>FRACBITS;
break;
}
}
}
}
#else
(void)sector;
#endif
} }
// only useful for flat coloured triangles // only useful for flat coloured triangles

View file

@ -4569,7 +4569,6 @@ mobjinfo_t mobjinfo[NUMMOBJTYPES] =
S_NULL // raisestate S_NULL // raisestate
}, },
#ifdef BLUE_SPHERES
{ // MT_BLUEBALL { // MT_BLUEBALL
-1, // doomednum -1, // doomednum
S_BLUEBALL, // spawnstate S_BLUEBALL, // spawnstate
@ -4596,7 +4595,6 @@ mobjinfo_t mobjinfo[NUMMOBJTYPES] =
MF_SLIDEME|MF_SPECIAL|MF_NOGRAVITY|MF_NOCLIPHEIGHT, // flags MF_SLIDEME|MF_SPECIAL|MF_NOGRAVITY|MF_NOCLIPHEIGHT, // flags
S_NULL // raisestate S_NULL // raisestate
}, },
#endif
{ // MT_REDTEAMRING { // MT_REDTEAMRING
308, // doomednum 308, // doomednum

View file

@ -3049,9 +3049,7 @@ typedef enum mobj_type
// Collectible Items // Collectible Items
MT_RING, MT_RING,
MT_FLINGRING, // Lost ring MT_FLINGRING, // Lost ring
#ifdef BLUE_SPHERES
MT_BLUEBALL, // Blue sphere replacement for special stages MT_BLUEBALL, // Blue sphere replacement for special stages
#endif
MT_REDTEAMRING, //Rings collectable by red team. MT_REDTEAMRING, //Rings collectable by red team.
MT_BLUETEAMRING, //Rings collectable by blue team. MT_BLUETEAMRING, //Rings collectable by blue team.
MT_EMMY, // emerald token for special stage MT_EMMY, // emerald token for special stage

View file

@ -85,6 +85,14 @@ static int lib_print(lua_State *L)
return 0; return 0;
} }
static int lib_evalMath(lua_State *L)
{
const char *word = luaL_checkstring(L, 1);
LUA_Deprecated(L, "EvalMath(string)", "_G[string]");
lua_pushinteger(L, LUA_EvalMath(word));
return 1;
}
// M_RANDOM // M_RANDOM
////////////// //////////////
@ -1660,18 +1668,63 @@ static int lib_sStopSound(lua_State *L)
static int lib_sChangeMusic(lua_State *L) static int lib_sChangeMusic(lua_State *L)
{ {
UINT32 music_num = (UINT32)luaL_checkinteger(L, 1); #ifdef MUSICSLOT_COMPATIBILITY
const char *music_name;
UINT32 music_num;
char music_compat_name[7];
boolean looping;
player_t *player = NULL;
UINT16 music_flags = 0;
NOHUD
if (lua_isnumber(L, 1))
{
music_num = (UINT32)luaL_checkinteger(L, 1);
music_flags = (UINT16)(music_num & 0x0000FFFF);
if (music_flags && music_flags <= 1035)
snprintf(music_compat_name, 7, "%sM", G_BuildMapName((INT32)music_flags));
else if (music_flags && music_flags <= 1050)
strncpy(music_compat_name, compat_special_music_slots[music_flags - 1036], 7);
else
music_compat_name[0] = 0; // becomes empty string
music_compat_name[6] = 0;
music_name = (const char *)&music_compat_name;
music_flags = 0;
}
else
{
music_num = 0;
music_name = luaL_checkstring(L, 1);
}
looping = (boolean)lua_opttrueboolean(L, 2);
#else
const char *music_name = luaL_checkstring(L, 1);
boolean looping = (boolean)lua_opttrueboolean(L, 2); boolean looping = (boolean)lua_opttrueboolean(L, 2);
player_t *player = NULL; player_t *player = NULL;
UINT16 music_flags = 0;
NOHUD NOHUD
#endif
if (!lua_isnone(L, 3) && lua_isuserdata(L, 3)) if (!lua_isnone(L, 3) && lua_isuserdata(L, 3))
{ {
player = *((player_t **)luaL_checkudata(L, 3, META_PLAYER)); player = *((player_t **)luaL_checkudata(L, 3, META_PLAYER));
if (!player) if (!player)
return LUA_ErrInvalid(L, "player_t"); return LUA_ErrInvalid(L, "player_t");
} }
#ifdef MUSICSLOT_COMPATIBILITY
if (music_num)
music_flags = (UINT16)((music_num & 0x7FFF0000) >> 16);
else
#endif
music_flags = (UINT16)luaL_optinteger(L, 4, 0);
if (!player || P_IsLocalPlayer(player)) if (!player || P_IsLocalPlayer(player))
S_ChangeMusic(music_num, looping); S_ChangeMusic(music_name, music_flags, looping);
return 0; return 0;
} }
@ -1878,6 +1931,7 @@ static int lib_gTicsToMilliseconds(lua_State *L)
static luaL_Reg lib[] = { static luaL_Reg lib[] = {
{"print", lib_print}, {"print", lib_print},
{"EvalMath", lib_evalMath},
// m_random // m_random
{"P_Random",lib_pRandom}, {"P_Random",lib_pRandom},

View file

@ -42,6 +42,7 @@ enum hook {
hook_LinedefExecute, hook_LinedefExecute,
hook_PlayerMsg, hook_PlayerMsg,
hook_HurtMsg, hook_HurtMsg,
hook_PlayerSpawn,
hook_MAX // last hook hook_MAX // last hook
}; };
@ -75,5 +76,6 @@ boolean LUAh_BotAI(mobj_t *sonic, mobj_t *tails, ticcmd_t *cmd); // Hook for B_B
boolean LUAh_LinedefExecute(line_t *line, mobj_t *mo, sector_t *sector); // Hook for linedef executors boolean LUAh_LinedefExecute(line_t *line, mobj_t *mo, sector_t *sector); // Hook for linedef executors
boolean LUAh_PlayerMsg(int source, int target, int flags, char *msg); // Hook for chat messages boolean LUAh_PlayerMsg(int source, int target, int flags, char *msg); // Hook for chat messages
boolean LUAh_HurtMsg(player_t *player, mobj_t *inflictor, mobj_t *source); // Hook for hurt messages boolean LUAh_HurtMsg(player_t *player, mobj_t *inflictor, mobj_t *source); // Hook for hurt messages
#define LUAh_PlayerSpawn(player) LUAh_PlayerHook(player, hook_PlayerSpawn) // Hook for G_SpawnPlayer
#endif #endif

View file

@ -53,6 +53,7 @@ const char *const hookNames[hook_MAX+1] = {
"LinedefExecute", "LinedefExecute",
"PlayerMsg", "PlayerMsg",
"HurtMsg", "HurtMsg",
"PlayerSpawn",
NULL NULL
}; };
@ -768,4 +769,33 @@ boolean LUAh_HurtMsg(player_t *player, mobj_t *inflictor, mobj_t *source)
return hooked; return hooked;
} }
void LUAh_NetArchiveHook(lua_CFunction archFunc)
{
hook_p hookp;
if (!gL || !(hooksAvailable[hook_NetVars/8] & (1<<(hook_NetVars%8))))
return;
// stack: tables
I_Assert(lua_gettop(gL) > 0);
I_Assert(lua_istable(gL, -1));
// tables becomes an upvalue of archFunc
lua_pushvalue(gL, -1);
lua_pushcclosure(gL, archFunc, 1);
// stack: tables, archFunc
for (hookp = roothook; hookp; hookp = hookp->next)
if (hookp->type == hook_NetVars)
{
lua_pushfstring(gL, FMT_HOOKID, hookp->id);
lua_gettable(gL, LUA_REGISTRYINDEX);
lua_pushvalue(gL, -2); // archFunc
LUA_Call(gL, 1);
}
lua_pop(gL, 1); // pop archFunc
// stack: tables
}
#endif #endif

View file

@ -16,7 +16,9 @@
#include "r_local.h" #include "r_local.h"
#include "st_stuff.h" // hudinfo[] #include "st_stuff.h" // hudinfo[]
#include "g_game.h" #include "g_game.h"
#include "i_video.h" // rendermode
#include "p_local.h" // camera_t #include "p_local.h" // camera_t
#include "screen.h" // screen width/height
#include "v_video.h" #include "v_video.h"
#include "w_wad.h" #include "w_wad.h"
#include "z_zone.h" #include "z_zone.h"
@ -486,7 +488,7 @@ static int libd_getColormap(lua_State *L)
INT32 skinnum = TC_DEFAULT; INT32 skinnum = TC_DEFAULT;
skincolors_t color = luaL_optinteger(L, 2, 0); skincolors_t color = luaL_optinteger(L, 2, 0);
UINT8* colormap = NULL; UINT8* colormap = NULL;
//HUDSAFE HUDONLY
if (lua_isnoneornil(L, 1)) if (lua_isnoneornil(L, 1))
; // defaults to TC_DEFAULT ; // defaults to TC_DEFAULT
else if (lua_type(L, 1) == LUA_TNUMBER) // skin number else if (lua_type(L, 1) == LUA_TNUMBER) // skin number
@ -510,6 +512,31 @@ static int libd_getColormap(lua_State *L)
return 1; return 1;
} }
static int libd_width(lua_State *L)
{
HUDONLY
lua_pushinteger(L, vid.width); // push screen width
return 1;
}
static int libd_height(lua_State *L)
{
HUDONLY
lua_pushinteger(L, vid.height); // push screen height
return 1;
}
static int libd_renderer(lua_State *L)
{
HUDONLY
switch (rendermode) {
case render_opengl: lua_pushliteral(L, "opengl"); break; // OpenGL renderer
case render_soft: lua_pushliteral(L, "software"); break; // Software renderer
default: lua_pushliteral(L, "none"); break; // render_none (for dedicated), in case there's any reason this should be run
}
return 1;
}
static luaL_Reg lib_draw[] = { static luaL_Reg lib_draw[] = {
{"patchExists", libd_patchExists}, {"patchExists", libd_patchExists},
{"cachePatch", libd_cachePatch}, {"cachePatch", libd_cachePatch},
@ -521,6 +548,9 @@ static luaL_Reg lib_draw[] = {
{"drawString", libd_drawString}, {"drawString", libd_drawString},
{"stringWidth", libd_stringWidth}, {"stringWidth", libd_stringWidth},
{"getColormap", libd_getColormap}, {"getColormap", libd_getColormap},
{"width", libd_width},
{"height", libd_height},
{"renderer", libd_renderer},
{NULL, NULL} {NULL, NULL}
}; };

View file

@ -42,6 +42,7 @@ extern lua_State *gL;
#define META_CVAR "CONSVAR_T*" #define META_CVAR "CONSVAR_T*"
#define META_SECTORLINES "SECTOR_T*LINES"
#define META_SIDENUM "LINE_T*SIDENUM" #define META_SIDENUM "LINE_T*SIDENUM"
#define META_HUDINFO "HUDINFO_T*" #define META_HUDINFO "HUDINFO_T*"

View file

@ -37,6 +37,7 @@ enum sector_e {
sector_thinglist, sector_thinglist,
sector_heightsec, sector_heightsec,
sector_camsec, sector_camsec,
sector_lines,
sector_ffloors sector_ffloors
}; };
@ -52,6 +53,7 @@ static const char *const sector_opt[] = {
"thinglist", "thinglist",
"heightsec", "heightsec",
"camsec", "camsec",
"lines",
"ffloors", "ffloors",
NULL}; NULL};
@ -260,6 +262,67 @@ static int sector_iterate(lua_State *L)
return 3; return 3;
} }
// sector.lines, i -> sector.lines[i]
// sector.lines.valid, for validity checking
static int sectorlines_get(lua_State *L)
{
line_t **seclines = *((line_t ***)luaL_checkudata(L, 1, META_SECTORLINES));
size_t i;
size_t numoflines = 0;
lua_settop(L, 2);
if (!lua_isnumber(L, 2))
{
int field = luaL_checkoption(L, 2, NULL, valid_opt);
if (!seclines)
{
if (field == 0) {
lua_pushboolean(L, 0);
return 1;
}
return luaL_error(L, "accessed sector_t doesn't exist anymore.");
} else if (field == 0) {
lua_pushboolean(L, 1);
return 1;
}
}
// check first linedef to figure which of its sectors owns this sector->lines pointer
// then check that sector's linecount to get a maximum index
//if (!seclines[0])
//return luaL_error(L, "no lines found!"); // no first linedef?????
if (seclines[0]->frontsector->lines == seclines)
numoflines = seclines[0]->frontsector->linecount;
else if (seclines[0]->backsector && seclines[0]->backsector->lines == seclines) // check backsector exists first
numoflines = seclines[0]->backsector->linecount;
//if neither sector has it then ???
if (!numoflines)
return luaL_error(L, "no lines found!");
i = (size_t)lua_tointeger(L, 2);
if (i >= numoflines)
return 0;
LUA_PushUserdata(L, seclines[i], META_LINE);
return 1;
}
static int sectorlines_num(lua_State *L)
{
line_t **seclines = *((line_t ***)luaL_checkudata(L, 1, META_SECTORLINES));
size_t numoflines = 0;
// check first linedef to figure which of its sectors owns this sector->lines pointer
// then check that sector's linecount to get a maximum index
//if (!seclines[0])
//return luaL_error(L, "no lines found!"); // no first linedef?????
if (seclines[0]->frontsector->lines == seclines)
numoflines = seclines[0]->frontsector->linecount;
else if (seclines[0]->backsector && seclines[0]->backsector->lines == seclines) // check backsector exists first
numoflines = seclines[0]->backsector->linecount;
//if neither sector has it then ???
lua_pushinteger(L, numoflines);
return 1;
}
static int sector_get(lua_State *L) static int sector_get(lua_State *L)
{ {
sector_t *sector = *((sector_t **)luaL_checkudata(L, 1, META_SECTOR)); sector_t *sector = *((sector_t **)luaL_checkudata(L, 1, META_SECTOR));
@ -325,6 +388,9 @@ static int sector_get(lua_State *L)
return 0; return 0;
LUA_PushUserdata(L, &sectors[sector->camsec], META_SECTOR); LUA_PushUserdata(L, &sectors[sector->camsec], META_SECTOR);
return 1; return 1;
case sector_lines: // lines
LUA_PushUserdata(L, sector->lines, META_SECTORLINES);
return 1;
case sector_ffloors: // ffloors case sector_ffloors: // ffloors
lua_pushcfunction(L, lib_iterateSectorFFloors); lua_pushcfunction(L, lib_iterateSectorFFloors);
LUA_PushUserdata(L, sector->ffloors, META_FFLOOR); LUA_PushUserdata(L, sector->ffloors, META_FFLOOR);
@ -1172,10 +1238,10 @@ static int mapheaderinfo_get(lua_State *L)
lua_pushinteger(L, header->typeoflevel); lua_pushinteger(L, header->typeoflevel);
else if (fastcmp(field,"nextlevel")) else if (fastcmp(field,"nextlevel"))
lua_pushinteger(L, header->nextlevel); lua_pushinteger(L, header->nextlevel);
else if (fastcmp(field,"musicslot")) else if (fastcmp(field,"musname"))
lua_pushinteger(L, header->musicslot); lua_pushstring(L, header->musname);
else if (fastcmp(field,"musicslottrack")) else if (fastcmp(field,"mustrack"))
lua_pushinteger(L, header->musicslottrack); lua_pushinteger(L, header->mustrack);
else if (fastcmp(field,"forcecharacter")) else if (fastcmp(field,"forcecharacter"))
lua_pushstring(L, header->forcecharacter); lua_pushstring(L, header->forcecharacter);
else if (fastcmp(field,"weather")) else if (fastcmp(field,"weather"))
@ -1234,6 +1300,14 @@ static int mapheaderinfo_get(lua_State *L)
int LUA_MapLib(lua_State *L) int LUA_MapLib(lua_State *L)
{ {
luaL_newmetatable(L, META_SECTORLINES);
lua_pushcfunction(L, sectorlines_get);
lua_setfield(L, -2, "__index");
lua_pushcfunction(L, sectorlines_num);
lua_setfield(L, -2, "__len");
lua_pop(L, 1);
luaL_newmetatable(L, META_SECTOR); luaL_newmetatable(L, META_SECTOR);
lua_pushcfunction(L, sector_get); lua_pushcfunction(L, sector_get);
lua_setfield(L, -2, "__index"); lua_setfield(L, -2, "__index");

View file

@ -915,30 +915,6 @@ static void UnArchiveTables(void)
} }
} }
static void NetArchiveHook(lua_CFunction archFunc)
{
int TABLESINDEX;
if (!gL)
return;
TABLESINDEX = lua_gettop(gL);
lua_getfield(gL, LUA_REGISTRYINDEX, "hook");
I_Assert(lua_istable(gL, -1));
lua_rawgeti(gL, -1, hook_NetVars);
lua_remove(gL, -2);
I_Assert(lua_istable(gL, -1));
lua_pushvalue(gL, TABLESINDEX);
lua_pushcclosure(gL, archFunc, 1);
lua_pushnil(gL);
while (lua_next(gL, -3) != 0) {
lua_pushvalue(gL, -3); // function
LUA_Call(gL, 1);
}
lua_pop(gL, 2);
}
void LUA_Step(void) void LUA_Step(void)
{ {
if (!gL) if (!gL)
@ -972,7 +948,7 @@ void LUA_Archive(void)
} }
WRITEUINT32(save_p, UINT32_MAX); // end of mobjs marker, replaces mobjnum. WRITEUINT32(save_p, UINT32_MAX); // end of mobjs marker, replaces mobjnum.
NetArchiveHook(NetArchive); // call the NetArchive hook in archive mode LUAh_NetArchiveHook(NetArchive); // call the NetArchive hook in archive mode
ArchiveTables(); ArchiveTables();
if (gL) if (gL)
@ -1003,7 +979,7 @@ void LUA_UnArchive(void)
UnArchiveExtVars(th); // apply variables UnArchiveExtVars(th); // apply variables
} while(mobjnum != UINT32_MAX); // repeat until end of mobjs marker. } while(mobjnum != UINT32_MAX); // repeat until end of mobjs marker.
NetArchiveHook(NetUnArchive); // call the NetArchive hook in unarchive mode LUAh_NetArchiveHook(NetUnArchive); // call the NetArchive hook in unarchive mode
UnArchiveTables(); UnArchiveTables();
if (gL) if (gL)

View file

@ -30,9 +30,9 @@
#define lua_pushfixed(L, f) lua_pushinteger(L, f) #define lua_pushfixed(L, f) lua_pushinteger(L, f)
// angle_t casting // angle_t casting
// we reduce the angle to a fixed point between 0.0 and 1.0 // TODO deal with signedness
#define luaL_checkangle(L, i) (((angle_t)(luaL_checkfixed(L, i)&0xFFFF))<<16) #define luaL_checkangle(L, i) ((angle_t)luaL_checkinteger(L, i))
#define lua_pushangle(L, a) lua_pushfixed(L, a>>16) #define lua_pushangle(L, a) lua_pushinteger(L, a)
#ifdef _DEBUG #ifdef _DEBUG
void LUA_ClearExtVars(void); void LUA_ClearExtVars(void);
@ -55,6 +55,7 @@ void Got_Luacmd(UINT8 **cp, INT32 playernum); // lua_consolelib.c
void LUA_CVarChanged(const char *name); // lua_consolelib.c void LUA_CVarChanged(const char *name); // lua_consolelib.c
int Lua_optoption(lua_State *L, int narg, int Lua_optoption(lua_State *L, int narg,
const char *def, const char *const lst[]); const char *def, const char *const lst[]);
void LUAh_NetArchiveHook(lua_CFunction archFunc);
// Console wrapper // Console wrapper
void COM_Lua_f(void); void COM_Lua_f(void);
@ -69,4 +70,15 @@ void COM_Lua_f(void);
#define LUA_ErrInvalid(L, type) luaL_error(L, "accessed " type " doesn't exist anymore, please check 'valid' before using " type "."); #define LUA_ErrInvalid(L, type) luaL_error(L, "accessed " type " doesn't exist anymore, please check 'valid' before using " type ".");
// Deprecation warnings
// Shows once upon use. Then doesn't show again.
#define LUA_Deprecated(L,this_func,use_instead)\
{\
static UINT8 seen = 0;\
if (!seen) {\
seen = 1;\
CONS_Alert(CONS_WARNING,"\"%s\" is deprecated and will be removed.\nUse \"%s\" instead.\n", this_func, use_instead);\
}\
}
#endif #endif

View file

@ -4751,7 +4751,7 @@ static void M_SetupChoosePlayer(INT32 choice)
if (Playing() == false) if (Playing() == false)
{ {
S_StopMusic(); S_StopMusic();
S_ChangeMusic(mus_chrsel, true); S_ChangeMusicInternal("chrsel", true);
} }
SP_PlayerDef.prevMenu = currentMenu; SP_PlayerDef.prevMenu = currentMenu;
@ -5202,7 +5202,7 @@ void M_DrawTimeAttackMenu(void)
lumpnum_t lumpnum; lumpnum_t lumpnum;
char beststr[40]; char beststr[40];
S_ChangeMusic(mus_racent, true); // Eww, but needed for when user hits escape during demo playback S_ChangeMusicInternal("racent", true); // Eww, but needed for when user hits escape during demo playback
V_DrawPatchFill(W_CachePatchName("SRB2BACK", PU_CACHE)); V_DrawPatchFill(W_CachePatchName("SRB2BACK", PU_CACHE));
@ -5365,7 +5365,7 @@ static void M_TimeAttack(INT32 choice)
itemOn = tastart; // "Start" is selected. itemOn = tastart; // "Start" is selected.
G_SetGamestate(GS_TIMEATTACK); G_SetGamestate(GS_TIMEATTACK);
S_ChangeMusic(mus_racent, true); S_ChangeMusicInternal("racent", true);
} }
// Drawing function for Nights Attack // Drawing function for Nights Attack
@ -5375,7 +5375,7 @@ void M_DrawNightsAttackMenu(void)
lumpnum_t lumpnum; lumpnum_t lumpnum;
char beststr[40]; char beststr[40];
S_ChangeMusic(mus_racent, true); // Eww, but needed for when user hits escape during demo playback S_ChangeMusicInternal("racent", true); // Eww, but needed for when user hits escape during demo playback
V_DrawPatchFill(W_CachePatchName("SRB2BACK", PU_CACHE)); V_DrawPatchFill(W_CachePatchName("SRB2BACK", PU_CACHE));
@ -5498,7 +5498,7 @@ static void M_NightsAttack(INT32 choice)
itemOn = nastart; // "Start" is selected. itemOn = nastart; // "Start" is selected.
G_SetGamestate(GS_TIMEATTACK); G_SetGamestate(GS_TIMEATTACK);
S_ChangeMusic(mus_racent, true); S_ChangeMusicInternal("racent", true);
} }
// Player has selected the "START" from the nights attack screen // Player has selected the "START" from the nights attack screen
@ -5732,7 +5732,7 @@ static void M_ModeAttackEndGame(INT32 choice)
itemOn = currentMenu->lastOn; itemOn = currentMenu->lastOn;
G_SetGamestate(GS_TIMEATTACK); G_SetGamestate(GS_TIMEATTACK);
modeattacking = ATTACKING_NONE; modeattacking = ATTACKING_NONE;
S_ChangeMusic(mus_racent, true); S_ChangeMusicInternal("racent", true);
// Update replay availability. // Update replay availability.
CV_AddValue(&cv_nextmap, 1); CV_AddValue(&cv_nextmap, 1);
CV_AddValue(&cv_nextmap, -1); CV_AddValue(&cv_nextmap, -1);
@ -6944,7 +6944,7 @@ static void M_ToggleDigital(void)
if (nodigimusic) return; if (nodigimusic) return;
S_Init(cv_soundvolume.value, cv_digmusicvolume.value, cv_midimusicvolume.value); S_Init(cv_soundvolume.value, cv_digmusicvolume.value, cv_midimusicvolume.value);
S_StopMusic(); S_StopMusic();
S_ChangeMusic(mus_lclear, false); S_ChangeMusicInternal("lclear", false);
M_StartMessage(M_GetText("Digital Music Enabled\n"), NULL, MM_NOTHING); M_StartMessage(M_GetText("Digital Music Enabled\n"), NULL, MM_NOTHING);
} }
else else
@ -6971,7 +6971,7 @@ static void M_ToggleMIDI(void)
I_InitMIDIMusic(); I_InitMIDIMusic();
if (nomidimusic) return; if (nomidimusic) return;
S_Init(cv_soundvolume.value, cv_digmusicvolume.value, cv_midimusicvolume.value); S_Init(cv_soundvolume.value, cv_digmusicvolume.value, cv_midimusicvolume.value);
S_ChangeMusic(mus_lclear, false); S_ChangeMusicInternal("lclear", false);
M_StartMessage(M_GetText("MIDI Music Enabled\n"), NULL, MM_NOTHING); M_StartMessage(M_GetText("MIDI Music Enabled\n"), NULL, MM_NOTHING);
} }
else else

View file

@ -36,7 +36,7 @@
#include <stdlib.h> #include <stdlib.h>
#else #else
#ifndef HAVE_MEMCPY #ifndef HAVE_MEMCPY
#if !((defined (_WIN32) || defined (_WIN32_WCE)) && !defined (__CYGWIN__)) #if !((defined (_WIN32) || defined (_WIN32_WCE)) && !defined (__CYGWIN__)) && !defined (__APPLE__)
#define memcpy(d, s, n) bcopy ((s), (d), (n)) #define memcpy(d, s, n) bcopy ((s), (d), (n))
#endif #endif
#endif #endif

View file

@ -3063,12 +3063,8 @@ void A_Invincibility(mobj_t *actor)
{ {
S_StopMusic(); S_StopMusic();
if (mariomode) if (mariomode)
{
S_ChangeMusic(mus_minvnc, false);
G_GhostAddColor(GHC_INVINCIBLE); G_GhostAddColor(GHC_INVINCIBLE);
} S_ChangeMusicInternal((mariomode) ? "minvnc" : "invinc", false);
else
S_ChangeMusic(mus_invinc, false);
} }
} }
@ -3104,7 +3100,7 @@ void A_SuperSneakers(mobj_t *actor)
else else
{ {
S_StopMusic(); S_StopMusic();
S_ChangeMusic(mus_shoes, false); S_ChangeMusicInternal("shoes", false);
} }
} }
} }
@ -7227,7 +7223,7 @@ void A_ChangeAngleAbsolute(mobj_t *actor)
//const angle_t amin = FixedAngle(locvar1*FRACUNIT); //const angle_t amin = FixedAngle(locvar1*FRACUNIT);
//const angle_t amax = FixedAngle(locvar2*FRACUNIT); //const angle_t amax = FixedAngle(locvar2*FRACUNIT);
#ifdef HAVE_BLUA #ifdef HAVE_BLUA
if (LUA_CallAction("A_ChangeAngelAbsolute", actor)) if (LUA_CallAction("A_ChangeAngleAbsolute", actor))
return; return;
#endif #endif

View file

@ -1973,71 +1973,51 @@ void T_NoEnemiesSector(levelspecthink_t *nobaddies)
{ {
size_t i; size_t i;
fixed_t upperbound, lowerbound; fixed_t upperbound, lowerbound;
sector_t *sec = NULL; INT32 s;
sector_t *targetsec = NULL; sector_t *checksector;
INT32 secnum = -1;
msecnode_t *node; msecnode_t *node;
mobj_t *thing; mobj_t *thing;
boolean FOFsector = false; boolean exists = false;
while ((secnum = P_FindSectorFromLineTag(nobaddies->sourceline, secnum)) >= 0) for (i = 0; i < nobaddies->sector->linecount; i++)
{ {
sec = &sectors[secnum]; if (nobaddies->sector->lines[i]->special == 223)
FOFsector = false;
// Check the lines of this sector, to see if it is a FOF control sector.
for (i = 0; i < sec->linecount; i++)
{ {
INT32 targetsecnum = -1;
if (sec->lines[i]->special < 100 || sec->lines[i]->special >= 300) upperbound = nobaddies->sector->ceilingheight;
continue; lowerbound = nobaddies->sector->floorheight;
FOFsector = true; for (s = -1; (s = P_FindSectorFromLineTag(nobaddies->sector->lines[i], s)) >= 0 ;)
while ((targetsecnum = P_FindSectorFromLineTag(sec->lines[i], targetsecnum)) >= 0)
{ {
targetsec = &sectors[targetsecnum]; checksector = &sectors[s];
upperbound = targetsec->ceilingheight; node = checksector->touching_thinglist; // things touching this sector
lowerbound = targetsec->floorheight;
node = targetsec->touching_thinglist; // things touching this sector
while (node) while (node)
{ {
thing = node->m_thing; thing = node->m_thing;
if ((thing->flags & (MF_ENEMY|MF_BOSS)) && thing->health > 0 if ((thing->flags & (MF_ENEMY|MF_BOSS)) && thing->health > 0
&& thing->z < upperbound && thing->z+thing->height > lowerbound) && thing->z < upperbound && thing->z+thing->height > lowerbound)
return; {
exists = true;
goto foundenemy;
}
node = node->m_snext; node = node->m_snext;
} }
} }
} }
if (!FOFsector)
{
upperbound = sec->ceilingheight;
lowerbound = sec->floorheight;
node = sec->touching_thinglist; // things touching this sector
while (node)
{
thing = node->m_thing;
if ((thing->flags & (MF_ENEMY|MF_BOSS)) && thing->health > 0
&& thing->z < upperbound && thing->z+thing->height > lowerbound)
return;
node = node->m_snext;
}
}
} }
foundenemy:
if (exists)
return;
CONS_Debug(DBG_GAMELOGIC, "Running no-more-enemies exec with tag of %d\n", nobaddies->sourceline->tag); s = P_AproxDistance(nobaddies->sourceline->dx, nobaddies->sourceline->dy)>>FRACBITS;
// No enemies found, run the linedef exec and terminate this thinker CONS_Debug(DBG_GAMELOGIC, "Running no-more-enemies exec with tag of %d\n", s);
P_RunTriggerLinedef(nobaddies->sourceline, NULL, NULL);
// Otherwise, run the linedef exec and terminate this thinker
P_LinedefExecute((INT16)s, NULL, NULL);
P_RemoveThinker(&nobaddies->thinker); P_RemoveThinker(&nobaddies->thinker);
} }

View file

@ -405,7 +405,6 @@ void P_TouchSpecialThing(mobj_t *special, mobj_t *toucher, boolean heightcheck)
if ((maptol & TOL_NIGHTS) && special->type != MT_FLINGCOIN) if ((maptol & TOL_NIGHTS) && special->type != MT_FLINGCOIN)
P_DoNightsScore(player); P_DoNightsScore(player);
break; break;
#ifdef BLUE_SPHERES
case MT_BLUEBALL: case MT_BLUEBALL:
if (!(P_CanPickupItem(player, false))) if (!(P_CanPickupItem(player, false)))
return; return;
@ -422,7 +421,6 @@ void P_TouchSpecialThing(mobj_t *special, mobj_t *toucher, boolean heightcheck)
if (maptol & TOL_NIGHTS) if (maptol & TOL_NIGHTS)
P_DoNightsScore(player); P_DoNightsScore(player);
break; break;
#endif
case MT_AUTOPICKUP: case MT_AUTOPICKUP:
case MT_BOUNCEPICKUP: case MT_BOUNCEPICKUP:
case MT_SCATTERPICKUP: case MT_SCATTERPICKUP:
@ -766,10 +764,7 @@ void P_TouchSpecialThing(mobj_t *special, mobj_t *toucher, boolean heightcheck)
} }
if (!(mo2->type == MT_NIGHTSWING || mo2->type == MT_RING || mo2->type == MT_COIN if (!(mo2->type == MT_NIGHTSWING || mo2->type == MT_RING || mo2->type == MT_COIN
#ifdef BLUE_SPHERES || mo2->type == MT_BLUEBALL))
|| mo2->type == MT_BLUEBALL
#endif
))
continue; continue;
// Yay! The thing's in reach! Pull it in! // Yay! The thing's in reach! Pull it in!
@ -2076,7 +2071,7 @@ void P_KillMobj(mobj_t *target, mobj_t *inflictor, mobj_t *source)
if (P_IsLocalPlayer(target->player) && target->player == &players[consoleplayer]) if (P_IsLocalPlayer(target->player) && target->player == &players[consoleplayer])
{ {
S_StopMusic(); // Stop the Music! Tails 03-14-2000 S_StopMusic(); // Stop the Music! Tails 03-14-2000
S_ChangeMusic(mus_gmover, false); // Yousa dead now, Okieday? Tails 03-14-2000 S_ChangeMusicInternal("gmover", false); // Yousa dead now, Okieday? Tails 03-14-2000
} }
} }
} }
@ -2464,7 +2459,7 @@ static inline void P_NiGHTSDamage(mobj_t *target, mobj_t *source)
&& player->nightstime < 10*TICRATE) && player->nightstime < 10*TICRATE)
{ {
//S_StartSound(NULL, sfx_timeup); // that creepy "out of time" music from NiGHTS. Dummied out, as some on the dev team thought it wasn't Sonic-y enough (Mystic, notably). Uncomment to restore. -SH //S_StartSound(NULL, sfx_timeup); // that creepy "out of time" music from NiGHTS. Dummied out, as some on the dev team thought it wasn't Sonic-y enough (Mystic, notably). Uncomment to restore. -SH
S_ChangeMusic(mus_drown,false); S_ChangeMusicInternal("drown",false);
} }
} }
} }

View file

@ -2188,9 +2188,7 @@ static boolean P_ZMovement(mobj_t *mo)
case MT_RING: // Ignore still rings case MT_RING: // Ignore still rings
case MT_COIN: case MT_COIN:
#ifdef BLUE_SPHERES
case MT_BLUEBALL: case MT_BLUEBALL:
#endif
case MT_REDTEAMRING: case MT_REDTEAMRING:
case MT_BLUETEAMRING: case MT_BLUETEAMRING:
case MT_FLINGRING: case MT_FLINGRING:
@ -6083,7 +6081,8 @@ void P_MobjThinker(mobj_t *mobj)
if (mobj->tracer && P_MobjWasRemoved(mobj->tracer)) if (mobj->tracer && P_MobjWasRemoved(mobj->tracer))
P_SetTarget(&mobj->tracer, NULL); P_SetTarget(&mobj->tracer, NULL);
mobj->eflags &= ~(MFE_PUSHED|MFE_SPRUNG); mobj->flags2 &= ~MF2_PUSHED;
mobj->eflags &= ~MFE_SPRUNG;
tmfloorthing = tmhitthing = NULL; tmfloorthing = tmhitthing = NULL;
@ -6478,14 +6477,12 @@ void P_MobjThinker(mobj_t *mobj)
else if (mobj->health <= 0) // Dead things think differently than the living. else if (mobj->health <= 0) // Dead things think differently than the living.
switch (mobj->type) switch (mobj->type)
{ {
#ifdef BLUE_SPHERES
case MT_BLUEBALL: case MT_BLUEBALL:
if ((mobj->tics>>2)+1 > 0 && (mobj->tics>>2)+1 <= tr_trans60) // tr_trans50 through tr_trans90, shifting once every second frame if ((mobj->tics>>2)+1 > 0 && (mobj->tics>>2)+1 <= tr_trans60) // tr_trans50 through tr_trans90, shifting once every second frame
mobj->frame = (NUMTRANSMAPS-((mobj->tics>>2)+1))<<FF_TRANSSHIFT; mobj->frame = (NUMTRANSMAPS-((mobj->tics>>2)+1))<<FF_TRANSSHIFT;
else // tr_trans60 otherwise else // tr_trans60 otherwise
mobj->frame = tr_trans60<<FF_TRANSSHIFT; mobj->frame = tr_trans60<<FF_TRANSSHIFT;
break; break;
#endif
case MT_EGGCAPSULE: case MT_EGGCAPSULE:
if (mobj->z <= mobj->floorz) if (mobj->z <= mobj->floorz)
{ {
@ -6943,9 +6940,7 @@ void P_MobjThinker(mobj_t *mobj)
break; break;
case MT_RING: case MT_RING:
case MT_COIN: case MT_COIN:
#ifdef BLUE_SPHERES
case MT_BLUEBALL: case MT_BLUEBALL:
#endif
case MT_REDTEAMRING: case MT_REDTEAMRING:
case MT_BLUETEAMRING: case MT_BLUETEAMRING:
// No need to check water. Who cares? // No need to check water. Who cares?
@ -7711,9 +7706,7 @@ mobj_t *P_SpawnMobj(fixed_t x, fixed_t y, fixed_t z, mobjtype_t type)
break; break;
case MT_RING: case MT_RING:
case MT_COIN: case MT_COIN:
#ifdef BLUE_SPHERES
case MT_BLUEBALL: case MT_BLUEBALL:
#endif
nummaprings++; nummaprings++;
default: default:
break; break;
@ -7839,9 +7832,7 @@ void P_RemoveMobj(mobj_t *mobj)
if (mobj->spawnpoint && if (mobj->spawnpoint &&
(mobj->type == MT_RING (mobj->type == MT_RING
|| mobj->type == MT_COIN || mobj->type == MT_COIN
#ifdef BLUE_SPHERES
|| mobj->type == MT_BLUEBALL || mobj->type == MT_BLUEBALL
#endif
|| mobj->type == MT_REDTEAMRING || mobj->type == MT_REDTEAMRING
|| mobj->type == MT_BLUETEAMRING || mobj->type == MT_BLUETEAMRING
|| P_WeaponOrPanel(mobj->type)) || P_WeaponOrPanel(mobj->type))
@ -9627,11 +9618,9 @@ void P_SpawnHoopsAndRings(mapthing_t *mthing)
ringthing = (gametype == GT_CTF) ? MT_BLUETEAMRING : MT_RING; ringthing = (gametype == GT_CTF) ? MT_BLUETEAMRING : MT_RING;
break; break;
default: default:
#ifdef BLUE_SPHERES
// Spawn rings as blue spheres in special stages, ala S3+K. // Spawn rings as blue spheres in special stages, ala S3+K.
if (G_IsSpecialStage(gamemap) && useNightsSS) if (G_IsSpecialStage(gamemap) && useNightsSS)
ringthing = MT_BLUEBALL; ringthing = MT_BLUEBALL;
#endif
break; break;
} }
@ -9696,11 +9685,9 @@ void P_SpawnHoopsAndRings(mapthing_t *mthing)
if (ultimatemode && !(G_IsSpecialStage(gamemap) || maptol & TOL_NIGHTS)) if (ultimatemode && !(G_IsSpecialStage(gamemap) || maptol & TOL_NIGHTS))
return; return;
#ifdef BLUE_SPHERES
// Spawn rings as blue spheres in special stages, ala S3+K. // Spawn rings as blue spheres in special stages, ala S3+K.
if (G_IsSpecialStage(gamemap) && useNightsSS) if (G_IsSpecialStage(gamemap) && useNightsSS)
ringthing = MT_BLUEBALL; ringthing = MT_BLUEBALL;
#endif
for (r = 1; r <= 5; r++) for (r = 1; r <= 5; r++)
{ {
@ -9751,11 +9738,9 @@ void P_SpawnHoopsAndRings(mapthing_t *mthing)
if (ultimatemode && !(G_IsSpecialStage(gamemap) || maptol & TOL_NIGHTS)) if (ultimatemode && !(G_IsSpecialStage(gamemap) || maptol & TOL_NIGHTS))
return; return;
#ifdef BLUE_SPHERES
// Spawn rings as blue spheres in special stages, ala S3+K. // Spawn rings as blue spheres in special stages, ala S3+K.
if (G_IsSpecialStage(gamemap) && useNightsSS) if (G_IsSpecialStage(gamemap) && useNightsSS)
ringthing = MT_BLUEBALL; ringthing = MT_BLUEBALL;
#endif
angle >>= ANGLETOFINESHIFT; angle >>= ANGLETOFINESHIFT;
@ -9848,11 +9833,9 @@ void P_SpawnHoopsAndRings(mapthing_t *mthing)
if (ultimatemode && !(G_IsSpecialStage(gamemap) || (maptol & TOL_NIGHTS))) if (ultimatemode && !(G_IsSpecialStage(gamemap) || (maptol & TOL_NIGHTS)))
continue; continue;
#ifdef BLUE_SPHERES
// Spawn rings as blue spheres in special stages, ala S3+K. // Spawn rings as blue spheres in special stages, ala S3+K.
if (G_IsSpecialStage(gamemap) && useNightsSS) if (G_IsSpecialStage(gamemap) && useNightsSS)
itemToSpawn = MT_BLUEBALL; itemToSpawn = MT_BLUEBALL;
#endif
} }
fa = i*FINEANGLES/numitems; fa = i*FINEANGLES/numitems;

View file

@ -175,23 +175,24 @@ typedef enum
MF2_EXPLOSION = 1<<7, // Thrown ring has explosive properties MF2_EXPLOSION = 1<<7, // Thrown ring has explosive properties
MF2_SCATTER = 1<<8, // Thrown ring has scatter properties MF2_SCATTER = 1<<8, // Thrown ring has scatter properties
MF2_BEYONDTHEGRAVE = 1<<9, // Source of this missile has died and has since respawned. MF2_BEYONDTHEGRAVE = 1<<9, // Source of this missile has died and has since respawned.
MF2_SLIDEPUSH = 1<<10, // MF_PUSHABLE that pushes continuously. MF2_PUSHED = 1<<10, // Mobj was already pushed this tic
MF2_CLASSICPUSH = 1<<11, // Drops straight down when object has negative Z. MF2_SLIDEPUSH = 1<<11, // MF_PUSHABLE that pushes continuously.
MF2_STANDONME = 1<<12, // While not pushable, stand on me anyway. MF2_CLASSICPUSH = 1<<12, // Drops straight down when object has negative Z.
MF2_INFLOAT = 1<<13, // Floating to a height for a move, don't auto float to target's height. MF2_STANDONME = 1<<13, // While not pushable, stand on me anyway.
MF2_DEBRIS = 1<<14, // Splash ring from explosion ring MF2_INFLOAT = 1<<14, // Floating to a height for a move, don't auto float to target's height.
MF2_NIGHTSPULL = 1<<15, // Attracted from a paraloop MF2_DEBRIS = 1<<15, // Splash ring from explosion ring
MF2_JUSTATTACKED = 1<<16, // can be pushed by other moving mobjs MF2_NIGHTSPULL = 1<<16, // Attracted from a paraloop
MF2_FIRING = 1<<17, // turret fire MF2_JUSTATTACKED = 1<<17, // can be pushed by other moving mobjs
MF2_SUPERFIRE = 1<<18, // Firing something with Super Sonic-stopping properties. Or, if mobj has MF_MISSILE, this is the actual fire from it. MF2_FIRING = 1<<18, // turret fire
MF2_SHADOW = 1<<19, // Fuzzy draw, makes targeting harder. MF2_SUPERFIRE = 1<<19, // Firing something with Super Sonic-stopping properties. Or, if mobj has MF_MISSILE, this is the actual fire from it.
MF2_STRONGBOX = 1<<20, // Flag used for "strong" random monitors. MF2_SHADOW = 1<<20, // Fuzzy draw, makes targeting harder.
MF2_OBJECTFLIP = 1<<21, // Flag for objects that always have flipped gravity. MF2_STRONGBOX = 1<<21, // Flag used for "strong" random monitors.
MF2_SKULLFLY = 1<<22, // Special handling: skull in flight. MF2_OBJECTFLIP = 1<<22, // Flag for objects that always have flipped gravity.
MF2_FRET = 1<<23, // Flashing from a previous hit MF2_SKULLFLY = 1<<23, // Special handling: skull in flight.
MF2_BOSSNOTRAP = 1<<24, // No Egg Trap after boss MF2_FRET = 1<<24, // Flashing from a previous hit
MF2_BOSSFLEE = 1<<25, // Boss is fleeing! MF2_BOSSNOTRAP = 1<<25, // No Egg Trap after boss
MF2_BOSSDEAD = 1<<26, // Boss is dead! (Not necessarily fleeing, if a fleeing point doesn't exist.) MF2_BOSSFLEE = 1<<26, // Boss is fleeing!
MF2_BOSSDEAD = 1<<27, // Boss is dead! (Not necessarily fleeing, if a fleeing point doesn't exist.)
// free: to and including 1<<31 // free: to and including 1<<31
} mobjflag2_t; } mobjflag2_t;
@ -231,8 +232,7 @@ typedef enum
MFE_VERTICALFLIP = 1<<5, MFE_VERTICALFLIP = 1<<5,
// Goo water // Goo water
MFE_GOOWATER = 1<<6, MFE_GOOWATER = 1<<6,
// Mobj was already pushed this tic // free: to and including 1<<7
MFE_PUSHED = 1<<7,
// Mobj was already sprung this tic // Mobj was already sprung this tic
MFE_SPRUNG = 1<<8, MFE_SPRUNG = 1<<8,
// Platform movement // Platform movement

View file

@ -3203,7 +3203,7 @@ static inline boolean P_NetUnArchiveMisc(void)
// tell the sound code to reset the music since we're skipping what // tell the sound code to reset the music since we're skipping what
// normally sets this flag // normally sets this flag
mapmusic |= MUSIC_RELOADRESET; mapmusflags |= MUSIC_RELOADRESET;
G_SetGamestate(READINT16(save_p)); G_SetGamestate(READINT16(save_p));

View file

@ -180,10 +180,11 @@ static void P_ClearSingleMapHeaderInfo(INT16 i)
mapheaderinfo[num]->typeoflevel = 0; mapheaderinfo[num]->typeoflevel = 0;
DEH_WriteUndoline("NEXTLEVEL", va("%d", mapheaderinfo[num]->nextlevel), UNDO_NONE); DEH_WriteUndoline("NEXTLEVEL", va("%d", mapheaderinfo[num]->nextlevel), UNDO_NONE);
mapheaderinfo[num]->nextlevel = (INT16)(i + 1); mapheaderinfo[num]->nextlevel = (INT16)(i + 1);
DEH_WriteUndoline("MUSICSLOT", va("%d", mapheaderinfo[num]->musicslot), UNDO_NONE); DEH_WriteUndoline("MUSIC", mapheaderinfo[num]->musname, UNDO_NONE);
mapheaderinfo[num]->musicslot = mus_map01m + num; snprintf(mapheaderinfo[num]->musname, 7, "%sM", G_BuildMapName(i));
DEH_WriteUndoline("MUSICSLOTTRACK", va("%d", mapheaderinfo[num]->musicslottrack), UNDO_NONE); mapheaderinfo[num]->musname[6] = 0;
mapheaderinfo[num]->musicslottrack = 0; DEH_WriteUndoline("MUSICTRACK", va("%d", mapheaderinfo[num]->mustrack), UNDO_NONE);
mapheaderinfo[num]->mustrack = 0;
DEH_WriteUndoline("FORCECHARACTER", va("%d", mapheaderinfo[num]->forcecharacter), UNDO_NONE); DEH_WriteUndoline("FORCECHARACTER", va("%d", mapheaderinfo[num]->forcecharacter), UNDO_NONE);
mapheaderinfo[num]->forcecharacter[0] = '\0'; mapheaderinfo[num]->forcecharacter[0] = '\0';
DEH_WriteUndoline("WEATHER", va("%d", mapheaderinfo[num]->weather), UNDO_NONE); DEH_WriteUndoline("WEATHER", va("%d", mapheaderinfo[num]->weather), UNDO_NONE);
@ -1439,6 +1440,29 @@ static void P_LoadSideDefs2(lumpnum_t lumpnum)
#endif #endif
case 413: // Change music case 413: // Change music
{
char process[8+1];
sd->toptexture = sd->midtexture = sd->bottomtexture = 0;
if (msd->bottomtexture[0] != '-' || msd->bottomtexture[1] != '\0')
{
M_Memcpy(process,msd->bottomtexture,8);
process[8] = '\0';
sd->bottomtexture = get_number(process)-1;
}
M_Memcpy(process,msd->toptexture,8);
process[8] = '\0';
sd->text = Z_Malloc(7, PU_LEVEL, NULL);
// If they type in O_ or D_ and their music name, just shrug,
// then copy the rest instead.
if ((process[0] == 'O' || process[0] == 'D') && process[7])
M_Memcpy(sd->text, process+2, 6);
else // Assume it's a proper music name.
M_Memcpy(sd->text, process, 6);
sd->text[6] = 0;
break;
}
case 414: // Play SFX case 414: // Play SFX
{ {
sd->toptexture = sd->midtexture = sd->bottomtexture = 0; sd->toptexture = sd->midtexture = sd->bottomtexture = 0;
@ -1449,13 +1473,6 @@ static void P_LoadSideDefs2(lumpnum_t lumpnum)
process[8] = '\0'; process[8] = '\0';
sd->toptexture = get_number(process); sd->toptexture = get_number(process);
} }
if (sd->special == 413 && (msd->bottomtexture[0] != '-' || msd->bottomtexture[1] != '\0'))
{
char process[8+1];
M_Memcpy(process,msd->bottomtexture,8);
process[8] = '\0';
sd->bottomtexture = get_number(process)-1;
}
break; break;
} }

View file

@ -1891,7 +1891,6 @@ boolean P_RunTriggerLinedef(line_t *triggerline, mobj_t *actor, sector_t *caller
|| specialtype == 304 // Ring count - Once || specialtype == 304 // Ring count - Once
|| specialtype == 307 // Character ability - Once || specialtype == 307 // Character ability - Once
|| specialtype == 308 // Race only - Once || specialtype == 308 // Race only - Once
|| specialtype == 313 // No More Enemies - Once
|| specialtype == 315 // No of pushables - Once || specialtype == 315 // No of pushables - Once
|| specialtype == 318 // Unlockable trigger - Once || specialtype == 318 // Unlockable trigger - Once
|| specialtype == 320 // Unlockable - Once || specialtype == 320 // Unlockable - Once
@ -2390,20 +2389,19 @@ static void P_ProcessLineSpecial(line_t *line, mobj_t *mo, sector_t *callsec)
// console player only unless NOCLIMB is set // console player only unless NOCLIMB is set
if ((line->flags & ML_NOCLIMB) || (mo && mo->player && P_IsLocalPlayer(mo->player))) if ((line->flags & ML_NOCLIMB) || (mo && mo->player && P_IsLocalPlayer(mo->player)))
{ {
UINT16 musicnum = (UINT16)sides[line->sidenum[0]].toptexture; //P_AproxDistance(line->dx, line->dy)>>FRACBITS;
UINT16 tracknum = (UINT16)sides[line->sidenum[0]].bottomtexture; UINT16 tracknum = (UINT16)sides[line->sidenum[0]].bottomtexture;
mapmusic = musicnum | (tracknum << MUSIC_TRACKSHIFT); strncpy(mapmusname, sides[line->sidenum[0]].text, 7);
if (!(line->flags & ML_BLOCKMONSTERS)) mapmusname[6] = 0;
mapmusic |= MUSIC_RELOADRESET;
if (musicnum >= NUMMUSIC || musicnum == mus_None) mapmusflags = tracknum & MUSIC_TRACKMASK;
S_StopMusic(); if (!(line->flags & ML_BLOCKMONSTERS))
else mapmusflags |= MUSIC_RELOADRESET;
S_ChangeMusic(mapmusic, !(line->flags & ML_EFFECT4));
S_ChangeMusic(mapmusname, mapmusflags, !(line->flags & ML_EFFECT4));
// Except, you can use the ML_BLOCKMONSTERS flag to change this behavior. // Except, you can use the ML_BLOCKMONSTERS flag to change this behavior.
// if (mapmusic & MUSIC_RELOADRESET) then it will reset the music in G_PlayerReborn. // if (mapmusflags & MUSIC_RELOADRESET) then it will reset the music in G_PlayerReborn.
} }
break; break;
@ -6030,31 +6028,6 @@ void P_SpawnSpecials(INT32 fromnetsave)
P_AddRaiseThinker(lines[i].frontsector, &lines[i]); P_AddRaiseThinker(lines[i].frontsector, &lines[i]);
break; break;
#ifdef SLOPENESS
case 999:
sec = sides[*lines[i].sidenum].sector-sectors;
for (s = -1; (s = P_FindSectorFromLineTag(lines + i, s)) >= 0 ;)
{
size_t counting;
sectors[s].floorangle = ANGLE_45;
for (counting = 0; counting < sectors[s].linecount/2; counting++)
{
sectors[s].lines[counting]->v1->z = sectors[sec].floorheight;
CONS_Debug(DBG_GAMELOGIC, "Set it to %d\n", sectors[s].lines[counting]->v1->z>>FRACBITS);
}
for (counting = sectors[s].linecount/2; counting < sectors[s].linecount; counting++)
{
sectors[s].lines[counting]->v1->z = sectors[sec].ceilingheight;
CONS_Debug(DBG_GAMELOGIC, "Set it to %d\n", sectors[s].lines[counting]->v1->z>>FRACBITS);
}
sectors[s].special = 65535;
CONS_Debug(DBG_GAMELOGIC, "Found & Set slope!\n");
}
break;
#endif
case 200: // Double light effect case 200: // Double light effect
P_AddFakeFloorsByLine(i, FF_EXISTS|FF_CUTSPRITES|FF_DOUBLESHADOW, secthinkers); P_AddFakeFloorsByLine(i, FF_EXISTS|FF_CUTSPRITES|FF_DOUBLESHADOW, secthinkers);
break; break;
@ -6469,7 +6442,7 @@ static void P_DoScrollMove(mobj_t *thing, fixed_t dx, fixed_t dy, INT32 exclusiv
thing->momy += dy; thing->momy += dy;
if (exclusive) if (exclusive)
thing->eflags |= MFE_PUSHED; thing->flags2 |= MF2_PUSHED;
} }
/** Processes an active scroller. /** Processes an active scroller.
@ -6573,7 +6546,7 @@ void T_Scroll(scroll_t *s)
{ {
thing = node->m_thing; thing = node->m_thing;
if (thing->eflags & MFE_PUSHED) // Already pushed this tic by an exclusive pusher. if (thing->flags2 & MF2_PUSHED) // Already pushed this tic by an exclusive pusher.
continue; continue;
height = P_GetSpecialBottomZ(thing, sec, psec); height = P_GetSpecialBottomZ(thing, sec, psec);
@ -6595,7 +6568,7 @@ void T_Scroll(scroll_t *s)
{ {
thing = node->m_thing; thing = node->m_thing;
if (thing->eflags & MFE_PUSHED) if (thing->flags2 & MF2_PUSHED)
continue; continue;
height = P_GetSpecialBottomZ(thing, sec, sec); height = P_GetSpecialBottomZ(thing, sec, sec);
@ -6636,7 +6609,7 @@ void T_Scroll(scroll_t *s)
{ {
thing = node->m_thing; thing = node->m_thing;
if (thing->eflags & MFE_PUSHED) if (thing->flags2 & MF2_PUSHED)
continue; continue;
height = P_GetSpecialTopZ(thing, sec, psec); height = P_GetSpecialTopZ(thing, sec, psec);
@ -6658,7 +6631,7 @@ void T_Scroll(scroll_t *s)
{ {
thing = node->m_thing; thing = node->m_thing;
if (thing->eflags & MFE_PUSHED) if (thing->flags2 & MF2_PUSHED)
continue; continue;
height = P_GetSpecialTopZ(thing, sec, sec); height = P_GetSpecialTopZ(thing, sec, sec);
@ -7141,7 +7114,7 @@ static pusher_t *tmpusher; // pusher structure for blockmap searches
*/ */
static inline boolean PIT_PushThing(mobj_t *thing) static inline boolean PIT_PushThing(mobj_t *thing)
{ {
if (thing->eflags & MFE_PUSHED) if (thing->flags2 & MF2_PUSHED)
return false; return false;
if (thing->player && thing->player->pflags & PF_ROPEHANG) if (thing->player && thing->player->pflags & PF_ROPEHANG)
@ -7271,7 +7244,7 @@ static inline boolean PIT_PushThing(mobj_t *thing)
} }
if (tmpusher->exclusive) if (tmpusher->exclusive)
thing->eflags |= MFE_PUSHED; thing->flags2 |= MF2_PUSHED;
return true; return true;
} }
@ -7374,7 +7347,7 @@ void T_Pusher(pusher_t *p)
|| thing->type == MT_BIGTUMBLEWEED)) || thing->type == MT_BIGTUMBLEWEED))
continue; continue;
if (thing->eflags & MFE_PUSHED) if (thing->flags2 & MF2_PUSHED)
continue; continue;
if (thing->player && thing->player->pflags & PF_ROPEHANG) if (thing->player && thing->player->pflags & PF_ROPEHANG)
@ -7541,7 +7514,7 @@ void T_Pusher(pusher_t *p)
} }
if (p->exclusive) if (p->exclusive)
thing->eflags |= MFE_PUSHED; thing->flags2 |= MF2_PUSHED;
} }
} }
} }

View file

@ -962,7 +962,7 @@ void P_DoSuperTransformation(player_t *player, boolean giverings)
if (!(mapheaderinfo[gamemap-1]->levelflags & LF_NOSSMUSIC) && P_IsLocalPlayer(player)) if (!(mapheaderinfo[gamemap-1]->levelflags & LF_NOSSMUSIC) && P_IsLocalPlayer(player))
{ {
S_StopMusic(); S_StopMusic();
S_ChangeMusic(mus_supers, true); S_ChangeMusicInternal("supers", true);
} }
S_StartSound(NULL, sfx_supert); //let all players hear it -mattw_cfi S_StartSound(NULL, sfx_supert); //let all players hear it -mattw_cfi
@ -1098,7 +1098,7 @@ void P_PlayLivesJingle(player_t *player)
if (player) if (player)
player->powers[pw_extralife] = extralifetics + 1; player->powers[pw_extralife] = extralifetics + 1;
S_StopMusic(); // otherwise it won't restart if this is done twice in a row S_StopMusic(); // otherwise it won't restart if this is done twice in a row
S_ChangeMusic(mus_xtlife, false); S_ChangeMusicInternal("xtlife", false);
} }
} }
@ -1116,21 +1116,21 @@ void P_RestoreMusic(player_t *player)
return; return;
S_SpeedMusic(1.0f); S_SpeedMusic(1.0f);
if (player->powers[pw_super] && !(mapheaderinfo[gamemap-1]->levelflags & LF_NOSSMUSIC)) if (player->powers[pw_super] && !(mapheaderinfo[gamemap-1]->levelflags & LF_NOSSMUSIC))
S_ChangeMusic(mus_supers, true); S_ChangeMusicInternal("supers", true);
else if (player->powers[pw_invulnerability] > 1) else if (player->powers[pw_invulnerability] > 1)
S_ChangeMusic((mariomode) ? mus_minvnc : mus_invinc, false); S_ChangeMusicInternal((mariomode) ? "minvnc" : "invinc", false);
else if (player->powers[pw_sneakers] > 1 && !player->powers[pw_super]) else if (player->powers[pw_sneakers] > 1 && !player->powers[pw_super])
{ {
if (mapheaderinfo[gamemap-1]->levelflags & LF_SPEEDMUSIC) if (mapheaderinfo[gamemap-1]->levelflags & LF_SPEEDMUSIC)
{ {
S_SpeedMusic(1.4f); S_SpeedMusic(1.4f);
S_ChangeMusic(mapmusic, true); S_ChangeMusic(mapmusname, mapmusflags, true);
} }
else else
S_ChangeMusic(mus_shoes, true); S_ChangeMusicInternal("shoes", true);
} }
else else
S_ChangeMusic(mapmusic, true); S_ChangeMusic(mapmusname, mapmusflags, true);
} }
// //
@ -2039,7 +2039,7 @@ static void P_CheckUnderwaterAndSpaceTimer(player_t *player)
mobj_t *killer; mobj_t *killer;
if ((netgame || multiplayer) && P_IsLocalPlayer(player)) if ((netgame || multiplayer) && P_IsLocalPlayer(player))
S_ChangeMusic(mapmusic, true); S_ChangeMusic(mapmusname, mapmusflags, true);
killer = P_SpawnMobj(player->mo->x, player->mo->y, player->mo->z, MT_NULL); killer = P_SpawnMobj(player->mo->x, player->mo->y, player->mo->z, MT_NULL);
killer->threshold = 42; // Special flag that it was drowning which killed you. killer->threshold = 42; // Special flag that it was drowning which killed you.
@ -2048,7 +2048,7 @@ static void P_CheckUnderwaterAndSpaceTimer(player_t *player)
else if (player->powers[pw_spacetime] == 1) else if (player->powers[pw_spacetime] == 1)
{ {
if ((netgame || multiplayer) && P_IsLocalPlayer(player)) if ((netgame || multiplayer) && P_IsLocalPlayer(player))
S_ChangeMusic(mapmusic, true); S_ChangeMusic(mapmusname, mapmusflags, true);
P_DamageMobj(player->mo, NULL, NULL, 10000); P_DamageMobj(player->mo, NULL, NULL, 10000);
} }
@ -2083,7 +2083,7 @@ static void P_CheckUnderwaterAndSpaceTimer(player_t *player)
&& player == &players[consoleplayer]) && player == &players[consoleplayer])
{ {
S_StopMusic(); S_StopMusic();
S_ChangeMusic(mus_drown, false); S_ChangeMusicInternal("drown", false);
} }
if (player->powers[pw_underwater] == 25*TICRATE + 1) if (player->powers[pw_underwater] == 25*TICRATE + 1)
@ -5579,7 +5579,7 @@ static void P_NiGHTSMovement(player_t *player)
} }
else if (P_IsLocalPlayer(player) && player->nightstime == 10*TICRATE) else if (P_IsLocalPlayer(player) && player->nightstime == 10*TICRATE)
// S_StartSound(NULL, sfx_timeup); // that creepy "out of time" music from NiGHTS. Dummied out, as some on the dev team thought it wasn't Sonic-y enough (Mystic, notably). Uncomment to restore. -SH // S_StartSound(NULL, sfx_timeup); // that creepy "out of time" music from NiGHTS. Dummied out, as some on the dev team thought it wasn't Sonic-y enough (Mystic, notably). Uncomment to restore. -SH
S_ChangeMusic(mus_drown,false); S_ChangeMusicInternal("drown",false);
if (player->mo->z < player->mo->floorz) if (player->mo->z < player->mo->floorz)
@ -7717,7 +7717,7 @@ static void P_DeathThink(player_t *player)
// Return to level music // Return to level music
if (netgame && player->deadtimer == gameovertics && P_IsLocalPlayer(player)) if (netgame && player->deadtimer == gameovertics && P_IsLocalPlayer(player))
S_ChangeMusic(mapmusic, true); S_ChangeMusic(mapmusname, mapmusflags, true);
} }
if (!player->mo) if (!player->mo)
@ -8703,7 +8703,7 @@ void P_PlayerThink(player_t *player)
if (countdown == 11*TICRATE - 1) if (countdown == 11*TICRATE - 1)
{ {
if (P_IsLocalPlayer(player)) if (P_IsLocalPlayer(player))
S_ChangeMusic(mus_drown, false); S_ChangeMusicInternal("drown", false);
} }
// If you've hit the countdown and you haven't made // If you've hit the countdown and you haven't made
@ -8857,10 +8857,7 @@ void P_PlayerThink(player_t *player)
mo2 = (mobj_t *)th; mo2 = (mobj_t *)th;
if (!(mo2->type == MT_NIGHTSWING || mo2->type == MT_RING || mo2->type == MT_COIN if (!(mo2->type == MT_NIGHTSWING || mo2->type == MT_RING || mo2->type == MT_COIN
#ifdef BLUE_SPHERES || mo2->type == MT_BLUEBALL))
|| mo2->type == MT_BLUEBALL
#endif
))
continue; continue;
if (P_AproxDistance(P_AproxDistance(mo2->x - x, mo2->y - y), mo2->z - z) > FixedMul(128*FRACUNIT, player->mo->scale)) if (P_AproxDistance(P_AproxDistance(mo2->x - x, mo2->y - y), mo2->z - z) > FixedMul(128*FRACUNIT, player->mo->scale))

View file

@ -369,14 +369,6 @@ typedef struct sector_s
double lineoutLength; double lineoutLength;
#endif // ----- end special tricks ----- #endif // ----- end special tricks -----
// ZDoom C++ to Legacy C conversion (for slopes)
// store floor and ceiling planes instead of heights
//secplane_t floorplane, ceilingplane;
#ifdef SLOPENESS
//fixed_t floortexz, ceilingtexz; // [RH] used for wall texture mapping
angle_t floorangle;
#endif
// This points to the master's floorheight, so it can be changed in realtime! // This points to the master's floorheight, so it can be changed in realtime!
fixed_t *gravity; // per-sector gravity fixed_t *gravity; // per-sector gravity
boolean verticalflip; // If gravity < 0, then allow flipped physics boolean verticalflip; // If gravity < 0, then allow flipped physics

View file

@ -141,14 +141,6 @@ typedef struct
static channel_t *channels = NULL; static channel_t *channels = NULL;
static INT32 numofchannels = 0; static INT32 numofchannels = 0;
// whether songs are mus_paused
static boolean mus_paused = 0;
// music currently being played
musicinfo_t *mus_playing = 0;
static INT32 nextcleanup;
// //
// Internals. // Internals.
// //
@ -307,47 +299,6 @@ static void SetChannelsNum(void)
channels[i].sfxinfo = 0; channels[i].sfxinfo = 0;
} }
//
// Initializes sound stuff, including volume
// Sets channels, SFX and music volume,
// allocates channel buffer, sets S_sfx lookup.
//
void S_Init(INT32 sfxVolume, INT32 digMusicVolume, INT32 midiMusicVolume)
{
INT32 i;
if (dedicated)
return;
S_SetSfxVolume(sfxVolume);
S_SetDigMusicVolume(digMusicVolume);
S_SetMIDIMusicVolume(midiMusicVolume);
SetChannelsNum();
// no sounds are playing, and they are not mus_paused
mus_paused = 0;
// Note that sounds have not been cached (yet).
for (i = 1; i < NUMSFX; i++)
{
S_sfx[i].usefulness = -1; // for I_GetSfx()
S_sfx[i].lumpnum = LUMPERROR;
}
// precache sounds if requested by cmdline, or precachesound var true
if (!nosound && (M_CheckParm("-precachesound") || precachesound.value))
{
// Initialize external data (all sounds) at start, keep static.
CONS_Printf(M_GetText("Loading sounds... "));
for (i = 1; i < NUMSFX; i++)
if (S_sfx[i].name)
S_sfx[i].data = I_GetSfx(&S_sfx[i]);
CONS_Printf(M_GetText(" pre-cached all sound data\n"));
}
}
// Retrieve the lump number of sfx // Retrieve the lump number of sfx
// //
@ -371,12 +322,6 @@ lumpnum_t S_GetSfxLumpNum(sfxinfo_t *sfx)
return W_GetNumForName("dsthok"); return W_GetNumForName("dsthok");
} }
//
// Per level startup code.
// Kills playing sounds at start of level,
// determines music if any, changes music.
//
// Stop all sounds, load level info, THEN start sounds. // Stop all sounds, load level info, THEN start sounds.
void S_StopSounds(void) void S_StopSounds(void)
{ {
@ -442,22 +387,6 @@ void S_StopSoundByNum(sfxenum_t sfxnum)
} }
} }
void S_Start(void)
{
if (mapmusic & MUSIC_RELOADRESET)
{
mapmusic = mapheaderinfo[gamemap-1]->musicslot
| (mapheaderinfo[gamemap-1]->musicslottrack << MUSIC_TRACKSHIFT);
}
mus_paused = 0;
if (cv_resetmusic.value)
S_StopMusic();
S_ChangeMusic(mapmusic, true);
nextcleanup = 15;
}
void S_StartSoundAtVolume(const void *origin_p, sfxenum_t sfx_id, INT32 volume) void S_StartSoundAtVolume(const void *origin_p, sfxenum_t sfx_id, INT32 volume)
{ {
INT32 sep, pitch, priority, cnum; INT32 sep, pitch, priority, cnum;
@ -745,43 +674,6 @@ void S_StopSound(void *origin)
} }
} }
//
// Stop and resume music, during game PAUSE.
//
void S_PauseSound(void)
{
if (!nodigimusic)
I_PauseSong(0);
if (mus_playing && !mus_paused)
{
I_PauseSong(mus_playing->handle);
mus_paused = true;
}
// pause cd music
#if (defined (__unix__) && !defined (MSDOS)) || defined (UNIXCOMMON) || defined (HAVE_SDL)
I_PauseCD();
#else
I_StopCD();
#endif
}
void S_ResumeSound(void)
{
if (!nodigimusic)
I_ResumeSong(0);
else
if (mus_playing && mus_paused)
{
I_ResumeSong(mus_playing->handle);
mus_paused = false;
}
// resume cd music
I_ResumeCD();
}
// //
// Updates music & sounds // Updates music & sounds
// //
@ -883,38 +775,6 @@ void S_UpdateSounds(void)
} }
} }
// Clean up unused data.
#if 0
{
static tic_t nextcleanup = 0;
size_t i;
sfxinfo_t *sfx;
if (!gametic) nextcleanup = 0;
if (gametic > nextcleanup)
{
for (i = 1; i < NUMSFX; i++)
{
if (S_sfx[i].usefulness == 0)
{
S_sfx[i].usefulness--;
// don't forget to unlock it !!!
// __dmpi_unlock_....
//Z_ChangeTag(S_sfx[i].data, PU_CACHE);
I_FreeSfx(S_sfx+i);
//S_sfx[i].data = 0;
CONS_Debug(DBG_GAMELOGIC, "flushed sfx %.6s\n", S_sfx[i].name);
}
}
nextcleanup = gametic + 15;
}
}
#endif
// FIXTHIS: nextcleanup is probably unused
for (cnum = 0; cnum < numofchannels; cnum++) for (cnum = 0; cnum < numofchannels; cnum++)
{ {
c = &channels[cnum]; c = &channels[cnum];
@ -984,37 +844,6 @@ void S_UpdateSounds(void)
I_UpdateSound(); I_UpdateSound();
} }
void S_SetDigMusicVolume(INT32 volume)
{
if (volume < 0 || volume > 31)
CONS_Alert(CONS_WARNING, "musicvolume should be between 0-31\n");
CV_SetValue(&cv_digmusicvolume, volume&31);
actualdigmusicvolume = cv_digmusicvolume.value; //check for change of var
#ifdef DJGPPDOS
I_SetDigMusicVolume(31); // Trick for buggy dos drivers. Win32 doesn't need this.
#endif
if (!nodigimusic)
I_SetDigMusicVolume(volume&31);
}
void S_SetMIDIMusicVolume(INT32 volume)
{
if (volume < 0 || volume > 31)
CONS_Alert(CONS_WARNING, "musicvolume should be between 0-31\n");
CV_SetValue(&cv_midimusicvolume, volume&0x1f);
actualmidimusicvolume = cv_midimusicvolume.value; //check for change of var
#ifdef DJGPPDOS
I_SetMIDIMusicVolume(31); // Trick for buggy dos drivers. Win32 doesn't need this.
#endif
I_SetMIDIMusicVolume(volume&0x1f);
}
void S_SetSfxVolume(INT32 volume) void S_SetSfxVolume(INT32 volume)
{ {
if (volume < 0 || volume > 31) if (volume < 0 || volume > 31)
@ -1031,137 +860,6 @@ void S_SetSfxVolume(INT32 volume)
#endif #endif
} }
static boolean S_MIDIMusic(musicinfo_t *music, boolean looping)
{
if (nomidimusic)
return true; // no error
if (music_disabled)
return true; // no error
// get lumpnum if neccessary
if (!music->lumpnum)
{
if (W_CheckNumForName(va("d_%s", music->name)) == LUMPERROR)
return false;
music->lumpnum = W_GetNumForName(va("d_%s", music->name));
}
// load & register it
music->data = W_CacheLumpNum(music->lumpnum, PU_MUSIC);
#if defined (macintosh) && !defined (HAVE_SDL)
music->handle = I_RegisterSong(music_num);
#else
music->handle = I_RegisterSong(music->data, W_LumpLength(music->lumpnum));
#endif
#ifdef MUSSERV
if (msg_id != -1)
{
struct musmsg msg_buffer;
msg_buffer.msg_type = 6;
memset(msg_buffer.msg_text, 0, sizeof (msg_buffer.msg_text));
sprintf(msg_buffer.msg_text, "d_%s", music->name);
msgsnd(msg_id, (struct msgbuf*)&msg_buffer, sizeof (msg_buffer.msg_text), IPC_NOWAIT);
}
#endif
// play it
if (!I_PlaySong(music->handle, looping))
return false;
mus_playing = music;
return true;
}
static boolean S_DigMusic(musicinfo_t *music, boolean looping)
{
if (nodigimusic)
return false; // try midi
if (digital_disabled)
return false; // try midi
if (!I_StartDigSong(music->name, looping))
return false;
mus_playing = music;
return true;
}
void S_ChangeMusic(UINT32 mslotnum, boolean looping)
{
musicinfo_t *music;
musicenum_t music_num = (signed)(mslotnum & MUSIC_SONGMASK);
INT32 track_num = (mslotnum & MUSIC_TRACKMASK) >> MUSIC_TRACKSHIFT;
#if defined (DC) || defined (_WIN32_WCE) || defined (PSP) || defined(GP2X)
S_ClearSfx();
#endif
if (nomidimusic && nodigimusic)
return;
if (music_disabled && digital_disabled)
return;
// No Music
if (music_num == mus_None)
{
S_StopMusic();
return;
}
if (music_num >= NUMMUSIC)
{
CONS_Alert(CONS_ERROR, "Bad music number %d\n", music_num);
return;
}
else
music = &S_music[music_num];
if (mus_playing != music)
{
S_StopMusic(); // shutdown old music
if (!S_DigMusic(music, looping) && !S_MIDIMusic(music, looping))
{
CONS_Alert(CONS_ERROR, M_GetText("Music lump %.6s not found!\n"), music->name);
return;
}
}
I_SetSongTrack(track_num);
}
boolean S_SpeedMusic(float speed)
{
return I_SetSongSpeed(speed);
}
void S_StopMusic(void)
{
if (!mus_playing)
return;
if (mus_paused)
I_ResumeSong(mus_playing->handle);
if (!nodigimusic)
I_StopDigSong();
S_SpeedMusic(1.0f);
I_StopSong(mus_playing->handle);
I_UnRegisterSong(mus_playing->handle);
#ifndef HAVE_SDL //SDL uses RWOPS
Z_ChangeTag(mus_playing->data, PU_CACHE);
#endif
mus_playing->data = NULL;
mus_playing = NULL;
}
void S_ClearSfx(void) void S_ClearSfx(void)
{ {
#ifndef DJGPPDOS #ifndef DJGPPDOS
@ -1452,3 +1150,285 @@ void S_StartSoundName(void *mo, const char *soundname)
S_StartSound(mo, soundnum); S_StartSound(mo, soundnum);
} }
/// ------------------------
/// Music
/// ------------------------
#ifdef MUSICSLOT_COMPATIBILITY
const char *compat_special_music_slots[16] =
{
"titles", // 1036 title screen
"read_m", // 1037 intro
"lclear", // 1038 level clear
"invinc", // 1039 invincibility
"shoes", // 1040 super sneakers
"minvnc", // 1041 Mario invincibility
"drown", // 1042 drowning
"gmover", // 1043 game over
"xtlife", // 1044 extra life
"contsc", // 1045 continue screen
"supers", // 1046 Super Sonic
"chrsel", // 1047 character select
"credit", // 1048 credits
"racent", // 1049 Race Results
"stjr", // 1050 Sonic Team Jr. Presents
""
};
#endif
#define music_playing (music_name[0]) // String is empty if no music is playing
static char music_name[7]; // up to 6-character name
static lumpnum_t music_lumpnum; // lump number of music (used??)
static void *music_data; // music raw data
static INT32 music_handle; // once registered, the handle for the music
static boolean mus_paused = 0; // whether songs are mus_paused
static boolean S_MIDIMusic(const char *mname, boolean looping)
{
lumpnum_t mlumpnum;
void *mdata;
INT32 mhandle;
if (nomidimusic || music_disabled)
return false; // didn't search.
if (W_CheckNumForName(va("d_%s", mname)) == LUMPERROR)
return false;
mlumpnum = W_GetNumForName(va("d_%s", mname));
// load & register it
mdata = W_CacheLumpNum(mlumpnum, PU_MUSIC);
mhandle = I_RegisterSong(mdata, W_LumpLength(mlumpnum));
#ifdef MUSSERV
if (msg_id != -1)
{
struct musmsg msg_buffer;
msg_buffer.msg_type = 6;
memset(msg_buffer.msg_text, 0, sizeof (msg_buffer.msg_text));
sprintf(msg_buffer.msg_text, "d_%s", mname);
msgsnd(msg_id, (struct msgbuf*)&msg_buffer, sizeof (msg_buffer.msg_text), IPC_NOWAIT);
}
#endif
// play it
if (!I_PlaySong(mhandle, looping))
return false;
strncpy(music_name, mname, 7);
music_name[6] = 0;
music_lumpnum = mlumpnum;
music_data = mdata;
music_handle = mhandle;
return true;
}
static boolean S_DigMusic(const char *mname, boolean looping)
{
if (nodigimusic || digital_disabled)
return false; // try midi
if (!I_StartDigSong(mname, looping))
return false;
strncpy(music_name, mname, 7);
music_name[6] = 0;
music_lumpnum = LUMPERROR;
music_data = NULL;
music_handle = 0;
return true;
}
void S_ChangeMusic(const char *mmusic, UINT16 mflags, boolean looping)
{
#if defined (DC) || defined (_WIN32_WCE) || defined (PSP) || defined(GP2X)
S_ClearSfx();
#endif
if ((nomidimusic || music_disabled) && (nodigimusic || digital_disabled))
return;
// No Music (empty string)
if (mmusic[0] == 0)
{
S_StopMusic();
return;
}
if (strncmp(music_name, mmusic, 6))
{
S_StopMusic(); // shutdown old music
if (!S_DigMusic(mmusic, looping) && !S_MIDIMusic(mmusic, looping))
{
CONS_Alert(CONS_ERROR, M_GetText("Music lump %.6s not found!\n"), mmusic);
return;
}
}
I_SetSongTrack(mflags & MUSIC_TRACKMASK);
}
boolean S_SpeedMusic(float speed)
{
return I_SetSongSpeed(speed);
}
void S_StopMusic(void)
{
if (!music_playing)
return;
if (mus_paused)
I_ResumeSong(music_handle);
if (!nodigimusic)
I_StopDigSong();
S_SpeedMusic(1.0f);
I_StopSong(music_handle);
I_UnRegisterSong(music_handle);
#ifndef HAVE_SDL //SDL uses RWOPS
Z_ChangeTag(music_data, PU_CACHE);
#endif
music_data = NULL;
music_name[0] = 0;
}
void S_SetDigMusicVolume(INT32 volume)
{
if (volume < 0 || volume > 31)
CONS_Alert(CONS_WARNING, "musicvolume should be between 0-31\n");
CV_SetValue(&cv_digmusicvolume, volume&31);
actualdigmusicvolume = cv_digmusicvolume.value; //check for change of var
#ifdef DJGPPDOS
I_SetDigMusicVolume(31); // Trick for buggy dos drivers. Win32 doesn't need this.
#endif
if (!nodigimusic)
I_SetDigMusicVolume(volume&31);
}
void S_SetMIDIMusicVolume(INT32 volume)
{
if (volume < 0 || volume > 31)
CONS_Alert(CONS_WARNING, "musicvolume should be between 0-31\n");
CV_SetValue(&cv_midimusicvolume, volume&0x1f);
actualmidimusicvolume = cv_midimusicvolume.value; //check for change of var
#ifdef DJGPPDOS
I_SetMIDIMusicVolume(31); // Trick for buggy dos drivers. Win32 doesn't need this.
#endif
I_SetMIDIMusicVolume(volume&0x1f);
}
/// ------------------------
/// Init & Others
/// ------------------------
//
// Initializes sound stuff, including volume
// Sets channels, SFX and music volume,
// allocates channel buffer, sets S_sfx lookup.
//
void S_Init(INT32 sfxVolume, INT32 digMusicVolume, INT32 midiMusicVolume)
{
INT32 i;
if (dedicated)
return;
S_SetSfxVolume(sfxVolume);
S_SetDigMusicVolume(digMusicVolume);
S_SetMIDIMusicVolume(midiMusicVolume);
SetChannelsNum();
// no sounds are playing, and they are not mus_paused
mus_paused = 0;
// Note that sounds have not been cached (yet).
for (i = 1; i < NUMSFX; i++)
{
S_sfx[i].usefulness = -1; // for I_GetSfx()
S_sfx[i].lumpnum = LUMPERROR;
}
// precache sounds if requested by cmdline, or precachesound var true
if (!nosound && (M_CheckParm("-precachesound") || precachesound.value))
{
// Initialize external data (all sounds) at start, keep static.
CONS_Printf(M_GetText("Loading sounds... "));
for (i = 1; i < NUMSFX; i++)
if (S_sfx[i].name)
S_sfx[i].data = I_GetSfx(&S_sfx[i]);
CONS_Printf(M_GetText(" pre-cached all sound data\n"));
}
}
//
// Per level startup code.
// Kills playing sounds at start of level,
// determines music if any, changes music.
//
void S_Start(void)
{
if (mapmusflags & MUSIC_RELOADRESET)
{
strncpy(mapmusname, mapheaderinfo[gamemap-1]->musname, 7);
mapmusname[6] = 0;
mapmusflags = (mapheaderinfo[gamemap-1]->mustrack & MUSIC_TRACKMASK);
}
mus_paused = 0;
if (cv_resetmusic.value)
S_StopMusic();
S_ChangeMusic(mapmusname, mapmusflags, true);
}
//
// Stop and resume music, during game PAUSE.
//
void S_PauseAudio(void)
{
if (!nodigimusic)
I_PauseSong(0);
if (music_playing && !mus_paused)
{
I_PauseSong(music_handle);
mus_paused = true;
}
// pause cd music
#if (defined (__unix__) && !defined (MSDOS)) || defined (UNIXCOMMON) || defined (HAVE_SDL)
I_PauseCD();
#else
I_StopCD();
#endif
}
void S_ResumeAudio(void)
{
if (!nodigimusic)
I_ResumeSong(0);
else
if (music_playing && mus_paused)
{
I_ResumeSong(music_handle);
mus_paused = false;
}
// resume cd music
I_ResumeCD();
}

View file

@ -48,9 +48,6 @@ typedef enum
extern consvar_t play_mode; extern consvar_t play_mode;
#endif #endif
//in case you're wondering why: I need to define this as extern so P_RestoreMusic can get to it so we don't do stupid song/speed changes
extern musicinfo_t *mus_playing;
typedef enum typedef enum
{ {
SF_TOTALLYSINGLE = 1, // Only play one of these sounds at a time...GLOBALLY SF_TOTALLYSINGLE = 1, // Only play one of these sounds at a time...GLOBALLY
@ -100,11 +97,12 @@ void S_StartSoundAtVolume(const void *origin, sfxenum_t sound_id, INT32 volume);
// Stop sound for thing at <origin> // Stop sound for thing at <origin>
void S_StopSound(void *origin); void S_StopSound(void *origin);
// Start music using <music_id> from sounds.h, and set whether looping // Start music track, arbitrary, given its name, and set whether looping
// note: music slot is first 16 bits for songnum, // note: music flags 12 bits for tracknum (gme, other formats with more than one track)
// next 15 bits for tracknum (gme, other formats with more than one track) // 13-15 aren't used yet
// and the last bit we ignore (internal game flag for resetting music on reload) // and the last bit we ignore (internal game flag for resetting music on reload)
void S_ChangeMusic(UINT32 mslotnum, boolean looping); #define S_ChangeMusicInternal(a,b) S_ChangeMusic(a,0,b)
void S_ChangeMusic(const char *mmusic, UINT16 mflags, boolean looping);
// Set Speed of Music // Set Speed of Music
boolean S_SpeedMusic(float speed); boolean S_SpeedMusic(float speed);
@ -113,8 +111,8 @@ boolean S_SpeedMusic(float speed);
void S_StopMusic(void); void S_StopMusic(void);
// Stop and resume music, during game PAUSE. // Stop and resume music, during game PAUSE.
void S_PauseSound(void); void S_PauseAudio(void);
void S_ResumeSound(void); void S_ResumeAudio(void);
// //
// Updates music & sounds // Updates music & sounds
@ -141,4 +139,10 @@ void S_StopSoundByNum(sfxenum_t sfxnum);
#define S_StartScreamSound S_StartSound #define S_StartScreamSound S_StartSound
#endif #endif
#ifdef MUSICSLOT_COMPATIBILITY
// For compatibility with code/scripts relying on older versions
// This is a list of all the "special" slot names and their associated numbers
const char *compat_special_music_slots[16];
#endif
#endif #endif

View file

@ -117,11 +117,13 @@ if(${SDL2_FOUND})
add_executable(SRB2SDL2 MACOSX_BUNDLE WIN32 ${SRB2_SDL2_TOTAL_SOURCES}) add_executable(SRB2SDL2 MACOSX_BUNDLE WIN32 ${SRB2_SDL2_TOTAL_SOURCES})
set_target_properties(SRB2SDL2 PROPERTIES OUTPUT_NAME ${SRB2_SDL2_EXE_NAME}) set_target_properties(SRB2SDL2 PROPERTIES OUTPUT_NAME ${SRB2_SDL2_EXE_NAME})
if((CMAKE_CXX_COMPILER_ID STREQUAL "AppleClang")) if(${CMAKE_SYSTEM} MATCHES Darwin)
add_framework(CoreFoundation SRB2SDL2) find_library(CORE_LIB CoreFoundation)
add_framework(SDL2 SRB2SDL2)
add_framework(SDL2_mixer SRB2SDL2)
target_link_libraries(SRB2SDL2 PRIVATE target_link_libraries(SRB2SDL2 PRIVATE
${CORE_LIB}
SDL2
SDL2_mixer
${GME_LIBRARIES}
${PNG_LIBRARIES} ${PNG_LIBRARIES}
${ZLIB_LIBRARIES} ${ZLIB_LIBRARIES}
${OPENGL_LIBRARIES} ${OPENGL_LIBRARIES}
@ -131,6 +133,7 @@ if(${SDL2_FOUND})
target_link_libraries(SRB2SDL2 PRIVATE target_link_libraries(SRB2SDL2 PRIVATE
${SDL2_LIBRARIES} ${SDL2_LIBRARIES}
${SDL2_MIXER_LIBRARIES} ${SDL2_MIXER_LIBRARIES}
${GME_LIBRARIES}
${PNG_LIBRARIES} ${PNG_LIBRARIES}
${ZLIB_LIBRARIES} ${ZLIB_LIBRARIES}
${OPENGL_LIBRARIES} ${OPENGL_LIBRARIES}
@ -198,6 +201,7 @@ if(${SDL2_FOUND})
target_include_directories(SRB2SDL2 PRIVATE target_include_directories(SRB2SDL2 PRIVATE
${SDL2_INCLUDE_DIRS} ${SDL2_INCLUDE_DIRS}
${SDL2_MIXER_INCLUDE_DIRS} ${SDL2_MIXER_INCLUDE_DIRS}
${GME_INCLUDE_DIRS}
${PNG_INCLUDE_DIRS} ${PNG_INCLUDE_DIRS}
${ZLIB_INCLUDE_DIRS} ${ZLIB_INCLUDE_DIRS}
${OPENGL_INCLUDE_DIRS} ${OPENGL_INCLUDE_DIRS}
@ -224,7 +228,7 @@ if(${SDL2_FOUND})
endif() endif()
#### Installation #### #### Installation ####
if (CMAKE_CXX_COMPILER_ID STREQUAL "AppleClang") if(${CMAKE_SYSTEM} MATCHES Darwin)
install(TARGETS SRB2SDL2 install(TARGETS SRB2SDL2
BUNDLE DESTINATION . BUNDLE DESTINATION .
) )
@ -265,7 +269,7 @@ if(${SDL2_FOUND})
# Mac bundle fixup # Mac bundle fixup
if (CMAKE_CXX_COMPILER_ID STREQUAL "AppleClang") if(${CMAKE_SYSTEM} MATCHES Darwin)
install(CODE " install(CODE "
include(BundleUtilities) include(BundleUtilities)
fixup_bundle(\"${CMAKE_INSTALL_PREFIX}/Sonic Robo Blast 2.app\" fixup_bundle(\"${CMAKE_INSTALL_PREFIX}/Sonic Robo Blast 2.app\"

View file

@ -1270,6 +1270,7 @@
HAVE_BLUA, HAVE_BLUA,
LUA_USE_POSIX, LUA_USE_POSIX,
COMPVERSION, COMPVERSION,
HWRENDER,
); );
GCC_THREADSAFE_STATICS = NO; GCC_THREADSAFE_STATICS = NO;
GCC_TREAT_IMPLICIT_FUNCTION_DECLARATIONS_AS_ERRORS = YES; GCC_TREAT_IMPLICIT_FUNCTION_DECLARATIONS_AS_ERRORS = YES;
@ -1392,6 +1393,7 @@
HAVE_BLUA, HAVE_BLUA,
LUA_USE_POSIX, LUA_USE_POSIX,
COMPVERSION, COMPVERSION,
HWRENDER,
); );
GCC_THREADSAFE_STATICS = NO; GCC_THREADSAFE_STATICS = NO;
GCC_TREAT_IMPLICIT_FUNCTION_DECLARATIONS_AS_ERRORS = YES; GCC_TREAT_IMPLICIT_FUNCTION_DECLARATIONS_AS_ERRORS = YES;

View file

@ -395,6 +395,7 @@ void I_FreeSfx(sfxinfo_t *sfx)
if (sfx->data) if (sfx->data)
Mix_FreeChunk(sfx->data); Mix_FreeChunk(sfx->data);
sfx->data = NULL; sfx->data = NULL;
sfx->lumpnum = LUMPERROR;
} }
INT32 I_StartSound(sfxenum_t id, UINT8 vol, UINT8 sep, UINT8 pitch, UINT8 priority) INT32 I_StartSound(sfxenum_t id, UINT8 vol, UINT8 sep, UINT8 pitch, UINT8 priority)

File diff suppressed because it is too large Load diff

File diff suppressed because it is too large Load diff

View file

@ -15,6 +15,8 @@
#include <string.h> #include <string.h>
#include "doomdef.h" #include "doomdef.h"
#if !defined (__APPLE__)
// Like the OpenBSD version, but it doesn't check for src not being a valid // Like the OpenBSD version, but it doesn't check for src not being a valid
// C string. // C string.
size_t strlcat(char *dst, const char *src, size_t siz) size_t strlcat(char *dst, const char *src, size_t siz)
@ -46,3 +48,5 @@ size_t strlcpy(char *dst, const char *src, size_t siz)
dst[0] = '\0'; dst[0] = '\0';
return strlcat(dst, src, siz); return strlcat(dst, src, siz);
} }
#endif

View file

@ -32,6 +32,7 @@
#include "w_wad.h" #include "w_wad.h"
#include "z_zone.h" #include "z_zone.h"
#include "fastcmp.h"
#include "i_video.h" // rendermode #include "i_video.h" // rendermode
#include "d_netfil.h" #include "d_netfil.h"
@ -147,24 +148,32 @@ static inline void W_LoadDehackedLumps(UINT16 wadnum)
} }
#endif #endif
// Check for MAINCFG
for (lump = 0;lump != INT16_MAX;lump++)
{ {
lump = W_CheckNumForNamePwad("MAINCFG", wadnum, lump); lumpinfo_t *lump_p = wadfiles[wadnum]->lumpinfo;
if (lump == INT16_MAX) for (lump = 0; lump < wadfiles[wadnum]->numlumps; lump++, lump_p++)
break; if (memcmp(lump_p->name,"SOC_",4)==0) // Check for generic SOC lump
CONS_Printf(M_GetText("Loading main config from %s\n"), wadfiles[wadnum]->filename); { // shameless copy+paste of code from LUA_LoadLump
DEH_LoadDehackedLumpPwad(wadnum, lump); char *name = malloc(strlen(wadfiles[wadnum]->filename)+10);
} strcpy(name, wadfiles[wadnum]->filename);
if (!fasticmp(&name[strlen(name) - 4], ".soc")) {
// Check for OBJCTCFG // If it's not a .soc file, copy the lump name in too.
for (lump = 0;lump < INT16_MAX;lump++) name[strlen(wadfiles[wadnum]->filename)] = '|';
{ M_Memcpy(name+strlen(wadfiles[wadnum]->filename)+1, lump_p->name, 8);
lump = W_CheckNumForNamePwad("OBJCTCFG", wadnum, lump); name[strlen(wadfiles[wadnum]->filename)+9] = '\0';
if (lump == INT16_MAX) }
break; CONS_Printf(M_GetText("Loading SOC from %s\n"), name);
CONS_Printf(M_GetText("Loading object config from %s\n"), wadfiles[wadnum]->filename); DEH_LoadDehackedLumpPwad(wadnum, lump);
DEH_LoadDehackedLumpPwad(wadnum, lump); }
else if (memcmp(lump_p->name,"MAINCFG",8)==0) // Check for MAINCFG
{
CONS_Printf(M_GetText("Loading main config from %s\n"), wadfiles[wadnum]->filename);
DEH_LoadDehackedLumpPwad(wadnum, lump);
}
else if (memcmp(lump_p->name,"OBJCTCFG",8)==0) // Check for OBJCTCFG
{
CONS_Printf(M_GetText("Loading object config from %s\n"), wadfiles[wadnum]->filename);
DEH_LoadDehackedLumpPwad(wadnum, lump);
}
} }
#ifdef SCANTHINGS #ifdef SCANTHINGS

View file

@ -632,7 +632,7 @@ void Y_Ticker(void)
boolean anybonuses = false; boolean anybonuses = false;
if (!intertic) // first time only if (!intertic) // first time only
S_ChangeMusic(mus_lclear, false); // don't loop it S_ChangeMusicInternal("lclear", false); // don't loop it
if (intertic < TICRATE) // one second pause before tally begins if (intertic < TICRATE) // one second pause before tally begins
return; return;
@ -693,7 +693,7 @@ void Y_Ticker(void)
if (!intertic) // first time only if (!intertic) // first time only
{ {
S_ChangeMusic(mus_lclear, false); // don't loop it S_ChangeMusicInternal("lclear", false); // don't loop it
tallydonetic = 0; tallydonetic = 0;
} }
@ -754,7 +754,7 @@ void Y_Ticker(void)
else if (intertype == int_match || intertype == int_ctf || intertype == int_teammatch) // match else if (intertype == int_match || intertype == int_ctf || intertype == int_teammatch) // match
{ {
if (!intertic) // first time only if (!intertic) // first time only
S_ChangeMusic(mus_racent, true); // loop it S_ChangeMusicInternal("racent", true); // loop it
// If a player has left or joined, recalculate scores. // If a player has left or joined, recalculate scores.
if (data.match.numplayers != D_NumPlayers()) if (data.match.numplayers != D_NumPlayers())
@ -763,7 +763,7 @@ void Y_Ticker(void)
else if (intertype == int_race || intertype == int_classicrace) // race else if (intertype == int_race || intertype == int_classicrace) // race
{ {
if (!intertic) // first time only if (!intertic) // first time only
S_ChangeMusic(mus_racent, true); // loop it S_ChangeMusicInternal("racent", true); // loop it
// Don't bother recalcing for race. It doesn't make as much sense. // Don't bother recalcing for race. It doesn't make as much sense.
} }