This commit is contained in:
h4570
2020-12-26 13:31:30 +01:00
parent 8406dcee72
commit 91772a905c
2 changed files with 14 additions and 20 deletions
+11 -19
View File
@@ -26,33 +26,25 @@ Enemy::Enemy(TextureRepository *t_texRepo)
PRINT_LOG("Creating enemy object"); PRINT_LOG("Creating enemy object");
meshes = new Mesh[getMeshesCount()]; meshes = new Mesh[getMeshesCount()];
drawMeshes = new Mesh *[getMeshesCount()];
meshes[0].loadMD2("meshes/enemy/", "poss_head", 0.3F, false); meshes[0].loadMD2("meshes/enemy/", "poss_head", 0.3F, false);
meshes[0].rotation.x = -1.566F;
meshes[0].rotation.z = 1.566F;
meshes[0].shouldBeFrustumCulled = false;
meshes[1].loadMD2("meshes/enemy/", "poss_body", 0.3F, false); meshes[1].loadMD2("meshes/enemy/", "poss_body", 0.3F, false);
meshes[1].rotation.x = -1.566F;
meshes[1].rotation.z = 1.566F;
meshes[1].shouldBeFrustumCulled = false;
meshes[2].loadMD2("meshes/enemy/", "poss_weapon", 0.3F, false); meshes[2].loadMD2("meshes/enemy/", "poss_weapon", 0.3F, false);
meshes[2].rotation.x = -1.566F;
meshes[2].rotation.z = 1.566F; for (u8 i = 0; i < 3; i++)
meshes[2].shouldBeFrustumCulled = false; {
meshes[i].rotation.x = -1.566F;
meshes[i].rotation.z = 1.566F;
meshes[i].shouldBeFrustumCulled = false;
t_texRepo->addByMesh("meshes/enemy/", meshes[i], PNG);
meshes[i].playAnimation(1, 6);
drawMeshes[i] = &meshes[i];
}
Vector3 initPos = Vector3(0.00F, 40.00F, 0.00F); Vector3 initPos = Vector3(0.00F, 40.00F, 0.00F);
setPosition(initPos); setPosition(initPos);
t_texRepo->addByMesh("meshes/enemy/", meshes[0], PNG);
t_texRepo->addByMesh("meshes/enemy/", meshes[1], PNG);
t_texRepo->addByMesh("meshes/enemy/", meshes[2], PNG);
meshes[0].playAnimation(1, 6);
meshes[1].playAnimation(1, 6);
meshes[2].playAnimation(1, 6);
isKilled = true; isKilled = true;
PRINT_LOG("Enemy object created!"); PRINT_LOG("Enemy object created!");
+3 -1
View File
@@ -24,7 +24,7 @@ public:
Enemy(TextureRepository *t_texRepo); Enemy(TextureRepository *t_texRepo);
~Enemy(); ~Enemy();
inline Mesh *getMeshes() const { return meshes; } inline Mesh **getMeshes() const { return drawMeshes; }
inline u8 getMeshesCount() const { return 3; } inline u8 getMeshesCount() const { return 3; }
inline Vector3 getPosition() const { return position; } inline Vector3 getPosition() const { return position; }
void setPosition(const Vector3 &t_vec); void setPosition(const Vector3 &t_vec);
@@ -35,6 +35,8 @@ public:
private: private:
/** 0 - head, 1 - body, 2 - weapon */ /** 0 - head, 1 - body, 2 - weapon */
Mesh *meshes; Mesh *meshes;
/** Only for draw() method. */
Mesh **drawMeshes;
const Floor *currentFloor; const Floor *currentFloor;
Vector3 position, currFloorMin, currFloorMax; Vector3 position, currFloorMin, currFloorMax;
u8 isKilled; u8 isKilled;