This repository has been archived on 2022-06-27. You can view files and clone it, but cannot push or open issues or pull requests.
Xash3DArchive/engine/common/world.h

130 lines
3.6 KiB
C
Raw Normal View History

2009-11-02 22:00:00 +01:00
//=======================================================================
// Copyright XashXT Group 2009 <20>
2010-07-19 22:00:00 +02:00
// world.h - shared world trace
2009-11-02 22:00:00 +01:00
//=======================================================================
2010-07-19 22:00:00 +02:00
#ifndef WORLD_H
#define WORLD_H
2009-11-02 22:00:00 +01:00
#define MOVE_NORMAL 0 // normal trace
#define MOVE_NOMONSTERS 1 // ignore monsters (edicts with flags (FL_MONSTER|FL_FAKECLIENT|FL_CLIENT) set)
2009-11-23 22:00:00 +01:00
#define MOVE_MISSILE 2 // extra size for monsters
#define MOVE_WORLDONLY 3 // clip only world
2010-10-19 22:00:00 +02:00
#define FMOVE_IGNORE_GLASS 0x100
#define FMOVE_SIMPLEBOX 0x200
2010-08-15 22:00:00 +02:00
#define CONTENTS_NONE 0 // no custom contents specified
2009-11-02 22:00:00 +01:00
/*
===============================================================================
ENTITY AREA CHECKING
===============================================================================
*/
2010-10-20 22:00:00 +02:00
#define STRUCT_FROM_LINK( l, t, m ) ((t *)((byte *)l - (int)&(((t *)0)->m)))
2009-11-02 22:00:00 +01:00
#define MAX_TOTAL_ENT_LEAFS 128
2010-08-25 22:00:00 +02:00
#define AREA_NODES 32
#define AREA_DEPTH 4
2009-11-02 22:00:00 +01:00
2010-08-26 22:00:00 +02:00
typedef enum
{
AREA_SOLID, // find any solid edicts
AREA_TRIGGERS, // find all SOLID_TRIGGER edicts
AREA_CUSTOM, // find all edicts with custom contents - water, lava, fog, laders etc
} AREA_TYPE;
2009-11-02 22:00:00 +01:00
typedef struct areanode_s
{
2010-04-01 22:00:00 +02:00
int axis; // -1 = leaf node
2009-11-02 22:00:00 +01:00
float dist;
struct areanode_s *children[2];
link_t trigger_edicts;
link_t solid_edicts;
2010-04-01 22:00:00 +02:00
link_t water_edicts; // func water
2009-11-02 22:00:00 +01:00
} areanode_t;
typedef struct area_s
{
const float *mins;
const float *maxs;
2010-08-07 22:00:00 +02:00
void **list;
2009-11-02 22:00:00 +01:00
int count;
int maxcount;
int type;
} area_t;
2010-10-28 22:00:00 +02:00
typedef struct
{
2010-12-11 22:00:00 +01:00
char pattern[MAX_STRING];
2010-10-28 22:00:00 +02:00
float map[MAX_STRING];
int length;
2010-12-06 22:00:00 +01:00
float value;
2010-12-11 22:00:00 +01:00
qboolean interp; // allow to interpolate this lightstyle
2010-10-28 22:00:00 +02:00
} lightstyle_t;
2010-08-15 22:00:00 +02:00
extern const char *et_name[];
2009-11-26 22:00:00 +01:00
2009-11-02 22:00:00 +01:00
// linked list
2010-10-20 22:00:00 +02:00
void InsertLinkBefore( link_t *l, link_t *before );
2009-11-02 22:00:00 +01:00
void RemoveLink( link_t *l );
void ClearLink( link_t *l );
2009-11-26 22:00:00 +01:00
// trace common
2011-01-08 22:00:00 +01:00
qboolean World_UseSimpleBox( qboolean simpleBox, int solid, qboolean isPointTrace, model_t *mod );
2009-11-26 22:00:00 +01:00
void World_MoveBounds( const vec3_t start, vec3_t mins, vec3_t maxs, const vec3_t end, vec3_t boxmins, vec3_t boxmaxs );
2010-05-22 22:00:00 +02:00
trace_t World_CombineTraces( trace_t *cliptrace, trace_t *trace, edict_t *touch );
2010-08-25 22:00:00 +02:00
int BoxOnPlaneSide( const vec3_t emins, const vec3_t emaxs, const mplane_t *p );
int RankForContents( int contents );
#define BOX_ON_PLANE_SIDE( emins, emaxs, p ) \
((( p )->type < 3 ) ? \
( \
((p)->dist <= (emins)[(p)->type]) ? \
1 \
: \
( \
((p)->dist >= (emaxs)[(p)->type]) ? \
2 \
: \
3 \
) \
) \
: \
BoxOnPlaneSide(( emins ), ( emaxs ), ( p )))
2009-11-26 22:00:00 +01:00
2010-06-28 22:00:00 +02:00
#include "bspfile.h"
2009-12-05 22:00:00 +01:00
#include "pm_shared.h"
2009-11-02 22:00:00 +01:00
2009-12-02 22:00:00 +01:00
/*
===============================================================================
2010-05-22 22:00:00 +02:00
EVENTS QUEUE (hl1 events code)
2009-12-02 22:00:00 +01:00
===============================================================================
*/
#include "event_api.h"
2010-10-26 22:00:00 +02:00
#include "event_args.h"
2009-12-02 22:00:00 +01:00
#define MAX_EVENT_QUEUE 64 // 16 simultaneous events, max
typedef struct event_info_s
{
word index; // 0 implies not in use
short packet_index; // Use data from state info for entity in delta_packet .
// -1 implies separate info based on event
// parameter signature
short entity_index; // The edict this event is associated with
float fire_time; // if non-zero, the time when the event should be fired
// ( fixed up on the client )
event_args_t args;
int flags; // reliable or not, etc. ( CLIENT ONLY )
} event_info_t;
typedef struct event_state_s
{
event_info_t ei[MAX_EVENT_QUEUE];
} event_state_t;
2010-07-19 22:00:00 +02:00
#endif//WORLD_H