Back

Developer Network
  File Specs
  Source codes
  Tables
  Mailing lists
  Knowledge Base

Other Games

 

 

Descent Developer Network
Descent 1/2

Constants and definitions

Definitions and constants

Here is a header file you can use with all important definitions and constants:

// DCONST.H Header file for general Descent constants/definitions  
// Summarized by Heiko Herrmann
// (W) 1996-2000 by Descent Network Team

typedef signed char    INT8;
typedef signed short   INT16;
typedef signed long    INT32;
typedef unsigned char  UINT8;
typedef unsigned short UINT16;
typedef unsigned long  UINT32;
typedef long           FIX;           // 16 bits int, 16 bits fraction
typedef short          FIXANG;        //  8 bits int,  8 bits fraction - used for angles
typedef unsigned int   UINTW;
typedef int            INTW;

typedef struct vms_vector {
  FIX x,y,z;
} VMS_VECTOR;                         // 12 bytes

typedef struct vms_angvec {
  FIXANG p,b,h;
} VMS_ANGVEC;                         // 6 bytes
                                          
typedef struct vms_matrix {
  VMS_VECTOR rvec,uvec,fvec;
} VMS_MATRIX;                         // 36 bytes

typedef struct {
  UINT16 index;                           
} BITMAP_INDEX;                       // 2 bytes

typedef struct shortpos {
  SHORT xo,y0,zo,segment,velx,vely,velz;
} SHORTPOS;                           // 14 bytes
               

// Control types
#define CT_NONE                 0     // doesn't move (or change movement)
#define CT_AI                   1     // driven by AI (=robot)
#define CT_EXPLOSION            2     // explosion sequencer
#define CT_FLYING               4     // the player is flying
#define CT_SLEW                 5     // slewing
#define CT_FLYTHROUGH           6     // the flythrough system
#define CT_WEAPON               9     // laser shots etc.
#define CT_REPAIRCEN           10     // under the control of the repair center
#define CT_MORPH               11     // this object is being morphed
#define CT_DEBRIS              12     // this is a piece of debris
#define CT_POWERUP             13     // animating powerup blob
#define CT_LIGHT               14     // doesn't actually do anything
#define CT_REMOTE              15     // controlled by another net player
#define CT_CNRTLCEN            16     // the control center (main reactor)

// Movement types
#define MT_NONE                0      // doesn't move
#define MT_PHYSICS             1      // moves by physics
#define MT_SPINNING            3      // this object doesn't move just sits and spins

// Render types
#define RT_NONE                0      // does not render    
#define RT_POLYOBJ             1      // a polygon model
#define RT_FIREBALL            2      // a fireball
#define RT_LASER               3      // a laser
#define RT_HOSTAGE             4      // a hostage
#define RT_POWERUP             5      // a powerup
#define RT_MORPH               6      // a robot being morphed
#define RT_WEAPON_VCLIP        7      // a weapon that renders as a vclip
        
// Object types
#define OBJ_NONE             255      // unused object   
#define OBJ_WALL               0      // a wall (not really an object, but used for collisions)
#define OBJ_FIREBALL           1      // a fireball, part of an explosion
#define OBJ_ROBOT              2      // an evil enemy
#define OBJ_HOSTAGE            3      // a hostage you need to rescue
#define OBJ_PLAYER             4      // the player on the console
#define OBJ_WEAPON             5      // a laser, missile, etc.
#define OBJ_CAMERA             6      // a camera to slew around with
#define OBJ_POWERUP            7      // a powerup
#define OBJ_DEBRIS             8      // a piece of robot
#define OBJ_CNTRLCEN           9      // a control center (main reactor)
#define OBJ_FLARE             10      // a flare
#define OBJ_CLUTTER           11      // misc objects
#define OBJ_GHOSTS            12      // what the player turns into when dead
#define OBJ_LIGHT             13      // a light source & not much else
#define OBJ_COOP              14      // a cooperative player object

