This graph shows which files directly or indirectly include this file:
Go to the source code of this file.
Functions | |
void | sendECMNotification (MECH *objMech, int wMsgType) |
void | checkECM (MECH *objMech) |
void checkECM | ( | MECH * | objMech | ) |
Definition at line 95 of file mech.ecm.c.
References AngelECCMEnabled, AngelECMEnabled, AngelECMProtected, AnyECMDisturbed, checkAllSections(), ECCMEnabled, ECM_NOTIFY_COUNTERED, ECM_NOTIFY_DISTURBED, ECM_NOTIFY_UNCOUNTERED, ECM_NOTIFY_UNDISTURBED, ECM_RANGE, ECMCountered, ECMEnabled, ECMProtected, FaMechRange, FindObjectsData(), MAP::first_free, INARC_ECM_ATTACHED, MECH::mapindex, MarkForLOSUpdate(), MAP::mechsOnMap, MechStatus2, MechTeam, PerECCMEnabled, PerECMEnabled, sendECMNotification(), SetAngelECMDisturbed, SetAngelECMProtected, SetECMCountered, SetECMDisturbed, SetECMProtected, STH_ARMOR_ON, UnSetAngelECMDisturbed, UnSetAngelECMProtected, UnSetECMCountered, UnSetECMDisturbed, and UnSetECMProtected.
Referenced by aero_update(), changeStealthArmorEvent(), DestroySection(), mech_update(), MissileHitTarget(), and update_LOSinfo().
00096 { 00097 MAP *objMapmap; 00098 MECH *objOtherMech; 00099 float range = 0.0; 00100 00101 int wFriendlyECM = 0; 00102 int wFriendlyECCM = 0; 00103 int wUnFriendlyECM = 0; 00104 int wUnFriendlyECCM = 0; 00105 00106 int wFriendlyAngelECM = 0; 00107 int wFriendlyAngelECCM = 0; 00108 int wUnFriendlyAngelECM = 0; 00109 int wUnFriendlyAngelECCM = 0; 00110 00111 int wFriendlyECMDelta = 0; 00112 int wFriendlyECCMDelta = 0; 00113 00114 int tCheckECM = 0; 00115 int tCheckECCM = 0; 00116 00117 int wIter = 0; 00118 int tMark = 0; 00119 00120 if(!(objMapmap = FindObjectsData(objMech->mapindex))) /* get our map */ 00121 return; 00122 00123 for(wIter = 0; wIter < objMapmap->first_free; wIter++) { 00124 if(!(objOtherMech = FindObjectsData(objMapmap->mechsOnMap[wIter]))) 00125 continue; 00126 00127 if((range = FaMechRange(objOtherMech, objMech)) > ECM_RANGE) 00128 continue; 00129 00130 if(MechTeam(objOtherMech) == MechTeam(objMech)) { 00131 if(ECMEnabled(objOtherMech)) 00132 wFriendlyECM++; 00133 00134 if(ECCMEnabled(objOtherMech)) 00135 wFriendlyECCM++; 00136 00137 if(AngelECMEnabled(objOtherMech)) 00138 wFriendlyAngelECM++; 00139 00140 if(AngelECCMEnabled(objOtherMech)) 00141 wFriendlyAngelECCM++; 00142 00143 if(range <= 0.5) { 00144 if(PerECMEnabled(objOtherMech)) 00145 wFriendlyECM++; 00146 00147 if(PerECCMEnabled(objOtherMech)) 00148 wFriendlyECCM++; 00149 } 00150 } else { 00151 if(ECMEnabled(objOtherMech)) 00152 wUnFriendlyECM++; 00153 00154 if(ECCMEnabled(objOtherMech)) 00155 wUnFriendlyECCM++; 00156 00157 if(AngelECMEnabled(objOtherMech)) 00158 wUnFriendlyAngelECM++; 00159 00160 if(AngelECCMEnabled(objOtherMech)) 00161 wUnFriendlyAngelECCM++; 00162 00163 if(range <= 0.5) { 00164 if(PerECMEnabled(objOtherMech)) 00165 wUnFriendlyECM++; 00166 00167 if(PerECCMEnabled(objOtherMech)) 00168 wUnFriendlyECCM++; 00169 } 00170 } 00171 } 00172 00173 if((MechStatus2(objMech) & STH_ARMOR_ON) || 00174 checkAllSections(objMech, INARC_ECM_ATTACHED)) 00175 wUnFriendlyECM += 1000; 00176 00177 /* Generate our deltas */ 00178 wFriendlyECMDelta = 00179 wFriendlyECM + (2 * wFriendlyAngelECM) - wUnFriendlyECCM - 00180 (2 * wUnFriendlyAngelECCM); 00181 wFriendlyECCMDelta = 00182 wFriendlyECCM + (2 * wFriendlyAngelECCM) - wUnFriendlyECM - 00183 (2 * wUnFriendlyAngelECM); 00184 00185 tCheckECM = ((wFriendlyECM != 0) || (wFriendlyAngelECM != 0) || 00186 (wUnFriendlyECCM != 0) || (wUnFriendlyAngelECCM != 0)); 00187 tCheckECCM = ((wFriendlyECCM != 0) || (wFriendlyAngelECCM != 0) || 00188 (wUnFriendlyECM != 0) || (wUnFriendlyAngelECM != 0)); 00189 00190 /* SendDebug(tprintf("Checking unit %d. ECMDelta: %d. ECCMDelta: %d. CheckECM: %d. CheckECCM: %d",objMech->mynum,wFriendlyECMDelta,wFriendlyECCMDelta,tCheckECM,tCheckECCM)); */ 00191 00192 /* Now we do our checks... */ 00193 /* Let's first see if we should just reset our flags... 'cause there's no ECM or ECCM around */ 00194 if(!tCheckECM) { 00195 if(ECMCountered(objMech)) { 00196 sendECMNotification(objMech, ECM_NOTIFY_UNCOUNTERED); 00197 UnSetECMCountered(objMech); 00198 tMark = 1; 00199 } 00200 00201 if(ECMProtected(objMech) || AngelECMProtected(objMech)) { 00202 UnSetECMProtected(objMech); 00203 UnSetAngelECMProtected(objMech); 00204 tMark = 1; 00205 } 00206 } 00207 00208 if(!tCheckECCM) { 00209 if(AnyECMDisturbed(objMech)) { 00210 sendECMNotification(objMech, ECM_NOTIFY_UNDISTURBED); 00211 UnSetECMDisturbed(objMech); 00212 UnSetAngelECMDisturbed(objMech); 00213 tMark = 1; 00214 } 00215 } 00216 00217 /* Sanity check so we don't bother to do all the other checks */ 00218 if(!tCheckECM && !tCheckECCM) { 00219 if(tMark) 00220 MarkForLOSUpdate(objMech); 00221 00222 return; 00223 } 00224 00225 /* Now we see if our ECM has been countered */ 00226 if(tCheckECM) { 00227 if(wFriendlyECMDelta <= 0) { /* They have the same or more ECCM than we have ECM */ 00228 if(!ECMCountered(objMech)) { 00229 sendECMNotification(objMech, ECM_NOTIFY_COUNTERED); 00230 SetECMCountered(objMech); 00231 UnSetECMProtected(objMech); 00232 UnSetAngelECMProtected(objMech); 00233 } 00234 } else { 00235 if(ECMCountered(objMech)) { 00236 sendECMNotification(objMech, ECM_NOTIFY_UNCOUNTERED); 00237 UnSetECMCountered(objMech); 00238 } 00239 00240 if(wFriendlyECM > 0) 00241 SetECMProtected(objMech); 00242 else 00243 UnSetECMProtected(objMech); 00244 00245 if(wFriendlyAngelECM > 0) 00246 SetAngelECMProtected(objMech); 00247 else 00248 UnSetAngelECMProtected(objMech); 00249 } 00250 } 00251 00252 /* Now we see if we're under an enemy ECM umbrella */ 00253 if(tCheckECCM) { 00254 if(wFriendlyECCMDelta < 0) { /* They have more ECM than we have ECCM */ 00255 if(!AnyECMDisturbed(objMech)) { 00256 sendECMNotification(objMech, ECM_NOTIFY_DISTURBED); 00257 00258 if(wUnFriendlyECM > 0) 00259 SetECMDisturbed(objMech); 00260 else 00261 UnSetECMDisturbed(objMech); 00262 00263 if(wUnFriendlyAngelECM > 0) 00264 SetAngelECMDisturbed(objMech); 00265 else 00266 UnSetAngelECMDisturbed(objMech); 00267 00268 MarkForLOSUpdate(objMech); 00269 } 00270 } else { 00271 if(AnyECMDisturbed(objMech)) { 00272 sendECMNotification(objMech, ECM_NOTIFY_UNDISTURBED); 00273 00274 UnSetECMDisturbed(objMech); 00275 UnSetAngelECMDisturbed(objMech); 00276 MarkForLOSUpdate(objMech); 00277 } 00278 } 00279 } 00280 }
void sendECMNotification | ( | MECH * | objMech, | |
int | wMsgType | |||
) |
Definition at line 32 of file mech.ecm.c.
References BEAGLE_DESTROYED, BEAGLE_PROBE_TECH, BLOODHOUND_DESTROYED, BLOODHOUND_PROBE_TECH, ECM_NOTIFY_COUNTERED, ECM_NOTIFY_DISTURBED, ECM_NOTIFY_UNCOUNTERED, ECM_NOTIFY_UNDISTURBED, HasWorkingECMSuite, IsC3, IsC3i, mech_notify(), MECHALL, MechCritStatus, MechSpecials, and MechSpecials2.
Referenced by checkECM().
00033 { 00034 switch (wMsgType) { 00035 case ECM_NOTIFY_DISTURBED: 00036 00037 #ifdef LOUD_ECM 00038 mech_notify(objMech, MECHALL, 00039 "Half your screens are suddenly filled with static!"); 00040 00041 #ifdef VERY_LOUD_ECM 00042 if(MechSpecials(objMech) & BEAGLE_PROBE_TECH && 00043 !(MechCritStatus(objMech) & BEAGLE_DESTROYED)) 00044 mech_notify(objMech, MECHALL, 00045 "Your Beagle Active Probe is inoperative!"); 00046 if(MechSpecials2(objMech) & BLOODHOUND_PROBE_TECH && 00047 !(MechCritStatus(objMech) & BLOODHOUND_DESTROYED)) 00048 mech_notify(objMech, MECHALL, 00049 "Your Bloodhound Active Probe is inoperative!"); 00050 if(IsC3(objMech)) 00051 mech_notify(objMech, MECHALL, "Your C3 network is inoperative!"); 00052 if(IsC3i(objMech)) 00053 mech_notify(objMech, MECHALL, "Your C3i network is inoperative!"); 00054 00055 #endif /* */ 00056 #endif /* */ 00057 break; 00058 case ECM_NOTIFY_UNDISTURBED: 00059 00060 #ifdef LOUD_ECM 00061 mech_notify(objMech, MECHALL, 00062 "All your systems are back to normal again!"); 00063 00064 #ifdef VERY_LOUD_ECM 00065 if(MechSpecials(objMech) & BEAGLE_PROBE_TECH && 00066 !(MechCritStatus(objMech) & BEAGLE_DESTROYED)) 00067 mech_notify(objMech, MECHALL, 00068 "Your Beagle Active Probe is operational again!"); 00069 if(MechSpecials2(objMech) & BLOODHOUND_PROBE_TECH && 00070 !(MechCritStatus(objMech) & BLOODHOUND_DESTROYED)) 00071 mech_notify(objMech, MECHALL, 00072 "Your Bloodhound Active Probe is operational again!"); 00073 if(IsC3(objMech)) 00074 mech_notify(objMech, MECHALL, 00075 "Your C3 network is operational again!"); 00076 if(IsC3i(objMech)) 00077 mech_notify(objMech, MECHALL, 00078 "Your C3i network is operational again!"); 00079 00080 #endif /* */ 00081 #endif /* */ 00082 break; 00083 case ECM_NOTIFY_COUNTERED: 00084 if(HasWorkingECMSuite(objMech)) 00085 mech_notify(objMech, MECHALL, 00086 "Your ECM suite's ready light turns red, countered by enemy ECCM!"); 00087 break; 00088 case ECM_NOTIFY_UNCOUNTERED: 00089 if(HasWorkingECMSuite(objMech)) 00090 mech_notify(objMech, MECHALL, 00091 "Your ECM suite's ready light turns green, enemy ECCM is out of range."); 00092 break; 00093 } 00094 }