-
-
Notifications
You must be signed in to change notification settings - Fork 452
/
Copy pathCWeaponNames.cpp
129 lines (116 loc) · 5.1 KB
/
CWeaponNames.cpp
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
/*****************************************************************************
*
* PROJECT: Multi Theft Auto v1.0
* (Shared logic for modifications)
* LICENSE: See LICENSE in the top level directory
* FILE: mods/shared_logic/CWeaponNames.cpp
* PURPOSE: Weapon names class
*
*****************************************************************************/
#include <StdInc.h>
using namespace std;
const char* const szWeaponNameEmpty = "";
struct SWeaponName
{
const char* szName;
};
struct SWeaponSlot
{
char cSlot;
};
static const SWeaponName _WeaponNames[] = {{"Fist"},
{"Brassknuckle"},
{"Golfclub"},
{"Nightstick"},
{"Knife"},
{"Bat"},
{"Shovel"},
{"Poolstick"},
{"Katana"},
{"Chainsaw"},
{"Purple Dildo"},
{"Dildo"},
{"Vibrator"},
{"Silver Vibrator"},
{"Flower"},
{"Cane"},
{"Grenade"},
{"Teargas"},
{"Molotov"},
{"Rocket"},
{"Rocket"},
{"Freefall Bomb"},
{"Colt 45"},
{"Silenced"},
{"Deagle"},
{"Shotgun"},
{"Sawed-off"},
{"Combat Shotgun"},
{"Uzi"},
{"MP5"},
{"AK-47"},
{"M4"},
{"Tec-9"},
{"Rifle"},
{"Sniper"},
{"Rocket Launcher"},
{"Rocket Launcher HS"},
{"Flamethrower"},
{"Minigun"},
{"Satchel"},
{"Bomb"},
{"Spraycan"},
{"Fire Extinguisher"},
{"Camera"},
{"Nightvision"},
{"Infrared"},
{"Parachute"},
{"Last Weapon"},
{"Armour"},
{"Rammed"},
{"Ranover"},
{"Explosion"},
{"Driveby"},
{"Drowned"},
{"Fall"},
{"Unknown"},
{"Melee"},
{"Weapon"},
{"Flare"},
{"Tank Grenade"}};
static const IMPLEMENT_FIXED_ARRAY(SWeaponName, WeaponNames);
static const SWeaponSlot _WeaponIDs[] = {{0}, {0}, {1}, {1}, {1}, {1}, {1}, {1}, {1}, {1}, {10}, {10}, {10}, {-1}, {10}, {10},
{8}, {8}, {8}, {-1}, {-1}, {-1}, {2}, {2}, {2}, {3}, {3}, {3}, {4}, {4}, {5}, {5},
{4}, {6}, {6}, {7}, {7}, {7}, {7}, {8}, {12}, {9}, {9}, {9}, {11}, {11}, {11}, {-1}};
static const IMPLEMENT_FIXED_ARRAY(SWeaponSlot, WeaponIDs);
unsigned char CWeaponNames::GetWeaponID(const char* szName)
{
// If the specified string was empty, return 0
if (szName[0] == 0)
return 0xFF;
// Look for it in our table
for (unsigned int i = 0; i < NUMELMS(WeaponNames); i++)
{
if (stricmp(szName, WeaponNames[i].szName) == 0)
{
return i;
}
}
return 0xFF;
}
const char* CWeaponNames::GetWeaponName(unsigned char ucID)
{
if (ucID < NUMELMS(WeaponNames))
{
return WeaponNames[ucID].szName;
}
return szWeaponNameEmpty;
}
char CWeaponNames::GetSlotFromWeapon(unsigned char ucID)
{
if (ucID < NUMELMS(WeaponIDs))
{
return WeaponIDs[ucID].cSlot;
}
return -1;
}