[Scummvm-git-logs] scummvm master -> 76d29ca9f4fd5db44af4ce51de2f4e5e32b8a087
dreammaster
paulfgilbert at gmail.com
Sat May 9 21:50:57 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:
2283cc049d ULTIMA4: Fix yet again keypresses showing during initiate game
469ab5760c ULTIMA4: Fix crash exiting game during initiate game
045b2e12f2 ULTIMA4: Cleanup & clarification of savegame position fields
76d29ca9f4 ULTIMA4: Cleanup and fixes for saving dungeon location
Commit: 2283cc049d20e71f5c107811f82c13464f86d158
https://github.com/scummvm/scummvm/commit/2283cc049d20e71f5c107811f82c13464f86d158
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2020-05-09T14:28:49-07:00
Commit Message:
ULTIMA4: Fix yet again keypresses showing during initiate game
Changed paths:
engines/ultima/ultima4/game/context.cpp
diff --git a/engines/ultima/ultima4/game/context.cpp b/engines/ultima/ultima4/game/context.cpp
index a2dc28b17d..b053d1994f 100644
--- a/engines/ultima/ultima4/game/context.cpp
+++ b/engines/ultima/ultima4/game/context.cpp
@@ -55,7 +55,8 @@ void Context::reset() {
_location = nullptr;
_lastShip = nullptr;
- _line = _col = 0;
+ _line = 9999;
+ _col = 0;
_moonPhase = 0;
_windDirection = 0;
_windCounter = 0;
Commit: 469ab5760c636a7ae93cf909ace48015ced069e9
https://github.com/scummvm/scummvm/commit/469ab5760c636a7ae93cf909ace48015ced069e9
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2020-05-09T14:28:49-07:00
Commit Message:
ULTIMA4: Fix crash exiting game during initiate game
Changed paths:
engines/ultima/ultima4/controllers/intro_controller.cpp
diff --git a/engines/ultima/ultima4/controllers/intro_controller.cpp b/engines/ultima/ultima4/controllers/intro_controller.cpp
index f30aa219a3..dfc9db233b 100644
--- a/engines/ultima/ultima4/controllers/intro_controller.cpp
+++ b/engines/ultima/ultima4/controllers/intro_controller.cpp
@@ -717,52 +717,54 @@ void IntroController::finishInitiateGame(const Common::String &nameBuffer, SexTy
_menuArea.disableCursor();
// show the lead up story
- showStory();
+ if (!shouldQuit())
+ showStory();
// ask questions that determine character class
- startQuestions();
-
- // Setup savegame fields. The original wrote out multiple files and
- // then loaded them up once the game starts. Now we're simply setting
- // up the savegame fields and letting the game read from them later,
- // as if a savegame had been loaded
- SaveGame &saveGame = *g_ultima->_saveGame;
- SaveGamePlayerRecord avatar;
- avatar.init();
- strncpy(avatar._name, nameBuffer.c_str(), 15);
- avatar._name[15] = '\0';
-
- avatar._sex = sex;
- saveGame.init(&avatar);
- g_screen->screenHideCursor();
- initPlayers(&saveGame);
- saveGame._food = 30000;
- saveGame._gold = 200;
- saveGame._reagents[REAG_GINSENG] = 3;
- saveGame._reagents[REAG_GARLIC] = 4;
- saveGame._torches = 2;
-
- _justInitiatedNewGame = true;
+ if (!shouldQuit())
+ startQuestions();
- // show the text thats segues into the main game
- showText(_binData->_introGypsy[GYP_SEGUE1]);
+ if (!shouldQuit()) {
+ // Setup savegame fields. The original wrote out multiple files and
+ // then loaded them up once the game starts. Now we're simply setting
+ // up the savegame fields and letting the game read from them later,
+ // as if a savegame had been loaded
+ SaveGame &saveGame = *g_ultima->_saveGame;
+ SaveGamePlayerRecord avatar;
+ avatar.init();
+ strncpy(avatar._name, nameBuffer.c_str(), 15);
+ avatar._name[15] = '\0';
+
+ avatar._sex = sex;
+ saveGame.init(&avatar);
+ g_screen->screenHideCursor();
+ initPlayers(&saveGame);
+ saveGame._food = 30000;
+ saveGame._gold = 200;
+ saveGame._reagents[REAG_GINSENG] = 3;
+ saveGame._reagents[REAG_GARLIC] = 4;
+ saveGame._torches = 2;
+
+ _justInitiatedNewGame = true;
+
+ // show the text thats segues into the main game
+ showText(_binData->_introGypsy[GYP_SEGUE1]);
#ifdef IOS_ULTIMA4
- U4IOS::switchU4IntroControllerToContinueButton();
+ U4IOS::switchU4IntroControllerToContinueButton();
#endif
- ReadChoiceController pauseController("");
- eventHandler->pushController(&pauseController);
- pauseController.waitFor();
+ ReadChoiceController pauseController("");
+ eventHandler->pushController(&pauseController);
+ pauseController.waitFor();
- showText(_binData->_introGypsy[GYP_SEGUE2]);
+ showText(_binData->_introGypsy[GYP_SEGUE2]);
- eventHandler->pushController(&pauseController);
- pauseController.waitFor();
+ eventHandler->pushController(&pauseController);
+ pauseController.waitFor();
+ }
// done: exit intro and let game begin
_questionArea.disableCursor();
EventHandler::setControllerDone();
-
- return;
}
void IntroController::showStory() {
Commit: 045b2e12f2fe712a78e76579309eff8a2cd99d03
https://github.com/scummvm/scummvm/commit/045b2e12f2fe712a78e76579309eff8a2cd99d03
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2020-05-09T14:28:49-07:00
Commit Message:
ULTIMA4: Cleanup & clarification of savegame position fields
Changed paths:
engines/ultima/ultima4/controllers/intro_controller.cpp
engines/ultima/ultima4/filesys/savegame.cpp
engines/ultima/ultima4/filesys/savegame.h
diff --git a/engines/ultima/ultima4/controllers/intro_controller.cpp b/engines/ultima/ultima4/controllers/intro_controller.cpp
index dfc9db233b..7d9ec9ab3e 100644
--- a/engines/ultima/ultima4/controllers/intro_controller.cpp
+++ b/engines/ultima/ultima4/controllers/intro_controller.cpp
@@ -1320,8 +1320,9 @@ void IntroController::initPlayers(SaveGame *saveGame) {
saveGame->_players[0]._weapon = initValuesForClass[saveGame->_players[0]._class].weapon;
saveGame->_players[0]._armor = initValuesForClass[saveGame->_players[0]._class].armor;
saveGame->_players[0]._xp = initValuesForClass[saveGame->_players[0]._class].xp;
- saveGame->_x = initValuesForClass[saveGame->_players[0]._class].x;
- saveGame->_y = initValuesForClass[saveGame->_players[0]._class].y;
+ saveGame->_pos.x = initValuesForClass[saveGame->_players[0]._class].x;
+ saveGame->_pos.y = initValuesForClass[saveGame->_players[0]._class].y;
+ saveGame->_pos.z = 0;
saveGame->_players[0]._str = 15;
saveGame->_players[0]._dex = 15;
diff --git a/engines/ultima/ultima4/filesys/savegame.cpp b/engines/ultima/ultima4/filesys/savegame.cpp
index a16e39fd4d..68d0694120 100644
--- a/engines/ultima/ultima4/filesys/savegame.cpp
+++ b/engines/ultima/ultima4/filesys/savegame.cpp
@@ -39,20 +39,16 @@ void SaveGame::save(Common::WriteStream *stream) {
Common::Serializer ser(nullptr, stream);
assert(g_context && g_context->_location);
+ _location = g_context->_location->_map->_id;
+ _pos = g_context->_location->_coords;
+
if (g_context->_location->_prev) {
- _x = g_context->_location->_coords.x;
- _y = g_context->_location->_coords.y;
- _dngLevel = g_context->_location->_coords.z;
- _dngX = g_context->_location->_prev->_coords.x;
- _dngY = g_context->_location->_prev->_coords.y;
+ _overworldPos.x = g_context->_location->_prev->_coords.x;
+ _overworldPos.y = g_context->_location->_prev->_coords.y;
} else {
- _x = g_context->_location->_coords.x;
- _y = g_context->_location->_coords.y;
- _dngLevel = g_context->_location->_coords.z;
+ _overworldPos.x = _overworldPos.y = 0;
}
- _location = g_context->_location->_map->_id;
-
synchronize(ser);
/*
@@ -125,10 +121,10 @@ void SaveGame::load(Common::SeekableReadStream *stream) {
* Translate info from the savegame to something we can use
*/
if (g_context->_location->_prev) {
- g_context->_location->_coords = MapCoords(_x, _y, _dngLevel);
- g_context->_location->_prev->_coords = MapCoords(_dngX, _dngY);
+ g_context->_location->_coords = _pos;
+ g_context->_location->_prev->_coords = MapCoords(_overworldPos.x, _overworldPos.y, 0);
} else {
- g_context->_location->_coords = MapCoords(_x, _y, (int)_dngLevel);
+ g_context->_location->_coords = _pos;
}
/**
@@ -205,8 +201,12 @@ void SaveGame::synchronize(Common::Serializer &s) {
s.syncAsUint16LE(_mixtures[i]);
s.syncAsUint16LE(_items);
- s.syncAsByte(_x);
- s.syncAsByte(_y);
+ s.syncAsByte(_pos.x);
+ s.syncAsByte(_pos.y);
+ s.syncAsUint16LE(_pos.z);
+ s.syncAsByte(_overworldPos.x);
+ s.syncAsByte(_overworldPos.y);
+
s.syncAsByte(_stones);
s.syncAsByte(_runes);
s.syncAsUint16LE(_members);
@@ -220,10 +220,7 @@ void SaveGame::synchronize(Common::Serializer &s) {
s.syncAsUint16LE(_lastReagent);
s.syncAsUint16LE(_lastMeditation);
s.syncAsUint16LE(_lastVirtue);
- s.syncAsByte(_dngX);
- s.syncAsByte(_dngY);
s.syncAsUint16LE(_orientation);
- s.syncAsUint16LE(_dngLevel);
s.syncAsUint16LE(_location);
}
@@ -261,8 +258,8 @@ void SaveGame::init(const SaveGamePlayerRecord *avatarInfo) {
_mixtures[i] = 0;
_items = 0;
- _x = 0;
- _y = 0;
+ _pos = Coords(0, 0, 0xffff);
+ _overworldPos = Common::Point();
_stones = 0;
_runes = 0;
_members = 1;
@@ -276,10 +273,7 @@ void SaveGame::init(const SaveGamePlayerRecord *avatarInfo) {
_lastReagent = 0;
_lastMeditation = 0;
_lastVirtue = 0;
- _dngX = 0;
- _dngY = 0;
_orientation = 0;
- _dngLevel = 0xFFFF;
_location = 0;
}
diff --git a/engines/ultima/ultima4/filesys/savegame.h b/engines/ultima/ultima4/filesys/savegame.h
index 72c6623e79..a404ecaa10 100644
--- a/engines/ultima/ultima4/filesys/savegame.h
+++ b/engines/ultima/ultima4/filesys/savegame.h
@@ -23,8 +23,10 @@
#ifndef ULTIMA4_FILESYS_SAVEGAME_H
#define ULTIMA4_FILESYS_SAVEGAME_H
+#include "common/rect.h"
#include "common/stream.h"
#include "common/serializer.h"
+#include "ultima/ultima4/core/coords.h"
namespace Ultima {
namespace Ultima4 {
@@ -269,7 +271,8 @@ struct SaveGame {
short _reagents[REAG_MAX];
short _mixtures[SPELL_MAX];
unsigned short _items;
- byte _x, _y;
+ Coords _pos;
+ Common::Point _overworldPos;
byte _stones;
byte _runes;
unsigned short _members;
@@ -286,9 +289,7 @@ struct SaveGame {
unsigned short _lastReagent;
unsigned short _lastMeditation;
unsigned short _lastVirtue;
- byte _dngX, _dngY;
unsigned short _orientation;
- unsigned short _dngLevel;
unsigned short _location;
};
Commit: 76d29ca9f4fd5db44af4ce51de2f4e5e32b8a087
https://github.com/scummvm/scummvm/commit/76d29ca9f4fd5db44af4ce51de2f4e5e32b8a087
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2020-05-09T14:28:49-07:00
Commit Message:
ULTIMA4: Cleanup and fixes for saving dungeon location
Changed paths:
engines/ultima/ultima4/controllers/game_controller.cpp
engines/ultima/ultima4/filesys/savegame.cpp
engines/ultima/ultima4/filesys/savegame.h
diff --git a/engines/ultima/ultima4/controllers/game_controller.cpp b/engines/ultima/ultima4/controllers/game_controller.cpp
index 363fe5e67e..8fa4dd6a74 100644
--- a/engines/ultima/ultima4/controllers/game_controller.cpp
+++ b/engines/ultima/ultima4/controllers/game_controller.cpp
@@ -539,27 +539,29 @@ void GameController::avatarMovedInDungeon(MoveEvent &event) {
if (event._result & MOVE_TURNED) {
if (dirRotateCCW((Direction)g_ultima->_saveGame->_orientation) == realDir)
g_screen->screenMessage("Turn Left\n");
- else g_screen->screenMessage("Turn Right\n");
+ else
+ g_screen->screenMessage("Turn Right\n");
+ } else {
+ // Show 'Advance' or 'Retreat' in dungeons
+ g_screen->screenMessage("%s\n", realDir == g_ultima->_saveGame->_orientation ? "Advance" : "Retreat");
}
- /* show 'Advance' or 'Retreat' in dungeons */
- else g_screen->screenMessage("%s\n", realDir == g_ultima->_saveGame->_orientation ? "Advance" : "Retreat");
}
if (event._result & MOVE_BLOCKED)
g_screen->screenMessage("%cBlocked!%c\n", FG_GREY, FG_WHITE);
}
- /* if we're exiting the map, do this */
+ // If we're exiting the map, do this
if (event._result & MOVE_EXIT_TO_PARENT) {
g_screen->screenMessage("%cLeaving...%c\n", FG_GREY, FG_WHITE);
exitToParentMap();
g_music->playMapMusic();
}
- /* check to see if we're entering a dungeon room */
+ // Check to see if we're entering a dungeon room
if (event._result & MOVE_SUCCEEDED) {
if (dungeon->currentToken() == DUNGEON_ROOM) {
- int room = (int)dungeon->currentSubToken(); /* get room number */
+ int room = (int)dungeon->currentSubToken(); // Get room number
/**
* recalculate room for the abyss -- there are 16 rooms for every 2 levels,
@@ -573,7 +575,7 @@ void GameController::avatarMovedInDungeon(MoveEvent &event) {
assert(dng);
dng->_currentRoom = room;
- /* set the map and start combat! */
+ // Set the map and start combat!
CombatController *cc = new CombatController(dng->_roomMaps[room]);
cc->initDungeonRoom(room, dirReverse(realDir));
cc->begin();
diff --git a/engines/ultima/ultima4/filesys/savegame.cpp b/engines/ultima/ultima4/filesys/savegame.cpp
index 68d0694120..6cda0b5fb6 100644
--- a/engines/ultima/ultima4/filesys/savegame.cpp
+++ b/engines/ultima/ultima4/filesys/savegame.cpp
@@ -112,18 +112,15 @@ void SaveGame::load(Common::SeekableReadStream *stream) {
// initialize our start location
map = mapMgr->get(MapId(_location));
- // if our map is not the world map, then load our map
- if (map->_type != Map::WORLD)
+ if (map->_type != Map::WORLD) {
+ // Set up the secondary map
g_game->setMap(map, 1, nullptr);
- else
- /**
- * Translate info from the savegame to something we can use
- */
- if (g_context->_location->_prev) {
+ // Set position within map and in overworld
g_context->_location->_coords = _pos;
g_context->_location->_prev->_coords = MapCoords(_overworldPos.x, _overworldPos.y, 0);
} else {
+ // On overworld, simply set position
g_context->_location->_coords = _pos;
}
@@ -200,13 +197,15 @@ void SaveGame::synchronize(Common::Serializer &s) {
for (i = 0; i < SPELL_MAX; ++i)
s.syncAsUint16LE(_mixtures[i]);
- s.syncAsUint16LE(_items);
s.syncAsByte(_pos.x);
s.syncAsByte(_pos.y);
s.syncAsUint16LE(_pos.z);
s.syncAsByte(_overworldPos.x);
s.syncAsByte(_overworldPos.y);
+ s.syncAsUint16LE(_orientation);
+ s.syncAsUint16LE(_location);
+ s.syncAsUint16LE(_items);
s.syncAsByte(_stones);
s.syncAsByte(_runes);
s.syncAsUint16LE(_members);
@@ -220,8 +219,6 @@ void SaveGame::synchronize(Common::Serializer &s) {
s.syncAsUint16LE(_lastReagent);
s.syncAsUint16LE(_lastMeditation);
s.syncAsUint16LE(_lastVirtue);
- s.syncAsUint16LE(_orientation);
- s.syncAsUint16LE(_location);
}
void SaveGame::init(const SaveGamePlayerRecord *avatarInfo) {
diff --git a/engines/ultima/ultima4/filesys/savegame.h b/engines/ultima/ultima4/filesys/savegame.h
index a404ecaa10..536ad5a49c 100644
--- a/engines/ultima/ultima4/filesys/savegame.h
+++ b/engines/ultima/ultima4/filesys/savegame.h
@@ -273,6 +273,9 @@ struct SaveGame {
unsigned short _items;
Coords _pos;
Common::Point _overworldPos;
+ unsigned short _orientation;
+ unsigned short _location;
+
byte _stones;
byte _runes;
unsigned short _members;
@@ -289,8 +292,6 @@ struct SaveGame {
unsigned short _lastReagent;
unsigned short _lastMeditation;
unsigned short _lastVirtue;
- unsigned short _orientation;
- unsigned short _location;
};
} // End of namespace Ultima4
More information about the Scummvm-git-logs
mailing list