-
Notifications
You must be signed in to change notification settings - Fork 163
/
Copy pathitemtypes.h
178 lines (158 loc) · 4.46 KB
/
itemtypes.h
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
/*
* itemtypes.h
*
* Created on: Feb 10, 2017
* Author: nullifiedcat
*/
#ifndef ITEMTYPES_H_
#define ITEMTYPES_H_
#include "beforecheaders.h"
#include <map>
#include <string>
#include <vector>
#include "aftercheaders.h"
const std::string tf2c_weapon_names[] = {
"BOTTLE",
"GRENADE_NAPALM", "SUPERSHOTGUN_MERCENARY", "ROCKETBETA", "GRENADE_GRENADELAUNCHER",
"GRENADELAUNCHER", "GRENADE_PIPEBOMB", "CIGARETTE_CASE", "BRANDINGIRON",
"BANHAMMER", "SNIPERRIFLE", "GRENADE_HEAL", "HAMMERFISTS",
"GRENADE_NAIL", "DART", "RPG", "UMBRELLA_CIVILIAN",
"GRENADE_FRAG", "GRENADE_MIRV", "MEDIGUN", "GRENADE_MIRV_DEMO",
"PICKAXE", "SYRINGEGUN", "SCATTERGUN", "STENGUN",
"SNUBNOSE", "MINIGUN", "WRENCH", "BAT",
"SAPPER", "ROCKET", "HAMMER", "FISHWHACKER",
"KRITZKRIEG", "FLAREGUN", "SHOVEL", "PISTOL",
"SMG", "LEADPIPE", "FLAREGUN_SHELL", "GRENADE_EMP",
"CYCLOPS", "MACHETE", "SHOTGUN", "REVOLVER",
"GRENADE_GAS", "GRENADE_BEARTRAP", "FIREAXE", "GRENADE_CONC",
"NAILGUN", "BONESAW", "STICKYBOMB_LAUNCHER", "GRENADE_BOMBLET",
"TRANQ", "DYNAMITE", "CLUB", "TOMMYGUN",
"COFFEPOT", "STICKYBOMB", "ROCKETLAUNCHER", "FLAMETHROWER",
"CROWBAR", "BUILDER", "HEAVY_ARTILLERY", "KNIFE",
"PDA_ENGINEER", "BOTTLE_BROKEN", "TOOLBOX", "SYRINGE_PROJ",
"NAIL", "SYRINGE", "OVERHEALER" };
enum k_EItemType {
ITEM_NONE = 0,
ITEM_HEALTH_SMALL,
ITEM_HEALTH_MEDIUM,
ITEM_HEALTH_LARGE,
ITEM_AMMO_SMALL,
ITEM_AMMO_MEDIUM,
ITEM_AMMO_LARGE,
ITEM_POWERUP_STRENGTH,
ITEM_POWERUP_RESISTANCE,
ITEM_POWERUP_VAMPIRE,
ITEM_POWERUP_REFLECT,
ITEM_POWERUP_HASTE,
ITEM_POWERUP_REGENERATION,
ITEM_POWERUP_PRECISION,
ITEM_POWERUP_AGILITY,
ITEM_POWERUP_KNOCKOUT,
ITEM_POWERUP_KING,
ITEM_POWERUP_PLAGUE,
ITEM_POWERUP_SUPERNOVA,
ITEM_POWERUP_CRITS,
ITEM_POWERUP_FIRST = ITEM_POWERUP_STRENGTH,
ITEM_POWERUP_LAST = ITEM_POWERUP_CRITS,
ITEM_TF2C_PILL,
ITEM_TF2C_CRITS,
ITEM_TF2C_W_BOTTLE,
ITEM_TF2C_W_GRENADE_NAPALM,
ITEM_TF2C_W_SUPERSHOTGUN_MERCENARY,
ITEM_TF2C_W_ROCKETBETA,
ITEM_TF2C_W_GRENADE_GRENADELAUNCHER,
ITEM_TF2C_W_GRENADELAUNCHER,
ITEM_TF2C_W_GRENADE_PIPEBOMB,
ITEM_TF2C_W_CIGARETTE_CASE,
ITEM_TF2C_W_BRANDINGIRON,
ITEM_TF2C_W_BANHAMMER,
ITEM_TF2C_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,
ITEM_TF2C_W_STICKYBOMB,
ITEM_TF2C_W_ROCKETLAUNCHER,
ITEM_TF2C_W_FLAMETHROWER,
ITEM_TF2C_W_CROWBAR,
ITEM_TF2C_W_BUILDER,
ITEM_TF2C_W_HEAVY_ARTILLERY,
ITEM_TF2C_W_KNIFE,
ITEM_TF2C_W_PDA_ENGINEER,
ITEM_TF2C_W_BOTTLE_BROKEN,
ITEM_TF2C_W_TOOLBOX,
ITEM_TF2C_W_SYRINGE_PROJ,
ITEM_TF2C_W_NAIL,
ITEM_TF2C_W_SYRINGE,
ITEM_TF2C_W_OVERHEALER,
ITEM_TF2C_W_FIRST = ITEM_TF2C_W_BOTTLE,
ITEM_TF2C_W_LAST = ITEM_TF2C_W_OVERHEALER,
ITEM_HL_BATTERY,
ITEM_COUNT
};
class CachedEntity;
typedef bool(*ItemCheckerFn)(CachedEntity*);
typedef k_EItemType(*ItemSpecialMapperFn)(CachedEntity*);
class ItemModelMapper {
public:
void RegisterItem(std::string modelpath, k_EItemType type);
k_EItemType GetItemType(CachedEntity* entity);
std::map<std::string, k_EItemType> models;
std::map<uintptr_t, k_EItemType> map;
};
class ItemManager {
public:
ItemManager();
void RegisterModelMapping(std::string path, k_EItemType type);
void RegisterSpecialMapping(ItemCheckerFn fn, k_EItemType type);
k_EItemType GetItemType(CachedEntity* ent);
std::map<ItemCheckerFn, k_EItemType> special_map;
std::vector<ItemSpecialMapperFn> specials;
ItemModelMapper mapper_special;
ItemModelMapper mapper;
};
extern ItemManager g_ItemManager;
#endif /* ITEMTYPES_H_ */