diff --git a/CMakeLists.txt b/CMakeLists.txt index 5810665..0a7cac1 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -80,7 +80,7 @@ find_package(Intl REQUIRED) find_package(Boost COMPONENTS program_options REQUIRED) #Find all sources but one -file(GLOB SOURCES "source/code/*.cpp" "source/code/*/*.cpp" "source/code/Libs/*.c") +file(GLOB SOURCES "source/code/*.cpp" "source/code/*.inc" "source/code/*.h*" "source/code/*/*.cpp" "source/code/*/*.h*" "source/code/Libs/*.c" "source/code/Libs/*.h*") #I am still trying to get BlockGame to compile as a source file #list(REMOVE_ITEM SOURCES "${blockattack_SOURCE_DIR}/source/code/BlockGame.cpp") diff --git a/Game/data/puzzles/puzzle.levels b/Game/data/puzzles/puzzle.levels index c53240d..f48d57d 100644 --- a/Game/data/puzzles/puzzle.levels +++ b/Game/data/puzzles/puzzle.levels @@ -1,4 +1,4 @@ -27 +28 1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 @@ -350,3 +350,16 @@ 3 5 1 2 0 4 0 2 4 3 1 5 0 2 4 3 1 5 +1 +-1 -1 -1 -1 -1 -1 +-1 -1 -1 -1 -1 -1 +-1 -1 -1 -1 -1 -1 +-1 -1 -1 -1 -1 -1 +-1 -1 -1 2 -1 -1 +-1 -1 -1 4 -1 -1 +-1 -1 -1 0 -1 -1 +-1 -1 2 5 -1 -1 +-1 -1 4 1 2 -1 +-1 -1 2 0 3 -1 +-1 4 0 3 5 2 +2 2 5 3 1 1 diff --git a/Game/data/sprites/sample_alt_gfx.sprite b/Game/data/sprites/sample_alt_gfx.sprite new file mode 100644 index 0000000..23eb1ad --- /dev/null +++ b/Game/data/sprites/sample_alt_gfx.sprite @@ -0,0 +1,14 @@ +{ + + +"back_board_sample_snow" : { + "texture" : "alt_gfx/back_board_sample_snow", + "topx" : 0, + "topy" : 0, + "height" : 1200, + "width" : 600, + "number_of_frames" : 1, + "frame_time" : 1 +} + +} diff --git a/Game/data/textures/alt_gfx/back_board_sample_snow.jpg b/Game/data/textures/alt_gfx/back_board_sample_snow.jpg new file mode 100644 index 0000000..8672557 Binary files /dev/null and b/Game/data/textures/alt_gfx/back_board_sample_snow.jpg differ diff --git a/Game/data/textures/trans_cover.png b/Game/data/textures/trans_cover.png index ddbad2f..fecfbd6 100644 Binary files a/Game/data/textures/trans_cover.png and b/Game/data/textures/trans_cover.png differ diff --git a/source/AUTH b/source/AUTH index ab1f219..a9889db 100644 --- a/source/AUTH +++ b/source/AUTH @@ -15,6 +15,7 @@ freeserif.ttf Free Software Foundation penguinattack.ttf Dustin Norlander - GPLv2 /textures/ +alt_gfx/back_board_sample_snow.jpg Poul Sander back_board.png qubodup background.png qubodup background_sixteen_nine.png Poul Sander (based of qubodup's background.png) diff --git a/source/code/BlockGameSdl.inc b/source/code/BlockGameSdl.inc index 73561e0..c1d2880 100644 --- a/source/code/BlockGameSdl.inc +++ b/source/code/BlockGameSdl.inc @@ -26,6 +26,7 @@ https://blockattack.net #include "sago/SagoTextField.hpp" #include "mainVars.inc" + static void setScoreboardFont(const sago::SagoDataHolder* holder, sago::SagoTextField& field, const char* text){ field.SetHolder(holder); field.SetFont("penguinattack"); @@ -64,7 +65,7 @@ public: } void DrawImgBoardBounded(const sago::SagoSprite& img, int x, int y) const { - DrawIMG_Bounded(img, globalData.screen, x+topx, y+topy, topx, topy, topx + backBoard.GetWidth(), topy + backBoard.GetHeight()); + DrawIMG_Bounded(img, globalData.screen, x+topx, y+topy, topx, topy, topx + BOARD_WIDTH, topy + BOARD_HEIGHT); } void PrintTextCenteredBoard(int x, int y, sago::SagoTextField& field) { @@ -221,7 +222,7 @@ private: SDL_Texture* CreateGarbageTexture(int x, int y, int size_x, int size_y, SDL_Rect& dstrect, SDL_Rect& srcrect) const { dstrect = { x, y, size_x*bsize, size_y*bsize }; srcrect = { 0, 0, size_x*bsize, size_y*bsize }; - SDL_Rect bound = {topx, topy, backBoard.GetWidth(), backBoard.GetHeight()}; + SDL_Rect bound = {topx, topy, BOARD_WIDTH, BOARD_HEIGHT}; CropTexture (dstrect, srcrect, bound); SDL_Texture* mTexture = SDL_CreateTexture( globalData.screen, SDL_PIXELFORMAT_RGBA8888, SDL_TEXTUREACCESS_TARGET, size_x*bsize, size_y*bsize ); SDL_SetRenderTarget( globalData.screen, mTexture ); @@ -409,7 +410,7 @@ public: this->timeLabel.Draw(globalData.screen, this->GetTopX()+310,this->GetTopY()-68+197); this->chainLabel.Draw(globalData.screen, this->GetTopX()+310,this->GetTopY()-68+246); this->speedLabel.Draw(globalData.screen, this->GetTopX()+310,this->GetTopY()-68+295); - DrawImgBoard(backBoard, 0, 0); + backBoard.DrawScaled(globalData.screen, SDL_GetTicks(), this->GetTopX(),this->GetTopY(), BOARD_WIDTH, BOARD_HEIGHT); PaintBricks(); if (stageClear) { diff --git a/source/code/DialogBox.cpp b/source/code/DialogBox.cpp index 83127d3..7936b13 100644 --- a/source/code/DialogBox.cpp +++ b/source/code/DialogBox.cpp @@ -184,9 +184,19 @@ void DialogBox::Draw(SDL_Renderer* target) { this->y = globalData.ysize/2-100; DrawRectYellow(target, x, y, 200, 600); headerLabel.Draw(target, x+300, y+20, sago::SagoTextField::Alignment::center); - DrawRectYellow(target, x+25, y+128, 50, 250); + if (insideRect(x+25, y+128, 50, 250)) { + DrawRectYellow(target, x+24, y+127, 52, 252); + } + else { + DrawRectYellow(target, x+25, y+128, 50, 250); + } enterLabel.Draw(target, x+150, y+140, sago::SagoTextField::Alignment::center); - DrawRectYellow(target, x+325, y+128, 50, 250); + if (insideRect(x+325, y+128, 50, 250)) { + DrawRectYellow(target, x+324, y+127, 52, 252); + } + else { + DrawRectYellow(target, x+325, y+128, 50, 250); + } cancelLabel.Draw(target, x+450, y+140, sago::SagoTextField::Alignment::center); DrawRectWhite(target, x+26, y+64, 54, 600-2*26); textField.SetText(rk->GetString()); diff --git a/source/code/global.hpp b/source/code/global.hpp index 4dbbbdd..4d74aee 100644 --- a/source/code/global.hpp +++ b/source/code/global.hpp @@ -69,6 +69,9 @@ const int SIXTEEN_NINE_WIDTH = 1364; const int FOUR_THREE_WIDTH = 1024; const int SCREEN_HIGHT = 768; +const int BOARD_WIDTH = 300; +const int BOARD_HEIGHT = 600; + struct GlobalData { sago::SagoSprite bHighScore; sago::SagoSprite bBack; diff --git a/source/code/main.cpp b/source/code/main.cpp index 43c8326..37c1c33 100644 --- a/source/code/main.cpp +++ b/source/code/main.cpp @@ -181,7 +181,7 @@ static int InitImages(sago::SagoSpriteHolder& holder) { globalData.bNext = holder.GetSprite("b_blank"); bRetry = holder.GetSprite("b_blank"); globalData.mouse = holder.GetSprite("mouse"); - backBoard = holder.GetSprite("back_board"); + backBoard = holder.GetSprite("back_board"); // Can also be "back_board_sample_snow" sagoTextSetBlueFont(player1name); sagoTextSetBlueFont(player2name); @@ -546,7 +546,7 @@ void DrawEverything(int xsize, int ysize,BlockGameSdl* theGame, BlockGameSdl* th */ if (!twoPlayers && !theGame->isGameOver()) { //Blank player2's board: - DrawIMG(backBoard,globalData.screen,theGame2->GetTopX(),theGame2->GetTopY()); + backBoard.DrawScaled(globalData.screen, SDL_GetTicks(), theGame2->GetTopX(),theGame2->GetTopY(), BOARD_WIDTH, BOARD_HEIGHT); //Write a description: std::string gametypeName; std::string infostring; diff --git a/source/code/sago/SagoDataHolder.cpp b/source/code/sago/SagoDataHolder.cpp index cb2ce7f..ce79a31 100644 --- a/source/code/sago/SagoDataHolder.cpp +++ b/source/code/sago/SagoDataHolder.cpp @@ -114,7 +114,12 @@ SDL_Texture* SagoDataHolder::getTexturePtr(const std::string& textureName) const printFileWeLoad(path); } if (!PHYSFS_exists(path.c_str())) { - sago::SagoFatalErrorF("getTextureFailed - Texture does not exist: %s", path.c_str()); + // We did not find the png file. Try to see if there are a jpg file. + std::string jpg_path = "textures/"+textureName+".jpg"; + if (!PHYSFS_exists(jpg_path.c_str())) { + sago::SagoFatalErrorF("getTextureFailed - Texture does not exist: %s", path.c_str()); + } + path = jpg_path; } unsigned int m_size = 0; std::unique_ptr m_data;