mirror of
https://github.com/yann64/haikuports.git
synced 2026-05-06 15:08:57 +02:00
280 lines
8.5 KiB
Plaintext
280 lines
8.5 KiB
Plaintext
From d29fd19d5b7b22c21741b9d63155ac62f5916092 Mon Sep 17 00:00:00 2001
|
|
From: Victor Gamper <victor@wenzeslaus.de>
|
|
Date: Fri, 8 Jul 2022 03:50:46 +0200
|
|
Subject: Cleaned up the makefile to work again
|
|
|
|
|
|
diff --git a/src/Makefile b/src/Makefile
|
|
index 78dd5d4..20cf761 100644
|
|
--- a/src/Makefile
|
|
+++ b/src/Makefile
|
|
@@ -1,25 +1,16 @@
|
|
-SDL_LIBS = -static -L/mingw32/lib -lSDL_gfx -lSDL_image -lSDL_mixer -L/mingw32/lib -lvorbisfile -lvorbis -lmingw32 -lSDLmain -lSDL \
|
|
- -lbz2 -lharfbuzz -lglib-2.0 -lintl -liconv -ltiff -ljpeg -llzma -lpng16 -lstdc++ -lwebp -lwinpthread -lz -larchive -lwinmm -lgdi32 -ldxguid \
|
|
- -lasprintf -lcharset -lcrypto -lcurl -lexpat -lffi -lFLAC++ -lFLAC -lfontconfig -lformw -lfreeglut_static -lgdbm -lgettextlib -lgettextpo -lgif \
|
|
- -lgio-2.0 -lglew32 -lglew32mx -lgmodule-2.0 -lgmp -lgmpxx -lgnurx -lgnutls -lgnutlsxx -lgobject-2.0 -lgthread-2.0 -lhistory -lhogweed -lidn -lisl -ljansson \
|
|
- -ljsoncpp -llua -llzo2 -lmenuw -lmetalink -lminizip -lmpc -lmpfr -lncurses++w -lncursesw -lnettle -lnghttp2 -logg -lopenal -lpanelw -lphysfs -lpixman-1 \
|
|
- -lreadline -lregex -lrtmp -lssh2 -lssl -lsystre -ltasn1 -ltclstub86 -ltermcap -ltheora -ltheoradec -ltheoraenc \
|
|
- -ltkstub86 -ltre -lturbojpeg -lvorbisenc -lwebpdecoder -lwebpdemux -lwebpmux -lole32 -lws2_32 -mwindows
|
|
-
|
|
CFLAGS:= -g -O2 -Wall -Wno-unused $(OPTIONS)
|
|
|
|
CFLAGS += $(shell sdl-config --cflags) -Isprite -I. -Isupport -DINLINE=inline
|
|
-CFLAGS += -DLINUX
|
|
CFILES:= $(shell find . -name '*.c')
|
|
OBJECTS:= $(CFILES:.c=.o)
|
|
|
|
airstrike: $(OBJECTS)
|
|
-# $(CC) -o $@ $(CFLAGS) $(OBJECTS) `sdl-config --libs` -lSDL_image
|
|
- $(CC) -o $@ $(CFLAGS) $(OBJECTS) $(SDL_LIBS)
|
|
+ $(CC) -o $@ $(CFLAGS) $(OBJECTS) `sdl-config --libs` -lSDL_image
|
|
+# $(CC) -o $@ $(CFLAGS) $(OBJECTS) $(SDL_LIBS)
|
|
|
|
airstrike-sound: $(OBJECTS)
|
|
-# $(CC) -o $@ $(CFLAGS) $(OBJECTS) `sdl-config --libs` -lSDL_image -lSDL_mixer
|
|
- $(CC) -o $@ $(CFLAGS) $(OBJECTS) $(SDL_LIBS)
|
|
+ $(CC) -o $@ $(CFLAGS) $(OBJECTS) `sdl-config --libs` -lSDL_image -lSDL_mixer
|
|
+# $(CC) -o $@ $(CFLAGS) $(OBJECTS) $(SDL_LIBS)
|
|
|
|
# Use the rule below when coding new sprite types
|
|
#sprites_autogen.h: sprite_types/*.c
|
|
--
|
|
2.36.1
|
|
|
|
|
|
From ea638c5b9832e796881fca6d183aa130665ed517 Mon Sep 17 00:00:00 2001
|
|
From: Victor Gamper <victor@wenzeslaus.de>
|
|
Date: Fri, 8 Jul 2022 17:30:23 +0200
|
|
Subject: use the correct paths for Haiku
|
|
|
|
|
|
diff --git a/src/airstrike.c b/src/airstrike.c
|
|
index 20753f6..652d713 100644
|
|
--- a/src/airstrike.c
|
|
+++ b/src/airstrike.c
|
|
@@ -5,6 +5,11 @@
|
|
#pragma comment(lib, "SDL_image.lib")
|
|
#endif
|
|
|
|
+#ifdef __HAIKU__
|
|
+#include <FindDirectory.h>
|
|
+#include <fs_info.h>
|
|
+#endif
|
|
+
|
|
#include <string.h>
|
|
#include <assert.h>
|
|
#include <stdlib.h>
|
|
@@ -35,6 +40,9 @@ static int frame_time_i = 0;
|
|
static int screen_w;
|
|
static int screen_h;
|
|
|
|
+char* airstrikerc;
|
|
+char* airstrikerc_user;
|
|
+char* dataDir;
|
|
|
|
static void atexit_cleanup(void)
|
|
{
|
|
@@ -81,7 +89,7 @@ static int general_setup(void)
|
|
console_set_pos(9,254);
|
|
console_load_bg(path_to_data("console-bg.png"));
|
|
sprite_types_setup();
|
|
- sprite_background_load("data/bg.png","data/bgmask.png");
|
|
+ sprite_background_load(path_to_data("bg.png"), path_to_data("bgmask.png"));
|
|
|
|
level_setup();
|
|
winds_setup();
|
|
@@ -657,6 +665,26 @@ void saveanimframe()
|
|
|
|
int main(int argc, char *argv[])
|
|
{
|
|
+#ifdef __HAIKU__
|
|
+ dev_t vol = dev_for_path("/boot");
|
|
+ int fLen = sizeof("airstrikerc");
|
|
+ char buf[B_PATH_NAME_LENGTH + B_FILE_NAME_LENGTH];
|
|
+ find_directory(B_SYSTEM_DATA_DIRECTORY, vol, false, buf, sizeof(buf));strcat(buf, "/airstrike");
|
|
+ dataDir = malloc(strlen(buf));
|
|
+ strcpy(dataDir, buf);
|
|
+ airstrikerc = malloc(strlen(buf) + fLen);
|
|
+ strcpy(airstrikerc, buf);
|
|
+ strcat(airstrikerc, "/airstrikerc");
|
|
+ find_directory(B_USER_SETTINGS_DIRECTORY, vol, false, buf, sizeof(buf));
|
|
+ strcat(buf, "/airstrikerc");
|
|
+ airstrikerc_user = malloc(strlen(buf));
|
|
+ strcpy(airstrikerc_user, buf);
|
|
+#else
|
|
+ dataDir = "data";
|
|
+ airstrikerc = "data/airstrikerc";
|
|
+ airstrikerc_user = ".airstrikerc";
|
|
+#endif
|
|
+
|
|
int res;
|
|
if (argc > 1)
|
|
{
|
|
diff --git a/src/airstrike.h b/src/airstrike.h
|
|
index 3b64275..115789f 100644
|
|
--- a/src/airstrike.h
|
|
+++ b/src/airstrike.h
|
|
@@ -18,5 +18,8 @@ extern char *p2_name;
|
|
extern controller_t *p1_controller;
|
|
extern controller_t *p2_controller;
|
|
|
|
+extern char* airstrikerc;
|
|
+extern char* airstrikerc_user;
|
|
+extern char* dataDir;
|
|
|
|
#endif
|
|
diff --git a/src/config.c b/src/config.c
|
|
index 1abbad0..4cf0320 100644
|
|
--- a/src/config.c
|
|
+++ b/src/config.c
|
|
@@ -1,6 +1,7 @@
|
|
#include <string.h>
|
|
#include <stdlib.h>
|
|
#include <SDL.h>
|
|
+#include "airstrike.h"
|
|
#include "config.h"
|
|
#include "names.h"
|
|
|
|
@@ -10,9 +11,10 @@ static char *datapath;
|
|
int config_setup()
|
|
{
|
|
FILE *cfile;
|
|
- char cbuf[1024]; /* stupid, really */
|
|
+ char cbuf[2048]; /* stupid, really */
|
|
int got_file = 0;
|
|
- cfile = fopen(ROOT_CONFIG_FILE,"r");
|
|
+ sprintf(cbuf,"%s",airstrikerc);
|
|
+ cfile = fopen(cbuf,"r");
|
|
if (cfile)
|
|
{
|
|
nread_str(&config_user,cfile);
|
|
@@ -21,7 +23,11 @@ int config_setup()
|
|
}
|
|
if (getenv("HOME"))
|
|
{
|
|
- sprintf(cbuf,"%s/%s",getenv("HOME"),USER_CONFIG_FILE);
|
|
+#ifdef __HAIKU__
|
|
+ sprintf(cbuf,"%s",airstrikerc_user);
|
|
+#else
|
|
+ sprintf(cbuf,"%s/%s",getenv("HOME"),USER_CONFIG_FILE);
|
|
+#endif
|
|
cfile = fopen(cbuf,"r");
|
|
if (cfile)
|
|
{
|
|
@@ -35,12 +41,17 @@ int config_setup()
|
|
fprintf(stderr,"Looked for config files at '%s' and '$HOME/%s', but could not find any. Quitting.\n",ROOT_CONFIG_FILE,USER_CONFIG_FILE);
|
|
exit(EXIT_FAILURE);
|
|
}
|
|
+
|
|
+#ifdef __HAIKU__
|
|
+ datapath = dataDir;
|
|
+#else
|
|
datapath = cfgstr("datapath",0);
|
|
if (!datapath)
|
|
{
|
|
fprintf(stderr,"Cannot find datapath in config files. Quitting.\n");
|
|
exit(EXIT_FAILURE);
|
|
}
|
|
+#endif
|
|
return 0;
|
|
}
|
|
|
|
--
|
|
2.36.1
|
|
|
|
|
|
From fcefe4cfa6f6238eb1a27ca78f8bcc5ea8a11ad0 Mon Sep 17 00:00:00 2001
|
|
From: Victor Gamper <victor@wenzeslaus.de>
|
|
Date: Fri, 8 Jul 2022 20:39:07 +0200
|
|
Subject: airstrike: fix bombs
|
|
|
|
|
|
diff --git a/src/sprite_types/biplane.c b/src/sprite_types/biplane.c
|
|
index a23b589..40481e7 100644
|
|
--- a/src/sprite_types/biplane.c
|
|
+++ b/src/sprite_types/biplane.c
|
|
@@ -203,8 +203,9 @@ static void sigget(sprite_t *s, int signal, void *data)
|
|
break;
|
|
case SIGNAL_NUM0: /* create bomb */
|
|
if (sprite_timer_finished(((struct biplane*)s)->bomb_timer) &&
|
|
- (!(s->state & BIPLANE_CRASHING)))
|
|
+ (!(s->state & BIPLANE_CRASHING)) && (((struct biplane*)s)->nr_bombs > 0))
|
|
{
|
|
+ ((struct biplane*)s)->nr_bombs--;
|
|
p = sprite_create(&bomb);
|
|
p->anim_p = s->anim_p;
|
|
((mech_sprite_t *)p)->angle = ((mech_sprite_t *)s)->angle;
|
|
--
|
|
2.36.1
|
|
|
|
|
|
From 2e3478015559fc380d48b8265ababc79225424d9 Mon Sep 17 00:00:00 2001
|
|
From: Victor Gamper <victor@wenzeslaus.de>
|
|
Date: Fri, 8 Jul 2022 20:45:31 +0200
|
|
Subject: airstrike: fix for x86-64
|
|
|
|
This is pretty much copied from debian
|
|
SEE: https://sources.debian.org/patches/airstrike/0.99+1.0pre6a-10/fix-unusable-on-amd64.patch/
|
|
|
|
diff --git a/src/mech.c b/src/mech.c
|
|
index 2010088..fe83335 100644
|
|
--- a/src/mech.c
|
|
+++ b/src/mech.c
|
|
@@ -335,11 +335,10 @@ void mech_sprite_collide(sprite_t *s1, sprite_t *s2, int x, int y)
|
|
n[2]*((mech_sprite_t *)s1)->ang_vel +
|
|
n[3]*((mech_sprite_t *)s2)->ang_vel;
|
|
|
|
- if (a > 0)
|
|
- {
|
|
- b = n[0]*delta[0] + n[1]*delta[1] + n[2]*delta[2]
|
|
+ b = n[0]*delta[0] + n[1]*delta[1] + n[2]*delta[2]
|
|
- n[0]*delta[3] - n[1]*delta[4] + n[3]*delta[5];
|
|
-
|
|
+ if ( (a > 0) && (abs(b) > 0) )
|
|
+ {
|
|
c = -1.4*a/b;
|
|
|
|
s1->vel[0] += c*delta[0];
|
|
@@ -479,10 +478,9 @@ void mech_sprite_bg_collide(sprite_t *s1, int x, int y)
|
|
a = n[0]*s1->vel[0] + n[1]*s1->vel[1] +
|
|
n[2]*((mech_sprite_t *)s1)->ang_vel;
|
|
|
|
- if (a > 0)
|
|
+ b = n[0]*delta[0] + n[1]*delta[1] + n[2]*delta[2];
|
|
+ if ( (a > 0) && (abs(b) > 0) )
|
|
{
|
|
- b = n[0]*delta[0] + n[1]*delta[1] + n[2]*delta[2];
|
|
-
|
|
c = -1.2*a/b;
|
|
|
|
s1->vel[0] += c*delta[0];
|
|
--
|
|
2.36.1
|
|
|
|
|
|
From ae63790c6851a79ed211fbabfaec1531264f1b34 Mon Sep 17 00:00:00 2001
|
|
From: Victor Gamper <victor@wenzeslaus.de>
|
|
Date: Fri, 8 Jul 2022 21:29:17 +0200
|
|
Subject: airstrike: fix physics
|
|
|
|
|
|
diff --git a/src/airstrike.c b/src/airstrike.c
|
|
index 652d713..ea67017 100644
|
|
--- a/src/airstrike.c
|
|
+++ b/src/airstrike.c
|
|
@@ -89,7 +89,10 @@ static int general_setup(void)
|
|
console_set_pos(9,254);
|
|
console_load_bg(path_to_data("console-bg.png"));
|
|
sprite_types_setup();
|
|
- sprite_background_load(path_to_data("bg.png"), path_to_data("bgmask.png"));
|
|
+ char* tmp = path_to_data("bgmask.png");
|
|
+ char bgmask[strlen(tmp)];
|
|
+ strcpy(bgmask, tmp);
|
|
+ sprite_background_load(path_to_data("bg.png"), bgmask);
|
|
|
|
level_setup();
|
|
winds_setup();
|
|
--
|
|
2.36.1
|
|
|