1
0
mirror of git://projects.qi-hardware.com/openwrt-packages.git synced 2024-11-22 11:52:48 +02:00

new package: alex4: Alex the Allegator v4: Game-Boy style jump&n&run game

This commit is contained in:
David Kühling 2011-06-07 13:31:53 +02:00
parent 51707e8501
commit 51cbdda599
5 changed files with 401 additions and 0 deletions

91
alex4/Makefile Normal file
View File

@ -0,0 +1,91 @@
#
# Copyright (C) 2011 David Kuehling <dvdkhlng TA gmx TOD de>
#
# OpenWRT package for Alex the Allegotor v4 -- a game using liballegro
#
# License GPLv2 or later. NO WARRANTY.
include $(TOPDIR)/rules.mk
PKG_NAME:=alex4
PKG_VERSION:=4.0
PKG_RELEASE:=1
PKG_SOURCE:=alex4src_data.zip
PKG_SOURCE_URL:=@SF/allegator/Alex4/source%20and%20data/
PKG_MD5SUM:=c81b8e3813300a0cfbe828bcdff60fda
PKG_BUILD_DIR:=$(BUILD_DIR)/alex4src
PKG_BUILD_DEPENDS := libdumb
include $(INCLUDE_DIR)/package.mk
define Package/alex4/Default
SECTION:=games
CATEGORY:=Games
URL:=http://alex.sf.net
endef
define Package/alex4/Default/description
Alex the Allegotor is a series of games. Alex v4 is a jump&n run game.
endef
define Package/alex4
$(call Package/alex4/Default)
TITLE += (the game)
DEPENDS:=+liballegro +alex4-data
endef
define Package/alex4/description
$(call Package/alex4/Default/description)
This package contains the executable files
endef
define Package/alex4-data
$(call Package/alex4/Default)
TITLE += (data)
DEPENDS:=+alex4
endef
define Package/alex4-data/description
$(call Package/alex4/Default/description)
This package contains the data files for Alex v4.
endef
#TARGET_LDFLAGS += -Wl,-rpath-link -Wl,$(STAGING_DIR)/usr/lib
#TARGET_CPPFLAGS +=
TARGET_LDFLAGS += -L$(STAGING_DIR)/usr/lib -laldmb -ldumb -lalleg
define Build/Configure
endef
define Build/Compile
cd $(PKG_BUILD_DIR)/src && \
$(TARGET_CC) $(TARGET_CFLAGS) $(EXTRA_CFLAGS) $(TARGET_CPPFLAGS) *.c $(TARGET_LDFLAGS) -o alex4
endef
define Package/alex4/install
$(INSTALL_DIR) $(1)/usr/bin
$(INSTALL_DIR) $(1)/etc
$(CP) $(PKG_BUILD_DIR)/src/alex4 $(1)/usr/bin/
$(CP) ./files/alex4.ini $(1)/etc/
endef
define Package/alex4-data/install
$(INSTALL_DIR) $(1)/usr/share/alex4
$(CP) $(PKG_BUILD_DIR)/data/*.dat $(1)/usr/share/alex4
endef
$(eval $(call BuildPackage,alex4))
$(eval $(call BuildPackage,alex4-data))
# The following comments configure the Emacs editor. Just ignore them.
# Local Variables:
# compile-command: "make -C ~/h/src/qi/openwrt-xburst package/alex4/compile -j2 V=99"
# End:

92
alex4/files/alex4.ini Normal file
View File

@ -0,0 +1,92 @@
##############################################################
#
# Configuration file for Alex 4 (v1.1)
#
##############################################################
#
# If you lose control of the contents of this file
# and wants to restore to the defaults, you will have
# to reinstall the game. Conclusion: Handle with care!
#
##############################################################
[graphics]
# controls the startup resolution
# Setting lower resolutions than 160x120 might result in
# weird undocumented side affects in the rendering.
# start in full screen or not (1 = fullscreen, 0 = windowed)
fullscreen = 1
# fullscreen width and height (used if fullscreen = 1)
f_width = 320
f_height = 240
# window width and height (used if fullscreen = 0)
w_width = 320
w_height = 240
# turns vertical sync on or off (1 = on, 0 = off)
vsync = 0
[sound]
# these options controls the sound and music
# controls what sound and mixing device to use
# 0 = no sound whatsoever
# 1 = autodetect sound device
# 2 = use DirectSound device with direct mixing
# 3 = use DirectSound device with Allegro mixing
sound_device = 1
# controls the volume of the samples (0-255 (0 = no sound))
sample_volume = 50
# controls the volume of the music (0-255 (0 = no music))
music_volume = 120
# use the sound datafile or not (0 = no, 1 = yes)
use_sound_datafile = 1
# if use_sound_datafile is set to 0
# this should point to where the
# sounds can be loaded from
sfx_path = sfx/22KHz
##############################################################
# DUMB (mod control)
##############################################################
# You can edit this section to control the playback quality of
# the music in Alex 4.
# dumb_resampling_quality can range from 0 (fastest) to 4 (best).
# dumb_it_max_to_mix is the maximum number of samples DUMB will render at a
# time.
# Increase buffer_size to combat stuttering.
# The module will be rendered at a sampling frequency specified by sound_freq.
# This variable is also used by Allegro for initialising the sound hardware.
# You can ignore the quality variable. Allegro uses it when relaying the audio
# stream to the sound card. 2 is the maximum, and is only comparable in quality
# to dumb_resampling_quality = 1. Only a masochist would reduce it.
[dumb]
dumb_resampling_quality = 4
dumb_it_max_to_mix = 256
buffer_size = 4096
sound_freq = 44100
quality = 2

View File

@ -0,0 +1,63 @@
This is from alex4src_data.zip directory 'extras'
Index: alex4src/src/main.c
===================================================================
--- alex4src.orig/src/main.c 2003-07-26 12:53:52.000000000 +0200
+++ alex4src/src/main.c 2011-06-06 22:51:43.000000000 +0200
@@ -840,6 +840,7 @@
i = DIGI_AUTODETECT;
log2file(" DIGI_AUTODETECT selected (%d)", i);
break;
+#ifdef ALLEGRO_WINDOWS
case 2:
i = DIGI_DIRECTX(0);
log2file(" DIGI_DIRECTX(0) selected (%d)", i);
@@ -848,6 +849,20 @@
i = DIGI_DIRECTAMX(0);
log2file(" DIGI_DIRECTAMX(0) selected (%d)", i);
break;
+#elif defined ALLEGRO_UNIX
+#ifdef DIGI_OSS
+ case 2:
+ i = DIGI_OSS;
+ log2file(" DIGI_OSS selected (%d)", i);
+ break;
+#endif
+#ifdef DIGI_ALSA
+ case 3:
+ i = DIGI_ALSA;
+ log2file(" DIGI_ALSA selected (%d)", i);
+ break;
+#endif
+#endif
default:
i = -770405; // dummy number
got_sound = 0;
Index: alex4src/src/main.h
===================================================================
--- alex4src.orig/src/main.h 2003-07-26 12:53:52.000000000 +0200
+++ alex4src/src/main.h 2011-06-06 22:51:43.000000000 +0200
@@ -90,8 +90,7 @@
// a little bounding box quickie
-#define check_bb_collision(x1,y1,w1,h1,x2,y2,w2,h2) (!( ((x1)>=(x2)+(w2)) || ((x2)>=(x1)+(w1)) || \
- ((y1)>=(y2)+(h2)) || ((y2)>=(y1)+(h1)) ))
+#define check_bb_collision(x1,y1,w1,h1,x2,y2,w2,h2) (!( ((x1)>=(x2)+(w2)) || ((x2)>=(x1)+(w1)) || ((y1)>=(y2)+(h2)) || ((y2)>=(y1)+(h1)) ))
#endif
\ No newline at end of file
Index: alex4src/src/shooter.c
===================================================================
--- alex4src.orig/src/shooter.c 2003-07-26 12:53:52.000000000 +0200
+++ alex4src/src/shooter.c 2011-06-06 22:51:43.000000000 +0200
@@ -239,8 +239,7 @@
// PIXEL PERFECT COLLISION ROUTINES COURTESY OF IVAN BALDO'S PPCOL
-#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)) ))
+#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)) ))
#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)
int s_check_pp_collision(BITMAP *spr1, BITMAP *spr2, int x1, int y1, int x2, int y2) {

View File

@ -0,0 +1,50 @@
Index: alex4src/src/main.c
===================================================================
--- alex4src.orig/src/main.c 2011-06-07 11:43:11.000000000 +0200
+++ alex4src/src/main.c 2011-06-07 11:59:26.000000000 +0200
@@ -62,6 +62,7 @@
DATAFILE *maps = NULL;
DATAFILE *sfx_data = NULL;
BITMAP *swap_screen;
+BITMAP *colorconv_screen = 0;
PALETTE org_pal;
Tscroller hscroll;
Thisc *hisc_table;
@@ -484,9 +485,20 @@
// blits anything to screen
void blit_to_screen(BITMAP *bmp) {
+ if (!colorconv_screen ||
+ colorconv_screen->w != bmp->w || colorconv_screen->h != bmp->h)
+ {
+ if (colorconv_screen)
+ destroy_bitmap(colorconv_screen);
+
+ colorconv_screen = create_bitmap_ex(bitmap_color_depth(screen),
+ bmp->w, bmp->h);
+ }
+ blit (bmp, colorconv_screen, 0, 0, 0, 0, bmp->w, bmp->h);
+
acquire_screen();
if (options.use_vsync) vsync();
- stretch_blit(bmp, screen, 0, 0, bmp->w, bmp->h, 0, 0, SCREEN_W, SCREEN_H);
+ stretch_blit(colorconv_screen, screen, 0, 0, bmp->w, bmp->h, 0, 0, SCREEN_W, SCREEN_H);
release_screen();
}
@@ -674,6 +686,7 @@
log2file(" entering gfx mode set in alex4.ini (%dx%d %s)", w, h, (get_config_int("graphics", "fullscreen", 0) ? "full" : "win"));
+ set_color_depth(32);
if (set_gfx_mode(
(get_config_int("graphics", "fullscreen", 0) ? GFX_AUTODETECT_FULLSCREEN : GFX_AUTODETECT_WINDOWED),
w, h, 0, 0)) {
@@ -689,6 +702,7 @@
}
}
}
+ set_color_depth(8);
// show initial loading screen
clear(swap_screen);

View File

@ -0,0 +1,105 @@
Index: alex4src/src/main.c
===================================================================
--- alex4src.orig/src/main.c 2011-06-07 12:24:01.000000000 +0200
+++ alex4src/src/main.c 2011-06-07 13:15:30.000000000 +0200
@@ -157,7 +157,7 @@
va_list ptr; /* get an arg pointer */
FILE *fp;
- fp = fopen("log.txt", "at");
+ fp = fopen("/var/log/alex4.log", "at");
if (fp) {
/* initialize ptr to point to the first argument after the format string */
va_start(ptr, format);
@@ -637,7 +637,7 @@
log2file(" initializing allegro");
text_mode(-1);
garble_string(init_string, 53);
- set_config_file("alex4.ini");
+ set_config_file("/etc/alex4.ini");
set_window_close_button(FALSE);
// install timers
@@ -732,7 +732,7 @@
// load data
log2file(" loading data");
packfile_password(init_string);
- data = load_datafile("data/data.dat");
+ data = load_datafile("/usr/share/alex4/data.dat");
packfile_password(NULL);
if (data == NULL) {
log2file(" *** failed");
@@ -742,7 +742,7 @@
// load options
log2file(" loading options");
- pf = pack_fopen("alex4.sav", "rp");
+ pf = pack_fopen("/var/lib/alex4.sav", "rp");
if (pf) {
load_options(&options, pf);
pack_fclose(pf);
@@ -754,7 +754,7 @@
// loading highscores
log2file(" loading hiscores");
- pf = pack_fopen("alex4.hi", "rp");
+ pf = pack_fopen("/var/lib/alex4.hi", "rp");
if (pf) {
load_hisc_table(hisc_table, pf);
load_hisc_table(hisc_table_space, pf);
@@ -790,7 +790,7 @@
log2file(" loading original maps");
packfile_password(init_string);
num_levels = -1; // skip end object when counting
- maps = load_datafile_callback("data/maps.dat", count_maps_callback);
+ maps = load_datafile_callback("/usr/share/alex4/maps.dat", count_maps_callback);
packfile_password(NULL);
if (maps == NULL) {
log2file(" *** failed");
@@ -899,9 +899,9 @@
if (get_config_int("sound", "use_sound_datafile", 1)) {
log2file(" loading sound datafile");
packfile_password(init_string);
- sfx_data = load_datafile("data/sfx_44.dat");
+ sfx_data = load_datafile("/usr/share/alex4/sfx_44.dat");
if (sfx_data == NULL) {
- sfx_data = load_datafile("data/sfx_22.dat");
+ sfx_data = load_datafile("/usr/share/alex4/sfx_22.dat");
log2file(" sfx_44.dat not found");
s = 0;
}
@@ -1018,14 +1018,14 @@
// only save if everything was inited ok!
if (init_ok) {
log2file(" saving options");
- pf = pack_fopen("alex4.sav", "wp");
+ pf = pack_fopen("/var/lib/alex4.sav", "wp");
if (pf) {
save_options(&options, pf);
pack_fclose(pf);
}
log2file(" saving highscores");
- pf = pack_fopen("alex4.hi", "wp");
+ pf = pack_fopen("/var/lib/alex4.hi", "wp");
if (pf) {
save_hisc_table(hisc_table, pf);
save_hisc_table(hisc_table_space, pf);
@@ -1372,7 +1372,7 @@
if (space) {
// get space bg
packfile_password(init_string);
- df = load_datafile_object("data/a45.dat", "BG1");
+ df = load_datafile_object("/usr/share/alex4/a45.dat", "BG1");
packfile_password(NULL);
if (df != NULL) {
bg = df->dat;
@@ -3008,7 +3008,7 @@
// get working directory
get_executable_name(full_path, 1024);
replace_filename(working_directory, full_path, "", 1024);
- chdir(working_directory);
+ /* chdir(working_directory); */
// start logfile