// Misc object flags
#define OF_EXPLODING           1      // this object is exploding
#define OF_SHOULD_BE_DEAD      2      // this object should be dead, so next time we can we should delete it
#define OF_DESTROYED           4      // this has been killed, and is showing the dead version
#define OF_SILENT              8      // this makes no sound when it hits a wall
#define OF_ATTACHED           16      // this object is a fireball attached to another object
#define OF_HARMLESS           32      // this object does no damage

// GameMode constants
#define GM_MULTI               4      // IPX Multiplayer mode (serial is handled extra with GM_SERIAL)
#define GM_ROBOTS              8      // Robots enabled (in Cooperative and Robo-Anarchy modes)
#define GM_MULTI_COOP         16      // Cooperative mode
#define GM_SERIAL             32      // Serial Multiplayer mode (modem/null-modem connection)
#define GM_TEAM              256      // Team mode (in Team-Anarchy, Capture the Flag and Team-Hoard modes)
#define GM_FLAG              512      // Capture the Flag mode
#define GM_HOARD            1024      // Hoard mode

// Max constants
#define MAX_PRIMARY_WEAPONS   10      // Number of different primary weapon types
#define MAX_SECONDARY_WEAPONS 10      // Number of different secondary weapon types
#define MAX_GUNS               8      // Maximum number of guns a robot can have
#define MAX_CONTROLCEN_GUNS    8      // Maximum number of guns a reactor can have
#define MAX_OBJECT_TYPES      15      // Maximum number of object types
#define MAX_CLIP_FRAMES       50      // Maximum number of frames a VClip/EClip/WClip can have
#define MAX_SUBMODELS         10      // Maximum number of submodels a polygon model can have
#define MAX_ROBOT_TYPES       85      // Maximum number of different robots
#define MAX_ROBOT_JOINTS    1250      // Maximum number of robot joints
#define MAX_POLYGON_MODELS   200      // Maximum number of polygon models
#define MAX_OBJ_BITMAPS      600      // Maximum number of object bitmaps
#define VCLIP_MAX_FRAMES      30

// Other constants
#define N_PLAYER_GUNS         8
#define N_ANIM_STATES	      5       // Number of states a robot can be
#define NDL                   5       // Number of difficulty levels


// HAM/HXM definitions

typedef struct {
  UINT8       flags;           /*1=lava,2=water,4=force field,8=blue goal, 16=red goal */
  UINT8       pad[3];          /*keep alignment */
  FIX         lighting;        /*how much light this casts */
  FIX         damage;          /*how much damage being against this does (for lava) */
  INT16       eclip_num;       /*the eclip that changes this, or -1 */
  INT16       destroyed;       /*bitmap to show when destroyed, or -1 */
  INT16       slide_u,slide_v; /*slide rates of texture, stored in 8:8 FIX */
} TMAP_INFO;

typedef struct {
  FIX            play_time;  /*total time (in seconds) of clip */
  INT32          num_frames;
  FIX            frame_time; /*time (in seconds) of each frame */
  INT32          flags;
  INT16          sound_num;
  BITMAP_INDEX   frames[VCLIP_MAX_FRAMES];
  FIX            light_value;
} VCLIP;

typedef struct {
  VCLIP  vc;                      /*imbedded vclip */
  FIX    time_left;               /*for sequencing */
  INT32  frame_count;             /*for sequencing */
  INT16  changing_wall_texture;   /*Which element of Textures array to */
                                  /*replace. */
  INT16  changing_object_texture; /*Which element of ObjBitmapPtrs array */
                                  /*to replace. */
  INT32  flags;                   
  INT32  crit_clip;               /*use this clip instead of above one */
                                  /*when mine critical */
  INT32  dest_bm_num;             /*use this bitmap when monitor destroyed */
  INT32  dest_vclip;              /*what vclip to play when exploding */
  INT32  dest_eclip;              /*what eclip to play when exploding */
  FIX    dest_size;               /*3d size of explosion */
  INT32  sound_num;               /*what sound this makes */
  INT32  segnum,sidenum;          /*what seg & side, for one-shot clips */
} ECLIP;

