float GameLayerLight::getPlantInViewLength(int plantIndex) { PlantNode* plant = GameLayerPlant::getRunningLayer()->getPlantNodeByIndex(plantIndex); auto ip = plant->_cpList.begin(); auto end = plant->_cpList.end(); while (ip!=end) { if (plant->convertToWorldSpace(ip->_point).y >= 0) { break; } ip++; } float len = 0; ContorlPointV2* precp = nullptr; if (ip == end) return len; precp = &(*ip); ip++; while (ip != end) { len += fabs(PathGetLength(*precp, *ip)); precp = &(*ip); ip++; } return len; }
/* ================ sdDeliveryVehicle::Event_StartMagogReturn ================ */ void sdDeliveryVehicle::Event_StartMagogReturn( float startTime, float _pathSpeed, float _leadTime, const idVec3& _endPoint ) { vehicleMode = VMODE_MAGOG; deliveryMode = DMODE_RETURN; modeStartTime = SEC2MS( startTime ); pathSpeed = _pathSpeed; pathLength = PathGetLength(); leadTime = _leadTime; endPoint = _endPoint; }
/* ================ sdDeliveryVehicle::Event_StartJotunReturn ================ */ void sdDeliveryVehicle::Event_StartJotunReturn( float startTime, float _pathSpeed, float _leadTime ) { vehicleMode = VMODE_JOTUN; deliveryMode = DMODE_RETURN; modeStartTime = SEC2MS( startTime ); pathSpeed = _pathSpeed; pathLength = PathGetLength(); leadTime = _leadTime; endPoint = PathGetPoint( PathGetNumPoints() - 1 ); endPoint.z += JOTUN_FLY_HEIGHT; }
/* ================ sdDeliveryVehicle::Event_StartMagogDelivery ================ */ void sdDeliveryVehicle::Event_StartMagogDelivery( float startTime, float _pathSpeed, float _leadTime, const idVec3& _endPoint, float _itemRotation ) { vehicleMode = VMODE_MAGOG; deliveryMode = DMODE_DELIVER; modeStartTime = SEC2MS( startTime ); pathSpeed = _pathSpeed; pathLength = PathGetLength(); leadTime = _leadTime; endPoint = _endPoint; itemRotation = _itemRotation; }