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"
|
2019-09-21 20:53:00 +00:00
|
|
|
# include "namesdyn.h"
|
2020-03-04 20:33:27 +00:00
|
|
|
#include "dukerr/actors.h"
|
2019-09-21 20:53:00 +00:00
|
|
|
|
|
|
|
BEGIN_DUKE_NS
|
2012-12-09 13:24:46 +00:00
|
|
|
// (+ 40 16 16 4 8 6 8 6 4 20)
|
2017-06-23 03:59:39 +00:00
|
|
|
#pragma pack(push, 1)
|
2010-08-02 08:13:51 +00:00
|
|
|
|
2018-12-08 00:40:39 +00:00
|
|
|
// note: fields in this struct DO NOT have to be in this order,
|
|
|
|
// however if you add something to this struct, please make sure
|
|
|
|
// a field gets added to ActorFields[], otherwise the field
|
|
|
|
// won't get synced over the network!
|
|
|
|
//
|
|
|
|
// I don't think the ActorFields array needs to be in the same order,
|
|
|
|
// need to verify this...
|
|
|
|
typedef struct netactor_s
|
2016-08-27 01:40:06 +00:00
|
|
|
{
|
2018-12-08 00:40:39 +00:00
|
|
|
// actor fields
|
|
|
|
//--------------------------------------------
|
|
|
|
int32_t
|
|
|
|
t_data_0,
|
|
|
|
t_data_1,
|
|
|
|
t_data_2,
|
|
|
|
t_data_3,
|
|
|
|
t_data_4,
|
|
|
|
t_data_5,
|
|
|
|
t_data_6,
|
|
|
|
t_data_7,
|
|
|
|
t_data_8,
|
|
|
|
t_data_9;
|
2012-08-06 20:00:29 +00:00
|
|
|
|
2018-12-08 00:40:39 +00:00
|
|
|
int32_t
|
|
|
|
flags;
|
|
|
|
|
|
|
|
|
|
|
|
int32_t
|
|
|
|
bpos_x,
|
|
|
|
bpos_y,
|
|
|
|
bpos_z;
|
|
|
|
|
|
|
|
int32_t
|
|
|
|
floorz,
|
|
|
|
ceilingz,
|
|
|
|
lastvx,
|
|
|
|
lastvy,
|
|
|
|
|
|
|
|
lasttransport,
|
|
|
|
|
|
|
|
picnum,
|
|
|
|
ang,
|
|
|
|
extra,
|
|
|
|
owner,
|
|
|
|
|
|
|
|
movflag,
|
|
|
|
tempang,
|
|
|
|
timetosleep,
|
|
|
|
|
|
|
|
stayput,
|
|
|
|
dispicnum;
|
|
|
|
|
|
|
|
|
|
|
|
// note: lightId, lightcount, lightmaxrange are not synchronized between client and server
|
|
|
|
|
2019-03-19 17:10:17 +00:00
|
|
|
int32_t
|
2018-12-08 00:40:39 +00:00
|
|
|
cgg;
|
|
|
|
|
|
|
|
|
|
|
|
// sprite fields
|
|
|
|
//-----------------------------
|
|
|
|
|
|
|
|
int32_t
|
|
|
|
spr_x,
|
|
|
|
spr_y,
|
|
|
|
spr_z,
|
|
|
|
|
|
|
|
spr_cstat,
|
|
|
|
|
|
|
|
spr_picnum,
|
|
|
|
|
|
|
|
spr_shade,
|
|
|
|
|
|
|
|
spr_pal,
|
|
|
|
spr_clipdist,
|
|
|
|
spr_blend,
|
|
|
|
|
|
|
|
spr_xrepeat,
|
|
|
|
spr_yrepeat,
|
|
|
|
|
|
|
|
spr_xoffset,
|
|
|
|
spr_yoffset,
|
|
|
|
|
|
|
|
spr_sectnum,
|
|
|
|
spr_statnum,
|
|
|
|
|
|
|
|
spr_ang,
|
|
|
|
spr_owner,
|
|
|
|
spr_xvel,
|
|
|
|
spr_yvel,
|
|
|
|
spr_zvel,
|
|
|
|
|
|
|
|
spr_lotag,
|
|
|
|
spr_hitag,
|
|
|
|
|
|
|
|
spr_extra;
|
|
|
|
|
|
|
|
//---------------------------------------------
|
|
|
|
//spriteext fields
|
|
|
|
|
|
|
|
int32_t
|
|
|
|
ext_mdanimtims,
|
|
|
|
|
|
|
|
ext_mdanimcur,
|
|
|
|
ext_angoff,
|
|
|
|
ext_pitch,
|
|
|
|
ext_roll,
|
|
|
|
|
2019-12-31 19:35:28 +00:00
|
|
|
ext_pivot_offset_x,
|
|
|
|
ext_pivot_offset_y,
|
|
|
|
ext_pivot_offset_z,
|
|
|
|
|
|
|
|
ext_position_offset_x,
|
|
|
|
ext_position_offset_y,
|
|
|
|
ext_position_offset_z,
|
2018-12-08 00:40:39 +00:00
|
|
|
|
|
|
|
ext_flags,
|
|
|
|
ext_xpanning,
|
|
|
|
ext_ypanning;
|
|
|
|
|
|
|
|
float ext_alpha;
|
|
|
|
|
|
|
|
// DON'T send tsprites over the internet
|
|
|
|
|
|
|
|
//--------------------------------------------
|
|
|
|
//spritesmooth fields
|
|
|
|
|
|
|
|
float sm_smoothduration;
|
|
|
|
|
|
|
|
int32_t
|
|
|
|
sm_mdcurframe,
|
|
|
|
sm_mdoldframe,
|
|
|
|
|
|
|
|
sm_mdsmooth;
|
|
|
|
|
|
|
|
//--------------------------------------------
|
|
|
|
// SpriteProjectile fields
|
2017-06-23 03:59:39 +00:00
|
|
|
|
2018-12-08 00:40:39 +00:00
|
|
|
// may want to put projectile fields here
|
|
|
|
int32_t netIndex;
|
2017-06-23 03:59:19 +00:00
|
|
|
|
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
|
|
|
|
2016-08-27 01:42:01 +00:00
|
|
|
extern tiledata_t g_tile[MAXTILES];
|
|
|
|
extern actor_t actor[MAXSPRITES];
|
|
|
|
extern int32_t block_deletesprite;
|
|
|
|
extern int32_t g_noEnemies;
|
|
|
|
extern int32_t otherp;
|
|
|
|
extern int32_t ticrandomseed;
|
|
|
|
extern projectile_t SpriteProjectile[MAXSPRITES];
|
2019-09-17 03:20:16 +00:00
|
|
|
extern uint8_t g_radiusDmgStatnums[(MAXSTATUS+7)>>3];
|
2016-08-27 01:42:01 +00:00
|
|
|
|
2019-04-18 17:25:24 +00:00
|
|
|
int A_CheckNoSE7Water(uspriteptr_t pSprite, int sectNum, int sectLotag, int32_t *pOther);
|
2016-08-27 01:42:01 +00:00
|
|
|
int A_CheckSwitchTile(int spriteNum);
|
2018-10-16 06:08:58 +00:00
|
|
|
int A_IncurDamage(int spriteNum);
|
2016-08-27 01:42:01 +00:00
|
|
|
void A_AddToDeleteQueue(int spriteNum);
|
|
|
|
void A_DeleteSprite(int spriteNum);
|
|
|
|
void A_DoGuts(int spriteNum, int tileNum, int spawnCnt);
|
|
|
|
void A_DoGutsDir(int spriteNum, int tileNum, int spawnCnt);
|
2019-03-19 17:10:17 +00:00
|
|
|
int A_GetClipdist(int spriteNum, int clipDist);
|
2016-08-27 01:42:01 +00:00
|
|
|
void A_MoveCyclers(void);
|
|
|
|
void A_MoveDummyPlayers(void);
|
2018-10-16 06:08:58 +00:00
|
|
|
void A_MoveSector(int spriteNum);
|
2016-08-27 01:42:01 +00:00
|
|
|
void A_PlayAlertSound(int spriteNum);
|
|
|
|
void A_RadiusDamage(int spriteNum, int blastRadius, int dmg1, int dmg2, int dmg3, int dmg4);
|
|
|
|
void A_SpawnMultiple(int spriteNum, int tileNum, int spawnCnt);
|
|
|
|
|
2018-10-16 06:08:58 +00:00
|
|
|
int G_SetInterpolation(int32_t *posptr);
|
2016-08-27 01:42:01 +00:00
|
|
|
void G_AddGameLight(int lightRadius, int spriteNum, int zOffset, int lightRange, int lightColor, int lightPrio);
|
|
|
|
void G_ClearCameraView(DukePlayer_t *ps);
|
|
|
|
void G_DoInterpolations(int smoothRatio);
|
|
|
|
void G_MoveWorld(void);
|
|
|
|
void G_RefreshLights(void);
|
2018-10-16 06:08:58 +00:00
|
|
|
void G_StopInterpolation(const int32_t *posptr);
|
2010-08-02 08:13:51 +00:00
|
|
|
|
2020-03-04 20:33:27 +00:00
|
|
|
inline int A_CheckEnemyTile(int tileNum);
|
|
|
|
inline int A_SetSprite(int spriteNum, uint32_t cliptype);
|
|
|
|
inline int32_t A_MoveSprite(int spriteNum, vec3_t const* change, uint32_t cliptype);
|
2014-11-26 04:39:23 +00:00
|
|
|
|
2020-03-04 20:33:27 +00:00
|
|
|
inline int G_CheckForSpaceCeiling(int sectnum);
|
|
|
|
inline int G_CheckForSpaceFloor(int sectnum);
|
2016-01-08 01:33:35 +00:00
|
|
|
|
2020-03-04 20:33:27 +00:00
|
|
|
inline int A_CheckEnemySprite(void const* s);
|
2016-01-08 01:33:35 +00:00
|
|
|
|
2020-03-04 20:33:27 +00:00
|
|
|
// PK 20110701: changed input argument: int32_t i (== sprite, whose sectnum...) --> sectnum directly
|
|
|
|
void Sect_ToggleInterpolation(int sectnum, int setInterpolation);
|
|
|
|
inline void Sect_ClearInterpolation(int sectnum) { Sect_ToggleInterpolation(sectnum, 0); }
|
|
|
|
inline void Sect_SetInterpolation(int sectnum) { Sect_ToggleInterpolation(sectnum, 1); }
|
2014-11-26 04:39:23 +00:00
|
|
|
|
2020-03-04 20:33:27 +00:00
|
|
|
extern int32_t A_MoveSpriteClipdist(int32_t spritenum, vec3_t const * change, uint32_t cliptype, int32_t clipdist);
|
2016-01-08 01:33:35 +00:00
|
|
|
|
|
|
|
|
2020-03-04 20:33:27 +00:00
|
|
|
inline int A_CheckEnemyTile(int const tileNum)
|
2016-01-08 01:33:35 +00:00
|
|
|
{
|
2017-06-24 06:31:32 +00:00
|
|
|
return ((g_tile[tileNum].flags & (SFLAG_HARDCODED_BADGUY | SFLAG_BADGUY)) != 0);
|
2016-01-08 01:33:35 +00:00
|
|
|
}
|
|
|
|
|
2020-03-04 20:33:27 +00:00
|
|
|
inline int A_SetSprite(int const spriteNum, uint32_t cliptype)
|
2016-01-08 01:33:35 +00:00
|
|
|
{
|
2019-03-19 22:09:26 +00:00
|
|
|
vec3_t const davect = { (sprite[spriteNum].xvel * (sintable[(sprite[spriteNum].ang + 512) & 2047])) >> 14,
|
2017-06-24 06:31:32 +00:00
|
|
|
(sprite[spriteNum].xvel * (sintable[sprite[spriteNum].ang & 2047])) >> 14, sprite[spriteNum].zvel };
|
|
|
|
return (A_MoveSprite(spriteNum, &davect, cliptype) == 0);
|
2016-01-08 01:33:35 +00:00
|
|
|
}
|
|
|
|
|
2020-03-04 20:33:27 +00:00
|
|
|
inline int A_SetSpriteNoZ(int const spriteNum, uint32_t cliptype)
|
2019-03-19 22:09:26 +00:00
|
|
|
{
|
|
|
|
vec3_t const davect = { (sprite[spriteNum].xvel * (sintable[(sprite[spriteNum].ang + 512) & 2047])) >> 14,
|
|
|
|
(sprite[spriteNum].xvel * (sintable[sprite[spriteNum].ang & 2047])) >> 14, 0 };
|
|
|
|
return (A_MoveSprite(spriteNum, &davect, cliptype) == 0);
|
|
|
|
}
|
|
|
|
|
2020-03-04 20:33:27 +00:00
|
|
|
inline int32_t A_MoveSprite(int const spriteNum, vec3_t const * const change, uint32_t cliptype)
|
2016-01-08 01:33:35 +00:00
|
|
|
{
|
2017-06-24 06:31:32 +00:00
|
|
|
return A_MoveSpriteClipdist(spriteNum, change, cliptype, -1);
|
2016-01-08 01:33:35 +00:00
|
|
|
}
|
|
|
|
|
2020-03-04 20:33:27 +00:00
|
|
|
inline int G_CheckForSpaceCeiling(int const sectnum)
|
2016-01-08 01:33:35 +00:00
|
|
|
{
|
|
|
|
return ((sector[sectnum].ceilingstat&1) && sector[sectnum].ceilingpal == 0 &&
|
|
|
|
(sector[sectnum].ceilingpicnum==MOONSKY1 || sector[sectnum].ceilingpicnum==BIGORBIT1));
|
|
|
|
}
|
|
|
|
|
2020-03-04 20:33:27 +00:00
|
|
|
inline int G_CheckForSpaceFloor(int const sectnum)
|
2016-01-08 01:33:35 +00:00
|
|
|
{
|
|
|
|
return ((sector[sectnum].floorstat&1) && sector[sectnum].ceilingpal == 0 &&
|
|
|
|
(sector[sectnum].floorpicnum==MOONSKY1 || sector[sectnum].floorpicnum==BIGORBIT1));
|
|
|
|
}
|
|
|
|
|
2020-03-04 20:33:27 +00:00
|
|
|
inline int A_CheckEnemySprite(void const * const pSprite)
|
2016-01-08 01:33:35 +00:00
|
|
|
{
|
2019-04-18 17:25:24 +00:00
|
|
|
return A_CheckEnemyTile(((uspriteptr_t) pSprite)->picnum);
|
2016-01-08 01:33:35 +00:00
|
|
|
}
|
|
|
|
|
2019-09-21 20:53:00 +00:00
|
|
|
|
2020-03-04 20:33:27 +00:00
|
|
|
END_DUKE_NS
|
2012-11-05 02:49:08 +00:00
|
|
|
|
2010-08-02 08:13:51 +00:00
|
|
|
#endif
|