typedef struct {
  FIX    play_time;
  INT16  num_frames;
  INT16  frames[MAX_CLIP_FRAMES];
  INT16  open_sound;
  INT16  close_sound;
  INT16  flags;
  char   filename[13];
  char   pad;
} WCLIP;

/*describes a list of joint positions */
typedef struct {
  INT16  n_joints;
  INT16  offset;
} JOINTLIST;

typedef struct {
  INT32       model_num;               /* which polygon model? */
  VMS_VECTOR  gun_points[MAX_GUNS];    /* where each gun model is */
  UINT8       gun_submodels[MAX_GUNS]; /* which submodel is each gun in? */
  INT16       exp1_vclip_num;
  INT16       exp1_sound_num;
  INT16       exp2_vclip_num;
  INT16       exp2_sound_num;
  INT8        weapon_type;
  INT8        weapon_type2;         /* Secondary weapon number, -1 means none, */
                                    /* otherwise gun #0 fires this weapon. */
  INT8        n_guns;               /* how many different gun positions */
  INT8        contains_id;          /* ID of powerup this robot can contain. */
  INT8        contains_count;       /* Max number of things this instance can */
                                    /* contain. */
  INT8        contains_prob;        /* Probability that this instance will */
                                    /* contain something in N/16 */
  INT8        contains_type;        /* Type of thing contained, robot or */
                                    /* powerup, in bitmaps.tbl, !0=robot, */
                                    /* 0=powerup */
  INT8        kamikaze;             /* !0 means commits suicide when hits you, */
                                    /* strength thereof. 0 means no. */
  INT16       score_value;          /* Score from this robot. */
  INT8        badass;               /* Dies with badass explosion, and strength */
                                    /* thereof, 0 means NO. */
  INT8        energy_drain;         /* Points of energy drained at each */
                                    /* collision. */
  FIX         lighting;             /* should this be here or with polygon */
                                    /* model? */
  FIX         strength;             /* Initial shields of robot */
  FIX         mass;                 /* how heavy is this thing? */
  FIX         drag;                 /* how much drag does it have? */
  FIX         field_of_view[NDL];   /* compare this value with */
                                    /* forward_vector.dot.vector_to_player, */
                                    /* ..if field_of_view <, then robot can */
                                    /* see player */
  FIX         firing_wait[NDL];     /* time in seconds between shots */
  FIX         firing_wait2[NDL];    /* time in seconds between shots */
  FIX         turn_time[NDL];       /* time in seconds to rotate 360 degrees */
                                    /* in a dimension */
  FIX         max_speed[NDL];       /* maximum speed attainable by this robot */
  FIX         circle_distance[NDL]; /* distance at which robot circles player */
  INT8        rapidfire_count[NDL]; /* number of shots fired rapidly */
  INT8        evade_speed[NDL];     /* rate at which robot can evade shots, */
                                    /* 0=none, 4=very fast */
  INT8        cloak_type;           /* 0=never, 1=always, 2=except-when-firing */
  INT8        attack_type;          /* 0=firing, 1=charge (like green guy) */
  UINT8       see_sound;            /* sound robot makes when it first sees the */
                                    /* player */
  UINT8       attack_sound;         /* sound robot makes when it attacks the */
                                    /* player */
  UINT8       claw_sound;           /* sound robot makes as it claws you */
                                    /* (attack_type should be 1) */
  UINT8       taunt_sound;          /* sound robot makes after you die */
  INT8        boss_flag;            /* 0 = not boss, 1 = boss.  Is that? */
  INT8        companion;            /* Companion robot, leads you to things. */
  INT8        smart_blobs;          /* how many smart blobs are emitted when */
                                    /* this guy dies! */
  INT8        energy_blobs;         /* how many smart blobs are emitted when */
                                    /* this guy gets hit by energy weapon! */
  INT8        thief;                /* !0 means this guy can steal when he */
                                    /* collides with you! */
  INT8        pursuit;              /* !0 means pursues player after he goes */
                                    /* around a corner. */
                                    /* ..4 = 4/2 pursue up to 4/2 seconds */
                                    /* after becoming invisible if up to 4 */
                                    /* ..segments away */
  INT8        lightcast;            /* Amount of light cast. 1 is default. */
                                    /* 10 is very large. */
  INT8        death_roll;           /* 0 = dies without death roll. !0 means */
                                    /* does death roll, larger = faster */
                                    /* ..and louder */
  UINT8       flags;                /* misc properties */
                                    /* (boss_flag, companion, thief, & pursuit */
                                    /* probably should also be bits in flags) */
  UINT8       pad[3];               /* alignment */
  UINT8       deathroll_sound;      /* if has deathroll, what sound? */
  UINT8       glow;                 /* apply this light to robot itself. */
                                    /* stored as 4:4 FIXed-point */
  UINT8       behavior;             /* Default behavior. */
  UINT8       aim;                  /* 255 = perfect, less = more likely */
                                    /* to miss.  0 != random, would look stupid. */
                                    /* ..0=45 degree spread.  Specify in */
                                    /* bitmaps.tbl in range 0.0..1.0 */

  JOINTLIST   anim_states[MAX_GUNS+1][N_ANIM_STATES];

  INT32       always_0xabcd;        /* debugging */
} ROBOT_INFO;

