From f693722c544bf3193d0bffe063be7f166d03a493 Mon Sep 17 00:00:00 2001
From: Markus Himmel <markus@himmel-villmar.de>
Date: Mon, 12 Jan 2015 20:53:30 +0000
Subject: Original resource definition file


diff --git a/LTris.rdef b/LTris.rdef
new file mode 100644
index 0000000..b1cea42
--- /dev/null
+++ b/LTris.rdef
@@ -0,0 +1,37 @@
+resource app_signature "application/x-vnd.lgames.ltris";
+
+resource app_flags B_SINGLE_LAUNCH;
+
+resource app_version {
+	major  = 1,
+	middle = 0,
+	minor  = 19,
+
+	/* 0 = development	1 = alpha			2 = beta
+	   3 = gamma		4 = golden master	5 = final */
+	variety = 5,
+
+	internal = 0,
+
+	short_info = "LTris is a tetris clone.",
+	long_info  = "LTris is a tetris clone: differently shaped blocks are falling down the rectangular playing field."
+};
+
+resource vector_icon {
+	$"6E6369660A05000200060239BCD5357062B86B6C3CA1364826E049473700C0BE"
+	$"33FF6A6925020006023C15033A71ACB873493A166346BF9949CB5C00FFFC1BFF"
+	$"CDCB16020006023A39972E8567AFC35B3B523345A11E4863C900CECC1BFF9E9D"
+	$"150392901702001602399F0E3686A9B98DF63C8C42488EEB4924C900C2FF5A02"
+	$"0016023C15033A71ACB873493A166347FF994A15AE00FAFFD7020016023C9D60"
+	$"377C1EB78C243CA9674705BF48FA9100DAFFB30578040174060A04223E224A2D"
+	$"4F2D420A042D422D4F334B333F0A04223E2D42333F283B0A1C224A223E233D22"
+	$"3C222F282D2E2F2E2735243F283F2A41294B2D4B394A3B4B3C5740574C51504B"
+	$"4E4B5545593A543A483B473344334B2D4F0A072D513A4F455B5159575A605337"
+	$"420A04463F533E35332E351B0A090104000A0001031001178403040A01010100"
+	$"0A020100000A040102000A05010120382A0A06010020382A0A08010220382A0A"
+	$"0101012020120A0201002020120A0301022020120A010101202C170A02010020"
+	$"2C170A040102202C170A05010120381C0A06010020381C0A08010220381C0A05"
+	$"01012044210A0601002044210A0701022044210A090105000A010101202C090A"
+	$"020100202C090A030102202C090A05010120380E0A06010020380E0A07010220"
+	$"380E"
+};
-- 
2.26.0


From 6de1572536a027526d45224219b53a33712de630 Mon Sep 17 00:00:00 2001
From: Markus Himmel <markus@himmel-villmar.de>
Date: Mon, 12 Jan 2015 22:16:46 +0000
Subject: Move settings and highscores to B_USER_SETTINGS_DIRECTORY


diff --git a/src/chart.c b/src/chart.c
index 87d8e03..8cee31d 100644
--- a/src/chart.c
+++ b/src/chart.c
@@ -189,15 +189,19 @@ void chart_load()
 	if ( charts ) list_delete( charts ); charts = 0;
 	charts = list_create( LIST_AUTO_DELETE, chart_set_delete );
     /* load highscore */
+#ifndef __HAIKU__
     if ( !chart_load_from_path( HI_DIR ) ) {
         fprintf( stderr, "Unable to access highscore chart in '%s'.\n", HI_DIR );
         fprintf( stderr, "Trying to use config directory '%s'.\n", config.dir_name );
+#endif
         if ( !chart_load_from_path( config.dir_name ) ) {
             fprintf( stderr, "Unable to access highscore chart in config directory... won't be "
                              "able to save any results. Sorry.\n" );
             return;
         }
+#ifndef __HAIKU__
     }
+#endif
     printf( "Saving highscore chart in: %s\n", chart_path );
     /* load resources */
     cfont = load_fixed_font( "f_small_yellow.bmp", 32, 96, 8 );
diff --git a/src/config.c b/src/config.c
index 00f7e9c..c4d6ea0 100644
--- a/src/config.c
+++ b/src/config.c
@@ -23,6 +23,11 @@
 #include <sys/types.h>
 #include <sys/stat.h>
 
