diff --git a/SQCSim2021/chunk.cpp b/SQCSim2021/chunk.cpp index 945e254..d1f39af 100644 --- a/SQCSim2021/chunk.cpp +++ b/SQCSim2021/chunk.cpp @@ -22,7 +22,6 @@ Chunk::~Chunk() { std::ostringstream pos; pos << CHUNK_PATH << m_posX << '_' << m_posY << ".chunk"; - std::ofstream output(pos.str().c_str(), std::fstream::binary); output.write(data, sizeof(data)); output.close(); @@ -31,36 +30,36 @@ Chunk::~Chunk() { void Chunk::RemoveBlock(int x, int y, int z, World* world) { m_blocks.Set(x, y, z, BTYPE_AIR); - CheckNeighbors(x, y, world); - m_isDirty = true; } void Chunk::SetBlock(int x, int y, int z, BlockType type, World* world) { m_blocks.Set(x, y, z, type); - CheckNeighbors(x, z, world); - m_isDirty = true; } BlockType Chunk::GetBlock(int x, int y, int z) { return m_blocks.Get(x, y, z); } void Chunk::CheckNeighbors(int x, int z, World* world) { - if (x == 0 && m_posX >= 0 && - world->ChunkAt((m_posX - 1) * CHUNK_SIZE_X, 1, m_posY * CHUNK_SIZE_Z)) - world->ChunkAt((m_posX - 1) * CHUNK_SIZE_X, 1, m_posY * CHUNK_SIZE_Z)->MakeDirty(); - else if (x == CHUNK_SIZE_X - 1 && m_posX < WORLD_SIZE_X && - world->ChunkAt((m_posX + 1) * CHUNK_SIZE_X, 1, m_posY * CHUNK_SIZE_Z)) - world->ChunkAt((m_posX + 1) * CHUNK_SIZE_X, 1, m_posY * CHUNK_SIZE_Z)->MakeDirty(); + int cx, cy; - if (z == 0 && m_posY >= 0 && - world->ChunkAt(m_posX * CHUNK_SIZE_X, 1, (m_posY - 1) * CHUNK_SIZE_Z)) - world->ChunkAt(m_posX * CHUNK_SIZE_X, 1, (m_posY - 1) * CHUNK_SIZE_Z)->MakeDirty(); - else if (z == CHUNK_SIZE_X - 1 && m_posY < WORLD_SIZE_Y && - world->ChunkAt(m_posX * CHUNK_SIZE_X, 1, (m_posY + 1) * CHUNK_SIZE_Z)) - world->ChunkAt(m_posX * CHUNK_SIZE_X, 1, (m_posY + 1) * CHUNK_SIZE_Z)->MakeDirty(); + world->GetScope(cx, cy); + + if (x == 0 && m_posX - cx >= 0 && + world->ChunkAt((m_posX - cx - 1) * CHUNK_SIZE_X, 1, (m_posY - cy) * CHUNK_SIZE_Z)) + world->ChunkAt((m_posX - cx - 1) * CHUNK_SIZE_X, 1, (m_posY - cy) * CHUNK_SIZE_Z)->MakeDirty(); + else if (x == CHUNK_SIZE_X - 1 && m_posX - cx < WORLD_SIZE_X && + world->ChunkAt((m_posX - cx + 1) * CHUNK_SIZE_X, 1, (m_posY - cy) * CHUNK_SIZE_Z)) + world->ChunkAt((m_posX - cx + 1) * CHUNK_SIZE_X, 1, (m_posY - cy) * CHUNK_SIZE_Z)->MakeDirty(); + + if (z == 0 && m_posY - cy >= 0 && + world->ChunkAt((m_posX - cx) * CHUNK_SIZE_X, 1, (m_posY - cy - 1) * CHUNK_SIZE_Z)) + world->ChunkAt((m_posX - cx) * CHUNK_SIZE_X, 1, (m_posY - cy - 1) * CHUNK_SIZE_Z)->MakeDirty(); + else if (z == CHUNK_SIZE_X - 1 && m_posY - cy < WORLD_SIZE_Y && + world->ChunkAt((m_posX - cx) * CHUNK_SIZE_X, 1, (m_posY - cy + 1) * CHUNK_SIZE_Z)) + world->ChunkAt((m_posX - cx) * CHUNK_SIZE_X, 1, (m_posY - cy + 1) * CHUNK_SIZE_Z)->MakeDirty(); } void Chunk::GetPosition(int& x, int& y) const { @@ -103,7 +102,11 @@ void Chunk::Update(BlockInfo* blockinfo[BTYPE_LAST], World* world) { void Chunk::AddBlockToMesh(VertexBuffer::VertexData* vd, int& count, BlockType bt, int x, int y, int z, float u, float v, float s, World* world) { - int cx = x + m_posX * CHUNK_SIZE_X, cy = z + m_posY * CHUNK_SIZE_Z; + int cex, cey; + + world->GetScope(cex, cey); + + int cx = x + (m_posX - cex) * CHUNK_SIZE_X, cy = z + (m_posY - cey) * CHUNK_SIZE_Z; if (y == CHUNK_SIZE_Y - 1 || GetBlock(x, y + 1, z) == BTYPE_AIR) { // y vd[count++] = VertexBuffer::VertexData(x, y + 1.f, z, .8f, .8f, .8f, u, v); diff --git a/SQCSim2021/engine.cpp b/SQCSim2021/engine.cpp index ab92a7d..fc03441 100644 --- a/SQCSim2021/engine.cpp +++ b/SQCSim2021/engine.cpp @@ -23,7 +23,6 @@ void Engine::Init() { glEnable(GL_DEPTH_TEST); glHint(GL_PERSPECTIVE_CORRECTION_HINT, GL_NICEST); glShadeModel(GL_SMOOTH); - glEnable(GL_LIGHTING); glEnable(GL_LINE_SMOOTH); glEnable(GL_CULL_FACE); @@ -32,26 +31,11 @@ void Engine::Init() { glEnable(GL_BLEND); glBlendFunc(GL_CONSTANT_ALPHA, GL_ONE_MINUS_CONSTANT_ALPHA); - // Light - GLfloat light0Pos[4] = { 0.0f, CHUNK_SIZE_Y, 0.0f, 1.0f }; - GLfloat light0Amb[4] = { 0.2f, 0.2f, 0.2f, 1.f }; - GLfloat light0Diff[4] = { 1.f, 1.f, 1.f, 1.f }; - GLfloat light0Spec[4] = { 0.2f, 0.2f, 0.2f, 1.0f }; - - glEnable(GL_LIGHT0); - glLightfv(GL_LIGHT0, GL_POSITION, light0Pos); - glLightfv(GL_LIGHT0, GL_AMBIENT, light0Amb); - glLightfv(GL_LIGHT0, GL_DIFFUSE, light0Diff); - glLightfv(GL_LIGHT0, GL_SPECULAR, light0Spec); - - // Init manifeste de chunks renderés. - m_renderManifest.reserve(3000); - // Objet de skybox avec sa propre texture et son propre shader! m_skybox.Init(0.00013f); // Objet de musique! - //m_audio.ToggleMusicState(); + m_audio.ToggleMusicState(); // Init Chunks m_world.GetChunks().Reset(nullptr); @@ -64,7 +48,6 @@ void Engine::Init() { void Engine::DeInit() { } void Engine::LoadResource() { - LoadTexture(m_textureFloor, TEXTURE_PATH "grass.png"); LoadTexture(m_skybox.GetTexture(), TEXTURE_PATH "skybox.png"); LoadTexture(m_textureCrosshair, TEXTURE_PATH "cross.bmp"); LoadTexture(m_textureFont, TEXTURE_PATH "font.bmp"); @@ -104,10 +87,8 @@ void Engine::UnloadResource() {} void Engine::DrawHud(float elapsedTime) { // Setter le blend function , tout ce qui sera noir sera transparent - glDisable(GL_LIGHTING); glColor4f(1.f, 1.f, 1.f, 1.f); glBlendFunc(GL_SRC_ALPHA, GL_ONE); - //glEnable(GL_BLEND); glDisable(GL_DEPTH_TEST); glMatrixMode(GL_PROJECTION); glPushMatrix(); @@ -154,9 +135,6 @@ void Engine::DrawHud(float elapsedTime) { glTexCoord2f(0, 1); glVertex2i(0, crossSize); glEnd(); - glEnable(GL_LIGHTING); - //glDisable(GL_BLEND); - //glBlendFuncSeparate(GL_SRC_COLOR, GL_ONE_MINUS_DST_COLOR, GL_CONSTANT_ALPHA, GL_ONE_MINUS_CONSTANT_ALPHA); glBlendFunc(GL_CONSTANT_ALPHA, GL_ONE_MINUS_CONSTANT_ALPHA); glEnable(GL_DEPTH_TEST); glMatrixMode(GL_PROJECTION); @@ -210,105 +188,15 @@ void Engine::Render(float elapsedTime) { m_player.ApplyTransformation(skybox, false); // Version d'ApplyTransformation qui ne tient compte que de la rotation // (donc l'objet ne bouge pas relativement au joueur, ce qui est pratique pour une skybox!). - glDisable(GL_LIGHT0); if (m_isSkybox) m_skybox.Render(skybox); - glEnable(GL_LIGHT0); if (m_mouseL) - ChangeBlockAtCursor(BTYPE_DIRT); + m_world.ChangeBlockAtCursor(BTYPE_DIRT, m_player, m_block); else if (m_mouseR) - ChangeBlockAtCursor(BTYPE_AIR); + m_world.ChangeBlockAtCursor(BTYPE_AIR, m_player, m_block); - // Génération/Update des Chunks. - m_textureAtlas.Bind(); - int cx = m_player.GetPosition().x; - int cy = m_player.GetPosition().z; - static int frameGenerate = 0; - static int frameUpdate = 0; - int side = 0; - if (frameGenerate > 0) --frameGenerate; - if (frameUpdate > 0) --frameUpdate; - - if (!frameGenerate || !frameUpdate) - while (side * CHUNK_SIZE_X <= VIEW_DISTANCE * 2) { - int tx = -side, ty = -side; - - for (; tx <= side; ++tx) - UpdateWorld(frameGenerate, frameUpdate, cx + tx * CHUNK_SIZE_X, cy + ty * CHUNK_SIZE_Z); - for (; ty <= side; ++ty) - UpdateWorld(frameGenerate, frameUpdate, cx + tx * CHUNK_SIZE_X, cy + ty * CHUNK_SIZE_Z); - for (; tx >= -side; --tx) - UpdateWorld(frameGenerate, frameUpdate, cx + tx * CHUNK_SIZE_X, cy + ty * CHUNK_SIZE_Z); - for (; ty >= -side; --ty) - UpdateWorld(frameGenerate, frameUpdate, cx + tx * CHUNK_SIZE_X, cy + ty * CHUNK_SIZE_Z); - - ++side; - } - - // Rendering des Chunks. - m_shader01.Use(); - m_renderCount = 0; - m_badHitCount = 0; - Vector3f angle; - Vector3f cursor; - Vector3f direct = m_player.GetDirection(); - Vector3f pos = m_player.GetPosition() - direct; - - direct.y = 0; - direct.Normalize(); - pos.y = 1; - m_renderManifest.clear(); - - for (int dist = VIEW_DISTANCE; dist >= 0; dist -= CHUNK_SIZE_X) { - // Configuration du radar. - angle.x = direct.z + direct.x; - angle.y = 0; - angle.z = direct.z - direct.x; - angle.Normalize(); - - float sinus = .01745240643; // sin(1 degré) - float cosinus = .99984769515; // cos(1 degré) - int echantillons = 90; - - for (int radar = 0; radar < echantillons; ++radar) { - float x = angle.x; - float z = angle.z; - - angle.x = x * cosinus - z * sinus; - angle.z = z * cosinus + x * sinus; - angle.Normalize(); - - cursor = pos - direct * CHUNK_SIZE_X * 2 + angle * dist; - if (cursor.y >= 128.f || cursor.y >= 0.f) cursor.y = 1; - - bool valide = true; - - if (m_world.ChunkAt(cursor)) { - int chx, chy; - m_world.ChunkAt(cursor)->GetPosition(chx, chy); - for (int index = 0; index < m_renderManifest.size(); ++index) - if (m_renderManifest[index] == Vector3i(chx, 0, chy)) { - valide = false; - ++m_badHitCount; - } - - if (valide) { - all.ApplyTranslation(chx * CHUNK_SIZE_X, 0, chy * CHUNK_SIZE_Z); - all.Use(); - float dist = (pos - cursor).Length(); - float blend = ((float)VIEW_DISTANCE - dist * 2.f + 128.f) / (float)VIEW_DISTANCE; - glBlendColor(0.f,0.f,0.f,blend); - m_world.GetChunks().Get(chx, chy)->Render(); - all.ApplyTranslation(-chx * CHUNK_SIZE_X, 0, -chy * CHUNK_SIZE_Z); - m_renderManifest.push_back(Vector3i(chx, 0, chy)); - ++m_renderCount; - } - } - } - } - - m_shader01.Disable(); + m_world.Update(m_renderCount, m_badHitCount, m_player, all, m_shader01, m_textureAtlas, m_perlin, m_blockinfo); if (m_wireframe) glPolygonMode(GL_FRONT_AND_BACK, GL_FILL); @@ -320,10 +208,10 @@ void Engine::Render(float elapsedTime) { m_player = Player(Vector3f(0, CHUNK_SIZE_Y + 1.8f, 0)); // Respawn si le bonho- joueur tombe en bas du monde. } -void Engine::KeyPressEvent(unsigned char key) -{ +void Engine::KeyPressEvent(unsigned char key) { switch (key) { case 36: // ESC + m_world.CleanUpWorld(m_renderCount, true); for (int x = 0; x < WORLD_SIZE_X; ++x) // Les destructeurs de Chunks ont de la misère je les aide un peu! for (int y = 0; y < WORLD_SIZE_Y; ++y) if (m_world.GetChunks().Get(x,y)) @@ -380,8 +268,7 @@ void Engine::KeyPressEvent(unsigned char key) } } -void Engine::KeyReleaseEvent(unsigned char key) -{ +void Engine::KeyReleaseEvent(unsigned char key) { switch (key) { case 12: m_audio.ToggleMusicState(); @@ -422,8 +309,7 @@ void Engine::KeyReleaseEvent(unsigned char key) } } -void Engine::MouseMoveEvent(int x, int y) -{ +void Engine::MouseMoveEvent(int x, int y) { m_player.TurnLeftRight(x - (Width() / 2)); m_player.TurnTopBottom(y - (Height() / 2)); @@ -482,8 +368,7 @@ void Engine::MouseReleaseEvent(const MOUSE_BUTTON& button, int x, int y) { } } -bool Engine::LoadTexture(Texture& texture, const std::string& filename, bool stopOnError) -{ +bool Engine::LoadTexture(Texture& texture, const std::string& filename, bool stopOnError) { texture.Load(filename); if (!texture.IsValid()) { @@ -496,153 +381,3 @@ bool Engine::LoadTexture(Texture& texture, const std::string& filename, bool sto return true; } - -bool Engine::GenerateChunk(int chx, int chy) { - if (chx < WORLD_SIZE_X * CHUNK_SIZE_X && chy < WORLD_SIZE_Y * CHUNK_SIZE_Z && - chx >= 0 && chy >= 0) - if (!m_world.ChunkAt(chx, 1, chy)) { - - std::ostringstream pos; - pos << CHUNK_PATH << chx / CHUNK_SIZE_X << '_' << chy / CHUNK_SIZE_Z << ".chunk"; - - std::ifstream input(pos.str().c_str(), std::fstream::binary); - - if (input.fail()) { - m_world.GetChunks().Set(chx / CHUNK_SIZE_X, chy / CHUNK_SIZE_Z, new Chunk(chx / CHUNK_SIZE_X, chy / CHUNK_SIZE_Z)); - Chunk* chunk = m_world.GetChunks().Get(chx / CHUNK_SIZE_X, chy / CHUNK_SIZE_Z); - - for (int x = 0; x < CHUNK_SIZE_X; ++x) - for (int z = 0; z < CHUNK_SIZE_Z; ++z) { - Vector3f perlin; - perlin.z = x * CHUNK_SIZE_X + CHUNK_SIZE_X * chx; - perlin.y = 0; - perlin.x = z * CHUNK_SIZE_Z + CHUNK_SIZE_Z * chy; - perlin.Normalize(); - float height = m_perlin.Get(perlin.x, perlin.z) * 3 - 32; - for (int y = 0; y <= (int)height % CHUNK_SIZE_Y; ++y) { - chunk->SetBlock(x, y, z, BTYPE_METAL, &m_world); - } - } - - for (int x = 0; x < CHUNK_SIZE_X; ++x) - for (int z = 0; z < CHUNK_SIZE_Z; ++z) { - Vector3f perlin; - perlin.x = x * CHUNK_SIZE_X + CHUNK_SIZE_X * chx; - perlin.y = 0; - perlin.z = z * CHUNK_SIZE_Z + CHUNK_SIZE_Z * chy; - perlin.Normalize(); - float height = m_perlin.Get(perlin.x, perlin.z) + 16; - for (int y = 0; y <= (int)height % CHUNK_SIZE_Y; ++y) { - if (chunk->GetBlock(x, y, z) == BTYPE_AIR) - chunk->SetBlock(x, y, z, BTYPE_GRASS, &m_world); - } - } - - for (int x = 0; x < CHUNK_SIZE_X; ++x) - for (int z = 0; z < CHUNK_SIZE_Z; ++z) { - for (int y = 0; y <= 10; ++y) { - if (chunk->GetBlock(x, y, z) == BTYPE_AIR) - chunk->SetBlock(x, y, z, BTYPE_ICE, &m_world); - } - } - - for (int x = 0; x < CHUNK_SIZE_X; ++x) - for (int z = 0; z < CHUNK_SIZE_Z; ++z) { - for (int y = 0; y < CHUNK_SIZE_Y; ++y) { - Vector3f perlin; - perlin.x = x * CHUNK_SIZE_X + CHUNK_SIZE_X * chx; - perlin.y = (x + z) * CHUNK_SIZE_Y; - perlin.z = z * CHUNK_SIZE_Z + CHUNK_SIZE_Z * chy; - perlin.Normalize(); - float height = m_perlin.Get(perlin.x, perlin.y, perlin.z); - if (chunk->GetBlock(x, y, z) != BTYPE_AIR && height > 18) - chunk->SetBlock(x, y, z, BTYPE_DIRT, &m_world); - } - } - } - else { - input.seekg(0, std::ios_base::end); - int size = input.tellg(); - input.seekg(0, std::ios_base::beg); - - char* data = new char[size]; - input.read(data, size); - input.close(); - - m_world.GetChunks().Set(chx / CHUNK_SIZE_X, chy / CHUNK_SIZE_Z, new Chunk(chx / CHUNK_SIZE_X, chy / CHUNK_SIZE_Z, data)); - - delete[] data; - } - std::cout << "Chunk generated: " << chx / CHUNK_SIZE_X << ", " << chy / CHUNK_SIZE_Z << std::endl; - - return true; - } - return false; -} - -void Engine::UpdateWorld(int& generates, int& updates, int chx, int chy) { - if (generates == 0 && GenerateChunk(chx, chy)) generates = FRAMES_RENDER_CHUNKS; - if (updates == 0 && m_world.ChunkAt(chx, 1, chy) && - m_world.ChunkAt(chx, 1, chy)->IsDirty()) { - m_world.ChunkAt(chx, 1, chy)->Update(m_blockinfo, &m_world); - updates = FRAMES_UPDATE_CHUNKS; - } -} - -void Engine::ChangeBlockAtCursor(BlockType blockType) { - Vector3f currentPos = m_player.GetPosition(); - Vector3f currentBlock = currentPos; - Vector3f ray = m_player.GetDirection(); - bool found = false; - - if (m_block) return; - - while ((currentPos - currentBlock).Length() <= MAX_SELECTION_DISTANCE && !found) { - currentBlock += ray / 10.f; - - BlockType bt = m_world.BlockAt(currentBlock); - - if (bt != BTYPE_AIR) - found = true; - } - - if (found) { - if (blockType != BTYPE_AIR) { - found = false; - while ((currentPos - currentBlock).Length() >= 1.7f && !found) { - currentBlock -= ray / 10.f; - - BlockType bt = m_world.BlockAt(currentBlock); - - if (bt == BTYPE_AIR) { // Vérification pour être sûr que le bloc à changer n'est pas dans le joueur. - int Bx = (int)currentBlock.x; - int By = (int)currentBlock.y; - int Bz = (int)currentBlock.z; - - int Px = (int)currentPos.x; - int PyA = (int)currentPos.y; - int PyB = (int)(currentPos.y - .9f); - int PyC = (int)(currentPos.y - 1.7f); - int Pz = (int)currentPos.z; - - if (!(Bx == Px && - (By == PyA || - By == PyB || - By == PyC) && - Bz == Pz)) - found = true; - } - } - } - } - - if (found && (int)currentBlock.y < CHUNK_SIZE_Y) { - int bx = (int)currentBlock.x % CHUNK_SIZE_X; - int by = (int)currentBlock.y % CHUNK_SIZE_Y; - int bz = (int)currentBlock.z % CHUNK_SIZE_Z; - - m_world.ChunkAt(currentBlock)->SetBlock(bx, by, bz, blockType, &m_world); - m_world.ChunkAt(currentBlock)->MakeModified(); - m_block = true; - } -} diff --git a/SQCSim2021/engine.h b/SQCSim2021/engine.h index 6c75b8b..d877407 100644 --- a/SQCSim2021/engine.h +++ b/SQCSim2021/engine.h @@ -35,31 +35,25 @@ private: void DrawHud(float elapsedTime); void PrintText(unsigned int x, unsigned int y, const std::string& t); int GetFps(float elapsedTime) const; - bool GenerateChunk(int chx, int chy); - void UpdateWorld(int& generates, int& updates, int chx, int chy); - - void ChangeBlockAtCursor(BlockType blocktype); bool m_wireframe = false; bool m_isSkybox = true; int m_renderCount = 0; int m_badHitCount = 0; - std::vector m_renderManifest; + Shader m_shader01; BlockInfo* m_blockinfo[BTYPE_LAST]; TextureAtlas m_textureAtlas = TextureAtlas(BTYPE_LAST); - World m_world = World(); - Perlin m_perlin = Perlin(3,5.f,64.f,12345); - Texture m_textureFloor; + World m_world = World(); + Perlin m_perlin = Perlin(3,7.f,127.f,12345); + Texture m_textureSkybox; Texture m_textureFont; Texture m_textureCrosshair; - Texture m_textureCube1; Skybox m_skybox; - Shader m_shader01; Audio m_audio = Audio(AUDIO_PATH "music01.wav"); Player m_player = Player(Vector3f(0, CHUNK_SIZE_Y + 1.8f, 0)); diff --git a/SQCSim2021/media/chunks/0_0.chunk b/SQCSim2021/media/chunks/0_0.chunk deleted file mode 100644 index 081655e..0000000 Binary files a/SQCSim2021/media/chunks/0_0.chunk and /dev/null differ diff --git a/SQCSim2021/media/chunks/108_45.chunk b/SQCSim2021/media/chunks/108_45.chunk deleted file mode 100644 index 9334430..0000000 Binary files a/SQCSim2021/media/chunks/108_45.chunk and /dev/null differ diff --git a/SQCSim2021/media/chunks/113_20.chunk b/SQCSim2021/media/chunks/113_20.chunk deleted file mode 100644 index e9bc2e0..0000000 Binary files a/SQCSim2021/media/chunks/113_20.chunk and /dev/null differ diff --git a/SQCSim2021/media/chunks/118_2.chunk b/SQCSim2021/media/chunks/118_2.chunk deleted file mode 100644 index 4fceb94..0000000 Binary files a/SQCSim2021/media/chunks/118_2.chunk and /dev/null differ diff --git a/SQCSim2021/media/chunks/118_3.chunk b/SQCSim2021/media/chunks/118_3.chunk deleted file mode 100644 index dd9a7e3..0000000 Binary files a/SQCSim2021/media/chunks/118_3.chunk and /dev/null differ diff --git a/SQCSim2021/media/chunks/118_4.chunk b/SQCSim2021/media/chunks/118_4.chunk deleted file mode 100644 index 04cf4ac..0000000 Binary files a/SQCSim2021/media/chunks/118_4.chunk and /dev/null differ diff --git a/SQCSim2021/media/chunks/118_5.chunk b/SQCSim2021/media/chunks/118_5.chunk deleted file mode 100644 index 441a5f1..0000000 Binary files a/SQCSim2021/media/chunks/118_5.chunk and /dev/null differ diff --git a/SQCSim2021/media/chunks/118_7.chunk b/SQCSim2021/media/chunks/118_7.chunk deleted file mode 100644 index cbad6b7..0000000 --- a/SQCSim2021/media/chunks/118_7.chunk +++ /dev/null @@ -1 +0,0 @@ - \ No newline at end of file diff --git a/SQCSim2021/media/chunks/11_100.chunk b/SQCSim2021/media/chunks/11_100.chunk deleted file mode 100644 index 74d3ccd..0000000 Binary files a/SQCSim2021/media/chunks/11_100.chunk and /dev/null differ diff --git a/SQCSim2021/media/chunks/11_101.chunk b/SQCSim2021/media/chunks/11_101.chunk deleted file mode 100644 index 85f9636..0000000 Binary files a/SQCSim2021/media/chunks/11_101.chunk and /dev/null differ diff --git a/SQCSim2021/media/chunks/11_102.chunk b/SQCSim2021/media/chunks/11_102.chunk deleted file mode 100644 index 14290f4..0000000 Binary files a/SQCSim2021/media/chunks/11_102.chunk and /dev/null differ diff --git a/SQCSim2021/media/chunks/11_103.chunk b/SQCSim2021/media/chunks/11_103.chunk deleted file mode 100644 index ae4eaf3..0000000 Binary files a/SQCSim2021/media/chunks/11_103.chunk and /dev/null differ diff --git a/SQCSim2021/media/chunks/11_105.chunk b/SQCSim2021/media/chunks/11_105.chunk deleted file mode 100644 index 3b894ee..0000000 Binary files a/SQCSim2021/media/chunks/11_105.chunk and /dev/null differ diff --git a/SQCSim2021/media/chunks/11_99.chunk b/SQCSim2021/media/chunks/11_99.chunk deleted file mode 100644 index 18b2b85..0000000 Binary files a/SQCSim2021/media/chunks/11_99.chunk and /dev/null differ diff --git a/SQCSim2021/media/chunks/12_103.chunk b/SQCSim2021/media/chunks/12_103.chunk deleted file mode 100644 index f395a2d..0000000 Binary files a/SQCSim2021/media/chunks/12_103.chunk and /dev/null differ diff --git a/SQCSim2021/media/chunks/16_5.chunk b/SQCSim2021/media/chunks/16_5.chunk deleted file mode 100644 index 36f1afc..0000000 Binary files a/SQCSim2021/media/chunks/16_5.chunk and /dev/null differ diff --git a/SQCSim2021/media/chunks/17_5.chunk b/SQCSim2021/media/chunks/17_5.chunk deleted file mode 100644 index d6b3875..0000000 Binary files a/SQCSim2021/media/chunks/17_5.chunk and /dev/null differ diff --git a/SQCSim2021/media/chunks/1_6.chunk b/SQCSim2021/media/chunks/1_6.chunk deleted file mode 100644 index 40168cf..0000000 Binary files a/SQCSim2021/media/chunks/1_6.chunk and /dev/null differ diff --git a/SQCSim2021/media/chunks/1_7.chunk b/SQCSim2021/media/chunks/1_7.chunk deleted file mode 100644 index 11541ac..0000000 Binary files a/SQCSim2021/media/chunks/1_7.chunk and /dev/null differ diff --git a/SQCSim2021/media/chunks/20_111.chunk b/SQCSim2021/media/chunks/20_111.chunk deleted file mode 100644 index bda5e00..0000000 Binary files a/SQCSim2021/media/chunks/20_111.chunk and /dev/null differ diff --git a/SQCSim2021/media/chunks/23_97.chunk b/SQCSim2021/media/chunks/23_97.chunk deleted file mode 100644 index d8d921c..0000000 Binary files a/SQCSim2021/media/chunks/23_97.chunk and /dev/null differ diff --git a/SQCSim2021/media/chunks/23_98.chunk b/SQCSim2021/media/chunks/23_98.chunk deleted file mode 100644 index 28a94cb..0000000 Binary files a/SQCSim2021/media/chunks/23_98.chunk and /dev/null differ diff --git a/SQCSim2021/media/chunks/24_97.chunk b/SQCSim2021/media/chunks/24_97.chunk deleted file mode 100644 index 16d005a..0000000 Binary files a/SQCSim2021/media/chunks/24_97.chunk and /dev/null differ diff --git a/SQCSim2021/media/chunks/26_85.chunk b/SQCSim2021/media/chunks/26_85.chunk deleted file mode 100644 index 280bcc0..0000000 Binary files a/SQCSim2021/media/chunks/26_85.chunk and /dev/null differ diff --git a/SQCSim2021/media/chunks/28_94.chunk b/SQCSim2021/media/chunks/28_94.chunk deleted file mode 100644 index 9d9974e..0000000 Binary files a/SQCSim2021/media/chunks/28_94.chunk and /dev/null differ diff --git a/SQCSim2021/media/chunks/28_96.chunk b/SQCSim2021/media/chunks/28_96.chunk deleted file mode 100644 index 5924301..0000000 Binary files a/SQCSim2021/media/chunks/28_96.chunk and /dev/null differ diff --git a/SQCSim2021/media/chunks/39_64.chunk b/SQCSim2021/media/chunks/39_64.chunk deleted file mode 100644 index 57562f0..0000000 Binary files a/SQCSim2021/media/chunks/39_64.chunk and /dev/null differ diff --git a/SQCSim2021/media/chunks/41_75.chunk b/SQCSim2021/media/chunks/41_75.chunk deleted file mode 100644 index cb7d9e3..0000000 Binary files a/SQCSim2021/media/chunks/41_75.chunk and /dev/null differ diff --git a/SQCSim2021/media/chunks/42_75.chunk b/SQCSim2021/media/chunks/42_75.chunk deleted file mode 100644 index b70364a..0000000 Binary files a/SQCSim2021/media/chunks/42_75.chunk and /dev/null differ diff --git a/SQCSim2021/media/chunks/42_76.chunk b/SQCSim2021/media/chunks/42_76.chunk deleted file mode 100644 index 6d942e5..0000000 Binary files a/SQCSim2021/media/chunks/42_76.chunk and /dev/null differ diff --git a/SQCSim2021/media/chunks/43_76.chunk b/SQCSim2021/media/chunks/43_76.chunk deleted file mode 100644 index 25ed3fc..0000000 Binary files a/SQCSim2021/media/chunks/43_76.chunk and /dev/null differ diff --git a/SQCSim2021/media/chunks/45_37.chunk b/SQCSim2021/media/chunks/45_37.chunk deleted file mode 100644 index 73e85f6..0000000 Binary files a/SQCSim2021/media/chunks/45_37.chunk and /dev/null differ diff --git a/SQCSim2021/media/chunks/45_38.chunk b/SQCSim2021/media/chunks/45_38.chunk deleted file mode 100644 index 77f3aa3..0000000 Binary files a/SQCSim2021/media/chunks/45_38.chunk and /dev/null differ diff --git a/SQCSim2021/media/chunks/45_75.chunk b/SQCSim2021/media/chunks/45_75.chunk deleted file mode 100644 index aa848f1..0000000 Binary files a/SQCSim2021/media/chunks/45_75.chunk and /dev/null differ diff --git a/SQCSim2021/media/chunks/46_39.chunk b/SQCSim2021/media/chunks/46_39.chunk deleted file mode 100644 index 6d41e01..0000000 Binary files a/SQCSim2021/media/chunks/46_39.chunk and /dev/null differ diff --git a/SQCSim2021/media/chunks/46_75.chunk b/SQCSim2021/media/chunks/46_75.chunk deleted file mode 100644 index fa9a9f7..0000000 Binary files a/SQCSim2021/media/chunks/46_75.chunk and /dev/null differ diff --git a/SQCSim2021/media/chunks/47_74.chunk b/SQCSim2021/media/chunks/47_74.chunk deleted file mode 100644 index bd6b8ee..0000000 Binary files a/SQCSim2021/media/chunks/47_74.chunk and /dev/null differ diff --git a/SQCSim2021/media/chunks/47_75.chunk b/SQCSim2021/media/chunks/47_75.chunk deleted file mode 100644 index cf380ef..0000000 Binary files a/SQCSim2021/media/chunks/47_75.chunk and /dev/null differ diff --git a/SQCSim2021/media/chunks/49_52.chunk b/SQCSim2021/media/chunks/49_52.chunk deleted file mode 100644 index 3009871..0000000 Binary files a/SQCSim2021/media/chunks/49_52.chunk and /dev/null differ diff --git a/SQCSim2021/media/chunks/53_65.chunk b/SQCSim2021/media/chunks/53_65.chunk deleted file mode 100644 index cd57d9d..0000000 Binary files a/SQCSim2021/media/chunks/53_65.chunk and /dev/null differ diff --git a/SQCSim2021/media/chunks/53_66.chunk b/SQCSim2021/media/chunks/53_66.chunk deleted file mode 100644 index d5c8509..0000000 Binary files a/SQCSim2021/media/chunks/53_66.chunk and /dev/null differ diff --git a/SQCSim2021/media/chunks/54_61.chunk b/SQCSim2021/media/chunks/54_61.chunk deleted file mode 100644 index dc44570..0000000 Binary files a/SQCSim2021/media/chunks/54_61.chunk and /dev/null differ diff --git a/SQCSim2021/media/chunks/54_62.chunk b/SQCSim2021/media/chunks/54_62.chunk deleted file mode 100644 index b777eef..0000000 Binary files a/SQCSim2021/media/chunks/54_62.chunk and /dev/null differ diff --git a/SQCSim2021/media/chunks/54_64.chunk b/SQCSim2021/media/chunks/54_64.chunk deleted file mode 100644 index 37c630a..0000000 Binary files a/SQCSim2021/media/chunks/54_64.chunk and /dev/null differ diff --git a/SQCSim2021/media/chunks/54_68.chunk b/SQCSim2021/media/chunks/54_68.chunk deleted file mode 100644 index 9ed7245..0000000 Binary files a/SQCSim2021/media/chunks/54_68.chunk and /dev/null differ diff --git a/SQCSim2021/media/chunks/54_69.chunk b/SQCSim2021/media/chunks/54_69.chunk deleted file mode 100644 index 2aa72f1..0000000 Binary files a/SQCSim2021/media/chunks/54_69.chunk and /dev/null differ diff --git a/SQCSim2021/media/chunks/54_75.chunk b/SQCSim2021/media/chunks/54_75.chunk deleted file mode 100644 index 8e714eb..0000000 Binary files a/SQCSim2021/media/chunks/54_75.chunk and /dev/null differ diff --git a/SQCSim2021/media/chunks/54_76.chunk b/SQCSim2021/media/chunks/54_76.chunk deleted file mode 100644 index ed2466f..0000000 Binary files a/SQCSim2021/media/chunks/54_76.chunk and /dev/null differ diff --git a/SQCSim2021/media/chunks/55_57.chunk b/SQCSim2021/media/chunks/55_57.chunk deleted file mode 100644 index e0f8448..0000000 Binary files a/SQCSim2021/media/chunks/55_57.chunk and /dev/null differ diff --git a/SQCSim2021/media/chunks/55_58.chunk b/SQCSim2021/media/chunks/55_58.chunk deleted file mode 100644 index 7604009..0000000 Binary files a/SQCSim2021/media/chunks/55_58.chunk and /dev/null differ diff --git a/SQCSim2021/media/chunks/55_68.chunk b/SQCSim2021/media/chunks/55_68.chunk deleted file mode 100644 index 42a97a6..0000000 Binary files a/SQCSim2021/media/chunks/55_68.chunk and /dev/null differ diff --git a/SQCSim2021/media/chunks/55_70.chunk b/SQCSim2021/media/chunks/55_70.chunk deleted file mode 100644 index 106d3f0..0000000 Binary files a/SQCSim2021/media/chunks/55_70.chunk and /dev/null differ diff --git a/SQCSim2021/media/chunks/55_75.chunk b/SQCSim2021/media/chunks/55_75.chunk deleted file mode 100644 index 6645491..0000000 Binary files a/SQCSim2021/media/chunks/55_75.chunk and /dev/null differ diff --git a/SQCSim2021/media/chunks/56_54.chunk b/SQCSim2021/media/chunks/56_54.chunk deleted file mode 100644 index 3230ed7..0000000 --- a/SQCSim2021/media/chunks/56_54.chunk +++ /dev/null @@ -1 +0,0 @@ - \ No newline at end of file diff --git a/SQCSim2021/media/chunks/56_67.chunk b/SQCSim2021/media/chunks/56_67.chunk deleted file mode 100644 index fb23c74..0000000 Binary files a/SQCSim2021/media/chunks/56_67.chunk and /dev/null differ diff --git a/SQCSim2021/media/chunks/56_73.chunk b/SQCSim2021/media/chunks/56_73.chunk deleted file mode 100644 index 7fd12d6..0000000 Binary files a/SQCSim2021/media/chunks/56_73.chunk and /dev/null differ diff --git a/SQCSim2021/media/chunks/57_64.chunk b/SQCSim2021/media/chunks/57_64.chunk deleted file mode 100644 index 676c69a..0000000 Binary files a/SQCSim2021/media/chunks/57_64.chunk and /dev/null differ diff --git a/SQCSim2021/media/chunks/57_74.chunk b/SQCSim2021/media/chunks/57_74.chunk deleted file mode 100644 index 4e1ec8c..0000000 Binary files a/SQCSim2021/media/chunks/57_74.chunk and /dev/null differ diff --git a/SQCSim2021/media/chunks/58_64.chunk b/SQCSim2021/media/chunks/58_64.chunk deleted file mode 100644 index 9835150..0000000 Binary files a/SQCSim2021/media/chunks/58_64.chunk and /dev/null differ diff --git a/SQCSim2021/media/chunks/58_74.chunk b/SQCSim2021/media/chunks/58_74.chunk deleted file mode 100644 index 330afe5..0000000 Binary files a/SQCSim2021/media/chunks/58_74.chunk and /dev/null differ diff --git a/SQCSim2021/media/chunks/59_63.chunk b/SQCSim2021/media/chunks/59_63.chunk deleted file mode 100644 index af4bb49..0000000 Binary files a/SQCSim2021/media/chunks/59_63.chunk and /dev/null differ diff --git a/SQCSim2021/media/chunks/59_64.chunk b/SQCSim2021/media/chunks/59_64.chunk deleted file mode 100644 index 7fe012b..0000000 Binary files a/SQCSim2021/media/chunks/59_64.chunk and /dev/null differ diff --git a/SQCSim2021/media/chunks/59_75.chunk b/SQCSim2021/media/chunks/59_75.chunk deleted file mode 100644 index 92fe300..0000000 Binary files a/SQCSim2021/media/chunks/59_75.chunk and /dev/null differ diff --git a/SQCSim2021/media/chunks/5_25.chunk b/SQCSim2021/media/chunks/5_25.chunk deleted file mode 100644 index 276f7f8..0000000 Binary files a/SQCSim2021/media/chunks/5_25.chunk and /dev/null differ diff --git a/SQCSim2021/media/chunks/5_43.chunk b/SQCSim2021/media/chunks/5_43.chunk deleted file mode 100644 index d7b967d..0000000 Binary files a/SQCSim2021/media/chunks/5_43.chunk and /dev/null differ diff --git a/SQCSim2021/media/chunks/5_44.chunk b/SQCSim2021/media/chunks/5_44.chunk deleted file mode 100644 index 2858407..0000000 Binary files a/SQCSim2021/media/chunks/5_44.chunk and /dev/null differ diff --git a/SQCSim2021/media/chunks/5_46.chunk b/SQCSim2021/media/chunks/5_46.chunk deleted file mode 100644 index 5ea4e1a..0000000 Binary files a/SQCSim2021/media/chunks/5_46.chunk and /dev/null differ diff --git a/SQCSim2021/media/chunks/5_50.chunk b/SQCSim2021/media/chunks/5_50.chunk deleted file mode 100644 index 35cfb7d..0000000 Binary files a/SQCSim2021/media/chunks/5_50.chunk and /dev/null differ diff --git a/SQCSim2021/media/chunks/5_51.chunk b/SQCSim2021/media/chunks/5_51.chunk deleted file mode 100644 index 082cab2..0000000 Binary files a/SQCSim2021/media/chunks/5_51.chunk and /dev/null differ diff --git a/SQCSim2021/media/chunks/5_52.chunk b/SQCSim2021/media/chunks/5_52.chunk deleted file mode 100644 index 17f5379..0000000 Binary files a/SQCSim2021/media/chunks/5_52.chunk and /dev/null differ diff --git a/SQCSim2021/media/chunks/60_121.chunk b/SQCSim2021/media/chunks/60_121.chunk deleted file mode 100644 index 504dc42..0000000 Binary files a/SQCSim2021/media/chunks/60_121.chunk and /dev/null differ diff --git a/SQCSim2021/media/chunks/60_122.chunk b/SQCSim2021/media/chunks/60_122.chunk deleted file mode 100644 index 6861f93..0000000 Binary files a/SQCSim2021/media/chunks/60_122.chunk and /dev/null differ diff --git a/SQCSim2021/media/chunks/60_123.chunk b/SQCSim2021/media/chunks/60_123.chunk deleted file mode 100644 index b27b52d..0000000 Binary files a/SQCSim2021/media/chunks/60_123.chunk and /dev/null differ diff --git a/SQCSim2021/media/chunks/60_124.chunk b/SQCSim2021/media/chunks/60_124.chunk deleted file mode 100644 index 772a00c..0000000 Binary files a/SQCSim2021/media/chunks/60_124.chunk and /dev/null differ diff --git a/SQCSim2021/media/chunks/60_125.chunk b/SQCSim2021/media/chunks/60_125.chunk deleted file mode 100644 index 222c32c..0000000 Binary files a/SQCSim2021/media/chunks/60_125.chunk and /dev/null differ diff --git a/SQCSim2021/media/chunks/60_127.chunk b/SQCSim2021/media/chunks/60_127.chunk deleted file mode 100644 index 3afdf37..0000000 Binary files a/SQCSim2021/media/chunks/60_127.chunk and /dev/null differ diff --git a/SQCSim2021/media/chunks/60_61.chunk b/SQCSim2021/media/chunks/60_61.chunk deleted file mode 100644 index 271a080..0000000 Binary files a/SQCSim2021/media/chunks/60_61.chunk and /dev/null differ diff --git a/SQCSim2021/media/chunks/60_62.chunk b/SQCSim2021/media/chunks/60_62.chunk deleted file mode 100644 index 9c50136..0000000 Binary files a/SQCSim2021/media/chunks/60_62.chunk and /dev/null differ diff --git a/SQCSim2021/media/chunks/60_63.chunk b/SQCSim2021/media/chunks/60_63.chunk deleted file mode 100644 index 783ccbd..0000000 Binary files a/SQCSim2021/media/chunks/60_63.chunk and /dev/null differ diff --git a/SQCSim2021/media/chunks/60_66.chunk b/SQCSim2021/media/chunks/60_66.chunk deleted file mode 100644 index df7588e..0000000 Binary files a/SQCSim2021/media/chunks/60_66.chunk and /dev/null differ diff --git a/SQCSim2021/media/chunks/60_67.chunk b/SQCSim2021/media/chunks/60_67.chunk deleted file mode 100644 index d047ed2..0000000 Binary files a/SQCSim2021/media/chunks/60_67.chunk and /dev/null differ diff --git a/SQCSim2021/media/chunks/60_68.chunk b/SQCSim2021/media/chunks/60_68.chunk deleted file mode 100644 index 8d023dc..0000000 Binary files a/SQCSim2021/media/chunks/60_68.chunk and /dev/null differ diff --git a/SQCSim2021/media/chunks/61_55.chunk b/SQCSim2021/media/chunks/61_55.chunk deleted file mode 100644 index 2e8410a..0000000 Binary files a/SQCSim2021/media/chunks/61_55.chunk and /dev/null differ diff --git a/SQCSim2021/media/chunks/61_56.chunk b/SQCSim2021/media/chunks/61_56.chunk deleted file mode 100644 index dae3115..0000000 --- a/SQCSim2021/media/chunks/61_56.chunk +++ /dev/null @@ -1 +0,0 @@ - \ No newline at end of file diff --git a/SQCSim2021/media/chunks/61_68.chunk b/SQCSim2021/media/chunks/61_68.chunk deleted file mode 100644 index e64f750..0000000 Binary files a/SQCSim2021/media/chunks/61_68.chunk and /dev/null differ diff --git a/SQCSim2021/media/chunks/62_107.chunk b/SQCSim2021/media/chunks/62_107.chunk deleted file mode 100644 index 476686f..0000000 Binary files a/SQCSim2021/media/chunks/62_107.chunk and /dev/null differ diff --git a/SQCSim2021/media/chunks/62_109.chunk b/SQCSim2021/media/chunks/62_109.chunk deleted file mode 100644 index d47913a..0000000 Binary files a/SQCSim2021/media/chunks/62_109.chunk and /dev/null differ diff --git a/SQCSim2021/media/chunks/62_76.chunk b/SQCSim2021/media/chunks/62_76.chunk deleted file mode 100644 index 1df5d22..0000000 Binary files a/SQCSim2021/media/chunks/62_76.chunk and /dev/null differ diff --git a/SQCSim2021/media/chunks/63_105.chunk b/SQCSim2021/media/chunks/63_105.chunk deleted file mode 100644 index 7d5ffe9..0000000 Binary files a/SQCSim2021/media/chunks/63_105.chunk and /dev/null differ diff --git a/SQCSim2021/media/chunks/63_106.chunk b/SQCSim2021/media/chunks/63_106.chunk deleted file mode 100644 index 565d8f8..0000000 Binary files a/SQCSim2021/media/chunks/63_106.chunk and /dev/null differ diff --git a/SQCSim2021/media/chunks/63_107.chunk b/SQCSim2021/media/chunks/63_107.chunk deleted file mode 100644 index a8e35ff..0000000 Binary files a/SQCSim2021/media/chunks/63_107.chunk and /dev/null differ diff --git a/SQCSim2021/media/chunks/63_63.chunk b/SQCSim2021/media/chunks/63_63.chunk deleted file mode 100644 index aa4f443..0000000 --- a/SQCSim2021/media/chunks/63_63.chunk +++ /dev/null @@ -1 +0,0 @@ - \ No newline at end of file diff --git a/SQCSim2021/media/chunks/63_64.chunk b/SQCSim2021/media/chunks/63_64.chunk deleted file mode 100644 index 26cf557..0000000 Binary files a/SQCSim2021/media/chunks/63_64.chunk and /dev/null differ diff --git a/SQCSim2021/media/chunks/63_76.chunk b/SQCSim2021/media/chunks/63_76.chunk deleted file mode 100644 index dd3eca8..0000000 Binary files a/SQCSim2021/media/chunks/63_76.chunk and /dev/null differ diff --git a/SQCSim2021/media/chunks/64_104.chunk b/SQCSim2021/media/chunks/64_104.chunk deleted file mode 100644 index c948e6f..0000000 Binary files a/SQCSim2021/media/chunks/64_104.chunk and /dev/null differ diff --git a/SQCSim2021/media/chunks/64_105.chunk b/SQCSim2021/media/chunks/64_105.chunk deleted file mode 100644 index d8b32a6..0000000 Binary files a/SQCSim2021/media/chunks/64_105.chunk and /dev/null differ diff --git a/SQCSim2021/media/chunks/64_63.chunk b/SQCSim2021/media/chunks/64_63.chunk deleted file mode 100644 index dc14499..0000000 --- a/SQCSim2021/media/chunks/64_63.chunk +++ /dev/null @@ -1 +0,0 @@ - \ No newline at end of file diff --git a/SQCSim2021/media/chunks/64_69.chunk b/SQCSim2021/media/chunks/64_69.chunk deleted file mode 100644 index 045ed64..0000000 Binary files a/SQCSim2021/media/chunks/64_69.chunk and /dev/null differ diff --git a/SQCSim2021/media/chunks/64_72.chunk b/SQCSim2021/media/chunks/64_72.chunk deleted file mode 100644 index d94c490..0000000 Binary files a/SQCSim2021/media/chunks/64_72.chunk and /dev/null differ diff --git a/SQCSim2021/media/chunks/65_102.chunk b/SQCSim2021/media/chunks/65_102.chunk deleted file mode 100644 index 0fce0e0..0000000 Binary files a/SQCSim2021/media/chunks/65_102.chunk and /dev/null differ diff --git a/SQCSim2021/media/chunks/65_103.chunk b/SQCSim2021/media/chunks/65_103.chunk deleted file mode 100644 index df2f35a..0000000 Binary files a/SQCSim2021/media/chunks/65_103.chunk and /dev/null differ diff --git a/SQCSim2021/media/chunks/65_62.chunk b/SQCSim2021/media/chunks/65_62.chunk deleted file mode 100644 index d269483..0000000 --- a/SQCSim2021/media/chunks/65_62.chunk +++ /dev/null @@ -1 +0,0 @@ - \ No newline at end of file diff --git a/SQCSim2021/media/chunks/66_41.chunk b/SQCSim2021/media/chunks/66_41.chunk deleted file mode 100644 index 01e0894..0000000 Binary files a/SQCSim2021/media/chunks/66_41.chunk and /dev/null differ diff --git a/SQCSim2021/media/chunks/66_57.chunk b/SQCSim2021/media/chunks/66_57.chunk deleted file mode 100644 index 30ffcf2..0000000 Binary files a/SQCSim2021/media/chunks/66_57.chunk and /dev/null differ diff --git a/SQCSim2021/media/chunks/66_76.chunk b/SQCSim2021/media/chunks/66_76.chunk deleted file mode 100644 index 7807b38..0000000 Binary files a/SQCSim2021/media/chunks/66_76.chunk and /dev/null differ diff --git a/SQCSim2021/media/chunks/67_100.chunk b/SQCSim2021/media/chunks/67_100.chunk deleted file mode 100644 index 8e95cf8..0000000 Binary files a/SQCSim2021/media/chunks/67_100.chunk and /dev/null differ diff --git a/SQCSim2021/media/chunks/67_81.chunk b/SQCSim2021/media/chunks/67_81.chunk deleted file mode 100644 index 2a19980..0000000 Binary files a/SQCSim2021/media/chunks/67_81.chunk and /dev/null differ diff --git a/SQCSim2021/media/chunks/67_99.chunk b/SQCSim2021/media/chunks/67_99.chunk deleted file mode 100644 index b76aeef..0000000 Binary files a/SQCSim2021/media/chunks/67_99.chunk and /dev/null differ diff --git a/SQCSim2021/media/chunks/68_125.chunk b/SQCSim2021/media/chunks/68_125.chunk deleted file mode 100644 index 3aecb01..0000000 Binary files a/SQCSim2021/media/chunks/68_125.chunk and /dev/null differ diff --git a/SQCSim2021/media/chunks/68_126.chunk b/SQCSim2021/media/chunks/68_126.chunk deleted file mode 100644 index 4f5d8b1..0000000 Binary files a/SQCSim2021/media/chunks/68_126.chunk and /dev/null differ diff --git a/SQCSim2021/media/chunks/68_63.chunk b/SQCSim2021/media/chunks/68_63.chunk deleted file mode 100644 index ae8c1b3..0000000 --- a/SQCSim2021/media/chunks/68_63.chunk +++ /dev/null @@ -1 +0,0 @@ - \ No newline at end of file diff --git a/SQCSim2021/media/chunks/69_121.chunk b/SQCSim2021/media/chunks/69_121.chunk deleted file mode 100644 index cd13a05..0000000 Binary files a/SQCSim2021/media/chunks/69_121.chunk and /dev/null differ diff --git a/SQCSim2021/media/chunks/69_122.chunk b/SQCSim2021/media/chunks/69_122.chunk deleted file mode 100644 index 2de4a30..0000000 Binary files a/SQCSim2021/media/chunks/69_122.chunk and /dev/null differ diff --git a/SQCSim2021/media/chunks/69_123.chunk b/SQCSim2021/media/chunks/69_123.chunk deleted file mode 100644 index db22057..0000000 Binary files a/SQCSim2021/media/chunks/69_123.chunk and /dev/null differ diff --git a/SQCSim2021/media/chunks/69_124.chunk b/SQCSim2021/media/chunks/69_124.chunk deleted file mode 100644 index 6d1957a..0000000 Binary files a/SQCSim2021/media/chunks/69_124.chunk and /dev/null differ diff --git a/SQCSim2021/media/chunks/69_125.chunk b/SQCSim2021/media/chunks/69_125.chunk deleted file mode 100644 index 44455fc..0000000 Binary files a/SQCSim2021/media/chunks/69_125.chunk and /dev/null differ diff --git a/SQCSim2021/media/chunks/6_116.chunk b/SQCSim2021/media/chunks/6_116.chunk deleted file mode 100644 index 6f82d42..0000000 Binary files a/SQCSim2021/media/chunks/6_116.chunk and /dev/null differ diff --git a/SQCSim2021/media/chunks/6_52.chunk b/SQCSim2021/media/chunks/6_52.chunk deleted file mode 100644 index 612841f..0000000 Binary files a/SQCSim2021/media/chunks/6_52.chunk and /dev/null differ diff --git a/SQCSim2021/media/chunks/6_53.chunk b/SQCSim2021/media/chunks/6_53.chunk deleted file mode 100644 index e1a2dcb..0000000 Binary files a/SQCSim2021/media/chunks/6_53.chunk and /dev/null differ diff --git a/SQCSim2021/media/chunks/6_54.chunk b/SQCSim2021/media/chunks/6_54.chunk deleted file mode 100644 index 2be1096..0000000 Binary files a/SQCSim2021/media/chunks/6_54.chunk and /dev/null differ diff --git a/SQCSim2021/media/chunks/6_55.chunk b/SQCSim2021/media/chunks/6_55.chunk deleted file mode 100644 index b64c752..0000000 Binary files a/SQCSim2021/media/chunks/6_55.chunk and /dev/null differ diff --git a/SQCSim2021/media/chunks/6_56.chunk b/SQCSim2021/media/chunks/6_56.chunk deleted file mode 100644 index 3ffe2d6..0000000 Binary files a/SQCSim2021/media/chunks/6_56.chunk and /dev/null differ diff --git a/SQCSim2021/media/chunks/6_57.chunk b/SQCSim2021/media/chunks/6_57.chunk deleted file mode 100644 index cc2d632..0000000 Binary files a/SQCSim2021/media/chunks/6_57.chunk and /dev/null differ diff --git a/SQCSim2021/media/chunks/6_58.chunk b/SQCSim2021/media/chunks/6_58.chunk deleted file mode 100644 index b31a046..0000000 Binary files a/SQCSim2021/media/chunks/6_58.chunk and /dev/null differ diff --git a/SQCSim2021/media/chunks/6_59.chunk b/SQCSim2021/media/chunks/6_59.chunk deleted file mode 100644 index 4f87f4d..0000000 Binary files a/SQCSim2021/media/chunks/6_59.chunk and /dev/null differ diff --git a/SQCSim2021/media/chunks/6_60.chunk b/SQCSim2021/media/chunks/6_60.chunk deleted file mode 100644 index 833237c..0000000 Binary files a/SQCSim2021/media/chunks/6_60.chunk and /dev/null differ diff --git a/SQCSim2021/media/chunks/6_61.chunk b/SQCSim2021/media/chunks/6_61.chunk deleted file mode 100644 index 04c04e7..0000000 Binary files a/SQCSim2021/media/chunks/6_61.chunk and /dev/null differ diff --git a/SQCSim2021/media/chunks/6_62.chunk b/SQCSim2021/media/chunks/6_62.chunk deleted file mode 100644 index 59eacdf..0000000 Binary files a/SQCSim2021/media/chunks/6_62.chunk and /dev/null differ diff --git a/SQCSim2021/media/chunks/6_63.chunk b/SQCSim2021/media/chunks/6_63.chunk deleted file mode 100644 index c39fb29..0000000 Binary files a/SQCSim2021/media/chunks/6_63.chunk and /dev/null differ diff --git a/SQCSim2021/media/chunks/70_49.chunk b/SQCSim2021/media/chunks/70_49.chunk deleted file mode 100644 index dfab57f..0000000 Binary files a/SQCSim2021/media/chunks/70_49.chunk and /dev/null differ diff --git a/SQCSim2021/media/chunks/70_50.chunk b/SQCSim2021/media/chunks/70_50.chunk deleted file mode 100644 index 70d4b22..0000000 Binary files a/SQCSim2021/media/chunks/70_50.chunk and /dev/null differ diff --git a/SQCSim2021/media/chunks/70_63.chunk b/SQCSim2021/media/chunks/70_63.chunk deleted file mode 100644 index 0e05b90..0000000 Binary files a/SQCSim2021/media/chunks/70_63.chunk and /dev/null differ diff --git a/SQCSim2021/media/chunks/70_75.chunk b/SQCSim2021/media/chunks/70_75.chunk deleted file mode 100644 index 6f2e034..0000000 Binary files a/SQCSim2021/media/chunks/70_75.chunk and /dev/null differ diff --git a/SQCSim2021/media/chunks/70_76.chunk b/SQCSim2021/media/chunks/70_76.chunk deleted file mode 100644 index 9d6304c..0000000 Binary files a/SQCSim2021/media/chunks/70_76.chunk and /dev/null differ diff --git a/SQCSim2021/media/chunks/73_61.chunk b/SQCSim2021/media/chunks/73_61.chunk deleted file mode 100644 index 4e69b57..0000000 Binary files a/SQCSim2021/media/chunks/73_61.chunk and /dev/null differ diff --git a/SQCSim2021/media/chunks/75_59.chunk b/SQCSim2021/media/chunks/75_59.chunk deleted file mode 100644 index e352477..0000000 Binary files a/SQCSim2021/media/chunks/75_59.chunk and /dev/null differ diff --git a/SQCSim2021/media/chunks/78_75.chunk b/SQCSim2021/media/chunks/78_75.chunk deleted file mode 100644 index 2d8835e..0000000 --- a/SQCSim2021/media/chunks/78_75.chunk +++ /dev/null @@ -1 +0,0 @@ - \ No newline at end of file diff --git a/SQCSim2021/media/chunks/7_67.chunk b/SQCSim2021/media/chunks/7_67.chunk deleted file mode 100644 index b593b88..0000000 Binary files a/SQCSim2021/media/chunks/7_67.chunk and /dev/null differ diff --git a/SQCSim2021/media/chunks/80_36.chunk b/SQCSim2021/media/chunks/80_36.chunk deleted file mode 100644 index 4009cfa..0000000 Binary files a/SQCSim2021/media/chunks/80_36.chunk and /dev/null differ diff --git a/SQCSim2021/media/chunks/81_75.chunk b/SQCSim2021/media/chunks/81_75.chunk deleted file mode 100644 index efe9d1f..0000000 --- a/SQCSim2021/media/chunks/81_75.chunk +++ /dev/null @@ -1 +0,0 @@ - \ No newline at end of file diff --git a/SQCSim2021/media/chunks/84_73.chunk b/SQCSim2021/media/chunks/84_73.chunk deleted file mode 100644 index 1b3ec65..0000000 Binary files a/SQCSim2021/media/chunks/84_73.chunk and /dev/null differ diff --git a/SQCSim2021/media/chunks/84_74.chunk b/SQCSim2021/media/chunks/84_74.chunk deleted file mode 100644 index 6e29afe..0000000 Binary files a/SQCSim2021/media/chunks/84_74.chunk and /dev/null differ diff --git a/SQCSim2021/media/chunks/85_71.chunk b/SQCSim2021/media/chunks/85_71.chunk deleted file mode 100644 index b70ae27..0000000 Binary files a/SQCSim2021/media/chunks/85_71.chunk and /dev/null differ diff --git a/SQCSim2021/media/chunks/85_72.chunk b/SQCSim2021/media/chunks/85_72.chunk deleted file mode 100644 index a06ceb8..0000000 Binary files a/SQCSim2021/media/chunks/85_72.chunk and /dev/null differ diff --git a/SQCSim2021/media/chunks/86_31.chunk b/SQCSim2021/media/chunks/86_31.chunk deleted file mode 100644 index 6b2f6b7..0000000 Binary files a/SQCSim2021/media/chunks/86_31.chunk and /dev/null differ diff --git a/SQCSim2021/media/chunks/88_31.chunk b/SQCSim2021/media/chunks/88_31.chunk deleted file mode 100644 index fad70c6..0000000 Binary files a/SQCSim2021/media/chunks/88_31.chunk and /dev/null differ diff --git a/SQCSim2021/media/chunks/88_68.chunk b/SQCSim2021/media/chunks/88_68.chunk deleted file mode 100644 index 29de148..0000000 Binary files a/SQCSim2021/media/chunks/88_68.chunk and /dev/null differ diff --git a/SQCSim2021/media/chunks/89_29.chunk b/SQCSim2021/media/chunks/89_29.chunk deleted file mode 100644 index eafb867..0000000 Binary files a/SQCSim2021/media/chunks/89_29.chunk and /dev/null differ diff --git a/SQCSim2021/media/chunks/89_31.chunk b/SQCSim2021/media/chunks/89_31.chunk deleted file mode 100644 index 369b6e8..0000000 Binary files a/SQCSim2021/media/chunks/89_31.chunk and /dev/null differ diff --git a/SQCSim2021/media/chunks/89_66.chunk b/SQCSim2021/media/chunks/89_66.chunk deleted file mode 100644 index e84c36f..0000000 Binary files a/SQCSim2021/media/chunks/89_66.chunk and /dev/null differ diff --git a/SQCSim2021/media/chunks/90_65.chunk b/SQCSim2021/media/chunks/90_65.chunk deleted file mode 100644 index ba39ac5..0000000 Binary files a/SQCSim2021/media/chunks/90_65.chunk and /dev/null differ diff --git a/SQCSim2021/media/chunks/90_66.chunk b/SQCSim2021/media/chunks/90_66.chunk deleted file mode 100644 index 36705b1..0000000 Binary files a/SQCSim2021/media/chunks/90_66.chunk and /dev/null differ diff --git a/SQCSim2021/media/chunks/91_62.chunk b/SQCSim2021/media/chunks/91_62.chunk deleted file mode 100644 index d00b07e..0000000 Binary files a/SQCSim2021/media/chunks/91_62.chunk and /dev/null differ diff --git a/SQCSim2021/media/chunks/9_84.chunk b/SQCSim2021/media/chunks/9_84.chunk deleted file mode 100644 index 75877d9..0000000 Binary files a/SQCSim2021/media/chunks/9_84.chunk and /dev/null differ diff --git a/SQCSim2021/world.cpp b/SQCSim2021/world.cpp index e77cdc4..cd51c18 100644 --- a/SQCSim2021/world.cpp +++ b/SQCSim2021/world.cpp @@ -79,10 +79,11 @@ void World::TransposeWorld(Player& player) { player.Transpose(x, y); } -void World::CleanUpWorld(int& frames) { - if (!m_tbDeleted.empty() && !frames) { +void World::CleanUpWorld(int& deleteframes, bool clear = false) { + if (clear) m_tbDeleted.clear(); + if (!m_tbDeleted.empty() && !deleteframes) { m_tbDeleted.pop_back(); - frames = FRAMES_DELETE_CHUNKS; + deleteframes = FRAMES_DELETE_CHUNKS; } } @@ -97,3 +98,270 @@ Chunk* World::RetrieveChunk(int x, int y) { return nullptr; } + +void World::GetScope(int& x, int& y) { + x = m_center[0]; + y = m_center[1]; +} + +void World::Update(int& rendercount, int& badhitcount, Player& player, Transformation& world, Shader& shader, TextureAtlas& atlas, Perlin& perlin, BlockInfo* blockinfo[BTYPE_LAST]) { + atlas.Bind(); + TransposeWorld(player); + RenderWorld(rendercount, badhitcount, player, world, shader); + UpdateWorld(player, perlin, blockinfo); + shader.Disable(); +} + +bool World::GenerateChunk(int chx, int chy, Perlin& perlin) { + if (chx < WORLD_SIZE_X * CHUNK_SIZE_X && chy < WORLD_SIZE_Y * CHUNK_SIZE_Z && + chx >= 0 && chy >= 0) + if (!ChunkAt(chx, 1, chy)) { + + for (int index = 0; index < m_tbDeleted.size(); ++index) { // Vérifie l'existence d'un chunk dans le buffer de suppression avec sa position. + int x, y; + m_tbDeleted.at(index)->GetPosition(x, y); + if (chx / CHUNK_SIZE_X + m_center[0] == x && + chy / CHUNK_SIZE_Z + m_center[1] == y) { + GetChunks().Set(chx / CHUNK_SIZE_X, chy / CHUNK_SIZE_Z, std::move(m_tbDeleted.at(index))); + return true; + } + } + + std::ostringstream pos; // Vérifie l'existence d'un fichier .chunk avec sa position. + pos << CHUNK_PATH << chx / CHUNK_SIZE_X + m_center[0] << '_' << chy / CHUNK_SIZE_Z + m_center[1] << ".chunk"; + + std::ifstream input(pos.str().c_str(), std::fstream::binary); + + if (input.fail()) { + GetChunks().Set(chx / CHUNK_SIZE_X, chy / CHUNK_SIZE_Z, new Chunk(chx / CHUNK_SIZE_X + m_center[0], chy / CHUNK_SIZE_Z + m_center[1])); + Chunk* chunk = GetChunks().Get(chx / CHUNK_SIZE_X, chy / CHUNK_SIZE_Z); + + for (int x = 0; x < CHUNK_SIZE_X; ++x) + for (int z = 0; z < CHUNK_SIZE_Z; ++z) { + Vector3f noise; + noise.x = x * (CHUNK_SIZE_X + 1) + (CHUNK_SIZE_X - 1) * (chx + m_center[0]); + noise.y = 0; + noise.z = z * (CHUNK_SIZE_Z + 1) + (CHUNK_SIZE_Z - 1) * (chy + m_center[1]); + noise.Normalize(); + float height = perlin.Get(noise.x, noise.z) * 3 - 32; + for (int y = 0; y <= (int)height % CHUNK_SIZE_Y; ++y) + chunk->SetBlock(x, y, z, BTYPE_METAL, this); + } + + for (int x = 0; x < CHUNK_SIZE_X; ++x) + for (int z = 0; z < CHUNK_SIZE_Z; ++z) { + Vector3f noise; + noise.x = x * (CHUNK_SIZE_X + 1) + (CHUNK_SIZE_X - 1) * (chx + m_center[0]); + noise.y = 0; + noise.z = z * (CHUNK_SIZE_Z + 1) + (CHUNK_SIZE_Z - 1) * (chy + m_center[1]); + noise.Normalize(); + float height = perlin.Get(noise.x, noise.z) + 16; + for (int y = 0; y <= (int)height % CHUNK_SIZE_Y; ++y) { + if (chunk->GetBlock(x, y, z) == BTYPE_AIR) + chunk->SetBlock(x, y, z, BTYPE_GRASS, this); + } + } + + for (int x = 0; x < CHUNK_SIZE_X; ++x) + for (int z = 0; z < CHUNK_SIZE_Z; ++z) { + for (int y = 0; y <= 10; ++y) { + if (chunk->GetBlock(x, y, z) == BTYPE_AIR) + chunk->SetBlock(x, y, z, BTYPE_ICE, this); + } + } + + for (int x = 0; x < CHUNK_SIZE_X; ++x) + for (int z = 0; z < CHUNK_SIZE_Z; ++z) { + for (int y = 0; y < CHUNK_SIZE_Y; ++y) { + Vector3f noise; + noise.x = x * (CHUNK_SIZE_X + 1) + (CHUNK_SIZE_X - 1) * (chx + m_center[0]); + noise.y = (x + z) * CHUNK_SIZE_Y + m_center[0]; + noise.z = z * (CHUNK_SIZE_Z + 1) + (CHUNK_SIZE_Z - 1) * (chy + m_center[1]); + noise.Normalize(); + float height = perlin.Get(noise.x, noise.y, noise.z); + if (chunk->GetBlock(x, y, z) != BTYPE_AIR && height > 18) + chunk->SetBlock(x, y, z, BTYPE_DIRT, this); + } + } + } + else { + input.seekg(0, std::ios_base::end); + int size = input.tellg(); + input.seekg(0, std::ios_base::beg); + + char* data = new char[size]; + input.read(data, size); + input.close(); + + GetChunks().Set(chx / CHUNK_SIZE_X, chy / CHUNK_SIZE_Z, new Chunk(chx / CHUNK_SIZE_X + m_center[0], chy / CHUNK_SIZE_Z + m_center[1], data)); + + delete[] data; + } + std::cout << "Chunk generated: " << chx / CHUNK_SIZE_X + m_center[0] << ", " << chy / CHUNK_SIZE_Z + m_center[1] << std::endl; + + return true; + } + return false; +} + +void World::UpdateChunk(int& generates, int& updates, int chx, int chy, Perlin& perlin, BlockInfo* blockinfo[BTYPE_LAST]) { + if (generates == 0 && GenerateChunk(chx, chy, perlin)) generates = FRAMES_RENDER_CHUNKS; + 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, Player& player, bool& block) { + Vector3f currentPos = player.GetPosition(); + Vector3f currentBlock = currentPos; + Vector3f ray = player.GetDirection(); + bool found = false; + + if (block) return; + + while ((currentPos - currentBlock).Length() <= MAX_SELECTION_DISTANCE && !found) { + currentBlock += ray / 10.f; + + BlockType bt = BlockAt(currentBlock); + + if (bt != BTYPE_AIR) + found = true; + } + + if (found) + if (blockType != BTYPE_AIR) { + found = false; + while ((currentPos - currentBlock).Length() >= 1.7f && !found) { + currentBlock -= ray / 10.f; + + BlockType bt = BlockAt(currentBlock); + + if (bt == BTYPE_AIR) { // Vérification pour être sûr que le bloc à changer n'est pas dans le joueur. + int Bx = (int)currentBlock.x; + int By = (int)currentBlock.y; + int Bz = (int)currentBlock.z; + + int Px = (int)currentPos.x; + int PyA = (int)currentPos.y; + int PyB = (int)(currentPos.y - .9f); + int PyC = (int)(currentPos.y - 1.7f); + int Pz = (int)currentPos.z; + + if (!(Bx == Px && + (By == PyA || + By == PyB || + By == PyC) && + Bz == Pz)) + found = true; + } + } + } + + if (found && (int)currentBlock.y < CHUNK_SIZE_Y) { + int bx = (int)currentBlock.x % CHUNK_SIZE_X; + int by = (int)currentBlock.y % CHUNK_SIZE_Y; + int bz = (int)currentBlock.z % CHUNK_SIZE_Z; + + ChunkAt(currentBlock)->SetBlock(bx, by, bz, blockType, this); + ChunkAt(currentBlock)->MakeModified(); + block = true; + } +} + +void World::RenderWorld(int& rendercount, int& badhitcount, Player& player, Transformation& world, Shader& shader) { + shader.Use(); + rendercount = 0; + badhitcount = 0; + static std::vector renderManifest; + Vector3f angle; + Vector3f cursor; + Vector3f direct = player.GetDirection(); + Vector3f pos = player.GetPosition() - direct; + + direct.y = 0; + direct.Normalize(); + pos.y = 1; + renderManifest.clear(); + + for (int dist = VIEW_DISTANCE; dist >= 0; dist -= CHUNK_SIZE_X) { + // Configuration du radar. + angle.x = direct.z + direct.x; + angle.y = 0; + angle.z = direct.z - direct.x; + angle.Normalize(); + + float sinus = .01745240643; // sin(1 degré) + float cosinus = .99984769515; // cos(1 degré) + int echantillons = 90; + + for (int radar = 0; radar < echantillons; ++radar) { + float x = angle.x; + float z = angle.z; + + angle.x = x * cosinus - z * sinus; + angle.z = z * cosinus + x * sinus; + angle.Normalize(); + + cursor = pos - direct * CHUNK_SIZE_X * 2 + angle * dist; + if (cursor.y >= 128.f || cursor.y >= 0.f) cursor.y = 1; + + bool valide = true; + + if (ChunkAt(cursor)) { + int chx, chy; + ChunkAt(cursor)->GetPosition(chx, chy); + for (int index = 0; index < renderManifest.size(); ++index) + if (renderManifest[index] == Vector3i(chx, 0, chy)) { + valide = false; + ++badhitcount; + } + + if (valide) { + world.ApplyTranslation((chx - m_center[0]) * CHUNK_SIZE_X, 0, (chy - m_center[1]) * CHUNK_SIZE_Z); + world.Use(); + float dist = (pos - cursor).Length(); + float blend = ((float)VIEW_DISTANCE - dist * 2.f + 128.f) / (float)VIEW_DISTANCE; + glBlendColor(0.f, 0.f, 0.f, blend); + ChunkAt(cursor)->Render(); + world.ApplyTranslation(-(chx - m_center[0]) * CHUNK_SIZE_X, 0, -(chy - m_center[1]) * CHUNK_SIZE_Z); + renderManifest.push_back(Vector3i(chx, 0, chy)); + ++rendercount; + } + } + } + } + shader.Disable(); +}; + +void World::UpdateWorld(Player& player, Perlin& perlin, BlockInfo* blockinfo[BTYPE_LAST]) { + int cx = player.GetPosition().x; + int cy = player.GetPosition().z; + static int frameGenerate = 0; + static int frameUpdate = 0; + static int frameDelete = 0; + int side = 0; + + if (frameGenerate > 0) --frameGenerate; + if (frameUpdate > 0) --frameUpdate; + if (frameDelete > 0) --frameDelete; + + if (!frameGenerate || !frameUpdate) + while (side * CHUNK_SIZE_X <= VIEW_DISTANCE * 2) { + int tx = -side, ty = -side; + + for (; tx <= side; ++tx) + UpdateChunk(frameGenerate, frameUpdate, cx + tx * CHUNK_SIZE_X, cy + ty * CHUNK_SIZE_Z, perlin, blockinfo); + for (; ty <= side; ++ty) + UpdateChunk(frameGenerate, frameUpdate, cx + tx * CHUNK_SIZE_X, cy + ty * CHUNK_SIZE_Z, perlin, blockinfo); + for (; tx >= -side; --tx) + UpdateChunk(frameGenerate, frameUpdate, cx + tx * CHUNK_SIZE_X, cy + ty * CHUNK_SIZE_Z, perlin, blockinfo); + for (; ty >= -side; --ty) + UpdateChunk(frameGenerate, frameUpdate, cx + tx * CHUNK_SIZE_X, cy + ty * CHUNK_SIZE_Z, perlin, blockinfo); + + ++side; + } + + CleanUpWorld(frameDelete); +} \ No newline at end of file diff --git a/SQCSim2021/world.h b/SQCSim2021/world.h index a90e08c..8e4c6e9 100644 --- a/SQCSim2021/world.h +++ b/SQCSim2021/world.h @@ -6,6 +6,9 @@ #include "vector3.h" #include "player.h" #include "transformation.h" +#include "perlin.h" +#include "shader.h" +#include "textureatlas.h" #include #include #include @@ -14,27 +17,38 @@ class Chunk; class Player; class World { - public: - World(); - ~World(); +public: + World(); + ~World(); - Array2d& GetChunks(); + Array2d& GetChunks(); - Chunk* ChunkAt(float x, float y, float z) const; - Chunk* ChunkAt(const Vector3f& pos) const; - - BlockType BlockAt(float x, float y, float z, BlockType defaultBlockType = BTYPE_AIR) const; - BlockType BlockAt(const Vector3f& pos, BlockType defaultBlockType = BTYPE_AIR) const; + Chunk* ChunkAt(float x, float y, float z) const; + Chunk* ChunkAt(const Vector3f& pos) const; - void TransposeWorld(Player& player); - void CleanUpWorld(int& frames); - Chunk* RetrieveChunk(int x, int y); + 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(int& rendercount, int& badhitcount, Player& player, Transformation& world, Shader& shader, TextureAtlas& atlas, Perlin& perlin, BlockInfo* blockinfo[BTYPE_LAST]); + + void GetScope(int& x, int& y); + + void ChangeBlockAtCursor(BlockType blockType, Player& player, bool& block); + void CleanUpWorld(int& deleteframes, bool clear); private: Array2d m_chunks = Array2d(WORLD_SIZE_X, WORLD_SIZE_Y); std::vector m_tbDeleted; - int m_center[2] = {INT16_MAX / 2 - WORLD_SIZE_X / 2, INT16_MAX / 2 - WORLD_SIZE_Y / 2}; + int m_center[2] = { INT16_MAX / 2 - WORLD_SIZE_X / 2, INT16_MAX / 2 - WORLD_SIZE_Y / 2 }; + + bool GenerateChunk(int x, int y, Perlin& perlin); + void UpdateChunk(int& generates, int& updates, int chx, int chy, Perlin& perlin, BlockInfo* blockinfo[BTYPE_LAST]); + void RenderWorld(int& rendercount, int& badhitcount, Player& player, Transformation& world, Shader& shader); + void UpdateWorld(Player& player, Perlin& perlin, BlockInfo* blockinfo[BTYPE_LAST]); + void TransposeWorld(Player& player); + Chunk* RetrieveChunk(int x, int y); + + }; #endif // WORLD_H__