typedef struct {
  INT16       jointnum;
  VMS_ANGVEC  angles;
} JOINTPOS;

typedef struct {
  INT8         render_type;     /* How to draw 0=laser, 1=blob, 2=object */
  INT8         persistent;      /* 0 = dies when it hits something,  */
                                /* = continues (eg, fusion cannon) */
  INT16        model_num;       /* Model num if rendertype==2. */
  INT16        model_num_inner; /* Model num of inner part if rendertype==2. */
  INT8         flash_vclip;     /* What vclip to use for muzzle flash */
  INT8         robot_hit_vclip; /* What vclip for impact with robot */
  INT16        flash_sound;     /* What sound to play when fired */
  INT8         wall_hit_vclip;  /* What vclip for impact with wall */
  INT8         fire_count;      /* Number of bursts fired from EACH GUN */
                                /* per firing. */
                                /* ..For weapons which fire from both */
                                /* sides, 3*fire_count shots will be fired. */
  INT16        robot_hit_sound; /* What sound for impact with robot */
  INT8         ammo_usage;      /* How many units of ammunition it uses. */
  INT8         weapon_vclip;    /* Vclip to render for the weapon, itself. */
  INT16        wall_hit_sound;  /* What sound for impact with wall */
  INT8         destroyable;     /* If !0, this weapon can be destroyed by */
                                /* another weapon. */
  INT8         matter;          /* Flag: set if this object is matter */
                                /* (as opposed to energy) */
  INT8         bounce;          /* 1==always bounces, 2=bounces twice */
  INT8         homing_flag;     /* Set if this weapon can home in on a target. */
  UINT8        speedvar;        /* allowed variance in speed below average, */
                                /* /128: 64 = 50% meaning if speed = 100, */
                                /* ..can be 50..100 */
  UINT8        flags;           /* */
  INT8         flash;           /* Flash effect */
  INT8         afterburner_size;/* Size of blobs in F1_0/16 units, specify */
                                /* in bitmaps.tbl as floating point. */
                                /* ..Player afterburner size = 2.5. */
  INT8         children;        /* ID of weapon to drop if this contains */
                                /* children.  -1 means no children. */
  FIX          energy_usage;    /* How much fuel is consumed to fire this */
                                /* weapon. */
  FIX          fire_wait;          /* Time until this weapon can be fired */
                                   /* again. */
  FIX          multi_damage_scale; /* Scale damage by this amount when */
                                   /* applying to player in multiplayer. */
                                   /* ..F1_0 means no change. */
  BITMAP_INDEX bitmap;          /* Pointer to bitmap if rendertype==0 or 1. */
  FIX          blob_size;       /* Size of blob if blob type */
  FIX          flash_size;      /* How big to draw the flash */
  FIX          impact_size;     /* How big of an impact */
  FIX          strength[NDL];   /* How much damage it can inflict */
  FIX          speed[NDL];      /* How fast it can move, difficulty */
                                /* level based. */
  FIX          mass;            /* How much mass it has */
  FIX          drag;            /* How much drag it has */
  FIX          thrust;                /* How much thrust it has */
  FIX          po_len_to_width_ratio; /* For polyobjects, the ratio of */
                                      /*len/width. (10 maybe?) */
  FIX          light;           /* Amount of light this weapon casts. */
  FIX          lifetime;        /* Lifetime in seconds of this weapon. */
  FIX          damage_radius;   /* Radius of damage caused by weapon, used */
                                /* for missiles (not lasers) to apply */
                                /* ..to damage to things it did not hit */
  BITMAP_INDEX picture;         /* a picture of the weapon for the cockpit */
  BITMAP_INDEX hires_picture;   /* a hires picture of the above */
} WEAPON_INFO;

