-
Notifications
You must be signed in to change notification settings - Fork 0
/
P_INTER.C
1501 lines (1409 loc) · 34 KB
/
P_INTER.C
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
// P_inter.c
#include "DoomDef.h"
#include "P_local.h"
#include "soundst.h"
#define BONUSADD 6
int WeaponValue[] =
{
1, // staff
3, // goldwand
4, // crossbow
5, // blaster
6, // skullrod
7, // phoenixrod
8, // mace
2, // gauntlets
0 // beak
};
int maxammo[NUMAMMO] =
{
100, // gold wand
50, // crossbow
200, // blaster
200, // skull rod
20, // phoenix rod
150 // mace
};
int GetWeaponAmmo[NUMWEAPONS] =
{
0, // staff
25, // gold wand
10, // crossbow
30, // blaster
50, // skull rod
2, // phoenix rod
50, // mace
0, // gauntlets
0 // beak
};
static weapontype_t GetAmmoChange[] =
{
wp_goldwand,
wp_crossbow,
wp_blaster,
wp_skullrod,
wp_phoenixrod,
wp_mace
};
//--------------------------------------------------------------------------
//
// PROC P_SetMessage
//
//--------------------------------------------------------------------------
boolean ultimatemsg;
void P_SetMessage(player_t *player, char *message, boolean ultmsg)
{
extern boolean messageson;
if ((ultimatemsg || !messageson) && !ultmsg)
{
return;
}
player->message = message;
player->messageTics = MESSAGETICS;
BorderTopRefresh = true;
if (ultmsg)
{
ultimatemsg = true;
}
}
//--------------------------------------------------------------------------
//
// FUNC P_GiveAmmo
//
// Returns true if the player accepted the ammo, false if it was
// refused (player has maxammo[ammo]).
//
//--------------------------------------------------------------------------
boolean P_GiveAmmo(player_t *player, ammotype_t ammo, int count)
{
int prevAmmo;
//weapontype_t changeWeapon;
if (ammo == am_noammo)
{
return(false);
}
if (ammo < 0 || ammo > NUMAMMO)
{
I_Error("P_GiveAmmo: bad type %i", ammo);
}
if (player->ammo[ammo] == player->maxammo[ammo])
{
return(false);
}
if (gameskill == sk_baby || gameskill == sk_nightmare)
{ // extra ammo in baby mode and nightmare mode
count += count >> 1;
}
prevAmmo = player->ammo[ammo];
player->ammo[ammo] += count;
if (player->ammo[ammo] > player->maxammo[ammo])
{
player->ammo[ammo] = player->maxammo[ammo];
}
if (prevAmmo)
{
// Don't attempt to change weapons if the player already had
// ammo of the type just given
return(true);
}
if (player->readyweapon == wp_staff
|| player->readyweapon == wp_gauntlets)
{
if (player->weaponowned[GetAmmoChange[ammo]])
{
player->pendingweapon = GetAmmoChange[ammo];
}
}
return(true);
}
//--------------------------------------------------------------------------
//
// FUNC P_GiveWeapon
//
// Returns true if the weapon or its ammo was accepted.
//
//--------------------------------------------------------------------------
boolean P_GiveWeapon(player_t *player, weapontype_t weapon)
{
boolean gaveAmmo;
boolean gaveWeapon;
if (netgame && !deathmatch)
{ // Cooperative net-game
if (player->weaponowned[weapon])
{
return(false);
}
player->bonuscount += BONUSADD;
player->weaponowned[weapon] = true;
P_GiveAmmo(player, wpnlev1info[weapon].ammo,
GetWeaponAmmo[weapon]);
player->pendingweapon = weapon;
if (!M_CheckParm("-oldrules")) // FS: Some hacky shit to show the pickup messages in netgames for always stay
{
switch (weapon)
{
case wp_crossbow:
P_SetMessage(player, TXT_WPNCROSSBOW, false);
break;
case wp_blaster:
P_SetMessage(player, TXT_WPNBLASTER, false);
break;
case wp_skullrod:
P_SetMessage(player, TXT_WPNSKULLROD, false);
break;
case wp_phoenixrod:
P_SetMessage(player, TXT_WPNPHOENIXROD, false);
break;
case wp_mace:
P_SetMessage(player, TXT_WPNMACE, false);
break;
case wp_gauntlets:
P_SetMessage(player, TXT_WPNGAUNTLETS, false);
break;
}
}
if (player == &players[consoleplayer])
{
S_StartSound(NULL, sfx_wpnup);
}
return(false);
}
gaveAmmo = P_GiveAmmo(player, wpnlev1info[weapon].ammo,
GetWeaponAmmo[weapon]);
if (player->weaponowned[weapon])
{
gaveWeapon = false;
}
else
{
gaveWeapon = true;
player->weaponowned[weapon] = true;
if (WeaponValue[weapon] > WeaponValue[player->readyweapon])
{ // Only switch to more powerful weapons
player->pendingweapon = weapon;
}
}
return(gaveWeapon || gaveAmmo);
}
//---------------------------------------------------------------------------
//
// FUNC P_GiveBody
//
// Returns false if the body isn't needed at all.
//
//---------------------------------------------------------------------------
boolean P_GiveBody(player_t *player, int num)
{
int max;
max = MAXHEALTH;
if (player->chickenTics)
{
max = MAXCHICKENHEALTH;
}
if (player->health >= max)
{
return(false);
}
player->health += num;
if (player->health > max)
{
player->health = max;
}
player->mo->health = player->health;
return(true);
}
//---------------------------------------------------------------------------
//
// FUNC P_GiveArmor
//
// Returns false if the armor is worse than the current armor.
//
//---------------------------------------------------------------------------
boolean P_GiveArmor(player_t *player, int armortype)
{
int hits;
hits = armortype * 100;
if (player->armorpoints >= hits)
{
return(false);
}
player->armortype = armortype;
player->armorpoints = hits;
return(true);
}
//---------------------------------------------------------------------------
//
// PROC P_GiveKey
//
//---------------------------------------------------------------------------
void P_GiveKey(player_t *player, keytype_t key)
{
extern int playerkeys;
extern vertex_t KeyPoints[];
int i; // FS: Give keys to all players in Coop
if (player->keys[key])
{
return;
}
if (player == &players[consoleplayer])
{
playerkeys |= 1 << key;
KeyPoints[key].x = 0;
KeyPoints[key].y = 0;
}
player->bonuscount = BONUSADD;
player->keys[key] = true;
if (netgame && !deathmatch && !M_CheckParm("-oldrules")) // FS: Give it to all in coop
{
for (i = 0; i < MAXPLAYERS; i++)
{
player = &players[i];
playerkeys |= 1 << key;
KeyPoints[key].x = 0;
KeyPoints[key].y = 0;
player->bonuscount = BONUSADD;
player->keys[key] = true;
S_StartSound(NULL, sfx_keyup); // FS: Broadcast to all
switch (key)
{
case key_blue:
P_SetMessage(player, "EVERYONE HAS THE BLUE KEY!", true);
break;
case key_green:
P_SetMessage(player, "EVERYONE HAS THE GREEN KEY!", true);
break;
case key_yellow:
P_SetMessage(player, "EVERYONE HAS THE YELLOW KEY!", true);
break;
default:
break;
}
}
}
}
//---------------------------------------------------------------------------
//
// FUNC P_GivePower
//
// Returns true if power accepted.
//
//---------------------------------------------------------------------------
boolean P_GivePower(player_t *player, powertype_t power)
{
if (power == pw_invulnerability)
{
if (player->powers[power] > BLINKTHRESHOLD)
{ // Already have it
return(false);
}
player->powers[power] = INVULNTICS;
return(true);
}
if (power == pw_weaponlevel2)
{
if (player->powers[power] > BLINKTHRESHOLD)
{ // Already have it
return(false);
}
player->powers[power] = WPNLEV2TICS;
return(true);
}
if (power == pw_invisibility)
{
if (player->powers[power] > BLINKTHRESHOLD)
{ // Already have it
return(false);
}
player->powers[power] = INVISTICS;
player->mo->flags |= MF_SHADOW;
return(true);
}
if (power == pw_flight)
{
if (player->powers[power] > BLINKTHRESHOLD)
{ // Already have it
return(false);
}
player->powers[power] = FLIGHTTICS;
player->mo->flags2 |= MF2_FLY;
player->mo->flags |= MF_NOGRAVITY;
if (player->mo->z <= player->mo->floorz)
{
player->flyheight = 10; // thrust the player in the air a bit
}
return(true);
}
if (power == pw_infrared)
{
if (player->powers[power] > BLINKTHRESHOLD)
{ // Already have it
return(false);
}
player->powers[power] = INFRATICS;
return(true);
}
if (player->powers[power])
{
return(false); // already got it
}
player->powers[power] = 1;
return(true);
}
//---------------------------------------------------------------------------
//
// FUNC P_GiveArtifact
//
// Returns true if artifact accepted.
//
//---------------------------------------------------------------------------
boolean P_GiveArtifact(player_t *player, artitype_t arti, mobj_t *mo)
{
int i;
i = 0;
while (player->inventory[i].type != arti && i < player->inventorySlotNum)
{
i++;
}
if (i == player->inventorySlotNum)
{
player->inventory[i].count = 1;
player->inventory[i].type = arti;
player->inventorySlotNum++;
}
else
{
if (player->inventory[i].count >= 16)
{ // Player already has 16 of this item
return(false);
}
player->inventory[i].count++;
}
if (player->artifactCount == 0)
{
player->readyArtifact = arti;
}
player->artifactCount++;
if (mo && (mo->flags & MF_COUNTITEM))
{
player->itemcount++;
}
return(true);
}
//---------------------------------------------------------------------------
//
// PROC P_SetDormantArtifact
//
// Removes the MF_SPECIAL flag, and initiates the artifact pickup
// animation.
//
//---------------------------------------------------------------------------
void P_SetDormantArtifact(mobj_t *arti)
{
arti->flags &= ~MF_SPECIAL;
if (netgame && (arti->type != MT_ARTIINVULNERABILITY) // FS: Respawn items Was deathmatch
&& (arti->type != MT_ARTIINVISIBILITY) && !M_CheckParm("-oldrules"))
{
P_SetMobjState(arti, S_DORMANTARTI1);
}
else
{ // Don't respawn
P_SetMobjState(arti, S_DEADARTI1);
}
S_StartSound(arti, sfx_artiup);
}
//---------------------------------------------------------------------------
//
// PROC A_RestoreArtifact
//
//---------------------------------------------------------------------------
void A_RestoreArtifact(mobj_t *arti)
{
arti->flags |= MF_SPECIAL;
P_SetMobjState(arti, arti->info->spawnstate);
S_StartSound(arti, sfx_respawn);
}
//----------------------------------------------------------------------------
//
// PROC P_HideSpecialThing
//
//----------------------------------------------------------------------------
void P_HideSpecialThing(mobj_t *thing)
{
thing->flags &= ~MF_SPECIAL;
thing->flags2 |= MF2_DONTDRAW;
P_SetMobjState(thing, S_HIDESPECIAL1);
}
//---------------------------------------------------------------------------
//
// PROC A_RestoreSpecialThing1
//
// Make a special thing visible again.
//
//---------------------------------------------------------------------------
void A_RestoreSpecialThing1(mobj_t *thing)
{
if (thing->type == MT_WMACE)
{ // Do random mace placement
P_RepositionMace(thing);
}
thing->flags2 &= ~MF2_DONTDRAW;
S_StartSound(thing, sfx_respawn);
}
//---------------------------------------------------------------------------
//
// PROC A_RestoreSpecialThing2
//
//---------------------------------------------------------------------------
void A_RestoreSpecialThing2(mobj_t *thing)
{
thing->flags |= MF_SPECIAL;
P_SetMobjState(thing, thing->info->spawnstate);
}
//---------------------------------------------------------------------------
//
// PROC P_TouchSpecialThing
//
//---------------------------------------------------------------------------
void P_TouchSpecialThing(mobj_t *special, mobj_t *toucher)
{
int i;
player_t *player;
fixed_t delta;
int sound;
delta = special->z - toucher->z;
if (delta > toucher->height || delta < -32 * FRACUNIT)
{ // Out of reach
return;
}
if (toucher->health <= 0)
{ // Toucher is dead
return;
}
sound = sfx_itemup;
player = toucher->player;
switch (special->sprite)
{
// Items
case SPR_PTN1: // Item_HealingPotion
if (!P_GiveBody(player, 10))
{
return;
}
P_SetMessage(player, TXT_ITEMHEALTH, false);
break;
case SPR_SHLD: // Item_Shield1
if (!P_GiveArmor(player, 1))
{
return;
}
P_SetMessage(player, TXT_ITEMSHIELD1, false);
break;
case SPR_SHD2: // Item_Shield2
if (!P_GiveArmor(player, 2))
{
return;
}
P_SetMessage(player, TXT_ITEMSHIELD2, false);
break;
case SPR_BAGH: // Item_BagOfHolding
if (!player->backpack)
{
for (i = 0; i < NUMAMMO; i++)
{
player->maxammo[i] *= 2;
}
player->backpack = true;
}
P_GiveAmmo(player, am_goldwand, AMMO_GWND_WIMPY);
P_GiveAmmo(player, am_blaster, AMMO_BLSR_WIMPY);
P_GiveAmmo(player, am_crossbow, AMMO_CBOW_WIMPY);
P_GiveAmmo(player, am_skullrod, AMMO_SKRD_WIMPY);
P_GiveAmmo(player, am_phoenixrod, AMMO_PHRD_WIMPY);
P_SetMessage(player, TXT_ITEMBAGOFHOLDING, false);
break;
case SPR_SPMP: // Item_SuperMap
if (!P_GivePower(player, pw_allmap))
{
return;
}
P_SetMessage(player, TXT_ITEMSUPERMAP, false);
break;
// Keys
case SPR_BKYY: // Key_Blue
if (!player->keys[key_blue])
{
P_SetMessage(player, TXT_GOTBLUEKEY, false);
}
P_GiveKey(player, key_blue);
sound = sfx_keyup;
if (!netgame)
{
break;
}
return;
case SPR_CKYY: // Key_Yellow
if (!player->keys[key_yellow])
{
P_SetMessage(player, TXT_GOTYELLOWKEY, false);
}
sound = sfx_keyup;
P_GiveKey(player, key_yellow);
if (!netgame)
{
break;
}
return;
case SPR_AKYY: // Key_Green
if (!player->keys[key_green])
{
P_SetMessage(player, TXT_GOTGREENKEY, false);
}
sound = sfx_keyup;
P_GiveKey(player, key_green);
if (!netgame)
{
break;
}
return;
// Artifacts
case SPR_PTN2: // Arti_HealingPotion
if (P_GiveArtifact(player, arti_health, special))
{
P_SetMessage(player, TXT_ARTIHEALTH, false);
P_SetDormantArtifact(special);
}
return;
case SPR_SOAR: // Arti_Fly
if (P_GiveArtifact(player, arti_fly, special))
{
P_SetMessage(player, TXT_ARTIFLY, false);
P_SetDormantArtifact(special);
}
return;
case SPR_INVU: // Arti_Invulnerability
if (P_GiveArtifact(player, arti_invulnerability, special))
{
P_SetMessage(player, TXT_ARTIINVULNERABILITY, false);
P_SetDormantArtifact(special);
}
return;
case SPR_PWBK: // Arti_TomeOfPower
if (P_GiveArtifact(player, arti_tomeofpower, special))
{
P_SetMessage(player, TXT_ARTITOMEOFPOWER, false);
P_SetDormantArtifact(special);
}
return;
case SPR_INVS: // Arti_Invisibility
if (P_GiveArtifact(player, arti_invisibility, special))
{
P_SetMessage(player, TXT_ARTIINVISIBILITY, false);
P_SetDormantArtifact(special);
}
return;
case SPR_EGGC: // Arti_Egg
if (P_GiveArtifact(player, arti_egg, special))
{
P_SetMessage(player, TXT_ARTIEGG, false);
P_SetDormantArtifact(special);
}
return;
case SPR_SPHL: // Arti_SuperHealth
if (P_GiveArtifact(player, arti_superhealth, special))
{
P_SetMessage(player, TXT_ARTISUPERHEALTH, false);
P_SetDormantArtifact(special);
}
return;
case SPR_TRCH: // Arti_Torch
if (P_GiveArtifact(player, arti_torch, special))
{
P_SetMessage(player, TXT_ARTITORCH, false);
P_SetDormantArtifact(special);
}
return;
case SPR_FBMB: // Arti_FireBomb
if (P_GiveArtifact(player, arti_firebomb, special))
{
P_SetMessage(player, TXT_ARTIFIREBOMB, false);
P_SetDormantArtifact(special);
}
return;
case SPR_ATLP: // Arti_Teleport
if (P_GiveArtifact(player, arti_teleport, special))
{
P_SetMessage(player, TXT_ARTITELEPORT, false);
P_SetDormantArtifact(special);
}
return;
// Ammo
case SPR_AMG1: // Ammo_GoldWandWimpy
if (!P_GiveAmmo(player, am_goldwand, special->health))
{
return;
}
P_SetMessage(player, TXT_AMMOGOLDWAND1, false);
break;
case SPR_AMG2: // Ammo_GoldWandHefty
if (!P_GiveAmmo(player, am_goldwand, special->health))
{
return;
}
P_SetMessage(player, TXT_AMMOGOLDWAND2, false);
break;
case SPR_AMM1: // Ammo_MaceWimpy
if (!P_GiveAmmo(player, am_mace, special->health))
{
return;
}
P_SetMessage(player, TXT_AMMOMACE1, false);
break;
case SPR_AMM2: // Ammo_MaceHefty
if (!P_GiveAmmo(player, am_mace, special->health))
{
return;
}
P_SetMessage(player, TXT_AMMOMACE2, false);
break;
case SPR_AMC1: // Ammo_CrossbowWimpy
if (!P_GiveAmmo(player, am_crossbow, special->health))
{
return;
}
P_SetMessage(player, TXT_AMMOCROSSBOW1, false);
break;
case SPR_AMC2: // Ammo_CrossbowHefty
if (!P_GiveAmmo(player, am_crossbow, special->health))
{
return;
}
P_SetMessage(player, TXT_AMMOCROSSBOW2, false);
break;
case SPR_AMB1: // Ammo_BlasterWimpy
if (!P_GiveAmmo(player, am_blaster, special->health))
{
return;
}
P_SetMessage(player, TXT_AMMOBLASTER1, false);
break;
case SPR_AMB2: // Ammo_BlasterHefty
if (!P_GiveAmmo(player, am_blaster, special->health))
{
return;
}
P_SetMessage(player, TXT_AMMOBLASTER2, false);
break;
case SPR_AMS1: // Ammo_SkullRodWimpy
if (!P_GiveAmmo(player, am_skullrod, special->health))
{
return;
}
P_SetMessage(player, TXT_AMMOSKULLROD1, false);
break;
case SPR_AMS2: // Ammo_SkullRodHefty
if (!P_GiveAmmo(player, am_skullrod, special->health))
{
return;
}
P_SetMessage(player, TXT_AMMOSKULLROD2, false);
break;
case SPR_AMP1: // Ammo_PhoenixRodWimpy
if (!P_GiveAmmo(player, am_phoenixrod, special->health))
{
return;
}
P_SetMessage(player, TXT_AMMOPHOENIXROD1, false);
break;
case SPR_AMP2: // Ammo_PhoenixRodHefty
if (!P_GiveAmmo(player, am_phoenixrod, special->health))
{
return;
}
P_SetMessage(player, TXT_AMMOPHOENIXROD2, false);
break;
// Weapons
case SPR_WMCE: // Weapon_Mace
if (!P_GiveWeapon(player, wp_mace))
{
return;
}
P_SetMessage(player, TXT_WPNMACE, false);
sound = sfx_wpnup;
break;
case SPR_WBOW: // Weapon_Crossbow
if (!P_GiveWeapon(player, wp_crossbow))
{
return;
}
P_SetMessage(player, TXT_WPNCROSSBOW, false);
sound = sfx_wpnup;
break;
case SPR_WBLS: // Weapon_Blaster
if (!P_GiveWeapon(player, wp_blaster))
{
return;
}
P_SetMessage(player, TXT_WPNBLASTER, false);
sound = sfx_wpnup;
break;
case SPR_WSKL: // Weapon_SkullRod
if (!P_GiveWeapon(player, wp_skullrod))
{
return;
}
P_SetMessage(player, TXT_WPNSKULLROD, false);
sound = sfx_wpnup;
break;
case SPR_WPHX: // Weapon_PhoenixRod
if (!P_GiveWeapon(player, wp_phoenixrod))
{
return;
}
P_SetMessage(player, TXT_WPNPHOENIXROD, false);
sound = sfx_wpnup;
break;
case SPR_WGNT: // Weapon_Gauntlets
if (!P_GiveWeapon(player, wp_gauntlets))
{
return;
}
P_SetMessage(player, TXT_WPNGAUNTLETS, false);
sound = sfx_wpnup;
break;
default:
I_Error("P_SpecialThing: Unknown gettable thing");
}
if (special->flags & MF_COUNTITEM)
{
player->itemcount++;
}
if ((netgame && !(special->flags & MF_DROPPED) && !M_CheckParm("-oldrules")) || M_CheckParm("-respawnitems")) // FS: Respawning Items Was deathmatch
{
P_HideSpecialThing(special);
}
else
{
P_RemoveMobj(special);
}
player->bonuscount += BONUSADD;
if (player == &players[consoleplayer])
{
S_StartSound(NULL, sound);
SB_PaletteFlash();
}
}
//---------------------------------------------------------------------------
//
// PROC P_KillMobj
//
//---------------------------------------------------------------------------
void P_KillMobj(mobj_t *source, mobj_t *target)
{
int i, z; // FS: For Player Died message
player_t *player; // FS: For Player Died message
int playnum; // FS: For Player Died message
target->flags &= ~(MF_SHOOTABLE | MF_FLOAT | MF_SKULLFLY | MF_NOGRAVITY);
target->flags |= MF_CORPSE | MF_DROPOFF;
target->flags2 &= ~MF2_PASSMOBJ;
target->height >>= 2;
if (source && source->player)
{
if (target->flags & MF_COUNTKILL)
{ // Count for intermission
source->player->killcount++;
}
if (target->player)
{ // Frag stuff
if (target == source)
{ // Self-frag
target->player->frags[target->player - players]--;
}
else
{
source->player->frags[target->player - players]++;
if (source->player == &players[consoleplayer])
{
S_StartSound(NULL, sfx_gfrag);
}
if (source->player->chickenTics)
{ // Make a super chicken
P_GivePower(source->player, pw_weaponlevel2);
}
}
}
}
else if (!netgame && (target->flags & MF_COUNTKILL))
{ // Count all monster deaths
players[0].killcount++;
}
if (target->player)
{
if (!source)
{ // Self-frag
target->player->frags[target->player - players]--;
}
target->flags &= ~MF_SOLID;
target->flags2 &= ~MF2_FLY;
target->player->powers[pw_flight] = 0;
target->player->powers[pw_weaponlevel2] = 0;
target->player->powers[pw_infrared] = 0; // FS: Remove Torch
target->player->fixedcolormap = 0; // FS: Remove Torch
target->player->playerstate = PST_DEAD;
if (netgame && !deathmatch && !M_CheckParm("-oldrules")) // FS: Broadcast death in coop
{
for (z = 0; z < MAXPLAYERS; z++)
{
player = &players[z];
if (player == target->player)
{
playnum = z;
}
}
for (i = 0; i < MAXPLAYERS; i++)
{
player = &players[i];
switch (playnum)
{
case 0:
P_SetMessage(player, "PLAYER 1 DIED!", true);
break;
case 1:
P_SetMessage(player, "PLAYER 2 DIED!", true);
break;
case 2:
P_SetMessage(player, "PLAYER 3 DIED!", true);
break;
case 3:
P_SetMessage(player, "PLAYER 4 DIED!", true);
break;
default: // FS: Shouldn't happen... but?
P_SetMessage(player, "PLAYER DIED!", true);
break;
}
}
}
P_DropWeapon(target->player);
if (target->flags2 & MF2_FIREDAMAGE)
{ // Player flame death
P_SetMobjState(target, S_PLAY_FDTH1);
//S_StartSound(target, sfx_hedat1); // Burn sound
return;
}
}
if (target->health < -(target->info->spawnhealth >> 1)
&& target->info->xdeathstate)
{ // Extreme death
P_SetMobjState(target, target->info->xdeathstate);
}
else
{ // Normal death
P_SetMobjState(target, target->info->deathstate);
}
target->tics -= P_Random() & 3;
// I_StartSound(&actor->r, actor->info->deathsound);
}
//---------------------------------------------------------------------------
//
// FUNC P_MinotaurSlam
//
//---------------------------------------------------------------------------
void P_MinotaurSlam(mobj_t *source, mobj_t *target)
{
angle_t angle;
fixed_t thrust;
angle = R_PointToAngle2(source->x, source->y, target->x, target->y);
angle >>= ANGLETOFINESHIFT;
thrust = 16 * FRACUNIT + (P_Random() << 10);
target->momx += FixedMul(thrust, finecosine[angle]);
target->momy += FixedMul(thrust, finesine[angle]);
P_DamageMobj(target, NULL, NULL, HITDICE(6));
if (target->player)
{
target->reactiontime = 14 + (P_Random() & 7);
}
}
//---------------------------------------------------------------------------
//
// FUNC P_TouchWhirlwind
//
//---------------------------------------------------------------------------