diff options
Diffstat (limited to 'engines/scumm/he/moonbase/ai_traveller.cpp')
-rw-r--r-- | engines/scumm/he/moonbase/ai_traveller.cpp | 60 |
1 files changed, 30 insertions, 30 deletions
diff --git a/engines/scumm/he/moonbase/ai_traveller.cpp b/engines/scumm/he/moonbase/ai_traveller.cpp index 5437ab1547..68cf0c0d76 100644 --- a/engines/scumm/he/moonbase/ai_traveller.cpp +++ b/engines/scumm/he/moonbase/ai_traveller.cpp @@ -48,7 +48,7 @@ Traveller::Traveller(int originX, int originY) { } void Traveller::adjustPosX(int offsetX) { - int maxX = GetMaxX(); + int maxX = getMaxX(); int deltaX = _posX + offsetX; if (deltaX < 0) _posX = maxX + deltaX; @@ -57,7 +57,7 @@ void Traveller::adjustPosX(int offsetX) { } void Traveller::adjustPosY(int offsetY) { - int maxY = GetMaxX(); + int maxY = getMaxX(); int deltaY = _posY + offsetY; if (deltaY < 0) _posY = maxY + deltaY; @@ -73,7 +73,7 @@ void Traveller::adjustXY(int offsetX, int offsetY) { float Traveller::calcH() { float retVal = 0; // Calc dist from here to target - retVal = GetDistance(_posX, _posY, _targetPosX, _targetPosY); + retVal = getDistance(_posX, _posY, _targetPosX, _targetPosY); // Divide by _maxDist to get minimum number of jumps to goal retVal /= static_cast<float>(_maxDist); @@ -82,7 +82,7 @@ float Traveller::calcH() { int Traveller::numChildrenToGen() { if (!_numToGen) - _numToGen = GetAnimSpeed() + 2; + _numToGen = getAnimSpeed() + 2; return _numToGen; } @@ -103,14 +103,14 @@ IContainedObject *Traveller::createChildObj(int index, int &completionFlag) { // Calculate angle between here and target int directAngle = 0; - if (GetEnergyHogType()) - directAngle = GetAngle(_posX, _posY, _targetPosX, _targetPosY, 1); + if (getEnergyHogType()) + directAngle = calcAngle(_posX, _posY, _targetPosX, _targetPosY, 1); else - directAngle = GetAngle(_posX, _posY, _targetPosX, _targetPosY); + directAngle = calcAngle(_posX, _posY, _targetPosX, _targetPosY); // Calculate the offset angle for this index if (!_sizeAngleStep) - _sizeAngleStep = 52 - (GetAnimSpeed() * 7); + _sizeAngleStep = 52 - (getAnimSpeed() * 7); dir = _sizeAngleStep * ((static_cast<int>(index / NUM_POWER_STEPS) + 1) >> 1); // Calculate the sign value for the offset for this index @@ -120,12 +120,12 @@ IContainedObject *Traveller::createChildObj(int index, int &completionFlag) { // Calculate power for this index int maxPower = 0; - int directDist = GetDistance(_posX, _posY, _targetPosX, _targetPosY); + int directDist = getDistance(_posX, _posY, _targetPosX, _targetPosY); if (directDist > _maxDist + 120) - maxPower = GetMaxPower(); + maxPower = getMaxPower(); else - maxPower = (static_cast<float>(directDist) / static_cast<float>(_maxDist + 120)) * GetMaxPower(); + maxPower = (static_cast<float>(directDist) / static_cast<float>(_maxDist + 120)) * getMaxPower(); maxPower -= 70; power = maxPower * (1 - ((index % NUM_POWER_STEPS) * SIZE_POWER_STEP)); @@ -139,7 +139,7 @@ IContainedObject *Traveller::createChildObj(int index, int &completionFlag) { int coords = 0; if (!(index % NUM_POWER_STEPS) || (!lastSuccessful)) { - coords = SimulateBuildingLaunch(_posX, _posY, power, angle, 10, 0); + coords = simulateBuildingLaunch(_posX, _posY, power, angle, 10, 0); lastSuccessful = 0; } else { completionState = 1; @@ -156,34 +156,34 @@ IContainedObject *Traveller::createChildObj(int index, int &completionFlag) { completionState = 1; } - int whoseTurn = GetCurrentPlayer(); - int maxX = GetMaxX(); + int whoseTurn = getCurrentPlayer(); + int maxX = getMaxX(); // Check new position to see if landing is clear if (coords > 0) { int yCoord = coords / maxX; int xCoord = coords - (yCoord * maxX); - int terrain = GetTerrain(xCoord, yCoord); + int terrain = getTerrain(xCoord, yCoord); assert(terrain == TERRAIN_TYPE_GOOD); - float pwr = GetMinPower() * .3; + float pwr = getMinPower() * .3; float cosine = cos((static_cast<float>(angle) / 360) * (2 * M_PI)); float sine = sin((static_cast<float>(angle) / 360) * (2 * M_PI)); int xParam = xCoord + (pwr * cosine); int yParam = yCoord + (pwr * sine); if (xParam < 0) - xParam += GetMaxX(); - else if (xParam > GetMaxX()) - xParam -= GetMaxX(); + xParam += getMaxX(); + else if (xParam > getMaxX()) + xParam -= getMaxX(); if (yParam < 0) - yParam += GetMaxY(); - else if (yParam > GetMaxY()) - yParam -= GetMaxY(); + yParam += getMaxY(); + else if (yParam > getMaxY()) + yParam -= getMaxY(); - if (CheckIfWaterState(xParam, yParam)) { + if (checkIfWaterState(xParam, yParam)) { delete retTraveller; return NULL; } @@ -192,7 +192,7 @@ IContainedObject *Traveller::createChildObj(int index, int &completionFlag) { retTraveller->setPosX(xCoord); // Iterate through the previous action list, making sure this one isn't on it - for (intVecItr i = (lastXCoord[whoseTurn]).begin(), j = (lastYCoord[whoseTurn]).begin(); i != (lastXCoord[whoseTurn]).end(); ++i, ++j) { + for (intVecItr i = (lastXCoord[whoseTurn]).begin(), j = (lastYCoord[whoseTurn]).begin(); i != (lastXCoord[whoseTurn]).end(); i++, j++) { // Check if this shot is the same as the last time we tried if ((*i == retTraveller->getPosX()) && (*j == retTraveller->getPosY())) { retTraveller->setDisabled(); @@ -208,8 +208,8 @@ IContainedObject *Traveller::createChildObj(int index, int &completionFlag) { int xCoord = -coords - (yCoord * maxX); // If landing fault is because of water, add 1 extra to g and turn on water flag. Also set coords, and adjust power to water fault location - if (CheckIfWaterState(xCoord, yCoord)) { - int terrainSquareSize = GetTerrainSquareSize(); + if (checkIfWaterState(xCoord, yCoord)) { + int terrainSquareSize = getTerrainSquareSize(); xCoord = ((xCoord / terrainSquareSize * terrainSquareSize) + (terrainSquareSize / 2)); yCoord = ((yCoord / terrainSquareSize * terrainSquareSize) + (terrainSquareSize / 2)); @@ -218,10 +218,10 @@ IContainedObject *Traveller::createChildObj(int index, int &completionFlag) { retTraveller->setPosX(xCoord + (terrainSquareSize * 1.414 * (xDist / (abs(xDist) + 1)))); retTraveller->setPosY(yCoord + (terrainSquareSize * 1.414 * (yDist / (abs(yDist) + 1)))); - int closestHub = GetClosestUnit(retTraveller->getPosX(), retTraveller->getPosY(), GetMaxX(), GetCurrentPlayer(), 1, BUILDING_MAIN_BASE, 1, 110); + int closestHub = getClosestUnit(retTraveller->getPosX(), retTraveller->getPosY(), getMaxX(), getCurrentPlayer(), 1, BUILDING_MAIN_BASE, 1, 110); - retTraveller->setWaterSourceX(GetHubX(closestHub)); - retTraveller->setWaterSourceY(GetHubY(closestHub)); + retTraveller->setWaterSourceX(getHubX(closestHub)); + retTraveller->setWaterSourceY(getHubY(closestHub)); retTraveller->setWaterDestX(retTraveller->getPosX()); retTraveller->setWaterDestY(retTraveller->getPosY()); @@ -242,7 +242,7 @@ IContainedObject *Traveller::createChildObj(int index, int &completionFlag) { } int Traveller::checkSuccess() { - if (GetDistance(_posX + 1, _posY, _targetPosX, _targetPosY) < _maxDist) + if (getDistance(_posX + 1, _posY, _targetPosX, _targetPosY) < _maxDist) return SUCCESS; return 0; |