typedef struct {
  INT32  vclip_num;
  INT32  hit_sound;
  FIX    size;        /* 3d size of longest dimension */
  FIX    light;       /* amount of light cast by this powerup,  */
                      /* set in bitmaps.tbl */
} POWERUP_TYPE_INFO;

typedef struct {
  INT32      n_models;
  INT32      model_data_size;
  UINT8      *model_data;
  INT32      submodel_ptrs[MAX_SUBMODELS];
  VMS_VECTOR submodel_offsets[MAX_SUBMODELS];
  VMS_VECTOR submodel_norms[MAX_SUBMODELS];   /* norm for sep plane */
  VMS_VECTOR submodel_pnts[MAX_SUBMODELS];    /* point on sep plane */
  FIX        submodel_rads[MAX_SUBMODELS];    /* radius for each submodel */
  UINT8      submodel_parents[MAX_SUBMODELS]; /* what is parent for each  */
                                              /* submodel */
  VMS_VECTOR submodel_mins[MAX_SUBMODELS];
  VMS_VECTOR submodel_maxs[MAX_SUBMODELS];
  VMS_VECTOR mins,maxs;                       /* min,max for whole model */
  FIX        rad;
  UINT8      n_textures;
  UINT16     first_texture;
  UINT8      simpler_model;           /* alternate model with less detail */
                                      /* (0 if none, model_num+1 else) */
} POLYMODEL;

typedef struct {
  UINT32     model_num;
  UINT32     n_guns;
  VMS_VECTOR gun_points[MAX_CONTROLCEN_GUNS];
  VMS_VECTOR gun_dirs[MAX_CONTROLCEN_GUNS];
} REACTOR;

typedef struct {
  UINT32     model_num;
  UINT32     expl_vclip_num;
  FIX        mass;
  FIX        drag;
  FIX        max_thrust;
  FIX        reverse_thrust;
  FIX        brakes;
  FIX        wiggle;
  FIX        max_rotthrust;
  VMS_VECTOR gun_points[N_PLAYER_GUNS];
} PLAYER_SHIP;

 

 

All pages (C) 1996-2000 Descent Network Team
Everything taken from the Descent, FreeSpace, Red Faction and Summoner series games are
Copyright Interplay Productions , THQ Inc. , Parallax Software , Volition Inc. and/or Outrage Entertainment