Merge remote-tracking branch 'refs/remotes/srb2public/next' into zarrotsu

# Conflicts:
#	src/doomdef.h
#	src/sdl/i_main.c
#	src/sdl/i_video.c
#	src/y_inter.c
This commit is contained in:
TehRealSalt 2017-10-17 15:53:34 -04:00
commit 5fe2f4928f
113 changed files with 1235 additions and 953 deletions

View File

@ -58,6 +58,3 @@ jobs:
key: v1-SRB2-{{ .Branch }}-{{ checksum "objs/Linux/SDL/Release/depend.dep" }} key: v1-SRB2-{{ .Branch }}-{{ checksum "objs/Linux/SDL/Release/depend.dep" }}
paths: paths:
- /root/.ccache - /root/.ccache

View File

@ -100,6 +100,21 @@ matrix:
compiler: gcc-6 compiler: gcc-6
env: WFLAGS="-Wno-tautological-compare" env: WFLAGS="-Wno-tautological-compare"
#gcc-6 (Ubuntu 6.1.1-3ubuntu11~14.04.1) 6.1.1 20160511 #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 - os: linux
compiler: clang compiler: clang
#clang version 3.5.0 (tags/RELEASE_350/final) #clang version 3.5.0 (tags/RELEASE_350/final)
@ -162,6 +177,51 @@ matrix:
- clang-3.8 - clang-3.8
compiler: clang-3.8 compiler: clang-3.8
#clang version 3.8.1-svn271127-1~exp1 (branches/release_38) #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 # - os: osx
# osx_image: beta-xcode6.1 # osx_image: beta-xcode6.1
# #Apple LLVM version 6.0 (clang-600.0.54) (based on LLVM 3.5svn) # #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.6
- compiler: clang-3.7 - compiler: clang-3.7
- compiler: clang-3.8 - compiler: clang-3.8
- compiler: clang-3.9
- compiler: clang-4.0
- compiler: clang-5.0
cache: cache:
apt: true apt: true
@ -219,9 +282,9 @@ before_script:
before_install: before_install:
- if [[ "$TRAVIS_OS_NAME" == "osx" ]]; then brew update ; fi - 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 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 - 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 - mkdir -p $HOME/srb2_cache

View File

@ -1,6 +1,6 @@
cmake_minimum_required(VERSION 3.0) cmake_minimum_required(VERSION 3.0)
project(SRB2 project(SRB2
VERSION 2.1.18 VERSION 2.1.19
LANGUAGES C) LANGUAGES C)
if(${PROJECT_SOURCE_DIR} MATCHES ${PROJECT_BINARY_DIR}) if(${PROJECT_SOURCE_DIR} MATCHES ${PROJECT_BINARY_DIR})

View File

@ -1,4 +1,4 @@
version: 2.1.18.{branch}-{build} version: 2.1.19.{branch}-{build}
os: MinGW os: MinGW
environment: environment:
@ -47,7 +47,7 @@ before_build:
- upx -V - upx -V
- ccache -V - ccache -V
- ccache -s - ccache -s
- set SRB2_MFLAGS=-C src MINGW=1 WARNINGMODE=1 GCC63=1 CCACHE=1 - set SRB2_MFLAGS=-C src MINGW=1 WARNINGMODE=1 GCC63=1 CCACHE=1 NOOBJDUMP=1
build_script: build_script:
- cmd: mingw32-make.exe %SRB2_MFLAGS% %CONFIGURATION%=1 clean - cmd: mingw32-make.exe %SRB2_MFLAGS% %CONFIGURATION%=1 clean
@ -58,26 +58,29 @@ after_build:
- cmd: git rev-parse --short %APPVEYOR_REPO_COMMIT%>%TMP%/gitshort.txt - cmd: git rev-parse --short %APPVEYOR_REPO_COMMIT%>%TMP%/gitshort.txt
- cmd: set /P GITSHORT=<%TMP%/gitshort.txt - cmd: set /P GITSHORT=<%TMP%/gitshort.txt
- set BUILD_ARCHIVE=%APPVEYOR_REPO_BRANCH%-%GITSHORT%-%CONFIGURATION%.7z - set BUILD_ARCHIVE=%APPVEYOR_REPO_BRANCH%-%GITSHORT%-%CONFIGURATION%.7z
- set BUILDSARCHIVE=%APPVEYOR_REPO_BRANCH%-%CONFIGURATION%.7z
- cmd: 7z a %BUILD_ARCHIVE% bin\Mingw\Release -xr!.gitignore - cmd: 7z a %BUILD_ARCHIVE% bin\Mingw\Release -xr!.gitignore
- appveyor PushArtifact %BUILD_ARCHIVE% - appveyor PushArtifact %BUILD_ARCHIVE%
- cmd: copy %BUILD_ARCHIVE% %BUILDSARCHIVE%
- appveyor PushArtifact %BUILDSARCHIVE%
test: off test: off
deploy: #deploy:
- provider: FTP # - provider: FTP
protocol: ftps # protocol: ftps
host: # host:
secure: NsLJEPIBvmwCOj8Tg8RoRQ== # secure: NsLJEPIBvmwCOj8Tg8RoRQ==
username: # username:
secure: ejxi5mvk7oLYu7QtbYojajEPigMy0mokaKhuEVuDZcA= # secure: ejxi5mvk7oLYu7QtbYojajEPigMy0mokaKhuEVuDZcA=
password: # password:
secure: Hbn6Uy3lT0YZ88yFJ3aW4w== # secure: Hbn6Uy3lT0YZ88yFJ3aW4w==
folder: appveyor # folder: appveyor
application: # application:
active_mode: false # active_mode: false
on: # on:
branch: master # branch: master
appveyor_repo_tag: true # appveyor_repo_tag: true
on_finish: on_finish:

2
bin/DC/.gitignore vendored Normal file
View File

@ -0,0 +1,2 @@
# DON'T REMOVE
# This keeps the folder from disappearing

2
bin/Dos/Debug/.gitignore vendored Normal file
View File

@ -0,0 +1,2 @@
# DON'T REMOVE
# This keeps the folder from disappearing

2
bin/Dos/Release/.gitignore vendored Normal file
View File

@ -0,0 +1,2 @@
# DON'T REMOVE
# This keeps the folder from disappearing

2
bin/FreeBSD/Debug/.gitignore vendored Normal file
View File

@ -0,0 +1,2 @@
# DON'T REMOVE
# This keeps the folder from disappearing

2
bin/FreeBSD/Release/.gitignore vendored Normal file
View File

@ -0,0 +1,2 @@
# DON'T REMOVE
# This keeps the folder from disappearing

2
bin/SDL/Debug/.gitignore vendored Normal file
View File

@ -0,0 +1,2 @@
# DON'T REMOVE
# This keeps the folder from disappearing

2
bin/SDL/Release/.gitignore vendored Normal file
View File

@ -0,0 +1,2 @@
# DON'T REMOVE
# This keeps the folder from disappearing

2
bin/WinCE/ARMV4Dbg/.gitignore vendored Normal file
View File

@ -0,0 +1,2 @@
# DON'T REMOVE
# This keeps the folder from disappearing

2
bin/WinCE/ARMV4IDbg/.gitignore vendored Normal file
View File

@ -0,0 +1,2 @@
# DON'T REMOVE
# This keeps the folder from disappearing

2
bin/WinCE/ARMV4IRel/.gitignore vendored Normal file
View File

@ -0,0 +1,2 @@
# DON'T REMOVE
# This keeps the folder from disappearing

2
bin/WinCE/ARMV4Rel/.gitignore vendored Normal file
View File

@ -0,0 +1,2 @@
# DON'T REMOVE
# This keeps the folder from disappearing

2
bin/WinCE/ARMV4TDbg/.gitignore vendored Normal file
View File

@ -0,0 +1,2 @@
# DON'T REMOVE
# This keeps the folder from disappearing

2
bin/WinCE/ARMV4TRel/.gitignore vendored Normal file
View File

@ -0,0 +1,2 @@
# DON'T REMOVE
# This keeps the folder from disappearing

2
bin/WinCE/MIPS16Dbg/.gitignore vendored Normal file
View File

@ -0,0 +1,2 @@
# DON'T REMOVE
# This keeps the folder from disappearing

2
bin/WinCE/MIPS16Rel/.gitignore vendored Normal file
View File

@ -0,0 +1,2 @@
# DON'T REMOVE
# This keeps the folder from disappearing

2
bin/WinCE/MIPSIIDbg/.gitignore vendored Normal file
View File

@ -0,0 +1,2 @@
# DON'T REMOVE
# This keeps the folder from disappearing

2
bin/WinCE/MIPSIIRel/.gitignore vendored Normal file
View File

@ -0,0 +1,2 @@
# DON'T REMOVE
# This keeps the folder from disappearing

2
bin/WinCE/MIPSII_FPDbg/.gitignore vendored Normal file
View File

@ -0,0 +1,2 @@
# DON'T REMOVE
# This keeps the folder from disappearing

2
bin/WinCE/MIPSII_FPRel/.gitignore vendored Normal file
View File

@ -0,0 +1,2 @@
# DON'T REMOVE
# This keeps the folder from disappearing

2
bin/WinCE/MIPSIVDbg/.gitignore vendored Normal file
View File

@ -0,0 +1,2 @@
# DON'T REMOVE
# This keeps the folder from disappearing

2
bin/WinCE/MIPSIVRel/.gitignore vendored Normal file
View File

@ -0,0 +1,2 @@
# DON'T REMOVE
# This keeps the folder from disappearing

2
bin/WinCE/MIPSIV_FPDbg/.gitignore vendored Normal file
View File

@ -0,0 +1,2 @@
# DON'T REMOVE
# This keeps the folder from disappearing

2
bin/WinCE/MIPSIV_FPRel/.gitignore vendored Normal file
View File

@ -0,0 +1,2 @@
# DON'T REMOVE
# This keeps the folder from disappearing

2
bin/WinCE/Release/.gitignore vendored Normal file
View File

@ -0,0 +1,2 @@
# DON'T REMOVE
# This keeps the folder from disappearing

2
bin/WinCE/SH3Dbg/.gitignore vendored Normal file
View File

@ -0,0 +1,2 @@
# DON'T REMOVE
# This keeps the folder from disappearing

2
bin/WinCE/SH3Rel/.gitignore vendored Normal file
View File

@ -0,0 +1,2 @@
# DON'T REMOVE
# This keeps the folder from disappearing

2
bin/WinCE/SH4Dbg/.gitignore vendored Normal file
View File

@ -0,0 +1,2 @@
# DON'T REMOVE
# This keeps the folder from disappearing

2
bin/WinCE/SH4Rel/.gitignore vendored Normal file
View File

@ -0,0 +1,2 @@
# DON'T REMOVE
# This keeps the folder from disappearing

2
bin/WinCE/X86Dbg/.gitignore vendored Normal file
View File

@ -0,0 +1,2 @@
# DON'T REMOVE
# This keeps the folder from disappearing

2
bin/WinCE/X86Rel/.gitignore vendored Normal file
View File

@ -0,0 +1,2 @@
# DON'T REMOVE
# This keeps the folder from disappearing

2
bin/WinCE/emulatorDbg/.gitignore vendored Normal file
View File

@ -0,0 +1,2 @@
# DON'T REMOVE
# This keeps the folder from disappearing

2
bin/WinCE/emulatorRel/.gitignore vendored Normal file
View File

@ -0,0 +1,2 @@
# DON'T REMOVE
# This keeps the folder from disappearing

2
bin/dummy/.gitignore vendored Normal file
View File

@ -0,0 +1,2 @@
# DON'T REMOVE
# This keeps the folder from disappearing

2
objs/FreeBSD/SDL/Debug/.gitignore vendored Normal file
View File

@ -0,0 +1,2 @@
# DON'T REMOVE
# This keeps the folder from disappearing

2
objs/FreeBSD/SDL/Release/.gitignore vendored Normal file
View File

@ -0,0 +1,2 @@
# DON'T REMOVE
# This keeps the folder from disappearing

2
objs/MasterClient/.gitignore vendored Normal file
View File

@ -0,0 +1,2 @@
# DON'T REMOVE
# This keeps the folder from disappearing

2
objs/MasterServer/.gitignore vendored Normal file
View File

@ -0,0 +1,2 @@
# DON'T REMOVE
# This keeps the folder from disappearing

2
objs/XBOX/SDL/Debug/.gitignore vendored Normal file
View File

@ -0,0 +1,2 @@
# DON'T REMOVE
# This keeps the folder from disappearing

2
objs/XBOX/SDL/Release/.gitignore vendored Normal file
View File

@ -0,0 +1,2 @@
# DON'T REMOVE
# This keeps the folder from disappearing

2
objs/cygwin/Debug/.gitignore vendored Normal file
View File

@ -0,0 +1,2 @@
# DON'T REMOVE
# This keeps the folder from disappearing

2
objs/cygwin/Release/.gitignore vendored Normal file
View File

@ -0,0 +1,2 @@
# DON'T REMOVE
# This keeps the folder from disappearing

2
objs/dummy/.gitignore vendored Normal file
View File

@ -0,0 +1,2 @@
# DON'T REMOVE
# This keeps the folder from disappearing

View File

@ -209,7 +209,13 @@ LIBS+=-lm
endif endif
ifdef SDL ifdef SDL
include sdl/Makefile.cfg #SDL 2.0
ifndef SDL12
include sdl/Makefile.cfg
#SDL 1.2
else
include sdl12/Makefile.cfg
endif #ifndef SDL12
endif #ifdef SDL endif #ifdef SDL
ifdef DISTCC ifdef DISTCC
@ -513,13 +519,11 @@ OBJS:=$(i_main_o) \
# For reference, this is the command I use to build a srb2.pot file from the source code. # For reference, this is the command I use to build a srb2.pot file from the source code.
# (The listed source files are the ones containing translated strings). # (The listed source files are the ones containing translated strings).
# FILES=""; for file in `find ./ | grep "\.c" | grep -v svn`; do [ "`grep "M_GetText(" $file`" ] && FILES="$FILES $file"; done; xgettext -d srb2 -o locale/srb2.pot -kM_GetText -F --no-wrap $FILES # FILES=""; for file in `find ./ | grep "\.c" | grep -v svn`; do [ "`grep "M_GetText(" $file`" ] && FILES="$FILES $file"; done; xgettext -d srb2 -o locale/srb2.pot -kM_GetText -F --no-wrap $FILES
ifndef NOGETTEXT
ifdef GETTEXT ifdef GETTEXT
POS:=$(BIN)/en.mo POS:=$(BIN)/en.mo
OPTS+=-DGETTEXT OPTS+=-DGETTEXT
endif endif
endif
ifdef DJGPPDOS ifdef DJGPPDOS
all: pre-build $(BIN)/$(EXENAME) all: pre-build $(BIN)/$(EXENAME)

View File

@ -7,6 +7,21 @@
# and other things # 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 ifdef GCC63
GCC62=1 GCC62=1
@ -283,9 +298,6 @@ else
ifdef LINUX ifdef LINUX
NASMFORMAT=elf -DLINUX NASMFORMAT=elf -DLINUX
SDL=1 SDL=1
ifndef NOGETTEXT
GETTEXT=1
endif
ifdef LINUX64 ifdef LINUX64
OBJDIR:=$(OBJDIR)/Linux64 OBJDIR:=$(OBJDIR)/Linux64
BIN:=$(BIN)/Linux64 BIN:=$(BIN)/Linux64
@ -321,29 +333,28 @@ else
ifdef MINGW64 ifdef MINGW64
INTERFACE=win32 INTERFACE=win32
#NASMFORMAT=win64 #NASMFORMAT=win64
ifndef NOGETTEXT
#GETTEXT=1
endif
OBJDIR:=$(OBJDIR)/Mingw64 OBJDIR:=$(OBJDIR)/Mingw64
BIN:=$(BIN)/Mingw64 BIN:=$(BIN)/Mingw64
else else
ifdef WII ifdef WII
INTERFACE=sdl INTERFACE=sdl12
NONX86=1 NONX86=1
STATIC=1 STATIC=1
PREFIX?=powerpc-eabi PREFIX?=powerpc-eabi
SDL=1 SDL=1
SDL12=1
SDLMAIN=1 SDLMAIN=1
OBJDIR:=$(OBJDIR)/Wii OBJDIR:=$(OBJDIR)/Wii
BIN:=$(BIN)/Wii BIN:=$(BIN)/Wii
NOUPX=1 NOUPX=1
else else
ifdef PS3N ifdef PS3N
INTERFACE=sdl INTERFACE=sdl12
NONX86=1 NONX86=1
STATIC=1 STATIC=1
PREFIX?=ppu PREFIX?=ppu
SDL=1 SDL=1
SDL12=1
# unsure? # unsure?
#SDLMAIN=1 #SDLMAIN=1
# can't compile SDL_mixer for ps3... # can't compile SDL_mixer for ps3...
@ -354,41 +365,42 @@ else
ifdef MINGW ifdef MINGW
INTERFACE=win32 INTERFACE=win32
NASMFORMAT=win32 NASMFORMAT=win32
ifndef NOGETTEXT
GETTEXT=1
endif
OBJDIR:=$(OBJDIR)/Mingw OBJDIR:=$(OBJDIR)/Mingw
BIN:=$(BIN)/Mingw BIN:=$(BIN)/Mingw
else else
ifdef XBOX ifdef XBOX
INTERFACE=sdl INTERFACE=sdl12
NASMFORMAT=win32 NASMFORMAT=win32
PREFIX?=/usr/local/openxdk/bin/i386-pc-xbox PREFIX?=/usr/local/openxdk/bin/i386-pc-xbox
SDL=1 SDL=1
SDL12=1
OBJDIR:=$(OBJDIR)/XBOX OBJDIR:=$(OBJDIR)/XBOX
BIN:=$(BIN)/XBOX BIN:=$(BIN)/XBOX
else else
ifdef PSP ifdef PSP
INTERFACE=sdl INTERFACE=sdl12
NONX86=1 NONX86=1
SDL=1 SDL=1
SDL12=1
OBJDIR:=$(OBJDIR)/PSP OBJDIR:=$(OBJDIR)/PSP
BIN:=$(BIN)/PSP BIN:=$(BIN)/PSP
NOUPX=1 NOUPX=1
else else
ifdef DC ifdef DC
INTERFACE=sdl INTERFACE=sdl12
NONX86=1 NONX86=1
SDL=1 SDL=1
SDL12=1
OBJDIR:=$(OBJDIR)/DC OBJDIR:=$(OBJDIR)/DC
BIN:=$(BIN)/DC BIN:=$(BIN)/DC
NOUPX=1 NOUPX=1
else else
ifdef WINCE ifdef WINCE
INTERFACE=sdl INTERFACE=sdl12
NONX86=1 NONX86=1
PREFIX?=arm-wince-pe PREFIX?=arm-wince-pe
SDL=1 SDL=1
SDL12=1
OBJDIR:=$(OBJDIR)/WinCE OBJDIR:=$(OBJDIR)/WinCE
BIN:=$(BIN)/WinCE BIN:=$(BIN)/WinCE
else else
@ -413,6 +425,12 @@ endif
endif endif
endif endif
ifdef GP2X
ifdef SDL
SDL12=1
endif
endif
ifdef ARCHNAME ifdef ARCHNAME
OBJDIR:=$(OBJDIR)/$(ARCHNAME) OBJDIR:=$(OBJDIR)/$(ARCHNAME)
BIN:=$(BIN)/$(ARCHNAME) BIN:=$(BIN)/$(ARCHNAME)
@ -446,7 +464,13 @@ OBJDUMP_OPTS?=--wide --source --line-numbers
LD=$(CC) LD=$(CC)
ifdef SDL ifdef SDL
# SDL 2.0
ifndef SDL12
INTERFACE=sdl INTERFACE=sdl
# SDL 1.2
else
INTERFACE=sdl12
endif
OBJDIR:=$(OBJDIR)/SDL OBJDIR:=$(OBJDIR)/SDL
endif endif

View File

