5. Built-in Constants

This file tries to give some additional details about the definitions in defs.qc.

5.1 temporary entities

Information copied from the DEM specifications

// point entity is a small point like entity.
 0    TE_SPIKE           unknown
 1    TE_SUPERSPIKE      superspike hits (spike traps)
 2    TE_GUNSHOT         hit on the wall (Axe, Shotgun)
 3    TE_EXPLOSION       grenade/missile explosion
 4    TE_TAREXPLOSION    explosion of a tarbaby
 7    TE_WIZSPIKE        wizard's hit
 8    TE_KNIGHTSPIKE     hell knight's shot hit
10    TE_LAVASPLASH      Chthon awakes and falls dead
11    TE_TELEPORT        teleport end
// large entity is a 2 dimensional entity.
 5    TE_LIGHTNING1      flash of the Shambler
 6    TE_LIGHTNING2      flash of the Thunderbolt
 9    TE_LIGHTNING3      flash in e1m7 to kill Chthon

5.2 Sound Channels

CHAN_AUTO = 0;   // Create a new sound
CHAN_WEAPON = 1; // Replace entitie's weapon noise
CHAN_VOICE = 2;  // Replace entitie's voice
CHAN_ITEM = 3;   // Replace entitie's item noise
CHAN_BODY = 4;   // Replace entitie's body noise 
Those values are meant to be used with the function sound.

5.3 Sound Attenuation

ATTN_NONE = 0;    // full volume everywhere in the leve
ATTN_NORM = 1;    // normal
ATTN_IDLE = 2;    // ?
ATTN_STATIC = 3;  // ?
Those values are meant to be used with the functions sound and ambientsound.

5.4 Contents of areas

CONTENT_EMPTY = -1;   // Empty area
CONTENT_SOLID = -2;   // Totally solid area (rock)   
CONTENT_WATER = -3;   // Pool of water
CONTENT_SLIME = -4;   // Pool of slime
CONTENT_LAVA = -5;    // Lava
CONTENT_SKY = -6;     // Sky
Note: it seems that the CONTENT_SKY is not used anymore.

5.5 light effects

EF_BRIGHTFIELD = 1;  // Glowing field of dots
EF_MUZZLEFLASH = 2;
EF_BRIGHTLIGHT = 4;
EF_DIMLIGHT = 8;

5.6 Items

IT_AXE = 4096;
IT_SHOTGUN = 1;
IT_SUPER_SHOTGUN = 2;
IT_NAILGUN = 4;
IT_SUPER_NAILGUN = 8;
IT_GRENADE_LAUNCHER = 16;
IT_ROCKET_LAUNCHER = 32;
IT_LIGHTNING = 64;
IT_EXTRA_WEAPON = 128;
IT_SHELLS = 256;
IT_NAILS = 512;
IT_ROCKETS = 1024;
IT_CELLS = 2048;
IT_ARMOR1 = 8192;
IT_ARMOR2 = 16384;
IT_ARMOR3 = 32768;
IT_SUPERHEALTH = 65536;
IT_KEY1 = 131072;
IT_KEY2 = 262144;
IT_INVISIBILITY = 524288;
IT_INVULNERABILITY = 1048576;
IT_SUIT = 2097152;
IT_QUAD = 4194304;
The item codes are flags. That mean they can be combined by logical operations (| for or-ing, & for and-ing). So for instance items = (IT_AXE | IT_NAILGUN) means you have both the axe and the nailgun.

5.7 Collision detection

SOLID_NOT = 0;                 // no interaction with other objects
                               // inactive triggers
SOLID_TRIGGER = 1;             // touch on edge, but not blocking
                               // active triggers, pickable items 
                               // (.MDL models, like armors)
SOLID_BBOX = 2;                // touch on edge, block
                               // pickable items (.BSP models, like ammo box)
                               // grenade, missiles
SOLID_SLIDEBOX = 3;            // touch on edge, but not an onground
                               // most monsters
SOLID_BSP = 4;                 // bsp clip, touch on edge, block
                               // buttons, platforms, doors, missiles

5.8 Type of movements

           
MOVETYPE_NONE = 0;	       // never moves
//float	MOVETYPE_ANGLENOCLIP = 1;
//float	MOVETYPE_ANGLECLIP = 2;
MOVETYPE_WALK = 3;	       // Walking players only
MOVETYPE_STEP = 4;	       // Walking monster
MOVETYPE_FLY = 5;              // Hovering Flight 
                               // meant for flying monsters (and players)
MOVETYPE_TOSS = 6;	       // Balistic flight 
                               // meant for gibs and the like
MOVETYPE_PUSH = 7;	       // Not blocked by the world, push and crush 
                               // meant for doors, spikes and crusing platforms
MOVETYPE_NOCLIP = 8;           // Not blocked by the world
MOVETYPE_FLYMISSILE = 9;       // like fly, but size enlarged against monsters
                               // meant for rockets
MOVETYPE_BOUNCE = 10;          // bounce off walls
MOVETYPE_BOUNCEMISSILE = 11    // bounce off walls, but size enlarged against monsters
                               // meant for grenades

5.9 Take damage

DAMAGE_NO = 0;                 // Can't be damaged
DAMAGE_YES = 1;                // Grenades don't explode when touching entity
DAMAGE_AIM = 2;                // Grenades explode when touching entity
Most damageable entities have DAMAGE_AIM, so that when they chew on a grenade, it explodes. If you make an entity DAMAGE_YES, the grenades will bounce off it.

5.10 Entity dead flag

DEAD_NO = 0;                   // still living
DEAD_DYING = 1;                // dying (helpless)
DEAD_DEAD = 2;                 // really dead
DEAD_RESPAWNABLE = 3;          // dead, but can respawn

5.11 Spawn flags

The spawn flags are bit fields, whose interpretation depend on the concerned entity. There is quite a bit of a hack, that could cause unexpected bugs in the Quake C code.

  DOOR_START_OPEN = 1;         // allow entity to be lighted in closed position
  SPAWN_CRUCIFIED= 1;          // for zombie
  PLAT_LOW_TRIGGER = 1;        // for func_plat
  SPAWNFLAG_NOTOUCH= 1;
  SPAWNFLAG_NOMESSAGE= 1;
  PLAYER_ONLY = 1;
  SPAWNFLAG_SUPERSPIKE = 1;    // for spike shooter
  SECRET_OPEN_ONCE = 1;        // secret door, stays open
  PUSH_ONCE = 1;
  WEAPON_SHOTGUN = 1;          // weapon, shotgun
  H_ROTTEN = 1;                // health, rotten (5-10 points)
  WEAPON_BIG2 = 1;             // items 
  START_OFF = 1;               // light, is off at start.
  SILENT = 2;
  SPAWNFLAG_LASER = 2;         // for spike shooter
  SECRET_1ST_LEFT = 2;         // secret door, 1st move is left of arrow
  WEAPON_ROCKET = 2;           // weapon, rocket
  H_MEGA = 2;	               // health, mega (100 points)
  DOOR_DONT_LINK = 4;
  SECRET_1ST_DOWN = 4;         // secret door, 1st move is down from arrow
  WEAPON_SPIKES = 4;           // weapon, nailgun
  DOOR_GOLD_KEY = 8;
  SECRET_NO_SHOOT = 8;         // secret door, only opened by trigger
  WEAPON_BIG = 8;              // weapon, super model
  DOOR_SILVER_KEY = 16;
  SECRET_YES_SHOOT = 16;       // secret door, shootable even if targeted
  DOOR_TOGGLE = 32;