3 #define AMMO(type, mm, rounds, price) [type] = { mm, rounds, price }
5 const struct ammo ammunition
[] = {
6 AMMO(AMMO_45ACP
, MM(2.54 * .45), 100, 65),
7 AMMO(AMMO_9MMPARABELLUM
, MM(9), 100, 60),
8 AMMO(AMMO_556
, 556, 100, 50),
9 AMMO(AMMO_762
, 762, 100, 55),
10 AMMO(AMMO_10MM
, MM(10), 100, 80),
11 AMMO(AMMO_ROCKET83MM
, MM(83), 1, 1400),
12 AMMO(AMMO_ROCKET40MM
, MM(40), 1, 1300),
13 AMMO(AMMO_K200GRENADE40MM
, MM(40), 1, 200),
14 AMMO(AMMO_GAS
, MM(0), 50, 500),
15 AMMO(AMMO_GRENADE
, MM(0), 5, 250),
20 #define WEAP(id, bullspeed, _rpm, _range, _ammo, _price, _flags, _sound, _shot) \
22 .bullet_speed = bullspeed, .rpm = _rpm, .range = _range, \
23 .ammo = _ammo, .price = _price, .flags = _flags, .sound = _sound, \
26 #define RANGE(x) (x/100)
27 const struct weapon weapons
[] = {
28 WEAP(WP_COLT45
, 1.75, RPM(200), RANGE(200), AMMO_45ACP
, 100, WF_MUZZLEFLASH
, WS_PISTOL
, ST_BULLET
),
29 WEAP(WP_BROWNING
, 1.75, RPM(200), RANGE(200), AMMO_45ACP
, 110, WF_MUZZLEFLASH
, WS_PISTOL
, ST_BULLET
),
30 WEAP(WP_SA80
, 3, RPM(800), RANGE(500), AMMO_556
, 1400, WF_AUTOMATIC
| WF_MUZZLEFLASH
, WS_GUN
, ST_BULLET
),
31 WEAP(WP_MP5
, 5, RPM(800), RANGE(200), AMMO_9MMPARABELLUM
, 800, WF_AUTOMATIC
| WF_MUZZLEFLASH
, WS_MACHINEGUN
, ST_BULLET
),
32 WEAP(WP_UZI
, 5, RPM(600), RANGE(200), AMMO_9MMPARABELLUM
, 700, WF_AUTOMATIC
| WF_MUZZLEFLASH
, WS_MACHINEGUN
, ST_BULLET
),
33 WEAP(WP_STEYR
, 4, RPM(650), RANGE(300), AMMO_556
, 1500, WF_AUTOMATIC
| WF_MUZZLEFLASH
, WS_GUN
, ST_BULLET
),
34 WEAP(WP_AK47
, 5, RPM(600), RANGE(400), AMMO_556
, 800, WF_AUTOMATIC
| WF_MUZZLEFLASH
, WS_GUN
, ST_BULLET
),
35 WEAP(WP_M16A2
, 4, RPM(600), RANGE(400), AMMO_556
, 900, WF_AUTOMATIC
| WF_MUZZLEFLASH
, WS_GUN
, ST_BULLET
),
36 WEAP(WP_M203
, 4, RPM(600), RANGE(400), AMMO_556
, 1500, WF_AUTOMATIC
| WF_MUZZLEFLASH
, WS_GUN
, ST_BULLET
),
37 WEAP(WP_RPK
, 4, RPM(600), RANGE(800), AMMO_762
, 4900, WF_AUTOMATIC
| WF_MUZZLEFLASH
, WS_GUN
, ST_BULLET
),
38 WEAP(WP_L7A2
, 6, RPM(850), RANGE(1200), AMMO_762
, 5700, WF_AUTOMATIC
| WF_MUZZLEFLASH
, WS_MACHINEGUN
, ST_BULLET
),
39 WEAP(WP_HK21
, 8, RPM(900), RANGE(1200), AMMO_762
, 7800, WF_AUTOMATIC
| WF_MUZZLEFLASH
, WS_MACHINEGUN
, ST_BULLET
),
40 WEAP(WP_M60
, 4, RPM(550), RANGE(1000), AMMO_762
, 6200, WF_AUTOMATIC
| WF_MUZZLEFLASH
, WS_GUN
, ST_BULLET
),
41 WEAP(WP_MG42
, 12, RPM(1200), RANGE(2000), AMMO_762
, 7000, WF_AUTOMATIC
| WF_MUZZLEFLASH
, WS_MACHINEGUN
, ST_BULLET
),
42 WEAP(WP_M134
, 10, RPM(3000), RANGE(2000), AMMO_10MM
, 10400, WF_AUTOMATIC
| WF_MUZZLEFLASH
, WS_MACHINEGUN
, ST_BULLET
),
43 WEAP(WP_RPG7
, 2.5, RPM(0), RANGE(300), AMMO_ROCKET40MM
, 2600, 0, WS_NONE
, ST_LAUNCHER
),
44 WEAP(WP_LAW
, 2.5, RPM(0), RANGE(400), AMMO_INVALID
, 2900, 0, WS_NONE
, ST_LAUNCHER
), // comes with a single rocket preloaded, not reloadable
45 WEAP(WP_MAW
, 2.5, RPM(0), RANGE(500), AMMO_ROCKET83MM
, 2100, 0, WS_NONE
, ST_LAUNCHER
),
46 WEAP(WP_ABC
, 2, RPM(800), RANGE(100), AMMO_GAS
, 9900, WF_AUTOMATIC
, WS_FLAMETHROWER
, ST_FLAMES
),
47 WEAP(WP_GRENADES
, 1.75, RPM(0), RANGE(100), AMMO_GRENADE
, 50, 0, WS_NONE
, ST_GRENADE
),
51 // range 200 entspricht ca 128 pix
52 // range 400 - " - 235 pix
53 // range 500, 800 ebenso
54 // range 1000+ entspricht der diagonale von einem eck zum andern
56 #define WEAPN(x) [x] = #x
57 #define STR(x, y) [x] = y
58 static const char *weapon_names
[] = {
59 STR(WP_COLT45
, "COLT.45"),
60 STR(WP_BROWNING
, "BROWNING HP"),
64 STR(WP_STEYR
, "STEYR AUG"),
67 STR(WP_M203
, "M16+M203"),
73 STR(WP_M134
, "M134 MINIGUN"),
74 STR(WP_RPG7
, "RPG-7"),
77 STR(WP_ABC
, "FLAME THROWER"),
78 STR(WP_GRENADES
, "APG"),
81 const char* weapon_name(enum weapon_id id
) {
82 if(id
>= WP_MAX
) return 0;
83 return weapon_names
[id
];
86 static const char *ammo_names
[] = {
87 STR(AMMO_45ACP
, ".45 ACP"),
88 STR(AMMO_9MMPARABELLUM
, "9MM PAR"),
89 STR(AMMO_556
, "5.54"),
90 STR(AMMO_762
, "7.62"),
91 STR(AMMO_10MM
, "MINIGUN"),
92 STR(AMMO_ROCKET83MM
, "MAW"),
93 STR(AMMO_ROCKET40MM
, "RPG7"),
94 STR(AMMO_K200GRENADE40MM
, "M203"),
96 STR(AMMO_GRENADE
, "APG"),
99 const char* ammo_name(enum ammo_id id
) {
100 if(id
>= AMMO_MAX
) return 0;
101 return ammo_names
[id
];