+#ifdef __HAIKU__
+#include <FindDirectory.h>
+#include <fs_info.h>
+#endif
+
 #include "sdl.h"
 #include "config.h"
 #include "parser.h"
@@ -40,7 +45,18 @@ void config_check_dir()
 {
 #ifdef DISABLE_INSTALL
     sprintf( config.dir_name, "." );
-#else    
+#elif __HAIKU__
+    dev_t volume = dev_for_path("/boot");
+    if ( find_directory(B_USER_SETTINGS_DIRECTORY, volume, false,
+        config.dir_name, sizeof(config.dir_name)-1 ) == B_OK &&
+        strlen(config.dir_name) + strlen(CONFIG_DIR_NAME)
+        < sizeof(config.dir_name)-1 ) {
+        strcat(config.dir_name, "/");
+        strcat(config.dir_name, CONFIG_DIR_NAME);
+    } else
+        snprintf( config.dir_name, sizeof(config.dir_name)-1, "%s/%s", getenv( "HOME" ), CONFIG_DIR_NAME );
+    fprintf( stderr, "HAIKU: Config directory is '%s'\n", config.dir_name );
+#else
     snprintf( config.dir_name, sizeof(config.dir_name)-1, "%s/%s", getenv( "HOME" ), CONFIG_DIR_NAME );
 #endif
     if ( opendir( config.dir_name ) == 0 ) {
diff --git a/src/config.h b/src/config.h
index ee52a64..491ed64 100644
--- a/src/config.h
+++ b/src/config.h
@@ -99,7 +99,11 @@ typedef struct {
 } Config;
 
 /* config directory name in home directory */
+#ifdef __HAIKU__
+#define CONFIG_DIR_NAME "LGames"
+#else
 #define CONFIG_DIR_NAME ".lgames"
+#endif
 
 /* set config to default */
 void config_reset();
diff --git a/src/manager.c b/src/manager.c
index b8cc411..de07f73 100644
--- a/src/manager.c
+++ b/src/manager.c
@@ -19,6 +19,11 @@
 #include "../config.h"
 #endif
 
+#ifdef __HAIKU__
+#include <FindDirectory.h>
+#include <fs_info.h>
+#endif
+
 #include "ltris.h"
 #include "manager.h"
 #include "chart.h"
@@ -143,7 +148,22 @@ void cb_delete_set()
         return;
     }
     /* get file name + path */
+#ifdef __HAIKU__
+    dev_t volume = dev_for_path("/boot");
+    if ( find_directory(B_USER_SETTINGS_DIRECTORY, volume, false,
+        fname, sizeof(config.dir_name)-1 ) == B_OK &&
+        strlen(fname) + strlen(CONFIG_DIR_NAME)
+        + strlen(levelset_home_names[config.levelset_home_id])
+        < sizeof(fname)-9 ) {
+        strcat(fname, "/");
+        strcat(fname, CONFIG_DIR_NAME);
+        strcat(fname, "/levels/");
+        strcat(fname, levelset_home_names[config.levelset_home_id]);
+    } else
+        snprintf( fname, sizeof(fname)-1, "%s/%s/levels/%s", getenv( "HOME" ), CONFIG_DIR_NAME, levelset_home_names[config.levelset_home_id] );
+#else
     snprintf( fname, sizeof(fname)-1, "%s/%s/levels/%s", getenv( "HOME" ), CONFIG_DIR_NAME, levelset_home_names[config.levelset_home_id] );
+#endif
     remove( fname );
     levelsets_load_names(); /* reinit name lists and configs indices */
     /* reassign these name lists as position in memory has changed */
-- 
2.26.0


From c511bcc1551702a5222ba9e59563d9e21d88f29c Mon Sep 17 00:00:00 2001
From: Gerasim Troeglazov <3dEyes@gmail.com>
Date: Fri, 1 May 2020 21:17:07 +1000
Subject: Remove inline functions


diff --git a/src/sdl.c b/src/sdl.c
index c4fc6b5..8a5900d 100644
--- a/src/sdl.c
+++ b/src/sdl.c
@@ -905,7 +905,7 @@ void hardware_cap()
 /*
     update rectangle (0,0,0,0)->fullscreen
 */
-inline void refresh_screen(int x, int y, int w, int h)
+void refresh_screen(int x, int y, int w, int h)
 {
     SDL_UpdateRect(sdl.screen, x, y, w, h);
 }
@@ -1132,7 +1132,7 @@ SDL_Cursor* create_cursor( int width, int height, int hot_x, int hot_y, char *so
 /*
     get milliseconds since last call
 */
-inline int get_time()
+int get_time()
 {
     int ms;
     cur_time = SDL_GetTicks();
@@ -1148,7 +1148,7 @@ inline int get_time()
 /*
     reset timer
 */
-inline void reset_timer()
+void reset_timer()
 {
     last_time = SDL_GetTicks();
 }
diff --git a/src/sdl.h b/src/sdl.h
index 3a83bb0..f5a378a 100644
--- a/src/sdl.h
+++ b/src/sdl.h
@@ -132,7 +132,7 @@ Video_Mode* cur_video_mode();
 char** get_mode_names( int *count );
 int  set_video_mode( Video_Mode mode );
 void hardware_cap();
-inline void refresh_screen( int x, int y, int w, int h );
+void refresh_screen( int x, int y, int w, int h );
 void refresh_rects();
 void add_refresh_rect(int x, int y, int w, int h);
 int  wait_for_key();
@@ -148,8 +148,8 @@ void take_screenshot( int i );
 SDL_Cursor* create_cursor( int width, int height, int hot_x, int hot_y, char *source );
 
 /* timer */
-inline int get_time();
-inline void reset_timer();
+int get_time();
+void reset_timer();
 
 #ifdef __cplusplus
 };
diff --git a/src/tools.c b/src/tools.c
index 853ac49..4075752 100644
--- a/src/tools.c
+++ b/src/tools.c
@@ -23,27 +23,27 @@
 #include "ltris.h"
 
 /* compares to strings and returns true if their first strlen(str1) chars are equal */
-inline int strequal( char *str1, char *str2 )
+int strequal( char *str1, char *str2 )
 {
     if ( strlen( str1 ) != strlen( str2 ) ) return 0;
     return ( !strncmp( str1, str2, strlen( str1 ) ) );
 }
 
 /* set delay to ms milliseconds */
-inline void delay_set( Delay *delay, int ms )
+void delay_set( Delay *delay, int ms )
 {
     delay->limit = ms;
     delay->cur = 0;
 }
 
 /* reset delay ( cur = 0 )*/
-inline void delay_reset( Delay *delay )
+void delay_reset( Delay *delay )
 {
     delay->cur = 0;
 }
 
 /* check if times out and reset */
-inline int delay_timed_out( Delay *delay, int ms )
+int delay_timed_out( Delay *delay, int ms )
 {
     delay->cur += ms;
     if ( delay->cur >= delay->limit ) {
@@ -56,12 +56,12 @@ inline int delay_timed_out( Delay *delay, int ms )
 }
 
 /* set timer so that we have a time out next call of delay_timed_out() */
-inline void delay_force_time_out( Delay *delay )
+void delay_force_time_out( Delay *delay )
 {
     delay->cur = delay->limit;
 }
 
-inline void goto_tile( int *x, int *y, int d )
+void goto_tile( int *x, int *y, int d )
 {
     /*  0 -up, clockwise, 5 - left up */
     switch ( d ) {
diff --git a/src/tools.h b/src/tools.h
index 8afdd23..18ed5da 100644
--- a/src/tools.h
+++ b/src/tools.h
@@ -45,16 +45,16 @@ typedef struct {
 } Delay;
 
 /* set delay to ms milliseconds */
-inline void delay_set( Delay *delay, int ms );
+void delay_set( Delay *delay, int ms );
 
 /* reset delay ( cur = 0 )*/
-inline void delay_reset( Delay *delay );
+void delay_reset( Delay *delay );
 
 /* check if time's out ( add ms milliseconds )and reset */
-inline int delay_timed_out( Delay *delay, int ms );
+int delay_timed_out( Delay *delay, int ms );
 
 /* set timer so that we have a time out next call of delay_timed_out() */
-inline void delay_force_time_out( Delay *delay );
+void delay_force_time_out( Delay *delay );
 
 /* return distance betwteen to map positions */
 int get_dist( int x1, int y1, int x2, int y2 );
-- 
2.26.0

