/*-
 * Copyright (c) 2000
 * Tatsuya Kudoh(CDR/TK),ROYALPANDA.    All rights reserved.
 *
 * Redistribution and use in source and binary forms, with or without
 * modification, are permitted provided that the following conditions
 * are met:
 * 1. Redistributions of source code must retain the above copyright
 *    notice, this list of conditions and the following disclaimer.
 * 2. Redistributions in binary form must reproduce the above copyright
 *    notice, this list of conditions and the following disclaimer in the
 *    documentation and/or other materials provided with the distribution.
 *
 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
 * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
 * SUCH DAMAGE.
 *
 */

#ifndef _JUMP_H_
#define _JUMP_H_

#include<sys/bios.h>

#define VERSION		"0.0"


#define COORD_SCALE	16
#define COORD_MASK	4095

#define abs(n)	((n) >= 0 ? (n) : -(n))
#define sgn(n)	((n) > 0 ? 1 : (n) < 0 ? -1 : 0 )

#define rnd(n)		(rand() % (n))
#define rnd_pm()	((rand() & 2) - 1)

#define K_LEFT	1
#define K_RIGHT	2
#define K_JUMP	4
#define K_START	8
#define K_RESET 16


typedef struct{
	int floor;

	int sprite;	/* sprite number */

	int xx;

	int x;
	int y;
	int width;

	int pic;

	int fric;	/* friction */

	/* moving */
	int move_vector;

	/* blink */

	int blink_interval;
	int blink_count;

	/* force */

	int force_vector;

	int phase;
	int viewable;
}floor_t;


typedef struct{
	int sprite;

	int x;
	int y;

	int xx;
	int yy;

	int vx;
	int vy;
	int dir;
	int jump;

	int pic;
	int count;
}hero_t;


typedef struct{
	char name[8];
	int score;
}record_t;

int DISP_wait_vblank( void );
void DISP_put_str( int x, int y, char far *str );
void DISP_disable( void );
void DISP_enable( void );
void DISP_init( void );
void DISP_clear( void );
void FLOOR_delete( floor_t *fp );
void FLOOR_create( floor_t *fp,int level );
void FLOOR_move( floor_t *fp );
void FLOOR_init( void );
void FONTDATA_init( void );
floor_t *GAME_get_floor( int y );
int GAME_title( void );
void GAME_main( void );
int HERO_move( hero_t *hp, int key );
void KEY_init( void );
int KEY_read( void );
void KEY_wait_pause( void );

#endif
