diff --git a/.travis.yml b/.travis.yml
index f1996215b..d728758ed 100644
--- a/.travis.yml
+++ b/.travis.yml
@@ -2,19 +2,199 @@ language: c
sudo: required
dist: trusty
-env:
-- CFLAGS=-Wall -W -Werror
-
-os:
- - linux
- - osx
-
-compiler:
- - gcc
- - clang
+matrix:
+ include:
+ - os: linux
+ addons:
+ apt:
+ packages:
+ - libsdl2-mixer-dev
+ - libpng-dev
+ - libgl1-mesa-dev
+ - libgme-dev
+ - p7zip-full
+ - gcc-4.4
+ compiler: gcc-4.4
+ #gcc-4.4 (Ubuntu/Linaro 4.4.7-8ubuntu1) 4.4.7
+ - os: linux
+ addons:
+ apt:
+ packages:
+ - libsdl2-mixer-dev
+ - libpng-dev
+ - libgl1-mesa-dev
+ - libgme-dev
+ - p7zip-full
+ - gcc-4.6
+ compiler: gcc-4.6
+ #gcc-4.6 (Ubuntu/Linaro 4.6.4-6ubuntu2) 4.6.4
+ - os: linux
+ addons:
+ apt:
+ packages:
+ - libsdl2-mixer-dev
+ - libpng-dev
+ - libgl1-mesa-dev
+ - libgme-dev
+ - p7zip-full
+ - gcc-4.7
+ compiler: gcc-4.7
+ #gcc-4.7
+ - os: linux
+ compiler: gcc
+ #gcc (Ubuntu 4.8.4-2ubuntu1~14.04) 4.8.4
+ - os: linux
+ addons:
+ apt:
+ sources:
+ - ubuntu-toolchain-r-test
+ packages:
+ - libsdl2-mixer-dev
+ - libpng-dev
+ - libgl1-mesa-dev
+ - libgme-dev
+ - p7zip-full
+ - gcc-4.8
+ compiler: gcc-4.8
+ #gcc-4.8 (Ubuntu 4.8.5-2ubuntu1~14.04.1) 4.8.5
+ - os: linux
+ addons:
+ apt:
+ sources:
+ - ubuntu-toolchain-r-test
+ packages:
+ - libsdl2-mixer-dev
+ - libpng-dev
+ - libgl1-mesa-dev
+ - libgme-dev
+ - p7zip-full
+ - gcc-4.9
+ compiler: gcc-4.9
+ #gcc-4.9 (Ubuntu 4.9.3-8ubuntu2~14.04) 4.9.3
+ - os: linux
+ addons:
+ apt:
+ sources:
+ - ubuntu-toolchain-r-test
+ packages:
+ - libsdl2-mixer-dev
+ - libpng-dev
+ - libgl1-mesa-dev
+ - libgme-dev
+ - p7zip-full
+ - gcc-5
+ compiler: gcc-5
+ #gcc-5 (Ubuntu 5.3.0-3ubuntu1~14.04) 5.3.0 20151204
+ - os: linux
+ addons:
+ apt:
+ sources:
+ - ubuntu-toolchain-r-test
+ packages:
+ - libsdl2-mixer-dev
+ - libpng-dev
+ - libgl1-mesa-dev
+ - libgme-dev
+ - p7zip-full
+ - gcc-6
+ compiler: gcc-6
+ env: WFLAGS="-Wno-tautological-compare"
+ #gcc-6 (Ubuntu 6.1.1-3ubuntu11~14.04.1) 6.1.1 20160511
+ - os: linux
+ compiler: clang
+ #clang version 3.5.0 (tags/RELEASE_350/final)
+ - os: linux
+ addons:
+ apt:
+ sources:
+ - llvm-toolchain-precise-3.5
+ packages:
+ - libsdl2-mixer-dev
+ - libpng-dev
+ - libgl1-mesa-dev
+ - libgme-dev
+ - p7zip-full
+ - clang-3.5
+ compiler: clang-3.5
+ #Ubuntu clang version 3.5.0-4ubuntu2~trusty2 (tags/RELEASE_350/final) (based on LLVM 3.5.0)
+ - os: linux
+ addons:
+ apt:
+ sources:
+ - llvm-toolchain-precise-3.6
+ - ubuntu-toolchain-r-test
+ packages:
+ - libsdl2-mixer-dev
+ - libpng-dev
+ - libgl1-mesa-dev
+ - libgme-dev
+ - p7zip-full
+ - clang-3.6
+ compiler: clang-3.6
+ #Ubuntu clang version 3.6.2-svn240577-1~exp1 (branches/release_36) (based on LLVM 3.6.2)
+ - os: linux
+ addons:
+ apt:
+ sources:
+ - llvm-toolchain-precise-3.7
+ - ubuntu-toolchain-r-test
+ packages:
+ - libsdl2-mixer-dev
+ - libpng-dev
+ - libgl1-mesa-dev
+ - libgme-dev
+ - p7zip-full
+ - clang-3.7
+ compiler: clang-3.7
+ #Ubuntu clang version 3.7.1-svn253571-1~exp1 (branches/release_37) (based on LLVM 3.7.1)
+ - os: linux
+ addons:
+ apt:
+ sources:
+ - llvm-toolchain-precise-3.8
+ - ubuntu-toolchain-r-test
+ packages:
+ - libsdl2-mixer-dev
+ - libpng-dev
+ - libgl1-mesa-dev
+ - libgme-dev
+ - p7zip-full
+ - clang-3.8
+ compiler: clang-3.8
+ #clang version 3.8.1-svn271127-1~exp1 (branches/release_38)
+ - os: osx
+ osx_image: beta-xcode6.1
+ #Apple LLVM version 6.0 (clang-600.0.54) (based on LLVM 3.5svn)
+ - os: osx
+ osx_image: beta-xcode6.2
+ compiler: gcc
+ #Apple LLVM version 6.0 (clang-600.0.57) (based on LLVM 3.5svn)
+# - os: osx
+# osx_image: beta-xcode6.3
+# #I think xcode.6.3 VM is broken, it does not boot
+ - os: osx
+ osx_image: xcode6.4
+ #Apple LLVM version 6.1.0 (clang-602.0.53) (based on LLVM 3.6.0svn)
+ - os: osx
+ osx_image: xcode7
+ #Apple LLVM version 7.0.0 (clang-700.0.72)
+ - os: osx
+ osx_image: xcode7.1
+ #Apple LLVM version 7.0.0 (clang-700.1.76)
+ - os: osx
+ osx_image: xcode7.2
+ #Apple LLVM version 7.0.2 (clang-700.1.81)
+ - os: osx
+ osx_image: xcode7.3
+ #Apple LLVM version 7.3.0 (clang-703.0.31)
+ allow_failures:
+ - compiler: clang-3.5
+ - compiler: clang-3.6
+ - compiler: clang-3.7
+ - compiler: clang-3.8
cache:
- apt: true
+ apt: true
ccache: true
directories:
- $HOME/srb2_cache
@@ -33,11 +213,14 @@ before_script:
- 7z x $HOME/srb2_cache/SRB2-v2115-assets-2.7z -oassets
- mkdir build
- cd build
- - cmake ..
+ - export CFLAGS="-Wall -W -Werror $WFLAGS"
+ - export CCACHE_COMPRESS=true
+ - cmake .. -DCMAKE_BUILD_TYPE=Release
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 brew install sdl2_mixer game-music-emu p7zip; fi
+ - if [[ "$TRAVIS_OS_NAME" == "osx" ]]; then brew install cmake||true; 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
- mkdir -p $HOME/srb2_cache
diff --git a/SRB2.cbp b/SRB2.cbp
index 43696ee2e..99a712264 100644
--- a/SRB2.cbp
+++ b/SRB2.cbp
@@ -2815,6 +2815,39 @@ HW3SOUND for 3D hardware sound support
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/appveyor.yml b/appveyor.yml
index fd949dbb3..e0ee99c61 100644
--- a/appveyor.yml
+++ b/appveyor.yml
@@ -1,4 +1,4 @@
-version: 2.1.14.{branch}-{build}
+version: 2.1.16.{branch}-{build}
os: MinGW
environment:
@@ -75,6 +75,9 @@ deploy:
folder: appveyor
application:
active_mode: false
+ on:
+ branch: master
+ appveyor_repo_tag: true
on_finish:
diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt
index 035b46556..ba354c289 100644
--- a/src/CMakeLists.txt
+++ b/src/CMakeLists.txt
@@ -22,6 +22,7 @@ set(SRB2_CORE_SOURCES
i_tcp.c
info.c
lzf.c
+ m_aatree.c
m_anigif.c
m_argv.c
m_bbox.c
@@ -83,6 +84,7 @@ set(SRB2_CORE_HEADERS
info.h
keys.h
lzf.h
+ m_aatree.h
m_anigif.h
m_argv.h
m_bbox.h
diff --git a/src/Makefile b/src/Makefile
index f43e3c24d..ce4b569ee 100644
--- a/src/Makefile
+++ b/src/Makefile
@@ -189,6 +189,10 @@ ifdef FREEBSD
UNIXCOMMON=1
endif
+ifdef MACOSX
+UNIXCOMMON=1
+endif
+
ifdef NDS
NOPNG=1
NONET=1
@@ -366,7 +370,12 @@ ifdef DEBUGMODE
# build with debugging information
WINDRESFLAGS = -D_DEBUG
- CFLAGS+=-O0 -Wall -DPARANOIA -DRANGECHECK
+ifdef GCC48
+ CFLAGS+=-Og
+else
+ CFLAGS+=-O0
+endif
+ CFLAGS+= -Wall -DPARANOIA -DRANGECHECK
else
@@ -424,6 +433,7 @@ OBJS:=$(i_main_o) \
$(OBJDIR)/hu_stuff.o \
$(OBJDIR)/y_inter.o \
$(OBJDIR)/st_stuff.o \
+ $(OBJDIR)/m_aatree.o \
$(OBJDIR)/m_anigif.o \
$(OBJDIR)/m_argv.o \
$(OBJDIR)/m_bbox.o \
@@ -588,11 +598,15 @@ ifndef WINDOWSHELL
-$(GZIP) $(GZIP_OPT2) $(BIN)/$(DBGNAME).txt
endif
endif
+
+# mac os x lsdlsrb2 does not like objcopy
+ifndef MACOSX
ifndef PSP
$(OBJCOPY) $(BIN)/$(EXENAME) $(BIN)/$(DBGNAME)
$(OBJCOPY) --strip-debug $(BIN)/$(EXENAME)
-$(OBJCOPY) --add-gnu-debuglink=$(BIN)/$(DBGNAME) $(BIN)/$(EXENAME)
endif
+endif
ifndef NOUPX
-$(UPX) $(UPX_OPTS) $(BIN)/$(EXENAME)
endif
@@ -740,6 +754,11 @@ $(OBJDIR)/%.o: %.c
$(OBJDIR)/%.o: $(INTERFACE)/%.c
$(CC) $(CFLAGS) $(WFLAGS) -c $< -o $@
+ifdef MACOSX
+$(OBJDIR)/%.o: sdl/macosx/%.c
+ $(CC) $(CFLAGS) $(WFLAGS) -c $< -o $@
+endif
+
$(OBJDIR)/%.o: hardware/%.c
$(CC) $(CFLAGS) $(WFLAGS) -c $< -o $@
diff --git a/src/Makefile.cfg b/src/Makefile.cfg
index 347efa5e4..72404becc 100644
--- a/src/Makefile.cfg
+++ b/src/Makefile.cfg
@@ -406,6 +406,15 @@ else
WINDRES=windres
endif
+# because Apple screws with us on this
+# need to get bintools from homebrew
+ifdef MACOSX
+ CC=clang
+ CXX=clang
+ OBJCOPY=gobjcopy
+ OBJDUMP=gobjdump
+endif
+
OBJDUMP_OPTS?=--wide --source --line-numbers
LD=$(CC)
diff --git a/src/am_map.c b/src/am_map.c
index 90f815729..b28cecf11 100644
--- a/src/am_map.c
+++ b/src/am_map.c
@@ -999,7 +999,7 @@ static inline void AM_drawWalls(void)
static mline_t l;
#ifdef ESLOPE
fixed_t frontf1,frontf2, frontc1, frontc2; // front floor/ceiling ends
- fixed_t backf1, backf2, backc1, backc2; // back floor ceiling ends
+ fixed_t backf1 = 0, backf2 = 0, backc1 = 0, backc2 = 0; // back floor ceiling ends
#endif
for (i = 0; i < numlines; i++)
diff --git a/src/blua/lcode.c b/src/blua/lcode.c
index 743a094a8..5c7fed454 100644
--- a/src/blua/lcode.c
+++ b/src/blua/lcode.c
@@ -270,6 +270,7 @@ static int boolK (FuncState *fs, int b) {
static int nilK (FuncState *fs) {
TValue k, v;
+ setbvalue(&v, 0);
setnilvalue(&v);
/* cannot use nil as key; instead use table itself to represent nil */
sethvalue(fs->L, &k, fs->h);
diff --git a/src/blua/ltablib.c b/src/blua/ltablib.c
index 2e50ce0ae..2dd157155 100644
--- a/src/blua/ltablib.c
+++ b/src/blua/ltablib.c
@@ -137,7 +137,7 @@ static void addfield (lua_State *L, luaL_Buffer *b, int i) {
if (!lua_isstring(L, -1))
luaL_error(L, "invalid value (%s) at index %d in table for "
LUA_QL("concat"), luaL_typename(L, -1), i);
- luaL_addvalue(b);
+ luaL_addvalue(b);
}
diff --git a/src/blua/lvm.c b/src/blua/lvm.c
index a921d4437..b654613f4 100644
--- a/src/blua/lvm.c
+++ b/src/blua/lvm.c
@@ -732,7 +732,8 @@ void luaV_execute (lua_State *L, int nexeccalls) {
luaG_runerror(L, LUA_QL("for") " limit must be a number");
else if (!tonumber(pstep, ra+2))
luaG_runerror(L, LUA_QL("for") " step must be a number");
- setnvalue(ra, luai_numsub(nvalue(ra), nvalue(pstep)));
+ if (ra && pstep)
+ setnvalue(ra, luai_numsub(nvalue(ra), nvalue(pstep)));
dojump(L, pc, GETARG_sBx(i));
continue;
}
diff --git a/src/command.c b/src/command.c
index 84d777acf..a15471c83 100644
--- a/src/command.c
+++ b/src/command.c
@@ -966,9 +966,11 @@ void CV_RegisterVar(consvar_t *variable)
// check net variables
if (variable->flags & CV_NETVAR)
{
+ const consvar_t *netvar;
variable->netid = CV_ComputeNetid(variable->name);
- if (CV_FindNetVar(variable->netid))
- I_Error("Variables %s and %s have same netid\n", variable->name, CV_FindNetVar(variable->netid)->name);
+ netvar = CV_FindNetVar(variable->netid);
+ if (netvar)
+ I_Error("Variables %s and %s have same netid\n", variable->name, netvar->name);
}
// link the variable in
diff --git a/src/d_clisrv.c b/src/d_clisrv.c
index f5a063875..e49f37e2a 100644
--- a/src/d_clisrv.c
+++ b/src/d_clisrv.c
@@ -531,6 +531,7 @@ static inline void resynch_write_player(resynch_pak *rsp, const size_t i)
rsp->deadtimer = players[i].deadtimer;
rsp->exiting = (tic_t)LONG(players[i].exiting);
rsp->homing = players[i].homing;
+ rsp->dashmode = (tic_t)LONG(players[i].dashmode);
rsp->skidtime = (tic_t)LONG(players[i].skidtime);
rsp->cmomx = (fixed_t)LONG(players[i].cmomx);
rsp->cmomy = (fixed_t)LONG(players[i].cmomy);
@@ -657,6 +658,7 @@ static void resynch_read_player(resynch_pak *rsp)
players[i].deadtimer = rsp->deadtimer;
players[i].exiting = (tic_t)LONG(rsp->exiting);
players[i].homing = rsp->homing;
+ players[i].dashmode = (tic_t)LONG(rsp->dashmode);
players[i].skidtime = (tic_t)LONG(rsp->skidtime);
players[i].cmomx = (fixed_t)LONG(rsp->cmomx);
players[i].cmomy = (fixed_t)LONG(rsp->cmomy);
diff --git a/src/d_clisrv.h b/src/d_clisrv.h
index 14b590926..f9e33dc4c 100644
--- a/src/d_clisrv.h
+++ b/src/d_clisrv.h
@@ -191,6 +191,7 @@ typedef struct
INT32 deadtimer;
tic_t exiting;
UINT8 homing;
+ tic_t dashmode;
tic_t skidtime;
fixed_t cmomx;
fixed_t cmomy;
diff --git a/src/d_main.h b/src/d_main.h
index 88387a579..6dc273b15 100644
--- a/src/d_main.h
+++ b/src/d_main.h
@@ -41,7 +41,7 @@ void D_SRB2Main(void);
// Called by IO functions when input is detected.
void D_PostEvent(const event_t *ev);
#ifndef DOXYGEN
-void D_PostEvent_end(void); // delimiter for locking memory
+FUNCMATH void D_PostEvent_end(void); // delimiter for locking memory
#endif
void D_ProcessEvents(void);
diff --git a/src/d_netcmd.c b/src/d_netcmd.c
index b39036596..4b45ef1a7 100644
--- a/src/d_netcmd.c
+++ b/src/d_netcmd.c
@@ -2598,11 +2598,13 @@ static void D_MD5PasswordPass(const UINT8 *buffer, size_t len, const char *salt,
memset(dest, 0, 16);
#else
XBOXSTATIC char tmpbuf[256];
+ const size_t sl = strlen(salt);
- if (len > 256-strlen(salt))
- len = 256-strlen(salt);
+ if (len > 256-sl)
+ len = 256-sl;
memcpy(tmpbuf, buffer, len);
- strcpy(&tmpbuf[len], salt);
+ memmove(&tmpbuf[len], salt, sl);
+ //strcpy(&tmpbuf[len], salt);
len += strlen(salt);
if (len < 256)
memset(&tmpbuf[len],0,256-len);
diff --git a/src/d_player.h b/src/d_player.h
index f2e6fe735..4a5d0e702 100644
--- a/src/d_player.h
+++ b/src/d_player.h
@@ -57,7 +57,8 @@ typedef enum
CA_FALLSWITCH,
CA_JUMPBOOST,
CA_AIRDRILL,
- CA_JUMPTHOK
+ CA_JUMPTHOK,
+ CA_DASHMODE
} charability_t;
//Secondary skin abilities
@@ -164,6 +165,7 @@ typedef enum
PA_EDGE,
PA_WALK,
PA_RUN,
+ PA_PEEL,
PA_PAIN,
PA_ROLL,
PA_SPRING,
@@ -351,6 +353,7 @@ typedef struct player_s
tic_t exiting; // Exitlevel timer
UINT8 homing; // Are you homing?
+ tic_t dashmode; // counter for dashmode ability
tic_t skidtime; // Skid timer
diff --git a/src/dehacked.c b/src/dehacked.c
index 5dd9c532c..9298a6ecf 100644
--- a/src/dehacked.c
+++ b/src/dehacked.c
@@ -3794,6 +3794,7 @@ static const char *const STATE_LIST[] = { // array length left dynamic for sanit
"S_PLAY_WAIT",
"S_PLAY_WALK",
"S_PLAY_RUN",
+ "S_PLAY_PEEL",
"S_PLAY_PAIN",
"S_PLAY_DEAD",
"S_PLAY_DRWN",
@@ -3819,6 +3820,7 @@ static const char *const STATE_LIST[] = { // array length left dynamic for sanit
"S_PLAY_SUPER_STND",
"S_PLAY_SUPER_WALK",
"S_PLAY_SUPER_RUN",
+ "S_PLAY_SUPER_PEEL",
"S_PLAY_SUPER_PAIN",
"S_PLAY_SUPER_STUN",
"S_PLAY_SUPER_DEAD",
@@ -5497,6 +5499,36 @@ static const char *const STATE_LIST[] = { // array length left dynamic for sanit
"S_RDIAG7",
"S_RDIAG8",
+ // Yellow Side Spring
+ "S_YHORIZ1",
+ "S_YHORIZ2",
+ "S_YHORIZ3",
+ "S_YHORIZ4",
+ "S_YHORIZ5",
+ "S_YHORIZ6",
+ "S_YHORIZ7",
+ "S_YHORIZ8",
+
+ // Red Side Spring
+ "S_RHORIZ1",
+ "S_RHORIZ2",
+ "S_RHORIZ3",
+ "S_RHORIZ4",
+ "S_RHORIZ5",
+ "S_RHORIZ6",
+ "S_RHORIZ7",
+ "S_RHORIZ8",
+
+ // Blue Side Spring
+ "S_BHORIZ1",
+ "S_BHORIZ2",
+ "S_BHORIZ3",
+ "S_BHORIZ4",
+ "S_BHORIZ5",
+ "S_BHORIZ6",
+ "S_BHORIZ7",
+ "S_BHORIZ8",
+
// Rain
"S_RAIN1",
"S_RAINRETURN",
@@ -6254,6 +6286,9 @@ static const char *const MOBJTYPE_LIST[] = { // array length left dynamic for s
"MT_REDSPRING",
"MT_YELLOWDIAG", // Yellow Diagonal Spring
"MT_REDDIAG", // Red Diagonal Spring
+ "MT_YELLOWHORIZ", // Yellow Side Spring
+ "MT_REDHORIZ", // Red Side Spring
+ "MT_BLUEHORIZ", // Blue Side Spring
// Interactive Objects
"MT_BUBBLES", // Bubble source
@@ -6714,12 +6749,14 @@ static const char *const MOBJEFLAG_LIST[] = {
NULL
};
+#ifdef HAVE_BLUA
static const char *const MAPTHINGFLAG_LIST[4] = {
NULL,
"OBJECTFLIP", // Reverse gravity flag for objects.
"OBJECTSPECIAL", // Special flag used with certain objects.
"AMBUSH" // Deaf monsters/do not react to sound.
};
+#endif
static const char *const PLAYERFLAG_LIST[] = {
// Flip camera angle with gravity flip prefrence.
@@ -6792,6 +6829,7 @@ static const char *const PLAYERFLAG_LIST[] = {
NULL // stop loop here.
};
+#ifdef HAVE_BLUA
// Linedef flags
static const char *const ML_LIST[16] = {
"IMPASSIBLE",
@@ -6811,6 +6849,7 @@ static const char *const ML_LIST[16] = {
"BOUNCY",
"TFERLINE"
};
+#endif
// This DOES differ from r_draw's Color_Names, unfortunately.
// Also includes Super colors
@@ -7137,6 +7176,7 @@ struct {
{"CA_JUMPBOOST",CA_JUMPBOOST},
{"CA_AIRDRILL",CA_AIRDRILL},
{"CA_JUMPTHOK",CA_JUMPTHOK},
+ {"CA_DASHMODE",CA_DASHMODE},
// Secondary
{"CA2_NONE",CA2_NONE}, // now slot 0!
{"CA2_SPINDASH",CA2_SPINDASH},
@@ -7187,6 +7227,7 @@ struct {
{"PA_EDGE",PA_EDGE},
{"PA_WALK",PA_WALK},
{"PA_RUN",PA_RUN},
+ {"PA_PEEL",PA_PEEL},
{"PA_PAIN",PA_PAIN},
{"PA_ROLL",PA_ROLL},
{"PA_SPRING",PA_SPRING},
@@ -7770,7 +7811,7 @@ fixed_t get_number(const char *word)
#endif
}
-void DEH_Check(void)
+void FUNCMATH DEH_Check(void)
{
#if defined(_DEBUG) || defined(PARANOIA)
const size_t dehstates = sizeof(STATE_LIST)/sizeof(const char*);
@@ -8305,6 +8346,9 @@ static inline int lib_getenum(lua_State *L)
} else if (fastcmp(word,"VERSIONSTRING")) {
lua_pushstring(L, VERSIONSTRING);
return 1;
+ } else if (fastcmp(word, "token")) {
+ lua_pushinteger(L, token);
+ return 1;
}
return 0;
diff --git a/src/doomdef.h b/src/doomdef.h
index 70ec8c0d1..4428ef617 100644
--- a/src/doomdef.h
+++ b/src/doomdef.h
@@ -213,7 +213,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.
// 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".
-#define MODVERSION 20
+#define MODVERSION 21
// =========================================================================
@@ -435,6 +435,12 @@ extern const char *compdate, *comptime, *comprevision, *compbranch;
/// Kalaron/Eternity Engine slope code (SRB2CB ported)
#define ESLOPE
+#ifdef ESLOPE
+/// Backwards compatibility with SRB2CB's slope linedef types.
+/// \note A simple shim that prints a warning.
+#define ESLOPE_TYPESHIM
+#endif
+
/// Delete file while the game is running.
/// \note EXTREMELY buggy, tends to crash game.
//#define DELFILE
diff --git a/src/doomtype.h b/src/doomtype.h
index 2d9d36328..a711b466d 100644
--- a/src/doomtype.h
+++ b/src/doomtype.h
@@ -92,7 +92,7 @@ typedef long ssize_t;
#endif
#ifdef __APPLE_CC__
-#define DIRECTFULLSCREEN
+#define DIRECTFULLSCREEN 1
#define DEBUG_LOG
#define NOIPX
#endif
diff --git a/src/f_finale.h b/src/f_finale.h
index 8ee02bdf3..1f23643be 100644
--- a/src/f_finale.h
+++ b/src/f_finale.h
@@ -35,7 +35,7 @@ void F_CutsceneTicker(void);
void F_TitleDemoTicker(void);
// Called by main loop.
-void F_GameEndDrawer(void);
+FUNCMATH void F_GameEndDrawer(void);
void F_IntroDrawer(void);
void F_TitleScreenDrawer(void);
diff --git a/src/hardware/hw_dll.h b/src/hardware/hw_dll.h
index d9620be02..6b9f4d538 100644
--- a/src/hardware/hw_dll.h
+++ b/src/hardware/hw_dll.h
@@ -54,7 +54,7 @@
#endif
#endif
-typedef void (*I_Error_t) (const char *error, ...);
+typedef void (*I_Error_t) (const char *error, ...) FUNCIERROR;
// ==========================================================================
// MATHS
diff --git a/src/hardware/hw_main.c b/src/hardware/hw_main.c
index 34fce21bc..a83960177 100644
--- a/src/hardware/hw_main.c
+++ b/src/hardware/hw_main.c
@@ -1675,9 +1675,9 @@ static void HWR_StoreWallRange(double startfrac, double endfrac)
else
{
// Skewed by bottom
- wallVerts[0].t = (texturevpegtop + worldhigh - worldtop) * grTex->scaleY;
- wallVerts[2].t = wallVerts[3].t - (worldhighslope - worldhigh) * grTex->scaleY;
- wallVerts[1].t = wallVerts[2].t - (worldhighslope - worldtopslope) * grTex->scaleY;
+ wallVerts[0].t = wallVerts[1].t = (texturevpegtop + worldtop - worldhigh) * grTex->scaleY;
+ wallVerts[3].t = wallVerts[0].t - (worldtop - worldhigh) * grTex->scaleY;
+ wallVerts[2].t = wallVerts[1].t - (worldtopslope - worldhighslope) * grTex->scaleY;
}
#endif
}
@@ -1719,12 +1719,12 @@ static void HWR_StoreWallRange(double startfrac, double endfrac)
if (!(gr_linedef->flags & ML_DONTPEGBOTTOM))
texturevpegbottom = 0;
else if (gr_linedef->flags & ML_EFFECT1)
- texturevpegbottom = worldtop - worldlow;
+ texturevpegbottom = worldbottom - worldlow;
else
- texturevpegbottom = gr_frontsector->ceilingheight - gr_backsector->floorheight;
+ texturevpegbottom = gr_frontsector->floorheight - gr_backsector->floorheight;
#else
if (gr_linedef->flags & ML_DONTPEGBOTTOM)
- texturevpegbottom = worldtop - worldlow;
+ texturevpegbottom = worldbottom - worldlow;
else
texturevpegbottom = 0;
#endif
@@ -1752,9 +1752,9 @@ static void HWR_StoreWallRange(double startfrac, double endfrac)
else if (gr_linedef->flags & ML_DONTPEGBOTTOM)
{
// Skewed by bottom
- wallVerts[0].t = (texturevpegbottom + worldlow - worldbottom) * grTex->scaleY;
- wallVerts[2].t = wallVerts[3].t - (worldlowslope - worldlow) * grTex->scaleY;
- wallVerts[1].t = wallVerts[2].t - (worldbottomslope - worldlowslope) * grTex->scaleY;
+ wallVerts[0].t = wallVerts[1].t = (texturevpegbottom + worldlow - worldbottom) * grTex->scaleY;
+ //wallVerts[3].t = wallVerts[0].t - (worldlow - worldbottom) * grTex->scaleY; // no need, [3] is already this
+ wallVerts[2].t = wallVerts[1].t - (worldlowslope - worldbottomslope) * grTex->scaleY;
}
else
{
@@ -2892,15 +2892,57 @@ static void HWR_AddLine(seg_t * line)
gr_backsector = R_FakeFlat(gr_backsector, &tempsec, NULL, NULL, true);
- // Closed door.
- if (gr_backsector->ceilingheight <= gr_frontsector->floorheight ||
- gr_backsector->floorheight >= gr_frontsector->ceilingheight)
- goto clipsolid;
+#ifdef ESLOPE
+ if (gr_frontsector->f_slope || gr_frontsector->c_slope || gr_backsector->f_slope || gr_backsector->c_slope)
+ {
+ fixed_t v1x, v1y, v2x, v2y; // the seg's vertexes as fixed_t
+ fixed_t frontf1,frontf2, frontc1, frontc2; // front floor/ceiling ends
+ fixed_t backf1, backf2, backc1, backc2; // back floor ceiling ends
- // Window.
- if (gr_backsector->ceilingheight != gr_frontsector->ceilingheight ||
- gr_backsector->floorheight != gr_frontsector->floorheight)
- goto clippass;
+ v1x = FLOAT_TO_FIXED(((polyvertex_t *)gr_curline->v1)->x);
+ v1y = FLOAT_TO_FIXED(((polyvertex_t *)gr_curline->v1)->y);
+ v2x = FLOAT_TO_FIXED(((polyvertex_t *)gr_curline->v2)->x);
+ v2y = FLOAT_TO_FIXED(((polyvertex_t *)gr_curline->v2)->y);
+#define SLOPEPARAMS(slope, end1, end2, normalheight) \
+ if (slope) { \
+ end1 = P_GetZAt(slope, v1x, v1y); \
+ end2 = P_GetZAt(slope, v2x, v2y); \
+ } else \
+ end1 = end2 = normalheight;
+
+ SLOPEPARAMS(gr_frontsector->f_slope, frontf1, frontf2, gr_frontsector->floorheight)
+ SLOPEPARAMS(gr_frontsector->c_slope, frontc1, frontc2, gr_frontsector->ceilingheight)
+ SLOPEPARAMS( gr_backsector->f_slope, backf1, backf2, gr_backsector->floorheight)
+ SLOPEPARAMS( gr_backsector->c_slope, backc1, backc2, gr_backsector->ceilingheight)
+#undef SLOPEPARAMS
+
+ // Closed door.
+ if ((backc1 <= frontf1 && backc2 <= frontf2)
+ || (backf1 >= frontc1 && backf2 >= frontc2))
+ {
+ goto clipsolid;
+ }
+
+ // Window.
+ if (backc1 != frontc1 || backc2 != frontc2
+ || backf1 != frontf1 || backf2 != frontf2)
+ {
+ goto clippass;
+ }
+ }
+ else
+#endif
+ {
+ // Closed door.
+ if (gr_backsector->ceilingheight <= gr_frontsector->floorheight ||
+ gr_backsector->floorheight >= gr_frontsector->ceilingheight)
+ goto clipsolid;
+
+ // Window.
+ if (gr_backsector->ceilingheight != gr_frontsector->ceilingheight ||
+ gr_backsector->floorheight != gr_frontsector->floorheight)
+ goto clippass;
+ }
// Reject empty lines used for triggers and special events.
// Identical floor and ceiling on both sides,
@@ -4487,7 +4529,8 @@ static void HWR_SortVisSprites(void)
// Fix first and last. ds still points to the last one after the loop
dsfirst->prev = &unsorted;
unsorted.next = dsfirst;
- ds->next = &unsorted;
+ if (ds)
+ ds->next = &unsorted;
unsorted.prev = ds;
// pull the vissprites out by scale
@@ -4510,10 +4553,13 @@ static void HWR_SortVisSprites(void)
best = ds;
}
}
- best->next->prev = best->prev;
- best->prev->next = best->next;
- best->next = &gr_vsprsortedhead;
- best->prev = gr_vsprsortedhead.prev;
+ if (best)
+ {
+ best->next->prev = best->prev;
+ best->prev->next = best->next;
+ best->next = &gr_vsprsortedhead;
+ best->prev = gr_vsprsortedhead.prev;
+ }
gr_vsprsortedhead.prev->next = best;
gr_vsprsortedhead.prev = best;
}
diff --git a/src/hardware/r_opengl/r_opengl.c b/src/hardware/r_opengl/r_opengl.c
index 1a81fe796..54dd94854 100644
--- a/src/hardware/r_opengl/r_opengl.c
+++ b/src/hardware/r_opengl/r_opengl.c
@@ -1836,10 +1836,7 @@ EXPORT void HWRAPI(SetSpecialState) (hwdspecialstate_t IdState, INT32 Value)
}
}
-// -----------------+
-// HWRAPI DrawMD2 : Draw an MD2 model with glcommands
-// -----------------+
-EXPORT void HWRAPI(DrawMD2i) (INT32 *gl_cmd_buffer, md2_frame_t *frame, UINT32 duration, UINT32 tics, md2_frame_t *nextframe, FTransform *pos, float scale, UINT8 flipped, UINT8 *color)
+static inline void DrawMD2Ex(INT32 *gl_cmd_buffer, md2_frame_t *frame, UINT32 duration, UINT32 tics, md2_frame_t *nextframe, FTransform *pos, float scale, UINT8 flipped, UINT8 *color)
{
INT32 val, count, pindex;
GLfloat s, t;
@@ -1931,7 +1928,7 @@ EXPORT void HWRAPI(DrawMD2i) (INT32 *gl_cmd_buffer, md2_frame_t *frame, UINT32 d
//pglBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); // alpha = level of transparency
// Remove depth mask when the model is transparent so it doesn't cut thorugh sprites // SRB2CBTODO: For all stuff too?!
- if (color[3] < 255)
+ if (color && color[3] < 255)
{
pglBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); // alpha = level of transparency
pglDepthMask(GL_FALSE);
@@ -2007,11 +2004,20 @@ EXPORT void HWRAPI(DrawMD2i) (INT32 *gl_cmd_buffer, md2_frame_t *frame, UINT32 d
pglDisable(GL_CULL_FACE);
}
+// -----------------+
+// HWRAPI DrawMD2 : Draw an MD2 model with glcommands
+// -----------------+
+EXPORT void HWRAPI(DrawMD2i) (INT32 *gl_cmd_buffer, md2_frame_t *frame, UINT32 duration, UINT32 tics, md2_frame_t *nextframe, FTransform *pos, float scale, UINT8 flipped, UINT8 *color)
+{
+ DrawMD2Ex(gl_cmd_buffer, frame, duration, tics, nextframe, pos, scale, flipped, color);
+}
+
EXPORT void HWRAPI(DrawMD2) (INT32 *gl_cmd_buffer, md2_frame_t *frame, FTransform *pos, float scale)
{
- DrawMD2i(gl_cmd_buffer, frame, 0, 0, NULL, pos, scale, false, NULL);
+ DrawMD2Ex(gl_cmd_buffer, frame, 0, 0, NULL, pos, scale, false, NULL);
}
+
// -----------------+
// SetTransform :
// -----------------+
diff --git a/src/hu_stuff.h b/src/hu_stuff.h
index f0dd40096..7b22f33f1 100644
--- a/src/hu_stuff.h
+++ b/src/hu_stuff.h
@@ -87,7 +87,7 @@ void HU_Init(void);
void HU_LoadGraphics(void);
// reset heads up when consoleplayer respawns.
-void HU_Start(void);
+FUNCMATH void HU_Start(void);
boolean HU_Responder(event_t *ev);
diff --git a/src/i_tcp.c b/src/i_tcp.c
index 89e59c8b8..eca218c80 100644
--- a/src/i_tcp.c
+++ b/src/i_tcp.c
@@ -466,7 +466,7 @@ static boolean SOCK_cmpaddr(mysockaddr_t *a, mysockaddr_t *b, UINT8 mask)
UINT32 bitmask = INADDR_NONE;
if (mask && mask < 32)
- bitmask = htonl(-1 << (32 - mask));
+ bitmask = htonl((UINT32)(-1) << (32 - mask));
if (b->any.sa_family == AF_INET)
return (a->ip4.sin_addr.s_addr & bitmask) == (b->ip4.sin_addr.s_addr & bitmask)
diff --git a/src/info.c b/src/info.c
index dc71ad163..2db0c3d21 100644
--- a/src/info.c
+++ b/src/info.c
@@ -43,17 +43,17 @@ char sprnames[NUMSPRITES + 1][5] =
"DFLM","XMS1","XMS2","XMS3","BSZ1","BSZ2","BSZ3","BSZ4","BSZ5","BSZ6",
"BSZ7","BSZ8","STLG","DBAL","RCRY","ARMA","ARMF","ARMB","WIND","MAGN",
"ELEM","FORC","PITY","IVSP","SSPK","GOAL","BIRD","BUNY","MOUS","CHIC",
- "COWZ","RBRD","SPRY","SPRR","SPRB","YSPR","RSPR","RAIN","SNO1","SPLH",
- "SPLA","SMOK","BUBP","BUBO","BUBN","BUBM","POPP","TFOG","SEED","PRTL",
- "SCOR","DRWN","TTAG","GFLG","RRNG","RNGB","RNGR","RNGI","RNGA","RNGE",
- "RNGS","RNGG","PIKB","PIKR","PIKA","PIKE","PIKS","PIKG","TAUT","TGRE",
- "TSCR","COIN","CPRK","GOOM","BGOM","FFWR","FBLL","SHLL","PUMA","HAMM",
- "KOOP","BFLM","MAXE","MUS1","MUS2","TOAD","NDRN","SUPE","SUPZ","NDRL",
- "NSPK","NBMP","HOOP","NSCR","NPRU","CAPS","SUPT","SPRK","BOM1","BOM2",
- "BOM3","BOM4","ROIA","ROIB","ROIC","ROID","ROIE","ROIF","ROIG","ROIH",
- "ROII","ROIJ","ROIK","ROIL","ROIM","ROIN","ROIO","ROIP","BBAL","GWLG",
- "GWLR","SRBA","SRBB","SRBC","SRBD","SRBE","SRBF","SRBG","SRBH","SRBI",
- "SRBJ","SRBK","SRBL","SRBM","SRBN","SRBO",
+ "COWZ","RBRD","SPRY","SPRR","SPRB","YSPR","RSPR","SSWY","SSWR","SSWB",
+ "RAIN","SNO1","SPLH","SPLA","SMOK","BUBP","BUBO","BUBN","BUBM","POPP",
+ "TFOG","SEED","PRTL","SCOR","DRWN","TTAG","GFLG","RRNG","RNGB","RNGR",
+ "RNGI","RNGA","RNGE","RNGS","RNGG","PIKB","PIKR","PIKA","PIKE","PIKS",
+ "PIKG","TAUT","TGRE","TSCR","COIN","CPRK","GOOM","BGOM","FFWR","FBLL",
+ "SHLL","PUMA","HAMM","KOOP","BFLM","MAXE","MUS1","MUS2","TOAD","NDRN",
+ "SUPE","SUPZ","NDRL","NSPK","NBMP","HOOP","NSCR","NPRU","CAPS","SUPT",
+ "SPRK","BOM1","BOM2","BOM3","BOM4","ROIA","ROIB","ROIC","ROID","ROIE",
+ "ROIF","ROIG","ROIH","ROII","ROIJ","ROIK","ROIL","ROIM","ROIN","ROIO",
+ "ROIP","BBAL","GWLG","GWLR","SRBA","SRBB","SRBC","SRBD","SRBE","SRBF",
+ "SRBG","SRBH","SRBI","SRBJ","SRBK","SRBL","SRBM","SRBN","SRBO",
};
char spr2names[NUMPLAYERSPRITES][5] =
@@ -62,6 +62,7 @@ char spr2names[NUMPLAYERSPRITES][5] =
"WAIT",
"WALK",
"RUN_",
+ "PEEL",
"PAIN",
"DEAD",
"DRWN",
@@ -88,6 +89,7 @@ char spr2names[NUMPLAYERSPRITES][5] =
"SSTD",
"SWLK",
"SRUN",
+ "SPEE",
"SPAN",
"SMSL",
"SDTH",
@@ -132,6 +134,7 @@ state_t states[NUMSTATES] =
{SPR_PLAY, SPR2_WAIT, 16, {NULL}, 0, 0, S_PLAY_WAIT}, // S_PLAY_WAIT
{SPR_PLAY, SPR2_WALK, 4, {NULL}, 0, 0, S_PLAY_WALK}, // S_PLAY_WALK
{SPR_PLAY, SPR2_RUN , 2, {NULL}, 0, 0, S_PLAY_RUN}, // S_PLAY_RUN
+ {SPR_PLAY, SPR2_PEEL, 2, {NULL}, 0, 0, S_PLAY_PEEL}, // S_PLAY_PEEL
{SPR_PLAY, SPR2_PAIN, 350, {NULL}, 0, 0, S_PLAY_FALL}, // S_PLAY_PAIN
{SPR_PLAY, SPR2_DEAD, 4, {NULL}, 0, 0, S_PLAY_DEAD}, // S_PLAY_DEAD
{SPR_PLAY, SPR2_DRWN, 4, {NULL}, 0, 0, S_PLAY_DRWN}, // S_PLAY_DRWN
@@ -157,6 +160,7 @@ state_t states[NUMSTATES] =
{SPR_PLAY, SPR2_SSTD, 7, {NULL}, 0, 0, S_PLAY_SUPER_STND}, // S_PLAY_SUPER_STND
{SPR_PLAY, SPR2_SWLK, 7, {NULL}, 0, 0, S_PLAY_SUPER_WALK}, // S_PLAY_SUPER_WALK
{SPR_PLAY, SPR2_SRUN, 7, {NULL}, 0, 0, S_PLAY_SUPER_RUN}, // S_PLAY_SUPER_RUN
+ {SPR_PLAY, SPR2_SPEE, 7, {NULL}, 0, 0, S_PLAY_SUPER_PEEL}, // S_PLAY_SUPER_PEEL
{SPR_PLAY, SPR2_SPAN, -1, {NULL}, 0, 0, S_PLAY_SUPER_STND}, // S_PLAY_SUPER_PAIN
{SPR_PLAY, SPR2_SMSL, -1, {NULL}, 0, 0, S_PLAY_SUPER_STND}, // S_PLAY_SUPER_STUN
{SPR_PLAY, SPR2_SDTH, 4, {NULL}, 0, 0, S_PLAY_SUPER_DEAD}, // S_PLAY_SUPER_DEAD
@@ -1850,6 +1854,36 @@ state_t states[NUMSTATES] =
{SPR_RSPR, 2, 1, {NULL}, 0, 0, S_RDIAG8}, // S_RDIAG7
{SPR_RSPR, 1, 1, {NULL}, 0, 0, S_RDIAG1}, // S_RDIAG8
+ // Yellow Side Spring
+ {SPR_SSWY, 0, -1, {NULL}, 0, 0, S_NULL}, // S_YHORIZ1
+ {SPR_SSWY, 1, 1, {A_Pain}, 0, 0, S_YHORIZ3}, // S_YHORIZ2
+ {SPR_SSWY, 2, 1, {NULL}, 0, 0, S_YHORIZ4}, // S_YHORIZ3
+ {SPR_SSWY, 3, 1, {NULL}, 0, 0, S_YHORIZ5}, // S_YHORIZ4
+ {SPR_SSWY, 4, 1, {NULL}, 0, 0, S_YHORIZ6}, // S_YHORIZ5
+ {SPR_SSWY, 3, 1, {NULL}, 0, 0, S_YHORIZ7}, // S_YHORIZ6
+ {SPR_SSWY, 2, 1, {NULL}, 0, 0, S_YHORIZ8}, // S_YHORIZ7
+ {SPR_SSWY, 1, 1, {NULL}, 0, 0, S_YHORIZ1}, // S_YHORIZ8
+
+ // Red Side Spring
+ {SPR_SSWR, 0, -1, {NULL}, 0, 0, S_NULL}, // S_RHORIZ1
+ {SPR_SSWR, 1, 1, {A_Pain}, 0, 0, S_RHORIZ3}, // S_RHORIZ2
+ {SPR_SSWR, 2, 1, {NULL}, 0, 0, S_RHORIZ4}, // S_RHORIZ3
+ {SPR_SSWR, 3, 1, {NULL}, 0, 0, S_RHORIZ5}, // S_RHORIZ4
+ {SPR_SSWR, 4, 1, {NULL}, 0, 0, S_RHORIZ6}, // S_RHORIZ5
+ {SPR_SSWR, 3, 1, {NULL}, 0, 0, S_RHORIZ7}, // S_RHORIZ6
+ {SPR_SSWR, 2, 1, {NULL}, 0, 0, S_RHORIZ8}, // S_RHORIZ7
+ {SPR_SSWR, 1, 1, {NULL}, 0, 0, S_RHORIZ1}, // S_RHORIZ8
+
+ // Blue Side Spring
+ {SPR_SSWB, 0, -1, {NULL}, 0, 0, S_NULL}, // S_BHORIZ1
+ {SPR_SSWB, 1, 1, {A_Pain}, 0, 0, S_BHORIZ3}, // S_BHORIZ2
+ {SPR_SSWB, 2, 1, {NULL}, 0, 0, S_BHORIZ4}, // S_BHORIZ3
+ {SPR_SSWB, 3, 1, {NULL}, 0, 0, S_BHORIZ5}, // S_BHORIZ4
+ {SPR_SSWB, 4, 1, {NULL}, 0, 0, S_BHORIZ6}, // S_BHORIZ5
+ {SPR_SSWB, 3, 1, {NULL}, 0, 0, S_BHORIZ7}, // S_BHORIZ6
+ {SPR_SSWB, 2, 1, {NULL}, 0, 0, S_BHORIZ8}, // S_BHORIZ7
+ {SPR_SSWB, 1, 1, {NULL}, 0, 0, S_BHORIZ1}, // S_BHORIZ8
+
// Rain
{SPR_RAIN, FF_TRANS50, -1, {NULL}, 0, 0, S_NULL}, // S_RAIN1
{SPR_RAIN, FF_TRANS50, 1, {NULL}, 0, 0, S_RAIN1}, // S_RAINRETURN
@@ -5281,6 +5315,87 @@ mobjinfo_t mobjinfo[NUMMOBJTYPES] =
S_RDIAG2 // raisestate
},
+ { // MT_YELLOWHORIZ
+ 558, // doomednum
+ S_YHORIZ1, // spawnstate
+ 1, // spawnhealth
+ S_YHORIZ2, // seestate
+ sfx_None, // seesound
+ 8, // reactiontime
+ sfx_None, // attacksound
+ S_NULL, // painstate
+ 0, // painchance
+ sfx_spring, // painsound
+ S_NULL, // meleestate
+ S_NULL, // missilestate
+ S_NULL, // deathstate
+ S_NULL, // xdeathstate
+ sfx_None, // deathsound
+ 0, // speed
+ 16*FRACUNIT, // radius
+ 32*FRACUNIT, // height
+ 0, // display offset
+ 0, // mass
+ 16*FRACUNIT, // damage
+ sfx_None, // activesound
+ MF_SOLID|MF_SPRING|MF_NOGRAVITY, // flags
+ S_YHORIZ2 // raisestate
+ },
+
+ { // MT_REDHORIZ
+ 559, // doomednum
+ S_RHORIZ1, // spawnstate
+ 1, // spawnhealth
+ S_RHORIZ2, // seestate
+ sfx_None, // seesound
+ 8, // reactiontime
+ sfx_None, // attacksound
+ S_NULL, // painstate
+ 0, // painchance
+ sfx_spring, // painsound
+ S_NULL, // meleestate
+ S_NULL, // missilestate
+ S_NULL, // deathstate
+ S_NULL, // xdeathstate
+ sfx_None, // deathsound
+ 0, // speed
+ 16*FRACUNIT, // radius
+ 32*FRACUNIT, // height
+ 0, // display offset
+ 0, // mass
+ 64*FRACUNIT, // damage
+ sfx_None, // activesound
+ MF_SOLID|MF_SPRING|MF_NOGRAVITY, // flags
+ S_RHORIZ2 // raisestate
+ },
+
+ { // MT_BLUEHORIZ
+ 560, // doomednum
+ S_BHORIZ1, // spawnstate
+ 1, // spawnhealth
+ S_BHORIZ2, // seestate
+ sfx_None, // seesound
+ 8, // reactiontime
+ sfx_None, // attacksound
+ S_NULL, // painstate
+ 0, // painchance
+ sfx_spring, // painsound
+ S_NULL, // meleestate
+ S_NULL, // missilestate
+ S_NULL, // deathstate
+ S_NULL, // xdeathstate
+ sfx_None, // deathsound
+ 0, // speed
+ 16*FRACUNIT, // radius
+ 32*FRACUNIT, // height
+ 0, // display offset
+ 0, // mass
+ 4*FRACUNIT, // damage
+ sfx_None, // activesound
+ MF_SOLID|MF_SPRING|MF_NOGRAVITY, // flags
+ S_BHORIZ2 // raisestate
+ },
+
{ // MT_BUBBLES
500, // doomednum
S_BUBBLES1, // spawnstate
diff --git a/src/info.h b/src/info.h
index 46fdde46b..c89f4a88c 100644
--- a/src/info.h
+++ b/src/info.h
@@ -448,6 +448,9 @@ typedef enum sprite
SPR_SPRB, // Blue springs
SPR_YSPR, // Yellow Diagonal Spring
SPR_RSPR, // Red Diagonal Spring
+ SPR_SSWY, // Yellow Side Spring
+ SPR_SSWR, // Red Side Spring
+ SPR_SSWB, // Blue Side Spring
// Environmental Effects
SPR_RAIN, // Rain
@@ -581,6 +584,7 @@ enum playersprite
SPR2_WAIT,
SPR2_WALK,
SPR2_RUN ,
+ SPR2_PEEL,
SPR2_PAIN,
SPR2_DEAD,
SPR2_DRWN,
@@ -607,6 +611,7 @@ enum playersprite
SPR2_SSTD,
SPR2_SWLK,
SPR2_SRUN,
+ SPR2_SPEE,
SPR2_SPAN,
SPR2_SMSL,
SPR2_SDTH,
@@ -645,6 +650,7 @@ typedef enum state
S_PLAY_WAIT,
S_PLAY_WALK,
S_PLAY_RUN,
+ S_PLAY_PEEL,
S_PLAY_PAIN,
S_PLAY_DEAD,
S_PLAY_DRWN,
@@ -670,6 +676,7 @@ typedef enum state
S_PLAY_SUPER_STND,
S_PLAY_SUPER_WALK,
S_PLAY_SUPER_RUN,
+ S_PLAY_SUPER_PEEL,
S_PLAY_SUPER_PAIN,
S_PLAY_SUPER_STUN,
S_PLAY_SUPER_DEAD,
@@ -2348,6 +2355,36 @@ typedef enum state
S_RDIAG7,
S_RDIAG8,
+ // Yellow Side Spring
+ S_YHORIZ1,
+ S_YHORIZ2,
+ S_YHORIZ3,
+ S_YHORIZ4,
+ S_YHORIZ5,
+ S_YHORIZ6,
+ S_YHORIZ7,
+ S_YHORIZ8,
+
+ // Red Side Spring
+ S_RHORIZ1,
+ S_RHORIZ2,
+ S_RHORIZ3,
+ S_RHORIZ4,
+ S_RHORIZ5,
+ S_RHORIZ6,
+ S_RHORIZ7,
+ S_RHORIZ8,
+
+ // Blue Side Spring
+ S_BHORIZ1,
+ S_BHORIZ2,
+ S_BHORIZ3,
+ S_BHORIZ4,
+ S_BHORIZ5,
+ S_BHORIZ6,
+ S_BHORIZ7,
+ S_BHORIZ8,
+
// Rain
S_RAIN1,
S_RAINRETURN,
@@ -3123,6 +3160,9 @@ typedef enum mobj_type
MT_REDSPRING,
MT_YELLOWDIAG, // Yellow Diagonal Spring
MT_REDDIAG, // Red Diagonal Spring
+ MT_YELLOWHORIZ, // Yellow Side Spring
+ MT_REDHORIZ, // Red Side Spring
+ MT_BLUEHORIZ, // Blue Side Spring
// Interactive Objects
MT_BUBBLES, // Bubble source
diff --git a/src/lua_baselib.c b/src/lua_baselib.c
index e083530a9..48b095e08 100644
--- a/src/lua_baselib.c
+++ b/src/lua_baselib.c
@@ -439,6 +439,16 @@ static int lib_pMobjFlip(lua_State *L)
return 1;
}
+static int lib_pGetMobjGravity(lua_State *L)
+{
+ mobj_t *mobj = *((mobj_t **)luaL_checkudata(L, 1, META_MOBJ));
+ //HUDSAFE
+ if (!mobj)
+ return LUA_ErrInvalid(L, "mobj_t");
+ lua_pushfixed(L, P_GetMobjGravity(mobj));
+ return 1;
+}
+
static int lib_pWeaponOrPanel(lua_State *L)
{
mobjtype_t type = luaL_checkinteger(L, 1);
@@ -2014,6 +2024,7 @@ static luaL_Reg lib[] = {
{"P_SPMAngle",lib_pSPMAngle},
{"P_SpawnPlayerMissile",lib_pSpawnPlayerMissile},
{"P_MobjFlip",lib_pMobjFlip},
+ {"P_GetMobjGravity",lib_pGetMobjGravity},
{"P_WeaponOrPanel",lib_pWeaponOrPanel},
{"P_FlashPal",lib_pFlashPal},
{"P_GetClosestAxis",lib_pGetClosestAxis},
diff --git a/src/lua_playerlib.c b/src/lua_playerlib.c
index bd5605f23..60119deae 100644
--- a/src/lua_playerlib.c
+++ b/src/lua_playerlib.c
@@ -202,6 +202,8 @@ static int player_get(lua_State *L)
lua_pushinteger(L, plr->exiting);
else if (fastcmp(field,"homing"))
lua_pushinteger(L, plr->homing);
+ else if (fastcmp(field,"dashmode"))
+ lua_pushinteger(L, plr->dashmode);
else if (fastcmp(field,"skidtime"))
lua_pushinteger(L, plr->skidtime);
else if (fastcmp(field,"cmomx"))
@@ -459,6 +461,8 @@ static int player_set(lua_State *L)
plr->exiting = (tic_t)luaL_checkinteger(L, 3);
else if (fastcmp(field,"homing"))
plr->homing = (UINT8)luaL_checkinteger(L, 3);
+ else if (fastcmp(field,"dashmode"))
+ plr->dashmode = (tic_t)luaL_checkinteger(L, 3);
else if (fastcmp(field,"skidtime"))
plr->skidtime = (tic_t)luaL_checkinteger(L, 3);
else if (fastcmp(field,"cmomx"))
diff --git a/src/lzf.c b/src/lzf.c
index 33a1b2dcd..272174f30 100644
--- a/src/lzf.c
+++ b/src/lzf.c
@@ -59,7 +59,11 @@
* Unconditionally aligning does not cost very much, so do it if unsure
*/
#ifndef STRICT_ALIGN
-# define STRICT_ALIGN !(defined(__i386) || defined (__amd64)) || defined (__clang__)
+#if !(defined(__i386) || defined (__amd64)) || defined (__clang__)
+#define STRICT_ALIGN 1
+#else
+#define STRICT_ALIGN 0
+#endif
#endif
/*
diff --git a/src/m_aatree.c b/src/m_aatree.c
new file mode 100644
index 000000000..6cb3a32cb
--- /dev/null
+++ b/src/m_aatree.c
@@ -0,0 +1,167 @@
+// SONIC ROBO BLAST 2
+//-----------------------------------------------------------------------------
+// Copyright (C) 1993-1996 by id Software, Inc.
+// Copyright (C) 1998-2000 by DooM Legacy Team.
+// Copyright (C) 1999-2016 by Sonic Team Junior.
+//
+// This program is free software distributed under the
+// terms of the GNU General Public License, version 2.
+// See the 'LICENSE' file for more details.
+//-----------------------------------------------------------------------------
+/// \file m_aatree.h
+/// \brief AA trees code
+
+#include "m_aatree.h"
+#include "z_zone.h"
+
+// A partial implementation of AA trees,
+// according to the algorithms given on Wikipedia.
+// http://en.wikipedia.org/wiki/AA_tree
+
+typedef struct aatree_node_s
+{
+ INT32 level;
+ INT32 key;
+ void* value;
+
+ struct aatree_node_s *left, *right;
+} aatree_node_t;
+
+struct aatree_s
+{
+ aatree_node_t *root;
+ UINT32 flags;
+};
+
+aatree_t *M_AATreeAlloc(UINT32 flags)
+{
+ aatree_t *aatree = Z_Malloc(sizeof (aatree_t), PU_STATIC, NULL);
+ aatree->root = NULL;
+ aatree->flags = flags;
+ return aatree;
+}
+
+static void M_AATreeFree_Node(aatree_node_t *node)
+{
+ if (node->left) M_AATreeFree_Node(node->left);
+ if (node->right) M_AATreeFree_Node(node->right);
+ Z_Free(node);
+}
+
+void M_AATreeFree(aatree_t *aatree)
+{
+ if (aatree->root)
+ M_AATreeFree_Node(aatree->root);
+
+ Z_Free(aatree);
+}
+
+static aatree_node_t *M_AATreeSkew(aatree_node_t *node)
+{
+ if (node && node->left && node->left->level == node->level)
+ {
+ // Not allowed: horizontal left-link. Reverse the
+ // horizontal link and hook the orphan back in.
+ aatree_node_t *oldleft = node->left;
+ node->left = oldleft->right;
+ oldleft->right = node;
+
+ return oldleft;
+ }
+
+ // No change needed.
+ return node;
+}
+
+static aatree_node_t *M_AATreeSplit(aatree_node_t *node)
+{
+ if (node && node->right && node->right->right && node->level == node->right->right->level)
+ {
+ // Not allowed: two consecutive horizontal right-links.
+ // The middle one becomes the new root at this point,
+ // with suitable adjustments below.
+
+ aatree_node_t *oldright = node->right;
+ node->right = oldright->left;
+ oldright->left = node;
+ oldright->level++;
+
+ return oldright;
+ }
+
+ // No change needed.
+ return node;
+}
+
+static aatree_node_t *M_AATreeSet_Node(aatree_node_t *node, UINT32 flags, INT32 key, void* value)
+{
+ if (!node)
+ {
+ // Nothing here, so just add where we are
+
+ node = Z_Malloc(sizeof (aatree_node_t), PU_STATIC, NULL);
+ node->level = 1;
+ node->key = key;
+ if (value && (flags & AATREE_ZUSER)) Z_SetUser(value, &node->value);
+ else node->value = value;
+ node->left = node->right = NULL;
+ }
+ else
+ {
+ if (key < node->key)
+ node->left = M_AATreeSet_Node(node->left, flags, key, value);
+ else if (key > node->key)
+ node->right = M_AATreeSet_Node(node->right, flags, key, value);
+ else
+ {
+ if (value && (flags & AATREE_ZUSER)) Z_SetUser(value, &node->value);
+ else node->value = value;
+ }
+
+ node = M_AATreeSkew(node);
+ node = M_AATreeSplit(node);
+ }
+
+ return node;
+}
+
+void M_AATreeSet(aatree_t *aatree, INT32 key, void* value)
+{
+ aatree->root = M_AATreeSet_Node(aatree->root, aatree->flags, key, value);
+}
+
+// Caveat: we don't distinguish between nodes that don't exists
+// and nodes with value == NULL.
+static void *M_AATreeGet_Node(aatree_node_t *node, INT32 key)
+{
+ if (node)
+ {
+ if (node->key == key)
+ return node->value;
+ else if(node->key < key)
+ return M_AATreeGet_Node(node->right, key);
+ else
+ return M_AATreeGet_Node(node->left, key);
+ }
+
+ return NULL;
+}
+
+void *M_AATreeGet(aatree_t *aatree, INT32 key)
+{
+ return M_AATreeGet_Node(aatree->root, key);
+}
+
+
+static void M_AATreeIterate_Node(aatree_node_t *node, aatree_iter_t callback)
+{
+ if (node->left) M_AATreeIterate_Node(node->left, callback);
+ callback(node->key, node->value);
+ if (node->right) M_AATreeIterate_Node(node->right, callback);
+}
+
+void M_AATreeIterate(aatree_t *aatree, aatree_iter_t callback)
+{
+ if (aatree->root)
+ M_AATreeIterate_Node(aatree->root, callback);
+}
diff --git a/src/m_aatree.h b/src/m_aatree.h
new file mode 100644
index 000000000..c9077b974
--- /dev/null
+++ b/src/m_aatree.h
@@ -0,0 +1,31 @@
+// SONIC ROBO BLAST 2
+//-----------------------------------------------------------------------------
+// Copyright (C) 1993-1996 by id Software, Inc.
+// Copyright (C) 1998-2000 by DooM Legacy Team.
+// Copyright (C) 1999-2016 by Sonic Team Junior.
+//
+// This program is free software distributed under the
+// terms of the GNU General Public License, version 2.
+// See the 'LICENSE' file for more details.
+//-----------------------------------------------------------------------------
+/// \file m_aatree.h
+/// \brief AA trees code
+
+#ifndef __M_AATREE__
+#define __M_AATREE__
+
+#include "doomtype.h"
+
+// Flags for AA trees.
+#define AATREE_ZUSER 1 // Treat values as z_zone-allocated blocks and set their user fields
+
+typedef struct aatree_s aatree_t;
+typedef void (*aatree_iter_t)(INT32 key, void *value);
+
+aatree_t *M_AATreeAlloc(UINT32 flags);
+void M_AATreeFree(aatree_t *aatree);
+void M_AATreeSet(aatree_t *aatree, INT32 key, void* value);
+void *M_AATreeGet(aatree_t *aatree, INT32 key);
+void M_AATreeIterate(aatree_t *aatree, aatree_iter_t callback);
+
+#endif
\ No newline at end of file
diff --git a/src/m_menu.c b/src/m_menu.c
index 240256948..c225e7f15 100644
--- a/src/m_menu.c
+++ b/src/m_menu.c
@@ -7424,7 +7424,7 @@ static void M_HandleFogColor(INT32 choice)
l = strlen(temp);
for (i = 0; i < l; i++)
cv_grfogcolor.zstring[5 - i] = temp[l - i];
- cv_grfogcolor.zstring[5] = (char)choice;
+ cv_grfogcolor.zstring[5] = (char)choice;
}
break;
}
diff --git a/src/m_misc.c b/src/m_misc.c
index 64054d4f9..457214e33 100644
--- a/src/m_misc.c
+++ b/src/m_misc.c
@@ -2323,158 +2323,3 @@ void M_SetupMemcpy(void)
M_Memcpy = cpu_cpy;
#endif
}
-
-
-// A partial implementation of AA trees,
-// according to the algorithms given on Wikipedia.
-// http://en.wikipedia.org/wiki/AA_tree
-
-
-
-typedef struct aatree_node_s
-{
- INT32 level;
- INT32 key;
- void* value;
-
- struct aatree_node_s *left, *right;
-} aatree_node_t;
-
-struct aatree_s
-{
- aatree_node_t *root;
- UINT32 flags;
-};
-
-aatree_t *M_AATreeAlloc(UINT32 flags)
-{
- aatree_t *aatree = Z_Malloc(sizeof (aatree_t), PU_STATIC, NULL);
- aatree->root = NULL;
- aatree->flags = flags;
- return aatree;
-}
-
-static void M_AATreeFree_Node(aatree_node_t *node)
-{
- if (node->left) M_AATreeFree_Node(node->left);
- if (node->right) M_AATreeFree_Node(node->right);
- Z_Free(node);
-}
-
-void M_AATreeFree(aatree_t *aatree)
-{
- if (aatree->root)
- M_AATreeFree_Node(aatree->root);
-
- Z_Free(aatree);
-}
-
-static aatree_node_t *M_AATreeSkew(aatree_node_t *node)
-{
- if (node && node->left && node->left->level == node->level)
- {
- // Not allowed: horizontal left-link. Reverse the
- // horizontal link and hook the orphan back in.
- aatree_node_t *oldleft = node->left;
- node->left = oldleft->right;
- oldleft->right = node;
-
- return oldleft;
- }
-
- // No change needed.
- return node;
-}
-
-static aatree_node_t *M_AATreeSplit(aatree_node_t *node)
-{
- if (node && node->right && node->right->right && node->level == node->right->right->level)
- {
- // Not allowed: two consecutive horizontal right-links.
- // The middle one becomes the new root at this point,
- // with suitable adjustments below.
-
- aatree_node_t *oldright = node->right;
- node->right = oldright->left;
- oldright->left = node;
- oldright->level++;
-
- return oldright;
- }
-
- // No change needed.
- return node;
-}
-
-static aatree_node_t *M_AATreeSet_Node(aatree_node_t *node, UINT32 flags, INT32 key, void* value)
-{
- if (!node)
- {
- // Nothing here, so just add where we are
-
- node = Z_Malloc(sizeof (aatree_node_t), PU_STATIC, NULL);
- node->level = 1;
- node->key = key;
- if (value && (flags & AATREE_ZUSER)) Z_SetUser(value, &node->value);
- else node->value = value;
- node->left = node->right = NULL;
- }
- else
- {
- if (key < node->key)
- node->left = M_AATreeSet_Node(node->left, flags, key, value);
- else if (key > node->key)
- node->right = M_AATreeSet_Node(node->right, flags, key, value);
- else
- {
- if (value && (flags & AATREE_ZUSER)) Z_SetUser(value, &node->value);
- else node->value = value;
- }
-
- node = M_AATreeSkew(node);
- node = M_AATreeSplit(node);
- }
-
- return node;
-}
-
-void M_AATreeSet(aatree_t *aatree, INT32 key, void* value)
-{
- aatree->root = M_AATreeSet_Node(aatree->root, aatree->flags, key, value);
-}
-
-// Caveat: we don't distinguish between nodes that don't exists
-// and nodes with value == NULL.
-static void *M_AATreeGet_Node(aatree_node_t *node, INT32 key)
-{
- if (node)
- {
- if (node->key == key)
- return node->value;
- else if(node->key < key)
- return M_AATreeGet_Node(node->right, key);
- else
- return M_AATreeGet_Node(node->left, key);
- }
-
- return NULL;
-}
-
-void *M_AATreeGet(aatree_t *aatree, INT32 key)
-{
- return M_AATreeGet_Node(aatree->root, key);
-}
-
-
-static void M_AATreeIterate_Node(aatree_node_t *node, aatree_iter_t callback)
-{
- if (node->left) M_AATreeIterate_Node(node->left, callback);
- callback(node->key, node->value);
- if (node->right) M_AATreeIterate_Node(node->right, callback);
-}
-
-void M_AATreeIterate(aatree_t *aatree, aatree_iter_t callback)
-{
- if (aatree->root)
- M_AATreeIterate_Node(aatree->root, callback);
-}
diff --git a/src/m_misc.h b/src/m_misc.h
index fa1f3b33c..dc540dc16 100644
--- a/src/m_misc.h
+++ b/src/m_misc.h
@@ -96,19 +96,6 @@ void M_SetupMemcpy(void);
// counting bits, for weapon ammo code, usually
FUNCMATH UINT8 M_CountBits(UINT32 num, UINT8 size);
-// Flags for AA trees.
-#define AATREE_ZUSER 1 // Treat values as z_zone-allocated blocks and set their user fields
-
-typedef struct aatree_s aatree_t;
-typedef void (*aatree_iter_t)(INT32 key, void *value);
-
-aatree_t *M_AATreeAlloc(UINT32 flags);
-void M_AATreeFree(aatree_t *aatree);
-void M_AATreeSet(aatree_t *aatree, INT32 key, void* value);
-void *M_AATreeGet(aatree_t *aatree, INT32 key);
-void M_AATreeIterate(aatree_t *aatree, aatree_iter_t callback);
-
-// Nasty cyclic dependency workaround. This must come after aatree stuff.
#include "w_wad.h"
extern char configfile[MAX_WADPATH];
diff --git a/src/p_floor.c b/src/p_floor.c
index af6274f28..8f51698cc 100644
--- a/src/p_floor.c
+++ b/src/p_floor.c
@@ -1163,7 +1163,7 @@ void T_SpikeSector(levelspecthink_t *spikes)
node = spikes->sector->touching_thinglist; // things touching this sector
- for (; node; node = node->m_snext)
+ for (; node; node = node->m_thinglist_next)
{
thing = node->m_thing;
if (!thing->player)
@@ -1314,7 +1314,7 @@ void T_BridgeThinker(levelspecthink_t *bridge)
controlsec = §ors[k];
// Is a player standing on me?
- for (node = sector->touching_thinglist; node; node = node->m_snext)
+ for (node = sector->touching_thinglist; node; node = node->m_thinglist_next)
{
thing = node->m_thing;
@@ -1737,7 +1737,7 @@ wegotit:
static mobj_t *SearchMarioNode(msecnode_t *node)
{
mobj_t *thing = NULL;
- for (; node; node = node->m_snext)
+ for (; node; node = node->m_thinglist_next)
{
// Things which should NEVER be ejected from a MarioBlock, by type.
switch (node->m_thing->type)
@@ -2009,7 +2009,7 @@ void T_NoEnemiesSector(levelspecthink_t *nobaddies)
&& thing->z < upperbound && thing->z+thing->height > lowerbound)
return;
- node = node->m_snext;
+ node = node->m_thinglist_next;
}
}
}
@@ -2027,7 +2027,7 @@ void T_NoEnemiesSector(levelspecthink_t *nobaddies)
&& thing->z < upperbound && thing->z+thing->height > lowerbound)
return;
- node = node->m_snext;
+ node = node->m_thinglist_next;
}
}
}
@@ -2306,7 +2306,7 @@ void T_RaiseSector(levelspecthink_t *raise)
sector = §ors[i];
// Is a player standing on me?
- for (node = sector->touching_thinglist; node; node = node->m_snext)
+ for (node = sector->touching_thinglist; node; node = node->m_thinglist_next)
{
thing = node->m_thing;
diff --git a/src/p_inter.c b/src/p_inter.c
index 9d6230cb2..b0d8e4aac 100644
--- a/src/p_inter.c
+++ b/src/p_inter.c
@@ -3657,7 +3657,7 @@ void P_PlayerFlagBurst(player_t *player, boolean toss)
// Flag text
{
char plname[MAXPLAYERNAME+4];
- char *flagtext;
+ const char *flagtext;
char flagcolor;
snprintf(plname, sizeof(plname), "%s%s%s",
diff --git a/src/p_local.h b/src/p_local.h
index 57ca425e1..4dba5d306 100644
--- a/src/p_local.h
+++ b/src/p_local.h
@@ -251,7 +251,8 @@ mobj_t *P_SPMAngle(mobj_t *source, mobjtype_t type, angle_t angle, UINT8 aimtype
#endif
void P_ColorTeamMissile(mobj_t *missile, player_t *source);
SINT8 P_MobjFlip(mobj_t *mobj);
-boolean P_WeaponOrPanel(mobjtype_t type);
+fixed_t P_GetMobjGravity(mobj_t *mo);
+FUNCMATH boolean P_WeaponOrPanel(mobjtype_t type);
boolean P_CameraThinker(player_t *player, camera_t *thiscam, boolean resetcalled);
diff --git a/src/p_map.c b/src/p_map.c
index 668ba19c2..9bcd1b29e 100644
--- a/src/p_map.c
+++ b/src/p_map.c
@@ -129,6 +129,10 @@ boolean P_DoSpring(mobj_t *spring, mobj_t *object)
return false;
}
+#ifdef ESLOPE
+ object->standingslope = NULL; // Okay, now we can't return - no launching off at silly angles for you.
+#endif
+
object->eflags |= MFE_SPRUNG; // apply this flag asap!
spring->flags &= ~(MF_SOLID|MF_SPECIAL); // De-solidify
@@ -232,20 +236,24 @@ static void P_DoFanAndGasJet(mobj_t *spring, mobj_t *object)
if (p && object->state == &states[object->info->painstate]) // can't use fans and gas jets when player is in pain!
return;
- // is object below thruster's position? if not, calculate distance between their bottoms
+ // is object's top below thruster's position? if not, calculate distance between their bottoms
if (spring->eflags & MFE_VERTICALFLIP)
{
- if (object->z + object->height > spring->z + spring->height)
+ if (object->z > spring->z + spring->height)
return;
zdist = (spring->z + spring->height) - (object->z + object->height);
}
else
{
- if (object->z < spring->z)
+ if (object->z + object->height < spring->z)
return;
zdist = object->z - spring->z;
}
+#ifdef ESLOPE
+ object->standingslope = NULL; // No launching off at silly angles for you.
+#endif
+
switch (spring->type)
{
case MT_FAN: // fan
@@ -448,6 +456,35 @@ static boolean PIT_CheckThing(mobj_t *thing)
return true;
}
+ // Dashmode users destroy spikes and monitors.
+ if ((tmthing->player) && (tmthing->player->charability == CA_DASHMODE) && (tmthing->player->dashmode >= 3*TICRATE)
+ && (thing->flags & (MF_MONITOR) || thing->type == MT_SPIKE))
+ {
+ if ((thing->flags & (MF_MONITOR)) && (thing->health <= 0 || !(thing->flags & MF_SHOOTABLE)))
+ return true;
+ blockdist = thing->radius + tmthing->radius;
+ if (abs(thing->x - tmx) >= blockdist || abs(thing->y - tmy) >= blockdist)
+ return true; // didn't hit it
+ // see if it went over / under
+ if (tmthing->z > thing->z + thing->height)
+ return true; // overhead
+ if (tmthing->z + tmthing->height < thing->z)
+ return true; // underneath
+ if (thing->type == MT_SPIKE)
+ {
+ S_StartSound(tmthing, thing->info->deathsound);
+ for (thing = thing->subsector->sector->thinglist; thing; thing = thing->snext)
+ if (thing->type == MT_SPIKE && thing->health > 0 && thing->flags & MF_SOLID && P_AproxDistance(thing->x - tmthing->x, thing->y - tmthing->y) < FixedMul(56*FRACUNIT, thing->scale))
+ P_KillMobj(thing, tmthing, tmthing, 0);
+ }
+ else
+ {
+ thing->health = 0;
+ P_KillMobj(thing, tmthing, tmthing, 0);
+ }
+ return true;
+ }
+
if (!(thing->flags & (MF_SOLID|MF_SPECIAL|MF_PAIN|MF_SHOOTABLE)))
return true;
@@ -2433,6 +2470,8 @@ isblocking:
//
// P_IsClimbingValid
//
+// Unlike P_DoClimbing, don't use when up against a one-sided linedef.
+//
static boolean P_IsClimbingValid(player_t *player, angle_t angle)
{
fixed_t platx, platy;
@@ -2657,6 +2696,7 @@ isblocking:
// see about climbing on the wall
if (!(checkline->flags & ML_NOCLIMB))
{
+ boolean canclimb; // FUCK C90
angle_t climbangle, climbline;
INT32 whichside = P_PointOnLineSide(slidemo->x, slidemo->y, li);
@@ -2667,9 +2707,11 @@ isblocking:
climbangle += (ANGLE_90 * (whichside ? -1 : 1));
+ canclimb = (li->backsector ? P_IsClimbingValid(slidemo->player, climbangle) : true);
+
if (((!slidemo->player->climbing && abs((signed)(slidemo->angle - ANGLE_90 - climbline)) < ANGLE_45)
|| (slidemo->player->climbing == 1 && abs((signed)(slidemo->angle - climbline)) < ANGLE_135))
- && P_IsClimbingValid(slidemo->player, climbangle))
+ && canclimb)
{
slidemo->angle = climbangle;
if (!demoplayback || P_AnalogMove(slidemo->player))
@@ -3368,7 +3410,7 @@ boolean P_CheckSector(sector_t *sector, boolean crunch)
for (i = 0; i < sector->numattached; i++)
{
sec = §ors[sector->attached[i]];
- for (n = sec->touching_thinglist; n; n = n->m_snext)
+ for (n = sec->touching_thinglist; n; n = n->m_thinglist_next)
n->visited = false;
sec->moved = true;
@@ -3380,7 +3422,7 @@ boolean P_CheckSector(sector_t *sector, boolean crunch)
do
{
- for (n = sec->touching_thinglist; n; n = n->m_snext)
+ for (n = sec->touching_thinglist; n; n = n->m_thinglist_next)
if (!n->visited)
{
n->visited = true;
@@ -3401,12 +3443,12 @@ boolean P_CheckSector(sector_t *sector, boolean crunch)
// Mark all things invalid
sector->moved = true;
- for (n = sector->touching_thinglist; n; n = n->m_snext)
+ for (n = sector->touching_thinglist; n; n = n->m_thinglist_next)
n->visited = false;
do
{
- for (n = sector->touching_thinglist; n; n = n->m_snext) // go through list
+ for (n = sector->touching_thinglist; n; n = n->m_thinglist_next) // go through list
if (!n->visited) // unprocessed thing found
{
n->visited = true; // mark thing as processed
@@ -3430,7 +3472,7 @@ boolean P_CheckSector(sector_t *sector, boolean crunch)
for (i = 0; i < sector->numattached; i++)
{
sec = §ors[sector->attached[i]];
- for (n = sec->touching_thinglist; n; n = n->m_snext)
+ for (n = sec->touching_thinglist; n; n = n->m_thinglist_next)
n->visited = false;
sec->moved = true;
@@ -3442,7 +3484,7 @@ boolean P_CheckSector(sector_t *sector, boolean crunch)
do
{
- for (n = sec->touching_thinglist; n; n = n->m_snext)
+ for (n = sec->touching_thinglist; n; n = n->m_thinglist_next)
if (!n->visited)
{
n->visited = true;
@@ -3460,12 +3502,12 @@ boolean P_CheckSector(sector_t *sector, boolean crunch)
// Mark all things invalid
sector->moved = true;
- for (n = sector->touching_thinglist; n; n = n->m_snext)
+ for (n = sector->touching_thinglist; n; n = n->m_thinglist_next)
n->visited = false;
do
{
- for (n = sector->touching_thinglist; n; n = n->m_snext) // go through list
+ for (n = sector->touching_thinglist; n; n = n->m_thinglist_next) // go through list
if (!n->visited) // unprocessed thing found
{
n->visited = true; // mark thing as processed
@@ -3505,7 +3547,7 @@ static msecnode_t *P_GetSecnode(void)
if (headsecnode)
{
node = headsecnode;
- headsecnode = headsecnode->m_snext;
+ headsecnode = headsecnode->m_thinglist_next;
}
else
node = Z_Calloc(sizeof (*node), PU_LEVEL, NULL);
@@ -3519,7 +3561,7 @@ static mprecipsecnode_t *P_GetPrecipSecnode(void)
if (headprecipsecnode)
{
node = headprecipsecnode;
- headprecipsecnode = headprecipsecnode->m_snext;
+ headprecipsecnode = headprecipsecnode->m_thinglist_next;
}
else
node = Z_Calloc(sizeof (*node), PU_LEVEL, NULL);
@@ -3530,14 +3572,14 @@ static mprecipsecnode_t *P_GetPrecipSecnode(void)
static inline void P_PutSecnode(msecnode_t *node)
{
- node->m_snext = headsecnode;
+ node->m_thinglist_next = headsecnode;
headsecnode = node;
}
// Tails 08-25-2002
static inline void P_PutPrecipSecnode(mprecipsecnode_t *node)
{
- node->m_snext = headprecipsecnode;
+ node->m_thinglist_next = headprecipsecnode;
headprecipsecnode = node;
}
@@ -3558,7 +3600,7 @@ static msecnode_t *P_AddSecnode(sector_t *s, mobj_t *thing, msecnode_t *nextnode
node->m_thing = thing; // Yes. Setting m_thing says 'keep it'.
return nextnode;
}
- node = node->m_tnext;
+ node = node->m_sectorlist_next;
}
// Couldn't find an existing node for this sector. Add one at the head
@@ -3571,17 +3613,17 @@ static msecnode_t *P_AddSecnode(sector_t *s, mobj_t *thing, msecnode_t *nextnode
node->m_sector = s; // sector
node->m_thing = thing; // mobj
- node->m_tprev = NULL; // prev node on Thing thread
- node->m_tnext = nextnode; // next node on Thing thread
+ node->m_sectorlist_prev = NULL; // prev node on Thing thread
+ node->m_sectorlist_next = nextnode; // next node on Thing thread
if (nextnode)
- nextnode->m_tprev = node; // set back link on Thing
+ nextnode->m_sectorlist_prev = node; // set back link on Thing
// Add new node at head of sector thread starting at s->touching_thinglist
- node->m_sprev = NULL; // prev node on sector thread
- node->m_snext = s->touching_thinglist; // next node on sector thread
+ node->m_thinglist_prev = NULL; // prev node on sector thread
+ node->m_thinglist_next = s->touching_thinglist; // next node on sector thread
if (s->touching_thinglist)
- node->m_snext->m_sprev = node;
+ node->m_thinglist_next->m_thinglist_prev = node;
s->touching_thinglist = node;
return node;
}
@@ -3599,7 +3641,7 @@ static mprecipsecnode_t *P_AddPrecipSecnode(sector_t *s, precipmobj_t *thing, mp
node->m_thing = thing; // Yes. Setting m_thing says 'keep it'.
return nextnode;
}
- node = node->m_tnext;
+ node = node->m_sectorlist_next;
}
// Couldn't find an existing node for this sector. Add one at the head
@@ -3612,17 +3654,17 @@ static mprecipsecnode_t *P_AddPrecipSecnode(sector_t *s, precipmobj_t *thing, mp
node->m_sector = s; // sector
node->m_thing = thing; // mobj
- node->m_tprev = NULL; // prev node on Thing thread
- node->m_tnext = nextnode; // next node on Thing thread
+ node->m_sectorlist_prev = NULL; // prev node on Thing thread
+ node->m_sectorlist_next = nextnode; // next node on Thing thread
if (nextnode)
- nextnode->m_tprev = node; // set back link on Thing
+ nextnode->m_sectorlist_prev = node; // set back link on Thing
// Add new node at head of sector thread starting at s->touching_thinglist
- node->m_sprev = NULL; // prev node on sector thread
- node->m_snext = s->touching_preciplist; // next node on sector thread
+ node->m_thinglist_prev = NULL; // prev node on sector thread
+ node->m_thinglist_next = s->touching_preciplist; // next node on sector thread
if (s->touching_preciplist)
- node->m_snext->m_sprev = node;
+ node->m_thinglist_next->m_thinglist_prev = node;
s->touching_preciplist = node;
return node;
}
@@ -3644,24 +3686,24 @@ static msecnode_t *P_DelSecnode(msecnode_t *node)
// Unlink from the Thing thread. The Thing thread begins at
// sector_list and not from mobj_t->touching_sectorlist.
- tp = node->m_tprev;
- tn = node->m_tnext;
+ tp = node->m_sectorlist_prev;
+ tn = node->m_sectorlist_next;
if (tp)
- tp->m_tnext = tn;
+ tp->m_sectorlist_next = tn;
if (tn)
- tn->m_tprev = tp;
+ tn->m_sectorlist_prev = tp;
// Unlink from the sector thread. This thread begins at
// sector_t->touching_thinglist.
- sp = node->m_sprev;
- sn = node->m_snext;
+ sp = node->m_thinglist_prev;
+ sn = node->m_thinglist_next;
if (sp)
- sp->m_snext = sn;
+ sp->m_thinglist_next = sn;
else
node->m_sector->touching_thinglist = sn;
if (sn)
- sn->m_sprev = sp;
+ sn->m_thinglist_prev = sp;
// Return this node to the freelist
@@ -3683,24 +3725,24 @@ static mprecipsecnode_t *P_DelPrecipSecnode(mprecipsecnode_t *node)
// Unlink from the Thing thread. The Thing thread begins at
// sector_list and not from mobj_t->touching_sectorlist.
- tp = node->m_tprev;
- tn = node->m_tnext;
+ tp = node->m_sectorlist_prev;
+ tn = node->m_sectorlist_next;
if (tp)
- tp->m_tnext = tn;
+ tp->m_sectorlist_next = tn;
if (tn)
- tn->m_tprev = tp;
+ tn->m_sectorlist_prev = tp;
// Unlink from the sector thread. This thread begins at
// sector_t->touching_thinglist.
- sp = node->m_sprev;
- sn = node->m_snext;
+ sp = node->m_thinglist_prev;
+ sn = node->m_thinglist_next;
if (sp)
- sp->m_snext = sn;
+ sp->m_thinglist_next = sn;
else
node->m_sector->touching_preciplist = sn;
if (sn)
- sn->m_sprev = sp;
+ sn->m_thinglist_prev = sp;
// Return this node to the freelist
@@ -3815,7 +3857,7 @@ void P_CreateSecNodeList(mobj_t *thing, fixed_t x, fixed_t y)
while (node)
{
node->m_thing = NULL;
- node = node->m_tnext;
+ node = node->m_sectorlist_next;
}
P_SetTarget(&tmthing, thing);
@@ -3853,11 +3895,11 @@ void P_CreateSecNodeList(mobj_t *thing, fixed_t x, fixed_t y)
if (!node->m_thing)
{
if (node == sector_list)
- sector_list = node->m_tnext;
+ sector_list = node->m_sectorlist_next;
node = P_DelSecnode(node);
}
else
- node = node->m_tnext;
+ node = node->m_sectorlist_next;
}
/* cph -
@@ -3898,7 +3940,7 @@ void P_CreatePrecipSecNodeList(precipmobj_t *thing,fixed_t x,fixed_t y)
while (node)
{
node->m_thing = NULL;
- node = node->m_tnext;
+ node = node->m_sectorlist_next;
}
tmprecipthing = thing;
@@ -3932,11 +3974,11 @@ void P_CreatePrecipSecNodeList(precipmobj_t *thing,fixed_t x,fixed_t y)
if (!node->m_thing)
{
if (node == precipsector_list)
- precipsector_list = node->m_tnext;
+ precipsector_list = node->m_sectorlist_next;
node = P_DelPrecipSecnode(node);
}
else
- node = node->m_tnext;
+ node = node->m_sectorlist_next;
}
/* cph -
diff --git a/src/p_mobj.c b/src/p_mobj.c
index 9e061950f..fe09f6c01 100644
--- a/src/p_mobj.c
+++ b/src/p_mobj.c
@@ -175,6 +175,8 @@ boolean P_SetPlayerMobjState(mobj_t *mobj, statenum_t state)
return P_SetPlayerMobjState(mobj, S_PLAY_SUPER_WALK);
case S_PLAY_RUN:
return P_SetPlayerMobjState(mobj, S_PLAY_SUPER_RUN);
+ case S_PLAY_PEEL:
+ return P_SetPlayerMobjState(mobj, S_PLAY_SUPER_PEEL);
case S_PLAY_PAIN:
return P_SetPlayerMobjState(mobj, S_PLAY_SUPER_PAIN);
case S_PLAY_DEAD:
@@ -231,6 +233,10 @@ boolean P_SetPlayerMobjState(mobj_t *mobj, statenum_t state)
case S_PLAY_SUPER_RUN:
player->panim = PA_RUN;
break;
+ case S_PLAY_PEEL:
+ case S_PLAY_SUPER_PEEL:
+ player->panim = PA_PEEL;
+ break;
case S_PLAY_PAIN:
case S_PLAY_SUPER_PAIN:
case S_PLAY_SUPER_STUN:
@@ -316,7 +322,7 @@ boolean P_SetPlayerMobjState(mobj_t *mobj, statenum_t state)
else
mobj->tics = 4;
}
- else if (player->panim == PA_RUN)
+ else if ((player->panim == PA_RUN) || (player->panim == PA_PEEL))
{
if (speed > 52<tics = 1;
@@ -339,6 +345,9 @@ boolean P_SetPlayerMobjState(mobj_t *mobj, statenum_t state)
{
switch(spr2)
{
+ case SPR2_PEEL:
+ spr2 = SPR2_RUN;
+ break;
case SPR2_RUN:
spr2 = SPR2_WALK;
break;
@@ -393,6 +402,9 @@ boolean P_SetPlayerMobjState(mobj_t *mobj, statenum_t state)
case SPR2_SRUN:
spr2 = SPR2_RUN;
break;
+ case SPR2_SPEE:
+ spr2 = SPR2_PEEL;
+ break;
case SPR2_SPAN:
spr2 = SPR2_PAIN;
break;
@@ -1427,13 +1439,12 @@ static void P_PlayerFlip(mobj_t *mo)
}
//
-// P_CheckGravity
+// P_GetMobjGravity
//
-// Checks the current gravity state
-// of the object. If affect is true,
-// a gravity force will be applied.
+// Returns the current gravity
+// value of the object.
//
-void P_CheckGravity(mobj_t *mo, boolean affect)
+fixed_t P_GetMobjGravity(mobj_t *mo)
{
fixed_t gravityadd = 0;
boolean no3dfloorgrav = true; // Custom gravity
@@ -1492,9 +1503,6 @@ void P_CheckGravity(mobj_t *mo, boolean affect)
if (mo->eflags & MFE_UNDERWATER && !goopgravity)
gravityadd = gravityadd/3;
- if (!mo->momz) // mobj at stop, no floor, so feel the push of gravity!
- gravityadd <<= 1;
-
if (mo->player)
{
if (mo->player->charability == CA_FLY && (mo->player->powers[pw_tailsfly]
@@ -1575,12 +1583,31 @@ void P_CheckGravity(mobj_t *mo, boolean affect)
if (goopgravity)
gravityadd = -gravityadd/5;
- if (affect)
- mo->momz += FixedMul(gravityadd, mo->scale);
-
if (mo->player && !!(mo->eflags & MFE_VERTICALFLIP) != wasflip)
P_PlayerFlip(mo);
+ gravityadd = FixedMul(gravityadd, mo->scale);
+
+ return gravityadd;
+}
+
+//
+// P_CheckGravity
+//
+// Checks the current gravity state
+// of the object. If affect is true,
+// a gravity force will be applied.
+//
+void P_CheckGravity(mobj_t *mo, boolean affect)
+{
+ fixed_t gravityadd = P_GetMobjGravity(mo);
+
+ if (!mo->momz) // mobj at stop, no floor, so feel the push of gravity!
+ gravityadd <<= 1;
+
+ if (affect)
+ mo->momz += gravityadd;
+
if (mo->type == MT_SKIM && mo->z + mo->momz <= mo->watertop && mo->z >= mo->watertop)
{
mo->momz = 0;
@@ -1655,7 +1682,7 @@ static void P_XYFriction(mobj_t *mo, fixed_t oldx, fixed_t oldy)
&& abs(player->rmomy) < FixedMul(STOPSPEED, mo->scale)
&& (!(player->cmd.forwardmove && !(twodlevel || mo->flags2 & MF2_TWOD)) && !player->cmd.sidemove && !(player->pflags & PF_SPINNING))
#ifdef ESLOPE
- && !(player->mo->standingslope && abs(player->mo->standingslope->zdelta) >= FRACUNIT/2)
+ && !(player->mo->standingslope && (!(player->mo->standingslope->flags & SL_NOPHYSICS)) && (abs(player->mo->standingslope->zdelta) >= FRACUNIT/2))
#endif
)
{
@@ -1705,7 +1732,7 @@ static void P_PushableCheckBustables(mobj_t *mo)
mo->y += mo->momy;
P_SetThingPosition(mo);
- for (node = mo->touching_sectorlist; node; node = node->m_snext)
+ for (node = mo->touching_sectorlist; node; node = node->m_sectorlist_next)
{
if (!node->m_sector)
break;
@@ -2188,12 +2215,14 @@ static void P_AdjustMobjFloorZ_FFloors(mobj_t *mo, sector_t *sector, UINT8 motyp
delta1 = mo->z - (bottomheight + ((topheight - bottomheight)/2));
delta2 = thingtop - (bottomheight + ((topheight - bottomheight)/2));
if (topheight > mo->floorz && abs(delta1) < abs(delta2)
- && !(rover->flags & FF_REVERSEPLATFORM))
+ && !(rover->flags & FF_REVERSEPLATFORM)
+ && ((P_MobjFlip(mo)*mo->momz > 0) || (!(rover->flags & FF_PLATFORM)))) // In reverse gravity, only clip for FOFs that are intangible from their bottom (the "top" you're falling through) if you're coming from above ("below" in your frame of reference)
{
mo->floorz = topheight;
}
if (bottomheight < mo->ceilingz && abs(delta1) >= abs(delta2)
- && !(rover->flags & FF_PLATFORM))
+ && !(rover->flags & FF_PLATFORM)
+ && ((P_MobjFlip(mo)*mo->momz > 0) || (!(rover->flags & FF_REVERSEPLATFORM)))) // In normal gravity, only clip for FOFs that are intangible from the top if you're coming from below
{
mo->ceilingz = bottomheight;
}
@@ -2327,16 +2356,6 @@ static boolean P_ZMovement(mobj_t *mo)
I_Assert(mo != NULL);
I_Assert(!P_MobjWasRemoved(mo));
-#ifdef ESLOPE
- if (mo->standingslope)
- {
- if (mo->flags & MF_NOCLIPHEIGHT)
- mo->standingslope = NULL;
- else if (!P_IsObjectOnGround(mo))
- P_SlopeLaunch(mo);
- }
-#endif
-
// Intercept the stupid 'fall through 3dfloors' bug
if (mo->subsector->sector->ffloors)
P_AdjustMobjFloorZ_FFloors(mo, mo->subsector->sector, 0);
@@ -2351,6 +2370,16 @@ static boolean P_ZMovement(mobj_t *mo)
}
mo->z += mo->momz;
+#ifdef ESLOPE
+ if (mo->standingslope)
+ {
+ if (mo->flags & MF_NOCLIPHEIGHT)
+ mo->standingslope = NULL;
+ else if (!P_IsObjectOnGround(mo))
+ P_SlopeLaunch(mo);
+ }
+#endif
+
switch (mo->type)
{
case MT_THROWNBOUNCE:
@@ -2420,6 +2449,7 @@ static boolean P_ZMovement(mobj_t *mo)
case MT_BLUETEAMRING:
case MT_FLINGRING:
case MT_FLINGCOIN:
+ case MT_FLINGEMERALD:
// Remove flinged stuff from death pits.
if (P_CheckDeathPitCollide(mo))
{
@@ -2451,7 +2481,6 @@ static boolean P_ZMovement(mobj_t *mo)
if (!(mo->momx || mo->momy || mo->momz))
return true;
break;
- case MT_FLINGEMERALD:
case MT_NIGHTSWING:
if (!(mo->momx || mo->momy || mo->momz))
return true;
@@ -2534,13 +2563,10 @@ static boolean P_ZMovement(mobj_t *mo)
#ifdef ESLOPE
P_CheckPosition(mo, mo->x, mo->y); // Sets mo->standingslope correctly
- if ((mo->eflags & MFE_VERTICALFLIP) ? tmceilingslope : tmfloorslope) {
+ if (((mo->eflags & MFE_VERTICALFLIP) ? tmceilingslope : tmfloorslope) && (mo->type != MT_STEAM))
+ {
mo->standingslope = (mo->eflags & MFE_VERTICALFLIP) ? tmceilingslope : tmfloorslope;
-
- // Reverse quantizing might could use its own function later
- mo->standingslope->zangle = ANGLE_MAX-mo->standingslope->zangle;
- P_QuantizeMomentumToSlope(&mom, mo->standingslope);
- mo->standingslope->zangle = ANGLE_MAX-mo->standingslope->zangle;
+ P_ReverseQuantizeMomentumToSlope(&mom, mo->standingslope);
}
#endif
@@ -2693,7 +2719,7 @@ static boolean P_ZMovement(mobj_t *mo)
mom.z = tmfloorthing->momz;
#ifdef ESLOPE
- if (mo->standingslope) {
+ if (mo->standingslope) { // MT_STEAM will never have a standingslope, see above.
P_QuantizeMomentumToSlope(&mom, mo->standingslope);
}
#endif
@@ -2878,7 +2904,7 @@ static void P_PlayerZMovement(mobj_t *mo)
msecnode_t *node;
boolean stopmovecut = false;
- for (node = mo->touching_sectorlist; node; node = node->m_snext)
+ for (node = mo->touching_sectorlist; node; node = node->m_sectorlist_next)
{
sector_t *sec = node->m_sector;
subsector_t *newsubsec;
@@ -2955,7 +2981,9 @@ static void P_PlayerZMovement(mobj_t *mo)
{
if (mo->player->cmomx || mo->player->cmomy)
{
- if (mo->player->speed >= FixedMul(mo->player->runspeed, mo->scale) && mo->player->panim != PA_RUN)
+ if (mo->player->dashmode >= 3*TICRATE && mo->player->panim != PA_PEEL)
+ P_SetPlayerMobjState(mo, S_PLAY_PEEL);
+ else if (mo->player->speed >= FixedMul(mo->player->runspeed, mo->scale) && mo->player->panim != PA_RUN)
P_SetPlayerMobjState(mo, S_PLAY_RUN);
else if ((mo->player->rmomx || mo->player->rmomy) && (mo->player->panim != PA_WALK || mo->state-states == S_PLAY_SUPER_FLOAT))
P_SetPlayerMobjState(mo, S_PLAY_WALK);
@@ -2964,6 +2992,8 @@ static void P_PlayerZMovement(mobj_t *mo)
}
else
{
+ if (mo->player->dashmode >= 3*TICRATE && mo->player->panim != PA_PEEL)
+ P_SetPlayerMobjState(mo, S_PLAY_PEEL);
if (mo->player->speed >= FixedMul(mo->player->runspeed, mo->scale) && mo->player->panim != PA_RUN)
P_SetPlayerMobjState(mo, S_PLAY_RUN);
else if ((mo->momx || mo->momy) && (mo->player->panim != PA_WALK || mo->state-states == S_PLAY_SUPER_FLOAT))
@@ -3055,7 +3085,7 @@ nightsdone:
if (CheckForMarioBlocks && !(netgame && mo->player->spectator)) // Only let the player punch
{
// Search the touching sectors, from side-to-side...
- for (node = mo->touching_sectorlist; node; node = node->m_snext)
+ for (node = mo->touching_sectorlist; node; node = node->m_sectorlist_next)
{
ffloor_t *rover;
if (!node->m_sector->ffloors)
@@ -3823,7 +3853,7 @@ static void P_PlayerMobjThinker(mobj_t *mobj)
if (!(netgame && mobj->player->spectator))
{
// Crumbling platforms
- for (node = mobj->touching_sectorlist; node; node = node->m_snext)
+ for (node = mobj->touching_sectorlist; node; node = node->m_sectorlist_next)
{
fixed_t topheight, bottomheight;
ffloor_t *rover;
@@ -3848,7 +3878,7 @@ static void P_PlayerMobjThinker(mobj_t *mobj)
{
boolean thereiswater = false;
- for (node = mobj->touching_sectorlist; node; node = node->m_snext)
+ for (node = mobj->touching_sectorlist; node; node = node->m_sectorlist_next)
{
if (node->m_sector->ffloors)
{
@@ -3869,7 +3899,7 @@ static void P_PlayerMobjThinker(mobj_t *mobj)
}
if (thereiswater)
{
- for (node = mobj->touching_sectorlist; node; node = node->m_snext)
+ for (node = mobj->touching_sectorlist; node; node = node->m_sectorlist_next)
{
if (node->m_sector->ffloors)
{
@@ -3982,7 +4012,7 @@ void P_RecalcPrecipInSector(sector_t *sector)
sector->moved = true; // Recalc lighting and things too, maybe
- for (psecnode = sector->touching_preciplist; psecnode; psecnode = psecnode->m_snext)
+ for (psecnode = sector->touching_preciplist; psecnode; psecnode = psecnode->m_thinglist_next)
CalculatePrecipFloor(psecnode->m_thing);
}
diff --git a/src/p_mobj.h b/src/p_mobj.h
index ad650ef0d..b6592cb3d 100644
--- a/src/p_mobj.h
+++ b/src/p_mobj.h
@@ -442,7 +442,7 @@ boolean P_SupermanLook4Players(mobj_t *actor);
void P_DestroyRobots(void);
void P_SnowThinker(precipmobj_t *mobj);
void P_RainThinker(precipmobj_t *mobj);
-void P_NullPrecipThinker(precipmobj_t *mobj);
+FUNCMATH void P_NullPrecipThinker(precipmobj_t *mobj);
void P_RemovePrecipMobj(precipmobj_t *mobj);
void P_SetScale(mobj_t *mobj, fixed_t newscale);
void P_XYMovement(mobj_t *mo);
diff --git a/src/p_saveg.c b/src/p_saveg.c
index 48f283bd3..964e8b774 100644
--- a/src/p_saveg.c
+++ b/src/p_saveg.c
@@ -162,6 +162,7 @@ static void P_NetArchivePlayers(void)
WRITEINT32(save_p, players[i].deadtimer);
WRITEUINT32(save_p, players[i].exiting);
WRITEUINT8(save_p, players[i].homing);
+ WRITEUINT32(save_p, players[i].dashmode);
WRITEUINT32(save_p, players[i].skidtime);
////////////////////////////
@@ -337,6 +338,7 @@ static void P_NetUnArchivePlayers(void)
players[i].deadtimer = READINT32(save_p); // End game if game over lasts too long
players[i].exiting = READUINT32(save_p); // Exitlevel timer
players[i].homing = READUINT8(save_p); // Are you homing?
+ players[i].dashmode = READUINT32(save_p); // counter for dashmode ability
players[i].skidtime = READUINT32(save_p); // Skid timer
////////////////////////////
diff --git a/src/p_setup.c b/src/p_setup.c
index b36bf0b80..e56c44c70 100644
--- a/src/p_setup.c
+++ b/src/p_setup.c
@@ -1931,10 +1931,18 @@ static void P_GroupLines(void)
// allocate linebuffers for each sector
for (i = 0, sector = sectors; i < numsectors; i++, sector++)
{
- sector->lines = Z_Calloc(sector->linecount * sizeof(line_t*), PU_LEVEL, NULL);
+ if (sector->linecount == 0) // no lines found?
+ {
+ sector->lines = NULL;
+ CONS_Debug(DBG_SETUP, "P_GroupLines: sector %s has no lines\n", sizeu1(i));
+ }
+ else
+ {
+ sector->lines = Z_Calloc(sector->linecount * sizeof(line_t*), PU_LEVEL, NULL);
- // zero the count, since we'll later use this to track how many we've recorded
- sector->linecount = 0;
+ // zero the count, since we'll later use this to track how many we've recorded
+ sector->linecount = 0;
+ }
}
// iterate through lines, assigning them to sectors' linebuffers,
@@ -1952,11 +1960,14 @@ static void P_GroupLines(void)
{
M_ClearBox(bbox);
- for (j = 0; j < sector->linecount; j++)
+ if (sector->linecount != 0)
{
- li = sector->lines[j];
- M_AddToBox(bbox, li->v1->x, li->v1->y);
- M_AddToBox(bbox, li->v2->x, li->v2->y);
+ for (j = 0; j < sector->linecount; j++)
+ {
+ li = sector->lines[j];
+ M_AddToBox(bbox, li->v1->x, li->v1->y);
+ M_AddToBox(bbox, li->v2->x, li->v2->y);
+ }
}
// set the degenmobj_t to the middle of the bounding box
@@ -1966,6 +1977,35 @@ static void P_GroupLines(void)
}
}
+//
+// P_LoadReject
+//
+// Detect if the REJECT lump is valid,
+// if not, rejectmatrix will be NULL
+static void P_LoadReject(lumpnum_t lumpnum)
+{
+ size_t count;
+ const char *lumpname = W_CheckNameForNum(lumpnum);
+
+ // Check if the lump exists, and if it's named "REJECT"
+ if (!lumpname || memcmp(lumpname, "REJECT\0\0", 8) != 0)
+ {
+ rejectmatrix = NULL;
+ CONS_Debug(DBG_SETUP, "P_LoadReject: No valid REJECT lump found\n");
+ return;
+ }
+
+ count = W_LumpLength(lumpnum);
+
+ if (!count) // zero length, someone probably used ZDBSP
+ {
+ rejectmatrix = NULL;
+ CONS_Debug(DBG_SETUP, "P_LoadReject: REJECT lump has size 0, will not be loaded\n");
+ }
+ else
+ rejectmatrix = W_CacheLumpNum(lumpnum, PU_LEVEL);
+}
+
#if 0
static char *levellumps[] =
{
@@ -2574,7 +2614,7 @@ boolean P_SetupLevel(boolean skipprecip)
P_LoadSubsectors(lastloadedmaplumpnum + ML_SSECTORS);
P_LoadNodes(lastloadedmaplumpnum + ML_NODES);
P_LoadSegs(lastloadedmaplumpnum + ML_SEGS);
- rejectmatrix = W_CacheLumpNum(lastloadedmaplumpnum + ML_REJECT, PU_LEVEL);
+ P_LoadReject(lastloadedmaplumpnum + ML_REJECT);
P_GroupLines();
numdmstarts = numredctfstarts = numbluectfstarts = 0;
diff --git a/src/p_sight.c b/src/p_sight.c
index 14c1c945f..bd6ab4d73 100644
--- a/src/p_sight.c
+++ b/src/p_sight.c
@@ -325,9 +325,12 @@ boolean P_CheckSight(mobj_t *t1, mobj_t *t2)
s2 = t2->subsector->sector;
pnum = (s1-sectors)*numsectors + (s2-sectors);
- // Check in REJECT table.
- if (rejectmatrix[pnum>>3] & (1 << (pnum&7))) // can't possibly be connected
- return false;
+ if (rejectmatrix != NULL)
+ {
+ // Check in REJECT table.
+ if (rejectmatrix[pnum>>3] & (1 << (pnum&7))) // can't possibly be connected
+ return false;
+ }
// killough 11/98: shortcut for melee situations
// same subsector? obviously visible
diff --git a/src/p_slopes.c b/src/p_slopes.c
index 6393ca4b5..d939fee98 100644
--- a/src/p_slopes.c
+++ b/src/p_slopes.c
@@ -199,7 +199,6 @@ static fixed_t P_GetExtent(sector_t *sector, line_t *line)
// Find furthest vertex from the reference line. It, along with the two ends
// of the line, will define the plane.
- // SRB2CBTODO: Use a formula to get the slope to slide objects depending on how steep
for(i = 0; i < sector->linecount; i++)
{
line_t *li = sector->lines[i];
@@ -231,7 +230,6 @@ static fixed_t P_GetExtent(sector_t *sector, line_t *line)
//
// Creates one or more slopes based on the given line type and front/back
// sectors.
-// Kalaron: Check if dynamic slopes need recalculation
//
void P_SpawnSlope_Line(int linenum)
{
@@ -276,7 +274,6 @@ void P_SpawnSlope_Line(int linenum)
ny = -FixedDiv(line->dx, len);
}
- // SRB2CBTODO: Transform origin relative to the bounds of an individual FOF
origin.x = line->v1->x + (line->v2->x - line->v1->x)/2;
origin.y = line->v1->y + (line->v2->y - line->v1->y)/2;
@@ -327,7 +324,7 @@ void P_SpawnSlope_Line(int linenum)
// fslope->normal is a 3D line perpendicular to the 3D vector
// Sync the linedata of the line that started this slope
- // SRB2CBTODO: Anything special for remote(control sector)-based slopes later?
+ // TODO: Anything special for control sector based slopes later?
fslope->sourceline = line;
// To find the real highz/lowz of a slope, you need to check all the vertexes
@@ -379,7 +376,7 @@ void P_SpawnSlope_Line(int linenum)
cslope->refpos = 2;
// Sync the linedata of the line that started this slope
- // SRB2CBTODO: Anything special for remote(control sector)-based slopes later?
+ // TODO: Anything special for control sector based slopes later?
cslope->sourceline = line;
// Remember the way the slope is formed
@@ -445,7 +442,7 @@ void P_SpawnSlope_Line(int linenum)
fslope->refpos = 3;
// Sync the linedata of the line that started this slope
- // SRB2CBTODO: Anything special for remote(control sector)-based slopes later?
+ // TODO: Anything special for control sector based slopes later?
fslope->sourceline = line;
// Remember the way the slope is formed
@@ -488,7 +485,7 @@ void P_SpawnSlope_Line(int linenum)
cslope->refpos = 4;
// Sync the linedata of the line that started this slope
- // SRB2CBTODO: Anything special for remote(control sector)-based slopes later?
+ // TODO: Anything special for control sector based slopes later?
cslope->sourceline = line;
// Remember the way the slope is formed
@@ -554,16 +551,11 @@ static pslope_t *P_NewVertexSlope(INT16 tag1, INT16 tag2, INT16 tag3, UINT8 flag
ret->vertices[2] = mt;
}
- if (!ret->vertices[0])
- CONS_Printf("PANIC 0\n");
- if (!ret->vertices[1])
- CONS_Printf("PANIC 1\n");
- if (!ret->vertices[2])
- CONS_Printf("PANIC 2\n");
-
// Now set heights for each vertex, because they haven't been set yet
for (i = 0; i < 3; i++) {
mt = ret->vertices[i];
+ if (!mt) // If a vertex wasn't found, it's game over. There's nothing you can do to recover (except maybe try and kill the slope instead - TODO?)
+ I_Error("P_NewVertexSlope: Slope vertex %s (for linedef tag %d) not found!", sizeu1(i), tag1);
if (mt->extrainfo)
mt->z = mt->options;
else
@@ -623,265 +615,10 @@ pslope_t *P_SlopeById(UINT16 id)
return ret;
}
-#ifdef SPRINGCLEAN
-#include "byteptr.h"
-
-#include "p_setup.h"
-#include "p_local.h"
-
-//==========================================================================
-//
-// P_SetSlopesFromVertexHeights
-//
-//==========================================================================
-void P_SetSlopesFromVertexHeights(lumpnum_t lumpnum)
-{
- mapthing_t *mt;
- boolean vt_found = false;
- size_t i, j, k, l, q;
-
- //size_t i;
- //mapthing_t *mt;
- char *data;
- char *datastart;
-
- // SRB2CBTODO: WHAT IS (5 * sizeof (short))?! It = 10
- // anything else seems to make a map not load properly,
- // but this hard-coded value MUST have some reason for being what it is
- size_t snummapthings = W_LumpLength(lumpnum) / (5 * sizeof (short));
- mapthing_t *smapthings = Z_Calloc(snummapthings * sizeof (*smapthings), PU_LEVEL, NULL);
- fixed_t x, y;
- sector_t *sector;
- // Spawn axis points first so they are
- // at the front of the list for fast searching.
- data = datastart = W_CacheLumpNum(lumpnum, PU_LEVEL);
- mt = smapthings;
- for (i = 0; i < snummapthings; i++, mt++)
- {
- mt->x = READINT16(data);
- mt->y = READINT16(data);
- mt->angle = READINT16(data);
- mt->type = READINT16(data);
- mt->options = READINT16(data);
- // mt->z hasn't been set yet!
- //mt->extrainfo = (byte)(mt->type >> 12); // slope things are special, they have a bigger range of types
-
- //mt->type &= 4095; // SRB2CBTODO: WHAT IS THIS???? Mobj type limits?!!!!
- x = mt->x*FRACUNIT;
- y = mt->y*FRACUNIT;
- sector = R_PointInSubsector(x, y)->sector;
- // Z for objects
-#ifdef ESLOPE
- if (sector->f_slope)
- mt->z = (short)(P_GetZAt(sector->f_slope, x, y)>>FRACBITS);
- else
-#endif
- mt->z = (short)(sector->floorheight>>FRACBITS);
-
- mt->z = mt->z + (mt->options >> ZSHIFT);
-
- if (mt->type == THING_VertexFloorZ || mt->type == THING_VertexCeilingZ) // THING_VertexFloorZ
- {
- for(l = 0; l < numvertexes; l++)
- {
- if (vertexes[l].x == mt->x*FRACUNIT && vertexes[l].y == mt->y*FRACUNIT)
- {
- if (mt->type == THING_VertexFloorZ)
- {
- vertexes[l].z = mt->z*FRACUNIT;
- //I_Error("Z value: %i", vertexes[l].z/FRACUNIT);
-
- }
- else
- {
- vertexes[l].z = mt->z*FRACUNIT; // celing floor
- }
- vt_found = true;
- }
- }
- //mt->type = 0; // VPHYSICS: Dynamic slopes
-
-
-
-
-
-
- if (vt_found)
- {
- for (k = 0; k < numsectors; k++)
- {
- sector_t *sec = §ors[k];
- if (sec->linecount != 3) continue; // only works with triangular sectors
-
- v3float_t vt1, vt2, vt3; // cross = ret->normalf
- v3float_t vec1, vec2;
-
- int vi1, vi2, vi3;
-
- vi1 = (int)(sec->lines[0]->v1 - vertexes);
- vi2 = (int)(sec->lines[0]->v2 - vertexes);
- vi3 = (sec->lines[1]->v1 == sec->lines[0]->v1 || sec->lines[1]->v1 == sec->lines[0]->v2)?
- (int)(sec->lines[1]->v2 - vertexes) : (int)(sec->lines[1]->v1 - vertexes);
-
- //if (vertexes[vi1].z)
- // I_Error("OSNAP %i", vertexes[vi1].z/FRACUNIT);
- //if (vertexes[vi2].z)
- // I_Error("OSNAP %i", vertexes[vi2].z/FRACUNIT);
- //if (vertexes[vi3].z)
- // I_Error("OSNAP %i", vertexes[vi3].z/FRACUNIT);
-
- //I_Error("%i, %i", mt->z*FRACUNIT, vertexes[vi1].z);
-
- //I_Error("%i, %i, %i", mt->x, mt->y, mt->z);
- //P_SpawnMobj(mt->x*FRACUNIT, mt->y*FRACUNIT, mt->z*FRACUNIT, MT_RING);
-
- // TODO: Make sure not to spawn in the same place 2x! (we need an object in every vertex of the
- // triangle sector to setup the real vertex slopes
- // Check for the vertexes of all sectors
- for(q = 0; q < numvertexes; q++)
- {
- if (vertexes[q].x == mt->x*FRACUNIT && vertexes[q].y == mt->y*FRACUNIT)
- {
- //I_Error("yeah %i", vertexes[q].z);
- P_SpawnMobj(vertexes[q].x, vertexes[q].y, vertexes[q].z, MT_RING);
-#if 0
- if ((mt->y*FRACUNIT == vertexes[vi1].y && mt->x*FRACUNIT == vertexes[vi1].x && mt->z*FRACUNIT == vertexes[vi1].z)
- && !(mt->y*FRACUNIT == vertexes[vi2].y && mt->x*FRACUNIT == vertexes[vi2].x && mt->z*FRACUNIT == vertexes[vi2].z)
- && !(mt->y*FRACUNIT == vertexes[vi3].y && mt->x*FRACUNIT == vertexes[vi3].x && mt->z*FRACUNIT == vertexes[vi3].z))
- P_SpawnMobj(vertexes[vi1].x, vertexes[vi1].y, vertexes[vi1].z, MT_RING);
- else if ((mt->y*FRACUNIT == vertexes[vi2].y && mt->x*FRACUNIT == vertexes[vi2].x && mt->z*FRACUNIT == vertexes[vi2].z)
- && !(mt->y*FRACUNIT == vertexes[vi1].y && mt->x*FRACUNIT == vertexes[vi1].x && mt->z*FRACUNIT == vertexes[vi1].z)
- && !(mt->y*FRACUNIT == vertexes[vi3].y && mt->x*FRACUNIT == vertexes[vi3].x && mt->z*FRACUNIT == vertexes[vi3].z))
- P_SpawnMobj(vertexes[vi2].x, vertexes[vi2].y, vertexes[vi2].z, MT_BOUNCETV);
- else if ((mt->y*FRACUNIT == vertexes[vi3].y && mt->x*FRACUNIT == vertexes[vi3].x && mt->z*FRACUNIT == vertexes[vi3].z)
- && !(mt->y*FRACUNIT == vertexes[vi2].y && mt->x*FRACUNIT == vertexes[vi2].x && mt->z*FRACUNIT == vertexes[vi2].z)
- && !(mt->y*FRACUNIT == vertexes[vi1].y && mt->x*FRACUNIT == vertexes[vi1].x && mt->z*FRACUNIT == vertexes[vi1].z))
- P_SpawnMobj(vertexes[vi3].x, vertexes[vi3].y, vertexes[vi3].z, MT_GFZFLOWER1);
- else
-#endif
- continue;
- }
- }
-
- vt1.x = FIXED_TO_FLOAT(vertexes[vi1].x);
- vt1.y = FIXED_TO_FLOAT(vertexes[vi1].y);
- vt2.x = FIXED_TO_FLOAT(vertexes[vi2].x);
- vt2.y = FIXED_TO_FLOAT(vertexes[vi2].y);
- vt3.x = FIXED_TO_FLOAT(vertexes[vi3].x);
- vt3.y = FIXED_TO_FLOAT(vertexes[vi3].y);
-
- for(j = 0; j < 2; j++)
- {
-
- fixed_t z3;
- //I_Error("Lo hicimos");
-
- vt1.z = mt->z;//FIXED_TO_FLOAT(j==0 ? sec->floorheight : sec->ceilingheight);
- vt2.z = mt->z;//FIXED_TO_FLOAT(j==0? sec->floorheight : sec->ceilingheight);
- z3 = mt->z;//j==0? sec->floorheight : sec->ceilingheight; // Destination height
- vt3.z = FIXED_TO_FLOAT(z3);
-
- if (P_PointOnLineSide(vertexes[vi3].x, vertexes[vi3].y, sec->lines[0]) == 0)
- {
- vec1.x = vt2.x - vt3.x;
- vec1.y = vt2.y - vt3.y;
- vec1.z = vt2.z - vt3.z;
-
- vec2.x = vt1.x - vt3.x;
- vec2.y = vt1.y - vt3.y;
- vec2.z = vt1.z - vt3.z;
- }
- else
- {
- vec1.x = vt1.x - vt3.x;
- vec1.y = vt1.y - vt3.y;
- vec1.z = vt1.z - vt3.z;
-
- vec2.x = vt2.x - vt3.x;
- vec2.y = vt2.y - vt3.y;
- vec2.z = vt2.z - vt3.z;
- }
-
-
- pslope_t *ret = Z_Malloc(sizeof(pslope_t), PU_LEVEL, NULL);
- memset(ret, 0, sizeof(*ret));
-
- {
- M_CrossProduct3f(&ret->normalf, &vec1, &vec2);
-
- // Cross product length
- float len = (float)sqrt(ret->normalf.x * ret->normalf.x +
- ret->normalf.y * ret->normalf.y +
- ret->normalf.z * ret->normalf.z);
-
- if (len == 0)
- {
- // Only happens when all vertices in this sector are on the same line.
- // Let's just ignore this case.
- //CONS_Printf("Slope thing at (%d,%d) lies directly on its target line.\n", (int)(x>>16), (int)(y>>16));
- return;
- }
- // cross/len
- ret->normalf.x /= len;
- ret->normalf.y /= len;
- ret->normalf.z /= len;
-
- // ZDoom cross = ret->normalf
- // Fix backward normals
- if ((ret->normalf.z < 0 && j == 0) || (ret->normalf.z > 0 && j == 1))
- {
- // cross = -cross
- ret->normalf.x = -ret->normalf.x;
- ret->normalf.y = -ret->normalf.x;
- ret->normalf.z = -ret->normalf.x;
- }
- }
-
- secplane_t *srcplane = Z_Calloc(sizeof(*srcplane), PU_LEVEL, NULL);
-
- srcplane->a = FLOAT_TO_FIXED (ret->normalf.x);
- srcplane->b = FLOAT_TO_FIXED (ret->normalf.y);
- srcplane->c = FLOAT_TO_FIXED (ret->normalf.z);
- //srcplane->ic = FixedDiv(FRACUNIT, srcplane->c);
- srcplane->d = -TMulScale16 (srcplane->a, vertexes[vi3].x,
- srcplane->b, vertexes[vi3].y,
- srcplane->c, z3);
-
- if (j == 0)
- {
- sec->f_slope = ret;
- sec->f_slope->secplane = *srcplane;
- }
- else if (j == 1)
- {
- sec->c_slope = ret;
- sec->c_slope->secplane = *srcplane;
- }
- }
- }
- }
-
-
-
-
-
-
-
-
- }
- }
- Z_Free(datastart);
-
-
-
-
-}
-#endif
-
// Reset the dynamic slopes pointer, and read all of the fancy schmancy slopes
void P_ResetDynamicSlopes(void) {
size_t i;
-#if 1 // Rewrite old specials to new ones, and give a console warning
+#ifdef ESLOPE_TYPESHIM // Rewrite old specials to new ones, and give a console warning
boolean warned = false;
#endif
@@ -894,7 +631,7 @@ void P_ResetDynamicSlopes(void) {
{
switch (lines[i].special)
{
-#if 1 // Rewrite old specials to new ones, and give a console warning
+#ifdef ESLOPE_TYPESHIM // Rewrite old specials to new ones, and give a console warning
#define WARNME if (!warned) {warned = true; CONS_Alert(CONS_WARNING, "This level uses old slope specials.\nA conversion will be needed before 2.2's release.\n");}
case 386:
case 387:
@@ -1018,7 +755,11 @@ fixed_t P_GetZAt(pslope_t *slope, fixed_t x, fixed_t y)
// When given a vector, rotates it and aligns it to a slope
void P_QuantizeMomentumToSlope(vector3_t *momentum, pslope_t *slope)
{
- vector3_t axis;
+ vector3_t axis; // Fuck you, C90.
+
+ if (slope->flags & SL_NOPHYSICS)
+ return; // No physics, no quantizing.
+
axis.x = -slope->d.y;
axis.y = slope->d.x;
axis.z = 0;
@@ -1026,24 +767,38 @@ void P_QuantizeMomentumToSlope(vector3_t *momentum, pslope_t *slope)
FV3_Rotate(momentum, &axis, slope->zangle >> ANGLETOFINESHIFT);
}
+//
+// P_ReverseQuantizeMomentumToSlope
+//
+// When given a vector, rotates and aligns it to a flat surface (from being relative to a given slope)
+void P_ReverseQuantizeMomentumToSlope(vector3_t *momentum, pslope_t *slope)
+{
+ slope->zangle = InvAngle(slope->zangle);
+ P_QuantizeMomentumToSlope(momentum, slope);
+ slope->zangle = InvAngle(slope->zangle);
+}
+
//
// P_SlopeLaunch
//
// Handles slope ejection for objects
void P_SlopeLaunch(mobj_t *mo)
{
- // Double the pre-rotation Z, then halve the post-rotation Z. This reduces the
- // vertical launch given from slopes while increasing the horizontal launch
- // given. Good for SRB2's gravity and horizontal speeds.
- vector3_t slopemom;
- slopemom.x = mo->momx;
- slopemom.y = mo->momy;
- slopemom.z = mo->momz*2;
- P_QuantizeMomentumToSlope(&slopemom, mo->standingslope);
+ if (!(mo->standingslope->flags & SL_NOPHYSICS)) // If there's physics, time for launching.
+ {
+ // Double the pre-rotation Z, then halve the post-rotation Z. This reduces the
+ // vertical launch given from slopes while increasing the horizontal launch
+ // given. Good for SRB2's gravity and horizontal speeds.
+ vector3_t slopemom;
+ slopemom.x = mo->momx;
+ slopemom.y = mo->momy;
+ slopemom.z = mo->momz*2;
+ P_QuantizeMomentumToSlope(&slopemom, mo->standingslope);
- mo->momx = slopemom.x;
- mo->momy = slopemom.y;
- mo->momz = slopemom.z/2;
+ mo->momx = slopemom.x;
+ mo->momy = slopemom.y;
+ mo->momz = slopemom.z/2;
+ }
//CONS_Printf("Launched off of slope.\n");
mo->standingslope = NULL;
@@ -1052,17 +807,21 @@ void P_SlopeLaunch(mobj_t *mo)
// Function to help handle landing on slopes
void P_HandleSlopeLanding(mobj_t *thing, pslope_t *slope)
{
- vector3_t mom;
+ vector3_t mom; // Ditto.
+
+ if (slope->flags & SL_NOPHYSICS) { // No physics, no need to make anything complicated.
+ if (P_MobjFlip(thing)*(thing->momz) < 0) { // falling, land on slope
+ thing->momz = -P_MobjFlip(thing);
+ thing->standingslope = slope;
+ }
+ return;
+ }
+
mom.x = thing->momx;
mom.y = thing->momy;
mom.z = thing->momz*2;
- //CONS_Printf("langing on slope\n");
-
- // Reverse quantizing might could use its own function later
- slope->zangle = ANGLE_MAX-slope->zangle;
- P_QuantizeMomentumToSlope(&mom, slope);
- slope->zangle = ANGLE_MAX-slope->zangle;
+ P_ReverseQuantizeMomentumToSlope(&mom, slope);
if (P_MobjFlip(thing)*mom.z < 0) { // falling, land on slope
thing->momx = mom.x;
@@ -1082,6 +841,9 @@ void P_ButteredSlope(mobj_t *mo)
if (!mo->standingslope)
return;
+ if (mo->standingslope->flags & SL_NOPHYSICS)
+ return; // No physics, no butter.
+
if (mo->flags & (MF_NOCLIPHEIGHT|MF_NOGRAVITY))
return; // don't slide down slopes if you can't touch them or you're not affected by gravity
@@ -1106,8 +868,6 @@ void P_ButteredSlope(mobj_t *mo)
mult = FINECOSINE(angle >> ANGLETOFINESHIFT);
}
- //CONS_Printf("%d\n", mult);
-
thrust = FixedMul(thrust, FRACUNIT*2/3 + mult/8);
}
@@ -1115,10 +875,11 @@ void P_ButteredSlope(mobj_t *mo)
thrust = FixedMul(thrust, FRACUNIT+P_AproxDistance(mo->momx, mo->momy)/16);
// This makes it harder to zigzag up steep slopes, as well as allows greater top speed when rolling down
- // Multiply by gravity
- thrust = FixedMul(thrust, gravity); // TODO account for per-sector gravity etc
- // Multiply by scale (gravity strength depends on mobj scale)
- thrust = FixedMul(thrust, mo->scale);
+ // Let's get the gravity strength for the object...
+ thrust = FixedMul(thrust, abs(P_GetMobjGravity(mo)));
+
+ // ... and its friction against the ground for good measure (divided by original friction to keep behaviour for normal slopes the same).
+ thrust = FixedMul(thrust, FixedDiv(mo->friction, ORIG_FRICTION));
P_Thrust(mo, mo->standingslope->xydirection, thrust);
}
diff --git a/src/p_slopes.h b/src/p_slopes.h
index 80921a84b..de38f1d9e 100644
--- a/src/p_slopes.h
+++ b/src/p_slopes.h
@@ -21,26 +21,6 @@ void P_RunDynamicSlopes(void);
// sectors.
void P_SpawnSlope_Line(int linenum);
-#ifdef SPRINGCLEAN
-// Loads just map objects that make slopes,
-// terrain affecting objects have to be spawned first
-void P_SetSlopesFromVertexHeights(lumpnum_t lumpnum);
-
-typedef enum
-{
- THING_SlopeFloorPointLine = 9500,
- THING_SlopeCeilingPointLine = 9501,
- THING_SetFloorSlope = 9502,
- THING_SetCeilingSlope = 9503,
- THING_CopyFloorPlane = 9510,
- THING_CopyCeilingPlane = 9511,
- THING_VavoomFloor=1500,
- THING_VavoomCeiling=1501,
- THING_VertexFloorZ=1504,
- THING_VertexCeilingZ=1505,
-} slopething_e;
-#endif
-
//
// P_CopySectorSlope
//
@@ -55,6 +35,7 @@ fixed_t P_GetZAt(pslope_t *slope, fixed_t x, fixed_t y);
// Lots of physics-based bullshit
void P_QuantizeMomentumToSlope(vector3_t *momentum, pslope_t *slope);
+void P_ReverseQuantizeMomentumToSlope(vector3_t *momentum, pslope_t *slope);
void P_SlopeLaunch(mobj_t *mo);
void P_HandleSlopeLanding(mobj_t *thing, pslope_t *slope);
void P_ButteredSlope(mobj_t *mo);
diff --git a/src/p_spec.c b/src/p_spec.c
index 51c2d03d8..582f031db 100644
--- a/src/p_spec.c
+++ b/src/p_spec.c
@@ -1642,7 +1642,7 @@ boolean P_RunTriggerLinedef(line_t *triggerline, mobj_t *actor, sector_t *caller
mo = node->m_thing;
if (mo->flags & MF_PUSHABLE)
numpush++;
- node = node->m_snext;
+ node = node->m_thinglist_next;
}
if (triggerline->flags & ML_NOCLIMB) // Need at least or more
@@ -2435,10 +2435,10 @@ static void P_ProcessLineSpecial(line_t *line, mobj_t *mo, sector_t *callsec)
if (rover->master->frontsector->tag != line->tag)
continue;
- if (mo->z > *rover->topheight)
+ if (mo->z > P_GetSpecialTopZ(mo, sectors + rover->secnum, mo->subsector->sector))
continue;
- if (mo->z + mo->height < *rover->bottomheight)
+ if (mo->z + mo->height < P_GetSpecialBottomZ(mo, sectors + rover->secnum, mo->subsector->sector))
continue;
foundit = true;
@@ -3145,7 +3145,7 @@ void P_SetupSignExit(player_t *player)
thinker_t *think;
INT32 numfound = 0;
- for (; node; node = node->m_snext)
+ for (; node; node = node->m_thinglist_next)
{
thing = node->m_thing;
if (thing->type != MT_SIGN)
@@ -3228,8 +3228,8 @@ boolean P_IsFlagAtBase(mobjtype_t flag)
if (GETSECSPECIAL(rover->master->frontsector->special, 4) != specialnum)
continue;
- if (mo->z <= *rover->topheight
- && mo->z >= *rover->bottomheight)
+ if (mo->z <= P_GetSpecialTopZ(mo, sectors + rover->secnum, mo->subsector->sector)
+ && mo->z >= P_GetSpecialBottomZ(mo, sectors + rover->secnum, mo->subsector->sector))
return true;
}
}
@@ -3263,12 +3263,17 @@ sector_t *P_PlayerTouchingSectorSpecial(player_t *player, INT32 section, INT32 n
// Hmm.. maybe there's a FOF that has it...
for (rover = player->mo->subsector->sector->ffloors; rover; rover = rover->next)
{
+ fixed_t topheight, bottomheight;
+
if (GETSECSPECIAL(rover->master->frontsector->special, section) != number)
continue;
if (!(rover->flags & FF_EXISTS))
continue;
+ topheight = P_GetSpecialTopZ(player->mo, sectors + rover->secnum, player->mo->subsector->sector);
+ bottomheight = P_GetSpecialBottomZ(player->mo, sectors + rover->secnum, player->mo->subsector->sector);
+
// Check the 3D floor's type...
if (rover->flags & FF_BLOCKPLAYER)
{
@@ -3276,27 +3281,27 @@ sector_t *P_PlayerTouchingSectorSpecial(player_t *player, INT32 section, INT32 n
if ((rover->master->frontsector->flags & SF_FLIPSPECIAL_FLOOR)
&& !(rover->master->frontsector->flags & SF_FLIPSPECIAL_CEILING))
{
- if ((player->mo->eflags & MFE_VERTICALFLIP) || player->mo->z != *rover->topheight)
+ if ((player->mo->eflags & MFE_VERTICALFLIP) || player->mo->z != topheight)
continue;
}
else if ((rover->master->frontsector->flags & SF_FLIPSPECIAL_CEILING)
&& !(rover->master->frontsector->flags & SF_FLIPSPECIAL_FLOOR))
{
if (!(player->mo->eflags & MFE_VERTICALFLIP)
- || player->mo->z + player->mo->height != *rover->bottomheight)
+ || player->mo->z + player->mo->height != bottomheight)
continue;
}
else if (rover->master->frontsector->flags & SF_FLIPSPECIAL_BOTH)
{
- if (!((player->mo->eflags & MFE_VERTICALFLIP && player->mo->z + player->mo->height == *rover->bottomheight)
- || (!(player->mo->eflags & MFE_VERTICALFLIP) && player->mo->z == *rover->topheight)))
+ if (!((player->mo->eflags & MFE_VERTICALFLIP && player->mo->z + player->mo->height == bottomheight)
+ || (!(player->mo->eflags & MFE_VERTICALFLIP) && player->mo->z == topheight)))
continue;
}
}
else
{
// Water and DEATH FOG!!! heh
- if (player->mo->z > *rover->topheight || (player->mo->z + player->mo->height) < *rover->bottomheight)
+ if (player->mo->z > topheight || (player->mo->z + player->mo->height) < bottomheight)
continue;
}
@@ -3304,7 +3309,7 @@ sector_t *P_PlayerTouchingSectorSpecial(player_t *player, INT32 section, INT32 n
return rover->master->frontsector;
}
- for (node = player->mo->touching_sectorlist; node; node = node->m_snext)
+ for (node = player->mo->touching_sectorlist; node; node = node->m_sectorlist_next)
{
if (GETSECSPECIAL(node->m_sector->special, section) == number)
{
@@ -3318,12 +3323,17 @@ sector_t *P_PlayerTouchingSectorSpecial(player_t *player, INT32 section, INT32 n
// Hmm.. maybe there's a FOF that has it...
for (rover = node->m_sector->ffloors; rover; rover = rover->next)
{
+ fixed_t topheight, bottomheight;
+
if (GETSECSPECIAL(rover->master->frontsector->special, section) != number)
continue;
if (!(rover->flags & FF_EXISTS))
continue;
+ topheight = P_GetSpecialTopZ(player->mo, sectors + rover->secnum, player->mo->subsector->sector);
+ bottomheight = P_GetSpecialBottomZ(player->mo, sectors + rover->secnum, player->mo->subsector->sector);
+
// Check the 3D floor's type...
if (rover->flags & FF_BLOCKPLAYER)
{
@@ -3331,27 +3341,27 @@ sector_t *P_PlayerTouchingSectorSpecial(player_t *player, INT32 section, INT32 n
if ((rover->master->frontsector->flags & SF_FLIPSPECIAL_FLOOR)
&& !(rover->master->frontsector->flags & SF_FLIPSPECIAL_CEILING))
{
- if ((player->mo->eflags & MFE_VERTICALFLIP) || player->mo->z != *rover->topheight)
+ if ((player->mo->eflags & MFE_VERTICALFLIP) || player->mo->z != topheight)
continue;
}
else if ((rover->master->frontsector->flags & SF_FLIPSPECIAL_CEILING)
&& !(rover->master->frontsector->flags & SF_FLIPSPECIAL_FLOOR))
{
if (!(player->mo->eflags & MFE_VERTICALFLIP)
- || player->mo->z + player->mo->height != *rover->bottomheight)
+ || player->mo->z + player->mo->height != bottomheight)
continue;
}
else if (rover->master->frontsector->flags & SF_FLIPSPECIAL_BOTH)
{
- if (!((player->mo->eflags & MFE_VERTICALFLIP && player->mo->z + player->mo->height == *rover->bottomheight)
- || (!(player->mo->eflags & MFE_VERTICALFLIP) && player->mo->z == *rover->topheight)))
+ if (!((player->mo->eflags & MFE_VERTICALFLIP && player->mo->z + player->mo->height == bottomheight)
+ || (!(player->mo->eflags & MFE_VERTICALFLIP) && player->mo->z == topheight)))
continue;
}
}
else
{
// Water and DEATH FOG!!! heh
- if (player->mo->z > *rover->topheight || (player->mo->z + player->mo->height) < *rover->bottomheight)
+ if (player->mo->z > topheight || (player->mo->z + player->mo->height) < bottomheight)
continue;
}
@@ -4336,12 +4346,17 @@ sector_t *P_ThingOnSpecial3DFloor(mobj_t *mo)
for (rover = sector->ffloors; rover; rover = rover->next)
{
+ fixed_t topheight, bottomheight;
+
if (!rover->master->frontsector->special)
continue;
if (!(rover->flags & FF_EXISTS))
continue;
+ topheight = P_GetSpecialTopZ(mo, sectors + rover->secnum, sector);
+ bottomheight = P_GetSpecialBottomZ(mo, sectors + rover->secnum, sector);
+
// Check the 3D floor's type...
if (((rover->flags & FF_BLOCKPLAYER) && mo->player)
|| ((rover->flags & FF_BLOCKOTHERS) && !mo->player))
@@ -4350,27 +4365,27 @@ sector_t *P_ThingOnSpecial3DFloor(mobj_t *mo)
if ((rover->master->frontsector->flags & SF_FLIPSPECIAL_FLOOR)
&& !(rover->master->frontsector->flags & SF_FLIPSPECIAL_CEILING))
{
- if ((mo->eflags & MFE_VERTICALFLIP) || mo->z != *rover->topheight)
+ if ((mo->eflags & MFE_VERTICALFLIP) || mo->z != topheight)
continue;
}
else if ((rover->master->frontsector->flags & SF_FLIPSPECIAL_CEILING)
&& !(rover->master->frontsector->flags & SF_FLIPSPECIAL_FLOOR))
{
if (!(mo->eflags & MFE_VERTICALFLIP)
- || mo->z + mo->height != *rover->bottomheight)
+ || mo->z + mo->height != bottomheight)
continue;
}
else if (rover->master->frontsector->flags & SF_FLIPSPECIAL_BOTH)
{
- if (!((mo->eflags & MFE_VERTICALFLIP && mo->z + mo->height == *rover->bottomheight)
- || (!(mo->eflags & MFE_VERTICALFLIP) && mo->z == *rover->topheight)))
+ if (!((mo->eflags & MFE_VERTICALFLIP && mo->z + mo->height == bottomheight)
+ || (!(mo->eflags & MFE_VERTICALFLIP) && mo->z == topheight)))
continue;
}
}
else
{
// Water and intangible FOFs
- if (mo->z > *rover->topheight || (mo->z + mo->height) < *rover->bottomheight)
+ if (mo->z > topheight || (mo->z + mo->height) < bottomheight)
continue;
}
@@ -4392,12 +4407,17 @@ static void P_PlayerOnSpecial3DFloor(player_t *player, sector_t *sector)
for (rover = sector->ffloors; rover; rover = rover->next)
{
+ fixed_t topheight, bottomheight;
+
if (!rover->master->frontsector->special)
continue;
if (!(rover->flags & FF_EXISTS))
continue;
+ topheight = P_GetSpecialTopZ(player->mo, sectors + rover->secnum, sector);
+ bottomheight = P_GetSpecialBottomZ(player->mo, sectors + rover->secnum, sector);
+
// Check the 3D floor's type...
if (rover->flags & FF_BLOCKPLAYER)
{
@@ -4405,27 +4425,27 @@ static void P_PlayerOnSpecial3DFloor(player_t *player, sector_t *sector)
if ((rover->master->frontsector->flags & SF_FLIPSPECIAL_FLOOR)
&& !(rover->master->frontsector->flags & SF_FLIPSPECIAL_CEILING))
{
- if ((player->mo->eflags & MFE_VERTICALFLIP) || player->mo->z != P_GetSpecialTopZ(player->mo, sectors + rover->secnum, sector))
+ if ((player->mo->eflags & MFE_VERTICALFLIP) || player->mo->z != topheight)
continue;
}
else if ((rover->master->frontsector->flags & SF_FLIPSPECIAL_CEILING)
&& !(rover->master->frontsector->flags & SF_FLIPSPECIAL_FLOOR))
{
if (!(player->mo->eflags & MFE_VERTICALFLIP)
- || player->mo->z + player->mo->height != P_GetSpecialBottomZ(player->mo, sectors + rover->secnum, sector))
+ || player->mo->z + player->mo->height != bottomheight)
continue;
}
else if (rover->master->frontsector->flags & SF_FLIPSPECIAL_BOTH)
{
- if (!((player->mo->eflags & MFE_VERTICALFLIP && player->mo->z + player->mo->height == P_GetSpecialBottomZ(player->mo, sectors + rover->secnum, sector))
- || (!(player->mo->eflags & MFE_VERTICALFLIP) && player->mo->z == P_GetSpecialTopZ(player->mo, sectors + rover->secnum, sector))))
+ if (!((player->mo->eflags & MFE_VERTICALFLIP && player->mo->z + player->mo->height == bottomheight)
+ || (!(player->mo->eflags & MFE_VERTICALFLIP) && player->mo->z == topheight)))
continue;
}
}
else
{
// Water and DEATH FOG!!! heh
- if (player->mo->z > P_GetSpecialTopZ(player->mo, sectors + rover->secnum, sector) || (player->mo->z + player->mo->height) < P_GetSpecialBottomZ(player->mo, sectors + rover->secnum, sector))
+ if (player->mo->z > topheight || (player->mo->z + player->mo->height) < bottomheight)
continue;
}
@@ -4638,7 +4658,7 @@ void P_PlayerInSpecialSector(player_t *player)
P_RunSpecialSectorCheck(player, sector);
// Iterate through touching_sectorlist
- for (node = player->mo->touching_sectorlist; node; node = node->m_snext)
+ for (node = player->mo->touching_sectorlist; node; node = node->m_sectorlist_next)
{
sector = node->m_sector;
@@ -5306,11 +5326,19 @@ void T_LaserFlash(laserthink_t *flash)
sourcesec = ffloor->master->frontsector; // Less to type!
+#ifdef ESLOPE
+ top = (*ffloor->t_slope) ? P_GetZAt(*ffloor->t_slope, sector->soundorg.x, sector->soundorg.y)
+ : *ffloor->topheight;
+ bottom = (*ffloor->b_slope) ? P_GetZAt(*ffloor->b_slope, sector->soundorg.x, sector->soundorg.y)
+ : *ffloor->bottomheight;
+ sector->soundorg.z = (top + bottom)/2;
+#else
sector->soundorg.z = (*ffloor->topheight + *ffloor->bottomheight)/2;
+#endif
S_StartSound(§or->soundorg, sfx_laser);
// Seek out objects to DESTROY! MUAHAHHAHAHAA!!!*cough*
- for (node = sector->touching_thinglist; node && node->m_thing; node = node->m_snext)
+ for (node = sector->touching_thinglist; node && node->m_thing; node = node->m_thinglist_next)
{
thing = node->m_thing;
@@ -6581,7 +6609,7 @@ void T_Scroll(scroll_t *s)
sector_t *psec;
psec = sectors + sect;
- for (node = psec->touching_thinglist; node; node = node->m_snext)
+ for (node = psec->touching_thinglist; node; node = node->m_thinglist_next)
{
thing = node->m_thing;
@@ -6603,7 +6631,7 @@ void T_Scroll(scroll_t *s)
if (!is3dblock)
{
- for (node = sec->touching_thinglist; node; node = node->m_snext)
+ for (node = sec->touching_thinglist; node; node = node->m_thinglist_next)
{
thing = node->m_thing;
@@ -6644,7 +6672,7 @@ void T_Scroll(scroll_t *s)
sector_t *psec;
psec = sectors + sect;
- for (node = psec->touching_thinglist; node; node = node->m_snext)
+ for (node = psec->touching_thinglist; node; node = node->m_thinglist_next)
{
thing = node->m_thing;
@@ -6666,7 +6694,7 @@ void T_Scroll(scroll_t *s)
if (!is3dblock)
{
- for (node = sec->touching_thinglist; node; node = node->m_snext)
+ for (node = sec->touching_thinglist; node; node = node->m_thinglist_next)
{
thing = node->m_thing;
@@ -6905,6 +6933,11 @@ void T_Disappear(disappear_t *d)
if (!(lines[d->sourceline].flags & ML_NOCLIMB))
{
+#ifdef ESLOPE
+ if (*rover->t_slope)
+ sectors[s].soundorg.z = P_GetZAt(*rover->t_slope, sectors[s].soundorg.x, sectors[s].soundorg.y);
+ else
+#endif
sectors[s].soundorg.z = *rover->topheight;
S_StartSound(§ors[s].soundorg, sfx_appear);
}
@@ -7011,7 +7044,7 @@ void T_Friction(friction_t *f)
{
if (thing->floorz != P_GetSpecialTopZ(thing, referrer, sec))
{
- node = node->m_snext;
+ node = node->m_thinglist_next;
continue;
}
@@ -7029,7 +7062,7 @@ void T_Friction(friction_t *f)
thing->movefactor = f->movefactor;
}
}
- node = node->m_snext;
+ node = node->m_thinglist_next;
}
}
@@ -7369,7 +7402,7 @@ void T_Pusher(pusher_t *p)
// constant pushers p_wind and p_current
node = sec->touching_thinglist; // things touching this sector
- for (; node; node = node->m_snext)
+ for (; node; node = node->m_thinglist_next)
{
thing = node->m_thing;
if (thing->flags & (MF_NOGRAVITY | MF_NOCLIP)
diff --git a/src/p_user.c b/src/p_user.c
index 02e3308d0..d99d86dea 100644
--- a/src/p_user.c
+++ b/src/p_user.c
@@ -1685,7 +1685,7 @@ static void P_CheckBustableBlocks(player_t *player)
player->mo->y += player->mo->momy;
P_SetThingPosition(player->mo);
- for (node = player->mo->touching_sectorlist; node; node = node->m_snext)
+ for (node = player->mo->touching_sectorlist; node; node = node->m_sectorlist_next)
{
if (!node->m_sector)
break;
@@ -1802,7 +1802,7 @@ static void P_CheckBouncySectors(player_t *player)
player->mo->z += player->mo->momz;
P_SetThingPosition(player->mo);
- for (node = player->mo->touching_sectorlist; node; node = node->m_snext)
+ for (node = player->mo->touching_sectorlist; node; node = node->m_sectorlist_next)
{
if (!node->m_sector)
break;
@@ -1852,12 +1852,8 @@ static void P_CheckBouncySectors(player_t *player)
momentum.y = player->mo->momy;
momentum.z = player->mo->momz*2;
- if (slope) {
- // Reverse quantizing might could use its own function later
- slope->zangle = ANGLE_MAX-slope->zangle;
- P_QuantizeMomentumToSlope(&momentum, slope);
- slope->zangle = ANGLE_MAX-slope->zangle;
- }
+ if (slope)
+ P_ReverseQuantizeMomentumToSlope(&momentum, slope);
newmom = momentum.z = -FixedMul(momentum.z,linedist)/2;
#else
@@ -2279,9 +2275,9 @@ static void P_DoClimbing(player_t *player)
platx = P_ReturnThrustX(player->mo, player->mo->angle, player->mo->radius + FixedMul(8*FRACUNIT, player->mo->scale));
platy = P_ReturnThrustY(player->mo, player->mo->angle, player->mo->radius + FixedMul(8*FRACUNIT, player->mo->scale));
- glidesector = R_PointInSubsector(player->mo->x + platx, player->mo->y + platy);
+ glidesector = R_IsPointInSubsector(player->mo->x + platx, player->mo->y + platy);
- if (glidesector->sector != player->mo->subsector->sector)
+ if (!glidesector || glidesector->sector != player->mo->subsector->sector)
{
boolean floorclimb;
boolean thrust;
@@ -2293,299 +2289,304 @@ static void P_DoClimbing(player_t *player)
boostup = false;
skyclimber = false;
-#ifdef ESLOPE
- floorheight = glidesector->sector->f_slope ? P_GetZAt(glidesector->sector->f_slope, player->mo->x, player->mo->y)
- : glidesector->sector->floorheight;
- ceilingheight = glidesector->sector->c_slope ? P_GetZAt(glidesector->sector->c_slope, player->mo->x, player->mo->y)
- : glidesector->sector->ceilingheight;
-#else
- floorheight = glidesector->sector->floorheight;
- ceilingheight = glidesector->sector->ceilingheight;
-#endif
-
- if (glidesector->sector->ffloors)
+ if (glidesector)
{
- ffloor_t *rover;
- fixed_t topheight, bottomheight; // ESLOPE
+#ifdef ESLOPE
+ floorheight = glidesector->sector->f_slope ? P_GetZAt(glidesector->sector->f_slope, player->mo->x, player->mo->y)
+ : glidesector->sector->floorheight;
+ ceilingheight = glidesector->sector->c_slope ? P_GetZAt(glidesector->sector->c_slope, player->mo->x, player->mo->y)
+ : glidesector->sector->ceilingheight;
+#else
+ floorheight = glidesector->sector->floorheight;
+ ceilingheight = glidesector->sector->ceilingheight;
+#endif
- for (rover = glidesector->sector->ffloors; rover; rover = rover->next)
+ if (glidesector->sector->ffloors)
{
- if (!(rover->flags & FF_EXISTS) || !(rover->flags & FF_BLOCKPLAYER) || (rover->flags & FF_BUSTUP))
- continue;
+ ffloor_t *rover;
+ fixed_t topheight, bottomheight; // ESLOPE
- floorclimb = true;
+ for (rover = glidesector->sector->ffloors; rover; rover = rover->next)
+ {
+ if (!(rover->flags & FF_EXISTS) || !(rover->flags & FF_BLOCKPLAYER) || (rover->flags & FF_BUSTUP))
+ continue;
+
+ floorclimb = true;
#ifdef ESLOPE
- bottomheight = *rover->b_slope ? P_GetZAt(*rover->b_slope, player->mo->x, player->mo->y) : *rover->bottomheight;
- topheight = *rover->t_slope ? P_GetZAt(*rover->t_slope, player->mo->x, player->mo->y) : *rover->topheight;
+ bottomheight = *rover->b_slope ? P_GetZAt(*rover->b_slope, player->mo->x, player->mo->y) : *rover->bottomheight;
+ topheight = *rover->t_slope ? P_GetZAt(*rover->t_slope, player->mo->x, player->mo->y) : *rover->topheight;
#else
- bottomheight = *rover->bottomheight;
- topheight = *rover->topheight;
+ bottomheight = *rover->bottomheight;
+ topheight = *rover->topheight;
#endif
- // Only supports rovers that are moving like an 'elevator', not just the top or bottom.
- if (rover->master->frontsector->floorspeed && rover->master->frontsector->ceilspeed == 42)
- {
- if ((!(player->mo->eflags & MFE_VERTICALFLIP) && (bottomheight < player->mo->z+player->mo->height)
- && (topheight >= player->mo->z + FixedMul(16*FRACUNIT, player->mo->scale)))
- || ((player->mo->eflags & MFE_VERTICALFLIP) && (topheight > player->mo->z)
- && (bottomheight <= player->mo->z + player->mo->height - FixedMul(16*FRACUNIT, player->mo->scale))))
+ // Only supports rovers that are moving like an 'elevator', not just the top or bottom.
+ if (rover->master->frontsector->floorspeed && rover->master->frontsector->ceilspeed == 42)
{
- if (cmd->forwardmove != 0)
- player->mo->momz += rover->master->frontsector->floorspeed;
- else
+ if ((!(player->mo->eflags & MFE_VERTICALFLIP) && (bottomheight < player->mo->z+player->mo->height)
+ && (topheight >= player->mo->z + FixedMul(16*FRACUNIT, player->mo->scale)))
+ || ((player->mo->eflags & MFE_VERTICALFLIP) && (topheight > player->mo->z)
+ && (bottomheight <= player->mo->z + player->mo->height - FixedMul(16*FRACUNIT, player->mo->scale))))
{
- player->mo->momz = rover->master->frontsector->floorspeed;
- climb = false;
+ if (cmd->forwardmove != 0)
+ player->mo->momz += rover->master->frontsector->floorspeed;
+ else
+ {
+ player->mo->momz = rover->master->frontsector->floorspeed;
+ climb = false;
+ }
}
}
- }
- // Gravity is flipped, so the comments are, too.
- if (player->mo->eflags & MFE_VERTICALFLIP)
- {
- // Trying to climb down past the bottom of the FOF
- if ((topheight >= player->mo->z + player->mo->height) && ((player->mo->z + player->mo->height + player->mo->momz) >= topheight))
+ // Gravity is flipped, so the comments are, too.
+ if (player->mo->eflags & MFE_VERTICALFLIP)
{
- fixed_t bottomheight2;
- ffloor_t *roverbelow;
- boolean foundfof = false;
- floorclimb = true;
- boostup = false;
-
- // Is there a FOF directly below this one that we can move onto?
- for (roverbelow = glidesector->sector->ffloors; roverbelow; roverbelow = roverbelow->next)
+ // Trying to climb down past the bottom of the FOF
+ if ((topheight >= player->mo->z + player->mo->height) && ((player->mo->z + player->mo->height + player->mo->momz) >= topheight))
{
- if (!(roverbelow->flags & FF_EXISTS) || !(roverbelow->flags & FF_BLOCKPLAYER) || (roverbelow->flags & FF_BUSTUP))
- continue;
+ fixed_t bottomheight2;
+ ffloor_t *roverbelow;
+ boolean foundfof = false;
+ floorclimb = true;
+ boostup = false;
- if (roverbelow == rover)
- continue;
+ // Is there a FOF directly below this one that we can move onto?
+ for (roverbelow = glidesector->sector->ffloors; roverbelow; roverbelow = roverbelow->next)
+ {
+ if (!(roverbelow->flags & FF_EXISTS) || !(roverbelow->flags & FF_BLOCKPLAYER) || (roverbelow->flags & FF_BUSTUP))
+ continue;
+
+ if (roverbelow == rover)
+ continue;
#ifdef ESLOPE
- bottomheight2 = *roverbelow->b_slope ? P_GetZAt(*roverbelow->b_slope, player->mo->x, player->mo->y) : *roverbelow->bottomheight;
+ bottomheight2 = *roverbelow->b_slope ? P_GetZAt(*roverbelow->b_slope, player->mo->x, player->mo->y) : *roverbelow->bottomheight;
#else
- bottomheight2 = *roverbelow->bottomheight;
+ bottomheight2 = *roverbelow->bottomheight;
#endif
- if (bottomheight2 < topheight + FixedMul(16*FRACUNIT, player->mo->scale))
- foundfof = true;
+ if (bottomheight2 < topheight + FixedMul(16*FRACUNIT, player->mo->scale))
+ foundfof = true;
+ }
+
+ if (!foundfof)
+ player->mo->momz = 0;
}
- if (!foundfof)
- player->mo->momz = 0;
- }
-
- // Below the FOF
- if (topheight <= player->mo->z)
- {
- floorclimb = false;
- boostup = false;
- thrust = false;
- }
-
- // Above the FOF
- if (bottomheight > player->mo->z + player->mo->height - FixedMul(16*FRACUNIT, player->mo->scale))
- {
- floorclimb = false;
- thrust = true;
- boostup = true;
- }
- }
- else
- {
- // Trying to climb down past the bottom of a FOF
- if ((bottomheight <= player->mo->z) && ((player->mo->z + player->mo->momz) <= bottomheight))
- {
- fixed_t topheight2;
- ffloor_t *roverbelow;
- boolean foundfof = false;
- floorclimb = true;
- boostup = false;
-
- // Is there a FOF directly below this one that we can move onto?
- for (roverbelow = glidesector->sector->ffloors; roverbelow; roverbelow = roverbelow->next)
+ // Below the FOF
+ if (topheight <= player->mo->z)
{
- if (!(roverbelow->flags & FF_EXISTS) || !(roverbelow->flags & FF_BLOCKPLAYER) || (roverbelow->flags & FF_BUSTUP))
- continue;
+ floorclimb = false;
+ boostup = false;
+ thrust = false;
+ }
- if (roverbelow == rover)
- continue;
+ // Above the FOF
+ if (bottomheight > player->mo->z + player->mo->height - FixedMul(16*FRACUNIT, player->mo->scale))
+ {
+ floorclimb = false;
+ thrust = true;
+ boostup = true;
+ }
+ }
+ else
+ {
+ // Trying to climb down past the bottom of a FOF
+ if ((bottomheight <= player->mo->z) && ((player->mo->z + player->mo->momz) <= bottomheight))
+ {
+ fixed_t topheight2;
+ ffloor_t *roverbelow;
+ boolean foundfof = false;
+ floorclimb = true;
+ boostup = false;
+
+ // Is there a FOF directly below this one that we can move onto?
+ for (roverbelow = glidesector->sector->ffloors; roverbelow; roverbelow = roverbelow->next)
+ {
+ if (!(roverbelow->flags & FF_EXISTS) || !(roverbelow->flags & FF_BLOCKPLAYER) || (roverbelow->flags & FF_BUSTUP))
+ continue;
+
+ if (roverbelow == rover)
+ continue;
#ifdef ESLOPE
- topheight2 = *roverbelow->t_slope ? P_GetZAt(*roverbelow->t_slope, player->mo->x, player->mo->y) : *roverbelow->topheight;
+ topheight2 = *roverbelow->t_slope ? P_GetZAt(*roverbelow->t_slope, player->mo->x, player->mo->y) : *roverbelow->topheight;
#else
- topheight2 = *roverbelow->topheight;
+ topheight2 = *roverbelow->topheight;
#endif
- if (topheight2 > bottomheight - FixedMul(16*FRACUNIT, player->mo->scale))
- foundfof = true;
+ if (topheight2 > bottomheight - FixedMul(16*FRACUNIT, player->mo->scale))
+ foundfof = true;
+ }
+
+ if (!foundfof)
+ player->mo->momz = 0;
}
- if (!foundfof)
- player->mo->momz = 0;
+ // Below the FOF
+ if (bottomheight >= player->mo->z + player->mo->height)
+ {
+ floorclimb = false;
+ boostup = false;
+ thrust = false;
+ }
+
+ // Above the FOF
+ if (topheight < player->mo->z + FixedMul(16*FRACUNIT, player->mo->scale))
+ {
+ floorclimb = false;
+ thrust = true;
+ boostup = true;
+ }
}
- // Below the FOF
- if (bottomheight >= player->mo->z + player->mo->height)
+ if (floorclimb)
{
- floorclimb = false;
- boostup = false;
- thrust = false;
+ if (rover->flags & FF_CRUMBLE && !(netgame && player->spectator))
+ EV_StartCrumble(rover->master->frontsector, rover, (rover->flags & FF_FLOATBOB), player, rover->alpha, !(rover->flags & FF_NORETURN));
+ break;
}
-
- // Above the FOF
- if (topheight < player->mo->z + FixedMul(16*FRACUNIT, player->mo->scale))
- {
- floorclimb = false;
- thrust = true;
- boostup = true;
- }
- }
-
- if (floorclimb)
- {
- if (rover->flags & FF_CRUMBLE && !(netgame && player->spectator))
- EV_StartCrumble(rover->master->frontsector, rover, (rover->flags & FF_FLOATBOB), player, rover->alpha, !(rover->flags & FF_NORETURN));
- break;
}
}
- }
- // Gravity is flipped, so are comments.
- if (player->mo->eflags & MFE_VERTICALFLIP)
- {
- // Trying to climb down past the upper texture area
- if ((floorheight >= player->mo->z + player->mo->height) && ((player->mo->z + player->mo->height + player->mo->momz) >= floorheight))
+ // Gravity is flipped, so are comments.
+ if (player->mo->eflags & MFE_VERTICALFLIP)
{
- boolean foundfof = false;
- floorclimb = true;
-
- // Is there a FOF directly below that we can move onto?
- if (glidesector->sector->ffloors)
+ // Trying to climb down past the upper texture area
+ if ((floorheight >= player->mo->z + player->mo->height) && ((player->mo->z + player->mo->height + player->mo->momz) >= floorheight))
{
- fixed_t bottomheight;
- ffloor_t *rover;
- for (rover = glidesector->sector->ffloors; rover; rover = rover->next)
+ boolean foundfof = false;
+ floorclimb = true;
+
+ // Is there a FOF directly below that we can move onto?
+ if (glidesector->sector->ffloors)
{
- if (!(rover->flags & FF_EXISTS) || !(rover->flags & FF_BLOCKPLAYER) || (rover->flags & FF_BUSTUP))
- continue;
+ fixed_t bottomheight;
+ ffloor_t *rover;
+ for (rover = glidesector->sector->ffloors; rover; rover = rover->next)
+ {
+ if (!(rover->flags & FF_EXISTS) || !(rover->flags & FF_BLOCKPLAYER) || (rover->flags & FF_BUSTUP))
+ continue;
#ifdef ESLOPE
- bottomheight = *rover->b_slope ? P_GetZAt(*rover->b_slope, player->mo->x, player->mo->y) : *rover->bottomheight;
+ bottomheight = *rover->b_slope ? P_GetZAt(*rover->b_slope, player->mo->x, player->mo->y) : *rover->bottomheight;
#else
- bottomheight = *rover->bottomheight;
+ bottomheight = *rover->bottomheight;
#endif
- if (bottomheight < floorheight + FixedMul(16*FRACUNIT, player->mo->scale))
- {
- foundfof = true;
- break;
+ if (bottomheight < floorheight + FixedMul(16*FRACUNIT, player->mo->scale))
+ {
+ foundfof = true;
+ break;
+ }
}
}
+
+ if (!foundfof)
+ player->mo->momz = 0;
}
- if (!foundfof)
- player->mo->momz = 0;
+ // Reached the top of the lower texture area
+ if (!floorclimb && ceilingheight > player->mo->z + player->mo->height - FixedMul(16*FRACUNIT, player->mo->scale)
+ && (glidesector->sector->ceilingpic == skyflatnum || floorheight < (player->mo->z - FixedMul(8*FRACUNIT, player->mo->scale))))
+ {
+ thrust = true;
+ boostup = true;
+ // Play climb-up animation here
+ }
+ }
+ else
+ {
+ // Trying to climb down past the upper texture area
+ if ((ceilingheight <= player->mo->z) && ((player->mo->z + player->mo->momz) <= ceilingheight))
+ {
+ boolean foundfof = false;
+ floorclimb = true;
+
+ // Is there a FOF directly below that we can move onto?
+ if (glidesector->sector->ffloors)
+ {
+ ffloor_t *rover;
+ for (rover = glidesector->sector->ffloors; rover; rover = rover->next)
+ {
+ if (!(rover->flags & FF_EXISTS) || !(rover->flags & FF_BLOCKPLAYER) || (rover->flags & FF_BUSTUP))
+ continue;
+
+ if (*rover->topheight > ceilingheight - FixedMul(16*FRACUNIT, player->mo->scale))
+ {
+ foundfof = true;
+ break;
+ }
+ }
+ }
+
+ if (!foundfof)
+ player->mo->momz = 0;
+ }
+
+ // Allow climbing from a FOF or lower texture onto the upper texture and vice versa.
+ if (player->mo->z > ceilingheight - FixedMul(16*FRACUNIT, player->mo->scale))
+ {
+ floorclimb = true;
+ thrust = false;
+ boostup = false;
+ }
+
+ // Reached the top of the lower texture area
+ if (!floorclimb && floorheight < player->mo->z + FixedMul(16*FRACUNIT, player->mo->scale)
+ && (glidesector->sector->ceilingpic == skyflatnum || ceilingheight > (player->mo->z + player->mo->height + FixedMul(8*FRACUNIT, player->mo->scale))))
+ {
+ thrust = true;
+ boostup = true;
+ // Play climb-up animation here
+ }
}
- // Reached the top of the lower texture area
- if (!floorclimb && ceilingheight > player->mo->z + player->mo->height - FixedMul(16*FRACUNIT, player->mo->scale)
- && (glidesector->sector->ceilingpic == skyflatnum || floorheight < (player->mo->z - FixedMul(8*FRACUNIT, player->mo->scale))))
+ // Trying to climb on the sky
+ if ((ceilingheight < player->mo->z) && glidesector->sector->ceilingpic == skyflatnum)
{
- thrust = true;
- boostup = true;
- // Play climb-up animation here
+ skyclimber = true;
+ }
+
+ // Climbing on the lower texture area?
+ if ((!(player->mo->eflags & MFE_VERTICALFLIP) && player->mo->z + FixedMul(16*FRACUNIT, player->mo->scale) < floorheight)
+ || ((player->mo->eflags & MFE_VERTICALFLIP) && player->mo->z + player->mo->height <= floorheight))
+ {
+ floorclimb = true;
+
+ if (glidesector->sector->floorspeed)
+ {
+ if (cmd->forwardmove != 0)
+ player->mo->momz += glidesector->sector->floorspeed;
+ else
+ {
+ player->mo->momz = glidesector->sector->floorspeed;
+ climb = false;
+ }
+ }
+ }
+ // Climbing on the upper texture area?
+ else if ((!(player->mo->eflags & MFE_VERTICALFLIP) && player->mo->z >= ceilingheight)
+ || ((player->mo->eflags & MFE_VERTICALFLIP) && player->mo->z + player->mo->height - FixedMul(16*FRACUNIT, player->mo->scale) > ceilingheight))
+ {
+ floorclimb = true;
+
+ if (glidesector->sector->ceilspeed)
+ {
+ if (cmd->forwardmove != 0)
+ player->mo->momz += glidesector->sector->ceilspeed;
+ else
+ {
+ player->mo->momz = glidesector->sector->ceilspeed;
+ climb = false;
+ }
+ }
}
}
else
- {
- // Trying to climb down past the upper texture area
- if ((ceilingheight <= player->mo->z) && ((player->mo->z + player->mo->momz) <= ceilingheight))
- {
- boolean foundfof = false;
- floorclimb = true;
-
- // Is there a FOF directly below that we can move onto?
- if (glidesector->sector->ffloors)
- {
- ffloor_t *rover;
- for (rover = glidesector->sector->ffloors; rover; rover = rover->next)
- {
- if (!(rover->flags & FF_EXISTS) || !(rover->flags & FF_BLOCKPLAYER) || (rover->flags & FF_BUSTUP))
- continue;
-
- if (*rover->topheight > ceilingheight - FixedMul(16*FRACUNIT, player->mo->scale))
- {
- foundfof = true;
- break;
- }
- }
- }
-
- if (!foundfof)
- player->mo->momz = 0;
- }
-
- // Allow climbing from a FOF or lower texture onto the upper texture and vice versa.
- if (player->mo->z > ceilingheight - FixedMul(16*FRACUNIT, player->mo->scale))
- {
- floorclimb = true;
- thrust = false;
- boostup = false;
- }
-
- // Reached the top of the lower texture area
- if (!floorclimb && floorheight < player->mo->z + FixedMul(16*FRACUNIT, player->mo->scale)
- && (glidesector->sector->ceilingpic == skyflatnum || ceilingheight > (player->mo->z + player->mo->height + FixedMul(8*FRACUNIT, player->mo->scale))))
- {
- thrust = true;
- boostup = true;
- // Play climb-up animation here
- }
- }
-
- // Trying to climb on the sky
- if ((ceilingheight < player->mo->z) && glidesector->sector->ceilingpic == skyflatnum)
- {
- skyclimber = true;
- }
-
- // Climbing on the lower texture area?
- if ((!(player->mo->eflags & MFE_VERTICALFLIP) && player->mo->z + FixedMul(16*FRACUNIT, player->mo->scale) < floorheight)
- || ((player->mo->eflags & MFE_VERTICALFLIP) && player->mo->z + player->mo->height <= floorheight))
- {
floorclimb = true;
- if (glidesector->sector->floorspeed)
- {
- if (cmd->forwardmove != 0)
- player->mo->momz += glidesector->sector->floorspeed;
- else
- {
- player->mo->momz = glidesector->sector->floorspeed;
- climb = false;
- }
- }
- }
- // Climbing on the upper texture area?
- else if ((!(player->mo->eflags & MFE_VERTICALFLIP) && player->mo->z >= ceilingheight)
- || ((player->mo->eflags & MFE_VERTICALFLIP) && player->mo->z + player->mo->height - FixedMul(16*FRACUNIT, player->mo->scale) > ceilingheight))
- {
- floorclimb = true;
-
- if (glidesector->sector->ceilspeed)
- {
- if (cmd->forwardmove != 0)
- player->mo->momz += glidesector->sector->ceilspeed;
- else
- {
- player->mo->momz = glidesector->sector->ceilspeed;
- climb = false;
- }
- }
- }
-
if (player->lastsidehit != -1 && player->lastlinehit != -1)
{
thinker_t *think;
@@ -2844,94 +2845,20 @@ static boolean PIT_CheckSolidsTeeter(mobj_t *thing)
//
static void P_DoTeeter(player_t *player)
{
- msecnode_t *node;
boolean teeter = false;
boolean roverfloor; // solid 3d floors?
- boolean checkedforteeter = false;
+ fixed_t floorheight, ceilingheight;
+ fixed_t topheight, bottomheight; // for 3d floor usage
const fixed_t tiptop = FixedMul(MAXSTEPMOVE, player->mo->scale); // Distance you have to be above the ground in order to teeter.
- for (node = player->mo->touching_sectorlist; node; node = node->m_snext)
+ if (player->mo->standingslope && player->mo->standingslope->zdelta >= (FRACUNIT/2)) // Always teeter if the slope is too steep.
+ teeter = true;
+ else // Let's do some checks...
{
- // Ledge teetering. Check if any nearby sectors are low enough from your current one.
- checkedforteeter = true;
- roverfloor = false;
- if (node->m_sector->ffloors)
- {
- ffloor_t *rover;
- for (rover = node->m_sector->ffloors; rover; rover = rover->next)
- {
- if (!(rover->flags & FF_EXISTS)) continue;
-
- if (P_CheckSolidLava(player->mo, rover))
- ;
- else if (!(rover->flags & FF_BLOCKPLAYER || rover->flags & FF_QUICKSAND))
- continue; // intangible 3d floor
-
- if (player->mo->eflags & MFE_VERTICALFLIP)
- {
- if (*rover->bottomheight > node->m_sector->ceilingheight) // Above the ceiling
- continue;
-
- if (*rover->bottomheight > player->mo->z + player->mo->height + tiptop
- || (*rover->topheight < player->mo->z
- && player->mo->z + player->mo->height < node->m_sector->ceilingheight - tiptop))
- {
- teeter = true;
- roverfloor = true;
- }
- else
- {
- teeter = false;
- roverfloor = true;
- break;
- }
- }
- else
- {
- if (*rover->topheight < node->m_sector->floorheight) // Below the floor
- continue;
-
- if (*rover->topheight < player->mo->z - tiptop
- || (*rover->bottomheight > player->mo->z + player->mo->height
- && player->mo->z > node->m_sector->floorheight + tiptop))
- {
- teeter = true;
- roverfloor = true;
- }
- else
- {
- teeter = false;
- roverfloor = true;
- break;
- }
- }
- }
- }
-
- if (!teeter && !roverfloor)
- {
- if (player->mo->eflags & MFE_VERTICALFLIP)
- {
- if (node->m_sector->ceilingheight > player->mo->z + player->mo->height + tiptop)
- teeter = true;
- }
- else
- {
- if (node->m_sector->floorheight < player->mo->z - tiptop)
- teeter = true;
- }
- }
- }
-
- if (checkedforteeter && !teeter) // Backup code
- {
- subsector_t *subsec[4]; // changed abcd into array instead
UINT8 i;
-
- subsec[0] = R_PointInSubsector(player->mo->x + FixedMul(5*FRACUNIT, player->mo->scale), player->mo->y + FixedMul(5*FRACUNIT, player->mo->scale));
- subsec[1] = R_PointInSubsector(player->mo->x - FixedMul(5*FRACUNIT, player->mo->scale), player->mo->y + FixedMul(5*FRACUNIT, player->mo->scale));
- subsec[2] = R_PointInSubsector(player->mo->x + FixedMul(5*FRACUNIT, player->mo->scale), player->mo->y - FixedMul(5*FRACUNIT, player->mo->scale));
- subsec[3] = R_PointInSubsector(player->mo->x - FixedMul(5*FRACUNIT, player->mo->scale), player->mo->y - FixedMul(5*FRACUNIT, player->mo->scale));
+ sector_t *sec;
+ fixed_t highestceilingheight = INT32_MIN;
+ fixed_t lowestfloorheight = INT32_MAX;
teeter = false;
roverfloor = false;
@@ -2939,13 +2866,43 @@ static void P_DoTeeter(player_t *player)
{
ffloor_t *rover;
- if (!(subsec[i]->sector->ffloors))
+#define xsign ((i & 1) ? -1 : 1) // 0 -> 1 | 1 -> -1 | 2 -> 1 | 3 -> -1
+#define ysign ((i & 2) ? 1 : -1) // 0 -> 1 | 1 -> 1 | 2 -> -1 | 3 -> -1
+ fixed_t checkx = player->mo->x + (xsign*FixedMul(5*FRACUNIT, player->mo->scale));
+ fixed_t checky = player->mo->y + (ysign*FixedMul(5*FRACUNIT, player->mo->scale));
+#undef xsign
+#undef ysign
+
+ sec = R_PointInSubsector(checkx, checky)->sector;
+
+ ceilingheight = sec->ceilingheight;
+ floorheight = sec->floorheight;
+#ifdef ESLOPE
+ if (sec->c_slope)
+ ceilingheight = P_GetZAt(sec->c_slope, checkx, checky);
+ if (sec->f_slope)
+ floorheight = P_GetZAt(sec->f_slope, checkx, checky);
+#endif
+ highestceilingheight = (ceilingheight > highestceilingheight) ? ceilingheight : highestceilingheight;
+ lowestfloorheight = (floorheight < lowestfloorheight) ? floorheight : lowestfloorheight;
+
+ if (!(sec->ffloors))
continue; // move on to the next subsector
- for (rover = subsec[i]->sector->ffloors; rover; rover = rover->next)
+ for (rover = sec->ffloors; rover; rover = rover->next)
{
if (!(rover->flags & FF_EXISTS)) continue;
+ topheight = *rover->topheight;
+ bottomheight = *rover->bottomheight;
+
+#ifdef ESLOPE
+ if (*rover->t_slope)
+ topheight = P_GetZAt(*rover->t_slope, player->mo->x, player->mo->y);
+ if (*rover->b_slope)
+ bottomheight = P_GetZAt(*rover->b_slope, player->mo->x, player->mo->y);
+#endif
+
if (P_CheckSolidLava(player->mo, rover))
;
else if (!(rover->flags & FF_BLOCKPLAYER || rover->flags & FF_QUICKSAND))
@@ -2953,12 +2910,12 @@ static void P_DoTeeter(player_t *player)
if (player->mo->eflags & MFE_VERTICALFLIP)
{
- if (*rover->bottomheight > subsec[i]->sector->ceilingheight) // Above the ceiling
+ if (bottomheight > ceilingheight) // Above the ceiling
continue;
- if (*rover->bottomheight > player->mo->z + player->mo->height + tiptop
- || (*rover->topheight < player->mo->z
- && player->mo->z + player->mo->height < subsec[i]->sector->ceilingheight - tiptop))
+ if (bottomheight > player->mo->z + player->mo->height + tiptop
+ || (topheight < player->mo->z
+ && player->mo->z + player->mo->height < ceilingheight - tiptop))
{
teeter = true;
roverfloor = true;
@@ -2972,12 +2929,12 @@ static void P_DoTeeter(player_t *player)
}
else
{
- if (*rover->topheight < subsec[i]->sector->floorheight) // Below the floor
+ if (topheight < floorheight) // Below the floor
continue;
- if (*rover->topheight < player->mo->z - tiptop
- || (*rover->bottomheight > player->mo->z + player->mo->height
- && player->mo->z > subsec[i]->sector->floorheight + tiptop))
+ if (topheight < player->mo->z - tiptop
+ || (bottomheight > player->mo->z + player->mo->height
+ && player->mo->z > floorheight + tiptop))
{
teeter = true;
roverfloor = true;
@@ -2995,18 +2952,12 @@ static void P_DoTeeter(player_t *player)
if (player->mo->eflags & MFE_VERTICALFLIP)
{
- if (!teeter && !roverfloor && (subsec[0]->sector->ceilingheight > player->mo->ceilingz + tiptop
- || subsec[1]->sector->ceilingheight > player->mo->ceilingz + tiptop
- || subsec[2]->sector->ceilingheight > player->mo->ceilingz + tiptop
- || subsec[3]->sector->ceilingheight > player->mo->ceilingz + tiptop))
+ if (!teeter && !roverfloor && (highestceilingheight > player->mo->ceilingz + tiptop))
teeter = true;
}
else
{
- if (!teeter && !roverfloor && (subsec[0]->sector->floorheight < player->mo->floorz - tiptop
- || subsec[1]->sector->floorheight < player->mo->floorz - tiptop
- || subsec[2]->sector->floorheight < player->mo->floorz - tiptop
- || subsec[3]->sector->floorheight < player->mo->floorz - tiptop))
+ if (!teeter && !roverfloor && (lowestfloorheight < player->mo->floorz - tiptop))
teeter = true;
}
}
@@ -3142,7 +3093,7 @@ teeterdone:
if (player->panim == PA_IDLE)
P_SetPlayerMobjState(player->mo, S_PLAY_EDGE);
}
- else if (checkedforteeter && player->panim == PA_EDGE)
+ else if (player->panim == PA_EDGE)
P_SetPlayerMobjState(player->mo, S_PLAY_STND);
}
@@ -3501,6 +3452,9 @@ static void P_DoSuperStuff(player_t *player)
case S_PLAY_SUPER_RUN:
P_SetPlayerMobjState(player->mo, S_PLAY_RUN);
break;
+ case S_PLAY_SUPER_PEEL:
+ P_SetPlayerMobjState(player->mo, S_PLAY_PEEL);
+ break;
case S_PLAY_SUPER_PAIN:
P_SetPlayerMobjState(player->mo, S_PLAY_PAIN);
break;
@@ -3758,7 +3712,7 @@ static void P_DoSpinDash(player_t *player, ticcmd_t *cmd)
{
if ((cmd->buttons & BT_USE) && player->speed < FixedMul(5<mo->scale) && !player->mo->momz && onground && !(player->pflags & PF_USEDOWN) && !(player->pflags & PF_SPINNING)
#ifdef ESLOPE
- && (!player->mo->standingslope || abs(player->mo->standingslope->zdelta) < FRACUNIT/2)
+ && (!player->mo->standingslope || (player->mo->standingslope->flags & SL_NOPHYSICS) || abs(player->mo->standingslope->zdelta) < FRACUNIT/2)
#endif
)
{
@@ -3794,7 +3748,7 @@ static void P_DoSpinDash(player_t *player, ticcmd_t *cmd)
else if ((cmd->buttons & BT_USE || ((twodlevel || (player->mo->flags2 & MF2_TWOD)) && cmd->forwardmove < -20))
&& !player->climbing && !player->mo->momz && onground && (player->speed > FixedMul(5<mo->scale)
#ifdef ESLOPE
- || (player->mo->standingslope && abs(player->mo->standingslope->zdelta) >= FRACUNIT/2)
+ || (player->mo->standingslope && (!(player->mo->standingslope->flags & SL_NOPHYSICS)) && abs(player->mo->standingslope->zdelta) >= FRACUNIT/2)
#endif
) && !(player->pflags & PF_USEDOWN) && !(player->pflags & PF_SPINNING))
{
@@ -3810,7 +3764,7 @@ static void P_DoSpinDash(player_t *player, ticcmd_t *cmd)
if (onground && player->pflags & PF_SPINNING && !(player->pflags & PF_STARTDASH)
&& player->speed < FixedMul(5*FRACUNIT,player->mo->scale)
#ifdef ESLOPE
- && (!player->mo->standingslope || abs(player->mo->standingslope->zdelta) < FRACUNIT/2)
+ && (!player->mo->standingslope || (player->mo->standingslope->flags & SL_NOPHYSICS) || abs(player->mo->standingslope->zdelta) < FRACUNIT/2)
#endif
)
{
@@ -4040,19 +3994,26 @@ static void P_DoJumpStuff(player_t *player, ticcmd_t *cmd)
case CA_THOK:
case CA_HOMINGTHOK:
case CA_JUMPTHOK: // Credit goes to CZ64 and Sryder13 for the original
+ case CA_DASHMODE: // Credit goes to Iceman404
// Now it's Sonic's abilities turn!
// THOK!
if (!(player->pflags & PF_THOKKED) || (player->charability2 == CA2_MULTIABILITY))
{
// Catapult the player
fixed_t actionspd = player->actionspd;
+
+ if (player->charability == CA_DASHMODE)
+ actionspd = max(player->normalspeed, FixedDiv(player->speed, player->mo->scale));
+
if (player->mo->eflags & MFE_UNDERWATER)
actionspd >>= 1;
+
if ((player->charability == CA_JUMPTHOK) && !(player->pflags & PF_THOKKED))
{
player->pflags &= ~PF_JUMPED;
P_DoJump(player, false);
}
+
P_InstaThrust(player->mo, player->mo->angle, FixedMul(actionspd, player->mo->scale));
if (maptol & TOL_2D)
@@ -4799,7 +4760,7 @@ static void P_3dMovement(player_t *player)
#ifdef ESLOPE
if ((totalthrust.x || totalthrust.y)
- && player->mo->standingslope && abs(player->mo->standingslope->zdelta) > FRACUNIT/2) {
+ && player->mo->standingslope && (!(player->mo->standingslope->flags & SL_NOPHYSICS)) && abs(player->mo->standingslope->zdelta) > FRACUNIT/2) {
// Factor thrust to slope, but only for the part pushing up it!
// The rest is unaffected.
angle_t thrustangle = R_PointToAngle2(0, 0, totalthrust.x, totalthrust.y)-player->mo->standingslope->xydirection;
@@ -6500,9 +6461,12 @@ static void P_MovePlayer(player_t *player)
if ((cmd->forwardmove != 0 || cmd->sidemove != 0) || (player->powers[pw_super] && !onground))
{
+ // If the player is in dashmode, here's their peelout.
+ if (player->charability == CA_DASHMODE && player->dashmode >= 3*TICRATE && player->panim == PA_RUN && !player->skidtime && (onground || player->powers[pw_super]))
+ P_SetPlayerMobjState (player->mo, S_PLAY_PEEL);
// If the player is moving fast enough,
// break into a run!
- if (player->speed >= runspd && player->panim == PA_WALK && !player->skidtime && (onground || player->powers[pw_super]))
+ else if (player->speed >= runspd && player->panim == PA_WALK && !player->skidtime && (onground || player->powers[pw_super]))
P_SetPlayerMobjState (player->mo, S_PLAY_RUN);
// Super floating at slow speeds has its own special animation.
@@ -6514,6 +6478,11 @@ static void P_MovePlayer(player_t *player)
P_SetPlayerMobjState (player->mo, S_PLAY_WALK);
}
+ // If your peelout animation is playing, and you're
+ // going too slow, switch back to the run.
+ if (player->panim == PA_PEEL && player->dashmode < 3*TICRATE)
+ P_SetPlayerMobjState(player->mo, S_PLAY_RUN);
+
// If your running animation is playing, and you're
// going too slow, switch back to the walking frames.
if (player->panim == PA_RUN && player->speed < runspd)
@@ -6844,7 +6813,7 @@ static void P_MovePlayer(player_t *player)
#endif
}
// Otherwise, face the direction you're travelling.
- else if (player->panim == PA_WALK || player->panim == PA_RUN || player->panim == PA_ROLL
+ else if (player->panim == PA_WALK || player->panim == PA_RUN || player->panim == PA_PEEL || player->panim == PA_ROLL
|| (player->mo->state-states == S_PLAY_FLY || player->mo->state-states == S_PLAY_FLY_TIRED))
player->mo->angle = R_PointToAngle2(0, 0, player->rmomx, player->rmomy);
@@ -7064,7 +7033,7 @@ static void P_MovePlayer(player_t *player)
player->mo->y += player->mo->momy;
P_SetThingPosition(player->mo);
- for (node = player->mo->touching_sectorlist; node; node = node->m_snext)
+ for (node = player->mo->touching_sectorlist; node; node = node->m_sectorlist_next)
{
if (!node->m_sector)
break;
@@ -9162,6 +9131,49 @@ void P_PlayerThink(player_t *player)
player->pflags &= ~PF_SLIDING;
+#define dashmode player->dashmode
+ // Dash mode ability for Metal Sonic
+ if ((player->charability == CA_DASHMODE) && !(maptol & TOL_NIGHTS)) // woo, dashmode! no nights tho.
+ {
+ if (player->speed >= FixedMul(player->runspeed, player->mo->scale) || (player->pflags & PF_STARTDASH))
+ {
+ dashmode++; // Counter. Adds 1 to dash mode per tic in top speed.
+ if (dashmode == 3*TICRATE) // This isn't in the ">=" equation because it'd cause the sound to play infinitely.
+ S_StartSound(player->mo, sfx_s3ka2); // If the player enters dashmode, play this sound on the the tic it starts.
+ }
+ else if (!(player->pflags & PF_SPINNING))
+ {
+ if (dashmode > 3)
+ dashmode -= 3; // Rather than lose it all, it gently counts back down!
+ else
+ dashmode = 0;
+ }
+
+ if (dashmode < 3*TICRATE) // Exits Dash Mode if you drop below speed/dash counter tics. Not in the above block so it doesn't keep disabling in midair.
+ {
+ player->normalspeed = skins[player->skin].normalspeed; // Reset to default if not capable of entering dash mode.
+ player->jumpfactor = skins[player->skin].jumpfactor;
+ }
+ else if (P_IsObjectOnGround(player->mo)) // Activate dash mode if we're on the ground.
+ {
+ if (player->normalspeed < skins[player->skin].actionspd) // If the player normalspeed is not currently at actionspd in dash mode, add speed each tic
+ player->normalspeed = player->normalspeed + 1*FRACUNIT/5; // Enter Dash Mode smoothly.
+
+ if (player->jumpfactor < FixedMul(skins[player->skin].jumpfactor, 5*FRACUNIT/4)) // Boost jump height.
+ player->jumpfactor = player->jumpfactor + 1*FRACUNIT/300;
+ }
+
+ dashmode = min(dashmode, 3*TICRATE + 3);
+
+ if (player->normalspeed >= skins[player->skin].actionspd)
+ {
+ mobj_t *ghost = P_SpawnGhostMobj(player->mo); // Spawns afterimages
+ ghost->fuse = 2; // Makes the images fade quickly
+ }
+ }
+ else
+ dashmode = 0;
+#undef dashmode
/*
// Colormap verification
{
diff --git a/src/r_data.h b/src/r_data.h
index 4a37f82c3..69a2882af 100644
--- a/src/r_data.h
+++ b/src/r_data.h
@@ -30,7 +30,7 @@ typedef struct
{
// Block origin (always UL), which has already accounted for the internal origin of the patch.
INT16 originx, originy;
- INT16 wad, lump;
+ UINT16 wad, lump;
} texpatch_t;
// A maptexturedef_t describes a rectangular texture,
diff --git a/src/r_defs.h b/src/r_defs.h
index 848708164..2c5860ee7 100644
--- a/src/r_defs.h
+++ b/src/r_defs.h
@@ -500,10 +500,10 @@ typedef struct subsector_s
// Sector list node showing all sectors an object appears in.
//
// There are two threads that flow through these nodes. The first thread
-// starts at touching_thinglist in a sector_t and flows through the m_snext
+// starts at touching_thinglist in a sector_t and flows through the m_thinglist_next
// links to find all mobjs that are entirely or partially in the sector.
// The second thread starts at touching_sectorlist in an mobj_t and flows
-// through the m_tnext links to find all sectors a thing touches. This is
+// through the m_sectorlist_next links to find all sectors a thing touches. This is
// useful when applying friction or push effects to sectors. These effects
// can be done as thinkers that act upon all objects touching their sectors.
// As an mobj moves through the world, these nodes are created and
@@ -515,10 +515,10 @@ typedef struct msecnode_s
{
sector_t *m_sector; // a sector containing this object
struct mobj_s *m_thing; // this object
- struct msecnode_s *m_tprev; // prev msecnode_t for this thing
- struct msecnode_s *m_tnext; // next msecnode_t for this thing
- struct msecnode_s *m_sprev; // prev msecnode_t for this sector
- struct msecnode_s *m_snext; // next msecnode_t for this sector
+ struct msecnode_s *m_sectorlist_prev; // prev msecnode_t for this thing
+ struct msecnode_s *m_sectorlist_next; // next msecnode_t for this thing
+ struct msecnode_s *m_thinglist_prev; // prev msecnode_t for this sector
+ struct msecnode_s *m_thinglist_next; // next msecnode_t for this sector
boolean visited; // used in search algorithms
} msecnode_t;
@@ -526,10 +526,10 @@ typedef struct mprecipsecnode_s
{
sector_t *m_sector; // a sector containing this object
struct precipmobj_s *m_thing; // this object
- struct mprecipsecnode_s *m_tprev; // prev msecnode_t for this thing
- struct mprecipsecnode_s *m_tnext; // next msecnode_t for this thing
- struct mprecipsecnode_s *m_sprev; // prev msecnode_t for this sector
- struct mprecipsecnode_s *m_snext; // next msecnode_t for this sector
+ struct mprecipsecnode_s *m_sectorlist_prev; // prev msecnode_t for this thing
+ struct mprecipsecnode_s *m_sectorlist_next; // next msecnode_t for this thing
+ struct mprecipsecnode_s *m_thinglist_prev; // prev msecnode_t for this sector
+ struct mprecipsecnode_s *m_thinglist_next; // next msecnode_t for this sector
boolean visited; // used in search algorithms
} mprecipsecnode_t;
diff --git a/src/r_draw8.c b/src/r_draw8.c
index 7bfe5c79b..6cb600c5e 100644
--- a/src/r_draw8.c
+++ b/src/r_draw8.c
@@ -874,9 +874,9 @@ void R_DrawTiltedSplat_8(void)
colormap = planezlight[tiltlighting[ds_x1++]] + (ds_colormap - colormaps);
- val = colormap[source[((v >> nflatyshift) & nflatmask) | (u >> nflatxshift)]];
+ val = source[((v >> nflatyshift) & nflatmask) | (u >> nflatxshift)];
if (val != TRANSPARENTPIXEL)
- *dest = val;
+ *dest = colormap[val];
dest++;
iz += ds_sz.x;
uz += ds_su.x;
@@ -913,9 +913,9 @@ void R_DrawTiltedSplat_8(void)
for (i = SPANSIZE-1; i >= 0; i--)
{
colormap = planezlight[tiltlighting[ds_x1++]] + (ds_colormap - colormaps);
- val = colormap[source[((v >> nflatyshift) & nflatmask) | (u >> nflatxshift)]];
+ val = source[((v >> nflatyshift) & nflatmask) | (u >> nflatxshift)];
if (val != TRANSPARENTPIXEL)
- *dest = val;
+ *dest = colormap[val];
dest++;
u += stepu;
v += stepv;
@@ -931,9 +931,9 @@ void R_DrawTiltedSplat_8(void)
u = (INT64)(startu);
v = (INT64)(startv);
colormap = planezlight[tiltlighting[ds_x1++]] + (ds_colormap - colormaps);
- val = colormap[source[((v >> nflatyshift) & nflatmask) | (u >> nflatxshift)]];
+ val = source[((v >> nflatyshift) & nflatmask) | (u >> nflatxshift)];
if (val != TRANSPARENTPIXEL)
- *dest = val;
+ *dest = colormap[val];
}
else
{
@@ -954,9 +954,9 @@ void R_DrawTiltedSplat_8(void)
for (; width != 0; width--)
{
colormap = planezlight[tiltlighting[ds_x1++]] + (ds_colormap - colormaps);
- val = colormap[source[((v >> nflatyshift) & nflatmask) | (u >> nflatxshift)]];
+ val = source[((v >> nflatyshift) & nflatmask) | (u >> nflatxshift)];
if (val != TRANSPARENTPIXEL)
- *dest = val;
+ *dest = colormap[val];
dest++;
u += stepu;
v += stepv;
@@ -1124,49 +1124,49 @@ void R_DrawTranslucentSplat_8 (void)
// need!
val = source[((yposition >> nflatyshift) & nflatmask) | (xposition >> nflatxshift)];
if (val != TRANSPARENTPIXEL)
- dest[0] = colormap[*(ds_transmap + (source[((yposition >> nflatyshift) & nflatmask) | (xposition >> nflatxshift)] << 8) + dest[0])];
+ dest[0] = colormap[*(ds_transmap + (val << 8) + dest[0])];
xposition += xstep;
yposition += ystep;
val = source[((yposition >> nflatyshift) & nflatmask) | (xposition >> nflatxshift)];
if (val != TRANSPARENTPIXEL)
- dest[1] = colormap[*(ds_transmap + (source[((yposition >> nflatyshift) & nflatmask) | (xposition >> nflatxshift)] << 8) + dest[1])];
+ dest[1] = colormap[*(ds_transmap + (val << 8) + dest[1])];
xposition += xstep;
yposition += ystep;
val = source[((yposition >> nflatyshift) & nflatmask) | (xposition >> nflatxshift)];
if (val != TRANSPARENTPIXEL)
- dest[2] = colormap[*(ds_transmap + (source[((yposition >> nflatyshift) & nflatmask) | (xposition >> nflatxshift)] << 8) + dest[2])];
+ dest[2] = colormap[*(ds_transmap + (val << 8) + dest[2])];
xposition += xstep;
yposition += ystep;
val = source[((yposition >> nflatyshift) & nflatmask) | (xposition >> nflatxshift)];
if (val != TRANSPARENTPIXEL)
- dest[3] = colormap[*(ds_transmap + (source[((yposition >> nflatyshift) & nflatmask) | (xposition >> nflatxshift)] << 8) + dest[3])];
+ dest[3] = colormap[*(ds_transmap + (val << 8) + dest[3])];
xposition += xstep;
yposition += ystep;
val = source[((yposition >> nflatyshift) & nflatmask) | (xposition >> nflatxshift)];
if (val != TRANSPARENTPIXEL)
- dest[4] = colormap[*(ds_transmap + (source[((yposition >> nflatyshift) & nflatmask) | (xposition >> nflatxshift)] << 8) + dest[4])];
+ dest[4] = colormap[*(ds_transmap + (val << 8) + dest[4])];
xposition += xstep;
yposition += ystep;
val = source[((yposition >> nflatyshift) & nflatmask) | (xposition >> nflatxshift)];
if (val != TRANSPARENTPIXEL)
- dest[5] = colormap[*(ds_transmap + (source[((yposition >> nflatyshift) & nflatmask) | (xposition >> nflatxshift)] << 8) + dest[5])];
+ dest[5] = colormap[*(ds_transmap + (val << 8) + dest[5])];
xposition += xstep;
yposition += ystep;
val = source[((yposition >> nflatyshift) & nflatmask) | (xposition >> nflatxshift)];
if (val != TRANSPARENTPIXEL)
- dest[6] = colormap[*(ds_transmap + (source[((yposition >> nflatyshift) & nflatmask) | (xposition >> nflatxshift)] << 8) + dest[6])];
+ dest[6] = colormap[*(ds_transmap + (val << 8) + dest[6])];
xposition += xstep;
yposition += ystep;
val = source[((yposition >> nflatyshift) & nflatmask) | (xposition >> nflatxshift)];
if (val != TRANSPARENTPIXEL)
- dest[7] = colormap[*(ds_transmap + (source[((yposition >> nflatyshift) & nflatmask) | (xposition >> nflatxshift)] << 8) + dest[7])];
+ dest[7] = colormap[*(ds_transmap + (val << 8) + dest[7])];
xposition += xstep;
yposition += ystep;
@@ -1175,9 +1175,9 @@ void R_DrawTranslucentSplat_8 (void)
}
while (count--)
{
- val =colormap[source[((yposition >> nflatyshift) & nflatmask) | (xposition >> nflatxshift)]];
+ val = source[((yposition >> nflatyshift) & nflatmask) | (xposition >> nflatxshift)];
if (val != TRANSPARENTPIXEL)
- *dest = colormap[*(ds_transmap + (source[((yposition >> nflatyshift) & nflatmask) | (xposition >> nflatxshift)] << 8) + *dest)];
+ *dest = colormap[*(ds_transmap + (val << 8) + *dest)];
dest++;
xposition += xstep;
diff --git a/src/r_main.c b/src/r_main.c
index f625b29b6..38a169c08 100644
--- a/src/r_main.c
+++ b/src/r_main.c
@@ -919,9 +919,9 @@ void R_SkyboxFrame(player_t *player)
}
}
if (mh->skybox_scalez > 0)
- viewz += player->awayviewmobj->z / mh->skybox_scalez;
+ viewz += (player->awayviewmobj->z + 20*FRACUNIT) / mh->skybox_scalez;
else if (mh->skybox_scalez < 0)
- viewz += player->awayviewmobj->z * -mh->skybox_scalez;
+ viewz += (player->awayviewmobj->z + 20*FRACUNIT) * -mh->skybox_scalez;
}
else if (thiscam->chase)
{
@@ -966,9 +966,9 @@ void R_SkyboxFrame(player_t *player)
}
}
if (mh->skybox_scalez > 0)
- viewz += thiscam->z / mh->skybox_scalez;
+ viewz += (thiscam->z + (thiscam->height>>1)) / mh->skybox_scalez;
else if (mh->skybox_scalez < 0)
- viewz += thiscam->z * -mh->skybox_scalez;
+ viewz += (thiscam->z + (thiscam->height>>1)) * -mh->skybox_scalez;
}
else
{
@@ -1324,6 +1324,7 @@ void R_RenderPlayerView(player_t *player)
#endif
R_RenderBSPNode((INT32)numnodes - 1);
+ R_ClipSprites();
R_DrawPlanes();
#ifdef FLOORSPLATS
R_DrawVisibleFloorSplats();
diff --git a/src/r_plane.h b/src/r_plane.h
index 8730bcefd..ec1940716 100644
--- a/src/r_plane.h
+++ b/src/r_plane.h
@@ -87,7 +87,7 @@ extern lighttable_t **planezlight;
extern fixed_t *yslope;
extern fixed_t distscale[MAXVIDWIDTH];
-void R_InitPlanes(void);
+FUNCMATH void R_InitPlanes(void);
void R_PortalStoreClipValues(INT32 start, INT32 end, INT16 *ceil, INT16 *floor, fixed_t *scale);
void R_PortalRestoreClipValues(INT32 start, INT32 end, INT16 *ceil, INT16 *floor, fixed_t *scale);
void R_ClearPlanes(void);
diff --git a/src/r_segs.c b/src/r_segs.c
index 11b4c8aef..cb78743b6 100644
--- a/src/r_segs.c
+++ b/src/r_segs.c
@@ -1453,34 +1453,45 @@ static void R_RenderSegLoop (void)
frontscale[rw_x] = rw_scale;
// draw the wall tiers
- if (midtexture && yl <= yh && yh < vid.height && yh > 0)
+ if (midtexture)
{
// single sided line
- dc_yl = yl;
- dc_yh = yh;
- dc_texturemid = rw_midtexturemid;
- dc_source = R_GetColumn(midtexture,texturecolumn);
- dc_texheight = textureheight[midtexture]>>FRACBITS;
+ if (yl <= yh && yh >= 0 && yl < viewheight)
+ {
+ dc_yl = yl;
+ dc_yh = yh;
+ dc_texturemid = rw_midtexturemid;
+ dc_source = R_GetColumn(midtexture,texturecolumn);
+ dc_texheight = textureheight[midtexture]>>FRACBITS;
- //profile stuff ---------------------------------------------------------
+ //profile stuff ---------------------------------------------------------
#ifdef TIMING
- ProfZeroTimer();
+ ProfZeroTimer();
#endif
- colfunc();
+ colfunc();
#ifdef TIMING
- RDMSR(0x10,&mycount);
- mytotal += mycount; //64bit add
+ RDMSR(0x10,&mycount);
+ mytotal += mycount; //64bit add
- if (nombre--==0)
- I_Error("R_DrawColumn CPU Spy reports: 0x%d %d\n", *((INT32 *)&mytotal+1),
- (INT32)mytotal);
+ if (nombre--==0)
+ I_Error("R_DrawColumn CPU Spy reports: 0x%d %d\n", *((INT32 *)&mytotal+1),
+ (INT32)mytotal);
#endif
- //profile stuff ---------------------------------------------------------
+ //profile stuff ---------------------------------------------------------
- // dont draw anything more for this column, since
- // a midtexture blocks the view
- ceilingclip[rw_x] = (INT16)viewheight;
- floorclip[rw_x] = -1;
+ // dont draw anything more for this column, since
+ // a midtexture blocks the view
+ ceilingclip[rw_x] = (INT16)viewheight;
+ floorclip[rw_x] = -1;
+ }
+ else
+ {
+ // note: don't use min/max macros, since casting from INT32 to INT16 is involved here
+ if (markceiling)
+ ceilingclip[rw_x] = (yl >= 0) ? ((yl > viewheight) ? (INT16)viewheight : (INT16)((INT16)yl - 1)) : -1;
+ if (markfloor)
+ floorclip[rw_x] = (yh < viewheight) ? ((yh < -1) ? -1 : (INT16)((INT16)yh + 1)) : (INT16)viewheight;
+ }
}
else
{
@@ -1494,21 +1505,28 @@ static void R_RenderSegLoop (void)
if (mid >= floorclip[rw_x])
mid = floorclip[rw_x]-1;
- if (mid >= yl && yh < vid.height && yh > 0)
+ if (mid >= yl) // back ceiling lower than front ceiling ?
{
- dc_yl = yl;
- dc_yh = mid;
- dc_texturemid = rw_toptexturemid;
- dc_source = R_GetColumn(toptexture,texturecolumn);
- dc_texheight = textureheight[toptexture]>>FRACBITS;
- colfunc();
- ceilingclip[rw_x] = (INT16)mid;
+ if (yl >= viewheight) // entirely off bottom of screen
+ ceilingclip[rw_x] = (INT16)viewheight;
+ else if (mid >= 0) // safe to draw top texture
+ {
+ dc_yl = yl;
+ dc_yh = mid;
+ dc_texturemid = rw_toptexturemid;
+ dc_source = R_GetColumn(toptexture,texturecolumn);
+ dc_texheight = textureheight[toptexture]>>FRACBITS;
+ colfunc();
+ ceilingclip[rw_x] = (INT16)mid;
+ }
+ else // entirely off top of screen
+ ceilingclip[rw_x] = -1;
}
else
- ceilingclip[rw_x] = (INT16)((INT16)yl - 1);
+ ceilingclip[rw_x] = (yl >= 0) ? ((yl > viewheight) ? (INT16)viewheight : (INT16)((INT16)yl - 1)) : -1;
}
else if (markceiling) // no top wall
- ceilingclip[rw_x] = (INT16)((INT16)yl - 1);
+ ceilingclip[rw_x] = (yl >= 0) ? ((yl > viewheight) ? (INT16)viewheight : (INT16)((INT16)yl - 1)) : -1;
if (bottomtexture)
{
@@ -1520,22 +1538,29 @@ static void R_RenderSegLoop (void)
if (mid <= ceilingclip[rw_x])
mid = ceilingclip[rw_x]+1;
- if (mid <= yh && yh < vid.height && yh > 0)
+ if (mid <= yh) // back floor higher than front floor ?
{
- dc_yl = mid;
- dc_yh = yh;
- dc_texturemid = rw_bottomtexturemid;
- dc_source = R_GetColumn(bottomtexture,
- texturecolumn);
- dc_texheight = textureheight[bottomtexture]>>FRACBITS;
- colfunc();
- floorclip[rw_x] = (INT16)mid;
+ if (yh < 0) // entirely off top of screen
+ floorclip[rw_x] = -1;
+ else if (mid < viewheight) // safe to draw bottom texture
+ {
+ dc_yl = mid;
+ dc_yh = yh;
+ dc_texturemid = rw_bottomtexturemid;
+ dc_source = R_GetColumn(bottomtexture,
+ texturecolumn);
+ dc_texheight = textureheight[bottomtexture]>>FRACBITS;
+ colfunc();
+ floorclip[rw_x] = (INT16)mid;
+ }
+ else // entirely off bottom of screen
+ floorclip[rw_x] = (INT16)viewheight;
}
else
- floorclip[rw_x] = (INT16)((INT16)yh + 1);
+ floorclip[rw_x] = (yh < viewheight) ? ((yh < -1) ? -1 : (INT16)((INT16)yh + 1)) : (INT16)viewheight;
}
else if (markfloor) // no bottom wall
- floorclip[rw_x] = (INT16)((INT16)yh + 1);
+ floorclip[rw_x] = (yh < viewheight) ? ((yh < -1) ? -1 : (INT16)((INT16)yh + 1)) : (INT16)viewheight;
}
if (maskedtexture || numthicksides)
@@ -1858,12 +1883,13 @@ void R_StoreWallRange(INT32 start, INT32 stop)
// a single sided line is terminal, so it must mark ends
markfloor = markceiling = true;
#ifdef ESLOPE
- if (!(linedef->flags & ML_EFFECT1)) {
+ if (linedef->flags & ML_EFFECT2) {
if (linedef->flags & ML_DONTPEGBOTTOM)
rw_midtexturemid = frontsector->floorheight + textureheight[sidedef->midtexture] - viewz;
else
- rw_midtexturemid = frontsector->ceilingheight;
+ rw_midtexturemid = frontsector->ceilingheight - viewz;
}
+ else
#endif
if (linedef->flags & ML_DONTPEGBOTTOM)
{
@@ -2482,6 +2508,15 @@ void R_StoreWallRange(INT32 start, INT32 stop)
#ifdef ESLOPE
maskedtextureheight = ds_p->maskedtextureheight; // note to red, this == &(ds_p->maskedtextureheight[0])
+#ifdef POLYOBJECTS
+ if (curline->polyseg) { // use REAL front and back floors please, so midtexture rendering isn't mucked up
+ rw_midtextureslide = rw_midtexturebackslide = 0;
+ if (!!(linedef->flags & ML_DONTPEGBOTTOM) ^ !!(linedef->flags & ML_EFFECT3))
+ rw_midtexturemid = rw_midtextureback = max(curline->frontsector->floorheight, curline->backsector->floorheight) - viewz;
+ else
+ rw_midtexturemid = rw_midtextureback = min(curline->frontsector->ceilingheight, curline->backsector->ceilingheight) - viewz;
+ } else
+#endif
// Set midtexture starting height
if (linedef->flags & ML_EFFECT2) { // Ignore slopes when texturing
rw_midtextureslide = rw_midtexturebackslide = 0;
diff --git a/src/r_splats.h b/src/r_splats.h
index 349d8fa7a..c0ba6881c 100644
--- a/src/r_splats.h
+++ b/src/r_splats.h
@@ -63,7 +63,11 @@ typedef struct floorsplat_s
fixed_t P_SegLength(seg_t *seg);
// call at P_SetupLevel()
+#if !(defined (WALLSPLATS) || defined (FLOORSPLATS))
+FUNCMATH void R_ClearLevelSplats(void);
+#else
void R_ClearLevelSplats(void);
+#endif
#ifdef WALLSPLATS
void R_AddWallSplat(line_t *wallline, INT16 sectorside, const char *patchname, fixed_t top,
diff --git a/src/r_things.c b/src/r_things.c
index 4b3f289df..25cbd15fe 100644
--- a/src/r_things.c
+++ b/src/r_things.c
@@ -1643,7 +1643,8 @@ void R_SortVisSprites(void)
// Fix first and last. ds still points to the last one after the loop
dsfirst->prev = &unsorted;
unsorted.next = dsfirst;
- ds->next = &unsorted;
+ if (ds)
+ ds->next = &unsorted;
unsorted.prev = ds;
// pull the vissprites out by scale
diff --git a/src/s_sound.h b/src/s_sound.h
index bcc7979a1..39ec769a6 100644
--- a/src/s_sound.h
+++ b/src/s_sound.h
@@ -119,7 +119,7 @@ void S_ResumeAudio(void);
//
void S_UpdateSounds(void);
-fixed_t S_CalculateSoundDistance(fixed_t px1, fixed_t py1, fixed_t pz1, fixed_t px2, fixed_t py2, fixed_t pz2);
+FUNCMATH fixed_t S_CalculateSoundDistance(fixed_t px1, fixed_t py1, fixed_t pz1, fixed_t px2, fixed_t py2, fixed_t pz2);
void S_SetDigMusicVolume(INT32 volume);
void S_SetMIDIMusicVolume(INT32 volume);
diff --git a/src/screen.c b/src/screen.c
index 3834f72d5..376586c5d 100644
--- a/src/screen.c
+++ b/src/screen.c
@@ -69,6 +69,13 @@ consvar_t cv_scr_height = {"scr_height", "800", CV_SAVE, CV_Unsigned, NULL, 0, N
consvar_t cv_scr_depth = {"scr_depth", "16 bits", CV_SAVE, scr_depth_cons_t, NULL, 0, NULL, NULL, 0, 0, NULL};
#endif
consvar_t cv_renderview = {"renderview", "On", 0, CV_OnOff, NULL, 0, NULL, NULL, 0, 0, NULL};
+
+#ifdef DIRECTFULLSCREEN
+static FUNCMATH void SCR_ChangeFullscreen (void);
+#else
+static void SCR_ChangeFullscreen (void);
+#endif
+
consvar_t cv_fullscreen = {"fullscreen", "Yes", CV_SAVE|CV_CALL, CV_YesNo, SCR_ChangeFullscreen, 0, NULL, NULL, 0, 0, NULL};
// =========================================================================
diff --git a/src/screen.h b/src/screen.h
index bdf8e5a7d..2dff4590e 100644
--- a/src/screen.h
+++ b/src/screen.h
@@ -175,9 +175,7 @@ void SCR_SetDefaultMode (void);
void SCR_Startup (void);
-void SCR_ChangeFullscreen (void);
-
-boolean SCR_IsAspectCorrect(INT32 width, INT32 height);
+FUNCMATH boolean SCR_IsAspectCorrect(INT32 width, INT32 height);
// move out to main code for consistency
void SCR_DisplayTicRate(void);
diff --git a/src/sdl/MakeNIX.cfg b/src/sdl/MakeNIX.cfg
index f5c9b2075..1a0b54210 100644
--- a/src/sdl/MakeNIX.cfg
+++ b/src/sdl/MakeNIX.cfg
@@ -56,6 +56,15 @@ ifdef FREEBSD
LIBS+=-lipx -lkvm
endif
+#
+#here is Mac OS X
+#
+ifdef MACOSX
+ OBJS+=$(OBJDIR)/mac_resources.o
+ OBJS+=$(OBJDIR)/mac_alert.o
+ LIBS+=-framework CoreFoundation
+endif
+
#
#here is GP2x (arm-gp2x-linux)
#
diff --git a/src/sdl/Srb2SDL-vc10.vcxproj b/src/sdl/Srb2SDL-vc10.vcxproj
index d12a7efbf..820192649 100644
--- a/src/sdl/Srb2SDL-vc10.vcxproj
+++ b/src/sdl/Srb2SDL-vc10.vcxproj
@@ -167,6 +167,7 @@
+
@@ -308,6 +309,7 @@
+
diff --git a/src/sdl/Srb2SDL-vc10.vcxproj.filters b/src/sdl/Srb2SDL-vc10.vcxproj.filters
index 9396b4823..d04007dd7 100644
--- a/src/sdl/Srb2SDL-vc10.vcxproj.filters
+++ b/src/sdl/Srb2SDL-vc10.vcxproj.filters
@@ -294,6 +294,9 @@
M_Misc
+
+ M_Misc
+
M_Misc
@@ -666,6 +669,9 @@
M_Misc
+
+ M_Misc
+
M_Misc
diff --git a/src/sdl/i_cdmus.c b/src/sdl/i_cdmus.c
index f3f703667..3105f5122 100644
--- a/src/sdl/i_cdmus.c
+++ b/src/sdl/i_cdmus.c
@@ -12,25 +12,25 @@ consvar_t cd_volume = {"cd_volume","31",CV_SAVE,soundvolume_cons_t, NULL, 0, NUL
consvar_t cdUpdate = {"cd_update","1",CV_SAVE, NULL, NULL, 0, NULL, NULL, 0, 0, NULL};
-void I_InitCD(void){}
+FUNCMATH void I_InitCD(void){}
-void I_StopCD(void){}
+FUNCMATH void I_StopCD(void){}
-void I_PauseCD(void){}
+FUNCMATH void I_PauseCD(void){}
-void I_ResumeCD(void){}
+FUNCMATH void I_ResumeCD(void){}
-void I_ShutdownCD(void){}
+FUNCMATH void I_ShutdownCD(void){}
-void I_UpdateCD(void){}
+FUNCMATH void I_UpdateCD(void){}
-void I_PlayCD(UINT8 track, UINT8 looping)
+FUNCMATH void I_PlayCD(UINT8 track, UINT8 looping)
{
(void)track;
(void)looping;
}
-boolean I_SetVolumeCD(int volume)
+FUNCMATH boolean I_SetVolumeCD(int volume)
{
(void)volume;
return false;
diff --git a/src/sdl/i_main.c b/src/sdl/i_main.c
index 74b61339b..25fccb9f9 100644
--- a/src/sdl/i_main.c
+++ b/src/sdl/i_main.c
@@ -144,10 +144,8 @@ void XBoxStartup()
myargv = NULL;
#else
#ifdef FORCESDLMAIN
-FUNCNORETURN
int SDL_main(int argc, char **argv)
#else
-FUNCNORETURN
int main(int argc, char **argv)
#endif
{
@@ -216,12 +214,14 @@ int main(int argc, char **argv)
#if defined (_WIN32) && !defined (_XBOX)
#ifndef _WIN32_WCE
{
+#if 0 // just load the DLL
p_IsDebuggerPresent pfnIsDebuggerPresent = (p_IsDebuggerPresent)GetProcAddress(GetModuleHandleA("kernel32.dll"), "IsDebuggerPresent");
if ((!pfnIsDebuggerPresent || !pfnIsDebuggerPresent())
#ifdef BUGTRAP
&& !InitBugTrap()
#endif
)
+#endif
{
LoadLibraryA("exchndl.dll");
}
@@ -245,8 +245,6 @@ int main(int argc, char **argv)
#endif
// return to OS
-#ifndef __GNUC__
return 0;
-#endif
}
#endif
diff --git a/src/sdl/i_system.c b/src/sdl/i_system.c
index 0212e620b..ea8ade8c1 100644
--- a/src/sdl/i_system.c
+++ b/src/sdl/i_system.c
@@ -2049,14 +2049,14 @@ void I_StartupMouse2(void)
//
// I_Tactile
//
-void I_Tactile(FFType pFFType, const JoyFF_t *FFEffect)
+FUNCMATH void I_Tactile(FFType pFFType, const JoyFF_t *FFEffect)
{
// UNUSED.
(void)pFFType;
(void)FFEffect;
}
-void I_Tactile2(FFType pFFType, const JoyFF_t *FFEffect)
+FUNCMATH void I_Tactile2(FFType pFFType, const JoyFF_t *FFEffect)
{
// UNUSED.
(void)pFFType;
@@ -2067,7 +2067,7 @@ void I_Tactile2(FFType pFFType, const JoyFF_t *FFEffect)
*/
static ticcmd_t emptycmd;
-ticcmd_t *I_BaseTiccmd(void)
+FUNCMATH ticcmd_t *I_BaseTiccmd(void)
{
return &emptycmd;
}
@@ -2076,7 +2076,7 @@ ticcmd_t *I_BaseTiccmd(void)
*/
static ticcmd_t emptycmd2;
-ticcmd_t *I_BaseTiccmd2(void)
+FUNCMATH ticcmd_t *I_BaseTiccmd2(void)
{
return &emptycmd2;
}
@@ -2179,7 +2179,7 @@ tic_t I_GetTime (void)
//
//I_StartupTimer
//
-void I_StartupTimer(void)
+FUNCMATH void I_StartupTimer(void)
{
#if (defined (_WIN32) && !defined (_WIN32_WCE)) && !defined (_XBOX)
// for win2k time bug
@@ -2313,11 +2313,11 @@ void I_WaitVBL(INT32 count)
SDL_Delay(count);
}
-void I_BeginRead(void)
+FUNCMATH void I_BeginRead(void)
{
}
-void I_EndRead(void)
+FUNCMATH void I_EndRead(void)
{
}
@@ -3067,5 +3067,5 @@ const CPUInfoFlags *I_CPUInfo(void)
}
// note CPUAFFINITY code used to reside here
-void I_RegisterSysCommands(void) {}
+FUNCMATH void I_RegisterSysCommands(void) {}
#endif
diff --git a/src/sdl/i_video.c b/src/sdl/i_video.c
index b5168dad5..71baca510 100644
--- a/src/sdl/i_video.c
+++ b/src/sdl/i_video.c
@@ -1346,7 +1346,7 @@ void I_SetPalette(RGBA_t *palette)
}
// return number of fullscreen + X11 modes
-INT32 VID_NumModes(void)
+FUNCMATH INT32 VID_NumModes(void)
{
if (USE_FULLSCREEN && numVidModes != -1)
return numVidModes - firstEntry;
@@ -1354,7 +1354,7 @@ INT32 VID_NumModes(void)
return MAXWINMODES;
}
-const char *VID_GetModeName(INT32 modeNum)
+FUNCMATH const char *VID_GetModeName(INT32 modeNum)
{
#if 0
if (USE_FULLSCREEN && numVidModes != -1) // fullscreen modes
@@ -1384,7 +1384,7 @@ const char *VID_GetModeName(INT32 modeNum)
return &vidModeName[modeNum][0];
}
-INT32 VID_GetModeForSize(INT32 w, INT32 h)
+FUNCMATH INT32 VID_GetModeForSize(INT32 w, INT32 h)
{
int i;
for (i = 0; i < MAXWINMODES; i++)
diff --git a/src/sdl/macosx/mac_alert.c b/src/sdl/macosx/mac_alert.c
index 455e36509..2a139041a 100644
--- a/src/sdl/macosx/mac_alert.c
+++ b/src/sdl/macosx/mac_alert.c
@@ -25,19 +25,38 @@
#include "mac_alert.h"
#include
+#define CFSTRINGIFY(x) CFStringCreateWithCString(NULL, x, kCFStringEncodingASCII)
+
int MacShowAlert(const char *title, const char *message, const char *button1, const char *button2, const char *button3)
{
CFOptionFlags results;
- CFUserNotificationDisplayAlert(0,
- kCFUserNotificationStopAlertLevel | kCFUserNotificationNoDefaultButtonFlag,
- NULL, NULL, NULL,
- CFStringCreateWithCString(NULL, title, kCFStringEncodingASCII),
- CFStringCreateWithCString(NULL, message, kCFStringEncodingASCII),
- button1 != NULL ? CFStringCreateWithCString(NULL, button1, kCFStringEncodingASCII) : NULL,
- button2 != NULL ? CFStringCreateWithCString(NULL, button2, kCFStringEncodingASCII) : NULL,
- button3 != NULL ? CFStringCreateWithCString(NULL, button3, kCFStringEncodingASCII) : NULL,
- &results);
+ CFStringRef cf_title = CFSTRINGIFY(title);
+ CFStringRef cf_message = CFSTRINGIFY(message);
+ CFStringRef cf_button1 = NULL;
+ CFStringRef cf_button2 = NULL;
+ CFStringRef cf_button3 = NULL;
+
+ if (button1 != NULL)
+ cf_button1 = CFSTRINGIFY(button1);
+ if (button2 != NULL)
+ cf_button2 = CFSTRINGIFY(button2);
+ if (button3 != NULL)
+ cf_button3 = CFSTRINGIFY(button3);
+
+ CFOptionFlags alert_flags = kCFUserNotificationStopAlertLevel | kCFUserNotificationNoDefaultButtonFlag;
+
+ CFUserNotificationDisplayAlert(0, alert_flags, NULL, NULL, NULL, cf_title, cf_message,
+ cf_button1, cf_button2, cf_button3, &results);
+
+ if (cf_button1 != NULL)
+ CFRelease(cf_button1);
+ if (cf_button2 != NULL)
+ CFRelease(cf_button2);
+ if (cf_button3 != NULL)
+ CFRelease(cf_button3);
+ CFRelease(cf_message);
+ CFRelease(cf_title);
return (int)results;
}
diff --git a/src/sdl/macosx/mac_resources.c b/src/sdl/macosx/mac_resources.c
index dacc8014b..d67b92580 100644
--- a/src/sdl/macosx/mac_resources.c
+++ b/src/sdl/macosx/mac_resources.c
@@ -9,23 +9,29 @@ void OSX_GetResourcesPath(char * buffer)
mainBundle = CFBundleGetMainBundle();
if (mainBundle)
{
+ const int BUF_SIZE = 256; // because we somehow always know that
+
CFURLRef appUrlRef = CFBundleCopyBundleURL(mainBundle);
- CFStringRef macPath = CFURLCopyFileSystemPath(appUrlRef, kCFURLPOSIXPathStyle);
- CFStringRef resources = CFStringCreateWithCString(kCFAllocatorMalloc, "/Contents/Resources", kCFStringEncodingASCII);
- const void* rawarray[2] = {macPath, resources};
- CFArrayRef array = CFArrayCreate(kCFAllocatorMalloc, rawarray, 2, NULL);
- CFStringRef separator = CFStringCreateWithCString(kCFAllocatorMalloc, "", kCFStringEncodingASCII);
- CFStringRef fullPath = CFStringCreateByCombiningStrings(kCFAllocatorMalloc, array, separator);
- const char * path = CFStringGetCStringPtr(fullPath, kCFStringEncodingASCII);
- strcpy(buffer, path);
- CFRelease(fullPath);
- path = NULL;
- CFRelease(array);
- CFRelease(resources);
+ CFStringRef macPath;
+ if (appUrlRef != NULL)
+ macPath = CFURLCopyFileSystemPath(appUrlRef, kCFURLPOSIXPathStyle);
+ else
+ macPath = NULL;
+
+ const char* rawPath;
+
+ if (macPath != NULL)
+ rawPath = CFStringGetCStringPtr(macPath, kCFStringEncodingASCII);
+ else
+ rawPath = NULL;
+
+ if (rawPath != NULL && (CFStringGetLength(macPath) + strlen("/Contents/Resources") < BUF_SIZE))
+ {
+ strcpy(buffer, rawPath);
+ strcat(buffer, "/Contents/Resources");
+ }
+
CFRelease(macPath);
CFRelease(appUrlRef);
- //CFRelease(mainBundle);
- CFRelease(separator);
}
-
-}
\ No newline at end of file
+}
diff --git a/src/sdl/mixer_sound.c b/src/sdl/mixer_sound.c
index faebca6b4..4a46813c1 100644
--- a/src/sdl/mixer_sound.c
+++ b/src/sdl/mixer_sound.c
@@ -126,7 +126,7 @@ void I_ShutdownSound(void)
#endif
}
-void I_UpdateSound(void)
+FUNCMATH void I_UpdateSound(void)
{
}
@@ -464,7 +464,7 @@ static void mix_gme(void *udata, Uint8 *stream, int len)
}
#endif
-void I_InitMusic(void)
+FUNCMATH void I_InitMusic(void)
{
}
@@ -769,7 +769,7 @@ boolean I_SetSongTrack(int track)
// MIDI Music
//
-void I_InitMIDIMusic(void)
+FUNCMATH void I_InitMIDIMusic(void)
{
}
diff --git a/src/st_stuff.h b/src/st_stuff.h
index 6fafca404..c11559d2b 100644
--- a/src/st_stuff.h
+++ b/src/st_stuff.h
@@ -24,7 +24,7 @@
//
// Called by main loop.
-void ST_Ticker(void);
+FUNCMATH void ST_Ticker(void);
// Called by main loop.
void ST_Drawer(void);
diff --git a/src/tables.h b/src/tables.h
index 0e4853cb9..e05b81845 100644
--- a/src/tables.h
+++ b/src/tables.h
@@ -82,7 +82,7 @@ typedef UINT32 angle_t;
extern angle_t tantoangle[SLOPERANGE+1];
// Utility function, called by R_PointToAngle.
-unsigned SlopeDiv(unsigned num, unsigned den);
+FUNCMATH unsigned SlopeDiv(unsigned num, unsigned den);
// 360 - angle_t(ANGLE_45) = ANGLE_315
FUNCMATH FUNCINLINE static ATTRINLINE angle_t InvAngle(angle_t a)
diff --git a/src/w_wad.c b/src/w_wad.c
index 40fea5223..aeaad3ced 100644
--- a/src/w_wad.c
+++ b/src/w_wad.c
@@ -475,11 +475,11 @@ UINT16 W_LoadWadFile(const char *filename)
//
CONS_Printf(M_GetText("Added file %s (%u lumps)\n"), filename, numlumps);
wadfiles[numwadfiles] = wadfile;
- W_LoadDehackedLumps(numwadfiles);
+ numwadfiles++; // must come BEFORE W_LoadDehackedLumps, so any addfile called by COM_BufInsertText called by Lua doesn't overwrite what we just loaded
+ W_LoadDehackedLumps(numwadfiles-1);
W_InvalidateLumpnumCache();
- numwadfiles++;
return wadfile->numlumps;
}
diff --git a/src/w_wad.h b/src/w_wad.h
index c13f69338..b03e376bf 100644
--- a/src/w_wad.h
+++ b/src/w_wad.h
@@ -54,10 +54,8 @@ typedef struct
#define lumpcache_t void *
-// Annoying cyclic dependency workaround: this inlcusion must come after
-// the definition of MAX_WADPATH.
#ifdef HWRENDER
-#include "m_misc.h"
+#include "m_aatree.h"
#endif
typedef struct wadfile_s
diff --git a/src/win32/Srb2win-vc10.vcxproj b/src/win32/Srb2win-vc10.vcxproj
index 1e9d8241e..064f75d7d 100644
--- a/src/win32/Srb2win-vc10.vcxproj
+++ b/src/win32/Srb2win-vc10.vcxproj
@@ -145,6 +145,7 @@
+
@@ -300,6 +301,7 @@
+
diff --git a/src/win32/Srb2win-vc10.vcxproj.filters b/src/win32/Srb2win-vc10.vcxproj.filters
index 3f5b84bfb..b2647ea1c 100644
--- a/src/win32/Srb2win-vc10.vcxproj.filters
+++ b/src/win32/Srb2win-vc10.vcxproj.filters
@@ -255,6 +255,9 @@
LUA
+
+ M_Misc
+
M_Misc
@@ -662,6 +665,9 @@
M_Misc
+
+ M_Misc
+
M_Misc
diff --git a/src/win32/win_main.c b/src/win32/win_main.c
index 9c9a20e75..663eddbd4 100644
--- a/src/win32/win_main.c
+++ b/src/win32/win_main.c
@@ -644,13 +644,16 @@ int WINAPI WinMain (HINSTANCE hInstance,
{
int Result = -1;
+#if 0
// Win95 and NT <4 don't have this, so link at runtime.
p_IsDebuggerPresent pfnIsDebuggerPresent = (p_IsDebuggerPresent)GetProcAddress(GetModuleHandleA("kernel32.dll"),"IsDebuggerPresent");
+#endif
UNREFERENCED_PARAMETER(hPrevInstance);
UNREFERENCED_PARAMETER(lpCmdLine);
UNREFERENCED_PARAMETER(nCmdShow);
+#if 0
#ifdef BUGTRAP
// Try BugTrap first.
if((!pfnIsDebuggerPresent || !pfnIsDebuggerPresent()) && InitBugTrap())
@@ -660,6 +663,7 @@ int WINAPI WinMain (HINSTANCE hInstance,
#endif
// Try Dr MinGW's exception handler.
if (!pfnIsDebuggerPresent || !pfnIsDebuggerPresent())
+#endif
LoadLibraryA("exchndl.dll");
prevExceptionFilter = SetUnhandledExceptionFilter(RecordExceptionInfo);