removed many Irrlicht references

This commit is contained in:
devZoGok
2021-10-31 15:13:47 +02:00
parent 0e236a44d6
commit b18b2fe9a8
70 changed files with 1822 additions and 1529 deletions
+31 -29
View File
@@ -3,19 +3,21 @@
#define UNIT_H
#include <vector>
#include <irrlicht.h>
#include <util.h>
#include <SFML/Audio.hpp>
#include "unitData.h"
#include "gameManager.h"
#include "projectile.h"
#include "util.h"
using namespace irr::core;
using namespace irr::scene;
using namespace irr::video;
using namespace game::content::unitData;
namespace vb01{
class Mesh;
class Node;
class Camera;
}
namespace game{
namespace content{
class Player;
@@ -23,7 +25,7 @@ namespace game{
struct Order {
enum class TYPE {ATTACK, MOVE, PATROL, LAUNCH};
TYPE type;
std::vector<vector3df*> targetPos;
std::vector<vb01::Vector3*> targetPos;
};
enum class MoveDir {FORWARD, LEFT, RIGHT};
@@ -32,67 +34,67 @@ namespace game{
class Unit {
public:
Unit(Player*,vector3df, int);
Unit(Player*, vb01::Vector3, int);
~Unit();
virtual void update();
virtual void blowUp();
virtual void updateUnitGUIInfo(ICameraSceneNode*, vector3df, vector3df, vector3df);
//virtual void updateUnitGUIInfo(ICameraSceneNode*, vector3df, vector3df, vector3df);
virtual void debug();
virtual void halt();
void toggleSelection(bool);
void setOrder(Order);
void placeUnit(vector3df);
void orientUnit(vector3df);
void placeUnit(vb01::Vector3);
void orientUnit(vb01::Vector3);
void addProjectile(Projectile*);
float getCircleRadius();
vector3df getCorner(int);
vb01::Vector3 getCorner(int);
std::vector<Projectile*> getProjectiles();
inline bool isSelected(){return selected;}
inline bool isSelectable(){return selectable;}
inline bool isDebuggable(){return debugging;}
inline bool isWorking(){return working;}
inline vector2d<s32> getScreenPos(){return screenPos;}
inline vb01::Vector2 getScreenPos(){return screenPos;}
inline void addOrder(Order o){orders.push_back(o);}
inline vector3df getPos() {return pos;}
inline vector3df* getPosPtr() {return &pos;}
inline ILightSceneNode* getLight() {return light;}
inline vb01::Vector3 getPos() {return pos;}
inline vb01::Vector3* getPosPtr() {return &pos;}
//inline ILightSceneNode* getLight() {return light;}
inline float getLineOfSight() {return lineOfSight;}
inline float getWidth() {return width;}
inline float getHeight() {return height;}
inline float getLength() {return length;}
inline ISceneNode* getNode() {return node;}
inline vb01::Node* getNode() {return node;}
inline Player* getPlayer(){return player;}
inline unitData::UNIT_TYPE getType() {return type;}
inline void toggleDebugging(bool d){this->debugging=d;}
inline void takeDamage(int damage) {health -= damage;}
inline int getId() {return id;}
inline int getPlayerId() {return playerId;}
inline vector3df getDirVec() {return dirVec;}
inline vector3df getLeftVec() {return leftVec;}
inline vector3df getUpVec() {return upVec;}
inline vb01::Vector3 getDirVec() {return dirVec;}
inline vb01::Vector3 getLeftVec() {return leftVec;}
inline vb01::Vector3 getUpVec() {return upVec;}
private:
void updateScreenCoordinates(ICameraSceneNode*, vector3df, vector3df, vector3df);
//void updateScreenCoordinates(ICameraSceneNode*, vector3df, vector3df, vector3df);
void displayUnitStats();
inline int getNextPatrolPointId() {return patrolPointId == patrolPoints.size() - 1 ? 0 : patrolPointId + 1;}
inline bool canDisplayOrderLine(){return util::getTime()-orderLineDispTime<orderVecDispLength;}
ILightSceneNode *light;
inline bool canDisplayOrderLine(){return vb01::getTime() - orderLineDispTime < orderVecDispLength;}
//ILightSceneNode *light;
const int orderVecDispLength=2000;
sf::SoundBuffer *selectionSfxBuffer;
sf::Sound *selectionSfx=nullptr;
protected:
Player *player;
MoveDir moveDir = MoveDir::FORWARD;
irr::video::SMaterial createLineMaterial();
//vb01::Material createLineMaterial();
unitData::UNIT_TYPE type;
ICameraSceneNode *cam = nullptr;
vector2d<s32> screenPos;
vb01::Camera *cam = nullptr;
vb01::Vector2 screenPos;
std::vector<Order> orders;
std::vector<vector3df> patrolPoints;
vector3df pos = vector3df(0, 0, 0), upVec = vector3df(0, 1, 0), dirVec = vector3df(0, 0, -1), leftVec = vector3df(1, 0, 0);
std::vector<vb01::Vector3> patrolPoints;
vb01::Vector3 pos = vb01::Vector3(0, 0, 0), upVec = vb01::Vector3(0, 1, 0), dirVec = vb01::Vector3(0, 0, -1), leftVec = vb01::Vector3(1, 0, 0);
int health, cost, id, patrolPointId = 0, playerId;
s64 orderLineDispTime=0;
IAnimatedMesh *mesh;
ISceneNode *node;
vb01::Mesh *mesh;
vb01::Node *node;
bool selected = false, selectable, debugging = false, working=true;
float lineOfSight, speed, maxTurnAngle, range, width, height, length;
void removeOrder(int);