#ifndef ACTOR_BASE_H
#define ACTOR_BASE_H

#include "game_object.h"

#define PLAYER_PHYS_MASS           80.0
#define PLAYER_PHYS_RADIUS         0.40
#define PLAYER_PHYS_HEIGHT         1.79
#define PLAYER_PHYS_JUMPDIST       PLAYER_PHYS_RADIUS
#define PLAYER_PHYS_JUMPHEIGHT     2.0
#define PLAYER_PHYS_JUMPSPEEDY     5.0
#define PLAYER_PHYS_WALK_SPEED     ( 5.5 )
#define PLAYER_PHYS_RUN_SPEED_MUL  1.4
#define PLAYER_PHYS_MOVE_SPEED_EXP 1.0
#define PLAYER_PHYS_FLY_SPEED_EXP  4.0

class ActorBase : public Entity
{
public:
	ActorBase();
	~ActorBase();

	virtual void Update(float dt);

	void AfterEngineStep();

	void UpdateCameraMovement(float dt);

	void UpdateBodyMovement(float dt);

	void UpdateCameraLook();

	void ActivateCamera();

	void CreatePlayerBody(float radius, float height, float mass, float friction, float damping);
	void CreatePlayerBodyBox(float x, float y, float z, float mass, float friction, float damping);
	void CreatePlayerBody_Old();

	bool OnGround();

	void SetNoclip(bool noclip);

	// Lua bindings

	virtual void RegisterFunctions();

	int Lua_UpdateCameraMovement(LuaPlus::LuaState* state);
	int Lua_UpdateBodyMovement(LuaPlus::LuaState* state);
	int Lua_UpdateCameraLook(LuaPlus::LuaState* state);
	int Lua_ActivateCamera(LuaPlus::LuaState* state);
	int Lua_CreatePlayerBody(LuaPlus::LuaState* state);
	int Lua_CreatePlayerBodyOld(LuaPlus::LuaState* state);
	int Lua_CreatePlayerBodyBox(LuaPlus::LuaState* state);
	int Lua_GetAction(LuaPlus::LuaState* state);
	int Lua_GetMovement(LuaPlus::LuaState* state);
	int Lua_OnGround(LuaPlus::LuaState* state);
	int Lua_IsNoclip(LuaPlus::LuaState* state);

private:
	int GenAction();
	uint32_t GenMovementDir();

private:
	Camera m_camera;

	bool m_noclip;
};


#endif // !ACTOR_BASE_H
