Merge pull request #30 from CegepSTH/SQC-35_nouvelles_structures
Sqc 35 nouvelles structures
This commit is contained in:
commit
488fe55410
@ -36,7 +36,7 @@ Chunk::Chunk(unsigned int x, unsigned int y, int64_t seed) : m_posX(x), m_posY(y
|
||||
float height = simplex.eval(xnoiz, ynoiz) * 50.f;// +1.f;
|
||||
for (int iy = 0; iy <= (int)height % CHUNK_SIZE_Y; ++iy) {
|
||||
if (GetBlock(ix, iy, iz) == BTYPE_AIR)
|
||||
SetBlock(ix, iy, iz, BTYPE_GRASS, nullptr);
|
||||
SetBlock(ix, iy, iz, BTYPE_GREENGRASS, nullptr);
|
||||
}
|
||||
}
|
||||
for (int ix = 0; ix < CHUNK_SIZE_X; ++ix) // "Lacs"
|
||||
@ -46,6 +46,37 @@ Chunk::Chunk(unsigned int x, unsigned int y, int64_t seed) : m_posX(x), m_posY(y
|
||||
SetBlock(ix, iy, iz, BTYPE_ICE, nullptr);
|
||||
}
|
||||
}
|
||||
|
||||
int rnd = rand() % 15;
|
||||
if (rnd == 4)
|
||||
for (int ix = 0; ix < CHUNK_SIZE_X; ++ix) // structure
|
||||
for (int iz = 0; iz < CHUNK_SIZE_Z; ++iz) {
|
||||
for (int iy = 0; iy < 14; ++iy) {
|
||||
if (ix == 3)
|
||||
if (GetBlock(ix, iy, iz) == BTYPE_AIR)
|
||||
Structure(ix, iy, iz, 2);
|
||||
}
|
||||
}
|
||||
if (rnd == 3)
|
||||
for (int ix = 0; ix < CHUNK_SIZE_Z; ++ix) // structure
|
||||
for (int iz = 0; iz < CHUNK_SIZE_X; ++iz) {
|
||||
for (int iy = 0; iy < 14; ++iy) {
|
||||
if (iz == 4)
|
||||
if (GetBlock(ix, iy, iz) == BTYPE_AIR)
|
||||
Structure(ix, iy, iz, 2);
|
||||
}
|
||||
}
|
||||
if (rnd == 6)
|
||||
for (int ix = 0; ix < CHUNK_SIZE_X; ++ix) // structure
|
||||
for (int iz = 0; iz < CHUNK_SIZE_Z; ++iz) {
|
||||
for (int iy = 0; iy < 14; ++iy) {
|
||||
if (ix == 3)
|
||||
if (GetBlock(ix, iy, iz) == BTYPE_AIR)
|
||||
Structure(ix, iy, iz, 2);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
//for (int ix = 0; ix < CHUNK_SIZE_X; ++ix) // "Arbres"
|
||||
// for (int iz = 0; iz < CHUNK_SIZE_Z; ++iz) {
|
||||
// float xnoiz, ynoiz;
|
||||
@ -61,8 +92,8 @@ Chunk::Chunk(unsigned int x, unsigned int y, int64_t seed) : m_posX(x), m_posY(y
|
||||
// break;
|
||||
// }
|
||||
// }
|
||||
/* }
|
||||
else {
|
||||
/* }
|
||||
else {
|
||||
input.seekg(0, std::ios_base::end);
|
||||
int size = input.tellg();
|
||||
input.seekg(0, std::ios_base::beg);
|
||||
@ -75,7 +106,7 @@ Chunk::Chunk(unsigned int x, unsigned int y, int64_t seed) : m_posX(x), m_posY(y
|
||||
for (int iz = 0; iz < CHUNK_SIZE_Z; ++iz)
|
||||
for (int iy = 0; iy < CHUNK_SIZE_Y; ++iy)
|
||||
m_blocks.Set(ix, iy, iz, data[ix + (iz * CHUNK_SIZE_X) + (iy * CHUNK_SIZE_Z * CHUNK_SIZE_X)]);
|
||||
}*/
|
||||
}*/
|
||||
}
|
||||
|
||||
Chunk::~Chunk() {
|
||||
@ -140,3 +171,31 @@ void Chunk::MakeClean() { m_isDirty = false; }
|
||||
|
||||
void Chunk::MakeModified() { m_isModified = true; }
|
||||
|
||||
|
||||
void Chunk::Structure(int x, int y, int z,int height)
|
||||
{
|
||||
|
||||
|
||||
|
||||
for (int i = 0; i < height; i++)
|
||||
{
|
||||
SetBlock(x, i + y, z, BTYPE_GRASS, nullptr);
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
@ -28,6 +28,7 @@ class Chunk {
|
||||
void CheckNeighbors(unsigned int x, unsigned int z, World* world);
|
||||
void GetPosition(unsigned int& x, unsigned int& y) const;
|
||||
|
||||
void Structure(int x, int y, int z, int height);
|
||||
bool IsDirty() const;
|
||||
void MakeDirty();
|
||||
void MakeClean();
|
||||
|
@ -9,9 +9,9 @@
|
||||
|
||||
#define BUFFER_LENGTH 1500
|
||||
|
||||
#define CHUNK_SIZE_X 4
|
||||
#define CHUNK_SIZE_X 6
|
||||
#define CHUNK_SIZE_Y 64
|
||||
#define CHUNK_SIZE_Z 4
|
||||
#define CHUNK_SIZE_Z 6
|
||||
#define MAX_SELECTION_DISTANCE 5
|
||||
#define SEED 0
|
||||
#define COUNTDOWN 300
|
||||
@ -38,8 +38,8 @@
|
||||
#define BULLET_TIME .1
|
||||
|
||||
typedef uint8_t BlockType;
|
||||
enum BLOCK_TYPE { BTYPE_AIR, BTYPE_DIRT, BTYPE_GRASS, BTYPE_METAL, BTYPE_ICE, BTYPE_GREENGRASS, BTYPE_LAST };
|
||||
typedef uint8_t BoostType;
|
||||
enum BLOCK_TYPE { BTYPE_AIR, BTYPE_DIRT, BTYPE_GRASS, BTYPE_METAL, BTYPE_ICE, BTYPE_LAST };
|
||||
enum BOOST_TYPE { BTYPE_SPEED, BTYPE_HEAL, BTYPE_DAMAGE, BTYPE_INVINCIBLE, BTYPE_BOOST_LAST };
|
||||
enum ANIM_TYPE { STILL = 0, SHOOTING = 8, JUMPING = 16, JUMPINGSHOOTING = 24, DEAD = 32, TYPE_LAST = 40};
|
||||
enum ANIM_POS {FRONT, QUARTER_FRONT_LEFT, QUATER_FRONT_RIGHT, PROFIL_LEFT, PROFIL_RIGHT, QUARTER_BACK_LEFT, QUARTER_BACK_RIGHT, BACK , POS_LAST};
|
||||
|
@ -450,6 +450,7 @@ void Engine::LoadResource() {
|
||||
TextureAtlas::TextureIndex texIceIndex = m_textureAtlas.AddTexture(TEXTURE_PATH "metal2.png");
|
||||
TextureAtlas::TextureIndex texGrassIndex = m_textureAtlas.AddTexture(TEXTURE_PATH "grass.png");
|
||||
TextureAtlas::TextureIndex texMetalIndex = m_textureAtlas.AddTexture(TEXTURE_PATH "dirt.png");
|
||||
TextureAtlas::TextureIndex texGreenGrassIndex = m_textureAtlas.AddTexture(TEXTURE_PATH "greengrass.png");
|
||||
TextureAtlas::TextureIndex texBoostHeal = m_textureAtlas.AddTexture(BOOSTER_TEXTURE_PATH "BoosterVert.png");
|
||||
TextureAtlas::TextureIndex texBoostDmg = m_textureAtlas.AddTexture(BOOSTER_TEXTURE_PATH "BoosterRouge.png");
|
||||
TextureAtlas::TextureIndex texBoostSpd = m_textureAtlas.AddTexture(BOOSTER_TEXTURE_PATH "BoosterBleu.png");
|
||||
@ -500,6 +501,8 @@ void Engine::LoadResource() {
|
||||
m_blockinfo[BTYPE_METAL] = new BlockInfo(BTYPE_METAL, "Metal", u, v, s, 1);
|
||||
m_textureAtlas.TextureIndexToCoord(texIceIndex, u, v, s, s);
|
||||
m_blockinfo[BTYPE_ICE] = new BlockInfo(BTYPE_ICE, "Ice", u, v, s, 1);
|
||||
m_textureAtlas.TextureIndexToCoord(texGreenGrassIndex, u, v, s, s);
|
||||
m_blockinfo[BTYPE_GREENGRASS] = new BlockInfo(BTYPE_GREENGRASS, "GreenGrass", u, v, s, 1);
|
||||
m_textureAtlas.TextureIndexToCoord(texBoostHeal, u, v, s, s);
|
||||
m_boostinfo[BTYPE_HEAL] = new BoostInfo(BTYPE_HEAL, "Heal", u, v, s, 1);
|
||||
m_textureAtlas.TextureIndexToCoord(texBoostDmg, u, v, s, s);
|
||||
@ -540,6 +543,7 @@ void Engine::SystemNotification(std::string systemLog) {
|
||||
|
||||
DisplayNotification(message);
|
||||
}
|
||||
|
||||
void Engine::KillNotification(Player killer, Player killed) {
|
||||
std::string message = "";
|
||||
|
||||
@ -1135,11 +1139,14 @@ void Engine::Render(float elapsedTime) {
|
||||
|
||||
m_player.ApplyTransformation(remotePlayer, true, false);
|
||||
|
||||
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.
|
||||
m_mouseWU = m_mouseWD = false;
|
||||
m_mouseWU = m_mouseWD = m_key1 = m_key2 = false;
|
||||
|
||||
if (m_mouseL) {
|
||||
if (bloc != BTYPE_LAST)
|
||||
@ -1373,6 +1380,10 @@ void Engine::KeyPressEvent(unsigned char key) {
|
||||
break;
|
||||
case 24: // Y - Ignorer
|
||||
break;
|
||||
case 27: // 1
|
||||
break;
|
||||
case 28: // 2
|
||||
break;
|
||||
case 255: // Fn - Ignorer
|
||||
break;
|
||||
default:
|
||||
@ -1447,6 +1458,12 @@ void Engine::KeyReleaseEvent(unsigned char key) {
|
||||
else
|
||||
glPolygonMode(GL_FRONT_AND_BACK, GL_FILL);
|
||||
break;
|
||||
case 27: // 1
|
||||
m_key1 = true;
|
||||
break;
|
||||
case 28: // 2
|
||||
m_key2 = true;
|
||||
break;
|
||||
case 57: // Espace - Stop sauter
|
||||
m_keySpace = false;
|
||||
break;
|
||||
@ -1567,3 +1584,5 @@ bool Engine::LoadTexture(Texture& texture, const std::string& filename, bool use
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
|
@ -67,6 +67,7 @@ private:
|
||||
|
||||
|
||||
|
||||
|
||||
Connector m_conn;
|
||||
Shader m_shader01;
|
||||
BlockInfo* m_blockinfo[BTYPE_LAST];
|
||||
@ -143,6 +144,9 @@ private:
|
||||
bool m_soloMultiChoiceMade = false;
|
||||
bool m_stopcountdown = false;
|
||||
|
||||
bool m_key1 = false;
|
||||
bool m_key2 = false;
|
||||
|
||||
bool m_keyK = false;
|
||||
bool m_keyL = false;
|
||||
bool m_keyW = false;
|
||||
|
BIN
SQCSim2021/media/textures/greengrass.png
Normal file
BIN
SQCSim2021/media/textures/greengrass.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 1.3 MiB |
Loading…
Reference in New Issue
Block a user