Merge branch 'master' of git@git.magicalgirl.moe:STJr/SRB2Internal.git into reduced_palette

Conflicts:
	src/dehacked.c
This commit is contained in:
Yukita Mayako 2015-11-09 14:34:26 -05:00
commit ca7151f1c2
76 changed files with 9364 additions and 4546 deletions

433
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" />
@ -4141,283 +4141,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 +4477,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

@ -150,6 +150,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 +163,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

@ -454,6 +454,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

@ -273,11 +273,11 @@ void B_RespawnBot(INT32 playernum)
P_TeleportMove(tails, x, y, z); P_TeleportMove(tails, x, y, z);
if (player->charability == CA_FLY) if (player->charability == CA_FLY)
{ {
P_SetPlayerMobjState(tails, S_PLAY_ABL1); P_SetPlayerMobjState(tails, S_PLAY_FLY);
tails->player->powers[pw_tailsfly] = (UINT16)-1; tails->player->powers[pw_tailsfly] = (UINT16)-1;
} }
else else
P_SetPlayerMobjState(tails, S_PLAY_FALL1); P_SetPlayerMobjState(tails, S_PLAY_FALL);
P_SetScale(tails, sonic->scale); P_SetScale(tails, sonic->scale);
tails->destscale = sonic->destscale; tails->destscale = sonic->destscale;
} }

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

@ -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;
@ -634,6 +638,10 @@ void D_SRB2Loop(void)
#ifdef HW3SOUND #ifdef HW3SOUND
HW3S_EndFrameUpdate(); HW3S_EndFrameUpdate();
#endif #endif
#ifdef HAVE_BLUA
LUA_Step();
#endif
} }
} }
@ -943,9 +951,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
@ -1118,7 +1126,7 @@ 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

View File

@ -1911,7 +1911,7 @@ static void Got_Suicide(UINT8 **cp, INT32 playernum)
} }
if (players[suicideplayer].mo) if (players[suicideplayer].mo)
P_DamageMobj(players[suicideplayer].mo, NULL, NULL, 10000); P_DamageMobj(players[suicideplayer].mo, NULL, NULL, 1, DMG_INSTAKILL);
} }
/** Deals with an ::XD_RANDOMSEED message in a netgame. /** Deals with an ::XD_RANDOMSEED message in a netgame.
@ -2442,7 +2442,7 @@ static void Got_Teamchange(UINT8 **cp, INT32 playernum)
if (players[playernum].mo) if (players[playernum].mo)
{ {
if (!players[playernum].spectator) if (!players[playernum].spectator)
P_DamageMobj(players[playernum].mo, NULL, NULL, 10000); P_DamageMobj(players[playernum].mo, NULL, NULL, 1, DMG_INSTAKILL);
else else
{ {
P_RemoveMobj(players[playernum].mo); P_RemoveMobj(players[playernum].mo);
@ -3193,7 +3193,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.

View File

@ -161,11 +161,15 @@ typedef enum
// Are animation frames playing? // Are animation frames playing?
PA_ETC=0, PA_ETC=0,
PA_IDLE, PA_IDLE,
PA_EDGE,
PA_WALK, PA_WALK,
PA_RUN, PA_RUN,
PA_PAIN,
PA_ROLL, PA_ROLL,
PA_JUMP,
PA_FALL, PA_FALL,
PA_ABILITY PA_ABILITY,
PA_RIDE
} panim_t; } panim_t;
typedef enum typedef enum

View File

@ -473,6 +473,7 @@ static void readPlayer(MYFILE *f, INT32 num)
if (!slotfound && (slotfound = findFreeSlot(&num)) == false) if (!slotfound && (slotfound = findFreeSlot(&num)) == false)
goto done; goto done;
PlayerMenu[num].status = IT_CALL;
for (i = 0; i < MAXLINELEN-3; i++) for (i = 0; i < MAXLINELEN-3; i++)
{ {
@ -545,6 +546,7 @@ static void readPlayer(MYFILE *f, INT32 num)
if (!slotfound && (slotfound = findFreeSlot(&num)) == false) if (!slotfound && (slotfound = findFreeSlot(&num)) == false)
goto done; goto done;
DEH_WriteUndoline(word, &description[num].picname[0], UNDO_NONE); DEH_WriteUndoline(word, &description[num].picname[0], UNDO_NONE);
PlayerMenu[num].status = IT_CALL;
strncpy(description[num].picname, word2, 8); strncpy(description[num].picname, word2, 8);
} }
else if (fastcmp(word, "STATUS")) else if (fastcmp(word, "STATUS"))
@ -576,6 +578,8 @@ static void readPlayer(MYFILE *f, INT32 num)
if (!slotfound && (slotfound = findFreeSlot(&num)) == false) if (!slotfound && (slotfound = findFreeSlot(&num)) == false)
goto done; goto done;
DEH_WriteUndoline(word, description[num].skinname, UNDO_NONE); DEH_WriteUndoline(word, description[num].skinname, UNDO_NONE);
PlayerMenu[num].status = IT_CALL;
strlcpy(description[num].skinname, word2, sizeof description[num].skinname); strlcpy(description[num].skinname, word2, sizeof description[num].skinname);
strlwr(description[num].skinname); strlwr(description[num].skinname);
} }
@ -994,7 +998,7 @@ static const struct {
static void readlevelheader(MYFILE *f, INT32 num) static void readlevelheader(MYFILE *f, INT32 num)
{ {
char *s = Z_Malloc(MAXLINELEN, PU_STATIC, NULL); char *s = Z_Malloc(MAXLINELEN, PU_STATIC, NULL);
char *word = s; char *word;
char *word2; char *word2;
//char *word3; // Non-uppercase version of word2 //char *word3; // Non-uppercase version of word2
char *tmp; char *tmp;
@ -1023,6 +1027,9 @@ static void readlevelheader(MYFILE *f, INT32 num)
if (s == tmp) if (s == tmp)
continue; // Skip comment lines, but don't break. continue; // Skip comment lines, but don't break.
// Set / reset word, because some things (Lua.) move it
word = s;
// Get the part before the " = " // Get the part before the " = "
tmp = strchr(s, '='); tmp = strchr(s, '=');
*(tmp-1) = '\0'; *(tmp-1) = '\0';
@ -3736,52 +3743,48 @@ static const char *const STATE_LIST[] = { // array length left dynamic for sanit
// Thok // Thok
"S_THOK", "S_THOK",
// Player
"S_PLAY_STND", "S_PLAY_STND",
"S_PLAY_TAP1", "S_PLAY_WAIT",
"S_PLAY_TAP2", "S_PLAY_WALK",
"S_PLAY_RUN1", "S_PLAY_RUN",
"S_PLAY_RUN2",
"S_PLAY_RUN3",
"S_PLAY_RUN4",
"S_PLAY_RUN5",
"S_PLAY_RUN6",
"S_PLAY_RUN7",
"S_PLAY_RUN8",
"S_PLAY_SPD1",
"S_PLAY_SPD2",
"S_PLAY_SPD3",
"S_PLAY_SPD4",
"S_PLAY_ATK1",
"S_PLAY_ATK2",
"S_PLAY_ATK3",
"S_PLAY_ATK4",
"S_PLAY_SPRING",
"S_PLAY_FALL1",
"S_PLAY_FALL2",
"S_PLAY_ABL1",
"S_PLAY_ABL2",
"S_PLAY_SPC1",
"S_PLAY_SPC2",
"S_PLAY_SPC3",
"S_PLAY_SPC4",
"S_PLAY_CLIMB1",
"S_PLAY_CLIMB2",
"S_PLAY_CLIMB3",
"S_PLAY_CLIMB4",
"S_PLAY_CLIMB5",
"S_PLAY_GASP",
"S_PLAY_PAIN", "S_PLAY_PAIN",
"S_PLAY_DIE", "S_PLAY_DEAD",
"S_PLAY_TEETER1", "S_PLAY_DRWN",
"S_PLAY_TEETER2", "S_PLAY_SPIN",
"S_PLAY_CARRY", "S_PLAY_DASH",
"S_PLAY_SUPERSTAND", "S_PLAY_GASP",
"S_PLAY_SUPERWALK1", "S_PLAY_JUMP",
"S_PLAY_SUPERWALK2", "S_PLAY_FALL",
"S_PLAY_SUPERFLY1", "S_PLAY_EDGE",
"S_PLAY_SUPERFLY2", "S_PLAY_RIDE",
"S_PLAY_SUPERTEETER",
"S_PLAY_SUPERHIT", // CA_FLY
"S_PLAY_FLY",
"S_PLAY_FLY_TIRED",
// CA_GLIDEANDCLIMB
"S_PLAY_GLIDE",
"S_PLAY_CLING",
"S_PLAY_CLIMB",
// SF_SUPERANIMS
"S_PLAY_SUPER_STND",
"S_PLAY_SUPER_WALK",
"S_PLAY_SUPER_RUN",
"S_PLAY_SUPER_PAIN",
"S_PLAY_SUPER_STUN",
"S_PLAY_SUPER_DEAD",
"S_PLAY_SUPER_DRWN",
"S_PLAY_SUPER_SPIN",
"S_PLAY_SUPER_GASP",
"S_PLAY_SUPER_JUMP",
"S_PLAY_SUPER_FALL",
"S_PLAY_SUPER_EDGE",
"S_PLAY_SUPER_RIDE",
"S_PLAY_SUPER_FLOAT",
// SF_SUPER
"S_PLAY_SUPERTRANS1", "S_PLAY_SUPERTRANS1",
"S_PLAY_SUPERTRANS2", "S_PLAY_SUPERTRANS2",
"S_PLAY_SUPERTRANS3", "S_PLAY_SUPERTRANS3",
@ -3807,7 +3810,6 @@ static const char *const STATE_LIST[] = { // array length left dynamic for sanit
// 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",
@ -3817,7 +3819,6 @@ static const char *const STATE_LIST[] = { // array length left dynamic for sanit
// 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",
@ -4534,7 +4535,7 @@ static const char *const STATE_LIST[] = { // array length left dynamic for sanit
// S_PLAY_TAP1 // S_PLAY_TAP1
"S_METALSONIC_WAIT1", "S_METALSONIC_WAIT1",
"S_METALSONIC_WAIT2", "S_METALSONIC_WAIT2",
// S_PLAY_RUN1 // S_PLAY_WALK
"S_METALSONIC_WALK1", "S_METALSONIC_WALK1",
"S_METALSONIC_WALK2", "S_METALSONIC_WALK2",
"S_METALSONIC_WALK3", "S_METALSONIC_WALK3",
@ -7172,7 +7173,6 @@ static const char *const MOBJFLAG2_LIST[] = {
"EXPLOSION", // Thrown ring has explosive properties "EXPLOSION", // Thrown ring has explosive properties
"SCATTER", // Thrown ring has scatter properties "SCATTER", // Thrown ring has scatter properties
"BEYONDTHEGRAVE",// Source of this missile has died and has since respawned. "BEYONDTHEGRAVE",// Source of this missile has died and has since respawned.
"PUSHED", // Mobj was already pushed this tic
"SLIDEPUSH", // MF_PUSHABLE that pushes continuously. "SLIDEPUSH", // MF_PUSHABLE that pushes continuously.
"CLASSICPUSH", // Drops straight down when object has negative Z. "CLASSICPUSH", // Drops straight down when object has negative Z.
"STANDONME", // While not pushable, stand on me anyway. "STANDONME", // While not pushable, stand on me anyway.
@ -7201,6 +7201,9 @@ static const char *const MOBJEFLAG_LIST[] = {
"JUSTSTEPPEDDOWN", // used for ramp sectors "JUSTSTEPPEDDOWN", // used for ramp sectors
"VERTICALFLIP", // Vertically flip sprite/allow upside-down physics "VERTICALFLIP", // Vertically flip sprite/allow upside-down physics
"GOOWATER", // Goo water "GOOWATER", // Goo water
"PUSHED", // Mobj was already pushed this tic
"SPRUNG", // Mobj was already sprung this tic
"APPLYPMOMZ", // Platform movement
NULL NULL
}; };
@ -7303,6 +7306,7 @@ static const char *const ML_LIST[16] = {
}; };
// This DOES differ from r_draw's Color_Names, unfortunately. // This DOES differ from r_draw's Color_Names, unfortunately.
// Also includes Super colors
static const char *COLOR_ENUMS[] = { static const char *COLOR_ENUMS[] = {
"NONE", // SKINCOLOR_NONE "NONE", // SKINCOLOR_NONE
"WHITE", // SKINCOLOR_WHITE "WHITE", // SKINCOLOR_WHITE
@ -7334,6 +7338,24 @@ static const char *COLOR_ENUMS[] = {
"MAGENTA", // SKINCOLOR_MAGENTA "MAGENTA", // SKINCOLOR_MAGENTA
"PINK", // SKINCOLOR_PINK "PINK", // SKINCOLOR_PINK
"ROSY" // SKINCOLOR_ROSY "ROSY" // SKINCOLOR_ROSY
// Super special awesome Super flashing colors!
"SUPER1", // SKINCOLOR_SUPER1
"SUPER2", // SKINCOLOR_SUPER2,
"SUPER3", // SKINCOLOR_SUPER3,
"SUPER4", // SKINCOLOR_SUPER4,
"SUPER5", // SKINCOLOR_SUPER5,
// Super Tails
"TSUPER1", // SKINCOLOR_TSUPER1,
"TSUPER2", // SKINCOLOR_TSUPER2,
"TSUPER3", // SKINCOLOR_TSUPER3,
"TSUPER4", // SKINCOLOR_TSUPER4,
"TSUPER5", // SKINCOLOR_TSUPER5,
// Super Knuckles
"KSUPER1", // SKINCOLOR_KSUPER1,
"KSUPER2", // SKINCOLOR_KSUPER2,
"KSUPER3", // SKINCOLOR_KSUPER3,
"KSUPER4", // SKINCOLOR_KSUPER4,
"KSUPER5" // SKINCOLOR_KSUPER5,
}; };
static const char *const POWERS_LIST[] = { static const char *const POWERS_LIST[] = {
@ -7540,8 +7562,9 @@ struct {
{"EMERALD6",EMERALD6}, {"EMERALD6",EMERALD6},
{"EMERALD7",EMERALD7}, {"EMERALD7",EMERALD7},
// SKINCOLOR_ doesn't include this..! // SKINCOLOR_ doesn't include these..!
{"MAXSKINCOLORS",MAXSKINCOLORS}, {"MAXSKINCOLORS",MAXSKINCOLORS},
{"MAXTRANSLATIONS",MAXTRANSLATIONS},
// Precipitation // Precipitation
{"PRECIP_NONE",PRECIP_NONE}, {"PRECIP_NONE",PRECIP_NONE},
@ -7651,11 +7674,15 @@ struct {
// Player animation (panim_t) // Player animation (panim_t)
{"PA_ETC",PA_ETC}, {"PA_ETC",PA_ETC},
{"PA_IDLE",PA_IDLE}, {"PA_IDLE",PA_IDLE},
{"PA_EDGE",PA_EDGE},
{"PA_WALK",PA_WALK}, {"PA_WALK",PA_WALK},
{"PA_RUN",PA_RUN}, {"PA_RUN",PA_RUN},
{"PA_PAIN",PA_PAIN},
{"PA_ROLL",PA_ROLL}, {"PA_ROLL",PA_ROLL},
{"PA_JUMP",PA_JUMP},
{"PA_FALL",PA_FALL}, {"PA_FALL",PA_FALL},
{"PA_ABILITY",PA_ABILITY}, {"PA_ABILITY",PA_ABILITY},
{"PA_RIDE",PA_RIDE},
// Current weapon // Current weapon
{"WEP_AUTO",WEP_AUTO}, {"WEP_AUTO",WEP_AUTO},
@ -7734,36 +7761,36 @@ struct {
{"FF_GOOWATER",FF_GOOWATER}, ///< Used with ::FF_SWIMMABLE. Makes thick bouncey goop. {"FF_GOOWATER",FF_GOOWATER}, ///< Used with ::FF_SWIMMABLE. Makes thick bouncey goop.
// Angles // Angles
{"ANG1",ANG1}, {"ANG1",ANG1>>16},
{"ANG2",ANG2}, {"ANG2",ANG2>>16},
{"ANG10",ANG10}, {"ANG10",ANG10>>16},
{"ANG15",ANG15}, {"ANG15",ANG15>>16},
{"ANG20",ANG20}, {"ANG20",ANG20>>16},
{"ANG30",ANG30}, {"ANG30",ANG30>>16},
{"ANG60",ANG60}, {"ANG60",ANG60>>16},
{"ANG64h",ANG64h}, {"ANG64h",ANG64h>>16},
{"ANG105",ANG105}, {"ANG105",ANG105>>16},
{"ANG210",ANG210}, {"ANG210",ANG210>>16},
{"ANG255",ANG255}, {"ANG255",ANG255>>16},
{"ANG340",ANG340}, {"ANG340",ANG340>>16},
{"ANG350",ANG350}, {"ANG350",ANG350>>16},
{"ANGLE_11hh",ANGLE_11hh}, {"ANGLE_11hh",ANGLE_11hh>>16},
{"ANGLE_22h",ANGLE_22h}, {"ANGLE_22h",ANGLE_22h>>16},
{"ANGLE_45",ANGLE_45}, {"ANGLE_45",ANGLE_45>>16},
{"ANGLE_67h",ANGLE_67h}, {"ANGLE_67h",ANGLE_67h>>16},
{"ANGLE_90",ANGLE_90}, {"ANGLE_90",ANGLE_90>>16},
{"ANGLE_112h",ANGLE_112h}, {"ANGLE_112h",ANGLE_112h>>16},
{"ANGLE_135",ANGLE_135}, {"ANGLE_135",ANGLE_135>>16},
{"ANGLE_157h",ANGLE_157h}, {"ANGLE_157h",ANGLE_157h>>16},
{"ANGLE_180",ANGLE_180}, {"ANGLE_180",ANGLE_180>>16},
{"ANGLE_202h",ANGLE_202h}, {"ANGLE_202h",ANGLE_202h>>16},
{"ANGLE_225",ANGLE_225}, {"ANGLE_225",ANGLE_225>>16},
{"ANGLE_247h",ANGLE_247h}, {"ANGLE_247h",ANGLE_247h>>16},
{"ANGLE_270",ANGLE_270}, {"ANGLE_270",ANGLE_270>>16},
{"ANGLE_292h",ANGLE_292h}, {"ANGLE_292h",ANGLE_292h>>16},
{"ANGLE_315",ANGLE_315}, {"ANGLE_315",ANGLE_315>>16},
{"ANGLE_337h",ANGLE_337h}, {"ANGLE_337h",ANGLE_337h>>16},
{"ANGLE_MAX",ANGLE_MAX}, {"ANGLE_MAX",ANGLE_MAX>>16},
// P_Chase directions (dirtype_t) // P_Chase directions (dirtype_t)
{"DI_NODIR",DI_NODIR}, {"DI_NODIR",DI_NODIR},
@ -8162,7 +8189,7 @@ static fixed_t find_const(const char **rword)
} }
else if (fastncmp("SKINCOLOR_",word,10)) { else if (fastncmp("SKINCOLOR_",word,10)) {
char *p = word+10; char *p = word+10;
for (i = 0; i < MAXSKINCOLORS; i++) for (i = 0; i < MAXTRANSLATIONS; i++)
if (fastcmp(p, COLOR_ENUMS[i])) { if (fastcmp(p, COLOR_ENUMS[i])) {
free(word); free(word);
return i; return i;
@ -8221,8 +8248,8 @@ void DEH_Check(void)
if (dehpowers != NUMPOWERS) if (dehpowers != NUMPOWERS)
I_Error("You forgot to update the Dehacked powers list, you dolt!\n(%d powers defined, versus %s in the Dehacked list)\n", NUMPOWERS, sizeu1(dehpowers)); I_Error("You forgot to update the Dehacked powers list, you dolt!\n(%d powers defined, versus %s in the Dehacked list)\n", NUMPOWERS, sizeu1(dehpowers));
if (dehcolors != MAXSKINCOLORS) if (dehcolors != MAXTRANSLATIONS)
I_Error("You forgot to update the Dehacked colors list, you dolt!\n(%d colors defined, versus %s in the Dehacked list)\n", MAXSKINCOLORS, sizeu1(dehcolors)); I_Error("You forgot to update the Dehacked colors list, you dolt!\n(%d colors defined, versus %s in the Dehacked list)\n", MAXTRANSLATIONS, sizeu1(dehcolors));
#endif #endif
} }
@ -8491,6 +8518,27 @@ static inline int lib_getenum(lua_State *L)
if (mathlib) return luaL_error(L, "sprite '%s' could not be found.\n", word); if (mathlib) return luaL_error(L, "sprite '%s' could not be found.\n", word);
return 0; return 0;
} }
else if (fastncmp("SPR2_",word,4)) {
p = word+5;
for (i = 0; i < NUMPLAYERSPRITES; i++)
if (!spr2names[i][4])
{
// special 3-char cases, e.g. SPR2_RUN
// the spr2names entry will have "_" on the end, as in "RUN_"
if (spr2names[i][3] == '_' && !p[3]) {
if (fastncmp(p,spr2names[i],3)) {
lua_pushinteger(L, i);
return 1;
}
}
else if (fastncmp(p,spr2names[i],4)) {
lua_pushinteger(L, i);
return 1;
}
}
if (mathlib) return luaL_error(L, "player sprite '%s' could not be found.\n", word);
return 0;
}
else if (!mathlib && fastncmp("sfx_",word,4)) { else if (!mathlib && fastncmp("sfx_",word,4)) {
p = word+4; p = word+4;
for (i = 0; i < NUMSFX; i++) for (i = 0; i < NUMSFX; i++)
@ -8576,7 +8624,7 @@ static inline int lib_getenum(lua_State *L)
} }
else if (fastncmp("SKINCOLOR_",word,10)) { else if (fastncmp("SKINCOLOR_",word,10)) {
p = word+10; p = word+10;
for (i = 0; i < MAXSKINCOLORS; i++) for (i = 0; i < MAXTRANSLATIONS; i++)
if (fastcmp(p, COLOR_ENUMS[i])) { if (fastcmp(p, COLOR_ENUMS[i])) {
lua_pushinteger(L, i); lua_pushinteger(L, i);
return 1; return 1;
@ -8701,7 +8749,7 @@ static inline int lib_getenum(lua_State *L)
lua_pushinteger(L, mapmusic); lua_pushinteger(L, mapmusic);
return 1; return 1;
} else if (fastcmp(word,"server")) { } else if (fastcmp(word,"server")) {
if (!playeringame[serverplayer]) if ((!multiplayer || !netgame) && !playeringame[serverplayer])
return 0; return 0;
LUA_PushUserdata(L, &players[serverplayer], META_PLAYER); LUA_PushUserdata(L, &players[serverplayer], META_PLAYER);
return 1; return 1;

View File

@ -138,15 +138,17 @@
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 "Trunk" #define VERSIONSTRING "Trunk"
#define VERSIONSTRINGW L"Trunk"
#else #else
#define VERSION 201 // Game version #define VERSION 202 // Game version
#define SUBVERSION 14 // more precise version number #define SUBVERSION 0 // more precise version number
#define VERSIONSTRING "v2.1.14" #define VERSIONSTRING "v2.2"
#define VERSIONSTRINGW L"v2.1.14" #define VERSIONSTRINGW L"v2.2"
// 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
@ -193,7 +195,7 @@ extern FILE *logstream;
// and should not be changed unless you have merged changes between versions of SRB2 // and should not be changed unless you have merged changes between versions of SRB2
// (such as 2.0.4 to 2.0.5, etc) into your working copy. // (such as 2.0.4 to 2.0.5, etc) into your working copy.
// Will always resemble the versionstring, 205 = 2.0.5, 210 = 2.1, etc. // Will always resemble the versionstring, 205 = 2.0.5, 210 = 2.1, etc.
#define CODEBASE 210 #define CODEBASE 220
// The Modification ID; must be obtained from Inuyasha ( http://mb.srb2.org/private.php?do=newpm&u=2604 ). // The Modification ID; must be obtained from Inuyasha ( http://mb.srb2.org/private.php?do=newpm&u=2604 ).
// DO NOT try to set this otherwise, or your modification will be unplayable through the Master Server. // DO NOT try to set this otherwise, or your modification will be unplayable through the Master Server.
@ -204,7 +206,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
@ -441,6 +443,9 @@ extern const char *compdate, *comptime, *comprevision;
/// Fun experimental slope stuff! /// Fun experimental slope stuff!
//#define SLOPENESS //#define SLOPENESS
/// Kalaron/Eternity Engine slope code (SRB2CB ported)
#define ESLOPE
/// 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.
//#define DELFILE //#define DELFILE

View File

@ -982,6 +982,7 @@ static const char *credits[] = {
"", "",
"\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",

View File

@ -2180,8 +2180,7 @@ 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)
@ -3687,6 +3686,7 @@ static ticcmd_t oldcmd;
#define GZT_SPRITE 0x10 // Animation frame #define GZT_SPRITE 0x10 // Animation frame
#define GZT_EXTRA 0x20 #define GZT_EXTRA 0x20
#define GZT_NIGHTS 0x40 // NiGHTS Mode stuff! #define GZT_NIGHTS 0x40 // NiGHTS Mode stuff!
#define GZT_SPR2 0x80 // Player animations
// GZT_EXTRA flags // GZT_EXTRA flags
#define EZT_THOK 0x01 // Spawned a thok object #define EZT_THOK 0x01 // Spawned a thok object
@ -3890,8 +3890,6 @@ void G_WriteGhostTic(mobj_t *ghost)
char ziptic = 0; char ziptic = 0;
UINT8 *ziptic_p; UINT8 *ziptic_p;
UINT32 i; UINT32 i;
UINT8 sprite;
UINT8 frame;
if (!demo_p) if (!demo_p)
return; return;
@ -3966,19 +3964,25 @@ void G_WriteGhostTic(mobj_t *ghost)
} }
// Store the sprite frame. // Store the sprite frame.
frame = ghost->frame & 0xFF; if ((ghost->frame & 0xFF) != oldghost.frame)
if (frame != oldghost.frame)
{ {
oldghost.frame = frame; oldghost.frame = (ghost->frame & 0xFF);
ziptic |= GZT_SPRITE; ziptic |= GZT_SPRITE;
WRITEUINT8(demo_p,oldghost.frame); WRITEUINT8(demo_p,oldghost.frame);
} }
// Check for sprite set changes if (ghost->sprite == SPR_PLAY
sprite = ghost->sprite; && ghost->sprite2 != oldghost.sprite2)
if (sprite != oldghost.sprite)
{ {
oldghost.sprite = sprite; oldghost.sprite2 = ghost->sprite2;
ziptic |= GZT_SPR2;
WRITEUINT8(demo_p,oldghost.sprite2);
}
// Check for sprite set changes
if (ghost->sprite != oldghost.sprite)
{
oldghost.sprite = ghost->sprite;
ghostext.flags |= EZT_SPRITE; ghostext.flags |= EZT_SPRITE;
} }
@ -4021,7 +4025,7 @@ void G_WriteGhostTic(mobj_t *ghost)
ghostext.hitlist = NULL; ghostext.hitlist = NULL;
} }
if (ghostext.flags & EZT_SPRITE) if (ghostext.flags & EZT_SPRITE)
WRITEUINT8(demo_p,sprite); WRITEUINT8(demo_p,oldghost.sprite);
ghostext.flags = 0; ghostext.flags = 0;
} }
@ -4077,6 +4081,8 @@ void G_ConsGhostTic(void)
demo_p++; demo_p++;
if (ziptic & GZT_SPRITE) if (ziptic & GZT_SPRITE)
demo_p++; demo_p++;
if (ziptic & GZT_SPR2)
demo_p++;
if(ziptic & GZT_NIGHTS) { if(ziptic & GZT_NIGHTS) {
if (!testmo->player || !(testmo->player->pflags & PF_NIGHTSMODE) || !testmo->tracer) if (!testmo->player || !(testmo->player->pflags & PF_NIGHTSMODE) || !testmo->tracer)
nightsfail = true; nightsfail = true;
@ -4128,7 +4134,7 @@ void G_ConsGhostTic(void)
if (demosynced) if (demosynced)
CONS_Alert(CONS_WARNING, M_GetText("Demo playback has desynced!\n")); CONS_Alert(CONS_WARNING, M_GetText("Demo playback has desynced!\n"));
demosynced = false; demosynced = false;
P_DamageMobj(mobj, players[0].mo, players[0].mo, 1); P_DamageMobj(mobj, players[0].mo, players[0].mo, 1, 0);
} }
} }
} }
@ -4208,6 +4214,8 @@ void G_GhostTicker(void)
g->oldmo.angle = READUINT8(g->p)<<24; g->oldmo.angle = READUINT8(g->p)<<24;
if (ziptic & GZT_SPRITE) if (ziptic & GZT_SPRITE)
g->oldmo.frame = READUINT8(g->p); g->oldmo.frame = READUINT8(g->p);
if (ziptic & GZT_SPR2)
g->oldmo.sprite2 = READUINT8(g->p);
// Update ghost // Update ghost
P_UnsetThingPosition(g->mo); P_UnsetThingPosition(g->mo);
@ -4217,6 +4225,7 @@ void G_GhostTicker(void)
P_SetThingPosition(g->mo); P_SetThingPosition(g->mo);
g->mo->angle = g->oldmo.angle; g->mo->angle = g->oldmo.angle;
g->mo->frame = g->oldmo.frame | tr_trans30<<FF_TRANSSHIFT; g->mo->frame = g->oldmo.frame | tr_trans30<<FF_TRANSSHIFT;
g->mo->sprite2 = g->oldmo.sprite2;
if (ziptic & GZT_EXTRA) if (ziptic & GZT_EXTRA)
{ // But wait, there's more! { // But wait, there's more!
@ -4330,20 +4339,10 @@ 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! if (leveltime % 9 < 5)
g->mo->color = SKINCOLOR_SUPER1 + (leveltime/2) % 5; g->mo->color = SKINCOLOR_SUPER1 + leveltime % 9;
if (g->mo->skin) else
switch (((skin_t*)g->mo->skin)-skins) g->mo->color = SKINCOLOR_SUPER1 + 9 - leveltime % 9;
{
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);
@ -4401,6 +4400,8 @@ void G_ReadMetalTic(mobj_t *metal)
oldmetal.angle = READUINT8(metal_p)<<24; oldmetal.angle = READUINT8(metal_p)<<24;
if (ziptic & GZT_SPRITE) if (ziptic & GZT_SPRITE)
metal_p++; // Currently unused. (Metal Sonic figures out what he's doing his own damn self.) metal_p++; // Currently unused. (Metal Sonic figures out what he's doing his own damn self.)
if (ziptic & GZT_SPR2)
metal_p++;
// Set movement, position, and angle // Set movement, position, and angle
// oldmetal contains where you're supposed to be. // oldmetal contains where you're supposed to be.

View File

@ -3527,6 +3527,184 @@ static boolean HWR_DoCulling(line_t *cullheight, line_t *viewcullheight, float v
return false; return false;
} }
static void HWR_DrawSpriteShadow(gr_vissprite_t *spr, GLPatch_t *gpatch, float this_scale)
{
UINT8 i;
float tr_x, tr_y;
FOutVector *wv;
FOutVector swallVerts[4];
FSurfaceInfo sSurf;
fixed_t floorheight, mobjfloor;
mobjfloor = HWR_OpaqueFloorAtPos(
spr->mobj->x, spr->mobj->y,
spr->mobj->z, spr->mobj->height);
if (cv_shadowoffs.value)
{
angle_t shadowdir;
// Set direction
if (splitscreen && stplyr != &players[displayplayer])
shadowdir = localangle2 + FixedAngle(cv_cam2_rotate.value);
else
shadowdir = localangle + FixedAngle(cv_cam_rotate.value);
// Find floorheight
floorheight = HWR_OpaqueFloorAtPos(
spr->mobj->x + P_ReturnThrustX(spr->mobj, shadowdir, spr->mobj->z - mobjfloor),
spr->mobj->y + P_ReturnThrustY(spr->mobj, shadowdir, spr->mobj->z - mobjfloor),
spr->mobj->z, spr->mobj->height);
// The shadow is falling ABOVE it's mobj?
// Don't draw it, then!
if (spr->mobj->z < floorheight)
return;
else
{
fixed_t floorz;
floorz = HWR_OpaqueFloorAtPos(
spr->mobj->x + P_ReturnThrustX(spr->mobj, shadowdir, spr->mobj->z - floorheight),
spr->mobj->y + P_ReturnThrustY(spr->mobj, shadowdir, spr->mobj->z - floorheight),
spr->mobj->z, spr->mobj->height);
// The shadow would be falling on a wall? Don't draw it, then.
// Would draw midair otherwise.
if (floorz < floorheight)
return;
}
floorheight = FixedInt(spr->mobj->z - floorheight);
}
else
floorheight = FixedInt(spr->mobj->z - mobjfloor);
// create the sprite billboard
//
// 3--2
// | /|
// |/ |
// 0--1
// x1/x2 were already scaled in HWR_ProjectSprite
swallVerts[0].x = swallVerts[3].x = spr->x1;
swallVerts[2].x = swallVerts[1].x = spr->x2;
if (spr->mobj && this_scale != 1.0f)
{
// Always a pixel above the floor, perfectly flat.
swallVerts[0].y = swallVerts[1].y = swallVerts[2].y = swallVerts[3].y = spr->ty - gpatch->topoffset * this_scale - (floorheight+3);
swallVerts[0].z = swallVerts[1].z = spr->tz - (gpatch->height-gpatch->topoffset) * this_scale;
swallVerts[2].z = swallVerts[3].z = spr->tz + gpatch->topoffset * this_scale;
}
else
{
// Always a pixel above the floor, perfectly flat.
swallVerts[0].y = swallVerts[1].y = swallVerts[2].y = swallVerts[3].y = spr->ty - gpatch->topoffset - (floorheight+3);
// Spread out top away from the camera. (Fixme: Make it always move out in the same direction!... somehow.)
swallVerts[0].z = swallVerts[1].z = spr->tz - (gpatch->height-gpatch->topoffset);
swallVerts[2].z = swallVerts[3].z = spr->tz + gpatch->topoffset;
}
// transform
wv = swallVerts;
for (i = 0; i < 4; i++,wv++)
{
// Offset away from the camera based on height from floor.
if (cv_shadowoffs.value)
wv->z += floorheight;
wv->z += 3;
//look up/down ----TOTAL SUCKS!!!--- do the 2 in one!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
tr_x = wv->z;
tr_y = wv->y;
wv->y = (tr_x * gr_viewludcos) + (tr_y * gr_viewludsin);
wv->z = (tr_x * gr_viewludsin) - (tr_y * gr_viewludcos);
// ---------------------- mega lame test ----------------------------------
//scale y before frustum so that frustum can be scaled to screen height
wv->y *= ORIGINAL_ASPECT * gr_fovlud;
wv->x *= gr_fovlud;
}
if (spr->flip)
{
swallVerts[0].sow = swallVerts[3].sow = gpatch->max_s;
swallVerts[2].sow = swallVerts[1].sow = 0;
}
else
{
swallVerts[0].sow = swallVerts[3].sow = 0;
swallVerts[2].sow = swallVerts[1].sow = gpatch->max_s;
}
// flip the texture coords (look familiar?)
if (spr->vflip)
{
swallVerts[3].tow = swallVerts[2].tow = gpatch->max_t;
swallVerts[0].tow = swallVerts[1].tow = 0;
}
else
{
swallVerts[3].tow = swallVerts[2].tow = 0;
swallVerts[0].tow = swallVerts[1].tow = gpatch->max_t;
}
sSurf.FlatColor.s.red = 0x00;
sSurf.FlatColor.s.blue = 0x00;
sSurf.FlatColor.s.green = 0x00;
/*if (spr->mobj->frame & FF_TRANSMASK || spr->mobj->flags2 & MF2_SHADOW)
{
sector_t *sector = spr->mobj->subsector->sector;
UINT8 lightlevel = 255;
extracolormap_t *colormap = sector->extra_colormap;
if (sector->numlights)
{
INT32 light = R_GetPlaneLight(sector, spr->mobj->floorz, false);
if (!(spr->mobj->frame & FF_FULLBRIGHT))
lightlevel = *sector->lightlist[light].lightlevel;
if (sector->lightlist[light].extra_colormap)
colormap = sector->lightlist[light].extra_colormap;
}
else
{
lightlevel = sector->lightlevel;
if (sector->extra_colormap)
colormap = sector->extra_colormap;
}
if (colormap)
sSurf.FlatColor.rgba = HWR_Lighting(lightlevel/2, colormap->rgba, colormap->fadergba, false, true);
else
sSurf.FlatColor.rgba = HWR_Lighting(lightlevel/2, NORMALFOG, FADEFOG, false, true);
}*/
// shadow is always half as translucent as the sprite itself
if (!cv_translucency.value) // use default translucency (main sprite won't have any translucency)
sSurf.FlatColor.s.alpha = 0x80; // default
else if (spr->mobj->flags2 & MF2_SHADOW)
sSurf.FlatColor.s.alpha = 0x20;
else if (spr->mobj->frame & FF_TRANSMASK)
{
HWR_TranstableToAlpha((spr->mobj->frame & FF_TRANSMASK)>>FF_TRANSSHIFT, &sSurf);
sSurf.FlatColor.s.alpha /= 2; //cut alpha in half!
}
else
sSurf.FlatColor.s.alpha = 0x80; // default
if (sSurf.FlatColor.s.alpha > floorheight/4)
{
sSurf.FlatColor.s.alpha = (UINT8)(sSurf.FlatColor.s.alpha - floorheight/4);
HWD.pfnDrawPolygon(&sSurf, swallVerts, 4, PF_Translucent|PF_Modulated|PF_Clip);
}
}
// -----------------+ // -----------------+
// HWR_DrawSprite : Draw flat sprites // HWR_DrawSprite : Draw flat sprites
// : (monsters, bonuses, weapons, lights, ...) // : (monsters, bonuses, weapons, lights, ...)
@ -3629,7 +3807,7 @@ static void HWR_DrawSprite(gr_vissprite_t *spr)
// Draw shadow BEFORE sprite // Draw shadow BEFORE sprite
if (cv_shadow.value // Shadows enabled if (cv_shadow.value // Shadows enabled
&& !(spr->mobj->flags & MF_SCENERY && spr->mobj->flags & MF_SPAWNCEILING && spr->mobj->flags & MF_NOGRAVITY) // Ceiling scenery have no shadow. && (spr->mobj->flags & (MF_SCENERY|MF_SPAWNCEILING|MF_NOGRAVITY)) != (MF_SCENERY|MF_SPAWNCEILING|MF_NOGRAVITY) // Ceiling scenery have no shadow.
&& !(spr->mobj->flags2 & MF2_DEBRIS) // Debris have no corona or shadow. && !(spr->mobj->flags2 & MF2_DEBRIS) // Debris have no corona or shadow.
#ifdef ALAM_LIGHTING #ifdef ALAM_LIGHTING
&& !(t_lspr[spr->mobj->sprite]->type // Things with dynamic lights have no shadow. && !(t_lspr[spr->mobj->sprite]->type // Things with dynamic lights have no shadow.
@ -3640,187 +3818,9 @@ static void HWR_DrawSprite(gr_vissprite_t *spr)
//////////////////// ////////////////////
// SHADOW SPRITE! // // SHADOW SPRITE! //
//////////////////// ////////////////////
FOutVector swallVerts[4]; HWR_DrawSpriteShadow(spr, gpatch, this_scale);
FSurfaceInfo sSurf;
fixed_t floorheight, mobjfloor;
mobjfloor = HWR_OpaqueFloorAtPos(
spr->mobj->x, spr->mobj->y,
spr->mobj->z, spr->mobj->height);
if (cv_shadowoffs.value)
{
angle_t shadowdir;
// Set direction
if (splitscreen && stplyr != &players[displayplayer])
shadowdir = localangle2 + FixedAngle(cv_cam2_rotate.value);
else
shadowdir = localangle + FixedAngle(cv_cam_rotate.value);
// Find floorheight
floorheight = HWR_OpaqueFloorAtPos(
spr->mobj->x + P_ReturnThrustX(spr->mobj, shadowdir, spr->mobj->z - mobjfloor),
spr->mobj->y + P_ReturnThrustY(spr->mobj, shadowdir, spr->mobj->z - mobjfloor),
spr->mobj->z, spr->mobj->height);
// The shadow is falling ABOVE it's mobj?
// Don't draw it, then!
if (spr->mobj->z < floorheight)
goto noshadow;
else
{
fixed_t floorz;
floorz = HWR_OpaqueFloorAtPos(
spr->mobj->x + P_ReturnThrustX(spr->mobj, shadowdir, spr->mobj->z - floorheight),
spr->mobj->y + P_ReturnThrustY(spr->mobj, shadowdir, spr->mobj->z - floorheight),
spr->mobj->z, spr->mobj->height);
// The shadow would be falling on a wall? Don't draw it, then.
// Would draw midair otherwise.
if (floorz < floorheight)
goto noshadow;
}
floorheight = FixedInt(spr->mobj->z - floorheight);
}
else
floorheight = FixedInt(spr->mobj->z - mobjfloor);
// create the sprite billboard
//
// 3--2
// | /|
// |/ |
// 0--1
// x1/x2 were already scaled in HWR_ProjectSprite
swallVerts[0].x = swallVerts[3].x = spr->x1;
swallVerts[2].x = swallVerts[1].x = spr->x2;
if (spr->mobj && this_scale != 1.0f)
{
// Always a pixel above the floor, perfectly flat.
swallVerts[0].y = swallVerts[1].y = swallVerts[2].y = swallVerts[3].y = spr->ty - gpatch->topoffset * this_scale - (floorheight+3);
swallVerts[0].z = swallVerts[1].z = spr->tz - (gpatch->height-gpatch->topoffset) * this_scale;
swallVerts[2].z = swallVerts[3].z = spr->tz + gpatch->topoffset * this_scale;
}
else
{
// Always a pixel above the floor, perfectly flat.
swallVerts[0].y = swallVerts[1].y = swallVerts[2].y = swallVerts[3].y = spr->ty - gpatch->topoffset - (floorheight+3);
// Spread out top away from the camera. (Fixme: Make it always move out in the same direction!... somehow.)
swallVerts[0].z = swallVerts[1].z = spr->tz - (gpatch->height-gpatch->topoffset);
swallVerts[2].z = swallVerts[3].z = spr->tz + gpatch->topoffset;
}
// transform
wv = swallVerts;
for (i = 0; i < 4; i++,wv++)
{
// Offset away from the camera based on height from floor.
if (cv_shadowoffs.value)
wv->z += floorheight;
wv->z += 3;
//look up/down ----TOTAL SUCKS!!!--- do the 2 in one!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
tr_x = wv->z;
tr_y = wv->y;
wv->y = (tr_x * gr_viewludcos) + (tr_y * gr_viewludsin);
wv->z = (tr_x * gr_viewludsin) - (tr_y * gr_viewludcos);
// ---------------------- mega lame test ----------------------------------
//scale y before frustum so that frustum can be scaled to screen height
wv->y *= ORIGINAL_ASPECT * gr_fovlud;
wv->x *= gr_fovlud;
}
if (spr->flip)
{
swallVerts[0].sow = swallVerts[3].sow = gpatch->max_s;
swallVerts[2].sow = swallVerts[1].sow = 0;
}
else
{
swallVerts[0].sow = swallVerts[3].sow = 0;
swallVerts[2].sow = swallVerts[1].sow = gpatch->max_s;
}
// flip the texture coords (look familiar?)
if (spr->vflip)
{
swallVerts[3].tow = swallVerts[2].tow = gpatch->max_t;
swallVerts[0].tow = swallVerts[1].tow = 0;
}
else
{
swallVerts[3].tow = swallVerts[2].tow = 0;
swallVerts[0].tow = swallVerts[1].tow = gpatch->max_t;
}
sSurf.FlatColor.s.red = 0x00;
sSurf.FlatColor.s.blue = 0x00;
sSurf.FlatColor.s.green = 0x00;
/*if (spr->mobj->frame & FF_TRANSMASK || spr->mobj->flags2 & MF2_SHADOW)
{
sector_t *sector = spr->mobj->subsector->sector;
UINT8 lightlevel = sector->lightlevel;
extracolormap_t *colormap = sector->extra_colormap;
if (sector->numlights)
{
INT32 light = R_GetPlaneLight(sector, spr->mobj->floorz, false);
if (!(spr->mobj->frame & FF_FULLBRIGHT))
lightlevel = *sector->lightlist[light].lightlevel;
else
lightlevel = 255;
if (sector->lightlist[light].extra_colormap)
colormap = sector->lightlist[light].extra_colormap;
}
else
{
lightlevel = sector->lightlevel;
if (sector->extra_colormap)
colormap = sector->extra_colormap;
}
if (colormap)
sSurf.FlatColor.rgba = HWR_Lighting(lightlevel/2, colormap->rgba, colormap->fadergba, false, true);
else
sSurf.FlatColor.rgba = HWR_Lighting(lightlevel/2, NORMALFOG, FADEFOG, false, true);
}*/
// shadow is always half as translucent as the sprite itself
if (!cv_translucency.value)
; // translucency disabled
else if (spr->mobj->flags2 & MF2_SHADOW)
sSurf.FlatColor.s.alpha = 0x20;
else if (spr->mobj->frame & FF_TRANSMASK)
{
HWR_TranstableToAlpha((spr->mobj->frame & FF_TRANSMASK)>>FF_TRANSSHIFT, &sSurf);
sSurf.FlatColor.s.alpha /= 2; //cut alpha in half!
}
else
sSurf.FlatColor.s.alpha = 0x80; // default
/// \todo do the test earlier
if (!cv_grmd2.value || (md2_models[spr->mobj->sprite].scale < 0.0f) || (md2_models[spr->mobj->sprite].notfound = true) || (md2_playermodels[(skin_t*)spr->mobj->skin-skins].scale < 0.0f) || (md2_playermodels[(skin_t*)spr->mobj->skin-skins].notfound = true))
{
if (sSurf.FlatColor.s.alpha > floorheight/4)
{
sSurf.FlatColor.s.alpha = (UINT8)(sSurf.FlatColor.s.alpha - floorheight/4);
HWD.pfnDrawPolygon(&sSurf, swallVerts, 4, PF_Translucent|PF_Modulated|PF_Clip);
}
}
} }
noshadow:
// This needs to be AFTER the shadows so that the regular sprites aren't drawn completely black. // This needs to be AFTER the shadows so that the regular sprites aren't drawn completely black.
// sprite lighting by modulating the RGB components // sprite lighting by modulating the RGB components
/// \todo coloured /// \todo coloured
@ -3828,7 +3828,7 @@ noshadow:
// 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)
@ -3839,8 +3839,6 @@ noshadow:
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;
@ -3849,27 +3847,25 @@ noshadow:
{ {
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);
} }
/// \todo do the test earlier
if (!cv_grmd2.value || (md2_models[spr->mobj->sprite].scale < 0.0f))
{ {
FBITFIELD blend = 0; FBITFIELD blend = 0;
if (spr->mobj->flags2 & MF2_SHADOW) if (!cv_translucency.value) // translucency disabled
{
Surf.FlatColor.s.alpha = 0xFF;
blend = PF_Translucent|PF_Occlude;
}
else if (spr->mobj->flags2 & MF2_SHADOW)
{ {
Surf.FlatColor.s.alpha = 0x40; Surf.FlatColor.s.alpha = 0x40;
blend = PF_Translucent; blend = PF_Translucent;
@ -4390,10 +4386,10 @@ static void HWR_DrawSprites(void)
#endif #endif
if (spr->mobj && spr->mobj->skin && spr->mobj->sprite == SPR_PLAY) if (spr->mobj && spr->mobj->skin && spr->mobj->sprite == SPR_PLAY)
{ {
if (!cv_grmd2.value || (cv_grmd2.value && md2_playermodels[(skin_t*)spr->mobj->skin-skins].notfound == true)) if (!cv_grmd2.value || md2_playermodels[(skin_t*)spr->mobj->skin-skins].notfound || md2_playermodels[(skin_t*)spr->mobj->skin-skins].scale < 0.0f)
HWR_DrawSprite(spr); HWR_DrawSprite(spr);
} }
else if (!cv_grmd2.value || (cv_grmd2.value && md2_models[spr->mobj->sprite].notfound == true)) else if (!cv_grmd2.value || md2_models[spr->mobj->sprite].notfound || md2_models[spr->mobj->sprite].scale < 0.0f)
HWR_DrawSprite(spr); HWR_DrawSprite(spr);
} }
} }
@ -4419,7 +4415,7 @@ static void HWR_DrawMD2S(void)
#endif #endif
if (spr->mobj && spr->mobj->skin && spr->mobj->sprite == SPR_PLAY) if (spr->mobj && spr->mobj->skin && spr->mobj->sprite == SPR_PLAY)
{ {
if ((md2_playermodels[(skin_t*)spr->mobj->skin-skins].notfound == false) && (md2_playermodels[(skin_t*)spr->mobj->skin-skins].scale > 0.0f)) if (md2_playermodels[(skin_t*)spr->mobj->skin-skins].notfound == false && md2_playermodels[(skin_t*)spr->mobj->skin-skins].scale > 0.0f)
HWR_DrawMD2(spr); HWR_DrawMD2(spr);
} }
else if (md2_models[spr->mobj->sprite].notfound == false && md2_models[spr->mobj->sprite].scale > 0.0f) else if (md2_models[spr->mobj->sprite].notfound == false && md2_models[spr->mobj->sprite].scale > 0.0f)
@ -4461,23 +4457,12 @@ static void HWR_AddSprites(sector_t *sec)
// If a limit exists, handle things a tiny bit different. // If a limit exists, handle things a tiny bit different.
if ((limit_dist = (fixed_t)((maptol & TOL_NIGHTS) ? cv_drawdist_nights.value : cv_drawdist.value) << FRACBITS)) if ((limit_dist = (fixed_t)((maptol & TOL_NIGHTS) ? cv_drawdist_nights.value : cv_drawdist.value) << FRACBITS))
{ {
if (!players[displayplayer].mo)
return; // Draw nothing if no player.
// todo: is this really the best option for this situation?
for (thing = sec->thinglist; thing; thing = thing->snext) for (thing = sec->thinglist; thing; thing = thing->snext)
{ {
if (thing->sprite == SPR_NULL || thing->flags2 & MF2_DONTDRAW) if (thing->sprite == SPR_NULL || thing->flags2 & MF2_DONTDRAW)
continue; continue;
approx_dist = P_AproxDistance( approx_dist = P_AproxDistance(viewx-thing->x, viewy-thing->y);
players[displayplayer].mo->x - thing->x,
players[displayplayer].mo->y - thing->y);
if (splitscreen && approx_dist > limit_dist && players[secondarydisplayplayer].mo)
approx_dist = P_AproxDistance(
players[secondarydisplayplayer].mo->x - thing->x,
players[secondarydisplayplayer].mo->y - thing->y);
if (approx_dist <= limit_dist) if (approx_dist <= limit_dist)
HWR_ProjectSprite(thing); HWR_ProjectSprite(thing);
@ -4495,23 +4480,12 @@ static void HWR_AddSprites(sector_t *sec)
// Someone seriously wants infinite draw distance for precipitation? // Someone seriously wants infinite draw distance for precipitation?
if ((limit_dist = (fixed_t)cv_drawdist_precip.value << FRACBITS)) if ((limit_dist = (fixed_t)cv_drawdist_precip.value << FRACBITS))
{ {
if (!players[displayplayer].mo)
return; // Draw nothing if no player.
// todo: is this really the best option for this situation?
for (precipthing = sec->preciplist; precipthing; precipthing = precipthing->snext) for (precipthing = sec->preciplist; precipthing; precipthing = precipthing->snext)
{ {
if (precipthing->invisible) if (precipthing->precipflags & PCF_INVISIBLE)
continue; continue;
approx_dist = P_AproxDistance( approx_dist = P_AproxDistance(viewx-precipthing->x, viewy-precipthing->y);
players[displayplayer].mo->x - precipthing->x,
players[displayplayer].mo->y - precipthing->y);
if (splitscreen && approx_dist > limit_dist && players[secondarydisplayplayer].mo)
approx_dist = P_AproxDistance(
players[secondarydisplayplayer].mo->x - precipthing->x,
players[secondarydisplayplayer].mo->y - precipthing->y);
if (approx_dist <= limit_dist) if (approx_dist <= limit_dist)
HWR_ProjectPrecipitationSprite(precipthing); HWR_ProjectPrecipitationSprite(precipthing);
@ -4521,7 +4495,7 @@ static void HWR_AddSprites(sector_t *sec)
{ {
// Draw everything in sector, no checks // Draw everything in sector, no checks
for (precipthing = sec->preciplist; precipthing; precipthing = precipthing->snext) for (precipthing = sec->preciplist; precipthing; precipthing = precipthing->snext)
if (!precipthing->invisible) if (!(precipthing->precipflags & PCF_INVISIBLE))
HWR_ProjectPrecipitationSprite(precipthing); HWR_ProjectPrecipitationSprite(precipthing);
} }
#endif #endif
@ -4576,16 +4550,17 @@ static void HWR_ProjectSprite(mobj_t *thing)
//Fab : 02-08-98: 'skin' override spritedef currently used for skin //Fab : 02-08-98: 'skin' override spritedef currently used for skin
if (thing->skin && thing->sprite == SPR_PLAY) if (thing->skin && thing->sprite == SPR_PLAY)
sprdef = &((skin_t *)thing->skin)->spritedef; sprdef = &((skin_t *)thing->skin)->sprites[thing->sprite2];
else else
sprdef = &sprites[thing->sprite]; sprdef = &sprites[thing->sprite];
if (rot >= sprdef->numframes) if (rot >= sprdef->numframes)
{ {
CONS_Alert(CONS_ERROR, M_GetText("R_ProjectSprite: invalid sprite frame %s/%s for %s\n"), CONS_Alert(CONS_ERROR, M_GetText("HWR_ProjectSprite: invalid sprite frame %s/%s for %s\n"),
sizeu1(rot), sizeu2(sprdef->numframes), sprnames[thing->sprite]); sizeu1(rot), sizeu2(sprdef->numframes), sprnames[thing->sprite]);
thing->sprite = states[S_UNKNOWN].sprite; thing->sprite = states[S_UNKNOWN].sprite;
thing->frame = states[S_UNKNOWN].frame; thing->frame = states[S_UNKNOWN].frame;
sprdef = &sprites[thing->sprite];
rot = thing->frame&FF_FRAMEMASK; rot = thing->frame&FF_FRAMEMASK;
thing->state->sprite = thing->sprite; thing->state->sprite = thing->sprite;
thing->state->frame = thing->frame; thing->state->frame = thing->frame;

View File

@ -921,24 +921,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;
} }
} }
@ -952,15 +953,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);
} }
@ -996,17 +996,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);
} }
@ -1021,6 +1018,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");
@ -1034,27 +1034,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);
} }
@ -1090,11 +1082,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)
@ -1105,8 +1103,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;
@ -1115,24 +1111,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;
@ -1149,15 +1139,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
@ -1215,7 +1201,7 @@ void HWR_DrawMD2(gr_vissprite_t *spr)
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->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])) && !(spr->mobj->player && spr->mobj->state->nextstate == S_PLAY_WAIT && spr->mobj->state == &states[S_PLAY_STND]))
{ {
const INT32 nextframe = (states[spr->mobj->state->nextstate].frame & FF_FRAMEMASK) % md2->model->header.numFrames; const INT32 nextframe = (states[spr->mobj->state->nextstate].frame & FF_FRAMEMASK) % md2->model->header.numFrames;
next = &md2->model->frames[nextframe]; next = &md2->model->frames[nextframe];
@ -1231,7 +1217,7 @@ void HWR_DrawMD2(gr_vissprite_t *spr)
p.z = FIXED_TO_FLOAT(spr->mobj->z); p.z = FIXED_TO_FLOAT(spr->mobj->z);
if (spr->mobj->skin && spr->mobj->sprite == SPR_PLAY) if (spr->mobj->skin && spr->mobj->sprite == SPR_PLAY)
sprdef = &((skin_t *)spr->mobj->skin)->spritedef; sprdef = &((skin_t *)spr->mobj->skin)->sprites[spr->mobj->sprite2];
else else
sprdef = &sprites[spr->mobj->sprite]; sprdef = &sprites[spr->mobj->sprite];
@ -1263,8 +1249,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

@ -1910,6 +1910,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

@ -56,6 +56,50 @@ char sprnames[NUMSPRITES + 1][5] =
"SRBJ","SRBK","SRBL","SRBM","SRBN","SRBO", "SRBJ","SRBK","SRBL","SRBM","SRBN","SRBO",
}; };
char spr2names[NUMPLAYERSPRITES][5] =
{
"STND",
"WAIT",
"WALK",
"RUN_",
"PAIN",
"DEAD",
"DRWN",
"SPIN",
"DASH",
"GASP",
"JUMP",
"FALL",
"EDGE",
"RIDE",
"SIGN",
"LIFE",
"FLY_",
"TIRE",
"GLID",
"CLNG",
"CLMB",
"TRNS",
"SSTD",
"SWLK",
"SRUN",
"SPAN",
"SMSL",
"SDTH",
"SDRN",
"SSPN",
"SGSP",
"SJMP",
"SFAL",
"SEDG",
"SRID",
"SFLT"
};
// Doesn't work with g++, needs actionf_p1 (don't modify this comment) // Doesn't work with g++, needs actionf_p1 (don't modify this comment)
state_t states[NUMSTATES] = state_t states[NUMSTATES] =
{ {
@ -81,77 +125,71 @@ state_t states[NUMSTATES] =
{SPR_THOK, FF_TRANS50, 8, {NULL}, 0, 0, S_NULL}, // S_THOK {SPR_THOK, FF_TRANS50, 8, {NULL}, 0, 0, S_NULL}, // S_THOK
// Player // Player
{SPR_PLAY, 0, 105, {NULL}, 0, 0, S_PLAY_TAP1}, // S_PLAY_STND {SPR_PLAY, SPR2_STND, 105, {NULL}, 0, 0, S_PLAY_WAIT}, // S_PLAY_STND
{SPR_PLAY, 1, 16, {NULL}, 0, 0, S_PLAY_TAP2}, // S_PLAY_TAP1 {SPR_PLAY, SPR2_WAIT, 16, {NULL}, 0, 0, S_PLAY_WAIT}, // S_PLAY_WAIT
{SPR_PLAY, 2, 16, {NULL}, 0, 0, S_PLAY_TAP1}, // S_PLAY_TAP2 {SPR_PLAY, SPR2_WALK, 4, {NULL}, 0, 0, S_PLAY_WALK}, // S_PLAY_WALK
{SPR_PLAY, 3, 4, {NULL}, 0, 0, S_PLAY_RUN2}, // S_PLAY_RUN1 {SPR_PLAY, SPR2_RUN , 2, {NULL}, 0, 0, S_PLAY_RUN}, // S_PLAY_RUN
{SPR_PLAY, 4, 4, {NULL}, 0, 0, S_PLAY_RUN3}, // S_PLAY_RUN2 {SPR_PLAY, SPR2_PAIN, 350, {NULL}, 0, 0, S_PLAY_FALL}, // S_PLAY_PAIN
{SPR_PLAY, 5, 4, {NULL}, 0, 0, S_PLAY_RUN4}, // S_PLAY_RUN3 {SPR_PLAY, SPR2_DEAD, 4, {NULL}, 0, 0, S_PLAY_DEAD}, // S_PLAY_DEAD
{SPR_PLAY, 6, 4, {NULL}, 0, 0, S_PLAY_RUN5}, // S_PLAY_RUN4 {SPR_PLAY, SPR2_DRWN, 4, {NULL}, 0, 0, S_PLAY_DRWN}, // S_PLAY_DRWN
{SPR_PLAY, 7, 4, {NULL}, 0, 0, S_PLAY_RUN6}, // S_PLAY_RUN5 {SPR_PLAY, SPR2_SPIN, 1, {NULL}, 0, 0, S_PLAY_SPIN}, // S_PLAY_SPIN
{SPR_PLAY, 8, 4, {NULL}, 0, 0, S_PLAY_RUN7}, // S_PLAY_RUN6 {SPR_PLAY, SPR2_DASH, 2, {NULL}, 0, 0, S_PLAY_DASH}, // S_PLAY_DASH
{SPR_PLAY, 9, 4, {NULL}, 0, 0, S_PLAY_RUN8}, // S_PLAY_RUN7 {SPR_PLAY, SPR2_GASP, 14, {NULL}, 0, 0, S_PLAY_WALK}, // S_PLAY_GASP
{SPR_PLAY, 10, 4, {NULL}, 0, 0, S_PLAY_RUN1}, // S_PLAY_RUN8 {SPR_PLAY, SPR2_JUMP, 2, {NULL}, 0, 0, S_PLAY_JUMP}, // S_PLAY_JUMP
{SPR_PLAY, 16, 2, {NULL}, 0, 0, S_PLAY_SPD2}, // S_PLAY_SPD1 {SPR_PLAY, SPR2_FALL, 2, {NULL}, 0, 0, S_PLAY_FALL}, // S_PLAY_FALL
{SPR_PLAY, 17, 2, {NULL}, 0, 0, S_PLAY_SPD3}, // S_PLAY_SPD2 {SPR_PLAY, SPR2_EDGE, 12, {NULL}, 0, 0, S_PLAY_EDGE}, // S_PLAY_EDGE
{SPR_PLAY, 18, 2, {NULL}, 0, 0, S_PLAY_SPD4}, // S_PLAY_SPD3 {SPR_PLAY, SPR2_RIDE, 4, {NULL}, 0, 0, S_PLAY_RIDE}, // S_PLAY_RIDE
{SPR_PLAY, 19, 2, {NULL}, 0, 0, S_PLAY_SPD1}, // S_PLAY_SPD4
{SPR_PLAY, 11, 1, {NULL}, 0, 0, S_PLAY_ATK2}, // S_PLAY_ATK1 // Tails abilities
{SPR_PLAY, 12, 1, {NULL}, 0, 0, S_PLAY_ATK3}, // S_PLAY_ATK2 {SPR_PLAY, SPR2_FLY , 2, {NULL}, 0, 0, S_PLAY_FLY}, // S_PLAY_FLY
{SPR_PLAY, 13, 1, {NULL}, 0, 0, S_PLAY_ATK4}, // S_PLAY_ATK3 {SPR_PLAY, SPR2_TIRE, 12, {NULL}, 0, 0, S_PLAY_FLY_TIRED}, // S_PLAY_FLY_TIRED
{SPR_PLAY, 14, 1, {NULL}, 0, 0, S_PLAY_ATK1}, // S_PLAY_ATK4
{SPR_PLAY, 15, -1, {NULL}, 0, 0, S_PLAY_FALL1}, // S_PLAY_SPRING // Knuckles abilities
{SPR_PLAY, 31, 2, {NULL}, 0, 0, S_PLAY_FALL2}, // S_PLAY_FALL1 {SPR_PLAY, SPR2_GLID, 2, {NULL}, 0, 0, S_PLAY_GLIDE}, // S_PLAY_GLIDE
{SPR_PLAY, 32, 2, {NULL}, 0, 0, S_PLAY_FALL1}, // S_PLAY_FALL2 {SPR_PLAY, SPR2_CLNG, 6, {NULL}, 0, 0, S_PLAY_CLING}, // S_PLAY_CLING
{SPR_PLAY, 20, 2, {NULL}, 0, 0, S_PLAY_ABL2}, // S_PLAY_ABL1 {SPR_PLAY, SPR2_CLMB, 5, {NULL}, 0, 0, S_PLAY_CLIMB}, // S_PLAY_CLIMB
{SPR_PLAY, 21, 2, {NULL}, 0, 0, S_PLAY_ABL1}, // S_PLAY_ABL2
{SPR_PLAY, 22, 6, {NULL}, 0, 0, S_PLAY_SPC2}, // S_PLAY_SPC1 // Super Sonic
{SPR_PLAY, 23, 6, {NULL}, 0, 0, S_PLAY_SPC3}, // S_PLAY_SPC2 {SPR_PLAY, SPR2_SSTD, 7, {NULL}, 0, 0, S_PLAY_SUPER_STND}, // S_PLAY_SUPER_STND
{SPR_PLAY, 24, 6, {NULL}, 0, 0, S_PLAY_SPC4}, // S_PLAY_SPC3 {SPR_PLAY, SPR2_SWLK, 7, {NULL}, 0, 0, S_PLAY_SUPER_WALK}, // S_PLAY_SUPER_WALK
{SPR_PLAY, 25, 6, {NULL}, 0, 0, S_PLAY_SPC1}, // S_PLAY_SPC4 {SPR_PLAY, SPR2_SRUN, 7, {NULL}, 0, 0, S_PLAY_SUPER_RUN}, // S_PLAY_SUPER_RUN
{SPR_PLAY, 22, -1, {NULL}, 0, 0, S_NULL}, // S_PLAY_CLIMB1 {SPR_PLAY, SPR2_SPAN, -1, {NULL}, 0, 0, S_PLAY_SUPER_STND}, // S_PLAY_SUPER_PAIN
{SPR_PLAY, 23, 5, {NULL}, 0, 0, S_PLAY_CLIMB3}, // S_PLAY_CLIMB2 {SPR_PLAY, SPR2_SMSL, -1, {NULL}, 0, 0, S_PLAY_SUPER_STND}, // S_PLAY_SUPER_STUN
{SPR_PLAY, 24, 5, {NULL}, 0, 0, S_PLAY_CLIMB4}, // S_PLAY_CLIMB3 {SPR_PLAY, SPR2_SDTH, 4, {NULL}, 0, 0, S_PLAY_SUPER_DEAD}, // S_PLAY_SUPER_DEAD
{SPR_PLAY, 25, 5, {NULL}, 0, 0, S_PLAY_CLIMB5}, // S_PLAY_CLIMB4 {SPR_PLAY, SPR2_SDRN, 4, {NULL}, 0, 0, S_PLAY_SUPER_DRWN}, // S_PLAY_SUPER_DRWN
{SPR_PLAY, 24, 5, {NULL}, 0, 0, S_PLAY_CLIMB2}, // S_PLAY_CLIMB5 {SPR_PLAY, SPR2_SSPN, 1, {NULL}, 0, 0, S_PLAY_SUPER_SPIN}, // S_PLAY_SUPER_SPIN
{SPR_PLAY, 26, 14, {NULL}, 0, 0, S_PLAY_RUN1}, // S_PLAY_GASP {SPR_PLAY, SPR2_SGSP, 14, {NULL}, 0, 0, S_PLAY_SUPER_WALK}, // S_PLAY_SUPER_GASP
{SPR_PLAY, 27, 350, {NULL}, 0, 0, S_PLAY_FALL1}, // S_PLAY_PAIN {SPR_PLAY, SPR2_SJMP, 2, {NULL}, 0, 0, S_PLAY_SUPER_JUMP}, // S_PLAY_SUPER_JUMP
{SPR_PLAY, 28, -1, {A_Fall}, 0, 0, S_NULL}, // S_PLAY_DIE {SPR_PLAY, SPR2_SFAL, 2, {NULL}, 0, 0, S_PLAY_SUPER_FALL}, // S_PLAY_SUPER_FALL
{SPR_PLAY, 29, 12, {NULL}, 0, 0, S_PLAY_TEETER2}, // S_PLAY_TEETER1 {SPR_PLAY, SPR2_SEDG, 12, {NULL}, 0, 0, S_PLAY_SUPER_EDGE}, // S_PLAY_SUPER_EDGE
{SPR_PLAY, 30, 12, {NULL}, 0, 0, S_PLAY_TEETER1}, // S_PLAY_TEETER2 {SPR_PLAY, SPR2_SRID, 4, {NULL}, 0, 0, S_PLAY_SUPER_RIDE}, // S_PLAY_SUPER_RIDE
{SPR_PLAY, 33, -1, {NULL}, 0, 0, S_NULL}, // S_PLAY_CARRY {SPR_PLAY, SPR2_SFLT, 7, {NULL}, 0, 0, S_PLAY_SUPER_FLOAT}, // S_PLAY_SUPER_FLOAT
{SPR_PLAY, 20, -1, {NULL}, 0, 0, S_PLAY_SUPERSTAND}, // S_PLAY_SUPERSTAND
{SPR_PLAY, 20, 7, {NULL}, 0, 0, S_PLAY_SUPERWALK2}, // S_PLAY_SUPERWALK1 // Transforming into Super
{SPR_PLAY, 21, 7, {NULL}, 0, 0, S_PLAY_SUPERWALK1}, // S_PLAY_SUPERWALK2 {SPR_PLAY, SPR2_TRNS, 4, {NULL}, 0, 0, S_PLAY_SUPER_TRANS2}, // S_PLAY_SUPER_TRANS
{SPR_PLAY, 22, 7, {NULL}, 0, 0, S_PLAY_SUPERFLY2}, // S_PLAY_SUPERFLY1 {SPR_PLAY, SPR2_TRNS, 4, {NULL}, 0, 0, S_PLAY_SUPER_TRANS3}, // S_PLAY_SUPER_TRANS2
{SPR_PLAY, 23, 7, {NULL}, 0, 0, S_PLAY_SUPERFLY1}, // S_PLAY_SUPERFLY2 {SPR_PLAY, SPR2_TRNS|FF_FULLBRIGHT, 4, {NULL}, 0, 0, S_PLAY_SUPER_TRANS4}, // S_PLAY_SUPER_TRANS3
{SPR_PLAY, 24, 12, {NULL}, 0, 0, S_PLAY_SUPERTEETER}, // S_PLAY_SUPERTEETER {SPR_PLAY, SPR2_TRNS, 3, {NULL}, 0, 0, S_PLAY_SUPER_TRANS5}, // S_PLAY_SUPER_TRANS4
{SPR_PLAY, 25, -1, {NULL}, 0, 0, S_PLAY_SUPERSTAND}, // S_PLAY_SUPERHIT {SPR_PLAY, SPR2_TRNS, 3, {NULL}, 0, 0, S_PLAY_SUPER_TRANS6}, // S_PLAY_SUPER_TRANS5
{SPR_PLAY, 36, 4, {NULL}, 0, 0, S_PLAY_SUPERTRANS2}, // S_PLAY_SUPERTRANS1 {SPR_PLAY, SPR2_TRNS, 3, {NULL}, 0, 0, S_PLAY_SUPER_TRANS7}, // S_PLAY_SUPER_TRANS6
{SPR_PLAY, 37, 4, {NULL}, 0, 0, S_PLAY_SUPERTRANS3}, // S_PLAY_SUPERTRANS2 {SPR_PLAY, SPR2_TRNS, 3, {NULL}, 0, 0, S_PLAY_SUPER_TRANS8}, // S_PLAY_SUPER_TRANS7
{SPR_PLAY, 32806, 4, {NULL}, 0, 0, S_PLAY_SUPERTRANS4}, // S_PLAY_SUPERTRANS3 {SPR_PLAY, SPR2_TRNS, 3, {NULL}, 0, 0, S_PLAY_SUPER_TRANS9}, // S_PLAY_SUPER_TRANS8
{SPR_PLAY, 39, 3, {NULL}, 0, 0, S_PLAY_SUPERTRANS5}, // S_PLAY_SUPERTRANS4 {SPR_PLAY, SPR2_TRNS, 16, {NULL}, 0, 0, S_PLAY_WALK}, // S_PLAY_SUPER_TRANS9
{SPR_PLAY, 40, 3, {NULL}, 0, 0, S_PLAY_SUPERTRANS6}, // S_PLAY_SUPERTRANS5
{SPR_PLAY, 41, 3, {NULL}, 0, 0, S_PLAY_SUPERTRANS7}, // S_PLAY_SUPERTRANS6
{SPR_PLAY, 42, 3, {NULL}, 0, 0, S_PLAY_SUPERTRANS8}, // S_PLAY_SUPERTRANS7
{SPR_PLAY, 43, 3, {NULL}, 0, 0, S_PLAY_SUPERTRANS9}, // S_PLAY_SUPERTRANS8
{SPR_PLAY, 44, 16, {NULL}, 0, 0, S_PLAY_RUN1}, // S_PLAY_SUPERTRANS9
{SPR_NULL, 0, -1, {NULL}, 0, 0, S_OBJPLACE_DUMMY}, //S_OBJPLACE_DUMMY {SPR_NULL, 0, -1, {NULL}, 0, 0, S_OBJPLACE_DUMMY}, //S_OBJPLACE_DUMMY
// 1-Up Box Sprites (uses player sprite) // 1-Up Box Sprites (uses player sprite)
{SPR_PLAY, 35, 2, {NULL}, 0, 16, S_PLAY_BOX2}, // S_PLAY_BOX1 {SPR_PLAY, SPR2_LIFE, 2, {NULL}, 0, 16, S_PLAY_BOX2}, // S_PLAY_BOX1
{SPR_NULL, 0, 1, {NULL}, 0, 0, S_PLAY_BOX1}, // S_PLAY_BOX2 {SPR_NULL, 0, 1, {NULL}, 0, 0, S_PLAY_BOX1}, // S_PLAY_BOX2
{SPR_PLAY, 35, 4, {NULL}, 0, 4, S_PLAY_ICON2}, // S_PLAY_ICON1 {SPR_PLAY, SPR2_LIFE, 4, {NULL}, 0, 4, S_PLAY_ICON2}, // S_PLAY_ICON1
{SPR_NULL, 0, 12, {NULL}, 0, 0, S_PLAY_ICON3}, // S_PLAY_ICON2 {SPR_NULL, 0, 12, {NULL}, 0, 0, S_PLAY_ICON3}, // S_PLAY_ICON2
{SPR_PLAY, 35, 18, {NULL}, 0, 4, S_NULL}, // S_PLAY_ICON3 {SPR_PLAY, SPR2_LIFE, 18, {NULL}, 0, 4, S_NULL}, // S_PLAY_ICON3
// Level end sign (uses player sprite) // Level end sign (uses player sprite)
{SPR_PLAY, 34, 1, {NULL}, 0, 24, S_PLAY_SIGN}, // S_PLAY_SIGN {SPR_PLAY, SPR2_SIGN, 1, {NULL}, 0, 24, S_PLAY_SIGN}, // S_PLAY_SIGN
// Blue Crawla // Blue Crawla
{SPR_POSS, 0, 5, {A_Look}, 0, 0, S_POSS_STND2}, // S_POSS_STND {SPR_POSS, 0, 5, {A_Look}, 0, 0, S_POSS_STND}, // S_POSS_STND
{SPR_POSS, 0, 5, {A_Look}, 0, 0, S_POSS_STND}, // S_POSS_STND2
{SPR_POSS, 0, 3, {A_Chase}, 0, 0, S_POSS_RUN2}, // S_POSS_RUN1 {SPR_POSS, 0, 3, {A_Chase}, 0, 0, S_POSS_RUN2}, // S_POSS_RUN1
{SPR_POSS, 1, 3, {A_Chase}, 0, 0, S_POSS_RUN3}, // S_POSS_RUN2 {SPR_POSS, 1, 3, {A_Chase}, 0, 0, S_POSS_RUN3}, // S_POSS_RUN2
{SPR_POSS, 2, 3, {A_Chase}, 0, 0, S_POSS_RUN4}, // S_POSS_RUN3 {SPR_POSS, 2, 3, {A_Chase}, 0, 0, S_POSS_RUN4}, // S_POSS_RUN3
@ -160,8 +198,7 @@ state_t states[NUMSTATES] =
{SPR_POSS, 5, 3, {A_Chase}, 0, 0, S_POSS_RUN1}, // S_POSS_RUN6 {SPR_POSS, 5, 3, {A_Chase}, 0, 0, S_POSS_RUN1}, // S_POSS_RUN6
// Red Crawla // Red Crawla
{SPR_SPOS, 0, 5, {A_Look}, 0, 0, S_SPOS_STND2}, // S_SPOS_STND {SPR_SPOS, 0, 5, {A_Look}, 0, 0, S_SPOS_STND}, // S_SPOS_STND
{SPR_SPOS, 0, 5, {A_Look}, 0, 0, S_SPOS_STND}, // S_SPOS_STND2
{SPR_SPOS, 0, 1, {A_Chase}, 0, 0, S_SPOS_RUN2}, // S_SPOS_RUN1 {SPR_SPOS, 0, 1, {A_Chase}, 0, 0, S_SPOS_RUN2}, // S_SPOS_RUN1
{SPR_SPOS, 1, 1, {A_Chase}, 0, 0, S_SPOS_RUN3}, // S_SPOS_RUN2 {SPR_SPOS, 1, 1, {A_Chase}, 0, 0, S_SPOS_RUN3}, // S_SPOS_RUN2
{SPR_SPOS, 2, 1, {A_Chase}, 0, 0, S_SPOS_RUN4}, // S_SPOS_RUN3 {SPR_SPOS, 2, 1, {A_Chase}, 0, 0, S_SPOS_RUN4}, // S_SPOS_RUN3
@ -3110,7 +3147,7 @@ mobjinfo_t mobjinfo[NUMMOBJTYPES] =
-1, // doomednum -1, // doomednum
S_PLAY_STND, // spawnstate S_PLAY_STND, // spawnstate
1, // spawnhealth 1, // spawnhealth
S_PLAY_RUN1, // seestate S_PLAY_WALK, // seestate
sfx_None, // seesound sfx_None, // seesound
0, // reactiontime 0, // reactiontime
sfx_thok, // attacksound sfx_thok, // attacksound
@ -3118,9 +3155,9 @@ mobjinfo_t mobjinfo[NUMMOBJTYPES] =
MT_THOK, // painchance MT_THOK, // painchance
sfx_None, // painsound sfx_None, // painsound
S_NULL, // meleestate S_NULL, // meleestate
S_PLAY_ATK1, // missilestate S_PLAY_SPIN, // missilestate
S_PLAY_DIE, // deathstate S_PLAY_DEAD, // deathstate
S_NULL, // xdeathstate S_PLAY_DRWN, // xdeathstate
sfx_None, // deathsound sfx_None, // deathsound
1, // speed 1, // speed
16*FRACUNIT, // radius 16*FRACUNIT, // radius

View File

@ -575,6 +575,52 @@ typedef enum sprite
NUMSPRITES NUMSPRITES
} spritenum_t; } spritenum_t;
enum playersprite
{
SPR2_STND = 0,
SPR2_WAIT,
SPR2_WALK,
SPR2_RUN ,
SPR2_PAIN,
SPR2_DEAD,
SPR2_DRWN,
SPR2_SPIN,
SPR2_DASH,
SPR2_GASP,
SPR2_JUMP,
SPR2_FALL,
SPR2_EDGE,
SPR2_RIDE,
SPR2_SIGN,
SPR2_LIFE,
SPR2_FLY ,
SPR2_TIRE,
SPR2_GLID,
SPR2_CLNG,
SPR2_CLMB,
SPR2_TRNS,
SPR2_SSTD,
SPR2_SWLK,
SPR2_SRUN,
SPR2_SPAN,
SPR2_SMSL,
SPR2_SDTH,
SPR2_SDRN,
SPR2_SSPN,
SPR2_SGSP,
SPR2_SJMP,
SPR2_SFAL,
SPR2_SEDG,
SPR2_SRID,
SPR2_SFLT,
NUMPLAYERSPRITES
};
typedef enum state typedef enum state
{ {
S_NULL, S_NULL,
@ -592,61 +638,57 @@ typedef enum state
// Thok // Thok
S_THOK, S_THOK,
// Player
S_PLAY_STND, S_PLAY_STND,
S_PLAY_TAP1, S_PLAY_WAIT,
S_PLAY_TAP2, S_PLAY_WALK,
S_PLAY_RUN1, S_PLAY_RUN,
S_PLAY_RUN2,
S_PLAY_RUN3,
S_PLAY_RUN4,
S_PLAY_RUN5,
S_PLAY_RUN6,
S_PLAY_RUN7,
S_PLAY_RUN8,
S_PLAY_SPD1,
S_PLAY_SPD2,
S_PLAY_SPD3,
S_PLAY_SPD4,
S_PLAY_ATK1,
S_PLAY_ATK2,
S_PLAY_ATK3,
S_PLAY_ATK4,
S_PLAY_SPRING,
S_PLAY_FALL1,
S_PLAY_FALL2,
S_PLAY_ABL1,
S_PLAY_ABL2,
S_PLAY_SPC1,
S_PLAY_SPC2,
S_PLAY_SPC3,
S_PLAY_SPC4,
S_PLAY_CLIMB1,
S_PLAY_CLIMB2,
S_PLAY_CLIMB3,
S_PLAY_CLIMB4,
S_PLAY_CLIMB5,
S_PLAY_GASP,
S_PLAY_PAIN, S_PLAY_PAIN,
S_PLAY_DIE, S_PLAY_DEAD,
S_PLAY_TEETER1, S_PLAY_DRWN,
S_PLAY_TEETER2, S_PLAY_SPIN,
S_PLAY_CARRY, S_PLAY_DASH,
S_PLAY_SUPERSTAND, S_PLAY_GASP,
S_PLAY_SUPERWALK1, S_PLAY_JUMP,
S_PLAY_SUPERWALK2, S_PLAY_FALL,
S_PLAY_SUPERFLY1, S_PLAY_EDGE,
S_PLAY_SUPERFLY2, S_PLAY_RIDE,
S_PLAY_SUPERTEETER,
S_PLAY_SUPERHIT, // CA_FLY
S_PLAY_SUPERTRANS1, S_PLAY_FLY,
S_PLAY_SUPERTRANS2, S_PLAY_FLY_TIRED,
S_PLAY_SUPERTRANS3,
S_PLAY_SUPERTRANS4, // CA_GLIDEANDCLIMB
S_PLAY_SUPERTRANS5, S_PLAY_GLIDE,
S_PLAY_SUPERTRANS6, S_PLAY_CLING,
S_PLAY_SUPERTRANS7, S_PLAY_CLIMB,
S_PLAY_SUPERTRANS8,
S_PLAY_SUPERTRANS9, // This has special significance in the code. If you add more frames, search for it and make the appropriate changes. // SF_SUPERANIMS
S_PLAY_SUPER_STND,
S_PLAY_SUPER_WALK,
S_PLAY_SUPER_RUN,
S_PLAY_SUPER_PAIN,
S_PLAY_SUPER_STUN,
S_PLAY_SUPER_DEAD,
S_PLAY_SUPER_DRWN,
S_PLAY_SUPER_SPIN,
S_PLAY_SUPER_GASP,
S_PLAY_SUPER_JUMP,
S_PLAY_SUPER_FALL,
S_PLAY_SUPER_EDGE,
S_PLAY_SUPER_RIDE,
S_PLAY_SUPER_FLOAT,
// SF_SUPER
S_PLAY_SUPER_TRANS,
S_PLAY_SUPER_TRANS2,
S_PLAY_SUPER_TRANS3,
S_PLAY_SUPER_TRANS4,
S_PLAY_SUPER_TRANS5,
S_PLAY_SUPER_TRANS6,
S_PLAY_SUPER_TRANS7,
S_PLAY_SUPER_TRANS8,
S_PLAY_SUPER_TRANS9,
// technically the player goes here but it's an infinite tic state // technically the player goes here but it's an infinite tic state
S_OBJPLACE_DUMMY, S_OBJPLACE_DUMMY,
@ -663,7 +705,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 +714,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,
@ -1390,7 +1430,7 @@ typedef enum state
// S_PLAY_TAP1 // S_PLAY_TAP1
S_METALSONIC_WAIT1, S_METALSONIC_WAIT1,
S_METALSONIC_WAIT2, S_METALSONIC_WAIT2,
// S_PLAY_RUN1 // S_PLAY_WALK
S_METALSONIC_WALK1, S_METALSONIC_WALK1,
S_METALSONIC_WALK2, S_METALSONIC_WALK2,
S_METALSONIC_WALK3, S_METALSONIC_WALK3,
@ -3488,6 +3528,7 @@ typedef struct
extern state_t states[NUMSTATES]; extern state_t states[NUMSTATES];
extern char sprnames[NUMSPRITES + 1][5]; extern char sprnames[NUMSPRITES + 1][5];
char spr2names[NUMPLAYERSPRITES][5];
extern state_t *astate; extern state_t *astate;
typedef enum mobj_type typedef enum mobj_type

View File

@ -85,13 +85,6 @@ static int lib_print(lua_State *L)
return 0; return 0;
} }
static int lib_evalMath(lua_State *L)
{
const char *word = luaL_checkstring(L, 1);
lua_pushinteger(L, LUA_EvalMath(word));
return 1;
}
// M_RANDOM // M_RANDOM
////////////// //////////////
@ -138,25 +131,25 @@ static int lib_pRandomRange(lua_State *L)
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); fixed_t x = luaL_checkfixed(L, 1);
fixed_t y = (fixed_t)luaL_checkinteger(L, 2); fixed_t y = luaL_checkfixed(L, 2);
line_t *line = *((line_t **)luaL_checkudata(L, 3, META_LINE)); line_t *line = *((line_t **)luaL_checkudata(L, 3, META_LINE));
vertex_t result; vertex_t result;
//HUDSAFE //HUDSAFE
if (!line) if (!line)
return LUA_ErrInvalid(L, "line_t"); return LUA_ErrInvalid(L, "line_t");
P_ClosestPointOnLine(x, y, line, &result); P_ClosestPointOnLine(x, y, line, &result);
lua_pushinteger(L, result.x); lua_pushfixed(L, result.x);
lua_pushinteger(L, result.y); lua_pushfixed(L, result.y);
return 2; return 2;
} }
@ -241,9 +234,9 @@ 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 > MT_LASTFREESLOT)
@ -283,9 +276,9 @@ 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");
@ -298,13 +291,13 @@ 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");
@ -318,9 +311,9 @@ 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)
@ -348,7 +341,7 @@ 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
@ -418,13 +411,13 @@ 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
@ -458,7 +451,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 +519,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 +529,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 +632,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 +746,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 +761,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 +774,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 +795,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");
@ -868,8 +861,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 +877,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 +892,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 +908,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 +922,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 +968,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 +983,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 +993,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 +1009,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
@ -1037,6 +1030,7 @@ static int lib_pDamageMobj(lua_State *L)
{ {
mobj_t *target = *((mobj_t **)luaL_checkudata(L, 1, META_MOBJ)), *inflictor = NULL, *source = NULL; mobj_t *target = *((mobj_t **)luaL_checkudata(L, 1, META_MOBJ)), *inflictor = NULL, *source = NULL;
INT32 damage; INT32 damage;
UINT8 damagetype;
NOHUD NOHUD
if (!target) if (!target)
return LUA_ErrInvalid(L, "mobj_t"); return LUA_ErrInvalid(L, "mobj_t");
@ -1045,13 +1039,15 @@ static int lib_pDamageMobj(lua_State *L)
if (!lua_isnone(L, 3) && lua_isuserdata(L, 3)) if (!lua_isnone(L, 3) && lua_isuserdata(L, 3))
source = *((mobj_t **)luaL_checkudata(L, 3, META_MOBJ)); source = *((mobj_t **)luaL_checkudata(L, 3, META_MOBJ));
damage = (INT32)luaL_optinteger(L, 4, 1); damage = (INT32)luaL_optinteger(L, 4, 1);
lua_pushboolean(L, P_DamageMobj(target, inflictor, source, damage)); damagetype = (UINT8)luaL_optinteger(L, 5, 0);
lua_pushboolean(L, P_DamageMobj(target, inflictor, source, damage, damagetype));
return 1; return 1;
} }
static int lib_pKillMobj(lua_State *L) static int lib_pKillMobj(lua_State *L)
{ {
mobj_t *target = *((mobj_t **)luaL_checkudata(L, 1, META_MOBJ)), *inflictor = NULL, *source = NULL; mobj_t *target = *((mobj_t **)luaL_checkudata(L, 1, META_MOBJ)), *inflictor = NULL, *source = NULL;
UINT8 damagetype;
NOHUD NOHUD
if (!target) if (!target)
return LUA_ErrInvalid(L, "mobj_t"); return LUA_ErrInvalid(L, "mobj_t");
@ -1059,7 +1055,8 @@ static int lib_pKillMobj(lua_State *L)
inflictor = *((mobj_t **)luaL_checkudata(L, 2, META_MOBJ)); inflictor = *((mobj_t **)luaL_checkudata(L, 2, META_MOBJ));
if (!lua_isnone(L, 3) && lua_isuserdata(L, 3)) if (!lua_isnone(L, 3) && lua_isuserdata(L, 3))
source = *((mobj_t **)luaL_checkudata(L, 3, META_MOBJ)); source = *((mobj_t **)luaL_checkudata(L, 3, META_MOBJ));
P_KillMobj(target, inflictor, source); damagetype = (UINT8)luaL_optinteger(L, 4, 0);
P_KillMobj(target, inflictor, source, damagetype);
return 0; return 0;
} }
@ -1209,8 +1206,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");
@ -1485,48 +1482,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;
@ -1660,7 +1657,7 @@ static int lib_sChangeMusic(lua_State *L)
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
@ -1861,7 +1858,6 @@ static int lib_gTicsToMilliseconds(lua_State *L)
static luaL_Reg lib[] = { static luaL_Reg lib[] = {
{"print", lib_print}, {"print", lib_print},
{"EvalMath", lib_evalMath},
// m_random // m_random
{"P_Random",lib_pRandom}, {"P_Random",lib_pRandom},

View File

@ -41,7 +41,7 @@ enum hook {
hook_BotAI, hook_BotAI,
hook_LinedefExecute, hook_LinedefExecute,
hook_PlayerMsg, hook_PlayerMsg,
hook_DeathMsg, hook_HurtMsg,
hook_MAX // last hook hook_MAX // last hook
}; };
@ -54,8 +54,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 +74,6 @@ 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
#endif #endif

File diff suppressed because it is too large Load Diff

View File

@ -126,8 +126,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 +135,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 +144,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 +153,6 @@ static const char *const camera_opt[] = {
"ceilingz", "ceilingz",
"radius", "radius",
"height", "height",
"relativex",
"momx", "momx",
"momy", "momy",
"momz", "momz",
@ -279,12 +273,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 +300,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;
@ -689,8 +674,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 +699,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

@ -91,6 +91,44 @@ static int lib_sprnamelen(lua_State *L)
return 1; return 1;
} }
//
// Player Sprite Names
//
// push sprite name
static int lib_getSpr2name(lua_State *L)
{
UINT32 i;
lua_remove(L, 1); // don't care about spr2names[] dummy userdata.
if (lua_isnumber(L, 1))
{
i = lua_tonumber(L, 1);
if (i > NUMPLAYERSPRITES)
return 0;
lua_pushlstring(L, spr2names[i], 4);
return 1;
}
else if (lua_isstring(L, 1))
{
const char *name = lua_tostring(L, 1);
for (i = 0; i < NUMPLAYERSPRITES; i++)
if (fastcmp(name, spr2names[i]))
{
lua_pushinteger(L, i);
return 1;
}
}
return 0;
}
static int lib_spr2namelen(lua_State *L)
{
lua_pushinteger(L, NUMPLAYERSPRITES);
return 1;
}
//////////////// ////////////////
// STATE INFO // // STATE INFO //
//////////////// ////////////////
@ -137,8 +175,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 *
@ -510,11 +546,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 +616,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 +692,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"))
@ -904,6 +940,16 @@ int LUA_InfoLib(lua_State *L)
lua_setmetatable(L, -2); lua_setmetatable(L, -2);
lua_setglobal(L, "sprnames"); lua_setglobal(L, "sprnames");
lua_newuserdata(L, 0);
lua_createtable(L, 0, 2);
lua_pushcfunction(L, lib_getSpr2name);
lua_setfield(L, -2, "__index");
lua_pushcfunction(L, lib_spr2namelen);
lua_setfield(L, -2, "__len");
lua_setmetatable(L, -2);
lua_setglobal(L, "spr2names");
lua_newuserdata(L, 0); lua_newuserdata(L, 0);
lua_createtable(L, 0, 2); lua_createtable(L, 0, 2);
lua_pushcfunction(L, lib_getState); lua_pushcfunction(L, lib_getState);

View File

@ -60,7 +60,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 +67,6 @@ static const char *const subsector_opt[] = {
"sector", "sector",
"numlines", "numlines",
"firstline", "firstline",
"validcount",
NULL}; NULL};
enum line_e { enum line_e {
@ -86,7 +84,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 +105,6 @@ static const char *const line_opt[] = {
"slopetype", "slopetype",
"frontsector", "frontsector",
"backsector", "backsector",
"validcount",
"firsttag", "firsttag",
"nexttag", "nexttag",
"text", "text",
@ -284,10 +280,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;
@ -400,26 +396,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 +476,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 +513,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 +561,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 +632,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 +662,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 +733,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 +1002,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 +1016,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 +1075,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,14 +1096,16 @@ 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:
@ -1224,6 +1266,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

@ -47,37 +47,37 @@ 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)); lua_pushfixed(L, FINETANGENT((luaL_checkangle(L, 1)>>ANGLETOFINESHIFT) & FINEMASK));
return 1; return 1;
} }
@ -86,61 +86,61 @@ 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))); lua_pushfixed(L, FixedDiv(luaL_checkfixed(L, 1), luaL_checkfixed(L, 2)));
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))); lua_pushfixed(L, FixedSqrt(luaL_checkfixed(L, 1)));
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 +156,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;
} }

View File

@ -162,13 +162,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 +179,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);
@ -193,28 +193,28 @@ static int mobj_get(lua_State *L)
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 +299,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 +382,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 +394,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])
@ -417,7 +417,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 +429,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 +439,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,7 +501,7 @@ 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; mo->color = ((UINT8)luaL_checkinteger(L, 3)) % MAXTRANSLATIONS;
break; break;
case mobj_bnext: case mobj_bnext:
return NOSETPOS; return NOSETPOS;
@ -572,25 +573,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 +600,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

@ -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"))
@ -305,16 +305,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 +354,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])
@ -391,13 +391,13 @@ static int player_set(lua_State *L)
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 +433,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 +455,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 +489,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"))
@ -569,7 +569,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 +578,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

@ -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;
} }
@ -948,6 +939,14 @@ static void NetArchiveHook(lua_CFunction archFunc)
lua_pop(gL, 2); lua_pop(gL, 2);
} }
void LUA_Step(void)
{
if (!gL)
return;
lua_settop(gL, 0);
lua_gc(gL, LUA_GCSTEP, 1);
}
void LUA_Archive(void) void LUA_Archive(void)
{ {
INT32 i; INT32 i;

View File

@ -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
// we reduce the angle to a fixed point between 0.0 and 1.0
#define luaL_checkangle(L, i) (((angle_t)(luaL_checkfixed(L, i)&0xFFFF))<<16)
#define lua_pushangle(L, a) lua_pushfixed(L, a>>16)
#ifdef _DEBUG #ifdef _DEBUG
void LUA_ClearExtVars(void); void LUA_ClearExtVars(void);
#endif #endif
@ -36,6 +48,7 @@ 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

View File

@ -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);

View File

@ -91,6 +91,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 +142,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
// ========================================================================== // ==========================================================================
@ -221,6 +256,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);
} }
@ -334,7 +372,7 @@ void Command_Hurtme_f(void)
return; return;
} }
P_DamageMobj(players[consoleplayer].mo, NULL, NULL, atoi(COM_Argv(1))); P_DamageMobj(players[consoleplayer].mo, NULL, NULL, atoi(COM_Argv(1)), 0);
} }
// Moves the NiGHTS player to another axis within the current mare // Moves the NiGHTS player to another axis within the current mare

View File

@ -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

@ -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

@ -110,10 +110,10 @@ const char *quitmsg[NUM_QUITMESSAGES];
// Stuff for customizing the player select screen Tails 09-22-2003 // Stuff for customizing the player select screen Tails 09-22-2003
description_t description[32] = description_t description[32] =
{ {
{"\x82Sonic\x80 is the fastest of the three, but also the hardest to control. Beginners beware, but experts will find Sonic very powerful.\n\n\x82""Ability:\x80 Speed Thok\nDouble jump to zoom forward with a huge burst of speed.\n\n\x82Tip:\x80 Simply letting go of forward does not slow down in SRB2. To slow down, hold the opposite direction.", "", "sonic"}, {"???", "", ""},
{"\x82Tails\x80 is the most mobile of the three, but has the slowest speed. Because of his mobility, he's well-\nsuited to beginners.\n\n\x82""Ability:\x80 Fly\nDouble jump to start flying for a limited time. Repetitively hit the jump button to ascend.\n\n\x82Tip:\x80 To quickly descend while flying, hit the spin button.", "", "tails"}, {"???", "", ""},
{"\x82Knuckles\x80 is well-\nrounded and can destroy breakable walls simply by touching them, but he can't jump as high as the other two.\n\n\x82""Ability:\x80 Glide & Climb\nDouble jump to glide in the air as long as jump is held. Glide into a wall to climb it.\n\n\x82Tip:\x80 Press spin while climbing to jump off the wall; press jump instead to jump off\nand face away from\nthe wall.", "", "knuckles"}, {"???", "", ""},
{"\x82Sonic & Tails\x80 team up to take on Dr. Eggman!\nControl Sonic while Tails desperately struggles to keep up.\n\nPlayer 2 can control Tails directly by setting the controls in the options menu.\nTails's directional controls are relative to Player 1's camera.\n\nTails can pick up Sonic while flying and carry him around.", "CHRS&T", "sonic&tails"}, {"???", "", ""},
{"???", "", ""}, {"???", "", ""},
{"???", "", ""}, {"???", "", ""},
{"???", "", ""}, {"???", "", ""},
@ -827,10 +827,10 @@ static menuitem_t SP_LevelStatsMenu[] =
// And I'm too lazy to go through and rename it everywhere. ARRGH! // And I'm too lazy to go through and rename it everywhere. ARRGH!
menuitem_t PlayerMenu[32] = menuitem_t PlayerMenu[32] =
{ {
{IT_CALL, NULL, NULL, M_ChoosePlayer, 0}, {IT_DISABLED, NULL, NULL, M_ChoosePlayer, 0},
{IT_CALL, NULL, NULL, M_ChoosePlayer, 0}, {IT_DISABLED, NULL, NULL, M_ChoosePlayer, 0},
{IT_CALL, NULL, NULL, M_ChoosePlayer, 0}, {IT_DISABLED, NULL, NULL, M_ChoosePlayer, 0},
{IT_CALL, NULL, NULL, M_ChoosePlayer, 0}, {IT_DISABLED, NULL, NULL, M_ChoosePlayer, 0},
{IT_DISABLED, NULL, NULL, M_ChoosePlayer, 0}, {IT_DISABLED, NULL, NULL, M_ChoosePlayer, 0},
{IT_DISABLED, NULL, NULL, M_ChoosePlayer, 0}, {IT_DISABLED, NULL, NULL, M_ChoosePlayer, 0},
{IT_DISABLED, NULL, NULL, M_ChoosePlayer, 0}, {IT_DISABLED, NULL, NULL, M_ChoosePlayer, 0},
@ -2203,6 +2203,7 @@ boolean M_Responder(event_t *ev)
if (modeattacking) if (modeattacking)
return true; return true;
M_StartControlPanel(); M_StartControlPanel();
M_Options(0);
currentMenu = &OP_SoundOptionsDef; currentMenu = &OP_SoundOptionsDef;
itemOn = 0; itemOn = 0;
return true; return true;
@ -2212,6 +2213,7 @@ boolean M_Responder(event_t *ev)
if (modeattacking) if (modeattacking)
return true; return true;
M_StartControlPanel(); M_StartControlPanel();
M_Options(0);
M_VideoModeMenu(0); M_VideoModeMenu(0);
return true; return true;
#endif #endif
@ -2223,6 +2225,7 @@ boolean M_Responder(event_t *ev)
if (modeattacking) if (modeattacking)
return true; return true;
M_StartControlPanel(); M_StartControlPanel();
M_Options(0);
M_SetupNextMenu(&OP_MainDef); M_SetupNextMenu(&OP_MainDef);
return true; return true;
@ -6331,8 +6334,8 @@ static void M_HandleConnectIP(INT32 choice)
#define PLBOXW 8 #define PLBOXW 8
#define PLBOXH 9 #define PLBOXH 9
static INT32 multi_tics; static UINT8 multi_tics;
static state_t *multi_state; static UINT8 multi_frame;
// this is set before entering the MultiPlayer setup menu, // this is set before entering the MultiPlayer setup menu,
// for either player 1 or 2 // for either player 1 or 2
@ -6346,11 +6349,10 @@ static INT32 setupm_fakecolor;
static void M_DrawSetupMultiPlayerMenu(void) static void M_DrawSetupMultiPlayerMenu(void)
{ {
INT32 mx, my, st, flags = 0; INT32 mx, my, flags = 0;
spritedef_t *sprdef; spritedef_t *sprdef;
spriteframe_t *sprframe; spriteframe_t *sprframe;
patch_t *patch; patch_t *patch;
UINT8 frame;
mx = MP_PlayerSetupDef.x; mx = MP_PlayerSetupDef.x;
my = MP_PlayerSetupDef.y; my = MP_PlayerSetupDef.y;
@ -6378,28 +6380,23 @@ static void M_DrawSetupMultiPlayerMenu(void)
// anim the player in the box // anim the player in the box
if (--multi_tics <= 0) if (--multi_tics <= 0)
{ {
st = multi_state->nextstate; multi_frame++;
if (st != S_NULL) multi_tics = 4;
multi_state = &states[st];
multi_tics = multi_state->tics;
if (multi_tics == -1)
multi_tics = 15;
} }
// skin 0 is default player sprite // skin 0 is default player sprite
if (R_SkinAvailable(skins[setupm_fakeskin].name) != -1) if (R_SkinAvailable(skins[setupm_fakeskin].name) != -1)
sprdef = &skins[R_SkinAvailable(skins[setupm_fakeskin].name)].spritedef; sprdef = &skins[R_SkinAvailable(skins[setupm_fakeskin].name)].sprites[SPR2_WALK];
else else
sprdef = &skins[0].spritedef; sprdef = &skins[0].sprites[SPR2_WALK];
if (!sprdef->numframes) // No frames ?? if (!sprdef->numframes) // No frames ??
return; // Can't render! return; // Can't render!
frame = multi_state->frame & FF_FRAMEMASK; if (multi_frame >= sprdef->numframes)
if (frame >= sprdef->numframes) // Walking animation missing multi_frame = 0;
frame = 0; // Try to use standing frame
sprframe = &sprdef->spriteframes[frame]; sprframe = &sprdef->spriteframes[multi_frame];
patch = W_CachePatchNum(sprframe->lumppat[0], PU_CACHE); patch = W_CachePatchNum(sprframe->lumppat[0], PU_CACHE);
if (sprframe->flip & 1) // Only for first sprite if (sprframe->flip & 1) // Only for first sprite
flags |= V_FLIP; // This sprite is left/right flipped! flags |= V_FLIP; // This sprite is left/right flipped!
@ -6533,8 +6530,8 @@ static void M_SetupMultiPlayer(INT32 choice)
{ {
(void)choice; (void)choice;
multi_state = &states[mobjinfo[MT_PLAYER].seestate]; multi_frame = 0;
multi_tics = multi_state->tics; multi_tics = 4;
strcpy(setupm_name, cv_playername.string); strcpy(setupm_name, cv_playername.string);
// set for player 1 // set for player 1
@ -6564,8 +6561,8 @@ static void M_SetupMultiPlayer2(INT32 choice)
{ {
(void)choice; (void)choice;
multi_state = &states[mobjinfo[MT_PLAYER].seestate]; multi_frame = 0;
multi_tics = multi_state->tics; multi_tics = 4;
strcpy (setupm_name, cv_playername2.string); strcpy (setupm_name, cv_playername2.string);
// set for splitscreen secondary player // set for splitscreen secondary player

View File

@ -363,12 +363,12 @@ boolean P_CheckMissileRange(mobj_t *actor)
if (!actor->target) if (!actor->target)
return false; return false;
if (!P_CheckSight(actor, actor->target))
return false;
if (actor->reactiontime) if (actor->reactiontime)
return false; // do not attack yet return false; // do not attack yet
if (!P_CheckSight(actor, actor->target))
return false;
// OPTIMIZE: get this from a global checksight // OPTIMIZE: get this from a global checksight
dist = P_AproxDistance(actor->x-actor->target->x, actor->y-actor->target->y) - FixedMul(64*FRACUNIT, actor->scale); dist = P_AproxDistance(actor->x-actor->target->x, actor->y-actor->target->y) - FixedMul(64*FRACUNIT, actor->scale);
@ -652,6 +652,9 @@ boolean P_LookForPlayers(mobj_t *actor, boolean allaround, boolean tracer, fixed
player = &players[actor->lastlook]; player = &players[actor->lastlook];
if ((netgame || multiplayer) && player->spectator)
continue;
if (player->health <= 0) if (player->health <= 0)
continue; // dead continue; // dead
@ -661,12 +664,6 @@ boolean P_LookForPlayers(mobj_t *actor, boolean allaround, boolean tracer, fixed
if (!player->mo || P_MobjWasRemoved(player->mo)) if (!player->mo || P_MobjWasRemoved(player->mo))
continue; continue;
if (!P_CheckSight(actor, player->mo))
continue; // out of sight
if ((netgame || multiplayer) && player->spectator)
continue;
if (dist > 0 if (dist > 0
&& P_AproxDistance(P_AproxDistance(player->mo->x - actor->x, player->mo->y - actor->y), player->mo->z - actor->z) > dist) && P_AproxDistance(P_AproxDistance(player->mo->x - actor->x, player->mo->y - actor->y), player->mo->z - actor->z) > dist)
continue; // Too far away continue; // Too far away
@ -683,6 +680,9 @@ boolean P_LookForPlayers(mobj_t *actor, boolean allaround, boolean tracer, fixed
} }
} }
if (!P_CheckSight(actor, player->mo))
continue; // out of sight
if (tracer) if (tracer)
P_SetTarget(&actor->tracer, player->mo); P_SetTarget(&actor->tracer, player->mo);
else else
@ -2513,7 +2513,7 @@ void A_1upThinker(mobj_t *actor)
} }
} }
if (closestplayer == -1 || skins[players[closestplayer].skin].spritedef.numframes <= states[S_PLAY_BOX1].frame) if (closestplayer == -1 || skins[players[closestplayer].skin].sprites[SPR2_LIFE].numframes == 0)
{ // Closest player not found (no players in game?? may be empty dedicated server!), or does not have correct sprite. { // Closest player not found (no players in game?? may be empty dedicated server!), or does not have correct sprite.
actor->frame = 0; actor->frame = 0;
if (actor->tracer) { if (actor->tracer) {
@ -2658,7 +2658,7 @@ for (i = cvar.value; i; --i) spawnchance[numchoices++] = type
if (actor->tracer) // Remove the old lives icon. if (actor->tracer) // Remove the old lives icon.
P_RemoveMobj(actor->tracer); P_RemoveMobj(actor->tracer);
if (!newmobj->target->skin || ((skin_t *)newmobj->target->skin)->spritedef.numframes <= states[S_PLAY_BOX1].frame) if (!newmobj->target->skin || ((skin_t *)newmobj->target->skin)->sprites[SPR2_LIFE].numframes == 0)
newmobj->frame -= 2; // No lives icon for this player, use the default. newmobj->frame -= 2; // No lives icon for this player, use the default.
else else
{ // Spawn the lives icon. { // Spawn the lives icon.
@ -4813,7 +4813,7 @@ void A_UnidusBall(mobj_t *actor)
boolean skull = (actor->target->flags2 & MF2_SKULLFLY) == MF2_SKULLFLY; boolean skull = (actor->target->flags2 & MF2_SKULLFLY) == MF2_SKULLFLY;
if (actor->target->state == &states[actor->target->info->painstate]) if (actor->target->state == &states[actor->target->info->painstate])
{ {
P_KillMobj(actor, NULL, NULL); P_KillMobj(actor, NULL, NULL, 0);
return; return;
} }
switch(actor->extravalue2) switch(actor->extravalue2)
@ -5024,7 +5024,7 @@ void A_MaceRotate(mobj_t *actor)
actor->movecount += actor->target->lastlook; actor->movecount += actor->target->lastlook;
actor->movecount &= FINEMASK; actor->movecount &= FINEMASK;
actor->threshold = FixedMul(FINECOSINE(actor->movecount), actor->target->lastlook); actor->threshold = FixedMul(FINECOSINE(actor->movecount), actor->target->lastlook << FRACBITS);
v[0] = FRACUNIT; v[0] = FRACUNIT;
v[1] = 0; v[1] = 0;
@ -5032,7 +5032,7 @@ void A_MaceRotate(mobj_t *actor)
v[3] = FRACUNIT; v[3] = FRACUNIT;
// Calculate the angle matrixes for the link. // Calculate the angle matrixes for the link.
res = VectorMatrixMultiply(v, *RotateXMatrix(FixedAngle(actor->threshold << FRACBITS))); res = VectorMatrixMultiply(v, *RotateXMatrix(FixedAngle(actor->threshold)));
M_Memcpy(&v, res, sizeof(v)); M_Memcpy(&v, res, sizeof(v));
res = VectorMatrixMultiply(v, *RotateZMatrix(actor->target->health << ANGLETOFINESHIFT)); res = VectorMatrixMultiply(v, *RotateZMatrix(actor->target->health << ANGLETOFINESHIFT));
M_Memcpy(&v, res, sizeof(v)); M_Memcpy(&v, res, sizeof(v));
@ -5278,7 +5278,7 @@ void A_RingExplode(mobj_t *actor)
if (mo2->flags & MF_SHOOTABLE) if (mo2->flags & MF_SHOOTABLE)
{ {
actor->flags2 |= MF2_DEBRIS; actor->flags2 |= MF2_DEBRIS;
P_DamageMobj(mo2, actor, actor->target, 1); P_DamageMobj(mo2, actor, actor->target, 1, 0);
continue; continue;
} }
} }
@ -5606,8 +5606,13 @@ void A_MixUp(mobj_t *actor)
P_SetThingPosition(players[i].mo); P_SetThingPosition(players[i].mo);
#ifdef ESLOPE
players[i].mo->floorz = P_GetFloorZ(players[i].mo, players[i].mo->subsector->sector, players[i].mo->x, players[i].mo->y, NULL);
players[i].mo->ceilingz = P_GetCeilingZ(players[i].mo, players[i].mo->subsector->sector, players[i].mo->x, players[i].mo->y, NULL);
#else
players[i].mo->floorz = players[i].mo->subsector->sector->floorheight; players[i].mo->floorz = players[i].mo->subsector->sector->floorheight;
players[i].mo->ceilingz = players[i].mo->subsector->sector->ceilingheight; players[i].mo->ceilingz = players[i].mo->subsector->sector->ceilingheight;
#endif
P_CheckPosition(players[i].mo, players[i].mo->x, players[i].mo->y); P_CheckPosition(players[i].mo, players[i].mo->x, players[i].mo->y);
} }
@ -5660,6 +5665,11 @@ void A_RecyclePowers(mobj_t *actor)
if (playeringame[i] && players[i].mo && players[i].mo->health > 0 && players[i].playerstate == PST_LIVE if (playeringame[i] && players[i].mo && players[i].mo->health > 0 && players[i].playerstate == PST_LIVE
&& !players[i].exiting && !((netgame || multiplayer) && players[i].spectator)) && !players[i].exiting && !((netgame || multiplayer) && players[i].spectator))
{ {
#ifndef WEIGHTEDRECYCLER
if (players[i].powers[pw_super])
continue; // Ignore super players
#endif
numplayers++; numplayers++;
postscramble[j] = playerslist[j] = (UINT8)i; postscramble[j] = playerslist[j] = (UINT8)i;
@ -6378,7 +6388,7 @@ void A_EggmanBox(mobj_t *actor)
return; return;
} }
P_DamageMobj(actor->target, actor, actor, 1); // Ow! P_DamageMobj(actor->target, actor, actor, 1, 0); // Ow!
} }
// Function: A_TurretFire // Function: A_TurretFire
@ -7645,26 +7655,33 @@ void A_SetObjectFlags(mobj_t *actor)
{ {
INT32 locvar1 = var1; INT32 locvar1 = var1;
INT32 locvar2 = var2; INT32 locvar2 = var2;
boolean unlinkthings = false;
#ifdef HAVE_BLUA #ifdef HAVE_BLUA
if (LUA_CallAction("A_SetObjectFlags", actor)) if (LUA_CallAction("A_SetObjectFlags", actor))
return; return;
#endif #endif
P_UnsetThingPosition(actor); if (locvar2 == 2)
if (sector_list) locvar1 = actor->flags | locvar1;
{ else if (locvar2 == 1)
P_DelSeclist(sector_list); locvar1 = actor->flags & ~locvar1;
sector_list = NULL;
if ((locvar1 & (MF_NOBLOCKMAP|MF_NOSECTOR)) != (actor->flags & (MF_NOBLOCKMAP|MF_NOSECTOR))) // Blockmap/sector status has changed, so reset the links
unlinkthings = true;
if (unlinkthings) {
P_UnsetThingPosition(actor);
if (sector_list)
{
P_DelSeclist(sector_list);
sector_list = NULL;
}
} }
if (locvar2 == 2) actor->flags = locvar1;
actor->flags |= locvar1;
else if (locvar2 == 1)
actor->flags &= ~locvar1;
else
actor->flags = locvar1;
P_SetThingPosition(actor); if (unlinkthings)
P_SetThingPosition(actor);
} }
// Function: A_SetObjectFlags2 // Function: A_SetObjectFlags2
@ -9363,9 +9380,9 @@ void A_RemoteDamage(mobj_t *actor)
if (locvar2 == 1) // Kill mobj! if (locvar2 == 1) // Kill mobj!
{ {
if (target->player) // players die using P_DamageMobj instead for some reason if (target->player) // players die using P_DamageMobj instead for some reason
P_DamageMobj(target, source, source, 10000); P_DamageMobj(target, source, source, 1, DMG_INSTAKILL);
else else
P_KillMobj(target, source, source); P_KillMobj(target, source, source, 0);
} }
else if (locvar2 == 2) // Remove mobj! else if (locvar2 == 2) // Remove mobj!
{ {
@ -9375,7 +9392,7 @@ void A_RemoteDamage(mobj_t *actor)
P_RemoveMobj(target); P_RemoveMobj(target);
} }
else // default: Damage mobj! else // default: Damage mobj!
P_DamageMobj(target, source, source, 1); P_DamageMobj(target, source, source, 1, 0);
} }
// Function: A_HomingChase // Function: A_HomingChase
@ -9610,7 +9627,7 @@ void A_VileAttack(mobj_t *actor)
return; return;
S_StartSound(actor, soundtoplay); S_StartSound(actor, soundtoplay);
P_DamageMobj(actor->target, actor, actor, 1); P_DamageMobj(actor->target, actor, actor, 1, 0);
//actor->target->momz = 1000*FRACUNIT/actor->target->info->mass; // How id did it //actor->target->momz = 1000*FRACUNIT/actor->target->info->mass; // How id did it
actor->target->momz += FixedMul(10*FRACUNIT, actor->scale)*P_MobjFlip(actor->target); // How we're doing it actor->target->momz += FixedMul(10*FRACUNIT, actor->scale)*P_MobjFlip(actor->target); // How we're doing it
if (explosionType != MT_NULL) if (explosionType != MT_NULL)
@ -9651,7 +9668,7 @@ void A_VileAttack(mobj_t *actor)
continue; continue;
S_StartSound(actor, soundtoplay); S_StartSound(actor, soundtoplay);
P_DamageMobj(players[i].mo, actor, actor, 1); P_DamageMobj(players[i].mo, actor, actor, 1, 0);
//actor->target->momz = 1000*FRACUNIT/actor->target->info->mass; // How id did it //actor->target->momz = 1000*FRACUNIT/actor->target->info->mass; // How id did it
players[i].mo->momz += FixedMul(10*FRACUNIT, actor->scale)*P_MobjFlip(players[i].mo); // How we're doing it players[i].mo->momz += FixedMul(10*FRACUNIT, actor->scale)*P_MobjFlip(players[i].mo); // How we're doing it
if (explosionType != MT_NULL) if (explosionType != MT_NULL)

View File

@ -1174,12 +1174,15 @@ void T_SpikeSector(levelspecthink_t *spikes)
if (affectsec == spikes->sector) // Applied to an actual sector if (affectsec == spikes->sector) // Applied to an actual sector
{ {
fixed_t affectfloor = P_GetSpecialBottomZ(thing, affectsec, affectsec);
fixed_t affectceil = P_GetSpecialTopZ(thing, affectsec, affectsec);
if (affectsec->flags & SF_FLIPSPECIAL_FLOOR) if (affectsec->flags & SF_FLIPSPECIAL_FLOOR)
{ {
if (!(thing->eflags & MFE_VERTICALFLIP) && thing->momz > 0) if (!(thing->eflags & MFE_VERTICALFLIP) && thing->momz > 0)
continue; continue;
if (thing->z == affectsec->floorheight) if (thing->z == affectfloor)
dothepain = true; dothepain = true;
} }
@ -1188,18 +1191,20 @@ void T_SpikeSector(levelspecthink_t *spikes)
if ((thing->eflags & MFE_VERTICALFLIP) && thing->momz < 0) if ((thing->eflags & MFE_VERTICALFLIP) && thing->momz < 0)
continue; continue;
if (thing->z + thing->height == affectsec->ceilingheight) if (thing->z + thing->height == affectceil)
dothepain = true; dothepain = true;
} }
} }
else else
{ {
fixed_t affectfloor = P_GetSpecialBottomZ(thing, affectsec, spikes->sector);
fixed_t affectceil = P_GetSpecialTopZ(thing, affectsec, spikes->sector);
if (affectsec->flags & SF_FLIPSPECIAL_FLOOR) if (affectsec->flags & SF_FLIPSPECIAL_FLOOR)
{ {
if (!(thing->eflags & MFE_VERTICALFLIP) && thing->momz > 0) if (!(thing->eflags & MFE_VERTICALFLIP) && thing->momz > 0)
continue; continue;
if (thing->z == affectsec->ceilingheight) if (thing->z == affectceil)
dothepain = true; dothepain = true;
} }
@ -1208,16 +1213,14 @@ void T_SpikeSector(levelspecthink_t *spikes)
if ((thing->eflags & MFE_VERTICALFLIP) && thing->momz < 0) if ((thing->eflags & MFE_VERTICALFLIP) && thing->momz < 0)
continue; continue;
if (thing->z + thing->height == affectsec->floorheight) if (thing->z + thing->height == affectfloor)
dothepain = true; dothepain = true;
} }
} }
if (dothepain) if (dothepain)
{ {
mobj_t *killer = P_SpawnMobj(thing->x, thing->y, thing->z, MT_NULL); P_DamageMobj(thing, NULL, NULL, 1, DMG_SPIKE);
killer->threshold = 43; // Special flag that it was spikes which hurt you.
P_DamageMobj(thing, killer, killer, 1);
break; break;
} }
} }
@ -1968,51 +1971,71 @@ void T_NoEnemiesSector(levelspecthink_t *nobaddies)
{ {
size_t i; size_t i;
fixed_t upperbound, lowerbound; fixed_t upperbound, lowerbound;
INT32 s; sector_t *sec = NULL;
sector_t *checksector; sector_t *targetsec = NULL;
INT32 secnum = -1;
msecnode_t *node; msecnode_t *node;
mobj_t *thing; mobj_t *thing;
boolean exists = false; boolean FOFsector = false;
for (i = 0; i < nobaddies->sector->linecount; i++) while ((secnum = P_FindSectorFromLineTag(nobaddies->sourceline, secnum)) >= 0)
{ {
if (nobaddies->sector->lines[i]->special == 223) sec = &sectors[secnum];
FOFsector = false;
// Check the lines of this sector, to see if it is a FOF control sector.
for (i = 0; i < sec->linecount; i++)
{ {
INT32 targetsecnum = -1;
upperbound = nobaddies->sector->ceilingheight; if (sec->lines[i]->special < 100 || sec->lines[i]->special >= 300)
lowerbound = nobaddies->sector->floorheight; continue;
for (s = -1; (s = P_FindSectorFromLineTag(nobaddies->sector->lines[i], s)) >= 0 ;) FOFsector = true;
while ((targetsecnum = P_FindSectorFromLineTag(sec->lines[i], targetsecnum)) >= 0)
{ {
checksector = &sectors[s]; targetsec = &sectors[targetsecnum];
node = checksector->touching_thinglist; // things touching this sector upperbound = targetsec->ceilingheight;
lowerbound = targetsec->floorheight;
node = targetsec->touching_thinglist; // things touching this sector
while (node) while (node)
{ {
thing = node->m_thing; thing = node->m_thing;
if ((thing->flags & (MF_ENEMY|MF_BOSS)) && thing->health > 0 if ((thing->flags & (MF_ENEMY|MF_BOSS)) && thing->health > 0
&& thing->z < upperbound && thing->z+thing->height > lowerbound) && thing->z < upperbound && thing->z+thing->height > lowerbound)
{ return;
exists = true;
goto foundenemy;
}
node = node->m_snext; node = node->m_snext;
} }
} }
} }
if (!FOFsector)
{
upperbound = sec->ceilingheight;
lowerbound = sec->floorheight;
node = sec->touching_thinglist; // things touching this sector
while (node)
{
thing = node->m_thing;
if ((thing->flags & (MF_ENEMY|MF_BOSS)) && thing->health > 0
&& thing->z < upperbound && thing->z+thing->height > lowerbound)
return;
node = node->m_snext;
}
}
} }
foundenemy:
if (exists)
return;
s = P_AproxDistance(nobaddies->sourceline->dx, nobaddies->sourceline->dy)>>FRACBITS; CONS_Debug(DBG_GAMELOGIC, "Running no-more-enemies exec with tag of %d\n", nobaddies->sourceline->tag);
CONS_Debug(DBG_GAMELOGIC, "Running no-more-enemies exec with tag of %d\n", s); // No enemies found, run the linedef exec and terminate this thinker
P_RunTriggerLinedef(nobaddies->sourceline, NULL, NULL);
// Otherwise, run the linedef exec and terminate this thinker
P_LinedefExecute((INT16)s, NULL, NULL);
P_RemoveThinker(&nobaddies->thinker); P_RemoveThinker(&nobaddies->thinker);
} }
@ -2067,6 +2090,7 @@ void T_EachTimeThinker(levelspecthink_t *eachtime)
boolean FOFsector = false; boolean FOFsector = false;
boolean inAndOut = false; boolean inAndOut = false;
boolean floortouch = false; boolean floortouch = false;
fixed_t bottomheight, topheight;
for (i = 0; i < MAXPLAYERS; i++) for (i = 0; i < MAXPLAYERS; i++)
{ {
@ -2131,10 +2155,13 @@ void T_EachTimeThinker(levelspecthink_t *eachtime)
if (players[j].mo->subsector->sector != targetsec) if (players[j].mo->subsector->sector != targetsec)
continue; continue;
if (players[j].mo->z > sec->ceilingheight) topheight = P_GetSpecialTopZ(players[j].mo, sec, targetsec);
bottomheight = P_GetSpecialBottomZ(players[j].mo, sec, targetsec);
if (players[j].mo->z > topheight)
continue; continue;
if (players[j].mo->z + players[j].mo->height < sec->floorheight) if (players[j].mo->z + players[j].mo->height < bottomheight)
continue; continue;
if (floortouch == true && P_IsObjectOnGroundIn(players[j].mo, targetsec)) if (floortouch == true && P_IsObjectOnGroundIn(players[j].mo, targetsec))
@ -2217,7 +2244,7 @@ void T_EachTimeThinker(levelspecthink_t *eachtime)
oldPlayersArea = oldPlayersInArea; oldPlayersArea = oldPlayersInArea;
} }
if ((affectPlayer = P_HavePlayersEnteredArea(playersArea, oldPlayersArea, inAndOut)) != -1) while ((affectPlayer = P_HavePlayersEnteredArea(playersArea, oldPlayersArea, inAndOut)) != -1)
{ {
if (GETSECSPECIAL(sec->special, 2) == 2 || GETSECSPECIAL(sec->special, 2) == 3) if (GETSECSPECIAL(sec->special, 2) == 2 || GETSECSPECIAL(sec->special, 2) == 3)
{ {
@ -2250,6 +2277,8 @@ void T_EachTimeThinker(levelspecthink_t *eachtime)
if (!eachtime->sourceline->special) // this happens only for "Trigger on X calls" linedefs if (!eachtime->sourceline->special) // this happens only for "Trigger on X calls" linedefs
P_RemoveThinker(&eachtime->thinker); P_RemoveThinker(&eachtime->thinker);
oldPlayersArea[affectPlayer]=playersArea[affectPlayer];
} }
} }
@ -2292,7 +2321,7 @@ void T_RaiseSector(levelspecthink_t *raise)
if (raise->vars[1] && !(thing->player->pflags & PF_STARTDASH)) if (raise->vars[1] && !(thing->player->pflags & PF_STARTDASH))
continue; continue;
if (!(thing->z == raise->sector->ceilingheight)) if (!(thing->z == P_GetSpecialTopZ(thing, raise->sector, sector)))
continue; continue;
playeronme = true; playeronme = true;
@ -3105,7 +3134,7 @@ INT32 EV_MarioBlock(sector_t *sec, sector_t *roversector, fixed_t topheight, mob
thing->momz = FixedMul(6*FRACUNIT, thing->scale); thing->momz = FixedMul(6*FRACUNIT, thing->scale);
P_SetThingPosition(thing); P_SetThingPosition(thing);
if (thing->flags & MF_SHOOTABLE) if (thing->flags & MF_SHOOTABLE)
P_DamageMobj(thing, puncher, puncher, 1); P_DamageMobj(thing, puncher, puncher, 1, 0);
else if (thing->type == MT_RING || thing->type == MT_COIN) else if (thing->type == MT_RING || thing->type == MT_COIN)
{ {
thing->momz = FixedMul(3*FRACUNIT, thing->scale); thing->momz = FixedMul(3*FRACUNIT, thing->scale);

View File

@ -291,7 +291,7 @@ void P_TouchSpecialThing(mobj_t *special, mobj_t *toucher, boolean heightcheck)
{ {
if (special->type == MT_BLACKEGGMAN) if (special->type == MT_BLACKEGGMAN)
{ {
P_DamageMobj(toucher, special, special, 1); // ouch P_DamageMobj(toucher, special, special, 1, 0); // ouch
return; return;
} }
@ -303,20 +303,20 @@ void P_TouchSpecialThing(mobj_t *special, mobj_t *toucher, boolean heightcheck)
toucher->momz = -toucher->momz; toucher->momz = -toucher->momz;
toucher->momx = -toucher->momx; toucher->momx = -toucher->momx;
toucher->momy = -toucher->momy; toucher->momy = -toucher->momy;
P_DamageMobj(special, toucher, toucher, 1); P_DamageMobj(special, toucher, toucher, 1, 0);
} }
else if (((toucher->z < special->z && !(toucher->eflags & MFE_VERTICALFLIP)) else if (((toucher->z < special->z && !(toucher->eflags & MFE_VERTICALFLIP))
|| (toucher->z + toucher->height > special->z + special->height && (toucher->eflags & MFE_VERTICALFLIP))) || (toucher->z + toucher->height > special->z + special->height && (toucher->eflags & MFE_VERTICALFLIP)))
&& player->charability == CA_FLY && player->charability == CA_FLY
&& (player->powers[pw_tailsfly] && (player->powers[pw_tailsfly]
|| (toucher->state >= &states[S_PLAY_SPC1] && toucher->state <= &states[S_PLAY_SPC4]))) // Tails can shred stuff with his propeller. || toucher->state-states == S_PLAY_FLY_TIRED)) // Tails can shred stuff with his propeller.
{ {
toucher->momz = -toucher->momz/2; toucher->momz = -toucher->momz/2;
P_DamageMobj(special, toucher, toucher, 1); P_DamageMobj(special, toucher, toucher, 1, 0);
} }
else else
P_DamageMobj(toucher, special, special, 1); P_DamageMobj(toucher, special, special, 1, 0);
return; return;
} }
@ -330,13 +330,13 @@ void P_TouchSpecialThing(mobj_t *special, mobj_t *toucher, boolean heightcheck)
&& toucher->z < special->z + special->height && toucher->z + toucher->height > special->z) && toucher->z < special->z + special->height && toucher->z + toucher->height > special->z)
{ {
// Can only hit snapper from above // Can only hit snapper from above
P_DamageMobj(toucher, special, special, 1); P_DamageMobj(toucher, special, special, 1, 0);
} }
else if (special->type == MT_SHARP else if (special->type == MT_SHARP
&& ((special->state == &states[special->info->xdeathstate]) || (toucher->z > special->z + special->height/2))) && ((special->state == &states[special->info->xdeathstate]) || (toucher->z > special->z + special->height/2)))
{ {
// Cannot hit sharp from above or when red and angry // Cannot hit sharp from above or when red and angry
P_DamageMobj(toucher, special, special, 1); P_DamageMobj(toucher, special, special, 1, 0);
} }
else if (((player->pflags & PF_NIGHTSMODE) && (player->pflags & PF_DRILLING)) else if (((player->pflags & PF_NIGHTSMODE) && (player->pflags & PF_DRILLING))
|| (player->pflags & (PF_JUMPED|PF_SPINNING|PF_GLIDING)) || (player->pflags & (PF_JUMPED|PF_SPINNING|PF_GLIDING))
@ -345,27 +345,27 @@ void P_TouchSpecialThing(mobj_t *special, mobj_t *toucher, boolean heightcheck)
if (P_MobjFlip(toucher)*toucher->momz < 0) if (P_MobjFlip(toucher)*toucher->momz < 0)
toucher->momz = -toucher->momz; toucher->momz = -toucher->momz;
P_DamageMobj(special, toucher, toucher, 1); P_DamageMobj(special, toucher, toucher, 1, 0);
} }
else if (((toucher->z < special->z && !(toucher->eflags & MFE_VERTICALFLIP)) else if (((toucher->z < special->z && !(toucher->eflags & MFE_VERTICALFLIP))
|| (toucher->z + toucher->height > special->z + special->height && (toucher->eflags & MFE_VERTICALFLIP))) // Flame is bad at logic - JTE || (toucher->z + toucher->height > special->z + special->height && (toucher->eflags & MFE_VERTICALFLIP))) // Flame is bad at logic - JTE
&& player->charability == CA_FLY && player->charability == CA_FLY
&& (player->powers[pw_tailsfly] && (player->powers[pw_tailsfly]
|| (toucher->state >= &states[S_PLAY_SPC1] && toucher->state <= &states[S_PLAY_SPC4]))) // Tails can shred stuff with his propeller. || toucher->state-states == S_PLAY_FLY_TIRED)) // Tails can shred stuff with his propeller.
{ {
if (P_MobjFlip(toucher)*toucher->momz < 0) if (P_MobjFlip(toucher)*toucher->momz < 0)
toucher->momz = -toucher->momz/2; toucher->momz = -toucher->momz/2;
P_DamageMobj(special, toucher, toucher, 1); P_DamageMobj(special, toucher, toucher, 1, 0);
} }
else else
P_DamageMobj(toucher, special, special, 1); P_DamageMobj(toucher, special, special, 1, 0);
return; return;
} }
else if (special->flags & MF_FIRE) else if (special->flags & MF_FIRE)
{ {
P_DamageMobj(toucher, special, special, 1); P_DamageMobj(toucher, special, special, 1, DMG_FIRE);
return; return;
} }
else else
@ -743,7 +743,7 @@ void P_TouchSpecialThing(mobj_t *special, mobj_t *toucher, boolean heightcheck)
if (mo2->flags & MF_SHOOTABLE) if (mo2->flags & MF_SHOOTABLE)
{ {
P_DamageMobj(mo2, toucher, toucher, 1); P_DamageMobj(mo2, toucher, toucher, 1, 0);
continue; continue;
} }
@ -875,7 +875,7 @@ void P_TouchSpecialThing(mobj_t *special, mobj_t *toucher, boolean heightcheck)
P_ResetPlayer(player); P_ResetPlayer(player);
P_SetPlayerMobjState(toucher, S_PLAY_FALL1); P_SetPlayerMobjState(toucher, S_PLAY_FALL);
} }
} }
return; return;
@ -1212,7 +1212,7 @@ void P_TouchSpecialThing(mobj_t *special, mobj_t *toucher, boolean heightcheck)
if (player->pflags & PF_GLIDING) if (player->pflags & PF_GLIDING)
{ {
player->pflags &= ~(PF_GLIDING|PF_JUMPED); player->pflags &= ~(PF_GLIDING|PF_JUMPED);
P_SetPlayerMobjState(toucher, S_PLAY_FALL1); P_SetPlayerMobjState(toucher, S_PLAY_FALL);
} }
// Play a bounce sound? // Play a bounce sound?
@ -1279,7 +1279,7 @@ void P_TouchSpecialThing(mobj_t *special, mobj_t *toucher, boolean heightcheck)
if (player->pflags & PF_GLIDING) if (player->pflags & PF_GLIDING)
{ {
player->pflags &= ~(PF_GLIDING|PF_JUMPED); player->pflags &= ~(PF_GLIDING|PF_JUMPED);
P_SetPlayerMobjState(toucher, S_PLAY_FALL1); P_SetPlayerMobjState(toucher, S_PLAY_FALL);
} }
// Play a bounce sound? // Play a bounce sound?
@ -1335,7 +1335,7 @@ void P_TouchSpecialThing(mobj_t *special, mobj_t *toucher, boolean heightcheck)
{ {
player->pflags |= PF_MACESPIN; player->pflags |= PF_MACESPIN;
S_StartSound(toucher, sfx_spin); S_StartSound(toucher, sfx_spin);
P_SetPlayerMobjState(toucher, S_PLAY_ATK1); P_SetPlayerMobjState(toucher, S_PLAY_SPIN);
} }
else else
player->pflags |= PF_ITEMHANG; player->pflags |= PF_ITEMHANG;
@ -1351,7 +1351,7 @@ void P_TouchSpecialThing(mobj_t *special, mobj_t *toucher, boolean heightcheck)
case MT_SPECIALSPIKEBALL: case MT_SPECIALSPIKEBALL:
if (!(!useNightsSS && G_IsSpecialStage(gamemap))) // Only for old special stages if (!(!useNightsSS && G_IsSpecialStage(gamemap))) // Only for old special stages
{ {
P_DamageMobj(toucher, special, special, 1); P_DamageMobj(toucher, special, special, 1, 0);
return; return;
} }
@ -1382,7 +1382,7 @@ void P_TouchSpecialThing(mobj_t *special, mobj_t *toucher, boolean heightcheck)
// Goomba Stomp'd! // Goomba Stomp'd!
if (special->target->momz < 0) if (special->target->momz < 0)
{ {
P_DamageMobj(toucher, special, special->target, 1); P_DamageMobj(toucher, special, special->target, 1, 0);
//special->target->momz = -special->target->momz; //special->target->momz = -special->target->momz;
special->target->momx = special->target->momy = 0; special->target->momx = special->target->momy = 0;
special->target->momz = 0; special->target->momz = 0;
@ -1446,7 +1446,7 @@ void P_TouchSpecialThing(mobj_t *special, mobj_t *toucher, boolean heightcheck)
} }
S_StartSound(toucher, special->info->deathsound); // was NULL, but changed to player so you could hear others pick up rings S_StartSound(toucher, special->info->deathsound); // was NULL, but changed to player so you could hear others pick up rings
P_KillMobj(special, NULL, toucher); P_KillMobj(special, NULL, toucher, 0);
} }
#define CTFTEAMCODE(pl) pl->ctfteam ? (pl->ctfteam == 1 ? "\x85" : "\x84") : "" #define CTFTEAMCODE(pl) pl->ctfteam ? (pl->ctfteam == 1 ? "\x85" : "\x84") : ""
@ -1457,8 +1457,9 @@ void P_TouchSpecialThing(mobj_t *special, mobj_t *toucher, boolean heightcheck)
* \param player Affected player. * \param player Affected player.
* \param inflictor The attack weapon used, can be NULL. * \param inflictor The attack weapon used, can be NULL.
* \param source The attacker, can be NULL. * \param source The attacker, can be NULL.
* \param damagetype The type of damage dealt to the player. If bit 7 (0x80) is set, this was an instant-kill.
*/ */
static void P_HitDeathMessages(player_t *player, mobj_t *inflictor, mobj_t *source) static void P_HitDeathMessages(player_t *player, mobj_t *inflictor, mobj_t *source, UINT8 damagetype)
{ {
const char *str = NULL; const char *str = NULL;
boolean deathonly = false; boolean deathonly = false;
@ -1478,7 +1479,7 @@ static void P_HitDeathMessages(player_t *player, mobj_t *inflictor, mobj_t *sour
return; // Presumably it's obvious what's happening in splitscreen. return; // Presumably it's obvious what's happening in splitscreen.
#ifdef HAVE_BLUA #ifdef HAVE_BLUA
if (LUAh_DeathMsg(player, inflictor, source)) if (LUAh_HurtMsg(player, inflictor, source))
return; return;
#endif #endif
@ -1567,22 +1568,6 @@ static void P_HitDeathMessages(player_t *player, mobj_t *inflictor, mobj_t *sour
} }
else switch (source->type) else switch (source->type)
{ {
case MT_NULL:
switch(source->threshold)
{
case 42:
deathonly = true;
str = M_GetText("%s drowned.\n");
break;
case 43:
str = M_GetText("%s was %s by spikes.\n");
break;
case 44:
deathonly = true;
str = M_GetText("%s was crushed.\n");
break;
}
break;
case MT_EGGMANICO: case MT_EGGMANICO:
case MT_EGGMANBOX: case MT_EGGMANBOX:
str = M_GetText("%s was %s by Eggman's nefarious TV magic.\n"); str = M_GetText("%s was %s by Eggman's nefarious TV magic.\n");
@ -1598,30 +1583,52 @@ static void P_HitDeathMessages(player_t *player, mobj_t *inflictor, mobj_t *sour
else else
{ {
// null source, environment kills // null source, environment kills
// TERRIBLE HACK for hit damage because P_DoPlayerPain moves the player... switch (damagetype)
// I'll put it back, I promise!
player->mo->z -= player->mo->momz+1;
if (P_PlayerTouchingSectorSpecial(player, 1, 2))
str = M_GetText("%s was %s by chemical water.\n");
else if (P_PlayerTouchingSectorSpecial(player, 1, 3))
str = M_GetText("%s was %s by molten lava.\n");
else if (P_PlayerTouchingSectorSpecial(player, 1, 4))
str = M_GetText("%s was %s by electricity.\n");
else if (deadtarget)
{ {
deathonly = true; case DMG_WATER:
if (P_PlayerTouchingSectorSpecial(player, 1, 6) str = M_GetText("%s was %s by chemical water.\n");
|| P_PlayerTouchingSectorSpecial(player, 1, 7)) break;
str = M_GetText("%s fell into a bottomless pit.\n"); case DMG_FIRE:
else if (P_PlayerTouchingSectorSpecial(player, 1, 12)) str = M_GetText("%s was %s by molten lava.\n");
str = M_GetText("%s asphyxiated in space.\n"); break;
else case DMG_ELECTRIC:
str = M_GetText("%s died.\n"); str = M_GetText("%s was %s by electricity.\n");
break;
case DMG_SPIKE:
str = M_GetText("%s was %s by spikes.\n");
break;
case DMG_DROWNED:
deathonly = true;
str = M_GetText("%s drowned.\n");
break;
case DMG_CRUSHED:
deathonly = true;
str = M_GetText("%s was crushed.\n");
break;
case DMG_DEATHPIT:
if (deadtarget)
{
deathonly = true;
str = M_GetText("%s fell into a bottomless pit.\n");
}
break;
case DMG_SPACEDROWN:
if (deadtarget)
{
deathonly = true;
str = M_GetText("%s asphyxiated in space.\n");
}
break;
default:
if (deadtarget)
{
deathonly = true;
str = M_GetText("%s died.\n");
}
break;
} }
if (!str) if (!str)
str = M_GetText("%s was %s by an environmental hazard.\n"); str = M_GetText("%s was %s by an environmental hazard.\n");
player->mo->z += player->mo->momz+1;
} }
if (!str) // Should not happen! Unless we missed catching something above. if (!str) // Should not happen! Unless we missed catching something above.
@ -1799,10 +1806,11 @@ boolean P_CheckRacers(void)
* \param target The victim. * \param target The victim.
* \param inflictor The attack weapon. May be NULL (environmental damage). * \param inflictor The attack weapon. May be NULL (environmental damage).
* \param source The attacker. May be NULL. * \param source The attacker. May be NULL.
* \param damagetype The type of damage dealt that killed the target. If bit 7 (0x80) was set, this was an instant-death.
* \todo Cleanup, refactor, split up. * \todo Cleanup, refactor, split up.
* \sa P_DamageMobj * \sa P_DamageMobj
*/ */
void P_KillMobj(mobj_t *target, mobj_t *inflictor, mobj_t *source) void P_KillMobj(mobj_t *target, mobj_t *inflictor, mobj_t *source, UINT8 damagetype)
{ {
mobjtype_t item; mobjtype_t item;
mobj_t *mo; mobj_t *mo;
@ -1945,7 +1953,7 @@ void P_KillMobj(mobj_t *target, mobj_t *inflictor, mobj_t *source)
{ {
target->flags &= ~(MF_SOLID|MF_SHOOTABLE); // does not block target->flags &= ~(MF_SOLID|MF_SHOOTABLE); // does not block
P_UnsetThingPosition(target); P_UnsetThingPosition(target);
target->flags |= MF_NOBLOCKMAP; target->flags |= MF_NOBLOCKMAP|MF_NOCLIP|MF_NOCLIPHEIGHT|MF_NOGRAVITY;
P_SetThingPosition(target); P_SetThingPosition(target);
if (!target->player->bot && !G_IsSpecialStage(gamemap) if (!target->player->bot && !G_IsSpecialStage(gamemap)
@ -1988,7 +1996,7 @@ void P_KillMobj(mobj_t *target, mobj_t *inflictor, mobj_t *source)
// allow them to try again, rather than sitting the whole thing out. // allow them to try again, rather than sitting the whole thing out.
if (leveltime >= hidetime * TICRATE) if (leveltime >= hidetime * TICRATE)
{ {
if (gametype == GT_HIDEANDSEEK)//suiciding in survivor makes you IT. if (gametype == GT_TAG)//suiciding in survivor makes you IT.
{ {
target->player->pflags |= PF_TAGIT; target->player->pflags |= PF_TAGIT;
CONS_Printf(M_GetText("%s is now IT!\n"), player_names[target->player-players]); // Tell everyone who is it! CONS_Printf(M_GetText("%s is now IT!\n"), player_names[target->player-players]); // Tell everyone who is it!
@ -2126,15 +2134,19 @@ void P_KillMobj(mobj_t *target, mobj_t *inflictor, mobj_t *source)
case MT_PLAYER: case MT_PLAYER:
target->fuse = TICRATE*3; // timer before mobj disappears from view (even if not an actual player) target->fuse = TICRATE*3; // timer before mobj disappears from view (even if not an actual player)
target->momx = target->momy = target->momz = 0; target->momx = target->momy = target->momz = 0;
if (!(source && source->type == MT_NULL && source->threshold == 42)) // Don't jump up when drowning if (damagetype == DMG_DROWNED) // drowned
P_SetObjectMomZ(target, 14*FRACUNIT, false); {
if (source && source->type == MT_NULL && source->threshold == 42) // drowned
S_StartSound(target, sfx_drown); S_StartSound(target, sfx_drown);
else if (source && (source->type == MT_SPIKE || (source->type == MT_NULL && source->threshold == 43))) // Spikes // Don't jump up when drowning
S_StartSound(target, sfx_spkdth); }
else else
P_PlayDeathSound(target); {
P_SetObjectMomZ(target, 14*FRACUNIT, false);
if ((source && source->type == MT_SPIKE) || damagetype == DMG_SPIKE) // Spikes
S_StartSound(target, sfx_spkdth);
else
P_PlayDeathSound(target);
}
break; break;
default: default:
break; break;
@ -2277,7 +2289,12 @@ void P_KillMobj(mobj_t *target, mobj_t *inflictor, mobj_t *source)
} }
} }
else if (target->player) else if (target->player)
P_SetPlayerMobjState(target, target->info->deathstate); {
if (damagetype == DMG_DROWNED || damagetype == DMG_SPACEDROWN)
P_SetPlayerMobjState(target, target->info->xdeathstate);
else
P_SetPlayerMobjState(target, target->info->deathstate);
}
else else
#ifdef DEBUG_NULL_DEATHSTATE #ifdef DEBUG_NULL_DEATHSTATE
P_SetMobjState(target, S_NULL); P_SetMobjState(target, S_NULL);
@ -2384,7 +2401,7 @@ static inline boolean P_TagDamage(mobj_t *target, mobj_t *inflictor, mobj_t *sou
if (source->player->pflags & PF_TAGIT && !(player->pflags & PF_TAGIT)) if (source->player->pflags & PF_TAGIT && !(player->pflags & PF_TAGIT))
{ {
P_AddPlayerScore(source->player, 100); //award points to tagger. P_AddPlayerScore(source->player, 100); //award points to tagger.
P_HitDeathMessages(player, inflictor, source); P_HitDeathMessages(player, inflictor, source, 0);
if (gametype == GT_TAG) //survivor if (gametype == GT_TAG) //survivor
{ {
@ -2570,7 +2587,7 @@ static inline void P_SuperDamage(player_t *player, mobj_t *inflictor, mobj_t *so
P_InstaThrust(player->mo, ang, fallbackspeed); P_InstaThrust(player->mo, ang, fallbackspeed);
if (player->charflags & SF_SUPERANIMS) if (player->charflags & SF_SUPERANIMS)
P_SetPlayerMobjState(player->mo, S_PLAY_SUPERHIT); P_SetPlayerMobjState(player->mo, S_PLAY_SUPER_STUN);
else else
P_SetPlayerMobjState(player->mo, player->mo->info->painstate); P_SetPlayerMobjState(player->mo, player->mo->info->painstate);
@ -2640,7 +2657,7 @@ static void P_ShieldDamage(player_t *player, mobj_t *inflictor, mobj_t *source,
} }
} }
static void P_RingDamage(player_t *player, mobj_t *inflictor, mobj_t *source, INT32 damage) static void P_RingDamage(player_t *player, mobj_t *inflictor, mobj_t *source, INT32 damage, UINT8 damagetype)
{ {
if (!(inflictor && ((inflictor->flags & MF_MISSILE) || inflictor->player) && player->powers[pw_super] && ALL7EMERALDS(player->powers[pw_emeralds]))) if (!(inflictor && ((inflictor->flags & MF_MISSILE) || inflictor->player) && player->powers[pw_super] && ALL7EMERALDS(player->powers[pw_emeralds])))
{ {
@ -2648,7 +2665,7 @@ static void P_RingDamage(player_t *player, mobj_t *inflictor, mobj_t *source, IN
P_ForceFeed(player, 40, 10, TICRATE, 40 + min(damage, 100)*2); P_ForceFeed(player, 40, 10, TICRATE, 40 + min(damage, 100)*2);
if (source && (source->type == MT_SPIKE || (source->type == MT_NULL && source->threshold == 43))) // spikes if ((source && source->type == MT_SPIKE) || damagetype == DMG_SPIKE) // spikes
S_StartSound(player->mo, sfx_spkdth); S_StartSound(player->mo, sfx_spkdth);
} }
@ -2677,21 +2694,21 @@ static void P_RingDamage(player_t *player, mobj_t *inflictor, mobj_t *source, IN
/** Damages an object, which may or may not be a player. /** Damages an object, which may or may not be a player.
* For melee attacks, source and inflictor are the same. * For melee attacks, source and inflictor are the same.
* *
* \param target The object being damaged. * \param target The object being damaged.
* \param inflictor The thing that caused the damage: creature, missile, * \param inflictor The thing that caused the damage: creature, missile,
* gargoyle, and so forth. Can be NULL in the case of * gargoyle, and so forth. Can be NULL in the case of
* environmental damage, such as slime or crushing. * environmental damage, such as slime or crushing.
* \param source The creature or person responsible. For example, if a * \param source The creature or person responsible. For example, if a
* player is hit by a ring, the player who shot it. In some * player is hit by a ring, the player who shot it. In some
* cases, the target will go after this object after * cases, the target will go after this object after
* receiving damage. This can be NULL. * receiving damage. This can be NULL.
* \param damage Amount of damage to be dealt. 10000 is instant death. * \param damage Amount of damage to be dealt.
* \param damagetype Type of damage to be dealt. If bit 7 (0x80) is set, this is an instant-kill.
* \return True if the target sustained damage, otherwise false. * \return True if the target sustained damage, otherwise false.
* \todo Clean up this mess, split into multiple functions. * \todo Clean up this mess, split into multiple functions.
* \todo Get rid of the magic number 10000.
* \sa P_KillMobj * \sa P_KillMobj
*/ */
boolean P_DamageMobj(mobj_t *target, mobj_t *inflictor, mobj_t *source, INT32 damage) boolean P_DamageMobj(mobj_t *target, mobj_t *inflictor, mobj_t *source, INT32 damage, UINT8 damagetype)
{ {
player_t *player; player_t *player;
#ifdef HAVE_BLUA #ifdef HAVE_BLUA
@ -2709,9 +2726,7 @@ boolean P_DamageMobj(mobj_t *target, mobj_t *inflictor, mobj_t *source, INT32 da
// Spectator handling // Spectator handling
if (netgame) if (netgame)
{ {
if (damage == 42000 && target->player && target->player->spectator) if (damagetype != DMG_SPECTATOR && target->player && target->player->spectator)
damage = 10000;
else if (target->player && target->player->spectator)
return false; return false;
if (source && source->player && source->player->spectator) if (source && source->player && source->player->spectator)
@ -2819,6 +2834,21 @@ boolean P_DamageMobj(mobj_t *target, mobj_t *inflictor, mobj_t *source, INT32 da
if (!(target->player->pflags & (PF_NIGHTSMODE|PF_NIGHTSFALL)) && (maptol & TOL_NIGHTS)) if (!(target->player->pflags & (PF_NIGHTSMODE|PF_NIGHTSFALL)) && (maptol & TOL_NIGHTS))
return false; return false;
switch (damagetype)
{
case DMG_WATER:
case DMG_FIRE:
if ((player->powers[pw_shield] & SH_NOSTACK) == SH_ELEMENTAL)
return false; // Invincible to water/fire damage
break;
case DMG_ELECTRIC:
if ((player->powers[pw_shield] & SH_NOSTACK) == SH_ATTRACT)
return false; // Invincible to electric damage
break;
default:
break;
}
} }
if (player->pflags & PF_NIGHTSMODE) // NiGHTS damage handling if (player->pflags & PF_NIGHTSMODE) // NiGHTS damage handling
@ -2840,12 +2870,12 @@ boolean P_DamageMobj(mobj_t *target, mobj_t *inflictor, mobj_t *source, INT32 da
return true; return true;
} }
if (!force && inflictor && (inflictor->flags & MF_FIRE)) if (!force && inflictor && inflictor->flags & MF_FIRE)
{ {
if ((player->powers[pw_shield] & SH_NOSTACK) == SH_ELEMENTAL) if ((player->powers[pw_shield] & SH_NOSTACK) == SH_ELEMENTAL)
return false; // Invincible to fire objects return false; // Invincible to fire objects
if (G_PlatformGametype() && source && source->player) if (G_PlatformGametype() && inflictor && source && source->player)
return false; // Don't get hurt by fire generated from friends. return false; // Don't get hurt by fire generated from friends.
} }
@ -2854,7 +2884,7 @@ boolean P_DamageMobj(mobj_t *target, mobj_t *inflictor, mobj_t *source, INT32 da
{ {
if ((gametype == GT_MATCH || gametype == GT_TEAMMATCH || gametype == GT_CTF) && cv_suddendeath.value if ((gametype == GT_MATCH || gametype == GT_TEAMMATCH || gametype == GT_CTF) && cv_suddendeath.value
&& !player->powers[pw_flashing] && !player->powers[pw_invulnerability]) && !player->powers[pw_flashing] && !player->powers[pw_invulnerability])
damage = 10000; damagetype = DMG_INSTAKILL;
} }
// Player hits another player // Player hits another player
@ -2868,7 +2898,7 @@ boolean P_DamageMobj(mobj_t *target, mobj_t *inflictor, mobj_t *source, INT32 da
return false; return false;
// Instant-Death // Instant-Death
if (damage == 10000) if (damagetype & DMG_DEATHMASK)
P_KillPlayer(player, source, damage); P_KillPlayer(player, source, damage);
else if (metalrecording) else if (metalrecording)
{ {
@ -2876,7 +2906,7 @@ boolean P_DamageMobj(mobj_t *target, mobj_t *inflictor, mobj_t *source, INT32 da
inflictor = source; inflictor = source;
if (inflictor && inflictor->flags & MF_ENEMY) if (inflictor && inflictor->flags & MF_ENEMY)
{ // Metal Sonic destroy enemy !! { // Metal Sonic destroy enemy !!
P_KillMobj(inflictor, NULL, target); P_KillMobj(inflictor, NULL, target, damagetype);
return false; return false;
} }
else if (inflictor && inflictor->flags & MF_MISSILE) else if (inflictor && inflictor->flags & MF_MISSILE)
@ -2915,7 +2945,7 @@ boolean P_DamageMobj(mobj_t *target, mobj_t *inflictor, mobj_t *source, INT32 da
else if (player->mo->health > 1) // No shield but have rings. else if (player->mo->health > 1) // No shield but have rings.
{ {
damage = player->mo->health - 1; damage = player->mo->health - 1;
P_RingDamage(player, inflictor, source, damage); P_RingDamage(player, inflictor, source, damage, damagetype);
} }
else // No shield, no rings, no invincibility. else // No shield, no rings, no invincibility.
{ {
@ -2952,21 +2982,20 @@ boolean P_DamageMobj(mobj_t *target, mobj_t *inflictor, mobj_t *source, INT32 da
if (gametype == GT_CTF && (player->gotflag & (GF_REDFLAG|GF_BLUEFLAG))) if (gametype == GT_CTF && (player->gotflag & (GF_REDFLAG|GF_BLUEFLAG)))
P_PlayerFlagBurst(player, false); P_PlayerFlagBurst(player, false);
} }
else if (damagetype & DMG_DEATHMASK)
player->health = 0;
else else
{ {
player->health -= damage; // mirror mobj health here player->health -= damage; // mirror mobj health here
if (damage < 10000) target->player->powers[pw_flashing] = flashingtics;
{ if (damage > 0) // don't spill emeralds/ammo/panels for shield damage
target->player->powers[pw_flashing] = flashingtics; P_PlayerRingBurst(player, damage);
if (damage > 0) // don't spill emeralds/ammo/panels for shield damage
P_PlayerRingBurst(player, damage);
}
} }
if (player->health < 0) if (player->health < 0)
player->health = 0; player->health = 0;
P_HitDeathMessages(player, inflictor, source); P_HitDeathMessages(player, inflictor, source, damagetype);
P_ForceFeed(player, 40, 10, TICRATE, 40 + min(damage, 100)*2); P_ForceFeed(player, 40, 10, TICRATE, 40 + min(damage, 100)*2);
} }
@ -2974,7 +3003,7 @@ boolean P_DamageMobj(mobj_t *target, mobj_t *inflictor, mobj_t *source, INT32 da
// Killing dead. Just for kicks. // Killing dead. Just for kicks.
// Require source and inflictor be player. Don't hurt for firing rings. // Require source and inflictor be player. Don't hurt for firing rings.
if (cv_killingdead.value && (source && source->player) && (inflictor && inflictor->player) && P_Random() < 80) if (cv_killingdead.value && (source && source->player) && (inflictor && inflictor->player) && P_Random() < 80)
P_DamageMobj(source, target, target, 1); P_DamageMobj(source, target, target, 1, 0);
// do the damage // do the damage
if (player && player->powers[pw_super] && ALL7EMERALDS(player->powers[pw_emeralds]) && inflictor && ((inflictor->flags & MF_MISSILE) || inflictor->player)) if (player && player->powers[pw_super] && ALL7EMERALDS(player->powers[pw_emeralds]) && inflictor && ((inflictor->flags & MF_MISSILE) || inflictor->player))
@ -2983,6 +3012,8 @@ boolean P_DamageMobj(mobj_t *target, mobj_t *inflictor, mobj_t *source, INT32 da
if (target->health < 2) if (target->health < 2)
target->health = 2; target->health = 2;
} }
else if (damagetype & DMG_DEATHMASK)
target->health = 0;
else else
target->health -= damage; target->health -= damage;
@ -2991,7 +3022,7 @@ boolean P_DamageMobj(mobj_t *target, mobj_t *inflictor, mobj_t *source, INT32 da
if (target->health <= 0) if (target->health <= 0)
{ {
P_KillMobj(target, inflictor, source); P_KillMobj(target, inflictor, source, damagetype);
return true; return true;
} }

View File

@ -38,6 +38,9 @@
#define MAPBMASK (MAPBLOCKSIZE-1) #define MAPBMASK (MAPBLOCKSIZE-1)
#define MAPBTOFRAC (MAPBLOCKSHIFT-FRACBITS) #define MAPBTOFRAC (MAPBLOCKSHIFT-FRACBITS)
// Convenience macro to fix issue with collision along bottom/left edges of blockmap -Red
#define BMBOUNDFIX(xl, xh, yl, yh) {if (xl > xh) xl = 0; if (yl > yh) yl = 0;}
// player radius used only in am_map.c // player radius used only in am_map.c
#define PLAYERRADIUS (16*FRACUNIT) #define PLAYERRADIUS (16*FRACUNIT)
@ -214,6 +217,23 @@ boolean P_RailThinker(mobj_t *mobj);
void P_PushableThinker(mobj_t *mobj); void P_PushableThinker(mobj_t *mobj);
void P_SceneryThinker(mobj_t *mobj); void P_SceneryThinker(mobj_t *mobj);
fixed_t P_MobjFloorZ(mobj_t *mobj, sector_t *sector, sector_t *boundsec, fixed_t x, fixed_t y, line_t *line, boolean lowest, boolean perfect);
fixed_t P_MobjCeilingZ(mobj_t *mobj, sector_t *sector, sector_t *boundsec, fixed_t x, fixed_t y, line_t *line, boolean lowest, boolean perfect);
#define P_GetFloorZ(mobj, sector, x, y, line) P_MobjFloorZ(mobj, sector, NULL, x, y, line, false, false)
#define P_GetCeilingZ(mobj, sector, x, y, line) P_MobjCeilingZ(mobj, sector, NULL, x, y, line, true, false)
#define P_GetFOFTopZ(mobj, sector, fof, x, y, line) P_MobjCeilingZ(mobj, sectors + fof->secnum, sector, x, y, line, false, false)
#define P_GetFOFBottomZ(mobj, sector, fof, x, y, line) P_MobjFloorZ(mobj, sectors + fof->secnum, sector, x, y, line, true, false)
#define P_GetSpecialBottomZ(mobj, src, bound) P_MobjFloorZ(mobj, src, bound, mobj->x, mobj->y, NULL, src != bound, true)
#define P_GetSpecialTopZ(mobj, src, bound) P_MobjCeilingZ(mobj, src, bound, mobj->x, mobj->y, NULL, src == bound, true)
fixed_t P_CameraFloorZ(camera_t *mobj, sector_t *sector, sector_t *boundsec, fixed_t x, fixed_t y, line_t *line, boolean lowest, boolean perfect);
fixed_t P_CameraCeilingZ(camera_t *mobj, sector_t *sector, sector_t *boundsec, fixed_t x, fixed_t y, line_t *line, boolean lowest, boolean perfect);
#define P_CameraGetFloorZ(mobj, sector, x, y, line) P_CameraFloorZ(mobj, sector, NULL, x, y, line, false, false)
#define P_CameraGetCeilingZ(mobj, sector, x, y, line) P_CameraCeilingZ(mobj, sector, NULL, x, y, line, true, false)
#define P_CameraGetFOFTopZ(mobj, sector, fof, x, y, line) P_CameraCeilingZ(mobj, sectors + fof->secnum, sector, x, y, line, false, false)
#define P_CameraGetFOFBottomZ(mobj, sector, fof, x, y, line) P_CameraFloorZ(mobj, sectors + fof->secnum, sector, x, y, line, true, false)
boolean P_InsideANonSolidFFloor(mobj_t *mobj, ffloor_t *rover); boolean P_InsideANonSolidFFloor(mobj_t *mobj, ffloor_t *rover);
boolean P_CheckDeathPitCollide(mobj_t *mo); boolean P_CheckDeathPitCollide(mobj_t *mo);
boolean P_CheckSolidLava(mobj_t *mo, ffloor_t *rover); boolean P_CheckSolidLava(mobj_t *mo, ffloor_t *rover);
@ -273,9 +293,13 @@ boolean P_LookForPlayers(mobj_t *actor, boolean allaround, boolean tracer, fixed
extern boolean floatok; extern boolean floatok;
extern fixed_t tmfloorz; extern fixed_t tmfloorz;
extern fixed_t tmceilingz; extern fixed_t tmceilingz;
extern boolean tmsprung; extern mobj_t *tmfloorthing, *tmhitthing, *tmthing;
extern mobj_t *tmfloorthing, *tmthing;
extern camera_t *mapcampointer; extern camera_t *mapcampointer;
extern fixed_t tmx;
extern fixed_t tmy;
#ifdef ESLOPE
extern pslope_t *tmfloorslope, *tmceilingslope;
#endif
/* cphipps 2004/08/30 */ /* cphipps 2004/08/30 */
extern void P_MapStart(void); extern void P_MapStart(void);
@ -314,7 +338,7 @@ void P_RadiusAttack(mobj_t *spot, mobj_t *source, fixed_t damagedist);
fixed_t P_FloorzAtPos(fixed_t x, fixed_t y, fixed_t z, fixed_t height); fixed_t P_FloorzAtPos(fixed_t x, fixed_t y, fixed_t z, fixed_t height);
boolean PIT_PushableMoved(mobj_t *thing); boolean PIT_PushableMoved(mobj_t *thing);
void P_DoSpring(mobj_t *spring, mobj_t *object); boolean P_DoSpring(mobj_t *spring, mobj_t *object);
// //
// P_SETUP // P_SETUP
@ -343,12 +367,29 @@ typedef struct BasicFF_s
INT32 Magnitude; ///< Magnitude of the effect, in the range from 0 through 10,000. INT32 Magnitude; ///< Magnitude of the effect, in the range from 0 through 10,000.
} BasicFF_t; } BasicFF_t;
/* Damage/death types, for P_DamageMobj and related */
//// Damage types
//#define DMG_NORMAL 0 (unneeded?)
#define DMG_WATER 1
#define DMG_FIRE 2
#define DMG_ELECTRIC 3
#define DMG_SPIKE 4
//#define DMG_SPECIALSTAGE 5
//// Death types - cannot be combined with damage types
#define DMG_INSTAKILL 0x80
#define DMG_DROWNED 0x80+1
#define DMG_SPACEDROWN 0x80+2
#define DMG_DEATHPIT 0x80+3
#define DMG_CRUSHED 0x80+4
#define DMG_SPECTATOR 0x80+5
#define DMG_DEATHMASK DMG_INSTAKILL // if bit 7 is set, this is a death type instead of a damage type
void P_ForceFeed(const player_t *player, INT32 attack, INT32 fade, tic_t duration, INT32 period); void P_ForceFeed(const player_t *player, INT32 attack, INT32 fade, tic_t duration, INT32 period);
void P_ForceConstant(const BasicFF_t *FFInfo); void P_ForceConstant(const BasicFF_t *FFInfo);
void P_RampConstant(const BasicFF_t *FFInfo, INT32 Start, INT32 End); void P_RampConstant(const BasicFF_t *FFInfo, INT32 Start, INT32 End);
void P_RemoveShield(player_t *player); void P_RemoveShield(player_t *player);
boolean P_DamageMobj(mobj_t *target, mobj_t *inflictor, mobj_t *source, INT32 damage); boolean P_DamageMobj(mobj_t *target, mobj_t *inflictor, mobj_t *source, INT32 damage, UINT8 damagetype);
void P_KillMobj(mobj_t *target, mobj_t *inflictor, mobj_t *source); void P_KillMobj(mobj_t *target, mobj_t *inflictor, mobj_t *source, UINT8 damagetype);
void P_PlayerRingBurst(player_t *player, INT32 num_rings); /// \todo better fit in p_user.c void P_PlayerRingBurst(player_t *player, INT32 num_rings); /// \todo better fit in p_user.c
void P_PlayerWeaponPanelBurst(player_t *player); void P_PlayerWeaponPanelBurst(player_t *player);
void P_PlayerWeaponAmmoBurst(player_t *player); void P_PlayerWeaponAmmoBurst(player_t *player);

File diff suppressed because it is too large Load Diff

View File

@ -17,8 +17,10 @@
#include "p_local.h" #include "p_local.h"
#include "r_main.h" #include "r_main.h"
#include "r_data.h"
#include "p_maputl.h" #include "p_maputl.h"
#include "p_polyobj.h" #include "p_polyobj.h"
#include "p_slopes.h"
#include "z_zone.h" #include "z_zone.h"
// //
@ -321,6 +323,9 @@ fixed_t P_InterceptVector(divline_t *v2, divline_t *v1)
// OPTIMIZE: keep this precalculated // OPTIMIZE: keep this precalculated
// //
fixed_t opentop, openbottom, openrange, lowfloor, highceiling; fixed_t opentop, openbottom, openrange, lowfloor, highceiling;
#ifdef ESLOPE
pslope_t *opentopslope, *openbottomslope;
#endif
// P_CameraLineOpening // P_CameraLineOpening
// P_LineOpening, but for camera // P_LineOpening, but for camera
@ -347,31 +352,56 @@ void P_CameraLineOpening(line_t *linedef)
{ {
frontfloor = sectors[front->camsec].floorheight; frontfloor = sectors[front->camsec].floorheight;
frontceiling = sectors[front->camsec].ceilingheight; frontceiling = sectors[front->camsec].ceilingheight;
#ifdef ESLOPE
if (sectors[front->camsec].f_slope) // SRB2CBTODO: ESLOPE (sectors[front->heightsec].f_slope)
frontfloor = P_GetZAt(sectors[front->camsec].f_slope, camera.x, camera.y);
if (sectors[front->camsec].c_slope)
frontceiling = P_GetZAt(sectors[front->camsec].c_slope, camera.x, camera.y);
#endif
} }
else if (front->heightsec >= 0) else if (front->heightsec >= 0)
{ {
frontfloor = sectors[front->heightsec].floorheight; frontfloor = sectors[front->heightsec].floorheight;
frontceiling = sectors[front->heightsec].ceilingheight; frontceiling = sectors[front->heightsec].ceilingheight;
#ifdef ESLOPE
if (sectors[front->heightsec].f_slope) // SRB2CBTODO: ESLOPE (sectors[front->heightsec].f_slope)
frontfloor = P_GetZAt(sectors[front->heightsec].f_slope, camera.x, camera.y);
if (sectors[front->heightsec].c_slope)
frontceiling = P_GetZAt(sectors[front->heightsec].c_slope, camera.x, camera.y);
#endif
} }
else else
{ {
frontfloor = front->floorheight; frontfloor = P_CameraGetFloorZ(mapcampointer, front, tmx, tmy, linedef);
frontceiling = front->ceilingheight; frontceiling = P_CameraGetCeilingZ(mapcampointer, front, tmx, tmy, linedef);
} }
if (back->camsec >= 0) if (back->camsec >= 0)
{ {
backfloor = sectors[back->camsec].floorheight; backfloor = sectors[back->camsec].floorheight;
backceiling = sectors[back->camsec].ceilingheight; backceiling = sectors[back->camsec].ceilingheight;
#ifdef ESLOPE
if (sectors[back->camsec].f_slope) // SRB2CBTODO: ESLOPE (sectors[front->heightsec].f_slope)
frontfloor = P_GetZAt(sectors[back->camsec].f_slope, camera.x, camera.y);
if (sectors[back->camsec].c_slope)
frontceiling = P_GetZAt(sectors[back->camsec].c_slope, camera.x, camera.y);
#endif
} }
else if (back->heightsec >= 0) else if (back->heightsec >= 0)
{ {
backfloor = sectors[back->heightsec].floorheight; backfloor = sectors[back->heightsec].floorheight;
backceiling = sectors[back->heightsec].ceilingheight; backceiling = sectors[back->heightsec].ceilingheight;
#ifdef ESLOPE
if (sectors[back->heightsec].f_slope) // SRB2CBTODO: ESLOPE (sectors[front->heightsec].f_slope)
frontfloor = P_GetZAt(sectors[back->heightsec].f_slope, camera.x, camera.y);
if (sectors[back->heightsec].c_slope)
frontceiling = P_GetZAt(sectors[back->heightsec].c_slope, camera.x, camera.y);
#endif
} }
else else
{ {
backfloor = back->floorheight; backfloor = P_CameraGetFloorZ(mapcampointer, back, tmx, tmy, linedef);
backceiling = back->ceilingheight; backceiling = P_CameraGetCeilingZ(mapcampointer, back, tmx, tmy, linedef);
} }
{ {
@ -413,40 +443,48 @@ void P_CameraLineOpening(line_t *linedef)
if (front->ffloors) if (front->ffloors)
for (rover = front->ffloors; rover; rover = rover->next) for (rover = front->ffloors; rover; rover = rover->next)
{ {
fixed_t topheight, bottomheight;
if (!(rover->flags & FF_BLOCKOTHERS) || !(rover->flags & FF_RENDERALL) || !(rover->flags & FF_EXISTS) || GETSECSPECIAL(rover->master->frontsector->special, 4) == 12) if (!(rover->flags & FF_BLOCKOTHERS) || !(rover->flags & FF_RENDERALL) || !(rover->flags & FF_EXISTS) || GETSECSPECIAL(rover->master->frontsector->special, 4) == 12)
continue; continue;
delta1 = abs(mapcampointer->z - (*rover->bottomheight + ((*rover->topheight - *rover->bottomheight)/2))); topheight = P_CameraGetFOFTopZ(mapcampointer, front, rover, tmx, tmy, linedef);
delta2 = abs(thingtop - (*rover->bottomheight + ((*rover->topheight - *rover->bottomheight)/2))); bottomheight = P_CameraGetFOFBottomZ(mapcampointer, front, rover, tmx, tmy, linedef);
if (*rover->bottomheight < lowestceiling && delta1 >= delta2)
lowestceiling = *rover->bottomheight;
else if (*rover->bottomheight < highestceiling && delta1 >= delta2)
highestceiling = *rover->bottomheight;
if (*rover->topheight > highestfloor && delta1 < delta2) delta1 = abs(mapcampointer->z - (bottomheight + ((topheight - bottomheight)/2)));
highestfloor = *rover->topheight; delta2 = abs(thingtop - (bottomheight + ((topheight - bottomheight)/2)));
else if (*rover->topheight > lowestfloor && delta1 < delta2) if (bottomheight < lowestceiling && delta1 >= delta2)
lowestfloor = *rover->topheight; lowestceiling = bottomheight;
else if (bottomheight < highestceiling && delta1 >= delta2)
highestceiling = bottomheight;
if (topheight > highestfloor && delta1 < delta2)
highestfloor = topheight;
else if (topheight > lowestfloor && delta1 < delta2)
lowestfloor = topheight;
} }
// Check for backsectors fake floors // Check for backsectors fake floors
if (back->ffloors) if (back->ffloors)
for (rover = back->ffloors; rover; rover = rover->next) for (rover = back->ffloors; rover; rover = rover->next)
{ {
fixed_t topheight, bottomheight;
if (!(rover->flags & FF_BLOCKOTHERS) || !(rover->flags & FF_RENDERALL) || !(rover->flags & FF_EXISTS) || GETSECSPECIAL(rover->master->frontsector->special, 4) == 12) if (!(rover->flags & FF_BLOCKOTHERS) || !(rover->flags & FF_RENDERALL) || !(rover->flags & FF_EXISTS) || GETSECSPECIAL(rover->master->frontsector->special, 4) == 12)
continue; continue;
delta1 = abs(mapcampointer->z - (*rover->bottomheight + ((*rover->topheight - *rover->bottomheight)/2))); topheight = P_CameraGetFOFTopZ(mapcampointer, back, rover, tmx, tmy, linedef);
delta2 = abs(thingtop - (*rover->bottomheight + ((*rover->topheight - *rover->bottomheight)/2))); bottomheight = P_CameraGetFOFBottomZ(mapcampointer, back, rover, tmx, tmy, linedef);
if (*rover->bottomheight < lowestceiling && delta1 >= delta2)
lowestceiling = *rover->bottomheight;
else if (*rover->bottomheight < highestceiling && delta1 >= delta2)
highestceiling = *rover->bottomheight;
if (*rover->topheight > highestfloor && delta1 < delta2) delta1 = abs(mapcampointer->z - (bottomheight + ((topheight - bottomheight)/2)));
highestfloor = *rover->topheight; delta2 = abs(thingtop - (bottomheight + ((topheight - bottomheight)/2)));
else if (*rover->topheight > lowestfloor && delta1 < delta2) if (bottomheight < lowestceiling && delta1 >= delta2)
lowestfloor = *rover->topheight; lowestceiling = bottomheight;
else if (bottomheight < highestceiling && delta1 >= delta2)
highestceiling = bottomheight;
if (topheight > highestfloor && delta1 < delta2)
highestfloor = topheight;
else if (topheight > lowestfloor && delta1 < delta2)
lowestfloor = topheight;
} }
if (highestceiling < highceiling) if (highestceiling < highceiling)
@ -494,32 +532,91 @@ void P_LineOpening(line_t *linedef)
I_Assert(front != NULL); I_Assert(front != NULL);
I_Assert(back != NULL); I_Assert(back != NULL);
if (front->ceilingheight < back->ceilingheight) { // Set open and high/low values here
{ fixed_t frontheight, backheight;
opentop = front->ceilingheight;
highceiling = back->ceilingheight;
}
else
{
opentop = back->ceilingheight;
highceiling = front->ceilingheight;
}
if (front->floorheight > back->floorheight) frontheight = P_GetCeilingZ(tmthing, front, tmx, tmy, linedef);
{ backheight = P_GetCeilingZ(tmthing, back, tmx, tmy, linedef);
openbottom = front->floorheight;
lowfloor = back->floorheight; if (frontheight < backheight)
} {
else opentop = frontheight;
{ highceiling = backheight;
openbottom = back->floorheight; opentopslope = front->c_slope;
lowfloor = front->floorheight; }
else
{
opentop = backheight;
highceiling = frontheight;
opentopslope = back->c_slope;
}
frontheight = P_GetFloorZ(tmthing, front, tmx, tmy, linedef);
backheight = P_GetFloorZ(tmthing, back, tmx, tmy, linedef);
if (frontheight > backheight)
{
openbottom = frontheight;
lowfloor = backheight;
openbottomslope = front->f_slope;
}
else
{
openbottom = backheight;
lowfloor = frontheight;
openbottomslope = back->f_slope;
}
} }
if (tmthing) if (tmthing)
{ {
fixed_t thingtop = tmthing->z + tmthing->height; fixed_t thingtop = tmthing->z + tmthing->height;
// Check for collision with front side's midtexture if Effect 4 is set
if (linedef->flags & ML_EFFECT4) {
side_t *side = &sides[linedef->sidenum[0]];
fixed_t textop, texbottom, texheight;
fixed_t texmid, delta1, delta2;
// Get the midtexture's height
texheight = textures[texturetranslation[side->midtexture]]->height << FRACBITS;
// Set texbottom and textop to the Z coordinates of the texture's boundaries
#ifdef POLYOBJECTS
if (linedef->polyobj && (linedef->polyobj->flags & POF_TESTHEIGHT)) {
if (linedef->flags & ML_DONTPEGBOTTOM) {
texbottom = back->floorheight + side->rowoffset;
textop = texbottom + texheight*(side->repeatcnt+1);
} else {
textop = back->ceilingheight - side->rowoffset;
texbottom = textop - texheight*(side->repeatcnt+1);
}
} else
#endif
{
if (linedef->flags & ML_DONTPEGBOTTOM) {
texbottom = openbottom + side->rowoffset;
textop = texbottom + texheight*(side->repeatcnt+1);
} else {
textop = opentop - side->rowoffset;
texbottom = textop - texheight*(side->repeatcnt+1);
}
}
texmid = texbottom+(textop-texbottom)/2;
delta1 = abs(tmthing->z - texmid);
delta2 = abs(thingtop - texmid);
if (delta1 > delta2) { // Below
if (opentop > texbottom)
opentop = texbottom;
} else { // Above
if (openbottom < textop)
openbottom = textop;
}
}
// Check for fake floors in the sector. // Check for fake floors in the sector.
if (front->ffloors || back->ffloors if (front->ffloors || back->ffloors
#ifdef POLYOBJECTS #ifdef POLYOBJECTS
@ -534,10 +631,15 @@ void P_LineOpening(line_t *linedef)
fixed_t highestfloor = openbottom; fixed_t highestfloor = openbottom;
fixed_t lowestfloor = lowfloor; fixed_t lowestfloor = lowfloor;
fixed_t delta1, delta2; fixed_t delta1, delta2;
#ifdef ESLOPE
pslope_t *ceilingslope = opentopslope;
pslope_t *floorslope = openbottomslope;
#endif
// Check for frontsector's fake floors // Check for frontsector's fake floors
for (rover = front->ffloors; rover; rover = rover->next) for (rover = front->ffloors; rover; rover = rover->next)
{ {
fixed_t topheight, bottomheight;
if (!(rover->flags & FF_EXISTS)) if (!(rover->flags & FF_EXISTS))
continue; continue;
@ -547,29 +649,41 @@ void P_LineOpening(line_t *linedef)
|| (rover->flags & FF_BLOCKOTHERS && !tmthing->player))) || (rover->flags & FF_BLOCKOTHERS && !tmthing->player)))
continue; continue;
delta1 = abs(tmthing->z - (*rover->bottomheight + ((*rover->topheight - *rover->bottomheight)/2))); topheight = P_GetFOFTopZ(tmthing, front, rover, tmx, tmy, linedef);
delta2 = abs(thingtop - (*rover->bottomheight + ((*rover->topheight - *rover->bottomheight)/2))); bottomheight = P_GetFOFBottomZ(tmthing, front, rover, tmx, tmy, linedef);
delta1 = abs(tmthing->z - (bottomheight + ((topheight - bottomheight)/2)));
delta2 = abs(thingtop - (bottomheight + ((topheight - bottomheight)/2)));
if (delta1 >= delta2 && !(rover->flags & FF_PLATFORM)) // thing is below FOF if (delta1 >= delta2 && !(rover->flags & FF_PLATFORM)) // thing is below FOF
{ {
if (*rover->bottomheight < lowestceiling) if (bottomheight < lowestceiling) {
lowestceiling = *rover->bottomheight; lowestceiling = bottomheight;
else if (*rover->bottomheight < highestceiling) #ifdef ESLOPE
highestceiling = *rover->bottomheight; ceilingslope = *rover->b_slope;
#endif
}
else if (bottomheight < highestceiling)
highestceiling = bottomheight;
} }
if (delta1 < delta2 && !(rover->flags & FF_REVERSEPLATFORM)) // thing is above FOF if (delta1 < delta2 && !(rover->flags & FF_REVERSEPLATFORM)) // thing is above FOF
{ {
if (*rover->topheight > highestfloor) if (topheight > highestfloor) {
highestfloor = *rover->topheight; highestfloor = topheight;
else if (*rover->topheight > lowestfloor) #ifdef ESLOPE
lowestfloor = *rover->topheight; floorslope = *rover->t_slope;
#endif
}
else if (topheight > lowestfloor)
lowestfloor = topheight;
} }
} }
// Check for backsectors fake floors // Check for backsectors fake floors
for (rover = back->ffloors; rover; rover = rover->next) for (rover = back->ffloors; rover; rover = rover->next)
{ {
fixed_t topheight, bottomheight;
if (!(rover->flags & FF_EXISTS)) if (!(rover->flags & FF_EXISTS))
continue; continue;
@ -579,23 +693,34 @@ void P_LineOpening(line_t *linedef)
|| (rover->flags & FF_BLOCKOTHERS && !tmthing->player))) || (rover->flags & FF_BLOCKOTHERS && !tmthing->player)))
continue; continue;
delta1 = abs(tmthing->z - (*rover->bottomheight + ((*rover->topheight - *rover->bottomheight)/2))); topheight = P_GetFOFTopZ(tmthing, back, rover, tmx, tmy, linedef);
delta2 = abs(thingtop - (*rover->bottomheight + ((*rover->topheight - *rover->bottomheight)/2))); bottomheight = P_GetFOFBottomZ(tmthing, back, rover, tmx, tmy, linedef);
delta1 = abs(tmthing->z - (bottomheight + ((topheight - bottomheight)/2)));
delta2 = abs(thingtop - (bottomheight + ((topheight - bottomheight)/2)));
if (delta1 >= delta2 && !(rover->flags & FF_PLATFORM)) // thing is below FOF if (delta1 >= delta2 && !(rover->flags & FF_PLATFORM)) // thing is below FOF
{ {
if (*rover->bottomheight < lowestceiling) if (bottomheight < lowestceiling) {
lowestceiling = *rover->bottomheight; lowestceiling = bottomheight;
else if (*rover->bottomheight < highestceiling) #ifdef ESLOPE
highestceiling = *rover->bottomheight; ceilingslope = *rover->b_slope;
#endif
}
else if (bottomheight < highestceiling)
highestceiling = bottomheight;
} }
if (delta1 < delta2 && !(rover->flags & FF_REVERSEPLATFORM)) // thing is above FOF if (delta1 < delta2 && !(rover->flags & FF_REVERSEPLATFORM)) // thing is above FOF
{ {
if (*rover->topheight > highestfloor) if (topheight > highestfloor) {
highestfloor = *rover->topheight; highestfloor = topheight;
else if (*rover->topheight > lowestfloor) #ifdef ESLOPE
lowestfloor = *rover->topheight; floorslope = *rover->t_slope;
#endif
}
else if (topheight > lowestfloor)
lowestfloor = topheight;
} }
} }
@ -607,13 +732,21 @@ void P_LineOpening(line_t *linedef)
delta1 = abs(tmthing->z - (polysec->floorheight + ((polysec->ceilingheight - polysec->floorheight)/2))); delta1 = abs(tmthing->z - (polysec->floorheight + ((polysec->ceilingheight - polysec->floorheight)/2)));
delta2 = abs(thingtop - (polysec->floorheight + ((polysec->ceilingheight - polysec->floorheight)/2))); delta2 = abs(thingtop - (polysec->floorheight + ((polysec->ceilingheight - polysec->floorheight)/2)));
if (polysec->floorheight < lowestceiling && delta1 >= delta2) if (polysec->floorheight < lowestceiling && delta1 >= delta2) {
lowestceiling = polysec->floorheight; lowestceiling = polysec->floorheight;
#ifdef ESLOPE
ceilingslope = NULL;
#endif
}
else if (polysec->floorheight < highestceiling && delta1 >= delta2) else if (polysec->floorheight < highestceiling && delta1 >= delta2)
highestceiling = polysec->floorheight; highestceiling = polysec->floorheight;
if (polysec->ceilingheight > highestfloor && delta1 < delta2) if (polysec->ceilingheight > highestfloor && delta1 < delta2) {
highestfloor = polysec->ceilingheight; highestfloor = polysec->ceilingheight;
#ifdef ESLOPE
floorslope = NULL;
#endif
}
else if (polysec->ceilingheight > lowestfloor && delta1 < delta2) else if (polysec->ceilingheight > lowestfloor && delta1 < delta2)
lowestfloor = polysec->ceilingheight; lowestfloor = polysec->ceilingheight;
} }
@ -621,11 +754,19 @@ void P_LineOpening(line_t *linedef)
if (highestceiling < highceiling) if (highestceiling < highceiling)
highceiling = highestceiling; highceiling = highestceiling;
if (highestfloor > openbottom) if (highestfloor > openbottom) {
openbottom = highestfloor; openbottom = highestfloor;
#ifdef ESLOPE
openbottomslope = floorslope;
#endif
}
if (lowestceiling < opentop) if (lowestceiling < opentop) {
opentop = lowestceiling; opentop = lowestceiling;
#ifdef ESLOPE
opentopslope = ceilingslope;
#endif
}
if (lowestfloor > lowfloor) if (lowestfloor > lowfloor)
lowfloor = lowestfloor; lowfloor = lowestfloor;
@ -723,6 +864,7 @@ void P_SetThingPosition(mobj_t *thing)
{ // link into subsector { // link into subsector
subsector_t *ss; subsector_t *ss;
sector_t *oldsec = NULL; sector_t *oldsec = NULL;
fixed_t tfloorz, tceilz;
I_Assert(thing != NULL); I_Assert(thing != NULL);
I_Assert(!P_MobjWasRemoved(thing)); I_Assert(!P_MobjWasRemoved(thing));
@ -792,12 +934,15 @@ void P_SetThingPosition(mobj_t *thing)
// sector's floor is the same height. // sector's floor is the same height.
if (thing->player && oldsec != NULL && thing->subsector && oldsec != thing->subsector->sector) if (thing->player && oldsec != NULL && thing->subsector && oldsec != thing->subsector->sector)
{ {
tfloorz = P_GetFloorZ(thing, ss->sector, thing->x, thing->y, NULL);
tceilz = P_GetCeilingZ(thing, ss->sector, thing->x, thing->y, NULL);
if (thing->eflags & MFE_VERTICALFLIP) if (thing->eflags & MFE_VERTICALFLIP)
{ {
if (thing->z + thing->height >= thing->subsector->sector->ceilingheight) if (thing->z + thing->height >= tceilz)
thing->eflags |= MFE_JUSTSTEPPEDDOWN; thing->eflags |= MFE_JUSTSTEPPEDDOWN;
} }
else if (thing->z <= thing->subsector->sector->floorheight) else if (thing->z <= tfloorz)
thing->eflags |= MFE_JUSTSTEPPEDDOWN; thing->eflags |= MFE_JUSTSTEPPEDDOWN;
} }
} }

View File

@ -55,6 +55,9 @@ void P_CreatePrecipSecNodeList(precipmobj_t *thing, fixed_t x,fixed_t y);
boolean P_SceneryTryMove(mobj_t *thing, fixed_t x, fixed_t y); boolean P_SceneryTryMove(mobj_t *thing, fixed_t x, fixed_t y);
extern fixed_t opentop, openbottom, openrange, lowfloor, highceiling; extern fixed_t opentop, openbottom, openrange, lowfloor, highceiling;
#ifdef ESLOPE
extern pslope_t *opentopslope, *openbottomslope;
#endif
void P_LineOpening(line_t *plinedef); void P_LineOpening(line_t *plinedef);

File diff suppressed because it is too large Load Diff

View File

@ -175,24 +175,23 @@ typedef enum
MF2_EXPLOSION = 1<<7, // Thrown ring has explosive properties MF2_EXPLOSION = 1<<7, // Thrown ring has explosive properties
MF2_SCATTER = 1<<8, // Thrown ring has scatter properties MF2_SCATTER = 1<<8, // Thrown ring has scatter properties
MF2_BEYONDTHEGRAVE = 1<<9, // Source of this missile has died and has since respawned. MF2_BEYONDTHEGRAVE = 1<<9, // Source of this missile has died and has since respawned.
MF2_PUSHED = 1<<10, // Mobj was already pushed this tic MF2_SLIDEPUSH = 1<<10, // MF_PUSHABLE that pushes continuously.
MF2_SLIDEPUSH = 1<<11, // MF_PUSHABLE that pushes continuously. MF2_CLASSICPUSH = 1<<11, // Drops straight down when object has negative Z.
MF2_CLASSICPUSH = 1<<12, // Drops straight down when object has negative Z. MF2_STANDONME = 1<<12, // While not pushable, stand on me anyway.
MF2_STANDONME = 1<<13, // While not pushable, stand on me anyway. MF2_INFLOAT = 1<<13, // Floating to a height for a move, don't auto float to target's height.
MF2_INFLOAT = 1<<14, // Floating to a height for a move, don't auto float to target's height. MF2_DEBRIS = 1<<14, // Splash ring from explosion ring
MF2_DEBRIS = 1<<15, // Splash ring from explosion ring MF2_NIGHTSPULL = 1<<15, // Attracted from a paraloop
MF2_NIGHTSPULL = 1<<16, // Attracted from a paraloop MF2_JUSTATTACKED = 1<<16, // can be pushed by other moving mobjs
MF2_JUSTATTACKED = 1<<17, // can be pushed by other moving mobjs MF2_FIRING = 1<<17, // turret fire
MF2_FIRING = 1<<18, // turret fire MF2_SUPERFIRE = 1<<18, // Firing something with Super Sonic-stopping properties. Or, if mobj has MF_MISSILE, this is the actual fire from it.
MF2_SUPERFIRE = 1<<19, // Firing something with Super Sonic-stopping properties. Or, if mobj has MF_MISSILE, this is the actual fire from it. MF2_SHADOW = 1<<19, // Fuzzy draw, makes targeting harder.
MF2_SHADOW = 1<<20, // Fuzzy draw, makes targeting harder. MF2_STRONGBOX = 1<<20, // Flag used for "strong" random monitors.
MF2_STRONGBOX = 1<<21, // Flag used for "strong" random monitors. MF2_OBJECTFLIP = 1<<21, // Flag for objects that always have flipped gravity.
MF2_OBJECTFLIP = 1<<22, // Flag for objects that always have flipped gravity. MF2_SKULLFLY = 1<<22, // Special handling: skull in flight.
MF2_SKULLFLY = 1<<23, // Special handling: skull in flight. MF2_FRET = 1<<23, // Flashing from a previous hit
MF2_FRET = 1<<24, // Flashing from a previous hit MF2_BOSSNOTRAP = 1<<24, // No Egg Trap after boss
MF2_BOSSNOTRAP = 1<<25, // No Egg Trap after boss MF2_BOSSFLEE = 1<<25, // Boss is fleeing!
MF2_BOSSFLEE = 1<<26, // Boss is fleeing! MF2_BOSSDEAD = 1<<26, // Boss is dead! (Not necessarily fleeing, if a fleeing point doesn't exist.)
MF2_BOSSDEAD = 1<<27, // Boss is dead! (Not necessarily fleeing, if a fleeing point doesn't exist.)
// free: to and including 1<<31 // free: to and including 1<<31
} mobjflag2_t; } mobjflag2_t;
@ -232,7 +231,13 @@ typedef enum
MFE_VERTICALFLIP = 1<<5, MFE_VERTICALFLIP = 1<<5,
// Goo water // Goo water
MFE_GOOWATER = 1<<6, MFE_GOOWATER = 1<<6,
// free: to and including 1<<7 // Mobj was already pushed this tic
MFE_PUSHED = 1<<7,
// Mobj was already sprung this tic
MFE_SPRUNG = 1<<8,
// Platform movement
MFE_APPLYPMOMZ = 1<<9,
// free: to and including 1<<15
} mobjeflag_t; } mobjeflag_t;
// //
@ -265,6 +270,7 @@ typedef struct mobj_s
angle_t angle; // orientation angle_t angle; // orientation
spritenum_t sprite; // used to find patch_t and flip value spritenum_t sprite; // used to find patch_t and flip value
UINT32 frame; // frame number, plus bits see p_pspr.h UINT32 frame; // frame number, plus bits see p_pspr.h
UINT8 sprite2; // player sprites
struct msecnode_s *touching_sectorlist; // a linked list of sectors where this object appears struct msecnode_s *touching_sectorlist; // a linked list of sectors where this object appears
@ -286,7 +292,7 @@ typedef struct mobj_s
state_t *state; state_t *state;
UINT32 flags; // flags from mobjinfo tables UINT32 flags; // flags from mobjinfo tables
UINT32 flags2; // MF2_ flags UINT32 flags2; // MF2_ flags
UINT8 eflags; // extra flags UINT16 eflags; // extra flags
void *skin; // overrides 'sprite' when non-NULL (for player bodies to 'remember' the skin) void *skin; // overrides 'sprite' when non-NULL (for player bodies to 'remember' the skin)
// Player and mobj sprites in multiplayer modes are modified // Player and mobj sprites in multiplayer modes are modified
@ -349,6 +355,10 @@ typedef struct mobj_s
INT32 cusval; INT32 cusval;
INT32 cvmem; INT32 cvmem;
#ifdef ESLOPE
struct pslope_s *standingslope; // The slope that the object is standing on (shouldn't need synced in savegames, right?)
#endif
// WARNING: New fields must be added separately to savegame and Lua. // WARNING: New fields must be added separately to savegame and Lua.
} mobj_t; } mobj_t;

View File

@ -239,24 +239,39 @@ boolean P_BBoxInsidePolyobj(polyobj_t *po, fixed_t *bbox)
// //
// Polyobj_GetInfo // Polyobj_GetInfo
// //
// Finds the 'polyobject settings' linedef that shares the same tag // Finds the 'polyobject settings' linedef for a polyobject
// as the polyobj linedef to get the settings for it. // the polyobject's id should be set as its tag
// //
void Polyobj_GetInfo(INT16 tag, INT32 *polyID, INT32 *mirrorID, UINT16 *exparg) void Polyobj_GetInfo(INT16 poid, INT32 *poflags, INT32 *parentID, INT32 *potrans)
{ {
INT32 i = P_FindSpecialLineFromTag(POLYINFO_SPECIALNUM, tag, -1); INT32 i = P_FindSpecialLineFromTag(POLYINFO_SPECIALNUM, poid, -1);
if (i == -1) if (i == -1)
I_Error("Polyobject (tag: %d) needs line %d for information.\n", tag, POLYINFO_SPECIALNUM); return; // no extra settings to apply, let's leave it
if (polyID) if (parentID)
*polyID = lines[i].frontsector->floorheight>>FRACBITS; *parentID = lines[i].frontsector->special;
if (mirrorID) if (potrans)
*mirrorID = lines[i].frontsector->special; *potrans = (lines[i].frontsector->floorheight>>FRACBITS) / 100;
if (exparg) if (lines[i].flags & ML_EFFECT1)
*exparg = (UINT16)lines[i].frontsector->lightlevel; *poflags |= POF_ONESIDE;
if (lines[i].flags & ML_EFFECT2)
*poflags &= ~POF_SOLID;
if (lines[i].flags & ML_EFFECT3)
*poflags |= POF_PUSHABLESTOP;
if (lines[i].flags & ML_EFFECT4)
*poflags |= POF_RENDERPLANES;
/*if (lines[i].flags & ML_EFFECT5)
*poflags &= ~POF_CLIPPLANES;*/
if (lines[i].flags & ML_NOCLIMB) // Has a linedef executor
*poflags |= POF_LDEXEC;
} }
// Reallocating array maintenance // Reallocating array maintenance
@ -478,6 +493,7 @@ newseg:
CONS_Debug(DBG_POLYOBJ, "Polyobject %d is not closed\n", po->id); CONS_Debug(DBG_POLYOBJ, "Polyobject %d is not closed\n", po->id);
} }
/*
// structure used to store segs during explicit search process // structure used to store segs during explicit search process
typedef struct segitem_s typedef struct segitem_s
{ {
@ -553,7 +569,7 @@ static void Polyobj_findExplicit(polyobj_t *po)
// free the temporary array // free the temporary array
Z_Free(segitems); Z_Free(segitems);
} }*/
// Setup functions // Setup functions
@ -591,47 +607,27 @@ static void Polyobj_spawnPolyObj(INT32 num, mobj_t *spawnSpot, INT32 id)
for (i = 0; i < numsegs; ++i) for (i = 0; i < numsegs; ++i)
{ {
seg_t *seg = &segs[i]; seg_t *seg = &segs[i];
INT32 polyID, parentID; INT32 poflags = POF_SOLID|POF_TESTHEIGHT|POF_RENDERSIDES;
INT32 parentID = 0, potrans = 0;
if (seg->linedef->special != POLYOBJ_START_LINE) if (seg->linedef->special != POLYOBJ_START_LINE)
continue; continue;
Polyobj_GetInfo(seg->linedef->tag, &polyID, &parentID, NULL); if (seg->linedef->tag != po->id)
continue;
// is it a START line with this polyobject's id? Polyobj_GetInfo(po->id, &poflags, &parentID, &potrans); // apply extra settings if they exist!
if (polyID == po->id)
{
po->flags = POF_SOLID|POF_TESTHEIGHT|POF_RENDERSIDES;
if (seg->linedef->flags & ML_EFFECT1) // save original flags and translucency to reference later for netgames!
po->flags |= POF_ONESIDE; po->spawnflags = po->flags = poflags;
po->spawntrans = po->translucency = potrans;
if (seg->linedef->flags & ML_EFFECT2) Polyobj_findSegs(po, seg);
po->flags &= ~POF_SOLID; po->parent = parentID;
if (po->parent == po->id) // do not allow a self-reference
if (seg->linedef->flags & ML_EFFECT3) po->parent = -1;
po->flags |= POF_PUSHABLESTOP; // TODO: sound sequence is in args[2]
break;
if (seg->linedef->flags & ML_EFFECT4)
po->flags |= POF_RENDERPLANES;
// TODO: Use a different linedef flag for this if we really need it!!
// This clashes with texture tiling, also done by Effect 5 flag
/*if (seg->linedef->flags & ML_EFFECT5)
po->flags &= ~POF_CLIPPLANES;*/
if (seg->linedef->flags & ML_NOCLIMB) // Has a linedef executor
po->flags |= POF_LDEXEC;
po->spawnflags = po->flags; // save original flags to reference later for netgames!
Polyobj_findSegs(po, seg);
po->parent = parentID;
if (po->parent == po->id) // do not allow a self-reference
po->parent = -1;
// TODO: sound sequence is in args[2]
break;
}
} }
CONS_Debug(DBG_POLYOBJ, "PO ID: %d; Num verts: %s\n", po->id, sizeu1(po->numVertices)); CONS_Debug(DBG_POLYOBJ, "PO ID: %d; Num verts: %s\n", po->id, sizeu1(po->numVertices));
@ -640,6 +636,7 @@ static void Polyobj_spawnPolyObj(INT32 num, mobj_t *spawnSpot, INT32 id)
if (po->isBad) if (po->isBad)
return; return;
/*
// 2. If no such line existed in the first step, look for a seg with the // 2. If no such line existed in the first step, look for a seg with the
// "explicit" special with tag matching this polyobject's id number. If // "explicit" special with tag matching this polyobject's id number. If
// found, continue to search for all such lines, storing them in a // found, continue to search for all such lines, storing them in a
@ -658,8 +655,16 @@ static void Polyobj_spawnPolyObj(INT32 num, mobj_t *spawnSpot, INT32 id)
if (po->parent == po->id) // do not allow a self-reference if (po->parent == po->id) // do not allow a self-reference
po->parent = -1; po->parent = -1;
// TODO: sound sequence is in args[3] // TODO: sound sequence is in args[3]
} }*/
// make sure array isn't empty
// since Polyobj_findExplicit is disabled currently, we have to do things here instead now!
if (po->segCount == 0)
{
po->isBad = true;
CONS_Debug(DBG_POLYOBJ, "Polyobject %d is empty\n", po->id);
return;
}
// set the polyobject's spawn spot // set the polyobject's spawn spot
po->spawnSpot.x = spawnSpot->x; po->spawnSpot.x = spawnSpot->x;
@ -1043,9 +1048,10 @@ static void Polyobj_carryThings(polyobj_t *po, fixed_t dx, fixed_t dy)
mo->lastlook = pomovecount; mo->lastlook = pomovecount;
// always push players even if not solid // Don't scroll objects that aren't affected by gravity
if (!((mo->flags & MF_SOLID) || mo->player)) if (mo->flags & MF_NOGRAVITY)
continue; continue;
// (The above check used to only move MF_SOLID objects, but that's inconsistent with conveyor behavior. -Red)
if (mo->flags & MF_NOCLIP) if (mo->flags & MF_NOCLIP)
continue; continue;
@ -1097,9 +1103,11 @@ static INT32 Polyobj_clipThings(polyobj_t *po, line_t *line)
for (; mo; mo = mo->bnext) for (; mo; mo = mo->bnext)
{ {
// always push players even if not solid
if (!((mo->flags & MF_SOLID) || mo->player)) // Don't scroll objects that aren't affected by gravity
if (mo->flags & MF_NOGRAVITY)
continue; continue;
// (The above check used to only move MF_SOLID objects, but that's inconsistent with conveyor behavior. -Red)
if (mo->flags & MF_NOCLIP) if (mo->flags & MF_NOCLIP)
continue; continue;
@ -1259,6 +1267,7 @@ static void Polyobj_rotateThings(polyobj_t *po, vertex_t origin, angle_t delta,
{ {
static INT32 pomovecount = 10000; static INT32 pomovecount = 10000;
INT32 x, y; INT32 x, y;
angle_t deltafine = delta >> ANGLETOFINESHIFT;
pomovecount++; pomovecount++;
@ -1283,9 +1292,10 @@ static void Polyobj_rotateThings(polyobj_t *po, vertex_t origin, angle_t delta,
mo->lastlook = pomovecount; mo->lastlook = pomovecount;
// always push players even if not solid // Don't scroll objects that aren't affected by gravity
if (!((mo->flags & MF_SOLID) || mo->player)) if (mo->flags & MF_NOGRAVITY)
continue; continue;
// (The above check used to only move MF_SOLID objects, but that's inconsistent with conveyor behavior. -Red)
if (mo->flags & MF_NOCLIP) if (mo->flags & MF_NOCLIP)
continue; continue;
@ -1300,21 +1310,28 @@ static void Polyobj_rotateThings(polyobj_t *po, vertex_t origin, angle_t delta,
continue; continue;
{ {
fixed_t newxoff, newyoff; fixed_t oldxoff, oldyoff, newxoff, newyoff;
angle_t angletoobj = R_PointToAngle2(origin.x, origin.y, mo->x, mo->y); fixed_t c, s;
fixed_t disttoobj = R_PointToDist2(origin.x, origin.y, mo->x, mo->y);
c = FINECOSINE(deltafine);
s = FINESINE(deltafine);
oldxoff = mo->x-origin.x;
oldyoff = mo->y-origin.y;
if (mo->player) // Hack to fix players sliding off of spinning polys -Red if (mo->player) // Hack to fix players sliding off of spinning polys -Red
{ {
disttoobj = FixedMul(disttoobj, 0xfe40); fixed_t temp;
temp = FixedMul(oldxoff, c)-FixedMul(oldyoff, s);
oldyoff = FixedMul(oldyoff, c)+FixedMul(oldxoff, s);
oldxoff = temp;
} }
angletoobj += delta; newxoff = FixedMul(oldxoff, c)-FixedMul(oldyoff, s);
angletoobj >>= ANGLETOFINESHIFT; newyoff = FixedMul(oldyoff, c)+FixedMul(oldxoff, s);
newxoff = FixedMul(FINECOSINE(angletoobj), disttoobj);
newyoff = FixedMul(FINESINE(angletoobj), disttoobj);
Polyobj_slideThing(mo, origin.x+newxoff-mo->x, origin.y+newyoff-mo->y); Polyobj_slideThing(mo, newxoff-oldxoff, newyoff-oldyoff);
if (turnthings == 2 || (turnthings == 1 && !mo->player)) { if (turnthings == 2 || (turnthings == 1 && !mo->player)) {
mo->angle += delta; mo->angle += delta;
@ -2491,6 +2508,10 @@ INT32 EV_DoPolyObjWaypoint(polywaypointdata_t *pwdata)
return 0; return 0;
} }
// Hotfix to not crash on single-waypoint sequences -Red
if (!last)
last = first;
// Set diffx, diffy, diffz // Set diffx, diffy, diffz
// Put these at 0 for now...might not be needed after all. // Put these at 0 for now...might not be needed after all.
th->diffx = 0;//first->x - po->centerPt.x; th->diffx = 0;//first->x - po->centerPt.x;

View File

@ -28,7 +28,7 @@
#define POLYOBJ_ANCHOR_DOOMEDNUM 760 #define POLYOBJ_ANCHOR_DOOMEDNUM 760
#define POLYOBJ_SPAWN_DOOMEDNUM 761 #define POLYOBJ_SPAWN_DOOMEDNUM 761
#define POLYOBJ_SPAWNCRUSH_DOOMEDNUM 762 #define POLYOBJ_SPAWNCRUSH_DOOMEDNUM 762 // todo: REMOVE
#define POLYOBJ_START_LINE 20 #define POLYOBJ_START_LINE 20
#define POLYOBJ_EXPLICIT_LINE 21 #define POLYOBJ_EXPLICIT_LINE 21
@ -100,8 +100,11 @@ typedef struct polyobj_s
UINT8 isBad; // a bad polyobject: should not be rendered/manipulated UINT8 isBad; // a bad polyobject: should not be rendered/manipulated
INT32 translucency; // index to translucency tables INT32 translucency; // index to translucency tables
struct visplane_s *visplane; // polyobject's visplane, for ease of putting into the list later
// these are saved for netgames, so do not let Lua touch these! // these are saved for netgames, so do not let Lua touch these!
INT32 spawnflags; // Flags the polyobject originally spawned with INT32 spawnflags; // Flags the polyobject originally spawned with
INT32 spawntrans; // Translucency the polyobject originally spawned with
} polyobj_t; } polyobj_t;
// //
@ -274,7 +277,7 @@ boolean P_PointInsidePolyobj(polyobj_t *po, fixed_t x, fixed_t y);
boolean P_MobjTouchingPolyobj(polyobj_t *po, mobj_t *mo); boolean P_MobjTouchingPolyobj(polyobj_t *po, mobj_t *mo);
boolean P_MobjInsidePolyobj(polyobj_t *po, mobj_t *mo); boolean P_MobjInsidePolyobj(polyobj_t *po, mobj_t *mo);
boolean P_BBoxInsidePolyobj(polyobj_t *po, fixed_t *bbox); boolean P_BBoxInsidePolyobj(polyobj_t *po, fixed_t *bbox);
void Polyobj_GetInfo(INT16 tag, INT32 *polyID, INT32 *parentID, UINT16 *exparg); void Polyobj_GetInfo(INT16 poid, INT32 *poflags, INT32 *parentID, INT32 *potrans);
// thinkers (needed in p_saveg.c) // thinkers (needed in p_saveg.c)
void T_PolyObjRotate(polyrotate_t *); void T_PolyObjRotate(polyrotate_t *);

View File

@ -30,6 +30,9 @@
#include "r_sky.h" #include "r_sky.h"
#include "p_polyobj.h" #include "p_polyobj.h"
#include "lua_script.h" #include "lua_script.h"
#ifdef ESLOPE
#include "p_slopes.h"
#endif
savedata_t savedata; savedata_t savedata;
UINT8 *save_p; UINT8 *save_p;
@ -921,7 +924,8 @@ typedef enum
MD2_EXTVAL1 = 1<<5, MD2_EXTVAL1 = 1<<5,
MD2_EXTVAL2 = 1<<6, MD2_EXTVAL2 = 1<<6,
MD2_HNEXT = 1<<7, MD2_HNEXT = 1<<7,
MD2_HPREV = 1<<8 MD2_HPREV = 1<<8,
MD2_SLOPE = 1<<9
} mobj_diff2_t; } mobj_diff2_t;
typedef enum typedef enum
@ -1052,6 +1056,8 @@ static void SaveMobjThinker(const thinker_t *th, const UINT8 type)
diff |= MD_TICS; diff |= MD_TICS;
if (mobj->sprite != mobj->state->sprite) if (mobj->sprite != mobj->state->sprite)
diff |= MD_SPRITE; diff |= MD_SPRITE;
if (mobj->sprite == SPR_PLAY && mobj->sprite2 != 0)
diff |= MD_SPRITE;
if (mobj->frame != mobj->state->frame) if (mobj->frame != mobj->state->frame)
diff |= MD_FRAME; diff |= MD_FRAME;
if (mobj->eflags) if (mobj->eflags)
@ -1109,6 +1115,8 @@ static void SaveMobjThinker(const thinker_t *th, const UINT8 type)
diff2 |= MD2_HNEXT; diff2 |= MD2_HNEXT;
if (mobj->hprev) if (mobj->hprev)
diff2 |= MD2_HPREV; diff2 |= MD2_HPREV;
if (mobj->standingslope)
diff2 |= MD2_SLOPE;
if (diff2 != 0) if (diff2 != 0)
diff |= MD_MORE; diff |= MD_MORE;
@ -1169,12 +1177,15 @@ static void SaveMobjThinker(const thinker_t *th, const UINT8 type)
WRITEUINT16(save_p, mobj->state-states); WRITEUINT16(save_p, mobj->state-states);
if (diff & MD_TICS) if (diff & MD_TICS)
WRITEINT32(save_p, mobj->tics); WRITEINT32(save_p, mobj->tics);
if (diff & MD_SPRITE) if (diff & MD_SPRITE) {
WRITEUINT16(save_p, mobj->sprite); WRITEUINT16(save_p, mobj->sprite);
if (mobj->sprite == SPR_PLAY)
WRITEUINT8(save_p, mobj->sprite2);
}
if (diff & MD_FRAME) if (diff & MD_FRAME)
WRITEUINT32(save_p, mobj->frame); WRITEUINT32(save_p, mobj->frame);
if (diff & MD_EFLAGS) if (diff & MD_EFLAGS)
WRITEUINT8(save_p, mobj->eflags); WRITEUINT16(save_p, mobj->eflags);
if (diff & MD_PLAYER) if (diff & MD_PLAYER)
WRITEUINT8(save_p, mobj->player-players); WRITEUINT8(save_p, mobj->player-players);
if (diff & MD_MOVEDIR) if (diff & MD_MOVEDIR)
@ -1221,6 +1232,8 @@ static void SaveMobjThinker(const thinker_t *th, const UINT8 type)
WRITEUINT32(save_p, mobj->hnext->mobjnum); WRITEUINT32(save_p, mobj->hnext->mobjnum);
if (diff2 & MD2_HPREV) if (diff2 & MD2_HPREV)
WRITEUINT32(save_p, mobj->hprev->mobjnum); WRITEUINT32(save_p, mobj->hprev->mobjnum);
if (diff2 & MD2_SLOPE)
WRITEUINT16(save_p, mobj->standingslope->id);
WRITEUINT32(save_p, mobj->mobjnum); WRITEUINT32(save_p, mobj->mobjnum);
} }
@ -1991,16 +2004,22 @@ static void LoadMobjThinker(actionf_p1 thinker)
mobj->tics = READINT32(save_p); mobj->tics = READINT32(save_p);
else else
mobj->tics = mobj->state->tics; mobj->tics = mobj->state->tics;
if (diff & MD_SPRITE) if (diff & MD_SPRITE) {
mobj->sprite = READUINT16(save_p); mobj->sprite = READUINT16(save_p);
else if (mobj->sprite == SPR_PLAY)
mobj->sprite2 = READUINT8(save_p);
}
else {
mobj->sprite = mobj->state->sprite; mobj->sprite = mobj->state->sprite;
if (mobj->sprite == SPR_PLAY)
mobj->sprite2 = mobj->state->frame&FF_FRAMEMASK;
}
if (diff & MD_FRAME) if (diff & MD_FRAME)
mobj->frame = READUINT32(save_p); mobj->frame = READUINT32(save_p);
else else
mobj->frame = mobj->state->frame; mobj->frame = mobj->state->frame;
if (diff & MD_EFLAGS) if (diff & MD_EFLAGS)
mobj->eflags = READUINT8(save_p); mobj->eflags = READUINT16(save_p);
if (diff & MD_PLAYER) if (diff & MD_PLAYER)
{ {
i = READUINT8(save_p); i = READUINT8(save_p);
@ -2068,6 +2087,9 @@ static void LoadMobjThinker(actionf_p1 thinker)
mobj->hnext = (mobj_t *)(size_t)READUINT32(save_p); mobj->hnext = (mobj_t *)(size_t)READUINT32(save_p);
if (diff2 & MD2_HPREV) if (diff2 & MD2_HPREV)
mobj->hprev = (mobj_t *)(size_t)READUINT32(save_p); mobj->hprev = (mobj_t *)(size_t)READUINT32(save_p);
if (diff2 & MD2_SLOPE)
mobj->standingslope = P_SlopeById(READUINT16(save_p));
if (diff & MD_REDFLAG) if (diff & MD_REDFLAG)
{ {
@ -2789,7 +2811,7 @@ static inline void P_ArchivePolyObj(polyobj_t *po)
if (po->flags != po->spawnflags) if (po->flags != po->spawnflags)
diff |= PD_FLAGS; diff |= PD_FLAGS;
if (po->translucency != 0) if (po->translucency != po->spawntrans)
diff |= PD_TRANS; diff |= PD_TRANS;
WRITEUINT8(save_p, diff); WRITEUINT8(save_p, diff);

View File

@ -72,6 +72,10 @@
#include "hardware/hw_light.h" #include "hardware/hw_light.h"
#endif #endif
#ifdef ESLOPE
#include "p_slopes.h"
#endif
// //
// Map MD5, calculated on level load. // Map MD5, calculated on level load.
// Sent to clients in PT_SERVERINFO. // Sent to clients in PT_SERVERINFO.
@ -846,7 +850,7 @@ void P_ScanThings(INT16 mapnum, INT16 wadnum, INT16 lumpnum)
// //
// P_LoadThings // P_LoadThings
// //
static void P_LoadThings(lumpnum_t lumpnum) static void P_PrepareThings(lumpnum_t lumpnum)
{ {
size_t i; size_t i;
mapthing_t *mt; mapthing_t *mt;
@ -884,13 +888,27 @@ static void P_LoadThings(lumpnum_t lumpnum)
} }
Z_Free(datastart); Z_Free(datastart);
}
static void P_LoadThings(void)
{
size_t i;
mapthing_t *mt;
// Loading the things lump itself into memory is now handled in P_PrepareThings, above
mt = mapthings; mt = mapthings;
numhuntemeralds = 0; numhuntemeralds = 0;
for (i = 0; i < nummapthings; i++, mt++) for (i = 0; i < nummapthings; i++, mt++)
{ {
sector_t *mtsector = R_PointInSubsector(mt->x << FRACBITS, mt->y << FRACBITS)->sector;
// Z for objects // Z for objects
mt->z = (INT16)(R_PointInSubsector(mt->x << FRACBITS, mt->y << FRACBITS) mt->z = (INT16)(
->sector->floorheight>>FRACBITS); #ifdef ESLOPE
mtsector->f_slope ? P_GetZAt(mtsector->f_slope, mt->x << FRACBITS, mt->y << FRACBITS) :
#endif
mtsector->floorheight)>>FRACBITS;
if (mt->type == 1700 // MT_AXIS if (mt->type == 1700 // MT_AXIS
|| mt->type == 1701 // MT_AXISTRANSFER || mt->type == 1701 // MT_AXISTRANSFER
@ -2114,7 +2132,8 @@ void P_LoadThingsOnly(void)
P_LevelInitStuff(); P_LevelInitStuff();
P_LoadThings(lastloadedmaplumpnum + ML_THINGS); P_PrepareThings(lastloadedmaplumpnum + ML_THINGS);
P_LoadThings();
P_SpawnSecretItems(true); P_SpawnSecretItems(true);
} }
@ -2531,7 +2550,13 @@ boolean P_SetupLevel(boolean skipprecip)
P_MapStart(); P_MapStart();
P_LoadThings(lastloadedmaplumpnum + ML_THINGS); P_PrepareThings(lastloadedmaplumpnum + ML_THINGS);
#ifdef ESLOPE
P_ResetDynamicSlopes();
#endif
P_LoadThings();
P_SpawnSecretItems(loademblems); P_SpawnSecretItems(loademblems);

1139
src/p_slopes.c Normal file

File diff suppressed because it is too large Load Diff

85
src/p_slopes.h Normal file
View File

@ -0,0 +1,85 @@
// Emacs style mode select -*- C++ -*-
//-----------------------------------------------------------------------------
//
// Copyright(C) 2004 Stephen McGranahan
//
// This program is free software; you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation; either version 2 of the License, or
// (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with this program; if not, write to the Free Software
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
//
//--------------------------------------------------------------------------
//
// DESCRIPTION:
// Slopes
// SoM created 05/10/09
//
//-----------------------------------------------------------------------------
#ifndef P_SLOPES_H__
#define P_SLOPES_H__
#ifdef ESLOPE
void P_CalculateSlopeNormal(pslope_t *slope);
void P_ReconfigureVertexSlope(pslope_t *slope);
void P_ResetDynamicSlopes(void);
void P_RunDynamicSlopes(void);
// P_SpawnSlope_Line
// Creates one or more slopes based on the given line type and front/back
// sectors.
void P_SpawnSlope_Line(int linenum);
pslope_t *P_NewVertexSlope(INT16 tag1, INT16 tag2, INT16 tag3, UINT8 flags);
#ifdef SPRINGCLEAN
// Loads just map objects that make slopes,
// terrain affecting objects have to be spawned first
void P_SetSlopesFromVertexHeights(lumpnum_t lumpnum);
typedef enum
{
THING_SlopeFloorPointLine = 9500,
THING_SlopeCeilingPointLine = 9501,
THING_SetFloorSlope = 9502,
THING_SetCeilingSlope = 9503,
THING_CopyFloorPlane = 9510,
THING_CopyCeilingPlane = 9511,
THING_VavoomFloor=1500,
THING_VavoomCeiling=1501,
THING_VertexFloorZ=1504,
THING_VertexCeilingZ=1505,
} slopething_e;
#endif
//
// P_CopySectorSlope
//
// Searches through tagged sectors and copies
//
void P_CopySectorSlope(line_t *line);
pslope_t *P_SlopeById(UINT16 id);
// Returns the height of the sloped plane at (x, y) as a fixed_t
fixed_t P_GetZAt(pslope_t *slope, fixed_t x, fixed_t y);
// Lots of physics-based bullshit
void P_QuantizeMomentumToSlope(vector3_t *momentum, pslope_t *slope);
void P_SlopeLaunch(mobj_t *mo);
void P_HandleSlopeLanding(mobj_t *thing, pslope_t *slope);
void P_ButteredSlope(mobj_t *mo);
#endif
// EOF
#endif // #ifdef ESLOPE

View File

@ -29,6 +29,7 @@
#include "r_main.h" //Two extra includes. #include "r_main.h" //Two extra includes.
#include "r_sky.h" #include "r_sky.h"
#include "p_polyobj.h" #include "p_polyobj.h"
#include "p_slopes.h"
#include "hu_stuff.h" #include "hu_stuff.h"
#include "m_misc.h" #include "m_misc.h"
#include "m_cond.h" //unlock triggers #include "m_cond.h" //unlock triggers
@ -1890,6 +1891,7 @@ boolean P_RunTriggerLinedef(line_t *triggerline, mobj_t *actor, sector_t *caller
|| specialtype == 304 // Ring count - Once || specialtype == 304 // Ring count - Once
|| specialtype == 307 // Character ability - Once || specialtype == 307 // Character ability - Once
|| specialtype == 308 // Race only - Once || specialtype == 308 // Race only - Once
|| specialtype == 313 // No More Enemies - Once
|| specialtype == 315 // No of pushables - Once || specialtype == 315 // No of pushables - Once
|| specialtype == 318 // Unlockable trigger - Once || specialtype == 318 // Unlockable trigger - Once
|| specialtype == 320 // Unlockable - Once || specialtype == 320 // Unlockable - Once
@ -3364,6 +3366,7 @@ sector_t *P_PlayerTouchingSectorSpecial(player_t *player, INT32 section, INT32 n
static boolean P_ThingIsOnThe3DFloor(mobj_t *mo, sector_t *sector, sector_t *targetsec) static boolean P_ThingIsOnThe3DFloor(mobj_t *mo, sector_t *sector, sector_t *targetsec)
{ {
ffloor_t *rover; ffloor_t *rover;
fixed_t top, bottom;
if (!mo->player) // should NEVER happen if (!mo->player) // should NEVER happen
return false; return false;
@ -3380,6 +3383,9 @@ static boolean P_ThingIsOnThe3DFloor(mobj_t *mo, sector_t *sector, sector_t *tar
//if (!(rover->flags & FF_EXISTS)) //if (!(rover->flags & FF_EXISTS))
// return false; // return false;
top = P_GetSpecialTopZ(mo, sector, targetsec);
bottom = P_GetSpecialBottomZ(mo, sector, targetsec);
// Check the 3D floor's type... // Check the 3D floor's type...
if (rover->flags & FF_BLOCKPLAYER) if (rover->flags & FF_BLOCKPLAYER)
{ {
@ -3387,27 +3393,27 @@ static boolean P_ThingIsOnThe3DFloor(mobj_t *mo, sector_t *sector, sector_t *tar
if ((rover->master->frontsector->flags & SF_FLIPSPECIAL_FLOOR) if ((rover->master->frontsector->flags & SF_FLIPSPECIAL_FLOOR)
&& !(rover->master->frontsector->flags & SF_FLIPSPECIAL_CEILING)) && !(rover->master->frontsector->flags & SF_FLIPSPECIAL_CEILING))
{ {
if ((mo->eflags & MFE_VERTICALFLIP) || mo->z != *rover->topheight) if ((mo->eflags & MFE_VERTICALFLIP) || mo->z != top)
return false; return false;
} }
else if ((rover->master->frontsector->flags & SF_FLIPSPECIAL_CEILING) else if ((rover->master->frontsector->flags & SF_FLIPSPECIAL_CEILING)
&& !(rover->master->frontsector->flags & SF_FLIPSPECIAL_FLOOR)) && !(rover->master->frontsector->flags & SF_FLIPSPECIAL_FLOOR))
{ {
if (!(mo->eflags & MFE_VERTICALFLIP) if (!(mo->eflags & MFE_VERTICALFLIP)
|| mo->z + mo->height != *rover->bottomheight) || mo->z + mo->height != bottom)
return false; return false;
} }
else if (rover->master->frontsector->flags & SF_FLIPSPECIAL_BOTH) else if (rover->master->frontsector->flags & SF_FLIPSPECIAL_BOTH)
{ {
if (!((mo->eflags & MFE_VERTICALFLIP && mo->z + mo->height == *rover->bottomheight) if (!((mo->eflags & MFE_VERTICALFLIP && mo->z + mo->height == bottom)
|| (!(mo->eflags & MFE_VERTICALFLIP) && mo->z == *rover->topheight))) || (!(mo->eflags & MFE_VERTICALFLIP) && mo->z == top)))
return false; return false;
} }
} }
else else
{ {
// Water and intangible FOFs // Water and intangible FOFs
if (mo->z > *rover->topheight || (mo->z + mo->height) < *rover->bottomheight) if (mo->z > top || (mo->z + mo->height) < bottom)
return false; return false;
} }
@ -3425,9 +3431,9 @@ static boolean P_ThingIsOnThe3DFloor(mobj_t *mo, sector_t *sector, sector_t *tar
static inline boolean P_MobjReadyToTrigger(mobj_t *mo, sector_t *sec) static inline boolean P_MobjReadyToTrigger(mobj_t *mo, sector_t *sec)
{ {
if (mo->eflags & MFE_VERTICALFLIP) if (mo->eflags & MFE_VERTICALFLIP)
return (mo->z+mo->height == sec->ceilingheight && sec->flags & SF_FLIPSPECIAL_CEILING); return (mo->z+mo->height == P_GetSpecialTopZ(mo, sec, sec) && sec->flags & SF_FLIPSPECIAL_CEILING);
else else
return (mo->z == sec->floorheight && sec->flags & SF_FLIPSPECIAL_FLOOR); return (mo->z == P_GetSpecialBottomZ(mo, sec, sec) && sec->flags & SF_FLIPSPECIAL_FLOOR);
} }
/** Applies a sector special to a player. /** Applies a sector special to a player.
@ -3471,19 +3477,19 @@ void P_ProcessSpecialSector(player_t *player, sector_t *sector, sector_t *rovers
{ {
case 1: // Damage (Generic) case 1: // Damage (Generic)
if (roversector || P_MobjReadyToTrigger(player->mo, sector)) if (roversector || P_MobjReadyToTrigger(player->mo, sector))
P_DamageMobj(player->mo, NULL, NULL, 1); P_DamageMobj(player->mo, NULL, NULL, 1, 0);
break; break;
case 2: // Damage (Water) case 2: // Damage (Water)
if ((roversector || P_MobjReadyToTrigger(player->mo, sector)) && (player->powers[pw_underwater] || player->pflags & PF_NIGHTSMODE) && (player->powers[pw_shield] & SH_NOSTACK) != SH_ELEMENTAL) if ((roversector || P_MobjReadyToTrigger(player->mo, sector)) && (player->powers[pw_underwater] || player->pflags & PF_NIGHTSMODE))
P_DamageMobj(player->mo, NULL, NULL, 1); P_DamageMobj(player->mo, NULL, NULL, 1, DMG_WATER);
break; break;
case 3: // Damage (Fire) case 3: // Damage (Fire)
if ((roversector || P_MobjReadyToTrigger(player->mo, sector)) && (player->powers[pw_shield] & SH_NOSTACK) != SH_ELEMENTAL) if (roversector || P_MobjReadyToTrigger(player->mo, sector))
P_DamageMobj(player->mo, NULL, NULL, 1); P_DamageMobj(player->mo, NULL, NULL, 1, DMG_FIRE);
break; break;
case 4: // Damage (Electrical) case 4: // Damage (Electrical)
if ((roversector || P_MobjReadyToTrigger(player->mo, sector)) && (player->powers[pw_shield] & SH_NOSTACK) != SH_ATTRACT) if (roversector || P_MobjReadyToTrigger(player->mo, sector))
P_DamageMobj(player->mo, NULL, NULL, 1); P_DamageMobj(player->mo, NULL, NULL, 1, DMG_ELECTRIC);
break; break;
case 5: // Spikes case 5: // Spikes
// Don't do anything. In Soviet Russia, spikes find you. // Don't do anything. In Soviet Russia, spikes find you.
@ -3491,10 +3497,10 @@ void P_ProcessSpecialSector(player_t *player, sector_t *sector, sector_t *rovers
case 6: // Death Pit (Camera Mod) case 6: // Death Pit (Camera Mod)
case 7: // Death Pit (No Camera Mod) case 7: // Death Pit (No Camera Mod)
if (roversector || P_MobjReadyToTrigger(player->mo, sector)) if (roversector || P_MobjReadyToTrigger(player->mo, sector))
P_DamageMobj(player->mo, NULL, NULL, 10000); P_DamageMobj(player->mo, NULL, NULL, 1, DMG_DEATHPIT);
break; break;
case 8: // Instant Kill case 8: // Instant Kill
P_DamageMobj(player->mo, NULL, NULL, 10000); P_DamageMobj(player->mo, NULL, NULL, 1, DMG_INSTAKILL);
break; break;
case 9: // Ring Drainer (Floor Touch) case 9: // Ring Drainer (Floor Touch)
case 10: // Ring Drainer (No Floor Touch) case 10: // Ring Drainer (No Floor Touch)
@ -3598,7 +3604,7 @@ void P_ProcessSpecialSector(player_t *player, sector_t *sector, sector_t *rovers
mo2 = (mobj_t *)th; mo2 = (mobj_t *)th;
if (mo2->type == MT_EGGTRAP) if (mo2->type == MT_EGGTRAP)
P_KillMobj(mo2, NULL, player->mo); P_KillMobj(mo2, NULL, player->mo, 0);
} }
// clear the special so you can't push the button twice. // clear the special so you can't push the button twice.
@ -3684,7 +3690,7 @@ DoneSection2:
if (!(player->pflags & PF_SPINNING)) if (!(player->pflags & PF_SPINNING))
player->pflags |= PF_SPINNING; player->pflags |= PF_SPINNING;
P_SetPlayerMobjState(player->mo, S_PLAY_ATK1); P_SetPlayerMobjState(player->mo, S_PLAY_SPIN);
} }
player->powers[pw_flashing] = TICRATE/3; player->powers[pw_flashing] = TICRATE/3;
@ -3826,7 +3832,7 @@ DoneSection2:
P_ResetPlayer(player); P_ResetPlayer(player);
if (player->panim != PA_FALL) if (player->panim != PA_FALL)
P_SetPlayerMobjState(player->mo, S_PLAY_FALL1); P_SetPlayerMobjState(player->mo, S_PLAY_FALL);
break; break;
case 6: // Super Sonic transformer case 6: // Super Sonic transformer
@ -3838,7 +3844,7 @@ DoneSection2:
if (!(player->pflags & PF_SPINNING) && P_IsObjectOnGround(player->mo) && (player->charability2 == CA2_SPINDASH)) if (!(player->pflags & PF_SPINNING) && P_IsObjectOnGround(player->mo) && (player->charability2 == CA2_SPINDASH))
{ {
player->pflags |= PF_SPINNING; player->pflags |= PF_SPINNING;
P_SetPlayerMobjState(player->mo, S_PLAY_ATK1); P_SetPlayerMobjState(player->mo, S_PLAY_SPIN);
S_StartAttackSound(player->mo, sfx_spin); S_StartAttackSound(player->mo, sfx_spin);
if (abs(player->rmomx) < FixedMul(5*FRACUNIT, player->mo->scale) if (abs(player->rmomx) < FixedMul(5*FRACUNIT, player->mo->scale)
@ -3912,9 +3918,9 @@ DoneSection2:
player->pflags &= ~PF_GLIDING; player->pflags &= ~PF_GLIDING;
player->climbing = 0; player->climbing = 0;
if (!(player->mo->state >= &states[S_PLAY_ATK1] && player->mo->state <= &states[S_PLAY_ATK4])) if (player->mo->state-states != S_PLAY_SPIN)
{ {
P_SetPlayerMobjState(player->mo, S_PLAY_ATK1); P_SetPlayerMobjState(player->mo, S_PLAY_SPIN);
S_StartSound(player->mo, sfx_spin); S_StartSound(player->mo, sfx_spin);
} }
} }
@ -3984,9 +3990,9 @@ DoneSection2:
player->pflags |= PF_SPINNING; player->pflags |= PF_SPINNING;
player->pflags &= ~PF_JUMPED; player->pflags &= ~PF_JUMPED;
if (!(player->mo->state >= &states[S_PLAY_ATK1] && player->mo->state <= &states[S_PLAY_ATK4])) if (player->mo->state-states != S_PLAY_SPIN)
{ {
P_SetPlayerMobjState(player->mo, S_PLAY_ATK1); P_SetPlayerMobjState(player->mo, S_PLAY_SPIN);
S_StartSound(player->mo, sfx_spin); S_StartSound(player->mo, sfx_spin);
} }
} }
@ -4289,7 +4295,7 @@ DoneSection2:
player->pflags &= ~PF_SLIDING; player->pflags &= ~PF_SLIDING;
player->climbing = 0; player->climbing = 0;
P_SetThingPosition(player->mo); P_SetThingPosition(player->mo);
P_SetPlayerMobjState(player->mo, S_PLAY_CARRY); P_SetPlayerMobjState(player->mo, S_PLAY_RIDE);
} }
break; break;
case 12: // Camera noclip case 12: // Camera noclip
@ -4388,27 +4394,27 @@ static void P_PlayerOnSpecial3DFloor(player_t *player, sector_t *sector)
if ((rover->master->frontsector->flags & SF_FLIPSPECIAL_FLOOR) if ((rover->master->frontsector->flags & SF_FLIPSPECIAL_FLOOR)
&& !(rover->master->frontsector->flags & SF_FLIPSPECIAL_CEILING)) && !(rover->master->frontsector->flags & SF_FLIPSPECIAL_CEILING))
{ {
if ((player->mo->eflags & MFE_VERTICALFLIP) || player->mo->z != *rover->topheight) if ((player->mo->eflags & MFE_VERTICALFLIP) || player->mo->z != P_GetSpecialTopZ(player->mo, sectors + rover->secnum, sector))
continue; continue;
} }
else if ((rover->master->frontsector->flags & SF_FLIPSPECIAL_CEILING) else if ((rover->master->frontsector->flags & SF_FLIPSPECIAL_CEILING)
&& !(rover->master->frontsector->flags & SF_FLIPSPECIAL_FLOOR)) && !(rover->master->frontsector->flags & SF_FLIPSPECIAL_FLOOR))
{ {
if (!(player->mo->eflags & MFE_VERTICALFLIP) if (!(player->mo->eflags & MFE_VERTICALFLIP)
|| player->mo->z + player->mo->height != *rover->bottomheight) || player->mo->z + player->mo->height != P_GetSpecialBottomZ(player->mo, sectors + rover->secnum, sector))
continue; continue;
} }
else if (rover->master->frontsector->flags & SF_FLIPSPECIAL_BOTH) else if (rover->master->frontsector->flags & SF_FLIPSPECIAL_BOTH)
{ {
if (!((player->mo->eflags & MFE_VERTICALFLIP && player->mo->z + player->mo->height == *rover->bottomheight) if (!((player->mo->eflags & MFE_VERTICALFLIP && player->mo->z + player->mo->height == P_GetSpecialBottomZ(player->mo, sectors + rover->secnum, sector))
|| (!(player->mo->eflags & MFE_VERTICALFLIP) && player->mo->z == *rover->topheight))) || (!(player->mo->eflags & MFE_VERTICALFLIP) && player->mo->z == P_GetSpecialTopZ(player->mo, sectors + rover->secnum, sector))))
continue; continue;
} }
} }
else else
{ {
// Water and DEATH FOG!!! heh // Water and DEATH FOG!!! heh
if (player->mo->z > *rover->topheight || (player->mo->z + player->mo->height) < *rover->bottomheight) if (player->mo->z > P_GetSpecialTopZ(player->mo, sectors + rover->secnum, sector) || (player->mo->z + player->mo->height) < P_GetSpecialBottomZ(player->mo, sectors + rover->secnum, sector))
continue; continue;
} }
@ -4518,6 +4524,7 @@ static void P_PlayerOnSpecial3DFloor(player_t *player, sector_t *sector)
static void P_RunSpecialSectorCheck(player_t *player, sector_t *sector) static void P_RunSpecialSectorCheck(player_t *player, sector_t *sector)
{ {
boolean nofloorneeded = false; boolean nofloorneeded = false;
fixed_t f_affectpoint, c_affectpoint;
if (!sector->special) // nothing special, exit if (!sector->special) // nothing special, exit
return; return;
@ -4580,16 +4587,19 @@ static void P_RunSpecialSectorCheck(player_t *player, sector_t *sector)
return; return;
} }
f_affectpoint = P_GetSpecialBottomZ(player->mo, sector, sector);
c_affectpoint = P_GetSpecialTopZ(player->mo, sector, sector);
// Only go further if on the ground // Only go further if on the ground
if ((sector->flags & SF_FLIPSPECIAL_FLOOR) && !(sector->flags & SF_FLIPSPECIAL_CEILING) && player->mo->z != sector->floorheight) if ((sector->flags & SF_FLIPSPECIAL_FLOOR) && !(sector->flags & SF_FLIPSPECIAL_CEILING) && player->mo->z != f_affectpoint)
return; return;
if ((sector->flags & SF_FLIPSPECIAL_CEILING) && !(sector->flags & SF_FLIPSPECIAL_FLOOR) && player->mo->z + player->mo->height != sector->ceilingheight) if ((sector->flags & SF_FLIPSPECIAL_CEILING) && !(sector->flags & SF_FLIPSPECIAL_FLOOR) && player->mo->z + player->mo->height != c_affectpoint)
return; return;
if ((sector->flags & SF_FLIPSPECIAL_BOTH) if ((sector->flags & SF_FLIPSPECIAL_BOTH)
&& player->mo->z != sector->floorheight && player->mo->z != f_affectpoint
&& player->mo->z + player->mo->height != sector->ceilingheight) && player->mo->z + player->mo->height != c_affectpoint)
return; return;
P_ProcessSpecialSector(player, sector, NULL); P_ProcessSpecialSector(player, sector, NULL);
@ -4750,6 +4760,9 @@ void P_UpdateSpecials(void)
// POINT LIMIT // POINT LIMIT
P_CheckPointLimit(); P_CheckPointLimit();
// Dynamic slopeness
P_RunDynamicSlopes();
// ANIMATE TEXTURES // ANIMATE TEXTURES
for (anim = anims; anim < lastanim; anim++) for (anim = anims; anim < lastanim; anim++)
{ {
@ -4893,6 +4906,12 @@ static ffloor_t *P_AddFakeFloor(sector_t *sec, sector_t *sec2, line_t *master, f
ffloor->topyoffs = &sec2->ceiling_yoffs; ffloor->topyoffs = &sec2->ceiling_yoffs;
ffloor->topangle = &sec2->ceilingpic_angle; ffloor->topangle = &sec2->ceilingpic_angle;
#ifdef ESLOPE
// Add slopes
ffloor->t_slope = &sec2->c_slope;
ffloor->b_slope = &sec2->f_slope;
#endif
if ((flags & FF_SOLID) && (master->flags & ML_EFFECT1)) // Block player only if ((flags & FF_SOLID) && (master->flags & ML_EFFECT1)) // Block player only
flags &= ~FF_BLOCKOTHERS; flags &= ~FF_BLOCKOTHERS;
@ -5326,6 +5345,7 @@ void T_LaserFlash(laserthink_t *flash)
sector_t *sourcesec; sector_t *sourcesec;
ffloor_t *ffloor = flash->ffloor; ffloor_t *ffloor = flash->ffloor;
sector_t *sector = flash->sector; sector_t *sector = flash->sector;
fixed_t top, bottom;
if (!ffloor || !(ffloor->flags & FF_EXISTS)) if (!ffloor || !(ffloor->flags & FF_EXISTS))
return; return;
@ -5349,14 +5369,17 @@ void T_LaserFlash(laserthink_t *flash)
&& thing->flags & MF_BOSS) && thing->flags & MF_BOSS)
continue; // Don't hurt bosses continue; // Don't hurt bosses
if (thing->z >= sourcesec->ceilingheight top = P_GetSpecialTopZ(thing, sourcesec, sector);
|| thing->z + thing->height <= sourcesec->floorheight) bottom = P_GetSpecialBottomZ(thing, sourcesec, sector);
if (thing->z >= top
|| thing->z + thing->height <= bottom)
continue; continue;
if (thing->flags & MF_SHOOTABLE) if (thing->flags & MF_SHOOTABLE)
P_DamageMobj(thing, NULL, NULL, 1); P_DamageMobj(thing, NULL, NULL, 1, 0);
else if (thing->type == MT_EGGSHIELD) else if (thing->type == MT_EGGSHIELD)
P_KillMobj(thing, NULL, NULL); P_KillMobj(thing, NULL, NULL, 0);
} }
} }
@ -6429,6 +6452,14 @@ void P_SpawnSpecials(INT32 fromnetsave)
sectors[s].midmap = lines[i].frontsector->midmap; sectors[s].midmap = lines[i].frontsector->midmap;
break; break;
#ifdef ESLOPE // Slope copy specials. Handled here for sanity.
case 720:
case 721:
case 722:
P_CopySectorSlope(&lines[i]);
break;
#endif
default: default:
break; break;
} }
@ -6526,7 +6557,7 @@ static void P_DoScrollMove(mobj_t *thing, fixed_t dx, fixed_t dy, INT32 exclusiv
thing->momy += dy; thing->momy += dy;
if (exclusive) if (exclusive)
thing->flags2 |= MF2_PUSHED; thing->eflags |= MFE_PUSHED;
} }
/** Processes an active scroller. /** Processes an active scroller.
@ -6630,9 +6661,11 @@ void T_Scroll(scroll_t *s)
{ {
thing = node->m_thing; thing = node->m_thing;
if (thing->flags2 & MF2_PUSHED) // Already pushed this tic by an exclusive pusher. if (thing->eflags & MFE_PUSHED) // Already pushed this tic by an exclusive pusher.
continue; continue;
height = P_GetSpecialBottomZ(thing, sec, psec);
if (!(thing->flags & MF_NOCLIP)) // Thing must be clipped if (!(thing->flags & MF_NOCLIP)) // Thing must be clipped
if (!(thing->flags & MF_NOGRAVITY || thing->z+thing->height != height)) // Thing must a) be non-floating and have z+height == height if (!(thing->flags & MF_NOGRAVITY || thing->z+thing->height != height)) // Thing must a) be non-floating and have z+height == height
{ {
@ -6650,9 +6683,11 @@ void T_Scroll(scroll_t *s)
{ {
thing = node->m_thing; thing = node->m_thing;
if (thing->flags2 & MF2_PUSHED) if (thing->eflags & MFE_PUSHED)
continue; continue;
height = P_GetSpecialBottomZ(thing, sec, sec);
if (!(thing->flags & MF_NOCLIP) && if (!(thing->flags & MF_NOCLIP) &&
(!(thing->flags & MF_NOGRAVITY || thing->z > height))) (!(thing->flags & MF_NOGRAVITY || thing->z > height)))
{ {
@ -6689,9 +6724,11 @@ void T_Scroll(scroll_t *s)
{ {
thing = node->m_thing; thing = node->m_thing;
if (thing->flags2 & MF2_PUSHED) if (thing->eflags & MFE_PUSHED)
continue; continue;
height = P_GetSpecialTopZ(thing, sec, psec);
if (!(thing->flags & MF_NOCLIP)) // Thing must be clipped if (!(thing->flags & MF_NOCLIP)) // Thing must be clipped
if (!(thing->flags & MF_NOGRAVITY || thing->z != height))// Thing must a) be non-floating and have z == height if (!(thing->flags & MF_NOGRAVITY || thing->z != height))// Thing must a) be non-floating and have z == height
{ {
@ -6709,9 +6746,11 @@ void T_Scroll(scroll_t *s)
{ {
thing = node->m_thing; thing = node->m_thing;
if (thing->flags2 & MF2_PUSHED) if (thing->eflags & MFE_PUSHED)
continue; continue;
height = P_GetSpecialTopZ(thing, sec, sec);
if (!(thing->flags & MF_NOCLIP) && if (!(thing->flags & MF_NOCLIP) &&
(!(thing->flags & MF_NOGRAVITY || thing->z+thing->height < height))) (!(thing->flags & MF_NOGRAVITY || thing->z+thing->height < height)))
{ {
@ -7005,7 +7044,7 @@ static void Add_Friction(INT32 friction, INT32 movefactor, INT32 affectee, INT32
*/ */
void T_Friction(friction_t *f) void T_Friction(friction_t *f)
{ {
sector_t *sec; sector_t *sec, *referrer = NULL;
mobj_t *thing; mobj_t *thing;
msecnode_t *node; msecnode_t *node;
@ -7014,7 +7053,7 @@ void T_Friction(friction_t *f)
// Make sure the sector type hasn't changed // Make sure the sector type hasn't changed
if (f->roverfriction) if (f->roverfriction)
{ {
sector_t *referrer = sectors + f->referrer; referrer = sectors + f->referrer;
if (!(GETSECSPECIAL(referrer->special, 3) == 1 if (!(GETSECSPECIAL(referrer->special, 3) == 1
|| GETSECSPECIAL(referrer->special, 3) == 3)) || GETSECSPECIAL(referrer->special, 3) == 3))
@ -7046,9 +7085,7 @@ void T_Friction(friction_t *f)
{ {
if (f->roverfriction) if (f->roverfriction)
{ {
sector_t *referrer = &sectors[f->referrer]; if (thing->floorz != P_GetSpecialTopZ(thing, referrer, sec))
if (thing->floorz != referrer->ceilingheight)
{ {
node = node->m_snext; node = node->m_snext;
continue; continue;
@ -7061,7 +7098,7 @@ void T_Friction(friction_t *f)
thing->movefactor = f->movefactor; thing->movefactor = f->movefactor;
} }
} }
else if (sec->floorheight == thing->floorz && (thing->friction == ORIG_FRICTION // normal friction? else if (P_GetSpecialBottomZ(thing, sec, sec) == thing->floorz && (thing->friction == ORIG_FRICTION // normal friction?
|| f->friction < thing->friction)) || f->friction < thing->friction))
{ {
thing->friction = f->friction; thing->friction = f->friction;
@ -7192,7 +7229,7 @@ static pusher_t *tmpusher; // pusher structure for blockmap searches
*/ */
static inline boolean PIT_PushThing(mobj_t *thing) static inline boolean PIT_PushThing(mobj_t *thing)
{ {
if (thing->flags2 & MF2_PUSHED) if (thing->eflags & MFE_PUSHED)
return false; return false;
if (thing->player && thing->player->pflags & PF_ROPEHANG) if (thing->player && thing->player->pflags & PF_ROPEHANG)
@ -7322,7 +7359,7 @@ static inline boolean PIT_PushThing(mobj_t *thing)
} }
if (tmpusher->exclusive) if (tmpusher->exclusive)
thing->flags2 |= MF2_PUSHED; thing->eflags |= MFE_PUSHED;
return true; return true;
} }
@ -7335,7 +7372,7 @@ static inline boolean PIT_PushThing(mobj_t *thing)
*/ */
void T_Pusher(pusher_t *p) void T_Pusher(pusher_t *p)
{ {
sector_t *sec; sector_t *sec, *referrer = NULL;
mobj_t *thing; mobj_t *thing;
msecnode_t *node; msecnode_t *node;
INT32 xspeed = 0,yspeed = 0; INT32 xspeed = 0,yspeed = 0;
@ -7344,7 +7381,6 @@ void T_Pusher(pusher_t *p)
//INT32 ht = 0; //INT32 ht = 0;
boolean inFOF; boolean inFOF;
boolean touching; boolean touching;
boolean foundfloor = false;
boolean moved; boolean moved;
xspeed = yspeed = 0; xspeed = yspeed = 0;
@ -7356,19 +7392,16 @@ void T_Pusher(pusher_t *p)
if (p->roverpusher) if (p->roverpusher)
{ {
sector_t *referrer = &sectors[p->referrer]; referrer = &sectors[p->referrer];
if (GETSECSPECIAL(referrer->special, 3) == 2 if (!(GETSECSPECIAL(referrer->special, 3) == 2
|| GETSECSPECIAL(referrer->special, 3) == 3) || GETSECSPECIAL(referrer->special, 3) == 3))
foundfloor = true; return;
} }
else if (!(GETSECSPECIAL(sec->special, 3) == 2 else if (!(GETSECSPECIAL(sec->special, 3) == 2
|| GETSECSPECIAL(sec->special, 3) == 3)) || GETSECSPECIAL(sec->special, 3) == 3))
return; return;
if (p->roverpusher && foundfloor == false) // Not even a 3d floor has the PUSH_MASK.
return;
// For constant pushers (wind/current) there are 3 situations: // For constant pushers (wind/current) there are 3 situations:
// //
// 1) Affected Thing is above the floor. // 1) Affected Thing is above the floor.
@ -7429,7 +7462,7 @@ void T_Pusher(pusher_t *p)
|| thing->type == MT_BIGTUMBLEWEED)) || thing->type == MT_BIGTUMBLEWEED))
continue; continue;
if (thing->flags2 & MF2_PUSHED) if (thing->eflags & MFE_PUSHED)
continue; continue;
if (thing->player && thing->player->pflags & PF_ROPEHANG) if (thing->player && thing->player->pflags & PF_ROPEHANG)
@ -7443,41 +7476,38 @@ void T_Pusher(pusher_t *p)
// Find the area that the 'thing' is in // Find the area that the 'thing' is in
if (p->roverpusher) if (p->roverpusher)
{ {
sector_t *referrer = &sectors[p->referrer]; fixed_t top, bottom;
INT32 special;
special = GETSECSPECIAL(referrer->special, 3); top = P_GetSpecialTopZ(thing, referrer, sec);
bottom = P_GetSpecialBottomZ(thing, referrer, sec);
if (!(special == 2 || special == 3))
return;
if (thing->eflags & MFE_VERTICALFLIP) if (thing->eflags & MFE_VERTICALFLIP)
{ {
if (referrer->floorheight > thing->z + thing->height if (bottom > thing->z + thing->height
|| referrer->ceilingheight < (thing->z + (thing->height >> 1))) || top < (thing->z + (thing->height >> 1)))
continue; continue;
if (thing->z < referrer->floorheight) if (thing->z < bottom)
touching = true; touching = true;
if (thing->z + (thing->height >> 1) > referrer->floorheight) if (thing->z + (thing->height >> 1) > bottom)
inFOF = true; inFOF = true;
} }
else else
{ {
if (referrer->ceilingheight < thing->z || referrer->floorheight > (thing->z + (thing->height >> 1))) if (top < thing->z || referrer->floorheight > (thing->z + (thing->height >> 1)))
continue; continue;
if (thing->z + thing->height > referrer->ceilingheight) if (thing->z + thing->height > top)
touching = true; touching = true;
if (thing->z + (thing->height >> 1) < referrer->ceilingheight) if (thing->z + (thing->height >> 1) < top)
inFOF = true; inFOF = true;
} }
} }
else // Treat the entire sector as one big FOF else // Treat the entire sector as one big FOF
{ {
if (thing->z == thing->subsector->sector->floorheight) if (thing->z == P_GetSpecialBottomZ(thing, sec, sec))
touching = true; touching = true;
else if (p->type != p_current) else if (p->type != p_current)
inFOF = true; inFOF = true;
@ -7599,7 +7629,7 @@ void T_Pusher(pusher_t *p)
} }
if (p->exclusive) if (p->exclusive)
thing->flags2 |= MF2_PUSHED; thing->eflags |= MFE_PUSHED;
} }
} }
} }

View File

@ -662,7 +662,7 @@ void P_Ticker(boolean run)
if (!players[i].mo) if (!players[i].mo)
continue; continue;
P_DamageMobj(players[i].mo, NULL, NULL, 10000); P_DamageMobj(players[i].mo, NULL, NULL, 1, DMG_INSTAKILL);
} }
} }

File diff suppressed because it is too large Load Diff

View File

@ -18,6 +18,7 @@
#include "r_splats.h" #include "r_splats.h"
#include "p_local.h" // camera #include "p_local.h" // camera
#include "p_slopes.h"
#include "z_zone.h" // Check R_Prep3DFloors #include "z_zone.h" // Check R_Prep3DFloors
seg_t *curline; seg_t *curline;
@ -459,6 +460,11 @@ static void R_AddLine(seg_t *line)
doorclosed = 0; doorclosed = 0;
// Closed door. // Closed door.
#ifdef ESLOPE
// Just don't bother checking this if one side is sloped. This is probably inefficient, but it's better than
// random renderer stopping around slopes...
if (!(frontsector->f_slope || frontsector->c_slope || backsector->f_slope || backsector->c_slope))
#endif
if (backsector->ceilingheight <= frontsector->floorheight if (backsector->ceilingheight <= frontsector->floorheight
|| backsector->floorheight >= frontsector->ceilingheight) || backsector->floorheight >= frontsector->ceilingheight)
{ {
@ -487,6 +493,10 @@ static void R_AddLine(seg_t *line)
#endif #endif
backsector->ceilingpic == frontsector->ceilingpic backsector->ceilingpic == frontsector->ceilingpic
&& backsector->floorpic == frontsector->floorpic && backsector->floorpic == frontsector->floorpic
#ifdef ESLOPE
&& backsector->f_slope == frontsector->f_slope
&& backsector->c_slope == frontsector->c_slope
#endif
&& backsector->lightlevel == frontsector->lightlevel && backsector->lightlevel == frontsector->lightlevel
&& !curline->sidedef->midtexture && !curline->sidedef->midtexture
// Check offsets too! // Check offsets too!
@ -842,11 +852,19 @@ static void R_Subsector(size_t num)
sub->sector->moved = frontsector->moved = false; sub->sector->moved = frontsector->moved = false;
} }
light = R_GetPlaneLight(frontsector, frontsector->floorheight, false); light = R_GetPlaneLight(frontsector,
#ifdef ESLOPE
frontsector->f_slope ? P_GetZAt(frontsector->f_slope, frontsector->soundorg.x, frontsector->soundorg.y) :
#endif
frontsector->floorheight, false);
if (frontsector->floorlightsec == -1) if (frontsector->floorlightsec == -1)
floorlightlevel = *frontsector->lightlist[light].lightlevel; floorlightlevel = *frontsector->lightlist[light].lightlevel;
floorcolormap = frontsector->lightlist[light].extra_colormap; floorcolormap = frontsector->lightlist[light].extra_colormap;
light = R_GetPlaneLight(frontsector, frontsector->ceilingheight, false); light = R_GetPlaneLight(frontsector,
#ifdef ESLOPE
frontsector->c_slope ? P_GetZAt(frontsector->c_slope, frontsector->soundorg.x, frontsector->soundorg.y) :
#endif
frontsector->ceilingheight, false);
if (frontsector->ceilinglightsec == -1) if (frontsector->ceilinglightsec == -1)
ceilinglightlevel = *frontsector->lightlist[light].lightlevel; ceilinglightlevel = *frontsector->lightlist[light].lightlevel;
ceilingcolormap = frontsector->lightlist[light].extra_colormap; ceilingcolormap = frontsector->lightlist[light].extra_colormap;
@ -854,32 +872,52 @@ static void R_Subsector(size_t num)
sub->sector->extra_colormap = frontsector->extra_colormap; sub->sector->extra_colormap = frontsector->extra_colormap;
if ((frontsector->floorheight < viewz || (frontsector->heightsec != -1 if (((
#ifdef ESLOPE
frontsector->f_slope ? P_GetZAt(frontsector->f_slope, viewx, viewy) :
#endif
frontsector->floorheight) < viewz || (frontsector->heightsec != -1
&& sectors[frontsector->heightsec].ceilingpic == skyflatnum))) && sectors[frontsector->heightsec].ceilingpic == skyflatnum)))
{ {
floorplane = R_FindPlane(frontsector->floorheight, frontsector->floorpic, floorlightlevel, floorplane = R_FindPlane(frontsector->floorheight, frontsector->floorpic, floorlightlevel,
frontsector->floor_xoffs, frontsector->floor_yoffs, frontsector->floorpic_angle, floorcolormap, NULL); frontsector->floor_xoffs, frontsector->floor_yoffs, frontsector->floorpic_angle, floorcolormap, NULL
#ifdef ESLOPE
, frontsector->f_slope
#endif
);
} }
else else
floorplane = NULL; floorplane = NULL;
if ((frontsector->ceilingheight > viewz || frontsector->ceilingpic == skyflatnum if (((
#ifdef ESLOPE
frontsector->c_slope ? P_GetZAt(frontsector->c_slope, viewx, viewy) :
#endif
frontsector->ceilingheight) > viewz || frontsector->ceilingpic == skyflatnum
|| (frontsector->heightsec != -1 || (frontsector->heightsec != -1
&& sectors[frontsector->heightsec].floorpic == skyflatnum))) && sectors[frontsector->heightsec].floorpic == skyflatnum)))
{ {
ceilingplane = R_FindPlane(frontsector->ceilingheight, frontsector->ceilingpic, ceilingplane = R_FindPlane(frontsector->ceilingheight, frontsector->ceilingpic,
ceilinglightlevel, frontsector->ceiling_xoffs, frontsector->ceiling_yoffs, frontsector->ceilingpic_angle, ceilinglightlevel, frontsector->ceiling_xoffs, frontsector->ceiling_yoffs, frontsector->ceilingpic_angle,
ceilingcolormap, NULL); ceilingcolormap, NULL
#ifdef ESLOPE
, frontsector->c_slope
#endif
);
} }
else else
ceilingplane = NULL; ceilingplane = NULL;
numffloors = 0; numffloors = 0;
#ifdef ESLOPE
ffloor[numffloors].slope = NULL;
#endif
ffloor[numffloors].plane = NULL; ffloor[numffloors].plane = NULL;
ffloor[numffloors].polyobj = NULL; ffloor[numffloors].polyobj = NULL;
if (frontsector->ffloors) if (frontsector->ffloors)
{ {
ffloor_t *rover; ffloor_t *rover;
fixed_t heightcheck, planecenterz, floorcenterz, ceilingcenterz;
for (rover = frontsector->ffloors; rover && numffloors < MAXFFLOORS; rover = rover->next) for (rover = frontsector->ffloors; rover && numffloors < MAXFFLOORS; rover = rover->next)
{ {
@ -897,18 +935,60 @@ static void R_Subsector(size_t num)
ffloor[numffloors].plane = NULL; ffloor[numffloors].plane = NULL;
ffloor[numffloors].polyobj = NULL; ffloor[numffloors].polyobj = NULL;
if (*rover->bottomheight <= frontsector->ceilingheight
&& *rover->bottomheight >= frontsector->floorheight floorcenterz =
&& ((viewz < *rover->bottomheight && !(rover->flags & FF_INVERTPLANES)) #ifdef ESLOPE
|| (viewz > *rover->bottomheight && (rover->flags & FF_BOTHPLANES)))) frontsector->f_slope ? P_GetZAt(frontsector->f_slope, frontsector->soundorg.x, frontsector->soundorg.y) :
#endif
frontsector->floorheight;
ceilingcenterz =
#ifdef ESLOPE
frontsector->c_slope ? P_GetZAt(frontsector->c_slope, frontsector->soundorg.x, frontsector->soundorg.y) :
#endif
frontsector->ceilingheight;
heightcheck =
#ifdef ESLOPE
*rover->b_slope ? P_GetZAt(*rover->b_slope, viewx, viewy) :
#endif
*rover->bottomheight;
planecenterz =
#ifdef ESLOPE
*rover->b_slope ? P_GetZAt(*rover->b_slope, frontsector->soundorg.x, frontsector->soundorg.y) :
#endif
*rover->bottomheight;
if (planecenterz <= ceilingcenterz
&& planecenterz >= floorcenterz
&& ((viewz < heightcheck && !(rover->flags & FF_INVERTPLANES))
|| (viewz > heightcheck && (rover->flags & FF_BOTHPLANES))))
{ {
light = R_GetPlaneLight(frontsector, *rover->bottomheight, light = R_GetPlaneLight(frontsector, planecenterz,
viewz < *rover->bottomheight); viewz < *rover->bottomheight);
ffloor[numffloors].plane = R_FindPlane(*rover->bottomheight, *rover->bottompic, ffloor[numffloors].plane = R_FindPlane(*rover->bottomheight, *rover->bottompic,
*frontsector->lightlist[light].lightlevel, *rover->bottomxoffs, *frontsector->lightlist[light].lightlevel, *rover->bottomxoffs,
*rover->bottomyoffs, *rover->bottomangle, frontsector->lightlist[light].extra_colormap, rover); *rover->bottomyoffs, *rover->bottomangle, frontsector->lightlist[light].extra_colormap, rover
#ifdef ESLOPE
, *rover->b_slope
#endif
);
#ifdef ESLOPE
ffloor[numffloors].slope = *rover->b_slope;
// Tell the renderer this sector has slopes in it.
if (ffloor[numffloors].slope)
frontsector->hasslope = true;
#endif
ffloor[numffloors].height =
#ifdef ESLOPE
*rover->b_slope ? P_GetZAt(*rover->b_slope, viewx, viewy) :
#endif
*rover->bottomheight;
ffloor[numffloors].height = *rover->bottomheight;
ffloor[numffloors].ffloor = rover; ffloor[numffloors].ffloor = rover;
numffloors++; numffloors++;
} }
@ -916,16 +996,47 @@ static void R_Subsector(size_t num)
break; break;
ffloor[numffloors].plane = NULL; ffloor[numffloors].plane = NULL;
ffloor[numffloors].polyobj = NULL; ffloor[numffloors].polyobj = NULL;
if (*rover->topheight >= frontsector->floorheight
&& *rover->topheight <= frontsector->ceilingheight heightcheck =
&& ((viewz > *rover->topheight && !(rover->flags & FF_INVERTPLANES)) #ifdef ESLOPE
|| (viewz < *rover->topheight && (rover->flags & FF_BOTHPLANES)))) *rover->t_slope ? P_GetZAt(*rover->t_slope, viewx, viewy) :
#endif
*rover->topheight;
planecenterz =
#ifdef ESLOPE
*rover->t_slope ? P_GetZAt(*rover->t_slope, frontsector->soundorg.x, frontsector->soundorg.y) :
#endif
*rover->topheight;
if (planecenterz >= floorcenterz
&& planecenterz <= ceilingcenterz
&& ((viewz > heightcheck && !(rover->flags & FF_INVERTPLANES))
|| (viewz < heightcheck && (rover->flags & FF_BOTHPLANES))))
{ {
light = R_GetPlaneLight(frontsector, *rover->topheight, viewz < *rover->topheight); light = R_GetPlaneLight(frontsector, planecenterz, viewz < *rover->topheight);
ffloor[numffloors].plane = R_FindPlane(*rover->topheight, *rover->toppic, ffloor[numffloors].plane = R_FindPlane(*rover->topheight, *rover->toppic,
*frontsector->lightlist[light].lightlevel, *rover->topxoffs, *rover->topyoffs, *rover->topangle, *frontsector->lightlist[light].lightlevel, *rover->topxoffs, *rover->topyoffs, *rover->topangle,
frontsector->lightlist[light].extra_colormap, rover); frontsector->lightlist[light].extra_colormap, rover
ffloor[numffloors].height = *rover->topheight; #ifdef ESLOPE
, *rover->t_slope
#endif
);
#ifdef ESLOPE
ffloor[numffloors].slope = *rover->t_slope;
// Tell the renderer this sector has slopes in it.
if (ffloor[numffloors].slope)
frontsector->hasslope = true;
#endif
ffloor[numffloors].height =
#ifdef ESLOPE
*rover->t_slope ? P_GetZAt(*rover->t_slope, viewx, viewy) :
#endif
*rover->topheight;
ffloor[numffloors].ffloor = rover; ffloor[numffloors].ffloor = rover;
numffloors++; numffloors++;
} }
@ -977,12 +1088,20 @@ static void R_Subsector(size_t num)
polysec->lightlevel, xoff, yoff, polysec->lightlevel, xoff, yoff,
polysec->floorpic_angle-po->angle, polysec->floorpic_angle-po->angle,
NULL, NULL,
NULL); NULL
ffloor[numffloors].plane->polyobj = po; #ifdef ESLOPE
, NULL // will ffloors be slopable eventually?
#endif
);
//ffloor[numffloors].plane->polyobj = po;
ffloor[numffloors].height = polysec->floorheight; ffloor[numffloors].height = polysec->floorheight;
ffloor[numffloors].polyobj = po; ffloor[numffloors].polyobj = po;
#ifdef ESLOPE
ffloor[numffloors].slope = NULL;
#endif
// ffloor[numffloors].ffloor = rover; // ffloor[numffloors].ffloor = rover;
po->visplane = ffloor[numffloors].plane;
numffloors++; numffloors++;
} }
@ -1013,12 +1132,20 @@ static void R_Subsector(size_t num)
light = 0; light = 0;
ffloor[numffloors].plane = R_FindPlane(polysec->ceilingheight, polysec->ceilingpic, ffloor[numffloors].plane = R_FindPlane(polysec->ceilingheight, polysec->ceilingpic,
polysec->lightlevel, xoff, yoff, polysec->ceilingpic_angle-po->angle, polysec->lightlevel, xoff, yoff, polysec->ceilingpic_angle-po->angle,
NULL, NULL); NULL, NULL
ffloor[numffloors].plane->polyobj = po; #ifdef ESLOPE
, NULL // will ffloors be slopable eventually?
#endif
);
//ffloor[numffloors].plane->polyobj = po;
ffloor[numffloors].polyobj = po; ffloor[numffloors].polyobj = po;
ffloor[numffloors].height = polysec->ceilingheight; ffloor[numffloors].height = polysec->ceilingheight;
#ifdef ESLOPE
ffloor[numffloors].slope = NULL;
#endif
// ffloor[numffloors].ffloor = rover; // ffloor[numffloors].ffloor = rover;
po->visplane = ffloor[numffloors].plane;
numffloors++; numffloors++;
} }
@ -1075,6 +1202,11 @@ void R_Prep3DFloors(sector_t *sector)
fixed_t bestheight, maxheight; fixed_t bestheight, maxheight;
INT32 count, i, mapnum; INT32 count, i, mapnum;
sector_t *sec; sector_t *sec;
#ifdef ESLOPE
pslope_t *bestslope;
fixed_t heighttest; // I think it's better to check the Z height at the sector's center
// than assume unsloped heights are accurate indicators of order in sloped sectors. -Red
#endif
count = 1; count = 1;
for (rover = sector->ffloors; rover; rover = rover->next) for (rover = sector->ffloors; rover; rover = rover->next)
@ -1097,7 +1229,14 @@ void R_Prep3DFloors(sector_t *sector)
else else
memset(sector->lightlist, 0, sizeof (lightlist_t) * count); memset(sector->lightlist, 0, sizeof (lightlist_t) * count);
#ifdef ESLOPE
heighttest = sector->c_slope ? P_GetZAt(sector->c_slope, sector->soundorg.x, sector->soundorg.y) : sector->ceilingheight;
sector->lightlist[0].height = heighttest + 1;
sector->lightlist[0].slope = sector->c_slope;
#else
sector->lightlist[0].height = sector->ceilingheight + 1; sector->lightlist[0].height = sector->ceilingheight + 1;
#endif
sector->lightlist[0].lightlevel = &sector->lightlevel; sector->lightlist[0].lightlevel = &sector->lightlevel;
sector->lightlist[0].caster = NULL; sector->lightlist[0].caster = NULL;
sector->lightlist[0].extra_colormap = sector->extra_colormap; sector->lightlist[0].extra_colormap = sector->extra_colormap;
@ -1115,6 +1254,29 @@ void R_Prep3DFloors(sector_t *sector)
&& !(rover->flags & FF_CUTLEVEL) && !(rover->flags & FF_CUTSPRITES))) && !(rover->flags & FF_CUTLEVEL) && !(rover->flags & FF_CUTSPRITES)))
continue; continue;
#ifdef ESLOPE
heighttest = *rover->t_slope ? P_GetZAt(*rover->t_slope, sector->soundorg.x, sector->soundorg.y) : *rover->topheight;
if (heighttest > bestheight && heighttest < maxheight)
{
best = rover;
bestheight = heighttest;
bestslope = *rover->t_slope;
continue;
}
if (rover->flags & FF_DOUBLESHADOW) {
heighttest = *rover->b_slope ? P_GetZAt(*rover->b_slope, sector->soundorg.x, sector->soundorg.y) : *rover->bottomheight;
if (heighttest > bestheight
&& heighttest < maxheight)
{
best = rover;
bestheight = heighttest;
bestslope = *rover->b_slope;
continue;
}
}
#else
if (*rover->topheight > bestheight && *rover->topheight < maxheight) if (*rover->topheight > bestheight && *rover->topheight < maxheight)
{ {
best = rover; best = rover;
@ -1128,6 +1290,7 @@ void R_Prep3DFloors(sector_t *sector)
bestheight = *rover->bottomheight; bestheight = *rover->bottomheight;
continue; continue;
} }
#endif
} }
if (!best) if (!best)
{ {
@ -1138,6 +1301,9 @@ void R_Prep3DFloors(sector_t *sector)
sector->lightlist[i].height = maxheight = bestheight; sector->lightlist[i].height = maxheight = bestheight;
sector->lightlist[i].caster = best; sector->lightlist[i].caster = best;
sector->lightlist[i].flags = best->flags; sector->lightlist[i].flags = best->flags;
#ifdef ESLOPE
sector->lightlist[i].slope = bestslope;
#endif
sec = &sectors[best->secnum]; sec = &sectors[best->secnum];
mapnum = sec->midmap; mapnum = sec->midmap;
if (mapnum >= 0 && (size_t)mapnum < num_extra_colormaps) if (mapnum >= 0 && (size_t)mapnum < num_extra_colormaps)
@ -1163,7 +1329,12 @@ void R_Prep3DFloors(sector_t *sector)
if (best->flags & FF_DOUBLESHADOW) if (best->flags & FF_DOUBLESHADOW)
{ {
#ifdef ESLOPE
heighttest = *best->b_slope ? P_GetZAt(*best->b_slope, sector->soundorg.x, sector->soundorg.y) : *best->bottomheight;
if (bestheight == heighttest) ///TODO: do this in a more efficient way -Red
#else
if (bestheight == *best->bottomheight) if (bestheight == *best->bottomheight)
#endif
{ {
sector->lightlist[i].lightlevel = sector->lightlist[best->lastlight].lightlevel; sector->lightlist[i].lightlevel = sector->lightlist[best->lastlight].lightlevel;
sector->lightlist[i].extra_colormap = sector->lightlist[i].extra_colormap =

View File

@ -155,6 +155,12 @@ typedef struct ffloor_s
fixed_t *bottomyoffs; fixed_t *bottomyoffs;
angle_t *bottomangle; angle_t *bottomangle;
#ifdef ESLOPE
// Pointers to pointers. Yup.
struct pslope_s **t_slope;
struct pslope_s **b_slope;
#endif
size_t secnum; size_t secnum;
ffloortype_e flags; ffloortype_e flags;
struct line_s *master; struct line_s *master;
@ -184,6 +190,9 @@ typedef struct lightlist_s
extracolormap_t *extra_colormap; extracolormap_t *extra_colormap;
INT32 flags; INT32 flags;
ffloor_t *caster; ffloor_t *caster;
#ifdef ESLOPE
struct pslope_s *slope; // FF_DOUBLESHADOW makes me have to store this pointer here. Bluh bluh.
#endif
} lightlist_t; } lightlist_t;
@ -224,6 +233,52 @@ typedef struct secplane_t
fixed_t a, b, c, d, ic; fixed_t a, b, c, d, ic;
} secplane_t; } secplane_t;
// Slopes
#ifdef ESLOPE
typedef enum {
SL_NOPHYSICS = 1, // Don't do momentum adjustment with this slope
SL_NODYNAMIC = 1<<1, // Slope will never need to move during the level, so don't fuss with recalculating it
SL_ANCHORVERTEX = 1<<2, // Slope is using a Slope Vertex Thing to anchor its position
SL_VERTEXSLOPE = 1<<3, // Slope is built from three Slope Vertex Things
} slopeflags_t;
typedef struct pslope_s
{
UINT16 id; // The number of the slope, mostly used for netgame syncing purposes
// --- Information used in clipping/projection ---
// Origin vector for the plane
vector3_t o;
// 2-Dimentional vector (x, y) normalized. Used to determine distance from
// the origin in 2d mapspace. (Basically a thrust of FRACUNIT in xydirection angle)
vector2_t d;
// The rate at which z changes based on distance from the origin plane.
fixed_t zdelta;
// The normal of the slope; will always point upward, and thus be inverted on ceilings. I think it's only needed for physics? -Red
vector3_t normal;
// For comparing when a slope should be rendered
fixed_t lowz;
fixed_t highz;
// This values only check and must be updated if the slope itself is modified
angle_t zangle; // Angle of the plane going up from the ground (not mesured in degrees)
angle_t xydirection; // The direction the slope is facing (north, west, south, etc.)
struct line_s *sourceline; // The line that generated the slope
fixed_t extent; // Distance value used for recalculating zdelta
UINT8 refpos; // 1=front floor 2=front ceiling 3=back floor 4=back ceiling (used for dynamic sloping)
UINT8 flags; // Slope options
mapthing_t **vertices; // List should be three long for slopes made by vertex things, or one long for slopes using one vertex thing to anchor
struct pslope_s *next; // Make a linked list of dynamic slopes, for easy reference later
} pslope_t;
#endif
typedef enum typedef enum
{ {
SF_FLIPSPECIAL_FLOOR = 1, SF_FLIPSPECIAL_FLOOR = 1,
@ -337,6 +392,13 @@ typedef struct sector_s
precipmobj_t *preciplist; precipmobj_t *preciplist;
struct mprecipsecnode_s *touching_preciplist; struct mprecipsecnode_s *touching_preciplist;
#ifdef ESLOPE
// Eternity engine slope
pslope_t *f_slope; // floor slope
pslope_t *c_slope; // ceiling slope
boolean hasslope; // The sector, or one of its visible FOFs, contains a slope
#endif
// these are saved for netgames, so do not let Lua touch these! // these are saved for netgames, so do not let Lua touch these!
// offsets sector spawned with (via linedef type 7) // offsets sector spawned with (via linedef type 7)
@ -612,6 +674,12 @@ typedef struct drawseg_s
INT16 *thicksidecol; INT16 *thicksidecol;
INT32 numthicksides; INT32 numthicksides;
fixed_t frontscale[MAXVIDWIDTH]; fixed_t frontscale[MAXVIDWIDTH];
#ifdef ESLOPE
fixed_t maskedtextureheight[MAXVIDWIDTH]; // For handling sloped midtextures
vertex_t leftpos, rightpos; // Used for rendering FOF walls with slopes
#endif
} drawseg_t; } drawseg_t;
typedef enum typedef enum

View File

@ -103,6 +103,12 @@ fixed_t ds_xfrac, ds_yfrac, ds_xstep, ds_ystep;
UINT8 *ds_source; // start of a 64*64 tile image UINT8 *ds_source; // start of a 64*64 tile image
UINT8 *ds_transmap; // one of the translucency tables UINT8 *ds_transmap; // one of the translucency tables
#ifdef ESLOPE
pslope_t *ds_slope; // Current slope being used
floatv3_t ds_su, ds_sv, ds_sz; // Vectors for... stuff?
float focallengthf, zeroheight;
#endif
/** \brief Variable flat sizes /** \brief Variable flat sizes
*/ */

View File

@ -60,6 +60,16 @@ extern fixed_t ds_xfrac, ds_yfrac, ds_xstep, ds_ystep;
extern UINT8 *ds_source; // start of a 64*64 tile image extern UINT8 *ds_source; // start of a 64*64 tile image
extern UINT8 *ds_transmap; extern UINT8 *ds_transmap;
#ifdef ESLOPE
typedef struct {
float x, y, z;
} floatv3_t;
extern pslope_t *ds_slope; // Current slope being used
extern floatv3_t ds_su, ds_sv, ds_sz; // Vectors for... stuff?
extern float focallengthf, zeroheight;
#endif
// Variable flat sizes // Variable flat sizes
extern UINT32 nflatxshift; extern UINT32 nflatxshift;
extern UINT32 nflatyshift; extern UINT32 nflatyshift;
@ -141,6 +151,12 @@ void ASMCALL R_DrawSpan_8_MMX(void);
void R_DrawTranslatedColumn_8(void); void R_DrawTranslatedColumn_8(void);
void R_DrawTranslatedTranslucentColumn_8(void); void R_DrawTranslatedTranslucentColumn_8(void);
void R_DrawSpan_8(void); void R_DrawSpan_8(void);
#ifdef ESLOPE
void R_CalcTiltedLighting(fixed_t start, fixed_t end);
void R_DrawTiltedSpan_8(void);
void R_DrawTiltedTranslucentSpan_8(void);
void R_DrawTiltedSplat_8(void);
#endif
void R_DrawSplat_8(void); void R_DrawSplat_8(void);
void R_DrawTranslucentSplat_8(void); void R_DrawTranslucentSplat_8(void);
void R_DrawTranslucentSpan_8(void); void R_DrawTranslucentSpan_8(void);

View File

@ -526,6 +526,447 @@ void R_DrawSpan_8 (void)
} }
} }
#ifdef ESLOPE
// R_CalcTiltedLighting
// Exactly what it says on the tin. I wish I wasn't too lazy to explain things properly.
static INT32 tiltlighting[MAXVIDWIDTH];
void R_CalcTiltedLighting(fixed_t start, fixed_t end)
{
// ZDoom uses a different lighting setup to us, and I couldn't figure out how to adapt their version
// of this function. Here's my own.
INT32 left = ds_x1, right = ds_x2;
fixed_t step = (end-start)/(ds_x2-ds_x1+1);
INT32 i;
// I wanna do some optimizing by checking for out-of-range segments on either side to fill in all at once,
// but I'm too bad at coding to not crash the game trying to do that. I guess this is fast enough for now...
for (i = left; i <= right; i++) {
tiltlighting[i] = (start += step) >> FRACBITS;
if (tiltlighting[i] < 0)
tiltlighting[i] = 0;
else if (tiltlighting[i] >= MAXLIGHTSCALE)
tiltlighting[i] = MAXLIGHTSCALE-1;
}
}
/** \brief The R_DrawTiltedSpan_8 function
Draw slopes! Holy sheit!
*/
void R_DrawTiltedSpan_8(void)
{
// x1, x2 = ds_x1, ds_x2
int width = ds_x2 - ds_x1;
double iz, uz, vz;
UINT32 u, v;
int i;
UINT8 *source;
UINT8 *colormap;
UINT8 *dest;
double startz, startu, startv;
double izstep, uzstep, vzstep;
double endz, endu, endv;
UINT32 stepu, stepv;
iz = ds_sz.z + ds_sz.y*(centery-ds_y) + ds_sz.x*(ds_x1-centerx);
// Lighting is simple. It's just linear interpolation from start to end
{
float planelightfloat = BASEVIDWIDTH*BASEVIDWIDTH/vid.width / (zeroheight - FIXED_TO_FLOAT(viewz)) / 21.0f;
float lightstart, lightend;
lightend = (iz + ds_sz.x*width) * planelightfloat;
lightstart = iz * planelightfloat;
R_CalcTiltedLighting(FLOAT_TO_FIXED(lightstart), FLOAT_TO_FIXED(lightend));
//CONS_Printf("tilted lighting %f to %f (foc %f)\n", lightstart, lightend, focallengthf);
}
uz = ds_su.z + ds_su.y*(centery-ds_y) + ds_su.x*(ds_x1-centerx);
vz = ds_sv.z + ds_sv.y*(centery-ds_y) + ds_sv.x*(ds_x1-centerx);
dest = ylookup[ds_y] + columnofs[ds_x1];
source = ds_source;
//colormap = ds_colormap;
#if 0 // The "perfect" reference version of this routine. Pretty slow.
// Use it only to see how things are supposed to look.
i = 0;
do
{
double z = 1.f/iz;
u = (INT64)(uz*z) + viewx;
v = (INT64)(vz*z) + viewy;
colormap = planezlight[tiltlighting[ds_x1++]] + (ds_colormap - colormaps);
*dest = colormap[source[((v >> nflatyshift) & nflatmask) | (u >> nflatxshift)]];
dest++;
iz += ds_sz.x;
uz += ds_su.x;
vz += ds_sv.x;
} while (--width >= 0);
#else
#define SPANSIZE 16
#define INVSPAN 0.0625f
startz = 1.f/iz;
startu = uz*startz;
startv = vz*startz;
izstep = ds_sz.x * SPANSIZE;
uzstep = ds_su.x * SPANSIZE;
vzstep = ds_sv.x * SPANSIZE;
//x1 = 0;
width++;
while (width >= SPANSIZE)
{
iz += izstep;
uz += uzstep;
vz += vzstep;
endz = 1.f/iz;
endu = uz*endz;
endv = vz*endz;
stepu = (INT64)((endu - startu) * INVSPAN);
stepv = (INT64)((endv - startv) * INVSPAN);
u = (INT64)(startu) + viewx;
v = (INT64)(startv) + viewy;
for (i = SPANSIZE-1; i >= 0; i--)
{
colormap = planezlight[tiltlighting[ds_x1++]] + (ds_colormap - colormaps);
*dest = colormap[source[((v >> nflatyshift) & nflatmask) | (u >> nflatxshift)]];
dest++;
u += stepu;
v += stepv;
}
startu = endu;
startv = endv;
width -= SPANSIZE;
}
if (width > 0)
{
if (width == 1)
{
u = (INT64)(startu);
v = (INT64)(startv);
colormap = planezlight[tiltlighting[ds_x1++]] + (ds_colormap - colormaps);
*dest = colormap[source[((v >> nflatyshift) & nflatmask) | (u >> nflatxshift)]];
}
else
{
double left = width;
iz += ds_sz.x * left;
uz += ds_su.x * left;
vz += ds_sv.x * left;
endz = 1.f/iz;
endu = uz*endz;
endv = vz*endz;
left = 1.f/left;
stepu = (INT64)((endu - startu) * left);
stepv = (INT64)((endv - startv) * left);
u = (INT64)(startu) + viewx;
v = (INT64)(startv) + viewy;
for (; width != 0; width--)
{
colormap = planezlight[tiltlighting[ds_x1++]] + (ds_colormap - colormaps);
*dest = colormap[source[((v >> nflatyshift) & nflatmask) | (u >> nflatxshift)]];
dest++;
u += stepu;
v += stepv;
}
}
}
#endif
}
/** \brief The R_DrawTiltedTranslucentSpan_8 function
Like DrawTiltedSpan, but translucent
*/
void R_DrawTiltedTranslucentSpan_8(void)
{
// x1, x2 = ds_x1, ds_x2
int width = ds_x2 - ds_x1;
double iz, uz, vz;
UINT32 u, v;
int i;
UINT8 *source;
UINT8 *colormap;
UINT8 *dest;
double startz, startu, startv;
double izstep, uzstep, vzstep;
double endz, endu, endv;
UINT32 stepu, stepv;
iz = ds_sz.z + ds_sz.y*(centery-ds_y) + ds_sz.x*(ds_x1-centerx);
// Lighting is simple. It's just linear interpolation from start to end
{
float planelightfloat = BASEVIDWIDTH*BASEVIDWIDTH/vid.width / (zeroheight - FIXED_TO_FLOAT(viewz)) / 21.0f;
float lightstart, lightend;
lightend = (iz + ds_sz.x*width) * planelightfloat;
lightstart = iz * planelightfloat;
R_CalcTiltedLighting(FLOAT_TO_FIXED(lightstart), FLOAT_TO_FIXED(lightend));
//CONS_Printf("tilted lighting %f to %f (foc %f)\n", lightstart, lightend, focallengthf);
}
uz = ds_su.z + ds_su.y*(centery-ds_y) + ds_su.x*(ds_x1-centerx);
vz = ds_sv.z + ds_sv.y*(centery-ds_y) + ds_sv.x*(ds_x1-centerx);
dest = ylookup[ds_y] + columnofs[ds_x1];
source = ds_source;
//colormap = ds_colormap;
#if 0 // The "perfect" reference version of this routine. Pretty slow.
// Use it only to see how things are supposed to look.
i = 0;
do
{
double z = 1.f/iz;
u = (INT64)(uz*z) + viewx;
v = (INT64)(vz*z) + viewy;
colormap = planezlight[tiltlighting[ds_x1++]] + (ds_colormap - colormaps);
*dest = colormap[*(ds_transmap + (source[((v >> nflatyshift) & nflatmask) | (u >> nflatxshift)] << 8) + dest[0])];
dest++;
iz += ds_sz.x;
uz += ds_su.x;
vz += ds_sv.x;
} while (--width >= 0);
#else
#define SPANSIZE 16
#define INVSPAN 0.0625f
startz = 1.f/iz;
startu = uz*startz;
startv = vz*startz;
izstep = ds_sz.x * SPANSIZE;
uzstep = ds_su.x * SPANSIZE;
vzstep = ds_sv.x * SPANSIZE;
//x1 = 0;
width++;
while (width >= SPANSIZE)
{
iz += izstep;
uz += uzstep;
vz += vzstep;
endz = 1.f/iz;
endu = uz*endz;
endv = vz*endz;
stepu = (INT64)((endu - startu) * INVSPAN);
stepv = (INT64)((endv - startv) * INVSPAN);
u = (INT64)(startu) + viewx;
v = (INT64)(startv) + viewy;
for (i = SPANSIZE-1; i >= 0; i--)
{
colormap = planezlight[tiltlighting[ds_x1++]] + (ds_colormap - colormaps);
*dest = colormap[*(ds_transmap + (source[((v >> nflatyshift) & nflatmask) | (u >> nflatxshift)] << 8) + dest[0])];
dest++;
u += stepu;
v += stepv;
}
startu = endu;
startv = endv;
width -= SPANSIZE;
}
if (width > 0)
{
if (width == 1)
{
u = (INT64)(startu);
v = (INT64)(startv);
colormap = planezlight[tiltlighting[ds_x1++]] + (ds_colormap - colormaps);
*dest = colormap[*(ds_transmap + (source[((v >> nflatyshift) & nflatmask) | (u >> nflatxshift)] << 8) + dest[0])];
}
else
{
double left = width;
iz += ds_sz.x * left;
uz += ds_su.x * left;
vz += ds_sv.x * left;
endz = 1.f/iz;
endu = uz*endz;
endv = vz*endz;
left = 1.f/left;
stepu = (INT64)((endu - startu) * left);
stepv = (INT64)((endv - startv) * left);
u = (INT64)(startu) + viewx;
v = (INT64)(startv) + viewy;
for (; width != 0; width--)
{
colormap = planezlight[tiltlighting[ds_x1++]] + (ds_colormap - colormaps);
*dest = colormap[*(ds_transmap + (source[((v >> nflatyshift) & nflatmask) | (u >> nflatxshift)] << 8) + dest[0])];
dest++;
u += stepu;
v += stepv;
}
}
}
#endif
}
void R_DrawTiltedSplat_8(void)
{
// x1, x2 = ds_x1, ds_x2
int width = ds_x2 - ds_x1;
double iz, uz, vz;
UINT32 u, v;
int i;
UINT8 *source;
UINT8 *colormap;
UINT8 *dest;
UINT8 val;
double startz, startu, startv;
double izstep, uzstep, vzstep;
double endz, endu, endv;
UINT32 stepu, stepv;
iz = ds_sz.z + ds_sz.y*(centery-ds_y) + ds_sz.x*(ds_x1-centerx);
// Lighting is simple. It's just linear interpolation from start to end
{
float planelightfloat = BASEVIDWIDTH*BASEVIDWIDTH/vid.width / (zeroheight - FIXED_TO_FLOAT(viewz)) / 21.0f;
float lightstart, lightend;
lightend = (iz + ds_sz.x*width) * planelightfloat;
lightstart = iz * planelightfloat;
R_CalcTiltedLighting(FLOAT_TO_FIXED(lightstart), FLOAT_TO_FIXED(lightend));
//CONS_Printf("tilted lighting %f to %f (foc %f)\n", lightstart, lightend, focallengthf);
}
uz = ds_su.z + ds_su.y*(centery-ds_y) + ds_su.x*(ds_x1-centerx);
vz = ds_sv.z + ds_sv.y*(centery-ds_y) + ds_sv.x*(ds_x1-centerx);
dest = ylookup[ds_y] + columnofs[ds_x1];
source = ds_source;
//colormap = ds_colormap;
#if 0 // The "perfect" reference version of this routine. Pretty slow.
// Use it only to see how things are supposed to look.
i = 0;
do
{
double z = 1.f/iz;
u = (INT64)(uz*z) + viewx;
v = (INT64)(vz*z) + viewy;
colormap = planezlight[tiltlighting[ds_x1++]] + (ds_colormap - colormaps);
val = colormap[source[((v >> nflatyshift) & nflatmask) | (u >> nflatxshift)]];
if (val != TRANSPARENTPIXEL)
*dest = val;
dest++;
iz += ds_sz.x;
uz += ds_su.x;
vz += ds_sv.x;
} while (--width >= 0);
#else
#define SPANSIZE 16
#define INVSPAN 0.0625f
startz = 1.f/iz;
startu = uz*startz;
startv = vz*startz;
izstep = ds_sz.x * SPANSIZE;
uzstep = ds_su.x * SPANSIZE;
vzstep = ds_sv.x * SPANSIZE;
//x1 = 0;
width++;
while (width >= SPANSIZE)
{
iz += izstep;
uz += uzstep;
vz += vzstep;
endz = 1.f/iz;
endu = uz*endz;
endv = vz*endz;
stepu = (INT64)((endu - startu) * INVSPAN);
stepv = (INT64)((endv - startv) * INVSPAN);
u = (INT64)(startu) + viewx;
v = (INT64)(startv) + viewy;
for (i = SPANSIZE-1; i >= 0; i--)
{
colormap = planezlight[tiltlighting[ds_x1++]] + (ds_colormap - colormaps);
val = colormap[source[((v >> nflatyshift) & nflatmask) | (u >> nflatxshift)]];
if (val != TRANSPARENTPIXEL)
*dest = val;
dest++;
u += stepu;
v += stepv;
}
startu = endu;
startv = endv;
width -= SPANSIZE;
}
if (width > 0)
{
if (width == 1)
{
u = (INT64)(startu);
v = (INT64)(startv);
colormap = planezlight[tiltlighting[ds_x1++]] + (ds_colormap - colormaps);
val = colormap[source[((v >> nflatyshift) & nflatmask) | (u >> nflatxshift)]];
if (val != TRANSPARENTPIXEL)
*dest = val;
}
else
{
double left = width;
iz += ds_sz.x * left;
uz += ds_su.x * left;
vz += ds_sv.x * left;
endz = 1.f/iz;
endu = uz*endz;
endv = vz*endz;
left = 1.f/left;
stepu = (INT64)((endu - startu) * left);
stepv = (INT64)((endv - startv) * left);
u = (INT64)(startu) + viewx;
v = (INT64)(startv) + viewy;
for (; width != 0; width--)
{
colormap = planezlight[tiltlighting[ds_x1++]] + (ds_colormap - colormaps);
val = colormap[source[((v >> nflatyshift) & nflatmask) | (u >> nflatxshift)]];
if (val != TRANSPARENTPIXEL)
*dest = val;
dest++;
u += stepu;
v += stepv;
}
}
}
#endif
}
#endif // ESLOPE
/** \brief The R_DrawSplat_8 function /** \brief The R_DrawSplat_8 function
Just like R_DrawSpan_8, but skips transparent pixels. Just like R_DrawSpan_8, but skips transparent pixels.
*/ */

View File

@ -316,13 +316,13 @@ angle_t R_PointToAngle(fixed_t x, fixed_t y)
x >= 0 ? x >= 0 ?
y >= 0 ? y >= 0 ?
(x > y) ? tantoangle[SlopeDiv(y,x)] : // octant 0 (x > y) ? tantoangle[SlopeDiv(y,x)] : // octant 0
ANGLE_90-1-tantoangle[SlopeDiv(x,y)] : // octant 1 ANGLE_90-tantoangle[SlopeDiv(x,y)] : // octant 1
x > (y = -y) ? 0-tantoangle[SlopeDiv(y,x)] : // octant 8 x > (y = -y) ? 0-tantoangle[SlopeDiv(y,x)] : // octant 8
ANGLE_270+tantoangle[SlopeDiv(x,y)] : // octant 7 ANGLE_270+tantoangle[SlopeDiv(x,y)] : // octant 7
y >= 0 ? (x = -x) > y ? ANGLE_180-1-tantoangle[SlopeDiv(y,x)] :// octant 3 y >= 0 ? (x = -x) > y ? ANGLE_180-tantoangle[SlopeDiv(y,x)] : // octant 3
ANGLE_90 + tantoangle[SlopeDiv(x,y)] : // octant 2 ANGLE_90 + tantoangle[SlopeDiv(x,y)] : // octant 2
(x = -x) > (y = -y) ? ANGLE_180+tantoangle[ SlopeDiv(y,x)] : // octant 4 (x = -x) > (y = -y) ? ANGLE_180+tantoangle[SlopeDiv(y,x)] : // octant 4
ANGLE_270-1-tantoangle[SlopeDiv(x,y)] : // octant 5 ANGLE_270-tantoangle[SlopeDiv(x,y)] : // octant 5
0; 0;
} }
@ -332,13 +332,13 @@ angle_t R_PointToAngle2(fixed_t pviewx, fixed_t pviewy, fixed_t x, fixed_t y)
x >= 0 ? x >= 0 ?
y >= 0 ? y >= 0 ?
(x > y) ? tantoangle[SlopeDiv(y,x)] : // octant 0 (x > y) ? tantoangle[SlopeDiv(y,x)] : // octant 0
ANGLE_90-1-tantoangle[SlopeDiv(x,y)] : // octant 1 ANGLE_90-tantoangle[SlopeDiv(x,y)] : // octant 1
x > (y = -y) ? 0-tantoangle[SlopeDiv(y,x)] : // octant 8 x > (y = -y) ? 0-tantoangle[SlopeDiv(y,x)] : // octant 8
ANGLE_270+tantoangle[SlopeDiv(x,y)] : // octant 7 ANGLE_270+tantoangle[SlopeDiv(x,y)] : // octant 7
y >= 0 ? (x = -x) > y ? ANGLE_180-1-tantoangle[SlopeDiv(y,x)] :// octant 3 y >= 0 ? (x = -x) > y ? ANGLE_180-tantoangle[SlopeDiv(y,x)] : // octant 3
ANGLE_90 + tantoangle[SlopeDiv(x,y)] : // octant 2 ANGLE_90 + tantoangle[SlopeDiv(x,y)] : // octant 2
(x = -x) > (y = -y) ? ANGLE_180+tantoangle[ SlopeDiv(y,x)] : // octant 4 (x = -x) > (y = -y) ? ANGLE_180+tantoangle[SlopeDiv(y,x)] : // octant 4
ANGLE_270-1-tantoangle[SlopeDiv(x,y)] : // octant 5 ANGLE_270-tantoangle[SlopeDiv(x,y)] : // octant 5
0; 0;
} }
@ -527,6 +527,8 @@ static void R_InitTextureMapping(void)
focallength = FixedDiv(centerxfrac, focallength = FixedDiv(centerxfrac,
FINETANGENT(FINEANGLES/4+/*cv_fov.value*/ FIELDOFVIEW/2)); FINETANGENT(FINEANGLES/4+/*cv_fov.value*/ FIELDOFVIEW/2));
focallengthf = FIXED_TO_FLOAT(focallength);
for (i = 0; i < FINEANGLES/2; i++) for (i = 0; i < FINEANGLES/2; i++)
{ {
if (FINETANGENT(i) > FRACUNIT*2) if (FINETANGENT(i) > FRACUNIT*2)
@ -1026,34 +1028,31 @@ void R_SetupFrame(player_t *player, boolean skybox)
{ {
INT32 dy = 0; INT32 dy = 0;
camera_t *thiscam; camera_t *thiscam;
boolean forcechase = false; boolean chasecam = false;
if (splitscreen && player == &players[secondarydisplayplayer] if (splitscreen && player == &players[secondarydisplayplayer]
&& player != &players[consoleplayer]) && player != &players[consoleplayer])
{ {
thiscam = &camera2; thiscam = &camera2;
chasecam = (cv_chasecam2.value != 0);
} }
else else
{
thiscam = &camera; thiscam = &camera;
chasecam = (cv_chasecam.value != 0);
}
if (player->climbing || (player->pflags & PF_NIGHTSMODE) || player->playerstate == PST_DEAD) if (player->climbing || (player->pflags & PF_NIGHTSMODE) || player->playerstate == PST_DEAD)
forcechase = true; chasecam = true; // force chasecam on
else if (player->spectator) // no spectator chasecam
chasecam = false; // force chasecam off
if (!forcechase && player->spectator) // no spectator chasecam if (chasecam && !thiscam->chase)
thiscam->chase = false;
else if ((cv_chasecam.value || forcechase) && !player->spectator && thiscam == &camera && !thiscam->chase)
{ {
P_ResetCamera(player, &camera); P_ResetCamera(player, thiscam);
thiscam->chase = true; thiscam->chase = true;
} }
else if ((cv_chasecam2.value || forcechase) && !player->spectator && thiscam == &camera2 && !thiscam->chase) else if (!chasecam)
{
P_ResetCamera(player, &camera2);
thiscam->chase = true;
}
else if (!(cv_chasecam.value || forcechase) && thiscam == &camera)
thiscam->chase = false;
else if (!(cv_chasecam2.value || forcechase) && thiscam == &camera2)
thiscam->chase = false; thiscam->chase = false;
viewsky = !skybox; viewsky = !skybox;
@ -1066,9 +1065,7 @@ void R_SetupFrame(player_t *player, boolean skybox)
aimingangle = player->awayviewaiming; aimingangle = player->awayviewaiming;
viewangle = viewmobj->angle; viewangle = viewmobj->angle;
} }
else if (!player->spectator && (forcechase else if (!player->spectator && chasecam)
|| (cv_chasecam.value && thiscam == &camera)
|| (cv_chasecam2.value && thiscam == &camera2)))
// use outside cam view // use outside cam view
{ {
viewmobj = NULL; viewmobj = NULL;
@ -1105,8 +1102,7 @@ void R_SetupFrame(player_t *player, boolean skybox)
viewplayer = player; viewplayer = player;
if ((forcechase || (cv_chasecam.value && thiscam == &camera) || (cv_chasecam2.value && thiscam == &camera2)) if (chasecam && !player->awayviewtics && !player->spectator)
&& !player->awayviewtics && !player->spectator)
{ {
viewx = thiscam->x; viewx = thiscam->x;
viewy = thiscam->y; viewy = thiscam->y;

View File

@ -28,6 +28,8 @@
#include "p_setup.h" // levelflats #include "p_setup.h" // levelflats
#include "p_slopes.h"
// //
// opening // opening
// //
@ -74,7 +76,7 @@ static INT32 spanstart[MAXVIDHEIGHT];
// //
// texture mapping // texture mapping
// //
static lighttable_t **planezlight; lighttable_t **planezlight;
static fixed_t planeheight; static fixed_t planeheight;
//added : 10-02-98: yslopetab is what yslope used to be, //added : 10-02-98: yslopetab is what yslope used to be,
@ -327,6 +329,11 @@ void R_MapPlane(INT32 y, INT32 x1, INT32 x2)
if (pindex >= MAXLIGHTZ) if (pindex >= MAXLIGHTZ)
pindex = MAXLIGHTZ - 1; pindex = MAXLIGHTZ - 1;
#ifdef ESLOPE
if (currentplane->slope)
ds_colormap = colormaps;
else
#endif
ds_colormap = planezlight[pindex]; ds_colormap = planezlight[pindex];
if (currentplane->extra_colormap) if (currentplane->extra_colormap)
@ -423,11 +430,18 @@ static visplane_t *new_visplane(unsigned hash)
// //
visplane_t *R_FindPlane(fixed_t height, INT32 picnum, INT32 lightlevel, visplane_t *R_FindPlane(fixed_t height, INT32 picnum, INT32 lightlevel,
fixed_t xoff, fixed_t yoff, angle_t plangle, extracolormap_t *planecolormap, fixed_t xoff, fixed_t yoff, angle_t plangle, extracolormap_t *planecolormap,
ffloor_t *pfloor) ffloor_t *pfloor
#ifdef ESLOPE
, pslope_t *slope
#endif
)
{ {
visplane_t *check; visplane_t *check;
unsigned hash; unsigned hash;
#ifdef ESLOPE
if (slope); else // Don't mess with this right now if a slope is involved
#endif
if (plangle != 0) if (plangle != 0)
{ {
// Add the view offset, rotated by the plane angle. // Add the view offset, rotated by the plane angle.
@ -462,7 +476,11 @@ visplane_t *R_FindPlane(fixed_t height, INT32 picnum, INT32 lightlevel,
&& xoff == check->xoffs && yoff == check->yoffs && xoff == check->xoffs && yoff == check->yoffs
&& planecolormap == check->extra_colormap && planecolormap == check->extra_colormap
&& !pfloor && !check->ffloor && check->viewz == viewz && !pfloor && !check->ffloor && check->viewz == viewz
&& check->viewangle == viewangle) && check->viewangle == viewangle
#ifdef ESLOPE
&& check->slope == slope
#endif
)
{ {
return check; return check;
} }
@ -485,6 +503,9 @@ visplane_t *R_FindPlane(fixed_t height, INT32 picnum, INT32 lightlevel,
#ifdef POLYOBJECTS_PLANES #ifdef POLYOBJECTS_PLANES
check->polyobj = NULL; check->polyobj = NULL;
#endif #endif
#ifdef ESLOPE
check->slope = slope;
#endif
memset(check->top, 0xff, sizeof (check->top)); memset(check->top, 0xff, sizeof (check->top));
memset(check->bottom, 0x00, sizeof (check->bottom)); memset(check->bottom, 0x00, sizeof (check->bottom));
@ -551,6 +572,9 @@ visplane_t *R_CheckPlane(visplane_t *pl, INT32 start, INT32 stop)
new_pl->plangle = pl->plangle; new_pl->plangle = pl->plangle;
#ifdef POLYOBJECTS_PLANES #ifdef POLYOBJECTS_PLANES
new_pl->polyobj = pl->polyobj; new_pl->polyobj = pl->polyobj;
#endif
#ifdef ESLOPE
new_pl->slope = pl->slope;
#endif #endif
pl = new_pl; pl = new_pl;
pl->minx = start; pl->minx = start;
@ -814,7 +838,11 @@ void R_DrawSinglePlane(visplane_t *pl)
else light = (pl->lightlevel >> LIGHTSEGSHIFT); else light = (pl->lightlevel >> LIGHTSEGSHIFT);
#ifndef NOWATER #ifndef NOWATER
if (pl->ffloor->flags & FF_RIPPLE) if (pl->ffloor->flags & FF_RIPPLE
#ifdef ESLOPE
&& !pl->slope
#endif
)
{ {
INT32 top, bottom; INT32 top, bottom;
@ -842,6 +870,9 @@ void R_DrawSinglePlane(visplane_t *pl)
} }
else light = (pl->lightlevel >> LIGHTSEGSHIFT); else light = (pl->lightlevel >> LIGHTSEGSHIFT);
#ifdef ESLOPE
if (!pl->slope) // Don't mess with angle on slopes! We'll handle this ourselves later
#endif
if (viewangle != pl->viewangle) if (viewangle != pl->viewangle)
{ {
memset(cachedheight, 0, sizeof (cachedheight)); memset(cachedheight, 0, sizeof (cachedheight));
@ -915,6 +946,106 @@ void R_DrawSinglePlane(visplane_t *pl)
if (light < 0) if (light < 0)
light = 0; light = 0;
#ifdef ESLOPE
if (pl->slope) {
// Potentially override other stuff for now cus we're mean. :< But draw a slope plane!
// I copied ZDoom's code and adapted it to SRB2... -Red
floatv3_t p, m, n;
float ang;
float vx, vy, vz;
float fudge;
// compiler complains when P_GetZAt is used in FLOAT_TO_FIXED directly
// use this as a temp var to store P_GetZAt's return value each time
fixed_t temp;
xoffs &= ((1 << (32-nflatshiftup))-1);
yoffs &= ((1 << (32-nflatshiftup))-1);
xoffs -= (pl->slope->o.x + (1 << (31-nflatshiftup))) & ~((1 << (32-nflatshiftup))-1);
yoffs += (pl->slope->o.y + (1 << (31-nflatshiftup))) & ~((1 << (32-nflatshiftup))-1);
// Okay, look, don't ask me why this works, but without this setup there's a disgusting-looking misalignment with the textures. -Red
fudge = ((1<<nflatshiftup)+1.0f)/(1<<nflatshiftup);
xoffs *= fudge;
yoffs /= fudge;
vx = FIXED_TO_FLOAT(viewx+xoffs);
vy = FIXED_TO_FLOAT(viewy-yoffs);
vz = FIXED_TO_FLOAT(viewz);
temp = P_GetZAt(pl->slope, viewx, viewy);
zeroheight = FIXED_TO_FLOAT(temp);
#define ANG2RAD(angle) ((float)((angle)*M_PI)/ANGLE_180)
// p is the texture origin in view space
// Don't add in the offsets at this stage, because doing so can result in
// errors if the flat is rotated.
ang = ANG2RAD(ANGLE_270 - viewangle);
p.x = vx * cos(ang) - vy * sin(ang);
p.z = vx * sin(ang) + vy * cos(ang);
temp = P_GetZAt(pl->slope, -xoffs, yoffs);
p.y = FIXED_TO_FLOAT(temp) - vz;
// m is the v direction vector in view space
ang = ANG2RAD(ANGLE_180 - viewangle - pl->plangle);
m.x = cos(ang);
m.z = sin(ang);
// n is the u direction vector in view space
n.x = sin(ang);
n.z = -cos(ang);
ang = ANG2RAD(pl->plangle);
temp = P_GetZAt(pl->slope, viewx + FLOAT_TO_FIXED(sin(ang)), viewy + FLOAT_TO_FIXED(cos(ang)));
m.y = FIXED_TO_FLOAT(temp) - zeroheight;
temp = P_GetZAt(pl->slope, viewx + FLOAT_TO_FIXED(cos(ang)), viewy - FLOAT_TO_FIXED(sin(ang)));
n.y = FIXED_TO_FLOAT(temp) - zeroheight;
m.x /= fudge;
m.y /= fudge;
m.z /= fudge;
n.x *= fudge;
n.y *= fudge;
n.z *= fudge;
// Eh. I tried making this stuff fixed-point and it exploded on me. Here's a macro for the only floating-point vector function I recall using.
#define CROSS(d, v1, v2) \
d.x = (v1.y * v2.z) - (v1.z * v2.y);\
d.y = (v1.z * v2.x) - (v1.x * v2.z);\
d.z = (v1.x * v2.y) - (v1.y * v2.x)
CROSS(ds_su, p, m);
CROSS(ds_sv, p, n);
CROSS(ds_sz, m, n);
#undef CROSS
ds_su.z *= focallengthf;
ds_sv.z *= focallengthf;
ds_sz.z *= focallengthf;
// Premultiply the texture vectors with the scale factors
#define SFMULT 65536.f*(1<<nflatshiftup)
ds_su.x *= SFMULT;
ds_su.y *= SFMULT;
ds_su.z *= SFMULT;
ds_sv.x *= SFMULT;
ds_sv.y *= SFMULT;
ds_sv.z *= SFMULT;
#undef SFMULT
if (spanfunc == R_DrawTranslucentSpan_8)
spanfunc = R_DrawTiltedTranslucentSpan_8;
else if (spanfunc == splatfunc)
spanfunc = R_DrawTiltedSplat_8;
else
spanfunc = R_DrawTiltedSpan_8;
planezlight = scalelight[light];
} else
#endif // ESLOPE
planezlight = zlight[light]; planezlight = zlight[light];
// set the maximum value for unsigned // set the maximum value for unsigned

View File

@ -61,6 +61,9 @@ typedef struct visplane_s
#ifdef POLYOBJECTS_PLANES #ifdef POLYOBJECTS_PLANES
polyobj_t *polyobj; polyobj_t *polyobj;
#endif #endif
#ifdef ESLOPE
pslope_t *slope;
#endif
} visplane_t; } visplane_t;
extern visplane_t *floorplane; extern visplane_t *floorplane;
@ -79,6 +82,8 @@ extern fixed_t cachedxstep[MAXVIDHEIGHT];
extern fixed_t cachedystep[MAXVIDHEIGHT]; extern fixed_t cachedystep[MAXVIDHEIGHT];
extern fixed_t basexscale, baseyscale; extern fixed_t basexscale, baseyscale;
extern lighttable_t **planezlight;
extern fixed_t *yslope; extern fixed_t *yslope;
extern fixed_t distscale[MAXVIDWIDTH]; extern fixed_t distscale[MAXVIDWIDTH];
@ -91,7 +96,11 @@ void R_MapPlane(INT32 y, INT32 x1, INT32 x2);
void R_MakeSpans(INT32 x, INT32 t1, INT32 b1, INT32 t2, INT32 b2); void R_MakeSpans(INT32 x, INT32 t1, INT32 b1, INT32 t2, INT32 b2);
void R_DrawPlanes(void); void R_DrawPlanes(void);
visplane_t *R_FindPlane(fixed_t height, INT32 picnum, INT32 lightlevel, fixed_t xoff, fixed_t yoff, angle_t plangle, visplane_t *R_FindPlane(fixed_t height, INT32 picnum, INT32 lightlevel, fixed_t xoff, fixed_t yoff, angle_t plangle,
extracolormap_t *planecolormap, ffloor_t *ffloor); extracolormap_t *planecolormap, ffloor_t *ffloor
#ifdef ESLOPE
, pslope_t *slope
#endif
);
visplane_t *R_CheckPlane(visplane_t *pl, INT32 start, INT32 stop); visplane_t *R_CheckPlane(visplane_t *pl, INT32 start, INT32 stop);
void R_ExpandPlane(visplane_t *pl, INT32 start, INT32 stop); void R_ExpandPlane(visplane_t *pl, INT32 start, INT32 stop);
void R_PlaneBounds(visplane_t *plane); void R_PlaneBounds(visplane_t *plane);
@ -110,6 +119,14 @@ typedef struct planemgr_s
INT16 f_clip[MAXVIDWIDTH]; INT16 f_clip[MAXVIDWIDTH];
INT16 c_clip[MAXVIDWIDTH]; INT16 c_clip[MAXVIDWIDTH];
#ifdef ESLOPE
// For slope rendering; the height at the other end
fixed_t f_pos_slope;
fixed_t b_pos_slope;
struct pslope_s *slope;
#endif
struct ffloor_s *ffloor; struct ffloor_s *ffloor;
#ifdef POLYOBJECTS_PLANES #ifdef POLYOBJECTS_PLANES
polyobj_t *polyobj; polyobj_t *polyobj;

File diff suppressed because it is too large Load Diff

View File

@ -24,6 +24,7 @@
#include "r_plane.h" #include "r_plane.h"
#include "p_tick.h" #include "p_tick.h"
#include "p_local.h" #include "p_local.h"
#include "p_slopes.h"
#include "dehacked.h" // get_number (for thok) #include "dehacked.h" // get_number (for thok)
#include "d_netfil.h" // blargh. for nameonly(). #include "d_netfil.h" // blargh. for nameonly().
#include "m_cheat.h" // objectplace #include "m_cheat.h" // objectplace
@ -338,6 +339,10 @@ void R_AddSpriteDefs(UINT16 wadnum)
else else
start++; // just after S_START start++; // just after S_START
// ignore skin wads (we don't want skin sprites interfering with vanilla sprites)
if (start == 0 && W_CheckNumForNamePwad("S_SKIN", wadnum, 0) != INT16_MAX)
return;
end = W_CheckNumForNamePwad("S_END",wadnum,start); end = W_CheckNumForNamePwad("S_END",wadnum,start);
if (end == INT16_MAX) if (end == INT16_MAX)
end = W_CheckNumForNamePwad("SS_END",wadnum,start); //deutex compatib. end = W_CheckNumForNamePwad("SS_END",wadnum,start); //deutex compatib.
@ -950,12 +955,22 @@ static void R_SplitSprite(vissprite_t *sprite, mobj_t *thing)
for (i = 1; i < sector->numlights; i++) for (i = 1; i < sector->numlights; i++)
{ {
if (sector->lightlist[i].height >= sprite->gzt || !(sector->lightlist[i].caster->flags & FF_CUTSPRITES)) fixed_t testheight = sector->lightlist[i].height;
if (!(sector->lightlist[i].caster->flags & FF_CUTSPRITES))
continue; continue;
if (sector->lightlist[i].height <= sprite->gz)
#ifdef ESLOPE
if (sector->lightlist[i].slope)
testheight = P_GetZAt(sector->lightlist[i].slope, sprite->gx, sprite->gy);
#endif
if (testheight >= sprite->gzt)
continue;
if (testheight <= sprite->gz)
return; return;
cutfrac = (INT16)((centeryfrac - FixedMul(sector->lightlist[i].height - viewz, sprite->scale))>>FRACBITS); cutfrac = (INT16)((centeryfrac - FixedMul(testheight - viewz, sprite->scale))>>FRACBITS);
if (cutfrac < 0) if (cutfrac < 0)
continue; continue;
if (cutfrac > vid.height) if (cutfrac > vid.height)
@ -966,15 +981,15 @@ static void R_SplitSprite(vissprite_t *sprite, mobj_t *thing)
newsprite = M_Memcpy(R_NewVisSprite(), sprite, sizeof (vissprite_t)); newsprite = M_Memcpy(R_NewVisSprite(), sprite, sizeof (vissprite_t));
sprite->cut |= SC_BOTTOM; sprite->cut |= SC_BOTTOM;
sprite->gz = sector->lightlist[i].height; sprite->gz = testheight;
newsprite->gzt = sprite->gz; newsprite->gzt = sprite->gz;
sprite->sz = cutfrac; sprite->sz = cutfrac;
newsprite->szt = (INT16)(sprite->sz - 1); newsprite->szt = (INT16)(sprite->sz - 1);
if (sector->lightlist[i].height < sprite->pzt && sector->lightlist[i].height > sprite->pz) if (testheight < sprite->pzt && testheight > sprite->pz)
sprite->pz = newsprite->pzt = sector->lightlist[i].height; sprite->pz = newsprite->pzt = testheight;
else else
{ {
newsprite->pz = newsprite->gz; newsprite->pz = newsprite->gz;
@ -1088,9 +1103,14 @@ static void R_ProjectSprite(mobj_t *thing)
//Fab : 02-08-98: 'skin' override spritedef currently used for skin //Fab : 02-08-98: 'skin' override spritedef currently used for skin
if (thing->skin && thing->sprite == SPR_PLAY) if (thing->skin && thing->sprite == SPR_PLAY)
{ {
sprdef = &((skin_t *)thing->skin)->spritedef; sprdef = &((skin_t *)thing->skin)->sprites[thing->sprite2];
if (rot >= sprdef->numframes) if (rot >= sprdef->numframes) {
CONS_Alert(CONS_ERROR, M_GetText("R_ProjectSprite: invalid skins[\"%s\"].sprites[SPR2_%s] frame %d\n"), ((skin_t *)thing->skin)->name, spr2names[thing->sprite2], rot);
thing->sprite = states[S_UNKNOWN].sprite;
thing->frame = states[S_UNKNOWN].frame;
sprdef = &sprites[thing->sprite]; sprdef = &sprites[thing->sprite];
rot = thing->frame&FF_FRAMEMASK;
}
} }
else else
sprdef = &sprites[thing->sprite]; sprdef = &sprites[thing->sprite];
@ -1191,7 +1211,20 @@ static void R_ProjectSprite(mobj_t *thing)
if (thing->subsector->sector->numlights) if (thing->subsector->sector->numlights)
{ {
INT32 lightnum; INT32 lightnum;
#ifdef ESLOPE // R_GetPlaneLight won't work on sloped lights!
light = thing->subsector->sector->numlights - 1;
for (lightnum = 1; lightnum < thing->subsector->sector->numlights; lightnum++) {
fixed_t h = thing->subsector->sector->lightlist[lightnum].slope ? P_GetZAt(thing->subsector->sector->lightlist[lightnum].slope, thing->x, thing->y)
: thing->subsector->sector->lightlist[lightnum].height;
if (h <= gzt) {
light = lightnum - 1;
break;
}
}
#else
light = R_GetPlaneLight(thing->subsector->sector, gzt, false); light = R_GetPlaneLight(thing->subsector->sector, gzt, false);
#endif
lightnum = (*thing->subsector->sector->lightlist[light].lightlevel >> LIGHTSEGSHIFT); lightnum = (*thing->subsector->sector->lightlist[light].lightlevel >> LIGHTSEGSHIFT);
if (lightnum < 0) if (lightnum < 0)
@ -1546,23 +1579,12 @@ void R_AddSprites(sector_t *sec, INT32 lightlevel)
// If a limit exists, handle things a tiny bit different. // If a limit exists, handle things a tiny bit different.
if ((limit_dist = (fixed_t)((maptol & TOL_NIGHTS) ? cv_drawdist_nights.value : cv_drawdist.value) << FRACBITS)) if ((limit_dist = (fixed_t)((maptol & TOL_NIGHTS) ? cv_drawdist_nights.value : cv_drawdist.value) << FRACBITS))
{ {
if (!players[displayplayer].mo)
return; // Draw nothing if no player.
// todo: is this really the best option for this situation?
for (thing = sec->thinglist; thing; thing = thing->snext) for (thing = sec->thinglist; thing; thing = thing->snext)
{ {
if (thing->sprite == SPR_NULL || thing->flags2 & MF2_DONTDRAW) if (thing->sprite == SPR_NULL || thing->flags2 & MF2_DONTDRAW)
continue; continue;
approx_dist = P_AproxDistance( approx_dist = P_AproxDistance(viewx-thing->x, viewy-thing->y);
players[displayplayer].mo->x - thing->x,
players[displayplayer].mo->y - thing->y);
if (splitscreen && approx_dist > limit_dist && players[secondarydisplayplayer].mo)
approx_dist = P_AproxDistance(
players[secondarydisplayplayer].mo->x - thing->x,
players[secondarydisplayplayer].mo->y - thing->y);
if (approx_dist <= limit_dist) if (approx_dist <= limit_dist)
R_ProjectSprite(thing); R_ProjectSprite(thing);
@ -1579,23 +1601,12 @@ void R_AddSprites(sector_t *sec, INT32 lightlevel)
// Someone seriously wants infinite draw distance for precipitation? // Someone seriously wants infinite draw distance for precipitation?
if ((limit_dist = (fixed_t)cv_drawdist_precip.value << FRACBITS)) if ((limit_dist = (fixed_t)cv_drawdist_precip.value << FRACBITS))
{ {
if (!players[displayplayer].mo)
return; // Draw nothing if no player.
// todo: is this really the best option for this situation?
for (precipthing = sec->preciplist; precipthing; precipthing = precipthing->snext) for (precipthing = sec->preciplist; precipthing; precipthing = precipthing->snext)
{ {
if (precipthing->precipflags & PCF_INVISIBLE) if (precipthing->precipflags & PCF_INVISIBLE)
continue; continue;
approx_dist = P_AproxDistance( approx_dist = P_AproxDistance(viewx-precipthing->x, viewy-precipthing->y);
players[displayplayer].mo->x - precipthing->x,
players[displayplayer].mo->y - precipthing->y);
if (splitscreen && approx_dist > limit_dist && players[secondarydisplayplayer].mo)
approx_dist = P_AproxDistance(
players[secondarydisplayplayer].mo->x - precipthing->x,
players[secondarydisplayplayer].mo->y - precipthing->y);
if (approx_dist <= limit_dist) if (approx_dist <= limit_dist)
R_ProjectPrecipitationSprite(precipthing); R_ProjectPrecipitationSprite(precipthing);
@ -1704,6 +1715,19 @@ static void R_CreateDrawNodes(void)
} }
if (ds->maskedtexturecol) if (ds->maskedtexturecol)
{ {
#ifdef POLYOBJECTS_PLANES
// Check for a polyobject plane, but only if this is a front line
if (ds->curline->polyseg && ds->curline->polyseg->visplane && !ds->curline->side) {
// Put it in!
entry = R_CreateDrawNode(&nodehead);
entry->plane = ds->curline->polyseg->visplane;
entry->seg = ds;
ds->curline->polyseg->visplane->polyobj = ds->curline->polyseg;
ds->curline->polyseg->visplane = NULL;
}
#endif
entry = R_CreateDrawNode(&nodehead); entry = R_CreateDrawNode(&nodehead);
entry->seg = ds; entry->seg = ds;
} }
@ -1720,7 +1744,7 @@ static void R_CreateDrawNodes(void)
plane = ds->ffloorplanes[p]; plane = ds->ffloorplanes[p];
R_PlaneBounds(plane); R_PlaneBounds(plane);
if (plane->low < con_clipviewtop || plane->high > vid.height || plane->high > plane->low) if (plane->low < con_clipviewtop || plane->high > vid.height || plane->high > plane->low || plane->polyobj)
{ {
ds->ffloorplanes[p] = NULL; ds->ffloorplanes[p] = NULL;
continue; continue;
@ -1761,24 +1785,34 @@ static void R_CreateDrawNodes(void)
{ {
if (r2->plane) if (r2->plane)
{ {
fixed_t planeobjectz, planecameraz;
if (r2->plane->minx > rover->x2 || r2->plane->maxx < rover->x1) if (r2->plane->minx > rover->x2 || r2->plane->maxx < rover->x1)
continue; continue;
if (rover->szt > r2->plane->low || rover->sz < r2->plane->high) if (rover->szt > r2->plane->low || rover->sz < r2->plane->high)
continue; continue;
#ifdef ESLOPE
// Effective height may be different for each comparison in the case of slopes
if (r2->plane->slope) {
planeobjectz = P_GetZAt(r2->plane->slope, rover->gx, rover->gy);
planecameraz = P_GetZAt(r2->plane->slope, viewx, viewy);
} else
#endif
planeobjectz = planecameraz = r2->plane->height;
if (rover->mobjflags & MF_NOCLIPHEIGHT) if (rover->mobjflags & MF_NOCLIPHEIGHT)
{ {
//Objects with NOCLIPHEIGHT can appear halfway in. //Objects with NOCLIPHEIGHT can appear halfway in.
if (r2->plane->height < viewz && rover->pz+(rover->thingheight/2) >= r2->plane->height) if (planecameraz < viewz && rover->pz+(rover->thingheight/2) >= planeobjectz)
continue; continue;
if (r2->plane->height > viewz && rover->pzt-(rover->thingheight/2) <= r2->plane->height) if (planecameraz > viewz && rover->pzt-(rover->thingheight/2) <= planeobjectz)
continue; continue;
} }
else else
{ {
if (r2->plane->height < viewz && rover->pz >= r2->plane->height) if (planecameraz < viewz && rover->pz >= planeobjectz)
continue; continue;
if (r2->plane->height > viewz && rover->pzt <= r2->plane->height) if (planecameraz > viewz && rover->pzt <= planeobjectz)
continue; continue;
} }
@ -1808,6 +1842,7 @@ static void R_CreateDrawNodes(void)
} }
else if (r2->thickseg) else if (r2->thickseg)
{ {
fixed_t topplaneobjectz, topplanecameraz, botplaneobjectz, botplanecameraz;
if (rover->x1 > r2->thickseg->x2 || rover->x2 < r2->thickseg->x1) if (rover->x1 > r2->thickseg->x2 || rover->x2 < r2->thickseg->x1)
continue; continue;
@ -1818,9 +1853,25 @@ static void R_CreateDrawNodes(void)
if (scale <= rover->scale) if (scale <= rover->scale)
continue; continue;
if ((*r2->ffloor->topheight > viewz && *r2->ffloor->bottomheight < viewz) || #ifdef ESLOPE
(*r2->ffloor->topheight < viewz && rover->gzt < *r2->ffloor->topheight) || if (*r2->ffloor->t_slope) {
(*r2->ffloor->bottomheight > viewz && rover->gz > *r2->ffloor->bottomheight)) topplaneobjectz = P_GetZAt(*r2->ffloor->t_slope, rover->gx, rover->gy);
topplanecameraz = P_GetZAt(*r2->ffloor->t_slope, viewx, viewy);
} else
#endif
topplaneobjectz = topplanecameraz = *r2->ffloor->topheight;
#ifdef ESLOPE
if (*r2->ffloor->b_slope) {
botplaneobjectz = P_GetZAt(*r2->ffloor->b_slope, rover->gx, rover->gy);
botplanecameraz = P_GetZAt(*r2->ffloor->b_slope, viewx, viewy);
} else
#endif
botplaneobjectz = botplanecameraz = *r2->ffloor->bottomheight;
if ((topplanecameraz > viewz && botplanecameraz < viewz) ||
(topplanecameraz < viewz && rover->gzt < topplaneobjectz) ||
(botplanecameraz > viewz && rover->gz > botplaneobjectz))
{ {
entry = R_CreateDrawNode(NULL); entry = R_CreateDrawNode(NULL);
(entry->prev = r2->prev)->next = entry; (entry->prev = r2->prev)->next = entry;
@ -1831,7 +1882,7 @@ static void R_CreateDrawNodes(void)
} }
else if (r2->seg) else if (r2->seg)
{ {
#ifdef POLYOBJECTS_PLANES #if 0 //#ifdef POLYOBJECTS_PLANES
if (r2->seg->curline->polyseg && rover->mobj && P_MobjInsidePolyobj(r2->seg->curline->polyseg, rover->mobj)) { if (r2->seg->curline->polyseg && rover->mobj && P_MobjInsidePolyobj(r2->seg->curline->polyseg, rover->mobj)) {
// Determine if we need to sort in front of the polyobj, based on the planes. This fixes the issue where // Determine if we need to sort in front of the polyobj, based on the planes. This fixes the issue where
// polyobject planes render above the object standing on them. (A bit hacky... but it works.) -Red // polyobject planes render above the object standing on them. (A bit hacky... but it works.) -Red
@ -2039,21 +2090,21 @@ void R_ClipSprites(void)
if (spr->gzt <= ds->tsilheight) if (spr->gzt <= ds->tsilheight)
silhouette &= ~SIL_TOP; silhouette &= ~SIL_TOP;
if (silhouette == 1) if (silhouette == SIL_BOTTOM)
{ {
// bottom sil // bottom sil
for (x = r1; x <= r2; x++) for (x = r1; x <= r2; x++)
if (spr->clipbot[x] == -2) if (spr->clipbot[x] == -2)
spr->clipbot[x] = ds->sprbottomclip[x]; spr->clipbot[x] = ds->sprbottomclip[x];
} }
else if (silhouette == 2) else if (silhouette == SIL_TOP)
{ {
// top sil // top sil
for (x = r1; x <= r2; x++) for (x = r1; x <= r2; x++)
if (spr->cliptop[x] == -2) if (spr->cliptop[x] == -2)
spr->cliptop[x] = ds->sprtopclip[x]; spr->cliptop[x] = ds->sprtopclip[x];
} }
else if (silhouette == 3) else if (silhouette == (SIL_TOP|SIL_BOTTOM))
{ {
// both // both
for (x = r1; x <= r2; x++) for (x = r1; x <= r2; x++)
@ -2225,7 +2276,6 @@ static void Sk_SetDefaultValue(skin_t *skin)
sizeof skin->name, "skin %u", (UINT32)(skin-skins)); sizeof skin->name, "skin %u", (UINT32)(skin-skins));
skin->name[sizeof skin->name - 1] = '\0'; skin->name[sizeof skin->name - 1] = '\0';
skin->wadnum = INT16_MAX; skin->wadnum = INT16_MAX;
strcpy(skin->sprite, "");
skin->flags = 0; skin->flags = 0;
@ -2267,7 +2317,6 @@ static void Sk_SetDefaultValue(skin_t *skin)
// //
void R_InitSkins(void) void R_InitSkins(void)
{ {
skin_t *skin;
#ifdef SKINVALUES #ifdef SKINVALUES
INT32 i; INT32 i;
@ -2278,43 +2327,8 @@ void R_InitSkins(void)
} }
#endif #endif
// skin[0] = Sonic skin // no default skin!
skin = &skins[0]; numskins = 0;
numskins = 1;
Sk_SetDefaultValue(skin);
// Hardcoded S_SKIN customizations for Sonic.
strcpy(skin->name, DEFAULTSKIN);
#ifdef SKINVALUES
skin_cons_t[0].strvalue = skins[0].name;
#endif
skin->flags = SF_SUPER|SF_SUPERANIMS|SF_SUPERSPIN;
strcpy(skin->realname, "Sonic");
strcpy(skin->hudname, "SONIC");
strncpy(skin->charsel, "CHRSONIC", 8);
strncpy(skin->face, "LIVSONIC", 8);
strncpy(skin->superface, "LIVSUPER", 8);
skin->prefcolor = SKINCOLOR_BLUE;
skin->ability = CA_THOK;
skin->actionspd = 60<<FRACBITS;
skin->normalspeed = 36<<FRACBITS;
skin->runspeed = 28<<FRACBITS;
skin->thrustfactor = 5;
skin->accelstart = 96;
skin->acceleration = 40;
skin->spritedef.numframes = sprites[SPR_PLAY].numframes;
skin->spritedef.spriteframes = sprites[SPR_PLAY].spriteframes;
ST_LoadFaceGraphics(skin->face, skin->superface, 0);
//MD2 for sonic doesn't want to load in Linux.
#ifdef HWRENDER
if (rendermode == render_opengl)
HWR_AddPlayerMD2(0);
#endif
} }
// returns true if the skin name is found (loaded from pwad) // returns true if the skin name is found (loaded from pwad)
@ -2559,11 +2573,6 @@ void R_AddSkins(UINT16 wadnum)
STRBUFCPY(skin->realname, skin->hudname); STRBUFCPY(skin->realname, skin->hudname);
} }
else if (!stricmp(stoken, "sprite"))
{
strupr(value);
strncpy(skin->sprite, value, sizeof skin->sprite);
}
else if (!stricmp(stoken, "charsel")) else if (!stricmp(stoken, "charsel"))
{ {
strupr(value); strupr(value);
@ -2645,71 +2654,25 @@ next_token:
} }
free(buf2); free(buf2);
// Not in vanilla, you don't. if (skin != &skins[0])
skin->flags &= ~SF_SUPER; skin->flags &= ~SF_SUPER;
lump++; // if no sprite defined use spirte just after this one // Add sprites
if (skin->sprite[0] == '\0')
{ {
const char *csprname = W_CheckNameForNumPwad(wadnum, lump); UINT16 z;
UINT8 sprite2;
// skip to end of this skin's frames lump++; // start after S_SKIN
lastlump = lump; lastlump = W_CheckNumForNamePwad("S_END",wadnum,lump); // stop at S_END
while (W_CheckNameForNumPwad(wadnum,lastlump) && memcmp(W_CheckNameForNumPwad(wadnum, lastlump),csprname,4)==0) // old wadding practices die hard -- stop at S_SKIN or S_START if they come before S_END.
lastlump++; z = W_CheckNumForNamePwad("S_SKIN",wadnum,lump);
// allocate (or replace) sprite frames, and set spritedef if (z < lastlump) lastlump = z;
R_AddSingleSpriteDef(csprname, &skin->spritedef, wadnum, lump, lastlump); z = W_CheckNumForNamePwad("S_START",wadnum,lump);
} if (z < lastlump) lastlump = z;
else
{
// search in the normal sprite tables
size_t name;
boolean found = false;
const char *sprname = skin->sprite;
for (name = 0;sprnames[name][0] != '\0';name++)
if (strncmp(sprnames[name], sprname, 4) == 0)
{
found = true;
skin->spritedef = sprites[name];
}
// not found so make a new one // load all sprite sets we are aware of.
// go through the entire current wad looking for our sprite for (sprite2 = 0; sprite2 < NUMPLAYERSPRITES; sprite2++)
// don't just mass add anything beginning with our four letters. R_AddSingleSpriteDef(spr2names[sprite2], &skin->sprites[sprite2], wadnum, lump, lastlump);
// "HOODFACE" is not a sprite name.
if (!found)
{
UINT16 localllump = 0, lstart = UINT16_MAX, lend = UINT16_MAX;
const char *lname;
while ((lname = W_CheckNameForNumPwad(wadnum,localllump)))
{
// If this is a valid sprite...
if (!memcmp(lname,sprname,4) && lname[4] && lname[5] && lname[5] >= '0' && lname[5] <= '8')
{
if (lstart == UINT16_MAX)
lstart = localllump;
// If already set do nothing
}
else
{
if (lstart != UINT16_MAX)
{
lend = localllump;
break;
}
// If not already set do nothing
}
++localllump;
}
R_AddSingleSpriteDef(sprname, &skin->spritedef, wadnum, lstart, lend);
}
// I don't particularly care about skipping to the end of the used frames.
// We could be using frames from ANYWHERE in the current WAD file, including
// right before us, which is a terrible idea.
// So just let the function in the while loop take care of it for us.
} }
R_FlushTranslationColormapCache(); R_FlushTranslationColormapCache();

View File

@ -68,9 +68,7 @@ void R_DrawMasked(void);
typedef struct typedef struct
{ {
char name[SKINNAMESIZE+1]; // INT16 descriptive name of the skin char name[SKINNAMESIZE+1]; // INT16 descriptive name of the skin
spritedef_t spritedef;
UINT16 wadnum; UINT16 wadnum;
char sprite[4]; // Sprite name, if seperated from S_SKIN.
skinflags_t flags; skinflags_t flags;
char realname[SKINNAMESIZE+1]; // Display name for level completion. char realname[SKINNAMESIZE+1]; // Display name for level completion.
@ -102,6 +100,8 @@ typedef struct
// specific sounds per skin // specific sounds per skin
sfxenum_t soundsid[NUMSKINSOUNDS]; // sound # in S_sfx table sfxenum_t soundsid[NUMSKINSOUNDS]; // sound # in S_sfx table
spritedef_t sprites[NUMPLAYERSPRITES];
} skin_t; } skin_t;
// ----------- // -----------

View File

@ -1,80 +1,425 @@
/* XPM */ /* XPM */
static const char * SDL_icon_xpm[] = { static char * C:\Repo\srb2\src\sdl\SDL_icon_xpm[] = {
"32 32 45 1", "32 32 390 2",
" c None", " c None",
". c #6B6BFF", ". c #4F4F70",
"+ c #3D00B9", "+ c #4D4D87",
"@ c #4848FF", "@ c #4D4D84",
"# c #2525FF", "# c #4E4E6C",
"$ c #310096", "$ c #6C6C95",
"% c #003196", "% c #5E5EB2",
"& c #003DB9", "& c #6B6BE7",
"* c #620096", "* c #7373F9",
"= c #6E6E6E", "= c #7C7CFF",
"- c #966200", "- c #6F70E7",
"; c #250073", "; c #494BB2",
"> c #626262", "> c #4F4FA3",
", c #FF8F6B", ", c #6464D4",
"' c #FFC66B", "' c #7979F5",
") c #FFAB8E", ") c #5F5FCA",
"! c #000080", "! c #5D5D93",
"~ c #B6B6B6", "~ c #3A3A9F",
"{ c #929292", "{ c #6060AC",
"] c #FFD48E", "] c #777793",
"^ c #0000B9", "^ c #5C5CB3",
"/ c #565656", "/ c #7373EA",
"( c #868686", "( c #7A7AFF",
"_ c #808080", "_ c #7575FF",
": c #C0C0C0", ": c #7979FF",
"< c #DADADA", "< c #6264DD",
"[ c #F2F2F2", "[ c #47478C",
"} c #FFFFFF", "} c #564567",
"| c #CECECE", "| c #4647D0",
"1 c #AAAAAA", "1 c #5C5CAE",
"2 c #E6E6E6", "2 c #5E5EFF",
"3 c #000096", "3 c #2929FF",
"4 c #AB8EFF", "4 c #1D1DFF",
"5 c #190050", "5 c #1919D1",
"6 c #000000", "6 c #4F4F90",
"7 c #8E8EFF", "7 c #1E1ECE",
"8 c #3E3E3E", "8 c #5858FF",
"9 c #7A7A7A", "9 c #6767A8",
"0 c #0E0E0E", "0 c #4949A0",
"a c #9E9E9E", "a c #7070FB",
"b c #001950", "b c #7D7DFF",
"c c #C2C2C2", "c c #7777FF",
"d c #323232", "d c #7373FF",
"e c #002573", "e c #7272FF",
"f c #A0A0A4", "f c #7878FF",
" ", "g c #6465D8",
" ", "h c #363886",
" ", "i c #9F7655",
" .+@##@. ", "j c #C89B5C",
" @@.@#######@ ", "k c #1D1CB7",
" @@....######### ", "l c #3031B1",
" .. .@.....@+##$%%%&&% ", "m c #1919F4",
" ..@# @@....@+#*=-;%%%%% ", "n c #1111FF",
" ..@#@......@>,')!%%%$ ", "o c #1818FF",
" ~..$#.........{])^#+%/ ", "p c #1B1BFF",
" +##@.........()^@@@@@_ ", "q c #1C1CFF",
" $####@........#=#######+ ", "r c #2626B3",
" +######....@@##^#########_ ", "s c #1E1EC8",
" +#####=:<<:+##############/ ", "t c #1A1AE8",
"[<=####{<}}}}|###############= ", "u c #24249F",
" }1###=2}}}}}}.############### ", "v c #2F2FD2",
" }<3#3~}}}}}}}4################ ", "w c #7676FF",
" }<5#6:}}}}}}}7################/", "x c #6869E2",
" }:6861}}}}}}}.########$$ 9 .@$", "y c #414290",
" }:0a6~}}}}}}}@######5b ", "z c #8C6751",
"22cd262}}}}}}2######5b$ ", "A c #FCBA68",
" 2>1a}}}}}}}{(*###%be## ", "B c #E9BD7D",
" 860)1<[22c1)]]+##be### ", "C c #201EB8",
" ~)]]]))))]]]]]=#bb#### ", "D c #090AB8",
" )]]]]]]]]](]]=eb$#### ", "E c #1616EB",
" :]]]]]]]]]'9bbb$##### ", "F c #1818FD",
" ),'''''( >db+### ", "G c #1414EE",
" =##f ", "H c #1010E1",
" { ", "I c #0E0EE2",
" ", "J c #0E0EF4",
" ", "K c #0606B2",
" "}; "L c #7A7A89",
"M c #0C0C9A",
"N c #0A0AA7",
"O c #2424E4",
"P c #6669E6",
"Q c #4F4A8F",
"R c #BF853B",
"S c #FFD98D",
"T c #CDAB76",
"U c #1717C4",
"V c #0F10BA",
"W c #0909B6",
"X c #0505C3",
"Y c #0000B6",
"Z c #0000BE",
"` c #0000AD",
" . c #1D1D83",
".. c #63638E",
"+. c #090975",
"@. c #1414F3",
"#. c #5B5BFF",
"$. c #7B7BFF",
"%. c #7070FF",
"&. c #6E6EFF",
"*. c #7172F6",
"=. c #625DAF",
"-. c #BA9E6C",
";. c #887167",
">. c #090DF2",
",. c #1313BE",
"'. c #000085",
"). c #0000AC",
"!. c #0202AA",
"~. c #242488",
"{. c #1414C7",
"]. c #1717FF",
"^. c #5959FF",
"/. c #7F7FFF",
"(. c #7474FF",
"_. c #7171FF",
":. c #8686FF",
"<. c #7574FF",
"[. c #797CFF",
"}. c #5756B8",
"|. c #1C19A4",
"1. c #1617FF",
"2. c #1212BD",
"3. c #040485",
"4. c #0707A4",
"5. c #1B1B71",
"6. c #373797",
"7. c #1616FF",
"8. c #5050FF",
"9. c #8080FF",
"0. c #AAAAFF",
"a. c #AEAEF6",
"b. c #8A8AEF",
"c. c #6969FB",
"d. c #2728FF",
"e. c #1314FF",
"f. c #1919FF",
"g. c #1313E8",
"h. c #1F1FF4",
"i. c #5454FF",
"j. c #6D6DF0",
"k. c #6868B5",
"l. c #0B0BB8",
"m. c #1212C5",
"n. c #1616FC",
"o. c #1515FF",
"p. c #1212FF",
"q. c #2323FF",
"r. c #3636FF",
"s. c #4040FF",
"t. c #4343F9",
"u. c #5D5DB8",
"v. c #7F7F92",
"w. c #878793",
"x. c #4B4B94",
"y. c #0B0CE2",
"z. c #1313FF",
"A. c #4C4CFF",
"B. c #8282FF",
"C. c #7171ED",
"D. c #636394",
"E. c #575785",
"F. c #A9A99C",
"G. c #1414BC",
"H. c #1414FF",
"I. c #0707FD",
"J. c #2525AA",
"K. c #A8A8A4",
"L. c #EBEBE2",
"M. c #F9F9F2",
"N. c #E1E1CC",
"O. c #4D4D9F",
"P. c #0B0BF7",
"Q. c #2121FF",
"R. c #3232FF",
"S. c #5555FF",
"T. c #6161B4",
"U. c #B5B5B2",
"V. c #FFFFF8",
"W. c #4F4F9A",
"X. c #0B0BF5",
"Y. c #1616C5",
"Z. c #A8A8A1",
"`. c #FFFFFC",
" + c #FFFFFF",
".+ c #C0C0C4",
"++ c #1212D4",
"@+ c #4444FF",
"#+ c #6464FF",
"$+ c #8383FF",
"%+ c #6767C3",
"&+ c #E4E4E4",
"*+ c #9494AE",
"=+ c #0808DF",
"-+ c #0D0DF2",
";+ c #61619A",
">+ c #F1F1E0",
",+ c #E8E8DD",
"'+ c #2424BB",
")+ c #1010FF",
"!+ c #3434FF",
"~+ c #6161FF",
"{+ c #6969D2",
"]+ c #EFEFF0",
"^+ c #C2C2BA",
"/+ c #1010B6",
"(+ c #0909AC",
"_+ c #A4A49A",
":+ c #EAEADE",
"<+ c #2525B8",
"[+ c #2F2FFF",
"}+ c #3C3CB5",
"|+ c #EEEEEE",
"1+ c #BBBBAD",
"2+ c #0B0B56",
"3+ c #0B0BFC",
"4+ c #1212EF",
"5+ c #0C0C3E",
"6+ c #919187",
"7+ c #DEDED6",
"8+ c #1F1FC0",
"9+ c #1A1AFF",
"0+ c #1717FA",
"a+ c #1515F8",
"b+ c #1111FC",
"c+ c #494992",
"d+ c #999998",
"e+ c #3E3E3B",
"f+ c #3C3C99",
"g+ c #535397",
"h+ c #5A5A4D",
"i+ c #6F6F70",
"j+ c #BFBFC9",
"k+ c #1111D6",
"l+ c #1515F1",
"m+ c #0F0FE2",
"n+ c #0D0DD9",
"o+ c #0909CD",
"p+ c #0808C7",
"q+ c #0505C7",
"r+ c #0303CB",
"s+ c #0101C0",
"t+ c #0202AF",
"u+ c #0606AC",
"v+ c #121283",
"w+ c #BBBBBB",
"x+ c #BEBEBE",
"y+ c #2F2F2E",
"z+ c #C7C8BB",
"A+ c #D8DAD1",
"B+ c #272828",
"C+ c #929292",
"D+ c #8688C7",
"E+ c #0506F6",
"F+ c #1616F5",
"G+ c #0B0BD3",
"H+ c #0202B6",
"I+ c #0000AF",
"J+ c #0000B4",
"K+ c #0000BD",
"L+ c #0000BB",
"M+ c #00009E",
"N+ c #2C2C7E",
"O+ c #6A6A8B",
"P+ c #959595",
"Q+ c #F0F0F1",
"R+ c #E1E1E1",
"S+ c #8C8E90",
"T+ c #BEBEBF",
"U+ c #C9C7C5",
"V+ c #939699",
"W+ c #E7EAED",
"X+ c #CBCBC7",
"Y+ c #413B9B",
"Z+ c #0607DD",
"`+ c #0C0CE2",
" @ c #0303B9",
".@ c #0000A8",
"+@ c #181888",
"@@ c #6A6A6A",
"#@ c #626263",
"$@ c #4B4B4C",
"%@ c #3E3B36",
"&@ c #9B805C",
"*@ c #D9B07D",
"=@ c #C9AE89",
"-@ c #B9AF9E",
";@ c #C7C5C4",
">@ c #CBCCCF",
",@ c #C7C6C6",
"'@ c #AEA59A",
")@ c #B69974",
"!@ c #D8B87F",
"~@ c #9B8272",
"{@ c #0E0B9B",
"]@ c #0000B7",
"^@ c #0000B8",
"/@ c #000082",
"(@ c #00007A",
"_@ c #636379",
":@ c #62533E",
"<@ c #B59B6C",
"[@ c #DEB07B",
"}@ c #FECC90",
"|@ c #FFCE92",
"1@ c #FEC98C",
"2@ c #F1BD82",
"3@ c #D1A979",
"4@ c #BC9E73",
"5@ c #CCA777",
"6@ c #EAB980",
"7@ c #FFCD90",
"8@ c #FFD595",
"9@ c #FDD782",
"0@ c #413678",
"a@ c #0000AE",
"b@ c #000077",
"c@ c #010193",
"d@ c #0C0CE4",
"e@ c #38389E",
"f@ c #EEC585",
"g@ c #FFDA9D",
"h@ c #FFC992",
"i@ c #FFC88F",
"j@ c #FFC990",
"k@ c #FFCE93",
"l@ c #FFD094",
"m@ c #FFCC92",
"n@ c #C9A174",
"o@ c #EDBD88",
"p@ c #FAD287",
"q@ c #3A2F7F",
"r@ c #0000BA",
"s@ c #0000B0",
"t@ c #0101B2",
"u@ c #1111ED",
"v@ c #1919C1",
"w@ c #95887C",
"x@ c #DCAC6E",
"y@ c #FFD393",
"z@ c #FFCD94",
"A@ c #FFCA93",
"B@ c #FFC991",
"C@ c #FFC78E",
"D@ c #FFCB91",
"E@ c #E0B581",
"F@ c #BB9A6F",
"G@ c #FFDC97",
"H@ c #C1A173",
"I@ c #0E0B9A",
"J@ c #0000B5",
"K@ c #0101B6",
"L@ c #1010E0",
"M@ c #1616EC",
"N@ c #A68156",
"O@ c #E7AC6B",
"P@ c #FFC582",
"Q@ c #FFCF8F",
"R@ c #FFD195",
"S@ c #FFD296",
"T@ c #FFD396",
"U@ c #FFD193",
"V@ c #FFD28F",
"W@ c #D2A96B",
"X@ c #2F2482",
"Y@ c #0000C1",
"Z@ c #0000C0",
"`@ c #0000BF",
" # c #0101BF",
".# c #1212F0",
"+# c #767698",
"@# c #9C866E",
"## c #A9865D",
"$# c #C0915D",
"%# c #C89760",
"&# c #C29360",
"*# c #AD8A61",
"=# c #9D8971",
"-# c #7F7A7A",
";# c #70708F",
"># c #6F6F91",
",# c #575788",
"'# c #464687",
")# c #2F2F87",
"!# c #15158F",
"~# c #0101A8",
"{# c #1313FB",
"]# c #57579F",
"^# c #343487",
"/# c #434388",
" ",
" ",
" ",
" . + @ # ",
" $ % & * = - ; > , ' ) ! ",
" ~ { ] ^ / = ( _ : < [ } | 1 2 3 4 5 6 ",
" 7 8 9 0 a b c d e f g h i j k l m n o p q r ",
" s t u v _ f d d d w x y z A B C D E F G H I J K L ",
" M N O _ c e d d d _ P Q R S T U V W X Y Z ` ... ",
" +.@.#.$.d d d d %.&._ *.=.-.;.>.,.'.).!.~. ",
" {.].^./.(.d d _.$.:._ <.[.}.|.1.2.3.4.5. ",
" 6.7.7.4 8.e : w 9.0.a.b.c.2 d.e.f.g.h.i.j.k. ",
" l.m.n.o.p.q.r.s.t.u.v.w.x.y.z.o o z.A.B./.b C.D. ",
" E.F.G.].o H.z.I.J.K.L.M.N.O.P.o o o Q.R.S._.b B.T. ",
" U.V.W.X.f.f.7.Y.Z.`. + + +.+++].o o o.n z.q.@+#+$+%+ ",
" &+ +*+=+].o -+;+>+ + + + +,+'+H.o o o o o H.)+o !+~+{+ ",
" ]+ +^+/+H.o.(+_+ + + + + +:+<+z.o o o o o o o 7.n H.[+}+ ",
" |+ +1+2+3+4+5+6+ + + + + +7+8+H.o o f.9+f.9+f.F 0+a+b+o.c+ ",
" &+ +d+e+f+g+h+i+ + + + + +j+k+].f.9+l+m+n+o+p+q+r+s+t+u+v+ ",
" w+ +x+y+z+A+B+C+ + + + + +D+E+9+F+G+H+I+J+K+L+M+N+O+ ",
" P+Q+R+S+T+U+V+W+ + + + +X+Y+Z+`+ @I+J+Z .@+@E. ",
" @@#@$@%@&@*@=@-@;@>@,@'@)@!@~@{@]@^@I+/@(@_@ ",
" :@<@[@}@|@1@2@3@4@5@6@7@8@9@0@L+a@b@c@d@e@ ",
" f@g@h@i@i@j@k@l@|@m@n@o@p@q@r@s@t@u@p v@ ",
" w@x@y@z@A@B@i@C@D@E@F@G@H@I@L+J@K@L@p M@ ",
" N@O@P@Q@R@S@T@U@V@W@X@Y@Z@Y@`@ #.#p +# ",
" @###$#%#&#*#=#-#;#>#,#'#)#!#~#{#]# ",
" ^#/# ",
" ",
" ",
" ",
" "};

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.2 KiB

After

Width:  |  Height:  |  Size: 364 KiB

View File

@ -2759,8 +2759,8 @@ static const char *locateWad(void)
if (isWadPathOk(returnWadPath)) if (isWadPathOk(returnWadPath))
return NULL; return NULL;
#endif #endif
#ifdef CMAKECONFIG #ifdef CMAKECONFIG
#ifndef NDEBUG #ifndef NDEBUG
I_OutputMsg(","CMAKE_ASSETS_DIR); I_OutputMsg(","CMAKE_ASSETS_DIR);
@ -2771,7 +2771,7 @@ static const char *locateWad(void)
} }
#endif #endif
#endif #endif
#ifdef __APPLE__ #ifdef __APPLE__
OSX_GetResourcesPath(returnWadPath); OSX_GetResourcesPath(returnWadPath);
I_OutputMsg(",%s", returnWadPath); I_OutputMsg(",%s", returnWadPath);
@ -2779,7 +2779,7 @@ static const char *locateWad(void)
{ {
return returnWadPath; return returnWadPath;
} }
#endif #endif
// examine default dirs // examine default dirs

View File

@ -1,80 +1,425 @@
/* XPM */ /* XPM */
static const char * SDL_icon_xpm[] = { static char * C:\Repo\srb2\src\sdl\SDL_icon_xpm[] = {
"32 32 45 1", "32 32 390 2",
" c None", " c None",
". c #6B6BFF", ". c #4F4F70",
"+ c #3D00B9", "+ c #4D4D87",
"@ c #4848FF", "@ c #4D4D84",
"# c #2525FF", "# c #4E4E6C",
"$ c #310096", "$ c #6C6C95",
"% c #003196", "% c #5E5EB2",
"& c #003DB9", "& c #6B6BE7",
"* c #620096", "* c #7373F9",
"= c #6E6E6E", "= c #7C7CFF",
"- c #966200", "- c #6F70E7",
"; c #250073", "; c #494BB2",
"> c #626262", "> c #4F4FA3",
", c #FF8F6B", ", c #6464D4",
"' c #FFC66B", "' c #7979F5",
") c #FFAB8E", ") c #5F5FCA",
"! c #000080", "! c #5D5D93",
"~ c #B6B6B6", "~ c #3A3A9F",
"{ c #929292", "{ c #6060AC",
"] c #FFD48E", "] c #777793",
"^ c #0000B9", "^ c #5C5CB3",
"/ c #565656", "/ c #7373EA",
"( c #868686", "( c #7A7AFF",
"_ c #808080", "_ c #7575FF",
": c #C0C0C0", ": c #7979FF",
"< c #DADADA", "< c #6264DD",
"[ c #F2F2F2", "[ c #47478C",
"} c #FFFFFF", "} c #564567",
"| c #CECECE", "| c #4647D0",
"1 c #AAAAAA", "1 c #5C5CAE",
"2 c #E6E6E6", "2 c #5E5EFF",
"3 c #000096", "3 c #2929FF",
"4 c #AB8EFF", "4 c #1D1DFF",
"5 c #190050", "5 c #1919D1",
"6 c #000000", "6 c #4F4F90",
"7 c #8E8EFF", "7 c #1E1ECE",
"8 c #3E3E3E", "8 c #5858FF",
"9 c #7A7A7A", "9 c #6767A8",
"0 c #0E0E0E", "0 c #4949A0",
"a c #9E9E9E", "a c #7070FB",
"b c #001950", "b c #7D7DFF",
"c c #C2C2C2", "c c #7777FF",
"d c #323232", "d c #7373FF",
"e c #002573", "e c #7272FF",
"f c #A0A0A4", "f c #7878FF",
" ", "g c #6465D8",
" ", "h c #363886",
" ", "i c #9F7655",
" .+@##@. ", "j c #C89B5C",
" @@.@#######@ ", "k c #1D1CB7",
" @@....######### ", "l c #3031B1",
" .. .@.....@+##$%%%&&% ", "m c #1919F4",
" ..@# @@....@+#*=-;%%%%% ", "n c #1111FF",
" ..@#@......@>,')!%%%$ ", "o c #1818FF",
" ~..$#.........{])^#+%/ ", "p c #1B1BFF",
" +##@.........()^@@@@@_ ", "q c #1C1CFF",
" $####@........#=#######+ ", "r c #2626B3",
" +######....@@##^#########_ ", "s c #1E1EC8",
" +#####=:<<:+##############/ ", "t c #1A1AE8",
"[<=####{<}}}}|###############= ", "u c #24249F",
" }1###=2}}}}}}.############### ", "v c #2F2FD2",
" }<3#3~}}}}}}}4################ ", "w c #7676FF",
" }<5#6:}}}}}}}7################/", "x c #6869E2",
" }:6861}}}}}}}.########$$ 9 .@$", "y c #414290",
" }:0a6~}}}}}}}@######5b ", "z c #8C6751",
"22cd262}}}}}}2######5b$ ", "A c #FCBA68",
" 2>1a}}}}}}}{(*###%be## ", "B c #E9BD7D",
" 860)1<[22c1)]]+##be### ", "C c #201EB8",
" ~)]]]))))]]]]]=#bb#### ", "D c #090AB8",
" )]]]]]]]]](]]=eb$#### ", "E c #1616EB",
" :]]]]]]]]]'9bbb$##### ", "F c #1818FD",
" ),'''''( >db+### ", "G c #1414EE",
" =##f ", "H c #1010E1",
" { ", "I c #0E0EE2",
" ", "J c #0E0EF4",
" ", "K c #0606B2",
" "}; "L c #7A7A89",
"M c #0C0C9A",
"N c #0A0AA7",
"O c #2424E4",
"P c #6669E6",
"Q c #4F4A8F",
"R c #BF853B",
"S c #FFD98D",
"T c #CDAB76",
"U c #1717C4",
"V c #0F10BA",
"W c #0909B6",
"X c #0505C3",
"Y c #0000B6",
"Z c #0000BE",
"` c #0000AD",
" . c #1D1D83",
".. c #63638E",
"+. c #090975",
"@. c #1414F3",
"#. c #5B5BFF",
"$. c #7B7BFF",
"%. c #7070FF",
"&. c #6E6EFF",
"*. c #7172F6",
"=. c #625DAF",
"-. c #BA9E6C",
";. c #887167",
">. c #090DF2",
",. c #1313BE",
"'. c #000085",
"). c #0000AC",
"!. c #0202AA",
"~. c #242488",
"{. c #1414C7",
"]. c #1717FF",
"^. c #5959FF",
"/. c #7F7FFF",
"(. c #7474FF",
"_. c #7171FF",
":. c #8686FF",
"<. c #7574FF",
"[. c #797CFF",
"}. c #5756B8",
"|. c #1C19A4",
"1. c #1617FF",
"2. c #1212BD",
"3. c #040485",
"4. c #0707A4",
"5. c #1B1B71",
"6. c #373797",
"7. c #1616FF",
"8. c #5050FF",
"9. c #8080FF",
"0. c #AAAAFF",
"a. c #AEAEF6",
"b. c #8A8AEF",
"c. c #6969FB",
"d. c #2728FF",
"e. c #1314FF",
"f. c #1919FF",
"g. c #1313E8",
"h. c #1F1FF4",
"i. c #5454FF",
"j. c #6D6DF0",
"k. c #6868B5",
"l. c #0B0BB8",
"m. c #1212C5",
"n. c #1616FC",
"o. c #1515FF",
"p. c #1212FF",
"q. c #2323FF",
"r. c #3636FF",
"s. c #4040FF",
"t. c #4343F9",
"u. c #5D5DB8",
"v. c #7F7F92",
"w. c #878793",
"x. c #4B4B94",
"y. c #0B0CE2",
"z. c #1313FF",
"A. c #4C4CFF",
"B. c #8282FF",
"C. c #7171ED",
"D. c #636394",
"E. c #575785",
"F. c #A9A99C",
"G. c #1414BC",
"H. c #1414FF",
"I. c #0707FD",
"J. c #2525AA",
"K. c #A8A8A4",
"L. c #EBEBE2",
"M. c #F9F9F2",
"N. c #E1E1CC",
"O. c #4D4D9F",
"P. c #0B0BF7",
"Q. c #2121FF",
"R. c #3232FF",
"S. c #5555FF",
"T. c #6161B4",
"U. c #B5B5B2",
"V. c #FFFFF8",
"W. c #4F4F9A",
"X. c #0B0BF5",
"Y. c #1616C5",
"Z. c #A8A8A1",
"`. c #FFFFFC",
" + c #FFFFFF",
".+ c #C0C0C4",
"++ c #1212D4",
"@+ c #4444FF",
"#+ c #6464FF",
"$+ c #8383FF",
"%+ c #6767C3",
"&+ c #E4E4E4",
"*+ c #9494AE",
"=+ c #0808DF",
"-+ c #0D0DF2",
";+ c #61619A",
">+ c #F1F1E0",
",+ c #E8E8DD",
"'+ c #2424BB",
")+ c #1010FF",
"!+ c #3434FF",
"~+ c #6161FF",
"{+ c #6969D2",
"]+ c #EFEFF0",
"^+ c #C2C2BA",
"/+ c #1010B6",
"(+ c #0909AC",
"_+ c #A4A49A",
":+ c #EAEADE",
"<+ c #2525B8",
"[+ c #2F2FFF",
"}+ c #3C3CB5",
"|+ c #EEEEEE",
"1+ c #BBBBAD",
"2+ c #0B0B56",
"3+ c #0B0BFC",
"4+ c #1212EF",
"5+ c #0C0C3E",
"6+ c #919187",
"7+ c #DEDED6",
"8+ c #1F1FC0",
"9+ c #1A1AFF",
"0+ c #1717FA",
"a+ c #1515F8",
"b+ c #1111FC",
"c+ c #494992",
"d+ c #999998",
"e+ c #3E3E3B",
"f+ c #3C3C99",
"g+ c #535397",
"h+ c #5A5A4D",
"i+ c #6F6F70",
"j+ c #BFBFC9",
"k+ c #1111D6",
"l+ c #1515F1",
"m+ c #0F0FE2",
"n+ c #0D0DD9",
"o+ c #0909CD",
"p+ c #0808C7",
"q+ c #0505C7",
"r+ c #0303CB",
"s+ c #0101C0",
"t+ c #0202AF",
"u+ c #0606AC",
"v+ c #121283",
"w+ c #BBBBBB",
"x+ c #BEBEBE",
"y+ c #2F2F2E",
"z+ c #C7C8BB",
"A+ c #D8DAD1",
"B+ c #272828",
"C+ c #929292",
"D+ c #8688C7",
"E+ c #0506F6",
"F+ c #1616F5",
"G+ c #0B0BD3",
"H+ c #0202B6",
"I+ c #0000AF",
"J+ c #0000B4",
"K+ c #0000BD",
"L+ c #0000BB",
"M+ c #00009E",
"N+ c #2C2C7E",
"O+ c #6A6A8B",
"P+ c #959595",
"Q+ c #F0F0F1",
"R+ c #E1E1E1",
"S+ c #8C8E90",
"T+ c #BEBEBF",
"U+ c #C9C7C5",
"V+ c #939699",
"W+ c #E7EAED",
"X+ c #CBCBC7",
"Y+ c #413B9B",
"Z+ c #0607DD",
"`+ c #0C0CE2",
" @ c #0303B9",
".@ c #0000A8",
"+@ c #181888",
"@@ c #6A6A6A",
"#@ c #626263",
"$@ c #4B4B4C",
"%@ c #3E3B36",
"&@ c #9B805C",
"*@ c #D9B07D",
"=@ c #C9AE89",
"-@ c #B9AF9E",
";@ c #C7C5C4",
">@ c #CBCCCF",
",@ c #C7C6C6",
"'@ c #AEA59A",
")@ c #B69974",
"!@ c #D8B87F",
"~@ c #9B8272",
"{@ c #0E0B9B",
"]@ c #0000B7",
"^@ c #0000B8",
"/@ c #000082",
"(@ c #00007A",
"_@ c #636379",
":@ c #62533E",
"<@ c #B59B6C",
"[@ c #DEB07B",
"}@ c #FECC90",
"|@ c #FFCE92",
"1@ c #FEC98C",
"2@ c #F1BD82",
"3@ c #D1A979",
"4@ c #BC9E73",
"5@ c #CCA777",
"6@ c #EAB980",
"7@ c #FFCD90",
"8@ c #FFD595",
"9@ c #FDD782",
"0@ c #413678",
"a@ c #0000AE",
"b@ c #000077",
"c@ c #010193",
"d@ c #0C0CE4",
"e@ c #38389E",
"f@ c #EEC585",
"g@ c #FFDA9D",
"h@ c #FFC992",
"i@ c #FFC88F",
"j@ c #FFC990",
"k@ c #FFCE93",
"l@ c #FFD094",
"m@ c #FFCC92",
"n@ c #C9A174",
"o@ c #EDBD88",
"p@ c #FAD287",
"q@ c #3A2F7F",
"r@ c #0000BA",
"s@ c #0000B0",
"t@ c #0101B2",
"u@ c #1111ED",
"v@ c #1919C1",
"w@ c #95887C",
"x@ c #DCAC6E",
"y@ c #FFD393",
"z@ c #FFCD94",
"A@ c #FFCA93",
"B@ c #FFC991",
"C@ c #FFC78E",
"D@ c #FFCB91",
"E@ c #E0B581",
"F@ c #BB9A6F",
"G@ c #FFDC97",
"H@ c #C1A173",
"I@ c #0E0B9A",
"J@ c #0000B5",
"K@ c #0101B6",
"L@ c #1010E0",
"M@ c #1616EC",
"N@ c #A68156",
"O@ c #E7AC6B",
"P@ c #FFC582",
"Q@ c #FFCF8F",
"R@ c #FFD195",
"S@ c #FFD296",
"T@ c #FFD396",
"U@ c #FFD193",
"V@ c #FFD28F",
"W@ c #D2A96B",
"X@ c #2F2482",
"Y@ c #0000C1",
"Z@ c #0000C0",
"`@ c #0000BF",
" # c #0101BF",
".# c #1212F0",
"+# c #767698",
"@# c #9C866E",
"## c #A9865D",
"$# c #C0915D",
"%# c #C89760",
"&# c #C29360",
"*# c #AD8A61",
"=# c #9D8971",
"-# c #7F7A7A",
";# c #70708F",
"># c #6F6F91",
",# c #575788",
"'# c #464687",
")# c #2F2F87",
"!# c #15158F",
"~# c #0101A8",
"{# c #1313FB",
"]# c #57579F",
"^# c #343487",
"/# c #434388",
" ",
" ",
" ",
" . + @ # ",
" $ % & * = - ; > , ' ) ! ",
" ~ { ] ^ / = ( _ : < [ } | 1 2 3 4 5 6 ",
" 7 8 9 0 a b c d e f g h i j k l m n o p q r ",
" s t u v _ f d d d w x y z A B C D E F G H I J K L ",
" M N O _ c e d d d _ P Q R S T U V W X Y Z ` ... ",
" +.@.#.$.d d d d %.&._ *.=.-.;.>.,.'.).!.~. ",
" {.].^./.(.d d _.$.:._ <.[.}.|.1.2.3.4.5. ",
" 6.7.7.4 8.e : w 9.0.a.b.c.2 d.e.f.g.h.i.j.k. ",
" l.m.n.o.p.q.r.s.t.u.v.w.x.y.z.o o z.A.B./.b C.D. ",
" E.F.G.].o H.z.I.J.K.L.M.N.O.P.o o o Q.R.S._.b B.T. ",
" U.V.W.X.f.f.7.Y.Z.`. + + +.+++].o o o.n z.q.@+#+$+%+ ",
" &+ +*+=+].o -+;+>+ + + + +,+'+H.o o o o o H.)+o !+~+{+ ",
" ]+ +^+/+H.o.(+_+ + + + + +:+<+z.o o o o o o o 7.n H.[+}+ ",
" |+ +1+2+3+4+5+6+ + + + + +7+8+H.o o f.9+f.9+f.F 0+a+b+o.c+ ",
" &+ +d+e+f+g+h+i+ + + + + +j+k+].f.9+l+m+n+o+p+q+r+s+t+u+v+ ",
" w+ +x+y+z+A+B+C+ + + + + +D+E+9+F+G+H+I+J+K+L+M+N+O+ ",
" P+Q+R+S+T+U+V+W+ + + + +X+Y+Z+`+ @I+J+Z .@+@E. ",
" @@#@$@%@&@*@=@-@;@>@,@'@)@!@~@{@]@^@I+/@(@_@ ",
" :@<@[@}@|@1@2@3@4@5@6@7@8@9@0@L+a@b@c@d@e@ ",
" f@g@h@i@i@j@k@l@|@m@n@o@p@q@r@s@t@u@p v@ ",
" w@x@y@z@A@B@i@C@D@E@F@G@H@I@L+J@K@L@p M@ ",
" N@O@P@Q@R@S@T@U@V@W@X@Y@Z@Y@`@ #.#p +# ",
" @###$#%#&#*#=#-#;#>#,#'#)#!#~#{#]# ",
" ^#/# ",
" ",
" ",
" ",
" "};

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.2 KiB

After

Width:  |  Height:  |  Size: 364 KiB

View File

@ -1590,7 +1590,7 @@ static void ST_drawSpecialStageHUD(void)
if (sstimer) if (sstimer)
{ {
V_DrawString(hudinfo[HUD_TIMELEFT].x, STRINGY(hudinfo[HUD_TIMELEFT].y), V_HUDTRANS, M_GetText("TIME LEFT")); V_DrawString(hudinfo[HUD_TIMELEFT].x, STRINGY(hudinfo[HUD_TIMELEFT].y), V_HUDTRANS, M_GetText("TIME LEFT"));
ST_DrawNightsOverlayNum(SCX(hudinfo[HUD_TIMELEFTNUM].x), SCY(hudinfo[HUD_TIMELEFTNUM].y), V_HUDTRANS, sstimer/TICRATE, tallnum, SKINCOLOR_WHITE); ST_DrawNumFromHud(HUD_TIMELEFTNUM, sstimer/TICRATE);
} }
else else
ST_DrawPatchFromHud(HUD_TIMEUP, timeup); ST_DrawPatchFromHud(HUD_TIMEUP, timeup);

File diff suppressed because it is too large Load Diff

View File

@ -96,9 +96,6 @@ FUNCMATH angle_t FixedAngle(fixed_t fa);
// and with a factor, with +factor for (fa/factor) and -factor for (fa*factor) // and with a factor, with +factor for (fa/factor) and -factor for (fa*factor)
FUNCMATH angle_t FixedAngleC(fixed_t fa, fixed_t factor); FUNCMATH angle_t FixedAngleC(fixed_t fa, fixed_t factor);
#ifdef NEED_FIXED_VECTOR
/// The FixedAcos function /// The FixedAcos function
FUNCMATH angle_t FixedAcos(fixed_t x); FUNCMATH angle_t FixedAcos(fixed_t x);
@ -112,8 +109,6 @@ void FV3_Rotate(vector3_t *rotVec, const vector3_t *axisVec, const angle_t angle
/// Fixed Point Matrix functions /// Fixed Point Matrix functions
void FM_Rotate(matrix_t *dest, angle_t angle, fixed_t x, fixed_t y, fixed_t z); void FM_Rotate(matrix_t *dest, angle_t angle, fixed_t x, fixed_t y, fixed_t z);
#endif // defined NEED_FIXED_VECTOR
// The table values in tables.c are calculated with this many fractional bits. // The table values in tables.c are calculated with this many fractional bits.
#define FINE_FRACBITS 16 #define FINE_FRACBITS 16

View File

@ -635,7 +635,7 @@ void V_DrawContinueIcon(INT32 x, INT32 y, INT32 flags, INT32 skinnum, UINT8 skin
V_DrawScaledPatch(x - 10, y - 14, flags, W_CachePatchName("CONTINS", PU_CACHE)); V_DrawScaledPatch(x - 10, y - 14, flags, W_CachePatchName("CONTINS", PU_CACHE));
else else
{ {
spriteframe_t *sprframe = &skins[skinnum].spritedef.spriteframes[2 & FF_FRAMEMASK]; spriteframe_t *sprframe = &skins[skinnum].sprites[SPR2_WAIT].spriteframes[0];
patch_t *patch = W_CachePatchNum(sprframe->lumppat[0], PU_CACHE); patch_t *patch = W_CachePatchNum(sprframe->lumppat[0], PU_CACHE);
const UINT8 *colormap = R_GetTranslationColormap(skinnum, skincolor, GTC_CACHE); const UINT8 *colormap = R_GetTranslationColormap(skinnum, skincolor, GTC_CACHE);

View File

@ -413,6 +413,7 @@ UINT16 W_LoadWadFile(const char *filename)
lump_p->disksize -= 4; lump_p->disksize -= 4;
} }
else lump_p->compressed = 0; else lump_p->compressed = 0;
memset(lump_p->name, 0x00, 9);
strncpy(lump_p->name, fileinfo->name, 8); strncpy(lump_p->name, fileinfo->name, 8);
} }
free(fileinfov); free(fileinfov);

Binary file not shown.

Before

Width:  |  Height:  |  Size: 5.9 KiB

After

Width:  |  Height:  |  Size: 364 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.2 KiB

After

Width:  |  Height:  |  Size: 364 KiB

View File

@ -351,6 +351,13 @@ int main(int argc, char** argv)
return 0; return 0;
} }
static void *cpu_cpy(void *dest, const void *src, size_t n)
{
return memcpy(dest, src, n);
}
void *(*M_Memcpy)(void* dest, const void* src, size_t n) = cpu_cpy;
void I_Error(const char *error, ...) void I_Error(const char *error, ...)
{ {
(void)error; (void)error;