Commit 73434947 authored by CeRiAl's avatar CeRiAl

COMMON: Import of version #021212

parents
BACKSPACE
TAB
CLEAR
RETURN
PAUSE
ESCAPE
SPACE
EXCLAIM
QUOTEDBL
HASH
DOLLAR
AMPERSAND
QUOTE
LEFTPAREN
RIGHTPAREN
ASTERISK
PLUS
COMMA
MINUS
PERIOD
SLASH
0 ... 9
COLON
SEMICOLON
LESS
EQUALS
GREATER
QUESTION
AT
LEFTBRACKET
BACKSLASH
RIGHTBRACKET
CARET
UNDERSCORE
BACKQUOTE
a ... z
DELETE
WORLD_0 ... WODLD_95
KP0 ... KP9
KP_PERIOD
KP_DIVIDE
KP_MULTIPLY
KP_MINUS
KP_PLUS
KP_ENTER
KP_EQUALS
UP
DOWN
RIGHT
LEFT
INSERT
HOME
END
PAGEUP
PAGEDOWN
F1 ... F15
NUMLOCK
CAPSLOCK
SCROLLOCK
RSHIFT
LSHIFT
RCTRL
LCTRL
RALT
LALT
RMETA
LMETA
LSUPER
RSUPER
MODE
COMPOSE
HELP
PRINT
SYSREQ
BREAK
MENU
POWER
EURO
#
# xrick/Makefile
#
# 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.
#
#
# Vars
#
SDLVERSION=$(shell sdl-config --version 2>/dev/null)
ROOTDIR=$(shell pwd)
TARGET=$(shell uname -s | tr [a-z] [A-Z])
#
# Config
#
ifeq ($(strip $(SDLVERSION)),)
$(error SDL is missing)
else
$(warning Detected SDL version $(SDLVERSION))
endif
ifeq ($(strip $(SDLVERSION)),)
$(error SDL is missing)
endif
SDL_MAJ=$(word 1,$(subst ., ,$(SDLVERSION)))
SDL_MIN=$(word 2,$(subst ., ,$(SDLVERSION)))
SDL_MIC=$(word 3,$(subst ., ,$(SDLVERSION)))
SDL_MAJ_REQ=1
SDL_MIN_REQ=2
SDL_MIC_REQ=1
SDL_CHKVER=$(shell if [ $(SDL_MAJ) -lt $(SDL_MAJ_REQ) ]; then echo "BAD"; fi)
ifeq ($(SDL_CHKVER),BAD)
$(error SDL version $(SDL_MAJ_REQ).$(SDL_MIN_REQ).$(SDL_MIC_REQ) is required)
endif
SDL_CHKVER=$(shell if [ $(SDL_MAJ) -eq $(SDL_MAJ_REQ) -a $(SDL_MIN) -lt $(SDL_MIN_REQ) ]; then echo "BAD"; fi)
ifeq ($(SDL_CHKVER),BAD)
$(error SDL version $(SDL_MAJ_REQ).$(SDL_MIN_REQ).$(SDL_MIC_REQ) is required)
endif
SDL_CHKVER=$(shell if [ $(SDL_MAJ) -eq $(SDL_MAJ_REQ) -a $(SDL_MIN) -eq $(SDL_MIN_REQ) -a $(SDL_MIC) -lt $(SDL_MIC_REQ) ]; then echo "BAD"; fi)
ifeq ($(SDL_CHKVER),BAD)
$(error SDL version $(SDL_MAJ_REQ).$(SDL_MIN_REQ).$(SDL_MIC_REQ) is required)
endif
ifneq (,$(findstring CYGWIN,$(TARGET)))
XOBJ=xrick.res
endif
ifneq (,$(findstring MINGW,$(TARGET)))
XOBJ=xrick.res
endif
#
# Rules
#
all:
@echo "ROOTDIR=$(ROOTDIR)" > Makefile.global
@echo "XOBJ=$(XOBJ)" >> Makefile.global
@echo "CFLAGS=-g -ansi -pedantic -Wall -W -O2 -I $(ROOTDIR)/include $(shell sdl-config --cflags)" >> Makefile.global
@echo "LDFLAGS=-lz $(shell sdl-config --libs)" >> Makefile.global
@echo "CC=gcc" >> Makefile.global
@echo "CPP=gcc -E" >> Makefile.global
$(MAKE) -C src all
clean:
for i in src include; do \
$(MAKE) -C $$i clean; \
done
rm -f *~ log.txt Makefile.global
depend:
$(MAKE) -C src depend
# eof
**
xrick - version #021212
Copyright (C) 1998-2002 BigOrno (bigorno@bigorno.net)
http://www.bigorno.net/xrick/
** LICENSE AGREEMENT & LEGAL BABLE
I have written the xrick code. However, graphics and maps and sounds
are by the authors of the original Rick Dangerous game, and "Rick
Dangerous" remains a trademark of its owner(s) -- maybe Core Design
(who wrote the game) or FireBird (who published it). As of today, I
have not been successful at contacting Core Design.
This makes it a bit difficult to formally release the whole code,
including data for graphics and maps and sounds, under the terms of
licences such as the GNU General Public Licence. So the code is
released "in the spirit" of the GNU GPL. Whatever that means.
This program is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
or FITNESS FOR A PARTICULAR PURPOSE.
** HOWTO
Build: ./config; make
Usage: 'xrick -help' will tell you all about command-line options.
Controls:
- left, right, up (jump) or down (crawl): arrow keys or Z, X, O and K.
- fire: SPACE, end: E, pause: P, exit: ESC.
- use left, right, up, down + fire to poke something with your stick,
lay a stick of dynamite, or fire a bullet.
- toggle fullscreen: F1 ; zoom in/out: F2, F3.
- mute: F4 ; volume up/down: F5, F6.
- cheat modes, "trainer": F7 ; "never die": F8 ; "expose": F9.
More details at http://www.bigorno.net/xrick/.
Report problems, or ask questions, to bigorno@bigorno.net.
Enjoy!
**
File added
#
# xrick/include/Makefile
#
# 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.
#
#
# rules
#
#
clean:
rm -f *~
# eof
/*
* 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
/* version */
#define VERSION "021212"
/* graphics (choose one) */
#define GFXST
#undef GFXPC
/* joystick support */
#undef ENABLE_JOYSTICK
/* sound support */
#define 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 */
/*
* 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 */
/*
* 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 <stdio.h>
#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 */
/*
* 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 */
/*
* 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 */
/*
* 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 U8 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 */
/*
* 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(U8);
extern void e_bomb_init(U16, U16);
extern void e_bomb_action(U8);
#endif
/* eof */
/*
* 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(U8);
#endif
/* eof */
/*
* 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(U8);
#endif
/* eof */
/*
* 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 S8 e_bullet_offsx;
extern S16 e_bullet_xc, e_bullet_yc;
extern void e_bullet_init(U16, U16);
extern void e_bullet_action(U8);
#endif
/* eof */
/*
* 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(U8);
extern void e_rick_gozombie(void);
extern U8 e_rick_boxtest(U8);
#endif
/* eof */
/*
* 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(U8);
extern void e_sbonus_stop(U8);
#endif
/* eof */
/*
* 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(U8);
extern void e_them_t1b_action(U8);
extern void e_them_t2_action(U8);
extern void e_them_t3_action(U8);
extern void e_them_z_action(U8);
#endif
/* eof */
/*
* 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 */
/*
* 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 <stddef.h> /* 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
#define GAME_PERIOD 75
#define GAME_BOMBS_INIT 6
#define GAME_BULLETS_INIT 6
typedef struct {
U32 score;
U8 name[10];
} hscore_t;
extern U8 game_lives; /* lives counter */
extern U8 game_bombs; /* bombs counter */
extern U8 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 U8 game_dir; /* direction (LEFT, RIGHT) */
extern U8 game_chsm; /* change submap request (TRUE, FALSE) */
extern U8 game_waitevt; /* wait for events (TRUE, FALSE) */
extern U8 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 U8 game_cheat1; /* infinite lives, bombs and bullets */
extern U8 game_cheat2; /* never die */
extern U8 game_cheat3; /* highlight sprites */
extern void game_toggleCheat(U8);
#endif
#ifdef ENABLE_SOUND
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
#endif
/* eof */
/*
* 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;
typedef struct {
U16 w, h;
U16 ncolors;
img_color_t *colors;
U8 *pixels;
} img_t;
img_t *IMG_SPLASH;
#endif
/* eof */
/*
* 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 U8 map_frow;
/*
* tiles offset
*/
extern U8 map_tilesBank;
extern void map_expand(void);
extern void map_init(void);
extern U8 map_chain(void);
extern void map_resetMarks(void);
#endif
/* eof */
/*
* 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 */
/*
* 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 */
/*
* 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 */
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 */
#endif
/* eof */
/*
* 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 */
/*
* 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 */
/*
* 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 */
/*
* 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
/* 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 */
/* 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
#define SYSVID_WIDTH 320
#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_zoom(S8);
extern void sysvid_toggleFullscreen(void);
extern void sysvid_setGamePalette(void);
extern void sysvid_setPalette(img_color_t *, U16);
/*
* 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
typedef struct {
#ifdef DEBUG
char *name;
#endif
U8 *buf;
U32 len;
U8 dispose;
} sound_t;
extern void syssnd_init(void);
extern void syssnd_shutdown(void);
extern void syssnd_vol(S8);
extern void syssnd_toggleMute(void);
extern S8 syssnd_play(sound_t *, S8);
extern void syssnd_pause(U8, U8);
extern void syssnd_stopchan(S8);
extern void syssnd_stopsound(sound_t *);
extern void syssnd_stopall();
extern int syssnd_isplaying(sound_t *);
extern sound_t *syssnd_load(char *name);
extern void syssnd_free(sound_t *);
#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
#endif
/* eof */
/*
* 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 */
/*
* 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
#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
/*
* tiles banks (each bank is 0x100 tiles)
*/
extern tile_t tiles_data[TILES_NBR_BANKS][0x100];
#endif
/* eof */
This diff is collapsed.
/*
* 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
extern void u_envtest(S16, S16, U8, U8 *, U8 *);
extern U8 u_boxtest(U8, U8);
extern U8 u_fboxtest(U8, S16, S16);
extern U8 u_trigbox(U8, S16, S16);
#endif
/* eof */
#
# xrick/src/Makefile
#
# 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.
#
#
# Includes
#
#
ifeq (.depend, $(wildcard .depend))
include .depend
endif
ifeq (../Makefile.global, $(wildcard ../Makefile.global))
include ../Makefile.global
else
$(error Oops)
endif
#
# Defs
#
#
TARGET = ../xrick
OBJECTS = unzip.o data.o scr_xrick.o scr_pause.o scr_imain.o scr_imap.o scr_gameover.o scr_getname.o dat_picsPC.o dat_picsST.o dat_screens.o dat_tilesPC.o dat_tilesST.o dat_maps.o dat_ents.o dat_spritesST.o dat_spritesPC.o ents.o e_bullet.o e_bomb.o e_rick.o e_sbonus.o e_them.o e_bonus.o e_box.o rects.o util.o game.o xrick.o draw.o maps.o sysvid.o syskbd.o control.o system.o scroller.o sysevt.o sysarg.o syssnd.o sysjoy.o dat_snd.o
#
# Rules
#
#
all: $(TARGET)
$(TARGET): $(OBJECTS) $(XOBJ)
$(CC) $(OBJECTS) $(XOBJ) $(LDFLAGS) -o $(TARGET)
%.o: %.c
$(CC) $(CFLAGS) -c $< -o $@
xrick.res: xrick.rc
windres $< -O coff -o $@
clean:
rm -f *~ *.o core .depend $(TARGET)
rm -f *.exe *.core *.res
rm -f $(LINKS)
depend:
for i in *.c; do $(CPP) $(CFLAGS) -I$(ROOTDIR)/include -MM $$i; done > .depend
# eof
/*
* xrick/src/control.c
*
* 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.
*/
#include "config.h"
#include "system.h"
#include "game.h"
U8 control_status = 0;
U8 control_last = 0;
U8 control_active = TRUE;
/* eof */
This diff is collapsed.
This diff is collapsed.
/*
* xrick/data/dat_picsPC.c
*
* 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.
*/
#include "config.h"
#ifdef GFXPC
#include "system.h"
#include "pics.h"
#endif /* GFXPC */
/* eof */
This diff is collapsed.
/*
* xrick/src/scr_data.c
*
* 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.
*/
#include "system.h"
#include "screens.h"
/*
* map intro, sprites lists
*/
U8 screen_imapsl[] = {
0x1b, 0x00,
0x1c, 0x1d, 0x00,
0x01, 0x00,
0x02, 0x03, 0x04, 0x05, 0x06, 0x00,
0x1e, 0x00,
0x0d, 0x00,
0x13, 0x14, 0x00,
0x1f, 0x00
};
/*
* map intro, steps
*/
screen_imapsteps_t screen_imapsteps[] = {
{ 0x0000, 0x0002, 0x0002, 0x0000 },
{ 0x000b, 0x0000, 0x0001, 0x0000 },
{ 0x0008, 0x0001, 0x0000, 0x0002 },
{ 0x0000, 0x0000, 0x000c, 0x0000 },
{ 0x000a, 0x0000, 0x0000, 0x0005 },
{ 0x0006, 0x0002, 0x0000, 0x0007 },
{ 0x0005, 0x0000, 0x0000, 0x0005 },
{ 0x0000, 0x0006, 0x0000, 0x0000 },
{ 0x000c, 0x0000, 0x0001, 0x0000 },
{ 0x0005, 0x0000, 0x0000, 0x000d },
{ 0x0000, 0x000c, 0x000c, 0x0000 },
{ 0x0005, 0x0000, 0x0000, 0x0005 },
{ 0x000a, 0x0000, 0x0000, 0x000f },
{ 0x000c, 0xffff, 0x0000, 0x0011 },
{ 0x0005, 0x0000, 0x0000, 0x000f },
{ 0x0000, 0x0006, 0x0001, 0x0000 },
{ 0x000a, 0x0000, 0x0000, 0x0014 },
{ 0x0006, 0x0000, 0x0001, 0x0014 },
{ 0x0005, 0x0000, 0x0000, 0x0014 },
{ 0x0003, 0x0001, 0x0000, 0x0014 },
{ 0x0006, 0xffff, 0x0000, 0x0014 },
{ 0x0003, 0x0000, 0xffff, 0x0014 },
{ 0x0000, 0x0000, 0x0000, 0x0000 }
};
/*
* map intro, step offset per map
*/
U8 screen_imapsofs[] = {
0x00, 0x03, 0x07, 0x0a, 0x0f
};
/*
* map intro, text
* (from ds + 0x8810 + 0x2000, 0x2138, 0x2251, 0x236a, 0x2464)
*
* \376=0xfe \377=0xff
*/
U8 screen_imaptext_amazon[] = "\
@@@@@SOUTH@AMERICA@1945@@@@@@@\377\
RICK@DANGEROUS@CRASH@LANDS@HIS\377\
@PLANE@OVER@THE@AMAZON@WHILE@@\377\
@SEARCHING@FOR@THE@LOST@GOOLU@\377\
@@@@@@@@@@@@TRIBE.@@@@@@@@@@@@\377\377\
@BUT,@BY@A@TERRIBLE@TWIST@OF@@\377\
FATE@HE@LANDS@IN@THE@MIDDLE@OF\377\
@@@A@BUNCH@OF@WILD@GOOLUS.@@@@\377\377\
@@CAN@RICK@ESCAPE@THESE@ANGRY@\377\
@@@AMAZONIAN@ANTAGONISTS@?@@@@\376";
U8 screen_imaptext_egypt[] = "\
@@@@EGYPT,@SOMETIMES@LATER@@@@\377\
RICK@HEADS@FOR@THE@PYRAMIDS@AT\377\
@@@@THE@REQUEST@OF@LONDON.@@@@\377\377\
HE@IS@TO@RECOVER@THE@JEWEL@OF@\377\
ANKHEL@THAT@HAS@BEEN@STOLEN@BY\377\
FANATICS@WHO@THREATEN@TO@SMASH\377\
@IT,@IF@A@RANSOM@IS@NOT@PAID.@\377\377\
CAN@RICK@SAVE@THE@GEM,@OR@WILL\377\
HE@JUST@GET@A@BROKEN@ANKHEL@?@\376";
U8 screen_imaptext_castle[] = "\
@@@@EUROPE,@LATER@THAT@WEEK@@@\377\
@@RICK@RECEIVES@A@COMMUNIQUE@@\377\
@@FROM@BRITISH@INTELLIGENCE@@@\377\
@@ASKING@HIM@TO@RESCUE@ALLIED@\377\
@PRISONERS@FROM@THE@NOTORIOUS@\377\
@@@@SCHWARZENDUMPF@CASTLE.@@@@\377\377\
@@RICK@ACCEPTS@THE@MISSION.@@@\377\377\
@@@BUT@CAN@HE@LIBERATE@THE@@@@\377\
@CRUELLY@CAPTURED@COOMANDOS@?@\376";
U8 screen_imaptext_missile[] = "\
@@@@@@EUROPE,@EVEN@LATER@@@@@@\377\
RICK@LEARNS@FROM@THE@PRISONERS\377\
@THAT@THE@ENEMY@ARE@TO@LAUNCH@\377\
AN@ATTACK@ON@LONDON@FROM@THEIR\377\
@@@@@SECRET@MISSILE@BASE.@@@@@\377\377\
WITHOUT@HESITATION,@HE@DECIDES\377\
@@@TO@INFILTRATE@THE@BASE.@@@@\377\377\
CAN@RICK@SAVE@LONDON@IN@TIME@?\376";
U8 screen_imaptext_muchlater[] = "\
@@@LONDON,@MUCH,@MUCH@LATER@@@\377\
@RICK@RETURNS@TO@A@TRIUMPHANT@\377\
@@WELCOME@HOME@HAVING@HELPED@@\377\
@@@@SECURE@ALLIED@VICTORY.@@@@\377\377\
BUT,@MEANWHILE,@IN@SPACE,@THE@\377\
@@@MASSED@STARSHIPS@OF@THE@@@@\377\
@@@BARFIAN@EMPIRE@ARE@POISED@@\377\
@@@@@TO@INVADE@THE@EARTH.@@@@@\377\377\
@WHAT@WILL@RICK@DO@NEXT@...@?@\376";
U8 *screen_imaptext[5] =
{ screen_imaptext_amazon,
screen_imaptext_egypt,
screen_imaptext_castle,
screen_imaptext_missile,
screen_imaptext_muchlater
};
/*
* main intro, hall of fame title
* (from ds + 0x8810 + 0x2642)
*/
U8 screen_imainhoft[] =
{ 0x2f, 0x2f, 0x2f, 0x2f, 0x2f, 0xd4, 0xb7, 0xb1,
0xac, 0xc6, 0x2f, 0xc6, 0x2f, 0x2f, 0xa4, 0xac,
0x9b, 0xc1, 0x2f, 0x9b, 0xc1, 0xb1, 0xac, 0xb6,
0xbd, 0x9b, 0xc1, 0x2f, 0x2f, 0x2f, 0x2f, 0x2f,
0xff,
0x2f, 0x2f, 0x2f, 0x2f, 0x2f, 0xb2, 0xb3, 0xb2,
0xb3, 0xad, 0x2f, 0xad, 0x2f, 0x2f, 0xa6, 0xae,
0xc2, 0xc3, 0x2f, 0xc2, 0xc3, 0xb2, 0xb3, 0xbe,
0xbf, 0xc2, 0xc3, 0x2f, 0x2f, 0x2f, 0x2f, 0x2f,
0xff,
0x2f, 0x2f, 0x2f, 0x2f, 0x2f, 0x9f, 0xc0, 0xb4,
0xb5, 0xaf, 0xc4, 0xaf, 0xc4, 0x2f, 0xa7, 0xb0,
0xb4, 0x2f, 0x2f, 0xb4, 0x2f, 0xb4, 0xb5, 0xb4,
0xb5, 0xaf, 0xc4, 0x2f, 0x2f, 0x2f, 0x2f, 0x2f,
0xfe
};
/*
* main intro, Rick Dangerous title
* (from ds + 0x8810 + 0x27a1)
*/
U8 screen_imainrdt[] =
{ 0x2f, 0x2f, 0x2f, 0x9b, 0x9c, 0xa1, 0xa4, 0xa5,
0xa9, 0xaa, 0x2f, 0x9b, 0xac, 0xb1, 0xac, 0xb6,
0xb7, 0xa4, 0xa5, 0x9b, 0xc1, 0x9b, 0x9c, 0xa4,
0xac, 0xc6, 0xc7, 0xc8, 0xc9, 0x2f, 0x2f, 0x2f,
0xff,
0x2f, 0x2f, 0x2f, 0x9d, 0x9e, 0xa2, 0xa6, 0x2f,
0x9d, 0xab, 0x2f, 0xad, 0xae, 0xb2, 0xb3, 0xb8,
0xb9, 0xa6, 0xbb, 0xc2, 0xc3, 0x9d, 0x9e, 0xa6,
0xae, 0xad, 0xae, 0xca, 0xcb, 0x2f, 0x2f, 0x2f,
0xff,
0x2f, 0x2f, 0x2f, 0x9f, 0xa0, 0xa3, 0xa7, 0xa8,
0x9f, 0xa0, 0x2f, 0xaf, 0xb0, 0xb4, 0xb5, 0x9f,
0xba, 0xa7, 0xbc, 0xaf, 0xc4, 0x9f, 0xa0, 0xa7,
0xb0, 0xc5, 0xb0, 0xcc, 0xb0, 0x2f, 0x2f, 0x2f,
0xfe
};
/*
* congratulations
* (from ds + 0x8810 + 0x257d)
*/
U8 screen_congrats[] =
{ 0xa4, 0xa5, 0xa4, 0xac, 0xb6, 0xb7, 0xa4, 0xa5,
0x9b, 0x9c, 0xb1, 0xac, 0xcd, 0xce, 0xc6, 0xc7,
0xd3, 0x2f, 0xb1, 0xac, 0xcd, 0xce, 0xa1, 0xa4,
0xac, 0xb6, 0xb7, 0xc8, 0xc9, 0x2f, 0xd5, 0xd6,
0xff,
0xa6, 0x2f, 0xa6, 0xae, 0xb8, 0xb9, 0xa6, 0xbb,
0x9d, 0x9e, 0xb2, 0xb3, 0xcf, 0xd0, 0xad, 0xae,
0xad, 0x2f, 0xb2, 0xb3, 0xcf, 0xd0, 0xa2, 0xa6,
0xae, 0xb8, 0xb9, 0xca, 0xcb, 0x2f, 0xd7, 0xd8,
0xff,
0xa7, 0xa8, 0xa7, 0xb0, 0x9f, 0xba, 0xa7, 0xbc,
0x9f, 0xa0, 0xb4, 0xb5, 0xd1, 0xd2, 0xc5, 0xb0,
0xaf, 0xc4, 0xb4, 0xb5, 0xd1, 0xd2, 0xa3, 0xa7,
0xb0, 0x9f, 0xba, 0xcc, 0xb0, 0x2f, 0xd9, 0xda,
0xfe
};
/*
* main intro, Core Design copyright text
* (from ds + 0x8810 + 0x2288)
*
* \376=0xfe \377=0xff
*/
U8 screen_imaincdc[] = "\
@@@@@@@@@@@@@@@@@@@\377\377\
(C)@1989@CORE@DESIGN\377\377\377\
@PRESS@SPACE@TO@START\376";
/*
* gameover
* (from ds + 0x8810 + 0x2864)
*
* \376=0xfe \377=0xff
*/
U8 screen_gameovertxt[] = "\
@@@@@@@@@@@\377\
@GAME@OVER@\377\
@@@@@@@@@@@\376";
/*
* paused
*
* \376=0xfe \377=0xff
*/
U8 screen_pausedtxt[] = "\
@@@@@@@@@@\377\
@@PAUSED@@\377\
@@@@@@@@@@\376";
/* eof */
/*
* xrick/data/dat_snd.c
*
* 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.
*/
#include "config.h"
#ifdef ENABLE_SOUND
#include "system.h"
sound_t *WAV_WAA;
sound_t *WAV_BOMB;
sound_t *WAV_BULLET;
sound_t *WAV_WALK;
sound_t *WAV_JUMP;
sound_t *WAV_TING;
sound_t *WAV_BOMBSHHT;
sound_t *WAV_BONUS;
sound_t *WAV_SHHT;
sound_t *WAV_BOX;
sound_t *WAV_DDDING;
#endif /* ENABLE_SOUND */
/* eof */
This diff is collapsed.
This diff is collapsed.
This source diff could not be displayed because it is too large. You can view the blob instead.
This diff is collapsed.
/*
* xrick/src/data.c
*
* 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.
*/
#include <stdlib.h> /* malloc */
#include <string.h>
#include "system.h"
#include "data.h"
#include "unzip.h"
/*
* Private typedefs
*/
typedef struct {
char *name;
unzFile zip;
} zipped_t;
typedef struct {
char *name;
unzFile zip;
} path_t;
/*
* Static variables
*/
static path_t path;
/*
* Prototypes
*/
static int str_zipext(char *);
static char *str_dup(char *);
static char *str_slash(char *);
/*
*
*/
void
data_setpath(char *name)
{
unzFile zip;
char *n;
if (str_zipext(name)) {
/* path has .zip extension */
n = str_slash(str_dup(name));
zip = unzOpen(n);
if (!zip) {
free(n);
sys_panic("(data) can not open data");
} else {
path.zip = zip;
path.name = n;
}
} else {
/* path has no .zip extension. it should be a directory */
/* FIXME check that it is a valid directory */
path.zip = NULL;
path.name = str_dup(name);
}
}
/*
*
*/
void
data_closepath()
{
if (path.zip) {
unzClose(path.zip);
path.zip = NULL;
}
free(path.name);
path.name = NULL;
}
/*
* Open a data file.
*/
data_file_t *
data_file_open(char *name)
{
char *n;
FILE *fh;
zipped_t *z;
if (path.zip) {
z = malloc(sizeof(zipped_t));
z->name = strdup(name);
z->zip = unzDup(path.zip);
if (unzLocateFile(z->zip, name, 0) != UNZ_OK ||
unzOpenCurrentFile(z->zip) != UNZ_OK) {
unzClose(z->zip);
z = NULL;
}
return (data_file_t *)z;
} else {
n = malloc(strlen(path.name) + strlen(name) + 2);
sprintf(n, "%s/%s", path.name, name);
str_slash(n);
fh = fopen(n, "rb");
return (data_file_t *)fh;
}
}
int
data_file_size(data_file_t *file)
{
int s;
if (path.zip) {
/* not implemented */
} else {
fseek((FILE *)file, 0, SEEK_END);
s = ftell((FILE *)file);
fseek((FILE *)file, 0, SEEK_SET);
}
return s;
}
/*
* Seek.
*/
int
data_file_seek(data_file_t *file, long offset, int origin)
{
if (path.zip) {
/* not implemented */
return -1;
} else {
return fseek((FILE *)file, offset, origin);
}
}
/*
* Tell.
*/
int
data_file_tell(data_file_t *file)
{
if (path.zip) {
/* not implemented */
return -1;
} else {
return ftell((FILE *)file);
}
}
/*
* Read a file within a data archive.
*/
int
data_file_read(data_file_t *file, void *buf, size_t size, size_t count)
{
if (path.zip) {
return unzReadCurrentFile(((zipped_t *)file)->zip, buf, size * count) / size;
} else {
return fread(buf, size, count, (FILE *)file);
}
}
/*
* Close a file within a data archive.
*/
void
data_file_close(data_file_t *file)
{
if (path.zip) {
unzClose(((zipped_t *)file)->zip);
((zipped_t *)file)->zip = NULL;
free(((zipped_t *)file)->name);
((zipped_t *)file)->name = NULL;
} else {
fclose((FILE *)file);
}
}
/*
* Returns 1 if filename has .zip extension.
*/
static int
str_zipext(char *name)
{
int i;
i = strlen(name) - 1;
if (i < 0 || name[i] != 'p' && name[i] != 'P') return 0;
i--;
if (i < 0 || name[i] != 'i' && name[i] != 'I') return 0;
i--;
if (i < 0 || name[i] != 'z' && name[i] != 'Z') return 0;
i--;
if (i < 0 || name[i] != '.') return 0;
i--;
if (i < 0) return 0;
return 1;
}
/*
*
*/
static char *
str_dup(char *s)
{
char *s1;
int i;
i = strlen(s) + 1;
s1 = malloc(i);
strncpy(s1, s, i);
return s1;
}
static char *
str_slash(char *s)
{
#ifdef __WIN32__
int i, l;
l = strlen(s);
for (i = 0; i < l; i++)
if (s[i] == '/') s[i] = '\\';
#endif
return s;
}
/* eof */
/*
* xrick/src/scr_devtools.c
*
* 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.
*/
#include "config.h"
#ifdef ENABLE_DEVTOOLS
#include "system.h"
#include "game.h"
#include "control.h"
#include "screens.h"
#include "draw.h"
#include "sprites.h"
#include "maps.h"
/*
* DevTools
*/
U8
devtools_run(void)
{
static U8 seq = 0;
static U8 pos = 0;
static U8 pos2 = 0;
U8 i, j, k, l;
U8 s[128];
if (seq == 0) {
sysvid_clear();
game_rects = &draw_SCREENRECT;
#ifdef GFXPC
draw_filter = 0xffff;
#endif
seq = 1;
}
switch (seq) {
case 1: /* draw tiles */
sysvid_clear();
draw_tilesBank = 0;
sprintf(s, "TILES@BANK@%d\376", pos);
draw_setfb(4, 4);
draw_tilesListImm(s);
k = 0;
for (i = 0; i < 0x10; i++) {
draw_setfb(80 + i * 0x0a, 14);
draw_tile((i<10?0x30:'A'-10) + i);
draw_setfb(64, 30 + i * 0x0a);
draw_tile((i<10?0x30:'A'-10) + i);
}
draw_tilesBank = pos;
for (i = 0; i < 0x10; i++)
for (j = 0; j < 0x10; j++) {
draw_setfb(80 + j * 0x0a, 30 + i * 0x0a);
draw_tile(k++);
}
seq = 10;
break;
case 10: /* wait for key pressed */
if (control_status & CONTROL_FIRE)
seq = 98;
if (control_status & CONTROL_UP)
seq = 12;
if (control_status & CONTROL_DOWN)
seq = 13;
if (control_status & CONTROL_RIGHT)
seq = 11;
break;
case 11: /* wait for key released */
if (!(control_status & CONTROL_RIGHT)) {
pos = 0;
seq = 21;
}
break;
case 12: /* wait for key released */
if (!(control_status & CONTROL_UP)) {
if (pos < 4) pos++;
seq = 1;
}
break;
case 13: /* wait for key released */
if (!(control_status & CONTROL_DOWN)) {
if (pos > 0) pos--;
seq = 1;
}
break;
case 21: /* draw sprites */
sysvid_clear();
draw_tilesBank = 0;
sprintf(s, "SPRITES\376");
draw_setfb(4, 4);
draw_tilesListImm(s);
for (i = 0; i < 8; i++) {
draw_setfb(0x08 + 0x20 + i * 0x20, 0x30 - 26);
draw_tile((i<10?0x30:'A'-10) + i);
draw_setfb(0x08 + 0x20 + i * 0x20, 0x30 - 16);
draw_tile((i+8<10?0x30:'A'-10) + i+8);
}
for (i = 0; i < 4; i++) {
k = pos + i * 8;
draw_setfb(0x20 - 16, 0x08 + 0x30 + i * 0x20);
j = k%16;
k /= 16;
draw_tile((j<10?0x30:'A'-10) + j);
draw_setfb(0x20 - 26, 0x08 + 0x30 + i * 0x20);
j = k%16;
draw_tile((j<10?0x30:'A'-10) + j);
}
k = pos;
for (i = 0; i < 4; i++)
for (j = 0; j < 8; j++) {
draw_sprite(k++, 0x20 + j * 0x20, 0x30 + i * 0x20);
}
seq = 30;
break;
case 30: /* wait for key pressed */
if (control_status & CONTROL_FIRE)
seq = 98;
if (control_status & CONTROL_UP)
seq = 32;
if (control_status & CONTROL_DOWN)
seq = 33;
if (control_status & CONTROL_LEFT)
seq = 31;
if (control_status & CONTROL_RIGHT)
seq = 40;
break;
case 31: /* wait for key released */
if (!(control_status & CONTROL_LEFT)) {
pos = 0;
seq = 1;
}
break;
case 32: /* wait for key released */
if (!(control_status & CONTROL_UP)) {
if (pos < SPRITES_NBR_SPRITES - 32) pos += 32;
seq = 21;
}
break;
case 33: /* wait for key released */
if (!(control_status & CONTROL_DOWN)) {
if (pos > 0) pos -= 32;
seq = 21;
}
break;
case 40:
sysvid_clear();
#ifdef GFXPC
if (pos2 == 0) pos2 = 2;
#endif
#ifdef GFXST
if (pos2 == 0) pos2 = 1;
#endif
sprintf(s, "BLOCKS@%#04X@TO@%#04X@WITH@BANK@%d\376",
pos, pos + 4*8-1, pos2);
draw_setfb(4, 4);
draw_tilesBank = 0;
draw_tilesListImm(s);
draw_tilesBank = pos2;
for (l = 0; l < 8; l++)
for (k = 0; k < 4; k++)
for (i = 0; i < 4; i++)
for (j = 0; j < 4; j++) {
draw_setfb(20 + j * 8 + l * 36, 30 + i * 8 + k * 36);
draw_tile(map_blocks[pos + l + k * 8][i * 4 + j]);
}
seq = 41;
break;
case 41:
if (control_status & CONTROL_FIRE)
seq = 98;
if (control_status & CONTROL_UP)
seq = 42;
if (control_status & CONTROL_DOWN)
seq = 43;
if (control_status & CONTROL_LEFT)
seq = 44;
if (control_status & CONTROL_PAUSE)
seq = 45;
break;
case 42:
if (!(control_status & CONTROL_UP)) {
if (pos < MAP_NBR_BLOCKS - 8*4) pos += 8 * 4;
seq = 40;
}
break;
case 43:
if (!(control_status & CONTROL_DOWN)) {
if (pos > 0) pos -= 8 * 4;
seq = 40;
}
break;
case 44:
if (!(control_status & CONTROL_LEFT)) {
pos = 0;
pos2 = 0;
seq = 21;
}
break;
case 45:
if (!(control_status & CONTROL_PAUSE)) {
#ifdef GFXPC
if (pos2 == 2) pos2 = 3;
else pos2 = 2;
#endif
#ifdef GFXST
if (pos2 == 1) pos2 = 2;
else pos2 = 1;
#endif
seq = 40;
}
break;
case 98: /* wait for key released */
if (!(control_status & CONTROL_FIRE))
seq = 99;
break;
}
if (control_status & CONTROL_EXIT) /* check for exit request */
return SCREEN_EXIT;
if (seq == 99) { /* we're done */
sysvid_clear();
seq = 0;
return SCREEN_DONE;
}
return SCREEN_RUNNING;
}
#endif /* ENABLE_DEVTOOLS */
/* eof */
This diff is collapsed.
/*
* xrick/src/e_bomb.c
*
* 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.
*/
#include "system.h"
#include "game.h"
#include "ents.h"
#include "e_bomb.h"
#include "e_rick.h"
/*
* public vars (for performance reasons)
*/
U8 e_bomb_lethal;
U8 e_bomb_xc;
U16 e_bomb_yc;
/*
* private vars
*/
U8 e_bomb_ticker;
/*
* Bomb hit test
*
* ASM 11CD
* returns: TRUE/hit, FALSE/not
*/
U8 e_bomb_hit(U8 e)
{
if (ent_ents[e].x > (E_BOMB_ENT.x >= 0xE0 ? 0xFF : E_BOMB_ENT.x + 0x20))
return FALSE;
if (ent_ents[e].x + ent_ents[e].w < (E_BOMB_ENT.x > 0x04 ? E_BOMB_ENT.x - 0x04 : 0))
return FALSE;
if (ent_ents[e].y > (E_BOMB_ENT.y + 0x1D))
return FALSE;
if (ent_ents[e].y + ent_ents[e].h < (E_BOMB_ENT.y > 0x0004 ? E_BOMB_ENT.y - 0x0004 : 0))
return FALSE;
return TRUE;
}
/*
* Initialize bomb
*/
void e_bomb_init(U16 x, U16 y)
{
E_BOMB_ENT.n = 0x03;
E_BOMB_ENT.x = x;
E_BOMB_ENT.y = y;
e_bomb_ticker = E_BOMB_TICKER;
e_bomb_lethal = FALSE;
/*
* Atari ST dynamite sprites are not centered the
* way IBM PC sprites were ... need to adjust things a little bit
*/
#ifdef GFXST
E_BOMB_ENT.x += 4;
E_BOMB_ENT.y += 5;
#endif
}
/*
* Entity action
*
* ASM 18CA
*/
void
e_bomb_action(UNUSED(U8 e))
{
/* tick */
e_bomb_ticker--;
if (e_bomb_ticker == 0)
{
/*
* end: deactivate
*/
E_BOMB_ENT.n = 0;
e_bomb_lethal = FALSE;
}
else if (e_bomb_ticker >= 0x0A)
{
/*
* ticking
*/
#ifdef ENABLE_SOUND
if ((e_bomb_ticker & 0x03) == 0x02)
syssnd_play(WAV_BOMBSHHT, 1);
#endif
#ifdef GFXST
/* ST bomb sprites sequence is longer */
if (e_bomb_ticker < 40)
E_BOMB_ENT.sprite = 0x99 + 19 - (e_bomb_ticker >> 1);
else
#endif
E_BOMB_ENT.sprite = (e_bomb_ticker & 0x01) ? 0x23 : 0x22;
}
else if (e_bomb_ticker == 0x09)
{
/*
* explode
*/
#ifdef ENABLE_SOUND
syssnd_play(WAV_EXPLODE, 1);
#endif
#ifdef GFXPC
E_BOMB_ENT.sprite = 0x24 + 4 - (e_bomb_ticker >> 1);
#endif
#ifdef GFXST
/* See above: fixing alignment */
E_BOMB_ENT.x -= 4;
E_BOMB_ENT.y -= 5;
E_BOMB_ENT.sprite = 0xa8 + 4 - (e_bomb_ticker >> 1);
#endif
e_bomb_xc = E_BOMB_ENT.x + 0x0C;
e_bomb_yc = E_BOMB_ENT.y + 0x000A;
e_bomb_lethal = TRUE;
if (e_bomb_hit(E_RICK_NO))
e_rick_gozombie();
}
else
{
/*
* exploding
*/
#ifdef GFXPC
E_BOMB_ENT.sprite = 0x24 + 4 - (e_bomb_ticker >> 1);
#endif
#ifdef GFXST
E_BOMB_ENT.sprite = 0xa8 + 4 - (e_bomb_ticker >> 1);
#endif
/* exploding, hence lethal */
if (e_bomb_hit(E_RICK_NO))
e_rick_gozombie();
}
}
/* eof */
/*
* xrick/src/e_bonus.c
*
* 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.
*/
#include "system.h"
#include "game.h"
#include "ents.h"
#include "e_bonus.h"
#include "e_rick.h"
#include "maps.h"
/*
* Entity action
*
* ASM 242C
*/
void
e_bonus_action(U8 e)
{
#define seq c1
if (ent_ents[e].seq == 0) {
if (e_rick_boxtest(e)) {
game_score += 500;
#ifdef ENABLE_SOUND
syssnd_play(WAV_BONUS, 1);
#endif
map_marks[ent_ents[e].mark].ent |= MAP_MARK_NACT;
ent_ents[e].seq = 1;
ent_ents[e].sprite = 0xad;
ent_ents[e].front = TRUE;
ent_ents[e].y -= 0x08;
}
}
else if (ent_ents[e].seq > 0 && ent_ents[e].seq < 10) {
ent_ents[e].seq++;
ent_ents[e].y -= 2;
}
else {
ent_ents[e].n = 0;
}
}
/* eof */
/*
* xrick/src/e_box.c
*
* 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.
*/
#include "system.h"
#include "game.h"
#include "ents.h"
#include "e_box.h"
#include "e_bullet.h"
#include "e_bomb.h"
#include "e_rick.h"
#include "maps.h"
#include "util.h"
/*
* FIXME this is because the same structure is used
* for all entities. Need to replace this w/ an inheritance
* solution.
*/
#define cnt c1
/*
* Constants
*/
#define SEQ_INIT 0x0A
/*
* Prototypes
*/
static void explode(U8);
/*
* Entity action
*
* ASM 245A
*/
void
e_box_action(U8 e)
{
static U8 sp[] = {0x24, 0x25, 0x26, 0x27, 0x28}; /* explosion sprites sequence */
if (ent_ents[e].n & ENT_LETHAL) {
/*
* box is lethal i.e. exploding
* play sprites sequence then stop
*/
ent_ents[e].sprite = sp[ent_ents[e].cnt >> 1];
if (--ent_ents[e].cnt == 0) {
ent_ents[e].n = 0;
map_marks[ent_ents[e].mark].ent |= MAP_MARK_NACT;
}
} else {
/*
* not lethal: check to see if triggered
*/
if (e_rick_boxtest(e)) {
/* rick: collect bombs or bullets and stop */
#ifdef ENABLE_SOUND
syssnd_play(WAV_BOX, 1);
#endif
if (ent_ents[e].n == 0x10)
game_bombs = GAME_BOMBS_INIT;
else /* 0x11 */
game_bullets = GAME_BULLETS_INIT;
ent_ents[e].n = 0;
map_marks[ent_ents[e].mark].ent |= MAP_MARK_NACT;
}
else if (E_RICK_STTST(E_RICK_STSTOP) &&
u_fboxtest(e, e_rick_stop_x, e_rick_stop_y)) {
/* rick's stick: explode */
explode(e);
}
else if (E_BULLET_ENT.n && u_fboxtest(e, e_bullet_xc, e_bullet_yc)) {
/* bullet: explode (and stop bullet) */
E_BULLET_ENT.n = 0;
explode(e);
}
else if (e_bomb_lethal && e_bomb_hit(e)) {
/* bomb: explode */
explode(e);
}
}
}
/*
* Explode when
*/
static void explode(U8 e)
{
ent_ents[e].cnt = SEQ_INIT;
ent_ents[e].n |= ENT_LETHAL;
#ifdef ENABLE_SOUND
syssnd_play(WAV_EXPLODE, 1);
#endif
}
/* eof */
/*
* xrick/src/e_bullet.c
*
* 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.
*/
#include "system.h"
#include "game.h"
#include "ents.h"
#include "e_bullet.h"
#include "maps.h"
/*
* public vars (for performance reasons)
*/
S8 e_bullet_offsx;
S16 e_bullet_xc, e_bullet_yc;
/*
* Initialize bullet
*/
void
e_bullet_init(U16 x, U16 y)
{
E_BULLET_ENT.n = 0x02;
E_BULLET_ENT.x = x;
E_BULLET_ENT.y = y + 0x0006;
if (game_dir == LEFT) {
e_bullet_offsx = -0x08;
E_BULLET_ENT.sprite = 0x21;
}
else {
e_bullet_offsx = 0x08;
E_BULLET_ENT.sprite = 0x20;
}
#ifdef ENABLE_SOUND
syssnd_play(WAV_BULLET, 1);
#endif
}
/*
* Entity action
*
* ASM 1883, 0F97
*/
void
e_bullet_action(UNUSED(U8 e))
{
/* move bullet */
E_BULLET_ENT.x += e_bullet_offsx;
if (E_BULLET_ENT.x <= -0x10 || E_BULLET_ENT.x > 0xe8) {
/* out: deactivate */
E_BULLET_ENT.n = 0;
}
else {
/* update bullet center coordinates */
e_bullet_xc = E_BULLET_ENT.x + 0x0c;
e_bullet_yc = E_BULLET_ENT.y + 0x05;
if (map_eflg[map_map[e_bullet_yc >> 3][e_bullet_xc >> 3]] &
MAP_EFLG_SOLID) {
/* hit something: deactivate */
E_BULLET_ENT.n = 0;
}
}
}
/* eof */
This diff is collapsed.
/*
* xrick/src/e_sbonus.c
*
* 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.
*/
#include "system.h"
#include "game.h"
#include "ents.h"
#include "e_sbonus.h"
#include "util.h"
#include "maps.h"
#include "e_rick.h"
/*
* public vars
*/
U8 e_sbonus_counting = FALSE;
U8 e_sbonus_counter = 0;
U16 e_sbonus_bonus = 0;
/*
* Entity action / start counting
*
* ASM 2182
*/
void
e_sbonus_start(U8 e)
{
ent_ents[e].sprite = 0; /* invisible */
if (u_trigbox(e, ENT_XRICK.x + 0x0C, ENT_XRICK.y + 0x0A)) {
/* rick is within trigger box */
ent_ents[e].n = 0;
e_sbonus_counting = TRUE; /* 6DD5 */
e_sbonus_counter = 0x1e; /* 6DDB */
e_sbonus_bonus = 2000; /* 291A-291D */
#ifdef ENABLE_SOUND
syssnd_play(WAV_SBONUS1, 1);
#endif
}
}
/*
* Entity action / stop counting
*
* ASM 2143
*/
void
e_sbonus_stop(U8 e)
{
ent_ents[e].sprite = 0; /* invisible */
if (!e_sbonus_counting)
return;
if (u_trigbox(e, ENT_XRICK.x + 0x0C, ENT_XRICK.y + 0x0A)) {
/* rick is within trigger box */
e_sbonus_counting = FALSE; /* stop counting */
ent_ents[e].n = 0; /* deactivate entity */
game_score += e_sbonus_bonus; /* add bonus to score */
#ifdef ENABLE_SOUND
syssnd_play(WAV_SBONUS2, 1);
#endif
/* make sure the entity won't be activated again */
map_marks[ent_ents[e].mark].ent |= MAP_MARK_NACT;
}
else {
/* keep counting */
if (--e_sbonus_counter == 0) {
e_sbonus_counter = 0x1e;
if (e_sbonus_bonus) e_sbonus_bonus--;
}
}
}
/* eof */
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
static U8 IMG_ICON_PIXELS[] = {
0,0,0,0,0,0,0,0,0,
211,108,211,108,52,52,52,52,52,52,52,52,52,0,0,0,
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,174,
92,15,188,130,130,121,148,197,197,197,148,148,177,105,0,0,
0,0,0,0,0,0,0,0,0,0,0,0,0,0,14,92,
12,104,192,143,195,56,7,72,72,72,7,7,85,14,105,0,
0,0,0,0,0,0,0,0,0,0,0,0,0,0,122,32,
186,7,7,104,143,195,65,7,186,7,104,56,195,51,174,52,
0,0,0,0,0,0,0,0,0,0,0,0,0,105,38,115,
134,149,149,149,13,13,13,149,166,83,31,120,13,72,168,14,
105,0,0,0,0,0,0,0,0,105,174,174,52,77,72,69,
126,21,126,126,21,21,21,126,159,195,84,139,21,12,30,122,
52,174,174,174,105,0,0,0,105,77,201,193,193,193,186,7,
104,42,42,104,104,104,42,104,104,78,42,104,104,186,193,193,
24,24,24,30,5,105,0,0,9,181,51,188,188,188,20,20,
73,73,73,73,73,73,73,73,20,73,20,20,20,73,20,20,
32,32,32,163,117,9,0,0,0,9,14,14,14,52,164,72,
72,72,72,72,72,72,72,164,12,72,164,72,72,164,164,72,
174,174,52,0,9,0,0,0,0,0,0,0,0,52,135,196,
23,193,6,23,23,23,23,23,202,193,23,23,23,23,196,135,
14,0,0,0,0,0,0,0,0,0,0,0,0,52,137,203,
151,6,127,84,98,43,19,84,159,46,127,127,127,127,162,128,
9,0,0,0,0,0,0,0,0,0,0,0,0,52,151,84,
84,84,151,151,165,170,183,208,139,126,7,7,7,7,182,174,
0,0,0,0,0,0,0,0,0,0,0,0,0,52,90,90,
90,74,88,84,165,1,93,116,91,132,161,62,96,17,204,175,
0,0,0,0,0,0,0,0,0,0,0,0,122,181,72,2,
74,157,54,88,53,176,152,50,4,140,67,133,33,95,34,0,
0,0,0,0,0,0,0,0,0,0,0,14,5,72,2,192,
143,111,74,12,87,145,11,35,94,165,84,84,84,7,148,58,
0,0,0,0,0,0,0,0,0,0,0,52,197,72,104,195,
195,65,193,72,98,137,142,158,138,142,84,84,84,39,59,52,
0,0,0,0,0,0,0,0,0,0,105,181,163,72,193,83,
195,143,192,101,44,68,87,151,84,84,84,208,114,86,178,52,
0,0,0,0,0,0,0,0,0,118,52,164,72,72,184,112,
111,195,56,104,72,69,21,84,151,151,151,139,21,12,197,52,
0,0,0,0,0,0,0,0,0,118,174,72,72,12,72,184,
193,18,171,104,72,22,114,180,129,145,110,53,81,181,122,0,
0,0,0,0,0,0,0,0,0,89,52,12,12,72,164,12,
12,193,7,7,90,150,84,87,141,136,131,28,122,52,0,0,
0,0,0,0,0,0,0,0,0,89,174,72,72,72,72,72,
164,54,57,7,208,84,151,151,159,186,7,74,164,117,0,0,
0,0,0,0,0,0,0,0,0,118,14,154,115,113,92,92,
92,72,54,153,84,84,84,84,88,2,2,190,30,30,27,0,
0,0,0,0,0,0,0,0,0,187,52,24,149,126,141,82,
179,72,184,107,172,47,47,23,22,72,80,66,70,30,197,160,
211,52,0,0,0,0,0,0,0,0,187,177,85,134,21,21,
21,164,74,104,143,13,126,72,30,191,35,152,11,211,102,176,
124,160,14,0,0,0,0,0,0,0,0,118,17,80,71,71,
71,92,200,10,41,97,205,12,209,165,125,35,1,173,11,35,
165,124,75,105,0,0,0,0,0,0,0,0,118,52,52,52,
108,108,173,176,11,11,165,72,109,165,11,94,123,64,35,35,
11,165,3,174,0,0,0,0,0,0,0,0,0,0,14,160,
124,64,183,26,170,94,11,14,102,165,165,165,94,35,100,106,
124,191,14,0,0,0,0,0,0,0,0,0,0,105,206,36,
11,183,147,76,152,49,3,105,105,167,11,165,165,189,199,165,
3,211,0,0,0,0,0,0,0,0,0,0,52,211,124,165,
156,26,103,123,48,174,52,0,118,52,167,165,11,165,165,191,
52,0,0,0,0,0,0,0,0,0,0,211,211,155,11,125,
123,35,125,165,52,58,0,0,0,89,52,3,124,165,167,14,
0,0,0,0,0,0,0,0,0,0,0,0,70,167,165,199,
45,103,16,125,75,48,58,0,0,0,89,14,191,191,52,58,
0,0,0,0,0,0,0,0,0,0,0,0,0,14,11,11,
1,147,103,123,11,167,52,0,0,0,0,194,14,52,194,0,
0,0,0,0,0,0,0,};
static img_color_t IMG_ICON_COLORS[] = {
{0,0,0,0},{90,94,92,0},{94,46,4,0},{46,50,44,0},{138,142,140,0},{50,34,20,0},{178,98,36,0},{142,70,4,0},{198,122,100,0},{0,0,0,0},{98,74,44,0},{74,74,76,0},{74,38,4,0},{198,106,44,0},{30,38,28,0},{74,50,20,0},{114,118,116,0},{50,42,28,0},{166,82,4,0},{214,142,116,0},{118,58,4,0},{178,110,108,0},{146,82,44,0},{222,130,92,0},{134,70,4,0},{138,94,84,0},{174,178,172,0},{42,38,20,0},{74,70,52,0},{0,0,0,0},{66,34,4,0},{190,102,44,0},{98,58,12,0},{174,142,132,0},{38,30,20,0},{102,106,100,0},{58,62,60,0},{82,86,84,0},{66,42,12,0},{170,98,76,0},{202,114,68,0},{126,86,44,0},{150,78,12,0},{202,130,108,0},{90,50,20,0},{130,130,132,0},{154,82,36,0},{238,138,100,0},{42,46,44,0},{54,58,52,0},{154,158,156,0},{58,34,12,0},{30,34,28,0},{110,86,76,0},{86,42,4,0},{38,38,28,0},{178,90,4,0},{130,66,4,0},{18,22,20,0},{102,66,52,0},{0,0,0,0},{122,94,84,0},{158,146,132,0},{174,98,52,0},{78,82,76,0},{210,106,4,0},{58,42,28,0},{198,170,156,0},{190,114,92,0},{122,70,52,0},{42,42,36,0},{86,62,60,0},{70,34,4,0},{114,58,4,0},{110,54,4,0},{54,54,52,0},{146,150,148,0},{50,38,20,0},{150,74,4,0},{214,122,68,0},{78,46,12,0},{74,58,52,0},{50,46,36,0},{174,86,4,0},{246,142,100,0},{122,66,4,0},{150,90,76,0},{230,134,100,0},{166,94,52,0},{18,18,20,0},{106,58,20,0},{170,154,148,0},{46,34,20,0},{110,114,108,0},{90,90,92,0},{66,46,20,0},{142,130,116,0},{118,86,68,0},{190,118,92,0},{0,0,0,0},{98,102,100,0},{102,50,4,0},{50,54,52,0},{142,146,140,0},{146,74,4,0},{26,30,28,0},{74,78,76,0},{82,42,4,0},{34,38,28,0},{70,54,36,0},{146,118,100,0},{170,86,4,0},{126,62,4,0},{142,82,68,0},{226,134,100,0},{134,70,20,0},{190,174,164,0},{46,38,20,0},{14,18,12,0},{62,38,4,0},{194,106,44,0},{102,62,20,0},{38,34,28,0},{106,110,108,0},{66,66,68,0},{86,90,84,0},{174,106,100,0},{214,118,68,0},{126,82,76,0},{158,106,92,0},{118,70,20,0},{110,102,84,0},{150,138,140,0},{186,158,148,0},{158,90,52,0},{162,98,92,0},{86,70,60,0},{198,118,100,0},{210,130,100,0},{214,126,100,0},{122,122,124,0},{134,86,84,0},{206,126,100,0},{218,110,4,0},{130,70,36,0},{118,90,84,0},{150,86,52,0},{178,182,180,0},{86,54,20,0},{158,86,44,0},{178,102,60,0},{250,146,108,0},{94,98,92,0},{98,50,4,0},{122,62,4,0},{62,66,60,0},{134,134,132,0},{90,46,4,0},{214,134,100,0},{198,110,52,0},{38,42,36,0},{170,158,140,0},{170,102,76,0},{58,38,12,0},{70,38,4,0},{70,70,68,0},{166,86,20,0},{50,50,52,0},{54,34,12,0},{26,26,28,0},{106,106,108,0},{154,78,4,0},{242,138,92,0},{58,58,60,0},{34,34,28,0},{10,10,12,0},{82,82,84,0},{46,42,28,0},{90,62,52,0},{54,46,44,0},{194,118,100,0},{42,34,20,0},{90,54,12,0},{142,142,140,0},{78,38,4,0},{54,42,28,0},{138,70,4,0},{14,14,12,0},{102,58,12,0},{86,86,84,0},{70,42,12,0},{46,46,44,0},{182,90,4,0},{134,66,4,0},{22,22,20,0},{214,106,4,0},{194,114,92,0},{54,38,20,0},{0,0,0,0},{78,78,76,0},{74,54,36,0},{66,38,4,0},{178,98,44,0},{222,130,100,0},{42,38,28,0},{110,86,84,0},{38,38,36,0},{174,98,60,0},{246,142,108,0},{66,46,28,0},{146,74,12,0},{34,38,36,0},{194,106,52,0},{154,78,12,0},{242,138,100,0},{34,34,36,0},};
static img_t IMG_ICON_OBJECT = {
32, 32,
216,
IMG_ICON_COLORS,
IMG_ICON_PIXELS
};
img_t *IMG_ICON = &IMG_ICON_OBJECT;
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
//{{NO_DEPENDENCIES}}
// Microsoft Developer Studio generated include file.
// Used by xrick.rc
//
// Next default values for new objects
//
#ifdef APSTUDIO_INVOKED
#ifndef APSTUDIO_READONLY_SYMBOLS
#define _APS_NEXT_RESOURCE_VALUE 102
#define _APS_NEXT_COMMAND_VALUE 40001
#define _APS_NEXT_CONTROL_VALUE 1000
#define _APS_NEXT_SYMED_VALUE 101
#endif
#endif
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment