#include "mech.h"
#include "mech.sensor.h"
#include "p.map.obj.h"
#include "p.mech.update.h"
#include "p.mech.utils.h"
#include "p.template.h"
Include dependency graph for mech.sensor.functions.c:
Go to the source code of this file.
Defines | |
#define | HEAT_MODIFIER(a) ((a) <= 7 ? 2 : (a) <= 10 ? 1 : (a) <= 15 ? 0 : (a) <= 22 ? -1 : -2) |
#define | WEIGHT_MODIFIER(a) (a > 65 ? -1 : a > 35 ? 0 : 1) |
#define | MOVE_MODIFIER(a) (abs(a) >= 10.75 ? 1 : 0) |
#define | nwood_count(mech, a) |
Functions | |
SEEFUNC (vislight_see, r >(c *((!l &&t &&IsLit(t))?3:1))?0:(100-(r/3))/((t &&(MechType(t)==CLASS_BSUIT||MechType(t)==CLASS_MW))?3:1)) | |
SEEFUNC (liteamp_see,((!l &&r >(2 *c))?0:(l &&r > c)?0:(70-r))/((t &&(MechType(t)==CLASS_BSUIT||MechType(t)==CLASS_MW))?3:1)) | |
SEEFUNC (infrared_see,(80-r)) | |
SEEFUNC (electrom_see, MAX(r< 24?2:0,(60-(r *2)))/2) | |
SEEFUNC (seismic_see, 50-(r *4)) | |
SEEFUNC (radar_see, BOUNDED(10,(180-r), 90)) | |
SEEFUNC (bap_see, 101) | |
SEEFUNC (blood_see, 101) | |
float | ActualElevation (MAP *map, int x, int y, MECH *mech) |
CSEEFUNC (vislight_csee,!(map->sensorflags &(1<< SENSOR_VIS))&&!(f &(MECHLOSFLAG_BLOCK|MECHLOSFLAG_FIRE|MECHLOSFLAG_SMOKE))&&MechLOSFlag_WoodCount(f)< 3 &&(!t||MechZ(t) >=0||ActualElevation(getMap(t->mapindex), MechX(t), MechY(t), t) >=0.0||MechLOSFlag_WaterCount(f)< 6)) | |
CSEEFUNC (liteamp_csee,!(map->sensorflags &(1<< SENSOR_LA))&&!(f &(MECHLOSFLAG_BLOCK|MECHLOSFLAG_FIRE|MECHLOSFLAG_SMOKE))&&(!t||!IsLit(t))&&MechLOSFlag_WoodCount(f)< 2 &&!(MechLOSFlag_WaterCount(f))) | |
CSEEFUNC (infrared_csee,!(map->sensorflags &(1<< SENSOR_IR))&&!(f &(MECHLOSFLAG_BLOCK|MECHLOSFLAG_FIRE))&&MechLOSFlag_WoodCount(f)< 6 &&(!t||(MechType(t)!=CLASS_BSUIT &&MechType(t)!=CLASS_MW))) | |
CSEEFUNC (electrom_csee,!(map->sensorflags &(1<< SENSOR_EM))&&!(f &(MECHLOSFLAG_BLOCK|MECHLOSFLAG_MNTN))&&MechLOSFlag_WoodCount(f)< 8 &&!AnyECMDisturbed(m)&&(!t||(MechType(t)!=CLASS_MW))) | |
CSEEFUNC (seismic_csee,!(map->sensorflags &(1<< SENSOR_SE))&&t &&(!Jumping(m))&&(mudconf.btech_seismic_see_stopped?1:(abs(MechSpeed(t)) > MP1))&&(((MechMove(m)!=MOVE_VTOL)||((MechMove(m)==MOVE_VTOL)&&Landed(m)))&&((MechMove(m)!=MOVE_FLY)||((MechMove(m)==MOVE_FLY)&&Landed(m)))&&Started(t)&&!Jumping(t)&&(MechType(t)!=CLASS_BSUIT)&&(MechType(t)!=CLASS_MW)&&(MechMove(t)!=MOVE_HOVER)&&((MechMove(t)!=MOVE_VTOL)||((MechMove(t)==MOVE_VTOL)&&Landed(t)))&&((MechMove(t)!=MOVE_FLY)||((MechMove(t)==MOVE_FLY)&&Landed(t))))&&(MechMove(t)!=MOVE_NONE)) | |
CSEEFUNC (radar_csee,!(map->sensorflags &(1<< SENSOR_RA))&&t &&MechZ(t) > 2 &&!(f &MECHLOSFLAG_BLOCK)&&(MechZ(t) >=10||(r< (MechZ(t)*MechZ(t))))&&MechsElevation(t) > 1) | |
CSEEFUNC (bap_csee,!(map->sensorflags &(1<< SENSOR_BAP))&&!AnyECMDisturbed(m)&&t &&!AngelECMProtected(t)&&!StealthArmorActive(t)&&!NullSigSysActive(t)) | |
CSEEFUNC (blood_csee,!(map->sensorflags &(1<< SENSOR_BHAP))&&!AnyECMDisturbed(m)&&t &&!AngelECMProtected(t)) | |
TOHITFUNC (vislight_tohit,((!t||!IsLit(t))?(2-l):0)+nwood_count(t, f)+((f &MECHLOSFLAG_PARTIAL)?3+(IsHulldown(t)?2:0):0)) | |
TOHITFUNC (liteamp_tohit,((2-l)/2)+((nwood_count(t, f)*3)/2)+((f &MECHLOSFLAG_PARTIAL)?3+(IsHulldown(t)?2:0):0)) | |
TOHITFUNC (infrared_tohit,((nwood_count(t, f)*4)/3)+((f &MECHLOSFLAG_PARTIAL)?3+(IsHulldown(t)?2:0):0)+HEAT_MODIFIER(MechHeat(t)+7)) | |
TOHITFUNC (electrom_tohit,((nwood_count(t, f)*2)/3)+((f &MECHLOSFLAG_PARTIAL)?3+(IsHulldown(t)?2:0):0)+WEIGHT_MODIFIER(MechTons(t))+MOVE_MODIFIER(MechSpeed(t))+(MechStatus(t)&FIRED?-1:0)+MNumber(m, 0, 1)) | |
TOHITFUNC (seismic_tohit, 2+((f &MECHLOSFLAG_PARTIAL)?3+(IsHulldown(t)?2:0):0)+WEIGHT_MODIFIER(MechRealTons(t))-MOVE_MODIFIER(MechSpeed(t))+MNumber(m, 0, 1)) | |
TOHITFUNC (bap_tohit, MNumber(m, 0, 2)) | |
TOHITFUNC (blood_tohit, MNumber(m, 0, 2)) | |
TOHITFUNC (radar_tohit,((MechZ(t) >=10||FlyingT(t))?-3:0)+((f &MECHLOSFLAG_PARTIAL)?2+(IsHulldown(t)?2:0):0)+nwood_count(t, f)) |
#define HEAT_MODIFIER | ( | a | ) | ((a) <= 7 ? 2 : (a) <= 10 ? 1 : (a) <= 15 ? 0 : (a) <= 22 ? -1 : -2) |
Definition at line 155 of file mech.sensor.functions.c.
#define MOVE_MODIFIER | ( | a | ) | (abs(a) >= 10.75 ? 1 : 0) |
Definition at line 161 of file mech.sensor.functions.c.
#define nwood_count | ( | mech, | |||
a | ) |
Value:
(MechLOSFlag_WoodCount(a) + \ ((MechElevation(mech) + 2) < MechZ(mech) ? 0 : \ MechRTerrain(mech) == LIGHT_FOREST ? 1 : \ MechRTerrain(mech) == HEAVY_FOREST ? 2 : 0))
Definition at line 163 of file mech.sensor.functions.c.
#define WEIGHT_MODIFIER | ( | a | ) | (a > 65 ? -1 : a > 35 ? 0 : 1) |
Definition at line 158 of file mech.sensor.functions.c.
Definition at line 35 of file mech.los.c.
00036 { 00037 00038 if(!map) 00039 return 0.0; 00040 if(!mech) 00041 return (float) (Elevation(map, x, y) + 0.1); 00042 if(MechType(mech) == CLASS_MECH && !Fallen(mech)) 00043 return (float) MechZ(mech) + 1.5; 00044 else if(MechMove(mech) == MOVE_NONE) 00045 return (float) MechZ(mech) + 1.5; 00046 else if(IsDS(mech)) 00047 return (float) MechZ(mech) + 2.5 + (MechType(mech) == 00048 CLASS_DS ? 0 : 2); 00049 if(MechDugIn(mech)) 00050 return (float) MechZ(mech) + 0.1; 00051 return (float) MechZ(mech) + 0.5; 00052 }
CSEEFUNC | ( | blood_csee | , | |
! | (map->sensorflags &(1<< SENSOR_BHAP))&&!AnyECMDisturbed(m)&&t &&!AngelECMProtected(t) | |||
) |
CSEEFUNC | ( | bap_csee | , | |
! | (map->sensorflags &(1<< SENSOR_BAP))&&!AnyECMDisturbed(m)&&t &&!AngelECMProtected(t)&&!StealthArmorActive(t)&&!NullSigSysActive(t) | |||
) |
CSEEFUNC | ( | radar_csee | , | |
! | (map->sensorflags &(1<< SENSOR_RA))&&t &&MechZ(t), | |||
2 &&! | (f &MECHLOSFLAG_BLOCK)&&(MechZ(t) >=10||(r< (MechZ(t)*MechZ(t))))&&MechsElevation(t), | |||
1 | ||||
) |
CSEEFUNC | ( | seismic_csee | , | |
! | (map->sensorflags &(1<< SENSOR_SE))&&t &&(!Jumping(m))&&(mudconf.btech_seismic_see_stopped?1:(abs(MechSpeed(t)) > MP1))&&(((MechMove(m)!=MOVE_VTOL)||((MechMove(m)==MOVE_VTOL)&&Landed(m)))&&((MechMove(m)!=MOVE_FLY)||((MechMove(m)==MOVE_FLY)&&Landed(m)))&&Started(t)&&!Jumping(t)&&(MechType(t)!=CLASS_BSUIT)&&(MechType(t)!=CLASS_MW)&&(MechMove(t)!=MOVE_HOVER)&&((MechMove(t)!=MOVE_VTOL)||((MechMove(t)==MOVE_VTOL)&&Landed(t)))&&((MechMove(t)!=MOVE_FLY)||((MechMove(t)==MOVE_FLY)&&Landed(t))))&&(MechMove(t)!=MOVE_NONE) | |||
) |
CSEEFUNC | ( | electrom_csee | ) |
CSEEFUNC | ( | infrared_csee | ) |
CSEEFUNC | ( | liteamp_csee | ) |
CSEEFUNC | ( | vislight_csee | ) |
SEEFUNC | ( | blood_see | , | |
101 | ||||
) |
SEEFUNC | ( | bap_see | , | |
101 | ||||
) |
SEEFUNC | ( | radar_see | , | |
BOUNDED(10,(180-r), 90) | ||||
) |
SEEFUNC | ( | seismic_see | , | |
50- | (r *4) | |||
) |
SEEFUNC | ( | electrom_see | , | |
MAX(r< 24?2:0,(60-(r *2)))/ | 2 | |||
) |
SEEFUNC | ( | infrared_see | , | |
(80-r) | ||||
) |
SEEFUNC | ( | liteamp_see | , | |
((!l &&r >(2 *c))?0:(l &&r > c)?0:(70-r))/((t &&(MechType(t)==CLASS_BSUIT||MechType(t)==CLASS_MW))?3:1) | ||||
) |
SEEFUNC | ( | vislight_see | , | |
r | , | |||
(c *((!l &&t &&IsLit(t))?3:1))?0:(100-(r/3))/((t &&(MechType(t)==CLASS_BSUIT||MechType(t)==CLASS_MW))?3:1) | ||||
) |
TOHITFUNC | ( | radar_tohit | , | |
((MechZ(t) >=10||FlyingT(t))?-3:0)+((f &MECHLOSFLAG_PARTIAL)?2+(IsHulldown(t)?2:0):0)+nwood_count(t, f) | ||||
) |
TOHITFUNC | ( | blood_tohit | , | |
MNumber(m, 0, 2) | ||||
) |
TOHITFUNC | ( | bap_tohit | , | |
MNumber(m, 0, 2) | ||||
) |
TOHITFUNC | ( | seismic_tohit | , | |
2+ | ((f &MECHLOSFLAG_PARTIAL)?3+(IsHulldown(t)?2:0):0)+WEIGHT_MODIFIER(MechRealTons(t))-MOVE_MODIFIER(MechSpeed(t))+MNumber(m, 0, 1) | |||
) |
TOHITFUNC | ( | electrom_tohit | , | |
((nwood_count(t, f)*2)/3)+((f &MECHLOSFLAG_PARTIAL)?3+(IsHulldown(t)?2:0):0)+WEIGHT_MODIFIER(MechTons(t))+MOVE_MODIFIER(MechSpeed(t))+(MechStatus(t)&FIRED?-1:0)+MNumber(m, 0, 1) | ||||
) |
TOHITFUNC | ( | infrared_tohit | , | |
((nwood_count(t, f)*4)/3)+((f &MECHLOSFLAG_PARTIAL)?3+(IsHulldown(t)?2:0):0)+HEAT_MODIFIER(MechHeat(t)+7) | ||||
) |
TOHITFUNC | ( | liteamp_tohit | , | |
((2-l)/2)+((nwood_count(t, f)*3)/2)+((f &MECHLOSFLAG_PARTIAL)?3+(IsHulldown(t)?2:0):0) | ||||
) |
TOHITFUNC | ( | vislight_tohit | , | |
((!t||!IsLit(t))?(2-l):0)+nwood_count(t, f)+((f &MECHLOSFLAG_PARTIAL)?3+(IsHulldown(t)?2:0):0) | ||||
) |