1 //-------------------------------------------------------------------------
2 /*
3 Copyright (C) 1997, 2005 - 3D Realms Entertainment
4 
5 This file is part of Shadow Warrior version 1.2
6 
7 Shadow Warrior is free software; you can redistribute it and/or
8 modify it under the terms of the GNU General Public License
9 as published by the Free Software Foundation; either version 2
10 of the License, or (at your option) any later version.
11 
12 This program is distributed in the hope that it will be useful,
13 but WITHOUT ANY WARRANTY; without even the implied warranty of
14 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
15 
16 See the GNU General Public License for more details.
17 
18 You should have received a copy of the GNU General Public License
19 along with this program; if not, write to the Free Software
20 Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
21 
22 Original Source: 1997 - Frank Maddin and Jim Norwood
23 Prepared for public release: 03/28/2005 - Charlie Wiederhold, 3D Realms
24 */
25 //-------------------------------------------------------------------------
26 
27 #ifndef WEAPON_H
28 #define WEAPON_H
29 
30 #define NEW_ELECTRO 1
31 #define HORIZ_MULT 128L
32 
33 #define ANG2PLAYER(pp,sp) (getangle((pp)->posx - (sp)->x, (pp)->posy - (sp)->y))
34 #define ANG2SPRITE(sp,op) (getangle((sp)->x - (op)->x, (sp)->y - (op)->y))
35 
36 #define MAX_HOLE_QUEUE 64
37 #define MAX_STAR_QUEUE 32
38 #define MAX_WALLBLOOD_QUEUE  32
39 #define MAX_FLOORBLOOD_QUEUE 32
40 #define MAX_GENERIC_QUEUE 32
41 #define MAX_LOWANGS_QUEUE 16
42 
43 //#define NUKE_RADIUS 16384
44 #define NUKE_RADIUS 30000
45 #define RAIL_RADIUS 3500
46 
47 // This is how many bullet shells have been spawned since the beginning of the game.
48 extern FOOT_TYPE FootMode;
49 extern int ShellCount;
50 #define MAXSHELLS 32
51 
52 extern short StarQueueHead;
53 extern short StarQueue[MAX_STAR_QUEUE];
54 extern short HoleQueueHead;
55 extern short HoleQueue[MAX_HOLE_QUEUE];
56 extern short WallBloodQueueHead;
57 extern short WallBloodQueue[MAX_WALLBLOOD_QUEUE];
58 extern short FloorBloodQueueHead;
59 extern short FloorBloodQueue[MAX_FLOORBLOOD_QUEUE];
60 extern short GenericQueueHead;
61 extern short GenericQueue[MAX_GENERIC_QUEUE];
62 extern short LoWangsQueueHead;
63 extern short LoWangsQueue[MAX_LOWANGS_QUEUE];
64 
65 VOID ChangeState(short SpriteNum, STATEp statep);
66 void DoPlayerBeginRecoil(PLAYERp pp, short pix_amt);
67 SECTOR_OBJECTp DetectSectorObject(SECTORp);
68 SECTOR_OBJECTp DetectSectorObjectByWall(WALLp);
69 VOID ScaleSpriteVector(short SpriteNum, int scale);
70 int QueueHole(short ang, short hitsect, short hitwall, int hitx, int hity, int hitz);
71 int QueueWallBlood(short hitsprite,short ang);
72 BOOL SlopeBounce(short SpriteNum, BOOL *hitwall);
73 BOOL HitscanSpriteAdjust(short SpriteNum, short hitwall);
74 int SpawnSwordSparks(PLAYERp pp, short hitsect, short hitwall, int hitx, int hity, int hitz, short hitang);
75 int SpawnBubble(short SpriteNum);
76 int SpawnFireballExp(SHORT Weapon);
77 int SpawnFireballFlames(SHORT SpriteNum,SHORT enemy);
78 int SpawnRadiationCloud(short SpriteNum);
79 int SpawnGrenadeExp(SHORT Weapon);
80 int SpawnSectorExp(SHORT Weapon);
81 int DoShrapVelocity(SHORT SpriteNum);
82 int ShrapKillSprite(short SpriteNum);
83 BOOL MissileSetPos(short Weapon,ANIMATORp DoWeapon,int dist);
84 int ActorPain(short SpriteNum);
85 
86 //
87 // Damage Amounts defined in damage.h
88 //
89 extern DAMAGE_DATA DamageData[];
90 
91 // Damage Times - takes damage after this many tics
92 #define DAMAGE_BLADE_TIME       (10)
93 
94 // Player Missile Speeds
95 #define STAR_VELOCITY           (1800)
96 #define BOLT_VELOCITY           (900)
97 #define ROCKET_VELOCITY         (1350)
98 #define BOLT_SEEKER_VELOCITY    (820)
99 #define FIREBALL_VELOCITY       (2000)
100 #define ELECTRO_VELOCITY        (800)
101 #define PLASMA_VELOCITY         (1000)
102 #define UZI_BULLET_VELOCITY     (2500)
103 #define TRACER_VELOCITY         (1200)
104 #define TANK_SHELL_VELOCITY     (1200)
105 #define GRENADE_VELOCITY        (900)
106 #define MINE_VELOCITY           (520)   // Was 420
107 #define CHEMBOMB_VELOCITY       (420)
108 
109 // Player Spell Missile Speeds
110 #define BLOOD_WORM_VELOCITY   (800)
111 #define NAPALM_VELOCITY         (800)
112 #define MIRV_VELOCITY          (600)
113 #define SPIRAL_VELOCITY         (600)
114 
115 // Trap Speeds
116 #define BOLT_TRAP_VELOCITY      (950)
117 #define SPEAR_TRAP_VELOCITY     (650)
118 #define FIREBALL_TRAP_VELOCITY  (750)
119 
120 // NPC Missile Speeds
121 #define NINJA_STAR_VELOCITY     (1800)
122 #define NINJA_BOLT_VELOCITY     (500)
123 #define GORO_FIREBALL_VELOCITY  (800)
124 #define SKEL_ELECTRO_VELOCITY   (850)
125 #define COOLG_FIRE_VELOCITY     (400)
126 
127 #define GRENADE_RECOIL_AMT      (12)
128 #define ROCKET_RECOIL_AMT       (7)
129 #define RAIL_RECOIL_AMT       (7)
130 #define SHOTGUN_RECOIL_AMT      (12)
131 //#define MICRO_RECOIL_AMT        (15)
132 
133 // Damage amounts that determine the type of player death
134 // The standard flip over death is default
135 #define PLAYER_DEATH_CRUMBLE_DAMMAGE_AMT   (25)
136 #define PLAYER_DEATH_EXPLODE_DAMMAGE_AMT   (65)
137 
138 // electro weapon
139 #define ELECTRO_MAX_JUMP_DIST 25000
140 
141 extern int WeaponIsAmmo;
142 
143 #define MISSILEMOVETICS 6
144 
145 #define CLOSE_RANGE_DIST_FUDGE(sp1, sp2, fudge) \
146     (((int)(sp1)->clipdist<<2) + ((int)(sp2)->clipdist<<2) + (fudge))
147 
148 #define CLOSE_RANGE_DIST(sp1, sp2) CLOSE_RANGE_DIST_FUDGE(sp1, sp2, 400)
149 
150 
151 extern short target_ang;
152 
153 BOOL SpriteOverlap(short, short);
154 
155 int SpawnShotgunSparks(PLAYERp pp, short hitsect, short hitwall, int hitx, int hity, int hitz, short hitang);
156 int DoActorBeginSlide(short SpriteNum, short ang, short vel, short dec);
157 int GetOverlapSector(int x, int y, short *over, short *under);
158 BOOL MissileHitDiveArea(short SpriteNum);
159 
160 int DoDamageTest(short);
161 
162 extern short StatDamageList[STAT_DAMAGE_LIST_SIZE];
163 
164 #define RADIATION_CLOUD 3258
165 #define MUSHROOM_CLOUD 3280
166 extern STATE s_NukeMushroom[];
167 
168 VOID WallBounce(short SpriteNum, short ang);
169 
170 #define PUFF 1748
171 #define CALTROPS 2218
172 #define PHOSPHORUS 1397
173 
174 int PlayerInitChemBomb(PLAYERp pp);
175 int InitChemBomb(short SpriteNum);
176 int PlayerInitCaltrops(PLAYERp pp);
177 int InitBloodSpray(SHORT SpriteNum, BOOL dogib, short velocity);
178 int SpawnBunnyExp(SHORT Weapon);
179 int InitBunnyRocket(PLAYERp pp);
180 
181 int GetDamage(short SpriteNum, short Weapon, short DamageNdx);
182 int DoFlamesDamageTest(short Weapon);
183 
184 VOID DoActorSpawnIcon(SHORT SpriteNum);
185 
186 typedef struct
187     {
188     STATEp state;
189     short id, num, zlevel, min_jspeed, max_jspeed, min_vel, max_vel, random_disperse, ang_range;
190     // state, id, num, min_jspeed, max_jspeed, min_vel, max_vel, size,
191     // random_disperse, ang_range
192     } SHRAP, *SHRAPp;
193 
194 enum ShrapPos
195 {
196 Z_TOP,
197 Z_MID,
198 Z_BOT
199 };
200 
201 int SetSuicide(short SpriteNum);
202 VOID UpdateSinglePlayKills(short SpriteNum);
203 int InitPlasmaFountain(SPRITEp wp, SPRITEp sp);
204 int InitCoolgDrip(short SpriteNum);
205 int InitFireball(PLAYERp pp);
206 void InitSpellRing(PLAYERp pp);
207 void InitSpellNapalm(PLAYERp pp);
208 int InitUzi(PLAYERp pp);
209 int InitSobjGun(PLAYERp pp);
210 int InitBoltTrap(short SpriteNum);
211 int InitSpearTrap(short SpriteNum);
212 int InitTurretMgun(SECTOR_OBJECTp sop);
213 int InitVulcanBoulder(short SpriteNum);
214 int DoBladeDamage(short SpriteNum);
215 int DoFindGround(SHORT SpriteNum);
216 int DoFindGroundPoint(SHORT SpriteNum);
217 VOID SpriteQueueDelete(short SpriteNum);
218 int HelpMissileLateral(SHORT Weapon,int dist);
219 int AddSpriteToSectorObject(short SpriteNum,SECTOR_OBJECTp sop);
220 void QueueReset(void );
221 int PlayerCheckDeath(PLAYERp pp,short Weapon);
222 BOOL SpriteWarpToUnderwater(SPRITEp sp);
223 int PlayerDamageSlide(PLAYERp pp,short damage,short ang);
224 BOOL VehicleMoveHit(short SpriteNum);
225 int SpawnSplash(short SpriteNum);
226 int SpawnMineExp(SHORT Weapon);
227 int SpawnLittleExp(SHORT Weapon);
228 int SpawnLargeExp(SHORT Weapon);
229 int SpawnNuclearExp(SHORT Weapon);
230 int SpawnBoltExp(SHORT Weapon);
231 int SpawnTracerExp(SHORT Weapon);
232 int SpawnGoroFireballExp(SHORT Weapon);
233 BOOL MissileHitMatch(short Weapon,short WeaponNum,short hitsprite);
234 int DoItemFly(SHORT SpriteNum);
235 int SpawnVehicleSmoke(short SpriteNum);
236 short PrevWall(short wall_num);
237 int DoDamage(short SpriteNum,short Weapon);
238 
239 #endif
240