Merge branch 'master' of http://git.magicalgirl.moe/STJr/SRB2Internal into unslot-music

# Conflicts:
#	src/dehacked.c
#	src/f_finale.c
#	src/lua_baselib.c
#	src/lua_maplib.c
#	src/m_menu.c
#	src/p_enemy.c
#	src/p_inter.c
#	src/p_setup.c
#	src/p_user.c
#	src/s_sound.c
#	src/y_inter.c
This commit is contained in:
Inuyasha 2016-03-03 22:09:24 -08:00
commit e0f5312d13
80 changed files with 1299 additions and 2190 deletions

2
.gitattributes vendored
View file

@ -29,4 +29,6 @@
/libs/zlib/nintendods/README -whitespace
/libs/zlib/watcom/watcom_f.mak -crlf -whitespace
/libs/zlib/watcom/watcom_l.mak -crlf -whitespace
#Appveyor
/appveyor.yml -crlf -whitespace
# Other

33
.travis.yml Normal file
View file

@ -0,0 +1,33 @@
language: c
sudo: required
dist: trusty
env:
- CFLAGS=-Wno-absolute-value -Werror
compiler:
- gcc
- clang
cache:
directories:
- $HOME/srb2_cache
addons:
apt:
packages:
- libsdl2-mixer-dev
- libpng-dev
- libgl1-mesa-dev
- libgme-dev
- p7zip-full
before_script:
- mkdir $HOME/srb2_cache
- wget --verbose --server-response -c http://rosenthalcastle.org/srb2/SRB2-v2114-assets.7z -O $HOME/srb2_cache/SRB2-v2114-assets.7z
- 7z x $HOME/srb2_cache/SRB2-v2114-assets.7z -oassets
- mkdir build
- cd build
- cmake ..
script: make

View file

@ -23,13 +23,13 @@ endfunction()
# Macro to add OSX framework
macro(add_framework fwname appname)
find_library(FRAMEWORK_${fwname}
NAMES ${fwname}
PATHS ${CMAKE_OSX_SYSROOT}/System/Library
${CMAKE_OSX_SYSROOT}/Library
/System/Library
/Library
PATH_SUFFIXES Frameworks
NO_DEFAULT_PATH)
NAMES ${fwname}
PATHS ${CMAKE_OSX_SYSROOT}/System/Library
${CMAKE_OSX_SYSROOT}/Library
/System/Library
/Library
ATH_SUFFIXES Frameworks
NO_DEFAULT_PATH)
if( ${FRAMEWORK_${fwname}} STREQUAL FRAMEWORK_${fwname}-NOTFOUND)
MESSAGE(ERROR ": Framework ${fwname} not found")
else()
@ -80,9 +80,6 @@ endif()
if(${CMAKE_SYSTEM} MATCHES "Darwin")
add_definitions(-DMACOSX)
if(${CMAKE_C_COMPILER_ID} MATCHES "Clang")
set(CLANG ON)
endif()
endif()
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/bin")

71
appveyor.yml Normal file
View file

@ -0,0 +1,71 @@
version: 2.1.14.{branch}-{build}
os: MinGW
environment:
CC: i686-w64-mingw32-gcc
WINDRES: windres
MINGW_SDK: c:\msys64\mingw32
SDL2_URL: http://libsdl.org/release/SDL2-devel-2.0.4-mingw.tar.gz
SDL2_ARCHIVE: SDL2-devel-2.0.4-mingw.tar
SDL2_MOVE: SDL2-2.0.4\i686-w64-mingw32
SDL2_MIXER_URL: https://www.libsdl.org/projects/SDL_mixer/release/SDL2_mixer-devel-2.0.1-mingw.tar.gz
SDL2_MIXER_ARCHIVE: SDL2_mixer-devel-2.0.1-mingw.tar
SDL2_MIXER_MOVE: SDL2_mixer-2.0.1\i686-w64-mingw32
cache:
- SDL2-devel-2.0.4-mingw.tar.gz
- SDL2_mixer-devel-2.0.1-mingw.tar.gz
install:
#Download SDL2
- if not exist "%SDL2_ARCHIVE%.gz" appveyor DownloadFile "%SDL2_URL%" -FileName "%SDL2_ARCHIVE%.gz"
- 7z x -y "%SDL2_ARCHIVE%.gz" -o%TMP% >null
- 7z x -y "%TMP%\%SDL2_ARCHIVE%" -o%TMP% >null
- robocopy /S /xx /ns /nc /nfl /ndl /np /njh /njs %TMP%\%SDL2_MOVE% %MINGW_SDK% || exit 0
- ps: (Get-Content ([System.Environment]::ExpandEnvironmentVariables("%TMP%\%SDL2_MOVE%\bin\sdl2-config"))) | ForEach-Object { $_ -replace "/usr/local/cross-tools/i686-w64-mingw32", ([System.Environment]::ExpandEnvironmentVariables("%MINGW_SDK%")) } | Set-Content ([System.Environment]::ExpandEnvironmentVariables("%MINGW_SDK%\bin\sdl2-config"))
- ps: (Get-Content ([System.Environment]::ExpandEnvironmentVariables("%TMP%\%SDL2_MOVE%\lib\cmake\SDL2\sdl2-config.cmake"))) | ForEach-Object { $_ -replace "/usr/local/cross-tools/i686-w64-mingw32", ([System.Environment]::ExpandEnvironmentVariables("%MINGW_SDK%")) } | Set-Content ([System.Environment]::ExpandEnvironmentVariables("%MINGW_SDK%\lib\cmake\SDL2\sdl2-config.cmake"))
- ps: (Get-Content ([System.Environment]::ExpandEnvironmentVariables("%TMP%\%SDL2_MOVE%\lib\pkgconfig\sdl2.pc"))) | ForEach-Object { $_ -replace "/usr/local/cross-tools/i686-w64-mingw32", ([System.Environment]::ExpandEnvironmentVariables("%MINGW_SDK%")) } | Set-Content ([System.Environment]::ExpandEnvironmentVariables("%MINGW_SDK%\lib\pkgconfig\sdl2.pc"))
#Download SDL2_Mixer
- if not exist "%SDL2_MIXER_ARCHIVE%.gz" appveyor DownloadFile "%SDL2_MIXER_URL%" -FileName "%SDL2_MIXER_ARCHIVE%.gz"
- 7z x -y "%SDL2_MIXER_ARCHIVE%.gz" -o%TMP% >null
- 7z x -y "%TMP%\%SDL2_MIXER_ARCHIVE%" -o%TMP% >null
- robocopy /S /xx /ns /nc /nfl /ndl /np /njh /njs %TMP%\%SDL2_MIXER_MOVE% %MINGW_SDK% || exit 0
- ps: (Get-Content ([System.Environment]::ExpandEnvironmentVariables("%TMP%\%SDL2_MIXER_MOVE%\lib\pkgconfig\SDL2_mixer.pc")))| ForEach-Object { $_ -replace "/usr/local/cross-tools/i686-w64-mingw32", ([System.Environment]::ExpandEnvironmentVariables("%MINGW_SDK%")) } | Set-Content ([System.Environment]::ExpandEnvironmentVariables("%MINGW_SDK%\lib\pkgconfig\SDL2_mixer.pc"))
before_build:
- set SDL_PKGCONFIG=%MINGW_SDK%\lib\pkgconfig\sdl2.pc
- set Path=%MINGW_SDK%\bin;%Path%
- i686-w64-mingw32-gcc --version
- mingw32-make --version
- set SRB2_MFLAGS=-C src MINGW=1 WARNINGMODE=1 NOASM=1 NOUPX=1 GCC53=1
build_script:
- cmd: mingw32-make.exe %SRB2_MFLAGS% SDL=1 clean
- cmd: mingw32-make.exe %SRB2_MFLAGS% SDL=1 ERRORMODE=1
after_build:
- cmd: git rev-parse --short %APPVEYOR_REPO_COMMIT%>%TMP%/gitshort.txt
- cmd: set /P GITSHORT=<%TMP%/gitshort.txt
- set BUILD_ARCHIVE=%APPVEYOR_REPO_BRANCH%-%GITSHORT%.7z
- cmd: 7z a %BUILD_ARCHIVE% bin\Mingw\Release -xr!.gitignore
- appveyor PushArtifact %BUILD_ARCHIVE%
test: off
deploy:
- provider: FTP
protocol: ftps
host:
secure: NsLJEPIBvmwCOj8Tg8RoRQ==
username:
secure: ejxi5mvk7oLYu7QtbYojajEPigMy0mokaKhuEVuDZcA=
password:
secure: Hbn6Uy3lT0YZ88yFJ3aW4w==
folder: appveyor
application:
active_mode: false
on_finish:
#- cmd: echo xfreerdp /u:appveyor /cert-ignore +clipboard /v:<ip>:<port>
#- ps: $blockRdp = $true; iex ((new-object net.webclient).DownloadString('https://raw.githubusercontent.com/appveyor/ci/master/scripts/enable-rdp.ps1'))

12
assets/debian/changelog Normal file
View file

@ -0,0 +1,12 @@
srb2-data (2.1.14~1) unstable; urgency=low
* Updated for SRB2 v2.1.14
-- Alam Arias <alam+debian@srb2.org> Sat, 6 Jan 2016 11:00:00 -0500
srb2-data (2.0.6-2) maverick; urgency=high
* Initial proper release..
-- Callum Dickinson <gcfreak_ag20@hotmail.com> Sat, 29 Jan 2011 01:18:42 +1300

View file

@ -37,7 +37,7 @@ RM := rm -rf
DIR := $(shell pwd)
PACKAGE := $(shell cat $(DIR)/debian/control | grep 'Package:' | sed -e 's/Package: //g')
DATAFILES := drill.dta music.dta soar.dta zones.dta player.dta rings.wpn srb2.wad
DATAFILES := srb2.srb zones.dta player.dta rings.dta music.dta
DATADIR := usr/games/SRB2
RESOURCEDIR := .
@ -48,7 +48,7 @@ build:
# This will need to be updated every time SRB2 official version is
# Copy data files to their install locations, and add data files to include-binaries
for file in $(DATAFILES); do \
$(WGET) http://alam.srb2.org/SRB2/2.0.6-Final/Resources/$$file; \
$(WGET) http://alam.srb2.org/SRB2/2.1.14-Final/Resources/$$file; \
if test "$$file" = "srb2.wad"; then \
$(INSTALL) $(RESOURCEDIR)/$$file $(DIR)/debian/tmp/$(DATADIR)/srb2.srb; \
else \

View file

@ -0,0 +1 @@
3.0 (native)

View file

@ -1,5 +0,0 @@
srb2-data (2.0.6-2) maverick; urgency=high
* Initial proper release..
-- Callum Dickinson <gcfreak_ag20@hotmail.com> Sat, 29 Jan 2011 01:18:42 +1300

View file

@ -1 +0,0 @@
3.0 (quilt)

View file

@ -1,6 +1,6 @@
# Find SDL2
# Once done, this will define
#
#
# SDL2_FOUND - system has SDL2
# SDL2_INCLUDE_DIRS - SDL2 include directories
# SDL2_LIBRARIES - link libraries

View file

@ -1,6 +1,6 @@
# Find SDL2
# Once done, this will define
#
#
# SDL2_MAIN_FOUND - system has SDL2
# SDL2_MAIN_INCLUDE_DIRS - SDL2 include directories
# SDL2_MAIN_LIBRARIES - link libraries

View file

@ -1,6 +1,6 @@
# Find SDL2
# Once done, this will define
#
#
# SDL2_MIXER_FOUND - system has SDL2
# SDL2_MIXER_INCLUDE_DIRS - SDL2 include directories
# SDL2_MIXER_LIBRARIES - link libraries

View file

@ -123,7 +123,7 @@ function (libfind_process PREFIX)
set(includeopts ${${PREFIX}_PROCESS_INCLUDES})
set(libraryopts ${${PREFIX}_PROCESS_LIBS})
# Process deps to add to
# Process deps to add to
foreach (i ${PREFIX} ${${PREFIX}_DEPENDENCIES})
if (DEFINED ${i}_INCLUDE_OPTS OR DEFINED ${i}_LIBRARY_OPTS)
# The package seems to export option lists that we can use, woohoo!
@ -146,11 +146,11 @@ function (libfind_process PREFIX)
endif()
endif()
endforeach()
if (includeopts)
list(REMOVE_DUPLICATES includeopts)
endif()
if (libraryopts)
list(REMOVE_DUPLICATES libraryopts)
endif()
@ -215,7 +215,7 @@ function (libfind_process PREFIX)
set (${PREFIX}_LIBRARIES ${libs} PARENT_SCOPE)
set (${PREFIX}_FOUND TRUE PARENT_SCOPE)
endif()
return()
return()
endif()
# Format messages for debug info and the type of error

View file

@ -6,6 +6,7 @@ copy nul: /b +%1\comptime.c tmp.$$$ > nul
move tmp.$$$ %1\comptime.c > nul
if exist .git goto gitrev
if exist ..\.git goto gitrev
if exist .svn goto svnrev
goto filwri

14
debian/control vendored
View file

@ -4,13 +4,19 @@ Source: srb2
Section: games
Priority: extra
Maintainer: Callum Dickinson <gcfreak_ag20@hotmail.com>
Build-Depends: debhelper (>= 7.0.50~), libsdl1.2-dev (>= 1.2.7), libsdl-mixer1.2-dev (>= 1.2.7), libpng12-dev (>= 1.2.7), libglu1-dev | libglu-dev, libosmesa6-dev | libgl-dev, nasm [i386]
Build-Depends: debhelper (>= 7.0.50~),
libsdl2-dev,
libsdl2-mixer-dev,
libpng12-dev (>= 1.2.7),
libglu1-dev | libglu-dev,
libosmesa6-dev | libgl-dev,
nasm [i386]
Standards-Version: 3.8.4
Homepage: http://www.srb2.org
Package: srb2
Architecture: any
Depends: ${shlibs:Depends}, ${misc:Depends}, srb2-data (= 2.0.6)
Depends: ${shlibs:Depends}, ${misc:Depends}, srb2-data (= 2.1.14)
Description: A cross-platform 3D Sonic fangame
Sonic Robo Blast 2 is a 3D open-source Sonic the Hedgehog
fangame built using a modified version of the Doom Legacy
@ -22,8 +28,8 @@ Description: A cross-platform 3D Sonic fangame
Package: srb2-dbg
Architecture: any
# FIXME: should be Depends: ${shlibs:Depends}, ${misc:Depends}, srb2-data (= 2.0.6), srb2 but dh_shlibdeps is being an asshat
Depends: libc6, ${misc:Depends}, srb2-data (= 2.0.6), srb2
# FIXME: should be Depends: ${shlibs:Depends}, ${misc:Depends}, srb2-data (= 2.1.14), srb2 but dh_shlibdeps is being an asshat
Depends: libc6, ${misc:Depends}, srb2-data (= 2.1.14), srb2
Description: A cross-platform 3D Sonic fangame
Sonic Robo Blast 2 is a 3D open-source Sonic the Hedgehog
fangame built using a modified version of the Doom Legacy

17
debian/rules vendored
View file

@ -59,16 +59,18 @@ DBGNAME = debug/$(EXENAME)
PKGDIR = usr/games
DBGDIR = usr/lib/debug/$(PKGDIR)
PIXMAPS_DIR = usr/share/pixmaps
DESKTOP_DIR = usr/share/applications
PREFIX = $(shell test "$(CROSS_COMPILE_BUILD)" != "$(CROSS_COMPILE_HOST)" && echo "PREFIX=$(CROSS_COMPILE_HOST)")
OS = LINUX=1
NONX86 = $(shell test "`echo $(CROSS_COMPILE_HOST) | grep 'i[3-6]86'`" || echo "NONX86=1")
MAKEARGS = $(OS) $(NONX86) $(PREFIX) EXENAME=$(EXENAME) DBGNAME=$(DBGNAME) SDL_PKGCONFIG=sdl PNG_PKGCONFIG=libpng NOOBJDUMP=1
MAKEARGS = $(OS) $(NONX86) $(PREFIX) EXENAME=$(EXENAME) DBGNAME=$(DBGNAME) SDL_PKGCONFIG=sdl2 PNG_PKGCONFIG=libpng NOOBJDUMP=1
MENUFILE1 = ?package($(PACKAGE)):needs="X11" section="$(SECTION)"
MENUFILE2 = title="$(TITLE)" command="/$(PKGDIR)/$(PACKAGE)"
# FIXME pkg-config dir hacks
export PKG_CONFIG_LIBDIR = /usr/$(CROSS_COMPILE_HOST)/lib/pkgconfig
export PKG_CONFIG_LIBDIR = /usr/lib/$(CROSS_COMPILE_HOST)/pkgconfig
BINDIR := $(DIR)/bin/Linux/Release
LDFLAGS += "-Wl,-rpath=/usr/$(CROSS_COMPILE_HOST)/lib/"
LDFLAGS += "-Wl,-rpath=/usr/lib/$(CROSS_COMPILE_HOST)"
build:
$(MKDIR) $(BINDIR)/debug
@ -80,14 +82,23 @@ binary-indep:
echo "no need to do any arch-independent stuff"
binary-arch:
# create ddirs
$(MKDIR) $(DIR)/debian/tmp/$(PKGDIR) $(DIR)/debian/tmp/$(DBGDIR)
$(MKDIR) $(DIR)/debian/tmp/$(PKGDIR) $(DIR)/debian/tmp/$(DESKTOP_DIR)
$(MKDIR) $(DIR)/debian/tmp/$(PKGDIR) $(DIR)/debian/tmp/$(PIXMAPS_DIR)
# install main binaries
$(INSTALL) $(BINDIR)/$(EXENAME) $(DIR)/debian/tmp/$(PKGDIR)/$(PACKAGE)
$(INSTALL) $(BINDIR)/$(DBGNAME) $(DIR)/debian/tmp/$(DBGDIR)/$(PACKAGE)
# Install desktop file and banner image
$(INSTALL) $(DIR)/srb2.png $(DIR)/debian/tmp/usr/share/pixmaps
$(INSTALL) $(DIR)/debian/srb2.desktop $(DIR)/debian/tmp/usr/share/applications
# add compiled binaries to include-binaries
echo $(BINDIR)/$(EXENAME) >> $(DIR)/debian/source/include-binaries
echo $(BINDIR)/$(EXENAME) >> $(DIR)/debian/source/include-binaries
# Generate install folder files
echo $(PKGDIR) > $(DIR)/debian/$(PACKAGE).install
echo $(DESKTOP_DIR) >> $(DIR)/debian/$(PACKAGE).install
echo $(PIXMAPS_DIR) >> $(DIR)/debian/$(PACKAGE).install
echo $(DBGDIR) > $(DIR)/debian/$(DBGPKG).install
binary: binary-arch

10
debian/srb2.desktop vendored Normal file
View file

@ -0,0 +1,10 @@
[Desktop Entry]
Name=Sonic Robo Blast 2
Comment=A free 3D Sonic the Hedgehog fan-game built using a modified ver. of the Doom Legacy source port
Encoding=UTF-8
Exec=srb2
Icon=/usr/share/pixmaps/srb2.png
Terminal=false
Type=Application
StartupNotify=false
Categories=Application;Game;

BIN
srb2.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 153 KiB

View file

