2010-08-02 08:13:51 +00:00
|
|
|
//-------------------------------------------------------------------------
|
|
|
|
/*
|
|
|
|
Copyright (C) 2010 EDuke32 developers and contributors
|
|
|
|
|
|
|
|
This file is part of EDuke32.
|
|
|
|
|
|
|
|
EDuke32 is free software; you can redistribute it and/or
|
|
|
|
modify it under the terms of the GNU General Public License version 2
|
|
|
|
as published by the Free Software Foundation.
|
|
|
|
|
|
|
|
This program is distributed in the hope that it will be useful,
|
|
|
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
|
|
|
|
|
|
|
See the GNU General Public License for more details.
|
|
|
|
|
|
|
|
You should have received a copy of the GNU General Public License
|
|
|
|
along with this program; if not, write to the Free Software
|
2014-07-20 08:55:56 +00:00
|
|
|
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
2010-08-02 08:13:51 +00:00
|
|
|
*/
|
|
|
|
//-------------------------------------------------------------------------
|
|
|
|
|
2014-11-22 12:32:56 +00:00
|
|
|
#ifndef actors_h_
|
|
|
|
#define actors_h_
|
2010-08-02 08:13:51 +00:00
|
|
|
|
2012-08-02 10:52:17 +00:00
|
|
|
#include "player.h"
|
|
|
|
|
2010-08-02 08:13:51 +00:00
|
|
|
#define MAXSLEEPDIST 16384
|
|
|
|
#define SLEEPTIME 1536
|
|
|
|
#define ZOFFSET (1<<8)
|
|
|
|
|
2013-04-15 10:48:09 +00:00
|
|
|
#define ACTOR_MAXFALLINGZVEL 6144
|
|
|
|
#define ACTOR_ONWATER_ADDZ (24<<8)
|
|
|
|
|
2012-11-25 13:18:41 +00:00
|
|
|
// KEEPINSYNC lunatic/con_lang.lua
|
2010-08-02 08:13:51 +00:00
|
|
|
#define STAT_DEFAULT 0
|
|
|
|
#define STAT_ACTOR 1
|
|
|
|
#define STAT_ZOMBIEACTOR 2
|
|
|
|
#define STAT_EFFECTOR 3
|
|
|
|
#define STAT_PROJECTILE 4
|
|
|
|
#define STAT_MISC 5
|
|
|
|
#define STAT_STANDABLE 6
|
|
|
|
#define STAT_LOCATOR 7
|
|
|
|
#define STAT_ACTIVATOR 8
|
|
|
|
#define STAT_TRANSPORT 9
|
|
|
|
#define STAT_PLAYER 10
|
|
|
|
#define STAT_FX 11
|
|
|
|
#define STAT_FALLER 12
|
|
|
|
#define STAT_DUMMYPLAYER 13
|
2012-05-06 21:01:52 +00:00
|
|
|
#define STAT_LIGHT 14
|
2013-01-28 22:00:37 +00:00
|
|
|
#define STAT_NETALLOC MAXSTATUS-1
|
2010-08-02 08:13:51 +00:00
|
|
|
|
2012-05-18 12:46:10 +00:00
|
|
|
|
2010-08-02 08:13:51 +00:00
|
|
|
// Defines the motion characteristics of an actor
|
|
|
|
enum amoveflags_t {
|
|
|
|
face_player = 1,
|
|
|
|
geth = 2,
|
|
|
|
getv = 4,
|
|
|
|
random_angle = 8,
|
|
|
|
face_player_slow = 16,
|
|
|
|
spin = 32,
|
|
|
|
face_player_smart = 64,
|
|
|
|
fleeenemy = 128,
|
2014-03-16 14:37:52 +00:00
|
|
|
jumptoplayer_only = 256,
|
|
|
|
jumptoplayer_bits = 257, // NOTE: two bits set!
|
2010-08-02 08:13:51 +00:00
|
|
|
seekplayer = 512,
|
|
|
|
furthestdir = 1024,
|
|
|
|
dodgebullet = 4096
|
|
|
|
};
|
|
|
|
|
|
|
|
// Defines for 'useractor' keyword
|
|
|
|
enum uactortypes_t {
|
|
|
|
notenemy,
|
|
|
|
enemy,
|
|
|
|
enemystayput
|
|
|
|
};
|
|
|
|
|
2013-06-30 20:38:48 +00:00
|
|
|
// These macros are there to give names to the t_data[]/T*/vm.g_t[] indices
|
|
|
|
// when used with actors. Greppability of source code is certainly a virtue.
|
2013-06-30 20:38:52 +00:00
|
|
|
#define AC_COUNT(t) ((t)[0]) /* the actor's count */
|
2013-06-30 20:38:48 +00:00
|
|
|
/* The ID of the actor's current move. In C-CON, the bytecode offset to the
|
|
|
|
* move composite: */
|
2013-06-30 20:38:52 +00:00
|
|
|
#define AC_MOVE_ID(t) ((t)[1])
|
|
|
|
#define AC_ACTION_COUNT(t) ((t)[2]) /* the actor's action count */
|
|
|
|
#define AC_CURFRAME(t) ((t)[3]) /* the actor's current frame offset */
|
2013-06-30 20:38:48 +00:00
|
|
|
/* The ID of the actor's current action. In C-CON, the bytecode offset to the
|
|
|
|
* action composite: */
|
2013-06-30 20:38:52 +00:00
|
|
|
#define AC_ACTION_ID(t) ((t)[4])
|
|
|
|
#define AC_AI_ID(t) ((t)[5]) /* the ID of the actor's current ai */
|
2012-08-06 20:00:29 +00:00
|
|
|
|
|
|
|
#ifdef LUNATIC
|
|
|
|
struct action {
|
2013-06-30 20:38:39 +00:00
|
|
|
// These members MUST be in this exact order because FFI cdata of this type
|
|
|
|
// can be initialized by passing a table with numeric indices (con.action).
|
2012-08-06 20:00:29 +00:00
|
|
|
int16_t startframe, numframes;
|
|
|
|
int16_t viewtype, incval, delay;
|
|
|
|
};
|
|
|
|
|
|
|
|
struct move {
|
2013-06-30 20:38:39 +00:00
|
|
|
// These members MUST be in this exact order.
|
2012-08-06 20:00:29 +00:00
|
|
|
int16_t hvel, vvel;
|
|
|
|
};
|
2012-12-23 19:24:16 +00:00
|
|
|
|
2013-02-03 12:48:25 +00:00
|
|
|
#pragma pack(push,1)
|
2012-12-23 19:24:16 +00:00
|
|
|
typedef struct { int32_t id; struct move mv; } con_move_t;
|
|
|
|
typedef struct { int32_t id; struct action ac; } con_action_t;
|
2013-02-03 12:48:25 +00:00
|
|
|
#pragma pack(pop)
|
2012-08-06 20:00:29 +00:00
|
|
|
#endif
|
|
|
|
|
2010-08-02 08:13:51 +00:00
|
|
|
typedef struct {
|
|
|
|
int32_t workslike, cstat; // 8b
|
|
|
|
int32_t hitradius, range, flashcolor; // 12b
|
|
|
|
int16_t spawns, sound, isound, vel; // 8b
|
|
|
|
int16_t decal, trail, tnum, drop; // 8b
|
|
|
|
int16_t offset, bounces, bsound; // 6b
|
|
|
|
int16_t toffset; // 2b
|
|
|
|
int16_t extra, extra_rand; // 4b
|
|
|
|
int8_t sxrepeat, syrepeat, txrepeat, tyrepeat; // 4b
|
|
|
|
int8_t shade, xrepeat, yrepeat, pal; // 4b
|
2012-10-05 20:48:10 +00:00
|
|
|
int8_t movecnt; // 1b
|
2010-08-02 08:13:51 +00:00
|
|
|
uint8_t clipdist; // 1b
|
2013-06-09 16:37:18 +00:00
|
|
|
int8_t filler[2]; // 2b
|
|
|
|
int32_t userdata; // 4b
|
2010-08-02 08:13:51 +00:00
|
|
|
} projectile_t;
|
|
|
|
|
2013-06-30 20:38:52 +00:00
|
|
|
// Select an actor's actiontics and movflags locations depending on
|
|
|
|
// whether we compile the Lunatic build.
|
|
|
|
// <spr>: sprite pointer
|
|
|
|
// <a>: actor_t pointer
|
|
|
|
#ifdef LUNATIC
|
|
|
|
# define AC_ACTIONTICS(spr, a) ((a)->actiontics)
|
|
|
|
# define AC_MOVFLAGS(spr, a) ((a)->movflags)
|
|
|
|
#else
|
|
|
|
# define AC_ACTIONTICS(spr, a) ((spr)->lotag)
|
|
|
|
# define AC_MOVFLAGS(spr, a) ((spr)->hitag)
|
|
|
|
#endif
|
|
|
|
|
2012-12-09 13:24:46 +00:00
|
|
|
// (+ 40 16 16 4 8 6 8 6 4 20)
|
2010-08-02 08:13:51 +00:00
|
|
|
typedef struct {
|
2011-12-21 18:40:47 +00:00
|
|
|
int32_t t_data[10]; // 40b sometimes used to hold offsets to con code
|
2012-08-06 20:00:29 +00:00
|
|
|
|
|
|
|
#ifdef LUNATIC
|
2012-12-09 13:24:46 +00:00
|
|
|
// total: 16b
|
2012-08-06 20:00:29 +00:00
|
|
|
struct move mv;
|
|
|
|
struct action ac;
|
2013-06-30 20:38:52 +00:00
|
|
|
// Gets incremented by TICSPERFRAME on each A_Execute() call:
|
|
|
|
uint16_t actiontics;
|
2012-06-03 15:46:08 +00:00
|
|
|
#endif
|
2012-03-11 17:37:50 +00:00
|
|
|
|
2012-12-23 14:00:08 +00:00
|
|
|
int32_t flags; //4b
|
|
|
|
vec3_t bpos; //12b
|
2010-08-02 08:13:51 +00:00
|
|
|
int32_t floorz,ceilingz,lastvx,lastvy; //16b
|
|
|
|
int32_t lasttransport; //4b
|
|
|
|
|
2012-12-09 13:24:46 +00:00
|
|
|
int16_t picnum,ang,extra,owner; //8b
|
|
|
|
int16_t movflag,tempang,timetosleep; //6b
|
|
|
|
|
2013-06-30 20:38:52 +00:00
|
|
|
int16_t actorstayput, dispicnum;
|
|
|
|
#if !defined LUNATIC
|
2013-06-30 20:38:50 +00:00
|
|
|
// NOTE: shootzvel is not used any more.
|
2013-06-30 20:38:52 +00:00
|
|
|
int16_t shootzvel_;
|
|
|
|
#else
|
|
|
|
// Movement flags, sprite[i].hitag in C-CON:
|
|
|
|
uint16_t movflags;
|
|
|
|
#endif
|
|
|
|
int16_t cgg;
|
2010-08-02 08:13:51 +00:00
|
|
|
|
2013-06-30 20:38:52 +00:00
|
|
|
int16_t lightId, lightcount, lightmaxrange; //6b
|
2010-08-02 08:13:51 +00:00
|
|
|
#ifdef POLYMER
|
|
|
|
_prlight *lightptr; //4b/8b
|
|
|
|
#else
|
|
|
|
void *lightptr;
|
|
|
|
#endif
|
|
|
|
|
2011-12-25 15:34:06 +00:00
|
|
|
// pad struct to 128 bytes
|
|
|
|
#if !defined UINTPTR_MAX
|
|
|
|
# error Need UINTPTR_MAX define to select between 32- and 64-bit structs
|
|
|
|
#endif
|
|
|
|
#if UINTPTR_MAX == 0xffffffff
|
|
|
|
/* 32-bit */
|
2013-06-30 20:38:48 +00:00
|
|
|
# if !defined LUNATIC
|
2012-11-05 02:49:08 +00:00
|
|
|
int8_t filler[20];
|
2012-06-03 15:46:08 +00:00
|
|
|
# else
|
2012-11-05 02:49:08 +00:00
|
|
|
int8_t filler[4];
|
2012-06-03 15:46:08 +00:00
|
|
|
# endif
|
2011-12-21 18:40:47 +00:00
|
|
|
#else
|
2011-12-25 15:34:06 +00:00
|
|
|
/* 64-bit */
|
2013-06-30 20:38:48 +00:00
|
|
|
# if !defined LUNATIC
|
2012-11-05 02:49:08 +00:00
|
|
|
int8_t filler[16];
|
2012-06-03 15:46:08 +00:00
|
|
|
# else
|
|
|
|
/* no padding */
|
|
|
|
#endif
|
2011-12-21 18:40:47 +00:00
|
|
|
#endif
|
2010-08-02 08:13:51 +00:00
|
|
|
} actor_t;
|
|
|
|
|
2013-07-19 12:49:08 +00:00
|
|
|
#pragma pack(push,1)
|
2010-08-02 08:13:51 +00:00
|
|
|
// this struct needs to match the beginning of actor_t above
|
|
|
|
typedef struct {
|
2011-12-21 18:40:47 +00:00
|
|
|
int32_t t_data[10]; // 40b sometimes used to hold offsets to con code
|
2012-08-06 20:00:29 +00:00
|
|
|
|
|
|
|
#ifdef LUNATIC
|
|
|
|
struct move mv;
|
|
|
|
struct action ac;
|
2013-06-30 20:38:52 +00:00
|
|
|
uint16_t actiontics;
|
2012-06-03 15:46:08 +00:00
|
|
|
#endif
|
2010-08-02 08:13:51 +00:00
|
|
|
|
2012-12-23 14:00:08 +00:00
|
|
|
int32_t flags; //4b
|
|
|
|
vec3_t bpos; //12b
|
2012-10-14 22:11:09 +00:00
|
|
|
int32_t floorz,ceilingz,lastvx,lastvy; //16b
|
|
|
|
int32_t lasttransport; //4b
|
|
|
|
|
2012-12-09 13:24:46 +00:00
|
|
|
int16_t picnum,ang,extra,owner; //8b
|
|
|
|
int16_t movflag,tempang,timetosleep; // 6b
|
|
|
|
|
2013-06-30 20:38:52 +00:00
|
|
|
int16_t actorstayput, dispicnum;
|
|
|
|
#if !defined LUNATIC
|
|
|
|
int16_t shootzvel_;
|
|
|
|
#else
|
|
|
|
uint16_t movflags;
|
|
|
|
#endif
|
|
|
|
int16_t cgg;
|
2012-10-14 22:11:09 +00:00
|
|
|
|
2012-12-12 02:53:13 +00:00
|
|
|
spritetype sprite;
|
|
|
|
int16_t netIndex;
|
|
|
|
|
2010-08-02 08:13:51 +00:00
|
|
|
} netactor_t;
|
2013-02-03 12:48:25 +00:00
|
|
|
#pragma pack(pop)
|
2012-10-30 15:54:35 +00:00
|
|
|
|
|
|
|
typedef struct {
|
2013-02-03 12:48:17 +00:00
|
|
|
#if !defined LUNATIC
|
2012-10-30 15:54:35 +00:00
|
|
|
intptr_t *execPtr; // pointer to CON script for this tile, formerly actorscrptr
|
|
|
|
intptr_t *loadPtr; // pointer to load time CON script, formerly actorLoadEventScrPtr or something
|
2013-02-03 12:48:17 +00:00
|
|
|
#endif
|
2012-10-30 15:54:35 +00:00
|
|
|
uint32_t flags; // formerly SpriteFlags, ActorType
|
|
|
|
|
2013-02-03 12:48:25 +00:00
|
|
|
int32_t cacherange; // formerly SpriteCache
|
2012-10-30 15:54:35 +00:00
|
|
|
|
2012-11-11 17:57:06 +00:00
|
|
|
// todo: make this a pointer and allocate at runtime
|
2012-10-30 15:54:35 +00:00
|
|
|
projectile_t defproj;
|
|
|
|
} tiledata_t;
|
|
|
|
|
2010-08-02 08:13:51 +00:00
|
|
|
|
2012-11-25 13:18:41 +00:00
|
|
|
// KEEPINSYNC lunatic/con_lang.lua
|
2010-08-02 08:13:51 +00:00
|
|
|
enum sflags_t {
|
2014-02-22 19:38:52 +00:00
|
|
|
SFLAG_SHADOW = 0x00000001,
|
|
|
|
SFLAG_NVG = 0x00000002,
|
|
|
|
SFLAG_NOSHADE = 0x00000004,
|
|
|
|
SFLAG_PROJECTILE = 0x00000008,
|
|
|
|
SFLAG_DECAL = 0x00000010,
|
|
|
|
SFLAG_BADGUY = 0x00000020,
|
|
|
|
SFLAG_NOPAL = 0x00000040,
|
|
|
|
SFLAG_NOEVENTCODE = 0x00000080,
|
|
|
|
SFLAG_NOLIGHT = 0x00000100,
|
|
|
|
SFLAG_USEACTIVATOR = 0x00000200,
|
|
|
|
SFLAG_NULL = 0x00000400, // null sprite in multiplayer
|
|
|
|
SFLAG_NOCLIP = 0x00000800, // clipmove it with cliptype 0
|
|
|
|
SFLAG_NOFLOORSHADOW = 0x00001000, // for temp. internal use, per-tile flag not checked
|
|
|
|
SFLAG_SMOOTHMOVE = 0x00002000,
|
|
|
|
SFLAG_NOTELEPORT = 0x00004000,
|
|
|
|
SFLAG_BADGUYSTAYPUT = 0x00008000,
|
|
|
|
SFLAG_CACHE = 0x00010000,
|
2012-12-23 19:24:21 +00:00
|
|
|
// rotation-fixed wrt a pivot point to prevent position diverging due to
|
|
|
|
// roundoff error accumulation:
|
2014-02-22 19:38:52 +00:00
|
|
|
SFLAG_ROTFIXED = 0x00020000,
|
|
|
|
SFLAG_HARDCODED_BADGUY = 0x00040000,
|
|
|
|
SFLAG_DIDNOSE7WATER = 0x00080000, // used temporarily
|
2014-03-15 14:10:47 +00:00
|
|
|
SFLAG_NODAMAGEPUSH = 0x00100000,
|
2010-08-02 08:13:51 +00:00
|
|
|
};
|
|
|
|
|
2013-05-10 12:31:33 +00:00
|
|
|
// Custom projectiles "workslike" flags.
|
|
|
|
// XXX: Currently not predefined from CON.
|
2010-08-02 08:13:51 +00:00
|
|
|
enum pflags_t {
|
|
|
|
PROJECTILE_HITSCAN = 0x00000001,
|
|
|
|
PROJECTILE_RPG = 0x00000002,
|
|
|
|
PROJECTILE_BOUNCESOFFWALLS = 0x00000004,
|
|
|
|
PROJECTILE_BOUNCESOFFMIRRORS = 0x00000008,
|
|
|
|
PROJECTILE_KNEE = 0x00000010,
|
|
|
|
PROJECTILE_WATERBUBBLES = 0x00000020,
|
|
|
|
PROJECTILE_TIMED = 0x00000040,
|
|
|
|
PROJECTILE_BOUNCESOFFSPRITES = 0x00000080,
|
|
|
|
PROJECTILE_SPIT = 0x00000100,
|
|
|
|
PROJECTILE_COOLEXPLOSION1 = 0x00000200,
|
|
|
|
PROJECTILE_BLOOD = 0x00000400,
|
|
|
|
PROJECTILE_LOSESVELOCITY = 0x00000800,
|
|
|
|
PROJECTILE_NOAIM = 0x00001000,
|
|
|
|
PROJECTILE_RANDDECALSIZE = 0x00002000,
|
|
|
|
PROJECTILE_EXPLODEONTIMER = 0x00004000,
|
|
|
|
PROJECTILE_RPG_IMPACT = 0x00008000,
|
|
|
|
PROJECTILE_RADIUS_PICNUM = 0x00010000,
|
|
|
|
PROJECTILE_ACCURATE_AUTOAIM = 0x00020000,
|
|
|
|
PROJECTILE_FORCEIMPACT = 0x00040000,
|
|
|
|
PROJECTILE_REALCLIPDIST = 0x00080000,
|
|
|
|
PROJECTILE_ACCURATE = 0x00100000,
|
2013-08-06 23:53:34 +00:00
|
|
|
PROJECTILE_TYPE_MASK = PROJECTILE_HITSCAN|PROJECTILE_RPG|PROJECTILE_KNEE|PROJECTILE_BLOOD,
|
2010-08-02 08:13:51 +00:00
|
|
|
};
|
|
|
|
|
2012-10-30 15:54:35 +00:00
|
|
|
extern tiledata_t g_tile[MAXTILES];
|
2010-08-02 08:13:51 +00:00
|
|
|
extern actor_t actor[MAXSPRITES];
|
|
|
|
extern int32_t block_deletesprite;
|
|
|
|
extern int32_t g_noEnemies;
|
|
|
|
extern int32_t otherp;
|
|
|
|
extern int32_t ticrandomseed;
|
|
|
|
extern intptr_t *g_parsingActorPtr;
|
|
|
|
extern projectile_t SpriteProjectile[MAXSPRITES];
|
|
|
|
|
2012-08-06 20:00:29 +00:00
|
|
|
|
|
|
|
|
2010-08-02 08:13:51 +00:00
|
|
|
void A_AddToDeleteQueue(int32_t i);
|
|
|
|
int32_t A_CheckEnemyTile(int32_t pn);
|
|
|
|
int32_t A_CheckSwitchTile(int32_t i);
|
|
|
|
void A_DeleteSprite(int32_t s);
|
|
|
|
void A_DoGuts(int32_t sp,int32_t gtype,int32_t n);
|
|
|
|
void A_DoGutsDir(int32_t sp,int32_t gtype,int32_t n);
|
|
|
|
int32_t A_IncurDamage(int32_t sn);
|
|
|
|
void A_MoveCyclers(void);
|
|
|
|
void A_MoveDummyPlayers(void);
|
|
|
|
void A_PlayAlertSound(int32_t i);
|
|
|
|
void A_RadiusDamage(int32_t i,int32_t r,int32_t hp1,int32_t hp2,int32_t hp3,int32_t hp4);
|
|
|
|
void A_SpawnMultiple(int32_t sp,int32_t pic,int32_t n);
|
|
|
|
|
|
|
|
void G_AddGameLight(int32_t radius,int32_t srcsprite,int32_t zoffset,int32_t range,int32_t color,int32_t priority);
|
2012-08-02 10:52:13 +00:00
|
|
|
void G_ClearCameraView(DukePlayer_t *ps);
|
2010-08-02 08:13:51 +00:00
|
|
|
void G_DoInterpolations(int32_t smoothratio);
|
|
|
|
void G_MoveWorld(void);
|
2013-02-16 18:53:00 +00:00
|
|
|
int32_t G_SetInterpolation(int32_t *posptr);
|
2010-08-02 08:13:51 +00:00
|
|
|
void G_StopInterpolation(int32_t *posptr);
|
|
|
|
|
2011-07-01 17:15:07 +00:00
|
|
|
// PK 20110701: changed input argument: int32_t i (== sprite, whose sectnum...) --> sectnum directly
|
2014-11-22 12:29:25 +00:00
|
|
|
void Sect_ToggleInterpolation(int sectnum, int doset);
|
|
|
|
FORCE_INLINE void Sect_ClearInterpolation(int sectnum) { Sect_ToggleInterpolation(sectnum, 0); }
|
|
|
|
FORCE_INLINE void Sect_SetInterpolation(int sectnum) { Sect_ToggleInterpolation(sectnum, 1); }
|
2010-08-02 08:13:51 +00:00
|
|
|
|
2012-11-05 02:49:08 +00:00
|
|
|
#include "actors_inline.h"
|
|
|
|
|
2010-08-02 08:13:51 +00:00
|
|
|
#endif
|