From 102c3742487dba76ec72d5f56a2c3041344b2d68 Mon Sep 17 00:00:00 2001 From: Sebastian Leonhardt Date: Fri, 8 Jan 2016 01:05:36 +0100 Subject: added xrick game original xrick code by 'BigOrno' at: http://www.bigorno.net/xrick/ Rockbox port, plus bugfixes at: https://github.com/pierluigi-vicinanza/xrick Further changes: * Additonal fixes from g#3026 * Port to modern plugin API * Add Pluginlib keymap fallback * Support all >1bpp screens * Fix build warnings in miniz * Better error message when resources are missing Change-Id: Id83928bc2539901b0221692f65cbca41389c58e7 --- apps/plugins/xrick/data/img.c | 23 +++++++++++ apps/plugins/xrick/data/img.h | 39 ++++++++++++++++++ apps/plugins/xrick/data/pics.c | 29 +++++++++++++ apps/plugins/xrick/data/pics.h | 41 ++++++++++++++++++ apps/plugins/xrick/data/sounds.c | 44 ++++++++++++++++++++ apps/plugins/xrick/data/sounds.h | 87 +++++++++++++++++++++++++++++++++++++++ apps/plugins/xrick/data/sprites.c | 22 ++++++++++ apps/plugins/xrick/data/sprites.h | 70 +++++++++++++++++++++++++++++++ apps/plugins/xrick/data/tiles.c | 22 ++++++++++ apps/plugins/xrick/data/tiles.h | 70 +++++++++++++++++++++++++++++++ 10 files changed, 447 insertions(+) create mode 100644 apps/plugins/xrick/data/img.c create mode 100644 apps/plugins/xrick/data/img.h create mode 100644 apps/plugins/xrick/data/pics.c create mode 100644 apps/plugins/xrick/data/pics.h create mode 100644 apps/plugins/xrick/data/sounds.c create mode 100644 apps/plugins/xrick/data/sounds.h create mode 100644 apps/plugins/xrick/data/sprites.c create mode 100644 apps/plugins/xrick/data/sprites.h create mode 100644 apps/plugins/xrick/data/tiles.c create mode 100644 apps/plugins/xrick/data/tiles.h (limited to 'apps/plugins/xrick/data') diff --git a/apps/plugins/xrick/data/img.c b/apps/plugins/xrick/data/img.c new file mode 100644 index 0000000000..2226df3c48 --- /dev/null +++ b/apps/plugins/xrick/data/img.c @@ -0,0 +1,23 @@ +/* + * xrick/data/img.c + * + * Copyright (C) 2008-2014 Pierluigi Vicinanza. All rights reserved. + * + * The use and distribution terms for this software are contained in the file + * named README, which can be found in the root of this distribution. By + * using this software in any fashion, you are agreeing to be bound by the + * terms of this license. + * + * You must not remove this notice, or any other, from this software. + */ + +#include "xrick/data/img.h" + +#include /* NULL */ + +/* + * globals + */ +img_t *img_splash = NULL; + +/* eof */ diff --git a/apps/plugins/xrick/data/img.h b/apps/plugins/xrick/data/img.h new file mode 100644 index 0000000000..96952627f9 --- /dev/null +++ b/apps/plugins/xrick/data/img.h @@ -0,0 +1,39 @@ +/* + * xrick/data/img.h + * + * Copyright (C) 1998-2002 BigOrno (bigorno@bigorno.net). + * Copyright (C) 2008-2014 Pierluigi Vicinanza. + * All rights reserved. + * + * The use and distribution terms for this software are contained in the file + * named README, which can be found in the root of this distribution. By + * using this software in any fashion, you are agreeing to be bound by the + * terms of this license. + * + * You must not remove this notice, or any other, from this software. + */ + +#ifndef _IMG_H +#define _IMG_H + +#include "xrick/system/basic_types.h" + +typedef struct { + U8 r, g, b, nothing; +} img_color_t; + +typedef struct { + U16 width; + U16 height; + U16 xPos; + U16 yPos; + U16 ncolors; + img_color_t *colors; + U8 *pixels; +} img_t; + +extern img_t *img_splash; + +#endif /* ndef _IMG_H */ + +/* eof */ diff --git a/apps/plugins/xrick/data/pics.c b/apps/plugins/xrick/data/pics.c new file mode 100644 index 0000000000..103bfd8344 --- /dev/null +++ b/apps/plugins/xrick/data/pics.c @@ -0,0 +1,29 @@ +/* + * xrick/data/pics.c + * + * Copyright (C) 2008-2014 Pierluigi Vicinanza. All rights reserved. + * + * The use and distribution terms for this software are contained in the file + * named README, which can be found in the root of this distribution. By + * using this software in any fashion, you are agreeing to be bound by the + * terms of this license. + * + * You must not remove this notice, or any other, from this software. + */ + +#include "xrick/data/pics.h" + +#ifdef GFXST + +#include /* NULL */ + +/* + * globals + */ +pic_t *pic_haf = NULL; +pic_t *pic_congrats = NULL; +pic_t *pic_splash = NULL; + +#endif /* GFXST */ + +/* eof */ diff --git a/apps/plugins/xrick/data/pics.h b/apps/plugins/xrick/data/pics.h new file mode 100644 index 0000000000..0c540b125e --- /dev/null +++ b/apps/plugins/xrick/data/pics.h @@ -0,0 +1,41 @@ +/* + * xrick/data/pics.h + * + * Copyright (C) 1998-2002 BigOrno (bigorno@bigorno.net). + * Copyright (C) 2008-2014 Pierluigi Vicinanza. + * All rights reserved. + * + * The use and distribution terms for this software are contained in the file + * named README, which can be found in the root of this distribution. By + * using this software in any fashion, you are agreeing to be bound by the + * terms of this license. + * + * You must not remove this notice, or any other, from this software. + */ + +#ifndef _PICS_H +#define _PICS_H + +#include "xrick/config.h" + +#ifdef GFXST + +#include "xrick/system/basic_types.h" + +typedef struct { + U16 width; + U16 height; + U16 xPos; + U16 yPos; + U32 *pixels; +} pic_t; + +extern pic_t *pic_haf; +extern pic_t *pic_congrats; +extern pic_t *pic_splash; + +#endif /* GFXST */ + +#endif /* ndef _PICS_H */ + +/* eof */ diff --git a/apps/plugins/xrick/data/sounds.c b/apps/plugins/xrick/data/sounds.c new file mode 100644 index 0000000000..853e7cd198 --- /dev/null +++ b/apps/plugins/xrick/data/sounds.c @@ -0,0 +1,44 @@ +/* + * xrick/data/sounds.c + * + * Copyright (C) 2008-2014 Pierluigi Vicinanza. All rights reserved. + * + * The use and distribution terms for this software are contained in the file + * named README, which can be found in the root of this distribution. By + * using this software in any fashion, you are agreeing to be bound by the + * terms of this license. + * + * You must not remove this notice, or any other, from this software. + */ + +#include "xrick/data/sounds.h" + +#ifdef ENABLE_SOUND + +#include /* NULL */ + +sound_t *soundBombshht = NULL; +sound_t *soundBonus = NULL; +sound_t *soundBox = NULL; +sound_t *soundBullet = NULL; +sound_t *soundCrawl = NULL; +sound_t *soundDie = NULL; +sound_t *soundEntity[SOUNDS_NBR_ENTITIES]; +sound_t *soundExplode = NULL; +sound_t *soundGameover = NULL; +sound_t *soundJump = NULL; +sound_t *soundPad = NULL; +sound_t *soundSbonus1 = NULL; +sound_t *soundSbonus2 = NULL; +sound_t *soundStick = NULL; +sound_t *soundTune0 = NULL; +sound_t *soundTune1 = NULL; +sound_t *soundTune2 = NULL; +sound_t *soundTune3 = NULL; +sound_t *soundTune4 = NULL; +sound_t *soundTune5 = NULL; +sound_t *soundWalk = NULL; + +#endif /* ENABLE_SOUND */ + +/* eof */ \ No newline at end of file diff --git a/apps/plugins/xrick/data/sounds.h b/apps/plugins/xrick/data/sounds.h new file mode 100644 index 0000000000..5d89b3e9ee --- /dev/null +++ b/apps/plugins/xrick/data/sounds.h @@ -0,0 +1,87 @@ +/* + * xrick/data/sounds.h + * + * Copyright (C) 2008-2014 Pierluigi Vicinanza. All rights reserved. + * + * The use and distribution terms for this software are contained in the file + * named README, which can be found in the root of this distribution. By + * using this software in any fashion, you are agreeing to be bound by the + * terms of this license. + * + * You must not remove this notice, or any other, from this software. + */ + +#ifndef _SOUNDS_H +#define _SOUNDS_H + +#include "xrick/config.h" + +#ifdef ENABLE_SOUND + +#include "xrick/system/basic_types.h" + +typedef struct { + char *name; + U8 *buf; + U32 len; + bool dispose; +} sound_t; + +enum +{ + /* expected format is 8-bit mono at 22050Hz */ + Wave_SAMPLE_RATE = 22050, + Wave_AUDIO_FORMAT = 1, /* PCM = 1 (i.e. Linear quantization) */ + Wave_CHANNEL_COUNT = 1, + Wave_BITS_PER_SAMPLE = 8, +}; + +typedef struct { + /* "RIFF" chunk descriptor */ + U8 riffChunkId[4]; + U8 riffChunkSize[4]; + U8 riffType[4]; + /* "fmt" sub-chunk */ + U8 formatChunkId[4]; + U8 formatChunkSize[4]; + U8 audioFormat[2]; + U8 channelCount[2]; + U8 sampleRate[4]; + U8 byteRate[4]; + U8 blockAlign[2]; + U8 bitsPerSample[2]; + /* "data" sub-chunk */ + U8 dataChunkId[4]; + U8 dataChunkSize[4]; +} wave_header_t; + +/* apparently there are 10 entity sounds in original game (ref. "e_them.c" notes)? However we only have 9 so far... */ +enum { SOUNDS_NBR_ENTITIES = 10 }; + +extern sound_t *soundBombshht; +extern sound_t *soundBonus; +extern sound_t *soundBox; +extern sound_t *soundBullet; +extern sound_t *soundCrawl; +extern sound_t *soundDie; +extern sound_t *soundEntity[SOUNDS_NBR_ENTITIES]; +extern sound_t *soundExplode; +extern sound_t *soundGameover; +extern sound_t *soundJump; +extern sound_t *soundPad; +extern sound_t *soundSbonus1; +extern sound_t *soundSbonus2; +extern sound_t *soundStick; +extern sound_t *soundTune0; +extern sound_t *soundTune1; +extern sound_t *soundTune2; +extern sound_t *soundTune3; +extern sound_t *soundTune4; +extern sound_t *soundTune5; +extern sound_t *soundWalk; + +#endif /* ENABLE_SOUND */ + +#endif /* ndef _SOUNDS_H */ + +/* eof */ \ No newline at end of file diff --git a/apps/plugins/xrick/data/sprites.c b/apps/plugins/xrick/data/sprites.c new file mode 100644 index 0000000000..461861e85e --- /dev/null +++ b/apps/plugins/xrick/data/sprites.c @@ -0,0 +1,22 @@ +/* + * xrick/data/sprites.c + * + * Copyright (C) 2008-2014 Pierluigi Vicinanza. All rights reserved. + * + * The use and distribution terms for this software are contained in the file + * named README, which can be found in the root of this distribution. By + * using this software in any fashion, you are agreeing to be bound by the + * terms of this license. + * + * You must not remove this notice, or any other, from this software. + */ + +#include "xrick/data/sprites.h" + +/* + * globals + */ +size_t sprites_nbr_sprites = 0; +sprite_t *sprites_data = NULL; + +/* eof */ diff --git a/apps/plugins/xrick/data/sprites.h b/apps/plugins/xrick/data/sprites.h new file mode 100644 index 0000000000..124ad4bc85 --- /dev/null +++ b/apps/plugins/xrick/data/sprites.h @@ -0,0 +1,70 @@ +/* + * xrick/data/sprites.h + * + * Copyright (C) 1998-2002 BigOrno (bigorno@bigorno.net). + * Copyright (C) 2008-2014 Pierluigi Vicinanza. + * All rights reserved. + * + * The use and distribution terms for this software are contained in the file + * named README, which can be found in the root of this distribution. By + * using this software in any fashion, you are agreeing to be bound by the + * terms of this license. + * + * You must not remove this notice, or any other, from this software. + */ + +/* + * NOTES -- PC version + * + * A sprite consists in 4 columns and 21 rows of (U16 mask, U16 pict), + * each pair representing 8 pixels (cga encoding, two bits per pixels). + * Sprites are stored in 'sprites.bin' and are loaded by spr_init. Memory + * is freed by spr_shutdown. + * + * There are four sprites planes. Plane 0 is the raw content of 'sprites.bin', + * and planes 1, 2 and 3 contain copies of plane 0 with all sprites shifted + * 2, 4 and 6 pixels to the right. + */ + +#ifndef _SPRITES_H_ +#define _SPRITES_H_ + +#include "xrick/config.h" + +#include "xrick/system/basic_types.h" + +#include /* size_t */ + +#ifdef GFXPC + +typedef struct { + U16 mask; + U16 pict; +} spriteX_t; + +enum { + SPRITES_NBR_ROWS = 21, + SPRITES_NBR_COLS = 4 +}; +typedef spriteX_t sprite_t[SPRITES_NBR_COLS][SPRITES_NBR_ROWS]; /* one sprite */ + +#endif /* GFXPC */ + + +#ifdef GFXST + +enum { + SPRITES_NBR_ROWS = 21, + SPRITES_NBR_COLS = 4, + SPRITES_NBR_DATA = SPRITES_NBR_ROWS * SPRITES_NBR_COLS +}; +typedef U32 sprite_t[SPRITES_NBR_DATA]; + +#endif /* GFXST */ + +extern size_t sprites_nbr_sprites; +extern sprite_t *sprites_data; + +#endif /* ndef _SPRITES_H_ */ + +/* eof */ diff --git a/apps/plugins/xrick/data/tiles.c b/apps/plugins/xrick/data/tiles.c new file mode 100644 index 0000000000..17d702ee6b --- /dev/null +++ b/apps/plugins/xrick/data/tiles.c @@ -0,0 +1,22 @@ +/* + * xrick/data/tiles.c + * + * Copyright (C) 2008-2014 Pierluigi Vicinanza. All rights reserved. + * + * The use and distribution terms for this software are contained in the file + * named README, which can be found in the root of this distribution. By + * using this software in any fashion, you are agreeing to be bound by the + * terms of this license. + * + * You must not remove this notice, or any other, from this software. + */ + +#include "xrick/data/tiles.h" + +/* + * globals + */ +size_t tiles_nbr_banks = 0; +tile_t *tiles_data = NULL; + +/* eof */ diff --git a/apps/plugins/xrick/data/tiles.h b/apps/plugins/xrick/data/tiles.h new file mode 100644 index 0000000000..35bc07184e --- /dev/null +++ b/apps/plugins/xrick/data/tiles.h @@ -0,0 +1,70 @@ +/* + * xrick/data/tiles.h + * + * Copyright (C) 1998-2002 BigOrno (bigorno@bigorno.net). + * Copyright (C) 2008-2014 Pierluigi Vicinanza. + * All rights reserved. + * + * The use and distribution terms for this software are contained in the file + * named README, which can be found in the root of this distribution. By + * using this software in any fashion, you are agreeing to be bound by the + * terms of this license. + * + * You must not remove this notice, or any other, from this software. + */ + +/* + * NOTES + * + * A tile consists in one column and 8 rows of 8 U16 (cga encoding, two + * bits per pixel). The tl_tiles array contains all tiles, with the + * following structure: + * + * 0x0000 - 0x00FF tiles for main intro + * 0x0100 - 0x01FF tiles for map intro + * 0x0200 - 0x0327 unused + * 0x0328 - 0x0427 game tiles, page 0 + * 0x0428 - 0x0527 game tiles, page 1 + * 0x0527 - 0x05FF unused + */ + +#ifndef _TILES_H +#define _TILES_H + +#include "xrick/system/basic_types.h" + +#include "xrick/config.h" + +#include /* size_t */ + +/* + * three special tile numbers + */ +enum { + TILES_BULLET = 0x01, + TILES_BOMB = 0x02, + TILES_RICK = 0x03 +}; + +/* + * one single tile + */ +enum { TILES_NBR_LINES = 0x08 }; + +#ifdef GFXPC +typedef U16 tile_t[TILES_NBR_LINES]; +#endif +#ifdef GFXST +typedef U32 tile_t[TILES_NBR_LINES]; +#endif + +/* + * tiles banks (each bank is 0x100 tiles) + */ +enum { TILES_NBR_TILES = 0x100 }; +extern size_t tiles_nbr_banks; +extern tile_t *tiles_data; + +#endif /* ndef _TILES_H */ + +/* eof */ -- cgit v1.2.3