@ -168,7 +168,7 @@ set(SRB2_CORE_GAME_SOURCES
p_tick.h
)
if(NOT CLANG)
if(NOT (CMAKE_CXX_COMPILER_ID MATCHES "Clang"))
set(SRB2_CORE_SOURCES ${SRB2_CORE_SOURCES} string.c)
endif()
@ -406,10 +406,14 @@ endif()
# Compatibility flag with later versions of GCC
# We should really fix our code to not need this
if(NOT CLANG AND NOT MSVC)
if ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "GNU")
set(CMAKE_C_FLAGS ${CMAKE_C_FLAGS} -mno-ms-bitfields)
endif()
if (CMAKE_CXX_COMPILER_ID MATCHES "Clang")
set(CMAKE_C_FLAGS ${CMAKE_C_FLAGS} -Wno-absolute-value)
endif()
add_definitions(-DCMAKECONFIG)
#add_library(SRB2Core STATIC
@ -431,4 +435,4 @@ endif()
if(NOT ${SRB2_SDL2_AVAILABLE} AND NOT ${SRB2_WIN32_AVAILABLE})
message(FATAL_ERROR "There are no targets available to build an SRB2 executable. :(")
endif()
endif()

View file

@ -7,6 +7,22 @@
# and other things
#
ifdef GCC53
GCC52=1
endif
ifdef GCC52
GCC51=1
endif
ifdef GCC51
GCC49=1
endif
ifdef GCC49
GCC48=1
endif
ifdef GCC48
GCC47=1
endif
@ -139,6 +155,10 @@ WFLAGS+=-Wformat-security
ifndef GCC29
#WFLAGS+=-Winit-self
endif
ifdef GCC46
WFLAGS+=-Wno-suggest-attribute=noreturn
endif
ifndef MINGW
ifdef GCC45
WFLAGS+=-Wunsuffixed-float-constants
@ -155,6 +175,7 @@ ifdef GCC43
endif
WFLAGS+=$(OLDWFLAGS)
#indicate platform and what interface use with
ifndef WINCE
ifndef XBOX

View file

@ -49,7 +49,7 @@ static inline void B_BuildTailsTiccmd(mobj_t *sonic, mobj_t *tails, ticcmd_t *cm
if (sonic->player->pflags & (PF_MACESPIN|PF_ITEMHANG))
{
cmd->forwardmove = sonic->player->cmd.forwardmove;
cmd->angleturn = abs(tails->angle - sonic->angle)>>16;
cmd->angleturn = abs((tails->angle - sonic->angle))>>16;
if (sonic->angle < tails->angle)
cmd->angleturn = -cmd->angleturn;
} else if (dist > FixedMul(512*FRACUNIT, tails->scale))

View file

@ -202,7 +202,7 @@ static void CONS_Bind_f(void)
}
key = G_KeyStringtoNum(COM_Argv(1));
if (!key)
if (key <= 0 || key >= NUMINPUTS)
{
CONS_Alert(CONS_NOTICE, M_GetText("Invalid key name\n"));
return;
@ -310,7 +310,7 @@ static void CON_SetupBackColormap(void)
yellowmap[9] = (UINT8)66;
purplemap[3] = (UINT8)184;
purplemap[9] = (UINT8)186;
lgreenmap[3] = (UINT8)102;
lgreenmap[3] = (UINT8)98;
lgreenmap[9] = (UINT8)106;
bluemap[3] = (UINT8)147;
bluemap[9] = (UINT8)158;
@ -1472,4 +1472,3 @@ void CON_Drawer(void)
else if (gamestate == GS_LEVEL || gamestate == GS_INTERMISSION || gamestate == GS_CUTSCENE || gamestate == GS_CREDITS)
CON_DrawHudlines();
}

View file

