2002-08-25 23:06:23 +00:00
|
|
|
/*
|
|
|
|
entities.h
|
|
|
|
|
|
|
|
(description)
|
|
|
|
|
2002-09-25 01:51:58 +00:00
|
|
|
Copyright (C) 1996-1997 Id Software, Inc.
|
2002-08-25 23:06:23 +00:00
|
|
|
Copyright (C) 2002 Colin Thompson
|
|
|
|
|
|
|
|
This program is free software; you can redistribute it and/or
|
|
|
|
modify it under the terms of the GNU General Public License
|
|
|
|
as published by the Free Software Foundation; either version 2
|
|
|
|
of the License, or (at your option) any later version.
|
|
|
|
|
|
|
|
This program is distributed in the hope that it will be useful,
|
|
|
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
|
|
|
|
|
|
|
See the GNU General Public License for more details.
|
|
|
|
|
|
|
|
You should have received a copy of the GNU General Public License
|
|
|
|
along with this program; if not, write to:
|
|
|
|
|
|
|
|
Free Software Foundation, Inc.
|
|
|
|
59 Temple Place - Suite 330
|
|
|
|
Boston, MA 02111-1307, USA
|
|
|
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
#ifndef __entities_h
|
|
|
|
#define __entities_h
|
|
|
|
|
2013-01-02 09:31:36 +00:00
|
|
|
#include "light.h"
|
|
|
|
|
2012-12-26 05:39:05 +00:00
|
|
|
/** \defgroup qflight_entities Light entity data.
|
|
|
|
\ingroup qflight
|
|
|
|
*/
|
|
|
|
//@{
|
|
|
|
|
2002-08-25 23:06:23 +00:00
|
|
|
#define DEFAULTLIGHTLEVEL 300
|
2003-09-09 08:13:33 +00:00
|
|
|
#define DEFAULTFALLOFF 1.0f
|
2002-08-25 23:06:23 +00:00
|
|
|
|
2004-01-26 07:39:29 +00:00
|
|
|
// Open Quartz - attenuation types
|
|
|
|
#define LIGHT_LINEAR 0 // regular attenuation (light - distance)
|
|
|
|
#define LIGHT_RADIUS 1 // light * (distance - radius) / radius
|
|
|
|
#define LIGHT_INVERSE 2 // light / distance
|
|
|
|
#define LIGHT_REALISTIC 3 // light / (distance * distance)
|
|
|
|
#define LIGHT_NO_ATTEN 4 // no attenuation
|
|
|
|
#define LIGHT_LH 5 // LordHavocs version of realistic
|
|
|
|
|
|
|
|
// Open Quartz - noise type flags
|
|
|
|
#define NOISE_RANDOM 0 // completely random noise (default)
|
|
|
|
#define NOISE_SMOOTH 1 // low res noise with interpolation
|
|
|
|
#define NOISE_PERLIN 2 // combines several noise frequencies
|
|
|
|
|
2002-08-25 23:06:23 +00:00
|
|
|
typedef struct entity_s {
|
2003-09-08 03:39:44 +00:00
|
|
|
const char *classname;
|
|
|
|
vec3_t origin;
|
2003-09-09 08:13:33 +00:00
|
|
|
vec_t angle;
|
2003-09-08 03:39:44 +00:00
|
|
|
int light;
|
2013-01-02 09:31:36 +00:00
|
|
|
|
|
|
|
int sun_light[2];
|
|
|
|
vec3_t sun_color[2];
|
|
|
|
int num_suns;
|
|
|
|
vec3_t sun_dir[NUMSUNS];
|
|
|
|
float shadow_sense;
|
|
|
|
|
2003-09-08 03:39:44 +00:00
|
|
|
// LordHavoc: added falloff (smaller fractions = bigger light area),
|
|
|
|
// color, and lightradius (also subbrightness to implement lightradius)
|
|
|
|
vec_t falloff;
|
|
|
|
vec_t lightradius;
|
|
|
|
vec_t subbrightness;
|
|
|
|
vec_t lightoffset;
|
2004-01-27 08:31:34 +00:00
|
|
|
vec3_t color, color2;
|
2003-09-08 03:39:44 +00:00
|
|
|
vec3_t spotdir;
|
|
|
|
vec_t spotcone;
|
|
|
|
unsigned short visbyte, visbit; // which byte and bit to look at in
|
|
|
|
// the visdata for the leaf this light
|
|
|
|
// is in
|
|
|
|
int style;
|
2004-01-26 07:39:29 +00:00
|
|
|
|
|
|
|
// Open Quartz - special light feilds
|
|
|
|
int noisetype; // random noise type
|
|
|
|
float noise; // noise intensity
|
|
|
|
float resolution; // noise blockiness
|
|
|
|
float persistence; // perlin noise decay per octave
|
|
|
|
int attenuation; // light attenuation type
|
|
|
|
float radius; // the light's maximum range, minimum
|
|
|
|
// of cutoff range and _radius key, 0
|
|
|
|
// for no maximum
|
|
|
|
|
2003-09-08 03:39:44 +00:00
|
|
|
const char *target;
|
|
|
|
const char *targetname;
|
2002-09-19 02:37:52 +00:00
|
|
|
struct entity_s *targetent;
|
2012-12-26 07:24:59 +00:00
|
|
|
struct plitem_s *dict;
|
2002-08-25 23:06:23 +00:00
|
|
|
} entity_t;
|
|
|
|
|
2003-09-08 03:39:44 +00:00
|
|
|
extern entity_t *entities;
|
2002-08-25 23:06:23 +00:00
|
|
|
extern int num_entities;
|
2013-01-02 08:00:09 +00:00
|
|
|
extern entity_t *world_entity;
|
2002-08-25 23:06:23 +00:00
|
|
|
|
2003-01-06 18:28:13 +00:00
|
|
|
const char *ValueForKey (entity_t *ent, const char *key);
|
|
|
|
void SetKeyValue (entity_t *ent, const char *key, const char *value);
|
2003-09-10 15:48:46 +00:00
|
|
|
entity_t *FindEntityWithKeyPair(const char *key, const char *value);
|
2003-01-06 18:28:13 +00:00
|
|
|
void GetVectorForKey (entity_t *ent, const char *key, vec3_t vec);
|
2002-08-25 23:06:23 +00:00
|
|
|
|
|
|
|
void LoadEntities (void);
|
|
|
|
void WriteEntitiesToString (void);
|
|
|
|
|
2012-12-26 05:39:05 +00:00
|
|
|
//@}
|
|
|
|
|
2002-08-25 23:06:23 +00:00
|
|
|
#endif// __entities_h
|