1 /* 2 * This program is free software; you can redistribute it and/or modify 3 * it under the terms of the GNU General Public License as published by 4 * the Free Software Foundation; either version 2 of the License, or 5 * (at your option) any later version. 6 * 7 * This program is distributed in the hope that it will be useful, 8 * but WITHOUT ANY WARRANTY; without even the implied warranty of 9 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 10 * GNU General Public License for more details. 11 * 12 * You should have received a copy of the GNU General Public License 13 * along with this program; if not, write to the Free Software 14 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. 15 */ 16 17 #ifndef SIS_H_INCL__ 18 #define SIS_H_INCL__ 19 20 #include "libs/compiler.h" 21 #include "libs/gfxlib.h" 22 #include "planets/elemdata.h" 23 // for NUM_ELEMENT_CATEGORIES 24 25 #if defined(__cplusplus) 26 extern "C" { 27 #endif 28 29 #define CLEAR_SIS_RADAR (1 << 2) 30 #define DRAW_SIS_DISPLAY (1 << 3) 31 32 #define UNDEFINED_DELTA 0x7FFF 33 34 #define NUM_DRIVE_SLOTS 11 35 #define NUM_JET_SLOTS 8 36 #define NUM_MODULE_SLOTS 16 37 38 #define CREW_POD_CAPACITY 50 39 #define STORAGE_BAY_CAPACITY 500 /* km cubed */ 40 #define FUEL_TANK_SCALE 100 41 #define FUEL_TANK_CAPACITY (50 * FUEL_TANK_SCALE) 42 #define HEFUEL_TANK_CAPACITY (100 * FUEL_TANK_SCALE) 43 #define MODULE_COST_SCALE 50 44 45 #define CREW_EXPENSE_THRESHOLD 1000 46 47 #define CREW_PER_ROW 5 48 #define SBAY_MASS_PER_ROW 50 49 50 #define MAX_FUEL_BARS 10 51 #define FUEL_VOLUME_PER_ROW (HEFUEL_TANK_CAPACITY / MAX_FUEL_BARS) 52 #define FUEL_RESERVE FUEL_VOLUME_PER_ROW 53 54 #define IP_SHIP_THRUST_INCREMENT 8 55 #define IP_SHIP_TURN_WAIT 17 56 #define IP_SHIP_TURN_DECREMENT 2 57 58 #define BIO_CREDIT_VALUE 2 59 60 enum 61 { 62 PLANET_LANDER = 0, 63 /* thruster types */ 64 FUSION_THRUSTER, 65 /* jet types */ 66 TURNING_JETS, 67 /* module types */ 68 CREW_POD, 69 STORAGE_BAY, 70 FUEL_TANK, 71 HIGHEFF_FUELSYS, 72 DYNAMO_UNIT, 73 SHIVA_FURNACE, 74 GUN_WEAPON, 75 BLASTER_WEAPON, 76 CANNON_WEAPON, 77 TRACKING_SYSTEM, 78 ANTIMISSILE_DEFENSE, 79 80 NUM_PURCHASE_MODULES, 81 82 BOMB_MODULE_0 = NUM_PURCHASE_MODULES, 83 BOMB_MODULE_1, 84 BOMB_MODULE_2, 85 BOMB_MODULE_3, 86 BOMB_MODULE_4, 87 BOMB_MODULE_5, 88 89 NUM_MODULES /* must be last entry */ 90 }; 91 92 #define EMPTY_SLOT NUM_MODULES 93 #define NUM_BOMB_MODULES 10 94 95 #define DRIVE_SIDE_X 31 96 #define DRIVE_SIDE_Y 56 97 #define DRIVE_TOP_X 33 98 #define DRIVE_TOP_Y (65 + 21) 99 100 #define JET_SIDE_X 71 101 #define JET_SIDE_Y 48 102 #define JET_TOP_X 70 103 #define JET_TOP_Y (73 + 21) 104 105 #define MODULE_SIDE_X 17 106 #define MODULE_SIDE_Y 14 107 #define MODULE_TOP_X 17 108 #define MODULE_TOP_Y (96 + 21) 109 110 #define SHIP_PIECE_OFFSET 12 111 112 #define MAX_BUILT_SHIPS 12 113 /* Maximum number of ships escorting the SIS */ 114 #define MAX_LANDERS 10 115 116 #define SUPPORT_SHIP_PTS \ 117 {3 + 0, 30 + (2 * 16)}, \ 118 {3 + 42, 30 + (2 * 16)}, \ 119 {3 + 0, 30 + (3 * 16)}, \ 120 {3 + 42, 30 + (3 * 16)}, \ 121 {3 + 0, 30 + (1 * 16)}, \ 122 {3 + 42, 30 + (1 * 16)}, \ 123 {3 + 0, 30 + (4 * 16)}, \ 124 {3 + 42, 30 + (4 * 16)}, \ 125 {3 + 0, 30 + (0 * 16)}, \ 126 {3 + 42, 30 + (0 * 16)}, \ 127 {3 + 0, 30 + (5 * 16)}, \ 128 {3 + 42, 30 + (5 * 16)}, 129 130 #define SIS_NAME_SIZE 16 131 132 typedef struct 133 { 134 SDWORD log_x, log_y; 135 136 DWORD ResUnits; 137 138 DWORD FuelOnBoard; 139 COUNT CrewEnlisted; 140 // Number of crew on board, not counting the captain. 141 // Set to (COUNT) ~0 to indicate game over. 142 COUNT TotalElementMass, TotalBioMass; 143 144 BYTE ModuleSlots[NUM_MODULE_SLOTS]; 145 BYTE DriveSlots[NUM_DRIVE_SLOTS]; 146 BYTE JetSlots[NUM_JET_SLOTS]; 147 148 BYTE NumLanders; 149 150 COUNT ElementAmounts[NUM_ELEMENT_CATEGORIES]; 151 152 UNICODE ShipName[SIS_NAME_SIZE]; 153 UNICODE CommanderName[SIS_NAME_SIZE]; 154 UNICODE PlanetName[SIS_NAME_SIZE]; 155 } SIS_STATE; 156 157 #define OVERRIDE_LANDER_FLAGS (1 << 7) 158 #define AFTER_BOMB_INSTALLED (1 << 7) 159 160 extern void RepairSISBorder (void); 161 extern void InitSISContexts (void); 162 extern void DrawSISFrame (void); 163 extern void ClearSISRect (BYTE ClearFlags); 164 extern void SetFlashRect (const RECT *pRect); 165 extern void PreUpdateFlashRect (void); 166 extern void PostUpdateFlashRect (void); 167 extern void PauseFlash (void); 168 extern void ContinueFlash (void); 169 170 #define SFR_MENU_3DO ((RECT*)~0L) 171 #define SFR_MENU_ANY ((RECT*)~1L) 172 extern void DrawHyperCoords (POINT puniverse); 173 extern void DrawSISTitle (UNICODE *pStr); 174 175 // Flags for DrawSISMessageEx (may be OR'ed): 176 #define DSME_NONE 0 177 #define DSME_SETFR (1 << 0) 178 // Set the flash rectangle to the message area. 179 #define DSME_CLEARFR (1 << 1) 180 // Disable the flash rectangle. 181 #define DSME_BLOCKCUR (1 << 2) 182 // Use a block cursor instead of an insertion point cursor, 183 // when editing in the message field. 184 #define DSME_MYCOLOR (1 << 3) 185 // Use the current foreground color, instead of the default. 186 extern BOOLEAN DrawSISMessageEx (const UNICODE *pStr, SIZE CurPos, 187 SIZE ExPos, COUNT flags); 188 189 extern void DrawSISMessage (const UNICODE *pStr); 190 extern void DateToString (char *buf, size_t bufLen, 191 BYTE month_index, BYTE day_index, COUNT year_index); 192 193 // Returned RECT is relative to the StatusContext 194 extern void GetStatusMessageRect (RECT *r); 195 extern void DrawStatusMessage (const UNICODE *pStr); 196 typedef enum 197 { 198 SMM_UNDEFINED = 0, 199 SMM_DATE, 200 SMM_RES_UNITS, 201 SMM_CREDITS, 202 203 SMM_DEFAULT = SMM_DATE, 204 } StatMsgMode; 205 // Sets the new mode and return the previous 206 extern StatMsgMode SetStatusMessageMode (StatMsgMode); 207 208 extern void DrawLanders (void); 209 extern void DrawStorageBays (BOOLEAN Refresh); 210 extern void GetGaugeRect (RECT *pRect, BOOLEAN IsCrewRect); 211 extern void DrawFlagshipStats (void); 212 void DrawAutoPilotMessage (BOOLEAN Reset); 213 214 extern void DeltaSISGauges (SIZE crew_delta, SIZE fuel_delta, int 215 resunit_delta); 216 217 extern COUNT GetCrewCount (void); 218 extern COUNT GetModuleCrewCapacity (BYTE moduleType); 219 220 extern COUNT GetCrewPodCapacity (void); 221 extern COUNT GetCPodCapacity (POINT *ppt); 222 223 extern COUNT GetModuleStorageCapacity (BYTE moduleType); 224 extern COUNT GetStorageBayCapacity (void); 225 extern COUNT GetSBayCapacity (POINT *ppt); 226 227 extern DWORD GetModuleFuelCapacity (BYTE moduleType); 228 extern DWORD GetFuelTankCapacity (void); 229 extern DWORD GetFTankCapacity (POINT *ppt); 230 231 extern COUNT CountSISPieces (BYTE piece_type); 232 233 extern void DrawFlagshipName (BOOLEAN InStatusArea); 234 extern void DrawCaptainsName (void); 235 236 #if defined(__cplusplus) 237 } 238 #endif 239 240 #endif /* SIS_H_INCL__ */ 241 242