home *** CD-ROM | disk | FTP | other *** search
/ Amiga ACS 1998 #6 / amigaacscoverdisc1998-061998.iso / games / descent / source / main / weapon.h < prev    next >
Text File  |  1998-06-08  |  10KB  |  282 lines

  1. /*
  2. THE COMPUTER CODE CONTAINED HEREIN IS THE SOLE PROPERTY OF PARALLAX
  3. SOFTWARE CORPORATION ("PARALLAX").  PARALLAX, IN DISTRIBUTING THE CODE TO
  4. END-USERS, AND SUBJECT TO ALL OF THE TERMS AND CONDITIONS HEREIN, GRANTS A
  5. ROYALTY-FREE, PERPETUAL LICENSE TO SUCH END-USERS FOR USE BY SUCH END-USERS
  6. IN USING, DISPLAYING,  AND CREATING DERIVATIVE WORKS THEREOF, SO LONG AS
  7. SUCH USE, DISPLAY OR CREATION IS FOR NON-COMMERCIAL, ROYALTY OR REVENUE
  8. FREE PURPOSES.  IN NO EVENT SHALL THE END-USER USE THE COMPUTER CODE
  9. CONTAINED HEREIN FOR REVENUE-BEARING PURPOSES.  THE END-USER UNDERSTANDS
  10. AND AGREES TO THE TERMS HEREIN AND ACCEPTS THE SAME BY USE OF THIS FILE.  
  11. COPYRIGHT 1993-1998 PARALLAX SOFTWARE CORPORATION.  ALL RIGHTS RESERVED.
  12. */
  13. /*
  14.  * $Source: f:/miner/source/main/rcs/weapon.h $
  15.  * $Revision: 2.0 $
  16.  * $Author: john $
  17.  * $Date: 1995/02/27 11:31:10 $
  18.  * 
  19.  * Protypes for weapon stuff.
  20.  * 
  21.  * $Log: weapon.h $
  22.  * Revision 2.0  1995/02/27  11:31:10  john
  23.  * New version 2.0, which has no anonymous unions, builds with
  24.  * Watcom 10.0, and doesn't require parsing BITMAPS.TBL.
  25.  * 
  26.  * Revision 1.44  1995/01/30  17:14:18  mike
  27.  * halve rate of vulcan ammo consumption.
  28.  * 
  29.  * Revision 1.43  1995/01/19  17:45:04  mike
  30.  * damage_force removed, that information coming from strength field.
  31.  * 
  32.  * Revision 1.42  1995/01/05  15:46:11  john
  33.  * Made weapons not rearm when starting a saved game.
  34.  * 
  35.  * Revision 1.41  1995/01/04  12:20:27  john
  36.  * Declearations to work better with game state save.
  37.  * 
  38.  * 
  39.  * Revision 1.40  1994/12/13  12:54:16  mike
  40.  * fix proximity, homing flags, backwards!
  41.  * 
  42.  * Revision 1.39  1994/12/11  16:17:57  mike
  43.  * change default weapon life so shots from ctrlcen on level 6 won't evaporate before they hit you.
  44.  * 
  45.  * Revision 1.38  1994/12/09  19:55:26  matt
  46.  * Added weapon name in "not available in shareware" message
  47.  * 
  48.  * Revision 1.37  1994/12/07  12:55:27  mike
  49.  * tweak vulcan amounts.
  50.  * 
  51.  * Revision 1.36  1994/12/03  19:03:56  matt
  52.  * Fixed vulcan ammo HUD message
  53.  * 
  54.  * Revision 1.35  1994/12/02  15:05:02  matt
  55.  * Fixed bogus weapon constants and arrays
  56.  * 
  57.  * Revision 1.34  1994/11/29  14:26:05  john
  58.  * Again.
  59.  * 
  60.  * Revision 1.33  1994/11/29  14:13:47  adam
  61.  * Changed the byte flash sound to short.
  62.  * 
  63.  * Revision 1.32  1994/11/12  16:36:55  mike
  64.  * default ammo stuff.
  65.  * 
  66.  * Revision 1.31  1994/10/21  10:55:24  adam
  67.  * upped MAX_WEAPON_TYPES to 30
  68.  * 
  69.  * Revision 1.30  1994/10/19  11:16:37  mike
  70.  * Limit ammo amounts.
  71.  * 
  72.  * Revision 1.29  1994/10/12  08:05:04  mike
  73.  * Clean up homing/proximity mess.
  74.  * 
  75.  * Revision 1.28  1994/10/08  23:37:53  matt
  76.  * Don't pick up weapons you already have; also fixed auto_select bug
  77.  * for seconary weapons
  78.  * 
  79.  * Revision 1.27  1994/10/07  23:37:56  matt
  80.  * Made weapons select when pick up better one
  81.  * 
  82.  * Revision 1.26  1994/10/07  16:02:17  matt
  83.  * Fixed problem with weapon auto-select
  84.  * 
  85.  * Revision 1.25  1994/10/05  17:07:44  matt
  86.  * Made player_has_weapon() public and moved constants to header file
  87.  * 
  88.  * Revision 1.24  1994/09/30  21:50:49  mike
  89.  * Add homing_flag and 3 dummy bytes to weapon_info.
  90.  * 
  91.  * Revision 1.23  1994/09/30  13:47:41  mike
  92.  * Make speed and strength be difficulty level based.
  93.  * 
  94.  * Revision 1.22  1994/09/20  16:10:13  mike
  95.  * Prototype Primary_weapon_names and Secondary_weapon_names.
  96.  * 
  97.  * Revision 1.21  1994/09/20  12:17:21  adam
  98.  * upped weapon types
  99.  * 
  100.  * Revision 1.20  1994/09/13  16:40:29  mike
  101.  * Define REARM_TIME -- time it takes until you can fire a newly armed weapon.
  102.  * 
  103.  * Revision 1.19  1994/09/13  14:43:03  matt
  104.  * Added cockpit weapon displays
  105.  * 
  106.  * Revision 1.18  1994/09/11  15:50:34  mike
  107.  * Add matter and bounce to weapon_info.
  108.  * 
  109.  * Revision 1.17  1994/09/10  17:32:17  mike
  110.  * Add thrust to weapon_info.
  111.  * 
  112.  * Revision 1.16  1994/09/09  20:04:54  mike
  113.  * Add vclips for weapons.
  114.  * 
  115.  * Revision 1.15  1994/09/07  15:59:14  mike
  116.  * Add default lifetimes to weapons, destroyable, lifetime, damage_radius, damage_force fields to weapons.
  117.  * 
  118.  * Revision 1.14  1994/09/03  15:18:06  mike
  119.  * Add prototype for auto_select_weapon.
  120.  * 
  121.  * Revision 1.13  1994/09/02  16:38:33  mike
  122.  * Move data from global arrays to Weapon_info.
  123.  * 
  124.  * Revision 1.12  1994/09/02  11:54:59  mike
  125.  * Add a whole slew of constants for the whole slew of new weapons.
  126.  * 
  127.  * Revision 1.11  1994/08/23  16:39:15  mike
  128.  * Add light to weapon struct
  129.  * 
  130.  */
  131.  
  132. #ifndef _WEAPON_H
  133. #define _WEAPON_H
  134.  
  135. #include "inferno.h"
  136. #include "gr.h"
  137. #include "game.h"
  138. #include "piggy.h"
  139.  
  140. typedef struct weapon_info {
  141.     byte    render_type;                // How to draw 0=laser, 1=blob, 2=object
  142.     byte    model_num;                    // Model num if rendertype==2.
  143.     byte    model_num_inner;            // Model num of inner part if rendertype==2.
  144.     byte    persistent;                    //    0 = dies when it hits something, 1 = continues (eg, fusion cannon)
  145.  
  146.     byte    flash_vclip;                // What vclip to use for muzzle flash
  147.     short    flash_sound;                // What sound to play when fired
  148.     byte    robot_hit_vclip;            // What vclip for impact with robot
  149.     short    robot_hit_sound;            // What sound for impact with robot
  150.  
  151.     byte    wall_hit_vclip;            // What vclip for impact with wall
  152.     short    wall_hit_sound;            // What sound for impact with wall
  153.     byte    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.
  154.     byte    ammo_usage;                    //    How many units of ammunition it uses.
  155.  
  156.     byte    weapon_vclip;                //    Vclip to render for the weapon, itself.
  157.     byte    destroyable;                //    If !0, this weapon can be destroyed by another weapon.
  158.     byte    matter;                        //    Flag: set if this object is matter (as opposed to energy)
  159.     byte    bounce;                        //    Flag: set if this object bounces off walls
  160.  
  161.     byte    homing_flag;                //    Set if this weapon can home in on a target.
  162.     byte    dum1, dum2, dum3;
  163.  
  164.     fix    energy_usage;                //    How much fuel is consumed to fire this weapon.
  165.     fix    fire_wait;                    //    Time until this weapon can be fired again.
  166.  
  167.     bitmap_index bitmap;                // Pointer to bitmap if rendertype==0 or 1.
  168.  
  169.     fix    blob_size;                    // Size of blob if blob type
  170.     fix    flash_size;                    // How big to draw the flash
  171.     fix    impact_size;                // How big of an impact
  172.     fix    strength[NDL];                // How much damage it can inflict
  173.     fix    speed[NDL];                    // How fast it can move, difficulty level based.
  174.     fix    mass;                            // How much mass it has
  175.     fix    drag;                            // How much drag it has
  176.     fix    thrust;                        //    How much thrust it has
  177.     fix    po_len_to_width_ratio;    // For polyobjects, the ratio of len/width. (10 maybe?)
  178.     fix    light;                        //    Amount of light this weapon casts.
  179.     fix    lifetime;                    //    Lifetime in seconds of this weapon.
  180.     fix    damage_radius;                //    Radius of damage caused by weapon, used for missiles (not lasers) to apply to damage to things it did not hit
  181. //-- unused--    fix    damage_force;                //    Force of damage caused by weapon, used for missiles (not lasers) to apply to damage to things it did not hit
  182. // damage_force was a real mess.  Wasn't Difficulty_level based, and was being applied instead of weapon's actual strength.  Now use 2*strength instead. --MK, 01/19/95
  183.     bitmap_index    picture;                // a picture of the weapon for the cockpit
  184. } weapon_info;
  185.  
  186. #define    REARM_TIME                    (F1_0)
  187.  
  188. #define    WEAPON_DEFAULT_LIFETIME    (F1_0*12)    //    Lifetime of an object if a bozo forgets to define it.
  189.  
  190. #define WEAPON_TYPE_WEAK_LASER    0
  191. #define WEAPON_TYPE_STRONG_LASER    1
  192. #define WEAPON_TYPE_CANNON_BALL    2
  193. #define WEAPON_TYPE_MISSILE        3
  194. #define MAX_WEAPON_TYPES             30
  195.  
  196. #define WEAPON_RENDER_NONE            -1
  197. #define WEAPON_RENDER_LASER        0
  198. #define WEAPON_RENDER_BLOB            1
  199. #define WEAPON_RENDER_POLYMODEL    2
  200. #define WEAPON_RENDER_VCLIP        3
  201.  
  202. #define    MAX_PRIMARY_WEAPONS        5
  203. #define    MAX_SECONDARY_WEAPONS    5
  204.  
  205. //    Weapon flags, if player->weapon_flags & WEAPON_FLAG is set, then the player has this weapon
  206. #define    HAS_LASER_FLAG                0x001
  207. #define    HAS_VULCAN_FLAG            0x002
  208. #define    HAS_SPREADFIRE_FLAG        0x004
  209. #define    HAS_PLASMA_FLAG            0x008
  210. #define    HAS_FUSION_FLAG            0x010
  211.  
  212. #define    HAS_CONCUSSION_FLAG        0x001
  213. #define    HAS_HOMING_FLAG            0x002
  214. #define    HAS_PROXIMITY_FLAG        0x004
  215. #define    HAS_SMART_FLAG                0x008
  216. #define    HAS_MEGA_FLAG                0x010
  217.  
  218. #define    CLASS_PRIMARY                0
  219. #define    CLASS_SECONDARY            1
  220.  
  221. #define    LASER_INDEX                    0
  222. #define    VULCAN_INDEX                1
  223. #define    SPREADFIRE_INDEX            2
  224. #define    PLASMA_INDEX                3
  225. #define    FUSION_INDEX                4
  226.  
  227. #define    CONCUSSION_INDEX            0
  228. #define    HOMING_INDEX                1
  229. #define    PROXIMITY_INDEX            2
  230. #define    SMART_INDEX                    3
  231. #define    MEGA_INDEX                    4
  232.  
  233. #define    NUM_SHAREWARE_WEAPONS    3        //in shareware, old get first 3 of each
  234.  
  235. #define    VULCAN_AMMO_SCALE        (0x198300/2)        //multiply ammo by this before displaying
  236.  
  237. extern weapon_info Weapon_info[];
  238. extern int N_weapon_types;
  239. extern void do_weapon_select(int weapon_num, int secondary_flag);
  240. extern void show_weapon_status(void);
  241.  
  242. extern byte    Primary_weapon, Secondary_weapon;
  243.  
  244. extern ubyte Primary_weapon_to_weapon_info[MAX_PRIMARY_WEAPONS];
  245. extern ubyte Secondary_weapon_to_weapon_info[MAX_SECONDARY_WEAPONS];
  246. extern void auto_select_weapon(int weapon_type);        //parm is primary or secondary
  247. extern select_weapon(int weapon_num, int secondary_flag, int print_message,int wait_for_rearm);
  248.  
  249. extern char    *Primary_weapon_names_short[];
  250. extern char    *Secondary_weapon_names_short[];
  251. extern char    *Primary_weapon_names[];
  252. extern char    *Secondary_weapon_names[];
  253. extern int    Primary_ammo_max[MAX_PRIMARY_WEAPONS];
  254. extern ubyte    Secondary_ammo_max[MAX_PRIMARY_WEAPONS];
  255.  
  256. #define    HAS_WEAPON_FLAG    1
  257. #define    HAS_ENERGY_FLAG    2
  258. #define    HAS_AMMO_FLAG        4
  259. #define  HAS_ALL (HAS_WEAPON_FLAG|HAS_ENERGY_FLAG|HAS_AMMO_FLAG)
  260.  
  261. //    ------------------------------------------------------------------------------------
  262. //    Return:
  263. // Bits set:
  264. //        HAS_WEAPON_FLAG
  265. //        HAS_ENERGY_FLAG
  266. //        HAS_AMMO_FLAG    
  267. extern int player_has_weapon(int weapon_num, int secondary_flag);
  268.  
  269. //called when one of these weapons is picked up
  270. //when you pick up a secondary, you always get the weapon & ammo for it
  271. pick_up_secondary(int weapon_index,int count);
  272.  
  273. //called when a primary weapon is picked up
  274. //returns true if actually picked up
  275. int pick_up_primary(int weapon_index);
  276.  
  277. //called when ammo (for the vulcan cannon) is picked up
  278. pick_up_ammo(int class_flag,int weapon_index,int ammo_count);
  279.  
  280. #endif
  281. 
  282.