@ -412,7 +412,7 @@ static Instruction symbexec (const Proto *pt, int lastpc, int reg) {
case OP_FORLOOP: case OP_FORLOOP:
case OP_FORPREP: case OP_FORPREP:
checkreg(pt, a+3); checkreg(pt, a+3);
/* go through */ /* FALLTHRU */
case OP_JMP: { case OP_JMP: {
int dest = pc+1+b; int dest = pc+1+b;
/* not full check and jump is forward and do not skip `lastpc'? */ /* not full check and jump is forward and do not skip `lastpc'? */

View File

@ -306,11 +306,12 @@ static void read_string (LexState *ls, int del, SemInfo *seminfo) {
save_and_next(ls); /* skip $ */ save_and_next(ls); /* skip $ */
seminfo->ts = luaX_newstring(ls, luaZ_buffer(ls->buff) + 1, seminfo->ts = luaX_newstring(ls, luaZ_buffer(ls->buff) + 1,
luaZ_bufflen(ls->buff) - 2); luaZ_bufflen(ls->buff) - 2);
ls->refstr++; /* expect '\' anytime soon */ ls->refstr++; /* expect '\' anytime soon */
lua_assert(ls->lookahead.token == TK_EOS); lua_assert(ls->lookahead.token == TK_EOS);
ls->lookahead.token = TK_CONCAT; ls->lookahead.token = TK_CONCAT;
return; return;
} }
/* FALLTHRU */
default: { default: {
if (!isdigit(ls->current)) if (!isdigit(ls->current))
save_and_next(ls); /* handles \\, \", \', and \? */ save_and_next(ls); /* handles \\, \", \', and \? */
@ -340,7 +341,8 @@ static void read_string (LexState *ls, int del, SemInfo *seminfo) {
}; };
switch (i) { 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 ); case 2: save( ls, c&0xff );
break; break;
case 5: case 5:
@ -350,7 +352,7 @@ static void read_string (LexState *ls, int del, SemInfo *seminfo) {
} }
continue; 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, // 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 // 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 if (sep == -1) return '[';
else luaX_lexerror(ls, "invalid long string delimiter", TK_STRING); else luaX_lexerror(ls, "invalid long string delimiter", TK_STRING);
} }
/* FALLTHRU */
case '=': { case '=': {
next(ls); next(ls);
if (ls->current != '=') return '='; if (ls->current != '=') return '=';
else { next(ls); return TK_EQ; } else { next(ls); return TK_EQ; }
} }
/* FALLTHRU */
case '<': { case '<': {
next(ls); next(ls);
if (ls->current == '<') { next(ls); return TK_SHL; } if (ls->current == '<') { next(ls); return TK_SHL; }
if (ls->current != '=') return '<'; if (ls->current != '=') return '<';
else { next(ls); return TK_LE; } else { next(ls); return TK_LE; }
} }
case '>': { case '>': {
next(ls); next(ls);
if (ls->current == '>') { next(ls); return TK_SHR; } if (ls->current == '>') { next(ls); return TK_SHR; }
if (ls->current != '=') return '>'; if (ls->current != '=') return '>';
else { next(ls); return TK_GE; } else { next(ls); return TK_GE; }
} }
@ -547,9 +551,10 @@ static int llex (LexState *ls, SemInfo *seminfo) {
} }
case '\\': if (ls->refstr) { case '\\': if (ls->refstr) {
ls->refstr--; ls->refstr--;
ls->current = '"'; /* whacky! */ ls->current = '"'; /* whacky! */
return TK_CONCAT; return TK_CONCAT;
} }
/* FALLTHRU */
default: { default: {
if (isspace(ls->current)) { if (isspace(ls->current)) {
lua_assert(!currIsNewline(ls)); lua_assert(!currIsNewline(ls));

View File

@ -478,6 +478,7 @@ static TValue *newkey (lua_State *L, Table *t, const TValue *key) {
return luaH_getnum(t, k); /* use specialized version */ return luaH_getnum(t, k); /* use specialized version */
/* else go through */ /* else go through */
} }
/* FALLTHRU */
default: { default: {
Node *n = mainposition(t, key); Node *n = mainposition(t, key);
do { /* check whether `key' is somewhere in the chain */ do { /* check whether `key' is somewhere in the chain */

View File

@ -1188,7 +1188,10 @@ finish:
CONS_Printf(M_GetText("%s set to %s\n"), var->name, var->string); CONS_Printf(M_GetText("%s set to %s\n"), var->name, var->string);
var->flags &= ~CV_SHOWMODIFONETIME; 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; var->flags |= CV_MODIFIED;
// raise 'on change' code // raise 'on change' code
#ifdef HAVE_BLUA #ifdef HAVE_BLUA

View File

@ -51,7 +51,7 @@
#endif #endif
#ifdef _XBOX #ifdef _XBOX
#include "sdl/SRB2XBOX/xboxhelp.h" #include "sdl12/SRB2XBOX/xboxhelp.h"
#endif #endif
// //
@ -1748,9 +1748,7 @@ static boolean CL_ServerConnectionSearchTicker(boolean viams, tic_t *asksent)
{ {
#ifndef NONET #ifndef NONET
INT32 i; INT32 i;
#endif
#ifndef NONET
// serverlist is updated by GetPacket function // serverlist is updated by GetPacket function
if (serverlistcount > 0) if (serverlistcount > 0)
{ {
@ -1784,7 +1782,20 @@ static boolean CL_ServerConnectionSearchTicker(boolean viams, tic_t *asksent)
serverlist[i].info.fileneeded); serverlist[i].info.fileneeded);
CONS_Printf(M_GetText("Checking files...\n")); CONS_Printf(M_GetText("Checking files...\n"));
i = CL_CheckFiles(); i = CL_CheckFiles();
if (i == 2) // cannot join for some reason if (i == 3) // too many files
{
D_QuitNetGame();
CL_Reset();
D_StartTitle();
M_StartMessage(M_GetText(
"You have too many WAD files loaded\n"
"to add ones the server is using.\n"
"Please restart SRB2 before connecting.\n\n"
"Press ESC\n"
), NULL, MM_NOTHING);
return false;
}
else if (i == 2) // cannot join for some reason
{ {
D_QuitNetGame(); D_QuitNetGame();
CL_Reset(); CL_Reset();
@ -1887,6 +1898,7 @@ static boolean CL_ServerConnectionTicker(boolean viams, const char *tmpsave, tic
break; // exit the case break; // exit the case
cl_mode = CL_ASKJOIN; // don't break case continue to cljoin request now cl_mode = CL_ASKJOIN; // don't break case continue to cljoin request now
/* FALLTHRU */
case CL_ASKJOIN: case CL_ASKJOIN:
CL_LoadServerFiles(); CL_LoadServerFiles();
@ -2529,12 +2541,18 @@ static void Command_Nodes(void)
static void Command_Ban(void) static void Command_Ban(void)
{ {
if (COM_Argc() == 1) if (COM_Argc() < 2)
{ {
CONS_Printf(M_GetText("Ban <playername/playernum> <reason>: ban and kick a player\n")); CONS_Printf(M_GetText("Ban <playername/playernum> <reason>: ban and kick a player\n"));
return; return;
} }
if (!netgame) // Don't kick Tails in splitscreen!
{
CONS_Printf(M_GetText("This only works in a netgame.\n"));
return;
}
if (server || adminplayer == consoleplayer) if (server || adminplayer == consoleplayer)
{ {
XBOXSTATIC UINT8 buf[3 + MAX_REASONLENGTH]; XBOXSTATIC UINT8 buf[3 + MAX_REASONLENGTH];
@ -2544,8 +2562,9 @@ static void Command_Ban(void)
if (pn == -1 || pn == 0) if (pn == -1 || pn == 0)
return; return;
else
WRITEUINT8(p, pn); WRITEUINT8(p, pn);
if (server && I_Ban && !I_Ban(node)) // only the server is allowed to do this right now if (server && I_Ban && !I_Ban(node)) // only the server is allowed to do this right now
{ {
CONS_Alert(CONS_WARNING, M_GetText("Too many bans! Geez, that's a lot of people you're excluding...\n")); CONS_Alert(CONS_WARNING, M_GetText("Too many bans! Geez, that's a lot of people you're excluding...\n"));
@ -2588,21 +2607,27 @@ static void Command_Ban(void)
static void Command_Kick(void) static void Command_Kick(void)
{ {
XBOXSTATIC UINT8 buf[3 + MAX_REASONLENGTH]; if (COM_Argc() < 2)
UINT8 *p = buf;
if (COM_Argc() == 1)
{ {
CONS_Printf(M_GetText("kick <playername/playernum> <reason>: kick a player\n")); CONS_Printf(M_GetText("kick <playername/playernum> <reason>: kick a player\n"));
return; return;
} }
if (!netgame) // Don't kick Tails in splitscreen!
{
CONS_Printf(M_GetText("This only works in a netgame.\n"));
return;
}
if (server || adminplayer == consoleplayer) if (server || adminplayer == consoleplayer)
{ {
XBOXSTATIC UINT8 buf[3 + MAX_REASONLENGTH];
UINT8 *p = buf;
const SINT8 pn = nametonum(COM_Argv(1)); const SINT8 pn = nametonum(COM_Argv(1));
WRITESINT8(p, pn);
if (pn == -1 || pn == 0) if (pn == -1 || pn == 0)
return; return;
// Special case if we are trying to kick a player who is downloading the game state: // Special case if we are trying to kick a player who is downloading the game state:
// trigger a timeout instead of kicking them, because a kick would only // trigger a timeout instead of kicking them, because a kick would only
// take effect after they have finished downloading // take effect after they have finished downloading
@ -2611,6 +2636,9 @@ static void Command_Kick(void)
Net_ConnectionTimeout(playernode[pn]); Net_ConnectionTimeout(playernode[pn]);
return; return;
} }
WRITESINT8(p, pn);
if (COM_Argc() == 2) if (COM_Argc() == 2)
{ {
WRITEUINT8(p, KICK_MSG_GO_AWAY); WRITEUINT8(p, KICK_MSG_GO_AWAY);
@ -3417,17 +3445,42 @@ static void HandlePacketFromAwayNode(SINT8 node)
if (node != servernode) if (node != servernode)
DEBFILE(va("Received packet from unknown host %d\n", node)); DEBFILE(va("Received packet from unknown host %d\n", node));
// macro for packets that should only be sent by the server
// if it is NOT from the server, bail out and close the connection!
#define SERVERONLY \
if (node != servernode) \
{ \
Net_CloseConnection(node); \
break; \
}
switch (netbuffer->packettype) switch (netbuffer->packettype)
{ {
case PT_ASKINFOVIAMS: case PT_ASKINFOVIAMS:
#if 0
if (server && serverrunning) if (server && serverrunning)
{ {
INT32 clientnode = I_NetMakeNode(netbuffer->u.msaskinfo.clientaddr); INT32 clientnode;
SV_SendServerInfo(clientnode, (tic_t)LONG(netbuffer->u.msaskinfo.time)); if (ms_RoomId < 0) // ignore if we're not actually on the MS right now
SV_SendPlayerInfo(clientnode); // Send extra info {
Net_CloseConnection(clientnode); Net_CloseConnection(node); // and yes, close connection
// Don't close connection to MS. return;
}
clientnode = I_NetMakeNode(netbuffer->u.msaskinfo.clientaddr);
if (clientnode != -1)
{
SV_SendServerInfo(clientnode, (tic_t)LONG(netbuffer->u.msaskinfo.time));
SV_SendPlayerInfo(clientnode); // Send extra info
Net_CloseConnection(clientnode);
// Don't close connection to MS...
}
else
Net_CloseConnection(node); // ...unless the IP address is not valid
} }
else
Net_CloseConnection(node); // you're not supposed to get it, so ignore it
#else
Net_CloseConnection(node);
#endif
break; break;
case PT_ASKINFO: case PT_ASKINFO:
@ -3435,8 +3488,8 @@ static void HandlePacketFromAwayNode(SINT8 node)
{ {
SV_SendServerInfo(node, (tic_t)LONG(netbuffer->u.askinfo.time)); SV_SendServerInfo(node, (tic_t)LONG(netbuffer->u.askinfo.time));
SV_SendPlayerInfo(node); // Send extra info SV_SendPlayerInfo(node); // Send extra info
Net_CloseConnection(node);
} }
Net_CloseConnection(node);
break; break;
case PT_SERVERREFUSE: // Negative response of client join request case PT_SERVERREFUSE: // Negative response of client join request
@ -3445,6 +3498,7 @@ static void HandlePacketFromAwayNode(SINT8 node)
Net_CloseConnection(node); Net_CloseConnection(node);
break; break;
} }
SERVERONLY
if (cl_mode == CL_WAITJOINRESPONSE) if (cl_mode == CL_WAITJOINRESPONSE)
{ {
// Save the reason so it can be displayed after quitting the netgame // Save the reason so it can be displayed after quitting the netgame
@ -3476,6 +3530,7 @@ static void HandlePacketFromAwayNode(SINT8 node)
Net_CloseConnection(node); Net_CloseConnection(node);
break; break;
} }
SERVERONLY
/// \note how would this happen? and is it doing the right thing if it does? /// \note how would this happen? and is it doing the right thing if it does?
if (cl_mode != CL_WAITJOINRESPONSE) if (cl_mode != CL_WAITJOINRESPONSE)
break; break;
@ -3539,13 +3594,18 @@ static void HandlePacketFromAwayNode(SINT8 node)
Net_CloseConnection(node); Net_CloseConnection(node);
break; break;
} }
else SERVERONLY
Got_Filetxpak(); Got_Filetxpak();
break; break;
case PT_REQUESTFILE: case PT_REQUESTFILE:
if (server) if (server)
Got_RequestFilePak(node); {
if (!cv_downloading.value || !Got_RequestFilePak(node))
Net_CloseConnection(node); // close connection if one of the requested files could not be sent, or you disabled downloading anyway
}
else
Net_CloseConnection(node); // nope
break; break;
case PT_NODETIMEOUT: case PT_NODETIMEOUT:
@ -3561,6 +3621,7 @@ static void HandlePacketFromAwayNode(SINT8 node)
// Do not remove my own server (we have just get a out of order packet) // Do not remove my own server (we have just get a out of order packet)
if (node == servernode) if (node == servernode)
break; break;
/* FALLTHRU */
default: default:
DEBFILE(va("unknown packet received (%d) from unknown host\n",netbuffer->packettype)); DEBFILE(va("unknown packet received (%d) from unknown host\n",netbuffer->packettype));
@ -3568,6 +3629,7 @@ static void HandlePacketFromAwayNode(SINT8 node)
break; // Ignore it break; // Ignore it
} }
#undef SERVERONLY
} }
/** Handles a packet received from a node that is in game /** Handles a packet received from a node that is in game
@ -3600,6 +3662,8 @@ FILESTAMP
{ {
// -------------------------------------------- SERVER RECEIVE ---------- // -------------------------------------------- SERVER RECEIVE ----------
case PT_RESYNCHGET: case PT_RESYNCHGET:
if (client)
break;
SV_AcknowledgeResynchAck(netconsole, netbuffer->u.resynchgot); SV_AcknowledgeResynchAck(netconsole, netbuffer->u.resynchgot);
break; break;
case PT_CLIENTCMD: case PT_CLIENTCMD:
@ -3666,7 +3730,8 @@ FILESTAMP
} }
// Splitscreen cmd // Splitscreen cmd
if (netbuffer->packettype == PT_CLIENT2CMD && nodetoplayer2[node] >= 0) if ((netbuffer->packettype == PT_CLIENT2CMD || netbuffer->packettype == PT_CLIENT2MIS)
&& nodetoplayer2[node] >= 0)
G_MoveTiccmd(&netcmds[maketic%BACKUPTICS][(UINT8)nodetoplayer2[node]], G_MoveTiccmd(&netcmds[maketic%BACKUPTICS][(UINT8)nodetoplayer2[node]],
&netbuffer->u.client2pak.cmd2, 1); &netbuffer->u.client2pak.cmd2, 1);
@ -3713,6 +3778,7 @@ FILESTAMP
break; break;
case PT_TEXTCMD2: // splitscreen special case PT_TEXTCMD2: // splitscreen special
netconsole = nodetoplayer2[node]; netconsole = nodetoplayer2[node];
/* FALLTHRU */
case PT_TEXTCMD: case PT_TEXTCMD:
if (client) if (client)
break; break;
@ -3725,6 +3791,27 @@ FILESTAMP
tic_t tic = maketic; tic_t tic = maketic;
UINT8 *textcmd; UINT8 *textcmd;
// ignore if the textcmd has a reported size of zero
// this shouldn't be sent at all
if (!netbuffer->u.textcmd[0])
{
DEBFILE(va("GetPacket: Textcmd with size 0 detected! (node %u, player %d)\n",
node, netconsole));
Net_UnAcknowledgePacket(node);
break;
}
// ignore if the textcmd size var is actually larger than it should be
// BASEPACKETSIZE + 1 (for size) + textcmd[0] should == datalength
if (netbuffer->u.textcmd[0] > (size_t)doomcom->datalength-BASEPACKETSIZE-1)
{
DEBFILE(va("GetPacket: Bad Textcmd packet size! (expected %d, actual %s, node %u, player %d)\n",
netbuffer->u.textcmd[0], sizeu1((size_t)doomcom->datalength-BASEPACKETSIZE-1),
node, netconsole));
Net_UnAcknowledgePacket(node);
break;
}
// check if tic that we are making isn't too large else we cannot send it :( // check if tic that we are making isn't too large else we cannot send it :(
// doomcom->numslots+1 "+1" since doomcom->numslots can change within this time and sent time // doomcom->numslots+1 "+1" since doomcom->numslots can change within this time and sent time
j = software_MAXPACKETLENGTH j = software_MAXPACKETLENGTH
@ -3918,7 +4005,7 @@ FILESTAMP
if (client) if (client)
{ {
INT32 i; INT32 i;
for (i = 0; i < MAXNETNODES; i++) for (i = 0; i < MAXPLAYERS; i++)
if (playeringame[i]) if (playeringame[i])
playerpingtable[i] = (tic_t)netbuffer->u.pingtable[i]; playerpingtable[i] = (tic_t)netbuffer->u.pingtable[i];
} }
@ -3928,6 +4015,21 @@ FILESTAMP
case PT_SERVERCFG: case PT_SERVERCFG:
break; break;
case PT_FILEFRAGMENT: case PT_FILEFRAGMENT:
// Only accept PT_FILEFRAGMENT from the server.
if (node != servernode)
{
CONS_Alert(CONS_WARNING, M_GetText("%s received from non-host %d\n"), "PT_FILEFRAGMENT", node);
if (server)
{
XBOXSTATIC UINT8 buf[2];
buf[0] = (UINT8)node;
buf[1] = KICK_MSG_CON_FAIL;
SendNetXCmd(XD_KICK, &buf, 2);
}
break;
}
if (client) if (client)
Got_Filetxpak(); Got_Filetxpak();
break; break;
@ -4031,7 +4133,10 @@ static INT16 Consistancy(void)
#ifdef MOBJCONSISTANCY #ifdef MOBJCONSISTANCY
if (!thinkercap.next) if (!thinkercap.next)
{
DEBFILE(va("Consistancy = %u\n", ret));
return ret; return ret;
}
for (th = thinkercap.next; th != &thinkercap; th = th->next) for (th = thinkercap.next; th != &thinkercap; th = th->next)
{ {
if (th->function.acp1 != (actionf_p1)P_MobjThinker) if (th->function.acp1 != (actionf_p1)P_MobjThinker)
@ -4100,6 +4205,8 @@ static INT16 Consistancy(void)
} }
#endif #endif
DEBFILE(va("Consistancy = %u\n", (ret & 0xFFFF)));
return (INT16)(ret & 0xFFFF); return (INT16)(ret & 0xFFFF);
} }
@ -4461,8 +4568,8 @@ static inline void PingUpdate(void)
} }
//send out our ping packets //send out our ping packets
for (i = 0; i < MAXPLAYERS; i++) for (i = 0; i < MAXNETNODES; i++)
if (playeringame[i]) if (nodeingame[i])
HSendPacket(i, true, 0, sizeof(INT32) * MAXPLAYERS); HSendPacket(i, true, 0, sizeof(INT32) * MAXPLAYERS);
pingmeasurecount = 1; //Reset count pingmeasurecount = 1; //Reset count
@ -4492,20 +4599,15 @@ void NetUpdate(void)
gametime = nowtime; gametime = nowtime;
if (!(gametime % 255) && netgame && server)
{
#ifdef NEWPING
PingUpdate();
#endif
}
#ifdef NEWPING #ifdef NEWPING
if (server) if (server)
{ {
if (netgame && !(gametime % 255))
PingUpdate();
// update node latency values so we can take an average later. // update node latency values so we can take an average later.
for (i = 0; i < MAXNETNODES; i++) for (i = 0; i < MAXPLAYERS; i++)
if (playeringame[i]) if (playeringame[i])
realpingtable[i] += G_TicsToMilliseconds(GetLag(i)); realpingtable[i] += G_TicsToMilliseconds(GetLag(playernode[i]));
pingmeasurecount++; pingmeasurecount++;
} }
#endif #endif

View File

@ -82,7 +82,7 @@ int snprintf(char *str, size_t n, const char *fmt, ...);
#endif #endif
#ifdef _XBOX #ifdef _XBOX
#include "sdl/SRB2XBOX/xboxhelp.h" #include "sdl12/SRB2XBOX/xboxhelp.h"
#endif #endif
#ifdef HWRENDER #ifdef HWRENDER

View File

@ -711,6 +711,13 @@ void Net_CloseConnection(INT32 node)
#else #else
INT32 i; INT32 i;
boolean forceclose = (node & FORCECLOSE) != 0; boolean forceclose = (node & FORCECLOSE) != 0;
if (node == -1)
{
DEBFILE(M_GetText("Net_CloseConnection: node -1 detected!\n"));
return; // nope, just ignore it
}
node &= ~FORCECLOSE; node &= ~FORCECLOSE;
if (!node) if (!node)
@ -718,7 +725,7 @@ void Net_CloseConnection(INT32 node)
if (node < 0 || node >= MAXNETNODES) // prevent invalid nodes from crashing the game if (node < 0 || node >= MAXNETNODES) // prevent invalid nodes from crashing the game
{ {
CONS_Alert(CONS_WARNING, M_GetText("Net_CloseConnection: invalid node %d detected!\n"), node); DEBFILE(va(M_GetText("Net_CloseConnection: invalid node %d detected!\n"), node));
return; return;
} }
@ -1021,6 +1028,7 @@ boolean HSendPacket(INT32 node, boolean reliable, UINT8 acknum, size_t packetlen
#endif #endif
return false; return false;
} }
netbuffer->ack = netbuffer->ackreturn = 0; // don't hold over values from last packet sent/received
M_Memcpy(&reboundstore[rebound_head], netbuffer, M_Memcpy(&reboundstore[rebound_head], netbuffer,
doomcom->datalength); doomcom->datalength);
reboundsize[rebound_head] = doomcom->datalength; reboundsize[rebound_head] = doomcom->datalength;
@ -1356,7 +1364,7 @@ boolean D_CheckNetGame(void)
#else #else
if (M_CheckParm("-debugfile")) if (M_CheckParm("-debugfile"))
{ {
char filename[20]; char filename[21];
INT32 k = doomcom->consoleplayer - 1; INT32 k = doomcom->consoleplayer - 1;
if (M_IsNextParm()) if (M_IsNextParm())
k = atoi(M_GetNextParm()) - 1; k = atoi(M_GetNextParm()) - 1;

View File

@ -1606,8 +1606,13 @@ void D_MapChange(INT32 mapnum, INT32 newgametype, boolean pultmode, boolean rese
mapchangepending = 0; mapchangepending = 0;
// spawn the server if needed // spawn the server if needed
// reset players if there is a new one // reset players if there is a new one
if (!(adminplayer == consoleplayer) && SV_SpawnServer()) if (!(adminplayer == consoleplayer))
buf[0] &= ~(1<<1); {
if (SV_SpawnServer())
buf[0] &= ~(1<<1);
if (!Playing()) // you failed to start a server somehow, so cancel the map change
return;
}
// Kick bot from special stages // Kick bot from special stages
if (botskin) if (botskin)
@ -2485,7 +2490,7 @@ static void Got_Teamchange(UINT8 **cp, INT32 playernum)
error = true; error = true;
break; break;
} }
//fall down /* FALLTHRU */
case GT_TAG: case GT_TAG:
switch (NetPacket.packet.newteam) switch (NetPacket.packet.newteam)
{ {
@ -3115,7 +3120,13 @@ static void Got_RequestAddfilecmd(UINT8 **cp, INT32 playernum)
filestatus_t ncs = FS_NOTFOUND; filestatus_t ncs = FS_NOTFOUND;
UINT8 md5sum[16]; UINT8 md5sum[16];
boolean kick = false; boolean kick = false;
boolean toomany = false;
INT32 i; INT32 i;
size_t packetsize = 0;
serverinfo_pak *dummycheck = NULL;
// Shut the compiler up.
(void)dummycheck;
READSTRINGN(*cp, filename, 240); READSTRINGN(*cp, filename, 240);
READMEM(*cp, md5sum, 16); READMEM(*cp, md5sum, 16);
@ -3141,13 +3152,25 @@ static void Got_RequestAddfilecmd(UINT8 **cp, INT32 playernum)
return; return;
} }
ncs = findfile(filename,md5sum,true); // See W_LoadWadFile in w_wad.c
for (i = 0; i < numwadfiles; i++)
packetsize += nameonlylength(wadfiles[i]->filename) + 22;
if (ncs != FS_FOUND) packetsize += nameonlylength(filename) + 22;
if ((numwadfiles >= MAX_WADFILES)
|| (packetsize > sizeof(dummycheck->fileneeded)))
toomany = true;
else
ncs = findfile(filename,md5sum,true);
if (ncs != FS_FOUND || toomany)
{ {
char message[256]; char message[256];
if (ncs == FS_NOTFOUND) if (toomany)
sprintf(message, M_GetText("Too many files loaded to add %s\n"), filename);
else if (ncs == FS_NOTFOUND)
sprintf(message, M_GetText("The server doesn't have %s\n"), filename); sprintf(message, M_GetText("The server doesn't have %s\n"), filename);
else if (ncs == FS_MD5SUMBAD) else if (ncs == FS_MD5SUMBAD)
sprintf(message, M_GetText("Checksum mismatch on %s\n"), filename); sprintf(message, M_GetText("Checksum mismatch on %s\n"), filename);
@ -3217,10 +3240,15 @@ static void Got_Addfilecmd(UINT8 **cp, INT32 playernum)
ncs = findfile(filename,md5sum,true); ncs = findfile(filename,md5sum,true);
if (ncs != FS_FOUND) if (ncs != FS_FOUND || !P_AddWadFile(filename, NULL))
{ {
Command_ExitGame_f(); Command_ExitGame_f();
if (ncs == FS_NOTFOUND) if (ncs == FS_FOUND)
{
CONS_Printf(M_GetText("The server tried to add %s,\nbut you have too many files added.\nRestart the game to clear loaded files\nand play on this server."), filename);
M_StartMessage(va("The server added a file \n(%s)\nbut you have too many files added.\nRestart the game to clear loaded files.\n\nPress ESC\n",filename), NULL, MM_NOTHING);
}
else if (ncs == FS_NOTFOUND)
{ {
CONS_Printf(M_GetText("The server tried to add %s,\nbut you don't have this file.\nYou need to find it in order\nto play on this server."), filename); CONS_Printf(M_GetText("The server tried to add %s,\nbut you don't have this file.\nYou need to find it in order\nto play on this server."), filename);
M_StartMessage(va("The server added a file \n(%s)\nthat you do not have.\n\nPress ESC\n",filename), NULL, MM_NOTHING); M_StartMessage(va("The server added a file \n(%s)\nthat you do not have.\n\nPress ESC\n",filename), NULL, MM_NOTHING);
@ -3238,7 +3266,6 @@ static void Got_Addfilecmd(UINT8 **cp, INT32 playernum)
return; return;
} }
P_AddWadFile(filename, NULL);
G_SetGameModified(true); G_SetGameModified(true);
} }

View File

@ -62,7 +62,8 @@
#include <errno.h> #include <errno.h>
static void SV_SendFile(INT32 node, const char *filename, UINT8 fileid); // Prototypes
static boolean SV_SendFile(INT32 node, const char *filename, UINT8 fileid);
// Sender structure // Sender structure
typedef struct filetx_s typedef struct filetx_s
@ -303,7 +304,8 @@ boolean CL_SendRequestFile(void)
} }
// get request filepak and put it on the send queue // get request filepak and put it on the send queue
void Got_RequestFilePak(INT32 node) // returns false if a requested file was not found or cannot be sent
boolean Got_RequestFilePak(INT32 node)
{ {
char wad[MAX_WADPATH+1]; char wad[MAX_WADPATH+1];
UINT8 *p = netbuffer->u.textcmd; UINT8 *p = netbuffer->u.textcmd;
@ -314,8 +316,13 @@ void Got_RequestFilePak(INT32 node)
if (id == 0xFF) if (id == 0xFF)
break; break;
READSTRINGN(p, wad, MAX_WADPATH); READSTRINGN(p, wad, MAX_WADPATH);
SV_SendFile(node, wad, id); if (!SV_SendFile(node, wad, id))
{
SV_AbortSendFiles(node);
return false; // don't read the rest of the files
}
} }
return true; // no problems with any files
} }
/** Checks if the files needed aren't already loaded or on the disk /** Checks if the files needed aren't already loaded or on the disk
@ -330,6 +337,12 @@ INT32 CL_CheckFiles(void)
INT32 i, j; INT32 i, j;
char wadfilename[MAX_WADPATH]; char wadfilename[MAX_WADPATH];
INT32 ret = 1; INT32 ret = 1;
size_t packetsize = 0;
size_t filestoget = 0;
serverinfo_pak *dummycheck = NULL;
// Shut the compiler up.
(void)dummycheck;
// if (M_CheckParm("-nofiles")) // if (M_CheckParm("-nofiles"))
// return 1; // return 1;
@ -378,6 +391,10 @@ INT32 CL_CheckFiles(void)
return 1; return 1;
} }
// See W_LoadWadFile in w_wad.c
for (i = 0; i < numwadfiles; i++)
packetsize += nameonlylength(wadfiles[i]->filename) + 22;
for (i = 1; i < fileneedednum; i++) for (i = 1; i < fileneedednum; i++)
{ {
CONS_Debug(DBG_NETPLAY, "searching for '%s' ", fileneeded[i].filename); CONS_Debug(DBG_NETPLAY, "searching for '%s' ", fileneeded[i].filename);
@ -397,6 +414,14 @@ INT32 CL_CheckFiles(void)
if (fileneeded[i].status != FS_NOTFOUND || !fileneeded[i].important) if (fileneeded[i].status != FS_NOTFOUND || !fileneeded[i].important)
continue; continue;
packetsize += nameonlylength(fileneeded[i].filename) + 22;
if ((numwadfiles+filestoget >= MAX_WADFILES)
|| (packetsize > sizeof(dummycheck->fileneeded)))
return 3;
filestoget++;
fileneeded[i].status = findfile(fileneeded[i].filename, fileneeded[i].md5sum, true); fileneeded[i].status = findfile(fileneeded[i].filename, fileneeded[i].md5sum, true);
CONS_Debug(DBG_NETPLAY, "found %d\n", fileneeded[i].status); CONS_Debug(DBG_NETPLAY, "found %d\n", fileneeded[i].status);
if (fileneeded[i].status != FS_FOUND) if (fileneeded[i].status != FS_FOUND)
@ -480,7 +505,7 @@ static INT32 filestosend = 0;
* \sa SV_SendRam * \sa SV_SendRam
* *
*/ */
static void SV_SendFile(INT32 node, const char *filename, UINT8 fileid) static boolean SV_SendFile(INT32 node, const char *filename, UINT8 fileid)
{ {
filetx_t **q; // A pointer to the "next" field of the last file in the list filetx_t **q; // A pointer to the "next" field of the last file in the list
filetx_t *p; // The new file request filetx_t *p; // The new file request
@ -488,7 +513,7 @@ static void SV_SendFile(INT32 node, const char *filename, UINT8 fileid)
char wadfilename[MAX_WADPATH]; char wadfilename[MAX_WADPATH];
if (cv_noticedownload.value) if (cv_noticedownload.value)
CONS_Printf("Sending file \"%s\" to node %d\n", filename, node); CONS_Printf("Sending file \"%s\" to node %d (%s)\n", filename, node, I_GetNodeAddress(node));
// Find the last file in the list and set a pointer to its "next" field // Find the last file in the list and set a pointer to its "next" field
q = &transfer[node].txlist; q = &transfer[node].txlist;
@ -537,7 +562,7 @@ static void SV_SendFile(INT32 node, const char *filename, UINT8 fileid)
free(p->id.filename); free(p->id.filename);
free(p); free(p);
*q = NULL; *q = NULL;
return; return false; // cancel the rest of the requests
} }
// Handle huge file requests (i.e. bigger than cv_maxsend.value KB) // Handle huge file requests (i.e. bigger than cv_maxsend.value KB)
@ -549,7 +574,7 @@ static void SV_SendFile(INT32 node, const char *filename, UINT8 fileid)
free(p->id.filename); free(p->id.filename);
free(p); free(p);
*q = NULL; *q = NULL;
return; return false; // cancel the rest of the requests
} }
DEBFILE(va("Sending file %s (id=%d) to %d\n", filename, fileid, node)); DEBFILE(va("Sending file %s (id=%d) to %d\n", filename, fileid, node));
@ -557,6 +582,7 @@ static void SV_SendFile(INT32 node, const char *filename, UINT8 fileid)
p->fileid = fileid; p->fileid = fileid;
p->next = NULL; // End of list p->next = NULL; // End of list
filestosend++; filestosend++;
return true;
} }
/** Adds a memory block to the file list for a node /** Adds a memory block to the file list for a node

View File

@ -69,7 +69,7 @@ boolean SV_SendingFile(INT32 node);
boolean CL_CheckDownloadable(void); boolean CL_CheckDownloadable(void);
boolean CL_SendRequestFile(void); boolean CL_SendRequestFile(void);
void Got_RequestFilePak(INT32 node); boolean Got_RequestFilePak(INT32 node);
void SV_AbortSendFiles(INT32 node); void SV_AbortSendFiles(INT32 node);
void CloseNetFile(void); void CloseNetFile(void);

View File

@ -11,6 +11,7 @@
/// \brief Load dehacked file and change tables and text /// \brief Load dehacked file and change tables and text
#include "doomdef.h" #include "doomdef.h"
#include "d_main.h" // for srb2home
#include "g_game.h" #include "g_game.h"
#include "sounds.h" #include "sounds.h"
#include "info.h" #include "info.h"
@ -3081,6 +3082,8 @@ static void readmaincfg(MYFILE *f)
strncpy(savegamename, timeattackfolder, sizeof (timeattackfolder)); strncpy(savegamename, timeattackfolder, sizeof (timeattackfolder));
strlcat(savegamename, "%u.ssg", sizeof(savegamename)); strlcat(savegamename, "%u.ssg", sizeof(savegamename));
// can't use sprintf since there is %u in savegamename
strcatbf(savegamename, srb2home, PATHSEP);
gamedataadded = true; gamedataadded = true;
} }

View File

@ -536,4 +536,8 @@ extern const char *compdate, *comptime, *comprevision, *compbranch;
/// \note You should leave this enabled unless you're working with a future SRB2 version. /// \note You should leave this enabled unless you're working with a future SRB2 version.
#define MUSICSLOT_COMPATIBILITY #define MUSICSLOT_COMPATIBILITY
/// 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
#endif // __DOOMDEF__ #endif // __DOOMDEF__

View File

@ -94,7 +94,7 @@ static fixed_t paldiv;
* \return fademask_t for lump * \return fademask_t for lump
*/ */
static fademask_t *F_GetFadeMask(UINT8 masknum, UINT8 scrnnum) { 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}; static fademask_t fm = {NULL,0,0,0,0,0};
lumpnum_t lumpnum; lumpnum_t lumpnum;
UINT8 *lump, *mask; UINT8 *lump, *mask;

View File

@ -22,7 +22,7 @@
#include <windows.h> #include <windows.h>
#endif #endif
#ifdef _WIN32_WCE #ifdef _WIN32_WCE
#include "sdl/SRB2CE/cehelp.h" #include "sdl12/SRB2CE/cehelp.h"
#else #else
#include <sys/stat.h> #include <sys/stat.h>
#endif #endif

View File

@ -717,7 +717,7 @@ void G_SetGameModified(boolean silent)
*/ */
const char *G_BuildMapName(INT32 map) 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 > 0);
I_Assert(map <= NUMMAPS); I_Assert(map <= NUMMAPS);
@ -2420,6 +2420,9 @@ void G_SpawnPlayer(INT32 playernum, boolean starpost)
if (starpost) //Don't even bother with looking for a place to spawn. if (starpost) //Don't even bother with looking for a place to spawn.
{ {
P_MovePlayerToStarpost(playernum); P_MovePlayerToStarpost(playernum);
#ifdef HAVE_BLUA
LUAh_PlayerSpawn(&players[playernum]); // Lua hook for player spawning :)
#endif
return; return;
} }
@ -4009,7 +4012,7 @@ void G_GhostAddColor(ghostcolor_t color)
ghostext.color = (UINT8)color; ghostext.color = (UINT8)color;
} }
void G_GhostAddScale(UINT16 scale) void G_GhostAddScale(fixed_t scale)
{ {
if (!demorecording || !(demoflags & DF_GHOST)) if (!demorecording || !(demoflags & DF_GHOST))
return; return;

View File

@ -139,7 +139,7 @@ void G_GhostAddSpin(void);
void G_GhostAddRev(void); void G_GhostAddRev(void);
void G_GhostAddColor(ghostcolor_t color); void G_GhostAddColor(ghostcolor_t color);
void G_GhostAddFlip(void); void G_GhostAddFlip(void);
void G_GhostAddScale(UINT16 scale); void G_GhostAddScale(fixed_t scale);
void G_GhostAddHit(mobj_t *victim); void G_GhostAddHit(mobj_t *victim);
void G_WriteGhostTic(mobj_t *ghost); void G_WriteGhostTic(mobj_t *ghost);
void G_ConsGhostTic(void); void G_ConsGhostTic(void);

View File

@ -64,7 +64,7 @@ typedef struct GLMipmap_s GLMipmap_t;
// //
struct GLTexture_s struct GLTexture_s
{ {
GLMipmap_t mipmap; GLMipmap_t mipmap;
float scaleX; //used for scaling textures on walls float scaleX; //used for scaling textures on walls
float scaleY; float scaleY;
}; };
@ -88,7 +88,7 @@ struct GLPatch_s
UINT16 wadnum; // the software patch lump num for when the hardware patch UINT16 wadnum; // the software patch lump num for when the hardware patch
UINT16 lumpnum; // was flushed, and we need to re-create it UINT16 lumpnum; // was flushed, and we need to re-create it
GLMipmap_t mipmap; GLMipmap_t mipmap;
} ATTRPACK; };
typedef struct GLPatch_s GLPatch_t; typedef struct GLPatch_s GLPatch_t;
#endif //_HWR_DATA_ #endif //_HWR_DATA_

View File

@ -1084,9 +1084,9 @@ static void HWR_SplitWall(sector_t *sector, wallVert3D *wallVerts, INT32 texnum,
float endheight = 0.0f, endbheight = 0.0f; float endheight = 0.0f, endbheight = 0.0f;
fixed_t v1x = FLOAT_TO_FIXED(wallVerts[0].x); fixed_t v1x = FLOAT_TO_FIXED(wallVerts[0].x);
fixed_t v1y = FLOAT_TO_FIXED(wallVerts[0].y); fixed_t v1y = FLOAT_TO_FIXED(wallVerts[0].z); // not a typo
fixed_t v2x = FLOAT_TO_FIXED(wallVerts[1].x); fixed_t v2x = FLOAT_TO_FIXED(wallVerts[1].x);
fixed_t v2y = FLOAT_TO_FIXED(wallVerts[1].y); fixed_t v2y = FLOAT_TO_FIXED(wallVerts[1].z); // not a typo
// compiler complains when P_GetZAt is used in FLOAT_TO_FIXED directly // compiler complains when P_GetZAt is used in FLOAT_TO_FIXED directly
// use this as a temp var to store P_GetZAt's return value each time // use this as a temp var to store P_GetZAt's return value each time
fixed_t temp; fixed_t temp;
@ -3722,6 +3722,9 @@ static void HWR_Subsector(size_t num)
while (count--) while (count--)
{ {
#ifdef POLYOBJECTS
if (!line->polyseg) // ignore segs that belong to polyobjects
#endif
HWR_AddLine(line); HWR_AddLine(line);
line++; line++;
} }

View File

@ -244,6 +244,7 @@ FUNCPRINTF void DBG_Printf(const char *lpFmt, ...)
#define pglMaterialfv glMaterialfv #define pglMaterialfv glMaterialfv
/* Raster functions */ /* Raster functions */
#define pglPixelStorei glPixelStorei
#define pglReadPixels glReadPixels #define pglReadPixels glReadPixels
/* Texture mapping */ /* Texture mapping */
@ -262,15 +263,8 @@ FUNCPRINTF void DBG_Printf(const char *lpFmt, ...)
/* texture mapping */ //GL_EXT_copy_texture /* texture mapping */ //GL_EXT_copy_texture
#ifndef KOS_GL_COMPATIBILITY #ifndef KOS_GL_COMPATIBILITY
#define pglCopyTexImage2D glCopyTexImage2D #define pglCopyTexImage2D glCopyTexImage2D
#endif
/* GLU functions */
#define pgluBuild2DMipmaps gluBuild2DMipmaps
#endif
#ifndef MINI_GL_COMPATIBILITY
/* 1.3 functions for multitexturing */
#define pglActiveTexture glActiveTexture
#define pglMultiTexCoord2f glMultiTexCoord2f
#endif
#else //!STATIC_OPENGL #else //!STATIC_OPENGL
/* 1.0 functions */ /* 1.0 functions */
@ -365,6 +359,8 @@ typedef void (APIENTRY * PFNglMaterialfv) (GLint face, GLenum pname, GLfloat *pa
static PFNglMaterialfv pglMaterialfv; static PFNglMaterialfv pglMaterialfv;
/* Raster functions */ /* Raster functions */
typedef void (APIENTRY * PFNglPixelStorei) (GLenum pname, GLint param);
static PFNglPixelStorei pglPixelStorei;
typedef void (APIENTRY * PFNglReadPixels) (GLint x, GLint y, GLsizei width, GLsizei height, GLenum format, GLenum type, GLvoid *pixels); typedef void (APIENTRY * PFNglReadPixels) (GLint x, GLint y, GLsizei width, GLsizei height, GLenum format, GLenum type, GLvoid *pixels);
static PFNglReadPixels pglReadPixels; static PFNglReadPixels pglReadPixels;
@ -391,7 +387,7 @@ static PFNglBindTexture pglBindTexture;
/* texture mapping */ //GL_EXT_copy_texture /* texture mapping */ //GL_EXT_copy_texture
typedef void (APIENTRY * PFNglCopyTexImage2D) (GLenum target, GLint level, GLenum internalformat, GLint x, GLint y, GLsizei width, GLsizei height, GLint border); typedef void (APIENTRY * PFNglCopyTexImage2D) (GLenum target, GLint level, GLenum internalformat, GLint x, GLint y, GLsizei width, GLsizei height, GLint border);
static PFNglCopyTexImage2D pglCopyTexImage2D; static PFNglCopyTexImage2D pglCopyTexImage2D;
#endif
/* GLU functions */ /* GLU functions */
typedef GLint (APIENTRY * PFNgluBuild2DMipmaps) (GLenum target, GLint internalFormat, GLsizei width, GLsizei height, GLenum format, GLenum type, const void *data); typedef GLint (APIENTRY * PFNgluBuild2DMipmaps) (GLenum target, GLint internalFormat, GLsizei width, GLsizei height, GLenum format, GLenum type, const void *data);
static PFNgluBuild2DMipmaps pgluBuild2DMipmaps; static PFNgluBuild2DMipmaps pgluBuild2DMipmaps;
@ -403,7 +399,6 @@ static PFNglActiveTexture pglActiveTexture;
typedef void (APIENTRY *PFNglMultiTexCoord2f) (GLenum, GLfloat, GLfloat); typedef void (APIENTRY *PFNglMultiTexCoord2f) (GLenum, GLfloat, GLfloat);
static PFNglMultiTexCoord2f pglMultiTexCoord2f; static PFNglMultiTexCoord2f pglMultiTexCoord2f;
#endif #endif
#endif
#ifndef MINI_GL_COMPATIBILITY #ifndef MINI_GL_COMPATIBILITY
/* 1.2 Parms */ /* 1.2 Parms */
@ -494,6 +489,7 @@ boolean SetupGLfunc(void)
GETOPENGLFUNC(pglLightModelfv , glLightModelfv) GETOPENGLFUNC(pglLightModelfv , glLightModelfv)
GETOPENGLFUNC(pglMaterialfv , glMaterialfv) GETOPENGLFUNC(pglMaterialfv , glMaterialfv)
GETOPENGLFUNC(pglPixelStorei , glPixelStorei)
GETOPENGLFUNC(pglReadPixels , glReadPixels) GETOPENGLFUNC(pglReadPixels , glReadPixels)
GETOPENGLFUNC(pglTexEnvi , glTexEnvi) GETOPENGLFUNC(pglTexEnvi , glTexEnvi)
@ -519,35 +515,23 @@ boolean SetupGLfunc(void)
// This has to be done after the context is created so the version number can be obtained // This has to be done after the context is created so the version number can be obtained
boolean SetupGLFunc13(void) boolean SetupGLFunc13(void)
{ {
#ifdef MINI_GL_COMPATIBILITY
return false;
#else
const GLubyte *version = pglGetString(GL_VERSION); const GLubyte *version = pglGetString(GL_VERSION);
int glmajor, glminor; int glmajor, glminor;
gl13 = false; gl13 = false;
#ifdef MINI_GL_COMPATIBILITY
return false;
#else
#ifdef STATIC_OPENGL
gl13 = true;
#else
// Parse the GL version // Parse the GL version
if (version != NULL) if (version != NULL)
{ {
if (sscanf((const char*)version, "%d.%d", &glmajor, &glminor) == 2) if (sscanf((const char*)version, "%d.%d", &glmajor, &glminor) == 2)
{ {
// Look, we gotta prepare for the inevitable arrival of GL 2.0 code... // Look, we gotta prepare for the inevitable arrival of GL 2.0 code...
switch (glmajor) if (glmajor == 1 && glminor >= 3)
{ gl13 = true;
case 1: else if (glmajor > 1)
if (glminor == 3) gl13 = true; gl13 = true;
break;
case 2:
case 3:
case 4:
gl13 = true;
default:
break;
}
} }
} }
@ -568,9 +552,6 @@ boolean SetupGLFunc13(void)
} }
else else
DBG_Printf("GL_ARB_multitexture support: disabled\n"); DBG_Printf("GL_ARB_multitexture support: disabled\n");
#undef GETOPENGLFUNC
#endif
return true; return true;
#endif #endif
} }
@ -897,7 +878,9 @@ EXPORT void HWRAPI(ReadRect) (INT32 x, INT32 y, INT32 width, INT32 height,
GLubyte*top = (GLvoid*)dst_data, *bottom = top + dst_stride * (height - 1); GLubyte*top = (GLvoid*)dst_data, *bottom = top + dst_stride * (height - 1);
GLubyte *row = malloc(dst_stride); GLubyte *row = malloc(dst_stride);
if (!row) return; if (!row) return;
pglPixelStorei(GL_PACK_ALIGNMENT, 1);
pglReadPixels(x, y, width, height, GL_RGB, GL_UNSIGNED_BYTE, dst_data); pglReadPixels(x, y, width, height, GL_RGB, GL_UNSIGNED_BYTE, dst_data);
pglPixelStorei(GL_UNPACK_ALIGNMENT, 1);
for(i = 0; i < height/2; i++) for(i = 0; i < height/2; i++)
{ {
memcpy(row, top, dst_stride); memcpy(row, top, dst_stride);
@ -913,7 +896,9 @@ EXPORT void HWRAPI(ReadRect) (INT32 x, INT32 y, INT32 width, INT32 height,
INT32 j; INT32 j;
GLubyte *image = malloc(width*height*3*sizeof (*image)); GLubyte *image = malloc(width*height*3*sizeof (*image));
if (!image) return; if (!image) return;
pglPixelStorei(GL_PACK_ALIGNMENT, 1);
pglReadPixels(x, y, width, height, GL_RGB, GL_UNSIGNED_BYTE, image); pglReadPixels(x, y, width, height, GL_RGB, GL_UNSIGNED_BYTE, image);
pglPixelStorei(GL_UNPACK_ALIGNMENT, 1);
for (i = height-1; i >= 0; i--) for (i = height-1; i >= 0; i--)
{ {
for (j = 0; j < width; j++) for (j = 0; j < width; j++)
@ -1815,13 +1800,11 @@ EXPORT void HWRAPI(SetSpecialState) (hwdspecialstate_t IdState, INT32 Value)
min_filter = GL_NEAREST; min_filter = GL_NEAREST;
#endif #endif
} }
#ifndef STATIC_OPENGL
if (!pgluBuild2DMipmaps) if (!pgluBuild2DMipmaps)
{ {
MipMap = GL_FALSE; MipMap = GL_FALSE;
min_filter = GL_LINEAR; min_filter = GL_LINEAR;
} }
#endif
Flush(); //??? if we want to change filter mode by texture, remove this Flush(); //??? if we want to change filter mode by texture, remove this
break; break;

View File

@ -97,7 +97,7 @@
#include <time.h> #include <time.h>
#ifdef _arch_dreamcast #ifdef _arch_dreamcast
#include "sdl/SRB2DC/dchelp.h" #include "sdl12/SRB2DC/dchelp.h"
#endif #endif
#if (defined (__unix__) && !defined (MSDOS)) || defined(__APPLE__) || defined (UNIXCOMMON) #if (defined (__unix__) && !defined (MSDOS)) || defined(__APPLE__) || defined (UNIXCOMMON)
@ -192,7 +192,7 @@ static UINT8 UPNP_support = TRUE;
#define close closesocket #define close closesocket
#ifdef _WIN32_WCE #ifdef _WIN32_WCE
#include "sdl/SRB2CE/cehelp.h" #include "sdl12/SRB2CE/cehelp.h"
#endif #endif
#endif #endif

View File

@ -391,12 +391,21 @@ static int lib_cvRegisterVar(lua_State *L)
// stack: cvar table, cvar userdata // stack: cvar table, cvar userdata
lua_getfield(L, LUA_REGISTRYINDEX, "CV_Vars"); lua_getfield(L, LUA_REGISTRYINDEX, "CV_Vars");
I_Assert(lua_istable(L, 3)); 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_pushvalue(L, 2);
lua_setfield(L, 3, cvar->name); lua_setfield(L, 3, cvar->name);
lua_pop(L, 1); lua_pop(L, 1);
// actually time to register it to the console now! Finally! // actually time to register it to the console now! Finally!
cvar->flags |= CV_MODIFIED;
CV_RegisterVar(cvar); 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 cvar userdata
return 1; return 1;

View File

@ -568,14 +568,14 @@ static UINT8 ArchiveValue(int TABLESINDEX, int myindex)
{ {
mobjinfo_t *info = *((mobjinfo_t **)lua_touserdata(gL, myindex)); mobjinfo_t *info = *((mobjinfo_t **)lua_touserdata(gL, myindex));
WRITEUINT8(save_p, ARCH_MOBJINFO); WRITEUINT8(save_p, ARCH_MOBJINFO);
WRITEUINT8(save_p, info - mobjinfo); WRITEUINT16(save_p, info - mobjinfo);
break; break;
} }
case ARCH_STATE: case ARCH_STATE:
{ {
state_t *state = *((state_t **)lua_touserdata(gL, myindex)); state_t *state = *((state_t **)lua_touserdata(gL, myindex));
WRITEUINT8(save_p, ARCH_STATE); WRITEUINT8(save_p, ARCH_STATE);
WRITEUINT8(save_p, state - states); WRITEUINT16(save_p, state - states);
break; break;
} }
case ARCH_MOBJ: case ARCH_MOBJ:

View File

@ -16,84 +16,118 @@
#include "lua_script.h" #include "lua_script.h"
#include "lua_libs.h" #include "lua_libs.h"
#define META_ITERATIONSTATE "iteration state"
static const char *const iter_opt[] = { static const char *const iter_opt[] = {
"all", "all",
"mobj", "mobj",
NULL}; NULL};
static const actionf_p1 iter_funcs[] = {
NULL,
(actionf_p1)P_MobjThinker
};
struct iterationState {
actionf_p1 filter;
int next;
};
static int iterationState_gc(lua_State *L)
{
struct iterationState *it = luaL_checkudata(L, -1, META_ITERATIONSTATE);
if (it->next != LUA_REFNIL)
{
luaL_unref(L, LUA_REGISTRYINDEX, it->next);
it->next = LUA_REFNIL;
}
return 0;
}
#define push_thinker(th) {\
if ((th)->function.acp1 == (actionf_p1)P_MobjThinker) \
LUA_PushUserdata(L, (th), META_MOBJ); \
else \
lua_pushlightuserdata(L, (th)); \
}
static int lib_iterateThinkers(lua_State *L) static int lib_iterateThinkers(lua_State *L)
{ {
int state = luaL_checkoption(L, 1, "mobj", iter_opt); thinker_t *th = NULL, *next = NULL;
struct iterationState *it = luaL_checkudata(L, 1, META_ITERATIONSTATE);
thinker_t *th = NULL;
actionf_p1 searchFunc;
const char *searchMeta;
lua_settop(L, 2); lua_settop(L, 2);
lua_remove(L, 1); // remove state now.
switch(state) if (lua_isnil(L, 2))
th = &thinkercap;
else if (lua_isuserdata(L, 2))
{ {
case 0: if (lua_islightuserdata(L, 2))
searchFunc = NULL; th = lua_touserdata(L, 2);
searchMeta = NULL; else
break; {
case 1: th = *(thinker_t **)lua_touserdata(L, -1);
default: if (!th)
searchFunc = (actionf_p1)P_MobjThinker; {
searchMeta = META_MOBJ; if (it->next == LUA_REFNIL)
break; return 0;
lua_rawgeti(L, LUA_REGISTRYINDEX, it->next);
if (lua_islightuserdata(L, -1))
next = lua_touserdata(L, -1);
else
next = *(thinker_t **)lua_touserdata(L, -1);
}
}
} }
if (!lua_isnil(L, 1)) { luaL_unref(L, LUA_REGISTRYINDEX, it->next);
if (lua_islightuserdata(L, 1)) it->next = LUA_REFNIL;
th = (thinker_t *)lua_touserdata(L, 1);
else if (searchMeta)
th = *((thinker_t **)luaL_checkudata(L, 1, searchMeta));
else
th = *((thinker_t **)lua_touserdata(L, 1));
} else
th = &thinkercap;
if (!th) // something got our userdata invalidated! if (th && !next)
return 0; next = th->next;
if (!next)
return luaL_error(L, "next thinker invalidated during iteration");
if (searchFunc == NULL) for (; next != &thinkercap; next = next->next)
{ if (!it->filter || next->function.acp1 == it->filter)
if ((th = th->next) != &thinkercap)
{ {
if (th->function.acp1 == (actionf_p1)P_MobjThinker) push_thinker(next);
LUA_PushUserdata(L, th, META_MOBJ); if (next->next != &thinkercap)
else {
lua_pushlightuserdata(L, th); push_thinker(next->next);
it->next = luaL_ref(L, LUA_REGISTRYINDEX);
}
return 1; return 1;
} }
return 0;
}
for (th = th->next; th != &thinkercap; th = th->next)
{
if (th->function.acp1 != searchFunc)
continue;
LUA_PushUserdata(L, th, searchMeta);
return 1;
}
return 0; return 0;
} }
static int lib_startIterate(lua_State *L) static int lib_startIterate(lua_State *L)
{ {
luaL_checkoption(L, 1, iter_opt[0], iter_opt); struct iterationState *it;
lua_pushcfunction(L, lib_iterateThinkers);
lua_pushvalue(L, 1); lua_pushvalue(L, lua_upvalueindex(1));
it = lua_newuserdata(L, sizeof(struct iterationState));
luaL_getmetatable(L, META_ITERATIONSTATE);
lua_setmetatable(L, -2);
it->filter = iter_funcs[luaL_checkoption(L, 1, "mobj", iter_opt)];
it->next = LUA_REFNIL;
return 2; return 2;
} }
#undef push_thinker
int LUA_ThinkerLib(lua_State *L) int LUA_ThinkerLib(lua_State *L)
{ {
luaL_newmetatable(L, META_ITERATIONSTATE);
lua_pushcfunction(L, iterationState_gc);
lua_setfield(L, -2, "__gc");
lua_pop(L, 1);
lua_createtable(L, 0, 1); lua_createtable(L, 0, 1);
lua_pushcfunction(L, lib_startIterate); lua_pushcfunction(L, lib_iterateThinkers);
lua_pushcclosure(L, lib_startIterate, 1);
lua_setfield(L, -2, "iterate"); lua_setfield(L, -2, "iterate");
lua_setglobal(L, "thinkers"); lua_setglobal(L, "thinkers");
return 0; return 0;

View File

@ -20,9 +20,10 @@
#include <stdlib.h> #include <stdlib.h>
#endif #endif
#ifdef _WIN32_WCE // Was this just for the #define USEASM?
#include "sdl/SRB2CE/cehelp.h" //#ifdef _WIN32_WCE
#endif //#include "sdl12/SRB2CE/cehelp.h"
//#endif
/*! /*!
\brief bits of the fraction \brief bits of the fraction

View File

@ -3027,6 +3027,7 @@ static void M_DrawGenericMenu(void)
W_CachePatchName(currentMenu->menuitems[i].patch, PU_CACHE)); W_CachePatchName(currentMenu->menuitems[i].patch, PU_CACHE));
} }
} }
/* FALLTHRU */
case IT_NOTHING: case IT_NOTHING:
case IT_DYBIGSPACE: case IT_DYBIGSPACE:
y += LINEHEIGHT; y += LINEHEIGHT;
@ -3078,6 +3079,7 @@ static void M_DrawGenericMenu(void)
break; break;
case IT_STRING2: case IT_STRING2:
V_DrawString(x, y, 0, currentMenu->menuitems[i].text); V_DrawString(x, y, 0, currentMenu->menuitems[i].text);
/* FALLTHRU */
case IT_DYLITLSPACE: case IT_DYLITLSPACE:
y += SMALLLINEHEIGHT; y += SMALLLINEHEIGHT;
break; break;
@ -3090,6 +3092,7 @@ static void M_DrawGenericMenu(void)
case IT_TRANSTEXT: case IT_TRANSTEXT:
if (currentMenu->menuitems[i].alphaKey) if (currentMenu->menuitems[i].alphaKey)
y = currentMenu->y+currentMenu->menuitems[i].alphaKey; y = currentMenu->y+currentMenu->menuitems[i].alphaKey;
/* FALLTHRU */
case IT_TRANSTEXT2: case IT_TRANSTEXT2:
V_DrawString(x, y, V_TRANSLUCENT, currentMenu->menuitems[i].text); V_DrawString(x, y, V_TRANSLUCENT, currentMenu->menuitems[i].text);
y += SMALLLINEHEIGHT; y += SMALLLINEHEIGHT;
@ -3302,6 +3305,7 @@ static void M_DrawCenteredMenu(void)
W_CachePatchName(currentMenu->menuitems[i].patch, PU_CACHE)); W_CachePatchName(currentMenu->menuitems[i].patch, PU_CACHE));
} }
} }
/* FALLTHRU */
case IT_NOTHING: case IT_NOTHING:
case IT_DYBIGSPACE: case IT_DYBIGSPACE:
y += LINEHEIGHT; y += LINEHEIGHT;
@ -3352,6 +3356,7 @@ static void M_DrawCenteredMenu(void)
break; break;
case IT_STRING2: case IT_STRING2:
V_DrawCenteredString(x, y, 0, currentMenu->menuitems[i].text); V_DrawCenteredString(x, y, 0, currentMenu->menuitems[i].text);
/* FALLTHRU */
case IT_DYLITLSPACE: case IT_DYLITLSPACE:
y += SMALLLINEHEIGHT; y += SMALLLINEHEIGHT;
break; break;
@ -4625,7 +4630,7 @@ static void M_ReadSavegameInfo(UINT32 slot)
savegameinfo[slot].botskin = 0; savegameinfo[slot].botskin = 0;
if (savegameinfo[slot].botskin) if (savegameinfo[slot].botskin)
snprintf(savegameinfo[slot].playername, 32, "%s & %s", snprintf(savegameinfo[slot].playername, 36, "%s & %s",
skins[savegameinfo[slot].skinnum].realname, skins[savegameinfo[slot].skinnum].realname,
skins[savegameinfo[slot].botskin-1].realname); skins[savegameinfo[slot].botskin-1].realname);
else else

View File

@ -190,7 +190,7 @@ typedef struct
// savegame struct for save game menu // savegame struct for save game menu
typedef struct typedef struct
{ {
char playername[32]; char playername[37];
char levelname[32]; char levelname[32];
UINT8 actnum; UINT8 actnum;
UINT8 skincolor; UINT8 skincolor;

View File

@ -1080,7 +1080,7 @@ void M_StartMovie(void)
moviemode = M_StartMovieGIF(pathname); moviemode = M_StartMovieGIF(pathname);
break; break;
} }
// fall thru /* FALLTHRU */
case MM_APNG: case MM_APNG:
moviemode = M_StartMovieAPNG(pathname); moviemode = M_StartMovieAPNG(pathname);
break; break;

View File

@ -65,7 +65,7 @@
#endif #endif
#ifdef _arch_dreamcast #ifdef _arch_dreamcast
#include "sdl/SRB2DC/dchelp.h" #include "sdl12/SRB2DC/dchelp.h"
#endif #endif
#include <sys/time.h> // timeval,... (TIMEOUT) #include <sys/time.h> // timeval,... (TIMEOUT)
@ -92,7 +92,7 @@
#include "m_misc.h" // GetRevisionString() #include "m_misc.h" // GetRevisionString()
#ifdef _WIN32_WCE #ifdef _WIN32_WCE
#include "sdl/SRB2CE/cehelp.h" #include "sdl12/SRB2CE/cehelp.h"
#endif #endif
#include "i_addrinfo.h" #include "i_addrinfo.h"

View File

@ -79,7 +79,7 @@ void T_MoveCeiling(ceiling_t *ceiling)
P_LinedefExecute((INT16)(ceiling->texture + INT16_MAX + 2), NULL, NULL); P_LinedefExecute((INT16)(ceiling->texture + INT16_MAX + 2), NULL, NULL);
if (ceiling->texture > -1) // flat changing if (ceiling->texture > -1) // flat changing
ceiling->sector->ceilingpic = ceiling->texture; ceiling->sector->ceilingpic = ceiling->texture;
// don't break /* FALLTHRU */
case raiseToHighest: case raiseToHighest:
// case raiseCeilingByLine: // case raiseCeilingByLine:
case moveCeilingByFrontTexture: case moveCeilingByFrontTexture:
@ -182,6 +182,7 @@ void T_MoveCeiling(ceiling_t *ceiling)
// except generalized ones, reset speed, start back up // except generalized ones, reset speed, start back up
case crushAndRaise: case crushAndRaise:
ceiling->speed = CEILSPEED; ceiling->speed = CEILSPEED;
/* FALLTHRU */
case fastCrushAndRaise: case fastCrushAndRaise:
ceiling->direction = 1; ceiling->direction = 1;
break; break;
@ -200,6 +201,7 @@ void T_MoveCeiling(ceiling_t *ceiling)
if (ceiling->texture > -1) // flat changing if (ceiling->texture > -1) // flat changing
ceiling->sector->ceilingpic = ceiling->texture; ceiling->sector->ceilingpic = ceiling->texture;
// don't break // don't break
/* FALLTHRU */
// in all other cases, just remove the active ceiling // in all other cases, just remove the active ceiling
case lowerAndCrush: case lowerAndCrush:
@ -427,6 +429,7 @@ INT32 EV_DoCeiling(line_t *line, ceiling_e type)
case crushAndRaise: case crushAndRaise:
ceiling->crush = true; ceiling->crush = true;
ceiling->topheight = sec->ceilingheight; ceiling->topheight = sec->ceilingheight;
/* FALLTHRU */
case lowerAndCrush: case lowerAndCrush:
ceiling->bottomheight = sec->floorheight; ceiling->bottomheight = sec->floorheight;
ceiling->bottomheight += 4*FRACUNIT; ceiling->bottomheight += 4*FRACUNIT;

View File

@ -4894,9 +4894,11 @@ void A_UnidusBall(mobj_t *actor)
case 0: // at least one frame where not dashing case 0: // at least one frame where not dashing
if (!skull) ++actor->extravalue2; if (!skull) ++actor->extravalue2;
else break; else break;
/* FALLTHRU */
case 1: // at least one frame where ARE dashing case 1: // at least one frame where ARE dashing
if (skull) ++actor->extravalue2; if (skull) ++actor->extravalue2;
else break; else break;
/* FALLTHRU */
case 2: // not dashing again? case 2: // not dashing again?
if (skull) break; if (skull) break;
// launch. // launch.
@ -6251,7 +6253,7 @@ void A_Boss7Chase(mobj_t *actor)
break; break;
} }
actor->threshold++; actor->threshold++;
// fall into... /* FALLTHRU */
case 1: // Chaingun Goop case 1: // Chaingun Goop
A_FaceTarget(actor); A_FaceTarget(actor);
P_SetMobjState(actor, S_BLACKEGG_SHOOT1); P_SetMobjState(actor, S_BLACKEGG_SHOOT1);

