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
This commit is contained in:
Sebastian Leonhardt 2016-01-08 01:05:36 +01:00 committed by Solomon Peachy
parent 6f1e67e5e3
commit 102c374248
88 changed files with 16514 additions and 62 deletions

View file

@ -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 <stddef.h> /* NULL */
/*
* globals
*/
img_t *img_splash = NULL;
/* eof */

View file

@ -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 */

View file

@ -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 <stddef.h> /* NULL */
/*
* globals
*/
pic_t *pic_haf = NULL;
pic_t *pic_congrats = NULL;
pic_t *pic_splash = NULL;
#endif /* GFXST */
/* eof */

View file

@ -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 */

View file

@ -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 <stddef.h> /* 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 */

View file

@ -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 */

View file

@ -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 */

View file

@ -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 <stddef.h> /* 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 */

View file

@ -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 */

View file

@ -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 <stddef.h> /* 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 */