383 changes: 383 additions & 0 deletions games-action/heroes/patches/heroes-0.21.patchset
@@ -0,0 +1,383 @@
From 5a81d074a58ebcf20a6ea35dd1a53083a8abe996 Mon Sep 17 00:00:00 2001
From: Begasus <begasus@gmail.com>
Date: Thu, 6 Jul 2023 09:59:51 +0000
Subject: AM_C_PROTOTYPES - automatic de-ANSI-fication support has been removed


diff --git a/configure.ac b/configure.ac
index 8bd5ee4..646dc38 100644
--- a/configure.ac
+++ b/configure.ac
@@ -112,7 +112,6 @@ AC_HEADER_STAT
# Checks for typedefs, structures, and compiler characteristics.
# ==============================================================

-AM_C_PROTOTYPES
AC_C_CONST
AC_TYPE_UID_T dnl This checks for gid_t too.
AC_CHECK_TYPES([ssize_t])
--
2.37.3


From 8b18d3d38603306e9cb96d0eeac6b3e011b9c969 Mon Sep 17 00:00:00 2001
From: Begasus <begasus@gmail.com>
Date: Thu, 6 Jul 2023 10:49:03 +0000
Subject: applying patch heroes-0.21.patch (imported from AUR)


diff --git a/src/argv.c b/src/argv.c
index 75b289d..97f8dae 100644
--- a/src/argv.c
+++ b/src/argv.c
@@ -45,8 +45,8 @@ bool swapside = true;
char* level_name;
bool mono = false;
bool bits8 = false;
-bool hqmix = false;
-int stretch = 1;
+bool hqmix = true;
+int stretch = 4;
bool nosound = false;
bool even_lines = false;
bool showprefs = false;
@@ -171,15 +171,11 @@ Sound options:\n\
-S, --no-sound disable sound\n\
-X, --no-sfx disable sound-effects\n\
-m, --mono non-stereo output\n\
- -8, --8bits 8bits sound output\n\
- -i, --high-quality high quality mixer\n"));
+ -8, --8bits 8bits sound output\n"));
puts (_("\
Display options:\n\
-G, --gfx-options=OPTIONS pass OPTIONS to the display driver\n\
- -F, --full-screen full screen mode\n\
- -2, --double stretch the display twofold\n\
- -3, --triple stretch the display threefold\n\
- -4, --quadruple stretch the display fourfold\n\
+ -W, --windowed windowed mode\n\
-e, --even-lines display only even-lines\n"));
/* TRANS: rotozoom is a graphical effect used in the demo of yore
where the screen rotate and zoom (actually it doesn't zoom in Heroes);
@@ -215,15 +211,13 @@ const struct option long_options[] = {
{"default-saves", no_argument, &reinitsav, 1},
{"default-scores", no_argument, &reinitsco, 1},
{"devparm", no_argument, &devparm, 1},
- {"double", no_argument, NULL, '2'},
{"driver", required_argument, NULL, 'd'},
{"drivers-info", no_argument, NULL, 'n'},
{"even-lines", no_argument, NULL, 'e'},
- {"full-screen", no_argument, NULL, 'F'},
+ {"windowed", no_argument, NULL, 'W'},
{"gfx-options", required_argument, NULL, 'G'},
{"go", no_argument, NULL, 'g'},
{"help", no_argument, NULL, 'h'},
- {"high-quality", no_argument, NULL, 'i'},
{"list", optional_argument, NULL, 'l'},
{"load", required_argument, NULL, 'L'},
{"mono", no_argument, NULL, 'm'},
@@ -231,11 +225,9 @@ const struct option long_options[] = {
{"no-joystick", no_argument, NULL, 'J'},
{"no-sfx", no_argument, NULL, 'X'},
{"no-sound", no_argument, NULL, 'S'},
- {"quadruple", no_argument, NULL, '4'},
{"quiet", no_argument, NULL, 'q'},
{"really-quiet", no_argument, NULL, 'Q'},
{"swap-sides", no_argument, NULL, 's'},
- {"triple", no_argument, NULL, '3'},
{"verbose", required_argument, NULL, 'v'},
{"version", no_argument, NULL, 'v'},
{"x10-saves", no_argument, &x10sav, 1},
@@ -263,7 +255,7 @@ parse_argv (int argc, char **argv, const char *from_file, int from_line)
for (;;) {
int option_index = 0;

- c = getopt_long (argc, argv, "2348d:eFgG:hiJl::L:mnqQsSv::X",
+ c = getopt_long (argc, argv, "8d:eWgG:hiJl::L:mnqQsSv::X",
long_options, &option_index);

/* Detect the end of the options. */
@@ -290,9 +282,6 @@ parse_argv (int argc, char **argv, const char *from_file, int from_line)
case '8':
bits8 = true;
break;
- case 'a':
- hqmix = true;
- break;
case 'X':
nosfx = true;
break;
@@ -319,27 +308,15 @@ parse_argv (int argc, char **argv, const char *from_file, int from_line)
case 'G':
set_display_params (optarg);
break;
- case 'F':
+ case 'W':
set_full_screen_mode ();
break;
case 'J':
joyoff = true;
break;
- case '2':
- stretch = 2;
- break;
- case '3':
- stretch = 3;
- break;
- case '4':
- stretch = 4;
- break;
case 'e':
even_lines = true;
break;
- case 'i':
- hqmix = true;
- break;
case 'S':
nosound = true;
break;
diff --git a/src/hedlite.c b/src/hedlite.c
index c44c34d..3579cc2 100644
--- a/src/hedlite.c
+++ b/src/hedlite.c
@@ -45,7 +45,6 @@
#include "dirname.h"

