diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..a67fe91 --- /dev/null +++ b/.gitignore @@ -0,0 +1,5 @@ +*.o +*.d +*.lha +blues +Crashlog* diff --git a/Makefile b/Makefile old mode 100644 new mode 100755 diff --git a/Makefile.os4 b/Makefile.os4 new file mode 100644 index 0000000..5dcf8e4 --- /dev/null +++ b/Makefile.os4 @@ -0,0 +1,62 @@ + +SDL_CFLAGS := -D__USE_INLINE__ -I/sdk/local/newlib/include/SDL2 +SDL_LIBS := -lSDL2_mixer -lmikmod -lmodplug -lFLAC -logg -lSDL2 -lpthread -athread=native -lstdc++ + +MODPLUG_LIBS ?= + +BB := decode.c game.c level.c objects.c resource.c screen.c sound.c staticres.c tiles.c unpack.c +JA := game.c level.c resource.c screen.c sound.c staticres.c unpack.c +P2 := bosses.c game.c level.c monsters.c resource.c screen.c sound.c staticres.c unpack.c + +BB_SRCS := $(foreach f,$(BB),bb/$f) +JA_SRCS := $(foreach f,$(JA),ja/$f) +P2_SRCS := $(foreach f,$(P2),p2/$f) +SRCS := $(BB_SRCS) $(JA_SRCS) $(P2_SRCS) +OBJS := $(SRCS:.c=.o) +DEPS := $(SRCS:.c=.d) + +CPPFLAGS += -O2 -Wall -Wextra -Wno-unused-parameter -Wno-sign-compare -Wpedantic -MMD $(SDL_CFLAGS) -I. -g + +all: blues + +game_bb.o: CPPFLAGS += -fvisibility=hidden + +game_bb.o: $(BB_SRCS:.c=.o) + ld -r -o $@ $^ + objcopy --localize-hidden $@ + +game_ja.o: CPPFLAGS += -fvisibility=hidden + +game_ja.o: $(JA_SRCS:.c=.o) + ld -r -o $@ $^ + objcopy --localize-hidden $@ + +game_p2.o: CPPFLAGS += -fvisibility=hidden + +game_p2.o: $(P2_SRCS:.c=.o) + ld -r -o $@ $^ + objcopy --localize-hidden $@ + +blues: main.o mixer.o sys_sdl2.o util.o game_bb.o game_ja.o game_p2.o + $(CC) $(LDFLAGS) -o $@ $^ $(SDL_LIBS) $(MODPLUG_LIBS) + +clean: + rm -f $(OBJS) $(DEPS) *.o *.d + +-include $(DEPS) + + +# prepare an archive for the program +release: + @echo "Creating release files..." + @strip blues + @mkdir -p release/blues + @copy ALL release_files/ release/blues/ QUIET + @copy blues "release/blues/Blues Brothers/" + @copy blues "release/blues/Jukebox Adventure/" + @copy blues "release/blues/Prehistorik 2/" + @copy README.md release/blues/ + @echo "Creating release archive..." + @lha -aeqr3 a blues.lha release/ + @echo "Clean release files..." + @delete release ALL QUIET FORCE diff --git a/README.md b/README.md old mode 100644 new mode 100755 diff --git a/bb/decode.c b/bb/decode.c old mode 100644 new mode 100755 diff --git a/bb/decode.h b/bb/decode.h old mode 100644 new mode 100755 diff --git a/bb/game.c b/bb/game.c old mode 100644 new mode 100755 diff --git a/bb/game.h b/bb/game.h old mode 100644 new mode 100755 diff --git a/bb/level.c b/bb/level.c old mode 100644 new mode 100755 diff --git a/bb/objects.c b/bb/objects.c old mode 100644 new mode 100755 diff --git a/bb/resource.c b/bb/resource.c index 9d9022e..7d5fa89 100644 --- a/bb/resource.c +++ b/bb/resource.c @@ -1,4 +1,8 @@ +#if defined(__amigaos4__) +#include +#endif + #include "resource.h" #include "sys.h" #include "unpack.h" diff --git a/bb/resource.h b/bb/resource.h old mode 100644 new mode 100755 diff --git a/bb/screen.c b/bb/screen.c old mode 100644 new mode 100755 diff --git a/bb/sound.c b/bb/sound.c old mode 100644 new mode 100755 diff --git a/bb/staticres.c b/bb/staticres.c old mode 100644 new mode 100755 diff --git a/bb/tiles.c b/bb/tiles.c old mode 100644 new mode 100755 diff --git a/bb/unpack.c b/bb/unpack.c old mode 100644 new mode 100755 diff --git a/bb/unpack.h b/bb/unpack.h old mode 100644 new mode 100755 diff --git a/bbja1.png b/bbja1.png old mode 100644 new mode 100755 diff --git a/bbja2.png b/bbja2.png old mode 100644 new mode 100755 diff --git a/blues1.png b/blues1.png old mode 100644 new mode 100755 diff --git a/blues2.png b/blues2.png old mode 100644 new mode 100755 diff --git a/intern.h b/intern.h old mode 100644 new mode 100755 diff --git a/ja/game.c b/ja/game.c old mode 100644 new mode 100755 diff --git a/ja/game.h b/ja/game.h old mode 100644 new mode 100755 diff --git a/ja/level.c b/ja/level.c index c814095..2c34e3c 100644 --- a/ja/level.c +++ b/ja/level.c @@ -113,7 +113,7 @@ static uint8_t level_lookup_tile(uint8_t num) { static uint8_t level_get_tile(int offset) { if (offset < 0 || offset >= g_vars.tilemap_w * g_vars.tilemap_h) { - print_warning("Invalid tilemap offset %d", offset); + // print_warning("Invalid tilemap offset %d", offset); return 0; } int num = g_vars.tilemap_data[offset]; @@ -2434,7 +2434,7 @@ static void level_tile_func_5f16(struct object_t *obj, int bp) { level_tile_func_5e83(obj, bp); } else { if (obj != &g_vars.players_table[0].obj) { - print_warning("Unexpected object #%d spr %d on tile 5f16", obj - g_vars.objects_table, obj->spr_num); + // print_warning("Unexpected object #%d spr %d on tile 5f16", obj - g_vars.objects_table, obj->spr_num); return; } player_flags2(obj) &= ~2; diff --git a/ja/resource.c b/ja/resource.c index 3504cb1..b2b8f48 100644 --- a/ja/resource.c +++ b/ja/resource.c @@ -1,4 +1,8 @@ +#if defined(__amigaos4__) +#include +#endif + #include #include "resource.h" #include "unpack.h" diff --git a/ja/resource.h b/ja/resource.h old mode 100644 new mode 100755 diff --git a/ja/screen.c b/ja/screen.c old mode 100644 new mode 100755 diff --git a/ja/sound.c b/ja/sound.c old mode 100644 new mode 100755 diff --git a/ja/staticres.c b/ja/staticres.c old mode 100644 new mode 100755 diff --git a/ja/unpack.c b/ja/unpack.c old mode 100644 new mode 100755 diff --git a/ja/unpack.h b/ja/unpack.h old mode 100644 new mode 100755 diff --git a/main.c b/main.c index d9ff767..98064bd 100644 --- a/main.c +++ b/main.c @@ -7,7 +7,17 @@ struct options_t g_options; +#if defined(__amigaos4__) +#define USED __attribute__((used)) +#define VSTRING "Blues 1.0.0r1 (04.08.2023)" +#define VERSTAG "\0$VER: " VSTRING +static const char *stack USED = "$STACK:102400"; +static const char *version USED = VERSTAG; + +static const char *DEFAULT_DATA_PATH = "PROGDIR:data"; +#else static const char *DEFAULT_DATA_PATH = "."; +#endif static const int DEFAULT_SCALE_FACTOR = 2; diff --git a/mixer.c b/mixer.c old mode 100644 new mode 100755 diff --git a/mixer.h b/mixer.h old mode 100644 new mode 100755 diff --git a/p2/bosses.c b/p2/bosses.c old mode 100644 new mode 100755 diff --git a/p2/game.c b/p2/game.c old mode 100644 new mode 100755 diff --git a/p2/game.h b/p2/game.h old mode 100644 new mode 100755 diff --git a/p2/level.c b/p2/level.c old mode 100644 new mode 100755 diff --git a/p2/monsters.c b/p2/monsters.c old mode 100644 new mode 100755 diff --git a/p2/resource.c b/p2/resource.c old mode 100644 new mode 100755 diff --git a/p2/resource.h b/p2/resource.h old mode 100644 new mode 100755 diff --git a/p2/screen.c b/p2/screen.c old mode 100644 new mode 100755 diff --git a/p2/sound.c b/p2/sound.c old mode 100644 new mode 100755 diff --git a/p2/staticres.c b/p2/staticres.c old mode 100644 new mode 100755 diff --git a/p2/unpack.c b/p2/unpack.c old mode 100644 new mode 100755 diff --git a/p2/unpack.h b/p2/unpack.h old mode 100644 new mode 100755 diff --git a/release_files/Blues Brothers.info b/release_files/Blues Brothers.info new file mode 100644 index 0000000..80d5086 Binary files /dev/null and b/release_files/Blues Brothers.info differ diff --git a/release_files/Blues Brothers/Blues Brothers b/release_files/Blues Brothers/Blues Brothers new file mode 100755 index 0000000..5647bba --- /dev/null +++ b/release_files/Blues Brothers/Blues Brothers @@ -0,0 +1 @@ +Run >NIL: blues --scale=3 \ No newline at end of file diff --git a/release_files/Blues Brothers/Blues Brothers.info b/release_files/Blues Brothers/Blues Brothers.info new file mode 100644 index 0000000..da8793a Binary files /dev/null and b/release_files/Blues Brothers/Blues Brothers.info differ diff --git a/release_files/Jukebox Adventure.info b/release_files/Jukebox Adventure.info new file mode 100644 index 0000000..1265522 Binary files /dev/null and b/release_files/Jukebox Adventure.info differ diff --git a/release_files/Jukebox Adventure/Jukebox Adventure b/release_files/Jukebox Adventure/Jukebox Adventure new file mode 100755 index 0000000..5647bba --- /dev/null +++ b/release_files/Jukebox Adventure/Jukebox Adventure @@ -0,0 +1 @@ +Run >NIL: blues --scale=3 \ No newline at end of file diff --git a/release_files/Jukebox Adventure/Jukebox Adventure.info b/release_files/Jukebox Adventure/Jukebox Adventure.info new file mode 100644 index 0000000..7cb56ec Binary files /dev/null and b/release_files/Jukebox Adventure/Jukebox Adventure.info differ diff --git a/release_files/Prehistorik 2.info b/release_files/Prehistorik 2.info new file mode 100644 index 0000000..b972922 Binary files /dev/null and b/release_files/Prehistorik 2.info differ diff --git a/release_files/Prehistorik 2/Prehistorik 2 b/release_files/Prehistorik 2/Prehistorik 2 new file mode 100755 index 0000000..5647bba --- /dev/null +++ b/release_files/Prehistorik 2/Prehistorik 2 @@ -0,0 +1 @@ +Run >NIL: blues --scale=3 \ No newline at end of file diff --git a/release_files/Prehistorik 2/Prehistorik 2.info b/release_files/Prehistorik 2/Prehistorik 2.info new file mode 100644 index 0000000..041f24b Binary files /dev/null and b/release_files/Prehistorik 2/Prehistorik 2.info differ diff --git a/release_files/README_Amiga.md b/release_files/README_Amiga.md new file mode 100644 index 0000000..5768c64 --- /dev/null +++ b/release_files/README_Amiga.md @@ -0,0 +1,94 @@ +# blues for AmigaOS 4.1 FE + +blues is a game engine developed by Gregory Montoir and found at his +GitHub repository (https://github.com/cyxx/blues) + +This engine supports three games developed by Titus Interactive, +which are the "Blues Brothers", the "Blues Brothers: Jukebox Adventure" +and the "Prehistorik 2" + +## Installation + +Extract the archive wherever you want. There are three folders, one +for each game. In these folders there is the executable and a *data* +folder where you need to copy the data files for each game. +Please read below for more info about these files. + +### Blues Brothers + +The data files of the Amiga or DOS version, full game or +demo (https://archive.org/details/TheBluesBrothers_1020), are +required. + +``` +*.BIN, *.CK1, *.CK2, *.SQL, *.SQV, *.SQZ +``` + +For sounds and music, the Amiga version files or the +ExoticA (https://www.exotica.org.uk/wiki/The_Blues_Brothers) set +need to be copied. + +### Jukebox Adventure + +The data files of the DOS version are required. + +``` +*.EAT, *.MOD +``` + +### Prehistorik 2 + +The data files of the DOS version, full game or +demo (http://cd.textfiles.com/ccbcurrsh1/demos/pre2.zip), are +required. + +``` +*.SQZ, *.TRK +``` + +## Usage + +``` +Usage: blues [OPTIONS]... + --datapath=PATH Path to data files (default '.') + --level=NUM Start at level NUM + --cheats=MASK Cheats bitmask + --startpos=XxY Start at position (X,Y) + --fullscreen Enable fullscreen + --scale=N Graphics scaling factor (default 2) + --filter=NAME Graphics scaling filter (default 'nearest') + --screensize=WxH Graphics screen size (default 320x200) + --cga Enable CGA colors + --dosscroll Enable DOS style screen scrolling + --hybrid Enable fuchsia color as in Hybrid crack +``` + +## I would like to thank + +- Gregory Montoir for creating this awesome engine and open sourcing it +- Capehill for his tireless work on SDL port for AmigaOS 4.1 FE + +## Support + +If you enjoy what I am doing and would like to keep me up during the night, +please consider to buy me a coffee at: +https://ko-fi.com/walkero + +## Known issues + +- Please avoid using the fullscreen because some times it breaks + the game in some situations. Prefer to use --scale +- By default the game loads the data files from the data folder. + It is not tested if those are in a different place and it might fail +- If you have problems in graphics (black screen, missing sprites) + try different SDL renderer in prefs + +You can find the known issues at +https://git.walkero.gr/walkero/blues + +# Changelog + +## [1.0.0r1] - 2023-08-04 +### Added +- First release for AmigaOS 4 + diff --git a/release_files/README_Amiga.md.info b/release_files/README_Amiga.md.info new file mode 100644 index 0000000..161ffce Binary files /dev/null and b/release_files/README_Amiga.md.info differ diff --git a/sys.h b/sys.h old mode 100644 new mode 100755 diff --git a/sys_psp.c b/sys_psp.c old mode 100644 new mode 100755 diff --git a/sys_sdl2.c b/sys_sdl2.c index 984864a..90c03ef 100644 --- a/sys_sdl2.c +++ b/sys_sdl2.c @@ -119,7 +119,7 @@ static void sdl2_set_screen_size(int w, int h, const char *caption, int scale, c } const int window_w = w * scale; const int window_h = h * scale; - const int flags = fullscreen ? SDL_WINDOW_FULLSCREEN_DESKTOP : SDL_WINDOW_RESIZABLE; + const int flags = fullscreen ? SDL_WINDOW_FULLSCREEN_DESKTOP : SDL_WINDOW_SHOWN; _window = SDL_CreateWindow(caption, SDL_WINDOWPOS_CENTERED, SDL_WINDOWPOS_CENTERED, window_w, window_h, flags); _renderer = SDL_CreateRenderer(_window, -1, 0); SDL_RenderSetLogicalSize(_renderer, w, h); @@ -647,7 +647,11 @@ static void sdl2_start_audio(sys_audio_cb callback, void *param) { SDL_AudioSpec desired; memset(&desired, 0, sizeof(desired)); desired.freq = SYS_AUDIO_FREQ; +#if defined(__amigaos4__) + desired.format = AUDIO_S16SYS; +#else desired.format = AUDIO_S16; +#endif desired.channels = 1; desired.samples = 2048; desired.callback = callback; diff --git a/util.h b/util.h old mode 100644 new mode 100755