diff --git a/.travis.yml b/.travis.yml
index c652584f..54c5901d 100644
--- a/.travis.yml
+++ b/.travis.yml
@@ -3,13 +3,19 @@ sudo: required
dist: trusty
env:
-- CFLAGS=-Wno-absolute-value -Werror
+- CFLAGS=-Wall -W -Werror
+
+os:
+ - linux
+ - osx
compiler:
- gcc
- clang
cache:
+ apt: true
+ ccache: true
directories:
- $HOME/srb2_cache
@@ -30,4 +36,10 @@ before_script:
- cd build
- 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
diff --git a/SRB2.cbp b/SRB2.cbp
index 5a03955b..43696ee2 100644
--- a/SRB2.cbp
+++ b/SRB2.cbp
@@ -3293,23 +3293,6 @@ HW3SOUND for 3D hardware sound support
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
diff --git a/appveyor.yml b/appveyor.yml
index 4edcd7a7..3ddec6df 100644
--- a/appveyor.yml
+++ b/appveyor.yml
@@ -11,6 +11,7 @@ environment:
SDL2_MIXER_URL: https://www.libsdl.org/projects/SDL_mixer/release/SDL2_mixer-devel-2.0.1-mingw.tar.gz
SDL2_MIXER_ARCHIVE: SDL2_mixer-devel-2.0.1-mingw.tar
SDL2_MIXER_MOVE: SDL2_mixer-2.0.1\i686-w64-mingw32
+ CFLAGS: -Wall -W -Werror
cache:
- SDL2-devel-2.0.4-mingw.tar.gz
diff --git a/cmake/Modules/FindGME.cmake b/cmake/Modules/FindGME.cmake
index 3b0c68de..ea80af45 100644
--- a/cmake/Modules/FindGME.cmake
+++ b/cmake/Modules/FindGME.cmake
@@ -6,16 +6,16 @@ find_path(GME_INCLUDE_DIR
NAMES gme.h
PATHS
${GME_PKGCONF_INCLUDE_DIRS}
- /usr/include/gme
- /usr/local/include/gme
+ "/usr/include/gme"
+ "/usr/local/include/gme"
)
find_library(GME_LIBRARY
NAMES gme
PATHS
${GME_PKGCONF_LIBRARY_DIRS}
- /usr/lib
- /usr/local/lib
+ "/usr/lib"
+ "/usr/local/lib"
)
set(GME_PROCESS_INCLUDES GME_INCLUDE_DIR)
diff --git a/comptime.bat b/comptime.bat
index 9e127f00..0c7ea06d 100644
--- a/comptime.bat
+++ b/comptime.bat
@@ -1,4 +1,4 @@
-@ECHO OFF
+@echo off
set BRA=Unknown
set REV=illegal
@@ -13,20 +13,20 @@ goto filwri
:gitrev
set GIT=%2
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 HEAD`) DO @SET REV=%%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
set REV=%REV:~0,8%
goto filwri
:svnrev
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%
goto filwri
:filwri
-ECHO // Do not edit! This file was autogenerated > %1\comptime.h
-ECHO // by the %0 batch file >> %1\comptime.h
-ECHO // >> %1\comptime.h
-ECHO const char* compbranch = "%BRA%"; >> %1\comptime.h
-ECHO const char* comprevision = "%REV%"; >> %1\comptime.h
+echo // Do not edit! This file was autogenerated > %1\comptime.h
+echo // by the %0 batch file >> %1\comptime.h
+echo // >> %1\comptime.h
+echo const char* compbranch = "%BRA%"; >> %1\comptime.h
+echo const char* comprevision = "%REV%"; >> %1\comptime.h
diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt
index 54a08ea0..035b4655 100644
--- a/src/CMakeLists.txt
+++ b/src/CMakeLists.txt
@@ -139,7 +139,6 @@ set(SRB2_CORE_RENDER_SOURCES
set(SRB2_CORE_GAME_SOURCES
p_ceilng.c
p_enemy.c
- p_fab.c
p_floor.c
p_inter.c
p_lights.c
@@ -316,6 +315,7 @@ if(${SRB2_CONFIG_HAVE_GME})
find_package(GME)
if(${GME_FOUND})
set(SRB2_HAVE_GME ON)
+ add_definitions(-DHAVE_LIBGME)
else()
message(WARNING "You have specified that GME is available but it was not found.")
endif()
diff --git a/src/Makefile b/src/Makefile
index bee60804..0c034143 100644
--- a/src/Makefile
+++ b/src/Makefile
@@ -262,9 +262,7 @@ else
OBJS+=$(OBJDIR)/hw3sound.o
endif
-ifndef NOVERSION
OPTS += -DCOMPVERSION
-endif
ifndef NONX86
ifndef GCC29
@@ -439,7 +437,6 @@ OBJS:=$(i_main_o) \
$(OBJDIR)/info.o \
$(OBJDIR)/p_ceilng.o \
$(OBJDIR)/p_enemy.o \
- $(OBJDIR)/p_fab.o \
$(OBJDIR)/p_floor.o \
$(OBJDIR)/p_inter.o \
$(OBJDIR)/p_lights.o \
@@ -551,15 +548,11 @@ cleandep:
$(REMOVE) comptime.h
pre-build:
-ifdef NOVERSION
- -@touch comptime.c
-else
ifdef WINDOWSHELL
-..\comptime.bat .
else
-@../comptime.sh .
endif
-endif
clean:
$(REMOVE) *~ *.flc
diff --git a/src/am_map.c b/src/am_map.c
index 70714fac..97b7c516 100644
--- a/src/am_map.c
+++ b/src/am_map.c
@@ -30,9 +30,7 @@ static const UINT8 REDRANGE = 16;
static const UINT8 GRAYS = (1*16);
static const UINT8 GRAYSRANGE = 16;
static const UINT8 BROWNS = (3*16);
-static const UINT8 BROWNRANGE = 16;
static const UINT8 YELLOWS = (7*16);
-static const UINT8 YELLOWRANGE = 8;
static const UINT8 GREENS = (10*16);
static const UINT8 GREENRANGE = 16;
static const UINT8 DBLACK = 31;
@@ -41,11 +39,8 @@ static const UINT8 DWHITE = 0;
static const UINT8 NOCLIMBREDS = 248;
static const UINT8 NOCLIMBREDRANGE = 8;
static const UINT8 NOCLIMBGRAYS = 204;
-static const UINT8 NOCLIMBGRAYSRANGE = 4;
static const UINT8 NOCLIMBBROWNS = (2*16);
-static const UINT8 NOCLIMBBROWNRANGE = 16;
static const UINT8 NOCLIMBYELLOWS = (11*16);
-static const UINT8 NOCLIMBYELLOWRANGE = 8;
#ifdef _NDS
@@ -67,15 +62,10 @@ static const UINT8 NOCLIMBYELLOWRANGE = 8;
#define TSWALLCOLORS GRAYS
#define TSWALLRANGE GRAYSRANGE
#define NOCLIMBTSWALLCOLORS NOCLIMBGRAYS
-#define NOCLIMBTSWALLRANGE NOCLIMBGRAYSRANGE
#define FDWALLCOLORS BROWNS
-#define FDWALLRANGE BROWNRANGE
#define NOCLIMBFDWALLCOLORS NOCLIMBBROWNS
-#define NOCLIMBFDWALLRANGE NOCLIMBBROWNRANGE
#define CDWALLCOLORS YELLOWS
-#define CDWALLRANGE YELLOWRANGE
#define NOCLIMBCDWALLCOLORS NOCLIMBYELLOWS
-#define NOCLIMBCDWALLRANGE NOCLIMBYELLOWRANGE
#define THINGCOLORS GREENS
#define THINGRANGE GREENRANGE
#define SECRETWALLCOLORS WALLCOLORS
@@ -255,29 +245,6 @@ static AMDRAWFLINEFUNC AM_drawFline;
static void AM_drawFline_soft(const fline_t *fl, INT32 color);
-/** Calculates the slope and slope according to the x-axis of a line
- * segment in map coordinates (with the upright y-axis and all) so
- * that it can be used with the braindead drawing stuff.
- *
- * \param ml The line segment.
- * \param is Holds the result.
- */
-static inline void AM_getIslope(const mline_t *ml, islope_t *is)
-{
- INT32 dx, dy;
-
- dy = ml->a.y - ml->b.y;
- dx = ml->b.x - ml->a.x;
- if (!dy)
- is->islp = (dx < 0 ? -INT32_MAX : INT32_MAX);
- else
- is->islp = FixedDiv(dx, dy);
- if (!dx)
- is->slp = (dy < 0 ? -INT32_MAX : INT32_MAX);
- else
- is->slp = FixedDiv(dy, dx);
-}
-
static void AM_activateNewScale(void)
{
m_x += m_w/2;
diff --git a/src/b_bot.c b/src/b_bot.c
index 3072b1d7..e9b00497 100644
--- a/src/b_bot.c
+++ b/src/b_bot.c
@@ -49,7 +49,7 @@ static inline void B_BuildTailsTiccmd(mobj_t *sonic, mobj_t *tails, ticcmd_t *cm
if (sonic->player->pflags & (PF_MACESPIN|PF_ITEMHANG))
{
cmd->forwardmove = sonic->player->cmd.forwardmove;
- cmd->angleturn = abs((tails->angle - sonic->angle))>>16;
+ cmd->angleturn = abs((signed)(tails->angle - sonic->angle))>>16;
if (sonic->angle < tails->angle)
cmd->angleturn = -cmd->angleturn;
} else if (dist > FixedMul(512*FRACUNIT, tails->scale))
diff --git a/src/config.h.in b/src/config.h.in
index 5cd75fa5..eef4fec1 100644
--- a/src/config.h.in
+++ b/src/config.h.in
@@ -15,7 +15,9 @@
#define ASSET_HASH_PLAYER_DTA "${SRB2_ASSET_player.dta_HASH}"
#define ASSET_HASH_RINGS_DTA "${SRB2_ASSET_rings.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}"
+#endif
#define SRB2_COMP_REVISION "${SRB2_COMP_REVISION}"
#define SRB2_COMP_BRANCH "${SRB2_COMP_BRANCH}"
@@ -26,10 +28,16 @@
#else
+/* Manually defined asset hashes for non-CMake builds
+ * Last updated 2000 / 00 / 00
+ */
#define ASSET_HASH_SRB2_SRB "c1b9577687f8a795104aef4600720ea7"
#define ASSET_HASH_ZONES_DTA "303838c6c534d9540288360fa49cca60"
#define ASSET_HASH_PLAYER_DTA "cfca0f1c73023cbbd8f844f45480f799"
#define ASSET_HASH_RINGS_DTA "85901ad4bf94637e5753d2ac2c03ea26"
+#ifdef USE_PATCH_DTA
+#define ASSET_HASH_PATCH_DTA "0c66790502e648bfce90fdc5bb15722e"
+#endif
#endif
#endif
diff --git a/src/d_clisrv.c b/src/d_clisrv.c
index c0179ca1..d20c0e5e 100644
--- a/src/d_clisrv.c
+++ b/src/d_clisrv.c
@@ -2935,9 +2935,9 @@ static void Got_AddPlayer(UINT8 **p, INT32 playernum)
if (botingame)
players[newplayernum].bot = 1;
// Same goes for player 2 when relevant
- players[newplayernum].pflags &= ~(/*PF_FLIPCAM|*/PF_ANALOGMODE);
- //if (cv_flipcam2.value)
- //players[newplayernum].pflags |= PF_FLIPCAM;
+ players[newplayernum].pflags &= ~(PF_FLIPCAM|PF_ANALOGMODE);
+ if (cv_flipcam2.value)
+ players[newplayernum].pflags |= PF_FLIPCAM;
if (cv_analog2.value)
players[newplayernum].pflags |= PF_ANALOGMODE;
}
diff --git a/src/d_main.c b/src/d_main.c
index 3918d811..c9282be7 100644
--- a/src/d_main.c
+++ b/src/d_main.c
@@ -221,10 +221,7 @@ gamestate_t wipegamestate = GS_LEVEL;
static void D_Display(void)
{
- static boolean menuactivestate = false;
- static gamestate_t oldgamestate = -1;
- boolean redrawsbar = false;
-
+ boolean forcerefresh = false;
static boolean wipe = false;
INT32 wipedefindex = 0;
@@ -245,23 +242,15 @@ static void D_Display(void)
if (setsizeneeded)
{
R_ExecuteSetViewSize();
- oldgamestate = -1; // force background redraw
- redrawsbar = true;
+ forcerefresh = true; // force background redraw
}
- // save the current screen if about to wipe
- if (gamestate != wipegamestate)
- {
- wipe = true;
- F_WipeStartScreen();
- }
- else
- wipe = false;
-
// draw buffered stuff to screen
// Used only by linux GGI version
I_UpdateNoBlit();
+ // save the current screen if about to wipe
+ wipe = (gamestate != wipegamestate);
if (wipe)
{
// set for all later
@@ -280,6 +269,7 @@ static void D_Display(void)
if (gamestate != GS_LEVEL // fades to black on its own timing, always
&& wipedefs[wipedefindex] != UINT8_MAX)
{
+ F_WipeStartScreen();
V_DrawFill(0, 0, BASEVIDWIDTH, BASEVIDHEIGHT, 31);
F_WipeEndScreen();
F_RunWipe(wipedefs[wipedefindex], gamestate != GS_TIMEATTACK);
@@ -298,8 +288,6 @@ static void D_Display(void)
HU_Erase();
if (automapactive)
AM_Drawer();
- if (wipe || menuactivestate || (rendermode != render_soft && rendermode != render_none) || vid.recalc)
- redrawsbar = true;
break;
case GS_INTERMISSION:
@@ -357,11 +345,6 @@ static void D_Display(void)
// see if the border needs to be initially drawn
if (gamestate == GS_LEVEL)
{
-#if 0
- if (oldgamestate != GS_LEVEL)
- R_FillBackScreen(); // draw the pattern into the back screen
-#endif
-
// draw the view directly
if (!automapactive && !dedicated && cv_renderview.value)
{
@@ -417,17 +400,17 @@ static void D_Display(void)
lastdraw = false;
}
- ST_Drawer(redrawsbar);
+ ST_Drawer();
HU_Drawer();
}
// change gamma if needed
- if (gamestate != oldgamestate && gamestate != GS_LEVEL)
+ // (GS_LEVEL handles this already due to level-specific palettes)
+ if (forcerefresh && gamestate != GS_LEVEL)
V_SetPalette(0);
- menuactivestate = menuactive;
- oldgamestate = wipegamestate = gamestate;
+ wipegamestate = gamestate;
// draw pause pic
if (paused && cv_showhud.value && (!menuactive || netgame))
@@ -450,15 +433,22 @@ static void D_Display(void)
CON_Drawer();
M_Drawer(); // menu is drawn even on top of everything
+ // focus lost moved to M_Drawer
- // focus lost notification goes on top of everything, even the former everything
- if (window_notinfocus)
+ //
+ // wipe update
+ //
+ if (wipe)
{
- M_DrawTextBox((BASEVIDWIDTH/2) - (60), (BASEVIDHEIGHT/2) - (16), 13, 2);
- if (gamestate == GS_LEVEL && (P_AutoPause() || paused))
- V_DrawCenteredString(BASEVIDWIDTH/2, (BASEVIDHEIGHT/2) - (4), V_YELLOWMAP, "Game Paused");
- else
- V_DrawCenteredString(BASEVIDWIDTH/2, (BASEVIDHEIGHT/2) - (4), V_YELLOWMAP, "Focus Lost");
+ // note: moved up here because NetUpdate does input changes
+ // and input during wipe tends to mess things up
+ wipedefindex += WIPEFINALSHIFT;
+
+ if (rendermode != render_none)
+ {
+ F_WipeEndScreen();
+ F_RunWipe(wipedefs[wipedefindex], gamestate != GS_TIMEATTACK);
+ }
}
NetUpdate(); // send out any new accumulation
@@ -493,18 +483,6 @@ static void D_Display(void)
}
I_FinishUpdate(); // page flip or blit buffer
- return;
- }
-
- //
- // wipe update
- //
- wipedefindex += WIPEFINALSHIFT;
-
- if (rendermode != render_none)
- {
- F_WipeEndScreen();
- F_RunWipe(wipedefs[wipedefindex], gamestate != GS_TIMEATTACK);
}
}
@@ -513,7 +491,6 @@ static void D_Display(void)
// =========================================================================
tic_t rendergametic;
-boolean supdate;
void D_SRB2Loop(void)
{
@@ -604,7 +581,6 @@ void D_SRB2Loop(void)
// Update display, next frame, with current state.
D_Display();
- supdate = false;
if (moviemode)
M_SaveFrame();
@@ -841,8 +817,10 @@ static void IdentifyVersion(void)
// Add the weapons
D_AddFile(va(pandf,srb2waddir,"rings.dta"));
+#ifdef USE_PATCH_DTA
// 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)
{
@@ -1133,12 +1111,18 @@ void D_SRB2Main(void)
W_VerifyFileMD5(1, ASSET_HASH_ZONES_DTA); // zones.dta
W_VerifyFileMD5(2, ASSET_HASH_PLAYER_DTA); // player.dta
W_VerifyFileMD5(3, ASSET_HASH_RINGS_DTA); // rings.dta
- //W_VerifyFileMD5(4, "0c66790502e648bfce90fdc5bb15722e"); // patch.dta
- // 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.
+#ifdef USE_PATCH_DTA
+ W_VerifyFileMD5(4, ASSET_HASH_PATCH_DTA); // patch.dta
#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();
diff --git a/src/d_main.h b/src/d_main.h
index 800b61f5..c5ce19ef 100644
--- a/src/d_main.h
+++ b/src/d_main.h
@@ -17,7 +17,6 @@
#include "d_event.h"
#include "w_wad.h" // for MAX_WADFILES
-extern boolean supdate;
extern boolean advancedemo;
// make sure not to write back the config until it's been correctly loaded
diff --git a/src/d_netcmd.c b/src/d_netcmd.c
index 02bc464e..5eb35283 100644
--- a/src/d_netcmd.c
+++ b/src/d_netcmd.c
@@ -1854,10 +1854,10 @@ static void Got_Pause(UINT8 **cp, INT32 playernum)
if (paused)
{
if (!menuactive || netgame)
- S_PauseSound();
+ S_PauseAudio();
}
else
- S_ResumeSound();
+ S_ResumeAudio();
}
}
@@ -3761,50 +3761,66 @@ static void Command_Displayplayer_f(void)
static void Command_Tunes_f(void)
{
const char *tunearg;
- UINT16 tune, track = 0;
+ UINT16 tunenum, track = 0;
const size_t argc = COM_Argc();
if (argc < 2) //tunes slot ...
{
- CONS_Printf("tunes