static a_pcx_image heditrsc;
-static a_pcx_image tile_set_img;

unsigned short int xdalles = 0;
unsigned short int ydalles = 0;
diff --git a/src/media/ggi/video.c b/src/media/ggi/video.c
index 23f19d5..ec910a6 100644
--- a/src/media/ggi/video.c
+++ b/src/media/ggi/video.c
@@ -54,7 +54,7 @@ static int scr_stretch;

static ggi_mode vid_mode;
static char *display_params = NULL;
-static int full_screen = 0;
+static int full_screen = 1;
/* Direct buffer for each frame.
We might have db[0] == db[1] if double buffering is not available.*/
static const ggi_directbuffer *db[2] = { NULL, NULL };
@@ -88,7 +88,7 @@ set_display_params (const char* str)
void
set_full_screen_mode (void)
{
- full_screen = 1;
+ full_screen = 0;
}

static bool
diff --git a/src/media/sdl/video.c b/src/media/sdl/video.c
index c6543d6..00d405c 100644
--- a/src/media/sdl/video.c
+++ b/src/media/sdl/video.c
@@ -40,7 +40,7 @@ static int scr_stretch;
it might requires locking. */

static SDL_Surface *visu = 0;
-static int visu_options = SDL_HWPALETTE | SDL_DOUBLEBUF;
+static int visu_options = SDL_HWPALETTE | SDL_DOUBLEBUF | SDL_FULLSCREEN;
static bool SDL_initialized = false;
#define SDL_VIDEODRIVER "SDL_VIDEODRIVER"
static char *sdl_videodriver = 0;
@@ -56,7 +56,7 @@ set_display_params (const char *str)
void
set_full_screen_mode (void)
{
- visu_options |= SDL_FULLSCREEN;
+ visu_options &= ~SDL_FULLSCREEN;
}

/* Fullscreen mode is toggeled by pressing Alt+Enter.
diff --git a/src/media/video.c b/src/media/video.c
index e4e57a5..e737761 100644
--- a/src/media/video.c
+++ b/src/media/video.c
@@ -26,111 +26,6 @@ int scr_pitch; /* rendering buffer pitch */

/* slow stretching routines */

