diff --git a/background.bmp b/background.bmp new file mode 100644 index 0000000..5a6a460 Binary files /dev/null and b/background.bmp differ diff --git a/game.cpp b/game.cpp index 3b2f964..51ca248 100644 --- a/game.cpp +++ b/game.cpp @@ -349,11 +349,14 @@ int Game::tick() } int returnVal; + int level = linesCleared_/100; + if (level > 12) + level = 12; removePiece(piece_, px_, py_); markBlocksForClearing(); returnVal = collapse(); moveClearBar(); - if (counter < COUNTER_SPACE) + if (counter < COUNTER_SPACE - level) { counter++; placePiece(piece_, px_, py_); diff --git a/jLightRed.bmp b/jLightRed.bmp new file mode 100644 index 0000000..e61f08c Binary files /dev/null and b/jLightRed.bmp differ diff --git a/jLightWhite.bmp b/jLightWhite.bmp new file mode 100644 index 0000000..c3add5a Binary files /dev/null and b/jLightWhite.bmp differ diff --git a/jRed.bmp b/jRed.bmp new file mode 100644 index 0000000..b6dea0f Binary files /dev/null and b/jRed.bmp differ diff --git a/jWhite.bmp b/jWhite.bmp new file mode 100644 index 0000000..5252261 Binary files /dev/null and b/jWhite.bmp differ diff --git a/move.ogg b/move.ogg index 272150d..ff2a1e6 100644 Binary files a/move.ogg and b/move.ogg differ diff --git a/turn.ogg b/turn.ogg index ad059b7..5dfcfa6 100644 Binary files a/turn.ogg and b/turn.ogg differ diff --git a/viewer.cpp b/viewer.cpp index 41258fa..c6d8c33 100644 --- a/viewer.cpp +++ b/viewer.cpp @@ -133,6 +133,7 @@ void Viewer::on_realize() LoadGLTextures("floor.bmp", floorTexId); LoadGLTextures("playButton.bmp", playButtonTex); LoadGLTextures("playButtonClicked.bmp", playButtonClickedTex); + LoadGLTextures("background.bmp", backgroundTex); GenNormalizationCubeMap(256, cube); @@ -277,6 +278,27 @@ bool Viewer::on_expose_event(GdkEventExpose* event) glLightfv(GL_LIGHT0, GL_SPECULAR, specularLight0); glLightfv(GL_LIGHT0, GL_POSITION, lightPos); + glActiveTexture(GL_TEXTURE0); + glEnable(GL_TEXTURE_2D); + glBindTexture(GL_TEXTURE_2D, backgroundTex); + glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_REPEAT ); + glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_REPEAT ); + glBegin(GL_QUADS); + glTexCoord2f(0.0f, 0.0f); + glVertex3f(-9, 0, -10); + + glTexCoord2f(0.0f, 1.0f); + glVertex3f(-9, 16, -10); + + glTexCoord2f(1.0f, 1.0f); + glVertex3f(27, 16, -10); + + glTexCoord2f(1.0f, 0.0f); + glVertex3f(27, 0, -10); + glEnd(); + glBindTexture(GL_TEXTURE_2D, 0); + glDisable(GL_TEXTURE_2D); + if (loadScreen) { drawStartScreen(false, playButtonTex); @@ -853,25 +875,25 @@ void Viewer::drawFallingBox() void Viewer::drawFloor() { // Draw Floor -/* glEnable(GL_TEXTURE_2D); + glEnable(GL_TEXTURE_2D); glBindTexture(GL_TEXTURE_2D, floorTexId); glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_REPEAT ); - glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_REPEAT );*/ + glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_REPEAT ); glNormal3f(0.0, 1.0, 0.0); glColor3d(1, 1, 1); glBegin(GL_QUADS); - // glTexCoord2f(0.0, 0.0); + glTexCoord2f(0.0, 0.0); glVertex3d(-100, -1, -100); - // glTexCoord2f(0.0, 10.0); + glTexCoord2f(0.0, 10.0); glVertex3d(-100, -1, 100); - // glTexCoord2f(10.0, 10.0); + glTexCoord2f(10.0, 10.0); glVertex3d(100, -1, 100); - // glTexCoord2f(10.0, 0.0); + glTexCoord2f(10.0, 0.0); glVertex3d(100, -1, -100); glEnd(); - // glBindTexture(GL_TEXTURE_2D, 0); - // glDisable(GL_TEXTURE_2D); + glBindTexture(GL_TEXTURE_2D, 0); + glDisable(GL_TEXTURE_2D); } void Viewer::drawScene(int itesdfr) { @@ -1626,10 +1648,10 @@ bool Viewer::on_key_press_event( GdkEventKey *ev ) if (gameOver) return true; -/* if (ev->keyval == GDK_Left || ev->keyval == GDK_Right) + if (ev->keyval == GDK_Left || ev->keyval == GDK_Right) sm.PlaySound(moveSound); else if (ev->keyval == GDK_Up || ev->keyval == GDK_Down) - sm.PlaySound(turnSound);*/ + sm.PlaySound(turnSound); int r, c; r = game->py_; @@ -1653,9 +1675,10 @@ bool Viewer::gameTick() { if (loadScreen) return true; - - int returnVal = game->tick(); + int cubesDeletedBeforeTick = game->getLinesCleared(); + int returnVal = game->tick(); + int cubesDeletedAfterTick = game->getLinesCleared(); // String streams used to print score and lines cleared std::stringstream scoreStream, linesStream; std::string s; @@ -1664,6 +1687,13 @@ bool Viewer::gameTick() scoreStream << game->getScore(); scoreLabel->set_text("Score:\t" + scoreStream.str()); + if (cubesDeletedBeforeTick/100 < cubesDeletedAfterTick/100) + { + LoadGLTextures("jWhite.bmp", texture[0]); + LoadGLTextures("jRed.bmp", texture[1]); + LoadGLTextures("jLightWhite.bmp", texture[2]); + LoadGLTextures("jLightRed.bmp", texture[3]); + } // If a line was cleared update the linesCleared widget if (returnVal > 0) { diff --git a/viewer.hpp b/viewer.hpp index f80774f..274e019 100644 --- a/viewer.hpp +++ b/viewer.hpp @@ -195,7 +195,7 @@ class Viewer : public Gtk::GL::DrawingArea { float planeNormal[4]; bool drawingShadow; - GLuint cube, bumpMap, floorTexId, playButtonTex, playButtonClickedTex; + GLuint cube, bumpMap, floorTexId, playButtonTex, playButtonClickedTex, backgroundTex; bool clickedButton; std::vector< std::pair > silhouette; std::vector< Particle *> particles;