View File

@ -313,6 +313,7 @@ void T_MoveFloor(floormove_t *movefloor)
case moveFloorByFrontSector: case moveFloorByFrontSector:
if (movefloor->texture < -1) // chained linedef executing if (movefloor->texture < -1) // chained linedef executing
P_LinedefExecute((INT16)(movefloor->texture + INT16_MAX + 2), NULL, NULL); P_LinedefExecute((INT16)(movefloor->texture + INT16_MAX + 2), NULL, NULL);
/* FALLTHRU */
case instantMoveFloorByFrontSector: case instantMoveFloorByFrontSector:
if (movefloor->texture > -1) // flat changing if (movefloor->texture > -1) // flat changing
movefloor->sector->floorpic = movefloor->texture; movefloor->sector->floorpic = movefloor->texture;
@ -361,6 +362,7 @@ void T_MoveFloor(floormove_t *movefloor)
case moveFloorByFrontSector: case moveFloorByFrontSector:
if (movefloor->texture < -1) // chained linedef executing if (movefloor->texture < -1) // chained linedef executing
P_LinedefExecute((INT16)(movefloor->texture + INT16_MAX + 2), NULL, NULL); P_LinedefExecute((INT16)(movefloor->texture + INT16_MAX + 2), NULL, NULL);
/* FALLTHRU */
case instantMoveFloorByFrontSector: case instantMoveFloorByFrontSector:
if (movefloor->texture > -1) // flat changing if (movefloor->texture > -1) // flat changing
movefloor->sector->floorpic = movefloor->texture; movefloor->sector->floorpic = movefloor->texture;
@ -2035,6 +2037,33 @@ foundenemy:
P_RemoveThinker(&nobaddies->thinker); P_RemoveThinker(&nobaddies->thinker);
} }
//
// P_IsObjectOnRealGround
//
// Helper function for T_EachTimeThinker
// Like P_IsObjectOnGroundIn, except ONLY THE REAL GROUND IS CONSIDERED, NOT FOFS
// I'll consider whether to make this a more globally accessible function or whatever in future
// -- Monster Iestyn
//
static boolean P_IsObjectOnRealGround(mobj_t *mo, sector_t *sec)
{
// Is the object in reverse gravity?
if (mo->eflags & MFE_VERTICALFLIP)
{
// Detect if the player is on the ceiling.
if (mo->z+mo->height >= P_GetSpecialTopZ(mo, sec, sec))
return true;
}
// Nope!
else
{
// Detect if the player is on the floor.
if (mo->z <= P_GetSpecialBottomZ(mo, sec, sec))
return true;
}
return false;
}
// //
// P_HavePlayersEnteredArea // P_HavePlayersEnteredArea
// //
@ -2087,6 +2116,7 @@ void T_EachTimeThinker(levelspecthink_t *eachtime)
boolean inAndOut = false; boolean inAndOut = false;
boolean floortouch = false; boolean floortouch = false;
fixed_t bottomheight, topheight; fixed_t bottomheight, topheight;
msecnode_t *node;
for (i = 0; i < MAXPLAYERS; i++) for (i = 0; i < MAXPLAYERS; i++)
{ {
@ -2148,7 +2178,23 @@ void T_EachTimeThinker(levelspecthink_t *eachtime)
if ((netgame || multiplayer) && players[j].spectator) if ((netgame || multiplayer) && players[j].spectator)
continue; continue;
if (players[j].mo->subsector->sector != targetsec) if (players[j].mo->subsector->sector == targetsec)
;
else if (sec->flags & SF_TRIGGERSPECIAL_TOUCH)
{
boolean insector = false;
for (node = players[j].mo->touching_sectorlist; node; node = node->m_sectorlist_next)
{
if (node->m_sector == targetsec)
{
insector = true;
break;
}
}
if (!insector)
continue;
}
else
continue; continue;
topheight = P_GetSpecialTopZ(players[j].mo, sec, targetsec); topheight = P_GetSpecialTopZ(players[j].mo, sec, targetsec);
@ -2198,10 +2244,30 @@ void T_EachTimeThinker(levelspecthink_t *eachtime)
if ((netgame || multiplayer) && players[i].spectator) if ((netgame || multiplayer) && players[i].spectator)
continue; continue;
if (players[i].mo->subsector->sector != sec) if (players[i].mo->subsector->sector == sec)
;
else if (sec->flags & SF_TRIGGERSPECIAL_TOUCH)
{
boolean insector = false;
for (node = players[i].mo->touching_sectorlist; node; node = node->m_sectorlist_next)
{
if (node->m_sector == sec)
{
insector = true;
break;
}
}
if (!insector)
continue;
}
else
continue; continue;
if (floortouch == true && P_IsObjectOnGroundIn(players[i].mo, sec)) if (!(players[i].mo->subsector->sector == sec
|| P_PlayerTouchingSectorSpecial(&players[i], 2, (GETSECSPECIAL(sec->special, 2))) == sec))
continue;
if (floortouch == true && P_IsObjectOnRealGround(players[i].mo, sec))
{ {
if (i & 1) if (i & 1)
eachtime->var2s[i/2] |= 1; eachtime->var2s[i/2] |= 1;

View File

@ -400,9 +400,11 @@ void P_TouchSpecialThing(mobj_t *special, mobj_t *toucher, boolean heightcheck)
case MT_REDTEAMRING: case MT_REDTEAMRING:
if (player->ctfteam != 1) if (player->ctfteam != 1)
return; return;
/* FALLTHRU */
case MT_BLUETEAMRING: // Yes, I'm lazy. Oh well, deal with it. case MT_BLUETEAMRING: // Yes, I'm lazy. Oh well, deal with it.
if (special->type == MT_BLUETEAMRING && player->ctfteam != 2) if (special->type == MT_BLUETEAMRING && player->ctfteam != 2)
return; return;
/* FALLTHRU */
case MT_RING: case MT_RING:
case MT_FLINGRING: case MT_FLINGRING:
if (!(P_CanPickupItem(player, false))) if (!(P_CanPickupItem(player, false)))
@ -3270,7 +3272,7 @@ boolean P_DamageMobj(mobj_t *target, mobj_t *inflictor, mobj_t *source, INT32 da
P_SetMobjState(target, target->info->meleestate); // go to pinch pain state P_SetMobjState(target, target->info->meleestate); // go to pinch pain state
break; break;
} }
// fallthrough /* FALLTHRU */
default: default:
P_SetMobjState(target, target->info->painstate); P_SetMobjState(target, target->info->painstate);
break; break;

View File

@ -1604,6 +1604,8 @@ static boolean PIT_CheckThing(mobj_t *thing)
if (iwassprung) // this spring caused you to gain MFE_SPRUNG just now... if (iwassprung) // this spring caused you to gain MFE_SPRUNG just now...
return false; // "cancel" P_TryMove via blocking so you keep your current position return false; // "cancel" P_TryMove via blocking so you keep your current position
} }
else if (tmthing->flags & MF_SPRING && (thing->player || thing->flags & MF_PUSHABLE))
; // Fix a few nasty spring-jumping bugs that happen sometimes.
// Monitors are not treated as solid to players who are jumping, spinning or gliding, // Monitors are not treated as solid to players who are jumping, spinning or gliding,
// unless it's a CTF team monitor and you're on the wrong team // unless it's a CTF team monitor and you're on the wrong team
else if (thing->flags & MF_MONITOR && tmthing->player && tmthing->player->pflags & (PF_JUMPED|PF_SPINNING|PF_GLIDING) else if (thing->flags & MF_MONITOR && tmthing->player && tmthing->player->pflags & (PF_JUMPED|PF_SPINNING|PF_GLIDING)
@ -1635,11 +1637,13 @@ static boolean PIT_CheckThing(mobj_t *thing)
topz = thing->z - thing->scale; // FixedMul(FRACUNIT, thing->scale), but thing->scale == FRACUNIT in base scale anyways topz = thing->z - thing->scale; // FixedMul(FRACUNIT, thing->scale), but thing->scale == FRACUNIT in base scale anyways
if (thing->flags & MF_SPRING)
;
// block only when jumping not high enough, // block only when jumping not high enough,
// (dont climb max. 24units while already in air) // (dont climb max. 24units while already in air)
// since return false doesn't handle momentum properly, // since return false doesn't handle momentum properly,
// we lie to P_TryMove() so it's always too high // we lie to P_TryMove() so it's always too high
if (tmthing->player && tmthing->z + tmthing->height > topz else if (tmthing->player && tmthing->z + tmthing->height > topz
&& tmthing->z + tmthing->height < tmthing->ceilingz) && tmthing->z + tmthing->height < tmthing->ceilingz)
{ {
tmfloorz = tmceilingz = topz; // block while in air tmfloorz = tmceilingz = topz; // block while in air
@ -1648,8 +1652,6 @@ static boolean PIT_CheckThing(mobj_t *thing)
#endif #endif
tmfloorthing = thing; // needed for side collision tmfloorthing = thing; // needed for side collision
} }
else if (thing->flags & MF_SPRING)
;
else if (topz < tmceilingz && tmthing->z <= thing->z+thing->height) else if (topz < tmceilingz && tmthing->z <= thing->z+thing->height)
{ {
tmceilingz = topz; tmceilingz = topz;
@ -1678,11 +1680,13 @@ static boolean PIT_CheckThing(mobj_t *thing)
topz = thing->z + thing->height + thing->scale; // FixedMul(FRACUNIT, thing->scale), but thing->scale == FRACUNIT in base scale anyways topz = thing->z + thing->height + thing->scale; // FixedMul(FRACUNIT, thing->scale), but thing->scale == FRACUNIT in base scale anyways
if (thing->flags & MF_SPRING)
;
// block only when jumping not high enough, // block only when jumping not high enough,
// (dont climb max. 24units while already in air) // (dont climb max. 24units while already in air)
// since return false doesn't handle momentum properly, // since return false doesn't handle momentum properly,
// we lie to P_TryMove() so it's always too high // we lie to P_TryMove() so it's always too high
if (tmthing->player && tmthing->z < topz else if (tmthing->player && tmthing->z < topz
&& tmthing->z > tmthing->floorz) && tmthing->z > tmthing->floorz)
{ {
tmfloorz = tmceilingz = topz; // block while in air tmfloorz = tmceilingz = topz; // block while in air
@ -1691,8 +1695,6 @@ static boolean PIT_CheckThing(mobj_t *thing)
#endif #endif
tmfloorthing = thing; // needed for side collision tmfloorthing = thing; // needed for side collision
} }
else if (thing->flags & MF_SPRING)
;
else if (topz > tmfloorz && tmthing->z+tmthing->height >= thing->z) else if (topz > tmfloorz && tmthing->z+tmthing->height >= thing->z)
{ {
tmfloorz = topz; tmfloorz = topz;
@ -4668,6 +4670,11 @@ fixed_t P_FloorzAtPos(fixed_t x, fixed_t y, fixed_t z, fixed_t height)
sector_t *sec = R_PointInSubsector(x, y)->sector; sector_t *sec = R_PointInSubsector(x, y)->sector;
fixed_t floorz = sec->floorheight; fixed_t floorz = sec->floorheight;
#ifdef ESLOPE
if (sec->f_slope)
floorz = P_GetZAt(sec->f_slope, x, y);
#endif
// Intercept the stupid 'fall through 3dfloors' bug Tails 03-17-2002 // Intercept the stupid 'fall through 3dfloors' bug Tails 03-17-2002
if (sec->ffloors) if (sec->ffloors)
{ {

View File

@ -2194,10 +2194,18 @@ boolean P_CheckSolidLava(mobj_t *mo, ffloor_t *rover)
I_Assert(mo != NULL); I_Assert(mo != NULL);
I_Assert(!P_MobjWasRemoved(mo)); I_Assert(!P_MobjWasRemoved(mo));
if (rover->flags & FF_SWIMMABLE && GETSECSPECIAL(rover->master->frontsector->special, 1) == 3 {
&& !(rover->master->flags & ML_BLOCKMONSTERS) fixed_t topheight =
&& ((rover->master->flags & ML_EFFECT3) || mo->z-mo->momz > *rover->topheight - FixedMul(16*FRACUNIT, mo->scale))) #ifdef ESLOPE
return true; *rover->t_slope ? P_GetZAt(*rover->t_slope, mo->x, mo->y) :
#endif
*rover->topheight;
if (rover->flags & FF_SWIMMABLE && GETSECSPECIAL(rover->master->frontsector->special, 1) == 3
&& !(rover->master->flags & ML_BLOCKMONSTERS)
&& ((rover->master->flags & ML_EFFECT3) || mo->z-mo->momz > topheight - FixedMul(16*FRACUNIT, mo->scale)))
return true;
}
return false; return false;
} }
@ -2427,7 +2435,7 @@ static boolean P_ZMovement(mobj_t *mo)
mo->z = mo->floorz; mo->z = mo->floorz;
#ifdef ESLOPE #ifdef ESLOPE
if (mo->standingslope) // You're still on the ground; why are we here? if (!(mo->flags & MF_MISSILE) && mo->standingslope) // You're still on the ground; why are we here?
{ {
mo->momz = 0; mo->momz = 0;
return true; return true;
@ -3178,11 +3186,17 @@ static boolean P_SceneryZMovement(mobj_t *mo)
// //
boolean P_CanRunOnWater(player_t *player, ffloor_t *rover) boolean P_CanRunOnWater(player_t *player, ffloor_t *rover)
{ {
fixed_t topheight =
#ifdef ESLOPE
*rover->t_slope ? P_GetZAt(*rover->t_slope, player->mo->x, player->mo->y) :
#endif
*rover->topheight;
if (!(player->pflags & PF_NIGHTSMODE) && !player->homing if (!(player->pflags & PF_NIGHTSMODE) && !player->homing
&& (((player->charability == CA_SWIM) || player->powers[pw_super] || player->charflags & SF_RUNONWATER) && player->mo->ceilingz-*rover->topheight >= player->mo->height) && (((player->charability == CA_SWIM) || player->powers[pw_super] || player->charflags & SF_RUNONWATER) && player->mo->ceilingz-topheight >= player->mo->height)
&& (rover->flags & FF_SWIMMABLE) && !(player->pflags & PF_SPINNING) && player->speed > FixedMul(player->runspeed, player->mo->scale) && (rover->flags & FF_SWIMMABLE) && !(player->pflags & PF_SPINNING) && player->speed > FixedMul(player->runspeed, player->mo->scale)
&& !(player->pflags & PF_SLIDING) && !(player->pflags & PF_SLIDING)
&& abs(player->mo->z - *rover->topheight) < FixedMul(30*FRACUNIT, player->mo->scale)) && abs(player->mo->z - topheight) < FixedMul(30*FRACUNIT, player->mo->scale))
return true; return true;
return false; return false;
@ -7650,7 +7664,7 @@ void P_MobjThinker(mobj_t *mobj)
mobj->z = mobj->ceilingz - mobj->height; mobj->z = mobj->ceilingz - mobj->height;
else else
mobj->z = mobj->floorz; mobj->z = mobj->floorz;
// THERE IS NO BREAK HERE ON PURPOSE /* FALLTHRU */
default: default:
// check mobj against possible water content, before movement code // check mobj against possible water content, before movement code
P_MobjCheckWater(mobj); P_MobjCheckWater(mobj);
@ -8316,6 +8330,7 @@ mobj_t *P_SpawnMobj(fixed_t x, fixed_t y, fixed_t z, mobjtype_t type)
break; break;
case MT_EGGCAPSULE: case MT_EGGCAPSULE:
mobj->extravalue1 = -1; // timer for how long a player has been at the capsule mobj->extravalue1 = -1; // timer for how long a player has been at the capsule
break;
case MT_REDTEAMRING: case MT_REDTEAMRING:
mobj->color = skincolor_redteam; mobj->color = skincolor_redteam;
break; break;
@ -8821,6 +8836,7 @@ void P_PrecipitationEffects(void)
{ {
case PRECIP_RAIN: // no lightning or thunder whatsoever case PRECIP_RAIN: // no lightning or thunder whatsoever
sounds_thunder = false; sounds_thunder = false;
/* FALLTHRU */
case PRECIP_STORM_NOSTRIKES: // no lightning strikes specifically case PRECIP_STORM_NOSTRIKES: // no lightning strikes specifically
effects_lightning = false; effects_lightning = false;
break; break;

View File

@ -1669,12 +1669,18 @@ static inline void SaveWhatThinker(const thinker_t *th, const UINT8 type)
static void P_NetArchiveThinkers(void) static void P_NetArchiveThinkers(void)
{ {
const thinker_t *th; const thinker_t *th;
UINT32 numsaved = 0;
WRITEUINT32(save_p, ARCHIVEBLOCK_THINKERS); WRITEUINT32(save_p, ARCHIVEBLOCK_THINKERS);
// save off the current thinkers // save off the current thinkers
for (th = thinkercap.next; th != &thinkercap; th = th->next) for (th = thinkercap.next; th != &thinkercap; th = th->next)
{ {
if (!(th->function.acp1 == (actionf_p1)P_RemoveThinkerDelayed
|| th->function.acp1 == (actionf_p1)P_RainThinker
|| th->function.acp1 == (actionf_p1)P_SnowThinker))
numsaved++;
if (th->function.acp1 == (actionf_p1)P_MobjThinker) if (th->function.acp1 == (actionf_p1)P_MobjThinker)
{ {
SaveMobjThinker(th, tc_mobj); SaveMobjThinker(th, tc_mobj);
@ -1862,6 +1868,8 @@ static void P_NetArchiveThinkers(void)
#endif #endif
} }
CONS_Debug(DBG_NETPLAY, "%u thinkers saved\n", numsaved);
WRITEUINT8(save_p, tc_end); WRITEUINT8(save_p, tc_end);
} }
@ -2626,6 +2634,7 @@ static void P_NetUnArchiveThinkers(void)
UINT8 tclass; UINT8 tclass;
UINT8 restoreNum = false; UINT8 restoreNum = false;
UINT32 i; UINT32 i;
UINT32 numloaded = 0;
if (READUINT32(save_p) != ARCHIVEBLOCK_THINKERS) if (READUINT32(save_p) != ARCHIVEBLOCK_THINKERS)
I_Error("Bad $$$.sav at archive block Thinkers"); I_Error("Bad $$$.sav at archive block Thinkers");
@ -2659,6 +2668,7 @@ static void P_NetUnArchiveThinkers(void)
if (tclass == tc_end) if (tclass == tc_end)
break; // leave the saved thinker reading loop break; // leave the saved thinker reading loop
numloaded++;
switch (tclass) switch (tclass)
{ {
@ -2810,6 +2820,8 @@ static void P_NetUnArchiveThinkers(void)
} }
} }
CONS_Debug(DBG_NETPLAY, "%u thinkers loaded\n", numloaded);
if (restoreNum) if (restoreNum)
{ {
executor_t *delay = NULL; executor_t *delay = NULL;

View File

@ -1747,7 +1747,7 @@ boolean P_RunTriggerLinedef(line_t *triggerline, mobj_t *actor, sector_t *caller
case 305: // continuous case 305: // continuous
case 306: // each time case 306: // each time
case 307: // once case 307: // once
if (!(actor && actor->player && actor->player->charability != dist/10)) if (!(actor && actor->player && actor->player->charability == dist/10))
return false; return false;
break; break;
case 309: // continuous case 309: // continuous
@ -2442,73 +2442,81 @@ static void P_ProcessLineSpecial(line_t *line, mobj_t *mo, sector_t *callsec)
case 414: // Play SFX case 414: // Play SFX
{ {
fixed_t sfxnum; INT32 sfxnum;
sfxnum = sides[line->sidenum[0]].toptexture; //P_AproxDistance(line->dx, line->dy)>>FRACBITS; sfxnum = sides[line->sidenum[0]].toptexture; //P_AproxDistance(line->dx, line->dy)>>FRACBITS;
if (line->tag != 0 && line->flags & ML_EFFECT5) if (sfxnum == sfx_None)
return; // Do nothing!
if (sfxnum < sfx_None || sfxnum >= NUMSFX)
{ {
sector_t *sec; CONS_Debug(DBG_GAMELOGIC, "Line type 414 Executor: sfx number %d is invalid!\n", sfxnum);
return;
while ((secnum = P_FindSectorFromLineTag(line, secnum)) >= 0) }
if (line->tag != 0) // Do special stuff only if a non-zero linedef tag is set
{
if (line->flags & ML_EFFECT5) // Repeat Midtexture
{ {
sec = &sectors[secnum]; // Additionally play the sound from tagged sectors' soundorgs
S_StartSound(&sec->soundorg, sfxnum); sector_t *sec;
while ((secnum = P_FindSectorFromLineTag(line, secnum)) >= 0)
{
sec = &sectors[secnum];
S_StartSound(&sec->soundorg, sfxnum);
}
}
else if (mo) // A mobj must have triggered the executor
{
// Only trigger if mobj is touching the tag
ffloor_t *rover;
boolean foundit = false;
for(rover = mo->subsector->sector->ffloors; rover; rover = rover->next)
{
if (rover->master->frontsector->tag != line->tag)
continue;
if (mo->z > P_GetSpecialTopZ(mo, sectors + rover->secnum, mo->subsector->sector))
continue;
if (mo->z + mo->height < P_GetSpecialBottomZ(mo, sectors + rover->secnum, mo->subsector->sector))
continue;
foundit = true;
}
if (mo->subsector->sector->tag == line->tag)
foundit = true;
if (!foundit)
return;
} }
} }
else if (line->tag != 0 && mo)
if (line->flags & ML_NOCLIMB)
{ {
// Only trigger if mobj is touching the tag // play the sound from nowhere, but only if display player triggered it
ffloor_t *rover; if (mo && mo->player && (mo->player == &players[displayplayer] || mo->player == &players[secondarydisplayplayer]))
boolean foundit = false;
for(rover = mo->subsector->sector->ffloors; rover; rover = rover->next)
{
if (rover->master->frontsector->tag != line->tag)
continue;
if (mo->z > P_GetSpecialTopZ(mo, sectors + rover->secnum, mo->subsector->sector))
continue;
if (mo->z + mo->height < P_GetSpecialBottomZ(mo, sectors + rover->secnum, mo->subsector->sector))
continue;
foundit = true;
}
if (mo->subsector->sector->tag == line->tag)
foundit = true;
if (!foundit)
return;
}
if (sfxnum < NUMSFX && sfxnum > sfx_None)
{
if (line->flags & ML_NOCLIMB)
{
// play the sound from nowhere, but only if display player triggered it
if (mo && mo->player && (mo->player == &players[displayplayer] || mo->player == &players[secondarydisplayplayer]))
S_StartSound(NULL, sfxnum);
}
else if (line->flags & ML_EFFECT4)
{
// play the sound from nowhere
S_StartSound(NULL, sfxnum); S_StartSound(NULL, sfxnum);
} }
else if (line->flags & ML_BLOCKMONSTERS) else if (line->flags & ML_EFFECT4)
{ {
// play the sound from calling sector's soundorg // play the sound from nowhere
if (callsec) S_StartSound(NULL, sfxnum);
S_StartSound(&callsec->soundorg, sfxnum); }
else if (mo) else if (line->flags & ML_BLOCKMONSTERS)
S_StartSound(&mo->subsector->sector->soundorg, sfxnum); {
} // play the sound from calling sector's soundorg
if (callsec)
S_StartSound(&callsec->soundorg, sfxnum);
else if (mo) else if (mo)
{ S_StartSound(&mo->subsector->sector->soundorg, sfxnum);
// play the sound from mobj that triggered it }
S_StartSound(mo, sfxnum); else if (mo)
} {
// play the sound from mobj that triggered it
S_StartSound(mo, sfxnum);
} }
} }
break; break;
@ -3481,7 +3489,7 @@ static boolean P_ThingIsOnThe3DFloor(mobj_t *mo, sector_t *sector, sector_t *tar
// //
// Is player standing on the sector's "ground"? // Is player standing on the sector's "ground"?
// //
static inline boolean P_MobjReadyToTrigger(mobj_t *mo, sector_t *sec) static boolean P_MobjReadyToTrigger(mobj_t *mo, sector_t *sec)
{ {
if (mo->eflags & MFE_VERTICALFLIP) if (mo->eflags & MFE_VERTICALFLIP)
return (mo->z+mo->height == P_GetSpecialTopZ(mo, sec, sec) && sec->flags & SF_FLIPSPECIAL_CEILING); return (mo->z+mo->height == P_GetSpecialTopZ(mo, sec, sec) && sec->flags & SF_FLIPSPECIAL_CEILING);
@ -3608,20 +3616,56 @@ void P_ProcessSpecialSector(player_t *player, sector_t *sector, sector_t *rovers
{ {
if (roversector) if (roversector)
{ {
if (players[i].mo->subsector->sector != roversector) if (players[i].mo->subsector->sector == roversector)
;
else if (sector->flags & SF_TRIGGERSPECIAL_TOUCH)
{
boolean insector = false;
msecnode_t *node;
for (node = players[i].mo->touching_sectorlist; node; node = node->m_sectorlist_next)
{
if (node->m_sector == roversector)
{
insector = true;
break;
}
}
if (!insector)
goto DoneSection2;
}
else
goto DoneSection2; goto DoneSection2;
if (!P_ThingIsOnThe3DFloor(players[i].mo, sector, roversector)) if (!P_ThingIsOnThe3DFloor(players[i].mo, sector, roversector))
goto DoneSection2; goto DoneSection2;
} }
else else
{ {
if (players[i].mo->subsector->sector != sector) if (players[i].mo->subsector->sector == sector)
;
else if (sector->flags & SF_TRIGGERSPECIAL_TOUCH)
{
boolean insector = false;
msecnode_t *node;
for (node = players[i].mo->touching_sectorlist; node; node = node->m_sectorlist_next)
{
if (node->m_sector == sector)
{
insector = true;
break;
}
}
if (!insector)
goto DoneSection2;
}
else
goto DoneSection2; goto DoneSection2;
if (special == 3 && !P_MobjReadyToTrigger(players[i].mo, sector)) if (special == 3 && !P_MobjReadyToTrigger(players[i].mo, sector))
goto DoneSection2; goto DoneSection2;
} }
} }
/* FALLTHRU */
case 4: // Linedef executor that doesn't require touching floor case 4: // Linedef executor that doesn't require touching floor
case 5: // Linedef executor case 5: // Linedef executor
case 6: // Linedef executor (7 Emeralds) case 6: // Linedef executor (7 Emeralds)
@ -4407,6 +4451,7 @@ sector_t *P_ThingOnSpecial3DFloor(mobj_t *mo)
{ {
sector_t *sector; sector_t *sector;
ffloor_t *rover; ffloor_t *rover;
fixed_t topheight, bottomheight;
sector = mo->subsector->sector; sector = mo->subsector->sector;
if (!sector->ffloors) if (!sector->ffloors)
@ -4414,8 +4459,6 @@ sector_t *P_ThingOnSpecial3DFloor(mobj_t *mo)
for (rover = sector->ffloors; rover; rover = rover->next) for (rover = sector->ffloors; rover; rover = rover->next)
{ {
fixed_t topheight, bottomheight;
if (!rover->master->frontsector->special) if (!rover->master->frontsector->special)
continue; continue;
@ -4463,6 +4506,8 @@ sector_t *P_ThingOnSpecial3DFloor(mobj_t *mo)
return NULL; return NULL;
} }
#define TELEPORTED (player->mo->subsector->sector != originalsector)
/** Checks if a player is standing on or is inside a 3D floor (e.g. water) and /** Checks if a player is standing on or is inside a 3D floor (e.g. water) and
* applies any specials. * applies any specials.
* *
@ -4471,12 +4516,12 @@ sector_t *P_ThingOnSpecial3DFloor(mobj_t *mo)
*/ */
static void P_PlayerOnSpecial3DFloor(player_t *player, sector_t *sector) static void P_PlayerOnSpecial3DFloor(player_t *player, sector_t *sector)
{ {
sector_t *originalsector = player->mo->subsector->sector;
ffloor_t *rover; ffloor_t *rover;
fixed_t topheight, bottomheight;
for (rover = sector->ffloors; rover; rover = rover->next) for (rover = sector->ffloors; rover; rover = rover->next)
{ {
fixed_t topheight, bottomheight;
if (!rover->master->frontsector->special) if (!rover->master->frontsector->special)
continue; continue;
@ -4520,7 +4565,10 @@ static void P_PlayerOnSpecial3DFloor(player_t *player, sector_t *sector)
// This FOF has the special we're looking for, but are we allowed to touch it? // This FOF has the special we're looking for, but are we allowed to touch it?
if (sector == player->mo->subsector->sector if (sector == player->mo->subsector->sector
|| (rover->master->frontsector->flags & SF_TRIGGERSPECIAL_TOUCH)) || (rover->master->frontsector->flags & SF_TRIGGERSPECIAL_TOUCH))
{
P_ProcessSpecialSector(player, rover->master->frontsector, sector); P_ProcessSpecialSector(player, rover->master->frontsector, sector);
if TELEPORTED return;
}
} }
// Allow sector specials to be applied to polyobjects! // Allow sector specials to be applied to polyobjects!
@ -4531,7 +4579,7 @@ static void P_PlayerOnSpecial3DFloor(player_t *player, sector_t *sector)
boolean touching = false; boolean touching = false;
boolean inside = false; boolean inside = false;
while(po) while (po)
{ {
if (po->flags & POF_NOSPECIALS) if (po->flags & POF_NOSPECIALS)
{ {
@ -4607,6 +4655,7 @@ static void P_PlayerOnSpecial3DFloor(player_t *player, sector_t *sector)
} }
P_ProcessSpecialSector(player, polysec, sector); P_ProcessSpecialSector(player, polysec, sector);
if TELEPORTED return;
po = (polyobj_t *)(po->link.next); po = (polyobj_t *)(po->link.next);
} }
@ -4670,6 +4719,8 @@ static void P_RunSpecialSectorCheck(player_t *player, sector_t *sector)
// requires touching floor. // requires touching floor.
break; break;
} }
/* FALLTHRU */
case 1: // Starpost activator case 1: // Starpost activator
case 5: // Fan sector case 5: // Fan sector
case 6: // Super Sonic Transform case 6: // Super Sonic Transform
@ -4711,40 +4762,43 @@ static void P_RunSpecialSectorCheck(player_t *player, sector_t *sector)
*/ */
void P_PlayerInSpecialSector(player_t *player) void P_PlayerInSpecialSector(player_t *player)
{ {
sector_t *sector; sector_t *originalsector;
sector_t *loopsector;
msecnode_t *node; msecnode_t *node;
if (!player->mo) if (!player->mo)
return; return;
// Do your ->subsector->sector first originalsector = player->mo->subsector->sector;
sector = player->mo->subsector->sector;
P_PlayerOnSpecial3DFloor(player, sector);
// After P_PlayerOnSpecial3DFloor, recheck if the player is in that sector,
// because the player can be teleported in between these times.
if (sector == player->mo->subsector->sector)
P_RunSpecialSectorCheck(player, sector);
// Iterate through touching_sectorlist P_PlayerOnSpecial3DFloor(player, originalsector); // Handle FOFs first.
if TELEPORTED return;
P_RunSpecialSectorCheck(player, originalsector);
if TELEPORTED return;
// Iterate through touching_sectorlist for SF_TRIGGERSPECIAL_TOUCH
for (node = player->mo->touching_sectorlist; node; node = node->m_sectorlist_next) for (node = player->mo->touching_sectorlist; node; node = node->m_sectorlist_next)
{ {
sector = node->m_sector; loopsector = node->m_sector;
if (sector == player->mo->subsector->sector) // Don't duplicate if (loopsector == originalsector) // Don't duplicate
continue; continue;
// Check 3D floors... // Check 3D floors...
P_PlayerOnSpecial3DFloor(player, sector); P_PlayerOnSpecial3DFloor(player, loopsector);
if TELEPORTED return;
if (!(sector->flags & SF_TRIGGERSPECIAL_TOUCH)) if (!(loopsector->flags & SF_TRIGGERSPECIAL_TOUCH))
return; continue;
// After P_PlayerOnSpecial3DFloor, recheck if the player is in that sector,
// because the player can be teleported in between these times. P_RunSpecialSectorCheck(player, loopsector);
if (sector == player->mo->subsector->sector) if TELEPORTED return;
P_RunSpecialSectorCheck(player, sector);
} }
} }
#undef TELEPORTED
/** Animate planes, scroll walls, etc. and keeps track of level timelimit and exits if time is up. /** Animate planes, scroll walls, etc. and keeps track of level timelimit and exits if time is up.
* *
* \sa P_CheckTimeLimit, P_CheckPointLimit * \sa P_CheckTimeLimit, P_CheckPointLimit
@ -5748,6 +5802,8 @@ void P_SpawnSpecials(INT32 fromnetsave)
EV_DoFloor(&lines[i], bounceFloor); EV_DoFloor(&lines[i], bounceFloor);
if (lines[i].special == 54) if (lines[i].special == 54)
break; break;
/* FALLTHRU */
case 55: // New super cool and awesome moving ceiling type case 55: // New super cool and awesome moving ceiling type
if (lines[i].backsector) if (lines[i].backsector)
EV_DoCeiling(&lines[i], bounceCeiling); EV_DoCeiling(&lines[i], bounceCeiling);
@ -5759,7 +5815,8 @@ void P_SpawnSpecials(INT32 fromnetsave)
EV_DoFloor(&lines[i], bounceFloorCrush); EV_DoFloor(&lines[i], bounceFloorCrush);
if (lines[i].special == 57) if (lines[i].special == 57)
break; //only move the floor break; //only move the floor
/* FALLTHRU */
case 58: // New super cool and awesome moving ceiling crush type case 58: // New super cool and awesome moving ceiling crush type
if (lines[i].backsector) if (lines[i].backsector)
@ -6865,6 +6922,7 @@ static void P_SpawnScrollers(void)
Add_Scroller(sc_ceiling, -dx, dy, control, s, accel, l->flags & ML_NOCLIMB); Add_Scroller(sc_ceiling, -dx, dy, control, s, accel, l->flags & ML_NOCLIMB);
if (special != 533) if (special != 533)
break; break;
/* FALLTHRU */
case 523: // carry objects on ceiling case 523: // carry objects on ceiling
dx = FixedMul(dx, CARRYFACTOR); dx = FixedMul(dx, CARRYFACTOR);
@ -6879,6 +6937,7 @@ static void P_SpawnScrollers(void)
Add_Scroller(sc_floor, -dx, dy, control, s, accel, l->flags & ML_NOCLIMB); Add_Scroller(sc_floor, -dx, dy, control, s, accel, l->flags & ML_NOCLIMB);
if (special != 530) if (special != 530)
break; break;
/* FALLTHRU */
case 520: // carry objects on floor case 520: // carry objects on floor
dx = FixedMul(dx, CARRYFACTOR); dx = FixedMul(dx, CARRYFACTOR);

View File

@ -1255,11 +1255,12 @@ boolean P_IsObjectOnGroundIn(mobj_t *mo, sector_t *sec)
if (!(rover->flags & FF_EXISTS)) if (!(rover->flags & FF_EXISTS))
continue; continue;
// If the FOF is configured to let players through, continue. // If the FOF is configured to let the object through, continue.
if (!(rover->flags & FF_BLOCKPLAYER) && (rover->flags & FF_BLOCKOTHERS)) if (!((rover->flags & FF_BLOCKPLAYER && mo->player)
|| (rover->flags & FF_BLOCKOTHERS && !mo->player)))
continue; continue;
// If the the platform is intangile from below, continue. // If the the platform is intangible from below, continue.
if (rover->flags & FF_PLATFORM) if (rover->flags & FF_PLATFORM)
continue; continue;
@ -1288,11 +1289,12 @@ boolean P_IsObjectOnGroundIn(mobj_t *mo, sector_t *sec)
if (!(rover->flags & FF_EXISTS)) if (!(rover->flags & FF_EXISTS))
continue; continue;
// If the FOF is configured to let players through, continue. // If the FOF is configured to let the object through, continue.
if (!(rover->flags & FF_BLOCKPLAYER) && (rover->flags & FF_BLOCKOTHERS)) if (!((rover->flags & FF_BLOCKPLAYER && mo->player)
|| (rover->flags & FF_BLOCKOTHERS && !mo->player)))
continue; continue;
// If the the platform is intangile from above, continue. // If the the platform is intangible from above, continue.
if (rover->flags & FF_REVERSEPLATFORM) if (rover->flags & FF_REVERSEPLATFORM)
continue; continue;
@ -1673,9 +1675,8 @@ void P_DoPlayerExit(player_t *player)
#define SPACESPECIAL 12 #define SPACESPECIAL 12
boolean P_InSpaceSector(mobj_t *mo) // Returns true if you are in space boolean P_InSpaceSector(mobj_t *mo) // Returns true if you are in space
{ {
sector_t *sector; sector_t *sector = mo->subsector->sector;
fixed_t topheight, bottomheight;
sector = mo->subsector->sector;
if (GETSECSPECIAL(sector->special, 1) == SPACESPECIAL) if (GETSECSPECIAL(sector->special, 1) == SPACESPECIAL)
return true; return true;
@ -1688,11 +1689,18 @@ boolean P_InSpaceSector(mobj_t *mo) // Returns true if you are in space
{ {
if (GETSECSPECIAL(rover->master->frontsector->special, 1) != SPACESPECIAL) if (GETSECSPECIAL(rover->master->frontsector->special, 1) != SPACESPECIAL)
continue; continue;
#ifdef ESLOPE
topheight = *rover->t_slope ? P_GetZAt(*rover->t_slope, mo->x, mo->y) : *rover->topheight;
bottomheight = *rover->b_slope ? P_GetZAt(*rover->b_slope, mo->x, mo->y) : *rover->bottomheight;
#else
topheight = *rover->topheight;
bottomheight = *rover->bottomheight;
#endif
if (mo->z > *rover->topheight) if (mo->z + (mo->height/2) > topheight)
continue; continue;
if (mo->z + (mo->height/2) < *rover->bottomheight) if (mo->z + (mo->height/2) < bottomheight)
continue; continue;
return true; return true;
@ -1704,9 +1712,10 @@ boolean P_InSpaceSector(mobj_t *mo) // Returns true if you are in space
boolean P_InQuicksand(mobj_t *mo) // Returns true if you are in quicksand boolean P_InQuicksand(mobj_t *mo) // Returns true if you are in quicksand
{ {
sector_t *sector; sector_t *sector = mo->subsector->sector;
fixed_t topheight, bottomheight;
sector = mo->subsector->sector; fixed_t flipoffset = ((mo->eflags & MFE_VERTICALFLIP) ? (mo->height/2) : 0);
if (sector->ffloors) if (sector->ffloors)
{ {
@ -1720,10 +1729,18 @@ boolean P_InQuicksand(mobj_t *mo) // Returns true if you are in quicksand
if (!(rover->flags & FF_QUICKSAND)) if (!(rover->flags & FF_QUICKSAND))
continue; continue;
if (mo->z > *rover->topheight) #ifdef ESLOPE
topheight = *rover->t_slope ? P_GetZAt(*rover->t_slope, mo->x, mo->y) : *rover->topheight;
bottomheight = *rover->b_slope ? P_GetZAt(*rover->b_slope, mo->x, mo->y) : *rover->bottomheight;
#else
topheight = *rover->topheight;
bottomheight = *rover->bottomheight;
#endif
if (mo->z + flipoffset > topheight)
continue; continue;
if (mo->z + (mo->height/2) < *rover->bottomheight) if (mo->z + (mo->height/2) + flipoffset < bottomheight)
continue; continue;
return true; return true;
@ -2006,6 +2023,7 @@ static void P_CheckQuicksand(player_t *player)
{ {
ffloor_t *rover; ffloor_t *rover;
fixed_t sinkspeed, friction; fixed_t sinkspeed, friction;
fixed_t topheight, bottomheight;
if (!(player->mo->subsector->sector->ffloors && player->mo->momz <= 0)) if (!(player->mo->subsector->sector->ffloors && player->mo->momz <= 0))
return; return;
@ -2017,16 +2035,38 @@ static void P_CheckQuicksand(player_t *player)
if (!(rover->flags & FF_QUICKSAND)) if (!(rover->flags & FF_QUICKSAND))
continue; continue;
if (*rover->topheight >= player->mo->z && *rover->bottomheight < player->mo->z + player->mo->height) #ifdef ESLOPE
topheight = *rover->t_slope ? P_GetZAt(*rover->t_slope, player->mo->x, player->mo->y) : *rover->topheight;
bottomheight = *rover->b_slope ? P_GetZAt(*rover->b_slope, player->mo->x, player->mo->y) : *rover->bottomheight;
#else
topheight = *rover->topheight;
bottomheight = *rover->bottomheight;
#endif
if (topheight >= player->mo->z && bottomheight < player->mo->z + player->mo->height)
{ {
sinkspeed = abs(rover->master->v1->x - rover->master->v2->x)>>1; sinkspeed = abs(rover->master->v1->x - rover->master->v2->x)>>1;
sinkspeed = FixedDiv(sinkspeed,TICRATE*FRACUNIT); sinkspeed = FixedDiv(sinkspeed,TICRATE*FRACUNIT);
player->mo->z -= sinkspeed; if (player->mo->eflags & MFE_VERTICALFLIP)
{
fixed_t ceilingheight = P_GetCeilingZ(player->mo, player->mo->subsector->sector, player->mo->x, player->mo->y, NULL);
if (player->mo->z <= player->mo->subsector->sector->floorheight) player->mo->z += sinkspeed;
player->mo->z = player->mo->subsector->sector->floorheight;
if (player->mo->z + player->mo->height >= ceilingheight)
player->mo->z = ceilingheight - player->mo->height;
}
else
{
fixed_t floorheight = P_GetFloorZ(player->mo, player->mo->subsector->sector, player->mo->x, player->mo->y, NULL);
player->mo->z -= sinkspeed;
if (player->mo->z <= floorheight)
player->mo->z = floorheight;
}
friction = abs(rover->master->v1->y - rover->master->v2->y)>>6; friction = abs(rover->master->v1->y - rover->master->v2->y)>>6;
@ -2389,11 +2429,11 @@ static void P_DoClimbing(player_t *player) // SRB2kart - unused
floorclimb = true; floorclimb = true;
#ifdef ESLOPE #ifdef ESLOPE
bottomheight = *rover->b_slope ? P_GetZAt(*rover->b_slope, player->mo->x, player->mo->y) : *rover->bottomheight;
topheight = *rover->t_slope ? P_GetZAt(*rover->t_slope, player->mo->x, player->mo->y) : *rover->topheight; topheight = *rover->t_slope ? P_GetZAt(*rover->t_slope, player->mo->x, player->mo->y) : *rover->topheight;
bottomheight = *rover->b_slope ? P_GetZAt(*rover->b_slope, player->mo->x, player->mo->y) : *rover->bottomheight;
#else #else
bottomheight = *rover->bottomheight;
topheight = *rover->topheight; topheight = *rover->topheight;
bottomheight = *rover->bottomheight;
#endif #endif
// Only supports rovers that are moving like an 'elevator', not just the top or bottom. // Only supports rovers that are moving like an 'elevator', not just the top or bottom.
@ -2582,13 +2622,20 @@ static void P_DoClimbing(player_t *player) // SRB2kart - unused
// Is there a FOF directly below that we can move onto? // Is there a FOF directly below that we can move onto?
if (glidesector->sector->ffloors) if (glidesector->sector->ffloors)
{ {
fixed_t topheight;
ffloor_t *rover; ffloor_t *rover;
for (rover = glidesector->sector->ffloors; rover; rover = rover->next) for (rover = glidesector->sector->ffloors; rover; rover = rover->next)
{ {
if (!(rover->flags & FF_EXISTS) || !(rover->flags & FF_BLOCKPLAYER) || (rover->flags & FF_BUSTUP)) if (!(rover->flags & FF_EXISTS) || !(rover->flags & FF_BLOCKPLAYER) || (rover->flags & FF_BUSTUP))
continue; continue;
if (*rover->topheight > ceilingheight - FixedMul(16*FRACUNIT, player->mo->scale)) #ifdef ESLOPE
topheight = *rover->t_slope ? P_GetZAt(*rover->t_slope, player->mo->x, player->mo->y) : *rover->topheight;
#else
topheight = *rover->topheight;
#endif
if (topheight > ceilingheight - FixedMul(16*FRACUNIT, player->mo->scale))
{ {
foundfof = true; foundfof = true;
break; break;
@ -2970,14 +3017,12 @@ static void P_DoTeeter(player_t *player) // SRB2kart - unused.
{ {
if (!(rover->flags & FF_EXISTS)) continue; if (!(rover->flags & FF_EXISTS)) continue;
#ifdef ESLOPE
topheight = *rover->t_slope ? P_GetZAt(*rover->t_slope, player->mo->x, player->mo->y) : *rover->topheight;
bottomheight = *rover->b_slope ? P_GetZAt(*rover->b_slope, player->mo->x, player->mo->y) : *rover->bottomheight;
#else
topheight = *rover->topheight; topheight = *rover->topheight;
bottomheight = *rover->bottomheight; bottomheight = *rover->bottomheight;
#ifdef ESLOPE
if (*rover->t_slope)
topheight = P_GetZAt(*rover->t_slope, player->mo->x, player->mo->y);
if (*rover->b_slope)
bottomheight = P_GetZAt(*rover->b_slope, player->mo->x, player->mo->y);
#endif #endif
if (P_CheckSolidLava(player->mo, rover)) if (P_CheckSolidLava(player->mo, rover))
@ -8893,13 +8938,23 @@ static void P_CalcPostImg(player_t *player)
else if (sector->ffloors) else if (sector->ffloors)
{ {
ffloor_t *rover; ffloor_t *rover;
fixed_t topheight;
fixed_t bottomheight;
for (rover = sector->ffloors; rover; rover = rover->next) for (rover = sector->ffloors; rover; rover = rover->next)
{ {
if (!(rover->flags & FF_EXISTS)) if (!(rover->flags & FF_EXISTS))
continue; continue;
if (pviewheight >= *rover->topheight || pviewheight <= *rover->bottomheight) #ifdef ESLOPE
topheight = *rover->t_slope ? P_GetZAt(*rover->t_slope, player->mo->x, player->mo->y) : *rover->topheight;
bottomheight = *rover->b_slope ? P_GetZAt(*rover->b_slope, player->mo->x, player->mo->y) : *rover->bottomheight;
#else
topheight = *rover->topheight;
bottomheight = *rover->bottomheight;
#endif
if (pviewheight >= topheight || pviewheight <= bottomheight)
continue; continue;
if (P_FindSpecialLineFromTag(13, rover->master->frontsector->tag, -1) != -1) if (P_FindSpecialLineFromTag(13, rover->master->frontsector->tag, -1) != -1)
@ -8911,13 +8966,23 @@ static void P_CalcPostImg(player_t *player)
if (sector->ffloors) if (sector->ffloors)
{ {
ffloor_t *rover; ffloor_t *rover;
fixed_t topheight;
fixed_t bottomheight;
for (rover = sector->ffloors; rover; rover = rover->next) for (rover = sector->ffloors; rover; rover = rover->next)
{ {
if (!(rover->flags & FF_EXISTS) || !(rover->flags & FF_SWIMMABLE) || rover->flags & FF_BLOCKPLAYER) if (!(rover->flags & FF_EXISTS) || !(rover->flags & FF_SWIMMABLE) || rover->flags & FF_BLOCKPLAYER)
continue; continue;
if (pviewheight >= *rover->topheight || pviewheight <= *rover->bottomheight) #ifdef ESLOPE
topheight = *rover->t_slope ? P_GetZAt(*rover->t_slope, player->mo->x, player->mo->y) : *rover->topheight;
bottomheight = *rover->b_slope ? P_GetZAt(*rover->b_slope, player->mo->x, player->mo->y) : *rover->bottomheight;
#else
topheight = *rover->topheight;
bottomheight = *rover->bottomheight;
#endif
if (pviewheight >= topheight || pviewheight <= bottomheight)
continue; continue;
*type = postimg_water; *type = postimg_water;
@ -9145,6 +9210,7 @@ void P_PlayerThink(player_t *player)
// check water content, set stuff in mobj // check water content, set stuff in mobj
P_MobjCheckWater(player->mo); P_MobjCheckWater(player->mo);
#ifndef SECTORSPECIALSAFTERTHINK
#ifdef POLYOBJECTS #ifdef POLYOBJECTS
if (player->onconveyor != 1 || !P_IsObjectOnGround(player->mo)) if (player->onconveyor != 1 || !P_IsObjectOnGround(player->mo))
#endif #endif
@ -9153,6 +9219,7 @@ void P_PlayerThink(player_t *player)
if (!player->spectator) if (!player->spectator)
P_PlayerInSpecialSector(player); P_PlayerInSpecialSector(player);
#endif
if (player->playerstate == PST_DEAD) if (player->playerstate == PST_DEAD)
{ {
@ -9529,6 +9596,17 @@ void P_PlayerAfterThink(player_t *player)
cmd = &player->cmd; cmd = &player->cmd;
#ifdef SECTORSPECIALSAFTERTHINK
#ifdef POLYOBJECTS
if (player->onconveyor != 1 || !P_IsObjectOnGround(player->mo))
#endif
player->onconveyor = 0;
// check special sectors : damage & secrets
if (!player->spectator)
P_PlayerInSpecialSector(player);
#endif
if (splitscreen && player == &players[secondarydisplayplayer]) if (splitscreen && player == &players[secondarydisplayplayer])
thiscam = &camera2; thiscam = &camera2;
else if (player == &players[displayplayer]) else if (player == &players[displayplayer])

View File

@ -1222,6 +1222,9 @@ static void R_Subsector(size_t num)
while (count--) while (count--)
{ {
// CONS_Debug(DBG_GAMELOGIC, "Adding normal line %d...(%d)\n", line->linedef-lines, leveltime); // CONS_Debug(DBG_GAMELOGIC, "Adding normal line %d...(%d)\n", line->linedef-lines, leveltime);
#ifdef POLYOBJECTS
if (!line->polyseg) // ignore segs that belong to polyobjects
#endif
R_AddLine(line); R_AddLine(line);
line++; line++;
curline = NULL; /* cph 2001/11/18 - must clear curline now we're done with it, so stuff doesn't try using it for other things */ curline = NULL; /* cph 2001/11/18 - must clear curline now we're done with it, so stuff doesn't try using it for other things */

View File

@ -944,23 +944,24 @@ static void R_InitExtraColormaps(void)
for (cfile = clump = 0; cfile < numwadfiles; cfile++, clump = 0) for (cfile = clump = 0; cfile < numwadfiles; cfile++, clump = 0)
{ {
startnum = W_CheckNumForNamePwad("C_START", cfile, clump); startnum = W_CheckNumForNamePwad("C_START", cfile, clump);
if (startnum == LUMPERROR) if (startnum == INT16_MAX)
continue; continue;
endnum = W_CheckNumForNamePwad("C_END", cfile, clump); endnum = W_CheckNumForNamePwad("C_END", cfile, clump);
if (endnum == LUMPERROR) if (endnum == INT16_MAX)
I_Error("R_InitExtraColormaps: C_START without C_END\n"); I_Error("R_InitExtraColormaps: C_START without C_END\n");
if (WADFILENUM(startnum) != WADFILENUM(endnum)) // This shouldn't be possible when you use the Pwad function, silly
I_Error("R_InitExtraColormaps: C_START and C_END in different wad files!\n"); //if (WADFILENUM(startnum) != WADFILENUM(endnum))
//I_Error("R_InitExtraColormaps: C_START and C_END in different wad files!\n");
if (numcolormaplumps >= maxcolormaplumps) if (numcolormaplumps >= maxcolormaplumps)
maxcolormaplumps *= 2; maxcolormaplumps *= 2;
colormaplumps = Z_Realloc(colormaplumps, colormaplumps = Z_Realloc(colormaplumps,
sizeof (*colormaplumps) * maxcolormaplumps, PU_STATIC, NULL); sizeof (*colormaplumps) * maxcolormaplumps, PU_STATIC, NULL);
colormaplumps[numcolormaplumps].wadfile = WADFILENUM(startnum); colormaplumps[numcolormaplumps].wadfile = cfile;
colormaplumps[numcolormaplumps].firstlump = LUMPNUM(startnum+1); colormaplumps[numcolormaplumps].firstlump = startnum+1;
colormaplumps[numcolormaplumps].numlumps = endnum - (startnum + 1); colormaplumps[numcolormaplumps].numlumps = endnum - (startnum + 1);
numcolormaplumps++; numcolormaplumps++;
} }

View File

@ -65,37 +65,6 @@ ifdef MACOSX
LIBS+=-framework CoreFoundation LIBS+=-framework CoreFoundation
endif endif
#
#here is GP2x (arm-gp2x-linux)
#
ifdef GP2X
PNG_CONFIG?=$(PREFIX)-libpng12-config
ifdef STATIC #need a better setting name
CFLAGS+=-I$(OPEN2X)/include
ifndef NOMIXER
LIBS+=-lvorbisidec
ifdef MIKMOD
LIBS+=-lmikmod
endif
ifdef SMPEGLIB
LIBS+=-lsmpeg
LD=$(CXX)
endif
endif
NONET=1
endif
ifndef ARCHNAME
"error"
endif
NONX86=1
NOHW=1
NOHS=1
NOMD5=1
WFLAGS+=-O0
OPTS+=-DGP2X -ffast-math -mcpu=arm920t
EXENAME?=SRB2GP2X.gpe
endif
ifndef NOHW ifndef NOHW
OPTS+=-I/usr/X11R6/include OPTS+=-I/usr/X11R6/include
LDFLAGS+=-L/usr/X11R6/lib LDFLAGS+=-L/usr/X11R6/lib

View File

@ -14,26 +14,6 @@ ifdef PANDORA
include sdl/SRB2Pandora/Makefile.cfg include sdl/SRB2Pandora/Makefile.cfg
endif #ifdef PANDORA endif #ifdef PANDORA
ifdef DC
include sdl/SRB2DC/Makefile.cfg
endif #ifdef DC
ifdef PS3N
include sdl/SRB2PS3/Makefile.cfg
endif #ifdef PS3N
ifdef PSP
include sdl/SRB2PSP/Makefile.cfg
endif #ifdef PSP
ifdef XBOX
include sdl/SRB2XBOX/Makefile.cfg
endif #ifdef XBOX
ifdef WINCE
include sdl/SRB2CE/Makefile.cfg
endif #ifef WINCE
ifdef CYGWIN32 ifdef CYGWIN32
include sdl/MakeCYG.cfg include sdl/MakeCYG.cfg
endif #ifdef CYGWIN32 endif #ifdef CYGWIN32
@ -150,15 +130,8 @@ endif
endif endif
endif endif
# FIXME: DevkitPPC and ready-compiled SDL Wii require these things to be in a silly order
ifdef WII
include sdl/SRB2WII/Makefile.cfg
endif #ifdef WII
CFLAGS+=$(SDL_CFLAGS) CFLAGS+=$(SDL_CFLAGS)
LIBS:=$(SDL_LDFLAGS) $(LIBS) LIBS:=$(SDL_LDFLAGS) $(LIBS)
ifndef WII
ifdef STATIC ifdef STATIC
LIBS+=$(shell $(SDL_CONFIG) --static-libs) LIBS+=$(shell $(SDL_CONFIG) --static-libs)
endif endif
endif

View File

@ -33,7 +33,6 @@
void ShowEndTxt(void) void ShowEndTxt(void)
{ {
#if !(defined (_WIN32_WCE) || defined (_XBOX) || defined (_arch_dreamcast))
INT32 i; INT32 i;
UINT16 j, att = 0; UINT16 j, att = 0;
INT32 nlflag = 1; INT32 nlflag = 1;
@ -232,5 +231,4 @@ void ShowEndTxt(void)
printf("\n"); printf("\n");
Z_Free(data); Z_Free(data);
#endif
} }

View File

@ -37,14 +37,8 @@
#pragma warning(default : 4214 4244) #pragma warning(default : 4214 4244)
#endif #endif
#if defined (_XBOX) || defined (_arch_dreamcast) || defined(GP2X) #ifndef NOLOADSO
#define NOLOADSO #include "SDL_loadso.h"
#endif
#if SDL_VERSION_ATLEAST(1,2,6) && !defined (NOLOADSO)
#include "SDL_loadso.h" // 1.2.6+
#elif !defined (NOLOADSO)
#define NOLOADSO
#endif #endif
#define _CREATE_DLL_ // necessary for Unix AND Windows #define _CREATE_DLL_ // necessary for Unix AND Windows

View File

@ -26,28 +26,6 @@
#include <unistd.h> #include <unistd.h>
#endif #endif
#ifdef _WII
#include <limits.h>
#include <network.h>
#include <fat.h>
#ifdef REMOTE_DEBUGGING
#include <debug.h>
#endif
static char wiicwd[PATH_MAX] = "sd:/";
static char localip[16] = {0};
static char gateway[16] = {0};
static char netmask[16] = {0};
#endif
#ifdef _PSP
#include <pspmoduleinfo.h>
#include <pspthreadman.h>
PSP_HEAP_SIZE_KB(24*1024);
PSP_MAIN_THREAD_ATTR(PSP_THREAD_ATTR_USER | PSP_THREAD_ATTR_VFPU);
PSP_MAIN_THREAD_NAME("SRB2Kart");
PSP_MAIN_THREAD_STACK_SIZE_KB(256);
#endif
#ifdef HAVE_SDL #ifdef HAVE_SDL
#ifdef HAVE_TTF #ifdef HAVE_TTF
@ -79,23 +57,12 @@ FILE *logstream = NULL;
#endif #endif
#endif #endif
#if defined (_WIN32) && !defined (_XBOX) #if defined (_WIN32)
#include "../win32/win_dbg.h" #include "../win32/win_dbg.h"
typedef BOOL (WINAPI *p_IsDebuggerPresent)(VOID); typedef BOOL (WINAPI *p_IsDebuggerPresent)(VOID);
#endif #endif
#ifdef _arch_dreamcast #if defined (_WIN32)
#include <arch/arch.h>
KOS_INIT_FLAGS(INIT_DEFAULT
//| INIT_NET
//| INIT_MALLOCSTATS
//| INIT_QUIET
//| INIT_OCRAM
//| INIT_NO_DCLOAD
);
#endif
#if defined (_WIN32) && !defined (_XBOX) && !defined (_WIN32_WCE)
static inline VOID MakeCodeWritable(VOID) static inline VOID MakeCodeWritable(VOID)
{ {
#ifdef USEASM // Disable write-protection of code segment #ifdef USEASM // Disable write-protection of code segment
@ -136,13 +103,6 @@ static inline VOID MakeCodeWritable(VOID)
\return int \return int
*/ */
#if defined (_XBOX) && defined (__GNUC__)
void XBoxStartup()
{
const char *logdir = NULL;
myargc = -1;
myargv = NULL;
#else
#ifdef FORCESDLMAIN #ifdef FORCESDLMAIN
int SDL_main(int argc, char **argv) int SDL_main(int argc, char **argv)
#else #else
@ -152,56 +112,19 @@ int main(int argc, char **argv)
const char *logdir = NULL; const char *logdir = NULL;
myargc = argc; myargc = argc;
myargv = argv; /// \todo pull out path to exe from this string myargv = argv; /// \todo pull out path to exe from this string
#endif
#ifdef HAVE_TTF #ifdef HAVE_TTF
#ifdef _PS3 #ifdef _WIN32
// apparently there is a bug in SDL_PSL1GHT which needs this to be set to work around
SDL_setenv("SDL_VIDEODRIVER", "psl1ght", 1);
I_StartupTTF(FONTPOINTSIZE, SDL_INIT_VIDEO, SDL_SWSURFACE|SDL_DOUBLEBUF);
#elif defined(_WIN32)
I_StartupTTF(FONTPOINTSIZE, SDL_INIT_VIDEO|SDL_INIT_AUDIO, SDL_SWSURFACE); I_StartupTTF(FONTPOINTSIZE, SDL_INIT_VIDEO|SDL_INIT_AUDIO, SDL_SWSURFACE);
#else #else
I_StartupTTF(FONTPOINTSIZE, SDL_INIT_VIDEO, SDL_SWSURFACE); I_StartupTTF(FONTPOINTSIZE, SDL_INIT_VIDEO, SDL_SWSURFACE);
#endif #endif
#endif #endif
#ifdef _PS3
// initialise controllers.
//ioPadInit(7);
#endif
// init Wii-specific stuff
#ifdef _WII
// Start network
if_config(localip, netmask, gateway, TRUE);
#ifdef REMOTE_DEBUGGING
#if REMOTE_DEBUGGING == 0
DEBUG_Init(GDBSTUB_DEVICE_TCP, GDBSTUB_DEF_TCPPORT); // Port 2828
#elif REMOTE_DEBUGGING > 2
DEBUG_Init(GDBSTUB_DEVICE_TCP, REMOTE_DEBUGGING); // Custom Port
#elif REMOTE_DEBUGGING < 0
DEBUG_Init(GDBSTUB_DEVICE_USB, GDBSTUB_DEF_CHANNEL); // Slot 1
#else
DEBUG_Init(GDBSTUB_DEVICE_USB, REMOTE_DEBUGGING-1); // Custom Slot
#endif
#endif
// Start FAT filesystem
fatInitDefault();
if (getcwd(wiicwd, PATH_MAX))
I_PutEnv(va("HOME=%ssrb2wii", wiicwd));
#endif
logdir = D_Home(); logdir = D_Home();
#ifdef LOGMESSAGES #ifdef LOGMESSAGES
#if defined(_WIN32_WCE) || defined(GP2X) #ifdef DEFAULTDIR
logstream = fopen(va("%s.log",argv[0]), "wt");
#elif defined (_WII)
logstream = fopen(va("%s/log.txt",logdir), "wt");
#elif defined (DEFAULTDIR)
if (logdir) if (logdir)
logstream = fopen(va("%s/"DEFAULTDIR"/log.txt",logdir), "wt"); logstream = fopen(va("%s/"DEFAULTDIR"/log.txt",logdir), "wt");
else else
@ -211,8 +134,7 @@ int main(int argc, char **argv)
//I_OutputMsg("I_StartupSystem() ...\n"); //I_OutputMsg("I_StartupSystem() ...\n");
I_StartupSystem(); I_StartupSystem();
#if defined (_WIN32) && !defined (_XBOX) #if defined (_WIN32)
#ifndef _WIN32_WCE
{ {
#if 0 // just load the DLL #if 0 // just load the DLL
p_IsDebuggerPresent pfnIsDebuggerPresent = (p_IsDebuggerPresent)GetProcAddress(GetModuleHandleA("kernel32.dll"), "IsDebuggerPresent"); p_IsDebuggerPresent pfnIsDebuggerPresent = (p_IsDebuggerPresent)GetProcAddress(GetModuleHandleA("kernel32.dll"), "IsDebuggerPresent");
@ -226,11 +148,8 @@ int main(int argc, char **argv)
LoadLibraryA("exchndl.dll"); LoadLibraryA("exchndl.dll");
} }
} }
#endif
prevExceptionFilter = SetUnhandledExceptionFilter(RecordExceptionInfo); prevExceptionFilter = SetUnhandledExceptionFilter(RecordExceptionInfo);
#ifndef _WIN32_WCE
MakeCodeWritable(); MakeCodeWritable();
#endif
#endif #endif
// startup SRB2 // startup SRB2
CONS_Printf("Setting up SRB2Kart...\n"); CONS_Printf("Setting up SRB2Kart...\n");

View File

@ -26,19 +26,12 @@
#include "../config.h.in" #include "../config.h.in"
#endif #endif
#ifndef _WIN32_WCE
#include <signal.h> #include <signal.h>
#endif
#ifdef _XBOX #ifdef _WIN32
#include "SRB2XBOX/xboxhelp.h"
#endif
#if defined (_WIN32) && !defined (_XBOX)
#define RPC_NO_WINDOWS_H #define RPC_NO_WINDOWS_H
#include <windows.h> #include <windows.h>
#include "../doomtype.h" #include "../doomtype.h"
#ifndef _WIN32_WCE
typedef BOOL (WINAPI *p_GetDiskFreeSpaceExA)(LPCSTR, PULARGE_INTEGER, PULARGE_INTEGER, PULARGE_INTEGER); typedef BOOL (WINAPI *p_GetDiskFreeSpaceExA)(LPCSTR, PULARGE_INTEGER, PULARGE_INTEGER, PULARGE_INTEGER);
typedef BOOL (WINAPI *p_IsProcessorFeaturePresent) (DWORD); typedef BOOL (WINAPI *p_IsProcessorFeaturePresent) (DWORD);
typedef DWORD (WINAPI *p_timeGetTime) (void); typedef DWORD (WINAPI *p_timeGetTime) (void);
@ -46,7 +39,6 @@ typedef UINT (WINAPI *p_timeEndPeriod) (UINT);
typedef HANDLE (WINAPI *p_OpenFileMappingA) (DWORD, BOOL, LPCSTR); typedef HANDLE (WINAPI *p_OpenFileMappingA) (DWORD, BOOL, LPCSTR);
typedef LPVOID (WINAPI *p_MapViewOfFile) (HANDLE, DWORD, DWORD, DWORD, SIZE_T); typedef LPVOID (WINAPI *p_MapViewOfFile) (HANDLE, DWORD, DWORD, DWORD, SIZE_T);
#endif #endif
#endif
#include <stdio.h> #include <stdio.h>
#include <stdlib.h> #include <stdlib.h>
#include <string.h> #include <string.h>
@ -59,18 +51,10 @@ typedef LPVOID (WINAPI *p_MapViewOfFile) (HANDLE, DWORD, DWORD, DWORD, SIZE_T);
#include <fcntl.h> #include <fcntl.h>
#endif #endif
#ifdef _arch_dreamcast
#include <arch/gdb.h>
#include <arch/timer.h>
#include <conio/conio.h>
#include <dc/pvr.h>
void __set_fpscr(long); // in libgcc / kernel's startup.s?
#else
#include <stdio.h> #include <stdio.h>
#if defined (_WIN32) && !defined (_WIN32_WCE) && !defined (_XBOX) #ifdef _WIN32
#include <conio.h> #include <conio.h>
#endif #endif
#endif
#ifdef _MSC_VER #ifdef _MSC_VER
#pragma warning(disable : 4214 4244) #pragma warning(disable : 4214 4244)
@ -88,15 +72,10 @@ void __set_fpscr(long); // in libgcc / kernel's startup.s?
#pragma warning(default : 4214 4244) #pragma warning(default : 4214 4244)
#endif #endif
#if SDL_VERSION_ATLEAST(1,2,7) && !defined (DC) #include "SDL_cpuinfo.h"
#include "SDL_cpuinfo.h" // 1.2.7 or greater
#define HAVE_SDLCPUINFO #define HAVE_SDLCPUINFO
#endif
#ifdef _PSP #if defined (__unix__) || defined(__APPLE__) || (defined (UNIXCOMMON) && !defined (__HAIKU__))
//#include <pspiofilemgr.h>
#elif !defined(_PS3)
#if defined (__unix__) || defined(__APPLE__) || (defined (UNIXCOMMON) && !defined (_arch_dreamcast) && !defined (__HAIKU__) && !defined (_WII))
#if defined (__linux__) #if defined (__linux__)
#include <sys/vfs.h> #include <sys/vfs.h>
#else #else
@ -111,20 +90,17 @@ void __set_fpscr(long); // in libgcc / kernel's startup.s?
#include <sys/vmmeter.h> #include <sys/vmmeter.h>
#endif #endif
#endif #endif
#endif
#ifndef _PS3 #if defined (__linux__) || (defined (UNIXCOMMON) && !defined (__HAIKU__))
#if defined (__linux__) || (defined (UNIXCOMMON) && !defined (_arch_dreamcast) && !defined (_PSP) && !defined (__HAIKU__) && !defined (_WII))
#ifndef NOTERMIOS #ifndef NOTERMIOS
#include <termios.h> #include <termios.h>
#include <sys/ioctl.h> // ioctl #include <sys/ioctl.h> // ioctl
#define HAVE_TERMIOS #define HAVE_TERMIOS
#endif #endif
#endif #endif
#endif
#ifndef NOMUMBLE #ifndef NOMUMBLE
#if defined (__linux__) && !defined(_PS3) // need -lrt #ifdef __linux__ // need -lrt
#include <sys/mman.h> #include <sys/mman.h>
#ifdef MAP_FAILED #ifdef MAP_FAILED
#define HAVE_SHM #define HAVE_SHM
@ -132,7 +108,7 @@ void __set_fpscr(long); // in libgcc / kernel's startup.s?
#include <wchar.h> #include <wchar.h>
#endif #endif
#if defined (_WIN32) && !defined (_WIN32_WCE) && !defined (_XBOX) #ifdef _WIN32
#define HAVE_MUMBLE #define HAVE_MUMBLE
#define WINMUMBLE #define WINMUMBLE
#elif defined (HAVE_SHM) #elif defined (HAVE_SHM)
@ -140,10 +116,6 @@ void __set_fpscr(long); // in libgcc / kernel's startup.s?
#endif #endif
#endif // NOMUMBLE #endif // NOMUMBLE
#ifdef _WIN32_WCE
#include "SRB2CE/cehelp.h"
#endif
#ifndef O_BINARY #ifndef O_BINARY
#define O_BINARY 0 #define O_BINARY 0
#endif #endif
@ -153,44 +125,7 @@ void __set_fpscr(long); // in libgcc / kernel's startup.s?
#endif #endif
// Locations for searching the srb2.srb // Locations for searching the srb2.srb
#ifdef _arch_dreamcast #if defined (__unix__) || defined(__APPLE__) || defined (UNIXCOMMON)
#define DEFAULTWADLOCATION1 "/cd"
#define DEFAULTWADLOCATION2 "/pc"
#define DEFAULTWADLOCATION3 "/pc/home/alam/srb2code/data"
#define DEFAULTSEARCHPATH1 "/cd"
#define DEFAULTSEARCHPATH2 "/pc"
//#define DEFAULTSEARCHPATH3 "/pc/home/alam/srb2code/data"
#elif defined (GP2X)
#define DEFAULTWADLOCATION1 "/mnt/sd"
#define DEFAULTWADLOCATION2 "/mnt/sd/SRB2"
#define DEFAULTWADLOCATION3 "/tmp/mnt/sd"
#define DEFAULTWADLOCATION4 "/tmp/mnt/sd/SRB2"
#define DEFAULTSEARCHPATH1 "/mnt/sd"
#define DEFAULTSEARCHPATH2 "/tmp/mnt/sd"
#elif defined (_WII)
#define NOCWD
#define NOHOME
#define NEED_SDL_GETENV
#define DEFAULTWADLOCATION1 "sd:/srb2wii"
#define DEFAULTWADLOCATION2 "usb:/srb2wii"
#define DEFAULTSEARCHPATH1 "sd:/srb2wii"
#define DEFAULTSEARCHPATH2 "usb:/srb2wii"
// PS3: TODO: this will need modification most likely
#elif defined (_PS3)
#define NOCWD
#define NOHOME
#define DEFAULTWADLOCATION1 "/dev_hdd0/game/SRB2-PS3_/USRDIR/etc"
#define DEFAULTWADLOCATION2 "/dev_usb/SRB2PS3"
#define DEFAULTSEARCHPATH1 "/dev_hdd0/game/SRB2-PS3_/USRDIR/etc"
#define DEFAULTSEARCHPATH2 "/dev_usb/SRB2PS3"
#elif defined (_PSP)
#define NOCWD
#define NOHOME
#define DEFAULTWADLOCATION1 "host0:/bin/Resources"
#define DEFAULTWADLOCATION2 "ms0:/PSP/GAME/SRB2PSP"
#define DEFAULTSEARCHPATH1 "host0:/"
#define DEFAULTSEARCHPATH2 "ms0:/PSP/GAME/SRB2PSP"
#elif defined (__unix__) || defined(__APPLE__) || defined (UNIXCOMMON)
#define DEFAULTWADLOCATION1 "/usr/local/share/games/SRB2" #define DEFAULTWADLOCATION1 "/usr/local/share/games/SRB2"
#define DEFAULTWADLOCATION2 "/usr/local/games/SRB2" #define DEFAULTWADLOCATION2 "/usr/local/games/SRB2"
#define DEFAULTWADLOCATION3 "/usr/share/games/SRB2" #define DEFAULTWADLOCATION3 "/usr/share/games/SRB2"
@ -198,23 +133,6 @@ void __set_fpscr(long); // in libgcc / kernel's startup.s?
#define DEFAULTSEARCHPATH1 "/usr/local/games" #define DEFAULTSEARCHPATH1 "/usr/local/games"
#define DEFAULTSEARCHPATH2 "/usr/games" #define DEFAULTSEARCHPATH2 "/usr/games"
#define DEFAULTSEARCHPATH3 "/usr/local" #define DEFAULTSEARCHPATH3 "/usr/local"
#elif defined (_XBOX)
#define NOCWD
#ifdef __GNUC__
#include <openxdk/debug.h>
#endif
#define DEFAULTWADLOCATION1 "c:\\srb2"
#define DEFAULTWADLOCATION2 "d:\\srb2"
#define DEFAULTWADLOCATION3 "e:\\srb2"
#define DEFAULTWADLOCATION4 "f:\\srb2"
#define DEFAULTWADLOCATION5 "g:\\srb2"
#define DEFAULTWADLOCATION6 "h:\\srb2"
#define DEFAULTWADLOCATION7 "i:\\srb2"
#elif defined (_WIN32_WCE)
#define NOCWD
#define NOHOME
#define DEFAULTWADLOCATION1 "\\Storage Card\\SRB2DEMO"
#define DEFAULTSEARCHPATH1 "\\Storage Card"
#elif defined (_WIN32) #elif defined (_WIN32)
#define DEFAULTWADLOCATION1 "c:\\games\\srb2" #define DEFAULTWADLOCATION1 "c:\\games\\srb2"
#define DEFAULTWADLOCATION2 "\\games\\srb2" #define DEFAULTWADLOCATION2 "\\games\\srb2"
@ -270,9 +188,6 @@ static void JoyReset(SDLJoyInfo_t *JoySet)
{ {
if (JoySet->dev) if (JoySet->dev)
{ {
#ifdef GP2X //GP2X's SDL does an illegal free on the 1st joystick...
if (SDL_JoystickIndex(JoySet->dev) != 0)
#endif
SDL_JoystickClose(JoySet->dev); SDL_JoystickClose(JoySet->dev);
} }
JoySet->dev = NULL; JoySet->dev = NULL;
@ -308,7 +223,6 @@ SDL_bool framebuffer = SDL_FALSE;
UINT8 keyboard_started = false; UINT8 keyboard_started = false;
#if !defined (DC)
FUNCNORETURN static ATTRNORETURN void signal_handler(INT32 num) FUNCNORETURN static ATTRNORETURN void signal_handler(INT32 num)
{ {
//static char msg[] = "oh no! back to reality!\r\n"; //static char msg[] = "oh no! back to reality!\r\n";
@ -362,7 +276,6 @@ FUNCNORETURN static ATTRNORETURN void quit_handler(int num)
raise(num); raise(num);
I_Quit(); I_Quit();
} }
#endif
#ifdef HAVE_TERMIOS #ifdef HAVE_TERMIOS
// TERMIOS console code from Quake3: thank you! // TERMIOS console code from Quake3: thank you!
@ -487,9 +400,7 @@ static void I_StartupConsole(void)
signal(SIGTTIN, SIG_IGN); signal(SIGTTIN, SIG_IGN);
signal(SIGTTOU, SIG_IGN); signal(SIGTTOU, SIG_IGN);
#if !defined(GP2X) //read is bad on GP2X
consolevent = !M_CheckParm("-noconsole"); consolevent = !M_CheckParm("-noconsole");
#endif
framebuffer = M_CheckParm("-framebuffer"); framebuffer = M_CheckParm("-framebuffer");
if (framebuffer) if (framebuffer)
@ -577,7 +488,7 @@ void I_GetConsoleEvents(void)
(void)d; (void)d;
} }
#elif defined (_WIN32) && !(defined (_XBOX) || defined (_WIN32_WCE)) #elif defined (_WIN32)
static BOOL I_ReadyConsole(HANDLE ci) static BOOL I_ReadyConsole(HANDLE ci)
{ {
DWORD gotinput; DWORD gotinput;
@ -590,70 +501,78 @@ static BOOL I_ReadyConsole(HANDLE ci)
static boolean entering_con_command = false; static boolean entering_con_command = false;
static void Impl_HandleKeyboardConsoleEvent(KEY_EVENT_RECORD evt, HANDLE co)
{
event_t event;
CONSOLE_SCREEN_BUFFER_INFO CSBI;
DWORD t;
memset(&event,0x00,sizeof (event));
if (evt.bKeyDown)
{
event.type = ev_console;
entering_con_command = true;
switch (evt.wVirtualKeyCode)
{
case VK_ESCAPE:
case VK_TAB:
event.data1 = KEY_NULL;
break;
case VK_SHIFT:
event.data1 = KEY_LSHIFT;
break;
case VK_RETURN:
entering_con_command = false;
// Fall through.
default:
event.data1 = MapVirtualKey(evt.wVirtualKeyCode,2); // convert in to char
}
if (co != INVALID_HANDLE_VALUE && GetFileType(co) == FILE_TYPE_CHAR && GetConsoleMode(co, &t))
{
if (event.data1 && event.data1 != KEY_LSHIFT && event.data1 != KEY_RSHIFT)
{
#ifdef _UNICODE
WriteConsole(co, &evt.uChar.UnicodeChar, 1, &t, NULL);
#else
WriteConsole(co, &evt.uChar.AsciiChar, 1 , &t, NULL);
#endif
}
if (evt.wVirtualKeyCode == VK_BACK
&& GetConsoleScreenBufferInfo(co,&CSBI))
{
WriteConsoleOutputCharacterA(co, " ",1, CSBI.dwCursorPosition, &t);
}
}
}
else
{
event.type = ev_keyup;
switch (evt.wVirtualKeyCode)
{
case VK_SHIFT:
event.data1 = KEY_LSHIFT;
break;
default:
break;
}
}
if (event.data1) D_PostEvent(&event);
}
void I_GetConsoleEvents(void) void I_GetConsoleEvents(void)
{ {
event_t ev = {0,0,0,0};
HANDLE ci = GetStdHandle(STD_INPUT_HANDLE); HANDLE ci = GetStdHandle(STD_INPUT_HANDLE);
HANDLE co = GetStdHandle(STD_OUTPUT_HANDLE); HANDLE co = GetStdHandle(STD_OUTPUT_HANDLE);
CONSOLE_SCREEN_BUFFER_INFO CSBI;
INPUT_RECORD input; INPUT_RECORD input;
DWORD t; DWORD t;
while (I_ReadyConsole(ci) && ReadConsoleInput(ci, &input, 1, &t) && t) while (I_ReadyConsole(ci) && ReadConsoleInput(ci, &input, 1, &t) && t)
{ {
memset(&ev,0x00,sizeof (ev));
switch (input.EventType) switch (input.EventType)
{ {
case KEY_EVENT: case KEY_EVENT:
if (input.Event.KeyEvent.bKeyDown) Impl_HandleKeyboardConsoleEvent(input.Event.KeyEvent, co);
{
ev.type = ev_console;
entering_con_command = true;
switch (input.Event.KeyEvent.wVirtualKeyCode)
{
case VK_ESCAPE:
case VK_TAB:
ev.data1 = KEY_NULL;
break;
case VK_SHIFT:
ev.data1 = KEY_LSHIFT;
break;
case VK_RETURN:
entering_con_command = false;
// Fall through.
default:
ev.data1 = MapVirtualKey(input.Event.KeyEvent.wVirtualKeyCode,2); // convert in to char
}
if (co != INVALID_HANDLE_VALUE && GetFileType(co) == FILE_TYPE_CHAR && GetConsoleMode(co, &t))
{
if (ev.data1 && ev.data1 != KEY_LSHIFT && ev.data1 != KEY_RSHIFT)
{
#ifdef _UNICODE
WriteConsole(co, &input.Event.KeyEvent.uChar.UnicodeChar, 1, &t, NULL);
#else
WriteConsole(co, &input.Event.KeyEvent.uChar.AsciiChar, 1 , &t, NULL);
#endif
}
if (input.Event.KeyEvent.wVirtualKeyCode == VK_BACK
&& GetConsoleScreenBufferInfo(co,&CSBI))
{
WriteConsoleOutputCharacterA(co, " ",1, CSBI.dwCursorPosition, &t);
}
}
}
else
{
ev.type = ev_keyup;
switch (input.Event.KeyEvent.wVirtualKeyCode)
{
case VK_SHIFT:
ev.data1 = KEY_LSHIFT;
break;
default:
break;
}
}
if (ev.data1) D_PostEvent(&ev);
break; break;
case MOUSE_EVENT: case MOUSE_EVENT:
case WINDOW_BUFFER_SIZE_EVENT: case WINDOW_BUFFER_SIZE_EVENT:
@ -708,17 +627,6 @@ static inline void I_ShutdownConsole(void){}
void I_GetConsoleEvents(void){} void I_GetConsoleEvents(void){}
static inline void I_StartupConsole(void) static inline void I_StartupConsole(void)
{ {
#ifdef _arch_dreamcast
char title[] = "SRB2 for Dreamcast!\n";
__set_fpscr(0x00040000); /* ignore FPU underflow */
//printf("\nHello world!\n\n");
pvr_init_defaults();
conio_init(CONIO_TTY_PVR, CONIO_INPUT_LINE);
conio_set_theme(CONIO_THEME_MATRIX);
conio_clear();
conio_putstr(title);
//printf("\nHello world!\n\n");
#endif
#ifdef _DEBUG #ifdef _DEBUG
consolevent = !M_CheckParm("-noconsole"); consolevent = !M_CheckParm("-noconsole");
#else #else
@ -738,7 +646,6 @@ static inline void I_ShutdownConsole(void){}
// //
void I_StartupKeyboard (void) void I_StartupKeyboard (void)
{ {
#if !defined (DC)
#ifdef SIGINT #ifdef SIGINT
signal(SIGINT , quit_handler); signal(SIGINT , quit_handler);
#endif #endif
@ -755,7 +662,6 @@ void I_StartupKeyboard (void)
signal(SIGSEGV , signal_handler); signal(SIGSEGV , signal_handler);
signal(SIGABRT , signal_handler); signal(SIGABRT , signal_handler);
signal(SIGFPE , signal_handler); signal(SIGFPE , signal_handler);
#endif
} }
// //
@ -767,10 +673,6 @@ void I_OutputMsg(const char *fmt, ...)
XBOXSTATIC char txt[8192]; XBOXSTATIC char txt[8192];
va_list argptr; va_list argptr;
#ifdef _arch_dreamcast
if (!keyboard_started) conio_printf(fmt);
#endif
va_start(argptr,fmt); va_start(argptr,fmt);
vsprintf(txt, fmt, argptr); vsprintf(txt, fmt, argptr);
va_end(argptr); va_end(argptr);
@ -780,7 +682,7 @@ void I_OutputMsg(const char *fmt, ...)
DEFAULTFONTBGR, DEFAULTFONTBGG, DEFAULTFONTBGB, DEFAULTFONTBGA, txt); DEFAULTFONTBGR, DEFAULTFONTBGG, DEFAULTFONTBGB, DEFAULTFONTBGA, txt);
#endif #endif
#if defined (_WIN32) && !defined (_XBOX) && defined (_MSC_VER) #if defined (_WIN32) && defined (_MSC_VER)
OutputDebugStringA(txt); OutputDebugStringA(txt);
#endif #endif
@ -795,7 +697,7 @@ void I_OutputMsg(const char *fmt, ...)
} }
#endif #endif
#if defined (_WIN32) && !defined (_XBOX) && !defined(_WIN32_WCE) #if defined (_WIN32)
#ifdef DEBUGFILE #ifdef DEBUGFILE
if (debugfile != stderr) if (debugfile != stderr)
#endif #endif
@ -909,22 +811,12 @@ INT32 I_GetKey (void)
// //
void I_JoyScale(void) void I_JoyScale(void)
{ {
#ifdef GP2X
if (JoyInfo.dev && SDL_JoystickIndex(JoyInfo.dev) == 0)
Joystick.bGamepadStyle = true;
else
#endif
Joystick.bGamepadStyle = cv_joyscale.value==0; Joystick.bGamepadStyle = cv_joyscale.value==0;
JoyInfo.scale = Joystick.bGamepadStyle?1:cv_joyscale.value; JoyInfo.scale = Joystick.bGamepadStyle?1:cv_joyscale.value;
} }
void I_JoyScale2(void) void I_JoyScale2(void)
{ {
#ifdef GP2X
if (JoyInfo2.dev && SDL_JoystickIndex(JoyInfo2.dev) == 0)
Joystick.bGamepadStyle = true;
else
#endif
Joystick2.bGamepadStyle = cv_joyscale2.value==0; Joystick2.bGamepadStyle = cv_joyscale2.value==0;
JoyInfo2.scale = Joystick2.bGamepadStyle?1:cv_joyscale2.value; JoyInfo2.scale = Joystick2.bGamepadStyle?1:cv_joyscale2.value;
} }
@ -1027,11 +919,6 @@ void I_GetJoystickEvents(void)
event.type = ev_keydown; event.type = ev_keydown;
else else
event.type = ev_keyup; event.type = ev_keyup;
#ifdef _PSP
if (i == 12)
event.data1 = KEY_ESCAPE;
else
#endif
event.data1 = KEY_JOY1 + i; event.data1 = KEY_JOY1 + i;
D_PostEvent(&event); D_PostEvent(&event);
} }
@ -1082,13 +969,11 @@ void I_GetJoystickEvents(void)
axisy = SDL_JoystickGetAxis(JoyInfo.dev, i*2 + 1); axisy = SDL_JoystickGetAxis(JoyInfo.dev, i*2 + 1);
else axisy = 0; else axisy = 0;
#ifdef _arch_dreamcast // -128 to 127
axisx = axisx*8; // -32768 to 32767
axisy = axisy*8;
#else // -32768 to 32767
axisx = axisx/32; axisx = axisx/32;
axisy = axisy/32; axisy = axisy/32;
#endif
if (Joystick.bGamepadStyle) if (Joystick.bGamepadStyle)
{ {
@ -1206,15 +1091,11 @@ static int joy_open(const char *fname)
if (JoyInfo.buttons > JOYBUTTONS) if (JoyInfo.buttons > JOYBUTTONS)
JoyInfo.buttons = JOYBUTTONS; JoyInfo.buttons = JOYBUTTONS;
#ifdef DC
JoyInfo.hats = 0;
#else
JoyInfo.hats = SDL_JoystickNumHats(JoyInfo.dev); JoyInfo.hats = SDL_JoystickNumHats(JoyInfo.dev);
if (JoyInfo.hats > JOYHATS) if (JoyInfo.hats > JOYHATS)
JoyInfo.hats = JOYHATS; JoyInfo.hats = JOYHATS;
JoyInfo.balls = SDL_JoystickNumBalls(JoyInfo.dev); JoyInfo.balls = SDL_JoystickNumBalls(JoyInfo.dev);
#endif
//Joystick.bGamepadStyle = !stricmp(SDL_JoystickName(JoyInfo.dev), "pad"); //Joystick.bGamepadStyle = !stricmp(SDL_JoystickName(JoyInfo.dev), "pad");
@ -1371,13 +1252,9 @@ void I_GetJoystick2Events(void)
axisy = SDL_JoystickGetAxis(JoyInfo2.dev, i*2 + 1); axisy = SDL_JoystickGetAxis(JoyInfo2.dev, i*2 + 1);
else axisy = 0; else axisy = 0;
#ifdef _arch_dreamcast // -128 to 127 // -32768 to 32767
axisx = axisx*8;
axisy = axisy*8;
#else // -32768 to 32767
axisx = axisx/32; axisx = axisx/32;
axisy = axisy/32; axisy = axisy/32;
#endif
if (Joystick2.bGamepadStyle) if (Joystick2.bGamepadStyle)
{ {
@ -1496,15 +1373,11 @@ static int joy_open2(const char *fname)
if (JoyInfo2.buttons > JOYBUTTONS) if (JoyInfo2.buttons > JOYBUTTONS)
JoyInfo2.buttons = JOYBUTTONS; JoyInfo2.buttons = JOYBUTTONS;
#ifdef DC
JoyInfo2.hats = 0;
#else
JoyInfo2.hats = SDL_JoystickNumHats(JoyInfo2.dev); JoyInfo2.hats = SDL_JoystickNumHats(JoyInfo2.dev);
if (JoyInfo2.hats > JOYHATS) if (JoyInfo2.hats > JOYHATS)
JoyInfo2.hats = JOYHATS; JoyInfo2.hats = JOYHATS;
JoyInfo2.balls = SDL_JoystickNumBalls(JoyInfo2.dev); JoyInfo2.balls = SDL_JoystickNumBalls(JoyInfo2.dev);
#endif
//Joystick.bGamepadStyle = !stricmp(SDL_JoystickName(JoyInfo2.dev), "pad"); //Joystick.bGamepadStyle = !stricmp(SDL_JoystickName(JoyInfo2.dev), "pad");
@ -1788,7 +1661,7 @@ static void I_ShutdownMouse2(void)
if (fdmouse2 != -1) close(fdmouse2); if (fdmouse2 != -1) close(fdmouse2);
mouse2_started = 0; mouse2_started = 0;
} }
#elif defined (_WIN32) && !defined (_XBOX) #elif defined (_WIN32)
static HANDLE mouse2filehandle = INVALID_HANDLE_VALUE; static HANDLE mouse2filehandle = INVALID_HANDLE_VALUE;
@ -1986,7 +1859,7 @@ void I_StartupMouse2(void)
} }
mouse2_started = 1; mouse2_started = 1;
I_AddExitFunc(I_ShutdownMouse2); I_AddExitFunc(I_ShutdownMouse2);
#elif defined (_WIN32) && !defined (_XBOX) #elif defined (_WIN32)
DCB dcb; DCB dcb;
if (mouse2filehandle != INVALID_HANDLE_VALUE) if (mouse2filehandle != INVALID_HANDLE_VALUE)
@ -2081,7 +1954,7 @@ FUNCMATH ticcmd_t *I_BaseTiccmd2(void)
return &emptycmd2; return &emptycmd2;
} }
#if (defined (_WIN32) && !defined (_WIN32_WCE)) && !defined (_XBOX) #if defined (_WIN32)
static HMODULE winmm = NULL; static HMODULE winmm = NULL;
static DWORD starttickcount = 0; // hack for win2k time bug static DWORD starttickcount = 0; // hack for win2k time bug
static p_timeGetTime pfntimeGetTime = NULL; static p_timeGetTime pfntimeGetTime = NULL;
@ -2151,13 +2024,8 @@ static void I_ShutdownTimer(void)
// //
tic_t I_GetTime (void) tic_t I_GetTime (void)
{ {
#ifdef _arch_dreamcast
static Uint64 basetime = 0;
Uint64 ticks = timer_ms_gettime64(); //using timer_ms_gettime64 instand of SDL_GetTicks for the Dreamcast
#else
static Uint32 basetime = 0; static Uint32 basetime = 0;
Uint32 ticks = SDL_GetTicks(); Uint32 ticks = SDL_GetTicks();
#endif
if (!basetime) if (!basetime)
basetime = ticks; basetime = ticks;
@ -2166,11 +2034,7 @@ tic_t I_GetTime (void)
ticks = (ticks*TICRATE); ticks = (ticks*TICRATE);
#if 0 //#ifdef _WIN32_WCE
ticks = (ticks/10);
#else
ticks = (ticks/1000); ticks = (ticks/1000);
#endif
return (tic_t)ticks; return (tic_t)ticks;
} }
@ -2181,7 +2045,7 @@ tic_t I_GetTime (void)
// //
FUNCMATH void I_StartupTimer(void) FUNCMATH void I_StartupTimer(void)
{ {
#if (defined (_WIN32) && !defined (_WIN32_WCE)) && !defined (_XBOX) #ifdef _WIN32
// for win2k time bug // for win2k time bug
if (M_CheckParm("-gettickcount")) if (M_CheckParm("-gettickcount"))
{ {
@ -2197,9 +2061,6 @@ FUNCMATH void I_StartupTimer(void)
pfntimeGetTime = (p_timeGetTime)GetProcAddress(winmm, "timeGetTime"); pfntimeGetTime = (p_timeGetTime)GetProcAddress(winmm, "timeGetTime");
} }
I_AddExitFunc(I_ShutdownTimer); I_AddExitFunc(I_ShutdownTimer);
#elif 0 //#elif !defined (_arch_dreamcast) && !defined(GP2X) // the DC have it own timer and GP2X have broken pthreads?
if (SDL_InitSubSystem(SDL_INIT_TIMER) < 0)
I_Error("SRB2: Needs SDL_Timer, Error: %s", SDL_GetError());
#endif #endif
} }
@ -2207,35 +2068,14 @@ FUNCMATH void I_StartupTimer(void)
void I_Sleep(void) void I_Sleep(void)
{ {
#if !(defined (_arch_dreamcast) || defined (_XBOX))
if (cv_sleep.value != -1) if (cv_sleep.value != -1)
SDL_Delay(cv_sleep.value); SDL_Delay(cv_sleep.value);
#endif
} }
INT32 I_StartupSystem(void) INT32 I_StartupSystem(void)
{ {
SDL_version SDLcompiled; SDL_version SDLcompiled;
SDL_version SDLlinked; SDL_version SDLlinked;
#ifdef _XBOX
#ifdef __GNUC__
char DP[] =" Sonic Robo Blast 2!\n";
debugPrint(DP);
#endif
unlink("e:/Games/SRB2/stdout.txt");
freopen("e:/Games/SRB2/stdout.txt", "w+", stdout);
unlink("e:/Games/SRB2/stderr.txt");
freopen("e:/Games/SRB2/stderr.txt", "w+", stderr);
#endif
#ifdef _arch_dreamcast
#ifdef _DEBUG
//gdb_init();
#endif
printf(__FILE__":%i\n",__LINE__);
#ifdef _DEBUG
//gdb_breakpoint();
#endif
#endif
SDL_VERSION(&SDLcompiled) SDL_VERSION(&SDLcompiled)
SDL_GetVersion(&SDLlinked); SDL_GetVersion(&SDLlinked);
I_StartupConsole(); I_StartupConsole();
@ -2243,11 +2083,7 @@ INT32 I_StartupSystem(void)
SDLcompiled.major, SDLcompiled.minor, SDLcompiled.patch); SDLcompiled.major, SDLcompiled.minor, SDLcompiled.patch);
I_OutputMsg("Linked with SDL version: %d.%d.%d\n", I_OutputMsg("Linked with SDL version: %d.%d.%d\n",
SDLlinked.major, SDLlinked.minor, SDLlinked.patch); SDLlinked.major, SDLlinked.minor, SDLlinked.patch);
#if 0 //#ifdef GP2X //start up everything if (SDL_Init(0) < 0)
if (SDL_Init(SDL_INIT_NOPARACHUTE|SDL_INIT_EVERYTHING) < 0)
#else
if (SDL_Init(SDL_INIT_NOPARACHUTE) < 0)
#endif
I_Error("SRB2: SDL System Error: %s", SDL_GetError()); //Alam: Oh no.... I_Error("SRB2: SDL System Error: %s", SDL_GetError()); //Alam: Oh no....
#ifndef NOMUMBLE #ifndef NOMUMBLE
I_SetupMumble(); I_SetupMumble();
@ -2289,9 +2125,7 @@ void I_Quit(void)
I_ShutdownGraphics(); I_ShutdownGraphics();
I_ShutdownInput(); I_ShutdownInput();
I_ShutdownSystem(); I_ShutdownSystem();
#ifndef _arch_dreamcast
SDL_Quit(); SDL_Quit();
#endif
/* if option -noendtxt is set, don't print the text */ /* if option -noendtxt is set, don't print the text */
if (!M_CheckParm("-noendtxt") && W_CheckNumForName("ENDOOM") != LUMPERROR) if (!M_CheckParm("-noendtxt") && W_CheckNumForName("ENDOOM") != LUMPERROR)
{ {
@ -2300,10 +2134,6 @@ void I_Quit(void)
} }
death: death:
W_Shutdown(); W_Shutdown();
#ifdef GP2X
chdir("/usr/gp2x");
execl("/usr/gp2x/gp2xmenu", "/usr/gp2x/gp2xmenu", NULL);
#endif
exit(0); exit(0);
} }
@ -2356,10 +2186,8 @@ void I_Error(const char *error, ...)
I_ShutdownInput(); I_ShutdownInput();
if (errorcount == 7) if (errorcount == 7)
I_ShutdownSystem(); I_ShutdownSystem();
#ifndef _arch_dreamcast
if (errorcount == 8) if (errorcount == 8)
SDL_Quit(); SDL_Quit();
#endif
if (errorcount == 9) if (errorcount == 9)
{ {
M_SaveConfig(NULL); M_SaveConfig(NULL);
@ -2378,12 +2206,6 @@ void I_Error(const char *error, ...)
buffer, NULL); buffer, NULL);
W_Shutdown(); W_Shutdown();
#ifdef GP2X
chdir("/usr/gp2x");
execl("/usr/gp2x/gp2xmenu", "/usr/gp2x/gp2xmenu", NULL);
#endif
exit(-1); // recursive errors detected exit(-1); // recursive errors detected
} }
} }
@ -2419,9 +2241,7 @@ void I_Error(const char *error, ...)
I_ShutdownGraphics(); I_ShutdownGraphics();
I_ShutdownInput(); I_ShutdownInput();
I_ShutdownSystem(); I_ShutdownSystem();
#ifndef _arch_dreamcast
SDL_Quit(); SDL_Quit();
#endif
// Implement message box with SDL_ShowSimpleMessageBox, // Implement message box with SDL_ShowSimpleMessageBox,
// which should fail gracefully if it can't put a message box up // which should fail gracefully if it can't put a message box up
@ -2441,11 +2261,6 @@ void I_Error(const char *error, ...)
*(INT32 *)2 = 4; //Alam: Debug! *(INT32 *)2 = 4; //Alam: Debug!
#endif #endif
#ifdef GP2X
chdir("/usr/gp2x");
execl("/usr/gp2x/gp2xmenu", "/usr/gp2x/gp2xmenu", NULL);
#endif
exit(-1); exit(-1);
} }
@ -2508,7 +2323,7 @@ void I_ShutdownSystem(void)
for (c = MAX_QUIT_FUNCS-1; c >= 0; c--) for (c = MAX_QUIT_FUNCS-1; c >= 0; c--)
if (quit_funcs[c]) if (quit_funcs[c])
(*quit_funcs[c])(); (*quit_funcs[c])();
#ifdef LOGMESSAGES #ifdef LOGMESSAGES
if (logstream) if (logstream)
{ {
I_OutputMsg("I_ShutdownSystem(): end of logstream.\n"); I_OutputMsg("I_ShutdownSystem(): end of logstream.\n");
@ -2521,10 +2336,8 @@ void I_ShutdownSystem(void)
void I_GetDiskFreeSpace(INT64 *freespace) void I_GetDiskFreeSpace(INT64 *freespace)
{ {
#if defined (_arch_dreamcast) || defined (_PSP) #if defined (__unix__) || defined(__APPLE__) || defined (UNIXCOMMON)
*freespace = 0; #if defined (SOLARIS) || defined (__HAIKU__)
#elif defined (__unix__) || defined(__APPLE__) || defined (UNIXCOMMON)
#if defined (SOLARIS) || defined (__HAIKU__) || defined (_WII) || defined (_PS3)
*freespace = INT32_MAX; *freespace = INT32_MAX;
return; return;
#else // Both Linux and BSD have this, apparently. #else // Both Linux and BSD have this, apparently.
@ -2536,7 +2349,7 @@ void I_GetDiskFreeSpace(INT64 *freespace)
} }
*freespace = stfs.f_bavail * stfs.f_bsize; *freespace = stfs.f_bavail * stfs.f_bsize;
#endif #endif
#elif (defined (_WIN32) && !defined (_WIN32_WCE)) && !defined (_XBOX) #elif defined (_WIN32)
static p_GetDiskFreeSpaceExA pfnGetDiskFreeSpaceEx = NULL; static p_GetDiskFreeSpaceExA pfnGetDiskFreeSpaceEx = NULL;
static boolean testwin95 = false; static boolean testwin95 = false;
ULARGE_INTEGER usedbytes, lfreespace; ULARGE_INTEGER usedbytes, lfreespace;
@ -2567,13 +2380,6 @@ void I_GetDiskFreeSpace(INT64 *freespace)
char *I_GetUserName(void) char *I_GetUserName(void)
{ {
#ifdef GP2X
static char username[MAXPLAYERNAME] = "GP2XUSER";
return username;
#elif defined (PSP)
static char username[MAXPLAYERNAME] = "PSPUSER";
return username;
#elif !(defined (_WIN32_WCE) || defined (_XBOX))
static char username[MAXPLAYERNAME]; static char username[MAXPLAYERNAME];
char *p; char *p;
#ifdef _WIN32 #ifdef _WIN32
@ -2605,7 +2411,6 @@ char *I_GetUserName(void)
if (strcmp(username, "") != 0) if (strcmp(username, "") != 0)
return username; return username;
#endif
return NULL; // dummy for platform independent version return NULL; // dummy for platform independent version
} }
@ -2614,7 +2419,7 @@ INT32 I_mkdir(const char *dirname, INT32 unixright)
//[segabor] //[segabor]
#if defined (__unix__) || defined(__APPLE__) || defined (UNIXCOMMON) || defined (__CYGWIN__) || defined (__OS2__) #if defined (__unix__) || defined(__APPLE__) || defined (UNIXCOMMON) || defined (__CYGWIN__) || defined (__OS2__)
return mkdir(dirname, unixright); return mkdir(dirname, unixright);
#elif (defined (_WIN32) || (defined (_WIN32_WCE) && !defined (__GNUC__))) && !defined (_XBOX) #elif defined (_WIN32)
UNREFERENCED_PARAMETER(unixright); /// \todo should implement ntright under nt... UNREFERENCED_PARAMETER(unixright); /// \todo should implement ntright under nt...
return CreateDirectoryA(dirname, NULL); return CreateDirectoryA(dirname, NULL);
#else #else
@ -2628,9 +2433,6 @@ char *I_GetEnv(const char *name)
{ {
#ifdef NEED_SDL_GETENV #ifdef NEED_SDL_GETENV
return SDL_getenv(name); return SDL_getenv(name);
#elif defined(_WIN32_WCE)
(void)name;
return NULL;
#else #else
return getenv(name); return getenv(name);
#endif #endif
@ -2640,8 +2442,6 @@ INT32 I_PutEnv(char *variable)
{ {
#ifdef NEED_SDL_GETENV #ifdef NEED_SDL_GETENV
return SDL_putenv(variable); return SDL_putenv(variable);
#elif defined(_WIN32_WCE)
return ((variable)?-1:0);
#else #else
return putenv(variable); return putenv(variable);
#endif #endif
@ -2781,15 +2581,6 @@ static const char *locateWad(void)
if (((envstr = I_GetEnv("SRB2WADDIR")) != NULL) && isWadPathOk(envstr)) if (((envstr = I_GetEnv("SRB2WADDIR")) != NULL) && isWadPathOk(envstr))
return envstr; return envstr;
#if defined(_WIN32_WCE) || defined(_PS3) || defined(_PSP)
// examine argv[0]
strcpy(returnWadPath, myargv[0]);
pathonly(returnWadPath);
I_PutEnv(va("HOME=%s",returnWadPath));
if (isWadPathOk(returnWadPath))
return returnWadPath;
#endif
#ifndef NOCWD #ifndef NOCWD
I_OutputMsg(",."); I_OutputMsg(",.");
// examine current dir // examine current dir
@ -2908,9 +2699,9 @@ const char *I_LocateWad(void)
if (waddir) if (waddir)
{ {
// change to the directory where we found srb2.srb // change to the directory where we found srb2.srb
#if (defined (_WIN32) && !defined (_WIN32_WCE)) && !defined (_XBOX) #if defined (_WIN32)
SetCurrentDirectoryA(waddir); SetCurrentDirectoryA(waddir);
#elif !defined (_WIN32_WCE) && !defined (_PS3) #else
if (chdir(waddir) == -1) if (chdir(waddir) == -1)
I_OutputMsg("Couldn't change working directory\n"); I_OutputMsg("Couldn't change working directory\n");
#endif #endif
@ -2927,17 +2718,7 @@ const char *I_LocateWad(void)
// quick fix for compil // quick fix for compil
UINT32 I_GetFreeMem(UINT32 *total) UINT32 I_GetFreeMem(UINT32 *total)
{ {
#if defined (_arch_dreamcast) #ifdef FREEBSD
//Dreamcast!
if (total)
*total = 16<<20;
return 8<<20;
#elif defined (_PSP)
// PSP
if (total)
*total = 32<<20;
return 16<<20;
#elif defined (FREEBSD)
struct vmmeter sum; struct vmmeter sum;
kvm_t *kd; kvm_t *kd;
struct nlist namelist[] = struct nlist namelist[] =
@ -2974,7 +2755,7 @@ UINT32 I_GetFreeMem(UINT32 *total)
if (total) if (total)
*total = 32 << 20; *total = 32 << 20;
return 32 << 20; return 32 << 20;
#elif (defined (_WIN32) || (defined (_WIN32_WCE) && !defined (__GNUC__))) && !defined (_XBOX) #elif defined (_WIN32)
MEMORYSTATUS info; MEMORYSTATUS info;
info.dwLength = sizeof (MEMORYSTATUS); info.dwLength = sizeof (MEMORYSTATUS);
@ -3046,7 +2827,7 @@ UINT32 I_GetFreeMem(UINT32 *total)
const CPUInfoFlags *I_CPUInfo(void) const CPUInfoFlags *I_CPUInfo(void)
{ {
#if (defined (_WIN32) && !defined (_WIN32_WCE)) && !defined (_XBOX) #if defined (_WIN32)
static CPUInfoFlags WIN_CPUInfo; static CPUInfoFlags WIN_CPUInfo;
SYSTEM_INFO SI; SYSTEM_INFO SI;
p_IsProcessorFeaturePresent pfnCPUID = (p_IsProcessorFeaturePresent)GetProcAddress(GetModuleHandleA("kernel32.dll"), "IsProcessorFeaturePresent"); p_IsProcessorFeaturePresent pfnCPUID = (p_IsProcessorFeaturePresent)GetProcAddress(GetModuleHandleA("kernel32.dll"), "IsProcessorFeaturePresent");

View File

@ -26,10 +26,7 @@
#include "i_ttf.h" #include "i_ttf.h"
// Search directories to find aforementioned TTF file. // Search directories to find aforementioned TTF file.
#ifdef _PS3 #if defined (__unix__) || defined(__APPLE__) || defined (UNIXCOMMON)
#include <sysutil/video.h>
#define FONTSEARCHPATH1 "/dev_hdd0/game/SRB2-PS3_/USRDIR/etc"
#elif defined (__unix__) || defined(__APPLE__) || defined (UNIXCOMMON)
#define FONTSEARCHPATH1 "/usr/share/fonts" #define FONTSEARCHPATH1 "/usr/share/fonts"
#define FONTSEARCHPATH2 "/usr/local/share/fonts" #define FONTSEARCHPATH2 "/usr/local/share/fonts"
#define FONTSEARCHPATH3 "/usr/games/SRB2" #define FONTSEARCHPATH3 "/usr/games/SRB2"
@ -233,16 +230,9 @@ void I_StartupTTF(UINT32 fontpointsize, Uint32 initflags, Uint32 vidmodeflags)
{ {
char *fontpath = NULL; char *fontpath = NULL;
INT32 fontstatus = -1; INT32 fontstatus = -1;
#ifdef _PS3
videoState state;
videoGetState(0, 0, &state);
videoGetResolution(state.displayMode.resolution, &res);
bitsperpixel = 24;
#else
res.width = 320; res.width = 320;
res.height = 200; res.height = 200;
bitsperpixel = 8; bitsperpixel = 8;
#endif
// what's the point of trying to display an error? // what's the point of trying to display an error?
// SDL_ttf is not started, can't display anything to screen (presumably)... // SDL_ttf is not started, can't display anything to screen (presumably)...

View File

@ -57,13 +57,12 @@ int currentfonthinting;
int currentfontoutline; int currentfontoutline;
#endif #endif
#ifndef _PS3
typedef struct typedef struct
{ {
UINT16 width; UINT16 width;
UINT16 height; UINT16 height;
} VideoResolution; } VideoResolution;
#endif
UINT8 bitsperpixel; UINT8 bitsperpixel;
typedef enum typedef enum

View File

@ -47,7 +47,7 @@
#include "../doomdef.h" #include "../doomdef.h"
#if defined (_WIN32) #ifdef _WIN32
#include "SDL_syswm.h" #include "SDL_syswm.h"
#endif #endif
@ -107,6 +107,9 @@ static SDL_bool disable_mouse = SDL_FALSE;
// first entry in the modelist which is not bigger than MAXVIDWIDTHxMAXVIDHEIGHT // first entry in the modelist which is not bigger than MAXVIDWIDTHxMAXVIDHEIGHT
static INT32 firstEntry = 0; static INT32 firstEntry = 0;
// Total mouse motion X/Y offsets
static INT32 mousemovex = 0, mousemovey = 0;
// SDL vars // SDL vars
static SDL_Surface *vidSurface = NULL; static SDL_Surface *vidSurface = NULL;
static SDL_Surface *bufSurface = NULL; static SDL_Surface *bufSurface = NULL;
@ -119,7 +122,8 @@ static Uint8 BitsPerPixel = 16;
Uint16 realwidth = BASEVIDWIDTH; Uint16 realwidth = BASEVIDWIDTH;
Uint16 realheight = BASEVIDHEIGHT; Uint16 realheight = BASEVIDHEIGHT;
static SDL_bool mousegrabok = SDL_TRUE; static SDL_bool mousegrabok = SDL_TRUE;
#define HalfWarpMouse(x,y) SDL_WarpMouseInWindow(window, (Uint16)(x/2),(Uint16)(y/2)) static SDL_bool wrapmouseok = SDL_FALSE;
#define HalfWarpMouse(x,y) if (wrapmouseok) SDL_WarpMouseInWindow(window, (Uint16)(x/2),(Uint16)(y/2))
static SDL_bool videoblitok = SDL_FALSE; static SDL_bool videoblitok = SDL_FALSE;
static SDL_bool exposevideo = SDL_FALSE; static SDL_bool exposevideo = SDL_FALSE;
static SDL_bool usesdl2soft = SDL_FALSE; static SDL_bool usesdl2soft = SDL_FALSE;
@ -158,7 +162,7 @@ static INT32 windowedModes[MAXWINMODES][2] =
static void Impl_VideoSetupSDLBuffer(void); static void Impl_VideoSetupSDLBuffer(void);
static void Impl_VideoSetupBuffer(void); static void Impl_VideoSetupBuffer(void);
static SDL_bool Impl_CreateWindow(SDL_bool fullscreen); static SDL_bool Impl_CreateWindow(SDL_bool fullscreen);
static void Impl_SetWindowName(const char *title); //static void Impl_SetWindowName(const char *title);
static void Impl_SetWindowIcon(void); static void Impl_SetWindowIcon(void);
static void SDLSetMode(INT32 width, INT32 height, SDL_bool fullscreen) static void SDLSetMode(INT32 width, INT32 height, SDL_bool fullscreen)
@ -181,15 +185,13 @@ static void SDLSetMode(INT32 width, INT32 height, SDL_bool fullscreen)
wasfullscreen = SDL_TRUE; wasfullscreen = SDL_TRUE;
SDL_SetWindowFullscreen(window, SDL_WINDOW_FULLSCREEN_DESKTOP); SDL_SetWindowFullscreen(window, SDL_WINDOW_FULLSCREEN_DESKTOP);
} }
else if (wasfullscreen) else // windowed mode
{
wasfullscreen = SDL_FALSE;
SDL_SetWindowFullscreen(window, 0);
SDL_SetWindowSize(window, width, height);
SDL_SetWindowPosition(window, SDL_WINDOWPOS_CENTERED_DISPLAY(1), SDL_WINDOWPOS_CENTERED_DISPLAY(1));
}
else
{ {
if (wasfullscreen)
{
wasfullscreen = SDL_FALSE;
SDL_SetWindowFullscreen(window, 0);
}
// Reposition window only in windowed mode // Reposition window only in windowed mode
SDL_SetWindowSize(window, width, height); SDL_SetWindowSize(window, width, height);
SDL_SetWindowPosition(window, SDL_WINDOWPOS_CENTERED_DISPLAY(1), SDL_WINDOWPOS_CENTERED_DISPLAY(1)); SDL_SetWindowPosition(window, SDL_WINDOWPOS_CENTERED_DISPLAY(1), SDL_WINDOWPOS_CENTERED_DISPLAY(1));
@ -350,6 +352,8 @@ static INT32 Impl_SDL_Scancode_To_Keycode(SDL_Scancode code)
static void SDLdoUngrabMouse(void) static void SDLdoUngrabMouse(void)
{ {
SDL_SetWindowGrab(window, SDL_FALSE); SDL_SetWindowGrab(window, SDL_FALSE);
wrapmouseok = SDL_FALSE;
SDL_SetRelativeMouseMode(SDL_FALSE);
} }
void SDLforceUngrabMouse(void) void SDLforceUngrabMouse(void)
@ -357,6 +361,8 @@ void SDLforceUngrabMouse(void)
if (SDL_WasInit(SDL_INIT_VIDEO)==SDL_INIT_VIDEO && window != NULL) if (SDL_WasInit(SDL_INIT_VIDEO)==SDL_INIT_VIDEO && window != NULL)
{ {
SDL_SetWindowGrab(window, SDL_FALSE); SDL_SetWindowGrab(window, SDL_FALSE);
wrapmouseok = SDL_FALSE;
SDL_SetRelativeMouseMode(SDL_FALSE);
} }
} }
@ -605,36 +611,43 @@ static void Impl_HandleKeyboardEvent(SDL_KeyboardEvent evt, Uint32 type)
static void Impl_HandleMouseMotionEvent(SDL_MouseMotionEvent evt) static void Impl_HandleMouseMotionEvent(SDL_MouseMotionEvent evt)
{ {
event_t event;
int wwidth, wheight;
if (USE_MOUSEINPUT) if (USE_MOUSEINPUT)
{ {
SDL_GetWindowSize(window, &wwidth, &wheight);
if ((SDL_GetMouseFocus() != window && SDL_GetKeyboardFocus() != window)) if ((SDL_GetMouseFocus() != window && SDL_GetKeyboardFocus() != window))
{ {
SDLdoUngrabMouse(); SDLdoUngrabMouse();
return; return;
} }
// If using relative mouse mode, don't post an event_t just now,
// add on the offsets so we can make an overall event later.
if (SDL_GetRelativeMouseMode())
{
if (SDL_GetMouseFocus() == window && SDL_GetKeyboardFocus() == window)
{
mousemovex += evt.xrel;
mousemovey += -evt.yrel;
SDL_SetWindowGrab(window, SDL_TRUE);
}
return;
}
// If the event is from warping the pointer to middle
// of the screen then ignore it.
if ((evt.x == realwidth/2) && (evt.y == realheight/2)) if ((evt.x == realwidth/2) && (evt.y == realheight/2))
{ {
return; return;
} }
else
{
event.data2 = (INT32)lround((evt.xrel) * ((float)wwidth / (float)realwidth));
event.data3 = (INT32)lround(-evt.yrel * ((float)wheight / (float)realheight));
}
event.type = ev_mouse;
// Don't send an event_t if not in relative mouse mode anymore,
// just grab and set relative mode
// this fixes the stupid camera jerk on mouse entering bug
// -- Monster Iestyn
if (SDL_GetMouseFocus() == window && SDL_GetKeyboardFocus() == window) if (SDL_GetMouseFocus() == window && SDL_GetKeyboardFocus() == window)
{ {
D_PostEvent(&event);
SDL_SetWindowGrab(window, SDL_TRUE); SDL_SetWindowGrab(window, SDL_TRUE);
HalfWarpMouse(wwidth, wheight); if (SDL_SetRelativeMouseMode(SDL_TRUE) == 0) // already warps mouse if successful
wrapmouseok = SDL_TRUE; // TODO: is wrapmouseok or HalfWarpMouse needed anymore?
} }
} }
} }
@ -782,13 +795,15 @@ void I_GetEvent(void)
SDL_Event evt; SDL_Event evt;
// We only want the first motion event, // We only want the first motion event,
// otherwise we'll end up catching the warp back to center. // otherwise we'll end up catching the warp back to center.
int mouseMotionOnce = 0; //int mouseMotionOnce = 0;
if (!graphics_started) if (!graphics_started)
{ {
return; return;
} }
mousemovex = mousemovey = 0;
while (SDL_PollEvent(&evt)) while (SDL_PollEvent(&evt))
{ {
switch (evt.type) switch (evt.type)
@ -801,8 +816,9 @@ void I_GetEvent(void)
Impl_HandleKeyboardEvent(evt.key, evt.type); Impl_HandleKeyboardEvent(evt.key, evt.type);
break; break;
case SDL_MOUSEMOTION: case SDL_MOUSEMOTION:
if (!mouseMotionOnce) Impl_HandleMouseMotionEvent(evt.motion); //if (!mouseMotionOnce)
mouseMotionOnce = 1; Impl_HandleMouseMotionEvent(evt.motion);
//mouseMotionOnce = 1;
break; break;
case SDL_MOUSEBUTTONUP: case SDL_MOUSEBUTTONUP:
case SDL_MOUSEBUTTONDOWN: case SDL_MOUSEBUTTONDOWN:
@ -825,6 +841,20 @@ void I_GetEvent(void)
} }
} }
// Send all relative mouse movement as one single mouse event.
if (mousemovex || mousemovey)
{
event_t event;
int wwidth, wheight;
SDL_GetWindowSize(window, &wwidth, &wheight);
//SDL_memset(&event, 0, sizeof(event_t));
event.type = ev_mouse;
event.data1 = 0;
event.data2 = (INT32)lround(mousemovex * ((float)wwidth / (float)realwidth));
event.data3 = (INT32)lround(mousemovey * ((float)wheight / (float)realheight));
D_PostEvent(&event);
}
// In order to make wheels act like buttons, we have to set their state to Up. // In order to make wheels act like buttons, we have to set their state to Up.
// This is because wheel messages don't have an up/down state. // This is because wheel messages don't have an up/down state.
gamekeydown[KEY_MOUSEWHEELDOWN] = gamekeydown[KEY_MOUSEWHEELUP] = 0; gamekeydown[KEY_MOUSEWHEELDOWN] = gamekeydown[KEY_MOUSEWHEELUP] = 0;
@ -838,7 +868,9 @@ void I_StartupMouse(void)
return; return;
if (!firsttimeonmouse) if (!firsttimeonmouse)
{
HalfWarpMouse(realwidth, realheight); // warp to center HalfWarpMouse(realwidth, realheight); // warp to center
}
else else
firsttimeonmouse = SDL_FALSE; firsttimeonmouse = SDL_FALSE;
if (cv_usemouse.value) if (cv_usemouse.value)
@ -899,7 +931,7 @@ static inline boolean I_SkipFrame(void)
{ {
static boolean skip = false; static boolean skip = false;
if (render_soft != rendermode) if (rendermode != render_soft)
return false; return false;
skip = !skip; skip = !skip;
@ -909,6 +941,7 @@ static inline boolean I_SkipFrame(void)
case GS_LEVEL: case GS_LEVEL:
if (!paused) if (!paused)
return false; return false;
/* FALLTHRU */
case GS_TIMEATTACK: case GS_TIMEATTACK:
case GS_WAITINGPLAYERS: case GS_WAITINGPLAYERS:
return skip; // Skip odd frames return skip; // Skip odd frames
@ -931,7 +964,7 @@ void I_FinishUpdate(void)
if (cv_ticrate.value) if (cv_ticrate.value)
SCR_DisplayTicRate(); SCR_DisplayTicRate();
if (render_soft == rendermode && screens[0]) if (rendermode == render_soft && screens[0])
{ {
SDL_Rect rect; SDL_Rect rect;
@ -958,7 +991,7 @@ void I_FinishUpdate(void)
} }
#ifdef HWRENDER #ifdef HWRENDER
else else if (rendermode == render_opengl)
{ {
OglSdlFinishUpdate(cv_vidwait.value); OglSdlFinishUpdate(cv_vidwait.value);
} }
@ -1186,11 +1219,11 @@ INT32 VID_SetMode(INT32 modeNum)
} }
vid.modenum = -1; vid.modenum = -1;
} }
Impl_SetWindowName("SRB2Kart "VERSIONSTRING); //Impl_SetWindowName("SRB2Kart "VERSIONSTRING);
SDLSetMode(windowedModes[modeNum][0], windowedModes[modeNum][1], USE_FULLSCREEN); SDLSetMode(vid.width, vid.height, USE_FULLSCREEN);
if (render_soft == rendermode) if (rendermode == render_soft)
{ {
if (bufSurface) if (bufSurface)
{ {
@ -1209,30 +1242,20 @@ static SDL_bool Impl_CreateWindow(SDL_bool fullscreen)
int flags = 0; int flags = 0;
if (rendermode == render_none) // dedicated if (rendermode == render_none) // dedicated
{
return SDL_TRUE; // Monster Iestyn -- not sure if it really matters what we return here tbh return SDL_TRUE; // Monster Iestyn -- not sure if it really matters what we return here tbh
}
if (window != NULL) if (window != NULL)
{
return SDL_FALSE; return SDL_FALSE;
}
if (fullscreen) if (fullscreen)
{
flags |= SDL_WINDOW_FULLSCREEN_DESKTOP; flags |= SDL_WINDOW_FULLSCREEN_DESKTOP;
}
if (borderlesswindow) if (borderlesswindow)
{
flags |= SDL_WINDOW_BORDERLESS; flags |= SDL_WINDOW_BORDERLESS;
}
#ifdef HWRENDER #ifdef HWRENDER
if (rendermode == render_opengl) if (rendermode == render_opengl)
{
flags |= SDL_WINDOW_OPENGL; flags |= SDL_WINDOW_OPENGL;
}
#endif #endif
// Create a window // Create a window
@ -1261,7 +1284,13 @@ static SDL_bool Impl_CreateWindow(SDL_bool fullscreen)
#endif #endif
if (rendermode == render_soft) if (rendermode == render_soft)
{ {
renderer = SDL_CreateRenderer(window, -1, (usesdl2soft ? SDL_RENDERER_SOFTWARE : 0) | (cv_vidwait.value && !usesdl2soft ? SDL_RENDERER_PRESENTVSYNC : 0)); flags = 0; // Use this to set SDL_RENDERER_* flags now
if (usesdl2soft)
flags |= SDL_RENDERER_SOFTWARE;
else if (cv_vidwait.value)
flags |= SDL_RENDERER_PRESENTVSYNC;
renderer = SDL_CreateRenderer(window, -1, flags);
if (renderer == NULL) if (renderer == NULL)
{ {
CONS_Printf(M_GetText("Couldn't create rendering context: %s\n"), SDL_GetError()); CONS_Printf(M_GetText("Couldn't create rendering context: %s\n"), SDL_GetError());
@ -1273,14 +1302,16 @@ static SDL_bool Impl_CreateWindow(SDL_bool fullscreen)
return SDL_TRUE; return SDL_TRUE;
} }
/*
static void Impl_SetWindowName(const char *title) static void Impl_SetWindowName(const char *title)
{ {
if (window != NULL) if (window == NULL)
{ {
return; return;
} }
SDL_SetWindowTitle(window, title); SDL_SetWindowTitle(window, title);
} }
*/
static void Impl_SetWindowIcon(void) static void Impl_SetWindowIcon(void)
{ {
@ -1483,7 +1514,7 @@ void I_ShutdownGraphics(void)
rendermode = render_none; rendermode = render_none;
if (icoSurface) SDL_FreeSurface(icoSurface); if (icoSurface) SDL_FreeSurface(icoSurface);
icoSurface = NULL; icoSurface = NULL;
if (render_soft == oldrendermode) if (oldrendermode == render_soft)
{ {
if (vidSurface) SDL_FreeSurface(vidSurface); if (vidSurface) SDL_FreeSurface(vidSurface);
vidSurface = NULL; vidSurface = NULL;

View File

@ -1214,7 +1214,7 @@
C01FCF4B08A954540054247B /* Debug */ = { C01FCF4B08A954540054247B /* Debug */ = {
isa = XCBuildConfiguration; isa = XCBuildConfiguration;
buildSettings = { buildSettings = {
CURRENT_PROJECT_VERSION = 2.1.18; CURRENT_PROJECT_VERSION = 2.1.19;
GCC_PREPROCESSOR_DEFINITIONS = ( GCC_PREPROCESSOR_DEFINITIONS = (
"$(inherited)", "$(inherited)",
NORMALSRB2, NORMALSRB2,
@ -1226,7 +1226,7 @@
C01FCF4C08A954540054247B /* Release */ = { C01FCF4C08A954540054247B /* Release */ = {
isa = XCBuildConfiguration; isa = XCBuildConfiguration;
buildSettings = { buildSettings = {
CURRENT_PROJECT_VERSION = 2.1.18; CURRENT_PROJECT_VERSION = 2.1.19;
GCC_ENABLE_FIX_AND_CONTINUE = NO; GCC_ENABLE_FIX_AND_CONTINUE = NO;
GCC_GENERATE_DEBUGGING_SYMBOLS = NO; GCC_GENERATE_DEBUGGING_SYMBOLS = NO;
GCC_PREPROCESSOR_DEFINITIONS = ( GCC_PREPROCESSOR_DEFINITIONS = (

View File

@ -43,12 +43,10 @@
#define HAVE_ZLIB #define HAVE_ZLIB
#ifndef _MSC_VER #ifndef _MSC_VER
#ifndef _WII
#ifndef _LARGEFILE64_SOURCE #ifndef _LARGEFILE64_SOURCE
#define _LARGEFILE64_SOURCE #define _LARGEFILE64_SOURCE
#endif #endif
#endif #endif
#endif
#ifndef _LFS64_LARGEFILE #ifndef _LFS64_LARGEFILE
#define _LFS64_LARGEFILE #define _LFS64_LARGEFILE

View File

@ -71,7 +71,6 @@ INT32 oglflags = 0;
void *GLUhandle = NULL; void *GLUhandle = NULL;
SDL_GLContext sdlglcontext = 0; SDL_GLContext sdlglcontext = 0;
#ifndef STATIC_OPENGL
void *GetGLFunc(const char *proc) void *GetGLFunc(const char *proc)
{ {
if (strncmp(proc, "glu", 3) == 0) if (strncmp(proc, "glu", 3) == 0)
@ -83,7 +82,6 @@ void *GetGLFunc(const char *proc)
} }
return SDL_GL_GetProcAddress(proc); return SDL_GL_GetProcAddress(proc);
} }
#endif
boolean LoadGL(void) boolean LoadGL(void)
{ {

View File

@ -49,7 +49,7 @@
#define MIX_CHANNELS 8 #define MIX_CHANNELS 8
#endif #endif
#if defined (_WIN32) && !defined (_WIN32_WCE) && !defined (_XBOX) #ifdef _WIN32
#include <direct.h> #include <direct.h>
#elif defined (__GNUC__) #elif defined (__GNUC__)
#include <unistd.h> #include <unistd.h>
@ -85,21 +85,11 @@
// mixing buffer, and the samplerate of the raw data. // mixing buffer, and the samplerate of the raw data.
// Needed for calling the actual sound output. // Needed for calling the actual sound output.
#if defined (_WIN32_WCE) || defined (DC) || defined (PSP) || defined(GP2X)
#define NUM_CHANNELS MIX_CHANNELS
#else
#define NUM_CHANNELS MIX_CHANNELS*4 #define NUM_CHANNELS MIX_CHANNELS*4
#endif
#define INDEXOFSFX(x) ((sfxinfo_t *)x - S_sfx) #define INDEXOFSFX(x) ((sfxinfo_t *)x - S_sfx)
#if defined (_WIN32_WCE) || defined (DC) || defined (PSP)
static Uint16 samplecount = 512; //Alam: .5KB samplecount at 11025hz is 46.439909297052154195011337868481ms of buffer
#elif defined(GP2X)
static Uint16 samplecount = 128;
#else
static Uint16 samplecount = 1024; //Alam: 1KB samplecount at 22050hz is 46.439909297052154195011337868481ms of buffer static Uint16 samplecount = 1024; //Alam: 1KB samplecount at 22050hz is 46.439909297052154195011337868481ms of buffer
#endif
typedef struct chan_struct typedef struct chan_struct
{ {
@ -151,17 +141,10 @@ static SDL_bool musicStarted = SDL_FALSE;
#ifdef HAVE_MIXER #ifdef HAVE_MIXER
static SDL_mutex *Msc_Mutex = NULL; static SDL_mutex *Msc_Mutex = NULL;
/* FIXME: Make this file instance-specific */ /* FIXME: Make this file instance-specific */
#ifdef _arch_dreamcast
#define MIDI_PATH "/ram"
#elif defined(GP2X)
#define MIDI_PATH "/mnt/sd/srb2"
#define MIDI_PATH2 "/tmp/mnt/sd/srb2"
#else
#define MIDI_PATH srb2home #define MIDI_PATH srb2home
#if defined (__unix__) || defined(__APPLE__) || defined (UNIXCOMMON) #if defined (__unix__) || defined(__APPLE__) || defined (UNIXCOMMON)
#define MIDI_PATH2 "/tmp" #define MIDI_PATH2 "/tmp"
#endif #endif
#endif
#define MIDI_TMPFILE "srb2music" #define MIDI_TMPFILE "srb2music"
#define MIDI_TMPFILE2 "srb2wav" #define MIDI_TMPFILE2 "srb2wav"
static INT32 musicvol = 62; static INT32 musicvol = 62;
@ -176,7 +159,7 @@ static SDL_bool canlooping = SDL_TRUE;
#if SDL_MIXER_VERSION_ATLEAST(1,2,7) #if SDL_MIXER_VERSION_ATLEAST(1,2,7)
#define USE_RWOPS // ok, USE_RWOPS is in here #define USE_RWOPS // ok, USE_RWOPS is in here
#if defined (DC) || defined (_WIN32_WCE) || defined (_XBOX) //|| defined(_WIN32) || defined(GP2X) #if 0 // defined(_WIN32)
#undef USE_RWOPS #undef USE_RWOPS
#endif #endif
#endif #endif
@ -1188,13 +1171,6 @@ void I_StartupSound(void)
#endif #endif
#ifndef HAVE_MIXER #ifndef HAVE_MIXER
nomidimusic = nodigimusic = true; nomidimusic = nodigimusic = true;
#endif
#ifdef DC
//nosound = true;
#ifdef HAVE_MIXER
nomidimusic = true;
nodigimusic = true;
#endif
#endif #endif
memset(channels, 0, sizeof (channels)); //Alam: Clean it memset(channels, 0, sizeof (channels)); //Alam: Clean it
@ -1243,13 +1219,7 @@ void I_StartupSound(void)
audio.samples /= 2; audio.samples /= 2;
} }
#if defined (_PSP) && defined (HAVE_MIXER) // Bug in PSP's SDL_OpenAudio, can not open twice
I_SetChannels();
sound_started = true;
Snd_Mutex = SDL_CreateMutex();
#else
if (nosound) if (nosound)
#endif
return; return;
#ifdef HW3SOUND #ifdef HW3SOUND
@ -1302,7 +1272,7 @@ void I_StartupSound(void)
snddev.bps = 16; snddev.bps = 16;
snddev.sample_rate = audio.freq; snddev.sample_rate = audio.freq;
snddev.numsfxs = NUMSFX; snddev.numsfxs = NUMSFX;
#if defined (_WIN32) && !defined (_XBOX) #if defined (_WIN32)
snddev.cooplevel = 0x00000002; snddev.cooplevel = 0x00000002;
snddev.hWnd = vid.WndParent; snddev.hWnd = vid.WndParent;
#endif #endif
@ -1520,9 +1490,7 @@ void I_InitMusic(void)
I_OutputMsg("Compiled for SDL_mixer version: %d.%d.%d\n", I_OutputMsg("Compiled for SDL_mixer version: %d.%d.%d\n",
MIXcompiled.major, MIXcompiled.minor, MIXcompiled.patch); MIXcompiled.major, MIXcompiled.minor, MIXcompiled.patch);
#ifdef MIXER_POS #ifdef MIXER_POS
#ifndef _WII
if (MIXlinked->major == 1 && MIXlinked->minor == 2 && MIXlinked->patch < 7) if (MIXlinked->major == 1 && MIXlinked->minor == 2 && MIXlinked->patch < 7)
#endif
canlooping = SDL_FALSE; canlooping = SDL_FALSE;
#endif #endif
#ifdef USE_RWOPS #ifdef USE_RWOPS
@ -1531,13 +1499,11 @@ void I_InitMusic(void)
#endif #endif
I_OutputMsg("Linked with SDL_mixer version: %d.%d.%d\n", I_OutputMsg("Linked with SDL_mixer version: %d.%d.%d\n",
MIXlinked->major, MIXlinked->minor, MIXlinked->patch); MIXlinked->major, MIXlinked->minor, MIXlinked->patch);
#if !(defined (DC) || defined (PSP) || defined(GP2X) || defined (WII))
if (audio.freq < 44100 && !M_CheckParm ("-freq")) //I want atleast 44Khz if (audio.freq < 44100 && !M_CheckParm ("-freq")) //I want atleast 44Khz
{ {
audio.samples = (Uint16)(audio.samples*(INT32)(44100/audio.freq)); audio.samples = (Uint16)(audio.samples*(INT32)(44100/audio.freq));
audio.freq = 44100; //Alam: to keep it around the same XX ms audio.freq = 44100; //Alam: to keep it around the same XX ms
} }
#endif
if (sound_started if (sound_started
#ifdef HW3SOUND #ifdef HW3SOUND
@ -1929,7 +1895,7 @@ boolean I_StartDigSong(const char *musicname, boolean looping)
if (loopstart > 0) if (loopstart > 0)
{ {
loopstartDig = (double)((44.1l+loopstart) / 44100.0l); //8 PCM chucks off and PCM to secs loopstartDig = (double)((44.1l+loopstart) / 44100.0l); //8 PCM chucks off and PCM to secs
//#ifdef GP2X//#ifdef PARANOIA //#ifdef PARANOIA
//I_OutputMsg("I_StartDigSong: setting looping point to %ul PCMs(%f seconds)\n", loopstart, loopstartDig); //I_OutputMsg("I_StartDigSong: setting looping point to %ul PCMs(%f seconds)\n", loopstart, loopstartDig);
//#endif //#endif
} }

Some files were not shown because too many files have changed in this diff Show More