From 61ce97a342c0e1dbf4eb563bb8ab87f0194be81e Mon Sep 17 00:00:00 2001 From: Elio Blanca Date: Mon, 24 Apr 2023 20:44:30 +0200 Subject: [PATCH] Puzzle game new entry: blockout2 (#8498) * new blockout2 puzzle game * small fixes to the recipe --- games-puzzle/blockout2/blockout2-2.5.recipe | 59 ++ .../blockout2/patches/blockout2-2.5.patchset | 977 ++++++++++++++++++ 2 files changed, 1036 insertions(+) create mode 100644 games-puzzle/blockout2/blockout2-2.5.recipe create mode 100644 games-puzzle/blockout2/patches/blockout2-2.5.patchset diff --git a/games-puzzle/blockout2/blockout2-2.5.recipe b/games-puzzle/blockout2/blockout2-2.5.recipe new file mode 100644 index 000000000..c6f1e1370 --- /dev/null +++ b/games-puzzle/blockout2/blockout2-2.5.recipe @@ -0,0 +1,59 @@ +SUMMARY="3D falling blocks game" +DESCRIPTION="BlockOut II is an OpenGL adaptation of the original BlockOut DOS \ +game edited by California Dreams in 1989. Similar to Tetris but with the third \ +dimension, BlockOut II has the same features as the original game with a few \ +graphics improvements. Score calculation is also nearly similar to the original \ +game. BlockOut II has been designed by an addicted player for addicted players." +HOMEPAGE="http://www.blockout.net/blockout2/" +COPYRIGHT="2007-2014 Jean-Luc Pons" +LICENSE="GNU GPL v2" +REVISION="1" +SOURCE_URI="https://salsa.debian.org/games-team/blockout2/-/archive/master/blockout2-master.tar.bz2" +CHECKSUM_SHA256="08b677be01c02e6695559ccc65df1cafcac0793b7864ba7e2285059babf57349" +SOURCE_DIR="blockout2-master/" +PATCHES="blockout2-2.5.patchset" + +ARCHITECTURES="all !x86_gcc2" +SECONDARY_ARCHITECTURES="x86" + +PROVIDES=" + blockout2$secondaryArchSuffix = $portVersion + app:blockout2$secondaryArchSuffix + " + +REQUIRES=" + haiku$secondaryArchSuffix + lib:libSDL_1.2$secondaryArchSuffix + lib:libSDL_mixer_1.2$secondaryArchSuffix + lib:libGL$secondaryArchSuffix + lib:libglu$secondaryArchSuffix + lib:libpng$secondaryArchSuffix + " + +BUILD_REQUIRES=" + haiku${secondaryArchSuffix}_devel + devel:libSDL_1.2$secondaryArchSuffix + devel:libSDL_mixer_1.2$secondaryArchSuffix + devel:libglu$secondaryArchSuffix + devel:libpng$secondaryArchSuffix + " + +BUILD_PREREQUIRES=" + cmd:gcc$secondaryArchSuffix + cmd:find + cmd:make + " + +BUILD() +{ + make $jobArgs -f debian/Makefile +} + +INSTALL() +{ + mkdir -p $appsDir/Blockout2 + cp -rf BlockOut/images BlockOut/sounds $appsDir/Blockout2 + cp obj/blockout2 $appsDir/Blockout2/Blockout2 + + addAppDeskbarSymlink $appsDir/Blockout2/Blockout2 "BlockOut II" +} diff --git a/games-puzzle/blockout2/patches/blockout2-2.5.patchset b/games-puzzle/blockout2/patches/blockout2-2.5.patchset new file mode 100644 index 000000000..2a562a6cf --- /dev/null +++ b/games-puzzle/blockout2/patches/blockout2-2.5.patchset @@ -0,0 +1,977 @@ +From 0eaf01bac5e6ea62711e921bbcdffe5189089e88 Mon Sep 17 00:00:00 2001 +From: eblanca +Date: Sun, 23 Apr 2023 18:52:22 +0000 +Subject: applying patch 01_blockout2-2.4-alt-x86_64.patch + + +diff --git a/BlockOut/Utils.cpp b/BlockOut/Utils.cpp +index 4ccd8df..06391f8 100644 +--- a/BlockOut/Utils.cpp ++++ b/BlockOut/Utils.cpp +@@ -106,8 +106,9 @@ char *FormatDate(uint32 time) { + + static char ret[32]; + if( time>0 ) { +-#ifdef LOCALTIME32 +- struct tm *ts = _localtime32((__time32_t *)&time); ++#ifdef LOCALTIME64 ++ time_t d = (time_t)time; ++ struct tm *ts = localtime(&d); + #else + time_t innerTm = (time_t)time; + struct tm *ts = localtime((time_t *)&innerTm); +@@ -130,8 +131,9 @@ char *FormatDateShort(uint32 time) { + + static char ret[32]; + if( time>0 ) { +-#ifdef LOCALTIME32 +- struct tm *ts = _localtime32((__time32_t *)&time); ++#ifdef LOCALTIME64 ++ time_t d = (time_t)time; ++ struct tm *ts = localtime(&d); + #else + time_t innerTm = (time_t)time; + struct tm *ts = localtime((time_t *)&innerTm); +-- +2.37.3 + + +From a91b745cd0dd7e7547bdcf7dc663e6a8ddba7c3d Mon Sep 17 00:00:00 2001 +From: eblanca +Date: Sun, 23 Apr 2023 18:52:22 +0000 +Subject: applying patch 02_debian-kfreebsd.ftbfs.patch + + +diff --git a/BlockOut/Http.cpp b/BlockOut/Http.cpp +index 0b4f12b..b8b5f5f 100644 +--- a/BlockOut/Http.cpp ++++ b/BlockOut/Http.cpp +@@ -224,9 +224,11 @@ int Http::Connect(char *site, int port) { + case ENOMEM: + sprintf(err_str,"Socket error: Insufficient user memory is available"); + break; ++#ifdef ENOSR + case ENOSR: + sprintf(err_str,"Socket error: Insufficient STREAMS resources available"); + break; ++#endif + case EPROTONOSUPPORT: + sprintf(err_str,"Socket error: Specified protocol is not supported"); + break; +-- +2.37.3 + + +From 0b9359819e528cb6a84754d30f6234754bec7726 Mon Sep 17 00:00:00 2001 +From: eblanca +Date: Sun, 23 Apr 2023 18:52:22 +0000 +Subject: applying patch 03_debian_multimedia_paths.patch + + +diff --git a/BlockOut/Utils.cpp b/BlockOut/Utils.cpp +index 06391f8..a220660 100644 +--- a/BlockOut/Utils.cpp ++++ b/BlockOut/Utils.cpp +@@ -209,12 +209,8 @@ BOOL CheckEnv() { + return FALSE; + } + +- char *blockoutHome = getenv("BL2_HOME"); +- if( blockoutHome==NULL ) { +- printf("BL2_HOME environement variable if not defined !\n"); +- printf("Please set the BL2_HOME to the BlockOut II installation directory (ex: BL2_HOME=/usr/local/bl2).\n"); +- return FALSE; +- } ++ const char *blockoutHome = "/usr/share/games/blockout2"; ++ + strcpy( bl2Home , blockoutHome ); + + char bl2Dir[512]; +-- +2.37.3 + + +From 83a874a9bc77c1f0fb7a222edb579b68681e9125 Mon Sep 17 00:00:00 2001 +From: eblanca +Date: Sun, 23 Apr 2023 18:52:22 +0000 +Subject: applying patch 04_fixed_all_gcc_warnings.patch + + +diff --git a/BlockOut/BlockOut.cpp b/BlockOut/BlockOut.cpp +index a21a924..8a381ae 100644 +--- a/BlockOut/BlockOut.cpp ++++ b/BlockOut/BlockOut.cpp +@@ -65,11 +65,11 @@ int main(int argc,char *argv[]) + // Name: BlockOut() + // Desc: Application constructor. Sets attributes for the app. + //----------------------------------------------------------------------------- +-BlockOut::BlockOut() ++BlockOut::BlockOut() : GLApplication(STR(APP_VERSION)) + { + inited = FALSE; + mode = MENU_MODE; +- m_strWindowTitle = STR(APP_VERSION); ++// m_strWindowTitle = STR(APP_VERSION); + ZeroMemory( m_bKey, sizeof(m_bKey) ); + } + +diff --git a/BlockOut/EditControl.cpp b/BlockOut/EditControl.cpp +index 5985c09..f2a3b17 100644 +--- a/BlockOut/EditControl.cpp ++++ b/BlockOut/EditControl.cpp +@@ -30,7 +30,7 @@ void EditControl::SetDisplayLength(int length) { + + // ------------------------------------------------ + +-void EditControl::SetMode(char *text,BOOL edit,BYTE *keys) { ++void EditControl::SetMode(const char *text,BOOL edit,BYTE *keys) { + + if( strlen(text)>=255 ) { + strncpy(editText,text,255); +diff --git a/BlockOut/EditControl.h b/BlockOut/EditControl.h +index 1028380..12251ed 100644 +--- a/BlockOut/EditControl.h ++++ b/BlockOut/EditControl.h +@@ -27,7 +27,7 @@ class EditControl { + void SetDisplayLength(int length); + + // Set edit control mode (keys can be NULL) +- void SetMode(char *text,BOOL edit,BYTE *keys); ++ void SetMode(const char *text,BOOL edit,BYTE *keys); + + // Get the mode + BOOL GetMode(); +diff --git a/BlockOut/GLApp/GLApp.cpp b/BlockOut/GLApp/GLApp.cpp +index 3bec6f8..8263b30 100644 +--- a/BlockOut/GLApp/GLApp.cpp ++++ b/BlockOut/GLApp/GLApp.cpp +@@ -14,11 +14,13 @@ extern char *LID(char *fileName); + + // ------------------------------------------- + +-GLApplication::GLApplication() { ++GLApplication::GLApplication(const char * strWindowTitle) : ++ m_strWindowTitle(strWindowTitle) ++{ + + m_bWindowed = true; + m_bVSync = false; +- m_strWindowTitle = (char *)"GL application"; ++ //m_strWindowTitle = (char *)"GL application"; + strcpy((char *)m_strFrameStats,""); + m_screenWidth = 640; + m_screenHeight = 480; +@@ -286,7 +288,7 @@ void GLApplication::printGlError() { + #ifdef WINDOWS + MessageBox(NULL, message, "Error", MB_OK | MB_ICONERROR); + #else +- printf(message); ++ printf("%s", message); + #endif + + } +diff --git a/BlockOut/GLApp/GLApp.h b/BlockOut/GLApp/GLApp.h +index 105cf0c..66f1486 100644 +--- a/BlockOut/GLApp/GLApp.h ++++ b/BlockOut/GLApp/GLApp.h +@@ -60,7 +60,7 @@ protected: + + // Internal variables for the state of the app + BOOL m_bWindowed; +- char* m_strWindowTitle; ++ const char* m_strWindowTitle; + int m_screenWidth; + int m_screenHeight; + BOOL m_bVSync; +@@ -95,7 +95,7 @@ public: + static void printGlError(); + + // Internal constructor +- GLApplication(); ++ GLApplication(const char * strWindowTitle); + + private: + +diff --git a/BlockOut/GLApp/GLFont.cpp b/BlockOut/GLApp/GLFont.cpp +index 49d079a..4ac88f9 100644 +--- a/BlockOut/GLApp/GLFont.cpp ++++ b/BlockOut/GLApp/GLFont.cpp +@@ -8,7 +8,7 @@ + #undef LoadImage + #include + +-extern char *LID(char *fileName); ++extern const char *LID(const char *fileName); + + // ------------------------------------------- + +@@ -21,7 +21,7 @@ int GLFont2D::RestoreDeviceObjects(int scrWidth,int scrHeight) { + + // Load the image + CImage img; +- if( !img.LoadImage(LID((char *)"images/font.png")) ) { ++ if( !img.LoadImage(LID("images/font.png")) ) { + #ifdef WINDOWS + char message[256]; + sprintf(message,"Failed to load %s\n",LID((char *)"images/font.png")); +diff --git a/BlockOut/GLApp/GLSprite.cpp b/BlockOut/GLApp/GLSprite.cpp +index 44aee00..27a6aad 100644 +--- a/BlockOut/GLApp/GLSprite.cpp ++++ b/BlockOut/GLApp/GLSprite.cpp +@@ -8,7 +8,7 @@ + #undef LoadImage + #include + +-extern char *LID(char *fileName); ++extern const char *LID(const char *fileName); + + // ------------------------------------------- + +@@ -54,7 +54,7 @@ void Sprite2D::UpdateSprite(int x1,int y1,int x2,int y2) { + + // ------------------------------------------- + +-int Sprite2D::RestoreDeviceObjects(char *diffName,char *alphaName,int scrWidth,int scrHeight) { ++int Sprite2D::RestoreDeviceObjects(const char *diffName,const char *alphaName,int scrWidth,int scrHeight) { + + GLint bpp; + GLenum format; +diff --git a/BlockOut/GLApp/GLSprite.h b/BlockOut/GLApp/GLSprite.h +index 3f92868..fca3c1f 100644 +--- a/BlockOut/GLApp/GLSprite.h ++++ b/BlockOut/GLApp/GLSprite.h +@@ -15,7 +15,7 @@ public: + + // Initialise the sprite + // return 1 when success, 0 otherwise +- int RestoreDeviceObjects(char *diffName,char *alphaName,int srcWidth,int scrHeight); ++ int RestoreDeviceObjects(const char *diffName,const char *alphaName,int srcWidth,int scrHeight); + + // Update sprite mapping and coordinates + void UpdateSprite(int x1,int y1,int x2,int y2); +diff --git a/BlockOut/Menu.h b/BlockOut/Menu.h +index 55e4bfd..dcf5bcc 100644 +--- a/BlockOut/Menu.h ++++ b/BlockOut/Menu.h +@@ -61,8 +61,8 @@ class Menu { + // Menu page + void ToPage(MenuPage *page); + void ToPage(MenuPage *page,int iParam,void *wParam); +- void RenderText(int x,int y,BOOL selected,char *text); +- void RenderTitle(char *title); ++ void RenderText(int x,int y,BOOL selected,const char *text); ++ void RenderTitle(const char *title); + + PageMainMenu mainMenuPage; + PageStartGame startGamePage; +diff --git a/BlockOut/MenuGraphics.cpp b/BlockOut/MenuGraphics.cpp +index a26e86e..de0be06 100644 +--- a/BlockOut/MenuGraphics.cpp ++++ b/BlockOut/MenuGraphics.cpp +@@ -438,7 +438,7 @@ void Menu::RenderChar(int x,int y,int w,int h,BOOL selected,char c) { + + // --------------------------------------------------------------------- + +-void Menu::RenderTitle(char *title) { ++void Menu::RenderTitle(const char *title) { + + int lgth = (int)strlen(title); + int nwFont = fround((float)wFont*1.1f); +@@ -454,7 +454,7 @@ void Menu::RenderTitle(char *title) { + + // --------------------------------------------------------------------- + +-void Menu::RenderText(int x,int y,BOOL selected,char *text) { ++void Menu::RenderText(int x,int y,BOOL selected,const char *text) { + + float startLine = 0.515f; + float startColumn = 0.15f; +diff --git a/BlockOut/SetupManager.cpp b/BlockOut/SetupManager.cpp +index 2d549dc..bb47a0a 100644 +--- a/BlockOut/SetupManager.cpp ++++ b/BlockOut/SetupManager.cpp +@@ -364,7 +364,7 @@ int SetupManager::GetTimeout() { + + // ------------------------------------------------ + +-char *SetupManager::GetName() { ++const char *SetupManager::GetName() { + + static char ret[32]; + strcpy(ret,""); +diff --git a/BlockOut/SetupManager.h b/BlockOut/SetupManager.h +index 16bf0ca..469a343 100644 +--- a/BlockOut/SetupManager.h ++++ b/BlockOut/SetupManager.h +@@ -67,7 +67,7 @@ class SetupManager { + float GetAnimationTime(); /* in seconds */ + + // Names +- char *GetName(); ++ const char *GetName(); + const char *GetBlockSetName(); + + // Sound +diff --git a/BlockOut/SoundManager.cpp b/BlockOut/SoundManager.cpp +index bfb2ffd..2996900 100644 +--- a/BlockOut/SoundManager.cpp ++++ b/BlockOut/SoundManager.cpp +@@ -21,6 +21,7 @@ + + #define PLAY(x) if( enabled && x ) Mix_PlayChannel (-1, x, 0); + ++extern const char * LID(const char * fileName); + // ------------------------------------------------ + + SoundManager::SoundManager() { +@@ -82,7 +83,7 @@ void SoundManager::SetEnable(BOOL enable) { + + // ------------------------------------------------ + +-int SoundManager::InitSound(char *fileName,Mix_Chunk **snd) { ++int SoundManager::InitSound(const char *fileName,Mix_Chunk **snd) { + + *snd = Mix_LoadWAV ( fileName ); + if( *snd == NULL ) { +diff --git a/BlockOut/SoundManager.h b/BlockOut/SoundManager.h +index 2195223..a4d2793 100644 +--- a/BlockOut/SoundManager.h ++++ b/BlockOut/SoundManager.h +@@ -55,7 +55,7 @@ class SoundManager { + void SetEnable(BOOL enable); + + private: +- int InitSound(char *fileName,Mix_Chunk **snd); ++ int InitSound(const char *fileName,Mix_Chunk **snd); + + char errMsg[1024]; + BOOL enabled; +diff --git a/BlockOut/Types.h b/BlockOut/Types.h +index 1bceaef..7c89802 100644 +--- a/BlockOut/Types.h ++++ b/BlockOut/Types.h +@@ -197,21 +197,21 @@ typedef struct { + // Util functions + //----------------------------------------------------------------------------- + +-extern VERTEX v(float x,float y,float z); +-extern void Normalize(VERTEX *v); +-extern int fround(float x); +-extern char *FormatTime(float seconds); +-extern char *FormatDate(uint32 time); +-extern char *FormatDateShort(uint32 time); +-extern int CreateTexture(int width,int height,char *imgName,GLuint *hmap); +-extern char GetChar(BYTE *keys); ++VERTEX v(float x,float y,float z); ++void Normalize(VERTEX *v); ++int fround(float x); ++char *FormatTime(float seconds); ++char *FormatDate(uint32 time); ++char *FormatDateShort(uint32 time); ++int CreateTexture(int width,int height,const char *imgName,GLuint *hmap); ++char GetChar(BYTE *keys); + #ifndef WINDOWS +-extern void ZeroMemory(void *buff,int size); ++void ZeroMemory(void *buff,int size); + #endif +-extern BOOL DirExists(char *dirname); +-extern BOOL CheckEnv(); +-extern char *LID(char *fileName); +-extern char *LHD(char *fileName); ++BOOL DirExists(char *dirname); ++BOOL CheckEnv(); ++const char *LID(const char *fileName); ++const char *LHD(const char *fileName); + + + #endif /* TYPESH */ +diff --git a/BlockOut/Utils.cpp b/BlockOut/Utils.cpp +index a220660..1d3020e 100644 +--- a/BlockOut/Utils.cpp ++++ b/BlockOut/Utils.cpp +@@ -236,7 +236,7 @@ BOOL CheckEnv() { + // Name: LID() + // Desc: Locate file in the installation directory + //----------------------------------------------------------------------------- +-char *LID(char *fileName) { ++const char *LID(const char *fileName) { + + #ifdef WINDOWS + return fileName; +@@ -252,7 +252,7 @@ char *LID(char *fileName) { + // Name: LHD() + // Desc: Locate file in the home directory + //----------------------------------------------------------------------------- +-char *LHD(char *fileName) { ++const char *LHD(const char *fileName) { + + static char ret[512]; + +@@ -276,7 +276,7 @@ char *LHD(char *fileName) { + // Name: CreateTexture() + // Desc: Create a texture (no alpha) + //----------------------------------------------------------------------------- +-int CreateTexture(int width,int height,char *imgName,GLuint *hmap) { ++int CreateTexture(int width,int height,const char *imgName,GLuint *hmap) { + + *hmap = 0; + CImage img; +diff --git a/ImageLib/include/CImage.h b/ImageLib/include/CImage.h +index cdc350a..85e3838 100644 +--- a/ImageLib/include/CImage.h ++++ b/ImageLib/include/CImage.h +@@ -16,7 +16,7 @@ public: + // Load an image + // Supports GIF , JPG or PNG format + // Return 1 when image has been succesfully load , 0 otherwise. +- int LoadImage(char *FileName); ++ int LoadImage(const char *FileName); + + // Get error message if LoadImage fails. + char *GetErrorMessage(); +diff --git a/ImageLib/src/CImage.cpp b/ImageLib/src/CImage.cpp +index c68eed7..2f889bd 100644 +--- a/ImageLib/src/CImage.cpp ++++ b/ImageLib/src/CImage.cpp +@@ -27,7 +27,7 @@ CImage::CImage() { + + // ------ Load image ----- + +-int CImage::LoadImage(char *FileName) { ++int CImage::LoadImage(const char *FileName) { + + Release(); + +diff --git a/ImageLib/src/CImage.h b/ImageLib/src/CImage.h +index 2602989..ffb3d6f 100644 +--- a/ImageLib/src/CImage.h ++++ b/ImageLib/src/CImage.h +@@ -18,7 +18,7 @@ public: + // Load an image + // Supports GIF , JPG or PNG format + // Return 1 when image has been succesfully load , 0 otherwise. +- int LoadImage(char *FileName); ++ int LoadImage(const char *FileName); + + // Get error message if LoadImage fails. + char *GetErrorMessage(); +diff --git a/ImageLib/src/png/hpng.c b/ImageLib/src/png/hpng.c +index 25c7089..eb8cc05 100644 +--- a/ImageLib/src/png/hpng.c ++++ b/ImageLib/src/png/hpng.c +@@ -1,5 +1,6 @@ + #include + #include ++#include + #include "png/png.h" + #include "hpng.h" + +-- +2.37.3 + + +From e654389c8d4276b5d7c93dc2e66ab500506a550b Mon Sep 17 00:00:00 2001 +From: eblanca +Date: Sun, 23 Apr 2023 18:52:23 +0000 +Subject: applying patch 05_remove_unnecessary_libdeps.patch + + +diff --git a/ImageLib/src/CImage.cpp b/ImageLib/src/CImage.cpp +index 2f889bd..d1d7a55 100644 +--- a/ImageLib/src/CImage.cpp ++++ b/ImageLib/src/CImage.cpp +@@ -4,10 +4,10 @@ + /* Use an ultra fast compression method */ + /***************************************************/ + #include ++#include ++#include + + #include "CImage.h" +-#include "gif/gif.h" +-#include "jpg/jpegdecoder.h" + #include "png/hpng.h" + + #ifdef WINDOWS +@@ -50,55 +50,6 @@ int CImage::LoadImage(const char *FileName) { + return 0; + } + +- // Load GIF image +- if( strcasecmp(ext,"gif")==0 ) { +- +- GIF_IMAGE img; +- int Length; +- +- strcpy(img.FileName,FileName); +- if( !LoadGifImage(&img) ) { +- strcpy(m_LastError,GifErrorMessage); +- return 0; +- } +- +- m_Width=img.width; +- m_Height=img.height; +- Length=m_Width*m_Height; +- +- m_Data=(BYTE *)malloc( Length*3 ); +- +- for(int i=0,j=0;i + #include + #include +-#include "png/png.h" ++#include + #include "hpng.h" + + char PngErrorMessage[1024]; +@@ -100,8 +100,8 @@ int LoadPngImage(PNG_IMAGE *d) { + + // Convert the image + { +- unsigned char *src = data; +- unsigned char *dst = (unsigned char *)malloc(width*height*3); ++ char *src = data; ++ char *dst = (char *)malloc(width*height*3); + d->data = dst; + for(i = 0 ; i < height ; i++) { + for(j = 0 ; j < width ; j++) { +@@ -192,5 +192,4 @@ char *WritePngImage(char *file_name,unsigned long width,unsigned long height,uns + + /* that's it */ + return NULL; +- + } +-- +2.37.3 + + +From bed61bc65ac8e4930d205ff9f667485d50d9795a Mon Sep 17 00:00:00 2001 +From: eblanca +Date: Sun, 23 Apr 2023 18:52:23 +0000 +Subject: applying patch 06_ubuntu_fix_invalid_conversion.patch + + +diff --git a/ImageLib/src/CImage.cpp b/ImageLib/src/CImage.cpp +index d1d7a55..5cc8cbe 100644 +--- a/ImageLib/src/CImage.cpp ++++ b/ImageLib/src/CImage.cpp +@@ -32,7 +32,7 @@ int CImage::LoadImage(const char *FileName) { + Release(); + + // Get extensions +- char *p = strrchr(FileName,'.'); ++ const char *p = strrchr(FileName,'.'); + char ext[12]; + + if( p==NULL ) { +-- +2.37.3 + + +From 565da92d5a82baa1d0c67751f83e47e13374501a Mon Sep 17 00:00:00 2001 +From: eblanca +Date: Sun, 23 Apr 2023 18:52:23 +0000 +Subject: applying patch 07_ftbfs-with-libpng15.patch + + +diff --git a/ImageLib/src/png/hpng.c b/ImageLib/src/png/hpng.c +index 17b273d..ec67887 100644 +--- a/ImageLib/src/png/hpng.c ++++ b/ImageLib/src/png/hpng.c +@@ -1,7 +1,7 @@ + #include + #include + #include +-#include ++#include + #include "hpng.h" + + char PngErrorMessage[1024]; +@@ -46,8 +46,12 @@ int LoadPngImage(PNG_IMAGE *d) { + // ---------------- Error handling + + png_set_error_fn(png,NULL,my_png_error,NULL); ++#if (PNG_LIBPNG_VER < 10500) + if (setjmp(png->jmpbuf)) { +- png_destroy_read_struct(&png, &info, &endinfo); ++#else ++ if ( setjmp(png_jmpbuf(png)) ) { ++#endif ++ png_destroy_read_struct(&png, &info, &endinfo); + return 0; + } + +@@ -155,7 +159,7 @@ char *WritePngImage(char *file_name,unsigned long width,unsigned long height,uns + { + sprintf(PngErrorMessage,"png_create_info_struct() failed"); + fclose(fp); +- png_destroy_write_struct(&png_ptr, png_infopp_NULL); ++ png_destroy_write_struct(&png_ptr, NULL); + return PngErrorMessage; + } + +-- +2.37.3 + + +From 2d4e22202ac7fdeb9e8ff2eda08640355cb1fa95 Mon Sep 17 00:00:00 2001 +From: eblanca +Date: Sun, 23 Apr 2023 18:52:23 +0000 +Subject: applying patch 08_spelling.patch + + +diff --git a/BlockOut/BlockOut.cpp b/BlockOut/BlockOut.cpp +index 8a381ae..d51837c 100644 +--- a/BlockOut/BlockOut.cpp ++++ b/BlockOut/BlockOut.cpp +@@ -38,7 +38,7 @@ int main(int argc,char *argv[]) + #endif + { + +- // Check environement ++ // Check environment + if( !CheckEnv() ) { + return 0; + } +diff --git a/BlockOut/Http.cpp b/BlockOut/Http.cpp +index b8b5f5f..332ab96 100644 +--- a/BlockOut/Http.cpp ++++ b/BlockOut/Http.cpp +@@ -233,7 +233,7 @@ int Http::Connect(char *site, int port) { + sprintf(err_str,"Socket error: Specified protocol is not supported"); + break; + default: +- sprintf(err_str,"Socket error: Unknow code:%d",errno); ++ sprintf(err_str,"Socket error: Unknown code:%d",errno); + break; + } + #endif +diff --git a/BlockOut/README.txt b/BlockOut/README.txt +index b4cd5db..6e6ef9e 100644 +--- a/BlockOut/README.txt ++++ b/BlockOut/README.txt +@@ -74,7 +74,7 @@ Version history + -Added player/rank name when replaying + -New punctuation characters added + -Little effect when rotation is blocked +- -Fixed "Cannot open blX.bl2replay for writting" ++ -Fixed "Cannot open blX.bl2replay for writing" + -New style (Marble/Arcade) + -Fixed crash when pressing [Esc] + -Pit animation when the game is over +diff --git a/BlockOut/Utils.cpp b/BlockOut/Utils.cpp +index 1d3020e..a6b2e63 100644 +--- a/BlockOut/Utils.cpp ++++ b/BlockOut/Utils.cpp +@@ -204,7 +204,7 @@ BOOL CheckEnv() { + + char *homePath = getenv("HOME"); + if( homePath==NULL ) { +- printf("HOME environement variable if not defined !\n"); ++ printf("HOME environment variable if not defined !\n"); + printf("Please set the HOME variable to your home directory (ex: HOME=/users/jeanluc)\n"); + return FALSE; + } +diff --git a/ImageLib/src/png/hpng.c b/ImageLib/src/png/hpng.c +index ec67887..9efa9a4 100644 +--- a/ImageLib/src/png/hpng.c ++++ b/ImageLib/src/png/hpng.c +@@ -139,7 +139,7 @@ char *WritePngImage(char *file_name,unsigned long width,unsigned long height,uns + + fp = fopen(file_name, "wb"); + if (fp == NULL) { +- sprintf(PngErrorMessage,"Unable to open the file %s for writting",file_name); ++ sprintf(PngErrorMessage,"Unable to open the file %s for writing",file_name); + return PngErrorMessage; + } + +-- +2.37.3 + + +From ba9176eb74b5d6e2fd16b2334814866cd3ea3d5a Mon Sep 17 00:00:00 2001 +From: eblanca +Date: Sun, 23 Apr 2023 18:55:57 +0000 +Subject: update Makefile and optimize build + + +diff --git a/debian/Makefile b/debian/Makefile +index 0830ca5..b6d7370 100644 +--- a/debian/Makefile ++++ b/debian/Makefile +@@ -9,8 +9,8 @@ TARGET = obj/blockout2 + + + +-CFLAGS += -I/usr/include/SDL -I./ImageLib/src -Dlinux $(ADDCFLAGS) +-LIBS = -lSDL_mixer -lSDL -lpng -lGLU -lGL ++CFLAGS += -O2 -I./ImageLib/src $(ADDCFLAGS) ++LIBS = -lSDL_mixer -lSDL -lpng -lGLU -lGL -lnetwork + + all: obj/obj-dir-stamp $(TARGET) + +@@ -19,7 +19,7 @@ obj/obj-dir-stamp: + touch $@ + + $(TARGET): $(BOBJ) $(IOBJ) +- $(CXX) $^ -o $@ $(LDFLAGS) $(LIBS) ++ $(CXX) -s $^ -o $@ $(LDFLAGS) $(LIBS) + + obj/bo/%.o: BlockOut/%.cpp + $(CXX) $(CPPFLAGS) -MMD $(CFLAGS) -c $< -o $@ +-- +2.37.3 + + +From 14bb02b24722a197be5cea3c91338183d8cf1c7e Mon Sep 17 00:00:00 2001 +From: eblanca +Date: Sun, 23 Apr 2023 19:01:45 +0000 +Subject: fix header search paths + + +diff --git a/BlockOut/GLApp/GLApp.h b/BlockOut/GLApp/GLApp.h +index 66f1486..d576e36 100644 +--- a/BlockOut/GLApp/GLApp.h ++++ b/BlockOut/GLApp/GLApp.h +@@ -2,8 +2,8 @@ + // SDL/OpenGL OpenGL application framework + // Jean-Luc PONS (2007) + // ------------------------------------------- +-#include +-#include ++#include ++#include + #include + #include + +diff --git a/BlockOut/GLApp/GLFont.h b/BlockOut/GLApp/GLFont.h +index c11debf..90f2644 100644 +--- a/BlockOut/GLApp/GLFont.h ++++ b/BlockOut/GLApp/GLFont.h +@@ -1,7 +1,7 @@ + // ----------------------------------------------- + // Simple 2D font + // ----------------------------------------------- +-#include "SDL_opengl.h" ++#include "SDL/SDL_opengl.h" + + #ifndef _GLFONT2DH_ + #define _GLFONT2DH_ +diff --git a/BlockOut/GLApp/GLMatrix.h b/BlockOut/GLApp/GLMatrix.h +index bb5ae60..755bb35 100644 +--- a/BlockOut/GLApp/GLMatrix.h ++++ b/BlockOut/GLApp/GLMatrix.h +@@ -1,7 +1,7 @@ + // ------------------------------------- + // 3x3 Matrix class + // ------------------------------------- +-#include ++#include + + #ifndef _GLMATRIXH_ + #define _GLMATRIXH_ +diff --git a/BlockOut/GLApp/GLSprite.h b/BlockOut/GLApp/GLSprite.h +index fca3c1f..32451be 100644 +--- a/BlockOut/GLApp/GLSprite.h ++++ b/BlockOut/GLApp/GLSprite.h +@@ -1,7 +1,7 @@ + // ----------------------------------------------- + // 2D sprites + // ----------------------------------------------- +-#include "SDL_opengl.h" ++#include "SDL/SDL_opengl.h" + + #ifndef _SPRITE2DH_ + #define _SPRITE2DH_ +diff --git a/BlockOut/SoundManager.h b/BlockOut/SoundManager.h +index a4d2793..a6d433a 100644 +--- a/BlockOut/SoundManager.h ++++ b/BlockOut/SoundManager.h +@@ -15,7 +15,7 @@ + GNU General Public License for more details. + */ + #include "GLApp/GLApp.h" +-#include ++#include + + #ifndef SOUNDMANAGERH + #define SOUNDMANAGERH +diff --git a/ImageLib/src/png/hpng.c b/ImageLib/src/png/hpng.c +index 9efa9a4..d640caf 100644 +--- a/ImageLib/src/png/hpng.c ++++ b/ImageLib/src/png/hpng.c +@@ -1,7 +1,7 @@ + #include + #include + #include +-#include ++#include + #include "hpng.h" + + char PngErrorMessage[1024]; +-- +2.37.3 + + +From bc30bc5b4b9d66b72b11420657aee41c546e409f Mon Sep 17 00:00:00 2001 +From: eblanca +Date: Sun, 23 Apr 2023 19:03:20 +0000 +Subject: keycodes handling + + +diff --git a/BlockOut/BlockOut.cpp b/BlockOut/BlockOut.cpp +index d51837c..af6da1a 100644 +--- a/BlockOut/BlockOut.cpp ++++ b/BlockOut/BlockOut.cpp +@@ -368,12 +368,25 @@ int BlockOut::EventProc(SDL_Event *event) + // Handle key presses + if( event->type == SDL_KEYDOWN ) + { ++#ifdef __HAIKU__ ++ /* handle the incoming key code based on unicode value. ++ Basic idea taken from sample program checkkeys.c provided ++ with sdl-1.2.15 source package ++ */ ++ if ( event->key.keysym.unicode < ' ' ) { ++ m_bKey[event->key.keysym.sym] = 1; ++ } ++ else { ++ m_bKey[event->key.keysym.unicode] = 1; ++ } ++#else + int unicode = (event->key.keysym.unicode & 0x7F); + if( unicode ) { + m_bKey[unicode] = 1; + } else { + m_bKey[event->key.keysym.sym] = 1; + } ++#endif + } + + return GL_OK; +-- +2.37.3 + + +From 0834914c585710e6290cbb2b99bab2fe3feb3c75 Mon Sep 17 00:00:00 2001 +From: eblanca +Date: Sun, 23 Apr 2023 19:06:06 +0000 +Subject: locate real executable path + + +diff --git a/BlockOut/BlockOut.cpp b/BlockOut/BlockOut.cpp +index af6da1a..0608fc0 100644 +--- a/BlockOut/BlockOut.cpp ++++ b/BlockOut/BlockOut.cpp +@@ -39,7 +39,11 @@ int main(int argc,char *argv[]) + { + + // Check environment ++#ifdef __HAIKU__ ++ if( !CheckEnv(argv[0]) ) { ++#else + if( !CheckEnv() ) { ++#endif + return 0; + } + +diff --git a/BlockOut/Types.h b/BlockOut/Types.h +index 7c89802..45ec75a 100644 +--- a/BlockOut/Types.h ++++ b/BlockOut/Types.h +@@ -209,7 +209,11 @@ char GetChar(BYTE *keys); + void ZeroMemory(void *buff,int size); + #endif + BOOL DirExists(char *dirname); ++#ifdef __HAIKU__ ++BOOL CheckEnv(char *); ++#else + BOOL CheckEnv(); ++#endif + const char *LID(const char *fileName); + const char *LHD(const char *fileName); + +diff --git a/BlockOut/Utils.cpp b/BlockOut/Utils.cpp +index a6b2e63..115a6e1 100644 +--- a/BlockOut/Utils.cpp ++++ b/BlockOut/Utils.cpp +@@ -171,8 +171,11 @@ BOOL DirExists(char *dirname) { + // Name: CheckEnv() + // Desc: Check environemt + //----------------------------------------------------------------------------- ++#ifdef __HAIKU__ ++BOOL CheckEnv(char *argv0) { ++#else + BOOL CheckEnv() { +- ++#endif + #ifdef WINDOWS + + strcpy(usrHome,""); +@@ -208,11 +211,23 @@ BOOL CheckEnv() { + printf("Please set the HOME variable to your home directory (ex: HOME=/users/jeanluc)\n"); + return FALSE; + } +- ++#ifdef __HAIKU__ ++ char *binpath = realpath(argv0, NULL); ++ if (binpath != NULL) { ++ strcpy(bl2Home, binpath); ++ free(binpath); ++ char *appdir = strrchr(bl2Home, '/'); ++ *appdir = '\0'; ++ } ++ else { ++ printf("Fatal: Unable to locate executable directory!\n"); ++ return FALSE; ++ } ++#else + const char *blockoutHome = "/usr/share/games/blockout2"; + + strcpy( bl2Home , blockoutHome ); +- ++#endif + char bl2Dir[512]; + sprintf(bl2Dir,"%s/.bl2",homePath); + if( !DirExists(bl2Dir) ) { +-- +2.37.3 +