Merge branch 'master' into SQC-18_Mecanique_de_combat
This commit is contained in:
@@ -7,8 +7,9 @@ Bullet::Bullet(Vector3f pos, Vector3f dir, uint64_t tid): m_startpos(pos), m_cur
|
||||
|
||||
Bullet::~Bullet() {}
|
||||
|
||||
bool Bullet::Update(World* world, float elapsedtime) {
|
||||
for (int x = 0; x < 1000; ++x) {
|
||||
bool Bullet::Update(World* world, float elapsedtime, int perframe) {
|
||||
int max = 100 / perframe;
|
||||
for (int x = 0; x < max; ++x) {
|
||||
m_currentpos += m_velocity * elapsedtime;
|
||||
|
||||
if (!world->ChunkAt(m_currentpos))
|
||||
@@ -30,10 +31,14 @@ void Bullet::Transpose(int& x, int& z) {
|
||||
m_startpos.z -= z * CHUNK_SIZE_Z;
|
||||
}
|
||||
|
||||
Vector3f Bullet::getPos() {
|
||||
Vector3f Bullet::getPos() const {
|
||||
return m_currentpos;
|
||||
}
|
||||
|
||||
Vector3f Bullet::getVel() const {
|
||||
return m_velocity;
|
||||
}
|
||||
|
||||
uint64_t Bullet::getTeamID(){
|
||||
return m_tid;
|
||||
}
|
||||
|
@@ -12,9 +12,10 @@ public:
|
||||
Bullet(Vector3f pos, Vector3f dir, uint64_t tid);
|
||||
~Bullet();
|
||||
|
||||
bool Update(World* world, float elapsedtime);
|
||||
bool Update(World* world, float elapsedtime, int perframe);
|
||||
void Transpose(int& x, int& z);
|
||||
Vector3f getPos();
|
||||
Vector3f getPos() const;
|
||||
Vector3f getVel() const;
|
||||
uint64_t getTeamID();
|
||||
|
||||
private:
|
||||
|
@@ -53,6 +53,7 @@ typedef uint64_t Timestamp;
|
||||
#include <sys/socket.h>
|
||||
#include <arpa/inet.h>
|
||||
#include <netinet/in.h>
|
||||
#include <cstring>
|
||||
|
||||
#define SOCKET int
|
||||
#define INVALID_SOCKET -1
|
||||
|
@@ -130,7 +130,7 @@ void World::GetScope(unsigned int& x, unsigned int& y) {
|
||||
y = m_center[1];
|
||||
}
|
||||
|
||||
void World::Update(Bullet* bullets[MAX_BULLETS], Vector3f& player_pos, BlockInfo* blockinfo[BTYPE_LAST]) {
|
||||
void World::Update(Bullet* bullets[MAX_BULLETS], const Vector3f& player_pos, BlockInfo* blockinfo[BTYPE_LAST]) {
|
||||
UpdateWorld(player_pos, blockinfo);
|
||||
//TransposeWorld(player_pos, bullets);
|
||||
}
|
||||
@@ -407,4 +407,4 @@ void World::UpdateWorld(const Vector3f& player, BlockInfo* blockinfo[BTYPE_LAST]
|
||||
}*/
|
||||
}
|
||||
|
||||
int World::GettbDeleted() const { return m_tbDeleted.size(); }
|
||||
int World::GettbDeleted() const { return m_tbDeleted.size(); }
|
||||
|
@@ -30,7 +30,7 @@ public:
|
||||
BlockType BlockAt(float x, float y, float z, BlockType defaultBlockType = BTYPE_AIR) const;
|
||||
BlockType BlockAt(const Vector3f& pos, BlockType defaultBlockType = BTYPE_AIR) const;
|
||||
|
||||
void Update(Bullet* bullets[MAX_BULLETS], Vector3f& player_pos, BlockInfo* blockinfo[BTYPE_LAST]);
|
||||
void Update(Bullet* bullets[MAX_BULLETS], const Vector3f& player_pos, BlockInfo* blockinfo[BTYPE_LAST]);
|
||||
|
||||
void GetScope(unsigned int& x, unsigned int& y);
|
||||
|
||||
|
Reference in New Issue
Block a user