/** * @brief Converts a grid position to world coordinates * @sa Grid_Height * @param[in] map The routing map * @param[in] actorSize width of the actor in cells * @param[in] pos The grid position * @param[out] vec The world vector */ void Grid_PosToVec (const routing_t *map, const actorSizeEnum_t actorSize, const pos3_t pos, vec3_t vec) { SizedPosToVec(pos, actorSize, vec); #ifdef PARANOID if (pos[2] >= PATHFINDING_HEIGHT) Com_Printf("Grid_PosToVec: Warning - z level bigger than 7 (%i - source: %.02f)\n", pos[2], vec[2]); #endif /* Clamp the floor value between 0 and UNIT_HEIGHT */ vec[2] += max(0, min(UNIT_HEIGHT, Grid_Floor(map, actorSize, pos))); }
/** * @brief Converts a grid position to world coordinates * @param[in] routing The routing map * @param[in] actorSize width of the actor in cells * @param[in] pos The grid position * @param[out] vec The world vector */ void Grid_PosToVec (const Routing &routing, const actorSizeEnum_t actorSize, const pos3_t pos, vec3_t vec) { SizedPosToVec(pos, actorSize, vec); #ifdef PARANOID if (pos[2] >= PATHFINDING_HEIGHT) Com_Printf("Grid_PosToVec: Warning - z level bigger than 7 (%i - source: %.02f)\n", pos[2], vec[2]); #endif /* Clamp the floor value between 0 and UNIT_HEIGHT */ const int gridFloor = Grid_Floor(routing, actorSize, pos); vec[2] += std::max(0, std::min(UNIT_HEIGHT, gridFloor)); }