Merge branch 'next'

This commit is contained in:
Alam Ed Arias 2016-05-19 18:36:27 -04:00
commit a7938783de
200 changed files with 21078 additions and 18757 deletions

View file

@ -29,8 +29,8 @@ addons:
- p7zip-full - p7zip-full
before_script: before_script:
- wget --verbose --server-response -c http://rosenthalcastle.org/srb2/SRB2-v2114-assets.7z -O $HOME/srb2_cache/SRB2-v2114-assets.7z - wget --verbose --server-response -c http://rosenthalcastle.org/srb2/SRB2-v2115-assets-2.7z -O $HOME/srb2_cache/SRB2-v2115-assets-2.7z
- 7z x $HOME/srb2_cache/SRB2-v2114-assets.7z -oassets - 7z x $HOME/srb2_cache/SRB2-v2115-assets-2.7z -oassets
- mkdir build - mkdir build
- cd build - cd build
- cmake .. - cmake ..

View file

@ -100,7 +100,8 @@ set(GIT_EXECUTABLE "git" CACHE FILEPATH "Path to git binary")
include(GitUtilities) include(GitUtilities)
git_describe(SRB2_GIT_DESCRIBE "${CMAKE_SOURCE_DIR}") git_describe(SRB2_GIT_DESCRIBE "${CMAKE_SOURCE_DIR}")
git_current_branch(SRB2_GIT_BRANCH "${CMAKE_SOURCE_DIR}") git_current_branch(SRB2_GIT_BRANCH "${CMAKE_SOURCE_DIR}")
set(SRB2_COMP_REVISION "${SRB2_GIT_DESCRIBE}-<${SRB2_GIT_BRANCH}>") set(SRB2_COMP_BRANCH "${SRB2_GIT_BRANCH}")
set(SRB2_COMP_REVISION "${SRB2_GIT_DESCRIBE}")
configure_file(${CMAKE_CURRENT_SOURCE_DIR}/src/config.h.in ${CMAKE_CURRENT_BINARY_DIR}/src/config.h) configure_file(${CMAKE_CURRENT_SOURCE_DIR}/src/config.h.in ${CMAKE_CURRENT_BINARY_DIR}/src/config.h)
##### PACKAGE CONFIGURATION ##### ##### PACKAGE CONFIGURATION #####

450
SRB2.cbp
View file

@ -154,8 +154,8 @@ HW3SOUND for 3D hardware sound support
<Add directory="libs/gme/include" /> <Add directory="libs/gme/include" />
</Compiler> </Compiler>
<Linker> <Linker>
<Add library="SDL" /> <Add library="SDL2" />
<Add library="SDL_mixer" /> <Add library="SDL2_mixer" />
<Add library="advapi32" /> <Add library="advapi32" />
<Add library="kernel32" /> <Add library="kernel32" />
<Add library="msvcrt" /> <Add library="msvcrt" />
@ -200,8 +200,8 @@ HW3SOUND for 3D hardware sound support
<Add directory="libs/gme/include" /> <Add directory="libs/gme/include" />
</Compiler> </Compiler>
<Linker> <Linker>
<Add library="SDL" /> <Add library="SDL2" />
<Add library="SDL_mixer" /> <Add library="SDL2_mixer" />
<Add library="advapi32" /> <Add library="advapi32" />
<Add library="kernel32" /> <Add library="kernel32" />
<Add library="msvcrt" /> <Add library="msvcrt" />
@ -3293,23 +3293,6 @@ HW3SOUND for 3D hardware sound support
<Option target="Debug Mingw64/DirectX" /> <Option target="Debug Mingw64/DirectX" />
<Option target="Release Mingw64/DirectX" /> <Option target="Release Mingw64/DirectX" />
</Unit> </Unit>
<Unit filename="src/p_fab.c">
<Option compilerVar="CC" />
<Option target="Debug Native/SDL" />
<Option target="Release Native/SDL" />
<Option target="Debug Mingw/SDL" />
<Option target="Release Mingw/SDL" />
<Option target="Debug Mingw/DirectX" />
<Option target="Release Mingw/DirectX" />
<Option target="Debug Any/Dummy" />
<Option target="Release Any/Dummy" />
<Option target="Debug Linux/SDL" />
<Option target="Release Linux/SDL" />
<Option target="Debug Mingw64/SDL" />
<Option target="Release Mingw64/SDL" />
<Option target="Debug Mingw64/DirectX" />
<Option target="Release Mingw64/DirectX" />
</Unit>
<Unit filename="src/p_floor.c"> <Unit filename="src/p_floor.c">
<Option compilerVar="CC" /> <Option compilerVar="CC" />
<Option target="Debug Native/SDL" /> <Option target="Debug Native/SDL" />
@ -4141,283 +4124,170 @@ HW3SOUND for 3D hardware sound support
<Option target="Debug Mingw64/DirectX" /> <Option target="Debug Mingw64/DirectX" />
<Option target="Release Mingw64/DirectX" /> <Option target="Release Mingw64/DirectX" />
</Unit> </Unit>
<Unit filename="src/sdl/IMG_xpm.c"> <Unit filename="src/sdl2/IMG_xpm.c">
<Option compilerVar="CC" />
<Option compile="0" />
<Option link="0" />
<Option target="Debug Native/SDL" />
<Option target="Release Native/SDL" />
<Option target="Debug Mingw/SDL" />
<Option target="Release Mingw/SDL" />
<Option target="Debug Any/Dummy" />
<Option target="Release Any/Dummy" />
<Option target="Debug Linux/SDL" />
<Option target="Release Linux/SDL" />
<Option target="Debug Mingw64/SDL" />
<Option target="Release Mingw64/SDL" />
</Unit>
<Unit filename="src/sdl/dosstr.c">
<Option compilerVar="CC" />
<Option target="Debug Native/SDL" />
<Option target="Release Native/SDL" />
<Option target="Debug Mingw/SDL" />
<Option target="Release Mingw/SDL" />
<Option target="Debug Linux/SDL" />
<Option target="Release Linux/SDL" />
<Option target="Debug Mingw64/SDL" />
<Option target="Release Mingw64/SDL" />
</Unit>
<Unit filename="src/sdl/endtxt.c">
<Option compilerVar="CC" />
<Option target="Debug Native/SDL" />
<Option target="Release Native/SDL" />
<Option target="Debug Mingw/SDL" />
<Option target="Release Mingw/SDL" />
<Option target="Debug Linux/SDL" />
<Option target="Release Linux/SDL" />
<Option target="Debug Mingw64/SDL" />
<Option target="Release Mingw64/SDL" />
</Unit>
<Unit filename="src/sdl/endtxt.h">
<Option target="Debug Native/SDL" />
<Option target="Release Native/SDL" />
<Option target="Debug Mingw/SDL" />
<Option target="Release Mingw/SDL" />
<Option target="Debug Any/Dummy" />
<Option target="Release Any/Dummy" />
<Option target="Debug Linux/SDL" />
<Option target="Release Linux/SDL" />
<Option target="Debug Mingw64/SDL" />
<Option target="Release Mingw64/SDL" />
</Unit>
<Unit filename="src/sdl/filter/filters.c">
<Option compilerVar="CC" />
<Option target="Debug Native/SDL" />
<Option target="Release Native/SDL" />
<Option target="Debug Mingw/SDL" />
<Option target="Release Mingw/SDL" />
<Option target="Debug Linux/SDL" />
<Option target="Release Linux/SDL" />
<Option target="Debug Mingw64/SDL" />
<Option target="Release Mingw64/SDL" />
</Unit>
<Unit filename="src/sdl/filter/filters.h">
<Option target="Debug Native/SDL" />
<Option target="Release Native/SDL" />
<Option target="Debug Mingw/SDL" />
<Option target="Release Mingw/SDL" />
<Option target="Debug Any/Dummy" />
<Option target="Release Any/Dummy" />
<Option target="Debug Linux/SDL" />
<Option target="Release Linux/SDL" />
<Option target="Debug Mingw64/SDL" />
<Option target="Release Mingw64/SDL" />
</Unit>
<Unit filename="src/sdl/filter/hq2x.c">
<Option compilerVar="CC" />
<Option target="Debug Native/SDL" />
<Option target="Release Native/SDL" />
<Option target="Debug Mingw/SDL" />
<Option target="Release Mingw/SDL" />
<Option target="Debug Linux/SDL" />
<Option target="Release Linux/SDL" />
<Option target="Debug Mingw64/SDL" />
<Option target="Release Mingw64/SDL" />
</Unit>
<Unit filename="src/sdl/filter/hq2x.h">
<Option target="Debug Native/SDL" />
<Option target="Release Native/SDL" />
<Option target="Debug Mingw/SDL" />
<Option target="Release Mingw/SDL" />
<Option target="Debug Any/Dummy" />
<Option target="Release Any/Dummy" />
<Option target="Debug Linux/SDL" />
<Option target="Release Linux/SDL" />
<Option target="Debug Mingw64/SDL" />
<Option target="Release Mingw64/SDL" />
</Unit>
<Unit filename="src/sdl/filter/interp.h">
<Option target="Debug Native/SDL" />
<Option target="Release Native/SDL" />
<Option target="Debug Mingw/SDL" />
<Option target="Release Mingw/SDL" />
<Option target="Debug Any/Dummy" />
<Option target="Release Any/Dummy" />
<Option target="Debug Linux/SDL" />
<Option target="Release Linux/SDL" />
<Option target="Debug Mingw64/SDL" />
<Option target="Release Mingw64/SDL" />
</Unit>
<Unit filename="src/sdl/filter/lq2x.c">
<Option compilerVar="CC" />
<Option target="Debug Native/SDL" />
<Option target="Release Native/SDL" />
<Option target="Debug Mingw/SDL" />
<Option target="Release Mingw/SDL" />
<Option target="Debug Linux/SDL" />
<Option target="Release Linux/SDL" />
<Option target="Debug Mingw64/SDL" />
<Option target="Release Mingw64/SDL" />
</Unit>
<Unit filename="src/sdl/filter/lq2x.h">
<Option target="Debug Native/SDL" />
<Option target="Release Native/SDL" />
<Option target="Debug Mingw/SDL" />
<Option target="Release Mingw/SDL" />
<Option target="Debug Any/Dummy" />
<Option target="Release Any/Dummy" />
<Option target="Debug Linux/SDL" />
<Option target="Release Linux/SDL" />
<Option target="Debug Mingw64/SDL" />
<Option target="Release Mingw64/SDL" />
</Unit>
<Unit filename="src/sdl/filter/main.c">
<Option compilerVar="CC" />
<Option compile="0" />
<Option link="0" />
<Option target="Debug Native/SDL" />
<Option target="Release Native/SDL" />
<Option target="Debug Mingw/SDL" />
<Option target="Release Mingw/SDL" />
<Option target="Debug Any/Dummy" />
<Option target="Release Any/Dummy" />
<Option target="Debug Linux/SDL" />
<Option target="Release Linux/SDL" />
<Option target="Debug Mingw64/SDL" />
<Option target="Release Mingw64/SDL" />
</Unit>
<Unit filename="src/sdl/hwsym_sdl.c">
<Option compilerVar="CC" />
<Option target="Debug Native/SDL" />
<Option target="Release Native/SDL" />
<Option target="Debug Mingw/SDL" />
<Option target="Release Mingw/SDL" />
<Option target="Debug Linux/SDL" />
<Option target="Release Linux/SDL" />
<Option target="Debug Mingw64/SDL" />
<Option target="Release Mingw64/SDL" />
</Unit>
<Unit filename="src/sdl/hwsym_sdl.h">
<Option target="Debug Native/SDL" />
<Option target="Release Native/SDL" />
<Option target="Debug Mingw/SDL" />
<Option target="Release Mingw/SDL" />
<Option target="Debug Any/Dummy" />
<Option target="Release Any/Dummy" />
<Option target="Debug Linux/SDL" />
<Option target="Release Linux/SDL" />
<Option target="Debug Mingw64/SDL" />
<Option target="Release Mingw64/SDL" />
</Unit>
<Unit filename="src/sdl/i_cdmus.c">
<Option compilerVar="CC" />
<Option target="Debug Native/SDL" />
<Option target="Release Native/SDL" />
<Option target="Debug Mingw/SDL" />
<Option target="Release Mingw/SDL" />
<Option target="Debug Linux/SDL" />
<Option target="Release Linux/SDL" />
<Option target="Debug Mingw64/SDL" />
<Option target="Release Mingw64/SDL" />
</Unit>
<Unit filename="src/sdl/i_main.c">
<Option compilerVar="CC" />
<Option target="Debug Native/SDL" />
<Option target="Release Native/SDL" />
<Option target="Debug Mingw/SDL" />
<Option target="Release Mingw/SDL" />
<Option target="Debug Linux/SDL" />
<Option target="Release Linux/SDL" />
<Option target="Debug Mingw64/SDL" />
<Option target="Release Mingw64/SDL" />
</Unit>
<Unit filename="src/sdl/i_net.c">
<Option compilerVar="CC" />
<Option target="Debug Native/SDL" />
<Option target="Release Native/SDL" />
<Option target="Debug Mingw/SDL" />
<Option target="Release Mingw/SDL" />
<Option target="Debug Linux/SDL" />
<Option target="Release Linux/SDL" />
<Option target="Debug Mingw64/SDL" />
<Option target="Release Mingw64/SDL" />
</Unit>
<Unit filename="src/sdl/i_system.c">
<Option compilerVar="CC" />
<Option target="Debug Native/SDL" />
<Option target="Release Native/SDL" />
<Option target="Debug Mingw/SDL" />
<Option target="Release Mingw/SDL" />
<Option target="Debug Linux/SDL" />
<Option target="Release Linux/SDL" />
<Option target="Debug Mingw64/SDL" />
<Option target="Release Mingw64/SDL" />
</Unit>
<Unit filename="src/sdl/i_video.c">
<Option compilerVar="CC" />
<Option target="Debug Native/SDL" />
<Option target="Release Native/SDL" />
<Option target="Debug Mingw/SDL" />
<Option target="Release Mingw/SDL" />
<Option target="Debug Linux/SDL" />
<Option target="Release Linux/SDL" />
<Option target="Debug Mingw64/SDL" />
<Option target="Release Mingw64/SDL" />
</Unit>
<Unit filename="src/sdl/mixer_sound.c">
<Option compilerVar="CC" />
<Option target="Debug Mingw/SDL" />
<Option target="Release Mingw/SDL" />
<Option target="Debug Linux/SDL" />
<Option target="Release Linux/SDL" />
<Option target="Debug Mingw64/SDL" />
<Option target="Release Mingw64/SDL" />
</Unit>
<Unit filename="src/sdl/ogl_sdl.c">
<Option compilerVar="CC" />
<Option target="Debug Native/SDL" />
<Option target="Release Native/SDL" />
<Option target="Debug Mingw/SDL" />
<Option target="Release Mingw/SDL" />
<Option target="Debug Linux/SDL" />
<Option target="Release Linux/SDL" />
<Option target="Debug Mingw64/SDL" />
<Option target="Release Mingw64/SDL" />
</Unit>
<Unit filename="src/sdl/ogl_sdl.h">
<Option target="Debug Native/SDL" />
<Option target="Release Native/SDL" />
<Option target="Debug Mingw/SDL" />
<Option target="Release Mingw/SDL" />
<Option target="Debug Any/Dummy" />
<Option target="Release Any/Dummy" />
<Option target="Debug Linux/SDL" />
<Option target="Release Linux/SDL" />
<Option target="Debug Mingw64/SDL" />
<Option target="Release Mingw64/SDL" />
</Unit>
<Unit filename="src/sdl/sdl_sound.c">
<Option compilerVar="CC" /> <Option compilerVar="CC" />
<Option target="Debug Native/SDL" /> <Option target="Debug Native/SDL" />
<Option target="Release Native/SDL" /> <Option target="Release Native/SDL" />
<Option target="Debug Linux/SDL" /> <Option target="Debug Linux/SDL" />
<Option target="Release Linux/SDL" /> <Option target="Release Linux/SDL" />
<Option target="Debug Mingw64/SDL" />
<Option target="Release Mingw64/SDL" />
<Option target="Debug Mingw/SDL" /> <Option target="Debug Mingw/SDL" />
<Option target="Release Mingw/SDL" /> <Option target="Release Mingw/SDL" />
</Unit> </Unit>
<Unit filename="src/sdl/sdlmain.h"> <Unit filename="src/sdl2/SDL_icon.xpm">
<Option target="Debug Native/SDL" /> <Option target="Debug Native/SDL" />
<Option target="Release Native/SDL" /> <Option target="Release Native/SDL" />
<Option target="Debug Mingw/SDL" />
<Option target="Release Mingw/SDL" />
<Option target="Debug Any/Dummy" />
<Option target="Release Any/Dummy" />
<Option target="Debug Linux/SDL" /> <Option target="Debug Linux/SDL" />
<Option target="Release Linux/SDL" /> <Option target="Release Linux/SDL" />
<Option target="Debug Mingw64/SDL" /> <Option target="Debug Mingw/SDL" />
<Option target="Release Mingw64/SDL" /> <Option target="Release Mingw/SDL" />
</Unit>
<Unit filename="src/sdl2/dosstr.c">
<Option compilerVar="CC" />
<Option target="Debug Native/SDL" />
<Option target="Release Native/SDL" />
<Option target="Debug Linux/SDL" />
<Option target="Release Linux/SDL" />
<Option target="Debug Mingw/SDL" />
<Option target="Release Mingw/SDL" />
</Unit>
<Unit filename="src/sdl2/endtxt.c">
<Option compilerVar="CC" />
<Option target="Debug Native/SDL" />
<Option target="Release Native/SDL" />
<Option target="Debug Linux/SDL" />
<Option target="Release Linux/SDL" />
<Option target="Debug Mingw/SDL" />
<Option target="Release Mingw/SDL" />
</Unit>
<Unit filename="src/sdl2/endtxt.h">
<Option target="Debug Native/SDL" />
<Option target="Release Native/SDL" />
<Option target="Debug Linux/SDL" />
<Option target="Release Linux/SDL" />
<Option target="Debug Mingw/SDL" />
<Option target="Release Mingw/SDL" />
</Unit>
<Unit filename="src/sdl2/hwsym_sdl.c">
<Option compilerVar="CC" />
<Option target="Debug Native/SDL" />
<Option target="Release Native/SDL" />
<Option target="Debug Linux/SDL" />
<Option target="Release Linux/SDL" />
<Option target="Debug Mingw/SDL" />
<Option target="Release Mingw/SDL" />
</Unit>
<Unit filename="src/sdl2/hwsym_sdl.h">
<Option target="Debug Native/SDL" />
<Option target="Release Native/SDL" />
<Option target="Debug Linux/SDL" />
<Option target="Release Linux/SDL" />
<Option target="Debug Mingw/SDL" />
<Option target="Release Mingw/SDL" />
</Unit>
<Unit filename="src/sdl2/i_cdmus.c">
<Option compilerVar="CC" />
<Option target="Debug Native/SDL" />
<Option target="Release Native/SDL" />
<Option target="Debug Linux/SDL" />
<Option target="Release Linux/SDL" />
<Option target="Debug Mingw/SDL" />
<Option target="Release Mingw/SDL" />
</Unit>
<Unit filename="src/sdl2/i_main.c">
<Option compilerVar="CC" />
<Option target="Debug Native/SDL" />
<Option target="Release Native/SDL" />
<Option target="Debug Linux/SDL" />
<Option target="Release Linux/SDL" />
<Option target="Debug Mingw/SDL" />
<Option target="Release Mingw/SDL" />
</Unit>
<Unit filename="src/sdl2/i_net.c">
<Option compilerVar="CC" />
<Option target="Debug Native/SDL" />
<Option target="Release Native/SDL" />
<Option target="Debug Linux/SDL" />
<Option target="Release Linux/SDL" />
<Option target="Debug Mingw/SDL" />
<Option target="Release Mingw/SDL" />
</Unit>
<Unit filename="src/sdl2/i_system.c">
<Option compilerVar="CC" />
<Option target="Debug Native/SDL" />
<Option target="Release Native/SDL" />
<Option target="Debug Linux/SDL" />
<Option target="Release Linux/SDL" />
<Option target="Debug Mingw/SDL" />
<Option target="Release Mingw/SDL" />
</Unit>
<Unit filename="src/sdl2/i_ttf.c">
<Option compilerVar="CC" />
<Option target="Debug Native/SDL" />
<Option target="Release Native/SDL" />
<Option target="Debug Linux/SDL" />
<Option target="Release Linux/SDL" />
<Option target="Debug Mingw/SDL" />
<Option target="Release Mingw/SDL" />
</Unit>
<Unit filename="src/sdl2/i_ttf.h">
<Option target="Debug Native/SDL" />
<Option target="Release Native/SDL" />
<Option target="Debug Linux/SDL" />
<Option target="Release Linux/SDL" />
<Option target="Debug Mingw/SDL" />
<Option target="Release Mingw/SDL" />
</Unit>
<Unit filename="src/sdl2/i_video.c">
<Option compilerVar="CC" />
<Option target="Debug Native/SDL" />
<Option target="Release Native/SDL" />
<Option target="Debug Linux/SDL" />
<Option target="Release Linux/SDL" />
<Option target="Debug Mingw/SDL" />
<Option target="Release Mingw/SDL" />
</Unit>
<Unit filename="src/sdl2/mixer_sound.c">
<Option compilerVar="CC" />
<Option target="Debug Native/SDL" />
<Option target="Release Native/SDL" />
<Option target="Debug Linux/SDL" />
<Option target="Release Linux/SDL" />
<Option target="Debug Mingw/SDL" />
<Option target="Release Mingw/SDL" />
</Unit>
<Unit filename="src/sdl2/ogl_sdl.c">
<Option compilerVar="CC" />
<Option target="Debug Native/SDL" />
<Option target="Release Native/SDL" />
<Option target="Debug Linux/SDL" />
<Option target="Release Linux/SDL" />
<Option target="Debug Mingw/SDL" />
<Option target="Release Mingw/SDL" />
</Unit>
<Unit filename="src/sdl2/ogl_sdl.h">
<Option target="Debug Native/SDL" />
<Option target="Release Native/SDL" />
<Option target="Debug Linux/SDL" />
<Option target="Release Linux/SDL" />
<Option target="Debug Mingw/SDL" />
<Option target="Release Mingw/SDL" />
</Unit>
<Unit filename="src/sdl2/sdl_sound.c">
<Option compilerVar="CC" />
<Option target="Debug Native/SDL" />
<Option target="Release Native/SDL" />
<Option target="Debug Linux/SDL" />
<Option target="Release Linux/SDL" />
<Option target="Debug Mingw/SDL" />
<Option target="Release Mingw/SDL" />
</Unit>
<Unit filename="src/sdl2/sdlmain.h">
<Option target="Debug Native/SDL" />
<Option target="Release Native/SDL" />
<Option target="Debug Linux/SDL" />
<Option target="Release Linux/SDL" />
<Option target="Debug Mingw/SDL" />
<Option target="Release Mingw/SDL" />
</Unit> </Unit>
<Unit filename="src/sounds.c"> <Unit filename="src/sounds.c">
<Option compilerVar="CC" /> <Option compilerVar="CC" />
@ -4590,13 +4460,13 @@ HW3SOUND for 3D hardware sound support
</Unit> </Unit>
<Unit filename="src/vid_copy.s"> <Unit filename="src/vid_copy.s">
<Option compilerVar="CC" /> <Option compilerVar="CC" />
<Option compiler="avrgcc" use="1" buildCommand="$compiler $options -x assembler-with-cpp -c $file -o $object" /> <Option compiler="gcc" use="1" buildCommand="$compiler $options -x assembler-with-cpp -c $file -o $object" />
<Option compiler="ppcgcc" use="1" buildCommand="$compiler $options -x assembler-with-cpp -c $file -o $object" />
<Option compiler="gnu_gcc_compiler_for_mingw32" use="1" buildCommand="$compiler $options -x assembler-with-cpp -c $file -o $object" /> <Option compiler="gnu_gcc_compiler_for_mingw32" use="1" buildCommand="$compiler $options -x assembler-with-cpp -c $file -o $object" />
<Option compiler="gnu_gcc_compiler_for_mingw64" use="1" buildCommand="$compiler $options -x assembler-with-cpp -c $file -o $object" />
<Option compiler="armelfgcc" use="1" buildCommand="$compiler $options -x assembler-with-cpp -c $file -o $object" /> <Option compiler="armelfgcc" use="1" buildCommand="$compiler $options -x assembler-with-cpp -c $file -o $object" />
<Option compiler="tricoregcc" use="1" buildCommand="$compiler $options -x assembler-with-cpp -c $file -o $object" /> <Option compiler="tricoregcc" use="1" buildCommand="$compiler $options -x assembler-with-cpp -c $file -o $object" />
<Option compiler="ppcgcc" use="1" buildCommand="$compiler $options -x assembler-with-cpp -c $file -o $object" /> <Option compiler="avrgcc" use="1" buildCommand="$compiler $options -x assembler-with-cpp -c $file -o $object" />
<Option compiler="gcc" use="1" buildCommand="$compiler $options -x assembler-with-cpp -c $file -o $object" /> <Option compiler="gnu_gcc_compiler_for_mingw64" use="1" buildCommand="$compiler $options -x assembler-with-cpp -c $file -o $object" />
<Option target="Debug Native/SDL" /> <Option target="Debug Native/SDL" />
<Option target="Release Native/SDL" /> <Option target="Release Native/SDL" />
<Option target="Debug Linux/SDL" /> <Option target="Debug Linux/SDL" />

View file

@ -27,7 +27,6 @@ find_library(SDL2_LIBRARY
"/usr/local/lib" "/usr/local/lib"
) )
# set include dir variables # set include dir variables
set(SDL2_PROCESS_INCLUDES SDL2_INCLUDE_DIR) set(SDL2_PROCESS_INCLUDES SDL2_INCLUDE_DIR)
set(SDL2_PROCESS_LIBS SDL2_LIBRARY) set(SDL2_PROCESS_LIBS SDL2_LIBRARY)

View file

@ -139,7 +139,6 @@ set(SRB2_CORE_RENDER_SOURCES
set(SRB2_CORE_GAME_SOURCES set(SRB2_CORE_GAME_SOURCES
p_ceilng.c p_ceilng.c
p_enemy.c p_enemy.c
p_fab.c
p_floor.c p_floor.c
p_inter.c p_inter.c
p_lights.c p_lights.c
@ -150,6 +149,7 @@ set(SRB2_CORE_GAME_SOURCES
p_saveg.c p_saveg.c
p_setup.c p_setup.c
p_sight.c p_sight.c
p_slopes.c
p_spec.c p_spec.c
p_telept.c p_telept.c
p_tick.c p_tick.c
@ -162,6 +162,7 @@ set(SRB2_CORE_GAME_SOURCES
p_pspr.h p_pspr.h
p_saveg.h p_saveg.h
p_setup.h p_setup.h
p_slopes.h
p_spec.h p_spec.h
p_tick.h p_tick.h
) )

View file

@ -372,7 +372,7 @@ else
# build a normal optimised version # build a normal optimised version
WINDRESFLAGS = -DNDEBUG WINDRESFLAGS = -DNDEBUG
CFLAGS+=-O2 #CFLAGS+=-O2
endif endif
CFLAGS+=-g $(OPTS) $(M5) $(WINDRESFLAGS) CFLAGS+=-g $(OPTS) $(M5) $(WINDRESFLAGS)
@ -437,7 +437,6 @@ OBJS:=$(i_main_o) \
$(OBJDIR)/info.o \ $(OBJDIR)/info.o \
$(OBJDIR)/p_ceilng.o \ $(OBJDIR)/p_ceilng.o \
$(OBJDIR)/p_enemy.o \ $(OBJDIR)/p_enemy.o \
$(OBJDIR)/p_fab.o \
$(OBJDIR)/p_floor.o \ $(OBJDIR)/p_floor.o \
$(OBJDIR)/p_inter.o \ $(OBJDIR)/p_inter.o \
$(OBJDIR)/p_lights.o \ $(OBJDIR)/p_lights.o \
@ -452,6 +451,7 @@ OBJS:=$(i_main_o) \
$(OBJDIR)/p_telept.o \ $(OBJDIR)/p_telept.o \
$(OBJDIR)/p_tick.o \ $(OBJDIR)/p_tick.o \
$(OBJDIR)/p_user.o \ $(OBJDIR)/p_user.o \
$(OBJDIR)/p_slopes.o \
$(OBJDIR)/tables.o \ $(OBJDIR)/tables.o \
$(OBJDIR)/r_bsp.o \ $(OBJDIR)/r_bsp.o \
$(OBJDIR)/r_data.o \ $(OBJDIR)/r_data.o \

View file

@ -2,19 +2,20 @@
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
// Copyright (C) 1993-1996 by id Software, Inc. // Copyright (C) 1993-1996 by id Software, Inc.
// Copyright (C) 1998-2000 by DooM Legacy Team. // Copyright (C) 1998-2000 by DooM Legacy Team.
// Copyright (C) 1999-2014 by Sonic Team Junior. // Copyright (C) 1999-2016 by Sonic Team Junior.
// //
// This program is free software distributed under the // This program is free software distributed under the
// terms of the GNU General Public License, version 2. // terms of the GNU General Public License, version 2.
// See the 'LICENSE' file for more details. // See the 'LICENSE' file for more details.
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
/// \file am_map.c /// \file am_map.c
/// \brief the automap code /// \brief Code for the 'automap', former Doom feature used for DEVMODE testing
#include "g_game.h" #include "g_game.h"
#include "am_map.h" #include "am_map.h"
#include "g_input.h" #include "g_input.h"
#include "p_local.h" #include "p_local.h"
#include "p_slopes.h"
#include "v_video.h" #include "v_video.h"
#include "i_video.h" #include "i_video.h"
#include "r_state.h" #include "r_state.h"
@ -996,6 +997,10 @@ static inline void AM_drawWalls(void)
{ {
size_t i; size_t i;
static mline_t l; static mline_t l;
#ifdef ESLOPE
fixed_t frontf1,frontf2, frontc1, frontc2; // front floor/ceiling ends
fixed_t backf1, backf2, backc1, backc2; // back floor ceiling ends
#endif
for (i = 0; i < numlines; i++) for (i = 0; i < numlines; i++)
{ {
@ -1003,6 +1008,22 @@ static inline void AM_drawWalls(void)
l.a.y = lines[i].v1->y; l.a.y = lines[i].v1->y;
l.b.x = lines[i].v2->x; l.b.x = lines[i].v2->x;
l.b.y = lines[i].v2->y; l.b.y = lines[i].v2->y;
#ifdef ESLOPE
#define SLOPEPARAMS(slope, end1, end2, normalheight) \
if (slope) { \
end1 = P_GetZAt(slope, l.a.x, l.a.y); \
end2 = P_GetZAt(slope, l.b.x, l.b.y); \
} else \
end1 = end2 = normalheight;
SLOPEPARAMS(lines[i].frontsector->f_slope, frontf1, frontf2, lines[i].frontsector->floorheight)
SLOPEPARAMS(lines[i].frontsector->c_slope, frontc1, frontc2, lines[i].frontsector->ceilingheight)
if (lines[i].backsector) {
SLOPEPARAMS(lines[i].backsector->f_slope, backf1, backf2, lines[i].backsector->floorheight)
SLOPEPARAMS(lines[i].backsector->c_slope, backc1, backc2, lines[i].backsector->ceilingheight)
}
#undef SLOPEPARAMS
#endif
// AM_drawMline(&l, GRAYS + 3); // Old, everything-is-gray automap // AM_drawMline(&l, GRAYS + 3); // Old, everything-is-gray automap
if (!lines[i].backsector) // 1-sided if (!lines[i].backsector) // 1-sided
@ -1016,11 +1037,19 @@ static inline void AM_drawWalls(void)
AM_drawMline(&l, WALLCOLORS+lightlev); AM_drawMline(&l, WALLCOLORS+lightlev);
} }
} }
#ifdef ESLOPE
else if ((backf1 == backc1 && backf2 == backc2) // Back is thok barrier
|| (frontf1 == frontc1 && frontf2 == frontc2)) // Front is thok barrier
{
if (backf1 == backc1 && backf2 == backc2
&& frontf1 == frontc1 && frontf2 == frontc2) // BOTH are thok barriers
#else
else if (lines[i].backsector->floorheight == lines[i].backsector->ceilingheight // Back is thok barrier else if (lines[i].backsector->floorheight == lines[i].backsector->ceilingheight // Back is thok barrier
|| lines[i].frontsector->floorheight == lines[i].frontsector->ceilingheight) // Front is thok barrier || lines[i].frontsector->floorheight == lines[i].frontsector->ceilingheight) // Front is thok barrier
{ {
if (lines[i].backsector->floorheight == lines[i].backsector->ceilingheight if (lines[i].backsector->floorheight == lines[i].backsector->ceilingheight
&& lines[i].frontsector->floorheight == lines[i].frontsector->ceilingheight) // BOTH are thok barriers && lines[i].frontsector->floorheight == lines[i].frontsector->ceilingheight) // BOTH are thok barriers
#endif
{ {
if (lines[i].flags & ML_NOCLIMB) if (lines[i].flags & ML_NOCLIMB)
{ {
@ -1046,12 +1075,20 @@ static inline void AM_drawWalls(void)
else else
{ {
if (lines[i].flags & ML_NOCLIMB) { if (lines[i].flags & ML_NOCLIMB) {
#ifdef ESLOPE
if (backf1 != frontf1 || backf2 != frontf2) {
#else
if (lines[i].backsector->floorheight if (lines[i].backsector->floorheight
!= lines[i].frontsector->floorheight) { != lines[i].frontsector->floorheight) {
#endif
AM_drawMline(&l, NOCLIMBFDWALLCOLORS + lightlev); // floor level change AM_drawMline(&l, NOCLIMBFDWALLCOLORS + lightlev); // floor level change
} }
#ifdef ESLOPE
else if (backc1 != frontc1 || backc2 != frontc2) {
#else
else if (lines[i].backsector->ceilingheight else if (lines[i].backsector->ceilingheight
!= lines[i].frontsector->ceilingheight) { != lines[i].frontsector->ceilingheight) {
#endif
AM_drawMline(&l, NOCLIMBCDWALLCOLORS+lightlev); // ceiling level change AM_drawMline(&l, NOCLIMBCDWALLCOLORS+lightlev); // ceiling level change
} }
else { else {
@ -1060,12 +1097,20 @@ static inline void AM_drawWalls(void)
} }
else else
{ {
#ifdef ESLOPE
if (backf1 != frontf1 || backf2 != frontf2) {
#else
if (lines[i].backsector->floorheight if (lines[i].backsector->floorheight
!= lines[i].frontsector->floorheight) { != lines[i].frontsector->floorheight) {
#endif
AM_drawMline(&l, FDWALLCOLORS + lightlev); // floor level change AM_drawMline(&l, FDWALLCOLORS + lightlev); // floor level change
} }
#ifdef ESLOPE
else if (backc1 != frontc1 || backc2 != frontc2) {
#else
else if (lines[i].backsector->ceilingheight else if (lines[i].backsector->ceilingheight
!= lines[i].frontsector->ceilingheight) { != lines[i].frontsector->ceilingheight) {
#endif
AM_drawMline(&l, CDWALLCOLORS+lightlev); // ceiling level change AM_drawMline(&l, CDWALLCOLORS+lightlev); // ceiling level change
} }
else { else {

View file

@ -2,14 +2,14 @@
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
// Copyright (C) 1993-1996 by id Software, Inc. // Copyright (C) 1993-1996 by id Software, Inc.
// Copyright (C) 1998-2000 by DooM Legacy Team. // Copyright (C) 1998-2000 by DooM Legacy Team.
// Copyright (C) 1999-2014 by Sonic Team Junior. // Copyright (C) 1999-2016 by Sonic Team Junior.
// //
// This program is free software distributed under the // This program is free software distributed under the
// terms of the GNU General Public License, version 2. // terms of the GNU General Public License, version 2.
// See the 'LICENSE' file for more details. // See the 'LICENSE' file for more details.
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
/// \file am_map.h /// \file am_map.h
/// \brief AutoMap module /// \brief Code for the 'automap', former Doom feature used for DEVMODE testing
#ifndef __AMMAP_H__ #ifndef __AMMAP_H__
#define __AMMAP_H__ #define __AMMAP_H__

View file

@ -1,7 +1,7 @@
// SONIC ROBO BLAST 2 // SONIC ROBO BLAST 2
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
// Copyright (C) 2007-2014 by John "JTE" Muniz. // Copyright (C) 2007-2016 by John "JTE" Muniz.
// Copyright (C) 2011-2014 by Sonic Team Junior. // Copyright (C) 2011-2016 by Sonic Team Junior.
// //
// This program is free software distributed under the // This program is free software distributed under the
// terms of the GNU General Public License, version 2. // terms of the GNU General Public License, version 2.

View file

@ -1,7 +1,7 @@
// SONIC ROBO BLAST 2 // SONIC ROBO BLAST 2
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
// Copyright (C) 2007-2014 by John "JTE" Muniz. // Copyright (C) 2007-2016 by John "JTE" Muniz.
// Copyright (C) 2012-2014 by Sonic Team Junior. // Copyright (C) 2012-2016 by Sonic Team Junior.
// //
// This program is free software distributed under the // This program is free software distributed under the
// terms of the GNU General Public License, version 2. // terms of the GNU General Public License, version 2.

View file

@ -11,6 +11,13 @@
#include <limits.h> #include <limits.h>
#include <stddef.h> #include <stddef.h>
#ifdef _MSC_VER
#define INT32 __int32
#else
#include <stdint.h>
#define INT32 int32_t
#endif
/* /*
** ================================================================== ** ==================================================================
@ -140,7 +147,7 @@
** CHANGE that if ptrdiff_t is not adequate on your machine. (On most ** CHANGE that if ptrdiff_t is not adequate on your machine. (On most
** machines, ptrdiff_t gives a good choice between int or long.) ** machines, ptrdiff_t gives a good choice between int or long.)
*/ */
#define LUA_INTEGER ptrdiff_t #define LUA_INTEGER INT32
/* /*
@ -502,13 +509,13 @@
*/ */
//#define LUA_NUMBER_DOUBLE //#define LUA_NUMBER_DOUBLE
#define LUA_NUMBER ptrdiff_t #define LUA_NUMBER INT32
/* /*
@@ LUAI_UACNUMBER is the result of an 'usual argument conversion' @@ LUAI_UACNUMBER is the result of an 'usual argument conversion'
@* over a number. @* over a number.
*/ */
#define LUAI_UACNUMBER ptrdiff_t #define LUAI_UACNUMBER INT32
/* /*
@ -519,14 +526,14 @@
@@ lua_str2number converts a string to a number. @@ lua_str2number converts a string to a number.
*/ */
#ifdef LUA_WIN #ifdef LUA_WIN
#define LUA_NUMBER_SCAN "%Ii" #define LUA_NUMBER_SCAN "%d"
#define LUA_NUMBER_FMT "%Ii" #define LUA_NUMBER_FMT "%d"
#else #else
#define LUA_NUMBER_SCAN "%ti" #define LUA_NUMBER_SCAN "%d"
#define LUA_NUMBER_FMT "%ti" #define LUA_NUMBER_FMT "%d"
#endif #endif
#define lua_number2str(s,n) sprintf((s), LUA_NUMBER_FMT, (n)) #define lua_number2str(s,n) sprintf((s), LUA_NUMBER_FMT, (n))
#define LUAI_MAXNUMBER2STR 32 /* 16 digits, sign, point, and \0 */ #define LUAI_MAXNUMBER2STR 12 /* 10 digits, sign, and \0 */
#define lua_str2number(s,p) strtol((s), (p), 10) #define lua_str2number(s,p) strtol((s), (p), 10)

View file

@ -1,7 +1,7 @@
// SONIC ROBO BLAST 2 // SONIC ROBO BLAST 2
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
// Copyright (C) 1998-2000 by DooM Legacy Team. // Copyright (C) 1998-2000 by DooM Legacy Team.
// Copyright (C) 1999-2014 by Sonic Team Junior. // Copyright (C) 1999-2016 by Sonic Team Junior.
// //
// This program is free software distributed under the // This program is free software distributed under the
// terms of the GNU General Public License, version 2. // terms of the GNU General Public License, version 2.

View file

@ -1,7 +1,7 @@
// SONIC ROBO BLAST 2 // SONIC ROBO BLAST 2
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
// Copyright (C) 1998-2000 by DooM Legacy Team. // Copyright (C) 1998-2000 by DooM Legacy Team.
// Copyright (C) 1999-2014 by Sonic Team Junior. // Copyright (C) 1999-2016 by Sonic Team Junior.
// //
// This program is free software distributed under the // This program is free software distributed under the
// terms of the GNU General Public License, version 2. // terms of the GNU General Public License, version 2.

View file

@ -1,7 +1,7 @@
// SONIC ROBO BLAST 2 // SONIC ROBO BLAST 2
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
// Copyright (C) 1998-2000 by DooM Legacy Team. // Copyright (C) 1998-2000 by DooM Legacy Team.
// Copyright (C) 1999-2014 by Sonic Team Junior. // Copyright (C) 1999-2016 by Sonic Team Junior.
// //
// This program is free software distributed under the // This program is free software distributed under the
// terms of the GNU General Public License, version 2. // terms of the GNU General Public License, version 2.

View file

@ -9,7 +9,7 @@
#if (defined(CMAKECONFIG)) #if (defined(CMAKECONFIG))
#include "config.h" #include "config.h"
const char *compbranch = ""; // hell if I know what to do with cmake const char *compbranch = SRB2_COMP_BRANCH;
const char *comprevision = SRB2_COMP_REVISION; const char *comprevision = SRB2_COMP_REVISION;
#elif (defined(COMPVERSION)) #elif (defined(COMPVERSION))

View file

@ -15,9 +15,12 @@
#define ASSET_HASH_PLAYER_DTA "${SRB2_ASSET_player.dta_HASH}" #define ASSET_HASH_PLAYER_DTA "${SRB2_ASSET_player.dta_HASH}"
#define ASSET_HASH_RINGS_DTA "${SRB2_ASSET_rings.dta_HASH}" #define ASSET_HASH_RINGS_DTA "${SRB2_ASSET_rings.dta_HASH}"
#define ASSET_HASH_ZONES_DTA "${SRB2_ASSET_zones.dta_HASH}" #define ASSET_HASH_ZONES_DTA "${SRB2_ASSET_zones.dta_HASH}"
#ifdef USE_PATCH_DTA
#define ASSET_HASH_PATCH_DTA "${SRB2_ASSET_patch.dta_HASH}" #define ASSET_HASH_PATCH_DTA "${SRB2_ASSET_patch.dta_HASH}"
#endif
#define SRB2_COMP_REVISION "${SRB2_COMP_REVISION}" #define SRB2_COMP_REVISION "${SRB2_COMP_REVISION}"
#define SRB2_COMP_BRANCH "${SRB2_COMP_BRANCH}"
#define SRB2_GIT_DESCRIBE "${SRB2_GIT_DESCRIBE}" #define SRB2_GIT_DESCRIBE "${SRB2_GIT_DESCRIBE}"
#define SRB2_GIT_BRANCH "${SRB2_GIT_BRANCH}" #define SRB2_GIT_BRANCH "${SRB2_GIT_BRANCH}"
@ -25,10 +28,16 @@
#else #else
/* Manually defined asset hashes for non-CMake builds
* Last updated 2015 / 05 / 03
*/
#define ASSET_HASH_SRB2_SRB "c1b9577687f8a795104aef4600720ea7" #define ASSET_HASH_SRB2_SRB "c1b9577687f8a795104aef4600720ea7"
#define ASSET_HASH_ZONES_DTA "303838c6c534d9540288360fa49cca60" #define ASSET_HASH_ZONES_DTA "303838c6c534d9540288360fa49cca60"
#define ASSET_HASH_PLAYER_DTA "cfca0f1c73023cbbd8f844f45480f799" #define ASSET_HASH_PLAYER_DTA "cfca0f1c73023cbbd8f844f45480f799"
#define ASSET_HASH_RINGS_DTA "85901ad4bf94637e5753d2ac2c03ea26" #define ASSET_HASH_RINGS_DTA "85901ad4bf94637e5753d2ac2c03ea26"
#ifdef USE_PATCH_DTA
#define ASSET_HASH_PATCH_DTA "dbbf8bc6121618ee3be2d5b14650429b"
#endif
#endif #endif
#endif #endif

View file

@ -1,7 +1,7 @@
// SONIC ROBO BLAST 2 // SONIC ROBO BLAST 2
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
// Copyright (C) 1998-2000 by DooM Legacy Team. // Copyright (C) 1998-2000 by DooM Legacy Team.
// Copyright (C) 1999-2014 by Sonic Team Junior. // Copyright (C) 1999-2016 by Sonic Team Junior.
// //
// This program is free software distributed under the // This program is free software distributed under the
// terms of the GNU General Public License, version 2. // terms of the GNU General Public License, version 2.
@ -202,7 +202,7 @@ static void CONS_Bind_f(void)
} }
key = G_KeyStringtoNum(COM_Argv(1)); key = G_KeyStringtoNum(COM_Argv(1));
if (!key) if (key <= 0 || key >= NUMINPUTS)
{ {
CONS_Alert(CONS_NOTICE, M_GetText("Invalid key name\n")); CONS_Alert(CONS_NOTICE, M_GetText("Invalid key name\n"));
return; return;

View file

@ -1,7 +1,7 @@
// SONIC ROBO BLAST 2 // SONIC ROBO BLAST 2
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
// Copyright (C) 1998-2000 by DooM Legacy Team. // Copyright (C) 1998-2000 by DooM Legacy Team.
// Copyright (C) 1999-2014 by Sonic Team Junior. // Copyright (C) 1999-2016 by Sonic Team Junior.
// //
// This program is free software distributed under the // This program is free software distributed under the
// terms of the GNU General Public License, version 2. // terms of the GNU General Public License, version 2.

View file

@ -1,7 +1,7 @@
// SONIC ROBO BLAST 2 // SONIC ROBO BLAST 2
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
// Copyright (C) 1998-2000 by DooM Legacy Team. // Copyright (C) 1998-2000 by DooM Legacy Team.
// Copyright (C) 1999-2014 by Sonic Team Junior. // Copyright (C) 1999-2016 by Sonic Team Junior.
// //
// This program is free software distributed under the // This program is free software distributed under the
// terms of the GNU General Public License, version 2. // terms of the GNU General Public License, version 2.
@ -517,9 +517,9 @@ static inline void resynch_write_player(resynch_pak *rsp, const size_t i)
rsp->thokitem = (UINT32)LONG(players[i].thokitem); //mobjtype_t rsp->thokitem = (UINT32)LONG(players[i].thokitem); //mobjtype_t
rsp->spinitem = (UINT32)LONG(players[i].spinitem); //mobjtype_t rsp->spinitem = (UINT32)LONG(players[i].spinitem); //mobjtype_t
rsp->revitem = (UINT32)LONG(players[i].revitem); //mobjtype_t rsp->revitem = (UINT32)LONG(players[i].revitem); //mobjtype_t
rsp->actionspd = LONG(players[i].actionspd); rsp->actionspd = (fixed_t)LONG(players[i].actionspd);
rsp->mindash = LONG(players[i].mindash); rsp->mindash = (fixed_t)LONG(players[i].mindash);
rsp->maxdash = LONG(players[i].maxdash); rsp->maxdash = (fixed_t)LONG(players[i].maxdash);
rsp->jumpfactor = (fixed_t)LONG(players[i].jumpfactor); rsp->jumpfactor = (fixed_t)LONG(players[i].jumpfactor);
rsp->speed = (fixed_t)LONG(players[i].speed); rsp->speed = (fixed_t)LONG(players[i].speed);
@ -531,6 +531,7 @@ static inline void resynch_write_player(resynch_pak *rsp, const size_t i)
rsp->deadtimer = players[i].deadtimer; rsp->deadtimer = players[i].deadtimer;
rsp->exiting = (tic_t)LONG(players[i].exiting); rsp->exiting = (tic_t)LONG(players[i].exiting);
rsp->homing = players[i].homing; rsp->homing = players[i].homing;
rsp->skidtime = (tic_t)LONG(players[i].skidtime);
rsp->cmomx = (fixed_t)LONG(players[i].cmomx); rsp->cmomx = (fixed_t)LONG(players[i].cmomx);
rsp->cmomy = (fixed_t)LONG(players[i].cmomy); rsp->cmomy = (fixed_t)LONG(players[i].cmomy);
rsp->rmomx = (fixed_t)LONG(players[i].rmomx); rsp->rmomx = (fixed_t)LONG(players[i].rmomx);
@ -590,7 +591,7 @@ static inline void resynch_write_player(resynch_pak *rsp, const size_t i)
rsp->tics = LONG(players[i].mo->tics); rsp->tics = LONG(players[i].mo->tics);
rsp->statenum = (statenum_t)LONG(players[i].mo->state-states); // :( rsp->statenum = (statenum_t)LONG(players[i].mo->state-states); // :(
rsp->eflags = (UINT32)LONG(players[i].mo->eflags); rsp->eflags = (UINT16)SHORT(players[i].mo->eflags);
rsp->flags = LONG(players[i].mo->flags); rsp->flags = LONG(players[i].mo->flags);
rsp->flags2 = LONG(players[i].mo->flags2); rsp->flags2 = LONG(players[i].mo->flags2);
@ -642,9 +643,9 @@ static void resynch_read_player(resynch_pak *rsp)
players[i].thokitem = (UINT32)LONG(rsp->thokitem); //mobjtype_t players[i].thokitem = (UINT32)LONG(rsp->thokitem); //mobjtype_t
players[i].spinitem = (UINT32)LONG(rsp->spinitem); //mobjtype_t players[i].spinitem = (UINT32)LONG(rsp->spinitem); //mobjtype_t
players[i].revitem = (UINT32)LONG(rsp->revitem); //mobjtype_t players[i].revitem = (UINT32)LONG(rsp->revitem); //mobjtype_t
players[i].actionspd = LONG(rsp->actionspd); players[i].actionspd = (fixed_t)LONG(rsp->actionspd);
players[i].mindash = LONG(rsp->mindash); players[i].mindash = (fixed_t)LONG(rsp->mindash);
players[i].maxdash = LONG(rsp->maxdash); players[i].maxdash = (fixed_t)LONG(rsp->maxdash);
players[i].jumpfactor = (fixed_t)LONG(rsp->jumpfactor); players[i].jumpfactor = (fixed_t)LONG(rsp->jumpfactor);
players[i].speed = (fixed_t)LONG(rsp->speed); players[i].speed = (fixed_t)LONG(rsp->speed);
@ -656,6 +657,7 @@ static void resynch_read_player(resynch_pak *rsp)
players[i].deadtimer = rsp->deadtimer; players[i].deadtimer = rsp->deadtimer;
players[i].exiting = (tic_t)LONG(rsp->exiting); players[i].exiting = (tic_t)LONG(rsp->exiting);
players[i].homing = rsp->homing; players[i].homing = rsp->homing;
players[i].skidtime = (tic_t)LONG(rsp->skidtime);
players[i].cmomx = (fixed_t)LONG(rsp->cmomx); players[i].cmomx = (fixed_t)LONG(rsp->cmomx);
players[i].cmomy = (fixed_t)LONG(rsp->cmomy); players[i].cmomy = (fixed_t)LONG(rsp->cmomy);
players[i].rmomx = (fixed_t)LONG(rsp->rmomx); players[i].rmomx = (fixed_t)LONG(rsp->rmomx);
@ -713,7 +715,7 @@ static void resynch_read_player(resynch_pak *rsp)
//At this point, the player should have a body, whether they were respawned or not. //At this point, the player should have a body, whether they were respawned or not.
P_UnsetThingPosition(players[i].mo); P_UnsetThingPosition(players[i].mo);
players[i].mo->angle = (angle_t)LONG(rsp->angle); players[i].mo->angle = (angle_t)LONG(rsp->angle);
players[i].mo->eflags = (UINT32)LONG(rsp->eflags); players[i].mo->eflags = (UINT16)SHORT(rsp->eflags);
players[i].mo->flags = LONG(rsp->flags); players[i].mo->flags = LONG(rsp->flags);
players[i].mo->flags2 = LONG(rsp->flags2); players[i].mo->flags2 = LONG(rsp->flags2);
players[i].mo->friction = LONG(rsp->friction); players[i].mo->friction = LONG(rsp->friction);
@ -2935,9 +2937,9 @@ static void Got_AddPlayer(UINT8 **p, INT32 playernum)
if (botingame) if (botingame)
players[newplayernum].bot = 1; players[newplayernum].bot = 1;
// Same goes for player 2 when relevant // Same goes for player 2 when relevant
players[newplayernum].pflags &= ~(/*PF_FLIPCAM|*/PF_ANALOGMODE); players[newplayernum].pflags &= ~(PF_FLIPCAM|PF_ANALOGMODE);
//if (cv_flipcam2.value) if (cv_flipcam2.value)
//players[newplayernum].pflags |= PF_FLIPCAM; players[newplayernum].pflags |= PF_FLIPCAM;
if (cv_analog2.value) if (cv_analog2.value)
players[newplayernum].pflags |= PF_ANALOGMODE; players[newplayernum].pflags |= PF_ANALOGMODE;
} }

View file

@ -1,7 +1,7 @@
// SONIC ROBO BLAST 2 // SONIC ROBO BLAST 2
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
// Copyright (C) 1998-2000 by DooM Legacy Team. // Copyright (C) 1998-2000 by DooM Legacy Team.
// Copyright (C) 1999-2014 by Sonic Team Junior. // Copyright (C) 1999-2016 by Sonic Team Junior.
// //
// This program is free software distributed under the // This program is free software distributed under the
// terms of the GNU General Public License, version 2. // terms of the GNU General Public License, version 2.
@ -177,9 +177,9 @@ typedef struct
UINT32 thokitem; //mobjtype_t UINT32 thokitem; //mobjtype_t
UINT32 spinitem; //mobjtype_t UINT32 spinitem; //mobjtype_t
UINT32 revitem; //mobjtype_t UINT32 revitem; //mobjtype_t
INT32 actionspd; fixed_t actionspd;
INT32 mindash; fixed_t mindash;
INT32 maxdash; fixed_t maxdash;
fixed_t jumpfactor; fixed_t jumpfactor;
fixed_t speed; fixed_t speed;
@ -191,6 +191,7 @@ typedef struct
INT32 deadtimer; INT32 deadtimer;
tic_t exiting; tic_t exiting;
UINT8 homing; UINT8 homing;
tic_t skidtime;
fixed_t cmomx; fixed_t cmomx;
fixed_t cmomy; fixed_t cmomy;
fixed_t rmomx; fixed_t rmomx;
@ -241,11 +242,11 @@ typedef struct
fixed_t friction; fixed_t friction;
fixed_t movefactor; fixed_t movefactor;
INT16 tics; INT32 tics;
statenum_t statenum; statenum_t statenum;
UINT32 flags; UINT32 flags;
UINT32 flags2; UINT32 flags2;
UINT8 eflags; UINT16 eflags;
fixed_t radius; fixed_t radius;
fixed_t height; fixed_t height;

View file

@ -2,7 +2,7 @@
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
// Copyright (C) 1993-1996 by id Software, Inc. // Copyright (C) 1993-1996 by id Software, Inc.
// Copyright (C) 1998-2000 by DooM Legacy Team. // Copyright (C) 1998-2000 by DooM Legacy Team.
// Copyright (C) 1999-2014 by Sonic Team Junior. // Copyright (C) 1999-2016 by Sonic Team Junior.
// //
// This program is free software distributed under the // This program is free software distributed under the
// terms of the GNU General Public License, version 2. // terms of the GNU General Public License, version 2.

View file

@ -2,7 +2,7 @@
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
// Copyright (C) 1993-1996 by id Software, Inc. // Copyright (C) 1993-1996 by id Software, Inc.
// Copyright (C) 1998-2000 by DooM Legacy Team. // Copyright (C) 1998-2000 by DooM Legacy Team.
// Copyright (C) 1999-2014 by Sonic Team Junior. // Copyright (C) 1999-2016 by Sonic Team Junior.
// //
// This program is free software distributed under the // This program is free software distributed under the
// terms of the GNU General Public License, version 2. // terms of the GNU General Public License, version 2.
@ -96,6 +96,10 @@ int snprintf(char *str, size_t n, const char *fmt, ...);
#include "hardware/hw3sound.h" #include "hardware/hw3sound.h"
#endif #endif
#ifdef HAVE_BLUA
#include "lua_script.h"
#endif
// platform independant focus loss // platform independant focus loss
UINT8 window_notinfocus = false; UINT8 window_notinfocus = false;
@ -217,10 +221,7 @@ gamestate_t wipegamestate = GS_LEVEL;
static void D_Display(void) static void D_Display(void)
{ {
static boolean menuactivestate = false; boolean forcerefresh = false;
static gamestate_t oldgamestate = -1;
boolean redrawsbar = false;
static boolean wipe = false; static boolean wipe = false;
INT32 wipedefindex = 0; INT32 wipedefindex = 0;
@ -241,23 +242,15 @@ static void D_Display(void)
if (setsizeneeded) if (setsizeneeded)
{ {
R_ExecuteSetViewSize(); R_ExecuteSetViewSize();
oldgamestate = -1; // force background redraw forcerefresh = true; // force background redraw
redrawsbar = true;
} }
// save the current screen if about to wipe
if (gamestate != wipegamestate)
{
wipe = true;
F_WipeStartScreen();
}
else
wipe = false;
// draw buffered stuff to screen // draw buffered stuff to screen
// Used only by linux GGI version // Used only by linux GGI version
I_UpdateNoBlit(); I_UpdateNoBlit();
// save the current screen if about to wipe
wipe = (gamestate != wipegamestate);
if (wipe) if (wipe)
{ {
// set for all later // set for all later
@ -276,6 +269,7 @@ static void D_Display(void)
if (gamestate != GS_LEVEL // fades to black on its own timing, always if (gamestate != GS_LEVEL // fades to black on its own timing, always
&& wipedefs[wipedefindex] != UINT8_MAX) && wipedefs[wipedefindex] != UINT8_MAX)
{ {
F_WipeStartScreen();
V_DrawFill(0, 0, BASEVIDWIDTH, BASEVIDHEIGHT, 31); V_DrawFill(0, 0, BASEVIDWIDTH, BASEVIDHEIGHT, 31);
F_WipeEndScreen(); F_WipeEndScreen();
F_RunWipe(wipedefs[wipedefindex], gamestate != GS_TIMEATTACK); F_RunWipe(wipedefs[wipedefindex], gamestate != GS_TIMEATTACK);
@ -294,8 +288,6 @@ static void D_Display(void)
HU_Erase(); HU_Erase();
if (automapactive) if (automapactive)
AM_Drawer(); AM_Drawer();
if (wipe || menuactivestate || (rendermode != render_soft && rendermode != render_none) || vid.recalc)
redrawsbar = true;
break; break;
case GS_INTERMISSION: case GS_INTERMISSION:
@ -353,11 +345,6 @@ static void D_Display(void)
// see if the border needs to be initially drawn // see if the border needs to be initially drawn
if (gamestate == GS_LEVEL) if (gamestate == GS_LEVEL)
{ {
#if 0
if (oldgamestate != GS_LEVEL)
R_FillBackScreen(); // draw the pattern into the back screen
#endif
// draw the view directly // draw the view directly
if (!automapactive && !dedicated && cv_renderview.value) if (!automapactive && !dedicated && cv_renderview.value)
{ {
@ -413,17 +400,17 @@ static void D_Display(void)
lastdraw = false; lastdraw = false;
} }
ST_Drawer(redrawsbar); ST_Drawer();
HU_Drawer(); HU_Drawer();
} }
// change gamma if needed // change gamma if needed
if (gamestate != oldgamestate && gamestate != GS_LEVEL) // (GS_LEVEL handles this already due to level-specific palettes)
if (forcerefresh && gamestate != GS_LEVEL)
V_SetPalette(0); V_SetPalette(0);
menuactivestate = menuactive; wipegamestate = gamestate;
oldgamestate = wipegamestate = gamestate;
// draw pause pic // draw pause pic
if (paused && cv_showhud.value && (!menuactive || netgame)) if (paused && cv_showhud.value && (!menuactive || netgame))
@ -446,15 +433,22 @@ static void D_Display(void)
CON_Drawer(); CON_Drawer();
M_Drawer(); // menu is drawn even on top of everything M_Drawer(); // menu is drawn even on top of everything
// focus lost moved to M_Drawer
// focus lost notification goes on top of everything, even the former everything //
if (window_notinfocus) // wipe update
//
if (wipe)
{ {
M_DrawTextBox((BASEVIDWIDTH/2) - (60), (BASEVIDHEIGHT/2) - (16), 13, 2); // note: moved up here because NetUpdate does input changes
if (gamestate == GS_LEVEL && (P_AutoPause() || paused)) // and input during wipe tends to mess things up
V_DrawCenteredString(BASEVIDWIDTH/2, (BASEVIDHEIGHT/2) - (4), V_YELLOWMAP, "Game Paused"); wipedefindex += WIPEFINALSHIFT;
else
V_DrawCenteredString(BASEVIDWIDTH/2, (BASEVIDHEIGHT/2) - (4), V_YELLOWMAP, "Focus Lost"); if (rendermode != render_none)
{
F_WipeEndScreen();
F_RunWipe(wipedefs[wipedefindex], gamestate != GS_TIMEATTACK);
}
} }
NetUpdate(); // send out any new accumulation NetUpdate(); // send out any new accumulation
@ -489,18 +483,6 @@ static void D_Display(void)
} }
I_FinishUpdate(); // page flip or blit buffer I_FinishUpdate(); // page flip or blit buffer
return;
}
//
// wipe update
//
wipedefindex += WIPEFINALSHIFT;
if (rendermode != render_none)
{
F_WipeEndScreen();
F_RunWipe(wipedefs[wipedefindex], gamestate != GS_TIMEATTACK);
} }
} }
@ -632,6 +614,10 @@ void D_SRB2Loop(void)
#ifdef HW3SOUND #ifdef HW3SOUND
HW3S_EndFrameUpdate(); HW3S_EndFrameUpdate();
#endif #endif
#ifdef HAVE_BLUA
LUA_Step();
#endif
} }
} }
@ -831,8 +817,10 @@ static void IdentifyVersion(void)
// Add the weapons // Add the weapons
D_AddFile(va(pandf,srb2waddir,"rings.dta")); D_AddFile(va(pandf,srb2waddir,"rings.dta"));
#ifdef USE_PATCH_DTA
// Add our crappy patches to fix our bugs // Add our crappy patches to fix our bugs
// D_AddFile(va(pandf,srb2waddir,"patch.dta")); D_AddFile(va(pandf,srb2waddir,"patch.dta"));
#endif
#if !defined (HAVE_SDL) || defined (HAVE_MIXER) #if !defined (HAVE_SDL) || defined (HAVE_MIXER)
{ {
@ -941,9 +929,9 @@ void D_SRB2Main(void)
#endif #endif
#if defined (_WIN32_WCE) //|| defined (_DEBUG) || defined (GP2X) #if defined (_WIN32_WCE) //|| defined (_DEBUG) || defined (GP2X)
devparm = !M_CheckParm("-nodebug"); devparm = M_CheckParm("-nodebug") == 0;
#else #else
devparm = M_CheckParm("-debug"); devparm = M_CheckParm("-debug") != 0;
#endif #endif
// for dedicated server // for dedicated server
@ -1116,19 +1104,25 @@ void D_SRB2Main(void)
#endif #endif
D_CleanFile(); D_CleanFile();
#if 1 // md5s last updated 12/14/14 #ifndef DEVELOP // md5s last updated 12/14/14
// Check MD5s of autoloaded files // Check MD5s of autoloaded files
W_VerifyFileMD5(0, ASSET_HASH_SRB2_SRB); // srb2.srb/srb2.wad W_VerifyFileMD5(0, ASSET_HASH_SRB2_SRB); // srb2.srb/srb2.wad
W_VerifyFileMD5(1, ASSET_HASH_ZONES_DTA); // zones.dta W_VerifyFileMD5(1, ASSET_HASH_ZONES_DTA); // zones.dta
W_VerifyFileMD5(2, ASSET_HASH_PLAYER_DTA); // player.dta W_VerifyFileMD5(2, ASSET_HASH_PLAYER_DTA); // player.dta
W_VerifyFileMD5(3, ASSET_HASH_RINGS_DTA); // rings.dta W_VerifyFileMD5(3, ASSET_HASH_RINGS_DTA); // rings.dta
//W_VerifyFileMD5(4, "0c66790502e648bfce90fdc5bb15722e"); // patch.dta #ifdef USE_PATCH_DTA
// don't check music.dta because people like to modify it, and it doesn't matter if they do W_VerifyFileMD5(4, ASSET_HASH_PATCH_DTA); // patch.dta
// ...except it does if they slip maps in there, and that's what W_VerifyNMUSlumps is for.
#endif #endif
mainwads = 4; // there are 5 wads not to unload // don't check music.dta because people like to modify it, and it doesn't matter if they do
// ...except it does if they slip maps in there, and that's what W_VerifyNMUSlumps is for.
#endif //ifndef DEVELOP
mainwads = 4; // there are 4 wads not to unload
#ifdef USE_PATCH_DTA
++mainwads; // patch.dta adds one more
#endif
cht_Init(); cht_Init();

View file

@ -2,7 +2,7 @@
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
// Copyright (C) 1993-1996 by id Software, Inc. // Copyright (C) 1993-1996 by id Software, Inc.
// Copyright (C) 1998-2000 by DooM Legacy Team. // Copyright (C) 1998-2000 by DooM Legacy Team.
// Copyright (C) 1999-2014 by Sonic Team Junior. // Copyright (C) 1999-2016 by Sonic Team Junior.
// //
// This program is free software distributed under the // This program is free software distributed under the
// terms of the GNU General Public License, version 2. // terms of the GNU General Public License, version 2.

View file

@ -2,7 +2,7 @@
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
// Copyright (C) 1993-1996 by id Software, Inc. // Copyright (C) 1993-1996 by id Software, Inc.
// Copyright (C) 1998-2000 by DooM Legacy Team. // Copyright (C) 1998-2000 by DooM Legacy Team.
// Copyright (C) 1999-2014 by Sonic Team Junior. // Copyright (C) 1999-2016 by Sonic Team Junior.
// //
// This program is free software distributed under the // This program is free software distributed under the
// terms of the GNU General Public License, version 2. // terms of the GNU General Public License, version 2.

View file

@ -2,7 +2,7 @@
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
// Copyright (C) 1993-1996 by id Software, Inc. // Copyright (C) 1993-1996 by id Software, Inc.
// Copyright (C) 1998-2000 by DooM Legacy Team. // Copyright (C) 1998-2000 by DooM Legacy Team.
// Copyright (C) 1999-2014 by Sonic Team Junior. // Copyright (C) 1999-2016 by Sonic Team Junior.
// //
// This program is free software distributed under the // This program is free software distributed under the
// terms of the GNU General Public License, version 2. // terms of the GNU General Public License, version 2.

View file

@ -1,7 +1,7 @@
// SONIC ROBO BLAST 2 // SONIC ROBO BLAST 2
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
// Copyright (C) 1998-2000 by DooM Legacy Team. // Copyright (C) 1998-2000 by DooM Legacy Team.
// Copyright (C) 1999-2014 by Sonic Team Junior. // Copyright (C) 1999-2016 by Sonic Team Junior.
// //
// This program is free software distributed under the // This program is free software distributed under the
// terms of the GNU General Public License, version 2. // terms of the GNU General Public License, version 2.
@ -597,7 +597,9 @@ void D_RegisterClientCommands(void)
CV_RegisterVar(&cv_gif_optimize); CV_RegisterVar(&cv_gif_optimize);
CV_RegisterVar(&cv_gif_downscale); CV_RegisterVar(&cv_gif_downscale);
#ifdef WALLSPLATS
CV_RegisterVar(&cv_splats); CV_RegisterVar(&cv_splats);
#endif
// register these so it is saved to config // register these so it is saved to config
if ((username = I_GetUserName())) if ((username = I_GetUserName()))
@ -808,7 +810,7 @@ static boolean IsNameGood(char *name, INT32 playernum)
else if (len == 1) // Agh! else if (len == 1) // Agh!
{ {
// Last ditch effort... // Last ditch effort...
sprintf(name, "%d", M_Random() & 7); sprintf(name, "%d", M_RandomKey(10));
if (!IsNameGood (name, playernum)) if (!IsNameGood (name, playernum))
return false; return false;
} }
@ -1111,6 +1113,13 @@ static void SendNameAndColor(void)
players[consoleplayer].mo->color = (UINT8)players[consoleplayer].skincolor; players[consoleplayer].mo->color = (UINT8)players[consoleplayer].skincolor;
} }
} }
else
{
cv_skin.value = players[consoleplayer].skin;
CV_StealthSet(&cv_skin, skins[players[consoleplayer].skin].name);
// will always be same as current
SetPlayerSkin(consoleplayer, cv_skin.string);
}
return; return;
} }
@ -1228,6 +1237,13 @@ static void SendNameAndColor2(void)
players[secondplaya].mo->color = players[secondplaya].skincolor; players[secondplaya].mo->color = players[secondplaya].skincolor;
} }
} }
else
{
cv_skin2.value = players[secondplaya].skin;
CV_StealthSet(&cv_skin2, skins[players[secondplaya].skin].name);
// will always be same as current
SetPlayerSkin(secondplaya, cv_skin2.string);
}
return; return;
} }
@ -1854,10 +1870,10 @@ static void Got_Pause(UINT8 **cp, INT32 playernum)
if (paused) if (paused)
{ {
if (!menuactive || netgame) if (!menuactive || netgame)
S_PauseSound(); S_PauseAudio();
} }
else else
S_ResumeSound(); S_ResumeAudio();
} }
} }
@ -3197,7 +3213,27 @@ static void Command_ModDetails_f(void)
// //
static void Command_ShowGametype_f(void) static void Command_ShowGametype_f(void)
{ {
CONS_Printf(M_GetText("Current gametype is %d\n"), gametype); INT32 j;
const char *gametypestr = NULL;
if (!(netgame || multiplayer)) // print "Single player" instead of "Co-op"
{
CONS_Printf(M_GetText("Current gametype is %s\n"), M_GetText("Single player"));
return;
}
// find name string for current gametype
for (j = 0; gametype_cons_t[j].strvalue; j++)
{
if (gametype_cons_t[j].value == gametype)
{
gametypestr = gametype_cons_t[j].strvalue;
break;
}
}
if (gametypestr)
CONS_Printf(M_GetText("Current gametype is %s\n"), gametypestr);
else // string for current gametype was not found above (should never happen)
CONS_Printf(M_GetText("Unknown gametype set (%d)\n"), gametype);
} }
/** Plays the intro. /** Plays the intro.
@ -3563,7 +3599,7 @@ retryscramble:
for (i = 0; i < playercount; i++) for (i = 0; i < playercount; i++)
{ {
if (repick) if (repick)
newteam = (INT16)((M_Random() % 2) + 1); newteam = (INT16)((M_RandomByte() % 2) + 1);
// One team has the most players they can get, assign the rest to the other team. // One team has the most players they can get, assign the rest to the other team.
if (red == maxcomposition || blue == maxcomposition) if (red == maxcomposition || blue == maxcomposition)
@ -3608,7 +3644,7 @@ retryscramble:
{ {
if (repick) if (repick)
{ {
newteam = (INT16)((M_Random() % 2) + 1); newteam = (INT16)((M_RandomByte() % 2) + 1);
repick = false; repick = false;
} }
else else
@ -3741,50 +3777,66 @@ static void Command_Displayplayer_f(void)
static void Command_Tunes_f(void) static void Command_Tunes_f(void)
{ {
const char *tunearg; const char *tunearg;
UINT16 tune, track = 0; UINT16 tunenum, track = 0;
const size_t argc = COM_Argc(); const size_t argc = COM_Argc();
if (argc < 2) //tunes slot ... if (argc < 2) //tunes slot ...
{ {
CONS_Printf("tunes <slot #/map name/\"default\"> <speed> <track>:\n"); CONS_Printf("tunes <name/num> [track] [speed] / <-show> / <-default> / <-none>:\n");
CONS_Printf(M_GetText("Play a music slot at a set speed (\"1\" being normal speed).\n")); CONS_Printf(M_GetText("Play an arbitrary music lump. If a map number is used, 'MAP##M' is played.\n"));
CONS_Printf(M_GetText("If the format supports multiple songs, you can specify which one to play.\n")); CONS_Printf(M_GetText("If the format supports multiple songs, you can specify which one to play.\n\n"));
CONS_Printf(M_GetText("The current tune is: %d\nThe current track is: %d\n"), CONS_Printf(M_GetText("* With \"-show\", shows the currently playing tune and track.\n"));
(mapmusic & MUSIC_SONGMASK), ((mapmusic & MUSIC_TRACKMASK) >> MUSIC_TRACKSHIFT)); CONS_Printf(M_GetText("* With \"-default\", returns to the default music for the map.\n"));
CONS_Printf(M_GetText("* With \"-none\", any music playing will be stopped.\n"));
return; return;
} }
tunearg = COM_Argv(1); tunearg = COM_Argv(1);
tune = (UINT16)atoi(tunearg); tunenum = (UINT16)atoi(tunearg);
track = 0; track = 0;
if (!strcasecmp(tunearg, "default")) if (!strcasecmp(tunearg, "-show"))
{ {
tune = mapheaderinfo[gamemap-1]->musicslot; CONS_Printf(M_GetText("The current tune is: %s [track %d]\n"),
track = mapheaderinfo[gamemap-1]->musicslottrack; mapmusname, (mapmusflags & MUSIC_TRACKMASK));
}
else if (toupper(tunearg[0]) >= 'A' && toupper(tunearg[0]) <= 'Z')
tune = (UINT16)M_MapNumber(tunearg[0], tunearg[1]);
if (tune >= NUMMUSIC)
{
CONS_Alert(CONS_NOTICE, M_GetText("Valid slots are 1 to %d, or 0 to stop music\n"), NUMMUSIC - 1);
return; return;
} }
if (!strcasecmp(tunearg, "-none"))
if (argc > 3) {
track = (UINT16)atoi(COM_Argv(3))-1;
mapmusic = tune | (track << MUSIC_TRACKSHIFT);
if (tune == mus_None)
S_StopMusic(); S_StopMusic();
else return;
S_ChangeMusic(mapmusic, true); }
else if (!strcasecmp(tunearg, "-default"))
{
tunearg = mapheaderinfo[gamemap-1]->musname;
track = mapheaderinfo[gamemap-1]->mustrack;
}
else if (!tunearg[2] && toupper(tunearg[0]) >= 'A' && toupper(tunearg[0]) <= 'Z')
tunenum = (UINT16)M_MapNumber(tunearg[0], tunearg[1]);
if (tunenum && tunenum >= 1036)
{
CONS_Alert(CONS_NOTICE, M_GetText("Valid music slots are 1 to 1035.\n"));
return;
}
if (!tunenum && strlen(tunearg) > 6) // This is automatic -- just show the error just in case
CONS_Alert(CONS_NOTICE, M_GetText("Music name too long - truncated to six characters.\n"));
if (argc > 2) if (argc > 2)
track = (UINT16)atoi(COM_Argv(2))-1;
if (tunenum)
snprintf(mapmusname, 7, "%sM", G_BuildMapName(tunenum));
else
strncpy(mapmusname, tunearg, 7);
mapmusname[6] = 0;
mapmusflags = (track & MUSIC_TRACKMASK);
S_ChangeMusic(mapmusname, mapmusflags, true);
if (argc > 3)
{ {
float speed = (float)atof(COM_Argv(2)); float speed = (float)atof(COM_Argv(3));
if (speed > 0.0f) if (speed > 0.0f)
S_SpeedMusic(speed); S_SpeedMusic(speed);
} }

View file

@ -1,7 +1,7 @@
// SONIC ROBO BLAST 2 // SONIC ROBO BLAST 2
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
// Copyright (C) 1998-2000 by DooM Legacy Team. // Copyright (C) 1998-2000 by DooM Legacy Team.
// Copyright (C) 1999-2014 by Sonic Team Junior. // Copyright (C) 1999-2016 by Sonic Team Junior.
// //
// This program is free software distributed under the // This program is free software distributed under the
// terms of the GNU General Public License, version 2. // terms of the GNU General Public License, version 2.
@ -81,7 +81,9 @@ extern consvar_t cv_useranalog, cv_useranalog2;
extern consvar_t cv_analog, cv_analog2; extern consvar_t cv_analog, cv_analog2;
extern consvar_t cv_netstat; extern consvar_t cv_netstat;
#ifdef WALLSPLATS
extern consvar_t cv_splats; extern consvar_t cv_splats;
#endif
extern consvar_t cv_countdowntime; extern consvar_t cv_countdowntime;
extern consvar_t cv_runscripts; extern consvar_t cv_runscripts;

View file

@ -1,7 +1,7 @@
// SONIC ROBO BLAST 2 // SONIC ROBO BLAST 2
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
// Copyright (C) 1998-2000 by DooM Legacy Team. // Copyright (C) 1998-2000 by DooM Legacy Team.
// Copyright (C) 1999-2014 by Sonic Team Junior. // Copyright (C) 1999-2016 by Sonic Team Junior.
// //
// This program is free software distributed under the // This program is free software distributed under the
// terms of the GNU General Public License, version 2. // terms of the GNU General Public License, version 2.

View file

@ -1,7 +1,7 @@
// SONIC ROBO BLAST 2 // SONIC ROBO BLAST 2
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
// Copyright (C) 1998-2000 by DooM Legacy Team. // Copyright (C) 1998-2000 by DooM Legacy Team.
// Copyright (C) 1999-2014 by Sonic Team Junior. // Copyright (C) 1999-2016 by Sonic Team Junior.
// //
// This program is free software distributed under the // This program is free software distributed under the
// terms of the GNU General Public License, version 2. // terms of the GNU General Public License, version 2.

View file

@ -2,7 +2,7 @@
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
// Copyright (C) 1993-1996 by id Software, Inc. // Copyright (C) 1993-1996 by id Software, Inc.
// Copyright (C) 1998-2000 by DooM Legacy Team. // Copyright (C) 1998-2000 by DooM Legacy Team.
// Copyright (C) 1999-2014 by Sonic Team Junior. // Copyright (C) 1999-2016 by Sonic Team Junior.
// //
// This program is free software distributed under the // This program is free software distributed under the
// terms of the GNU General Public License, version 2. // terms of the GNU General Public License, version 2.

View file

@ -2,7 +2,7 @@
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
// Copyright (C) 1993-1996 by id Software, Inc. // Copyright (C) 1993-1996 by id Software, Inc.
// Copyright (C) 1998-2000 by DooM Legacy Team. // Copyright (C) 1998-2000 by DooM Legacy Team.
// Copyright (C) 1999-2014 by Sonic Team Junior. // Copyright (C) 1999-2016 by Sonic Team Junior.
// //
// This program is free software distributed under the // This program is free software distributed under the
// terms of the GNU General Public License, version 2. // terms of the GNU General Public License, version 2.

View file

@ -2,7 +2,7 @@
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
// Copyright (C) 1993-1996 by id Software, Inc. // Copyright (C) 1993-1996 by id Software, Inc.
// Copyright (C) 1998-2000 by DooM Legacy Team. // Copyright (C) 1998-2000 by DooM Legacy Team.
// Copyright (C) 1999-2014 by Sonic Team Junior. // Copyright (C) 1999-2016 by Sonic Team Junior.
// //
// This program is free software distributed under the // This program is free software distributed under the
// terms of the GNU General Public License, version 2. // terms of the GNU General Public License, version 2.

File diff suppressed because it is too large Load diff

View file

@ -1,7 +1,7 @@
// SONIC ROBO BLAST 2 // SONIC ROBO BLAST 2
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
// Copyright (C) 1998-2000 by DooM Legacy Team. // Copyright (C) 1998-2000 by DooM Legacy Team.
// Copyright (C) 1999-2014 by Sonic Team Junior. // Copyright (C) 1999-2016 by Sonic Team Junior.
// //
// This program is free software distributed under the // This program is free software distributed under the
// terms of the GNU General Public License, version 2. // terms of the GNU General Public License, version 2.

View file

@ -2,7 +2,7 @@
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
// Copyright (C) 1993-1996 by id Software, Inc. // Copyright (C) 1993-1996 by id Software, Inc.
// Copyright (C) 1998-2000 by DooM Legacy Team. // Copyright (C) 1998-2000 by DooM Legacy Team.
// Copyright (C) 1999-2014 by Sonic Team Junior. // Copyright (C) 1999-2016 by Sonic Team Junior.
// //
// This program is free software distributed under the // This program is free software distributed under the
// terms of the GNU General Public License, version 2. // terms of the GNU General Public License, version 2.

View file

@ -2,7 +2,7 @@
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
// Copyright (C) 1993-1996 by id Software, Inc. // Copyright (C) 1993-1996 by id Software, Inc.
// Copyright (C) 1998-2000 by DooM Legacy Team. // Copyright (C) 1998-2000 by DooM Legacy Team.
// Copyright (C) 1999-2014 by Sonic Team Junior. // Copyright (C) 1999-2016 by Sonic Team Junior.
// //
// This program is free software distributed under the // This program is free software distributed under the
// terms of the GNU General Public License, version 2. // terms of the GNU General Public License, version 2.
@ -101,6 +101,7 @@
#include <stdlib.h> #include <stdlib.h>
#include <string.h> #include <string.h>
#define _USE_MATH_DEFINES // fixes M_PI errors in r_plane.c for Visual Studio
#include <math.h> #include <math.h>
#ifdef GETTEXT #ifdef GETTEXT
@ -138,7 +139,8 @@
extern FILE *logstream; extern FILE *logstream;
#endif #endif
#if 0 //#define DEVELOP // Disable this for release builds to remove excessive cheat commands and enable MD5 checking and stuff, all in one go. :3
#ifdef DEVELOP
#define VERSION 0 // Game version #define VERSION 0 // Game version
#define SUBVERSION 0 // more precise version number #define SUBVERSION 0 // more precise version number
#define VERSIONSTRING "Development EXE" #define VERSIONSTRING "Development EXE"
@ -147,13 +149,17 @@ extern FILE *logstream;
// we use comprevision and compbranch instead. // we use comprevision and compbranch instead.
#else #else
#define VERSION 201 // Game version #define VERSION 201 // Game version
#define SUBVERSION 14 // more precise version number #define SUBVERSION 15 // more precise version number
#define VERSIONSTRING "v2.1.14" #define VERSIONSTRING "v2.1.15"
#define VERSIONSTRINGW L"v2.1.14" #define VERSIONSTRINGW L"v2.1.15"
// Hey! If you change this, add 1 to the MODVERSION below! // Hey! If you change this, add 1 to the MODVERSION below!
// Otherwise we can't force updates! // Otherwise we can't force updates!
#endif #endif
// Does this version require an added patch file?
// Comment or uncomment this as necessary.
#define USE_PATCH_DTA
// Modification options // Modification options
// If you want to take advantage of the Master Server's ability to force clients to update // If you want to take advantage of the Master Server's ability to force clients to update
// to the latest version, fill these out. Otherwise, just comment out UPDATE_ALERT and leave // to the latest version, fill these out. Otherwise, just comment out UPDATE_ALERT and leave
@ -207,7 +213,7 @@ extern FILE *logstream;
// it's only for detection of the version the player is using so the MS can alert them of an update. // it's only for detection of the version the player is using so the MS can alert them of an update.
// Only set it higher, not lower, obviously. // Only set it higher, not lower, obviously.
// Note that we use this to help keep internal testing in check; this is why v2.1.0 is not version "1". // Note that we use this to help keep internal testing in check; this is why v2.1.0 is not version "1".
#define MODVERSION 19 #define MODVERSION 20
// ========================================================================= // =========================================================================
@ -422,12 +428,8 @@ extern const char *compdate, *comptime, *comprevision, *compbranch;
// None of these that are disabled in the normal build are guaranteed to work perfectly // None of these that are disabled in the normal build are guaranteed to work perfectly
// Compile them at your own risk! // Compile them at your own risk!
/// Max recursive portal renders /// Kalaron/Eternity Engine slope code (SRB2CB ported)
/// \note obsoleted by cv_maxportals #define ESLOPE
//#define PORTAL_LIMIT 8
/// Fun experimental slope stuff!
//#define SLOPENESS
/// Delete file while the game is running. /// Delete file while the game is running.
/// \note EXTREMELY buggy, tends to crash game. /// \note EXTREMELY buggy, tends to crash game.
@ -445,10 +447,6 @@ extern const char *compdate, *comptime, *comprevision, *compbranch;
/// Polyobject fake flat code /// Polyobject fake flat code
#define POLYOBJECTS_PLANES #define POLYOBJECTS_PLANES
/// Blue spheres for future use.
/// \todo Remove this define.
#define BLUE_SPHERES // Blue spheres for future use.
/// Improved way of dealing with ping values and a ping limit. /// Improved way of dealing with ping values and a ping limit.
#define NEWPING #define NEWPING
@ -486,4 +484,8 @@ extern const char *compdate, *comptime, *comprevision, *compbranch;
/// Experimental tweaks to analog mode. (Needs a lot of work before it's ready for primetime.) /// Experimental tweaks to analog mode. (Needs a lot of work before it's ready for primetime.)
//#define REDSANALOG //#define REDSANALOG
/// Backwards compatibility with musicslots.
/// \note You should leave this enabled unless you're working with a future SRB2 version.
#define MUSICSLOT_COMPATIBILITY
#endif // __DOOMDEF__ #endif // __DOOMDEF__

View file

@ -2,7 +2,7 @@
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
// Copyright (C) 1993-1996 by id Software, Inc. // Copyright (C) 1993-1996 by id Software, Inc.
// Copyright (C) 1998-2000 by DooM Legacy Team. // Copyright (C) 1998-2000 by DooM Legacy Team.
// Copyright (C) 1999-2014 by Sonic Team Junior. // Copyright (C) 1999-2016 by Sonic Team Junior.
// //
// This program is free software distributed under the // This program is free software distributed under the
// terms of the GNU General Public License, version 2. // terms of the GNU General Public License, version 2.
@ -31,15 +31,11 @@
// Selected by user. // Selected by user.
extern INT16 gamemap; extern INT16 gamemap;
extern char mapmusname[7];
// ----------------xxxxxxxxxxxxxxxx = music slot extern UINT16 mapmusflags;
// -xxxxxxxxxxxxxxx---------------- = track slot #define MUSIC_TRACKMASK 0x0FFF // ----************
// x------------------------------- = reset music bit #define MUSIC_RELOADRESET 0x8000 // *---------------
extern UINT32 mapmusic; // Use other bits if necessary.
#define MUSIC_TRACKSHIFT 16
#define MUSIC_SONGMASK 0x0000FFFF
#define MUSIC_TRACKMASK 0x7FFF0000
#define MUSIC_RELOADRESET 0x80000000
extern INT16 maptol; extern INT16 maptol;
extern UINT8 globalweather; extern UINT8 globalweather;
@ -146,11 +142,13 @@ typedef struct
UINT16 xcoord[8]; UINT16 xcoord[8];
UINT16 ycoord[8]; UINT16 ycoord[8];
UINT16 picduration[8]; UINT16 picduration[8];
UINT16 musicslot;
UINT8 musicloop; UINT8 musicloop;
UINT16 textxpos; UINT16 textxpos;
UINT16 textypos; UINT16 textypos;
char musswitch[7];
UINT16 musswitchflags;
UINT8 fadecolor; // Color number for fade, 0 means don't do the first fade UINT8 fadecolor; // Color number for fade, 0 means don't do the first fade
UINT8 fadeinid; // ID of the first fade, to a color -- ignored if fadecolor is 0 UINT8 fadeinid; // ID of the first fade, to a color -- ignored if fadecolor is 0
UINT8 fadeoutid; // ID of the second fade, to the new screen UINT8 fadeoutid; // ID of the second fade, to the new screen
@ -218,8 +216,8 @@ typedef struct
UINT8 actnum; ///< Act number or 0 for none. UINT8 actnum; ///< Act number or 0 for none.
UINT16 typeoflevel; ///< Combination of typeoflevel flags. UINT16 typeoflevel; ///< Combination of typeoflevel flags.
INT16 nextlevel; ///< Map number of next level, or 1100-1102 to end. INT16 nextlevel; ///< Map number of next level, or 1100-1102 to end.
UINT16 musicslot; ///< Music slot number to play. 0 for no music. char musname[7]; ///< Music track to play. "" for no music.
UINT16 musicslottrack; ///< Subsong to play. Only really relevant for music modules and specific formats supported by GME. 0 to ignore. UINT16 mustrack; ///< Subsong to play. Only really relevant for music modules and specific formats supported by GME. 0 to ignore.
char forcecharacter[17]; ///< (SKINNAMESIZE+1) Skin to switch to or "" to disable. char forcecharacter[17]; ///< (SKINNAMESIZE+1) Skin to switch to or "" to disable.
UINT8 weather; ///< 0 = sunny day, 1 = storm, 2 = snow, 3 = rain, 4 = blank, 5 = thunder w/o rain, 6 = rain w/o lightning, 7 = heat wave. UINT8 weather; ///< 0 = sunny day, 1 = storm, 2 = snow, 3 = rain, 4 = blank, 5 = thunder w/o rain, 6 = rain w/o lightning, 7 = heat wave.
INT16 skynum; ///< Sky number to use. INT16 skynum; ///< Sky number to use.

View file

@ -2,7 +2,7 @@
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
// Copyright (C) 1993-1996 by id Software, Inc. // Copyright (C) 1993-1996 by id Software, Inc.
// Copyright (C) 1998-2000 by DooM Legacy Team. // Copyright (C) 1998-2000 by DooM Legacy Team.
// Copyright (C) 1999-2014 by Sonic Team Junior. // Copyright (C) 1999-2016 by Sonic Team Junior.
// //
// This program is free software distributed under the // This program is free software distributed under the
// terms of the GNU General Public License, version 2. // terms of the GNU General Public License, version 2.

View file

@ -1,6 +1,6 @@
// SONIC ROBO BLAST 2 // SONIC ROBO BLAST 2
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
// Copyright (C) 2014 by Sonic Team Junior. // Copyright (C) 2014-2016 by Sonic Team Junior.
// //
// This program is free software distributed under the // This program is free software distributed under the
// terms of the GNU General Public License, version 2. // terms of the GNU General Public License, version 2.

View file

@ -2,7 +2,7 @@
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
// Copyright (C) 1993-1996 by id Software, Inc. // Copyright (C) 1993-1996 by id Software, Inc.
// Copyright (C) 1998-2000 by DooM Legacy Team. // Copyright (C) 1998-2000 by DooM Legacy Team.
// Copyright (C) 1999-2014 by Sonic Team Junior. // Copyright (C) 1999-2016 by Sonic Team Junior.
// //
// This program is free software distributed under the // This program is free software distributed under the
// terms of the GNU General Public License, version 2. // terms of the GNU General Public License, version 2.
@ -559,7 +559,7 @@ static void F_IntroDrawScene(void)
if (finalecount < 4) if (finalecount < 4)
S_StopMusic(); S_StopMusic();
if (finalecount == 4) if (finalecount == 4)
S_ChangeMusic(mus_stjr, false); S_ChangeMusicInternal("stjr", false);
x = (BASEVIDWIDTH<<FRACBITS)/2 - FixedMul(334<<FRACBITS, aspect)/2; x = (BASEVIDWIDTH<<FRACBITS)/2 - FixedMul(334<<FRACBITS, aspect)/2;
y = (BASEVIDHEIGHT<<FRACBITS)/2 - FixedMul(358<<FRACBITS, aspect)/2; y = (BASEVIDHEIGHT<<FRACBITS)/2 - FixedMul(358<<FRACBITS, aspect)/2;
V_DrawSciencePatch(x, y, 0, (patch = W_CachePatchName("WAHH1", PU_CACHE)), aspect); V_DrawSciencePatch(x, y, 0, (patch = W_CachePatchName("WAHH1", PU_CACHE)), aspect);
@ -771,7 +771,7 @@ void F_IntroDrawer(void)
F_RunWipe(99,true); F_RunWipe(99,true);
} }
S_ChangeMusic(mus_read_m, false); S_ChangeMusicInternal("read_m", false);
} }
else if (intro_scenenum == 3) else if (intro_scenenum == 3)
roidtics = BASEVIDWIDTH - 64; roidtics = BASEVIDWIDTH - 64;
@ -977,11 +977,13 @@ static const char *credits[] = {
"\"Monster\" Iestyn Jealous", "\"Monster\" Iestyn Jealous",
"Ronald \"Furyhunter\" Kinard", // The SDL2 port "Ronald \"Furyhunter\" Kinard", // The SDL2 port
"John \"JTE\" Muniz", "John \"JTE\" Muniz",
"Ehab \"Wolfy\" Saeed",
"\"SSNTails\"", "\"SSNTails\"",
"Matthew \"Inuyasha\" Walsh", "Matthew \"Inuyasha\" Walsh",
"", "",
"\1Programming", "\1Programming",
"\1Assistance", "\1Assistance",
"\"chi.miru\"", // Red's secret weapon, the REAL reason slopes exist (also helped port drawing code from ZDoom)
"Andrew \"orospakr\" Clunis", "Andrew \"orospakr\" Clunis",
"Gregor \"Oogaland\" Dick", "Gregor \"Oogaland\" Dick",
"Julio \"Chaos Zero 64\" Guir", "Julio \"Chaos Zero 64\" Guir",
@ -1006,6 +1008,7 @@ static const char *credits[] = {
"\1Texture Artists", "\1Texture Artists",
"Ryan \"Blaze Hedgehog\" Bloom", "Ryan \"Blaze Hedgehog\" Bloom",
"Buddy \"KinkaJoy\" Fischer", "Buddy \"KinkaJoy\" Fischer",
"Vivian \"toaster\" Grannell",
"Kepa \"Nev3r\" Iceta", "Kepa \"Nev3r\" Iceta",
"Jarrett \"JEV3\" Voight", "Jarrett \"JEV3\" Voight",
"", "",
@ -1019,7 +1022,7 @@ static const char *credits[] = {
"\"Monster\" Iestyn Jealous", "\"Monster\" Iestyn Jealous",
"Jarel \"Arrow\" Jones", "Jarel \"Arrow\" Jones",
"Stefan \"Stuf\" Rimalia", "Stefan \"Stuf\" Rimalia",
"Shane Strife", "Shane Mychal Sexton",
"\"Spazzo\"", "\"Spazzo\"",
"David \"Big Wave Dave\" Spencer Sr.", "David \"Big Wave Dave\" Spencer Sr.",
"David \"Instant Sonic\" Spencer Jr.", "David \"Instant Sonic\" Spencer Jr.",
@ -1124,7 +1127,7 @@ void F_StartCredits(void)
CON_ClearHUD(); CON_ClearHUD();
S_StopMusic(); S_StopMusic();
S_ChangeMusic(mus_credit, false); S_ChangeMusicInternal("credit", false);
finalecount = 0; finalecount = 0;
animtimer = 0; animtimer = 0;
@ -1421,7 +1424,7 @@ void F_StartTitleScreen(void)
// IWAD dependent stuff. // IWAD dependent stuff.
S_ChangeMusic(mus_titles, looptitle); S_ChangeMusicInternal("titles", looptitle);
animtimer = 0; animtimer = 0;
@ -1587,7 +1590,7 @@ void F_StartContinue(void)
// In case menus are still up?!! // In case menus are still up?!!
M_ClearMenus(true); M_ClearMenus(true);
S_ChangeMusic(mus_contsc, false); S_ChangeMusicInternal("contsc", false);
S_StopSounds(); S_StopSounds();
timetonext = TICRATE*11; timetonext = TICRATE*11;
@ -1701,8 +1704,10 @@ static void F_AdvanceToNextScene(void)
picxpos = cutscenes[cutnum]->scene[scenenum].xcoord[picnum]; picxpos = cutscenes[cutnum]->scene[scenenum].xcoord[picnum];
picypos = cutscenes[cutnum]->scene[scenenum].ycoord[picnum]; picypos = cutscenes[cutnum]->scene[scenenum].ycoord[picnum];
if (cutscenes[cutnum]->scene[scenenum].musicslot != 0) if (cutscenes[cutnum]->scene[scenenum].musswitch[0])
S_ChangeMusic(cutscenes[cutnum]->scene[scenenum].musicslot, cutscenes[cutnum]->scene[scenenum].musicloop); S_ChangeMusic(cutscenes[cutnum]->scene[scenenum].musswitch,
cutscenes[cutnum]->scene[scenenum].musswitchflags,
cutscenes[cutnum]->scene[scenenum].musicloop);
// Fade to the next // Fade to the next
dofadenow = true; dofadenow = true;
@ -1773,8 +1778,10 @@ void F_StartCustomCutscene(INT32 cutscenenum, boolean precutscene, boolean reset
animtimer = cutscenes[cutnum]->scene[0].picduration[0]; // Picture duration animtimer = cutscenes[cutnum]->scene[0].picduration[0]; // Picture duration
stoptimer = 0; stoptimer = 0;
if (cutscenes[cutnum]->scene[scenenum].musicslot != 0) if (cutscenes[cutnum]->scene[0].musswitch[0])
S_ChangeMusic(cutscenes[cutnum]->scene[scenenum].musicslot, cutscenes[cutnum]->scene[scenenum].musicloop); S_ChangeMusic(cutscenes[cutnum]->scene[0].musswitch,
cutscenes[cutnum]->scene[0].musswitchflags,
cutscenes[cutnum]->scene[0].musicloop);
else else
S_StopMusic(); S_StopMusic();
} }

View file

@ -2,7 +2,7 @@
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
// Copyright (C) 1993-1996 by id Software, Inc. // Copyright (C) 1993-1996 by id Software, Inc.
// Copyright (C) 1998-2000 by DooM Legacy Team. // Copyright (C) 1998-2000 by DooM Legacy Team.
// Copyright (C) 1999-2014 by Sonic Team Junior. // Copyright (C) 1999-2016 by Sonic Team Junior.
// //
// This program is free software distributed under the // This program is free software distributed under the
// terms of the GNU General Public License, version 2. // terms of the GNU General Public License, version 2.
@ -90,6 +90,7 @@ enum
// custom intermissions // custom intermissions
wipe_specinter_toblack, wipe_specinter_toblack,
wipe_multinter_toblack, wipe_multinter_toblack,
wipe_speclevel_towhite,
wipe_level_final, wipe_level_final,
wipe_intermission_final, wipe_intermission_final,
@ -108,7 +109,7 @@ enum
NUMWIPEDEFS NUMWIPEDEFS
}; };
#define WIPEFINALSHIFT 12 #define WIPEFINALSHIFT 13
extern UINT8 wipedefs[NUMWIPEDEFS]; extern UINT8 wipedefs[NUMWIPEDEFS];
#endif #endif

View file

@ -2,8 +2,8 @@
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
// Copyright (C) 1993-1996 by id Software, Inc. // Copyright (C) 1993-1996 by id Software, Inc.
// Copyright (C) 1998-2000 by DooM Legacy Team. // Copyright (C) 1998-2000 by DooM Legacy Team.
// Copyright (C) 2013-2014 by Matthew "Inuyasha" Walsh. // Copyright (C) 2013-2016 by Matthew "Inuyasha" Walsh.
// Copyright (C) 1999-2014 by Sonic Team Junior. // Copyright (C) 1999-2016 by Sonic Team Junior.
// //
// This program is free software distributed under the // This program is free software distributed under the
// terms of the GNU General Public License, version 2. // terms of the GNU General Public License, version 2.
@ -58,6 +58,7 @@ UINT8 wipedefs[NUMWIPEDEFS] = {
0, // wipe_specinter_toblack 0, // wipe_specinter_toblack
0, // wipe_multinter_toblack 0, // wipe_multinter_toblack
0, // wipe_speclevel_towhite
0, // wipe_level_final 0, // wipe_level_final
0, // wipe_intermission_final 0, // wipe_intermission_final
@ -231,34 +232,52 @@ static void F_DoWipe(fademask_t *fademask)
maskx = masky = 0; maskx = masky = 0;
do do
{ {
// pointer to transtable that this mask would use
transtbl = transtables + ((9 - *mask)<<FF_TRANSSHIFT);
// (ignore that it goes out of bounds if *mask is 0 or 10 --
// it wouldn't be used in those cases anyway)
draw_rowstart = scrxpos[maskx]; draw_rowstart = scrxpos[maskx];
draw_rowend = scrxpos[maskx + 1]; draw_rowend = scrxpos[maskx + 1];
draw_linestart = scrypos[masky]; draw_linestart = scrypos[masky];
draw_lineend = scrypos[masky + 1]; draw_lineend = scrypos[masky + 1];
// DRAWING LOOP
relativepos = (draw_linestart * vid.width) + draw_rowstart; relativepos = (draw_linestart * vid.width) + draw_rowstart;
draw_linestogo = draw_lineend - draw_linestart; draw_linestogo = draw_lineend - draw_linestart;
while (draw_linestogo--)
if (*mask == 0)
{ {
w = w_base + relativepos; // shortcut - memcpy source to work
s = s_base + relativepos; while (draw_linestogo--)
e = e_base + relativepos;
draw_rowstogo = draw_rowend - draw_rowstart;
while (draw_rowstogo--)
{ {
if (*s != *e) M_Memcpy(w_base+relativepos, s_base+relativepos, draw_rowend-draw_rowstart);
*w = ((*mask == 0) ? *s : (*mask == 10) ? *e : transtbl[(*e<<8) + *s]); relativepos += vid.width;
++w, ++s, ++e;
} }
relativepos += vid.width;
} }
// END DRAWING LOOP else if (*mask == 10)
{
// shortcut - memcpy target to work
while (draw_linestogo--)
{
M_Memcpy(w_base+relativepos, e_base+relativepos, draw_rowend-draw_rowstart);
relativepos += vid.width;
}
}
else
{
// pointer to transtable that this mask would use
transtbl = transtables + ((9 - *mask)<<FF_TRANSSHIFT);
// DRAWING LOOP
while (draw_linestogo--)
{
w = w_base + relativepos;
s = s_base + relativepos;
e = e_base + relativepos;
draw_rowstogo = draw_rowend - draw_rowstart;
while (draw_rowstogo--)
*w++ = transtbl[ ( *e++ << 8 ) + *s++ ];
relativepos += vid.width;
}
// END DRAWING LOOP
}
if (++maskx >= fademask->width) if (++maskx >= fademask->width)
++masky, maskx = 0; ++masky, maskx = 0;

View file

@ -2,7 +2,7 @@
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
// Copyright (C) 1993-1996 by id Software, Inc. // Copyright (C) 1993-1996 by id Software, Inc.
// Copyright (C) 1998-2000 by DooM Legacy Team. // Copyright (C) 1998-2000 by DooM Legacy Team.
// Copyright (C) 1999-2014 by Sonic Team Junior. // Copyright (C) 1999-2016 by Sonic Team Junior.
// //
// This program is free software distributed under the // This program is free software distributed under the
// terms of the GNU General Public License, version 2. // terms of the GNU General Public License, version 2.
@ -69,8 +69,10 @@ static void G_DoStartContinue(void);
static void G_DoContinued(void); static void G_DoContinued(void);
static void G_DoWorldDone(void); static void G_DoWorldDone(void);
char mapmusname[7]; // Music name
UINT16 mapmusflags; // Track and reset bit
INT16 gamemap = 1; INT16 gamemap = 1;
UINT32 mapmusic; // music, track, and reset bit
INT16 maptol; INT16 maptol;
UINT8 globalweather = 0; UINT8 globalweather = 0;
INT32 curWeather = PRECIP_NONE; INT32 curWeather = PRECIP_NONE;
@ -297,9 +299,6 @@ static CV_PossibleValue_t joyaxis_cons_t[] = {{0, "None"},
#if JOYAXISSET > 3 #if JOYAXISSET > 3
{7, "Pitch"}, {8, "Roll"}, {-7, "Pitch-"}, {-8, "Roll-"}, {7, "Pitch"}, {8, "Roll"}, {-7, "Pitch-"}, {-8, "Roll-"},
#endif #endif
#if JOYAXISSET > 3
{7, "Pitch"}, {8, "Roll"}, {-7, "Pitch-"}, {-8, "Roll-"},
#endif
#if JOYAXISSET > 4 #if JOYAXISSET > 4
{7, "Yaw"}, {8, "Dummy"}, {-7, "Yaw-"}, {-8, "Dummy-"}, {7, "Yaw"}, {8, "Dummy"}, {-7, "Yaw-"}, {-8, "Dummy-"},
#endif #endif
@ -1010,10 +1009,10 @@ void G_BuildTiccmd(ticcmd_t *cmd, INT32 realtics)
} }
if (cv_analog.value || twodlevel if (cv_analog.value || twodlevel
|| (player->mo && (player->mo->flags2 & MF2_TWOD)) || (player->mo && (player->mo->flags2 & MF2_TWOD))
|| player->climbing || (!demoplayback && (player->climbing
|| (player->pflags & PF_NIGHTSMODE) || (player->pflags & PF_NIGHTSMODE)
|| (player->pflags & PF_SLIDING) || (player->pflags & PF_SLIDING)
|| (player->pflags & PF_FORCESTRAFE)) // Analog || (player->pflags & PF_FORCESTRAFE)))) // Analog
forcestrafe = true; forcestrafe = true;
if (forcestrafe) // Analog if (forcestrafe) // Analog
{ {
@ -1185,8 +1184,9 @@ void G_BuildTiccmd(ticcmd_t *cmd, INT32 realtics)
if (!mouseaiming && cv_mousemove.value) if (!mouseaiming && cv_mousemove.value)
forward += mousey; forward += mousey;
if (cv_analog.value || player->climbing if (cv_analog.value ||
|| (player->pflags & PF_SLIDING)) // Analog for mouse (!demoplayback && (player->climbing
|| (player->pflags & PF_SLIDING)))) // Analog for mouse
side += mousex*2; side += mousex*2;
else else
cmd->angleturn = (INT16)(cmd->angleturn - (mousex*8)); cmd->angleturn = (INT16)(cmd->angleturn - (mousex*8));
@ -2180,18 +2180,18 @@ void G_PlayerReborn(INT32 player)
p->health = 1; // 0 rings p->health = 1; // 0 rings
p->panim = PA_IDLE; // standing animation p->panim = PA_IDLE; // standing animation
if ((netgame || multiplayer) && !p->spectator if ((netgame || multiplayer) && !p->spectator)
&& gametype != GT_RACE)
p->powers[pw_flashing] = flashingtics-1; // Babysitting deterrent p->powers[pw_flashing] = flashingtics-1; // Babysitting deterrent
if (p-players == consoleplayer) if (p-players == consoleplayer)
{ {
if (mapmusic & MUSIC_RELOADRESET) // TODO: Might not need this here if (mapmusflags & MUSIC_RELOADRESET)
{ {
mapmusic = mapheaderinfo[gamemap-1]->musicslot strncpy(mapmusname, mapheaderinfo[gamemap-1]->musname, 7);
| (mapheaderinfo[gamemap-1]->musicslottrack << MUSIC_TRACKSHIFT); mapmusname[6] = 0;
mapmusflags = mapheaderinfo[gamemap-1]->mustrack & MUSIC_TRACKMASK;
} }
S_ChangeMusic(mapmusic, true); S_ChangeMusic(mapmusname, mapmusflags, true);
} }
if (gametype == GT_COOP) if (gametype == GT_COOP)
@ -2332,6 +2332,11 @@ void G_SpawnPlayer(INT32 playernum, boolean starpost)
} }
} }
P_MovePlayerToSpawn(playernum, spawnpoint); P_MovePlayerToSpawn(playernum, spawnpoint);
#ifdef HAVE_BLUA
LUAh_PlayerSpawn(&players[playernum]); // Lua hook for player spawning :)
#endif
} }
mapthing_t *G_FindCTFStart(INT32 playernum) mapthing_t *G_FindCTFStart(INT32 playernum)
@ -2345,7 +2350,7 @@ mapthing_t *G_FindCTFStart(INT32 playernum)
return NULL; return NULL;
} }
if ((!players[playernum].ctfteam && numredctfstarts && (!numbluectfstarts || P_Random() & 1)) || players[playernum].ctfteam == 1) //red if ((!players[playernum].ctfteam && numredctfstarts && (!numbluectfstarts || P_RandomChance(FRACUNIT/2))) || players[playernum].ctfteam == 1) //red
{ {
if (!numredctfstarts) if (!numredctfstarts)
{ {
@ -2875,7 +2880,8 @@ static void G_DoCompleted(void)
// We are committed to this map now. // We are committed to this map now.
// We may as well allocate its header if it doesn't exist // We may as well allocate its header if it doesn't exist
if(!mapheaderinfo[nextmap]) // (That is, if it's a real map)
if (nextmap < NUMMAPS && !mapheaderinfo[nextmap])
P_AllocMapHeader(nextmap); P_AllocMapHeader(nextmap);
if (skipstats) if (skipstats)
@ -3525,7 +3531,7 @@ void G_InitNew(UINT8 pultmode, const char *mapname, boolean resetplayer, boolean
if (paused) if (paused)
{ {
paused = false; paused = false;
S_ResumeSound(); S_ResumeAudio();
} }
if (netgame || multiplayer) // Nice try, haxor. if (netgame || multiplayer) // Nice try, haxor.
@ -3599,7 +3605,7 @@ void G_InitNew(UINT8 pultmode, const char *mapname, boolean resetplayer, boolean
globalweather = mapheaderinfo[gamemap-1]->weather; globalweather = mapheaderinfo[gamemap-1]->weather;
// Don't carry over custom music change to another map. // Don't carry over custom music change to another map.
mapmusic |= MUSIC_RELOADRESET; mapmusflags |= MUSIC_RELOADRESET;
ultimatemode = pultmode; ultimatemode = pultmode;
playerdeadview = false; playerdeadview = false;
@ -4330,20 +4336,8 @@ void G_GhostTicker(void)
switch(g->color) switch(g->color)
{ {
case GHC_SUPER: // Super Sonic (P_DoSuperStuff) case GHC_SUPER: // Super Sonic (P_DoSuperStuff)
// Yousa yellow now! g->mo->color = SKINCOLOR_SUPER1;
g->mo->color = SKINCOLOR_SUPER1 + (leveltime/2) % 5; g->mo->color += abs( ( (signed)( (unsigned)leveltime >> 1 ) % 9) - 4);
if (g->mo->skin)
switch (((skin_t*)g->mo->skin)-skins)
{
case 1: // Golden orange supertails.
g->mo->color = SKINCOLOR_TSUPER1 + (leveltime/2) % 5;
break;
case 2: // Pink superknux.
g->mo->color = SKINCOLOR_KSUPER1 + (leveltime/2) % 5;
break;
default:
break;
}
break; break;
case GHC_INVINCIBLE: // Mario invincibility (P_CheckInvincibilityTimer) case GHC_INVINCIBLE: // Mario invincibility (P_CheckInvincibilityTimer)
g->mo->color = (UINT8)(leveltime % MAXSKINCOLORS); g->mo->color = (UINT8)(leveltime % MAXSKINCOLORS);
@ -5494,7 +5488,7 @@ ATTRNORETURN void FUNCNORETURN G_StopMetalRecording(void)
UINT8 i; UINT8 i;
WRITEUINT8(demo_p, DEMOMARKER); // add the demo end marker WRITEUINT8(demo_p, DEMOMARKER); // add the demo end marker
for (i = 0; i < 16; i++, p++) for (i = 0; i < 16; i++, p++)
*p = P_Random(); // This MD5 was chosen by fair dice roll and most likely < 50% correct. *p = P_RandomByte(); // This MD5 was chosen by fair dice roll and most likely < 50% correct.
#else #else
WRITEUINT8(demo_p, DEMOMARKER); // add the demo end marker WRITEUINT8(demo_p, DEMOMARKER); // add the demo end marker
md5_buffer((char *)p+16, demo_p - (p+16), (void *)p); // make a checksum of everything after the checksum in the file. md5_buffer((char *)p+16, demo_p - (p+16), (void *)p); // make a checksum of everything after the checksum in the file.
@ -5576,7 +5570,7 @@ boolean G_CheckDemoStatus(void)
UINT8 i; UINT8 i;
WRITEUINT8(demo_p, DEMOMARKER); // add the demo end marker WRITEUINT8(demo_p, DEMOMARKER); // add the demo end marker
for (i = 0; i < 16; i++, p++) for (i = 0; i < 16; i++, p++)
*p = P_Random(); // This MD5 was chosen by fair dice roll and most likely < 50% correct. *p = P_RandomByte(); // This MD5 was chosen by fair dice roll and most likely < 50% correct.
#else #else
WRITEUINT8(demo_p, DEMOMARKER); // add the demo end marker WRITEUINT8(demo_p, DEMOMARKER); // add the demo end marker
md5_buffer((char *)p+16, demo_p - (p+16), p); // make a checksum of everything after the checksum in the file. md5_buffer((char *)p+16, demo_p - (p+16), p); // make a checksum of everything after the checksum in the file.

View file

@ -2,7 +2,7 @@
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
// Copyright (C) 1993-1996 by id Software, Inc. // Copyright (C) 1993-1996 by id Software, Inc.
// Copyright (C) 1998-2000 by DooM Legacy Team. // Copyright (C) 1998-2000 by DooM Legacy Team.
// Copyright (C) 1999-2014 by Sonic Team Junior. // Copyright (C) 1999-2016 by Sonic Team Junior.
// //
// This program is free software distributed under the // This program is free software distributed under the
// terms of the GNU General Public License, version 2. // terms of the GNU General Public License, version 2.

View file

@ -1,7 +1,7 @@
// SONIC ROBO BLAST 2 // SONIC ROBO BLAST 2
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
// Copyright (C) 1998-2000 by DooM Legacy Team. // Copyright (C) 1998-2000 by DooM Legacy Team.
// Copyright (C) 1999-2014 by Sonic Team Junior. // Copyright (C) 1999-2016 by Sonic Team Junior.
// //
// This program is free software distributed under the // This program is free software distributed under the
// terms of the GNU General Public License, version 2. // terms of the GNU General Public License, version 2.
@ -1041,13 +1041,13 @@ INT32 G_KeyStringtoNum(const char *keystr)
if (!keystr[1] && keystr[0] > ' ' && keystr[0] <= 'z') if (!keystr[1] && keystr[0] > ' ' && keystr[0] <= 'z')
return keystr[0]; return keystr[0];
if (!strncmp(keystr, "KEY", 3) && keystr[3] >= '0' && keystr[3] <= '9')
return atoi(&keystr[3]);
for (j = 0; j < NUMKEYNAMES; j++) for (j = 0; j < NUMKEYNAMES; j++)
if (!stricmp(keynames[j].name, keystr)) if (!stricmp(keynames[j].name, keystr))
return keynames[j].keynum; return keynames[j].keynum;
if (strlen(keystr) > 3)
return atoi(&keystr[3]);
return 0; return 0;
} }

View file

@ -1,7 +1,7 @@
// SONIC ROBO BLAST 2 // SONIC ROBO BLAST 2
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
// Copyright (C) 1998-2000 by DooM Legacy Team. // Copyright (C) 1998-2000 by DooM Legacy Team.
// Copyright (C) 1999-2014 by Sonic Team Junior. // Copyright (C) 1999-2016 by Sonic Team Junior.
// //
// This program is free software distributed under the // This program is free software distributed under the
// terms of the GNU General Public License, version 2. // terms of the GNU General Public License, version 2.

View file

@ -1,7 +1,7 @@
// SONIC ROBO BLAST 2 // SONIC ROBO BLAST 2
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
// Copyright (C) 1998-2000 by DooM Legacy Team. // Copyright (C) 1998-2000 by DooM Legacy Team.
// Copyright (C) 1999-2014 by Sonic Team Junior. // Copyright (C) 1999-2016 by Sonic Team Junior.
// //
// This program is free software distributed under the // This program is free software distributed under the
// terms of the GNU General Public License, version 2. // terms of the GNU General Public License, version 2.
@ -51,7 +51,6 @@ typedef enum
extern gamestate_t gamestate; extern gamestate_t gamestate;
extern UINT8 ultimatemode; // was sk_insane extern UINT8 ultimatemode; // was sk_insane
extern boolean oncontinuescreen;
extern gameaction_t gameaction; extern gameaction_t gameaction;
extern boolean botingame; extern boolean botingame;

View file

@ -384,12 +384,12 @@ INT32 HW3S_I_StartSound(const void *origin_p, source3D_data_t *source_parm, chan
/*if (gamemode != heretic) /*if (gamemode != heretic)
{ {
if (sfx_id >= sfx_sawup && sfx_id <= sfx_sawhit) if (sfx_id >= sfx_sawup && sfx_id <= sfx_sawhit)
pitch += 8 - (M_Random()&15); pitch += 8 - (M_RandomByte()&15);
else if (sfx_id != sfx_itemup && sfx_id != sfx_tink) else if (sfx_id != sfx_itemup && sfx_id != sfx_tink)
pitch += 16 - (M_Random()&31); pitch += 16 - (M_RandomByte()&31);
} }
else*/ else*/
pitch = 128 + (M_Random() & 7) - (M_Random() & 7); pitch = 128 + (M_RandomByte() & 7) - (M_RandomByte() & 7);
} }
#endif #endif

View file

@ -657,6 +657,9 @@ void HWR_DrawFill(INT32 x, INT32 y, INT32 w, INT32 h, INT32 color)
FOutVector v[4]; FOutVector v[4];
FSurfaceInfo Surf; FSurfaceInfo Surf;
if (w < 0 || h < 0)
return; // consistency w/ software
// 3--2 // 3--2
// | /| // | /|
// |/ | // |/ |

View file

@ -36,9 +36,7 @@ typedef struct
{ {
float x; float x;
float y; float y;
//#ifdef SLOPENESS
float z; float z;
//#endif
} polyvertex_t; } polyvertex_t;
#ifdef _MSC_VER #ifdef _MSC_VER
@ -79,6 +77,7 @@ typedef struct gr_vissprite_s
boolean vflip; boolean vflip;
//Hurdler: 25/04/2000: now support colormap in hardware mode //Hurdler: 25/04/2000: now support colormap in hardware mode
UINT8 *colormap; UINT8 *colormap;
INT32 dispoffset; // copy of info->dispoffset, affects ordering but not drawing
} gr_vissprite_t; } gr_vissprite_t;
// -------- // --------

View file

@ -871,7 +871,7 @@ void HWR_DoCoronasLighting(FOutVector *outVerts, gr_vissprite_t *spr)
size = p_lspr->corona_radius * ((outVerts[0].z+120.0f)/950.0f); // d'ou vienne ces constante ? size = p_lspr->corona_radius * ((outVerts[0].z+120.0f)/950.0f); // d'ou vienne ces constante ?
break; break;
case ROCKET_SPR: case ROCKET_SPR:
p_lspr->corona_color = (((M_Random()>>1)&0xff)<<24)|0x0040ff; p_lspr->corona_color = (((M_RandomByte()>>1)&0xff)<<24)|0x0040ff;
// don't need a break // don't need a break
case CORONA_SPR: case CORONA_SPR:
size = p_lspr->corona_radius * ((outVerts[0].z+60.0f)/100.0f); // d'ou vienne ces constante ? size = p_lspr->corona_radius * ((outVerts[0].z+60.0f)/100.0f); // d'ou vienne ces constante ?
@ -974,7 +974,7 @@ void HWR_DrawCoronas(void)
size = p_lspr->corona_radius * ((cz+120.0f)/950.0f); // d'ou vienne ces constante ? size = p_lspr->corona_radius * ((cz+120.0f)/950.0f); // d'ou vienne ces constante ?
break; break;
case ROCKET_SPR: case ROCKET_SPR:
Surf.FlatColor.s.alpha = (UINT8)((M_Random()>>1)&0xff); Surf.FlatColor.s.alpha = (UINT8)((M_RandomByte()>>1)&0xff);
// don't need a break // don't need a break
case CORONA_SPR: case CORONA_SPR:
size = p_lspr->corona_radius * ((cz+60.0f)/100.0f); // d'ou vienne ces constante ? size = p_lspr->corona_radius * ((cz+60.0f)/100.0f); // d'ou vienne ces constante ?

File diff suppressed because it is too large Load diff

View file

@ -74,10 +74,12 @@ FUNCMATH UINT8 LightLevelToLum(INT32 l);
extern CV_PossibleValue_t granisotropicmode_cons_t[]; extern CV_PossibleValue_t granisotropicmode_cons_t[];
#ifdef ALAM_LIGHTING
extern consvar_t cv_grdynamiclighting; extern consvar_t cv_grdynamiclighting;
extern consvar_t cv_grstaticlighting; extern consvar_t cv_grstaticlighting;
extern consvar_t cv_grcoronas; extern consvar_t cv_grcoronas;
extern consvar_t cv_grcoronasize; extern consvar_t cv_grcoronasize;
#endif
extern consvar_t cv_grfov; extern consvar_t cv_grfov;
extern consvar_t cv_grmd2; extern consvar_t cv_grmd2;
extern consvar_t cv_grfog; extern consvar_t cv_grfog;

View file

@ -790,24 +790,25 @@ void HWR_InitMD2(void)
} }
while (fscanf(f, "%19s %31s %f %f", name, filename, &scale, &offset) == 4) while (fscanf(f, "%19s %31s %f %f", name, filename, &scale, &offset) == 4)
{ {
if (stricmp(name, "PLAY") == 0)
{
CONS_Printf("MD2 for sprite PLAY detected in md2.dat, use a player skin instead!\n");
continue;
}
for (i = 0; i < NUMSPRITES; i++) for (i = 0; i < NUMSPRITES; i++)
{ {
if (stricmp(name, sprnames[i]) == 0) if (stricmp(name, sprnames[i]) == 0)
{ {
if (stricmp(name, "PLAY") == 0) //if (stricmp(name, "PLAY") == 0)
continue; //continue;
//CONS_Debug(DBG_RENDER, " Found: %s %s %f %f\n", name, filename, scale, offset); //CONS_Debug(DBG_RENDER, " Found: %s %s %f %f\n", name, filename, scale, offset);
md2_models[i].scale = scale; md2_models[i].scale = scale;
md2_models[i].offset = offset; md2_models[i].offset = offset;
md2_models[i].notfound = false; md2_models[i].notfound = false;
strcpy(md2_models[i].filename, filename); strcpy(md2_models[i].filename, filename);
break; goto md2found;
}
if (i == NUMSPRITES)
{
CONS_Printf("MD2 for sprite %s not found\n", name);
md2_models[i].notfound = true;
} }
} }
@ -821,15 +822,14 @@ void HWR_InitMD2(void)
md2_playermodels[s].offset = offset; md2_playermodels[s].offset = offset;
md2_playermodels[s].notfound = false; md2_playermodels[s].notfound = false;
strcpy(md2_playermodels[s].filename, filename); strcpy(md2_playermodels[s].filename, filename);
break; goto md2found;
}
if (s == MAXSKINS-1)
{
CONS_Printf("MD2 for player skin %s not found\n", name);
md2_playermodels[s].notfound = true;
} }
} }
// no sprite/player skin name found?!?
CONS_Printf("Unknown sprite/player skin %s detected in md2.dat\n", name);
md2found:
// move on to next line...
continue;
} }
fclose(f); fclose(f);
} }
@ -865,17 +865,14 @@ void HWR_AddPlayerMD2(int skin) // For MD2's that were added after startup
md2_playermodels[skin].offset = offset; md2_playermodels[skin].offset = offset;
md2_playermodels[skin].notfound = false; md2_playermodels[skin].notfound = false;
strcpy(md2_playermodels[skin].filename, filename); strcpy(md2_playermodels[skin].filename, filename);
break; goto playermd2found;
}
if (skin == MAXSKINS-1)
{
CONS_Printf("MD2 for player skin %s not found\n", name);
md2_playermodels[skin].notfound = true;
} }
} }
//CONS_Printf("MD2 for player skin %s not found\n", skins[skin].name);
md2_playermodels[skin].notfound = true;
playermd2found:
fclose(f); fclose(f);
} }
@ -890,6 +887,9 @@ void HWR_AddSpriteMD2(size_t spritenum) // For MD2s that were added after startu
if (nomd2s) if (nomd2s)
return; return;
if (spritenum == SPR_PLAY) // Handled already NEWMD2: Per sprite, per-skin check
return;
// Read the md2.dat file // Read the md2.dat file
f = fopen("md2.dat", "rt"); f = fopen("md2.dat", "rt");
@ -903,27 +903,19 @@ void HWR_AddSpriteMD2(size_t spritenum) // For MD2s that were added after startu
// Check for any MD2s that match the names of player skins! // Check for any MD2s that match the names of player skins!
while (fscanf(f, "%19s %31s %f %f", name, filename, &scale, &offset) == 4) while (fscanf(f, "%19s %31s %f %f", name, filename, &scale, &offset) == 4)
{ {
if (stricmp(name, sprnames[spritenum]) == 0)
{ {
if (stricmp(name, sprnames[spritenum]) == 0) md2_models[spritenum].scale = scale;
{ md2_models[spritenum].offset = offset;
if (stricmp(name, "PLAY") == 0) // Handled already NEWMD2: Per sprite, per-skin check md2_models[spritenum].notfound = false;
continue; strcpy(md2_models[spritenum].filename, filename);
goto spritemd2found;
md2_models[spritenum].scale = scale;
md2_models[spritenum].offset = offset;
md2_models[spritenum].notfound = false;
strcpy(md2_models[spritenum].filename, filename);
break;
}
if (spritenum == NUMSPRITES-1)
{
CONS_Printf("MD2 for sprite %s not found\n", name);
md2_models[spritenum].notfound = true;
}
} }
} }
//CONS_Printf("MD2 for sprite %s not found\n", sprnames[spritenum]);
md2_models[spritenum].notfound = true;
spritemd2found:
fclose(f); fclose(f);
} }
@ -1201,11 +1193,17 @@ void HWR_DrawMD2(gr_vissprite_t *spr)
md2_t *md2; md2_t *md2;
UINT8 color[4]; UINT8 color[4];
if (!cv_grmd2.value)
return;
if (spr->precip)
return;
// MD2 colormap fix // MD2 colormap fix
// colormap test // colormap test
{ {
sector_t *sector = spr->mobj->subsector->sector; sector_t *sector = spr->mobj->subsector->sector;
UINT8 lightlevel = sector->lightlevel; UINT8 lightlevel = 255;
extracolormap_t *colormap = sector->extra_colormap; extracolormap_t *colormap = sector->extra_colormap;
if (sector->numlights) if (sector->numlights)
@ -1216,8 +1214,6 @@ void HWR_DrawMD2(gr_vissprite_t *spr)
if (!(spr->mobj->frame & FF_FULLBRIGHT)) if (!(spr->mobj->frame & FF_FULLBRIGHT))
lightlevel = *sector->lightlist[light].lightlevel; lightlevel = *sector->lightlist[light].lightlevel;
else
lightlevel = 255;
if (sector->lightlist[light].extra_colormap) if (sector->lightlist[light].extra_colormap)
colormap = sector->lightlist[light].extra_colormap; colormap = sector->lightlist[light].extra_colormap;
@ -1226,24 +1222,18 @@ void HWR_DrawMD2(gr_vissprite_t *spr)
{ {
if (!(spr->mobj->frame & FF_FULLBRIGHT)) if (!(spr->mobj->frame & FF_FULLBRIGHT))
lightlevel = sector->lightlevel; lightlevel = sector->lightlevel;
else
lightlevel = 255;
if (sector->extra_colormap) if (sector->extra_colormap)
colormap = sector->extra_colormap; colormap = sector->extra_colormap;
} }
if (spr->mobj->frame & FF_FULLBRIGHT)
lightlevel = 255;
if (colormap) if (colormap)
Surf.FlatColor.rgba = HWR_Lighting(lightlevel, colormap->rgba, colormap->fadergba, false, false); Surf.FlatColor.rgba = HWR_Lighting(lightlevel, colormap->rgba, colormap->fadergba, false, false);
else else
Surf.FlatColor.rgba = HWR_Lighting(lightlevel, NORMALFOG, FADEFOG, false, false); Surf.FlatColor.rgba = HWR_Lighting(lightlevel, NORMALFOG, FADEFOG, false, false);
} }
// Look at HWR_ProjetctSprite for more // Look at HWR_ProjectSprite for more
if (cv_grmd2.value && ((md2_models[spr->mobj->sprite].scale > 0.0f) || (md2_playermodels[(skin_t*)spr->mobj->skin-skins].scale > 0.0f)) && !spr->precip)
{ {
GLPatch_t *gpatch; GLPatch_t *gpatch;
INT32 *buff; INT32 *buff;
@ -1260,15 +1250,11 @@ void HWR_DrawMD2(gr_vissprite_t *spr)
//durs = tics; //durs = tics;
if (spr->mobj->flags2 & MF2_SHADOW) if (spr->mobj->flags2 & MF2_SHADOW)
{
Surf.FlatColor.s.alpha = 0x40; Surf.FlatColor.s.alpha = 0x40;
}
else if (spr->mobj->frame & FF_TRANSMASK) else if (spr->mobj->frame & FF_TRANSMASK)
HWR_TranstableToAlpha((spr->mobj->frame & FF_TRANSMASK)>>FF_TRANSSHIFT, &Surf); HWR_TranstableToAlpha((spr->mobj->frame & FF_TRANSMASK)>>FF_TRANSSHIFT, &Surf);
else else
{
Surf.FlatColor.s.alpha = 0xFF; Surf.FlatColor.s.alpha = 0xFF;
}
// dont forget to enabled the depth test because we can't do this like // dont forget to enabled the depth test because we can't do this like
// before: polygons models are not sorted // before: polygons models are not sorted
@ -1332,16 +1318,37 @@ void HWR_DrawMD2(gr_vissprite_t *spr)
HWR_GetMappedPatch(gpatch, spr->colormap); 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 //FIXME: this is not yet correct
frame = (spr->mobj->frame & FF_FRAMEMASK) % md2->model->header.numFrames; frame = (spr->mobj->frame & FF_FRAMEMASK) % md2->model->header.numFrames;
buff = md2->model->glCommandBuffer; buff = md2->model->glCommandBuffer;
curr = &md2->model->frames[frame]; curr = &md2->model->frames[frame];
if (cv_grmd2.value == 1 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_TAP1 || spr->mobj->state->nextstate == S_PLAY_TAP2) && spr->mobj->state == &states[S_PLAY_STND]))
{ {
const INT32 nextframe = (states[spr->mobj->state->nextstate].frame & FF_FRAMEMASK) % md2->model->header.numFrames; // frames are handled differently for states with FF_ANIMATE, so get the next frame differently for the interpolation
next = &md2->model->frames[nextframe]; 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_TAP1 || spr->mobj->state->nextstate == S_PLAY_TAP2) && 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 //Hurdler: it seems there is still a small problem with mobj angle
@ -1386,8 +1393,6 @@ void HWR_DrawMD2(gr_vissprite_t *spr)
p.flip = false; p.flip = false;
HWD.pfnDrawMD2i(buff, curr, durs, tics, next, &p, finalscale, flip, color); HWD.pfnDrawMD2i(buff, curr, durs, tics, next, &p, finalscale, flip, color);
} }
} }

View file

@ -1930,6 +1930,13 @@ EXPORT void HWRAPI(DrawMD2i) (INT32 *gl_cmd_buffer, md2_frame_t *frame, UINT32 d
pglRotatef(pos->anglex, -1.0f, 0.0f, 0.0f); pglRotatef(pos->anglex, -1.0f, 0.0f, 0.0f);
//pglBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); // alpha = level of transparency //pglBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); // alpha = level of transparency
// Remove depth mask when the model is transparent so it doesn't cut thorugh sprites // SRB2CBTODO: For all stuff too?!
if (color[3] < 255)
{
pglBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); // alpha = level of transparency
pglDepthMask(GL_FALSE);
}
val = *gl_cmd_buffer++; val = *gl_cmd_buffer++;
while (val != 0) while (val != 0)

View file

@ -2,7 +2,7 @@
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
// Copyright (C) 1993-1996 by id Software, Inc. // Copyright (C) 1993-1996 by id Software, Inc.
// Copyright (C) 1998-2000 by DooM Legacy Team. // Copyright (C) 1998-2000 by DooM Legacy Team.
// Copyright (C) 1999-2014 by Sonic Team Junior. // Copyright (C) 1999-2016 by Sonic Team Junior.
// //
// This program is free software distributed under the // This program is free software distributed under the
// terms of the GNU General Public License, version 2. // terms of the GNU General Public License, version 2.

View file

@ -2,7 +2,7 @@
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
// Copyright (C) 1993-1996 by id Software, Inc. // Copyright (C) 1993-1996 by id Software, Inc.
// Copyright (C) 1998-2000 by DooM Legacy Team. // Copyright (C) 1998-2000 by DooM Legacy Team.
// Copyright (C) 1999-2014 by Sonic Team Junior. // Copyright (C) 1999-2016 by Sonic Team Junior.
// //
// This program is free software distributed under the // This program is free software distributed under the
// terms of the GNU General Public License, version 2. // terms of the GNU General Public License, version 2.

View file

@ -1,6 +1,6 @@
// SONIC ROBO BLAST 2 // SONIC ROBO BLAST 2
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
// Copyright (C) 2011-2014 by Sonic Team Junior. // Copyright (C) 2011-2016 by Sonic Team Junior.
// //
// This program is free software distributed under the // This program is free software distributed under the
// terms of the GNU General Public License, version 2. // terms of the GNU General Public License, version 2.

View file

@ -1,6 +1,6 @@
// SONIC ROBO BLAST 2 // SONIC ROBO BLAST 2
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
// Copyright (C) 2011-2014 by Sonic Team Junior. // Copyright (C) 2011-2016 by Sonic Team Junior.
// //
// This program is free software distributed under the // This program is free software distributed under the
// terms of the GNU General Public License, version 2. // terms of the GNU General Public License, version 2.

View file

@ -1,7 +1,7 @@
// SONIC ROBO BLAST 2 // SONIC ROBO BLAST 2
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
// Copyright (C) 1998-2000 by DooM Legacy Team. // Copyright (C) 1998-2000 by DooM Legacy Team.
// Copyright (C) 1999-2014 by Sonic Team Junior. // Copyright (C) 1999-2016 by Sonic Team Junior.
// //
// This program is free software distributed under the // This program is free software distributed under the
// terms of the GNU General Public License, version 2. // terms of the GNU General Public License, version 2.

View file

@ -2,7 +2,7 @@
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
// Copyright (C) 1993-1996 by id Software, Inc. // Copyright (C) 1993-1996 by id Software, Inc.
// Copyright (C) 1998-2000 by DooM Legacy Team. // Copyright (C) 1998-2000 by DooM Legacy Team.
// Copyright (C) 1999-2014 by Sonic Team Junior. // Copyright (C) 1999-2016 by Sonic Team Junior.
// //
// This program is free software distributed under the // This program is free software distributed under the
// terms of the GNU General Public License, version 2. // terms of the GNU General Public License, version 2.

View file

@ -2,7 +2,7 @@
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
// Copyright (C) 1993-1996 by id Software, Inc. // Copyright (C) 1993-1996 by id Software, Inc.
// Copyright (C) 1998-2000 by DooM Legacy Team. // Copyright (C) 1998-2000 by DooM Legacy Team.
// Copyright (C) 1999-2014 by Sonic Team Junior. // Copyright (C) 1999-2016 by Sonic Team Junior.
// //
// This program is free software distributed under the // This program is free software distributed under the
// terms of the GNU General Public License, version 2. // terms of the GNU General Public License, version 2.

View file

@ -2,7 +2,7 @@
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
// Copyright (C) 1993-1996 by id Software, Inc. // Copyright (C) 1993-1996 by id Software, Inc.
// Copyright (C) 1998-2000 by DooM Legacy Team. // Copyright (C) 1998-2000 by DooM Legacy Team.
// Copyright (C) 1999-2014 by Sonic Team Junior. // Copyright (C) 1999-2016 by Sonic Team Junior.
// //
// This program is free software distributed under the // This program is free software distributed under the
// terms of the GNU General Public License, version 2. // terms of the GNU General Public License, version 2.

View file

@ -1,7 +1,7 @@
// SONIC ROBO BLAST 2 // SONIC ROBO BLAST 2
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
// Copyright (C) 1998-2000 by DooM Legacy Team. // Copyright (C) 1998-2000 by DooM Legacy Team.
// Copyright (C) 1999-2014 by Sonic Team Junior. // Copyright (C) 1999-2016 by Sonic Team Junior.
// //
// This program is free software distributed under the // This program is free software distributed under the
// terms of the GNU General Public License, version 2. // terms of the GNU General Public License, version 2.

View file

@ -1,7 +1,7 @@
// SONIC ROBO BLAST 2 // SONIC ROBO BLAST 2
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
// Copyright (C) 1998-2000 by DooM Legacy Team. // Copyright (C) 1998-2000 by DooM Legacy Team.
// Copyright (C) 1999-2014 by Sonic Team Junior. // Copyright (C) 1999-2016 by Sonic Team Junior.
// //
// This program is free software distributed under the // This program is free software distributed under the
// terms of the GNU General Public License, version 2. // terms of the GNU General Public License, version 2.

View file

@ -2,7 +2,7 @@
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
// Copyright (C) 1993-1996 by id Software, Inc. // Copyright (C) 1993-1996 by id Software, Inc.
// Copyright (C) 1998-2000 by DooM Legacy Team. // Copyright (C) 1998-2000 by DooM Legacy Team.
// Copyright (C) 1999-2014 by Sonic Team Junior. // Copyright (C) 1999-2016 by Sonic Team Junior.
// //
// This program is free software distributed under the // This program is free software distributed under the
// terms of the GNU General Public License, version 2. // terms of the GNU General Public License, version 2.

File diff suppressed because it is too large Load diff

View file

@ -2,7 +2,7 @@
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
// Copyright (C) 1993-1996 by id Software, Inc. // Copyright (C) 1993-1996 by id Software, Inc.
// Copyright (C) 1998-2000 by DooM Legacy Team. // Copyright (C) 1998-2000 by DooM Legacy Team.
// Copyright (C) 1999-2014 by Sonic Team Junior. // Copyright (C) 1999-2016 by Sonic Team Junior.
// //
// This program is free software distributed under the // This program is free software distributed under the
// terms of the GNU General Public License, version 2. // terms of the GNU General Public License, version 2.
@ -663,7 +663,6 @@ typedef enum state
// Blue Crawla // Blue Crawla
S_POSS_STND, S_POSS_STND,
S_POSS_STND2,
S_POSS_RUN1, S_POSS_RUN1,
S_POSS_RUN2, S_POSS_RUN2,
S_POSS_RUN3, S_POSS_RUN3,
@ -673,7 +672,6 @@ typedef enum state
// Red Crawla // Red Crawla
S_SPOS_STND, S_SPOS_STND,
S_SPOS_STND2,
S_SPOS_RUN1, S_SPOS_RUN1,
S_SPOS_RUN2, S_SPOS_RUN2,
S_SPOS_RUN3, S_SPOS_RUN3,
@ -1435,30 +1433,7 @@ typedef enum state
S_MSSHIELD_F12, S_MSSHIELD_F12,
// Ring // Ring
S_RING1, S_RING,
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,
// Blue Sphere for special stages // Blue Sphere for special stages
S_BLUEBALL, S_BLUEBALL,
@ -1474,39 +1449,10 @@ typedef enum state
S_GRAVWELLRED3, S_GRAVWELLRED3,
// Individual Team Rings // Individual Team Rings
S_TEAMRING1, S_TEAMRING,
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,
// Special Stage Token // Special Stage Token
S_EMMY1, S_EMMY,
S_EMMY2,
S_EMMY3,
S_EMMY4,
S_EMMY5,
S_EMMY6,
S_EMMY7,
// Special Stage Token // Special Stage Token
S_TOKEN, S_TOKEN,
@ -1660,40 +1606,9 @@ typedef enum state
S_SPIKED2, S_SPIKED2,
// Starpost // Starpost
S_STARPOST1, S_STARPOST_IDLE,
S_STARPOST2, S_STARPOST_FLASH,
S_STARPOST3, S_STARPOST_SPIN,
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,
// Big floating mine // Big floating mine
S_BIGMINE1, S_BIGMINE1,
@ -2301,38 +2216,7 @@ typedef enum state
S_PITY10, S_PITY10,
// Invincibility Sparkles // Invincibility Sparkles
S_IVSP1, S_IVSP,
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,
// Super Sonic Spark // Super Sonic Spark
S_SSPK1, S_SSPK1,
@ -2519,283 +2403,17 @@ typedef enum state
S_RRNG6, S_RRNG6,
S_RRNG7, S_RRNG7,
// Bounce Ring // Weapon Ring Ammo
S_BOUNCERING1, S_BOUNCERINGAMMO,
S_BOUNCERING2, S_RAILRINGAMMO,
S_BOUNCERING3, S_INFINITYRINGAMMO,
S_BOUNCERING4, S_AUTOMATICRINGAMMO,
S_BOUNCERING5, S_EXPLOSIONRINGAMMO,
S_BOUNCERING6, S_SCATTERRINGAMMO,
S_BOUNCERING7, S_GRENADERINGAMMO,
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 pickup // Weapon pickup
S_BOUNCEPICKUP1, S_BOUNCEPICKUP,
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_BOUNCEPICKUPFADE1, S_BOUNCEPICKUPFADE1,
S_BOUNCEPICKUPFADE2, S_BOUNCEPICKUPFADE2,
S_BOUNCEPICKUPFADE3, S_BOUNCEPICKUPFADE3,
@ -2805,23 +2423,7 @@ typedef enum state
S_BOUNCEPICKUPFADE7, S_BOUNCEPICKUPFADE7,
S_BOUNCEPICKUPFADE8, S_BOUNCEPICKUPFADE8,
S_RAILPICKUP1, S_RAILPICKUP,
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_RAILPICKUPFADE1, S_RAILPICKUPFADE1,
S_RAILPICKUPFADE2, S_RAILPICKUPFADE2,
S_RAILPICKUPFADE3, S_RAILPICKUPFADE3,
@ -2831,23 +2433,7 @@ typedef enum state
S_RAILPICKUPFADE7, S_RAILPICKUPFADE7,
S_RAILPICKUPFADE8, S_RAILPICKUPFADE8,
S_AUTOPICKUP1, S_AUTOPICKUP,
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_AUTOPICKUPFADE1, S_AUTOPICKUPFADE1,
S_AUTOPICKUPFADE2, S_AUTOPICKUPFADE2,
S_AUTOPICKUPFADE3, S_AUTOPICKUPFADE3,
@ -2857,23 +2443,7 @@ typedef enum state
S_AUTOPICKUPFADE7, S_AUTOPICKUPFADE7,
S_AUTOPICKUPFADE8, S_AUTOPICKUPFADE8,
S_EXPLODEPICKUP1, S_EXPLODEPICKUP,
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_EXPLODEPICKUPFADE1, S_EXPLODEPICKUPFADE1,
S_EXPLODEPICKUPFADE2, S_EXPLODEPICKUPFADE2,
S_EXPLODEPICKUPFADE3, S_EXPLODEPICKUPFADE3,
@ -2883,23 +2453,7 @@ typedef enum state
S_EXPLODEPICKUPFADE7, S_EXPLODEPICKUPFADE7,
S_EXPLODEPICKUPFADE8, S_EXPLODEPICKUPFADE8,
S_SCATTERPICKUP1, S_SCATTERPICKUP,
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_SCATTERPICKUPFADE1, S_SCATTERPICKUPFADE1,
S_SCATTERPICKUPFADE2, S_SCATTERPICKUPFADE2,
S_SCATTERPICKUPFADE3, S_SCATTERPICKUPFADE3,
@ -2909,23 +2463,7 @@ typedef enum state
S_SCATTERPICKUPFADE7, S_SCATTERPICKUPFADE7,
S_SCATTERPICKUPFADE8, S_SCATTERPICKUPFADE8,
S_GRENADEPICKUP1, S_GRENADEPICKUP,
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_GRENADEPICKUPFADE1, S_GRENADEPICKUPFADE1,
S_GRENADEPICKUPFADE2, S_GRENADEPICKUPFADE2,
S_GRENADEPICKUPFADE3, S_GRENADEPICKUPFADE3,
@ -3306,101 +2844,22 @@ typedef enum state
S_ROCKSPAWN, S_ROCKSPAWN,
S_ROCKCRUMBLEA1, S_ROCKCRUMBLEA,
S_ROCKCRUMBLEA2, S_ROCKCRUMBLEB,
S_ROCKCRUMBLEA3, S_ROCKCRUMBLEC,
S_ROCKCRUMBLEA4, S_ROCKCRUMBLED,
S_ROCKCRUMBLEA5, S_ROCKCRUMBLEE,
S_ROCKCRUMBLEF,
S_ROCKCRUMBLEB1, S_ROCKCRUMBLEG,
S_ROCKCRUMBLEB2, S_ROCKCRUMBLEH,
S_ROCKCRUMBLEB3, S_ROCKCRUMBLEI,
S_ROCKCRUMBLEB4, S_ROCKCRUMBLEJ,
S_ROCKCRUMBLEB5, S_ROCKCRUMBLEK,
S_ROCKCRUMBLEL,
S_ROCKCRUMBLEC1, S_ROCKCRUMBLEM,
S_ROCKCRUMBLEC2, S_ROCKCRUMBLEN,
S_ROCKCRUMBLEC3, S_ROCKCRUMBLEO,
S_ROCKCRUMBLEC4, S_ROCKCRUMBLEP,
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_SRB1_CRAWLA1, S_SRB1_CRAWLA1,
S_SRB1_CRAWLA2, S_SRB1_CRAWLA2,
@ -3590,9 +3049,7 @@ typedef enum mobj_type
// Collectible Items // Collectible Items
MT_RING, MT_RING,
MT_FLINGRING, // Lost ring MT_FLINGRING, // Lost ring
#ifdef BLUE_SPHERES
MT_BLUEBALL, // Blue sphere replacement for special stages MT_BLUEBALL, // Blue sphere replacement for special stages
#endif
MT_REDTEAMRING, //Rings collectable by red team. MT_REDTEAMRING, //Rings collectable by red team.
MT_BLUETEAMRING, //Rings collectable by blue team. MT_BLUETEAMRING, //Rings collectable by blue team.
MT_EMMY, // emerald token for special stage MT_EMMY, // emerald token for special stage

View file

@ -1,7 +1,7 @@
// SONIC ROBO BLAST 2 // SONIC ROBO BLAST 2
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
// Copyright (C) 1998-2000 by DooM Legacy Team. // Copyright (C) 1998-2000 by DooM Legacy Team.
// Copyright (C) 1999-2014 by Sonic Team Junior. // Copyright (C) 1999-2016 by Sonic Team Junior.
// //
// This program is free software distributed under the // This program is free software distributed under the
// terms of the GNU General Public License, version 2. // terms of the GNU General Public License, version 2.

View file

@ -1,7 +1,7 @@
// SONIC ROBO BLAST 2 // SONIC ROBO BLAST 2
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
// Copyright (C) 2012-2014 by John "JTE" Muniz. // Copyright (C) 2012-2016 by John "JTE" Muniz.
// Copyright (C) 2012-2014 by Sonic Team Junior. // Copyright (C) 2012-2016 by Sonic Team Junior.
// //
// This program is free software distributed under the // This program is free software distributed under the
// terms of the GNU General Public License, version 2. // terms of the GNU General Public License, version 2.
@ -88,6 +88,7 @@ static int lib_print(lua_State *L)
static int lib_evalMath(lua_State *L) static int lib_evalMath(lua_State *L)
{ {
const char *word = luaL_checkstring(L, 1); const char *word = luaL_checkstring(L, 1);
LUA_Deprecated(L, "EvalMath(string)", "_G[string]");
lua_pushinteger(L, LUA_EvalMath(word)); lua_pushinteger(L, LUA_EvalMath(word));
return 1; return 1;
} }
@ -95,17 +96,17 @@ static int lib_evalMath(lua_State *L)
// M_RANDOM // M_RANDOM
////////////// //////////////
static int lib_pRandom(lua_State *L) static int lib_pRandomFixed(lua_State *L)
{ {
NOHUD NOHUD
lua_pushinteger(L, P_Random()); lua_pushfixed(L, P_RandomFixed());
return 1; return 1;
} }
static int lib_pSignedRandom(lua_State *L) static int lib_pRandomByte(lua_State *L)
{ {
NOHUD NOHUD
lua_pushinteger(L, P_SignedRandom()); lua_pushinteger(L, P_RandomByte());
return 1; return 1;
} }
@ -114,6 +115,8 @@ static int lib_pRandomKey(lua_State *L)
INT32 a = (INT32)luaL_checkinteger(L, 1); INT32 a = (INT32)luaL_checkinteger(L, 1);
NOHUD NOHUD
if (a > 65536)
LUA_UsageWarning(L, "P_RandomKey: range > 65536 is undefined behavior");
lua_pushinteger(L, P_RandomKey(a)); lua_pushinteger(L, P_RandomKey(a));
return 1; return 1;
} }
@ -129,34 +132,84 @@ static int lib_pRandomRange(lua_State *L)
a = b; a = b;
b = c; b = c;
} }
if ((b-a+1) > 65536)
LUA_UsageWarning(L, "P_RandomRange: range > 65536 is undefined behavior");
lua_pushinteger(L, P_RandomRange(a, b)); lua_pushinteger(L, P_RandomRange(a, b));
return 1; return 1;
} }
// Deprecated, macros, etc.
static int lib_pRandom(lua_State *L)
{
NOHUD
LUA_Deprecated(L, "P_Random", "P_RandomByte");
lua_pushinteger(L, P_RandomByte());
return 1;
}
static int lib_pSignedRandom(lua_State *L)
{
NOHUD
lua_pushinteger(L, P_SignedRandom());
return 1;
}
static int lib_pRandomChance(lua_State *L)
{
fixed_t p = luaL_checkfixed(L, 1);
NOHUD
lua_pushboolean(L, P_RandomChance(p));
return 1;
}
// P_MAPUTIL // P_MAPUTIL
/////////////// ///////////////
static int lib_pAproxDistance(lua_State *L) static int lib_pAproxDistance(lua_State *L)
{ {
fixed_t dx = (fixed_t)luaL_checkinteger(L, 1); fixed_t dx = luaL_checkfixed(L, 1);
fixed_t dy = (fixed_t)luaL_checkinteger(L, 2); fixed_t dy = luaL_checkfixed(L, 2);
//HUDSAFE //HUDSAFE
lua_pushinteger(L, P_AproxDistance(dx, dy)); lua_pushfixed(L, P_AproxDistance(dx, dy));
return 1; return 1;
} }
static int lib_pClosestPointOnLine(lua_State *L) static int lib_pClosestPointOnLine(lua_State *L)
{ {
fixed_t x = (fixed_t)luaL_checkinteger(L, 1); int n = lua_gettop(L);
fixed_t y = (fixed_t)luaL_checkinteger(L, 2); fixed_t x = luaL_checkfixed(L, 1);
line_t *line = *((line_t **)luaL_checkudata(L, 3, META_LINE)); fixed_t y = luaL_checkfixed(L, 2);
vertex_t result; vertex_t result;
//HUDSAFE //HUDSAFE
if (!line) if (lua_isuserdata(L, 3)) // use a real linedef to get our points
return LUA_ErrInvalid(L, "line_t"); {
P_ClosestPointOnLine(x, y, line, &result); line_t *line = *((line_t **)luaL_checkudata(L, 3, META_LINE));
lua_pushinteger(L, result.x); if (!line)
lua_pushinteger(L, result.y); return LUA_ErrInvalid(L, "line_t");
P_ClosestPointOnLine(x, y, line, &result);
}
else // use custom coordinates of our own!
{
vertex_t v1, v2; // fake vertexes
line_t junk; // fake linedef
if (n < 6)
return luaL_error(L, "arguments 3 to 6 not all given (expected 4 fixed-point integers)");
v1.x = luaL_checkfixed(L, 3);
v1.y = luaL_checkfixed(L, 4);
v2.x = luaL_checkfixed(L, 5);
v2.y = luaL_checkfixed(L, 6);
junk.v1 = &v1;
junk.v2 = &v2;
junk.dx = v2.x - v1.x;
junk.dy = v2.y - v1.y;
P_ClosestPointOnLine(x, y, &junk, &result);
}
lua_pushfixed(L, result.x);
lua_pushfixed(L, result.y);
return 2; return 2;
} }
@ -241,13 +294,13 @@ static int lib_pLookForPlayers(lua_State *L)
static int lib_pSpawnMobj(lua_State *L) static int lib_pSpawnMobj(lua_State *L)
{ {
fixed_t x = (fixed_t)luaL_checkinteger(L, 1); fixed_t x = luaL_checkfixed(L, 1);
fixed_t y = (fixed_t)luaL_checkinteger(L, 2); fixed_t y = luaL_checkfixed(L, 2);
fixed_t z = (fixed_t)luaL_checkinteger(L, 3); fixed_t z = luaL_checkfixed(L, 3);
mobjtype_t type = luaL_checkinteger(L, 4); mobjtype_t type = luaL_checkinteger(L, 4);
NOHUD NOHUD
if (type > MT_LASTFREESLOT) if (type >= NUMMOBJTYPES)
return luaL_error(L, "mobjtype_t out of bounds error!"); return luaL_error(L, "mobj type %d out of range (0 - %d)", type, NUMMOBJTYPES-1);
LUA_PushUserdata(L, P_SpawnMobj(x, y, z, type), META_MOBJ); LUA_PushUserdata(L, P_SpawnMobj(x, y, z, type), META_MOBJ);
return 1; return 1;
} }
@ -272,8 +325,8 @@ static int lib_pSpawnMissile(lua_State *L)
NOHUD NOHUD
if (!source || !dest) if (!source || !dest)
return LUA_ErrInvalid(L, "mobj_t"); return LUA_ErrInvalid(L, "mobj_t");
if (type > MT_LASTFREESLOT) if (type >= NUMMOBJTYPES)
return luaL_error(L, "mobjtype_t out of bounds error!"); return luaL_error(L, "mobj type %d out of range (0 - %d)", type, NUMMOBJTYPES-1);
LUA_PushUserdata(L, P_SpawnMissile(source, dest, type), META_MOBJ); LUA_PushUserdata(L, P_SpawnMissile(source, dest, type), META_MOBJ);
return 1; return 1;
} }
@ -283,14 +336,14 @@ static int lib_pSpawnXYZMissile(lua_State *L)
mobj_t *source = *((mobj_t **)luaL_checkudata(L, 1, META_MOBJ)); mobj_t *source = *((mobj_t **)luaL_checkudata(L, 1, META_MOBJ));
mobj_t *dest = *((mobj_t **)luaL_checkudata(L, 2, META_MOBJ)); mobj_t *dest = *((mobj_t **)luaL_checkudata(L, 2, META_MOBJ));
mobjtype_t type = luaL_checkinteger(L, 3); mobjtype_t type = luaL_checkinteger(L, 3);
fixed_t x = (fixed_t)luaL_checkinteger(L, 4); fixed_t x = luaL_checkfixed(L, 4);
fixed_t y = (fixed_t)luaL_checkinteger(L, 5); fixed_t y = luaL_checkfixed(L, 5);
fixed_t z = (fixed_t)luaL_checkinteger(L, 6); fixed_t z = luaL_checkfixed(L, 6);
NOHUD NOHUD
if (!source || !dest) if (!source || !dest)
return LUA_ErrInvalid(L, "mobj_t"); return LUA_ErrInvalid(L, "mobj_t");
if (type > MT_LASTFREESLOT) if (type >= NUMMOBJTYPES)
return luaL_error(L, "mobjtype_t out of bounds error!"); return luaL_error(L, "mobj type %d out of range (0 - %d)", type, NUMMOBJTYPES-1);
LUA_PushUserdata(L, P_SpawnXYZMissile(source, dest, type, x, y, z), META_MOBJ); LUA_PushUserdata(L, P_SpawnXYZMissile(source, dest, type, x, y, z), META_MOBJ);
return 1; return 1;
} }
@ -298,18 +351,18 @@ static int lib_pSpawnXYZMissile(lua_State *L)
static int lib_pSpawnPointMissile(lua_State *L) static int lib_pSpawnPointMissile(lua_State *L)
{ {
mobj_t *source = *((mobj_t **)luaL_checkudata(L, 1, META_MOBJ)); mobj_t *source = *((mobj_t **)luaL_checkudata(L, 1, META_MOBJ));
fixed_t xa = (fixed_t)luaL_checkinteger(L, 2); fixed_t xa = luaL_checkfixed(L, 2);
fixed_t ya = (fixed_t)luaL_checkinteger(L, 3); fixed_t ya = luaL_checkfixed(L, 3);
fixed_t za = (fixed_t)luaL_checkinteger(L, 4); fixed_t za = luaL_checkfixed(L, 4);
mobjtype_t type = luaL_checkinteger(L, 5); mobjtype_t type = luaL_checkinteger(L, 5);
fixed_t x = (fixed_t)luaL_checkinteger(L, 6); fixed_t x = luaL_checkfixed(L, 6);
fixed_t y = (fixed_t)luaL_checkinteger(L, 7); fixed_t y = luaL_checkfixed(L, 7);
fixed_t z = (fixed_t)luaL_checkinteger(L, 8); fixed_t z = luaL_checkfixed(L, 8);
NOHUD NOHUD
if (!source) if (!source)
return LUA_ErrInvalid(L, "mobj_t"); return LUA_ErrInvalid(L, "mobj_t");
if (type > MT_LASTFREESLOT) if (type >= NUMMOBJTYPES)
return luaL_error(L, "mobjtype_t out of bounds error!"); return luaL_error(L, "mobj type %d out of range (0 - %d)", type, NUMMOBJTYPES-1);
LUA_PushUserdata(L, P_SpawnPointMissile(source, xa, ya, za, type, x, y, z), META_MOBJ); LUA_PushUserdata(L, P_SpawnPointMissile(source, xa, ya, za, type, x, y, z), META_MOBJ);
return 1; return 1;
} }
@ -318,15 +371,15 @@ static int lib_pSpawnAlteredDirectionMissile(lua_State *L)
{ {
mobj_t *source = *((mobj_t **)luaL_checkudata(L, 1, META_MOBJ)); mobj_t *source = *((mobj_t **)luaL_checkudata(L, 1, META_MOBJ));
mobjtype_t type = luaL_checkinteger(L, 2); mobjtype_t type = luaL_checkinteger(L, 2);
fixed_t x = (fixed_t)luaL_checkinteger(L, 3); fixed_t x = luaL_checkfixed(L, 3);
fixed_t y = (fixed_t)luaL_checkinteger(L, 4); fixed_t y = luaL_checkfixed(L, 4);
fixed_t z = (fixed_t)luaL_checkinteger(L, 5); fixed_t z = luaL_checkfixed(L, 5);
INT32 shiftingAngle = (INT32)luaL_checkinteger(L, 5); INT32 shiftingAngle = (INT32)luaL_checkinteger(L, 5);
NOHUD NOHUD
if (!source) if (!source)
return LUA_ErrInvalid(L, "mobj_t"); return LUA_ErrInvalid(L, "mobj_t");
if (type > MT_LASTFREESLOT) if (type >= NUMMOBJTYPES)
return luaL_error(L, "mobjtype_t out of bounds error!"); return luaL_error(L, "mobj type %d out of range (0 - %d)", type, NUMMOBJTYPES-1);
LUA_PushUserdata(L, P_SpawnAlteredDirectionMissile(source, type, x, y, z, shiftingAngle), META_MOBJ); LUA_PushUserdata(L, P_SpawnAlteredDirectionMissile(source, type, x, y, z, shiftingAngle), META_MOBJ);
return 1; return 1;
} }
@ -348,14 +401,14 @@ static int lib_pSPMAngle(lua_State *L)
{ {
mobj_t *source = *((mobj_t **)luaL_checkudata(L, 1, META_MOBJ)); mobj_t *source = *((mobj_t **)luaL_checkudata(L, 1, META_MOBJ));
mobjtype_t type = luaL_checkinteger(L, 2); mobjtype_t type = luaL_checkinteger(L, 2);
angle_t angle = (angle_t)luaL_checkinteger(L, 3); angle_t angle = luaL_checkangle(L, 3);
UINT8 allowaim = (UINT8)luaL_optinteger(L, 4, 0); UINT8 allowaim = (UINT8)luaL_optinteger(L, 4, 0);
UINT32 flags2 = (UINT32)luaL_optinteger(L, 5, 0); UINT32 flags2 = (UINT32)luaL_optinteger(L, 5, 0);
NOHUD NOHUD
if (!source) if (!source)
return LUA_ErrInvalid(L, "mobj_t"); return LUA_ErrInvalid(L, "mobj_t");
if (type > MT_LASTFREESLOT) if (type >= NUMMOBJTYPES)
return luaL_error(L, "mobjtype_t out of bounds error!"); return luaL_error(L, "mobj type %d out of range (0 - %d)", type, NUMMOBJTYPES-1);
LUA_PushUserdata(L, P_SPMAngle(source, type, angle, allowaim, flags2), META_MOBJ); LUA_PushUserdata(L, P_SPMAngle(source, type, angle, allowaim, flags2), META_MOBJ);
return 1; return 1;
} }
@ -368,8 +421,8 @@ static int lib_pSpawnPlayerMissile(lua_State *L)
NOHUD NOHUD
if (!source) if (!source)
return LUA_ErrInvalid(L, "mobj_t"); return LUA_ErrInvalid(L, "mobj_t");
if (type > MT_LASTFREESLOT) if (type >= NUMMOBJTYPES)
return luaL_error(L, "mobjtype_t out of bounds error!"); return luaL_error(L, "mobj type %d out of range (0 - %d)", type, NUMMOBJTYPES-1);
LUA_PushUserdata(L, P_SpawnPlayerMissile(source, type, flags2), META_MOBJ); LUA_PushUserdata(L, P_SpawnPlayerMissile(source, type, flags2), META_MOBJ);
return 1; return 1;
} }
@ -388,8 +441,8 @@ static int lib_pWeaponOrPanel(lua_State *L)
{ {
mobjtype_t type = luaL_checkinteger(L, 1); mobjtype_t type = luaL_checkinteger(L, 1);
//HUDSAFE //HUDSAFE
if (type > MT_LASTFREESLOT) if (type >= NUMMOBJTYPES)
return luaL_error(L, "mobjtype_t out of bounds error!"); return luaL_error(L, "mobj type %d out of range (0 - %d)", type, NUMMOBJTYPES-1);
lua_pushboolean(L, P_WeaponOrPanel(type)); lua_pushboolean(L, P_WeaponOrPanel(type));
return 1; return 1;
} }
@ -418,18 +471,20 @@ static int lib_pGetClosestAxis(lua_State *L)
static int lib_pSpawnParaloop(lua_State *L) static int lib_pSpawnParaloop(lua_State *L)
{ {
fixed_t x = (fixed_t)luaL_checkinteger(L, 1); fixed_t x = luaL_checkfixed(L, 1);
fixed_t y = (fixed_t)luaL_checkinteger(L, 2); fixed_t y = luaL_checkfixed(L, 2);
fixed_t z = (fixed_t)luaL_checkinteger(L, 3); fixed_t z = luaL_checkfixed(L, 3);
fixed_t radius = (fixed_t)luaL_checkinteger(L, 4); fixed_t radius = luaL_checkfixed(L, 4);
INT32 number = (INT32)luaL_checkinteger(L, 5); INT32 number = (INT32)luaL_checkinteger(L, 5);
mobjtype_t type = luaL_checkinteger(L, 6); mobjtype_t type = luaL_checkinteger(L, 6);
angle_t rotangle = (angle_t)luaL_checkinteger(L, 7); angle_t rotangle = luaL_checkangle(L, 7);
statenum_t nstate = luaL_optinteger(L, 8, S_NULL); statenum_t nstate = luaL_optinteger(L, 8, S_NULL);
boolean spawncenter = lua_optboolean(L, 9); boolean spawncenter = lua_optboolean(L, 9);
NOHUD NOHUD
if (type > MT_LASTFREESLOT) if (type >= NUMMOBJTYPES)
return luaL_error(L, "mobjtype_t out of bounds error!"); return luaL_error(L, "mobj type %d out of range (0 - %d)", type, NUMMOBJTYPES-1);
if (nstate >= NUMSTATES)
return luaL_error(L, "state %d out of range (0 - %d)", nstate, NUMSTATES-1);
P_SpawnParaloop(x, y, z, radius, number, type, nstate, rotangle, spawncenter); P_SpawnParaloop(x, y, z, radius, number, type, nstate, rotangle, spawncenter);
return 0; return 0;
} }
@ -458,7 +513,7 @@ static int lib_pSupermanLook4Players(lua_State *L)
static int lib_pSetScale(lua_State *L) static int lib_pSetScale(lua_State *L)
{ {
mobj_t *mobj = *((mobj_t **)luaL_checkudata(L, 1, META_MOBJ)); mobj_t *mobj = *((mobj_t **)luaL_checkudata(L, 1, META_MOBJ));
fixed_t newscale = (fixed_t)luaL_checkinteger(L, 2); fixed_t newscale = luaL_checkfixed(L, 2);
NOHUD NOHUD
if (!mobj) if (!mobj)
return LUA_ErrInvalid(L, "mobj_t"); return LUA_ErrInvalid(L, "mobj_t");
@ -526,7 +581,7 @@ static int lib_pGetPlayerHeight(lua_State *L)
//HUDSAFE //HUDSAFE
if (!player) if (!player)
return LUA_ErrInvalid(L, "player_t"); return LUA_ErrInvalid(L, "player_t");
lua_pushinteger(L, P_GetPlayerHeight(player)); lua_pushfixed(L, P_GetPlayerHeight(player));
return 1; return 1;
} }
@ -536,7 +591,7 @@ static int lib_pGetPlayerSpinHeight(lua_State *L)
//HUDSAFE //HUDSAFE
if (!player) if (!player)
return LUA_ErrInvalid(L, "player_t"); return LUA_ErrInvalid(L, "player_t");
lua_pushinteger(L, P_GetPlayerSpinHeight(player)); lua_pushfixed(L, P_GetPlayerSpinHeight(player));
return 1; return 1;
} }
@ -639,7 +694,7 @@ static int lib_pInQuicksand(lua_State *L)
static int lib_pSetObjectMomZ(lua_State *L) static int lib_pSetObjectMomZ(lua_State *L)
{ {
mobj_t *mo = *((mobj_t **)luaL_checkudata(L, 1, META_MOBJ)); mobj_t *mo = *((mobj_t **)luaL_checkudata(L, 1, META_MOBJ));
fixed_t value = (fixed_t)luaL_checkinteger(L, 2); fixed_t value = luaL_checkfixed(L, 2);
boolean relative = lua_optboolean(L, 3); boolean relative = lua_optboolean(L, 3);
NOHUD NOHUD
if (!mo) if (!mo)
@ -753,8 +808,8 @@ static int lib_pDoPlayerExit(lua_State *L)
static int lib_pInstaThrust(lua_State *L) static int lib_pInstaThrust(lua_State *L)
{ {
mobj_t *mo = *((mobj_t **)luaL_checkudata(L, 1, META_MOBJ)); mobj_t *mo = *((mobj_t **)luaL_checkudata(L, 1, META_MOBJ));
angle_t angle = (angle_t)luaL_checkinteger(L, 2); angle_t angle = luaL_checkangle(L, 2);
fixed_t move = (fixed_t)luaL_checkinteger(L, 3); fixed_t move = luaL_checkfixed(L, 3);
NOHUD NOHUD
if (!mo) if (!mo)
return LUA_ErrInvalid(L, "mobj_t"); return LUA_ErrInvalid(L, "mobj_t");
@ -768,10 +823,10 @@ static int lib_pReturnThrustX(lua_State *L)
fixed_t move; fixed_t move;
if (lua_isnil(L, 1) || lua_isuserdata(L, 1)) if (lua_isnil(L, 1) || lua_isuserdata(L, 1))
lua_remove(L, 1); // ignore mobj as arg1 lua_remove(L, 1); // ignore mobj as arg1
angle = (angle_t)luaL_checkinteger(L, 1); angle = luaL_checkangle(L, 1);
move = (fixed_t)luaL_checkinteger(L, 2); move = luaL_checkfixed(L, 2);
//HUDSAFE //HUDSAFE
lua_pushinteger(L, P_ReturnThrustX(NULL, angle, move)); lua_pushfixed(L, P_ReturnThrustX(NULL, angle, move));
return 1; return 1;
} }
@ -781,10 +836,10 @@ static int lib_pReturnThrustY(lua_State *L)
fixed_t move; fixed_t move;
if (lua_isnil(L, 1) || lua_isuserdata(L, 1)) if (lua_isnil(L, 1) || lua_isuserdata(L, 1))
lua_remove(L, 1); // ignore mobj as arg1 lua_remove(L, 1); // ignore mobj as arg1
angle = (angle_t)luaL_checkinteger(L, 1); angle = luaL_checkangle(L, 1);
move = (fixed_t)luaL_checkinteger(L, 2); move = luaL_checkfixed(L, 2);
//HUDSAFE //HUDSAFE
lua_pushinteger(L, P_ReturnThrustY(NULL, angle, move)); lua_pushfixed(L, P_ReturnThrustY(NULL, angle, move));
return 1; return 1;
} }
@ -802,7 +857,7 @@ static int lib_pNukeEnemies(lua_State *L)
{ {
mobj_t *inflictor = *((mobj_t **)luaL_checkudata(L, 1, META_MOBJ)); mobj_t *inflictor = *((mobj_t **)luaL_checkudata(L, 1, META_MOBJ));
mobj_t *source = *((mobj_t **)luaL_checkudata(L, 2, META_MOBJ)); mobj_t *source = *((mobj_t **)luaL_checkudata(L, 2, META_MOBJ));
fixed_t radius = (fixed_t)luaL_checkinteger(L, 3); fixed_t radius = luaL_checkfixed(L, 3);
NOHUD NOHUD
if (!inflictor || !source) if (!inflictor || !source)
return LUA_ErrInvalid(L, "mobj_t"); return LUA_ErrInvalid(L, "mobj_t");
@ -859,8 +914,8 @@ static int lib_pSpawnSpinMobj(lua_State *L)
NOHUD NOHUD
if (!player) if (!player)
return LUA_ErrInvalid(L, "player_t"); return LUA_ErrInvalid(L, "player_t");
if (type > MT_LASTFREESLOT) if (type >= NUMMOBJTYPES)
return luaL_error(L, "mobjtype_t out of bounds error!"); return luaL_error(L, "mobj type %d out of range (0 - %d)", type, NUMMOBJTYPES-1);
P_SpawnSpinMobj(player, type); P_SpawnSpinMobj(player, type);
return 0; return 0;
} }
@ -868,8 +923,8 @@ static int lib_pSpawnSpinMobj(lua_State *L)
static int lib_pTelekinesis(lua_State *L) static int lib_pTelekinesis(lua_State *L)
{ {
player_t *player = *((player_t **)luaL_checkudata(L, 1, META_PLAYER)); player_t *player = *((player_t **)luaL_checkudata(L, 1, META_PLAYER));
fixed_t thrust = (fixed_t)luaL_checkinteger(L, 2); fixed_t thrust = luaL_checkfixed(L, 2);
fixed_t range = (fixed_t)luaL_checkinteger(L, 3); fixed_t range = luaL_checkfixed(L, 3);
NOHUD NOHUD
if (!player) if (!player)
return LUA_ErrInvalid(L, "player_t"); return LUA_ErrInvalid(L, "player_t");
@ -884,8 +939,8 @@ static int lib_pCheckPosition(lua_State *L)
{ {
mobj_t *ptmthing = tmthing; mobj_t *ptmthing = tmthing;
mobj_t *thing = *((mobj_t **)luaL_checkudata(L, 1, META_MOBJ)); mobj_t *thing = *((mobj_t **)luaL_checkudata(L, 1, META_MOBJ));
fixed_t x = (fixed_t)luaL_checkinteger(L, 2); fixed_t x = luaL_checkfixed(L, 2);
fixed_t y = (fixed_t)luaL_checkinteger(L, 3); fixed_t y = luaL_checkfixed(L, 3);
NOHUD NOHUD
if (!thing) if (!thing)
return LUA_ErrInvalid(L, "mobj_t"); return LUA_ErrInvalid(L, "mobj_t");
@ -899,8 +954,8 @@ static int lib_pTryMove(lua_State *L)
{ {
mobj_t *ptmthing = tmthing; mobj_t *ptmthing = tmthing;
mobj_t *thing = *((mobj_t **)luaL_checkudata(L, 1, META_MOBJ)); mobj_t *thing = *((mobj_t **)luaL_checkudata(L, 1, META_MOBJ));
fixed_t x = (fixed_t)luaL_checkinteger(L, 2); fixed_t x = luaL_checkfixed(L, 2);
fixed_t y = (fixed_t)luaL_checkinteger(L, 3); fixed_t y = luaL_checkfixed(L, 3);
boolean allowdropoff = lua_optboolean(L, 4); boolean allowdropoff = lua_optboolean(L, 4);
NOHUD NOHUD
if (!thing) if (!thing)
@ -915,7 +970,7 @@ static int lib_pMove(lua_State *L)
{ {
mobj_t *ptmthing = tmthing; mobj_t *ptmthing = tmthing;
mobj_t *actor = *((mobj_t **)luaL_checkudata(L, 1, META_MOBJ)); mobj_t *actor = *((mobj_t **)luaL_checkudata(L, 1, META_MOBJ));
fixed_t speed = (fixed_t)luaL_checkinteger(L, 2); fixed_t speed = luaL_checkfixed(L, 2);
NOHUD NOHUD
if (!actor) if (!actor)
return LUA_ErrInvalid(L, "mobj_t"); return LUA_ErrInvalid(L, "mobj_t");
@ -929,9 +984,9 @@ static int lib_pTeleportMove(lua_State *L)
{ {
mobj_t *ptmthing = tmthing; mobj_t *ptmthing = tmthing;
mobj_t *thing = *((mobj_t **)luaL_checkudata(L, 1, META_MOBJ)); mobj_t *thing = *((mobj_t **)luaL_checkudata(L, 1, META_MOBJ));
fixed_t x = (fixed_t)luaL_checkinteger(L, 2); fixed_t x = luaL_checkfixed(L, 2);
fixed_t y = (fixed_t)luaL_checkinteger(L, 3); fixed_t y = luaL_checkfixed(L, 3);
fixed_t z = (fixed_t)luaL_checkinteger(L, 4); fixed_t z = luaL_checkfixed(L, 4);
NOHUD NOHUD
if (!thing) if (!thing)
return LUA_ErrInvalid(L, "mobj_t"); return LUA_ErrInvalid(L, "mobj_t");
@ -975,10 +1030,10 @@ static int lib_pCheckSight(lua_State *L)
static int lib_pCheckHoopPosition(lua_State *L) static int lib_pCheckHoopPosition(lua_State *L)
{ {
mobj_t *hoopthing = *((mobj_t **)luaL_checkudata(L, 1, META_MOBJ)); mobj_t *hoopthing = *((mobj_t **)luaL_checkudata(L, 1, META_MOBJ));
fixed_t x = (fixed_t)luaL_checkinteger(L, 2); fixed_t x = luaL_checkfixed(L, 2);
fixed_t y = (fixed_t)luaL_checkinteger(L, 3); fixed_t y = luaL_checkfixed(L, 3);
fixed_t z = (fixed_t)luaL_checkinteger(L, 4); fixed_t z = luaL_checkfixed(L, 4);
fixed_t radius = (fixed_t)luaL_checkinteger(L, 5); fixed_t radius = luaL_checkfixed(L, 5);
NOHUD NOHUD
if (!hoopthing) if (!hoopthing)
return LUA_ErrInvalid(L, "mobj_t"); return LUA_ErrInvalid(L, "mobj_t");
@ -990,7 +1045,7 @@ static int lib_pRadiusAttack(lua_State *L)
{ {
mobj_t *spot = *((mobj_t **)luaL_checkudata(L, 1, META_MOBJ)); mobj_t *spot = *((mobj_t **)luaL_checkudata(L, 1, META_MOBJ));
mobj_t *source = *((mobj_t **)luaL_checkudata(L, 2, META_MOBJ)); mobj_t *source = *((mobj_t **)luaL_checkudata(L, 2, META_MOBJ));
fixed_t damagedist = (fixed_t)luaL_checkinteger(L, 3); fixed_t damagedist = luaL_checkfixed(L, 3);
NOHUD NOHUD
if (!spot || !source) if (!spot || !source)
return LUA_ErrInvalid(L, "mobj_t"); return LUA_ErrInvalid(L, "mobj_t");
@ -1000,12 +1055,12 @@ static int lib_pRadiusAttack(lua_State *L)
static int lib_pFloorzAtPos(lua_State *L) static int lib_pFloorzAtPos(lua_State *L)
{ {
fixed_t x = (fixed_t)luaL_checkinteger(L, 1); fixed_t x = luaL_checkfixed(L, 1);
fixed_t y = (fixed_t)luaL_checkinteger(L, 2); fixed_t y = luaL_checkfixed(L, 2);
fixed_t z = (fixed_t)luaL_checkinteger(L, 3); fixed_t z = luaL_checkfixed(L, 3);
fixed_t height = (fixed_t)luaL_checkinteger(L, 4); fixed_t height = luaL_checkfixed(L, 4);
//HUDSAFE //HUDSAFE
lua_pushinteger(L, P_FloorzAtPos(x, y, z, height)); lua_pushfixed(L, P_FloorzAtPos(x, y, z, height));
return 1; return 1;
} }
@ -1016,8 +1071,8 @@ static int lib_pDoSpring(lua_State *L)
NOHUD NOHUD
if (!spring || !object) if (!spring || !object)
return LUA_ErrInvalid(L, "mobj_t"); return LUA_ErrInvalid(L, "mobj_t");
P_DoSpring(spring, object); lua_pushboolean(L, P_DoSpring(spring, object));
return 0; return 1;
} }
// P_INTER // P_INTER
@ -1209,8 +1264,8 @@ static int lib_pDoNightsScore(lua_State *L)
static int lib_pThrust(lua_State *L) static int lib_pThrust(lua_State *L)
{ {
mobj_t *mo = *((mobj_t **)luaL_checkudata(L, 1, META_MOBJ)); mobj_t *mo = *((mobj_t **)luaL_checkudata(L, 1, META_MOBJ));
angle_t angle = (angle_t)luaL_checkinteger(L, 2); angle_t angle = luaL_checkangle(L, 2);
fixed_t move = (fixed_t)luaL_checkinteger(L, 3); fixed_t move = luaL_checkfixed(L, 3);
NOHUD NOHUD
if (!mo) if (!mo)
return LUA_ErrInvalid(L, "mobj_t"); return LUA_ErrInvalid(L, "mobj_t");
@ -1225,6 +1280,8 @@ static int lib_pSetMobjStateNF(lua_State *L)
NOHUD NOHUD
if (!mobj) if (!mobj)
return LUA_ErrInvalid(L, "mobj_t"); return LUA_ErrInvalid(L, "mobj_t");
if (state >= NUMSTATES)
return luaL_error(L, "state %d out of range (0 - %d)", state, NUMSTATES-1);
if (mobj->player && state == S_NULL) if (mobj->player && state == S_NULL)
return luaL_error(L, "Attempt to remove player mobj with S_NULL."); return luaL_error(L, "Attempt to remove player mobj with S_NULL.");
lua_pushboolean(L, P_SetMobjStateNF(mobj, state)); lua_pushboolean(L, P_SetMobjStateNF(mobj, state));
@ -1336,8 +1393,8 @@ static int lib_pIsFlagAtBase(lua_State *L)
{ {
mobjtype_t flag = luaL_checkinteger(L, 1); mobjtype_t flag = luaL_checkinteger(L, 1);
NOHUD NOHUD
if (flag > MT_LASTFREESLOT) if (flag >= NUMMOBJTYPES)
return luaL_error(L, "mobjtype_t out of bounds error!"); return luaL_error(L, "mobj type %d out of range (0 - %d)", flag, NUMMOBJTYPES-1);
lua_pushboolean(L, P_IsFlagAtBase(flag)); lua_pushboolean(L, P_IsFlagAtBase(flag));
return 1; return 1;
} }
@ -1485,48 +1542,48 @@ static int lib_evCrumbleChain(lua_State *L)
static int lib_rPointToAngle(lua_State *L) static int lib_rPointToAngle(lua_State *L)
{ {
fixed_t x = (fixed_t)luaL_checkinteger(L, 1); fixed_t x = luaL_checkfixed(L, 1);
fixed_t y = (fixed_t)luaL_checkinteger(L, 2); fixed_t y = luaL_checkfixed(L, 2);
//HUDSAFE //HUDSAFE
lua_pushinteger(L, R_PointToAngle(x, y)); lua_pushangle(L, R_PointToAngle(x, y));
return 1; return 1;
} }
static int lib_rPointToAngle2(lua_State *L) static int lib_rPointToAngle2(lua_State *L)
{ {
fixed_t px2 = (fixed_t)luaL_checkinteger(L, 1); fixed_t px2 = luaL_checkfixed(L, 1);
fixed_t py2 = (fixed_t)luaL_checkinteger(L, 2); fixed_t py2 = luaL_checkfixed(L, 2);
fixed_t px1 = (fixed_t)luaL_checkinteger(L, 3); fixed_t px1 = luaL_checkfixed(L, 3);
fixed_t py1 = (fixed_t)luaL_checkinteger(L, 4); fixed_t py1 = luaL_checkfixed(L, 4);
//HUDSAFE //HUDSAFE
lua_pushinteger(L, R_PointToAngle2(px2, py2, px1, py1)); lua_pushangle(L, R_PointToAngle2(px2, py2, px1, py1));
return 1; return 1;
} }
static int lib_rPointToDist(lua_State *L) static int lib_rPointToDist(lua_State *L)
{ {
fixed_t x = (fixed_t)luaL_checkinteger(L, 1); fixed_t x = luaL_checkfixed(L, 1);
fixed_t y = (fixed_t)luaL_checkinteger(L, 2); fixed_t y = luaL_checkfixed(L, 2);
//HUDSAFE //HUDSAFE
lua_pushinteger(L, R_PointToDist(x, y)); lua_pushfixed(L, R_PointToDist(x, y));
return 1; return 1;
} }
static int lib_rPointToDist2(lua_State *L) static int lib_rPointToDist2(lua_State *L)
{ {
fixed_t px2 = (fixed_t)luaL_checkinteger(L, 1); fixed_t px2 = luaL_checkfixed(L, 1);
fixed_t py2 = (fixed_t)luaL_checkinteger(L, 2); fixed_t py2 = luaL_checkfixed(L, 2);
fixed_t px1 = (fixed_t)luaL_checkinteger(L, 3); fixed_t px1 = luaL_checkfixed(L, 3);
fixed_t py1 = (fixed_t)luaL_checkinteger(L, 4); fixed_t py1 = luaL_checkfixed(L, 4);
//HUDSAFE //HUDSAFE
lua_pushinteger(L, R_PointToDist2(px2, py2, px1, py1)); lua_pushfixed(L, R_PointToDist2(px2, py2, px1, py1));
return 1; return 1;
} }
static int lib_rPointInSubsector(lua_State *L) static int lib_rPointInSubsector(lua_State *L)
{ {
fixed_t x = (fixed_t)luaL_checkinteger(L, 1); fixed_t x = luaL_checkfixed(L, 1);
fixed_t y = (fixed_t)luaL_checkinteger(L, 2); fixed_t y = luaL_checkfixed(L, 2);
//HUDSAFE //HUDSAFE
LUA_PushUserdata(L, R_PointInSubsector(x, y), META_SUBSECTOR); LUA_PushUserdata(L, R_PointInSubsector(x, y), META_SUBSECTOR);
return 1; return 1;
@ -1570,7 +1627,7 @@ static int lib_rSetPlayerSkin(lua_State *L)
{ {
INT32 i = luaL_checkinteger(L, 2); INT32 i = luaL_checkinteger(L, 2);
if (i < 0 || i >= MAXSKINS) if (i < 0 || i >= MAXSKINS)
return luaL_error(L, "argument #2 cannot exceed MAXSKINS"); return luaL_error(L, "skin number (argument #2) %d out of range (0 - %d)", i, MAXSKINS-1);
SetPlayerSkinByNum(player-players, i); SetPlayerSkinByNum(player-players, i);
} }
else // skin name else // skin name
@ -1590,6 +1647,8 @@ static int lib_sStartSound(lua_State *L)
sfxenum_t sound_id = luaL_checkinteger(L, 2); sfxenum_t sound_id = luaL_checkinteger(L, 2);
player_t *player = NULL; player_t *player = NULL;
NOHUD NOHUD
if (sound_id >= NUMSFX)
return luaL_error(L, "sfx %d out of range (0 - %d)", sound_id, NUMSFX-1);
if (!lua_isnil(L, 1)) if (!lua_isnil(L, 1))
{ {
origin = *((mobj_t **)luaL_checkudata(L, 1, META_MOBJ)); origin = *((mobj_t **)luaL_checkudata(L, 1, META_MOBJ));
@ -1614,12 +1673,15 @@ static int lib_sStartSoundAtVolume(lua_State *L)
INT32 volume = (INT32)luaL_checkinteger(L, 3); INT32 volume = (INT32)luaL_checkinteger(L, 3);
player_t *player = NULL; player_t *player = NULL;
NOHUD NOHUD
if (!lua_isnil(L, 1)) if (!lua_isnil(L, 1))
{ {
origin = *((mobj_t **)luaL_checkudata(L, 1, META_MOBJ)); origin = *((mobj_t **)luaL_checkudata(L, 1, META_MOBJ));
if (!origin) if (!origin)
return LUA_ErrInvalid(L, "mobj_t"); return LUA_ErrInvalid(L, "mobj_t");
} }
if (sound_id >= NUMSFX)
return luaL_error(L, "sfx %d out of range (0 - %d)", sound_id, NUMSFX-1);
if (!lua_isnone(L, 4) && lua_isuserdata(L, 4)) if (!lua_isnone(L, 4) && lua_isuserdata(L, 4))
{ {
player = *((player_t **)luaL_checkudata(L, 4, META_PLAYER)); player = *((player_t **)luaL_checkudata(L, 4, META_PLAYER));
@ -1643,24 +1705,69 @@ static int lib_sStopSound(lua_State *L)
static int lib_sChangeMusic(lua_State *L) static int lib_sChangeMusic(lua_State *L)
{ {
UINT32 music_num = (UINT32)luaL_checkinteger(L, 1); #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); boolean looping = (boolean)lua_opttrueboolean(L, 2);
player_t *player = NULL; player_t *player = NULL;
UINT16 music_flags = 0;
NOHUD NOHUD
#endif
if (!lua_isnone(L, 3) && lua_isuserdata(L, 3)) if (!lua_isnone(L, 3) && lua_isuserdata(L, 3))
{ {
player = *((player_t **)luaL_checkudata(L, 3, META_PLAYER)); player = *((player_t **)luaL_checkudata(L, 3, META_PLAYER));
if (!player) if (!player)
return LUA_ErrInvalid(L, "player_t"); 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)) if (!player || P_IsLocalPlayer(player))
S_ChangeMusic(music_num, looping); S_ChangeMusic(music_name, music_flags, looping);
return 0; return 0;
} }
static int lib_sSpeedMusic(lua_State *L) static int lib_sSpeedMusic(lua_State *L)
{ {
fixed_t fixedspeed = (fixed_t)luaL_checkinteger(L, 1); fixed_t fixedspeed = luaL_checkfixed(L, 1);
float speed = FIXED_TO_FLOAT(fixedspeed); float speed = FIXED_TO_FLOAT(fixedspeed);
player_t *player = NULL; player_t *player = NULL;
NOHUD NOHUD
@ -1706,6 +1813,8 @@ static int lib_sIdPlaying(lua_State *L)
{ {
sfxenum_t id = luaL_checkinteger(L, 1); sfxenum_t id = luaL_checkinteger(L, 1);
NOHUD NOHUD
if (id >= NUMSFX)
return luaL_error(L, "sfx %d out of range (0 - %d)", id, NUMSFX-1);
lua_pushboolean(L, S_IdPlaying(id)); lua_pushboolean(L, S_IdPlaying(id));
return 1; return 1;
} }
@ -1717,6 +1826,8 @@ static int lib_sSoundPlaying(lua_State *L)
NOHUD NOHUD
if (!origin) if (!origin)
return LUA_ErrInvalid(L, "mobj_t"); return LUA_ErrInvalid(L, "mobj_t");
if (id >= NUMSFX)
return luaL_error(L, "sfx %d out of range (0 - %d)", id, NUMSFX-1);
lua_pushboolean(L, S_SoundPlaying(origin, id)); lua_pushboolean(L, S_SoundPlaying(origin, id));
return 1; return 1;
} }
@ -1737,7 +1848,7 @@ static int lib_gDoReborn(lua_State *L)
INT32 playernum = luaL_checkinteger(L, 1); INT32 playernum = luaL_checkinteger(L, 1);
NOHUD NOHUD
if (playernum >= MAXPLAYERS) if (playernum >= MAXPLAYERS)
return luaL_error(L, "playernum out of bounds error!"); return luaL_error(L, "playernum %d out of range (0 - %d)", playernum, MAXPLAYERS-1);
G_DoReborn(playernum); G_DoReborn(playernum);
return 0; return 0;
} }
@ -1864,10 +1975,13 @@ static luaL_Reg lib[] = {
{"EvalMath", lib_evalMath}, {"EvalMath", lib_evalMath},
// m_random // m_random
{"P_Random",lib_pRandom}, {"P_RandomFixed",lib_pRandomFixed},
{"P_SignedRandom",lib_pSignedRandom}, {"P_RandomByte",lib_pRandomByte},
{"P_RandomKey",lib_pRandomKey}, {"P_RandomKey",lib_pRandomKey},
{"P_RandomRange",lib_pRandomRange}, {"P_RandomRange",lib_pRandomRange},
{"P_Random",lib_pRandom}, // DEPRECATED
{"P_SignedRandom",lib_pSignedRandom}, // MACRO
{"P_RandomChance",lib_pRandomChance}, // MACRO
// p_maputil // p_maputil
{"P_AproxDistance",lib_pAproxDistance}, {"P_AproxDistance",lib_pAproxDistance},

View file

@ -1,7 +1,7 @@
// SONIC ROBO BLAST 2 // SONIC ROBO BLAST 2
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
// Copyright (C) 2012-2014 by John "JTE" Muniz. // Copyright (C) 2012-2016 by John "JTE" Muniz.
// Copyright (C) 2012-2014 by Sonic Team Junior. // Copyright (C) 2012-2016 by Sonic Team Junior.
// //
// This program is free software distributed under the // This program is free software distributed under the
// terms of the GNU General Public License, version 2. // terms of the GNU General Public License, version 2.

View file

@ -1,7 +1,7 @@
// SONIC ROBO BLAST 2 // SONIC ROBO BLAST 2
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
// Copyright (C) 2012-2014 by John "JTE" Muniz. // Copyright (C) 2012-2016 by John "JTE" Muniz.
// Copyright (C) 2012-2014 by Sonic Team Junior. // Copyright (C) 2012-2016 by Sonic Team Junior.
// //
// This program is free software distributed under the // This program is free software distributed under the
// terms of the GNU General Public License, version 2. // terms of the GNU General Public License, version 2.
@ -41,7 +41,8 @@ enum hook {
hook_BotAI, hook_BotAI,
hook_LinedefExecute, hook_LinedefExecute,
hook_PlayerMsg, hook_PlayerMsg,
hook_DeathMsg, hook_HurtMsg,
hook_PlayerSpawn,
hook_MAX // last hook hook_MAX // last hook
}; };
@ -54,8 +55,9 @@ void LUAh_ThinkFrame(void); // Hook for frame (after mobj and player thinkers)
boolean LUAh_MobjHook(mobj_t *mo, enum hook which); boolean LUAh_MobjHook(mobj_t *mo, enum hook which);
boolean LUAh_PlayerHook(player_t *plr, enum hook which); boolean LUAh_PlayerHook(player_t *plr, enum hook which);
#define LUAh_MobjSpawn(mo) LUAh_MobjHook(mo, hook_MobjSpawn) // Hook for P_SpawnMobj by mobj type #define LUAh_MobjSpawn(mo) LUAh_MobjHook(mo, hook_MobjSpawn) // Hook for P_SpawnMobj by mobj type
UINT8 LUAh_MobjCollide(mobj_t *thing1, mobj_t *thing2); // Hook for PIT_CheckThing by (thing) mobj type UINT8 LUAh_MobjCollideHook(mobj_t *thing1, mobj_t *thing2, enum hook which);
UINT8 LUAh_MobjMoveCollide(mobj_t *thing1, mobj_t *thing2); // Hook for PIT_CheckThing by (tmthing) mobj type #define LUAh_MobjCollide(thing1, thing2) LUAh_MobjCollideHook(thing1, thing2, hook_MobjCollide) // Hook for PIT_CheckThing by (thing) mobj type
#define LUAh_MobjMoveCollide(thing1, thing2) LUAh_MobjCollideHook(thing1, thing2, hook_MobjMoveCollide) // Hook for PIT_CheckThing by (tmthing) mobj type
boolean LUAh_TouchSpecial(mobj_t *special, mobj_t *toucher); // Hook for P_TouchSpecialThing by mobj type boolean LUAh_TouchSpecial(mobj_t *special, mobj_t *toucher); // Hook for P_TouchSpecialThing by mobj type
#define LUAh_MobjFuse(mo) LUAh_MobjHook(mo, hook_MobjFuse) // Hook for mobj->fuse == 0 by mobj type #define LUAh_MobjFuse(mo) LUAh_MobjHook(mo, hook_MobjFuse) // Hook for mobj->fuse == 0 by mobj type
#define LUAh_MobjThinker(mo) LUAh_MobjHook(mo, hook_MobjThinker) // Hook for P_MobjThinker or P_SceneryThinker by mobj type #define LUAh_MobjThinker(mo) LUAh_MobjHook(mo, hook_MobjThinker) // Hook for P_MobjThinker or P_SceneryThinker by mobj type
@ -73,6 +75,7 @@ boolean LUAh_BotTiccmd(player_t *bot, ticcmd_t *cmd); // Hook for B_BuildTiccmd
boolean LUAh_BotAI(mobj_t *sonic, mobj_t *tails, ticcmd_t *cmd); // Hook for B_BuildTailsTiccmd by skin name boolean LUAh_BotAI(mobj_t *sonic, mobj_t *tails, ticcmd_t *cmd); // Hook for B_BuildTailsTiccmd by skin name
boolean LUAh_LinedefExecute(line_t *line, mobj_t *mo, sector_t *sector); // Hook for linedef executors boolean LUAh_LinedefExecute(line_t *line, mobj_t *mo, sector_t *sector); // Hook for linedef executors
boolean LUAh_PlayerMsg(int source, int target, int flags, char *msg); // Hook for chat messages boolean LUAh_PlayerMsg(int source, int target, int flags, char *msg); // Hook for chat messages
boolean LUAh_DeathMsg(player_t *player, mobj_t *inflictor, mobj_t *source); // Hook for hurt messages boolean LUAh_HurtMsg(player_t *player, mobj_t *inflictor, mobj_t *source); // Hook for hurt messages
#define LUAh_PlayerSpawn(player) LUAh_PlayerHook(player, hook_PlayerSpawn) // Hook for G_SpawnPlayer
#endif #endif

File diff suppressed because it is too large Load diff

View file

@ -1,7 +1,7 @@
// SONIC ROBO BLAST 2 // SONIC ROBO BLAST 2
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
// Copyright (C) 2014 by John "JTE" Muniz. // Copyright (C) 2014-2016 by John "JTE" Muniz.
// Copyright (C) 2014 by Sonic Team Junior. // Copyright (C) 2014-2016 by Sonic Team Junior.
// //
// This program is free software distributed under the // This program is free software distributed under the
// terms of the GNU General Public License, version 2. // terms of the GNU General Public License, version 2.

View file

@ -1,7 +1,7 @@
// SONIC ROBO BLAST 2 // SONIC ROBO BLAST 2
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
// Copyright (C) 2014 by John "JTE" Muniz. // Copyright (C) 2014-2016 by John "JTE" Muniz.
// Copyright (C) 2014 by Sonic Team Junior. // Copyright (C) 2014-2016 by Sonic Team Junior.
// //
// This program is free software distributed under the // This program is free software distributed under the
// terms of the GNU General Public License, version 2. // terms of the GNU General Public License, version 2.
@ -16,7 +16,9 @@
#include "r_local.h" #include "r_local.h"
#include "st_stuff.h" // hudinfo[] #include "st_stuff.h" // hudinfo[]
#include "g_game.h" #include "g_game.h"
#include "i_video.h" // rendermode
#include "p_local.h" // camera_t #include "p_local.h" // camera_t
#include "screen.h" // screen width/height
#include "v_video.h" #include "v_video.h"
#include "w_wad.h" #include "w_wad.h"
#include "z_zone.h" #include "z_zone.h"
@ -126,8 +128,6 @@ static const char *const widtht_opt[] = {
enum cameraf { enum cameraf {
camera_chase = 0, camera_chase = 0,
camera_aiming, camera_aiming,
camera_viewheight,
camera_startangle,
camera_x, camera_x,
camera_y, camera_y,
camera_z, camera_z,
@ -137,7 +137,6 @@ enum cameraf {
camera_ceilingz, camera_ceilingz,
camera_radius, camera_radius,
camera_height, camera_height,
camera_relativex,
camera_momx, camera_momx,
camera_momy, camera_momy,
camera_momz camera_momz
@ -147,8 +146,6 @@ enum cameraf {
static const char *const camera_opt[] = { static const char *const camera_opt[] = {
"chase", "chase",
"aiming", "aiming",
"viewheight",
"startangle",
"x", "x",
"y", "y",
"z", "z",
@ -158,7 +155,6 @@ static const char *const camera_opt[] = {
"ceilingz", "ceilingz",
"radius", "radius",
"height", "height",
"relativex",
"momx", "momx",
"momy", "momy",
"momz", "momz",
@ -170,6 +166,8 @@ static int lib_getHudInfo(lua_State *L)
lua_remove(L, 1); lua_remove(L, 1);
i = luaL_checkinteger(L, 1); i = luaL_checkinteger(L, 1);
if (i >= NUMHUDITEMS)
return luaL_error(L, "hudinfo[] index %d out of range (0 - %d)", i, NUMHUDITEMS-1);
LUA_PushUserdata(L, &hudinfo[i], META_HUDINFO); LUA_PushUserdata(L, &hudinfo[i], META_HUDINFO);
return 1; return 1;
} }
@ -279,12 +277,6 @@ static int camera_get(lua_State *L)
case camera_aiming: case camera_aiming:
lua_pushinteger(L, cam->aiming); lua_pushinteger(L, cam->aiming);
break; break;
case camera_viewheight:
lua_pushinteger(L, cam->viewheight);
break;
case camera_startangle:
lua_pushinteger(L, cam->startangle);
break;
case camera_x: case camera_x:
lua_pushinteger(L, cam->x); lua_pushinteger(L, cam->x);
break; break;
@ -312,9 +304,6 @@ static int camera_get(lua_State *L)
case camera_height: case camera_height:
lua_pushinteger(L, cam->height); lua_pushinteger(L, cam->height);
break; break;
case camera_relativex:
lua_pushinteger(L, cam->relativex);
break;
case camera_momx: case camera_momx:
lua_pushinteger(L, cam->momx); lua_pushinteger(L, cam->momx);
break; break;
@ -501,14 +490,14 @@ static int libd_getColormap(lua_State *L)
INT32 skinnum = TC_DEFAULT; INT32 skinnum = TC_DEFAULT;
skincolors_t color = luaL_optinteger(L, 2, 0); skincolors_t color = luaL_optinteger(L, 2, 0);
UINT8* colormap = NULL; UINT8* colormap = NULL;
//HUDSAFE HUDONLY
if (lua_isnoneornil(L, 1)) if (lua_isnoneornil(L, 1))
; // defaults to TC_DEFAULT ; // defaults to TC_DEFAULT
else if (lua_type(L, 1) == LUA_TNUMBER) // skin number else if (lua_type(L, 1) == LUA_TNUMBER) // skin number
{ {
skinnum = (INT32)luaL_checkinteger(L, 1); skinnum = (INT32)luaL_checkinteger(L, 1);
if (skinnum < TC_ALLWHITE || skinnum >= MAXSKINS) if (skinnum < TC_ALLWHITE || skinnum >= MAXSKINS)
return luaL_error(L, "argument #1 is out of range"); return luaL_error(L, "skin number %d is out of range (%d - %d)", skinnum, TC_ALLWHITE, MAXSKINS-1);
} }
else // skin name else // skin name
{ {
@ -525,6 +514,47 @@ static int libd_getColormap(lua_State *L)
return 1; return 1;
} }
static int libd_width(lua_State *L)
{
HUDONLY
lua_pushinteger(L, vid.width); // push screen width
return 1;
}
static int libd_height(lua_State *L)
{
HUDONLY
lua_pushinteger(L, vid.height); // push screen height
return 1;
}
static int libd_dupx(lua_State *L)
{
HUDONLY
lua_pushinteger(L, vid.dupx); // push integral scale (patch scale)
lua_pushfixed(L, vid.fdupx); // push fixed point scale (position scale)
return 2;
}
static int libd_dupy(lua_State *L)
{
HUDONLY
lua_pushinteger(L, vid.dupy); // push integral scale (patch scale)
lua_pushfixed(L, vid.fdupy); // push fixed point scale (position scale)
return 2;
}
static int libd_renderer(lua_State *L)
{
HUDONLY
switch (rendermode) {
case render_opengl: lua_pushliteral(L, "opengl"); break; // OpenGL renderer
case render_soft: lua_pushliteral(L, "software"); break; // Software renderer
default: lua_pushliteral(L, "none"); break; // render_none (for dedicated), in case there's any reason this should be run
}
return 1;
}
static luaL_Reg lib_draw[] = { static luaL_Reg lib_draw[] = {
{"patchExists", libd_patchExists}, {"patchExists", libd_patchExists},
{"cachePatch", libd_cachePatch}, {"cachePatch", libd_cachePatch},
@ -536,6 +566,11 @@ static luaL_Reg lib_draw[] = {
{"drawString", libd_drawString}, {"drawString", libd_drawString},
{"stringWidth", libd_stringWidth}, {"stringWidth", libd_stringWidth},
{"getColormap", libd_getColormap}, {"getColormap", libd_getColormap},
{"width", libd_width},
{"height", libd_height},
{"dupx", libd_dupx},
{"dupy", libd_dupy},
{"renderer", libd_renderer},
{NULL, NULL} {NULL, NULL}
}; };
@ -689,8 +724,6 @@ void LUAh_GameHUD(player_t *stplayr)
LUA_Call(gL, 3); LUA_Call(gL, 3);
} }
lua_pop(gL, -1); lua_pop(gL, -1);
lua_gc(gL, LUA_GCCOLLECT, 0);
hud_running = false; hud_running = false;
} }
@ -716,8 +749,6 @@ void LUAh_ScoresHUD(void)
LUA_Call(gL, 1); LUA_Call(gL, 1);
} }
lua_pop(gL, -1); lua_pop(gL, -1);
lua_gc(gL, LUA_GCCOLLECT, 0);
hud_running = false; hud_running = false;
} }

View file

@ -1,7 +1,7 @@
// SONIC ROBO BLAST 2 // SONIC ROBO BLAST 2
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
// Copyright (C) 2012-2014 by John "JTE" Muniz. // Copyright (C) 2012-2016 by John "JTE" Muniz.
// Copyright (C) 2012-2014 by Sonic Team Junior. // Copyright (C) 2012-2016 by Sonic Team Junior.
// //
// This program is free software distributed under the // This program is free software distributed under the
// terms of the GNU General Public License, version 2. // terms of the GNU General Public License, version 2.
@ -137,8 +137,6 @@ static void A_Lua(mobj_t *actor)
--superstack; --superstack;
superactions[superstack] = NULL; superactions[superstack] = NULL;
} }
lua_gc(gL, LUA_GCSTEP, 1);
} }
// Arbitrary states[] table index -> state_t * // Arbitrary states[] table index -> state_t *
@ -148,6 +146,8 @@ static int lib_getState(lua_State *L)
lua_remove(L, 1); lua_remove(L, 1);
i = luaL_checkinteger(L, 1); i = luaL_checkinteger(L, 1);
if (i >= NUMSTATES)
return luaL_error(L, "states[] index %d out of range (0 - %d)", i, NUMSTATES-1);
LUA_PushUserdata(L, &states[i], META_STATE); LUA_PushUserdata(L, &states[i], META_STATE);
return 1; return 1;
} }
@ -157,7 +157,12 @@ static int lib_setState(lua_State *L)
{ {
state_t *state; state_t *state;
lua_remove(L, 1); // don't care about states[] userdata. lua_remove(L, 1); // don't care about states[] userdata.
state = &states[luaL_checkinteger(L, 1)]; // get the state to assign to. {
UINT32 i = luaL_checkinteger(L, 1);
if (i >= NUMSTATES)
return luaL_error(L, "states[] index %d out of range (0 - %d)", i, NUMSTATES-1);
state = &states[i]; // get the state to assign to.
}
luaL_checktype(L, 2, LUA_TTABLE); // check that we've been passed a table. luaL_checktype(L, 2, LUA_TTABLE); // check that we've been passed a table.
lua_remove(L, 1); // pop state num, don't need it any more. lua_remove(L, 1); // pop state num, don't need it any more.
lua_settop(L, 1); // cut the stack here. the only thing left now is the table of data we're assigning to the state. lua_settop(L, 1); // cut the stack here. the only thing left now is the table of data we're assigning to the state.
@ -438,6 +443,8 @@ static int lib_getMobjInfo(lua_State *L)
lua_remove(L, 1); lua_remove(L, 1);
i = luaL_checkinteger(L, 1); i = luaL_checkinteger(L, 1);
if (i >= NUMMOBJTYPES)
return luaL_error(L, "mobjinfo[] index %d out of range (0 - %d)", i, NUMMOBJTYPES-1);
LUA_PushUserdata(L, &mobjinfo[i], META_MOBJINFO); LUA_PushUserdata(L, &mobjinfo[i], META_MOBJINFO);
return 1; return 1;
} }
@ -447,7 +454,12 @@ static int lib_setMobjInfo(lua_State *L)
{ {
mobjinfo_t *info; mobjinfo_t *info;
lua_remove(L, 1); // don't care about mobjinfo[] userdata. lua_remove(L, 1); // don't care about mobjinfo[] userdata.
info = &mobjinfo[luaL_checkinteger(L, 1)]; // get the mobjinfo to assign to. {
UINT32 i = luaL_checkinteger(L, 1);
if (i >= NUMMOBJTYPES)
return luaL_error(L, "mobjinfo[] index %d out of range (0 - %d)", i, NUMMOBJTYPES-1);
info = &mobjinfo[i]; // get the mobjinfo to assign to.
}
luaL_checktype(L, 2, LUA_TTABLE); // check that we've been passed a table. luaL_checktype(L, 2, LUA_TTABLE); // check that we've been passed a table.
lua_remove(L, 1); // pop mobjtype num, don't need it any more. lua_remove(L, 1); // pop mobjtype num, don't need it any more.
lua_settop(L, 1); // cut the stack here. the only thing left now is the table of data we're assigning to the mobjinfo. lua_settop(L, 1); // cut the stack here. the only thing left now is the table of data we're assigning to the mobjinfo.
@ -510,11 +522,11 @@ static int lib_setMobjInfo(lua_State *L)
else if (i == 15 || (str && fastcmp(str,"deathsound"))) else if (i == 15 || (str && fastcmp(str,"deathsound")))
info->deathsound = luaL_checkinteger(L, 3); info->deathsound = luaL_checkinteger(L, 3);
else if (i == 16 || (str && fastcmp(str,"speed"))) else if (i == 16 || (str && fastcmp(str,"speed")))
info->speed = (fixed_t)luaL_checkinteger(L, 3); info->speed = luaL_checkfixed(L, 3);
else if (i == 17 || (str && fastcmp(str,"radius"))) else if (i == 17 || (str && fastcmp(str,"radius")))
info->radius = (fixed_t)luaL_checkinteger(L, 3); info->radius = luaL_checkfixed(L, 3);
else if (i == 18 || (str && fastcmp(str,"height"))) else if (i == 18 || (str && fastcmp(str,"height")))
info->height = (fixed_t)luaL_checkinteger(L, 3); info->height = luaL_checkfixed(L, 3);
else if (i == 19 || (str && fastcmp(str,"dispoffset"))) else if (i == 19 || (str && fastcmp(str,"dispoffset")))
info->dispoffset = (INT32)luaL_checkinteger(L, 3); info->dispoffset = (INT32)luaL_checkinteger(L, 3);
else if (i == 20 || (str && fastcmp(str,"mass"))) else if (i == 20 || (str && fastcmp(str,"mass")))
@ -580,11 +592,11 @@ static int mobjinfo_get(lua_State *L)
else if (fastcmp(field,"deathsound")) else if (fastcmp(field,"deathsound"))
lua_pushinteger(L, info->deathsound); lua_pushinteger(L, info->deathsound);
else if (fastcmp(field,"speed")) else if (fastcmp(field,"speed"))
lua_pushinteger(L, info->speed); lua_pushinteger(L, info->speed); // sometimes it's fixed_t, sometimes it's not...
else if (fastcmp(field,"radius")) else if (fastcmp(field,"radius"))
lua_pushinteger(L, info->radius); lua_pushfixed(L, info->radius);
else if (fastcmp(field,"height")) else if (fastcmp(field,"height"))
lua_pushinteger(L, info->height); lua_pushfixed(L, info->height);
else if (fastcmp(field,"dispoffset")) else if (fastcmp(field,"dispoffset"))
lua_pushinteger(L, info->dispoffset); lua_pushinteger(L, info->dispoffset);
else if (fastcmp(field,"mass")) else if (fastcmp(field,"mass"))
@ -656,11 +668,11 @@ static int mobjinfo_set(lua_State *L)
else if (fastcmp(field,"deathsound")) else if (fastcmp(field,"deathsound"))
info->deathsound = luaL_checkinteger(L, 3); info->deathsound = luaL_checkinteger(L, 3);
else if (fastcmp(field,"speed")) else if (fastcmp(field,"speed"))
info->speed = (fixed_t)luaL_checkinteger(L, 3); info->speed = luaL_checkfixed(L, 3);
else if (fastcmp(field,"radius")) else if (fastcmp(field,"radius"))
info->radius = (fixed_t)luaL_checkinteger(L, 3); info->radius = luaL_checkfixed(L, 3);
else if (fastcmp(field,"height")) else if (fastcmp(field,"height"))
info->height = (fixed_t)luaL_checkinteger(L, 3); info->height = luaL_checkfixed(L, 3);
else if (fastcmp(field,"dispoffset")) else if (fastcmp(field,"dispoffset"))
info->dispoffset = (INT32)luaL_checkinteger(L, 3); info->dispoffset = (INT32)luaL_checkinteger(L, 3);
else if (fastcmp(field,"mass")) else if (fastcmp(field,"mass"))
@ -719,6 +731,8 @@ static int lib_getSfxInfo(lua_State *L)
lua_remove(L, 1); lua_remove(L, 1);
i = luaL_checkinteger(L, 1); i = luaL_checkinteger(L, 1);
if (i >= NUMSFX)
return luaL_error(L, "sfxinfo[] index %d out of range (0 - %d)", i, NUMSFX-1);
LUA_PushUserdata(L, &S_sfx[i], META_SFXINFO); LUA_PushUserdata(L, &S_sfx[i], META_SFXINFO);
return 1; return 1;
} }
@ -729,7 +743,12 @@ static int lib_setSfxInfo(lua_State *L)
sfxinfo_t *info; sfxinfo_t *info;
lua_remove(L, 1); lua_remove(L, 1);
info = &S_sfx[luaL_checkinteger(L, 1)]; // get the mobjinfo to assign to. {
UINT32 i = luaL_checkinteger(L, 1);
if (i >= NUMSFX)
return luaL_error(L, "sfxinfo[] index %d out of range (0 - %d)", i, NUMSFX-1);
info = &S_sfx[i]; // get the mobjinfo to assign to.
}
luaL_checktype(L, 2, LUA_TTABLE); // check that we've been passed a table. luaL_checktype(L, 2, LUA_TTABLE); // check that we've been passed a table.
lua_remove(L, 1); // pop mobjtype num, don't need it any more. lua_remove(L, 1); // pop mobjtype num, don't need it any more.
lua_settop(L, 1); // cut the stack here. the only thing left now is the table of data we're assigning to the mobjinfo. lua_settop(L, 1); // cut the stack here. the only thing left now is the table of data we're assigning to the mobjinfo.

View file

@ -1,7 +1,7 @@
// SONIC ROBO BLAST 2 // SONIC ROBO BLAST 2
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
// Copyright (C) 2012-2014 by John "JTE" Muniz. // Copyright (C) 2012-2016 by John "JTE" Muniz.
// Copyright (C) 2012-2014 by Sonic Team Junior. // Copyright (C) 2012-2016 by Sonic Team Junior.
// //
// This program is free software distributed under the // This program is free software distributed under the
// terms of the GNU General Public License, version 2. // terms of the GNU General Public License, version 2.
@ -42,6 +42,7 @@ extern lua_State *gL;
#define META_CVAR "CONSVAR_T*" #define META_CVAR "CONSVAR_T*"
#define META_SECTORLINES "SECTOR_T*LINES"
#define META_SIDENUM "LINE_T*SIDENUM" #define META_SIDENUM "LINE_T*SIDENUM"
#define META_HUDINFO "HUDINFO_T*" #define META_HUDINFO "HUDINFO_T*"

View file

@ -1,7 +1,7 @@
// SONIC ROBO BLAST 2 // SONIC ROBO BLAST 2
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
// Copyright (C) 2012-2014 by John "JTE" Muniz. // Copyright (C) 2012-2016 by John "JTE" Muniz.
// Copyright (C) 2012-2014 by Sonic Team Junior. // Copyright (C) 2012-2016 by Sonic Team Junior.
// //
// This program is free software distributed under the // This program is free software distributed under the
// terms of the GNU General Public License, version 2. // terms of the GNU General Public License, version 2.
@ -37,6 +37,7 @@ enum sector_e {
sector_thinglist, sector_thinglist,
sector_heightsec, sector_heightsec,
sector_camsec, sector_camsec,
sector_lines,
sector_ffloors sector_ffloors
}; };
@ -52,6 +53,7 @@ static const char *const sector_opt[] = {
"thinglist", "thinglist",
"heightsec", "heightsec",
"camsec", "camsec",
"lines",
"ffloors", "ffloors",
NULL}; NULL};
@ -60,7 +62,6 @@ enum subsector_e {
subsector_sector, subsector_sector,
subsector_numlines, subsector_numlines,
subsector_firstline, subsector_firstline,
subsector_validcount
}; };
static const char *const subsector_opt[] = { static const char *const subsector_opt[] = {
@ -68,7 +69,6 @@ static const char *const subsector_opt[] = {
"sector", "sector",
"numlines", "numlines",
"firstline", "firstline",
"validcount",
NULL}; NULL};
enum line_e { enum line_e {
@ -86,7 +86,6 @@ enum line_e {
line_slopetype, line_slopetype,
line_frontsector, line_frontsector,
line_backsector, line_backsector,
line_validcount,
line_firsttag, line_firsttag,
line_nexttag, line_nexttag,
line_text, line_text,
@ -108,7 +107,6 @@ static const char *const line_opt[] = {
"slopetype", "slopetype",
"frontsector", "frontsector",
"backsector", "backsector",
"validcount",
"firsttag", "firsttag",
"nexttag", "nexttag",
"text", "text",
@ -264,6 +262,67 @@ static int sector_iterate(lua_State *L)
return 3; return 3;
} }
// sector.lines, i -> sector.lines[i]
// sector.lines.valid, for validity checking
static int sectorlines_get(lua_State *L)
{
line_t **seclines = *((line_t ***)luaL_checkudata(L, 1, META_SECTORLINES));
size_t i;
size_t numoflines = 0;
lua_settop(L, 2);
if (!lua_isnumber(L, 2))
{
int field = luaL_checkoption(L, 2, NULL, valid_opt);
if (!seclines)
{
if (field == 0) {
lua_pushboolean(L, 0);
return 1;
}
return luaL_error(L, "accessed sector_t doesn't exist anymore.");
} else if (field == 0) {
lua_pushboolean(L, 1);
return 1;
}
}
// check first linedef to figure which of its sectors owns this sector->lines pointer
// then check that sector's linecount to get a maximum index
//if (!seclines[0])
//return luaL_error(L, "no lines found!"); // no first linedef?????
if (seclines[0]->frontsector->lines == seclines)
numoflines = seclines[0]->frontsector->linecount;
else if (seclines[0]->backsector && seclines[0]->backsector->lines == seclines) // check backsector exists first
numoflines = seclines[0]->backsector->linecount;
//if neither sector has it then ???
if (!numoflines)
return luaL_error(L, "no lines found!");
i = (size_t)lua_tointeger(L, 2);
if (i >= numoflines)
return 0;
LUA_PushUserdata(L, seclines[i], META_LINE);
return 1;
}
static int sectorlines_num(lua_State *L)
{
line_t **seclines = *((line_t ***)luaL_checkudata(L, 1, META_SECTORLINES));
size_t numoflines = 0;
// check first linedef to figure which of its sectors owns this sector->lines pointer
// then check that sector's linecount to get a maximum index
//if (!seclines[0])
//return luaL_error(L, "no lines found!"); // no first linedef?????
if (seclines[0]->frontsector->lines == seclines)
numoflines = seclines[0]->frontsector->linecount;
else if (seclines[0]->backsector && seclines[0]->backsector->lines == seclines) // check backsector exists first
numoflines = seclines[0]->backsector->linecount;
//if neither sector has it then ???
lua_pushinteger(L, numoflines);
return 1;
}
static int sector_get(lua_State *L) static int sector_get(lua_State *L)
{ {
sector_t *sector = *((sector_t **)luaL_checkudata(L, 1, META_SECTOR)); sector_t *sector = *((sector_t **)luaL_checkudata(L, 1, META_SECTOR));
@ -284,10 +343,10 @@ static int sector_get(lua_State *L)
lua_pushboolean(L, 1); lua_pushboolean(L, 1);
return 1; return 1;
case sector_floorheight: case sector_floorheight:
lua_pushinteger(L, sector->floorheight); lua_pushfixed(L, sector->floorheight);
return 1; return 1;
case sector_ceilingheight: case sector_ceilingheight:
lua_pushinteger(L, sector->ceilingheight); lua_pushfixed(L, sector->ceilingheight);
return 1; return 1;
case sector_floorpic: { // floorpic case sector_floorpic: { // floorpic
levelflat_t *levelflat; levelflat_t *levelflat;
@ -329,6 +388,9 @@ static int sector_get(lua_State *L)
return 0; return 0;
LUA_PushUserdata(L, &sectors[sector->camsec], META_SECTOR); LUA_PushUserdata(L, &sectors[sector->camsec], META_SECTOR);
return 1; return 1;
case sector_lines: // lines
LUA_PushUserdata(L, sector->lines, META_SECTORLINES);
return 1;
case sector_ffloors: // ffloors case sector_ffloors: // ffloors
lua_pushcfunction(L, lib_iterateSectorFFloors); lua_pushcfunction(L, lib_iterateSectorFFloors);
LUA_PushUserdata(L, sector->ffloors, META_FFLOOR); LUA_PushUserdata(L, sector->ffloors, META_FFLOOR);
@ -400,26 +462,30 @@ static int sector_set(lua_State *L)
return luaL_error(L, "sector_t field " LUA_QS " cannot be set.", sector_opt[field]); return luaL_error(L, "sector_t field " LUA_QS " cannot be set.", sector_opt[field]);
case sector_floorheight: { // floorheight case sector_floorheight: { // floorheight
boolean flag; boolean flag;
mobj_t *ptmthing = tmthing;
fixed_t lastpos = sector->floorheight; fixed_t lastpos = sector->floorheight;
sector->floorheight = (fixed_t)luaL_checkinteger(L, 3); sector->floorheight = luaL_checkfixed(L, 3);
flag = P_CheckSector(sector, true); flag = P_CheckSector(sector, true);
if (flag && sector->numattached) if (flag && sector->numattached)
{ {
sector->floorheight = lastpos; sector->floorheight = lastpos;
P_CheckSector(sector, true); P_CheckSector(sector, true);
} }
P_SetTarget(&tmthing, ptmthing);
break; break;
} }
case sector_ceilingheight: { // ceilingheight case sector_ceilingheight: { // ceilingheight
boolean flag; boolean flag;
mobj_t *ptmthing = tmthing;
fixed_t lastpos = sector->ceilingheight; fixed_t lastpos = sector->ceilingheight;
sector->ceilingheight = (fixed_t)luaL_checkinteger(L, 3); sector->ceilingheight = luaL_checkfixed(L, 3);
flag = P_CheckSector(sector, true); flag = P_CheckSector(sector, true);
if (flag && sector->numattached) if (flag && sector->numattached)
{ {
sector->ceilingheight = lastpos; sector->ceilingheight = lastpos;
P_CheckSector(sector, true); P_CheckSector(sector, true);
} }
P_SetTarget(&tmthing, ptmthing);
break; break;
} }
case sector_floorpic: case sector_floorpic:
@ -476,9 +542,6 @@ static int subsector_get(lua_State *L)
case subsector_firstline: case subsector_firstline:
lua_pushinteger(L, subsector->firstline); lua_pushinteger(L, subsector->firstline);
return 1; return 1;
case subsector_validcount:
lua_pushinteger(L, subsector->validcount);
return 1;
} }
return 0; return 0;
} }
@ -516,10 +579,10 @@ static int line_get(lua_State *L)
LUA_PushUserdata(L, line->v2, META_VERTEX); LUA_PushUserdata(L, line->v2, META_VERTEX);
return 1; return 1;
case line_dx: case line_dx:
lua_pushinteger(L, line->dx); lua_pushfixed(L, line->dx);
return 1; return 1;
case line_dy: case line_dy:
lua_pushinteger(L, line->dy); lua_pushfixed(L, line->dy);
return 1; return 1;
case line_flags: case line_flags:
lua_pushinteger(L, line->flags); lua_pushinteger(L, line->flags);
@ -564,9 +627,6 @@ static int line_get(lua_State *L)
case line_backsector: case line_backsector:
LUA_PushUserdata(L, line->backsector, META_SECTOR); LUA_PushUserdata(L, line->backsector, META_SECTOR);
return 1; return 1;
case line_validcount:
lua_pushinteger(L, line->validcount);
return 1;
case line_firsttag: case line_firsttag:
lua_pushinteger(L, line->firsttag); lua_pushinteger(L, line->firsttag);
return 1; return 1;
@ -638,10 +698,10 @@ static int side_get(lua_State *L)
lua_pushboolean(L, 1); lua_pushboolean(L, 1);
return 1; return 1;
case side_textureoffset: case side_textureoffset:
lua_pushinteger(L, side->textureoffset); lua_pushfixed(L, side->textureoffset);
return 1; return 1;
case side_rowoffset: case side_rowoffset:
lua_pushinteger(L, side->rowoffset); lua_pushfixed(L, side->rowoffset);
return 1; return 1;
case side_toptexture: case side_toptexture:
lua_pushinteger(L, side->toptexture); lua_pushinteger(L, side->toptexture);
@ -668,6 +728,50 @@ static int side_get(lua_State *L)
return 0; return 0;
} }
static int side_set(lua_State *L)
{
side_t *side = *((side_t **)luaL_checkudata(L, 1, META_SIDE));
enum side_e field = luaL_checkoption(L, 2, side_opt[0], side_opt);
if (!side)
{
if (field == side_valid) {
lua_pushboolean(L, 0);
return 1;
}
return luaL_error(L, "accessed side_t doesn't exist anymore.");
}
switch(field)
{
case side_valid: // valid
case side_sector:
case side_special:
case side_text:
default:
return luaL_error(L, "side_t field " LUA_QS " cannot be set.", side_opt[field]);
case side_textureoffset:
side->textureoffset = luaL_checkfixed(L, 3);
break;
case side_rowoffset:
side->rowoffset = luaL_checkfixed(L, 3);
break;
case side_toptexture:
side->toptexture = luaL_checkinteger(L, 3);
break;
case side_bottomtexture:
side->bottomtexture = luaL_checkinteger(L, 3);
break;
case side_midtexture:
side->midtexture = luaL_checkinteger(L, 3);
break;
case side_repeatcnt:
side->repeatcnt = luaL_checkinteger(L, 3);
break;
}
return 0;
}
static int side_num(lua_State *L) static int side_num(lua_State *L)
{ {
side_t *side = *((side_t **)luaL_checkudata(L, 1, META_SIDE)); side_t *side = *((side_t **)luaL_checkudata(L, 1, META_SIDE));
@ -695,13 +799,13 @@ static int vertex_get(lua_State *L)
lua_pushboolean(L, 1); lua_pushboolean(L, 1);
return 1; return 1;
case vertex_x: case vertex_x:
lua_pushinteger(L, vertex->x); lua_pushfixed(L, vertex->x);
return 1; return 1;
case vertex_y: case vertex_y:
lua_pushinteger(L, vertex->y); lua_pushfixed(L, vertex->y);
return 1; return 1;
case vertex_z: case vertex_z:
lua_pushinteger(L, vertex->z); lua_pushfixed(L, vertex->z);
return 1; return 1;
} }
return 0; return 0;
@ -964,7 +1068,7 @@ static int ffloor_get(lua_State *L)
lua_pushboolean(L, 1); lua_pushboolean(L, 1);
return 1; return 1;
case ffloor_topheight: case ffloor_topheight:
lua_pushinteger(L, *ffloor->topheight); lua_pushfixed(L, *ffloor->topheight);
return 1; return 1;
case ffloor_toppic: { // toppic case ffloor_toppic: { // toppic
levelflat_t *levelflat; levelflat_t *levelflat;
@ -978,7 +1082,7 @@ static int ffloor_get(lua_State *L)
lua_pushinteger(L, *ffloor->toplightlevel); lua_pushinteger(L, *ffloor->toplightlevel);
return 1; return 1;
case ffloor_bottomheight: case ffloor_bottomheight:
lua_pushinteger(L, *ffloor->bottomheight); lua_pushfixed(L, *ffloor->bottomheight);
return 1; return 1;
case ffloor_bottompic: { // bottompic case ffloor_bottompic: { // bottompic
levelflat_t *levelflat; levelflat_t *levelflat;
@ -1037,14 +1141,16 @@ static int ffloor_set(lua_State *L)
case ffloor_topheight: { // topheight case ffloor_topheight: { // topheight
boolean flag; boolean flag;
fixed_t lastpos = *ffloor->topheight; fixed_t lastpos = *ffloor->topheight;
mobj_t *ptmthing = tmthing;
sector_t *sector = &sectors[ffloor->secnum]; sector_t *sector = &sectors[ffloor->secnum];
sector->ceilingheight = (fixed_t)luaL_checkinteger(L, 3); sector->ceilingheight = luaL_checkfixed(L, 3);
flag = P_CheckSector(sector, true); flag = P_CheckSector(sector, true);
if (flag && sector->numattached) if (flag && sector->numattached)
{ {
*ffloor->topheight = lastpos; *ffloor->topheight = lastpos;
P_CheckSector(sector, true); P_CheckSector(sector, true);
} }
P_SetTarget(&tmthing, ptmthing);
break; break;
} }
case ffloor_toppic: case ffloor_toppic:
@ -1056,22 +1162,28 @@ static int ffloor_set(lua_State *L)
case ffloor_bottomheight: { // bottomheight case ffloor_bottomheight: { // bottomheight
boolean flag; boolean flag;
fixed_t lastpos = *ffloor->bottomheight; fixed_t lastpos = *ffloor->bottomheight;
mobj_t *ptmthing = tmthing;
sector_t *sector = &sectors[ffloor->secnum]; sector_t *sector = &sectors[ffloor->secnum];
sector->floorheight = (fixed_t)luaL_checkinteger(L, 3); sector->floorheight = luaL_checkfixed(L, 3);
flag = P_CheckSector(sector, true); flag = P_CheckSector(sector, true);
if (flag && sector->numattached) if (flag && sector->numattached)
{ {
*ffloor->bottomheight = lastpos; *ffloor->bottomheight = lastpos;
P_CheckSector(sector, true); P_CheckSector(sector, true);
} }
P_SetTarget(&tmthing, ptmthing);
break; break;
} }
case ffloor_bottompic: case ffloor_bottompic:
*ffloor->bottompic = P_AddLevelFlatRuntime(luaL_checkstring(L, 3)); *ffloor->bottompic = P_AddLevelFlatRuntime(luaL_checkstring(L, 3));
break; break;
case ffloor_flags: case ffloor_flags: {
ffloortype_e oldflags = ffloor->flags; // store FOF's old flags
ffloor->flags = luaL_checkinteger(L, 3); ffloor->flags = luaL_checkinteger(L, 3);
if (ffloor->flags != oldflags)
ffloor->target->moved = true; // reset target sector's lightlist
break; break;
}
case ffloor_alpha: case ffloor_alpha:
ffloor->alpha = (INT32)luaL_checkinteger(L, 3); ffloor->alpha = (INT32)luaL_checkinteger(L, 3);
break; break;
@ -1115,26 +1227,23 @@ static int mapheaderinfo_get(lua_State *L)
{ {
mapheader_t *header = *((mapheader_t **)luaL_checkudata(L, 1, META_MAPHEADER)); mapheader_t *header = *((mapheader_t **)luaL_checkudata(L, 1, META_MAPHEADER));
const char *field = luaL_checkstring(L, 2); const char *field = luaL_checkstring(L, 2);
//INT16 i; INT16 i;
if (fastcmp(field,"lvlttl")) { if (fastcmp(field,"lvlttl"))
//for (i = 0; i < 21; i++) lua_pushstring(L, header->lvlttl);
// if (!header->lvlttl[i]) else if (fastcmp(field,"subttl"))
// break; lua_pushstring(L, header->subttl);
lua_pushlstring(L, header->lvlttl, 21);
} else if (fastcmp(field,"subttl"))
lua_pushlstring(L, header->subttl, 32);
else if (fastcmp(field,"actnum")) else if (fastcmp(field,"actnum"))
lua_pushinteger(L, header->actnum); lua_pushinteger(L, header->actnum);
else if (fastcmp(field,"typeoflevel")) else if (fastcmp(field,"typeoflevel"))
lua_pushinteger(L, header->typeoflevel); lua_pushinteger(L, header->typeoflevel);
else if (fastcmp(field,"nextlevel")) else if (fastcmp(field,"nextlevel"))
lua_pushinteger(L, header->nextlevel); lua_pushinteger(L, header->nextlevel);
else if (fastcmp(field,"musicslot")) else if (fastcmp(field,"musname"))
lua_pushinteger(L, header->musicslot); lua_pushstring(L, header->musname);
else if (fastcmp(field,"musicslottrack")) else if (fastcmp(field,"mustrack"))
lua_pushinteger(L, header->musicslottrack); lua_pushinteger(L, header->mustrack);
else if (fastcmp(field,"forcecharacter")) else if (fastcmp(field,"forcecharacter"))
lua_pushlstring(L, header->forcecharacter, 16); lua_pushstring(L, header->forcecharacter);
else if (fastcmp(field,"weather")) else if (fastcmp(field,"weather"))
lua_pushinteger(L, header->weather); lua_pushinteger(L, header->weather);
else if (fastcmp(field,"skynum")) else if (fastcmp(field,"skynum"))
@ -1145,12 +1254,15 @@ static int mapheaderinfo_get(lua_State *L)
lua_pushinteger(L, header->skybox_scaley); lua_pushinteger(L, header->skybox_scaley);
else if (fastcmp(field,"skybox_scalez")) else if (fastcmp(field,"skybox_scalez"))
lua_pushinteger(L, header->skybox_scalez); lua_pushinteger(L, header->skybox_scalez);
else if (fastcmp(field,"interscreen")) else if (fastcmp(field,"interscreen")) {
lua_pushlstring(L, header->interscreen, 8); for (i = 0; i < 8; i++)
else if (fastcmp(field,"runsoc")) if (!header->interscreen[i])
lua_pushlstring(L, header->runsoc, 32); break;
lua_pushlstring(L, header->interscreen, i);
} else if (fastcmp(field,"runsoc"))
lua_pushstring(L, header->runsoc);
else if (fastcmp(field,"scriptname")) else if (fastcmp(field,"scriptname"))
lua_pushlstring(L, header->scriptname, 32); lua_pushstring(L, header->scriptname);
else if (fastcmp(field,"precutscenenum")) else if (fastcmp(field,"precutscenenum"))
lua_pushinteger(L, header->precutscenenum); lua_pushinteger(L, header->precutscenenum);
else if (fastcmp(field,"cutscenenum")) else if (fastcmp(field,"cutscenenum"))
@ -1175,11 +1287,11 @@ static int mapheaderinfo_get(lua_State *L)
else { else {
// Read custom vars now // Read custom vars now
// (note: don't include the "LUA." in your lua scripts!) // (note: don't include the "LUA." in your lua scripts!)
UINT8 i = 0; UINT8 j = 0;
for (;i < header->numCustomOptions && !fastcmp(field, header->customopts[i].option); ++i); for (;j < header->numCustomOptions && !fastcmp(field, header->customopts[j].option); ++j);
if(i < header->numCustomOptions) if(j < header->numCustomOptions)
lua_pushlstring(L, header->customopts[i].value, 255); lua_pushstring(L, header->customopts[j].value);
else else
lua_pushnil(L); lua_pushnil(L);
} }
@ -1188,6 +1300,14 @@ static int mapheaderinfo_get(lua_State *L)
int LUA_MapLib(lua_State *L) int LUA_MapLib(lua_State *L)
{ {
luaL_newmetatable(L, META_SECTORLINES);
lua_pushcfunction(L, sectorlines_get);
lua_setfield(L, -2, "__index");
lua_pushcfunction(L, sectorlines_num);
lua_setfield(L, -2, "__len");
lua_pop(L, 1);
luaL_newmetatable(L, META_SECTOR); luaL_newmetatable(L, META_SECTOR);
lua_pushcfunction(L, sector_get); lua_pushcfunction(L, sector_get);
lua_setfield(L, -2, "__index"); lua_setfield(L, -2, "__index");
@ -1224,6 +1344,9 @@ int LUA_MapLib(lua_State *L)
lua_pushcfunction(L, side_get); lua_pushcfunction(L, side_get);
lua_setfield(L, -2, "__index"); lua_setfield(L, -2, "__index");
lua_pushcfunction(L, side_set);
lua_setfield(L, -2, "__newindex");
lua_pushcfunction(L, side_num); lua_pushcfunction(L, side_num);
lua_setfield(L, -2, "__len"); lua_setfield(L, -2, "__len");
lua_pop(L, 1); lua_pop(L, 1);

View file

@ -1,7 +1,7 @@
// SONIC ROBO BLAST 2 // SONIC ROBO BLAST 2
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
// Copyright (C) 2012-2014 by John "JTE" Muniz. // Copyright (C) 2012-2016 by John "JTE" Muniz.
// Copyright (C) 2012-2014 by Sonic Team Junior. // Copyright (C) 2012-2016 by Sonic Team Junior.
// //
// This program is free software distributed under the // This program is free software distributed under the
// terms of the GNU General Public License, version 2. // terms of the GNU General Public License, version 2.
@ -32,13 +32,17 @@ static int lib_abs(lua_State *L)
static int lib_min(lua_State *L) static int lib_min(lua_State *L)
{ {
lua_pushinteger(L, min(luaL_checkinteger(L, 1), luaL_checkinteger(L, 2))); int a = luaL_checkinteger(L, 1);
int b = luaL_checkinteger(L, 2);
lua_pushinteger(L, min(a,b));
return 1; return 1;
} }
static int lib_max(lua_State *L) static int lib_max(lua_State *L)
{ {
lua_pushinteger(L, max(luaL_checkinteger(L, 1), luaL_checkinteger(L, 2))); int a = luaL_checkinteger(L, 1);
int b = luaL_checkinteger(L, 2);
lua_pushinteger(L, max(a,b));
return 1; return 1;
} }
@ -47,37 +51,50 @@ static int lib_max(lua_State *L)
static int lib_fixedangle(lua_State *L) static int lib_fixedangle(lua_State *L)
{ {
lua_pushinteger(L, FixedAngle((fixed_t)luaL_checkinteger(L, 1))); lua_pushangle(L, FixedAngle(luaL_checkfixed(L, 1)));
return 1; return 1;
} }
static int lib_anglefixed(lua_State *L) static int lib_anglefixed(lua_State *L)
{ {
lua_pushinteger(L, AngleFixed((angle_t)luaL_checkinteger(L, 1))); lua_pushfixed(L, AngleFixed(luaL_checkangle(L, 1)));
return 1; return 1;
} }
static int lib_invangle(lua_State *L) static int lib_invangle(lua_State *L)
{ {
lua_pushinteger(L, InvAngle((angle_t)luaL_checkinteger(L, 1))); lua_pushangle(L, InvAngle(luaL_checkangle(L, 1)));
return 1; return 1;
} }
static int lib_finesine(lua_State *L) static int lib_finesine(lua_State *L)
{ {
lua_pushinteger(L, FINESINE((luaL_checkinteger(L, 1)>>ANGLETOFINESHIFT) & FINEMASK)); lua_pushfixed(L, FINESINE((luaL_checkangle(L, 1)>>ANGLETOFINESHIFT) & FINEMASK));
return 1; return 1;
} }
static int lib_finecosine(lua_State *L) static int lib_finecosine(lua_State *L)
{ {
lua_pushinteger(L, FINECOSINE((luaL_checkinteger(L, 1)>>ANGLETOFINESHIFT) & FINEMASK)); lua_pushfixed(L, FINECOSINE((luaL_checkangle(L, 1)>>ANGLETOFINESHIFT) & FINEMASK));
return 1; return 1;
} }
static int lib_finetangent(lua_State *L) static int lib_finetangent(lua_State *L)
{ {
lua_pushinteger(L, FINETANGENT((luaL_checkinteger(L, 1)>>ANGLETOFINESHIFT) & FINEMASK)); // 2.1.15 ONLY HACK: optional boolean argument, only add ANGLE_90 if true
boolean newtan = lua_optboolean(L, 2);
if (newtan)
{
// HACK: add ANGLE_90 to make tan() in Lua start at 0 like it should
// use & 4095 instead of & FINEMASK (8191), so it doesn't go out of the array's bounds
lua_pushfixed(L, FINETANGENT(((luaL_checkangle(L, 1)+ANGLE_90)>>ANGLETOFINESHIFT) & 4095));
}
else
{
LUA_Deprecated(L, "tan(angle)", "tan(angle, true)");
lua_pushfixed(L, FINETANGENT((luaL_checkangle(L, 1)>>ANGLETOFINESHIFT) & 4095));
}
return 1; return 1;
} }
@ -86,61 +103,68 @@ static int lib_finetangent(lua_State *L)
static int lib_fixedmul(lua_State *L) static int lib_fixedmul(lua_State *L)
{ {
lua_pushinteger(L, FixedMul((fixed_t)luaL_checkinteger(L, 1), (fixed_t)luaL_checkinteger(L, 2))); lua_pushfixed(L, FixedMul(luaL_checkfixed(L, 1), luaL_checkfixed(L, 2)));
return 1; return 1;
} }
static int lib_fixedint(lua_State *L) static int lib_fixedint(lua_State *L)
{ {
lua_pushinteger(L, FixedInt((fixed_t)luaL_checkinteger(L, 1))); lua_pushinteger(L, FixedInt(luaL_checkfixed(L, 1)));
return 1; return 1;
} }
static int lib_fixeddiv(lua_State *L) static int lib_fixeddiv(lua_State *L)
{ {
lua_pushinteger(L, FixedDiv((fixed_t)luaL_checkinteger(L, 1), (fixed_t)luaL_checkinteger(L, 2))); fixed_t i = luaL_checkfixed(L, 1);
fixed_t j = luaL_checkfixed(L, 2);
if (j == 0)
return luaL_error(L, "divide by zero");
lua_pushfixed(L, FixedDiv(i, j));
return 1; return 1;
} }
static int lib_fixedrem(lua_State *L) static int lib_fixedrem(lua_State *L)
{ {
lua_pushinteger(L, FixedRem((fixed_t)luaL_checkinteger(L, 1), (fixed_t)luaL_checkinteger(L, 2))); lua_pushfixed(L, FixedRem(luaL_checkfixed(L, 1), luaL_checkfixed(L, 2)));
return 1; return 1;
} }
static int lib_fixedsqrt(lua_State *L) static int lib_fixedsqrt(lua_State *L)
{ {
lua_pushinteger(L, FixedSqrt((fixed_t)luaL_checkinteger(L, 1))); fixed_t i = luaL_checkfixed(L, 1);
if (i < 0)
return luaL_error(L, "square root domain error");
lua_pushfixed(L, FixedSqrt(i));
return 1; return 1;
} }
static int lib_fixedhypot(lua_State *L) static int lib_fixedhypot(lua_State *L)
{ {
lua_pushinteger(L, FixedHypot((fixed_t)luaL_checkinteger(L, 1), (fixed_t)luaL_checkinteger(L, 2))); lua_pushfixed(L, FixedHypot(luaL_checkfixed(L, 1), luaL_checkfixed(L, 2)));
return 1; return 1;
} }
static int lib_fixedfloor(lua_State *L) static int lib_fixedfloor(lua_State *L)
{ {
lua_pushinteger(L, FixedFloor((fixed_t)luaL_checkinteger(L, 1))); lua_pushfixed(L, FixedFloor(luaL_checkfixed(L, 1)));
return 1; return 1;
} }
static int lib_fixedtrunc(lua_State *L) static int lib_fixedtrunc(lua_State *L)
{ {
lua_pushinteger(L, FixedTrunc((fixed_t)luaL_checkinteger(L, 1))); lua_pushfixed(L, FixedTrunc(luaL_checkfixed(L, 1)));
return 1; return 1;
} }
static int lib_fixedceil(lua_State *L) static int lib_fixedceil(lua_State *L)
{ {
lua_pushinteger(L, FixedCeil((fixed_t)luaL_checkinteger(L, 1))); lua_pushfixed(L, FixedCeil(luaL_checkfixed(L, 1)));
return 1; return 1;
} }
static int lib_fixedround(lua_State *L) static int lib_fixedround(lua_State *L)
{ {
lua_pushinteger(L, FixedRound((fixed_t)luaL_checkinteger(L, 1))); lua_pushfixed(L, FixedRound(luaL_checkfixed(L, 1)));
return 1; return 1;
} }
@ -156,7 +180,7 @@ static int lib_getsecspecial(lua_State *L)
static int lib_all7emeralds(lua_State *L) static int lib_all7emeralds(lua_State *L)
{ {
lua_pushinteger(L, ALL7EMERALDS(luaL_checkinteger(L, 1))); lua_pushboolean(L, ALL7EMERALDS(luaL_checkinteger(L, 1)));
return 1; return 1;
} }
@ -164,7 +188,9 @@ static int lib_all7emeralds(lua_State *L)
// Returns both color and frame numbers! // Returns both color and frame numbers!
static int lib_coloropposite(lua_State *L) static int lib_coloropposite(lua_State *L)
{ {
int colornum = ((int)luaL_checkinteger(L, 1)) & MAXSKINCOLORS; UINT8 colornum = (UINT8)luaL_checkinteger(L, 1);
if (colornum >= MAXSKINCOLORS)
return luaL_error(L, "skincolor %d out of range (0 - %d).", colornum, MAXSKINCOLORS-1);
lua_pushinteger(L, Color_Opposite[colornum*2]); // push color lua_pushinteger(L, Color_Opposite[colornum*2]); // push color
lua_pushinteger(L, Color_Opposite[colornum*2+1]); // push frame lua_pushinteger(L, Color_Opposite[colornum*2+1]); // push frame
return 2; return 2;

View file

@ -1,7 +1,7 @@
// SONIC ROBO BLAST 2 // SONIC ROBO BLAST 2
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
// Copyright (C) 2012-2014 by John "JTE" Muniz. // Copyright (C) 2012-2016 by John "JTE" Muniz.
// Copyright (C) 2012-2014 by Sonic Team Junior. // Copyright (C) 2012-2016 by Sonic Team Junior.
// //
// This program is free software distributed under the // This program is free software distributed under the
// terms of the GNU General Public License, version 2. // terms of the GNU General Public License, version 2.
@ -34,6 +34,7 @@ enum mobj_e {
mobj_angle, mobj_angle,
mobj_sprite, mobj_sprite,
mobj_frame, mobj_frame,
mobj_anim_duration,
mobj_touching_sectorlist, mobj_touching_sectorlist,
mobj_subsector, mobj_subsector,
mobj_floorz, mobj_floorz,
@ -92,6 +93,7 @@ static const char *const mobj_opt[] = {
"angle", "angle",
"sprite", "sprite",
"frame", "frame",
"anim_duration",
"touching_sectorlist", "touching_sectorlist",
"subsector", "subsector",
"floorz", "floorz",
@ -162,13 +164,13 @@ static int mobj_get(lua_State *L)
lua_pushboolean(L, 1); lua_pushboolean(L, 1);
break; break;
case mobj_x: case mobj_x:
lua_pushinteger(L, mo->x); lua_pushfixed(L, mo->x);
break; break;
case mobj_y: case mobj_y:
lua_pushinteger(L, mo->y); lua_pushfixed(L, mo->y);
break; break;
case mobj_z: case mobj_z:
lua_pushinteger(L, mo->z); lua_pushfixed(L, mo->z);
break; break;
case mobj_snext: case mobj_snext:
LUA_PushUserdata(L, mo->snext, META_MOBJ); LUA_PushUserdata(L, mo->snext, META_MOBJ);
@ -179,7 +181,7 @@ static int mobj_get(lua_State *L)
// i.e. it will always ultimately point to THIS mobj -- so that's actually not useful to Lua and won't be included. // i.e. it will always ultimately point to THIS mobj -- so that's actually not useful to Lua and won't be included.
return UNIMPLEMENTED; return UNIMPLEMENTED;
case mobj_angle: case mobj_angle:
lua_pushinteger(L, mo->angle); lua_pushangle(L, mo->angle);
break; break;
case mobj_sprite: case mobj_sprite:
lua_pushinteger(L, mo->sprite); lua_pushinteger(L, mo->sprite);
@ -187,34 +189,37 @@ static int mobj_get(lua_State *L)
case mobj_frame: case mobj_frame:
lua_pushinteger(L, mo->frame); lua_pushinteger(L, mo->frame);
break; break;
case mobj_anim_duration:
lua_pushinteger(L, mo->anim_duration);
break;
case mobj_touching_sectorlist: case mobj_touching_sectorlist:
return UNIMPLEMENTED; return UNIMPLEMENTED;
case mobj_subsector: case mobj_subsector:
LUA_PushUserdata(L, mo->subsector, META_SUBSECTOR); LUA_PushUserdata(L, mo->subsector, META_SUBSECTOR);
break; break;
case mobj_floorz: case mobj_floorz:
lua_pushinteger(L, mo->floorz); lua_pushfixed(L, mo->floorz);
break; break;
case mobj_ceilingz: case mobj_ceilingz:
lua_pushinteger(L, mo->ceilingz); lua_pushfixed(L, mo->ceilingz);
break; break;
case mobj_radius: case mobj_radius:
lua_pushinteger(L, mo->radius); lua_pushfixed(L, mo->radius);
break; break;
case mobj_height: case mobj_height:
lua_pushinteger(L, mo->height); lua_pushfixed(L, mo->height);
break; break;
case mobj_momx: case mobj_momx:
lua_pushinteger(L, mo->momx); lua_pushfixed(L, mo->momx);
break; break;
case mobj_momy: case mobj_momy:
lua_pushinteger(L, mo->momy); lua_pushfixed(L, mo->momy);
break; break;
case mobj_momz: case mobj_momz:
lua_pushinteger(L, mo->momz); lua_pushfixed(L, mo->momz);
break; break;
case mobj_pmomz: case mobj_pmomz:
lua_pushinteger(L, mo->pmomz); lua_pushfixed(L, mo->pmomz);
break; break;
case mobj_tics: case mobj_tics:
lua_pushinteger(L, mo->tics); lua_pushinteger(L, mo->tics);
@ -299,32 +304,32 @@ static int mobj_get(lua_State *L)
LUA_PushUserdata(L, mo->tracer, META_MOBJ); LUA_PushUserdata(L, mo->tracer, META_MOBJ);
break; break;
case mobj_friction: case mobj_friction:
lua_pushinteger(L, mo->friction); lua_pushfixed(L, mo->friction);
break; break;
case mobj_movefactor: case mobj_movefactor:
lua_pushinteger(L, mo->movefactor); lua_pushfixed(L, mo->movefactor);
break; break;
case mobj_fuse: case mobj_fuse:
lua_pushinteger(L, mo->fuse); lua_pushinteger(L, mo->fuse);
break; break;
case mobj_watertop: case mobj_watertop:
lua_pushinteger(L, mo->watertop); lua_pushfixed(L, mo->watertop);
break; break;
case mobj_waterbottom: case mobj_waterbottom:
lua_pushinteger(L, mo->waterbottom); lua_pushfixed(L, mo->waterbottom);
break; break;
case mobj_mobjnum: case mobj_mobjnum:
// mobjnum is a networking thing generated for $$$.sav // mobjnum is a networking thing generated for $$$.sav
// and therefore shouldn't be used by Lua. // and therefore shouldn't be used by Lua.
return UNIMPLEMENTED; return UNIMPLEMENTED;
case mobj_scale: case mobj_scale:
lua_pushinteger(L, mo->scale); lua_pushfixed(L, mo->scale);
break; break;
case mobj_destscale: case mobj_destscale:
lua_pushinteger(L, mo->destscale); lua_pushfixed(L, mo->destscale);
break; break;
case mobj_scalespeed: case mobj_scalespeed:
lua_pushinteger(L, mo->scalespeed); lua_pushfixed(L, mo->scalespeed);
break; break;
case mobj_extravalue1: case mobj_extravalue1:
lua_pushinteger(L, mo->extravalue1); lua_pushinteger(L, mo->extravalue1);
@ -382,7 +387,7 @@ static int mobj_set(lua_State *L)
{ {
// z doesn't cross sector bounds so it's okay. // z doesn't cross sector bounds so it's okay.
mobj_t *ptmthing = tmthing; mobj_t *ptmthing = tmthing;
mo->z = (fixed_t)luaL_checkinteger(L, 3); mo->z = luaL_checkfixed(L, 3);
P_CheckPosition(mo, mo->x, mo->y); P_CheckPosition(mo, mo->x, mo->y);
mo->floorz = tmfloorz; mo->floorz = tmfloorz;
mo->ceilingz = tmceilingz; mo->ceilingz = tmceilingz;
@ -394,7 +399,7 @@ static int mobj_set(lua_State *L)
case mobj_sprev: case mobj_sprev:
return UNIMPLEMENTED; return UNIMPLEMENTED;
case mobj_angle: case mobj_angle:
mo->angle = (angle_t)luaL_checkinteger(L, 3); mo->angle = luaL_checkangle(L, 3);
if (mo->player == &players[consoleplayer]) if (mo->player == &players[consoleplayer])
localangle = mo->angle; localangle = mo->angle;
else if (mo->player == &players[secondarydisplayplayer]) else if (mo->player == &players[secondarydisplayplayer])
@ -406,6 +411,9 @@ static int mobj_set(lua_State *L)
case mobj_frame: case mobj_frame:
mo->frame = (UINT32)luaL_checkinteger(L, 3); mo->frame = (UINT32)luaL_checkinteger(L, 3);
break; break;
case mobj_anim_duration:
mo->anim_duration = (UINT16)luaL_checkinteger(L, 3);
break;
case mobj_touching_sectorlist: case mobj_touching_sectorlist:
return UNIMPLEMENTED; return UNIMPLEMENTED;
case mobj_subsector: case mobj_subsector:
@ -417,7 +425,7 @@ static int mobj_set(lua_State *L)
case mobj_radius: case mobj_radius:
{ {
mobj_t *ptmthing = tmthing; mobj_t *ptmthing = tmthing;
mo->radius = (fixed_t)luaL_checkinteger(L, 3); mo->radius = luaL_checkfixed(L, 3);
if (mo->radius < 0) if (mo->radius < 0)
mo->radius = 0; mo->radius = 0;
P_CheckPosition(mo, mo->x, mo->y); P_CheckPosition(mo, mo->x, mo->y);
@ -429,7 +437,7 @@ static int mobj_set(lua_State *L)
case mobj_height: case mobj_height:
{ {
mobj_t *ptmthing = tmthing; mobj_t *ptmthing = tmthing;
mo->height = (fixed_t)luaL_checkinteger(L, 3); mo->height = luaL_checkfixed(L, 3);
if (mo->height < 0) if (mo->height < 0)
mo->height = 0; mo->height = 0;
P_CheckPosition(mo, mo->x, mo->y); P_CheckPosition(mo, mo->x, mo->y);
@ -439,16 +447,17 @@ static int mobj_set(lua_State *L)
break; break;
} }
case mobj_momx: case mobj_momx:
mo->momx = (fixed_t)luaL_checkinteger(L, 3); mo->momx = luaL_checkfixed(L, 3);
break; break;
case mobj_momy: case mobj_momy:
mo->momy = (fixed_t)luaL_checkinteger(L, 3); mo->momy = luaL_checkfixed(L, 3);
break; break;
case mobj_momz: case mobj_momz:
mo->momz = (fixed_t)luaL_checkinteger(L, 3); mo->momz = luaL_checkfixed(L, 3);
break; break;
case mobj_pmomz: case mobj_pmomz:
mo->pmomz = (fixed_t)luaL_checkinteger(L, 3); mo->pmomz = luaL_checkfixed(L, 3);
mo->eflags |= MFE_APPLYPMOMZ;
break; break;
case mobj_tics: case mobj_tics:
mo->tics = luaL_checkinteger(L, 3); mo->tics = luaL_checkinteger(L, 3);
@ -500,8 +509,13 @@ static int mobj_set(lua_State *L)
return luaL_error(L, "mobj.skin '%s' not found!", skin); return luaL_error(L, "mobj.skin '%s' not found!", skin);
} }
case mobj_color: case mobj_color:
mo->color = ((UINT8)luaL_checkinteger(L, 3)) % MAXSKINCOLORS; {
UINT8 newcolor = (UINT8)luaL_checkinteger(L,3);
if (newcolor >= MAXTRANSLATIONS)
return luaL_error(L, "mobj.color %d out of range (0 - %d).", newcolor, MAXTRANSLATIONS-1);
mo->color = newcolor;
break; break;
}
case mobj_bnext: case mobj_bnext:
return NOSETPOS; return NOSETPOS;
case mobj_bprev: case mobj_bprev:
@ -515,8 +529,8 @@ static int mobj_set(lua_State *L)
case mobj_type: // yeah sure, we'll let you change the mobj's type. case mobj_type: // yeah sure, we'll let you change the mobj's type.
{ {
mobjtype_t newtype = luaL_checkinteger(L, 3); mobjtype_t newtype = luaL_checkinteger(L, 3);
if (newtype > MT_LASTFREESLOT) if (newtype >= NUMMOBJTYPES)
return luaL_error(L, "mobj.type %u is out of bounds.", newtype); return luaL_error(L, "mobj.type %d out of range (0 - %d).", newtype, NUMMOBJTYPES-1);
mo->type = newtype; mo->type = newtype;
mo->info = &mobjinfo[newtype]; mo->info = &mobjinfo[newtype];
P_SetScale(mo, mo->scale); P_SetScale(mo, mo->scale);
@ -572,25 +586,25 @@ static int mobj_set(lua_State *L)
} }
break; break;
case mobj_friction: case mobj_friction:
mo->friction = (fixed_t)luaL_checkinteger(L, 3); mo->friction = luaL_checkfixed(L, 3);
break; break;
case mobj_movefactor: case mobj_movefactor:
mo->movefactor = (fixed_t)luaL_checkinteger(L, 3); mo->movefactor = luaL_checkfixed(L, 3);
break; break;
case mobj_fuse: case mobj_fuse:
mo->fuse = luaL_checkinteger(L, 3); mo->fuse = luaL_checkinteger(L, 3);
break; break;
case mobj_watertop: case mobj_watertop:
mo->watertop = (fixed_t)luaL_checkinteger(L, 3); mo->watertop = luaL_checkfixed(L, 3);
break; break;
case mobj_waterbottom: case mobj_waterbottom:
mo->waterbottom = (fixed_t)luaL_checkinteger(L, 3); mo->waterbottom = luaL_checkfixed(L, 3);
break; break;
case mobj_mobjnum: case mobj_mobjnum:
return UNIMPLEMENTED; return UNIMPLEMENTED;
case mobj_scale: case mobj_scale:
{ {
fixed_t scale = (fixed_t)luaL_checkinteger(L, 3); fixed_t scale = luaL_checkfixed(L, 3);
if (scale < FRACUNIT/100) if (scale < FRACUNIT/100)
scale = FRACUNIT/100; scale = FRACUNIT/100;
mo->destscale = scale; mo->destscale = scale;
@ -599,14 +613,14 @@ static int mobj_set(lua_State *L)
} }
case mobj_destscale: case mobj_destscale:
{ {
fixed_t scale = (fixed_t)luaL_checkinteger(L, 3); fixed_t scale = luaL_checkfixed(L, 3);
if (scale < FRACUNIT/100) if (scale < FRACUNIT/100)
scale = FRACUNIT/100; scale = FRACUNIT/100;
mo->destscale = scale; mo->destscale = scale;
break; break;
} }
case mobj_scalespeed: case mobj_scalespeed:
mo->scalespeed = (fixed_t)luaL_checkinteger(L, 3); mo->scalespeed = luaL_checkfixed(L, 3);
break; break;
case mobj_extravalue1: case mobj_extravalue1:
mo->extravalue1 = luaL_checkinteger(L, 3); mo->extravalue1 = luaL_checkinteger(L, 3);

View file

@ -1,7 +1,7 @@
// SONIC ROBO BLAST 2 // SONIC ROBO BLAST 2
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
// Copyright (C) 2012-2014 by John "JTE" Muniz. // Copyright (C) 2012-2016 by John "JTE" Muniz.
// Copyright (C) 2012-2014 by Sonic Team Junior. // Copyright (C) 2012-2016 by Sonic Team Junior.
// //
// This program is free software distributed under the // This program is free software distributed under the
// terms of the GNU General Public License, version 2. // terms of the GNU General Public License, version 2.
@ -55,7 +55,7 @@ static int lib_getPlayer(lua_State *L)
{ {
lua_Integer i = luaL_checkinteger(L, 2); lua_Integer i = luaL_checkinteger(L, 2);
if (i < 0 || i >= MAXPLAYERS) if (i < 0 || i >= MAXPLAYERS)
return luaL_error(L, "players[] index cannot exceed MAXPLAYERS"); return luaL_error(L, "players[] index %d out of range (0 - %d)", i, MAXPLAYERS-1);
if (!playeringame[i]) if (!playeringame[i])
return 0; return 0;
if (!players[i].mo) if (!players[i].mo)
@ -109,15 +109,15 @@ static int player_get(lua_State *L)
else if (fastcmp(field,"playerstate")) else if (fastcmp(field,"playerstate"))
lua_pushinteger(L, plr->playerstate); lua_pushinteger(L, plr->playerstate);
else if (fastcmp(field,"viewz")) else if (fastcmp(field,"viewz"))
lua_pushinteger(L, plr->viewz); lua_pushfixed(L, plr->viewz);
else if (fastcmp(field,"viewheight")) else if (fastcmp(field,"viewheight"))
lua_pushinteger(L, plr->viewheight); lua_pushfixed(L, plr->viewheight);
else if (fastcmp(field,"deltaviewheight")) else if (fastcmp(field,"deltaviewheight"))
lua_pushinteger(L, plr->deltaviewheight); lua_pushfixed(L, plr->deltaviewheight);
else if (fastcmp(field,"bob")) else if (fastcmp(field,"bob"))
lua_pushinteger(L, plr->bob); lua_pushfixed(L, plr->bob);
else if (fastcmp(field,"aiming")) else if (fastcmp(field,"aiming"))
lua_pushinteger(L, plr->aiming); lua_pushangle(L, plr->aiming);
else if (fastcmp(field,"health")) else if (fastcmp(field,"health"))
lua_pushinteger(L, plr->health); lua_pushinteger(L, plr->health);
else if (fastcmp(field,"pity")) else if (fastcmp(field,"pity"))
@ -141,13 +141,13 @@ static int player_get(lua_State *L)
else if (fastcmp(field,"score")) else if (fastcmp(field,"score"))
lua_pushinteger(L, plr->score); lua_pushinteger(L, plr->score);
else if (fastcmp(field,"dashspeed")) else if (fastcmp(field,"dashspeed"))
lua_pushinteger(L, plr->dashspeed); lua_pushfixed(L, plr->dashspeed);
else if (fastcmp(field,"dashtime")) else if (fastcmp(field,"dashtime"))
lua_pushinteger(L, plr->dashtime); lua_pushinteger(L, plr->dashtime);
else if (fastcmp(field,"normalspeed")) else if (fastcmp(field,"normalspeed"))
lua_pushinteger(L, plr->normalspeed); lua_pushfixed(L, plr->normalspeed);
else if (fastcmp(field,"runspeed")) else if (fastcmp(field,"runspeed"))
lua_pushinteger(L, plr->runspeed); lua_pushfixed(L, plr->runspeed);
else if (fastcmp(field,"thrustfactor")) else if (fastcmp(field,"thrustfactor"))
lua_pushinteger(L, plr->thrustfactor); lua_pushinteger(L, plr->thrustfactor);
else if (fastcmp(field,"accelstart")) else if (fastcmp(field,"accelstart"))
@ -167,13 +167,13 @@ static int player_get(lua_State *L)
else if (fastcmp(field,"revitem")) else if (fastcmp(field,"revitem"))
lua_pushinteger(L, plr->revitem); lua_pushinteger(L, plr->revitem);
else if (fastcmp(field,"actionspd")) else if (fastcmp(field,"actionspd"))
lua_pushinteger(L, plr->actionspd); lua_pushfixed(L, plr->actionspd);
else if (fastcmp(field,"mindash")) else if (fastcmp(field,"mindash"))
lua_pushinteger(L, plr->mindash); lua_pushfixed(L, plr->mindash);
else if (fastcmp(field,"maxdash")) else if (fastcmp(field,"maxdash"))
lua_pushinteger(L, plr->maxdash); lua_pushfixed(L, plr->maxdash);
else if (fastcmp(field,"jumpfactor")) else if (fastcmp(field,"jumpfactor"))
lua_pushinteger(L, plr->jumpfactor); lua_pushfixed(L, plr->jumpfactor);
else if (fastcmp(field,"lives")) else if (fastcmp(field,"lives"))
lua_pushinteger(L, plr->lives); lua_pushinteger(L, plr->lives);
else if (fastcmp(field,"continues")) else if (fastcmp(field,"continues"))
@ -183,7 +183,7 @@ static int player_get(lua_State *L)
else if (fastcmp(field,"gotcontinue")) else if (fastcmp(field,"gotcontinue"))
lua_pushinteger(L, plr->gotcontinue); lua_pushinteger(L, plr->gotcontinue);
else if (fastcmp(field,"speed")) else if (fastcmp(field,"speed"))
lua_pushinteger(L, plr->speed); lua_pushfixed(L, plr->speed);
else if (fastcmp(field,"jumping")) else if (fastcmp(field,"jumping"))
lua_pushboolean(L, plr->jumping); lua_pushboolean(L, plr->jumping);
else if (fastcmp(field,"secondjump")) else if (fastcmp(field,"secondjump"))
@ -205,13 +205,13 @@ static int player_get(lua_State *L)
else if (fastcmp(field,"skidtime")) else if (fastcmp(field,"skidtime"))
lua_pushinteger(L, plr->skidtime); lua_pushinteger(L, plr->skidtime);
else if (fastcmp(field,"cmomx")) else if (fastcmp(field,"cmomx"))
lua_pushinteger(L, plr->cmomx); lua_pushfixed(L, plr->cmomx);
else if (fastcmp(field,"cmomy")) else if (fastcmp(field,"cmomy"))
lua_pushinteger(L, plr->cmomy); lua_pushfixed(L, plr->cmomy);
else if (fastcmp(field,"rmomx")) else if (fastcmp(field,"rmomx"))
lua_pushinteger(L, plr->rmomx); lua_pushfixed(L, plr->rmomx);
else if (fastcmp(field,"rmomy")) else if (fastcmp(field,"rmomy"))
lua_pushinteger(L, plr->rmomy); lua_pushfixed(L, plr->rmomy);
else if (fastcmp(field,"numboxes")) else if (fastcmp(field,"numboxes"))
lua_pushinteger(L, plr->numboxes); lua_pushinteger(L, plr->numboxes);
else if (fastcmp(field,"totalring")) else if (fastcmp(field,"totalring"))
@ -239,11 +239,11 @@ static int player_get(lua_State *L)
else if (fastcmp(field,"starposttime")) else if (fastcmp(field,"starposttime"))
lua_pushinteger(L, plr->starposttime); lua_pushinteger(L, plr->starposttime);
else if (fastcmp(field,"starpostangle")) else if (fastcmp(field,"starpostangle"))
lua_pushinteger(L, plr->starpostangle); lua_pushangle(L, plr->starpostangle);
else if (fastcmp(field,"angle_pos")) else if (fastcmp(field,"angle_pos"))
lua_pushinteger(L, plr->angle_pos); lua_pushangle(L, plr->angle_pos);
else if (fastcmp(field,"old_angle_pos")) else if (fastcmp(field,"old_angle_pos"))
lua_pushinteger(L, plr->old_angle_pos); lua_pushangle(L, plr->old_angle_pos);
else if (fastcmp(field,"axis1")) else if (fastcmp(field,"axis1"))
LUA_PushUserdata(L, plr->axis1, META_MOBJ); LUA_PushUserdata(L, plr->axis1, META_MOBJ);
else if (fastcmp(field,"axis2")) else if (fastcmp(field,"axis2"))
@ -298,6 +298,8 @@ static int player_get(lua_State *L)
lua_pushinteger(L, plr->lastlinehit); lua_pushinteger(L, plr->lastlinehit);
else if (fastcmp(field,"losstime")) else if (fastcmp(field,"losstime"))
lua_pushinteger(L, plr->losstime); lua_pushinteger(L, plr->losstime);
else if (fastcmp(field,"timeshit"))
lua_pushinteger(L, plr->timeshit);
else if (fastcmp(field,"onconveyor")) else if (fastcmp(field,"onconveyor"))
lua_pushinteger(L, plr->onconveyor); lua_pushinteger(L, plr->onconveyor);
else if (fastcmp(field,"awayviewmobj")) else if (fastcmp(field,"awayviewmobj"))
@ -305,16 +307,16 @@ static int player_get(lua_State *L)
else if (fastcmp(field,"awayviewtics")) else if (fastcmp(field,"awayviewtics"))
lua_pushinteger(L, plr->awayviewtics); lua_pushinteger(L, plr->awayviewtics);
else if (fastcmp(field,"awayviewaiming")) else if (fastcmp(field,"awayviewaiming"))
lua_pushinteger(L, plr->awayviewaiming); lua_pushangle(L, plr->awayviewaiming);
else if (fastcmp(field,"spectator")) else if (fastcmp(field,"spectator"))
lua_pushinteger(L, plr->spectator); lua_pushboolean(L, plr->spectator);
else if (fastcmp(field,"bot")) else if (fastcmp(field,"bot"))
lua_pushinteger(L, plr->bot); lua_pushinteger(L, plr->bot);
else if (fastcmp(field,"jointime")) else if (fastcmp(field,"jointime"))
lua_pushinteger(L, plr->jointime); lua_pushinteger(L, plr->jointime);
#ifdef HWRENDER #ifdef HWRENDER
else if (fastcmp(field,"fovadd")) else if (fastcmp(field,"fovadd"))
lua_pushinteger(L, plr->fovadd); lua_pushfixed(L, plr->fovadd);
#endif #endif
else { else {
lua_getfield(L, LUA_REGISTRYINDEX, LREG_EXTVARS); lua_getfield(L, LUA_REGISTRYINDEX, LREG_EXTVARS);
@ -354,15 +356,15 @@ static int player_set(lua_State *L)
else if (fastcmp(field,"playerstate")) else if (fastcmp(field,"playerstate"))
plr->playerstate = luaL_checkinteger(L, 3); plr->playerstate = luaL_checkinteger(L, 3);
else if (fastcmp(field,"viewz")) else if (fastcmp(field,"viewz"))
plr->viewz = (fixed_t)luaL_checkinteger(L, 3); plr->viewz = luaL_checkfixed(L, 3);
else if (fastcmp(field,"viewheight")) else if (fastcmp(field,"viewheight"))
plr->viewheight = (fixed_t)luaL_checkinteger(L, 3); plr->viewheight = luaL_checkfixed(L, 3);
else if (fastcmp(field,"deltaviewheight")) else if (fastcmp(field,"deltaviewheight"))
plr->deltaviewheight = (fixed_t)luaL_checkinteger(L, 3); plr->deltaviewheight = luaL_checkfixed(L, 3);
else if (fastcmp(field,"bob")) else if (fastcmp(field,"bob"))
plr->bob = (fixed_t)luaL_checkinteger(L, 3); plr->bob = luaL_checkfixed(L, 3);
else if (fastcmp(field,"aiming")) { else if (fastcmp(field,"aiming")) {
plr->aiming = (angle_t)luaL_checkinteger(L, 3); plr->aiming = luaL_checkangle(L, 3);
if (plr == &players[consoleplayer]) if (plr == &players[consoleplayer])
localaiming = plr->aiming; localaiming = plr->aiming;
else if (plr == &players[secondarydisplayplayer]) else if (plr == &players[secondarydisplayplayer])
@ -387,17 +389,22 @@ static int player_set(lua_State *L)
else if (fastcmp(field,"flashpal")) else if (fastcmp(field,"flashpal"))
plr->flashpal = (UINT16)luaL_checkinteger(L, 3); plr->flashpal = (UINT16)luaL_checkinteger(L, 3);
else if (fastcmp(field,"skincolor")) else if (fastcmp(field,"skincolor"))
plr->skincolor = ((UINT8)luaL_checkinteger(L, 3)) % MAXSKINCOLORS; {
UINT8 newcolor = (UINT8)luaL_checkinteger(L,3);
if (newcolor >= MAXSKINCOLORS)
return luaL_error(L, "player.skincolor %d out of range (0 - %d).", newcolor, MAXSKINCOLORS-1);
plr->skincolor = newcolor;
}
else if (fastcmp(field,"score")) else if (fastcmp(field,"score"))
plr->score = (UINT32)luaL_checkinteger(L, 3); plr->score = (UINT32)luaL_checkinteger(L, 3);
else if (fastcmp(field,"dashspeed")) else if (fastcmp(field,"dashspeed"))
plr->dashspeed = (fixed_t)luaL_checkinteger(L, 3); plr->dashspeed = luaL_checkfixed(L, 3);
else if (fastcmp(field,"dashtime")) else if (fastcmp(field,"dashtime"))
plr->dashtime = (INT32)luaL_checkinteger(L, 3); plr->dashtime = (INT32)luaL_checkinteger(L, 3);
else if (fastcmp(field,"normalspeed")) else if (fastcmp(field,"normalspeed"))
plr->normalspeed = (fixed_t)luaL_checkinteger(L, 3); plr->normalspeed = luaL_checkfixed(L, 3);
else if (fastcmp(field,"runspeed")) else if (fastcmp(field,"runspeed"))
plr->runspeed = (fixed_t)luaL_checkinteger(L, 3); plr->runspeed = luaL_checkfixed(L, 3);
else if (fastcmp(field,"thrustfactor")) else if (fastcmp(field,"thrustfactor"))
plr->thrustfactor = (UINT8)luaL_checkinteger(L, 3); plr->thrustfactor = (UINT8)luaL_checkinteger(L, 3);
else if (fastcmp(field,"accelstart")) else if (fastcmp(field,"accelstart"))
@ -433,7 +440,7 @@ static int player_set(lua_State *L)
else if (fastcmp(field,"gotcontinue")) else if (fastcmp(field,"gotcontinue"))
plr->gotcontinue = (UINT8)luaL_checkinteger(L, 3); plr->gotcontinue = (UINT8)luaL_checkinteger(L, 3);
else if (fastcmp(field,"speed")) else if (fastcmp(field,"speed"))
plr->speed = (fixed_t)luaL_checkinteger(L, 3); plr->speed = luaL_checkfixed(L, 3);
else if (fastcmp(field,"jumping")) else if (fastcmp(field,"jumping"))
plr->jumping = luaL_checkboolean(L, 3); plr->jumping = luaL_checkboolean(L, 3);
else if (fastcmp(field,"secondjump")) else if (fastcmp(field,"secondjump"))
@ -455,13 +462,13 @@ static int player_set(lua_State *L)
else if (fastcmp(field,"skidtime")) else if (fastcmp(field,"skidtime"))
plr->skidtime = (tic_t)luaL_checkinteger(L, 3); plr->skidtime = (tic_t)luaL_checkinteger(L, 3);
else if (fastcmp(field,"cmomx")) else if (fastcmp(field,"cmomx"))
plr->cmomx = (fixed_t)luaL_checkinteger(L, 3); plr->cmomx = luaL_checkfixed(L, 3);
else if (fastcmp(field,"cmomy")) else if (fastcmp(field,"cmomy"))
plr->cmomy = (fixed_t)luaL_checkinteger(L, 3); plr->cmomy = luaL_checkfixed(L, 3);
else if (fastcmp(field,"rmomx")) else if (fastcmp(field,"rmomx"))
plr->rmomx = (fixed_t)luaL_checkinteger(L, 3); plr->rmomx = luaL_checkfixed(L, 3);
else if (fastcmp(field,"rmomy")) else if (fastcmp(field,"rmomy"))
plr->rmomy = (fixed_t)luaL_checkinteger(L, 3); plr->rmomy = luaL_checkfixed(L, 3);
else if (fastcmp(field,"numboxes")) else if (fastcmp(field,"numboxes"))
plr->numboxes = (INT16)luaL_checkinteger(L, 3); plr->numboxes = (INT16)luaL_checkinteger(L, 3);
else if (fastcmp(field,"totalring")) else if (fastcmp(field,"totalring"))
@ -489,11 +496,11 @@ static int player_set(lua_State *L)
else if (fastcmp(field,"starposttime")) else if (fastcmp(field,"starposttime"))
plr->starposttime = (tic_t)luaL_checkinteger(L, 3); plr->starposttime = (tic_t)luaL_checkinteger(L, 3);
else if (fastcmp(field,"starpostangle")) else if (fastcmp(field,"starpostangle"))
plr->starpostangle = (angle_t)luaL_checkinteger(L, 3); plr->starpostangle = luaL_checkangle(L, 3);
else if (fastcmp(field,"angle_pos")) else if (fastcmp(field,"angle_pos"))
plr->angle_pos = (angle_t)luaL_checkinteger(L, 3); plr->angle_pos = luaL_checkangle(L, 3);
else if (fastcmp(field,"old_angle_pos")) else if (fastcmp(field,"old_angle_pos"))
plr->old_angle_pos = (angle_t)luaL_checkinteger(L, 3); plr->old_angle_pos = luaL_checkangle(L, 3);
else if (fastcmp(field,"axis1")) else if (fastcmp(field,"axis1"))
P_SetTarget(&plr->axis1, *((mobj_t **)luaL_checkudata(L, 3, META_MOBJ))); P_SetTarget(&plr->axis1, *((mobj_t **)luaL_checkudata(L, 3, META_MOBJ)));
else if (fastcmp(field,"axis2")) else if (fastcmp(field,"axis2"))
@ -553,6 +560,8 @@ static int player_set(lua_State *L)
plr->lastlinehit = (INT16)luaL_checkinteger(L, 3); plr->lastlinehit = (INT16)luaL_checkinteger(L, 3);
else if (fastcmp(field,"losstime")) else if (fastcmp(field,"losstime"))
plr->losstime = (tic_t)luaL_checkinteger(L, 3); plr->losstime = (tic_t)luaL_checkinteger(L, 3);
else if (fastcmp(field,"timeshit"))
plr->timeshit = (UINT8)luaL_checkinteger(L, 3);
else if (fastcmp(field,"onconveyor")) else if (fastcmp(field,"onconveyor"))
plr->onconveyor = (INT32)luaL_checkinteger(L, 3); plr->onconveyor = (INT32)luaL_checkinteger(L, 3);
else if (fastcmp(field,"awayviewmobj")) else if (fastcmp(field,"awayviewmobj"))
@ -569,7 +578,7 @@ static int player_set(lua_State *L)
P_SetTarget(&plr->awayviewmobj, plr->mo); // but since the script might set awayviewmobj immediately AFTER setting awayviewtics, use player mobj as filler for now. P_SetTarget(&plr->awayviewmobj, plr->mo); // but since the script might set awayviewmobj immediately AFTER setting awayviewtics, use player mobj as filler for now.
} }
else if (fastcmp(field,"awayviewaiming")) else if (fastcmp(field,"awayviewaiming"))
plr->awayviewaiming = (angle_t)luaL_checkinteger(L, 3); plr->awayviewaiming = luaL_checkangle(L, 3);
else if (fastcmp(field,"spectator")) else if (fastcmp(field,"spectator"))
plr->spectator = lua_toboolean(L, 3); plr->spectator = lua_toboolean(L, 3);
else if (fastcmp(field,"bot")) else if (fastcmp(field,"bot"))
@ -578,7 +587,7 @@ static int player_set(lua_State *L)
plr->jointime = (tic_t)luaL_checkinteger(L, 3); plr->jointime = (tic_t)luaL_checkinteger(L, 3);
#ifdef HWRENDER #ifdef HWRENDER
else if (fastcmp(field,"fovadd")) else if (fastcmp(field,"fovadd"))
plr->fovadd = (fixed_t)luaL_checkinteger(L, 3); plr->fovadd = luaL_checkfixed(L, 3);
#endif #endif
else { else {
lua_getfield(L, LUA_REGISTRYINDEX, LREG_EXTVARS); lua_getfield(L, LUA_REGISTRYINDEX, LREG_EXTVARS);

View file

@ -1,7 +1,7 @@
// SONIC ROBO BLAST 2 // SONIC ROBO BLAST 2
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
// Copyright (C) 2012-2014 by John "JTE" Muniz. // Copyright (C) 2012-2016 by John "JTE" Muniz.
// Copyright (C) 2012-2014 by Sonic Team Junior. // Copyright (C) 2012-2016 by Sonic Team Junior.
// //
// This program is free software distributed under the // This program is free software distributed under the
// terms of the GNU General Public License, version 2. // terms of the GNU General Public License, version 2.
@ -442,7 +442,6 @@ enum
ARCH_NULL=0, ARCH_NULL=0,
ARCH_BOOLEAN, ARCH_BOOLEAN,
ARCH_SIGNED, ARCH_SIGNED,
ARCH_UNSIGNED,
ARCH_STRING, ARCH_STRING,
ARCH_TABLE, ARCH_TABLE,
@ -522,13 +521,8 @@ static UINT8 ArchiveValue(int TABLESINDEX, int myindex)
case LUA_TNUMBER: case LUA_TNUMBER:
{ {
lua_Integer number = lua_tointeger(gL, myindex); lua_Integer number = lua_tointeger(gL, myindex);
if (number < 0) { WRITEUINT8(save_p, ARCH_SIGNED);
WRITEUINT8(save_p, ARCH_SIGNED); WRITEFIXED(save_p, number);
WRITEFIXED(save_p, number);
} else {
WRITEUINT8(save_p, ARCH_UNSIGNED);
WRITEANGLE(save_p, number);
}
break; break;
} }
case LUA_TSTRING: case LUA_TSTRING:
@ -743,7 +737,7 @@ static int NetArchive(lua_State *L)
{ {
int TABLESINDEX = lua_upvalueindex(1); int TABLESINDEX = lua_upvalueindex(1);
int i, n = lua_gettop(L); int i, n = lua_gettop(L);
for (i = 0; i < n; i++) for (i = 1; i <= n; i++)
ArchiveValue(TABLESINDEX, i); ArchiveValue(TABLESINDEX, i);
return n; return n;
} }
@ -797,9 +791,6 @@ static UINT8 UnArchiveValue(int TABLESINDEX)
case ARCH_SIGNED: case ARCH_SIGNED:
lua_pushinteger(gL, READFIXED(save_p)); lua_pushinteger(gL, READFIXED(save_p));
break; break;
case ARCH_UNSIGNED:
lua_pushinteger(gL, READANGLE(save_p));
break;
case ARCH_STRING: case ARCH_STRING:
{ {
char value[1024]; char value[1024];
@ -893,7 +884,7 @@ static int NetUnArchive(lua_State *L)
{ {
int TABLESINDEX = lua_upvalueindex(1); int TABLESINDEX = lua_upvalueindex(1);
int i, n = lua_gettop(L); int i, n = lua_gettop(L);
for (i = 0; i < n; i++) for (i = 1; i <= n; i++)
UnArchiveValue(TABLESINDEX); UnArchiveValue(TABLESINDEX);
return n; return n;
} }
@ -924,28 +915,12 @@ static void UnArchiveTables(void)
} }
} }
static void NetArchiveHook(lua_CFunction archFunc) void LUA_Step(void)
{ {
int TABLESINDEX;
if (!gL) if (!gL)
return; return;
lua_settop(gL, 0);
TABLESINDEX = lua_gettop(gL); lua_gc(gL, LUA_GCSTEP, 1);
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_Archive(void) void LUA_Archive(void)
@ -973,7 +948,7 @@ void LUA_Archive(void)
} }
WRITEUINT32(save_p, UINT32_MAX); // end of mobjs marker, replaces mobjnum. 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(); ArchiveTables();
if (gL) if (gL)
@ -1004,7 +979,7 @@ void LUA_UnArchive(void)
UnArchiveExtVars(th); // apply variables UnArchiveExtVars(th); // apply variables
} while(mobjnum != UINT32_MAX); // repeat until end of mobjs marker. } 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(); UnArchiveTables();
if (gL) if (gL)

View file

@ -1,7 +1,7 @@
// SONIC ROBO BLAST 2 // SONIC ROBO BLAST 2
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
// Copyright (C) 2012-2014 by John "JTE" Muniz. // Copyright (C) 2012-2016 by John "JTE" Muniz.
// Copyright (C) 2012-2014 by Sonic Team Junior. // Copyright (C) 2012-2016 by Sonic Team Junior.
// //
// This program is free software distributed under the // This program is free software distributed under the
// terms of the GNU General Public License, version 2. // terms of the GNU General Public License, version 2.
@ -19,9 +19,21 @@
#include "blua/lua.h" #include "blua/lua.h"
#include "blua/lualib.h" #include "blua/lualib.h"
#include "blua/lauxlib.h" #include "blua/lauxlib.h"
#define lua_optboolean(L, i) (!lua_isnoneornil(L, i) && lua_toboolean(L, i)) #define lua_optboolean(L, i) (!lua_isnoneornil(L, i) && lua_toboolean(L, i))
#define lua_opttrueboolean(L, i) (lua_isnoneornil(L, i) || lua_toboolean(L, i)) #define lua_opttrueboolean(L, i) (lua_isnoneornil(L, i) || lua_toboolean(L, i))
// fixed_t casting
// TODO add some distinction between fixed numbers and integer numbers
// for at least the purpose of printing and maybe math.
#define luaL_checkfixed(L, i) luaL_checkinteger(L, i)
#define lua_pushfixed(L, f) lua_pushinteger(L, f)
// angle_t casting
// TODO deal with signedness
#define luaL_checkangle(L, i) ((angle_t)luaL_checkinteger(L, i))
#define lua_pushangle(L, a) lua_pushinteger(L, a)
#ifdef _DEBUG #ifdef _DEBUG
void LUA_ClearExtVars(void); void LUA_ClearExtVars(void);
#endif #endif
@ -36,12 +48,14 @@ void LUA_InvalidateUserdata(void *data);
void LUA_InvalidateLevel(void); void LUA_InvalidateLevel(void);
void LUA_InvalidateMapthings(void); void LUA_InvalidateMapthings(void);
void LUA_InvalidatePlayer(player_t *player); void LUA_InvalidatePlayer(player_t *player);
void LUA_Step(void);
void LUA_Archive(void); void LUA_Archive(void);
void LUA_UnArchive(void); void LUA_UnArchive(void);
void Got_Luacmd(UINT8 **cp, INT32 playernum); // lua_consolelib.c void Got_Luacmd(UINT8 **cp, INT32 playernum); // lua_consolelib.c
void LUA_CVarChanged(const char *name); // lua_consolelib.c void LUA_CVarChanged(const char *name); // lua_consolelib.c
int Lua_optoption(lua_State *L, int narg, int Lua_optoption(lua_State *L, int narg,
const char *def, const char *const lst[]); const char *def, const char *const lst[]);
void LUAh_NetArchiveHook(lua_CFunction archFunc);
// Console wrapper // Console wrapper
void COM_Lua_f(void); void COM_Lua_f(void);
@ -56,4 +70,26 @@ void COM_Lua_f(void);
#define LUA_ErrInvalid(L, type) luaL_error(L, "accessed " type " doesn't exist anymore, please check 'valid' before using " type "."); #define LUA_ErrInvalid(L, type) luaL_error(L, "accessed " type " doesn't exist anymore, please check 'valid' before using " type ".");
// Deprecation warnings
// Shows once upon use. Then doesn't show again.
#define LUA_Deprecated(L,this_func,use_instead)\
{\
static UINT8 seen = 0;\
if (!seen) {\
seen = 1;\
CONS_Alert(CONS_WARNING,"\"%s\" is deprecated and will be removed.\nUse \"%s\" instead.\n", this_func, use_instead);\
}\
}
// Warnings about incorrect function usage.
// Shows once, then never again, like deprecation
#define LUA_UsageWarning(L, warningmsg)\
{\
static UINT8 seen = 0;\
if (!seen) {\
seen = 1;\
CONS_Alert(CONS_WARNING,"%s\n", warningmsg);\
}\
}
#endif #endif

View file

@ -1,7 +1,7 @@
// SONIC ROBO BLAST 2 // SONIC ROBO BLAST 2
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
// Copyright (C) 2014 by John "JTE" Muniz. // Copyright (C) 2014-2016 by John "JTE" Muniz.
// Copyright (C) 2014 by Sonic Team Junior. // Copyright (C) 2014-2016 by Sonic Team Junior.
// //
// This program is free software distributed under the // This program is free software distributed under the
// terms of the GNU General Public License, version 2. // terms of the GNU General Public License, version 2.
@ -147,19 +147,19 @@ static int skin_get(lua_State *L)
lua_pushinteger(L, skin->revitem); lua_pushinteger(L, skin->revitem);
break; break;
case skin_actionspd: case skin_actionspd:
lua_pushinteger(L, skin->actionspd); lua_pushfixed(L, skin->actionspd);
break; break;
case skin_mindash: case skin_mindash:
lua_pushinteger(L, skin->mindash); lua_pushfixed(L, skin->mindash);
break; break;
case skin_maxdash: case skin_maxdash:
lua_pushinteger(L, skin->maxdash); lua_pushfixed(L, skin->maxdash);
break; break;
case skin_normalspeed: case skin_normalspeed:
lua_pushinteger(L, skin->normalspeed); lua_pushfixed(L, skin->normalspeed);
break; break;
case skin_runspeed: case skin_runspeed:
lua_pushinteger(L, skin->runspeed); lua_pushfixed(L, skin->runspeed);
break; break;
case skin_thrustfactor: case skin_thrustfactor:
lua_pushinteger(L, skin->thrustfactor); lua_pushinteger(L, skin->thrustfactor);
@ -171,7 +171,7 @@ static int skin_get(lua_State *L)
lua_pushinteger(L, skin->acceleration); lua_pushinteger(L, skin->acceleration);
break; break;
case skin_jumpfactor: case skin_jumpfactor:
lua_pushinteger(L, skin->jumpfactor); lua_pushfixed(L, skin->jumpfactor);
break; break;
case skin_starttranscolor: case skin_starttranscolor:
lua_pushinteger(L, skin->starttranscolor); lua_pushinteger(L, skin->starttranscolor);
@ -244,7 +244,7 @@ static int lib_getSkin(lua_State *L)
{ {
i = luaL_checkinteger(L, 2); i = luaL_checkinteger(L, 2);
if (i < 0 || i >= MAXSKINS) if (i < 0 || i >= MAXSKINS)
return luaL_error(L, "skins[] index cannot exceed MAXSKINS"); return luaL_error(L, "skins[] index %d out of range (0 - %d)", i, MAXSKINS-1);
if (i >= numskins) if (i >= numskins)
return 0; return 0;
LUA_PushUserdata(L, &skins[i], META_SKIN); LUA_PushUserdata(L, &skins[i], META_SKIN);

View file

@ -1,7 +1,7 @@
// SONIC ROBO BLAST 2 // SONIC ROBO BLAST 2
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
// Copyright (C) 2012-2014 by John "JTE" Muniz. // Copyright (C) 2012-2016 by John "JTE" Muniz.
// Copyright (C) 2012-2014 by Sonic Team Junior. // Copyright (C) 2012-2016 by Sonic Team Junior.
// //
// This program is free software distributed under the // This program is free software distributed under the
// terms of the GNU General Public License, version 2. // terms of the GNU General Public License, version 2.

View file

@ -1,8 +1,8 @@
// SONIC ROBO BLAST 2 // SONIC ROBO BLAST 2
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
// Copyright (C) 2013-2014 by Matthew "Inuyasha" Walsh. // Copyright (C) 2013-2016 by Matthew "Inuyasha" Walsh.
// Copyright (C) 2013 by "Treeki" / "Ninjifox". // Copyright (C) 2013 by "Ninji".
// Copyright (C) 2013-2014 by Sonic Team Junior. // Copyright (C) 2013-2016 by Sonic Team Junior.
// //
// This program is free software distributed under the // This program is free software distributed under the
// terms of the GNU General Public License, version 2. // terms of the GNU General Public License, version 2.

View file

@ -1,7 +1,7 @@
// SONIC ROBO BLAST 2 // SONIC ROBO BLAST 2
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
// Copyright (C) 2013-2014 by Matthew "Inuyasha" Walsh. // Copyright (C) 2013-2016 by Matthew "Inuyasha" Walsh.
// Copyright (C) 2013-2014 by Sonic Team Junior. // Copyright (C) 2013-2016 by Sonic Team Junior.
// //
// This program is free software distributed under the // This program is free software distributed under the
// terms of the GNU General Public License, version 2. // terms of the GNU General Public License, version 2.

View file

@ -2,7 +2,7 @@
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
// Copyright (C) 1993-1996 by id Software, Inc. // Copyright (C) 1993-1996 by id Software, Inc.
// Copyright (C) 1998-2000 by DooM Legacy Team. // Copyright (C) 1998-2000 by DooM Legacy Team.
// Copyright (C) 1999-2014 by Sonic Team Junior. // Copyright (C) 1999-2016 by Sonic Team Junior.
// //
// This program is free software distributed under the // This program is free software distributed under the
// terms of the GNU General Public License, version 2. // terms of the GNU General Public License, version 2.

View file

@ -2,7 +2,7 @@
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
// Copyright (C) 1993-1996 by id Software, Inc. // Copyright (C) 1993-1996 by id Software, Inc.
// Copyright (C) 1998-2000 by DooM Legacy Team. // Copyright (C) 1998-2000 by DooM Legacy Team.
// Copyright (C) 1999-2014 by Sonic Team Junior. // Copyright (C) 1999-2016 by Sonic Team Junior.
// //
// This program is free software distributed under the // This program is free software distributed under the
// terms of the GNU General Public License, version 2. // terms of the GNU General Public License, version 2.

View file

@ -2,7 +2,7 @@
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
// Copyright (C) 1993-1996 by id Software, Inc. // Copyright (C) 1993-1996 by id Software, Inc.
// Copyright (C) 1998-2000 by DooM Legacy Team. // Copyright (C) 1998-2000 by DooM Legacy Team.
// Copyright (C) 1999-2014 by Sonic Team Junior. // Copyright (C) 1999-2016 by Sonic Team Junior.
// //
// This program is free software distributed under the // This program is free software distributed under the
// terms of the GNU General Public License, version 2. // terms of the GNU General Public License, version 2.

View file

@ -2,7 +2,7 @@
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
// Copyright (C) 1993-1996 by id Software, Inc. // Copyright (C) 1993-1996 by id Software, Inc.
// Copyright (C) 1998-2000 by DooM Legacy Team. // Copyright (C) 1998-2000 by DooM Legacy Team.
// Copyright (C) 1999-2014 by Sonic Team Junior. // Copyright (C) 1999-2016 by Sonic Team Junior.
// //
// This program is free software distributed under the // This program is free software distributed under the
// terms of the GNU General Public License, version 2. // terms of the GNU General Public License, version 2.

View file

@ -2,7 +2,7 @@
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
// Copyright (C) 1993-1996 by id Software, Inc. // Copyright (C) 1993-1996 by id Software, Inc.
// Copyright (C) 1998-2000 by DooM Legacy Team. // Copyright (C) 1998-2000 by DooM Legacy Team.
// Copyright (C) 1999-2014 by Sonic Team Junior. // Copyright (C) 1999-2016 by Sonic Team Junior.
// //
// This program is free software distributed under the // This program is free software distributed under the
// terms of the GNU General Public License, version 2. // terms of the GNU General Public License, version 2.
@ -31,6 +31,7 @@
#include "v_video.h" #include "v_video.h"
#include "z_zone.h" #include "z_zone.h"
#include "p_slopes.h"
#include "lua_script.h" #include "lua_script.h"
#include "lua_hook.h" #include "lua_hook.h"
@ -91,6 +92,33 @@ static UINT8 cheatf_warp(void)
return 1; return 1;
} }
#ifdef DEVELOP
static UINT8 cheatf_devmode(void)
{
UINT8 i;
if (modifiedgame)
return 0;
if (menuactive && currentMenu != &MainDef)
return 0; // Only on the main menu!
S_StartSound(0, sfx_itemup);
// Just unlock all the things and turn on -debug and console devmode.
G_SetGameModified(false);
for (i = 0; i < MAXUNLOCKABLES; i++)
unlockables[i].unlocked = true;
devparm = TRUE;
cv_debug |= 0x8000;
// Refresh secrets menu existing.
M_ClearMenus(true);
M_StartControlPanel();
return 1;
}
#endif
static cheatseq_t cheat_ultimate = { static cheatseq_t cheat_ultimate = {
0, cheatf_ultimate, 0, cheatf_ultimate,
{ SCRAMBLE('u'), SCRAMBLE('l'), SCRAMBLE('t'), SCRAMBLE('i'), SCRAMBLE('m'), SCRAMBLE('a'), SCRAMBLE('t'), SCRAMBLE('e'), 0xff } { SCRAMBLE('u'), SCRAMBLE('l'), SCRAMBLE('t'), SCRAMBLE('i'), SCRAMBLE('m'), SCRAMBLE('a'), SCRAMBLE('t'), SCRAMBLE('e'), 0xff }
@ -115,6 +143,14 @@ static cheatseq_t cheat_warp_joy = {
SCRAMBLE(KEY_LEFTARROW), SCRAMBLE(KEY_UPARROW), SCRAMBLE(KEY_LEFTARROW), SCRAMBLE(KEY_UPARROW),
SCRAMBLE(KEY_ENTER), 0xff } SCRAMBLE(KEY_ENTER), 0xff }
}; };
#ifdef DEVELOP
static cheatseq_t cheat_devmode = {
0, cheatf_devmode,
{ SCRAMBLE('d'), SCRAMBLE('e'), SCRAMBLE('v'), SCRAMBLE('m'), SCRAMBLE('o'), SCRAMBLE('d'), SCRAMBLE('e'), 0xff }
};
#endif
// ========================================================================== // ==========================================================================
// CHEAT SEQUENCE PACKAGE // CHEAT SEQUENCE PACKAGE
// ========================================================================== // ==========================================================================
@ -201,6 +237,9 @@ boolean cht_Responder(event_t *ev)
ret += cht_CheckCheat(&cheat_ultimate_joy, (char)ch); ret += cht_CheckCheat(&cheat_ultimate_joy, (char)ch);
ret += cht_CheckCheat(&cheat_warp, (char)ch); ret += cht_CheckCheat(&cheat_warp, (char)ch);
ret += cht_CheckCheat(&cheat_warp_joy, (char)ch); ret += cht_CheckCheat(&cheat_warp_joy, (char)ch);
#ifdef DEVELOP
ret += cht_CheckCheat(&cheat_devmode, (char)ch);
#endif
return (ret != 0); return (ret != 0);
} }
@ -560,9 +599,9 @@ void Command_CauseCfail_f(void)
} }
P_UnsetThingPosition(players[consoleplayer].mo); P_UnsetThingPosition(players[consoleplayer].mo);
P_Random(); P_RandomFixed();
P_Random(); P_RandomByte();
P_Random(); P_RandomFixed();
players[consoleplayer].mo->x = 0; players[consoleplayer].mo->x = 0;
players[consoleplayer].mo->y = 123311; //cfail cansuled kthxbye players[consoleplayer].mo->y = 123311; //cfail cansuled kthxbye
players[consoleplayer].mo->z = 123311; players[consoleplayer].mo->z = 123311;
@ -799,9 +838,19 @@ static void OP_CycleThings(INT32 amt)
static boolean OP_HeightOkay(player_t *player, UINT8 ceiling) static boolean OP_HeightOkay(player_t *player, UINT8 ceiling)
{ {
sector_t *sec = player->mo->subsector->sector;
if (ceiling) if (ceiling)
{ {
if (((player->mo->subsector->sector->ceilingheight - player->mo->z - player->mo->height)>>FRACBITS) >= (1 << (16-ZSHIFT))) #ifdef ESLOPE
// Truncate position to match where mapthing would be when spawned
// (this applies to every further P_GetZAt call as well)
fixed_t cheight = sec->c_slope ? P_GetZAt(sec->c_slope, player->mo->x & 0xFFFF0000, player->mo->y & 0xFFFF0000) : sec->ceilingheight;
#else
fixed_t cheight = sec->ceilingheight;
#endif
if (((cheight - player->mo->z - player->mo->height)>>FRACBITS) >= (1 << (16-ZSHIFT)))
{ {
CONS_Printf(M_GetText("Sorry, you're too %s to place this object (max: %d %s).\n"), M_GetText("low"), CONS_Printf(M_GetText("Sorry, you're too %s to place this object (max: %d %s).\n"), M_GetText("low"),
(1 << (16-ZSHIFT)), M_GetText("below top ceiling")); (1 << (16-ZSHIFT)), M_GetText("below top ceiling"));
@ -810,7 +859,12 @@ static boolean OP_HeightOkay(player_t *player, UINT8 ceiling)
} }
else else
{ {
if (((player->mo->z - player->mo->subsector->sector->floorheight)>>FRACBITS) >= (1 << (16-ZSHIFT))) #ifdef ESLOPE
fixed_t fheight = sec->f_slope ? P_GetZAt(sec->f_slope, player->mo->x & 0xFFFF0000, player->mo->y & 0xFFFF0000) : sec->floorheight;
#else
fixed_t fheight = sec->floorheight;
#endif
if (((player->mo->z - fheight)>>FRACBITS) >= (1 << (16-ZSHIFT)))
{ {
CONS_Printf(M_GetText("Sorry, you're too %s to place this object (max: %d %s).\n"), M_GetText("high"), CONS_Printf(M_GetText("Sorry, you're too %s to place this object (max: %d %s).\n"), M_GetText("high"),
(1 << (16-ZSHIFT)), M_GetText("above bottom floor")); (1 << (16-ZSHIFT)), M_GetText("above bottom floor"));
@ -822,21 +876,57 @@ static boolean OP_HeightOkay(player_t *player, UINT8 ceiling)
static mapthing_t *OP_CreateNewMapThing(player_t *player, UINT16 type, boolean ceiling) static mapthing_t *OP_CreateNewMapThing(player_t *player, UINT16 type, boolean ceiling)
{ {
mapthing_t *mt; mapthing_t *mt = mapthings;
sector_t *sec = player->mo->subsector->sector;
#ifdef HAVE_BLUA #ifdef HAVE_BLUA
LUA_InvalidateMapthings(); LUA_InvalidateMapthings();
#endif #endif
mapthings = Z_Realloc(mapthings, ++nummapthings * sizeof (*mapthings), PU_LEVEL, NULL); 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 = (mapthings+nummapthings-1);
mt->type = type; mt->type = type;
mt->x = (INT16)(player->mo->x>>FRACBITS); mt->x = (INT16)(player->mo->x>>FRACBITS);
mt->y = (INT16)(player->mo->y>>FRACBITS); mt->y = (INT16)(player->mo->y>>FRACBITS);
if (ceiling) if (ceiling)
mt->options = (UINT16)((player->mo->subsector->sector->ceilingheight - player->mo->z - player->mo->height)>>FRACBITS); {
#ifdef ESLOPE
fixed_t cheight = sec->c_slope ? P_GetZAt(sec->c_slope, mt->x << FRACBITS, mt->y << FRACBITS) : sec->ceilingheight;
#else
fixed_t cheight = sec->ceilingheight;
#endif
mt->options = (UINT16)((cheight - player->mo->z - player->mo->height)>>FRACBITS);
}
else else
mt->options = (UINT16)((player->mo->z - player->mo->subsector->sector->floorheight)>>FRACBITS); {
#ifdef ESLOPE
fixed_t fheight = sec->f_slope ? P_GetZAt(sec->f_slope, mt->x << FRACBITS, mt->y << FRACBITS) : sec->floorheight;
#else
fixed_t fheight = sec->floorheight;
#endif
mt->options = (UINT16)((player->mo->z - fheight)>>FRACBITS);
}
mt->options <<= ZSHIFT; mt->options <<= ZSHIFT;
mt->angle = (INT16)(FixedInt(AngleFixed(player->mo->angle))); mt->angle = (INT16)(FixedInt(AngleFixed(player->mo->angle)));
@ -890,6 +980,13 @@ void OP_NightsObjectplace(player_t *player)
{ {
UINT16 angle = (UINT16)(player->anotherflyangle % 360); UINT16 angle = (UINT16)(player->anotherflyangle % 360);
INT16 temp = (INT16)FixedInt(AngleFixed(player->mo->angle)); // Traditional 2D Angle INT16 temp = (INT16)FixedInt(AngleFixed(player->mo->angle)); // Traditional 2D Angle
sector_t *sec = player->mo->subsector->sector;
#ifdef ESLOPE
fixed_t fheight = sec->f_slope ? P_GetZAt(sec->f_slope, player->mo->x & 0xFFFF0000, player->mo->y & 0xFFFF0000) : sec->floorheight;
#else
fixed_t fheight = sec->floorheight;
#endif
player->pflags |= PF_ATTACKDOWN; player->pflags |= PF_ATTACKDOWN;
@ -904,7 +1001,7 @@ void OP_NightsObjectplace(player_t *player)
temp += 90; temp += 90;
temp %= 360; temp %= 360;
mt->options = (UINT16)((player->mo->z - player->mo->subsector->sector->floorheight)>>FRACBITS); mt->options = (UINT16)((player->mo->z - fheight)>>FRACBITS);
mt->angle = (INT16)(mt->angle+(INT16)((FixedInt(FixedDiv(temp*FRACUNIT, 360*(FRACUNIT/256))))<<8)); mt->angle = (INT16)(mt->angle+(INT16)((FixedInt(FixedDiv(temp*FRACUNIT, 360*(FRACUNIT/256))))<<8));
P_SpawnHoopsAndRings(mt); P_SpawnHoopsAndRings(mt);
@ -1038,6 +1135,33 @@ void OP_ObjectplaceMovement(player_t *player)
else else
player->viewz = player->mo->z + player->viewheight; player->viewz = player->mo->z + player->viewheight;
// Display flag information
// Moved up so it always updates.
{
sector_t *sec = player->mo->subsector->sector;
if (!!(mobjinfo[op_currentthing].flags & MF_SPAWNCEILING) ^ !!(cv_opflags.value & MTF_OBJECTFLIP))
{
#ifdef ESLOPE
fixed_t cheight = sec->c_slope ? P_GetZAt(sec->c_slope, player->mo->x & 0xFFFF0000, player->mo->y & 0xFFFF0000) : sec->ceilingheight;
#else
fixed_t cheight = sec->ceilingheight;
#endif
op_displayflags = (UINT16)((cheight - player->mo->z - mobjinfo[op_currentthing].height)>>FRACBITS);
}
else
{
#ifdef ESLOPE
fixed_t fheight = sec->f_slope ? P_GetZAt(sec->f_slope, player->mo->x & 0xFFFF0000, player->mo->y & 0xFFFF0000) : sec->floorheight;
#else
fixed_t fheight = sec->floorheight;
#endif
op_displayflags = (UINT16)((player->mo->z - fheight)>>FRACBITS);
}
op_displayflags <<= ZSHIFT;
op_displayflags |= (UINT16)cv_opflags.value;
}
if (player->pflags & PF_ATTACKDOWN) if (player->pflags & PF_ATTACKDOWN)
{ {
// Are ANY objectplace buttons pressed? If no, remove flag. // Are ANY objectplace buttons pressed? If no, remove flag.
@ -1103,16 +1227,6 @@ void OP_ObjectplaceMovement(player_t *player)
CONS_Printf(M_GetText("Placed object type %d at %d, %d, %d, %d\n"), mt->type, mt->x, mt->y, mt->options>>ZSHIFT, mt->angle); CONS_Printf(M_GetText("Placed object type %d at %d, %d, %d, %d\n"), mt->type, mt->x, mt->y, mt->options>>ZSHIFT, mt->angle);
} }
// Display flag information
{
if (!!(mobjinfo[op_currentthing].flags & MF_SPAWNCEILING) ^ !!(cv_opflags.value & MTF_OBJECTFLIP))
op_displayflags = (UINT16)((player->mo->subsector->sector->ceilingheight - player->mo->z - mobjinfo[op_currentthing].height)>>FRACBITS);
else
op_displayflags = (UINT16)((player->mo->z - player->mo->subsector->sector->floorheight)>>FRACBITS);
op_displayflags <<= ZSHIFT;
op_displayflags |= (UINT16)cv_opflags.value;
}
} }
// //

View file

@ -2,7 +2,7 @@
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
// Copyright (C) 1993-1996 by id Software, Inc. // Copyright (C) 1993-1996 by id Software, Inc.
// Copyright (C) 1998-2000 by DooM Legacy Team. // Copyright (C) 1998-2000 by DooM Legacy Team.
// Copyright (C) 1999-2014 by Sonic Team Junior. // Copyright (C) 1999-2016 by Sonic Team Junior.
// //
// This program is free software distributed under the // This program is free software distributed under the
// terms of the GNU General Public License, version 2. // terms of the GNU General Public License, version 2.

View file

@ -1,7 +1,7 @@
// SONIC ROBO BLAST 2 // SONIC ROBO BLAST 2
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
// Copyright (C) 2012-2014 by Matthew "Inuyasha" Walsh. // Copyright (C) 2012-2016 by Matthew "Inuyasha" Walsh.
// Copyright (C) 2012-2014 by Sonic Team Junior. // Copyright (C) 2012-2016 by Sonic Team Junior.
// //
// This program is free software distributed under the // This program is free software distributed under the
// terms of the GNU General Public License, version 2. // terms of the GNU General Public License, version 2.

View file

@ -1,7 +1,7 @@
// SONIC ROBO BLAST 2 // SONIC ROBO BLAST 2
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
// Copyright (C) 2012-2014 by Matthew "Inuyasha" Walsh. // Copyright (C) 2012-2016 by Matthew "Inuyasha" Walsh.
// Copyright (C) 2012-2014 by Sonic Team Junior. // Copyright (C) 2012-2016 by Sonic Team Junior.
// //
// This program is free software distributed under the // This program is free software distributed under the
// terms of the GNU General Public License, version 2. // terms of the GNU General Public License, version 2.

View file

@ -1,7 +1,7 @@
// SONIC ROBO BLAST 2 // SONIC ROBO BLAST 2
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
// Copyright (C) 2005 by James Haley // Copyright (C) 2005 by James Haley
// Copyright (C) 2005-2014 by Sonic Team Junior. // Copyright (C) 2005-2016 by Sonic Team Junior.
// //
// This program is free software distributed under the // This program is free software distributed under the
// terms of the GNU General Public License, version 2. // terms of the GNU General Public License, version 2.

View file

@ -2,7 +2,7 @@
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
// Copyright (C) 1993-1996 by id Software, Inc. // Copyright (C) 1993-1996 by id Software, Inc.
// Copyright (C) 1998-2000 by DooM Legacy Team. // Copyright (C) 1998-2000 by DooM Legacy Team.
// Copyright (C) 1999-2014 by Sonic Team Junior. // Copyright (C) 1999-2016 by Sonic Team Junior.
// //
// This program is free software distributed under the // This program is free software distributed under the
// terms of the GNU General Public License, version 2. // terms of the GNU General Public License, version 2.
@ -119,8 +119,6 @@ fixed_t FixedHypot(fixed_t x, fixed_t y)
return FixedMul(ax, yx1); // |x|*((1 + (x/y)^2)^1/2) return FixedMul(ax, yx1); // |x|*((1 + (x/y)^2)^1/2)
} }
#ifdef NEED_FIXED_VECTOR
vector2_t *FV2_Load(vector2_t *vec, fixed_t x, fixed_t y) vector2_t *FV2_Load(vector2_t *vec, fixed_t x, fixed_t y)
{ {
vec->x = x; vec->x = x;
@ -863,8 +861,6 @@ void FM_Scale(matrix_t *dest, fixed_t x, fixed_t y, fixed_t z)
#undef M #undef M
} }
#endif
#ifdef M_TESTCASE #ifdef M_TESTCASE
//#define MULDIV_TEST //#define MULDIV_TEST
#define SQRT_TEST #define SQRT_TEST

View file

@ -2,7 +2,7 @@
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
// Copyright (C) 1993-1996 by id Software, Inc. // Copyright (C) 1993-1996 by id Software, Inc.
// Copyright (C) 1998-2000 by DooM Legacy Team. // Copyright (C) 1998-2000 by DooM Legacy Team.
// Copyright (C) 1999-2014 by Sonic Team Junior. // Copyright (C) 1999-2016 by Sonic Team Junior.
// //
// This program is free software distributed under the // This program is free software distributed under the
// terms of the GNU General Public License, version 2. // terms of the GNU General Public License, version 2.
@ -357,8 +357,6 @@ FUNCMATH FUNCINLINE static ATTRINLINE fixed_t FixedRound(fixed_t x)
return INT32_MAX; return INT32_MAX;
} }
#ifdef NEED_FIXED_VECTOR
typedef struct typedef struct
{ {
fixed_t x; fixed_t x;
@ -437,6 +435,4 @@ void FM_MultMatrix(matrix_t *dest, const matrix_t *multme);
void FM_Translate(matrix_t *dest, fixed_t x, fixed_t y, fixed_t z); void FM_Translate(matrix_t *dest, fixed_t x, fixed_t y, fixed_t z);
void FM_Scale(matrix_t *dest, fixed_t x, fixed_t y, fixed_t z); void FM_Scale(matrix_t *dest, fixed_t x, fixed_t y, fixed_t z);
#endif // defined NEED_FIXED_VECTOR
#endif //m_fixed.h #endif //m_fixed.h

View file

@ -2,8 +2,8 @@
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
// Copyright (C) 1993-1996 by id Software, Inc. // Copyright (C) 1993-1996 by id Software, Inc.
// Copyright (C) 1998-2000 by DooM Legacy Team. // Copyright (C) 1998-2000 by DooM Legacy Team.
// Copyright (C) 2011-2014 by Matthew "Inuyasha" Walsh. // Copyright (C) 2011-2016 by Matthew "Inuyasha" Walsh.
// Copyright (C) 1999-2014 by Sonic Team Junior. // Copyright (C) 1999-2016 by Sonic Team Junior.
// //
// This program is free software distributed under the // This program is free software distributed under the
// terms of the GNU General Public License, version 2. // terms of the GNU General Public License, version 2.
@ -2059,6 +2059,10 @@ static void M_PrevOpt(void)
} while (oldItemOn != itemOn && (currentMenu->menuitems[itemOn].status & IT_TYPE) == IT_SPACE); } while (oldItemOn != itemOn && (currentMenu->menuitems[itemOn].status & IT_TYPE) == IT_SPACE);
} }
// lock out further input in a tic when important buttons are pressed
// (in other words -- stop bullshit happening by mashing buttons in fades)
static boolean noFurtherInput = false;
// //
// M_Responder // M_Responder
// //
@ -2081,6 +2085,12 @@ boolean M_Responder(event_t *ev)
shiftdown = false; shiftdown = false;
return false; return false;
} }
if (noFurtherInput)
{
// Ignore input after enter/escape/other buttons
// (but still allow shift keyup so caps doesn't get stuck)
return false;
}
else if (ev->type == ev_keydown) else if (ev->type == ev_keydown)
{ {
ch = ev->data1; ch = ev->data1;
@ -2182,6 +2192,7 @@ boolean M_Responder(event_t *ev)
// F-Keys // F-Keys
if (!menuactive) if (!menuactive)
{ {
noFurtherInput = true;
switch (ch) switch (ch)
{ {
case KEY_F1: // Help key case KEY_F1: // Help key
@ -2252,6 +2263,7 @@ boolean M_Responder(event_t *ev)
M_StartControlPanel(); M_StartControlPanel();
return true; return true;
} }
noFurtherInput = false; // turns out we didn't care
return false; return false;
} }
@ -2275,6 +2287,7 @@ boolean M_Responder(event_t *ev)
if (routine) if (routine)
routine(ch); routine(ch);
M_StopMessage(0); M_StopMessage(0);
noFurtherInput = true;
return true; return true;
} }
return true; return true;
@ -2354,6 +2367,7 @@ boolean M_Responder(event_t *ev)
return true; return true;
case KEY_ENTER: case KEY_ENTER:
noFurtherInput = true;
currentMenu->lastOn = itemOn; currentMenu->lastOn = itemOn;
if (routine) if (routine)
{ {
@ -2387,6 +2401,7 @@ boolean M_Responder(event_t *ev)
return true; return true;
case KEY_ESCAPE: case KEY_ESCAPE:
noFurtherInput = true;
currentMenu->lastOn = itemOn; currentMenu->lastOn = itemOn;
if (currentMenu->prevMenu) if (currentMenu->prevMenu)
{ {
@ -2443,35 +2458,45 @@ void M_Drawer(void)
if (currentMenu == &MessageDef) if (currentMenu == &MessageDef)
menuactive = true; menuactive = true;
if (!menuactive) if (menuactive)
return;
// now that's more readable with a faded background (yeah like Quake...)
if (!WipeInAction)
V_DrawFadeScreen();
if (currentMenu->drawroutine)
currentMenu->drawroutine(); // call current menu Draw routine
// Draw version down in corner
// ... but only in the MAIN MENU. I'm a picky bastard.
if (currentMenu == &MainDef)
{ {
if (customversionstring[0] != '\0') // now that's more readable with a faded background (yeah like Quake...)
{ if (!WipeInAction)
V_DrawThinString(vid.dupx, vid.height - 17*vid.dupy, V_NOSCALESTART|V_TRANSLUCENT, "Mod version:"); V_DrawFadeScreen();
V_DrawThinString(vid.dupx, vid.height - 9*vid.dupy, V_NOSCALESTART|V_TRANSLUCENT|V_ALLOWLOWERCASE, customversionstring);
} if (currentMenu->drawroutine)
else currentMenu->drawroutine(); // call current menu Draw routine
// Draw version down in corner
// ... but only in the MAIN MENU. I'm a picky bastard.
if (currentMenu == &MainDef)
{ {
if (customversionstring[0] != '\0')
{
V_DrawThinString(vid.dupx, vid.height - 17*vid.dupy, V_NOSCALESTART|V_TRANSLUCENT, "Mod version:");
V_DrawThinString(vid.dupx, vid.height - 9*vid.dupy, V_NOSCALESTART|V_TRANSLUCENT|V_ALLOWLOWERCASE, customversionstring);
}
else
{
#ifdef DEVELOP // Development -- show revision / branch info #ifdef DEVELOP // Development -- show revision / branch info
V_DrawThinString(vid.dupx, vid.height - 17*vid.dupy, V_NOSCALESTART|V_TRANSLUCENT|V_ALLOWLOWERCASE, compbranch); V_DrawThinString(vid.dupx, vid.height - 17*vid.dupy, V_NOSCALESTART|V_TRANSLUCENT|V_ALLOWLOWERCASE, compbranch);
V_DrawThinString(vid.dupx, vid.height - 9*vid.dupy, V_NOSCALESTART|V_TRANSLUCENT|V_ALLOWLOWERCASE, comprevision); V_DrawThinString(vid.dupx, vid.height - 9*vid.dupy, V_NOSCALESTART|V_TRANSLUCENT|V_ALLOWLOWERCASE, comprevision);
#else // Regular build #else // Regular build
V_DrawThinString(vid.dupx, vid.height - 9*vid.dupy, V_NOSCALESTART|V_TRANSLUCENT|V_ALLOWLOWERCASE, va("%s", VERSIONSTRING)); V_DrawThinString(vid.dupx, vid.height - 9*vid.dupy, V_NOSCALESTART|V_TRANSLUCENT|V_ALLOWLOWERCASE, va("%s", VERSIONSTRING));
#endif #endif
}
} }
} }
// focus lost notification goes on top of everything, even the former everything
if (window_notinfocus)
{
M_DrawTextBox((BASEVIDWIDTH/2) - (60), (BASEVIDHEIGHT/2) - (16), 13, 2);
if (gamestate == GS_LEVEL && (P_AutoPause() || paused))
V_DrawCenteredString(BASEVIDWIDTH/2, (BASEVIDHEIGHT/2) - (4), V_YELLOWMAP, "Game Paused");
else
V_DrawCenteredString(BASEVIDWIDTH/2, (BASEVIDHEIGHT/2) - (4), V_YELLOWMAP, "Focus Lost");
}
} }
// //
@ -2656,6 +2681,9 @@ void M_SetupNextMenu(menu_t *menudef)
// //
void M_Ticker(void) void M_Ticker(void)
{ {
// reset input trigger
noFurtherInput = false;
if (dedicated) if (dedicated)
return; return;
@ -4751,7 +4779,7 @@ static void M_SetupChoosePlayer(INT32 choice)
if (Playing() == false) if (Playing() == false)
{ {
S_StopMusic(); S_StopMusic();
S_ChangeMusic(mus_chrsel, true); S_ChangeMusicInternal("chrsel", true);
} }
SP_PlayerDef.prevMenu = currentMenu; SP_PlayerDef.prevMenu = currentMenu;
@ -5202,7 +5230,7 @@ void M_DrawTimeAttackMenu(void)
lumpnum_t lumpnum; lumpnum_t lumpnum;
char beststr[40]; char beststr[40];
S_ChangeMusic(mus_racent, true); // Eww, but needed for when user hits escape during demo playback S_ChangeMusicInternal("racent", true); // Eww, but needed for when user hits escape during demo playback
V_DrawPatchFill(W_CachePatchName("SRB2BACK", PU_CACHE)); V_DrawPatchFill(W_CachePatchName("SRB2BACK", PU_CACHE));
@ -5365,7 +5393,7 @@ static void M_TimeAttack(INT32 choice)
itemOn = tastart; // "Start" is selected. itemOn = tastart; // "Start" is selected.
G_SetGamestate(GS_TIMEATTACK); G_SetGamestate(GS_TIMEATTACK);
S_ChangeMusic(mus_racent, true); S_ChangeMusicInternal("racent", true);
} }
// Drawing function for Nights Attack // Drawing function for Nights Attack
@ -5375,7 +5403,7 @@ void M_DrawNightsAttackMenu(void)
lumpnum_t lumpnum; lumpnum_t lumpnum;
char beststr[40]; char beststr[40];
S_ChangeMusic(mus_racent, true); // Eww, but needed for when user hits escape during demo playback S_ChangeMusicInternal("racent", true); // Eww, but needed for when user hits escape during demo playback
V_DrawPatchFill(W_CachePatchName("SRB2BACK", PU_CACHE)); V_DrawPatchFill(W_CachePatchName("SRB2BACK", PU_CACHE));
@ -5498,7 +5526,7 @@ static void M_NightsAttack(INT32 choice)
itemOn = nastart; // "Start" is selected. itemOn = nastart; // "Start" is selected.
G_SetGamestate(GS_TIMEATTACK); G_SetGamestate(GS_TIMEATTACK);
S_ChangeMusic(mus_racent, true); S_ChangeMusicInternal("racent", true);
} }
// Player has selected the "START" from the nights attack screen // Player has selected the "START" from the nights attack screen
@ -5732,7 +5760,7 @@ static void M_ModeAttackEndGame(INT32 choice)
itemOn = currentMenu->lastOn; itemOn = currentMenu->lastOn;
G_SetGamestate(GS_TIMEATTACK); G_SetGamestate(GS_TIMEATTACK);
modeattacking = ATTACKING_NONE; modeattacking = ATTACKING_NONE;
S_ChangeMusic(mus_racent, true); S_ChangeMusicInternal("racent", true);
// Update replay availability. // Update replay availability.
CV_AddValue(&cv_nextmap, 1); CV_AddValue(&cv_nextmap, 1);
CV_AddValue(&cv_nextmap, -1); CV_AddValue(&cv_nextmap, -1);
@ -6944,7 +6972,7 @@ static void M_ToggleDigital(void)
if (nodigimusic) return; if (nodigimusic) return;
S_Init(cv_soundvolume.value, cv_digmusicvolume.value, cv_midimusicvolume.value); S_Init(cv_soundvolume.value, cv_digmusicvolume.value, cv_midimusicvolume.value);
S_StopMusic(); S_StopMusic();
S_ChangeMusic(mus_lclear, false); S_ChangeMusicInternal("lclear", false);
M_StartMessage(M_GetText("Digital Music Enabled\n"), NULL, MM_NOTHING); M_StartMessage(M_GetText("Digital Music Enabled\n"), NULL, MM_NOTHING);
} }
else else
@ -6971,7 +6999,7 @@ static void M_ToggleMIDI(void)
I_InitMIDIMusic(); I_InitMIDIMusic();
if (nomidimusic) return; if (nomidimusic) return;
S_Init(cv_soundvolume.value, cv_digmusicvolume.value, cv_midimusicvolume.value); S_Init(cv_soundvolume.value, cv_digmusicvolume.value, cv_midimusicvolume.value);
S_ChangeMusic(mus_lclear, false); S_ChangeMusicInternal("lclear", false);
M_StartMessage(M_GetText("MIDI Music Enabled\n"), NULL, MM_NOTHING); M_StartMessage(M_GetText("MIDI Music Enabled\n"), NULL, MM_NOTHING);
} }
else else

View file

@ -2,8 +2,8 @@
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
// Copyright (C) 1993-1996 by id Software, Inc. // Copyright (C) 1993-1996 by id Software, Inc.
// Copyright (C) 1998-2000 by DooM Legacy Team. // Copyright (C) 1998-2000 by DooM Legacy Team.
// Copyright (C) 2011-2014 by Matthew "Inuyasha" Walsh. // Copyright (C) 2011-2016 by Matthew "Inuyasha" Walsh.
// Copyright (C) 1999-2014 by Sonic Team Junior. // Copyright (C) 1999-2016 by Sonic Team Junior.
// //
// This program is free software distributed under the // This program is free software distributed under the
// terms of the GNU General Public License, version 2. // terms of the GNU General Public License, version 2.

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