mirror of
https://git.do.srb2.org/STJr/SRB2.git
synced 2025-03-13 14:25:10 +00:00
Merge branch 'next' of http://git.magicalgirl.moe/STJr/SRB2.git into lua-sector-lines
This commit is contained in:
commit
103027124b
71 changed files with 7486 additions and 3714 deletions
|
@ -103,7 +103,8 @@ set(GIT_EXECUTABLE "git" CACHE FILEPATH "Path to git binary")
|
||||||
include(GitUtilities)
|
include(GitUtilities)
|
||||||
git_describe(SRB2_GIT_DESCRIBE "${CMAKE_SOURCE_DIR}")
|
git_describe(SRB2_GIT_DESCRIBE "${CMAKE_SOURCE_DIR}")
|
||||||
git_current_branch(SRB2_GIT_BRANCH "${CMAKE_SOURCE_DIR}")
|
git_current_branch(SRB2_GIT_BRANCH "${CMAKE_SOURCE_DIR}")
|
||||||
set(SRB2_COMP_REVISION "${SRB2_GIT_DESCRIBE}-<${SRB2_GIT_BRANCH}>")
|
set(SRB2_COMP_BRANCH "${SRB2_GIT_BRANCH}")
|
||||||
|
set(SRB2_COMP_REVISION "${SRB2_GIT_DESCRIBE}")
|
||||||
configure_file(${CMAKE_CURRENT_SOURCE_DIR}/src/config.h.in ${CMAKE_CURRENT_BINARY_DIR}/src/config.h)
|
configure_file(${CMAKE_CURRENT_SOURCE_DIR}/src/config.h.in ${CMAKE_CURRENT_BINARY_DIR}/src/config.h)
|
||||||
|
|
||||||
##### PACKAGE CONFIGURATION #####
|
##### PACKAGE CONFIGURATION #####
|
||||||
|
|
30
comptime.bat
30
comptime.bat
|
@ -1,10 +1,32 @@
|
||||||
@ECHO OFF
|
@ECHO OFF
|
||||||
set REV=Unknown
|
set BRA=Unknown
|
||||||
|
set REV=illegal
|
||||||
|
|
||||||
copy nul: /b +%1\comptime.c tmp.$$$ > nul
|
copy nul: /b +%1\comptime.c tmp.$$$ > nul
|
||||||
move tmp.$$$ %1\comptime.c > nul
|
move tmp.$$$ %1\comptime.c > nul
|
||||||
SET REV=illegal
|
|
||||||
FOR /F "usebackq" %%s IN (`svnversion %1`) DO @SET REV=%%s
|
if exist .git goto gitrev
|
||||||
|
if exist ..\.git goto gitrev
|
||||||
|
if exist .svn goto svnrev
|
||||||
|
goto filwri
|
||||||
|
|
||||||
|
:gitrev
|
||||||
|
set GIT=%2
|
||||||
|
if "%GIT%"=="" set GIT=git
|
||||||
|
FOR /F "usebackq" %%s IN (`%GIT% rev-parse --abbrev-ref HEAD`) DO @SET BRA=%%s
|
||||||
|
FOR /F "usebackq" %%s IN (`%GIT% rev-parse HEAD`) DO @SET REV=%%s
|
||||||
|
set REV=%REV:~0,8%
|
||||||
|
goto filwri
|
||||||
|
|
||||||
|
:svnrev
|
||||||
|
set BRA=Subversion
|
||||||
|
FOR /F "usebackq" %%s IN (`svnversion .`) DO @SET REV=%%s
|
||||||
|
set REV=r%REV%
|
||||||
|
goto filwri
|
||||||
|
|
||||||
|
:filwri
|
||||||
ECHO // Do not edit! This file was autogenerated > %1\comptime.h
|
ECHO // Do not edit! This file was autogenerated > %1\comptime.h
|
||||||
ECHO // by the %0 batch file >> %1\comptime.h
|
ECHO // by the %0 batch file >> %1\comptime.h
|
||||||
ECHO // >> %1\comptime.h
|
ECHO // >> %1\comptime.h
|
||||||
ECHO const char* comprevision = "r%REV%"; >> %1\comptime.h
|
ECHO const char* compbranch = "%BRA%"; >> %1\comptime.h
|
||||||
|
ECHO const char* comprevision = "%REV%"; >> %1\comptime.h
|
||||||
|
|
10
comptime.sh
10
comptime.sh
|
@ -5,13 +5,15 @@ if [ x"$1" != x ]; then
|
||||||
fi
|
fi
|
||||||
|
|
||||||
versiongit() {
|
versiongit() {
|
||||||
gitversion=`git describe`
|
gitbranch=`git rev-parse --abbrev-ref HEAD`
|
||||||
|
gitversion=`git rev-parse HEAD`
|
||||||
cat <<EOF > $path/comptime.h
|
cat <<EOF > $path/comptime.h
|
||||||
|
|
||||||
// Do not edit! This file was autogenerated
|
// Do not edit! This file was autogenerated
|
||||||
// by the $0 script with git svn
|
// by the $0 script with git
|
||||||
//
|
//
|
||||||
const char* comprevision = "$gitversion";
|
const char* compbranch = "$gitbranch";
|
||||||
|
const char* comprevision = "${gitversion:0:8}";
|
||||||
EOF
|
EOF
|
||||||
exit 0
|
exit 0
|
||||||
}
|
}
|
||||||
|
@ -23,6 +25,7 @@ versionsvn() {
|
||||||
// Do not edit! This file was autogenerated
|
// Do not edit! This file was autogenerated
|
||||||
// by the $0 script with subversion
|
// by the $0 script with subversion
|
||||||
//
|
//
|
||||||
|
const char* compbranch = "Subversion";
|
||||||
const char* comprevision = "r$svnrevision";
|
const char* comprevision = "r$svnrevision";
|
||||||
EOF
|
EOF
|
||||||
exit 0
|
exit 0
|
||||||
|
@ -34,6 +37,7 @@ versionfake() {
|
||||||
// Do not edit! This file was autogenerated
|
// Do not edit! This file was autogenerated
|
||||||
// by the $0 script with an unknown or nonexist SCM
|
// by the $0 script with an unknown or nonexist SCM
|
||||||
//
|
//
|
||||||
|
const char* compbranch = "Unknown";
|
||||||
const char* comprevision = "illegal";
|
const char* comprevision = "illegal";
|
||||||
EOF
|
EOF
|
||||||
}
|
}
|
||||||
|
|
|
@ -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
|
||||||
)
|
)
|
||||||
|
|
|
@ -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 \
|
||||||
|
|
|
@ -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)
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -9,12 +9,14 @@
|
||||||
|
|
||||||
#if (defined(CMAKECONFIG))
|
#if (defined(CMAKECONFIG))
|
||||||
#include "config.h"
|
#include "config.h"
|
||||||
|
const char *compbranch = SRB2_COMP_BRANCH;
|
||||||
const char *comprevision = SRB2_COMP_REVISION;
|
const char *comprevision = SRB2_COMP_REVISION;
|
||||||
|
|
||||||
#elif (defined(COMPVERSION))
|
#elif (defined(COMPVERSION))
|
||||||
#include "comptime.h"
|
#include "comptime.h"
|
||||||
|
|
||||||
#else
|
#else
|
||||||
|
const char *compbranch = "Unknown";
|
||||||
const char *comprevision = "illegal";
|
const char *comprevision = "illegal";
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -18,6 +18,7 @@
|
||||||
#define ASSET_HASH_PATCH_DTA "${SRB2_ASSET_patch.dta_HASH}"
|
#define ASSET_HASH_PATCH_DTA "${SRB2_ASSET_patch.dta_HASH}"
|
||||||
|
|
||||||
#define SRB2_COMP_REVISION "${SRB2_COMP_REVISION}"
|
#define SRB2_COMP_REVISION "${SRB2_COMP_REVISION}"
|
||||||
|
#define SRB2_COMP_BRANCH "${SRB2_COMP_BRANCH}"
|
||||||
#define SRB2_GIT_DESCRIBE "${SRB2_GIT_DESCRIBE}"
|
#define SRB2_GIT_DESCRIBE "${SRB2_GIT_DESCRIBE}"
|
||||||
#define SRB2_GIT_BRANCH "${SRB2_GIT_BRANCH}"
|
#define SRB2_GIT_BRANCH "${SRB2_GIT_BRANCH}"
|
||||||
|
|
||||||
|
|
|
@ -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
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -3179,7 +3179,11 @@ static void Command_ListWADS_f(void)
|
||||||
*/
|
*/
|
||||||
static void Command_Version_f(void)
|
static void Command_Version_f(void)
|
||||||
{
|
{
|
||||||
|
#ifdef DEVELOP
|
||||||
|
CONS_Printf("Sonic Robo Blast 2 %s-%s (%s %s)\n", compbranch, comprevision, compdate, comptime);
|
||||||
|
#else
|
||||||
CONS_Printf("Sonic Robo Blast 2 %s (%s %s %s)\n", VERSIONSTRING, compdate, comptime, comprevision);
|
CONS_Printf("Sonic Robo Blast 2 %s (%s %s %s)\n", VERSIONSTRING, compdate, comptime, comprevision);
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef UPDATE_ALERT
|
#ifdef UPDATE_ALERT
|
||||||
|
|
|
@ -1132,6 +1132,10 @@ static void readlevelheader(MYFILE *f, INT32 num)
|
||||||
}
|
}
|
||||||
else if (fastcmp(word, "NEXTLEVEL"))
|
else if (fastcmp(word, "NEXTLEVEL"))
|
||||||
{
|
{
|
||||||
|
if (fastcmp(word2, "TITLE")) i = 1100;
|
||||||
|
else if (fastcmp(word2, "EVALUATION")) i = 1101;
|
||||||
|
else if (fastcmp(word2, "CREDITS")) i = 1102;
|
||||||
|
else
|
||||||
// Support using the actual map name,
|
// Support using the actual map name,
|
||||||
// i.e., Nextlevel = AB, Nextlevel = FZ, etc.
|
// i.e., Nextlevel = AB, Nextlevel = FZ, etc.
|
||||||
|
|
||||||
|
@ -7207,6 +7211,7 @@ static const char *const MOBJEFLAG_LIST[] = {
|
||||||
"GOOWATER", // Goo water
|
"GOOWATER", // Goo water
|
||||||
"PUSHED", // Mobj was already pushed this tic
|
"PUSHED", // Mobj was already pushed this tic
|
||||||
"SPRUNG", // Mobj was already sprung this tic
|
"SPRUNG", // Mobj was already sprung this tic
|
||||||
|
"APPLYPMOMZ", // Platform movement
|
||||||
NULL
|
NULL
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -7756,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},
|
||||||
|
|
|
@ -142,8 +142,10 @@ extern FILE *logstream;
|
||||||
#ifdef DEVELOP
|
#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 "Development EXE"
|
||||||
#define VERSIONSTRINGW L"Trunk"
|
#define VERSIONSTRINGW L"Development EXE"
|
||||||
|
// most interface strings are ignored in development mode.
|
||||||
|
// we use comprevision and compbranch instead.
|
||||||
#else
|
#else
|
||||||
#define VERSION 201 // Game version
|
#define VERSION 201 // Game version
|
||||||
#define SUBVERSION 14 // more precise version number
|
#define SUBVERSION 14 // more precise version number
|
||||||
|
@ -426,7 +428,7 @@ INT32 I_GetKey(void);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
// Compile date and time and revision.
|
// Compile date and time and revision.
|
||||||
extern const char *compdate, *comptime, *comprevision;
|
extern const char *compdate, *comptime, *comprevision, *compbranch;
|
||||||
|
|
||||||
// Disabled code and code under testing
|
// Disabled code and code under testing
|
||||||
// None of these that are disabled in the normal build are guaranteed to work perfectly
|
// None of these that are disabled in the normal build are guaranteed to work perfectly
|
||||||
|
@ -439,6 +441,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
|
||||||
|
|
|
@ -100,11 +100,13 @@ typedef long ssize_t;
|
||||||
|
|
||||||
#if defined (_MSC_VER) || defined (__OS2__)
|
#if defined (_MSC_VER) || defined (__OS2__)
|
||||||
// Microsoft VisualC++
|
// Microsoft VisualC++
|
||||||
|
#ifdef _MSC_VER
|
||||||
#if (_MSC_VER <= 1800) // MSVC 2013 and back
|
#if (_MSC_VER <= 1800) // MSVC 2013 and back
|
||||||
#define snprintf _snprintf
|
#define snprintf _snprintf
|
||||||
#if (_MSC_VER <= 1200) // MSVC 2012 and back
|
#if (_MSC_VER <= 1200) // MSVC 2012 and back
|
||||||
#define vsnprintf _vsnprintf
|
#define vsnprintf _vsnprintf
|
||||||
#endif
|
#endif
|
||||||
|
#endif
|
||||||
#endif
|
#endif
|
||||||
#define strncasecmp strnicmp
|
#define strncasecmp strnicmp
|
||||||
#define strcasecmp stricmp
|
#define strcasecmp stricmp
|
||||||
|
@ -177,6 +179,8 @@ size_t strlcpy(char *dst, const char *src, size_t siz);
|
||||||
// not the number of bytes in the buffer.
|
// not the number of bytes in the buffer.
|
||||||
#define STRBUFCPY(dst,src) strlcpy(dst, src, sizeof dst)
|
#define STRBUFCPY(dst,src) strlcpy(dst, src, sizeof dst)
|
||||||
|
|
||||||
|
// \note __BYTEBOOL__ used to be set above if "macintosh" was defined,
|
||||||
|
// if macintosh's version of boolean type isn't needed anymore, then isn't this macro pointless now?
|
||||||
#ifndef __BYTEBOOL__
|
#ifndef __BYTEBOOL__
|
||||||
#define __BYTEBOOL__
|
#define __BYTEBOOL__
|
||||||
|
|
||||||
|
@ -193,7 +197,6 @@ size_t strlcpy(char *dst, const char *src, size_t siz);
|
||||||
#else
|
#else
|
||||||
typedef enum {false, true} boolean;
|
typedef enum {false, true} boolean;
|
||||||
#endif
|
#endif
|
||||||
//#endif // __cplusplus
|
|
||||||
#endif // __BYTEBOOL__
|
#endif // __BYTEBOOL__
|
||||||
|
|
||||||
/* 7.18.2.1 Limits of exact-width integer types */
|
/* 7.18.2.1 Limits of exact-width integer types */
|
||||||
|
|
|
@ -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",
|
||||||
|
|
40
src/f_wipe.c
40
src/f_wipe.c
|
@ -231,34 +231,52 @@ static void F_DoWipe(fademask_t *fademask)
|
||||||
maskx = masky = 0;
|
maskx = masky = 0;
|
||||||
do
|
do
|
||||||
{
|
{
|
||||||
// pointer to transtable that this mask would use
|
|
||||||
transtbl = transtables + ((9 - *mask)<<FF_TRANSSHIFT);
|
|
||||||
// (ignore that it goes out of bounds if *mask is 0 or 10 --
|
|
||||||
// it wouldn't be used in those cases anyway)
|
|
||||||
|
|
||||||
draw_rowstart = scrxpos[maskx];
|
draw_rowstart = scrxpos[maskx];
|
||||||
draw_rowend = scrxpos[maskx + 1];
|
draw_rowend = scrxpos[maskx + 1];
|
||||||
draw_linestart = scrypos[masky];
|
draw_linestart = scrypos[masky];
|
||||||
draw_lineend = scrypos[masky + 1];
|
draw_lineend = scrypos[masky + 1];
|
||||||
|
|
||||||
// DRAWING LOOP
|
|
||||||
relativepos = (draw_linestart * vid.width) + draw_rowstart;
|
relativepos = (draw_linestart * vid.width) + draw_rowstart;
|
||||||
draw_linestogo = draw_lineend - draw_linestart;
|
draw_linestogo = draw_lineend - draw_linestart;
|
||||||
|
|
||||||
|
if (*mask == 0)
|
||||||
|
{
|
||||||
|
// shortcut - memcpy source to work
|
||||||
|
while (draw_linestogo--)
|
||||||
|
{
|
||||||
|
M_Memcpy(w_base+relativepos, s_base+relativepos, draw_rowend-draw_rowstart);
|
||||||
|
relativepos += vid.width;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else if (*mask == 10)
|
||||||
|
{
|
||||||
|
// shortcut - memcpy target to work
|
||||||
|
while (draw_linestogo--)
|
||||||
|
{
|
||||||
|
M_Memcpy(w_base+relativepos, e_base+relativepos, draw_rowend-draw_rowstart);
|
||||||
|
relativepos += vid.width;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
// pointer to transtable that this mask would use
|
||||||
|
transtbl = transtables + ((9 - *mask)<<FF_TRANSSHIFT);
|
||||||
|
|
||||||
|
// DRAWING LOOP
|
||||||
while (draw_linestogo--)
|
while (draw_linestogo--)
|
||||||
{
|
{
|
||||||
w = w_base + relativepos;
|
w = w_base + relativepos;
|
||||||
s = s_base + relativepos;
|
s = s_base + relativepos;
|
||||||
e = e_base + relativepos;
|
e = e_base + relativepos;
|
||||||
draw_rowstogo = draw_rowend - draw_rowstart;
|
draw_rowstogo = draw_rowend - draw_rowstart;
|
||||||
|
|
||||||
while (draw_rowstogo--)
|
while (draw_rowstogo--)
|
||||||
{
|
*w++ = transtbl[ ( *e++ << 8 ) + *s++ ];
|
||||||
if (*s != *e)
|
|
||||||
*w = ((*mask == 0) ? *s : (*mask == 10) ? *e : transtbl[(*e<<8) + *s]);
|
|
||||||
++w, ++s, ++e;
|
|
||||||
}
|
|
||||||
relativepos += vid.width;
|
relativepos += vid.width;
|
||||||
}
|
}
|
||||||
// END DRAWING LOOP
|
// END DRAWING LOOP
|
||||||
|
}
|
||||||
|
|
||||||
if (++maskx >= fademask->width)
|
if (++maskx >= fademask->width)
|
||||||
++masky, maskx = 0;
|
++masky, maskx = 0;
|
||||||
|
|
|
@ -297,9 +297,6 @@ static CV_PossibleValue_t joyaxis_cons_t[] = {{0, "None"},
|
||||||
#if JOYAXISSET > 3
|
#if JOYAXISSET > 3
|
||||||
{7, "Pitch"}, {8, "Roll"}, {-7, "Pitch-"}, {-8, "Roll-"},
|
{7, "Pitch"}, {8, "Roll"}, {-7, "Pitch-"}, {-8, "Roll-"},
|
||||||
#endif
|
#endif
|
||||||
#if JOYAXISSET > 3
|
|
||||||
{7, "Pitch"}, {8, "Roll"}, {-7, "Pitch-"}, {-8, "Roll-"},
|
|
||||||
#endif
|
|
||||||
#if JOYAXISSET > 4
|
#if JOYAXISSET > 4
|
||||||
{7, "Yaw"}, {8, "Dummy"}, {-7, "Yaw-"}, {-8, "Dummy-"},
|
{7, "Yaw"}, {8, "Dummy"}, {-7, "Yaw-"}, {-8, "Dummy-"},
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -79,6 +79,7 @@ typedef struct gr_vissprite_s
|
||||||
boolean vflip;
|
boolean vflip;
|
||||||
//Hurdler: 25/04/2000: now support colormap in hardware mode
|
//Hurdler: 25/04/2000: now support colormap in hardware mode
|
||||||
UINT8 *colormap;
|
UINT8 *colormap;
|
||||||
|
INT32 dispoffset; // copy of info->dispoffset, affects ordering but not drawing
|
||||||
} gr_vissprite_t;
|
} gr_vissprite_t;
|
||||||
|
|
||||||
// --------
|
// --------
|
||||||
|
|
|
@ -3998,6 +3998,7 @@ static void HWR_SortVisSprites(void)
|
||||||
gr_vissprite_t *best = NULL;
|
gr_vissprite_t *best = NULL;
|
||||||
gr_vissprite_t unsorted;
|
gr_vissprite_t unsorted;
|
||||||
float bestdist;
|
float bestdist;
|
||||||
|
INT32 bestdispoffset;
|
||||||
|
|
||||||
if (!gr_visspritecount)
|
if (!gr_visspritecount)
|
||||||
return;
|
return;
|
||||||
|
@ -4025,11 +4026,19 @@ static void HWR_SortVisSprites(void)
|
||||||
for (i = 0; i < gr_visspritecount; i++)
|
for (i = 0; i < gr_visspritecount; i++)
|
||||||
{
|
{
|
||||||
bestdist = ZCLIP_PLANE-1;
|
bestdist = ZCLIP_PLANE-1;
|
||||||
|
bestdispoffset = INT32_MAX;
|
||||||
for (ds = unsorted.next; ds != &unsorted; ds = ds->next)
|
for (ds = unsorted.next; ds != &unsorted; ds = ds->next)
|
||||||
{
|
{
|
||||||
if (ds->tz > bestdist)
|
if (ds->tz > bestdist)
|
||||||
{
|
{
|
||||||
bestdist = ds->tz;
|
bestdist = ds->tz;
|
||||||
|
bestdispoffset = ds->dispoffset;
|
||||||
|
best = ds;
|
||||||
|
}
|
||||||
|
// order visprites of same scale by dispoffset, smallest first
|
||||||
|
else if (ds->tz == bestdist && ds->dispoffset < bestdispoffset)
|
||||||
|
{
|
||||||
|
bestdispoffset = ds->dispoffset;
|
||||||
best = ds;
|
best = ds;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -4653,6 +4662,7 @@ static void HWR_ProjectSprite(mobj_t *thing)
|
||||||
#endif
|
#endif
|
||||||
vis->x2 = tx;
|
vis->x2 = tx;
|
||||||
vis->tz = tz;
|
vis->tz = tz;
|
||||||
|
vis->dispoffset = thing->info->dispoffset; // Monster Iestyn: 23/11/15: HARDWARE SUPPORT AT LAST
|
||||||
vis->patchlumpnum = sprframe->lumppat[rot];
|
vis->patchlumpnum = sprframe->lumppat[rot];
|
||||||
vis->flip = flip;
|
vis->flip = flip;
|
||||||
vis->mobj = thing;
|
vis->mobj = thing;
|
||||||
|
@ -4769,6 +4779,7 @@ static void HWR_ProjectPrecipitationSprite(precipmobj_t *thing)
|
||||||
vis->x1 = x1;
|
vis->x1 = x1;
|
||||||
vis->x2 = tx;
|
vis->x2 = tx;
|
||||||
vis->tz = tz;
|
vis->tz = tz;
|
||||||
|
vis->dispoffset = 0; // Monster Iestyn: 23/11/15: HARDWARE SUPPORT AT LAST
|
||||||
vis->patchlumpnum = sprframe->lumppat[rot];
|
vis->patchlumpnum = sprframe->lumppat[rot];
|
||||||
vis->flip = flip;
|
vis->flip = flip;
|
||||||
vis->mobj = (mobj_t *)thing;
|
vis->mobj = (mobj_t *)thing;
|
||||||
|
|
|
@ -1085,7 +1085,7 @@ void HWR_DrawMD2(gr_vissprite_t *spr)
|
||||||
if (!cv_grmd2.value)
|
if (!cv_grmd2.value)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if (!spr->precip)
|
if (spr->precip)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
// MD2 colormap fix
|
// MD2 colormap fix
|
||||||
|
|
|
@ -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
|
||||||
|
@ -1209,8 +1202,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 +1478,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 +1653,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 +1854,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},
|
||||||
|
|
|
@ -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
|
@ -674,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;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -701,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;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -137,8 +137,6 @@ static void A_Lua(mobj_t *actor)
|
||||||
--superstack;
|
--superstack;
|
||||||
superactions[superstack] = NULL;
|
superactions[superstack] = NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
lua_gc(gL, LUA_GCSTEP, 1);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Arbitrary states[] table index -> state_t *
|
// Arbitrary states[] table index -> state_t *
|
||||||
|
@ -510,11 +508,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 +578,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 +654,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"))
|
||||||
|
|
|
@ -325,10 +325,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;
|
||||||
|
@ -444,26 +444,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:
|
||||||
|
@ -557,10 +561,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);
|
||||||
|
@ -676,10 +680,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);
|
||||||
|
@ -706,6 +710,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));
|
||||||
|
@ -733,13 +781,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;
|
||||||
|
@ -1002,7 +1050,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;
|
||||||
|
@ -1016,7 +1064,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;
|
||||||
|
@ -1075,14 +1123,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 = §ors[ffloor->secnum];
|
sector_t *sector = §ors[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:
|
||||||
|
@ -1094,14 +1144,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 = §ors[ffloor->secnum];
|
sector_t *sector = §ors[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:
|
||||||
|
@ -1267,6 +1319,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);
|
||||||
|
|
|
@ -47,37 +47,39 @@ 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));
|
// HACK: add ANGLE_90 to make tan() in Lua start at 0 like it should
|
||||||
|
// use & 4095 instead of & FINEMASK (8191), so it doesn't go out of the array's bounds
|
||||||
|
lua_pushfixed(L, FINETANGENT(((luaL_checkangle(L, 1)+ANGLE_90)>>ANGLETOFINESHIFT) & 4095));
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -86,61 +88,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 +158,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;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -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);
|
||||||
|
@ -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);
|
||||||
|
|
|
@ -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);
|
||||||
|
|
|
@ -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;
|
||||||
|
|
|
@ -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
|
||||||
|
|
|
@ -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);
|
||||||
|
|
|
@ -880,12 +880,33 @@ static boolean OP_HeightOkay(player_t *player, UINT8 ceiling)
|
||||||
|
|
||||||
static mapthing_t *OP_CreateNewMapThing(player_t *player, UINT16 type, boolean ceiling)
|
static mapthing_t *OP_CreateNewMapThing(player_t *player, UINT16 type, boolean ceiling)
|
||||||
{
|
{
|
||||||
mapthing_t *mt;
|
mapthing_t *mt = mapthings;
|
||||||
|
|
||||||
#ifdef HAVE_BLUA
|
#ifdef HAVE_BLUA
|
||||||
LUA_InvalidateMapthings();
|
LUA_InvalidateMapthings();
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
mapthings = Z_Realloc(mapthings, ++nummapthings * sizeof (*mapthings), PU_LEVEL, NULL);
|
mapthings = Z_Realloc(mapthings, ++nummapthings * sizeof (*mapthings), PU_LEVEL, NULL);
|
||||||
|
|
||||||
|
// as Z_Realloc can relocate mapthings, quickly go through thinker list and correct
|
||||||
|
// the spawnpoints of any objects that have them to the new location
|
||||||
|
if (mt != mapthings)
|
||||||
|
{
|
||||||
|
thinker_t *th;
|
||||||
|
mobj_t *mo;
|
||||||
|
|
||||||
|
for (th = thinkercap.next; th != &thinkercap; th = th->next)
|
||||||
|
{
|
||||||
|
if (th->function.acp1 != (actionf_p1)P_MobjThinker)
|
||||||
|
continue;
|
||||||
|
|
||||||
|
mo = (mobj_t *)th;
|
||||||
|
// get offset from mt, which points to old mapthings, then add new location
|
||||||
|
if (mo->spawnpoint)
|
||||||
|
mo->spawnpoint = (mo->spawnpoint - mt) + mapthings;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
mt = (mapthings+nummapthings-1);
|
mt = (mapthings+nummapthings-1);
|
||||||
|
|
||||||
mt->type = type;
|
mt->type = type;
|
||||||
|
|
|
@ -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
|
||||||
|
|
|
@ -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
|
||||||
|
|
12
src/m_menu.c
12
src/m_menu.c
|
@ -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;
|
||||||
|
|
||||||
|
@ -2460,13 +2463,16 @@ void M_Drawer(void)
|
||||||
V_DrawThinString(vid.dupx, vid.height - 9*vid.dupy, V_NOSCALESTART|V_TRANSLUCENT|V_ALLOWLOWERCASE, customversionstring);
|
V_DrawThinString(vid.dupx, vid.height - 9*vid.dupy, V_NOSCALESTART|V_TRANSLUCENT|V_ALLOWLOWERCASE, customversionstring);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
#if VERSION > 0 || SUBVERSION > 0
|
{
|
||||||
|
#ifdef DEVELOP // Development -- show revision / branch info
|
||||||
|
V_DrawThinString(vid.dupx, vid.height - 17*vid.dupy, V_NOSCALESTART|V_TRANSLUCENT|V_ALLOWLOWERCASE, compbranch);
|
||||||
|
V_DrawThinString(vid.dupx, vid.height - 9*vid.dupy, V_NOSCALESTART|V_TRANSLUCENT|V_ALLOWLOWERCASE, comprevision);
|
||||||
|
#else // Regular build
|
||||||
V_DrawThinString(vid.dupx, vid.height - 9*vid.dupy, V_NOSCALESTART|V_TRANSLUCENT|V_ALLOWLOWERCASE, va("%s", VERSIONSTRING));
|
V_DrawThinString(vid.dupx, vid.height - 9*vid.dupy, V_NOSCALESTART|V_TRANSLUCENT|V_ALLOWLOWERCASE, va("%s", VERSIONSTRING));
|
||||||
#else // Trunk build, show revision info
|
|
||||||
V_DrawThinString(vid.dupx, vid.height - 9*vid.dupy, V_NOSCALESTART|V_TRANSLUCENT|V_ALLOWLOWERCASE, va("%s (%s)", VERSIONSTRING, comprevision));
|
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
// M_StartControlPanel
|
// M_StartControlPanel
|
||||||
|
|
10
src/m_misc.c
10
src/m_misc.c
|
@ -1800,16 +1800,14 @@ UINT8 M_HighestBit(UINT32 num)
|
||||||
|
|
||||||
const char *GetRevisionString(void)
|
const char *GetRevisionString(void)
|
||||||
{
|
{
|
||||||
INT32 vinfo;
|
static char rev[9] = {0};
|
||||||
static char rev[8] = {0};
|
|
||||||
if (rev[0])
|
if (rev[0])
|
||||||
return rev;
|
return rev;
|
||||||
|
|
||||||
vinfo = atoi(&comprevision[1]);
|
if (comprevision[0] == 'r')
|
||||||
if (vinfo)
|
strncpy(rev, comprevision, 7);
|
||||||
snprintf(rev, 7, "r%d", vinfo);
|
|
||||||
else
|
else
|
||||||
strcpy(rev, "rNULL");
|
snprintf(rev, 7, "r%s", comprevision);
|
||||||
rev[7] = '\0';
|
rev[7] = '\0';
|
||||||
|
|
||||||
return rev;
|
return rev;
|
||||||
|
|
|
@ -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);
|
||||||
}
|
}
|
||||||
|
@ -7592,48 +7597,35 @@ void A_SetTargetsTarget(mobj_t *actor)
|
||||||
{
|
{
|
||||||
INT32 locvar1 = var1;
|
INT32 locvar1 = var1;
|
||||||
INT32 locvar2 = var2;
|
INT32 locvar2 = var2;
|
||||||
mobj_t *targetedmobj = NULL;
|
mobj_t *oldtarg = NULL, *newtarg = NULL;
|
||||||
thinker_t *th;
|
|
||||||
mobj_t *mo2;
|
|
||||||
#ifdef HAVE_BLUA
|
#ifdef HAVE_BLUA
|
||||||
if (LUA_CallAction("A_SetTargetsTarget", actor))
|
if (LUA_CallAction("A_SetTargetsTarget", actor))
|
||||||
return;
|
return;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
if ((!locvar1 && (!actor->target)) || (locvar1 && (!actor->tracer)))
|
// actor's target
|
||||||
|
if (locvar1) // or tracer
|
||||||
|
oldtarg = actor->tracer;
|
||||||
|
else
|
||||||
|
oldtarg = actor->target;
|
||||||
|
|
||||||
|
if (P_MobjWasRemoved(oldtarg))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if ((!locvar1 && !locvar2 && (!actor->target->target))
|
// actor's target's target!
|
||||||
|| (!locvar1 && locvar2 && (!actor->target->tracer))
|
if (locvar2) // or tracer
|
||||||
|| (locvar1 && !locvar2 && (!actor->tracer->target))
|
newtarg = oldtarg->tracer;
|
||||||
|| (locvar1 && locvar2 && (!actor->tracer->tracer)))
|
|
||||||
return; // Don't search for nothing.
|
|
||||||
|
|
||||||
// scan the thinkers
|
|
||||||
for (th = thinkercap.next; th != &thinkercap; th = th->next)
|
|
||||||
{
|
|
||||||
if (th->function.acp1 != (actionf_p1)P_MobjThinker)
|
|
||||||
continue;
|
|
||||||
|
|
||||||
mo2 = (mobj_t *)th;
|
|
||||||
|
|
||||||
if ((!locvar1 && !locvar2 && (mo2 == actor->target->target))
|
|
||||||
|| (!locvar1 && locvar2 && (mo2 == actor->target->tracer))
|
|
||||||
|| (locvar1 && !locvar2 && (mo2 == actor->tracer->target))
|
|
||||||
|| (locvar1 && locvar2 && (mo2 == actor->tracer->tracer)))
|
|
||||||
{
|
|
||||||
targetedmobj = mo2;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!targetedmobj)
|
|
||||||
return; // Oops, nothing found..
|
|
||||||
|
|
||||||
if (!locvar1)
|
|
||||||
P_SetTarget(&actor->target, targetedmobj);
|
|
||||||
else
|
else
|
||||||
P_SetTarget(&actor->tracer, targetedmobj);
|
newtarg = oldtarg->target;
|
||||||
|
|
||||||
|
if (P_MobjWasRemoved(newtarg))
|
||||||
|
return;
|
||||||
|
|
||||||
|
// set actor's new target
|
||||||
|
if (locvar1) // or tracer
|
||||||
|
P_SetTarget(&actor->tracer, newtarg);
|
||||||
|
else
|
||||||
|
P_SetTarget(&actor->target, newtarg);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Function: A_SetObjectFlags
|
// Function: A_SetObjectFlags
|
||||||
|
@ -7650,25 +7642,32 @@ 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
|
||||||
|
|
||||||
|
if (locvar2 == 2)
|
||||||
|
locvar1 = actor->flags | locvar1;
|
||||||
|
else if (locvar2 == 1)
|
||||||
|
locvar1 = actor->flags & ~locvar1;
|
||||||
|
|
||||||
|
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);
|
P_UnsetThingPosition(actor);
|
||||||
if (sector_list)
|
if (sector_list)
|
||||||
{
|
{
|
||||||
P_DelSeclist(sector_list);
|
P_DelSeclist(sector_list);
|
||||||
sector_list = NULL;
|
sector_list = NULL;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if (locvar2 == 2)
|
|
||||||
actor->flags |= locvar1;
|
|
||||||
else if (locvar2 == 1)
|
|
||||||
actor->flags &= ~locvar1;
|
|
||||||
else
|
|
||||||
actor->flags = locvar1;
|
actor->flags = locvar1;
|
||||||
|
|
||||||
|
if (unlinkthings)
|
||||||
P_SetThingPosition(actor);
|
P_SetThingPosition(actor);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -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,7 +1213,7 @@ 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;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -2087,6 +2092,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++)
|
||||||
{
|
{
|
||||||
|
@ -2151,10 +2157,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))
|
||||||
|
@ -2314,7 +2323,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;
|
||||||
|
|
121
src/p_inter.c
121
src/p_inter.c
|
@ -1478,7 +1478,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
|
||||||
|
|
||||||
|
@ -1641,11 +1641,126 @@ static void P_HitDeathMessages(player_t *player, mobj_t *inflictor, mobj_t *sour
|
||||||
CONS_Printf(str, targetname, deadtarget ? M_GetText("killed") : M_GetText("hit"));
|
CONS_Printf(str, targetname, deadtarget ? M_GetText("killed") : M_GetText("hit"));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/** Checks if the level timer is over the timelimit and the round should end,
|
||||||
|
* unless you are in overtime. In which case leveltime may stretch out beyond
|
||||||
|
* timelimitintics and overtime's status will be checked here each tick.
|
||||||
|
* Verify that the value of ::cv_timelimit is greater than zero before
|
||||||
|
* calling this function.
|
||||||
|
*
|
||||||
|
* \sa cv_timelimit, P_CheckPointLimit, P_UpdateSpecials
|
||||||
|
*/
|
||||||
|
void P_CheckTimeLimit(void)
|
||||||
|
{
|
||||||
|
INT32 i, k;
|
||||||
|
|
||||||
|
if (!cv_timelimit.value)
|
||||||
|
return;
|
||||||
|
|
||||||
|
if (!(multiplayer || netgame))
|
||||||
|
return;
|
||||||
|
|
||||||
|
if (G_PlatformGametype())
|
||||||
|
return;
|
||||||
|
|
||||||
|
if (leveltime < timelimitintics)
|
||||||
|
return;
|
||||||
|
|
||||||
|
if (gameaction == ga_completed)
|
||||||
|
return;
|
||||||
|
|
||||||
|
//Tagmode round end but only on the tic before the
|
||||||
|
//XD_EXITLEVEL packet is recieved by all players.
|
||||||
|
if (G_TagGametype())
|
||||||
|
{
|
||||||
|
if (leveltime == (timelimitintics + 1))
|
||||||
|
{
|
||||||
|
for (i = 0; i < MAXPLAYERS; i++)
|
||||||
|
{
|
||||||
|
if (!playeringame[i] || players[i].spectator
|
||||||
|
|| (players[i].pflags & PF_TAGGED) || (players[i].pflags & PF_TAGIT))
|
||||||
|
continue;
|
||||||
|
|
||||||
|
CONS_Printf(M_GetText("%s recieved double points for surviving the round.\n"), player_names[i]);
|
||||||
|
P_AddPlayerScore(&players[i], players[i].score);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (server)
|
||||||
|
SendNetXCmd(XD_EXITLEVEL, NULL, 0);
|
||||||
|
}
|
||||||
|
|
||||||
|
//Optional tie-breaker for Match/CTF
|
||||||
|
else if (cv_overtime.value)
|
||||||
|
{
|
||||||
|
INT32 playerarray[MAXPLAYERS];
|
||||||
|
INT32 tempplayer = 0;
|
||||||
|
INT32 spectators = 0;
|
||||||
|
INT32 playercount = 0;
|
||||||
|
|
||||||
|
//Figure out if we have enough participating players to care.
|
||||||
|
for (i = 0; i < MAXPLAYERS; i++)
|
||||||
|
{
|
||||||
|
if (playeringame[i] && players[i].spectator)
|
||||||
|
spectators++;
|
||||||
|
}
|
||||||
|
|
||||||
|
if ((D_NumPlayers() - spectators) > 1)
|
||||||
|
{
|
||||||
|
// Play the starpost sfx after the first second of overtime.
|
||||||
|
if (gamestate == GS_LEVEL && (leveltime == (timelimitintics + TICRATE)))
|
||||||
|
S_StartSound(NULL, sfx_strpst);
|
||||||
|
|
||||||
|
// Normal Match
|
||||||
|
if (!G_GametypeHasTeams())
|
||||||
|
{
|
||||||
|
//Store the nodes of participating players in an array.
|
||||||
|
for (i = 0; i < MAXPLAYERS; i++)
|
||||||
|
{
|
||||||
|
if (playeringame[i] && !players[i].spectator)
|
||||||
|
{
|
||||||
|
playerarray[playercount] = i;
|
||||||
|
playercount++;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
//Sort 'em.
|
||||||
|
for (i = 1; i < playercount; i++)
|
||||||
|
{
|
||||||
|
for (k = i; k < playercount; k++)
|
||||||
|
{
|
||||||
|
if (players[playerarray[i-1]].score < players[playerarray[k]].score)
|
||||||
|
{
|
||||||
|
tempplayer = playerarray[i-1];
|
||||||
|
playerarray[i-1] = playerarray[k];
|
||||||
|
playerarray[k] = tempplayer;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
//End the round if the top players aren't tied.
|
||||||
|
if (players[playerarray[0]].score == players[playerarray[1]].score)
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
//In team match and CTF, determining a tie is much simpler. =P
|
||||||
|
if (redscore == bluescore)
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (server)
|
||||||
|
SendNetXCmd(XD_EXITLEVEL, NULL, 0);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (server)
|
||||||
|
SendNetXCmd(XD_EXITLEVEL, NULL, 0);
|
||||||
|
}
|
||||||
|
|
||||||
/** Checks if a player's score is over the pointlimit and the round should end.
|
/** Checks if a player's score is over the pointlimit and the round should end.
|
||||||
* Verify that the value of ::cv_pointlimit is greater than zero before
|
* Verify that the value of ::cv_pointlimit is greater than zero before
|
||||||
* calling this function.
|
* calling this function.
|
||||||
*
|
*
|
||||||
* \sa cv_pointlimit, P_UpdateSpecials
|
* \sa cv_pointlimit, P_CheckTimeLimit, P_UpdateSpecials
|
||||||
*/
|
*/
|
||||||
void P_CheckPointLimit(void)
|
void P_CheckPointLimit(void)
|
||||||
{
|
{
|
||||||
|
@ -1988,7 +2103,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!
|
||||||
|
|
|
@ -217,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);
|
||||||
|
@ -276,8 +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 mobj_t *tmfloorthing, *tmthing;
|
extern mobj_t *tmfloorthing, *tmhitthing, *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);
|
||||||
|
@ -316,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
|
||||||
|
@ -358,6 +380,7 @@ void P_PlayerEmeraldBurst(player_t *player, boolean toss);
|
||||||
|
|
||||||
void P_TouchSpecialThing(mobj_t *special, mobj_t *toucher, boolean heightcheck);
|
void P_TouchSpecialThing(mobj_t *special, mobj_t *toucher, boolean heightcheck);
|
||||||
void P_PlayerFlagBurst(player_t *player, boolean toss);
|
void P_PlayerFlagBurst(player_t *player, boolean toss);
|
||||||
|
void P_CheckTimeLimit(void);
|
||||||
void P_CheckPointLimit(void);
|
void P_CheckPointLimit(void);
|
||||||
void P_CheckSurvivors(void);
|
void P_CheckSurvivors(void);
|
||||||
boolean P_CheckRacers(void);
|
boolean P_CheckRacers(void);
|
||||||
|
|
332
src/p_map.c
332
src/p_map.c
|
@ -27,6 +27,10 @@
|
||||||
|
|
||||||
#include "r_splats.h"
|
#include "r_splats.h"
|
||||||
|
|
||||||
|
#ifdef ESLOPE
|
||||||
|
#include "p_slopes.h"
|
||||||
|
#endif
|
||||||
|
|
||||||
#include "z_zone.h"
|
#include "z_zone.h"
|
||||||
|
|
||||||
#include "lua_hook.h"
|
#include "lua_hook.h"
|
||||||
|
@ -34,8 +38,8 @@
|
||||||
fixed_t tmbbox[4];
|
fixed_t tmbbox[4];
|
||||||
mobj_t *tmthing;
|
mobj_t *tmthing;
|
||||||
static INT32 tmflags;
|
static INT32 tmflags;
|
||||||
static fixed_t tmx;
|
fixed_t tmx;
|
||||||
static fixed_t tmy;
|
fixed_t tmy;
|
||||||
|
|
||||||
static precipmobj_t *tmprecipthing;
|
static precipmobj_t *tmprecipthing;
|
||||||
static fixed_t preciptmbbox[4];
|
static fixed_t preciptmbbox[4];
|
||||||
|
@ -47,7 +51,10 @@ boolean floatok;
|
||||||
fixed_t tmfloorz, tmceilingz;
|
fixed_t tmfloorz, tmceilingz;
|
||||||
static fixed_t tmdropoffz, tmdrpoffceilz; // drop-off floor/ceiling heights
|
static fixed_t tmdropoffz, tmdrpoffceilz; // drop-off floor/ceiling heights
|
||||||
mobj_t *tmfloorthing; // the thing corresponding to tmfloorz or NULL if tmfloorz is from a sector
|
mobj_t *tmfloorthing; // the thing corresponding to tmfloorz or NULL if tmfloorz is from a sector
|
||||||
static mobj_t *tmhitthing; // the solid thing you bumped into (for collisions)
|
mobj_t *tmhitthing; // the solid thing you bumped into (for collisions)
|
||||||
|
#ifdef ESLOPE
|
||||||
|
pslope_t *tmfloorslope, *tmceilingslope;
|
||||||
|
#endif
|
||||||
|
|
||||||
// keep track of the line that lowers the ceiling,
|
// keep track of the line that lowers the ceiling,
|
||||||
// so missiles don't explode against sky hack walls
|
// so missiles don't explode against sky hack walls
|
||||||
|
@ -102,7 +109,7 @@ boolean P_TeleportMove(mobj_t *thing, fixed_t x, fixed_t y, fixed_t z)
|
||||||
// MOVEMENT ITERATOR FUNCTIONS
|
// MOVEMENT ITERATOR FUNCTIONS
|
||||||
// =========================================================================
|
// =========================================================================
|
||||||
|
|
||||||
void P_DoSpring(mobj_t *spring, mobj_t *object)
|
boolean P_DoSpring(mobj_t *spring, mobj_t *object)
|
||||||
{
|
{
|
||||||
INT32 pflags;
|
INT32 pflags;
|
||||||
fixed_t offx, offy;
|
fixed_t offx, offy;
|
||||||
|
@ -110,16 +117,16 @@ void P_DoSpring(mobj_t *spring, mobj_t *object)
|
||||||
fixed_t horizspeed = spring->info->damage;
|
fixed_t horizspeed = spring->info->damage;
|
||||||
|
|
||||||
if (object->eflags & MFE_SPRUNG) // Object was already sprung this tic
|
if (object->eflags & MFE_SPRUNG) // Object was already sprung this tic
|
||||||
return;
|
return false;
|
||||||
|
|
||||||
// Spectators don't trigger springs.
|
// Spectators don't trigger springs.
|
||||||
if (object->player && object->player->spectator)
|
if (object->player && object->player->spectator)
|
||||||
return;
|
return false;
|
||||||
|
|
||||||
if (object->player && (object->player->pflags & PF_NIGHTSMODE))
|
if (object->player && (object->player->pflags & PF_NIGHTSMODE))
|
||||||
{
|
{
|
||||||
/*Someone want to make these work like bumpers?*/
|
/*Someone want to make these work like bumpers?*/
|
||||||
return;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
object->eflags |= MFE_SPRUNG; // apply this flag asap!
|
object->eflags |= MFE_SPRUNG; // apply this flag asap!
|
||||||
|
@ -209,6 +216,7 @@ void P_DoSpring(mobj_t *spring, mobj_t *object)
|
||||||
P_SetPlayerMobjState(object, S_PLAY_ATK1);
|
P_SetPlayerMobjState(object, S_PLAY_ATK1);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void P_DoFanAndGasJet(mobj_t *spring, mobj_t *object)
|
static void P_DoFanAndGasJet(mobj_t *spring, mobj_t *object)
|
||||||
|
@ -365,6 +373,7 @@ static void P_DoTailsCarry(player_t *sonic, player_t *tails)
|
||||||
static boolean PIT_CheckThing(mobj_t *thing)
|
static boolean PIT_CheckThing(mobj_t *thing)
|
||||||
{
|
{
|
||||||
fixed_t blockdist;
|
fixed_t blockdist;
|
||||||
|
boolean iwassprung = false;
|
||||||
|
|
||||||
// don't clip against self
|
// don't clip against self
|
||||||
if (thing == tmthing)
|
if (thing == tmthing)
|
||||||
|
@ -819,7 +828,7 @@ static boolean PIT_CheckThing(mobj_t *thing)
|
||||||
{
|
{
|
||||||
if ( thing->z <= tmthing->z + tmthing->height
|
if ( thing->z <= tmthing->z + tmthing->height
|
||||||
&& tmthing->z <= thing->z + thing->height)
|
&& tmthing->z <= thing->z + thing->height)
|
||||||
P_DoSpring(thing, tmthing);
|
iwassprung = P_DoSpring(thing, tmthing);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -906,7 +915,7 @@ static boolean PIT_CheckThing(mobj_t *thing)
|
||||||
{
|
{
|
||||||
if ( thing->z <= tmthing->z + tmthing->height
|
if ( thing->z <= tmthing->z + tmthing->height
|
||||||
&& tmthing->z <= thing->z + thing->height)
|
&& tmthing->z <= thing->z + thing->height)
|
||||||
P_DoSpring(thing, tmthing);
|
iwassprung = P_DoSpring(thing, tmthing);
|
||||||
}
|
}
|
||||||
// Are you touching the side of the object you're interacting with?
|
// Are you touching the side of the object you're interacting with?
|
||||||
else if (thing->z - FixedMul(FRACUNIT, thing->scale) <= tmthing->z + tmthing->height
|
else if (thing->z - FixedMul(FRACUNIT, thing->scale) <= tmthing->z + tmthing->height
|
||||||
|
@ -928,12 +937,14 @@ static boolean PIT_CheckThing(mobj_t *thing)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (thing->flags & MF_SPRING && (tmthing->player || tmthing->flags & MF_PUSHABLE))
|
||||||
if (thing->flags & MF_SPRING && (tmthing->player || tmthing->flags & MF_PUSHABLE));
|
{
|
||||||
else
|
if (iwassprung) // this spring caused you to gain MFE_SPRUNG just now...
|
||||||
|
return false; // "cancel" P_TryMove via blocking so you keep your current position
|
||||||
|
}
|
||||||
// Monitors are not treated as solid to players who are jumping, spinning or gliding,
|
// Monitors are not treated as solid to players who are jumping, spinning or gliding,
|
||||||
// unless it's a CTF team monitor and you're on the wrong team
|
// unless it's a CTF team monitor and you're on the wrong team
|
||||||
if (thing->flags & MF_MONITOR && tmthing->player && tmthing->player->pflags & (PF_JUMPED|PF_SPINNING|PF_GLIDING)
|
else if (thing->flags & MF_MONITOR && tmthing->player && tmthing->player->pflags & (PF_JUMPED|PF_SPINNING|PF_GLIDING)
|
||||||
&& !((thing->type == MT_REDRINGBOX && tmthing->player->ctfteam != 1) || (thing->type == MT_BLUERINGBOX && tmthing->player->ctfteam != 2)))
|
&& !((thing->type == MT_REDRINGBOX && tmthing->player->ctfteam != 1) || (thing->type == MT_BLUERINGBOX && tmthing->player->ctfteam != 2)))
|
||||||
;
|
;
|
||||||
// z checking at last
|
// z checking at last
|
||||||
|
@ -953,6 +964,9 @@ static boolean PIT_CheckThing(mobj_t *thing)
|
||||||
if (thing->z + thing->height > tmfloorz)
|
if (thing->z + thing->height > tmfloorz)
|
||||||
{
|
{
|
||||||
tmfloorz = thing->z + thing->height;
|
tmfloorz = thing->z + thing->height;
|
||||||
|
#ifdef ESLOPE
|
||||||
|
tmfloorslope = NULL;
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
@ -971,6 +985,9 @@ static boolean PIT_CheckThing(mobj_t *thing)
|
||||||
else if (topz < tmceilingz && tmthing->z+tmthing->height <= thing->z+thing->height)
|
else if (topz < tmceilingz && tmthing->z+tmthing->height <= thing->z+thing->height)
|
||||||
{
|
{
|
||||||
tmceilingz = topz;
|
tmceilingz = topz;
|
||||||
|
#ifdef ESLOPE
|
||||||
|
tmceilingslope = NULL;
|
||||||
|
#endif
|
||||||
tmfloorthing = thing; // thing we may stand on
|
tmfloorthing = thing; // thing we may stand on
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -984,6 +1001,9 @@ static boolean PIT_CheckThing(mobj_t *thing)
|
||||||
if (thing->z < tmceilingz)
|
if (thing->z < tmceilingz)
|
||||||
{
|
{
|
||||||
tmceilingz = thing->z;
|
tmceilingz = thing->z;
|
||||||
|
#ifdef ESLOPE
|
||||||
|
tmceilingslope = NULL;
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
@ -1001,6 +1021,9 @@ static boolean PIT_CheckThing(mobj_t *thing)
|
||||||
else if (topz > tmfloorz && tmthing->z >= thing->z)
|
else if (topz > tmfloorz && tmthing->z >= thing->z)
|
||||||
{
|
{
|
||||||
tmfloorz = topz;
|
tmfloorz = topz;
|
||||||
|
#ifdef ESLOPE
|
||||||
|
tmfloorslope = NULL;
|
||||||
|
#endif
|
||||||
tmfloorthing = thing; // thing we may stand on
|
tmfloorthing = thing; // thing we may stand on
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1123,11 +1146,13 @@ static boolean PIT_CheckLine(line_t *ld)
|
||||||
{
|
{
|
||||||
tmceilingz = opentop;
|
tmceilingz = opentop;
|
||||||
ceilingline = ld;
|
ceilingline = ld;
|
||||||
|
tmceilingslope = opentopslope;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (openbottom > tmfloorz)
|
if (openbottom > tmfloorz)
|
||||||
{
|
{
|
||||||
tmfloorz = openbottom;
|
tmfloorz = openbottom;
|
||||||
|
tmfloorslope = openbottomslope;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (highceiling > tmdrpoffceilz)
|
if (highceiling > tmdrpoffceilz)
|
||||||
|
@ -1204,8 +1229,12 @@ boolean P_CheckPosition(mobj_t *thing, fixed_t x, fixed_t y)
|
||||||
// that contains the point.
|
// that contains the point.
|
||||||
// Any contacted lines the step closer together
|
// Any contacted lines the step closer together
|
||||||
// will adjust them.
|
// will adjust them.
|
||||||
tmfloorz = tmdropoffz = newsubsec->sector->floorheight;
|
tmfloorz = tmdropoffz = P_GetFloorZ(thing, newsubsec->sector, x, y, NULL); //newsubsec->sector->floorheight;
|
||||||
tmceilingz = tmdrpoffceilz = newsubsec->sector->ceilingheight;
|
tmceilingz = P_GetCeilingZ(thing, newsubsec->sector, x, y, NULL); //newsubsec->sector->ceilingheight;
|
||||||
|
#ifdef ESLOPE
|
||||||
|
tmfloorslope = newsubsec->sector->f_slope;
|
||||||
|
tmceilingslope = newsubsec->sector->c_slope;
|
||||||
|
#endif
|
||||||
|
|
||||||
// Check list of fake floors and see if tmfloorz/tmceilingz need to be altered.
|
// Check list of fake floors and see if tmfloorz/tmceilingz need to be altered.
|
||||||
if (newsubsec->sector->ffloors)
|
if (newsubsec->sector->ffloors)
|
||||||
|
@ -1216,35 +1245,48 @@ boolean P_CheckPosition(mobj_t *thing, fixed_t x, fixed_t y)
|
||||||
|
|
||||||
for (rover = newsubsec->sector->ffloors; rover; rover = rover->next)
|
for (rover = newsubsec->sector->ffloors; rover; rover = rover->next)
|
||||||
{
|
{
|
||||||
|
fixed_t topheight, bottomheight;
|
||||||
|
|
||||||
if (!(rover->flags & FF_EXISTS))
|
if (!(rover->flags & FF_EXISTS))
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
|
topheight = P_GetFOFTopZ(thing, newsubsec->sector, rover, x, y, NULL);
|
||||||
|
bottomheight = P_GetFOFBottomZ(thing, newsubsec->sector, rover, x, y, NULL);
|
||||||
|
|
||||||
if (rover->flags & FF_GOOWATER && !(thing->flags & MF_NOGRAVITY))
|
if (rover->flags & FF_GOOWATER && !(thing->flags & MF_NOGRAVITY))
|
||||||
{
|
{
|
||||||
// If you're inside goowater and slowing down
|
// If you're inside goowater and slowing down
|
||||||
fixed_t sinklevel = FixedMul(thing->info->height/6, thing->scale);
|
fixed_t sinklevel = FixedMul(thing->info->height/6, thing->scale);
|
||||||
fixed_t minspeed = FixedMul(thing->info->height/12, thing->scale);
|
fixed_t minspeed = FixedMul(thing->info->height/9, thing->scale);
|
||||||
if (thing->z < *rover->topheight && *rover->bottomheight < thingtop
|
if (thing->z < topheight && bottomheight < thingtop
|
||||||
&& abs(thing->momz) < minspeed)
|
&& abs(thing->momz) < minspeed)
|
||||||
{
|
{
|
||||||
// Oh no! The object is stick in between the surface of the goo and sinklevel! help them out!
|
// Oh no! The object is stick in between the surface of the goo and sinklevel! help them out!
|
||||||
if (!(thing->eflags & MFE_VERTICALFLIP) && thing->z > *rover->topheight - sinklevel
|
if (!(thing->eflags & MFE_VERTICALFLIP) && thing->z > topheight - sinklevel
|
||||||
&& thing->momz >= 0 && thing->momz < (minspeed>>2))
|
&& thing->momz >= 0 && thing->momz < (minspeed>>2))
|
||||||
thing->momz += minspeed>>2;
|
thing->momz += minspeed>>2;
|
||||||
else if (thing->eflags & MFE_VERTICALFLIP && thingtop < *rover->bottomheight + sinklevel
|
else if (thing->eflags & MFE_VERTICALFLIP && thingtop < bottomheight + sinklevel
|
||||||
&& thing->momz <= 0 && thing->momz > -(minspeed>>2))
|
&& thing->momz <= 0 && thing->momz > -(minspeed>>2))
|
||||||
thing->momz -= minspeed>>2;
|
thing->momz -= minspeed>>2;
|
||||||
|
|
||||||
// Land on the top or the bottom, depending on gravity flip.
|
// Land on the top or the bottom, depending on gravity flip.
|
||||||
if (!(thing->eflags & MFE_VERTICALFLIP) && thing->z >= *rover->topheight - sinklevel && thing->momz <= 0)
|
if (!(thing->eflags & MFE_VERTICALFLIP) && thing->z >= topheight - sinklevel && thing->momz <= 0)
|
||||||
{
|
{
|
||||||
if (tmfloorz < *rover->topheight - sinklevel)
|
if (tmfloorz < topheight - sinklevel) {
|
||||||
tmfloorz = *rover->topheight - sinklevel;
|
tmfloorz = topheight - sinklevel;
|
||||||
|
#ifdef ESLOPE
|
||||||
|
tmfloorslope = *rover->t_slope;
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
else if (thing->eflags & MFE_VERTICALFLIP && thingtop <= *rover->bottomheight + sinklevel && thing->momz >= 0)
|
}
|
||||||
|
else if (thing->eflags & MFE_VERTICALFLIP && thingtop <= bottomheight + sinklevel && thing->momz >= 0)
|
||||||
{
|
{
|
||||||
if (tmceilingz > *rover->bottomheight + sinklevel)
|
if (tmceilingz > bottomheight + sinklevel) {
|
||||||
tmceilingz = *rover->bottomheight + sinklevel;
|
tmceilingz = bottomheight + sinklevel;
|
||||||
|
#ifdef ESLOPE
|
||||||
|
tmceilingslope = *rover->b_slope;
|
||||||
|
#endif
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
continue;
|
continue;
|
||||||
|
@ -1261,30 +1303,40 @@ boolean P_CheckPosition(mobj_t *thing, fixed_t x, fixed_t y)
|
||||||
|
|
||||||
if (rover->flags & FF_QUICKSAND)
|
if (rover->flags & FF_QUICKSAND)
|
||||||
{
|
{
|
||||||
if (thing->z < *rover->topheight && *rover->bottomheight < thingtop)
|
if (thing->z < topheight && bottomheight < thingtop)
|
||||||
{
|
{
|
||||||
if (tmfloorz < thing->z)
|
if (tmfloorz < thing->z) {
|
||||||
tmfloorz = thing->z;
|
tmfloorz = thing->z;
|
||||||
|
#ifdef ESLOPE
|
||||||
|
tmfloorslope = NULL;
|
||||||
|
#endif
|
||||||
|
}
|
||||||
}
|
}
|
||||||
// Quicksand blocks never change heights otherwise.
|
// Quicksand blocks never change heights otherwise.
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
delta1 = thing->z - (*rover->bottomheight
|
delta1 = thing->z - (bottomheight
|
||||||
+ ((*rover->topheight - *rover->bottomheight)/2));
|
+ ((topheight - bottomheight)/2));
|
||||||
delta2 = thingtop - (*rover->bottomheight
|
delta2 = thingtop - (bottomheight
|
||||||
+ ((*rover->topheight - *rover->bottomheight)/2));
|
+ ((topheight - bottomheight)/2));
|
||||||
|
|
||||||
if (*rover->topheight > tmfloorz && abs(delta1) < abs(delta2)
|
if (topheight > tmfloorz && abs(delta1) < abs(delta2)
|
||||||
&& !(rover->flags & FF_REVERSEPLATFORM))
|
&& !(rover->flags & FF_REVERSEPLATFORM))
|
||||||
{
|
{
|
||||||
tmfloorz = tmdropoffz = *rover->topheight;
|
tmfloorz = tmdropoffz = topheight;
|
||||||
|
#ifdef ESLOPE
|
||||||
|
tmfloorslope = *rover->t_slope;
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
if (*rover->bottomheight < tmceilingz && abs(delta1) >= abs(delta2)
|
if (bottomheight < tmceilingz && abs(delta1) >= abs(delta2)
|
||||||
&& !(rover->flags & FF_PLATFORM)
|
&& !(rover->flags & FF_PLATFORM)
|
||||||
&& !(thing->type == MT_SKIM && (rover->flags & FF_SWIMMABLE)))
|
&& !(thing->type == MT_SKIM && (rover->flags & FF_SWIMMABLE)))
|
||||||
{
|
{
|
||||||
tmceilingz = tmdrpoffceilz = *rover->bottomheight;
|
tmceilingz = tmdrpoffceilz = bottomheight;
|
||||||
|
#ifdef ESLOPE
|
||||||
|
tmceilingslope = *rover->b_slope;
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1357,11 +1409,19 @@ boolean P_CheckPosition(mobj_t *thing, fixed_t x, fixed_t y)
|
||||||
delta1 = thing->z - (polybottom + ((polytop - polybottom)/2));
|
delta1 = thing->z - (polybottom + ((polytop - polybottom)/2));
|
||||||
delta2 = thingtop - (polybottom + ((polytop - polybottom)/2));
|
delta2 = thingtop - (polybottom + ((polytop - polybottom)/2));
|
||||||
|
|
||||||
if (polytop > tmfloorz && abs(delta1) < abs(delta2))
|
if (polytop > tmfloorz && abs(delta1) < abs(delta2)) {
|
||||||
tmfloorz = tmdropoffz = polytop;
|
tmfloorz = tmdropoffz = polytop;
|
||||||
|
#ifdef ESLOPE
|
||||||
|
tmfloorslope = NULL;
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
|
||||||
if (polybottom < tmceilingz && abs(delta1) >= abs(delta2))
|
if (polybottom < tmceilingz && abs(delta1) >= abs(delta2)) {
|
||||||
tmceilingz = tmdrpoffceilz = polybottom;
|
tmceilingz = tmdrpoffceilz = polybottom;
|
||||||
|
#ifdef ESLOPE
|
||||||
|
tmceilingslope = NULL;
|
||||||
|
#endif
|
||||||
|
}
|
||||||
}
|
}
|
||||||
plink = (polymaplink_t *)(plink->link.next);
|
plink = (polymaplink_t *)(plink->link.next);
|
||||||
}
|
}
|
||||||
|
@ -1463,8 +1523,9 @@ boolean P_CheckCameraPosition(fixed_t x, fixed_t y, camera_t *thiscam)
|
||||||
// that contains the point.
|
// that contains the point.
|
||||||
// Any contacted lines the step closer together
|
// Any contacted lines the step closer together
|
||||||
// will adjust them.
|
// will adjust them.
|
||||||
tmfloorz = tmdropoffz = newsubsec->sector->floorheight;
|
tmfloorz = tmdropoffz = P_CameraGetFloorZ(thiscam, newsubsec->sector, x, y, NULL);
|
||||||
tmceilingz = tmdrpoffceilz = newsubsec->sector->ceilingheight;
|
|
||||||
|
tmceilingz = P_CameraGetCeilingZ(thiscam, newsubsec->sector, x, y, NULL);
|
||||||
|
|
||||||
// Cameras use the heightsec's heights rather then the actual sector heights.
|
// Cameras use the heightsec's heights rather then the actual sector heights.
|
||||||
// If you can see through it, why not move the camera through it too?
|
// If you can see through it, why not move the camera through it too?
|
||||||
|
@ -1490,20 +1551,24 @@ boolean P_CheckCameraPosition(fixed_t x, fixed_t y, camera_t *thiscam)
|
||||||
|
|
||||||
for (rover = newsubsec->sector->ffloors; rover; rover = rover->next)
|
for (rover = newsubsec->sector->ffloors; rover; rover = rover->next)
|
||||||
{
|
{
|
||||||
|
fixed_t topheight, bottomheight;
|
||||||
if (!(rover->flags & FF_BLOCKOTHERS) || !(rover->flags & FF_EXISTS) || !(rover->flags & FF_RENDERALL) || GETSECSPECIAL(rover->master->frontsector->special, 4) == 12)
|
if (!(rover->flags & FF_BLOCKOTHERS) || !(rover->flags & FF_EXISTS) || !(rover->flags & FF_RENDERALL) || GETSECSPECIAL(rover->master->frontsector->special, 4) == 12)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
delta1 = thiscam->z - (*rover->bottomheight
|
topheight = P_CameraGetFOFTopZ(thiscam, newsubsec->sector, rover, x, y, NULL);
|
||||||
+ ((*rover->topheight - *rover->bottomheight)/2));
|
bottomheight = P_CameraGetFOFBottomZ(thiscam, newsubsec->sector, rover, x, y, NULL);
|
||||||
delta2 = thingtop - (*rover->bottomheight
|
|
||||||
+ ((*rover->topheight - *rover->bottomheight)/2));
|
delta1 = thiscam->z - (bottomheight
|
||||||
if (*rover->topheight > tmfloorz && abs(delta1) < abs(delta2))
|
+ ((topheight - bottomheight)/2));
|
||||||
|
delta2 = thingtop - (bottomheight
|
||||||
|
+ ((topheight - bottomheight)/2));
|
||||||
|
if (topheight > tmfloorz && abs(delta1) < abs(delta2))
|
||||||
{
|
{
|
||||||
tmfloorz = tmdropoffz = *rover->topheight;
|
tmfloorz = tmdropoffz = topheight;
|
||||||
}
|
}
|
||||||
if (*rover->bottomheight < tmceilingz && abs(delta1) >= abs(delta2))
|
if (bottomheight < tmceilingz && abs(delta1) >= abs(delta2))
|
||||||
{
|
{
|
||||||
tmceilingz = tmdrpoffceilz = *rover->bottomheight;
|
tmceilingz = tmdrpoffceilz = bottomheight;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1698,8 +1763,8 @@ boolean P_TryCameraMove(fixed_t x, fixed_t y, camera_t *thiscam)
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
tmfloorz = thiscam->subsector->sector->floorheight;
|
tmfloorz = P_CameraGetFloorZ(thiscam, thiscam->subsector->sector, x, y, NULL);
|
||||||
tmceilingz = thiscam->subsector->sector->ceilingheight;
|
tmceilingz = P_CameraGetCeilingZ(thiscam, thiscam->subsector->sector, x, y, NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
// the move is ok,
|
// the move is ok,
|
||||||
|
@ -1765,6 +1830,10 @@ boolean PIT_PushableMoved(mobj_t *thing)
|
||||||
mobj_t *oldthing = tmthing;
|
mobj_t *oldthing = tmthing;
|
||||||
line_t *oldceilline = ceilingline;
|
line_t *oldceilline = ceilingline;
|
||||||
line_t *oldblockline = blockingline;
|
line_t *oldblockline = blockingline;
|
||||||
|
#ifdef ESLOPE
|
||||||
|
pslope_t *oldfslope = tmfloorslope;
|
||||||
|
pslope_t *oldcslope = tmceilingslope;
|
||||||
|
#endif
|
||||||
|
|
||||||
// Move the player
|
// Move the player
|
||||||
P_TryMove(thing, thing->x+stand->momx, thing->y+stand->momy, true);
|
P_TryMove(thing, thing->x+stand->momx, thing->y+stand->momy, true);
|
||||||
|
@ -1777,6 +1846,10 @@ boolean PIT_PushableMoved(mobj_t *thing)
|
||||||
P_SetTarget(&tmthing, oldthing);
|
P_SetTarget(&tmthing, oldthing);
|
||||||
ceilingline = oldceilline;
|
ceilingline = oldceilline;
|
||||||
blockingline = oldblockline;
|
blockingline = oldblockline;
|
||||||
|
#ifdef ESLOPE
|
||||||
|
tmfloorslope = oldfslope;
|
||||||
|
tmceilingslope = oldcslope;
|
||||||
|
#endif
|
||||||
thing->momz = stand->momz;
|
thing->momz = stand->momz;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
@ -1798,6 +1871,9 @@ boolean P_TryMove(mobj_t *thing, fixed_t x, fixed_t y, boolean allowdropoff)
|
||||||
fixed_t tryy = thing->y;
|
fixed_t tryy = thing->y;
|
||||||
fixed_t radius = thing->radius;
|
fixed_t radius = thing->radius;
|
||||||
fixed_t thingtop = thing->z + thing->height;
|
fixed_t thingtop = thing->z + thing->height;
|
||||||
|
#ifdef ESLOPE
|
||||||
|
fixed_t startingonground = P_IsObjectOnGround(thing);
|
||||||
|
#endif
|
||||||
floatok = false;
|
floatok = false;
|
||||||
|
|
||||||
if (radius < MAXRADIUS/2)
|
if (radius < MAXRADIUS/2)
|
||||||
|
@ -1886,13 +1962,23 @@ boolean P_TryMove(mobj_t *thing, fixed_t x, fixed_t y, boolean allowdropoff)
|
||||||
{
|
{
|
||||||
if (thingtop == thing->ceilingz && tmceilingz > thingtop && tmceilingz - thingtop <= maxstep)
|
if (thingtop == thing->ceilingz && tmceilingz > thingtop && tmceilingz - thingtop <= maxstep)
|
||||||
{
|
{
|
||||||
thing->z = tmceilingz - thing->height;
|
thing->z = (thing->ceilingz = thingtop = tmceilingz) - thing->height;
|
||||||
|
thing->eflags |= MFE_JUSTSTEPPEDDOWN;
|
||||||
|
}
|
||||||
|
else if (tmceilingz < thingtop && thingtop - tmceilingz <= maxstep)
|
||||||
|
{
|
||||||
|
thing->z = (thing->ceilingz = thingtop = tmceilingz) - thing->height;
|
||||||
thing->eflags |= MFE_JUSTSTEPPEDDOWN;
|
thing->eflags |= MFE_JUSTSTEPPEDDOWN;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if (thing->z == thing->floorz && tmfloorz < thing->z && thing->z - tmfloorz <= maxstep)
|
else if (thing->z == thing->floorz && tmfloorz < thing->z && thing->z - tmfloorz <= maxstep)
|
||||||
{
|
{
|
||||||
thing->z = tmfloorz;
|
thing->z = thing->floorz = tmfloorz;
|
||||||
|
thing->eflags |= MFE_JUSTSTEPPEDDOWN;
|
||||||
|
}
|
||||||
|
else if (tmfloorz > thing->z && tmfloorz - thing->z <= maxstep)
|
||||||
|
{
|
||||||
|
thing->z = thing->floorz = tmfloorz;
|
||||||
thing->eflags |= MFE_JUSTSTEPPEDDOWN;
|
thing->eflags |= MFE_JUSTSTEPPEDDOWN;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1963,6 +2049,25 @@ boolean P_TryMove(mobj_t *thing, fixed_t x, fixed_t y, boolean allowdropoff)
|
||||||
|
|
||||||
thing->floorz = tmfloorz;
|
thing->floorz = tmfloorz;
|
||||||
thing->ceilingz = tmceilingz;
|
thing->ceilingz = tmceilingz;
|
||||||
|
|
||||||
|
#ifdef ESLOPE
|
||||||
|
// Assign thing's standingslope if needed
|
||||||
|
if (thing->z <= tmfloorz && !(thing->eflags & MFE_VERTICALFLIP)) {
|
||||||
|
if (!startingonground && tmfloorslope)
|
||||||
|
P_HandleSlopeLanding(thing, tmfloorslope);
|
||||||
|
|
||||||
|
if (thing->momz <= 0)
|
||||||
|
thing->standingslope = tmfloorslope;
|
||||||
|
}
|
||||||
|
else if (thing->z+thing->height >= tmceilingz && (thing->eflags & MFE_VERTICALFLIP)) {
|
||||||
|
if (!startingonground && tmceilingslope)
|
||||||
|
P_HandleSlopeLanding(thing, tmceilingslope);
|
||||||
|
|
||||||
|
if (thing->momz >= 0)
|
||||||
|
thing->standingslope = tmceilingslope;
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
thing->x = x;
|
thing->x = x;
|
||||||
thing->y = y;
|
thing->y = y;
|
||||||
|
|
||||||
|
@ -1978,6 +2083,7 @@ boolean P_TryMove(mobj_t *thing, fixed_t x, fixed_t y, boolean allowdropoff)
|
||||||
boolean P_SceneryTryMove(mobj_t *thing, fixed_t x, fixed_t y)
|
boolean P_SceneryTryMove(mobj_t *thing, fixed_t x, fixed_t y)
|
||||||
{
|
{
|
||||||
fixed_t tryx, tryy;
|
fixed_t tryx, tryy;
|
||||||
|
|
||||||
tryx = thing->x;
|
tryx = thing->x;
|
||||||
tryy = thing->y;
|
tryy = thing->y;
|
||||||
do {
|
do {
|
||||||
|
@ -2042,6 +2148,7 @@ boolean P_SceneryTryMove(mobj_t *thing, fixed_t x, fixed_t y)
|
||||||
//
|
//
|
||||||
static boolean P_ThingHeightClip(mobj_t *thing)
|
static boolean P_ThingHeightClip(mobj_t *thing)
|
||||||
{
|
{
|
||||||
|
boolean floormoved;
|
||||||
fixed_t oldfloorz = thing->floorz;
|
fixed_t oldfloorz = thing->floorz;
|
||||||
boolean onfloor = P_IsObjectOnGround(thing);//(thing->z <= thing->floorz);
|
boolean onfloor = P_IsObjectOnGround(thing);//(thing->z <= thing->floorz);
|
||||||
|
|
||||||
|
@ -2053,6 +2160,9 @@ static boolean P_ThingHeightClip(mobj_t *thing)
|
||||||
if (P_MobjWasRemoved(thing))
|
if (P_MobjWasRemoved(thing))
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
|
floormoved = (thing->eflags & MFE_VERTICALFLIP && tmceilingz != thing->ceilingz)
|
||||||
|
|| (!(thing->eflags & MFE_VERTICALFLIP) && tmfloorz != thing->floorz);
|
||||||
|
|
||||||
thing->floorz = tmfloorz;
|
thing->floorz = tmfloorz;
|
||||||
thing->ceilingz = tmceilingz;
|
thing->ceilingz = tmceilingz;
|
||||||
|
|
||||||
|
@ -2061,20 +2171,13 @@ static boolean P_ThingHeightClip(mobj_t *thing)
|
||||||
if (tmfloorz > oldfloorz+thing->height)
|
if (tmfloorz > oldfloorz+thing->height)
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
if (/*!tmfloorthing && */onfloor && !(thing->flags & MF_NOGRAVITY))
|
if (onfloor && !(thing->flags & MF_NOGRAVITY) && floormoved)
|
||||||
{
|
{
|
||||||
if (thing->eflags & MFE_VERTICALFLIP)
|
if (thing->eflags & MFE_VERTICALFLIP)
|
||||||
thing->pmomz = thing->ceilingz - (thing->z + thing->height);
|
thing->pmomz = thing->ceilingz - (thing->z + thing->height);
|
||||||
else
|
else
|
||||||
thing->pmomz = thing->floorz - thing->z;
|
thing->pmomz = thing->floorz - thing->z;
|
||||||
|
thing->eflags |= MFE_APPLYPMOMZ;
|
||||||
if (thing->player)
|
|
||||||
{
|
|
||||||
if (splitscreen && camera2.chase && thing->player == &players[secondarydisplayplayer])
|
|
||||||
camera2.z += thing->pmomz;
|
|
||||||
else if (camera.chase && thing->player == &players[displayplayer])
|
|
||||||
camera.z += thing->pmomz;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (thing->eflags & MFE_VERTICALFLIP)
|
if (thing->eflags & MFE_VERTICALFLIP)
|
||||||
thing->z = thing->ceilingz - thing->height;
|
thing->z = thing->ceilingz - thing->height;
|
||||||
|
@ -2303,15 +2406,25 @@ static boolean P_IsClimbingValid(player_t *player, angle_t angle)
|
||||||
{
|
{
|
||||||
fixed_t platx, platy;
|
fixed_t platx, platy;
|
||||||
subsector_t *glidesector;
|
subsector_t *glidesector;
|
||||||
|
fixed_t floorz, ceilingz;
|
||||||
|
|
||||||
platx = P_ReturnThrustX(player->mo, angle, player->mo->radius + FixedMul(8*FRACUNIT, player->mo->scale));
|
platx = P_ReturnThrustX(player->mo, angle, player->mo->radius + FixedMul(8*FRACUNIT, player->mo->scale));
|
||||||
platy = P_ReturnThrustY(player->mo, angle, player->mo->radius + FixedMul(8*FRACUNIT, player->mo->scale));
|
platy = P_ReturnThrustY(player->mo, angle, player->mo->radius + FixedMul(8*FRACUNIT, player->mo->scale));
|
||||||
|
|
||||||
glidesector = R_PointInSubsector(player->mo->x + platx, player->mo->y + platy);
|
glidesector = R_PointInSubsector(player->mo->x + platx, player->mo->y + platy);
|
||||||
|
|
||||||
|
#ifdef ESLOPE
|
||||||
|
floorz = glidesector->sector->f_slope ? P_GetZAt(glidesector->sector->f_slope, player->mo->x, player->mo->y) : glidesector->sector->floorheight;
|
||||||
|
ceilingz = glidesector->sector->c_slope ? P_GetZAt(glidesector->sector->c_slope, player->mo->x, player->mo->y) : glidesector->sector->ceilingheight;
|
||||||
|
#else
|
||||||
|
floorz = glidesector->sector->floorheight;
|
||||||
|
ceilingz = glidesector->sector->ceilingheight;
|
||||||
|
#endif
|
||||||
|
|
||||||
if (glidesector->sector != player->mo->subsector->sector)
|
if (glidesector->sector != player->mo->subsector->sector)
|
||||||
{
|
{
|
||||||
boolean floorclimb = false;
|
boolean floorclimb = false;
|
||||||
|
fixed_t topheight, bottomheight;
|
||||||
|
|
||||||
if (glidesector->sector->ffloors)
|
if (glidesector->sector->ffloors)
|
||||||
{
|
{
|
||||||
|
@ -2321,34 +2434,44 @@ static boolean P_IsClimbingValid(player_t *player, angle_t angle)
|
||||||
if (!(rover->flags & FF_EXISTS) || !(rover->flags & FF_BLOCKPLAYER))
|
if (!(rover->flags & FF_EXISTS) || !(rover->flags & FF_BLOCKPLAYER))
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
|
topheight = *rover->topheight;
|
||||||
|
bottomheight = *rover->bottomheight;
|
||||||
|
|
||||||
|
#ifdef ESLOPE
|
||||||
|
if (*rover->t_slope)
|
||||||
|
topheight = P_GetZAt(*rover->t_slope, player->mo->x, player->mo->y);
|
||||||
|
if (*rover->b_slope)
|
||||||
|
bottomheight = P_GetZAt(*rover->b_slope, player->mo->x, player->mo->y);
|
||||||
|
#endif
|
||||||
|
|
||||||
floorclimb = true;
|
floorclimb = true;
|
||||||
|
|
||||||
if (player->mo->eflags & MFE_VERTICALFLIP)
|
if (player->mo->eflags & MFE_VERTICALFLIP)
|
||||||
{
|
{
|
||||||
if ((*rover->topheight < player->mo->z + player->mo->height) && ((player->mo->z + player->mo->height + player->mo->momz) < *rover->topheight))
|
if ((topheight < player->mo->z + player->mo->height) && ((player->mo->z + player->mo->height + player->mo->momz) < topheight))
|
||||||
{
|
{
|
||||||
floorclimb = true;
|
floorclimb = true;
|
||||||
}
|
}
|
||||||
if (*rover->topheight < player->mo->z) // Waaaay below the ledge.
|
if (topheight < player->mo->z) // Waaaay below the ledge.
|
||||||
{
|
{
|
||||||
floorclimb = false;
|
floorclimb = false;
|
||||||
}
|
}
|
||||||
if (*rover->bottomheight > player->mo->z + player->mo->height - FixedMul(16*FRACUNIT,player->mo->scale))
|
if (bottomheight > player->mo->z + player->mo->height - FixedMul(16*FRACUNIT,player->mo->scale))
|
||||||
{
|
{
|
||||||
floorclimb = false;
|
floorclimb = false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
if ((*rover->bottomheight > player->mo->z) && ((player->mo->z - player->mo->momz) > *rover->bottomheight))
|
if ((bottomheight > player->mo->z) && ((player->mo->z - player->mo->momz) > bottomheight))
|
||||||
{
|
{
|
||||||
floorclimb = true;
|
floorclimb = true;
|
||||||
}
|
}
|
||||||
if (*rover->bottomheight > player->mo->z + player->mo->height) // Waaaay below the ledge.
|
if (bottomheight > player->mo->z + player->mo->height) // Waaaay below the ledge.
|
||||||
{
|
{
|
||||||
floorclimb = false;
|
floorclimb = false;
|
||||||
}
|
}
|
||||||
if (*rover->topheight < player->mo->z + FixedMul(16*FRACUNIT,player->mo->scale))
|
if (topheight < player->mo->z + FixedMul(16*FRACUNIT,player->mo->scale))
|
||||||
{
|
{
|
||||||
floorclimb = false;
|
floorclimb = false;
|
||||||
}
|
}
|
||||||
|
@ -2361,30 +2484,30 @@ static boolean P_IsClimbingValid(player_t *player, angle_t angle)
|
||||||
|
|
||||||
if (player->mo->eflags & MFE_VERTICALFLIP)
|
if (player->mo->eflags & MFE_VERTICALFLIP)
|
||||||
{
|
{
|
||||||
if ((glidesector->sector->floorheight <= player->mo->z + player->mo->height)
|
if ((floorz <= player->mo->z + player->mo->height)
|
||||||
&& ((player->mo->z + player->mo->height - player->mo->momz) <= glidesector->sector->floorheight))
|
&& ((player->mo->z + player->mo->height - player->mo->momz) <= floorz))
|
||||||
floorclimb = true;
|
floorclimb = true;
|
||||||
|
|
||||||
if ((glidesector->sector->floorheight > player->mo->z)
|
if ((floorz > player->mo->z)
|
||||||
&& glidesector->sector->floorpic == skyflatnum)
|
&& glidesector->sector->floorpic == skyflatnum)
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
if ((player->mo->z + player->mo->height - FixedMul(16*FRACUNIT,player->mo->scale) > glidesector->sector->ceilingheight)
|
if ((player->mo->z + player->mo->height - FixedMul(16*FRACUNIT,player->mo->scale) > ceilingz)
|
||||||
|| (player->mo->z + player->mo->height <= glidesector->sector->floorheight))
|
|| (player->mo->z + player->mo->height <= floorz))
|
||||||
floorclimb = true;
|
floorclimb = true;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
if ((glidesector->sector->ceilingheight >= player->mo->z)
|
if ((ceilingz >= player->mo->z)
|
||||||
&& ((player->mo->z - player->mo->momz) >= glidesector->sector->ceilingheight))
|
&& ((player->mo->z - player->mo->momz) >= ceilingz))
|
||||||
floorclimb = true;
|
floorclimb = true;
|
||||||
|
|
||||||
if ((glidesector->sector->ceilingheight < player->mo->z+player->mo->height)
|
if ((ceilingz < player->mo->z+player->mo->height)
|
||||||
&& glidesector->sector->ceilingpic == skyflatnum)
|
&& glidesector->sector->ceilingpic == skyflatnum)
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
if ((player->mo->z + FixedMul(16*FRACUNIT,player->mo->scale) < glidesector->sector->floorheight)
|
if ((player->mo->z + FixedMul(16*FRACUNIT,player->mo->scale) < ceilingz)
|
||||||
|| (player->mo->z >= glidesector->sector->ceilingheight))
|
|| (player->mo->z >= ceilingz))
|
||||||
floorclimb = true;
|
floorclimb = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -2456,6 +2579,7 @@ isblocking:
|
||||||
line_t *checkline = li;
|
line_t *checkline = li;
|
||||||
sector_t *checksector;
|
sector_t *checksector;
|
||||||
ffloor_t *rover;
|
ffloor_t *rover;
|
||||||
|
fixed_t topheight, bottomheight;
|
||||||
boolean fofline = false;
|
boolean fofline = false;
|
||||||
INT32 side = P_PointOnLineSide(slidemo->x, slidemo->y, li);
|
INT32 side = P_PointOnLineSide(slidemo->x, slidemo->y, li);
|
||||||
|
|
||||||
|
@ -2471,13 +2595,23 @@ isblocking:
|
||||||
if (!(rover->flags & FF_EXISTS) || !(rover->flags & FF_BLOCKPLAYER) || (rover->flags & FF_BUSTUP))
|
if (!(rover->flags & FF_EXISTS) || !(rover->flags & FF_BLOCKPLAYER) || (rover->flags & FF_BUSTUP))
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
if (*rover->topheight < slidemo->z)
|
topheight = *rover->topheight;
|
||||||
|
bottomheight = *rover->bottomheight;
|
||||||
|
|
||||||
|
#ifdef ESLOPE
|
||||||
|
if (*rover->t_slope)
|
||||||
|
topheight = P_GetZAt(*rover->t_slope, slidemo->x, slidemo->y);
|
||||||
|
if (*rover->b_slope)
|
||||||
|
bottomheight = P_GetZAt(*rover->b_slope, slidemo->x, slidemo->y);
|
||||||
|
#endif
|
||||||
|
|
||||||
|
if (topheight < slidemo->z)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
if (*rover->bottomheight > slidemo->z + slidemo->height)
|
if (bottomheight > slidemo->z + slidemo->height)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
// Got this far, so I guess it's climbable.
|
// Got this far, so I guess it's climbable. // TODO: Climbing check, also, better method to do this?
|
||||||
if (rover->master->flags & ML_TFERLINE)
|
if (rover->master->flags & ML_TFERLINE)
|
||||||
{
|
{
|
||||||
size_t linenum = li-checksector->lines[0];
|
size_t linenum = li-checksector->lines[0];
|
||||||
|
@ -3097,6 +3231,7 @@ static boolean PIT_ChangeSector(mobj_t *thing, boolean realcrush)
|
||||||
if (thing->subsector->sector->ffloors && (realcrush || thing->flags & MF_PUSHABLE))
|
if (thing->subsector->sector->ffloors && (realcrush || thing->flags & MF_PUSHABLE))
|
||||||
{
|
{
|
||||||
ffloor_t *rover;
|
ffloor_t *rover;
|
||||||
|
fixed_t topheight, bottomheight;
|
||||||
fixed_t delta1, delta2;
|
fixed_t delta1, delta2;
|
||||||
INT32 thingtop = thing->z + thing->height;
|
INT32 thingtop = thing->z + thing->height;
|
||||||
|
|
||||||
|
@ -3106,9 +3241,19 @@ static boolean PIT_ChangeSector(mobj_t *thing, boolean realcrush)
|
||||||
|| ((rover->flags & FF_BLOCKOTHERS) && !thing->player)) || !(rover->flags & FF_EXISTS))
|
|| ((rover->flags & FF_BLOCKOTHERS) && !thing->player)) || !(rover->flags & FF_EXISTS))
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
delta1 = thing->z - (*rover->bottomheight + *rover->topheight)/2;
|
topheight = *rover->topheight;
|
||||||
delta2 = thingtop - (*rover->bottomheight + *rover->topheight)/2;
|
bottomheight = *rover->bottomheight;
|
||||||
if (*rover->bottomheight <= thing->ceilingz && abs(delta1) >= abs(delta2))
|
|
||||||
|
/*#ifdef ESLOPE
|
||||||
|
if (rover->t_slope)
|
||||||
|
topheight = P_GetZAt(rover->t_slope, thing->x, thing->y);
|
||||||
|
if (rover->b_slope)
|
||||||
|
bottomheight = P_GetZAt(rover->b_slope, thing->x, thing->y);
|
||||||
|
#endif*/
|
||||||
|
|
||||||
|
delta1 = thing->z - (bottomheight + topheight)/2;
|
||||||
|
delta2 = thingtop - (bottomheight + topheight)/2;
|
||||||
|
if (bottomheight <= thing->ceilingz && abs(delta1) >= abs(delta2))
|
||||||
{
|
{
|
||||||
if (thing->flags & MF_PUSHABLE)
|
if (thing->flags & MF_PUSHABLE)
|
||||||
{
|
{
|
||||||
|
@ -3786,7 +3931,7 @@ void P_MapEnd(void)
|
||||||
}
|
}
|
||||||
|
|
||||||
// P_FloorzAtPos
|
// P_FloorzAtPos
|
||||||
// Returns the floorz of the XYZ position
|
// Returns the floorz of the XYZ position // TODO: Need ceilingpos function too
|
||||||
// Tails 05-26-2003
|
// Tails 05-26-2003
|
||||||
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)
|
||||||
{
|
{
|
||||||
|
@ -3801,15 +3946,26 @@ fixed_t P_FloorzAtPos(fixed_t x, fixed_t y, fixed_t z, fixed_t height)
|
||||||
|
|
||||||
for (rover = sec->ffloors; rover; rover = rover->next)
|
for (rover = sec->ffloors; rover; rover = rover->next)
|
||||||
{
|
{
|
||||||
|
fixed_t topheight, bottomheight;
|
||||||
if (!(rover->flags & FF_EXISTS))
|
if (!(rover->flags & FF_EXISTS))
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
if ((!(rover->flags & FF_SOLID || rover->flags & FF_QUICKSAND) || (rover->flags & FF_SWIMMABLE)))
|
if ((!(rover->flags & FF_SOLID || rover->flags & FF_QUICKSAND) || (rover->flags & FF_SWIMMABLE)))
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
|
topheight = *rover->topheight;
|
||||||
|
bottomheight = *rover->bottomheight;
|
||||||
|
|
||||||
|
#ifdef ESLOPE
|
||||||
|
if (*rover->t_slope)
|
||||||
|
topheight = P_GetZAt(*rover->t_slope, x, y);
|
||||||
|
if (*rover->b_slope)
|
||||||
|
bottomheight = P_GetZAt(*rover->b_slope, x, y);
|
||||||
|
#endif
|
||||||
|
|
||||||
if (rover->flags & FF_QUICKSAND)
|
if (rover->flags & FF_QUICKSAND)
|
||||||
{
|
{
|
||||||
if (z < *rover->topheight && *rover->bottomheight < thingtop)
|
if (z < topheight && bottomheight < thingtop)
|
||||||
{
|
{
|
||||||
if (floorz < z)
|
if (floorz < z)
|
||||||
floorz = z;
|
floorz = z;
|
||||||
|
@ -3817,10 +3973,10 @@ fixed_t P_FloorzAtPos(fixed_t x, fixed_t y, fixed_t z, fixed_t height)
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
delta1 = z - (*rover->bottomheight + ((*rover->topheight - *rover->bottomheight)/2));
|
delta1 = z - (bottomheight + ((topheight - bottomheight)/2));
|
||||||
delta2 = thingtop - (*rover->bottomheight + ((*rover->topheight - *rover->bottomheight)/2));
|
delta2 = thingtop - (bottomheight + ((topheight - bottomheight)/2));
|
||||||
if (*rover->topheight > floorz && abs(delta1) < abs(delta2))
|
if (topheight > floorz && abs(delta1) < abs(delta2))
|
||||||
floorz = *rover->topheight;
|
floorz = topheight;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
219
src/p_maputl.c
219
src/p_maputl.c
|
@ -20,6 +20,7 @@
|
||||||
#include "r_data.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"
|
||||||
|
|
||||||
//
|
//
|
||||||
|
@ -322,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
|
||||||
|
@ -348,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);
|
||||||
}
|
}
|
||||||
|
|
||||||
{
|
{
|
||||||
|
@ -414,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)
|
||||||
|
@ -495,26 +532,40 @@ 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;
|
||||||
|
|
||||||
|
frontheight = P_GetCeilingZ(tmthing, front, tmx, tmy, linedef);
|
||||||
|
backheight = P_GetCeilingZ(tmthing, back, tmx, tmy, linedef);
|
||||||
|
|
||||||
|
if (frontheight < backheight)
|
||||||
{
|
{
|
||||||
opentop = front->ceilingheight;
|
opentop = frontheight;
|
||||||
highceiling = back->ceilingheight;
|
highceiling = backheight;
|
||||||
|
opentopslope = front->c_slope;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
opentop = back->ceilingheight;
|
opentop = backheight;
|
||||||
highceiling = front->ceilingheight;
|
highceiling = frontheight;
|
||||||
|
opentopslope = back->c_slope;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (front->floorheight > back->floorheight)
|
frontheight = P_GetFloorZ(tmthing, front, tmx, tmy, linedef);
|
||||||
|
backheight = P_GetFloorZ(tmthing, back, tmx, tmy, linedef);
|
||||||
|
|
||||||
|
if (frontheight > backheight)
|
||||||
{
|
{
|
||||||
openbottom = front->floorheight;
|
openbottom = frontheight;
|
||||||
lowfloor = back->floorheight;
|
lowfloor = backheight;
|
||||||
|
openbottomslope = front->f_slope;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
openbottom = back->floorheight;
|
openbottom = backheight;
|
||||||
lowfloor = front->floorheight;
|
lowfloor = frontheight;
|
||||||
|
openbottomslope = back->f_slope;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (tmthing)
|
if (tmthing)
|
||||||
|
@ -580,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;
|
||||||
|
|
||||||
|
@ -593,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;
|
||||||
|
|
||||||
|
@ -625,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;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -653,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;
|
||||||
}
|
}
|
||||||
|
@ -667,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;
|
||||||
|
@ -769,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));
|
||||||
|
@ -838,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;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -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);
|
||||||
|
|
||||||
|
|
997
src/p_mobj.c
997
src/p_mobj.c
File diff suppressed because it is too large
Load diff
|
@ -235,6 +235,8 @@ typedef enum
|
||||||
MFE_PUSHED = 1<<7,
|
MFE_PUSHED = 1<<7,
|
||||||
// Mobj was already sprung this tic
|
// Mobj was already sprung this tic
|
||||||
MFE_SPRUNG = 1<<8,
|
MFE_SPRUNG = 1<<8,
|
||||||
|
// Platform movement
|
||||||
|
MFE_APPLYPMOMZ = 1<<9,
|
||||||
// free: to and including 1<<15
|
// free: to and including 1<<15
|
||||||
} mobjeflag_t;
|
} mobjeflag_t;
|
||||||
|
|
||||||
|
@ -352,6 +354,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;
|
||||||
|
|
||||||
|
|
|
@ -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;
|
||||||
|
@ -633,7 +636,7 @@ static void P_NetArchiveWorld(void)
|
||||||
if (li->special != SHORT(mld->special))
|
if (li->special != SHORT(mld->special))
|
||||||
diff |= LD_SPECIAL;
|
diff |= LD_SPECIAL;
|
||||||
|
|
||||||
if (mld->special == 321 || mld->special == 322) // only reason li->callcount would be non-zero is if either of these are involved
|
if (SHORT(mld->special) == 321 || SHORT(mld->special) == 322) // only reason li->callcount would be non-zero is if either of these are involved
|
||||||
diff |= LD_CLLCOUNT;
|
diff |= LD_CLLCOUNT;
|
||||||
|
|
||||||
if (li->sidenum[0] != 0xffff)
|
if (li->sidenum[0] != 0xffff)
|
||||||
|
@ -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
|
||||||
|
@ -1109,6 +1113,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;
|
||||||
|
|
||||||
|
@ -1221,6 +1227,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);
|
||||||
}
|
}
|
||||||
|
@ -2068,6 +2076,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)
|
||||||
{
|
{
|
||||||
|
|
|
@ -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
1139
src/p_slopes.c
Normal file
File diff suppressed because it is too large
Load diff
80
src/p_slopes.h
Normal file
80
src/p_slopes.h
Normal file
|
@ -0,0 +1,80 @@
|
||||||
|
// 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_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);
|
||||||
|
|
||||||
|
#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
|
224
src/p_spec.c
224
src/p_spec.c
|
@ -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
|
||||||
|
@ -3365,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;
|
||||||
|
@ -3381,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)
|
||||||
{
|
{
|
||||||
|
@ -3388,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;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -3426,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.
|
||||||
|
@ -4389,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;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -4519,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;
|
||||||
|
@ -4581,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);
|
||||||
|
@ -4639,118 +4648,26 @@ void P_PlayerInSpecialSector(player_t *player)
|
||||||
|
|
||||||
/** Animate planes, scroll walls, etc. and keeps track of level timelimit and exits if time is up.
|
/** Animate planes, scroll walls, etc. and keeps track of level timelimit and exits if time is up.
|
||||||
*
|
*
|
||||||
* \sa cv_timelimit, P_CheckPointLimit
|
* \sa P_CheckTimeLimit, P_CheckPointLimit
|
||||||
*/
|
*/
|
||||||
void P_UpdateSpecials(void)
|
void P_UpdateSpecials(void)
|
||||||
{
|
{
|
||||||
anim_t *anim;
|
anim_t *anim;
|
||||||
INT32 i, k;
|
INT32 i;
|
||||||
INT32 pic;
|
INT32 pic;
|
||||||
size_t j;
|
size_t j;
|
||||||
|
|
||||||
levelflat_t *foundflats; // for flat animation
|
levelflat_t *foundflats; // for flat animation
|
||||||
|
|
||||||
// LEVEL TIMER
|
// LEVEL TIMER
|
||||||
// Exit if the timer is equal to or greater the timelimit, unless you are
|
P_CheckTimeLimit();
|
||||||
// in overtime. In which case leveltime may stretch out beyond timelimitintics
|
|
||||||
// and overtime's status will be checked here each tick.
|
|
||||||
if (cv_timelimit.value && timelimitintics <= leveltime && (multiplayer || netgame)
|
|
||||||
&& G_RingSlingerGametype() && (gameaction != ga_completed))
|
|
||||||
{
|
|
||||||
boolean pexit = false;
|
|
||||||
|
|
||||||
//Tagmode round end but only on the tic before the
|
|
||||||
//XD_EXITLEVEL packet is recieved by all players.
|
|
||||||
if (G_TagGametype())
|
|
||||||
{
|
|
||||||
if (leveltime == (timelimitintics + 1))
|
|
||||||
{
|
|
||||||
for (i = 0; i < MAXPLAYERS; i++)
|
|
||||||
{
|
|
||||||
if (!playeringame[i] || players[i].spectator
|
|
||||||
|| (players[i].pflags & PF_TAGGED) || (players[i].pflags & PF_TAGIT))
|
|
||||||
continue;
|
|
||||||
|
|
||||||
CONS_Printf(M_GetText("%s recieved double points for surviving the round.\n"), player_names[i]);
|
|
||||||
P_AddPlayerScore(&players[i], players[i].score);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
pexit = true;
|
|
||||||
}
|
|
||||||
|
|
||||||
//Optional tie-breaker for Match/CTF
|
|
||||||
else if (G_RingSlingerGametype() && cv_overtime.value)
|
|
||||||
{
|
|
||||||
INT32 playerarray[MAXPLAYERS];
|
|
||||||
INT32 tempplayer = 0;
|
|
||||||
INT32 spectators = 0;
|
|
||||||
INT32 playercount = 0;
|
|
||||||
|
|
||||||
//Figure out if we have enough participating players to care.
|
|
||||||
for (i = 0; i < MAXPLAYERS; i++)
|
|
||||||
{
|
|
||||||
if (playeringame[i] && players[i].spectator)
|
|
||||||
spectators++;
|
|
||||||
}
|
|
||||||
|
|
||||||
if ((D_NumPlayers() - spectators) > 1)
|
|
||||||
{
|
|
||||||
// Play the starpost sfx after the first second of overtime.
|
|
||||||
if (gamestate == GS_LEVEL && (leveltime == (timelimitintics + TICRATE)))
|
|
||||||
S_StartSound(NULL, sfx_strpst);
|
|
||||||
|
|
||||||
// Normal Match
|
|
||||||
if (!G_GametypeHasTeams())
|
|
||||||
{
|
|
||||||
//Store the nodes of participating players in an array.
|
|
||||||
for (i = 0; i < MAXPLAYERS; i++)
|
|
||||||
{
|
|
||||||
if (playeringame[i] && !players[i].spectator)
|
|
||||||
{
|
|
||||||
playerarray[playercount] = i;
|
|
||||||
playercount++;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
//Sort 'em.
|
|
||||||
for (i = 1; i < playercount; i++)
|
|
||||||
{
|
|
||||||
for (k = i; k < playercount; k++)
|
|
||||||
{
|
|
||||||
if (players[playerarray[i-1]].score < players[playerarray[k]].score)
|
|
||||||
{
|
|
||||||
tempplayer = playerarray[i-1];
|
|
||||||
playerarray[i-1] = playerarray[k];
|
|
||||||
playerarray[k] = tempplayer;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
//End the round if the top players aren't tied.
|
|
||||||
if (!(players[playerarray[0]].score == players[playerarray[1]].score))
|
|
||||||
pexit = true;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
//In team match and CTF, determining a tie is much simpler. =P
|
|
||||||
if (!(redscore == bluescore))
|
|
||||||
pexit = true;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else
|
|
||||||
pexit = true;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
pexit = true;
|
|
||||||
|
|
||||||
if (server && pexit)
|
|
||||||
SendNetXCmd(XD_EXITLEVEL, NULL, 0);
|
|
||||||
}
|
|
||||||
|
|
||||||
// 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++)
|
||||||
{
|
{
|
||||||
|
@ -4894,6 +4811,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;
|
||||||
|
|
||||||
|
@ -5327,6 +5250,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;
|
||||||
|
@ -5350,8 +5274,11 @@ 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)
|
||||||
|
@ -6430,6 +6357,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;
|
||||||
}
|
}
|
||||||
|
@ -6634,6 +6569,8 @@ void T_Scroll(scroll_t *s)
|
||||||
if (thing->eflags & MFE_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
|
||||||
{
|
{
|
||||||
|
@ -6654,6 +6591,8 @@ void T_Scroll(scroll_t *s)
|
||||||
if (thing->eflags & MFE_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)))
|
||||||
{
|
{
|
||||||
|
@ -6693,6 +6632,8 @@ void T_Scroll(scroll_t *s)
|
||||||
if (thing->eflags & MFE_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
|
||||||
{
|
{
|
||||||
|
@ -6713,6 +6654,8 @@ void T_Scroll(scroll_t *s)
|
||||||
if (thing->eflags & MFE_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)))
|
||||||
{
|
{
|
||||||
|
@ -7006,7 +6949,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;
|
||||||
|
|
||||||
|
@ -7015,7 +6958,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))
|
||||||
|
@ -7047,9 +6990,7 @@ void T_Friction(friction_t *f)
|
||||||
{
|
{
|
||||||
if (f->roverfriction)
|
if (f->roverfriction)
|
||||||
{
|
{
|
||||||
sector_t *referrer = §ors[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;
|
||||||
|
@ -7062,7 +7003,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;
|
||||||
|
@ -7336,7 +7277,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;
|
||||||
|
@ -7345,7 +7286,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;
|
||||||
|
@ -7357,19 +7297,16 @@ void T_Pusher(pusher_t *p)
|
||||||
|
|
||||||
if (p->roverpusher)
|
if (p->roverpusher)
|
||||||
{
|
{
|
||||||
sector_t *referrer = §ors[p->referrer];
|
referrer = §ors[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.
|
||||||
|
@ -7444,41 +7381,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 = §ors[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;
|
||||||
|
|
325
src/p_user.c
325
src/p_user.c
|
@ -29,6 +29,7 @@
|
||||||
#include "m_random.h"
|
#include "m_random.h"
|
||||||
#include "m_misc.h"
|
#include "m_misc.h"
|
||||||
#include "i_video.h"
|
#include "i_video.h"
|
||||||
|
#include "p_slopes.h"
|
||||||
#include "p_spec.h"
|
#include "p_spec.h"
|
||||||
#include "r_splats.h"
|
#include "r_splats.h"
|
||||||
#include "z_zone.h"
|
#include "z_zone.h"
|
||||||
|
@ -1212,7 +1213,7 @@ boolean P_IsObjectOnGroundIn(mobj_t *mo, sector_t *sec)
|
||||||
if (mo->eflags & MFE_VERTICALFLIP)
|
if (mo->eflags & MFE_VERTICALFLIP)
|
||||||
{
|
{
|
||||||
// Detect if the player is on the ceiling.
|
// Detect if the player is on the ceiling.
|
||||||
if (mo->z+mo->height >= sec->ceilingheight)
|
if (mo->z+mo->height >= P_GetSpecialTopZ(mo, sec, sec))
|
||||||
return true;
|
return true;
|
||||||
// Otherwise, detect if the player is on the bottom of a FOF.
|
// Otherwise, detect if the player is on the bottom of a FOF.
|
||||||
else
|
else
|
||||||
|
@ -1236,7 +1237,7 @@ boolean P_IsObjectOnGroundIn(mobj_t *mo, sector_t *sec)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
// Actually check if the player is on the suitable FOF.
|
// Actually check if the player is on the suitable FOF.
|
||||||
if (mo->z+mo->height == *rover->bottomheight)
|
if (mo->z+mo->height == P_GetSpecialBottomZ(mo, sectors + rover->secnum, sec))
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1245,7 +1246,7 @@ boolean P_IsObjectOnGroundIn(mobj_t *mo, sector_t *sec)
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
// Detect if the player is on the floor.
|
// Detect if the player is on the floor.
|
||||||
if (mo->z <= sec->floorheight)
|
if (mo->z <= P_GetSpecialBottomZ(mo, sec, sec))
|
||||||
return true;
|
return true;
|
||||||
// Otherwise, detect if the player is on the top of a FOF.
|
// Otherwise, detect if the player is on the top of a FOF.
|
||||||
else
|
else
|
||||||
|
@ -1269,7 +1270,7 @@ boolean P_IsObjectOnGroundIn(mobj_t *mo, sector_t *sec)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
// Actually check if the player is on the suitable FOF.
|
// Actually check if the player is on the suitable FOF.
|
||||||
if (mo->z == *rover->topheight)
|
if (mo->z == P_GetSpecialTopZ(mo, sectors + rover->secnum, sec))
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1789,6 +1790,9 @@ static void P_CheckBouncySectors(player_t *player)
|
||||||
fixed_t oldx;
|
fixed_t oldx;
|
||||||
fixed_t oldy;
|
fixed_t oldy;
|
||||||
fixed_t oldz;
|
fixed_t oldz;
|
||||||
|
#ifdef ESLOPE
|
||||||
|
vector3_t momentum;
|
||||||
|
#endif
|
||||||
|
|
||||||
oldx = player->mo->x;
|
oldx = player->mo->x;
|
||||||
oldy = player->mo->y;
|
oldy = player->mo->y;
|
||||||
|
@ -1809,16 +1813,21 @@ static void P_CheckBouncySectors(player_t *player)
|
||||||
{
|
{
|
||||||
ffloor_t *rover;
|
ffloor_t *rover;
|
||||||
boolean top = true;
|
boolean top = true;
|
||||||
|
fixed_t topheight, bottomheight;
|
||||||
|
|
||||||
for (rover = node->m_sector->ffloors; rover; rover = rover->next)
|
for (rover = node->m_sector->ffloors; rover; rover = rover->next)
|
||||||
{
|
{
|
||||||
if (player->mo->z > *rover->topheight)
|
topheight = P_GetFOFTopZ(player->mo, node->m_sector, rover, player->mo->x, player->mo->y, NULL);
|
||||||
|
bottomheight = P_GetFOFBottomZ(player->mo, node->m_sector, rover, player->mo->x, player->mo->y, NULL);
|
||||||
|
|
||||||
|
if (player->mo->z > topheight)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
if (player->mo->z + player->mo->height < *rover->bottomheight)
|
if (player->mo->z + player->mo->height < bottomheight)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
if (oldz < *rover->topheight && oldz > *rover->bottomheight)
|
if (oldz < P_GetFOFTopZ(player->mo, node->m_sector, rover, oldx, oldy, NULL)
|
||||||
|
&& oldz + player->mo->height > P_GetFOFBottomZ(player->mo, node->m_sector, rover, oldx, oldy, NULL))
|
||||||
top = false;
|
top = false;
|
||||||
|
|
||||||
if (GETSECSPECIAL(rover->master->frontsector->special, 1) == 15)
|
if (GETSECSPECIAL(rover->master->frontsector->special, 1) == 15)
|
||||||
|
@ -1833,7 +1842,29 @@ static void P_CheckBouncySectors(player_t *player)
|
||||||
{
|
{
|
||||||
fixed_t newmom;
|
fixed_t newmom;
|
||||||
|
|
||||||
|
#ifdef ESLOPE
|
||||||
|
pslope_t *slope;
|
||||||
|
if (abs(oldz - topheight) < abs(oldz + player->mo->height - bottomheight)) { // Hit top
|
||||||
|
slope = *rover->t_slope;
|
||||||
|
} else { // Hit bottom
|
||||||
|
slope = *rover->b_slope;
|
||||||
|
}
|
||||||
|
|
||||||
|
momentum.x = player->mo->momx;
|
||||||
|
momentum.y = player->mo->momy;
|
||||||
|
momentum.z = player->mo->momz*2;
|
||||||
|
|
||||||
|
if (slope) {
|
||||||
|
// Reverse quantizing might could use its own function later
|
||||||
|
slope->zangle = ANGLE_MAX-slope->zangle;
|
||||||
|
P_QuantizeMomentumToSlope(&momentum, slope);
|
||||||
|
slope->zangle = ANGLE_MAX-slope->zangle;
|
||||||
|
}
|
||||||
|
|
||||||
|
newmom = momentum.z = -FixedMul(momentum.z,linedist)/2;
|
||||||
|
#else
|
||||||
newmom = -FixedMul(player->mo->momz,linedist);
|
newmom = -FixedMul(player->mo->momz,linedist);
|
||||||
|
#endif
|
||||||
|
|
||||||
if (abs(newmom) < (linedist*2))
|
if (abs(newmom) < (linedist*2))
|
||||||
{
|
{
|
||||||
|
@ -1856,7 +1887,18 @@ static void P_CheckBouncySectors(player_t *player)
|
||||||
else if (newmom < -P_GetPlayerHeight(player)/2)
|
else if (newmom < -P_GetPlayerHeight(player)/2)
|
||||||
newmom = -P_GetPlayerHeight(player)/2;
|
newmom = -P_GetPlayerHeight(player)/2;
|
||||||
|
|
||||||
|
#ifdef ESLOPE
|
||||||
|
momentum.z = newmom*2;
|
||||||
|
|
||||||
|
if (slope)
|
||||||
|
P_QuantizeMomentumToSlope(&momentum, slope);
|
||||||
|
|
||||||
|
player->mo->momx = momentum.x;
|
||||||
|
player->mo->momy = momentum.y;
|
||||||
|
player->mo->momz = momentum.z/2;
|
||||||
|
#else
|
||||||
player->mo->momz = newmom;
|
player->mo->momz = newmom;
|
||||||
|
#endif
|
||||||
|
|
||||||
if (player->pflags & PF_SPINNING)
|
if (player->pflags & PF_SPINNING)
|
||||||
{
|
{
|
||||||
|
@ -2078,30 +2120,7 @@ static void P_CheckInvincibilityTimer(player_t *player)
|
||||||
player->mo->color = (UINT8)(1 + (leveltime % (MAXSKINCOLORS-1)));
|
player->mo->color = (UINT8)(1 + (leveltime % (MAXSKINCOLORS-1)));
|
||||||
else if (leveltime % (TICRATE/7) == 0)
|
else if (leveltime % (TICRATE/7) == 0)
|
||||||
{
|
{
|
||||||
fixed_t destx, desty;
|
mobj_t *sparkle = P_SpawnMobj(player->mo->x, player->mo->y, player->mo->z, MT_IVSP);
|
||||||
mobj_t *sparkle;
|
|
||||||
|
|
||||||
if (!splitscreen && rendermode != render_soft)
|
|
||||||
{
|
|
||||||
angle_t viewingangle;
|
|
||||||
|
|
||||||
if (players[displayplayer].awayviewtics)
|
|
||||||
viewingangle = R_PointToAngle2(player->mo->x, player->mo->y, players[displayplayer].awayviewmobj->x, players[displayplayer].awayviewmobj->y);
|
|
||||||
else if (!camera.chase && players[displayplayer].mo)
|
|
||||||
viewingangle = R_PointToAngle2(player->mo->x, player->mo->y, players[displayplayer].mo->x, players[displayplayer].mo->y);
|
|
||||||
else
|
|
||||||
viewingangle = R_PointToAngle2(player->mo->x, player->mo->y, camera.x, camera.y);
|
|
||||||
|
|
||||||
destx = player->mo->x + P_ReturnThrustX(player->mo, viewingangle, FixedMul(FRACUNIT, player->mo->scale));
|
|
||||||
desty = player->mo->y + P_ReturnThrustY(player->mo, viewingangle, FixedMul(FRACUNIT, player->mo->scale));
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
destx = player->mo->x;
|
|
||||||
desty = player->mo->y;
|
|
||||||
}
|
|
||||||
|
|
||||||
sparkle = P_SpawnMobj(destx, desty, player->mo->z, MT_IVSP);
|
|
||||||
sparkle->destscale = player->mo->scale;
|
sparkle->destscale = player->mo->scale;
|
||||||
P_SetScale(sparkle, player->mo->scale);
|
P_SetScale(sparkle, player->mo->scale);
|
||||||
}
|
}
|
||||||
|
@ -2276,14 +2295,27 @@ static void P_DoClimbing(player_t *player)
|
||||||
boolean thrust;
|
boolean thrust;
|
||||||
boolean boostup;
|
boolean boostup;
|
||||||
boolean skyclimber;
|
boolean skyclimber;
|
||||||
|
fixed_t floorheight, ceilingheight; // ESLOPE
|
||||||
thrust = false;
|
thrust = false;
|
||||||
floorclimb = false;
|
floorclimb = false;
|
||||||
boostup = false;
|
boostup = false;
|
||||||
skyclimber = false;
|
skyclimber = false;
|
||||||
|
|
||||||
|
#ifdef ESLOPE
|
||||||
|
floorheight = glidesector->sector->f_slope ? P_GetZAt(glidesector->sector->f_slope, player->mo->x, player->mo->y)
|
||||||
|
: glidesector->sector->floorheight;
|
||||||
|
ceilingheight = glidesector->sector->c_slope ? P_GetZAt(glidesector->sector->c_slope, player->mo->x, player->mo->y)
|
||||||
|
: glidesector->sector->ceilingheight;
|
||||||
|
#else
|
||||||
|
floorheight = glidesector->sector->floorheight;
|
||||||
|
ceilingheight = glidesector->sector->ceilingheight;
|
||||||
|
#endif
|
||||||
|
|
||||||
if (glidesector->sector->ffloors)
|
if (glidesector->sector->ffloors)
|
||||||
{
|
{
|
||||||
ffloor_t *rover;
|
ffloor_t *rover;
|
||||||
|
fixed_t topheight, bottomheight; // ESLOPE
|
||||||
|
|
||||||
for (rover = glidesector->sector->ffloors; rover; rover = rover->next)
|
for (rover = glidesector->sector->ffloors; rover; rover = rover->next)
|
||||||
{
|
{
|
||||||
if (!(rover->flags & FF_EXISTS) || !(rover->flags & FF_BLOCKPLAYER) || (rover->flags & FF_BUSTUP))
|
if (!(rover->flags & FF_EXISTS) || !(rover->flags & FF_BLOCKPLAYER) || (rover->flags & FF_BUSTUP))
|
||||||
|
@ -2291,13 +2323,21 @@ static void P_DoClimbing(player_t *player)
|
||||||
|
|
||||||
floorclimb = true;
|
floorclimb = true;
|
||||||
|
|
||||||
|
#ifdef ESLOPE
|
||||||
|
bottomheight = *rover->b_slope ? P_GetZAt(*rover->b_slope, player->mo->x, player->mo->y) : *rover->bottomheight;
|
||||||
|
topheight = *rover->t_slope ? P_GetZAt(*rover->t_slope, player->mo->x, player->mo->y) : *rover->topheight;
|
||||||
|
#else
|
||||||
|
bottomheight = *rover->bottomheight;
|
||||||
|
topheight = *rover->topheight;
|
||||||
|
#endif
|
||||||
|
|
||||||
// Only supports rovers that are moving like an 'elevator', not just the top or bottom.
|
// Only supports rovers that are moving like an 'elevator', not just the top or bottom.
|
||||||
if (rover->master->frontsector->floorspeed && rover->master->frontsector->ceilspeed == 42)
|
if (rover->master->frontsector->floorspeed && rover->master->frontsector->ceilspeed == 42)
|
||||||
{
|
{
|
||||||
if ((!(player->mo->eflags & MFE_VERTICALFLIP) && (*rover->bottomheight < player->mo->z+player->mo->height)
|
if ((!(player->mo->eflags & MFE_VERTICALFLIP) && (bottomheight < player->mo->z+player->mo->height)
|
||||||
&& (*rover->topheight >= player->mo->z + FixedMul(16*FRACUNIT, player->mo->scale)))
|
&& (topheight >= player->mo->z + FixedMul(16*FRACUNIT, player->mo->scale)))
|
||||||
|| ((player->mo->eflags & MFE_VERTICALFLIP) && (*rover->topheight > player->mo->z)
|
|| ((player->mo->eflags & MFE_VERTICALFLIP) && (topheight > player->mo->z)
|
||||||
&& (*rover->bottomheight <= player->mo->z + player->mo->height - FixedMul(16*FRACUNIT, player->mo->scale))))
|
&& (bottomheight <= player->mo->z + player->mo->height - FixedMul(16*FRACUNIT, player->mo->scale))))
|
||||||
{
|
{
|
||||||
if (cmd->forwardmove != 0)
|
if (cmd->forwardmove != 0)
|
||||||
player->mo->momz += rover->master->frontsector->floorspeed;
|
player->mo->momz += rover->master->frontsector->floorspeed;
|
||||||
|
@ -2313,8 +2353,9 @@ static void P_DoClimbing(player_t *player)
|
||||||
if (player->mo->eflags & MFE_VERTICALFLIP)
|
if (player->mo->eflags & MFE_VERTICALFLIP)
|
||||||
{
|
{
|
||||||
// Trying to climb down past the bottom of the FOF
|
// Trying to climb down past the bottom of the FOF
|
||||||
if ((*rover->topheight >= player->mo->z + player->mo->height) && ((player->mo->z + player->mo->height + player->mo->momz) >= *rover->topheight))
|
if ((topheight >= player->mo->z + player->mo->height) && ((player->mo->z + player->mo->height + player->mo->momz) >= topheight))
|
||||||
{
|
{
|
||||||
|
fixed_t bottomheight2;
|
||||||
ffloor_t *roverbelow;
|
ffloor_t *roverbelow;
|
||||||
boolean foundfof = false;
|
boolean foundfof = false;
|
||||||
floorclimb = true;
|
floorclimb = true;
|
||||||
|
@ -2329,7 +2370,13 @@ static void P_DoClimbing(player_t *player)
|
||||||
if (roverbelow == rover)
|
if (roverbelow == rover)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
if (*roverbelow->bottomheight < *rover->topheight + FixedMul(16*FRACUNIT, player->mo->scale))
|
#ifdef ESLOPE
|
||||||
|
bottomheight2 = *roverbelow->b_slope ? P_GetZAt(*roverbelow->b_slope, player->mo->x, player->mo->y) : *roverbelow->bottomheight;
|
||||||
|
#else
|
||||||
|
bottomheight2 = *roverbelow->bottomheight;
|
||||||
|
#endif
|
||||||
|
|
||||||
|
if (bottomheight2 < topheight + FixedMul(16*FRACUNIT, player->mo->scale))
|
||||||
foundfof = true;
|
foundfof = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -2338,7 +2385,7 @@ static void P_DoClimbing(player_t *player)
|
||||||
}
|
}
|
||||||
|
|
||||||
// Below the FOF
|
// Below the FOF
|
||||||
if (*rover->topheight <= player->mo->z)
|
if (topheight <= player->mo->z)
|
||||||
{
|
{
|
||||||
floorclimb = false;
|
floorclimb = false;
|
||||||
boostup = false;
|
boostup = false;
|
||||||
|
@ -2346,7 +2393,7 @@ static void P_DoClimbing(player_t *player)
|
||||||
}
|
}
|
||||||
|
|
||||||
// Above the FOF
|
// Above the FOF
|
||||||
if (*rover->bottomheight > player->mo->z + player->mo->height - FixedMul(16*FRACUNIT, player->mo->scale))
|
if (bottomheight > player->mo->z + player->mo->height - FixedMul(16*FRACUNIT, player->mo->scale))
|
||||||
{
|
{
|
||||||
floorclimb = false;
|
floorclimb = false;
|
||||||
thrust = true;
|
thrust = true;
|
||||||
|
@ -2356,8 +2403,9 @@ static void P_DoClimbing(player_t *player)
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
// Trying to climb down past the bottom of a FOF
|
// Trying to climb down past the bottom of a FOF
|
||||||
if ((*rover->bottomheight <= player->mo->z) && ((player->mo->z + player->mo->momz) <= *rover->bottomheight))
|
if ((bottomheight <= player->mo->z) && ((player->mo->z + player->mo->momz) <= bottomheight))
|
||||||
{
|
{
|
||||||
|
fixed_t topheight2;
|
||||||
ffloor_t *roverbelow;
|
ffloor_t *roverbelow;
|
||||||
boolean foundfof = false;
|
boolean foundfof = false;
|
||||||
floorclimb = true;
|
floorclimb = true;
|
||||||
|
@ -2372,7 +2420,13 @@ static void P_DoClimbing(player_t *player)
|
||||||
if (roverbelow == rover)
|
if (roverbelow == rover)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
if (*roverbelow->topheight > *rover->bottomheight - FixedMul(16*FRACUNIT, player->mo->scale))
|
#ifdef ESLOPE
|
||||||
|
topheight2 = *roverbelow->t_slope ? P_GetZAt(*roverbelow->t_slope, player->mo->x, player->mo->y) : *roverbelow->topheight;
|
||||||
|
#else
|
||||||
|
topheight2 = *roverbelow->topheight;
|
||||||
|
#endif
|
||||||
|
|
||||||
|
if (topheight2 > bottomheight - FixedMul(16*FRACUNIT, player->mo->scale))
|
||||||
foundfof = true;
|
foundfof = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -2381,7 +2435,7 @@ static void P_DoClimbing(player_t *player)
|
||||||
}
|
}
|
||||||
|
|
||||||
// Below the FOF
|
// Below the FOF
|
||||||
if (*rover->bottomheight >= player->mo->z + player->mo->height)
|
if (bottomheight >= player->mo->z + player->mo->height)
|
||||||
{
|
{
|
||||||
floorclimb = false;
|
floorclimb = false;
|
||||||
boostup = false;
|
boostup = false;
|
||||||
|
@ -2389,7 +2443,7 @@ static void P_DoClimbing(player_t *player)
|
||||||
}
|
}
|
||||||
|
|
||||||
// Above the FOF
|
// Above the FOF
|
||||||
if (*rover->topheight < player->mo->z + FixedMul(16*FRACUNIT, player->mo->scale))
|
if (topheight < player->mo->z + FixedMul(16*FRACUNIT, player->mo->scale))
|
||||||
{
|
{
|
||||||
floorclimb = false;
|
floorclimb = false;
|
||||||
thrust = true;
|
thrust = true;
|
||||||
|
@ -2410,7 +2464,7 @@ static void P_DoClimbing(player_t *player)
|
||||||
if (player->mo->eflags & MFE_VERTICALFLIP)
|
if (player->mo->eflags & MFE_VERTICALFLIP)
|
||||||
{
|
{
|
||||||
// Trying to climb down past the upper texture area
|
// Trying to climb down past the upper texture area
|
||||||
if ((glidesector->sector->floorheight >= player->mo->z + player->mo->height) && ((player->mo->z + player->mo->height + player->mo->momz) >= glidesector->sector->floorheight))
|
if ((floorheight >= player->mo->z + player->mo->height) && ((player->mo->z + player->mo->height + player->mo->momz) >= floorheight))
|
||||||
{
|
{
|
||||||
boolean foundfof = false;
|
boolean foundfof = false;
|
||||||
floorclimb = true;
|
floorclimb = true;
|
||||||
|
@ -2418,13 +2472,20 @@ static void P_DoClimbing(player_t *player)
|
||||||
// Is there a FOF directly below that we can move onto?
|
// Is there a FOF directly below that we can move onto?
|
||||||
if (glidesector->sector->ffloors)
|
if (glidesector->sector->ffloors)
|
||||||
{
|
{
|
||||||
|
fixed_t bottomheight;
|
||||||
ffloor_t *rover;
|
ffloor_t *rover;
|
||||||
for (rover = glidesector->sector->ffloors; rover; rover = rover->next)
|
for (rover = glidesector->sector->ffloors; rover; rover = rover->next)
|
||||||
{
|
{
|
||||||
if (!(rover->flags & FF_EXISTS) || !(rover->flags & FF_BLOCKPLAYER) || (rover->flags & FF_BUSTUP))
|
if (!(rover->flags & FF_EXISTS) || !(rover->flags & FF_BLOCKPLAYER) || (rover->flags & FF_BUSTUP))
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
if (*rover->bottomheight < glidesector->sector->floorheight + FixedMul(16*FRACUNIT, player->mo->scale))
|
#ifdef ESLOPE
|
||||||
|
bottomheight = *rover->b_slope ? P_GetZAt(*rover->b_slope, player->mo->x, player->mo->y) : *rover->bottomheight;
|
||||||
|
#else
|
||||||
|
bottomheight = *rover->bottomheight;
|
||||||
|
#endif
|
||||||
|
|
||||||
|
if (bottomheight < floorheight + FixedMul(16*FRACUNIT, player->mo->scale))
|
||||||
{
|
{
|
||||||
foundfof = true;
|
foundfof = true;
|
||||||
break;
|
break;
|
||||||
|
@ -2437,8 +2498,8 @@ static void P_DoClimbing(player_t *player)
|
||||||
}
|
}
|
||||||
|
|
||||||
// Reached the top of the lower texture area
|
// Reached the top of the lower texture area
|
||||||
if (!floorclimb && glidesector->sector->ceilingheight > player->mo->z + player->mo->height - FixedMul(16*FRACUNIT, player->mo->scale)
|
if (!floorclimb && ceilingheight > player->mo->z + player->mo->height - FixedMul(16*FRACUNIT, player->mo->scale)
|
||||||
&& (glidesector->sector->ceilingpic == skyflatnum || glidesector->sector->floorheight < (player->mo->z - FixedMul(8*FRACUNIT, player->mo->scale))))
|
&& (glidesector->sector->ceilingpic == skyflatnum || floorheight < (player->mo->z - FixedMul(8*FRACUNIT, player->mo->scale))))
|
||||||
{
|
{
|
||||||
thrust = true;
|
thrust = true;
|
||||||
boostup = true;
|
boostup = true;
|
||||||
|
@ -2448,7 +2509,7 @@ static void P_DoClimbing(player_t *player)
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
// Trying to climb down past the upper texture area
|
// Trying to climb down past the upper texture area
|
||||||
if ((glidesector->sector->ceilingheight <= player->mo->z) && ((player->mo->z + player->mo->momz) <= glidesector->sector->ceilingheight))
|
if ((ceilingheight <= player->mo->z) && ((player->mo->z + player->mo->momz) <= ceilingheight))
|
||||||
{
|
{
|
||||||
boolean foundfof = false;
|
boolean foundfof = false;
|
||||||
floorclimb = true;
|
floorclimb = true;
|
||||||
|
@ -2462,7 +2523,7 @@ static void P_DoClimbing(player_t *player)
|
||||||
if (!(rover->flags & FF_EXISTS) || !(rover->flags & FF_BLOCKPLAYER) || (rover->flags & FF_BUSTUP))
|
if (!(rover->flags & FF_EXISTS) || !(rover->flags & FF_BLOCKPLAYER) || (rover->flags & FF_BUSTUP))
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
if (*rover->topheight > glidesector->sector->ceilingheight - FixedMul(16*FRACUNIT, player->mo->scale))
|
if (*rover->topheight > ceilingheight - FixedMul(16*FRACUNIT, player->mo->scale))
|
||||||
{
|
{
|
||||||
foundfof = true;
|
foundfof = true;
|
||||||
break;
|
break;
|
||||||
|
@ -2475,7 +2536,7 @@ static void P_DoClimbing(player_t *player)
|
||||||
}
|
}
|
||||||
|
|
||||||
// Allow climbing from a FOF or lower texture onto the upper texture and vice versa.
|
// Allow climbing from a FOF or lower texture onto the upper texture and vice versa.
|
||||||
if (player->mo->z > glidesector->sector->ceilingheight - FixedMul(16*FRACUNIT, player->mo->scale))
|
if (player->mo->z > ceilingheight - FixedMul(16*FRACUNIT, player->mo->scale))
|
||||||
{
|
{
|
||||||
floorclimb = true;
|
floorclimb = true;
|
||||||
thrust = false;
|
thrust = false;
|
||||||
|
@ -2483,8 +2544,8 @@ static void P_DoClimbing(player_t *player)
|
||||||
}
|
}
|
||||||
|
|
||||||
// Reached the top of the lower texture area
|
// Reached the top of the lower texture area
|
||||||
if (!floorclimb && glidesector->sector->floorheight < player->mo->z + FixedMul(16*FRACUNIT, player->mo->scale)
|
if (!floorclimb && floorheight < player->mo->z + FixedMul(16*FRACUNIT, player->mo->scale)
|
||||||
&& (glidesector->sector->ceilingpic == skyflatnum || glidesector->sector->ceilingheight > (player->mo->z + player->mo->height + FixedMul(8*FRACUNIT, player->mo->scale))))
|
&& (glidesector->sector->ceilingpic == skyflatnum || ceilingheight > (player->mo->z + player->mo->height + FixedMul(8*FRACUNIT, player->mo->scale))))
|
||||||
{
|
{
|
||||||
thrust = true;
|
thrust = true;
|
||||||
boostup = true;
|
boostup = true;
|
||||||
|
@ -2493,14 +2554,14 @@ static void P_DoClimbing(player_t *player)
|
||||||
}
|
}
|
||||||
|
|
||||||
// Trying to climb on the sky
|
// Trying to climb on the sky
|
||||||
if ((glidesector->sector->ceilingheight < player->mo->z) && glidesector->sector->ceilingpic == skyflatnum)
|
if ((ceilingheight < player->mo->z) && glidesector->sector->ceilingpic == skyflatnum)
|
||||||
{
|
{
|
||||||
skyclimber = true;
|
skyclimber = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Climbing on the lower texture area?
|
// Climbing on the lower texture area?
|
||||||
if ((!(player->mo->eflags & MFE_VERTICALFLIP) && player->mo->z + FixedMul(16*FRACUNIT, player->mo->scale) < glidesector->sector->floorheight)
|
if ((!(player->mo->eflags & MFE_VERTICALFLIP) && player->mo->z + FixedMul(16*FRACUNIT, player->mo->scale) < floorheight)
|
||||||
|| ((player->mo->eflags & MFE_VERTICALFLIP) && player->mo->z + player->mo->height <= glidesector->sector->floorheight))
|
|| ((player->mo->eflags & MFE_VERTICALFLIP) && player->mo->z + player->mo->height <= floorheight))
|
||||||
{
|
{
|
||||||
floorclimb = true;
|
floorclimb = true;
|
||||||
|
|
||||||
|
@ -2516,8 +2577,8 @@ static void P_DoClimbing(player_t *player)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// Climbing on the upper texture area?
|
// Climbing on the upper texture area?
|
||||||
else if ((!(player->mo->eflags & MFE_VERTICALFLIP) && player->mo->z >= glidesector->sector->ceilingheight)
|
else if ((!(player->mo->eflags & MFE_VERTICALFLIP) && player->mo->z >= ceilingheight)
|
||||||
|| ((player->mo->eflags & MFE_VERTICALFLIP) && player->mo->z + player->mo->height - FixedMul(16*FRACUNIT, player->mo->scale) > glidesector->sector->ceilingheight))
|
|| ((player->mo->eflags & MFE_VERTICALFLIP) && player->mo->z + player->mo->height - FixedMul(16*FRACUNIT, player->mo->scale) > ceilingheight))
|
||||||
{
|
{
|
||||||
floorclimb = true;
|
floorclimb = true;
|
||||||
|
|
||||||
|
@ -3635,11 +3696,22 @@ void P_DoJump(player_t *player, boolean soundandstate)
|
||||||
|
|
||||||
// set just an eensy above the ground
|
// set just an eensy above the ground
|
||||||
if (player->mo->eflags & MFE_VERTICALFLIP)
|
if (player->mo->eflags & MFE_VERTICALFLIP)
|
||||||
|
{
|
||||||
player->mo->z--;
|
player->mo->z--;
|
||||||
|
if (player->mo->pmomz < 0)
|
||||||
|
player->mo->momz += player->mo->pmomz; // Add the platform's momentum to your jump.
|
||||||
else
|
else
|
||||||
|
player->mo->pmomz = 0;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
player->mo->z++;
|
player->mo->z++;
|
||||||
|
if (player->mo->pmomz > 0)
|
||||||
player->mo->z += player->mo->pmomz; // Solves problem of 'hitting around again after jumping on a moving platform'.
|
player->mo->momz += player->mo->pmomz; // Add the platform's momentum to your jump.
|
||||||
|
else
|
||||||
|
player->mo->pmomz = 0;
|
||||||
|
}
|
||||||
|
player->mo->eflags &= ~MFE_APPLYPMOMZ;
|
||||||
|
|
||||||
player->pflags |= PF_JUMPED;
|
player->pflags |= PF_JUMPED;
|
||||||
|
|
||||||
|
@ -3677,7 +3749,11 @@ static void P_DoSpinDash(player_t *player, ticcmd_t *cmd)
|
||||||
if ((player->charability2 == CA2_SPINDASH) && !(player->pflags & PF_SLIDING) && !player->exiting
|
if ((player->charability2 == CA2_SPINDASH) && !(player->pflags & PF_SLIDING) && !player->exiting
|
||||||
&& !P_PlayerInPain(player)) // subsequent revs
|
&& !P_PlayerInPain(player)) // subsequent revs
|
||||||
{
|
{
|
||||||
if ((cmd->buttons & BT_USE) && player->speed < FixedMul(5<<FRACBITS, player->mo->scale) && !player->mo->momz && onground && !(player->pflags & PF_USEDOWN) && !(player->pflags & PF_SPINNING))
|
if ((cmd->buttons & BT_USE) && player->speed < FixedMul(5<<FRACBITS, player->mo->scale) && !player->mo->momz && onground && !(player->pflags & PF_USEDOWN) && !(player->pflags & PF_SPINNING)
|
||||||
|
#ifdef ESLOPE
|
||||||
|
&& (!player->mo->standingslope || abs(player->mo->standingslope->zdelta) < FRACUNIT/2)
|
||||||
|
#endif
|
||||||
|
)
|
||||||
{
|
{
|
||||||
player->mo->momx = player->cmomx;
|
player->mo->momx = player->cmomx;
|
||||||
player->mo->momy = player->cmomy;
|
player->mo->momy = player->cmomy;
|
||||||
|
@ -3706,7 +3782,11 @@ static void P_DoSpinDash(player_t *player, ticcmd_t *cmd)
|
||||||
// down the spin button and not spinning.
|
// down the spin button and not spinning.
|
||||||
// AKA Just go into a spin on the ground, you idiot. ;)
|
// AKA Just go into a spin on the ground, you idiot. ;)
|
||||||
else if ((cmd->buttons & BT_USE || ((twodlevel || (player->mo->flags2 & MF2_TWOD)) && cmd->forwardmove < -20))
|
else if ((cmd->buttons & BT_USE || ((twodlevel || (player->mo->flags2 & MF2_TWOD)) && cmd->forwardmove < -20))
|
||||||
&& !player->climbing && !player->mo->momz && onground && player->speed > FixedMul(5<<FRACBITS, player->mo->scale) && !(player->pflags & PF_USEDOWN) && !(player->pflags & PF_SPINNING))
|
&& !player->climbing && !player->mo->momz && onground && (player->speed > FixedMul(5<<FRACBITS, player->mo->scale)
|
||||||
|
#ifdef ESLOPE
|
||||||
|
|| (player->mo->standingslope && abs(player->mo->standingslope->zdelta) >= FRACUNIT/2)
|
||||||
|
#endif
|
||||||
|
) && !(player->pflags & PF_USEDOWN) && !(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_ATK1);
|
||||||
|
@ -3718,7 +3798,11 @@ static void P_DoSpinDash(player_t *player, ticcmd_t *cmd)
|
||||||
|
|
||||||
// Rolling normally
|
// Rolling normally
|
||||||
if (onground && player->pflags & PF_SPINNING && !(player->pflags & PF_STARTDASH)
|
if (onground && player->pflags & PF_SPINNING && !(player->pflags & PF_STARTDASH)
|
||||||
&& player->speed < FixedMul(5*FRACUNIT,player->mo->scale))
|
&& player->speed < FixedMul(5*FRACUNIT,player->mo->scale)
|
||||||
|
#ifdef ESLOPE
|
||||||
|
&& (!player->mo->standingslope || abs(player->mo->standingslope->zdelta) < FRACUNIT/2)
|
||||||
|
#endif
|
||||||
|
)
|
||||||
{
|
{
|
||||||
if (GETSECSPECIAL(player->mo->subsector->sector->special, 4) == 7 || (player->mo->ceilingz - player->mo->floorz < P_GetPlayerHeight(player)))
|
if (GETSECSPECIAL(player->mo->subsector->sector->special, 4) == 7 || (player->mo->ceilingz - player->mo->floorz < P_GetPlayerHeight(player)))
|
||||||
P_InstaThrust(player->mo, player->mo->angle, FixedMul(10*FRACUNIT, player->mo->scale));
|
P_InstaThrust(player->mo, player->mo->angle, FixedMul(10*FRACUNIT, player->mo->scale));
|
||||||
|
@ -4422,12 +4506,16 @@ static void P_3dMovement(player_t *player)
|
||||||
angle_t dangle; // replaces old quadrants bits
|
angle_t dangle; // replaces old quadrants bits
|
||||||
fixed_t normalspd = FixedMul(player->normalspeed, player->mo->scale);
|
fixed_t normalspd = FixedMul(player->normalspeed, player->mo->scale);
|
||||||
boolean analogmove = false;
|
boolean analogmove = false;
|
||||||
#ifndef OLD_MOVEMENT_CODE
|
|
||||||
fixed_t oldMagnitude, newMagnitude;
|
fixed_t oldMagnitude, newMagnitude;
|
||||||
|
#ifdef ESLOPE
|
||||||
|
vector3_t totalthrust;
|
||||||
|
|
||||||
|
totalthrust.x = totalthrust.y = 0; // I forget if this is needed
|
||||||
|
totalthrust.z = FRACUNIT*P_MobjFlip(player->mo)/3; // A bit of extra push-back on slopes
|
||||||
|
#endif // ESLOPE
|
||||||
|
|
||||||
// Get the old momentum; this will be needed at the end of the function! -SH
|
// Get the old momentum; this will be needed at the end of the function! -SH
|
||||||
oldMagnitude = R_PointToDist2(player->mo->momx - player->cmomx, player->mo->momy - player->cmomy, 0, 0);
|
oldMagnitude = R_PointToDist2(player->mo->momx - player->cmomx, player->mo->momy - player->cmomy, 0, 0);
|
||||||
#endif
|
|
||||||
|
|
||||||
analogmove = P_AnalogMove(player);
|
analogmove = P_AnalogMove(player);
|
||||||
|
|
||||||
|
@ -4604,17 +4692,10 @@ static void P_3dMovement(player_t *player)
|
||||||
}
|
}
|
||||||
|
|
||||||
movepushforward = FixedMul(movepushforward, player->mo->scale);
|
movepushforward = FixedMul(movepushforward, player->mo->scale);
|
||||||
#ifdef OLD_MOVEMENT_CODE
|
|
||||||
if (player->speed < topspeed && mforward && cmd->forwardmove > 0) // Sonic's Speed
|
#ifdef ESLOPE
|
||||||
P_Thrust(player->mo, movepushangle, movepushforward);
|
totalthrust.x += P_ReturnThrustX(player->mo, movepushangle, movepushforward);
|
||||||
else if (mforward && cmd->forwardmove < 0)
|
totalthrust.y += P_ReturnThrustY(player->mo, movepushangle, movepushforward);
|
||||||
P_Thrust(player->mo, movepushangle, movepushforward);
|
|
||||||
else if (player->speed < topspeed && mbackward && cmd->forwardmove < 0)
|
|
||||||
P_Thrust(player->mo, movepushangle, movepushforward);
|
|
||||||
else if (mbackward && cmd->forwardmove > 0)
|
|
||||||
P_Thrust(player->mo, movepushangle, movepushforward);
|
|
||||||
else if (!mforward && !mbackward)
|
|
||||||
P_Thrust(player->mo, movepushangle, movepushforward);
|
|
||||||
#else
|
#else
|
||||||
P_Thrust(player->mo, movepushangle, movepushforward);
|
P_Thrust(player->mo, movepushangle, movepushforward);
|
||||||
#endif
|
#endif
|
||||||
|
@ -4633,33 +4714,12 @@ static void P_3dMovement(player_t *player)
|
||||||
if (!(player->pflags & PF_GLIDING || player->exiting || P_PlayerInPain(player)))
|
if (!(player->pflags & PF_GLIDING || player->exiting || P_PlayerInPain(player)))
|
||||||
{
|
{
|
||||||
angle_t controldirection;
|
angle_t controldirection;
|
||||||
#ifdef OLD_MOVEMENT_CODE
|
|
||||||
angle_t controlplayerdirection;
|
|
||||||
boolean cforward; // controls pointing forward from the player
|
|
||||||
boolean cbackward; // controls pointing backward from the player
|
|
||||||
angle_t dangle;
|
|
||||||
|
|
||||||
cforward = cbackward = false;
|
|
||||||
#endif
|
|
||||||
// Calculate the angle at which the controls are pointing
|
// Calculate the angle at which the controls are pointing
|
||||||
// to figure out the proper mforward and mbackward.
|
// to figure out the proper mforward and mbackward.
|
||||||
// (Why was it so complicated before? ~Red)
|
// (Why was it so complicated before? ~Red)
|
||||||
controldirection = R_PointToAngle2(0, 0, cmd->forwardmove*FRACUNIT, -cmd->sidemove*FRACUNIT)+movepushangle;
|
controldirection = R_PointToAngle2(0, 0, cmd->forwardmove*FRACUNIT, -cmd->sidemove*FRACUNIT)+movepushangle;
|
||||||
|
|
||||||
#ifdef OLD_MOVEMENT_CODE
|
|
||||||
controlplayerdirection = player->mo->angle;
|
|
||||||
|
|
||||||
dangle = controldirection - controlplayerdirection;
|
|
||||||
|
|
||||||
if (dangle > ANGLE_180) //flip to keep to one side
|
|
||||||
dangle = InvAngle(dangle);
|
|
||||||
|
|
||||||
if (dangle > ANGLE_90)
|
|
||||||
cbackward = true; // Controls pointing backwards from player
|
|
||||||
else
|
|
||||||
cforward = true; // Controls pointing in player's general direction
|
|
||||||
#endif
|
|
||||||
|
|
||||||
movepushforward = max(abs(cmd->sidemove), abs(cmd->forwardmove)) * (thrustfactor * acceleration);
|
movepushforward = max(abs(cmd->sidemove), abs(cmd->forwardmove)) * (thrustfactor * acceleration);
|
||||||
|
|
||||||
// allow very small movement while in air for gameplay
|
// allow very small movement while in air for gameplay
|
||||||
|
@ -4682,13 +4742,10 @@ static void P_3dMovement(player_t *player)
|
||||||
movepushsideangle = controldirection;
|
movepushsideangle = controldirection;
|
||||||
|
|
||||||
movepushforward = FixedMul(movepushforward, player->mo->scale);
|
movepushforward = FixedMul(movepushforward, player->mo->scale);
|
||||||
#ifdef OLD_MOVEMENT_CODE
|
|
||||||
if (player->speed < topspeed)
|
#ifdef ESLOPE
|
||||||
P_Thrust(player->mo, controldirection, movepushforward);
|
totalthrust.x += P_ReturnThrustX(player->mo, controldirection, movepushforward);
|
||||||
else if ((mforward) && (cbackward))
|
totalthrust.y += P_ReturnThrustY(player->mo, controldirection, movepushforward);
|
||||||
P_Thrust(player->mo, controldirection, movepushforward);
|
|
||||||
else if ((mbackward) && (cforward))
|
|
||||||
P_Thrust(player->mo, controldirection, movepushforward);
|
|
||||||
#else
|
#else
|
||||||
P_Thrust(player->mo, controldirection, movepushforward);
|
P_Thrust(player->mo, controldirection, movepushforward);
|
||||||
#endif
|
#endif
|
||||||
|
@ -4696,29 +4753,6 @@ static void P_3dMovement(player_t *player)
|
||||||
}
|
}
|
||||||
else if (cmd->sidemove && !(player->pflags & PF_GLIDING) && !player->exiting && !P_PlayerInPain(player))
|
else if (cmd->sidemove && !(player->pflags & PF_GLIDING) && !player->exiting && !P_PlayerInPain(player))
|
||||||
{
|
{
|
||||||
#ifdef OLD_MOVEMENT_CODE
|
|
||||||
boolean mright = 0;
|
|
||||||
boolean mleft = 0;
|
|
||||||
angle_t sideangle;
|
|
||||||
|
|
||||||
sideangle = player->mo->angle - ANGLE_90;
|
|
||||||
|
|
||||||
// Monster Iestyn - 04-11-13
|
|
||||||
// Quadrants are stupid, excessive and broken, let's do this a much simpler way!
|
|
||||||
// Get delta angle from rmom angle and player angle first
|
|
||||||
dangle = R_PointToAngle2(0,0, player->rmomx, player->rmomy) - sideangle;
|
|
||||||
if (dangle > ANGLE_180)
|
|
||||||
dangle = InvAngle(dangle);
|
|
||||||
|
|
||||||
// now use it to determine direction!
|
|
||||||
if (dangle <= ANGLE_45) // angles 0-45 or 315-360
|
|
||||||
mright = 1; // going right
|
|
||||||
else if (dangle >= ANGLE_135) // angles 135-225
|
|
||||||
mleft = 1; // going left
|
|
||||||
|
|
||||||
// anything else will leave both at 0, so no need to do anything else
|
|
||||||
#endif
|
|
||||||
|
|
||||||
movepushside = cmd->sidemove * (thrustfactor * acceleration);
|
movepushside = cmd->sidemove * (thrustfactor * acceleration);
|
||||||
|
|
||||||
if (!onground)
|
if (!onground)
|
||||||
|
@ -4741,19 +4775,37 @@ static void P_3dMovement(player_t *player)
|
||||||
|
|
||||||
// Finally move the player now that his speed/direction has been decided.
|
// Finally move the player now that his speed/direction has been decided.
|
||||||
movepushside = FixedMul(movepushside, player->mo->scale);
|
movepushside = FixedMul(movepushside, player->mo->scale);
|
||||||
#ifdef OLD_MOVEMENT_CODE
|
|
||||||
if (player->speed < topspeed)
|
#ifdef ESLOPE
|
||||||
P_Thrust(player->mo, movepushsideangle, movepushside);
|
totalthrust.x += P_ReturnThrustX(player->mo, movepushsideangle, movepushside);
|
||||||
else if (mright && cmd->sidemove < 0)
|
totalthrust.y += P_ReturnThrustY(player->mo, movepushsideangle, movepushside);
|
||||||
P_Thrust(player->mo, movepushsideangle, movepushside);
|
|
||||||
else if (mleft && cmd->sidemove > 0)
|
|
||||||
P_Thrust(player->mo, movepushsideangle, movepushside);
|
|
||||||
#else
|
#else
|
||||||
P_Thrust(player->mo, movepushsideangle, movepushside);
|
P_Thrust(player->mo, movepushsideangle, movepushside);
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifndef OLD_MOVEMENT_CODE
|
#ifdef ESLOPE
|
||||||
|
if ((totalthrust.x || totalthrust.y)
|
||||||
|
&& player->mo->standingslope && abs(player->mo->standingslope->zdelta) > FRACUNIT/2) {
|
||||||
|
// Factor thrust to slope, but only for the part pushing up it!
|
||||||
|
// The rest is unaffected.
|
||||||
|
angle_t thrustangle = R_PointToAngle2(0, 0, totalthrust.x, totalthrust.y)-player->mo->standingslope->xydirection;
|
||||||
|
|
||||||
|
if (player->mo->standingslope->zdelta < 0) { // Direction goes down, so thrustangle needs to face toward
|
||||||
|
if (thrustangle < ANGLE_90 || thrustangle > ANGLE_270) {
|
||||||
|
P_QuantizeMomentumToSlope(&totalthrust, player->mo->standingslope);
|
||||||
|
}
|
||||||
|
} else { // Direction goes up, so thrustangle needs to face away
|
||||||
|
if (thrustangle > ANGLE_90 && thrustangle < ANGLE_270) {
|
||||||
|
P_QuantizeMomentumToSlope(&totalthrust, player->mo->standingslope);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
player->mo->momx += totalthrust.x;
|
||||||
|
player->mo->momy += totalthrust.y;
|
||||||
|
#endif
|
||||||
|
|
||||||
// Time to ask three questions:
|
// Time to ask three questions:
|
||||||
// 1) Are we over topspeed?
|
// 1) Are we over topspeed?
|
||||||
// 2) If "yes" to 1, were we moving over topspeed to begin with?
|
// 2) If "yes" to 1, were we moving over topspeed to begin with?
|
||||||
|
@ -4787,7 +4839,6 @@ static void P_3dMovement(player_t *player)
|
||||||
player->mo->momy = tempmomy + player->cmomy;
|
player->mo->momy = tempmomy + player->cmomy;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
|
@ -9046,7 +9097,6 @@ void P_PlayerThink(player_t *player)
|
||||||
player->mo->tracer->flags2 &= ~MF2_DONTDRAW;
|
player->mo->tracer->flags2 &= ~MF2_DONTDRAW;
|
||||||
}
|
}
|
||||||
|
|
||||||
player->mo->pmomz = 0;
|
|
||||||
player->pflags &= ~PF_SLIDING;
|
player->pflags &= ~PF_SLIDING;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
@ -9399,4 +9449,7 @@ void P_PlayerAfterThink(player_t *player)
|
||||||
player->mo->flags2 |= MF2_DONTDRAW;
|
player->mo->flags2 |= MF2_DONTDRAW;
|
||||||
player->mo->flags |= MF_NOGRAVITY;
|
player->mo->flags |= MF_NOGRAVITY;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (P_IsObjectOnGround(player->mo))
|
||||||
|
player->mo->pmomz = 0;
|
||||||
}
|
}
|
||||||
|
|
213
src/r_bsp.c
213
src/r_bsp.c
|
@ -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,11 +1088,18 @@ 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
|
||||||
|
#ifdef ESLOPE
|
||||||
|
, NULL // will ffloors be slopable eventually?
|
||||||
|
#endif
|
||||||
|
);
|
||||||
//ffloor[numffloors].plane->polyobj = po;
|
//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;
|
po->visplane = ffloor[numffloors].plane;
|
||||||
numffloors++;
|
numffloors++;
|
||||||
|
@ -1014,11 +1132,18 @@ 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
|
||||||
|
#ifdef ESLOPE
|
||||||
|
, NULL // will ffloors be slopable eventually?
|
||||||
|
#endif
|
||||||
|
);
|
||||||
//ffloor[numffloors].plane->polyobj = po;
|
//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;
|
po->visplane = ffloor[numffloors].plane;
|
||||||
numffloors++;
|
numffloors++;
|
||||||
|
@ -1077,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)
|
||||||
|
@ -1099,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 = §or->lightlevel;
|
sector->lightlist[0].lightlevel = §or->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;
|
||||||
|
@ -1117,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;
|
||||||
|
@ -1130,6 +1290,7 @@ void R_Prep3DFloors(sector_t *sector)
|
||||||
bestheight = *rover->bottomheight;
|
bestheight = *rover->bottomheight;
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
if (!best)
|
if (!best)
|
||||||
{
|
{
|
||||||
|
@ -1140,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 = §ors[best->secnum];
|
sec = §ors[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)
|
||||||
|
@ -1165,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 =
|
||||||
|
|
68
src/r_defs.h
68
src/r_defs.h
|
@ -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
|
||||||
|
|
|
@ -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
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
16
src/r_draw.h
16
src/r_draw.h
|
@ -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);
|
||||||
|
|
441
src/r_draw8.c
441
src/r_draw8.c
|
@ -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.
|
||||||
*/
|
*/
|
||||||
|
|
23
src/r_main.c
23
src/r_main.c
|
@ -114,15 +114,6 @@ INT32 viewangletox[FINEANGLES/2];
|
||||||
// from clipangle to -clipangle.
|
// from clipangle to -clipangle.
|
||||||
angle_t xtoviewangle[MAXVIDWIDTH+1];
|
angle_t xtoviewangle[MAXVIDWIDTH+1];
|
||||||
|
|
||||||
// UNUSED.
|
|
||||||
// The finetangentgent[angle+FINEANGLES/4] table
|
|
||||||
// holds the fixed_t tangent values for view angles,
|
|
||||||
// ranging from INT32_MIN to 0 to INT32_MAX.
|
|
||||||
|
|
||||||
#if !(defined _NDS) || !(defined NONET)
|
|
||||||
fixed_t *finecosine = &finesine[FINEANGLES/4];
|
|
||||||
#endif
|
|
||||||
|
|
||||||
lighttable_t *scalelight[LIGHTLEVELS][MAXLIGHTSCALE];
|
lighttable_t *scalelight[LIGHTLEVELS][MAXLIGHTSCALE];
|
||||||
lighttable_t *scalelightfixed[MAXLIGHTSCALE];
|
lighttable_t *scalelightfixed[MAXLIGHTSCALE];
|
||||||
lighttable_t *zlight[LIGHTLEVELS][MAXLIGHTZ];
|
lighttable_t *zlight[LIGHTLEVELS][MAXLIGHTZ];
|
||||||
|
@ -316,13 +307,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 +323,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 +518,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)
|
||||||
|
|
179
src/r_plane.c
179
src/r_plane.c
|
@ -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;
|
||||||
|
@ -726,24 +750,8 @@ void R_DrawSinglePlane(visplane_t *pl)
|
||||||
// Hacked up support for alpha value in software mode Tails 09-24-2002 (sidenote: ported to polys 10-15-2014, there was no time travel involved -Red)
|
// Hacked up support for alpha value in software mode Tails 09-24-2002 (sidenote: ported to polys 10-15-2014, there was no time travel involved -Red)
|
||||||
if (pl->polyobj->translucency >= 10)
|
if (pl->polyobj->translucency >= 10)
|
||||||
return; // Don't even draw it
|
return; // Don't even draw it
|
||||||
else if (pl->polyobj->translucency == 9)
|
else if (pl->polyobj->translucency > 0)
|
||||||
ds_transmap = ((tr_trans90)<<FF_TRANSSHIFT) - 0x10000 + transtables;
|
ds_transmap = transtables + ((pl->polyobj->translucency-1)<<FF_TRANSSHIFT);
|
||||||
else if (pl->polyobj->translucency == 8)
|
|
||||||
ds_transmap = ((tr_trans80)<<FF_TRANSSHIFT) - 0x10000 + transtables;
|
|
||||||
else if (pl->polyobj->translucency == 7)
|
|
||||||
ds_transmap = ((tr_trans70)<<FF_TRANSSHIFT) - 0x10000 + transtables;
|
|
||||||
else if (pl->polyobj->translucency == 6)
|
|
||||||
ds_transmap = ((tr_trans60)<<FF_TRANSSHIFT) - 0x10000 + transtables;
|
|
||||||
else if (pl->polyobj->translucency == 5)
|
|
||||||
ds_transmap = ((tr_trans50)<<FF_TRANSSHIFT) - 0x10000 + transtables;
|
|
||||||
else if (pl->polyobj->translucency == 4)
|
|
||||||
ds_transmap = ((tr_trans40)<<FF_TRANSSHIFT) - 0x10000 + transtables;
|
|
||||||
else if (pl->polyobj->translucency == 3)
|
|
||||||
ds_transmap = ((tr_trans30)<<FF_TRANSSHIFT) - 0x10000 + transtables;
|
|
||||||
else if (pl->polyobj->translucency == 2)
|
|
||||||
ds_transmap = ((tr_trans20)<<FF_TRANSSHIFT) - 0x10000 + transtables;
|
|
||||||
else if (pl->polyobj->translucency == 1)
|
|
||||||
ds_transmap = ((tr_trans10)<<FF_TRANSSHIFT) - 0x10000 + transtables;
|
|
||||||
else // Opaque, but allow transparent flat pixels
|
else // Opaque, but allow transparent flat pixels
|
||||||
spanfunc = splatfunc;
|
spanfunc = splatfunc;
|
||||||
|
|
||||||
|
@ -781,23 +789,23 @@ void R_DrawSinglePlane(visplane_t *pl)
|
||||||
if (pl->ffloor->alpha < 12)
|
if (pl->ffloor->alpha < 12)
|
||||||
return; // Don't even draw it
|
return; // Don't even draw it
|
||||||
else if (pl->ffloor->alpha < 38)
|
else if (pl->ffloor->alpha < 38)
|
||||||
ds_transmap = ((tr_trans90)<<FF_TRANSSHIFT) - 0x10000 + transtables;
|
ds_transmap = transtables + ((tr_trans90-1)<<FF_TRANSSHIFT);
|
||||||
else if (pl->ffloor->alpha < 64)
|
else if (pl->ffloor->alpha < 64)
|
||||||
ds_transmap = ((tr_trans80)<<FF_TRANSSHIFT) - 0x10000 + transtables;
|
ds_transmap = transtables + ((tr_trans80-1)<<FF_TRANSSHIFT);
|
||||||
else if (pl->ffloor->alpha < 89)
|
else if (pl->ffloor->alpha < 89)
|
||||||
ds_transmap = ((tr_trans70)<<FF_TRANSSHIFT) - 0x10000 + transtables;
|
ds_transmap = transtables + ((tr_trans70-1)<<FF_TRANSSHIFT);
|
||||||
else if (pl->ffloor->alpha < 115)
|
else if (pl->ffloor->alpha < 115)
|
||||||
ds_transmap = ((tr_trans60)<<FF_TRANSSHIFT) - 0x10000 + transtables;
|
ds_transmap = transtables + ((tr_trans60-1)<<FF_TRANSSHIFT);
|
||||||
else if (pl->ffloor->alpha < 140)
|
else if (pl->ffloor->alpha < 140)
|
||||||
ds_transmap = ((tr_trans50)<<FF_TRANSSHIFT) - 0x10000 + transtables;
|
ds_transmap = transtables + ((tr_trans50-1)<<FF_TRANSSHIFT);
|
||||||
else if (pl->ffloor->alpha < 166)
|
else if (pl->ffloor->alpha < 166)
|
||||||
ds_transmap = ((tr_trans40)<<FF_TRANSSHIFT) - 0x10000 + transtables;
|
ds_transmap = transtables + ((tr_trans40-1)<<FF_TRANSSHIFT);
|
||||||
else if (pl->ffloor->alpha < 192)
|
else if (pl->ffloor->alpha < 192)
|
||||||
ds_transmap = ((tr_trans30)<<FF_TRANSSHIFT) - 0x10000 + transtables;
|
ds_transmap = transtables + ((tr_trans30-1)<<FF_TRANSSHIFT);
|
||||||
else if (pl->ffloor->alpha < 217)
|
else if (pl->ffloor->alpha < 217)
|
||||||
ds_transmap = ((tr_trans20)<<FF_TRANSSHIFT) - 0x10000 + transtables;
|
ds_transmap = transtables + ((tr_trans20-1)<<FF_TRANSSHIFT);
|
||||||
else if (pl->ffloor->alpha < 243)
|
else if (pl->ffloor->alpha < 243)
|
||||||
ds_transmap = ((tr_trans10)<<FF_TRANSSHIFT) - 0x10000 + transtables;
|
ds_transmap = transtables + ((tr_trans10-1)<<FF_TRANSSHIFT);
|
||||||
else // Opaque, but allow transparent flat pixels
|
else // Opaque, but allow transparent flat pixels
|
||||||
spanfunc = splatfunc;
|
spanfunc = splatfunc;
|
||||||
|
|
||||||
|
@ -814,7 +822,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 +854,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 +930,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
|
||||||
|
@ -951,7 +1066,7 @@ using the palette colors.
|
||||||
if (spanfunc == R_DrawSpan_8)
|
if (spanfunc == R_DrawSpan_8)
|
||||||
{
|
{
|
||||||
INT32 i;
|
INT32 i;
|
||||||
ds_transmap = ((tr_trans50)<<FF_TRANSSHIFT) - 0x10000 + transtables;
|
ds_transmap = transtables + ((tr_trans50-1)<<FF_TRANSSHIFT);
|
||||||
spanfunc = R_DrawTranslucentSpan_8;
|
spanfunc = R_DrawTranslucentSpan_8;
|
||||||
for (i=0; i<4; i++)
|
for (i=0; i<4; i++)
|
||||||
{
|
{
|
||||||
|
|
|
@ -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;
|
||||||
|
|
811
src/r_segs.c
811
src/r_segs.c
File diff suppressed because it is too large
Load diff
|
@ -503,7 +503,7 @@ static void R_RenderFloorSplat(floorsplat_t *pSplat, vertex_t *verts, UINT8 *pTe
|
||||||
{
|
{
|
||||||
ds_x1 = x1;
|
ds_x1 = x1;
|
||||||
ds_x2 = x2;
|
ds_x2 = x2;
|
||||||
ds_transmap = ((tr_trans50)<<FF_TRANSSHIFT) - 0x10000 + transtables;
|
ds_transmap = transtables + ((tr_trans50-1)<<FF_TRANSSHIFT);
|
||||||
splatfunc();
|
splatfunc();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
104
src/r_things.c
104
src/r_things.c
|
@ -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
|
||||||
|
@ -950,12 +951,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 +977,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;
|
||||||
|
@ -1191,7 +1202,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)
|
||||||
|
@ -1233,7 +1257,8 @@ static void R_ProjectSprite(mobj_t *thing)
|
||||||
vis = R_NewVisSprite();
|
vis = R_NewVisSprite();
|
||||||
vis->heightsec = heightsec; //SoM: 3/17/2000
|
vis->heightsec = heightsec; //SoM: 3/17/2000
|
||||||
vis->mobjflags = thing->flags;
|
vis->mobjflags = thing->flags;
|
||||||
vis->scale = yscale + thing->info->dispoffset; //<<detailshift;
|
vis->scale = yscale; //<<detailshift;
|
||||||
|
vis->dispoffset = thing->info->dispoffset; // Monster Iestyn: 23/11/15
|
||||||
vis->gx = thing->x;
|
vis->gx = thing->x;
|
||||||
vis->gy = thing->y;
|
vis->gy = thing->y;
|
||||||
vis->gz = gz;
|
vis->gz = gz;
|
||||||
|
@ -1296,9 +1321,9 @@ static void R_ProjectSprite(mobj_t *thing)
|
||||||
if (!cv_translucency.value)
|
if (!cv_translucency.value)
|
||||||
; // no translucency
|
; // no translucency
|
||||||
else if (thing->flags2 & MF2_SHADOW) // actually only the player should use this (temporary invisibility)
|
else if (thing->flags2 & MF2_SHADOW) // actually only the player should use this (temporary invisibility)
|
||||||
vis->transmap = ((tr_trans80-1)<<FF_TRANSSHIFT) + transtables; // because now the translucency is set through FF_TRANSMASK
|
vis->transmap = transtables + ((tr_trans80-1)<<FF_TRANSSHIFT); // because now the translucency is set through FF_TRANSMASK
|
||||||
else if (thing->frame & FF_TRANSMASK)
|
else if (thing->frame & FF_TRANSMASK)
|
||||||
vis->transmap = (thing->frame & FF_TRANSMASK) - 0x10000 + transtables;
|
vis->transmap = transtables + (thing->frame & FF_TRANSMASK) - 0x10000;
|
||||||
|
|
||||||
if (((thing->frame & FF_FULLBRIGHT) || (thing->flags2 & MF2_SHADOW))
|
if (((thing->frame & FF_FULLBRIGHT) || (thing->flags2 & MF2_SHADOW))
|
||||||
&& (!vis->extra_colormap || !vis->extra_colormap->fog))
|
&& (!vis->extra_colormap || !vis->extra_colormap->fog))
|
||||||
|
@ -1449,6 +1474,7 @@ static void R_ProjectPrecipitationSprite(precipmobj_t *thing)
|
||||||
// store information in a vissprite
|
// store information in a vissprite
|
||||||
vis = R_NewVisSprite();
|
vis = R_NewVisSprite();
|
||||||
vis->scale = yscale; //<<detailshift;
|
vis->scale = yscale; //<<detailshift;
|
||||||
|
vis->dispoffset = 0; // Monster Iestyn: 23/11/15
|
||||||
vis->gx = thing->x;
|
vis->gx = thing->x;
|
||||||
vis->gy = thing->y;
|
vis->gy = thing->y;
|
||||||
vis->gz = gz;
|
vis->gz = gz;
|
||||||
|
@ -1600,6 +1626,7 @@ void R_SortVisSprites(void)
|
||||||
vissprite_t *best = NULL;
|
vissprite_t *best = NULL;
|
||||||
vissprite_t unsorted;
|
vissprite_t unsorted;
|
||||||
fixed_t bestscale;
|
fixed_t bestscale;
|
||||||
|
INT32 bestdispoffset;
|
||||||
|
|
||||||
if (!visspritecount)
|
if (!visspritecount)
|
||||||
return;
|
return;
|
||||||
|
@ -1630,12 +1657,19 @@ void R_SortVisSprites(void)
|
||||||
vsprsortedhead.next = vsprsortedhead.prev = &vsprsortedhead;
|
vsprsortedhead.next = vsprsortedhead.prev = &vsprsortedhead;
|
||||||
for (i = 0; i < visspritecount; i++)
|
for (i = 0; i < visspritecount; i++)
|
||||||
{
|
{
|
||||||
bestscale = INT32_MAX;
|
bestscale = bestdispoffset = INT32_MAX;
|
||||||
for (ds = unsorted.next; ds != &unsorted; ds = ds->next)
|
for (ds = unsorted.next; ds != &unsorted; ds = ds->next)
|
||||||
{
|
{
|
||||||
if (ds->scale < bestscale)
|
if (ds->scale < bestscale)
|
||||||
{
|
{
|
||||||
bestscale = ds->scale;
|
bestscale = ds->scale;
|
||||||
|
bestdispoffset = ds->dispoffset;
|
||||||
|
best = ds;
|
||||||
|
}
|
||||||
|
// order visprites of same scale by dispoffset, smallest first
|
||||||
|
else if (ds->scale == bestscale && ds->dispoffset < bestdispoffset)
|
||||||
|
{
|
||||||
|
bestdispoffset = ds->dispoffset;
|
||||||
best = ds;
|
best = ds;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1752,24 +1786,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;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1799,6 +1843,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;
|
||||||
|
|
||||||
|
@ -1809,9 +1854,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;
|
||||||
|
@ -1860,7 +1921,8 @@ static void R_CreateDrawNodes(void)
|
||||||
if (r2->sprite->szt > rover->sz || r2->sprite->sz < rover->szt)
|
if (r2->sprite->szt > rover->sz || r2->sprite->sz < rover->szt)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
if (r2->sprite->scale > rover->scale)
|
if (r2->sprite->scale > rover->scale
|
||||||
|
|| (r2->sprite->scale == rover->scale && r2->sprite->dispoffset > rover->dispoffset))
|
||||||
{
|
{
|
||||||
entry = R_CreateDrawNode(NULL);
|
entry = R_CreateDrawNode(NULL);
|
||||||
(entry->prev = r2->prev)->next = entry;
|
(entry->prev = r2->prev)->next = entry;
|
||||||
|
@ -2030,21 +2092,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++)
|
||||||
|
|
|
@ -162,6 +162,7 @@ typedef struct vissprite_s
|
||||||
boolean precip;
|
boolean precip;
|
||||||
boolean vflip; // Flip vertically
|
boolean vflip; // Flip vertically
|
||||||
boolean isScaled;
|
boolean isScaled;
|
||||||
|
INT32 dispoffset; // copy of info->dispoffset, affects ordering but not drawing
|
||||||
} vissprite_t;
|
} vissprite_t;
|
||||||
|
|
||||||
// A drawnode is something that points to a 3D floor, 3D side, or masked
|
// A drawnode is something that points to a 3D floor, 3D side, or masked
|
||||||
|
|
|
@ -23,7 +23,7 @@
|
||||||
#ifdef CMAKECONFIG
|
#ifdef CMAKECONFIG
|
||||||
#include "config.h"
|
#include "config.h"
|
||||||
#else
|
#else
|
||||||
#include "config.h.in"
|
#include "../config.h.in"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifndef _WIN32_WCE
|
#ifndef _WIN32_WCE
|
||||||
|
|
|
@ -217,10 +217,12 @@ static void SDLSetMode(INT32 width, INT32 height, SDL_bool fullscreen)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#ifdef HWRENDER
|
||||||
if (rendermode == render_opengl)
|
if (rendermode == render_opengl)
|
||||||
{
|
{
|
||||||
OglSdlSurface(vid.width, vid.height);
|
OglSdlSurface(vid.width, vid.height);
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
if (rendermode == render_soft)
|
if (rendermode == render_soft)
|
||||||
{
|
{
|
||||||
|
@ -401,9 +403,11 @@ static INT32 Impl_SDL_Scancode_To_Keycode(SDL_Scancode code)
|
||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
#ifdef HWRENDER
|
||||||
DBG_Printf("Unknown incoming scancode: %d, represented %c\n",
|
DBG_Printf("Unknown incoming scancode: %d, represented %c\n",
|
||||||
code,
|
code,
|
||||||
SDL_GetKeyName(SDL_GetKeyFromScancode(code)));
|
SDL_GetKeyName(SDL_GetKeyFromScancode(code)));
|
||||||
|
#endif
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1842,37 +1842,6 @@ static void ST_overlayDrawer(void)
|
||||||
LUAh_GameHUD(stplyr);
|
LUAh_GameHUD(stplyr);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if 0 // Pope XVI
|
|
||||||
if (!(netgame || multiplayer) && !modifiedgame && gamemap == 11 && ALL7EMERALDS(emeralds)
|
|
||||||
&& stplyr->mo && stplyr->mo->subsector && stplyr->mo->subsector->sector-sectors == 1361)
|
|
||||||
{
|
|
||||||
if (grade & 2048) // NAGZ
|
|
||||||
{
|
|
||||||
V_DrawCenteredString(BASEVIDWIDTH/2, 70, 0, M_GetText("I, Pope Rededict XVI proclaim"));
|
|
||||||
V_DrawCenteredString(BASEVIDWIDTH/2, 80, 0, M_GetText("AJ & Amy"));
|
|
||||||
V_DrawCenteredString(BASEVIDWIDTH/2, 90, 0, M_GetText("Husband & Wife"));
|
|
||||||
V_DrawCenteredString(BASEVIDWIDTH/2, 100, 0, M_GetText("on this day"));
|
|
||||||
V_DrawCenteredString(BASEVIDWIDTH/2, 110, 0, M_GetText("May 16, 2009"));
|
|
||||||
|
|
||||||
P_GivePlayerRings(stplyr, 9999);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
V_DrawCenteredString(BASEVIDWIDTH/2, 60, 0, M_GetText("Oh... it's you again..."));
|
|
||||||
V_DrawCenteredString(BASEVIDWIDTH/2, 80, 0, M_GetText("Look, I wanted to apologize for the way"));
|
|
||||||
V_DrawCenteredString(BASEVIDWIDTH/2, 90, 0, M_GetText("I've acted in the past."));
|
|
||||||
V_DrawCenteredString(BASEVIDWIDTH/2, 110, 0, M_GetText("I've seen the error of my ways"));
|
|
||||||
V_DrawCenteredString(BASEVIDWIDTH/2, 120, 0, M_GetText("and turned over a new leaf."));
|
|
||||||
V_DrawCenteredString(BASEVIDWIDTH/2, 140, 0, M_GetText("Instead of sending people to hell,"));
|
|
||||||
V_DrawCenteredString(BASEVIDWIDTH/2, 150, 0, M_GetText("I now send them to heaven!"));
|
|
||||||
|
|
||||||
P_LinedefExecute(4200, stplyr->mo, stplyr->mo->subsector->sector);
|
|
||||||
P_LinedefExecute(4201, stplyr->mo, stplyr->mo->subsector->sector);
|
|
||||||
stplyr->mo->momx = stplyr->mo->momy = 0;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
// draw level title Tails
|
// draw level title Tails
|
||||||
if (*mapheaderinfo[gamemap-1]->lvlttl != '\0' && !(hu_showscores && (netgame || multiplayer))
|
if (*mapheaderinfo[gamemap-1]->lvlttl != '\0' && !(hu_showscores && (netgame || multiplayer))
|
||||||
#ifdef HAVE_BLUA
|
#ifdef HAVE_BLUA
|
||||||
|
|
3581
src/tables.c
3581
src/tables.c
File diff suppressed because it is too large
Load diff
|
@ -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
|
||||||
|
|
||||||
|
|
|
@ -366,7 +366,7 @@ void V_DrawFixedPatch(fixed_t x, fixed_t y, fixed_t pscale, INT32 scrn, patch_t
|
||||||
}
|
}
|
||||||
if (alphalevel)
|
if (alphalevel)
|
||||||
{
|
{
|
||||||
v_translevel = ((alphalevel)<<FF_TRANSSHIFT) - 0x10000 + transtables;
|
v_translevel = transtables + ((alphalevel-1)<<FF_TRANSSHIFT);
|
||||||
patchdrawfunc = translucentpdraw;
|
patchdrawfunc = translucentpdraw;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1869,7 +1869,7 @@ void V_DoPostProcessor(INT32 view, postimg_t type, INT32 param)
|
||||||
angle_t disStart = (leveltime * 128) & FINEMASK; // in 0 to FINEANGLE
|
angle_t disStart = (leveltime * 128) & FINEMASK; // in 0 to FINEANGLE
|
||||||
INT32 newpix;
|
INT32 newpix;
|
||||||
INT32 sine;
|
INT32 sine;
|
||||||
//UINT8 *transme = ((tr_trans50)<<FF_TRANSSHIFT) + transtables;
|
//UINT8 *transme = transtables + ((tr_trans50-1)<<FF_TRANSSHIFT);
|
||||||
|
|
||||||
for (y = yoffset; y < yoffset+height; y++)
|
for (y = yoffset; y < yoffset+height; y++)
|
||||||
{
|
{
|
||||||
|
@ -1926,7 +1926,7 @@ Unoptimized version
|
||||||
INT32 x, y;
|
INT32 x, y;
|
||||||
|
|
||||||
// TODO: Add a postimg_param so that we can pick the translucency level...
|
// TODO: Add a postimg_param so that we can pick the translucency level...
|
||||||
UINT8 *transme = ((param)<<FF_TRANSSHIFT) - 0x10000 + transtables;
|
UINT8 *transme = transtables + ((param-1)<<FF_TRANSSHIFT);
|
||||||
|
|
||||||
for (y = yoffset; y < yoffset+height; y++)
|
for (y = yoffset; y < yoffset+height; y++)
|
||||||
{
|
{
|
||||||
|
|
|
@ -16,8 +16,6 @@
|
||||||
|
|
||||||
#ifdef HWRENDER
|
#ifdef HWRENDER
|
||||||
#include "hardware/hw_data.h"
|
#include "hardware/hw_data.h"
|
||||||
#else
|
|
||||||
typedef void GLPatch_t;
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef __GNUG__
|
#ifdef __GNUG__
|
||||||
|
|
|
@ -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;
|
||||||
|
|
Loading…
Reference in a new issue