Before the merge....
This commit is contained in:
parent
4841e8d5ba
commit
988b2c330c
@ -5,7 +5,7 @@
|
||||
Connection::Connection(SOCKET sock,
|
||||
sockaddr_in sockaddr,
|
||||
LoginInfo log,
|
||||
PlayerInfo play):
|
||||
PlayerInfo play) :
|
||||
m_sock(sock),
|
||||
m_addr(sockaddr),
|
||||
m_loginfo(log),
|
||||
@ -15,7 +15,7 @@ Connection::Connection(SOCKET sock,
|
||||
|
||||
Connection::~Connection() { closesocket(m_sock); }
|
||||
|
||||
uint64_t Connection::GetHash(bool self) const { return self? m_loginfo.sid: m_playinfo.id; }
|
||||
uint64_t Connection::GetHash(bool self) const { return self ? m_loginfo.sid : m_playinfo.id; }
|
||||
|
||||
uint64_t Connection::GetTeamHash() const { return m_loginfo.tid; }
|
||||
|
||||
@ -151,7 +151,10 @@ Timestamp Connection::Run(World* world) {
|
||||
out.states.dead = true;
|
||||
}
|
||||
|
||||
static bool toggle = false;
|
||||
if (in.keys.block) {
|
||||
if (!toggle) {
|
||||
toggle = true;
|
||||
bool block = false;
|
||||
ChunkMod* cmod = world->ChangeBlockAtCursor(BLOCK_TYPE::BTYPE_METAL,
|
||||
player->GetPosition(),
|
||||
@ -160,10 +163,13 @@ Timestamp Connection::Run(World* world) {
|
||||
if (cmod)
|
||||
ChunkDiffs.emplace_back(cmod);
|
||||
}
|
||||
}
|
||||
else toggle = false;
|
||||
|
||||
if (in.keys.shoot && m_shoot_acc <= 0.) {
|
||||
Bullets.emplace_back(new Bullet(player->GetPOV() + player->GetDirection(), player->GetDirection(), GetHash(true)));
|
||||
out.states.shooting = true;
|
||||
m_shoot_acc = BULLET_TIME;
|
||||
}
|
||||
|
||||
out.position = player->GetPositionAbs();
|
||||
@ -181,10 +187,10 @@ Timestamp Connection::Run(World* world) {
|
||||
}
|
||||
|
||||
void Connection::CleanInputManifest(Timestamp time) {
|
||||
// auto wat = m_input_manifest.find(time);
|
||||
// auto wat = m_input_manifest.find(time);
|
||||
|
||||
// while (wat != m_input_manifest.begin())
|
||||
// m_input_manifest.erase(wat--);
|
||||
// while (wat != m_input_manifest.begin())
|
||||
// m_input_manifest.erase(wat--);
|
||||
}
|
||||
|
||||
Timestamp Connection::GetTStamp() const { return m_tstamp; }
|
||||
|
@ -1267,20 +1267,17 @@ void Engine::Render(float elapsedTime) {
|
||||
|
||||
m_player.ApplyTransformation(remotePlayer, true, false);
|
||||
|
||||
if (m_key1) bloc++;
|
||||
else if (m_key2) bloc--;
|
||||
//if (m_key1) bloc++;
|
||||
//else if (m_key2) bloc--;
|
||||
|
||||
if (m_mouseWU) bloc++;
|
||||
else if (m_mouseWD) bloc--;
|
||||
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.
|
||||
//if (m_mouseWU) bloc++;
|
||||
//else if (m_mouseWD) bloc--;
|
||||
//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.
|
||||
m_mouseWU = m_mouseWD = m_key1 = m_key2 = false;
|
||||
netprot::ChunkMod* cmod = nullptr;
|
||||
|
||||
if (m_mouseL) {
|
||||
if (bloc != BTYPE_LAST)
|
||||
cmod = m_world.ChangeBlockAtCursor(bloc, m_player.GetPosition(), m_player.GetDirection(), m_block, m_networkgame);
|
||||
else if (bulletTime <= 0.f) {
|
||||
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").
|
||||
if (!m_bullets[x]) {
|
||||
m_bullets[x] = new Bullet(m_player.GetPOV() + m_player.GetDirection(), m_player.GetDirection());
|
||||
@ -1301,7 +1298,35 @@ void Engine::Render(float elapsedTime) {
|
||||
}
|
||||
}
|
||||
else if (m_mouseR)
|
||||
cmod = m_world.ChangeBlockAtCursor(BTYPE_AIR, m_player.GetPosition(), m_player.GetDirection(), m_block, m_networkgame);
|
||||
cmod = m_world.ChangeBlockAtCursor(BTYPE_METAL, m_player.GetPosition(), m_player.GetDirection(), m_block, m_networkgame);
|
||||
|
||||
|
||||
|
||||
//if (m_mouseL) {
|
||||
// if (bloc != BTYPE_LAST)
|
||||
// cmod = m_world.ChangeBlockAtCursor(bloc, m_player.GetPosition(), m_player.GetDirection(), m_block, m_networkgame);
|
||||
// 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").
|
||||
// if (!m_bullets[x]) {
|
||||
// m_bullets[x] = new Bullet(m_player.GetPOV() + m_player.GetDirection(), m_player.GetDirection());
|
||||
// break;
|
||||
// }
|
||||
// else if (x == MAX_BULLETS - 1) { // S'il y a pas d'espace dans l'array, prendre la place de la première balle de l'array.
|
||||
// m_bullets[0]->~Bullet();
|
||||
// m_bullets[0] = new Bullet(m_player.GetPOV() + m_player.GetDirection(), m_player.GetDirection());
|
||||
// }
|
||||
// bulletTime = BULLET_TIME;
|
||||
// m_audio.Create3DAudioObj(m_powpow, AUDIO_PATH "pow.wav", m_player.GetPOV(), m_player.GetDirection() * 10, false, .5f);
|
||||
// if (m_flash) { // Coupe le rendering et affiche un frame blanc, pour simuler un flash.
|
||||
// glClearColor(.8f, .8f, .8f, 1.f);
|
||||
// glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT | GL_STENCIL_BUFFER_BIT);
|
||||
// glClearColor(0.f, 0.f, 0.f, 1.f);
|
||||
// return;
|
||||
// }
|
||||
// }
|
||||
//}
|
||||
//else if (m_mouseR)
|
||||
// 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.
|
||||
if (m_bullets[x]) {
|
||||
|
Loading…
x
Reference in New Issue
Block a user