1 /*
2  Copyright (c) 2013 yvt
3  based on code of pysnip (c) Mathias Kaerlev 2011-2012.
4 
5  This file is part of OpenSpades.
6 
7  OpenSpades is free software: you can redistribute it and/or modify
8  it under the terms of the GNU General Public License as published by
9  the Free Software Foundation, either version 3 of the License, or
10  (at your option) any later version.
11 
12  OpenSpades 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.  See the
15  GNU General Public License for more details.
16 
17  You should have received a copy of the GNU General Public License
18  along with OpenSpades.  If not, see <http://www.gnu.org/licenses/>.
19 
20  */
21 
22 #pragma once
23 
24 #define FALL_SLOW_DOWN 0.24f
25 #define FALL_DAMAGE_VELOCITY 0.58f
26 #define FALL_DAMAGE_SCALAR 4096
27 #define MINERANGE 3
28 #define SCPITCH 128
29 #define MAXSCANDIST 128
30 #define MAXSCANSQ (MAXSCANDIST * MAXSCANDIST)
31 #define BOUNCE_SOUND_THRESHOLD 0.1f
32 #define TC_CAPTURE_RATE 0.05f
33 #define TC_CAPTURE_DISTANCE 16.f
34 
35 // actually this is server-side constraint.
36 // actual value differs on vanilla client
37 #define MELEE_DISTANCE_F 3.f
38 #define MELEE_DISTANCE 3
39 #define MAX_BLOCK_DISTANCE 6
40 #define MAX_DIG_DISTANCE 6
41 
42 enum WeaponType { RIFLE_WEAPON, SMG_WEAPON, SHOTGUN_WEAPON };
43 
44 enum BlockActionType {
45 	BlockActionCreate,
46 	BlockActionTool, // gun and spade
47 	BlockActionDig,
48 	BlockActionGrenade
49 };
50 
51 // "Hit Packet" and weapon damage query
52 enum HitType {
53 	HitTypeTorso,
54 	HitTypeHead,
55 	HitTypeArms,
56 	HitTypeLegs,
57 	HitTypeBlock, // used for block damage query
58 	HitTypeMelee
59 };
60 
61 enum HurtType { HurtTypeFall = 0, HurtTypeWeapon };
62 
63 enum KillType {
64 	KillTypeWeapon = 0,
65 	KillTypeHeadshot,
66 	KillTypeMelee,
67 	KillTypeGrenade,
68 	KillTypeFall,
69 	KillTypeTeamChange,
70 	KillTypeClassChange
71 };
72 
73 // Flags to be used in a raycast.
74 enum hitTag_t { hit_None = 0, hit_Head = 1, hit_Torso = 2, hit_Legs = 4, hit_Arms = 8 };
75 
76 static inline hitTag_t &operator|=(hitTag_t &left, const hitTag_t &right) {
77 	left = static_cast<hitTag_t>(static_cast<int>(left) | static_cast<int>(right));
78 	return left;
79 }
80