/**********************************************************************
 *
 * File :     global.h
 *
 * Abstract : Global definitions shared across modules
 *
 **********************************************************************
 *
 * This file is a product of Criterion Software Ltd.
 *
 * This file is provided as is with no warranties of any kind and is
 * provided without any obligation on Criterion Software Ltd. or
 * Canon Inc. to assist in its use or modification.
 *
 * Criterion Software Ltd. will not, under any
 * circumstances, be liable for any lost revenue or other damages arising
 * from the use of this file.
 *
 * Copyright (c) 1995 Criterion Software Ltd.
 * All Rights Reserved.
 *
 * RenderWare is a trademark of Canon Inc.
 *
 ************************************************************************/

/*--- Option definitions ---*/

#define WITH_SCORE          /* Overlay the score on top of the display */
#define WITH_SHADOWS        /* Render shadows under the Rats and Bits  */
/* #define WITH_SOUND          Include sounds */

/*--- Include files ---*/

#include <stdlib.h>
#include <stdio.h>
#include <stdarg.h>
#include <math.h>
#include <string.h>
#include <time.h>

/* Main RenderWare include file */

#include "rwlib.h"

/* OS specific function prototypes */

#include "os.h"

/* Module specific data and functions */

#include "doscyber.h"
#include "object.h"
#include "gunbit.h"
#include "ratrophy.h"
#include "man.h"

#ifdef WITH_SOUND
#include "sound.h"
#endif

/*--- Magic Number definitions */

/* The hole in the panel that the scene will be rendered into */

#define PANEL_HOLE_WIDTH    400
#define PANEL_HOLE_HEIGHT   300
#define PANEL_HOLE_XOFFSET  190
#define PANEL_HOLE_YOFFSET   40

/*  World Definitions: The world is made up of 3 separate cells, the
 *  street, the hall and the poolroom. The following diagram should help
 *  to visualize the world. The view is a plan view seen from above.
 *  x marks the initial position if the camera.
 *
 *                         Far
 *
 *             |-------------------------> X
 *             |  Street   |Hall
 *             |           |----|----|
 *             |     x     |----|    |PoolRoom
 *   Left      |           |    |----|            Right
 *             |           |
 *             |           |
 *             |------------
 *             |
 *             Z
 *                           Near
 */

/* Street definitions */

#define NEAR_STREET     12.0
#define FAR_STREET       0.0
#define LEFT_STREET     -2.0
#define RIGHT_STREET     2.0
#define LEFT_KERB       -1.2
#define RIGHT_KERB       1.2
#define KERB_HEIGHT      0.05
#define STREET_HEIGHT    0.0

#define PAD_X           1.5     /* position of the Pad that opens the door */
#define PAD_Y           0.5
#define DOOR_OPEN       10      /* Maximum value for door control variable */
#define DOOR_HEIGHT      0.4    /* Height of the door */

/* Hall definitions */

#define STEP_HEIGHT      0.045
#define STEP_WIDTH       0.14
#define MAX_STEPS        9

#define LEFT_HALL       RIGHT_STREET
#define RIGHT_HALL      3.4
#define FAR_HALL        3.08
#define NEAR_HALL       3.447

/* Poolroom definitions */

#define LEFT_POOL       RIGHT_HALL
#define RIGHT_POOL      7.4
#define NEAR_POOL       7.08
#define FAR_POOL        FAR_HALL

/* Camera definitions */

#define CAMERA_START_X  0.0
#define CAMERA_START_Y  0.4
#define CAMERA_START_Z  3.0

/* General definitions */

#define SHADOW_HEIGHT   0.05        /* height that shadows are drawn above the ground */
#define RICOCHET        (-1.0/8.0)  /* bouncing off of a wall changes velocity by this amount */
#define GRAVITY         0.005       /* the rate that an objects upward velocity decreases */

/*--- Macro Definitions ---*/

/* Generate a random RwReal in the specified range */

#define RANDOM_REAL(min, max) \
(RAdd(min,RMul(RMul(INT2REAL(RwRandom()&0x7fff),CREAL(1.0/32768.0)), RSub(max, min))))							   \

/*--- Global Variable Definitions ---*/

/* One of the modules should define DEFINE_GLOBAL before including this file
 * this will ensure that each global variable is only declared once
 */

#ifdef DEFINE_GLOBAL
#define ref
#define value(x) = (x)
#else

#define ref extern
#define value(x)  /* (x) */

#endif

ref RwCamera    *cpGCamera      value(NULL); /* camera used for all rendering */
ref RwScene     *spGTargetScene value(NULL); /* each rat is represented by a
                                                polygon in this scene. Picking
                                                is performed on this simplified
                                                target scene rather than the
                                                main scene */
ref RwScene     *spGScene       value(NULL); /* The main scene containing the
                                                street */
ref RwScene     *spGPoolScene   value(NULL); /* The scene containing the
                                                poolroom */
ref RwRaster    *rpGPanel       value(NULL); /* The raster for the surrounding
                                                panel */

