Date:2011-06-07 13:31:53 (12 years 9 months ago)
Author:David Kühling
Commit:51cbdda5992c93b971fbf6c517103ced02737030
Message:new package: alex4: Alex the Allegator v4: Game-Boy style jump&n&run game

Files: alex4/Makefile (1 diff)
alex4/files/alex4.ini (1 diff)
alex4/patches/010-alex4-unix.patch (1 diff)
alex4/patches/020-gfx-mode.patch (1 diff)
alex4/patches/030-files-n-paths.patch (1 diff)

Change Details

alex4/Makefile
1#
2# Copyright (C) 2011 David Kuehling <dvdkhlng TA gmx TOD de>
3#
4# OpenWRT package for Alex the Allegotor v4 -- a game using liballegro
5#
6# License GPLv2 or later. NO WARRANTY.
7
8include $(TOPDIR)/rules.mk
9
10PKG_NAME:=alex4
11PKG_VERSION:=4.0
12PKG_RELEASE:=1
13PKG_SOURCE:=alex4src_data.zip
14PKG_SOURCE_URL:=@SF/allegator/Alex4/source%20and%20data/
15PKG_MD5SUM:=c81b8e3813300a0cfbe828bcdff60fda
16PKG_BUILD_DIR:=$(BUILD_DIR)/alex4src
17
18
19PKG_BUILD_DEPENDS := libdumb
20
21include $(INCLUDE_DIR)/package.mk
22
23define Package/alex4/Default
24  SECTION:=games
25  CATEGORY:=Games
26  URL:=http://alex.sf.net
27endef
28
29define Package/alex4/Default/description
30Alex the Allegotor is a series of games. Alex v4 is a jump&n run game.
31endef
32
33define Package/alex4
34$(call Package/alex4/Default)
35  TITLE += (the game)
36  DEPENDS:=+liballegro +alex4-data
37endef
38
39define Package/alex4/description
40$(call Package/alex4/Default/description)
41This package contains the executable files
42endef
43
44
45define Package/alex4-data
46$(call Package/alex4/Default)
47  TITLE += (data)
48  DEPENDS:=+alex4
49endef
50
51define Package/alex4-data/description
52 $(call Package/alex4/Default/description)
53This package contains the data files for Alex v4.
54endef
55
56#TARGET_LDFLAGS += -Wl,-rpath-link -Wl,$(STAGING_DIR)/usr/lib
57#TARGET_CPPFLAGS +=
58
59TARGET_LDFLAGS += -L$(STAGING_DIR)/usr/lib -laldmb -ldumb -lalleg
60
61
62
63define Build/Configure
64endef
65
66define Build/Compile
67    cd $(PKG_BUILD_DIR)/src && \
68        $(TARGET_CC) $(TARGET_CFLAGS) $(EXTRA_CFLAGS) $(TARGET_CPPFLAGS) *.c $(TARGET_LDFLAGS) -o alex4
69endef
70
71define Package/alex4/install
72    $(INSTALL_DIR) $(1)/usr/bin
73    $(INSTALL_DIR) $(1)/etc
74    $(CP) $(PKG_BUILD_DIR)/src/alex4 $(1)/usr/bin/
75    $(CP) ./files/alex4.ini $(1)/etc/
76endef
77
78
79define Package/alex4-data/install
80    $(INSTALL_DIR) $(1)/usr/share/alex4
81    $(CP) $(PKG_BUILD_DIR)/data/*.dat $(1)/usr/share/alex4
82endef
83
84$(eval $(call BuildPackage,alex4))
85$(eval $(call BuildPackage,alex4-data))
86
87
88# The following comments configure the Emacs editor. Just ignore them.
89# Local Variables:
90# compile-command: "make -C ~/h/src/qi/openwrt-xburst package/alex4/compile -j2 V=99"
91# End:
alex4/files/alex4.ini
1##############################################################
2#
3# Configuration file for Alex 4 (v1.1)
4#
5##############################################################
6#
7# If you lose control of the contents of this file
8# and wants to restore to the defaults, you will have
9# to reinstall the game. Conclusion: Handle with care!
10#
11##############################################################
12
13[graphics]
14# controls the startup resolution
15# Setting lower resolutions than 160x120 might result in
16# weird undocumented side affects in the rendering.
17
18# start in full screen or not (1 = fullscreen, 0 = windowed)
19fullscreen = 1
20
21# fullscreen width and height (used if fullscreen = 1)
22f_width = 320
23f_height = 240
24
25# window width and height (used if fullscreen = 0)
26w_width = 320
27w_height = 240
28
29# turns vertical sync on or off (1 = on, 0 = off)
30vsync = 0
31
32
33[sound]
34# these options controls the sound and music
35
36# controls what sound and mixing device to use
37# 0 = no sound whatsoever
38# 1 = autodetect sound device
39# 2 = use DirectSound device with direct mixing
40# 3 = use DirectSound device with Allegro mixing
41sound_device = 1
42
43# controls the volume of the samples (0-255 (0 = no sound))
44sample_volume = 50
45
46# controls the volume of the music (0-255 (0 = no music))
47music_volume = 120
48
49# use the sound datafile or not (0 = no, 1 = yes)
50use_sound_datafile = 1
51
52# if use_sound_datafile is set to 0
53# this should point to where the
54# sounds can be loaded from
55sfx_path = sfx/22KHz
56
57
58
59
60
61
62
63
64
65##############################################################
66# DUMB (mod control)
67##############################################################
68# You can edit this section to control the playback quality of
69# the music in Alex 4.
70
71# dumb_resampling_quality can range from 0 (fastest) to 4 (best).
72
73# dumb_it_max_to_mix is the maximum number of samples DUMB will render at a
74# time.
75
76# Increase buffer_size to combat stuttering.
77
78# The module will be rendered at a sampling frequency specified by sound_freq.
79# This variable is also used by Allegro for initialising the sound hardware.
80
81# You can ignore the quality variable. Allegro uses it when relaying the audio
82# stream to the sound card. 2 is the maximum, and is only comparable in quality
83# to dumb_resampling_quality = 1. Only a masochist would reduce it.
84
85[dumb]
86dumb_resampling_quality = 4
87dumb_it_max_to_mix = 256
88buffer_size = 4096
89sound_freq = 44100
90
91quality = 2
92
alex4/patches/010-alex4-unix.patch
1This is from alex4src_data.zip directory 'extras'
2Index: alex4src/src/main.c
3===================================================================
4--- alex4src.orig/src/main.c 2003-07-26 12:53:52.000000000 +0200
5@@ -840,6 +840,7 @@
6             i = DIGI_AUTODETECT;
7             log2file(" DIGI_AUTODETECT selected (%d)", i);
8             break;
9+#ifdef ALLEGRO_WINDOWS
10         case 2:
11             i = DIGI_DIRECTX(0);
12             log2file(" DIGI_DIRECTX(0) selected (%d)", i);
13@@ -848,6 +849,20 @@
14             i = DIGI_DIRECTAMX(0);
15             log2file(" DIGI_DIRECTAMX(0) selected (%d)", i);
16             break;
17+#elif defined ALLEGRO_UNIX
18+#ifdef DIGI_OSS
19+ case 2:
20+ i = DIGI_OSS;
21+ log2file(" DIGI_OSS selected (%d)", i);
22+ break;
23+#endif
24+#ifdef DIGI_ALSA
25+ case 3:
26+ i = DIGI_ALSA;
27+ log2file(" DIGI_ALSA selected (%d)", i);
28+ break;
29+#endif
30+#endif
31         default:
32             i = -770405; // dummy number
33             got_sound = 0;
34Index: alex4src/src/main.h
35===================================================================
36--- alex4src.orig/src/main.h 2003-07-26 12:53:52.000000000 +0200
37@@ -90,8 +90,7 @@
38
39
40 // a little bounding box quickie
41-#define check_bb_collision(x1,y1,w1,h1,x2,y2,w2,h2) (!( ((x1)>=(x2)+(w2)) || ((x2)>=(x1)+(w1)) || \
42- ((y1)>=(y2)+(h2)) || ((y2)>=(y1)+(h1)) ))
43+#define check_bb_collision(x1,y1,w1,h1,x2,y2,w2,h2) (!( ((x1)>=(x2)+(w2)) || ((x2)>=(x1)+(w1)) || ((y1)>=(y2)+(h2)) || ((y2)>=(y1)+(h1)) ))
44
45
46 #endif
47\ No newline at end of file
48Index: alex4src/src/shooter.c
49===================================================================
50--- alex4src.orig/src/shooter.c 2003-07-26 12:53:52.000000000 +0200
51@@ -239,8 +239,7 @@
52
53 // PIXEL PERFECT COLLISION ROUTINES COURTESY OF IVAN BALDO'S PPCOL
54
55-#define pp_check_bb_collision_general(x1,y1,w1,h1,x2,y2,w2,h2) (!( ((x1)>=(x2)+(w2)) || ((x2)>=(x1)+(w1)) || \
56- ((y1)>=(y2)+(h2)) || ((y2)>=(y1)+(h1)) ))
57+#define pp_check_bb_collision_general(x1,y1,w1,h1,x2,y2,w2,h2) (!( ((x1)>=(x2)+(w2)) || ((x2)>=(x1)+(w1)) || ((y1)>=(y2)+(h2)) || ((y2)>=(y1)+(h1)) ))
58 #define pp_check_bb_collision(mask1,mask2,x1,y1,x2,y2) pp_check_bb_collision_general(x1,y1,mask1->w,mask1->h,x2,y2,mask2->w,mask2->h)
59
60 int s_check_pp_collision(BITMAP *spr1, BITMAP *spr2, int x1, int y1, int x2, int y2) {
alex4/patches/020-gfx-mode.patch
1Index: alex4src/src/main.c
2===================================================================
3--- alex4src.orig/src/main.c 2011-06-07 11:43:11.000000000 +0200
4@@ -62,6 +62,7 @@
5 DATAFILE *maps = NULL;
6 DATAFILE *sfx_data = NULL;
7 BITMAP *swap_screen;
8+BITMAP *colorconv_screen = 0;
9 PALETTE org_pal;
10 Tscroller hscroll;
11 Thisc *hisc_table;
12@@ -484,9 +485,20 @@
13
14 // blits anything to screen
15 void blit_to_screen(BITMAP *bmp) {
16+ if (!colorconv_screen ||
17+ colorconv_screen->w != bmp->w || colorconv_screen->h != bmp->h)
18+ {
19+ if (colorconv_screen)
20+ destroy_bitmap(colorconv_screen);
21+
22+ colorconv_screen = create_bitmap_ex(bitmap_color_depth(screen),
23+ bmp->w, bmp->h);
24+ }
25+ blit (bmp, colorconv_screen, 0, 0, 0, 0, bmp->w, bmp->h);
26+
27     acquire_screen();
28     if (options.use_vsync) vsync();
29- stretch_blit(bmp, screen, 0, 0, bmp->w, bmp->h, 0, 0, SCREEN_W, SCREEN_H);
30+ stretch_blit(colorconv_screen, screen, 0, 0, bmp->w, bmp->h, 0, 0, SCREEN_W, SCREEN_H);
31     release_screen();
32 }
33
34@@ -674,6 +686,7 @@
35
36     log2file(" entering gfx mode set in alex4.ini (%dx%d %s)", w, h, (get_config_int("graphics", "fullscreen", 0) ? "full" : "win"));
37
38+ set_color_depth(32);
39     if (set_gfx_mode(
40         (get_config_int("graphics", "fullscreen", 0) ? GFX_AUTODETECT_FULLSCREEN : GFX_AUTODETECT_WINDOWED),
41         w, h, 0, 0)) {
42@@ -689,6 +702,7 @@
43             }
44         }
45     }
46+ set_color_depth(8);
47
48     // show initial loading screen
49     clear(swap_screen);
alex4/patches/030-files-n-paths.patch
1Index: alex4src/src/main.c
2===================================================================
3--- alex4src.orig/src/main.c 2011-06-07 12:24:01.000000000 +0200
4@@ -157,7 +157,7 @@
5     va_list ptr; /* get an arg pointer */
6      FILE *fp;
7
8- fp = fopen("log.txt", "at");
9+ fp = fopen("/var/log/alex4.log", "at");
10     if (fp) {
11         /* initialize ptr to point to the first argument after the format string */
12         va_start(ptr, format);
13@@ -637,7 +637,7 @@
14     log2file(" initializing allegro");
15     text_mode(-1);
16     garble_string(init_string, 53);
17- set_config_file("alex4.ini");
18+ set_config_file("/etc/alex4.ini");
19     set_window_close_button(FALSE);
20
21     // install timers
22@@ -732,7 +732,7 @@
23     // load data
24     log2file(" loading data");
25     packfile_password(init_string);
26- data = load_datafile("data/data.dat");
27+ data = load_datafile("/usr/share/alex4/data.dat");
28     packfile_password(NULL);
29     if (data == NULL) {
30         log2file(" *** failed");
31@@ -742,7 +742,7 @@
32
33     // load options
34     log2file(" loading options");
35- pf = pack_fopen("alex4.sav", "rp");
36+ pf = pack_fopen("/var/lib/alex4.sav", "rp");
37     if (pf) {
38         load_options(&options, pf);
39         pack_fclose(pf);
40@@ -754,7 +754,7 @@
41
42     // loading highscores
43     log2file(" loading hiscores");
44- pf = pack_fopen("alex4.hi", "rp");
45+ pf = pack_fopen("/var/lib/alex4.hi", "rp");
46     if (pf) {
47         load_hisc_table(hisc_table, pf);
48         load_hisc_table(hisc_table_space, pf);
49@@ -790,7 +790,7 @@
50         log2file(" loading original maps");
51         packfile_password(init_string);
52         num_levels = -1; // skip end object when counting
53- maps = load_datafile_callback("data/maps.dat", count_maps_callback);
54+ maps = load_datafile_callback("/usr/share/alex4/maps.dat", count_maps_callback);
55         packfile_password(NULL);
56         if (maps == NULL) {
57             log2file(" *** failed");
58@@ -899,9 +899,9 @@
59         if (get_config_int("sound", "use_sound_datafile", 1)) {
60             log2file(" loading sound datafile");
61             packfile_password(init_string);
62- sfx_data = load_datafile("data/sfx_44.dat");
63+ sfx_data = load_datafile("/usr/share/alex4/sfx_44.dat");
64             if (sfx_data == NULL) {
65- sfx_data = load_datafile("data/sfx_22.dat");
66+ sfx_data = load_datafile("/usr/share/alex4/sfx_22.dat");
67                 log2file(" sfx_44.dat not found");
68                 s = 0;
69             }
70@@ -1018,14 +1018,14 @@
71     // only save if everything was inited ok!
72     if (init_ok) {
73         log2file(" saving options");
74- pf = pack_fopen("alex4.sav", "wp");
75+ pf = pack_fopen("/var/lib/alex4.sav", "wp");
76         if (pf) {
77             save_options(&options, pf);
78             pack_fclose(pf);
79         }
80
81         log2file(" saving highscores");
82- pf = pack_fopen("alex4.hi", "wp");
83+ pf = pack_fopen("/var/lib/alex4.hi", "wp");
84         if (pf) {
85             save_hisc_table(hisc_table, pf);
86             save_hisc_table(hisc_table_space, pf);
87@@ -1372,7 +1372,7 @@
88     if (space) {
89         // get space bg
90         packfile_password(init_string);
91- df = load_datafile_object("data/a45.dat", "BG1");
92+ df = load_datafile_object("/usr/share/alex4/a45.dat", "BG1");
93         packfile_password(NULL);
94         if (df != NULL) {
95             bg = df->dat;
96@@ -3008,7 +3008,7 @@
97     // get working directory
98     get_executable_name(full_path, 1024);
99     replace_filename(working_directory, full_path, "", 1024);
100- chdir(working_directory);
101+ /* chdir(working_directory); */
102
103
104     // start logfile

Archive Download the corresponding diff file



interactive