0
0
Fork 0
haikuports/games-rpg/kqlives/patches/kqlives-0.99.patchset

492 lines
16 KiB
Plaintext

From b97889300384a0b21d43f499ca5398185ce775b6 Mon Sep 17 00:00:00 2001
From: Adrien Destugues <pulkomandy@pulkomandy.tk>
Date: Thu, 12 Nov 2015 14:00:33 +0100
Subject: Tell the buildsystem that Haiku is BeOS-like.
diff --git a/configure.ac b/configure.ac
index 679d74f..3a00c0f 100644
--- a/configure.ac
+++ b/configure.ac
@@ -101,6 +101,12 @@ AC_ARG_ENABLE(cheats, AS_HELP_STRING([--enable-cheats], [Enable cheats]), AC_DEF
# host stuff
case ${host} in
+ *-*-haiku*)
+ kq_extra_files='beos.$(OBJEXT)'
+ AC_SUBST([kq_extra_files])
+ AC_SUBST(kq_target_dir,beos)
+ bundle=no
+ ;;
*-*-linux*)
kq_extra_files='unix.$(OBJEXT)'
AC_SUBST([kq_extra_files])
--
2.2.2
From e87805b729ddc5fb32f1b55c15bdb16f59fc0ff4 Mon Sep 17 00:00:00 2001
From: Adrien Destugues <pulkomandy@pulkomandy.tk>
Date: Thu, 12 Nov 2015 14:00:50 +0100
Subject: gcc2 fixes.
diff --git a/maps/mapdiff.c b/maps/mapdiff.c
index 3416961..7a007f9 100644
--- a/maps/mapdiff.c
+++ b/maps/mapdiff.c
@@ -677,8 +677,8 @@ void cleanup (void)
*/
void error_load (const char *problem_file)
{
- ASSERT (problem_file);
char err_msg[80];
+ ASSERT (problem_file);
sprintf (strbuf, "Could not load \"%s\"\n", problem_file);
strcat (strncpy (err_msg, strbuf, sizeof (err_msg) - 1), "\n");
@@ -816,13 +816,13 @@ void usage (const char *argv)
int main (int argc, char *argv[])
{
+ int i, number_of_files = 0;
+ char *filenames[PATH_MAX];
+
setlocale (LC_ALL, "");
bindtextdomain (PACKAGE, KQ_LOCALE);
textdomain (PACKAGE);
- int i, number_of_files = 0;
- char *filenames[PATH_MAX];
-
startup ();
/* Check whether we should show program usage. If we do, exit program
diff --git a/maps/mapdump.c b/maps/mapdump.c
index ee80743..6ad399c 100644
--- a/maps/mapdump.c
+++ b/maps/mapdump.c
@@ -91,8 +91,8 @@ void cleanup (void)
*/
void error_load (const char *problem_file)
{
- ASSERT (problem_file);
char err_msg[80];
+ ASSERT (problem_file);
strcat (strncpy (err_msg, problem_file, sizeof (err_msg) - 1), "\n");
TRACE ("%s: could not load %s\n", allegro_error, problem_file);
@@ -136,10 +136,6 @@ void usage (const char *argv)
int main (int argc, char *argv[])
{
- setlocale (LC_ALL, "");
- bindtextdomain (PACKAGE, KQ_LOCALE);
- textdomain (PACKAGE);
-
char fn[PATH_MAX], *filenames[PATH_MAX];
int i, number_of_files = 0, verbose = 0;
int force_overwrite = 0;
@@ -148,6 +144,10 @@ int main (int argc, char *argv[])
/* Regular and default values (incase an option is not specified) */
s_show showing, d_showing;
+ setlocale (LC_ALL, "");
+ bindtextdomain (PACKAGE, KQ_LOCALE);
+ textdomain (PACKAGE);
+
/* Make sure that we have some sort of input; exit with error if not */
if (argc == 1) {
usage (argv[0]);
diff --git a/maps/mapedit.c b/maps/mapedit.c
index 987b9a8..325ad73 100644
--- a/maps/mapedit.c
+++ b/maps/mapedit.c
@@ -2144,12 +2144,12 @@ void kq_yield (void)
/* Welcome to Mapdraw, folks! */
int main (int argc, char *argv[])
{
+ int main_stop = 0, oldmouse_x = 0, oldmouse_y = 0;
+ int i;
+
setlocale (LC_ALL, "");
bindtextdomain (PACKAGE, KQ_LOCALE);
textdomain (PACKAGE);
-
- int main_stop = 0, oldmouse_x = 0, oldmouse_y = 0;
- int i;
row[0] = vtiles * 16 + 6;
for (i = 1; i < 8; i++) {
@@ -4194,72 +4194,8 @@ int startup (void)
int kx, ky, a;
COLOR_MAP cmap;
- if (allegro_init () != 0)
- return 0;
-
- /* Buffer for all strings */
- strbuf = (char *) malloc (256);
-
- install_keyboard ();
- install_timer ();
-
- /* Determine if user wants to use Windowed or Regular Mode */
- if (WBUILD == 1) {
- if (set_gfx_mode (GFX_AUTODETECT_WINDOWED, SW, SH, 0, 0) != 0) {
- if (set_gfx_mode (GFX_SAFE, SW, SH, 0, 0) != 0) {
- set_gfx_mode (GFX_TEXT, 0, 0, 0, 0);
- allegro_message ("Unable to set any graphic mode\n%s\n",
- allegro_error);
- return 0;
- }
- }
- } else {
- if (set_gfx_mode (GFX_AUTODETECT, SW, SH, 0, 0) != 0) {
- if (set_gfx_mode (GFX_SAFE, SW, SH, 0, 0) != 0) {
- set_gfx_mode (GFX_TEXT, 0, 0, 0, 0);
- allegro_message ("Unable to set any graphic mode\n%s\n",
- allegro_error);
- return 0;
- }
- } // if (WBUILD)
- }
-
- /* Check for the presence of a mouse */
- a = install_mouse ();
- if (a == -1) {
- nomouse = 1;
- klog ("Mouse not found!\n");
- rest (1000);
- }
-
- shared_startup ();
-
- /* Create the picture used for the mouse */
- mouse_pic = create_bitmap (4, 6);
- for (ky = 0; ky < 6; ky++)
- for (kx = 0; kx < 4; kx++)
- mouse_pic->line[ky][kx] = mousepic[ky * 4 + kx];
- set_mouse_speed (4, 4);
-
- /* Screen buffer */
- double_buffer = create_bitmap (SW, SH);
- clear (double_buffer);
-
- gmap.map_no = -1;
- gmap.tileset = 0;
- gmap.xsize = htiles;
- gmap.ysize = vtiles;
-
- bufferize ();
-
- create_trans_table (&cmap, pal, 128, 128, 128, NULL);
- color_map = &cmap;
-
- font6 = create_bitmap (6, 546);
- getfont ();
-
/* Used for highlighting */
- unsigned char hilite[] = {
+ static const unsigned char hilite[] = {
00, 00, 00, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 00, 00, 00,
00, 00, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 00, 00,
00, 25, 25, 25, 45, 45, 45, 45, 45, 45, 45, 45, 25, 25, 25, 00,
@@ -4278,14 +4214,8 @@ int startup (void)
00, 00, 00, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 00, 00, 00,
};
- mesh2 = create_bitmap (16, 16);
- clear (mesh2);
- for (ky = 0; ky < 16; ky++)
- for (kx = 0; kx < 16; kx++)
- mesh2->line[ky][kx] = hilite[ky * 16 + kx];
-
/* Used to show map boundaries */
- static unsigned char diag_bars[] = {
+ static const unsigned char diag_bars[] = {
25, 25, 00, 00, 00, 00, 00, 00, 25, 25, 00, 00, 00, 00, 00, 00,
25, 00, 00, 00, 00, 00, 00, 25, 25, 00, 00, 00, 00, 00, 00, 25,
00, 00, 00, 00, 00, 00, 25, 25, 00, 00, 00, 00, 00, 00, 25, 25,
@@ -4304,31 +4234,10 @@ int startup (void)
00, 25, 25, 00, 00, 00, 00, 00, 00, 25, 25, 00, 00, 00, 00, 00,
};
- mesh3 = create_bitmap (16, 16);
- clear (mesh3);
- for (ky = 0; ky < 16; ky++)
- for (kx = 0; kx < 16; kx++)
- mesh3->line[ky][kx] = diag_bars[ky * 16 + kx];
-
- /* Entity images */
- init_entities ();
- showing.entities = 0;
- showing.obstacles = 0;
- showing.shadows = 0;
- showing.zones = 0;
- showing.markers = 0;
- showing.boundaries = 0;
- showing.last_layer = draw_mode;
- showing.layer[0] = 1;
- showing.layer[1] = 1;
- showing.layer[2] = 1;
-
- icon_set = 0;
-
// This turns the other/indent.pro settings off:
// *INDENT-OFF*
- unsigned char arrow_up[] = {
+ static const unsigned char arrow_up[] = {
00, 00, 00, 00, 00, 00, 00, 60, 00, 00, 00, 00, 00, 00, 00, 00,
00, 00, 00, 00, 00, 00, 60, 58, 60, 00, 00, 00, 00, 00, 00, 00,
00, 00, 00, 00, 00, 60, 58, 56, 58, 60, 00, 00, 00, 00, 00, 00,
@@ -4347,7 +4256,7 @@ int startup (void)
00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00,
};
- unsigned char arrow_left[] = {
+ static const unsigned char arrow_left[] = {
00, 00, 00, 00, 00, 00, 00, 60, 00, 00, 00, 00, 00, 00, 00, 00,
00, 00, 00, 00, 00, 00, 60, 60, 50, 00, 00, 00, 00, 00, 00, 00,
00, 00, 00, 00, 00, 60, 58, 60, 50, 00, 00, 00, 00, 00, 00, 00,
@@ -4366,7 +4275,7 @@ int startup (void)
00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00,
};
- unsigned char arrow_center[] = {
+ static const unsigned char arrow_center[] = {
00, 00, 00, 60, 60, 60, 60, 60, 60, 60, 60, 60, 00, 00, 00, 00,
00, 00, 60, 00, 00, 00, 00, 60, 00, 00, 00, 00, 60, 00, 00, 00,
00, 60, 00, 00, 58, 58, 58, 60, 58, 58, 58, 58, 00, 60, 00, 00,
@@ -4385,7 +4294,7 @@ int startup (void)
00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00,
};
- unsigned char arrow_right[] = {
+ static const unsigned char arrow_right[] = {
00, 00, 00, 00, 00, 00, 00, 60, 00, 00, 00, 00, 00, 00, 00, 00,
00, 00, 00, 00, 00, 00, 00, 60, 60, 00, 00, 00, 00, 00, 00, 00,
00, 00, 00, 00, 00, 00, 00, 60, 58, 60, 00, 00, 00, 00, 00, 00,
@@ -4404,7 +4313,7 @@ int startup (void)
00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00,
};
- unsigned char arrow_down[] = {
+ static const unsigned char arrow_down[] = {
00, 00, 00, 00, 00, 00, 60, 60, 60, 00, 00, 00, 00, 00, 00, 00,
00, 00, 00, 00, 00, 00, 60, 60, 60, 50, 00, 00, 00, 00, 00, 00,
00, 00, 00, 00, 00, 00, 60, 60, 60, 50, 00, 00, 00, 00, 00, 00,
@@ -4426,6 +4335,118 @@ int startup (void)
// This turns the other/indent.pro settings back on:
// *INDENT-ON*
+ /* Used for highlighting */
+ static const unsigned char hilite_attrib[] = {
+ 24, 24, 00, 00, 00, 00, 00, 24, 24, 00, 00, 00, 00, 00, 24, 24,
+ 24, 24, 24, 00, 00, 00, 00, 24, 24, 00, 00, 00, 00, 24, 24, 24,
+ 00, 24, 24, 24, 00, 00, 00, 24, 24, 00, 00, 00, 24, 24, 24, 00,
+ 00, 00, 24, 24, 24, 00, 00, 24, 24, 00, 00, 24, 24, 24, 00, 00,
+ 00, 00, 00, 24, 00, 00, 00, 00, 00, 00, 00, 00, 24, 00, 00, 00,
+ 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00,
+ 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00,
+ 24, 24, 24, 24, 00, 00, 00, 00, 00, 00, 00, 00, 24, 24, 24, 24,
+ 24, 24, 24, 24, 00, 00, 00, 00, 00, 00, 00, 00, 24, 24, 24, 24,
+ 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00,
+ 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00,
+ 00, 00, 00, 24, 00, 00, 00, 00, 00, 00, 00, 00, 24, 00, 00, 00,
+ 00, 00, 24, 24, 24, 00, 00, 24, 24, 00, 00, 24, 24, 24, 00, 00,
+ 00, 24, 24, 24, 00, 00, 00, 24, 24, 00, 00, 00, 24, 24, 24, 00,
+ 24, 24, 24, 00, 00, 00, 00, 24, 24, 00, 00, 00, 00, 24, 24, 24,
+ 24, 24, 00, 00, 00, 00, 00, 24, 24, 00, 00, 00, 00, 00, 24, 24,
+ };
+
+
+ if (allegro_init () != 0)
+ return 0;
+
+ /* Buffer for all strings */
+ strbuf = (char *) malloc (256);
+
+ install_keyboard ();
+ install_timer ();
+
+ /* Determine if user wants to use Windowed or Regular Mode */
+ if (WBUILD == 1) {
+ if (set_gfx_mode (GFX_AUTODETECT_WINDOWED, SW, SH, 0, 0) != 0) {
+ if (set_gfx_mode (GFX_SAFE, SW, SH, 0, 0) != 0) {
+ set_gfx_mode (GFX_TEXT, 0, 0, 0, 0);
+ allegro_message ("Unable to set any graphic mode\n%s\n",
+ allegro_error);
+ return 0;
+ }
+ }
+ } else {
+ if (set_gfx_mode (GFX_AUTODETECT, SW, SH, 0, 0) != 0) {
+ if (set_gfx_mode (GFX_SAFE, SW, SH, 0, 0) != 0) {
+ set_gfx_mode (GFX_TEXT, 0, 0, 0, 0);
+ allegro_message ("Unable to set any graphic mode\n%s\n",
+ allegro_error);
+ return 0;
+ }
+ } // if (WBUILD)
+ }
+
+ /* Check for the presence of a mouse */
+ a = install_mouse ();
+ if (a == -1) {
+ nomouse = 1;
+ klog ("Mouse not found!\n");
+ rest (1000);
+ }
+
+ shared_startup ();
+
+ /* Create the picture used for the mouse */
+ mouse_pic = create_bitmap (4, 6);
+ for (ky = 0; ky < 6; ky++)
+ for (kx = 0; kx < 4; kx++)
+ mouse_pic->line[ky][kx] = mousepic[ky * 4 + kx];
+ set_mouse_speed (4, 4);
+
+ /* Screen buffer */
+ double_buffer = create_bitmap (SW, SH);
+ clear (double_buffer);
+
+ gmap.map_no = -1;
+ gmap.tileset = 0;
+ gmap.xsize = htiles;
+ gmap.ysize = vtiles;
+
+ bufferize ();
+
+ create_trans_table (&cmap, pal, 128, 128, 128, NULL);
+ color_map = &cmap;
+
+ font6 = create_bitmap (6, 546);
+ getfont ();
+
+ mesh2 = create_bitmap (16, 16);
+ clear (mesh2);
+ for (ky = 0; ky < 16; ky++)
+ for (kx = 0; kx < 16; kx++)
+ mesh2->line[ky][kx] = hilite[ky * 16 + kx];
+
+ mesh3 = create_bitmap (16, 16);
+ clear (mesh3);
+ for (ky = 0; ky < 16; ky++)
+ for (kx = 0; kx < 16; kx++)
+ mesh3->line[ky][kx] = diag_bars[ky * 16 + kx];
+
+ /* Entity images */
+ init_entities ();
+ showing.entities = 0;
+ showing.obstacles = 0;
+ showing.shadows = 0;
+ showing.zones = 0;
+ showing.markers = 0;
+ showing.boundaries = 0;
+ showing.last_layer = draw_mode;
+ showing.layer[0] = 1;
+ showing.layer[1] = 1;
+ showing.layer[2] = 1;
+
+ icon_set = 0;
+
/* Create the arrow bitmaps
*
* arrow_pics[0] = up arrow
@@ -4448,26 +4469,6 @@ int startup (void)
}
}
- /* Used for highlighting */
- static unsigned char hilite_attrib[] = {
- 24, 24, 00, 00, 00, 00, 00, 24, 24, 00, 00, 00, 00, 00, 24, 24,
- 24, 24, 24, 00, 00, 00, 00, 24, 24, 00, 00, 00, 00, 24, 24, 24,
- 00, 24, 24, 24, 00, 00, 00, 24, 24, 00, 00, 00, 24, 24, 24, 00,
- 00, 00, 24, 24, 24, 00, 00, 24, 24, 00, 00, 24, 24, 24, 00, 00,
- 00, 00, 00, 24, 00, 00, 00, 00, 00, 00, 00, 00, 24, 00, 00, 00,
- 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00,
- 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00,
- 24, 24, 24, 24, 00, 00, 00, 00, 00, 00, 00, 00, 24, 24, 24, 24,
- 24, 24, 24, 24, 00, 00, 00, 00, 00, 00, 00, 00, 24, 24, 24, 24,
- 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00,
- 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00,
- 00, 00, 00, 24, 00, 00, 00, 00, 00, 00, 00, 00, 24, 00, 00, 00,
- 00, 00, 24, 24, 24, 00, 00, 24, 24, 00, 00, 24, 24, 24, 00, 00,
- 00, 24, 24, 24, 00, 00, 00, 24, 24, 00, 00, 00, 24, 24, 24, 00,
- 24, 24, 24, 00, 00, 00, 00, 24, 24, 00, 00, 00, 00, 24, 24, 24,
- 24, 24, 00, 00, 00, 00, 00, 24, 24, 00, 00, 00, 00, 00, 24, 24,
- };
-
mesh_h = create_bitmap (16, 16);
clear (mesh_h);
for (ky = 0; ky < 16; ky++)
@@ -4481,9 +4482,9 @@ int startup (void)
if (num_joysticks == 0) {
use_joy = 0;
} else {
+ int i;
use_joy = 0;
- int i;
if (poll_joystick () == 0) {
for (i = num_joysticks - 1; i >= 0; i--) {
if (joy[i].num_buttons >= 4) {
diff --git a/maps/mapstructs.c b/maps/mapstructs.c
index 310034b..5200350 100644
--- a/maps/mapstructs.c
+++ b/maps/mapstructs.c
@@ -79,6 +79,8 @@ void add_change_bounding (int x, int y, int mouse_b, int *current)
b->y1 = y;
active_bound = 1;
} else {
+ s_bound temp;
+
/* We have started tracking a boundary already, meaning we
* already have the top-left coords. Now we just need the
* bottom-right ones.
@@ -91,7 +93,6 @@ void add_change_bounding (int x, int y, int mouse_b, int *current)
}
/* Used only to check if boundaries are okay */
- s_bound temp;
set_bounds (&temp, b->x1, b->y1, x, y);
/* Don't allow the user to begin (or end) any portion of a bounding
* area if it has any points contained in another bounding area's
diff --git a/src/intrface.c b/src/intrface.c
index 7287753..269b0c4 100644
--- a/src/intrface.c
+++ b/src/intrface.c
@@ -278,7 +278,7 @@ static int KQ_get_tile_all (lua_State *);
#endif
-static const struct luaL_reg lrs[] = {
+static const struct luaL_Reg lrs[] = {
{"add_chr", KQ_add_chr},
{"add_quest_item", KQ_add_quest_item},
{"add_special_item", KQ_add_special_item},
@@ -4074,7 +4074,7 @@ int lua_dofile (lua_State * L, const char * fname)
}
}
- if ((lua_load (L, (lua_Chunkreader) filereader, f, filename)) != 0) {
+ if ((lua_load (L, (lua_Reader) filereader, f, filename)) != 0) {
allegro_message (_("Could not parse script %s!"), filename);
pack_fclose (f);
return 1;
@@ -4101,7 +4101,7 @@ static int kq_dostring (lua_State * L, const char *cmd)
{
int retval, nrets, i;
nrets = lua_gettop(L);
- retval = lua_load (L, (lua_Chunkreader) stringreader, &cmd, "<console>");
+ retval = lua_load (L, (lua_Reader) stringreader, &cmd, "<console>");
if (retval != 0) {
scroll_console("Parse error");
return retval;
--
2.2.2