Compare commits
11 Commits
sqc-15_onl
...
RUNNINGREA
Author | SHA1 | Date | |
---|---|---|---|
|
7a7dc1fad6 | ||
|
0856f913d2 | ||
|
16e9f6aefe | ||
|
e98bd03192 | ||
|
e6e93ef6d0 | ||
|
df0a142b12 | ||
|
5a491c5446 | ||
|
20eb410b08 | ||
|
c44d1453ae | ||
|
37ea09aaf3 | ||
|
62b7719eb4 |
@@ -7,7 +7,7 @@ Bullet::Bullet(Vector3f pos, Vector3f dir, uint64_t tid): m_startpos(pos), m_cur
|
|||||||
|
|
||||||
Bullet::~Bullet() {}
|
Bullet::~Bullet() {}
|
||||||
|
|
||||||
bool Bullet::Update(World* world, float elapsedtime, int perframe, std::unordered_map<uint64_t, Player*> mapPlayer) {
|
bool Bullet::Update(World* world, float elapsedtime, int perframe, std::unordered_map<uint64_t, Player*> mapPlayer, netprot::ChunkMod** chunkmod) {
|
||||||
int max = 100 / perframe;
|
int max = 100 / perframe;
|
||||||
float damage = 0.057f;
|
float damage = 0.057f;
|
||||||
for (int x = 0; x < max; ++x) {
|
for (int x = 0; x < max; ++x) {
|
||||||
@@ -23,6 +23,15 @@ bool Bullet::Update(World* world, float elapsedtime, int perframe, std::unordere
|
|||||||
if (!world->ChunkAt(m_currentpos))
|
if (!world->ChunkAt(m_currentpos))
|
||||||
return true;
|
return true;
|
||||||
else if (world->BlockAt(m_currentpos) != BTYPE_AIR) {
|
else if (world->BlockAt(m_currentpos) != BTYPE_AIR) {
|
||||||
|
if (chunkmod) {
|
||||||
|
using namespace netprot;
|
||||||
|
ChunkMod* cmod = *chunkmod;
|
||||||
|
cmod = new ChunkMod();
|
||||||
|
cmod->old_b_type = world->BlockAt(m_currentpos);
|
||||||
|
cmod->b_type = BTYPE_AIR;
|
||||||
|
cmod->pos = m_currentpos;
|
||||||
|
}
|
||||||
|
|
||||||
world->ChangeBlockAtPosition(BTYPE_AIR, m_currentpos);
|
world->ChangeBlockAtPosition(BTYPE_AIR, m_currentpos);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
@@ -5,7 +5,7 @@
|
|||||||
#include "define.h"
|
#include "define.h"
|
||||||
#include "vector3.h"
|
#include "vector3.h"
|
||||||
#include "player.h"
|
#include "player.h"
|
||||||
|
#include "netprotocol.h"
|
||||||
|
|
||||||
class World;
|
class World;
|
||||||
class Player;
|
class Player;
|
||||||
@@ -16,7 +16,7 @@ public:
|
|||||||
Bullet(Vector3f pos, Vector3f dir, uint64_t tid);
|
Bullet(Vector3f pos, Vector3f dir, uint64_t tid);
|
||||||
~Bullet();
|
~Bullet();
|
||||||
|
|
||||||
bool Update(World* world, float elapsedtime, int perframe, std::unordered_map<uint64_t, Player*> m_mapPlayer);
|
bool Update(World* world, float elapsedtime, int perframe, std::unordered_map<uint64_t, Player*> m_mapPlayer, netprot::ChunkMod** chunkmod);
|
||||||
void Transpose(int& x, int& z);
|
void Transpose(int& x, int& z);
|
||||||
Vector3f getPos() const;
|
Vector3f getPos() const;
|
||||||
Vector3f getVel() const;
|
Vector3f getVel() const;
|
||||||
|
@@ -402,6 +402,34 @@ void netprot::Serialize(Chat* chat, char* buf[], uint32_t* buflen) {
|
|||||||
*buflen = messize + sizeof(uint64_t) * 3 + 2;
|
*buflen = messize + sizeof(uint64_t) * 3 + 2;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void netprot::Serialize(ChunkMod* chmod, char* buf[], uint32_t* buflen) {
|
||||||
|
*buf[0] = (char)netprot::PACKET_TYPE::CHUNKMOD;
|
||||||
|
|
||||||
|
uint32_t vec[3];
|
||||||
|
memcpy(vec, &chmod->pos, sizeof(Vector3f)); // Pour d<>naturer les floats.
|
||||||
|
|
||||||
|
uint8_t vec8[3 * sizeof(uint32_t)] = {
|
||||||
|
(uint8_t)((vec[0] >> 24) & 0xFF),
|
||||||
|
(uint8_t)((vec[0] >> 16) & 0xFF),
|
||||||
|
(uint8_t)((vec[0] >> 8) & 0xFF),
|
||||||
|
(uint8_t)(vec[0] & 0xFF),
|
||||||
|
(uint8_t)((vec[1] >> 24) & 0xFF),
|
||||||
|
(uint8_t)((vec[1] >> 16) & 0xFF),
|
||||||
|
(uint8_t)((vec[1] >> 8) & 0xFF),
|
||||||
|
(uint8_t)(vec[1] & 0xFF),
|
||||||
|
(uint8_t)((vec[2] >> 24) & 0xFF),
|
||||||
|
(uint8_t)((vec[2] >> 16) & 0xFF),
|
||||||
|
(uint8_t)((vec[2] >> 8) & 0xFF),
|
||||||
|
(uint8_t)(vec[2] & 0xFF) };
|
||||||
|
|
||||||
|
memcpy(*buf + 1, vec8, sizeof(uint32_t) * 3);
|
||||||
|
|
||||||
|
memcpy(*buf + sizeof(uint32_t) * 3 + 1, &chmod->b_type, sizeof(BlockType));
|
||||||
|
memcpy(*buf + sizeof(uint32_t) * 3 + 2, &chmod->old_b_type, sizeof(BlockType));
|
||||||
|
|
||||||
|
*buflen = sizeof(uint32_t) * 3 + 3;
|
||||||
|
}
|
||||||
|
|
||||||
void netprot::Serialize(ErrorLog* errlog, char* buf[], uint32_t* buflen) {
|
void netprot::Serialize(ErrorLog* errlog, char* buf[], uint32_t* buflen) {
|
||||||
*buf[0] = (char)netprot::PACKET_TYPE::ERRLOG;
|
*buf[0] = (char)netprot::PACKET_TYPE::ERRLOG;
|
||||||
|
|
||||||
@@ -818,6 +846,36 @@ bool netprot::Deserialize(Chat* chat, char* buf, uint32_t *buflen) {
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool netprot::Deserialize(ChunkMod* chmod, char* buf, uint32_t* buflen) {
|
||||||
|
if (*buflen <= sizeof(ChunkMod))
|
||||||
|
return false;
|
||||||
|
|
||||||
|
uint8_t subvec[3 * sizeof(uint32_t)] = { 0,0,0,0,0,0,0,0,0,0,0,0 };
|
||||||
|
memcpy(subvec, &buf[1], sizeof(uint8_t) * 12);
|
||||||
|
uint32_t vec[3] = {
|
||||||
|
(uint32_t)subvec[0] << 24 |
|
||||||
|
(uint32_t)subvec[1] << 16 |
|
||||||
|
(uint32_t)subvec[2] << 8 |
|
||||||
|
(uint32_t)subvec[3],
|
||||||
|
(uint32_t)subvec[4] << 24 |
|
||||||
|
(uint32_t)subvec[5] << 16 |
|
||||||
|
(uint32_t)subvec[6] << 8 |
|
||||||
|
(uint32_t)subvec[7],
|
||||||
|
(uint32_t)subvec[8] << 24 |
|
||||||
|
(uint32_t)subvec[9] << 16 |
|
||||||
|
(uint32_t)subvec[10] << 8 |
|
||||||
|
(uint32_t)subvec[11] };
|
||||||
|
|
||||||
|
memcpy(&chmod->pos, vec, sizeof(uint32_t) * 3);
|
||||||
|
|
||||||
|
memcpy(&chmod->b_type, &buf[1 + sizeof(uint8_t) * 12], sizeof(BlockType));
|
||||||
|
memcpy(&chmod->old_b_type, &buf[2 + sizeof(uint8_t) * 12], sizeof(BlockType));
|
||||||
|
|
||||||
|
*buflen = sizeof(uint32_t) * 3 + 3;
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
bool netprot::Deserialize(ErrorLog* errlog, char* buf, uint32_t *buflen) {
|
bool netprot::Deserialize(ErrorLog* errlog, char* buf, uint32_t *buflen) {
|
||||||
if (*buflen <= sizeof(ErrorLog))
|
if (*buflen <= sizeof(ErrorLog))
|
||||||
return false;
|
return false;
|
||||||
|
@@ -130,6 +130,11 @@ namespace netprot {
|
|||||||
Chat(Chat* cha) : src_id(cha->src_id), dest_id(cha->dest_id), dest_team_id(cha->dest_team_id) { strcpy(cha->mess, mess); }
|
Chat(Chat* cha) : src_id(cha->src_id), dest_id(cha->dest_id), dest_team_id(cha->dest_team_id) { strcpy(cha->mess, mess); }
|
||||||
};
|
};
|
||||||
|
|
||||||
|
struct ChunkMod {
|
||||||
|
Vector3f pos;
|
||||||
|
BlockType b_type, old_b_type;
|
||||||
|
};
|
||||||
|
|
||||||
struct ErrorLog { // srv -> cli TCP event
|
struct ErrorLog { // srv -> cli TCP event
|
||||||
char mess[140];
|
char mess[140];
|
||||||
bool is_fatal;
|
bool is_fatal;
|
||||||
@@ -147,6 +152,7 @@ namespace netprot {
|
|||||||
void Serialize(PlayerInfo* pinfo, char* buf[], uint32_t* buflen); // srv
|
void Serialize(PlayerInfo* pinfo, char* buf[], uint32_t* buflen); // srv
|
||||||
void Serialize(GameInfo* ginfo, char* buf[], uint32_t* buflen); // cli/srv
|
void Serialize(GameInfo* ginfo, char* buf[], uint32_t* buflen); // cli/srv
|
||||||
void Serialize(Chat* chat, char* buf[], uint32_t* buflen); // cli/srv
|
void Serialize(Chat* chat, char* buf[], uint32_t* buflen); // cli/srv
|
||||||
|
void Serialize(ChunkMod* chmod, char* buf[], uint32_t* buflen); // srv
|
||||||
void Serialize(ErrorLog* errlog, char* buf[], uint32_t* buflen); // srv
|
void Serialize(ErrorLog* errlog, char* buf[], uint32_t* buflen); // srv
|
||||||
|
|
||||||
bool Deserialize(Input* in, char* buf, uint32_t* buflen); // srv
|
bool Deserialize(Input* in, char* buf, uint32_t* buflen); // srv
|
||||||
@@ -157,6 +163,7 @@ namespace netprot {
|
|||||||
bool Deserialize(PlayerInfo* pinfo, char* buf, uint32_t* buflen); // cli
|
bool Deserialize(PlayerInfo* pinfo, char* buf, uint32_t* buflen); // cli
|
||||||
bool Deserialize(GameInfo* ginfo, char* buf, uint32_t* buflen); // cli
|
bool Deserialize(GameInfo* ginfo, char* buf, uint32_t* buflen); // cli
|
||||||
bool Deserialize(Chat* chat, char* buf, uint32_t* buflen); // srv/cli
|
bool Deserialize(Chat* chat, char* buf, uint32_t* buflen); // srv/cli
|
||||||
|
bool Deserialize(ChunkMod* chmod, char* buf, uint32_t* buflen); // cli
|
||||||
bool Deserialize(ErrorLog* errlog, char* buf, uint32_t* buflen); // srv
|
bool Deserialize(ErrorLog* errlog, char* buf, uint32_t* buflen); // srv
|
||||||
|
|
||||||
PACKET_TYPE getType(char* buf, uint32_t buflen);
|
PACKET_TYPE getType(char* buf, uint32_t buflen);
|
||||||
|
@@ -204,11 +204,11 @@ Player::Sound Player::ApplyPhysics(Vector3f input, World* world, float elapsedTi
|
|||||||
void Player::ApplyTransformation(Transformation& transformation, bool rel, bool rot) const {
|
void Player::ApplyTransformation(Transformation& transformation, bool rel, bool rot) const {
|
||||||
transformation.ApplyRotation(-m_rotX, 1, 0, 0);
|
transformation.ApplyRotation(-m_rotX, 1, 0, 0);
|
||||||
transformation.ApplyRotation(-m_rotY, 0, 1, 0);
|
transformation.ApplyRotation(-m_rotY, 0, 1, 0);
|
||||||
|
|
||||||
|
|
||||||
if (rel) transformation.ApplyTranslation(-GetPOV());
|
if (rel) transformation.ApplyTranslation(-GetPOV());
|
||||||
if (!rot) {
|
|
||||||
transformation.ApplyRotation(-m_rotX, 1, 0, 0);
|
|
||||||
transformation.ApplyRotation(-m_rotY, 0, 1, 0);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void Player::GetBooster(Booster boosttype)
|
void Player::GetBooster(Booster boosttype)
|
||||||
|
@@ -169,31 +169,26 @@ void World::Update(Bullet* bullets[MAX_BULLETS], const Vector3f& player_pos, Blo
|
|||||||
UpdateWorld(player_pos, blockinfo);
|
UpdateWorld(player_pos, blockinfo);
|
||||||
//TransposeWorld(player_pos, bullets);
|
//TransposeWorld(player_pos, bullets);
|
||||||
}
|
}
|
||||||
//
|
|
||||||
//void World::UpdateChunk(int& updates, unsigned int chx, unsigned int chy, BlockInfo* blockinfo[BTYPE_LAST]) {
|
|
||||||
// if (updates == 0 && ChunkAt(chx, 1, chy) &&
|
|
||||||
// ChunkAt(chx, 1, chy)->IsDirty()) {
|
|
||||||
// ChunkAt(chx, 1, chy)->Update(blockinfo, this);
|
|
||||||
// updates = FRAMES_UPDATE_CHUNKS;
|
|
||||||
// }
|
|
||||||
//
|
|
||||||
//}
|
|
||||||
|
|
||||||
void World::ChangeBlockAtCursor(BlockType blockType, const Vector3f& player_pos, const Vector3f& player_dir, bool& block) {
|
netprot::ChunkMod* World::ChangeBlockAtCursor(BlockType blockType, const Vector3f& player_pos, const Vector3f& player_dir, bool& block, bool net) {
|
||||||
Vector3f currentPos = player_pos;
|
Vector3f currentPos = player_pos;
|
||||||
Vector3f currentBlock = currentPos;
|
Vector3f currentBlock = currentPos;
|
||||||
Vector3f ray = player_dir;
|
Vector3f ray = player_dir;
|
||||||
|
BlockType oldbtype;
|
||||||
|
netprot::ChunkMod* cmod = nullptr;
|
||||||
bool found = false;
|
bool found = false;
|
||||||
|
|
||||||
if (block) return;
|
if (block) return cmod;
|
||||||
|
|
||||||
while ((currentPos - currentBlock).Length() <= MAX_SELECTION_DISTANCE && !found) {
|
while ((currentPos - currentBlock).Length() <= MAX_SELECTION_DISTANCE && !found) {
|
||||||
currentBlock += ray / 10.f;
|
currentBlock += ray / 10.f;
|
||||||
|
|
||||||
BlockType bt = BlockAt(currentBlock);
|
BlockType bt = BlockAt(currentBlock);
|
||||||
|
|
||||||
if (bt != BTYPE_AIR)
|
if (bt != BTYPE_AIR) {
|
||||||
found = true;
|
found = true;
|
||||||
|
oldbtype = bt;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (found)
|
if (found)
|
||||||
@@ -219,21 +214,30 @@ void World::ChangeBlockAtCursor(BlockType blockType, const Vector3f& player_pos,
|
|||||||
(By == PyA ||
|
(By == PyA ||
|
||||||
By == PyB ||
|
By == PyB ||
|
||||||
By == PyC) &&
|
By == PyC) &&
|
||||||
Bz == Pz))
|
Bz == Pz)) {
|
||||||
found = true;
|
found = true;
|
||||||
|
oldbtype = bt;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (found && (int)currentBlock.y < CHUNK_SIZE_Y) {
|
if (found && (int)currentBlock.y < CHUNK_SIZE_Y) {
|
||||||
|
if (net) {
|
||||||
|
cmod = new netprot::ChunkMod();
|
||||||
|
cmod->old_b_type = oldbtype;
|
||||||
|
cmod->b_type = blockType;
|
||||||
|
cmod->pos = currentBlock;
|
||||||
|
}
|
||||||
int bx = (int)currentBlock.x % CHUNK_SIZE_X;
|
int bx = (int)currentBlock.x % CHUNK_SIZE_X;
|
||||||
int by = (int)currentBlock.y % CHUNK_SIZE_Y;
|
int by = (int)currentBlock.y % CHUNK_SIZE_Y;
|
||||||
int bz = (int)currentBlock.z % CHUNK_SIZE_Z;
|
int bz = (int)currentBlock.z % CHUNK_SIZE_Z;
|
||||||
|
|
||||||
ChunkAt(currentBlock)->SetBlock(bx, by, bz, blockType, this);
|
ChunkAt(currentBlock)->SetBlock(bx, by, bz, blockType, this);
|
||||||
ChunkAt(currentBlock)->MakeModified();
|
ChunkAt(currentBlock)->MakeModified();
|
||||||
block = true;
|
block = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
return cmod;
|
||||||
}
|
}
|
||||||
|
|
||||||
void World::ChangeBlockAtPosition(BlockType blockType, Vector3f pos) {
|
void World::ChangeBlockAtPosition(BlockType blockType, Vector3f pos) {
|
||||||
|
@@ -11,6 +11,7 @@
|
|||||||
#include "array2d.h"
|
#include "array2d.h"
|
||||||
#include "bullet.h"
|
#include "bullet.h"
|
||||||
#include "chunk.h"
|
#include "chunk.h"
|
||||||
|
#include "netprotocol.h"
|
||||||
|
|
||||||
class Chunk;
|
class Chunk;
|
||||||
class Bullet;
|
class Bullet;
|
||||||
@@ -37,7 +38,7 @@ public:
|
|||||||
|
|
||||||
void GetScope(unsigned int& x, unsigned int& y);
|
void GetScope(unsigned int& x, unsigned int& y);
|
||||||
|
|
||||||
void ChangeBlockAtCursor(BlockType blockType, const Vector3f& player_pos, const Vector3f& player_dir, bool& block);
|
netprot::ChunkMod* ChangeBlockAtCursor(BlockType blockType, const Vector3f& player_pos, const Vector3f& player_dir, bool& block, bool net);
|
||||||
void ChangeBlockAtPosition(BlockType blockType, Vector3f pos);
|
void ChangeBlockAtPosition(BlockType blockType, Vector3f pos);
|
||||||
void CleanUpWorld(int& deleteframes, bool clear);
|
void CleanUpWorld(int& deleteframes, bool clear);
|
||||||
int GettbDeleted() const;
|
int GettbDeleted() const;
|
||||||
|
@@ -122,17 +122,28 @@ void Connection::Run(World* world) {
|
|||||||
last = m_input_vector.at(m_last_in);
|
last = m_input_vector.at(m_last_in);
|
||||||
|
|
||||||
el = (double)(in.timestamp - last.timestamp) / 1000.;
|
el = (double)(in.timestamp - last.timestamp) / 1000.;
|
||||||
std::cout << 1. / el << std::endl;
|
|
||||||
|
if (m_shoot_acc > 0.) {
|
||||||
|
m_shoot_acc -= el;
|
||||||
|
if (m_shoot_acc < 0.)
|
||||||
|
m_shoot_acc = 0;
|
||||||
|
}
|
||||||
|
|
||||||
player.get()->SetDirection(in.direction);
|
player.get()->SetDirection(in.direction);
|
||||||
std::cout << in.direction << std::endl;
|
|
||||||
player.get()->ApplyPhysics(player.get()->GetInput(in.keys.forward,
|
player.get()->ApplyPhysics(player.get()->GetInput(in.keys.forward,
|
||||||
in.keys.backward,
|
in.keys.backward,
|
||||||
in.keys.left,
|
in.keys.left,
|
||||||
in.keys.right,
|
in.keys.right,
|
||||||
in.keys.jump, false, el), world, el);
|
in.keys.jump, false, el), world, el);
|
||||||
|
|
||||||
|
//if (in.keys.block)
|
||||||
|
// ChunkDiffs.push_back()
|
||||||
|
|
||||||
|
if (in.keys.shoot && m_shoot_acc <= 0.)
|
||||||
|
Bullets.push_back(Bullet(player.get()->GetPOV() + player.get()->GetDirection(), player.get()->GetDirection()));
|
||||||
|
|
||||||
|
|
||||||
out.position = player.get()->GetPositionAbs();
|
out.position = player.get()->GetPositionAbs();
|
||||||
player.get()->GetPositionAbs().Afficher();
|
|
||||||
out.direction = in.direction;
|
out.direction = in.direction;
|
||||||
out.timestamp = in.timestamp;
|
out.timestamp = in.timestamp;
|
||||||
out.id = m_playinfo.id;
|
out.id = m_playinfo.id;
|
||||||
|
@@ -41,6 +41,10 @@ public:
|
|||||||
void CleanInputManifest(Timestamp time);
|
void CleanInputManifest(Timestamp time);
|
||||||
|
|
||||||
bool m_nsync = true;
|
bool m_nsync = true;
|
||||||
|
|
||||||
|
std::vector<Bullet> Bullets;
|
||||||
|
std::vector<ChunkMod> ChunkDiffs;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
std::unordered_map<Timestamp, Input> m_input_manifest;
|
std::unordered_map<Timestamp, Input> m_input_manifest;
|
||||||
std::vector<Input> m_input_vector;
|
std::vector<Input> m_input_vector;
|
||||||
@@ -48,6 +52,8 @@ private:
|
|||||||
std::deque<Output> m_output_vector;
|
std::deque<Output> m_output_vector;
|
||||||
std::unordered_map<Timestamp, Chat> m_chatlog;
|
std::unordered_map<Timestamp, Chat> m_chatlog;
|
||||||
|
|
||||||
|
float m_shoot_acc = 0;
|
||||||
|
|
||||||
SOCKET m_sock;
|
SOCKET m_sock;
|
||||||
sockaddr_in m_addr;
|
sockaddr_in m_addr;
|
||||||
LoginInfo m_loginfo;
|
LoginInfo m_loginfo;
|
||||||
|
@@ -19,7 +19,7 @@ Server::~Server() {
|
|||||||
if (m_sock_tcp)
|
if (m_sock_tcp)
|
||||||
closesocket(m_sock_tcp);
|
closesocket(m_sock_tcp);
|
||||||
for (const auto& [key, player] : m_players)
|
for (const auto& [key, player] : m_players)
|
||||||
closesocket(player->getSock());
|
closesocket(player->getSock());
|
||||||
m_players.clear();
|
m_players.clear();
|
||||||
delete m_world;
|
delete m_world;
|
||||||
#ifdef _WIN32
|
#ifdef _WIN32
|
||||||
@@ -77,7 +77,8 @@ int Server::Ready() {
|
|||||||
std::cin.getline(m_buf.ptr, BUFFER_LENGTH);
|
std::cin.getline(m_buf.ptr, BUFFER_LENGTH);
|
||||||
try {
|
try {
|
||||||
m_game.countdown = std::stoi(m_buf.ptr);
|
m_game.countdown = std::stoi(m_buf.ptr);
|
||||||
} catch(const std::exception& e) {
|
}
|
||||||
|
catch (const std::exception& e) {
|
||||||
Log(e.what(), true, false);
|
Log(e.what(), true, false);
|
||||||
m_game.countdown = 0;
|
m_game.countdown = 0;
|
||||||
}
|
}
|
||||||
@@ -87,7 +88,8 @@ int Server::Ready() {
|
|||||||
std::cin.getline(m_buf.ptr, BUFFER_LENGTH);
|
std::cin.getline(m_buf.ptr, BUFFER_LENGTH);
|
||||||
try {
|
try {
|
||||||
m_game.seed = 9370707;//std::stoi(m_buf.ptr);
|
m_game.seed = 9370707;//std::stoi(m_buf.ptr);
|
||||||
} catch(const std::exception& e) {
|
}
|
||||||
|
catch (const std::exception& e) {
|
||||||
Log(e.what(), true, false);
|
Log(e.what(), true, false);
|
||||||
m_game.seed = 0;
|
m_game.seed = 0;
|
||||||
}
|
}
|
||||||
@@ -97,7 +99,8 @@ int Server::Ready() {
|
|||||||
std::cin.getline(m_buf.ptr, BUFFER_LENGTH);
|
std::cin.getline(m_buf.ptr, BUFFER_LENGTH);
|
||||||
try {
|
try {
|
||||||
nbrjoueurs = std::stoi(m_buf.ptr);
|
nbrjoueurs = std::stoi(m_buf.ptr);
|
||||||
} catch(const std::exception& e) {
|
}
|
||||||
|
catch (const std::exception& e) {
|
||||||
Log(e.what(), true, false);
|
Log(e.what(), true, false);
|
||||||
nbrjoueurs = 0;
|
nbrjoueurs = 0;
|
||||||
}
|
}
|
||||||
@@ -154,8 +157,8 @@ int Server::Ready() {
|
|||||||
strcpy(play.name, log->name);
|
strcpy(play.name, log->name);
|
||||||
|
|
||||||
Log(str.append(play.name).append(" SID: [").append(std::to_string(log->sid)).append("]")
|
Log(str.append(play.name).append(" SID: [").append(std::to_string(log->sid)).append("]")
|
||||||
.append(" ID: [").append(std::to_string(play.id)).append("]")
|
.append(" ID: [").append(std::to_string(play.id)).append("]")
|
||||||
.append(" TID: [").append(std::to_string(play.tid)).append("]"), false, false);
|
.append(" TID: [").append(std::to_string(play.tid)).append("]"), false, false);
|
||||||
play.tid = log->tid;
|
play.tid = log->tid;
|
||||||
|
|
||||||
sendPackTo<GameInfo>(m_sock_udp, &m_game, &m_buf, &sockad);
|
sendPackTo<GameInfo>(m_sock_udp, &m_game, &m_buf, &sockad);
|
||||||
@@ -207,66 +210,80 @@ void Server::Run() {
|
|||||||
sync.timestamp = 0;
|
sync.timestamp = 0;
|
||||||
sync.timer = m_game.countdown;
|
sync.timer = m_game.countdown;
|
||||||
sendPackTo<Sync>(m_sock_udp, &sync, &m_buf, conn->getAddr());
|
sendPackTo<Sync>(m_sock_udp, &sync, &m_buf, conn->getAddr());
|
||||||
|
}
|
||||||
|
|
||||||
int timer = m_game.countdown, sync_acc = 0;
|
int timer = m_game.countdown, sync_acc = 0;
|
||||||
std::chrono::high_resolution_clock::time_point start = std::chrono::high_resolution_clock::now();
|
std::chrono::high_resolution_clock::time_point start = std::chrono::high_resolution_clock::now();
|
||||||
Timestamp last = 0;
|
Timestamp last = 0;
|
||||||
|
std::vector<Chat> chatlog;
|
||||||
|
|
||||||
while (!endgame) {
|
while (!endgame) {
|
||||||
using namespace std::chrono;
|
using namespace std::chrono;
|
||||||
Timestamp tstamp = duration_cast<milliseconds>(high_resolution_clock::now() - start).count();
|
Timestamp tstamp = duration_cast<milliseconds>(high_resolution_clock::now() - start).count();
|
||||||
|
|
||||||
if (last == 0)
|
if (last == 0)
|
||||||
last = tstamp;
|
last = tstamp;
|
||||||
sync_acc += tstamp - last;
|
sync_acc += tstamp - last;
|
||||||
if (sync_acc >= 1000) {
|
if (sync_acc >= 1000) {
|
||||||
sync_acc -= 1000;
|
sync_acc -= 1000;
|
||||||
--timer;
|
--timer;
|
||||||
}
|
|
||||||
|
|
||||||
for (auto& [key, conn] : m_players) {
|
|
||||||
int deadplayers = 0;
|
|
||||||
std::vector<char*> lsPck;
|
|
||||||
Input in;
|
|
||||||
Sync sync;
|
|
||||||
lsPck = recvPacks(m_sock_udp, &m_buf);
|
|
||||||
for (auto& pck : lsPck) {
|
|
||||||
uint32_t bsize = m_buf.len - (pck - m_buf.ptr);
|
|
||||||
switch (netprot::getType(pck, 1)) {
|
|
||||||
using enum netprot::PACKET_TYPE;
|
|
||||||
case INPUT:
|
|
||||||
if (Deserialize(&in, pck, &bsize)) {
|
|
||||||
m_players[in.sid]->AddInput(in);
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
case SYNC:
|
|
||||||
if (Deserialize(&sync, pck, &bsize)) {}
|
|
||||||
break;
|
|
||||||
case CHAT:
|
|
||||||
// TODO: Pitcher les chats à tous le monde.
|
|
||||||
break;
|
|
||||||
default: break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
lsPck.clear();
|
|
||||||
|
|
||||||
if (conn->m_nsync) {
|
|
||||||
if (conn->player->AmIDead()) {
|
|
||||||
++deadplayers;
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
conn->Run(m_world);
|
|
||||||
conn->sendPacks(m_sock_udp, m_players, timer);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (deadplayers == players - 1 || timer <= 0)
|
|
||||||
endgame = true;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// TODO: Gérer les 2-3 secondes post-game avant le billboard pour pas avoir un whiplash à la fin de la game.
|
for (auto& [key, conn] : m_players) {
|
||||||
|
|
||||||
|
/* In */
|
||||||
|
|
||||||
|
int deadplayers = 0;
|
||||||
|
std::vector<char*> lsPck;
|
||||||
|
Input in; Chat chat; Sync sync;
|
||||||
|
lsPck = recvPacks(m_sock_udp, &m_buf);
|
||||||
|
for (auto& pck : lsPck) {
|
||||||
|
uint32_t bsize = m_buf.len - (pck - m_buf.ptr);
|
||||||
|
switch (netprot::getType(pck, 1)) {
|
||||||
|
using enum netprot::PACKET_TYPE;
|
||||||
|
case INPUT:
|
||||||
|
if (Deserialize(&in, pck, &bsize))
|
||||||
|
m_players[in.sid]->AddInput(in);
|
||||||
|
break;
|
||||||
|
case SYNC:
|
||||||
|
if (Deserialize(&sync, pck, &bsize)) {}
|
||||||
|
break;
|
||||||
|
case CHAT:
|
||||||
|
if (Deserialize(&chat, pck, &bsize))
|
||||||
|
chatlog.push_back(chat);
|
||||||
|
break;
|
||||||
|
default: break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
lsPck.clear();
|
||||||
|
|
||||||
|
/* Process */
|
||||||
|
|
||||||
|
if (conn->m_nsync) {
|
||||||
|
if (conn->player->AmIDead()) {
|
||||||
|
++deadplayers;
|
||||||
|
conn->m_nsync == false;
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
conn->Run(m_world);
|
||||||
|
|
||||||
|
/* Out */
|
||||||
|
|
||||||
|
conn->sendPacks(m_sock_udp, m_players, timer);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (deadplayers == players - 1 || timer <= 0)
|
||||||
|
endgame = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
for (auto& chat : chatlog)
|
||||||
|
for (auto& [key, conn] : m_players)
|
||||||
|
sendPackTo<Chat>(m_sock_udp, &chat, &m_buf, conn->getAddr());
|
||||||
|
chatlog.clear();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// TODO: Gérer les 2-3 secondes post-game avant le billboard pour pas avoir un whiplash à la fin de la game.
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
inline std::string Server::LogTimestamp() {
|
inline std::string Server::LogTimestamp() {
|
||||||
@@ -291,13 +308,13 @@ inline std::string Server::LogTimestamp() {
|
|||||||
void Server::Log(std::string str, bool is_error = false, bool is_fatal = false) {
|
void Server::Log(std::string str, bool is_error = false, bool is_fatal = false) {
|
||||||
switch (m_log) {
|
switch (m_log) {
|
||||||
using enum LOG_DEST; // C++20!
|
using enum LOG_DEST; // C++20!
|
||||||
case LOGFILE:
|
case LOGFILE:
|
||||||
m_logfile << LogTimestamp() << (is_fatal ? "FATAL " : "") << (is_error ? "ERROR " : "") << str << std::endl;
|
m_logfile << LogTimestamp() << (is_fatal ? "FATAL " : "") << (is_error ? "ERROR " : "") << str << std::endl;
|
||||||
break;
|
break;
|
||||||
case CONSOLE: [[fallthrough]]; // Pour dire que c'est voulu que ça traverse vers le case en dessous (C++17!)
|
case CONSOLE: [[fallthrough]]; // Pour dire que c'est voulu que ça traverse vers le case en dessous (C++17!)
|
||||||
default:
|
default:
|
||||||
std::cout << LogTimestamp() << (is_fatal ? "FATAL " : "") << (is_error ? "ERROR " : "") << str << std::endl;
|
std::cout << LogTimestamp() << (is_fatal ? "FATAL " : "") << (is_error ? "ERROR " : "") << str << std::endl;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (is_fatal) {
|
if (is_fatal) {
|
||||||
|
@@ -394,7 +394,7 @@ void Engine::Init() {
|
|||||||
m_world.SetSeed(seed);
|
m_world.SetSeed(seed);
|
||||||
|
|
||||||
m_startTime = std::chrono::high_resolution_clock::now();
|
m_startTime = std::chrono::high_resolution_clock::now();
|
||||||
|
m_remotePlayer.SetPosition(Vector3f(.5, CHUNK_SIZE_Y + 10., .5));
|
||||||
// Gestion de souris.
|
// Gestion de souris.
|
||||||
CenterMouse();
|
CenterMouse();
|
||||||
HideCursor();
|
HideCursor();
|
||||||
@@ -462,67 +462,67 @@ void Engine::LoadResource() {
|
|||||||
//AJOUTER LES TEXTURES DANS L'ORDRE DE L'ÉNUM
|
//AJOUTER LES TEXTURES DANS L'ORDRE DE L'ÉNUM
|
||||||
|
|
||||||
//STILL//STANDING
|
//STILL//STANDING
|
||||||
TextureAtlas::TextureIndex StillFront = m_animeAtlas.AddTexture(ANIME_PATH_STILL "BlueFrontRight.png");
|
TextureAtlas::TextureIndex StillFront = m_animeAtlas.AddTexture(ANIME_PATH_STILL "BlueFrontRight.png"); //0
|
||||||
//TextureAtlas::TextureIndex StillQuarterFrontLeft = m_animeAtlas.AddTexture(ANIME_PATH_STILL "BlueLeft.png");
|
TextureAtlas::TextureIndex StillQuarterFrontLeft = m_animeAtlas.AddTexture(ANIME_PATH_STILL "BlueLeft.png"); //1
|
||||||
//TextureAtlas::TextureIndex StillQuarterFrontRight = m_animeAtlas.AddTexture(ANIME_PATH_STILL "BlueRight.png");
|
TextureAtlas::TextureIndex StillQuarterFrontRight = m_animeAtlas.AddTexture(ANIME_PATH_STILL "BlueRight.png"); //2
|
||||||
//TextureAtlas::TextureIndex StillProfiltLeft = m_animeAtlas.AddTexture(ANIME_PATH_STILL "BlueProfilLeft.png");
|
TextureAtlas::TextureIndex StillProfiltLeft = m_animeAtlas.AddTexture(ANIME_PATH_STILL "BlueProfilLeft.png"); //3
|
||||||
//TextureAtlas::TextureIndex StillProfiltRight = m_animeAtlas.AddTexture(ANIME_PATH_STILL "BlueProfilRight.png");
|
TextureAtlas::TextureIndex StillProfiltRight = m_animeAtlas.AddTexture(ANIME_PATH_STILL "BlueProfilRight.png"); //4
|
||||||
//TextureAtlas::TextureIndex StillQuarterBackLeft = m_animeAtlas.AddTexture(ANIME_PATH_STILL "BlueLeftBack.png");
|
TextureAtlas::TextureIndex StillQuarterBackLeft = m_animeAtlas.AddTexture(ANIME_PATH_STILL "BlueLeftBack.png"); //5
|
||||||
//TextureAtlas::TextureIndex StillQuarterBackRight = m_animeAtlas.AddTexture(ANIME_PATH_STILL "BlueRightBack.png");
|
TextureAtlas::TextureIndex StillQuarterBackRight = m_animeAtlas.AddTexture(ANIME_PATH_STILL "BlueRightBack.png"); //6
|
||||||
//TextureAtlas::TextureIndex StillBack = m_animeAtlas.AddTexture(ANIME_PATH_STILL "BlueBackRight.png");
|
TextureAtlas::TextureIndex StillBack = m_animeAtlas.AddTexture(ANIME_PATH_STILL "BlueBackRight.png"); //7
|
||||||
|
|
||||||
//SHOOTINGSTILL SANS TIRER
|
//SHOOTINGSTILL SANS TIRER
|
||||||
//TextureAtlas::TextureIndex StillFrontShoot = m_animeAtlas.AddTexture(ANIM_PATH_SSHOOT1 "BlueFrontRightShootingRight.png");
|
//TextureAtlas::TextureIndex StillFrontShoot = m_animeAtlas.AddTexture(ANIM_PATH_SSHOOT1 "BlueFrontRightShootingRight.png"); ////9
|
||||||
//TextureAtlas::TextureIndex StillQuarterFrontLeftShoot = m_animeAtlas.AddTexture(ANIM_PATH_SSHOOT1 "BlueFrontRightShootingRight.png");
|
//TextureAtlas::TextureIndex StillQuarterFrontLeftShoot = m_animeAtlas.AddTexture(ANIM_PATH_SSHOOT1 "BlueFrontRightShootingRight.png"); ////10
|
||||||
//TextureAtlas::TextureIndex StillQuarterFrontRightShoot = m_animeAtlas.AddTexture(ANIM_PATH_SSHOOT1 "BlueRightShootingRight.png");
|
//TextureAtlas::TextureIndex StillQuarterFrontRightShoot = m_animeAtlas.AddTexture(ANIM_PATH_SSHOOT1 "BlueRightShootingRight.png"); ////11
|
||||||
//TextureAtlas::TextureIndex StillProfiltLeftShoot = m_animeAtlas.AddTexture(ANIM_PATH_SSHOOT1 "BlueProfilShootingLeft.png");
|
//TextureAtlas::TextureIndex StillProfiltLeftShoot = m_animeAtlas.AddTexture(ANIM_PATH_SSHOOT1 "BlueProfilShootingLeft.png"); ////12
|
||||||
//TextureAtlas::TextureIndex StillProfiltRightShoot = m_animeAtlas.AddTexture(ANIM_PATH_SSHOOT1 "BlueProfilShootingRight.png");
|
//TextureAtlas::TextureIndex StillProfiltRightShoot = m_animeAtlas.AddTexture(ANIM_PATH_SSHOOT1 "BlueProfilShootingRight.png"); ////13
|
||||||
//TextureAtlas::TextureIndex StillQuarterBackLeftShoot = m_animeAtlas.AddTexture(ANIM_PATH_SSHOOT1 "BlueBackLeftShootingLeft.png");
|
//TextureAtlas::TextureIndex StillQuarterBackLeftShoot = m_animeAtlas.AddTexture(ANIM_PATH_SSHOOT1 "BlueBackLeftShootingLeft.png"); ////14
|
||||||
//TextureAtlas::TextureIndex StillQuarterBackRightShoot = m_animeAtlas.AddTexture(ANIM_PATH_SSHOOT1 "BlueBackRightShootingRight.png");
|
//TextureAtlas::TextureIndex StillQuarterBackRightShoot = m_animeAtlas.AddTexture(ANIM_PATH_SSHOOT1 "BlueBackRightShootingRight.png"); ////15
|
||||||
//TextureAtlas::TextureIndex StillBackShoot = m_animeAtlas.AddTexture(ANIM_PATH_SSHOOT1 "BlueShootingBackRight.png");
|
//TextureAtlas::TextureIndex StillBackShoot = m_animeAtlas.AddTexture(ANIM_PATH_SSHOOT1 "BlueShootingBackRight.png"); ////16
|
||||||
|
|
||||||
//SHOOTINGSTILL TIRER
|
//SHOOTINGSTILL TIRER
|
||||||
//TextureAtlas::TextureIndex StillFrontShootFire = m_animeAtlas.AddTexture(ANIM_PATH_SSHOOT2 "BlueFrontRightShootingRightShoot1.png");
|
//TextureAtlas::TextureIndex StillFrontShootFire = m_animeAtlas.AddTexture(ANIM_PATH_SSHOOT2 "BlueFrontRightShootingRightShoot1.png"); ////17
|
||||||
//TextureAtlas::TextureIndex StillQuarterFrontLeftFire = m_animeAtlas.AddTexture(ANIM_PATH_SSHOOT2 "BlueLeftShootingLeftShoot1.png");
|
//TextureAtlas::TextureIndex StillQuarterFrontLeftFire = m_animeAtlas.AddTexture(ANIM_PATH_SSHOOT2 "BlueLeftShootingLeftShoot1.png"); ////18
|
||||||
//TextureAtlas::TextureIndex StillQuarterFrontRightShootFire = m_animeAtlas.AddTexture(ANIM_PATH_SSHOOT2 "BlueRightShootingRightShoot1.png");
|
//TextureAtlas::TextureIndex StillQuarterFrontRightShootFire = m_animeAtlas.AddTexture(ANIM_PATH_SSHOOT2 "BlueRightShootingRightShoot1.png"); ////19
|
||||||
//TextureAtlas::TextureIndex StillProfiltLeftShootFire = m_animeAtlas.AddTexture(ANIM_PATH_SSHOOT2 "BlueProfilShootingLeftShoot1.png");
|
//TextureAtlas::TextureIndex StillProfiltLeftShootFire = m_animeAtlas.AddTexture(ANIM_PATH_SSHOOT2 "BlueProfilShootingLeftShoot1.png"); ////20
|
||||||
//TextureAtlas::TextureIndex StillProfiltRightShootFire = m_animeAtlas.AddTexture(ANIM_PATH_SSHOOT2 "BlueProfilShootingRightShoot1.png");
|
//TextureAtlas::TextureIndex StillProfiltRightShootFire = m_animeAtlas.AddTexture(ANIM_PATH_SSHOOT2 "BlueProfilShootingRightShoot1.png"); ////21
|
||||||
//TextureAtlas::TextureIndex StillQuarterBackLeftShootFire = m_animeAtlas.AddTexture(ANIM_PATH_SSHOOT2 "BlueBackLeftShootingLeftShoot1.png");
|
//TextureAtlas::TextureIndex StillQuarterBackLeftShootFire = m_animeAtlas.AddTexture(ANIM_PATH_SSHOOT2 "BlueBackLeftShootingLeftShoot1.png"); ////22
|
||||||
//TextureAtlas::TextureIndex StillQuarterBackRightShootFire = m_animeAtlas.AddTexture(ANIM_PATH_SSHOOT2 "BlueBackRightShootingRightShoot1.png");
|
//TextureAtlas::TextureIndex StillQuarterBackRightShootFire = m_animeAtlas.AddTexture(ANIM_PATH_SSHOOT2 "BlueBackRightShootingRightShoot1.png"); ////23
|
||||||
//TextureAtlas::TextureIndex StillBackShootFire = m_animeAtlas.AddTexture(ANIM_PATH_SSHOOT2 "BlueShootingBackRightShoot1.png");
|
//TextureAtlas::TextureIndex StillBackShootFire = m_animeAtlas.AddTexture(ANIM_PATH_SSHOOT2 "BlueShootingBackRightShoot1.png"); ////24
|
||||||
|
|
||||||
|
|
||||||
//JUMP
|
//JUMP
|
||||||
//TextureAtlas::TextureIndex JumpFront = m_animeAtlas.AddTexture(ANIME_PATH_JUMP "BlueFrontJumpRight.png");
|
//TextureAtlas::TextureIndex JumpFront = m_animeAtlas.AddTexture(ANIME_PATH_JUMP "BlueFrontJumpRight.png"); ////25
|
||||||
//TextureAtlas::TextureIndex JumpQuarterFrontLeft = m_animeAtlas.AddTexture(ANIME_PATH_JUMP "BlueLeftFrontJumpLeft.png");
|
//TextureAtlas::TextureIndex JumpQuarterFrontLeft = m_animeAtlas.AddTexture(ANIME_PATH_JUMP "BlueLeftFrontJumpLeft.png"); ////26
|
||||||
//TextureAtlas::TextureIndex JumpQuarterFrontRight = m_animeAtlas.AddTexture(ANIME_PATH_JUMP "BlueRightFrontJumpRight.png");
|
//TextureAtlas::TextureIndex JumpQuarterFrontRight = m_animeAtlas.AddTexture(ANIME_PATH_JUMP "BlueRightFrontJumpRight.png"); ////27
|
||||||
//TextureAtlas::TextureIndex JumpProfiltLeft = m_animeAtlas.AddTexture(ANIME_PATH_JUMP "BlueProfilJumpLeft.png");
|
//TextureAtlas::TextureIndex JumpProfiltLeft = m_animeAtlas.AddTexture(ANIME_PATH_JUMP "BlueProfilJumpLeft.png"); ////28
|
||||||
//TextureAtlas::TextureIndex JumpProfiltRight = m_animeAtlas.AddTexture(ANIME_PATH_JUMP "BlueProfilJumpRight.png");
|
//TextureAtlas::TextureIndex JumpProfiltRight = m_animeAtlas.AddTexture(ANIME_PATH_JUMP "BlueProfilJumpRight.png"); ////29
|
||||||
//TextureAtlas::TextureIndex JumpQuarterBackLeft = m_animeAtlas.AddTexture(ANIME_PATH_JUMP "BlueLeftBackJumpLeft.png");
|
//TextureAtlas::TextureIndex JumpQuarterBackLeft = m_animeAtlas.AddTexture(ANIME_PATH_JUMP "BlueLeftBackJumpLeft.png"); ////30
|
||||||
//TextureAtlas::TextureIndex JumpQuarterBackRight = m_animeAtlas.AddTexture(ANIME_PATH_JUMP "BlueRightBackJumpRight.png");
|
//TextureAtlas::TextureIndex JumpQuarterBackRight = m_animeAtlas.AddTexture(ANIME_PATH_JUMP "BlueRightBackJumpRight.png"); ////31
|
||||||
//TextureAtlas::TextureIndex JumpBack = m_animeAtlas.AddTexture(ANIME_PATH_JUMP "BlueBackJumpRight.png");
|
//TextureAtlas::TextureIndex JumpBack = m_animeAtlas.AddTexture(ANIME_PATH_JUMP "BlueBackJumpRight.png"); ////32
|
||||||
|
|
||||||
|
|
||||||
//SHOOTINGJUMP SANS TIRER
|
//SHOOTINGJUMP SANS TIRER
|
||||||
//TextureAtlas::TextureIndex JumpFrontShoot = m_animeAtlas.AddTexture(ANIM_PATH_JSHOOT1 "BlueFrontJumpRightShootingRight.png");
|
//TextureAtlas::TextureIndex JumpFrontShoot = m_animeAtlas.AddTexture(ANIM_PATH_JSHOOT1 "BlueFrontJumpRightShootingRight.png"); ////33
|
||||||
//TextureAtlas::TextureIndex JumpQuarterFrontLeftShoot = m_animeAtlas.AddTexture(ANIM_PATH_JSHOOT1 "BlueFrontLeftJumpLeftShootingLeft.png");
|
//TextureAtlas::TextureIndex JumpQuarterFrontLeftShoot = m_animeAtlas.AddTexture(ANIM_PATH_JSHOOT1 "BlueFrontLeftJumpLeftShootingLeft.png"); ////34
|
||||||
//TextureAtlas::TextureIndex JumpQuarterFrontRightShoot = m_animeAtlas.AddTexture(ANIM_PATH_JSHOOT1 "BlueFrontRightJumpRightShootingRight.png");
|
//TextureAtlas::TextureIndex JumpQuarterFrontRightShoot = m_animeAtlas.AddTexture(ANIM_PATH_JSHOOT1 "BlueFrontRightJumpRightShootingRight.png"); ////35
|
||||||
//TextureAtlas::TextureIndex JumpProfiltLeftShoot = m_animeAtlas.AddTexture(ANIM_PATH_JSHOOT1 "BlueProfilLeftJumpLeftShootingLeft.png");
|
//TextureAtlas::TextureIndex JumpProfiltLeftShoot = m_animeAtlas.AddTexture(ANIM_PATH_JSHOOT1 "BlueProfilLeftJumpLeftShootingLeft.png"); ////36
|
||||||
//TextureAtlas::TextureIndex JumpProfiltRightShoot = m_animeAtlas.AddTexture(ANIM_PATH_JSHOOT1 "BluerProfilRightJumprightShootingRight.png");
|
//TextureAtlas::TextureIndex JumpProfiltRightShoot = m_animeAtlas.AddTexture(ANIM_PATH_JSHOOT1 "BluerProfilRightJumprightShootingRight.png"); ////37
|
||||||
//TextureAtlas::TextureIndex JumpQuarterBackLeftShoot = m_animeAtlas.AddTexture(ANIM_PATH_JSHOOT1 "BlueBackLeftJumpLeftShootingLeft.png");
|
//TextureAtlas::TextureIndex JumpQuarterBackLeftShoot = m_animeAtlas.AddTexture(ANIM_PATH_JSHOOT1 "BlueBackLeftJumpLeftShootingLeft.png"); ////38
|
||||||
//TextureAtlas::TextureIndex JumpQuarterBackRightShoot = m_animeAtlas.AddTexture(ANIM_PATH_JSHOOT1 "BlueBackRightJumpRightShootingRight.png");
|
//TextureAtlas::TextureIndex JumpQuarterBackRightShoot = m_animeAtlas.AddTexture(ANIM_PATH_JSHOOT1 "BlueBackRightJumpRightShootingRight.png"); ////39
|
||||||
//TextureAtlas::TextureIndex JumpBackShoot = m_animeAtlas.AddTexture(ANIM_PATH_JSHOOT1 "BlueBackJumpRightShootingRight.png");
|
//TextureAtlas::TextureIndex JumpBackShoot = m_animeAtlas.AddTexture(ANIM_PATH_JSHOOT1 "BlueBackJumpRightShootingRight.png"); ////40
|
||||||
|
|
||||||
|
|
||||||
//SHOOTINGJUMP TIRER
|
//SHOOTINGJUMP TIRER
|
||||||
//TextureAtlas::TextureIndex JumpFrontShootFire = m_animeAtlas.AddTexture(ANIM_PATH_JSHOOT2 "BlueFrontJumpRightShootingRightShoot1.png");
|
//TextureAtlas::TextureIndex JumpFrontShootFire = m_animeAtlas.AddTexture(ANIM_PATH_JSHOOT2 "BlueFrontJumpRightShootingRightShoot1.png"); ////41
|
||||||
//TextureAtlas::TextureIndex JumpQuarterFrontLeftShootFire = m_animeAtlas.AddTexture(ANIM_PATH_JSHOOT2 "BlueFrontLeftJumpLeftShootingLeftShoot1.png");
|
//TextureAtlas::TextureIndex JumpQuarterFrontLeftShootFire = m_animeAtlas.AddTexture(ANIM_PATH_JSHOOT2 "BlueFrontLeftJumpLeftShootingLeftShoot1.png"); ////42
|
||||||
//TextureAtlas::TextureIndex JumpQuarterFrontRightShootFire = m_animeAtlas.AddTexture(ANIM_PATH_JSHOOT2 "BlueFrontRightJumpRightShootingRightShoot1.png");
|
//TextureAtlas::TextureIndex JumpQuarterFrontRightShootFire = m_animeAtlas.AddTexture(ANIM_PATH_JSHOOT2 "BlueFrontRightJumpRightShootingRightShoot1.png"); ////43
|
||||||
//TextureAtlas::TextureIndex JumpProfiltLeftShootFire = m_animeAtlas.AddTexture(ANIM_PATH_JSHOOT2 "BlueProfilLeftJumpLeftShootingLeftShoot1.png");
|
//TextureAtlas::TextureIndex JumpProfiltLeftShootFire = m_animeAtlas.AddTexture(ANIM_PATH_JSHOOT2 "BlueProfilLeftJumpLeftShootingLeftShoot1.png"); ////44
|
||||||
//TextureAtlas::TextureIndex JumpProfiltRightShootFire = m_animeAtlas.AddTexture(ANIM_PATH_JSHOOT2 "BluerProfilRightJumprightShootingRightShoot1.png");
|
//TextureAtlas::TextureIndex JumpProfiltRightShootFire = m_animeAtlas.AddTexture(ANIM_PATH_JSHOOT2 "BluerProfilRightJumprightShootingRightShoot1.png"); ////45
|
||||||
//TextureAtlas::TextureIndex JumpQuarterBackLeftShootFire = m_animeAtlas.AddTexture(ANIM_PATH_JSHOOT2 "BlueBackLeftJumpLeftShootingLeftShoot1.png");
|
//TextureAtlas::TextureIndex JumpQuarterBackLeftShootFire = m_animeAtlas.AddTexture(ANIM_PATH_JSHOOT2 "BlueBackLeftJumpLeftShootingLeftShoot1.png"); ////46
|
||||||
//TextureAtlas::TextureIndex JumpQuarterBackRightShootFire = m_animeAtlas.AddTexture(ANIM_PATH_JSHOOT2 "BlueBackRightJumpRightShootingRightShoot1.png");
|
//TextureAtlas::TextureIndex JumpQuarterBackRightShootFire = m_animeAtlas.AddTexture(ANIM_PATH_JSHOOT2 "BlueBackRightJumpRightShootingRightShoot1.png"); ////47
|
||||||
//TextureAtlas::TextureIndex JumpBackShootFire = m_animeAtlas.AddTexture(ANIM_PATH_JSHOOT2 "BlueBackJumpRightShootingRightShoot1.png");
|
//TextureAtlas::TextureIndex JumpBackShootFire = m_animeAtlas.AddTexture(ANIM_PATH_JSHOOT2 "BlueBackJumpRightShootingRightShoot1.png"); ////48
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@@ -1193,10 +1193,11 @@ void Engine::Render(float elapsedTime) {
|
|||||||
if (bloc == BTYPE_LAST + 1) bloc = BTYPE_AIR + 1;
|
if (bloc == BTYPE_LAST + 1) bloc = BTYPE_AIR + 1;
|
||||||
else if (bloc == BTYPE_AIR) bloc = BTYPE_LAST; // La selection de BTYPE_LAST <20>quipe l'arme.
|
else if (bloc == BTYPE_AIR) bloc = BTYPE_LAST; // La selection de BTYPE_LAST <20>quipe l'arme.
|
||||||
m_mouseWU = m_mouseWD = m_key1 = m_key2 = false;
|
m_mouseWU = m_mouseWD = m_key1 = m_key2 = false;
|
||||||
|
netprot::ChunkMod* cmod = nullptr;
|
||||||
|
|
||||||
if (m_mouseL) {
|
if (m_mouseL) {
|
||||||
if (bloc != BTYPE_LAST)
|
if (bloc != BTYPE_LAST)
|
||||||
m_world.ChangeBlockAtCursor(bloc, m_player.GetPosition(), m_player.GetDirection(), m_block);
|
cmod = m_world.ChangeBlockAtCursor(bloc, m_player.GetPosition(), m_player.GetDirection(), m_block, m_networkgame);
|
||||||
else if (bulletTime <= 0.f) {
|
else if (bulletTime <= 0.f) {
|
||||||
for (int x = 0; x < MAX_BULLETS; ++x) // Ajouter une balle dans l'array (aussi connu sous le nom de "faire pow pow").
|
for (int x = 0; x < MAX_BULLETS; ++x) // Ajouter une balle dans l'array (aussi connu sous le nom de "faire pow pow").
|
||||||
if (!m_bullets[x]) {
|
if (!m_bullets[x]) {
|
||||||
@@ -1218,12 +1219,12 @@ void Engine::Render(float elapsedTime) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if (m_mouseR)
|
else if (m_mouseR)
|
||||||
m_world.ChangeBlockAtCursor(BTYPE_AIR, m_player.GetPosition(), m_player.GetDirection(), m_block);
|
cmod = m_world.ChangeBlockAtCursor(BTYPE_AIR, m_player.GetPosition(), m_player.GetDirection(), m_block, m_networkgame);
|
||||||
|
|
||||||
for (int x = 0; x < MAX_BULLETS; ++x) { // Array de bullets en jeu.
|
for (int x = 0; x < MAX_BULLETS; ++x) { // Array de bullets en jeu.
|
||||||
if (m_bullets[x]) {
|
if (m_bullets[x]) {
|
||||||
for (int b = 0; b < BULLET_UPDATES_PER_FRAME; ++b) {
|
for (int b = 0; b < BULLET_UPDATES_PER_FRAME; ++b) {
|
||||||
if (m_bullets[x]->Update(&m_world, elapsedTime, BULLET_UPDATES_PER_FRAME, m_players)) {
|
if (m_bullets[x]->Update(&m_world, elapsedTime, BULLET_UPDATES_PER_FRAME, m_players, m_networkgame ? &m_chunkmod : nullptr)) {
|
||||||
m_bullets[x]->~Bullet();
|
m_bullets[x]->~Bullet();
|
||||||
if (m_whoosh[x])
|
if (m_whoosh[x])
|
||||||
m_whoosh[x]->drop();
|
m_whoosh[x]->drop();
|
||||||
@@ -1248,6 +1249,8 @@ void Engine::Render(float elapsedTime) {
|
|||||||
m_renderer.UpdateMesh(&m_world, m_player.GetPosition(), m_blockinfo);
|
m_renderer.UpdateMesh(&m_world, m_player.GetPosition(), m_blockinfo);
|
||||||
|
|
||||||
//m_booster.RenderBillboard({ 195,16,195 }, m_textureAtlas, m_shader01, all);
|
//m_booster.RenderBillboard({ 195,16,195 }, m_textureAtlas, m_shader01, all);
|
||||||
|
/* m_remotePlayer.ApplyPhysics(Vector3f(0, 0, 0), &m_world, elapsedTime);
|
||||||
|
m_remotePlayer.Render(m_animeAtlas, m_shader01, all ,elapsedTime , m_player);*/
|
||||||
|
|
||||||
m_renderer.RenderWorld(&m_world, m_renderCount, m_player.GetPosition(), m_player.GetDirection(), all, m_shader01, m_textureAtlas);
|
m_renderer.RenderWorld(&m_world, m_renderCount, m_player.GetPosition(), m_player.GetDirection(), all, m_shader01, m_textureAtlas);
|
||||||
|
|
||||||
@@ -1282,6 +1285,9 @@ void Engine::Render(float elapsedTime) {
|
|||||||
static std::vector<char*> lsPck;
|
static std::vector<char*> lsPck;
|
||||||
static int sync_acc = 0;
|
static int sync_acc = 0;
|
||||||
|
|
||||||
|
if (cmod)
|
||||||
|
m_chunkmod_manifest.emplace_back(cmod);
|
||||||
|
|
||||||
if (last == 0)
|
if (last == 0)
|
||||||
last = tstamp;
|
last = tstamp;
|
||||||
|
|
||||||
@@ -1339,8 +1345,6 @@ void Engine::Render(float elapsedTime) {
|
|||||||
if (diff.y < 1.)
|
if (diff.y < 1.)
|
||||||
diff.y = 0;
|
diff.y = 0;
|
||||||
|
|
||||||
//std::cout << sync.timestamp << " ms: " << comp.position << " - " << sync.position << " Diff: " << diff.Length() << std::endl;
|
|
||||||
|
|
||||||
if (diff.Length() > 1.5) {
|
if (diff.Length() > 1.5) {
|
||||||
diff.Normalize();
|
diff.Normalize();
|
||||||
m_player.Move(-diff);
|
m_player.Move(-diff);
|
||||||
@@ -1375,7 +1379,7 @@ void Engine::Render(float elapsedTime) {
|
|||||||
for (auto& [key, player] : m_players) {
|
for (auto& [key, player] : m_players) {
|
||||||
RemotePlayer* rt = static_cast<RemotePlayer*>(player);
|
RemotePlayer* rt = static_cast<RemotePlayer*>(player);
|
||||||
glClear(GL_STENCIL_BUFFER_BIT);
|
glClear(GL_STENCIL_BUFFER_BIT);
|
||||||
rt->Render(m_animeAtlas, m_shader01, all, elapsedTime);
|
rt->Render(m_animeAtlas, m_shader01, all, elapsedTime, m_player);
|
||||||
m_otherplayerpos = player->GetPosition(); // Aller chercher GetPosition des deux façon, voir si ça chie.
|
m_otherplayerpos = player->GetPosition(); // Aller chercher GetPosition des deux façon, voir si ça chie.
|
||||||
}
|
}
|
||||||
glEnable(GL_CULL_FACE);
|
glEnable(GL_CULL_FACE);
|
||||||
|
@@ -101,10 +101,12 @@ private:
|
|||||||
Player m_player = Player(Vector3f(.5f, CHUNK_SIZE_Y + 1.8f, .5f));
|
Player m_player = Player(Vector3f(.5f, CHUNK_SIZE_Y + 1.8f, .5f));
|
||||||
|
|
||||||
Bullet* m_bullets[MAX_BULLETS];
|
Bullet* m_bullets[MAX_BULLETS];
|
||||||
|
std::vector<netprot::ChunkMod*> m_chunkmod_manifest;
|
||||||
|
|
||||||
std::unordered_map<uint64_t, Player*> m_players;
|
std::unordered_map<uint64_t, Player*> m_players;
|
||||||
netprot::Buffer m_buf, m_bufout;
|
netprot::Buffer m_buf, m_bufout;
|
||||||
std::chrono::high_resolution_clock::time_point m_startTime;
|
std::chrono::high_resolution_clock::time_point m_startTime;
|
||||||
|
netprot::ChunkMod* m_chunkmod = nullptr;
|
||||||
|
|
||||||
//Menu
|
//Menu
|
||||||
enum class GameState: uint8_t { MAIN_MENU, OPTIONS, QUIT, NEWG, PLAY, PAUSE };
|
enum class GameState: uint8_t { MAIN_MENU, OPTIONS, QUIT, NEWG, PLAY, PAUSE };
|
||||||
|
@@ -10,13 +10,13 @@
|
|||||||
|
|
||||||
RemotePlayer::RemotePlayer(netprot::PlayerInfo pinfo) : m_pinfo(pinfo), m_aminacc(0.0f), m_animstate(Anim::STILL), m_team_id(0), current(), previous(), m_texture_front(), Player(Vector3f(0, 0, 0)){
|
RemotePlayer::RemotePlayer(netprot::PlayerInfo pinfo) : m_pinfo(pinfo), m_aminacc(0.0f), m_animstate(Anim::STILL), m_team_id(0), current(), previous(), m_texture_front(), Player(Vector3f(0, 0, 0)){
|
||||||
|
|
||||||
LoadTexture(m_texture_front, TEXTURE_PATH "AssetOtherPlayer/FinalPNGStanding/BlueFrontRight.png", false, false);
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
RemotePlayer::RemotePlayer(netprot::PlayerInfo pinfo, const Vector3f& pos) : m_pinfo(pinfo), m_aminacc(0.0f), m_animstate(Anim::STILL), m_team_id(0), current(), previous(), m_texture_front(), Player(pos) {
|
RemotePlayer::RemotePlayer(netprot::PlayerInfo pinfo, const Vector3f& pos) : m_pinfo(pinfo), m_aminacc(0.0f), m_animstate(Anim::STILL), m_team_id(0), current(), previous(), m_texture_front(), Player(pos) {
|
||||||
|
|
||||||
LoadTexture(m_texture_front, TEXTURE_PATH "AssetOtherPlayer/FinalPNGStanding/BlueFrontRight.png", false, false);
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -81,31 +81,67 @@ void RemotePlayer::Feed(const netprot::Output out) {
|
|||||||
//m_position = current.position;
|
//m_position = current.position;
|
||||||
}
|
}
|
||||||
|
|
||||||
void RemotePlayer::Render(TextureAtlas& atlas, Shader& shader, Transformation tran, float elapsedTime)
|
|
||||||
|
|
||||||
|
|
||||||
|
void RemotePlayer::Render(TextureAtlas& atlas, Shader& shader, Transformation tran, float elapsedTime, Player& camera)
|
||||||
{
|
{
|
||||||
float x = GetPosition().x;
|
|
||||||
float y = GetPosition().y;
|
|
||||||
float z = GetPosition().z;
|
|
||||||
float width = 1.f;
|
float width = 1.f;
|
||||||
float height = 1.7f;
|
float height = 1.7f;
|
||||||
|
|
||||||
//Matrix4 mat4 = tran.GetMatrix();
|
Vector3f DiffCam = GetPosition() - camera.GetPosition();
|
||||||
//mat4 VP = pMatrix * vMatrix;
|
Vector3f UpCam = Vector3f(0.f, 1.f, 0.f);
|
||||||
//Vector3f CameraRight = Vector3f(mat4.Get11(), mat4.Get21(), mat4.Get31());
|
Vector3f CrossA = DiffCam.Cross(UpCam);
|
||||||
//Vector3f CameraUp = Vector3f(mat4.Get12(), mat4.Get22(), mat4.Get32());
|
Vector3f CrossB = DiffCam.Cross(CrossA);
|
||||||
|
CrossA.Normalize();
|
||||||
|
CrossB.Normalize();
|
||||||
|
Vector3f playerPosition = GetPosition() + Vector3f(0.f, -.75f, 0.f);
|
||||||
|
Vector3f v2 = (playerPosition + CrossA * 0.5 * width + CrossB * 0.5 * height);
|
||||||
|
Vector3f v1 = (playerPosition - CrossA * 0.5 * width + CrossB * 0.5 * height);
|
||||||
|
Vector3f v3 = (playerPosition + CrossA * 0.5 * width - CrossB * 0.5 * height);
|
||||||
|
Vector3f v4 = (playerPosition - CrossA * 0.5 * width - CrossB * 0.5 * height);
|
||||||
|
|
||||||
//Vector3f v1 = (m_position + CameraRight * 0.5 * width + CameraUp * -0.5 * width);
|
Vector3f angleRemote = GetDirection();
|
||||||
//Vector3f v2 = (m_position + CameraRight * 0.5 * width + CameraUp * 0.5 * width);
|
Vector3f angleCam = (v1 - v2).Cross(v3 - v2);
|
||||||
//Vector3f v4 = (m_position + CameraRight * -0.5 * width + CameraUp * -0.5 * width);
|
angleCam.y = 0;
|
||||||
//Vector3f v3 = (m_position + CameraRight * -0.5 * width + CameraUp * 0.5 * width);
|
angleRemote.y = 0;
|
||||||
|
angleCam.Normalize();
|
||||||
|
angleRemote.Normalize();
|
||||||
|
|
||||||
|
float angle = angleRemote.Dot(angleCam);
|
||||||
|
int index = 0;
|
||||||
|
|
||||||
|
Vector3f side = angleRemote.Cross(angleCam);
|
||||||
|
|
||||||
|
|
||||||
|
bool isLeft = side.y > 0;
|
||||||
|
if (angle >= 0.75 ) //Face //side positif
|
||||||
|
index = 0;
|
||||||
|
else if (angle >= 0.25 && isLeft) //Frontleft
|
||||||
|
index = 1;
|
||||||
|
else if (angle >= -0.25 && isLeft) //ProfileLeft
|
||||||
|
index = 3;
|
||||||
|
else if (angle >= -0.75 && isLeft) //BackLeft
|
||||||
|
index = 5;
|
||||||
|
else if (angle < -0.75) //Dos //side n<>gatif
|
||||||
|
index = 7;
|
||||||
|
else if (angle >= 0.25 && !isLeft) //FrontRight
|
||||||
|
index = 2;
|
||||||
|
else if (angle >= -0.25 && !isLeft) //ProfileRight
|
||||||
|
index = 4;
|
||||||
|
else if (angle >= -0.75 && !isLeft) //BackRight
|
||||||
|
index = 6;
|
||||||
|
|
||||||
|
std::cout << index << std::endl;
|
||||||
|
|
||||||
|
std::cout << "angle: " << angle << std::endl;
|
||||||
|
|
||||||
//tran.ApplyTranslation(m_position);
|
|
||||||
float u, v, w, h;
|
float u, v, w, h;
|
||||||
//glDisable(GL_DEPTH_TEST);
|
|
||||||
shader.Use();
|
shader.Use();
|
||||||
atlas.Bind();
|
atlas.Bind();
|
||||||
atlas.TextureIndexToCoord(0, u, v, w, h);
|
atlas.TextureIndexToCoord(index, u, v, w, h);
|
||||||
//glLoadIdentity();
|
|
||||||
|
|
||||||
glEnable(GL_BLEND);
|
glEnable(GL_BLEND);
|
||||||
glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
|
glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
|
||||||
@@ -113,20 +149,19 @@ void RemotePlayer::Render(TextureAtlas& atlas, Shader& shader, Transformation tr
|
|||||||
|
|
||||||
glLoadMatrixf(tran.GetMatrix().GetInternalValues());
|
glLoadMatrixf(tran.GetMatrix().GetInternalValues());
|
||||||
glBegin(GL_QUADS);
|
glBegin(GL_QUADS);
|
||||||
glTexCoord2f(u, v); glVertex3f(x - width/2., y - height, z); //glVertex3f(v4.x, v4.y, v4.z);//glVertex3f(0, 50, 0);
|
glTexCoord2f(u, v); glVertex3f(v1.x, v1.y, v1.z);
|
||||||
glTexCoord2f(u + w, v); glVertex3f(x+width/2., y - height, z); //glVertex3f(v3.x, v3.y, v3.z); //glVertex3f(50,50, 0);
|
glTexCoord2f(u + w, v); glVertex3f(v2.x, v2.y, v2.z);
|
||||||
glTexCoord2f(u + w, v + h); glVertex3f(x+width/2., y, z); //glVertex3f(v2.x, v2.y, v2.z); //glVertex3f(50, 0, 0);
|
glTexCoord2f(u + w, v + h); glVertex3f(v3.x, v3.y, v3.z);
|
||||||
glTexCoord2f(u, v + h); glVertex3f(x-width/2., y, z); //glVertex3f(v1.x, v1.y, v1.z);// glVertex3f(0, 0, 0);
|
glTexCoord2f(u, v + h); glVertex3f(v4.x, v4.y, v4.z);
|
||||||
glEnd();
|
|
||||||
|
|
||||||
|
glEnd();
|
||||||
|
|
||||||
glBlendFunc(GL_CONSTANT_COLOR, GL_ONE_MINUS_CONSTANT_COLOR);
|
glBlendFunc(GL_CONSTANT_COLOR, GL_ONE_MINUS_CONSTANT_COLOR);
|
||||||
glBlendEquation(GL_FUNC_SUBTRACT);
|
glBlendEquation(GL_FUNC_SUBTRACT);
|
||||||
glDisable(GL_BLEND);
|
glDisable(GL_BLEND);
|
||||||
|
|
||||||
shader.Disable();
|
shader.Disable();
|
||||||
//tran.ApplyTranslation(-m_position);
|
|
||||||
//glEnable(GL_DEPTH_TEST);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
bool RemotePlayer::LoadTexture(Texture& texture, const std::string& filename, bool useMipmaps, bool stopOnError)
|
bool RemotePlayer::LoadTexture(Texture& texture, const std::string& filename, bool useMipmaps, bool stopOnError)
|
||||||
|
@@ -21,7 +21,7 @@ public:
|
|||||||
|
|
||||||
void Init();
|
void Init();
|
||||||
void Feed(const netprot::Output out);
|
void Feed(const netprot::Output out);
|
||||||
void Render(TextureAtlas& atlas, Shader& shader, Transformation tran, float elapsedTime);
|
void Render(TextureAtlas& atlas, Shader& shader, Transformation tran, float elapsedTime, Player& camera);
|
||||||
bool LoadTexture(Texture& texture, const std::string& filename, bool useMipmaps, bool stopOnError);
|
bool LoadTexture(Texture& texture, const std::string& filename, bool useMipmaps, bool stopOnError);
|
||||||
|
|
||||||
void SetPosition(Vector3f pos) { m_position = pos; }
|
void SetPosition(Vector3f pos) { m_position = pos; }
|
||||||
|
Reference in New Issue
Block a user