|
|
1.1 root 1: --- p_weapon.c Wed Apr 01 20:36:39 1998
2: +++ e:\Incoming\p_weapon.c Tue Apr 07 11:16:41 1998
3: @@ -11,7 +11,7 @@
4: void weapon_grenade_fire (edict_t *ent, qboolean held);
5:
6:
7: -static void P_ProjectSource (gclient_t *client, vec3_t point, vec3_t distance, vec3_t forward, vec3_t right, vec3_t result)
8: +void P_ProjectSource (gclient_t *client, vec3_t point, vec3_t distance, vec3_t forward, vec3_t right, vec3_t result)
9: {
10: vec3_t _distance;
11:
12: @@ -152,10 +152,28 @@
13: current
14: ===============
15: */
16: -void ChangeWeapon (edict_t *ent)
17: +
18: +// ### Hentai ### BEGIN
19: +void ShowGun(edict_t *ent)
20: {
21: - int i;
22: + char heldmodel[128];
23: + if(!ent->client->pers.weapon)
24: + {
25: + ent->s.modelindex2 = 0;
26: + return;
27: + }
28: +
29: + strcpy(heldmodel, "*"); // Zoid: is this a * or a #?
30: + strcat(heldmodel, ent->client->pers.weapon->icon);
31: + strcat(heldmodel, ".md2");
32: + //gi.dprintf ("%s\n", heldmodel);
33: + ent->s.modelindex2 = gi.modelindex(heldmodel); // Hentai's custom gun models
34: +
35: +}
36: +// ### Hentai ### END
37:
38: +void ChangeWeapon (edict_t *ent)
39: +{
40: if (ent->client->grenade_time)
41: {
42: ent->client->grenade_time = level.time;
43: @@ -169,22 +187,13 @@
44: ent->client->newweapon = NULL;
45: ent->client->machinegun_shots = 0;
46:
47: - // set visible model
48: - if (ent->s.modelindex == 255) {
49: - if (ent->client->pers.weapon)
50: - i = ((ent->client->pers.weapon->weapmodel & 0xff) << 8);
51: - else
52: - i = 0;
53: - ent->s.skinnum = (ent - g_edicts - 1) | i;
54: - }
55: -
56: if (ent->client->pers.weapon && ent->client->pers.weapon->ammo)
57: ent->client->ammo_index = ITEM_INDEX(FindItem(ent->client->pers.weapon->ammo));
58: else
59: ent->client->ammo_index = 0;
60:
61: - if (!ent->client->pers.weapon)
62: - { // dead
63: + if (!ent->client->pers.weapon || ent->s.modelindex != 255) // ### Hentai ###
64: + { // dead, or not on client, so VWep animations could do wacky things
65: ent->client->ps.gunindex = 0;
66: return;
67: }
68: @@ -193,6 +202,7 @@
69: ent->client->ps.gunframe = 0;
70: ent->client->ps.gunindex = gi.modelindex(ent->client->pers.weapon->view_model);
71:
72: + // ### Hentai ### BEGIN
73: ent->client->anim_priority = ANIM_PAIN;
74: if(ent->client->ps.pmove.pm_flags & PMF_DUCKED)
75: {
76: @@ -205,6 +215,10 @@
77: ent->client->anim_end = FRAME_pain304;
78:
79: }
80: +
81: + ShowGun(ent);
82: +
83: + // ### Hentai ### END
84: }
85:
86: /*
87: @@ -358,14 +372,12 @@
88: #define FRAME_IDLE_FIRST (FRAME_FIRE_LAST + 1)
89: #define FRAME_DEACTIVATE_FIRST (FRAME_IDLE_LAST + 1)
90:
91: -void Weapon_Generic (edict_t *ent, int FRAME_ACTIVATE_LAST, int FRAME_FIRE_LAST, int FRAME_IDLE_LAST, int FRAME_DEACTIVATE_LAST, int *pause_frames, int *fire_frames, void (*fire)(edict_t *ent))
92: +static void Weapon_Generic2 (edict_t *ent, int FRAME_ACTIVATE_LAST, int FRAME_FIRE_LAST, int FRAME_IDLE_LAST, int FRAME_DEACTIVATE_LAST, int *pause_frames, int *fire_frames, void (*fire)(edict_t *ent))
93: {
94: int n;
95:
96: - if(ent->deadflag || ent->s.modelindex != 255) // VWep animations screw up corpses
97: - {
98: - return;
99: - }
100: + if(ent->s.modelindex != 255) // ### Hentai ###
101: + return; // not on client, so VWep animations could do wacky things
102:
103: if (ent->client->weaponstate == WEAPON_DROPPING)
104: {
105: @@ -374,7 +386,8 @@
106: ChangeWeapon (ent);
107: return;
108: }
109: - else if ((FRAME_DEACTIVATE_LAST - ent->client->ps.gunframe) == 4)
110: + // ### Hentai ### BEGIN
111: + else if((FRAME_DEACTIVATE_LAST - ent->client->ps.gunframe) == 4)
112: {
113: ent->client->anim_priority = ANIM_REVERSE;
114: if(ent->client->ps.pmove.pm_flags & PMF_DUCKED)
115: @@ -389,6 +402,7 @@
116:
117: }
118: }
119: + // ### Hentai ### END
120:
121: ent->client->ps.gunframe++;
122: return;
123: @@ -411,8 +425,8 @@
124: {
125: ent->client->weaponstate = WEAPON_DROPPING;
126: ent->client->ps.gunframe = FRAME_DEACTIVATE_FIRST;
127: -
128: - if ((FRAME_DEACTIVATE_LAST - FRAME_DEACTIVATE_FIRST) < 4)
129: + // ### Hentai ### BEGIN
130: + if((FRAME_DEACTIVATE_LAST - FRAME_DEACTIVATE_FIRST) < 4)
131: {
132: ent->client->anim_priority = ANIM_REVERSE;
133: if(ent->client->ps.pmove.pm_flags & PMF_DUCKED)
134: @@ -427,6 +441,7 @@
135:
136: }
137: }
138: + // ### Hentai ### END
139: return;
140: }
141:
142: @@ -495,8 +510,14 @@
143: {
144: if (ent->client->ps.gunframe == fire_frames[n])
145: {
146: +//ZOID
147: + if (!CTFApplyStrengthSound(ent))
148: +//ZOID
149: if (ent->client->quad_framenum > level.framenum)
150: gi.sound(ent, CHAN_ITEM, gi.soundindex("items/damage3.wav"), 1, ATTN_NORM, 0);
151: +//ZOID
152: + CTFApplyHasteSound(ent);
153: +//ZOID
154:
155: fire (ent);
156: break;
157: @@ -511,6 +532,33 @@
158: }
159: }
160:
161: +//ZOID
162: +void Weapon_Generic (edict_t *ent, int FRAME_ACTIVATE_LAST, int FRAME_FIRE_LAST, int FRAME_IDLE_LAST, int FRAME_DEACTIVATE_LAST, int *pause_frames, int *fire_frames, void (*fire)(edict_t *ent))
163: +{
164: + int oldstate = ent->client->weaponstate;
165: +
166: + if (ent->s.modelindex != 255) // ### Hentai ###
167: + return; // not on client, so VWep animations could do wacky things
168: +
169: + Weapon_Generic2 (ent, FRAME_ACTIVATE_LAST, FRAME_FIRE_LAST,
170: + FRAME_IDLE_LAST, FRAME_DEACTIVATE_LAST, pause_frames,
171: + fire_frames, fire);
172: +
173: + // run the weapon frame again if hasted
174: + if (stricmp(ent->client->pers.weapon->pickup_name, "Grapple") == 0 &&
175: + ent->client->weaponstate == WEAPON_FIRING)
176: + return;
177: +
178: + if ((CTFApplyHaste(ent) ||
179: + (Q_stricmp(ent->client->pers.weapon->pickup_name, "Grapple") == 0 &&
180: + ent->client->weaponstate != WEAPON_FIRING))
181: + && oldstate == ent->client->weaponstate) {
182: + Weapon_Generic2 (ent, FRAME_ACTIVATE_LAST, FRAME_FIRE_LAST,
183: + FRAME_IDLE_LAST, FRAME_DEACTIVATE_LAST, pause_frames,
184: + fire_frames, fire);
185: + }
186: +}
187: +//ZOID
188:
189: /*
190: ======================================================================
191: @@ -546,28 +594,28 @@
192: speed = GRENADE_MINSPEED + (GRENADE_TIMER - timer) * ((GRENADE_MAXSPEED - GRENADE_MINSPEED) / GRENADE_TIMER);
193: fire_grenade2 (ent, start, forward, damage, speed, timer, radius, held);
194:
195: - if (! ( (int)dmflags->value & DF_INFINITE_AMMO ) )
196: - ent->client->pers.inventory[ent->client->ammo_index]--;
197: -
198: - ent->client->grenade_time = level.time + 1.0;
199: -
200: - if(ent->deadflag || ent->s.modelindex != 255) // VWep animations screw up corpses
201: - {
202: + // ### Hentai ### BEGIN
203: + if(ent->deadflag || ent->s.modelindex != 255)
204: return;
205: - }
206:
207: - if (ent->client->ps.pmove.pm_flags & PMF_DUCKED)
208: + if (ent->client->ps.pmove.pm_flags & PMF_DUCKED )
209: {
210: ent->client->anim_priority = ANIM_ATTACK;
211: ent->s.frame = FRAME_crattak1-1;
212: ent->client->anim_end = FRAME_crattak3;
213: }
214: - else
215: + else if(ent->s.modelindex != 255)
216: {
217: ent->client->anim_priority = ANIM_REVERSE;
218: ent->s.frame = FRAME_wave08;
219: ent->client->anim_end = FRAME_wave01;
220: }
221: + // ### Hentai ### END
222: +
223: + if (! ( (int)dmflags->value & DF_INFINITE_AMMO ) )
224: + ent->client->pers.inventory[ent->client->ammo_index]--;
225: +
226: + ent->client->grenade_time = level.time + 1.0;
227: }
228:
229: void Weapon_Grenade (edict_t *ent)
230: @@ -629,7 +677,7 @@
231: if (!ent->client->grenade_time)
232: {
233: ent->client->grenade_time = level.time + GRENADE_TIMER + 0.2;
234: - ent->client->weapon_sound = gi.soundindex("weapons/hgrenc1b.wav");
235: + //ent->client->weapon_sound = gi.soundindex("weapons/hgrenc1b.wav");
236: }
237:
238: // they waited too long, detonate it in their hand
239: @@ -883,8 +931,8 @@
240: else
241: damage = 20;
242: Blaster_Fire (ent, offset, damage, true, effect);
243: - if (! ( (int)dmflags->value & DF_INFINITE_AMMO ) )
244: - ent->client->pers.inventory[ent->client->ammo_index]--;
245: +
246: + // ### Hentai ### BEGIN
247:
248: ent->client->anim_priority = ANIM_ATTACK;
249: if (ent->client->ps.pmove.pm_flags & PMF_DUCKED)
250: @@ -897,6 +945,11 @@
251: ent->s.frame = FRAME_attack1 - 1;
252: ent->client->anim_end = FRAME_attack8;
253: }
254: +
255: + // ### Hentai ### END
256: +
257: + if (! ( (int)dmflags->value & DF_INFINITE_AMMO ) )
258: + ent->client->pers.inventory[ent->client->ammo_index]--;
259: }
260:
261: ent->client->ps.gunframe++;
262: @@ -997,9 +1050,7 @@
263: gi.multicast (ent->s.origin, MULTICAST_PVS);
264:
265: PlayerNoise(ent, start, PNOISE_WEAPON);
266: -
267: - if (! ( (int)dmflags->value & DF_INFINITE_AMMO ) )
268: - ent->client->pers.inventory[ent->client->ammo_index]--;
269: + // ### Hentai ### BEGIN
270:
271: ent->client->anim_priority = ANIM_ATTACK;
272: if (ent->client->ps.pmove.pm_flags & PMF_DUCKED)
273: @@ -1012,6 +1063,11 @@
274: ent->s.frame = FRAME_attack1 - (int) (random()+0.25);
275: ent->client->anim_end = FRAME_attack8;
276: }
277: +
278: + // ### Hentai ### END
279: +
280: + if (! ( (int)dmflags->value & DF_INFINITE_AMMO ) )
281: + ent->client->pers.inventory[ent->client->ammo_index]--;
282: }
283:
284: void Weapon_Machinegun (edict_t *ent)
285: @@ -1067,6 +1123,8 @@
286: ent->client->weapon_sound = gi.soundindex("weapons/chngnl1a.wav");
287: }
288:
289: + // ### Hentai ### BEGIN
290: +
291: ent->client->anim_priority = ANIM_ATTACK;
292: if (ent->client->ps.pmove.pm_flags & PMF_DUCKED)
293: {
294: @@ -1079,6 +1137,8 @@
295: ent->client->anim_end = FRAME_attack8;
296: }
297:
298: + // ### Hentai ### END
299: +
300: if (ent->client->ps.gunframe <= 9)
301: shots = 1;
302: else if (ent->client->ps.gunframe <= 14)
303: @@ -1137,6 +1197,7 @@
304:
305: PlayerNoise(ent, start, PNOISE_WEAPON);
306:
307: +
308: if (! ( (int)dmflags->value & DF_INFINITE_AMMO ) )
309: ent->client->pers.inventory[ent->client->ammo_index] -= shots;
310: }
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.