diff --git a/.circleci/config.yml b/.circleci/config.yml
index b5c43d017..ca9105685 100644
--- a/.circleci/config.yml
+++ b/.circleci/config.yml
@@ -58,6 +58,3 @@ jobs:
key: v1-SRB2-{{ .Branch }}-{{ checksum "objs/Linux/SDL/Release/depend.dep" }}
paths:
- /root/.ccache
-
-
-
diff --git a/.travis.yml b/.travis.yml
index e5dbb58e4..4648ae567 100644
--- a/.travis.yml
+++ b/.travis.yml
@@ -100,6 +100,21 @@ matrix:
compiler: gcc-6
env: WFLAGS="-Wno-tautological-compare"
#gcc-6 (Ubuntu 6.1.1-3ubuntu11~14.04.1) 6.1.1 20160511
+ - os: linux
+ addons:
+ apt:
+ sources:
+ - ubuntu-toolchain-r-test
+ packages:
+ - libsdl2-mixer-dev
+ - libpng-dev
+ - libgl1-mesa-dev
+ - libgme-dev
+ - p7zip-full
+ - gcc-7
+ compiler: gcc-7
+ env: WFLAGS="-Wno-tautological-compare -Wno-error=implicit-fallthrough -Wimplicit-fallthrough=3"
+ #gcc-7 (Ubuntu 7.2.0-1ubuntu1~14.04) 7.2.0 20170802
- os: linux
compiler: clang
#clang version 3.5.0 (tags/RELEASE_350/final)
@@ -162,6 +177,51 @@ matrix:
- clang-3.8
compiler: clang-3.8
#clang version 3.8.1-svn271127-1~exp1 (branches/release_38)
+ - os: linux
+ addons:
+ apt:
+ sources:
+ - llvm-toolchain-precise-3.9
+ - ubuntu-toolchain-r-test
+ packages:
+ - libsdl2-mixer-dev
+ - libpng-dev
+ - libgl1-mesa-dev
+ - libgme-dev
+ - p7zip-full
+ - clang-3.9
+ compiler: clang-3.9
+ #clang version 3.9.X
+# - os: linux
+# addons:
+# apt:
+# sources:
+# - llvm-toolchain-precise-4.0
+# - ubuntu-toolchain-r-test
+# packages:
+# - libsdl2-mixer-dev
+# - libpng-dev
+# - libgl1-mesa-dev
+# - libgme-dev
+# - p7zip-full
+# - clang-4.0
+# compiler: clang-4.0
+# #clang version 4.0.X
+# - os: linux
+# addons:
+# apt:
+# sources:
+# - llvm-toolchain-precise-5.0
+# - ubuntu-toolchain-r-test
+# packages:
+# - libsdl2-mixer-dev
+# - libpng-dev
+# - libgl1-mesa-dev
+# - libgme-dev
+# - p7zip-full
+# - clang-5.0
+# compiler: clang-5.0
+# #clang version 5.0.X
# - os: osx
# osx_image: beta-xcode6.1
# #Apple LLVM version 6.0 (clang-600.0.54) (based on LLVM 3.5svn)
@@ -192,6 +252,9 @@ matrix:
- compiler: clang-3.6
- compiler: clang-3.7
- compiler: clang-3.8
+ - compiler: clang-3.9
+ - compiler: clang-4.0
+ - compiler: clang-5.0
cache:
apt: true
@@ -219,9 +282,9 @@ before_script:
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 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/release/SDL2-2.0.6.dmg; hdiutil attach SDL2-2.0.6.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 88dc400fe..2a1eb87b8 100644
--- a/SRB2.cbp
+++ b/SRB2.cbp
@@ -1174,6 +1174,39 @@ HW3SOUND for 3D hardware sound support
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/objs/DC/SDL/Debug/.gitignore b/bin/Dos/Debug/.gitignore
similarity index 100%
rename from objs/DC/SDL/Debug/.gitignore
rename to bin/Dos/Debug/.gitignore
diff --git a/objs/DC/SDL/Release/.gitignore b/bin/Dos/Release/.gitignore
similarity index 100%
rename from objs/DC/SDL/Release/.gitignore
rename to bin/Dos/Release/.gitignore
diff --git a/objs/PS3/SDL/Debug/.gitignore b/bin/FreeBSD/Debug/.gitignore
similarity index 100%
rename from objs/PS3/SDL/Debug/.gitignore
rename to bin/FreeBSD/Debug/.gitignore
diff --git a/objs/PS3/SDL/Release/.gitignore b/bin/FreeBSD/Release/.gitignore
similarity index 100%
rename from objs/PS3/SDL/Release/.gitignore
rename to bin/FreeBSD/Release/.gitignore
diff --git a/bin/PS3/Debug/.gitignore b/bin/PS3/Debug/.gitignore
deleted file mode 100644
index c4dcd19e5..000000000
--- a/bin/PS3/Debug/.gitignore
+++ /dev/null
@@ -1,5 +0,0 @@
-/*.elf
-/*.self
-/*.pkg
-/*.BIN
-/pkg
diff --git a/bin/PS3/Release/.gitignore b/bin/PS3/Release/.gitignore
deleted file mode 100644
index c4dcd19e5..000000000
--- a/bin/PS3/Release/.gitignore
+++ /dev/null
@@ -1,5 +0,0 @@
-/*.elf
-/*.self
-/*.pkg
-/*.BIN
-/pkg
diff --git a/bin/PSP/Release/.gitignore b/bin/PSP/Release/.gitignore
deleted file mode 100644
index 98d08e695..000000000
--- a/bin/PSP/Release/.gitignore
+++ /dev/null
@@ -1,4 +0,0 @@
-/EBOOT.PBP
-/PARAM.SFO
-/SRB2PSP.PBP
-/SRB2PSP.elf
diff --git a/objs/PSP/SDL/Release/.gitignore b/bin/SDL/Debug/.gitignore
similarity index 100%
rename from objs/PSP/SDL/Release/.gitignore
rename to bin/SDL/Debug/.gitignore
diff --git a/objs/Wii/SDL/Debug/.gitignore b/bin/SDL/Release/.gitignore
similarity index 100%
rename from objs/Wii/SDL/Debug/.gitignore
rename to bin/SDL/Release/.gitignore
diff --git a/bin/Wii/Debug/.gitignore b/bin/Wii/Debug/.gitignore
deleted file mode 100644
index 200eea51f..000000000
--- a/bin/Wii/Debug/.gitignore
+++ /dev/null
@@ -1,3 +0,0 @@
-/*.elf
-/*.dol
-/apps
diff --git a/bin/Wii/Release/.gitignore b/bin/Wii/Release/.gitignore
deleted file mode 100644
index 200eea51f..000000000
--- a/bin/Wii/Release/.gitignore
+++ /dev/null
@@ -1,3 +0,0 @@
-/*.elf
-/*.dol
-/apps
diff --git a/objs/Wii/SDL/Release/.gitignore b/bin/dummy/.gitignore
similarity index 100%
rename from objs/Wii/SDL/Release/.gitignore
rename to bin/dummy/.gitignore
diff --git a/bin/nds/Debug/.gitignore b/bin/nds/Debug/.gitignore
deleted file mode 100644
index 9bfc4a51d..000000000
--- a/bin/nds/Debug/.gitignore
+++ /dev/null
@@ -1,3 +0,0 @@
-*.arm9
-*.elf*
-*.nds
diff --git a/bin/nds/Release/.gitignore b/bin/nds/Release/.gitignore
deleted file mode 100644
index 9bfc4a51d..000000000
--- a/bin/nds/Release/.gitignore
+++ /dev/null
@@ -1,3 +0,0 @@
-*.arm9
-*.elf*
-*.nds
diff --git a/objs/WinCE/SDL/Release/.gitignore b/objs/FreeBSD/SDL/Debug/.gitignore
similarity index 100%
rename from objs/WinCE/SDL/Release/.gitignore
rename to objs/FreeBSD/SDL/Debug/.gitignore
diff --git a/objs/nds/Debug/.gitignore b/objs/FreeBSD/SDL/Release/.gitignore
similarity index 100%
rename from objs/nds/Debug/.gitignore
rename to objs/FreeBSD/SDL/Release/.gitignore
diff --git a/objs/nds/Release/.gitignore b/objs/MasterClient/.gitignore
similarity index 100%
rename from objs/nds/Release/.gitignore
rename to objs/MasterClient/.gitignore
diff --git a/objs/MasterServer/.gitignore b/objs/MasterServer/.gitignore
new file mode 100644
index 000000000..42c6dc2c6
--- /dev/null
+++ b/objs/MasterServer/.gitignore
@@ -0,0 +1,2 @@
+# DON'T REMOVE
+# This keeps the folder from disappearing
diff --git a/objs/cygwin/Debug/.gitignore b/objs/cygwin/Debug/.gitignore
new file mode 100644
index 000000000..42c6dc2c6
--- /dev/null
+++ b/objs/cygwin/Debug/.gitignore
@@ -0,0 +1,2 @@
+# DON'T REMOVE
+# This keeps the folder from disappearing
diff --git a/objs/cygwin/Release/.gitignore b/objs/cygwin/Release/.gitignore
new file mode 100644
index 000000000..42c6dc2c6
--- /dev/null
+++ b/objs/cygwin/Release/.gitignore
@@ -0,0 +1,2 @@
+# DON'T REMOVE
+# This keeps the folder from disappearing
diff --git a/objs/dummy/.gitignore b/objs/dummy/.gitignore
new file mode 100644
index 000000000..42c6dc2c6
--- /dev/null
+++ b/objs/dummy/.gitignore
@@ -0,0 +1,2 @@
+# DON'T REMOVE
+# This keeps the folder from disappearing
diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt
index da8438a59..6a8b7e3f1 100644
--- a/src/CMakeLists.txt
+++ b/src/CMakeLists.txt
@@ -351,6 +351,7 @@ if(${SRB2_CONFIG_HWRENDER})
set(SRB2_HWRENDER_SOURCES
${CMAKE_CURRENT_SOURCE_DIR}/hardware/hw_bsp.c
${CMAKE_CURRENT_SOURCE_DIR}/hardware/hw_cache.c
+ ${CMAKE_CURRENT_SOURCE_DIR}/hardware/hw_clip.c
${CMAKE_CURRENT_SOURCE_DIR}/hardware/hw_draw.c
${CMAKE_CURRENT_SOURCE_DIR}/hardware/hw_light.c
${CMAKE_CURRENT_SOURCE_DIR}/hardware/hw_main.c
@@ -359,6 +360,7 @@ if(${SRB2_CONFIG_HWRENDER})
)
set (SRB2_HWRENDER_HEADERS
+ ${CMAKE_CURRENT_SOURCE_DIR}/hardware/hw_clip.h
${CMAKE_CURRENT_SOURCE_DIR}/hardware/hw_data.h
${CMAKE_CURRENT_SOURCE_DIR}/hardware/hw_defs.h
${CMAKE_CURRENT_SOURCE_DIR}/hardware/hw_dll.h
diff --git a/src/Makefile b/src/Makefile
index 426dc2289..017bd2442 100644
--- a/src/Makefile
+++ b/src/Makefile
@@ -33,8 +33,6 @@
# compile all HW render and 3D sound DLLs for the set
# opengl_dll
# Pure Mingw only, compile OpenGL HW render DLL
-# minigl_dll
-# Pure Mingw only, compile MiniGL HW render DLL
# ds3d_dll
# Pure Mingw only, compile DirectX DirectSound HW sound DLL
# fmod_dll
@@ -91,10 +89,6 @@ D_FILES=$(D_DIR)/srb2.srb \
PKG_CONFIG?=pkg-config
-ifdef WIILINUX
-LINUX=1
-endif
-
ifdef PANDORA
LINUX=1
endif
@@ -108,12 +102,6 @@ ifdef HAIKU
SDL=1
endif
-ifdef NDS
-# Include this before the main Makefile.cfg
-EXENAME?=srb2.elf
-include nds/Makefile.cfg
-endif
-
include Makefile.cfg
ifdef DUMMY
@@ -139,32 +127,12 @@ PNG_CFLAGS?=
PNG_LDFLAGS?=-lpng
endif
-ifdef WIILINUX
-NONX86=1
-NOTERMIOS=1
-NOHW=1
-CFLAGS+=-DWMINPUT
-NOTERMIOS=1
-NOPOSTPROCESSING=1
-endif
-
ifdef PANDORA
NONX86=1
NOHW=1
NOHS=1
endif
-ifdef WII
-NONX86=1
-NOHW=1
-NOPOSTPROCESSING=1
-endif
-
-ifdef PS3N
-NONX86=1
-NOHW=1
-endif
-
ifdef DJGPPDOS
include djgppdos/Makefile.cfg
endif
@@ -196,20 +164,8 @@ ifdef MACOSX
UNIXCOMMON=1
endif
-ifdef NDS
-NOPNG=1
-NONET=1
-#NOHW=1
-NOHS=1
-NOASM=1
-NOIPX=1
-NONX86=1
-OBJS+=$(OBJDIR)/i_video.o
-LIBS+=-lm
-endif
-
ifdef SDL
-include sdl/Makefile.cfg
+ include sdl/Makefile.cfg
endif #ifdef SDL
ifdef DISTCC
@@ -231,11 +187,7 @@ ifndef ECHO
OBJDUMP:=@$(OBJDUMP)
STRIP:=@$(STRIP)
WINDRES:=@$(WINDRES)
- CP:=@$(CP)
MKDIR:=@$(MKDIR)
- MKISOFS:=@$(MKISOFS)
- DD:=@$(DD)
- NDSTOOL:=@$(NDSTOOL)
GZIP:=@$(GZIP)
MSGFMT:=@$(MSGFMT)
UPX:=@$(UPX)
@@ -253,13 +205,11 @@ endif
ifdef NOHW
OPTS+=-DNOHW
else
-ifndef DC
#Hurdler: not really supported and not tested recently
#OPTS+=-DUSE_PALETTED_TEXTURE
-endif
OPTS+=-DHWRENDER
OBJS+=$(OBJDIR)/hw_bsp.o $(OBJDIR)/hw_draw.o $(OBJDIR)/hw_light.o \
- $(OBJDIR)/hw_main.o $(OBJDIR)/hw_md2.o $(OBJDIR)/hw_cache.o $(OBJDIR)/hw_trick.o
+ $(OBJDIR)/hw_main.o $(OBJDIR)/hw_clip.o $(OBJDIR)/hw_md2.o $(OBJDIR)/hw_cache.o $(OBJDIR)/hw_trick.o
endif
ifdef NOHS
@@ -362,14 +312,6 @@ else
OBJS:=$(OBJDIR)/md5.o $(OBJS)
endif
-ifdef FAKEDC
- OPTS+=-DDC
-endif
-
-ifdef FAKEPSP
- OPTS+=-DPSP
-endif
-
ifdef NOPOSTPROCESSING
OPTS+=-DNOPOSTPROCESSING
endif
@@ -521,49 +463,20 @@ ifdef DJGPPDOS
all: pre-build $(BIN)/$(EXENAME)
endif
-ifdef XBOX
-all: pre-build $(BIN)/$(BINNAME)
-endif
-
-ifdef PS3N
-all: pre-build $(BIN)/$(PKGNAME)
-endif
-
-ifdef WII
-all: pre-build $(BIN)/$(DOLNAME)
-endif
-
ifdef PANDORA
all: pre-build $(BIN)/$(PNDNAME)
endif
-ifdef PSP
-all: pre-build $(BIN)/$(BINNAME) post-build
-endif
-ifdef DC
-all: pre-build $(BIN)/$(BINNAME) post-build
-endif
-
-ifndef DC
-ifndef PSP
-ifndef XBOX
ifdef MINGW
ifndef SDL
all: pre-build $(BIN)/$(EXENAME) dll
endif
endif
-endif
-endif
ifdef SDL
all: pre-build $(BIN)/$(EXENAME)
endif
-endif
-
-ifdef NDS
-all: $(BIN)/$(EXENAME:.elf=.nds)
-endif
ifdef DUMMY
all: $(BIN)/$(EXENAME)
@@ -617,12 +530,10 @@ 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
@@ -647,7 +558,7 @@ else
dll : opengl_dll
endif
ifdef MINGW
-all_dll: opengl_dll minigl_dll ds3d_dll fmod_dll openal_dll
+all_dll: opengl_dll ds3d_dll fmod_dll openal_dll
opengl_dll: $(BIN)/r_opengl.dll
$(BIN)/r_opengl.dll: $(OBJDIR)/ogl_win.o $(OBJDIR)/r_opengl.o
@@ -658,12 +569,6 @@ ifndef NOUPX
-$(UPX) $(UPX_OPTS) $@
endif
-minigl_dll: $(BIN)/r_minigl.dll
-$(BIN)/r_minigl.dll: $(OBJDIR)/r_minigl.o
- -$(MKDIR) $(BIN)
- @echo Linking R_MiniGL.dll...
- $(CC) --shared $^ -o $@ -g -Wl,--add-stdcall-alias -lgdi32
-
ds3d_dll: $(BIN)/s_ds3d.dll
$(BIN)/s_ds3d.dll: $(OBJDIR)/s_ds3d.o
@echo Linking S_DS3d.dll...
@@ -703,7 +608,7 @@ ifdef MINGW
$(OBJDIR)/r_opengl.o: hardware/r_opengl/r_opengl.c hardware/r_opengl/r_opengl.h \
doomdef.h doomtype.h g_state.h m_swap.h hardware/hw_drv.h screen.h \
command.h hardware/hw_data.h hardware/hw_glide.h hardware/hw_defs.h \
- hardware/hw_md2.h hardware/hw_glob.h hardware/hw_main.h am_map.h \
+ hardware/hw_md2.h hardware/hw_glob.h hardware/hw_main.h hardware/hw_clip.h am_map.h \
d_event.h d_player.h p_pspr.h m_fixed.h tables.h info.h d_think.h \
p_mobj.h doomdata.h d_ticcmd.h r_defs.h hardware/hw_dll.h
$(CC) $(CFLAGS) $(WFLAGS) -c $< -o $@
@@ -711,7 +616,7 @@ else
$(OBJDIR)/r_opengl.o: hardware/r_opengl/r_opengl.c hardware/r_opengl/r_opengl.h \
doomdef.h doomtype.h g_state.h m_swap.h hardware/hw_drv.h screen.h \
command.h hardware/hw_data.h hardware/hw_glide.h hardware/hw_defs.h \
- hardware/hw_md2.h hardware/hw_glob.h hardware/hw_main.h am_map.h \
+ hardware/hw_md2.h hardware/hw_glob.h hardware/hw_main.h hardware/hw_clip.h am_map.h \
d_event.h d_player.h p_pspr.h m_fixed.h tables.h info.h d_think.h \
p_mobj.h doomdata.h d_ticcmd.h r_defs.h hardware/hw_dll.h
$(CC) $(CFLAGS) $(WFLAGS) -I/usr/X11R6/include -c $< -o $@
@@ -742,16 +647,6 @@ endif
$(REMOVE) $(OBJDIR)/depend.ped
@echo "Created dependency file, depend.dep"
-ifdef DC
-$(OBJDIR)/v_video.o: v_video.c doomdef.h doomtype.h g_state.h m_swap.h r_local.h \
- tables.h m_fixed.h screen.h command.h m_bbox.h r_main.h d_player.h \
- p_pspr.h info.h d_think.h sounds.h p_mobj.h doomdata.h d_ticcmd.h \
- r_data.h r_defs.h r_state.h r_bsp.h r_segs.h r_plane.h r_sky.h \
- r_things.h r_draw.h v_video.h hu_stuff.h d_event.h w_wad.h console.h \
- i_video.h z_zone.h doomstat.h d_clisrv.h d_netcmd.h
- $(CC) $(CFLAGS) -fno-omit-frame-pointer $(WFLAGS) -c $< -o $@
-endif
-
ifdef VALGRIND
$(OBJDIR)/z_zone.o: z_zone.c
$(CC) $(CFLAGS) $(WFLAGS) -DHAVE_VALGRIND $(VALGRIND_CFLAGS) -c $< -o $@
@@ -793,70 +688,6 @@ $(OBJDIR)/%.o: %.s
$(OBJDIR)/SRB2.res: win32/Srb2win.rc win32/afxres.h win32/resource.h
$(WINDRES) -i $< -O rc $(WINDRESFLAGS) --include-dir=win32 -o $@ -O coff
-ifdef DC
-$(OBJDIR)/romdisk.img:
- $(KOS_GENROMFS) -f romdisk.img -d ../data -v
-
-$(OBJDIR)/romdisk.o: romdisk.img
- $(KOS_BASE)/utils/bin2o/bin2o romdisk.img romdisk romdisk.o
-
-$(OBJDIR)/dchelp.o: $(INTERFACE)/SRB2DC/dchelp.c
- $(CC) $(CFLAGS) $(WFLAGS) -c $< -o $@
-
-$(OBJDIR)/i_udp.o: $(INTERFACE)/SRB2DC/i_udp.c
- $(CC) $(CFLAGS) $(WFLAGS) -c $< -o $@
-
-$(BIN)/IP.BIN: $(INTERFACE)/SRB2DC/IP.BIN
- $(CP) $< $@
-
-$(BIN)/SRB2DC.cdi.pass1: $(INTERFACE)/SRB2DC/SELFBOOT.BIN
- $(CP) $< $@
-
-$(BIN)/$(BINNAME): $(BIN)/$(EXENAME)
- $(KOS_OBJCOPY) -R .stack -O binary $< $@
-
-$(BIN)/1ST_READ.BIN: $(BIN)/$(BINNAME) $(BIN)/scramble
- $(BIN)/scramble $< $@
-
-$(BIN)/scramble: $(INTERFACE)/SRB2DC/scramble.c
- -$(MKDIR) $(BIN)
- $(HOSTCC) $< -o $@
-
-iso: $(BIN)/SRB2DC.iso
-cdi: $(BIN)/SRB2DC.cdi
-
-$(BIN)/SRB2DC.iso.pass1: $(BIN)/1ST_READ.BIN $(BIN)/IP.BIN
- -$(MKDIR) $(BIN)/cdrom
- $(CP) $(BIN)/1ST_READ.BIN $(D_FILES) $(BIN)/cdrom
- $(MKISOFS) -l -r -o $@ $(BIN)/cdrom
-
-$(BIN)/SRB2DC.iso.pass2: $(BIN)/SRB2DC.iso.pass1
- $(DD) if=$< of=$@ bs=2048 skip=16 status=noxfer
-
-$(BIN)/SRB2DC.iso: $(BIN)/SRB2DC.iso.pass2 $(BIN)/IP.BIN
- @cat $(BIN)/IP.BIN $(BIN)/SRB2DC.iso.pass2 > $@
-
-$(BIN)/SRB2DC.cdi: $(BIN)/SRB2DC.iso.pass2 $(BIN)/SRB2DC.cdi.pass1 $(BIN)/IP.BIN
- @cat $(BIN)/SRB2DC.cdi.pass1 $(BIN)/IP.BIN $(BIN)/SRB2DC.iso.pass2 > $@
-
-post-build: $(BIN)/1ST_READ.BIN
-endif
-
-ifdef XBOX
-$(OBJDIR)/xboxhelp.o: $(INTERFACE)/SRB2XBOX/xboxhelp.c
- $(CC) $(CFLAGS) $(WFLAGS) -c $< -o $@
-
-$(BIN)/$(BINNAME): $(BIN)/$(EXENAME)
- $(CXBE) -OUT:"$@" -DUMPINFO:"$(BIN)/SRB2XBOX.cxbe" -TITLE:"Sonic Robo Blast 2" $<
-endif
-
-ifdef NDS
-$(BIN)/$(EXENAME:.elf=.nds): $(BIN)/$(EXENAME:.elf=.arm9)
- $(NDSTOOL) -c $@ -9 $(BIN)/$(EXENAME:.elf=.arm9)
-
-%.arm9: %.elf
- $(OBJCOPY) -O binary $< $@
-endif
ifdef MINGW
ifndef SDL
@@ -864,7 +695,7 @@ ifndef NOHW
$(OBJDIR)/r_opengl.o: hardware/r_opengl/r_opengl.c hardware/r_opengl/r_opengl.h \
doomdef.h doomtype.h g_state.h m_swap.h hardware/hw_drv.h screen.h \
command.h hardware/hw_data.h hardware/hw_glide.h hardware/hw_defs.h \
- hardware/hw_md2.h hardware/hw_glob.h hardware/hw_main.h am_map.h \
+ hardware/hw_md2.h hardware/hw_glob.h hardware/hw_main.h hardware/hw_clip.h am_map.h \
d_event.h d_player.h p_pspr.h m_fixed.h tables.h info.h d_think.h \
p_mobj.h doomdata.h d_ticcmd.h r_defs.h hardware/hw_dll.h
$(CC) $(CFLAGS) $(WFLAGS) -D_WINDOWS -mwindows -c $< -o $@
@@ -872,15 +703,7 @@ $(OBJDIR)/r_opengl.o: hardware/r_opengl/r_opengl.c hardware/r_opengl/r_opengl.h
$(OBJDIR)/ogl_win.o: hardware/r_opengl/ogl_win.c hardware/r_opengl/r_opengl.h \
doomdef.h doomtype.h g_state.h m_swap.h hardware/hw_drv.h screen.h \
command.h hardware/hw_data.h hardware/hw_glide.h hardware/hw_defs.h \
- hardware/hw_md2.h hardware/hw_glob.h hardware/hw_main.h am_map.h \
- d_event.h d_player.h p_pspr.h m_fixed.h tables.h info.h d_think.h \
- p_mobj.h doomdata.h d_ticcmd.h r_defs.h hardware/hw_dll.h
- $(CC) $(CFLAGS) $(WFLAGS) -D_WINDOWS -mwindows -c $< -o $@
-
-$(OBJDIR)/r_minigl.o: hardware/r_minigl/r_minigl.c hardware/r_opengl/r_opengl.h \
- doomdef.h doomtype.h g_state.h m_swap.h hardware/hw_drv.h screen.h \
- command.h hardware/hw_data.h hardware/hw_glide.h hardware/hw_defs.h \
- hardware/hw_md2.h hardware/hw_glob.h hardware/hw_main.h am_map.h \
+ hardware/hw_md2.h hardware/hw_glob.h hardware/hw_main.h hardware/hw_clip.h am_map.h \
d_event.h d_player.h p_pspr.h m_fixed.h tables.h info.h d_think.h \
p_mobj.h doomdata.h d_ticcmd.h r_defs.h hardware/hw_dll.h
$(CC) $(CFLAGS) $(WFLAGS) -D_WINDOWS -mwindows -c $< -o $@
@@ -933,25 +756,6 @@ $(OBJDIR)/s_openal.o: hardware/s_openal/s_openal.c hardware/hw3dsdrv.h \
hardware/hw_dll.h
$(CC) $(M5) -Os -o $(OBJDIR)/s_openal.o -DHW3SOUND -DUNIXCOMMON -shared -nostartfiles -c hardware/s_openal/s_openal.c
endif
-
-ifdef FILTERS
-$(OBJDIR)/%.o: $(INTERFACE)/filter/%.c
- @echo $< needs deps
- $(CC) $(CFLAGS) $(WFLAGS) -c $< -o $@
-
-$(OBJDIR)/filters.o: $(INTERFACE)/filter/filters.c $(INTERFACE)/filter/filters.c \
- $(INTERFACE)/filter/filters.h
- $(CC) $(CFLAGS) $(WFLAGS) -c $< -o $@
-
-$(OBJDIR)/hq2x.o: $(INTERFACE)/filter/hq2x.c $(INTERFACE)/filter/hq2x.c \
- $(INTERFACE)/filter/filters.h
- $(CC) $(CFLAGS) $(WFLAGS) -c $< -o $@
-
-$(OBJDIR)/lq2x.o: $(INTERFACE)/filter/lq2x.c $(INTERFACE)/filter/lq2x.c \
- $(INTERFACE)/filter/filters.h $(INTERFACE)/filter/interp.h \
- $(INTERFACE)/filter/hq2x.h $(INTERFACE)/filter/lq2x.h
- $(CC) $(CFLAGS) $(WFLAGS) -c $< -o $@
-endif
endif
#############################################################
diff --git a/src/Makefile.cfg b/src/Makefile.cfg
index 5bf7f247d..b32b522f6 100644
--- a/src/Makefile.cfg
+++ b/src/Makefile.cfg
@@ -7,6 +7,21 @@
# and other things
#
+ifdef GCC80
+GCC72=1
+endif
+
+ifdef GCC72
+GCC71=1
+endif
+
+ifdef GCC71
+GCC64=1
+endif
+
+ifdef GCC64
+GCC64=1
+endif
ifdef GCC63
GCC62=1
@@ -77,10 +92,6 @@ ifdef GCC295
GCC29=1
endif
-ifdef DC
-NOCASTALIGNWARN=1
-endif
-
OLDWFLAGS:=$(WFLAGS)
# -W -Wno-unused
WFLAGS=-Wall
@@ -141,15 +152,11 @@ endif
ifdef GCC40
WFLAGS+=-Wold-style-definition
endif
-ifndef XBOX
WFLAGS+=-Wmissing-prototypes -Wmissing-declarations
-endif
ifdef GCC40
WFLAGS+=-Wmissing-field-initializers
endif
-ifndef XBOX
WFLAGS+=-Wmissing-noreturn
-endif
#WFLAGS+=-Wmissing-format-attribute
#WFLAGS+=-Wno-multichar
#WFLAGS+=-Wno-deprecated-declarations
@@ -207,18 +214,11 @@ endif
#indicate platform and what interface use with
-ifndef WINCE
-ifndef XBOX
-ifndef PSP
-ifndef DC
-ifndef WII
-ifndef PS3N
ifndef LINUX
ifndef FREEBSD
ifndef CYGWIN32
ifndef MINGW
ifndef SDL
-ifndef NDS
ifndef DUMMY
DJGPPDOS=1
endif
@@ -227,13 +227,6 @@ endif
endif
endif
endif
-endif
-endif
-endif
-endif
-endif
-endif
-endif
#determine the interface directory (where you put all i_*.c)
i_cdmus_o=$(OBJDIR)/i_cdmus.o
@@ -251,10 +244,7 @@ else
NASM?=nasm
endif
REMOVE?=rm -f
-CP?=cp
MKDIR?=mkdir -p
-MKISOFS?=mkisofs
-DD?=dd
GZIP?=gzip
GZIP_OPTS?=-9 -f -n
GZIP_OPT2=$(GZIP_OPTS) --rsyncable
@@ -321,80 +311,11 @@ ifdef MINGW64
OBJDIR:=$(OBJDIR)/Mingw64
BIN:=$(BIN)/Mingw64
else
-ifdef WII
- INTERFACE=sdl
- NONX86=1
- STATIC=1
- PREFIX?=powerpc-eabi
- SDL=1
- SDLMAIN=1
- OBJDIR:=$(OBJDIR)/Wii
- BIN:=$(BIN)/Wii
- NOUPX=1
-else
-ifdef PS3N
- INTERFACE=sdl
- NONX86=1
- STATIC=1
- PREFIX?=ppu
- SDL=1
- # unsure?
- #SDLMAIN=1
- # can't compile SDL_mixer for ps3...
- NOMIXER=1
- OBJDIR:=$(OBJDIR)/PS3
- BIN:=$(BIN)/PS3
-else
ifdef MINGW
INTERFACE=win32
NASMFORMAT=win32
OBJDIR:=$(OBJDIR)/Mingw
BIN:=$(BIN)/Mingw
-else
-ifdef XBOX
- INTERFACE=sdl
- NASMFORMAT=win32
- PREFIX?=/usr/local/openxdk/bin/i386-pc-xbox
- SDL=1
- OBJDIR:=$(OBJDIR)/XBOX
- BIN:=$(BIN)/XBOX
-else
-ifdef PSP
- INTERFACE=sdl
- NONX86=1
- SDL=1
- OBJDIR:=$(OBJDIR)/PSP
- BIN:=$(BIN)/PSP
- NOUPX=1
-else
-ifdef DC
- INTERFACE=sdl
- NONX86=1
- SDL=1
- OBJDIR:=$(OBJDIR)/DC
- BIN:=$(BIN)/DC
- NOUPX=1
-else
-ifdef WINCE
- INTERFACE=sdl
- NONX86=1
- PREFIX?=arm-wince-pe
- SDL=1
- OBJDIR:=$(OBJDIR)/WinCE
- BIN:=$(BIN)/WinCE
-else
-ifdef NDS
- INTERFACE=nds
- OBJDIR:=$(OBJDIR)/nds
- BIN:=$(BIN)/nds
- NOUPX=1
-endif
-endif
-endif
-endif
-endif
-endif
-endif
endif
endif
endif
diff --git a/src/am_map.c b/src/am_map.c
index b28cecf11..7e012a304 100644
--- a/src/am_map.c
+++ b/src/am_map.c
@@ -44,10 +44,6 @@ static const UINT8 NOCLIMBBROWNS = (2*16);
static const UINT8 NOCLIMBYELLOWS = (11*16);
-#ifdef _NDS
-#undef BACKGROUND
-#endif
-
// Automap colors
#define BACKGROUND DBLACK
#define YOURCOLORS DWHITE
diff --git a/src/b_bot.c b/src/b_bot.c
index dc65c9c16..543bcb183 100644
--- a/src/b_bot.c
+++ b/src/b_bot.c
@@ -271,6 +271,12 @@ void B_RespawnBot(INT32 playernum)
player->powers[pw_spacetime] = sonic->player->powers[pw_spacetime];
player->powers[pw_gravityboots] = sonic->player->powers[pw_gravityboots];
player->powers[pw_nocontrol] = sonic->player->powers[pw_nocontrol];
+ player->acceleration = sonic->player->acceleration;
+ player->accelstart = sonic->player->accelstart;
+ player->thrustfactor = sonic->player->thrustfactor;
+ player->normalspeed = sonic->player->normalspeed;
+ player->pflags |= PF_AUTOBRAKE;
+ player->pflags &= ~PF_DIRECTIONCHAR;
P_TeleportMove(tails, x, y, z);
if (player->charability == CA_FLY)
diff --git a/src/blua/ldebug.c b/src/blua/ldebug.c
index 497d54980..542e209a1 100644
--- a/src/blua/ldebug.c
+++ b/src/blua/ldebug.c
@@ -412,7 +412,7 @@ static Instruction symbexec (const Proto *pt, int lastpc, int reg) {
case OP_FORLOOP:
case OP_FORPREP:
checkreg(pt, a+3);
- /* go through */
+ /* FALLTHRU */
case OP_JMP: {
int dest = pc+1+b;
/* not full check and jump is forward and do not skip `lastpc'? */
diff --git a/src/blua/llex.c b/src/blua/llex.c
index 0b328dcad..9e3dc2929 100644
--- a/src/blua/llex.c
+++ b/src/blua/llex.c
@@ -306,11 +306,12 @@ static void read_string (LexState *ls, int del, SemInfo *seminfo) {
save_and_next(ls); /* skip $ */
seminfo->ts = luaX_newstring(ls, luaZ_buffer(ls->buff) + 1,
luaZ_bufflen(ls->buff) - 2);
- ls->refstr++; /* expect '\' anytime soon */
+ ls->refstr++; /* expect '\' anytime soon */
lua_assert(ls->lookahead.token == TK_EOS);
- ls->lookahead.token = TK_CONCAT;
- return;
- }
+ ls->lookahead.token = TK_CONCAT;
+ return;
+ }
+ /* FALLTHRU */
default: {
if (!isdigit(ls->current))
save_and_next(ls); /* handles \\, \", \', and \? */
@@ -340,7 +341,8 @@ static void read_string (LexState *ls, int del, SemInfo *seminfo) {
};
switch (i) {
- case 4: save( ls, (c>>8) & 0xff ); // pass-through..
+ case 4: save( ls, (c>>8) & 0xff );
+ /* FALLTHRU */
case 2: save( ls, c&0xff );
break;
case 5:
@@ -350,7 +352,7 @@ static void read_string (LexState *ls, int del, SemInfo *seminfo) {
}
continue;
- // "\u0000".."\x10FFFF": UTF-8 encoded Unicode
+ // "\u0000".."\x10FFFF": UTF-8 encoded Unicode
//
// Note that although codes are entered like this (must have min. four digit,
// just to tease you!) the actual outcome in the string will vary between
@@ -482,20 +484,22 @@ static int llex (LexState *ls, SemInfo *seminfo) {
else if (sep == -1) return '[';
else luaX_lexerror(ls, "invalid long string delimiter", TK_STRING);
}
+ /* FALLTHRU */
case '=': {
next(ls);
if (ls->current != '=') return '=';
else { next(ls); return TK_EQ; }
}
+ /* FALLTHRU */
case '<': {
next(ls);
- if (ls->current == '<') { next(ls); return TK_SHL; }
+ if (ls->current == '<') { next(ls); return TK_SHL; }
if (ls->current != '=') return '<';
else { next(ls); return TK_LE; }
}
case '>': {
next(ls);
- if (ls->current == '>') { next(ls); return TK_SHR; }
+ if (ls->current == '>') { next(ls); return TK_SHR; }
if (ls->current != '=') return '>';
else { next(ls); return TK_GE; }
}
@@ -547,9 +551,10 @@ static int llex (LexState *ls, SemInfo *seminfo) {
}
case '\\': if (ls->refstr) {
ls->refstr--;
- ls->current = '"'; /* whacky! */
- return TK_CONCAT;
+ ls->current = '"'; /* whacky! */
+ return TK_CONCAT;
}
+ /* FALLTHRU */
default: {
if (isspace(ls->current)) {
lua_assert(!currIsNewline(ls));
diff --git a/src/blua/ltable.c b/src/blua/ltable.c
index 9f4d91ff2..0ddd9ef4f 100644
--- a/src/blua/ltable.c
+++ b/src/blua/ltable.c
@@ -478,6 +478,7 @@ static TValue *newkey (lua_State *L, Table *t, const TValue *key) {
return luaH_getnum(t, k); /* use specialized version */
/* else go through */
}
+ /* FALLTHRU */
default: {
Node *n = mainposition(t, key);
do { /* check whether `key' is somewhere in the chain */
diff --git a/src/command.c b/src/command.c
index d72f845ad..62431b664 100644
--- a/src/command.c
+++ b/src/command.c
@@ -1189,7 +1189,10 @@ finish:
CONS_Printf(M_GetText("%s set to %s\n"), var->name, var->string);
var->flags &= ~CV_SHOWMODIFONETIME;
}
- DEBFILE(va("%s set to %s\n", var->name, var->string));
+ else // display message in debug file only
+ {
+ DEBFILE(va("%s set to %s\n", var->name, var->string));
+ }
var->flags |= CV_MODIFIED;
// raise 'on change' code
#ifdef HAVE_BLUA
@@ -1233,7 +1236,7 @@ static void Got_NetVar(UINT8 **p, INT32 playernum)
if (server)
{
- XBOXSTATIC UINT8 buf[2];
+ UINT8 buf[2];
buf[0] = (UINT8)playernum;
buf[1] = KICK_MSG_CON_FAIL;
@@ -1252,9 +1255,6 @@ static void Got_NetVar(UINT8 **p, INT32 playernum)
CONS_Alert(CONS_WARNING, "Netvar not found with netid %hu\n", netid);
return;
}
-#if 0 //defined (GP2X) || defined (PSP)
- CONS_Printf("Netvar received: %s [netid=%d] value %s\n", cvar->name, netid, svalue);
-#endif
DEBFILE(va("Netvar received: %s [netid=%d] value %s\n", cvar->name, netid, svalue));
Setvalue(cvar, svalue, stealth);
@@ -1353,7 +1353,7 @@ static void CV_SetCVar(consvar_t *var, const char *value, boolean stealth)
if (var->flags & CV_NETVAR)
{
// send the value of the variable
- XBOXSTATIC UINT8 buf[128];
+ UINT8 buf[128];
UINT8 *p = buf;
if (!(server || (adminplayer == consoleplayer)))
{
diff --git a/src/console.c b/src/console.c
index fff9ba96c..3a6e4729d 100644
--- a/src/console.c
+++ b/src/console.c
@@ -12,9 +12,6 @@
#ifdef __GNUC__
#include
-#ifdef _XBOX
-#include
-#endif
#endif
#include "doomdef.h"
@@ -33,6 +30,7 @@
#include "i_system.h"
#include "d_main.h"
#include "m_menu.h"
+#include "filesrch.h"
#ifdef _WINDOWS
#include "win32/win_main.h"
@@ -328,12 +326,7 @@ static void CON_SetupColormaps(void)
// Setup the console text buffer
//
-// for WII, libogc already has a CON_Init function, we must rename it here
-#ifdef _WII
-void CON_InitWii(void)
-#else
void CON_Init(void)
-#endif
{
INT32 i;
@@ -1031,10 +1024,10 @@ boolean CON_Responder(event_t *ev)
// allow people to use keypad in console (good for typing IP addresses) - Calum
if (key >= KEY_KEYPAD7 && key <= KEY_KPADDEL)
{
- XBOXSTATIC char keypad_translation[] = {'7','8','9','-',
- '4','5','6','+',
- '1','2','3',
- '0','.'};
+ char keypad_translation[] = {'7','8','9','-',
+ '4','5','6','+',
+ '1','2','3',
+ '0','.'};
key = keypad_translation[key - KEY_KEYPAD7];
}
@@ -1170,7 +1163,7 @@ static void CON_Print(char *msg)
void CON_LogMessage(const char *msg)
{
- XBOXSTATIC char txt[8192], *t;
+ char txt[8192], *t;
const char *p = msg, *e = txt+sizeof (txt)-2;
for (t = txt; *p != '\0'; p++)
@@ -1206,15 +1199,10 @@ void CONS_Printf(const char *fmt, ...)
va_end(argptr);
// echo console prints to log file
-#ifndef _arch_dreamcast
DEBFILE(txt);
-#endif
if (!con_started)
{
-#if defined (_XBOX) && defined (__GNUC__)
- if (!keyboard_started) debugPrint(txt);
-#endif
#ifdef PC_DOS
CON_LogMessage(txt);
free(txt);
@@ -1235,7 +1223,7 @@ void CONS_Printf(const char *fmt, ...)
// if not in display loop, force screen update
if (con_startup)
{
-#if (defined (_WINDOWS)) || (defined (__OS2__) && !defined (HAVE_SDL))
+#ifdef _WINDOWS
static lumpnum_t con_backpic_lumpnum = UINT32_MAX;
patch_t *con_backpic;
@@ -1275,12 +1263,15 @@ void CONS_Alert(alerttype_t level, const char *fmt, ...)
switch (level)
{
case CONS_NOTICE:
+ // no notice for notices, hehe
CONS_Printf("\x83" "%s" "\x80 ", M_GetText("NOTICE:"));
break;
case CONS_WARNING:
+ refreshdirmenu |= REFRESHDIR_WARNING;
CONS_Printf("\x82" "%s" "\x80 ", M_GetText("WARNING:"));
break;
case CONS_ERROR:
+ refreshdirmenu |= REFRESHDIR_ERROR;
CONS_Printf("\x85" "%s" "\x80 ", M_GetText("ERROR:"));
break;
}
diff --git a/src/console.h b/src/console.h
index 8cf6483ff..1e510e89a 100644
--- a/src/console.h
+++ b/src/console.h
@@ -13,11 +13,7 @@
#include "d_event.h"
#include "command.h"
-#ifdef _WII
-void CON_InitWii(void);
-#else
void CON_Init(void);
-#endif
boolean CON_Responder(event_t *ev);
diff --git a/src/d_clisrv.c b/src/d_clisrv.c
index 4b198ba59..33f826432 100644
--- a/src/d_clisrv.c
+++ b/src/d_clisrv.c
@@ -10,9 +10,7 @@
/// \file d_clisrv.c
/// \brief SRB2 Network game communication and protocol, all OS independent parts.
-#if !defined (UNDER_CE)
#include
-#endif
#ifdef __GNUC__
#include //for unlink
#endif
@@ -50,10 +48,6 @@
#include "f_finale.h"
#endif
-#ifdef _XBOX
-#include "sdl/SRB2XBOX/xboxhelp.h"
-#endif
-
//
// NETWORKING
//
@@ -393,7 +387,7 @@ static void ExtraDataTicker(void)
{
if (server)
{
- XBOXSTATIC UINT8 buf[3];
+ UINT8 buf[3];
buf[0] = (UINT8)i;
buf[1] = KICK_MSG_CON_FAIL;
@@ -544,6 +538,7 @@ static inline void resynch_write_player(resynch_pak *rsp, const size_t i)
rsp->thokitem = (UINT32)LONG(players[i].thokitem); //mobjtype_t
rsp->spinitem = (UINT32)LONG(players[i].spinitem); //mobjtype_t
rsp->revitem = (UINT32)LONG(players[i].revitem); //mobjtype_t
+ rsp->followitem = (UINT32)LONG(players[i].followitem); //mobjtype_t
rsp->actionspd = (fixed_t)LONG(players[i].actionspd);
rsp->mindash = (fixed_t)LONG(players[i].mindash);
rsp->maxdash = (fixed_t)LONG(players[i].maxdash);
@@ -673,6 +668,7 @@ static void resynch_read_player(resynch_pak *rsp)
players[i].thokitem = (UINT32)LONG(rsp->thokitem); //mobjtype_t
players[i].spinitem = (UINT32)LONG(rsp->spinitem); //mobjtype_t
players[i].revitem = (UINT32)LONG(rsp->revitem); //mobjtype_t
+ players[i].followitem = (UINT32)LONG(rsp->followitem); //mobjtype_t
players[i].actionspd = (fixed_t)LONG(rsp->actionspd);
players[i].mindash = (fixed_t)LONG(rsp->mindash);
players[i].maxdash = (fixed_t)LONG(rsp->maxdash);
@@ -768,8 +764,16 @@ static void resynch_read_player(resynch_pak *rsp)
players[i].mo->scalespeed = LONG(rsp->scalespeed);
// And finally, SET THE MOBJ SKIN damn it.
- players[i].mo->skin = &skins[players[i].skin];
- players[i].mo->color = players[i].skincolor;
+ if ((players[i].powers[pw_carry] == CR_NIGHTSMODE) && (skins[players[i].skin].sprites[SPR2_NGT0].numframes == 0))
+ {
+ players[i].mo->skin = &skins[DEFAULTNIGHTSSKIN];
+ players[i].mo->color = skins[DEFAULTNIGHTSSKIN].prefcolor; // this will be corrected by thinker to super flash
+ }
+ else
+ {
+ players[i].mo->skin = &skins[players[i].skin];
+ players[i].mo->color = players[i].skincolor; // this will be corrected by thinker to super flash/mario star
+ }
P_SetThingPosition(players[i].mo);
}
@@ -883,6 +887,7 @@ static inline void resynch_write_others(resynchend_pak *rst)
UINT8 i;
rst->ingame = 0;
+ rst->outofcoop = 0;
for (i = 0; i < MAXPLAYERS; ++i)
{
@@ -899,6 +904,8 @@ static inline void resynch_write_others(resynchend_pak *rst)
if (!players[i].spectator)
rst->ingame |= (1<outofcoop |= (1<ctfteam[i] = (INT32)LONG(players[i].ctfteam);
rst->score[i] = (UINT32)LONG(players[i].score);
rst->numboxes[i] = SHORT(players[i].numboxes);
@@ -915,11 +922,13 @@ static inline void resynch_read_others(resynchend_pak *p)
{
UINT8 i;
UINT32 loc_ingame = (UINT32)LONG(p->ingame);
+ UINT32 loc_outofcoop = (UINT32)LONG(p->outofcoop);
for (i = 0; i < MAXPLAYERS; ++i)
{
// We don't care if they're in the game or not, just write all the data.
players[i].spectator = !(loc_ingame & (1<ctfteam[i]); // no, 0 does not mean spectator, at least not in Match
players[i].score = (UINT32)LONG(p->score[i]);
players[i].numboxes = SHORT(p->numboxes[i]);
@@ -1014,7 +1023,7 @@ static void SV_SendResynch(INT32 node)
if (resynch_score[node] > (unsigned)cv_resynchattempts.value*250)
{
- XBOXSTATIC UINT8 buf[2];
+ UINT8 buf[2];
buf[0] = (UINT8)nodetoplayer[node];
buf[1] = KICK_MSG_CON_FAIL;
SendNetXCmd(XD_KICK, &buf, 2);
@@ -1319,7 +1328,7 @@ static void SV_SendPlayerInfo(INT32 node)
netbuffer->u.playerinfo[i].skin = (UINT8)players[i].skin;
// Extra data
- netbuffer->u.playerinfo[i].data = players[i].skincolor;
+ netbuffer->u.playerinfo[i].data = 0; //players[i].skincolor;
if (players[i].pflags & PF_TAGIT)
netbuffer->u.playerinfo[i].data |= 0x20;
@@ -1490,7 +1499,7 @@ static void SV_SavedGame(void)
{
size_t length;
UINT8 *savebuffer;
- XBOXSTATIC char tmpsave[256];
+ char tmpsave[256];
if (!cv_dumpconsistency.value)
return;
@@ -1532,7 +1541,7 @@ static void CL_LoadReceivedSavegame(void)
{
UINT8 *savebuffer = NULL;
size_t length, decompressedlen;
- XBOXSTATIC char tmpsave[256];
+ char tmpsave[256];
sprintf(tmpsave, "%s" PATHSEP TMPSAVENAME, srb2home);
@@ -1890,6 +1899,7 @@ static boolean CL_ServerConnectionTicker(boolean viams, const char *tmpsave, tic
break; // exit the case
cl_mode = CL_ASKJOIN; // don't break case continue to cljoin request now
+ /* FALLTHRU */
case CL_ASKJOIN:
CL_LoadServerFiles();
@@ -1989,7 +1999,7 @@ static void CL_ConnectToServer(boolean viams)
tic_t asksent;
#endif
#ifdef JOININGAME
- XBOXSTATIC char tmpsave[256];
+ char tmpsave[256];
sprintf(tmpsave, "%s" PATHSEP TMPSAVENAME, srb2home);
#endif
@@ -2234,7 +2244,8 @@ static void Command_connect(void)
CONS_Printf(M_GetText(
"Connect (port): connect to a server\n"
"Connect ANY: connect to the first lan server found\n"
- "Connect SELF: connect to your own server.\n"));
+ //"Connect SELF: connect to your own server.\n"
+ ));
return;
}
@@ -2248,7 +2259,7 @@ static void Command_connect(void)
// we don't request a restart unless the filelist differs
server = false;
-
+/*
if (!stricmp(COM_Argv(1), "self"))
{
servernode = 0;
@@ -2257,6 +2268,7 @@ static void Command_connect(void)
//SV_SpawnServer();
}
else
+*/
{
// used in menu to connect to a server in the list
if (netgame && !stricmp(COM_Argv(1), "node"))
@@ -2280,10 +2292,13 @@ static void Command_connect(void)
if (!stricmp(COM_Argv(1), "any"))
servernode = BROADCASTADDR;
- else if (I_NetMakeNodewPort && COM_Argc() >= 3)
- servernode = I_NetMakeNodewPort(COM_Argv(1), COM_Argv(2));
else if (I_NetMakeNodewPort)
- servernode = I_NetMakeNode(COM_Argv(1));
+ {
+ if (COM_Argc() >= 3) // address AND port
+ servernode = I_NetMakeNodewPort(COM_Argv(1), COM_Argv(2));
+ else // address only, or address:port
+ servernode = I_NetMakeNode(COM_Argv(1));
+ }
else
{
CONS_Alert(CONS_ERROR, M_GetText("There is no server identification with this network driver\n"));
@@ -2535,7 +2550,7 @@ static void Command_Ban(void)
if (server || adminplayer == consoleplayer)
{
- XBOXSTATIC UINT8 buf[3 + MAX_REASONLENGTH];
+ UINT8 buf[3 + MAX_REASONLENGTH];
UINT8 *p = buf;
const SINT8 pn = nametonum(COM_Argv(1));
const INT32 node = playernode[(INT32)pn];
@@ -2601,7 +2616,7 @@ static void Command_Kick(void)
if (server || adminplayer == consoleplayer)
{
- XBOXSTATIC UINT8 buf[3 + MAX_REASONLENGTH];
+ UINT8 buf[3 + MAX_REASONLENGTH];
UINT8 *p = buf;
const SINT8 pn = nametonum(COM_Argv(1));
@@ -2650,7 +2665,7 @@ static void Command_Kick(void)
static void Got_KickCmd(UINT8 **p, INT32 playernum)
{
INT32 pnum, msg;
- XBOXSTATIC char buf[3 + MAX_REASONLENGTH];
+ char buf[3 + MAX_REASONLENGTH];
char *reason = buf;
pnum = READUINT8(*p);
@@ -3041,7 +3056,7 @@ static void Got_AddPlayer(UINT8 **p, INT32 playernum)
CONS_Alert(CONS_WARNING, M_GetText("Illegal add player command received from %s\n"), player_names[playernum]);
if (server)
{
- XBOXSTATIC UINT8 buf[2];
+ UINT8 buf[2];
buf[0] = (UINT8)playernum;
buf[1] = KICK_MSG_CON_FAIL;
@@ -3078,11 +3093,15 @@ static void Got_AddPlayer(UINT8 **p, INT32 playernum)
secondarydisplayplayer = newplayernum;
DEBFILE("spawning me\n");
// Apply player flags as soon as possible!
- players[newplayernum].pflags &= ~(PF_FLIPCAM|PF_ANALOGMODE);
+ players[newplayernum].pflags &= ~(PF_FLIPCAM|PF_ANALOGMODE|PF_DIRECTIONCHAR|PF_AUTOBRAKE);
if (cv_flipcam.value)
players[newplayernum].pflags |= PF_FLIPCAM;
if (cv_analog.value)
players[newplayernum].pflags |= PF_ANALOGMODE;
+ if (cv_directionchar.value)
+ players[newplayernum].pflags |= PF_DIRECTIONCHAR;
+ if (cv_autobrake.value)
+ players[newplayernum].pflags |= PF_AUTOBRAKE;
}
else
{
@@ -3091,11 +3110,15 @@ static void Got_AddPlayer(UINT8 **p, INT32 playernum)
if (botingame)
players[newplayernum].bot = 1;
// Same goes for player 2 when relevant
- players[newplayernum].pflags &= ~(PF_FLIPCAM|PF_ANALOGMODE);
+ players[newplayernum].pflags &= ~(PF_FLIPCAM|PF_ANALOGMODE|PF_DIRECTIONCHAR|PF_AUTOBRAKE);
if (cv_flipcam2.value)
players[newplayernum].pflags |= PF_FLIPCAM;
if (cv_analog2.value)
players[newplayernum].pflags |= PF_ANALOGMODE;
+ if (cv_directionchar2.value)
+ players[newplayernum].pflags |= PF_DIRECTIONCHAR;
+ if (cv_autobrake2.value)
+ players[newplayernum].pflags |= PF_AUTOBRAKE;
}
D_SendPlayerConfig();
addedtogame = true;
@@ -3118,7 +3141,7 @@ static void Got_AddPlayer(UINT8 **p, INT32 playernum)
static boolean SV_AddWaitingPlayers(void)
{
INT32 node, n, newplayer = false;
- XBOXSTATIC UINT8 buf[2];
+ UINT8 buf[2];
UINT8 newplayernum = 0;
// What is the reason for this? Why can't newplayernum always be 0?
@@ -3179,7 +3202,7 @@ void CL_AddSplitscreenPlayer(void)
void CL_RemoveSplitscreenPlayer(void)
{
- XBOXSTATIC UINT8 buf[2];
+ UINT8 buf[2];
if (cl_mode != CL_CONNECTED)
return;
@@ -3603,6 +3626,7 @@ static void HandlePacketFromAwayNode(SINT8 node)
// Do not remove my own server (we have just get a out of order packet)
if (node == servernode)
break;
+ /* FALLTHRU */
default:
DEBFILE(va("unknown packet received (%d) from unknown host\n",netbuffer->packettype));
@@ -3622,11 +3646,10 @@ static void HandlePacketFromAwayNode(SINT8 node)
*
*/
static void HandlePacketFromPlayer(SINT8 node)
-{FILESTAMP
- XBOXSTATIC INT32 netconsole;
- XBOXSTATIC tic_t realend, realstart;
- XBOXSTATIC UINT8 *pak, *txtpak, numtxtpak;
-FILESTAMP
+{
+ INT32 netconsole;
+ tic_t realend, realstart;
+ UINT8 *pak, *txtpak, numtxtpak;
txtpak = NULL;
@@ -3700,7 +3723,7 @@ FILESTAMP
if (netcmds[maketic%BACKUPTICS][netconsole].forwardmove > MAXPLMOVE || netcmds[maketic%BACKUPTICS][netconsole].forwardmove < -MAXPLMOVE
|| netcmds[maketic%BACKUPTICS][netconsole].sidemove > MAXPLMOVE || netcmds[maketic%BACKUPTICS][netconsole].sidemove < -MAXPLMOVE)
{
- XBOXSTATIC char buf[2];
+ char buf[2];
CONS_Alert(CONS_WARNING, M_GetText("Illegal movement value received from node %d\n"), netconsole);
//D_Clearticcmd(k);
@@ -3743,7 +3766,7 @@ FILESTAMP
}
else
{
- XBOXSTATIC UINT8 buf[3];
+ UINT8 buf[3];
buf[0] = (UINT8)netconsole;
buf[1] = KICK_MSG_CON_FAIL;
@@ -3759,6 +3782,7 @@ FILESTAMP
break;
case PT_TEXTCMD2: // splitscreen special
netconsole = nodetoplayer2[node];
+ /* FALLTHRU */
case PT_TEXTCMD:
if (client)
break;
@@ -3833,7 +3857,7 @@ FILESTAMP
nodewaiting[node] = 0;
if (netconsole != -1 && playeringame[netconsole])
{
- XBOXSTATIC UINT8 buf[2];
+ UINT8 buf[2];
buf[0] = (UINT8)netconsole;
if (netbuffer->packettype == PT_NODETIMEOUT)
buf[1] = KICK_MSG_TIMEOUT;
@@ -3861,7 +3885,7 @@ FILESTAMP
if (server)
{
- XBOXSTATIC UINT8 buf[2];
+ UINT8 buf[2];
buf[0] = (UINT8)node;
buf[1] = KICK_MSG_CON_FAIL;
SendNetXCmd(XD_KICK, &buf, 2);
@@ -3886,7 +3910,7 @@ FILESTAMP
if (server)
{
- XBOXSTATIC UINT8 buf[2];
+ UINT8 buf[2];
buf[0] = (UINT8)node;
buf[1] = KICK_MSG_CON_FAIL;
SendNetXCmd(XD_KICK, &buf, 2);
@@ -3952,7 +3976,7 @@ FILESTAMP
if (server)
{
- XBOXSTATIC char buf[2];
+ char buf[2];
buf[0] = (char)node;
buf[1] = KICK_MSG_CON_FAIL;
SendNetXCmd(XD_KICK, &buf, 2);
@@ -3972,7 +3996,7 @@ FILESTAMP
if (server)
{
- XBOXSTATIC char buf[2];
+ char buf[2];
buf[0] = (char)node;
buf[1] = KICK_MSG_CON_FAIL;
SendNetXCmd(XD_KICK, &buf, 2);
@@ -4002,7 +4026,7 @@ FILESTAMP
if (server)
{
- XBOXSTATIC UINT8 buf[2];
+ UINT8 buf[2];
buf[0] = (UINT8)node;
buf[1] = KICK_MSG_CON_FAIL;
SendNetXCmd(XD_KICK, &buf, 2);
@@ -4025,9 +4049,8 @@ FILESTAMP
*
*/
static void GetPackets(void)
-{FILESTAMP
- XBOXSTATIC SINT8 node; // The packet sender
-FILESTAMP
+{
+ SINT8 node; // The packet sender
player_joining = false;
@@ -4113,7 +4136,10 @@ static INT16 Consistancy(void)
#ifdef MOBJCONSISTANCY
if (!thinkercap.next)
+ {
+ DEBFILE(va("Consistancy = %u\n", ret));
return ret;
+ }
for (th = thinkercap.next; th != &thinkercap; th = th->next)
{
if (th->function.acp1 != (actionf_p1)P_MobjThinker)
@@ -4182,6 +4208,8 @@ static INT16 Consistancy(void)
}
#endif
+ DEBFILE(va("Consistancy = %u\n", (ret & 0xFFFF)));
+
return (INT16)(ret & 0xFFFF);
}
@@ -4522,7 +4550,7 @@ static inline void PingUpdate(void)
{
if (playeringame[i] && laggers[i])
{
- XBOXSTATIC char buf[2];
+ char buf[2];
buf[0] = (char)i;
buf[1] = KICK_MSG_PING_HIGH;
@@ -4594,9 +4622,9 @@ void NetUpdate(void)
if (server)
CL_SendClientCmd(); // send it
-FILESTAMP
+
GetPackets(); // get packet from client or from server
-FILESTAMP
+
// client send the command after a receive of the server
// the server send before because in single player is beter
diff --git a/src/d_clisrv.h b/src/d_clisrv.h
index 1ca82fdc5..bdf332665 100644
--- a/src/d_clisrv.h
+++ b/src/d_clisrv.h
@@ -136,6 +136,7 @@ typedef struct
fixed_t flagz[2];
UINT32 ingame; // Spectator bit for each player
+ UINT32 outofcoop; // outofcoop bit for each player
INT32 ctfteam[MAXPLAYERS]; // Which team? (can't be 1 bit, since in regular Match there are no teams)
// Resynch game scores and the like all at once
@@ -188,6 +189,7 @@ typedef struct
UINT32 thokitem; // mobjtype_t
UINT32 spinitem; // mobjtype_t
UINT32 revitem; // mobjtype_t
+ UINT32 followitem; // mobjtype_t
fixed_t actionspd;
fixed_t mindash;
fixed_t maxdash;
@@ -315,6 +317,7 @@ typedef struct
} ATTRPACK clientconfig_pak;
#define MAXSERVERNAME 32
+#define MAXFILENEEDED 915
// This packet is too large
typedef struct
{
@@ -336,7 +339,7 @@ typedef struct
unsigned char mapmd5[16];
UINT8 actnum;
UINT8 iszone;
- UINT8 fileneeded[915]; // is filled with writexxx (byteptr.h)
+ UINT8 fileneeded[MAXFILENEEDED]; // is filled with writexxx (byteptr.h)
} ATTRPACK serverinfo_pak;
typedef struct
diff --git a/src/d_main.c b/src/d_main.c
index 509edbeb8..e321693ee 100644
--- a/src/d_main.c
+++ b/src/d_main.c
@@ -30,16 +30,12 @@ int snprintf(char *str, size_t n, const char *fmt, ...);
//int vsnprintf(char *str, size_t n, const char *fmt, va_list ap);
#endif
-#if (defined (_WIN32) && !defined (_WIN32_WCE)) && !defined (_XBOX)
+#ifdef _WIN32
#include
#include
#endif
-#if !defined (UNDER_CE)
#include
-#elif defined (_XBOX)
-#define NO_TIME
-#endif
#include "doomdef.h"
#include "am_map.h"
@@ -74,6 +70,7 @@ int snprintf(char *str, size_t n, const char *fmt, ...);
#include "m_cond.h" // condition initialization
#include "fastcmp.h"
#include "keys.h"
+#include "filesrch.h" // refreshdirmenu, mainwadstally
#ifdef CMAKECONFIG
#include "config.h"
@@ -81,10 +78,6 @@ int snprintf(char *str, size_t n, const char *fmt, ...);
#include "config.h.in"
#endif
-#ifdef _XBOX
-#include "sdl/SRB2XBOX/xboxhelp.h"
-#endif
-
#ifdef HWRENDER
#include "hardware/hw_main.h" // 3D View Rendering
#endif
@@ -119,13 +112,8 @@ INT32 postimgparam;
postimg_t postimgtype2 = postimg_none;
INT32 postimgparam2;
-#ifdef _XBOX
-boolean nomidimusic = true, nosound = true;
-boolean nodigimusic = true;
-#else
boolean nomidimusic = false, nosound = false;
boolean nodigimusic = false; // No fmod-based music
-#endif
// These variables are only true if
// the respective sound system is initialized
@@ -139,13 +127,8 @@ boolean advancedemo;
INT32 debugload = 0;
#endif
-#ifdef _arch_dreamcast
-char srb2home[256] = "/cd";
-char srb2path[256] = "/cd";
-#else
char srb2home[256] = ".";
char srb2path[256] = ".";
-#endif
boolean usehome = true;
const char *pandf = "%s" PATHSEP "%s";
@@ -300,7 +283,7 @@ static void D_Display(void)
if (rendermode != render_none)
{
// Fade to black first
- if (gamestate != GS_LEVEL // fades to black on its own timing, always
+ if (!(gamestate == GS_LEVEL || (gamestate == GS_TITLESCREEN && titlemapinaction)) // fades to black on its own timing, always
&& wipedefs[wipedefindex] != UINT8_MAX)
{
F_WipeStartScreen();
@@ -316,6 +299,12 @@ static void D_Display(void)
// do buffered drawing
switch (gamestate)
{
+ case GS_TITLESCREEN:
+ if (!titlemapinaction) {
+ F_TitleScreenDrawer();
+ break;
+ }
+ // Intentional fall-through
case GS_LEVEL:
if (!gametic)
break;
@@ -364,10 +353,6 @@ static void D_Display(void)
HU_Drawer();
break;
- case GS_TITLESCREEN:
- F_TitleScreenDrawer();
- break;
-
case GS_WAITINGPLAYERS:
// The clientconnect drawer is independent...
case GS_DEDICATEDSERVER:
@@ -377,9 +362,10 @@ static void D_Display(void)
// clean up border stuff
// see if the border needs to be initially drawn
- if (gamestate == GS_LEVEL)
+ if (gamestate == GS_LEVEL || (gamestate == GS_TITLESCREEN && titlemapinaction))
{
// draw the view directly
+
if (!automapactive && !dedicated && cv_renderview.value)
{
if (players[displayplayer].mo || players[displayplayer].playerstate == PST_DEAD)
@@ -418,10 +404,13 @@ static void D_Display(void)
}
// Image postprocessing effect
- if (postimgtype)
- V_DoPostProcessor(0, postimgtype, postimgparam);
- if (postimgtype2)
- V_DoPostProcessor(1, postimgtype2, postimgparam2);
+ if (rendermode == render_soft)
+ {
+ if (postimgtype)
+ V_DoPostProcessor(0, postimgtype, postimgparam);
+ if (postimgtype2)
+ V_DoPostProcessor(1, postimgtype2, postimgparam2);
+ }
}
if (lastdraw)
@@ -434,9 +423,13 @@ static void D_Display(void)
lastdraw = false;
}
- ST_Drawer();
-
- HU_Drawer();
+ if (gamestate == GS_LEVEL)
+ {
+ ST_Drawer();
+ HU_Drawer();
+ }
+ else
+ F_TitleScreenDrawer();
}
// change gamma if needed
@@ -584,6 +577,8 @@ void D_SRB2Loop(void)
realtics = entertic - oldentertics;
oldentertics = entertic;
+ refreshdirmenu = 0; // not sure where to put this, here as good as any?
+
#ifdef DEBUGFILE
if (!realtics)
if (debugload)
@@ -674,6 +669,9 @@ void D_AdvanceDemo(void)
void D_StartTitle(void)
{
INT32 i;
+
+ S_StopMusic();
+
if (netgame)
{
if (gametype == GT_COOP)
@@ -709,6 +707,7 @@ void D_StartTitle(void)
botskin = 0;
cv_debug = 0;
emeralds = 0;
+ lastmaploaded = 0;
// In case someone exits out at the same time they start a time attack run,
// reset modeattacking
@@ -717,6 +716,14 @@ void D_StartTitle(void)
// empty maptol so mario/etc sounds don't play in sound test when they shouldn't
maptol = 0;
+ // reset to default player stuff
+ COM_BufAddText (va("%s \"%s\"\n",cv_playername.name,cv_defaultplayername.string));
+ COM_BufAddText (va("%s \"%s\"\n",cv_skin.name,cv_defaultskin.string));
+ COM_BufAddText (va("%s \"%s\"\n",cv_playercolor.name,cv_defaultplayercolor.string));
+ COM_BufAddText (va("%s \"%s\"\n",cv_playername2.name,cv_defaultplayername2.string));
+ COM_BufAddText (va("%s \"%s\"\n",cv_skin2.name,cv_defaultskin2.string));
+ COM_BufAddText (va("%s \"%s\"\n",cv_playercolor2.name,cv_defaultplayercolor2.string));
+
gameaction = ga_nothing;
displayplayer = consoleplayer = 0;
gametype = GT_COOP;
@@ -791,17 +798,11 @@ static void IdentifyVersion(void)
}
else
{
-#if !defined(_WIN32_WCE) && !defined(_PS3)
if (getcwd(srb2path, 256) != NULL)
srb2waddir = srb2path;
else
-#endif
{
-#ifdef _arch_dreamcast
- srb2waddir = "/cd";
-#else
srb2waddir = ".";
-#endif
}
}
@@ -856,11 +857,7 @@ static void IdentifyVersion(void)
#if !defined (HAVE_SDL) || defined (HAVE_MIXER)
{
-#if defined (DC) && 0
- const char *musicfile = "music_dc.dta";
-#else
const char *musicfile = "music.dta";
-#endif
const char *musicpath = va(pandf,srb2waddir,musicfile);
int ms = W_VerifyNMUSlumps(musicpath); // Don't forget the music!
if (ms == 1)
@@ -870,7 +867,7 @@ static void IdentifyVersion(void)
}
#endif
-#if 1 // This section can be deleted when music_new is merged with music.dta
+#ifdef DEVELOP // This section can be deleted when music_new is merged with music.dta
{
const char *musicfile = "music_new.dta";
const char *musicpath = va(pandf,srb2waddir,musicfile);
@@ -952,7 +949,7 @@ void D_SRB2Main(void)
boolean autostart = false;
// keep error messages until the final flush(stderr)
-#if !defined (PC_DOS) && !defined (_WIN32_WCE) && !defined(NOTERMIOS)
+#if !defined (PC_DOS) && !defined(NOTERMIOS)
if (setvbuf(stderr, NULL, _IOFBF, 1000))
I_OutputMsg("setvbuf didnt work\n");
#endif
@@ -974,11 +971,11 @@ void D_SRB2Main(void)
// identify the main IWAD file to use
IdentifyVersion();
-#if !defined (_WIN32_WCE) && !defined(NOTERMIOS)
+#if !defined(NOTERMIOS)
setbuf(stdout, NULL); // non-buffered output
#endif
-#if defined (_WIN32_WCE) //|| defined (_DEBUG) || defined (GP2X)
+#if 0 //defined (_DEBUG)
devparm = M_CheckParm("-nodebug") == 0;
#else
devparm = M_CheckParm("-debug") != 0;
@@ -1004,13 +1001,8 @@ void D_SRB2Main(void)
if (!userhome)
{
-#if ((defined (__unix__) && !defined (MSDOS)) || defined(__APPLE__) || defined (UNIXCOMMON)) && !defined (__CYGWIN__) && !defined (DC) && !defined (PSP) && !defined(GP2X)
+#if ((defined (__unix__) && !defined (MSDOS)) || defined(__APPLE__) || defined (UNIXCOMMON)) && !defined (__CYGWIN__)
I_Error("Please set $HOME to your home directory\n");
-#elif defined (_WIN32_WCE) && 0
- if (dedicated)
- snprintf(configfile, sizeof configfile, "/Storage Card/SRB2DEMO/d"CONFIGFILENAME);
- else
- snprintf(configfile, sizeof configfile, "/Storage Card/SRB2DEMO/"CONFIGFILENAME);
#else
if (dedicated)
snprintf(configfile, sizeof configfile, "d"CONFIGFILENAME);
@@ -1047,10 +1039,6 @@ void D_SRB2Main(void)
}
configfile[sizeof configfile - 1] = '\0';
-
-#ifdef _arch_dreamcast
- strcpy(downloaddir, "/ram"); // the dreamcast's TMP
-#endif
}
// rand() needs seeded regardless of password
@@ -1162,6 +1150,11 @@ void D_SRB2Main(void)
#ifdef USE_PATCH_DTA
++mainwads; // patch.dta adds one more
#endif
+#ifdef DEVELOP
+ ++mainwads; // music_new, too
+#endif
+
+ mainwadstally = packetsizetally;
cht_Init();
@@ -1180,12 +1173,7 @@ void D_SRB2Main(void)
HU_Init();
COM_Init();
- // libogc has a CON_Init function, we must rename SRB2's CON_Init in WII/libogc
-#ifndef _WII
CON_Init();
-#else
- CON_InitWii();
-#endif
D_RegisterServerCommands();
D_RegisterClientCommands(); // be sure that this is called before D_CheckNetGame
@@ -1325,6 +1313,19 @@ void D_SRB2Main(void)
ultimatemode = true;
}
+ // rei/miru: bootmap (Idea: starts the game on a predefined map)
+ if (bootmap && !(M_CheckParm("-warp") && M_IsNextParm()))
+ {
+ pstartmap = bootmap;
+
+ if (pstartmap < 1 || pstartmap > NUMMAPS)
+ I_Error("Cannot warp to map %d (out of range)\n", pstartmap);
+ else
+ {
+ autostart = true;
+ }
+ }
+
if (autostart || netgame || M_CheckParm("+connect") || M_CheckParm("-connect"))
{
gameaction = ga_nothing;
@@ -1400,26 +1401,19 @@ const char *D_Home(void)
#ifdef ANDROID
return "/data/data/org.srb2/";
#endif
-#ifdef _arch_dreamcast
- char VMUHOME[] = "HOME=/vmu/a1";
- putenv(VMUHOME); //don't use I_PutEnv
-#endif
if (M_CheckParm("-home") && M_IsNextParm())
userhome = M_GetNextParm();
else
{
-#if defined (GP2X)
- usehome = false; //let use the CWD
- return NULL;
-#elif !((defined (__unix__) && !defined (MSDOS)) || defined(__APPLE__) || defined (UNIXCOMMON)) && !defined (__APPLE__) && !defined(_WIN32_WCE)
+#if !((defined (__unix__) && !defined (MSDOS)) || defined(__APPLE__) || defined (UNIXCOMMON)) && !defined (__APPLE__)
if (FIL_FileOK(CONFIGFILENAME))
usehome = false; // Let's NOT use home
else
#endif
userhome = I_GetEnv("HOME"); //Alam: my new HOME for srb2
}
-#if defined (_WIN32) && !defined(_WIN32_WCE) //Alam: only Win32 have APPDATA and USERPROFILE
+#ifdef _WIN32 //Alam: only Win32 have APPDATA and USERPROFILE
if (!userhome && usehome) //Alam: Still not?
{
char *testhome = NULL;
diff --git a/src/d_net.c b/src/d_net.c
index 48c1d60ea..2c0a8a329 100644
--- a/src/d_net.c
+++ b/src/d_net.c
@@ -1030,6 +1030,7 @@ boolean HSendPacket(INT32 node, boolean reliable, UINT8 acknum, size_t packetlen
#endif
return false;
}
+ netbuffer->ack = netbuffer->ackreturn = 0; // don't hold over values from last packet sent/received
M_Memcpy(&reboundstore[rebound_head], netbuffer,
doomcom->datalength);
reboundsize[rebound_head] = doomcom->datalength;
@@ -1358,14 +1359,9 @@ boolean D_CheckNetGame(void)
netbuffer = (doomdata_t *)(void *)&doomcom->data;
#ifdef DEBUGFILE
-#ifdef _arch_dreamcast
- //debugfile = stderr;
- if (debugfile)
- CONS_Printf(M_GetText("debug output to: %s\n"), "STDERR");
-#else
if (M_CheckParm("-debugfile"))
{
- char filename[20];
+ char filename[21];
INT32 k = doomcom->consoleplayer - 1;
if (M_IsNextParm())
k = atoi(M_GetNextParm()) - 1;
@@ -1380,7 +1376,6 @@ boolean D_CheckNetGame(void)
else
CONS_Alert(CONS_WARNING, M_GetText("cannot debug output to file %s!\n"), filename);
}
-#endif
#endif
D_ClientServerInit();
diff --git a/src/d_netcmd.c b/src/d_netcmd.c
index b8f73085f..c7d384b0d 100644
--- a/src/d_netcmd.c
+++ b/src/d_netcmd.c
@@ -37,6 +37,7 @@
#include "d_main.h"
#include "m_random.h"
#include "f_finale.h"
+#include "filesrch.h"
#include "mserv.h"
#include "md5.h"
#include "z_zone.h"
@@ -60,9 +61,6 @@ static void Got_WeaponPref(UINT8 **cp, INT32 playernum);
static void Got_Mapcmd(UINT8 **cp, INT32 playernum);
static void Got_ExitLevelcmd(UINT8 **cp, INT32 playernum);
static void Got_RequestAddfilecmd(UINT8 **cp, INT32 playernum);
-#ifdef DELFILE
-static void Got_Delfilecmd(UINT8 **cp, INT32 playernum);
-#endif
static void Got_Addfilecmd(UINT8 **cp, INT32 playernum);
static void Got_Pause(UINT8 **cp, INT32 playernum);
static void Got_Suicide(UINT8 **cp, INT32 playernum);
@@ -84,6 +82,9 @@ static void TeamScramble_OnChange(void);
static void NetTimeout_OnChange(void);
static void JoinTimeout_OnChange(void);
+static void CoopStarposts_OnChange(void);
+static void CoopLives_OnChange(void);
+
static void Ringslinger_OnChange(void);
static void Gravity_OnChange(void);
static void ForceSkin_OnChange(void);
@@ -111,9 +112,6 @@ static void Command_ResetCamera_f(void);
static void Command_Addfile(void);
static void Command_ListWADS_f(void);
-#ifdef DELFILE
-static void Command_Delfile(void);
-#endif
static void Command_RunSOC(void);
static void Command_Pause(void);
static void Command_Suicide(void);
@@ -184,15 +182,14 @@ static CV_PossibleValue_t joyport_cons_t[] = {{1, "/dev/js0"}, {2, "/dev/js1"},
#define usejoystick_cons_t NULL
#endif
-static CV_PossibleValue_t autobalance_cons_t[] = {{0, "MIN"}, {4, "MAX"}, {0, NULL}};
static CV_PossibleValue_t teamscramble_cons_t[] = {{0, "Off"}, {1, "Random"}, {2, "Points"}, {0, NULL}};
static CV_PossibleValue_t startingliveslimit_cons_t[] = {{1, "MIN"}, {99, "MAX"}, {0, NULL}};
static CV_PossibleValue_t sleeping_cons_t[] = {{-1, "MIN"}, {1000/TICRATE, "MAX"}, {0, NULL}};
-static CV_PossibleValue_t competitionboxes_cons_t[] = {{0, "Normal"}, {1, "Random"}, //{2, "Teleports"},
+static CV_PossibleValue_t competitionboxes_cons_t[] = {{0, "Normal"}, {1, "Mystery"}, //{2, "Teleport"},
{3, "None"}, {0, NULL}};
-static CV_PossibleValue_t matchboxes_cons_t[] = {{0, "Normal"}, {1, "Random"}, {2, "Non-Random"},
+static CV_PossibleValue_t matchboxes_cons_t[] = {{0, "Normal"}, {1, "Mystery"}, {2, "Unchanging"},
{3, "None"}, {0, NULL}};
static CV_PossibleValue_t chances_cons_t[] = {{0, "MIN"}, {9, "MAX"}, {0, NULL}};
@@ -214,7 +211,7 @@ consvar_t cv_startinglives = {"startinglives", "3", CV_NETVAR|CV_CHEAT, starting
static CV_PossibleValue_t respawntime_cons_t[] = {{0, "MIN"}, {30, "MAX"}, {0, NULL}};
consvar_t cv_respawntime = {"respawndelay", "3", CV_NETVAR|CV_CHEAT, respawntime_cons_t, NULL, 0, NULL, NULL, 0, 0, NULL};
-consvar_t cv_competitionboxes = {"competitionboxes", "Random", CV_NETVAR|CV_CHEAT, competitionboxes_cons_t, NULL, 0, NULL, NULL, 0, 0, NULL};
+consvar_t cv_competitionboxes = {"competitionboxes", "Mystery", CV_NETVAR|CV_CHEAT, competitionboxes_cons_t, NULL, 0, NULL, NULL, 0, 0, NULL};
#ifdef SEENAMES
static CV_PossibleValue_t seenames_cons_t[] = {{0, "Off"}, {1, "Colorless"}, {2, "Team"}, {3, "Ally/Foe"}, {0, NULL}};
@@ -222,9 +219,9 @@ consvar_t cv_seenames = {"seenames", "Ally/Foe", CV_SAVE, seenames_cons_t, 0, 0,
consvar_t cv_allowseenames = {"allowseenames", "Yes", CV_NETVAR, CV_YesNo, NULL, 0, NULL, NULL, 0, 0, NULL};
#endif
-// these are just meant to be saved to the config
-consvar_t cv_playername = {"name", "Sonic", CV_SAVE|CV_CALL|CV_NOINIT, NULL, Name_OnChange, 0, NULL, NULL, 0, 0, NULL};
-consvar_t cv_playername2 = {"name2", "Tails", CV_SAVE|CV_CALL|CV_NOINIT, NULL, Name2_OnChange, 0, NULL, NULL, 0, 0, NULL};
+// names
+consvar_t cv_playername = {"name", "Sonic", CV_CALL|CV_NOINIT, NULL, Name_OnChange, 0, NULL, NULL, 0, 0, NULL};
+consvar_t cv_playername2 = {"name2", "Tails", CV_CALL|CV_NOINIT, NULL, Name2_OnChange, 0, NULL, NULL, 0, 0, NULL};
// player colors
consvar_t cv_playercolor = {"color", "Blue", CV_CALL|CV_NOINIT, Color_cons_t, Color_OnChange, 0, NULL, NULL, 0, 0, NULL};
consvar_t cv_playercolor2 = {"color2", "Orange", CV_CALL|CV_NOINIT, Color_cons_t, Color2_OnChange, 0, NULL, NULL, 0, 0, NULL};
@@ -232,6 +229,14 @@ consvar_t cv_playercolor2 = {"color2", "Orange", CV_CALL|CV_NOINIT, Color_cons_t
consvar_t cv_skin = {"skin", DEFAULTSKIN, CV_CALL|CV_NOINIT, NULL, Skin_OnChange, 0, NULL, NULL, 0, 0, NULL};
consvar_t cv_skin2 = {"skin2", DEFAULTSKIN2, CV_CALL|CV_NOINIT, NULL, Skin2_OnChange, 0, NULL, NULL, 0, 0, NULL};
+// saved versions of the above six
+consvar_t cv_defaultplayername = {"defaultname", "Sonic", CV_SAVE, NULL, NULL, 0, NULL, NULL, 0, 0, NULL};
+consvar_t cv_defaultplayername2 = {"defaultname2", "Tails", CV_SAVE, NULL, NULL, 0, NULL, NULL, 0, 0, NULL};
+consvar_t cv_defaultplayercolor = {"defaultcolor", "Blue", CV_SAVE, Color_cons_t, NULL, 0, NULL, NULL, 0, 0, NULL};
+consvar_t cv_defaultplayercolor2 = {"defaultcolor2", "Orange", CV_SAVE, Color_cons_t, NULL, 0, NULL, NULL, 0, 0, NULL};
+consvar_t cv_defaultskin = {"defaultskin", DEFAULTSKIN, CV_SAVE, NULL, NULL, 0, NULL, NULL, 0, 0, NULL};
+consvar_t cv_defaultskin2 = {"defaultskin2", DEFAULTSKIN2, CV_SAVE, NULL, NULL, 0, NULL, NULL, 0, 0, NULL};
+
consvar_t cv_skipmapcheck = {"skipmapcheck", "Off", CV_SAVE, CV_OnOff, NULL, 0, NULL, NULL, 0, 0, NULL};
INT32 cv_debug;
@@ -239,22 +244,10 @@ INT32 cv_debug;
consvar_t cv_usemouse = {"use_mouse", "On", CV_SAVE|CV_CALL,usemouse_cons_t, I_StartupMouse, 0, NULL, NULL, 0, 0, NULL};
consvar_t cv_usemouse2 = {"use_mouse2", "Off", CV_SAVE|CV_CALL,usemouse_cons_t, I_StartupMouse2, 0, NULL, NULL, 0, 0, NULL};
-#if defined (DC) || defined (_XBOX) || defined (WMINPUT) || defined (_WII) //joystick 1 and 2
-consvar_t cv_usejoystick = {"use_joystick", "1", CV_SAVE|CV_CALL, usejoystick_cons_t,
- I_InitJoystick, 0, NULL, NULL, 0, 0, NULL};
-consvar_t cv_usejoystick2 = {"use_joystick2", "2", CV_SAVE|CV_CALL, usejoystick_cons_t,
- I_InitJoystick2, 0, NULL, NULL, 0, 0, NULL};
-#elif defined (PSP) || defined (GP2X) || defined (_NDS) //only one joystick
-consvar_t cv_usejoystick = {"use_joystick", "1", CV_SAVE|CV_CALL, usejoystick_cons_t,
- I_InitJoystick, 0, NULL, NULL, 0, 0, NULL};
-consvar_t cv_usejoystick2 = {"use_joystick2", "0", CV_SAVE|CV_CALL, usejoystick_cons_t,
- I_InitJoystick2, 0, NULL, NULL, 0, 0, NULL};
-#else //all esle, no joystick
consvar_t cv_usejoystick = {"use_joystick", "0", CV_SAVE|CV_CALL, usejoystick_cons_t,
I_InitJoystick, 0, NULL, NULL, 0, 0, NULL};
consvar_t cv_usejoystick2 = {"use_joystick2", "0", CV_SAVE|CV_CALL, usejoystick_cons_t,
I_InitJoystick2, 0, NULL, NULL, 0, 0, NULL};
-#endif
#if (defined (LJOYSTICK) || defined (HAVE_SDL))
#ifdef LJOYSTICK
consvar_t cv_joyport = {"joyport", "/dev/js0", CV_SAVE, joyport_cons_t, NULL, 0, NULL, NULL, 0, 0, NULL};
@@ -302,7 +295,7 @@ consvar_t cv_countdowntime = {"countdowntime", "60", CV_NETVAR|CV_CHEAT, minitim
consvar_t cv_touchtag = {"touchtag", "Off", CV_NETVAR, CV_OnOff, NULL, 0, NULL, NULL, 0, 0, NULL};
consvar_t cv_hidetime = {"hidetime", "30", CV_NETVAR|CV_CALL, minitimelimit_cons_t, Hidetime_OnChange, 0, NULL, NULL, 0, 0, NULL};
-consvar_t cv_autobalance = {"autobalance", "0", CV_NETVAR|CV_CALL, autobalance_cons_t, AutoBalance_OnChange, 0, NULL, NULL, 0, 0, NULL};
+consvar_t cv_autobalance = {"autobalance", "Off", CV_NETVAR|CV_CALL, CV_OnOff, AutoBalance_OnChange, 0, NULL, NULL, 0, 0, NULL};
consvar_t cv_teamscramble = {"teamscramble", "Off", CV_NETVAR|CV_CALL|CV_NOINIT, teamscramble_cons_t, TeamScramble_OnChange, 0, NULL, NULL, 0, 0, NULL};
consvar_t cv_scrambleonchange = {"scrambleonchange", "Off", CV_NETVAR, teamscramble_cons_t, NULL, 0, NULL, NULL, 0, 0, NULL};
@@ -347,12 +340,18 @@ consvar_t cv_maxping = {"maxping", "0", CV_SAVE, CV_Unsigned, NULL, 0, NULL, NUL
#endif
// Intermission time Tails 04-19-2002
static CV_PossibleValue_t inttime_cons_t[] = {{0, "MIN"}, {3600, "MAX"}, {0, NULL}};
-consvar_t cv_inttime = {"inttime", "20", CV_NETVAR, inttime_cons_t, NULL, 0, NULL, NULL, 0, 0, NULL};
+consvar_t cv_inttime = {"inttime", "10", CV_NETVAR, inttime_cons_t, NULL, 0, NULL, NULL, 0, 0, NULL};
+
+static CV_PossibleValue_t coopstarposts_cons_t[] = {{0, "Per-player"}, {1, "Shared"}, {2, "Teamwork"}, {0, NULL}};
+consvar_t cv_coopstarposts = {"coopstarposts", "Teamwork", CV_NETVAR|CV_CALL|CV_CHEAT, coopstarposts_cons_t, CoopStarposts_OnChange, 0, NULL, NULL, 0, 0, NULL};
+
+static CV_PossibleValue_t cooplives_cons_t[] = {{0, "Infinite"}, {1, "Per-player"}, {2, "Avoid Game Over"}, {3, "Single pool"}, {0, NULL}};
+consvar_t cv_cooplives = {"cooplives", "Avoid Game Over", CV_NETVAR|CV_CALL|CV_CHEAT, cooplives_cons_t, CoopLives_OnChange, 0, NULL, NULL, 0, 0, NULL};
static CV_PossibleValue_t advancemap_cons_t[] = {{0, "Off"}, {1, "Next"}, {2, "Random"}, {0, NULL}};
consvar_t cv_advancemap = {"advancemap", "Next", CV_NETVAR, advancemap_cons_t, NULL, 0, NULL, NULL, 0, 0, NULL};
-static CV_PossibleValue_t playersforexit_cons_t[] = {{0, "One"}, {1, "All"}, {0, NULL}};
-consvar_t cv_playersforexit = {"playersforexit", "One", CV_NETVAR, playersforexit_cons_t, NULL, 0, NULL, NULL, 0, 0, NULL};
+static CV_PossibleValue_t playersforexit_cons_t[] = {{0, "One"}, {1, "1/4"}, {2, "Half"}, {3, "3/4"}, {4, "All"}, {0, NULL}};
+consvar_t cv_playersforexit = {"playersforexit", "All", CV_NETVAR, playersforexit_cons_t, NULL, 0, NULL, NULL, 0, 0, NULL};
consvar_t cv_runscripts = {"runscripts", "Yes", 0, CV_YesNo, NULL, 0, NULL, NULL, 0, 0, NULL};
@@ -386,7 +385,7 @@ const char *netxcmdnames[MAXNETXCMD - 1] =
"RANDOMSEED",
"RUNSOC",
"REQADDFILE",
- "DELFILE",
+ "DELFILE", // replace next time we add an XD
"SETMOTD",
"SUICIDE",
#ifdef HAVE_BLUA
@@ -422,9 +421,6 @@ void D_RegisterServerCommands(void)
RegisterNetXCmd(XD_EXITLEVEL, Got_ExitLevelcmd);
RegisterNetXCmd(XD_ADDFILE, Got_Addfilecmd);
RegisterNetXCmd(XD_REQADDFILE, Got_RequestAddfilecmd);
-#ifdef DELFILE
- RegisterNetXCmd(XD_DELFILE, Got_Delfilecmd);
-#endif
RegisterNetXCmd(XD_PAUSE, Got_Pause);
RegisterNetXCmd(XD_SUICIDE, Got_Suicide);
RegisterNetXCmd(XD_RUNSOC, Got_RunSOCcmd);
@@ -458,9 +454,6 @@ void D_RegisterServerCommands(void)
COM_AddCommand("addfile", Command_Addfile);
COM_AddCommand("listwad", Command_ListWADS_f);
-#ifdef DELFILE
- COM_AddCommand("delfile", Command_Delfile);
-#endif
COM_AddCommand("runsoc", Command_RunSOC);
COM_AddCommand("pause", Command_Pause);
COM_AddCommand("suicide", Command_Suicide);
@@ -517,6 +510,9 @@ void D_RegisterServerCommands(void)
CV_RegisterVar(&cv_forceskin);
CV_RegisterVar(&cv_downloading);
+ CV_RegisterVar(&cv_coopstarposts);
+ CV_RegisterVar(&cv_cooplives);
+
CV_RegisterVar(&cv_specialrings);
CV_RegisterVar(&cv_powerstones);
CV_RegisterVar(&cv_competitionboxes);
@@ -645,7 +641,7 @@ void D_RegisterClientCommands(void)
// register these so it is saved to config
if ((username = I_GetUserName()))
- cv_playername.defaultvalue = username;
+ cv_playername.defaultvalue = cv_defaultplayername.defaultvalue = username;
CV_RegisterVar(&cv_playername);
CV_RegisterVar(&cv_playercolor);
CV_RegisterVar(&cv_skin); // r_things.c (skin NAME)
@@ -653,6 +649,13 @@ void D_RegisterClientCommands(void)
CV_RegisterVar(&cv_playername2);
CV_RegisterVar(&cv_playercolor2);
CV_RegisterVar(&cv_skin2);
+ // saved versions of the above six
+ CV_RegisterVar(&cv_defaultplayername);
+ CV_RegisterVar(&cv_defaultplayercolor);
+ CV_RegisterVar(&cv_defaultskin);
+ CV_RegisterVar(&cv_defaultplayername2);
+ CV_RegisterVar(&cv_defaultplayercolor2);
+ CV_RegisterVar(&cv_defaultskin2);
#ifdef SEENAMES
CV_RegisterVar(&cv_seenames);
@@ -724,6 +727,14 @@ void D_RegisterClientCommands(void)
CV_RegisterVar(&cv_firenaxis);
CV_RegisterVar(&cv_firenaxis2);
+ // filesrch.c
+ CV_RegisterVar(&cv_addons_option);
+ CV_RegisterVar(&cv_addons_folder);
+ CV_RegisterVar(&cv_addons_md5);
+ CV_RegisterVar(&cv_addons_showall);
+ CV_RegisterVar(&cv_addons_search_type);
+ CV_RegisterVar(&cv_addons_search_case);
+
// WARNING: the order is important when initialising mouse2
// we need the mouse2port
CV_RegisterVar(&cv_mouse2port);
@@ -758,6 +769,12 @@ void D_RegisterClientCommands(void)
CV_RegisterVar(&cv_useranalog);
CV_RegisterVar(&cv_useranalog2);
+ // deez New User eXperiences
+ CV_RegisterVar(&cv_directionchar);
+ CV_RegisterVar(&cv_directionchar2);
+ CV_RegisterVar(&cv_autobrake);
+ CV_RegisterVar(&cv_autobrake2);
+
// s_sound.c
CV_RegisterVar(&cv_soundvolume);
CV_RegisterVar(&cv_closedcaptioning);
@@ -1025,7 +1042,7 @@ static void SetPlayerName(INT32 playernum, char *newname)
CONS_Printf(M_GetText("Player %d sent a bad name change\n"), playernum+1);
if (server && netgame)
{
- XBOXSTATIC UINT8 buf[2];
+ UINT8 buf[2];
buf[0] = (UINT8)playernum;
buf[1] = KICK_MSG_CON_FAIL;
@@ -1105,7 +1122,7 @@ static INT32 snacpending = 0, snac2pending = 0, chmappending = 0;
//
static void SendNameAndColor(void)
{
- XBOXSTATIC char buf[MAXPLAYERNAME+2];
+ char buf[MAXPLAYERNAME+2];
char *p;
p = buf;
@@ -1174,7 +1191,7 @@ static void SendNameAndColor(void)
{
CV_StealthSetValue(&cv_playercolor, skins[cv_skin.value].prefcolor);
- players[consoleplayer].skincolor = (cv_playercolor.value&0x1F) % MAXSKINCOLORS;
+ players[consoleplayer].skincolor = cv_playercolor.value % MAXSKINCOLORS;
if (players[consoleplayer].mo)
players[consoleplayer].mo->color = (UINT8)players[consoleplayer].skincolor;
@@ -1301,7 +1318,7 @@ static void SendNameAndColor2(void)
{
CV_StealthSetValue(&cv_playercolor2, skins[players[secondplaya].skin].prefcolor);
- players[secondplaya].skincolor = (cv_playercolor2.value&0x1F) % MAXSKINCOLORS;
+ players[secondplaya].skincolor = cv_playercolor2.value % MAXSKINCOLORS;
if (players[secondplaya].mo)
players[secondplaya].mo->color = players[secondplaya].skincolor;
@@ -1386,7 +1403,7 @@ static void Got_NameAndColor(UINT8 **cp, INT32 playernum)
if (kick)
{
- XBOXSTATIC UINT8 buf[2];
+ UINT8 buf[2];
CONS_Alert(CONS_WARNING, M_GetText("Illegal color change received from %s (team: %d), color: %d)\n"), player_names[playernum], p->ctfteam, p->skincolor);
buf[0] = (UINT8)playernum;
@@ -1413,25 +1430,33 @@ static void Got_NameAndColor(UINT8 **cp, INT32 playernum)
void SendWeaponPref(void)
{
- XBOXSTATIC UINT8 buf[1];
+ UINT8 buf[1];
buf[0] = 0;
if (players[consoleplayer].pflags & PF_FLIPCAM)
buf[0] |= 1;
if (players[consoleplayer].pflags & PF_ANALOGMODE)
buf[0] |= 2;
+ if (players[consoleplayer].pflags & PF_DIRECTIONCHAR)
+ buf[0] |= 4;
+ if (players[consoleplayer].pflags & PF_AUTOBRAKE)
+ buf[0] |= 8;
SendNetXCmd(XD_WEAPONPREF, buf, 1);
}
void SendWeaponPref2(void)
{
- XBOXSTATIC UINT8 buf[1];
+ UINT8 buf[1];
buf[0] = 0;
if (players[secondarydisplayplayer].pflags & PF_FLIPCAM)
buf[0] |= 1;
if (players[secondarydisplayplayer].pflags & PF_ANALOGMODE)
buf[0] |= 2;
+ if (players[secondarydisplayplayer].pflags & PF_DIRECTIONCHAR)
+ buf[0] |= 4;
+ if (players[secondarydisplayplayer].pflags & PF_AUTOBRAKE)
+ buf[0] |= 8;
SendNetXCmd2(XD_WEAPONPREF, buf, 1);
}
@@ -1439,11 +1464,15 @@ static void Got_WeaponPref(UINT8 **cp,INT32 playernum)
{
UINT8 prefs = READUINT8(*cp);
- players[playernum].pflags &= ~(PF_FLIPCAM|PF_ANALOGMODE);
+ players[playernum].pflags &= ~(PF_FLIPCAM|PF_ANALOGMODE|PF_DIRECTIONCHAR|PF_AUTOBRAKE);
if (prefs & 1)
players[playernum].pflags |= PF_FLIPCAM;
if (prefs & 2)
players[playernum].pflags |= PF_ANALOGMODE;
+ if (prefs & 4)
+ players[playernum].pflags |= PF_DIRECTIONCHAR;
+ if (prefs & 8)
+ players[playernum].pflags |= PF_AUTOBRAKE;
}
void D_SendPlayerConfig(void)
@@ -1797,7 +1826,7 @@ static void Got_Mapcmd(UINT8 **cp, INT32 playernum)
CONS_Alert(CONS_WARNING, M_GetText("Illegal map change received from %s\n"), player_names[playernum]);
if (server)
{
- XBOXSTATIC UINT8 buf[2];
+ UINT8 buf[2];
buf[0] = (UINT8)playernum;
buf[1] = KICK_MSG_CON_FAIL;
@@ -1874,7 +1903,7 @@ static void Got_Mapcmd(UINT8 **cp, INT32 playernum)
static void Command_Pause(void)
{
- XBOXSTATIC UINT8 buf[2];
+ UINT8 buf[2];
UINT8 *cp = buf;
if (COM_Argc() > 1)
@@ -1910,7 +1939,7 @@ static void Got_Pause(UINT8 **cp, INT32 playernum)
CONS_Alert(CONS_WARNING, M_GetText("Illegal pause command received from %s\n"), player_names[playernum]);
if (server)
{
- XBOXSTATIC UINT8 buf[2];
+ UINT8 buf[2];
buf[0] = (UINT8)playernum;
buf[1] = KICK_MSG_CON_FAIL;
@@ -1953,7 +1982,7 @@ static void Got_Pause(UINT8 **cp, INT32 playernum)
// Command for stuck characters in netgames, griefing, etc.
static void Command_Suicide(void)
{
- XBOXSTATIC UINT8 buf[4];
+ UINT8 buf[4];
UINT8 *cp = buf;
WRITEINT32(cp, consoleplayer);
@@ -1990,7 +2019,7 @@ static void Got_Suicide(UINT8 **cp, INT32 playernum)
CONS_Alert(CONS_WARNING, M_GetText("Illegal suicide command received from %s\n"), player_names[playernum]);
if (server)
{
- XBOXSTATIC UINT8 buf[2];
+ UINT8 buf[2];
buf[0] = (UINT8)playernum;
buf[1] = KICK_MSG_CON_FAIL;
@@ -2059,7 +2088,7 @@ static void Got_Clearscores(UINT8 **cp, INT32 playernum)
CONS_Alert(CONS_WARNING, M_GetText("Illegal clear scores command received from %s\n"), player_names[playernum]);
if (server)
{
- XBOXSTATIC UINT8 buf[2];
+ UINT8 buf[2];
buf[0] = (UINT8)playernum;
buf[1] = KICK_MSG_CON_FAIL;
@@ -2412,7 +2441,7 @@ static void Got_Teamchange(UINT8 **cp, INT32 playernum)
CONS_Alert(CONS_WARNING, M_GetText("Illegal team change received from player %s\n"), player_names[playernum]);
if (server)
{
- XBOXSTATIC UINT8 buf[2];
+ UINT8 buf[2];
buf[0] = (UINT8)playernum;
buf[1] = KICK_MSG_CON_FAIL;
@@ -2427,7 +2456,7 @@ static void Got_Teamchange(UINT8 **cp, INT32 playernum)
CONS_Alert(CONS_WARNING, M_GetText("Illegal team change received from player %s\n"), player_names[playernum]);
if (server)
{
- XBOXSTATIC UINT8 buf[2];
+ UINT8 buf[2];
buf[0] = (UINT8)playernum;
buf[1] = KICK_MSG_CON_FAIL;
@@ -2466,7 +2495,7 @@ static void Got_Teamchange(UINT8 **cp, INT32 playernum)
CONS_Alert(CONS_WARNING, M_GetText("Illegal team change received from player %s\n"), player_names[playernum]);
if (server)
{
- XBOXSTATIC UINT8 buf[2];
+ UINT8 buf[2];
buf[0] = (UINT8)playernum;
buf[1] = KICK_MSG_CON_FAIL;
@@ -2486,7 +2515,7 @@ static void Got_Teamchange(UINT8 **cp, INT32 playernum)
error = true;
break;
}
- //fall down
+ /* FALLTHRU */
case GT_TAG:
switch (NetPacket.packet.newteam)
{
@@ -2519,7 +2548,7 @@ static void Got_Teamchange(UINT8 **cp, INT32 playernum)
if (server && ((NetPacket.packet.newteam < 0 || NetPacket.packet.newteam > 3) || error))
{
- XBOXSTATIC UINT8 buf[2];
+ UINT8 buf[2];
buf[0] = (UINT8)playernum;
buf[1] = KICK_MSG_CON_FAIL;
@@ -2550,12 +2579,12 @@ static void Got_Teamchange(UINT8 **cp, INT32 playernum)
{
players[playernum].spectator = true;
players[playernum].pflags &= ~PF_TAGIT;
- players[playernum].pflags &= ~PF_TAGGED;
+ players[playernum].pflags &= ~PF_GAMETYPEOVER;
}
else if (NetPacket.packet.newteam != 3) // .newteam == 1 or 2.
{
players[playernum].spectator = false;
- players[playernum].pflags &= ~PF_TAGGED;//Just in case.
+ players[playernum].pflags &= ~PF_GAMETYPEOVER; //Just in case.
if (NetPacket.packet.newteam == 1) //Make the player IT.
players[playernum].pflags |= PF_TAGIT;
@@ -2670,7 +2699,7 @@ static void D_MD5PasswordPass(const UINT8 *buffer, size_t len, const char *salt,
(void)salt;
memset(dest, 0, 16);
#else
- XBOXSTATIC char tmpbuf[256];
+ char tmpbuf[256];
const size_t sl = strlen(salt);
if (len > 256-sl)
@@ -2725,7 +2754,7 @@ static void Command_Login_f(void)
// If we have no MD5 support then completely disable XD_LOGIN responses for security.
CONS_Alert(CONS_NOTICE, "Remote administration commands are not supported in this build.\n");
#else
- XBOXSTATIC UINT8 finalmd5[16];
+ UINT8 finalmd5[16];
const char *pw;
// If the server uses login, it will effectively just remove admin privileges
@@ -2779,7 +2808,7 @@ static void Got_Login(UINT8 **cp, INT32 playernum)
static void Command_Verify_f(void)
{
- XBOXSTATIC char buf[8]; // Should be plenty
+ char buf[8]; // Should be plenty
char *temp;
INT32 playernum;
@@ -2816,7 +2845,7 @@ static void Got_Verification(UINT8 **cp, INT32 playernum)
CONS_Alert(CONS_WARNING, M_GetText("Illegal verification received from %s (serverplayer is %s)\n"), player_names[playernum], player_names[serverplayer]);
if (server)
{
- XBOXSTATIC UINT8 buf[2];
+ UINT8 buf[2];
buf[0] = (UINT8)playernum;
buf[1] = KICK_MSG_CON_FAIL;
@@ -2896,7 +2925,7 @@ static void Got_MotD_f(UINT8 **cp, INT32 playernum)
CONS_Alert(CONS_WARNING, M_GetText("Illegal motd change received from %s\n"), player_names[playernum]);
if (server)
{
- XBOXSTATIC UINT8 buf[2];
+ UINT8 buf[2];
buf[0] = (UINT8)playernum;
buf[1] = KICK_MSG_CON_FAIL;
@@ -2917,7 +2946,7 @@ static void Got_MotD_f(UINT8 **cp, INT32 playernum)
static void Command_RunSOC(void)
{
const char *fn;
- XBOXSTATIC char buf[255];
+ char buf[255];
size_t length = 0;
if (COM_Argc() != 2)
@@ -2959,7 +2988,7 @@ static void Got_RunSOCcmd(UINT8 **cp, INT32 playernum)
CONS_Alert(CONS_WARNING, M_GetText("Illegal runsoc command received from %s\n"), player_names[playernum]);
if (server)
{
- XBOXSTATIC UINT8 buf[2];
+ UINT8 buf[2];
buf[0] = (UINT8)playernum;
buf[1] = KICK_MSG_CON_FAIL;
@@ -3002,7 +3031,7 @@ static void Got_RunSOCcmd(UINT8 **cp, INT32 playernum)
static void Command_Addfile(void)
{
const char *fn, *p;
- XBOXSTATIC char buf[256];
+ char buf[256];
char *buf_p = buf;
INT32 i;
int musiconly; // W_VerifyNMUSlumps isn't boolean
@@ -3074,42 +3103,6 @@ static void Command_Addfile(void)
SendNetXCmd(XD_ADDFILE, buf, buf_p - buf);
}
-#ifdef DELFILE
-/** removes the last added pwad at runtime.
- * Searches for sounds, maps, music and images to remove
- */
-static void Command_Delfile(void)
-{
- if (gamestate == GS_LEVEL)
- {
- CONS_Printf(M_GetText("You must NOT be in a level to use this.\n"));
- return;
- }
-
- if (netgame && !(server || adminplayer == consoleplayer))
- {
- CONS_Printf(M_GetText("Only the server or a remote admin can use this.\n"));
- return;
- }
-
- if (numwadfiles <= mainwads)
- {
- CONS_Printf(M_GetText("No additional WADs are loaded.\n"));
- return;
- }
-
- if (!(netgame || multiplayer))
- {
- P_DelWadFile();
- if (mainwads == numwadfiles && modifiedgame)
- modifiedgame = false;
- return;
- }
-
- SendNetXCmd(XD_DELFILE, NULL, 0);
-}
-#endif
-
static void Got_RequestAddfilecmd(UINT8 **cp, INT32 playernum)
{
char filename[241];
@@ -3138,7 +3131,7 @@ static void Got_RequestAddfilecmd(UINT8 **cp, INT32 playernum)
if ((playernum != serverplayer && playernum != adminplayer) || kick)
{
- XBOXSTATIC UINT8 buf[2];
+ UINT8 buf[2];
CONS_Alert(CONS_WARNING, M_GetText("Illegal addfile command received from %s\n"), player_names[playernum]);
@@ -3184,33 +3177,6 @@ static void Got_RequestAddfilecmd(UINT8 **cp, INT32 playernum)
COM_BufAddText(va("addfile %s\n", filename));
}
-#ifdef DELFILE
-static void Got_Delfilecmd(UINT8 **cp, INT32 playernum)
-{
- if (playernum != serverplayer && playernum != adminplayer)
- {
- CONS_Alert(CONS_WARNING, M_GetText("Illegal delfile command received from %s\n"), player_names[playernum]);
- if (server)
- {
- XBOXSTATIC UINT8 buf[2];
-
- buf[0] = (UINT8)playernum;
- buf[1] = KICK_MSG_CON_FAIL;
- SendNetXCmd(XD_KICK, &buf, 2);
- }
- return;
- }
- (void)cp;
-
- if (numwadfiles <= mainwads) //sanity
- return;
-
- P_DelWadFile();
- if (mainwads == numwadfiles && modifiedgame)
- modifiedgame = false;
-}
-#endif
-
static void Got_Addfilecmd(UINT8 **cp, INT32 playernum)
{
char filename[241];
@@ -3225,7 +3191,7 @@ static void Got_Addfilecmd(UINT8 **cp, INT32 playernum)
CONS_Alert(CONS_WARNING, M_GetText("Illegal addfile command received from %s\n"), player_names[playernum]);
if (server)
{
- XBOXSTATIC UINT8 buf[2];
+ UINT8 buf[2];
buf[0] = (UINT8)playernum;
buf[1] = KICK_MSG_CON_FAIL;
@@ -3411,6 +3377,102 @@ static void JoinTimeout_OnChange(void)
jointimeout = (tic_t)cv_jointimeout.value;
}
+static void CoopStarposts_OnChange(void)
+{
+ INT32 i;
+
+ if (!(netgame || multiplayer) || gametype != GT_COOP)
+ return;
+
+ switch (cv_coopstarposts.value)
+ {
+ case 0:
+ CONS_Printf(M_GetText("Starposts are now per-player.\n"));
+ break;
+ case 1:
+ CONS_Printf(M_GetText("Starposts are now shared between players.\n"));
+ break;
+ case 2:
+ CONS_Printf(M_GetText("Players now only spawn when starposts are hit.\n"));
+ return;
+ }
+
+ if (G_IsSpecialStage(gamemap))
+ return;
+
+ for (i = 0; i < MAXPLAYERS; i++)
+ {
+ if (!playeringame[i])
+ continue;
+
+ if (!players[i].spectator)
+ continue;
+
+ if (players[i].lives <= 0)
+ continue;
+
+ break;
+ }
+
+ if (i == MAXPLAYERS)
+ return;
+
+ for (i = 0; i < MAXPLAYERS; i++)
+ {
+ if (!playeringame[i])
+ continue;
+
+ if (!players[i].spectator)
+ continue;
+
+ if (players[i].lives <= 0 && (cv_cooplives.value == 1))
+ continue;
+
+ P_SpectatorJoinGame(&players[i]);
+ }
+}
+
+static void CoopLives_OnChange(void)
+{
+ INT32 i;
+
+ if (!(netgame || multiplayer) || gametype != GT_COOP)
+ return;
+
+ switch (cv_cooplives.value)
+ {
+ case 0:
+ CONS_Printf(M_GetText("Players can now respawn indefinitely.\n"));
+ return;
+ case 1:
+ CONS_Printf(M_GetText("Lives are now per-player.\n"));
+ return;
+ case 2:
+ CONS_Printf(M_GetText("Players can now steal lives to avoid game over.\n"));
+ break;
+ case 3:
+ CONS_Printf(M_GetText("Lives are now shared between players.\n"));
+ break;
+ }
+
+ if (cv_coopstarposts.value == 2)
+ return;
+
+ for (i = 0; i < MAXPLAYERS; i++)
+ {
+ if (!playeringame[i])
+ continue;
+
+ if (!players[i].spectator)
+ continue;
+
+ if (players[i].lives > 0)
+ continue;
+
+ P_SpectatorJoinGame(&players[i]);
+ }
+}
+
UINT32 timelimitintics = 0;
/** Deals with a timelimit change by printing the change to the console.
@@ -3699,7 +3761,7 @@ retryscramble:
{
if (red == maxcomposition)
newteam = 2;
- else if (blue == maxcomposition)
+ else //if (blue == maxcomposition)
newteam = 1;
repick = false;
@@ -3740,14 +3802,11 @@ retryscramble:
newteam = (INT16)((M_RandomByte() % 2) + 1);
repick = false;
}
- else
+ else if (i != 2) // Mystic's secret sauce - ABBA is better than ABAB, so team B doesn't get worse players all around
{
// We will only randomly pick the team for the first guy.
// Otherwise, just alternate back and forth, distributing players.
- if (newteam == 1)
- newteam = 2;
- else
- newteam = 1;
+ newteam = 3 - newteam;
}
scrambleteams[i] = newteam;
@@ -3846,7 +3905,7 @@ static void Got_ExitLevelcmd(UINT8 **cp, INT32 playernum)
CONS_Alert(CONS_WARNING, M_GetText("Illegal exitlevel command received from %s\n"), player_names[playernum]);
if (server)
{
- XBOXSTATIC UINT8 buf[2];
+ UINT8 buf[2];
buf[0] = (UINT8)playernum;
buf[1] = KICK_MSG_CON_FAIL;
diff --git a/src/d_netcmd.h b/src/d_netcmd.h
index 80481c6a5..57e23b0f1 100644
--- a/src/d_netcmd.h
+++ b/src/d_netcmd.h
@@ -25,6 +25,13 @@ extern consvar_t cv_skin;
extern consvar_t cv_playername2;
extern consvar_t cv_playercolor2;
extern consvar_t cv_skin2;
+// saved versions of the above six
+extern consvar_t cv_defaultplayername;
+extern consvar_t cv_defaultplayercolor;
+extern consvar_t cv_defaultskin;
+extern consvar_t cv_defaultplayername2;
+extern consvar_t cv_defaultplayercolor2;
+extern consvar_t cv_defaultskin2;
#ifdef SEENAMES
extern consvar_t cv_seenames, cv_allowseenames;
@@ -89,7 +96,7 @@ extern consvar_t cv_recycler;
extern consvar_t cv_itemfinder;
-extern consvar_t cv_inttime, cv_advancemap, cv_playersforexit;
+extern consvar_t cv_inttime, cv_coopstarposts, cv_cooplives, cv_advancemap, cv_playersforexit;
extern consvar_t cv_overtime;
extern consvar_t cv_startinglives;
@@ -129,7 +136,7 @@ typedef enum
XD_RANDOMSEED, // 15
XD_RUNSOC, // 16
XD_REQADDFILE, // 17
- XD_DELFILE, // 18
+ XD_DELFILE, // 18 - replace next time we add an XD
XD_SETMOTD, // 19
XD_SUICIDE, // 20
#ifdef HAVE_BLUA
diff --git a/src/d_netfil.c b/src/d_netfil.c
index 172624ad2..bf94e0ca7 100644
--- a/src/d_netfil.c
+++ b/src/d_netfil.c
@@ -11,21 +11,14 @@
/// \brief Transfer a file using HSendPacket.
#include
-#ifndef _WIN32_WCE
-#ifdef __OS2__
-#include
-#endif // __OS2__
#include
-#endif
-#if !defined (UNDER_CE)
#include
-#endif
-#if ((defined (_WIN32) && !defined (_WIN32_WCE)) || defined (__DJGPP__)) && !defined (_XBOX)
+#if defined (_WIN32) || defined (__DJGPP__)
#include
#include
-#elif !defined (_WIN32_WCE) && !(defined (_XBOX) && !defined (__GNUC__))
+#else
#include
#include
#include
@@ -34,7 +27,7 @@
#ifdef __GNUC__
#include
#include
-#elif defined (_WIN32) && !defined (_WIN32_WCE)
+#elif defined (_WIN32)
#include
#endif
#ifdef __DJGPP__
@@ -104,6 +97,7 @@ INT32 lastfilenum = -1;
/** Fills a serverinfo packet with information about wad files loaded.
*
* \todo Give this function a better name since it is in global scope.
+ * Used to have size limiting built in - now handled via W_LoadWadFile in w_wad.c
*
*/
UINT8 *PutFileNeeded(void)
@@ -112,29 +106,22 @@ UINT8 *PutFileNeeded(void)
UINT8 *p = netbuffer->u.serverinfo.fileneeded;
char wadfilename[MAX_WADPATH] = "";
UINT8 filestatus;
- size_t bytesused = 0;
for (i = 0; i < numwadfiles; i++)
{
- // If it has only music/sound lumps, mark it as unimportant
- if (W_VerifyNMUSlumps(wadfiles[i]->filename))
- filestatus = 0;
- else
- filestatus = 1; // Important
+ // If it has only music/sound lumps, don't put it in the list
+ if (!wadfiles[i]->important)
+ continue;
+
+ filestatus = 1; // Importance - not really used any more, holds 1 by default for backwards compat with MS
// Store in the upper four bits
if (!cv_downloading.value)
filestatus += (2 << 4); // Won't send
- else if ((wadfiles[i]->filesize > (UINT32)cv_maxsend.value * 1024))
- filestatus += (0 << 4); // Won't send
- else
+ else if ((wadfiles[i]->filesize <= (UINT32)cv_maxsend.value * 1024))
filestatus += (1 << 4); // Will send if requested
-
- bytesused += (nameonlylength(wadfilename) + 22);
-
- // Don't write too far...
- if (bytesused > sizeof(netbuffer->u.serverinfo.fileneeded))
- I_Error("Too many wad files added to host a game. (%s, stopped on %s)\n", sizeu1(bytesused), wadfilename);
+ // else
+ // filestatus += (0 << 4); -- Won't send, too big
WRITEUINT8(p, filestatus);
@@ -167,7 +154,6 @@ void D_ParseFileneeded(INT32 fileneedednum_parm, UINT8 *fileneededstr)
{
fileneeded[i].status = FS_NOTFOUND; // We haven't even started looking for the file yet
filestatus = READUINT8(p); // The first byte is the file status
- fileneeded[i].important = (UINT8)(filestatus & 3);
fileneeded[i].willsend = (UINT8)(filestatus >> 4);
fileneeded[i].totalsize = READUINT32(p); // The four next bytes are the file size
fileneeded[i].file = NULL; // The file isn't open yet
@@ -197,7 +183,7 @@ boolean CL_CheckDownloadable(void)
UINT8 i,dlstatus = 0;
for (i = 0; i < fileneedednum; i++)
- if (fileneeded[i].status != FS_FOUND && fileneeded[i].status != FS_OPEN && fileneeded[i].important)
+ if (fileneeded[i].status != FS_FOUND && fileneeded[i].status != FS_OPEN)
{
if (fileneeded[i].willsend == 1)
continue;
@@ -218,7 +204,7 @@ boolean CL_CheckDownloadable(void)
// not downloadable, put reason in console
CONS_Alert(CONS_NOTICE, M_GetText("You need additional files to connect to this server:\n"));
for (i = 0; i < fileneedednum; i++)
- if (fileneeded[i].status != FS_FOUND && fileneeded[i].status != FS_OPEN && fileneeded[i].important)
+ if (fileneeded[i].status != FS_FOUND && fileneeded[i].status != FS_OPEN)
{
CONS_Printf(" * \"%s\" (%dK)", fileneeded[i].filename, fileneeded[i].totalsize >> 10);
@@ -271,7 +257,7 @@ boolean CL_SendRequestFile(void)
for (i = 0; i < fileneedednum; i++)
if (fileneeded[i].status != FS_FOUND && fileneeded[i].status != FS_OPEN
- && fileneeded[i].important && (fileneeded[i].willsend == 0 || fileneeded[i].willsend == 2))
+ && (fileneeded[i].willsend == 0 || fileneeded[i].willsend == 2))
{
I_Error("Attempted to download files that were not sendable");
}
@@ -280,8 +266,7 @@ boolean CL_SendRequestFile(void)
netbuffer->packettype = PT_REQUESTFILE;
p = (char *)netbuffer->u.textcmd;
for (i = 0; i < fileneedednum; i++)
- if ((fileneeded[i].status == FS_NOTFOUND || fileneeded[i].status == FS_MD5SUMBAD)
- && fileneeded[i].important)
+ if ((fileneeded[i].status == FS_NOTFOUND || fileneeded[i].status == FS_MD5SUMBAD))
{
totalfreespaceneeded += fileneeded[i].totalsize;
nameonly(fileneeded[i].filename);
@@ -360,15 +345,9 @@ INT32 CL_CheckFiles(void)
CONS_Debug(DBG_NETPLAY, "game is modified; only doing basic checks\n");
for (i = 1, j = 1; i < fileneedednum || j < numwadfiles;)
{
- if (i < fileneedednum && !fileneeded[i].important)
+ if (j < numwadfiles && !wadfiles[j]->important)
{
- // Eh whatever, don't care
- ++i;
- continue;
- }
- if (j < numwadfiles && W_VerifyNMUSlumps(wadfiles[j]->filename))
- {
- // Unimportant on our side. still don't care.
+ // Unimportant on our side.
++j;
continue;
}
@@ -411,7 +390,7 @@ INT32 CL_CheckFiles(void)
break;
}
}
- if (fileneeded[i].status != FS_NOTFOUND || !fileneeded[i].important)
+ if (fileneeded[i].status != FS_NOTFOUND)
continue;
packetsize += nameonlylength(fileneeded[i].filename) + 22;
@@ -449,27 +428,8 @@ void CL_LoadServerFiles(void)
fileneeded[i].status = FS_OPEN;
}
else if (fileneeded[i].status == FS_MD5SUMBAD)
- {
- // If the file is marked important, don't even bother proceeding.
- if (fileneeded[i].important)
- I_Error("Wrong version of important file %s", fileneeded[i].filename);
-
- // If it isn't, no need to worry the user with a console message,
- // although it can't hurt to put something in the debug file.
-
- // ...but wait a second. What if the local version is "important"?
- if (!W_VerifyNMUSlumps(fileneeded[i].filename))
- I_Error("File %s should only contain music and sound effects!",
- fileneeded[i].filename);
-
- // Okay, NOW we know it's safe. Whew.
- P_AddWadFile(fileneeded[i].filename, NULL);
- if (fileneeded[i].important)
- G_SetGameModified(true);
- fileneeded[i].status = FS_OPEN;
- DEBFILE(va("File %s found but with different md5sum\n", fileneeded[i].filename));
- }
- else if (fileneeded[i].important)
+ I_Error("Wrong version of file %s", fileneeded[i].filename);
+ else
{
const char *s;
switch(fileneeded[i].status)
@@ -965,7 +925,7 @@ size_t nameonlylength(const char *s)
filestatus_t checkfilemd5(char *filename, const UINT8 *wantedmd5sum)
{
-#if defined (NOMD5) || defined (_arch_dreamcast)
+#if defined (NOMD5)
(void)wantedmd5sum;
(void)filename;
#else
@@ -1000,9 +960,5 @@ filestatus_t findfile(char *filename, const UINT8 *wantedmd5sum, boolean complet
if (homecheck == FS_FOUND)
return filesearch(filename, srb2path, wantedmd5sum, completepath, 10);
-#ifdef _arch_dreamcast
- return filesearch(filename, "/cd", wantedmd5sum, completepath, 10);
-#else
return filesearch(filename, ".", wantedmd5sum, completepath, 10);
-#endif
}
diff --git a/src/d_netfil.h b/src/d_netfil.h
index b9b7b2f2e..6fdd0a8a1 100644
--- a/src/d_netfil.h
+++ b/src/d_netfil.h
@@ -35,7 +35,6 @@ typedef enum
typedef struct
{
- UINT8 important;
UINT8 willsend; // Is the server willing to send it?
char filename[MAX_WADPATH];
UINT8 md5sum[16];
diff --git a/src/d_player.h b/src/d_player.h
index 4e4a53a08..e1350fe67 100644
--- a/src/d_player.h
+++ b/src/d_player.h
@@ -98,66 +98,58 @@ typedef enum
//
typedef enum
{
- // Flip camera angle with gravity flip prefrence.
- PF_FLIPCAM = 1,
+ // Cvars
+ PF_FLIPCAM = 1, // Flip camera angle with gravity flip prefrence.
+ PF_ANALOGMODE = 1<<1, // Analog mode?
+ PF_DIRECTIONCHAR = 1<<2, // Directional character sprites?
+ PF_AUTOBRAKE = 1<<3, // Autobrake?
// Cheats
- PF_GODMODE = 1<<1,
- PF_NOCLIP = 1<<2,
- PF_INVIS = 1<<3,
+ PF_GODMODE = 1<<4,
+ PF_NOCLIP = 1<<5,
+ PF_INVIS = 1<<6,
// True if button down last tic.
- PF_ATTACKDOWN = 1<<4,
- PF_USEDOWN = 1<<5,
- PF_JUMPDOWN = 1<<6,
- PF_WPNDOWN = 1<<7,
+ PF_ATTACKDOWN = 1<<7,
+ PF_USEDOWN = 1<<8,
+ PF_JUMPDOWN = 1<<9,
+ PF_WPNDOWN = 1<<10,
// Unmoving states
- PF_STASIS = 1<<8, // Player is not allowed to move
- PF_JUMPSTASIS = 1<<9, // and that includes jumping.
+ PF_STASIS = 1<<11, // Player is not allowed to move
+ PF_JUMPSTASIS = 1<<12, // and that includes jumping.
PF_FULLSTASIS = PF_STASIS|PF_JUMPSTASIS,
- // Did you get a time-over?
- PF_TIMEOVER = 1<<10,
+ // Applying autobrake?
+ PF_APPLYAUTOBRAKE = 1<<13,
// Character action status
- PF_STARTJUMP = 1<<11,
- PF_JUMPED = 1<<12,
- PF_SPINNING = 1<<13,
- PF_STARTDASH = 1<<14,
- PF_THOKKED = 1<<15,
+ PF_STARTJUMP = 1<<14,
+ PF_JUMPED = 1<<15,
+ PF_NOJUMPDAMAGE = 1<<16,
- // Are you gliding?
- PF_GLIDING = 1<<16,
+ PF_SPINNING = 1<<17,
+ PF_STARTDASH = 1<<18,
+
+ PF_THOKKED = 1<<19,
+ PF_SHIELDABILITY = 1<<20,
+ PF_GLIDING = 1<<21,
+ PF_BOUNCING = 1<<22,
// Sliding (usually in water) like Labyrinth/Oil Ocean
- PF_SLIDING = 1<<17,
+ PF_SLIDING = 1<<23,
- // Bouncing
- PF_BOUNCING = 1<<18,
+ // NiGHTS stuff
+ PF_TRANSFERTOCLOSEST = 1<<24,
+ PF_DRILLING = 1<<25,
- /*** NIGHTS STUFF ***/
- PF_TRANSFERTOCLOSEST = 1<<19,
- PF_NIGHTSFALL = 1<<20,
- PF_DRILLING = 1<<21,
- PF_SKIDDOWN = 1<<22,
-
- /*** TAG STUFF ***/
- PF_TAGGED = 1<<23, // Player has been tagged and awaits the next round in hide and seek.
- PF_TAGIT = 1<<24, // The player is it! For Tag Mode
+ // Gametype-specific stuff
+ PF_GAMETYPEOVER = 1<<26, // Race time over, or H&S out-of-game
+ PF_TAGIT = 1<<27, // The player is it! For Tag Mode
/*** misc ***/
- PF_FORCESTRAFE = 1<<25, // Turning inputs are translated into strafing inputs
- PF_ANALOGMODE = 1<<26, // Analog mode?
-
- // Can carry another player?
- PF_CANCARRY = 1<<27,
-
- // Used shield ability
- PF_SHIELDABILITY = 1<<28,
-
- // Jump damage?
- PF_NOJUMPDAMAGE = 1<<29,
+ PF_FORCESTRAFE = 1<<28, // Turning inputs are translated into strafing inputs
+ PF_CANCARRY = 1<<29, // Can carry another player?
// up to 1<<31 is free
} pflags_t;
@@ -181,6 +173,14 @@ typedef enum
PA_RIDE
} panim_t;
+//
+// All of the base srb2 shields are either a single constant,
+// or use damagetype-protecting flags applied to a constant,
+// or are the force shield (which does everything weirdly).
+//
+// Base flags by themselves aren't used so modders can make
+// abstract, ability-less shields should they so choose.
+//
typedef enum
{
SH_NONE = 0,
@@ -189,19 +189,21 @@ typedef enum
SH_PROTECTFIRE = 0x400,
SH_PROTECTWATER = 0x800,
SH_PROTECTELECTRIC = 0x1000,
+ SH_PROTECTSPIKE = 0x2000, // cactus shield one day? thanks, subarashii
+ //SH_PROTECTNUKE = 0x4000, // intentionally no hardcoded defense against nukes
// Indivisible shields
SH_PITY = 1, // the world's most basic shield ever, given to players who suck at Match
SH_WHIRLWIND,
SH_ARMAGEDDON,
- // normal shields that use flags
- SH_ATTRACT = SH_PROTECTELECTRIC,
- SH_ELEMENTAL = SH_PROTECTFIRE|SH_PROTECTWATER,
+ // Normal shields that use flags
+ SH_ATTRACT = SH_PITY|SH_PROTECTELECTRIC,
+ SH_ELEMENTAL = SH_PITY|SH_PROTECTFIRE|SH_PROTECTWATER,
// Sonic 3 shields
- SH_FLAMEAURA = SH_PROTECTFIRE,
- SH_BUBBLEWRAP = SH_PROTECTWATER,
+ SH_FLAMEAURA = SH_PITY|SH_PROTECTFIRE,
+ SH_BUBBLEWRAP = SH_PITY|SH_PROTECTWATER,
SH_THUNDERCOIN = SH_WHIRLWIND|SH_PROTECTELECTRIC,
// The force shield uses the lower 8 bits to count how many extra hits are left.
@@ -224,6 +226,7 @@ typedef enum
CR_PLAYER,
// NiGHTS mode. Not technically a CARRYING, but doesn't stack with any of the others, so might as well go here.
CR_NIGHTSMODE,
+ CR_NIGHTSFALL,
// Old Brak sucks hard, but this gimmick could be used for something better, so we might as well continue supporting it.
CR_BRAKGOOP,
// Specific level gimmicks.
@@ -244,6 +247,7 @@ typedef enum
pw_underwater, // underwater timer
pw_spacetime, // In space, no one can hear you spin!
pw_extralife, // Extra Life timer
+ pw_pushing,
pw_super, // Are you super?
pw_gravityboots, // gravity boots
@@ -316,6 +320,9 @@ typedef struct player_s
// It is updated with cmd->aiming.
angle_t aiming;
+ // fun thing for player sprite
+ angle_t drawangle;
+
// player's ring count
INT32 rings;
@@ -362,6 +369,8 @@ typedef struct player_s
mobjtype_t thokitem; // Object # to spawn for the thok
mobjtype_t spinitem; // Object # to spawn for spindash/spinning
mobjtype_t revitem; // Object # to spawn for spindash/spinning
+ mobjtype_t followitem; // Object # to spawn for Smiles
+ mobj_t *followmobj; // Smiles all around
fixed_t actionspd; // Speed of thok/glide/fly
fixed_t mindash; // Minimum spindash speed
@@ -471,6 +480,7 @@ typedef struct player_s
angle_t awayviewaiming; // Used for cut-away view
boolean spectator;
+ boolean outofcoop;
UINT8 bot;
tic_t jointime; // Timer when player joins game to change skin/color
diff --git a/src/dehacked.c b/src/dehacked.c
index 1279d7bd0..774257d4d 100644
--- a/src/dehacked.c
+++ b/src/dehacked.c
@@ -11,6 +11,7 @@
/// \brief Load dehacked file and change tables and text
#include "doomdef.h"
+#include "d_main.h" // for srb2home
#include "g_game.h"
#include "sounds.h"
#include "info.h"
@@ -64,6 +65,7 @@ memset(used_spr,0,sizeof(UINT8) * ((NUMSPRITEFREESLOTS / 8) + 1));\
static mobjtype_t get_mobjtype(const char *word);
static statenum_t get_state(const char *word);
static spritenum_t get_sprite(const char *word);
+static playersprite_t get_sprite2(const char *word);
static sfxenum_t get_sfx(const char *word);
#ifdef MUSICSLOT_COMPATIBILITY
static UINT16 get_mus(const char *word, UINT8 dehacked_mode);
@@ -77,97 +79,8 @@ boolean deh_loaded = false;
static int dbg_line;
static boolean gamedataadded = false;
-
-#ifdef DELFILE
-typedef struct undehacked_s
-{
- char *undata;
- struct undehacked_s *next;
-} undehacked_t;
-
-static UINT16 unsocwad;
-static undehacked_t *unsocdata[MAX_WADFILES];
-static boolean disableundo = false;
-
-void DEH_WriteUndoline(const char *value, const char *data, undotype_f flags)
-{
- const char *eqstr = " = ";
- const char *space = " ";
- const char *pader = eqstr;
- undehacked_t *newdata;
-
- if (disableundo || !unsocwad)
- return;
-
- if ((newdata = malloc(sizeof(*newdata))) == NULL)
- I_Error("Out of memory for unsoc line");
-
- if (flags & UNDO_SPACE)
- pader = space;
-
- if (flags & UNDO_ENDTEXT && !data)
- data = space;
-
- if (value)
- {
- const size_t plen = strlen(pader);
- const char *pound = "#";
- char *undata = NULL;
- const size_t elen = strlen(pound);
- size_t vlen = strlen(value), dlen = 0, len = 1;
-
- if (*(value+vlen-1) == '\n')
- vlen--; // lnet not copy the ending \n
-
- if (flags & UNDO_ENDTEXT)
- len += elen; // let malloc more space
-
- if (flags & UNDO_NEWLINE)
- len++; // more space for the beginning \n
-
- if (data)
- {
- dlen = strlen(data);
- if (flags & UNDO_CUTLINE && *(data+dlen-1) == '\n')
- dlen--; // let not copy the ending \n
- newdata->undata = malloc(vlen+plen+dlen+len);
- newdata->undata[vlen+plen+dlen+len-1] = '\0';
- }
- else
- {
- newdata->undata = malloc(vlen+len);
- newdata->undata[vlen+len-1] = '\0';
- }
-
- if (newdata->undata)
- {
- undata = newdata->undata;
- *undata = '\0';
- }
- else
- {
- free(newdata);
- I_Error("Out of memory for unsoc data");
- }
-
- if (flags & UNDO_NEWLINE) // let start with \n
- strcat(undata, "\n");
-
- strncat(undata, value, vlen);
-
- if (data) // value+pader+data
- strncat(strncat(undata, pader, plen), data, dlen);
-
- if (flags & UNDO_ENDTEXT) // let end the text
- strncat(undata, pound, elen);
- }
- else
- newdata->undata = NULL;
-
- newdata->next = unsocdata[unsocwad];
- unsocdata[unsocwad] = newdata;
-}
-#endif
+static boolean titlechanged = false;
+static boolean introchanged = false;
ATTRINLINE static FUNCINLINE char myfget_color(MYFILE *f)
{
@@ -408,8 +321,6 @@ static void readPlayer(MYFILE *f, INT32 num)
INT32 i;
boolean slotfound = false;
- DEH_WriteUndoline("PLAYERTEXT", description[num].notes, UNDO_ENDTEXT);
-
do
{
if (myfgets(s, MAXLINELEN, f))
@@ -478,7 +389,6 @@ static void readPlayer(MYFILE *f, INT32 num)
{
if (!slotfound && (slotfound = findFreeSlot(&num)) == false)
goto done;
- DEH_WriteUndoline(word, &description[num].picname[0], UNDO_NONE);
strncpy(description[num].picname, word2, 8);
}
@@ -493,7 +403,7 @@ static void readPlayer(MYFILE *f, INT32 num)
*/
if (i && !slotfound && (slotfound = findFreeSlot(&num)) == false)
goto done;
- DEH_WriteUndoline(word, va("%d", description[num].used), UNDO_NONE);
+
description[num].used = (!!i);
}
else if (fastcmp(word, "SKINNAME"))
@@ -501,7 +411,6 @@ static void readPlayer(MYFILE *f, INT32 num)
// Send to free slot.
if (!slotfound && (slotfound = findFreeSlot(&num)) == false)
goto done;
- DEH_WriteUndoline(word, description[num].skinname, UNDO_NONE);
strlcpy(description[num].skinname, word2, sizeof description[num].skinname);
strlwr(description[num].skinname);
@@ -511,11 +420,6 @@ static void readPlayer(MYFILE *f, INT32 num)
}
} while (!myfeof(f)); // finish when the line is empty
-#ifdef DELFILE
- if (slotfound)
- DEH_WriteUndoline("MENUPOSITION", va("%d", num), UNDO_NONE);
-#endif
-
done:
Z_Free(s);
}
@@ -653,122 +557,98 @@ static void readthing(MYFILE *f, INT32 num)
if (fastcmp(word, "MAPTHINGNUM") || fastcmp(word, "DOOMEDNUM"))
{
- DEH_WriteUndoline(word, va("%d", mobjinfo[num].doomednum), UNDO_NONE);
mobjinfo[num].doomednum = (INT32)atoi(word2);
}
else if (fastcmp(word, "SPAWNSTATE"))
{
- DEH_WriteUndoline(word, va("%d", mobjinfo[num].spawnstate), UNDO_NONE);
mobjinfo[num].spawnstate = get_number(word2);
}
else if (fastcmp(word, "SPAWNHEALTH"))
{
- DEH_WriteUndoline(word, va("%d", mobjinfo[num].spawnhealth), UNDO_NONE);
mobjinfo[num].spawnhealth = (INT32)get_number(word2);
}
else if (fastcmp(word, "SEESTATE"))
{
- DEH_WriteUndoline(word, va("%d", mobjinfo[num].seestate), UNDO_NONE);
mobjinfo[num].seestate = get_number(word2);
}
else if (fastcmp(word, "SEESOUND"))
{
- DEH_WriteUndoline(word, va("%d", mobjinfo[num].seesound), UNDO_NONE);
mobjinfo[num].seesound = get_number(word2);
}
else if (fastcmp(word, "REACTIONTIME"))
{
- DEH_WriteUndoline(word, va("%d", mobjinfo[num].reactiontime), UNDO_NONE);
mobjinfo[num].reactiontime = (INT32)get_number(word2);
}
else if (fastcmp(word, "ATTACKSOUND"))
{
- DEH_WriteUndoline(word, va("%d", mobjinfo[num].attacksound), UNDO_NONE);
mobjinfo[num].attacksound = get_number(word2);
}
else if (fastcmp(word, "PAINSTATE"))
{
- DEH_WriteUndoline(word, va("%d", mobjinfo[num].painstate), UNDO_NONE);
mobjinfo[num].painstate = get_number(word2);
}
else if (fastcmp(word, "PAINCHANCE"))
{
- DEH_WriteUndoline(word, va("%d", mobjinfo[num].painchance), UNDO_NONE);
mobjinfo[num].painchance = (INT32)get_number(word2);
}
else if (fastcmp(word, "PAINSOUND"))
{
- DEH_WriteUndoline(word, va("%d", mobjinfo[num].painsound), UNDO_NONE);
mobjinfo[num].painsound = get_number(word2);
}
else if (fastcmp(word, "MELEESTATE"))
{
- DEH_WriteUndoline(word, va("%d", mobjinfo[num].meleestate), UNDO_NONE);
mobjinfo[num].meleestate = get_number(word2);
}
else if (fastcmp(word, "MISSILESTATE"))
{
- DEH_WriteUndoline(word, va("%d", mobjinfo[num].missilestate), UNDO_NONE);
mobjinfo[num].missilestate = get_number(word2);
}
else if (fastcmp(word, "DEATHSTATE"))
{
- DEH_WriteUndoline(word, va("%d", mobjinfo[num].deathstate), UNDO_NONE);
mobjinfo[num].deathstate = get_number(word2);
}
else if (fastcmp(word, "DEATHSOUND"))
{
- DEH_WriteUndoline(word, va("%d", mobjinfo[num].deathsound), UNDO_NONE);
mobjinfo[num].deathsound = get_number(word2);
}
else if (fastcmp(word, "XDEATHSTATE"))
{
- DEH_WriteUndoline(word, va("%d", mobjinfo[num].xdeathstate), UNDO_NONE);
mobjinfo[num].xdeathstate = get_number(word2);
}
else if (fastcmp(word, "SPEED"))
{
- DEH_WriteUndoline(word, va("%d", mobjinfo[num].speed), UNDO_NONE);
mobjinfo[num].speed = get_number(word2);
}
else if (fastcmp(word, "RADIUS"))
{
- DEH_WriteUndoline(word, va("%d", mobjinfo[num].radius), UNDO_NONE);
mobjinfo[num].radius = get_number(word2);
}
else if (fastcmp(word, "HEIGHT"))
{
- DEH_WriteUndoline(word, va("%d", mobjinfo[num].height), UNDO_NONE);
mobjinfo[num].height = get_number(word2);
}
else if (fastcmp(word, "DISPOFFSET"))
{
- DEH_WriteUndoline(word, va("%d", mobjinfo[num].dispoffset), UNDO_NONE);
mobjinfo[num].dispoffset = get_number(word2);
}
else if (fastcmp(word, "MASS"))
{
- DEH_WriteUndoline(word, va("%d", mobjinfo[num].mass), UNDO_NONE);
mobjinfo[num].mass = (INT32)get_number(word2);
}
else if (fastcmp(word, "DAMAGE"))
{
- DEH_WriteUndoline(word, va("%d", mobjinfo[num].damage), UNDO_NONE);
mobjinfo[num].damage = (INT32)get_number(word2);
}
else if (fastcmp(word, "ACTIVESOUND"))
{
- DEH_WriteUndoline(word, va("%d", mobjinfo[num].activesound), UNDO_NONE);
mobjinfo[num].activesound = get_number(word2);
}
else if (fastcmp(word, "FLAGS"))
{
- DEH_WriteUndoline(word, va("%d", mobjinfo[num].flags), UNDO_NONE);
mobjinfo[num].flags = (INT32)get_number(word2);
}
else if (fastcmp(word, "RAISESTATE"))
{
- DEH_WriteUndoline(word, va("%d", mobjinfo[num].raisestate), UNDO_NONE);
mobjinfo[num].raisestate = get_number(word2);
}
else
@@ -812,37 +692,30 @@ static void readlight(MYFILE *f, INT32 num)
if (fastcmp(word, "TYPE"))
{
- DEH_WriteUndoline(word, va("%d", lspr[num].type), UNDO_NONE);
lspr[num].type = (UINT16)value;
}
else if (fastcmp(word, "OFFSETX"))
{
- DEH_WriteUndoline(word, va("%f", lspr[num].light_xoffset), UNDO_NONE);
lspr[num].light_xoffset = fvalue;
}
else if (fastcmp(word, "OFFSETY"))
{
- DEH_WriteUndoline(word, va("%f", lspr[num].light_yoffset), UNDO_NONE);
lspr[num].light_yoffset = fvalue;
}
else if (fastcmp(word, "CORONACOLOR"))
{
- DEH_WriteUndoline(word, va("%u", lspr[num].corona_color), UNDO_NONE);
lspr[num].corona_color = value;
}
else if (fastcmp(word, "CORONARADIUS"))
{
- DEH_WriteUndoline(word, va("%f", lspr[num].corona_radius), UNDO_NONE);
lspr[num].corona_radius = fvalue;
}
else if (fastcmp(word, "DYNAMICCOLOR"))
{
- DEH_WriteUndoline(word, va("%u", lspr[num].dynamic_color), UNDO_NONE);
lspr[num].dynamic_color = value;
}
else if (fastcmp(word, "DYNAMICRADIUS"))
{
- DEH_WriteUndoline(word, va("%f", lspr[num].dynamic_radius), UNDO_NONE);
lspr[num].dynamic_radius = fvalue;
/// \note Update the sqrradius! unnecessary?
@@ -889,7 +762,6 @@ static void readspritelight(MYFILE *f, INT32 num)
INT32 oldvar;
for (oldvar = 0; t_lspr[num] != &lspr[oldvar]; oldvar++)
;
- DEH_WriteUndoline(word, va("%d", oldvar), UNDO_NONE);
t_lspr[num] = &lspr[value];
}
else
@@ -901,6 +773,49 @@ static void readspritelight(MYFILE *f, INT32 num)
}
#endif // HWRENDER
+static void readsprite2(MYFILE *f, INT32 num)
+{
+ char *s = Z_Malloc(MAXLINELEN, PU_STATIC, NULL);
+ char *word, *word2;
+ char *tmp;
+
+ do
+ {
+ if (myfgets(s, MAXLINELEN, f))
+ {
+ if (s[0] == '\n')
+ break;
+
+ tmp = strchr(s, '#');
+ if (tmp)
+ *tmp = '\0';
+ if (s == tmp)
+ continue; // Skip comment lines, but don't break.
+
+ word = strtok(s, " ");
+ if (word)
+ strupr(word);
+ else
+ break;
+
+ word2 = strtok(NULL, " = ");
+ if (word2)
+ strupr(word2);
+ else
+ break;
+ if (word2[strlen(word2)-1] == '\n')
+ word2[strlen(word2)-1] = '\0';
+
+ if (fastcmp(word, "DEFAULT"))
+ spr2defaults[num] = get_number(word2);
+ else
+ deh_warning("Sprite2 %s: unknown word '%s'", spr2names[num], word);
+ }
+ } while (!myfeof(f)); // finish when the line is empty
+
+ Z_Free(s);
+}
+
static const struct {
const char *name;
const UINT16 flag;
@@ -972,8 +887,6 @@ static void readlevelheader(MYFILE *f, INT32 num)
INT32 i;
// Reset all previous map header information
- // This call automatically saves all previous information when DELFILE is defined.
- // We don't need to do it ourselves.
P_AllocMapHeader((INT16)(num-1));
do
@@ -1329,6 +1242,13 @@ static void readlevelheader(MYFILE *f, INT32 num)
else
mapheaderinfo[num-1]->levelflags &= ~LF_NOZONE;
}
+ else if (fastcmp(word, "SAVEGAME"))
+ {
+ if (i || word2[0] == 'T' || word2[0] == 'Y')
+ mapheaderinfo[num-1]->levelflags |= LF_SAVEGAME;
+ else
+ mapheaderinfo[num-1]->levelflags &= ~LF_SAVEGAME;
+ }
// Individual triggers for menu flags
else if (fastcmp(word, "HIDDEN"))
@@ -1392,8 +1312,6 @@ static void readcutscenescene(MYFILE *f, INT32 num, INT32 scenenum)
UINT16 usi;
UINT8 picid;
- DEH_WriteUndoline("SCENETEXT", cutscenes[num]->scene[scenenum].text, UNDO_ENDTEXT);
-
do
{
if (myfgets(s, MAXLINELEN, f))
@@ -1470,7 +1388,6 @@ static void readcutscenescene(MYFILE *f, INT32 num, INT32 scenenum)
if (fastcmp(word, "NUMBEROFPICS"))
{
- DEH_WriteUndoline(word, va("%d", cutscenes[num]->scene[scenenum].numpics), UNDO_NONE);
cutscenes[num]->scene[scenenum].numpics = (UINT8)i;
}
else if (fastncmp(word, "PIC", 3))
@@ -1485,27 +1402,22 @@ static void readcutscenescene(MYFILE *f, INT32 num, INT32 scenenum)
if (fastcmp(word+4, "NAME"))
{
- DEH_WriteUndoline(word, cutscenes[num]->scene[scenenum].picname[picid], UNDO_NONE);
strncpy(cutscenes[num]->scene[scenenum].picname[picid], word2, 8);
}
else if (fastcmp(word+4, "HIRES"))
{
- DEH_WriteUndoline(word, va("%d", cutscenes[num]->scene[scenenum].pichires[picid]), UNDO_NONE);
cutscenes[num]->scene[scenenum].pichires[picid] = (UINT8)(i || word2[0] == 'T' || word2[0] == 'Y');
}
else if (fastcmp(word+4, "DURATION"))
{
- DEH_WriteUndoline(word, va("%u", cutscenes[num]->scene[scenenum].picduration[picid]), UNDO_NONE);
cutscenes[num]->scene[scenenum].picduration[picid] = usi;
}
else if (fastcmp(word+4, "XCOORD"))
{
- DEH_WriteUndoline(word, va("%u", cutscenes[num]->scene[scenenum].xcoord[picid]), UNDO_NONE);
cutscenes[num]->scene[scenenum].xcoord[picid] = usi;
}
else if (fastcmp(word+4, "YCOORD"))
{
- DEH_WriteUndoline(word, va("%u", cutscenes[num]->scene[scenenum].ycoord[picid]), UNDO_NONE);
cutscenes[num]->scene[scenenum].ycoord[picid] = usi;
}
else
@@ -1513,14 +1425,12 @@ static void readcutscenescene(MYFILE *f, INT32 num, INT32 scenenum)
}
else if (fastcmp(word, "MUSIC"))
{
- DEH_WriteUndoline(word, cutscenes[num]->scene[scenenum].musswitch, UNDO_NONE);
strncpy(cutscenes[num]->scene[scenenum].musswitch, word2, 7);
cutscenes[num]->scene[scenenum].musswitch[6] = 0;
}
#ifdef MUSICSLOT_COMPATIBILITY
else if (fastcmp(word, "MUSICSLOT"))
{
- DEH_WriteUndoline(word, cutscenes[num]->scene[scenenum].musswitch, UNDO_NONE);
i = get_mus(word2, true);
if (i && i <= 1035)
snprintf(cutscenes[num]->scene[scenenum].musswitch, 7, "%sM", G_BuildMapName(i));
@@ -1533,37 +1443,30 @@ static void readcutscenescene(MYFILE *f, INT32 num, INT32 scenenum)
#endif
else if (fastcmp(word, "MUSICTRACK"))
{
- DEH_WriteUndoline(word, va("%u", cutscenes[num]->scene[scenenum].musswitchflags), UNDO_NONE);
cutscenes[num]->scene[scenenum].musswitchflags = ((UINT16)i) & MUSIC_TRACKMASK;
}
else if (fastcmp(word, "MUSICLOOP"))
{
- DEH_WriteUndoline(word, va("%u", cutscenes[num]->scene[scenenum].musicloop), UNDO_NONE);
cutscenes[num]->scene[scenenum].musicloop = (UINT8)(i || word2[0] == 'T' || word2[0] == 'Y');
}
else if (fastcmp(word, "TEXTXPOS"))
{
- DEH_WriteUndoline(word, va("%u", cutscenes[num]->scene[scenenum].textxpos), UNDO_NONE);
cutscenes[num]->scene[scenenum].textxpos = usi;
}
else if (fastcmp(word, "TEXTYPOS"))
{
- DEH_WriteUndoline(word, va("%u", cutscenes[num]->scene[scenenum].textypos), UNDO_NONE);
cutscenes[num]->scene[scenenum].textypos = usi;
}
else if (fastcmp(word, "FADEINID"))
{
- DEH_WriteUndoline(word, va("%u", cutscenes[num]->scene[scenenum].fadenum), UNDO_NONE);
cutscenes[num]->scene[scenenum].fadeinid = (UINT8)i;
}
else if (fastcmp(word, "FADEOUTID"))
{
- DEH_WriteUndoline(word, va("%u", cutscenes[num]->scene[scenenum].fadenum), UNDO_NONE);
cutscenes[num]->scene[scenenum].fadeoutid = (UINT8)i;
}
else if (fastcmp(word, "FADECOLOR"))
{
- DEH_WriteUndoline(word, va("%u", cutscenes[num]->scene[scenenum].fadenum), UNDO_NONE);
cutscenes[num]->scene[scenenum].fadecolor = (UINT8)i;
}
else
@@ -1581,9 +1484,6 @@ static void readcutscene(MYFILE *f, INT32 num)
char *word2;
char *tmp;
INT32 value;
-#ifdef DELFILE
- const INT32 oldnumscenes = cutscenes[num]->numscenes;
-#endif
// Allocate memory for this cutscene if we don't yet have any
if (!cutscenes[num])
@@ -1626,8 +1526,6 @@ static void readcutscene(MYFILE *f, INT32 num)
if (1 <= value && value <= 128)
{
readcutscenescene(f, num, value - 1);
- DEH_WriteUndoline(word, word2, UNDO_SPACE|UNDO_CUTLINE);
- DEH_WriteUndoline("NUMSCENES", va("%d", oldnumscenes), UNDO_SPACE);
}
else
deh_warning("Scene number %d out of range (1 - 128)", value);
@@ -1680,12 +1578,10 @@ static void readhuditem(MYFILE *f, INT32 num)
if (fastcmp(word, "X"))
{
- DEH_WriteUndoline(word, va("%d", hudinfo[num].x), UNDO_NONE);
hudinfo[num].x = i;
}
else if (fastcmp(word, "Y"))
{
- DEH_WriteUndoline(word, va("%d", hudinfo[num].y), UNDO_NONE);
hudinfo[num].y = i;
}
else
@@ -1732,7 +1628,6 @@ static actionpointer_t actionpointers[] =
{{A_BossDeath}, "A_BOSSDEATH"},
{{A_CustomPower}, "A_CUSTOMPOWER"},
{{A_GiveWeapon}, "A_GIVEWEAPON"},
- {{A_RingShield}, "A_RINGSHIELD"},
{{A_RingBox}, "A_RINGBOX"},
{{A_Invincibility}, "A_INVINCIBILITY"},
{{A_SuperSneakers}, "A_SUPERSNEAKERS"},
@@ -1743,14 +1638,7 @@ static actionpointer_t actionpointers[] =
{{A_BubbleCheck}, "A_BUBBLECHECK"},
{{A_AwardScore}, "A_AWARDSCORE"},
{{A_ExtraLife}, "A_EXTRALIFE"},
- {{A_BombShield}, "A_BOMBSHIELD"},
- {{A_JumpShield}, "A_JUMPSHIELD"},
- {{A_WaterShield}, "A_WATERSHIELD"},
- {{A_ForceShield}, "A_FORCESHIELD"},
- {{A_PityShield}, "A_PITYSHIELD"},
- {{A_FlameShield}, "A_FLAMESHIELD"},
- {{A_BubbleShield}, "A_BUBBLESHIELD"},
- {{A_ThunderShield}, "A_THUNDERSHIELD"},
+ {{A_GiveShield}, "A_GIVESHIELD"},
{{A_GravityBox}, "A_GRAVITYBOX"},
{{A_ScoreRise}, "A_SCORERISE"},
{{A_ParticleSpawn}, "A_PARTICLESPAWN"},
@@ -1776,7 +1664,6 @@ static actionpointer_t actionpointers[] =
{{A_CapeChase}, "A_CAPECHASE"},
{{A_RotateSpikeBall}, "A_ROTATESPIKEBALL"},
{{A_SlingAppear}, "A_SLINGAPPEAR"},
- {{A_MaceRotate}, "A_MACEROTATE"},
{{A_UnidusBall}, "A_UNIDUSBALL"},
{{A_RockSpawn}, "A_ROCKSPAWN"},
{{A_SetFuse}, "A_SETFUSE"},
@@ -1917,6 +1804,7 @@ static actionpointer_t actionpointers[] =
{{A_FlickyHeightCheck}, "A_FLICKYHEIGHTCHECK"},
{{A_FlickyFlutter}, "A_FLICKYFLUTTER"},
{{A_FlameParticle}, "A_FLAMEPARTICLE"},
+ {{A_FadeOverlay}, "A_FADEOVERLAY"},
{{NULL}, "NONE"},
@@ -1971,39 +1859,33 @@ static void readframe(MYFILE *f, INT32 num)
if (fastcmp(word1, "SPRITENUMBER") || fastcmp(word1, "SPRITENAME"))
{
- DEH_WriteUndoline(word1, va("%u", states[num].sprite), UNDO_NONE);
states[num].sprite = get_sprite(word2);
}
else if (fastcmp(word1, "SPRITESUBNUMBER") || fastcmp(word1, "SPRITEFRAME"))
{
- DEH_WriteUndoline(word1, va("%d", states[num].frame), UNDO_NONE);
states[num].frame = (INT32)get_number(word2); // So the FF_ flags get calculated
}
else if (fastcmp(word1, "DURATION"))
{
- DEH_WriteUndoline(word1, va("%u", states[num].tics), UNDO_NONE);
states[num].tics = (INT32)get_number(word2); // So TICRATE can be used
}
else if (fastcmp(word1, "NEXT"))
{
- DEH_WriteUndoline(word1, va("%d", states[num].nextstate), UNDO_NONE);
states[num].nextstate = get_state(word2);
}
else if (fastcmp(word1, "VAR1"))
{
- DEH_WriteUndoline(word1, va("%d", states[num].var1), UNDO_NONE);
states[num].var1 = (INT32)get_number(word2);
}
else if (fastcmp(word1, "VAR2"))
{
- DEH_WriteUndoline(word1, va("%d", states[num].var2), UNDO_NONE);
states[num].var2 = (INT32)get_number(word2);
}
else if (fastcmp(word1, "ACTION"))
{
size_t z;
boolean found = false;
- XBOXSTATIC char actiontocompare[32];
+ char actiontocompare[32];
memset(actiontocompare, 0x00, sizeof(actiontocompare));
strlcpy(actiontocompare, word2, sizeof (actiontocompare));
@@ -2021,10 +1903,7 @@ static void readframe(MYFILE *f, INT32 num)
for (z = 0; actionpointers[z].name; z++)
{
if (actionpointers[z].action.acv == states[num].action.acv)
- {
- DEH_WriteUndoline(word1, actionpointers[z].name, UNDO_NONE);
break;
- }
}
z = 0;
@@ -2094,17 +1973,14 @@ static void readsound(MYFILE *f, INT32 num)
if (fastcmp(word, "SINGULAR"))
{
- DEH_WriteUndoline(word, va("%d", S_sfx[num].singularity), UNDO_NONE);
S_sfx[num].singularity = value;
}
else if (fastcmp(word, "PRIORITY"))
{
- DEH_WriteUndoline(word, va("%d", S_sfx[num].priority), UNDO_NONE);
S_sfx[num].priority = value;
}
else if (fastcmp(word, "FLAGS"))
{
- DEH_WriteUndoline(word, va("%d", S_sfx[num].pitch), UNDO_NONE);
S_sfx[num].pitch = value;
}
else if (fastcmp(word, "CAPTION") || fastcmp(word, "DESCRIPTION"))
@@ -2148,11 +2024,7 @@ static boolean GoodDataFileName(const char *s)
p = s + strlen(s) - strlen(tail);
if (p <= s) return false; // too short
if (!fasticmp(p, tail)) return false; // doesn't end in .dat
-#ifdef DELFILE
- if (fasticmp(s, "gamedata.dat") && !disableundo) return false;
-#else
if (fasticmp(s, "gamedata.dat")) return false;
-#endif
return true;
}
@@ -2165,17 +2037,6 @@ static void reademblemdata(MYFILE *f, INT32 num)
char *tmp;
INT32 value;
- // Reset all data initially
- DEH_WriteUndoline("TYPE", va("%d", emblemlocations[num-1].type), UNDO_NONE);
- DEH_WriteUndoline("X", va("%d", emblemlocations[num-1].x), UNDO_NONE);
- DEH_WriteUndoline("Y", va("%d", emblemlocations[num-1].y), UNDO_NONE);
- DEH_WriteUndoline("Z", va("%d", emblemlocations[num-1].z), UNDO_NONE);
- DEH_WriteUndoline("MAPNUM", va("%d", emblemlocations[num-1].level), UNDO_NONE);
- DEH_WriteUndoline("VAR", va("%d", emblemlocations[num-1].var), UNDO_NONE);
- DEH_WriteUndoline("SPRITE", va("%d", emblemlocations[num-1].sprite), UNDO_NONE);
- DEH_WriteUndoline("COLOR", va("%d", emblemlocations[num-1].color), UNDO_NONE);
- DEH_WriteUndoline("HINT", extraemblems[num-1].hint, UNDO_NONE);
-
memset(&emblemlocations[num-1], 0, sizeof(emblem_t));
do
@@ -2227,12 +2088,12 @@ static void reademblemdata(MYFILE *f, INT32 num)
emblemlocations[num-1].type = ET_TIME;
else if (fastcmp(word2, "RINGS"))
emblemlocations[num-1].type = ET_RINGS;
+ else if (fastcmp(word2, "MAP"))
+ emblemlocations[num-1].type = ET_MAP;
else if (fastcmp(word2, "NGRADE"))
emblemlocations[num-1].type = ET_NGRADE;
else if (fastcmp(word2, "NTIME"))
emblemlocations[num-1].type = ET_NTIME;
- else if (fastcmp(word2, "MAP"))
- emblemlocations[num-1].type = ET_MAP;
else
emblemlocations[num-1].type = (UINT8)value;
}
@@ -2311,13 +2172,6 @@ static void readextraemblemdata(MYFILE *f, INT32 num)
char *tmp;
INT32 value;
- // Reset all data initially
- DEH_WriteUndoline("NAME", extraemblems[num-1].name, UNDO_NONE);
- DEH_WriteUndoline("OBJECTIVE", extraemblems[num-1].description, UNDO_NONE);
- DEH_WriteUndoline("CONDITIONSET", va("%d", extraemblems[num-1].conditionset), UNDO_NONE);
- DEH_WriteUndoline("SPRITE", va("%d", extraemblems[num-1].sprite), UNDO_NONE);
- DEH_WriteUndoline("COLOR", va("%d", extraemblems[num-1].color), UNDO_NONE);
-
memset(&extraemblems[num-1], 0, sizeof(extraemblem_t));
do
@@ -2392,16 +2246,6 @@ static void readunlockable(MYFILE *f, INT32 num)
char *tmp;
INT32 i;
- // Same deal with unlockables, clear all first
- DEH_WriteUndoline("NAME", unlockables[num].name, UNDO_NONE);
- DEH_WriteUndoline("OBJECTIVE", unlockables[num].objective, UNDO_NONE);
- DEH_WriteUndoline("HEIGHT", va("%d", unlockables[num].height), UNDO_NONE);
- DEH_WriteUndoline("CONDITIONSET", va("%d", unlockables[num].conditionset), UNDO_NONE);
- DEH_WriteUndoline("TYPE", va("%d", unlockables[num].type), UNDO_NONE);
- DEH_WriteUndoline("NOCECHO", va("%d", unlockables[num].nocecho), UNDO_NONE);
- DEH_WriteUndoline("NOCHECKLIST", va("%d", unlockables[num].nochecklist), UNDO_NONE);
- DEH_WriteUndoline("VAR", va("%d", unlockables[num].variable), UNDO_NONE);
-
memset(&unlockables[num], 0, sizeof(unlockable_t));
unlockables[num].objective[0] = '/';
@@ -2796,7 +2640,6 @@ static void readmaincfg(MYFILE *f)
else
value = get_number(word2);
- DEH_WriteUndoline(word, va("%d", spstage_start), UNDO_NONE);
spstage_start = (INT16)value;
}
else if (fastcmp(word, "SSTAGE_START"))
@@ -2810,97 +2653,101 @@ static void readmaincfg(MYFILE *f)
else
value = get_number(word2);
- DEH_WriteUndoline(word, va("%d", sstage_start), UNDO_NONE);
sstage_start = (INT16)value;
sstage_end = (INT16)(sstage_start+6); // 7 special stages total
}
else if (fastcmp(word, "USENIGHTSSS"))
{
- DEH_WriteUndoline(word, va("%d", useNightsSS), UNDO_NONE);
useNightsSS = (UINT8)(value || word2[0] == 'T' || word2[0] == 'Y');
}
else if (fastcmp(word, "REDTEAM"))
{
- DEH_WriteUndoline(word, va("%d", skincolor_redteam), UNDO_NONE);
skincolor_redteam = (UINT8)get_number(word2);
}
else if (fastcmp(word, "BLUETEAM"))
{
- DEH_WriteUndoline(word, va("%d", skincolor_blueteam), UNDO_NONE);
skincolor_blueteam = (UINT8)get_number(word2);
}
else if (fastcmp(word, "REDRING"))
{
- DEH_WriteUndoline(word, va("%d", skincolor_redring), UNDO_NONE);
skincolor_redring = (UINT8)get_number(word2);
}
else if (fastcmp(word, "BLUERING"))
{
- DEH_WriteUndoline(word, va("%d", skincolor_bluering), UNDO_NONE);
skincolor_bluering = (UINT8)get_number(word2);
}
else if (fastcmp(word, "INVULNTICS"))
{
- DEH_WriteUndoline(word, va("%u", invulntics), UNDO_NONE);
invulntics = (UINT16)get_number(word2);
}
else if (fastcmp(word, "SNEAKERTICS"))
{
- DEH_WriteUndoline(word, va("%u", sneakertics), UNDO_NONE);
sneakertics = (UINT16)get_number(word2);
}
else if (fastcmp(word, "FLASHINGTICS"))
{
- DEH_WriteUndoline(word, va("%u", flashingtics), UNDO_NONE);
flashingtics = (UINT16)get_number(word2);
}
else if (fastcmp(word, "TAILSFLYTICS"))
{
- DEH_WriteUndoline(word, va("%u", tailsflytics), UNDO_NONE);
tailsflytics = (UINT16)get_number(word2);
}
else if (fastcmp(word, "UNDERWATERTICS"))
{
- DEH_WriteUndoline(word, va("%u", underwatertics), UNDO_NONE);
underwatertics = (UINT16)get_number(word2);
}
else if (fastcmp(word, "SPACETIMETICS"))
{
- DEH_WriteUndoline(word, va("%u", spacetimetics), UNDO_NONE);
spacetimetics = (UINT16)get_number(word2);
}
else if (fastcmp(word, "EXTRALIFETICS"))
{
- DEH_WriteUndoline(word, va("%u", extralifetics), UNDO_NONE);
extralifetics = (UINT16)get_number(word2);
}
else if (fastcmp(word, "GAMEOVERTICS"))
{
- DEH_WriteUndoline(word, va("%u", gameovertics), UNDO_NONE);
gameovertics = get_number(word2);
}
else if (fastcmp(word, "INTROTOPLAY"))
{
- DEH_WriteUndoline(word, va("%d", introtoplay), UNDO_NONE);
introtoplay = (UINT8)get_number(word2);
// range check, you morons.
if (introtoplay > 128)
introtoplay = 128;
+ introchanged = true;
}
else if (fastcmp(word, "LOOPTITLE"))
{
- DEH_WriteUndoline(word, va("%d", looptitle), UNDO_NONE);
looptitle = (boolean)(value || word2[0] == 'T' || word2[0] == 'Y');
+ titlechanged = true;
+ }
+ else if (fastcmp(word, "TITLEMAP"))
+ {
+ // Support using the actual map name,
+ // i.e., Level AB, Level FZ, etc.
+
+ // Convert to map number
+ if (word2[0] >= 'A' && word2[0] <= 'Z')
+ value = M_MapNumber(word2[0], word2[1]);
+ else
+ value = get_number(word2);
+
+ titlemap = (INT16)value;
+ titlechanged = true;
+ }
+ else if (fastcmp(word, "HIDETITLEPICS"))
+ {
+ hidetitlepics = (boolean)(value || word2[0] == 'T' || word2[0] == 'Y');
+ titlechanged = true;
}
else if (fastcmp(word, "TITLESCROLLSPEED"))
{
- DEH_WriteUndoline(word, va("%d", titlescrollspeed), UNDO_NONE);
titlescrollspeed = get_number(word2);
+ titlechanged = true;
}
else if (fastcmp(word, "CREDITSCUTSCENE"))
{
- DEH_WriteUndoline(word, va("%d", creditscutscene), UNDO_NONE);
creditscutscene = (UINT8)get_number(word2);
// range check, you morons.
if (creditscutscene > 128)
@@ -2908,32 +2755,29 @@ static void readmaincfg(MYFILE *f)
}
else if (fastcmp(word, "DISABLESPEEDADJUST"))
{
- DEH_WriteUndoline(word, va("%d", disableSpeedAdjust), UNDO_NONE);
disableSpeedAdjust = (UINT8)get_number(word2);
}
else if (fastcmp(word, "NUMDEMOS"))
{
- DEH_WriteUndoline(word, va("%d", numDemos), UNDO_NONE);
numDemos = (UINT8)get_number(word2);
+ titlechanged = true;
}
else if (fastcmp(word, "DEMODELAYTIME"))
{
- DEH_WriteUndoline(word, va("%d", demoDelayTime), UNDO_NONE);
demoDelayTime = get_number(word2);
+ titlechanged = true;
}
else if (fastcmp(word, "DEMOIDLETIME"))
{
- DEH_WriteUndoline(word, va("%d", demoIdleTime), UNDO_NONE);
demoIdleTime = get_number(word2);
+ titlechanged = true;
}
else if (fastcmp(word, "USE1UPSOUND"))
{
- DEH_WriteUndoline(word, va("%u", use1upSound), UNDO_NONE);
use1upSound = (UINT8)(value || word2[0] == 'T' || word2[0] == 'Y');
}
else if (fastcmp(word, "MAXXTRALIFE"))
{
- DEH_WriteUndoline(word, va("%u", maxXtraLife), UNDO_NONE);
maxXtraLife = (UINT8)get_number(word2);
}
@@ -2947,7 +2791,6 @@ static void readmaincfg(MYFILE *f)
I_Error("Maincfg: bad data file name '%s'\n", word2);
G_SaveGameData();
- DEH_WriteUndoline(word, gamedatafilename, UNDO_NONE);
strlcpy(gamedatafilename, word2, sizeof (gamedatafilename));
strlwr(gamedatafilename);
savemoddata = true;
@@ -2959,18 +2802,40 @@ static void readmaincfg(MYFILE *f)
strncpy(savegamename, timeattackfolder, sizeof (timeattackfolder));
strlcat(savegamename, "%u.ssg", sizeof(savegamename));
+ // can't use sprintf since there is %u in savegamename
+ strcatbf(savegamename, srb2home, PATHSEP);
gamedataadded = true;
+ titlechanged = true;
}
else if (fastcmp(word, "RESETDATA"))
{
- DEH_WriteUndoline(word, "0", UNDO_TODO); /// \todo
P_ResetData(value);
+ titlechanged = true;
}
else if (fastcmp(word, "CUSTOMVERSION"))
{
- DEH_WriteUndoline(word, customversionstring, UNDO_NONE);
strlcpy(customversionstring, word2, sizeof (customversionstring));
+ //titlechanged = true;
+ }
+ else if (fastcmp(word, "BOOTMAP"))
+ {
+ // Support using the actual map name,
+ // i.e., Level AB, Level FZ, etc.
+
+ // Convert to map number
+ if (word2[0] >= 'A' && word2[0] <= 'Z')
+ value = M_MapNumber(word2[0], word2[1]);
+ else
+ value = get_number(word2);
+
+ bootmap = (INT16)value;
+ //titlechanged = true;
+ }
+ else if (fastcmp(word, "STARTCHAR"))
+ {
+ startchar = (INT16)value;
+ char_on = -1;
}
else
deh_warning("Maincfg: unknown word '%s'", word);
@@ -3167,13 +3032,13 @@ static void DEH_LoadDehackedFile(MYFILE *f)
deh_num_warning = 0;
- gamedataadded = false;
+ gamedataadded = titlechanged = introchanged = false;
// it doesn't test the version of SRB2 and version of dehacked file
dbg_line = -1; // start at -1 so the first line is 0.
while (!myfeof(f))
{
- XBOXSTATIC char origpos[128];
+ char origpos[128];
INT32 size = 0;
char *traverse;
@@ -3207,13 +3072,11 @@ static void DEH_LoadDehackedFile(MYFILE *f)
else if (fastcmp(word, "MAINCFG"))
{
readmaincfg(f);
- DEH_WriteUndoline(word, "", UNDO_HEADER);
continue;
}
else if (fastcmp(word, "WIPES"))
{
readwipes(f);
- DEH_WriteUndoline(word, "", UNDO_HEADER);
continue;
}
word2 = strtok(NULL, " ");
@@ -3233,7 +3096,6 @@ static void DEH_LoadDehackedFile(MYFILE *f)
deh_warning("Character %d out of range (0 - 31)", i);
ignorelines(f);
}
- DEH_WriteUndoline(word, word2, UNDO_HEADER);
continue;
}
if (word2)
@@ -3242,6 +3104,7 @@ static void DEH_LoadDehackedFile(MYFILE *f)
if (word2[strlen(word2)-1] == '\n')
word2[strlen(word2)-1] = '\0';
i = atoi(word2);
+
if (fastcmp(word, "THING") || fastcmp(word, "MOBJ") || fastcmp(word, "OBJECT"))
{
if (i == 0 && word2[0] != '0') // If word2 isn't a number
@@ -3253,11 +3116,22 @@ static void DEH_LoadDehackedFile(MYFILE *f)
deh_warning("Thing %d out of range (1 - %d)", i, NUMMOBJTYPES-1);
ignorelines(f);
}
- DEH_WriteUndoline(word, word2, UNDO_HEADER);
}
+ else if (fastcmp(word, "SPRITE2"))
+ {
+ if (i == 0 && word2[0] != '0') // If word2 isn't a number
+ i = get_sprite2(word2); // find a sprite by name
+ if (i < (INT32)free_spr2 && i >= (INT32)SPR2_FIRSTFREESLOT)
+ readsprite2(f, i);
+ else
+ {
+ deh_warning("Sprite2 number %d out of range (%d - %d)", i, SPR2_FIRSTFREESLOT, free_spr2-1);
+ ignorelines(f);
+ }
+ }
+#ifdef HWRENDER
else if (fastcmp(word, "LIGHT"))
{
-#ifdef HWRENDER
// TODO: Read lights by name
if (i > 0 && i < NUMLIGHTS)
readlight(f, i);
@@ -3266,24 +3140,20 @@ static void DEH_LoadDehackedFile(MYFILE *f)
deh_warning("Light number %d out of range (1 - %d)", i, NUMLIGHTS-1);
ignorelines(f);
}
- DEH_WriteUndoline(word, word2, UNDO_HEADER);
-#endif
}
else if (fastcmp(word, "SPRITE"))
{
-#ifdef HWRENDER
if (i == 0 && word2[0] != '0') // If word2 isn't a number
i = get_sprite(word2); // find a sprite by name
- if (i < NUMSPRITES && i >= 0)
+ if (i < NUMSPRITES && i > 0)
readspritelight(f, i);
else
{
deh_warning("Sprite number %d out of range (0 - %d)", i, NUMSPRITES-1);
ignorelines(f);
}
- DEH_WriteUndoline(word, word2, UNDO_HEADER);
-#endif
}
+#endif
else if (fastcmp(word, "LEVEL"))
{
// Support using the actual map name,
@@ -3300,7 +3170,6 @@ static void DEH_LoadDehackedFile(MYFILE *f)
deh_warning("Level number %d out of range (1 - %d)", i, NUMMAPS);
ignorelines(f);
}
- DEH_WriteUndoline(word, word2, UNDO_HEADER);
}
else if (fastcmp(word, "CUTSCENE"))
{
@@ -3311,7 +3180,6 @@ static void DEH_LoadDehackedFile(MYFILE *f)
deh_warning("Cutscene number %d out of range (1 - 128)", i);
ignorelines(f);
}
- DEH_WriteUndoline(word, word2, UNDO_HEADER);
}
else if (fastcmp(word, "FRAME") || fastcmp(word, "STATE"))
{
@@ -3324,7 +3192,6 @@ static void DEH_LoadDehackedFile(MYFILE *f)
deh_warning("Frame %d out of range (0 - %d)", i, NUMSTATES-1);
ignorelines(f);
}
- DEH_WriteUndoline(word, word2, UNDO_HEADER);
}
else if (fastcmp(word, "SOUND"))
{
@@ -3337,7 +3204,6 @@ static void DEH_LoadDehackedFile(MYFILE *f)
deh_warning("Sound %d out of range (1 - %d)", i, NUMSFX-1);
ignorelines(f);
}
- DEH_WriteUndoline(word, word2, UNDO_HEADER);
}
else if (fastcmp(word, "HUDITEM"))
{
@@ -3350,7 +3216,6 @@ static void DEH_LoadDehackedFile(MYFILE *f)
deh_warning("HUD item number %d out of range (0 - %d)", i, NUMHUDITEMS-1);
ignorelines(f);
}
- DEH_WriteUndoline(word, word2, UNDO_HEADER);
}
else if (fastcmp(word, "EMBLEM"))
{
@@ -3370,7 +3235,6 @@ static void DEH_LoadDehackedFile(MYFILE *f)
deh_warning("Emblem number %d out of range (1 - %d)", i, MAXEMBLEMS);
ignorelines(f);
}
- DEH_WriteUndoline(word, word2, UNDO_HEADER);
}
else if (fastcmp(word, "EXTRAEMBLEM"))
{
@@ -3390,7 +3254,6 @@ static void DEH_LoadDehackedFile(MYFILE *f)
deh_warning("Extra emblem number %d out of range (1 - %d)", i, MAXEXTRAEMBLEMS);
ignorelines(f);
}
- DEH_WriteUndoline(word, word2, UNDO_HEADER);
}
else if (fastcmp(word, "UNLOCKABLE"))
{
@@ -3406,7 +3269,6 @@ static void DEH_LoadDehackedFile(MYFILE *f)
deh_warning("Unlockable number %d out of range (1 - %d)", i, MAXUNLOCKABLES);
ignorelines(f);
}
- DEH_WriteUndoline(word, word2, UNDO_HEADER);
}
else if (fastcmp(word, "CONDITIONSET"))
{
@@ -3422,8 +3284,6 @@ static void DEH_LoadDehackedFile(MYFILE *f)
deh_warning("Condition set number %d out of range (1 - %d)", i, MAXCONDITIONSETS);
ignorelines(f);
}
- // no undo support for this insanity yet
- //DEH_WriteUndoline(word, word2, UNDO_HEADER);
}
// Last I heard this crashes the game if you try to use it
// so this is disabled for now
@@ -3433,7 +3293,6 @@ static void DEH_LoadDehackedFile(MYFILE *f)
INT32 ver = searchvalue(strtok(NULL, "\n"));
if (ver != PATCHVERSION)
deh_warning("Patch is for SRB2 version %d,\nonly version %d is supported", ver, PATCHVERSION);
- //DEH_WriteUndoline(word, va("%d", ver), UNDO_NONE);
}
// Clear all data in certain locations (mostly for unlocks)
// Unless you REALLY want to piss people off,
@@ -3484,6 +3343,14 @@ static void DEH_LoadDehackedFile(MYFILE *f)
if (gamedataadded)
G_LoadGameData();
+ if (gamestate == GS_TITLESCREEN)
+ {
+ if (introchanged)
+ COM_BufAddText("playintro");
+ else if (titlechanged)
+ COM_BufAddText("exitgame"); // Command_ExitGame_f() but delayed
+ }
+
dbg_line = -1;
if (deh_num_warning)
{
@@ -3504,9 +3371,6 @@ static void DEH_LoadDehackedFile(MYFILE *f)
void DEH_LoadDehackedLumpPwad(UINT16 wad, UINT16 lump)
{
MYFILE f;
-#ifdef DELFILE
- unsocwad = wad;
-#endif
f.wad = wad;
f.size = W_LumpLengthPwad(wad, lump);
f.data = Z_Malloc(f.size + 1, PU_STATIC, NULL);
@@ -3514,7 +3378,6 @@ void DEH_LoadDehackedLumpPwad(UINT16 wad, UINT16 lump)
f.curpos = f.data;
f.data[f.size] = 0;
DEH_LoadDehackedFile(&f);
- DEH_WriteUndoline(va("# uload for wad: %u, lump: %u", wad, lump), NULL, UNDO_DONE);
Z_Free(f.data);
}
@@ -3523,67 +3386,6 @@ void DEH_LoadDehackedLump(lumpnum_t lumpnum)
DEH_LoadDehackedLumpPwad(WADFILENUM(lumpnum),LUMPNUM(lumpnum));
}
-#ifdef DELFILE
-#define DUMPUNDONE
-
-// read (un)dehacked lump in wad's memory
-void DEH_UnloadDehackedWad(UINT16 wad)
-{
- undehacked_t *tmp, *curundo = unsocdata[wad];
- MYFILE f;
- size_t len = 0;
- char *data;
-#ifdef DUMPUNDONE
- FILE *UNDO = fopen("undo.soc", "wt");
-#endif
- CONS_Printf(M_GetText("Unloading WAD SOC edits\n"));
- while (curundo)
- {
- data = curundo->undata;
- curundo = curundo->next;
- if (data)
- len += strlen(data);
- len += 1;
-#ifdef DUMPUNDONE
- if (UNDO)
- {
- if (data)
- fprintf(UNDO, "%s\n", data);
- else
- fprintf(UNDO, "\n");
- }
-#endif
- }
-#ifndef DUMPUNDONE
- if (UNDO) fclose(UNDO);
-#endif
- if (!len) return;
- f.size = len;
- data = f.data = Z_Malloc(f.size + 1, PU_STATIC, NULL);
- curundo = unsocdata[wad];
- unsocdata[wad] = NULL;
- while (curundo)
- {
- tmp = curundo;
- curundo = curundo->next;
- if (tmp->undata)
- data += sprintf(data, "%s\n", tmp->undata);
- else
- data += sprintf(data, "\n");
- if (tmp->undata) free(tmp->undata);
- free(tmp);
- }
- f.wad = wad;
- f.curpos = f.data;
- f.data[f.size] = 0;
- disableundo = true;
- DEH_LoadDehackedFile(&f);
- disableundo = false;
- Z_Free(f.data);
-}
-#endif //DELFILE
-
-
////////////////////////////////////////////////////////////////////////////////
// CRAZY LIST OF STATE NAMES AND ALL FROM HERE DOWN
// TODO: Make this all a seperate file or something, like part of info.c??
@@ -3615,6 +3417,7 @@ static const char *const STATE_LIST[] = { // array length left dynamic for sanit
"S_PLAY_STND",
"S_PLAY_WAIT",
"S_PLAY_WALK",
+ "S_PLAY_SKID",
"S_PLAY_RUN",
"S_PLAY_DASH",
"S_PLAY_PAIN",
@@ -3663,15 +3466,12 @@ static const char *const STATE_LIST[] = { // array length left dynamic for sanit
"S_PLAY_MELEE_LANDING",
// SF_SUPER
- "S_PLAY_SUPERTRANS1",
- "S_PLAY_SUPERTRANS2",
- "S_PLAY_SUPERTRANS3",
- "S_PLAY_SUPERTRANS4",
- "S_PLAY_SUPERTRANS5",
- "S_PLAY_SUPERTRANS6",
- "S_PLAY_SUPERTRANS7",
- "S_PLAY_SUPERTRANS8",
- "S_PLAY_SUPERTRANS9", // This has special significance in the code. If you add more frames, search for it and make the appropriate changes.
+ "S_PLAY_SUPER_TRANS1",
+ "S_PLAY_SUPER_TRANS2",
+ "S_PLAY_SUPER_TRANS3",
+ "S_PLAY_SUPER_TRANS4",
+ "S_PLAY_SUPER_TRANS5",
+ "S_PLAY_SUPER_TRANS6", // This has special significance in the code. If you add more frames, search for it and make the appropriate changes.
// technically the player goes here but it's an infinite tic state
"S_OBJPLACE_DUMMY",
@@ -3687,15 +3487,12 @@ static const char *const STATE_LIST[] = { // array length left dynamic for sanit
"S_PLAY_SIGN",
// NiGHTS character (uses player sprite)
- "S_PLAY_NIGHTS_TRANS",
+ "S_PLAY_NIGHTS_TRANS1",
"S_PLAY_NIGHTS_TRANS2",
"S_PLAY_NIGHTS_TRANS3",
"S_PLAY_NIGHTS_TRANS4",
"S_PLAY_NIGHTS_TRANS5",
"S_PLAY_NIGHTS_TRANS6",
- "S_PLAY_NIGHTS_TRANS7",
- "S_PLAY_NIGHTS_TRANS8",
- "S_PLAY_NIGHTS_TRANS9",
"S_PLAY_NIGHTS_STAND",
"S_PLAY_NIGHTS_FLOAT",
@@ -3730,6 +3527,20 @@ static const char *const STATE_LIST[] = { // array length left dynamic for sanit
"S_PLAY_NIGHTS_FLYC",
"S_PLAY_NIGHTS_DRILLC",
+ // c:
+ "S_TAILSOVERLAY_STAND",
+ "S_TAILSOVERLAY_0DEGREES",
+ "S_TAILSOVERLAY_PLUS30DEGREES",
+ "S_TAILSOVERLAY_PLUS60DEGREES",
+ "S_TAILSOVERLAY_MINUS30DEGREES",
+ "S_TAILSOVERLAY_MINUS60DEGREES",
+ "S_TAILSOVERLAY_RUN",
+ "S_TAILSOVERLAY_FLY",
+ "S_TAILSOVERLAY_TIRE",
+ "S_TAILSOVERLAY_PAIN",
+ "S_TAILSOVERLAY_GASP",
+ "S_TAILSOVERLAY_EDGE",
+
// Blue Crawla
"S_POSS_STND",
"S_POSS_RUN1",
@@ -4681,6 +4492,8 @@ static const char *const STATE_LIST[] = { // array length left dynamic for sanit
"S_WALLSPIKE5",
"S_WALLSPIKE6",
"S_WALLSPIKEBASE",
+ "S_WALLSPIKED1",
+ "S_WALLSPIKED2",
// Starpost
"S_STARPOST_IDLE",
@@ -4949,18 +4762,62 @@ static const char *const STATE_LIST[] = { // array length left dynamic for sanit
"S_SLING1",
"S_SLING2",
- // CEZ Small Mace Chain
+ // CEZ maces and chains
"S_SMALLMACECHAIN",
-
- // CEZ Big Mace Chain
"S_BIGMACECHAIN",
-
- // CEZ Small Mace
"S_SMALLMACE",
-
- // CEZ Big Mace
"S_BIGMACE",
+ // Yellow spring on a ball
+ "S_YELLOWSPRINGBALL",
+ "S_YELLOWSPRINGBALL2",
+ "S_YELLOWSPRINGBALL3",
+ "S_YELLOWSPRINGBALL4",
+ "S_YELLOWSPRINGBALL5",
+
+ // Red spring on a ball
+ "S_REDSPRINGBALL",
+ "S_REDSPRINGBALL2",
+ "S_REDSPRINGBALL3",
+ "S_REDSPRINGBALL4",
+ "S_REDSPRINGBALL5",
+
+ // Small Firebar
+ "S_SMALLFIREBAR1",
+ "S_SMALLFIREBAR2",
+ "S_SMALLFIREBAR3",
+ "S_SMALLFIREBAR4",
+ "S_SMALLFIREBAR5",
+ "S_SMALLFIREBAR6",
+ "S_SMALLFIREBAR7",
+ "S_SMALLFIREBAR8",
+ "S_SMALLFIREBAR9",
+ "S_SMALLFIREBAR10",
+ "S_SMALLFIREBAR11",
+ "S_SMALLFIREBAR12",
+ "S_SMALLFIREBAR13",
+ "S_SMALLFIREBAR14",
+ "S_SMALLFIREBAR15",
+ "S_SMALLFIREBAR16",
+
+ // Big Firebar
+ "S_BIGFIREBAR1",
+ "S_BIGFIREBAR2",
+ "S_BIGFIREBAR3",
+ "S_BIGFIREBAR4",
+ "S_BIGFIREBAR5",
+ "S_BIGFIREBAR6",
+ "S_BIGFIREBAR7",
+ "S_BIGFIREBAR8",
+ "S_BIGFIREBAR9",
+ "S_BIGFIREBAR10",
+ "S_BIGFIREBAR11",
+ "S_BIGFIREBAR12",
+ "S_BIGFIREBAR13",
+ "S_BIGFIREBAR14",
+ "S_BIGFIREBAR15",
+ "S_BIGFIREBAR16",
+
"S_CEZFLOWER1",
// Big Tumbleweed
@@ -5934,16 +5791,11 @@ static const char *const STATE_LIST[] = { // array length left dynamic for sanit
"S_NIGHTSWING_XMAS",
// NiGHTS Paraloop Powerups
- "S_NIGHTSPOWERUP1",
- "S_NIGHTSPOWERUP2",
- "S_NIGHTSPOWERUP3",
- "S_NIGHTSPOWERUP4",
- "S_NIGHTSPOWERUP5",
- "S_NIGHTSPOWERUP6",
- "S_NIGHTSPOWERUP7",
- "S_NIGHTSPOWERUP8",
- "S_NIGHTSPOWERUP9",
- "S_NIGHTSPOWERUP10",
+ "S_NIGHTSSUPERLOOP",
+ "S_NIGHTSDRILLREFILL",
+ "S_NIGHTSHELPER",
+ "S_NIGHTSEXTRATIME",
+ "S_NIGHTSLINKFREEZE",
"S_EGGCAPSULE",
// Orbiting Chaos Emeralds
@@ -6043,6 +5895,7 @@ static const char *const MOBJTYPE_LIST[] = { // array length left dynamic for s
"MT_THOK", // Thok! mobj
"MT_PLAYER",
+ "MT_TAILSOVERLAY", // c:
// Enemies
"MT_BLUECRAWLA",
@@ -6300,14 +6153,20 @@ static const char *const MOBJTYPE_LIST[] = { // array length left dynamic for s
"MT_FLAMEPARTICLE",
"MT_EGGSTATUE", // Eggman Statue
"MT_MACEPOINT", // Mace rotation point
- "MT_SWINGMACEPOINT", // Mace swinging point
- "MT_HANGMACEPOINT", // Hangable mace chain
- "MT_SPINMACEPOINT", // Spin/Controllable mace chain
+ "MT_CHAINMACEPOINT", // Combination of chains and maces point
+ "MT_SPRINGBALLPOINT", // Spring ball point
+ "MT_CHAINPOINT", // Mace chain
"MT_HIDDEN_SLING", // Spin mace chain (activatable)
+ "MT_FIREBARPOINT", // Firebar
+ "MT_CUSTOMMACEPOINT", // Custom mace
"MT_SMALLMACECHAIN", // Small Mace Chain
"MT_BIGMACECHAIN", // Big Mace Chain
"MT_SMALLMACE", // Small Mace
"MT_BIGMACE", // Big Mace
+ "MT_YELLOWSPRINGBALL", // Yellow spring on a ball
+ "MT_REDSPRINGBALL", // Red spring on a ball
+ "MT_SMALLFIREBAR", // Small Firebar
+ "MT_BIGFIREBAR", // Big Firebar
"MT_CEZFLOWER",
// Arid Canyon Scenery
@@ -6660,6 +6519,7 @@ static const char *const MOBJFLAG2_LIST[] = {
"AMBUSH", // Alternate behaviour typically set by MTF_AMBUSH
"LINKDRAW", // Draw vissprite of mobj immediately before/after tracer's vissprite (dependent on dispoffset and position)
"SHIELD", // Thinker calls P_AddShield/P_ShieldLook (must be partnered with MF_SCENERY to use)
+ "MACEROTATE", // Thinker calls P_MaceRotate around tracer
NULL
};
@@ -6687,8 +6547,12 @@ static const char *const MAPTHINGFLAG_LIST[4] = {
#endif
static const char *const PLAYERFLAG_LIST[] = {
- // Flip camera angle with gravity flip prefrence.
- "FLIPCAM",
+
+ // Cvars
+ "FLIPCAM", // Flip camera angle with gravity flip prefrence.
+ "ANALOGMODE", // Analog mode?
+ "DIRECTIONCHAR", // Directional character sprites?
+ "AUTOBRAKE", // Autobrake?
// Cheats
"GODMODE",
@@ -6706,41 +6570,36 @@ static const char *const PLAYERFLAG_LIST[] = {
"JUMPSTASIS", // and that includes jumping.
// (we don't include FULLSTASIS here I guess because it's just those two together...?)
- // Did you get a time-over?
- "TIMEOVER",
+ // Applying autobrake?
+ "APPLYAUTOBRAKE",
// Character action status
"STARTJUMP",
"JUMPED",
+ "NOJUMPDAMAGE",
+
"SPINNING",
"STARTDASH",
- "THOKKED",
- // Are you gliding?
+ "THOKKED",
+ "SHIELDABILITY",
"GLIDING",
+ "BOUNCING",
// Sliding (usually in water) like Labyrinth/Oil Ocean
"SLIDING",
- // Bouncing
- "BOUNCING",
-
- /*** NIGHTS STUFF ***/
+ // NiGHTS stuff
"TRANSFERTOCLOSEST",
- "NIGHTSFALL",
"DRILLING",
- "SKIDDOWN",
- /*** TAG STUFF ***/
- "TAGGED", // Player has been tagged and awaits the next round in hide and seek.
+ // Gametype-specific stuff
+ "GAMETYPEOVER", // Race time over, or H&S out-of-game
"TAGIT", // The player is it! For Tag Mode
/*** misc ***/
"FORCESTRAFE", // Translate turn inputs into strafe inputs
- "ANALOGMODE", // Analog mode?
"CANCARRY", // Can carry?
- "SHIELDABILITY", // Thokked with shield ability
- "NOJUMPDAMAGE", // No jump damage
NULL // stop loop here.
};
@@ -6770,91 +6629,130 @@ static const char *const ML_LIST[16] = {
// This DOES differ from r_draw's Color_Names, unfortunately.
// Also includes Super colors
static const char *COLOR_ENUMS[] = {
- "NONE", // SKINCOLOR_NONE
- "WHITE", // SKINCOLOR_WHITE
- "SILVER", // SKINCOLOR_SILVER
- "GREY", // SKINCOLOR_GREY
- "BLACK", // SKINCOLOR_BLACK
- "BEIGE", // SKINCOLOR_BEIGE
- "PEACH", // SKINCOLOR_PEACH
- "BROWN", // SKINCOLOR_BROWN
- "RED", // SKINCOLOR_RED
- "CRIMSON", // SKINCOLOR_CRIMSON
- "ORANGE", // SKINCOLOR_ORANGE
- "RUST", // SKINCOLOR_RUST
- "GOLD", // SKINCOLOR_GOLD
- "YELLOW", // SKINCOLOR_YELLOW
- "TAN", // SKINCOLOR_TAN
- "MOSS", // SKINCOLOR_MOSS
- "PERIDOT", // SKINCOLOR_PERIDOT
- "GREEN", // SKINCOLOR_GREEN
- "EMERALD", // SKINCOLOR_EMERALD
- "AQUA", // SKINCOLOR_AQUA
- "TEAL", // SKINCOLOR_TEAL
- "CYAN", // SKINCOLOR_CYAN
- "BLUE", // SKINCOLOR_BLUE
- "AZURE", // SKINCOLOR_AZURE
- "PASTEL", // SKINCOLOR_PASTEL
- "PURPLE", // SKINCOLOR_PURPLE
- "LAVENDER", // SKINCOLOR_LAVENDER
- "MAGENTA", // SKINCOLOR_MAGENTA
- "PINK", // SKINCOLOR_PINK
- "ROSY", // SKINCOLOR_ROSY
+ "NONE", // SKINCOLOR_NONE,
+
+ // Greyscale ranges
+ "WHITE", // SKINCOLOR_WHITE,
+ "BONE", // SKINCOLOR_BONE,
+ "CLOUDY", // SKINCOLOR_CLOUDY,
+ "GREY", // SKINCOLOR_GREY,
+ "SILVER", // SKINCOLOR_SILVER,
+ "CARBON", // SKINCOLOR_CARBON,
+ "JET", // SKINCOLOR_JET,
+ "BLACK", // SKINCOLOR_BLACK,
+
+ // Desaturated
+ "AETHER", // SKINCOLOR_AETHER,
+ "SLATE", // SKINCOLOR_SLATE,
+ "PINK", // SKINCOLOR_PINK,
+ "YOGURT", // SKINCOLOR_YOGURT,
+ "BROWN", // SKINCOLOR_BROWN,
+ "TAN", // SKINCOLOR_TAN,
+ "BEIGE", // SKINCOLOR_BEIGE,
+ "MOSS", // SKINCOLOR_MOSS,
+ "AZURE", // SKINCOLOR_AZURE,
+ "LAVENDER", // SKINCOLOR_LAVENDER,
+
+ // Viv's vivid colours (toast 21/07/17)
+ "RUBY", // SKINCOLOR_RUBY,
+ "SALMON", // SKINCOLOR_SALMON,
+ "RED", // SKINCOLOR_RED,
+ "CRIMSON", // SKINCOLOR_CRIMSON,
+ "FLAME", // SKINCOLOR_FLAME,
+ "PEACHY", // SKINCOLOR_PEACHY,
+ "QUAIL", // SKINCOLOR_QUAIL,
+ "SUNSET", // SKINCOLOR_SUNSET,
+ "APRICOT", // SKINCOLOR_APRICOT,
+ "ORANGE", // SKINCOLOR_ORANGE,
+ "RUST", // SKINCOLOR_RUST,
+ "GOLD", // SKINCOLOR_GOLD,
+ "SANDY", // SKINCOLOR_SANDY,
+ "YELLOW", // SKINCOLOR_YELLOW,
+ "OLIVE", // SKINCOLOR_OLIVE,
+ "LIME", // SKINCOLOR_LIME,
+ "PERIDOT", // SKINCOLOR_PERIDOT,
+ "GREEN", // SKINCOLOR_GREEN,
+ "FOREST", // SKINCOLOR_FOREST,
+ "EMERALD", // SKINCOLOR_EMERALD,
+ "MINT", // SKINCOLOR_MINT,
+ "SEAFOAM", // SKINCOLOR_SEAFOAM,
+ "AQUA", // SKINCOLOR_AQUA,
+ "TEAL", // SKINCOLOR_TEAL,
+ "WAVE", // SKINCOLOR_WAVE,
+ "CYAN", // SKINCOLOR_CYAN,
+ "SKY", // SKINCOLOR_SKY,
+ "CERULEAN", // SKINCOLOR_CERULEAN,
+ "ICY", // SKINCOLOR_ICY,
+ "SAPPHIRE", // SKINCOLOR_SAPPHIRE,
+ "CORNFLOWER", // SKINCOLOR_CORNFLOWER,
+ "BLUE", // SKINCOLOR_BLUE,
+ "COBALT", // SKINCOLOR_COBALT,
+ "VAPOR", // SKINCOLOR_VAPOR,
+ "DUSK", // SKINCOLOR_DUSK,
+ "PASTEL", // SKINCOLOR_PASTEL,
+ "PURPLE", // SKINCOLOR_PURPLE,
+ "BUBBLEGUM", // SKINCOLOR_BUBBLEGUM,
+ "MAGENTA", // SKINCOLOR_MAGENTA,
+ "NEON", // SKINCOLOR_NEON,
+ "VIOLET", // SKINCOLOR_VIOLET,
+ "LILAC", // SKINCOLOR_LILAC,
+ "PLUM", // SKINCOLOR_PLUM,
+ "ROSY", // SKINCOLOR_ROSY,
// Super special awesome Super flashing colors!
- "SUPERSILVER1", // SKINCOLOR_SUPERSILVER1
- "SUPERSILVER2", // SKINCOLOR_SUPERSILVER2,
- "SUPERSILVER3", // SKINCOLOR_SUPERSILVER3,
- "SUPERSILVER4", // SKINCOLOR_SUPERSILVER4,
- "SUPERSILVER5", // SKINCOLOR_SUPERSILVER5,
+ "SUPERSILVER1", // SKINCOLOR_SUPERSILVER1
+ "SUPERSILVER2", // SKINCOLOR_SUPERSILVER2,
+ "SUPERSILVER3", // SKINCOLOR_SUPERSILVER3,
+ "SUPERSILVER4", // SKINCOLOR_SUPERSILVER4,
+ "SUPERSILVER5", // SKINCOLOR_SUPERSILVER5,
- "SUPERRED1", // SKINCOLOR_SUPERRED1
- "SUPERRED2", // SKINCOLOR_SUPERRED2,
- "SUPERRED3", // SKINCOLOR_SUPERRED3,
- "SUPERRED4", // SKINCOLOR_SUPERRED4,
- "SUPERRED5", // SKINCOLOR_SUPERRED5,
+ "SUPERRED1", // SKINCOLOR_SUPERRED1
+ "SUPERRED2", // SKINCOLOR_SUPERRED2,
+ "SUPERRED3", // SKINCOLOR_SUPERRED3,
+ "SUPERRED4", // SKINCOLOR_SUPERRED4,
+ "SUPERRED5", // SKINCOLOR_SUPERRED5,
- "SUPERORANGE1", // SKINCOLOR_SUPERORANGE1
- "SUPERORANGE2", // SKINCOLOR_SUPERORANGE2,
- "SUPERORANGE3", // SKINCOLOR_SUPERORANGE3,
- "SUPERORANGE4", // SKINCOLOR_SUPERORANGE4,
- "SUPERORANGE5", // SKINCOLOR_SUPERORANGE5,
+ "SUPERORANGE1", // SKINCOLOR_SUPERORANGE1
+ "SUPERORANGE2", // SKINCOLOR_SUPERORANGE2,
+ "SUPERORANGE3", // SKINCOLOR_SUPERORANGE3,
+ "SUPERORANGE4", // SKINCOLOR_SUPERORANGE4,
+ "SUPERORANGE5", // SKINCOLOR_SUPERORANGE5,
- "SUPERGOLD1", // SKINCOLOR_SUPERGOLD1
- "SUPERGOLD2", // SKINCOLOR_SUPERGOLD2,
- "SUPERGOLD3", // SKINCOLOR_SUPERGOLD3,
- "SUPERGOLD4", // SKINCOLOR_SUPERGOLD4,
- "SUPERGOLD5", // SKINCOLOR_SUPERGOLD5,
+ "SUPERGOLD1", // SKINCOLOR_SUPERGOLD1
+ "SUPERGOLD2", // SKINCOLOR_SUPERGOLD2,
+ "SUPERGOLD3", // SKINCOLOR_SUPERGOLD3,
+ "SUPERGOLD4", // SKINCOLOR_SUPERGOLD4,
+ "SUPERGOLD5", // SKINCOLOR_SUPERGOLD5,
- "SUPERPERIDOT1", // SKINCOLOR_SUPERPERIDOT1
- "SUPERPERIDOT2", // SKINCOLOR_SUPERPERIDOT2,
- "SUPERPERIDOT3", // SKINCOLOR_SUPERPERIDOT3,
- "SUPERPERIDOT4", // SKINCOLOR_SUPERPERIDOT4,
- "SUPERPERIDOT5", // SKINCOLOR_SUPERPERIDOT5,
+ "SUPERPERIDOT1", // SKINCOLOR_SUPERPERIDOT1
+ "SUPERPERIDOT2", // SKINCOLOR_SUPERPERIDOT2,
+ "SUPERPERIDOT3", // SKINCOLOR_SUPERPERIDOT3,
+ "SUPERPERIDOT4", // SKINCOLOR_SUPERPERIDOT4,
+ "SUPERPERIDOT5", // SKINCOLOR_SUPERPERIDOT5,
- "SUPERCYAN1", // SKINCOLOR_SUPERCYAN1
- "SUPERCYAN2", // SKINCOLOR_SUPERCYAN2,
- "SUPERCYAN3", // SKINCOLOR_SUPERCYAN3,
- "SUPERCYAN4", // SKINCOLOR_SUPERCYAN4,
- "SUPERCYAN5", // SKINCOLOR_SUPERCYAN5,
+ "SUPERSKY1", // SKINCOLOR_SUPERSKY1
+ "SUPERSKY2", // SKINCOLOR_SUPERSKY2,
+ "SUPERSKY3", // SKINCOLOR_SUPERSKY3,
+ "SUPERSKY4", // SKINCOLOR_SUPERSKY4,
+ "SUPERSKY5", // SKINCOLOR_SUPERSKY5,
- "SUPERPURPLE1", // SKINCOLOR_SUPERPURPLE1,
- "SUPERPURPLE2", // SKINCOLOR_SUPERPURPLE2,
- "SUPERPURPLE3", // SKINCOLOR_SUPERPURPLE3,
- "SUPERPURPLE4", // SKINCOLOR_SUPERPURPLE4,
- "SUPERPURPLE5", // SKINCOLOR_SUPERPURPLE5,
+ "SUPERPURPLE1", // SKINCOLOR_SUPERPURPLE1,
+ "SUPERPURPLE2", // SKINCOLOR_SUPERPURPLE2,
+ "SUPERPURPLE3", // SKINCOLOR_SUPERPURPLE3,
+ "SUPERPURPLE4", // SKINCOLOR_SUPERPURPLE4,
+ "SUPERPURPLE5", // SKINCOLOR_SUPERPURPLE5,
- "SUPERRUST1", // SKINCOLOR_SUPERRUST1
- "SUPERRUST2", // SKINCOLOR_SUPERRUST2,
- "SUPERRUST3", // SKINCOLOR_SUPERRUST3,
- "SUPERRUST4", // SKINCOLOR_SUPERRUST4,
- "SUPERRUST5", // SKINCOLOR_SUPERRUST5,
+ "SUPERRUST1", // SKINCOLOR_SUPERRUST1
+ "SUPERRUST2", // SKINCOLOR_SUPERRUST2,
+ "SUPERRUST3", // SKINCOLOR_SUPERRUST3,
+ "SUPERRUST4", // SKINCOLOR_SUPERRUST4,
+ "SUPERRUST5", // SKINCOLOR_SUPERRUST5,
- "SUPERTAN1", // SKINCOLOR_SUPERTAN1
- "SUPERTAN2", // SKINCOLOR_SUPERTAN2,
- "SUPERTAN3", // SKINCOLOR_SUPERTAN3,
- "SUPERTAN4", // SKINCOLOR_SUPERTAN4,
- "SUPERTAN5" // SKINCOLOR_SUPERTAN5,
+ "SUPERTAN1", // SKINCOLOR_SUPERTAN1
+ "SUPERTAN2", // SKINCOLOR_SUPERTAN2,
+ "SUPERTAN3", // SKINCOLOR_SUPERTAN3,
+ "SUPERTAN4", // SKINCOLOR_SUPERTAN4,
+ "SUPERTAN5" // SKINCOLOR_SUPERTAN5,
};
static const char *const POWERS_LIST[] = {
@@ -6867,6 +6765,7 @@ static const char *const POWERS_LIST[] = {
"UNDERWATER", // underwater timer
"SPACETIME", // In space, no one can hear you spin!
"EXTRALIFE", // Extra Life timer
+ "PUSHING",
"SUPER", // Are you super?
"GRAVITYBOOTS", // gravity boots
@@ -7046,6 +6945,7 @@ struct {
{"LF_NOSSMUSIC",LF_NOSSMUSIC},
{"LF_NORELOAD",LF_NORELOAD},
{"LF_NOZONE",LF_NOZONE},
+ {"LF_SAVEGAME",LF_SAVEGAME},
// And map flags
{"LF2_HIDEINMENU",LF2_HIDEINMENU},
{"LF2_HIDEINSTATS",LF2_HIDEINSTATS},
@@ -7091,6 +6991,7 @@ struct {
{"SH_PROTECTFIRE",SH_PROTECTFIRE},
{"SH_PROTECTWATER",SH_PROTECTWATER},
{"SH_PROTECTELECTRIC",SH_PROTECTELECTRIC},
+ {"SH_PROTECTSPIKE",SH_PROTECTSPIKE},
// Indivisible shields
{"SH_PITY",SH_PITY},
{"SH_WHIRLWIND",SH_WHIRLWIND},
@@ -7115,6 +7016,7 @@ struct {
{"CR_GENERIC",CR_GENERIC},
{"CR_PLAYER",CR_PLAYER},
{"CR_NIGHTSMODE",CR_NIGHTSMODE},
+ {"CR_NIGHTSFALL",CR_NIGHTSFALL},
{"CR_BRAKGOOP",CR_BRAKGOOP},
{"CR_ZOOMTUBE",CR_ZOOMTUBE},
{"CR_ROPEHANG",CR_ROPEHANG},
@@ -7178,12 +7080,16 @@ struct {
{"SF_X8AWAYSOUND",SF_X8AWAYSOUND},
{"SF_NOINTERRUPT",SF_NOINTERRUPT},
{"SF_X2AWAYSOUND",SF_X2AWAYSOUND},
-
+
+ // Global emblem var flags
+ {"GE_NIGHTSPULL",GE_NIGHTSPULL},
+ {"GE_NIGHTSITEM",GE_NIGHTSITEM},
+
// Map emblem var flags
{"ME_ALLEMERALDS",ME_ALLEMERALDS},
{"ME_ULTIMATE",ME_ULTIMATE},
{"ME_PERFECT",ME_PERFECT},
-
+
#ifdef HAVE_BLUA
// p_local.h constants
{"FLOATSPEED",FLOATSPEED},
@@ -7510,6 +7416,20 @@ static spritenum_t get_sprite(const char *word)
return SPR_NULL;
}
+static playersprite_t get_sprite2(const char *word)
+{ // Returns the value of SPR2_ enumerations
+ playersprite_t i;
+ if (*word >= '0' && *word <= '9')
+ return atoi(word);
+ if (fastncmp("SPR2_",word,5))
+ word += 5; // take off the SPR2_
+ for (i = 0; i < NUMPLAYERSPRITES; i++)
+ if (!spr2names[i][4] && memcmp(word,spr2names[i],4)==0)
+ return i;
+ deh_warning("Couldn't find sprite named 'SPR2_%s'",word);
+ return SPR2_STND;
+}
+
static sfxenum_t get_sfx(const char *word)
{ // Returns the value of SFX_ enumerations
sfxenum_t i;
@@ -7860,11 +7780,14 @@ void FUNCMATH DEH_Check(void)
static inline int lib_freeslot(lua_State *L)
{
int n = lua_gettop(L);
- int r = 0; // args returned
+ int r = 0; // args returned
char *s, *type,*word;
- while (n-- > 0)
- {
+ if (!lua_lumploading)
+ return luaL_error(L, "This function cannot be called from within a hook or coroutine!");
+
+ while (n-- > 0)
+ {
s = Z_StrDup(luaL_checkstring(L,1));
type = strtok(s, "_");
if (type)
@@ -7952,7 +7875,7 @@ static inline int lib_freeslot(lua_State *L)
else if (fastcmp(type, "SPR2"))
{
// Search if we already have an SPR2 by that name...
- enum playersprite i;
+ playersprite_t i;
for (i = SPR2_FIRSTFREESLOT; i < free_spr2; i++)
if (memcmp(spr2names[i],word,4) == 0)
break;
@@ -8131,7 +8054,7 @@ static inline int lib_getenum(lua_State *L)
if (mathlib) return luaL_error(L, "sprite '%s' could not be found.\n", word);
return 0;
}
- else if (fastncmp("SPR2_",word,4)) {
+ else if (fastncmp("SPR2_",word,5)) {
p = word+5;
for (i = 0; i < (fixed_t)free_spr2; i++)
if (!spr2names[i][4])
@@ -8336,6 +8259,12 @@ static inline int lib_getenum(lua_State *L)
} else if (fastcmp(word,"paused")) {
lua_pushboolean(L, paused);
return 1;
+ } else if (fastcmp(word,"titlemap")) {
+ lua_pushinteger(L, titlemap);
+ return 1;
+ } else if (fastcmp(word,"titlemapinaction")) {
+ lua_pushboolean(L, (titlemapinaction != TITLEMAP_OFF));
+ return 1;
} else if (fastcmp(word,"gametype")) {
lua_pushinteger(L, gametype);
return 1;
diff --git a/src/dehacked.h b/src/dehacked.h
index 8832216b8..dfce996a2 100644
--- a/src/dehacked.h
+++ b/src/dehacked.h
@@ -27,13 +27,6 @@ typedef enum
UNDO_DONE = 0,
} undotype_f;
-#ifdef DELFILE
-void DEH_WriteUndoline(const char *value, const char *data, undotype_f flags);
-void DEH_UnloadDehackedWad(UINT16 wad);
-#else // null the undo lines
-#define DEH_WriteUndoline(a,b,c)
-#endif
-
void DEH_LoadDehackedLump(lumpnum_t lumpnum);
void DEH_LoadDehackedLumpPwad(UINT16 wad, UINT16 lump);
diff --git a/src/doomdata.h b/src/doomdata.h
index 033cc71b3..c0586fd65 100644
--- a/src/doomdata.h
+++ b/src/doomdata.h
@@ -207,8 +207,9 @@ typedef struct
#define ZSHIFT 4
+extern const UINT8 Color_Index[MAXTRANSLATIONS-1][16];
extern const char *Color_Names[MAXSKINCOLORS + NUMSUPERCOLORS];
-extern const UINT8 Color_Opposite[MAXSKINCOLORS*2];
+extern const UINT8 Color_Opposite[(MAXSKINCOLORS - 1)*2];
#define NUMMAPS 1035
diff --git a/src/doomdef.h b/src/doomdef.h
index 16d7fa218..a49fb0207 100644
--- a/src/doomdef.h
+++ b/src/doomdef.h
@@ -28,13 +28,11 @@
// Use Mixer interface?
#ifdef HAVE_MIXER
- //#if !defined(DC) && !defined(_WIN32_WCE) && !defined(_XBOX) && !defined(GP2X)
#define SOUND SOUND_MIXER
#define NOHS // No HW3SOUND
#ifdef HW3SOUND
#undef HW3SOUND
#endif
- //#endif
#endif
// Use generic SDL interface.
@@ -70,7 +68,7 @@
#endif
#endif
-#if defined (_WIN32) || defined (_WIN32_WCE)
+#ifdef _WIN32
#define ASMCALL __cdecl
#else
#define ASMCALL
@@ -87,13 +85,6 @@
// warning C4152: nonstandard extension, function/data pointer conversion in expression
// warning C4213: nonstandard extension used : cast on l-value
-#if defined (_WIN32_WCE) && defined (DEBUG) && defined (ARM)
-#if defined (ARMV4) || defined (ARMV4I)
-//#pragma warning(disable : 1166)
-// warning LNK1166: cannot adjust code at offset=
-#endif
-#endif
-
#include "doomtype.h"
@@ -110,13 +101,11 @@
#include
#endif
-#if !defined (_WIN32_WCE)
#include
#include
-#endif
#include
-#if ((defined (_WIN32) && !defined (_WIN32_WCE)) || defined (__DJGPP__)) && !defined (_XBOX)
+#if defined (_WIN32) || defined (__DJGPP__)
#include
#endif
@@ -229,39 +218,77 @@ extern FILE *logstream;
typedef enum
{
SKINCOLOR_NONE = 0,
+
+ // Greyscale ranges
SKINCOLOR_WHITE,
- SKINCOLOR_SILVER,
+ SKINCOLOR_BONE,
+ SKINCOLOR_CLOUDY,
SKINCOLOR_GREY,
+ SKINCOLOR_SILVER,
+ SKINCOLOR_CARBON,
+ SKINCOLOR_JET,
SKINCOLOR_BLACK,
- SKINCOLOR_BEIGE,
- SKINCOLOR_PEACH,
+
+ // Desaturated
+ SKINCOLOR_AETHER,
+ SKINCOLOR_SLATE,
+ SKINCOLOR_PINK,
+ SKINCOLOR_YOGURT,
SKINCOLOR_BROWN,
+ SKINCOLOR_TAN,
+ SKINCOLOR_BEIGE,
+ SKINCOLOR_MOSS,
+ SKINCOLOR_AZURE,
+ SKINCOLOR_LAVENDER,
+
+ // Viv's vivid colours (toast 21/07/17)
+ SKINCOLOR_RUBY,
+ SKINCOLOR_SALMON,
SKINCOLOR_RED,
SKINCOLOR_CRIMSON,
+ SKINCOLOR_FLAME,
+ SKINCOLOR_PEACHY,
+ SKINCOLOR_QUAIL,
+ SKINCOLOR_SUNSET,
+ SKINCOLOR_APRICOT,
SKINCOLOR_ORANGE,
SKINCOLOR_RUST,
SKINCOLOR_GOLD,
+ SKINCOLOR_SANDY,
SKINCOLOR_YELLOW,
- SKINCOLOR_TAN,
- SKINCOLOR_MOSS,
+ SKINCOLOR_OLIVE,
+ SKINCOLOR_LIME,
SKINCOLOR_PERIDOT,
SKINCOLOR_GREEN,
+ SKINCOLOR_FOREST,
SKINCOLOR_EMERALD,
+ SKINCOLOR_MINT,
+ SKINCOLOR_SEAFOAM,
SKINCOLOR_AQUA,
SKINCOLOR_TEAL,
+ SKINCOLOR_WAVE,
SKINCOLOR_CYAN,
+ SKINCOLOR_SKY,
+ SKINCOLOR_CERULEAN,
+ SKINCOLOR_ICY,
+ SKINCOLOR_SAPPHIRE, // sweet mother, i cannot weave – slender aphrodite has overcome me with longing for a girl
+ SKINCOLOR_CORNFLOWER,
SKINCOLOR_BLUE,
- SKINCOLOR_AZURE,
+ SKINCOLOR_COBALT,
+ SKINCOLOR_VAPOR,
+ SKINCOLOR_DUSK,
SKINCOLOR_PASTEL,
SKINCOLOR_PURPLE,
- SKINCOLOR_LAVENDER,
+ SKINCOLOR_BUBBLEGUM,
SKINCOLOR_MAGENTA,
- SKINCOLOR_PINK,
+ SKINCOLOR_NEON,
+ SKINCOLOR_VIOLET,
+ SKINCOLOR_LILAC,
+ SKINCOLOR_PLUM,
SKINCOLOR_ROSY,
- //SKINCOLOR_?
- //SKINCOLOR_?
- // Careful! MAXSKINCOLORS cannot be greater than 0x20! Two slots left...
+ // SKINCOLOR_? - one left before we bump up against 0x39, which isn't a HARD limit anymore but would be excessive
+
MAXSKINCOLORS,
// Super special awesome Super flashing colors!
@@ -295,11 +322,11 @@ typedef enum
SKINCOLOR_SUPERPERIDOT4,
SKINCOLOR_SUPERPERIDOT5,
- SKINCOLOR_SUPERCYAN1,
- SKINCOLOR_SUPERCYAN2,
- SKINCOLOR_SUPERCYAN3,
- SKINCOLOR_SUPERCYAN4,
- SKINCOLOR_SUPERCYAN5,
+ SKINCOLOR_SUPERSKY1,
+ SKINCOLOR_SUPERSKY2,
+ SKINCOLOR_SUPERSKY3,
+ SKINCOLOR_SUPERSKY4,
+ SKINCOLOR_SUPERSKY5,
SKINCOLOR_SUPERPURPLE1,
SKINCOLOR_SUPERPURPLE2,
@@ -343,13 +370,11 @@ enum {
};
// Name of local directory for config files and savegames
-#if !defined(_arch_dreamcast) && !defined(_WIN32_WCE) && !defined(GP2X) && !defined(_WII) && !defined(_PS3)
#if (((defined (__unix__) && !defined (MSDOS)) || defined (UNIXCOMMON)) && !defined (__CYGWIN__)) && !defined (__APPLE__)
#define DEFAULTDIR ".srb2"
#else
#define DEFAULTDIR "srb2"
#endif
-#endif
#include "g_state.h"
@@ -483,10 +508,6 @@ extern const char *compdate, *comptime, *comprevision, *compbranch;
#define ESLOPE_TYPESHIM
#endif
-/// Delete file while the game is running.
-/// \note EXTREMELY buggy, tends to crash game.
-//#define DELFILE
-
/// Allows the use of devmode in multiplayer. AKA "fishcake"
//#define NETGAME_DEVMODE
@@ -514,19 +535,15 @@ extern const char *compdate, *comptime, *comprevision, *compbranch;
/// Most modifications should probably enable this.
//#define SAVEGAME_OTHERVERSIONS
-#if !defined (_NDS) && !defined (_PSP)
/// Shuffle's incomplete OpenGL sorting code.
#define SHUFFLE // This has nothing to do with sorting, why was it disabled?
-#endif
-#if !defined (_NDS) && !defined (_PSP)
/// Allow the use of the SOC RESETINFO command.
/// \note Builds that are tight on memory should disable this.
/// This stops the game from storing backups of the states, sprites, and mobjinfo tables.
/// Though this info is compressed under normal circumstances, it's still a lot of extra
/// memory that never gets touched.
#define ALLOW_RESETDATA
-#endif
#ifndef NONET
/// Display a connection screen on join attempts.
@@ -546,6 +563,13 @@ extern const char *compdate, *comptime, *comprevision, *compbranch;
/// Hudname padding.
#define SKINNAMEPADDING
+/// FINALLY some real clipping that doesn't make walls dissappear AND speeds the game up
+/// (that was the original comment from SRB2CB, sadly it is a lie and actually slows game down)
+/// on the bright side it fixes some weird issues with translucent walls
+/// \note SRB2CB port.
+/// SRB2CB itself ported this from PrBoom+
+#define NEWCLIP
+
/// Handle touching sector specials in P_PlayerAfterThink instead of P_PlayerThink.
/// \note Required for proper collision with moving sloped surfaces that have sector specials on them.
//#define SECTORSPECIALSAFTERTHINK
diff --git a/src/doomstat.h b/src/doomstat.h
index 662bfa7c4..51d385203 100644
--- a/src/doomstat.h
+++ b/src/doomstat.h
@@ -41,9 +41,14 @@ extern INT16 maptol;
extern UINT8 globalweather;
extern INT32 curWeather;
extern INT32 cursaveslot;
-extern INT16 lastmapsaved;
+//extern INT16 lastmapsaved;
+extern INT16 lastmaploaded;
extern boolean gamecomplete;
+#define maxgameovers 13
+extern UINT8 numgameovers;
+extern SINT8 startinglivesbalance[maxgameovers+1];
+
#define PRECIP_NONE 0
#define PRECIP_STORM 1
#define PRECIP_SNOW 2
@@ -124,6 +129,10 @@ extern INT16 spstage_start;
extern INT16 sstage_start;
extern INT16 sstage_end;
+extern INT16 titlemap;
+extern boolean hidetitlepics;
+extern INT16 bootmap; //bootmap for loading a map on startup
+
extern boolean looptitle;
extern boolean useNightsSS;
@@ -263,6 +272,7 @@ typedef struct
#define LF_NOSSMUSIC 4 ///< Disable Super Sonic music
#define LF_NORELOAD 8 ///< Don't reload level on death
#define LF_NOZONE 16 ///< Don't include "ZONE" on level title
+#define LF_SAVEGAME 32 ///< Save the game upon loading this level
#define LF2_HIDEINMENU 1 ///< Hide in the multiplayer menu
#define LF2_HIDEINSTATS 2 ///< Hide in the statistics screen
diff --git a/src/doomtype.h b/src/doomtype.h
index a711b466d..b0623de9a 100644
--- a/src/doomtype.h
+++ b/src/doomtype.h
@@ -17,16 +17,12 @@
#ifndef __DOOMTYPE__
#define __DOOMTYPE__
-#if (defined (_WIN32) && !defined (_XBOX)) || (defined (_WIN32_WCE) && !defined (__GNUC__))
+#ifdef _WIN32
//#define WIN32_LEAN_AND_MEAN
#define RPC_NO_WINDOWS_H
#include
#endif
-#ifdef _NDS
-#include
-#endif
-
/* 7.18.1.1 Exact-width integer types */
#ifdef _MSC_VER
#define UINT8 unsigned __int8
@@ -51,19 +47,6 @@ typedef long ssize_t;
#if ((_MSC_VER <= 1200) && (!defined(PDWORD_PTR)))
#define PDWORD_PTR PDWORD
#endif
-#elif defined (_arch_dreamcast) // KOS Dreamcast
-#include
-
-#define UINT8 unsigned char
-#define SINT8 signed char
-
-#define UINT16 uint16
-#define INT16 int16
-
-#define INT32 int
-#define UINT32 unsigned int
-#define INT64 int64
-#define UINT64 uint64
#elif defined (__DJGPP__)
#define UINT8 unsigned char
#define SINT8 signed char
@@ -97,15 +80,13 @@ typedef long ssize_t;
#define NOIPX
#endif
-#if defined (_MSC_VER) || defined (__OS2__)
- // Microsoft VisualC++
#ifdef _MSC_VER
+ // Microsoft VisualC++
#if (_MSC_VER <= 1800) // MSVC 2013 and back
#define snprintf _snprintf
#if (_MSC_VER <= 1200) // MSVC 2012 and back
#define vsnprintf _vsnprintf
#endif
-#endif
#endif
#define strncasecmp strnicmp
#define strcasecmp stricmp
@@ -118,23 +99,12 @@ typedef long ssize_t;
#define strncasecmp strnicmp
#define strcasecmp strcmpi
#endif
-#ifdef _PSP
- #include
-#elif (defined (__unix__) && !defined (MSDOS)) || defined(__APPLE__) || defined (UNIXCOMMON)
+#if (defined (__unix__) && !defined (MSDOS)) || defined(__APPLE__) || defined (UNIXCOMMON)
#undef stricmp
#define stricmp(x,y) strcasecmp(x,y)
#undef strnicmp
#define strnicmp(x,y,n) strncasecmp(x,y,n)
#endif
-#ifdef _WIN32_WCE
-#ifndef __GNUC__
- #define stricmp(x,y) _stricmp(x,y)
- #define strnicmp _strnicmp
-#endif
- #define strdup _strdup
- #define strupr _strupr
- #define strlwr _strlwr
-#endif
#if defined (macintosh) //|| defined (__APPLE__) //skip all boolean/Boolean crap
#define true 1
@@ -154,7 +124,7 @@ typedef long ssize_t;
#endif
#endif //macintosh
-#if defined (PC_DOS) || defined (_WIN32) || defined (_WII) || defined (_PSP) || defined (_arch_dreamcast) || defined (__HAIKU__) || defined(_NDS) || defined(_PS3)
+#if defined (PC_DOS) || defined (_WIN32) || defined (__HAIKU__)
#define HAVE_DOSSTR_FUNCS
#endif
@@ -186,15 +156,10 @@ size_t strlcpy(char *dst, const char *src, size_t siz);
//faB: clean that up !!
#if defined( _MSC_VER) && (_MSC_VER >= 1800) // MSVC 2013 and forward
#include "stdbool.h"
- #elif (defined (_WIN32) || (defined (_WIN32_WCE) && !defined (__GNUC__))) && !defined (_XBOX)
+ #elif defined (_WIN32)
#define false FALSE // use windows types
#define true TRUE
#define boolean BOOL
- #elif defined(_NDS)
- #define boolean bool
- #elif defined(_PS3) // defined(__GNUC__)?
- #include //_bool_true_false_are_defined?
- #define boolean bool
#else
typedef enum {false, true} boolean;
#endif
@@ -317,10 +282,6 @@ typedef UINT32 tic_t;
#define ATTRPACK __attribute__((packed))
#endif
#define ATTRUNUSED __attribute__((unused))
-#ifdef _XBOX
-#define FILESTAMP I_OutputMsg("%s:%d\n",__FILE__,__LINE__);
-#define XBOXSTATIC static
-#endif
#elif defined (_MSC_VER)
#define ATTRNORETURN __declspec(noreturn)
#define ATTRINLINE __forceinline
@@ -374,10 +335,4 @@ typedef UINT32 tic_t;
#ifndef ATTRNOINLINE
#define ATTRNOINLINE
#endif
-#ifndef XBOXSTATIC
-#define XBOXSTATIC
-#endif
-#ifndef FILESTAMP
-#define FILESTAMP
-#endif
#endif //__DOOMTYPE__
diff --git a/src/f_finale.c b/src/f_finale.c
index db497daf7..05c3d5fc0 100644
--- a/src/f_finale.c
+++ b/src/f_finale.c
@@ -31,11 +31,18 @@
#include "m_random.h"
#include "y_inter.h"
#include "m_cond.h"
+#include "p_local.h"
+#include "p_setup.h"
+
+#ifdef HAVE_BLUA
+#include "lua_hud.h"
+#endif
// Stage of animation:
// 0 = text, 1 = art screen
static INT32 finalecount;
INT32 titlescrollspeed = 80;
+UINT8 titlemapinaction = TITLEMAP_OFF;
static INT32 timetonext; // Delay between screen changes
static INT32 continuetime; // Short delay when continuing
@@ -217,17 +224,19 @@ static void F_SkyScroll(INT32 scrollspeed)
{
INT32 scrolled, x, mx, fakedwidth;
patch_t *pat;
+ INT16 patwidth;
pat = W_CachePatchName("TITLESKY", PU_CACHE);
- animtimer = ((finalecount*scrollspeed)/16) % SHORT(pat->width);
+ patwidth = SHORT(pat->width);
+ animtimer = ((finalecount*scrollspeed)/16 + patwidth) % patwidth;
fakedwidth = vid.width / vid.dupx;
if (rendermode == render_soft)
{ // if only hardware rendering could be this elegant and complete
- scrolled = (SHORT(pat->width) - animtimer) - 1;
- for (x = 0, mx = scrolled; x < fakedwidth; x++, mx = (mx+1)%SHORT(pat->width))
+ scrolled = (patwidth - animtimer) - 1;
+ for (x = 0, mx = scrolled; x < fakedwidth; x++, mx = (mx+1)%patwidth)
F_DrawPatchCol(x, pat, mx);
}
#ifdef HWRENDER
@@ -235,8 +244,8 @@ static void F_SkyScroll(INT32 scrollspeed)
{ // if only software rendering could be this simple and retarded
scrolled = animtimer;
if (scrolled > 0)
- V_DrawScaledPatch(scrolled - SHORT(pat->width), 0, 0, pat);
- for (x = 0; x < fakedwidth; x += SHORT(pat->width))
+ V_DrawScaledPatch(scrolled - patwidth, 0, 0, pat);
+ for (x = 0; x < fakedwidth; x += patwidth)
V_DrawScaledPatch(x + scrolled, 0, 0, pat);
}
#endif
@@ -278,6 +287,8 @@ void F_StartCustomCutscene(INT32 cutscenenum, boolean precutscene, boolean reset
void F_StartIntro(void)
{
+ S_StopMusic();
+
if (introtoplay)
{
if (!cutscenes[introtoplay - 1])
@@ -998,7 +1009,7 @@ static const char *credits[] = {
"",
"\1Sprite Artists",
"Odi \"Iceman404\" Atunzu",
- "Victor \"VAdaPEGA\" Ara\x1Fjo", // Araújo -- sorry for our limited font! D:
+ "Victor \"VAdaPEGA\" Ara\x1Fjo", // Araújo -- sorry for our limited font! D:
"Jim \"MotorRoach\" DeMello",
"Desmond \"Blade\" DesJardins",
"Sherman \"CoatRack\" DesJardins",
@@ -1114,7 +1125,7 @@ void F_StartCredits(void)
M_ClearMenus(true);
// Save the second we enter the credits
- if ((!modifiedgame || savemoddata) && !(netgame || multiplayer) && cursaveslot >= 0)
+ if ((!modifiedgame || savemoddata) && !(netgame || multiplayer) && cursaveslot > 0)
G_SaveGame((UINT32)cursaveslot);
if (creditscutscene)
@@ -1252,7 +1263,7 @@ static boolean drawemblem = false, drawchaosemblem = false;
void F_StartGameEvaluation(void)
{
// Credits option in secrets menu
- if (cursaveslot == -2)
+ if (cursaveslot == -1)
{
F_StartGameEnd();
return;
@@ -1266,7 +1277,7 @@ void F_StartGameEvaluation(void)
// Save the second we enter the evaluation
// We need to do this again! Remember, it's possible a mod designed skipped
// the credits sequence!
- if ((!modifiedgame || savemoddata) && !(netgame || multiplayer) && cursaveslot >= 0)
+ if ((!modifiedgame || savemoddata) && !(netgame || multiplayer) && cursaveslot > 0)
G_SaveGame((UINT32)cursaveslot);
gameaction = ga_nothing;
@@ -1415,17 +1426,72 @@ void F_GameEndTicker(void)
// ==============
void F_StartTitleScreen(void)
{
+ S_ChangeMusicInternal("_title", looptitle);
+
if (gamestate != GS_TITLESCREEN && gamestate != GS_WAITINGPLAYERS)
finalecount = 0;
else
wipegamestate = GS_TITLESCREEN;
+
+ if (titlemap)
+ {
+ mapthing_t *startpos;
+
+ gamestate_t prevwipegamestate = wipegamestate;
+ titlemapinaction = TITLEMAP_LOADING;
+ gamemap = titlemap;
+
+ if (!mapheaderinfo[gamemap-1])
+ P_AllocMapHeader(gamemap-1);
+
+ maptol = mapheaderinfo[gamemap-1]->typeoflevel;
+ globalweather = mapheaderinfo[gamemap-1]->weather;
+
+ G_DoLoadLevel(true);
+ if (!titlemap)
+ return;
+
+ players[displayplayer].playerstate = PST_DEAD; // Don't spawn the player in dummy (I'm still a filthy cheater)
+
+ // Set Default Position
+ if (playerstarts[0])
+ startpos = playerstarts[0];
+ else if (deathmatchstarts[0])
+ startpos = deathmatchstarts[0];
+ else
+ startpos = NULL;
+
+ if (startpos)
+ {
+ camera.x = startpos->x << FRACBITS;
+ camera.y = startpos->y << FRACBITS;
+ camera.subsector = R_PointInSubsector(camera.x, camera.y);
+ camera.z = camera.subsector->sector->floorheight + ((startpos->options >> ZSHIFT) << FRACBITS);
+ camera.angle = (startpos->angle % 360)*ANG1;
+ camera.aiming = 0;
+ }
+ else
+ {
+ camera.x = camera.y = camera.z = camera.angle = camera.aiming = 0;
+ camera.subsector = NULL; // toast is filthy too
+ }
+
+ camera.chase = true;
+ camera.height = 0;
+
+ wipegamestate = prevwipegamestate;
+ }
+ else
+ {
+ titlemapinaction = TITLEMAP_OFF;
+ gamemap = 1; // g_game.c
+ CON_ClearHUD();
+ }
+
G_SetGamestate(GS_TITLESCREEN);
- CON_ClearHUD();
// IWAD dependent stuff.
- S_ChangeMusicInternal("_title", looptitle);
-
animtimer = 0;
demoDelayLeft = demoDelayTime;
@@ -1455,12 +1521,21 @@ void F_TitleScreenDrawer(void)
return; // We likely came here from retrying. Don't do a damn thing.
// Draw that sky!
- F_SkyScroll(titlescrollspeed);
+ if (!titlemapinaction)
+ F_SkyScroll(titlescrollspeed);
// Don't draw outside of the title screewn, or if the patch isn't there.
if (!ttwing || (gamestate != GS_TITLESCREEN && gamestate != GS_WAITINGPLAYERS))
return;
+ // rei|miru: use title pics?
+ if (hidetitlepics)
+#ifdef HAVE_BLUA
+ goto luahook;
+#else
+ return;
+#endif
+
V_DrawScaledPatch(30, 14, 0, ttwing);
if (finalecount < 57)
@@ -1497,6 +1572,11 @@ void F_TitleScreenDrawer(void)
}
V_DrawScaledPatch(48, 142, 0,ttbanner);
+
+#ifdef HAVE_BLUA
+luahook:
+ LUAh_TitleHUD();
+#endif
}
// (no longer) De-Demo'd Title Screen
@@ -1509,6 +1589,46 @@ void F_TitleScreenTicker(boolean run)
if (gameaction != ga_nothing || gamestate != GS_TITLESCREEN)
return;
+ // Execute the titlemap camera settings
+ if (titlemapinaction)
+ {
+ thinker_t *th;
+ mobj_t *mo2;
+ mobj_t *cameraref = NULL;
+
+ for (th = thinkercap.next; th != &thinkercap; th = th->next)
+ {
+ if (th->function.acp1 != (actionf_p1)P_MobjThinker) // Not a mobj thinker
+ continue;
+
+ mo2 = (mobj_t *)th;
+
+ if (!mo2)
+ continue;
+
+ if (mo2->type != MT_ALTVIEWMAN)
+ continue;
+
+ cameraref = mo2;
+ break;
+ }
+
+ if (cameraref)
+ {
+ camera.x = cameraref->x;
+ camera.y = cameraref->y;
+ camera.z = cameraref->z;
+ camera.angle = cameraref->angle;
+ camera.aiming = cameraref->cusval;
+ camera.subsector = cameraref->subsector;
+ }
+ else
+ {
+ // Default behavior: Do a lil' camera spin if a title map is loaded;
+ camera.angle += titlescrollspeed*ANG1/64;
+ }
+ }
+
// no demos to play? or, are they disabled?
if (!cv_rollingdemos.value || !numDemos)
return;
diff --git a/src/f_finale.h b/src/f_finale.h
index 1f23643be..aadc64ad0 100644
--- a/src/f_finale.h
+++ b/src/f_finale.h
@@ -62,6 +62,15 @@ void F_ContinueDrawer(void);
extern INT32 titlescrollspeed;
+typedef enum
+{
+ TITLEMAP_OFF = 0,
+ TITLEMAP_LOADING,
+ TITLEMAP_RUNNING
+} titlemap_enum;
+
+extern UINT8 titlemapinaction;
+
//
// WIPE
//
diff --git a/src/f_wipe.c b/src/f_wipe.c
index acc4efaaa..49ab9cc01 100644
--- a/src/f_wipe.c
+++ b/src/f_wipe.c
@@ -94,7 +94,7 @@ static fixed_t paldiv = 0;
* \return fademask_t for lump
*/
static fademask_t *F_GetFadeMask(UINT8 masknum, UINT8 scrnnum) {
- static char lumpname[9] = "FADEmmss";
+ static char lumpname[10] = "FADEmmss";
static fademask_t fm = {NULL,0,0,0,0,0};
lumpnum_t lumpnum;
UINT8 *lump, *mask;
diff --git a/src/filesrch.c b/src/filesrch.c
index acc176d6a..b4a995154 100644
--- a/src/filesrch.c
+++ b/src/filesrch.c
@@ -16,23 +16,21 @@
#ifdef __GNUC__
#include
#endif
-#if defined (_WIN32) && !defined (_XBOX)
+#ifdef _WIN32
//#define WIN32_LEAN_AND_MEAN
#define RPC_NO_WINDOWS_H
#include
#endif
-#ifdef _WIN32_WCE
-#include "sdl/SRB2CE/cehelp.h"
-#else
#include
-#endif
#include
#include "filesrch.h"
#include "d_netfil.h"
#include "m_misc.h"
+#include "z_zone.h"
+#include "m_menu.h" // Addons_option_Onchange
-#if (defined (_WIN32) && !defined (_WIN32_WCE)) && defined (_MSC_VER) && !defined (_XBOX)
+#if defined (_WIN32) && defined (_MSC_VER)
#include
#include
@@ -255,6 +253,28 @@ readdir (DIR * dirp)
return (struct dirent *) 0;
}
+/*
+ * rewinddir
+ *
+ * Makes the next readdir start from the beginning.
+ */
+int
+rewinddir (DIR * dirp)
+{
+ errno = 0;
+
+ /* Check for valid DIR struct. */
+ if (!dirp)
+ {
+ errno = EFAULT;
+ return -1;
+ }
+
+ dirp->dd_stat = 0;
+
+ return 0;
+}
+
/*
* closedir
*
@@ -285,68 +305,35 @@ closedir (DIR * dirp)
return rc;
}
#endif
-#if defined (_XBOX) && defined (_MSC_VER)
-filestatus_t filesearch(char *filename, const char *startpath, const UINT8 *wantedmd5sum,
- boolean completepath, int maxsearchdepth)
-{
-//NONE?
- startpath = filename = NULL;
- wantedmd5sum = NULL;
- maxsearchdepth = 0;
- completepath = false;
- return FS_NOTFOUND;
-}
-#elif defined (_WIN32_WCE)
-filestatus_t filesearch(char *filename, const char *startpath, const UINT8 *wantedmd5sum,
- boolean completepath, int maxsearchdepth)
-{
-#ifdef __GNUC__
-//NONE?
- startpath = filename = NULL;
- wantedmd5sum = NULL;
- maxsearchdepth = 0;
- completepath = false;
-#else
- WIN32_FIND_DATA dta;
- HANDLE searchhandle = INVALID_HANDLE_VALUE;
- const wchar_t wm[4] = L"*.*";
- //if (startpath) SetCurrentDirectory(startpath);
- if (FIL_ReadFileOK(filename))
- {
- // checkfilemd5 returns an FS_* value, either FS_FOUND or FS_MD5SUMBAD
- return checkfilemd5(filename, wantedmd5sum);
- }
- ZeroMemory(&dta,sizeof (dta));
- if (maxsearchdepth)
- searchhandle = FindFirstFile(wm,&dta);
- if (searchhandle != INVALID_HANDLE_VALUE)
- {
- do
- {
- if ((dta.cFileName[0]!='.') && (dta.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY))
- {
- //if (SetCurrentDirectory(dta.cFileName))
- { // can fail if we haven't the right
- filestatus_t found;
- found = filesearch(filename,NULL,wantedmd5sum,completepath,maxsearchdepth-1);
- //SetCurrentDirectory("..");
- if (found == FS_FOUND || found == FS_MD5SUMBAD)
- {
- if (completepath)
- strcatbf(filename,(char *)dta.cFileName,"\\");
- FindClose(searchhandle);
- return found;
- }
- }
- }
- } while (FindNextFile(searchhandle,&dta)==0);
- FindClose(searchhandle);
- }
-#endif
- return FS_NOTFOUND;
-}
-#else
+static CV_PossibleValue_t addons_cons_t[] = {{0, "SRB2 Folder"}, /*{1, "HOME"}, {2, "SRB2 Folder"},*/ {3, "CUSTOM"}, {0, NULL}};
+consvar_t cv_addons_option = {"addons_option", "SRB2 Folder", CV_SAVE|CV_CALL, addons_cons_t, Addons_option_Onchange, 0, NULL, NULL, 0, 0, NULL};
+consvar_t cv_addons_folder = {"addons_folder", "./", CV_SAVE, NULL, NULL, 0, NULL, NULL, 0, 0, NULL};
+
+static CV_PossibleValue_t addons_md5_cons_t[] = {{0, "Name"}, {1, "Contents"}, {0, NULL}};
+consvar_t cv_addons_md5 = {"addons_md5", "Name", CV_SAVE, addons_md5_cons_t, NULL, 0, NULL, NULL, 0, 0, NULL};
+
+consvar_t cv_addons_showall = {"addons_showall", "No", CV_SAVE, CV_YesNo, NULL, 0, NULL, NULL, 0, 0, NULL};
+
+consvar_t cv_addons_search_case = {"addons_search_case", "No", CV_SAVE, CV_YesNo, NULL, 0, NULL, NULL, 0, 0, NULL};
+
+static CV_PossibleValue_t addons_search_type_cons_t[] = {{0, "Start"}, {1, "Anywhere"}, {0, NULL}};
+consvar_t cv_addons_search_type = {"addons_search_type", "Anywhere", CV_SAVE, addons_search_type_cons_t, NULL, 0, NULL, NULL, 0, 0, NULL};
+
+char menupath[1024];
+size_t menupathindex[menudepth];
+size_t menudepthleft = menudepth;
+
+char menusearch[MAXSTRINGLENGTH+1];
+
+char **dirmenu;
+size_t sizedirmenu;
+size_t dir_on[menudepth];
+UINT8 refreshdirmenu = 0;
+
+size_t packetsizetally = 0;
+size_t mainwadstally = 0;
+
filestatus_t filesearch(char *filename, const char *startpath, const UINT8 *wantedmd5sum, boolean completepath, int maxsearchdepth)
{
filestatus_t retval = FS_NOTFOUND;
@@ -387,25 +374,29 @@ filestatus_t filesearch(char *filename, const char *startpath, const UINT8 *want
{
searchpath[searchpathindex[depthleft]]=0;
dent = readdir(dirhandle[depthleft]);
- if (dent)
- strcpy(&searchpath[searchpathindex[depthleft]],dent->d_name);
if (!dent)
+ {
closedir(dirhandle[depthleft++]);
- else if (dent->d_name[0]=='.' &&
+ continue;
+ }
+
+ if (dent->d_name[0]=='.' &&
(dent->d_name[1]=='\0' ||
(dent->d_name[1]=='.' &&
dent->d_name[2]=='\0')))
{
// we don't want to scan uptree
+ continue;
}
- else if (stat(searchpath,&fsstat) < 0) // do we want to follow symlinks? if not: change it to lstat
- {
- // was the file (re)moved? can't stat it
- }
+
+ // okay, now we actually want searchpath to incorporate d_name
+ strcpy(&searchpath[searchpathindex[depthleft]],dent->d_name);
+
+ if (stat(searchpath,&fsstat) < 0) // do we want to follow symlinks? if not: change it to lstat
+ ; // was the file (re)moved? can't stat it
else if (S_ISDIR(fsstat.st_mode) && depthleft)
{
- strcpy(&searchpath[searchpathindex[depthleft]],dent->d_name);
searchpathindex[--depthleft] = strlen(searchpath) + 1;
dirhandle[depthleft] = opendir(searchpath);
if (!dirhandle[depthleft])
@@ -444,6 +435,254 @@ filestatus_t filesearch(char *filename, const char *startpath, const UINT8 *want
free(searchname);
free(searchpathindex);
free(dirhandle);
+
return retval;
}
-#endif
+
+char exttable[NUM_EXT_TABLE][5] = {
+ ".txt", ".cfg", // exec
+ ".wad", ".soc", ".lua"}; // addfile
+
+char filenamebuf[MAX_WADFILES][MAX_WADPATH];
+
+
+static boolean filemenusearch(char *haystack, char *needle)
+{
+ static char localhaystack[128];
+ strlcpy(localhaystack, haystack, 128);
+ if (!cv_addons_search_case.value)
+ strupr(localhaystack);
+ return ((cv_addons_search_type.value)
+ ? (strstr(localhaystack, needle) != 0)
+ : (!strncmp(localhaystack, needle, menusearch[0])));
+}
+
+#define searchdir if (menusearch[0] && !filemenusearch(dent->d_name, localmenusearch))\
+ {\
+ rejected++;\
+ continue;\
+ }\
+
+boolean preparefilemenu(boolean samedepth)
+{
+ DIR *dirhandle;
+ struct dirent *dent;
+ struct stat fsstat;
+ size_t pos = 0, folderpos = 0, numfolders = 0, rejected = 0;
+ char *tempname = NULL;
+ boolean noresults = false;
+ char localmenusearch[MAXSTRINGLENGTH] = "";
+
+ if (samedepth)
+ {
+ if (dirmenu && dirmenu[dir_on[menudepthleft]])
+ tempname = Z_StrDup(dirmenu[dir_on[menudepthleft]]+DIR_STRING); // don't need to I_Error if can't make - not important, just QoL
+ }
+ else
+ menusearch[0] = menusearch[1] = 0; // clear search
+
+ for (; sizedirmenu > 0; sizedirmenu--) // clear out existing items
+ {
+ Z_Free(dirmenu[sizedirmenu-1]);
+ dirmenu[sizedirmenu-1] = NULL;
+ }
+
+ if (!(dirhandle = opendir(menupath))) // get directory
+ return false;
+
+ if (menusearch[0])
+ {
+ strcpy(localmenusearch, menusearch+1);
+ if (!cv_addons_search_case.value)
+ strupr(localmenusearch);
+ }
+
+ while (true)
+ {
+ menupath[menupathindex[menudepthleft]] = 0;
+ dent = readdir(dirhandle);
+
+ if (!dent)
+ break;
+ else if (dent->d_name[0]=='.' &&
+ (dent->d_name[1]=='\0' ||
+ (dent->d_name[1]=='.' &&
+ dent->d_name[2]=='\0')))
+ continue; // we don't want to scan uptree
+
+ strcpy(&menupath[menupathindex[menudepthleft]],dent->d_name);
+
+ if (stat(menupath,&fsstat) < 0) // do we want to follow symlinks? if not: change it to lstat
+ ; // was the file (re)moved? can't stat it
+ else // is a file or directory
+ {
+ if (!S_ISDIR(fsstat.st_mode)) // file
+ {
+ if (!cv_addons_showall.value)
+ {
+ size_t len = strlen(dent->d_name)+1;
+ UINT8 ext;
+ for (ext = 0; ext < NUM_EXT_TABLE; ext++)
+ if (!strcasecmp(exttable[ext], dent->d_name+len-5)) break; // extension comparison
+ if (ext == NUM_EXT_TABLE) continue; // not an addfile-able (or exec-able) file
+ }
+ searchdir;
+ }
+ else // directory
+ {
+ searchdir;
+ numfolders++;
+ }
+ sizedirmenu++;
+ }
+ }
+
+ if (!rejected && !sizedirmenu)
+ {
+ if (tempname)
+ Z_Free(tempname);
+ closedir(dirhandle);
+ return false;
+ }
+
+ if (((noresults = (menusearch[0] && !sizedirmenu)))
+ || (!menusearch[0] && menudepthleft != menudepth-1)) // Make room for UP... or search entry
+ {
+ sizedirmenu++;
+ numfolders++;
+ folderpos++;
+ }
+
+ if (!(dirmenu = Z_Realloc(dirmenu, sizedirmenu*sizeof(char *), PU_STATIC, NULL)))
+ {
+ closedir(dirhandle); // just in case
+ I_Error("Ran out of memory whilst preparing add-ons menu");
+ }
+
+ rejected = 0;
+ rewinddir(dirhandle);
+
+ while ((pos+folderpos) < sizedirmenu)
+ {
+ menupath[menupathindex[menudepthleft]] = 0;
+ dent = readdir(dirhandle);
+
+ if (!dent)
+ break;
+ else if (dent->d_name[0]=='.' &&
+ (dent->d_name[1]=='\0' ||
+ (dent->d_name[1]=='.' &&
+ dent->d_name[2]=='\0')))
+ continue; // we don't want to scan uptree
+
+ strcpy(&menupath[menupathindex[menudepthleft]],dent->d_name);
+
+ if (stat(menupath,&fsstat) < 0) // do we want to follow symlinks? if not: change it to lstat
+ ; // was the file (re)moved? can't stat it
+ else // is a file or directory
+ {
+ char *temp;
+ size_t len = strlen(dent->d_name)+1;
+ UINT8 ext = EXT_FOLDER;
+ UINT8 folder;
+
+ if (!S_ISDIR(fsstat.st_mode)) // file
+ {
+ if (!((numfolders+pos) < sizedirmenu)) continue; // crash prevention
+ for (; ext < NUM_EXT_TABLE; ext++)
+ if (!strcasecmp(exttable[ext], dent->d_name+len-5)) break; // extension comparison
+ if (ext == NUM_EXT_TABLE && !cv_addons_showall.value) continue; // not an addfile-able (or exec-able) file
+ ext += EXT_START; // moving to be appropriate position
+
+ searchdir;
+
+ if (ext >= EXT_LOADSTART)
+ {
+ size_t i;
+ for (i = 0; i < numwadfiles; i++)
+ {
+ if (!filenamebuf[i][0])
+ {
+ strncpy(filenamebuf[i], wadfiles[i]->filename, MAX_WADPATH);
+ filenamebuf[i][MAX_WADPATH - 1] = '\0';
+ nameonly(filenamebuf[i]);
+ }
+
+ if (strcmp(dent->d_name, filenamebuf[i]))
+ continue;
+ if (cv_addons_md5.value && !checkfilemd5(menupath, wadfiles[i]->md5sum))
+ continue;
+
+ ext |= EXT_LOADED;
+ }
+ }
+ else if (ext == EXT_TXT)
+ {
+ if (!strcmp(dent->d_name, "log.txt") || !strcmp(dent->d_name, "errorlog.txt"))
+ ext |= EXT_LOADED;
+ }
+
+ if (!strcmp(dent->d_name, configfile))
+ ext |= EXT_LOADED;
+
+ folder = 0;
+ }
+ else // directory
+ {
+ searchdir;
+ len += (folder = 1);
+ }
+
+ if (len > 255)
+ len = 255;
+
+ if (!(temp = Z_Malloc((len+DIR_STRING+folder) * sizeof (char), PU_STATIC, NULL)))
+ I_Error("Ran out of memory whilst preparing add-ons menu");
+ temp[DIR_TYPE] = ext;
+ temp[DIR_LEN] = (UINT8)(len);
+ strlcpy(temp+DIR_STRING, dent->d_name, len);
+ if (folder)
+ {
+ strcpy(temp+len, "/");
+ dirmenu[folderpos++] = temp;
+ }
+ else
+ dirmenu[numfolders + pos++] = temp;
+ }
+ }
+
+ closedir(dirhandle);
+
+ if (noresults) // no results
+ dirmenu[0] = Z_StrDup(va("%c\13No results...", EXT_NORESULTS));
+ else if (!menusearch[0] &&menudepthleft != menudepth-1) // now for UP... entry
+ dirmenu[0] = Z_StrDup(va("%c\5UP...", EXT_UP));
+
+ menupath[menupathindex[menudepthleft]] = 0;
+ sizedirmenu = (numfolders+pos); // just in case things shrink between opening and rewind
+
+ if (tempname)
+ {
+ size_t i;
+ for (i = 0; i < sizedirmenu; i++)
+ {
+ if (!strcmp(dirmenu[i]+DIR_STRING, tempname))
+ {
+ dir_on[menudepthleft] = i;
+ break;
+ }
+ }
+ Z_Free(tempname);
+ }
+
+ if (!sizedirmenu)
+ {
+ dir_on[menudepthleft] = 0;
+ Z_Free(dirmenu);
+ return false;
+ }
+ else if (dir_on[menudepthleft] >= sizedirmenu)
+ dir_on[menudepthleft] = sizedirmenu-1;
+
+ return true;
+}
diff --git a/src/filesrch.h b/src/filesrch.h
index 33b148d4b..c2201b453 100644
--- a/src/filesrch.h
+++ b/src/filesrch.h
@@ -6,6 +6,9 @@
#include "doomdef.h"
#include "d_netfil.h"
+#include "m_menu.h" // MAXSTRINGLENGTH
+
+extern consvar_t cv_addons_option, cv_addons_folder, cv_addons_md5, cv_addons_showall, cv_addons_search_case, cv_addons_search_type;
/** \brief The filesearch function
@@ -25,4 +28,64 @@
filestatus_t filesearch(char *filename, const char *startpath, const UINT8 *wantedmd5sum,
boolean completepath, int maxsearchdepth);
+#define menudepth 20
+
+extern char menupath[1024];
+extern size_t menupathindex[menudepth];
+extern size_t menudepthleft;
+
+extern char menusearch[MAXSTRINGLENGTH+1];
+
+extern char **dirmenu;
+extern size_t sizedirmenu;
+extern size_t dir_on[menudepth];
+extern UINT8 refreshdirmenu;
+
+extern size_t packetsizetally;
+extern size_t mainwadstally;
+
+typedef enum
+{
+ EXT_FOLDER = 0,
+ EXT_UP,
+ EXT_NORESULTS,
+ EXT_START,
+ EXT_TXT = EXT_START,
+ EXT_CFG,
+ EXT_LOADSTART,
+ EXT_WAD = EXT_LOADSTART,
+ EXT_SOC,
+ EXT_LUA, // allowed even if not HAVE_BLUA so that we can yell on load attempt
+ NUM_EXT,
+ NUM_EXT_TABLE = NUM_EXT-EXT_START,
+ EXT_LOADED = 0x80
+ /*
+ obviously there can only be 0x7F supported extensions in
+ addons menu because we're cramming this into a char out of
+ laziness/easy memory allocation (what's the difference?)
+ and have stolen a bit to show whether it's loaded or not
+ in practice the size of the data type is probably overkill
+ toast 02/05/17
+ */
+} ext_enum;
+
+typedef enum
+{
+ DIR_TYPE = 0,
+ DIR_LEN,
+ DIR_STRING
+} dirname_enum;
+
+typedef enum
+{
+ REFRESHDIR_NORMAL = 1,
+ REFRESHDIR_ADDFILE = 2,
+ REFRESHDIR_WARNING = 4,
+ REFRESHDIR_ERROR = 8,
+ REFRESHDIR_NOTLOADED = 16,
+ REFRESHDIR_MAX = 32
+} refreshdir_enum;
+
+boolean preparefilemenu(boolean samedepth);
+
#endif // __FILESRCH_H__
diff --git a/src/g_game.c b/src/g_game.c
index 7b4b10490..df2ba5baa 100644
--- a/src/g_game.c
+++ b/src/g_game.c
@@ -76,10 +76,14 @@ INT16 gamemap = 1;
INT16 maptol;
UINT8 globalweather = 0;
INT32 curWeather = PRECIP_NONE;
-INT32 cursaveslot = -1; // Auto-save 1p savegame slot
-INT16 lastmapsaved = 0; // Last map we auto-saved at
+INT32 cursaveslot = 0; // Auto-save 1p savegame slot
+//INT16 lastmapsaved = 0; // Last map we auto-saved at
+INT16 lastmaploaded = 0; // Last map the game loaded
boolean gamecomplete = false;
+UINT8 numgameovers = 0; // for startinglives balance
+SINT8 startinglivesbalance[maxgameovers+1] = {3, 5, 7, 9, 12, 15, 20, 25, 30, 40, 50, 75, 99, 0x7F};
+
UINT16 mainwads = 0;
boolean modifiedgame; // Set if homebrew PWAD stuff has been added.
boolean savemoddata = false;
@@ -120,6 +124,10 @@ INT16 spstage_start;
INT16 sstage_start;
INT16 sstage_end;
+INT16 titlemap = 0;
+boolean hidetitlepics = false;
+INT16 bootmap; //bootmap for loading a map on startup
+
boolean looptitle = false;
boolean useNightsSS = false;
@@ -285,48 +293,16 @@ static void UserAnalog_OnChange(void);
static void UserAnalog2_OnChange(void);
static void Analog_OnChange(void);
static void Analog2_OnChange(void);
+static void DirectionChar_OnChange(void);
+static void DirectionChar2_OnChange(void);
+static void AutoBrake_OnChange(void);
+static void AutoBrake2_OnChange(void);
void SendWeaponPref(void);
void SendWeaponPref2(void);
static CV_PossibleValue_t crosshair_cons_t[] = {{0, "Off"}, {1, "Cross"}, {2, "Angle"}, {3, "Point"}, {0, NULL}};
static CV_PossibleValue_t joyaxis_cons_t[] = {{0, "None"},
-#ifdef _WII
-{1, "LStick.X"}, {2, "LStick.Y"}, {-1, "LStick.X-"}, {-2, "LStick.Y-"},
-#if JOYAXISSET > 1
-{3, "RStick.X"}, {4, "RStick.Y"}, {-3, "RStick.X-"}, {-4, "RStick.Y-"},
-#endif
-#if JOYAXISSET > 2
-{5, "RTrigger"}, {6, "LTrigger"}, {-5, "RTrigger-"}, {-6, "LTrigger-"},
-#endif
-#if JOYAXISSET > 3
-{7, "Pitch"}, {8, "Roll"}, {-7, "Pitch-"}, {-8, "Roll-"},
-#endif
-#if JOYAXISSET > 4
-{7, "Yaw"}, {8, "Dummy"}, {-7, "Yaw-"}, {-8, "Dummy-"},
-#endif
-#if JOYAXISSET > 4
-{9, "LAnalog"}, {10, "RAnalog"}, {-9, "LAnalog-"}, {-10, "RAnalog-"},
-#endif
-#elif defined (WMINPUT)
-{1, "LStick.X"}, {2, "LStick.Y"}, {-1, "LStick.X-"}, {-2, "LStick.Y-"},
-#if JOYAXISSET > 1
-{3, "RStick.X"}, {4, "RStick.Y"}, {-3, "RStick.X-"}, {-4, "RStick.Y-"},
-#endif
-#if JOYAXISSET > 2
-{5, "NStick.X"}, {6, "NStick.Y"}, {-5, "NStick.X-"}, {-6, "NStick.Y-"},
-#endif
-#if JOYAXISSET > 3
-{7, "LAnalog"}, {8, "RAnalog"}, {-7, "LAnalog-"}, {-8, "RAnalog-"},
-#endif
-#else
{1, "X-Axis"}, {2, "Y-Axis"}, {-1, "X-Axis-"}, {-2, "Y-Axis-"},
-#ifdef _arch_dreamcast
-{3, "R-Trig"}, {4, "L-Trig"}, {-3, "R-Trig-"}, {-4, "L-Trig-"},
-{5, "Alt X-Axis"}, {6, "Alt Y-Axis"}, {-5, "Alt X-Axis-"}, {-6, "Alt Y-Axis-"},
-{7, "Triggers"}, {-7,"Triggers-"},
-#elif defined (_XBOX)
-{3, "Alt X-Axis"}, {4, "Alt Y-Axis"}, {-3, "Alt X-Axis-"}, {-4, "Alt Y-Axis-"},
-#else
#if JOYAXISSET > 1
{3, "Z-Axis"}, {4, "X-Rudder"}, {-3, "Z-Axis-"}, {-4, "X-Rudder-"},
#endif
@@ -335,19 +311,11 @@ static CV_PossibleValue_t joyaxis_cons_t[] = {{0, "None"},
#endif
#if JOYAXISSET > 3
{7, "U-Axis"}, {8, "V-Axis"}, {-7, "U-Axis-"}, {-8, "V-Axis-"},
-#endif
-#endif
#endif
{0, NULL}};
-#ifdef _WII
-#if JOYAXISSET > 5
-"More Axis Sets"
-#endif
-#else
#if JOYAXISSET > 4
"More Axis Sets"
#endif
-#endif
consvar_t cv_crosshair = {"crosshair", "Cross", CV_SAVE, crosshair_cons_t, NULL, 0, NULL, NULL, 0, 0, NULL};
consvar_t cv_crosshair2 = {"crosshair2", "Cross", CV_SAVE, crosshair_cons_t, NULL, 0, NULL, NULL, 0, 0, NULL};
@@ -359,13 +327,16 @@ consvar_t cv_mousemove = {"mousemove", "On", CV_SAVE, CV_OnOff, NULL, 0, NULL, N
consvar_t cv_mousemove2 = {"mousemove2", "On", CV_SAVE, CV_OnOff, NULL, 0, NULL, NULL, 0, 0, NULL};
consvar_t cv_analog = {"analog", "Off", CV_CALL, CV_OnOff, Analog_OnChange, 0, NULL, NULL, 0, 0, NULL};
consvar_t cv_analog2 = {"analog2", "Off", CV_CALL, CV_OnOff, Analog2_OnChange, 0, NULL, NULL, 0, 0, NULL};
-#ifdef DC
-consvar_t cv_useranalog = {"useranalog", "On", CV_SAVE|CV_CALL, CV_OnOff, UserAnalog_OnChange, 0, NULL, NULL, 0, 0, NULL};
-consvar_t cv_useranalog2 = {"useranalog2", "On", CV_SAVE|CV_CALL, CV_OnOff, UserAnalog2_OnChange, 0, NULL, NULL, 0, 0, NULL};
-#else
consvar_t cv_useranalog = {"useranalog", "Off", CV_SAVE|CV_CALL, CV_OnOff, UserAnalog_OnChange, 0, NULL, NULL, 0, 0, NULL};
consvar_t cv_useranalog2 = {"useranalog2", "Off", CV_SAVE|CV_CALL, CV_OnOff, UserAnalog2_OnChange, 0, NULL, NULL, 0, 0, NULL};
-#endif
+
+static CV_PossibleValue_t directionchar_cons_t[] = {{0, "Camera"}, {1, "Movement"}, {0, NULL}};
+
+// deez New User eXperiences
+consvar_t cv_directionchar = {"directionchar", "Movement", CV_SAVE|CV_CALL, directionchar_cons_t, DirectionChar_OnChange, 0, NULL, NULL, 0, 0, NULL};
+consvar_t cv_directionchar2 = {"directionchar2", "Movement", CV_SAVE|CV_CALL, directionchar_cons_t, DirectionChar2_OnChange, 0, NULL, NULL, 0, 0, NULL};
+consvar_t cv_autobrake = {"autobrake", "On", CV_SAVE|CV_CALL, CV_OnOff, AutoBrake_OnChange, 0, NULL, NULL, 0, 0, NULL};
+consvar_t cv_autobrake2 = {"autobrake2", "On", CV_SAVE|CV_CALL, CV_OnOff, AutoBrake2_OnChange, 0, NULL, NULL, 0, 0, NULL};
typedef enum
{
@@ -379,68 +350,19 @@ typedef enum
AXISFIRENORMAL,
} axis_input_e;
-#if defined (_WII) || defined (WMINPUT)
-consvar_t cv_turnaxis = {"joyaxis_turn", "LStick.X", CV_SAVE, joyaxis_cons_t, NULL, 0, NULL, NULL, 0, 0, NULL};
-consvar_t cv_moveaxis = {"joyaxis_move", "LStick.Y", CV_SAVE, joyaxis_cons_t, NULL, 0, NULL, NULL, 0, 0, NULL};
-consvar_t cv_sideaxis = {"joyaxis_side", "RStick.X", CV_SAVE, joyaxis_cons_t, NULL, 0, NULL, NULL, 0, 0, NULL};
-consvar_t cv_lookaxis = {"joyaxis_look", "RStick.Y", CV_SAVE, joyaxis_cons_t, NULL, 0, NULL, NULL, 0, 0, NULL};
-consvar_t cv_fireaxis = {"joyaxis_fire", "LAnalog", CV_SAVE, joyaxis_cons_t, NULL, 0, NULL, NULL, 0, 0, NULL};
-consvar_t cv_firenaxis = {"joyaxis_firenormal", "RAnalog", CV_SAVE, joyaxis_cons_t, NULL, 0, NULL, NULL, 0, 0, NULL};
-#else
consvar_t cv_turnaxis = {"joyaxis_turn", "X-Axis", CV_SAVE, joyaxis_cons_t, NULL, 0, NULL, NULL, 0, 0, NULL};
-#ifdef PSP
-consvar_t cv_moveaxis = {"joyaxis_move", "None", CV_SAVE, joyaxis_cons_t, NULL, 0, NULL, NULL, 0, 0, NULL};
-#else
consvar_t cv_moveaxis = {"joyaxis_move", "Y-Axis", CV_SAVE, joyaxis_cons_t, NULL, 0, NULL, NULL, 0, 0, NULL};
-#endif
-#ifdef _arch_dreamcast
-consvar_t cv_sideaxis = {"joyaxis_side", "Triggers", CV_SAVE, joyaxis_cons_t, NULL, 0, NULL, NULL, 0, 0, NULL};
-#elif defined (_XBOX)
-consvar_t cv_sideaxis = {"joyaxis_side", "Alt X-Axis", CV_SAVE, joyaxis_cons_t, NULL, 0, NULL, NULL, 0, 0, NULL};
-consvar_t cv_lookaxis = {"joyaxis_look", "Alt Y-Axis", CV_SAVE, joyaxis_cons_t, NULL, 0, NULL, NULL, 0, 0, NULL};
-#elif defined (PSP)
-consvar_t cv_sideaxis = {"joyaxis_side", "None", CV_SAVE, joyaxis_cons_t, NULL, 0, NULL, NULL, 0, 0, NULL};
-#else
consvar_t cv_sideaxis = {"joyaxis_side", "Z-Axis", CV_SAVE, joyaxis_cons_t, NULL, 0, NULL, NULL, 0, 0, NULL};
-#endif
-#ifndef _XBOX
-#ifdef PSP
-consvar_t cv_lookaxis = {"joyaxis_look", "Y-Axis", CV_SAVE, joyaxis_cons_t, NULL, 0, NULL, NULL, 0, 0, NULL};
-#else
consvar_t cv_lookaxis = {"joyaxis_look", "None", CV_SAVE, joyaxis_cons_t, NULL, 0, NULL, NULL, 0, 0, NULL};
-#endif
-#endif
consvar_t cv_fireaxis = {"joyaxis_fire", "None", CV_SAVE, joyaxis_cons_t, NULL, 0, NULL, NULL, 0, 0, NULL};
consvar_t cv_firenaxis = {"joyaxis_firenormal", "None", CV_SAVE, joyaxis_cons_t, NULL, 0, NULL, NULL, 0, 0, NULL};
-#endif
-#if defined (_WII) || defined (WMINPUT)
-consvar_t cv_turnaxis2 = {"joyaxis2_turn", "LStick.X", CV_SAVE, joyaxis_cons_t, NULL, 0, NULL, NULL, 0, 0, NULL};
-consvar_t cv_moveaxis2 = {"joyaxis2_move", "LStick.Y", CV_SAVE, joyaxis_cons_t, NULL, 0, NULL, NULL, 0, 0, NULL};
-consvar_t cv_sideaxis2 = {"joyaxis2_side", "RStick.X", CV_SAVE, joyaxis_cons_t, NULL, 0, NULL, NULL, 0, 0, NULL};
-consvar_t cv_lookaxis2 = {"joyaxis2_look", "RStick.Y", CV_SAVE, joyaxis_cons_t, NULL, 0, NULL, NULL, 0, 0, NULL};
-consvar_t cv_fireaxis2 = {"joyaxis2_fire", "LAnalog", CV_SAVE, joyaxis_cons_t, NULL, 0, NULL, NULL, 0, 0, NULL};
-consvar_t cv_firenaxis2 = {"joyaxis2_firenormal", "RAnalog", CV_SAVE, joyaxis_cons_t, NULL, 0, NULL, NULL, 0, 0, NULL};
-#else
consvar_t cv_turnaxis2 = {"joyaxis2_turn", "X-Axis", CV_SAVE, joyaxis_cons_t, NULL, 0, NULL, NULL, 0, 0, NULL};
consvar_t cv_moveaxis2 = {"joyaxis2_move", "Y-Axis", CV_SAVE, joyaxis_cons_t, NULL, 0, NULL, NULL, 0, 0, NULL};
-#ifdef _arch_dreamcast
-consvar_t cv_sideaxis2 = {"joyaxis2_side", "Triggers", CV_SAVE, joyaxis_cons_t, NULL, 0, NULL, NULL, 0, 0, NULL};
-#elif defined (_XBOX)
-consvar_t cv_sideaxis2 = {"joyaxis2_side", "Alt X-Axis", CV_SAVE, joyaxis_cons_t, NULL, 0, NULL, NULL, 0, 0, NULL};
-consvar_t cv_lookaxis2 = {"joyaxis2_look", "Alt Y-Axis", CV_SAVE, joyaxis_cons_t, NULL, 0, NULL, NULL, 0, 0, NULL};
-#elif defined (_PSP)
-consvar_t cv_sideaxis2 = {"joyaxis2_side", "None", CV_SAVE, joyaxis_cons_t, NULL, 0, NULL, NULL, 0, 0, NULL};
-#else
consvar_t cv_sideaxis2 = {"joyaxis2_side", "Z-Axis", CV_SAVE, joyaxis_cons_t, NULL, 0, NULL, NULL, 0, 0, NULL};
-#endif
-#ifndef _XBOX
consvar_t cv_lookaxis2 = {"joyaxis2_look", "None", CV_SAVE, joyaxis_cons_t, NULL, 0, NULL, NULL, 0, 0, NULL};
-#endif
consvar_t cv_fireaxis2 = {"joyaxis2_fire", "None", CV_SAVE, joyaxis_cons_t, NULL, 0, NULL, NULL, 0, 0, NULL};
consvar_t cv_firenaxis2 = {"joyaxis2_firenormal", "None", CV_SAVE, joyaxis_cons_t, NULL, 0, NULL, NULL, 0, 0, NULL};
-#endif
-
#if MAXPLAYERS > 32
#error "please update player_name table using the new value for MAXPLAYERS"
@@ -727,7 +649,7 @@ void G_SetGameModified(boolean silent)
*/
const char *G_BuildMapName(INT32 map)
{
- static char mapname[9] = "MAPXX"; // internal map name (wad resource name)
+ static char mapname[10] = "MAPXX"; // internal map name (wad resource name)
I_Assert(map > 0);
I_Assert(map <= NUMMAPS);
@@ -818,14 +740,6 @@ static INT32 JoyAxis(axis_input_e axissel)
axisval = -axisval;
flp = true;
}
-#ifdef _arch_dreamcast
- if (axisval == 7) // special case
- {
- retaxis = joyxmove[1] - joyymove[1];
- goto skipDC;
- }
- else
-#endif
if (axisval > JOYAXISSET*2 || axisval == 0) //not there in array or None
return 0;
@@ -841,10 +755,6 @@ static INT32 JoyAxis(axis_input_e axissel)
retaxis = joyymove[axisval];
}
-#ifdef _arch_dreamcast
- skipDC:
-#endif
-
if (retaxis < (-JOYAXISRANGE))
retaxis = -JOYAXISRANGE;
if (retaxis > (+JOYAXISRANGE))
@@ -896,14 +806,7 @@ static INT32 Joy2Axis(axis_input_e axissel)
axisval = -axisval;
flp = true;
}
-#ifdef _arch_dreamcast
- if (axisval == 7) // special case
- {
- retaxis = joy2xmove[1] - joy2ymove[1];
- goto skipDC;
- }
- else
-#endif
+
if (axisval > JOYAXISSET*2 || axisval == 0) //not there in array or None
return 0;
@@ -919,10 +822,6 @@ static INT32 Joy2Axis(axis_input_e axissel)
retaxis = joy2ymove[axisval];
}
-#ifdef _arch_dreamcast
- skipDC:
-#endif
-
if (retaxis < (-JOYAXISRANGE))
retaxis = -JOYAXISRANGE;
if (retaxis > (+JOYAXISRANGE))
@@ -1614,6 +1513,46 @@ static void Analog2_OnChange(void)
SendWeaponPref2();
}
+static void DirectionChar_OnChange(void)
+{
+ if (cv_directionchar.value)
+ players[consoleplayer].pflags |= PF_DIRECTIONCHAR;
+ else
+ players[consoleplayer].pflags &= ~PF_DIRECTIONCHAR;
+
+ SendWeaponPref();
+}
+
+static void DirectionChar2_OnChange(void)
+{
+ if (cv_directionchar2.value)
+ players[secondarydisplayplayer].pflags |= PF_DIRECTIONCHAR;
+ else
+ players[secondarydisplayplayer].pflags &= ~PF_DIRECTIONCHAR;
+
+ SendWeaponPref2();
+}
+
+static void AutoBrake_OnChange(void)
+{
+ if (cv_autobrake.value)
+ players[consoleplayer].pflags |= PF_AUTOBRAKE;
+ else
+ players[consoleplayer].pflags &= ~PF_AUTOBRAKE;
+
+ SendWeaponPref();
+}
+
+static void AutoBrake2_OnChange(void)
+{
+ if (cv_autobrake2.value)
+ players[secondarydisplayplayer].pflags |= PF_AUTOBRAKE;
+ else
+ players[secondarydisplayplayer].pflags &= ~PF_AUTOBRAKE;
+
+ SendWeaponPref2();
+}
+
//
// G_DoLoadLevel
//
@@ -1632,6 +1571,21 @@ void G_DoLoadLevel(boolean resetplayer)
if (gamestate == GS_INTERMISSION)
Y_EndIntermission();
+ // cleanup
+ if (titlemapinaction == TITLEMAP_LOADING)
+ {
+ if (W_CheckNumForName(G_BuildMapName(gamemap)) == LUMPERROR)
+ {
+ titlemap = 0; // let's not infinite recursion ok
+ Command_ExitGame_f();
+ return;
+ }
+
+ titlemapinaction = TITLEMAP_RUNNING;
+ }
+ else
+ titlemapinaction = TITLEMAP_OFF;
+
G_SetGamestate(GS_LEVEL);
for (i = 0; i < MAXPLAYERS; i++)
@@ -1641,7 +1595,7 @@ void G_DoLoadLevel(boolean resetplayer)
}
// Setup the level.
- if (!P_SetupLevel(false))
+ if (!P_SetupLevel(false)) // this never returns false?
{
// fail so reset game stuff
Command_ExitGame_f();
@@ -1990,6 +1944,8 @@ void G_Ticker(boolean run)
break;
case GS_TITLESCREEN:
+ if (titlemapinaction) P_Ticker(run); // then intentionally fall through
+ /* FALLTHRU */
case GS_WAITINGPLAYERS:
F_TitleScreenTicker(run);
break;
@@ -2067,6 +2023,7 @@ void G_PlayerReborn(INT32 player)
UINT32 thokitem;
UINT32 spinitem;
UINT32 revitem;
+ UINT32 followitem;
fixed_t actionspd;
fixed_t mindash;
fixed_t maxdash;
@@ -2090,6 +2047,7 @@ void G_PlayerReborn(INT32 player)
UINT32 availabilities;
tic_t jointime;
boolean spectator;
+ boolean outofcoop;
INT16 bot;
SINT8 pity;
@@ -2100,7 +2058,8 @@ void G_PlayerReborn(INT32 player)
exiting = players[player].exiting;
jointime = players[player].jointime;
spectator = players[player].spectator;
- pflags = (players[player].pflags & (PF_TIMEOVER|PF_FLIPCAM|PF_TAGIT|PF_TAGGED|PF_ANALOGMODE));
+ outofcoop = players[player].outofcoop;
+ pflags = (players[player].pflags & (PF_FLIPCAM|PF_ANALOGMODE|PF_DIRECTIONCHAR|PF_AUTOBRAKE|PF_TAGIT|PF_GAMETYPEOVER));
// As long as we're not in multiplayer, carry over cheatcodes from map to map
if (!(netgame || multiplayer))
@@ -2136,6 +2095,7 @@ void G_PlayerReborn(INT32 player)
thokitem = players[player].thokitem;
spinitem = players[player].spinitem;
revitem = players[player].revitem;
+ followitem = players[player].followitem;
actionspd = players[player].actionspd;
mindash = players[player].mindash;
maxdash = players[player].maxdash;
@@ -2154,6 +2114,7 @@ void G_PlayerReborn(INT32 player)
p->ctfteam = ctfteam;
p->jointime = jointime;
p->spectator = spectator;
+ p->outofcoop = outofcoop;
// save player config truth reborn
p->skincolor = skincolor;
@@ -2172,6 +2133,7 @@ void G_PlayerReborn(INT32 player)
p->thokitem = thokitem;
p->spinitem = spinitem;
p->revitem = revitem;
+ p->followitem = followitem;
p->actionspd = actionspd;
p->mindash = mindash;
p->maxdash = maxdash;
@@ -2205,8 +2167,8 @@ void G_PlayerReborn(INT32 player)
p->rings = 0; // 0 rings
p->panim = PA_IDLE; // standing animation
- if ((netgame || multiplayer) && !p->spectator)
- p->powers[pw_flashing] = flashingtics-1; // Babysitting deterrent
+ //if ((netgame || multiplayer) && !p->spectator) -- moved into P_SpawnPlayer to account for forced changes there
+ //p->powers[pw_flashing] = flashingtics-1; // Babysitting deterrent
if (p-players == consoleplayer)
{
@@ -2495,7 +2457,8 @@ void G_ChangePlayerReferences(mobj_t *oldmo, mobj_t *newmo)
void G_DoReborn(INT32 playernum)
{
player_t *player = &players[playernum];
- boolean starpost = false;
+ boolean resetlevel = false;
+ INT32 i;
if (modeattacking)
{
@@ -2521,35 +2484,98 @@ void G_DoReborn(INT32 playernum)
B_RespawnBot(playernum);
if (oldmo)
G_ChangePlayerReferences(oldmo, players[playernum].mo);
+
+ return;
}
- else if (countdowntimeup || (!multiplayer && gametype == GT_COOP))
+
+ if (countdowntimeup || (!(netgame || multiplayer) && gametype == GT_COOP))
+ resetlevel = true;
+ else if (gametype == GT_COOP && (netgame || multiplayer))
+ {
+ boolean notgameover = true;
+
+ if (cv_cooplives.value != 0 && player->lives <= 0) // consider game over first
+ {
+ for (i = 0; i < MAXPLAYERS; i++)
+ {
+ if (!playeringame[i])
+ continue;
+ if (players[i].exiting || players[i].lives > 0)
+ break;
+ }
+
+ if (i == MAXPLAYERS)
+ {
+ notgameover = false;
+ if (!countdown2)
+ {
+ // They're dead, Jim.
+ //nextmapoverride = spstage_start;
+ nextmapoverride = gamemap;
+ countdown2 = TICRATE;
+ skipstats = true;
+
+ for (i = 0; i < MAXPLAYERS; i++)
+ {
+ if (playeringame[i])
+ players[i].score = 0;
+ }
+
+ //emeralds = 0;
+ tokenbits = 0;
+ tokenlist = 0;
+ token = 0;
+ }
+ }
+ }
+
+ if (notgameover && cv_coopstarposts.value == 2)
+ {
+ for (i = 0; i < MAXPLAYERS; i++)
+ {
+ if (!playeringame[i])
+ continue;
+
+ if (players[i].playerstate != PST_DEAD && !players[i].spectator && players[i].mo && players[i].mo->health)
+ break;
+ }
+ if (i == MAXPLAYERS)
+ resetlevel = true;
+ }
+ }
+
+ if (resetlevel)
{
// reload the level from scratch
if (countdowntimeup)
{
- player->starpostangle = 0;
- player->starposttime = 0;
- player->starpostx = 0;
- player->starposty = 0;
- player->starpostz = 0;
- player->starpostnum = 0;
+ for (i = 0; i < MAXPLAYERS; i++)
+ {
+ if (!playeringame[i])
+ continue;
+ players[i].starpostangle = 0;
+ players[i].starposttime = 0;
+ players[i].starpostx = 0;
+ players[i].starposty = 0;
+ players[i].starpostz = 0;
+ players[i].starpostnum = 0;
+ }
}
if (!countdowntimeup && (mapheaderinfo[gamemap-1]->levelflags & LF_NORELOAD))
{
- INT32 i;
-
- player->playerstate = PST_REBORN;
-
P_LoadThingsOnly();
- P_ClearStarPost(player->starpostnum);
+ for (i = 0; i < MAXPLAYERS; i++)
+ {
+ if (!playeringame[i])
+ continue;
+ players[i].playerstate = PST_REBORN;
+ P_ClearStarPost(players[i].starpostnum);
+ }
// Do a wipe
wipegamestate = -1;
- if (player->starposttime)
- starpost = true;
-
if (camera.chase)
P_ResetCamera(&players[displayplayer], &camera);
if (camera2.chase && splitscreen)
@@ -2557,7 +2583,7 @@ void G_DoReborn(INT32 playernum)
// clear cmd building stuff
memset(gamekeydown, 0, sizeof (gamekeydown));
- for (i = 0;i < JOYAXISSET; i++)
+ for (i = 0; i < JOYAXISSET; i++)
{
joyxmove[i] = joyymove[i] = 0;
joy2xmove[i] = joy2ymove[i] = 0;
@@ -2569,31 +2595,45 @@ void G_DoReborn(INT32 playernum)
CON_ClearHUD();
// Starpost support
- G_SpawnPlayer(playernum, starpost);
+ for (i = 0; i < MAXPLAYERS; i++)
+ {
+ if (!playeringame[i])
+ continue;
+ G_SpawnPlayer(i, (players[i].starposttime));
+ }
- if (botingame)
- { // Bots respawn next to their master.
- players[secondarydisplayplayer].playerstate = PST_REBORN;
- G_SpawnPlayer(secondarydisplayplayer, false);
+ // restore time in netgame (see also p_setup.c)
+ if ((netgame || multiplayer) && gametype == GT_COOP && cv_coopstarposts.value == 2)
+ {
+ // is this a hack? maybe
+ tic_t maxstarposttime = 0;
+ for (i = 0; i < MAXPLAYERS; i++)
+ {
+ if (playeringame[i] && players[i].starposttime > maxstarposttime)
+ maxstarposttime = players[i].starposttime;
+ }
+ leveltime = maxstarposttime;
}
}
else
-#ifdef HAVE_BLUA
{
+#ifdef HAVE_BLUA
LUAh_MapChange();
#endif
G_DoLoadLevel(true);
-#ifdef HAVE_BLUA
+ return;
}
-#endif
}
else
{
// respawn at the start
mobj_t *oldmo = NULL;
- if (player->starposttime)
- starpost = true;
+ // Not resetting map, so return to level music
+ if (!countdown2
+ && player->lives <= 0
+ && cv_cooplives.value == 1) // not allowed for life steal because no way to come back from zero group lives without addons, which should call this anyways
+ P_RestoreMultiMusic(player);
// first dissasociate the corpse
if (player->mo)
@@ -2603,7 +2643,7 @@ void G_DoReborn(INT32 playernum)
P_RemoveMobj(player->mo);
}
- G_SpawnPlayer(playernum, starpost);
+ G_SpawnPlayer(playernum, (player->starposttime));
if (oldmo)
G_ChangePlayerReferences(oldmo, players[playernum].mo);
}
@@ -2611,10 +2651,49 @@ void G_DoReborn(INT32 playernum)
void G_AddPlayer(INT32 playernum)
{
+ INT32 countplayers = 0, notexiting = 0;
+
player_t *p = &players[playernum];
+ // Go through the current players and make sure you have the latest starpost set
+ if (G_PlatformGametype() && (netgame || multiplayer))
+ {
+ INT32 i;
+ for (i = 0; i < MAXPLAYERS; i++)
+ {
+ if (!playeringame[i])
+ continue;
+
+ if (players[i].bot) // ignore dumb, stupid tails
+ continue;
+
+ countplayers++;
+
+ if (!players->exiting)
+ notexiting++;
+
+ if (!(cv_coopstarposts.value && (gametype == GT_COOP) && (p->starpostnum < players[i].starpostnum)))
+ continue;
+
+ p->starposttime = players[i].starposttime;
+ p->starpostx = players[i].starpostx;
+ p->starposty = players[i].starposty;
+ p->starpostz = players[i].starpostz;
+ p->starpostangle = players[i].starpostangle;
+ p->starpostnum = players[i].starpostnum;
+ }
+ }
+
p->jointime = 0;
p->playerstate = PST_REBORN;
+
+ p->height = mobjinfo[MT_PLAYER].height;
+
+ if (G_GametypeUsesLives() || ((netgame || multiplayer) && gametype == GT_COOP))
+ p->lives = cv_startinglives.value;
+
+ if (countplayers && !notexiting)
+ P_DoPlayerExit(p);
}
void G_ExitLevel(void)
@@ -3040,8 +3119,11 @@ static void G_DoContinued(void)
tokenlist = 0;
token = 0;
+ if (!(netgame || multiplayer || demoplayback || demorecording || metalrecording || modeattacking) && (!modifiedgame || savemoddata) && cursaveslot > 0)
+ G_SaveGameOver((UINT32)cursaveslot, true);
+
// Reset # of lives
- pl->lives = (ultimatemode) ? 1 : 3;
+ pl->lives = (ultimatemode) ? 1 : startinglivesbalance[numgameovers];
D_MapChange(gamemap, gametype, ultimatemode, false, 0, false, false);
@@ -3380,59 +3462,6 @@ void G_SaveGameData(void)
#define VERSIONSIZE 16
-#ifdef SAVEGAMES_OTHERVERSIONS
-static INT16 startonmapnum = 0;
-
-//
-// User wants to load a savegame from a different version?
-//
-static void M_ForceLoadGameResponse(INT32 ch)
-{
- if (ch != 'y' && ch != KEY_ENTER)
- {
- //refused
- Z_Free(savebuffer);
- save_p = savebuffer = NULL;
- startonmapnum = 0;
- M_SetupNextMenu(&SP_LoadDef);
- return;
- }
-
- // pick up where we left off.
- save_p += VERSIONSIZE;
- if (!P_LoadGame(startonmapnum))
- {
- M_ClearMenus(true); // so ESC backs out to title
- M_StartMessage(M_GetText("Savegame file corrupted\n\nPress ESC\n"), NULL, MM_NOTHING);
- Command_ExitGame_f();
- Z_Free(savebuffer);
- save_p = savebuffer = NULL;
- startonmapnum = 0;
-
- // no cheating!
- memset(&savedata, 0, sizeof(savedata));
- return;
- }
-
- // done
- Z_Free(savebuffer);
- save_p = savebuffer = NULL;
- startonmapnum = 0;
-
- //set cursaveslot to -1 so nothing gets saved.
- cursaveslot = -1;
-
- displayplayer = consoleplayer;
- multiplayer = splitscreen = false;
-
- if (setsizeneeded)
- R_ExecuteSetViewSize();
-
- M_ClearMenus(true);
- CON_ToggleOff();
-}
-#endif
-
//
// G_InitFromSavegame
// Can be called by the startup code or the menu task.
@@ -3525,13 +3554,13 @@ void G_LoadGame(UINT32 slot, INT16 mapoverride)
// G_SaveGame
// Saves your game.
//
-void G_SaveGame(UINT32 savegameslot)
+void G_SaveGame(UINT32 slot)
{
boolean saved;
char savename[256] = "";
const char *backup;
- sprintf(savename, savegamename, savegameslot);
+ sprintf(savename, savegamename, slot);
backup = va("%s",savename);
// save during evaluation or credits? game's over, folks!
@@ -3567,9 +3596,91 @@ void G_SaveGame(UINT32 savegameslot)
if (cv_debug && saved)
CONS_Printf(M_GetText("Game saved.\n"));
else if (!saved)
- CONS_Alert(CONS_ERROR, M_GetText("Error while writing to %s for save slot %u, base: %s\n"), backup, savegameslot, savegamename);
+ CONS_Alert(CONS_ERROR, M_GetText("Error while writing to %s for save slot %u, base: %s\n"), backup, slot, savegamename);
}
+#define BADSAVE goto cleanup;
+#define CHECKPOS if (save_p >= end_p) BADSAVE
+void G_SaveGameOver(UINT32 slot, boolean modifylives)
+{
+ boolean saved = false;
+ size_t length;
+ char vcheck[VERSIONSIZE];
+ char savename[255];
+ const char *backup;
+
+ sprintf(savename, savegamename, slot);
+ backup = va("%s",savename);
+
+ length = FIL_ReadFile(savename, &savebuffer);
+ if (!length)
+ {
+ CONS_Printf(M_GetText("Couldn't read file %s\n"), savename);
+ return;
+ }
+
+ {
+ char temp[sizeof(timeattackfolder)];
+ UINT8 *end_p = savebuffer + length;
+ UINT8 *lives_p;
+ SINT8 pllives;
+
+ save_p = savebuffer;
+ // Version check
+ memset(vcheck, 0, sizeof (vcheck));
+ sprintf(vcheck, "version %d", VERSION);
+ if (strcmp((const char *)save_p, (const char *)vcheck)) BADSAVE
+ save_p += VERSIONSIZE;
+
+ // P_UnArchiveMisc()
+ (void)READINT16(save_p);
+ CHECKPOS
+ (void)READUINT16(save_p); // emeralds
+ CHECKPOS
+ READSTRINGN(save_p, temp, sizeof(temp)); // mod it belongs to
+ if (strcmp(temp, timeattackfolder)) BADSAVE
+
+ // P_UnArchivePlayer()
+ CHECKPOS
+ (void)READUINT16(save_p);
+ CHECKPOS
+
+ WRITEUINT8(save_p, numgameovers);
+ CHECKPOS
+
+ lives_p = save_p;
+ pllives = READSINT8(save_p); // lives
+ CHECKPOS
+ if (modifylives && pllives < startinglivesbalance[numgameovers])
+ {
+ pllives = startinglivesbalance[numgameovers];
+ WRITESINT8(lives_p, pllives);
+ }
+
+ (void)READINT32(save_p); // Score
+ CHECKPOS
+ (void)READINT32(save_p); // continues
+
+ // File end marker check
+ CHECKPOS
+ if (READUINT8(save_p) != 0x1d) BADSAVE;
+
+ // done
+ saved = FIL_WriteFile(backup, savebuffer, length);
+ }
+
+cleanup:
+ if (cv_debug && saved)
+ CONS_Printf(M_GetText("Game saved.\n"));
+ else if (!saved)
+ CONS_Alert(CONS_ERROR, M_GetText("Error while writing to %s for save slot %u, base: %s\n"), backup, slot, savegamename);
+ Z_Free(savebuffer);
+ save_p = savebuffer = NULL;
+
+}
+#undef CHECKPOS
+#undef BADSAVE
+
//
// G_DeferedInitNew
// Can be called by the startup code or the menu task,
@@ -3577,7 +3688,7 @@ void G_SaveGame(UINT32 savegameslot)
//
void G_DeferedInitNew(boolean pultmode, const char *mapname, INT32 pickedchar, boolean SSSG, boolean FLS)
{
- UINT8 color = 0;
+ UINT8 color = skins[pickedchar].prefcolor;
paused = false;
if (demoplayback)
@@ -3589,10 +3700,8 @@ void G_DeferedInitNew(boolean pultmode, const char *mapname, INT32 pickedchar, b
if (savedata.lives > 0)
{
- color = savedata.skincolor;
- botskin = savedata.botskin;
- botcolor = savedata.botcolor;
- botingame = (botskin != 0);
+ if ((botingame = ((botskin = savedata.botskin) != 0)))
+ botcolor = skins[botskin-1].prefcolor;
}
else if (splitscreen != SSSG)
{
@@ -3600,8 +3709,7 @@ void G_DeferedInitNew(boolean pultmode, const char *mapname, INT32 pickedchar, b
SplitScreen_OnChange();
}
- if (!color)
- color = skins[pickedchar].prefcolor;
+ color = skins[pickedchar].prefcolor;
SetPlayerSkinByNum(consoleplayer, pickedchar);
CV_StealthSet(&cv_skin, skins[pickedchar].name);
CV_StealthSetValue(&cv_playercolor, color);
@@ -3633,7 +3741,7 @@ void G_InitNew(UINT8 pultmode, const char *mapname, boolean resetplayer, boolean
if (resetplayer)
{
// Clear a bunch of variables
- tokenlist = token = sstimer = redscore = bluescore = lastmap = 0;
+ numgameovers = tokenlist = token = sstimer = redscore = bluescore = lastmap = 0;
countdown = countdown2 = 0;
for (i = 0; i < MAXPLAYERS; i++)
@@ -3644,26 +3752,21 @@ void G_InitNew(UINT8 pultmode, const char *mapname, boolean resetplayer, boolean
if (netgame || multiplayer)
{
- if (!FLS || (players[i].lives < cv_startinglives.value))
+ if (!FLS || (players[i].lives < 1))
players[i].lives = cv_startinglives.value;
players[i].continues = 0;
}
- else if (pultmode)
- {
- players[i].lives = 1;
- players[i].continues = 0;
- }
else
{
- players[i].lives = 3;
- players[i].continues = 1;
+ players[i].lives = (pultmode) ? 1 : startinglivesbalance[0];
+ players[i].continues = (pultmode) ? 0 : 1;
}
if (!((netgame || multiplayer) && (FLS)))
players[i].score = 0;
// The latter two should clear by themselves, but just in case
- players[i].pflags &= ~(PF_TAGIT|PF_TAGGED|PF_FULLSTASIS);
+ players[i].pflags &= ~(PF_TAGIT|PF_GAMETYPEOVER|PF_FULLSTASIS);
// Clear cheatcodes too, just in case.
players[i].pflags &= ~(PF_GODMODE|PF_NOCLIP|PF_INVIS);
@@ -4446,7 +4549,7 @@ void G_GhostTicker(void)
g->mo->color += abs( ( (signed)( (unsigned)leveltime >> 1 ) % 9) - 4);
break;
case GHC_INVINCIBLE: // Mario invincibility (P_CheckInvincibilityTimer)
- g->mo->color = (UINT8)(SKINCOLOR_RED + (leveltime % (MAXSKINCOLORS - SKINCOLOR_RED))); // Passes through all saturated colours
+ g->mo->color = (UINT8)(SKINCOLOR_RUBY + (leveltime % (MAXSKINCOLORS - SKINCOLOR_RUBY))); // Passes through all saturated colours
break;
default:
break;
diff --git a/src/g_game.h b/src/g_game.h
index 3313f0bb8..f85b13b26 100644
--- a/src/g_game.h
+++ b/src/g_game.h
@@ -59,6 +59,8 @@ extern consvar_t cv_invertmouse, cv_alwaysfreelook, cv_mousemove;
extern consvar_t cv_invertmouse2, cv_alwaysfreelook2, cv_mousemove2;
extern consvar_t cv_useranalog, cv_useranalog2;
extern consvar_t cv_analog, cv_analog2;
+extern consvar_t cv_directionchar, cv_directionchar2;
+extern consvar_t cv_autobrake, cv_autobrake2;
extern consvar_t cv_sideaxis,cv_turnaxis,cv_moveaxis,cv_lookaxis,cv_fireaxis,cv_firenaxis;
extern consvar_t cv_sideaxis2,cv_turnaxis2,cv_moveaxis2,cv_lookaxis2,cv_fireaxis2,cv_firenaxis2;
extern consvar_t cv_ghost_bestscore, cv_ghost_besttime, cv_ghost_bestrings, cv_ghost_last, cv_ghost_guest;
@@ -116,6 +118,8 @@ void G_SaveGameData(void);
void G_SaveGame(UINT32 slot);
+void G_SaveGameOver(UINT32 slot, boolean modifylives);
+
// Only called by startup code.
void G_RecordDemo(const char *name);
void G_RecordMetal(void);
diff --git a/src/g_input.c b/src/g_input.c
index 36b8373aa..67aaf4179 100644
--- a/src/g_input.c
+++ b/src/g_input.c
@@ -204,11 +204,9 @@ static keyname_t keynames[] =
{KEY_SCROLLLOCK, "SCROLLLOCK"},
// bill gates keys
-#ifndef _arch_dreamcast
{KEY_LEFTWIN, "LEFTWIN"},
{KEY_RIGHTWIN, "RIGHTWIN"},
{KEY_MENU, "MENU"},
-#endif
{KEY_LSHIFT, "LSHIFT"},
{KEY_RSHIFT, "RSHIFT"},
@@ -270,140 +268,24 @@ static keyname_t keynames[] =
{KEY_MOUSE1+0,"MOUSE1"},
{KEY_MOUSE1+1,"MOUSE2"},
{KEY_MOUSE1+2,"MOUSE3"},
-#if !defined (_arch_dreamcast) && !defined (_XBOX) && !defined (_PSP) && !defined (_WII)
{KEY_MOUSE1+3,"MOUSE4"},
{KEY_MOUSE1+4,"MOUSE5"},
{KEY_MOUSE1+5,"MOUSE6"},
{KEY_MOUSE1+6,"MOUSE7"},
{KEY_MOUSE1+7,"MOUSE8"},
-#endif
{KEY_2MOUSE1+0,"SEC_MOUSE2"}, // BP: sorry my mouse handler swap button 1 and 2
{KEY_2MOUSE1+1,"SEC_MOUSE1"},
{KEY_2MOUSE1+2,"SEC_MOUSE3"},
-#if !defined (_arch_dreamcast) && !defined (_XBOX) && !defined (_PSP) && !defined (_WII)
{KEY_2MOUSE1+3,"SEC_MOUSE4"},
{KEY_2MOUSE1+4,"SEC_MOUSE5"},
{KEY_2MOUSE1+5,"SEC_MOUSE6"},
{KEY_2MOUSE1+6,"SEC_MOUSE7"},
{KEY_2MOUSE1+7,"SEC_MOUSE8"},
-#endif
{KEY_MOUSEWHEELUP, "Wheel 1 UP"},
{KEY_MOUSEWHEELDOWN, "Wheel 1 Down"},
{KEY_2MOUSEWHEELUP, "Wheel 2 UP"},
{KEY_2MOUSEWHEELDOWN, "Wheel 2 Down"},
-#ifdef DC
- {KEY_JOY1+0, "JOYC"},
- {KEY_JOY1+1, "JOYB"},
- {KEY_JOY1+2, "JOYA"},
- {KEY_JOY1+3, "JOYS"},
- {KEY_JOY1+4, "JOYZ"},
- {KEY_JOY1+5, "JOYY"},
- {KEY_JOY1+6, "JOYX"},
- {KEY_JOY1+7, "JOYD"},
-#elif defined (_XBOX)
- {KEY_JOY1+0, "JOYA"},
- {KEY_JOY1+1, "JOYB"},
- {KEY_JOY1+2, "JOYX"},
- {KEY_JOY1+3, "JOYY"},
- {KEY_JOY1+4, "JOYG"},
- {KEY_JOY1+5, "JOYW"},
- {KEY_JOY1+6, "JOYL"},
- {KEY_JOY1+7, "JOYR"},
- {KEY_JOY1+8, "JOYS"},
- {KEY_JOY1+9, "JOYN"},
- {KEY_JOY1+10,"JOYW"},
- {KEY_JOY1+11,"JOYE"},
-#define NOMOREJOYBTN_1S
-#elif defined (_PSP)
- {KEY_JOY1+0, "TRIANGLE"},
- {KEY_JOY1+1, "CIRCLE" },
- {KEY_JOY1+2, "CROSS" },
- {KEY_JOY1+3, "SQUARE" },
- {KEY_JOY1+4, "LTRIGGER"},
- {KEY_JOY1+5, "RTRIGGER"},
- {KEY_JOY1+6, "SELECT" },
- {KEY_JOY1+7, "START" },
- {KEY_JOY1+8, "HOME" },
- {KEY_JOY1+9, "HOLD" },
-#define NOMOREJOYBTN_1S
-#elif defined (GP2X)
- {KEY_JOY1+0, "JOYA"},
- {KEY_JOY1+1, "JOYY"},
- {KEY_JOY1+2, "JOYB"},
- {KEY_JOY1+3, "JOYX"},
- {KEY_JOY1+4, "JOYL"},
- {KEY_JOY1+5, "JOYR"},
- {KEY_JOY1+6, "JOYVOLUP"},
- {KEY_JOY1+7, "JOYVOLDOWN"},
- {KEY_JOY1+8, "JOYSELECT"},
-#elif defined (_NDS)
- {KEY_JOY1+0, "JOYA"},
- {KEY_JOY1+1, "JOYB"},
- {KEY_JOY1+2, "JOYX"},
- {KEY_JOY1+3, "JOYY"},
- {KEY_JOY1+4, "JOYL"},
- {KEY_JOY1+5, "JOYR"},
- {KEY_JOY1+6, "JOYSTART"},
- {KEY_JOY1+7, "JOYSELECT"},
-#define NOMOREJOYBTN_1S
-#elif defined (WMINPUT)
- {KEY_JOY1+0, "JOYB"},
- {KEY_JOY1+1, "JOYA"},
- {KEY_JOY1+2, "JOYUP"},
- {KEY_JOY1+3, "JOYDOWN"},
- {KEY_JOY1+4, "JOYLEFT"},
- {KEY_JOY1+5, "JOYRIGHT"},
- {KEY_JOY1+6, "JOYAA"},
- {KEY_JOY1+7, "JOYBB"},
- {KEY_JOY1+8, "JOYCC"},
- {KEY_JOY1+9, "JOYXX"},
- {KEY_JOY1+10, "JOYYY"},
- {KEY_JOY1+11, "JOYZZ"},
- {KEY_JOY1+12, "JOYL"},
- {KEY_JOY1+13, "JOYR"},
- {KEY_JOY1+14, "JOYZL"},
- {KEY_JOY1+15, "JOYZR"},
- {KEY_JOY1+16, "JOYSELECT"},
- {KEY_JOY1+17, "JOYSTART"},
- {KEY_JOY1+18, "JOYHOME"},
- {KEY_JOY1+19, "JOYMINUS"},
- {KEY_JOY1+20, "JOYPLUS"},
- {KEY_JOY1+21, "JOY_1"},
- {KEY_JOY1+22, "JOY_2"},
- {KEY_JOY1+23, "JOY24"},
- {KEY_JOY1+24, "JOY25"},
- {KEY_JOY1+25, "JOY26"},
- {KEY_JOY1+26, "JOY27"},
- {KEY_JOY1+27, "JOY28"},
- {KEY_JOY1+28, "JOY29"},
- {KEY_JOY1+29, "JOY30"},
- {KEY_JOY1+30, "JOY31"},
- {KEY_JOY1+31, "JOY32"},
-#define NOMOREJOYBTN_1S
-#elif defined (_WII)
- {KEY_JOY1+0, "JOYA"},
- {KEY_JOY1+1, "JOYB"},
- {KEY_JOY1+2, "JOY1"},
- {KEY_JOY1+3, "JOY2"},
- {KEY_JOY1+4, "JOYMINUS"},
- {KEY_JOY1+5, "JOYPLUS"},
- {KEY_JOY1+6, "JOYHOME"},
- {KEY_JOY1+7, "JOYZ"},
- {KEY_JOY1+8, "JOYC"},
- {KEY_JOY1+9, "JOYA_CC"},
- {KEY_JOY1+10, "JOYB_CC"},
- {KEY_JOY1+11, "JOYX"},
- {KEY_JOY1+12, "JOYY"},
- {KEY_JOY1+13, "JOYL"},
- {KEY_JOY1+14, "JOYR"},
- {KEY_JOY1+15, "JOYZL"},
- {KEY_JOY1+16, "JOYZR"},
- {KEY_JOY1+17, "JOYMINUS_CC"},
- {KEY_JOY1+18, "JOYHPLUS_CC"},
- {KEY_JOY1+19, "JOYMHOME_CC"},
-#define NOMOREJOYBTN_1S
-#else
{KEY_JOY1+0, "JOY1"},
{KEY_JOY1+1, "JOY2"},
{KEY_JOY1+2, "JOY3"},
@@ -413,8 +295,7 @@ static keyname_t keynames[] =
{KEY_JOY1+6, "JOY7"},
{KEY_JOY1+7, "JOY8"},
{KEY_JOY1+8, "JOY9"},
-#endif
-#if !defined (_arch_dreamcast) && !defined (NOMOREJOYBTN_1S)
+#if !defined (NOMOREJOYBTN_1S)
// we use up to 32 buttons in DirectInput
{KEY_JOY1+9, "JOY10"},
{KEY_JOY1+10, "JOY11"},
@@ -445,12 +326,10 @@ static keyname_t keynames[] =
{KEY_HAT1+1, "HATDOWN"},
{KEY_HAT1+2, "HATLEFT"},
{KEY_HAT1+3, "HATRIGHT"},
-#if !defined (_XBOX) && !defined (_PSP) && !defined (_WII)
{KEY_HAT1+4, "HATUP2"},
{KEY_HAT1+5, "HATDOWN2"},
{KEY_HAT1+6, "HATLEFT2"},
{KEY_HAT1+7, "HATRIGHT2"},
-#ifndef _arch_dreamcast
{KEY_HAT1+8, "HATUP3"},
{KEY_HAT1+9, "HATDOWN3"},
{KEY_HAT1+10, "HATLEFT3"},
@@ -459,142 +338,24 @@ static keyname_t keynames[] =
{KEY_HAT1+13, "HATDOWN4"},
{KEY_HAT1+14, "HATLEFT4"},
{KEY_HAT1+15, "HATRIGHT4"},
-#endif
-#endif
{KEY_DBLMOUSE1+0, "DBLMOUSE1"},
{KEY_DBLMOUSE1+1, "DBLMOUSE2"},
{KEY_DBLMOUSE1+2, "DBLMOUSE3"},
-#if !defined (_arch_dreamcast) && !defined (_XBOX) && !defined (_PSP) && !defined (_WII)
{KEY_DBLMOUSE1+3, "DBLMOUSE4"},
{KEY_DBLMOUSE1+4, "DBLMOUSE5"},
{KEY_DBLMOUSE1+5, "DBLMOUSE6"},
{KEY_DBLMOUSE1+6, "DBLMOUSE7"},
{KEY_DBLMOUSE1+7, "DBLMOUSE8"},
-#endif
{KEY_DBL2MOUSE1+0, "DBLSEC_MOUSE2"}, // BP: sorry my mouse handler swap button 1 and 2
{KEY_DBL2MOUSE1+1, "DBLSEC_MOUSE1"},
{KEY_DBL2MOUSE1+2, "DBLSEC_MOUSE3"},
-#if !defined (_arch_dreamcast) && !defined (_XBOX) && !defined (_PSP) && !defined (_WII)
{KEY_DBL2MOUSE1+3, "DBLSEC_MOUSE4"},
{KEY_DBL2MOUSE1+4, "DBLSEC_MOUSE5"},
{KEY_DBL2MOUSE1+5, "DBLSEC_MOUSE6"},
{KEY_DBL2MOUSE1+6, "DBLSEC_MOUSE7"},
{KEY_DBL2MOUSE1+7, "DBLSEC_MOUSE8"},
-#endif
-#ifdef DC
- {KEY_DBLJOY1+0, "DBLJOYC"},
- {KEY_DBLJOY1+1, "DBLJOYB"},
- {KEY_DBLJOY1+2, "DBLJOYA"},
- {KEY_DBLJOY1+3, "DBLJOYS"},
- {KEY_DBLJOY1+4, "DBLJOYZ"},
- {KEY_DBLJOY1+5, "DBLJOYY"},
- {KEY_DBLJOY1+6, "DBLJOYX"},
- {KEY_DBLJOY1+7, "DBLJOYD"},
-#elif defined (_XBOX)
- {KEY_DBLJOY1+0, "DBLJOYA"},
- {KEY_DBLJOY1+1, "DBLJOYB"},
- {KEY_DBLJOY1+2, "DBLJOYX"},
- {KEY_DBLJOY1+3, "DBLJOYY"},
- {KEY_DBLJOY1+4, "DBLJOYG"},
- {KEY_DBLJOY1+5, "DBLJOYW"},
- {KEY_DBLJOY1+6, "DBLJOYL"},
- {KEY_DBLJOY1+7, "DBLJOYR"},
- {KEY_DBLJOY1+8, "DBLJOYS"},
- {KEY_DBLJOY1+9, "DBLJOYN"},
- {KEY_DBLJOY1+10,"DBLJOYW"},
- {KEY_DBLJOY1+11,"DBLJOYE"},
-#define NOMOREJOYBTN_1DBL
-#elif defined (_PSP)
- {KEY_DBLJOY1+0, "DBLTRIANGLE"},
- {KEY_DBLJOY1+1, "DBLCIRCLE" },
- {KEY_DBLJOY1+2, "DBLCROSS" },
- {KEY_DBLJOY1+3, "DBLSQUARE" },
- {KEY_DBLJOY1+4, "DBLLTRIGGER"},
- {KEY_DBLJOY1+5, "DBLRTRIGGER"},
- {KEY_DBLJOY1+6, "DBLSELECT" },
- {KEY_DBLJOY1+7, "DBLSTART" },
- {KEY_DBLJOY1+8, "DBLHOME" },
- {KEY_DBLJOY1+9, "DBLHOLD" },
-#elif defined (GP2X)
- {KEY_DBLJOY1+0, "DBLJOYA"},
- {KEY_DBLJOY1+1, "DBLJOYY"},
- {KEY_DBLJOY1+2, "DBLJOYB"},
- {KEY_DBLJOY1+3, "DBLJOYX"},
- {KEY_DBLJOY1+4, "DBLJOYL"},
- {KEY_DBLJOY1+5, "DBLJOYR"},
- {KEY_DBLJOY1+6, "DBLJOYVOLUP"},
- {KEY_DBLJOY1+7, "DBLJOYVOLDOWN"},
- {KEY_DBLJOY1+8, "DBLJOYSELECT"},
-#define NOMOREJOYBTN_1DBL
-#elif defined (_NDS)
- {KEY_DBLJOY1+0, "DBLJOYA"},
- {KEY_DBLJOY1+1, "DBLJOYB"},
- {KEY_DBLJOY1+2, "DBLJOYX"},
- {KEY_DBLJOY1+3, "DBLJOYY"},
- {KEY_DBLJOY1+4, "DBLJOYL"},
- {KEY_DBLJOY1+5, "DBLJOYR"},
- {KEY_DBLJOY1+6, "DBLJOYSTART"},
- {KEY_DBLJOY1+7, "DBLJOYSELECT"},
-#define NOMOREJOYBTN_1DBL
-#elif defined (WMINPUT)
- {KEY_DBLJOY1+0, "DBLJOYB"},
- {KEY_DBLJOY1+1, "DBLJOYA"},
- {KEY_DBLJOY1+2, "DBLJOYUP"},
- {KEY_DBLJOY1+3, "DBLJOYDOWN"},
- {KEY_DBLJOY1+4, "DBLJOYLEFT"},
- {KEY_DBLJOY1+5, "DBLJOYRIGHT"},
- {KEY_DBLJOY1+6, "DBLJOYAA"},
- {KEY_DBLJOY1+7, "DBLJOYBB"},
- {KEY_DBLJOY1+8, "DBLJOYCC"},
- {KEY_DBLJOY1+9, "DBLJOYXX"},
- {KEY_DBLJOY1+10, "DBLJOYYY"},
- {KEY_DBLJOY1+11, "DBLJOYZZ"},
- {KEY_DBLJOY1+12, "DBLJOYL"},
- {KEY_DBLJOY1+13, "DBLJOYR"},
- {KEY_DBLJOY1+14, "DBLJOYZL"},
- {KEY_DBLJOY1+15, "DBLJOYZR"},
- {KEY_DBLJOY1+16, "DBLJOYSELECT"},
- {KEY_DBLJOY1+17, "DBLJOYSTART"},
- {KEY_DBLJOY1+18, "DBLJOYHOME"},
- {KEY_DBLJOY1+19, "DBLJOYMINUS"},
- {KEY_DBLJOY1+20, "DBLJOYPLUS"},
- {KEY_DBLJOY1+21, "DBLJOY_1"},
- {KEY_DBLJOY1+22, "DBLJOY_2"},
- {KEY_DBLJOY1+23, "DBLJOY24"},
- {KEY_DBLJOY1+24, "DBLJOY25"},
- {KEY_DBLJOY1+25, "DBLJOY26"},
- {KEY_DBLJOY1+26, "DBLJOY27"},
- {KEY_DBLJOY1+27, "DBLJOY28"},
- {KEY_DBLJOY1+28, "DBLJOY29"},
- {KEY_DBLJOY1+29, "DBLJOY30"},
- {KEY_DBLJOY1+30, "DBLJOY31"},
- {KEY_DBLJOY1+31, "DBLJOY32"},
-#define NOMOREJOYBTN_1DBL
-#elif defined (_WII)
- {KEY_DBLJOY1+0, "DBLJOYA"},
- {KEY_DBLJOY1+1, "DBLJOYB"},
- {KEY_DBLJOY1+2, "DBLJOY1"},
- {KEY_DBLJOY1+3, "DBLJOY2"},
- {KEY_DBLJOY1+4, "DBLJOYMINUS"},
- {KEY_DBLJOY1+5, "DBLJOYPLUS"},
- {KEY_DBLJOY1+6, "DBLJOYHOME"},
- {KEY_DBLJOY1+7, "DBLJOYZ"},
- {KEY_DBLJOY1+8, "DBLJOYC"},
- {KEY_DBLJOY1+9, "DBLJOYA_CC"},
- {KEY_DBLJOY1+10, "DBLJOYB_CC"},
- {KEY_DBLJOY1+11, "DBLJOYX"},
- {KEY_DBLJOY1+12, "DBLJOYY"},
- {KEY_DBLJOY1+13, "DBLJOYL"},
- {KEY_DBLJOY1+14, "DBLJOYR"},
- {KEY_DBLJOY1+15, "DBLJOYZL"},
- {KEY_DBLJOY1+16, "DBLJOYZR"},
- {KEY_DBLJOY1+17, "DBLJOYMINUS_CC"},
- {KEY_DBLJOY1+18, "DBLJOYHPLUS_CC"},
- {KEY_DBLJOY1+19, "DBLJOYMHOME_CC"},
-#define NOMOREJOYBTN_1DBL
-#else
{KEY_DBLJOY1+0, "DBLJOY1"},
{KEY_DBLJOY1+1, "DBLJOY2"},
{KEY_DBLJOY1+2, "DBLJOY3"},
@@ -603,8 +364,7 @@ static keyname_t keynames[] =
{KEY_DBLJOY1+5, "DBLJOY6"},
{KEY_DBLJOY1+6, "DBLJOY7"},
{KEY_DBLJOY1+7, "DBLJOY8"},
-#endif
-#if !defined (_arch_dreamcast) && !defined (NOMOREJOYBTN_1DBL)
+#if !defined (NOMOREJOYBTN_1DBL)
{KEY_DBLJOY1+8, "DBLJOY9"},
{KEY_DBLJOY1+9, "DBLJOY10"},
{KEY_DBLJOY1+10, "DBLJOY11"},
@@ -634,12 +394,10 @@ static keyname_t keynames[] =
{KEY_DBLHAT1+1, "DBLHATDOWN"},
{KEY_DBLHAT1+2, "DBLHATLEFT"},
{KEY_DBLHAT1+3, "DBLHATRIGHT"},
-#if !defined (_XBOX) && !defined (_PSP) && !defined (_WII)
{KEY_DBLHAT1+4, "DBLHATUP2"},
{KEY_DBLHAT1+5, "DBLHATDOWN2"},
{KEY_DBLHAT1+6, "DBLHATLEFT2"},
{KEY_DBLHAT1+7, "DBLHATRIGHT2"},
-#ifndef _arch_dreamcast
{KEY_DBLHAT1+8, "DBLHATUP3"},
{KEY_DBLHAT1+9, "DBLHATDOWN3"},
{KEY_DBLHAT1+10, "DBLHATLEFT3"},
@@ -648,101 +406,7 @@ static keyname_t keynames[] =
{KEY_DBLHAT1+13, "DBLHATDOWN4"},
{KEY_DBLHAT1+14, "DBLHATLEFT4"},
{KEY_DBLHAT1+15, "DBLHATRIGHT4"},
-#endif
-#endif
-#ifdef DC
- {KEY_2JOY1+0, "SEC_JOYC"},
- {KEY_2JOY1+1, "SEC_JOYB"},
- {KEY_2JOY1+2, "SEC_JOYA"},
- {KEY_2JOY1+3, "SEC_JOYS"},
- {KEY_2JOY1+4, "SEC_JOYZ"},
- {KEY_2JOY1+5, "SEC_JOYY"},
- {KEY_2JOY1+6, "SEC_JOYX"},
- {KEY_2JOY1+7, "SEC_JOYD"},
-#elif defined (_XBOX)
- {KEY_2JOY1+0, "SEC_JOYA"},
- {KEY_2JOY1+1, "SEC_JOYB"},
- {KEY_2JOY1+2, "SEC_JOYX"},
- {KEY_2JOY1+3, "SEC_JOYY"},
- {KEY_2JOY1+4, "SEC_JOYG"},
- {KEY_2JOY1+5, "SEC_JOYW"},
- {KEY_2JOY1+6, "SEC_JOYL"},
- {KEY_2JOY1+7, "SEC_JOYR"},
- {KEY_2JOY1+8, "SEC_JOYS"},
- {KEY_2JOY1+9, "SEC_JOYN"},
- {KEY_2JOY1+10,"SEC_JOYW"},
- {KEY_2JOY1+11,"SEC_JOYE"},
-#define NOMOREJOYBTN_2S
-#elif defined (_PSP)
- {KEY_2JOY1+0, "SEC_TRIANGLE"},
- {KEY_2JOY1+1, "SEC_CIRCLE" },
- {KEY_2JOY1+2, "SEC_CROSS" },
- {KEY_2JOY1+3, "SEC_SQUARE" },
- {KEY_2JOY1+4, "SEC_LTRIGGER"},
- {KEY_2JOY1+5, "SEC_RTRIGGER"},
- {KEY_2JOY1+6, "SEC_SELECT" },
- {KEY_2JOY1+7, "SEC_START" },
- {KEY_2JOY1+8, "SEC_HOME" },
- {KEY_2JOY1+9, "SEC_HOLD" },
-#define NOMOREJOYBTN_2S
-#elif defined (WMINPUT)
- {KEY_2JOY1+0, "SEC_JOYB"},
- {KEY_2JOY1+1, "SEC_JOYA"},
- {KEY_2JOY1+2, "SEC_JOYUP"},
- {KEY_2JOY1+3, "SEC_JOYDOWN"},
- {KEY_2JOY1+4, "SEC_JOYLEFT"},
- {KEY_2JOY1+5, "SEC_JOYRIGHT"},
- {KEY_2JOY1+6, "SEC_JOYAA"},
- {KEY_2JOY1+7, "SEC_JOYBB"},
- {KEY_2JOY1+8, "SEC_JOYCC"},
- {KEY_2JOY1+9, "SEC_JOYXX"},
- {KEY_2JOY1+10, "SEC_JOYYY"},
- {KEY_2JOY1+11, "SEC_JOYZZ"},
- {KEY_2JOY1+12, "SEC_JOYL"},
- {KEY_2JOY1+13, "SEC_JOYR"},
- {KEY_2JOY1+14, "SEC_JOYZL"},
- {KEY_2JOY1+15, "SEC_JOYZR"},
- {KEY_2JOY1+16, "SEC_JOYSELECT"},
- {KEY_2JOY1+17, "SEC_JOYSTART"},
- {KEY_2JOY1+18, "SEC_JOYHOME"},
- {KEY_2JOY1+19, "SEC_JOYMINUS"},
- {KEY_2JOY1+20, "SEC_JOYPLUS"},
- {KEY_2JOY1+21, "SEC_JOY_1"},
- {KEY_2JOY1+22, "SEC_JOY_2"},
- {KEY_2JOY1+23, "SEC_JOY24"},
- {KEY_2JOY1+24, "SEC_JOY25"},
- {KEY_2JOY1+25, "SEC_JOY26"},
- {KEY_2JOY1+26, "SEC_JOY27"},
- {KEY_2JOY1+27, "SEC_JOY28"},
- {KEY_2JOY1+28, "SEC_JOY29"},
- {KEY_2JOY1+29, "SEC_JOY30"},
- {KEY_2JOY1+30, "SEC_JOY31"},
- {KEY_2JOY1+31, "SEC_JOY32"},
-#define NOMOREJOYBTN_2S
-#elif defined (_WII)
- {KEY_2JOY1+0, "SEC_JOYA"},
- {KEY_2JOY1+1, "SEC_JOYB"},
- {KEY_2JOY1+2, "SEC_JOY1"},
- {KEY_2JOY1+3, "SEC_JOY2"},
- {KEY_2JOY1+4, "SEC_JOYMINUS"},
- {KEY_2JOY1+5, "SEC_JOYPLUS"},
- {KEY_2JOY1+6, "SEC_JOYHOME"},
- {KEY_2JOY1+7, "SEC_JOYZ"},
- {KEY_2JOY1+8, "SEC_JOYC"},
- {KEY_2JOY1+9, "SEC_JOYA_CC"},
- {KEY_2JOY1+10, "SEC_JOYB_CC"},
- {KEY_2JOY1+11, "SEC_JOYX"},
- {KEY_2JOY1+12, "SEC_JOYY"},
- {KEY_2JOY1+13, "SEC_JOYL"},
- {KEY_2JOY1+14, "SEC_JOYR"},
- {KEY_2JOY1+15, "SEC_JOYZL"},
- {KEY_2JOY1+16, "SEC_JOYZR"},
- {KEY_2JOY1+17, "SEC_JOYMINUS_CC"},
- {KEY_2JOY1+18, "SEC_JOYHPLUS_CC"},
- {KEY_2JOY1+19, "SEC_JOYMHOME_CC"},
-#define NOMOREJOYBTN_2S
-#else
{KEY_2JOY1+0, "SEC_JOY1"},
{KEY_2JOY1+1, "SEC_JOY2"},
{KEY_2JOY1+2, "SEC_JOY3"},
@@ -751,8 +415,7 @@ static keyname_t keynames[] =
{KEY_2JOY1+5, "SEC_JOY6"},
{KEY_2JOY1+6, "SEC_JOY7"},
{KEY_2JOY1+7, "SEC_JOY8"},
-#endif
-#if !defined (_arch_dreamcast) && !defined (NOMOREJOYBTN_2S)
+#if !defined (NOMOREJOYBTN_2S)
// we use up to 32 buttons in DirectInput
{KEY_2JOY1+8, "SEC_JOY9"},
{KEY_2JOY1+9, "SEC_JOY10"},
@@ -784,12 +447,10 @@ static keyname_t keynames[] =
{KEY_2HAT1+1, "SEC_HATDOWN"},
{KEY_2HAT1+2, "SEC_HATLEFT"},
{KEY_2HAT1+3, "SEC_HATRIGHT"},
-#if !defined (_XBOX) && !defined (_PSP) && !defined (_WII)
{KEY_2HAT1+4, "SEC_HATUP2"},
{KEY_2HAT1+5, "SEC_HATDOWN2"},
{KEY_2HAT1+6, "SEC_HATLEFT2"},
{KEY_2HAT1+7, "SEC_HATRIGHT2"},
-#ifndef _arch_dreamcast
{KEY_2HAT1+8, "SEC_HATUP3"},
{KEY_2HAT1+9, "SEC_HATDOWN3"},
{KEY_2HAT1+10, "SEC_HATLEFT3"},
@@ -798,101 +459,7 @@ static keyname_t keynames[] =
{KEY_2HAT1+13, "SEC_HATDOWN4"},
{KEY_2HAT1+14, "SEC_HATLEFT4"},
{KEY_2HAT1+15, "SEC_HATRIGHT4"},
-#endif
-#endif
-#ifdef DC
- {KEY_DBL2JOY1+0, "DBLSEC_JOYC"},
- {KEY_DBL2JOY1+1, "DBLSEC_JOYB"},
- {KEY_DBL2JOY1+2, "DBLSEC_JOYA"},
- {KEY_DBL2JOY1+3, "DBLSEC_JOYS"},
- {KEY_DBL2JOY1+4, "DBLSEC_JOYZ"},
- {KEY_DBL2JOY1+5, "DBLSEC_JOYY"},
- {KEY_DBL2JOY1+6, "DBLSEC_JOYX"},
- {KEY_DBL2JOY1+7, "DBLSEC_JOYD"},
-#elif defined (_XBOX)
- {KEY_DBL2JOY1+0, "DBLSEC_JOYA"},
- {KEY_DBL2JOY1+1, "DBLSEC_JOYB"},
- {KEY_DBL2JOY1+2, "DBLSEC_JOYX"},
- {KEY_DBL2JOY1+3, "DBLSEC_JOYY"},
- {KEY_DBL2JOY1+4, "DBLSEC_JOYG"},
- {KEY_DBL2JOY1+5, "DBLSEC_JOYW"},
- {KEY_DBL2JOY1+6, "DBLSEC_JOYL"},
- {KEY_DBL2JOY1+7, "DBLSEC_JOYR"},
- {KEY_DBL2JOY1+8, "DBLSEC_JOYS"},
- {KEY_DBL2JOY1+9, "DBLSEC_JOYN"},
- {KEY_DBL2JOY1+10,"DBLSEC_JOYW"},
- {KEY_DBL2JOY1+11,"DBLSEC_JOYE"},
-#define NOMOREJOYBTN_2DBL
-#elif defined (_PSP)
- {KEY_DBL2JOY1+0, "DBLSEC_TRIANGLE"},
- {KEY_DBL2JOY1+1, "DBLSEC_CIRCLE" },
- {KEY_DBL2JOY1+2, "DBLSEC_CROSS" },
- {KEY_DBL2JOY1+3, "DBLSEC_SQUARE" },
- {KEY_DBL2JOY1+4, "DBLSEC_LTRIGGER"},
- {KEY_DBL2JOY1+5, "DBLSEC_RTRIGGER"},
- {KEY_DBL2JOY1+6, "DBLSEC_SELECT" },
- {KEY_DBL2JOY1+7, "DBLSEC_START" },
- {KEY_DBL2JOY1+8, "DBLSEC_HOME" },
- {KEY_DBL2JOY1+9, "DBLSEC_HOLD" },
-#define NOMOREJOYBTN_2DBL
-#elif defined (WMINPUT)
- {KEY_DBL2JOY1+0, "DBLSEC_JOYB"},
- {KEY_DBL2JOY1+1, "DBLSEC_JOYA"},
- {KEY_DBL2JOY1+2, "DBLSEC_JOYUP"},
- {KEY_DBL2JOY1+3, "DBLSEC_JOYDOWN"},
- {KEY_DBL2JOY1+4, "DBLSEC_JOYLEFT"},
- {KEY_DBL2JOY1+5, "DBLSEC_JOYRIGHT"},
- {KEY_DBL2JOY1+6, "DBLSEC_JOYAA"},
- {KEY_DBL2JOY1+7, "DBLSEC_JOYBB"},
- {KEY_DBL2JOY1+8, "DBLSEC_JOYCC"},
- {KEY_DBL2JOY1+9, "DBLSEC_JOYXX"},
- {KEY_DBL2JOY1+10, "DBLSEC_JOYYY"},
- {KEY_DBL2JOY1+11, "DBLSEC_JOYZZ"},
- {KEY_DBL2JOY1+12, "DBLSEC_JOYL"},
- {KEY_DBL2JOY1+13, "DBLSEC_JOYR"},
- {KEY_DBL2JOY1+14, "DBLSEC_JOYZL"},
- {KEY_DBL2JOY1+15, "DBLSEC_JOYZR"},
- {KEY_DBL2JOY1+16, "DBLSEC_JOYSELECT"},
- {KEY_DBL2JOY1+17, "DBLSEC_JOYSTART"},
- {KEY_DBL2JOY1+18, "DBLSEC_JOYHOME"},
- {KEY_DBL2JOY1+19, "DBLSEC_JOYMINUS"},
- {KEY_DBL2JOY1+20, "DBLSEC_JOYPLUS"},
- {KEY_DBL2JOY1+21, "DBLSEC_JOY_1"},
- {KEY_DBL2JOY1+22, "DBLSEC_JOY_2"},
- {KEY_DBL2JOY1+23, "DBLSEC_JOY24"},
- {KEY_DBL2JOY1+24, "DBLSEC_JOY25"},
- {KEY_DBL2JOY1+25, "DBLSEC_JOY26"},
- {KEY_DBL2JOY1+26, "DBLSEC_JOY27"},
- {KEY_DBL2JOY1+27, "DBLSEC_JOY28"},
- {KEY_DBL2JOY1+28, "DBLSEC_JOY29"},
- {KEY_DBL2JOY1+29, "DBLSEC_JOY30"},
- {KEY_DBL2JOY1+30, "DBLSEC_JOY31"},
- {KEY_DBL2JOY1+31, "DBLSEC_JOY32"},
-#define NOMOREJOYBTN_2SDBL
-#elif defined (_WII)
- {KEY_DBL2JOY1+0, "DBLSEC_JOYA"},
- {KEY_DBL2JOY1+1, "DBLSEC_JOYB"},
- {KEY_DBL2JOY1+2, "DBLSEC_JOY1"},
- {KEY_DBL2JOY1+3, "DBLSEC_JOY2"},
- {KEY_DBL2JOY1+4, "DBLSEC_JOYMINUS"},
- {KEY_DBL2JOY1+5, "DBLSEC_JOYPLUS"},
- {KEY_DBL2JOY1+6, "DBLSEC_JOYHOME"},
- {KEY_DBL2JOY1+7, "DBLSEC_JOYZ"},
- {KEY_DBL2JOY1+8, "DBLSEC_JOYC"},
- {KEY_DBL2JOY1+9, "DBLSEC_JOYA_CC"},
- {KEY_DBL2JOY1+10, "DBLSEC_JOYB_CC"},
- {KEY_DBL2JOY1+11, "DBLSEC_JOYX"},
- {KEY_DBL2JOY1+12, "DBLSEC_JOYY"},
- {KEY_DBL2JOY1+13, "DBLSEC_JOYL"},
- {KEY_DBL2JOY1+14, "DBLSEC_JOYR"},
- {KEY_DBL2JOY1+15, "DBLSEC_JOYZL"},
- {KEY_DBL2JOY1+16, "DBLSEC_JOYZR"},
- {KEY_DBL2JOY1+17, "DBLSEC_JOYMINUS_CC"},
- {KEY_DBL2JOY1+18, "DBLSEC_JOYHPLUS_CC"},
- {KEY_DBL2JOY1+19, "DBLSEC_JOYMHOME_CC"},
-#define NOMOREJOYBTN_2DBL
-#else
{KEY_DBL2JOY1+0, "DBLSEC_JOY1"},
{KEY_DBL2JOY1+1, "DBLSEC_JOY2"},
{KEY_DBL2JOY1+2, "DBLSEC_JOY3"},
@@ -901,8 +468,7 @@ static keyname_t keynames[] =
{KEY_DBL2JOY1+5, "DBLSEC_JOY6"},
{KEY_DBL2JOY1+6, "DBLSEC_JOY7"},
{KEY_DBL2JOY1+7, "DBLSEC_JOY8"},
-#endif
-#if !defined (_arch_dreamcast) && !defined (NOMOREJOYBTN_2DBL)
+#if !defined (NOMOREJOYBTN_2DBL)
{KEY_DBL2JOY1+8, "DBLSEC_JOY9"},
{KEY_DBL2JOY1+9, "DBLSEC_JOY10"},
{KEY_DBL2JOY1+10, "DBLSEC_JOY11"},
@@ -932,12 +498,10 @@ static keyname_t keynames[] =
{KEY_DBL2HAT1+1, "DBLSEC_HATDOWN"},
{KEY_DBL2HAT1+2, "DBLSEC_HATLEFT"},
{KEY_DBL2HAT1+3, "DBLSEC_HATRIGHT"},
-#if !defined (_XBOX) && !defined (_PSP) && !defined (_WII)
{KEY_DBL2HAT1+4, "DBLSEC_HATUP2"},
{KEY_DBL2HAT1+5, "DBLSEC_HATDOWN2"},
{KEY_DBL2HAT1+6, "DBLSEC_HATLEFT2"},
{KEY_DBL2HAT1+7, "DBLSEC_HATRIGHT2"},
-#ifndef _arch_dreamcast
{KEY_DBL2HAT1+8, "DBLSEC_HATUP3"},
{KEY_DBL2HAT1+9, "DBLSEC_HATDOWN3"},
{KEY_DBL2HAT1+10, "DBLSEC_HATLEFT3"},
@@ -946,8 +510,6 @@ static keyname_t keynames[] =
{KEY_DBL2HAT1+13, "DBLSEC_HATDOWN4"},
{KEY_DBL2HAT1+14, "DBLSEC_HATLEFT4"},
{KEY_DBL2HAT1+15, "DBLSEC_HATRIGHT4"},
-#endif
-#endif
};
@@ -1049,105 +611,6 @@ INT32 G_KeyStringtoNum(const char *keystr)
return 0;
}
-#ifdef DC
-void G_Controldefault(void)
-{
- gamecontrol[gc_forward ][0] = KEY_HAT1+0; //Up
- gamecontrol[gc_forward ][1] = KEY_UPARROW;
- gamecontrol[gc_backward ][0] = KEY_HAT1+1; //Down
- gamecontrol[gc_backward ][1] = KEY_DOWNARROW;
- //gamecontrol[gc_straferight][0] = '[';
- //gamecontrol[gc_strafeleft ][0] = ']';
- gamecontrol[gc_turnleft ][0] = KEY_HAT1+2; //Left
- gamecontrol[gc_turnleft ][1] = KEY_LEFTARROW;
- gamecontrol[gc_turnright ][0] = KEY_HAT1+3; //Right
- gamecontrol[gc_turnright ][1] = KEY_RIGHTARROW;
- gamecontrol[gc_weaponnext ][0] = ']';
- gamecontrol[gc_weaponprev ][0] = '[';
- gamecontrol[gc_fire ][0] = KEY_JOY1+6; //X
- gamecontrol[gc_fire ][1] = KEY_RCTRL;
- gamecontrol[gc_firenormal ][0] = KEY_JOY1+5; //Y
- gamecontrol[gc_firenormal ][1] = ';';
- gamecontrol[gc_tossflag ][0] = '\'';
- gamecontrol[gc_use ][0] = KEY_JOY1+1; //B
- gamecontrol[gc_use ][1] = '.';
- gamecontrol[gc_camtoggle ][1] = ',';
- gamecontrol[gc_camreset ][0] = 'c';
- gamecontrol[gc_lookup ][0] = KEY_PGUP;
- gamecontrol[gc_lookdown ][0] = KEY_PGDN;
- gamecontrol[gc_centerview ][0] = KEY_END;
- gamecontrol[gc_mouseaiming][0] = 's';
- gamecontrol[gc_talkkey ][0] = 't';
- gamecontrol[gc_teamkey ][0] = 'y';
- gamecontrol[gc_scores ][0] = KEY_TAB;
- gamecontrol[gc_jump ][0] = KEY_JOY1+2; //A
- gamecontrol[gc_jump ][1] = '/';
- gamecontrol[gc_console ][0] = KEY_CONSOLE;
- gamecontrol[gc_console ][1] = KEY_F5;
- //gamecontrolbis
- gamecontrolbis[gc_forward ][0] = KEY_2HAT1+0;
- gamecontrolbis[gc_forward ][1] = 'w';
- gamecontrolbis[gc_backward ][0] = KEY_2HAT1+1;
- gamecontrolbis[gc_backward ][1] = 's';
- gamecontrolbis[gc_turnleft ][0] = KEY_2HAT1+2;
- gamecontrolbis[gc_turnleft ][1] = 'a';
- gamecontrolbis[gc_turnright ][0] = KEY_2HAT1+3;
- gamecontrolbis[gc_turnright ][1] = 'd';
- gamecontrolbis[gc_weaponnext][0] = 't';
- gamecontrolbis[gc_weaponprev][0] = 'r';
- gamecontrolbis[gc_fire ][0] = KEY_2JOY1+6; //X
- gamecontrolbis[gc_firenormal][0] = KEY_2JOY1+5; //Y
- gamecontrolbis[gc_use ][0] = KEY_2JOY1+1; //B
- gamecontrolbis[gc_jump ][0] = KEY_2JOY1+2; //A
- //gamecontrolbis[gc_straferight][0] = 'x';
- //gamecontrolbis[gc_strafeleft ][0] = 'z';
-}
-#elif defined (_PSP)
-void G_Controldefault(void)
-{
- gamecontrol[gc_forward ][0] = KEY_HAT1+0; // Up
- gamecontrol[gc_backward ][0] = KEY_HAT1+1; // Down
- gamecontrol[gc_turnleft ][0] = KEY_HAT1+2; // Left
- gamecontrol[gc_turnright ][0] = KEY_HAT1+3; // Right
- gamecontrol[gc_strafeleft ][0] = KEY_JOY1+4; // L
- gamecontrol[gc_straferight][0] = KEY_JOY1+5; // R
- gamecontrol[gc_tossflag ][0] = KEY_JOY1+0; // Triangle
- gamecontrol[gc_use ][0] = KEY_JOY1+1; // Circle
- gamecontrol[gc_camtoggle ][0] = KEY_JOY1+6; // Select
- gamecontrol[gc_camreset ][0] = KEY_JOY1+3; // Square
- gamecontrol[gc_centerview ][0] = KEY_JOY1+9; // Hold
- gamecontrol[gc_pause ][0] = KEY_JOY1+8; // Start
- gamecontrol[gc_jump ][0] = KEY_JOY1+2; // Cross
-}
-#elif defined (GP2X)
-void G_Controldefault(void)
-{
- gamecontrol[gc_fire ][0] = KEY_JOY1+0; //A
- gamecontrol[gc_forward ][0] = KEY_JOY1+1; //Y
- gamecontrol[gc_jump ][0] = KEY_JOY1+2; //B
- gamecontrol[gc_use ][0] = KEY_JOY1+3; //X
- gamecontrol[gc_strafeleft ][0] = KEY_JOY1+4; //L
- gamecontrol[gc_straferight][0] = KEY_JOY1+5; //R
- gamecontrol[gc_lookup ][0] = KEY_JOY1+6; //U
- gamecontrol[gc_lookdown ][0] = KEY_JOY1+7; //D
- gamecontrol[gc_pause ][0] = KEY_JOY1+8; //S
-}
-#elif defined (_NDS)
-void G_Controldefault(void)
-{
- gamecontrol[gc_fire ][0] = KEY_JOY1+2; //X
- gamecontrol[gc_forward ][0] = KEY_UPARROW;
- gamecontrol[gc_backward ][0] = KEY_DOWNARROW;
- gamecontrol[gc_jump ][0] = KEY_JOY1+0; //A
- gamecontrol[gc_use ][0] = KEY_JOY1+3; //Y
- gamecontrol[gc_strafeleft ][0] = KEY_JOY1+4; //L
- gamecontrol[gc_straferight][0] = KEY_JOY1+5; //R
- gamecontrol[gc_turnleft ][0] = KEY_LEFTARROW;
- gamecontrol[gc_turnright ][0] = KEY_RIGHTARROW;
- gamecontrol[gc_pause ][0] = KEY_JOY1+6; //Start
- gamecontrol[gc_weaponnext ][0] = KEY_JOY1+7; //Select
-}
-#else
void G_Controldefault(void)
{
gamecontrol[gc_forward ][0] = 'w';
@@ -1184,80 +647,7 @@ void G_Controldefault(void)
gamecontrol[gc_jump ][0] = KEY_SPACE;
gamecontrol[gc_console ][0] = KEY_CONSOLE;
gamecontrol[gc_pause ][0] = KEY_PAUSE;
-#ifdef WMINPUT
- gamecontrol[gc_forward ][0] = KEY_JOY1+02; //UP
- gamecontrol[gc_backward ][0] = KEY_JOY1+03; //DOWN
- gamecontrol[gc_turnleft ][0] = KEY_JOY1+04; //LEFT
- gamecontrol[gc_turnright ][0] = KEY_JOY1+05; //RIGHT
- gamecontrol[gc_weaponnext ][0] = KEY_JOY1+10; //y
- gamecontrol[gc_weaponprev ][0] = KEY_JOY1+9; //x
- gamecontrol[gc_fire ][0] = KEY_JOY1+12; //L
- gamecontrol[gc_firenormal ][0] = KEY_JOY1+13; //R
- gamecontrol[gc_use ][0] = KEY_JOY1+00; //B
- gamecontrol[gc_use ][1] = KEY_JOY1+07; //b
- gamecontrol[gc_jump ][0] = KEY_JOY1+01; //A
- gamecontrol[gc_jump ][1] = KEY_JOY1+06; //a
- gamecontrol[gc_pause ][0] = KEY_JOY1+18; //Home
- gamecontrolbis[gc_forward ][0] = KEY_2JOY1+02; //UP
- gamecontrolbis[gc_backward ][0] = KEY_2JOY1+03; //DOWN
- gamecontrolbis[gc_turnleft ][0] = KEY_2JOY1+04; //LEFT
- gamecontrolbis[gc_turnright ][0] = KEY_2JOY1+05; //RIGHT
- gamecontrolbis[gc_weaponnext ][0] = KEY_2JOY1+10; //y
- gamecontrolbis[gc_weaponprev ][0] = KEY_2JOY1+9; //x
- gamecontrolbis[gc_fire ][0] = KEY_2JOY1+12; //L
- gamecontrolbis[gc_firenormal ][0] = KEY_2JOY1+13; //R
- gamecontrolbis[gc_use ][0] = KEY_2JOY1+00; //B
- gamecontrolbis[gc_use ][1] = KEY_2JOY1+07; //b
- gamecontrolbis[gc_jump ][0] = KEY_2JOY1+01; //A
- gamecontrolbis[gc_jump ][1] = KEY_2JOY1+06; //a
- gamecontrolbis[gc_pause ][0] = KEY_2JOY1+18; //Home
-#endif
-#ifdef _WII
- gamecontrol[gc_forward ][1] = KEY_HAT1+00; //UP
- gamecontrol[gc_backward ][1] = KEY_HAT1+01; //DOWN
- gamecontrol[gc_straferight][1] = KEY_JOY1+16; //ZR
- gamecontrol[gc_strafeleft ][1] = KEY_JOY1+15; //ZL
- gamecontrol[gc_turnleft ][1] = KEY_HAT1+02; //LEFT
- gamecontrol[gc_turnright ][1] = KEY_HAT1+03; //RIGHT
- gamecontrol[gc_weaponnext ][1] = KEY_JOY1+11; //x
- gamecontrol[gc_fire ][0] = KEY_JOY1+12; //y
- gamecontrol[gc_fire ][1] = KEY_JOY1+01; //B
- gamecontrol[gc_firenormal ][0] = KEY_JOY1+13; //L
- gamecontrol[gc_firenormal ][1] = KEY_JOY1+00; //A
- gamecontrol[gc_tossflag ][1] = KEY_JOY1+17; //Plus CC
- gamecontrol[gc_use ][0] = KEY_JOY1+9; //a
- gamecontrol[gc_use ][1] = KEY_JOY1+02; //1
- gamecontrol[gc_centerview ][1] = KEY_JOY1+14; //R
- gamecontrol[gc_scores ][0] = KEY_JOY1+04; //Minus
- gamecontrol[gc_scores ][1] = KEY_JOY1+18; //Minus
- gamecontrol[gc_jump ][0] = KEY_JOY1+10; //b
- gamecontrol[gc_jump ][1] = KEY_JOY1+3; //2
- gamecontrol[gc_pause ][0] = KEY_JOY1+06; //Home
- gamecontrol[gc_pause ][1] = KEY_JOY1+19; //Home
- gamecontrolbis[gc_forward ][1] = KEY_2HAT1+00; //UP
- gamecontrolbis[gc_backward ][1] = KEY_2HAT1+01; //DOWN
- gamecontrolbis[gc_straferight][1] = KEY_2JOY1+16; //ZR
- gamecontrolbis[gc_strafeleft ][1] = KEY_2JOY1+15; //ZL
- gamecontrolbis[gc_turnleft ][1] = KEY_2HAT1+02; //LEFT
- gamecontrolbis[gc_turnright ][1] = KEY_2HAT1+03; //RIGHT
- gamecontrolbis[gc_weaponnext ][1] = KEY_2JOY1+11; //x
- gamecontrolbis[gc_fire ][0] = KEY_2JOY1+12; //y
- gamecontrolbis[gc_fire ][1] = KEY_2JOY1+01; //B
- gamecontrolbis[gc_firenormal ][0] = KEY_2JOY1+13; //L
- gamecontrolbis[gc_firenormal ][1] = KEY_2JOY1+00; //A
- gamecontrolbis[gc_tossflag ][1] = KEY_2JOY1+17; //Plus CC
- gamecontrolbis[gc_use ][0] = KEY_2JOY1+9; //a
- gamecontrolbis[gc_use ][1] = KEY_2JOY1+02; //1
- gamecontrolbis[gc_centerview ][1] = KEY_2JOY1+14; //R
- gamecontrolbis[gc_scores ][0] = KEY_2JOY1+04; //Minus
- gamecontrolbis[gc_scores ][1] = KEY_2JOY1+18; //Minus
- gamecontrolbis[gc_jump ][0] = KEY_2JOY1+10; //b
- gamecontrolbis[gc_jump ][1] = KEY_2JOY1+3; //2
- gamecontrolbis[gc_pause ][0] = KEY_2JOY1+06; //Home
- gamecontrolbis[gc_pause ][1] = KEY_2JOY1+19; //Home
-#endif
}
-#endif
void G_SaveKeySetting(FILE *f)
{
diff --git a/src/g_input.h b/src/g_input.h
index 808397438..2a447c683 100644
--- a/src/g_input.h
+++ b/src/g_input.h
@@ -22,33 +22,10 @@
// keys (mousebuttons and joybuttons becomes keys)
#define NUMKEYS 256
-
-#ifdef _arch_dreamcast
-#define MOUSEBUTTONS 5
-#define JOYBUTTONS 8 // 8 buttons
-#define JOYHATS 2 // 2 hats
-#define JOYAXISSET 3 // 3 Sets of 2 axises
-#elif defined (_XBOX)
-#define MOUSEBUTTONS 5
-#define JOYBUTTONS 12 // 12 buttons
-#define JOYHATS 1 // 1 hat
-#define JOYAXISSET 2 // 2 Sets of 2 axises
-#elif defined (_PSP)
-#define MOUSEBUTTONS 3
-#define JOYBUTTONS 14 // 10 buttons
-#define JOYHATS 1 // 1 hat
-#define JOYAXISSET 1 // 1 Set of 2 axises
-#elif defined (_WII)
-#define MOUSEBUTTONS 3
-#define JOYBUTTONS 20 // 20 buttons
-#define JOYHATS 1 // 1 hat
-#define JOYAXISSET 5 // 5 Sets of 2 axises
-#else
#define MOUSEBUTTONS 8
#define JOYBUTTONS 32 // 32 buttons
#define JOYHATS 4 // 4 hats
#define JOYAXISSET 4 // 4 Sets of 2 axises
-#endif
//
// mouse and joystick buttons are handled as 'virtual' keys
diff --git a/src/hardware/hw_bsp.c b/src/hardware/hw_bsp.c
index a32609fc8..fa5bce308 100644
--- a/src/hardware/hw_bsp.c
+++ b/src/hardware/hw_bsp.c
@@ -878,8 +878,8 @@ static void AdjustSegs(void)
count = subsectors[i].numlines;
lseg = &segs[subsectors[i].firstline];
p = extrasubsectors[i].planepoly;
- if (!p)
- continue;
+ //if (!p)
+ //continue;
for (; count--; lseg++)
{
float distv1,distv2,tmp;
@@ -892,29 +892,31 @@ static void AdjustSegs(void)
continue;
#endif
- for (j = 0; j < p->numpts; j++)
- {
- distv1 = p->pts[j].x - FIXED_TO_FLOAT(lseg->v1->x);
- tmp = p->pts[j].y - FIXED_TO_FLOAT(lseg->v1->y);
- distv1 = distv1*distv1+tmp*tmp;
- if (distv1 <= nearv1)
+ if (p) {
+ for (j = 0; j < p->numpts; j++)
{
- v1found = j;
- nearv1 = distv1;
- }
- // the same with v2
- distv2 = p->pts[j].x - FIXED_TO_FLOAT(lseg->v2->x);
- tmp = p->pts[j].y - FIXED_TO_FLOAT(lseg->v2->y);
- distv2 = distv2*distv2+tmp*tmp;
- if (distv2 <= nearv2)
- {
- v2found = j;
- nearv2 = distv2;
+ distv1 = p->pts[j].x - FIXED_TO_FLOAT(lseg->v1->x);
+ tmp = p->pts[j].y - FIXED_TO_FLOAT(lseg->v1->y);
+ distv1 = distv1*distv1+tmp*tmp;
+ if (distv1 <= nearv1)
+ {
+ v1found = j;
+ nearv1 = distv1;
+ }
+ // the same with v2
+ distv2 = p->pts[j].x - FIXED_TO_FLOAT(lseg->v2->x);
+ tmp = p->pts[j].y - FIXED_TO_FLOAT(lseg->v2->y);
+ distv2 = distv2*distv2+tmp*tmp;
+ if (distv2 <= nearv2)
+ {
+ v2found = j;
+ nearv2 = distv2;
+ }
}
}
- if (nearv1 <= NEARDIST*NEARDIST)
+ if (p && nearv1 <= NEARDIST*NEARDIST)
// share vertice with segs
- lseg->v1 = (vertex_t *)&(p->pts[v1found]);
+ lseg->pv1 = &(p->pts[v1found]);
else
{
// BP: here we can do better, using PointInSeg and compute
@@ -925,24 +927,24 @@ static void AdjustSegs(void)
polyvertex_t *pv = HWR_AllocVertex();
pv->x = FIXED_TO_FLOAT(lseg->v1->x);
pv->y = FIXED_TO_FLOAT(lseg->v1->y);
- lseg->v1 = (vertex_t *)pv;
+ lseg->pv1 = pv;
}
- if (nearv2 <= NEARDIST*NEARDIST)
- lseg->v2 = (vertex_t *)&(p->pts[v2found]);
+ if (p && nearv2 <= NEARDIST*NEARDIST)
+ lseg->pv2 = &(p->pts[v2found]);
else
{
polyvertex_t *pv = HWR_AllocVertex();
pv->x = FIXED_TO_FLOAT(lseg->v2->x);
pv->y = FIXED_TO_FLOAT(lseg->v2->y);
- lseg->v2 = (vertex_t *)pv;
+ lseg->pv2 = pv;
}
// recompute length
{
float x,y;
- x = ((polyvertex_t *)lseg->v2)->x - ((polyvertex_t *)lseg->v1)->x
+ x = ((polyvertex_t *)lseg->pv2)->x - ((polyvertex_t *)lseg->pv1)->x
+ FIXED_TO_FLOAT(FRACUNIT/2);
- y = ((polyvertex_t *)lseg->v2)->y - ((polyvertex_t *)lseg->v1)->y
+ y = ((polyvertex_t *)lseg->pv2)->y - ((polyvertex_t *)lseg->pv1)->y
+ FIXED_TO_FLOAT(FRACUNIT/2);
lseg->flength = (float)hypot(x, y);
// BP: debug see this kind of segs
diff --git a/src/hardware/hw_clip.c b/src/hardware/hw_clip.c
new file mode 100644
index 000000000..fd6ba13f3
--- /dev/null
+++ b/src/hardware/hw_clip.c
@@ -0,0 +1,465 @@
+/* Emacs style mode select -*- C++ -*-
+ *-----------------------------------------------------------------------------
+ *
+ *
+ * PrBoom: a Doom port merged with LxDoom and LSDLDoom
+ * based on BOOM, a modified and improved DOOM engine
+ * Copyright (C) 1999 by
+ * id Software, Chi Hoang, Lee Killough, Jim Flynn, Rand Phares, Ty Halderman
+ * Copyright (C) 1999-2000 by
+ * Jess Haas, Nicolas Kalkhof, Colin Phipps, Florian Schulze
+ * Copyright 2005, 2006 by
+ * Florian Schulze, Colin Phipps, Neil Stevens, Andrey Budko
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
+ * 02111-1307, USA.
+ *
+ * DESCRIPTION:
+ *
+ *---------------------------------------------------------------------
+ */
+
+/*
+ *
+ ** gl_clipper.cpp
+ **
+ ** Handles visibility checks.
+ ** Loosely based on the JDoom clipper.
+ **
+ **---------------------------------------------------------------------------
+ ** Copyright 2003 Tim Stump
+ ** All rights reserved.
+ **
+ ** Redistribution and use in source and binary forms, with or without
+ ** modification, are permitted provided that the following conditions
+ ** are met:
+ **
+ ** 1. Redistributions of source code must retain the above copyright
+ ** notice, this list of conditions and the following disclaimer.
+ ** 2. Redistributions in binary form must reproduce the above copyright
+ ** notice, this list of conditions and the following disclaimer in the
+ ** documentation and/or other materials provided with the distribution.
+ ** 3. The name of the author may not be used to endorse or promote products
+ ** derived from this software without specific prior written permission.
+ **
+ ** THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
+ ** IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+ ** OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
+ ** IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
+ ** INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
+ ** NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ ** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ ** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ ** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+ ** THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ **---------------------------------------------------------------------------
+ **
+ */
+
+#include
+#include "../v_video.h"
+#include "hw_clip.h"
+#include "hw_glob.h"
+#include "../r_state.h"
+#include "../tables.h"
+#include "r_opengl/r_opengl.h"
+
+#ifdef HAVE_SPHEREFRUSTRUM
+static GLdouble viewMatrix[16];
+static GLdouble projMatrix[16];
+float frustum[6][4];
+#endif
+
+typedef struct clipnode_s
+ {
+ struct clipnode_s *prev, *next;
+ angle_t start, end;
+ } clipnode_t;
+
+clipnode_t *freelist;
+clipnode_t *clipnodes;
+clipnode_t *cliphead;
+
+static clipnode_t * gld_clipnode_GetNew(void);
+static clipnode_t * gld_clipnode_NewRange(angle_t start, angle_t end);
+static boolean gld_clipper_IsRangeVisible(angle_t startAngle, angle_t endAngle);
+static void gld_clipper_AddClipRange(angle_t start, angle_t end);
+static void gld_clipper_RemoveRange(clipnode_t * range);
+static void gld_clipnode_Free(clipnode_t *node);
+
+static clipnode_t * gld_clipnode_GetNew(void)
+{
+ if (freelist)
+ {
+ clipnode_t * p = freelist;
+ freelist = p->next;
+ return p;
+ }
+ else
+ {
+ return (clipnode_t*)malloc(sizeof(clipnode_t));
+ }
+}
+
+static clipnode_t * gld_clipnode_NewRange(angle_t start, angle_t end)
+{
+ clipnode_t * c = gld_clipnode_GetNew();
+ c->start = start;
+ c->end = end;
+ c->next = c->prev=NULL;
+ return c;
+}
+
+boolean gld_clipper_SafeCheckRange(angle_t startAngle, angle_t endAngle)
+{
+ if(startAngle > endAngle)
+ {
+ return (gld_clipper_IsRangeVisible(startAngle, ANGLE_MAX) || gld_clipper_IsRangeVisible(0, endAngle));
+ }
+
+ return gld_clipper_IsRangeVisible(startAngle, endAngle);
+}
+
+static boolean gld_clipper_IsRangeVisible(angle_t startAngle, angle_t endAngle)
+{
+ clipnode_t *ci;
+ ci = cliphead;
+
+ if (endAngle == 0 && ci && ci->start == 0)
+ return false;
+
+ while (ci != NULL && ci->start < endAngle)
+ {
+ if (startAngle >= ci->start && endAngle <= ci->end)
+ {
+ return false;
+ }
+ ci = ci->next;
+ }
+
+ return true;
+}
+
+static void gld_clipnode_Free(clipnode_t *node)
+{
+ node->next = freelist;
+ freelist = node;
+}
+
+static void gld_clipper_RemoveRange(clipnode_t *range)
+{
+ if (range == cliphead)
+ {
+ cliphead = cliphead->next;
+ }
+ else
+ {
+ if (range->prev)
+ {
+ range->prev->next = range->next;
+ }
+ if (range->next)
+ {
+ range->next->prev = range->prev;
+ }
+ }
+
+ gld_clipnode_Free(range);
+}
+
+void gld_clipper_SafeAddClipRange(angle_t startangle, angle_t endangle)
+{
+ if(startangle > endangle)
+ {
+ // The range has to added in two parts.
+ gld_clipper_AddClipRange(startangle, ANGLE_MAX);
+ gld_clipper_AddClipRange(0, endangle);
+ }
+ else
+ {
+ // Add the range as usual.
+ gld_clipper_AddClipRange(startangle, endangle);
+ }
+}
+
+static void gld_clipper_AddClipRange(angle_t start, angle_t end)
+{
+ clipnode_t *node, *temp, *prevNode, *node2, *delnode;
+
+ if (cliphead)
+ {
+ //check to see if range contains any old ranges
+ node = cliphead;
+ while (node != NULL && node->start < end)
+ {
+ if (node->start >= start && node->end <= end)
+ {
+ temp = node;
+ node = node->next;
+ gld_clipper_RemoveRange(temp);
+ }
+ else
+ {
+ if (node->start <= start && node->end >= end)
+ {
+ return;
+ }
+ else
+ {
+ node = node->next;
+ }
+ }
+ }
+
+ //check to see if range overlaps a range (or possibly 2)
+ node = cliphead;
+ while (node != NULL && node->start <= end)
+ {
+ if (node->end >= start)
+ {
+ // we found the first overlapping node
+ if (node->start > start)
+ {
+ // the new range overlaps with this node's start point
+ node->start = start;
+ }
+ if (node->end < end)
+ {
+ node->end = end;
+ }
+
+ node2 = node->next;
+ while (node2 && node2->start <= node->end)
+ {
+ if (node2->end > node->end)
+ {
+ node->end = node2->end;
+ }
+
+ delnode = node2;
+ node2 = node2->next;
+ gld_clipper_RemoveRange(delnode);
+ }
+ return;
+ }
+ node = node->next;
+ }
+
+ //just add range
+ node = cliphead;
+ prevNode = NULL;
+ temp = gld_clipnode_NewRange(start, end);
+ while (node != NULL && node->start < end)
+ {
+ prevNode = node;
+ node = node->next;
+ }
+ temp->next = node;
+ if (node == NULL)
+ {
+ temp->prev = prevNode;
+ if (prevNode)
+ {
+ prevNode->next = temp;
+ }
+ if (!cliphead)
+ {
+ cliphead = temp;
+ }
+ }
+ else
+ {
+ if (node == cliphead)
+ {
+ cliphead->prev = temp;
+ cliphead = temp;
+ }
+ else
+ {
+ temp->prev = prevNode;
+ prevNode->next = temp;
+ node->prev = temp;
+ }
+ }
+ }
+ else
+ {
+ temp = gld_clipnode_NewRange(start, end);
+ cliphead = temp;
+ return;
+ }
+}
+
+void gld_clipper_Clear(void)
+{
+ clipnode_t *node = cliphead;
+ clipnode_t *temp;
+
+ while (node != NULL)
+ {
+ temp = node;
+ node = node->next;
+ gld_clipnode_Free(temp);
+ }
+
+ cliphead = NULL;
+}
+
+#define RMUL (1.6f/1.333333f)
+
+angle_t gld_FrustumAngle(void)
+{
+ double floatangle;
+ angle_t a1;
+
+ float tilt = (float)fabs(((double)(int)aimingangle) / ANG1);
+
+ // NEWCLIP TODO: SRB2CBTODO: make a global render_fov for this function
+
+ float render_fov = FIXED_TO_FLOAT(cv_grfov.value);
+ float render_fovratio = (float)BASEVIDWIDTH / (float)BASEVIDHEIGHT; // SRB2CBTODO: NEWCLIPTODO: Is this right?
+ float render_multiplier = 64.0f / render_fovratio / RMUL;
+
+ if (tilt > 90.0f)
+ {
+ tilt = 90.0f;
+ }
+
+ // If the pitch is larger than this you can look all around at a FOV of 90
+ if (aimingangle > (ANGLE_45+ANG1) && (ANGLE_315-ANG1) > aimingangle)
+ return 0xffffffff;
+
+ // ok, this is a gross hack that barely works...
+ // but at least it doesn't overestimate too much...
+ floatangle = 2.0f + (45.0f + (tilt / 1.9f)) * (float)render_fov * 48.0f / render_multiplier / 90.0f;
+ a1 = ANG1 * (int)floatangle;
+ if (a1 >= ANGLE_180)
+ return 0xffffffff;
+ return a1;
+}
+
+// SRB2CB I don't think used any of this stuff, let's disable for now since SRB2 probably doesn't want it either
+// compiler complains about (p)glGetDoublev anyway, in case anyone wants this
+// only r_opengl.c can use the base gl funcs as it turns out, that's a problem for whoever wants sphere frustum checks
+// btw to renable define HAVE_SPHEREFRUSTRUM in hw_clip.h
+#ifdef HAVE_SPHEREFRUSTRUM
+//
+// gld_FrustrumSetup
+//
+
+#define CALCMATRIX(a, b, c, d, e, f, g, h)\
+(float)(viewMatrix[a] * projMatrix[b] + \
+viewMatrix[c] * projMatrix[d] + \
+viewMatrix[e] * projMatrix[f] + \
+viewMatrix[g] * projMatrix[h])
+
+#define NORMALIZE_PLANE(i)\
+t = (float)sqrt(\
+frustum[i][0] * frustum[i][0] + \
+frustum[i][1] * frustum[i][1] + \
+frustum[i][2] * frustum[i][2]); \
+frustum[i][0] /= t; \
+frustum[i][1] /= t; \
+frustum[i][2] /= t; \
+frustum[i][3] /= t
+
+void gld_FrustrumSetup(void)
+{
+ float t;
+ float clip[16];
+
+ pglGetDoublev(GL_PROJECTION_MATRIX, projMatrix);
+ pglGetDoublev(GL_MODELVIEW_MATRIX, viewMatrix);
+
+ clip[0] = CALCMATRIX(0, 0, 1, 4, 2, 8, 3, 12);
+ clip[1] = CALCMATRIX(0, 1, 1, 5, 2, 9, 3, 13);
+ clip[2] = CALCMATRIX(0, 2, 1, 6, 2, 10, 3, 14);
+ clip[3] = CALCMATRIX(0, 3, 1, 7, 2, 11, 3, 15);
+
+ clip[4] = CALCMATRIX(4, 0, 5, 4, 6, 8, 7, 12);
+ clip[5] = CALCMATRIX(4, 1, 5, 5, 6, 9, 7, 13);
+ clip[6] = CALCMATRIX(4, 2, 5, 6, 6, 10, 7, 14);
+ clip[7] = CALCMATRIX(4, 3, 5, 7, 6, 11, 7, 15);
+
+ clip[8] = CALCMATRIX(8, 0, 9, 4, 10, 8, 11, 12);
+ clip[9] = CALCMATRIX(8, 1, 9, 5, 10, 9, 11, 13);
+ clip[10] = CALCMATRIX(8, 2, 9, 6, 10, 10, 11, 14);
+ clip[11] = CALCMATRIX(8, 3, 9, 7, 10, 11, 11, 15);
+
+ clip[12] = CALCMATRIX(12, 0, 13, 4, 14, 8, 15, 12);
+ clip[13] = CALCMATRIX(12, 1, 13, 5, 14, 9, 15, 13);
+ clip[14] = CALCMATRIX(12, 2, 13, 6, 14, 10, 15, 14);
+ clip[15] = CALCMATRIX(12, 3, 13, 7, 14, 11, 15, 15);
+
+ // Right plane
+ frustum[0][0] = clip[ 3] - clip[ 0];
+ frustum[0][1] = clip[ 7] - clip[ 4];
+ frustum[0][2] = clip[11] - clip[ 8];
+ frustum[0][3] = clip[15] - clip[12];
+ NORMALIZE_PLANE(0);
+
+ // Left plane
+ frustum[1][0] = clip[ 3] + clip[ 0];
+ frustum[1][1] = clip[ 7] + clip[ 4];
+ frustum[1][2] = clip[11] + clip[ 8];
+ frustum[1][3] = clip[15] + clip[12];
+ NORMALIZE_PLANE(1);
+
+ // Bottom plane
+ frustum[2][0] = clip[ 3] + clip[ 1];
+ frustum[2][1] = clip[ 7] + clip[ 5];
+ frustum[2][2] = clip[11] + clip[ 9];
+ frustum[2][3] = clip[15] + clip[13];
+ NORMALIZE_PLANE(2);
+
+ // Top plane
+ frustum[3][0] = clip[ 3] - clip[ 1];
+ frustum[3][1] = clip[ 7] - clip[ 5];
+ frustum[3][2] = clip[11] - clip[ 9];
+ frustum[3][3] = clip[15] - clip[13];
+ NORMALIZE_PLANE(3);
+
+ // Far plane
+ frustum[4][0] = clip[ 3] - clip[ 2];
+ frustum[4][1] = clip[ 7] - clip[ 6];
+ frustum[4][2] = clip[11] - clip[10];
+ frustum[4][3] = clip[15] - clip[14];
+ NORMALIZE_PLANE(4);
+
+ // Near plane
+ frustum[5][0] = clip[ 3] + clip[ 2];
+ frustum[5][1] = clip[ 7] + clip[ 6];
+ frustum[5][2] = clip[11] + clip[10];
+ frustum[5][3] = clip[15] + clip[14];
+ NORMALIZE_PLANE(5);
+}
+
+boolean gld_SphereInFrustum(float x, float y, float z, float radius)
+{
+ int p;
+
+ for (p = 0; p < 4; p++)
+ {
+ if (frustum[p][0] * x +
+ frustum[p][1] * y +
+ frustum[p][2] * z +
+ frustum[p][3] <= -radius)
+ {
+ return false;
+ }
+ }
+ return true;
+}
+#endif
diff --git a/src/hardware/hw_clip.h b/src/hardware/hw_clip.h
new file mode 100644
index 000000000..3ba26e5e5
--- /dev/null
+++ b/src/hardware/hw_clip.h
@@ -0,0 +1,24 @@
+/*
+ * hw_clip.h
+ * SRB2CB
+ *
+ * PrBoom's OpenGL clipping
+ *
+ *
+ */
+
+// OpenGL BSP clipping
+#include "../doomdef.h"
+#include "../tables.h"
+#include "../doomtype.h"
+
+//#define HAVE_SPHEREFRUSTRUM // enable if you want gld_SphereInFrustum and related code
+
+boolean gld_clipper_SafeCheckRange(angle_t startAngle, angle_t endAngle);
+void gld_clipper_SafeAddClipRange(angle_t startangle, angle_t endangle);
+void gld_clipper_Clear(void);
+angle_t gld_FrustumAngle(void);
+#ifdef HAVE_SPHEREFRUSTRUM
+void gld_FrustrumSetup(void);
+boolean gld_SphereInFrustum(float x, float y, float z, float radius);
+#endif
diff --git a/src/hardware/hw_data.h b/src/hardware/hw_data.h
index a6525a2f5..f6bbf9455 100644
--- a/src/hardware/hw_data.h
+++ b/src/hardware/hw_data.h
@@ -20,7 +20,7 @@
#ifndef _HWR_DATA_
#define _HWR_DATA_
-#if defined (_WIN32) && !defined (__CYGWIN__) && !defined (_XBOX)
+#if defined (_WIN32) && !defined (__CYGWIN__)
//#define WIN32_LEAN_AND_MEAN
#define RPC_NO_WINDOWS_H
#include
@@ -64,7 +64,7 @@ typedef struct GLMipmap_s GLMipmap_t;
//
struct GLTexture_s
{
- GLMipmap_t mipmap;
+ GLMipmap_t mipmap;
float scaleX; //used for scaling textures on walls
float scaleY;
};
@@ -88,7 +88,7 @@ struct GLPatch_s
UINT16 wadnum; // the software patch lump num for when the hardware patch
UINT16 lumpnum; // was flushed, and we need to re-create it
GLMipmap_t mipmap;
-} ATTRPACK;
+};
typedef struct GLPatch_s GLPatch_t;
#endif //_HWR_DATA_
diff --git a/src/hardware/hw_defs.h b/src/hardware/hw_defs.h
index 52110121b..47c7c02a0 100644
--- a/src/hardware/hw_defs.h
+++ b/src/hardware/hw_defs.h
@@ -41,14 +41,8 @@ typedef unsigned char FBOOLEAN;
// ==========================================================================
// byte value for paletted graphics, which represent the transparent color
-#ifdef _NDS
-// NDS is hardwired to use zero as transparent color
-#define HWR_PATCHES_CHROMAKEY_COLORINDEX 0
-#define HWR_CHROMAKEY_EQUIVALENTCOLORINDEX 1
-#else
#define HWR_PATCHES_CHROMAKEY_COLORINDEX 255
#define HWR_CHROMAKEY_EQUIVALENTCOLORINDEX 130
-#endif
// the chroma key color shows on border sprites, set it to black
#define HWR_PATCHES_CHROMAKEY_COLORVALUE (0x00000000) //RGBA format as in grSstWinOpen()
diff --git a/src/hardware/hw_dll.h b/src/hardware/hw_dll.h
index 6b9f4d538..452e9037c 100644
--- a/src/hardware/hw_dll.h
+++ b/src/hardware/hw_dll.h
@@ -40,14 +40,14 @@
#define EXPORT
#endif
#endif
- #if defined (_WIN32) && !defined (_XBOX)
+ #ifdef _WIN32
#define HWRAPI(fn) WINAPI fn
#else
#define HWRAPI(fn) fn
#endif
#else // _CREATE_DLL_
#define EXPORT typedef
- #if defined (_WIN32) && !defined (_XBOX)
+ #ifdef _WIN32
#define HWRAPI(fn) (WINAPI *fn)
#else
#define HWRAPI(fn) (*fn)
diff --git a/src/hardware/hw_light.c b/src/hardware/hw_light.c
index cf9b1c536..267666749 100644
--- a/src/hardware/hw_light.c
+++ b/src/hardware/hw_light.c
@@ -323,6 +323,10 @@ light_t *t_lspr[NUMSPRITES] =
&lspr[NOLIGHT], // SPR_BMCH
&lspr[NOLIGHT], // SPR_SMCE
&lspr[NOLIGHT], // SPR_BMCE
+ &lspr[NOLIGHT], // SPR_YSPB
+ &lspr[NOLIGHT], // SPR_RSPB
+ &lspr[REDBALL_L], // SPR_SFBR
+ &lspr[REDBALL_L], // SPR_BFBR
// Arid Canyon Scenery
&lspr[NOLIGHT], // SPR_BTBL
diff --git a/src/hardware/hw_main.c b/src/hardware/hw_main.c
index 92c363943..864cd04b6 100644
--- a/src/hardware/hw_main.c
+++ b/src/hardware/hw_main.c
@@ -44,6 +44,10 @@
#endif
#include "hw_md2.h"
+#ifdef NEWCLIP
+#include "hw_clip.h"
+#endif
+
#define R_FAKEFLOORS
#define HWPRECIP
#define SORTING
@@ -99,8 +103,9 @@ CV_PossibleValue_t granisotropicmode_cons_t[] = {{1, "MIN"}, {16, "MAX"}, {0, NU
boolean drawsky = true;
// needs fix: walls are incorrectly clipped one column less
+#ifndef NEWCLIP
static consvar_t cv_grclipwalls = {"gr_clipwalls", "Off", 0, CV_OnOff, NULL, 0, NULL, NULL, 0, 0, NULL};
-
+#endif
//development variables for diverse uses
static consvar_t cv_gralpha = {"gr_alpha", "160", 0, CV_Unsigned, NULL, 0, NULL, NULL, 0, 0, NULL};
static consvar_t cv_grbeta = {"gr_beta", "0", 0, CV_Unsigned, NULL, 0, NULL, NULL, 0, 0, NULL};
@@ -323,9 +328,6 @@ static angle_t gr_xtoviewangle[MAXVIDWIDTH+1];
// test change fov when looking up/down but bsp projection messup :(
//#define NOCRAPPYMLOOK
-/// \note crappy
-#define drawtextured true
-
// base values set at SetViewSize
static float gr_basecentery;
@@ -641,13 +643,13 @@ static void HWR_RenderPlane(sector_t *sector, extrasubsector_t *xsub, boolean is
{
scrollx = FIXED_TO_FLOAT(FOFsector->floor_xoffs)/fflatsize;
scrolly = FIXED_TO_FLOAT(FOFsector->floor_yoffs)/fflatsize;
- angle = FOFsector->floorpic_angle>>ANGLETOFINESHIFT;
+ angle = FOFsector->floorpic_angle;
}
else // it's a ceiling
{
scrollx = FIXED_TO_FLOAT(FOFsector->ceiling_xoffs)/fflatsize;
scrolly = FIXED_TO_FLOAT(FOFsector->ceiling_yoffs)/fflatsize;
- angle = FOFsector->ceilingpic_angle>>ANGLETOFINESHIFT;
+ angle = FOFsector->ceilingpic_angle;
}
}
else if (gr_frontsector)
@@ -656,25 +658,19 @@ static void HWR_RenderPlane(sector_t *sector, extrasubsector_t *xsub, boolean is
{
scrollx = FIXED_TO_FLOAT(gr_frontsector->floor_xoffs)/fflatsize;
scrolly = FIXED_TO_FLOAT(gr_frontsector->floor_yoffs)/fflatsize;
- angle = gr_frontsector->floorpic_angle>>ANGLETOFINESHIFT;
+ angle = gr_frontsector->floorpic_angle;
}
else // it's a ceiling
{
scrollx = FIXED_TO_FLOAT(gr_frontsector->ceiling_xoffs)/fflatsize;
scrolly = FIXED_TO_FLOAT(gr_frontsector->ceiling_yoffs)/fflatsize;
- angle = gr_frontsector->ceilingpic_angle>>ANGLETOFINESHIFT;
+ angle = gr_frontsector->ceilingpic_angle;
}
}
if (angle) // Only needs to be done if there's an altered angle
{
-
- // This needs to be done so that it scrolls in a different direction after rotation like software
- tempxsow = FLOAT_TO_FIXED(scrollx);
- tempytow = FLOAT_TO_FIXED(scrolly);
- scrollx = (FIXED_TO_FLOAT(FixedMul(tempxsow, FINECOSINE(angle)) - FixedMul(tempytow, FINESINE(angle))));
- scrolly = (FIXED_TO_FLOAT(FixedMul(tempxsow, FINESINE(angle)) + FixedMul(tempytow, FINECOSINE(angle))));
-
+ angle = InvAngle(angle)>>ANGLETOFINESHIFT;
// This needs to be done so everything aligns after rotation
// It would be done so that rotation is done, THEN the translation, but I couldn't get it to rotate AND scroll like software does
tempxsow = FLOAT_TO_FIXED(flatxref);
@@ -687,7 +683,7 @@ static void HWR_RenderPlane(sector_t *sector, extrasubsector_t *xsub, boolean is
{
// Hurdler: add scrolling texture on floor/ceiling
v3d->sow = (float)((pv->x / fflatsize) - flatxref + scrollx);
- v3d->tow = (float)(flatyref - (pv->y / fflatsize) + scrolly);
+ v3d->tow = (float)(-(pv->y / fflatsize) + flatyref + scrolly);
//v3d->sow = (float)(pv->x / fflatsize);
//v3d->tow = (float)(pv->y / fflatsize);
@@ -698,7 +694,7 @@ static void HWR_RenderPlane(sector_t *sector, extrasubsector_t *xsub, boolean is
tempxsow = FLOAT_TO_FIXED(v3d->sow);
tempytow = FLOAT_TO_FIXED(v3d->tow);
v3d->sow = (FIXED_TO_FLOAT(FixedMul(tempxsow, FINECOSINE(angle)) - FixedMul(tempytow, FINESINE(angle))));
- v3d->tow = (FIXED_TO_FLOAT(-FixedMul(tempxsow, FINESINE(angle)) - FixedMul(tempytow, FINECOSINE(angle))));
+ v3d->tow = (FIXED_TO_FLOAT(FixedMul(tempxsow, FINESINE(angle)) + FixedMul(tempytow, FINECOSINE(angle))));
}
//v3d->sow = (float)(v3d->sow - flatxref + scrollx);
@@ -858,11 +854,11 @@ static void HWR_DrawSegsSplats(FSurfaceInfo * pSurf)
M_ClearBox(segbbox);
M_AddToBox(segbbox,
- FLOAT_TO_FIXED(((polyvertex_t *)gr_curline->v1)->x),
- FLOAT_TO_FIXED(((polyvertex_t *)gr_curline->v1)->y));
+ FLOAT_TO_FIXED(((polyvertex_t *)gr_curline->pv1)->x),
+ FLOAT_TO_FIXED(((polyvertex_t *)gr_curline->pv1)->y));
M_AddToBox(segbbox,
- FLOAT_TO_FIXED(((polyvertex_t *)gr_curline->v2)->x),
- FLOAT_TO_FIXED(((polyvertex_t *)gr_curline->v2)->y));
+ FLOAT_TO_FIXED(((polyvertex_t *)gr_curline->pv2)->x),
+ FLOAT_TO_FIXED(((polyvertex_t *)gr_curline->pv2)->y));
splat = (wallsplat_t *)gr_curline->linedef->splats;
for (; splat; splat = splat->next)
@@ -1035,6 +1031,7 @@ static void HWR_ProjectWall(wallVert3D * wallVerts,
// (in fact a clipping plane that has a constant, so can clip with simple 2d)
// with the wall segment
//
+#ifndef NEWCLIP
static float HWR_ClipViewSegment(INT32 x, polyvertex_t *v1, polyvertex_t *v2)
{
float num, den;
@@ -1063,6 +1060,7 @@ static float HWR_ClipViewSegment(INT32 x, polyvertex_t *v1, polyvertex_t *v2)
return num / den;
}
+#endif
//
// HWR_SplitWall
@@ -1437,7 +1435,11 @@ static void HWR_DrawSkyWall(wallVert3D *wallVerts, FSurfaceInfo *Surf, fixed_t b
// Anything between means the wall segment has been clipped with solidsegs,
// reducing wall overdraw to a minimum
//
+#ifdef NEWCLIP
+static void HWR_ProcessSeg(void) // Sort of like GLWall::Process in GZDoom
+#else
static void HWR_StoreWallRange(double startfrac, double endfrac)
+#endif
{
wallVert3D wallVerts[4];
v2d_t vs, ve; // start, end vertices of 2d line (view from above)
@@ -1462,16 +1464,18 @@ static void HWR_StoreWallRange(double startfrac, double endfrac)
extracolormap_t *colormap;
FSurfaceInfo Surf;
+#ifndef NEWCLIP
if (startfrac > endfrac)
return;
+#endif
gr_sidedef = gr_curline->sidedef;
gr_linedef = gr_curline->linedef;
- vs.x = ((polyvertex_t *)gr_curline->v1)->x;
- vs.y = ((polyvertex_t *)gr_curline->v1)->y;
- ve.x = ((polyvertex_t *)gr_curline->v2)->x;
- ve.y = ((polyvertex_t *)gr_curline->v2)->y;
+ vs.x = ((polyvertex_t *)gr_curline->pv1)->x;
+ vs.y = ((polyvertex_t *)gr_curline->pv1)->y;
+ ve.x = ((polyvertex_t *)gr_curline->pv2)->x;
+ ve.y = ((polyvertex_t *)gr_curline->pv2)->y;
#ifdef ESLOPE
v1x = FLOAT_TO_FIXED(vs.x);
@@ -1479,44 +1483,21 @@ static void HWR_StoreWallRange(double startfrac, double endfrac)
v2x = FLOAT_TO_FIXED(ve.x);
v2y = FLOAT_TO_FIXED(ve.y);
#endif
-
- if (gr_frontsector->heightsec != -1)
- {
#ifdef ESLOPE
- worldtop = worldtopslope = sectors[gr_frontsector->heightsec].ceilingheight;
- worldbottom = worldbottomslope = sectors[gr_frontsector->heightsec].floorheight;
-#else
- worldtop = sectors[gr_frontsector->heightsec].ceilingheight;
- worldbottom = sectors[gr_frontsector->heightsec].floorheight;
-#endif
- }
- else
- {
-#ifdef ESLOPE
- if (gr_frontsector->c_slope)
- {
- worldtop = P_GetZAt(gr_frontsector->c_slope, v1x, v1y);
- worldtopslope = P_GetZAt(gr_frontsector->c_slope, v2x, v2y);
- }
- else
- {
- worldtop = worldtopslope = gr_frontsector->ceilingheight;
- }
- if (gr_frontsector->f_slope)
- {
- worldbottom = P_GetZAt(gr_frontsector->f_slope, v1x, v1y);
- worldbottomslope = P_GetZAt(gr_frontsector->f_slope, v2x, v2y);
- }
- else
- {
- worldbottom = worldbottomslope = gr_frontsector->floorheight;
- }
+#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->c_slope, worldtop, worldtopslope, gr_frontsector->ceilingheight)
+ SLOPEPARAMS(gr_frontsector->f_slope, worldbottom, worldbottomslope, gr_frontsector->floorheight)
#else
- worldtop = gr_frontsector->ceilingheight;
- worldbottom = gr_frontsector->floorheight;
+ worldtop = gr_frontsector->ceilingheight;
+ worldbottom = gr_frontsector->floorheight;
#endif
- }
// remember vertices ordering
// 3--2
@@ -1531,20 +1512,23 @@ static void HWR_StoreWallRange(double startfrac, double endfrac)
wallVerts[2].z = wallVerts[1].z = ve.y;
wallVerts[0].w = wallVerts[1].w = wallVerts[2].w = wallVerts[3].w = 1.0f;
- if (drawtextured)
{
// x offset the texture
fixed_t texturehpeg = gr_sidedef->textureoffset + gr_curline->offset;
+#ifndef NEWCLIP
// clip texture s start/end coords with solidsegs
if (startfrac > 0.0f && startfrac < 1.0f)
cliplow = (float)(texturehpeg + (gr_curline->flength*FRACUNIT) * startfrac);
else
+#endif
cliplow = (float)texturehpeg;
+#ifndef NEWCLIP
if (endfrac > 0.0f && endfrac < 1.0f)
cliphigh = (float)(texturehpeg + (gr_curline->flength*FRACUNIT) * endfrac);
else
+#endif
cliphigh = (float)(texturehpeg + (gr_curline->flength*FRACUNIT));
}
@@ -1560,43 +1544,15 @@ static void HWR_StoreWallRange(double startfrac, double endfrac)
{
INT32 gr_toptexture, gr_bottomtexture;
// two sided line
- if (gr_backsector->heightsec != -1)
- {
-#ifdef ESLOPE
- worldhigh = worldhighslope = sectors[gr_backsector->heightsec].ceilingheight;
- worldlow = worldlowslope = sectors[gr_backsector->heightsec].floorheight;
-#else
- worldhigh = sectors[gr_backsector->heightsec].ceilingheight;
- worldlow = sectors[gr_backsector->heightsec].floorheight;
-#endif
- }
- else
- {
-#ifdef ESLOPE
- if (gr_backsector->c_slope)
- {
- worldhigh = P_GetZAt(gr_backsector->c_slope, v1x, v1y);
- worldhighslope = P_GetZAt(gr_backsector->c_slope, v2x, v2y);
- }
- else
- {
- worldhigh = worldhighslope = gr_backsector->ceilingheight;
- }
- if (gr_backsector->f_slope)
- {
- worldlow = P_GetZAt(gr_backsector->f_slope, v1x, v1y);
- worldlowslope = P_GetZAt(gr_backsector->f_slope, v2x, v2y);
- }
- else
- {
- worldlow = worldlowslope = gr_backsector->floorheight;
- }
+#ifdef ESLOPE
+ SLOPEPARAMS(gr_backsector->c_slope, worldhigh, worldhighslope, gr_backsector->ceilingheight)
+ SLOPEPARAMS(gr_backsector->f_slope, worldlow, worldlowslope, gr_backsector->floorheight)
+#undef SLOPEPARAMS
#else
- worldhigh = gr_backsector->ceilingheight;
- worldlow = gr_backsector->floorheight;
+ worldhigh = gr_backsector->ceilingheight;
+ worldlow = gr_backsector->floorheight;
#endif
- }
// hack to allow height changes in outdoor areas
// This is what gets rid of the upper textures if there should be sky
@@ -1620,7 +1576,6 @@ static void HWR_StoreWallRange(double startfrac, double endfrac)
worldhigh < worldtop
) && gr_toptexture)
{
- if (drawtextured)
{
fixed_t texturevpegtop; // top
@@ -1701,7 +1656,6 @@ static void HWR_StoreWallRange(double startfrac, double endfrac)
#endif
worldlow > worldbottom) && gr_bottomtexture) //only if VISIBLE!!!
{
- if (drawtextured)
{
fixed_t texturevpegbottom = 0; // bottom
@@ -1893,7 +1847,6 @@ static void HWR_StoreWallRange(double startfrac, double endfrac)
h = min(highcut, polytop);
l = max(polybottom, lowcut);
- if (drawtextured)
{
// PEGGING
#ifdef ESLOPE
@@ -1949,7 +1902,6 @@ static void HWR_StoreWallRange(double startfrac, double endfrac)
h = min(highcut, polytop);
l = max(polybottom, lowcut);
- if (drawtextured)
{
// PEGGING
if (!!(gr_linedef->flags & ML_DONTPEGBOTTOM) ^ !!(gr_linedef->flags & ML_EFFECT3))
@@ -2141,7 +2093,6 @@ static void HWR_StoreWallRange(double startfrac, double endfrac)
gr_midtexture = R_GetTextureNum(gr_sidedef->midtexture);
if (gr_midtexture)
{
- if (drawtextured)
{
fixed_t texturevpeg;
// PEGGING
@@ -2282,7 +2233,7 @@ static void HWR_StoreWallRange(double startfrac, double endfrac)
wallVerts[0].s = wallVerts[3].s = 0;
wallVerts[2].s = wallVerts[1].s = 0;
}
- else if (drawtextured)
+ else
{
#ifdef ESLOPE // P.S. this is better-organized than the old version
fixed_t offs = sides[(newline ? newline : rover->master)->sidenum[0]].rowoffset;
@@ -2415,7 +2366,7 @@ static void HWR_StoreWallRange(double startfrac, double endfrac)
wallVerts[0].s = wallVerts[3].s = 0;
wallVerts[2].s = wallVerts[1].s = 0;
}
- else if (drawtextured)
+ else
{
grTex = HWR_GetTexture(texnum);
@@ -2488,6 +2439,110 @@ static void HWR_StoreWallRange(double startfrac, double endfrac)
//Hurdler: end of 3d-floors test
}
+// From PrBoom:
+//
+// e6y: Check whether the player can look beyond this line
+//
+#ifdef NEWCLIP
+boolean checkforemptylines = true;
+// Don't modify anything here, just check
+// Kalaron: Modified for sloped linedefs
+static boolean CheckClip(seg_t * seg, sector_t * afrontsector, sector_t * abacksector)
+{
+ fixed_t frontf1,frontf2, frontc1, frontc2; // front floor/ceiling ends
+ fixed_t backf1, backf2, backc1, backc2; // back floor ceiling ends
+
+ // GZDoom method of sloped line clipping
+
+#ifdef ESLOPE
+ if (afrontsector->f_slope || afrontsector->c_slope || abacksector->f_slope || abacksector->c_slope)
+ {
+ fixed_t v1x, v1y, v2x, v2y; // the seg's vertexes as fixed_t
+ v1x = FLOAT_TO_FIXED(((polyvertex_t *)gr_curline->pv1)->x);
+ v1y = FLOAT_TO_FIXED(((polyvertex_t *)gr_curline->pv1)->y);
+ v2x = FLOAT_TO_FIXED(((polyvertex_t *)gr_curline->pv2)->x);
+ v2y = FLOAT_TO_FIXED(((polyvertex_t *)gr_curline->pv2)->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(afrontsector->f_slope, frontf1, frontf2, afrontsector->floorheight)
+ SLOPEPARAMS(afrontsector->c_slope, frontc1, frontc2, afrontsector->ceilingheight)
+ SLOPEPARAMS( abacksector->f_slope, backf1, backf2, abacksector->floorheight)
+ SLOPEPARAMS( abacksector->c_slope, backc1, backc2, abacksector->ceilingheight)
+#undef SLOPEPARAMS
+ }
+ else
+#endif
+ {
+ frontf1 = frontf2 = afrontsector->floorheight;
+ frontc1 = frontc2 = afrontsector->ceilingheight;
+ backf1 = backf2 = abacksector->floorheight;
+ backc1 = backc2 = abacksector->ceilingheight;
+ }
+
+ // now check for closed sectors!
+ if (backc1 <= frontf1 && backc2 <= frontf2)
+ {
+ checkforemptylines = false;
+ if (!seg->sidedef->toptexture)
+ return false;
+
+ if (abacksector->ceilingpic == skyflatnum && afrontsector->ceilingpic == skyflatnum)
+ return false;
+
+ return true;
+ }
+
+ if (backf1 >= frontc1 && backf2 >= frontc2)
+ {
+ checkforemptylines = false;
+ if (!seg->sidedef->bottomtexture)
+ return false;
+
+ // properly render skies (consider door "open" if both floors are sky):
+ if (abacksector->ceilingpic == skyflatnum && afrontsector->ceilingpic == skyflatnum)
+ return false;
+
+ return true;
+ }
+
+ if (backc1 <= backf1 && backc2 <= backf2)
+ {
+ checkforemptylines = false;
+ // preserve a kind of transparent door/lift special effect:
+ if (backc1 < frontc1 || backc2 < frontc2)
+ {
+ if (!seg->sidedef->toptexture)
+ return false;
+ }
+ if (backf1 > frontf1 || backf2 > frontf2)
+ {
+ if (!seg->sidedef->bottomtexture)
+ return false;
+ }
+ if (abacksector->ceilingpic == skyflatnum && afrontsector->ceilingpic == skyflatnum)
+ return false;
+
+ if (abacksector->floorpic == skyflatnum && afrontsector->floorpic == skyflatnum)
+ return false;
+
+ return true;
+ }
+
+ if (backc1 != frontc1 || backc2 != frontc2
+ || backf1 != frontf1 || backf2 != frontf2)
+ {
+ checkforemptylines = false;
+ return false;
+ }
+
+ return false;
+}
+#else
//Hurdler: just like in r_bsp.c
#if 1
#define MAXSEGS MAXVIDWIDTH/2+1
@@ -2559,7 +2614,7 @@ static void HWR_ClipSolidWallSegment(INT32 first, INT32 last)
}
else
{
- highfrac = HWR_ClipViewSegment(start->first+1, (polyvertex_t *)gr_curline->v1, (polyvertex_t *)gr_curline->v2);
+ highfrac = HWR_ClipViewSegment(start->first+1, (polyvertex_t *)gr_curline->pv1, (polyvertex_t *)gr_curline->pv2);
HWR_StoreWallRange(0, highfrac);
}
// Now adjust the clip size.
@@ -2583,8 +2638,8 @@ static void HWR_ClipSolidWallSegment(INT32 first, INT32 last)
}
else
{
- lowfrac = HWR_ClipViewSegment(next->last-1, (polyvertex_t *)gr_curline->v1, (polyvertex_t *)gr_curline->v2);
- highfrac = HWR_ClipViewSegment((next+1)->first+1, (polyvertex_t *)gr_curline->v1, (polyvertex_t *)gr_curline->v2);
+ lowfrac = HWR_ClipViewSegment(next->last-1, (polyvertex_t *)gr_curline->pv1, (polyvertex_t *)gr_curline->pv2);
+ highfrac = HWR_ClipViewSegment((next+1)->first+1, (polyvertex_t *)gr_curline->pv1, (polyvertex_t *)gr_curline->pv2);
HWR_StoreWallRange(lowfrac, highfrac);
}
next++;
@@ -2618,7 +2673,7 @@ static void HWR_ClipSolidWallSegment(INT32 first, INT32 last)
}
else
{
- lowfrac = HWR_ClipViewSegment(next->last-1, (polyvertex_t *)gr_curline->v1, (polyvertex_t *)gr_curline->v2);
+ lowfrac = HWR_ClipViewSegment(next->last-1, (polyvertex_t *)gr_curline->pv1, (polyvertex_t *)gr_curline->pv2);
HWR_StoreWallRange(lowfrac, 1);
}
}
@@ -2681,8 +2736,8 @@ static void HWR_ClipPassWallSegment(INT32 first, INT32 last)
else
{
highfrac = HWR_ClipViewSegment(min(start->first + 1,
- start->last), (polyvertex_t *)gr_curline->v1,
- (polyvertex_t *)gr_curline->v2);
+ start->last), (polyvertex_t *)gr_curline->pv1,
+ (polyvertex_t *)gr_curline->pv2);
HWR_StoreWallRange(0, highfrac);
}
}
@@ -2701,8 +2756,8 @@ static void HWR_ClipPassWallSegment(INT32 first, INT32 last)
}
else
{
- lowfrac = HWR_ClipViewSegment(max(start->last-1,start->first), (polyvertex_t *)gr_curline->v1, (polyvertex_t *)gr_curline->v2);
- highfrac = HWR_ClipViewSegment(min((start+1)->first+1,(start+1)->last), (polyvertex_t *)gr_curline->v1, (polyvertex_t *)gr_curline->v2);
+ lowfrac = HWR_ClipViewSegment(max(start->last-1,start->first), (polyvertex_t *)gr_curline->pv1, (polyvertex_t *)gr_curline->pv2);
+ highfrac = HWR_ClipViewSegment(min((start+1)->first+1,(start+1)->last), (polyvertex_t *)gr_curline->pv1, (polyvertex_t *)gr_curline->pv2);
HWR_StoreWallRange(lowfrac, highfrac);
}
start++;
@@ -2732,8 +2787,8 @@ static void HWR_ClipPassWallSegment(INT32 first, INT32 last)
else
{
lowfrac = HWR_ClipViewSegment(max(start->last - 1,
- start->first), (polyvertex_t *)gr_curline->v1,
- (polyvertex_t *)gr_curline->v2);
+ start->first), (polyvertex_t *)gr_curline->pv1,
+ (polyvertex_t *)gr_curline->pv2);
HWR_StoreWallRange(lowfrac, 1);
}
}
@@ -2773,6 +2828,7 @@ static void HWR_ClearClipSegs(void)
gr_solidsegs[1].last = 0x7fffffff;
hw_newend = gr_solidsegs+2;
}
+#endif // NEWCLIP
// -----------------+
// HWR_AddLine : Clips the given segment and adds any visible pieces to the line list.
@@ -2781,24 +2837,46 @@ static void HWR_ClearClipSegs(void)
// -----------------+
static void HWR_AddLine(seg_t * line)
{
- INT32 x1, x2;
angle_t angle1, angle2;
+#ifndef NEWCLIP
+ INT32 x1, x2;
angle_t span, tspan;
+#endif
// SoM: Backsector needs to be run through R_FakeFlat
sector_t tempsec;
+ fixed_t v1x, v1y, v2x, v2y; // the seg's vertexes as fixed_t
+#ifdef POLYOBJECTS
if (line->polyseg && !(line->polyseg->flags & POF_RENDERSIDES))
return;
+#endif
gr_curline = line;
- // OPTIMIZE: quickly reject orthogonal back sides.
- angle1 = R_PointToAngle(FLOAT_TO_FIXED(((polyvertex_t *)gr_curline->v1)->x),
- FLOAT_TO_FIXED(((polyvertex_t *)gr_curline->v1)->y));
- angle2 = R_PointToAngle(FLOAT_TO_FIXED(((polyvertex_t *)gr_curline->v2)->x),
- FLOAT_TO_FIXED(((polyvertex_t *)gr_curline->v2)->y));
+ v1x = FLOAT_TO_FIXED(((polyvertex_t *)gr_curline->pv1)->x);
+ v1y = FLOAT_TO_FIXED(((polyvertex_t *)gr_curline->pv1)->y);
+ v2x = FLOAT_TO_FIXED(((polyvertex_t *)gr_curline->pv2)->x);
+ v2y = FLOAT_TO_FIXED(((polyvertex_t *)gr_curline->pv2)->y);
+ // OPTIMIZE: quickly reject orthogonal back sides.
+ angle1 = R_PointToAngle(v1x, v1y);
+ angle2 = R_PointToAngle(v2x, v2y);
+
+#ifdef NEWCLIP
+ // PrBoom: Back side, i.e. backface culling - read: endAngle >= startAngle!
+ if (angle2 - angle1 < ANGLE_180)
+ return;
+
+ // PrBoom: use REAL clipping math YAYYYYYYY!!!
+
+ if (!gld_clipper_SafeCheckRange(angle2, angle1))
+ {
+ return;
+ }
+
+ checkforemptylines = true;
+#else
// Clip to view edges.
span = angle1 - angle2;
@@ -2839,8 +2917,8 @@ static void HWR_AddLine(seg_t * line)
float fx1,fx2,fy1,fy2;
//BP: test with a better projection than viewangletox[R_PointToAngle(angle)]
// do not enable this at release 4 mul and 2 div
- fx1 = ((polyvertex_t *)(line->v1))->x-gr_viewx;
- fy1 = ((polyvertex_t *)(line->v1))->y-gr_viewy;
+ fx1 = ((polyvertex_t *)(line->pv1))->x-gr_viewx;
+ fy1 = ((polyvertex_t *)(line->pv1))->y-gr_viewy;
fy2 = (fx1 * gr_viewcos + fy1 * gr_viewsin);
if (fy2 < 0)
// the point is back
@@ -2848,8 +2926,8 @@ static void HWR_AddLine(seg_t * line)
else
fx1 = gr_windowcenterx + (fx1 * gr_viewsin - fy1 * gr_viewcos) * gr_centerx / fy2;
- fx2 = ((polyvertex_t *)(line->v2))->x-gr_viewx;
- fy2 = ((polyvertex_t *)(line->v2))->y-gr_viewy;
+ fx2 = ((polyvertex_t *)(line->pv2))->x-gr_viewx;
+ fy2 = ((polyvertex_t *)(line->pv2))->y-gr_viewy;
fy1 = (fx2 * gr_viewcos + fy2 * gr_viewsin);
if (fy1 < 0)
// the point is back
@@ -2877,8 +2955,34 @@ static void HWR_AddLine(seg_t * line)
return;
}
*/
+#endif
+
gr_backsector = line->backsector;
+#ifdef NEWCLIP
+ if (!line->backsector)
+ {
+ gld_clipper_SafeAddClipRange(angle2, angle1);
+ }
+ else
+ {
+ gr_backsector = R_FakeFlat(gr_backsector, &tempsec, NULL, NULL, true);
+ if (CheckClip(line, gr_frontsector, gr_backsector))
+ {
+ gld_clipper_SafeAddClipRange(angle2, angle1);
+ checkforemptylines = false;
+ }
+ // Reject empty lines used for triggers and special events.
+ // Identical floor and ceiling on both sides,
+ // identical light levels on both sides,
+ // and no middle texture.
+ if (checkforemptylines && R_IsEmptyLine(line, gr_frontsector, gr_backsector))
+ return;
+ }
+
+ HWR_ProcessSeg(); // Doesn't need arguments because they're defined globally :D
+ return;
+#else
// Single sided line?
if (!gr_backsector)
goto clipsolid;
@@ -2888,14 +2992,9 @@ static void HWR_AddLine(seg_t * line)
#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
- 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); \
@@ -2916,6 +3015,13 @@ static void HWR_AddLine(seg_t * line)
goto clipsolid;
}
+ // Check for automap fix.
+ if (backc1 <= backf1 && backc2 <= backf2
+ && ((backc1 >= frontc1 && backc2 >= frontc2) || gr_curline->sidedef->toptexture)
+ && ((backf1 <= frontf1 && backf2 >= frontf2) || gr_curline->sidedef->bottomtexture)
+ && (gr_backsector->ceilingpic != skyflatnum || gr_frontsector->ceilingpic != skyflatnum))
+ goto clipsolid;
+
// Window.
if (backc1 != frontc1 || backc2 != frontc2
|| backf1 != frontf1 || backf2 != frontf2)
@@ -2931,6 +3037,13 @@ static void HWR_AddLine(seg_t * line)
gr_backsector->floorheight >= gr_frontsector->ceilingheight)
goto clipsolid;
+ // Check for automap fix.
+ if (gr_backsector->ceilingheight <= gr_backsector->floorheight
+ && ((gr_backsector->ceilingheight >= gr_frontsector->ceilingheight) || gr_curline->sidedef->toptexture)
+ && ((gr_backsector->floorheight <= gr_backsector->floorheight) || gr_curline->sidedef->bottomtexture)
+ && (gr_backsector->ceilingpic != skyflatnum || gr_frontsector->ceilingpic != skyflatnum))
+ goto clipsolid;
+
// Window.
if (gr_backsector->ceilingheight != gr_frontsector->ceilingheight ||
gr_backsector->floorheight != gr_frontsector->floorheight)
@@ -2941,25 +3054,8 @@ static void HWR_AddLine(seg_t * line)
// Identical floor and ceiling on both sides,
// identical light levels on both sides,
// and no middle texture.
- if (
-#ifdef POLYOBJECTS
- !line->polyseg &&
-#endif
- gr_backsector->ceilingpic == gr_frontsector->ceilingpic
- && gr_backsector->floorpic == gr_frontsector->floorpic
-#ifdef ESLOPE
- && gr_backsector->f_slope == gr_frontsector->f_slope
- && gr_backsector->c_slope == gr_frontsector->c_slope
-#endif
- && gr_backsector->lightlevel == gr_frontsector->lightlevel
- && gr_curline->sidedef->midtexture == 0
- && !gr_backsector->ffloors && !gr_frontsector->ffloors)
- // SoM: For 3D sides... Boris, would you like to take a
- // crack at rendering 3D sides? You would need to add the
- // above check and add code to HWR_StoreWallRange...
- {
+ if (R_IsEmptyLine(gr_curline, gr_frontsector, gr_backsector))
return;
- }
clippass:
if (x1 == x2)
@@ -2971,6 +3067,7 @@ clipsolid:
if (x1 == x2)
goto clippass;
HWR_ClipSolidWallSegment(x1, x2-1);
+#endif
}
// HWR_CheckBBox
@@ -2982,9 +3079,13 @@ clipsolid:
static boolean HWR_CheckBBox(fixed_t *bspcoord)
{
- INT32 boxpos, sx1, sx2;
+ INT32 boxpos;
fixed_t px1, py1, px2, py2;
- angle_t angle1, angle2, span, tspan;
+ angle_t angle1, angle2;
+#ifndef NEWCLIP
+ INT32 sx1, sx2;
+ angle_t span, tspan;
+#endif
// Find the corners of the box
// that define the edges from current viewpoint.
@@ -3010,6 +3111,11 @@ static boolean HWR_CheckBBox(fixed_t *bspcoord)
px2 = bspcoord[checkcoord[boxpos][2]];
py2 = bspcoord[checkcoord[boxpos][3]];
+#ifdef NEWCLIP
+ angle1 = R_PointToAngle(px1, py1);
+ angle2 = R_PointToAngle(px2, py2);
+ return gld_clipper_SafeCheckRange(angle2, angle1);
+#else
// check clip list for an open space
angle1 = R_PointToAngle(px1, py1) - dup_viewangle;
angle2 = R_PointToAngle(px2, py2) - dup_viewangle;
@@ -3057,6 +3163,7 @@ static boolean HWR_CheckBBox(fixed_t *bspcoord)
return false;
return HWR_ClipToSolidSegs(sx1, sx2 - 1);
+#endif
}
#ifdef POLYOBJECTS
@@ -3090,8 +3197,8 @@ static inline void HWR_AddPolyObjectSegs(void)
pv2->x = FIXED_TO_FLOAT(gr_fakeline->v2->x);
pv2->y = FIXED_TO_FLOAT(gr_fakeline->v2->y);
- gr_fakeline->v1 = (vertex_t *)pv1;
- gr_fakeline->v2 = (vertex_t *)pv2;
+ gr_fakeline->pv1 = pv1;
+ gr_fakeline->pv2 = pv2;
HWR_AddLine(gr_fakeline);
}
@@ -4646,8 +4753,6 @@ static polyplaneinfo_t *polyplaneinfo = NULL;
#ifndef SORTING
size_t numfloors = 0;
#else
-//static floorinfo_t *floorinfo = NULL;
-//static size_t numfloors = 0;
//Hurdler: 3D water sutffs
typedef struct gr_drawnode_s
{
@@ -5134,7 +5239,7 @@ static void HWR_ProjectSprite(mobj_t *thing)
// Note: DO NOT do this in software mode version, it actually
// makes papersprites look WORSE there (I know, I've tried)
// Monster Iestyn - 13/05/17
- ang = dup_viewangle - thing->angle;
+ ang = dup_viewangle - (thing->player ? thing->player->drawangle : thing->angle);
ang_scale = FIXED_TO_FLOAT(FINESINE(ang>>ANGLETOFINESHIFT));
ang_scalez = FIXED_TO_FLOAT(FINECOSINE(ang>>ANGLETOFINESHIFT));
@@ -5145,7 +5250,7 @@ static void HWR_ProjectSprite(mobj_t *thing)
}
}
else if (sprframe->rotate != SRF_SINGLE)
- ang = R_PointToAngle (thing->x, thing->y) - thing->angle;
+ ang = R_PointToAngle (thing->x, thing->y) - (thing->player ? thing->player->drawangle : thing->angle);
if (sprframe->rotate == SRF_SINGLE)
{
@@ -5621,12 +5726,8 @@ if (0)
HWD.pfnSetSpecialState(HWD_SET_FOG_MODE, 0); // Turn it off
}
-#ifndef _NDS
if (drawsky)
HWR_DrawSkyBackground(player);
-#else
- (void)HWR_DrawSkyBackground;
-#endif
//Hurdler: it doesn't work in splitscreen mode
drawsky = splitscreen;
@@ -5636,7 +5737,19 @@ if (0)
#ifdef SORTING
drawcount = 0;
#endif
+#ifdef NEWCLIP
+ if (rendermode == render_opengl)
+ {
+ angle_t a1 = gld_FrustumAngle();
+ gld_clipper_Clear();
+ gld_clipper_SafeAddClipRange(viewangle + a1, viewangle - a1);
+#ifdef HAVE_SPHEREFRUSTRUM
+ gld_FrustrumSetup();
+#endif
+ }
+#else
HWR_ClearClipSegs();
+#endif
//04/01/2000: Hurdler: added for T&L
// Actually it only works on Walls and Planes
@@ -5646,6 +5759,7 @@ if (0)
HWR_RenderBSPNode((INT32)numnodes-1);
+#ifndef NEWCLIP
// Make a viewangle int so we can render things based on mouselook
if (player == &players[consoleplayer])
viewangle = localaiming;
@@ -5672,6 +5786,7 @@ if (0)
dup_viewangle += ANGLE_90;
}
+#endif
// Check for new console commands.
NetUpdate();
@@ -5851,12 +5966,8 @@ if (0)
HWD.pfnSetSpecialState(HWD_SET_FOG_MODE, 0); // Turn it off
}
-#ifndef _NDS
if (!skybox && drawsky) // Don't draw the regular sky if there's a skybox
HWR_DrawSkyBackground(player);
-#else
- (void)HWR_DrawSkyBackground;
-#endif
//Hurdler: it doesn't work in splitscreen mode
drawsky = splitscreen;
@@ -5866,7 +5977,19 @@ if (0)
#ifdef SORTING
drawcount = 0;
#endif
+#ifdef NEWCLIP
+ if (rendermode == render_opengl)
+ {
+ angle_t a1 = gld_FrustumAngle();
+ gld_clipper_Clear();
+ gld_clipper_SafeAddClipRange(viewangle + a1, viewangle - a1);
+#ifdef HAVE_SPHEREFRUSTRUM
+ gld_FrustrumSetup();
+#endif
+ }
+#else
HWR_ClearClipSegs();
+#endif
//04/01/2000: Hurdler: added for T&L
// Actually it only works on Walls and Planes
@@ -5876,6 +5999,7 @@ if (0)
HWR_RenderBSPNode((INT32)numnodes-1);
+#ifndef NEWCLIP
// Make a viewangle int so we can render things based on mouselook
if (player == &players[consoleplayer])
viewangle = localaiming;
@@ -5902,6 +6026,7 @@ if (0)
dup_viewangle += ANGLE_90;
}
+#endif
// Check for new console commands.
NetUpdate();
@@ -6047,7 +6172,9 @@ static inline void HWR_AddEngineCommands(void)
{
// engine state variables
//CV_RegisterVar(&cv_grzbuffer);
+#ifndef NEWCLIP
CV_RegisterVar(&cv_grclipwalls);
+#endif
// engine development mode variables
// - usage may vary from version to version..
@@ -6090,12 +6217,7 @@ void HWR_Startup(void)
}
if (rendermode == render_opengl)
- textureformat = patchformat =
-#ifdef _NDS
- GR_TEXFMT_P_8;
-#else
- GR_RGBA;
-#endif
+ textureformat = patchformat = GR_RGBA;
startupdone = true;
}
diff --git a/src/hardware/hw_main.h b/src/hardware/hw_main.h
index b0a14d3b5..cb49f817c 100644
--- a/src/hardware/hw_main.h
+++ b/src/hardware/hw_main.h
@@ -46,8 +46,7 @@ void HWR_SetViewSize(void);
void HWR_DrawPatch(GLPatch_t *gpatch, INT32 x, INT32 y, INT32 option);
void HWR_DrawFixedPatch(GLPatch_t *gpatch, fixed_t x, fixed_t y, fixed_t scale, INT32 option, const UINT8 *colormap);
void HWR_DrawCroppedPatch(GLPatch_t *gpatch, fixed_t x, fixed_t y, fixed_t scale, INT32 option, fixed_t sx, fixed_t sy, fixed_t w, fixed_t h);
-void HWR_DrawCroppedPatch(GLPatch_t *gpatch, fixed_t x, fixed_t y, INT32 option, fixed_t scale, fixed_t sx, fixed_t sy, fixed_t w, fixed_t h);
-void HWR_MakePatch (const patch_t *patch, GLPatch_t *grPatch, GLMipmap_t *grMipmap, boolean makebitmap);
+void HWR_MakePatch(const patch_t *patch, GLPatch_t *grPatch, GLMipmap_t *grMipmap, boolean makebitmap);
void HWR_CreatePlanePolygons(INT32 bspnum);
void HWR_CreateStaticLightmaps(INT32 bspnum);
void HWR_PrepLevelCache(size_t pnumtextures);
@@ -104,13 +103,4 @@ extern float gr_viewwindowx, gr_basewindowcentery;
extern fixed_t *hwbbox;
extern FTransform atransform;
-typedef struct
-{
- wallVert3D floorVerts[4];
- FSurfaceInfo Surf;
- INT32 texnum;
- INT32 blend;
- INT32 drawcount;
-} floorinfo_t;
-
#endif
diff --git a/src/hardware/hw_md2.c b/src/hardware/hw_md2.c
index 7edf02db0..70a257c92 100644
--- a/src/hardware/hw_md2.c
+++ b/src/hardware/hw_md2.c
@@ -28,6 +28,7 @@
#include "../doomdef.h"
#include "../doomstat.h"
+#include "../fastcmp.h"
#ifdef HWRENDER
#include "hw_drv.h"
@@ -265,6 +266,9 @@ static void md2_freeModel (md2_model_t *model)
free(model->frames);
}
+ if (model->spr2frames)
+ free(model->spr2frames);
+
if (model->glCommandBuffer)
free(model->glCommandBuffer);
@@ -298,8 +302,8 @@ static md2_model_t *md2_readModel(const char *filename)
// initialize model and read header
if (fread(&model->header, sizeof (model->header), 1, file) != 1
- || model->header.magic !=
- (INT32)(('2' << 24) + ('P' << 16) + ('D' << 8) + 'I'))
+ || model->header.magic != MD2_IDENT
+ || model->header.version != MD2_VERSION)
{
fclose(file);
free(model);
@@ -313,6 +317,7 @@ static md2_model_t *md2_readModel(const char *filename)
{ \
CONS_Alert(CONS_ERROR, "md2_readModel: %s has too many " msgname " (# found: %d, maximum: %d)\n", filename, field, max); \
md2_freeModel (model); \
+ fclose(file); \
return 0; \
}
@@ -334,6 +339,7 @@ static md2_model_t *md2_readModel(const char *filename)
fread(model->skins, sizeof (md2_skin_t), model->header.numSkins, file))
{
md2_freeModel (model);
+ fclose(file);
return 0;
}
}
@@ -347,6 +353,7 @@ static md2_model_t *md2_readModel(const char *filename)
fread(model->texCoords, sizeof (md2_textureCoordinate_t), model->header.numTexCoords, file))
{
md2_freeModel (model);
+ fclose(file);
return 0;
}
}
@@ -360,6 +367,7 @@ static md2_model_t *md2_readModel(const char *filename)
fread(model->triangles, sizeof (md2_triangle_t), model->header.numTriangles, file))
{
md2_freeModel (model);
+ fclose(file);
return 0;
}
}
@@ -372,6 +380,7 @@ static md2_model_t *md2_readModel(const char *filename)
if (!model->frames)
{
md2_freeModel (model);
+ fclose(file);
return 0;
}
@@ -385,10 +394,44 @@ static md2_model_t *md2_readModel(const char *filename)
fread(frame, 1, model->header.frameSize, file))
{
md2_freeModel (model);
+ fclose(file);
return 0;
}
strcpy(model->frames[i].name, frame->name);
+ if (frame->name[0] == 'S')
+ {
+ boolean super;
+ if ((super = (fastncmp("UPER", frame->name+1, 4))) // SUPER
+ || fastncmp("PR2_", frame->name+1, 4)) // SPR2_
+ {
+ UINT8 spr2;
+ for (spr2 = 0; spr2 < free_spr2; spr2++)
+ if (fastncmp(frame->name+5,spr2names[spr2],3)
+ && ((frame->name[8] == spr2names[spr2][3])
+ || (frame->name[8] == '.' && spr2names[spr2][3] == '_')))
+ break;
+
+ if (spr2 < free_spr2)
+ {
+ if (!model->spr2frames)
+ {
+ model->spr2frames = calloc(sizeof (size_t), 2*NUMPLAYERSPRITES*2);
+ if (!model->spr2frames)
+ {
+ md2_freeModel (model);
+ fclose(file);
+ return 0;
+ }
+ }
+ if (super)
+ spr2 |= FF_SPR2SUPER;
+ if (model->spr2frames[spr2*2 + 1]++ == 0) // numspr2frames
+ model->spr2frames[spr2*2] = i; // starting frame
+ CONS_Debug(DBG_RENDER, "frame %s, sprite2 %s - starting frame %s, number of frames %s\n", frame->name, spr2names[spr2 & ~FF_SPR2SUPER], sizeu1(model->spr2frames[spr2*2]), sizeu2(model->spr2frames[spr2*2 + 1]));
+ }
+ }
+ }
for (j = 0; j < model->header.numVertices; j++)
{
model->frames[i].vertices[j].vertex[0] = (float) ((INT32) frame->alias_vertices[j].vertex[0]) * frame->scale[0] + frame->translate[0];
@@ -410,6 +453,7 @@ static md2_model_t *md2_readModel(const char *filename)
fread(model->glCommandBuffer, sizeof (INT32), model->header.numGlCommands, file))
{
md2_freeModel (model);
+ fclose(file);
return 0;
}
}
@@ -961,244 +1005,10 @@ static void HWR_CreateBlendedTexture(GLPatch_t *gpatch, GLPatch_t *blendgpatch,
image = gpatch->mipmap.grInfo.data;
blendimage = blendgpatch->mipmap.grInfo.data;
- switch (color)
- {
- case SKINCOLOR_WHITE:
- blendcolor = V_GetColor(3);
- break;
- case SKINCOLOR_SILVER:
- blendcolor = V_GetColor(10);
- break;
- case SKINCOLOR_GREY:
- blendcolor = V_GetColor(15);
- break;
- case SKINCOLOR_BLACK:
- blendcolor = V_GetColor(27);
- break;
- case SKINCOLOR_BEIGE:
- blendcolor = V_GetColor(247);
- break;
- case SKINCOLOR_PEACH:
- blendcolor = V_GetColor(218);
- break;
- case SKINCOLOR_BROWN:
- blendcolor = V_GetColor(234);
- break;
- case SKINCOLOR_RED:
- blendcolor = V_GetColor(38);
- break;
- case SKINCOLOR_CRIMSON:
- blendcolor = V_GetColor(45);
- break;
- case SKINCOLOR_ORANGE:
- blendcolor = V_GetColor(54);
- break;
- case SKINCOLOR_RUST:
- blendcolor = V_GetColor(60);
- break;
- case SKINCOLOR_GOLD:
- blendcolor = V_GetColor(67);
- break;
- case SKINCOLOR_YELLOW:
- blendcolor = V_GetColor(73);
- break;
- case SKINCOLOR_TAN:
- blendcolor = V_GetColor(85);
- break;
- case SKINCOLOR_MOSS:
- blendcolor = V_GetColor(92);
- break;
- case SKINCOLOR_PERIDOT:
- blendcolor = V_GetColor(188);
- break;
- case SKINCOLOR_GREEN:
- blendcolor = V_GetColor(101);
- break;
- case SKINCOLOR_EMERALD:
- blendcolor = V_GetColor(112);
- break;
- case SKINCOLOR_AQUA:
- blendcolor = V_GetColor(122);
- break;
- case SKINCOLOR_TEAL:
- blendcolor = V_GetColor(141);
- break;
- case SKINCOLOR_CYAN:
- blendcolor = V_GetColor(131);
- break;
- case SKINCOLOR_BLUE:
- blendcolor = V_GetColor(152);
- break;
- case SKINCOLOR_AZURE:
- blendcolor = V_GetColor(171);
- break;
- case SKINCOLOR_PASTEL:
- blendcolor = V_GetColor(161);
- break;
- case SKINCOLOR_PURPLE:
- blendcolor = V_GetColor(165);
- break;
- case SKINCOLOR_LAVENDER:
- blendcolor = V_GetColor(195);
- break;
- case SKINCOLOR_MAGENTA:
- blendcolor = V_GetColor(183);
- break;
- case SKINCOLOR_PINK:
- blendcolor = V_GetColor(211);
- break;
- case SKINCOLOR_ROSY:
- blendcolor = V_GetColor(202);
- break;
-
- case SKINCOLOR_SUPERSILVER1: // Super silver
- blendcolor = V_GetColor(0);
- break;
- case SKINCOLOR_SUPERSILVER2:
- blendcolor = V_GetColor(2);
- break;
- case SKINCOLOR_SUPERSILVER3:
- blendcolor = V_GetColor(4);
- break;
- case SKINCOLOR_SUPERSILVER4:
- blendcolor = V_GetColor(7);
- break;
- case SKINCOLOR_SUPERSILVER5:
- blendcolor = V_GetColor(10);
- break;
-
- case SKINCOLOR_SUPERRED1: // Super red
- blendcolor = V_GetColor(208);
- break;
- case SKINCOLOR_SUPERRED2:
- blendcolor = V_GetColor(210);
- break;
- case SKINCOLOR_SUPERRED3:
- blendcolor = V_GetColor(32);
- break;
- case SKINCOLOR_SUPERRED4:
- blendcolor = V_GetColor(33);
- break;
- case SKINCOLOR_SUPERRED5:
- blendcolor = V_GetColor(35);
- break;
-
- case SKINCOLOR_SUPERORANGE1: // Super orange
- blendcolor = V_GetColor(208);
- break;
- case SKINCOLOR_SUPERORANGE2:
- blendcolor = V_GetColor(48);
- break;
- case SKINCOLOR_SUPERORANGE3:
- blendcolor = V_GetColor(50);
- break;
- case SKINCOLOR_SUPERORANGE4:
- blendcolor = V_GetColor(54);
- break;
- case SKINCOLOR_SUPERORANGE5:
- blendcolor = V_GetColor(58);
- break;
-
- case SKINCOLOR_SUPERGOLD1: // Super gold
- blendcolor = V_GetColor(80);
- break;
- case SKINCOLOR_SUPERGOLD2:
- blendcolor = V_GetColor(83);
- break;
- case SKINCOLOR_SUPERGOLD3:
- blendcolor = V_GetColor(73);
- break;
- case SKINCOLOR_SUPERGOLD4:
- blendcolor = V_GetColor(64);
- break;
- case SKINCOLOR_SUPERGOLD5:
- blendcolor = V_GetColor(67);
- break;
-
- case SKINCOLOR_SUPERPERIDOT1: // Super peridot
- blendcolor = V_GetColor(88);
- break;
- case SKINCOLOR_SUPERPERIDOT2:
- blendcolor = V_GetColor(188);
- break;
- case SKINCOLOR_SUPERPERIDOT3:
- blendcolor = V_GetColor(189);
- break;
- case SKINCOLOR_SUPERPERIDOT4:
- blendcolor = V_GetColor(190);
- break;
- case SKINCOLOR_SUPERPERIDOT5:
- blendcolor = V_GetColor(191);
- break;
-
- case SKINCOLOR_SUPERCYAN1: // Super cyan
- blendcolor = V_GetColor(128);
- break;
- case SKINCOLOR_SUPERCYAN2:
- blendcolor = V_GetColor(131);
- break;
- case SKINCOLOR_SUPERCYAN3:
- blendcolor = V_GetColor(133);
- break;
- case SKINCOLOR_SUPERCYAN4:
- blendcolor = V_GetColor(134);
- break;
- case SKINCOLOR_SUPERCYAN5:
- blendcolor = V_GetColor(136);
- break;
-
- case SKINCOLOR_SUPERPURPLE1: // Super purple
- blendcolor = V_GetColor(144);
- break;
- case SKINCOLOR_SUPERPURPLE2:
- blendcolor = V_GetColor(162);
- break;
- case SKINCOLOR_SUPERPURPLE3:
- blendcolor = V_GetColor(164);
- break;
- case SKINCOLOR_SUPERPURPLE4:
- blendcolor = V_GetColor(166);
- break;
- case SKINCOLOR_SUPERPURPLE5:
- blendcolor = V_GetColor(168);
- break;
-
- case SKINCOLOR_SUPERRUST1: // Super rust
- blendcolor = V_GetColor(51);
- break;
- case SKINCOLOR_SUPERRUST2:
- blendcolor = V_GetColor(54);
- break;
- case SKINCOLOR_SUPERRUST3:
- blendcolor = V_GetColor(68);
- break;
- case SKINCOLOR_SUPERRUST4:
- blendcolor = V_GetColor(70);
- break;
- case SKINCOLOR_SUPERRUST5:
- blendcolor = V_GetColor(234);
- break;
-
- case SKINCOLOR_SUPERTAN1: // Super tan
- blendcolor = V_GetColor(80);
- break;
- case SKINCOLOR_SUPERTAN2:
- blendcolor = V_GetColor(82);
- break;
- case SKINCOLOR_SUPERTAN3:
- blendcolor = V_GetColor(84);
- break;
- case SKINCOLOR_SUPERTAN4:
- blendcolor = V_GetColor(87);
- break;
- case SKINCOLOR_SUPERTAN5:
- blendcolor = V_GetColor(247);
- break;
-
- default:
- blendcolor = V_GetColor(255);
- break;
- }
+ if (color == SKINCOLOR_NONE || color >= MAXTRANSLATIONS)
+ blendcolor = V_GetColor(0xff);
+ else
+ blendcolor = V_GetColor(Color_Index[color-1][4]);
while (size--)
{
@@ -1305,6 +1115,51 @@ static void HWR_GetBlendedTexture(GLPatch_t *gpatch, GLPatch_t *blendgpatch, con
res?
run?
*/
+
+static UINT8 P_GetModelSprite2(md2_t *md2, skin_t *skin, UINT8 spr2, player_t *player)
+{
+ UINT8 super = 0, i = 0;
+
+ if (!md2 || !skin)
+ return 0;
+
+ while (!(md2->model->spr2frames[spr2*2 + 1])
+ && spr2 != SPR2_STND
+ && ++i != 32) // recursion limiter
+ {
+ if (spr2 & FF_SPR2SUPER)
+ {
+ super = FF_SPR2SUPER;
+ spr2 &= ~FF_SPR2SUPER;
+ continue;
+ }
+
+ switch(spr2)
+ {
+
+ // Normal special cases.
+ case SPR2_JUMP:
+ spr2 = ((player
+ ? player->charflags
+ : skin->flags)
+ & SF_NOJUMPSPIN) ? SPR2_SPNG : SPR2_ROLL;
+ break;
+ case SPR2_TIRE:
+ spr2 = (player && player->charability == CA_SWIM) ? SPR2_SWIM : SPR2_FLY;
+ break;
+
+ // Use the handy list, that's what it's there for!
+ default:
+ spr2 = spr2defaults[spr2];
+ break;
+ }
+
+ spr2 |= super;
+ }
+
+ return spr2;
+}
+
#define NORMALFOG 0x00000000
#define FADEFOG 0x19000000
void HWR_DrawMD2(gr_vissprite_t *spr)
@@ -1452,31 +1307,70 @@ void HWR_DrawMD2(gr_vissprite_t *spr)
tics = spr->mobj->anim_duration;
}
- //FIXME: this is not yet correct
- frame = (spr->mobj->frame & FF_FRAMEMASK) % md2->model->header.numFrames;
- buff = md2->model->glCommandBuffer;
- curr = &md2->model->frames[frame];
- if (cv_grmd2.value == 1)
+#define INTERPOLERATION_LIMIT TICRATE/4
+
+ if (spr->mobj->skin && spr->mobj->sprite == SPR_PLAY && md2->model->spr2frames)
{
- // frames are handled differently for states with FF_ANIMATE, so get the next frame differently for the interpolation
- if (spr->mobj->frame & FF_ANIMATE)
+ UINT8 spr2 = P_GetModelSprite2(md2, spr->mobj->skin, spr->mobj->sprite2, spr->mobj->player);
+ UINT8 mod = md2->model->spr2frames[spr2*2 + 1] ? md2->model->spr2frames[spr2*2 + 1] : md2->model->header.numFrames;
+ if (mod > ((skin_t *)spr->mobj->skin)->sprites[spr2].numframes)
+ mod = ((skin_t *)spr->mobj->skin)->sprites[spr2].numframes;
+ //FIXME: this is not yet correct
+ frame = (spr->mobj->frame & FF_FRAMEMASK);
+ if (frame >= mod)
+ frame = 0;
+ buff = md2->model->glCommandBuffer;
+ curr = &md2->model->frames[md2->model->spr2frames[spr2*2] + frame];
+ if (cv_grmd2.value == 1 && tics <= INTERPOLERATION_LIMIT)
{
- UINT32 nextframe = (spr->mobj->frame & FF_FRAMEMASK) + 1;
- if (nextframe >= (UINT32)spr->mobj->state->var1)
- nextframe = (spr->mobj->state->frame & FF_FRAMEMASK);
- nextframe %= md2->model->header.numFrames;
- next = &md2->model->frames[nextframe];
- }
- else
- {
- if (spr->mobj->state->nextstate != S_NULL && states[spr->mobj->state->nextstate].sprite != SPR_NULL
- && !(spr->mobj->player && spr->mobj->state->nextstate == S_PLAY_WAIT && spr->mobj->state == &states[S_PLAY_STND]))
+ if (durs > INTERPOLERATION_LIMIT)
+ durs = INTERPOLERATION_LIMIT;
+
+ if (spr->mobj->frame & FF_ANIMATE
+ || (spr->mobj->state->nextstate != S_NULL
+ && states[spr->mobj->state->nextstate].sprite == spr->mobj->sprite
+ && (states[spr->mobj->state->nextstate].frame & FF_FRAMEMASK) == spr->mobj->sprite2))
{
- const UINT32 nextframe = (states[spr->mobj->state->nextstate].frame & FF_FRAMEMASK) % md2->model->header.numFrames;
- next = &md2->model->frames[nextframe];
+ if (++frame >= mod)
+ frame = 0;
+ if (frame || !(spr->mobj->state->frame & FF_SPR2ENDSTATE))
+ next = &md2->model->frames[md2->model->spr2frames[spr2*2] + frame];
}
}
}
+ else
+ {
+ //FIXME: this is not yet correct
+ frame = (spr->mobj->frame & FF_FRAMEMASK) % md2->model->header.numFrames;
+ buff = md2->model->glCommandBuffer;
+ curr = &md2->model->frames[frame];
+ if (cv_grmd2.value == 1 && tics <= INTERPOLERATION_LIMIT)
+ {
+ if (durs > INTERPOLERATION_LIMIT)
+ durs = INTERPOLERATION_LIMIT;
+
+ // frames are handled differently for states with FF_ANIMATE, so get the next frame differently for the interpolation
+ if (spr->mobj->frame & FF_ANIMATE)
+ {
+ UINT32 nextframe = (spr->mobj->frame & FF_FRAMEMASK) + 1;
+ if (nextframe >= (UINT32)spr->mobj->state->var1)
+ nextframe = (spr->mobj->state->frame & FF_FRAMEMASK);
+ nextframe %= md2->model->header.numFrames;
+ next = &md2->model->frames[nextframe];
+ }
+ else
+ {
+ if (spr->mobj->state->nextstate != S_NULL
+ && states[spr->mobj->state->nextstate].sprite == spr->mobj->sprite)
+ {
+ const UINT32 nextframe = (states[spr->mobj->state->nextstate].frame & FF_FRAMEMASK) % md2->model->header.numFrames;
+ next = &md2->model->frames[nextframe];
+ }
+ }
+ }
+ }
+
+#undef INTERPOLERATION_LIMIT
//Hurdler: it seems there is still a small problem with mobj angle
p.x = FIXED_TO_FLOAT(spr->mobj->x);
@@ -1496,7 +1390,7 @@ void HWR_DrawMD2(gr_vissprite_t *spr)
if (sprframe->rotate)
{
- const fixed_t anglef = AngleFixed(spr->mobj->angle);
+ const fixed_t anglef = AngleFixed((spr->mobj->player ? spr->mobj->player->drawangle : spr->mobj->angle));
p.angley = FIXED_TO_FLOAT(anglef);
}
else
diff --git a/src/hardware/hw_md2.h b/src/hardware/hw_md2.h
index 5a7e6d2b3..c7cda35af 100644
--- a/src/hardware/hw_md2.h
+++ b/src/hardware/hw_md2.h
@@ -22,6 +22,12 @@
#define _HW_MD2_H_
#include "hw_glob.h"
+#include "../info.h"
+
+// magic number "IDP2" or 844121161
+#define MD2_IDENT (INT32)(('2' << 24) + ('P' << 16) + ('D' << 8) + 'I')
+// model version
+#define MD2_VERSION 8
#define MD2_MAX_TRIANGLES 8192
#define MD2_MAX_VERTICES 4096
@@ -106,7 +112,8 @@ typedef struct
md2_textureCoordinate_t *texCoords;
md2_triangle_t *triangles;
md2_frame_t *frames;
- INT32 *glCommandBuffer;
+ size_t *spr2frames; // size_t spr2frames[2*NUMPLAYERSPRITES][2];
+ INT32 *glCommandBuffer;
} ATTRPACK md2_model_t;
#if defined(_MSC_VER)
diff --git a/src/hardware/hw_trick.c b/src/hardware/hw_trick.c
index e9ba19efb..97d86b944 100644
--- a/src/hardware/hw_trick.c
+++ b/src/hardware/hw_trick.c
@@ -107,17 +107,17 @@ static void releaseLineChains(void)
for (i = 0; i < numsectors; i++)
{
- sector = §ors[i];
- nextElem = sector->sectorLines;
+ sector = §ors[i];
+ nextElem = sector->sectorLines;
- while (nextElem)
- {
- thisElem = nextElem;
- nextElem = thisElem->next;
- free(thisElem);
- }
+ while (nextElem)
+ {
+ thisElem = nextElem;
+ nextElem = thisElem->next;
+ free(thisElem);
+ }
- sector->sectorLines = NULL;
+ sector->sectorLines = NULL;
}
}
@@ -397,7 +397,7 @@ static void sortStacklist(sector_t *sector)
i = 0;
finished = true;
- while (NULL != *(list+i+1))
+ while (*(list+i+1))
{
sec1 = *(list+i);
sec2 = *(list+i+1);
@@ -438,7 +438,7 @@ static double calcLineoutLength(sector_t *sector)
double length = 0.0L;
chain = sector->sectorLines;
- while (NULL != chain) // sum up lengths of all lines
+ while (chain) // sum up lengths of all lines
{
length += lineLength(chain->line);
chain = chain->next;
@@ -454,7 +454,7 @@ static void calcLineouts(sector_t *sector)
size_t secCount = 0;
sector_t *encSector = *(sector->stackList);
- while (NULL != encSector)
+ while (encSector)
{
if (encSector->lineoutLength < 0.0L) // if length has not yet been calculated
{
@@ -552,7 +552,7 @@ static boolean areBottomtexturesMissing(sector_t *thisSector)
if (frontSector == backSector) // skip damn renderer tricks here
continue;
- if (frontSector == NULL || backSector == NULL)
+ if (!frontSector || !backSector)
continue;
sider = &sides[thisElem->line->sidenum[0]];
@@ -587,73 +587,12 @@ static boolean areBottomtexturesMissing(sector_t *thisSector)
static boolean isCeilingFloating(sector_t *thisSector)
{
sector_t *adjSector, *refSector = NULL, *frontSector, *backSector;
- boolean floating = true;
linechain_t *thisElem, *nextElem;
if (!thisSector)
return false;
- nextElem = thisSector->sectorLines;
-
- while (NULL != nextElem) // walk through chain
- {
- thisElem = nextElem;
- nextElem = thisElem->next;
-
- frontSector = thisElem->line->frontsector;
- backSector = thisElem->line->backsector;
-
- if (frontSector == thisSector)
- adjSector = backSector;
- else
- adjSector = frontSector;
-
- if (!adjSector) // assume floating sectors have surrounding sectors
- {
- floating = false;
- break;
- }
-
- if (!refSector)
- {
- refSector = adjSector;
- continue;
- }
-
- // if adjacent sector has same height or more than one adjacent sector exists -> stop
- if (thisSector->ceilingheight == adjSector->ceilingheight ||
- refSector != adjSector)
- {
- floating = false;
- break;
- }
- }
-
- // now check for walltextures
- if (floating)
- {
- if (!areToptexturesMissing(thisSector))
- {
- floating = false;
- }
- }
- return floating;
-}
-
-//
-// check if no adjacent sector has same ceiling height
-// FIXME: throw that together with isCeilingFloating??
-//
-static boolean isFloorFloating(sector_t *thisSector)
-{
- sector_t *adjSector, *refSector = NULL, *frontSector, *backSector;
- boolean floating = true;
- linechain_t *thisElem, *nextElem;
-
- if (!thisSector)
- return false;
-
- nextElem = thisSector->sectorLines;
+ nextElem = thisSector->sectorLines;
while (nextElem) // walk through chain
{
@@ -668,36 +607,83 @@ static boolean isFloorFloating(sector_t *thisSector)
else
adjSector = frontSector;
- if (NULL == adjSector) // assume floating sectors have surrounding sectors
- {
- floating = false;
- break;
- }
+ if (!adjSector) // assume floating sectors have surrounding sectors
+ return false;
- if (NULL == refSector)
+#ifdef ESLOPE
+ if (adjSector->c_slope) // Don't bother with slopes
+ return false;
+#endif
+
+ if (!refSector)
{
refSector = adjSector;
continue;
}
// if adjacent sector has same height or more than one adjacent sector exists -> stop
- if (thisSector->floorheight == adjSector->floorheight ||
- refSector != adjSector)
- {
- floating = false;
- break;
- }
+ if (thisSector->ceilingheight == adjSector->ceilingheight || refSector != adjSector)
+ return false;
}
// now check for walltextures
- if (floating)
+ if (!areToptexturesMissing(thisSector))
+ return false;
+
+ return true;
+}
+
+//
+// check if no adjacent sector has same ceiling height
+// FIXME: throw that together with isCeilingFloating??
+//
+static boolean isFloorFloating(sector_t *thisSector)
+{
+ sector_t *adjSector, *refSector = NULL, *frontSector, *backSector;
+ linechain_t *thisElem, *nextElem;
+
+ if (!thisSector)
+ return false;
+
+ nextElem = thisSector->sectorLines;
+
+ while (nextElem) // walk through chain
{
- if (!areBottomtexturesMissing(thisSector))
+ thisElem = nextElem;
+ nextElem = thisElem->next;
+
+ frontSector = thisElem->line->frontsector;
+ backSector = thisElem->line->backsector;
+
+ if (frontSector == thisSector)
+ adjSector = backSector;
+ else
+ adjSector = frontSector;
+
+ if (!adjSector) // assume floating sectors have surrounding sectors
+ return false;
+
+#ifdef ESLOPE
+ if (adjSector->f_slope) // Don't bother with slopes
+ return false;
+#endif
+
+ if (!refSector)
{
- floating = false;
+ refSector = adjSector;
+ continue;
}
+
+ // if adjacent sector has same height or more than one adjacent sector exists -> stop
+ if (thisSector->floorheight == adjSector->floorheight || refSector != adjSector)
+ return false;
}
- return floating;
+
+ // now check for walltextures
+ if (!areBottomtexturesMissing(thisSector))
+ return false;
+
+ return true;
}
//
@@ -707,14 +693,12 @@ static fixed_t estimateCeilHeight(sector_t *thisSector)
{
sector_t *adjSector;
- if (!thisSector ||
- !thisSector->sectorLines ||
- !thisSector->sectorLines->line)
+ if (!thisSector || !thisSector->sectorLines || !thisSector->sectorLines->line)
return 0;
adjSector = thisSector->sectorLines->line->frontsector;
if (adjSector == thisSector)
- adjSector = thisSector->sectorLines->line->backsector;
+ adjSector = thisSector->sectorLines->line->backsector;
if (!adjSector)
return 0;
@@ -729,17 +713,15 @@ static fixed_t estimateFloorHeight(sector_t *thisSector)
{
sector_t *adjSector;
- if (!thisSector ||
- !thisSector->sectorLines ||
- !thisSector->sectorLines->line)
- return 0;
+ if (!thisSector || !thisSector->sectorLines || !thisSector->sectorLines->line)
+ return 0;
adjSector = thisSector->sectorLines->line->frontsector;
if (adjSector == thisSector)
- adjSector = thisSector->sectorLines->line->backsector;
+ adjSector = thisSector->sectorLines->line->backsector;
- if (NULL == adjSector)
- return 0;
+ if (!adjSector)
+ return 0;
return adjSector->floorheight;
}
@@ -845,18 +827,12 @@ void HWR_CorrectSWTricks(void)
// correct height of floating sectors
if (isCeilingFloating(floatSector))
{
- fixed_t corrheight;
-
- corrheight = estimateCeilHeight(floatSector);
- floatSector->virtualCeilingheight = corrheight;
+ floatSector->virtualCeilingheight = estimateCeilHeight(floatSector);
floatSector->virtualCeiling = true;
}
if (isFloorFloating(floatSector))
{
- fixed_t corrheight;
-
- corrheight = estimateFloorHeight(floatSector);
- floatSector->virtualFloorheight = corrheight;
+ floatSector->virtualFloorheight = estimateFloorHeight(floatSector);
floatSector->virtualFloor = true;
}
}
diff --git a/src/hardware/hws_data.h b/src/hardware/hws_data.h
index 9e2d0547e..b890d976b 100644
--- a/src/hardware/hws_data.h
+++ b/src/hardware/hws_data.h
@@ -114,7 +114,7 @@ typedef struct snddev_s
size_t numsfxs;
// Windows specific data
-#if defined (_WIN32) && !defined (_XBOX)
+#ifdef _WIN32
UINT32 cooplevel;
HWND hWnd;
#endif
diff --git a/src/hardware/r_minigl/r_minigl.c b/src/hardware/r_minigl/r_minigl.c
deleted file mode 100644
index b2482a552..000000000
--- a/src/hardware/r_minigl/r_minigl.c
+++ /dev/null
@@ -1,33 +0,0 @@
-// Emacs style mode select -*- C++ -*-
-//-----------------------------------------------------------------------------
-//
-// Copyright (C) 1998-2000 by DooM Legacy Team.
-//
-// This program is free software; you can redistribute it and/or
-// modify it under the terms of the GNU General Public License
-// as published by the Free Software Foundation; either version 2
-// of the License, or (at your option) any later version.
-//
-// This program is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-// GNU General Public License for more details.
-//-----------------------------------------------------------------------------
-/// \file
-/// \brief MiniGL API for Doom Legacy
-
-
-// tell r_opengl.cpp to compile for MiniGL Drivers
-#define MINI_GL_COMPATIBILITY
-
-// tell r_opengl.cpp to compile for ATI Rage Pro OpenGL driver
-//#define ATI_RAGE_PRO_COMPATIBILITY
-
-#define DRIVER_STRING "HWRAPI Init(): SRB2 MiniGL renderer"
-
-// Include this at end
-#include "../r_opengl/r_opengl.c"
-#include "../r_opengl/ogl_win.c"
-
-// That's all ;-)
-// Just, be sure to do the right changes in r_opengl.cpp
diff --git a/src/hardware/r_minigl/r_minigl.dev b/src/hardware/r_minigl/r_minigl.dev
deleted file mode 100644
index edf725ac5..000000000
--- a/src/hardware/r_minigl/r_minigl.dev
+++ /dev/null
@@ -1,89 +0,0 @@
-[Project]
-FileName=r_minigl.dev
-Name=r_minigl
-Ver=1
-IsCpp=1
-Type=3
-Compiler=-D_M_IX86=500_@@_-Wall_@@_-D_WINDOWS_@@_-DUSE_WGL_SWAP_@@_-Os_@@_-fomit-frame-pointer_@@_
-CppCompiler=
-Includes=
-Linker=--def ../r_mingw.def_@@_-lgdi32_@@_
-Libs=
-UnitCount=4
-Folders=
-ObjFiles=
-PrivateResource=
-ResourceIncludes=
-MakeIncludes=
-Icon=
-ExeOutput=C:\srb2demo2
-ObjectOutput=..\..\..\objs\Mingw\r_minigl
-OverrideOutput=1
-OverrideOutputName=r_minigl.dll
-HostApplication=
-CommandLine=
-IncludeVersionInfo=0
-SupportXPThemes=0
-CompilerSet=0
-CompilerSettings=00000000000000000111d0
-UseCustomMakefile=0
-CustomMakefile=
-
-[Unit1]
-FileName=..\r_opengl\ogl_win.c
-Folder=
-Compile=0
-CompileCpp=0
-Link=0
-Priority=1000
-OverrideBuildCmd=0
-BuildCmd=$(CC) -c ogl_win.c -o ../../../objs/Mingw/r_minigl/ogl_win.o $(CFLAGS)
-
-[Unit2]
-FileName=..\r_opengl\r_opengl.c
-Folder=
-Compile=0
-CompileCpp=0
-Link=0
-Priority=1000
-OverrideBuildCmd=0
-BuildCmd=$(CC) -c r_opengl.c -o ../../../objs/Mingw/r_minigl/r_opengl.o $(CFLAGS)
-
-[Unit3]
-FileName=..\r_opengl\r_opengl.h
-Folder=
-Compile=1
-CompileCpp=1
-Link=1
-Priority=1000
-OverrideBuildCmd=0
-BuildCmd=
-
-[VersionInfo]
-Major=0
-Minor=1
-Release=1
-Build=1
-LanguageID=1033
-CharsetID=1252
-CompanyName=
-FileVersion=0.1
-FileDescription=Developed using the Dev-C++ IDE
-InternalName=
-LegalCopyright=
-LegalTrademarks=
-OriginalFilename=r_opengl.exe
-ProductName=r_opengl
-ProductVersion=0.1
-AutoIncBuildNr=0
-
-[Unit4]
-FileName=r_minigl.c
-CompileCpp=0
-Folder=r_minigl
-Compile=1
-Link=1
-Priority=1000
-OverrideBuildCmd=0
-BuildCmd=$(CC) -c r_minigl.c -o ../../../objs/Mingw/r_minigl/r_minigl.o $(CFLAGS)
-
diff --git a/src/hardware/r_minigl/r_minigl.dsp b/src/hardware/r_minigl/r_minigl.dsp
deleted file mode 100644
index 686ca35a3..000000000
--- a/src/hardware/r_minigl/r_minigl.dsp
+++ /dev/null
@@ -1,103 +0,0 @@
-# Microsoft Developer Studio Project File - Name="r_minigl" - Package Owner=<4>
-# Microsoft Developer Studio Generated Build File, Format Version 6.00
-# ** DO NOT EDIT **
-
-# TARGTYPE "Win32 (x86) Dynamic-Link Library" 0x0102
-
-CFG=r_minigl - Win32 Debug
-!MESSAGE This is not a valid makefile. To build this project using NMAKE,
-!MESSAGE use the Export Makefile command and run
-!MESSAGE
-!MESSAGE NMAKE /f "r_minigl.mak".
-!MESSAGE
-!MESSAGE You can specify a configuration when running NMAKE
-!MESSAGE by defining the macro CFG on the command line. For example:
-!MESSAGE
-!MESSAGE NMAKE /f "r_minigl.mak" CFG="r_minigl - Win32 Debug"
-!MESSAGE
-!MESSAGE Possible choices for configuration are:
-!MESSAGE
-!MESSAGE "r_minigl - Win32 Release" (based on "Win32 (x86) Dynamic-Link Library")
-!MESSAGE "r_minigl - Win32 Debug" (based on "Win32 (x86) Dynamic-Link Library")
-!MESSAGE
-
-# Begin Project
-# PROP AllowPerConfigDependencies 0
-# PROP Scc_ProjName ""
-# PROP Scc_LocalPath ""
-CPP=cl.exe
-MTL=midl.exe
-RSC=rc.exe
-
-!IF "$(CFG)" == "r_minigl - Win32 Release"
-
-# PROP BASE Use_MFC 0
-# PROP BASE Use_Debug_Libraries 0
-# PROP BASE Output_Dir "..\..\..\objs\Release"
-# PROP BASE Intermediate_Dir "..\..\..\objs\Release"
-# PROP BASE Target_Dir ""
-# PROP Use_MFC 0
-# PROP Use_Debug_Libraries 0
-# PROP Output_Dir "..\..\..\bin\VC\Release\r_minigl"
-# PROP Intermediate_Dir "..\..\..\objs\VC\Release\r_minigl"
-# PROP Ignore_Export_Lib 1
-# PROP Target_Dir ""
-# ADD BASE CPP /nologo /MT /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "R_MINIGL_EXPORTS" /YX /FD /c
-# ADD CPP /nologo /G5 /MT /W3 /GX /Zi /O2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "__WIN32__" /D "__MSC__" /FR /FD /c
-# SUBTRACT CPP /YX
-# ADD BASE MTL /nologo /D "NDEBUG" /mktyplib203 /win32
-# ADD MTL /nologo /D "NDEBUG" /mktyplib203 /win32
-# ADD BASE RSC /l 0x80c /d "NDEBUG"
-# ADD RSC /l 0x40c /d "NDEBUG"
-BSC32=bscmake.exe
-# ADD BASE BSC32 /nologo
-# ADD BSC32 /nologo
-LINK32=link.exe
-# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /machine:I386
-# ADD LINK32 user32.lib gdi32.lib /nologo /dll /pdb:"..\..\..\bin\VC\Release\r_minigl.pdb" /machine:I386 /out:"..\..\..\bin\VC\Release\r_minigl.dll"
-# SUBTRACT LINK32 /pdb:none /debug
-
-!ELSEIF "$(CFG)" == "r_minigl - Win32 Debug"
-
-# PROP BASE Use_MFC 0
-# PROP BASE Use_Debug_Libraries 1
-# PROP BASE Output_Dir "..\..\..\objs\Debug"
-# PROP BASE Intermediate_Dir "..\..\..\objs\Debug"
-# PROP BASE Target_Dir ""
-# PROP Use_MFC 0
-# PROP Use_Debug_Libraries 1
-# PROP Output_Dir "..\..\..\bin\VC\Debug\r_minigl"
-# PROP Intermediate_Dir "..\..\..\objs\VC\Debug\r_minigl"
-# PROP Ignore_Export_Lib 1
-# PROP Target_Dir ""
-# ADD BASE CPP /nologo /MTd /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "R_MINIGL_EXPORTS" /YX /FD /GZ /c
-# ADD CPP /nologo /MTd /W4 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "__WIN32__" /D "__MSC__" /D "_MBCS" /D "_USRDLL" /D "R_MINIGL_EXPORTS" /FR /FD /GZ /c
-# SUBTRACT CPP /YX
-# ADD BASE MTL /nologo /D "_DEBUG" /mktyplib203 /win32
-# ADD MTL /nologo /D "_DEBUG" /mktyplib203 /win32
-# ADD BASE RSC /l 0x80c /d "_DEBUG"
-# ADD RSC /l 0x40c /d "_DEBUG"
-BSC32=bscmake.exe
-# ADD BASE BSC32 /nologo
-# ADD BSC32 /nologo
-LINK32=link.exe
-# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /debug /machine:I386 /pdbtype:sept
-# ADD LINK32 ouser32.lib gdi32.lib /nologo /dll /pdb:"..\..\..\bin\VC\Debug\r_minigl.pdb" /debug /machine:I386 /out:"..\..\..\bin\VC\Debug\r_minigl.dll" /pdbtype:sept
-# SUBTRACT LINK32 /pdb:none
-
-!ENDIF
-
-# Begin Target
-
-# Name "r_minigl - Win32 Release"
-# Name "r_minigl - Win32 Debug"
-# Begin Source File
-
-SOURCE=.\r_minigl.c
-# End Source File
-# Begin Source File
-
-SOURCE=..\r_opengl\r_opengl.h
-# End Source File
-# End Target
-# End Project
diff --git a/src/hardware/r_opengl/r_opengl.c b/src/hardware/r_opengl/r_opengl.c
index e6ff83e89..bd1cd95eb 100644
--- a/src/hardware/r_opengl/r_opengl.c
+++ b/src/hardware/r_opengl/r_opengl.c
@@ -30,10 +30,8 @@
#include
#include
#ifndef SHUFFLE
-#ifndef KOS_GL_COMPATIBILITY
#define SHUFFLE
#endif
-#endif
#include "r_opengl.h"
#if defined (HWRENDER) && !defined (NOROPENGL)
@@ -83,9 +81,7 @@ GLint screen_height = 0;
GLbyte screen_depth = 0;
GLint textureformatGL = 0;
GLint maximumAnisotropy = 0;
-#ifndef KOS_GL_COMPATIBILITY
static GLboolean MipMap = GL_FALSE;
-#endif
static GLint min_filter = GL_LINEAR;
static GLint mag_filter = GL_LINEAR;
static GLint anisotropic_filter = 0;
@@ -94,11 +90,9 @@ static FTransform md2_transform;
const GLubyte *gl_extensions = NULL;
//Hurdler: 04/10/2000: added for the kick ass coronas as Boris wanted;-)
-#ifndef MINI_GL_COMPATIBILITY
static GLdouble modelMatrix[16];
static GLdouble projMatrix[16];
static GLint viewport[4];
-#endif
#ifdef USE_PALETTED_TEXTURE
@@ -158,9 +152,7 @@ float byteasfloat(UINT8 fbyte)
static I_Error_t I_Error_GL = NULL;
-#ifndef MINI_GL_COMPATIBILITY
static boolean gl13 = false; // whether we can use opengl 1.3 functions
-#endif
// -----------------+
@@ -198,14 +190,9 @@ FUNCPRINTF void DBG_Printf(const char *lpFmt, ...)
#define pglScissor glScissor
#define pglEnable glEnable
#define pglDisable glDisable
-#ifndef MINI_GL_COMPATIBILITY
#define pglGetDoublev glGetDoublev
-#endif
//glGetIntegerv
//glGetString
-#ifdef KOS_GL_COMPATIBILITY
-#define pglHint glHint
-#endif
/* Depth Buffer */
#define pglClearDepth glClearDepth
@@ -219,11 +206,7 @@ FUNCPRINTF void DBG_Printf(const char *lpFmt, ...)
#define pglPushMatrix glPushMatrix
#define pglPopMatrix glPopMatrix
#define pglLoadIdentity glLoadIdentity
-#ifdef MINI_GL_COMPATIBILITY
-#define pglMultMatrixf glMultMatrixf
-#else
#define pglMultMatrixd glMultMatrixd
-#endif
#define pglRotatef glRotatef
#define pglScalef glScalef
#define pglTranslatef glTranslatef
@@ -261,9 +244,7 @@ FUNCPRINTF void DBG_Printf(const char *lpFmt, ...)
#define pglDeleteTextures glDeleteTextures
#define pglBindTexture glBindTexture
/* texture mapping */ //GL_EXT_copy_texture
-#ifndef KOS_GL_COMPATIBILITY
#define pglCopyTexImage2D glCopyTexImage2D
-#endif
#else //!STATIC_OPENGL
@@ -290,10 +271,8 @@ typedef void (APIENTRY * PFNglEnable) (GLenum cap);
static PFNglEnable pglEnable;
typedef void (APIENTRY * PFNglDisable) (GLenum cap);
static PFNglDisable pglDisable;
-#ifndef MINI_GL_COMPATIBILITY
typedef void (APIENTRY * PFNglGetDoublev) (GLenum pname, GLdouble *params);
static PFNglGetDoublev pglGetDoublev;
-#endif
//glGetIntegerv
//glGetString
@@ -318,13 +297,8 @@ typedef void (APIENTRY * PFNglPopMatrix) (void);
static PFNglPopMatrix pglPopMatrix;
typedef void (APIENTRY * PFNglLoadIdentity) (void);
static PFNglLoadIdentity pglLoadIdentity;
-#ifdef MINI_GL_COMPATIBILITY
-typedef void (APIENTRY * PFNglMultMatrixf) (const GLfloat *m);
-static PFNglMultMatrixf pglMultMatrixf;
-#else
typedef void (APIENTRY * PFNglMultMatrixd) (const GLdouble *m);
static PFNglMultMatrixd pglMultMatrixd;
-#endif
typedef void (APIENTRY * PFNglRotatef) (GLfloat angle, GLfloat x, GLfloat y, GLfloat z);
static PFNglRotatef pglRotatef;
typedef void (APIENTRY * PFNglScalef) (GLfloat x, GLfloat y, GLfloat z);
@@ -392,15 +366,12 @@ static PFNglCopyTexImage2D pglCopyTexImage2D;
typedef GLint (APIENTRY * PFNgluBuild2DMipmaps) (GLenum target, GLint internalFormat, GLsizei width, GLsizei height, GLenum format, GLenum type, const void *data);
static PFNgluBuild2DMipmaps pgluBuild2DMipmaps;
-#ifndef MINI_GL_COMPATIBILITY
/* 1.3 functions for multitexturing */
typedef void (APIENTRY *PFNglActiveTexture) (GLenum);
static PFNglActiveTexture pglActiveTexture;
typedef void (APIENTRY *PFNglMultiTexCoord2f) (GLenum, GLfloat, GLfloat);
static PFNglMultiTexCoord2f pglMultiTexCoord2f;
-#endif
-#ifndef MINI_GL_COMPATIBILITY
/* 1.2 Parms */
/* GL_CLAMP_TO_EDGE_EXT */
#ifndef GL_CLAMP_TO_EDGE
@@ -421,14 +392,6 @@ static PFNglMultiTexCoord2f pglMultiTexCoord2f;
#define GL_TEXTURE1 0x84C1
#endif
-#endif
-
-#ifdef MINI_GL_COMPATIBILITY
-#undef GL_CLAMP_TO_EDGE
-#undef GL_TEXTURE_MIN_LOD
-#undef GL_TEXTURE_MAX_LOD
-#endif
-
boolean SetupGLfunc(void)
{
#ifndef STATIC_OPENGL
@@ -451,9 +414,7 @@ boolean SetupGLfunc(void)
GETOPENGLFUNC(pglScissor , glScissor)
GETOPENGLFUNC(pglEnable , glEnable)
GETOPENGLFUNC(pglDisable , glDisable)
-#ifndef MINI_GL_COMPATIBILITY
GETOPENGLFUNC(pglGetDoublev , glGetDoublev)
-#endif
GETOPENGLFUNC(pglGetIntegerv , glGetIntegerv)
GETOPENGLFUNC(pglGetString , glGetString)
@@ -467,11 +428,7 @@ boolean SetupGLfunc(void)
GETOPENGLFUNC(pglPushMatrix , glPushMatrix)
GETOPENGLFUNC(pglPopMatrix , glPopMatrix)
GETOPENGLFUNC(pglLoadIdentity , glLoadIdentity)
-#ifdef MINI_GL_COMPATIBILITY
- GETOPENGLFUNC(pglMultMatrixf , glMultMatrixf)
-#else
GETOPENGLFUNC(pglMultMatrixd , glMultMatrixd)
-#endif
GETOPENGLFUNC(pglRotatef , glRotatef)
GETOPENGLFUNC(pglScalef , glScalef)
GETOPENGLFUNC(pglTranslatef , glTranslatef)
@@ -515,9 +472,6 @@ boolean SetupGLfunc(void)
// This has to be done after the context is created so the version number can be obtained
boolean SetupGLFunc13(void)
{
-#ifdef MINI_GL_COMPATIBILITY
- return false;
-#else
const GLubyte *version = pglGetString(GL_VERSION);
int glmajor, glminor;
@@ -553,7 +507,6 @@ boolean SetupGLFunc13(void)
else
DBG_Printf("GL_ARB_multitexture support: disabled\n");
return true;
-#endif
}
// -----------------+
@@ -571,11 +524,7 @@ static void SetNoTexture(void)
static void GLPerspective(GLdouble fovy, GLdouble aspect)
{
-#ifdef MINI_GL_COMPATIBILITY
- GLfloat m[4][4] =
-#else
GLdouble m[4][4] =
-#endif
{
{ 1.0f, 0.0f, 0.0f, 0.0f},
{ 0.0f, 1.0f, 0.0f, 0.0f},
@@ -598,14 +547,9 @@ static void GLPerspective(GLdouble fovy, GLdouble aspect)
m[1][1] = cotangent;
m[2][2] = -(zFar + zNear) / deltaZ;
m[3][2] = -2.0f * zNear * zFar / deltaZ;
-#ifdef MINI_GL_COMPATIBILITY
- pglMultMatrixf(&m[0][0]);
-#else
pglMultMatrixd(&m[0][0]);
-#endif
}
-#ifndef MINI_GL_COMPATIBILITY
static void GLProject(GLdouble objX, GLdouble objY, GLdouble objZ,
GLdouble* winX, GLdouble* winY, GLdouble* winZ)
{
@@ -645,7 +589,6 @@ static void GLProject(GLdouble objX, GLdouble objY, GLdouble objZ,
*winY=in[1];
*winZ=in[2];
}
-#endif
// -----------------+
// SetModelView :
@@ -672,10 +615,8 @@ void SetModelView(GLint w, GLint h)
//pglScalef(1.0f, 320.0f/200.0f, 1.0f); // gr_scalefrustum (ORIGINAL_ASPECT)
// added for new coronas' code (without depth buffer)
-#ifndef MINI_GL_COMPATIBILITY
pglGetIntegerv(GL_VIEWPORT, viewport);
pglGetDoublev(GL_PROJECTION_MATRIX, projMatrix);
-#endif
}
@@ -700,17 +641,13 @@ void SetStates(void)
//pglShadeModel(GL_FLAT);
pglEnable(GL_TEXTURE_2D); // two-dimensional texturing
-#ifndef KOS_GL_COMPATIBILITY
pglTexEnvi(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_MODULATE);
pglAlphaFunc(GL_NOTEQUAL, 0.0f);
-#endif
//pglBlendFunc(GL_ONE, GL_ZERO); // copy pixel to frame buffer (opaque)
pglEnable(GL_BLEND); // enable color blending
-#ifndef KOS_GL_COMPATIBILITY
pglColorMask(GL_TRUE, GL_TRUE, GL_TRUE, GL_TRUE);
-#endif
//pglDisable(GL_DITHER); // faB: ??? (undocumented in OpenGL 1.1)
// Hurdler: yes, it is!
@@ -735,9 +672,7 @@ void SetStates(void)
//tex_downloaded = NOTEXTURE_NUM;
//pglTexImage2D(GL_TEXTURE_2D, 0, 4, 8, 8, 0, GL_RGBA, GL_UNSIGNED_BYTE, Data);
-#ifndef KOS_GL_COMPATIBILITY
pglPolygonOffset(-1.0f, -1.0f);
-#endif
//pglEnable(GL_CULL_FACE);
//pglCullFace(GL_FRONT);
@@ -758,9 +693,7 @@ void SetStates(void)
// bp : when no t&l :)
pglLoadIdentity();
pglScalef(1.0f, 1.0f, -1.0f);
-#ifndef MINI_GL_COMPATIBILITY
pglGetDoublev(GL_MODELVIEW_MATRIX, modelMatrix); // added for new coronas' code (without depth buffer)
-#endif
}
@@ -863,14 +796,6 @@ EXPORT void HWRAPI(ClearMipMapCache) (void)
EXPORT void HWRAPI(ReadRect) (INT32 x, INT32 y, INT32 width, INT32 height,
INT32 dst_stride, UINT16 * dst_data)
{
-#ifdef KOS_GL_COMPATIBILITY
- (void)x;
- (void)y;
- (void)width;
- (void)height;
- (void)dst_stride;
- (void)dst_data;
-#else
INT32 i;
// DBG_Printf ("ReadRect()\n");
if (dst_stride == width*3)
@@ -912,7 +837,6 @@ EXPORT void HWRAPI(ReadRect) (INT32 x, INT32 y, INT32 width, INT32 height,
}
free(image);
}
-#endif
}
@@ -933,10 +857,8 @@ EXPORT void HWRAPI(GClipRect) (INT32 minx, INT32 miny, INT32 maxx, INT32 maxy, f
pglMatrixMode(GL_MODELVIEW);
// added for new coronas' code (without depth buffer)
-#ifndef MINI_GL_COMPATIBILITY
pglGetIntegerv(GL_VIEWPORT, viewport);
pglGetDoublev(GL_PROJECTION_MATRIX, projMatrix);
-#endif
}
@@ -983,12 +905,6 @@ EXPORT void HWRAPI(Draw2DLine) (F2DCoord * v1,
GLRGBAFloat c;
// DBG_Printf ("DrawLine() (%f %f %f) %d\n", v1->x, -v1->y, -v1->z, v1->argb);
-#ifdef MINI_GL_COMPATIBILITY
- GLfloat px1, px2, px3, px4;
- GLfloat py1, py2, py3, py4;
- GLfloat dx, dy;
- GLfloat angle;
-#endif
// BP: we should reflect the new state in our variable
//SetBlend(PF_Modulated|PF_NoTexture);
@@ -1000,33 +916,11 @@ EXPORT void HWRAPI(Draw2DLine) (F2DCoord * v1,
c.blue = byte2float[Color.s.blue];
c.alpha = byte2float[Color.s.alpha];
-#ifndef MINI_GL_COMPATIBILITY
pglColor4fv(&c.red); // is in RGBA float format
pglBegin(GL_LINES);
pglVertex3f(v1->x, -v1->y, 1.0f);
pglVertex3f(v2->x, -v2->y, 1.0f);
pglEnd();
-#else
- if (v2->x != v1->x)
- angle = (float)atan((v2->y-v1->y)/(v2->x-v1->x));
- else
- angle = N_PI_DEMI;
- dx = (float)sin(angle) / (float)screen_width;
- dy = (float)cos(angle) / (float)screen_height;
-
- px1 = v1->x - dx; py1 = v1->y + dy;
- px2 = v2->x - dx; py2 = v2->y + dy;
- px3 = v2->x + dx; py3 = v2->y - dy;
- px4 = v1->x + dx; py4 = v1->y - dy;
-
- pglColor4f(c.red, c.green, c.blue, c.alpha);
- pglBegin(GL_TRIANGLE_FAN);
- pglVertex3f(px1, -py1, 1);
- pglVertex3f(px2, -py2, 1);
- pglVertex3f(px3, -py3, 1);
- pglVertex3f(px4, -py4, 1);
- pglEnd();
-#endif
pglEnable(GL_TEXTURE_2D);
}
@@ -1034,9 +928,7 @@ EXPORT void HWRAPI(Draw2DLine) (F2DCoord * v1,
static void Clamp2D(GLenum pname)
{
pglTexParameteri(GL_TEXTURE_2D, pname, GL_CLAMP); // fallback clamp
-#ifdef GL_CLAMP_TO_EDGE
pglTexParameteri(GL_TEXTURE_2D, pname, GL_CLAMP_TO_EDGE);
-#endif
}
@@ -1063,11 +955,7 @@ EXPORT void HWRAPI(SetBlend) (FBITFIELD PolyFlags)
pglBlendFunc(GL_SRC_ALPHA, GL_ZERO); // 0 alpha = holes in texture
break;
case PF_Additive & PF_Blending:
-#ifdef ATI_RAGE_PRO_COMPATIBILITY
- pglBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); // alpha = level of transparency
-#else
pglBlendFunc(GL_SRC_ALPHA, GL_ONE); // src * alpha + dest
-#endif
break;
case PF_Environment & PF_Blending:
pglBlendFunc(GL_ONE, GL_ONE_MINUS_SRC_ALPHA);
@@ -1083,7 +971,6 @@ EXPORT void HWRAPI(SetBlend) (FBITFIELD PolyFlags)
break;
}
}
-#ifndef KOS_GL_COMPATIBILITY
if (Xor & PF_NoAlphaTest)
{
if (PolyFlags & PF_NoAlphaTest)
@@ -1099,7 +986,7 @@ EXPORT void HWRAPI(SetBlend) (FBITFIELD PolyFlags)
else
pglDisable(GL_POLYGON_OFFSET_FILL);
}
-#endif
+
if (Xor&PF_NoDepthTest)
{
if (PolyFlags & PF_NoDepthTest)
@@ -1126,10 +1013,6 @@ EXPORT void HWRAPI(SetBlend) (FBITFIELD PolyFlags)
pglTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_REPEAT);
}
-#ifdef KOS_GL_COMPATIBILITY
- if (Xor&PF_Modulated && !(PolyFlags & PF_Modulated))
- pglColor4f(1.0f, 1.0f, 1.0f, 1.0f);
-#else
if (Xor&PF_Modulated)
{
#if defined (__unix__) || defined (UNIXCOMMON)
@@ -1149,7 +1032,6 @@ EXPORT void HWRAPI(SetBlend) (FBITFIELD PolyFlags)
pglTexEnvi(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_REPLACE);
}
}
-#endif
if (Xor & PF_Occlude) // depth test but (no) depth write
{
@@ -1203,11 +1085,7 @@ EXPORT void HWRAPI(SetTexture) (FTextureInfo *pTexInfo)
else
{
// Download a mipmap
-#ifdef KOS_GL_COMPATIBILITY
- static GLushort tex[2048*2048];
-#else
static RGBA_t tex[2048*2048];
-#endif
const GLvoid *ptex = tex;
INT32 w, h;
@@ -1222,106 +1100,9 @@ EXPORT void HWRAPI(SetTexture) (FTextureInfo *pTexInfo)
!(pTexInfo->flags & TF_CHROMAKEYED))
{
// do nothing here.
- // Not a problem with MiniGL since we don't use paletted texture
}
else
#endif
-#ifdef KOS_GL_COMPATIBILITY
- if ((pTexInfo->grInfo.format == GR_TEXFMT_P_8) ||
- (pTexInfo->grInfo.format == GR_TEXFMT_AP_88))
- {
- const GLubyte *pImgData = (const GLubyte *)pTexInfo->grInfo.data;
- INT32 i, j;
-
- for (j = 0; j < h; j++)
- {
- for (i = 0; i < w; i++)
- {
- if ((*pImgData == HWR_PATCHES_CHROMAKEY_COLORINDEX) &&
- (pTexInfo->flags & TF_CHROMAKEYED))
- {
- tex[w*j+i] = 0;
- }
- else
- {
- if (pTexInfo->grInfo.format == GR_TEXFMT_AP_88 && !(pTexInfo->flags & TF_CHROMAKEYED))
- tex[w*j+i] = 0;
- else
- tex[w*j+i] = (myPaletteData[*pImgData].s.alpha>>4)<<12;
-
- tex[w*j+i] |= (myPaletteData[*pImgData].s.red >>4)<<8;
- tex[w*j+i] |= (myPaletteData[*pImgData].s.green>>4)<<4;
- tex[w*j+i] |= (myPaletteData[*pImgData].s.blue >>4);
- }
-
- pImgData++;
-
- if (pTexInfo->grInfo.format == GR_TEXFMT_AP_88)
- {
- if (!(pTexInfo->flags & TF_CHROMAKEYED))
- tex[w*j+i] |= ((*pImgData)>>4)<<12;
- pImgData++;
- }
-
- }
- }
- }
- else if (pTexInfo->grInfo.format == GR_RGBA)
- {
- // corona test : passed as ARGB 8888, which is not in glide formats
- // Hurdler: not used for coronas anymore, just for dynamic lighting
- const RGBA_t *pImgData = (const RGBA_t *)pTexInfo->grInfo.data;
- INT32 i, j;
-
- for (j = 0; j < h; j++)
- {
- for (i = 0; i < w; i++)
- {
- tex[w*j+i] = (pImgData->s.alpha>>4)<<12;
- tex[w*j+i] |= (pImgData->s.red >>4)<<8;
- tex[w*j+i] |= (pImgData->s.green>>4)<<4;
- tex[w*j+i] |= (pImgData->s.blue >>4);
- pImgData++;
- }
- }
- }
- else if (pTexInfo->grInfo.format == GR_TEXFMT_ALPHA_INTENSITY_88)
- {
- const GLubyte *pImgData = (const GLubyte *)pTexInfo->grInfo.data;
- INT32 i, j;
-
- for (j = 0; j < h; j++)
- {
- for (i = 0; i < w; i++)
- {
- const GLubyte sID = (*pImgData)>>4;
- tex[w*j+i] = sID<<8 | sID<<4 | sID;
- pImgData++;
- tex[w*j+i] |= ((*pImgData)>>4)<<12;
- pImgData++;
- }
- }
- }
- else if (pTexInfo->grInfo.format == GR_TEXFMT_ALPHA_8) // Used for fade masks
- {
- const GLubyte *pImgData = (const GLubyte *)pTexInfo->grInfo.data;
- INT32 i, j;
-
- for (j = 0; j < h; j++)
- {
- for (i = 0; i < w; i++)
- {
- tex[w*j+i] = (pImgData>>4)<<12;
- tex[w*j+i] |= (255>>4)<<8;
- tex[w*j+i] |= (255>>4)<<4;
- tex[w*j+i] |= (255>>4);
- pImgData++;
- }
- }
- }
- else
- DBG_Printf ("SetTexture(bad format) %ld\n", pTexInfo->grInfo.format);
-#else
if ((pTexInfo->grInfo.format == GR_TEXFMT_P_8) ||
(pTexInfo->grInfo.format == GR_TEXFMT_AP_88))
{
@@ -1403,7 +1184,6 @@ EXPORT void HWRAPI(SetTexture) (FTextureInfo *pTexInfo)
}
else
DBG_Printf ("SetTexture(bad format) %ld\n", pTexInfo->grInfo.format);
-#endif
pTexInfo->downloaded = NextTexAvail++;
tex_downloaded = pTexInfo->downloaded;
@@ -1412,18 +1192,6 @@ EXPORT void HWRAPI(SetTexture) (FTextureInfo *pTexInfo)
pglTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, mag_filter);
pglTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, min_filter);
-#ifdef KOS_GL_COMPATIBILITY
- pglTexImage2D(GL_TEXTURE_2D, 0, GL_ARGB4444, w, h, 0, GL_ARGB4444, GL_UNSIGNED_BYTE, ptex);
-#else
-#ifdef MINI_GL_COMPATIBILITY
- //if (pTexInfo->grInfo.format == GR_TEXFMT_ALPHA_INTENSITY_88)
- //pglTexImage2D(GL_TEXTURE_2D, 0, GL_LUMINANCE_ALPHA, w, h, 0, GL_RGBA, GL_UNSIGNED_BYTE, ptex);
- //else
- if (MipMap)
- pgluBuild2DMipmaps(GL_TEXTURE_2D, 0, w, h, GL_RGBA, GL_UNSIGNED_BYTE, ptex);
- else
- pglTexImage2D(GL_TEXTURE_2D, 0, 4, w, h, 0, GL_RGBA, GL_UNSIGNED_BYTE, ptex);
-#else
#ifdef USE_PALETTED_TEXTURE
//Hurdler: not really supported and not tested recently
if (glColorTableEXT &&
@@ -1441,15 +1209,11 @@ EXPORT void HWRAPI(SetTexture) (FTextureInfo *pTexInfo)
if (MipMap)
{
pgluBuild2DMipmaps(GL_TEXTURE_2D, GL_LUMINANCE_ALPHA, w, h, GL_RGBA, GL_UNSIGNED_BYTE, ptex);
-#ifdef GL_TEXTURE_MIN_LOD
pglTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_LOD, 0);
-#endif
-#ifdef GL_TEXTURE_MAX_LOD
if (pTexInfo->flags & TF_TRANSPARENT)
pglTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAX_LOD, 0); // No mippmaps on transparent stuff
else
pglTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAX_LOD, 4);
-#endif
//pglTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_LINEAR_MIPMAP_LINEAR);
}
else
@@ -1461,15 +1225,11 @@ EXPORT void HWRAPI(SetTexture) (FTextureInfo *pTexInfo)
if (MipMap)
{
pgluBuild2DMipmaps(GL_TEXTURE_2D, GL_ALPHA, w, h, GL_RGBA, GL_UNSIGNED_BYTE, ptex);
-#ifdef GL_TEXTURE_MIN_LOD
pglTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_LOD, 0);
-#endif
-#ifdef GL_TEXTURE_MAX_LOD
if (pTexInfo->flags & TF_TRANSPARENT)
pglTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAX_LOD, 0); // No mippmaps on transparent stuff
else
pglTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAX_LOD, 4);
-#endif
//pglTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_LINEAR_MIPMAP_LINEAR);
}
else
@@ -1481,21 +1241,15 @@ EXPORT void HWRAPI(SetTexture) (FTextureInfo *pTexInfo)
{
pgluBuild2DMipmaps(GL_TEXTURE_2D, textureformatGL, w, h, GL_RGBA, GL_UNSIGNED_BYTE, ptex);
// Control the mipmap level of detail
-#ifdef GL_TEXTURE_MIN_LOD
pglTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_LOD, 0); // the lower the number, the higer the detail
-#endif
-#ifdef GL_TEXTURE_MAX_LOD
if (pTexInfo->flags & TF_TRANSPARENT)
pglTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAX_LOD, 0); // No mippmaps on transparent stuff
else
pglTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAX_LOD, 5);
-#endif
}
else
pglTexImage2D(GL_TEXTURE_2D, 0, textureformatGL, w, h, 0, GL_RGBA, GL_UNSIGNED_BYTE, ptex);
}
-#endif
-#endif
if (pTexInfo->flags & TF_WRAPX)
pglTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_REPEAT);
@@ -1519,19 +1273,6 @@ EXPORT void HWRAPI(SetTexture) (FTextureInfo *pTexInfo)
else // initialisation de la liste
gr_cachetail = gr_cachehead = pTexInfo;
}
-#ifdef MINI_GL_COMPATIBILITY
- switch (pTexInfo->flags)
- {
- case 0 :
- pglTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP);
- pglTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP);
- break;
- default:
- pglTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_REPEAT);
- pglTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_REPEAT);
- break;
- }
-#endif
}
@@ -1545,18 +1286,11 @@ EXPORT void HWRAPI(DrawPolygon) (FSurfaceInfo *pSurf,
FBITFIELD PolyFlags)
{
FUINT i;
-#ifndef MINI_GL_COMPATIBILITY
FUINT j;
-#endif
GLRGBAFloat c = {0,0,0,0};
-#ifdef MINI_GL_COMPATIBILITY
- if (PolyFlags & PF_Corona)
- PolyFlags &= ~PF_NoDepthTest;
-#else
if ((PolyFlags & PF_Corona) && (oglflags & GLF_NOZBUFREAD))
PolyFlags &= ~(PF_NoDepthTest|PF_Corona);
-#endif
SetBlend(PolyFlags); //TODO: inline (#pragma..)
@@ -1578,16 +1312,11 @@ EXPORT void HWRAPI(DrawPolygon) (FSurfaceInfo *pSurf,
c.alpha = byte2float[pSurf->FlatColor.s.alpha];
}
-#ifdef MINI_GL_COMPATIBILITY
- pglColor4f(c.red, c.green, c.blue, c.alpha);
-#else
pglColor4fv(&c.red); // is in RGBA float format
-#endif
}
// this test is added for new coronas' code (without depth buffer)
// I think I should do a separate function for drawing coronas, so it will be a little faster
-#ifndef MINI_GL_COMPATIBILITY
if (PolyFlags & PF_Corona) // check to see if we need to draw the corona
{
//rem: all 8 (or 8.0f) values are hard coded: it can be changed to a higher value
@@ -1634,7 +1363,6 @@ EXPORT void HWRAPI(DrawPolygon) (FSurfaceInfo *pSurf,
c.alpha *= scalef; // change the alpha value (it seems better than changing the size of the corona)
pglColor4fv(&c.red);
}
-#endif
if (PolyFlags & PF_MD2)
return;
@@ -1728,41 +1456,15 @@ EXPORT void HWRAPI(SetSpecialState) (hwdspecialstate_t IdState, INT32 Value)
break;
case HWD_SET_POLYGON_SMOOTH:
-#ifdef KOS_GL_COMPATIBILITY // GL_POLYGON_SMOOTH_HINT
- if (Value)
- pglHint(GL_POLYGON_SMOOTH_HINT,GL_NICEST);
- else
- pglHint(GL_POLYGON_SMOOTH_HINT,GL_FASTEST);
-#else
if (Value)
pglEnable(GL_POLYGON_SMOOTH);
else
pglDisable(GL_POLYGON_SMOOTH);
-#endif
break;
case HWD_SET_TEXTUREFILTERMODE:
switch (Value)
{
-#ifdef KOS_GL_COMPATIBILITY
- case HWD_SET_TEXTUREFILTER_TRILINEAR:
- case HWD_SET_TEXTUREFILTER_BILINEAR:
- min_filter = mag_filter = GL_FILTER_BILINEAR;
- break;
- case HWD_SET_TEXTUREFILTER_POINTSAMPLED:
- min_filter = mag_filter = GL_FILTER_NONE;
- case HWD_SET_TEXTUREFILTER_MIXED1:
- min_filter = GL_FILTER_NONE;
- mag_filter = GL_LINEAR;
- case HWD_SET_TEXTUREFILTER_MIXED2:
- min_filter = GL_LINEAR;
- mag_filter = GL_FILTER_NONE;
- break;
- case HWD_SET_TEXTUREFILTER_MIXED3:
- min_filter = GL_FILTER_BILINEAR;
- mag_filter = GL_FILTER_NONE;
- break;
-#elif !defined (MINI_GL_COMPATIBILITY)
case HWD_SET_TEXTUREFILTER_TRILINEAR:
min_filter = GL_LINEAR_MIPMAP_LINEAR;
mag_filter = GL_LINEAR;
@@ -1791,14 +1493,9 @@ EXPORT void HWRAPI(SetSpecialState) (hwdspecialstate_t IdState, INT32 Value)
mag_filter = GL_NEAREST;
MipMap = GL_TRUE;
break;
-#endif
default:
-#ifdef KOS_GL_COMPATIBILITY
- min_filter = mag_filter = GL_FILTER_NONE;
-#else
mag_filter = GL_LINEAR;
min_filter = GL_NEAREST;
-#endif
}
if (!pgluBuild2DMipmaps)
{
@@ -1831,9 +1528,7 @@ static void DrawMD2Ex(INT32 *gl_cmd_buffer, md2_frame_t *frame, UINT32 duration
float scalex = scale, scaley = scale, scalez = scale;
// Because Otherwise, scaling the screen negatively vertically breaks the lighting
-#ifndef KOS_GL_COMPATIBILITY
GLfloat LightPos[] = {0.0f, 1.0f, 0.0f, 0.0f};
-#endif
if (duration == 0)
duration = 1;
@@ -1885,9 +1580,7 @@ static void DrawMD2Ex(INT32 *gl_cmd_buffer, md2_frame_t *frame, UINT32 duration
pglCullFace(GL_BACK);
}
-#ifndef KOS_GL_COMPATIBILITY
pglLightfv(GL_LIGHT0, GL_POSITION, LightPos);
-#endif
pglShadeModel(GL_SMOOTH);
if (color)
@@ -2029,9 +1722,7 @@ EXPORT void HWRAPI(SetTransform) (FTransform *stransform)
GLPerspective(53.13l, 2*ASPECT_RATIO); // 53.13 = 2*atan(0.5)
else
GLPerspective(stransform->fovxangle, ASPECT_RATIO);
-#ifndef MINI_GL_COMPATIBILITY
pglGetDoublev(GL_PROJECTION_MATRIX, projMatrix); // added for new coronas' code (without depth buffer)
-#endif
pglMatrixMode(GL_MODELVIEW);
}
else
@@ -2045,15 +1736,11 @@ EXPORT void HWRAPI(SetTransform) (FTransform *stransform)
else
//Hurdler: is "fov" correct?
GLPerspective(fov, ASPECT_RATIO);
-#ifndef MINI_GL_COMPATIBILITY
pglGetDoublev(GL_PROJECTION_MATRIX, projMatrix); // added for new coronas' code (without depth buffer)
-#endif
pglMatrixMode(GL_MODELVIEW);
}
-#ifndef MINI_GL_COMPATIBILITY
pglGetDoublev(GL_MODELVIEW_MATRIX, modelMatrix); // added for new coronas' code (without depth buffer)
-#endif
}
EXPORT INT32 HWRAPI(GetTextureUsed) (void)
@@ -2149,18 +1836,11 @@ EXPORT void HWRAPI(StartScreenWipe) (void)
// Create screen texture
pglBindTexture(GL_TEXTURE_2D, startScreenWipe);
-#ifdef KOS_GL_COMPATIBILITY
- pglTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_FILTER_NONE);
- pglTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_FILTER_NONE);
-#else
pglTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST);
pglTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST);
-#endif
Clamp2D(GL_TEXTURE_WRAP_S);
Clamp2D(GL_TEXTURE_WRAP_T);
-#ifndef KOS_GL_COMPATIBILITY
pglCopyTexImage2D(GL_TEXTURE_2D, 0, GL_RGB, 0, 0, texsize, texsize, 0);
-#endif
tex_downloaded = 0; // 0 so it knows it doesn't have any of the cached patches downloaded right now
}
@@ -2178,18 +1858,11 @@ EXPORT void HWRAPI(EndScreenWipe)(void)
// Create screen texture
pglBindTexture(GL_TEXTURE_2D, endScreenWipe);
-#ifdef KOS_GL_COMPATIBILITY
- pglTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_FILTER_NONE);
- pglTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_FILTER_NONE);
-#else
pglTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST);
pglTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST);
-#endif
Clamp2D(GL_TEXTURE_WRAP_S);
Clamp2D(GL_TEXTURE_WRAP_T);
-#ifndef KOS_GL_COMPATIBILITY
pglCopyTexImage2D(GL_TEXTURE_2D, 0, GL_RGB, 0, 0, texsize, texsize, 0);
-#endif
tex_downloaded = 0; // 0 so it knows it doesn't have any of the cached patches downloaded right now
}
@@ -2242,9 +1915,7 @@ EXPORT void HWRAPI(DoScreenWipe)(float alpha)
INT32 texsize = 2048;
float xfix, yfix;
-#ifndef MINI_GL_COMPATIBILITY
INT32 fademaskdownloaded = tex_downloaded; // the fade mask that has been set
-#endif
// Use a power of two texture, dammit
if(screen_width <= 1024)
@@ -2284,7 +1955,6 @@ EXPORT void HWRAPI(DoScreenWipe)(float alpha)
SetBlend(PF_Modulated|PF_Translucent|PF_NoDepthTest|PF_Clip|PF_NoZClip);
-#ifndef MINI_GL_COMPATIBILITY
if (gl13)
{
// Draw the end screen that fades in
@@ -2327,31 +1997,28 @@ EXPORT void HWRAPI(DoScreenWipe)(float alpha)
}
else
{
-#endif
- // Draw the end screen that fades in
- pglBindTexture(GL_TEXTURE_2D, endScreenWipe);
- pglBegin(GL_QUADS);
- pglColor4f(1.0f, 1.0f, 1.0f, alpha);
+ // Draw the end screen that fades in
+ pglBindTexture(GL_TEXTURE_2D, endScreenWipe);
+ pglBegin(GL_QUADS);
+ pglColor4f(1.0f, 1.0f, 1.0f, alpha);
- // Bottom left
- pglTexCoord2f(0.0f, 0.0f);
- pglVertex3f(-1.0f, -1.0f, 1.0f);
+ // Bottom left
+ pglTexCoord2f(0.0f, 0.0f);
+ pglVertex3f(-1.0f, -1.0f, 1.0f);
- // Top left
- pglTexCoord2f(0.0f, yfix);
- pglVertex3f(-1.0f, 1.0f, 1.0f);
+ // Top left
+ pglTexCoord2f(0.0f, yfix);
+ pglVertex3f(-1.0f, 1.0f, 1.0f);
- // Top right
- pglTexCoord2f(xfix, yfix);
- pglVertex3f(1.0f, 1.0f, 1.0f);
+ // Top right
+ pglTexCoord2f(xfix, yfix);
+ pglVertex3f(1.0f, 1.0f, 1.0f);
- // Bottom right
- pglTexCoord2f(xfix, 0.0f);
- pglVertex3f(1.0f, -1.0f, 1.0f);
- pglEnd();
-#ifndef MINI_GL_COMPATIBILITY
+ // Bottom right
+ pglTexCoord2f(xfix, 0.0f);
+ pglVertex3f(1.0f, -1.0f, 1.0f);
+ pglEnd();
}
-#endif
tex_downloaded = 0; // 0 so it knows it doesn't have any of the cached patches downloaded right now
}
@@ -2370,18 +2037,11 @@ EXPORT void HWRAPI(MakeScreenTexture) (void)
// Create screen texture
pglBindTexture(GL_TEXTURE_2D, screentexture);
-#ifdef KOS_GL_COMPATIBILITY
- pglTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_FILTER_NONE);
- pglTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_FILTER_NONE);
-#else
pglTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST);
pglTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST);
-#endif
Clamp2D(GL_TEXTURE_WRAP_S);
Clamp2D(GL_TEXTURE_WRAP_T);
-#ifndef KOS_GL_COMPATIBILITY
pglCopyTexImage2D(GL_TEXTURE_2D, 0, GL_RGB, 0, 0, texsize, texsize, 0);
-#endif
tex_downloaded = 0; // 0 so it knows it doesn't have any of the cached patches downloaded right now
}
@@ -2398,18 +2058,11 @@ EXPORT void HWRAPI(MakeScreenFinalTexture) (void)
// Create screen texture
pglBindTexture(GL_TEXTURE_2D, finalScreenTexture);
-#ifdef KOS_GL_COMPATIBILITY
- pglTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_FILTER_NONE);
- pglTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_FILTER_NONE);
-#else
pglTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST);
pglTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST);
-#endif
Clamp2D(GL_TEXTURE_WRAP_S);
Clamp2D(GL_TEXTURE_WRAP_T);
-#ifndef KOS_GL_COMPATIBILITY
pglCopyTexImage2D(GL_TEXTURE_2D, 0, GL_RGB, 0, 0, texsize, texsize, 0);
-#endif
tex_downloaded = 0; // 0 so it knows it doesn't have any of the cached patches downloaded right now
diff --git a/src/hardware/r_opengl/r_opengl.h b/src/hardware/r_opengl/r_opengl.h
index 6a2eba1df..e6cf164bb 100644
--- a/src/hardware/r_opengl/r_opengl.h
+++ b/src/hardware/r_opengl/r_opengl.h
@@ -37,13 +37,11 @@
#include
#include
-#ifndef MINI_GL_COMPATIBILITY
#ifdef STATIC_OPENGL // Because of the 1.3 functions, you'll need GLext to compile it if static
#define GL_GLEXT_PROTOTYPES
#include
#endif
#endif
-#endif
#define _CREATE_DLL_ // necessary for Unix AND Windows
#include "../../doomdef.h"
diff --git a/src/hu_stuff.c b/src/hu_stuff.c
index d8b1f652e..cd57c7d84 100644
--- a/src/hu_stuff.c
+++ b/src/hu_stuff.c
@@ -83,6 +83,7 @@ patch_t *rmatcico;
patch_t *bmatcico;
patch_t *tagico;
patch_t *tallminus;
+patch_t *tallinfin;
//-------------------------------------------
// coop hud
@@ -92,6 +93,7 @@ patch_t *emeraldpics[7];
patch_t *tinyemeraldpics[7];
static patch_t *emblemicon;
patch_t *tokenicon;
+static patch_t *exiticon;
//-------------------------------------------
// misc vars
@@ -234,6 +236,7 @@ void HU_LoadGraphics(void)
// minus for negative tallnums
tallminus = (patch_t *)W_CachePatchName("STTMINUS", PU_HUDGFX);
+ tallinfin = (patch_t *)W_CachePatchName("STTINFIN", PU_HUDGFX);
// cache the crosshairs, don't bother to know which one is being used,
// just cache all 3, they're so small anyway.
@@ -245,6 +248,7 @@ void HU_LoadGraphics(void)
emblemicon = W_CachePatchName("EMBLICON", PU_HUDGFX);
tokenicon = W_CachePatchName("TOKNICON", PU_HUDGFX);
+ exiticon = W_CachePatchName("EXITICON", PU_HUDGFX);
emeraldpics[0] = W_CachePatchName("CHAOS1", PU_HUDGFX);
emeraldpics[1] = W_CachePatchName("CHAOS2", PU_HUDGFX);
@@ -324,7 +328,7 @@ void HU_Start(void)
*/
static void DoSayCommand(SINT8 target, size_t usedargs, UINT8 flags)
{
- XBOXSTATIC char buf[254];
+ char buf[254];
size_t numwords, ix;
char *msg = &buf[2];
const size_t msgspace = sizeof buf - 2;
@@ -469,7 +473,7 @@ static void Got_Saycmd(UINT8 **p, INT32 playernum)
player_names[playernum]);
if (server)
{
- XBOXSTATIC UINT8 buf[2];
+ UINT8 buf[2];
buf[0] = (UINT8)playernum;
buf[1] = KICK_MSG_CON_FAIL;
@@ -489,7 +493,7 @@ static void Got_Saycmd(UINT8 **p, INT32 playernum)
CONS_Alert(CONS_WARNING, M_GetText("Illegal say command received from %s containing invalid characters\n"), player_names[playernum]);
if (server)
{
- XBOXSTATIC char buf[2];
+ char buf[2];
buf[0] = (char)playernum;
buf[1] = KICK_MSG_CON_FAIL;
@@ -1174,6 +1178,9 @@ void HU_Erase(void)
// IN-LEVEL MULTIPLAYER RANKINGS
//======================================================================
+#define supercheckdef ((players[tab[i].num].powers[pw_super] && players[tab[i].num].mo && (players[tab[i].num].mo->state < &states[S_PLAY_SUPER_TRANS1] || players[tab[i].num].mo->state >= &states[S_PLAY_SUPER_TRANS6])) || (players[tab[i].num].powers[pw_carry] == CR_NIGHTSMODE && skins[players[tab[i].num].skin].flags & SF_SUPER))
+#define greycheckdef ((players[tab[i].num].mo && players[tab[i].num].mo->health <= 0) || players[tab[i].num].spectator)
+
//
// HU_DrawTabRankings
//
@@ -1181,6 +1188,7 @@ void HU_DrawTabRankings(INT32 x, INT32 y, playersort_t *tab, INT32 scorelines, I
{
INT32 i;
const UINT8 *colormap;
+ boolean greycheck, supercheck;
//this function is designed for 9 or less score lines only
I_Assert(scorelines <= 9);
@@ -1189,12 +1197,15 @@ void HU_DrawTabRankings(INT32 x, INT32 y, playersort_t *tab, INT32 scorelines, I
for (i = 0; i < scorelines; i++)
{
- if (players[tab[i].num].spectator)
+ if (players[tab[i].num].spectator && gametype != GT_COOP)
continue; //ignore them.
+ greycheck = greycheckdef;
+ supercheck = supercheckdef;
+
V_DrawString(x + 20, y,
((tab[i].num == whiteplayer) ? V_YELLOWMAP : 0)
- | ((players[tab[i].num].mo && players[tab[i].num].mo->health > 0) ? 0 : V_60TRANS)
+ | (greycheck ? V_60TRANS : 0)
| V_ALLOWLOWERCASE, tab[i].name);
// Draw emeralds
@@ -1204,7 +1215,7 @@ void HU_DrawTabRankings(INT32 x, INT32 y, playersort_t *tab, INT32 scorelines, I
HU_DrawEmeralds(x-12,y+2,tab[i].emeralds);
}
- if (players[tab[i].num].mo && players[tab[i].num].mo->health <= 0)
+ if (greycheck)
V_DrawSmallTranslucentPatch (x, y-4, V_80TRANS, livesback);
else
V_DrawSmallScaledPatch (x, y-4, 0, livesback);
@@ -1212,11 +1223,11 @@ void HU_DrawTabRankings(INT32 x, INT32 y, playersort_t *tab, INT32 scorelines, I
if (tab[i].color == 0)
{
colormap = colormaps;
- if (players[tab[i].num].powers[pw_super])
+ if (supercheck)
V_DrawSmallScaledPatch(x, y-4, 0, superprefix[players[tab[i].num].skin]);
else
{
- if (players[tab[i].num].mo && players[tab[i].num].mo->health <= 0)
+ if (greycheck)
V_DrawSmallTranslucentPatch(x, y-4, V_80TRANS, faceprefix[players[tab[i].num].skin]);
else
V_DrawSmallScaledPatch(x, y-4, 0, faceprefix[players[tab[i].num].skin]);
@@ -1224,7 +1235,7 @@ void HU_DrawTabRankings(INT32 x, INT32 y, playersort_t *tab, INT32 scorelines, I
}
else
{
- if (players[tab[i].num].powers[pw_super] && players[tab[i].num].mo && (players[tab[i].num].mo->state < &states[S_PLAY_SUPER_TRANS] || players[tab[i].num].mo->state > &states[S_PLAY_SUPER_TRANS9]))
+ if (supercheck)
{
colormap = R_GetTranslationColormap(players[tab[i].num].skin, players[tab[i].num].mo->color, GTC_CACHE);
V_DrawSmallMappedPatch (x, y-4, 0, superprefix[players[tab[i].num].skin], colormap);
@@ -1232,23 +1243,26 @@ void HU_DrawTabRankings(INT32 x, INT32 y, playersort_t *tab, INT32 scorelines, I
else
{
colormap = R_GetTranslationColormap(players[tab[i].num].skin, players[tab[i].num].mo ? players[tab[i].num].mo->color : tab[i].color, GTC_CACHE);
- if (players[tab[i].num].mo && players[tab[i].num].mo->health <= 0)
+ if (greycheck)
V_DrawSmallTranslucentMappedPatch (x, y-4, V_80TRANS, faceprefix[players[tab[i].num].skin], colormap);
else
V_DrawSmallMappedPatch (x, y-4, 0, faceprefix[players[tab[i].num].skin], colormap);
}
}
- if (G_GametypeUsesLives()) //show lives
- V_DrawRightAlignedString(x, y+4, V_ALLOWLOWERCASE|((players[tab[i].num].mo && players[tab[i].num].mo->health > 0) ? 0 : V_60TRANS), va("%dx", players[tab[i].num].lives));
+ if (G_GametypeUsesLives() && !(gametype == GT_COOP && (cv_cooplives.value == 0 || cv_cooplives.value == 3)) && (players[tab[i].num].lives != 0x7f)) //show lives
+ V_DrawRightAlignedString(x, y+4, V_ALLOWLOWERCASE|(greycheck ? V_60TRANS : 0), va("%dx", players[tab[i].num].lives));
else if (G_TagGametype() && players[tab[i].num].pflags & PF_TAGIT)
{
- if (players[tab[i].num].mo && players[tab[i].num].mo->health <= 0)
+ if (greycheck)
V_DrawSmallTranslucentPatch(x-32, y-4, V_60TRANS, tagico);
else
V_DrawSmallScaledPatch(x-32, y-4, 0, tagico);
}
+ if (players[tab[i].num].exiting)
+ V_DrawSmallScaledPatch(x - SHORT(exiticon->width)/2 - 1, y-3, 0, exiticon);
+
if (gametype == GT_RACE)
{
if (circuitmap)
@@ -1256,13 +1270,13 @@ void HU_DrawTabRankings(INT32 x, INT32 y, playersort_t *tab, INT32 scorelines, I
if (players[tab[i].num].exiting)
V_DrawRightAlignedString(x+240, y, 0, va("%i:%02i.%02i", G_TicsToMinutes(players[tab[i].num].realtime,true), G_TicsToSeconds(players[tab[i].num].realtime), G_TicsToCentiseconds(players[tab[i].num].realtime)));
else
- V_DrawRightAlignedString(x+240, y, ((players[tab[i].num].mo && players[tab[i].num].mo->health > 0) ? 0 : V_60TRANS), va("%u", tab[i].count));
+ V_DrawRightAlignedString(x+240, y, (greycheck ? V_60TRANS : 0), va("%u", tab[i].count));
}
else
- V_DrawRightAlignedString(x+240, y, ((players[tab[i].num].mo && players[tab[i].num].mo->health > 0) ? 0 : V_60TRANS), va("%i:%02i.%02i", G_TicsToMinutes(tab[i].count,true), G_TicsToSeconds(tab[i].count), G_TicsToCentiseconds(tab[i].count)));
+ V_DrawRightAlignedString(x+240, y, (greycheck ? V_60TRANS : 0), va("%i:%02i.%02i", G_TicsToMinutes(tab[i].count,true), G_TicsToSeconds(tab[i].count), G_TicsToCentiseconds(tab[i].count)));
}
else
- V_DrawRightAlignedString(x+240, y, ((players[tab[i].num].mo && players[tab[i].num].mo->health > 0) ? 0 : V_60TRANS), va("%u", tab[i].count));
+ V_DrawRightAlignedString(x+240, y, (greycheck ? V_60TRANS : 0), va("%u", tab[i].count));
y += 16;
}
@@ -1277,6 +1291,7 @@ void HU_DrawTeamTabRankings(playersort_t *tab, INT32 whiteplayer)
INT32 redplayers = 0, blueplayers = 0;
const UINT8 *colormap;
char name[MAXPLAYERNAME+1];
+ boolean greycheck, supercheck;
V_DrawFill(160, 26, 1, 154, 0); //Draw a vertical line to separate the two teams.
V_DrawFill(1, 26, 318, 1, 0); //And a horizontal line to make a T.
@@ -1304,10 +1319,13 @@ void HU_DrawTeamTabRankings(playersort_t *tab, INT32 whiteplayer)
else //er? not on red or blue, so ignore them
continue;
+ greycheck = greycheckdef;
+ supercheck = supercheckdef;
+
strlcpy(name, tab[i].name, 9);
V_DrawString(x + 20, y,
((tab[i].num == whiteplayer) ? V_YELLOWMAP : 0)
- | ((players[tab[i].num].mo && players[tab[i].num].mo->health > 0) ? 0 : V_TRANSLUCENT)
+ | (greycheck ? V_TRANSLUCENT : 0)
| V_ALLOWLOWERCASE, name);
if (gametype == GT_CTF)
@@ -1325,7 +1343,7 @@ void HU_DrawTeamTabRankings(playersort_t *tab, INT32 whiteplayer)
HU_DrawEmeralds(x-12,y+2,tab[i].emeralds);
}
- if (players[tab[i].num].powers[pw_super])
+ if (supercheck)
{
colormap = R_GetTranslationColormap(players[tab[i].num].skin, players[tab[i].num].mo ? players[tab[i].num].mo->color : tab[i].color, GTC_CACHE);
V_DrawSmallMappedPatch (x, y-4, 0, superprefix[players[tab[i].num].skin], colormap);
@@ -1333,12 +1351,12 @@ void HU_DrawTeamTabRankings(playersort_t *tab, INT32 whiteplayer)
else
{
colormap = R_GetTranslationColormap(players[tab[i].num].skin, players[tab[i].num].mo ? players[tab[i].num].mo->color : tab[i].color, GTC_CACHE);
- if (players[tab[i].num].mo && players[tab[i].num].mo->health <= 0)
- V_DrawSmallTranslucentMappedPatch (x, y-4, 0, faceprefix[players[tab[i].num].skin], colormap);
+ if (greycheck)
+ V_DrawSmallTranslucentMappedPatch (x, y-4, V_80TRANS, faceprefix[players[tab[i].num].skin], colormap);
else
V_DrawSmallMappedPatch (x, y-4, 0, faceprefix[players[tab[i].num].skin], colormap);
}
- V_DrawRightAlignedThinString(x+120, y, ((players[tab[i].num].mo && players[tab[i].num].mo->health > 0) ? 0 : V_TRANSLUCENT), va("%u", tab[i].count));
+ V_DrawRightAlignedThinString(x+120, y, (greycheck ? V_TRANSLUCENT : 0), va("%u", tab[i].count));
}
}
@@ -1350,6 +1368,7 @@ void HU_DrawDualTabRankings(INT32 x, INT32 y, playersort_t *tab, INT32 scoreline
INT32 i;
const UINT8 *colormap;
char name[MAXPLAYERNAME+1];
+ boolean greycheck, supercheck;
V_DrawFill(160, 26, 1, 154, 0); //Draw a vertical line to separate the two sides.
V_DrawFill(1, 26, 318, 1, 0); //And a horizontal line to make a T.
@@ -1357,20 +1376,26 @@ void HU_DrawDualTabRankings(INT32 x, INT32 y, playersort_t *tab, INT32 scoreline
for (i = 0; i < scorelines; i++)
{
- if (players[tab[i].num].spectator)
+ if (players[tab[i].num].spectator && gametype != GT_COOP)
continue; //ignore them.
+ greycheck = greycheckdef;
+ supercheck = supercheckdef;
+
strlcpy(name, tab[i].name, 9);
V_DrawString(x + 20, y,
((tab[i].num == whiteplayer) ? V_YELLOWMAP : 0)
- | ((players[tab[i].num].mo && players[tab[i].num].mo->health > 0) ? 0 : V_TRANSLUCENT)
+ | (greycheck ? V_TRANSLUCENT : 0)
| V_ALLOWLOWERCASE, name);
- if (G_GametypeUsesLives()) //show lives
+ if (G_GametypeUsesLives() && !(gametype == GT_COOP && (cv_cooplives.value == 0 || cv_cooplives.value == 3)) && (players[tab[i].num].lives != 0x7f)) //show lives
V_DrawRightAlignedString(x, y+4, V_ALLOWLOWERCASE, va("%dx", players[tab[i].num].lives));
else if (G_TagGametype() && players[tab[i].num].pflags & PF_TAGIT)
V_DrawSmallScaledPatch(x-28, y-4, 0, tagico);
+ if (players[tab[i].num].exiting)
+ V_DrawSmallScaledPatch(x - SHORT(exiticon->width)/2 - 1, y-3, 0, exiticon);
+
// Draw emeralds
if (!players[tab[i].num].powers[pw_super]
|| ((leveltime/7) & 1))
@@ -1382,19 +1407,19 @@ void HU_DrawDualTabRankings(INT32 x, INT32 y, playersort_t *tab, INT32 scoreline
if (tab[i].color == 0)
{
colormap = colormaps;
- if (players[tab[i].num].powers[pw_super])
+ if (supercheck)
V_DrawSmallScaledPatch (x, y-4, 0, superprefix[players[tab[i].num].skin]);
else
{
- if (players[tab[i].num].mo && players[tab[i].num].mo->health <= 0)
- V_DrawSmallTranslucentPatch (x, y-4, 0, faceprefix[players[tab[i].num].skin]);
+ if (greycheck)
+ V_DrawSmallTranslucentPatch (x, y-4, V_80TRANS, faceprefix[players[tab[i].num].skin]);
else
V_DrawSmallScaledPatch (x, y-4, 0, faceprefix[players[tab[i].num].skin]);
}
}
else
{
- if (players[tab[i].num].powers[pw_super])
+ if (supercheck)
{
colormap = R_GetTranslationColormap(players[tab[i].num].skin, players[tab[i].num].mo ? players[tab[i].num].mo->color : tab[i].color, GTC_CACHE);
V_DrawSmallMappedPatch (x, y-4, 0, superprefix[players[tab[i].num].skin], colormap);
@@ -1402,8 +1427,8 @@ void HU_DrawDualTabRankings(INT32 x, INT32 y, playersort_t *tab, INT32 scoreline
else
{
colormap = R_GetTranslationColormap(players[tab[i].num].skin, players[tab[i].num].mo ? players[tab[i].num].mo->color : tab[i].color, GTC_CACHE);
- if (players[tab[i].num].mo && players[tab[i].num].mo->health <= 0)
- V_DrawSmallTranslucentMappedPatch (x, y-4, 0, faceprefix[players[tab[i].num].skin], colormap);
+ if (greycheck)
+ V_DrawSmallTranslucentMappedPatch (x, y-4, V_80TRANS, faceprefix[players[tab[i].num].skin], colormap);
else
V_DrawSmallMappedPatch (x, y-4, 0, faceprefix[players[tab[i].num].skin], colormap);
}
@@ -1417,13 +1442,13 @@ void HU_DrawDualTabRankings(INT32 x, INT32 y, playersort_t *tab, INT32 scoreline
if (players[tab[i].num].exiting)
V_DrawRightAlignedThinString(x+156, y, 0, va("%i:%02i.%02i", G_TicsToMinutes(players[tab[i].num].realtime,true), G_TicsToSeconds(players[tab[i].num].realtime), G_TicsToCentiseconds(players[tab[i].num].realtime)));
else
- V_DrawRightAlignedThinString(x+156, y, ((players[tab[i].num].mo && players[tab[i].num].mo->health > 0) ? 0 : V_TRANSLUCENT), va("%u", tab[i].count));
+ V_DrawRightAlignedThinString(x+156, y, (greycheck ? V_TRANSLUCENT : 0), va("%u", tab[i].count));
}
else
- V_DrawRightAlignedThinString(x+156, y, ((players[tab[i].num].mo && players[tab[i].num].mo->health > 0) ? 0 : V_TRANSLUCENT), va("%i:%02i.%02i", G_TicsToMinutes(tab[i].count,true), G_TicsToSeconds(tab[i].count), G_TicsToCentiseconds(tab[i].count)));
+ V_DrawRightAlignedThinString(x+156, y, (greycheck ? V_TRANSLUCENT : 0), va("%i:%02i.%02i", G_TicsToMinutes(tab[i].count,true), G_TicsToSeconds(tab[i].count), G_TicsToCentiseconds(tab[i].count)));
}
else
- V_DrawRightAlignedThinString(x+120, y, ((players[tab[i].num].mo && players[tab[i].num].mo->health > 0) ? 0 : V_TRANSLUCENT), va("%u", tab[i].count));
+ V_DrawRightAlignedThinString(x+120, y, (greycheck ? V_TRANSLUCENT : 0), va("%u", tab[i].count));
y += 16;
if (y > 160)
@@ -1620,61 +1645,67 @@ static void HU_DrawRankings(void)
for (j = 0; j < MAXPLAYERS; j++)
{
- if (!playeringame[j] || players[j].spectator)
+ if (!playeringame[j])
+ continue;
+
+ if (gametype != GT_COOP && players[j].spectator)
continue;
for (i = 0; i < MAXPLAYERS; i++)
{
- if (playeringame[i] && !players[i].spectator)
+ if (!playeringame[i])
+ continue;
+
+ if (gametype != GT_COOP && players[i].spectator)
+ continue;
+
+ if (gametype == GT_RACE)
{
- if (gametype == GT_RACE)
+ if (circuitmap)
{
- if (circuitmap)
+ if ((unsigned)players[i].laps+1 >= tab[scorelines].count && completed[i] == false)
{
- if ((unsigned)players[i].laps+1 >= tab[scorelines].count && completed[i] == false)
- {
- tab[scorelines].count = players[i].laps+1;
- tab[scorelines].num = i;
- tab[scorelines].color = players[i].skincolor;
- tab[scorelines].name = player_names[i];
- }
- }
- else
- {
- if (players[i].realtime <= tab[scorelines].count && completed[i] == false)
- {
- tab[scorelines].count = players[i].realtime;
- tab[scorelines].num = i;
- tab[scorelines].color = players[i].skincolor;
- tab[scorelines].name = player_names[i];
- }
- }
- }
- else if (gametype == GT_COMPETITION)
- {
- // todo put something more fitting for the gametype here, such as current
- // number of categories led
- if (players[i].score >= tab[scorelines].count && completed[i] == false)
- {
- tab[scorelines].count = players[i].score;
+ tab[scorelines].count = players[i].laps+1;
tab[scorelines].num = i;
tab[scorelines].color = players[i].skincolor;
tab[scorelines].name = player_names[i];
- tab[scorelines].emeralds = players[i].powers[pw_emeralds];
}
}
else
{
- if (players[i].score >= tab[scorelines].count && completed[i] == false)
+ if (players[i].realtime <= tab[scorelines].count && completed[i] == false)
{
- tab[scorelines].count = players[i].score;
+ tab[scorelines].count = players[i].realtime;
tab[scorelines].num = i;
tab[scorelines].color = players[i].skincolor;
tab[scorelines].name = player_names[i];
- tab[scorelines].emeralds = players[i].powers[pw_emeralds];
}
}
}
+ else if (gametype == GT_COMPETITION)
+ {
+ // todo put something more fitting for the gametype here, such as current
+ // number of categories led
+ if (players[i].score >= tab[scorelines].count && completed[i] == false)
+ {
+ tab[scorelines].count = players[i].score;
+ tab[scorelines].num = i;
+ tab[scorelines].color = players[i].skincolor;
+ tab[scorelines].name = player_names[i];
+ tab[scorelines].emeralds = players[i].powers[pw_emeralds];
+ }
+ }
+ else
+ {
+ if (players[i].score >= tab[scorelines].count && completed[i] == false)
+ {
+ tab[scorelines].count = players[i].score;
+ tab[scorelines].num = i;
+ tab[scorelines].color = players[i].skincolor;
+ tab[scorelines].name = player_names[i];
+ tab[scorelines].emeralds = players[i].powers[pw_emeralds];
+ }
+ }
}
completed[tab[scorelines].num] = true;
scorelines++;
diff --git a/src/hu_stuff.h b/src/hu_stuff.h
index 9bfb42912..2dbeb556d 100644
--- a/src/hu_stuff.h
+++ b/src/hu_stuff.h
@@ -21,7 +21,7 @@
//------------------------------------
// heads up font
//------------------------------------
-#define HU_FONTSTART '\x19' // the first font character
+#define HU_FONTSTART '\x16' // the first font character
#define HU_FONTEND '~'
#define HU_FONTSIZE (HU_FONTEND - HU_FONTSTART + 1)
@@ -71,6 +71,7 @@ extern patch_t *rmatcico;
extern patch_t *bmatcico;
extern patch_t *tagico;
extern patch_t *tallminus;
+extern patch_t *tallinfin;
extern patch_t *tokenicon;
// set true when entering a chat message
diff --git a/src/i_addrinfo.c b/src/i_addrinfo.c
index eb29e3608..208f470f4 100644
--- a/src/i_addrinfo.c
+++ b/src/i_addrinfo.c
@@ -20,17 +20,11 @@
#else
#include
#endif
-#elif !defined (__DJGPP__) && !defined(_WII)
+#elif !defined (__DJGPP__)
#include
-#ifndef _NDS
#include
-#endif
-#ifdef _PS3
-#include
-#elif ! defined (_arch_dreamcast)
#include
#endif
-#endif
#include "i_addrinfo.h"
@@ -262,9 +256,6 @@ int I_getaddrinfo(const char *node, const char *service,
for (i = 0, j = 0; i < ailen; i++, j++)
{
ai = *res+i;
-#ifdef _PS3
- addr[i].sin_len = famsize;
-#endif
addr[i].sin_port = htons((UINT16)sockport);
if (nodename)
{
diff --git a/src/i_addrinfo.h b/src/i_addrinfo.h
index 744ea0cf7..4cda8968b 100644
--- a/src/i_addrinfo.h
+++ b/src/i_addrinfo.h
@@ -39,17 +39,7 @@
#define EAI_NONAME -2
#endif
-#ifdef _PS3 // PSL1GHT v2
-struct my_addrinfo {
- int ai_flags;
- int ai_family;
- int ai_socktype;
- int ai_protocol;
- size_t ai_addrlen;
- struct sockaddr *ai_addr;
- struct my_addrinfo *ai_next;
-};
-#elif defined (_WIN32) // already use the stub for Win32
+#ifdef _WIN32 // already use the stub for Win32
// w32api, ws2tcpip.h, r1.12
struct my_addrinfo {
int ai_flags;
diff --git a/src/i_tcp.c b/src/i_tcp.c
index c65a536a8..b6c72f859 100644
--- a/src/i_tcp.c
+++ b/src/i_tcp.c
@@ -18,20 +18,12 @@
#ifdef __GNUC__
#include
#endif
-#ifdef __OS2__
-#include
-#include
-#endif // __OS2__
-
-#ifdef _PS3
-#define NO_IPV6 // PSL1GHT v2 do not have IPv6 support
-#endif
#ifndef NO_IPV6
#define HAVE_IPV6
#endif
-#if defined (_WIN32) || defined (_WIN32_WCE)
+#ifdef _WIN32
#define USE_WINSOCK
#if defined (_WIN64) || defined (HAVE_IPV6)
#define USE_WINSOCK2
@@ -40,12 +32,6 @@
#endif
#endif //WIN32 OS
-#ifdef _XBOX // XBox have on WinSock API?
-#undef USE_WINSOCK
-#undef USE_WINSOCK1
-#undef USE_WINSOCK2
-#endif
-
#ifdef USE_WINSOCK2
#include
#endif
@@ -61,17 +47,12 @@
#else
#ifdef USE_WINSOCK1
#include
-#elif !defined (SCOUW2) && !defined (SCOUW7) && !defined (__OS2__)
-#ifdef HAVE_LWIP
-#include
-#elif !defined (USE_WINSOCK)
+#elif !defined (SCOUW2) && !defined (SCOUW7)
+#ifndef USE_WINSOCK
#include
#endif //normal BSD API
-#ifdef HAVE_LWIP
-#include
-#define ioctl lwip_ioctl
-#elif !defined (USE_WINSOCK) //!HAVE_LWIP
+#ifndef USE_WINSOCK
#ifdef __APPLE_CC__
#ifndef _BSD_SOCKLEN_T_
#define _BSD_SOCKLEN_T_
@@ -81,14 +62,7 @@
#include
#endif //normal BSD API
-#if defined(_arch_dreamcast) && !defined(HAVE_LWIP)
-#include
-#elif defined(HAVE_LWIP)
-#include
-#elif defined (_PS3)
-#include
-#include
-#elif !defined(USE_WINSOCK) //!HAVE_LWIP
+#ifndef USE_WINSOCK
#include
#include
#endif //normal BSD API
@@ -96,10 +70,6 @@
#include
#include
-#ifdef _arch_dreamcast
-#include "sdl/SRB2DC/dchelp.h"
-#endif
-
#if (defined (__unix__) && !defined (MSDOS)) || defined(__APPLE__) || defined (UNIXCOMMON)
#include
#endif // UNIXCOMMON
@@ -190,11 +160,6 @@ static UINT8 UPNP_support = TRUE;
// winsock stuff (in winsock a socket is not a file)
#define ioctl ioctlsocket
#define close closesocket
-
- #ifdef _WIN32_WCE
- #include "sdl/SRB2CE/cehelp.h"
- #endif
-
#endif
#include "i_addrinfo.h"
@@ -205,9 +170,7 @@ static UINT8 UPNP_support = TRUE;
#define SELECTTEST
#endif
-#elif defined(HAVE_LWIP)
-#define SELECTTEST
-#elif !defined( _arch_dreamcast)
+#else
#define SELECTTEST
#endif
@@ -218,7 +181,7 @@ typedef SOCKET SOCKET_TYPE;
#define BADSOCKET INVALID_SOCKET
#define ERRSOCKET (SOCKET_ERROR)
#else
-#if (defined (__unix__) && !defined (MSDOS)) || defined (__APPLE__) || defined (__HAIKU__) || defined(_PS3)
+#if (defined (__unix__) && !defined (MSDOS)) || defined (__APPLE__) || defined (__HAIKU__)
typedef int SOCKET_TYPE;
#else
typedef unsigned long SOCKET_TYPE;
@@ -1165,12 +1128,6 @@ boolean I_InitTcpDriver(void)
CONS_Debug(DBG_NETPLAY, "WinSock description: %s\n",WSAData.szDescription);
CONS_Debug(DBG_NETPLAY, "WinSock System Status: %s\n",WSAData.szSystemStatus);
#endif
-#ifdef HAVE_LWIP
- lwip_kos_init();
-#elif defined(_arch_dreamcast)
- //return;
- net_init();
-#endif
#ifdef __DJGPP__
#ifdef WATTCP // Alam_GBC: survive bootp, dhcp, rarp and wattcp/pktdrv from failing to load
survive_eth = 1; // would be needed to not exit if pkt_eth_init() fails
@@ -1223,9 +1180,6 @@ boolean I_InitTcpDriver(void)
CONS_Debug(DBG_NETPLAY, "No TCP/IP driver detected\n");
#endif // libsocket
#endif // __DJGPP__
-#ifdef _PS3
- netInitialize();
-#endif
#ifndef __DJGPP__
init_tcp_driver = true;
#endif
@@ -1274,11 +1228,6 @@ void I_ShutdownTcpDriver(void)
WS_addrinfocleanup();
WSACleanup();
#endif
-#ifdef HAVE_LWIP
- lwip_kos_shutdown();
-#elif defined(_arch_dreamcast)
- net_shutdown();
-#endif
#ifdef __DJGPP__
#ifdef WATTCP // wattcp
//_outch = NULL;
@@ -1287,9 +1236,6 @@ void I_ShutdownTcpDriver(void)
__lsck_uninit();
#endif // libsocket
#endif // __DJGPP__
-#ifdef _PS3
- netDeinitialize();
-#endif
CONS_Printf("shut down\n");
init_tcp_driver = false;
#endif
diff --git a/src/info.c b/src/info.c
index 4f1a76c73..acb12379a 100644
--- a/src/info.c
+++ b/src/info.c
@@ -211,6 +211,10 @@ char sprnames[NUMSPRITES + 1][5] =
"BMCH", // Big Mace Chain
"SMCE", // Small Mace
"BMCE", // Big Mace
+ "YSPB", // Yellow spring on a ball
+ "RSPB", // Red spring on a ball
+ "SFBR", // Small Firebar
+ "BFBR", // Big Firebar
// Arid Canyon Scenery
"BTBL", // Big tumbleweed
@@ -401,6 +405,7 @@ char spr2names[NUMPLAYERSPRITES][5] =
"STND",
"WAIT",
"WALK",
+ "SKID",
"RUN_",
"DASH",
"PAIN",
@@ -474,10 +479,118 @@ char spr2names[NUMPLAYERSPRITES][5] =
"DRLB",
"DRLC",
+ "TAL0",
+ "TAL1",
+ "TAL2",
+ "TAL3",
+ "TAL4",
+ "TAL5",
+ "TAL6",
+ "TAL7",
+ "TAL8",
+ "TAL9",
+ "TALA",
+ "TALB",
+
"SIGN",
"LIFE"
};
-enum playersprite free_spr2 = SPR2_FIRSTFREESLOT;
+playersprite_t free_spr2 = SPR2_FIRSTFREESLOT;
+
+playersprite_t spr2defaults[NUMPLAYERSPRITES] = {
+ 0, // SPR2_STND,
+ 0, // SPR2_WAIT,
+ 0, // SPR2_WALK,
+ SPR2_WALK, // SPR2_SKID,
+ SPR2_WALK, // SPR2_RUN ,
+ SPR2_FRUN, // SPR2_DASH,
+ 0, // SPR2_PAIN,
+ SPR2_PAIN, // SPR2_STUN,
+ SPR2_PAIN, // SPR2_DEAD,
+ SPR2_DEAD, // SPR2_DRWN,
+ 0, // SPR2_ROLL,
+ SPR2_SPNG, // SPR2_GASP,
+ 0, // SPR2_JUMP, (conditional)
+ SPR2_FALL, // SPR2_SPNG,
+ SPR2_WALK, // SPR2_FALL,
+ 0, // SPR2_EDGE,
+ SPR2_FALL, // SPR2_RIDE,
+
+ SPR2_ROLL, // SPR2_SPIN,
+
+ SPR2_SPNG, // SPR2_FLY ,
+ SPR2_FLY , // SPR2_SWIM,
+ 0, // SPR2_TIRE, (conditional)
+
+ SPR2_FLY , // SPR2_GLID,
+ SPR2_CLMB, // SPR2_CLNG,
+ SPR2_ROLL, // SPR2_CLMB,
+
+ SPR2_WALK, // SPR2_FLT ,
+ SPR2_RUN , // SPR2_FRUN,
+
+ SPR2_FALL, // SPR2_BNCE,
+ SPR2_ROLL, // SPR2_BLND,
+
+ 0, // SPR2_FIRE,
+
+ SPR2_ROLL, // SPR2_TWIN,
+
+ SPR2_TWIN, // SPR2_MLEE,
+ 0, // SPR2_MLEL,
+
+ 0, // SPR2_TRNS,
+
+ FF_SPR2SUPER|SPR2_STND, // SPR2_NSTD,
+ FF_SPR2SUPER|SPR2_FLT , // SPR2_NFLT,
+ FF_SPR2SUPER|SPR2_STUN, // SPR2_NSTN,
+ SPR2_NSTN, // SPR2_NPUL,
+ FF_SPR2SUPER|SPR2_ROLL, // SPR2_NATK,
+
+ 0, // SPR2_NGT0, (should never be referenced)
+ SPR2_NGT0, // SPR2_NGT1,
+ SPR2_NGT1, // SPR2_NGT2,
+ SPR2_NGT2, // SPR2_NGT3,
+ SPR2_NGT3, // SPR2_NGT4,
+ SPR2_NGT4, // SPR2_NGT5,
+ SPR2_NGT5, // SPR2_NGT6,
+ SPR2_NGT0, // SPR2_NGT7,
+ SPR2_NGT7, // SPR2_NGT8,
+ SPR2_NGT8, // SPR2_NGT9,
+ SPR2_NGT9, // SPR2_NGTA,
+ SPR2_NGTA, // SPR2_NGTB,
+ SPR2_NGTB, // SPR2_NGTC,
+
+ SPR2_NGT0, // SPR2_DRL0,
+ SPR2_NGT1, // SPR2_DRL1,
+ SPR2_NGT2, // SPR2_DRL2,
+ SPR2_NGT3, // SPR2_DRL3,
+ SPR2_NGT4, // SPR2_DRL4,
+ SPR2_NGT5, // SPR2_DRL5,
+ SPR2_NGT6, // SPR2_DRL6,
+ SPR2_NGT7, // SPR2_DRL7,
+ SPR2_NGT8, // SPR2_DRL8,
+ SPR2_NGT9, // SPR2_DRL9,
+ SPR2_NGTA, // SPR2_DRLA,
+ SPR2_NGTB, // SPR2_DRLB,
+ SPR2_NGTC, // SPR2_DRLC,
+
+ 0, // SPR2_TAL0,
+ SPR2_TAL0, // SPR2_TAL1,
+ SPR2_TAL1, // SPR2_TAL2,
+ SPR2_TAL2, // SPR2_TAL3,
+ SPR2_TAL1, // SPR2_TAL4,
+ SPR2_TAL4, // SPR2_TAL5,
+ SPR2_TAL0, // SPR2_TAL6,
+ SPR2_TAL3, // SPR2_TAL7,
+ SPR2_TAL7, // SPR2_TAL8,
+ SPR2_TAL0, // SPR2_TAL9,
+ SPR2_TAL9, // SPR2_TALA,
+ SPR2_TAL0, // SPR2_TALB,
+
+ 0, // SPR2_SIGN,
+ 0, // SPR2_LIFE,
+};
// Doesn't work with g++, needs actionf_p1 (don't modify this comment)
state_t states[NUMSTATES] =
@@ -508,6 +621,7 @@ state_t states[NUMSTATES] =
{SPR_PLAY, SPR2_STND|FF_ANIMATE, 105, {NULL}, 0, 7, S_PLAY_WAIT}, // S_PLAY_STND
{SPR_PLAY, SPR2_WAIT|FF_ANIMATE, -1, {NULL}, 0, 16, S_NULL}, // S_PLAY_WAIT
{SPR_PLAY, SPR2_WALK, 4, {NULL}, 0, 0, S_PLAY_WALK}, // S_PLAY_WALK
+ {SPR_PLAY, SPR2_SKID, 1, {NULL}, 0, 0, S_PLAY_WALK}, // S_PLAY_SKID
{SPR_PLAY, SPR2_RUN , 2, {NULL}, 0, 0, S_PLAY_RUN}, // S_PLAY_RUN
{SPR_PLAY, SPR2_DASH, 2, {NULL}, 0, 0, S_PLAY_DASH}, // S_PLAY_DASH
{SPR_PLAY, SPR2_PAIN|FF_ANIMATE, 350, {NULL}, 0, 4, S_PLAY_FALL}, // S_PLAY_PAIN
@@ -556,15 +670,12 @@ state_t states[NUMSTATES] =
{SPR_PLAY, SPR2_MLEL, 35, {NULL}, 0, 0, S_PLAY_WALK}, // S_PLAY_MELEE_LANDING
// SF_SUPER
- {SPR_PLAY, SPR2_TRNS|FF_SPR2SUPER, 4, {NULL}, 0, 0, S_PLAY_SUPER_TRANS2}, // S_PLAY_SUPER_TRANS
- {SPR_PLAY, SPR2_TRNS|FF_SPR2SUPER, 4, {NULL}, 0, 0, S_PLAY_SUPER_TRANS3}, // S_PLAY_SUPER_TRANS2
- {SPR_PLAY, SPR2_TRNS|FF_SPR2SUPER|FF_FULLBRIGHT, 4, {NULL}, 0, 0, S_PLAY_SUPER_TRANS4}, // S_PLAY_SUPER_TRANS3
- {SPR_PLAY, SPR2_TRNS|FF_SPR2SUPER|FF_FULLBRIGHT, 3, {NULL}, 0, 0, S_PLAY_SUPER_TRANS5}, // S_PLAY_SUPER_TRANS4
- {SPR_PLAY, SPR2_TRNS|FF_SPR2SUPER|FF_FULLBRIGHT, 3, {NULL}, 0, 0, S_PLAY_SUPER_TRANS6}, // S_PLAY_SUPER_TRANS5
- {SPR_PLAY, SPR2_TRNS|FF_SPR2SUPER|FF_FULLBRIGHT, 3, {NULL}, 0, 0, S_PLAY_SUPER_TRANS7}, // S_PLAY_SUPER_TRANS6
- {SPR_PLAY, SPR2_TRNS|FF_SPR2SUPER|FF_FULLBRIGHT, 3, {NULL}, 0, 0, S_PLAY_SUPER_TRANS8}, // S_PLAY_SUPER_TRANS7
- {SPR_PLAY, SPR2_TRNS|FF_SPR2SUPER|FF_FULLBRIGHT, 3, {NULL}, 0, 0, S_PLAY_SUPER_TRANS9}, // S_PLAY_SUPER_TRANS8
- {SPR_PLAY, SPR2_TRNS|FF_SPR2SUPER|FF_FULLBRIGHT, 16, {NULL}, 0, 0, S_PLAY_WALK}, // S_PLAY_SUPER_TRANS9
+ {SPR_PLAY, SPR2_TRNS|FF_SPR2SUPER, 3, {NULL}, 0, 0, S_PLAY_SUPER_TRANS2}, // S_PLAY_SUPER_TRANS1
+ {SPR_PLAY, SPR2_TRNS|FF_SPR2SUPER, 3, {NULL}, 0, 0, S_PLAY_SUPER_TRANS3}, // S_PLAY_SUPER_TRANS2
+ {SPR_PLAY, SPR2_TRNS|FF_SPR2SUPER|FF_FULLBRIGHT, 2, {NULL}, 0, 0, S_PLAY_SUPER_TRANS4}, // S_PLAY_SUPER_TRANS3
+ {SPR_PLAY, SPR2_TRNS|FF_SPR2SUPER|FF_FULLBRIGHT, 2, {NULL}, 0, 0, S_PLAY_SUPER_TRANS5}, // S_PLAY_SUPER_TRANS4
+ {SPR_PLAY, SPR2_TRNS|FF_SPR2SUPER|FF_FULLBRIGHT, 2, {NULL}, 0, 0, S_PLAY_SUPER_TRANS6}, // S_PLAY_SUPER_TRANS5
+ {SPR_PLAY, SPR2_TRNS|FF_SPR2SUPER|FF_FULLBRIGHT, 20, {A_FadeOverlay}, 0, 0, S_PLAY_FALL}, // S_PLAY_SUPER_TRANS6
{SPR_NULL, 0, -1, {NULL}, 0, 0, S_OBJPLACE_DUMMY}, //S_OBJPLACE_DUMMY
@@ -579,15 +690,12 @@ state_t states[NUMSTATES] =
{SPR_PLAY, SPR2_SIGN, 1, {NULL}, 0, 24, S_PLAY_SIGN}, // S_PLAY_SIGN
// NiGHTS Player, transforming
- {SPR_PLAY, SPR2_TRNS, 4, {A_Scream}, 0, 0, S_PLAY_NIGHTS_TRANS2}, // S_PLAY_NIGHTS_TRANS
- {SPR_PLAY, SPR2_TRNS, 4, {NULL}, 0, 0, S_PLAY_NIGHTS_TRANS3}, // S_PLAY_NIGHTS_TRANS2
- {SPR_PLAY, SPR2_TRNS|FF_FULLBRIGHT, 4, {NULL}, 0, 0, S_PLAY_NIGHTS_TRANS4}, // S_PLAY_NIGHTS_TRANS3
- {SPR_PLAY, SPR2_TRNS, 3, {NULL}, 0, 0, S_PLAY_NIGHTS_TRANS5}, // S_PLAY_NIGHTS_TRANS4
- {SPR_PLAY, SPR2_TRNS, 3, {NULL}, 0, 0, S_PLAY_NIGHTS_TRANS6}, // S_PLAY_NIGHTS_TRANS5
- {SPR_PLAY, SPR2_TRNS, 3, {NULL}, 0, 0, S_PLAY_NIGHTS_TRANS7}, // S_PLAY_NIGHTS_TRANS6
- {SPR_PLAY, SPR2_TRNS, 3, {NULL}, 0, 0, S_PLAY_NIGHTS_TRANS8}, // S_PLAY_NIGHTS_TRANS7
- {SPR_PLAY, SPR2_TRNS, 3, {NULL}, 0, 0, S_PLAY_NIGHTS_TRANS9}, // S_PLAY_NIGHTS_TRANS8
- {SPR_PLAY, SPR2_TRNS, 16, {NULL}, 0, 0, S_PLAY_NIGHTS_FLOAT}, // S_PLAY_NIGHTS_TRANS9
+ {SPR_PLAY, SPR2_TRNS, 3, {NULL}, 0, 0, S_PLAY_NIGHTS_TRANS2}, // S_PLAY_NIGHTS_TRANS1
+ {SPR_PLAY, SPR2_TRNS, 3, {NULL}, 0, 0, S_PLAY_NIGHTS_TRANS3}, // S_PLAY_NIGHTS_TRANS2
+ {SPR_PLAY, SPR2_TRNS|FF_FULLBRIGHT, 2, {NULL}, 0, 0, S_PLAY_NIGHTS_TRANS4}, // S_PLAY_NIGHTS_TRANS3
+ {SPR_PLAY, SPR2_TRNS|FF_FULLBRIGHT, 2, {NULL}, 0, 0, S_PLAY_NIGHTS_TRANS5}, // S_PLAY_NIGHTS_TRANS4
+ {SPR_PLAY, SPR2_TRNS|FF_FULLBRIGHT, 2, {NULL}, 0, 0, S_PLAY_NIGHTS_TRANS6}, // S_PLAY_NIGHTS_TRANS5
+ {SPR_PLAY, SPR2_TRNS|FF_FULLBRIGHT, 25, {A_FadeOverlay}, 4, 0, S_PLAY_NIGHTS_FLOAT}, // S_PLAY_NIGHTS_TRANS5
// NiGHTS Player, stand, float, pain, pull and attack
{SPR_PLAY, SPR2_NSTD, 7, {NULL}, 0, 0, S_PLAY_NIGHTS_STAND}, // S_PLAY_NIGHTS_STAND
@@ -624,6 +732,20 @@ state_t states[NUMSTATES] =
{SPR_PLAY, SPR2_NGTC, 2, {NULL}, 0, 0, S_PLAY_NIGHTS_FLYC}, // S_PLAY_NIGHTS_FLYC
{SPR_PLAY, SPR2_DRLC, 2, {NULL}, 0, 0, S_PLAY_NIGHTS_DRILLC}, // S_PLAY_NIGHTS_DRILLC
+ // c:
+ {SPR_PLAY, SPR2_TAL0|FF_SPR2MIDSTART, 5, {NULL}, 0, 0, S_TAILSOVERLAY_STAND}, // S_TAILSOVERLAY_STAND
+ {SPR_PLAY, SPR2_TAL1|FF_SPR2MIDSTART, 35, {NULL}, 0, 0, S_TAILSOVERLAY_0DEGREES}, // S_TAILSOVERLAY_0DEGREES
+ {SPR_PLAY, SPR2_TAL2|FF_SPR2MIDSTART, 35, {NULL}, 0, 0, S_TAILSOVERLAY_PLUS30DEGREES}, // S_TAILSOVERLAY_PLUS30DEGREES
+ {SPR_PLAY, SPR2_TAL3|FF_SPR2MIDSTART, 35, {NULL}, 0, 0, S_TAILSOVERLAY_PLUS60DEGREES}, // S_TAILSOVERLAY_PLUS60DEGREES
+ {SPR_PLAY, SPR2_TAL4|FF_SPR2MIDSTART, 35, {NULL}, 0, 0, S_TAILSOVERLAY_MINUS30DEGREES}, // S_TAILSOVERLAY_MINUS30DEGREES
+ {SPR_PLAY, SPR2_TAL5|FF_SPR2MIDSTART, 35, {NULL}, 0, 0, S_TAILSOVERLAY_MINUS60DEGREES}, // S_TAILSOVERLAY_MINUS60DEGREES
+ {SPR_PLAY, SPR2_TAL6|FF_SPR2MIDSTART, 35, {NULL}, 0, 0, S_TAILSOVERLAY_RUN}, // S_TAILSOVERLAY_RUN
+ {SPR_PLAY, SPR2_TAL7|FF_SPR2MIDSTART, 4, {NULL}, 0, 0, S_TAILSOVERLAY_FLY}, // S_TAILSOVERLAY_FLY
+ {SPR_PLAY, SPR2_TAL8|FF_SPR2MIDSTART, 4, {NULL}, 0, 0, S_TAILSOVERLAY_TIRE}, // S_TAILSOVERLAY_TIRE
+ {SPR_PLAY, SPR2_TAL9|FF_SPR2MIDSTART, 35, {NULL}, 0, 0, S_TAILSOVERLAY_PAIN}, // S_TAILSOVERLAY_PAIN
+ {SPR_PLAY, SPR2_TALA|FF_SPR2MIDSTART, 35, {NULL}, 0, 0, S_TAILSOVERLAY_GASP}, // S_TAILSOVERLAY_GASP
+ {SPR_PLAY, SPR2_TALB , 35, {NULL}, 0, 0, S_TAILSOVERLAY_EDGE}, // S_TAILSOVERLAY_EDGE
+
// Blue Crawla
{SPR_POSS, 0, 5, {A_Look}, 0, 0, S_POSS_STND}, // S_POSS_STND
{SPR_POSS, 0, 3, {A_Chase}, 0, 0, S_POSS_RUN2}, // S_POSS_RUN1
@@ -1563,13 +1685,13 @@ state_t states[NUMSTATES] =
// Floor Spike
{SPR_USPK, 0,-1, {A_SpikeRetract}, 1, 0, S_SPIKE2}, // S_SPIKE1 -- Fully extended
- {SPR_USPK, 5, 2, {A_Pain}, 0, 0, S_SPIKE3}, // S_SPIKE2
- {SPR_USPK, 4, 2, {NULL}, 0, 0, S_SPIKE4}, // S_SPIKE3
+ {SPR_USPK, 1, 2, {A_Pain}, 0, 0, S_SPIKE3}, // S_SPIKE2
+ {SPR_USPK, 2, 2, {NULL}, 0, 0, S_SPIKE4}, // S_SPIKE3
{SPR_USPK, 3,-1, {A_SpikeRetract}, 0, 0, S_SPIKE5}, // S_SPIKE4 -- Fully retracted
- {SPR_USPK, 4, 2, {A_Pain}, 0, 0, S_SPIKE6}, // S_SPIKE5
- {SPR_USPK, 5, 2, {NULL}, 0, 0, S_SPIKE1}, // S_SPIKE6
- {SPR_USPK, 1,-1, {NULL}, 0, 0, S_NULL}, // S_SPIKED1 -- Busted spike particles
- {SPR_USPK, 2,-1, {NULL}, 0, 0, S_NULL}, // S_SPIKED2
+ {SPR_USPK, 2, 2, {A_Pain}, 0, 0, S_SPIKE6}, // S_SPIKE5
+ {SPR_USPK, 1, 2, {NULL}, 0, 0, S_SPIKE1}, // S_SPIKE6
+ {SPR_USPK, 4,-1, {NULL}, 0, 0, S_NULL}, // S_SPIKED1 -- Busted spike particles
+ {SPR_USPK, 5,-1, {NULL}, 0, 0, S_NULL}, // S_SPIKED2
// Wall Spike
{SPR_WSPK, 0|FF_PAPERSPRITE,-1, {A_SpikeRetract}, 1, 0, S_WALLSPIKE2}, // S_WALLSPIKE1 -- Fully extended
@@ -1579,6 +1701,8 @@ state_t states[NUMSTATES] =
{SPR_WSPK, 2|FF_PAPERSPRITE, 2, {A_Pain}, 0, 0, S_WALLSPIKE6}, // S_WALLSPIKE5
{SPR_WSPK, 1|FF_PAPERSPRITE, 2, {NULL}, 0, 0, S_WALLSPIKE1}, // S_WALLSPIKE6
{SPR_WSPB, 0|FF_PAPERSPRITE,-1, {NULL}, 0, 0, S_NULL}, // S_WALLSPIKEBASE -- Base
+ {SPR_WSPK, 4,-1, {NULL}, 0, 0, S_NULL}, // S_WALLSPIKED1 -- Busted spike particles
+ {SPR_WSPK, 5,-1, {NULL}, 0, 0, S_NULL}, // S_WALLSPIKED2
// Starpost
{SPR_STPT, 0 , -1, {NULL}, 0, 0, S_NULL}, // S_STARPOST_IDLE
@@ -1673,22 +1797,22 @@ state_t states[NUMSTATES] =
{SPR_TVRI, 2, 18, {A_RingBox}, 0, 0, S_NULL}, // S_RING_ICON2
{SPR_TVPI, FF_ANIMATE|2, 18, {NULL}, 3, 4, S_PITY_ICON2}, // S_PITY_ICON1
- {SPR_TVPI, 2, 18, {A_PityShield}, 0, 0, S_NULL}, // S_PITY_ICON2
+ {SPR_TVPI, 2, 18, {A_GiveShield}, SH_PITY, 0, S_NULL}, // S_PITY_ICON2
{SPR_TVAT, FF_ANIMATE|2, 18, {NULL}, 3, 4, S_ATTRACT_ICON2}, // S_ATTRACT_ICON1
- {SPR_TVAT, 2, 18, {A_RingShield},0, 0, S_NULL}, // S_ATTRACT_ICON2
+ {SPR_TVAT, 2, 18, {A_GiveShield}, SH_ATTRACT, 0, S_NULL}, // S_ATTRACT_ICON2
{SPR_TVFO, FF_ANIMATE|2, 18, {NULL}, 3, 4, S_FORCE_ICON2}, // S_FORCE_ICON1
- {SPR_TVFO, 2, 18, {A_ForceShield}, 1, 0, S_NULL}, // S_FORCE_ICON2
+ {SPR_TVFO, 2, 18, {A_GiveShield}, SH_FORCE|1, 0, S_NULL}, // S_FORCE_ICON2
{SPR_TVAR, FF_ANIMATE|2, 18, {NULL}, 3, 4, S_ARMAGEDDON_ICON2}, // S_ARMAGEDDON_ICON1
- {SPR_TVAR, 2, 18, {A_BombShield}, 0, 0, S_NULL}, // S_ARMAGEDDON_ICON2
+ {SPR_TVAR, 2, 18, {A_GiveShield}, SH_ARMAGEDDON, 0, S_NULL}, // S_ARMAGEDDON_ICON2
{SPR_TVWW, FF_ANIMATE|2, 18, {NULL}, 3, 4, S_WHIRLWIND_ICON2}, // S_WHIRLWIND_ICON1
- {SPR_TVWW, 2, 18, {A_JumpShield}, 0, 0, S_NULL}, // S_WHIRLWIND_ICON2
+ {SPR_TVWW, 2, 18, {A_GiveShield}, SH_WHIRLWIND, 0, S_NULL}, // S_WHIRLWIND_ICON2
{SPR_TVEL, FF_ANIMATE|2, 18, {NULL}, 3, 4, S_ELEMENTAL_ICON2}, // S_ELEMENTAL_ICON1
- {SPR_TVEL, 2, 18, {A_WaterShield}, 0, 0, S_NULL}, // S_ELEMENTAL_ICON2
+ {SPR_TVEL, 2, 18, {A_GiveShield}, SH_ELEMENTAL, 0, S_NULL}, // S_ELEMENTAL_ICON2
{SPR_TVSS, FF_ANIMATE|2, 18, {NULL}, 3, 4, S_SNEAKERS_ICON2}, // S_SNEAKERS_ICON1
{SPR_TVSS, 2, 18, {A_SuperSneakers}, 0, 0, S_NULL}, // S_SNEAKERS_ICON2
@@ -1718,13 +1842,13 @@ state_t states[NUMSTATES] =
{SPR_TVTK, 2, 18, {A_AwardScore}, 0, 0, S_NULL}, // S_SCORE10K_ICON2
{SPR_TVFL, FF_ANIMATE|2, 18, {NULL}, 3, 4, S_FLAMEAURA_ICON2}, // S_FLAMEAURA_ICON1
- {SPR_TVFL, 2, 18, {A_FlameShield}, 0, 0, S_NULL}, // S_FLAMEAURA_ICON2
+ {SPR_TVFL, 2, 18, {A_GiveShield}, SH_FLAMEAURA, 0, S_NULL}, // S_FLAMEAURA_ICON2
{SPR_TVBB, FF_ANIMATE|2, 18, {NULL}, 3, 4, S_BUBBLEWRAP_ICON2}, // S_BUBBLEWRAP_ICON1
- {SPR_TVBB, 2, 18, {A_BubbleShield}, 0, 0, S_NULL}, // S_BUBBLERWAP_ICON2
+ {SPR_TVBB, 2, 18, {A_GiveShield}, SH_BUBBLEWRAP, 0, S_NULL}, // S_BUBBLERWAP_ICON2
{SPR_TVZP, FF_ANIMATE|2, 18, {NULL}, 3, 4, S_THUNDERCOIN_ICON2}, // S_THUNDERCOIN_ICON1
- {SPR_TVZP, 2, 18, {A_ThunderShield}, 0, 0, S_NULL}, // S_THUNDERCOIN_ICON2
+ {SPR_TVZP, 2, 18, {A_GiveShield}, SH_THUNDERCOIN, 0, S_NULL}, // S_THUNDERCOIN_ICON2
// ---
@@ -1828,13 +1952,13 @@ state_t states[NUMSTATES] =
{SPR_CHAN, 0, -1, {NULL}, 0, 0, S_NULL}, // S_CEZCHAIN
// Flame
- {SPR_FLAM, FF_FULLBRIGHT|FF_TRANS20, 3, {A_FlameParticle}, 3, 0, S_FLAME2}, // S_FLAME1
- {SPR_FLAM, FF_FULLBRIGHT|FF_TRANS20|1, 3, {NULL}, 0, 0, S_FLAME3}, // S_FLAME2
- {SPR_FLAM, FF_FULLBRIGHT|FF_TRANS20|2, 3, {A_FlameParticle}, 3, 0, S_FLAME4}, // S_FLAME3
- {SPR_FLAM, FF_FULLBRIGHT|FF_TRANS20|3, 3, {NULL}, 0, 0, S_FLAME5}, // S_FLAME4
- {SPR_FLAM, FF_FULLBRIGHT|FF_TRANS20|4, 3, {A_FlameParticle}, 3, 0, S_FLAME6}, // S_FLAME5
- {SPR_FLAM, FF_FULLBRIGHT|FF_TRANS20|5, 3, {NULL}, 0, 0, S_FLAME1}, // S_FLAME6
- {SPR_FLAM, FF_FULLBRIGHT|FF_TRANS10|6, 24, {NULL}, 0, 0, S_NULL}, // S_FLAMEPARTICLE
+ {SPR_FLAM, FF_FULLBRIGHT|FF_TRANS20, 3, {A_FlameParticle}, 3, FRACUNIT/2, S_FLAME2}, // S_FLAME1
+ {SPR_FLAM, FF_FULLBRIGHT|FF_TRANS20|1, 3, {NULL}, 0, 0 , S_FLAME3}, // S_FLAME2
+ {SPR_FLAM, FF_FULLBRIGHT|FF_TRANS20|2, 3, {A_FlameParticle}, 3, FRACUNIT/2, S_FLAME4}, // S_FLAME3
+ {SPR_FLAM, FF_FULLBRIGHT|FF_TRANS20|3, 3, {NULL}, 0, 0 , S_FLAME5}, // S_FLAME4
+ {SPR_FLAM, FF_FULLBRIGHT|FF_TRANS20|4, 3, {A_FlameParticle}, 3, FRACUNIT/2, S_FLAME6}, // S_FLAME5
+ {SPR_FLAM, FF_FULLBRIGHT|FF_TRANS20|5, 3, {NULL}, 0, 0 , S_FLAME1}, // S_FLAME6
+ {SPR_FLAM, FF_FULLBRIGHT|FF_TRANS10|6, 24, {NULL}, 0, 0 , S_NULL}, // S_FLAMEPARTICLE
{SPR_FLAM, FF_FULLBRIGHT|FF_TRANS20|FF_ANIMATE, -1, {NULL}, 5, 3, S_FLAME2}, // S_FLAMEREST
@@ -1845,31 +1969,75 @@ state_t states[NUMSTATES] =
{SPR_NULL, 0, -1, {NULL}, 0, 0, S_SLING2}, // S_SLING1
{SPR_NULL, 0, -1, {A_SlingAppear}, 0, 0, S_NULL}, // S_SLING2
- // Small Mace Chain
- {SPR_SMCH, 0, 1, {A_MaceRotate}, 0, 0, S_SMALLMACECHAIN}, // S_SMALLMACECHAIN
+ // CEZ maces and chains
+ {SPR_SMCH, 0, -1, {NULL}, 0, 0, S_SMALLMACECHAIN}, // S_SMALLMACECHAIN
+ {SPR_BMCH, 0, -1, {NULL}, 0, 0, S_BIGMACECHAIN}, // S_BIGMACECHAIN
+ {SPR_SMCE, 0, -1, {NULL}, 0, 0, S_SMALLMACE}, // S_SMALLMACE
+ {SPR_BMCE, 0, -1, {NULL}, 0, 0, S_BIGMACE}, // S_BIGMACE
- // Big Mace Chain
- {SPR_BMCH, 0, 1, {A_MaceRotate}, 0, 0, S_BIGMACECHAIN}, // S_BIGMACECHAIN
+ // Yellow spring on a ball
+ {SPR_YSPB, 0, -1, {NULL}, 0, 0, S_NULL}, // S_YELLOWSPRINGBALL
+ {SPR_YSPB, 4, 4, {A_Pain}, 0, 0, S_YELLOWSPRINGBALL3}, // S_YELLOWSPRINGBALL2
+ {SPR_YSPB, 3, 1, {NULL}, 0, 0, S_YELLOWSPRINGBALL4}, // S_YELLOWSPRINGBALL3
+ {SPR_YSPB, 2, 1, {NULL}, 0, 0, S_YELLOWSPRINGBALL5}, // S_YELLOWSPRINGBALL4
+ {SPR_YSPB, 1, 1, {NULL}, 0, 0, S_YELLOWSPRINGBALL}, // S_YELLOWSPRINGBALL5
- // Small Mace
- {SPR_SMCE, 0, 1, {A_MaceRotate}, 0, 0, S_SMALLMACE}, // S_SMALLMACE
+ // Red spring on a ball
+ {SPR_RSPB, 0, -1, {NULL}, 0, 0, S_NULL}, // S_REDSPRINGBALL
+ {SPR_RSPB, 4, 4, {A_Pain}, 0, 0, S_REDSPRINGBALL3}, // S_REDSPRINGBALL2
+ {SPR_RSPB, 3, 1, {NULL}, 0, 0, S_REDSPRINGBALL4}, // S_REDSPRINGBALL3
+ {SPR_RSPB, 2, 1, {NULL}, 0, 0, S_REDSPRINGBALL5}, // S_REDSPRINGBALL4
+ {SPR_RSPB, 1, 1, {NULL}, 0, 0, S_REDSPRINGBALL}, // S_REDSPRINGBALL5
- // Big Mace
- {SPR_BMCE, 0, 1, {A_MaceRotate}, 0, 0, S_BIGMACE}, // S_BIGMACE
+ // Small Firebar
+ {SPR_SFBR, FF_FULLBRIGHT|FF_TRANS20, 1, {A_FlameParticle}, 3, FRACUNIT/3, S_SMALLFIREBAR2}, // S_SMALLFIREBAR1
+ {SPR_SFBR, FF_FULLBRIGHT|FF_TRANS20| 1, 1, {NULL}, 0, 0, S_SMALLFIREBAR3}, // S_SMALLFIREBAR2
+ {SPR_SFBR, FF_FULLBRIGHT|FF_TRANS20| 2, 1, {A_FlameParticle}, 3, FRACUNIT/3, S_SMALLFIREBAR4}, // S_SMALLFIREBAR3
+ {SPR_SFBR, FF_FULLBRIGHT|FF_TRANS20| 3, 1, {NULL}, 0, 0, S_SMALLFIREBAR5}, // S_SMALLFIREBAR4
+ {SPR_SFBR, FF_FULLBRIGHT|FF_TRANS20| 4, 1, {A_FlameParticle}, 3, FRACUNIT/3, S_SMALLFIREBAR6}, // S_SMALLFIREBAR5
+ {SPR_SFBR, FF_FULLBRIGHT|FF_TRANS20| 5, 1, {NULL}, 0, 0, S_SMALLFIREBAR7}, // S_SMALLFIREBAR6
+ {SPR_SFBR, FF_FULLBRIGHT|FF_TRANS20| 6, 1, {A_FlameParticle}, 3, FRACUNIT/3, S_SMALLFIREBAR8}, // S_SMALLFIREBAR7
+ {SPR_SFBR, FF_FULLBRIGHT|FF_TRANS20| 7, 1, {NULL}, 0, 0, S_SMALLFIREBAR9}, // S_SMALLFIREBAR8
+ {SPR_SFBR, FF_FULLBRIGHT|FF_TRANS20| 8, 1, {A_FlameParticle}, 3, FRACUNIT/3, S_SMALLFIREBAR10}, // S_SMALLFIREBAR9
+ {SPR_SFBR, FF_FULLBRIGHT|FF_TRANS20| 9, 1, {NULL}, 0, 0, S_SMALLFIREBAR11}, // S_SMALLFIREBAR10
+ {SPR_SFBR, FF_FULLBRIGHT|FF_TRANS20|10, 1, {A_FlameParticle}, 3, FRACUNIT/3, S_SMALLFIREBAR12}, // S_SMALLFIREBAR11
+ {SPR_SFBR, FF_FULLBRIGHT|FF_TRANS20|11, 1, {NULL}, 0, 0, S_SMALLFIREBAR13}, // S_SMALLFIREBAR12
+ {SPR_SFBR, FF_FULLBRIGHT|FF_TRANS20|12, 1, {A_FlameParticle}, 3, FRACUNIT/3, S_SMALLFIREBAR14}, // S_SMALLFIREBAR13
+ {SPR_SFBR, FF_FULLBRIGHT|FF_TRANS20|13, 1, {NULL}, 0, 0, S_SMALLFIREBAR15}, // S_SMALLFIREBAR14
+ {SPR_SFBR, FF_FULLBRIGHT|FF_TRANS20|14, 1, {A_FlameParticle}, 3, FRACUNIT/3, S_SMALLFIREBAR16}, // S_SMALLFIREBAR15
+ {SPR_SFBR, FF_FULLBRIGHT|FF_TRANS20|15, 1, {NULL}, 0, 0, S_SMALLFIREBAR1}, // S_SMALLFIREBAR16
+
+ // Big Firebar
+ {SPR_BFBR, FF_FULLBRIGHT|FF_TRANS20, 1, {A_FlameParticle}, 3, FRACUNIT/2, S_BIGFIREBAR2}, // S_BIGFIREBAR1
+ {SPR_BFBR, FF_FULLBRIGHT|FF_TRANS20| 1, 1, {NULL}, 0, 0, S_BIGFIREBAR3}, // S_BIGFIREBAR2
+ {SPR_BFBR, FF_FULLBRIGHT|FF_TRANS20| 2, 1, {A_FlameParticle}, 3, FRACUNIT/2, S_BIGFIREBAR4}, // S_BIGFIREBAR3
+ {SPR_BFBR, FF_FULLBRIGHT|FF_TRANS20| 3, 1, {NULL}, 0, 0, S_BIGFIREBAR5}, // S_BIGFIREBAR4
+ {SPR_BFBR, FF_FULLBRIGHT|FF_TRANS20| 4, 1, {A_FlameParticle}, 3, FRACUNIT/2, S_BIGFIREBAR6}, // S_BIGFIREBAR5
+ {SPR_BFBR, FF_FULLBRIGHT|FF_TRANS20| 5, 1, {NULL}, 0, 0, S_BIGFIREBAR7}, // S_BIGFIREBAR6
+ {SPR_BFBR, FF_FULLBRIGHT|FF_TRANS20| 6, 1, {A_FlameParticle}, 3, FRACUNIT/2, S_BIGFIREBAR8}, // S_BIGFIREBAR7
+ {SPR_BFBR, FF_FULLBRIGHT|FF_TRANS20| 7, 1, {NULL}, 0, 0, S_BIGFIREBAR9}, // S_BIGFIREBAR8
+ {SPR_BFBR, FF_FULLBRIGHT|FF_TRANS20| 8, 1, {A_FlameParticle}, 3, FRACUNIT/2, S_BIGFIREBAR10}, // S_BIGFIREBAR9
+ {SPR_BFBR, FF_FULLBRIGHT|FF_TRANS20| 9, 1, {NULL}, 0, 0, S_BIGFIREBAR11}, // S_BIGFIREBAR10
+ {SPR_BFBR, FF_FULLBRIGHT|FF_TRANS20|10, 1, {A_FlameParticle}, 3, FRACUNIT/2, S_BIGFIREBAR12}, // S_BIGFIREBAR11
+ {SPR_BFBR, FF_FULLBRIGHT|FF_TRANS20|11, 1, {NULL}, 0, 0, S_BIGFIREBAR13}, // S_BIGFIREBAR12
+ {SPR_BFBR, FF_FULLBRIGHT|FF_TRANS20|12, 1, {A_FlameParticle}, 3, FRACUNIT/2, S_BIGFIREBAR14}, // S_BIGFIREBAR13
+ {SPR_BFBR, FF_FULLBRIGHT|FF_TRANS20|13, 1, {NULL}, 0, 0, S_BIGFIREBAR15}, // S_BIGFIREBAR14
+ {SPR_BFBR, FF_FULLBRIGHT|FF_TRANS20|14, 1, {A_FlameParticle}, 3, FRACUNIT/2, S_BIGFIREBAR16}, // S_BIGFIREBAR15
+ {SPR_BFBR, FF_FULLBRIGHT|FF_TRANS20|15, 1, {NULL}, 0, 0, S_BIGFIREBAR1}, // S_BIGFIREBAR16
// CEZ Flower
{SPR_FWR4, 0, -1, {NULL}, 0, 0, S_NULL}, // S_CEZFLOWER1
// Big Tumbleweed
- {SPR_BTBL, 0, -1, {NULL}, 0, 0, S_NULL}, // S_BIGTUMBLEWEED
- {SPR_BTBL, 0, 5, {NULL}, 0, 0, S_BIGTUMBLEWEED_ROLL2}, // S_BIGTUMBLEWEED_ROLL1
- {SPR_BTBL, 1, 5, {NULL}, 0, 0, S_BIGTUMBLEWEED_ROLL3}, // S_BIGTUMBLEWEED_ROLL2
- {SPR_BTBL, 2, 5, {NULL}, 0, 0, S_BIGTUMBLEWEED_ROLL4}, // S_BIGTUMBLEWEED_ROLL3
- {SPR_BTBL, 3, 5, {NULL}, 0, 0, S_BIGTUMBLEWEED_ROLL5}, // S_BIGTUMBLEWEED_ROLL4
- {SPR_BTBL, 4, 5, {NULL}, 0, 0, S_BIGTUMBLEWEED_ROLL6}, // S_BIGTUMBLEWEED_ROLL5
- {SPR_BTBL, 5, 5, {NULL}, 0, 0, S_BIGTUMBLEWEED_ROLL7}, // S_BIGTUMBLEWEED_ROLL6
- {SPR_BTBL, 6, 5, {NULL}, 0, 0, S_BIGTUMBLEWEED_ROLL8}, // S_BIGTUMBLEWEED_ROLL7
- {SPR_BTBL, 7, 5, {NULL}, 0, 0, S_BIGTUMBLEWEED_ROLL1}, // S_BIGTUMBLEWEED_ROLL8
+ {SPR_BTBL, 0, -1, {NULL}, 0, 0, S_NULL}, // S_BIGTUMBLEWEED
+ {SPR_BTBL, 0, 5, {NULL}, 0, 0, S_BIGTUMBLEWEED_ROLL2}, // S_BIGTUMBLEWEED_ROLL1
+ {SPR_BTBL, 1, 5, {NULL}, 0, 0, S_BIGTUMBLEWEED_ROLL3}, // S_BIGTUMBLEWEED_ROLL2
+ {SPR_BTBL, 2, 5, {NULL}, 0, 0, S_BIGTUMBLEWEED_ROLL4}, // S_BIGTUMBLEWEED_ROLL3
+ {SPR_BTBL, 3, 5, {NULL}, 0, 0, S_BIGTUMBLEWEED_ROLL5}, // S_BIGTUMBLEWEED_ROLL4
+ {SPR_BTBL, 4, 5, {NULL}, 0, 0, S_BIGTUMBLEWEED_ROLL6}, // S_BIGTUMBLEWEED_ROLL5
+ {SPR_BTBL, 5, 5, {NULL}, 0, 0, S_BIGTUMBLEWEED_ROLL7}, // S_BIGTUMBLEWEED_ROLL6
+ {SPR_BTBL, 6, 5, {NULL}, 0, 0, S_BIGTUMBLEWEED_ROLL8}, // S_BIGTUMBLEWEED_ROLL7
+ {SPR_BTBL, 7, 5, {NULL}, 0, 0, S_BIGTUMBLEWEED_ROLL1}, // S_BIGTUMBLEWEED_ROLL8
// Little Tumbleweed
{SPR_STBL, 0, -1, {NULL}, 0, 0, S_NULL}, // S_LITTLETUMBLEWEED
@@ -2531,7 +2699,7 @@ state_t states[NUMSTATES] =
// Particle sprite
{SPR_PRTL, FF_FULLBRIGHT|FF_TRANS70, 2*TICRATE, {NULL}, 0, 0, S_NULL}, // S_PARTICLE
- {SPR_NULL, 0, 1, {A_ParticleSpawn}, 0, 0, S_PARTICLEGEN}, // S_PARTICLEGEN
+ {SPR_NULL, 0, 3, {A_ParticleSpawn}, 0, 0, S_PARTICLEGEN}, // S_PARTICLEGEN
{SPR_SCOR, 0, 32, {A_ScoreRise}, 0, 0, S_NULL}, // S_SCRA - 100
{SPR_SCOR, 1, 32, {A_ScoreRise}, 0, 0, S_NULL}, // S_SCRB - 200
@@ -2894,16 +3062,11 @@ state_t states[NUMSTATES] =
{SPR_NWNG, 1, -1, {NULL}, 0, 0, S_NULL}, // S_NIGHTSWING_XMAS
// NiGHTS Paraloop Powerups
- {SPR_NULL, 0, -1, {NULL}, 0, 0, S_NULL}, // S_NIGHTSPOWERUP1
- {SPR_NPRU, 0, -1, {NULL}, 0, 0, S_NULL}, // S_NIGHTSPOWERUP2
- {SPR_NULL, 0, -1, {NULL}, 0, 0, S_NULL}, // S_NIGHTSPOWERUP3
- {SPR_NPRU, 1, -1, {NULL}, 0, 0, S_NULL}, // S_NIGHTSPOWERUP4
- {SPR_NULL, 0, -1, {NULL}, 0, 0, S_NULL}, // S_NIGHTSPOWERUP5
- {SPR_NPRU, 2, -1, {NULL}, 0, 0, S_NULL}, // S_NIGHTSPOWERUP6
- {SPR_NULL, 0, -1, {NULL}, 0, 0, S_NULL}, // S_NIGHTSPOWERUP7
- {SPR_NPRU, 3, -1, {NULL}, 0, 0, S_NULL}, // S_NIGHTSPOWERUP8
- {SPR_NULL, 0, -1, {NULL}, 0, 0, S_NULL}, // S_NIGHTSPOWERUP9
- {SPR_NPRU, 4, -1, {NULL}, 0, 0, S_NULL}, // S_NIGHTSPOWERUP10
+ {SPR_NPRU, 0, -1, {NULL}, 0, 0, S_NULL}, // S_NIGHTSSUPERLOOP
+ {SPR_NPRU, 1, -1, {NULL}, 0, 0, S_NULL}, // S_NIGHTSDRILLREFILL
+ {SPR_NPRU, 2, -1, {NULL}, 0, 0, S_NULL}, // S_NIGHTSHELPER
+ {SPR_NPRU, 3, -1, {NULL}, 0, 0, S_NULL}, // S_NIGHTSEXTRATIME
+ {SPR_NPRU, 4, -1, {NULL}, 0, 0, S_NULL}, // S_NIGHTSLINKFREEZE
{SPR_CAPS, 0, -1, {NULL}, 0, 0, S_NULL}, // S_EGGCAPSULE
@@ -3106,6 +3269,33 @@ mobjinfo_t mobjinfo[NUMMOBJTYPES] =
(statenum_t)MT_NULL // raisestate
},
+ { // MT_TAILSOVERLAY
+ -1, // doomednum
+ S_INVISIBLE, // spawnstate
+ 1000, // spawnhealth
+ S_NULL, // seestate
+ sfx_None, // seesound
+ 8, // reactiontime
+ sfx_None, // attacksound
+ S_NULL, // painstate
+ 0, // painchance
+ sfx_None, // painsound
+ S_NULL, // meleestate
+ S_NULL, // missilestate
+ S_NULL, // deathstate
+ S_NULL, // xdeathstate
+ sfx_None, // deathsound
+ 8, // speed
+ 16*FRACUNIT, // radius
+ 48*FRACUNIT, // height
+ 2, // display offset
+ 16, // mass
+ 0, // damage
+ sfx_None, // activesound
+ MF_NOBLOCKMAP|MF_NOCLIP|MF_NOCLIPHEIGHT|MF_NOGRAVITY|MF_SCENERY, // flags
+ S_NULL // raisestate
+ },
+
{ // MT_BLUECRAWLA
100, // doomednum
S_POSS_STND, // spawnstate
@@ -5992,7 +6182,7 @@ mobjinfo_t mobjinfo[NUMMOBJTYPES] =
{ // MT_WALLSPIKE
522, // doomednum
- S_WALLSPIKE1, // spawnstate
+ S_WALLSPIKE1, // spawnstate
1000, // spawnhealth
S_NULL, // seestate
sfx_None, // seesound
@@ -6003,11 +6193,11 @@ mobjinfo_t mobjinfo[NUMMOBJTYPES] =
sfx_s3k64, // painsound
S_NULL, // meleestate
S_NULL, // missilestate
- S_NULL, // deathstate
- S_NULL, // xdeathstate
- sfx_None, // deathsound
+ S_WALLSPIKED1, // deathstate
+ S_WALLSPIKED2, // xdeathstate
+ sfx_mspogo, // deathsound
2*TICRATE, // speed
- 32*FRACUNIT, // radius
+ 16*FRACUNIT, // radius
14*FRACUNIT, // height
0, // display offset
4, // mass
@@ -6019,7 +6209,7 @@ mobjinfo_t mobjinfo[NUMMOBJTYPES] =
{ // MT_WALLSPIKEBASE
-1, // doomednum
- S_WALLSPIKEBASE, // spawnstate
+ S_WALLSPIKEBASE, // spawnstate
1000, // spawnhealth
S_NULL, // seestate
sfx_None, // seesound
@@ -8825,7 +9015,7 @@ mobjinfo_t mobjinfo[NUMMOBJTYPES] =
S_NULL // raisestate
},
- { // MT_SWINGMACEPOINT
+ { // MT_CHAINMACEPOINT
1105, // doomednum
S_INVISIBLE, // spawnstate
1000, // spawnhealth
@@ -8852,7 +9042,7 @@ mobjinfo_t mobjinfo[NUMMOBJTYPES] =
S_NULL // raisestate
},
- { // MT_HANGMACEPOINT
+ { // MT_SPRINGBALLPOINT
1106, // doomednum
S_INVISIBLE, // spawnstate
1000, // spawnhealth
@@ -8879,7 +9069,7 @@ mobjinfo_t mobjinfo[NUMMOBJTYPES] =
S_NULL // raisestate
},
- { // MT_SPINMACEPOINT
+ { // MT_CHAINPOINT
1107, // doomednum
S_INVISIBLE, // spawnstate
1000, // spawnhealth
@@ -8899,7 +9089,7 @@ mobjinfo_t mobjinfo[NUMMOBJTYPES] =
128*FRACUNIT, // radius
1*FRACUNIT, // height
0, // display offset
- 200, // mass
+ 10000, // mass
0, // damage
sfx_None, // activesound
MF_NOBLOCKMAP|MF_NOSECTOR|MF_NOCLIP|MF_NOGRAVITY|MF_NOCLIPHEIGHT, // flags
@@ -8933,6 +9123,60 @@ mobjinfo_t mobjinfo[NUMMOBJTYPES] =
S_NULL // raisestate
},
+ { // MT_FIREBARPOINT
+ 1109, // doomednum
+ S_INVISIBLE, // spawnstate
+ 1000, // spawnhealth
+ S_NULL, // seestate
+ sfx_None, // seesound
+ 0, // reactiontime
+ sfx_None, // attacksound
+ S_NULL, // painstate
+ 0, // painchance
+ sfx_None, // painsound
+ S_NULL, // meleestate
+ S_NULL, // missilestate
+ S_NULL, // deathstate
+ S_NULL, // xdeathstate
+ sfx_None, // deathsound
+ 10*FRACUNIT, // speed
+ 128*FRACUNIT, // radius
+ 1*FRACUNIT, // height
+ 0, // display offset
+ 200, // mass
+ 0, // damage
+ sfx_None, // activesound
+ MF_NOBLOCKMAP|MF_NOSECTOR|MF_NOCLIP|MF_NOGRAVITY|MF_NOCLIPHEIGHT, // flags
+ S_NULL // raisestate
+ },
+
+ { // MT_CUSTOMMACEPOINT
+ 1111, // doomednum
+ S_INVISIBLE, // spawnstate
+ 1000, // spawnhealth
+ S_NULL, // seestate
+ sfx_None, // seesound
+ 0, // reactiontime
+ sfx_None, // attacksound
+ S_NULL, // painstate
+ 0, // painchance
+ sfx_None, // painsound
+ S_NULL, // meleestate
+ S_NULL, // missilestate
+ S_NULL, // deathstate
+ S_NULL, // xdeathstate
+ sfx_None, // deathsound
+ 10*FRACUNIT, // speed
+ 128*FRACUNIT, // radius
+ 1*FRACUNIT, // height
+ 0, // display offset
+ 200, // mass
+ 0, // damage
+ sfx_None, // activesound
+ MF_NOBLOCKMAP|MF_NOSECTOR|MF_NOCLIP|MF_NOGRAVITY|MF_NOCLIPHEIGHT, // flags
+ S_NULL // raisestate
+ },
+
{ // MT_SMALLMACECHAIN
-1, // doomednum
S_SMALLMACECHAIN, // spawnstate
@@ -8956,7 +9200,7 @@ mobjinfo_t mobjinfo[NUMMOBJTYPES] =
100, // mass
1, // damage
sfx_None, // activesound
- MF_NOGRAVITY|MF_SPECIAL|MF_NOCLIPHEIGHT, // flags
+ MF_SCENERY|MF_SPECIAL|MF_NOGRAVITY, // flags
S_NULL // raisestate
},
@@ -8983,7 +9227,7 @@ mobjinfo_t mobjinfo[NUMMOBJTYPES] =
100, // mass
1, // damage
sfx_None, // activesound
- MF_NOGRAVITY|MF_SPECIAL|MF_NOCLIPHEIGHT, // flags
+ MF_SCENERY|MF_SPECIAL|MF_NOGRAVITY, // flags
S_NULL // raisestate
},
@@ -9006,11 +9250,11 @@ mobjinfo_t mobjinfo[NUMMOBJTYPES] =
24*FRACUNIT, // speed
17*FRACUNIT, // radius
34*FRACUNIT, // height
- 0, // display offset
+ 1, // display offset
100, // mass
1, // damage
sfx_mswing, // activesound
- MF_PAIN|MF_NOGRAVITY|MF_NOCLIPHEIGHT, // flags
+ MF_SCENERY|MF_PAIN|MF_NOGRAVITY, // flags
S_NULL // raisestate
},
@@ -9033,11 +9277,119 @@ mobjinfo_t mobjinfo[NUMMOBJTYPES] =
48*FRACUNIT, // speed
34*FRACUNIT, // radius
68*FRACUNIT, // height
- 0, // display offset
+ 1, // display offset
100, // mass
1, // damage
sfx_mswing, // activesound
- MF_PAIN|MF_NOGRAVITY|MF_NOCLIPHEIGHT, // flags
+ MF_SCENERY|MF_PAIN|MF_NOGRAVITY, // flags
+ S_NULL // raisestate
+ },
+
+ { // MT_YELLOWSPRINGBALL
+ -1, // doomednum
+ S_YELLOWSPRINGBALL, // spawnstate
+ 1000, // spawnhealth
+ S_YELLOWSPRINGBALL2, // 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
+ 24*FRACUNIT, // speed
+ 17*FRACUNIT, // radius
+ 34*FRACUNIT, // height
+ 1, // display offset
+ 20*FRACUNIT, // mass
+ 0, // damage
+ sfx_mswing, // activesound
+ MF_SCENERY|MF_SOLID|MF_SPRING|MF_NOGRAVITY, // flags
+ S_YELLOWSPRINGBALL2 // raisestate
+ },
+
+ { // MT_REDSPRINGBALL
+ -1, // doomednum
+ S_REDSPRINGBALL, // spawnstate
+ 1000, // spawnhealth
+ S_REDSPRINGBALL2, // 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
+ 24*FRACUNIT, // speed
+ 17*FRACUNIT, // radius
+ 34*FRACUNIT, // height
+ 1, // display offset
+ 32*FRACUNIT, // mass
+ 0, // damage
+ sfx_mswing, // activesound
+ MF_SCENERY|MF_SOLID|MF_SPRING|MF_NOGRAVITY, // flags
+ S_REDSPRINGBALL2 // raisestate
+ },
+
+ { // MT_SMALLFIREBAR
+ -1, // doomednum
+ S_SMALLFIREBAR1, // spawnstate
+ 1000, // spawnhealth
+ S_NULL, // seestate
+ sfx_None, // seesound
+ 8, // reactiontime
+ sfx_None, // attacksound
+ S_NULL, // painstate
+ MT_FLAMEPARTICLE, // painchance
+ sfx_None, // painsound
+ S_NULL, // meleestate
+ S_NULL, // missilestate
+ S_NULL, // deathstate
+ S_NULL, // xdeathstate
+ sfx_None, // deathsound
+ 24*FRACUNIT, // speed
+ 17*FRACUNIT, // radius
+ 34*FRACUNIT, // height
+ 0, // display offset
+ 100, // mass
+ 1, // damage
+ sfx_None, // activesound
+ MF_SCENERY|MF_PAIN|MF_FIRE|MF_NOGRAVITY, // flags
+ S_NULL // raisestate
+ },
+
+ { // MT_BIGFIREBAR
+ -1, // doomednum
+ S_BIGFIREBAR1, // spawnstate
+ 1000, // spawnhealth
+ S_NULL, // seestate
+ sfx_None, // seesound
+ 8, // reactiontime
+ sfx_None, // attacksound
+ S_NULL, // painstate
+ MT_FLAMEPARTICLE, // painchance
+ sfx_None, // painsound
+ S_NULL, // meleestate
+ S_NULL, // missilestate
+ S_NULL, // deathstate
+ S_NULL, // xdeathstate
+ sfx_None, // deathsound
+ 48*FRACUNIT, // speed
+ 34*FRACUNIT, // radius
+ 68*FRACUNIT, // height
+ 1, // display offset
+ 100, // mass
+ 1, // damage
+ sfx_None, // activesound
+ MF_SCENERY|MF_PAIN|MF_FIRE|MF_NOGRAVITY, // flags
S_NULL // raisestate
},
@@ -11412,7 +11764,7 @@ mobjinfo_t mobjinfo[NUMMOBJTYPES] =
SH_ELEMENTAL, // speed
64*FRACUNIT, // radius
64*FRACUNIT, // height
- 2, // display offset
+ 4, // display offset
16, // mass
0, // damage
sfx_None, // activesound
@@ -11439,7 +11791,7 @@ mobjinfo_t mobjinfo[NUMMOBJTYPES] =
SH_ATTRACT, // speed
64*FRACUNIT, // radius
64*FRACUNIT, // height
- 2, // display offset
+ 4, // display offset
16, // mass
0, // damage
sfx_None, // activesound
@@ -11466,7 +11818,7 @@ mobjinfo_t mobjinfo[NUMMOBJTYPES] =
SH_FORCE, // speed
64*FRACUNIT, // radius
64*FRACUNIT, // height
- 2, // display offset
+ 4, // display offset
16, // mass
0, // damage
sfx_None, // activesound
@@ -11493,7 +11845,7 @@ mobjinfo_t mobjinfo[NUMMOBJTYPES] =
SH_ARMAGEDDON, // speed
64*FRACUNIT, // radius
64*FRACUNIT, // height
- 2, // display offset
+ 4, // display offset
16, // mass
0, // damage
sfx_None, // activesound
@@ -11520,7 +11872,7 @@ mobjinfo_t mobjinfo[NUMMOBJTYPES] =
SH_WHIRLWIND, // speed
64*FRACUNIT, // radius
64*FRACUNIT, // height
- 2, // display offset
+ 4, // display offset
16, // mass
0, // damage
sfx_None, // activesound
@@ -11547,7 +11899,7 @@ mobjinfo_t mobjinfo[NUMMOBJTYPES] =
SH_PITY, // speed
64*FRACUNIT, // radius
64*FRACUNIT, // height
- 2, // display offset
+ 4, // display offset
16, // mass
0, // damage
sfx_None, // activesound
@@ -11574,7 +11926,7 @@ mobjinfo_t mobjinfo[NUMMOBJTYPES] =
SH_FLAMEAURA, // speed
64*FRACUNIT, // radius
64*FRACUNIT, // height
- -2, // display offset
+ -4, // display offset
16, // mass
0, // damage
sfx_None, // activesound
@@ -11601,7 +11953,7 @@ mobjinfo_t mobjinfo[NUMMOBJTYPES] =
SH_BUBBLEWRAP, // speed
64*FRACUNIT, // radius
64*FRACUNIT, // height
- 2, // display offset
+ 4, // display offset
16, // mass
0, // damage
sfx_None, // activesound
@@ -11628,7 +11980,7 @@ mobjinfo_t mobjinfo[NUMMOBJTYPES] =
SH_THUNDERCOIN, // speed
64*FRACUNIT, // radius
64*FRACUNIT, // height
- -2, // display offset
+ -4, // display offset
16, // mass
0, // damage
sfx_None, // activesound
@@ -14294,9 +14646,9 @@ mobjinfo_t mobjinfo[NUMMOBJTYPES] =
{ // MT_NIGHTSSUPERLOOP
1707, // doomednum
- S_NIGHTSPOWERUP1, // spawnstate
+ S_NIGHTSSUPERLOOP, // spawnstate
1000, // spawnhealth
- S_NIGHTSPOWERUP2, // seestate
+ S_NULL, // seestate
sfx_None, // seesound
0, // reactiontime
sfx_None, // attacksound
@@ -14321,9 +14673,9 @@ mobjinfo_t mobjinfo[NUMMOBJTYPES] =
{ // MT_NIGHTSDRILLREFILL
1708, // doomednum
- S_NIGHTSPOWERUP3, // spawnstate
+ S_NIGHTSDRILLREFILL, // spawnstate
1000, // spawnhealth
- S_NIGHTSPOWERUP4, // seestate
+ S_NULL, // seestate
sfx_None, // seesound
0, // reactiontime
sfx_None, // attacksound
@@ -14348,9 +14700,9 @@ mobjinfo_t mobjinfo[NUMMOBJTYPES] =
{ // MT_NIGHTSHELPER
1709, // doomednum
- S_NIGHTSPOWERUP5, // spawnstate
+ S_NIGHTSHELPER, // spawnstate
1000, // spawnhealth
- S_NIGHTSPOWERUP6, // seestate
+ S_NULL, // seestate
sfx_None, // seesound
0, // reactiontime
sfx_None, // attacksound
@@ -14375,9 +14727,9 @@ mobjinfo_t mobjinfo[NUMMOBJTYPES] =
{ // MT_NIGHTSEXTRATIME
1711, // doomednum
- S_NIGHTSPOWERUP7, // spawnstate
+ S_NIGHTSEXTRATIME, // spawnstate
1000, // spawnhealth
- S_NIGHTSPOWERUP8, // seestate
+ S_NULL, // seestate
sfx_None, // seesound
0, // reactiontime
sfx_None, // attacksound
@@ -14402,9 +14754,9 @@ mobjinfo_t mobjinfo[NUMMOBJTYPES] =
{ // MT_NIGHTSLINKFREEZE
1712, // doomednum
- S_NIGHTSPOWERUP9, // spawnstate
+ S_NIGHTSLINKFREEZE, // spawnstate
1000, // spawnhealth
- S_NIGHTSPOWERUP10, // seestate
+ S_NULL, // seestate
sfx_None, // seesound
0, // reactiontime
sfx_None, // attacksound
@@ -14666,7 +15018,7 @@ mobjinfo_t mobjinfo[NUMMOBJTYPES] =
0, // speed
16*FRACUNIT, // radius
48*FRACUNIT, // height
- 0, // display offset
+ 1, // display offset
1000, // mass
8, // damage
sfx_None, // activesound
diff --git a/src/info.h b/src/info.h
index 42fd63dff..ea2103393 100644
--- a/src/info.h
+++ b/src/info.h
@@ -40,8 +40,6 @@ void A_Scream();
void A_BossDeath();
void A_CustomPower(); // Use this for a custom power
void A_GiveWeapon(); // Gives the player weapon(s)
-void A_JumpShield(); // Obtained Jump Shield
-void A_RingShield(); // Obtained Ring Shield
void A_RingBox(); // Obtained Ring Box Tails
void A_Invincibility(); // Obtained Invincibility Box
void A_SuperSneakers(); // Obtained Super Sneakers Box
@@ -52,13 +50,7 @@ void A_BubbleRise(); // Bubbles float to surface
void A_BubbleCheck(); // Don't draw if not underwater
void A_AwardScore();
void A_ExtraLife(); // Extra Life
-void A_BombShield(); // Obtained Bomb Shield
-void A_WaterShield(); // Obtained Water Shield
-void A_ForceShield(); // Obtained Force Shield
-void A_PityShield(); // Obtained Pity Shield. We're... sorry.
-void A_FlameShield(); // Obtained Flame Shield
-void A_BubbleShield(); // Obtained Bubble Shield
-void A_ThunderShield(); // Obtained Thunder Shield
+void A_GiveShield(); // Obtained Shield
void A_GravityBox();
void A_ScoreRise(); // Rise the score logo
void A_ParticleSpawn();
@@ -84,7 +76,6 @@ void A_DetonChase(); // Deton Chaser
void A_CapeChase(); // Fake little Super Sonic cape
void A_RotateSpikeBall(); // Spike ball rotation
void A_SlingAppear();
-void A_MaceRotate();
void A_UnidusBall();
void A_RockSpawn();
void A_SetFuse();
@@ -225,6 +216,7 @@ void A_FlickyCheck();
void A_FlickyHeightCheck();
void A_FlickyFlutter();
void A_FlameParticle();
+void A_FadeOverlay();
// ratio of states to sprites to mobj types is roughly 6 : 1 : 1
#define NUMMOBJFREESLOTS 256
@@ -417,6 +409,10 @@ typedef enum sprite
SPR_BMCH, // Big Mace Chain
SPR_SMCE, // Small Mace
SPR_BMCE, // Big Mace
+ SPR_YSPB, // Yellow spring on a ball
+ SPR_RSPB, // Red spring on a ball
+ SPR_SFBR, // Small Firebar
+ SPR_BFBR, // Big Firebar
// Arid Canyon Scenery
SPR_BTBL, // Big tumbleweed
@@ -609,11 +605,12 @@ typedef enum sprite
// Make sure to be conscious of FF_FRAMEMASK and the fact sprite2 is stored as a UINT8 whenever you change this table.
// Currently, FF_FRAMEMASK is 0xff, or 255 - but the second half is used by FF_SPR2SUPER, so the limitation is 0x7f.
// Since this is zero-based, there can be at most 128 different SPR2_'s without changing that.
-enum playersprite
+typedef enum playersprite
{
SPR2_STND = 0,
SPR2_WAIT,
SPR2_WALK,
+ SPR2_SKID,
SPR2_RUN ,
SPR2_DASH,
SPR2_PAIN,
@@ -689,13 +686,27 @@ enum playersprite
SPR2_DRLB,
SPR2_DRLC,
+ // c:
+ SPR2_TAL0,
+ SPR2_TAL1,
+ SPR2_TAL2,
+ SPR2_TAL3,
+ SPR2_TAL4,
+ SPR2_TAL5,
+ SPR2_TAL6,
+ SPR2_TAL7,
+ SPR2_TAL8,
+ SPR2_TAL9,
+ SPR2_TALA,
+ SPR2_TALB,
+
SPR2_SIGN, // end sign head
SPR2_LIFE, // life monitor icon
SPR2_FIRSTFREESLOT,
SPR2_LASTFREESLOT = 0x7f,
NUMPLAYERSPRITES
-};
+} playersprite_t;
typedef enum state
{
@@ -718,6 +729,7 @@ typedef enum state
S_PLAY_STND,
S_PLAY_WAIT,
S_PLAY_WALK,
+ S_PLAY_SKID,
S_PLAY_RUN,
S_PLAY_DASH,
S_PLAY_PAIN,
@@ -766,15 +778,12 @@ typedef enum state
S_PLAY_MELEE_LANDING,
// SF_SUPER
- S_PLAY_SUPER_TRANS,
+ S_PLAY_SUPER_TRANS1,
S_PLAY_SUPER_TRANS2,
S_PLAY_SUPER_TRANS3,
S_PLAY_SUPER_TRANS4,
S_PLAY_SUPER_TRANS5,
S_PLAY_SUPER_TRANS6,
- S_PLAY_SUPER_TRANS7,
- S_PLAY_SUPER_TRANS8,
- S_PLAY_SUPER_TRANS9,
// technically the player goes here but it's an infinite tic state
S_OBJPLACE_DUMMY,
@@ -790,15 +799,12 @@ typedef enum state
S_PLAY_SIGN,
// NiGHTS character (uses player sprite)
- S_PLAY_NIGHTS_TRANS,
+ S_PLAY_NIGHTS_TRANS1,
S_PLAY_NIGHTS_TRANS2,
S_PLAY_NIGHTS_TRANS3,
S_PLAY_NIGHTS_TRANS4,
S_PLAY_NIGHTS_TRANS5,
S_PLAY_NIGHTS_TRANS6,
- S_PLAY_NIGHTS_TRANS7,
- S_PLAY_NIGHTS_TRANS8,
- S_PLAY_NIGHTS_TRANS9,
S_PLAY_NIGHTS_STAND,
S_PLAY_NIGHTS_FLOAT,
@@ -833,6 +839,20 @@ typedef enum state
S_PLAY_NIGHTS_FLYC,
S_PLAY_NIGHTS_DRILLC,
+ // c:
+ S_TAILSOVERLAY_STAND,
+ S_TAILSOVERLAY_0DEGREES,
+ S_TAILSOVERLAY_PLUS30DEGREES,
+ S_TAILSOVERLAY_PLUS60DEGREES,
+ S_TAILSOVERLAY_MINUS30DEGREES,
+ S_TAILSOVERLAY_MINUS60DEGREES,
+ S_TAILSOVERLAY_RUN,
+ S_TAILSOVERLAY_FLY,
+ S_TAILSOVERLAY_TIRE,
+ S_TAILSOVERLAY_PAIN,
+ S_TAILSOVERLAY_GASP,
+ S_TAILSOVERLAY_EDGE,
+
// Blue Crawla
S_POSS_STND,
S_POSS_RUN1,
@@ -1784,6 +1804,8 @@ typedef enum state
S_WALLSPIKE5,
S_WALLSPIKE6,
S_WALLSPIKEBASE,
+ S_WALLSPIKED1,
+ S_WALLSPIKED2,
// Starpost
S_STARPOST_IDLE,
@@ -2054,18 +2076,62 @@ typedef enum state
S_SLING1,
S_SLING2,
- // CEZ Small Mace Chain
+ // CEZ maces and chains
S_SMALLMACECHAIN,
-
- // CEZ Big Mace Chain
S_BIGMACECHAIN,
-
- // CEZ Small Mace
S_SMALLMACE,
-
- // CEZ Big Mace
S_BIGMACE,
+ // Yellow spring on a ball
+ S_YELLOWSPRINGBALL,
+ S_YELLOWSPRINGBALL2,
+ S_YELLOWSPRINGBALL3,
+ S_YELLOWSPRINGBALL4,
+ S_YELLOWSPRINGBALL5,
+
+ // Red spring on a ball
+ S_REDSPRINGBALL,
+ S_REDSPRINGBALL2,
+ S_REDSPRINGBALL3,
+ S_REDSPRINGBALL4,
+ S_REDSPRINGBALL5,
+
+ // Small Firebar
+ S_SMALLFIREBAR1,
+ S_SMALLFIREBAR2,
+ S_SMALLFIREBAR3,
+ S_SMALLFIREBAR4,
+ S_SMALLFIREBAR5,
+ S_SMALLFIREBAR6,
+ S_SMALLFIREBAR7,
+ S_SMALLFIREBAR8,
+ S_SMALLFIREBAR9,
+ S_SMALLFIREBAR10,
+ S_SMALLFIREBAR11,
+ S_SMALLFIREBAR12,
+ S_SMALLFIREBAR13,
+ S_SMALLFIREBAR14,
+ S_SMALLFIREBAR15,
+ S_SMALLFIREBAR16,
+
+ // Big Firebar
+ S_BIGFIREBAR1,
+ S_BIGFIREBAR2,
+ S_BIGFIREBAR3,
+ S_BIGFIREBAR4,
+ S_BIGFIREBAR5,
+ S_BIGFIREBAR6,
+ S_BIGFIREBAR7,
+ S_BIGFIREBAR8,
+ S_BIGFIREBAR9,
+ S_BIGFIREBAR10,
+ S_BIGFIREBAR11,
+ S_BIGFIREBAR12,
+ S_BIGFIREBAR13,
+ S_BIGFIREBAR14,
+ S_BIGFIREBAR15,
+ S_BIGFIREBAR16,
+
S_CEZFLOWER1,
// Big Tumbleweed
@@ -3039,16 +3105,11 @@ typedef enum state
S_NIGHTSWING_XMAS,
// NiGHTS Paraloop Powerups
- S_NIGHTSPOWERUP1,
- S_NIGHTSPOWERUP2,
- S_NIGHTSPOWERUP3,
- S_NIGHTSPOWERUP4,
- S_NIGHTSPOWERUP5,
- S_NIGHTSPOWERUP6,
- S_NIGHTSPOWERUP7,
- S_NIGHTSPOWERUP8,
- S_NIGHTSPOWERUP9,
- S_NIGHTSPOWERUP10,
+ S_NIGHTSSUPERLOOP,
+ S_NIGHTSDRILLREFILL,
+ S_NIGHTSHELPER,
+ S_NIGHTSEXTRATIME,
+ S_NIGHTSLINKFREEZE,
S_EGGCAPSULE,
// Orbiting Chaos Emeralds
@@ -3157,8 +3218,9 @@ typedef struct
extern state_t states[NUMSTATES];
extern char sprnames[NUMSPRITES + 1][5];
extern char spr2names[NUMPLAYERSPRITES][5];
+extern playersprite_t spr2defaults[NUMPLAYERSPRITES];
extern state_t *astate;
-extern enum playersprite free_spr2;
+extern playersprite_t free_spr2;
typedef enum mobj_type
{
@@ -3167,6 +3229,7 @@ typedef enum mobj_type
MT_THOK, // Thok! mobj
MT_PLAYER,
+ MT_TAILSOVERLAY, // c:
// Enemies
MT_BLUECRAWLA,
@@ -3424,14 +3487,20 @@ typedef enum mobj_type
MT_FLAMEPARTICLE,
MT_EGGSTATUE, // Eggman Statue
MT_MACEPOINT, // Mace rotation point
- MT_SWINGMACEPOINT, // Mace swinging point
- MT_HANGMACEPOINT, // Hangable mace chain
- MT_SPINMACEPOINT, // Spin/Controllable mace chain
+ MT_CHAINMACEPOINT, // Combination of chains and maces point
+ MT_SPRINGBALLPOINT, // Spring ball point
+ MT_CHAINPOINT, // Mace chain
MT_HIDDEN_SLING, // Spin mace chain (activatable)
+ MT_FIREBARPOINT, // Firebar
+ MT_CUSTOMMACEPOINT, // Custom mace
MT_SMALLMACECHAIN, // Small Mace Chain
MT_BIGMACECHAIN, // Big Mace Chain
MT_SMALLMACE, // Small Mace
MT_BIGMACE, // Big Mace
+ MT_YELLOWSPRINGBALL, // Yellow spring on a ball
+ MT_REDSPRINGBALL, // Red spring on a ball
+ MT_SMALLFIREBAR, // Small Firebar
+ MT_BIGFIREBAR, // Big Firebar
MT_CEZFLOWER,
// Arid Canyon Scenery
diff --git a/src/lua_baselib.c b/src/lua_baselib.c
index 93f2979fa..4d845df52 100644
--- a/src/lua_baselib.c
+++ b/src/lua_baselib.c
@@ -135,7 +135,7 @@ static const struct {
};
// goes through the above list and returns the utype string for the userdata type
-// returns "unknown" instead if we couldn't find the right userdata type
+// returns "unknown" instead if we couldn't find the right userdata type
static const char *GetUserdataUType(lua_State *L)
{
UINT8 i;
@@ -462,6 +462,8 @@ static int lib_pSpawnLockOn(lua_State *L)
return LUA_ErrInvalid(L, "mobj_t");
if (!player)
return LUA_ErrInvalid(L, "player_t");
+ if (state >= NUMSTATES)
+ return luaL_error(L, "state %d out of range (0 - %d)", state, NUMSTATES-1);
if (P_IsLocalPlayer(player)) // Only display it on your own view.
{
mobj_t *visual = P_SpawnMobj(lockon->x, lockon->y, lockon->z, MT_LOCKON); // positioning, flip handled in P_SceneryThinker
@@ -978,6 +980,19 @@ static int lib_pGivePlayerLives(lua_State *L)
return 0;
}
+static int lib_pGiveCoopLives(lua_State *L)
+{
+ player_t *player = *((player_t **)luaL_checkudata(L, 1, META_PLAYER));
+ INT32 numlives = (INT32)luaL_checkinteger(L, 2);
+ boolean sound = (boolean)lua_opttrueboolean(L, 3);
+ NOHUD
+ INLEVEL
+ if (!player)
+ return LUA_ErrInvalid(L, "player_t");
+ P_GiveCoopLives(player, numlives, sound);
+ return 0;
+}
+
static int lib_pResetScore(lua_State *L)
{
player_t *player = *((player_t **)luaL_checkudata(L, 1, META_PLAYER));
@@ -1183,6 +1198,18 @@ static int lib_pTelekinesis(lua_State *L)
return 0;
}
+static int lib_pSwitchShield(lua_State *L)
+{
+ player_t *player = *((player_t **)luaL_checkudata(L, 1, META_PLAYER));
+ UINT16 shield = luaL_checkinteger(L, 2);
+ NOHUD
+ INLEVEL
+ if (!player)
+ return LUA_ErrInvalid(L, "player_t");
+ P_SwitchShield(player, shield);
+ return 0;
+}
+
// P_MAP
///////////
@@ -2428,6 +2455,7 @@ static luaL_Reg lib[] = {
{"P_SpawnGhostMobj",lib_pSpawnGhostMobj},
{"P_GivePlayerRings",lib_pGivePlayerRings},
{"P_GivePlayerLives",lib_pGivePlayerLives},
+ {"P_GiveCoopLives",lib_pGiveCoopLives},
{"P_ResetScore",lib_pResetScore},
{"P_DoJumpShield",lib_pDoJumpShield},
{"P_DoBubbleBounce",lib_pDoBubbleBounce},
@@ -2445,6 +2473,7 @@ static luaL_Reg lib[] = {
{"P_SpawnThokMobj",lib_pSpawnThokMobj},
{"P_SpawnSpinMobj",lib_pSpawnSpinMobj},
{"P_Telekinesis",lib_pTelekinesis},
+ {"P_SwitchShield",lib_pSwitchShield},
// p_map
{"P_CheckPosition",lib_pCheckPosition},
diff --git a/src/lua_blockmaplib.c b/src/lua_blockmaplib.c
index ccd90f993..ebfd6a2df 100644
--- a/src/lua_blockmaplib.c
+++ b/src/lua_blockmaplib.c
@@ -254,7 +254,7 @@ static int lib_searchBlockmap(lua_State *L)
if (P_MobjWasRemoved(mobj)){ // ...unless the original object was removed
lua_pushboolean(L, false); // in which case we have to stop now regardless
return 1;
- }
+ }
}
lua_pushboolean(L, retval);
return 1;
diff --git a/src/lua_consolelib.c b/src/lua_consolelib.c
index 322fecb64..c82c39b46 100644
--- a/src/lua_consolelib.c
+++ b/src/lua_consolelib.c
@@ -22,8 +22,13 @@
#include "lua_libs.h"
#include "lua_hud.h" // hud_running errors
+// for functions not allowed in hud.add hooks
#define NOHUD if (hud_running)\
return luaL_error(L, "HUD rendering code should not call this function!");
+// for functions not allowed in hooks or coroutines (supercedes above)
+#define NOHOOK if (!lua_lumploading)\
+ return luaL_error(L, "This function cannot be called from within a hook or coroutine!");
+// for functions only allowed within a level
#define INLEVEL if (gamestate != GS_LEVEL)\
return luaL_error(L, "This function can only be used in a level!");
@@ -84,7 +89,7 @@ deny:
CONS_Alert(CONS_WARNING, M_GetText("Illegal lua command received from %s\n"), player_names[playernum]);
if (server)
{
- XBOXSTATIC UINT8 bufn[2];
+ UINT8 bufn[2];
bufn[0] = (UINT8)playernum;
bufn[1] = KICK_MSG_CON_FAIL;
@@ -184,7 +189,7 @@ static int lib_comAddCommand(lua_State *L)
strlwr(name);
luaL_checktype(L, 2, LUA_TFUNCTION);
- NOHUD
+ NOHOOK
if (lua_gettop(L) >= 3)
{ // For the third argument, only take a boolean or a number.
lua_settop(L, 3);
@@ -296,7 +301,7 @@ static int lib_cvRegisterVar(lua_State *L)
consvar_t *cvar;
luaL_checktype(L, 1, LUA_TTABLE);
lua_settop(L, 1); // Clear out all other possible arguments, leaving only the first one.
- NOHUD
+ NOHOOK
cvar = lua_newuserdata(L, sizeof(consvar_t));
luaL_getmetatable(L, META_CVAR);
lua_setmetatable(L, -2);
@@ -394,12 +399,21 @@ static int lib_cvRegisterVar(lua_State *L)
// stack: cvar table, cvar userdata
lua_getfield(L, LUA_REGISTRYINDEX, "CV_Vars");
I_Assert(lua_istable(L, 3));
+
+ lua_getfield(L, 3, cvar->name);
+ if (lua_type(L, -1) != LUA_TNIL)
+ return luaL_error(L, M_GetText("Variable %s is already defined\n"), cvar->name);
+ lua_pop(L, 1);
+
lua_pushvalue(L, 2);
lua_setfield(L, 3, cvar->name);
lua_pop(L, 1);
// actually time to register it to the console now! Finally!
+ cvar->flags |= CV_MODIFIED;
CV_RegisterVar(cvar);
+ if (cvar->flags & CV_MODIFIED)
+ return luaL_error(L, "failed to register cvar (probable conflict with internal variable/command names)");
// return cvar userdata
return 1;
diff --git a/src/lua_hook.h b/src/lua_hook.h
index fe5706f56..822edf79f 100644
--- a/src/lua_hook.h
+++ b/src/lua_hook.h
@@ -47,6 +47,7 @@ enum hook {
hook_ShieldSpecial,
hook_MobjMoveBlocked,
hook_MapThingSpawn,
+ hook_FollowMobj,
hook_MAX // last hook
};
@@ -85,5 +86,6 @@ boolean LUAh_HurtMsg(player_t *player, mobj_t *inflictor, mobj_t *source, UINT8
#define LUAh_ShieldSpecial(player) LUAh_PlayerHook(player, hook_ShieldSpecial) // Hook for shield abilities
#define LUAh_MobjMoveBlocked(mo) LUAh_MobjHook(mo, hook_MobjMoveBlocked) // Hook for P_XYMovement (when movement is blocked)
boolean LUAh_MapThingSpawn(mobj_t *mo, mapthing_t *mthing); // Hook for P_SpawnMapThing by mobj type
+boolean LUAh_FollowMobj(player_t *player, mobj_t *mo); // Hook for P_PlayerAfterThink Smiles mobj-following
#endif
diff --git a/src/lua_hooklib.c b/src/lua_hooklib.c
index 04efac070..0a7ef801e 100644
--- a/src/lua_hooklib.c
+++ b/src/lua_hooklib.c
@@ -58,6 +58,7 @@ const char *const hookNames[hook_MAX+1] = {
"ShieldSpecial",
"MobjMoveBlocked",
"MapThingSpawn",
+ "FollowMobj",
NULL
};
@@ -109,8 +110,8 @@ static int lib_addHook(lua_State *L)
luaL_checktype(L, 1, LUA_TFUNCTION);
- if (hud_running)
- return luaL_error(L, "HUD rendering code should not call this function!");
+ if (!lua_lumploading)
+ return luaL_error(L, "This function cannot be called from within a hook or coroutine!");
switch(hook.type)
{
@@ -197,6 +198,7 @@ static int lib_addHook(lua_State *L)
case hook_SpinSpecial:
case hook_JumpSpinSpecial:
case hook_PlayerSpawn:
+ case hook_FollowMobj:
lastp = &playerhooks;
break;
case hook_LinedefExecute:
@@ -1138,4 +1140,42 @@ boolean LUAh_MapThingSpawn(mobj_t *mo, mapthing_t *mthing)
return hooked;
}
+// Hook for P_PlayerAfterThink Smiles mobj-following
+boolean LUAh_FollowMobj(player_t *player, mobj_t *mobj)
+{
+ hook_p hookp;
+ boolean hooked = false;
+ if (!gL || !(hooksAvailable[hook_FollowMobj/8] & (1<<(hook_FollowMobj%8))))
+ return 0;
+
+ lua_settop(gL, 0);
+
+ for (hookp = playerhooks; hookp; hookp = hookp->next)
+ if (hookp->type == hook_FollowMobj)
+ {
+ if (lua_gettop(gL) == 0)
+ {
+ LUA_PushUserdata(gL, player, META_PLAYER);
+ LUA_PushUserdata(gL, mobj, META_MOBJ);
+ }
+ lua_pushfstring(gL, FMT_HOOKID, hookp->id);
+ lua_gettable(gL, LUA_REGISTRYINDEX);
+ lua_pushvalue(gL, -3);
+ lua_pushvalue(gL, -3);
+ if (lua_pcall(gL, 2, 1, 0)) {
+ if (!hookp->error || cv_debug & DBG_LUA)
+ CONS_Alert(CONS_WARNING,"%s\n",lua_tostring(gL, -1));
+ lua_pop(gL, 1);
+ hookp->error = true;
+ continue;
+ }
+ if (lua_toboolean(gL, -1))
+ hooked = true;
+ lua_pop(gL, 1);
+ }
+
+ lua_settop(gL, 0);
+ return hooked;
+}
+
#endif
diff --git a/src/lua_hud.h b/src/lua_hud.h
index ba0a1d894..beaca7883 100644
--- a/src/lua_hud.h
+++ b/src/lua_hud.h
@@ -42,3 +42,4 @@ boolean LUA_HudEnabled(enum hud option);
void LUAh_GameHUD(player_t *stplyr);
void LUAh_ScoresHUD(void);
+void LUAh_TitleHUD(void);
diff --git a/src/lua_hudlib.c b/src/lua_hudlib.c
index 5b3cd46ce..68a69cd1d 100644
--- a/src/lua_hudlib.c
+++ b/src/lua_hudlib.c
@@ -12,6 +12,7 @@
#include "doomdef.h"
#ifdef HAVE_BLUA
+#include "fastcmp.h"
#include "r_defs.h"
#include "r_local.h"
#include "st_stuff.h" // hudinfo[]
@@ -87,11 +88,13 @@ static const char *const patch_opt[] = {
enum hudhook {
hudhook_game = 0,
- hudhook_scores
+ hudhook_scores,
+ hudhook_title
};
static const char *const hudhook_opt[] = {
"game",
"scores",
+ "title",
NULL};
// alignment types for v.drawString
@@ -343,6 +346,158 @@ static int libd_cachePatch(lua_State *L)
return 1;
}
+// v.getSpritePatch(sprite, [frame, [angle]])
+static int libd_getSpritePatch(lua_State *L)
+{
+ UINT32 i; // sprite prefix
+ UINT32 frame = 0; // 'A'
+ UINT8 angle = 0;
+ spritedef_t *sprdef;
+ spriteframe_t *sprframe;
+ HUDONLY
+
+ if (lua_isnumber(L, 1)) // sprite number given, e.g. SPR_THOK
+ {
+ i = lua_tonumber(L, 1);
+ if (i >= NUMSPRITES)
+ return 0;
+ }
+ else if (lua_isstring(L, 1)) // sprite prefix name given, e.g. "THOK"
+ {
+ const char *name = lua_tostring(L, 1);
+ for (i = 0; i < NUMSPRITES; i++)
+ if (fastcmp(name, sprnames[i]))
+ break;
+ if (i >= NUMSPRITES)
+ return 0;
+ }
+ else
+ return 0;
+
+ if (i == SPR_PLAY) // Use getSprite2Patch instead!
+ return 0;
+
+ sprdef = &sprites[i];
+
+ // set frame number
+ frame = luaL_optinteger(L, 2, 0);
+ frame &= FF_FRAMEMASK; // ignore any bits that are not the actual frame, just in case
+ if (frame >= sprdef->numframes)
+ return 0;
+ // set angle number
+ sprframe = &sprdef->spriteframes[frame];
+ angle = luaL_optinteger(L, 3, 1);
+
+ // convert WAD editor angle numbers (1-8) to internal angle numbers (0-7)
+ // keep 0 the same since we'll make it default to angle 1 (which is internally 0)
+ // in case somebody didn't know that angle 0 really just maps all 8 angles to the same patch
+ if (angle != 0)
+ angle--;
+
+ if (angle >= 8) // out of range?
+ return 0;
+
+ // push both the patch and it's "flip" value
+ LUA_PushUserdata(L, W_CachePatchNum(sprframe->lumppat[angle], PU_STATIC), META_PATCH);
+ lua_pushboolean(L, (sprframe->flip & (1<= MAXSKINS)
+ return luaL_error(L, "skin number %d out of range (0 - %d)", i, MAXSKINS-1);
+ if (i >= numskins)
+ return 0;
+ }
+ else // find skin by name
+ {
+ const char *name = luaL_checkstring(L, 1);
+ for (i = 0; i < numskins; i++)
+ if (fastcmp(skins[i].name, name))
+ break;
+ if (i >= numskins)
+ return 0;
+ }
+
+ lua_remove(L, 1); // remove skin now
+
+ if (lua_isnumber(L, 1)) // sprite number given, e.g. SPR2_STND
+ {
+ j = lua_tonumber(L, 1);
+ if (j & FF_SPR2SUPER) // e.g. SPR2_STND|FF_SPR2SUPER
+ {
+ super = true;
+ j &= ~FF_SPR2SUPER; // remove flag so the next check doesn't fail
+ }
+ if (j >= free_spr2)
+ return 0;
+ }
+ else if (lua_isstring(L, 1)) // sprite prefix name given, e.g. "STND"
+ {
+ const char *name = lua_tostring(L, 1);
+ for (j = 0; j < free_spr2; j++)
+ if (fastcmp(name, spr2names[j]))
+ break;
+ // if you want super flags you'll have to use the optional boolean following this
+ if (j >= free_spr2)
+ return 0;
+ }
+ else
+ return 0;
+
+ if (lua_isboolean(L, 2)) // optional boolean for superness
+ {
+ super = lua_toboolean(L, 2); // note: this can override FF_SPR2SUPER from sprite number
+ lua_remove(L, 2); // remove
+ }
+ // if it's not boolean then just assume it's the frame number
+
+ if (super)
+ j |= FF_SPR2SUPER;
+
+ j = P_GetSkinSprite2(&skins[i], j, NULL); // feed skin and current sprite2 through to change sprite2 used if necessary
+
+ sprdef = &skins[i].sprites[j];
+
+ // set frame number
+ frame = luaL_optinteger(L, 2, 0);
+ frame &= FF_FRAMEMASK; // ignore any bits that are not the actual frame, just in case
+ if (frame >= sprdef->numframes)
+ return 0;
+ // set angle number
+ sprframe = &sprdef->spriteframes[frame];
+ angle = luaL_optinteger(L, 3, 1);
+
+ // convert WAD editor angle numbers (1-8) to internal angle numbers (0-7)
+ // keep 0 the same since we'll make it default to angle 1 (which is internally 0)
+ // in case somebody didn't know that angle 0 really just maps all 8 angles to the same patch
+ if (angle != 0)
+ angle--;
+
+ if (angle >= 8) // out of range?
+ return 0;
+
+ // push both the patch and it's "flip" value
+ LUA_PushUserdata(L, W_CachePatchNum(sprframe->lumppat[angle], PU_STATIC), META_PATCH);
+ lua_pushboolean(L, (sprframe->flip & (1<= free_spr2)
+ return 0;
+
+ lua_pushinteger(L, spr2defaults[i]);
+ return 1;
+}
+
+static int lib_setSpr2default(lua_State *L)
+{
+ UINT32 i;
+ UINT8 j = 0;
+
+ lua_remove(L, 1); // don't care about spr2defaults[] dummy userdata.
+
+ if (lua_isnumber(L, 1))
+ i = lua_tonumber(L, 1);
+ else if (lua_isstring(L, 1))
+ {
+ const char *name = lua_tostring(L, 1);
+ for (i = 0; i < free_spr2; i++)
+ {
+ if (fastcmp(name, spr2names[i]))
+ break;
+ }
+ if (i == free_spr2)
+ return luaL_error(L, "spr2defaults[] invalid index");
+ }
+ else
+ return luaL_error(L, "spr2defaults[] invalid index");
+
+ if (i < SPR2_FIRSTFREESLOT || i >= free_spr2)
+ return luaL_error(L, "spr2defaults[] index %d out of range (%d - %d)", i, SPR2_FIRSTFREESLOT, free_spr2-1);
+
+ if (lua_isnumber(L, 2))
+ j = lua_tonumber(L, 2);
+ else if (lua_isstring(L, 2))
+ {
+ const char *name = lua_tostring(L, 2);
+ for (j = 0; j < free_spr2; j++)
+ {
+ if (fastcmp(name, spr2names[j]))
+ break;
+ }
+ if (j == free_spr2)
+ return luaL_error(L, "spr2defaults[] invalid index");
+ }
+
+ if (j >= free_spr2)
+ j = 0; // return luaL_error(L, "spr2defaults[] set %d out of range (%d - %d)", j, 0, free_spr2-1);
+
+ spr2defaults[i] = j;
+ return 0;
+}
+
static int lib_spr2namelen(lua_State *L)
{
lua_pushinteger(L, free_spr2);
@@ -984,6 +1056,19 @@ int LUA_InfoLib(lua_State *L)
lua_setmetatable(L, -2);
lua_setglobal(L, "spr2names");
+ lua_newuserdata(L, 0);
+ lua_createtable(L, 0, 2);
+ lua_pushcfunction(L, lib_getSpr2default);
+ lua_setfield(L, -2, "__index");
+
+ lua_pushcfunction(L, lib_setSpr2default);
+ lua_setfield(L, -2, "__newindex");
+
+ lua_pushcfunction(L, lib_spr2namelen);
+ lua_setfield(L, -2, "__len");
+ lua_setmetatable(L, -2);
+ lua_setglobal(L, "spr2defaults");
+
lua_newuserdata(L, 0);
lua_createtable(L, 0, 2);
lua_pushcfunction(L, lib_getState);
diff --git a/src/lua_mobjlib.c b/src/lua_mobjlib.c
index 2fcccab66..d384b75d1 100644
--- a/src/lua_mobjlib.c
+++ b/src/lua_mobjlib.c
@@ -417,7 +417,7 @@ static int mobj_set(lua_State *L)
mo->frame = (UINT32)luaL_checkinteger(L, 3);
break;
case mobj_sprite2:
- mo->sprite2 = P_GetMobjSprite2(mo, (UINT8)luaL_checkinteger(L, 3));
+ mo->sprite2 = P_GetSkinSprite2(((skin_t *)mo->skin), (UINT8)luaL_checkinteger(L, 3), mo->player);
break;
case mobj_anim_duration:
mo->anim_duration = (UINT16)luaL_checkinteger(L, 3);
diff --git a/src/lua_playerlib.c b/src/lua_playerlib.c
index 622309425..12b2646d0 100644
--- a/src/lua_playerlib.c
+++ b/src/lua_playerlib.c
@@ -126,6 +126,8 @@ static int player_get(lua_State *L)
lua_pushfixed(L, plr->bob);
else if (fastcmp(field,"aiming"))
lua_pushangle(L, plr->aiming);
+ else if (fastcmp(field,"drawangle"))
+ lua_pushangle(L, plr->drawangle);
else if (fastcmp(field,"rings"))
lua_pushinteger(L, plr->rings);
else if (fastcmp(field,"pity"))
@@ -172,6 +174,10 @@ static int player_get(lua_State *L)
lua_pushinteger(L, plr->spinitem);
else if (fastcmp(field,"revitem"))
lua_pushinteger(L, plr->revitem);
+ else if (fastcmp(field,"followitem"))
+ lua_pushinteger(L, plr->followitem);
+ else if (fastcmp(field,"followmobj"))
+ LUA_PushUserdata(L, plr->followmobj, META_MOBJ);
else if (fastcmp(field,"actionspd"))
lua_pushfixed(L, plr->actionspd);
else if (fastcmp(field,"mindash"))
@@ -320,6 +326,8 @@ static int player_get(lua_State *L)
lua_pushangle(L, plr->awayviewaiming);
else if (fastcmp(field,"spectator"))
lua_pushboolean(L, plr->spectator);
+ else if (fastcmp(field,"outofcoop"))
+ lua_pushboolean(L, plr->outofcoop);
else if (fastcmp(field,"bot"))
lua_pushinteger(L, plr->bot);
else if (fastcmp(field,"jointime"))
@@ -384,6 +392,8 @@ static int player_set(lua_State *L)
else if (plr == &players[secondarydisplayplayer])
localaiming2 = plr->aiming;
}
+ else if (fastcmp(field,"drawangle"))
+ plr->drawangle = luaL_checkangle(L, 3);
else if (fastcmp(field,"rings"))
plr->rings = (INT32)luaL_checkinteger(L, 3);
else if (fastcmp(field,"pity"))
@@ -435,6 +445,10 @@ static int player_set(lua_State *L)
plr->spinitem = luaL_checkinteger(L, 3);
else if (fastcmp(field,"revitem"))
plr->revitem = luaL_checkinteger(L, 3);
+ else if (fastcmp(field,"followitem"))
+ plr->followitem = luaL_checkinteger(L, 3);
+ else if (fastcmp(field,"followmobj"))
+ plr->followmobj = *((mobj_t **)luaL_checkudata(L, 3, META_MOBJ));
else if (fastcmp(field,"actionspd"))
plr->actionspd = (INT32)luaL_checkinteger(L, 3);
else if (fastcmp(field,"mindash"))
@@ -597,6 +611,8 @@ static int player_set(lua_State *L)
plr->awayviewaiming = luaL_checkangle(L, 3);
else if (fastcmp(field,"spectator"))
plr->spectator = lua_toboolean(L, 3);
+ else if (fastcmp(field,"outofcoop"))
+ plr->outofcoop = lua_toboolean(L, 3);
else if (fastcmp(field,"bot"))
return NOSET;
else if (fastcmp(field,"jointime"))
diff --git a/src/lua_script.c b/src/lua_script.c
index 7bc9b88ec..994f81a40 100644
--- a/src/lua_script.c
+++ b/src/lua_script.c
@@ -161,6 +161,11 @@ void LUA_ClearExtVars(void)
}
#endif
+// Use this variable to prevent certain functions from running
+// if they were not called on lump load
+// (i.e. they were called in hooks or coroutines etc)
+boolean lua_lumploading = false;
+
// Load a script from a MYFILE
static inline void LUA_LoadFile(MYFILE *f, char *name)
{
@@ -198,7 +203,9 @@ void LUA_LoadLump(UINT16 wad, UINT16 lump)
name[strlen(wadfiles[wad]->filename)+9] = '\0';
}
- LUA_LoadFile(&f, name);
+ lua_lumploading = true; // turn on loading flag
+ LUA_LoadFile(&f, name); // actually load file!
+ lua_lumploading = false; // turn off again
free(name);
Z_Free(f.data);
diff --git a/src/lua_script.h b/src/lua_script.h
index d143ed879..51f1eaeaa 100644
--- a/src/lua_script.h
+++ b/src/lua_script.h
@@ -38,6 +38,8 @@
void LUA_ClearExtVars(void);
#endif
+extern boolean lua_lumploading; // is LUA_LoadLump being called?
+
void LUA_LoadLump(UINT16 wad, UINT16 lump);
#ifdef LUA_ALLOW_BYTECODE
void LUA_DumpFile(const char *filename);
diff --git a/src/lua_skinlib.c b/src/lua_skinlib.c
index f93513c49..1a70a82d9 100644
--- a/src/lua_skinlib.c
+++ b/src/lua_skinlib.c
@@ -35,6 +35,7 @@ enum skin {
skin_thokitem,
skin_spinitem,
skin_revitem,
+ skin_followitem,
skin_actionspd,
skin_mindash,
skin_maxdash,
@@ -73,6 +74,7 @@ static const char *const skin_opt[] = {
"thokitem",
"spinitem",
"revitem",
+ "followitem",
"actionspd",
"mindash",
"maxdash",
@@ -162,6 +164,9 @@ static int skin_get(lua_State *L)
case skin_revitem:
lua_pushinteger(L, skin->revitem);
break;
+ case skin_followitem:
+ lua_pushinteger(L, skin->followitem);
+ break;
case skin_actionspd:
lua_pushfixed(L, skin->actionspd);
break;
diff --git a/src/lzf.c b/src/lzf.c
index 272174f30..f81c3ee0a 100644
--- a/src/lzf.c
+++ b/src/lzf.c
@@ -119,9 +119,7 @@
/*****************************************************************************/
/* nothing should be changed below */
-#ifndef _NDS
typedef unsigned char u8;
-#endif
typedef const u8 *LZF_STATE[1 << (HLOG)];
@@ -159,7 +157,7 @@ typedef const u8 *LZF_STATE[1 << (HLOG)];
* lzfP.h ends here. lzf_d.c follows.
*/
-#if AVOID_ERRNO || defined(_WIN32_WCE)
+#if AVOID_ERRNO
# define SET_ERRNO(n)
#else
# include
diff --git a/src/m_argv.c b/src/m_argv.c
index 859fc9026..213577e76 100644
--- a/src/m_argv.c
+++ b/src/m_argv.c
@@ -123,12 +123,7 @@ void M_PushSpecialParameters(void)
}
/// \brief max args
-
-#if defined (_arch_dreamcast) || defined (_XBOX) || defined (_WII)
-#define MAXARGVS 1
-#else
#define MAXARGVS 256
-#endif
/** \brief the M_FindResponseFile function
Find a response file
diff --git a/src/m_cheat.c b/src/m_cheat.c
index f988c0fd5..76733a82f 100644
--- a/src/m_cheat.c
+++ b/src/m_cheat.c
@@ -61,7 +61,7 @@ static UINT8 cheatf_ultimate(void)
if (menuactive && (currentMenu != &MainDef && currentMenu != &SP_LoadDef))
return 0; // Only on the main menu, or the save select!
- S_StartSound(0, sfx_itemup);
+ BwehHehHe();
ultimate_selectable = (!ultimate_selectable);
// If on the save select, move to what is now Ultimate Mode!
@@ -1093,7 +1093,7 @@ void OP_ObjectplaceMovement(player_t *player)
ticcmd_t *cmd = &player->cmd;
if (!player->climbing && (netgame || !cv_analog.value || (player->pflags & PF_SPINNING)))
- player->mo->angle = (cmd->angleturn<<16 /* not FRACBITS */);
+ player->drawangle = player->mo->angle = (cmd->angleturn<<16 /* not FRACBITS */);
ticruned++;
if (!(cmd->angleturn & TICCMD_RECEIVED))
@@ -1255,7 +1255,7 @@ void Command_ObjectPlace_f(void)
{
objectplacing = true;
- if ((players[0].powers[pw_carry] == CR_NIGHTSMODE))
+ if (players[0].powers[pw_carry] == CR_NIGHTSMODE)
return;
if (!COM_CheckParm("-silent"))
diff --git a/src/m_cond.c b/src/m_cond.c
index b7735d4ce..e9d655694 100644
--- a/src/m_cond.c
+++ b/src/m_cond.c
@@ -499,63 +499,63 @@ emblem_t emblemlocations[MAXEMBLEMS] =
// FLORAL FIELD
// ---
{0, 5394, -996, 160, 50, 'N', SKINCOLOR_RUST, 0, "", 0},
- {ET_NGRADE, 0,0,0, 50, 'Q', SKINCOLOR_TEAL, GRADE_A, "", 0},
+ {ET_NGRADE, 0,0,0, 50, 'Q', SKINCOLOR_CYAN, GRADE_A, "", 0},
{ET_NTIME, 0,0,0, 50, 'T', SKINCOLOR_GREY, 40*TICRATE, "", 0},
// TOXIC PLATEAU
// ---
{0, 780, -1664, 32, 51, 'N', SKINCOLOR_RUST, 0, "", 0},
- {ET_NGRADE, 0,0,0, 51, 'Q', SKINCOLOR_TEAL, GRADE_A, "", 0},
+ {ET_NGRADE, 0,0,0, 51, 'Q', SKINCOLOR_CYAN, GRADE_A, "", 0},
{ET_NTIME, 0,0,0, 51, 'T', SKINCOLOR_GREY, 50*TICRATE, "", 0},
// FLOODED COVE
// ---
{0, 1824, -1888, 2448, 52, 'N', SKINCOLOR_RUST, 0, "", 0},
- {ET_NGRADE, 0,0,0, 52, 'Q', SKINCOLOR_TEAL, GRADE_A, "", 0},
+ {ET_NGRADE, 0,0,0, 52, 'Q', SKINCOLOR_CYAN, GRADE_A, "", 0},
{ET_NTIME, 0,0,0, 52, 'T', SKINCOLOR_GREY, 90*TICRATE, "", 0},
// CAVERN FORTRESS
// ---
{0, -3089, -431, 1328, 53, 'N', SKINCOLOR_RUST, 0, "", 0},
- {ET_NGRADE, 0,0,0, 53, 'Q', SKINCOLOR_TEAL, GRADE_A, "", 0},
+ {ET_NGRADE, 0,0,0, 53, 'Q', SKINCOLOR_CYAN, GRADE_A, "", 0},
{ET_NTIME, 0,0,0, 53, 'T', SKINCOLOR_GREY, 75*TICRATE, "", 0},
// DUSTY WASTELAND
// ---
{0, 957, 924, 2956, 54, 'N', SKINCOLOR_RUST, 0, "", 0},
- {ET_NGRADE, 0,0,0, 54, 'Q', SKINCOLOR_TEAL, GRADE_A, "", 0},
+ {ET_NGRADE, 0,0,0, 54, 'Q', SKINCOLOR_CYAN, GRADE_A, "", 0},
{ET_NTIME, 0,0,0, 54, 'T', SKINCOLOR_GREY, 65*TICRATE, "", 0},
// MAGMA CAVES
// ---
{0, -2752, 3104, 1800, 55, 'N', SKINCOLOR_RUST, 0, "", 0},
- {ET_NGRADE, 0,0,0, 55, 'Q', SKINCOLOR_TEAL, GRADE_A, "", 0},
+ {ET_NGRADE, 0,0,0, 55, 'Q', SKINCOLOR_CYAN, GRADE_A, "", 0},
{ET_NTIME, 0,0,0, 55, 'T', SKINCOLOR_GREY, 80*TICRATE, "", 0},
// EGG SATELLITE
// ---
{0, 5334, -609, 3426, 56, 'N', SKINCOLOR_RUST, 0, "", 0},
- {ET_NGRADE, 0,0,0, 56, 'Q', SKINCOLOR_TEAL, GRADE_A, "", 0},
+ {ET_NGRADE, 0,0,0, 56, 'Q', SKINCOLOR_CYAN, GRADE_A, "", 0},
{ET_NTIME, 0,0,0, 56, 'T', SKINCOLOR_GREY, 120*TICRATE, "", 0},
// BLACK HOLE
// ---
{0, 2108, 3776, 32, 57, 'N', SKINCOLOR_RUST, 0, "", 0},
- {ET_NGRADE, 0,0,0, 57, 'Q', SKINCOLOR_TEAL, GRADE_A, "", 0},
+ {ET_NGRADE, 0,0,0, 57, 'Q', SKINCOLOR_CYAN, GRADE_A, "", 0},
{ET_NTIME, 0,0,0, 57, 'T', SKINCOLOR_GREY, 150*TICRATE, "", 0},
// SPRING HILL
// ---
{0, -1840, -1024, 1644, 58, 'N', SKINCOLOR_RUST, 0, "", 0},
- {ET_NGRADE, 0,0,0, 58, 'Q', SKINCOLOR_TEAL, GRADE_A, "", 0},
+ {ET_NGRADE, 0,0,0, 58, 'Q', SKINCOLOR_CYAN, GRADE_A, "", 0},
{ET_NTIME, 0,0,0, 58, 'T', SKINCOLOR_GREY, 60*TICRATE, "", 0},
};
@@ -566,7 +566,7 @@ extraemblem_t extraemblems[MAXEXTRAEMBLEMS] =
{"All Emeralds", "Complete 1P Mode with all Emeralds", 11, 'V', SKINCOLOR_GREY, 0},
{"Perfect Bonus", "Perfect Bonus on a non-secret stage", 30, 'P', SKINCOLOR_GOLD, 0},
{"PLACEHOLDER", "PLACEHOLDER", 0, 'O', SKINCOLOR_RUST, 0},
- {"NiGHTS Mastery", "Show your mastery of NiGHTS!", 22, 'W', SKINCOLOR_TEAL, 0},
+ {"NiGHTS Mastery", "Show your mastery of NiGHTS!", 22, 'W', SKINCOLOR_CYAN, 0},
};
// Default Unlockables
@@ -980,18 +980,18 @@ UINT8 M_CompletionEmblems(void) // Bah! Duplication sucks, but it's for a separa
levelnum = emblemlocations[i].level;
embtype = emblemlocations[i].var;
flags = MV_BEATEN;
-
+
if (embtype & ME_ALLEMERALDS)
flags |= MV_ALLEMERALDS;
-
+
if (embtype & ME_ULTIMATE)
flags |= MV_ULTIMATE;
-
+
if (embtype & ME_PERFECT)
flags |= MV_PERFECT;
-
+
res = ((mapvisited[levelnum - 1] & flags) == flags);
-
+
emblemlocations[i].collected = res;
if (res)
++somethingUnlocked;
diff --git a/src/m_cond.h b/src/m_cond.h
index 94802f665..00f633a8d 100644
--- a/src/m_cond.h
+++ b/src/m_cond.h
@@ -66,14 +66,18 @@ typedef struct
} conditionset_t;
// Emblem information
-#define ET_GLOBAL 0 // Global map emblem, var == color
-#define ET_SKIN 1 // Skin specific emblem, var == skin
-#define ET_SCORE 2
-#define ET_TIME 3
-#define ET_RINGS 4
-#define ET_NGRADE 5
-#define ET_NTIME 6
-#define ET_MAP 7
+#define ET_GLOBAL 0 // Emblem with a position in space
+#define ET_SKIN 1 // Skin specific emblem with a position in space, var == skin
+#define ET_MAP 2 // Beat the map
+#define ET_SCORE 3 // Get the score
+#define ET_TIME 4 // Get the time
+#define ET_RINGS 5 // Get the rings
+#define ET_NGRADE 6 // Get the grade
+#define ET_NTIME 7 // Get the time (NiGHTS mode)
+
+// Global emblem flags
+#define GE_NIGHTSPULL 1 // sun off the nights track - loop it
+#define GE_NIGHTSITEM 2 // moon on the nights track - find it
// Map emblem flags
#define ME_ALLEMERALDS 1
diff --git a/src/m_fixed.h b/src/m_fixed.h
index 1cf9abbae..8050324db 100644
--- a/src/m_fixed.h
+++ b/src/m_fixed.h
@@ -20,10 +20,6 @@
#include
#endif
-#ifdef _WIN32_WCE
-#include "sdl/SRB2CE/cehelp.h"
-#endif
-
/*!
\brief bits of the fraction
*/
diff --git a/src/m_menu.c b/src/m_menu.c
index 8546624f5..aa199f289 100644
--- a/src/m_menu.c
+++ b/src/m_menu.c
@@ -33,6 +33,9 @@
#include "s_sound.h"
#include "i_system.h"
+// Addfile
+#include "filesrch.h"
+
#include "v_video.h"
#include "i_video.h"
#include "keys.h"
@@ -74,7 +77,6 @@ int snprintf(char *str, size_t n, const char *fmt, ...);
#define SMALLLINEHEIGHT 8
#define SLIDER_RANGE 9
#define SLIDER_WIDTH 78
-#define MAXSTRINGLENGTH 32
#define SERVERS_PER_PAGE 11
typedef enum
@@ -147,7 +149,7 @@ description_t description[32] =
{false, "???", "", "", 0, 0},
{false, "???", "", "", 0, 0}
};
-static INT16 char_on = 0;
+INT16 char_on = -1, startchar = 1;
static char *char_notes = NULL;
static fixed_t char_scroll = 0;
@@ -170,7 +172,9 @@ static char joystickInfo[8][25];
static UINT32 serverlistpage;
#endif
-static saveinfo_t savegameinfo[MAXSAVEGAMES]; // Extra info about the save games.
+static UINT8 numsaves = 0;
+static saveinfo_t* savegameinfo = NULL; // Extra info about the save games.
+static patch_t *savselp[7];
INT16 startmap; // Mario, NiGHTS, or just a plain old normal game?
@@ -211,17 +215,16 @@ menu_t SPauseDef;
// Level Select
static levelselect_t levelselect = {0, NULL};
-static UINT8 levelselectselect[4];
+static UINT8 levelselectselect[3];
static patch_t *levselp[2][3];
static INT32 lsoffs[2];
#define lsrow levelselectselect[0]
#define lscol levelselectselect[1]
-#define lstic levelselectselect[2]
-#define lshli levelselectselect[3]
+#define lshli levelselectselect[2]
#define lshseperation 101
-#define lsbasevseperation 62
+#define lsbasevseperation (62*vid.height)/(BASEVIDHEIGHT*vid.dupy) //62
#define lsheadingheight 16
#define getheadingoffset(row) (levelselect.rows[row].header[0] ? lsheadingheight : 0)
#define lsvseperation(row) lsbasevseperation + getheadingoffset(row)
@@ -262,7 +265,7 @@ static void M_ConfirmTeamChange(INT32 choice);
static void M_SecretsMenu(INT32 choice);
static void M_SetupChoosePlayer(INT32 choice);
static void M_QuitSRB2(INT32 choice);
-menu_t SP_MainDef, MP_MainDef, OP_MainDef;
+menu_t SP_MainDef, OP_MainDef;
menu_t MISC_ScrambleTeamDef, MISC_ChangeTeamDef;
// Single Player
@@ -285,21 +288,19 @@ static menu_t SP_TimeAttackDef, SP_ReplayDef, SP_GuestReplayDef, SP_GhostDef;
static menu_t SP_NightsAttackDef, SP_NightsReplayDef, SP_NightsGuestReplayDef, SP_NightsGhostDef;
// Multiplayer
-#ifndef NONET
-static void M_StartServerMenu(INT32 choice);
-static void M_ConnectMenu(INT32 choice);
-static void M_ConnectIPMenu(INT32 choice);
-#endif
+static void M_SetupMultiPlayer(INT32 choice);
+static void M_SetupMultiPlayer2(INT32 choice);
static void M_StartSplitServerMenu(INT32 choice);
static void M_StartServer(INT32 choice);
static void M_ServerOptions(INT32 choice);
#ifndef NONET
+static void M_StartServerMenu(INT32 choice);
+static void M_ConnectMenu(INT32 choice);
static void M_Refresh(INT32 choice);
static void M_Connect(INT32 choice);
static void M_ChooseRoom(INT32 choice);
+menu_t MP_MainDef;
#endif
-static void M_SetupMultiPlayer(INT32 choice);
-static void M_SetupMultiPlayer2(INT32 choice);
// Options
// Split into multiple parts due to size
@@ -334,12 +335,20 @@ menu_t OP_MonitorToggleDef;
static void M_ScreenshotOptions(INT32 choice);
static void M_EraseData(INT32 choice);
-static void M_DrawLevelPlatterHeader(INT32 y, const char *header, boolean headerhighlight);
+static void M_Addons(INT32 choice);
+static void M_AddonsOptions(INT32 choice);
+static patch_t *addonsp[NUM_EXT+6];
+static UINT8 addonsresponselimit = 0;
+
+#define numaddonsshown 4
+
+static void M_DrawLevelPlatterHeader(INT32 y, const char *header, boolean headerhighlight, boolean allowlowercase);
// Drawing functions
static void M_DrawGenericMenu(void);
static void M_DrawGenericScrollMenu(void);
static void M_DrawCenteredMenu(void);
+static void M_DrawAddons(void);
static void M_DrawSkyRoom(void);
static void M_DrawChecklist(void);
static void M_DrawEmblemHints(void);
@@ -367,24 +376,23 @@ static void M_OGL_DrawColorMenu(void);
#ifndef NONET
static void M_DrawScreenshotMenu(void);
static void M_DrawConnectMenu(void);
-static void M_DrawConnectIPMenu(void);
+static void M_DrawMPMainMenu(void);
static void M_DrawRoomMenu(void);
#endif
static void M_DrawJoystick(void);
static void M_DrawSetupMultiPlayerMenu(void);
// Handling functions
-#ifndef NONET
-static boolean M_CancelConnect(void);
-#endif
static boolean M_ExitPandorasBox(void);
static boolean M_QuitMultiPlayerMenu(void);
+static void M_HandleAddons(INT32 choice);
static void M_HandleLevelPlatter(INT32 choice);
static void M_HandleSoundTest(INT32 choice);
static void M_HandleImageDef(INT32 choice);
static void M_HandleLoadSave(INT32 choice);
static void M_HandleLevelStats(INT32 choice);
#ifndef NONET
+static boolean M_CancelConnect(void);
static void M_HandleConnectIP(INT32 choice);
#endif
static void M_HandleSetupMultiPlayer(INT32 choice);
@@ -473,11 +481,16 @@ static consvar_t cv_dummymares = {"dummymares", "Overall", CV_HIDEN|CV_CALL, dum
// ---------
static menuitem_t MainMenu[] =
{
- {IT_CALL |IT_STRING, NULL, "Secrets", M_SecretsMenu, 84},
- {IT_CALL |IT_STRING, NULL, "1 player", M_SinglePlayerMenu, 92},
- {IT_SUBMENU|IT_STRING, NULL, "multiplayer", &MP_MainDef, 100},
- {IT_CALL |IT_STRING, NULL, "options", M_Options, 108},
- {IT_CALL |IT_STRING, NULL, "quit game", M_QuitSRB2, 116},
+ {IT_STRING|IT_CALL, NULL, "Secrets", M_SecretsMenu, 76},
+ {IT_STRING|IT_CALL, NULL, "1 player", M_SinglePlayerMenu, 84},
+#ifndef NONET
+ {IT_STRING|IT_SUBMENU, NULL, "multiplayer", &MP_MainDef, 92},
+#else
+ {IT_STRING|IT_CALL, NULL, "multiplayer", M_StartSplitServerMenu, 92},
+#endif
+ {IT_STRING|IT_CALL, NULL, "options", M_Options, 100},
+ {IT_CALL |IT_STRING, NULL, "addons", M_Addons, 108},
+ {IT_STRING|IT_CALL, NULL, "quit game", M_QuitSRB2, 116},
};
typedef enum
@@ -486,9 +499,15 @@ typedef enum
singleplr,
multiplr,
options,
+ addons,
quitdoom
} main_e;
+static menuitem_t MISC_AddonsMenu[] =
+{
+ {IT_KEYHANDLER | IT_NOTHING, NULL, "", M_HandleAddons, 0}, // dummy menuitem for the control func
+};
+
// ---------------------------------
// Pause Menu Mode Attacking Edition
// ---------------------------------
@@ -511,26 +530,28 @@ typedef enum
// ---------------------
static menuitem_t MPauseMenu[] =
{
- {IT_STRING | IT_SUBMENU, NULL, "Scramble Teams...", &MISC_ScrambleTeamDef, 16},
- {IT_STRING | IT_CALL, NULL, "Switch Gametype/Level...", M_GameTypeChange, 24},
+ {IT_STRING | IT_CALL, NULL, "Add-ons...", M_Addons, 8},
+ {IT_STRING | IT_SUBMENU, NULL, "Scramble Teams...", &MISC_ScrambleTeamDef, 16},
+ {IT_STRING | IT_CALL, NULL, "Switch Gametype/Level...", M_GameTypeChange, 24},
- {IT_CALL | IT_STRING, NULL, "Continue", M_SelectableClearMenus,40},
- {IT_CALL | IT_STRING, NULL, "Player 1 Setup", M_SetupMultiPlayer, 48}, // splitscreen
- {IT_CALL | IT_STRING, NULL, "Player 2 Setup", M_SetupMultiPlayer2, 56}, // splitscreen
+ {IT_STRING | IT_CALL, NULL, "Continue", M_SelectableClearMenus,40},
+ {IT_STRING | IT_CALL, NULL, "Player 1 Setup", M_SetupMultiPlayer, 48}, // splitscreen
+ {IT_STRING | IT_CALL, NULL, "Player 2 Setup", M_SetupMultiPlayer2, 56}, // splitscreen
{IT_STRING | IT_CALL, NULL, "Spectate", M_ConfirmSpectate, 48},
{IT_STRING | IT_CALL, NULL, "Enter Game", M_ConfirmEnterGame, 48},
{IT_STRING | IT_SUBMENU, NULL, "Switch Team...", &MISC_ChangeTeamDef, 48},
- {IT_CALL | IT_STRING, NULL, "Player Setup", M_SetupMultiPlayer, 56}, // alone
- {IT_CALL | IT_STRING, NULL, "Options", M_Options, 64},
+ {IT_STRING | IT_CALL, NULL, "Player Setup", M_SetupMultiPlayer, 56}, // alone
+ {IT_STRING | IT_CALL, NULL, "Options", M_Options, 64},
- {IT_CALL | IT_STRING, NULL, "Return to Title", M_EndGame, 80},
- {IT_CALL | IT_STRING, NULL, "Quit Game", M_QuitSRB2, 88},
+ {IT_STRING | IT_CALL, NULL, "Return to Title", M_EndGame, 80},
+ {IT_STRING | IT_CALL, NULL, "Quit Game", M_QuitSRB2, 88},
};
typedef enum
{
- mpause_scramble = 0,
+ mpause_addons = 0,
+ mpause_scramble,
mpause_switchmap,
mpause_continue,
@@ -573,6 +594,7 @@ typedef enum
spause_continue,
spause_retry,
spause_options,
+
spause_title,
spause_quit
} spause_e;
@@ -888,56 +910,56 @@ static menuitem_t SP_PlayerMenu[] =
// Multiplayer and all of its submenus
// -----------------------------------
// Prefix: MP_
+
+// Separated splitscreen and normal servers.
+static menuitem_t MP_SplitServerMenu[] =
+{
+ {IT_STRING|IT_CALL, NULL, "Select Gametype/Level...", M_GameTypeChange, 100},
+#ifdef NONET // In order to keep player setup accessible.
+ {IT_STRING|IT_CALL, NULL, "Player 1 setup...", M_SetupMultiPlayer, 110},
+ {IT_STRING|IT_CALL, NULL, "Player 2 setup...", M_SetupMultiPlayer2, 120},
+#endif
+ {IT_STRING|IT_CALL, NULL, "More Options...", M_ServerOptions, 130},
+ {IT_WHITESTRING|IT_CALL, NULL, "Start", M_StartServer, 140},
+};
+
+#ifndef NONET
+
static menuitem_t MP_MainMenu[] =
{
-#ifndef NONET
- {IT_CALL | IT_STRING, NULL, "HOST GAME", M_StartServerMenu, 10},
- {IT_CALL | IT_STRING, NULL, "JOIN GAME (Search)", M_ConnectMenu, 30},
- {IT_CALL | IT_STRING, NULL, "JOIN GAME (Specify IP)", M_ConnectIPMenu, 40},
-#endif
- {IT_CALL | IT_STRING, NULL, "TWO PLAYER GAME", M_StartSplitServerMenu, 60},
-
- {IT_CALL | IT_STRING, NULL, "PLAYER 1 SETUP", M_SetupMultiPlayer, 80},
- {IT_CALL | IT_STRING, NULL, "PLAYER 2 SETUP", M_SetupMultiPlayer2, 90},
+ {IT_HEADER, NULL, "Host a game", NULL, 0},
+ {IT_STRING|IT_CALL, NULL, "Internet/LAN...", M_StartServerMenu, 12},
+ {IT_STRING|IT_CALL, NULL, "Splitscreen...", M_StartSplitServerMenu, 22},
+ {IT_HEADER, NULL, "Join a game", NULL, 40},
+ {IT_STRING|IT_CALL, NULL, "Server browser...", M_ConnectMenu, 52},
+ {IT_STRING|IT_KEYHANDLER, NULL, "Specify IPv4 address:", M_HandleConnectIP, 62},
+ {IT_HEADER, NULL, "Player setup", NULL, 94},
+ {IT_STRING|IT_CALL, NULL, "Player 1...", M_SetupMultiPlayer, 106},
+ {IT_STRING|IT_CALL, NULL, "Player 2... ", M_SetupMultiPlayer2, 116},
};
static menuitem_t MP_ServerMenu[] =
{
- {IT_DISABLED|IT_NOTHING, NULL, "", NULL, 0},
-#ifndef NONET
- {IT_STRING|IT_CALL, NULL, "Room...", M_RoomMenu, 10},
- {IT_STRING|IT_CVAR|IT_CV_STRING, NULL, "Server Name", &cv_servername, 20},
- {IT_STRING|IT_CVAR, NULL, "Max Players", &cv_maxplayers, 46},
- {IT_STRING|IT_CVAR, NULL, "Allow WAD Downloading", &cv_downloading, 56},
-#endif
- {IT_STRING|IT_CALL, NULL, "Select Gametype/Level...", M_GameTypeChange, 100},
- {IT_STRING|IT_CALL, NULL, "More Options...", M_ServerOptions, 130},
- {IT_WHITESTRING|IT_CALL, NULL, "Start", M_StartServer, 140},
+ {IT_STRING|IT_CALL, NULL, "Room...", M_RoomMenu, 10},
+ {IT_STRING|IT_CVAR|IT_CV_STRING, NULL, "Server Name", &cv_servername, 20},
+ {IT_STRING|IT_CVAR, NULL, "Max Players", &cv_maxplayers, 46},
+ {IT_STRING|IT_CVAR, NULL, "Allow Add-on Downloading", &cv_downloading, 56},
+ {IT_STRING|IT_CALL, NULL, "Select Gametype/Level...", M_GameTypeChange, 100},
+ {IT_STRING|IT_CALL, NULL, "More Options...", M_ServerOptions, 130},
+ {IT_WHITESTRING|IT_CALL, NULL, "Start", M_StartServer, 140},
};
enum
{
- mp_server_dummy = 0, // exists solely so zero-indexed in both NONET and not NONET
-#ifndef NONET
- mp_server_room,
+ mp_server_room = 0,
mp_server_name,
mp_server_maxpl,
mp_server_waddl,
-#endif
mp_server_levelgt,
mp_server_options,
mp_server_start
};
-// Separated splitscreen and normal servers.
-static menuitem_t MP_SplitServerMenu[] =
-{
- {IT_STRING|IT_CALL, NULL, "Select Gametype/Level...", M_GameTypeChange, 100},
- {IT_STRING|IT_CALL, NULL, "More Options...", M_ServerOptions, 130},
- {IT_WHITESTRING|IT_CALL, NULL, "Start", M_StartServer, 140},
-};
-
-#ifndef NONET
static menuitem_t MP_ConnectMenu[] =
{
{IT_STRING | IT_CALL, NULL, "Room...", M_RoomMenu, 4},
@@ -989,17 +1011,14 @@ static menuitem_t MP_RoomMenu[] =
{IT_DISABLED, NULL, "", M_ChooseRoom, 162},
};
-static menuitem_t MP_ConnectIPMenu[] =
-{
- {IT_KEYHANDLER | IT_STRING, NULL, " IP Address:", M_HandleConnectIP, 0},
-};
#endif
static menuitem_t MP_PlayerSetupMenu[] =
{
- {IT_KEYHANDLER | IT_STRING, NULL, "Your name", M_HandleSetupMultiPlayer, 0},
- {IT_KEYHANDLER | IT_STRING, NULL, "Your color", M_HandleSetupMultiPlayer, 16},
- {IT_KEYHANDLER | IT_STRING, NULL, "Your player", M_HandleSetupMultiPlayer, 96}, // Tails 01-18-2001
+ {IT_KEYHANDLER, NULL, "", M_HandleSetupMultiPlayer, 0}, // name
+ {IT_KEYHANDLER, NULL, "", M_HandleSetupMultiPlayer, 0}, // skin
+ {IT_KEYHANDLER, NULL, "", M_HandleSetupMultiPlayer, 0}, // colour
+ {IT_KEYHANDLER, NULL, "", M_HandleSetupMultiPlayer, 0}, // default
};
// ------------------------------------
@@ -1030,7 +1049,9 @@ static menuitem_t OP_P1ControlsMenu[] =
{IT_STRING | IT_CVAR, NULL, "Flip Camera with Gravity" , &cv_flipcam , 60},
{IT_STRING | IT_CVAR, NULL, "Crosshair", &cv_crosshair, 70},
- {IT_STRING | IT_CVAR, NULL, "Analog Control", &cv_useranalog, 90},
+ //{IT_STRING | IT_CVAR, NULL, "Analog Control", &cv_useranalog, 90},
+ {IT_STRING | IT_CVAR, NULL, "Character angle", &cv_directionchar, 90},
+ {IT_STRING | IT_CVAR, NULL, "Automatic braking", &cv_autobrake, 100},
};
static menuitem_t OP_P2ControlsMenu[] =
@@ -1043,7 +1064,9 @@ static menuitem_t OP_P2ControlsMenu[] =
{IT_STRING | IT_CVAR, NULL, "Flip Camera with Gravity" , &cv_flipcam2 , 60},
{IT_STRING | IT_CVAR, NULL, "Crosshair", &cv_crosshair2, 70},
- {IT_STRING | IT_CVAR, NULL, "Analog Control", &cv_useranalog2, 90},
+ //{IT_STRING | IT_CVAR, NULL, "Analog Control", &cv_useranalog2, 90},
+ {IT_STRING | IT_CVAR, NULL, "Character angle", &cv_directionchar2, 90},
+ {IT_STRING | IT_CVAR, NULL, "Automatic braking", &cv_autobrake2, 100},
};
static menuitem_t OP_ChangeControlsMenu[] =
@@ -1100,23 +1123,23 @@ static menuitem_t OP_ChangeControlsMenu[] =
static menuitem_t OP_Joystick1Menu[] =
{
{IT_STRING | IT_CALL, NULL, "Select Joystick...", M_Setup1PJoystickMenu, 10},
- {IT_STRING | IT_CVAR, NULL, "Move \x1A \x1B Axis" , &cv_moveaxis , 30},
- {IT_STRING | IT_CVAR, NULL, "Move \x1C \x1D Axis" , &cv_sideaxis , 40},
- {IT_STRING | IT_CVAR, NULL, "Camera \x1A \x1B Axis" , &cv_lookaxis , 50},
- {IT_STRING | IT_CVAR, NULL, "Camera \x1C \x1D Axis" , &cv_turnaxis , 60},
- {IT_STRING | IT_CVAR, NULL, "Fire Axis" , &cv_fireaxis , 70},
- {IT_STRING | IT_CVAR, NULL, "Fire Normal Axis" , &cv_firenaxis , 80},
+ {IT_STRING | IT_CVAR, NULL, "Move \x17 Axis" , &cv_moveaxis , 30},
+ {IT_STRING | IT_CVAR, NULL, "Move \x18 Axis" , &cv_sideaxis , 40},
+ {IT_STRING | IT_CVAR, NULL, "Camera \x17 Axis" , &cv_lookaxis , 50},
+ {IT_STRING | IT_CVAR, NULL, "Camera \x18 Axis" , &cv_turnaxis , 60},
+ {IT_STRING | IT_CVAR, NULL, "Fire Axis" , &cv_fireaxis , 70},
+ {IT_STRING | IT_CVAR, NULL, "Fire Normal Axis" , &cv_firenaxis , 80},
};
static menuitem_t OP_Joystick2Menu[] =
{
{IT_STRING | IT_CALL, NULL, "Select Joystick...", M_Setup2PJoystickMenu, 10},
- {IT_STRING | IT_CVAR, NULL, "Move \x1A \x1B Axis" , &cv_moveaxis2 , 30},
- {IT_STRING | IT_CVAR, NULL, "Move \x1C \x1D Axis" , &cv_sideaxis2 , 40},
- {IT_STRING | IT_CVAR, NULL, "Camera \x1A \x1B Axis" , &cv_lookaxis2 , 50},
- {IT_STRING | IT_CVAR, NULL, "Camera \x1C \x1D Axis" , &cv_turnaxis2 , 60},
- {IT_STRING | IT_CVAR, NULL, "Fire Axis" , &cv_fireaxis2 , 70},
- {IT_STRING | IT_CVAR, NULL, "Fire Normal Axis" , &cv_firenaxis2 , 80},
+ {IT_STRING | IT_CVAR, NULL, "Move \x17 Axis" , &cv_moveaxis2 , 30},
+ {IT_STRING | IT_CVAR, NULL, "Move \x18 Axis" , &cv_sideaxis2 , 40},
+ {IT_STRING | IT_CVAR, NULL, "Camera \x17 Axis" , &cv_lookaxis2 , 50},
+ {IT_STRING | IT_CVAR, NULL, "Camera \x18 Axis" , &cv_turnaxis2 , 60},
+ {IT_STRING | IT_CVAR, NULL, "Fire Axis" , &cv_fireaxis2 , 70},
+ {IT_STRING | IT_CVAR, NULL, "Fire Normal Axis" , &cv_firenaxis2 , 80},
};
static menuitem_t OP_JoystickSetMenu[] =
@@ -1304,9 +1327,10 @@ static menuitem_t OP_SoundOptionsMenu[] =
static menuitem_t OP_DataOptionsMenu[] =
{
- {IT_STRING | IT_CALL, NULL, "Screenshot Options...", M_ScreenshotOptions, 10},
+ {IT_STRING | IT_CALL, NULL, "Add-on Options...", M_AddonsOptions, 10},
+ {IT_STRING | IT_CALL, NULL, "Screenshot Options...", M_ScreenshotOptions, 20},
- {IT_STRING | IT_SUBMENU, NULL, "\x85" "Erase Data...", &OP_EraseDataDef, 20},
+ {IT_STRING | IT_SUBMENU, NULL, "\x85" "Erase Data...", &OP_EraseDataDef, 40},
};
static menuitem_t OP_ScreenshotOptionsMenu[] =
@@ -1353,6 +1377,24 @@ static menuitem_t OP_EraseDataMenu[] =
{IT_STRING | IT_CALL, NULL, "\x85" "Erase ALL Data", M_EraseData, 40},
};
+static menuitem_t OP_AddonsOptionsMenu[] =
+{
+ {IT_HEADER, NULL, "Menu", NULL, 0},
+ {IT_STRING|IT_CVAR, NULL, "Location", &cv_addons_option, 12},
+ {IT_STRING|IT_CVAR|IT_CV_STRING, NULL, "Custom Folder", &cv_addons_folder, 22},
+ {IT_STRING|IT_CVAR, NULL, "Identify add-ons via", &cv_addons_md5, 50},
+ {IT_STRING|IT_CVAR, NULL, "Show unsupported file types", &cv_addons_showall, 60},
+
+ {IT_HEADER, NULL, "Search", NULL, 78},
+ {IT_STRING|IT_CVAR, NULL, "Matching", &cv_addons_search_type, 90},
+ {IT_STRING|IT_CVAR, NULL, "Case-sensitive", &cv_addons_search_case, 100},
+};
+
+enum
+{
+ op_addons_folder = 2,
+};
+
static menuitem_t OP_ServerOptionsMenu[] =
{
{IT_HEADER, NULL, "General", NULL, 0},
@@ -1360,7 +1402,7 @@ static menuitem_t OP_ServerOptionsMenu[] =
{IT_STRING | IT_CVAR | IT_CV_STRING,
NULL, "Server name", &cv_servername, 7},
{IT_STRING | IT_CVAR, NULL, "Max Players", &cv_maxplayers, 21},
- {IT_STRING | IT_CVAR, NULL, "Allow WAD Downloading", &cv_downloading, 26},
+ {IT_STRING | IT_CVAR, NULL, "Allow Add-on Downloading", &cv_downloading, 26},
{IT_STRING | IT_CVAR, NULL, "Allow players to join", &cv_allownewplayer, 31},
#endif
{IT_STRING | IT_CVAR, NULL, "Map progression", &cv_advancemap, 36},
@@ -1372,33 +1414,38 @@ static menuitem_t OP_ServerOptionsMenu[] =
{IT_HEADER, NULL, "Items", NULL, 70},
{IT_STRING | IT_CVAR, NULL, "Item respawn delay", &cv_itemrespawntime, 76},
- {IT_STRING | IT_SUBMENU, NULL, "Random Item Box Toggles...", &OP_MonitorToggleDef, 81},
+ {IT_STRING | IT_SUBMENU, NULL, "Mystery Item Monitor Toggles...", &OP_MonitorToggleDef, 81},
- {IT_HEADER, NULL, "Platform (Coop, Race, Competition)", NULL, 90},
+ {IT_HEADER, NULL, "Cooperative", NULL, 90},
{IT_STRING | IT_CVAR, NULL, "Players required for exit", &cv_playersforexit, 96},
- {IT_STRING | IT_CVAR, NULL, "Level completion countdown", &cv_countdowntime, 101},
- {IT_STRING | IT_CVAR, NULL, "Item Boxes", &cv_competitionboxes, 106},
+ {IT_STRING | IT_CVAR, NULL, "Starposts", &cv_coopstarposts, 101},
+ {IT_STRING | IT_CVAR, NULL, "Life sharing", &cv_cooplives, 106},
- {IT_HEADER, NULL, "Ringslinger (Match, CTF, Tag, H&S)", NULL, 115},
- {IT_STRING | IT_CVAR, NULL, "Time Limit", &cv_timelimit, 121},
- {IT_STRING | IT_CVAR, NULL, "Score Limit", &cv_pointlimit, 126},
- {IT_STRING | IT_CVAR, NULL, "Overtime on Tie", &cv_overtime, 131},
- {IT_STRING | IT_CVAR, NULL, "Player respawn delay", &cv_respawntime, 136},
+ {IT_HEADER, NULL, "Race, Competition", NULL, 115},
+ {IT_STRING | IT_CVAR, NULL, "Level completion countdown", &cv_countdowntime, 121},
+ {IT_STRING | IT_CVAR, NULL, "Item Monitors", &cv_competitionboxes, 126},
- {IT_STRING | IT_CVAR, NULL, "Item Boxes", &cv_matchboxes, 146},
- {IT_STRING | IT_CVAR, NULL, "Weapon Rings", &cv_specialrings, 151},
- {IT_STRING | IT_CVAR, NULL, "Power Stones", &cv_powerstones, 156},
+ {IT_HEADER, NULL, "Ringslinger (Match, CTF, Tag, H&S)", NULL, 135},
+ {IT_STRING | IT_CVAR, NULL, "Time Limit", &cv_timelimit, 141},
+ {IT_STRING | IT_CVAR, NULL, "Score Limit", &cv_pointlimit, 146},
+ {IT_STRING | IT_CVAR, NULL, "Overtime on Tie", &cv_overtime, 151},
+ {IT_STRING | IT_CVAR, NULL, "Player respawn delay", &cv_respawntime, 156},
- {IT_STRING | IT_CVAR, NULL, "Flag respawn delay", &cv_flagtime, 166},
- {IT_STRING | IT_CVAR, NULL, "Hiding time", &cv_hidetime, 171},
+ {IT_STRING | IT_CVAR, NULL, "Item Monitors", &cv_matchboxes, 166},
+ {IT_STRING | IT_CVAR, NULL, "Weapon Rings", &cv_specialrings, 171},
+ {IT_STRING | IT_CVAR, NULL, "Power Stones", &cv_powerstones, 176},
- {IT_STRING | IT_CVAR, NULL, "Autobalance Teams", &cv_autobalance, 181},
- {IT_STRING | IT_CVAR, NULL, "Scramble Teams on Map Change", &cv_scrambleonchange, 186},
+ {IT_STRING | IT_CVAR, NULL, "Flag respawn delay", &cv_flagtime, 186},
+ {IT_STRING | IT_CVAR, NULL, "Hiding time", &cv_hidetime, 191},
+
+ {IT_HEADER, NULL, "Teams", NULL, 200},
+ {IT_STRING | IT_CVAR, NULL, "Autobalance sizes", &cv_autobalance, 206},
+ {IT_STRING | IT_CVAR, NULL, "Scramble on Map Change", &cv_scrambleonchange, 211},
#ifndef NONET
- {IT_HEADER, NULL, "Advanced", NULL, 195},
- {IT_STRING | IT_CVAR | IT_CV_STRING, NULL, "Master server", &cv_masterserver, 201},
- {IT_STRING | IT_CVAR, NULL, "Attempts to resynchronise", &cv_resynchattempts, 215},
+ {IT_HEADER, NULL, "Advanced", NULL, 220},
+ {IT_STRING | IT_CVAR | IT_CV_STRING, NULL, "Master server", &cv_masterserver, 226},
+ {IT_STRING | IT_CVAR, NULL, "Attempts to resynchronise", &cv_resynchattempts, 240},
#endif
};
@@ -1407,11 +1454,11 @@ static menuitem_t OP_MonitorToggleMenu[] =
// Printing handled by drawing function
{IT_STRING|IT_CALL, NULL, "Reset to defaults", M_ResetCvars, 15},
{IT_STRING|IT_CVAR|IT_CV_INVISSLIDER, NULL, "Recycler", &cv_recycler, 30},
- {IT_STRING|IT_CVAR|IT_CV_INVISSLIDER, NULL, "Teleporters", &cv_teleporters, 40},
+ {IT_STRING|IT_CVAR|IT_CV_INVISSLIDER, NULL, "Teleport", &cv_teleporters, 40},
{IT_STRING|IT_CVAR|IT_CV_INVISSLIDER, NULL, "Super Ring", &cv_superring, 50},
{IT_STRING|IT_CVAR|IT_CV_INVISSLIDER, NULL, "Super Sneakers", &cv_supersneakers, 60},
{IT_STRING|IT_CVAR|IT_CV_INVISSLIDER, NULL, "Invincibility", &cv_invincibility, 70},
- {IT_STRING|IT_CVAR|IT_CV_INVISSLIDER, NULL, "Jump Shield", &cv_jumpshield, 80},
+ {IT_STRING|IT_CVAR|IT_CV_INVISSLIDER, NULL, "Whirlwind Shield", &cv_jumpshield, 80},
{IT_STRING|IT_CVAR|IT_CV_INVISSLIDER, NULL, "Elemental Shield", &cv_watershield, 90},
{IT_STRING|IT_CVAR|IT_CV_INVISSLIDER, NULL, "Attraction Shield", &cv_ringshield, 100},
{IT_STRING|IT_CVAR|IT_CV_INVISSLIDER, NULL, "Force Shield", &cv_forceshield, 110},
@@ -1427,6 +1474,18 @@ static menuitem_t OP_MonitorToggleMenu[] =
// Main Menu and related
menu_t MainDef = CENTERMENUSTYLE(NULL, MainMenu, NULL, 72);
+menu_t MISC_AddonsDef =
+{
+ NULL,
+ sizeof (MISC_AddonsMenu)/sizeof (menuitem_t),
+ &MainDef,
+ MISC_AddonsMenu,
+ M_DrawAddons,
+ 50, 28,
+ 0,
+ NULL
+};
+
menu_t MAPauseDef = PAUSEMENUSTYLE(MAPauseMenu, 40, 72);
menu_t SPauseDef = PAUSEMENUSTYLE(SPauseMenu, 40, 72);
menu_t MPauseDef = PAUSEMENUSTYLE(MPauseMenu, 40, 72);
@@ -1646,29 +1705,16 @@ menu_t SP_PlayerDef =
};
// Multiplayer
-menu_t MP_MainDef = DEFAULTMENUSTYLE("M_MULTI", MP_MainMenu, &MainDef, 60, 40);
-
-menu_t MP_ServerDef =
-{
- "M_MULTI",
- sizeof (MP_ServerMenu)/sizeof (menuitem_t),
- &MP_MainDef,
- MP_ServerMenu,
- M_DrawServerMenu,
- 27, 30
-#ifdef NONET
- - 50
-#endif
- ,
- 0,
- NULL
-};
menu_t MP_SplitServerDef =
{
"M_MULTI",
sizeof (MP_SplitServerMenu)/sizeof (menuitem_t),
+#ifndef NONET
&MP_MainDef,
+#else
+ &MainDef,
+#endif
MP_SplitServerMenu,
M_DrawServerMenu,
27, 30 - 50,
@@ -1677,6 +1723,31 @@ menu_t MP_SplitServerDef =
};
#ifndef NONET
+
+menu_t MP_MainDef =
+{
+ "M_MULTI",
+ sizeof (MP_MainMenu)/sizeof (menuitem_t),
+ &MainDef,
+ MP_MainMenu,
+ M_DrawMPMainMenu,
+ 27, 40,
+ 0,
+ M_CancelConnect
+};
+
+menu_t MP_ServerDef =
+{
+ "M_MULTI",
+ sizeof (MP_ServerMenu)/sizeof (menuitem_t),
+ &MP_MainDef,
+ MP_ServerMenu,
+ M_DrawServerMenu,
+ 27, 30,
+ 0,
+ NULL
+};
+
menu_t MP_ConnectDef =
{
"M_MULTI",
@@ -1688,17 +1759,7 @@ menu_t MP_ConnectDef =
0,
M_CancelConnect
};
-menu_t MP_ConnectIPDef =
-{
- "M_MULTI",
- sizeof (MP_ConnectIPMenu)/sizeof (menuitem_t),
- &MP_MainDef,
- MP_ConnectIPMenu,
- M_DrawConnectIPMenu,
- 27,40,
- 0,
- M_CancelConnect
-};
+
menu_t MP_RoomDef =
{
"M_MULTI",
@@ -1716,23 +1777,23 @@ menu_t MP_PlayerSetupDef =
{
"M_SPLAYR",
sizeof (MP_PlayerSetupMenu)/sizeof (menuitem_t),
- &MP_MainDef,
+ &MainDef, // doesn't matter
MP_PlayerSetupMenu,
M_DrawSetupMultiPlayerMenu,
- 27, 40,
+ 19, 22,
0,
M_QuitMultiPlayerMenu
};
// Options
-menu_t OP_MainDef = DEFAULTMENUSTYLE("M_OPTTTL", OP_MainMenu, &MainDef, 60, 30);
+menu_t OP_MainDef = DEFAULTMENUSTYLE("M_OPTTTL", OP_MainMenu, &MainDef, 50, 30);
menu_t OP_ChangeControlsDef = CONTROLMENUSTYLE(OP_ChangeControlsMenu, &OP_MainDef);
menu_t OP_P1ControlsDef = DEFAULTMENUSTYLE("M_CONTRO", OP_P1ControlsMenu, &OP_MainDef, 50, 30);
menu_t OP_P2ControlsDef = DEFAULTMENUSTYLE("M_CONTRO", OP_P2ControlsMenu, &OP_MainDef, 50, 30);
menu_t OP_MouseOptionsDef = DEFAULTMENUSTYLE("M_CONTRO", OP_MouseOptionsMenu, &OP_P1ControlsDef, 35, 30);
menu_t OP_Mouse2OptionsDef = DEFAULTMENUSTYLE("M_CONTRO", OP_Mouse2OptionsMenu, &OP_P2ControlsDef, 35, 30);
-menu_t OP_Joystick1Def = DEFAULTMENUSTYLE("M_CONTRO", OP_Joystick1Menu, &OP_P1ControlsDef, 60, 30);
-menu_t OP_Joystick2Def = DEFAULTMENUSTYLE("M_CONTRO", OP_Joystick2Menu, &OP_P2ControlsDef, 60, 30);
+menu_t OP_Joystick1Def = DEFAULTMENUSTYLE("M_CONTRO", OP_Joystick1Menu, &OP_P1ControlsDef, 50, 30);
+menu_t OP_Joystick2Def = DEFAULTMENUSTYLE("M_CONTRO", OP_Joystick2Menu, &OP_P2ControlsDef, 50, 30);
menu_t OP_JoystickSetDef =
{
"M_CONTRO",
@@ -1790,17 +1851,7 @@ menu_t OP_SoundOptionsDef =
NULL
};
-menu_t OP_ServerOptionsDef =
-{
- "M_SERVER",
- sizeof (OP_ServerOptionsMenu)/sizeof (menuitem_t),
- &OP_MainDef,
- OP_ServerOptionsMenu,
- M_DrawGenericScrollMenu,
- 30, 30,
- 0,
- NULL
-};
+menu_t OP_ServerOptionsDef = DEFAULTSCROLLMENUSTYLE("M_SERVER", OP_ServerOptionsMenu, &OP_MainDef, 30, 30);
menu_t OP_MonitorToggleDef =
{
@@ -1842,7 +1893,7 @@ menu_t OP_OpenGLColorDef =
NULL
};
#endif
-menu_t OP_DataOptionsDef = DEFAULTMENUSTYLE("M_DATA", OP_DataOptionsMenu, &OP_MainDef, 30, 30);
+menu_t OP_DataOptionsDef = DEFAULTMENUSTYLE("M_DATA", OP_DataOptionsMenu, &OP_MainDef, 60, 30);
menu_t OP_ScreenshotOptionsDef =
{
@@ -1856,6 +1907,8 @@ menu_t OP_ScreenshotOptionsDef =
NULL
};
+menu_t OP_AddonsOptionsDef = DEFAULTMENUSTYLE("M_ADDONS", OP_AddonsOptionsMenu, &OP_DataOptionsDef, 30, 30);
+
menu_t OP_EraseDataDef = DEFAULTMENUSTYLE("M_DATA", OP_EraseDataMenu, &OP_DataOptionsDef, 60, 30);
// ==========================================================================
@@ -2074,6 +2127,12 @@ void Moviemode_mode_Onchange(void)
OP_ScreenshotOptionsMenu[i].status = IT_STRING|IT_CVAR;
}
+void Addons_option_Onchange(void)
+{
+ OP_AddonsOptionsMenu[op_addons_folder].status =
+ (cv_addons_option.value == 3 ? IT_CVAR|IT_STRING|IT_CV_STRING : IT_DISABLED);
+}
+
// ==========================================================================
// END ORGANIZATION STUFF.
// ==========================================================================
@@ -2136,9 +2195,12 @@ static void M_ChangeCvar(INT32 choice)
static boolean M_ChangeStringCvar(INT32 choice)
{
consvar_t *cv = (consvar_t *)currentMenu->menuitems[itemOn].itemaction;
- char buf[255];
+ char buf[MAXSTRINGLENGTH];
size_t len;
+ if (shiftdown && choice >= 32 && choice <= 127)
+ choice = shiftxform[choice];
+
switch (choice)
{
case KEY_BACKSPACE:
@@ -2356,7 +2418,6 @@ boolean M_Responder(event_t *ev)
itemOn = 0;
return true;
-#ifndef DC
case KEY_F5: // Video Mode
if (modeattacking)
return true;
@@ -2364,7 +2425,6 @@ boolean M_Responder(event_t *ev)
M_Options(0);
M_VideoModeMenu(0);
return true;
-#endif
case KEY_F6: // Empty
return true;
@@ -2449,8 +2509,6 @@ boolean M_Responder(event_t *ev)
{
if ((currentMenu->menuitems[itemOn].status & IT_CVARTYPE) == IT_CV_STRING)
{
- if (shiftdown && ch >= 32 && ch <= 127)
- ch = shiftxform[ch];
if (M_ChangeStringCvar(ch))
return true;
else
@@ -2512,7 +2570,7 @@ boolean M_Responder(event_t *ev)
{
if (((currentMenu->menuitems[itemOn].status & IT_CALLTYPE) & IT_CALL_NOTMODIFIED) && modifiedgame && !savemoddata)
{
- S_StartSound(NULL, sfx_menu1);
+ S_StartSound(NULL, sfx_skid);
M_StartMessage(M_GetText("This cannot be done in a modified game.\n\n(Press a key)\n"), NULL, MM_NOTHING);
return true;
}
@@ -2696,6 +2754,7 @@ void M_StartControlPanel(void)
else // multiplayer
{
MPauseMenu[mpause_switchmap].status = IT_DISABLED;
+ MPauseMenu[mpause_addons].status = IT_DISABLED;
MPauseMenu[mpause_scramble].status = IT_DISABLED;
MPauseMenu[mpause_psetupsplit].status = IT_DISABLED;
MPauseMenu[mpause_psetupsplit2].status = IT_DISABLED;
@@ -2707,6 +2766,7 @@ void M_StartControlPanel(void)
if ((server || adminplayer == consoleplayer))
{
MPauseMenu[mpause_switchmap].status = IT_STRING | IT_CALL;
+ MPauseMenu[mpause_addons].status = IT_STRING | IT_CALL;
if (G_GametypeHasTeams())
MPauseMenu[mpause_scramble].status = IT_STRING | IT_SUBMENU;
}
@@ -2752,9 +2812,8 @@ void M_ClearMenus(boolean callexitmenufunc)
if (currentMenu->quitroutine && callexitmenufunc && !currentMenu->quitroutine())
return; // we can't quit this menu (also used to set parameter from the menu)
-#ifndef DC // Save the config file. I'm sick of crashing the game later and losing all my changes!
+ // Save the config file. I'm sick of crashing the game later and losing all my changes!
COM_BufAddText(va("saveconfig \"%s\" -silent\n", configfile));
-#endif //Alam: But not on the Dreamcast's VMUs
if (currentMenu == &MessageDef) // Oh sod off!
currentMenu = &MainDef; // Not like it matters
@@ -2934,7 +2993,7 @@ static void M_DrawThermo(INT32 x, INT32 y, consvar_t *cv)
}
// A smaller 'Thermo', with range given as percents (0-100)
-static void M_DrawSlider(INT32 x, INT32 y, const consvar_t *cv)
+static void M_DrawSlider(INT32 x, INT32 y, const consvar_t *cv, boolean ontop)
{
INT32 i;
INT32 range;
@@ -2948,6 +3007,14 @@ static void M_DrawSlider(INT32 x, INT32 y, const consvar_t *cv)
for (i = 1; i < SLIDER_RANGE; i++)
V_DrawScaledPatch (x+i*8, y, 0,p);
+ if (ontop)
+ {
+ V_DrawCharacter(x - 6 - (skullAnimCounter/5), y,
+ '\x1C' | V_YELLOWMAP, false);
+ V_DrawCharacter(x+i*8 + 8 + (skullAnimCounter/5), y,
+ '\x1D' | V_YELLOWMAP, false);
+ }
+
p = W_CachePatchName("M_SLIDER", PU_CACHE);
V_DrawScaledPatch(x+i*8, y, 0, p);
@@ -3169,6 +3236,7 @@ static void M_DrawGenericMenu(void)
W_CachePatchName(currentMenu->menuitems[i].patch, PU_CACHE));
}
}
+ /* FALLTHRU */
case IT_NOTHING:
case IT_DYBIGSPACE:
y += LINEHEIGHT;
@@ -3197,7 +3265,7 @@ static void M_DrawGenericMenu(void)
switch (currentMenu->menuitems[i].status & IT_CVARTYPE)
{
case IT_CV_SLIDER:
- M_DrawSlider(x, y, cv);
+ M_DrawSlider(x, y, cv, (i == itemOn));
case IT_CV_NOPRINT: // color use this
case IT_CV_INVISSLIDER: // monitor toggles use this
break;
@@ -3212,6 +3280,13 @@ static void M_DrawGenericMenu(void)
default:
V_DrawRightAlignedString(BASEVIDWIDTH - x, y,
((cv->flags & CV_CHEAT) && !CV_IsSetToDefault(cv) ? V_REDMAP : V_YELLOWMAP), cv->string);
+ if (i == itemOn)
+ {
+ V_DrawCharacter(BASEVIDWIDTH - x - 10 - V_StringWidth(cv->string, 0) - (skullAnimCounter/5), y,
+ '\x1C' | V_YELLOWMAP, false);
+ V_DrawCharacter(BASEVIDWIDTH - x + 2 + (skullAnimCounter/5), y,
+ '\x1D' | V_YELLOWMAP, false);
+ }
break;
}
break;
@@ -3220,6 +3295,7 @@ static void M_DrawGenericMenu(void)
break;
case IT_STRING2:
V_DrawString(x, y, 0, currentMenu->menuitems[i].text);
+ /* FALLTHRU */
case IT_DYLITLSPACE:
y += SMALLLINEHEIGHT;
break;
@@ -3232,6 +3308,7 @@ static void M_DrawGenericMenu(void)
case IT_TRANSTEXT:
if (currentMenu->menuitems[i].alphaKey)
y = currentMenu->y+currentMenu->menuitems[i].alphaKey;
+ /* FALLTHRU */
case IT_TRANSTEXT2:
V_DrawString(x, y, V_TRANSLUCENT, currentMenu->menuitems[i].text);
y += SMALLLINEHEIGHT;
@@ -3248,7 +3325,7 @@ static void M_DrawGenericMenu(void)
y = currentMenu->y+currentMenu->menuitems[i].alphaKey;
//V_DrawString(x-16, y, V_YELLOWMAP, currentMenu->menuitems[i].text);
- M_DrawLevelPlatterHeader(y - (lsheadingheight - 12), currentMenu->menuitems[i].text, true);
+ M_DrawLevelPlatterHeader(y - (lsheadingheight - 12), currentMenu->menuitems[i].text, true, false);
y += SMALLLINEHEIGHT;
break;
}
@@ -3306,9 +3383,9 @@ static void M_DrawGenericScrollMenu(void)
}
if (i)
- V_DrawString(currentMenu->x - 20, currentMenu->y, V_YELLOWMAP, "\x1A"); // up arrow
+ V_DrawString(currentMenu->x - 20, currentMenu->y - (skullAnimCounter/5), V_YELLOWMAP, "\x1A"); // up arrow
if (max != bottom)
- V_DrawString(currentMenu->x - 20, currentMenu->y + 2*scrollareaheight, V_YELLOWMAP, "\x1B"); // down arrow
+ V_DrawString(currentMenu->x - 20, currentMenu->y + 2*scrollareaheight + (skullAnimCounter/5), V_YELLOWMAP, "\x1B"); // down arrow
// draw title (or big pic)
M_DrawMenuTitle();
@@ -3346,7 +3423,7 @@ static void M_DrawGenericScrollMenu(void)
switch (currentMenu->menuitems[i].status & IT_CVARTYPE)
{
case IT_CV_SLIDER:
- M_DrawSlider(x, y, cv);
+ M_DrawSlider(x, y, cv, (i == itemOn));
case IT_CV_NOPRINT: // color use this
case IT_CV_INVISSLIDER: // monitor toggles use this
break;
@@ -3375,6 +3452,13 @@ static void M_DrawGenericScrollMenu(void)
default:
V_DrawRightAlignedString(BASEVIDWIDTH - x, y,
((cv->flags & CV_CHEAT) && !CV_IsSetToDefault(cv) ? V_REDMAP : V_YELLOWMAP), cv->string);
+ if (i == itemOn)
+ {
+ V_DrawCharacter(BASEVIDWIDTH - x - 10 - V_StringWidth(cv->string, 0) - (skullAnimCounter/5), y,
+ '\x1C' | V_YELLOWMAP, false);
+ V_DrawCharacter(BASEVIDWIDTH - x + 2 + (skullAnimCounter/5), y,
+ '\x1D' | V_YELLOWMAP, false);
+ }
break;
}
break;
@@ -3388,7 +3472,7 @@ static void M_DrawGenericScrollMenu(void)
break;
case IT_HEADERTEXT:
//V_DrawString(x-16, y, V_YELLOWMAP, currentMenu->menuitems[i].text);
- M_DrawLevelPlatterHeader(y - (lsheadingheight - 12), currentMenu->menuitems[i].text, true);
+ M_DrawLevelPlatterHeader(y - (lsheadingheight - 12), currentMenu->menuitems[i].text, true, false);
break;
}
}
@@ -3574,6 +3658,7 @@ static void M_DrawCenteredMenu(void)
W_CachePatchName(currentMenu->menuitems[i].patch, PU_CACHE));
}
}
+ /* FALLTHRU */
case IT_NOTHING:
case IT_DYBIGSPACE:
y += LINEHEIGHT;
@@ -3602,7 +3687,7 @@ static void M_DrawCenteredMenu(void)
switch(currentMenu->menuitems[i].status & IT_CVARTYPE)
{
case IT_CV_SLIDER:
- M_DrawSlider(x, y, cv);
+ M_DrawSlider(x, y, cv, (i == itemOn));
case IT_CV_NOPRINT: // color use this
break;
case IT_CV_STRING:
@@ -3616,6 +3701,13 @@ static void M_DrawCenteredMenu(void)
default:
V_DrawString(BASEVIDWIDTH - x - V_StringWidth(cv->string, 0), y,
((cv->flags & CV_CHEAT) && !CV_IsSetToDefault(cv) ? V_REDMAP : V_YELLOWMAP), cv->string);
+ if (i == itemOn)
+ {
+ V_DrawCharacter(BASEVIDWIDTH - x - 10 - V_StringWidth(cv->string, 0) - (skullAnimCounter/5), y,
+ '\x1C' | V_YELLOWMAP, false);
+ V_DrawCharacter(BASEVIDWIDTH - x + 2 + (skullAnimCounter/5), y,
+ '\x1D' | V_YELLOWMAP, false);
+ }
break;
}
break;
@@ -3624,6 +3716,7 @@ static void M_DrawCenteredMenu(void)
break;
case IT_STRING2:
V_DrawCenteredString(x, y, 0, currentMenu->menuitems[i].text);
+ /* FALLTHRU */
case IT_DYLITLSPACE:
y += SMALLLINEHEIGHT;
break;
@@ -3898,7 +3991,7 @@ static boolean M_PrepareLevelPlatter(INT32 gt)
I_Error("Insufficient memory to prepare level platter");
// done here so lsrow and lscol can be set if cv_nextmap is on the platter
- lsrow = lscol = lstic = lshli = lsoffs[0] = lsoffs[1] = 0;
+ lsrow = lscol = lshli = lsoffs[0] = lsoffs[1] = 0;
while (mapnum < NUMMAPS)
{
@@ -3962,10 +4055,10 @@ static boolean M_PrepareLevelPlatter(INT32 gt)
if (actnum)
sprintf(mapname, "%s %d", mapheaderinfo[mapnum]->lvlttl, actnum);
else
- sprintf(mapname, "%s", mapheaderinfo[mapnum]->lvlttl);
+ strcpy(mapname, mapheaderinfo[mapnum]->lvlttl);
if (strlen(mapname) >= 17)
- sprintf(mapname+17-3, "...");
+ strcpy(mapname+17-3, "...");
strcpy(levelselect.rows[row].mapnames[col], (const char *)mapname);
}
@@ -3994,6 +4087,24 @@ static boolean M_PrepareLevelPlatter(INT32 gt)
mapnum++;
}
+#ifdef SYMMETRICAL_PLATTER
+ // horizontally space out rows with missing right sides
+ for (; row >= 0; row--)
+ {
+ if (!levelselect.rows[row].maplist[2] // no right side
+ && levelselect.rows[row].maplist[0] && levelselect.rows[row].maplist[1]) // all the left filled in
+ {
+ levelselect.rows[row].maplist[2] = levelselect.rows[row].maplist[1];
+ STRBUFCPY(levelselect.rows[row].mapnames[2], levelselect.rows[row].mapnames[1]);
+ levelselect.rows[row].mapavailable[2] = levelselect.rows[row].mapavailable[1];
+
+ levelselect.rows[row].maplist[1] = -1; // diamond
+ levelselect.rows[row].mapnames[1][0] = '\0';
+ levelselect.rows[row].mapavailable[1] = false;
+ }
+ }
+#endif
+
if (levselp[0][0]) // never going to have some provided but not all, saves individually checking
{
W_UnlockCachedPatch(levselp[0][0]);
@@ -4131,7 +4242,7 @@ static void M_HandleLevelPlatter(INT32 choice)
else if (!lsoffs[0]) // prevent sound spam
{
lsoffs[0] = -8;
- S_StartSound(NULL,sfx_s3kb2);
+ S_StartSound(NULL,sfx_lose);
}
break;
@@ -4157,21 +4268,15 @@ static void M_HandleLevelPlatter(INT32 choice)
}
}
-void M_DrawLevelPlatterHeader(INT32 y, const char *header, boolean headerhighlight)
+void M_DrawLevelPlatterHeader(INT32 y, const char *header, boolean headerhighlight, boolean allowlowercase)
{
y += lsheadingheight - 12;
- V_DrawString(19, y, (headerhighlight ? V_YELLOWMAP : 0), header);
+ V_DrawString(19, y, (headerhighlight ? V_YELLOWMAP : 0)|(allowlowercase ? V_ALLOWLOWERCASE : 0), header);
y += 9;
- if ((y >= 0) && (y < 200))
- {
- V_DrawFill(19, y, 281, 1, (headerhighlight ? yellowmap[3] : 3));
- V_DrawFill(300, y, 1, 1, 26);
- }
+ V_DrawFill(19, y, 281, 1, (headerhighlight ? yellowmap[3] : 3));
+ V_DrawFill(300, y, 1, 1, 26);
y++;
- if ((y >= 0) && (y < 200))
- {
- V_DrawFill(19, y, 282, 1, 26);
- }
+ V_DrawFill(19, y, 282, 1, 26);
}
static void M_DrawLevelPlatterWideMap(UINT8 row, UINT8 col, INT32 x, INT32 y, boolean highlight)
@@ -4179,7 +4284,7 @@ static void M_DrawLevelPlatterWideMap(UINT8 row, UINT8 col, INT32 x, INT32 y, bo
patch_t *patch;
INT32 map = levelselect.rows[row].maplist[col];
- if (!map)
+ if (map <= 0)
return;
// A 564x100 image of the level as entry MAPxxW
@@ -4195,22 +4300,9 @@ static void M_DrawLevelPlatterWideMap(UINT8 row, UINT8 col, INT32 x, INT32 y, bo
V_DrawSmallScaledPatch(x, y, 0, patch);
}
- if ((y+50) < 200)
- {
- INT32 topy = (y+50), h = 8;
-
- if (topy < 0)
- {
- h += topy;
- topy = 0;
- }
- else if (topy + h >= 200)
- h = 200 - y;
- if (h > 0)
- V_DrawFill(x, topy, 282, h,
- ((mapheaderinfo[map-1]->unlockrequired < 0)
- ? 159 : 63));
- }
+ V_DrawFill(x, y+50, 282, 8,
+ ((mapheaderinfo[map-1]->unlockrequired < 0)
+ ? 159 : 63));
V_DrawString(x, y+50, (highlight ? V_YELLOWMAP : 0), levelselect.rows[row].mapnames[col]);
}
@@ -4220,7 +4312,7 @@ static void M_DrawLevelPlatterMap(UINT8 row, UINT8 col, INT32 x, INT32 y, boolea
patch_t *patch;
INT32 map = levelselect.rows[row].maplist[col];
- if (!map)
+ if (map <= 0)
return;
// A 160x100 image of the level as entry MAPxxP
@@ -4236,22 +4328,9 @@ static void M_DrawLevelPlatterMap(UINT8 row, UINT8 col, INT32 x, INT32 y, boolea
V_DrawSmallScaledPatch(x, y, 0, patch);
}
- if ((y+50) < 200)
- {
- INT32 topy = (y+50), h = 8;
-
- if (topy < 0)
- {
- h += topy;
- topy = 0;
- }
- else if (topy + h >= 200)
- h = 200 - y;
- if (h > 0)
- V_DrawFill(x, topy, 80, h,
- ((mapheaderinfo[map-1]->unlockrequired < 0)
- ? 159 : 63));
- }
+ V_DrawFill(x, y+50, 80, 8,
+ ((mapheaderinfo[map-1]->unlockrequired < 0)
+ ? 159 : 63));
if (strlen(levelselect.rows[row].mapnames[col]) > 6) // "AERIAL GARDEN" vs "ACT 18" - "THE ACT" intentionally compressed
V_DrawThinString(x, y+50, (highlight ? V_YELLOWMAP : 0), levelselect.rows[row].mapnames[col]);
@@ -4265,7 +4344,7 @@ static void M_DrawLevelPlatterRow(UINT8 row, INT32 y)
const boolean rowhighlight = (row == lsrow);
if (levelselect.rows[row].header[0])
{
- M_DrawLevelPlatterHeader(y, levelselect.rows[row].header, (rowhighlight || (row == lshli)));
+ M_DrawLevelPlatterHeader(y, levelselect.rows[row].header, (rowhighlight || (row == lshli)), false);
y += lsheadingheight;
}
@@ -4284,9 +4363,6 @@ static void M_DrawLevelPlatterMenu(void)
INT32 y = lsbasey + lsoffs[0] - getheadingoffset(lsrow);
const INT32 cursorx = (sizeselect ? 0 : (lscol*lshseperation));
- if (++lstic == 32)
- lstic = 0;
-
if (gamestate == GS_TIMEATTACK)
V_DrawPatchFill(W_CachePatchName("SRB2BACK", PU_CACHE));
@@ -4306,18 +4382,18 @@ static void M_DrawLevelPlatterMenu(void)
}
// draw cursor box
- V_DrawSmallScaledPatch(lsbasex + cursorx + lsoffs[1], lsbasey, 0, ((lstic & 8) ? levselp[sizeselect][0] : levselp[sizeselect][1]));
+ V_DrawSmallScaledPatch(lsbasex + cursorx + lsoffs[1], lsbasey, 0, (levselp[sizeselect][((skullAnimCounter/4) ? 1 : 0)]));
- if (levelselect.rows[lsrow].maplist[lscol])
+ if (levelselect.rows[lsrow].maplist[lscol] > 0)
V_DrawScaledPatch(lsbasex + cursorx-17, lsbasey+50+lsoffs[0], 0, W_CachePatchName("M_CURSOR", PU_CACHE));
// handle movement of cursor box
- if (abs(lsoffs[0]) > 1)
+ if (lsoffs[0] > 1 || lsoffs[0] < -1)
lsoffs[0] = 2*lsoffs[0]/3;
else
lsoffs[0] = 0;
- if (abs(lsoffs[1]) > 1)
+ if (lsoffs[1] > 1 || lsoffs[1] < -1)
lsoffs[1] = 2*lsoffs[1]/3;
else
lsoffs[1] = 0;
@@ -4606,6 +4682,519 @@ static void M_HandleImageDef(INT32 choice)
// MISC MAIN MENU OPTIONS
// ======================
+static void M_AddonsOptions(INT32 choice)
+{
+ (void)choice;
+ Addons_option_Onchange();
+
+ M_SetupNextMenu(&OP_AddonsOptionsDef);
+}
+
+#define LOCATIONSTRING "Visit \x83SRB2.ORG/MODS\x80 to get & make add-ons!"
+
+static void M_Addons(INT32 choice)
+{
+ const char *pathname = ".";
+
+ (void)choice;
+
+ /*if (cv_addons_option.value == 0)
+ pathname = srb2home; usehome ? srb2home : srb2path;
+ else if (cv_addons_option.value == 1)
+ pathname = srb2home;
+ else if (cv_addons_option.value == 2)
+ pathname = srb2path;
+ else*/
+ if (cv_addons_option.value == 3 && *cv_addons_folder.string != '\0')
+ pathname = cv_addons_folder.string;
+
+ strlcpy(menupath, pathname, 1024);
+ menupathindex[(menudepthleft = menudepth-1)] = strlen(menupath) + 1;
+
+ if (menupath[menupathindex[menudepthleft]-2] != '/')
+ {
+ menupath[menupathindex[menudepthleft]-1] = '/';
+ menupath[menupathindex[menudepthleft]] = 0;
+ }
+ else
+ --menupathindex[menudepthleft];
+
+ if (!preparefilemenu(false))
+ {
+ M_StartMessage(M_GetText("No files/folders found.\n\n"LOCATIONSTRING"\n\n(Press a key)\n"),NULL,MM_NOTHING);
+ return;
+ }
+ else
+ dir_on[menudepthleft] = 0;
+
+ if (addonsp[0]) // never going to have some provided but not all, saves individually checking
+ {
+ size_t i;
+ for (i = 0; i < NUM_EXT+6; i++)
+ W_UnlockCachedPatch(addonsp[i]);
+ }
+
+ addonsp[EXT_FOLDER] = W_CachePatchName("M_FFLDR", PU_STATIC);
+ addonsp[EXT_UP] = W_CachePatchName("M_FBACK", PU_STATIC);
+ addonsp[EXT_NORESULTS] = W_CachePatchName("M_FNOPE", PU_STATIC);
+ addonsp[EXT_TXT] = W_CachePatchName("M_FTXT", PU_STATIC);
+ addonsp[EXT_CFG] = W_CachePatchName("M_FCFG", PU_STATIC);
+ addonsp[EXT_WAD] = W_CachePatchName("M_FWAD", PU_STATIC);
+ addonsp[EXT_SOC] = W_CachePatchName("M_FSOC", PU_STATIC);
+ addonsp[EXT_LUA] = W_CachePatchName("M_FLUA", PU_STATIC);
+ addonsp[NUM_EXT] = W_CachePatchName("M_FUNKN", PU_STATIC);
+ addonsp[NUM_EXT+1] = W_CachePatchName("M_FSEL1", PU_STATIC);
+ addonsp[NUM_EXT+2] = W_CachePatchName("M_FSEL2", PU_STATIC);
+ addonsp[NUM_EXT+3] = W_CachePatchName("M_FLOAD", PU_STATIC);
+ addonsp[NUM_EXT+4] = W_CachePatchName("M_FSRCH", PU_STATIC);
+ addonsp[NUM_EXT+5] = W_CachePatchName("M_FSAVE", PU_STATIC);
+
+ MISC_AddonsDef.prevMenu = currentMenu;
+ M_SetupNextMenu(&MISC_AddonsDef);
+}
+
+#define width 4
+#define vpadding 27
+#define h (BASEVIDHEIGHT-(2*vpadding))
+#define NUMCOLOURS 8 // when toast's coding it's british english hacker fucker
+static void M_DrawTemperature(INT32 x, fixed_t t)
+{
+ INT32 y;
+
+ // bounds check
+ if (t > FRACUNIT)
+ t = FRACUNIT;
+ /*else if (t < 0) -- not needed
+ t = 0;*/
+
+ // scale
+ if (t > 1)
+ t = (FixedMul(h<>FRACBITS);
+
+ // border
+ V_DrawFill(x - 1, vpadding, 1, h, 3);
+ V_DrawFill(x + width, vpadding, 1, h, 3);
+ V_DrawFill(x - 1, vpadding-1, width+2, 1, 3);
+ V_DrawFill(x - 1, vpadding+h, width+2, 1, 3);
+
+ // bar itself
+ y = h;
+ if (t)
+ for (t = h - t; y > 0; y--)
+ {
+ UINT8 colours[NUMCOLOURS] = {42, 40, 58, 222, 65, 90, 97, 98};
+ UINT8 c;
+ if (y <= t) break;
+ if (y+vpadding >= BASEVIDHEIGHT/2)
+ c = 113;
+ else
+ c = colours[(NUMCOLOURS*(y-1))/(h/2)];
+ V_DrawFill(x, y-1 + vpadding, width, 1, c);
+ }
+
+ // fill the rest of the backing
+ if (y)
+ V_DrawFill(x, vpadding, width, y, 27);
+}
+#undef width
+#undef vpadding
+#undef h
+#undef NUMCOLOURS
+
+static char *M_AddonsHeaderPath(void)
+{
+ UINT32 len;
+ static char header[1024];
+
+ if (menupath[0] == '.')
+ strlcpy(header, va("SRB2 folder%s", menupath+1), 1024);
+ else
+ strcpy(header, menupath);
+
+ len = strlen(header);
+ if (len > 34)
+ {
+ len = len-34;
+ header[len] = header[len+1] = header[len+2] = '.';
+ }
+ else
+ len = 0;
+
+ return header+len;
+}
+
+#define UNEXIST S_StartSound(NULL, sfx_lose);\
+ M_SetupNextMenu(MISC_AddonsDef.prevMenu);\
+ M_StartMessage(va("\x82%s\x80\nThis folder no longer exists!\nAborting to main menu.\n\n(Press a key)\n", M_AddonsHeaderPath()),NULL,MM_NOTHING)
+
+// returns whether to do message draw
+static boolean M_AddonsRefresh(void)
+{
+ if ((refreshdirmenu & REFRESHDIR_NORMAL) && !preparefilemenu(true))
+ {
+ UNEXIST;
+ return true;
+ }
+
+ if (refreshdirmenu & REFRESHDIR_ADDFILE)
+ {
+ addonsresponselimit = 0;
+
+ if (refreshdirmenu & REFRESHDIR_NOTLOADED)
+ {
+ char *message = NULL;
+ S_StartSound(NULL, sfx_lose);
+ if (refreshdirmenu & REFRESHDIR_MAX)
+ message = va("\x82%s\x80\nMaximum number of add-ons reached.\nThis file could not be loaded.\nIf you want to play with this add-on, restart the game to clear existing ones.\n\n(Press a key)\n", dirmenu[dir_on[menudepthleft]]+DIR_STRING);
+ else
+ message = va("\x82%s\x80\nThe file was not loaded.\nCheck the console log for more information.\n\n(Press a key)\n", dirmenu[dir_on[menudepthleft]]+DIR_STRING);
+ M_StartMessage(message,NULL,MM_NOTHING);
+ return true;
+ }
+
+ if (refreshdirmenu & (REFRESHDIR_WARNING|REFRESHDIR_ERROR))
+ {
+ S_StartSound(NULL, sfx_skid);
+ M_StartMessage(va("\x82%s\x80\nThe file was loaded with %s.\nCheck the console log for more information.\n\n(Press a key)\n", dirmenu[dir_on[menudepthleft]]+DIR_STRING, ((refreshdirmenu & REFRESHDIR_ERROR) ? "errors" : "warnings")),NULL,MM_NOTHING);
+ return true;
+ }
+
+ S_StartSound(NULL, sfx_strpst);
+ }
+
+ return false;
+}
+
+#define offs 1
+
+#ifdef __GNUC__
+#pragma GCC optimize ("0")
+#endif
+
+static void M_DrawAddons(void)
+{
+ INT32 x, y;
+ ssize_t i, max;
+
+ // hack - need to refresh at end of frame to handle addfile...
+ if (refreshdirmenu & M_AddonsRefresh())
+ return M_DrawMessageMenu();
+
+ if (addonsresponselimit)
+ addonsresponselimit--;
+
+ V_DrawCenteredString(BASEVIDWIDTH/2, 4+offs, 0, (Playing()
+ ? "\x85""Adding files mid-game may cause problems."
+ : LOCATIONSTRING));
+
+ if (numwadfiles <= mainwads+1)
+ y = 0;
+ else if (numwadfiles >= MAX_WADFILES)
+ y = FRACUNIT;
+ else
+ {
+ x = FixedDiv((numwadfiles - mainwads+1)< y)
+ y = x;
+ if (y > FRACUNIT) // happens because of how we're shrinkin' it a little
+ y = FRACUNIT;
+ }
+
+ M_DrawTemperature(BASEVIDWIDTH - 19 - 5, y);
+
+ // DRAW MENU
+ x = currentMenu->x;
+ y = currentMenu->y + offs;
+
+ //M_DrawLevelPlatterHeader(y - 16, M_AddonsHeaderPath(), true, true); -- wanted different width
+ V_DrawString(x-21, (y - 16) + (lsheadingheight - 12), V_YELLOWMAP|V_ALLOWLOWERCASE, M_AddonsHeaderPath());
+ V_DrawFill(x-21, (y - 16) + (lsheadingheight - 3), (MAXSTRINGLENGTH*8+6 - 1), 1, yellowmap[3]);
+ V_DrawFill(x-21 + (MAXSTRINGLENGTH*8+6 - 1), (y - 16) + (lsheadingheight - 3), 1, 1, 26);
+ V_DrawFill(x-21, (y - 16) + (lsheadingheight - 2), MAXSTRINGLENGTH*8+6, 1, 26);
+
+ V_DrawFill(x - 21, y - 1, MAXSTRINGLENGTH*8+6, (BASEVIDHEIGHT - currentMenu->y + 1 + offs) - (y - 1), 159);
+
+ // get bottom...
+ max = dir_on[menudepthleft] + numaddonsshown + 1;
+ if (max > (ssize_t)sizedirmenu)
+ max = sizedirmenu;
+
+ // then top...
+ i = max - (2*numaddonsshown + 1);
+
+ // then adjust!
+ if (i < 0)
+ {
+ if ((max -= i) > (ssize_t)sizedirmenu)
+ max = sizedirmenu;
+ i = 0;
+ }
+
+ if (i != 0)
+ V_DrawString(19, y+4 - (skullAnimCounter/5), V_YELLOWMAP, "\x1A");
+
+ for (; i < max; i++)
+ {
+ UINT32 flags = V_ALLOWLOWERCASE;
+ if (y > BASEVIDHEIGHT) break;
+ if (dirmenu[i])
+#define type (UINT8)(dirmenu[i][DIR_TYPE])
+ {
+ if (type & EXT_LOADED)
+ flags |= V_TRANSLUCENT;
+
+ V_DrawSmallScaledPatch(x-(16+4), y, (flags & V_TRANSLUCENT), addonsp[((UINT8)(dirmenu[i][DIR_TYPE]) & ~EXT_LOADED)]);
+
+ if (type & EXT_LOADED)
+ V_DrawSmallScaledPatch(x-(16+4), y, 0, addonsp[NUM_EXT+3]);
+
+ if ((size_t)i == dir_on[menudepthleft])
+ {
+ V_DrawSmallScaledPatch(x-(16+4), y, 0, addonsp[NUM_EXT+1+((skullAnimCounter/4) ? 1 : 0)]);
+ flags = V_ALLOWLOWERCASE|V_YELLOWMAP;
+ }
+
+#define charsonside 14
+ if (dirmenu[i][DIR_LEN] > (charsonside*2 + 3))
+ V_DrawString(x, y+4, flags, va("%.*s...%s", charsonside, dirmenu[i]+DIR_STRING, dirmenu[i]+DIR_STRING+dirmenu[i][DIR_LEN]-(charsonside+1)));
+#undef charsonside
+ else
+ V_DrawString(x, y+4, flags, dirmenu[i]+DIR_STRING);
+ }
+#undef type
+ y += 16;
+ }
+
+ if (max != (ssize_t)sizedirmenu)
+ V_DrawString(19, y-12 + (skullAnimCounter/5), V_YELLOWMAP, "\x1B");
+
+ y = BASEVIDHEIGHT - currentMenu->y + offs;
+
+ M_DrawTextBox(x - (21 + 5), y, MAXSTRINGLENGTH, 1);
+ if (menusearch[0])
+ V_DrawString(x - 18, y + 8, V_ALLOWLOWERCASE, menusearch+1);
+ else
+ V_DrawString(x - 18, y + 8, V_ALLOWLOWERCASE|V_TRANSLUCENT, "Type to search...");
+ if (skullAnimCounter < 4)
+ V_DrawCharacter(x - 18 + V_StringWidth(menusearch+1, 0), y + 8,
+ '_' | 0x80, false);
+
+ x -= (21 + 5 + 16);
+ V_DrawSmallScaledPatch(x, y + 4, (menusearch[0] ? 0 : V_TRANSLUCENT), addonsp[NUM_EXT+4]);
+
+#define CANSAVE (!modifiedgame || savemoddata)
+ x = BASEVIDWIDTH - x - 16;
+ V_DrawSmallScaledPatch(x, y + 4, (CANSAVE ? 0 : V_TRANSLUCENT), addonsp[NUM_EXT+5]);
+
+ if CANSAVE
+ V_DrawSmallScaledPatch(x, y + 4, 0, addonsp[NUM_EXT+3]);
+#undef CANSAVE
+}
+
+#ifdef __GNUC__
+#pragma GCC reset_options
+#endif
+
+#undef offs
+
+static void M_AddonExec(INT32 ch)
+{
+ if (ch != 'y' && ch != KEY_ENTER)
+ return;
+
+ S_StartSound(NULL, sfx_zoom);
+ COM_BufAddText(va("exec %s%s", menupath, dirmenu[dir_on[menudepthleft]]+DIR_STRING));
+}
+
+#define len menusearch[0]
+static boolean M_ChangeStringAddons(INT32 choice)
+{
+ if (shiftdown && choice >= 32 && choice <= 127)
+ choice = shiftxform[choice];
+
+ switch (choice)
+ {
+ case KEY_DEL:
+ if (len)
+ {
+ len = menusearch[1] = 0;
+ return true;
+ }
+ break;
+ case KEY_BACKSPACE:
+ if (len)
+ {
+ menusearch[1+--len] = 0;
+ return true;
+ }
+ break;
+ default:
+ if (choice >= 32 && choice <= 127)
+ {
+ if (len < MAXSTRINGLENGTH - 1)
+ {
+ menusearch[1+len++] = (char)choice;
+ menusearch[1+len] = 0;
+ return true;
+ }
+ }
+ break;
+ }
+ return false;
+}
+#undef len
+
+static void M_HandleAddons(INT32 choice)
+{
+ boolean exitmenu = false; // exit to previous menu
+
+ if (addonsresponselimit)
+ return;
+
+ if (M_ChangeStringAddons(choice))
+ {
+ if (!preparefilemenu(true))
+ {
+ UNEXIST;
+ return;
+ }
+ }
+
+ switch (choice)
+ {
+ case KEY_DOWNARROW:
+ if (dir_on[menudepthleft] < sizedirmenu-1)
+ dir_on[menudepthleft]++;
+ S_StartSound(NULL, sfx_menu1);
+ break;
+ case KEY_UPARROW:
+ if (dir_on[menudepthleft])
+ dir_on[menudepthleft]--;
+ S_StartSound(NULL, sfx_menu1);
+ break;
+ case KEY_PGDN:
+ {
+ UINT8 i;
+ for (i = numaddonsshown; i && (dir_on[menudepthleft] < sizedirmenu-1); i--)
+ dir_on[menudepthleft]++;
+ }
+ S_StartSound(NULL, sfx_menu1);
+ break;
+ case KEY_PGUP:
+ {
+ UINT8 i;
+ for (i = numaddonsshown; i && (dir_on[menudepthleft]); i--)
+ dir_on[menudepthleft]--;
+ }
+ S_StartSound(NULL, sfx_menu1);
+ break;
+ case KEY_ENTER:
+ {
+ boolean refresh = true;
+ if (!dirmenu[dir_on[menudepthleft]])
+ S_StartSound(NULL, sfx_lose);
+ else
+ {
+ switch (dirmenu[dir_on[menudepthleft]][DIR_TYPE])
+ {
+ case EXT_FOLDER:
+ strcpy(&menupath[menupathindex[menudepthleft]],dirmenu[dir_on[menudepthleft]]+DIR_STRING);
+ if (menudepthleft)
+ {
+ menupathindex[--menudepthleft] = strlen(menupath);
+ menupath[menupathindex[menudepthleft]] = 0;
+
+ if (!preparefilemenu(false))
+ {
+ S_StartSound(NULL, sfx_skid);
+ M_StartMessage(va("\x82%s\x80\nThis folder is empty.\n\n(Press a key)\n", M_AddonsHeaderPath()),NULL,MM_NOTHING);
+ menupath[menupathindex[++menudepthleft]] = 0;
+
+ if (!preparefilemenu(true))
+ {
+ UNEXIST;
+ return;
+ }
+ }
+ else
+ {
+ S_StartSound(NULL, sfx_menu1);
+ dir_on[menudepthleft] = 1;
+ }
+ refresh = false;
+ }
+ else
+ {
+ S_StartSound(NULL, sfx_lose);
+ M_StartMessage(va("\x82%s\x80\nThis folder is too deep to navigate to!\n\n(Press a key)\n", M_AddonsHeaderPath()),NULL,MM_NOTHING);
+ menupath[menupathindex[menudepthleft]] = 0;
+ }
+ break;
+ case EXT_UP:
+ S_StartSound(NULL, sfx_menu1);
+ menupath[menupathindex[++menudepthleft]] = 0;
+ if (!preparefilemenu(false))
+ {
+ UNEXIST;
+ return;
+ }
+ break;
+ case EXT_TXT:
+ M_StartMessage(va("\x82%s\x80\nThis file may not be a console script.\nAttempt to run anyways? \n\n(Press 'Y' to confirm)\n", dirmenu[dir_on[menudepthleft]]+DIR_STRING),M_AddonExec,MM_YESNO);
+ break;
+ case EXT_CFG:
+ M_AddonExec(KEY_ENTER);
+ break;
+ case EXT_LUA:
+#ifndef HAVE_BLUA
+ S_StartSound(NULL, sfx_lose);
+ M_StartMessage(va("\x82%s\x80\nThis copy of SRB2 was compiled\nwithout support for .lua files.\n\n(Press a key)\n", dirmenu[dir_on[menudepthleft]]+DIR_STRING),NULL,MM_NOTHING);
+ break;
+#endif
+ // else intentional fallthrough
+ case EXT_SOC:
+ case EXT_WAD:
+ COM_BufAddText(va("addfile %s%s", menupath, dirmenu[dir_on[menudepthleft]]+DIR_STRING));
+ addonsresponselimit = 5;
+ break;
+ default:
+ S_StartSound(NULL, sfx_lose);
+ }
+ }
+ if (refresh)
+ refreshdirmenu |= REFRESHDIR_NORMAL;
+ }
+ break;
+
+ case KEY_ESCAPE:
+ exitmenu = true;
+ break;
+
+ default:
+ break;
+ }
+ if (exitmenu)
+ {
+ for (; sizedirmenu > 0; sizedirmenu--)
+ {
+ Z_Free(dirmenu[sizedirmenu-1]);
+ dirmenu[sizedirmenu-1] = NULL;
+ }
+
+ Z_Free(dirmenu);
+ dirmenu = NULL;
+
+ // secrets disabled by addfile...
+ MainMenu[secrets].status = (M_AnySecretUnlocked()) ? (IT_STRING | IT_CALL) : (IT_DISABLED);
+
+ if (currentMenu->prevMenu)
+ M_SetupNextMenu(currentMenu->prevMenu);
+ else
+ M_ClearMenus(true);
+ }
+}
+
static void M_PandorasBox(INT32 choice)
{
(void)choice;
@@ -4708,7 +5297,7 @@ static void M_Options(INT32 choice)
OP_MainMenu[5].status = (Playing() && !(server || adminplayer == consoleplayer)) ? (IT_GRAYEDOUT) : (IT_STRING|IT_CALL);
// if the player is playing _at all_, disable the erase data options
- OP_DataOptionsMenu[1].status = (Playing()) ? (IT_GRAYEDOUT) : (IT_STRING|IT_SUBMENU);
+ OP_DataOptionsMenu[2].status = (Playing()) ? (IT_GRAYEDOUT) : (IT_STRING|IT_SUBMENU);
OP_MainDef.prevMenu = currentMenu;
M_SetupNextMenu(&OP_MainDef);
@@ -4796,7 +5385,7 @@ static void M_LevelSelectWarp(INT32 choice)
G_LoadGame((UINT32)cursaveslot, startmap);
else
{
- cursaveslot = -1;
+ cursaveslot = 0;
M_SetupChoosePlayer(0);
}
}
@@ -4816,13 +5405,21 @@ static void M_HandleChecklist(INT32 choice)
{
case KEY_DOWNARROW:
S_StartSound(NULL, sfx_menu1);
- if (checklist_cangodown)
+ if ((check_on != MAXUNLOCKABLES) && checklist_cangodown)
{
for (j = check_on+1; j < MAXUNLOCKABLES; j++)
{
- if (!(unlockables[j].name[0] == 0 //|| unlockables[j].nochecklist
- || !unlockables[j].conditionset || unlockables[j].conditionset > MAXCONDITIONSETS))
- break;
+ if (!unlockables[j].name[0])
+ continue;
+ // if (unlockables[j].nochecklist)
+ // continue;
+ if (!unlockables[j].conditionset)
+ continue;
+ if (unlockables[j].conditionset > MAXCONDITIONSETS)
+ continue;
+ if (unlockables[j].conditionset == unlockables[check_on].conditionset)
+ continue;
+ break;
}
if (j != MAXUNLOCKABLES)
check_on = j;
@@ -4831,14 +5428,25 @@ static void M_HandleChecklist(INT32 choice)
case KEY_UPARROW:
S_StartSound(NULL, sfx_menu1);
- for (j = check_on-1; j > -1; j--)
+ if (check_on)
{
- if (!(unlockables[j].name[0] == 0 //|| unlockables[j].nochecklist
- || !unlockables[j].conditionset || unlockables[j].conditionset > MAXCONDITIONSETS))
+ for (j = check_on-1; j > -1; j--)
+ {
+ if (!unlockables[j].name[0])
+ continue;
+ // if (unlockables[j].nochecklist)
+ // continue;
+ if (!unlockables[j].conditionset)
+ continue;
+ if (unlockables[j].conditionset > MAXCONDITIONSETS)
+ continue;
+ if (j && unlockables[j].conditionset == unlockables[j-1].conditionset)
+ continue;
break;
+ }
+ if (j != -1)
+ check_on = j;
}
- if (j != -1)
- check_on = j;
return;
case KEY_ESCAPE:
@@ -4864,7 +5472,7 @@ static void M_DrawChecklist(void)
M_DrawMenuTitle();
if (check_on)
- V_DrawString(10, y, V_YELLOWMAP, "\x1A");
+ V_DrawString(10, y-(skullAnimCounter/5), V_YELLOWMAP, "\x1A");
while (i < MAXUNLOCKABLES)
{
@@ -5122,9 +5730,7 @@ static void M_DrawChecklist(void)
finishchecklist:
if ((checklist_cangodown = ((y - currentMenu->y) > (scrollareaheight*2)))) // haaaaaaacks.
- {
- V_DrawString(10, currentMenu->y+(scrollareaheight*2), V_YELLOWMAP, "\x1B");
- }
+ V_DrawString(10, currentMenu->y+(scrollareaheight*2)+(skullAnimCounter/5), V_YELLOWMAP, "\x1B");
}
#define NUMHINTS 5
@@ -5195,6 +5801,13 @@ static void M_DrawSkyRoom(void)
return;
V_DrawRightAlignedString(BASEVIDWIDTH - currentMenu->x, currentMenu->y + y, V_YELLOWMAP, cv_soundtest.string);
+ if (i == itemOn)
+ {
+ V_DrawCharacter(BASEVIDWIDTH - currentMenu->x - 10 - V_StringWidth(cv_soundtest.string, 0) - (skullAnimCounter/5), currentMenu->y + y,
+ '\x1C' | V_YELLOWMAP, false);
+ V_DrawCharacter(BASEVIDWIDTH - currentMenu->x + 2 + (skullAnimCounter/5), currentMenu->y + y,
+ '\x1D' | V_YELLOWMAP, false);
+ }
if (cv_soundtest.value)
V_DrawRightAlignedString(BASEVIDWIDTH - currentMenu->x, currentMenu->y + y + 8, V_YELLOWMAP, S_sfx[cv_soundtest.value].name);
}
@@ -5347,7 +5960,7 @@ static void M_CustomWarp(INT32 choice)
static void M_Credits(INT32 choice)
{
(void)choice;
- cursaveslot = -2;
+ cursaveslot = -1;
M_ClearMenus(true);
F_StartCredits();
}
@@ -5405,149 +6018,285 @@ static void M_LoadGameLevelSelect(INT32 choice)
// LOAD GAME MENU
// ==============
-static INT32 saveSlotSelected = 0;
-static short menumovedir = 0;
+static INT32 saveSlotSelected = 1;
+static INT32 loadgamescroll = 0;
+static UINT8 loadgameoffset = 0;
static void M_DrawLoadGameData(void)
{
- INT32 ecks;
- INT32 i;
+ INT32 i, savetodraw, x, y, hsep = 90;
+ skin_t *charskin = NULL;
- ecks = SP_LoadDef.x + 24;
- M_DrawTextBox(SP_LoadDef.x-12,144, 24, 4);
+ if (vid.width != BASEVIDWIDTH*vid.dupx)
+ hsep = (hsep*vid.width)/(BASEVIDWIDTH*vid.dupx);
- if (saveSlotSelected == NOSAVESLOT) // last slot is play without saving
+ for (i = -2; i <= 2; i++)
{
- if (ultimate_selectable)
+ savetodraw = (saveSlotSelected + i + numsaves)%numsaves;
+ x = (BASEVIDWIDTH/2 - 42 + loadgamescroll) + (i*hsep);
+ y = 33 + 9;
+
{
- V_DrawCenteredString(ecks + 68, 144, V_ORANGEMAP, "ULTIMATE MODE");
- V_DrawCenteredString(ecks + 68, 156, 0, "NO RINGS, NO ONE-UPS,");
- V_DrawCenteredString(ecks + 68, 164, 0, "NO CONTINUES, ONE LIFE,");
- V_DrawCenteredString(ecks + 68, 172, 0, "FINAL DESTINATION.");
+ INT32 diff = x - (BASEVIDWIDTH/2 - 42);
+ if (diff < 0)
+ diff = -diff;
+ diff = (42 - diff)/3 - loadgameoffset;
+ if (diff < 0)
+ diff = 0;
+ y -= diff;
}
- else
- {
- V_DrawCenteredString(ecks + 68, 144, V_ORANGEMAP, "PLAY WITHOUT SAVING");
- V_DrawCenteredString(ecks + 68, 156, 0, "THIS GAME WILL NOT BE");
- V_DrawCenteredString(ecks + 68, 164, 0, "SAVED, BUT YOU CAN STILL");
- V_DrawCenteredString(ecks + 68, 172, 0, "GET EMBLEMS AND SECRETS.");
- }
- return;
- }
-
- if (savegameinfo[saveSlotSelected].lives == -42) // Empty
- {
- V_DrawCenteredString(ecks + 68, 160, 0, "NO DATA");
- return;
- }
-
- if (savegameinfo[saveSlotSelected].lives == -666) // savegame is bad
- {
- V_DrawCenteredString(ecks + 68, 144, V_REDMAP, "CORRUPT SAVE FILE");
- V_DrawCenteredString(ecks + 68, 156, 0, "THIS SAVE FILE");
- V_DrawCenteredString(ecks + 68, 164, 0, "CAN NOT BE LOADED.");
- V_DrawCenteredString(ecks + 68, 172, 0, "DELETE USING BACKSPACE.");
- return;
- }
-
- // Draw the back sprite, it looks ugly if we don't
- V_DrawScaledPatch(SP_LoadDef.x, 144+8, 0, livesback);
- if (savegameinfo[saveSlotSelected].skincolor == 0)
- V_DrawScaledPatch(SP_LoadDef.x,144+8,0,W_CachePatchName(skins[savegameinfo[saveSlotSelected].skinnum].face, PU_CACHE));
- else
- {
- UINT8 *colormap = R_GetTranslationColormap(savegameinfo[saveSlotSelected].skinnum, savegameinfo[saveSlotSelected].skincolor, 0);
- V_DrawMappedPatch(SP_LoadDef.x,144+8,0,W_CachePatchName(skins[savegameinfo[saveSlotSelected].skinnum].face, PU_CACHE), colormap);
- }
-
- V_DrawString(ecks + 12, 152, 0, savegameinfo[saveSlotSelected].playername);
-
-#ifdef SAVEGAMES_OTHERVERSIONS
- if (savegameinfo[saveSlotSelected].gamemap & 16384)
- V_DrawCenteredString(ecks + 68, 144, V_REDMAP, "OUTDATED SAVE FILE!");
-#endif
-
- if (savegameinfo[saveSlotSelected].gamemap & 8192)
- V_DrawString(ecks + 12, 160, V_GREENMAP, "CLEAR!");
- else
- V_DrawString(ecks + 12, 160, 0, va("%s", savegameinfo[saveSlotSelected].levelname));
-
- // Use the big face pic for lives, duh. :3
- V_DrawScaledPatch(ecks + 12, 175, 0, W_CachePatchName("STLIVEX", PU_HUDGFX));
- V_DrawTallNum(ecks + 40, 172, 0, savegameinfo[saveSlotSelected].lives);
-
- // Absolute ridiculousness, condensed into another function.
- V_DrawContinueIcon(ecks + 58, 182, 0, savegameinfo[saveSlotSelected].skinnum, savegameinfo[saveSlotSelected].skincolor);
- V_DrawScaledPatch(ecks + 68, 175, 0, W_CachePatchName("STLIVEX", PU_HUDGFX));
- V_DrawTallNum(ecks + 96, 172, 0, savegameinfo[saveSlotSelected].continues);
-
- for (i = 0; i < 7; ++i)
- {
- if (savegameinfo[saveSlotSelected].numemeralds & (1 << i))
- V_DrawScaledPatch(ecks + 104 + (i * 8), 172, 0, tinyemeraldpics[i]);
- }
-}
-
-#define LOADBARHEIGHT SP_LoadDef.y + (LINEHEIGHT * (j+1)) + ymod
-#define CURSORHEIGHT SP_LoadDef.y + (LINEHEIGHT*3) - 1
-static void M_DrawLoad(void)
-{
- INT32 i, j;
- INT32 ymod = 0, offset = 0;
-
- M_DrawMenuTitle();
-
- if (menumovedir != 0) //movement illusion
- {
- ymod = (-(LINEHEIGHT/4))*menumovedir;
- offset = ((menumovedir > 0) ? -1 : 1);
- }
-
- V_DrawCenteredString(BASEVIDWIDTH/2, 40, 0, "Press backspace to delete a save.");
-
- for (i = MAXSAVEGAMES + saveSlotSelected - 2 + offset, j = 0;i <= MAXSAVEGAMES + saveSlotSelected + 2 + offset; i++, j++)
- {
- if ((menumovedir < 0 && j == 4) || (menumovedir > 0 && j == 0))
- continue; //this helps give the illusion of movement
-
- M_DrawSaveLoadBorder(SP_LoadDef.x, LOADBARHEIGHT);
-
- if ((i%MAXSAVEGAMES) == NOSAVESLOT) // play without saving
+
+ if (savetodraw == 0)
{
+ V_DrawSmallScaledPatch(x, y, 0,
+ savselp[((ultimate_selectable) ? 2 : 1)]);
+ x += 2;
+ y += 1;
+ V_DrawString(x, y,
+ ((savetodraw == saveSlotSelected) ? V_YELLOWMAP : 0),
+ "NO FILE");
+ if (savetodraw == saveSlotSelected)
+ V_DrawFill(x, y+9, 80, 1, yellowmap[3]);
+ y += 11;
+ V_DrawSmallScaledPatch(x, y, V_STATIC, savselp[4]);
+ y += 41;
if (ultimate_selectable)
- V_DrawCenteredString(SP_LoadDef.x+92, LOADBARHEIGHT - 1, V_ORANGEMAP, "ULTIMATE MODE");
+ V_DrawRightAlignedThinString(x + 79, y, V_REDMAP, "ULTIMATE.");
else
- V_DrawCenteredString(SP_LoadDef.x+92, LOADBARHEIGHT - 1, V_ORANGEMAP, "PLAY WITHOUT SAVING");
+ V_DrawRightAlignedThinString(x + 79, y, V_GRAYMAP, "DON'T SAVE!");
continue;
}
- if (savegameinfo[i%MAXSAVEGAMES].lives == -42)
- V_DrawString(SP_LoadDef.x-6, LOADBARHEIGHT - 1, V_TRANSLUCENT, "NO DATA");
- else if (savegameinfo[i%MAXSAVEGAMES].lives == -666)
- V_DrawString(SP_LoadDef.x-6, LOADBARHEIGHT - 1, V_REDMAP, "CORRUPT SAVE FILE");
- else if (savegameinfo[i%MAXSAVEGAMES].gamemap & 8192)
- V_DrawString(SP_LoadDef.x-6, LOADBARHEIGHT - 1, V_GREENMAP, "CLEAR!");
- else
- V_DrawString(SP_LoadDef.x-6, LOADBARHEIGHT - 1, 0, va("%s", savegameinfo[i%MAXSAVEGAMES].levelname));
+ savetodraw--;
- //Draw the save slot number on the right side
- V_DrawRightAlignedString(SP_LoadDef.x+192, LOADBARHEIGHT - 1, 0, va("%d",(i%MAXSAVEGAMES) + 1));
+ if (savegameinfo[savetodraw].lives > 0)
+ charskin = &skins[savegameinfo[savetodraw].skinnum];
+
+ // signpost background
+ {
+ UINT8 col;
+ if (savegameinfo[savetodraw].lives == -666)
+ {
+ V_DrawSmallScaledPatch(x+2, y+64, 0, savselp[5]);
+ }
+#ifndef PERFECTSAVE // disabled, don't touch
+ else if ((savegameinfo[savetodraw].skinnum == 1)
+ && (savegameinfo[savetodraw].lives == 99)
+ && (savegameinfo[savetodraw].gamemap & 8192)
+ && (savegameinfo[savetodraw].numgameovers == 0)
+ && (savegameinfo[savetodraw].numemeralds == ((1<<7) - 1))) // perfect save
+ {
+ V_DrawFill(x+6, y+64, 72, 50, 134);
+ V_DrawFill(x+6, y+74, 72, 30, 201);
+ V_DrawFill(x+6, y+84, 72, 10, 1);
+ }
+#endif
+ else
+ {
+ if (savegameinfo[savetodraw].lives == -42)
+ col = 26;
+ else if (savegameinfo[savetodraw].botskin == 3) // & knuckles
+ col = 105;
+ else if (savegameinfo[savetodraw].botskin) // tailsbot or custom
+ col = 134;
+ else
+ {
+ col = (charskin->prefcolor - 1)*2;
+ col = Color_Index[Color_Opposite[col]-1][Color_Opposite[col+1]];
+ }
+
+ V_DrawFill(x+6, y+64, 72, 50, col);
+ }
+ }
+
+ V_DrawSmallScaledPatch(x, y, 0, savselp[0]);
+ x += 2;
+ y += 1;
+ V_DrawString(x, y,
+ ((savetodraw == saveSlotSelected-1) ? V_YELLOWMAP : 0),
+ va("FILE %d", savetodraw+1));
+ if (savetodraw == saveSlotSelected-1)
+ V_DrawFill(x, y+9, 80, 1, yellowmap[3]);
+ y += 11;
+
+ // level image area
+ {
+ patch_t *patch;
+ INT32 flags = 0;
+
+ if ((savegameinfo[savetodraw].lives == -42)
+ || (savegameinfo[savetodraw].lives == -666))
+ {
+ patch = savselp[3];
+ flags = V_STATIC;
+ }
+ else if (savegameinfo[savetodraw].gamemap & 8192)
+ patch = savselp[6];
+ else
+ {
+ lumpnum_t lumpnum = W_CheckNumForName(va("%sP", G_BuildMapName((savegameinfo[savetodraw].gamemap) & 8191)));
+ if (lumpnum != LUMPERROR)
+ patch = W_CachePatchNum(lumpnum, PU_CACHE);
+ else
+ patch = savselp[5];
+ }
+
+ V_DrawSmallScaledPatch(x, y, flags, patch);
+
+ y += 41;
+
+ if (savegameinfo[savetodraw].lives == -42)
+ V_DrawRightAlignedThinString(x + 79, y, V_GRAYMAP, "NEW GAME");
+ else if (savegameinfo[savetodraw].lives == -666)
+ V_DrawRightAlignedThinString(x + 79, y, V_REDMAP, "CAN'T LOAD!");
+ else if (savegameinfo[savetodraw].gamemap & 8192)
+ V_DrawRightAlignedThinString(x + 79, y, V_GREENMAP, "CLEAR!");
+ else
+ V_DrawRightAlignedThinString(x + 79, y, V_YELLOWMAP, savegameinfo[savetodraw].levelname);
+ }
+
+ if ((savegameinfo[savetodraw].lives == -42)
+ || (savegameinfo[savetodraw].lives == -666))
+ continue;
+
+ y += 64;
+
+ // tiny emeralds
+ {
+ INT32 j, workx = x + 6;
+ for (j = 0; j < 7; ++j)
+ {
+ if (savegameinfo[savetodraw].numemeralds & (1 << j))
+ V_DrawScaledPatch(workx, y, 0, tinyemeraldpics[j]);
+ workx += 10;
+ }
+ }
+
+ y -= 13;
+
+ // character heads, lives, and continues
+ {
+ spritedef_t *sprdef;
+ spriteframe_t *sprframe;
+ patch_t *patch;
+ UINT8 *colormap = NULL;
+
+ INT32 tempx = (x+40)<sprites[SPR2_SIGN];
+ if (!sprdef->numframes)
+ goto skipbot;
+ colormap = R_GetTranslationColormap(savegameinfo[savetodraw].botskin, charbotskin->prefcolor, 0);
+ sprframe = &sprdef->spriteframes[0];
+ patch = W_CachePatchNum(sprframe->lumppat[0], PU_CACHE);
+
+ V_DrawFixedPatch(
+ tempx + (18<highresscale,
+ 0, patch, colormap);
+
+ Z_Free(colormap);
+
+ tempx -= (15<sprites[SPR2_SIGN];
+ colormap = R_GetTranslationColormap(savegameinfo[savetodraw].skinnum, charskin->prefcolor, 0);
+ if (!sprdef->numframes)
+ goto skipsign;
+ sprframe = &sprdef->spriteframes[0];
+ patch = W_CachePatchNum(sprframe->lumppat[0], PU_CACHE);
+ if ((calc = SHORT(patch->topoffset) - 42) > 0)
+ tempy += ((4+calc)<highresscale,
+ flip, patch, colormap);
+
+skipsign:
+ y += 25;
+
+ tempx = x + 10;
+ if (savegameinfo[savetodraw].lives != 0x7f
+ && savegameinfo[savetodraw].lives > 9)
+ tempx -= 4;
+
+ if (!charskin) // shut up compiler
+ goto skiplife;
+
+ // lives
+ sprdef = &charskin->sprites[SPR2_LIFE];
+ if (!sprdef->numframes)
+ goto skiplife;
+ sprframe = &sprdef->spriteframes[0];
+ patch = W_CachePatchNum(sprframe->lumppat[0], PU_CACHE);
+
+ V_DrawFixedPatch(
+ (tempx + 4)<highresscale/2,
+ 0, patch, colormap);
+skiplife:
+ if (colormap)
+ Z_Free(colormap);
+
+ patch = W_CachePatchName("STLIVEX", PU_CACHE);
+
+ V_DrawScaledPatch(tempx + 9, y + 2, 0, patch);
+ tempx += 16;
+ if (savegameinfo[savetodraw].lives == 0x7f)
+ V_DrawCharacter(tempx, y + 1, '\x16', false);
+ else
+ V_DrawString(tempx, y, 0, va("%d", savegameinfo[savetodraw].lives));
+
+ tempx = x + 47;
+ if (savegameinfo[savetodraw].continues > 9)
+ tempx -= 4;
+
+ // continues
+ if (savegameinfo[savetodraw].continues > 0)
+ {
+ V_DrawSmallScaledPatch(tempx, y, 0, W_CachePatchName("CONTSAVE", PU_CACHE));
+ V_DrawScaledPatch(tempx + 9, y + 2, 0, patch);
+ V_DrawString(tempx + 16, y, 0, va("%d", savegameinfo[savetodraw].continues));
+ }
+ else
+ {
+ V_DrawSmallScaledPatch(tempx, y, 0, W_CachePatchName("CONTNONE", PU_CACHE));
+ V_DrawScaledPatch(tempx + 9, y + 2, 0, W_CachePatchName("STNONEX", PU_CACHE));
+ V_DrawString(tempx + 16, y, V_GRAYMAP, "0");
+ }
+ }
}
+}
- //Draw cursors on both sides.
- V_DrawScaledPatch( 32, CURSORHEIGHT, 0, W_CachePatchName("M_CURSOR", PU_CACHE));
- V_DrawScaledPatch(274, CURSORHEIGHT, 0, W_CachePatchName("M_CURSOR", PU_CACHE));
+static void M_DrawLoad(void)
+{
+ M_DrawMenuTitle();
+
+ if (loadgamescroll > 1 || loadgamescroll < -1)
+ loadgamescroll = 2*loadgamescroll/3;
+ else
+ loadgamescroll = 0;
+
+ if (loadgameoffset > 1)
+ loadgameoffset = 2*loadgameoffset/3;
+ else
+ loadgameoffset = 0;
M_DrawLoadGameData();
-
- //finishing the movement illusion
- if (menumovedir)
- menumovedir += ((menumovedir > 0) ? 1 : -1);
- if (abs(menumovedir) > 3)
- menumovedir = 0;
}
-#undef LOADBARHEIGHT
-#undef CURSORHEIGHT
//
// User wants to load this game
@@ -5559,7 +6308,7 @@ static void M_LoadSelect(INT32 choice)
if (saveSlotSelected == NOSAVESLOT) //last slot is play without saving
{
M_NewGame();
- cursaveslot = -1;
+ cursaveslot = 0;
return;
}
@@ -5568,8 +6317,8 @@ static void M_LoadSelect(INT32 choice)
// This slot is empty, so start a new game here.
M_NewGame();
}
- else if (savegameinfo[saveSlotSelected].gamemap & 8192) // Completed
- M_LoadGameLevelSelect(saveSlotSelected + 1);
+ else if (savegameinfo[saveSlotSelected-1].gamemap & 8192) // Completed
+ M_LoadGameLevelSelect(0);
else
G_LoadGame((UINT32)saveSlotSelected, 0);
@@ -5591,12 +6340,11 @@ static void M_ReadSavegameInfo(UINT32 slot)
INT32 fake; // Dummy variable
char temp[sizeof(timeattackfolder)];
char vcheck[VERSIONSIZE];
-#ifdef SAVEGAMES_OTHERVERSIONS
- boolean oldversion = false;
-#endif
sprintf(savename, savegamename, slot);
+ slot--;
+
length = FIL_ReadFile(savename, &savebuffer);
if (length == 0)
{
@@ -5612,14 +6360,7 @@ static void M_ReadSavegameInfo(UINT32 slot)
// Version check
memset(vcheck, 0, sizeof (vcheck));
sprintf(vcheck, "version %d", VERSION);
- if (strcmp((const char *)save_p, (const char *)vcheck))
- {
-#ifdef SAVEGAMES_OTHERVERSIONS
- oldversion = true;
-#else
- BADSAVE // Incompatible versions?
-#endif
- }
+ if (strcmp((const char *)save_p, (const char *)vcheck)) BADSAVE
save_p += VERSIONSIZE;
// dearchive all the modifications
@@ -5631,30 +6372,19 @@ static void M_ReadSavegameInfo(UINT32 slot)
if (((fake-1) & 8191) >= NUMMAPS) BADSAVE
if(!mapheaderinfo[(fake-1) & 8191])
- {
savegameinfo[slot].levelname[0] = '\0';
- savegameinfo[slot].actnum = 0;
- }
else
{
- strcpy(savegameinfo[slot].levelname, mapheaderinfo[(fake-1) & 8191]->lvlttl);
- savegameinfo[slot].actnum = mapheaderinfo[(fake-1) & 8191]->actnum;
+ strlcpy(savegameinfo[slot].levelname, mapheaderinfo[(fake-1) & 8191]->lvlttl, 17+1);
+
+ if (strlen(mapheaderinfo[(fake-1) & 8191]->lvlttl) >= 17)
+ strcpy(savegameinfo[slot].levelname+17-3, "...");
}
-#ifdef SAVEGAMES_OTHERVERSIONS
- if (oldversion)
- {
- if (fake == 24) //meh, let's count old Clear! saves too
- fake |= 8192;
- fake |= 16384; // marker for outdated version
- }
-#endif
savegameinfo[slot].gamemap = fake;
CHECKPOS
- fake = READUINT16(save_p)-357; // emeralds
-
- savegameinfo[slot].numemeralds = (UINT8)fake;
+ savegameinfo[slot].numemeralds = READUINT16(save_p)-357; // emeralds
CHECKPOS
READSTRINGN(save_p, temp, sizeof(temp)); // mod it belongs to
@@ -5663,39 +6393,25 @@ static void M_ReadSavegameInfo(UINT32 slot)
// P_UnArchivePlayer()
CHECKPOS
- savegameinfo[slot].skincolor = READUINT8(save_p);
- CHECKPOS
- savegameinfo[slot].skinnum = READUINT8(save_p);
+ fake = READUINT16(save_p);
+ savegameinfo[slot].skinnum = fake & ((1<<5) - 1);
+ if (savegameinfo[slot].skinnum >= numskins
+ || !R_SkinUsable(-1, savegameinfo[slot].skinnum))
+ BADSAVE
+ savegameinfo[slot].botskin = fake >> 5;
+ if (savegameinfo[slot].botskin-1 >= numskins
+ || !R_SkinUsable(-1, savegameinfo[slot].botskin-1))
+ BADSAVE
+ CHECKPOS
+ savegameinfo[slot].numgameovers = READUINT8(save_p); // numgameovers
+ CHECKPOS
+ savegameinfo[slot].lives = READSINT8(save_p); // lives
CHECKPOS
(void)READINT32(save_p); // Score
-
- CHECKPOS
- savegameinfo[slot].lives = READINT32(save_p); // lives
CHECKPOS
savegameinfo[slot].continues = READINT32(save_p); // continues
- if (fake & (1<<10))
- {
- CHECKPOS
- savegameinfo[slot].botskin = READUINT8(save_p);
- if (savegameinfo[slot].botskin-1 >= numskins)
- savegameinfo[slot].botskin = 0;
- CHECKPOS
- savegameinfo[slot].botcolor = READUINT8(save_p); // because why not.
- }
- else
- savegameinfo[slot].botskin = 0;
-
- if (savegameinfo[slot].botskin)
- snprintf(savegameinfo[slot].playername, 32, "%s & %s",
- skins[savegameinfo[slot].skinnum].realname,
- skins[savegameinfo[slot].botskin-1].realname);
- else
- strcpy(savegameinfo[slot].playername, skins[savegameinfo[slot].skinnum].realname);
-
- savegameinfo[slot].playername[31] = 0;
-
// File end marker check
CHECKPOS
if (READUINT8(save_p) != 0x1d) BADSAVE;
@@ -5714,23 +6430,80 @@ static void M_ReadSavegameInfo(UINT32 slot)
static void M_ReadSaveStrings(void)
{
FILE *handle;
- UINT32 i;
+ SINT8 i;
char name[256];
+ boolean nofile[MAXSAVEGAMES-1];
+ SINT8 tolerance = 3; // empty slots at any time
+ UINT8 lastseen = 0;
- for (i = 0; i < MAXSAVEGAMES; i++)
+ loadgamescroll = 0;
+ loadgameoffset = 14;
+
+ for (i = 1; (i < MAXSAVEGAMES); i++) // slot 0 is no save
{
snprintf(name, sizeof name, savegamename, i);
name[sizeof name - 1] = '\0';
handle = fopen(name, "rb");
- if (handle == NULL)
+ if ((nofile[i-1] = (handle == NULL)))
+ continue;
+ fclose(handle);
+ lastseen = i;
+ }
+
+ if (savegameinfo)
+ Z_Free(savegameinfo);
+ savegameinfo = NULL;
+
+ if (lastseen < saveSlotSelected)
+ lastseen = saveSlotSelected;
+
+ i = lastseen;
+
+ for (; (lastseen > 0 && tolerance); lastseen--)
+ {
+ if (nofile[lastseen-1])
+ tolerance--;
+ }
+
+ if ((i += tolerance+1) > MAXSAVEGAMES) // show 3 empty slots at minimum
+ i = MAXSAVEGAMES;
+
+ numsaves = i;
+ savegameinfo = Z_Realloc(savegameinfo, numsaves*sizeof(saveinfo_t), PU_STATIC, NULL);
+ if (!savegameinfo)
+ I_Error("Insufficient memory to prepare save platter");
+
+ for (; i > 0; i--)
+ {
+ if (nofile[i-1] == true)
{
- savegameinfo[i].lives = -42;
+ savegameinfo[i-1].lives = -42;
continue;
}
- fclose(handle);
M_ReadSavegameInfo(i);
}
+
+ if (savselp[0]) // never going to have some provided but not all, saves individually checking
+ {
+ W_UnlockCachedPatch(savselp[0]);
+ W_UnlockCachedPatch(savselp[1]);
+ W_UnlockCachedPatch(savselp[2]);
+
+ W_UnlockCachedPatch(savselp[3]);
+ W_UnlockCachedPatch(savselp[4]);
+ W_UnlockCachedPatch(savselp[5]);
+ W_UnlockCachedPatch(savselp[6]);
+ }
+
+ savselp[0] = W_CachePatchName("SAVEBACK", PU_STATIC);
+ savselp[1] = W_CachePatchName("SAVENONE", PU_STATIC);
+ savselp[2] = W_CachePatchName("ULTIMATE", PU_STATIC);
+
+ savselp[3] = W_CachePatchName("BLACKLVL", PU_STATIC);
+ savselp[4] = W_CachePatchName("BLACXLVL", PU_STATIC);
+ savselp[5] = W_CachePatchName("BLANKLVL", PU_STATIC);
+ savselp[6] = W_CachePatchName("GAMEDONE", PU_STATIC);
}
//
@@ -5748,8 +6521,19 @@ static void M_SaveGameDeleteResponse(INT32 ch)
name[sizeof name - 1] = '\0';
remove(name);
- // Refresh savegame menu info
- M_ReadSaveStrings();
+ BwehHehHe();
+ M_ReadSaveStrings(); // reload the menu
+}
+
+static void M_SaveGameUltimateResponse(INT32 ch)
+{
+ if (ch != 'y' && ch != KEY_ENTER)
+ return;
+
+ S_StartSound(NULL, sfx_menu1);
+ M_LoadSelect(saveSlotSelected);
+ SP_PlayerDef.prevMenu = MessageDef.prevMenu;
+ MessageDef.prevMenu = &SP_PlayerDef;
}
static void M_HandleLoadSave(INT32 choice)
@@ -5758,26 +6542,46 @@ static void M_HandleLoadSave(INT32 choice)
switch (choice)
{
- case KEY_DOWNARROW:
- S_StartSound(NULL, sfx_menu1);
+ case KEY_RIGHTARROW:
+ S_StartSound(NULL, sfx_s3kb7);
++saveSlotSelected;
- if (saveSlotSelected >= MAXSAVEGAMES)
- saveSlotSelected -= MAXSAVEGAMES;
- menumovedir = 1;
+ if (saveSlotSelected >= numsaves)
+ saveSlotSelected -= numsaves;
+ loadgamescroll = 90;
break;
- case KEY_UPARROW:
- S_StartSound(NULL, sfx_menu1);
+ case KEY_LEFTARROW:
+ S_StartSound(NULL, sfx_s3kb7);
--saveSlotSelected;
if (saveSlotSelected < 0)
- saveSlotSelected += MAXSAVEGAMES;
- menumovedir = -1;
+ saveSlotSelected += numsaves;
+ loadgamescroll = -90;
break;
case KEY_ENTER:
- S_StartSound(NULL, sfx_menu1);
- if (savegameinfo[saveSlotSelected].lives != -666) // don't allow loading of "bad saves"
+ if (ultimate_selectable && saveSlotSelected == NOSAVESLOT)
+ {
+ loadgamescroll = 0;
+ S_StartSound(NULL, sfx_skid);
+ M_StartMessage("Are you sure you want to play\n\x85ultimate mode\x80? It isn't remotely fair,\nand you don't even get an emblem for it.\n\n(Press 'Y' to confirm)\n",M_SaveGameUltimateResponse,MM_YESNO);
+ }
+ else if (saveSlotSelected != NOSAVESLOT && savegameinfo[saveSlotSelected-1].lives == -42 && !(!modifiedgame || savemoddata))
+ {
+ loadgamescroll = 0;
+ S_StartSound(NULL, sfx_skid);
+ M_StartMessage(M_GetText("This cannot be done in a modified game.\n\n(Press a key)\n"), NULL, MM_NOTHING);
+ }
+ else if (saveSlotSelected == NOSAVESLOT || savegameinfo[saveSlotSelected-1].lives != -666) // don't allow loading of "bad saves"
+ {
+ loadgamescroll = 0;
+ S_StartSound(NULL, sfx_menu1);
M_LoadSelect(saveSlotSelected);
+ }
+ else if (!loadgameoffset)
+ {
+ S_StartSound(NULL, sfx_lose);
+ loadgameoffset = 14;
+ }
break;
case KEY_ESCAPE:
@@ -5785,11 +6589,25 @@ static void M_HandleLoadSave(INT32 choice)
break;
case KEY_BACKSPACE:
- S_StartSound(NULL, sfx_menu1);
// Don't allow people to 'delete' "Play without Saving."
// Nor allow people to 'delete' slots with no saves in them.
- if (saveSlotSelected != NOSAVESLOT && savegameinfo[saveSlotSelected].lives != -42)
- M_StartMessage(M_GetText("Are you sure you want to delete\nthis save game?\n\n(Press 'Y' to confirm)\n"),M_SaveGameDeleteResponse,MM_YESNO);
+ if (saveSlotSelected != NOSAVESLOT && savegameinfo[saveSlotSelected-1].lives != -42)
+ {
+ loadgamescroll = 0;
+ S_StartSound(NULL, sfx_skid);
+ M_StartMessage(va("Are you sure you want to delete\nsave file %d?\n\n(Press 'Y' to confirm)\n", saveSlotSelected),M_SaveGameDeleteResponse,MM_YESNO);
+ }
+ else if (!loadgameoffset)
+ {
+ if (saveSlotSelected == NOSAVESLOT && ultimate_selectable)
+ {
+ ultimate_selectable = false;
+ S_StartSound(NULL, sfx_strpst);
+ }
+ else
+ S_StartSound(NULL, sfx_lose);
+ loadgameoffset = 14;
+ }
break;
}
if (exitmenu)
@@ -5798,6 +6616,8 @@ static void M_HandleLoadSave(INT32 choice)
M_SetupNextMenu(currentMenu->prevMenu);
else
M_ClearMenus(true);
+ Z_Free(savegameinfo);
+ savegameinfo = NULL;
}
}
@@ -5817,14 +6637,15 @@ static void M_LoadGame(INT32 choice)
//
void M_ForceSaveSlotSelected(INT32 sslot)
{
- // Already there? Out of bounds? Whatever, then!
- if (sslot == saveSlotSelected || sslot >= MAXSAVEGAMES)
+ loadgameoffset = 14;
+
+ // Already there? Whatever, then!
+ if (sslot == saveSlotSelected)
return;
- // Figure out whether to display up movement or down movement
- menumovedir = (saveSlotSelected - sslot) > 0 ? -1 : 1;
- if (abs(saveSlotSelected - sslot) > (MAXSAVEGAMES>>1))
- menumovedir *= -1;
+ loadgamescroll = 90;
+ if (saveSlotSelected <= numsaves/2)
+ loadgamescroll = -loadgamescroll;
saveSlotSelected = sslot;
}
@@ -5900,7 +6721,15 @@ static void M_SetupChoosePlayer(INT32 choice)
SP_PlayerDef.prevMenu = currentMenu;
M_SetupNextMenu(&SP_PlayerDef);
if (!allowed)
+ {
char_on = firstvalid;
+ if (startchar > 0 && startchar < 32)
+ {
+ INT16 workchar = startchar;
+ while (workchar--)
+ char_on = description[char_on].next;
+ }
+ }
char_scroll = 0; // finish scrolling the menu
Z_Free(char_notes);
char_notes = V_WordWrap(0, 21*8, V_ALLOWLOWERCASE, description[char_on].notes);
@@ -6095,9 +6924,9 @@ static void M_ChoosePlayer(INT32 choice)
}
if (startmap != spstage_start)
- cursaveslot = -1;
+ cursaveslot = 0;
- lastmapsaved = 0;
+ //lastmapsaved = 0;
gamecomplete = false;
G_DeferedInitNew(ultmode, G_BuildMapName(startmap), (UINT8)skinnum, false, fromlevelselect);
@@ -6106,6 +6935,10 @@ static void M_ChoosePlayer(INT32 choice)
if (levelselect.rows)
Z_Free(levelselect.rows);
levelselect.rows = NULL;
+
+ if (savegameinfo)
+ Z_Free(savegameinfo);
+ savegameinfo = NULL;
}
// ===============
@@ -6155,7 +6988,7 @@ static void M_DrawStatsMaps(int location)
boolean dotopname = true, dobottomarrow = (location < statsMax);
if (location)
- V_DrawString(10, y, V_YELLOWMAP, "\x1A");
+ V_DrawString(10, y-(skullAnimCounter/5), V_YELLOWMAP, "\x1A");
while (statsMapList[++i] != -1)
{
@@ -6232,7 +7065,7 @@ static void M_DrawStatsMaps(int location)
}
bottomarrow:
if (dobottomarrow)
- V_DrawString(10, y-8, V_YELLOWMAP, "\x1B");
+ V_DrawString(10, y-8 + (skullAnimCounter/5), V_YELLOWMAP, "\x1B");
}
static void M_DrawLevelStats(void)
@@ -6401,6 +7234,13 @@ void M_DrawTimeAttackMenu(void)
// Should see nothing but strings
V_DrawString(BASEVIDWIDTH - x - soffset - V_StringWidth(cv->string, 0), y, V_YELLOWMAP, cv->string);
+ if (i == itemOn)
+ {
+ V_DrawCharacter(BASEVIDWIDTH - x - soffset - 10 - V_StringWidth(cv->string, 0) - (skullAnimCounter/5), y,
+ '\x1C' | V_YELLOWMAP, false);
+ V_DrawCharacter(BASEVIDWIDTH - x - soffset + 2 + (skullAnimCounter/5), y,
+ '\x1D' | V_YELLOWMAP, false);
+ }
}
}
@@ -6427,7 +7267,7 @@ void M_DrawTimeAttackMenu(void)
lumpnum_t lumpnum;
char beststr[40];
- M_DrawLevelPlatterHeader(32-lsheadingheight/2, cv_nextmap.string, true);
+ M_DrawLevelPlatterHeader(32-lsheadingheight/2, cv_nextmap.string, true, false);
// A 160x100 image of the level as entry MAPxxP
lumpnum = W_CheckNumForName(va("%sP", G_BuildMapName(cv_nextmap.value)));
@@ -6583,6 +7423,13 @@ void M_DrawNightsAttackMenu(void)
// Should see nothing but strings
V_DrawString(BASEVIDWIDTH - x - soffset - V_StringWidth(cv->string, 0), y, V_YELLOWMAP, cv->string);
+ if (i == itemOn)
+ {
+ V_DrawCharacter(BASEVIDWIDTH - x - soffset - 10 - V_StringWidth(cv->string, 0) - (skullAnimCounter/5), y,
+ '\x1C' | V_YELLOWMAP, false);
+ V_DrawCharacter(BASEVIDWIDTH - x - soffset + 2 + (skullAnimCounter/5), y,
+ '\x1D' | V_YELLOWMAP, false);
+ }
}
}
@@ -6604,7 +7451,7 @@ void M_DrawNightsAttackMenu(void)
UINT32 bestscore = G_GetBestNightsScore(cv_nextmap.value, cv_dummymares.value);
tic_t besttime = G_GetBestNightsTime(cv_nextmap.value, cv_dummymares.value);
- M_DrawLevelPlatterHeader(32-lsheadingheight/2, cv_nextmap.string, true);
+ M_DrawLevelPlatterHeader(32-lsheadingheight/2, cv_nextmap.string, true, false);
// A 160x100 image of the level as entry MAPxxP
lumpnum = W_CheckNumForName(va("%sP", G_BuildMapName(cv_nextmap.value)));
@@ -7357,7 +8204,7 @@ static void M_DrawServerMenu(void)
// Room name
if (currentMenu == &MP_ServerDef)
{
- M_DrawLevelPlatterHeader(currentMenu->y - lsheadingheight/2, "Server settings", true);
+ M_DrawLevelPlatterHeader(currentMenu->y - lsheadingheight/2, "Server settings", true, false);
if (ms_RoomId < 0)
V_DrawRightAlignedString(BASEVIDWIDTH - currentMenu->x, currentMenu->y + MP_ServerMenu[mp_server_room].alphaKey,
V_YELLOWMAP, (itemOn == mp_server_room) ? "