![]() |
Shadowrun: Awakened 29 September 2011 - Build 871
|
00001 #ifndef __SRAVISIONUTILITY_H 00002 #define __SRAVISIONUTILITY_H 00003 00004 #include "CodeGenMacros.h" 00005 #include "SraTypes.h" 00006 #include "SrConstants.h" 00007 00008 //As of 6/20/2010, this is a legacy file that may need to be re-implemented in UnrealScript as needed 00009 00010 namespace SraLogic 00011 { 00015 INLINE int GetThermalSmokePenalty(Vision vision) 00016 { 00017 switch(vision) 00018 { 00019 case NormalVision: return VISIBILITY_THERMALSMOKE_NORMAL; 00020 case LowLightVision: return VISIBILITY_THERMALSMOKE_LOWLIGHT; 00021 case ThermographicVision: return VISIBILITY_THERMALSMOKE_THERMOGRAPHIC; 00022 case AstralVision: return VISIBILITY_THERMALSMOKE_ASTRAL; 00023 00024 default: return RANGED_TARGET_TOTAL_COVER; 00025 } 00026 } 00027 00031 INLINE int GetHeavyFogPenalty(Vision vision) 00032 { 00033 switch(vision) 00034 { 00035 case NormalVision: return VISIBILITY_HEAVYFOG_NORMAL; 00036 case LowLightVision: return VISIBILITY_HEAVYFOG_LOWLIGHT; 00037 case ThermographicVision: return VISIBILITY_HEAVYFOG_THERMOGRAPHIC; 00038 case AstralVision: return VISIBILITY_HEAVYFOG_ASTRAL; 00039 00040 default: return RANGED_TARGET_TOTAL_COVER; 00041 } 00042 } 00043 00047 INLINE int GetLightFogPenalty(Vision vision) 00048 { 00049 switch(vision) 00050 { 00051 case NormalVision: return VISIBILITY_GLARE_NORMAL; 00052 case LowLightVision: return VISIBILITY_GLARE_LOWLIGHT; 00053 case ThermographicVision: return VISIBILITY_GLARE_THERMOGRAPHIC; 00054 case AstralVision: return VISIBILITY_GLARE_ASTRAL; 00055 00056 default: return RANGED_TARGET_TOTAL_COVER; 00057 } 00058 } 00059 00063 INLINE int GetGlarePenalty(Vision vision) 00064 { 00065 switch(vision) 00066 { 00067 case NormalVision: return VISIBILITY_GLARE_NORMAL; 00068 case LowLightVision: return VISIBILITY_GLARE_LOWLIGHT; 00069 case ThermographicVision: return VISIBILITY_GLARE_THERMOGRAPHIC; 00070 case AstralVision: return VISIBILITY_GLARE_ASTRAL; 00071 00072 default: return RANGED_TARGET_TOTAL_COVER; 00073 } 00074 } 00075 00079 INLINE int GetPartialLightPenalty(Vision vision) 00080 { 00081 switch(vision) 00082 { 00083 case NormalVision: return VISIBILITY_PARTIALLIGHT_NORMAL; 00084 case LowLightVision: return VISIBILITY_PARTIALLIGHT_LOWLIGHT; 00085 case ThermographicVision: return VISIBILITY_PARTIALLIGHT_THERMOGRAPHIC; 00086 case AstralVision: return VISIBILITY_PARTIALLIGHT_ASTRAL; 00087 00088 default: return RANGED_TARGET_TOTAL_COVER; 00089 } 00090 } 00091 00095 INLINE int GetTotalDarknessPenalty(Vision vision) 00096 { 00097 switch(vision) 00098 { 00099 case NormalVision: return VISIBILITY_FULLDARK_NORMAL; 00100 case LowLightVision: return VISIBILITY_FULLDARK_LOWLIGHT; 00101 case ThermographicVision: return VISIBILITY_FULLDARK_THERMOGRAPHIC; 00102 case AstralVision: return VISIBILITY_FULLDARK_ASTRAL; 00103 00104 default: return RANGED_TARGET_TOTAL_COVER; 00105 } 00106 } 00107 00112 INLINE int GetTotalVisibilityPenalty(Visibility visibility, Vision vision) 00113 { 00114 //if there are no visbility issues, then we don't even need to calculate 00115 if(visibility == NoObstruction) 00116 return 0; 00117 00118 if((visibility & TotalObstruction) || (visibility & PartialObstruction)) 00119 return RANGED_TARGET_TOTAL_COVER; 00120 00121 //if we do need to calculate, then start at zero 00122 int total = 0; 00123 00124 //find the light-based penalty, checking darkest first 00125 if(visibility & FullDarkness) 00126 total += GetTotalDarknessPenalty(vision); 00127 else if(visibility & PartialLight) 00128 total += GetPartialLightPenalty(vision); 00129 00130 //check for glare 00131 if(visibility & Glare) 00132 total += GetGlarePenalty(vision); 00133 00134 //check for smoke (thermal smoke is worst, then heavy fog, then light fog) 00135 if(visibility & ThermalSmoke) 00136 total += GetThermalSmokePenalty(vision); 00137 else if(visibility & HeavyFog) 00138 total += GetHeavyFogPenalty(vision); 00139 else if(visibility & LightFog) 00140 total += GetLightFogPenalty(vision); 00141 00142 //visibility can't be worse than total cover 00143 if(total > RANGED_TARGET_TOTAL_COVER) 00144 return RANGED_TARGET_TOTAL_COVER; 00145 00146 return total; 00147 } 00148 } 00149 00150 #endif
Copyright © 2007-2010 by The Shadowrun: Awakened Team. This work is licensed under the GNU Lesser General Public License 3.