-static void
-stretch_twofold (const a_pixel *s, a_pixel *d, unsigned width)
-{
- int rows_left, columns_left;
-
- for (rows_left = 200; rows_left; --rows_left) {
- for (columns_left = width / 2; columns_left; --columns_left) {
- a_pixel t1, t2;
- t1 = s[0];
- t2 = s[1];
- d[0] = t1;
- d[640 + 2] = t2;
- d[1] = t1;
- d[640 + 3] = t2;
- d[640 + 0] = t1;
- d[2] = t2;
- d[640 + 1] = t1;
- d[3] = t2;
- s += 2;
- d += 4;
- }
- d += 2 * (scr_pitch - width);
- s += xbuf - width;
- }
-}
-
-static void
-stretch_twofold_even (const a_pixel *s, a_pixel *d, unsigned width)
-{
- int rows_left, columns_left;
-
- for (rows_left = 200; rows_left; --rows_left) {
- for (columns_left = width; columns_left; --columns_left) {
- d[1] = d[0] = *s;
- ++s;
- d += 2;
- }
- d += 2 * (scr_pitch - width);
- s += xbuf - width;
- }
-}
-
-static void
-stretch_threefold (const a_pixel* s, a_pixel *d, unsigned width)
-{
- int rows_left, columns_left;
-
- for (rows_left = 200; rows_left; --rows_left) {
- for (columns_left = width / 2; columns_left; --columns_left) {
- a_pixel t1, t2;
- t1 = s[0];
- t2 = s[1];
- d[0] = t1;
- d[960 + 3] = t2;
- d[2*960 + 1] = t1;
- d[4] = t2;
- d[960 + 2] = t1;
- d[2*960 + 5] = t2;
- d[960 + 0] = t1;
- d[2*960 + 3] = t2;
- d[1] = t1;
- d[960 + 4] = t2;
- d[2*960 + 2] = t1;
- d[5] = t2;
- d[2*960 + 0] = t1;
- d[3] = t2;
- d[960 + 1] = t1;
- d[2*960 + 4] = t2;
- d[2] = t1;
- d[960 + 5] = t2;
- s += 2;
- d += 6;
- }
- d += 3 * (scr_pitch - width);
- s += xbuf - width;
- }
-}
-
-static void
-stretch_threefold_even (const a_pixel *s, a_pixel *d, unsigned width)
-{
- int rows_left, columns_left;
-
- for (rows_left = 200 / 2; rows_left; --rows_left) {
- for (columns_left = width; columns_left; --columns_left) {
- a_pixel t1, t2;
- t1 = s[0];
- t2 = s[xbuf];
- d[0] = t1;
- d[0+960*4] = t2;
- d[1] = t1;
- d[2] = t1;
- d[1+960*4] = t2;
- d[0+960*2] = t1;
- d[1+960*2] = t1;
- d[2+960*4] = t2;
- d[2+960*2] = t1;
- ++s;
- d += 3;
- }
- d += 3 * (2 * scr_pitch - width);
- s += 2 * xbuf - width;
- }
-}
-
static void
stretch_fourfold (const a_pixel *s, a_pixel *d, unsigned width)
{
@@ -196,27 +91,10 @@ copy_display (const a_pixel *s, a_pixel *d, unsigned width)
{
/* the result of stretching routines is written directly
to the video memory */
- if (stretch == 2) {
- if (even_lines)
- stretch_twofold_even (s, d, width);
- else
- stretch_twofold (s, d, width);
- } else if (stretch == 3) {
- if (even_lines)
- stretch_threefold_even (s, d, width);
- else
- stretch_threefold (s, d, width);
- } else if (stretch == 4) {
- if (even_lines)
- stretch_fourfold_even (s, d, width);
- else
- stretch_fourfold (s, d, width);
- } else { /* stretch == 1 */
- if (even_lines)
- copy_screen_even (s, d, width);
- else
- copy_screen (s, d, width);
- }
+ if (even_lines)
+ stretch_fourfold_even (s, d, width);
+ else
+ stretch_fourfold (s, d, width);
}

void
diff --git a/src/persona.h b/src/persona.h
index dc10d5b..a338dec 100644
--- a/src/persona.h
+++ b/src/persona.h
@@ -28,8 +28,8 @@
* difference only if the program has a sgid or suid bit.
*/

-bool keep_sgid; /* Whether we should keep the */
-bool keep_suid; /* SGID or SUID priviledge. */
+extern bool keep_sgid; /* Whether we should keep the */
+extern bool keep_suid; /* SGID or SUID priviledge. */

/* Get information about the current persona,
and switch to the user persona. */
--
2.37.3


From ec83d7788f5ef6dce8ee656deee25a2380f50fd4 Mon Sep 17 00:00:00 2001
From: Begasus <begasus@gmail.com>
Date: Thu, 6 Jul 2023 10:49:42 +0000
Subject: Set user_dir to ~/config/settings/heroes


diff --git a/src/rsc_files_hash.c b/src/rsc_files_hash.c
index 1ea3b77..42a4ade 100644
--- a/src/rsc_files_hash.c
+++ b/src/rsc_files_hash.c
@@ -95,7 +95,7 @@ static struct rsc_file rsc_set[] =
{
{"",0,0,0,false}, {"",0,0,0,false}, {"",0,0,0,false}, {"",0,0,0,false}, {"",0,0,0,false}, {"",0,0,0,false}, {"",0,0,0,false},
{"sys-dir", "/var/games/heroes", 0,0,true},
- {"user-dir", "$(home-dir)/.heroes", 0,0,true},
+ {"user-dir", "$(home-dir)/config/settings/heroes", 0,0,true},
{"",0,0,0,false},
{"editor-img", "$(data-dir)/pics/edit.pcx", 0,0,true},
{"",0,0,0,false}, {"",0,0,0,false},
--
2.37.3