#include "ga_player.hpp" #include "ga_trig.hpp" AsPlayer::AsPlayer() { Reset(); } void AsPlayer::Reset() { X = 1000.0; #ifdef _AS_VERSION_PC Y = AS_PLAYER_LEGS; Z = 1000.0; #else Y = -AS_PLAYER_LEGS; Z = -1000.0; #endif xRoom = 0;//6;//2; // what about other starting points yRoom = 0;//0;//4; zRoom = 0;//0;//1; oldX = X; oldY = Y; oldZ = Z; aroundX = 0; aroundY = 0;//1024; aroundZ = 0; roomRotation = 0; } void AsPlayer::Move(unsigned int angle) { X += SIN(angle) * AS_PLAYER_MOVE_FACTOR; Z += COS(angle) * AS_PLAYER_MOVE_FACTOR; } void AsPlayer::MoveForward() { Move(aroundY); } void AsPlayer::MoveBackward() { unsigned int angle = aroundY + AS_DEGREES_180; Move(angle); } void AsPlayer::MoveLeft() { unsigned int angle = aroundY - AS_DEGREES_90; Move(angle); } void AsPlayer::MoveRight() { unsigned int angle = aroundY + AS_DEGREES_90; Move(angle); } void AsPlayer::StoreOldPosition() { oldX = X; oldY = Y; oldZ = Z; } //void AsPlayer::SetPosition(float newX, float newY, float newZ) void AsPlayer::SetPosition(int newX, int newY, int newZ) { X = newX; Y = newY; Z = newZ; } void AsPlayer::TurnLeft() { aroundY = (aroundY - AS_PLAYER_ROTATE_FACTOR) % AS_DEGREES_360; } void AsPlayer::TurnRight() { aroundY = (aroundY + AS_PLAYER_ROTATE_FACTOR) % AS_DEGREES_360; } void AsPlayer::LookUp() { aroundX = (aroundX - AS_PLAYER_ROTATE_FACTOR) % AS_DEGREES_360; } void AsPlayer::LookDown() { aroundX = (aroundX + AS_PLAYER_ROTATE_FACTOR) % AS_DEGREES_360; } void AsPlayer::TwistLeft() { aroundZ = (aroundZ - AS_PLAYER_ROTATE_FACTOR) % AS_DEGREES_360; } void AsPlayer::TwistRight() { aroundZ = (aroundZ + AS_PLAYER_ROTATE_FACTOR) % AS_DEGREES_360; }