62
62
63
63
#define DIRECT_PROJ_SPEED 500
64
64
#define VTOL_HITBOX_MODIFICATOR 100
65
+ #define STRUCT_HITBOX_MAPPER 32
65
66
66
67
typedef struct _interval
67
68
{
@@ -2005,8 +2006,7 @@ UDWORD establishTargetHeight(BASE_OBJECT *psTarget)
2005
2006
case OBJ_DROID :
2006
2007
{
2007
2008
DROID * psDroid = (DROID * )psTarget ;
2008
- unsigned int height = asBodyStats [psDroid -> asBits [COMP_BODY ].nStat ].pIMD -> max .y - asBodyStats [psDroid -> asBits [COMP_BODY ].nStat ].pIMD -> min .y ;
2009
- unsigned int utilityHeight = 0 , yMax = 0 , yMin = 0 ; // Temporaries for addition of utility's height to total height
2009
+ unsigned int height = asBodyStats [psDroid -> asBits [COMP_BODY ].nStat ].pIMD -> max .y ;
2010
2010
2011
2011
// VTOL's don't have pIMD either it seems...
2012
2012
if (isVtolDroid (psDroid ))
@@ -2023,29 +2023,24 @@ UDWORD establishTargetHeight(BASE_OBJECT *psTarget)
2023
2023
if ((asWeaponStats [psDroid -> asWeaps [0 ].nStat ]).pIMD == NULL )
2024
2024
return height ;
2025
2025
2026
- yMax = (asWeaponStats [psDroid -> asWeaps [0 ].nStat ]).pIMD -> max .y ;
2027
- yMin = (asWeaponStats [psDroid -> asWeaps [0 ].nStat ]).pIMD -> min .y ;
2026
+ height += (asWeaponStats [psDroid -> asWeaps [0 ].nStat ]).pIMD -> max .y ;
2028
2027
}
2029
2028
break ;
2030
2029
2031
2030
case DROID_SENSOR :
2032
- yMax = (asSensorStats [psDroid -> asBits [COMP_SENSOR ].nStat ]).pIMD -> max .y ;
2033
- yMin = (asSensorStats [psDroid -> asBits [COMP_SENSOR ].nStat ]).pIMD -> min .y ;
2031
+ height += (asSensorStats [psDroid -> asBits [COMP_SENSOR ].nStat ]).pIMD -> max .y ;
2034
2032
break ;
2035
2033
2036
2034
case DROID_ECM :
2037
- yMax = (asECMStats [psDroid -> asBits [COMP_ECM ].nStat ]).pIMD -> max .y ;
2038
- yMin = (asECMStats [psDroid -> asBits [COMP_ECM ].nStat ]).pIMD -> min .y ;
2035
+ height += (asECMStats [psDroid -> asBits [COMP_ECM ].nStat ]).pIMD -> max .y ;
2039
2036
break ;
2040
2037
2041
2038
case DROID_CONSTRUCT :
2042
- yMax = (asConstructStats [psDroid -> asBits [COMP_CONSTRUCT ].nStat ]).pIMD -> max .y ;
2043
- yMin = (asConstructStats [psDroid -> asBits [COMP_CONSTRUCT ].nStat ]).pIMD -> min .y ;
2039
+ height += (asConstructStats [psDroid -> asBits [COMP_CONSTRUCT ].nStat ]).pIMD -> max .y ;
2044
2040
break ;
2045
2041
2046
2042
case DROID_REPAIR :
2047
- yMax = (asRepairStats [psDroid -> asBits [COMP_REPAIRUNIT ].nStat ]).pIMD -> max .y ;
2048
- yMin = (asRepairStats [psDroid -> asBits [COMP_REPAIRUNIT ].nStat ]).pIMD -> min .y ;
2043
+ height += (asRepairStats [psDroid -> asBits [COMP_REPAIRUNIT ].nStat ]).pIMD -> max .y ;
2049
2044
break ;
2050
2045
2051
2046
case DROID_PERSON :
@@ -2062,19 +2057,15 @@ UDWORD establishTargetHeight(BASE_OBJECT *psTarget)
2062
2057
return height ;
2063
2058
}
2064
2059
2065
- // TODO: check the /2 - does this really make sense? why + ?
2066
- utilityHeight = (yMax + yMin )/2 ;
2067
-
2068
- return height + utilityHeight ;
2060
+ return height ;
2069
2061
}
2070
2062
case OBJ_STRUCTURE :
2071
2063
{
2072
2064
STRUCTURE_STATS * psStructureStats = ((STRUCTURE * )psTarget )-> pStructureType ;
2073
- return ( psStructureStats -> pIMD -> max . y + psStructureStats -> pIMD -> min . y );
2065
+ return psStructureStats -> height * STRUCT_HITBOX_MAPPER ; // Map stats to reasonable structure heights
2074
2066
}
2075
2067
case OBJ_FEATURE :
2076
- // Just use imd ymax+ymin
2077
- return (psTarget -> sDisplay .imd -> max .y + psTarget -> sDisplay .imd -> min .y );
2068
+ return psTarget -> sDisplay .imd -> max .y ;
2078
2069
case OBJ_PROJECTILE :
2079
2070
return BULLET_FLIGHT_HEIGHT ;
2080
2071
default :
0 commit comments