From patchwork Sun Jun 26 06:54:39 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Timotej Lazar X-Patchwork-Id: 40330 Return-Path: X-Original-To: patchwork@mira.cbaines.net Delivered-To: patchwork@mira.cbaines.net Received: by mira.cbaines.net (Postfix, from userid 113) id C264527BBEB; Sun, 26 Jun 2022 07:56:17 +0100 (BST) X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on mira.cbaines.net X-Spam-Level: X-Spam-Status: No, score=-2.7 required=5.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED,MAILING_LIST_MULTI,SPF_HELO_PASS,URIBL_BLOCKED autolearn=unavailable autolearn_force=no version=3.4.6 Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mira.cbaines.net (Postfix) with ESMTPS id 3357127BBEA for ; Sun, 26 Jun 2022 07:56:16 +0100 (BST) Received: from localhost ([::1]:56552 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1o5MBr-000734-BQ for patchwork@mira.cbaines.net; Sun, 26 Jun 2022 02:56:15 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:60470) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1o5MBe-00072m-OS for guix-patches@gnu.org; Sun, 26 Jun 2022 02:56:02 -0400 Received: from debbugs.gnu.org ([209.51.188.43]:52708) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1o5MBe-00041C-GR for guix-patches@gnu.org; Sun, 26 Jun 2022 02:56:02 -0400 Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1o5MBe-00043R-E1 for guix-patches@gnu.org; Sun, 26 Jun 2022 02:56:02 -0400 X-Loop: help-debbugs@gnu.org Subject: [bug#56230] [PATCH] gnu: Add barony. Resent-From: Timotej Lazar Original-Sender: "Debbugs-submit" Resent-CC: guix-patches@gnu.org Resent-Date: Sun, 26 Jun 2022 06:56:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: report 56230 X-GNU-PR-Package: guix-patches X-GNU-PR-Keywords: patch To: 56230@debbugs.gnu.org Cc: Timotej Lazar X-Debbugs-Original-To: guix-patches@gnu.org Received: via spool by submit@debbugs.gnu.org id=B.165622650215495 (code B ref -1); Sun, 26 Jun 2022 06:56:02 +0000 Received: (at submit) by debbugs.gnu.org; 26 Jun 2022 06:55:02 +0000 Received: from localhost ([127.0.0.1]:46602 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1o5MAf-00041W-9K for submit@debbugs.gnu.org; Sun, 26 Jun 2022 02:55:02 -0400 Received: from lists.gnu.org ([209.51.188.17]:35656) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1o5MAb-00041N-Ms for submit@debbugs.gnu.org; Sun, 26 Jun 2022 02:55:00 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:60368) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1o5MAa-0006yY-3p for guix-patches@gnu.org; Sun, 26 Jun 2022 02:54:57 -0400 Received: from araneo.si ([2001:15c0:2110:3400::2]:56838) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1o5MAW-0003gf-Gi for guix-patches@gnu.org; Sun, 26 Jun 2022 02:54:55 -0400 Received: from araneo.si (localhost.lan [127.0.0.1]) by araneo.si (OpenSMTPD) with ESMTP id c073445c for ; Sun, 26 Jun 2022 06:54:49 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha1; c=relaxed; d=araneo.si; h=from:to:cc :subject:date:message-id:mime-version:content-transfer-encoding; s=20180623; bh=a/tvqK/XB99Bff+id2uA/Lrw7IE=; b=e/E6xv/5NTrZ8AeO bYiFNlc/FW65l96Rwg7MvhnC2weoTRQ9csglgD/E+7jv6Sj6VRZJiMugXNNkI5vv /krwe67Y3vhnfVb1dNtRewXrgcC2CvQGzqumrbxN2QYuxYn4XGExPDGia32wGvXK XEaAu3SdXO6NB0Cuirjb8+e20OfvwJI39oBXUKlR94AHqA6TwDhDBNqbz2AFq476 6hTQ45gJVENapMGH1P2ZogWKrz78lx1EmT148oLlI+Q405q3kDHSZw0fxi8cm0fi L2Mku6Dii/81i3uuaIH8rDAWsuPhbsUafqqaQrMDqbsQGnJ9JsWK3cAka04Khzae JAvYyg== Received: by araneo.si (OpenSMTPD) with ESMTPSA id a7dd04b6 (TLSv1.3:TLS_AES_256_GCM_SHA384:256:NO); Sun, 26 Jun 2022 06:54:49 +0000 (UTC) From: Timotej Lazar Date: Sun, 26 Jun 2022 08:54:39 +0200 Message-Id: <20220626065438.3753-1-timotej.lazar@araneo.si> X-Mailer: git-send-email 2.36.1 MIME-Version: 1.0 Received-SPF: pass client-ip=2001:15c0:2110:3400::2; envelope-from=timotej.lazar@araneo.si; helo=araneo.si X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, SPF_HELO_PASS=-0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-BeenThere: guix-patches@gnu.org List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: guix-patches-bounces+patchwork=mira.cbaines.net@gnu.org Sender: "Guix-patches" X-getmail-retrieved-from-mailbox: Patches * gnu/packages/games.scm (barony): New variable. * gnu/packages/patches/barony-fix-textures.patch: New file. * gnu/local.mk (dist_patch_DATA): Add it. --- gnu/local.mk | 1 + gnu/packages/games.scm | 54 ++++ .../patches/barony-fix-textures.patch | 237 ++++++++++++++++++ 3 files changed, 292 insertions(+) create mode 100644 gnu/packages/patches/barony-fix-textures.patch diff --git a/gnu/local.mk b/gnu/local.mk index 353b91cfd2..4f3174d4aa 100644 --- a/gnu/local.mk +++ b/gnu/local.mk @@ -885,6 +885,7 @@ dist_patch_DATA = \ %D%/packages/patches/awesome-4.3-fno-common.patch \ %D%/packages/patches/aws-c-auth-install-private-headers.patch \ %D%/packages/patches/azr3.patch \ + %D%/packages/patches/barony-fix-textures.patch \ %D%/packages/patches/bash-completion-directories.patch \ %D%/packages/patches/bash-linux-pgrp-pipe.patch \ %D%/packages/patches/bastet-change-source-of-unordered_set.patch \ diff --git a/gnu/packages/games.scm b/gnu/packages/games.scm index 8e6ab03530..d6fe5f215c 100644 --- a/gnu/packages/games.scm +++ b/gnu/packages/games.scm @@ -503,6 +503,60 @@ (define-public astromenace ;; BY-SA 4.0, and fonts to OFL1.1. (license (list license:gpl3+ license:cc-by-sa4.0 license:silofl1.1)))) +(define-public barony + (package + (name "barony") + (version "3.3.7") + (source + (origin + (method git-fetch) + (uri (git-reference + (url "https://github.com/TurningWheel/Barony.git") + (commit (string-append "v" version)))) + (file-name (git-file-name name version)) + (sha256 + (base32 "1y72k6zrqqhib3p05zkdklays2d218v51n87k7k68m0s7nnxa4vy")) + ;; Fix textures for SDL 2.0.14. + ;; See . + (patches (search-patches "barony-fix-textures.patch")))) + (build-system cmake-build-system) + (arguments + '(#:configure-flags + (list "-DOPENAL_ENABLED=ON" ; enable sound + "-DEDITOR_EXE_NAME=barony-editor") ; instead of generic "editor" + #:tests? #f ; there are no tests + #:phases + (modify-phases %standard-phases + (add-before 'configure 'fix-installation + (lambda _ + (substitute* "CMakeLists.txt" + (("\\$\\{CMAKE_CURRENT_BINARY_DIR\\}/lang") + "${CMAKE_SOURCE_DIR}/lang"))))))) + (inputs + (list glu + libpng + libvorbis + openal + physfs + rapidjson + sdl2 + sdl2-image + sdl2-net + sdl2-ttf + zlib)) + (native-inputs + (list pkg-config)) + (home-page "http://baronygame.com") + (synopsis "3D first-person roguelike game") + (description + "A first-person roguelike role-playing game with cooperative play. The player +must descend a dark dungeon and destroy an undead lich while avoiding traps +and fighting monsters. The game features randomly generated dungeons, 13 +character classes, hundreds of items and artifacts, and cooperative +multiplayer for up to four players. This package does @emph{not} provide the +game assets.") + (license license:bsd-2))) + (define-public bastet (package (name "bastet") diff --git a/gnu/packages/patches/barony-fix-textures.patch b/gnu/packages/patches/barony-fix-textures.patch new file mode 100644 index 0000000000..712f0d63c6 --- /dev/null +++ b/gnu/packages/patches/barony-fix-textures.patch @@ -0,0 +1,237 @@ +From: Sylvain +Date: Sat, 10 Apr 2021 21:33:29 +0200 +Subject: [PATCH] Fixed bug 580 - Use 'userdata' instead of 'refcount' + 'refcount' is a private SDL_Surface field + +--- + src/draw.cpp | 22 +++++++++++----------- + src/files.cpp | 2 +- + src/opengl.cpp | 26 +++++++++++++------------- + src/savepng.cpp | 2 +- + 4 files changed, 26 insertions(+), 26 deletions(-) + +diff --git a/src/draw.cpp b/src/draw.cpp +index 08f95343f..4e62c751a 100644 +--- a/src/draw.cpp ++++ b/src/draw.cpp +@@ -443,7 +443,7 @@ void drawImageRotatedAlpha( SDL_Surface* image, SDL_Rect* src, SDL_Rect* pos, re + } + + // draw a textured quad +- glBindTexture(GL_TEXTURE_2D, texid[image->refcount]); ++ glBindTexture(GL_TEXTURE_2D, texid[(long int)image->userdata]); + glColor4f(1, 1, 1, alpha / 255.1); + glBegin(GL_QUADS); + glTexCoord2f(1.0 * ((real_t)src->x / image->w), 1.0 * ((real_t)src->y / image->h)); +@@ -492,7 +492,7 @@ void drawImageColor( SDL_Surface* image, SDL_Rect* src, SDL_Rect* pos, Uint32 co + } + + // draw a textured quad +- glBindTexture(GL_TEXTURE_2D, texid[image->refcount]); ++ glBindTexture(GL_TEXTURE_2D, texid[(long int)image->userdata]); + real_t r = ((Uint8)(color >> mainsurface->format->Rshift)) / 255.f; + real_t g = ((Uint8)(color >> mainsurface->format->Gshift)) / 255.f; + real_t b = ((Uint8)(color >> mainsurface->format->Bshift)) / 255.f; +@@ -546,7 +546,7 @@ void drawImageAlpha( SDL_Surface* image, SDL_Rect* src, SDL_Rect* pos, Uint8 alp + } + + // draw a textured quad +- glBindTexture(GL_TEXTURE_2D, texid[image->refcount]); ++ glBindTexture(GL_TEXTURE_2D, texid[(long int)image->userdata]); + glColor4f(1, 1, 1, alpha / 255.1); + glPushMatrix(); + glBegin(GL_QUADS); +@@ -596,7 +596,7 @@ void drawImage( SDL_Surface* image, SDL_Rect* src, SDL_Rect* pos ) + } + + // draw a textured quad +- glBindTexture(GL_TEXTURE_2D, texid[image->refcount]); ++ glBindTexture(GL_TEXTURE_2D, texid[(long int)image->userdata]); + glColor4f(1, 1, 1, 1); + glPushMatrix(); + glBegin(GL_QUADS); +@@ -646,7 +646,7 @@ void drawImageRing(SDL_Surface* image, SDL_Rect* src, int radius, int thickness, + } + + // draw a textured quad +- glBindTexture(GL_TEXTURE_2D, texid[image->refcount]); ++ glBindTexture(GL_TEXTURE_2D, texid[(long int)image->userdata]); + glColor4f(1, 1, 1, alpha / 255.f); + glPushMatrix(); + +@@ -771,7 +771,7 @@ void drawImageScaled( SDL_Surface* image, SDL_Rect* src, SDL_Rect* pos ) + } + + // draw a textured quad +- glBindTexture(GL_TEXTURE_2D, texid[image->refcount]); ++ glBindTexture(GL_TEXTURE_2D, texid[(long int)image->userdata]); + glColor4f(1, 1, 1, 1); + glPushMatrix(); + glBegin(GL_QUADS); +@@ -826,7 +826,7 @@ void drawImageScaledPartial(SDL_Surface* image, SDL_Rect* src, SDL_Rect* pos, fl + } + + // draw a textured quad +- glBindTexture(GL_TEXTURE_2D, texid[image->refcount]); ++ glBindTexture(GL_TEXTURE_2D, texid[(long int)image->userdata]); + glColor4f(1, 1, 1, 1); + glPushMatrix(); + glBegin(GL_QUADS); +@@ -889,7 +889,7 @@ void drawImageScaledColor(SDL_Surface* image, SDL_Rect* src, SDL_Rect* pos, Uint + } + + // draw a textured quad +- glBindTexture(GL_TEXTURE_2D, texid[image->refcount]); ++ glBindTexture(GL_TEXTURE_2D, texid[(long int)image->userdata]); + real_t r = ((Uint8)(color >> mainsurface->format->Rshift)) / 255.f; + real_t g = ((Uint8)(color >> mainsurface->format->Gshift)) / 255.f; + real_t b = ((Uint8)(color >> mainsurface->format->Bshift)) / 255.f; +@@ -985,7 +985,7 @@ void drawImageFancy( SDL_Surface* image, Uint32 color, real_t angle, SDL_Rect* s + } + + // draw a textured quad +- glBindTexture(GL_TEXTURE_2D, texid[image->refcount]); ++ glBindTexture(GL_TEXTURE_2D, texid[(long int)image->userdata]); + real_t r = ((Uint8)(color >> mainsurface->format->Rshift)) / 255.f; + real_t g = ((Uint8)(color >> mainsurface->format->Gshift)) / 255.f; + real_t b = ((Uint8)(color >> mainsurface->format->Bshift)) / 255.f; +@@ -2186,7 +2186,7 @@ void drawWindowFancy(int x1, int y1, int x2, int y2) + glVertex2f(x2 - 1, yres - y1 - 1); + glEnd(); + glColor3f(.75, .75, .75); +- glBindTexture(GL_TEXTURE_2D, texid[fancyWindow_bmp->refcount]); // wood texture ++ glBindTexture(GL_TEXTURE_2D, texid[(long int)fancyWindow_bmp->userdata]); // wood texture + glBegin(GL_QUADS); + glTexCoord2f(0, 0); + glVertex2f(x1 + 2, yres - y1 - 2); +@@ -2322,7 +2322,7 @@ SDL_Rect ttfPrintTextColor( TTF_Font* font, int x, int y, Uint32 color, bool out + SDL_BlitSurface(textSurf, NULL, surf, &pos); + // load the text outline surface as a GL texture + allsurfaces[imgref] = surf; +- allsurfaces[imgref]->refcount = imgref; ++ allsurfaces[imgref]->userdata = (void*) imgref; + glLoadTexture(allsurfaces[imgref], imgref); + imgref++; + // store the surface in the text surface cache +diff --git a/src/files.cpp b/src/files.cpp +index 2beb9a6b9..389ade6d1 100644 +--- a/src/files.cpp ++++ b/src/files.cpp +@@ -591,7 +591,7 @@ SDL_Surface* loadImage(char const * const filename) + + // load the new surface as a GL texture + allsurfaces[imgref] = newSurface; +- allsurfaces[imgref]->refcount = imgref + 1; ++ allsurfaces[imgref]->userdata = (void *)(imgref); + glLoadTexture(allsurfaces[imgref], imgref); + + // free the translated surface +diff --git a/src/opengl.cpp b/src/opengl.cpp +index f5b81e77a..3ac225825 100644 +--- a/src/opengl.cpp ++++ b/src/opengl.cpp +@@ -500,7 +500,7 @@ void glDrawSprite(view_t* camera, Entity* entity, int mode) + } + if ( mode == REALCOLORS ) + { +- glBindTexture(GL_TEXTURE_2D, texid[sprite->refcount]); ++ glBindTexture(GL_TEXTURE_2D, texid[(long int)sprite->userdata]); + } + else + { +@@ -586,7 +586,7 @@ void glDrawSpriteFromImage(view_t* camera, Entity* entity, std::string text, int + //int x, y; + real_t s = 1; + SDL_Surface* image = sprites[0]; +- GLuint textureId = texid[sprites[0]->refcount]; ++ GLuint textureId = texid[(long int)sprites[0]->userdata]; + char textToRetrieve[128]; + + if ( text.compare("") == 0 ) +@@ -603,7 +603,7 @@ void glDrawSpriteFromImage(view_t* camera, Entity* entity, std::string text, int + textToRetrieve[std::min(static_cast(strlen(text.c_str())), 22)] = '\0'; + if ( (image = ttfTextHashRetrieve(ttfTextHash, textToRetrieve, ttf12, true)) != NULL ) + { +- textureId = texid[image->refcount]; ++ textureId = texid[(long int)image->userdata]; + } + else + { +@@ -627,7 +627,7 @@ void glDrawSpriteFromImage(view_t* camera, Entity* entity, std::string text, int + SDL_BlitSurface(textSurf, NULL, image, &pos); + // load the text outline surface as a GL texture + allsurfaces[imgref] = image; +- allsurfaces[imgref]->refcount = imgref; ++ allsurfaces[imgref]->userdata = (void *)((long int)imgref); + glLoadTexture(allsurfaces[imgref], imgref); + imgref++; + // store the surface in the text surface cache +@@ -635,7 +635,7 @@ void glDrawSpriteFromImage(view_t* camera, Entity* entity, std::string text, int + { + printlog("warning: failed to store text outline surface with imgref %d\n", imgref - 1); + } +- textureId = texid[image->refcount]; ++ textureId = texid[(long int)image->userdata]; + } + // setup projection + glMatrixMode(GL_PROJECTION); +@@ -864,7 +864,7 @@ void glDrawWorld(view_t* camera, int mode) + + // first (higher) sky layer + glColor4f(1.f, 1.f, 1.f, .5); +- glBindTexture(GL_TEXTURE_2D, texid[tiles[cloudtile]->refcount]); // sky tile ++ glBindTexture(GL_TEXTURE_2D, texid[(long int)tiles[cloudtile]->userdata]); // sky tile + glBegin( GL_QUADS ); + glTexCoord2f((real_t)(ticks % 60) / 60, (real_t)(ticks % 60) / 60); + glVertex3f(-CLIPFAR * 16, 64, -CLIPFAR * 16); +@@ -881,7 +881,7 @@ void glDrawWorld(view_t* camera, int mode) + + // second (closer) sky layer + glColor4f(1.f, 1.f, 1.f, .5); +- glBindTexture(GL_TEXTURE_2D, texid[tiles[cloudtile]->refcount]); // sky tile ++ glBindTexture(GL_TEXTURE_2D, texid[(long int)tiles[cloudtile]->userdata]); // sky tile + glBegin( GL_QUADS ); + glTexCoord2f((real_t)(ticks % 240) / 240, (real_t)(ticks % 240) / 240); + glVertex3f(-CLIPFAR * 16, 32, -CLIPFAR * 16); +@@ -954,13 +954,13 @@ void glDrawWorld(view_t* camera, int mode) + { + if ( map.tiles[index] < 0 || map.tiles[index] >= numtiles ) + { +- new_tex = texid[sprites[0]->refcount]; +- //glBindTexture(GL_TEXTURE_2D, texid[sprites[0]->refcount]); ++ new_tex = texid[(long int)sprites[0]->userdata]; ++ //glBindTexture(GL_TEXTURE_2D, texid[(long int)sprites[0]->userdata]); + } + else + { +- new_tex = texid[tiles[map.tiles[index]]->refcount]; +- //glBindTexture(GL_TEXTURE_2D, texid[tiles[map.tiles[index]]->refcount]); ++ new_tex = texid[(long int)tiles[map.tiles[index]]->userdata]; ++ //glBindTexture(GL_TEXTURE_2D, texid[(long int)tiles[map.tiles[index]]->userdata]); + } + } + else +@@ -1282,8 +1282,8 @@ void glDrawWorld(view_t* camera, int mode) + // bind texture + if ( mode == REALCOLORS ) + { +- new_tex = texid[tiles[mapceilingtile]->refcount]; +- //glBindTexture(GL_TEXTURE_2D, texid[tiles[50]->refcount]); // rock tile ++ new_tex = texid[(long int)tiles[mapceilingtile]->userdata]; ++ //glBindTexture(GL_TEXTURE_2D, texid[(long int)tiles[50]->userdata]); // rock tile + if (cur_tex!=new_tex) + { + glEnd(); +diff --git a/src/savepng.cpp b/src/savepng.cpp +index fa7a5d4e2..59e052a5c 100644 +--- a/src/savepng.cpp ++++ b/src/savepng.cpp +@@ -59,7 +59,7 @@ SDL_Surface* SDL_PNGFormatAlpha(SDL_Surface* src) + /* NO-OP for images < 32bpp and 32bpp images that already have Alpha channel */ + if (src->format->BitsPerPixel <= 24 || src->format->Amask) + { +- src->refcount++; ++ src->userdata = (void *)((long int) src->userdata + 1); + return src; + } +