mirror of
https://git.do.srb2.org/STJr/SRB2.git
synced 2025-01-29 12:40:58 +00:00
Merge branch 'master' into damage-control
This commit is contained in:
commit
4369ba2a21
31 changed files with 2546 additions and 2466 deletions
|
@ -11,6 +11,13 @@
|
|||
#include <limits.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
|
||||
** 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 ptrdiff_t
|
||||
#define LUA_NUMBER INT32
|
||||
|
||||
/*
|
||||
@@ LUAI_UACNUMBER is the result of an 'usual argument conversion'
|
||||
@* over a number.
|
||||
*/
|
||||
#define LUAI_UACNUMBER ptrdiff_t
|
||||
#define LUAI_UACNUMBER INT32
|
||||
|
||||
|
||||
/*
|
||||
|
@ -519,14 +526,14 @@
|
|||
@@ lua_str2number converts a string to a number.
|
||||
*/
|
||||
#ifdef LUA_WIN
|
||||
#define LUA_NUMBER_SCAN "%Ii"
|
||||
#define LUA_NUMBER_FMT "%Ii"
|
||||
#define LUA_NUMBER_SCAN "%d"
|
||||
#define LUA_NUMBER_FMT "%d"
|
||||
#else
|
||||
#define LUA_NUMBER_SCAN "%ti"
|
||||
#define LUA_NUMBER_FMT "%ti"
|
||||
#define LUA_NUMBER_SCAN "%d"
|
||||
#define LUA_NUMBER_FMT "%d"
|
||||
#endif
|
||||
#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)
|
||||
|
||||
|
||||
|
|
|
@ -96,6 +96,10 @@ int snprintf(char *str, size_t n, const char *fmt, ...);
|
|||
#include "hardware/hw3sound.h"
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_BLUA
|
||||
#include "lua_script.h"
|
||||
#endif
|
||||
|
||||
// platform independant focus loss
|
||||
UINT8 window_notinfocus = false;
|
||||
|
||||
|
@ -634,6 +638,10 @@ void D_SRB2Loop(void)
|
|||
#ifdef HW3SOUND
|
||||
HW3S_EndFrameUpdate();
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_BLUA
|
||||
LUA_Step();
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -161,11 +161,15 @@ typedef enum
|
|||
// Are animation frames playing?
|
||||
PA_ETC=0,
|
||||
PA_IDLE,
|
||||
PA_EDGE,
|
||||
PA_WALK,
|
||||
PA_RUN,
|
||||
PA_PAIN,
|
||||
PA_ROLL,
|
||||
PA_JUMP,
|
||||
PA_FALL,
|
||||
PA_ABILITY
|
||||
PA_ABILITY,
|
||||
PA_RIDE
|
||||
} panim_t;
|
||||
|
||||
typedef enum
|
||||
|
|
|
@ -998,7 +998,7 @@ static const struct {
|
|||
static void readlevelheader(MYFILE *f, INT32 num)
|
||||
{
|
||||
char *s = Z_Malloc(MAXLINELEN, PU_STATIC, NULL);
|
||||
char *word = s;
|
||||
char *word;
|
||||
char *word2;
|
||||
//char *word3; // Non-uppercase version of word2
|
||||
char *tmp;
|
||||
|
@ -1027,6 +1027,9 @@ static void readlevelheader(MYFILE *f, INT32 num)
|
|||
if (s == tmp)
|
||||
continue; // Skip comment lines, but don't break.
|
||||
|
||||
// Set / reset word, because some things (Lua.) move it
|
||||
word = s;
|
||||
|
||||
// Get the part before the " = "
|
||||
tmp = strchr(s, '=');
|
||||
*(tmp-1) = '\0';
|
||||
|
@ -3747,7 +3750,9 @@ static const char *const STATE_LIST[] = { // array length left dynamic for sanit
|
|||
"S_PLAY_RUN",
|
||||
"S_PLAY_PAIN",
|
||||
"S_PLAY_DEAD",
|
||||
"S_PLAY_DRWN",
|
||||
"S_PLAY_SPIN",
|
||||
"S_PLAY_DASH",
|
||||
"S_PLAY_GASP",
|
||||
"S_PLAY_JUMP",
|
||||
"S_PLAY_FALL",
|
||||
|
@ -3767,8 +3772,17 @@ static const char *const STATE_LIST[] = { // array length left dynamic for sanit
|
|||
"S_PLAY_SUPER_STND",
|
||||
"S_PLAY_SUPER_WALK",
|
||||
"S_PLAY_SUPER_RUN",
|
||||
"S_PLAY_SUPER_EDGE",
|
||||
"S_PLAY_SUPER_PAIN",
|
||||
"S_PLAY_SUPER_STUN",
|
||||
"S_PLAY_SUPER_DEAD",
|
||||
"S_PLAY_SUPER_DRWN",
|
||||
"S_PLAY_SUPER_SPIN",
|
||||
"S_PLAY_SUPER_GASP",
|
||||
"S_PLAY_SUPER_JUMP",
|
||||
"S_PLAY_SUPER_FALL",
|
||||
"S_PLAY_SUPER_EDGE",
|
||||
"S_PLAY_SUPER_RIDE",
|
||||
"S_PLAY_SUPER_FLOAT",
|
||||
|
||||
// SF_SUPER
|
||||
"S_PLAY_SUPERTRANS1",
|
||||
|
@ -7189,6 +7203,7 @@ static const char *const MOBJEFLAG_LIST[] = {
|
|||
"GOOWATER", // Goo water
|
||||
"PUSHED", // Mobj was already pushed this tic
|
||||
"SPRUNG", // Mobj was already sprung this tic
|
||||
"APPLYPMOMZ", // Platform movement
|
||||
NULL
|
||||
};
|
||||
|
||||
|
@ -7655,11 +7670,15 @@ struct {
|
|||
// Player animation (panim_t)
|
||||
{"PA_ETC",PA_ETC},
|
||||
{"PA_IDLE",PA_IDLE},
|
||||
{"PA_EDGE",PA_EDGE},
|
||||
{"PA_WALK",PA_WALK},
|
||||
{"PA_RUN",PA_RUN},
|
||||
{"PA_PAIN",PA_PAIN},
|
||||
{"PA_ROLL",PA_ROLL},
|
||||
{"PA_JUMP",PA_JUMP},
|
||||
{"PA_FALL",PA_FALL},
|
||||
{"PA_ABILITY",PA_ABILITY},
|
||||
{"PA_RIDE",PA_RIDE},
|
||||
|
||||
// Current weapon
|
||||
{"WEP_AUTO",WEP_AUTO},
|
||||
|
@ -7738,36 +7757,36 @@ struct {
|
|||
{"FF_GOOWATER",FF_GOOWATER}, ///< Used with ::FF_SWIMMABLE. Makes thick bouncey goop.
|
||||
|
||||
// Angles
|
||||
{"ANG1",ANG1},
|
||||
{"ANG2",ANG2},
|
||||
{"ANG10",ANG10},
|
||||
{"ANG15",ANG15},
|
||||
{"ANG20",ANG20},
|
||||
{"ANG30",ANG30},
|
||||
{"ANG60",ANG60},
|
||||
{"ANG64h",ANG64h},
|
||||
{"ANG105",ANG105},
|
||||
{"ANG210",ANG210},
|
||||
{"ANG255",ANG255},
|
||||
{"ANG340",ANG340},
|
||||
{"ANG350",ANG350},
|
||||
{"ANGLE_11hh",ANGLE_11hh},
|
||||
{"ANGLE_22h",ANGLE_22h},
|
||||
{"ANGLE_45",ANGLE_45},
|
||||
{"ANGLE_67h",ANGLE_67h},
|
||||
{"ANGLE_90",ANGLE_90},
|
||||
{"ANGLE_112h",ANGLE_112h},
|
||||
{"ANGLE_135",ANGLE_135},
|
||||
{"ANGLE_157h",ANGLE_157h},
|
||||
{"ANGLE_180",ANGLE_180},
|
||||
{"ANGLE_202h",ANGLE_202h},
|
||||
{"ANGLE_225",ANGLE_225},
|
||||
{"ANGLE_247h",ANGLE_247h},
|
||||
{"ANGLE_270",ANGLE_270},
|
||||
{"ANGLE_292h",ANGLE_292h},
|
||||
{"ANGLE_315",ANGLE_315},
|
||||
{"ANGLE_337h",ANGLE_337h},
|
||||
{"ANGLE_MAX",ANGLE_MAX},
|
||||
{"ANG1",ANG1>>16},
|
||||
{"ANG2",ANG2>>16},
|
||||
{"ANG10",ANG10>>16},
|
||||
{"ANG15",ANG15>>16},
|
||||
{"ANG20",ANG20>>16},
|
||||
{"ANG30",ANG30>>16},
|
||||
{"ANG60",ANG60>>16},
|
||||
{"ANG64h",ANG64h>>16},
|
||||
{"ANG105",ANG105>>16},
|
||||
{"ANG210",ANG210>>16},
|
||||
{"ANG255",ANG255>>16},
|
||||
{"ANG340",ANG340>>16},
|
||||
{"ANG350",ANG350>>16},
|
||||
{"ANGLE_11hh",ANGLE_11hh>>16},
|
||||
{"ANGLE_22h",ANGLE_22h>>16},
|
||||
{"ANGLE_45",ANGLE_45>>16},
|
||||
{"ANGLE_67h",ANGLE_67h>>16},
|
||||
{"ANGLE_90",ANGLE_90>>16},
|
||||
{"ANGLE_112h",ANGLE_112h>>16},
|
||||
{"ANGLE_135",ANGLE_135>>16},
|
||||
{"ANGLE_157h",ANGLE_157h>>16},
|
||||
{"ANGLE_180",ANGLE_180>>16},
|
||||
{"ANGLE_202h",ANGLE_202h>>16},
|
||||
{"ANGLE_225",ANGLE_225>>16},
|
||||
{"ANGLE_247h",ANGLE_247h>>16},
|
||||
{"ANGLE_270",ANGLE_270>>16},
|
||||
{"ANGLE_292h",ANGLE_292h>>16},
|
||||
{"ANGLE_315",ANGLE_315>>16},
|
||||
{"ANGLE_337h",ANGLE_337h>>16},
|
||||
{"ANGLE_MAX",ANGLE_MAX>>16},
|
||||
|
||||
// P_Chase directions (dirtype_t)
|
||||
{"DI_NODIR",DI_NODIR},
|
||||
|
|
|
@ -926,7 +926,7 @@ void HWR_InitMD2(void)
|
|||
CONS_Printf("MD2 for sprite PLAY detected in md2.dat, use a player skin instead!\n");
|
||||
continue;
|
||||
}
|
||||
|
||||
|
||||
for (i = 0; i < NUMSPRITES; i++)
|
||||
{
|
||||
if (stricmp(name, sprnames[i]) == 0)
|
||||
|
|
76
src/info.c
76
src/info.c
|
@ -64,7 +64,9 @@ char spr2names[NUMPLAYERSPRITES][5] =
|
|||
"RUN_",
|
||||
"PAIN",
|
||||
"DEAD",
|
||||
"DRWN",
|
||||
"SPIN",
|
||||
"DASH",
|
||||
"GASP",
|
||||
"JUMP",
|
||||
"FALL",
|
||||
|
@ -85,8 +87,17 @@ char spr2names[NUMPLAYERSPRITES][5] =
|
|||
"SSTD",
|
||||
"SWLK",
|
||||
"SRUN",
|
||||
"SPAN",
|
||||
"SMSL",
|
||||
"SDTH",
|
||||
"SDRN",
|
||||
"SSPN",
|
||||
"SGSP",
|
||||
"SJMP",
|
||||
"SFAL",
|
||||
"SEDG",
|
||||
"SHIT"
|
||||
"SRID",
|
||||
"SFLT"
|
||||
};
|
||||
|
||||
// Doesn't work with g++, needs actionf_p1 (don't modify this comment)
|
||||
|
@ -114,32 +125,47 @@ state_t states[NUMSTATES] =
|
|||
{SPR_THOK, FF_TRANS50, 8, {NULL}, 0, 0, S_NULL}, // S_THOK
|
||||
|
||||
// Player
|
||||
{SPR_PLAY, SPR2_STND, 105, {NULL}, 0, 0, S_PLAY_WAIT}, // S_PLAY_STND
|
||||
{SPR_PLAY, SPR2_WAIT, 16, {NULL}, 0, 0, S_PLAY_WAIT}, // S_PLAY_WAIT
|
||||
{SPR_PLAY, SPR2_WALK, 4, {NULL}, 0, 0, S_PLAY_WALK}, // S_PLAY_WALK
|
||||
{SPR_PLAY, SPR2_RUN , 2, {NULL}, 0, 0, S_PLAY_RUN}, // S_PLAY_RUN
|
||||
{SPR_PLAY, SPR2_PAIN, 350, {NULL}, 0, 0, S_PLAY_FALL}, // S_PLAY_PAIN
|
||||
{SPR_PLAY, SPR2_DEAD, 4, {A_Fall}, 0, 0, S_PLAY_DEAD}, // S_PLAY_DEAD
|
||||
{SPR_PLAY, SPR2_SPIN, 1, {NULL}, 0, 0, S_PLAY_SPIN}, // S_PLAY_SPIN
|
||||
{SPR_PLAY, SPR2_GASP, 14, {NULL}, 0, 0, S_PLAY_WALK}, // S_PLAY_GASP
|
||||
{SPR_PLAY, SPR2_JUMP, -1, {NULL}, 0, 0, S_PLAY_FALL}, // S_PLAY_JUMP
|
||||
{SPR_PLAY, SPR2_FALL, 2, {NULL}, 0, 0, S_PLAY_FALL}, // S_PLAY_FALL
|
||||
{SPR_PLAY, SPR2_EDGE, 12, {NULL}, 0, 0, S_PLAY_EDGE}, // S_PLAY_EDGE
|
||||
{SPR_PLAY, SPR2_RIDE, 4, {NULL}, 0, 0, S_PLAY_RIDE}, // S_PLAY_RIDE
|
||||
{SPR_PLAY, SPR2_STND, 105, {NULL}, 0, 0, S_PLAY_WAIT}, // S_PLAY_STND
|
||||
{SPR_PLAY, SPR2_WAIT, 16, {NULL}, 0, 0, S_PLAY_WAIT}, // S_PLAY_WAIT
|
||||
{SPR_PLAY, SPR2_WALK, 4, {NULL}, 0, 0, S_PLAY_WALK}, // S_PLAY_WALK
|
||||
{SPR_PLAY, SPR2_RUN , 2, {NULL}, 0, 0, S_PLAY_RUN}, // S_PLAY_RUN
|
||||
{SPR_PLAY, SPR2_PAIN, 350, {NULL}, 0, 0, S_PLAY_FALL}, // S_PLAY_PAIN
|
||||
{SPR_PLAY, SPR2_DEAD, 4, {NULL}, 0, 0, S_PLAY_DEAD}, // S_PLAY_DEAD
|
||||
{SPR_PLAY, SPR2_DRWN, 4, {NULL}, 0, 0, S_PLAY_DRWN}, // S_PLAY_DRWN
|
||||
{SPR_PLAY, SPR2_SPIN, 1, {NULL}, 0, 0, S_PLAY_SPIN}, // S_PLAY_SPIN
|
||||
{SPR_PLAY, SPR2_DASH, 2, {NULL}, 0, 0, S_PLAY_DASH}, // S_PLAY_DASH
|
||||
{SPR_PLAY, SPR2_GASP, 14, {NULL}, 0, 0, S_PLAY_WALK}, // S_PLAY_GASP
|
||||
{SPR_PLAY, SPR2_JUMP, 2, {NULL}, 0, 0, S_PLAY_JUMP}, // S_PLAY_JUMP
|
||||
{SPR_PLAY, SPR2_FALL, 2, {NULL}, 0, 0, S_PLAY_FALL}, // S_PLAY_FALL
|
||||
{SPR_PLAY, SPR2_EDGE, 12, {NULL}, 0, 0, S_PLAY_EDGE}, // S_PLAY_EDGE
|
||||
{SPR_PLAY, SPR2_RIDE, 4, {NULL}, 0, 0, S_PLAY_RIDE}, // S_PLAY_RIDE
|
||||
|
||||
{SPR_PLAY, SPR2_FLY , 2, {NULL}, 0, 0, S_PLAY_FLY}, // S_PLAY_FLY
|
||||
{SPR_PLAY, SPR2_TIRE, 12, {NULL}, 0, 0, S_PLAY_FLY_TIRED}, // S_PLAY_FLY_TIRED
|
||||
// Tails abilities
|
||||
{SPR_PLAY, SPR2_FLY , 2, {NULL}, 0, 0, S_PLAY_FLY}, // S_PLAY_FLY
|
||||
{SPR_PLAY, SPR2_TIRE, 12, {NULL}, 0, 0, S_PLAY_FLY_TIRED}, // S_PLAY_FLY_TIRED
|
||||
|
||||
{SPR_PLAY, SPR2_GLID, 2, {NULL}, 0, 0, S_PLAY_GLIDE}, // S_PLAY_GLIDE
|
||||
{SPR_PLAY, SPR2_CLNG, 6, {NULL}, 0, 0, S_PLAY_CLING}, // S_PLAY_CLING
|
||||
{SPR_PLAY, SPR2_CLMB, 5, {NULL}, 0, 0, S_PLAY_CLIMB}, // S_PLAY_CLIMB
|
||||
// Knuckles abilities
|
||||
{SPR_PLAY, SPR2_GLID, 2, {NULL}, 0, 0, S_PLAY_GLIDE}, // S_PLAY_GLIDE
|
||||
{SPR_PLAY, SPR2_CLNG, 6, {NULL}, 0, 0, S_PLAY_CLING}, // S_PLAY_CLING
|
||||
{SPR_PLAY, SPR2_CLMB, 5, {NULL}, 0, 0, S_PLAY_CLIMB}, // S_PLAY_CLIMB
|
||||
|
||||
{SPR_PLAY, SPR2_SSTD, 7, {NULL}, 0, 0, S_PLAY_SUPER_STND}, // S_PLAY_SUPER_STND
|
||||
{SPR_PLAY, SPR2_SWLK, 7, {NULL}, 0, 0, S_PLAY_SUPER_WALK}, // S_PLAY_SUPER_WALK
|
||||
{SPR_PLAY, SPR2_SRUN, 7, {NULL}, 0, 0, S_PLAY_SUPER_RUN}, // S_PLAY_SUPER_RUN
|
||||
{SPR_PLAY, SPR2_SEDG, 12, {NULL}, 0, 0, S_PLAY_SUPER_EDGE}, // S_PLAY_SUPER_EDGE
|
||||
{SPR_PLAY, SPR2_SHIT, -1, {NULL}, 0, 0, S_PLAY_SUPER_STND}, // S_PLAY_SUPER_PAIN
|
||||
// Super Sonic
|
||||
{SPR_PLAY, SPR2_SSTD, 7, {NULL}, 0, 0, S_PLAY_SUPER_STND}, // S_PLAY_SUPER_STND
|
||||
{SPR_PLAY, SPR2_SWLK, 7, {NULL}, 0, 0, S_PLAY_SUPER_WALK}, // S_PLAY_SUPER_WALK
|
||||
{SPR_PLAY, SPR2_SRUN, 7, {NULL}, 0, 0, S_PLAY_SUPER_RUN}, // S_PLAY_SUPER_RUN
|
||||
{SPR_PLAY, SPR2_SPAN, -1, {NULL}, 0, 0, S_PLAY_SUPER_STND}, // S_PLAY_SUPER_PAIN
|
||||
{SPR_PLAY, SPR2_SMSL, -1, {NULL}, 0, 0, S_PLAY_SUPER_STND}, // S_PLAY_SUPER_STUN
|
||||
{SPR_PLAY, SPR2_SDTH, 4, {NULL}, 0, 0, S_PLAY_SUPER_DEAD}, // S_PLAY_SUPER_DEAD
|
||||
{SPR_PLAY, SPR2_SDRN, 4, {NULL}, 0, 0, S_PLAY_SUPER_DRWN}, // S_PLAY_SUPER_DRWN
|
||||
{SPR_PLAY, SPR2_SSPN, 1, {NULL}, 0, 0, S_PLAY_SUPER_SPIN}, // S_PLAY_SUPER_SPIN
|
||||
{SPR_PLAY, SPR2_SGSP, 14, {NULL}, 0, 0, S_PLAY_SUPER_WALK}, // S_PLAY_SUPER_GASP
|
||||
{SPR_PLAY, SPR2_SJMP, 2, {NULL}, 0, 0, S_PLAY_SUPER_JUMP}, // S_PLAY_SUPER_JUMP
|
||||
{SPR_PLAY, SPR2_SFAL, 2, {NULL}, 0, 0, S_PLAY_SUPER_FALL}, // S_PLAY_SUPER_FALL
|
||||
{SPR_PLAY, SPR2_SEDG, 12, {NULL}, 0, 0, S_PLAY_SUPER_EDGE}, // S_PLAY_SUPER_EDGE
|
||||
{SPR_PLAY, SPR2_SRID, 4, {NULL}, 0, 0, S_PLAY_SUPER_RIDE}, // S_PLAY_SUPER_RIDE
|
||||
{SPR_PLAY, SPR2_SFLT, 7, {NULL}, 0, 0, S_PLAY_SUPER_FLOAT}, // S_PLAY_SUPER_FLOAT
|
||||
|
||||
// Transforming into Super
|
||||
{SPR_PLAY, SPR2_TRNS, 4, {NULL}, 0, 0, S_PLAY_SUPER_TRANS2}, // S_PLAY_SUPER_TRANS
|
||||
{SPR_PLAY, SPR2_TRNS, 4, {NULL}, 0, 0, S_PLAY_SUPER_TRANS3}, // S_PLAY_SUPER_TRANS2
|
||||
{SPR_PLAY, SPR2_TRNS|FF_FULLBRIGHT, 4, {NULL}, 0, 0, S_PLAY_SUPER_TRANS4}, // S_PLAY_SUPER_TRANS3
|
||||
|
@ -3130,8 +3156,8 @@ mobjinfo_t mobjinfo[NUMMOBJTYPES] =
|
|||
sfx_None, // painsound
|
||||
S_NULL, // meleestate
|
||||
S_PLAY_SPIN, // missilestate
|
||||
S_PLAY_DEAD, // deathstate
|
||||
S_NULL, // xdeathstate
|
||||
S_PLAY_DEAD, // deathstate
|
||||
S_PLAY_DRWN, // xdeathstate
|
||||
sfx_None, // deathsound
|
||||
1, // speed
|
||||
16*FRACUNIT, // radius
|
||||
|
|
26
src/info.h
26
src/info.h
|
@ -583,7 +583,9 @@ enum playersprite
|
|||
SPR2_RUN ,
|
||||
SPR2_PAIN,
|
||||
SPR2_DEAD,
|
||||
SPR2_DRWN,
|
||||
SPR2_SPIN,
|
||||
SPR2_DASH,
|
||||
SPR2_GASP,
|
||||
SPR2_JUMP,
|
||||
SPR2_FALL,
|
||||
|
@ -604,8 +606,17 @@ enum playersprite
|
|||
SPR2_SSTD,
|
||||
SPR2_SWLK,
|
||||
SPR2_SRUN,
|
||||
SPR2_SPAN,
|
||||
SPR2_SMSL,
|
||||
SPR2_SDTH,
|
||||
SPR2_SDRN,
|
||||
SPR2_SSPN,
|
||||
SPR2_SGSP,
|
||||
SPR2_SJMP,
|
||||
SPR2_SFAL,
|
||||
SPR2_SEDG,
|
||||
SPR2_SHIT,
|
||||
SPR2_SRID,
|
||||
SPR2_SFLT,
|
||||
|
||||
NUMPLAYERSPRITES
|
||||
};
|
||||
|
@ -634,7 +645,9 @@ typedef enum state
|
|||
S_PLAY_RUN,
|
||||
S_PLAY_PAIN,
|
||||
S_PLAY_DEAD,
|
||||
S_PLAY_DRWN,
|
||||
S_PLAY_SPIN,
|
||||
S_PLAY_DASH,
|
||||
S_PLAY_GASP,
|
||||
S_PLAY_JUMP,
|
||||
S_PLAY_FALL,
|
||||
|
@ -654,8 +667,17 @@ typedef enum state
|
|||
S_PLAY_SUPER_STND,
|
||||
S_PLAY_SUPER_WALK,
|
||||
S_PLAY_SUPER_RUN,
|
||||
S_PLAY_SUPER_EDGE,
|
||||
S_PLAY_SUPER_PAIN,
|
||||
S_PLAY_SUPER_STUN,
|
||||
S_PLAY_SUPER_DEAD,
|
||||
S_PLAY_SUPER_DRWN,
|
||||
S_PLAY_SUPER_SPIN,
|
||||
S_PLAY_SUPER_GASP,
|
||||
S_PLAY_SUPER_JUMP,
|
||||
S_PLAY_SUPER_FALL,
|
||||
S_PLAY_SUPER_EDGE,
|
||||
S_PLAY_SUPER_RIDE,
|
||||
S_PLAY_SUPER_FLOAT,
|
||||
|
||||
// SF_SUPER
|
||||
S_PLAY_SUPER_TRANS,
|
||||
|
|
|
@ -85,13 +85,6 @@ static int lib_print(lua_State *L)
|
|||
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
|
||||
//////////////
|
||||
|
||||
|
@ -138,25 +131,25 @@ static int lib_pRandomRange(lua_State *L)
|
|||
|
||||
static int lib_pAproxDistance(lua_State *L)
|
||||
{
|
||||
fixed_t dx = (fixed_t)luaL_checkinteger(L, 1);
|
||||
fixed_t dy = (fixed_t)luaL_checkinteger(L, 2);
|
||||
fixed_t dx = luaL_checkfixed(L, 1);
|
||||
fixed_t dy = luaL_checkfixed(L, 2);
|
||||
//HUDSAFE
|
||||
lua_pushinteger(L, P_AproxDistance(dx, dy));
|
||||
lua_pushfixed(L, P_AproxDistance(dx, dy));
|
||||
return 1;
|
||||
}
|
||||
|
||||
static int lib_pClosestPointOnLine(lua_State *L)
|
||||
{
|
||||
fixed_t x = (fixed_t)luaL_checkinteger(L, 1);
|
||||
fixed_t y = (fixed_t)luaL_checkinteger(L, 2);
|
||||
fixed_t x = luaL_checkfixed(L, 1);
|
||||
fixed_t y = luaL_checkfixed(L, 2);
|
||||
line_t *line = *((line_t **)luaL_checkudata(L, 3, META_LINE));
|
||||
vertex_t result;
|
||||
//HUDSAFE
|
||||
if (!line)
|
||||
return LUA_ErrInvalid(L, "line_t");
|
||||
P_ClosestPointOnLine(x, y, line, &result);
|
||||
lua_pushinteger(L, result.x);
|
||||
lua_pushinteger(L, result.y);
|
||||
lua_pushfixed(L, result.x);
|
||||
lua_pushfixed(L, result.y);
|
||||
return 2;
|
||||
}
|
||||
|
||||
|
@ -241,9 +234,9 @@ static int lib_pLookForPlayers(lua_State *L)
|
|||
|
||||
static int lib_pSpawnMobj(lua_State *L)
|
||||
{
|
||||
fixed_t x = (fixed_t)luaL_checkinteger(L, 1);
|
||||
fixed_t y = (fixed_t)luaL_checkinteger(L, 2);
|
||||
fixed_t z = (fixed_t)luaL_checkinteger(L, 3);
|
||||
fixed_t x = luaL_checkfixed(L, 1);
|
||||
fixed_t y = luaL_checkfixed(L, 2);
|
||||
fixed_t z = luaL_checkfixed(L, 3);
|
||||
mobjtype_t type = luaL_checkinteger(L, 4);
|
||||
NOHUD
|
||||
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 *dest = *((mobj_t **)luaL_checkudata(L, 2, META_MOBJ));
|
||||
mobjtype_t type = luaL_checkinteger(L, 3);
|
||||
fixed_t x = (fixed_t)luaL_checkinteger(L, 4);
|
||||
fixed_t y = (fixed_t)luaL_checkinteger(L, 5);
|
||||
fixed_t z = (fixed_t)luaL_checkinteger(L, 6);
|
||||
fixed_t x = luaL_checkfixed(L, 4);
|
||||
fixed_t y = luaL_checkfixed(L, 5);
|
||||
fixed_t z = luaL_checkfixed(L, 6);
|
||||
NOHUD
|
||||
if (!source || !dest)
|
||||
return LUA_ErrInvalid(L, "mobj_t");
|
||||
|
@ -298,13 +291,13 @@ static int lib_pSpawnXYZMissile(lua_State *L)
|
|||
static int lib_pSpawnPointMissile(lua_State *L)
|
||||
{
|
||||
mobj_t *source = *((mobj_t **)luaL_checkudata(L, 1, META_MOBJ));
|
||||
fixed_t xa = (fixed_t)luaL_checkinteger(L, 2);
|
||||
fixed_t ya = (fixed_t)luaL_checkinteger(L, 3);
|
||||
fixed_t za = (fixed_t)luaL_checkinteger(L, 4);
|
||||
fixed_t xa = luaL_checkfixed(L, 2);
|
||||
fixed_t ya = luaL_checkfixed(L, 3);
|
||||
fixed_t za = luaL_checkfixed(L, 4);
|
||||
mobjtype_t type = luaL_checkinteger(L, 5);
|
||||
fixed_t x = (fixed_t)luaL_checkinteger(L, 6);
|
||||
fixed_t y = (fixed_t)luaL_checkinteger(L, 7);
|
||||
fixed_t z = (fixed_t)luaL_checkinteger(L, 8);
|
||||
fixed_t x = luaL_checkfixed(L, 6);
|
||||
fixed_t y = luaL_checkfixed(L, 7);
|
||||
fixed_t z = luaL_checkfixed(L, 8);
|
||||
NOHUD
|
||||
if (!source)
|
||||
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));
|
||||
mobjtype_t type = luaL_checkinteger(L, 2);
|
||||
fixed_t x = (fixed_t)luaL_checkinteger(L, 3);
|
||||
fixed_t y = (fixed_t)luaL_checkinteger(L, 4);
|
||||
fixed_t z = (fixed_t)luaL_checkinteger(L, 5);
|
||||
fixed_t x = luaL_checkfixed(L, 3);
|
||||
fixed_t y = luaL_checkfixed(L, 4);
|
||||
fixed_t z = luaL_checkfixed(L, 5);
|
||||
INT32 shiftingAngle = (INT32)luaL_checkinteger(L, 5);
|
||||
NOHUD
|
||||
if (!source)
|
||||
|
@ -348,7 +341,7 @@ static int lib_pSPMAngle(lua_State *L)
|
|||
{
|
||||
mobj_t *source = *((mobj_t **)luaL_checkudata(L, 1, META_MOBJ));
|
||||
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);
|
||||
UINT32 flags2 = (UINT32)luaL_optinteger(L, 5, 0);
|
||||
NOHUD
|
||||
|
@ -418,13 +411,13 @@ static int lib_pGetClosestAxis(lua_State *L)
|
|||
|
||||
static int lib_pSpawnParaloop(lua_State *L)
|
||||
{
|
||||
fixed_t x = (fixed_t)luaL_checkinteger(L, 1);
|
||||
fixed_t y = (fixed_t)luaL_checkinteger(L, 2);
|
||||
fixed_t z = (fixed_t)luaL_checkinteger(L, 3);
|
||||
fixed_t radius = (fixed_t)luaL_checkinteger(L, 4);
|
||||
fixed_t x = luaL_checkfixed(L, 1);
|
||||
fixed_t y = luaL_checkfixed(L, 2);
|
||||
fixed_t z = luaL_checkfixed(L, 3);
|
||||
fixed_t radius = luaL_checkfixed(L, 4);
|
||||
INT32 number = (INT32)luaL_checkinteger(L, 5);
|
||||
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);
|
||||
boolean spawncenter = lua_optboolean(L, 9);
|
||||
NOHUD
|
||||
|
@ -458,7 +451,7 @@ static int lib_pSupermanLook4Players(lua_State *L)
|
|||
static int lib_pSetScale(lua_State *L)
|
||||
{
|
||||
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
|
||||
if (!mobj)
|
||||
return LUA_ErrInvalid(L, "mobj_t");
|
||||
|
@ -526,7 +519,7 @@ static int lib_pGetPlayerHeight(lua_State *L)
|
|||
//HUDSAFE
|
||||
if (!player)
|
||||
return LUA_ErrInvalid(L, "player_t");
|
||||
lua_pushinteger(L, P_GetPlayerHeight(player));
|
||||
lua_pushfixed(L, P_GetPlayerHeight(player));
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
@ -536,7 +529,7 @@ static int lib_pGetPlayerSpinHeight(lua_State *L)
|
|||
//HUDSAFE
|
||||
if (!player)
|
||||
return LUA_ErrInvalid(L, "player_t");
|
||||
lua_pushinteger(L, P_GetPlayerSpinHeight(player));
|
||||
lua_pushfixed(L, P_GetPlayerSpinHeight(player));
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
@ -639,7 +632,7 @@ static int lib_pInQuicksand(lua_State *L)
|
|||
static int lib_pSetObjectMomZ(lua_State *L)
|
||||
{
|
||||
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);
|
||||
NOHUD
|
||||
if (!mo)
|
||||
|
@ -753,8 +746,8 @@ static int lib_pDoPlayerExit(lua_State *L)
|
|||
static int lib_pInstaThrust(lua_State *L)
|
||||
{
|
||||
mobj_t *mo = *((mobj_t **)luaL_checkudata(L, 1, META_MOBJ));
|
||||
angle_t angle = (angle_t)luaL_checkinteger(L, 2);
|
||||
fixed_t move = (fixed_t)luaL_checkinteger(L, 3);
|
||||
angle_t angle = luaL_checkangle(L, 2);
|
||||
fixed_t move = luaL_checkfixed(L, 3);
|
||||
NOHUD
|
||||
if (!mo)
|
||||
return LUA_ErrInvalid(L, "mobj_t");
|
||||
|
@ -768,10 +761,10 @@ static int lib_pReturnThrustX(lua_State *L)
|
|||
fixed_t move;
|
||||
if (lua_isnil(L, 1) || lua_isuserdata(L, 1))
|
||||
lua_remove(L, 1); // ignore mobj as arg1
|
||||
angle = (angle_t)luaL_checkinteger(L, 1);
|
||||
move = (fixed_t)luaL_checkinteger(L, 2);
|
||||
angle = luaL_checkangle(L, 1);
|
||||
move = luaL_checkfixed(L, 2);
|
||||
//HUDSAFE
|
||||
lua_pushinteger(L, P_ReturnThrustX(NULL, angle, move));
|
||||
lua_pushfixed(L, P_ReturnThrustX(NULL, angle, move));
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
@ -781,10 +774,10 @@ static int lib_pReturnThrustY(lua_State *L)
|
|||
fixed_t move;
|
||||
if (lua_isnil(L, 1) || lua_isuserdata(L, 1))
|
||||
lua_remove(L, 1); // ignore mobj as arg1
|
||||
angle = (angle_t)luaL_checkinteger(L, 1);
|
||||
move = (fixed_t)luaL_checkinteger(L, 2);
|
||||
angle = luaL_checkangle(L, 1);
|
||||
move = luaL_checkfixed(L, 2);
|
||||
//HUDSAFE
|
||||
lua_pushinteger(L, P_ReturnThrustY(NULL, angle, move));
|
||||
lua_pushfixed(L, P_ReturnThrustY(NULL, angle, move));
|
||||
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 *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
|
||||
if (!inflictor || !source)
|
||||
return LUA_ErrInvalid(L, "mobj_t");
|
||||
|
@ -868,8 +861,8 @@ static int lib_pSpawnSpinMobj(lua_State *L)
|
|||
static int lib_pTelekinesis(lua_State *L)
|
||||
{
|
||||
player_t *player = *((player_t **)luaL_checkudata(L, 1, META_PLAYER));
|
||||
fixed_t thrust = (fixed_t)luaL_checkinteger(L, 2);
|
||||
fixed_t range = (fixed_t)luaL_checkinteger(L, 3);
|
||||
fixed_t thrust = luaL_checkfixed(L, 2);
|
||||
fixed_t range = luaL_checkfixed(L, 3);
|
||||
NOHUD
|
||||
if (!player)
|
||||
return LUA_ErrInvalid(L, "player_t");
|
||||
|
@ -884,8 +877,8 @@ static int lib_pCheckPosition(lua_State *L)
|
|||
{
|
||||
mobj_t *ptmthing = tmthing;
|
||||
mobj_t *thing = *((mobj_t **)luaL_checkudata(L, 1, META_MOBJ));
|
||||
fixed_t x = (fixed_t)luaL_checkinteger(L, 2);
|
||||
fixed_t y = (fixed_t)luaL_checkinteger(L, 3);
|
||||
fixed_t x = luaL_checkfixed(L, 2);
|
||||
fixed_t y = luaL_checkfixed(L, 3);
|
||||
NOHUD
|
||||
if (!thing)
|
||||
return LUA_ErrInvalid(L, "mobj_t");
|
||||
|
@ -899,8 +892,8 @@ static int lib_pTryMove(lua_State *L)
|
|||
{
|
||||
mobj_t *ptmthing = tmthing;
|
||||
mobj_t *thing = *((mobj_t **)luaL_checkudata(L, 1, META_MOBJ));
|
||||
fixed_t x = (fixed_t)luaL_checkinteger(L, 2);
|
||||
fixed_t y = (fixed_t)luaL_checkinteger(L, 3);
|
||||
fixed_t x = luaL_checkfixed(L, 2);
|
||||
fixed_t y = luaL_checkfixed(L, 3);
|
||||
boolean allowdropoff = lua_optboolean(L, 4);
|
||||
NOHUD
|
||||
if (!thing)
|
||||
|
@ -915,7 +908,7 @@ static int lib_pMove(lua_State *L)
|
|||
{
|
||||
mobj_t *ptmthing = tmthing;
|
||||
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
|
||||
if (!actor)
|
||||
return LUA_ErrInvalid(L, "mobj_t");
|
||||
|
@ -929,9 +922,9 @@ static int lib_pTeleportMove(lua_State *L)
|
|||
{
|
||||
mobj_t *ptmthing = tmthing;
|
||||
mobj_t *thing = *((mobj_t **)luaL_checkudata(L, 1, META_MOBJ));
|
||||
fixed_t x = (fixed_t)luaL_checkinteger(L, 2);
|
||||
fixed_t y = (fixed_t)luaL_checkinteger(L, 3);
|
||||
fixed_t z = (fixed_t)luaL_checkinteger(L, 4);
|
||||
fixed_t x = luaL_checkfixed(L, 2);
|
||||
fixed_t y = luaL_checkfixed(L, 3);
|
||||
fixed_t z = luaL_checkfixed(L, 4);
|
||||
NOHUD
|
||||
if (!thing)
|
||||
return LUA_ErrInvalid(L, "mobj_t");
|
||||
|
@ -975,10 +968,10 @@ static int lib_pCheckSight(lua_State *L)
|
|||
static int lib_pCheckHoopPosition(lua_State *L)
|
||||
{
|
||||
mobj_t *hoopthing = *((mobj_t **)luaL_checkudata(L, 1, META_MOBJ));
|
||||
fixed_t x = (fixed_t)luaL_checkinteger(L, 2);
|
||||
fixed_t y = (fixed_t)luaL_checkinteger(L, 3);
|
||||
fixed_t z = (fixed_t)luaL_checkinteger(L, 4);
|
||||
fixed_t radius = (fixed_t)luaL_checkinteger(L, 5);
|
||||
fixed_t x = luaL_checkfixed(L, 2);
|
||||
fixed_t y = luaL_checkfixed(L, 3);
|
||||
fixed_t z = luaL_checkfixed(L, 4);
|
||||
fixed_t radius = luaL_checkfixed(L, 5);
|
||||
NOHUD
|
||||
if (!hoopthing)
|
||||
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 *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
|
||||
if (!spot || !source)
|
||||
return LUA_ErrInvalid(L, "mobj_t");
|
||||
|
@ -1000,12 +993,12 @@ static int lib_pRadiusAttack(lua_State *L)
|
|||
|
||||
static int lib_pFloorzAtPos(lua_State *L)
|
||||
{
|
||||
fixed_t x = (fixed_t)luaL_checkinteger(L, 1);
|
||||
fixed_t y = (fixed_t)luaL_checkinteger(L, 2);
|
||||
fixed_t z = (fixed_t)luaL_checkinteger(L, 3);
|
||||
fixed_t height = (fixed_t)luaL_checkinteger(L, 4);
|
||||
fixed_t x = luaL_checkfixed(L, 1);
|
||||
fixed_t y = luaL_checkfixed(L, 2);
|
||||
fixed_t z = luaL_checkfixed(L, 3);
|
||||
fixed_t height = luaL_checkfixed(L, 4);
|
||||
//HUDSAFE
|
||||
lua_pushinteger(L, P_FloorzAtPos(x, y, z, height));
|
||||
lua_pushfixed(L, P_FloorzAtPos(x, y, z, height));
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
@ -1213,8 +1206,8 @@ static int lib_pDoNightsScore(lua_State *L)
|
|||
static int lib_pThrust(lua_State *L)
|
||||
{
|
||||
mobj_t *mo = *((mobj_t **)luaL_checkudata(L, 1, META_MOBJ));
|
||||
angle_t angle = (angle_t)luaL_checkinteger(L, 2);
|
||||
fixed_t move = (fixed_t)luaL_checkinteger(L, 3);
|
||||
angle_t angle = luaL_checkangle(L, 2);
|
||||
fixed_t move = luaL_checkfixed(L, 3);
|
||||
NOHUD
|
||||
if (!mo)
|
||||
return LUA_ErrInvalid(L, "mobj_t");
|
||||
|
@ -1489,48 +1482,48 @@ static int lib_evCrumbleChain(lua_State *L)
|
|||
|
||||
static int lib_rPointToAngle(lua_State *L)
|
||||
{
|
||||
fixed_t x = (fixed_t)luaL_checkinteger(L, 1);
|
||||
fixed_t y = (fixed_t)luaL_checkinteger(L, 2);
|
||||
fixed_t x = luaL_checkfixed(L, 1);
|
||||
fixed_t y = luaL_checkfixed(L, 2);
|
||||
//HUDSAFE
|
||||
lua_pushinteger(L, R_PointToAngle(x, y));
|
||||
lua_pushangle(L, R_PointToAngle(x, y));
|
||||
return 1;
|
||||
}
|
||||
|
||||
static int lib_rPointToAngle2(lua_State *L)
|
||||
{
|
||||
fixed_t px2 = (fixed_t)luaL_checkinteger(L, 1);
|
||||
fixed_t py2 = (fixed_t)luaL_checkinteger(L, 2);
|
||||
fixed_t px1 = (fixed_t)luaL_checkinteger(L, 3);
|
||||
fixed_t py1 = (fixed_t)luaL_checkinteger(L, 4);
|
||||
fixed_t px2 = luaL_checkfixed(L, 1);
|
||||
fixed_t py2 = luaL_checkfixed(L, 2);
|
||||
fixed_t px1 = luaL_checkfixed(L, 3);
|
||||
fixed_t py1 = luaL_checkfixed(L, 4);
|
||||
//HUDSAFE
|
||||
lua_pushinteger(L, R_PointToAngle2(px2, py2, px1, py1));
|
||||
lua_pushangle(L, R_PointToAngle2(px2, py2, px1, py1));
|
||||
return 1;
|
||||
}
|
||||
|
||||
static int lib_rPointToDist(lua_State *L)
|
||||
{
|
||||
fixed_t x = (fixed_t)luaL_checkinteger(L, 1);
|
||||
fixed_t y = (fixed_t)luaL_checkinteger(L, 2);
|
||||
fixed_t x = luaL_checkfixed(L, 1);
|
||||
fixed_t y = luaL_checkfixed(L, 2);
|
||||
//HUDSAFE
|
||||
lua_pushinteger(L, R_PointToDist(x, y));
|
||||
lua_pushfixed(L, R_PointToDist(x, y));
|
||||
return 1;
|
||||
}
|
||||
|
||||
static int lib_rPointToDist2(lua_State *L)
|
||||
{
|
||||
fixed_t px2 = (fixed_t)luaL_checkinteger(L, 1);
|
||||
fixed_t py2 = (fixed_t)luaL_checkinteger(L, 2);
|
||||
fixed_t px1 = (fixed_t)luaL_checkinteger(L, 3);
|
||||
fixed_t py1 = (fixed_t)luaL_checkinteger(L, 4);
|
||||
fixed_t px2 = luaL_checkfixed(L, 1);
|
||||
fixed_t py2 = luaL_checkfixed(L, 2);
|
||||
fixed_t px1 = luaL_checkfixed(L, 3);
|
||||
fixed_t py1 = luaL_checkfixed(L, 4);
|
||||
//HUDSAFE
|
||||
lua_pushinteger(L, R_PointToDist2(px2, py2, px1, py1));
|
||||
lua_pushfixed(L, R_PointToDist2(px2, py2, px1, py1));
|
||||
return 1;
|
||||
}
|
||||
|
||||
static int lib_rPointInSubsector(lua_State *L)
|
||||
{
|
||||
fixed_t x = (fixed_t)luaL_checkinteger(L, 1);
|
||||
fixed_t y = (fixed_t)luaL_checkinteger(L, 2);
|
||||
fixed_t x = luaL_checkfixed(L, 1);
|
||||
fixed_t y = luaL_checkfixed(L, 2);
|
||||
//HUDSAFE
|
||||
LUA_PushUserdata(L, R_PointInSubsector(x, y), META_SUBSECTOR);
|
||||
return 1;
|
||||
|
@ -1664,7 +1657,7 @@ static int lib_sChangeMusic(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);
|
||||
player_t *player = NULL;
|
||||
NOHUD
|
||||
|
@ -1865,7 +1858,6 @@ static int lib_gTicsToMilliseconds(lua_State *L)
|
|||
|
||||
static luaL_Reg lib[] = {
|
||||
{"print", lib_print},
|
||||
{"EvalMath", lib_evalMath},
|
||||
|
||||
// m_random
|
||||
{"P_Random",lib_pRandom},
|
||||
|
|
|
@ -41,7 +41,7 @@ enum hook {
|
|||
hook_BotAI,
|
||||
hook_LinedefExecute,
|
||||
hook_PlayerMsg,
|
||||
hook_DeathMsg,
|
||||
hook_HurtMsg,
|
||||
|
||||
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_PlayerHook(player_t *plr, enum hook which);
|
||||
#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_MobjMoveCollide(mobj_t *thing1, mobj_t *thing2); // Hook for PIT_CheckThing by (tmthing) mobj type
|
||||
UINT8 LUAh_MobjCollideHook(mobj_t *thing1, mobj_t *thing2, enum hook which);
|
||||
#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
|
||||
#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
|
||||
|
@ -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_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_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
|
||||
|
|
1175
src/lua_hooklib.c
1175
src/lua_hooklib.c
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_pop(gL, -1);
|
||||
lua_gc(gL, LUA_GCCOLLECT, 0);
|
||||
|
||||
hud_running = false;
|
||||
}
|
||||
|
||||
|
@ -701,8 +699,6 @@ void LUAh_ScoresHUD(void)
|
|||
LUA_Call(gL, 1);
|
||||
}
|
||||
lua_pop(gL, -1);
|
||||
lua_gc(gL, LUA_GCCOLLECT, 0);
|
||||
|
||||
hud_running = false;
|
||||
}
|
||||
|
||||
|
|
|
@ -175,8 +175,6 @@ static void A_Lua(mobj_t *actor)
|
|||
--superstack;
|
||||
superactions[superstack] = NULL;
|
||||
}
|
||||
|
||||
lua_gc(gL, LUA_GCSTEP, 1);
|
||||
}
|
||||
|
||||
// Arbitrary states[] table index -> state_t *
|
||||
|
@ -548,11 +546,11 @@ static int lib_setMobjInfo(lua_State *L)
|
|||
else if (i == 15 || (str && fastcmp(str,"deathsound")))
|
||||
info->deathsound = luaL_checkinteger(L, 3);
|
||||
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")))
|
||||
info->radius = (fixed_t)luaL_checkinteger(L, 3);
|
||||
info->radius = luaL_checkfixed(L, 3);
|
||||
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")))
|
||||
info->dispoffset = (INT32)luaL_checkinteger(L, 3);
|
||||
else if (i == 20 || (str && fastcmp(str,"mass")))
|
||||
|
@ -618,11 +616,11 @@ static int mobjinfo_get(lua_State *L)
|
|||
else if (fastcmp(field,"deathsound"))
|
||||
lua_pushinteger(L, info->deathsound);
|
||||
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"))
|
||||
lua_pushinteger(L, info->radius);
|
||||
lua_pushfixed(L, info->radius);
|
||||
else if (fastcmp(field,"height"))
|
||||
lua_pushinteger(L, info->height);
|
||||
lua_pushfixed(L, info->height);
|
||||
else if (fastcmp(field,"dispoffset"))
|
||||
lua_pushinteger(L, info->dispoffset);
|
||||
else if (fastcmp(field,"mass"))
|
||||
|
@ -694,11 +692,11 @@ static int mobjinfo_set(lua_State *L)
|
|||
else if (fastcmp(field,"deathsound"))
|
||||
info->deathsound = luaL_checkinteger(L, 3);
|
||||
else if (fastcmp(field,"speed"))
|
||||
info->speed = (fixed_t)luaL_checkinteger(L, 3);
|
||||
info->speed = luaL_checkfixed(L, 3);
|
||||
else if (fastcmp(field,"radius"))
|
||||
info->radius = (fixed_t)luaL_checkinteger(L, 3);
|
||||
info->radius = luaL_checkfixed(L, 3);
|
||||
else if (fastcmp(field,"height"))
|
||||
info->height = (fixed_t)luaL_checkinteger(L, 3);
|
||||
info->height = luaL_checkfixed(L, 3);
|
||||
else if (fastcmp(field,"dispoffset"))
|
||||
info->dispoffset = (INT32)luaL_checkinteger(L, 3);
|
||||
else if (fastcmp(field,"mass"))
|
||||
|
|
|
@ -280,10 +280,10 @@ static int sector_get(lua_State *L)
|
|||
lua_pushboolean(L, 1);
|
||||
return 1;
|
||||
case sector_floorheight:
|
||||
lua_pushinteger(L, sector->floorheight);
|
||||
lua_pushfixed(L, sector->floorheight);
|
||||
return 1;
|
||||
case sector_ceilingheight:
|
||||
lua_pushinteger(L, sector->ceilingheight);
|
||||
lua_pushfixed(L, sector->ceilingheight);
|
||||
return 1;
|
||||
case sector_floorpic: { // floorpic
|
||||
levelflat_t *levelflat;
|
||||
|
@ -396,26 +396,30 @@ static int sector_set(lua_State *L)
|
|||
return luaL_error(L, "sector_t field " LUA_QS " cannot be set.", sector_opt[field]);
|
||||
case sector_floorheight: { // floorheight
|
||||
boolean flag;
|
||||
mobj_t *ptmthing = tmthing;
|
||||
fixed_t lastpos = sector->floorheight;
|
||||
sector->floorheight = (fixed_t)luaL_checkinteger(L, 3);
|
||||
sector->floorheight = luaL_checkfixed(L, 3);
|
||||
flag = P_CheckSector(sector, true);
|
||||
if (flag && sector->numattached)
|
||||
{
|
||||
sector->floorheight = lastpos;
|
||||
P_CheckSector(sector, true);
|
||||
}
|
||||
P_SetTarget(&tmthing, ptmthing);
|
||||
break;
|
||||
}
|
||||
case sector_ceilingheight: { // ceilingheight
|
||||
boolean flag;
|
||||
mobj_t *ptmthing = tmthing;
|
||||
fixed_t lastpos = sector->ceilingheight;
|
||||
sector->ceilingheight = (fixed_t)luaL_checkinteger(L, 3);
|
||||
sector->ceilingheight = luaL_checkfixed(L, 3);
|
||||
flag = P_CheckSector(sector, true);
|
||||
if (flag && sector->numattached)
|
||||
{
|
||||
sector->ceilingheight = lastpos;
|
||||
P_CheckSector(sector, true);
|
||||
}
|
||||
P_SetTarget(&tmthing, ptmthing);
|
||||
break;
|
||||
}
|
||||
case sector_floorpic:
|
||||
|
@ -509,10 +513,10 @@ static int line_get(lua_State *L)
|
|||
LUA_PushUserdata(L, line->v2, META_VERTEX);
|
||||
return 1;
|
||||
case line_dx:
|
||||
lua_pushinteger(L, line->dx);
|
||||
lua_pushfixed(L, line->dx);
|
||||
return 1;
|
||||
case line_dy:
|
||||
lua_pushinteger(L, line->dy);
|
||||
lua_pushfixed(L, line->dy);
|
||||
return 1;
|
||||
case line_flags:
|
||||
lua_pushinteger(L, line->flags);
|
||||
|
@ -628,10 +632,10 @@ static int side_get(lua_State *L)
|
|||
lua_pushboolean(L, 1);
|
||||
return 1;
|
||||
case side_textureoffset:
|
||||
lua_pushinteger(L, side->textureoffset);
|
||||
lua_pushfixed(L, side->textureoffset);
|
||||
return 1;
|
||||
case side_rowoffset:
|
||||
lua_pushinteger(L, side->rowoffset);
|
||||
lua_pushfixed(L, side->rowoffset);
|
||||
return 1;
|
||||
case side_toptexture:
|
||||
lua_pushinteger(L, side->toptexture);
|
||||
|
@ -658,6 +662,50 @@ static int side_get(lua_State *L)
|
|||
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)
|
||||
{
|
||||
side_t *side = *((side_t **)luaL_checkudata(L, 1, META_SIDE));
|
||||
|
@ -685,13 +733,13 @@ static int vertex_get(lua_State *L)
|
|||
lua_pushboolean(L, 1);
|
||||
return 1;
|
||||
case vertex_x:
|
||||
lua_pushinteger(L, vertex->x);
|
||||
lua_pushfixed(L, vertex->x);
|
||||
return 1;
|
||||
case vertex_y:
|
||||
lua_pushinteger(L, vertex->y);
|
||||
lua_pushfixed(L, vertex->y);
|
||||
return 1;
|
||||
case vertex_z:
|
||||
lua_pushinteger(L, vertex->z);
|
||||
lua_pushfixed(L, vertex->z);
|
||||
return 1;
|
||||
}
|
||||
return 0;
|
||||
|
@ -954,7 +1002,7 @@ static int ffloor_get(lua_State *L)
|
|||
lua_pushboolean(L, 1);
|
||||
return 1;
|
||||
case ffloor_topheight:
|
||||
lua_pushinteger(L, *ffloor->topheight);
|
||||
lua_pushfixed(L, *ffloor->topheight);
|
||||
return 1;
|
||||
case ffloor_toppic: { // toppic
|
||||
levelflat_t *levelflat;
|
||||
|
@ -968,7 +1016,7 @@ static int ffloor_get(lua_State *L)
|
|||
lua_pushinteger(L, *ffloor->toplightlevel);
|
||||
return 1;
|
||||
case ffloor_bottomheight:
|
||||
lua_pushinteger(L, *ffloor->bottomheight);
|
||||
lua_pushfixed(L, *ffloor->bottomheight);
|
||||
return 1;
|
||||
case ffloor_bottompic: { // bottompic
|
||||
levelflat_t *levelflat;
|
||||
|
@ -1027,14 +1075,16 @@ static int ffloor_set(lua_State *L)
|
|||
case ffloor_topheight: { // topheight
|
||||
boolean flag;
|
||||
fixed_t lastpos = *ffloor->topheight;
|
||||
mobj_t *ptmthing = tmthing;
|
||||
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);
|
||||
if (flag && sector->numattached)
|
||||
{
|
||||
*ffloor->topheight = lastpos;
|
||||
P_CheckSector(sector, true);
|
||||
}
|
||||
P_SetTarget(&tmthing, ptmthing);
|
||||
break;
|
||||
}
|
||||
case ffloor_toppic:
|
||||
|
@ -1046,14 +1096,16 @@ static int ffloor_set(lua_State *L)
|
|||
case ffloor_bottomheight: { // bottomheight
|
||||
boolean flag;
|
||||
fixed_t lastpos = *ffloor->bottomheight;
|
||||
mobj_t *ptmthing = tmthing;
|
||||
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);
|
||||
if (flag && sector->numattached)
|
||||
{
|
||||
*ffloor->bottomheight = lastpos;
|
||||
P_CheckSector(sector, true);
|
||||
}
|
||||
P_SetTarget(&tmthing, ptmthing);
|
||||
break;
|
||||
}
|
||||
case ffloor_bottompic:
|
||||
|
@ -1214,6 +1266,9 @@ int LUA_MapLib(lua_State *L)
|
|||
lua_pushcfunction(L, side_get);
|
||||
lua_setfield(L, -2, "__index");
|
||||
|
||||
lua_pushcfunction(L, side_set);
|
||||
lua_setfield(L, -2, "__newindex");
|
||||
|
||||
lua_pushcfunction(L, side_num);
|
||||
lua_setfield(L, -2, "__len");
|
||||
lua_pop(L, 1);
|
||||
|
|
|
@ -47,37 +47,37 @@ static int lib_max(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;
|
||||
}
|
||||
|
||||
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;
|
||||
}
|
||||
|
||||
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;
|
||||
}
|
||||
|
||||
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;
|
||||
}
|
||||
|
||||
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;
|
||||
}
|
||||
|
||||
static int lib_finetangent(lua_State *L)
|
||||
{
|
||||
lua_pushinteger(L, FINETANGENT((luaL_checkinteger(L, 1)>>ANGLETOFINESHIFT) & FINEMASK));
|
||||
lua_pushfixed(L, FINETANGENT((luaL_checkangle(L, 1)>>ANGLETOFINESHIFT) & FINEMASK));
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
@ -86,61 +86,61 @@ static int lib_finetangent(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;
|
||||
}
|
||||
|
||||
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;
|
||||
}
|
||||
|
||||
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;
|
||||
}
|
||||
|
||||
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;
|
||||
}
|
||||
|
||||
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;
|
||||
}
|
||||
|
||||
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;
|
||||
}
|
||||
|
||||
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;
|
||||
}
|
||||
|
||||
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;
|
||||
}
|
||||
|
||||
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;
|
||||
}
|
||||
|
||||
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;
|
||||
}
|
||||
|
||||
|
@ -156,7 +156,7 @@ static int lib_getsecspecial(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;
|
||||
}
|
||||
|
||||
|
|
|
@ -162,13 +162,13 @@ static int mobj_get(lua_State *L)
|
|||
lua_pushboolean(L, 1);
|
||||
break;
|
||||
case mobj_x:
|
||||
lua_pushinteger(L, mo->x);
|
||||
lua_pushfixed(L, mo->x);
|
||||
break;
|
||||
case mobj_y:
|
||||
lua_pushinteger(L, mo->y);
|
||||
lua_pushfixed(L, mo->y);
|
||||
break;
|
||||
case mobj_z:
|
||||
lua_pushinteger(L, mo->z);
|
||||
lua_pushfixed(L, mo->z);
|
||||
break;
|
||||
case mobj_snext:
|
||||
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.
|
||||
return UNIMPLEMENTED;
|
||||
case mobj_angle:
|
||||
lua_pushinteger(L, mo->angle);
|
||||
lua_pushangle(L, mo->angle);
|
||||
break;
|
||||
case mobj_sprite:
|
||||
lua_pushinteger(L, mo->sprite);
|
||||
|
@ -193,28 +193,28 @@ static int mobj_get(lua_State *L)
|
|||
LUA_PushUserdata(L, mo->subsector, META_SUBSECTOR);
|
||||
break;
|
||||
case mobj_floorz:
|
||||
lua_pushinteger(L, mo->floorz);
|
||||
lua_pushfixed(L, mo->floorz);
|
||||
break;
|
||||
case mobj_ceilingz:
|
||||
lua_pushinteger(L, mo->ceilingz);
|
||||
lua_pushfixed(L, mo->ceilingz);
|
||||
break;
|
||||
case mobj_radius:
|
||||
lua_pushinteger(L, mo->radius);
|
||||
lua_pushfixed(L, mo->radius);
|
||||
break;
|
||||
case mobj_height:
|
||||
lua_pushinteger(L, mo->height);
|
||||
lua_pushfixed(L, mo->height);
|
||||
break;
|
||||
case mobj_momx:
|
||||
lua_pushinteger(L, mo->momx);
|
||||
lua_pushfixed(L, mo->momx);
|
||||
break;
|
||||
case mobj_momy:
|
||||
lua_pushinteger(L, mo->momy);
|
||||
lua_pushfixed(L, mo->momy);
|
||||
break;
|
||||
case mobj_momz:
|
||||
lua_pushinteger(L, mo->momz);
|
||||
lua_pushfixed(L, mo->momz);
|
||||
break;
|
||||
case mobj_pmomz:
|
||||
lua_pushinteger(L, mo->pmomz);
|
||||
lua_pushfixed(L, mo->pmomz);
|
||||
break;
|
||||
case mobj_tics:
|
||||
lua_pushinteger(L, mo->tics);
|
||||
|
@ -299,32 +299,32 @@ static int mobj_get(lua_State *L)
|
|||
LUA_PushUserdata(L, mo->tracer, META_MOBJ);
|
||||
break;
|
||||
case mobj_friction:
|
||||
lua_pushinteger(L, mo->friction);
|
||||
lua_pushfixed(L, mo->friction);
|
||||
break;
|
||||
case mobj_movefactor:
|
||||
lua_pushinteger(L, mo->movefactor);
|
||||
lua_pushfixed(L, mo->movefactor);
|
||||
break;
|
||||
case mobj_fuse:
|
||||
lua_pushinteger(L, mo->fuse);
|
||||
break;
|
||||
case mobj_watertop:
|
||||
lua_pushinteger(L, mo->watertop);
|
||||
lua_pushfixed(L, mo->watertop);
|
||||
break;
|
||||
case mobj_waterbottom:
|
||||
lua_pushinteger(L, mo->waterbottom);
|
||||
lua_pushfixed(L, mo->waterbottom);
|
||||
break;
|
||||
case mobj_mobjnum:
|
||||
// mobjnum is a networking thing generated for $$$.sav
|
||||
// and therefore shouldn't be used by Lua.
|
||||
return UNIMPLEMENTED;
|
||||
case mobj_scale:
|
||||
lua_pushinteger(L, mo->scale);
|
||||
lua_pushfixed(L, mo->scale);
|
||||
break;
|
||||
case mobj_destscale:
|
||||
lua_pushinteger(L, mo->destscale);
|
||||
lua_pushfixed(L, mo->destscale);
|
||||
break;
|
||||
case mobj_scalespeed:
|
||||
lua_pushinteger(L, mo->scalespeed);
|
||||
lua_pushfixed(L, mo->scalespeed);
|
||||
break;
|
||||
case mobj_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.
|
||||
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);
|
||||
mo->floorz = tmfloorz;
|
||||
mo->ceilingz = tmceilingz;
|
||||
|
@ -394,7 +394,7 @@ static int mobj_set(lua_State *L)
|
|||
case mobj_sprev:
|
||||
return UNIMPLEMENTED;
|
||||
case mobj_angle:
|
||||
mo->angle = (angle_t)luaL_checkinteger(L, 3);
|
||||
mo->angle = luaL_checkangle(L, 3);
|
||||
if (mo->player == &players[consoleplayer])
|
||||
localangle = mo->angle;
|
||||
else if (mo->player == &players[secondarydisplayplayer])
|
||||
|
@ -417,7 +417,7 @@ static int mobj_set(lua_State *L)
|
|||
case mobj_radius:
|
||||
{
|
||||
mobj_t *ptmthing = tmthing;
|
||||
mo->radius = (fixed_t)luaL_checkinteger(L, 3);
|
||||
mo->radius = luaL_checkfixed(L, 3);
|
||||
if (mo->radius < 0)
|
||||
mo->radius = 0;
|
||||
P_CheckPosition(mo, mo->x, mo->y);
|
||||
|
@ -429,7 +429,7 @@ static int mobj_set(lua_State *L)
|
|||
case mobj_height:
|
||||
{
|
||||
mobj_t *ptmthing = tmthing;
|
||||
mo->height = (fixed_t)luaL_checkinteger(L, 3);
|
||||
mo->height = luaL_checkfixed(L, 3);
|
||||
if (mo->height < 0)
|
||||
mo->height = 0;
|
||||
P_CheckPosition(mo, mo->x, mo->y);
|
||||
|
@ -439,16 +439,17 @@ static int mobj_set(lua_State *L)
|
|||
break;
|
||||
}
|
||||
case mobj_momx:
|
||||
mo->momx = (fixed_t)luaL_checkinteger(L, 3);
|
||||
mo->momx = luaL_checkfixed(L, 3);
|
||||
break;
|
||||
case mobj_momy:
|
||||
mo->momy = (fixed_t)luaL_checkinteger(L, 3);
|
||||
mo->momy = luaL_checkfixed(L, 3);
|
||||
break;
|
||||
case mobj_momz:
|
||||
mo->momz = (fixed_t)luaL_checkinteger(L, 3);
|
||||
mo->momz = luaL_checkfixed(L, 3);
|
||||
break;
|
||||
case mobj_pmomz:
|
||||
mo->pmomz = (fixed_t)luaL_checkinteger(L, 3);
|
||||
mo->pmomz = luaL_checkfixed(L, 3);
|
||||
mo->eflags |= MFE_APPLYPMOMZ;
|
||||
break;
|
||||
case mobj_tics:
|
||||
mo->tics = luaL_checkinteger(L, 3);
|
||||
|
@ -572,25 +573,25 @@ static int mobj_set(lua_State *L)
|
|||
}
|
||||
break;
|
||||
case mobj_friction:
|
||||
mo->friction = (fixed_t)luaL_checkinteger(L, 3);
|
||||
mo->friction = luaL_checkfixed(L, 3);
|
||||
break;
|
||||
case mobj_movefactor:
|
||||
mo->movefactor = (fixed_t)luaL_checkinteger(L, 3);
|
||||
mo->movefactor = luaL_checkfixed(L, 3);
|
||||
break;
|
||||
case mobj_fuse:
|
||||
mo->fuse = luaL_checkinteger(L, 3);
|
||||
break;
|
||||
case mobj_watertop:
|
||||
mo->watertop = (fixed_t)luaL_checkinteger(L, 3);
|
||||
mo->watertop = luaL_checkfixed(L, 3);
|
||||
break;
|
||||
case mobj_waterbottom:
|
||||
mo->waterbottom = (fixed_t)luaL_checkinteger(L, 3);
|
||||
mo->waterbottom = luaL_checkfixed(L, 3);
|
||||
break;
|
||||
case mobj_mobjnum:
|
||||
return UNIMPLEMENTED;
|
||||
case mobj_scale:
|
||||
{
|
||||
fixed_t scale = (fixed_t)luaL_checkinteger(L, 3);
|
||||
fixed_t scale = luaL_checkfixed(L, 3);
|
||||
if (scale < FRACUNIT/100)
|
||||
scale = FRACUNIT/100;
|
||||
mo->destscale = scale;
|
||||
|
@ -599,14 +600,14 @@ static int mobj_set(lua_State *L)
|
|||
}
|
||||
case mobj_destscale:
|
||||
{
|
||||
fixed_t scale = (fixed_t)luaL_checkinteger(L, 3);
|
||||
fixed_t scale = luaL_checkfixed(L, 3);
|
||||
if (scale < FRACUNIT/100)
|
||||
scale = FRACUNIT/100;
|
||||
mo->destscale = scale;
|
||||
break;
|
||||
}
|
||||
case mobj_scalespeed:
|
||||
mo->scalespeed = (fixed_t)luaL_checkinteger(L, 3);
|
||||
mo->scalespeed = luaL_checkfixed(L, 3);
|
||||
break;
|
||||
case mobj_extravalue1:
|
||||
mo->extravalue1 = luaL_checkinteger(L, 3);
|
||||
|
|
|
@ -109,15 +109,15 @@ static int player_get(lua_State *L)
|
|||
else if (fastcmp(field,"playerstate"))
|
||||
lua_pushinteger(L, plr->playerstate);
|
||||
else if (fastcmp(field,"viewz"))
|
||||
lua_pushinteger(L, plr->viewz);
|
||||
lua_pushfixed(L, plr->viewz);
|
||||
else if (fastcmp(field,"viewheight"))
|
||||
lua_pushinteger(L, plr->viewheight);
|
||||
lua_pushfixed(L, plr->viewheight);
|
||||
else if (fastcmp(field,"deltaviewheight"))
|
||||
lua_pushinteger(L, plr->deltaviewheight);
|
||||
lua_pushfixed(L, plr->deltaviewheight);
|
||||
else if (fastcmp(field,"bob"))
|
||||
lua_pushinteger(L, plr->bob);
|
||||
lua_pushfixed(L, plr->bob);
|
||||
else if (fastcmp(field,"aiming"))
|
||||
lua_pushinteger(L, plr->aiming);
|
||||
lua_pushangle(L, plr->aiming);
|
||||
else if (fastcmp(field,"health"))
|
||||
lua_pushinteger(L, plr->health);
|
||||
else if (fastcmp(field,"pity"))
|
||||
|
@ -141,13 +141,13 @@ static int player_get(lua_State *L)
|
|||
else if (fastcmp(field,"score"))
|
||||
lua_pushinteger(L, plr->score);
|
||||
else if (fastcmp(field,"dashspeed"))
|
||||
lua_pushinteger(L, plr->dashspeed);
|
||||
lua_pushfixed(L, plr->dashspeed);
|
||||
else if (fastcmp(field,"dashtime"))
|
||||
lua_pushinteger(L, plr->dashtime);
|
||||
else if (fastcmp(field,"normalspeed"))
|
||||
lua_pushinteger(L, plr->normalspeed);
|
||||
lua_pushfixed(L, plr->normalspeed);
|
||||
else if (fastcmp(field,"runspeed"))
|
||||
lua_pushinteger(L, plr->runspeed);
|
||||
lua_pushfixed(L, plr->runspeed);
|
||||
else if (fastcmp(field,"thrustfactor"))
|
||||
lua_pushinteger(L, plr->thrustfactor);
|
||||
else if (fastcmp(field,"accelstart"))
|
||||
|
@ -167,13 +167,13 @@ static int player_get(lua_State *L)
|
|||
else if (fastcmp(field,"revitem"))
|
||||
lua_pushinteger(L, plr->revitem);
|
||||
else if (fastcmp(field,"actionspd"))
|
||||
lua_pushinteger(L, plr->actionspd);
|
||||
lua_pushfixed(L, plr->actionspd);
|
||||
else if (fastcmp(field,"mindash"))
|
||||
lua_pushinteger(L, plr->mindash);
|
||||
lua_pushfixed(L, plr->mindash);
|
||||
else if (fastcmp(field,"maxdash"))
|
||||
lua_pushinteger(L, plr->maxdash);
|
||||
lua_pushfixed(L, plr->maxdash);
|
||||
else if (fastcmp(field,"jumpfactor"))
|
||||
lua_pushinteger(L, plr->jumpfactor);
|
||||
lua_pushfixed(L, plr->jumpfactor);
|
||||
else if (fastcmp(field,"lives"))
|
||||
lua_pushinteger(L, plr->lives);
|
||||
else if (fastcmp(field,"continues"))
|
||||
|
@ -183,7 +183,7 @@ static int player_get(lua_State *L)
|
|||
else if (fastcmp(field,"gotcontinue"))
|
||||
lua_pushinteger(L, plr->gotcontinue);
|
||||
else if (fastcmp(field,"speed"))
|
||||
lua_pushinteger(L, plr->speed);
|
||||
lua_pushfixed(L, plr->speed);
|
||||
else if (fastcmp(field,"jumping"))
|
||||
lua_pushboolean(L, plr->jumping);
|
||||
else if (fastcmp(field,"secondjump"))
|
||||
|
@ -205,13 +205,13 @@ static int player_get(lua_State *L)
|
|||
else if (fastcmp(field,"skidtime"))
|
||||
lua_pushinteger(L, plr->skidtime);
|
||||
else if (fastcmp(field,"cmomx"))
|
||||
lua_pushinteger(L, plr->cmomx);
|
||||
lua_pushfixed(L, plr->cmomx);
|
||||
else if (fastcmp(field,"cmomy"))
|
||||
lua_pushinteger(L, plr->cmomy);
|
||||
lua_pushfixed(L, plr->cmomy);
|
||||
else if (fastcmp(field,"rmomx"))
|
||||
lua_pushinteger(L, plr->rmomx);
|
||||
lua_pushfixed(L, plr->rmomx);
|
||||
else if (fastcmp(field,"rmomy"))
|
||||
lua_pushinteger(L, plr->rmomy);
|
||||
lua_pushfixed(L, plr->rmomy);
|
||||
else if (fastcmp(field,"numboxes"))
|
||||
lua_pushinteger(L, plr->numboxes);
|
||||
else if (fastcmp(field,"totalring"))
|
||||
|
@ -239,11 +239,11 @@ static int player_get(lua_State *L)
|
|||
else if (fastcmp(field,"starposttime"))
|
||||
lua_pushinteger(L, plr->starposttime);
|
||||
else if (fastcmp(field,"starpostangle"))
|
||||
lua_pushinteger(L, plr->starpostangle);
|
||||
lua_pushangle(L, plr->starpostangle);
|
||||
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"))
|
||||
lua_pushinteger(L, plr->old_angle_pos);
|
||||
lua_pushangle(L, plr->old_angle_pos);
|
||||
else if (fastcmp(field,"axis1"))
|
||||
LUA_PushUserdata(L, plr->axis1, META_MOBJ);
|
||||
else if (fastcmp(field,"axis2"))
|
||||
|
@ -305,16 +305,16 @@ static int player_get(lua_State *L)
|
|||
else if (fastcmp(field,"awayviewtics"))
|
||||
lua_pushinteger(L, plr->awayviewtics);
|
||||
else if (fastcmp(field,"awayviewaiming"))
|
||||
lua_pushinteger(L, plr->awayviewaiming);
|
||||
lua_pushangle(L, plr->awayviewaiming);
|
||||
else if (fastcmp(field,"spectator"))
|
||||
lua_pushinteger(L, plr->spectator);
|
||||
lua_pushboolean(L, plr->spectator);
|
||||
else if (fastcmp(field,"bot"))
|
||||
lua_pushinteger(L, plr->bot);
|
||||
else if (fastcmp(field,"jointime"))
|
||||
lua_pushinteger(L, plr->jointime);
|
||||
#ifdef HWRENDER
|
||||
else if (fastcmp(field,"fovadd"))
|
||||
lua_pushinteger(L, plr->fovadd);
|
||||
lua_pushfixed(L, plr->fovadd);
|
||||
#endif
|
||||
else {
|
||||
lua_getfield(L, LUA_REGISTRYINDEX, LREG_EXTVARS);
|
||||
|
@ -354,15 +354,15 @@ static int player_set(lua_State *L)
|
|||
else if (fastcmp(field,"playerstate"))
|
||||
plr->playerstate = luaL_checkinteger(L, 3);
|
||||
else if (fastcmp(field,"viewz"))
|
||||
plr->viewz = (fixed_t)luaL_checkinteger(L, 3);
|
||||
plr->viewz = luaL_checkfixed(L, 3);
|
||||
else if (fastcmp(field,"viewheight"))
|
||||
plr->viewheight = (fixed_t)luaL_checkinteger(L, 3);
|
||||
plr->viewheight = luaL_checkfixed(L, 3);
|
||||
else if (fastcmp(field,"deltaviewheight"))
|
||||
plr->deltaviewheight = (fixed_t)luaL_checkinteger(L, 3);
|
||||
plr->deltaviewheight = luaL_checkfixed(L, 3);
|
||||
else if (fastcmp(field,"bob"))
|
||||
plr->bob = (fixed_t)luaL_checkinteger(L, 3);
|
||||
plr->bob = luaL_checkfixed(L, 3);
|
||||
else if (fastcmp(field,"aiming")) {
|
||||
plr->aiming = (angle_t)luaL_checkinteger(L, 3);
|
||||
plr->aiming = luaL_checkangle(L, 3);
|
||||
if (plr == &players[consoleplayer])
|
||||
localaiming = plr->aiming;
|
||||
else if (plr == &players[secondarydisplayplayer])
|
||||
|
@ -391,13 +391,13 @@ static int player_set(lua_State *L)
|
|||
else if (fastcmp(field,"score"))
|
||||
plr->score = (UINT32)luaL_checkinteger(L, 3);
|
||||
else if (fastcmp(field,"dashspeed"))
|
||||
plr->dashspeed = (fixed_t)luaL_checkinteger(L, 3);
|
||||
plr->dashspeed = luaL_checkfixed(L, 3);
|
||||
else if (fastcmp(field,"dashtime"))
|
||||
plr->dashtime = (INT32)luaL_checkinteger(L, 3);
|
||||
else if (fastcmp(field,"normalspeed"))
|
||||
plr->normalspeed = (fixed_t)luaL_checkinteger(L, 3);
|
||||
plr->normalspeed = luaL_checkfixed(L, 3);
|
||||
else if (fastcmp(field,"runspeed"))
|
||||
plr->runspeed = (fixed_t)luaL_checkinteger(L, 3);
|
||||
plr->runspeed = luaL_checkfixed(L, 3);
|
||||
else if (fastcmp(field,"thrustfactor"))
|
||||
plr->thrustfactor = (UINT8)luaL_checkinteger(L, 3);
|
||||
else if (fastcmp(field,"accelstart"))
|
||||
|
@ -433,7 +433,7 @@ static int player_set(lua_State *L)
|
|||
else if (fastcmp(field,"gotcontinue"))
|
||||
plr->gotcontinue = (UINT8)luaL_checkinteger(L, 3);
|
||||
else if (fastcmp(field,"speed"))
|
||||
plr->speed = (fixed_t)luaL_checkinteger(L, 3);
|
||||
plr->speed = luaL_checkfixed(L, 3);
|
||||
else if (fastcmp(field,"jumping"))
|
||||
plr->jumping = luaL_checkboolean(L, 3);
|
||||
else if (fastcmp(field,"secondjump"))
|
||||
|
@ -455,13 +455,13 @@ static int player_set(lua_State *L)
|
|||
else if (fastcmp(field,"skidtime"))
|
||||
plr->skidtime = (tic_t)luaL_checkinteger(L, 3);
|
||||
else if (fastcmp(field,"cmomx"))
|
||||
plr->cmomx = (fixed_t)luaL_checkinteger(L, 3);
|
||||
plr->cmomx = luaL_checkfixed(L, 3);
|
||||
else if (fastcmp(field,"cmomy"))
|
||||
plr->cmomy = (fixed_t)luaL_checkinteger(L, 3);
|
||||
plr->cmomy = luaL_checkfixed(L, 3);
|
||||
else if (fastcmp(field,"rmomx"))
|
||||
plr->rmomx = (fixed_t)luaL_checkinteger(L, 3);
|
||||
plr->rmomx = luaL_checkfixed(L, 3);
|
||||
else if (fastcmp(field,"rmomy"))
|
||||
plr->rmomy = (fixed_t)luaL_checkinteger(L, 3);
|
||||
plr->rmomy = luaL_checkfixed(L, 3);
|
||||
else if (fastcmp(field,"numboxes"))
|
||||
plr->numboxes = (INT16)luaL_checkinteger(L, 3);
|
||||
else if (fastcmp(field,"totalring"))
|
||||
|
@ -489,11 +489,11 @@ static int player_set(lua_State *L)
|
|||
else if (fastcmp(field,"starposttime"))
|
||||
plr->starposttime = (tic_t)luaL_checkinteger(L, 3);
|
||||
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"))
|
||||
plr->angle_pos = (angle_t)luaL_checkinteger(L, 3);
|
||||
plr->angle_pos = luaL_checkangle(L, 3);
|
||||
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"))
|
||||
P_SetTarget(&plr->axis1, *((mobj_t **)luaL_checkudata(L, 3, META_MOBJ)));
|
||||
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.
|
||||
}
|
||||
else if (fastcmp(field,"awayviewaiming"))
|
||||
plr->awayviewaiming = (angle_t)luaL_checkinteger(L, 3);
|
||||
plr->awayviewaiming = luaL_checkangle(L, 3);
|
||||
else if (fastcmp(field,"spectator"))
|
||||
plr->spectator = lua_toboolean(L, 3);
|
||||
else if (fastcmp(field,"bot"))
|
||||
|
@ -578,7 +578,7 @@ static int player_set(lua_State *L)
|
|||
plr->jointime = (tic_t)luaL_checkinteger(L, 3);
|
||||
#ifdef HWRENDER
|
||||
else if (fastcmp(field,"fovadd"))
|
||||
plr->fovadd = (fixed_t)luaL_checkinteger(L, 3);
|
||||
plr->fovadd = luaL_checkfixed(L, 3);
|
||||
#endif
|
||||
else {
|
||||
lua_getfield(L, LUA_REGISTRYINDEX, LREG_EXTVARS);
|
||||
|
|
|
@ -442,7 +442,6 @@ enum
|
|||
ARCH_NULL=0,
|
||||
ARCH_BOOLEAN,
|
||||
ARCH_SIGNED,
|
||||
ARCH_UNSIGNED,
|
||||
ARCH_STRING,
|
||||
ARCH_TABLE,
|
||||
|
||||
|
@ -522,13 +521,8 @@ static UINT8 ArchiveValue(int TABLESINDEX, int myindex)
|
|||
case LUA_TNUMBER:
|
||||
{
|
||||
lua_Integer number = lua_tointeger(gL, myindex);
|
||||
if (number < 0) {
|
||||
WRITEUINT8(save_p, ARCH_SIGNED);
|
||||
WRITEFIXED(save_p, number);
|
||||
} else {
|
||||
WRITEUINT8(save_p, ARCH_UNSIGNED);
|
||||
WRITEANGLE(save_p, number);
|
||||
}
|
||||
WRITEUINT8(save_p, ARCH_SIGNED);
|
||||
WRITEFIXED(save_p, number);
|
||||
break;
|
||||
}
|
||||
case LUA_TSTRING:
|
||||
|
@ -797,9 +791,6 @@ static UINT8 UnArchiveValue(int TABLESINDEX)
|
|||
case ARCH_SIGNED:
|
||||
lua_pushinteger(gL, READFIXED(save_p));
|
||||
break;
|
||||
case ARCH_UNSIGNED:
|
||||
lua_pushinteger(gL, READANGLE(save_p));
|
||||
break;
|
||||
case ARCH_STRING:
|
||||
{
|
||||
char value[1024];
|
||||
|
@ -948,6 +939,14 @@ static void NetArchiveHook(lua_CFunction archFunc)
|
|||
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)
|
||||
{
|
||||
INT32 i;
|
||||
|
|
|
@ -19,9 +19,21 @@
|
|||
#include "blua/lua.h"
|
||||
#include "blua/lualib.h"
|
||||
#include "blua/lauxlib.h"
|
||||
|
||||
#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))
|
||||
|
||||
// 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
|
||||
void LUA_ClearExtVars(void);
|
||||
#endif
|
||||
|
@ -36,6 +48,7 @@ void LUA_InvalidateUserdata(void *data);
|
|||
void LUA_InvalidateLevel(void);
|
||||
void LUA_InvalidateMapthings(void);
|
||||
void LUA_InvalidatePlayer(player_t *player);
|
||||
void LUA_Step(void);
|
||||
void LUA_Archive(void);
|
||||
void LUA_UnArchive(void);
|
||||
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);
|
||||
break;
|
||||
case skin_actionspd:
|
||||
lua_pushinteger(L, skin->actionspd);
|
||||
lua_pushfixed(L, skin->actionspd);
|
||||
break;
|
||||
case skin_mindash:
|
||||
lua_pushinteger(L, skin->mindash);
|
||||
lua_pushfixed(L, skin->mindash);
|
||||
break;
|
||||
case skin_maxdash:
|
||||
lua_pushinteger(L, skin->maxdash);
|
||||
lua_pushfixed(L, skin->maxdash);
|
||||
break;
|
||||
case skin_normalspeed:
|
||||
lua_pushinteger(L, skin->normalspeed);
|
||||
lua_pushfixed(L, skin->normalspeed);
|
||||
break;
|
||||
case skin_runspeed:
|
||||
lua_pushinteger(L, skin->runspeed);
|
||||
lua_pushfixed(L, skin->runspeed);
|
||||
break;
|
||||
case skin_thrustfactor:
|
||||
lua_pushinteger(L, skin->thrustfactor);
|
||||
|
@ -171,7 +171,7 @@ static int skin_get(lua_State *L)
|
|||
lua_pushinteger(L, skin->acceleration);
|
||||
break;
|
||||
case skin_jumpfactor:
|
||||
lua_pushinteger(L, skin->jumpfactor);
|
||||
lua_pushfixed(L, skin->jumpfactor);
|
||||
break;
|
||||
case skin_starttranscolor:
|
||||
lua_pushinteger(L, skin->starttranscolor);
|
||||
|
|
|
@ -7650,26 +7650,33 @@ void A_SetObjectFlags(mobj_t *actor)
|
|||
{
|
||||
INT32 locvar1 = var1;
|
||||
INT32 locvar2 = var2;
|
||||
boolean unlinkthings = false;
|
||||
#ifdef HAVE_BLUA
|
||||
if (LUA_CallAction("A_SetObjectFlags", actor))
|
||||
return;
|
||||
#endif
|
||||
|
||||
P_UnsetThingPosition(actor);
|
||||
if (sector_list)
|
||||
{
|
||||
P_DelSeclist(sector_list);
|
||||
sector_list = NULL;
|
||||
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);
|
||||
if (sector_list)
|
||||
{
|
||||
P_DelSeclist(sector_list);
|
||||
sector_list = NULL;
|
||||
}
|
||||
}
|
||||
|
||||
if (locvar2 == 2)
|
||||
actor->flags |= locvar1;
|
||||
else if (locvar2 == 1)
|
||||
actor->flags &= ~locvar1;
|
||||
else
|
||||
actor->flags = locvar1;
|
||||
actor->flags = locvar1;
|
||||
|
||||
P_SetThingPosition(actor);
|
||||
if (unlinkthings)
|
||||
P_SetThingPosition(actor);
|
||||
}
|
||||
|
||||
// Function: A_SetObjectFlags2
|
||||
|
|
|
@ -1479,7 +1479,7 @@ static void P_HitDeathMessages(player_t *player, mobj_t *inflictor, mobj_t *sour
|
|||
return; // Presumably it's obvious what's happening in splitscreen.
|
||||
|
||||
#ifdef HAVE_BLUA
|
||||
if (LUAh_DeathMsg(player, inflictor, source))
|
||||
if (LUAh_HurtMsg(player, inflictor, source))
|
||||
return;
|
||||
#endif
|
||||
|
||||
|
@ -1953,7 +1953,7 @@ void P_KillMobj(mobj_t *target, mobj_t *inflictor, mobj_t *source, UINT8 damaget
|
|||
{
|
||||
target->flags &= ~(MF_SOLID|MF_SHOOTABLE); // does not block
|
||||
P_UnsetThingPosition(target);
|
||||
target->flags |= MF_NOBLOCKMAP;
|
||||
target->flags |= MF_NOBLOCKMAP|MF_NOCLIP|MF_NOCLIPHEIGHT|MF_NOGRAVITY;
|
||||
P_SetThingPosition(target);
|
||||
|
||||
if (!target->player->bot && !G_IsSpecialStage(gamemap)
|
||||
|
@ -2289,7 +2289,12 @@ void P_KillMobj(mobj_t *target, mobj_t *inflictor, mobj_t *source, UINT8 damaget
|
|||
}
|
||||
}
|
||||
else if (target->player)
|
||||
P_SetPlayerMobjState(target, target->info->deathstate);
|
||||
{
|
||||
if (damagetype == DMG_DROWNED || damagetype == DMG_SPACEDROWN)
|
||||
P_SetPlayerMobjState(target, target->info->xdeathstate);
|
||||
else
|
||||
P_SetPlayerMobjState(target, target->info->deathstate);
|
||||
}
|
||||
else
|
||||
#ifdef DEBUG_NULL_DEATHSTATE
|
||||
P_SetMobjState(target, S_NULL);
|
||||
|
@ -2582,7 +2587,7 @@ static inline void P_SuperDamage(player_t *player, mobj_t *inflictor, mobj_t *so
|
|||
P_InstaThrust(player->mo, ang, fallbackspeed);
|
||||
|
||||
if (player->charflags & SF_SUPERANIMS)
|
||||
P_SetPlayerMobjState(player->mo, S_PLAY_SUPER_PAIN);
|
||||
P_SetPlayerMobjState(player->mo, S_PLAY_SUPER_STUN);
|
||||
else
|
||||
P_SetPlayerMobjState(player->mo, player->mo->info->painstate);
|
||||
|
||||
|
|
|
@ -276,7 +276,7 @@ boolean P_LookForPlayers(mobj_t *actor, boolean allaround, boolean tracer, fixed
|
|||
extern boolean floatok;
|
||||
extern fixed_t tmfloorz;
|
||||
extern fixed_t tmceilingz;
|
||||
extern mobj_t *tmfloorthing, *tmthing;
|
||||
extern mobj_t *tmfloorthing, *tmhitthing, *tmthing;
|
||||
extern camera_t *mapcampointer;
|
||||
|
||||
/* cphipps 2004/08/30 */
|
||||
|
|
71
src/p_map.c
71
src/p_map.c
|
@ -47,7 +47,7 @@ boolean floatok;
|
|||
fixed_t tmfloorz, tmceilingz;
|
||||
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
|
||||
static mobj_t *tmhitthing; // the solid thing you bumped into (for collisions)
|
||||
mobj_t *tmhitthing; // the solid thing you bumped into (for collisions)
|
||||
|
||||
// keep track of the line that lowers the ceiling,
|
||||
// so missiles don't explode against sky hack walls
|
||||
|
@ -121,7 +121,7 @@ void P_DoSpring(mobj_t *spring, mobj_t *object)
|
|||
/*Someone want to make these work like bumpers?*/
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
object->eflags |= MFE_SPRUNG; // apply this flag asap!
|
||||
spring->flags &= ~(MF_SOLID|MF_SPECIAL); // De-solidify
|
||||
|
||||
|
@ -1233,7 +1233,7 @@ boolean P_CheckPosition(mobj_t *thing, fixed_t x, fixed_t y)
|
|||
{
|
||||
// If you're inside goowater and slowing down
|
||||
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
|
||||
&& abs(thing->momz) < minspeed)
|
||||
{
|
||||
|
@ -1304,10 +1304,10 @@ boolean P_CheckPosition(mobj_t *thing, fixed_t x, fixed_t y)
|
|||
// based on their origin point, and can overlap
|
||||
// into adjacent blocks by up to MAXRADIUS units.
|
||||
|
||||
xl = (tmbbox[BOXLEFT] - bmaporgx - MAXRADIUS)>>MAPBLOCKSHIFT;
|
||||
xh = (tmbbox[BOXRIGHT] - bmaporgx + MAXRADIUS)>>MAPBLOCKSHIFT;
|
||||
yl = (tmbbox[BOXBOTTOM] - bmaporgy - MAXRADIUS)>>MAPBLOCKSHIFT;
|
||||
yh = (tmbbox[BOXTOP] - bmaporgy + MAXRADIUS)>>MAPBLOCKSHIFT;
|
||||
xl = (unsigned)(tmbbox[BOXLEFT] - bmaporgx - MAXRADIUS)>>MAPBLOCKSHIFT;
|
||||
xh = (unsigned)(tmbbox[BOXRIGHT] - bmaporgx + MAXRADIUS)>>MAPBLOCKSHIFT;
|
||||
yl = (unsigned)(tmbbox[BOXBOTTOM] - bmaporgy - MAXRADIUS)>>MAPBLOCKSHIFT;
|
||||
yh = (unsigned)(tmbbox[BOXTOP] - bmaporgy + MAXRADIUS)>>MAPBLOCKSHIFT;
|
||||
|
||||
BMBOUNDFIX(xl, xh, yl, yh);
|
||||
|
||||
|
@ -1523,10 +1523,10 @@ boolean P_CheckCameraPosition(fixed_t x, fixed_t y, camera_t *thiscam)
|
|||
// based on their origin point, and can overlap
|
||||
// into adjacent blocks by up to MAXRADIUS units.
|
||||
|
||||
xl = (tmbbox[BOXLEFT] - bmaporgx)>>MAPBLOCKSHIFT;
|
||||
xh = (tmbbox[BOXRIGHT] - bmaporgx)>>MAPBLOCKSHIFT;
|
||||
yl = (tmbbox[BOXBOTTOM] - bmaporgy)>>MAPBLOCKSHIFT;
|
||||
yh = (tmbbox[BOXTOP] - bmaporgy)>>MAPBLOCKSHIFT;
|
||||
xl = (unsigned)(tmbbox[BOXLEFT] - bmaporgx)>>MAPBLOCKSHIFT;
|
||||
xh = (unsigned)(tmbbox[BOXRIGHT] - bmaporgx)>>MAPBLOCKSHIFT;
|
||||
yl = (unsigned)(tmbbox[BOXBOTTOM] - bmaporgy)>>MAPBLOCKSHIFT;
|
||||
yh = (unsigned)(tmbbox[BOXTOP] - bmaporgy)>>MAPBLOCKSHIFT;
|
||||
|
||||
BMBOUNDFIX(xl, xh, yl, yh);
|
||||
|
||||
|
@ -1853,7 +1853,7 @@ boolean P_TryMove(mobj_t *thing, fixed_t x, fixed_t y, boolean allowdropoff)
|
|||
|
||||
// Don't 'step up' while springing,
|
||||
// Only step up "if needed".
|
||||
if (thing->state-states == S_PLAY_JUMP
|
||||
if (thing->player->panim == PA_JUMP
|
||||
&& P_MobjFlip(thing)*thing->momz > FixedMul(FRACUNIT, thing->scale))
|
||||
maxstep = 0;
|
||||
}
|
||||
|
@ -1952,10 +1952,10 @@ boolean P_TryMove(mobj_t *thing, fixed_t x, fixed_t y, boolean allowdropoff)
|
|||
{
|
||||
INT32 bx, by, xl, xh, yl, yh;
|
||||
|
||||
yh = (thing->y + MAXRADIUS - bmaporgy)>>MAPBLOCKSHIFT;
|
||||
yl = (thing->y - MAXRADIUS - bmaporgy)>>MAPBLOCKSHIFT;
|
||||
xh = (thing->x + MAXRADIUS - bmaporgx)>>MAPBLOCKSHIFT;
|
||||
xl = (thing->x - MAXRADIUS - bmaporgx)>>MAPBLOCKSHIFT;
|
||||
yh = (unsigned)(thing->y + MAXRADIUS - bmaporgy)>>MAPBLOCKSHIFT;
|
||||
yl = (unsigned)(thing->y - MAXRADIUS - bmaporgy)>>MAPBLOCKSHIFT;
|
||||
xh = (unsigned)(thing->x + MAXRADIUS - bmaporgx)>>MAPBLOCKSHIFT;
|
||||
xl = (unsigned)(thing->x - MAXRADIUS - bmaporgx)>>MAPBLOCKSHIFT;
|
||||
|
||||
BMBOUNDFIX(xl, xh, yl, yh);
|
||||
|
||||
|
@ -2052,6 +2052,7 @@ boolean P_SceneryTryMove(mobj_t *thing, fixed_t x, fixed_t y)
|
|||
//
|
||||
static boolean P_ThingHeightClip(mobj_t *thing)
|
||||
{
|
||||
boolean floormoved;
|
||||
fixed_t oldfloorz = thing->floorz;
|
||||
boolean onfloor = P_IsObjectOnGround(thing);//(thing->z <= thing->floorz);
|
||||
|
||||
|
@ -2063,6 +2064,9 @@ static boolean P_ThingHeightClip(mobj_t *thing)
|
|||
if (P_MobjWasRemoved(thing))
|
||||
return true;
|
||||
|
||||
floormoved = (thing->eflags & MFE_VERTICALFLIP && tmceilingz != thing->ceilingz)
|
||||
|| (!(thing->eflags & MFE_VERTICALFLIP) && tmfloorz != thing->floorz);
|
||||
|
||||
thing->floorz = tmfloorz;
|
||||
thing->ceilingz = tmceilingz;
|
||||
|
||||
|
@ -2071,20 +2075,13 @@ static boolean P_ThingHeightClip(mobj_t *thing)
|
|||
if (tmfloorz > oldfloorz+thing->height)
|
||||
return true;
|
||||
|
||||
if (/*!tmfloorthing && */onfloor && !(thing->flags & MF_NOGRAVITY))
|
||||
if (onfloor && !(thing->flags & MF_NOGRAVITY) && floormoved)
|
||||
{
|
||||
if (thing->eflags & MFE_VERTICALFLIP)
|
||||
thing->pmomz = thing->ceilingz - (thing->z + thing->height);
|
||||
else
|
||||
thing->pmomz = thing->floorz - thing->z;
|
||||
|
||||
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;
|
||||
}
|
||||
thing->eflags |= MFE_APPLYPMOMZ;
|
||||
|
||||
if (thing->eflags & MFE_VERTICALFLIP)
|
||||
thing->z = thing->ceilingz - thing->height;
|
||||
|
@ -3040,10 +3037,10 @@ void P_RadiusAttack(mobj_t *spot, mobj_t *source, fixed_t damagedist)
|
|||
fixed_t dist;
|
||||
|
||||
dist = FixedMul(damagedist, spot->scale) + MAXRADIUS;
|
||||
yh = (spot->y + dist - bmaporgy)>>MAPBLOCKSHIFT;
|
||||
yl = (spot->y - dist - bmaporgy)>>MAPBLOCKSHIFT;
|
||||
xh = (spot->x + dist - bmaporgx)>>MAPBLOCKSHIFT;
|
||||
xl = (spot->x - dist - bmaporgx)>>MAPBLOCKSHIFT;
|
||||
yh = (unsigned)(spot->y + dist - bmaporgy)>>MAPBLOCKSHIFT;
|
||||
yl = (unsigned)(spot->y - dist - bmaporgy)>>MAPBLOCKSHIFT;
|
||||
xh = (unsigned)(spot->x + dist - bmaporgx)>>MAPBLOCKSHIFT;
|
||||
xl = (unsigned)(spot->x - dist - bmaporgx)>>MAPBLOCKSHIFT;
|
||||
|
||||
BMBOUNDFIX(xl, xh, yl, yh);
|
||||
|
||||
|
@ -3656,10 +3653,10 @@ void P_CreateSecNodeList(mobj_t *thing, fixed_t x, fixed_t y)
|
|||
|
||||
validcount++; // used to make sure we only process a line once
|
||||
|
||||
xl = (tmbbox[BOXLEFT] - bmaporgx)>>MAPBLOCKSHIFT;
|
||||
xh = (tmbbox[BOXRIGHT] - bmaporgx)>>MAPBLOCKSHIFT;
|
||||
yl = (tmbbox[BOXBOTTOM] - bmaporgy)>>MAPBLOCKSHIFT;
|
||||
yh = (tmbbox[BOXTOP] - bmaporgy)>>MAPBLOCKSHIFT;
|
||||
xl = (unsigned)(tmbbox[BOXLEFT] - bmaporgx)>>MAPBLOCKSHIFT;
|
||||
xh = (unsigned)(tmbbox[BOXRIGHT] - bmaporgx)>>MAPBLOCKSHIFT;
|
||||
yl = (unsigned)(tmbbox[BOXBOTTOM] - bmaporgy)>>MAPBLOCKSHIFT;
|
||||
yh = (unsigned)(tmbbox[BOXTOP] - bmaporgy)>>MAPBLOCKSHIFT;
|
||||
|
||||
BMBOUNDFIX(xl, xh, yl, yh);
|
||||
|
||||
|
@ -3735,10 +3732,10 @@ void P_CreatePrecipSecNodeList(precipmobj_t *thing,fixed_t x,fixed_t y)
|
|||
|
||||
validcount++; // used to make sure we only process a line once
|
||||
|
||||
xl = (preciptmbbox[BOXLEFT] - bmaporgx)>>MAPBLOCKSHIFT;
|
||||
xh = (preciptmbbox[BOXRIGHT] - bmaporgx)>>MAPBLOCKSHIFT;
|
||||
yl = (preciptmbbox[BOXBOTTOM] - bmaporgy)>>MAPBLOCKSHIFT;
|
||||
yh = (preciptmbbox[BOXTOP] - bmaporgy)>>MAPBLOCKSHIFT;
|
||||
xl = (unsigned)(preciptmbbox[BOXLEFT] - bmaporgx)>>MAPBLOCKSHIFT;
|
||||
xh = (unsigned)(preciptmbbox[BOXRIGHT] - bmaporgx)>>MAPBLOCKSHIFT;
|
||||
yl = (unsigned)(preciptmbbox[BOXBOTTOM] - bmaporgy)>>MAPBLOCKSHIFT;
|
||||
yh = (unsigned)(preciptmbbox[BOXTOP] - bmaporgy)>>MAPBLOCKSHIFT;
|
||||
|
||||
BMBOUNDFIX(xl, xh, yl, yh);
|
||||
|
||||
|
|
|
@ -814,8 +814,8 @@ void P_SetThingPosition(mobj_t *thing)
|
|||
if (!(thing->flags & MF_NOBLOCKMAP))
|
||||
{
|
||||
// inert things don't need to be in blockmap
|
||||
const INT32 blockx = (thing->x - bmaporgx)>>MAPBLOCKSHIFT;
|
||||
const INT32 blocky = (thing->y - bmaporgy)>>MAPBLOCKSHIFT;
|
||||
const INT32 blockx = (unsigned)(thing->x - bmaporgx)>>MAPBLOCKSHIFT;
|
||||
const INT32 blocky = (unsigned)(thing->y - bmaporgy)>>MAPBLOCKSHIFT;
|
||||
if (blockx >= 0 && blockx < bmapwidth
|
||||
&& blocky >= 0 && blocky < bmapheight)
|
||||
{
|
||||
|
@ -1317,10 +1317,10 @@ boolean P_RadiusLinesCheck(fixed_t radius, fixed_t x, fixed_t y,
|
|||
tmbbox[BOXLEFT] = x - radius;
|
||||
|
||||
// check lines
|
||||
xl = (tmbbox[BOXLEFT] - bmaporgx)>>MAPBLOCKSHIFT;
|
||||
xh = (tmbbox[BOXRIGHT] - bmaporgx)>>MAPBLOCKSHIFT;
|
||||
yl = (tmbbox[BOXBOTTOM] - bmaporgy)>>MAPBLOCKSHIFT;
|
||||
yh = (tmbbox[BOXTOP] - bmaporgy)>>MAPBLOCKSHIFT;
|
||||
xl = (unsigned)(tmbbox[BOXLEFT] - bmaporgx)>>MAPBLOCKSHIFT;
|
||||
xh = (unsigned)(tmbbox[BOXRIGHT] - bmaporgx)>>MAPBLOCKSHIFT;
|
||||
yl = (unsigned)(tmbbox[BOXBOTTOM] - bmaporgy)>>MAPBLOCKSHIFT;
|
||||
yh = (unsigned)(tmbbox[BOXTOP] - bmaporgy)>>MAPBLOCKSHIFT;
|
||||
|
||||
for (bx = xl; bx <= xh; bx++)
|
||||
for (by = yl; by <= yh; by++)
|
||||
|
|
268
src/p_mobj.c
268
src/p_mobj.c
|
@ -142,24 +142,29 @@ boolean P_SetPlayerMobjState(mobj_t *mobj, statenum_t state)
|
|||
{
|
||||
case S_PLAY_STND:
|
||||
case S_PLAY_WAIT:
|
||||
case S_PLAY_GASP:
|
||||
P_SetPlayerMobjState(mobj, S_PLAY_SUPER_STND);
|
||||
return true;
|
||||
case S_PLAY_FALL:
|
||||
case S_PLAY_JUMP:
|
||||
return P_SetPlayerMobjState(mobj, S_PLAY_SUPER_STND);
|
||||
case S_PLAY_WALK:
|
||||
P_SetPlayerMobjState(mobj, S_PLAY_SUPER_WALK);
|
||||
return true;
|
||||
return P_SetPlayerMobjState(mobj, S_PLAY_SUPER_WALK);
|
||||
case S_PLAY_RUN:
|
||||
P_SetPlayerMobjState(mobj, S_PLAY_SUPER_RUN);
|
||||
return true;
|
||||
case S_PLAY_EDGE:
|
||||
P_SetPlayerMobjState(mobj, S_PLAY_SUPER_EDGE);
|
||||
return true;
|
||||
return P_SetPlayerMobjState(mobj, S_PLAY_SUPER_RUN);
|
||||
case S_PLAY_PAIN:
|
||||
return P_SetPlayerMobjState(mobj, S_PLAY_SUPER_PAIN);
|
||||
case S_PLAY_DEAD:
|
||||
return P_SetPlayerMobjState(mobj, S_PLAY_SUPER_DEAD);
|
||||
case S_PLAY_DRWN:
|
||||
return P_SetPlayerMobjState(mobj, S_PLAY_SUPER_DRWN);
|
||||
case S_PLAY_SPIN:
|
||||
if (!(player->charflags & SF_SUPERSPIN))
|
||||
return true;
|
||||
break;
|
||||
return P_SetPlayerMobjState(mobj, S_PLAY_SUPER_SPIN);
|
||||
case S_PLAY_GASP:
|
||||
return P_SetPlayerMobjState(mobj, S_PLAY_SUPER_GASP);
|
||||
case S_PLAY_JUMP:
|
||||
return P_SetPlayerMobjState(mobj, S_PLAY_SUPER_JUMP);
|
||||
case S_PLAY_FALL:
|
||||
return P_SetPlayerMobjState(mobj, S_PLAY_SUPER_FALL);
|
||||
case S_PLAY_EDGE:
|
||||
return P_SetPlayerMobjState(mobj, S_PLAY_SUPER_EDGE);
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
@ -178,30 +183,48 @@ boolean P_SetPlayerMobjState(mobj_t *mobj, statenum_t state)
|
|||
{
|
||||
case S_PLAY_STND:
|
||||
case S_PLAY_WAIT:
|
||||
case S_PLAY_EDGE:
|
||||
case S_PLAY_RIDE:
|
||||
case S_PLAY_SUPER_STND:
|
||||
case S_PLAY_SUPER_EDGE:
|
||||
player->panim = PA_IDLE;
|
||||
break;
|
||||
case S_PLAY_EDGE:
|
||||
case S_PLAY_SUPER_EDGE:
|
||||
player->panim = PA_EDGE;
|
||||
break;
|
||||
case S_PLAY_WALK:
|
||||
case S_PLAY_SUPER_WALK:
|
||||
case S_PLAY_SUPER_FLOAT:
|
||||
player->panim = PA_WALK;
|
||||
break;
|
||||
case S_PLAY_RUN:
|
||||
case S_PLAY_SUPER_RUN:
|
||||
player->panim = PA_RUN;
|
||||
break;
|
||||
case S_PLAY_PAIN:
|
||||
case S_PLAY_SUPER_PAIN:
|
||||
case S_PLAY_SUPER_STUN:
|
||||
player->panim = PA_PAIN;
|
||||
break;
|
||||
case S_PLAY_SPIN:
|
||||
case S_PLAY_DASH:
|
||||
case S_PLAY_SUPER_SPIN:
|
||||
player->panim = PA_ROLL;
|
||||
break;
|
||||
case S_PLAY_JUMP:
|
||||
case S_PLAY_SUPER_JUMP:
|
||||
player->panim = PA_JUMP;
|
||||
break;
|
||||
case S_PLAY_FALL:
|
||||
case S_PLAY_SUPER_FALL:
|
||||
player->panim = PA_FALL;
|
||||
break;
|
||||
case S_PLAY_FLY:
|
||||
case S_PLAY_GLIDE:
|
||||
player->panim = PA_ABILITY;
|
||||
break;
|
||||
case S_PLAY_RIDE:
|
||||
case S_PLAY_SUPER_RIDE:
|
||||
player->panim = PA_RIDE;
|
||||
break;
|
||||
default:
|
||||
player->panim = PA_ETC;
|
||||
break;
|
||||
|
@ -272,8 +295,109 @@ boolean P_SetPlayerMobjState(mobj_t *mobj, statenum_t state)
|
|||
// Player animations
|
||||
if (st->sprite == SPR_PLAY)
|
||||
{
|
||||
boolean noalt = false;
|
||||
UINT8 spr2 = st->frame & FF_FRAMEMASK;
|
||||
UINT16 frame = (mobj->frame & FF_FRAMEMASK)+1;
|
||||
|
||||
while (((skin_t *)mobj->skin)->sprites[spr2].numframes <= 0
|
||||
&& spr2 != SPR2_STND)
|
||||
{
|
||||
switch(spr2)
|
||||
{
|
||||
case SPR2_RUN:
|
||||
spr2 = SPR2_WALK;
|
||||
break;
|
||||
case SPR2_DRWN:
|
||||
spr2 = SPR2_DEAD;
|
||||
break;
|
||||
case SPR2_DASH:
|
||||
spr2 = SPR2_SPIN;
|
||||
break;
|
||||
case SPR2_GASP:
|
||||
spr2 = SPR2_JUMP;
|
||||
break;
|
||||
case SPR2_JUMP:
|
||||
spr2 = SPR2_FALL;
|
||||
break;
|
||||
case SPR2_FALL:
|
||||
spr2 = SPR2_WALK;
|
||||
break;
|
||||
case SPR2_RIDE:
|
||||
spr2 = SPR2_FALL;
|
||||
break;
|
||||
|
||||
case SPR2_FLY:
|
||||
spr2 = SPR2_JUMP;
|
||||
break;
|
||||
case SPR2_TIRE:
|
||||
spr2 = SPR2_FLY;
|
||||
break;
|
||||
|
||||
case SPR2_GLID:
|
||||
spr2 = SPR2_FLY;
|
||||
break;
|
||||
case SPR2_CLMB:
|
||||
spr2 = SPR2_WALK;
|
||||
break;
|
||||
case SPR2_CLNG:
|
||||
spr2 = SPR2_CLMB;
|
||||
break;
|
||||
|
||||
case SPR2_SIGN:
|
||||
case SPR2_LIFE:
|
||||
noalt = true;
|
||||
break;
|
||||
|
||||
// Super sprites fallback to regular sprites
|
||||
case SPR2_SWLK:
|
||||
spr2 = SPR2_WALK;
|
||||
break;
|
||||
case SPR2_SRUN:
|
||||
spr2 = SPR2_RUN;
|
||||
break;
|
||||
case SPR2_SPAN:
|
||||
spr2 = SPR2_PAIN;
|
||||
break;
|
||||
case SPR2_SMSL:
|
||||
spr2 = SPR2_SPAN;
|
||||
break;
|
||||
case SPR2_SDTH:
|
||||
spr2 = SPR2_DEAD;
|
||||
break;
|
||||
case SPR2_SDRN:
|
||||
spr2 = SPR2_DRWN;
|
||||
break;
|
||||
case SPR2_SSPN:
|
||||
spr2 = SPR2_SPIN;
|
||||
break;
|
||||
case SPR2_SGSP:
|
||||
spr2 = SPR2_GASP;
|
||||
break;
|
||||
case SPR2_SJMP:
|
||||
spr2 = SPR2_JUMP;
|
||||
break;
|
||||
case SPR2_SFAL:
|
||||
spr2 = SPR2_FALL;
|
||||
break;
|
||||
case SPR2_SEDG:
|
||||
spr2 = SPR2_EDGE;
|
||||
break;
|
||||
case SPR2_SRID:
|
||||
spr2 = SPR2_RIDE;
|
||||
break;
|
||||
case SPR2_SFLT:
|
||||
spr2 = SPR2_SWLK;
|
||||
break;
|
||||
|
||||
// Dunno? Just go to standing then.
|
||||
default:
|
||||
spr2 = SPR2_STND;
|
||||
break;
|
||||
}
|
||||
if (noalt)
|
||||
break;
|
||||
}
|
||||
|
||||
if (mobj->sprite != SPR_PLAY)
|
||||
{
|
||||
mobj->sprite = SPR_PLAY;
|
||||
|
@ -281,6 +405,7 @@ boolean P_SetPlayerMobjState(mobj_t *mobj, statenum_t state)
|
|||
}
|
||||
else if (mobj->sprite2 != spr2)
|
||||
frame = 0;
|
||||
|
||||
mobj->sprite2 = spr2;
|
||||
if (!mobj->skin || frame >= ((skin_t *)mobj->skin)->sprites[spr2].numframes)
|
||||
frame = 0;
|
||||
|
@ -1531,10 +1656,10 @@ static void P_RingZMovement(mobj_t *mo)
|
|||
P_AdjustMobjFloorZ_PolyObjs(mo, mo->subsector);
|
||||
|
||||
// adjust height
|
||||
if (mo->pmomz && mo->z != mo->floorz)
|
||||
if (mo->eflags & MFE_APPLYPMOMZ && !P_IsObjectOnGround(mo))
|
||||
{
|
||||
mo->momz += mo->pmomz;
|
||||
mo->pmomz = 0;
|
||||
mo->eflags &= ~MFE_APPLYPMOMZ;
|
||||
}
|
||||
mo->z += mo->momz;
|
||||
|
||||
|
@ -1600,10 +1725,10 @@ static boolean P_ZMovement(mobj_t *mo)
|
|||
P_AdjustMobjFloorZ_PolyObjs(mo, mo->subsector);
|
||||
|
||||
// adjust height
|
||||
if (mo->pmomz && mo->z != mo->floorz)
|
||||
if (mo->eflags & MFE_APPLYPMOMZ && !P_IsObjectOnGround(mo))
|
||||
{
|
||||
mo->momz += mo->pmomz;
|
||||
mo->pmomz = 0;
|
||||
mo->eflags &= ~MFE_APPLYPMOMZ;
|
||||
}
|
||||
mo->z += mo->momz;
|
||||
|
||||
|
@ -2025,11 +2150,11 @@ static void P_PlayerZMovement(mobj_t *mo)
|
|||
}
|
||||
|
||||
// adjust height
|
||||
/* if (mo->pmomz && mo->z > mo->floorz && !(mo->player->pflags & PF_JUMPED))
|
||||
if (mo->eflags & MFE_APPLYPMOMZ && !P_IsObjectOnGround(mo))
|
||||
{
|
||||
mo->momz += mo->pmomz;
|
||||
mo->pmomz = 0;
|
||||
}*/
|
||||
mo->eflags &= ~MFE_APPLYPMOMZ;
|
||||
}
|
||||
|
||||
mo->z += mo->momz;
|
||||
|
||||
|
@ -2046,7 +2171,7 @@ static void P_PlayerZMovement(mobj_t *mo)
|
|||
else
|
||||
mo->z = mo->floorz;
|
||||
|
||||
if (mo->player && (mo->player->pflags & PF_NIGHTSMODE))
|
||||
if (mo->player->pflags & PF_NIGHTSMODE)
|
||||
{
|
||||
if (mo->player->flyangle < 90 || mo->player->flyangle >= 270)
|
||||
mo->player->flyangle += P_MobjFlip(mo)*90;
|
||||
|
@ -2056,17 +2181,16 @@ static void P_PlayerZMovement(mobj_t *mo)
|
|||
goto nightsdone;
|
||||
}
|
||||
// Get up if you fell.
|
||||
if (mo->state == &states[mo->info->painstate] || mo->state-states == S_PLAY_SUPER_PAIN)
|
||||
if (mo->player->panim == PA_PAIN)
|
||||
P_SetPlayerMobjState(mo, S_PLAY_STND);
|
||||
|
||||
if (P_MobjFlip(mo)*mo->momz < 0) // falling
|
||||
{
|
||||
mo->pmomz = 0; // We're on a new floor, don't keep doing platform movement.
|
||||
|
||||
// Squat down. Decrease viewheight for a moment after hitting the ground (hard),
|
||||
if (mo->player)
|
||||
{
|
||||
if (P_MobjFlip(mo)*mo->momz < -FixedMul(8*FRACUNIT, mo->scale))
|
||||
mo->player->deltaviewheight = (P_MobjFlip(mo)*mo->momz)>>3; // make sure momz is negative
|
||||
}
|
||||
if (P_MobjFlip(mo)*mo->momz < -FixedMul(8*FRACUNIT, mo->scale))
|
||||
mo->player->deltaviewheight = (P_MobjFlip(mo)*mo->momz)>>3; // make sure momz is negative
|
||||
|
||||
if (!tmfloorthing || tmfloorthing->flags & (MF_PUSHABLE|MF_MONITOR)
|
||||
|| tmfloorthing->flags2 & MF2_STANDONME || tmfloorthing->type == MT_PLAYER) // Spin Attack
|
||||
|
@ -2139,14 +2263,14 @@ static void P_PlayerZMovement(mobj_t *mo)
|
|||
|
||||
// Cut momentum in half when you hit the ground and
|
||||
// aren't pressing any controls.
|
||||
if (!mo->player || (!(mo->player->cmd.forwardmove || mo->player->cmd.sidemove) && !mo->player->cmomx && !mo->player->cmomy && !(mo->player->pflags & PF_SPINNING)))
|
||||
if (!(mo->player->cmd.forwardmove || mo->player->cmd.sidemove) && !mo->player->cmomx && !mo->player->cmomy && !(mo->player->pflags & PF_SPINNING))
|
||||
{
|
||||
mo->momx = mo->momx/2;
|
||||
mo->momy = mo->momy/2;
|
||||
}
|
||||
}
|
||||
|
||||
if (mo->health && mo->player)
|
||||
if (mo->health)
|
||||
{
|
||||
if (mo->player->pflags & PF_GLIDING) // ground gliding
|
||||
{
|
||||
|
@ -2192,7 +2316,7 @@ static void P_PlayerZMovement(mobj_t *mo)
|
|||
mo->player->powers[pw_tailsfly] = 0;
|
||||
}
|
||||
}
|
||||
if (mo->player && !(mo->player->pflags & PF_SPINNING))
|
||||
if (!(mo->player->pflags & PF_SPINNING))
|
||||
mo->player->pflags &= ~PF_STARTDASH;
|
||||
|
||||
if (tmfloorthing && (tmfloorthing->flags & (MF_PUSHABLE|MF_MONITOR)
|
||||
|
@ -2235,7 +2359,7 @@ nightsdone:
|
|||
else
|
||||
mo->z = mo->ceilingz - mo->height;
|
||||
|
||||
if (mo->player && (mo->player->pflags & PF_NIGHTSMODE))
|
||||
if (mo->player->pflags & PF_NIGHTSMODE)
|
||||
{
|
||||
if (mo->player->flyangle < 90 || mo->player->flyangle >= 270)
|
||||
mo->player->flyangle -= P_MobjFlip(mo)*90;
|
||||
|
@ -2250,7 +2374,7 @@ nightsdone:
|
|||
{
|
||||
msecnode_t *node;
|
||||
|
||||
if (CheckForMarioBlocks && mo->player && !(netgame && mo->player->spectator)) // Only let the player punch
|
||||
if (CheckForMarioBlocks && !(netgame && mo->player->spectator)) // Only let the player punch
|
||||
{
|
||||
// Search the touching sectors, from side-to-side...
|
||||
for (node = mo->touching_sectorlist; node; node = node->m_snext)
|
||||
|
@ -2278,7 +2402,7 @@ nightsdone:
|
|||
if (mariomode)
|
||||
S_StartSound(mo, sfx_mario1);
|
||||
|
||||
if (!(mo->player && mo->player->climbing))
|
||||
if (!mo->player->climbing)
|
||||
mo->momz = 0;
|
||||
}
|
||||
}
|
||||
|
@ -2293,10 +2417,10 @@ static boolean P_SceneryZMovement(mobj_t *mo)
|
|||
P_AdjustMobjFloorZ_PolyObjs(mo, mo->subsector);
|
||||
|
||||
// adjust height
|
||||
if (mo->pmomz && mo->z != mo->floorz)
|
||||
if (mo->eflags & MFE_APPLYPMOMZ && !P_IsObjectOnGround(mo))
|
||||
{
|
||||
mo->momz += mo->pmomz;
|
||||
mo->pmomz = 0;
|
||||
mo->eflags &= ~MFE_APPLYPMOMZ;
|
||||
}
|
||||
mo->z += mo->momz;
|
||||
|
||||
|
@ -2564,10 +2688,8 @@ void P_MobjCheckWater(mobj_t *mobj)
|
|||
return;
|
||||
|
||||
if ((mobj->eflags & MFE_GOOWATER || wasingoo)) { // Decide what happens to your momentum when you enter/leave goopy water.
|
||||
if (wasinwater && P_MobjFlip(mobj)*mobj->momz > 0)
|
||||
mobj->momz = FixedMul(mobj->momz, FixedDiv(9*FRACUNIT, 8*FRACUNIT)); // Give the mobj a little out-of-goo boost.
|
||||
else if (P_MobjFlip(mobj)*mobj->momz < 0)
|
||||
mobj->momz = FixedMul(mobj->momz, FixedDiv(2*FRACUNIT, 5*FRACUNIT)); // KILL its momentum.
|
||||
if (P_MobjFlip(mobj)*mobj->momz < 0) // You are entering the goo?
|
||||
mobj->momz = FixedMul(mobj->momz, FixedDiv(2*FRACUNIT, 5*FRACUNIT)); // kill momentum significantly, to make the goo feel thick.
|
||||
}
|
||||
else if (wasinwater && P_MobjFlip(mobj)*mobj->momz > 0)
|
||||
mobj->momz = FixedMul(mobj->momz, FixedDiv(780*FRACUNIT, 457*FRACUNIT)); // Give the mobj a little out-of-water boost.
|
||||
|
@ -2876,10 +2998,10 @@ boolean P_CameraThinker(player_t *player, camera_t *thiscam, boolean resetcalled
|
|||
thiscam->floorz = tmfloorz;
|
||||
thiscam->ceilingz = tmceilingz;
|
||||
|
||||
if (thiscam->momz)
|
||||
if (thiscam->momz || player->mo->pmomz)
|
||||
{
|
||||
// adjust height
|
||||
thiscam->z += thiscam->momz;
|
||||
thiscam->z += thiscam->momz + player->mo->pmomz;
|
||||
|
||||
if (!itsatwodlevel && !(player->pflags & PF_NOCLIP))
|
||||
{
|
||||
|
@ -2937,6 +3059,7 @@ static void P_PlayerMobjThinker(mobj_t *mobj)
|
|||
msecnode_t *node;
|
||||
|
||||
I_Assert(mobj != NULL);
|
||||
I_Assert(mobj->player != NULL);
|
||||
I_Assert(!P_MobjWasRemoved(mobj));
|
||||
|
||||
P_MobjCheckWater(mobj);
|
||||
|
@ -2955,7 +3078,7 @@ static void P_PlayerMobjThinker(mobj_t *mobj)
|
|||
P_CheckPosition(mobj, mobj->x, mobj->y);
|
||||
goto animonly;
|
||||
}
|
||||
else if (mobj->player && (mobj->player->pflags & PF_MACESPIN) && mobj->tracer)
|
||||
else if (mobj->player->pflags & PF_MACESPIN && mobj->tracer)
|
||||
{
|
||||
P_CheckPosition(mobj, mobj->x, mobj->y);
|
||||
goto animonly;
|
||||
|
@ -2974,7 +3097,7 @@ static void P_PlayerMobjThinker(mobj_t *mobj)
|
|||
else
|
||||
P_TryMove(mobj, mobj->x, mobj->y, true);
|
||||
|
||||
if (!(netgame && mobj->player && mobj->player->spectator))
|
||||
if (!(netgame && mobj->player->spectator))
|
||||
{
|
||||
// Crumbling platforms
|
||||
for (node = mobj->touching_sectorlist; node; node = node->m_snext)
|
||||
|
@ -3057,18 +3180,14 @@ static void P_PlayerMobjThinker(mobj_t *mobj)
|
|||
}
|
||||
else
|
||||
{
|
||||
if (mobj->player)
|
||||
mobj->player->jumping = 0;
|
||||
mobj->player->pflags &= ~PF_JUMPED;
|
||||
if (mobj->player->secondjump || mobj->player->powers[pw_tailsfly])
|
||||
{
|
||||
mobj->player->jumping = 0;
|
||||
mobj->player->pflags &= ~PF_JUMPED;
|
||||
if (mobj->player->secondjump || mobj->player->powers[pw_tailsfly])
|
||||
{
|
||||
mobj->player->secondjump = 0;
|
||||
mobj->player->powers[pw_tailsfly] = 0;
|
||||
P_SetPlayerMobjState(mobj, S_PLAY_WALK);
|
||||
}
|
||||
mobj->player->secondjump = 0;
|
||||
mobj->player->powers[pw_tailsfly] = 0;
|
||||
P_SetPlayerMobjState(mobj, S_PLAY_WALK);
|
||||
}
|
||||
mobj->pmomz = 0;
|
||||
mobj->eflags &= ~MFE_JUSTHITFLOOR;
|
||||
}
|
||||
|
||||
|
@ -5488,6 +5607,8 @@ void P_MobjThinker(mobj_t *mobj)
|
|||
|
||||
mobj->eflags &= ~(MFE_PUSHED|MFE_SPRUNG);
|
||||
|
||||
tmfloorthing = tmhitthing = NULL;
|
||||
|
||||
// 970 allows ANY mobj to trigger a linedef exec
|
||||
if (mobj->subsector && GETSECSPECIAL(mobj->subsector->sector->special, 2) == 8)
|
||||
{
|
||||
|
@ -6535,19 +6656,22 @@ void P_MobjThinker(mobj_t *mobj)
|
|||
if (mobj->spawnpoint->options & MTF_OBJECTFLIP)
|
||||
{
|
||||
z = ss->sector->ceilingheight - mobjinfo[mobj->type].height;
|
||||
if (mobj->spawnpoint->z)
|
||||
z -= mobj->spawnpoint->z << FRACBITS;
|
||||
if (mobj->spawnpoint->options >> ZSHIFT)
|
||||
z -= (mobj->spawnpoint->options >> ZSHIFT) << FRACBITS;
|
||||
}
|
||||
else
|
||||
{
|
||||
z = ss->sector->floorheight;
|
||||
if (mobj->spawnpoint->z)
|
||||
z += mobj->spawnpoint->z << FRACBITS;
|
||||
if (mobj->spawnpoint->options >> ZSHIFT)
|
||||
z += (mobj->spawnpoint->options >> ZSHIFT) << FRACBITS;
|
||||
}
|
||||
flagmo = P_SpawnMobj(x, y, z, mobj->type);
|
||||
flagmo->spawnpoint = mobj->spawnpoint;
|
||||
if (mobj->spawnpoint->options & MTF_OBJECTFLIP)
|
||||
flagmo->spawnpoint->options |= MTF_OBJECTFLIP;
|
||||
{
|
||||
flagmo->eflags |= MFE_VERTICALFLIP;
|
||||
flagmo->flags2 |= MF2_OBJECTFLIP;
|
||||
}
|
||||
|
||||
if (mobj->type == MT_REDFLAG)
|
||||
{
|
||||
|
@ -6681,17 +6805,6 @@ for (i = ((mobj->flags2 & MF2_STRONGBOX) ? strongboxamt : weakboxamt); i; --i) s
|
|||
}
|
||||
else
|
||||
{
|
||||
if (mobj->player)
|
||||
{
|
||||
mobj->player->jumping = 0;
|
||||
mobj->player->pflags &= ~PF_JUMPED;
|
||||
if (mobj->player->secondjump || mobj->player->powers[pw_tailsfly])
|
||||
{
|
||||
mobj->player->secondjump = 0;
|
||||
mobj->player->powers[pw_tailsfly] = 0;
|
||||
P_SetPlayerMobjState(mobj, S_PLAY_WALK);
|
||||
}
|
||||
}
|
||||
mobj->pmomz = 0; // to prevent that weird rocketing gargoyle bug
|
||||
mobj->eflags &= ~MFE_JUSTHITFLOOR;
|
||||
}
|
||||
|
@ -6892,17 +7005,6 @@ void P_SceneryThinker(mobj_t *mobj)
|
|||
}
|
||||
else
|
||||
{
|
||||
if (mobj->player)
|
||||
{
|
||||
mobj->player->jumping = 0;
|
||||
mobj->player->pflags &= ~PF_JUMPED;
|
||||
if (mobj->player->secondjump || mobj->player->powers[pw_tailsfly])
|
||||
{
|
||||
mobj->player->secondjump = 0;
|
||||
mobj->player->powers[pw_tailsfly] = 0;
|
||||
P_SetPlayerMobjState(mobj, S_PLAY_WALK);
|
||||
}
|
||||
}
|
||||
mobj->pmomz = 0; // to prevent that weird rocketing gargoyle bug
|
||||
mobj->eflags &= ~MFE_JUSTHITFLOOR;
|
||||
}
|
||||
|
|
|
@ -235,6 +235,8 @@ typedef enum
|
|||
MFE_PUSHED = 1<<7,
|
||||
// Mobj was already sprung this tic
|
||||
MFE_SPRUNG = 1<<8,
|
||||
// Platform movement
|
||||
MFE_APPLYPMOMZ = 1<<9,
|
||||
// free: to and including 1<<15
|
||||
} mobjeflag_t;
|
||||
|
||||
|
|
|
@ -657,6 +657,14 @@ static void Polyobj_spawnPolyObj(INT32 num, mobj_t *spawnSpot, INT32 id)
|
|||
// TODO: sound sequence is in args[3]
|
||||
}*/
|
||||
|
||||
// make sure array isn't empty
|
||||
// since Polyobj_findExplicit is disabled currently, we have to do things here instead now!
|
||||
if (po->segCount == 0)
|
||||
{
|
||||
po->isBad = true;
|
||||
CONS_Debug(DBG_POLYOBJ, "Polyobject %d is empty\n", po->id);
|
||||
return;
|
||||
}
|
||||
|
||||
// set the polyobject's spawn spot
|
||||
po->spawnSpot.x = spawnSpot->x;
|
||||
|
@ -848,10 +856,10 @@ static void Polyobj_linkToBlockmap(polyobj_t *po)
|
|||
M_AddToBox(blockbox, po->vertices[i]->x, po->vertices[i]->y);
|
||||
|
||||
// adjust bounding box relative to blockmap
|
||||
blockbox[BOXRIGHT] = (blockbox[BOXRIGHT] - bmaporgx) >> MAPBLOCKSHIFT;
|
||||
blockbox[BOXLEFT] = (blockbox[BOXLEFT] - bmaporgx) >> MAPBLOCKSHIFT;
|
||||
blockbox[BOXTOP] = (blockbox[BOXTOP] - bmaporgy) >> MAPBLOCKSHIFT;
|
||||
blockbox[BOXBOTTOM] = (blockbox[BOXBOTTOM] - bmaporgy) >> MAPBLOCKSHIFT;
|
||||
blockbox[BOXRIGHT] = (unsigned)(blockbox[BOXRIGHT] - bmaporgx) >> MAPBLOCKSHIFT;
|
||||
blockbox[BOXLEFT] = (unsigned)(blockbox[BOXLEFT] - bmaporgx) >> MAPBLOCKSHIFT;
|
||||
blockbox[BOXTOP] = (unsigned)(blockbox[BOXTOP] - bmaporgy) >> MAPBLOCKSHIFT;
|
||||
blockbox[BOXBOTTOM] = (unsigned)(blockbox[BOXBOTTOM] - bmaporgy) >> MAPBLOCKSHIFT;
|
||||
|
||||
// link polyobject to every block its bounding box intersects
|
||||
for (y = blockbox[BOXBOTTOM]; y <= blockbox[BOXTOP]; ++y)
|
||||
|
@ -1079,10 +1087,10 @@ static INT32 Polyobj_clipThings(polyobj_t *po, line_t *line)
|
|||
return hitflags;
|
||||
|
||||
// adjust linedef bounding box to blockmap, extend by MAXRADIUS
|
||||
linebox[BOXLEFT] = (line->bbox[BOXLEFT] - bmaporgx - MAXRADIUS) >> MAPBLOCKSHIFT;
|
||||
linebox[BOXRIGHT] = (line->bbox[BOXRIGHT] - bmaporgx + MAXRADIUS) >> MAPBLOCKSHIFT;
|
||||
linebox[BOXBOTTOM] = (line->bbox[BOXBOTTOM] - bmaporgy - MAXRADIUS) >> MAPBLOCKSHIFT;
|
||||
linebox[BOXTOP] = (line->bbox[BOXTOP] - bmaporgy + MAXRADIUS) >> MAPBLOCKSHIFT;
|
||||
linebox[BOXLEFT] = (unsigned)(line->bbox[BOXLEFT] - bmaporgx - MAXRADIUS) >> MAPBLOCKSHIFT;
|
||||
linebox[BOXRIGHT] = (unsigned)(line->bbox[BOXRIGHT] - bmaporgx + MAXRADIUS) >> MAPBLOCKSHIFT;
|
||||
linebox[BOXBOTTOM] = (unsigned)(line->bbox[BOXBOTTOM] - bmaporgy - MAXRADIUS) >> MAPBLOCKSHIFT;
|
||||
linebox[BOXTOP] = (unsigned)(line->bbox[BOXTOP] - bmaporgy + MAXRADIUS) >> MAPBLOCKSHIFT;
|
||||
|
||||
// check all mobj blockmap cells the line contacts
|
||||
for (y = linebox[BOXBOTTOM]; y <= linebox[BOXTOP]; ++y)
|
||||
|
|
|
@ -1052,6 +1052,8 @@ static void SaveMobjThinker(const thinker_t *th, const UINT8 type)
|
|||
diff |= MD_TICS;
|
||||
if (mobj->sprite != mobj->state->sprite)
|
||||
diff |= MD_SPRITE;
|
||||
if (mobj->sprite == SPR_PLAY && mobj->sprite2 != 0)
|
||||
diff |= MD_SPRITE;
|
||||
if (mobj->frame != mobj->state->frame)
|
||||
diff |= MD_FRAME;
|
||||
if (mobj->eflags)
|
||||
|
|
|
@ -7401,10 +7401,10 @@ void T_Pusher(pusher_t *p)
|
|||
tmbbox[BOXRIGHT] = p->x + radius;
|
||||
tmbbox[BOXLEFT] = p->x - radius;
|
||||
|
||||
xl = (tmbbox[BOXLEFT] - bmaporgx - MAXRADIUS)>>MAPBLOCKSHIFT;
|
||||
xh = (tmbbox[BOXRIGHT] - bmaporgx + MAXRADIUS)>>MAPBLOCKSHIFT;
|
||||
yl = (tmbbox[BOXBOTTOM] - bmaporgy - MAXRADIUS)>>MAPBLOCKSHIFT;
|
||||
yh = (tmbbox[BOXTOP] - bmaporgy + MAXRADIUS)>>MAPBLOCKSHIFT;
|
||||
xl = (unsigned)(tmbbox[BOXLEFT] - bmaporgx - MAXRADIUS)>>MAPBLOCKSHIFT;
|
||||
xh = (unsigned)(tmbbox[BOXRIGHT] - bmaporgx + MAXRADIUS)>>MAPBLOCKSHIFT;
|
||||
yl = (unsigned)(tmbbox[BOXBOTTOM] - bmaporgy - MAXRADIUS)>>MAPBLOCKSHIFT;
|
||||
yh = (unsigned)(tmbbox[BOXTOP] - bmaporgy + MAXRADIUS)>>MAPBLOCKSHIFT;
|
||||
for (bx = xl; bx <= xh; bx++)
|
||||
for (by = yl; by <= yh; by++)
|
||||
P_BlockThingsIterator(bx,by, PIT_PushThing);
|
||||
|
|
111
src/p_user.c
111
src/p_user.c
|
@ -2953,10 +2953,10 @@ static void P_DoTeeter(player_t *player)
|
|||
{
|
||||
INT32 bx, by, xl, xh, yl, yh;
|
||||
|
||||
yh = (player->mo->y + player->mo->radius - bmaporgy)>>MAPBLOCKSHIFT;
|
||||
yl = (player->mo->y - player->mo->radius - bmaporgy)>>MAPBLOCKSHIFT;
|
||||
xh = (player->mo->x + player->mo->radius - bmaporgx)>>MAPBLOCKSHIFT;
|
||||
xl = (player->mo->x - player->mo->radius - bmaporgx)>>MAPBLOCKSHIFT;
|
||||
yh = (unsigned)(player->mo->y + player->mo->radius - bmaporgy)>>MAPBLOCKSHIFT;
|
||||
yl = (unsigned)(player->mo->y - player->mo->radius - bmaporgy)>>MAPBLOCKSHIFT;
|
||||
xh = (unsigned)(player->mo->x + player->mo->radius - bmaporgx)>>MAPBLOCKSHIFT;
|
||||
xl = (unsigned)(player->mo->x - player->mo->radius - bmaporgx)>>MAPBLOCKSHIFT;
|
||||
|
||||
BMBOUNDFIX(xl, xh, yl, yh);
|
||||
|
||||
|
@ -3078,10 +3078,10 @@ teeterdone:
|
|||
}
|
||||
if (teeter)
|
||||
{
|
||||
if (player->panim == PA_IDLE && player->mo->state-states != S_PLAY_EDGE)
|
||||
if (player->panim == PA_IDLE)
|
||||
P_SetPlayerMobjState(player->mo, S_PLAY_EDGE);
|
||||
}
|
||||
else if (checkedforteeter && (player->mo->state-states == S_PLAY_EDGE || player->mo->state-states == S_PLAY_SUPER_EDGE))
|
||||
else if (checkedforteeter && player->panim == PA_EDGE)
|
||||
P_SetPlayerMobjState(player->mo, S_PLAY_STND);
|
||||
}
|
||||
|
||||
|
@ -3436,14 +3436,35 @@ static void P_DoSuperStuff(player_t *player)
|
|||
|
||||
if (player->mo->health > 0)
|
||||
{
|
||||
if ((player->pflags & PF_JUMPED) || (player->pflags & PF_SPINNING))
|
||||
if ((player->pflags & PF_JUMPED || player->pflags & PF_SPINNING)
|
||||
&& player->mo->state-states != S_PLAY_DASH)
|
||||
P_SetPlayerMobjState(player->mo, S_PLAY_SPIN);
|
||||
else if (player->panim == PA_RUN)
|
||||
P_SetPlayerMobjState(player->mo, S_PLAY_RUN);
|
||||
else if (player->panim == PA_WALK)
|
||||
P_SetPlayerMobjState(player->mo, S_PLAY_WALK);
|
||||
else
|
||||
else switch (player->mo->state-states)
|
||||
{
|
||||
default:
|
||||
P_SetPlayerMobjState(player->mo, S_PLAY_STND);
|
||||
break;
|
||||
case S_PLAY_DASH:
|
||||
break;
|
||||
case S_PLAY_SUPER_WALK:
|
||||
P_SetPlayerMobjState(player->mo, S_PLAY_WALK);
|
||||
break;
|
||||
case S_PLAY_SUPER_RUN:
|
||||
P_SetPlayerMobjState(player->mo, S_PLAY_RUN);
|
||||
break;
|
||||
case S_PLAY_SUPER_PAIN:
|
||||
P_SetPlayerMobjState(player->mo, S_PLAY_PAIN);
|
||||
break;
|
||||
case S_PLAY_SUPER_JUMP:
|
||||
P_SetPlayerMobjState(player->mo, S_PLAY_JUMP);
|
||||
break;
|
||||
case S_PLAY_SUPER_FALL:
|
||||
P_SetPlayerMobjState(player->mo, S_PLAY_FALL);
|
||||
break;
|
||||
case S_PLAY_SUPER_RIDE:
|
||||
P_SetPlayerMobjState(player->mo, S_PLAY_RIDE);
|
||||
break;
|
||||
}
|
||||
|
||||
if (!player->exiting)
|
||||
{
|
||||
|
@ -3630,11 +3651,22 @@ void P_DoJump(player_t *player, boolean soundandstate)
|
|||
|
||||
// set just an eensy above the ground
|
||||
if (player->mo->eflags & MFE_VERTICALFLIP)
|
||||
{
|
||||
player->mo->z--;
|
||||
if (player->mo->pmomz < 0)
|
||||
player->mo->momz += player->mo->pmomz; // Add the platform's momentum to your jump.
|
||||
else
|
||||
player->mo->pmomz = 0;
|
||||
}
|
||||
else
|
||||
{
|
||||
player->mo->z++;
|
||||
|
||||
player->mo->z += player->mo->pmomz; // Solves problem of 'hitting around again after jumping on a moving platform'.
|
||||
if (player->mo->pmomz > 0)
|
||||
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;
|
||||
|
||||
|
@ -3679,7 +3711,7 @@ static void P_DoSpinDash(player_t *player, ticcmd_t *cmd)
|
|||
player->pflags |= PF_STARTDASH|PF_SPINNING;
|
||||
player->dashspeed = FixedMul(FRACUNIT, player->mo->scale);
|
||||
player->dashtime = 0;
|
||||
P_SetPlayerMobjState(player->mo, S_PLAY_SPIN);
|
||||
P_SetPlayerMobjState(player->mo, S_PLAY_DASH);
|
||||
player->pflags |= PF_USEDOWN;
|
||||
}
|
||||
else if ((cmd->buttons & BT_USE) && (player->pflags & PF_STARTDASH))
|
||||
|
@ -3692,9 +3724,12 @@ static void P_DoSpinDash(player_t *player, ticcmd_t *cmd)
|
|||
S_StartSound(player->mo, sfx_spndsh); // Make the rev sound!
|
||||
|
||||
// Now spawn the color thok circle.
|
||||
P_SpawnSpinMobj(player, player->revitem);
|
||||
if (demorecording)
|
||||
G_GhostAddRev();
|
||||
if (player->mo->sprite2 != SPR2_DASH)
|
||||
{
|
||||
P_SpawnSpinMobj(player, player->revitem);
|
||||
if (demorecording)
|
||||
G_GhostAddRev();
|
||||
}
|
||||
}
|
||||
}
|
||||
// If not moving up or down, and travelling faster than a speed of four while not holding
|
||||
|
@ -3736,6 +3771,7 @@ static void P_DoSpinDash(player_t *player, ticcmd_t *cmd)
|
|||
player->pflags &= ~PF_STARTDASH;
|
||||
if (!((gametype == GT_RACE || gametype == GT_COMPETITION) && leveltime < 4*TICRATE))
|
||||
{
|
||||
P_SetPlayerMobjState(player->mo, S_PLAY_SPIN);
|
||||
P_InstaThrust(player->mo, player->mo->angle, player->dashspeed); // catapult forward ho!!
|
||||
if (!player->spectator)
|
||||
S_StartSound(player->mo, sfx_zoom);
|
||||
|
@ -3743,7 +3779,9 @@ static void P_DoSpinDash(player_t *player, ticcmd_t *cmd)
|
|||
player->dashspeed = 0;
|
||||
}
|
||||
|
||||
if (onground && (player->pflags & PF_SPINNING) && !(player->panim == PA_ROLL))
|
||||
if (onground && player->pflags & PF_STARTDASH && player->mo->state-states != S_PLAY_DASH)
|
||||
P_SetPlayerMobjState(player->mo, S_PLAY_DASH);
|
||||
else if (onground && player->pflags & PF_SPINNING && !(player->panim == PA_ROLL))
|
||||
P_SetPlayerMobjState(player->mo, S_PLAY_SPIN);
|
||||
}
|
||||
|
||||
|
@ -6411,13 +6449,17 @@ static void P_MovePlayer(player_t *player)
|
|||
// MOVEMENT ANIMATIONS //
|
||||
/////////////////////////
|
||||
|
||||
if ((cmd->forwardmove != 0 || cmd->sidemove != 0) || (player->powers[pw_super] && player->mo->z > player->mo->floorz))
|
||||
if ((cmd->forwardmove != 0 || cmd->sidemove != 0) || (player->powers[pw_super] && !onground))
|
||||
{
|
||||
// If the player is moving fast enough,
|
||||
// break into a run!
|
||||
if (player->speed >= runspd && player->panim == PA_WALK && !player->skidtime && (onground || player->powers[pw_super]))
|
||||
P_SetPlayerMobjState (player->mo, S_PLAY_RUN);
|
||||
|
||||
// Super floating at slow speeds has its own special animation.
|
||||
else if (player->powers[pw_super] && player->panim == PA_IDLE && !onground)
|
||||
P_SetPlayerMobjState (player->mo, S_PLAY_SUPER_FLOAT);
|
||||
|
||||
// Otherwise, just walk.
|
||||
else if ((player->rmomx || player->rmomy) && player->panim == PA_IDLE)
|
||||
P_SetPlayerMobjState (player->mo, S_PLAY_WALK);
|
||||
|
@ -6426,13 +6468,18 @@ static void P_MovePlayer(player_t *player)
|
|||
// If your running animation is playing, and you're
|
||||
// going too slow, switch back to the walking frames.
|
||||
if (player->panim == PA_RUN && player->speed < runspd)
|
||||
P_SetPlayerMobjState(player->mo, S_PLAY_WALK);
|
||||
{
|
||||
if (!onground && player->powers[pw_super])
|
||||
P_SetPlayerMobjState(player->mo, S_PLAY_SUPER_FLOAT);
|
||||
else
|
||||
P_SetPlayerMobjState(player->mo, S_PLAY_WALK);
|
||||
}
|
||||
|
||||
// If Springing, but travelling DOWNWARD, change back!
|
||||
if (player->mo->state == &states[S_PLAY_JUMP] && P_MobjFlip(player->mo)*player->mo->momz < 0)
|
||||
if (player->panim == PA_JUMP && P_MobjFlip(player->mo)*player->mo->momz < 0)
|
||||
P_SetPlayerMobjState(player->mo, S_PLAY_FALL);
|
||||
// If Springing but on the ground, change back!
|
||||
else if (onground && (player->mo->state == &states[S_PLAY_JUMP] || player->panim == PA_FALL || player->mo->state == &states[S_PLAY_RIDE]) && !player->mo->momz)
|
||||
else if (onground && (player->panim == PA_JUMP || player->panim == PA_FALL || player->panim == PA_RIDE) && !player->mo->momz)
|
||||
P_SetPlayerMobjState(player->mo, S_PLAY_STND);
|
||||
|
||||
// If you are stopped and are still walking, stand still!
|
||||
|
@ -6797,8 +6844,8 @@ static void P_MovePlayer(player_t *player)
|
|||
if (player->charflags & SF_SUPER && player->powers[pw_super] && player->speed > FixedMul(5<<FRACBITS, player->mo->scale)
|
||||
&& P_MobjFlip(player->mo)*player->mo->momz <= 0)
|
||||
{
|
||||
if (player->panim == PA_ROLL || player->mo->state-states == S_PLAY_PAIN)
|
||||
P_SetPlayerMobjState(player->mo, S_PLAY_SUPER_WALK);
|
||||
if (player->panim == PA_ROLL || player->mo->state-states == S_PLAY_PAIN || player->panim == PA_WALK)
|
||||
P_SetPlayerMobjState(player->mo, S_PLAY_SUPER_FLOAT);
|
||||
|
||||
player->mo->momz = 0;
|
||||
player->pflags &= ~PF_SPINNING;
|
||||
|
@ -6857,7 +6904,7 @@ static void P_MovePlayer(player_t *player)
|
|||
}
|
||||
|
||||
// Make sure you're not teetering when you shouldn't be.
|
||||
if ((player->mo->state-states == S_PLAY_EDGE || player->mo->state-states == S_PLAY_SUPER_EDGE)
|
||||
if (player->panim == PA_EDGE
|
||||
&& (player->mo->momx || player->mo->momy || player->mo->momz))
|
||||
P_SetPlayerMobjState(player->mo, S_PLAY_STND);
|
||||
|
||||
|
@ -8086,10 +8133,10 @@ boolean P_MoveChaseCamera(player_t *player, camera_t *thiscam, boolean resetcall
|
|||
INT32 xl, xh, yl, yh, bx, by;
|
||||
validcount++;
|
||||
|
||||
xl = (tmbbox[BOXLEFT] - bmaporgx)>>MAPBLOCKSHIFT;
|
||||
xh = (tmbbox[BOXRIGHT] - bmaporgx)>>MAPBLOCKSHIFT;
|
||||
yl = (tmbbox[BOXBOTTOM] - bmaporgy)>>MAPBLOCKSHIFT;
|
||||
yh = (tmbbox[BOXTOP] - bmaporgy)>>MAPBLOCKSHIFT;
|
||||
xl = (unsigned)(tmbbox[BOXLEFT] - bmaporgx)>>MAPBLOCKSHIFT;
|
||||
xh = (unsigned)(tmbbox[BOXRIGHT] - bmaporgx)>>MAPBLOCKSHIFT;
|
||||
yl = (unsigned)(tmbbox[BOXBOTTOM] - bmaporgy)>>MAPBLOCKSHIFT;
|
||||
yh = (unsigned)(tmbbox[BOXTOP] - bmaporgy)>>MAPBLOCKSHIFT;
|
||||
|
||||
BMBOUNDFIX(xl, xh, yl, yh);
|
||||
|
||||
|
@ -9036,7 +9083,6 @@ void P_PlayerThink(player_t *player)
|
|||
player->mo->tracer->flags2 &= ~MF2_DONTDRAW;
|
||||
}
|
||||
|
||||
player->mo->pmomz = 0;
|
||||
player->pflags &= ~PF_SLIDING;
|
||||
|
||||
/*
|
||||
|
@ -9387,4 +9433,7 @@ void P_PlayerAfterThink(player_t *player)
|
|||
player->mo->flags2 |= MF2_DONTDRAW;
|
||||
player->mo->flags |= MF_NOGRAVITY;
|
||||
}
|
||||
|
||||
if (P_IsObjectOnGround(player->mo))
|
||||
player->mo->pmomz = 0;
|
||||
}
|
||||
|
|
2548
src/tables.c
2548
src/tables.c
File diff suppressed because it is too large
Load diff
Loading…
Reference in a new issue