1
2
3
4
5
6
7
8
9
10
11
|
#import "DynamicEntity.h"
#include "cube.h"
struct dynent {
OFVector3D origin, velocity;
float yaw, pitch, roll;
float maxSpeed;
bool outsideMap;
bool inWater;
bool onFloor, jumpNext;
|
>
>
|
1
2
3
4
5
6
7
8
9
10
11
12
13
|
#import "DynamicEntity.h"
#include "cube.h"
#import "Monster.h"
struct dynent {
OFVector3D origin, velocity;
float yaw, pitch, roll;
float maxSpeed;
bool outsideMap;
bool inWater;
bool onFloor, jumpNext;
|
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
|
copy->_lastAttackGun = _lastAttackGun;
copy->_lastMove = _lastMove;
copy->_attacking = _attacking;
for (size_t i = 0; i < NUMGUNS; i++)
copy->_ammo[i] = _ammo[i];
copy->_monsterState = _monsterState;
copy->_monsterType = _monsterType;
copy->_enemy = _enemy;
copy->_targetYaw = _targetYaw;
copy->_blocked = _blocked;
copy->_moving = _moving;
copy->_trigger = _trigger;
copy->_attackTarget = _attackTarget;
copy->_anger = _anger;
copy->_name = [_name copy];
copy->_team = [_team copy];
return copy;
}
- (OFData *)dataBySerializing
|
<
<
<
<
<
<
<
<
|
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
|
copy->_lastAttackGun = _lastAttackGun;
copy->_lastMove = _lastMove;
copy->_attacking = _attacking;
for (size_t i = 0; i < NUMGUNS; i++)
copy->_ammo[i] = _ammo[i];
copy->_blocked = _blocked;
copy->_moving = _moving;
copy->_name = [_name copy];
copy->_team = [_team copy];
return copy;
}
- (OFData *)dataBySerializing
|
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
|
.quadMillis = _quadMillis,
.gunSelect = _gunSelect,
.gunWait = _gunWait,
.lastAction = _lastAction,
.lastAttackGun = _lastAttackGun,
.lastMove = _lastMove,
.attacking = _attacking,
.monsterState = _monsterState,
.monsterType = _monsterType,
.targetYaw = _targetYaw,
.blocked = _blocked,
.moving = _moving,
.trigger = _trigger,
.attackTarget = _attackTarget,
.anger = _anger };
for (int i = 0; i < NUMGUNS; i++)
data.ammo[i] = _ammo[i];
memcpy(data.name, _name.UTF8String, min(_name.UTF8StringLength, 259));
memcpy(data.team, _team.UTF8String, min(_team.UTF8StringLength, 259));
|
<
<
<
|
>
>
>
>
>
>
|
|
|
>
|
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
|
.quadMillis = _quadMillis,
.gunSelect = _gunSelect,
.gunWait = _gunWait,
.lastAction = _lastAction,
.lastAttackGun = _lastAttackGun,
.lastMove = _lastMove,
.attacking = _attacking,
.blocked = _blocked,
.moving = _moving };
if ([self isKindOfClass:Monster.class]) {
Monster *monster = (Monster *)self;
data.monsterState = monster.monsterState;
data.monsterType = monster.monsterType;
data.targetYaw = monster.targetYaw;
data.trigger = monster.trigger;
data.attackTarget = monster.attackTarget;
data.anger = monster.anger;
}
for (int i = 0; i < NUMGUNS; i++)
data.ammo[i] = _ammo[i];
memcpy(data.name, _name.UTF8String, min(_name.UTF8StringLength, 259));
memcpy(data.team, _team.UTF8String, min(_team.UTF8StringLength, 259));
|
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
|
_lastAttackGun = d.lastAttackGun;
_lastMove = d.lastMove;
_attacking = d.attacking;
for (int i = 0; i < NUMGUNS; i++)
_ammo[i] = d.ammo[i];
_monsterState = d.monsterState;
_monsterType = d.monsterType;
_targetYaw = d.targetYaw;
_blocked = d.blocked;
_moving = d.moving;
_trigger = d.trigger;
_attackTarget = d.attackTarget;
_anger = d.anger;
_name = [[OFString alloc] initWithUTF8String:d.name];
_team = [[OFString alloc] initWithUTF8String:d.team];
}
- (void)resetMovement
{
|
>
>
>
>
>
|
|
|
<
<
|
|
|
>
|
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
|
_lastAttackGun = d.lastAttackGun;
_lastMove = d.lastMove;
_attacking = d.attacking;
for (int i = 0; i < NUMGUNS; i++)
_ammo[i] = d.ammo[i];
_blocked = d.blocked;
_moving = d.moving;
if ([self isKindOfClass:Monster.class]) {
Monster *monster = (Monster *)self;
monster.monsterState = d.monsterState;
monster.monsterType = d.monsterType;
monster.targetYaw = d.targetYaw;
monster.trigger = d.trigger;
monster.attackTarget = d.attackTarget;
monster.anger = d.anger;
}
_name = [[OFString alloc] initWithUTF8String:d.name];
_team = [[OFString alloc] initWithUTF8String:d.team];
}
- (void)resetMovement
{
|