00001 00006 /* 00007 Copyright (C) 2002-2010 UFO: Alien Invasion. 00008 00009 This program is free software; you can redistribute it and/or 00010 modify it under the terms of the GNU General Public License 00011 as published by the Free Software Foundation; either version 2 00012 of the License, or (at your option) any later version. 00013 00014 This program is distributed in the hope that it will be useful, 00015 but WITHOUT ANY WARRANTY; without even the implied warranty of 00016 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. 00017 00018 See the GNU General Public License for more details. 00019 00020 You should have received a copy of the GNU General Public License 00021 along with this program; if not, write to the Free Software 00022 Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. 00023 00024 */ 00025 00026 #ifndef CLIENT_CP_INSTALLATION_H 00027 #define CLIENT_CP_INSTALLATION_H 00028 00029 #define MAX_INSTALLATIONS 16 00030 #define MAX_INSTALLTAIONS_PER_BASE 3 00031 #define MAX_INSTALLATION_TEMPLATES 6 00032 00033 #define MAX_INSTALLATION_DAMAGE 100 00034 #define MAX_INSTALLATION_BATTERIES 5 00035 00036 #define INS_GetInstallationIDX(installation) ((ptrdiff_t)((installation) - ccs.installations)) 00037 #define INS_GetFoundedInstallationCount() (ccs.numInstallations) 00038 00043 typedef enum { 00044 INSTALLATION_NOT_USED, 00045 INSTALLATION_UNDER_CONSTRUCTION, 00046 INSTALLATION_WORKING 00047 } installationStatus_t; 00048 00049 typedef struct installationTemplate_s { 00050 char *id; 00051 char *name; 00052 char *description; 00054 int cost; 00055 int radarRange; 00056 int trackingRange; 00057 int maxBatteries; 00058 int maxUFOsStored; 00059 int maxDamage; 00060 int buildTime; 00061 char *model; 00062 char *image; 00063 } installationTemplate_t; 00064 00065 typedef enum { 00066 INSTALLATION_RADAR, 00067 INSTALLATION_DEFENCE, 00068 INSTALLATION_UFOYARD, 00069 00070 INSTALLATION_TYPE_MAX 00071 } installationType_t; 00072 00074 typedef struct installation_s { 00075 int idx; 00076 char name[MAX_VAR]; 00078 installationTemplate_t *installationTemplate; 00080 qboolean founded; 00081 vec3_t pos; 00083 installationStatus_t installationStatus; 00085 float alienInterest; 00087 struct radar_s radar; 00089 baseWeapon_t batteries[MAX_INSTALLATION_BATTERIES]; 00090 int numBatteries; 00092 capacities_t ufoCapacity; 00094 int installationDamage; 00095 int buildStart; 00096 qboolean selected; 00097 } installation_t; 00098 00100 extern installation_t *installationCurrent; 00101 00103 extern vec2_t newInstallationPos; 00104 00105 /* Functions */ 00106 installation_t *INS_GetInstallationByIDX(int instIdx); 00107 installation_t *INS_GetFoundedInstallationByIDX(int installationIdx); 00108 installation_t *INS_GetFirstUnfoundedInstallation(void); 00109 00110 installationTemplate_t *INS_GetInstallationTemplateFromInstallationID(const char *id); 00111 00112 installationType_t INS_GetType(const installation_t *installation); 00113 00114 installation_t *INS_GetFirstUFOYard(qboolean free); 00115 00116 void INS_SetUpInstallation(installation_t* installation, installationTemplate_t *installationTemplate, vec2_t pos); 00117 00118 installation_t *INS_GetCurrentSelectedInstallation(void); 00119 void INS_SetCurrentSelectedInstallation(const installation_t *installation); 00120 void INS_SelectInstallation(installation_t *installation); 00121 00122 void INS_UpdateInstallationData(void); 00123 00124 void INS_DestroyInstallation(installation_t *installation); 00125 00126 void INS_InitStartup(void); 00127 void INS_ParseInstallations(const char *name, const char **text); 00128 00129 #endif /* CLIENT_CP_INSTALLATION_H */