@ -65,6 +65,9 @@ static mobjtype_t get_mobjtype(const char *word);
static statenum_t get_state(const char *word);
static spritenum_t get_sprite(const char *word);
static sfxenum_t get_sfx(const char *word);
#ifdef MUSICSLOT_COMPATIBILITY
static UINT16 get_mus(const char *word, UINT8 dehacked_mode);
#endif
static hudnum_t get_huditem(const char *word);
#ifndef HAVE_BLUA
static powertype_t get_power(const char *word);
@ -1173,22 +1176,19 @@ static void readlevelheader(MYFILE *f, INT32 num)
sizeof(mapheaderinfo[num-1]->musname), va("Level header %d: music", num));
}
}
#ifdef MUSICSLOT_COMPATIBILITY
else if (fastcmp(word, "MUSICSLOT"))
{ // Backwards compatibility?
// Convert to map number
if (word2[0] >= 'A' && word2[0] <= 'Z' && word2[2] == '\0')
i = M_MapNumber(word2[0], word2[1]);
if (!i)
i = get_mus(word2, true);
if (i && i <= 1035)
snprintf(mapheaderinfo[num-1]->musname, 7, "%sM", G_BuildMapName(i));
else if (i && i <= 1050)
strncpy(mapheaderinfo[num-1]->musname, compat_special_music_slots[i - 1036], 7);
else
mapheaderinfo[num-1]->musname[0] = 0; // becomes empty string
else if (i > 1035)
deh_warning("Level header %d: musicslot out of range (0 - 1035)\n", num);
else // it's just a number
{
snprintf(mapheaderinfo[num-1]->musname, 7, va("%sM", G_BuildMapName(i)));
mapheaderinfo[num-1]->musname[6] = 0;
}
mapheaderinfo[num-1]->musname[6] = 0;
}
#endif
else if (fastcmp(word, "MUSICTRACK"))
mapheaderinfo[num-1]->mustrack = ((UINT16)i - 1);
else if (fastcmp(word, "FORCECHARACTER"))
@ -1463,6 +1463,20 @@ static void readcutscenescene(MYFILE *f, INT32 num, INT32 scenenum)
strncpy(cutscenes[num]->scene[scenenum].musswitch, word2, 7);
cutscenes[num]->scene[scenenum].musswitch[6] = 0;
}
#ifdef MUSICSLOT_COMPATIBILITY
else if (fastcmp(word, "MUSICSLOT"))
{
DEH_WriteUndoline(word, cutscenes[num]->scene[scenenum].musswitch, UNDO_NONE);
i = get_mus(word2, true);
if (i && i <= 1035)
snprintf(cutscenes[num]->scene[scenenum].musswitch, 7, "%sM", G_BuildMapName(i));
else if (i && i <= 1050)
strncpy(cutscenes[num]->scene[scenenum].musswitch, compat_special_music_slots[i - 1036], 7);
else
cutscenes[num]->scene[scenenum].musswitch[0] = 0; // becomes empty string
cutscenes[num]->scene[scenenum].musswitch[6] = 0;
}
#endif
else if (fastcmp(word, "MUSICTRACK"))
{
DEH_WriteUndoline(word, va("%u", cutscenes[num]->scene[scenenum].musswitchflags), UNDO_NONE);
@ -3207,6 +3221,12 @@ static void readwipes(MYFILE *f)
else if (fastcmp(pword, "FINAL"))
wipeoffset = wipe_gameend_final;
}
else if (fastncmp(word, "SPECLEVEL_", 10))
{
pword = word + 10;
if (fastcmp(pword, "TOWHITE"))
wipeoffset = wipe_speclevel_towhite;
}
if (wipeoffset < 0)
{
@ -3214,9 +3234,11 @@ static void readwipes(MYFILE *f)
continue;
}
if (value == UINT8_MAX // Cannot disable non-toblack wipes (or the level toblack wipe)
&& (wipeoffset <= wipe_level_toblack || wipeoffset >= wipe_level_final))
if (value == UINT8_MAX
&& (wipeoffset <= wipe_level_toblack || wipeoffset >= wipe_speclevel_towhite))
{
// Cannot disable non-toblack wipes
// (or the level toblack wipe, or the special towhite wipe)
deh_warning("Wipes: can't disable wipe of type '%s'", word);
continue;
}
@ -4606,30 +4628,7 @@ static const char *const STATE_LIST[] = { // array length left dynamic for sanit
"S_MSSHIELD_F12",
// Ring
"S_RING1",
"S_RING2",
"S_RING3",
"S_RING4",
"S_RING5",
"S_RING6",
"S_RING7",
"S_RING8",
"S_RING9",
"S_RING10",
"S_RING11",
"S_RING12",
"S_RING13",
"S_RING14",
"S_RING15",
"S_RING16",
"S_RING17",
"S_RING18",
"S_RING19",
"S_RING20",
"S_RING21",
"S_RING22",
"S_RING23",
"S_RING24",
"S_RING",
// Blue Sphere for special stages
"S_BLUEBALL",
@ -4645,39 +4644,10 @@ static const char *const STATE_LIST[] = { // array length left dynamic for sanit
"S_GRAVWELLRED3",
// Individual Team Rings
"S_TEAMRING1",
"S_TEAMRING2",
"S_TEAMRING3",
"S_TEAMRING4",
"S_TEAMRING5",
"S_TEAMRING6",
"S_TEAMRING7",
"S_TEAMRING8",
"S_TEAMRING9",
"S_TEAMRING10",
"S_TEAMRING11",
"S_TEAMRING12",
"S_TEAMRING13",
"S_TEAMRING14",
"S_TEAMRING15",
"S_TEAMRING16",
"S_TEAMRING17",
"S_TEAMRING18",
"S_TEAMRING19",
"S_TEAMRING20",
"S_TEAMRING21",
"S_TEAMRING22",
"S_TEAMRING23",
"S_TEAMRING24",
"S_TEAMRING",
// Special Stage Token
"S_EMMY1",
"S_EMMY2",
"S_EMMY3",
"S_EMMY4",
"S_EMMY5",
"S_EMMY6",
"S_EMMY7",
"S_EMMY",
// Special Stage Token
"S_TOKEN",
@ -4831,40 +4801,9 @@ static const char *const STATE_LIST[] = { // array length left dynamic for sanit
"S_SPIKED2",
// Starpost
"S_STARPOST1",
"S_STARPOST2",
"S_STARPOST3",
"S_STARPOST4",
"S_STARPOST5",
"S_STARPOST6",
"S_STARPOST7",
"S_STARPOST8",
"S_STARPOST9",
"S_STARPOST10",
"S_STARPOST11",
"S_STARPOST12",
"S_STARPOST13",
"S_STARPOST14",
"S_STARPOST15",
"S_STARPOST16",
"S_STARPOST17",
"S_STARPOST18",
"S_STARPOST19",
"S_STARPOST20",
"S_STARPOST21",
"S_STARPOST22",
"S_STARPOST23",
"S_STARPOST24",
"S_STARPOST25",
"S_STARPOST26",
"S_STARPOST27",
"S_STARPOST28",
"S_STARPOST29",
"S_STARPOST30",
"S_STARPOST31",
"S_STARPOST32",
"S_STARPOST33",
"S_STARPOST34",
"S_STARPOST_IDLE",
"S_STARPOST_FLASH",
"S_STARPOST_SPIN",
// Big floating mine
"S_BIGMINE1",
@ -5472,38 +5411,7 @@ static const char *const STATE_LIST[] = { // array length left dynamic for sanit
"S_PITY10",
// Invincibility Sparkles
"S_IVSP1",
"S_IVSP2",
"S_IVSP3",
"S_IVSP4",
"S_IVSP5",
"S_IVSP6",
"S_IVSP7",
"S_IVSP8",
"S_IVSP9",
"S_IVSP10",
"S_IVSP11",
"S_IVSP12",
"S_IVSP13",
"S_IVSP14",
"S_IVSP15",
"S_IVSP16",
"S_IVSP17",
"S_IVSP18",
"S_IVSP19",
"S_IVSP20",
"S_IVSP21",
"S_IVSP22",
"S_IVSP23",
"S_IVSP24",
"S_IVSP25",
"S_IVSP26",
"S_IVSP27",
"S_IVSP28",
"S_IVSP29",
"S_IVSP30",
"S_IVSP31",
"S_IVSP32",
"S_IVSP",
// Super Sonic Spark
"S_SSPK1",
@ -5690,283 +5598,17 @@ static const char *const STATE_LIST[] = { // array length left dynamic for sanit
"S_RRNG6",
"S_RRNG7",
// Bounce Ring
"S_BOUNCERING1",
"S_BOUNCERING2",
"S_BOUNCERING3",
"S_BOUNCERING4",
"S_BOUNCERING5",
"S_BOUNCERING6",
"S_BOUNCERING7",
"S_BOUNCERING8",
"S_BOUNCERING9",
"S_BOUNCERING10",
"S_BOUNCERING11",
"S_BOUNCERING12",
"S_BOUNCERING13",
"S_BOUNCERING14",
"S_BOUNCERING15",
"S_BOUNCERING16",
"S_BOUNCERING17",
"S_BOUNCERING18",
"S_BOUNCERING19",
"S_BOUNCERING20",
"S_BOUNCERING21",
"S_BOUNCERING22",
"S_BOUNCERING23",
"S_BOUNCERING24",
"S_BOUNCERING25",
"S_BOUNCERING26",
"S_BOUNCERING27",
"S_BOUNCERING28",
"S_BOUNCERING29",
"S_BOUNCERING30",
"S_BOUNCERING31",
"S_BOUNCERING32",
"S_BOUNCERING33",
"S_BOUNCERING34",
"S_BOUNCERING35",
// Rail Ring
"S_RAILRING1",
"S_RAILRING2",
"S_RAILRING3",
"S_RAILRING4",
"S_RAILRING5",
"S_RAILRING6",
"S_RAILRING7",
"S_RAILRING8",
"S_RAILRING9",
"S_RAILRING10",
"S_RAILRING11",
"S_RAILRING12",
"S_RAILRING13",
"S_RAILRING14",
"S_RAILRING15",
"S_RAILRING16",
"S_RAILRING17",
"S_RAILRING18",
"S_RAILRING19",
"S_RAILRING20",
"S_RAILRING21",
"S_RAILRING22",
"S_RAILRING23",
"S_RAILRING24",
"S_RAILRING25",
"S_RAILRING26",
"S_RAILRING27",
"S_RAILRING28",
"S_RAILRING29",
"S_RAILRING30",
"S_RAILRING31",
"S_RAILRING32",
"S_RAILRING33",
"S_RAILRING34",
"S_RAILRING35",
// Infinity ring
"S_INFINITYRING1",
"S_INFINITYRING2",
"S_INFINITYRING3",
"S_INFINITYRING4",
"S_INFINITYRING5",
"S_INFINITYRING6",
"S_INFINITYRING7",
"S_INFINITYRING8",
"S_INFINITYRING9",
"S_INFINITYRING10",
"S_INFINITYRING11",
"S_INFINITYRING12",
"S_INFINITYRING13",
"S_INFINITYRING14",
"S_INFINITYRING15",
"S_INFINITYRING16",
"S_INFINITYRING17",
"S_INFINITYRING18",
"S_INFINITYRING19",
"S_INFINITYRING20",
"S_INFINITYRING21",
"S_INFINITYRING22",
"S_INFINITYRING23",
"S_INFINITYRING24",
"S_INFINITYRING25",
"S_INFINITYRING26",
"S_INFINITYRING27",
"S_INFINITYRING28",
"S_INFINITYRING29",
"S_INFINITYRING30",
"S_INFINITYRING31",
"S_INFINITYRING32",
"S_INFINITYRING33",
"S_INFINITYRING34",
"S_INFINITYRING35",
// Automatic Ring
"S_AUTOMATICRING1",
"S_AUTOMATICRING2",
"S_AUTOMATICRING3",
"S_AUTOMATICRING4",
"S_AUTOMATICRING5",
"S_AUTOMATICRING6",
"S_AUTOMATICRING7",
"S_AUTOMATICRING8",
"S_AUTOMATICRING9",
"S_AUTOMATICRING10",
"S_AUTOMATICRING11",
"S_AUTOMATICRING12",
"S_AUTOMATICRING13",
"S_AUTOMATICRING14",
"S_AUTOMATICRING15",
"S_AUTOMATICRING16",
"S_AUTOMATICRING17",
"S_AUTOMATICRING18",
"S_AUTOMATICRING19",
"S_AUTOMATICRING20",
"S_AUTOMATICRING21",
"S_AUTOMATICRING22",
"S_AUTOMATICRING23",
"S_AUTOMATICRING24",
"S_AUTOMATICRING25",
"S_AUTOMATICRING26",
"S_AUTOMATICRING27",
"S_AUTOMATICRING28",
"S_AUTOMATICRING29",
"S_AUTOMATICRING30",
"S_AUTOMATICRING31",
"S_AUTOMATICRING32",
"S_AUTOMATICRING33",
"S_AUTOMATICRING34",
"S_AUTOMATICRING35",
// Explosion Ring
"S_EXPLOSIONRING1",
"S_EXPLOSIONRING2",
"S_EXPLOSIONRING3",
"S_EXPLOSIONRING4",
"S_EXPLOSIONRING5",
"S_EXPLOSIONRING6",
"S_EXPLOSIONRING7",
"S_EXPLOSIONRING8",
"S_EXPLOSIONRING9",
"S_EXPLOSIONRING10",
"S_EXPLOSIONRING11",
"S_EXPLOSIONRING12",
"S_EXPLOSIONRING13",
"S_EXPLOSIONRING14",
"S_EXPLOSIONRING15",
"S_EXPLOSIONRING16",
"S_EXPLOSIONRING17",
"S_EXPLOSIONRING18",
"S_EXPLOSIONRING19",
"S_EXPLOSIONRING20",
"S_EXPLOSIONRING21",
"S_EXPLOSIONRING22",
"S_EXPLOSIONRING23",
"S_EXPLOSIONRING24",
"S_EXPLOSIONRING25",
"S_EXPLOSIONRING26",
"S_EXPLOSIONRING27",
"S_EXPLOSIONRING28",
"S_EXPLOSIONRING29",
"S_EXPLOSIONRING30",
"S_EXPLOSIONRING31",
"S_EXPLOSIONRING32",
"S_EXPLOSIONRING33",
"S_EXPLOSIONRING34",
"S_EXPLOSIONRING35",
// Scatter Ring
"S_SCATTERRING1",
"S_SCATTERRING2",
"S_SCATTERRING3",
"S_SCATTERRING4",
"S_SCATTERRING5",
"S_SCATTERRING6",
"S_SCATTERRING7",
"S_SCATTERRING8",
"S_SCATTERRING9",
"S_SCATTERRING10",
"S_SCATTERRING11",
"S_SCATTERRING12",
"S_SCATTERRING13",
"S_SCATTERRING14",
"S_SCATTERRING15",
"S_SCATTERRING16",
"S_SCATTERRING17",
"S_SCATTERRING18",
"S_SCATTERRING19",
"S_SCATTERRING20",
"S_SCATTERRING21",
"S_SCATTERRING22",
"S_SCATTERRING23",
"S_SCATTERRING24",
"S_SCATTERRING25",
"S_SCATTERRING26",
"S_SCATTERRING27",
"S_SCATTERRING28",
"S_SCATTERRING29",
"S_SCATTERRING30",
"S_SCATTERRING31",
"S_SCATTERRING32",
"S_SCATTERRING33",
"S_SCATTERRING34",
"S_SCATTERRING35",
// Grenade Ring
"S_GRENADERING1",
"S_GRENADERING2",
"S_GRENADERING3",
"S_GRENADERING4",
"S_GRENADERING5",
"S_GRENADERING6",
"S_GRENADERING7",
"S_GRENADERING8",
"S_GRENADERING9",
"S_GRENADERING10",
"S_GRENADERING11",
"S_GRENADERING12",
"S_GRENADERING13",
"S_GRENADERING14",
"S_GRENADERING15",
"S_GRENADERING16",
"S_GRENADERING17",
"S_GRENADERING18",
"S_GRENADERING19",
"S_GRENADERING20",
"S_GRENADERING21",
"S_GRENADERING22",
"S_GRENADERING23",
"S_GRENADERING24",
"S_GRENADERING25",
"S_GRENADERING26",
"S_GRENADERING27",
"S_GRENADERING28",
"S_GRENADERING29",
"S_GRENADERING30",
"S_GRENADERING31",
"S_GRENADERING32",
"S_GRENADERING33",
"S_GRENADERING34",
"S_GRENADERING35",
// Weapon Ring Ammo
"S_BOUNCERINGAMMO",
"S_RAILRINGAMMO",
"S_INFINITYRINGAMMO",
"S_AUTOMATICRINGAMMO",
"S_EXPLOSIONRINGAMMO",
"S_SCATTERRINGAMMO",
"S_GRENADERINGAMMO",
// Weapon pickup
"S_BOUNCEPICKUP1",
"S_BOUNCEPICKUP2",
"S_BOUNCEPICKUP3",
"S_BOUNCEPICKUP4",
"S_BOUNCEPICKUP5",
"S_BOUNCEPICKUP6",
"S_BOUNCEPICKUP7",
"S_BOUNCEPICKUP8",
"S_BOUNCEPICKUP9",
"S_BOUNCEPICKUP10",
"S_BOUNCEPICKUP11",
"S_BOUNCEPICKUP12",
"S_BOUNCEPICKUP13",
"S_BOUNCEPICKUP14",
"S_BOUNCEPICKUP15",
"S_BOUNCEPICKUP16",
"S_BOUNCEPICKUP",
"S_BOUNCEPICKUPFADE1",
"S_BOUNCEPICKUPFADE2",
"S_BOUNCEPICKUPFADE3",
@ -5976,23 +5618,7 @@ static const char *const STATE_LIST[] = { // array length left dynamic for sanit
"S_BOUNCEPICKUPFADE7",
"S_BOUNCEPICKUPFADE8",
"S_RAILPICKUP1",
"S_RAILPICKUP2",
"S_RAILPICKUP3",
"S_RAILPICKUP4",
"S_RAILPICKUP5",
"S_RAILPICKUP6",
"S_RAILPICKUP7",
"S_RAILPICKUP8",
"S_RAILPICKUP9",
"S_RAILPICKUP10",
"S_RAILPICKUP11",
"S_RAILPICKUP12",
"S_RAILPICKUP13",
"S_RAILPICKUP14",
"S_RAILPICKUP15",
"S_RAILPICKUP16",
"S_RAILPICKUP",
"S_RAILPICKUPFADE1",
"S_RAILPICKUPFADE2",
"S_RAILPICKUPFADE3",
@ -6002,23 +5628,7 @@ static const char *const STATE_LIST[] = { // array length left dynamic for sanit
"S_RAILPICKUPFADE7",
"S_RAILPICKUPFADE8",
"S_AUTOPICKUP1",
"S_AUTOPICKUP2",
"S_AUTOPICKUP3",
"S_AUTOPICKUP4",
"S_AUTOPICKUP5",
"S_AUTOPICKUP6",
"S_AUTOPICKUP7",
"S_AUTOPICKUP8",
"S_AUTOPICKUP9",
"S_AUTOPICKUP10",
"S_AUTOPICKUP11",
"S_AUTOPICKUP12",
"S_AUTOPICKUP13",
"S_AUTOPICKUP14",
"S_AUTOPICKUP15",
"S_AUTOPICKUP16",
"S_AUTOPICKUP",
"S_AUTOPICKUPFADE1",
"S_AUTOPICKUPFADE2",
"S_AUTOPICKUPFADE3",
@ -6028,23 +5638,7 @@ static const char *const STATE_LIST[] = { // array length left dynamic for sanit
"S_AUTOPICKUPFADE7",
"S_AUTOPICKUPFADE8",
"S_EXPLODEPICKUP1",
"S_EXPLODEPICKUP2",
"S_EXPLODEPICKUP3",
"S_EXPLODEPICKUP4",
"S_EXPLODEPICKUP5",
"S_EXPLODEPICKUP6",
"S_EXPLODEPICKUP7",
"S_EXPLODEPICKUP8",
"S_EXPLODEPICKUP9",
"S_EXPLODEPICKUP10",
"S_EXPLODEPICKUP11",
"S_EXPLODEPICKUP12",
"S_EXPLODEPICKUP13",
"S_EXPLODEPICKUP14",
"S_EXPLODEPICKUP15",
"S_EXPLODEPICKUP16",
"S_EXPLODEPICKUP",
"S_EXPLODEPICKUPFADE1",
"S_EXPLODEPICKUPFADE2",
"S_EXPLODEPICKUPFADE3",
@ -6054,23 +5648,7 @@ static const char *const STATE_LIST[] = { // array length left dynamic for sanit
"S_EXPLODEPICKUPFADE7",
"S_EXPLODEPICKUPFADE8",
"S_SCATTERPICKUP1",
"S_SCATTERPICKUP2",
"S_SCATTERPICKUP3",
"S_SCATTERPICKUP4",
"S_SCATTERPICKUP5",
"S_SCATTERPICKUP6",
"S_SCATTERPICKUP7",
"S_SCATTERPICKUP8",
"S_SCATTERPICKUP9",
"S_SCATTERPICKUP10",
"S_SCATTERPICKUP11",
"S_SCATTERPICKUP12",
"S_SCATTERPICKUP13",
"S_SCATTERPICKUP14",
"S_SCATTERPICKUP15",
"S_SCATTERPICKUP16",
"S_SCATTERPICKUP",
"S_SCATTERPICKUPFADE1",
"S_SCATTERPICKUPFADE2",
"S_SCATTERPICKUPFADE3",
@ -6080,23 +5658,7 @@ static const char *const STATE_LIST[] = { // array length left dynamic for sanit
"S_SCATTERPICKUPFADE7",
"S_SCATTERPICKUPFADE8",
"S_GRENADEPICKUP1",
"S_GRENADEPICKUP2",
"S_GRENADEPICKUP3",
"S_GRENADEPICKUP4",
"S_GRENADEPICKUP5",
"S_GRENADEPICKUP6",
"S_GRENADEPICKUP7",
"S_GRENADEPICKUP8",
"S_GRENADEPICKUP9",
"S_GRENADEPICKUP10",
"S_GRENADEPICKUP11",
"S_GRENADEPICKUP12",
"S_GRENADEPICKUP13",
"S_GRENADEPICKUP14",
"S_GRENADEPICKUP15",
"S_GRENADEPICKUP16",
"S_GRENADEPICKUP",
"S_GRENADEPICKUPFADE1",
"S_GRENADEPICKUPFADE2",
"S_GRENADEPICKUPFADE3",
@ -6477,101 +6039,22 @@ static const char *const STATE_LIST[] = { // array length left dynamic for sanit
"S_ROCKSPAWN",
"S_ROCKCRUMBLEA1",
"S_ROCKCRUMBLEA2",
"S_ROCKCRUMBLEA3",
"S_ROCKCRUMBLEA4",
"S_ROCKCRUMBLEA5",
"S_ROCKCRUMBLEB1",
"S_ROCKCRUMBLEB2",
"S_ROCKCRUMBLEB3",
"S_ROCKCRUMBLEB4",
"S_ROCKCRUMBLEB5",
"S_ROCKCRUMBLEC1",
"S_ROCKCRUMBLEC2",
"S_ROCKCRUMBLEC3",
"S_ROCKCRUMBLEC4",
"S_ROCKCRUMBLEC5",
"S_ROCKCRUMBLED1",
"S_ROCKCRUMBLED2",
"S_ROCKCRUMBLED3",
"S_ROCKCRUMBLED4",
"S_ROCKCRUMBLED5",
"S_ROCKCRUMBLEE1",
"S_ROCKCRUMBLEE2",
"S_ROCKCRUMBLEE3",
"S_ROCKCRUMBLEE4",
"S_ROCKCRUMBLEE5",
"S_ROCKCRUMBLEF1",
"S_ROCKCRUMBLEF2",
"S_ROCKCRUMBLEF3",
"S_ROCKCRUMBLEF4",
"S_ROCKCRUMBLEF5",
"S_ROCKCRUMBLEG1",
"S_ROCKCRUMBLEG2",
"S_ROCKCRUMBLEG3",
"S_ROCKCRUMBLEG4",
"S_ROCKCRUMBLEG5",
"S_ROCKCRUMBLEH1",
"S_ROCKCRUMBLEH2",
"S_ROCKCRUMBLEH3",
"S_ROCKCRUMBLEH4",
"S_ROCKCRUMBLEH5",
"S_ROCKCRUMBLEI1",
"S_ROCKCRUMBLEI2",
"S_ROCKCRUMBLEI3",
"S_ROCKCRUMBLEI4",
"S_ROCKCRUMBLEI5",
"S_ROCKCRUMBLEJ1",
"S_ROCKCRUMBLEJ2",
"S_ROCKCRUMBLEJ3",
"S_ROCKCRUMBLEJ4",
"S_ROCKCRUMBLEJ5",
"S_ROCKCRUMBLEK1",
"S_ROCKCRUMBLEK2",
"S_ROCKCRUMBLEK3",
"S_ROCKCRUMBLEK4",
"S_ROCKCRUMBLEK5",
"S_ROCKCRUMBLEL1",
"S_ROCKCRUMBLEL2",
"S_ROCKCRUMBLEL3",
"S_ROCKCRUMBLEL4",
"S_ROCKCRUMBLEL5",
"S_ROCKCRUMBLEM1",
"S_ROCKCRUMBLEM2",
"S_ROCKCRUMBLEM3",
"S_ROCKCRUMBLEM4",
"S_ROCKCRUMBLEM5",
"S_ROCKCRUMBLEN1",
"S_ROCKCRUMBLEN2",
"S_ROCKCRUMBLEN3",
"S_ROCKCRUMBLEN4",
"S_ROCKCRUMBLEN5",
"S_ROCKCRUMBLEO1",
"S_ROCKCRUMBLEO2",
"S_ROCKCRUMBLEO3",
"S_ROCKCRUMBLEO4",
"S_ROCKCRUMBLEO5",
"S_ROCKCRUMBLEP1",
"S_ROCKCRUMBLEP2",
"S_ROCKCRUMBLEP3",
"S_ROCKCRUMBLEP4",
"S_ROCKCRUMBLEP5",
"S_ROCKCRUMBLEA",
"S_ROCKCRUMBLEB",
"S_ROCKCRUMBLEC",
"S_ROCKCRUMBLED",
"S_ROCKCRUMBLEE",
"S_ROCKCRUMBLEF",
"S_ROCKCRUMBLEG",
"S_ROCKCRUMBLEH",
"S_ROCKCRUMBLEI",
"S_ROCKCRUMBLEJ",
"S_ROCKCRUMBLEK",
"S_ROCKCRUMBLEL",
"S_ROCKCRUMBLEM",
"S_ROCKCRUMBLEN",
"S_ROCKCRUMBLEO",
"S_ROCKCRUMBLEP",
"S_SRB1_CRAWLA1",
"S_SRB1_CRAWLA2",
@ -7494,6 +6977,8 @@ struct {
{"PUSHACCEL",PUSHACCEL},
{"MODID",MODID}, // I don't know, I just thought it would be cool for a wad to potentially know what mod it was loaded into.
{"CODEBASE",CODEBASE}, // or what release of SRB2 this is.
{"VERSION",VERSION}, // Grab the game's version!
{"SUBVERSION",SUBVERSION}, // more precise version number
// Special linedef executor tag numbers!
{"LE_PINCHPHASE",LE_PINCHPHASE}, // A boss entered pinch phase (and, in most cases, is preparing their pinch phase attack!)
@ -7506,6 +6991,7 @@ struct {
// Frame settings
{"FF_FRAMEMASK",FF_FRAMEMASK},
{"FF_ANIMATE",FF_ANIMATE},
{"FF_FULLBRIGHT",FF_FULLBRIGHT},
{"FF_TRANSMASK",FF_TRANSMASK},
{"FF_TRANSSHIFT",FF_TRANSSHIFT},
@ -7984,6 +7470,46 @@ static sfxenum_t get_sfx(const char *word)
return sfx_None;
}
#ifdef MUSICSLOT_COMPATIBILITY
static UINT16 get_mus(const char *word, UINT8 dehacked_mode)
{ // Returns the value of MUS_ enumerations
UINT16 i;
char lumptmp[4];
if (*word >= '0' && *word <= '9')
return atoi(word);
if (!word[2] && toupper(word[0]) >= 'A' && toupper(word[0]) <= 'Z')
return (UINT16)M_MapNumber(word[0], word[1]);
if (fastncmp("MUS_",word,4))
word += 4; // take off the MUS_
else if (fastncmp("O_",word,2) || fastncmp("D_",word,2))
word += 2; // take off the O_ or D_
strncpy(lumptmp, word, 4);
lumptmp[3] = 0;
if (fasticmp("MAP",lumptmp))
{
word += 3;
if (toupper(word[0]) >= 'A' && toupper(word[0]) <= 'Z')
return (UINT16)M_MapNumber(word[0], word[1]);
else if ((i = atoi(word)))
return i;
word -= 3;
if (dehacked_mode)
deh_warning("Couldn't find music named 'MUS_%s'",word);
return 0;
}
for (i = 0; compat_special_music_slots[i][0]; ++i)
if (fasticmp(word, compat_special_music_slots[i]))
return i + 1036;
if (dehacked_mode)
deh_warning("Couldn't find music named 'MUS_%s'",word);
return 0;
}
#endif
static hudnum_t get_huditem(const char *word)
{ // Returns the value of HUD_ enumerations
hudnum_t i;
@ -8182,6 +7708,13 @@ static fixed_t find_const(const char **rword)
free(word);
return r;
}
#ifdef MUSICSLOT_COMPATIBILITY
else if (fastncmp("MUS_",word,4) || fastncmp("O_",word,2)) {
r = get_mus(word, true);
free(word);
return r;
}
#endif
else if (fastncmp("PW_",word,3)) {
r = get_power(word);
free(word);
@ -8572,6 +8105,29 @@ static inline int lib_getenum(lua_State *L)
if (mathlib) return luaL_error(L, "sfx '%s' could not be found.\n", word);
return 0;
}
#ifdef MUSICSLOT_COMPATIBILITY
else if (!mathlib && fastncmp("mus_",word,4)) {
p = word+4;
if ((i = get_mus(p, false)) == 0)
return 0;
lua_pushinteger(L, i);
return 1;
}
else if (mathlib && fastncmp("MUS_",word,4)) { // SOCs are ALL CAPS!
p = word+4;
if ((i = get_mus(p, false)) == 0)
return luaL_error(L, "music '%s' could not be found.\n", word);
lua_pushinteger(L, i);
return 1;
}
else if (mathlib && (fastncmp("O_",word,2) || fastncmp("D_",word,2))) {
p = word+2;
if ((i = get_mus(p, false)) == 0)
return luaL_error(L, "music '%s' could not be found.\n", word);
lua_pushinteger(L, i);
return 1;
}
#endif
else if (!mathlib && fastncmp("pw_",word,3)) {
p = word+3;
for (i = 0; i < NUMPOWERS; i++)
@ -8745,6 +8301,9 @@ static inline int lib_getenum(lua_State *L)
} else if (fastcmp(word,"gravity")) {
lua_pushinteger(L, gravity);
return 1;
} else if (fastcmp(word,"VERSIONSTRING")) {
lua_pushstring(L, VERSIONSTRING);
return 1;
}
return 0;
@ -8799,4 +8358,3 @@ void LUA_SetActionByName(void *state, const char *actiontocompare)
}
#endif // HAVE_BLUA

View file

@ -210,13 +210,6 @@ extern FILE *logstream;
// Note that we use this to help keep internal testing in check; this is why v2.1.0 is not version "1".
#define MODVERSION 20
// some tests, enable or disable it if it run or not
#define SPLITSCREEN
// =========================================================================
// The maximum number of players, multiplayer/networking.
@ -356,11 +349,7 @@ void CONS_Debug(INT32 debugflags, const char *fmt, ...) FUNCDEBUG;
#include "m_swap.h"
// Things that used to be in dstrings.h
#define DEVMAPS "devmaps"
#define DEVDATA "devdata"
#define SAVEGAMENAME "srb2sav"
char savegamename[256];
// m_misc.h
@ -505,5 +494,8 @@ extern const char *compdate, *comptime, *comprevision, *compbranch;
/// Experimental tweaks to analog mode. (Needs a lot of work before it's ready for primetime.)
//#define REDSANALOG
#endif // __DOOMDEF__
/// Backwards compatibility with musicslots.
/// \note You should leave this enabled unless you're working with a future SRB2 version.
#define MUSICSLOT_COMPATIBILITY
#endif // __DOOMDEF__

View file

@ -603,7 +603,7 @@ static void F_IntroDrawScene(void)
if (finalecount-84 < 58) { // Pure Fat is driving up!
int ftime = (finalecount-84);
x = (-189<<FRACBITS) + (FixedMul((6<<FRACBITS)+FRACUNIT/3, ftime<<FRACBITS) - FixedMul((6<<FRACBITS)+FRACUNIT/3, FixedDiv(FixedMul(ftime<<FRACBITS, ftime<<FRACBITS), 120<<FRACBITS)));
x = (-189*FRACUNIT) + (FixedMul((6<<FRACBITS)+FRACUNIT/3, ftime<<FRACBITS) - FixedMul((6<<FRACBITS)+FRACUNIT/3, FixedDiv(FixedMul(ftime<<FRACBITS, ftime<<FRACBITS), 120<<FRACBITS)));
y = (BASEVIDHEIGHT<<FRACBITS) - FixedMul(417<<FRACBITS, aspect);
// Draw the body
V_DrawSciencePatch(x, y, V_SNAPTOLEFT|V_SNAPTOBOTTOM, (patch = W_CachePatchName("PUREFAT1", PU_CACHE)), aspect);
@ -977,6 +977,7 @@ static const char *credits[] = {
"\"Monster\" Iestyn Jealous",
"Ronald \"Furyhunter\" Kinard", // The SDL2 port
"John \"JTE\" Muniz",
"Ehab \"Wolfy\" Saeed",
"\"SSNTails\"",
"Matthew \"Inuyasha\" Walsh",
"",
@ -985,6 +986,7 @@ static const char *credits[] = {
"\"chi.miru\"", // Red's secret weapon, the REAL reason slopes exist (also helped port drawing code from ZDoom)
"Andrew \"orospakr\" Clunis",
"Gregor \"Oogaland\" Dick",
"Vivian \"toaster\" Grannell",
"Julio \"Chaos Zero 64\" Guir",
"\"Kalaron\"", // Coded some of Sryder13's collection of OpenGL fixes, especially fog
"Matthew \"Shuffle\" Marsalko",
@ -1000,6 +1002,7 @@ static const char *credits[] = {
"Jim \"MotorRoach\" DeMello",
"Desmond \"Blade\" DesJardins",
"Sherman \"CoatRack\" DesJardins",
"Vivian \"toaster\" Grannell",
"Andrew \"Senku Niola\" Moran",
"David \"Instant Sonic\" Spencer Jr.",
"\"SSNTails\"",
@ -1020,7 +1023,7 @@ static const char *credits[] = {
"\"Monster\" Iestyn Jealous",
"Jarel \"Arrow\" Jones",
"Stefan \"Stuf\" Rimalia",
"Shane Strife",
"Shane Mychal Sexton",
"\"Spazzo\"",
"David \"Big Wave Dave\" Spencer Sr.",
"David \"Instant Sonic\" Spencer Jr.",
@ -1033,6 +1036,7 @@ static const char *credits[] = {
"Sherman \"CoatRack\" DesJardins",
"Ben \"Mystic\" Geyer",
"Nathan \"Jazz\" Giroux",
"Vivian \"toaster\" Grannell",
"Dan \"Blitzzo\" Hagerstrand",
"Kepa \"Nev3r\" Iceta",
"Thomas \"Shadow Hog\" Igoe",
@ -1069,7 +1073,7 @@ static const char *credits[] = {
"iD Software",
"Alex \"MistaED\" Fuller",
"FreeDoom Project", // Used some of the mancubus and rocket launcher sprites for Brak
"Randy Heit (<!>)", // For his MSPaint <!> sprite that we nicked
"Randi Heit (<!>)", // For their MSPaint <!> sprite that we nicked
"",
"\1Produced By",
"Sonic Team Junior",

View file

@ -90,6 +90,7 @@ enum
// custom intermissions
wipe_specinter_toblack,
wipe_multinter_toblack,
wipe_speclevel_towhite,
wipe_level_final,
wipe_intermission_final,
@ -108,7 +109,7 @@ enum
NUMWIPEDEFS
};
#define WIPEFINALSHIFT 12
#define WIPEFINALSHIFT 13
extern UINT8 wipedefs[NUMWIPEDEFS];
#endif

View file

@ -58,6 +58,7 @@ UINT8 wipedefs[NUMWIPEDEFS] = {
0, // wipe_specinter_toblack
0, // wipe_multinter_toblack
0, // wipe_speclevel_towhite
0, // wipe_level_final
0, // wipe_intermission_final

View file

@ -4340,10 +4340,8 @@ void G_GhostTicker(void)
switch(g->color)
{
case GHC_SUPER: // Super Sonic (P_DoSuperStuff)
if (leveltime % 9 < 5)
g->mo->color = SKINCOLOR_SUPER1 + leveltime % 9;
else
g->mo->color = SKINCOLOR_SUPER1 + 9 - leveltime % 9;
g->mo->color = SKINCOLOR_SUPER1;
g->mo->color += abs( ( ( leveltime >> 1 ) % 9) - 4);
break;
case GHC_INVINCIBLE: // Mario invincibility (P_CheckInvincibilityTimer)
g->mo->color = (UINT8)(leveltime % MAXSKINCOLORS);
@ -5587,7 +5585,7 @@ boolean G_CheckDemoStatus(void)
free(demobuffer);
demorecording = false;
if (!modeattacking == ATTACKING_RECORD)
if (modeattacking != ATTACKING_RECORD)
{
if (saved)
CONS_Printf(M_GetText("Demo %s recorded\n"), demoname);

View file

@ -16,7 +16,6 @@
#include "g_input.h"
#include "keys.h"
#include "hu_stuff.h" // need HUFONT start & end
#include "keys.h"
#include "d_net.h"
#include "console.h"
@ -1042,13 +1041,13 @@ INT32 G_KeyStringtoNum(const char *keystr)
if (!keystr[1] && keystr[0] > ' ' && keystr[0] <= 'z')
return keystr[0];
if (!strncmp(keystr, "KEY", 3) && keystr[3] >= '0' && keystr[3] <= '9')
return atoi(&keystr[3]);
for (j = 0; j < NUMKEYNAMES; j++)
if (!stricmp(keynames[j].name, keystr))
return keynames[j].keynum;
if (strlen(keystr) > 3)
return atoi(&keystr[3]);
return 0;
}

View file

@ -229,4 +229,3 @@ enum hwdfiltermode
#endif //_HWR_DEFS_

View file

@ -2856,7 +2856,6 @@ static void HWR_AddPolyObjectPlanes(void)
// : Draw one or more line segments.
// Notes : Sets gr_cursectorlight to the light of the parent sector, to modulate wall textures
// -----------------+
static lumpnum_t doomwaterflat; //set by R_InitFlats hack
static void HWR_Subsector(size_t num)
{
INT16 count;
@ -2867,7 +2866,6 @@ static void HWR_Subsector(size_t num)
INT32 ceilinglightlevel;
INT32 locFloorHeight, locCeilingHeight;
INT32 light = 0;
fixed_t wh;
extracolormap_t *floorcolormap;
extracolormap_t *ceilingcolormap;
@ -3193,26 +3191,6 @@ static void HWR_Subsector(size_t num)
}
}
//20/08/99: Changed by Hurdler (taken from faB's code)
#ifdef DOPLANES
// -------------------- WATER IN DEV. TEST ------------------------
//dck hack : use abs(tag) for waterheight
//ilag : Since we changed to UINT16 for sector tags, simulate INT16
if (gr_frontsector->tag > 32767)
{
wh = ((65535-gr_frontsector->tag) <<FRACBITS) + (FRACUNIT/2);
if (wh > gr_frontsector->floorheight &&
wh < gr_frontsector->ceilingheight)
{
HWR_GetFlat(doomwaterflat);
HWR_RenderPlane(gr_frontsector,
&extrasubsectors[num], wh, PF_Translucent,
gr_frontsector->lightlevel, doomwaterflat,
NULL, 255, false, gr_frontsector->lightlist[light].extra_colormap);
}
}
// -------------------- WATER IN DEV. TEST ------------------------
#endif
sub->validcount = validcount;
}
@ -5499,11 +5477,6 @@ void HWR_Startup(void)
HWR_AddEngineCommands();
HWR_InitTextureCache();
// for test water translucent surface
doomwaterflat = W_CheckNumForName("FWATER1");
if (doomwaterflat == LUMPERROR) // if FWATER1 not found (in doom shareware)
doomwaterflat = W_GetNumForName("WATER0");
HWR_InitMD2();
#ifdef ALAM_LIGHTING

View file

@ -41,6 +41,7 @@
#include "../r_things.h"
#include "hw_main.h"
#include "../v_video.h"
#ifdef HAVE_PNG
#ifndef _MSC_VER
@ -881,6 +882,59 @@ static void md2_loadTexture(md2_t *model)
HWR_UnlockCachedPatch(grpatch);
}
// -----------------+
// md2_loadBlendTexture : Download a pcx or png texture for blending MD2 models
// -----------------+
static void md2_loadBlendTexture(md2_t *model)
{
GLPatch_t *grpatch;
char *filename = Z_Malloc(strlen(model->filename)+7, PU_STATIC, NULL);
strcpy(filename, model->filename);
FIL_ForceExtension(filename, "_blend.png");
if (model->blendgrpatch)
{
grpatch = model->blendgrpatch;
Z_Free(grpatch->mipmap.grInfo.data);
}
else
grpatch = Z_Calloc(sizeof *grpatch, PU_HWRPATCHINFO,
&(model->blendgrpatch));
if (!grpatch->mipmap.downloaded && !grpatch->mipmap.grInfo.data)
{
int w = 0, h = 0;
#ifdef HAVE_PNG
grpatch->mipmap.grInfo.format = PNG_Load(filename, &w, &h, grpatch);
if (grpatch->mipmap.grInfo.format == 0)
#endif
grpatch->mipmap.grInfo.format = PCX_Load(filename, &w, &h, grpatch);
if (grpatch->mipmap.grInfo.format == 0)
{
Z_Free(filename);
return;
}
grpatch->mipmap.downloaded = 0;
grpatch->mipmap.flags = 0;
grpatch->width = (INT16)w;
grpatch->height = (INT16)h;
grpatch->mipmap.width = (UINT16)w;
grpatch->mipmap.height = (UINT16)h;
// not correct!
grpatch->mipmap.grInfo.smallLodLog2 = GR_LOD_LOG2_256;
grpatch->mipmap.grInfo.largeLodLog2 = GR_LOD_LOG2_256;
grpatch->mipmap.grInfo.aspectRatioLog2 = GR_ASPECT_LOG2_1x1;
}
HWD.pfnSetTexture(&grpatch->mipmap); // We do need to do this so that it can be cleared and knows to recreate it when necessary
HWR_UnlockCachedPatch(grpatch);
Z_Free(filename);
}
// Don't spam the console, or the OS with fopen requests!
static boolean nomd2s = false;
@ -1050,6 +1104,238 @@ spritemd2found:
fclose(f);
}
static void HWR_CreateBlendedTexture(GLPatch_t *gpatch, GLPatch_t *blendgpatch, GLMipmap_t *grmip, skincolors_t color)
{
UINT16 w = gpatch->width, h = gpatch->height;
UINT32 size = w*h;
RGBA_t *image, *blendimage, *cur, blendcolor;
if (grmip->width == 0)
{
grmip->width = gpatch->width;
grmip->height = gpatch->height;
// no wrap around, no chroma key
grmip->flags = 0;
// setup the texture info
grmip->grInfo.format = GR_RGBA;
}
Z_Free(grmip->grInfo.data);
grmip->grInfo.data = NULL;
cur = Z_Malloc(size*4, PU_HWRCACHE, &grmip->grInfo.data);
memset(cur, 0x00, size*4);
image = gpatch->mipmap.grInfo.data;
blendimage = blendgpatch->mipmap.grInfo.data;
switch (color)
{
case SKINCOLOR_WHITE:
blendcolor = V_GetColor(3);
break;
case SKINCOLOR_SILVER:
blendcolor = V_GetColor(10);
break;
case SKINCOLOR_GREY:
blendcolor = V_GetColor(15);
break;
case SKINCOLOR_BLACK:
blendcolor = V_GetColor(27);
break;
case SKINCOLOR_BEIGE:
blendcolor = V_GetColor(247);
break;
case SKINCOLOR_PEACH:
blendcolor = V_GetColor(218);
break;
case SKINCOLOR_BROWN:
blendcolor = V_GetColor(234);
break;
case SKINCOLOR_RED:
blendcolor = V_GetColor(38);
break;
case SKINCOLOR_CRIMSON:
blendcolor = V_GetColor(45);
break;
case SKINCOLOR_ORANGE:
blendcolor = V_GetColor(54);
break;
case SKINCOLOR_RUST:
blendcolor = V_GetColor(60);
break;
case SKINCOLOR_GOLD:
blendcolor = V_GetColor(67);
break;
case SKINCOLOR_YELLOW:
blendcolor = V_GetColor(73);
break;
case SKINCOLOR_TAN:
blendcolor = V_GetColor(85);
break;
case SKINCOLOR_MOSS:
blendcolor = V_GetColor(92);
break;
case SKINCOLOR_PERIDOT:
blendcolor = V_GetColor(188);
break;
case SKINCOLOR_GREEN:
blendcolor = V_GetColor(101);
break;
case SKINCOLOR_EMERALD:
blendcolor = V_GetColor(112);
break;
case SKINCOLOR_AQUA:
blendcolor = V_GetColor(122);
break;
case SKINCOLOR_TEAL:
blendcolor = V_GetColor(141);
break;
case SKINCOLOR_CYAN:
blendcolor = V_GetColor(131);
break;
case SKINCOLOR_BLUE:
blendcolor = V_GetColor(152);
break;
case SKINCOLOR_AZURE:
blendcolor = V_GetColor(171);
break;
case SKINCOLOR_PASTEL:
blendcolor = V_GetColor(161);
break;
case SKINCOLOR_PURPLE:
blendcolor = V_GetColor(165);
break;
case SKINCOLOR_LAVENDER:
blendcolor = V_GetColor(195);
break;
case SKINCOLOR_MAGENTA:
blendcolor = V_GetColor(183);
break;
case SKINCOLOR_PINK:
blendcolor = V_GetColor(211);
break;
case SKINCOLOR_ROSY:
blendcolor = V_GetColor(202);
break;
case SKINCOLOR_SUPER1:
blendcolor = V_GetColor(80);
break;
case SKINCOLOR_SUPER2:
blendcolor = V_GetColor(83);
break;
case SKINCOLOR_SUPER3:
blendcolor = V_GetColor(73);
break;
case SKINCOLOR_SUPER4:
blendcolor = V_GetColor(64);
break;
case SKINCOLOR_SUPER5:
blendcolor = V_GetColor(67);
break;
case SKINCOLOR_TSUPER1:
case SKINCOLOR_TSUPER2:
case SKINCOLOR_TSUPER3:
case SKINCOLOR_TSUPER4:
case SKINCOLOR_TSUPER5:
case SKINCOLOR_KSUPER1:
case SKINCOLOR_KSUPER2:
case SKINCOLOR_KSUPER3:
case SKINCOLOR_KSUPER4:
case SKINCOLOR_KSUPER5:
default:
blendcolor = V_GetColor(255);
break;
}
while (size--)
{
if (blendimage->s.alpha == 0)
{
// Don't bother with blending the pixel if the alpha of the blend pixel is 0
cur->rgba = image->rgba;
}
else
{
INT32 tempcolor;
INT16 tempmult, tempalpha;
tempalpha = -(abs(blendimage->s.red-127)-127)*2;
if (tempalpha > 255)
tempalpha = 255;
else if (tempalpha < 0)
tempalpha = 0;
tempmult = (blendimage->s.red-127)*2;
if (tempmult > 255)
tempmult = 255;
else if (tempmult < 0)
tempmult = 0;
tempcolor = (image->s.red*(255-blendimage->s.alpha))/255 + ((tempmult + ((tempalpha*blendcolor.s.red)/255)) * blendimage->s.alpha)/255;
cur->s.red = (UINT8)tempcolor;
tempcolor = (image->s.green*(255-blendimage->s.alpha))/255 + ((tempmult + ((tempalpha*blendcolor.s.green)/255)) * blendimage->s.alpha)/255;
cur->s.green = (UINT8)tempcolor;
tempcolor = (image->s.blue*(255-blendimage->s.alpha))/255 + ((tempmult + ((tempalpha*blendcolor.s.blue)/255)) * blendimage->s.alpha)/255;
cur->s.blue = (UINT8)tempcolor;
cur->s.alpha = image->s.alpha;
}
cur++; image++; blendimage++;
}
return;
}
static void HWR_GetBlendedTexture(GLPatch_t *gpatch, GLPatch_t *blendgpatch, const UINT8 *colormap, skincolors_t color)
{
// mostly copied from HWR_GetMappedPatch, hence the similarities and comment
GLMipmap_t *grmip, *newmip;
if (colormap == colormaps || colormap == NULL)
{
// Don't do any blending
HWD.pfnSetTexture(&gpatch->mipmap);
return;
}
// search for the mimmap
// skip the first (no colormap translated)
for (grmip = &gpatch->mipmap; grmip->nextcolormap; )
{
grmip = grmip->nextcolormap;
if (grmip->colormap == colormap)
{
if (grmip->downloaded && grmip->grInfo.data)
{
HWD.pfnSetTexture(grmip); // found the colormap, set it to the correct texture
Z_ChangeTag(grmip->grInfo.data, PU_HWRCACHE_UNLOCKED);
return;
}
}
}
// If here, the blended texture has not been created
// So we create it
//BP: WARNING: don't free it manually without clearing the cache of harware renderer
// (it have a liste of mipmap)
// this malloc is cleared in HWR_FreeTextureCache
// (...) unfortunately z_malloc fragment alot the memory :(so malloc is better
newmip = calloc(1, sizeof (*newmip));
if (newmip == NULL)
I_Error("%s: Out of memory", "HWR_GetMappedPatch");
grmip->nextcolormap = newmip;
newmip->colormap = colormap;
HWR_CreateBlendedTexture(gpatch, blendgpatch, newmip, color);
HWD.pfnSetTexture(newmip);
Z_ChangeTag(newmip->grInfo.data, PU_HWRCACHE_UNLOCKED);
}
// -----------------+
// HWR_DrawMD2 : Draw MD2
@ -1180,13 +1466,25 @@ void HWR_DrawMD2(gr_vissprite_t *spr)
gpatch = md2->grpatch;
if (!gpatch || !gpatch->mipmap.grInfo.format || !gpatch->mipmap.downloaded)
md2_loadTexture(md2);
gpatch = md2->grpatch; // Load it again, because it isn't being loaded into gpatch after md2_loadtexture...
if ((gpatch && gpatch->mipmap.grInfo.format) // don't load the blend texture if the base texture isn't available
&& (!md2->blendgrpatch || !((GLPatch_t *)md2->blendgrpatch)->mipmap.grInfo.format || !((GLPatch_t *)md2->blendgrpatch)->mipmap.downloaded))
md2_loadBlendTexture(md2);
if (gpatch && gpatch->mipmap.grInfo.format) // else if meant that if a texture couldn't be loaded, it would just end up using something else's texture
{
// This is safe, since we know the texture has been downloaded
HWD.pfnSetTexture(&gpatch->mipmap);
if ((skincolors_t)spr->mobj->color != SKINCOLOR_NONE &&
md2->blendgrpatch && ((GLPatch_t *)md2->blendgrpatch)->mipmap.grInfo.format
&& gpatch->width == ((GLPatch_t *)md2->blendgrpatch)->width && gpatch->height == ((GLPatch_t *)md2->blendgrpatch)->height)
{
HWR_GetBlendedTexture(gpatch, (GLPatch_t *)md2->blendgrpatch, spr->colormap, (skincolors_t)spr->mobj->color);
}
else
{
// This is safe, since we know the texture has been downloaded
HWD.pfnSetTexture(&gpatch->mipmap);
}
}
else
{
@ -1195,16 +1493,37 @@ void HWR_DrawMD2(gr_vissprite_t *spr)
HWR_GetMappedPatch(gpatch, spr->colormap);
}
if (spr->mobj->frame & FF_ANIMATE)
{
// set duration and tics to be the correct values for FF_ANIMATE states
durs = spr->mobj->state->var2;
tics = spr->mobj->anim_duration;
}
//FIXME: this is not yet correct
frame = (spr->mobj->frame & FF_FRAMEMASK) % md2->model->header.numFrames;
buff = md2->model->glCommandBuffer;
curr = &md2->model->frames[frame];
if (cv_grmd2.value == 1
&& spr->mobj->state->nextstate != S_NULL && states[spr->mobj->state->nextstate].sprite != SPR_NULL
&& !(spr->mobj->player && spr->mobj->state->nextstate == S_PLAY_WAIT && spr->mobj->state == &states[S_PLAY_STND]))
if (cv_grmd2.value == 1)
{
const INT32 nextframe = (states[spr->mobj->state->nextstate].frame & FF_FRAMEMASK) % md2->model->header.numFrames;
next = &md2->model->frames[nextframe];
// frames are handled differently for states with FF_ANIMATE, so get the next frame differently for the interpolation
if (spr->mobj->frame & FF_ANIMATE)
{
UINT32 nextframe = (spr->mobj->frame & FF_FRAMEMASK) + 1;
if (nextframe >= (UINT32)spr->mobj->state->var1)
nextframe = (spr->mobj->state->frame & FF_FRAMEMASK);
nextframe %= md2->model->header.numFrames;
next = &md2->model->frames[nextframe];
}
else
{
if (spr->mobj->state->nextstate != S_NULL && states[spr->mobj->state->nextstate].sprite != SPR_NULL
&& !(spr->mobj->player && spr->mobj->state->nextstate == S_PLAY_WAIT && spr->mobj->state == &states[S_PLAY_STND]))
{
const UINT32 nextframe = (states[spr->mobj->state->nextstate].frame & FF_FRAMEMASK) % md2->model->header.numFrames;
next = &md2->model->frames[nextframe];
}
}
}
//Hurdler: it seems there is still a small problem with mobj angle

View file

@ -120,6 +120,7 @@ typedef struct
float offset;
md2_model_t *model;
void *grpatch;
void *blendgrpatch;
boolean notfound;
INT32 skin;
} md2_t;

View file

@ -2371,7 +2371,7 @@ EXPORT void HWRAPI(MakeScreenTexture) (void)
Clamp2D(GL_TEXTURE_WRAP_S);
Clamp2D(GL_TEXTURE_WRAP_T);
#ifndef KOS_GL_COMPATIBILITY
pglCopyTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, 0, 0, texsize, texsize, 0);
pglCopyTexImage2D(GL_TEXTURE_2D, 0, GL_RGB, 0, 0, texsize, texsize, 0);
#endif
tex_downloaded = 0; // 0 so it knows it doesn't have any of the cached patches downloaded right now
@ -2399,7 +2399,7 @@ EXPORT void HWRAPI(MakeScreenFinalTexture) (void)
Clamp2D(GL_TEXTURE_WRAP_S);
Clamp2D(GL_TEXTURE_WRAP_T);
#ifndef KOS_GL_COMPATIBILITY
pglCopyTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, 0, 0, texsize, texsize, 0);
pglCopyTexImage2D(GL_TEXTURE_2D, 0, GL_RGB, 0, 0, texsize, texsize, 0);
#endif
tex_downloaded = 0; // 0 so it knows it doesn't have any of the cached patches downloaded right now

File diff suppressed because it is too large Load diff

View file

@ -1479,30 +1479,7 @@ typedef enum state
S_MSSHIELD_F12,
// Ring
S_RING1,
S_RING2,
S_RING3,
S_RING4,
S_RING5,
S_RING6,
S_RING7,
S_RING8,
S_RING9,
S_RING10,
S_RING11,
S_RING12,
S_RING13,
S_RING14,
S_RING15,
S_RING16,
S_RING17,
S_RING18,
S_RING19,
S_RING20,
S_RING21,
S_RING22,
S_RING23,
S_RING24,
S_RING,
// Blue Sphere for special stages
S_BLUEBALL,
@ -1518,39 +1495,10 @@ typedef enum state
S_GRAVWELLRED3,
// Individual Team Rings
S_TEAMRING1,
S_TEAMRING2,
S_TEAMRING3,
S_TEAMRING4,
S_TEAMRING5,
S_TEAMRING6,
S_TEAMRING7,
S_TEAMRING8,
S_TEAMRING9,
S_TEAMRING10,
S_TEAMRING11,
S_TEAMRING12,
S_TEAMRING13,
S_TEAMRING14,
S_TEAMRING15,
S_TEAMRING16,
S_TEAMRING17,
S_TEAMRING18,
S_TEAMRING19,
S_TEAMRING20,
S_TEAMRING21,
S_TEAMRING22,
S_TEAMRING23,
S_TEAMRING24,
S_TEAMRING,
// Special Stage Token
S_EMMY1,
S_EMMY2,
S_EMMY3,
S_EMMY4,
S_EMMY5,
S_EMMY6,
S_EMMY7,
S_EMMY,
// Special Stage Token
S_TOKEN,
@ -1704,40 +1652,9 @@ typedef enum state
S_SPIKED2,
// Starpost
S_STARPOST1,
S_STARPOST2,
S_STARPOST3,
S_STARPOST4,
S_STARPOST5,
S_STARPOST6,
S_STARPOST7,
S_STARPOST8,
S_STARPOST9,
S_STARPOST10,
S_STARPOST11,
S_STARPOST12,
S_STARPOST13,
S_STARPOST14,
S_STARPOST15,
S_STARPOST16,
S_STARPOST17,
S_STARPOST18,
S_STARPOST19,
S_STARPOST20,
S_STARPOST21,
S_STARPOST22,
S_STARPOST23,
S_STARPOST24,
S_STARPOST25,
S_STARPOST26,
S_STARPOST27,
S_STARPOST28,
S_STARPOST29,
S_STARPOST30,
S_STARPOST31,
S_STARPOST32,
S_STARPOST33,
S_STARPOST34,
S_STARPOST_IDLE,
S_STARPOST_FLASH,
S_STARPOST_SPIN,
// Big floating mine
S_BIGMINE1,
@ -2345,38 +2262,7 @@ typedef enum state
S_PITY10,
// Invincibility Sparkles
S_IVSP1,
S_IVSP2,
S_IVSP3,
S_IVSP4,
S_IVSP5,
S_IVSP6,
S_IVSP7,
S_IVSP8,
S_IVSP9,
S_IVSP10,
S_IVSP11,
S_IVSP12,
S_IVSP13,
S_IVSP14,
S_IVSP15,
S_IVSP16,
S_IVSP17,
S_IVSP18,
S_IVSP19,
S_IVSP20,
S_IVSP21,
S_IVSP22,
S_IVSP23,
S_IVSP24,
S_IVSP25,
S_IVSP26,
S_IVSP27,
S_IVSP28,
S_IVSP29,
S_IVSP30,
S_IVSP31,
S_IVSP32,
S_IVSP,
// Super Sonic Spark
S_SSPK1,
@ -2563,283 +2449,17 @@ typedef enum state
S_RRNG6,
S_RRNG7,
// Bounce Ring
S_BOUNCERING1,
S_BOUNCERING2,
S_BOUNCERING3,
S_BOUNCERING4,
S_BOUNCERING5,
S_BOUNCERING6,
S_BOUNCERING7,
S_BOUNCERING8,
S_BOUNCERING9,
S_BOUNCERING10,
S_BOUNCERING11,
S_BOUNCERING12,
S_BOUNCERING13,
S_BOUNCERING14,
S_BOUNCERING15,
S_BOUNCERING16,
S_BOUNCERING17,
S_BOUNCERING18,
S_BOUNCERING19,
S_BOUNCERING20,
S_BOUNCERING21,
S_BOUNCERING22,
S_BOUNCERING23,
S_BOUNCERING24,
S_BOUNCERING25,
S_BOUNCERING26,
S_BOUNCERING27,
S_BOUNCERING28,
S_BOUNCERING29,
S_BOUNCERING30,
S_BOUNCERING31,
S_BOUNCERING32,
S_BOUNCERING33,
S_BOUNCERING34,
S_BOUNCERING35,
// Rail Ring
S_RAILRING1,
S_RAILRING2,
S_RAILRING3,
S_RAILRING4,
S_RAILRING5,
S_RAILRING6,
S_RAILRING7,
S_RAILRING8,
S_RAILRING9,
S_RAILRING10,
S_RAILRING11,
S_RAILRING12,
S_RAILRING13,
S_RAILRING14,
S_RAILRING15,
S_RAILRING16,
S_RAILRING17,
S_RAILRING18,
S_RAILRING19,
S_RAILRING20,
S_RAILRING21,
S_RAILRING22,
S_RAILRING23,
S_RAILRING24,
S_RAILRING25,
S_RAILRING26,
S_RAILRING27,
S_RAILRING28,
S_RAILRING29,
S_RAILRING30,
S_RAILRING31,
S_RAILRING32,
S_RAILRING33,
S_RAILRING34,
S_RAILRING35,
// Infinity Ring
S_INFINITYRING1,
S_INFINITYRING2,
S_INFINITYRING3,
S_INFINITYRING4,
S_INFINITYRING5,
S_INFINITYRING6,
S_INFINITYRING7,
S_INFINITYRING8,
S_INFINITYRING9,
S_INFINITYRING10,
S_INFINITYRING11,
S_INFINITYRING12,
S_INFINITYRING13,
S_INFINITYRING14,
S_INFINITYRING15,
S_INFINITYRING16,
S_INFINITYRING17,
S_INFINITYRING18,
S_INFINITYRING19,
S_INFINITYRING20,
S_INFINITYRING21,
S_INFINITYRING22,
S_INFINITYRING23,
S_INFINITYRING24,
S_INFINITYRING25,
S_INFINITYRING26,
S_INFINITYRING27,
S_INFINITYRING28,
S_INFINITYRING29,
S_INFINITYRING30,
S_INFINITYRING31,
S_INFINITYRING32,
S_INFINITYRING33,
S_INFINITYRING34,
S_INFINITYRING35,
// Automatic Ring
S_AUTOMATICRING1,
S_AUTOMATICRING2,
S_AUTOMATICRING3,
S_AUTOMATICRING4,
S_AUTOMATICRING5,
S_AUTOMATICRING6,
S_AUTOMATICRING7,
S_AUTOMATICRING8,
S_AUTOMATICRING9,
S_AUTOMATICRING10,
S_AUTOMATICRING11,
S_AUTOMATICRING12,
S_AUTOMATICRING13,
S_AUTOMATICRING14,
S_AUTOMATICRING15,
S_AUTOMATICRING16,
S_AUTOMATICRING17,
S_AUTOMATICRING18,
S_AUTOMATICRING19,
S_AUTOMATICRING20,
S_AUTOMATICRING21,
S_AUTOMATICRING22,
S_AUTOMATICRING23,
S_AUTOMATICRING24,
S_AUTOMATICRING25,
S_AUTOMATICRING26,
S_AUTOMATICRING27,
S_AUTOMATICRING28,
S_AUTOMATICRING29,
S_AUTOMATICRING30,
S_AUTOMATICRING31,
S_AUTOMATICRING32,
S_AUTOMATICRING33,
S_AUTOMATICRING34,
S_AUTOMATICRING35,
// Explosion Ring
S_EXPLOSIONRING1,
S_EXPLOSIONRING2,
S_EXPLOSIONRING3,
S_EXPLOSIONRING4,
S_EXPLOSIONRING5,
S_EXPLOSIONRING6,
S_EXPLOSIONRING7,
S_EXPLOSIONRING8,
S_EXPLOSIONRING9,
S_EXPLOSIONRING10,
S_EXPLOSIONRING11,
S_EXPLOSIONRING12,
S_EXPLOSIONRING13,
S_EXPLOSIONRING14,
S_EXPLOSIONRING15,
S_EXPLOSIONRING16,
S_EXPLOSIONRING17,
S_EXPLOSIONRING18,
S_EXPLOSIONRING19,
S_EXPLOSIONRING20,
S_EXPLOSIONRING21,
S_EXPLOSIONRING22,
S_EXPLOSIONRING23,
S_EXPLOSIONRING24,
S_EXPLOSIONRING25,
S_EXPLOSIONRING26,
S_EXPLOSIONRING27,
S_EXPLOSIONRING28,
S_EXPLOSIONRING29,
S_EXPLOSIONRING30,
S_EXPLOSIONRING31,
S_EXPLOSIONRING32,
S_EXPLOSIONRING33,
S_EXPLOSIONRING34,
S_EXPLOSIONRING35,
// Scatter Ring
S_SCATTERRING1,
S_SCATTERRING2,
S_SCATTERRING3,
S_SCATTERRING4,
S_SCATTERRING5,
S_SCATTERRING6,
S_SCATTERRING7,
S_SCATTERRING8,
S_SCATTERRING9,
S_SCATTERRING10,
S_SCATTERRING11,
S_SCATTERRING12,
S_SCATTERRING13,
S_SCATTERRING14,
S_SCATTERRING15,
S_SCATTERRING16,
S_SCATTERRING17,
S_SCATTERRING18,
S_SCATTERRING19,
S_SCATTERRING20,
S_SCATTERRING21,
S_SCATTERRING22,
S_SCATTERRING23,
S_SCATTERRING24,
S_SCATTERRING25,
S_SCATTERRING26,
S_SCATTERRING27,
S_SCATTERRING28,
S_SCATTERRING29,
S_SCATTERRING30,
S_SCATTERRING31,
S_SCATTERRING32,
S_SCATTERRING33,
S_SCATTERRING34,
S_SCATTERRING35,
// Grenade Ring
S_GRENADERING1,
S_GRENADERING2,
S_GRENADERING3,
S_GRENADERING4,
S_GRENADERING5,
S_GRENADERING6,
S_GRENADERING7,
S_GRENADERING8,
S_GRENADERING9,
S_GRENADERING10,
S_GRENADERING11,
S_GRENADERING12,
S_GRENADERING13,
S_GRENADERING14,
S_GRENADERING15,
S_GRENADERING16,
S_GRENADERING17,
S_GRENADERING18,
S_GRENADERING19,
S_GRENADERING20,
S_GRENADERING21,
S_GRENADERING22,
S_GRENADERING23,
S_GRENADERING24,
S_GRENADERING25,
S_GRENADERING26,
S_GRENADERING27,
S_GRENADERING28,
S_GRENADERING29,
S_GRENADERING30,
S_GRENADERING31,
S_GRENADERING32,
S_GRENADERING33,
S_GRENADERING34,
S_GRENADERING35,
// Weapon Ring Ammo
S_BOUNCERINGAMMO,
S_RAILRINGAMMO,
S_INFINITYRINGAMMO,
S_AUTOMATICRINGAMMO,
S_EXPLOSIONRINGAMMO,
S_SCATTERRINGAMMO,
S_GRENADERINGAMMO,
// Weapon pickup
S_BOUNCEPICKUP1,
S_BOUNCEPICKUP2,
S_BOUNCEPICKUP3,
S_BOUNCEPICKUP4,
S_BOUNCEPICKUP5,
S_BOUNCEPICKUP6,
S_BOUNCEPICKUP7,
S_BOUNCEPICKUP8,
S_BOUNCEPICKUP9,
S_BOUNCEPICKUP10,
S_BOUNCEPICKUP11,
S_BOUNCEPICKUP12,
S_BOUNCEPICKUP13,
S_BOUNCEPICKUP14,
S_BOUNCEPICKUP15,
S_BOUNCEPICKUP16,
S_BOUNCEPICKUP,
S_BOUNCEPICKUPFADE1,
S_BOUNCEPICKUPFADE2,
S_BOUNCEPICKUPFADE3,
@ -2849,23 +2469,7 @@ typedef enum state
S_BOUNCEPICKUPFADE7,
S_BOUNCEPICKUPFADE8,
S_RAILPICKUP1,
S_RAILPICKUP2,
S_RAILPICKUP3,
S_RAILPICKUP4,
S_RAILPICKUP5,
S_RAILPICKUP6,
S_RAILPICKUP7,
S_RAILPICKUP8,
S_RAILPICKUP9,
S_RAILPICKUP10,
S_RAILPICKUP11,
S_RAILPICKUP12,
S_RAILPICKUP13,
S_RAILPICKUP14,
S_RAILPICKUP15,
S_RAILPICKUP16,
S_RAILPICKUP,
S_RAILPICKUPFADE1,
S_RAILPICKUPFADE2,
S_RAILPICKUPFADE3,
@ -2875,23 +2479,7 @@ typedef enum state
S_RAILPICKUPFADE7,
S_RAILPICKUPFADE8,
S_AUTOPICKUP1,
S_AUTOPICKUP2,
S_AUTOPICKUP3,
S_AUTOPICKUP4,
S_AUTOPICKUP5,
S_AUTOPICKUP6,
S_AUTOPICKUP7,
S_AUTOPICKUP8,
S_AUTOPICKUP9,
S_AUTOPICKUP10,
S_AUTOPICKUP11,
S_AUTOPICKUP12,
S_AUTOPICKUP13,
S_AUTOPICKUP14,
S_AUTOPICKUP15,
S_AUTOPICKUP16,
S_AUTOPICKUP,
S_AUTOPICKUPFADE1,
S_AUTOPICKUPFADE2,
S_AUTOPICKUPFADE3,
@ -2901,23 +2489,7 @@ typedef enum state
S_AUTOPICKUPFADE7,
S_AUTOPICKUPFADE8,
S_EXPLODEPICKUP1,
S_EXPLODEPICKUP2,
S_EXPLODEPICKUP3,
S_EXPLODEPICKUP4,
S_EXPLODEPICKUP5,
S_EXPLODEPICKUP6,
S_EXPLODEPICKUP7,
S_EXPLODEPICKUP8,
S_EXPLODEPICKUP9,
S_EXPLODEPICKUP10,
S_EXPLODEPICKUP11,
S_EXPLODEPICKUP12,
S_EXPLODEPICKUP13,
S_EXPLODEPICKUP14,
S_EXPLODEPICKUP15,
S_EXPLODEPICKUP16,
S_EXPLODEPICKUP,
S_EXPLODEPICKUPFADE1,
S_EXPLODEPICKUPFADE2,
S_EXPLODEPICKUPFADE3,
@ -2927,23 +2499,7 @@ typedef enum state
S_EXPLODEPICKUPFADE7,
S_EXPLODEPICKUPFADE8,
S_SCATTERPICKUP1,
S_SCATTERPICKUP2,
S_SCATTERPICKUP3,
S_SCATTERPICKUP4,
S_SCATTERPICKUP5,
S_SCATTERPICKUP6,
S_SCATTERPICKUP7,
S_SCATTERPICKUP8,
S_SCATTERPICKUP9,
S_SCATTERPICKUP10,
S_SCATTERPICKUP11,
S_SCATTERPICKUP12,
S_SCATTERPICKUP13,
S_SCATTERPICKUP14,
S_SCATTERPICKUP15,
S_SCATTERPICKUP16,
S_SCATTERPICKUP,
S_SCATTERPICKUPFADE1,
S_SCATTERPICKUPFADE2,
S_SCATTERPICKUPFADE3,
@ -2953,23 +2509,7 @@ typedef enum state
S_SCATTERPICKUPFADE7,
S_SCATTERPICKUPFADE8,
S_GRENADEPICKUP1,
S_GRENADEPICKUP2,
S_GRENADEPICKUP3,
S_GRENADEPICKUP4,
S_GRENADEPICKUP5,
S_GRENADEPICKUP6,
S_GRENADEPICKUP7,
S_GRENADEPICKUP8,
S_GRENADEPICKUP9,
S_GRENADEPICKUP10,
S_GRENADEPICKUP11,
S_GRENADEPICKUP12,
S_GRENADEPICKUP13,
S_GRENADEPICKUP14,
S_GRENADEPICKUP15,
S_GRENADEPICKUP16,
S_GRENADEPICKUP,
S_GRENADEPICKUPFADE1,
S_GRENADEPICKUPFADE2,
S_GRENADEPICKUPFADE3,
@ -3350,101 +2890,22 @@ typedef enum state
S_ROCKSPAWN,
S_ROCKCRUMBLEA1,
S_ROCKCRUMBLEA2,
S_ROCKCRUMBLEA3,
S_ROCKCRUMBLEA4,
S_ROCKCRUMBLEA5,
S_ROCKCRUMBLEB1,
S_ROCKCRUMBLEB2,
S_ROCKCRUMBLEB3,
S_ROCKCRUMBLEB4,
S_ROCKCRUMBLEB5,
S_ROCKCRUMBLEC1,
S_ROCKCRUMBLEC2,
S_ROCKCRUMBLEC3,
S_ROCKCRUMBLEC4,
S_ROCKCRUMBLEC5,
S_ROCKCRUMBLED1,
S_ROCKCRUMBLED2,
S_ROCKCRUMBLED3,
S_ROCKCRUMBLED4,
S_ROCKCRUMBLED5,
S_ROCKCRUMBLEE1,
S_ROCKCRUMBLEE2,
S_ROCKCRUMBLEE3,
S_ROCKCRUMBLEE4,
S_ROCKCRUMBLEE5,
S_ROCKCRUMBLEF1,
S_ROCKCRUMBLEF2,
S_ROCKCRUMBLEF3,
S_ROCKCRUMBLEF4,
S_ROCKCRUMBLEF5,
S_ROCKCRUMBLEG1,
S_ROCKCRUMBLEG2,
S_ROCKCRUMBLEG3,
S_ROCKCRUMBLEG4,
S_ROCKCRUMBLEG5,
S_ROCKCRUMBLEH1,
S_ROCKCRUMBLEH2,
S_ROCKCRUMBLEH3,
S_ROCKCRUMBLEH4,
S_ROCKCRUMBLEH5,
S_ROCKCRUMBLEI1,
S_ROCKCRUMBLEI2,
S_ROCKCRUMBLEI3,
S_ROCKCRUMBLEI4,
S_ROCKCRUMBLEI5,
S_ROCKCRUMBLEJ1,
S_ROCKCRUMBLEJ2,
S_ROCKCRUMBLEJ3,
S_ROCKCRUMBLEJ4,
S_ROCKCRUMBLEJ5,
S_ROCKCRUMBLEK1,
S_ROCKCRUMBLEK2,
S_ROCKCRUMBLEK3,
S_ROCKCRUMBLEK4,
S_ROCKCRUMBLEK5,
S_ROCKCRUMBLEL1,
S_ROCKCRUMBLEL2,
S_ROCKCRUMBLEL3,
S_ROCKCRUMBLEL4,
S_ROCKCRUMBLEL5,
S_ROCKCRUMBLEM1,
S_ROCKCRUMBLEM2,
S_ROCKCRUMBLEM3,
S_ROCKCRUMBLEM4,
S_ROCKCRUMBLEM5,
S_ROCKCRUMBLEN1,
S_ROCKCRUMBLEN2,
S_ROCKCRUMBLEN3,
S_ROCKCRUMBLEN4,
S_ROCKCRUMBLEN5,
S_ROCKCRUMBLEO1,
S_ROCKCRUMBLEO2,
S_ROCKCRUMBLEO3,
S_ROCKCRUMBLEO4,
S_ROCKCRUMBLEO5,
S_ROCKCRUMBLEP1,
S_ROCKCRUMBLEP2,
S_ROCKCRUMBLEP3,
S_ROCKCRUMBLEP4,
S_ROCKCRUMBLEP5,
S_ROCKCRUMBLEA,
S_ROCKCRUMBLEB,
S_ROCKCRUMBLEC,
S_ROCKCRUMBLED,
S_ROCKCRUMBLEE,
S_ROCKCRUMBLEF,
S_ROCKCRUMBLEG,
S_ROCKCRUMBLEH,
S_ROCKCRUMBLEI,
S_ROCKCRUMBLEJ,
S_ROCKCRUMBLEK,
S_ROCKCRUMBLEL,
S_ROCKCRUMBLEM,
S_ROCKCRUMBLEN,
S_ROCKCRUMBLEO,
S_ROCKCRUMBLEP,
S_SRB1_CRAWLA1,
S_SRB1_CRAWLA2,

View file

@ -1640,17 +1640,59 @@ static int lib_sStopSound(lua_State *L)
static int lib_sChangeMusic(lua_State *L)
{
#ifdef MUSICSLOT_COMPATIBILITY
const char *music_name;
UINT32 music_num;
char music_compat_name[7];
boolean looping;
player_t *player = NULL;
UINT16 music_flags = 0;
NOHUD
if (lua_isnumber(L, 1))
{
music_num = (UINT32)luaL_checkinteger(L, 1);
music_flags = (UINT16)(music_num & 0x0000FFFF);
if (music_flags && music_flags <= 1035)
snprintf(music_compat_name, 7, "%sM", G_BuildMapName((INT32)music_flags));
else if (music_flags && music_flags <= 1050)
strncpy(music_compat_name, compat_special_music_slots[music_flags - 1036], 7);
else
music_compat_name[0] = 0; // becomes empty string
music_compat_name[6] = 0;
music_name = (const char *)&music_compat_name;
music_flags = 0;
}
else
{
music_num = 0;
music_name = luaL_checkstring(L, 1);
}
looping = (boolean)lua_opttrueboolean(L, 2);
#else
const char *music_name = luaL_checkstring(L, 1);
boolean looping = (boolean)lua_opttrueboolean(L, 2);
player_t *player = NULL;
UINT16 music_flags = 0;
NOHUD
#endif
if (!lua_isnone(L, 3) && lua_isuserdata(L, 3))
{
player = *((player_t **)luaL_checkudata(L, 3, META_PLAYER));
if (!player)
return LUA_ErrInvalid(L, "player_t");
}
#ifdef MUSICSLOT_COMPATIBILITY
if (music_num)
music_flags = (UINT16)((music_num & 0x7FFF0000) >> 16);
else
#endif
music_flags = (UINT16)luaL_optinteger(L, 4, 0);
if (!player || P_IsLocalPlayer(player))

View file

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

View file

@ -1111,9 +1111,13 @@ static int ffloor_set(lua_State *L)
case ffloor_bottompic:
*ffloor->bottompic = P_AddLevelFlatRuntime(luaL_checkstring(L, 3));
break;
case ffloor_flags:
case ffloor_flags: {
ffloortype_e oldflags = ffloor->flags; // store FOF's old flags
ffloor->flags = luaL_checkinteger(L, 3);
if (ffloor->flags != oldflags)
ffloor->target->moved = true; // reset target sector's lightlist
break;
}
case ffloor_alpha:
ffloor->alpha = (INT32)luaL_checkinteger(L, 3);
break;
@ -1157,14 +1161,11 @@ static int mapheaderinfo_get(lua_State *L)
{
mapheader_t *header = *((mapheader_t **)luaL_checkudata(L, 1, META_MAPHEADER));
const char *field = luaL_checkstring(L, 2);
//INT16 i;
if (fastcmp(field,"lvlttl")) {
//for (i = 0; i < 21; i++)
// if (!header->lvlttl[i])
// break;
lua_pushlstring(L, header->lvlttl, 21);
} else if (fastcmp(field,"subttl"))
lua_pushlstring(L, header->subttl, 32);
INT16 i;
if (fastcmp(field,"lvlttl"))
lua_pushstring(L, header->lvlttl);
else if (fastcmp(field,"subttl"))
lua_pushstring(L, header->subttl);
else if (fastcmp(field,"actnum"))
lua_pushinteger(L, header->actnum);
else if (fastcmp(field,"typeoflevel"))
@ -1172,11 +1173,11 @@ static int mapheaderinfo_get(lua_State *L)
else if (fastcmp(field,"nextlevel"))
lua_pushinteger(L, header->nextlevel);
else if (fastcmp(field,"musname"))
lua_pushlstring(L, header->musname, 6);
lua_pushstring(L, header->musname);
else if (fastcmp(field,"mustrack"))
lua_pushinteger(L, header->mustrack);
else if (fastcmp(field,"forcecharacter"))
lua_pushlstring(L, header->forcecharacter, 16);
lua_pushstring(L, header->forcecharacter);
else if (fastcmp(field,"weather"))
lua_pushinteger(L, header->weather);
else if (fastcmp(field,"skynum"))
@ -1187,12 +1188,15 @@ static int mapheaderinfo_get(lua_State *L)
lua_pushinteger(L, header->skybox_scaley);
else if (fastcmp(field,"skybox_scalez"))
lua_pushinteger(L, header->skybox_scalez);
else if (fastcmp(field,"interscreen"))
lua_pushlstring(L, header->interscreen, 8);
else if (fastcmp(field,"runsoc"))
lua_pushlstring(L, header->runsoc, 32);
else if (fastcmp(field,"interscreen")) {
for (i = 0; i < 8; i++)
if (!header->interscreen[i])
break;
lua_pushlstring(L, header->interscreen, i);
} else if (fastcmp(field,"runsoc"))
lua_pushstring(L, header->runsoc);
else if (fastcmp(field,"scriptname"))
lua_pushlstring(L, header->scriptname, 32);
lua_pushstring(L, header->scriptname);
else if (fastcmp(field,"precutscenenum"))
lua_pushinteger(L, header->precutscenenum);
else if (fastcmp(field,"cutscenenum"))
@ -1217,11 +1221,11 @@ static int mapheaderinfo_get(lua_State *L)
else {
// Read custom vars now
// (note: don't include the "LUA." in your lua scripts!)
UINT8 i = 0;
for (;i < header->numCustomOptions && !fastcmp(field, header->customopts[i].option); ++i);
UINT8 j = 0;
for (;j < header->numCustomOptions && !fastcmp(field, header->customopts[j].option); ++j);
if(i < header->numCustomOptions)
lua_pushlstring(L, header->customopts[i].value, 255);
if(j < header->numCustomOptions)
lua_pushstring(L, header->customopts[j].value);
else
lua_pushnil(L);
}

View file

@ -166,7 +166,7 @@ static int lib_all7emeralds(lua_State *L)
// Returns both color and frame numbers!
static int lib_coloropposite(lua_State *L)
{
int colornum = ((int)luaL_checkinteger(L, 1)) & MAXSKINCOLORS;
int colornum = ((int)luaL_checkinteger(L, 1)) % MAXSKINCOLORS;
lua_pushinteger(L, Color_Opposite[colornum*2]); // push color
lua_pushinteger(L, Color_Opposite[colornum*2+1]); // push frame
return 2;

View file

@ -34,6 +34,7 @@ enum mobj_e {
mobj_angle,
mobj_sprite,
mobj_frame,
mobj_anim_duration,
mobj_touching_sectorlist,
mobj_subsector,
mobj_floorz,
@ -92,6 +93,7 @@ static const char *const mobj_opt[] = {
"angle",
"sprite",
"frame",
"anim_duration",
"touching_sectorlist",
"subsector",
"floorz",
@ -187,6 +189,9 @@ static int mobj_get(lua_State *L)
case mobj_frame:
lua_pushinteger(L, mo->frame);
break;
case mobj_anim_duration:
lua_pushinteger(L, mo->anim_duration);
break;
case mobj_touching_sectorlist:
return UNIMPLEMENTED;
case mobj_subsector:
@ -406,6 +411,9 @@ static int mobj_set(lua_State *L)
case mobj_frame:
mo->frame = (UINT32)luaL_checkinteger(L, 3);
break;
case mobj_anim_duration:
mo->anim_duration = (UINT16)luaL_checkinteger(L, 3);
break;
case mobj_touching_sectorlist:
return UNIMPLEMENTED;
case mobj_subsector:

View file

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

View file

@ -55,6 +55,7 @@ void Got_Luacmd(UINT8 **cp, INT32 playernum); // lua_consolelib.c
void LUA_CVarChanged(const char *name); // lua_consolelib.c
int Lua_optoption(lua_State *L, int narg,
const char *def, const char *const lst[]);
void LUAh_NetArchiveHook(lua_CFunction archFunc);
// Console wrapper
void COM_Lua_f(void);

View file

@ -108,7 +108,7 @@ static UINT8 cheatf_devmode(void)
G_SetGameModified(false);
for (i = 0; i < MAXUNLOCKABLES; i++)
unlockables[i].unlocked = true;
devparm = TRUE;
devparm = true;
cv_debug |= 0x8000;
// Refresh secrets menu existing.
@ -880,12 +880,33 @@ static boolean OP_HeightOkay(player_t *player, UINT8 ceiling)
static mapthing_t *OP_CreateNewMapThing(player_t *player, UINT16 type, boolean ceiling)
{
mapthing_t *mt;
mapthing_t *mt = mapthings;
#ifdef HAVE_BLUA
LUA_InvalidateMapthings();
#endif
mapthings = Z_Realloc(mapthings, ++nummapthings * sizeof (*mapthings), PU_LEVEL, NULL);
// as Z_Realloc can relocate mapthings, quickly go through thinker list and correct
// the spawnpoints of any objects that have them to the new location
if (mt != mapthings)
{
thinker_t *th;
mobj_t *mo;
for (th = thinkercap.next; th != &thinkercap; th = th->next)
{
if (th->function.acp1 != (actionf_p1)P_MobjThinker)
continue;
mo = (mobj_t *)th;
// get offset from mt, which points to old mapthings, then add new location
if (mo->spawnpoint)
mo->spawnpoint = (mo->spawnpoint - mt) + mapthings;
}
}
mt = (mapthings+nummapthings-1);
mt->type = type;

View file

@ -6074,7 +6074,7 @@ static void M_RoomMenu(INT32 choice)
for (i = 0; room_list[i].header.buffer[0]; i++)
{
if(room_list[i].name != '\0')
if(*room_list[i].name != '\0')
{
MP_RoomMenu[i+1].text = room_list[i].name;
roomIds[i] = room_list[i].id;
@ -7409,4 +7409,3 @@ static void M_HandleFogColor(INT32 choice)
}
}
#endif

View file

@ -677,7 +677,7 @@ static void M_PNGText(png_structp png_ptr, png_infop png_info_ptr, PNG_CONST png
else
snprintf(maptext, 8, "Unknown");
if (gamestate == GS_LEVEL && mapheaderinfo[gamemap-1]->lvlttl)
if (gamestate == GS_LEVEL && mapheaderinfo[gamemap-1]->lvlttl[0] != '\0')
snprintf(lvlttltext, 48, "%s%s%s",
mapheaderinfo[gamemap-1]->lvlttl,
(mapheaderinfo[gamemap-1]->levelflags & LF_NOZONE) ? "" : " ZONE",

View file

@ -6358,7 +6358,7 @@ void A_Boss2PogoTarget(mobj_t *actor)
if (actor->info->missilestate) // spawn the pogo stick collision box
{
mobj_t *pogo = P_SpawnMobj(actor->x, actor->y, actor->z - mobjinfo[actor->info->missilestate].height, actor->info->missilestate);
mobj_t *pogo = P_SpawnMobj(actor->x, actor->y, actor->z - mobjinfo[actor->info->missilestate].height, (mobjtype_t)actor->info->missilestate);
pogo->target = actor;
}

View file

@ -1339,6 +1339,9 @@ void P_TouchSpecialThing(mobj_t *special, mobj_t *toucher, boolean heightcheck)
}
else
player->pflags |= PF_ITEMHANG;
// Can't jump first frame
player->pflags |= PF_JUMPSTASIS;
return;
case MT_BIGMINE:
case MT_BIGAIRMINE:

View file

@ -212,6 +212,7 @@ void P_RemoveSavegameMobj(mobj_t *th);
boolean P_SetPlayerMobjState(mobj_t *mobj, statenum_t state);
boolean P_SetMobjState(mobj_t *mobj, statenum_t state);
void P_RunShields(void);
void P_RunOverlays(void);
void P_MobjThinker(mobj_t *mobj);
boolean P_RailThinker(mobj_t *mobj);
void P_PushableThinker(mobj_t *mobj);

View file

@ -503,7 +503,7 @@ static boolean PIT_CheckThing(mobj_t *thing)
return true; // overhead
if (thing->z + thing->height < tmthing->z)
return true; // underneath
if (tmthing->player && tmthing->flags & MF_SHOOTABLE)
if (tmthing->player && tmthing->flags & MF_SHOOTABLE && thing->health > 0)
{
UINT8 damagetype = 0;
if (thing->flags & MF_FIRE) // BURN!
@ -519,7 +519,7 @@ static boolean PIT_CheckThing(mobj_t *thing)
return true; // overhead
if (tmthing->z + tmthing->height < thing->z)
return true; // underneath
if (thing->player && thing->flags & MF_SHOOTABLE)
if (thing->player && thing->flags & MF_SHOOTABLE && tmthing->health > 0)
{
UINT8 damagetype = 0;
if (tmthing->flags & MF_FIRE) // BURN!
@ -2646,8 +2646,8 @@ isblocking:
climbangle += (ANGLE_90 * (whichside ? -1 : 1));
if (((!slidemo->player->climbing && abs(slidemo->angle - ANGLE_90 - climbline) < ANGLE_45)
|| (slidemo->player->climbing == 1 && abs(slidemo->angle - climbline) < ANGLE_135))
if (((!slidemo->player->climbing && abs((slidemo->angle - ANGLE_90 - climbline)) < ANGLE_45)
|| (slidemo->player->climbing == 1 && abs((slidemo->angle - climbline)) < ANGLE_135))
&& P_IsClimbingValid(slidemo->player, climbangle))
{
slidemo->angle = climbangle;

View file

@ -79,11 +79,31 @@ void P_AddCachedAction(mobj_t *mobj, INT32 statenum)
actioncachehead.prev = newaction;
}
//
// P_CycleStateAnimation
//
FUNCINLINE static ATTRINLINE void P_CycleStateAnimation(mobj_t *mobj)
{
// var2 determines delay between animation frames
if (!(mobj->frame & FF_ANIMATE) || --mobj->anim_duration != 0)
return;
mobj->anim_duration = (UINT16)mobj->state->var2;
// compare the current sprite frame to the one we started from
// if more than var1 away from it, swap back to the original
// else just advance by one
if (((++mobj->frame) & FF_FRAMEMASK) - (mobj->state->frame & FF_FRAMEMASK) > (UINT32)mobj->state->var1)
mobj->frame = (mobj->state->frame & FF_FRAMEMASK) | (mobj->frame & ~FF_FRAMEMASK);
}
//
// P_CycleMobjState
//
static void P_CycleMobjState(mobj_t *mobj)
{
// state animations
P_CycleStateAnimation(mobj);
// cycle through states,
// calling action functions at transitions
if (mobj->tics != -1)
@ -102,6 +122,9 @@ static void P_CycleMobjState(mobj_t *mobj)
//
static void P_CyclePlayerMobjState(mobj_t *mobj)
{
// state animations
P_CycleStateAnimation(mobj);
// cycle through states,
// calling action functions at transitions
if (mobj->tics != -1)
@ -307,6 +330,7 @@ boolean P_SetPlayerMobjState(mobj_t *mobj, statenum_t state)
boolean noalt = false;
UINT8 spr2 = st->frame & FF_FRAMEMASK;
UINT16 frame = (mobj->frame & FF_FRAMEMASK)+1;
mobj->anim_duration = (UINT16)st->var2; // only used if FF_ANIMATE is set
while (((skin_t *)mobj->skin)->sprites[spr2].numframes <= 0
&& spr2 != SPR2_STND)
@ -497,6 +521,7 @@ boolean P_SetMobjState(mobj_t *mobj, statenum_t state)
st = &states[state];
mobj->state = st;
mobj->tics = st->tics;
mobj->anim_duration = (UINT16)st->var2; // only used if FF_ANIMATE is set
// Player animations
if (st->sprite == SPR_PLAY)
@ -574,6 +599,8 @@ boolean P_SetMobjStateNF(mobj_t *mobj, statenum_t state)
mobj->tics = st->tics;
mobj->sprite = st->sprite;
mobj->frame = st->frame;
mobj->anim_duration = (UINT16)st->var2; // only used if FF_ANIMATE is set
return true;
}
@ -591,6 +618,8 @@ static boolean P_SetPrecipMobjState(precipmobj_t *mobj, statenum_t state)
mobj->tics = st->tics;
mobj->sprite = st->sprite;
mobj->frame = st->frame;
mobj->anim_duration = (UINT16)st->var2; // only used if FF_ANIMATE is set
return true;
}
@ -3891,6 +3920,8 @@ void P_NullPrecipThinker(precipmobj_t *mobj)
void P_SnowThinker(precipmobj_t *mobj)
{
P_CycleStateAnimation((mobj_t *)mobj);
// adjust height
if ((mobj->z += mobj->momz) <= mobj->floorz)
mobj->z = mobj->ceilingz;
@ -3898,6 +3929,8 @@ void P_SnowThinker(precipmobj_t *mobj)
void P_RainThinker(precipmobj_t *mobj)
{
P_CycleStateAnimation((mobj_t *)mobj);
if (mobj->state != &states[S_RAIN1])
{
// cycle through states,
@ -6008,8 +6041,6 @@ INT32 numshields = 0;
void P_RunShields(void)
{
INT32 i;
mobj_t *mo, *next;
fixed_t destx,desty,zoffs;
// run shields
for (i = 0; i < numshields; i++)
@ -6018,60 +6049,6 @@ void P_RunShields(void)
P_SetTarget(&shields[i], NULL);
}
numshields = 0;
// run overlays
next = NULL;
for (mo = overlaycap; mo; mo = next)
{
I_Assert(!P_MobjWasRemoved(mo));
// grab next in chain, then unset the chain target
next = mo->hnext;
P_SetTarget(&mo->hnext, NULL);
if (!mo->target)
continue;
if (!splitscreen /*&& rendermode != render_soft*/)
{
angle_t viewingangle;
if (players[displayplayer].awayviewtics)
viewingangle = R_PointToAngle2(mo->target->x, mo->target->y, players[displayplayer].awayviewmobj->x, players[displayplayer].awayviewmobj->y);
else if (!camera.chase && players[displayplayer].mo)
viewingangle = R_PointToAngle2(mo->target->x, mo->target->y, players[displayplayer].mo->x, players[displayplayer].mo->y);
else
viewingangle = R_PointToAngle2(mo->target->x, mo->target->y, camera.x, camera.y);
if (mo->state->var1)
viewingangle += ANGLE_180;
destx = mo->target->x + P_ReturnThrustX(mo->target, viewingangle, FixedMul(FRACUNIT/4, mo->scale));
desty = mo->target->y + P_ReturnThrustY(mo->target, viewingangle, FixedMul(FRACUNIT/4, mo->scale));
}
else
{
destx = mo->target->x;
desty = mo->target->y;
}
mo->eflags = (mo->eflags & ~MFE_VERTICALFLIP) | (mo->target->eflags & MFE_VERTICALFLIP);
mo->scale = mo->destscale = mo->target->scale;
zoffs = FixedMul(((signed)mo->state->var2)*FRACUNIT, mo->scale);
mo->angle = mo->target->angle;
P_UnsetThingPosition(mo);
mo->x = destx;
mo->y = desty;
if (mo->eflags & MFE_VERTICALFLIP)
mo->z = (mo->target->z + mo->target->height - mo->height) - zoffs;
else
mo->z = mo->target->z + zoffs;
if (mo->state->var1)
P_SetUnderlayPosition(mo);
else
P_SetThingPosition(mo);
P_CheckPosition(mo, mo->x, mo->y);
}
P_SetTarget(&overlaycap, NULL);
}
static boolean P_AddShield(mobj_t *thing)
@ -6108,6 +6085,71 @@ static boolean P_AddShield(mobj_t *thing)
return true;
}
void P_RunOverlays(void)
{
// run overlays
mobj_t *mo, *next = NULL;
fixed_t destx,desty,zoffs;
for (mo = overlaycap; mo; mo = next)
{
I_Assert(!P_MobjWasRemoved(mo));
// grab next in chain, then unset the chain target
next = mo->hnext;
P_SetTarget(&mo->hnext, NULL);
if (!mo->target)
continue;
if (!splitscreen /*&& rendermode != render_soft*/)
{
angle_t viewingangle;
if (players[displayplayer].awayviewtics)
viewingangle = R_PointToAngle2(mo->target->x, mo->target->y, players[displayplayer].awayviewmobj->x, players[displayplayer].awayviewmobj->y);
else if (!camera.chase && players[displayplayer].mo)
viewingangle = R_PointToAngle2(mo->target->x, mo->target->y, players[displayplayer].mo->x, players[displayplayer].mo->y);
else
viewingangle = R_PointToAngle2(mo->target->x, mo->target->y, camera.x, camera.y);
if (!(mo->state->frame & FF_ANIMATE) && mo->state->var1)
viewingangle += ANGLE_180;
destx = mo->target->x + P_ReturnThrustX(mo->target, viewingangle, FixedMul(FRACUNIT/4, mo->scale));
desty = mo->target->y + P_ReturnThrustY(mo->target, viewingangle, FixedMul(FRACUNIT/4, mo->scale));
}
else
{
destx = mo->target->x;
desty = mo->target->y;
}
mo->eflags = (mo->eflags & ~MFE_VERTICALFLIP) | (mo->target->eflags & MFE_VERTICALFLIP);
mo->scale = mo->destscale = mo->target->scale;
mo->angle = mo->target->angle;
if (!(mo->state->frame & FF_ANIMATE))
zoffs = FixedMul(((signed)mo->state->var2)*FRACUNIT, mo->scale);
// if you're using FF_ANIMATE on an overlay,
// then you're on your own.
else
zoffs = 0;
P_UnsetThingPosition(mo);
mo->x = destx;
mo->y = desty;
if (mo->eflags & MFE_VERTICALFLIP)
mo->z = (mo->target->z + mo->target->height - mo->height) - zoffs;
else
mo->z = mo->target->z + zoffs;
if (mo->state->var1)
P_SetUnderlayPosition(mo);
else
P_SetThingPosition(mo);
P_CheckPosition(mo, mo->x, mo->y);
}
P_SetTarget(&overlaycap, NULL);
}
// Called only when MT_OVERLAY thinks.
static void P_AddOverlay(mobj_t *thing)
{
@ -7677,6 +7719,8 @@ mobj_t *P_SpawnMobj(fixed_t x, fixed_t y, fixed_t z, mobjtype_t type)
mobj->tics = st->tics;
mobj->sprite = st->sprite;
mobj->frame = st->frame; // FF_FRAMEMASK for frame, and other bits..
mobj->anim_duration = (UINT16)st->var2; // only used if FF_ANIMATE is set
mobj->friction = ORIG_FRICTION;
mobj->movefactor = ORIG_FRICTION_FACTOR;
@ -7902,6 +7946,7 @@ static precipmobj_t *P_SpawnPrecipMobj(fixed_t x, fixed_t y, fixed_t z, mobjtype
mobj->tics = st->tics;
mobj->sprite = st->sprite;
mobj->frame = st->frame; // FF_FRAMEMASK for frame, and other bits..
mobj->anim_duration = (UINT16)st->var2; // only used if FF_ANIMATE is set
// set subsector and/or block links
P_SetPrecipitationThingPosition(mobj);
@ -9871,7 +9916,7 @@ void P_SpawnHoopsAndRings(mapthing_t *mthing)
// Diagonal rings (handles both types)
else if (mthing->type == 602 || mthing->type == 603) // Diagonal rings (5)
{
angle_t angle = ANGLE_45 * (mthing->angle/45);
angle_t angle = FixedAngle(mthing->angle*FRACUNIT);
mobjtype_t ringthing = MT_RING;
INT32 iterations = 5;
if (mthing->type == 603)

View file

@ -271,6 +271,7 @@ typedef struct mobj_s
spritenum_t sprite; // used to find patch_t and flip value
UINT32 frame; // frame number, plus bits see p_pspr.h
UINT8 sprite2; // player sprites
UINT16 anim_duration; // for FF_ANIMATE states
struct msecnode_s *touching_sectorlist; // a linked list of sectors where this object appears
@ -384,7 +385,8 @@ typedef struct precipmobj_s
// More drawing info: to determine current sprite.
angle_t angle; // orientation
spritenum_t sprite; // used to find patch_t and flip value
INT32 frame; // frame number, plus bits see p_pspr.h
UINT32 frame; // frame number, plus bits see p_pspr.h
UINT16 anim_duration; // for FF_ANIMATE states
struct mprecipsecnode_s *touching_sectorlist; // a linked list of sectors where this object appears

View file

@ -442,6 +442,8 @@ newseg:
// seg's ending vertex.
for (i = 0; i < numsegs; ++i)
{
if (segs[i].side != 0) // needs to be frontfacing
continue;
if (segs[i].v1->x == seg->v2->x && segs[i].v1->y == seg->v2->y)
{
// Make sure you didn't already add this seg...
@ -610,6 +612,9 @@ static void Polyobj_spawnPolyObj(INT32 num, mobj_t *spawnSpot, INT32 id)
INT32 poflags = POF_SOLID|POF_TESTHEIGHT|POF_RENDERSIDES;
INT32 parentID = 0, potrans = 0;
if (seg->side != 0) // needs to be frontfacing
continue;
if (seg->linedef->special != POLYOBJ_START_LINE)
continue;

View file

@ -36,9 +36,11 @@
#endif
/// \brief Frame flags: only the frame number
#define FF_FRAMEMASK 0x7fff
#define FF_FRAMEMASK 0x3fff
/// \brief Frame flags: Simple stateless animation
#define FF_ANIMATE 0x4000
/// \brief Frame flags: frame always appears full bright
#define FF_FULLBRIGHT 0x8000 //
#define FF_FULLBRIGHT 0x8000
/// \brief Frame flags: 0 = no trans(opaque), 1-15 = transl. table
#define FF_TRANSMASK 0xf0000
/// \brief shift for FF_TRANSMASK

View file

@ -1060,6 +1060,8 @@ static void SaveMobjThinker(const thinker_t *th, const UINT8 type)
diff |= MD_SPRITE;
if (mobj->frame != mobj->state->frame)
diff |= MD_FRAME;
if (mobj->anim_duration != (UINT16)mobj->state->var2)
diff |= MD_FRAME;
if (mobj->eflags)
diff |= MD_EFLAGS;
if (mobj->player)
@ -1183,7 +1185,10 @@ static void SaveMobjThinker(const thinker_t *th, const UINT8 type)
WRITEUINT8(save_p, mobj->sprite2);
}
if (diff & MD_FRAME)
{
WRITEUINT32(save_p, mobj->frame);
WRITEUINT16(save_p, mobj->anim_duration);
}
if (diff & MD_EFLAGS)
WRITEUINT16(save_p, mobj->eflags);
if (diff & MD_PLAYER)
@ -2015,9 +2020,15 @@ static void LoadMobjThinker(actionf_p1 thinker)
mobj->sprite2 = mobj->state->frame&FF_FRAMEMASK;
}
if (diff & MD_FRAME)
{
mobj->frame = READUINT32(save_p);
mobj->anim_duration = READUINT16(save_p);
}
else
{
mobj->frame = mobj->state->frame;
mobj->anim_duration = (UINT16)mobj->state->var2;
}
if (diff & MD_EFLAGS)
mobj->eflags = READUINT16(save_p);
if (diff & MD_PLAYER)

View file

@ -181,7 +181,7 @@ static void P_ClearSingleMapHeaderInfo(INT16 i)
DEH_WriteUndoline("NEXTLEVEL", va("%d", mapheaderinfo[num]->nextlevel), UNDO_NONE);
mapheaderinfo[num]->nextlevel = (INT16)(i + 1);
DEH_WriteUndoline("MUSIC", mapheaderinfo[num]->musname, UNDO_NONE);
snprintf(mapheaderinfo[num]->musname, 7, va("%sM", G_BuildMapName(i)));
snprintf(mapheaderinfo[num]->musname, 7, "%sM", G_BuildMapName(i));
mapheaderinfo[num]->musname[6] = 0;
DEH_WriteUndoline("MUSICTRACK", va("%d", mapheaderinfo[num]->mustrack), UNDO_NONE);
mapheaderinfo[num]->mustrack = 0;
@ -2386,7 +2386,7 @@ boolean P_SetupLevel(boolean skipprecip)
// use gamemap to get map number.
// 99% of the things already did, so.
// Map header should always be in place at this point
INT32 i, loadprecip = 1;
INT32 i, loadprecip = 1, ranspecialwipe = 0;
INT32 loademblems = 1;
INT32 fromnetsave = 0;
boolean loadedbm = false;
@ -2459,6 +2459,28 @@ boolean P_SetupLevel(boolean skipprecip)
// will be set by player think.
players[consoleplayer].viewz = 1;
// Special stage fade to white
// This is handled BEFORE sounds are stopped.
if (rendermode != render_none && G_IsSpecialStage(gamemap))
{
tic_t starttime = I_GetTime();
tic_t endtime = starttime + (3*TICRATE)/2;
S_StartSound(NULL, sfx_s3kaf);
F_WipeStartScreen();
V_DrawFill(0, 0, BASEVIDWIDTH, BASEVIDHEIGHT, 0);
F_WipeEndScreen();
F_RunWipe(wipedefs[wipe_speclevel_towhite], false);
// Hold on white for extra effect.
while (I_GetTime() < endtime)
I_Sleep();
ranspecialwipe = 1;
}
// Make sure all sounds are stopped before Z_FreeTags.
S_StopSounds();
S_ClearSfx();
@ -2468,25 +2490,28 @@ boolean P_SetupLevel(boolean skipprecip)
S_Start();
// Let's fade to black here
if (rendermode != render_none)
// But only if we didn't do the special stage wipe
if (rendermode != render_none && !ranspecialwipe)
{
F_WipeStartScreen();
V_DrawFill(0, 0, BASEVIDWIDTH, BASEVIDHEIGHT, 31);
F_WipeEndScreen();
F_RunWipe(wipedefs[wipe_level_toblack], false);
}
// Print "SPEEDING OFF TO [ZONE] [ACT 1]..."
if (rendermode != render_none)
{
// Don't include these in the fade!
{
char tx[64];
V_DrawSmallString(1, 191, V_ALLOWLOWERCASE, M_GetText("Speeding off to..."));
snprintf(tx, 63, "%s%s%s",
mapheaderinfo[gamemap-1]->lvlttl,
(mapheaderinfo[gamemap-1]->levelflags & LF_NOZONE) ? "" : " ZONE",
(mapheaderinfo[gamemap-1]->actnum > 0) ? va(", Act %d",mapheaderinfo[gamemap-1]->actnum) : "");
V_DrawSmallString(1, 195, V_ALLOWLOWERCASE, tx);
I_UpdateNoVsync();
}
char tx[64];
V_DrawSmallString(1, 191, V_ALLOWLOWERCASE, M_GetText("Speeding off to..."));
snprintf(tx, 63, "%s%s%s",
mapheaderinfo[gamemap-1]->lvlttl,
(mapheaderinfo[gamemap-1]->levelflags & LF_NOZONE) ? "" : " ZONE",
(mapheaderinfo[gamemap-1]->actnum > 0) ? va(", Act %d",mapheaderinfo[gamemap-1]->actnum) : "");
V_DrawSmallString(1, 195, V_ALLOWLOWERCASE, tx);
I_UpdateNoVsync();
}
#ifdef HAVE_BLUA
@ -2784,7 +2809,7 @@ boolean P_SetupLevel(boolean skipprecip)
// Remove the loading shit from the screen
if (rendermode != render_none)
V_DrawFill(0, 0, BASEVIDWIDTH, BASEVIDHEIGHT, 31);
V_DrawFill(0, 0, BASEVIDWIDTH, BASEVIDHEIGHT, (ranspecialwipe) ? 0 : 31);
if (precache || dedicated)
R_PrecacheLevel();

View file

@ -3038,6 +3038,7 @@ static void P_ProcessLineSpecial(line_t *line, mobj_t *mo, sector_t *callsec)
INT16 foftag = (INT16)(sides[line->sidenum[0]].rowoffset>>FRACBITS);
sector_t *sec; // Sector that the FOF is visible (or not visible) in
ffloor_t *rover; // FOF to vanish/un-vanish
ffloortype_e oldflags; // store FOF's old flags
for (secnum = -1; (secnum = P_FindSectorFromTag(sectag, secnum)) >= 0 ;)
{
@ -3061,11 +3062,17 @@ static void P_ProcessLineSpecial(line_t *line, mobj_t *mo, sector_t *callsec)
return;
}
oldflags = rover->flags;
// Abracadabra!
if (line->flags & ML_NOCLIMB)
rover->flags |= FF_EXISTS;
else
rover->flags &= ~FF_EXISTS;
// if flags changed, reset sector's light list
if (rover->flags != oldflags)
sec->moved = true;
}
}
break;
@ -4670,11 +4677,11 @@ void P_UpdateSpecials(void)
// ANIMATE TEXTURES
for (anim = anims; anim < lastanim; anim++)
{
for (i = anim->basepic; i < anim->basepic + anim->numpics; i++)
for (i = 0; i < anim->numpics; i++)
{
pic = anim->basepic + ((leveltime/anim->speed + i) % anim->numpics);
if (anim->istexture)
texturetranslation[i] = pic;
texturetranslation[anim->basepic+i] = pic;
}
}

View file

@ -631,6 +631,7 @@ void P_Ticker(boolean run)
// Run shield positioning
P_RunShields();
P_RunOverlays();
P_UpdateSpecials();
P_RespawnSpecials();
@ -742,6 +743,7 @@ void P_PreTicker(INT32 frames)
// Run shield positioning
P_RunShields();
P_RunOverlays();
P_UpdateSpecials();
P_RespawnSpecials();

View file

@ -52,9 +52,6 @@
#include "hardware/hw_main.h"
#endif
// Index of the special effects (INVUL inverse) map.
#define INVERSECOLORMAP 32
#if 0
static void P_NukeAllPlayers(player_t *player);
#endif
@ -3440,27 +3437,14 @@ static void P_DoSuperStuff(player_t *player)
player->mo->health--;
}
// future todo: a skin option for this, and possibly more colors
switch (player->skin)
{
case 1: // Golden orange supertails.
if (leveltime % 9 < 5)
player->mo->color = SKINCOLOR_TSUPER1 + leveltime % 9;
else
player->mo->color = SKINCOLOR_TSUPER1 + 9 - leveltime % 9;
break;
case 2: // Pink superknux.
if (leveltime % 9 < 5)
player->mo->color = SKINCOLOR_KSUPER1 + leveltime % 9;
else
player->mo->color = SKINCOLOR_KSUPER1 + 9 - leveltime % 9;
break;
default: // Yousa yellow now!
if (leveltime % 9 < 5)
player->mo->color = SKINCOLOR_SUPER1 + leveltime % 9;
else
player->mo->color = SKINCOLOR_SUPER1 + 9 - leveltime % 9;
break;
case 1: /* Tails */ player->mo->color = SKINCOLOR_TSUPER1; break;
case 2: /* Knux */ player->mo->color = SKINCOLOR_KSUPER1; break;
default: /* everyone */ player->mo->color = SKINCOLOR_SUPER1; break;
}
player->mo->color += abs( ( ( leveltime >> 1 ) % 9) - 4);
if ((cmd->forwardmove != 0 || cmd->sidemove != 0 || player->pflags & (PF_CARRIED|PF_ROPEHANG|PF_ITEMHANG|PF_MACESPIN))
&& !(leveltime % TICRATE) && (player->mo->momx || player->mo->momy))
@ -6366,8 +6350,7 @@ static void P_MovePlayer(player_t *player)
if (!(player->powers[pw_nocontrol] & (1<<15)))
player->pflags |= PF_JUMPSTASIS;
}
else
player->pflags &= ~PF_FULLSTASIS;
// note: don't unset stasis here
if (!player->spectator && G_TagGametype())
{
@ -7996,9 +7979,9 @@ boolean P_MoveChaseCamera(player_t *player, camera_t *thiscam, boolean resetcall
if (player == &players[consoleplayer])
{
if (focusangle >= localangle)
localangle += abs(focusangle - localangle)>>5;
localangle += abs((focusangle - localangle))>>5;
else
localangle -= abs(focusangle - localangle)>>5;
localangle -= abs((focusangle - localangle))>>5;
}
}
else if (P_AnalogMove(player)) // Analog
@ -8958,6 +8941,11 @@ void P_PlayerThink(player_t *player)
if (!player->mo)
return; // P_MovePlayer removed player->mo.
// Unset statis flags after moving.
// In other words, if you manually set stasis via code,
// it lasts for one tic.
player->pflags &= ~PF_FULLSTASIS;
#ifdef POLYOBJECTS
if (player->onconveyor == 1)
player->cmomy = player->cmomx = 0;

View file

@ -32,7 +32,6 @@ sector_t *backsector;
// 896 drawsegs! So too bad here's a limit removal a-la-Boom
drawseg_t *drawsegs = NULL;
drawseg_t *ds_p = NULL;
drawseg_t *firstnewseg = NULL;
// indicates doors closed wrt automap bugfix:
INT32 doorclosed;
@ -935,14 +934,14 @@ static void R_Subsector(size_t num)
ffloor[numffloors].plane = NULL;
ffloor[numffloors].polyobj = NULL;
floorcenterz =
floorcenterz =
#ifdef ESLOPE
frontsector->f_slope ? P_GetZAt(frontsector->f_slope, frontsector->soundorg.x, frontsector->soundorg.y) :
#endif
frontsector->floorheight;
ceilingcenterz =
ceilingcenterz =
#ifdef ESLOPE
frontsector->c_slope ? P_GetZAt(frontsector->c_slope, frontsector->soundorg.x, frontsector->soundorg.y) :
#endif
@ -953,8 +952,8 @@ static void R_Subsector(size_t num)
*rover->b_slope ? P_GetZAt(*rover->b_slope, viewx, viewy) :
#endif
*rover->bottomheight;
planecenterz =
planecenterz =
#ifdef ESLOPE
*rover->b_slope ? P_GetZAt(*rover->b_slope, frontsector->soundorg.x, frontsector->soundorg.y) :
#endif
@ -966,7 +965,7 @@ static void R_Subsector(size_t num)
{
light = R_GetPlaneLight(frontsector, planecenterz,
viewz < *rover->bottomheight);
ffloor[numffloors].plane = R_FindPlane(*rover->bottomheight, *rover->bottompic,
*frontsector->lightlist[light].lightlevel, *rover->bottomxoffs,
*rover->bottomyoffs, *rover->bottomangle, frontsector->lightlist[light].extra_colormap, rover
@ -1002,8 +1001,8 @@ static void R_Subsector(size_t num)
*rover->t_slope ? P_GetZAt(*rover->t_slope, viewx, viewy) :
#endif
*rover->topheight;
planecenterz =
planecenterz =
#ifdef ESLOPE
*rover->t_slope ? P_GetZAt(*rover->t_slope, frontsector->soundorg.x, frontsector->soundorg.y) :
#endif
@ -1014,7 +1013,7 @@ static void R_Subsector(size_t num)
|| (viewz < heightcheck && (rover->flags & FF_BOTHPLANES))))
{
light = R_GetPlaneLight(frontsector, planecenterz, viewz < *rover->topheight);
ffloor[numffloors].plane = R_FindPlane(*rover->topheight, *rover->toppic,
*frontsector->lightlist[light].lightlevel, *rover->topxoffs, *rover->topyoffs, *rover->topangle,
frontsector->lightlist[light].extra_colormap, rover

View file

@ -30,7 +30,6 @@ extern INT32 checkcoord[12][4];
extern drawseg_t *drawsegs;
extern drawseg_t *ds_p;
extern drawseg_t *firstnewseg;
extern INT32 doorclosed;
typedef void (*drawfunc_t)(INT32 start, INT32 stop);

View file

@ -347,7 +347,7 @@ static void R_GenerateTranslationColormap(UINT8 *dest_colormap, INT32 skinnum, U
dest_colormap[starttranscolor + i] = (UINT8)(skinbasecolors[color - 1] + i - 3);
}
break;
case SKINCOLOR_PEACH:
// 11 colors
for (i = 0; i < SKIN_RAMP_LENGTH; i++)
@ -362,7 +362,7 @@ static void R_GenerateTranslationColormap(UINT8 *dest_colormap, INT32 skinnum, U
dest_colormap[starttranscolor + i] = (UINT8)(skinbasecolors[color - 1] + i - 7); // Darkest
}
break;
case SKINCOLOR_RED:
// 16 colors
for (i = 0; i < SKIN_RAMP_LENGTH; i++)
@ -957,4 +957,3 @@ void R_DrawViewBorder(void)
// ==========================================================================
#include "r_draw16.c"

View file

@ -1388,4 +1388,3 @@ void R_DrawColumnShadowed_8(void)
if (dc_yl <= realyh)
walldrawerfunc(); // R_DrawWallColumn_8 for the appropriate architecture
}

View file

@ -1486,13 +1486,11 @@ void R_StoreWallRange(INT32 start, INT32 stop)
if (ds_p == drawsegs+maxdrawsegs)
{
size_t pos = ds_p - drawsegs;
size_t pos2 = firstnewseg - drawsegs;
size_t newmax = maxdrawsegs ? maxdrawsegs*2 : 128;
if (firstseg)
firstseg = (drawseg_t *)(firstseg - drawsegs);
drawsegs = Z_Realloc(drawsegs, newmax*sizeof (*drawsegs), PU_STATIC, NULL);
ds_p = drawsegs + pos;
firstnewseg = drawsegs + pos2;
maxdrawsegs = newmax;
if (firstseg)
firstseg = drawsegs + (size_t)firstseg;

View file

@ -1105,7 +1105,7 @@ static void R_ProjectSprite(mobj_t *thing)
{
sprdef = &((skin_t *)thing->skin)->sprites[thing->sprite2];
if (rot >= sprdef->numframes) {
CONS_Alert(CONS_ERROR, M_GetText("R_ProjectSprite: invalid skins[\"%s\"].sprites[SPR2_%s] frame %d\n"), ((skin_t *)thing->skin)->name, spr2names[thing->sprite2], rot);
CONS_Alert(CONS_ERROR, M_GetText("R_ProjectSprite: invalid skins[\"%s\"].sprites[SPR2_%s] frame %s\n"), ((skin_t *)thing->skin)->name, spr2names[thing->sprite2], sizeu5(rot));
thing->sprite = states[S_UNKNOWN].sprite;
thing->frame = states[S_UNKNOWN].frame;
sprdef = &sprites[thing->sprite];

View file

@ -1155,6 +1155,28 @@ void S_StartSoundName(void *mo, const char *soundname)
/// Music
/// ------------------------
#ifdef MUSICSLOT_COMPATIBILITY
const char *compat_special_music_slots[16] =
{
"titles", // 1036 title screen
"read_m", // 1037 intro
"lclear", // 1038 level clear
"invinc", // 1039 invincibility
"shoes", // 1040 super sneakers
"minvnc", // 1041 Mario invincibility
"drown", // 1042 drowning
"gmover", // 1043 game over
"xtlife", // 1044 extra life
"contsc", // 1045 continue screen
"supers", // 1046 Super Sonic
"chrsel", // 1047 character select
"credit", // 1048 credits
"racent", // 1049 Race Results
"stjr", // 1050 Sonic Team Jr. Presents
""
};
#endif
#define music_playing (music_name[0]) // String is empty if no music is playing
static char music_name[7]; // up to 6-character name

View file

@ -139,4 +139,10 @@ void S_StopSoundByNum(sfxenum_t sfxnum);
#define S_StartScreamSound S_StartSound
#endif
#ifdef MUSICSLOT_COMPATIBILITY
// For compatibility with code/scripts relying on older versions
// This is a list of all the "special" slot names and their associated numbers
const char *compat_special_music_slots[16];
#endif
#endif

View file

@ -57,7 +57,7 @@ if(${SDL2_FOUND})
${SRB2_SDL2_SOURCES}
${SRB2_SDL2_HEADERS}
)
source_group("Main" FILES ${SRB2_CORE_SOURCES} ${SRB2_CORE_HEADERS})
source_group("Renderer" FILES ${SRB2_CORE_RENDER_SOURCES})
source_group("Game" FILES ${SRB2_CORE_GAME_SOURCES})
@ -117,7 +117,7 @@ if(${SDL2_FOUND})
add_executable(SRB2SDL2 MACOSX_BUNDLE WIN32 ${SRB2_SDL2_TOTAL_SOURCES})
set_target_properties(SRB2SDL2 PROPERTIES OUTPUT_NAME ${SRB2_SDL2_EXE_NAME})
if(CLANG)
if((CMAKE_CXX_COMPILER_ID STREQUAL "AppleClang"))
add_framework(CoreFoundation SRB2SDL2)
add_framework(SDL2 SRB2SDL2)
add_framework(SDL2_mixer SRB2SDL2)
@ -224,7 +224,7 @@ if(${SDL2_FOUND})
endif()
#### Installation ####
if (CLANG)
if (CMAKE_CXX_COMPILER_ID STREQUAL "AppleClang")
install(TARGETS SRB2SDL2
BUNDLE DESTINATION .
)
@ -265,7 +265,7 @@ if(${SDL2_FOUND})
# Mac bundle fixup
if(CLANG)
if (CMAKE_CXX_COMPILER_ID STREQUAL "AppleClang")
install(CODE "
include(BundleUtilities)
fixup_bundle(\"${CMAKE_INSTALL_PREFIX}/Sonic Robo Blast 2.app\"
@ -279,4 +279,4 @@ if(${SDL2_FOUND})
else()
message(WARNING "SDL2 was not found, so the SDL2 target will not be available.")
set(SRB2_SDL2_AVAILABLE NO PARENT_SCOPE)
endif()
endif()

View file

@ -119,6 +119,12 @@ ifdef SDL_NET
SDL_LDFLAGS+=-lSDL2_net
endif
ifdef MINGW
ifndef NOSDLMAIN
SDLMAIN=1
endif
endif
ifdef SDLMAIN
OPTS+=-DSDLMAIN
else

View file

@ -55,6 +55,10 @@ PSP_MAIN_THREAD_STACK_SIZE_KB(256);
#include "i_ttf.h"
#endif
#if defined (_WIN32) && !defined (main)
//#define SDLMAIN
#endif
#ifdef SDLMAIN
#include "SDL_main.h"
#elif defined(FORCESDLMAIN)
@ -132,7 +136,6 @@ static inline VOID MakeCodeWritable(VOID)
\return int
*/
FUNCNORETURN
#if defined (_XBOX) && defined (__GNUC__)
void XBoxStartup()
{
@ -141,8 +144,10 @@ void XBoxStartup()
myargv = NULL;
#else
#ifdef FORCESDLMAIN
FUNCNORETURN
int SDL_main(int argc, char **argv)
#else
FUNCNORETURN
int main(int argc, char **argv)
#endif
{

View file

@ -45,9 +45,6 @@ typedef DWORD (WINAPI *p_timeGetTime) (void);
typedef UINT (WINAPI *p_timeEndPeriod) (UINT);
typedef HANDLE (WINAPI *p_OpenFileMappingA) (DWORD, BOOL, LPCSTR);
typedef LPVOID (WINAPI *p_MapViewOfFile) (HANDLE, DWORD, DWORD, DWORD, SIZE_T);
typedef HANDLE (WINAPI *p_GetCurrentProcess) (VOID);
typedef BOOL (WINAPI *p_GetProcessAffinityMask) (HANDLE, PDWORD_PTR, PDWORD_PTR);
typedef BOOL (WINAPI *p_SetProcessAffinityMask) (HANDLE, DWORD_PTR);
#endif
#endif
#include <stdio.h>
@ -2779,7 +2776,6 @@ static const char *locateWad(void)
{
return returnWadPath;
}
#endif
// examine default dirs
@ -3070,52 +3066,6 @@ const CPUInfoFlags *I_CPUInfo(void)
#endif
}
#if (defined (_WIN32) && !defined (_WIN32_WCE)) && !defined (_XBOX)
static void CPUAffinity_OnChange(void);
static consvar_t cv_cpuaffinity = {"cpuaffinity", "-1", CV_SAVE | CV_CALL, NULL, CPUAffinity_OnChange, 0, NULL, NULL, 0, 0, NULL};
static p_GetCurrentProcess pfnGetCurrentProcess = NULL;
static p_GetProcessAffinityMask pfnGetProcessAffinityMask = NULL;
static p_SetProcessAffinityMask pfnSetProcessAffinityMask = NULL;
static inline VOID GetAffinityFuncs(VOID)
{
HMODULE h = GetModuleHandleA("kernel32.dll");
pfnGetCurrentProcess = (p_GetCurrentProcess)GetProcAddress(h, "GetCurrentProcess");
pfnGetProcessAffinityMask = (p_GetProcessAffinityMask)GetProcAddress(h, "GetProcessAffinityMask");
pfnSetProcessAffinityMask = (p_SetProcessAffinityMask)GetProcAddress(h, "SetProcessAffinityMask");
}
static void CPUAffinity_OnChange(void)
{
DWORD_PTR dwProcMask, dwSysMask;
HANDLE selfpid;
if (!pfnGetCurrentProcess || !pfnGetProcessAffinityMask || !pfnSetProcessAffinityMask)
return;
else
selfpid = pfnGetCurrentProcess();
pfnGetProcessAffinityMask(selfpid, &dwProcMask, &dwSysMask);
/* If resulting mask is zero, don't change anything and fall back to
* actual mask.
*/
if(dwSysMask & cv_cpuaffinity.value)
{
pfnSetProcessAffinityMask(selfpid, dwSysMask & cv_cpuaffinity.value);
CV_StealthSetValue(&cv_cpuaffinity, (INT32)(dwSysMask & cv_cpuaffinity.value));
}
else
CV_StealthSetValue(&cv_cpuaffinity, (INT32)dwProcMask);
}
#endif
void I_RegisterSysCommands(void)
{
#if (defined (_WIN32) && !defined (_WIN32_WCE)) && !defined (_XBOX)
GetAffinityFuncs();
CV_RegisterVar(&cv_cpuaffinity);
#endif
}
// note CPUAFFINITY code used to reside here
void I_RegisterSysCommands(void) {}
#endif

View file

@ -1701,21 +1701,11 @@ void I_StartupGraphics(void)
keyboard_started = true;
#if !defined(HAVE_TTF)
#ifdef _WIN32 // Initialize Audio as well, otherwise Win32's DirectX can not use audio
if (SDL_InitSubSystem(SDL_INIT_AUDIO|SDL_INIT_VIDEO) < 0)
#else //SDL_OpenAudio will do SDL_InitSubSystem(SDL_INIT_AUDIO)
// Previously audio was init here for questionable reasons?
if (SDL_InitSubSystem(SDL_INIT_VIDEO) < 0)
#endif
{
#ifdef _WIN32
if (SDL_WasInit(SDL_INIT_AUDIO)==0)
CONS_Printf(M_GetText("Couldn't initialize SDL's Audio System with Video System: %s\n"), SDL_GetError());
if (SDL_WasInit(SDL_INIT_VIDEO)==0)
#endif
{
CONS_Printf(M_GetText("Couldn't initialize SDL's Video System: %s\n"), SDL_GetError());
return;
}
CONS_Printf(M_GetText("Couldn't initialize SDL's Video System: %s\n"), SDL_GetError());
return;
}
#endif
{

View file

@ -77,7 +77,16 @@ static INT32 current_track;
void I_StartupSound(void)
{
I_Assert(!sound_started);
sound_started = true;
// EE inits audio first so we're following along.
if (SDL_WasInit(SDL_INIT_AUDIO) == SDL_INIT_AUDIO)
CONS_Printf("SDL Audio already started\n");
else if (SDL_InitSubSystem(SDL_INIT_AUDIO) < 0)
{
CONS_Alert(CONS_ERROR, "Error initializing SDL Audio: %s\n", SDL_GetError());
// call to start audio failed -- we do not have it
return;
}
midimode = false;
music = NULL;
@ -86,19 +95,31 @@ void I_StartupSound(void)
#if SDL_MIXER_VERSION_ATLEAST(1,2,11)
Mix_Init(MIX_INIT_FLAC|MIX_INIT_MOD|MIX_INIT_MP3|MIX_INIT_OGG);
#endif
Mix_OpenAudio(44100, AUDIO_S16LSB, 2, 2048);
if (Mix_OpenAudio(44100, AUDIO_S16SYS, 2, 2048) < 0)
{
CONS_Alert(CONS_ERROR, "Error starting SDL_Mixer: %s\n", Mix_GetError());
// call to start audio failed -- we do not have it
return;
}
sound_started = true;
Mix_AllocateChannels(256);
}
void I_ShutdownSound(void)
{
I_Assert(sound_started);
if (!sound_started)
return; // not an error condition
sound_started = false;
Mix_CloseAudio();
#if SDL_MIXER_VERSION_ATLEAST(1,2,11)
Mix_Quit();
#endif
SDL_QuitSubSystem(SDL_INIT_AUDIO);
#ifdef HAVE_LIBGME
if (gme)
gme_delete(gme);

View file

@ -1213,6 +1213,16 @@ void I_StartupSound(void)
// Configure sound device
CONS_Printf("I_StartupSound:\n");
// EE inits audio first so we're following along.
if (SDL_WasInit(SDL_INIT_AUDIO) == SDL_INIT_AUDIO)
CONS_Printf("SDL Audio already started\n");
else if (SDL_InitSubSystem(SDL_INIT_AUDIO) < 0)
{
CONS_Alert(CONS_ERROR, "Error initializing SDL Audio: %s\n", SDL_GetError());
// call to start audio failed -- we do not have it
return;
}
// Open the audio device
if (M_CheckParm ("-freq") && M_IsNextParm())
{

View file

@ -3656,7 +3656,7 @@ const CPUInfoFlags *I_CPUInfo(void)
}
static void CPUAffinity_OnChange(void);
static consvar_t cv_cpuaffinity = {"cpuaffinity", "1", CV_SAVE | CV_CALL, NULL, CPUAffinity_OnChange, 0, NULL, NULL, 0, 0, NULL};
static consvar_t cv_cpuaffinity = {"cpuaffinity", "-1", CV_CALL, NULL, CPUAffinity_OnChange, 0, NULL, NULL, 0, 0, NULL};
typedef HANDLE (WINAPI *p_GetCurrentProcess) (VOID);
static p_GetCurrentProcess pfnGetCurrentProcess = NULL;