diff --git a/include/config.h b/include/config.h new file mode 100644 index 0000000..8629040 --- /dev/null +++ b/include/config.h @@ -0,0 +1,50 @@ +/* + * xrick/include/config.h + * + * Copyright (C) 1998-2002 BigOrno (bigorno@bigorno.net). 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 _CONFIG_H +#define _CONFIG_H + +#pragma memorymodel 1 + +/* version */ +#define VERSION "021212" + +/* graphics (choose one) */ +#undef GFXST +#undef GFXPC +#undef GFXGS +#define GFXF256 + +/* joystick support */ +#undef ENABLE_JOYSTICK + +/* sound support */ +//#define ENABLE_SOUND +#undef ENABLE_SOUND + +/* cheats support */ +#define ENABLE_CHEATS + +/* auto-defocus support */ +/* does seem to cause all sorts of problems on BeOS, Windows... */ +#undef ENABLE_FOCUS + +/* development tools */ +#undef ENABLE_DEVTOOLS +#undef DEBUG /* see include/debug.h */ + +#endif + +/* eof */ + + diff --git a/include/control.h b/include/control.h new file mode 100644 index 0000000..87281ee --- /dev/null +++ b/include/control.h @@ -0,0 +1,34 @@ +/* + * xrick/include/control.h + * + * Copyright (C) 1998-2002 BigOrno (bigorno@bigorno.net). 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 _CONTROL_H +#define _CONTROL_H + +#define CONTROL_UP 0x08 +#define CONTROL_DOWN 0x04 +#define CONTROL_LEFT 0x02 +#define CONTROL_RIGHT 0x01 +#define CONTROL_PAUSE 0x80 +#define CONTROL_END 0x40 +#define CONTROL_EXIT 0x20 +#define CONTROL_FIRE 0x10 + +extern U8 control_status; +extern U8 control_last; +extern U8 control_active; + +#endif + +/* eof */ + + diff --git a/include/data.h b/include/data.h new file mode 100644 index 0000000..68ef438 --- /dev/null +++ b/include/data.h @@ -0,0 +1,35 @@ +/* + * xrick/include/data.h + * + * Copyright (C) 1998-2002 BigOrno (bigorno@bigorno.net). 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 _DATA_H +#define _DATA_H + +#include + +#include "system.h" + +typedef void *data_file_t; + +extern void data_setpath(char *); +extern void data_closepath(); + +extern data_file_t *data_file_open(char *); +extern int data_file_seek(data_file_t *file, long offset, int origin); +extern int data_file_tell(data_file_t *file); +extern int data_file_size(data_file_t *file); +extern int data_file_read(data_file_t *, void *, size_t, size_t); +extern void data_file_close(data_file_t *); + +#endif + +/* eof */ diff --git a/include/debug.h b/include/debug.h new file mode 100644 index 0000000..ca67a98 --- /dev/null +++ b/include/debug.h @@ -0,0 +1,93 @@ +/* + * xrick/include/debug.h + * + * Copyright (C) 1998-2002 BigOrno (bigorno@bigorno.net). 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 _DEBUG_H +#define _DEBUG_H + +/* enable/disable subsystem debug */ +#undef DEBUG_ENTS +#undef DEBUG_SCROLLER +#undef DEBUG_MAPS +#undef DEBUG_JOYSTICK +#undef DEBUG_EVENTS +#undef DEBUG_AUDIO +#undef DEBUG_AUDIO2 +#undef DEBUG_VIDEO +#undef DEBUG_VIDEO2 + +/* define global debug option */ +#ifdef DEBUG +#define DEBUG_VIDEO +#define DEBUG_VIDEO2 +#endif + +/* define IFDEBUG macros */ +#ifdef DEBUG_ENTS +#define IFDEBUG_ENTS(X); X +#else +#define IFDEBUG_ENTS(X); +#endif + +#ifdef DEBUG_SCROLLER +#define IFDEBUG_SCROLLER(X); X +#else +#define IFDEBUG_SCROLLER(X); +#endif + +#ifdef DEBUG_MAPS +#define IFDEBUG_MAPS(X); X +#else +#define IFDEBUG_MAPS(X); +#endif + +#ifdef DEBUG_JOYSTICK +#define IFDEBUG_JOYSTICK(X); X +#else +#define IFDEBUG_JOYSTICK(X); +#endif + +#ifdef DEBUG_EVENTS +#define IFDEBUG_EVENTS(X); X +#else +#define IFDEBUG_EVENTS(X); +#endif + +#ifdef DEBUG_AUDIO +#define IFDEBUG_AUDIO(X); X +#else +#define IFDEBUG_AUDIO(X); +#endif + +#ifdef DEBUG_AUDIO2 +#define IFDEBUG_AUDIO2(X); X +#else +#define IFDEBUG_AUDIO2(X); +#endif + +#ifdef DEBUG_VIDEO +#define IFDEBUG_VIDEO(X); X +#else +#define IFDEBUG_VIDEO(X); +#endif + +#ifdef DEBUG_VIDEO2 +#define IFDEBUG_VIDEO2(X); X +#else +#define IFDEBUG_VIDEO2(X); +#endif + +#endif + +/* eof */ + + diff --git a/include/devtools.h b/include/devtools.h new file mode 100644 index 0000000..bda243d --- /dev/null +++ b/include/devtools.h @@ -0,0 +1,23 @@ +/* + * xrick/include/devtools.h + * + * Copyright (C) 1998-2002 BigOrno (bigorno@bigorno.net). 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 _DEVTOOLS_H +#define _DEVTOOLS_H + +#include "system.h" + +extern U8 devtools_run(void); + +#endif + +/* eof */ diff --git a/include/draw.h b/include/draw.h new file mode 100644 index 0000000..c601c52 --- /dev/null +++ b/include/draw.h @@ -0,0 +1,54 @@ +/* + * xrick/include/draw.h + * + * Copyright (C) 1998-2002 BigOrno (bigorno@bigorno.net). 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 _DRAW_H +#define _DRAW_H + +#include "system.h" + +#include "rects.h" +#include "img.h" + +/* map coordinates of the screen */ +#define DRAW_XYMAP_SCRLEFT (-0x0020) +#define DRAW_XYMAP_SCRTOP (0x0040) +/* map coordinates of the top of the hidden bottom of the map */ +#define DRAW_XYMAP_HBTOP (0x0100) + +extern U8 *draw_tllst; +#ifdef GFXPC +extern U16 draw_filter; +#endif +extern U16 draw_tilesBank; +extern rect_t draw_STATUSRECT; +extern rect_t draw_SCREENRECT; + +extern void draw_setfb(U16, U16); +extern U8 draw_clipms(S16 *, S16 *, U16 *, U16 *); +extern void draw_tilesList(void); +extern void draw_tilesListImm(U8 *); +extern U8 draw_tilesSubList(void); +extern void draw_tile(register U8); +extern void draw_sprite(U8, U16, U16); +extern void draw_sprite2(U8, U16, U16, U8); +extern void draw_spriteBackground(U16, U16); +extern void draw_map(void); +extern void draw_drawStatus(void); +extern void draw_clearStatus(void); +extern void draw_pic(U16, U16, U16, U16, U32 *); +extern void draw_infos(void); +extern void draw_img(img_t *); + +#endif + +/* eof */ diff --git a/include/e_bomb.h b/include/e_bomb.h new file mode 100644 index 0000000..35e9b0f --- /dev/null +++ b/include/e_bomb.h @@ -0,0 +1,34 @@ +/* + * xrick/include/e_bomb.h + * + * Copyright (C) 1998-2002 BigOrno (bigorno@bigorno.net). 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 _E_BOMB_H +#define _E_BOMB_H + +#include "system.h" + +#define E_BOMB_NO 3 +#define E_BOMB_ENT ent_ents[E_BOMB_NO] +#define E_BOMB_TICKER (0x2D) + +extern U8 e_bomb_lethal; +extern U8 e_bomb_ticker; +extern U8 e_bomb_xc; +extern U16 e_bomb_yc; + +extern U8 e_bomb_hit(ent_t* pEnt); +extern void e_bomb_init(U16, U16); +extern void e_bomb_action(ent_t* pEnt); + +#endif + +/* eof */ diff --git a/include/e_bonus.h b/include/e_bonus.h new file mode 100644 index 0000000..b92bdad --- /dev/null +++ b/include/e_bonus.h @@ -0,0 +1,23 @@ +/* + * xrick/include/e_bonus.h + * + * Copyright (C) 1998-2002 BigOrno (bigorno@bigorno.net). 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 _E_BONUS_H +#define _E_BONUS_H + +#include "system.h" + +extern void e_bonus_action(ent_t*); + +#endif + +/* eof */ diff --git a/include/e_box.h b/include/e_box.h new file mode 100644 index 0000000..7ec3dd5 --- /dev/null +++ b/include/e_box.h @@ -0,0 +1,23 @@ +/* + * xrick/include/e_box.h + * + * Copyright (C) 1998-2002 BigOrno (bigorno@bigorno.net). 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 _E_BOX_H +#define _E_BOX_H + +#include "system.h" + +extern void e_box_action(ent_t*); + +#endif + +/* eof */ diff --git a/include/e_bullet.h b/include/e_bullet.h new file mode 100644 index 0000000..0c61403 --- /dev/null +++ b/include/e_bullet.h @@ -0,0 +1,30 @@ +/* + * xrick/include/e_bullet.h + * + * Copyright (C) 1998-2002 BigOrno (bigorno@bigorno.net). 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 _E_BULLET_H +#define _E_BULLET_H + +#include "system.h" + +#define E_BULLET_NO 2 +#define E_BULLET_ENT ent_ents[E_BULLET_NO] + +extern S16 e_bullet_offsx; +extern S16 e_bullet_xc, e_bullet_yc; + +extern void e_bullet_init(U16, U16); +extern void e_bullet_action(ent_t*); + +#endif + +/* eof */ diff --git a/include/e_rick.h b/include/e_rick.h new file mode 100644 index 0000000..1712c32 --- /dev/null +++ b/include/e_rick.h @@ -0,0 +1,47 @@ +/* + * xrick/include/e_rick.h + * + * Copyright (C) 1998-2002 BigOrno (bigorno@bigorno.net). 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 _E_RICK_H +#define _E_RICK_H + +#include "system.h" + +#define E_RICK_NO 1 +#define E_RICK_ENT ent_ents[E_RICK_NO] + +extern U8 e_rick_state; +extern S16 e_rick_stop_x, e_rick_stop_y; + +#define E_RICK_STSTOP 0x01 +#define E_RICK_STSHOOT 0x02 +#define E_RICK_STCLIMB 0x04 +#define E_RICK_STJUMP 0x08 +#define E_RICK_STZOMBIE 0x10 +#define E_RICK_STDEAD 0x20 +#define E_RICK_STCRAWL 0x40 + +#define E_RICK_STSET(X) e_rick_state |= (X) +#define E_RICK_STRST(X) e_rick_state &= ~(X) +#define E_RICK_STTST(X) (e_rick_state & (X)) + +extern void e_rick_save(void); +extern void e_rick_restore(void); +extern void e_rick_action(ent_t*); +extern void e_rick_gozombie(void); +extern U8 e_rick_boxtest(ent_t*); + +#endif + +/* eof */ + + diff --git a/include/e_sbonus.h b/include/e_sbonus.h new file mode 100644 index 0000000..a7f76ce --- /dev/null +++ b/include/e_sbonus.h @@ -0,0 +1,28 @@ +/* + * xrick/include/e_sbonus.h + * + * Copyright (C) 1998-2002 BigOrno (bigorno@bigorno.net). 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 _E_SBONUS_H +#define _E_SBONUS_H + +#include "system.h" + +extern U8 e_sbonus_counting; +extern U8 e_sbonus_counter; +extern U16 e_sbonus_bonus; + +extern void e_sbonus_start(ent_t*); +extern void e_sbonus_stop(ent_t*); + +#endif + +/* eof */ diff --git a/include/e_them.h b/include/e_them.h new file mode 100644 index 0000000..a8bf57f --- /dev/null +++ b/include/e_them.h @@ -0,0 +1,29 @@ +/* + * xrick/include/e_them.h + * + * Copyright (C) 1998-2002 BigOrno (bigorno@bigorno.net). 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 _E_THEM_H +#define _E_THEM_H + +#include "system.h" + +extern U32 e_them_rndseed; + +extern void e_them_t1a_action(ent_t*); +extern void e_them_t1b_action(ent_t*); +extern void e_them_t2_action(ent_t*); +extern void e_them_t3_action(ent_t*); +extern void e_them_z_action(ent_t*); + +#endif + +/* eof */ diff --git a/include/ents.h b/include/ents.h new file mode 100644 index 0000000..5c90633 --- /dev/null +++ b/include/ents.h @@ -0,0 +1,113 @@ +/* + * xrick/include/ents.h + * + * Copyright (C) 1998-2002 BigOrno (bigorno@bigorno.net). 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 _ENTS_H +#define _ENTS_H + +#include "system.h" +#include "rects.h" + +#define ENT_XRICK ent_ents[1] + +#define ENT_NBR_ENTDATA 0x4a +#define ENT_NBR_SPRSEQ 0x88 +#define ENT_NBR_MVSTEP 0x310 + +#define ENT_ENTSNUM 0x0c + +/* + * flags for ent_ents[e].n ("yes" when set) + * + * ENT_LETHAL: is entity lethal? + */ +#define ENT_LETHAL 0x80 + +/* + * flags for ent_ents[e].flag ("yes" when set) + * + * ENT_FLG_ONCE: should the entity run once only? + * ENT_FLG_STOPRICK: does the entity stops rick (and goes to slot zero)? + * ENT_FLG_LETHALR: is entity lethal when restarting? + * ENT_FLG_LETHALI: is entity initially lethal? + * ENT_FLG_TRIGBOMB: can entity be triggered by a bomb? + * ENT_FLG_TRIGBULLET: can entity be triggered by a bullet? + * ENT_FLG_TRIGSTOP: can entity be triggered by rick stop? + * ENT_FLG_TRIGRICK: can entity be triggered by rick? + */ +#define ENT_FLG_ONCE 0x01 +#define ENT_FLG_STOPRICK 0x02 +#define ENT_FLG_LETHALR 0x04 +#define ENT_FLG_LETHALI 0x08 +#define ENT_FLG_TRIGBOMB 0x10 +#define ENT_FLG_TRIGBULLET 0x20 +#define ENT_FLG_TRIGSTOP 0x40 +#define ENT_FLG_TRIGRICK 0x80 + +typedef struct { + U8 n; /* b00 */ + /*U8 b01;*/ /* b01 in ASM code but never used */ + S16 x; /* b02 - position */ + S16 y; /* w04 - position */ + U8 sprite; /* b08 - sprite number */ + /*U16 w0C;*/ /* w0C in ASM code but never used */ + U8 w; /* b0E - width */ + U8 h; /* b10 - height */ + U16 mark; /* w12 - number of the mark that created the entity */ + U8 flags; /* b14 */ + S16 trig_x; /* b16 - position of trigger box */ + S16 trig_y; /* w18 - position of trigger box */ + S16 xsave; /* b1C */ + S16 ysave; /* w1E */ + U16 sprbase; /* w20 */ + U16 step_no_i; /* w22 */ + U16 step_no; /* w24 */ + S16 c1; /* b26 */ + S16 c2; /* b28 */ + U8 ylow; /* b2A */ + S16 offsy; /* w2C */ + U8 latency; /* b2E */ + U8 prev_n; /* new */ + S16 prev_x; /* new */ + S16 prev_y; /* new */ + U8 prev_s; /* new */ + U8 front; /* new */ + U8 trigsnd; /* new */ +} ent_t; + +typedef struct { + U8 w, h; + U16 spr, sni; + U8 trig_w, trig_h; + U8 snd; +} entdata_t; + +typedef struct { + U8 count; + S8 dx, dy; +} mvstep_t; + +extern ent_t ent_ents[ENT_ENTSNUM + 1]; +extern entdata_t ent_entdata[ENT_NBR_ENTDATA]; +extern rect_t *ent_rects; +extern U8 ent_sprseq[ENT_NBR_SPRSEQ]; +extern mvstep_t ent_mvstep[ENT_NBR_MVSTEP]; + +extern void ent_reset(void); +extern void ent_actvis(U8, U8); +extern void ent_draw(void); +extern void ent_clprev(void); +extern void ent_action(void); + +#endif + +/* eof */ diff --git a/include/game.h b/include/game.h new file mode 100644 index 0000000..2fa8795 --- /dev/null +++ b/include/game.h @@ -0,0 +1,121 @@ +/* + * xrick/include/game.h + * + * Copyright (C) 1998-2002 BigOrno (bigorno@bigorno.net). 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 _GAME_H +#define _GAME_H + +#include /* NULL */ + +#include "system.h" +#include "config.h" + +#include "rects.h" +#include "data.h" + +#define LEFT 1 +#define RIGHT 0 + +#define TRUE 1 +#define FALSE 0 + +#ifdef IIGS +#define GAME_PERIOD 64 +#else +#define GAME_PERIOD 75 +#endif + +#define GAME_BOMBS_INIT 6 +#define GAME_BULLETS_INIT 6 + +typedef struct { + U32 score; + U8 name[10]; +} hscore_t; + +extern U16 game_status_dirty; /* status dirty flag */ +extern U16 game_lives; /* lives counter */ +extern U16 game_bombs; /* bombs counter */ +extern U16 game_bullets; /* bullets counter */ + +extern U32 game_score; /* score */ + +extern hscore_t game_hscores[8]; /* highest scores (hall of fame) */ + +extern U16 game_map; /* current map */ +extern U16 game_submap; /* current submap */ + +extern U16 game_dir; /* direction (LEFT, RIGHT) */ +extern U16 game_chsm; /* change submap request (TRUE, FALSE) */ + +extern U16 game_waitevt; /* wait for events (TRUE, FALSE) */ +extern U16 game_period; /* time between each frame, in millisecond */ + +extern rect_t *game_rects; /* rectangles to redraw at each frame */ + +extern void game_run(void); +extern void game_setmusic(char *name, U8 loop); +extern void game_stopmusic(void); + + +#ifdef ENABLE_CHEATS +extern U16 game_cheat1; /* infinite lives, bombs and bullets */ +extern U16 game_cheat2; /* never die */ +extern U16 game_cheat3; /* highlight sprites */ +extern void game_toggleCheat(U8); +#endif + +#ifdef ENABLE_SOUND +#ifdef IIGS + +extern sound_t WAV_GAMEOVER; +extern sound_t WAV_SBONUS2; +extern sound_t WAV_BULLET; +extern sound_t WAV_BOMBSHHT; +extern sound_t WAV_EXPLODE; +extern sound_t WAV_STICK; +extern sound_t WAV_WALK; +extern sound_t WAV_CRAWL; +extern sound_t WAV_JUMP; +extern sound_t WAV_PAD; +extern sound_t WAV_BOX; +extern sound_t WAV_BONUS; +extern sound_t WAV_SBONUS1; +extern sound_t WAV_DIE; +extern sound_t WAV_ENTITY[]; + +#else + +extern sound_t *WAV_GAMEOVER; +extern sound_t *WAV_SBONUS2; +extern sound_t *WAV_BULLET; +extern sound_t *WAV_BOMBSHHT; +extern sound_t *WAV_EXPLODE; +extern sound_t *WAV_STICK; +extern sound_t *WAV_WALK; +extern sound_t *WAV_CRAWL; +extern sound_t *WAV_JUMP; +extern sound_t *WAV_PAD; +extern sound_t *WAV_BOX; +extern sound_t *WAV_BONUS; +extern sound_t *WAV_SBONUS1; +extern sound_t *WAV_DIE; +extern sound_t *WAV_ENTITY[]; + +#endif /* IIGS */ +#endif /* ENABLE_SOUND */ + +#endif + +/* eof */ + + diff --git a/include/img.h b/include/img.h new file mode 100644 index 0000000..69af70e --- /dev/null +++ b/include/img.h @@ -0,0 +1,40 @@ +/* + * xrick/include/img.h + * + * Copyright (C) 1998-2002 BigOrno (bigorno@bigorno.net). 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 "system.h" + +typedef struct { + U8 r, g, b, nothing; +} img_color_t; + +#ifdef IIGS + +typedef void img_t; + +#else +typedef struct { + U16 w, h; + U16 ncolors; + img_color_t *colors; + U8 *pixels; +} img_t; +#endif + +extern img_t *IMG_SPLASH; + +#endif + +/* eof */ diff --git a/include/maps.h b/include/maps.h new file mode 100644 index 0000000..86e3438 --- /dev/null +++ b/include/maps.h @@ -0,0 +1,150 @@ +/* + * xrick/include/maps.h + * + * Copyright (C) 1998-2002 BigOrno (bigorno@bigorno.net). 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 _MAPS_H +#define _MAPS_H + +#include "system.h" + +#define MAP_NBR_MAPS 0x05 +#define MAP_NBR_SUBMAPS 0x2F +#define MAP_NBR_CONNECT 0x99 +#define MAP_NBR_BNUMS 0x1FD8 +#define MAP_NBR_BLOCKS 0x0100 +#define MAP_NBR_MARKS 0x020B +#define MAP_NBR_EFLGC 0x0020 + +/* + * map row definitions, for three zones : hidden top, screen, hidden bottom + * the three zones compose map_map, which contains the definition of the + * current portion of the submap. + */ +#define MAP_ROW_HTTOP 0x00 +#define MAP_ROW_HTBOT 0x07 +#define MAP_ROW_SCRTOP 0x08 +#define MAP_ROW_SCRBOT 0x1F +#define MAP_ROW_HBTOP 0x20 +#define MAP_ROW_HBBOT 0x27 + +extern U8 map_map[0x2c][0x20]; + +/* + * main maps + */ +typedef struct { + U16 x, y; /* initial position for rick */ + U16 row; /* initial map_map top row within the submap */ + U16 submap; /* initial submap */ + char *tune; /* map tune */ +} map_t; + +extern map_t map_maps[MAP_NBR_MAPS]; + +/* + * sub maps + */ +typedef struct { + U16 page; /* tiles page */ + U16 bnum; /* first block number */ + U16 connect; /* first connection */ + U16 mark; /* first entity mark */ +} submap_t; + +extern submap_t map_submaps[MAP_NBR_SUBMAPS]; + +/* + * connections + */ +typedef struct { + U8 dir; + U8 rowout; + U8 submap; + U8 rowin; +} connect_t; + +extern connect_t map_connect[MAP_NBR_CONNECT]; + +/* + * blocks - one block is 4 by 4 tiles. + */ +typedef U8 block_t[0x10]; + +extern block_t map_blocks[MAP_NBR_BLOCKS]; + +/* + * flags for map_marks[].ent ("yes" when set) + * + * MAP_MARK_NACT: this mark is not active anymore. + */ +#define MAP_MARK_NACT (0x80) + +/* + * mark structure + */ +typedef struct { + U8 row; + U8 ent; + U8 flags; + U8 xy; /* bits XXXX XYYY (from b03) with X->x, Y->y */ + U8 lt; /* bits XXXX XNNN (from b04) with X->trig_x, NNN->lat & trig_y */ +} mark_t; + +extern mark_t map_marks[MAP_NBR_MARKS]; + +/* + * block numbers, i.e. array of rows of 8 blocks + */ +extern U8 map_bnums[MAP_NBR_BNUMS]; + +/* + * flags for map_eflg[map_map[row][col]] ("yes" when set) + * + * MAP_EFLG_VERT: vertical move only (usually on top of _CLIMB). + * MAP_EFLG_SOLID: solid block, can't go through. + * MAP_EFLG_SPAD: super pad. can't go through, but sends entities to the sky. + * MAP_EFLG_WAYUP: solid block, can't go through except when going up. + * MAP_EFLG_FGND: foreground (hides entities). + * MAP_EFLG_LETHAL: lethal (kill entities). + * MAP_EFLG_CLIMB: entities can climb here. + * MAP_EFLG_01: + */ +#define MAP_EFLG_VERT (0x80) +#define MAP_EFLG_SOLID (0x40) +#define MAP_EFLG_SPAD (0x20) +#define MAP_EFLG_WAYUP (0x10) +#define MAP_EFLG_FGND (0x08) +#define MAP_EFLG_LETHAL (0x04) +#define MAP_EFLG_CLIMB (0x02) +#define MAP_EFLG_01 (0x01) + +extern U8 map_eflg_c[MAP_NBR_EFLGC]; /* compressed */ +extern U8 map_eflg[0x100]; /* current */ + +/* + * map_map top row within the submap + */ +extern U16 map_frow; + +/* + * tiles offset + */ +extern U16 map_tilesBank; + +extern void map_expand(void); +extern void map_init(void); +extern U8 map_chain(void); +extern void map_resetMarks(void); + +#endif + +/* eof */ diff --git a/include/pics.h b/include/pics.h new file mode 100644 index 0000000..ed4fbb2 --- /dev/null +++ b/include/pics.h @@ -0,0 +1,25 @@ +/* + * xrick/include/pics.h + * + * Copyright (C) 1998-2002 BigOrno (bigorno@bigorno.net). 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 + +extern U32 pic_haf[]; +extern U32 pic_congrats[]; +extern U32 pic_splash[]; + +#endif + +/* eof */ + + diff --git a/include/rects.h b/include/rects.h new file mode 100644 index 0000000..e934440 --- /dev/null +++ b/include/rects.h @@ -0,0 +1,30 @@ +/* + * xrick/include/rects.h + * + * Copyright (C) 1998-2002 BigOrno (bigorno@bigorno.net). 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 _RECTS_H +#define _RECTS_H + +#include "system.h" + +typedef struct rect_s { + U16 x, y; + U16 width, height; + struct rect_s *next; +} rect_t; + +extern void rects_free(rect_t *); +extern rect_t *rects_new(U16, U16, U16, U16, rect_t *); + +#endif + +/* eof */ diff --git a/include/screens.h b/include/screens.h new file mode 100644 index 0000000..ae97957 --- /dev/null +++ b/include/screens.h @@ -0,0 +1,54 @@ +/* + * xrick/include/screens.h + * + * Copyright (C) 1998-2002 BigOrno (bigorno@bigorno.net). 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 _SCREENS_H +#define _SCREENS_H + +#include "system.h" + +#define SCREEN_TIMEOUT 4000 +#define SCREEN_RUNNING 0 +#define SCREEN_DONE 1 +#define SCREEN_EXIT 2 + +typedef struct { + U16 count; /* number of loops */ + U16 dx, dy; /* sprite x and y deltas */ + U16 base; /* base for sprite numbers table */ +} screen_imapsteps_t; /* description of one step */ + +//segment "screen"; + +extern U8 screen_imapsl[]; /* sprite lists */ +extern screen_imapsteps_t screen_imapsteps[]; /* map intro steps */ +extern U8 screen_imapsofs[]; /* first step for each map */ +extern U8 *screen_imaptext[]; /* map intro texts */ +extern U8 screen_imainhoft[]; /* hall of fame title */ +extern U8 screen_imainrdt[]; /*rick dangerous title */ +extern U8 screen_imaincdc[]; /* core design copyright text */ +extern U8 screen_gameovertxt[]; /* game over */ +extern U8 screen_pausedtxt[]; /* paused */ +extern U8 screen_congrats[]; /* congratulations */ + +extern U8 screen_xrick(void); /* splash */ +extern U8 screen_introMain(void); /* main intro */ +extern U8 screen_introMap(void); /* map intro */ +extern U8 screen_gameover(void); /* gameover */ +extern U8 screen_getname(void); /* enter you name */ +extern void screen_pause(U8); /* pause indicator */ + +U8 screen_joykey(void); /* choose Joystick or Keyboard */ + +#endif + +/* eof */ diff --git a/include/scroller.h b/include/scroller.h new file mode 100644 index 0000000..e2c2579 --- /dev/null +++ b/include/scroller.h @@ -0,0 +1,29 @@ +/* + * xrick/include/scroller.h + * + * Copyright (C) 1998-2002 BigOrno (bigorno@bigorno.net). 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 _SCROLLER_H +#define _SCROLLER_H + +#define SCROLL_RUNNING 1 +#define SCROLL_DONE 0 + +#define SCROLL_PERIOD 24 + +extern U8 scroll_up(void); +extern U8 scroll_down(void); + +#endif + +/* eof */ + + diff --git a/include/sprites.h b/include/sprites.h new file mode 100644 index 0000000..ea6c76f --- /dev/null +++ b/include/sprites.h @@ -0,0 +1,61 @@ +/* + * xrick/include/sprites.h + * + * Copyright (C) 1998-2002 BigOrno (bigorno@bigorno.net). 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 0x15 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 "system.h" + +#ifdef GFXPC + +#define SPRITES_NBR_SPRITES (0x9b) + +typedef struct { + U16 mask; + U16 pict; +} spriteX_t; + +typedef spriteX_t sprite_t[4][0x15]; /* one sprite */ + +extern sprite_t sprites_data[SPRITES_NBR_SPRITES]; + +#endif + +#ifdef GFXST + +#define SPRITES_NBR_SPRITES (0xD5) + +typedef U32 sprite_t[0x54]; /* 0x15 per 0x04 */ + +extern sprite_t sprites_data[SPRITES_NBR_SPRITES]; + +#endif + +#endif + +/* eof */ + diff --git a/include/syssnd.h b/include/syssnd.h new file mode 100644 index 0000000..ac6ad76 --- /dev/null +++ b/include/syssnd.h @@ -0,0 +1,45 @@ +/* + * xrick/include/syssnd.h + * + * Copyright (C) 1998-2002 BigOrno (bigorno@bigorno.net). 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 _SYSSND_H +#define _SYSSND_H + +#include "config.h" + +#ifdef ENABLE_SOUND + +#include "system.h" + +/* 8-bit mono at 22050Hz */ +#define SYSSND_FREQ 22050 +#define SYSSND_CHANNELS 1 +#define SYSSND_MAXVOL 10 +#define SYSSND_MIXCHANNELS 8 +/* MIXSAMPLES: 256 is too low on Windows. 512 means ~20 mix per second at 11025Hz */ +/* MIXSAMPLES: ?? at 22050Hz */ +#define SYSSND_MIXSAMPLES 1024 + +typedef struct { + sound_t *snd; + U8 *buf; + U32 len; + S8 loop; +} channel_t; + +#endif /* ENABLE_SOUND */ + +#endif /* _SYSSND_H */ + +/* eof */ + + diff --git a/include/system.h b/include/system.h new file mode 100644 index 0000000..5d4eab3 --- /dev/null +++ b/include/system.h @@ -0,0 +1,261 @@ +/* + * xrick/include/system.h + * + * Copyright (C) 1998-2002 BigOrno (bigorno@bigorno.net). 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 _SYSTEM_H +#define _SYSTEM_H + +#include "config.h" + +/* + * If compiling w/gcc, then we can use attributes. UNUSED(x) flags a + * parameter or a variable as potentially being unused, so that gcc doesn't + * complain about it. + * + * Note: from OpenAL code: Darwin OS cc is based on gcc and has __GNUC__ + * defined, yet does not support attributes. So in theory we should exclude + * Darwin target here. + */ +#ifdef __GNUC__ +#define UNUSED(x) x __attribute((unused)) +#else +#define UNUSED(x) x +#endif + +/* + * Detect Microsoft Visual C + */ +#ifdef _MSC_VER +#define __MSVC__ +/* + * FIXME disable "integral size mismatch in argument; conversion supplied" warning + * as long as the code has not been cleared -- there are so many of them... + */ + +#pragma warning( disable : 4761 ) +#endif + +/* + * Detect Microsoft Windows + */ +#ifdef WIN32 +#define __WIN32__ +#endif + +#ifdef __ORCAC__ +/* Apple IIgs */ +typedef unsigned char U8; /* 8 bits unsigned */ +typedef unsigned int U16; /* 16 bits unsigned */ +typedef unsigned long U32; /* 32 bits unsigned */ +typedef signed char S8; /* 8 bits signed */ +typedef signed int S16; /* 16 bits signed */ +typedef signed long S32; /* 32 bits signed */ +#else +/* there are true at least on x86 platforms */ +typedef unsigned char U8; /* 8 bits unsigned */ +typedef unsigned short int U16; /* 16 bits unsigned */ +typedef unsigned int U32; /* 32 bits unsigned */ +typedef signed char S8; /* 8 bits signed */ +typedef signed short int S16; /* 16 bits signed */ +typedef signed int S32; /* 32 bits signed */ +#endif + +/* this must be after typedefs because it relies on types defined above */ +#include "rects.h" +#include "img.h" + +/* + * main section + */ +extern void sys_init(int, char **); +extern void sys_shutdown(void); +extern void sys_panic(char *, ...); +extern void sys_printf(char *, ...); +extern U32 sys_gettime(void); +extern void sys_sleep(int); + +/* + * video section + */ +#define SYSVID_ZOOM 2 +#define SYSVID_MAXZOOM 4 +#ifdef IIGS +#define SYSVID_WIDTH 160 +#else +#define SYSVID_WIDTH 320 +#endif +#define SYSVID_HEIGHT 200 + +extern void sysvid_init(void); +extern void sysvid_shutdown(void); +extern void sysvid_update(rect_t *); +extern void sysvid_clear(void); +extern void sysvid_clearPalette(void); +extern void sysvid_FadeIn(void); +extern void sysvid_FadeOut(void); +extern void sysvid_zoom(S8); +extern void sysvid_toggleFullscreen(void); +extern void sysvid_setGamePalette(void); +extern void sysvid_setPalette(img_color_t *, U16); +extern void sysvid_wait_vblank(); +/* + * events section + */ +extern void sysevt_poll(void); +extern void sysevt_wait(void); + +/* + * keyboard section + */ +extern U8 syskbd_up; +extern U8 syskbd_down; +extern U8 syskbd_left; +extern U8 syskbd_right; +extern U8 syskbd_pause; +extern U8 syskbd_end; +extern U8 syskbd_xtra; +extern U8 syskbd_fire; + +/* + * sound section + */ +#ifdef ENABLE_SOUND + +#ifdef IIGS +typedef int sound_t; + +/* + * Output from the Mr.Audio Bank packer + */ +enum { + SND_BOMBSHHT, + SND_BONUS, + SND_BOX, + SND_BULLET, + SND_CRAWL, + SND_DIE, + SND_ENT0, + SND_ENT1, + SND_ENT2, + SND_ENT3, + SND_ENT4, + SND_ENT6, + SND_ENT8, + SND_EXPLODE, + SND_JUMP, + SND_PAD, + SND_SBONUS1, + SND_SBONUS2, + SND_STICK, + SND_WALK, + + SND_MAX +}; + + +#else +typedef struct { +#ifdef DEBUG + char *name; +#endif + U8 *buf; + U32 len; + U8 dispose; +} sound_t; +#endif + +extern void syssnd_init(void); +extern void syssnd_shutdown(void); +extern void syssnd_vol(S8); +extern void syssnd_toggleMute(void); +#ifdef IIGS +extern S8 syssnd_play(sound_t, S8); +extern void syssnd_stopsound(sound_t); +extern int syssnd_isplaying(sound_t); +extern void syssnd_free(sound_t); +#else +extern S8 syssnd_play(sound_t *, S8); +extern void syssnd_stopsound(sound_t *); +extern int syssnd_isplaying(sound_t *); +extern void syssnd_free(sound_t *); +extern sound_t *syssnd_load(char *name); +#endif +extern void syssnd_pause(U8, U8); +extern void syssnd_stopchan(S8); +extern void syssnd_stopall(); +#endif + +/* + * args section + */ +extern int sysarg_args_period; +extern int sysarg_args_map; +extern int sysarg_args_submap; +extern int sysarg_args_fullscreen; +extern int sysarg_args_zoom; +#ifdef ENABLE_SOUND +extern int sysarg_args_nosound; +extern int sysarg_args_vol; +#endif +extern char *sysarg_args_data; + +extern void sysarg_init(int, char **); + +/* + * joystick section + */ +#ifdef ENABLE_JOYSTICK +extern void sysjoy_init(void); +extern void sysjoy_shutdown(void); +#endif + +#ifdef IIGS +// GS Hardware Registers +extern volatile char *VIDEO_REGISTER; + +// GS Specific Stuff +extern int LZ4_Unpack(char* pDest, char* pPackedSource); +extern volatile unsigned long* tick; + +// GS Rendering Stuff +extern void SetTileBank(short bank); +extern void DrawTile(int offset, U16 tileNo); +extern void SetSpriteBanks(short b0, short b1, short b2, short b3); +extern void DrawSprite(int offset, int SpriteNo); + +// Code for presenting backpage +extern void PresentPalette(void); +extern void PresentSCB(void); +extern void PresentFrameBuffer(void); +extern int BlitRect(U16 x, U16 y, U16 width, U16 height); +extern void wait_vsync(void); + +// ADB Support Code +extern char KeyArray[128]; +extern void RemoveKeyboardDriver(); +extern void AddKeyboardDriver(); + +// IIGS NTP Songs +extern char egypt_lz4; +extern char mbase_lz4; +extern char rick1_lz4; +extern char rick1victory_lz4; +extern char samerica_lz4; +extern char schwarz_lz4; + +#endif + +#endif + +/* eof */ + + diff --git a/include/sysvid.h b/include/sysvid.h new file mode 100644 index 0000000..621d59d --- /dev/null +++ b/include/sysvid.h @@ -0,0 +1,25 @@ +/* + * xrick/include/sysvid.h + * + * Copyright (C) 1998-2002 BigOrno (bigorno@bigorno.net). 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 _VIDEOEX_H +#define _VIDEOEX_H + +#include "system.h" + +extern U8 *sysvid_fb; /* frame buffer */ + +#endif + +/* eof */ + + diff --git a/include/tiles.h b/include/tiles.h new file mode 100644 index 0000000..31ff4ba --- /dev/null +++ b/include/tiles.h @@ -0,0 +1,82 @@ +/* + * xrick/include/tiles.h + * + * Copyright (C) 1998-2002 BigOrno (bigorno@bigorno.net). 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 "system.h" + +#ifdef GFXPC +#define TILES_NBR_BANKS 4 +#endif +#ifdef GFXST +#define TILES_NBR_BANKS 3 +#endif +#ifdef GFXGS +#define TILES_NBR_BANKS 3 +#endif +#ifdef GFXF256 /* TODO: revist this */ +#define TILES_NBR_BANKS 3 +#endif + + +#define TILES_SIZEOF8 (0x10) +#define TILES_SIZEOF16 (0x08) + +/* + * three special tile numbers + */ +#define TILES_BULLET 0x01 +#define TILES_BOMB 0x02 +#define TILES_RICK 0x03 + +/* + * one single tile + */ +#ifdef GFXPC +typedef U16 tile_t[TILES_SIZEOF16]; +#endif +#ifdef GFXST +typedef U32 tile_t[0x08]; +#endif +#ifdef GFXGS +typedef U32 tile_t[0x08]; +#endif +#ifdef GFXF256 +typedef U32 tile_t[0x08]; +#endif + + +/* + * tiles banks (each bank is 0x100 tiles) + */ +extern tile_t tiles_data[TILES_NBR_BANKS][0x100]; + +#endif + +/* eof */ diff --git a/include/unzip.h b/include/unzip.h new file mode 100644 index 0000000..0ccda6a --- /dev/null +++ b/include/unzip.h @@ -0,0 +1,277 @@ +/* unzip.h -- IO for uncompress .zip files using zlib + Version 0.15 beta, Mar 19th, 1998, + + Copyright (C) 1998 Gilles Vollant + + This unzip package allow extract file from .ZIP file, compatible with PKZip 2.04g + WinZip, InfoZip tools and compatible. + Encryption and multi volume ZipFile (span) are not supported. + Old compressions used by old PKZip 1.x are not supported + + THIS IS AN ALPHA VERSION. AT THIS STAGE OF DEVELOPPEMENT, SOMES API OR STRUCTURE + CAN CHANGE IN FUTURE VERSION !! + I WAIT FEEDBACK at mail info@winimage.com + Visit also http://www.winimage.com/zLibDll/unzip.htm for evolution + + Condition of use and distribution are the same than zlib : + + This software is provided 'as-is', without any express or implied + warranty. In no event will the authors be held liable for any damages + arising from the use of this software. + + Permission is granted to anyone to use this software for any purpose, + including commercial applications, and to alter it and redistribute it + freely, subject to the following restrictions: + + 1. The origin of this software must not be misrepresented; you must not + claim that you wrote the original software. If you use this software + in a product, an acknowledgment in the product documentation would be + appreciated but is not required. + 2. Altered source versions must be plainly marked as such, and must not be + misrepresented as being the original software. + 3. This notice may not be removed or altered from any source distribution. + + +*/ +/* for more info about .ZIP format, see + ftp://ftp.cdrom.com/pub/infozip/doc/appnote-970311-iz.zip + PkWare has also a specification at : + ftp://ftp.pkware.com/probdesc.zip */ + +#ifndef _unz_H +#define _unz_H + +#ifdef __cplusplus +extern "C" { +#endif + +#ifndef _ZLIB_H +#include "zlib.h" +#endif + +#if defined(STRICTUNZIP) || defined(STRICTZIPUNZIP) +/* like the STRICT of WIN32, we define a pointer that cannot be converted + from (void*) without cast */ +typedef struct TagunzFile__ { int unused; } unzFile__; +typedef unzFile__ *unzFile; +#else +typedef voidp unzFile; +#endif + + +#define UNZ_OK (0) +#define UNZ_END_OF_LIST_OF_FILE (-100) +#define UNZ_ERRNO (Z_ERRNO) +#define UNZ_EOF (0) +#define UNZ_PARAMERROR (-102) +#define UNZ_BADZIPFILE (-103) +#define UNZ_INTERNALERROR (-104) +#define UNZ_CRCERROR (-105) + +/* tm_unz contain date/time info */ +typedef struct tm_unz_s +{ + uInt tm_sec; /* seconds after the minute - [0,59] */ + uInt tm_min; /* minutes after the hour - [0,59] */ + uInt tm_hour; /* hours since midnight - [0,23] */ + uInt tm_mday; /* day of the month - [1,31] */ + uInt tm_mon; /* months since January - [0,11] */ + uInt tm_year; /* years - [1980..2044] */ +} tm_unz; + +/* unz_global_info structure contain global data about the ZIPfile + These data comes from the end of central dir */ +typedef struct unz_global_info_s +{ + uLong number_entry; /* total number of entries in + the central dir on this disk */ + uLong size_comment; /* size of the global comment of the zipfile */ +} unz_global_info; + + +/* unz_file_info contain information about a file in the zipfile */ +typedef struct unz_file_info_s +{ + uLong version; /* version made by 2 bytes */ + uLong version_needed; /* version needed to extract 2 bytes */ + uLong flag; /* general purpose bit flag 2 bytes */ + uLong compression_method; /* compression method 2 bytes */ + uLong dosDate; /* last mod file date in Dos fmt 4 bytes */ + uLong crc; /* crc-32 4 bytes */ + uLong compressed_size; /* compressed size 4 bytes */ + uLong uncompressed_size; /* uncompressed size 4 bytes */ + uLong size_filename; /* filename length 2 bytes */ + uLong size_file_extra; /* extra field length 2 bytes */ + uLong size_file_comment; /* file comment length 2 bytes */ + + uLong disk_num_start; /* disk number start 2 bytes */ + uLong internal_fa; /* internal file attributes 2 bytes */ + uLong external_fa; /* external file attributes 4 bytes */ + + tm_unz tmu_date; +} unz_file_info; + +extern unzFile ZEXPORT unzDup OF ((unzFile file)); + +extern int ZEXPORT unzStringFileNameCompare OF ((const char* fileName1, + const char* fileName2, + int iCaseSensitivity)); +/* + Compare two filename (fileName1,fileName2). + If iCaseSenisivity = 1, comparision is case sensitivity (like strcmp) + If iCaseSenisivity = 2, comparision is not case sensitivity (like strcmpi + or strcasecmp) + If iCaseSenisivity = 0, case sensitivity is defaut of your operating system + (like 1 on Unix, 2 on Windows) +*/ + + +extern unzFile ZEXPORT unzOpen OF((const char *path)); +/* + Open a Zip file. path contain the full pathname (by example, + on a Windows NT computer "c:\\zlib\\zlib111.zip" or on an Unix computer + "zlib/zlib111.zip". + If the zipfile cannot be opened (file don't exist or in not valid), the + return value is NULL. + Else, the return value is a unzFile Handle, usable with other function + of this unzip package. +*/ + +extern int ZEXPORT unzClose OF((unzFile file)); +/* + Close a ZipFile opened with unzipOpen. + If there is files inside the .Zip opened with unzOpenCurrentFile (see later), + these files MUST be closed with unzipCloseCurrentFile before call unzipClose. + return UNZ_OK if there is no problem. */ + +extern int ZEXPORT unzGetGlobalInfo OF((unzFile file, + unz_global_info *pglobal_info)); +/* + Write info about the ZipFile in the *pglobal_info structure. + No preparation of the structure is needed + return UNZ_OK if there is no problem. */ + + +extern int ZEXPORT unzGetGlobalComment OF((unzFile file, + char *szComment, + uLong uSizeBuf)); +/* + Get the global comment string of the ZipFile, in the szComment buffer. + uSizeBuf is the size of the szComment buffer. + return the number of byte copied or an error code <0 +*/ + + +/***************************************************************************/ +/* Unzip package allow you browse the directory of the zipfile */ + +extern int ZEXPORT unzGoToFirstFile OF((unzFile file)); +/* + Set the current file of the zipfile to the first file. + return UNZ_OK if there is no problem +*/ + +extern int ZEXPORT unzGoToNextFile OF((unzFile file)); +/* + Set the current file of the zipfile to the next file. + return UNZ_OK if there is no problem + return UNZ_END_OF_LIST_OF_FILE if the actual file was the latest. +*/ + +extern int ZEXPORT unzLocateFile OF((unzFile file, + const char *szFileName, + int iCaseSensitivity)); +/* + Try locate the file szFileName in the zipfile. + For the iCaseSensitivity signification, see unzStringFileNameCompare + + return value : + UNZ_OK if the file is found. It becomes the current file. + UNZ_END_OF_LIST_OF_FILE if the file is not found +*/ + + +extern int ZEXPORT unzGetCurrentFileInfo OF((unzFile file, + unz_file_info *pfile_info, + char *szFileName, + uLong fileNameBufferSize, + void *extraField, + uLong extraFieldBufferSize, + char *szComment, + uLong commentBufferSize)); +/* + Get Info about the current file + if pfile_info!=NULL, the *pfile_info structure will contain somes info about + the current file + if szFileName!=NULL, the filemane string will be copied in szFileName + (fileNameBufferSize is the size of the buffer) + if extraField!=NULL, the extra field information will be copied in extraField + (extraFieldBufferSize is the size of the buffer). + This is the Central-header version of the extra field + if szComment!=NULL, the comment string of the file will be copied in szComment + (commentBufferSize is the size of the buffer) +*/ + +/***************************************************************************/ +/* for reading the content of the current zipfile, you can open it, read data + from it, and close it (you can close it before reading all the file) + */ + +extern int ZEXPORT unzOpenCurrentFile OF((unzFile file)); +/* + Open for reading data the current file in the zipfile. + If there is no error, the return value is UNZ_OK. +*/ + +extern int ZEXPORT unzCloseCurrentFile OF((unzFile file)); +/* + Close the file in zip opened with unzOpenCurrentFile + Return UNZ_CRCERROR if all the file was read but the CRC is not good +*/ + + +extern int ZEXPORT unzReadCurrentFile OF((unzFile file, + voidp buf, + unsigned len)); +/* + Read bytes from the current file (opened by unzOpenCurrentFile) + buf contain buffer where data must be copied + len the size of buf. + + return the number of byte copied if somes bytes are copied + return 0 if the end of file was reached + return <0 with error code if there is an error + (UNZ_ERRNO for IO error, or zLib error for uncompress error) +*/ + +extern z_off_t ZEXPORT unztell OF((unzFile file)); +/* + Give the current position in uncompressed data +*/ + +extern int ZEXPORT unzeof OF((unzFile file)); +/* + return 1 if the end of file was reached, 0 elsewhere +*/ + +extern int ZEXPORT unzGetLocalExtrafield OF((unzFile file, + voidp buf, + unsigned len)); +/* + Read extra field from the current file (opened by unzOpenCurrentFile) + This is the local-header version of the extra field (sometimes, there is + more info in the local-header version than in the central-header) + + if buf==NULL, it return the size of the local extra field + + if buf!=NULL, len is the size of the buffer, the extra header is copied in + buf. + the return value is the number of bytes copied in buf, or (if <0) + the error code +*/ + +#ifdef __cplusplus +} +#endif + +#endif /* _unz_H */ diff --git a/include/util.h b/include/util.h new file mode 100644 index 0000000..82a0286 --- /dev/null +++ b/include/util.h @@ -0,0 +1,26 @@ +/* + * xrick/include/util.h + * + * Copyright (C) 1998-2002 BigOrno (bigorno@bigorno.net). 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 _UTIL_H +#define _UTIL_H + +#include "ents.h" + +extern void u_envtest(S16, S16, U8, U8 *, U8 *); +extern U8 u_boxtest(ent_t*, ent_t*); +extern U8 u_fboxtest(ent_t*, S16, S16); +extern U8 u_trigbox(ent_t* pEnt, S16, S16); + +#endif + +/* eof */