-
Notifications
You must be signed in to change notification settings - Fork 0
/
game.go
176 lines (155 loc) · 4.06 KB
/
game.go
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
package rogue
//"fmt"
type ObjectType int
const (
Avatar ObjectType = iota
Allies
Enemies
Weapons
Items
)
type Team int
const (
CounterTerrorists = iota
Terrorists
)
type Game struct {
Avatar *GameObject
Allies Team
Enemies Team
Round int
Alive bool
Health int
Objects []*GameObject
// TODO: Just implement these by selecting them from the object group
// by using an attribute in the GameObject struct
//Weapons []*GameObject
//Items []*GameObject
//Players []*GameObject
//Terrorists []*GameObject
//CounterTerrorists []*GameObject
}
// TODO: All vector.cpp stuff will be moved in here, mainly
// regarding distance calculations so we can make glow hack
// work at distance
type Vector struct {
X float64
Y float64
Z float64
}
type GameObject struct {
ID int
Type ObjectType
Position Vector
Health int
Alive bool
}
//typedef struct {
// char __buff_0x00[0xC];//0x00
// float x;//0xC
// char __buff_0x10[0xC];//0x10
// float y;//0x1c
// char __buff_0x20[0xC];//0x20
// float z;//0x2c
//} BoneMatrix;
type BoneMatrix struct {
Vector Vector
Offset []byte // ? Is this the right name, I dont really understand why its called buff
}
func (self *Game) NewRound() {
self.Round++
self.Health = 100
self.Alive = true
// TODO Set active team
}
func (self *Game) ParseObjects() {
// TODO: Use a mutex to update the entity list in a thread safe manner
// might as well also return the list after parsing
// TODO: Previously thre was GetEntityList, UpdateEntityList, but we can combine them
// into one. And just make the list a public object within the engine.
// TODO: This is where we will assign our avatar data and our team data as well from
// memory
}
func (self *Game) ClearObjects() {
self.Objects = []*GameObject{}
}
func (self *Game) AddGameObject(o *GameObject) {
self.Objects = append(self.Objects, o)
}
func (self *Game) ObjectWithID(id int) *GameObject {
// TODO: Use a read mutex to ensure the data being pulled is not changed
// and ensure the entity does not equal 0 or nil
for _, object := range self.Objects {
if object.ID == id {
return object
}
}
return nil
}
func (self *Game) ObjectByIndex(index int) *GameObject {
if index < len(self.Objects) {
return self.Objects[index]
}
return nil
}
func (self *Game) Render() {
Info("Entering Game.Render() function")
self.ParseObjects()
}
type Weapon int
const (
NONE Weapon = 0
DEAGLE Weapon = 1
ELITE Weapon = 2
FIVESEVEN Weapon = 3
GLOCK Weapon = 4
AK47 Weapon = 7
AUG Weapon = 8
AWP Weapon = 9
FAMAS Weapon = 10
G3SG1 Weapon = 11
GALILAR Weapon = 13
M249 Weapon = 14
M4A1 Weapon = 16
MAC10 Weapon = 17
P90 Weapon = 19
UMP45 Weapon = 24
XM1014 Weapon = 25
BIZON Weapon = 26
MAG7 Weapon = 27
NEGEV Weapon = 28
SAWEDOFF Weapon = 29
TEC9 Weapon = 30
TASER Weapon = 31
HKP2000 Weapon = 32
MP7 Weapon = 33
MP9 Weapon = 34
NOVA Weapon = 35
P250 Weapon = 36
SCAR20 Weapon = 38
SG556 Weapon = 39
SSG08 Weapon = 40
KNIFE Weapon = 42
FLASHBANG Weapon = 43
HEGRENADE Weapon = 44
SMOKEGRENADE Weapon = 45
MOLOTOV Weapon = 46
DECOY Weapon = 47
INCENDIARYGRENADE Weapon = 48
C4 Weapon = 49
TERRORISTKNIFE Weapon = 59
M4A1SILENCER Weapon = 60
USPSILENCER Weapon = 61
CZ75A Weapon = 63
REVOLVER Weapon = 64
KNIFEBAYONET Weapon = 500
KNIFEFLIP Weapon = 505
KNIFEGUT Weapon = 506
KNIFEKARMABIT Weapon = 507
KNIFEM9BAYONET Weapon = 508
KNIFETACTICAL Weapon = 509
KNIFEFALCHION Weapon = 512
KNIFEBOWIE Weapon = 514
KNIFEBUTTERFLY Weapon = 515
KNIFEPUSH Weapon = 516
)