File: OGAME.h

package info (click to toggle)
7kaa 2.15.6%2Bds-2
  • links: PTS, VCS
  • area: main
  • in suites: trixie
  • size: 131,312 kB
  • sloc: cpp: 134,790; asm: 3,523; ansic: 1,949; perl: 1,665; makefile: 1,181; sh: 126; pascal: 27
file content (174 lines) | stat: -rw-r--r-- 4,499 bytes parent folder | download
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
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
/*
 * Seven Kingdoms: Ancient Adversaries
 *
 * Copyright 1997,1998 Enlight Software Ltd.
 *
 * 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, see <http://www.gnu.org/licenses/>.
 *
 */

//Filename	  : OGAME.H
//Description : Header file for Game class

#ifndef __OGAME_H
#define __OGAME_H

#include <ALL.h>
#include <OCONFIG.h>

//-------- Define game modes -----------//

enum { GAME_PREGAME=1,
		 GAME_SINGLE_PLAYER,		// game_mode is set once the player clicks an option on the screen, the game doesn't have to be actually running.
		 GAME_TUTORIAL,
		 GAME_TEST,
		 GAME_MULTI_PLAYER,
		 GAME_CAMPAIGN,
		 GAME_ENCYCLOPEDIA,
		 // ####### begin Gilbert 2/9 ######//
		 GAME_CREDITS,
		 // ####### end Gilbert 2/9 ######//
		 GAME_DEMO,
		 GAME_POSTGAME
	  };

//--------- Define struct ColorRemapMethod ----------//

struct ColorRemapMethod
{
	int	primary_color;
	int	secondary_color;
};

//--------- Define struct ColorRemap ----------//

#pragma pack(1)
struct ColorRemap
{
public:
	char  main_color;
	char	color_table[256];

public:
	void	set_remap_color(ColorRemapMethod*);
   void	load(char*);
};
#pragma pack()

//----- define struct ScenInfo -------//

struct ScenInfo
{
	enum { SCEN_NAME_LEN=80 };

	char* 	file_name;
	char  	scen_name[SCEN_NAME_LEN+1];
	char	dir_id;			// real path look from DIR_SCENARIO_PATH(dir_id)
	short	goal_difficulty;
	short 	goal_score_bonus;
	int		play_status;
};

//-------- Define class Game -----------//

struct Location;
struct NewNationPara;

#pragma pack(1)
class Game
{
public:
	char			init_flag;
	char			started_flag;
	char			game_mode;
	char			game_has_ended;		// whether game_end() has been called once already and the player is now just staying in the game to continue to play or observe

	//-------- color remap info -------//

	ColorRemap	color_remap_array[MAX_COLOR_SCHEME+1];

public:
	Game();

	int			init(int loadGameCall=0);
	void			deinit(int loadGameCall=0);

	void			main_menu();
   void			in_game_menu();
	int			in_game_option_menu();
	void 			game_end(int winNationRecno, int playerDestroyed=0, int surrenderToNationRecno=0, int retireFlag=0);

	int 			select_run_scenario();
	int 			select_scenario(int scenCount, ScenInfo* scenInfoArray);
	int 			run_scenario(ScenInfo* scenInfo);

	void 			demo_disp_ad_page();
	void			demo_disp_logo();

	void 			mp_broadcast_setting();

	char*			get_color_remap_table(int nationRecno, int selectedFlag);
	// ###### begin Gilbert 24/10 #######//
	static void	disp_gen_map_status( int curStep, int maxStep, int section );
	// ###### end Gilbert 24/10 #######//

	// ###### begin Gilbert 13/2 #######//
#ifndef DISABLE_MULTI_PLAYER
	void 			multi_player_menu(int lobbied, char *game_host);
#endif
	// ###### end Gilbert 13/2 #######//

	int 			write_file(File* filePtr);
	int			read_file(File* filePtr);

private:
	void			init_remap_table();

	void			disp_version();
	void			run_main_menu_option(int);
	void 			single_player_menu();
//	void 			multi_player_menu();

	void			single_player_game(int);
	void			multi_player_game(int lobbied, char *game_host);
	void			test_game();
	void			load_mp_game(char *saveFileName, int lobbied, char *game_host);
	void			view_encyclopedia();
	void			view_credits();

	int			input_box(const char *tell_string, char *buf, int len, char hide_input=0);
	int			input_name_pass(const char *txt[], char *name, int name_len, char *pass, int pass_len);

	//------- multiplayer game functions -------//

	int 			mp_select_mode(char *saveGameName, int service_mode);
	int			mp_get_leader_board();
	int			mp_join_session(int session_id);
	void			mp_close_session();
	int			mp_select_option(NewNationPara*, int*);
	int			mp_select_service();
	int			mp_select_session();
	void			mp_disp_players();
	int			mp_select_load_option(char *);
};
#pragma pack()

extern Game game;
extern char game_demo_mode, game_design_mode, scenario_file_name[FilePath::MAX_FILE_PATH+1];

//-------------------------------------//

#endif