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
|
/* This file is part of the Spring engine (GPL v2 or later), see LICENSE.html */
#ifndef FPS_UNIT_CONTROLLER_H
#define FPS_UNIT_CONTROLLER_H
#include "System/float3.h"
class CUnit;
class CPlayer;
struct FPSUnitController {
FPSUnitController();
void SetControlleeUnit(CUnit* controlleeUnit) { controllee = controlleeUnit; }
void SetControllerPlayer(CPlayer* controllerPlayer) { controller = controllerPlayer; }
void Update();
/**
* Extract and store direction info from byte array,
* used for network transfer.
* TODO move this to network message handling code when it is modularized
*/
void RecvStateUpdate(const unsigned char* buf);
/**
* Compress direction info into byte array, and send it to the host.
* TODO move this to network message handling code when it is modularized
*/
void SendStateUpdate();
const CUnit* GetControllee() const { return controllee; }
CUnit* GetControllee() { return controllee; }
const CPlayer* GetController() const { return controller; }
CPlayer* GetController() { return controller; }
CUnit* targetUnit; ///< synced
CUnit* controllee; ///< synced
/// synced, always points to the player that owns us (unused)
CPlayer* controller;
float3 viewDir; ///< synced
float3 targetPos; ///< synced
float targetDist; ///< synced
bool forward; ///< synced
bool back; ///< synced
bool left; ///< synced
bool right; ///< synced
bool mouse1; ///< synced
bool mouse2; ///< synced
short oldHeading; ///< unsynced
short oldPitch; ///< unsynced
unsigned char oldState; ///< unsynced
float3 oldDCpos; ///< unsynced
};
#endif // FPS_UNIT_CONTROLLER_H
|