Main Page   Class Hierarchy   Alphabetical List   Compound List   File List   Compound Members   File Members  

game.h File Reference

The control of the game itself. More...


Defines

#define VIEW_WIDTH   (12)
 Visible blocks on X axis in game viewport.

#define VIEW_HEIGHT   (10)
 Visible blocks on Y axis in game viewport.

#define OVERLAPS_VIEW(x1, y1, x2, y2)   (OVERLAPS(x1,y1,x2,y2,16*xo,16*yo,16*(xo+VIEW_WIDTH)+(8*xo_small),16*(yo+VIEW_HEIGHT)))
 Tests if rectangle overlaps portion of world visible on screen (pixel coordinates).

#define IN_VIEW(x, y)   (INBOUNDS(x,y,xo*16,yo*16,16*(xo+VIEW_WIDTH)+(8*xo_small),16*(yo+VIEW_HEIGHT)))
 Tests if point is directly inside portion of world visible on screen (pixel coordinates).


Enumerations

enum  EdjGameSounds {
  SOUND_PICKUP = 0,
  SOUND_SHOOT,
  SOUND_EXIT,
  SOUND_OPENDOOR,
  SOUND_MAX
}

Functions

void AddThing (CThing *pThing)
 Add a CThing to the current array of things in the level.

void NextLevel ()
 Advance to next level.

void RestartLevel ()
 Restart current level.

int GetCurrentLevel ()
 Get current level (0-based index).

void Die ()
 Lose a life.

void GameHeartBeat ()
 The main game "tick" routine.

void GameDrawSkin ()
 Draw the main game skin.

void GameDrawLives ()
 Draw hero's remaining "lives" (OBSOLETE?).

void GameDrawView ()
 Draw the main game view.

void GameDrawFirepower ()
 Draw hero firepower.

void GameInitialSetup ()
 Once off initialization stuff.

void GameFinalCleanup ()
 Final cleanup.

void PerGameSetup ()
 Per-game initialization.

void PerLevelSetup ()
 Per-level initialization.

void PerLevelCleanup ()
 Per-level cleanup.

void PerGameCleanup ()
 Per-game cleanup.

void HeroModifyFirepower (int nDiff)
 Add some value to hero firepower.

void HeroShoot (int nX, int nY, int nXDiff, int nYDiff=0)
 Hero shoot. Creates a bullet.

void MonsterShoot (int nX, int nY, int nXDiff, int nYDiff=0)
 Monster shoot. Creates a monster bullet.

int GameLoadSprites ()
bool SaveGame ()
 Save game (FIXME: Somewhat rudimentary at the moment. Needs more advanced, e.g. savegame slots, naming etc).

bool LoadGame ()
 Load game (FIXME: See SaveGame for comments).

void ShowGameMessage (const char *szMessage, int nFrames)
 Display a message on-screen during gameplay for next nFrames frames (FIXME: Make this time).

bool check_solid (int ix, int iy, bool bCheckThings=true)
 Return true if solid. bCheckThings is an ugly hack which (fixme) should be fixed.

bool CheckCollision (int x1, int y1, int x2, int y2, CBullet *pBullet=NULL)
 Return true if given rectangle [pixel coordinates] is colliding with anything solid.

int game_startup ()
void parse_level ()
void sprite_factory (unsigned char a, unsigned char b, int ix, int iy, int ifore, bool bfromlevel)
void SetScore (int nScore)
 Set current score. On-screen score display is redrawn automatically.

void SetHealth (int nHealth)
 Set current health. On-screen score display is redrawn automatically.

void update_score (int score_diff, int nFloatingScoreX=-1, int nFloatingScoreY=-1)
 Modify current score by given amount, optionally creating a "floating score" display.

void update_health (int health_diff)
void HeroSetHurting (bool bReset=false)
 Set the hero state to "hurting", unless already hurting, unless bReset is set to true.

bool HeroIsHurting ()
 Return true if hero is "hurting" (flashing).


Variables

vector<CThing *> g_apThings
SOUND_HANDLE g_iSounds [SOUND_MAX]
int anim4_count
 Global 4-animation-frame animation count. This name must also change.


Detailed Description

The control of the game itself.

Author:
David Joffe

Copyright (C) 1995-2001 David Joffe

License: GNU GPL Version 2 (*not* "later versions")


http://www.scorpioncity.com/djgame.html
Copyright (C) David Joffe. Generated: 23 Sep 2001