1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135
|
/*
* Copyright (C) 2000-2001 The Exult Team
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* 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. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
#ifndef GAME_H
#define GAME_H
#include <string>
#include <vector>
#include "hash_utils.h"
#include "exult_constants.h"
#include "palette.h"
#include "vgafile.h"
#include "singles.h"
class Game_window;
class Image_window8;
class Image_buffer8;
class Mouse;
struct str_int_pair
{
const char *str;
int num;
};
enum Exult_Game {
NONE,
BLACK_GATE,
SERPENT_ISLE,
EXULT_DEVEL_GAME // One that we develop.
};
#define GAME_BG (Game::get_game_type() == BLACK_GATE)
#define GAME_SI (Game::get_game_type() == SERPENT_ISLE)
#define GAME_FOV (Game::get_game_type()==BLACK_GATE && Game::has_expansion())
#define GAME_SS (Game::get_game_type()==SERPENT_ISLE && Game::has_expansion())
class Game : public Game_singletons {
private:
static bool new_game_flag;
static Exult_Game game_type;
static bool expansion;
#ifndef DONT_HAVE_HASH_MAP
hash_map<const char*, int, hashstr, eqstr> shapes;
hash_map<const char*, str_int_pair, hashstr, eqstr> resources;
#else /* !HAVE_HASH_MAP */
std::map<const char*, int, ltstr> shapes;
std::map<const char*, str_int_pair, ltstr> resources;
#endif
Mouse *menu_mouse;
static std::string gametitle;
static unsigned int ticks;
protected:
static bool editing_flag;
int topx, topy, centerx, centery;
Vga_file menushapes;
bool jive;
public:
Game_window *gwin;
Image_window8 *win;
Image_buffer8 *ibuf;
// Palette pal;
Game();
virtual ~Game();
static void set_new_game() { new_game_flag = true; }
static bool is_new_game() { return new_game_flag; }
static bool is_editing() { return editing_flag; }
static Game *create_game(Exult_Game mygame, const char *title = 0);
static Exult_Game get_game_type() { return game_type; }
static bool has_expansion() { return expansion; }
static const char *get_avname ();
static int get_avsex ();
static int get_avskin ();
static void set_avname (char *name);
static void set_avsex (int sex);
static void set_avskin (int skin);
static void clear_avname ();
static void clear_avsex ();
static void clear_avskin ();
static std::string get_gametitle() { return gametitle; }
virtual void play_intro() =0;
virtual void end_game(bool success) =0;
virtual void top_menu() =0;
virtual void show_quotes() =0;
virtual void show_credits() =0;
virtual bool new_game(Vga_file &shapes) =0;
virtual int get_start_tile_x() =0;
virtual int get_start_tile_y() =0;
virtual void show_journey_failed() = 0;
void play_flic(const char *archive, int index);
void play_audio(const char *archive, int index);
void play_midi(int track, bool repeat = false);
void add_shape(const char *name, int shapenum);
int get_shape(const char *name);
void add_resource(const char *name, const char *str, int num);
str_int_pair get_resource(const char *name);
bool show_menu(bool skip = false);
void journey_failed_text();
void set_jive () {jive = true;}
void clear_jive () {jive = false;}
inline static unsigned int get_ticks() { return ticks; }
inline static void set_ticks(unsigned int t) { ticks = t; }
};
extern Game *game;
extern int wait_delay(int ms, int startcol = 0, int ncol = 0);
extern Exult_Game exult_menu(Game_window *gwin);
#endif
|