1 /* 2 * Seven Kingdoms: Ancient Adversaries 3 * 4 * Copyright 1997,1998 Enlight Software Ltd. 5 * 6 * This program is free software: you can redistribute it and/or modify 7 * it under the terms of the GNU General Public License as published by 8 * the Free Software Foundation, either version 2 of the License, or 9 * (at your option) any later version. 10 * 11 * This program is distributed in the hope that it will be useful, 12 * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 * GNU General Public License for more details. 15 * 16 * You should have received a copy of the GNU General Public License 17 * along with this program. If not, see <http://www.gnu.org/licenses/>. 18 * 19 */ 20 21 //Filename : OINFO.H 22 //Description : Header file for class Info 23 24 #ifndef __OINFO_H 25 #define __OINFO_H 26 27 #include <stdint.h> 28 29 #include <OSKILL.h> 30 #include <ODYNARR.h> 31 #include <OWORLD.h> 32 33 //---------- Define constant ---------// 34 35 enum { INFO_REPAINT=10, INFO_UPDATE, INFO_SPECIAL }; 36 37 //--------- Define section positions ---------// 38 39 #define TOP_MENU_X1 4 40 #define TOP_MENU_Y1 4 41 #define TOP_MENU_X2 (ZOOM_X2-4) 42 #define TOP_MENU_Y2 30 43 44 #define INFO_X1 586 45 #define INFO_Y1 265 46 #define INFO_X2 790 47 #define INFO_Y2 589 48 49 #define MSG_X1 INFO_X1 50 #define MSG_Y1 (INFO_Y2-29) 51 #define MSG_X2 INFO_X2 52 #define MSG_Y2 INFO_Y2 53 54 //------- Nation report detail display mode -------// 55 56 enum { MAX_NATION_REPORT_MODE = 5 }; 57 58 enum { NATION_REPORT_INFO=1, 59 NATION_REPORT_TALK, 60 NATION_REPORT_CHAT, 61 NATION_REPORT_TALK_LOG, 62 NATION_REPORT_DEBUG 63 }; 64 65 enum { MAX_RANK_TYPE = 5 }; 66 67 enum { CHAT_STR_LEN=100 }; 68 69 enum { MAX_REMOTE_CHAT_STR=10 }; 70 71 //-------- Define chat_receiver_type --------// 72 73 enum { MAX_CHAT_RECEIVER_TYPE = 3 }; 74 75 enum { CHAT_RECEIVER_CURRENT=1, 76 CHAT_RECEIVER_ALL_ALLY, 77 CHAT_RECEIVER_ALL_HUMAN }; 78 79 //--------- Define struct ChatInfo ----------// 80 81 #pragma pack(1) 82 struct ChatInfo 83 { 84 int received_date; 85 char from_nation_recno; 86 char chat_str[CHAT_STR_LEN+1]; 87 }; 88 #pragma pack() 89 90 //--------- Define struct TalkMsgDisp --------// 91 92 struct TalkMsgDisp 93 { 94 short recno; 95 int date; 96 char is_reply; 97 }; 98 99 //----------- Define class Info -------------// 100 101 #pragma pack(1) 102 class Info 103 { 104 public: 105 int game_start_date; // set to Game::game_start_year in Info::init(), the actual date the game begins, not the scenario begins 106 int game_date; 107 int game_day; 108 int game_month; 109 int game_year; 110 111 int goal_deadline; 112 short goal_difficulty; 113 short goal_score_bonus; 114 115 int week_day; // = game_date&7 116 int year_day; // the nth day in a year 117 int year_passed; // no. of years passed since playing 118 119 int random_seed; 120 121 uint32_t start_play_time; // the time player start playing the game today 122 uint32_t total_play_time; // total time the player has played in all saved games 123 124 //------- report browsers recno -------// 125 126 short viewing_nation_recno; // which nation the player is viewing at with the reports. 127 short viewing_spy_recno; // the recno of the spy viewing the secret report of other nations 128 short default_viewing_nation_recno; 129 130 short browse_nation_recno; 131 short browse_race_recno; 132 short browse_firm_recno; 133 short browse_income_recno; 134 short browse_expense_recno; 135 short browse_troop_recno; 136 short browse_unit_recno; 137 short browse_tech_recno; 138 short browse_god_recno; 139 short browse_town_recno; 140 short browse_spy_recno; 141 short browse_caravan_recno; 142 short browse_ship_recno; 143 short browse_talk_msg_recno; 144 short browse_news_recno; 145 short browse_ai_action_recno; 146 short browse_ai_attack_recno; 147 148 //------ vars of the nation report ------// 149 150 char nation_report_mode; 151 short last_talk_nation_recno; 152 char player_reply_mode; 153 154 //------ chat string --------// 155 156 char chat_receiver_type; 157 char player_chat_str[CHAT_STR_LEN+1]; 158 ChatInfo remote_chat_array[MAX_REMOTE_CHAT_STR]; 159 160 //---------------------------------// 161 162 char last_write_offset; // it is used for an offset locator for excluding static member vars during reading and writing files 163 164 char* play_time_str(); // return total time played in string 165 char* game_duration_str(); 166 167 short get_report_data(int recNo); 168 short get_report_data2(int recNo); 169 170 //------ keep a copy of bitmap of the panel texture -----// 171 172 char* info_background_bitmap; // declare them static, so they won't be saved 173 DynArray report_array; 174 DynArray report_array2; 175 DynArray talk_msg_disp_array; 176 177 public: 178 Info(); 179 ~Info(); 180 181 void init(); 182 void deinit(); 183 184 void init_random_seed(int randomSeed); 185 186 void disp_panel(); 187 188 void disp(); 189 void update(); 190 int detect(); 191 bool is_unit_build_menu_opened(); 192 193 void next_day(); 194 195 void save_game_scr(); 196 void rest_game_scr(); 197 void free_game_scr(); 198 199 void draw_selected(); 200 void disp_heading(); 201 202 int disp_loyalty(int x, int y, int x2, int curLoyalty, int targetLoyalty, int nationRecno, int refreshFlag); 203 204 void disp_military(int refreshFlag); 205 void detect_military(); 206 207 void disp_nation(int refreshFlag); 208 void detect_nation(); 209 210 void disp_economy(int refreshFlag); 211 void detect_economy(); 212 213 void disp_town(int refreshFlag); 214 void detect_town(); 215 216 void disp_trade(int refreshFlag); 217 void detect_trade(); 218 219 void disp_tech(int refreshFlag); 220 void detect_tech(); 221 222 void disp_rank(int refreshFlag); 223 void detect_rank(); 224 225 void disp_spy(int refreshFlag); 226 void detect_spy(); 227 228 void disp_ai_action(int refreshFlag); 229 void detect_ai_action(); 230 231 void disp_news_log(int refreshFlag); 232 void detect_news_log(); 233 234 void init_player_reply(int talkToNationRecno); 235 void player_reply_chat(int withNationRecno); 236 void process_viewing_spy(); 237 238 void set_rank_data(int onlyHasContact); 239 char* get_rank_pos_str(int rankType, int nationRecno); 240 int get_rank_score(int rankType, int nationRecno); // score functions 241 int get_total_score(int nationRecno); 242 243 int write_file(File* filePtr); 244 int read_file(File* filePtr); 245 }; 246 #pragma pack() 247 248 extern Info info; 249 250 //------------------------------------------// 251 252 #endif 253