[Scummvm-git-logs] scummvm master -> 65bf202a33e812fd2b4ed4e4c229156e4d8f9f78
dreammaster
paulfgilbert at gmail.com
Thu May 14 01:43:35 UTC 2020
This automated email contains information about 4 new commits which have been
pushed to the 'scummvm' repo located at https://github.com/scummvm/scummvm .
Summary:
f63dd075fa ULTIMA4: Removal of redundant ifdefs
bc84f8799e ULTIMA4: Janitorial
1945dc1bff ULTIMA4: Refactor blank function static
65bf202a33 ULTIMA4: Janitorial of if else blocks
Commit: f63dd075fa562557cdda2b12eb004e76e362920f
https://github.com/scummvm/scummvm/commit/f63dd075fa562557cdda2b12eb004e76e362920f
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2020-05-13T16:24:59-07:00
Commit Message:
ULTIMA4: Removal of redundant ifdefs
Changed paths:
engines/ultima/ultima4/controllers/intro_controller.cpp
engines/ultima/ultima4/controllers/intro_controller.h
engines/ultima/ultima4/game/script.cpp
engines/ultima/ultima4/game/script.h
diff --git a/engines/ultima/ultima4/controllers/intro_controller.cpp b/engines/ultima/ultima4/controllers/intro_controller.cpp
index 2990c4f3f5..8c3ce8dc21 100644
--- a/engines/ultima/ultima4/controllers/intro_controller.cpp
+++ b/engines/ultima/ultima4/controllers/intro_controller.cpp
@@ -1136,15 +1136,6 @@ void IntroController::updateInputMenu(MenuEvent &event) {
// save settings
settings.setData(_settingsChanged);
settings.write();
-
-#ifdef SLACK_ON_SDL_AGNOSTICISM
- if (settings.mouseOptions.enabled) {
- SDL_ShowCursor(SDL_ENABLE);
- } else {
- SDL_ShowCursor(SDL_DISABLE);
- }
-#endif
-
break;
case CANCEL:
// discard settings
@@ -1434,7 +1425,7 @@ void IntroController::initTitles() {
eventHandler->getTimer()->reset(settings._titleSpeedOther);
}
-void IntroController::addTitle(int x, int y, int w, int h, AnimType method, int delay, int duration) {
+void IntroController::addTitle(int x, int y, int w, int h, AnimType method, uint32 delay, int duration) {
AnimElement data = {
x, y, // source x and y
w, h, // source width and height
@@ -1609,20 +1600,6 @@ void IntroController::getTitleSourceData() {
info->_image = scaled;
}
-
-
-#ifdef SLACK_ON_SDL_AGNOSTICISM
-int getTicks() {
- return SDL_GetTicks();
-}
-#elif !defined(IOS_ULTIMA4)
-static int ticks = 0;
-int getTicks() {
- ticks += 1000;
- return ticks;
-}
-#endif
-
bool IntroController::updateTitle() {
#ifdef IOS_ULTIMA4
static bool firstTime = true;
@@ -1634,7 +1611,7 @@ bool IntroController::updateTitle() {
int animStepTarget = 0;
- int timeCurrent = getTicks();
+ uint32 timeCurrent = g_system->getMillis();
float timePercent = 0;
if (_title->_animStep == 0 && !_bSkipTitles) {
@@ -1717,7 +1694,7 @@ bool IntroController::updateTitle() {
_title->_animStep = _title->_animStepMax;
else {
_title->_animStep++;
- _title->_timeDelay = getTicks() - _title->_timeBase + 100;
+ _title->_timeDelay = g_system->getMillis() - _title->_timeBase + 100;
}
// blit src to the canvas one row at a time, bottom up
@@ -1737,7 +1714,7 @@ bool IntroController::updateTitle() {
_title->_animStep = _title->_animStepMax;
else {
_title->_animStep++;
- _title->_timeDelay = getTicks() - _title->_timeBase + 100;
+ _title->_timeDelay = g_system->getMillis() - _title->_timeBase + 100;
}
// blit src to the canvas one row at a time, top down
@@ -1788,7 +1765,7 @@ bool IntroController::updateTitle() {
_title->_animStep = _title->_animStepMax;
else {
_title->_animStep++;
- _title->_timeDelay = getTicks() - _title->_timeBase + 100;
+ _title->_timeDelay = g_system->getMillis() - _title->_timeBase + 100;
}
// blit src to the canvas one row at a time, center out
@@ -1809,7 +1786,7 @@ bool IntroController::updateTitle() {
_title->_animStep = _title->_animStepMax;
else {
_title->_animStep++;
- _title->_timeDelay = getTicks() - _title->_timeBase + 100;
+ _title->_timeDelay = g_system->getMillis() - _title->_timeBase + 100;
}
int step = (_title->_animStep == _title->_animStepMax ? _title->_animStepMax - 1 : _title->_animStep);
@@ -1834,7 +1811,7 @@ bool IntroController::updateTitle() {
// create a destimage for the map tiles
- int newtime = getTicks();
+ int newtime = g_system->getMillis();
if (newtime > _title->_timeDuration + 250 / 4) {
// grab the map from the screen
Image *screen = imageMgr->get("screen")->_image;
diff --git a/engines/ultima/ultima4/controllers/intro_controller.h b/engines/ultima/ultima4/controllers/intro_controller.h
index 193f08f33f..6df677ab7a 100644
--- a/engines/ultima/ultima4/controllers/intro_controller.h
+++ b/engines/ultima/ultima4/controllers/intro_controller.h
@@ -375,13 +375,13 @@ private:
struct AnimElement {
void shufflePlotData();
- int _rx, _ry; // screen/source x and y
- int _rw, _rh; // source width and height
+ int _rx, _ry; // screen/source x and y
+ int _rw, _rh; // source width and height
AnimType _method; // render method
int _animStep; // tracks animation position
int _animStepMax;
int _timeBase; // initial animation time
- int _timeDelay; // delay before rendering begins
+ uint32 _timeDelay; // delay before rendering begins
int _timeDuration; // total animation time
Image *_srcImage; // storage for the source image
Image *_destImage; // storage for the animation frame
@@ -392,7 +392,7 @@ private:
/**
* Add the intro element to the element list
*/
- void addTitle(int x, int y, int w, int h, AnimType method, int delay, int duration);
+ void addTitle(int x, int y, int w, int h, AnimType method, uint32 delay, int duration);
/**
* The title element has finished drawing all frames, so delete, remove,
diff --git a/engines/ultima/ultima4/game/script.cpp b/engines/ultima/ultima4/game/script.cpp
index f955d2ab42..756fccabd8 100644
--- a/engines/ultima/ultima4/game/script.cpp
+++ b/engines/ultima/ultima4/game/script.cpp
@@ -359,7 +359,7 @@ Script::ReturnCode Script::execute(Shared::XMLNode *script, Shared::XMLNode *cur
retval = forLoop(script, current);
break;
case ACTION_RANDOM:
- retval = random(script, current);
+ retval = randomScript(script, current);
break;
case ACTION_MOVE:
retval = move(script, current);
@@ -958,7 +958,7 @@ Script::ReturnCode Script::forLoop(Shared::XMLNode *script, Shared::XMLNode *cur
return retval;
}
-Script::ReturnCode Script::random(Shared::XMLNode *script, Shared::XMLNode *current) {
+Script::ReturnCode Script::randomScript(Shared::XMLNode *script, Shared::XMLNode *current) {
int perc = getPropAsInt(current, "chance");
int num = xu4_random(100);
Script::ReturnCode retval = RET_OK;
diff --git a/engines/ultima/ultima4/game/script.h b/engines/ultima/ultima4/game/script.h
index 548163444c..8f827ba067 100644
--- a/engines/ultima/ultima4/game/script.h
+++ b/engines/ultima/ultima4/game/script.h
@@ -30,10 +30,6 @@
namespace Ultima {
namespace Ultima4 {
-#ifdef random
-#undef random
-#endif
-
/**
* An xml-scripting class. It loads and runs xml scripts that
* take information and interact with the game environment itself.
@@ -284,7 +280,7 @@ private:
/**
* Randomely executes script code
*/
- ReturnCode random(Shared::XMLNode *script, Shared::XMLNode *current);
+ ReturnCode randomScript(Shared::XMLNode *script, Shared::XMLNode *current);
/**
* Moves the player's current position
Commit: bc84f8799ed3186638ca001c9d1c380e340c9d23
https://github.com/scummvm/scummvm/commit/bc84f8799ed3186638ca001c9d1c380e340c9d23
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2020-05-13T16:24:59-07:00
Commit Message:
ULTIMA4: Janitorial
Changed paths:
engines/ultima/ultima4/map/direction.cpp
engines/ultima/ultima4/map/direction.h
engines/ultima/ultima4/map/location.cpp
engines/ultima/ultima4/map/map.cpp
engines/ultima/ultima4/map/movement.cpp
engines/ultima/ultima4/map/movement.h
diff --git a/engines/ultima/ultima4/map/direction.cpp b/engines/ultima/ultima4/map/direction.cpp
index 24023c60b0..032dbadd0e 100644
--- a/engines/ultima/ultima4/map/direction.cpp
+++ b/engines/ultima/ultima4/map/direction.cpp
@@ -27,9 +27,6 @@
namespace Ultima {
namespace Ultima4 {
-/**
- * Returns the opposite direction.
- */
Direction dirReverse(Direction dir) {
switch (dir) {
case DIR_NONE:
diff --git a/engines/ultima/ultima4/map/direction.h b/engines/ultima/ultima4/map/direction.h
index 55013c85d5..134f9809d4 100644
--- a/engines/ultima/ultima4/map/direction.h
+++ b/engines/ultima/ultima4/map/direction.h
@@ -49,7 +49,11 @@ enum Direction {
#define DIR_ADD_TO_MASK(dir,mask) ((1 << (dir)) | (mask))
#define DIR_REMOVE_FROM_MASK(dir,mask) ((~(1 << (dir))) & (mask))
+/**
+ * Returns the opposite direction.
+ */
Direction dirReverse(Direction dir);
+
Direction dirFromMask(int dir_mask);
Direction dirRotateCW(Direction dir);
Direction dirRotateCCW(Direction dir);
diff --git a/engines/ultima/ultima4/map/location.cpp b/engines/ultima/ultima4/map/location.cpp
index aa2cdb1711..3d2f78581c 100644
--- a/engines/ultima/ultima4/map/location.cpp
+++ b/engines/ultima/ultima4/map/location.cpp
@@ -245,8 +245,8 @@ int Location::getCurrentPosition(MapCoords *coords) {
MoveResult Location::move(Direction dir, bool userEvent) {
MoveEvent event(dir, userEvent);
- switch (_map->_type) {
+ switch (_map->_type) {
case Map::DUNGEON:
moveAvatarInDungeon(event);
break;
@@ -266,7 +266,6 @@ MoveResult Location::move(Direction dir, bool userEvent) {
return event._result;
}
-
void locationFree(Location **stack) {
delete locationPop(stack);
}
diff --git a/engines/ultima/ultima4/map/map.cpp b/engines/ultima/ultima4/map/map.cpp
index e01678e91f..21df967716 100644
--- a/engines/ultima/ultima4/map/map.cpp
+++ b/engines/ultima/ultima4/map/map.cpp
@@ -44,9 +44,11 @@ namespace Ultima4 {
bool MapCoords::operator==(const MapCoords &a) const {
return (x == a.x) && (y == a.y) && (z == a.z);
}
+
bool MapCoords::operator!=(const MapCoords &a) const {
return !operator==(a);
}
+
bool MapCoords::operator<(const MapCoords &a) const {
if (x > a.x)
return false;
@@ -55,7 +57,6 @@ bool MapCoords::operator<(const MapCoords &a) const {
return z < a.z;
}
-
MapCoords &MapCoords::wrap(const Map *map) {
if (map && map->_borderBehavior == Map::BORDER_WRAP) {
while (x < 0)
diff --git a/engines/ultima/ultima4/map/movement.cpp b/engines/ultima/ultima4/map/movement.cpp
index ef4631d3b5..cf3d4ae860 100644
--- a/engines/ultima/ultima4/map/movement.cpp
+++ b/engines/ultima/ultima4/map/movement.cpp
@@ -38,11 +38,6 @@
namespace Ultima {
namespace Ultima4 {
-/**
- * Attempt to move the avatar in the given direction. User event
- * should be set if the avatar is being moved in response to a
- * keystroke. Returns zero if the avatar is blocked.
- */
void moveAvatar(MoveEvent &event) {
MapCoords newCoords;
int slowed = 0;
@@ -128,9 +123,6 @@ void moveAvatar(MoveEvent &event) {
event._result = (MoveResult)(MOVE_SUCCEEDED | MOVE_END_TURN);
}
-/**
- * Moves the avatar while in dungeon view
- */
void moveAvatarInDungeon(MoveEvent &event) {
MapCoords newCoords;
Direction realDir = dirNormalize((Direction)g_ultima->_saveGame->_orientation, event._dir); /* get our real direction */
diff --git a/engines/ultima/ultima4/map/movement.h b/engines/ultima/ultima4/map/movement.h
index 5775276565..0a883d5aae 100644
--- a/engines/ultima/ultima4/map/movement.h
+++ b/engines/ultima/ultima4/map/movement.h
@@ -60,7 +60,16 @@ public:
MoveResult _result; /**< how the movement was resolved */
};
+/**
+ * Attempt to move the avatar in the given direction. User event
+ * should be set if the avatar is being moved in response to a
+ * keystroke. Returns zero if the avatar is blocked.
+ */
void moveAvatar(MoveEvent &event);
+
+/**
+ * Moves the avatar while in dungeon view
+ */
void moveAvatarInDungeon(MoveEvent &event);
/**
Commit: 1945dc1bff8ff1276d93004b79fb4bcf37ccd970
https://github.com/scummvm/scummvm/commit/1945dc1bff8ff1276d93004b79fb4bcf37ccd970
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2020-05-13T16:24:59-07:00
Commit Message:
ULTIMA4: Refactor blank function static
Changed paths:
engines/ultima/ultima4/map/map.cpp
engines/ultima/ultima4/map/map.h
diff --git a/engines/ultima/ultima4/map/map.cpp b/engines/ultima/ultima4/map/map.cpp
index 21df967716..dd04c7b826 100644
--- a/engines/ultima/ultima4/map/map.cpp
+++ b/engines/ultima/ultima4/map/map.cpp
@@ -231,7 +231,7 @@ int MapCoords::distance(const MapCoords &c, const Map *map) const {
Map::Map() : _id(0), _type(WORLD), _width(0), _height(0), _levels(1),
_chunkWidth(0), _chunkHeight(0), _offset(0), _flags(0),
_borderBehavior(BORDER_WRAP), _music(Music::NONE),
- _tileSet(nullptr), _tileMap(nullptr) {
+ _tileSet(nullptr), _tileMap(nullptr), _blank(0) {
_annotations = new AnnotationMgr();
}
@@ -279,10 +279,8 @@ const Portal *Map::portalAt(const Coords &coords, int actionFlags) {
}
MapTile *Map::getTileFromData(const Coords &coords) {
- static MapTile blank(0);
-
if (MAP_IS_OOB(this, coords))
- return ␣
+ return &_blank;
int index = coords.x + (coords.y * _width) + (_width * _height * coords.z);
return &_data[index];
diff --git a/engines/ultima/ultima4/map/map.h b/engines/ultima/ultima4/map/map.h
index 18f8da005c..5af07e0cad 100644
--- a/engines/ultima/ultima4/map/map.h
+++ b/engines/ultima/ultima4/map/map.h
@@ -285,6 +285,8 @@ public:
Std::map<Common::String, MapCoords> _labels;
Tileset *_tileSet;
TileMap *_tileMap;
+ MapTile _blank;
+
// u4dos compatibility
SaveGameMonsterRecord _monsterTable[MONSTERTABLE_SIZE];
Commit: 65bf202a33e812fd2b4ed4e4c229156e4d8f9f78
https://github.com/scummvm/scummvm/commit/65bf202a33e812fd2b4ed4e4c229156e4d8f9f78
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2020-05-13T18:21:39-07:00
Commit Message:
ULTIMA4: Janitorial of if else blocks
Changed paths:
engines/ultima/ultima4/controllers/combat_controller.cpp
engines/ultima/ultima4/controllers/game_controller.cpp
engines/ultima/ultima4/controllers/read_string_controller.cpp
engines/ultima/ultima4/core/debugger_actions.cpp
engines/ultima/ultima4/game/creature.cpp
engines/ultima/ultima4/game/game.cpp
engines/ultima/ultima4/game/item.cpp
engines/ultima/ultima4/game/object.h
engines/ultima/ultima4/game/person.cpp
engines/ultima/ultima4/game/player.cpp
engines/ultima/ultima4/game/portal.cpp
engines/ultima/ultima4/game/script.cpp
engines/ultima/ultima4/game/spell.cpp
engines/ultima/ultima4/map/city.cpp
engines/ultima/ultima4/map/dungeon.cpp
engines/ultima/ultima4/map/map.cpp
engines/ultima/ultima4/map/tile.cpp
engines/ultima/ultima4/map/tilemap.cpp
engines/ultima/ultima4/map/tileset.cpp
engines/ultima/ultima4/views/menu.cpp
diff --git a/engines/ultima/ultima4/controllers/combat_controller.cpp b/engines/ultima/ultima4/controllers/combat_controller.cpp
index 5ab79ecd33..3174cee643 100644
--- a/engines/ultima/ultima4/controllers/combat_controller.cpp
+++ b/engines/ultima/ultima4/controllers/combat_controller.cpp
@@ -79,7 +79,8 @@ CombatMap *getCombatMap(Map *punknown) {
Map *m = punknown ? punknown : g_context->_location->_map;
if (!isCombatMap(m))
return nullptr;
- else return dynamic_cast<CombatMap *>(m);
+ else
+ return dynamic_cast<CombatMap *>(m);
}
/**
@@ -223,7 +224,8 @@ void CombatController::initDungeonRoom(int room, Direction from) {
_map->setAltarRoom(VIRT_LOVE);
else if (g_context->_location->_prev->_coords.x <= 2)
_map->setAltarRoom(VIRT_TRUTH);
- else _map->setAltarRoom(VIRT_COURAGE);
+ else
+ _map->setAltarRoom(VIRT_COURAGE);
}
/* load in creatures and creature start coordinates */
@@ -377,7 +379,9 @@ void CombatController::end(bool adjustKarma) {
if (action != ACTION_NONE)
usePortalAt(g_context->_location, g_context->_location->_coords, action);
- } else g_screen->screenMessage("\n");
+ } else {
+ g_screen->screenMessage("\n");
+ }
if (_exitDir != DIR_NONE) {
g_ultima->_saveGame->_orientation = _exitDir; /* face the direction exiting the room */
@@ -685,7 +689,8 @@ bool CombatController::rangedAttack(const Coords &coords, Creature *attacker) {
// soundPlay(SOUND_PC_STRUCK, false);
if (hittile == g_tileSets->findTileByName("magic_flash")->getId())
g_screen->screenMessage("\n%s %cMagical Hit%c!\n", target->getName().c_str(), FG_BLUE, FG_WHITE);
- else g_screen->screenMessage("\n%s Hit!\n", target->getName().c_str());
+ else
+ g_screen->screenMessage("\n%s Hit!\n", target->getName().c_str());
attacker->dealDamage(target, attacker->getDamage());
break;
}
@@ -809,7 +814,9 @@ void CombatController::finishTurn() {
(_party[g_context->_party->getActivePlayer()]) && /* and the active player is still in combat */
!_party[g_context->_party->getActivePlayer()]->isDisabled() && /* and the active player is not disabled */
(g_context->_party->getActivePlayer() != _focus)));
- } else g_context->_location->_map->_annotations->passTurn();
+ } else {
+ g_context->_location->_map->_annotations->passTurn();
+ }
#if 0
if (focus != 0) {
diff --git a/engines/ultima/ultima4/controllers/game_controller.cpp b/engines/ultima/ultima4/controllers/game_controller.cpp
index 8fa4dd6a74..577bd18ab1 100644
--- a/engines/ultima/ultima4/controllers/game_controller.cpp
+++ b/engines/ultima/ultima4/controllers/game_controller.cpp
@@ -251,7 +251,8 @@ void GameController::finishTurn() {
if (g_context->_party->getTorchDuration() <= 0)
g_screen->screenMessage("It's Dark!\n");
- else g_context->_party->burnTorch();
+ else
+ g_context->_party->burnTorch();
/* handle dungeon traps */
if (dungeon->currentToken() == DUNGEON_TRAP) {
@@ -724,7 +725,9 @@ void GameController::creatureCleanup() {
/* delete the object and remove it from the map */
i = map->removeObject(i);
- } else i++;
+ } else {
+ i++;
+ }
}
}
diff --git a/engines/ultima/ultima4/controllers/read_string_controller.cpp b/engines/ultima/ultima4/controllers/read_string_controller.cpp
index db76b6881c..14eb06b5c4 100644
--- a/engines/ultima/ultima4/controllers/read_string_controller.cpp
+++ b/engines/ultima/ultima4/controllers/read_string_controller.cpp
@@ -84,7 +84,9 @@ bool ReadStringController::keyPressed(int key) {
g_screen->screenShowCursor();
}
}
- } else valid = false;
+ } else {
+ valid = false;
+ }
return valid || KeyHandler::defaultHandler(key, nullptr);
}
diff --git a/engines/ultima/ultima4/core/debugger_actions.cpp b/engines/ultima/ultima4/core/debugger_actions.cpp
index 63c750a0b5..b46e7adfd7 100644
--- a/engines/ultima/ultima4/core/debugger_actions.cpp
+++ b/engines/ultima/ultima4/core/debugger_actions.cpp
@@ -156,8 +156,11 @@ bool DebuggerActions::getChestTrapHandler(int player) {
(g_ultima->_saveGame->_players[player]._dex + 25 < xu4_random(100))) {
if (trapType == EFFECT_LAVA) /* bomb trap */
g_context->_party->applyEffect(trapType);
- else g_context->_party->member(player)->applyEffect(trapType);
- } else g_screen->screenMessage("Evaded!\n");
+ else
+ g_context->_party->member(player)->applyEffect(trapType);
+ } else {
+ g_screen->screenMessage("Evaded!\n");
+ }
return true;
}
diff --git a/engines/ultima/ultima4/game/creature.cpp b/engines/ultima/ultima4/game/creature.cpp
index c95e2853ea..866d8b570b 100644
--- a/engines/ultima/ultima4/game/creature.cpp
+++ b/engines/ultima/ultima4/game/creature.cpp
@@ -808,7 +808,8 @@ void Creature::removeStatus(StatusType s) {
for (i = _status.begin(); i != _status.end();) {
if (*i == s)
i = _status.erase(i);
- else i++;
+ else
+ i++;
}
// Just to be sure, if a player is poisoned from a savegame, then they won't have
@@ -928,7 +929,8 @@ Creature *CreatureMgr::getById(CreatureId id) {
CreatureMap::const_iterator i = _creatures.find(id);
if (i != _creatures.end())
return i->_value;
- else return nullptr;
+ else
+ return nullptr;
}
Creature *CreatureMgr::getByName(Common::String name) {
@@ -1008,7 +1010,8 @@ Creature *CreatureMgr::randomAmbushing() {
if (numAmbushingCreatures == randCreature)
return i->_value;
/* move on to the next creature */
- else numAmbushingCreatures++;
+ else
+ numAmbushingCreatures++;
}
}
}
diff --git a/engines/ultima/ultima4/game/game.cpp b/engines/ultima/ultima4/game/game.cpp
index 63a32b6dfc..9fea1ae2fd 100644
--- a/engines/ultima/ultima4/game/game.cpp
+++ b/engines/ultima/ultima4/game/game.cpp
@@ -457,7 +457,8 @@ bool creatureRangeAttack(const Coords &coords, Creature *m) {
/* FIXME: check actual damage from u4dos -- values here are guessed */
if (g_context->_transportContext == TRANSPORT_SHIP)
gameDamageShip(-1, 10);
- else gameDamageParty(10, 25);
+ else
+ gameDamageParty(10, 25);
return true;
}
@@ -633,8 +634,11 @@ bool gameSpawnCreature(const Creature *m) {
(m->walks() && tile->isCreatureWalkable()) ||
(m->flies() && tile->isFlyable()))
ok = true;
- else tries++;
- } else ok = true;
+ else
+ tries++;
+ } else {
+ ok = true;
+ }
}
if (ok)
@@ -687,8 +691,11 @@ void gameDestroyAllCreatures(void) {
// The skull does not destroy Lord British
if (m->getId() != LORDBRITISH_ID)
current = map->removeObject(current);
- else current++;
- } else current++;
+ else
+ current++;
+ } else {
+ current++;
+ }
}
}
diff --git a/engines/ultima/ultima4/game/item.cpp b/engines/ultima/ultima4/game/item.cpp
index 4edefa2b7c..5eabf874a7 100644
--- a/engines/ultima/ultima4/game/item.cpp
+++ b/engines/ultima/ultima4/game/item.cpp
@@ -236,7 +236,8 @@ bool Items::isStoneInInventory(int virt) {
if (virt == -1)
return (g_ultima->_saveGame->_stones > 0);
/* specific test: does the party have a specific stone? */
- else return g_ultima->_saveGame->_stones & virt;
+ else
+ return g_ultima->_saveGame->_stones & virt;
}
void Items::putStoneInInventory(int virt) {
@@ -354,10 +355,14 @@ void Items::useBBC(int item) {
U4IOS::testFlightPassCheckPoint("As you light the Candle the Earth Trembles!");
#endif
g_ultima->_saveGame->_items |= ITEM_CANDLE_USED;
- } else g_screen->screenMessage("\nHmm...No effect!\n");
+ } else {
+ g_screen->screenMessage("\nHmm...No effect!\n");
+ }
}
/* somewhere else */
- else g_screen->screenMessage("\nHmm...No effect!\n");
+ else {
+ g_screen->screenMessage("\nHmm...No effect!\n");
+ }
}
void Items::useHorn(int item) {
@@ -369,7 +374,9 @@ void Items::useWheel(int item) {
if ((g_context->_transportContext == TRANSPORT_SHIP) && (g_ultima->_saveGame->_shipHull == 50)) {
g_screen->screenMessage("\nOnce mounted, the Wheel glows with a blue light!\n");
g_context->_party->setShipHull(99);
- } else g_screen->screenMessage("\nHmm...No effect!\n");
+ } else {
+ g_screen->screenMessage("\nHmm...No effect!\n");
+ }
}
void Items::useSkull(int item) {
@@ -458,8 +465,9 @@ void Items::useStone(int item) {
stoneMask = 0; /* reset the mask so you can try again */
return;
}
- } else error("Not in an altar room!");
-
+ } else {
+ error("Not in an altar room!");
+ }
/* see if we have all the stones, if not, get more names! */
if (attr && needStoneNames) {
g_screen->screenMessage("\n%c:", 'E' - needStoneNames);
@@ -504,7 +512,9 @@ void Items::useStone(int item) {
#endif
g_screen->screenMessage("\nThou doth find one third of the Three Part Key!\n");
g_ultima->_saveGame->_items |= key;
- } else g_screen->screenMessage("\nHmm...No effect!\n");
+ } else {
+ g_screen->screenMessage("\nHmm...No effect!\n");
+ }
stoneMask = 0; /* reset the mask so you can try again */
}
@@ -542,7 +552,8 @@ void Items::useStone(int item) {
int virtueMask = getBaseVirtues((Virtue)g_context->_location->_coords.z);
if (virtueMask > 0)
g_screen->screenMessage("\n\nAs thou doth approach, a voice rings out: What virtue dost stem from %s?\n\n", getBaseVirtueName(virtueMask));
- else g_screen->screenMessage("\n\nA voice rings out: What virtue exists independently of Truth, Love, and Courage?\n\n");
+ else
+ g_screen->screenMessage("\n\nA voice rings out: What virtue exists independently of Truth, Love, and Courage?\n\n");
#ifdef IOS_ULTIMA4
U4IOS::IOSConversationHelper::setIntroString("Which virtue?");
#endif
@@ -572,9 +583,11 @@ void Items::useStone(int item) {
U4IOS::IOSConversationHelper::setIntroString("Which color?");
#endif
itemHandleStones(gameGetInput());
- } else g_screen->screenMessage("\nNo place to Use them!\n");
- // This used to say "\nNo place to Use them!\nHmm...No effect!\n"
- // That doesn't match U4DOS; does it match another?
+ } else {
+ g_screen->screenMessage("\nNo place to Use them!\n");
+ // This used to say "\nNo place to Use them!\nHmm...No effect!\n"
+ // That doesn't match U4DOS; does it match another?
+ }
}
void Items::useKey(int item) {
diff --git a/engines/ultima/ultima4/game/object.h b/engines/ultima/ultima4/game/object.h
index 6ef2e080a2..8922f7efb6 100644
--- a/engines/ultima/ultima4/game/object.h
+++ b/engines/ultima/ultima4/game/object.h
@@ -29,7 +29,9 @@
namespace Ultima {
namespace Ultima4 {
-typedef Std::deque<class Object *> ObjectDeque;
+class Object;
+
+typedef Std::deque<Object *> ObjectDeque;
enum ObjectMovementBehavior {
MOVEMENT_FIXED,
diff --git a/engines/ultima/ultima4/game/person.cpp b/engines/ultima/ultima4/game/person.cpp
index bf2cdd8cf5..7170d62f72 100644
--- a/engines/ultima/ultima4/game/person.cpp
+++ b/engines/ultima/ultima4/game/person.cpp
@@ -577,7 +577,8 @@ int chars_needed(const char *s, int columnmax, int linesdesired, int *real_lines
lines += linecount(p.c_str(), columnmax);
if (lines <= linesdesired)
paragraphs += p + "\n";
- else break;
+ else
+ break;
text = text.substr(pos + 1);
}
// Seems to be some sort of clang compilation bug in this code, that causes this addition
diff --git a/engines/ultima/ultima4/game/player.cpp b/engines/ultima/ultima4/game/player.cpp
index 3f6cf249f9..1b114c9ea0 100644
--- a/engines/ultima/ultima4/game/player.cpp
+++ b/engines/ultima/ultima4/game/player.cpp
@@ -103,18 +103,22 @@ Common::String PartyMember::translate(Std::vector<Common::String> &parts) {
if (parts[1] == "cure") {
if (getStatus() == STAT_POISONED)
return "true";
- else return "false";
+ else
+ return "false";
} else if (parts[1] == "heal" || parts[1] == "fullheal") {
if (getHp() < getMaxHp())
return "true";
- else return "false";
+ else
+ return "false";
} else if (parts[1] == "resurrect") {
if (getStatus() == STAT_DEAD)
return "true";
- else return "false";
+ else
+ return "false";
}
}
}
+
return "";
}
diff --git a/engines/ultima/ultima4/game/portal.cpp b/engines/ultima/ultima4/game/portal.cpp
index 3f7ba33423..0d6fe3d5f2 100644
--- a/engines/ultima/ultima4/game/portal.cpp
+++ b/engines/ultima/ultima4/game/portal.cpp
@@ -73,9 +73,12 @@ int usePortalAt(Location *location, MapCoords coords, PortalTriggerAction action
createDngLadder(location, action, &dngLadder);
else if ((action & ACTION_DESCEND) && dungeon->ladderDownAt(coords))
createDngLadder(location, action, &dngLadder);
- else return 0;
+ else
+ return 0;
portal = &dngLadder;
- } else return 0;
+ } else {
+ return 0;
+ }
}
/* conditions not met for portal to work */
@@ -98,7 +101,8 @@ int usePortalAt(Location *location, MapCoords coords, PortalTriggerAction action
case ACTION_KLIMB:
if (portal->_exitPortal)
sprintf(msg, "Klimb up!\nLeaving...\n");
- else sprintf(msg, "Klimb up!\nTo level %d\n", portal->_start.z + 1);
+ else
+ sprintf(msg, "Klimb up!\nTo level %d\n", portal->_start.z + 1);
break;
case ACTION_ENTER:
switch (destination->_type) {
diff --git a/engines/ultima/ultima4/game/script.cpp b/engines/ultima/ultima4/game/script.cpp
index 756fccabd8..f573f7098e 100644
--- a/engines/ultima/ultima4/game/script.cpp
+++ b/engines/ultima/ultima4/game/script.cpp
@@ -239,7 +239,8 @@ bool Script::load(const Common::String &filename, const Common::String &baseId,
} else {
if (subNodeName.empty())
error("Couldn't find script '%s' in %s", baseId.c_str(), filename.c_str());
- else error("Couldn't find subscript '%s' where id='%s' in script '%s' in %s", subNodeName.c_str(), subNodeId.c_str(), baseId.c_str(), filename.c_str());
+ else
+ error("Couldn't find subscript '%s' where id='%s' in script '%s' in %s", subNodeName.c_str(), subNodeId.c_str(), baseId.c_str(), filename.c_str());
}
_state = STATE_UNLOADED;
@@ -261,7 +262,8 @@ void Script::run(const Common::String &script) {
if (_variables.find(_idPropName) != _variables.end()) {
if (_variables[_idPropName]->isSet())
search_id = _variables[_idPropName]->getString();
- else search_id = "null";
+ else
+ search_id = "null";
}
scriptNode = find(_scriptNode, script, search_id);
@@ -436,7 +438,8 @@ void Script::_continue() {
/* there's no target indicated, just start where we left off! */
if (_target.empty())
execute(_currentScript, _currentItem);
- else run(_target);
+ else
+ run(_target);
}
void Script::resetState() {
@@ -469,7 +472,8 @@ void Script::unsetVar(const Common::String &name) {
// Ensure that the variable at least exists, but has no value
if (_variables.find(name) != _variables.end())
_variables[name]->unset();
- else _variables[name] = new Variable();
+ else
+ _variables[name] = new Variable();
}
Script::State Script::getState() {
@@ -688,7 +692,8 @@ void Script::translate(Common::String *text) {
else if (funcName == "compare") {
if (compare(content))
prop = "true";
- else prop = "false";
+ else
+ prop = "false";
}
/* make the Common::String upper case */
@@ -716,7 +721,8 @@ void Script::translate(Common::String *text) {
else if (funcName == "isempty") {
if (content.empty())
prop = "true";
- else prop = "false";
+ else
+ prop = "false";
}
}
}
diff --git a/engines/ultima/ultima4/game/spell.cpp b/engines/ultima/ultima4/game/spell.cpp
index 7800017989..2299ff9147 100644
--- a/engines/ultima/ultima4/game/spell.cpp
+++ b/engines/ultima/ultima4/game/spell.cpp
@@ -433,7 +433,9 @@ int Spells::spellBlink(int dir) {
failed = 1;
g_context->_location->_coords = coords;
- } else failed = 1;
+ } else {
+ failed = 1;
+ }
return (failed ? 0 : 1);
}
diff --git a/engines/ultima/ultima4/map/city.cpp b/engines/ultima/ultima4/map/city.cpp
index 45802c0bd8..f57cff0ab3 100644
--- a/engines/ultima/ultima4/map/city.cpp
+++ b/engines/ultima/ultima4/map/city.cpp
@@ -82,7 +82,8 @@ void City::removeAllPeople() {
for (obj = _objects.begin(); obj != _objects.end();) {
if (isPerson(*obj))
obj = removeObject(obj);
- else obj++;
+ else
+ obj++;
}
}
diff --git a/engines/ultima/ultima4/map/dungeon.cpp b/engines/ultima/ultima4/map/dungeon.cpp
index f98ab10e8f..6beb081236 100644
--- a/engines/ultima/ultima4/map/dungeon.cpp
+++ b/engines/ultima/ultima4/map/dungeon.cpp
@@ -222,8 +222,9 @@ void dungeonSearch(void) {
g_screen->screenMessage("You find...\n%s!\n", item->_name);
(g_items->*(item->_putItemInInventory))(item->_data);
}
- } else
+ } else {
g_screen->screenMessage("\nYou find Nothing!\n");
+ }
}
break;
@@ -250,7 +251,8 @@ void dungeonDrinkFountain() {
case FOUNTAIN_HEALING:
if (g_context->_party->member(player)->heal(HT_FULLHEAL))
g_screen->screenMessage("\nAhh-Refreshing!\n");
- else g_screen->screenMessage("\nHmmm--No Effect!\n");
+ else
+ g_screen->screenMessage("\nHmmm--No Effect!\n");
break;
/* acid fountain */
@@ -263,7 +265,8 @@ void dungeonDrinkFountain() {
case FOUNTAIN_CURE:
if (g_context->_party->member(player)->heal(HT_CURE))
g_screen->screenMessage("\nHmmm--Delicious!\n");
- else g_screen->screenMessage("\nHmmm--No Effect!\n");
+ else
+ g_screen->screenMessage("\nHmmm--No Effect!\n");
break;
/* poison fountain */
@@ -273,7 +276,9 @@ void dungeonDrinkFountain() {
g_context->_party->member(player)->applyEffect(EFFECT_POISON);
g_context->_party->member(player)->applyDamage(100); /* 100 damage to drinker also */
g_screen->screenMessage("\nArgh-Choke-Gasp!\n");
- } else g_screen->screenMessage("\nHmm--No Effect!\n");
+ } else {
+ g_screen->screenMessage("\nHmm--No Effect!\n");
+ }
break;
default:
diff --git a/engines/ultima/ultima4/map/map.cpp b/engines/ultima/ultima4/map/map.cpp
index dd04c7b826..a097b5e0e0 100644
--- a/engines/ultima/ultima4/map/map.cpp
+++ b/engines/ultima/ultima4/map/map.cpp
@@ -175,9 +175,9 @@ Direction MapCoords::pathTo(const MapCoords &c, int valid_directions, bool towar
// Get the new direction to move
if (directionsToObject > DIR_NONE)
return dirRandomDir(directionsToObject);
-
// There are no valid directions that lead to our target, just move wherever we can!
- else return dirRandomDir(valid_directions);
+ else
+ return dirRandomDir(valid_directions);
}
Direction MapCoords::pathAway(const MapCoords &c, int valid_directions) const {
@@ -199,14 +199,16 @@ int MapCoords::movementDistance(const MapCoords &c, const Map *map) const {
if (me.x != c.x) {
if (dirmask & MASK_DIR_WEST)
me.move(DIR_WEST, map);
- else me.move(DIR_EAST, map);
+ else
+ me.move(DIR_EAST, map);
dist++;
}
if (me.y != c.y) {
if (dirmask & MASK_DIR_NORTH)
me.move(DIR_NORTH, map);
- else me.move(DIR_SOUTH, map);
+ else
+ me.move(DIR_SOUTH, map);
dist++;
}
@@ -710,7 +712,8 @@ bool Map::fillMonsterTable() {
// Whirlpools and storms are separated from other moving objects
if (c->getId() == WHIRLPOOL_ID || c->getId() == STORM_ID)
monsters.push_back(obj);
- else other_creatures.push_back(obj);
+ else
+ other_creatures.push_back(obj);
} else inanimate_objects.push_back(obj);
}
@@ -767,6 +770,8 @@ MapTile Map::translateFromRawTileIndex(int raw) const {
}
uint Map::translateToRawTileIndex(MapTile &tile) const {
+ g_tileSets;
+
return _tileMap->untranslate(tile);
}
diff --git a/engines/ultima/ultima4/map/tile.cpp b/engines/ultima/ultima4/map/tile.cpp
index d6216637ac..080bb87dad 100644
--- a/engines/ultima/ultima4/map/tile.cpp
+++ b/engines/ultima/ultima4/map/tile.cpp
@@ -87,7 +87,9 @@ void Tile::loadProperties(const ConfigElement &conf) {
rule = g_tileRules->findByName(conf.getString("rule"));
if (rule == nullptr)
rule = g_tileRules->findByName("default");
- } else rule = g_tileRules->findByName("default");
+ } else {
+ rule = g_tileRules->findByName("default");
+ }
// Get the number of frames the tile has
_frames = conf.getInt("frames", 1);
diff --git a/engines/ultima/ultima4/map/tilemap.cpp b/engines/ultima/ultima4/map/tilemap.cpp
index 6ace82c652..a68f4de3ac 100644
--- a/engines/ultima/ultima4/map/tilemap.cpp
+++ b/engines/ultima/ultima4/map/tilemap.cpp
@@ -116,7 +116,8 @@ void TileMaps::load(const ConfigElement &tilemapConf) {
TileMap *TileMaps::get(Common::String name) {
if (find(name) != end())
return (*this)[name];
- else return nullptr;
+ else
+ return nullptr;
}
/*-------------------------------------------------------------------*/
diff --git a/engines/ultima/ultima4/map/tileset.cpp b/engines/ultima/ultima4/map/tileset.cpp
index f71a768cf3..568935a4cf 100644
--- a/engines/ultima/ultima4/map/tileset.cpp
+++ b/engines/ultima/ultima4/map/tileset.cpp
@@ -128,7 +128,8 @@ void TileSets::unloadAllImages() {
Tileset *TileSets::get(const Common::String &name) {
if (find(name) != end())
return (*this)[name];
- else return nullptr;
+ else
+ return nullptr;
}
Tile *TileSets::findTileByName(const Common::String &name) {
@@ -253,7 +254,8 @@ void Tileset::load(const ConfigElement &tilesetConf) {
_imageName = tilesetConf.getString("imageName");
if (tilesetConf.exists("extends"))
_extends = g_tileSets->get(tilesetConf.getString("extends"));
- else _extends = nullptr;
+ else
+ _extends = nullptr;
int index = 0;
Std::vector<ConfigElement> children = tilesetConf.getChildren();
@@ -307,13 +309,15 @@ Tile *Tileset::getByName(const Common::String &name) {
return _nameMap[name];
else if (_extends)
return _extends->getByName(name);
- else return nullptr;
+ else
+ return nullptr;
}
Common::String Tileset::getImageName() const {
if (_imageName.empty() && _extends)
return _extends->getImageName();
- else return _imageName;
+ else
+ return _imageName;
}
uint Tileset::numTiles() const {
diff --git a/engines/ultima/ultima4/views/menu.cpp b/engines/ultima/ultima4/views/menu.cpp
index 3cb03b8e04..72d5cfebd2 100644
--- a/engines/ultima/ultima4/views/menu.cpp
+++ b/engines/ultima/ultima4/views/menu.cpp
@@ -243,7 +243,8 @@ void Menu::activateItem(int id, MenuEvent::Type action) {
if (id >= 0)
mi = getItemById(id);
/* or use the current item */
- else mi = *getCurrent();
+ else
+ mi = *getCurrent();
if (!mi)
error("Error: Unable to find menu item with id '%d'", id);
More information about the Scummvm-git-logs
mailing list