[Scummvm-git-logs] scummvm master -> 62adf445b1195ccb4dfd0aaabd1b9bd8a2f97f68

dreammaster paulfgilbert at gmail.com
Sat May 2 04:55:07 UTC 2020


This automated email contains information about 3 new commits which have been
pushed to the 'scummvm' repo located at https://github.com/scummvm/scummvm .

Summary:
ed4cb527e4 ULTIMA4: Destroy creatures cheat action
916e4390c6 ULTIMA4: Janitorial
62adf445b1 ULTIMA4: Fix screen shaking


Commit: ed4cb527e4846b7d4a1c343f36b9fcaf8c68d26c
    https://github.com/scummvm/scummvm/commit/ed4cb527e4846b7d4a1c343f36b9fcaf8c68d26c
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2020-05-01T21:35:49-07:00

Commit Message:
ULTIMA4: Destroy creatures cheat action

Changed paths:
    engines/ultima/ultima4/controllers/combat_controller.cpp
    engines/ultima/ultima4/core/debugger.cpp
    engines/ultima/ultima4/core/debugger.h
    engines/ultima/ultima4/game/game.cpp
    engines/ultima/ultima4/game/game.h
    engines/ultima/ultima4/meta_engine.cpp
    engines/ultima/ultima4/meta_engine.h


diff --git a/engines/ultima/ultima4/controllers/combat_controller.cpp b/engines/ultima/ultima4/controllers/combat_controller.cpp
index c6a6bdeefb..6e9e0fb60d 100644
--- a/engines/ultima/ultima4/controllers/combat_controller.cpp
+++ b/engines/ultima/ultima4/controllers/combat_controller.cpp
@@ -864,16 +864,6 @@ bool CombatController::keyPressed(int key) {
 	bool endTurn = true;
 
 	switch (key) {
-	case Common::KEYCODE_F1: {
-		if (settings._debug)
-			gameDestroyAllCreatures();
-		else valid = false;
-		break;
-	}
-
-#ifdef IOS_ULTIMA4
-	case Common::KEYCODE_RETURN: // Fall through and get the chest.
-#endif
 	case 'g':
 		g_screen->screenMessage("Get Chest!\n");
 		g_debugger->getChest(_focus);
diff --git a/engines/ultima/ultima4/core/debugger.cpp b/engines/ultima/ultima4/core/debugger.cpp
index db8c0e85a7..e7ac34f811 100644
--- a/engines/ultima/ultima4/core/debugger.cpp
+++ b/engines/ultima/ultima4/core/debugger.cpp
@@ -92,6 +92,7 @@ Debugger::Debugger() : Shared::Debugger() {
 	registerCmd("collisions", WRAP_METHOD(Debugger, cmdCollisions));
 	registerCmd("companions", WRAP_METHOD(Debugger, cmdCompanions));
 	registerCmd("destroy", WRAP_METHOD(Debugger, cmdDestroy));
+	registerCmd("destroy_creatures", WRAP_METHOD(Debugger, cmdDestroyCreatures));
 	registerCmd("dungeon", WRAP_METHOD(Debugger, cmdDungeon));
 	registerCmd("equipment", WRAP_METHOD(Debugger, cmdEquipment));
 	registerCmd("exit", WRAP_METHOD(Debugger, cmdExit));
@@ -1258,6 +1259,13 @@ bool Debugger::cmdDestroy(int argc, const char **argv) {
 	return isDebuggerActive();
 }
 
+bool Debugger::cmdDestroyCreatures(int argc, const char **argv) {
+	gameDestroyAllCreatures();
+	dontEndTurn();
+
+	return isDebuggerActive();
+}
+
 bool Debugger::cmdDungeon(int argc, const char **argv) {
 	if (g_context->_location->_context & CTX_WORLDMAP) {
 		if (argc == 2) {
diff --git a/engines/ultima/ultima4/core/debugger.h b/engines/ultima/ultima4/core/debugger.h
index 3693ba3668..39e8a96902 100644
--- a/engines/ultima/ultima4/core/debugger.h
+++ b/engines/ultima/ultima4/core/debugger.h
@@ -266,6 +266,11 @@ private:
 	 */
 	bool cmdDestroy(int argc, const char **argv);
 
+	/**
+	 * Destroy all creatures
+	 */
+	bool cmdDestroyCreatures(int argc, const char **argv);
+
 	/**
 	 * Jumps to a given dungeon
 	 */
diff --git a/engines/ultima/ultima4/game/game.cpp b/engines/ultima/ultima4/game/game.cpp
index 5711bedf11..fedefb40e5 100644
--- a/engines/ultima/ultima4/game/game.cpp
+++ b/engines/ultima/ultima4/game/game.cpp
@@ -708,16 +708,13 @@ bool gameSpawnCreature(const Creature *m) {
 	return true;
 }
 
-/**
- * Destroys all creatures on the current map.
- */
 void gameDestroyAllCreatures(void) {
 	int i;
 
 	gameSpellEffect('t', -1, SOUND_MAGIC); /* same effect as tremor */
 
 	if (g_context->_location->_context & CTX_COMBAT) {
-		/* destroy all creatures in combat */
+		// Destroy all creatures in combat
 		for (i = 0; i < AREA_CREATURES; i++) {
 			CombatMap *cm = getCombatMap();
 			CreatureVector creatures = cm->getCreatures();
@@ -729,7 +726,7 @@ void gameDestroyAllCreatures(void) {
 			}
 		}
 	} else {
-		/* destroy all creatures on the map */
+		// Destroy all creatures on the map
 		ObjectDeque::iterator current;
 		Map *map = g_context->_location->_map;
 
@@ -737,7 +734,7 @@ void gameDestroyAllCreatures(void) {
 			Creature *m = dynamic_cast<Creature *>(*current);
 
 			if (m) {
-				/* the skull does not destroy Lord British */
+				// The skull does not destroy Lord British
 				if (m->getId() != LORDBRITISH_ID)
 					current = map->removeObject(current);
 				else current++;
@@ -745,7 +742,7 @@ void gameDestroyAllCreatures(void) {
 		}
 	}
 
-	/* alert the guards! Really, the only one left should be LB himself :) */
+	// Alert the guards! Really, the only one left should be LB himself :)
 	g_context->_location->_map->alertGuards();
 }
 
diff --git a/engines/ultima/ultima4/game/game.h b/engines/ultima/ultima4/game/game.h
index 6cd2b42cf6..dfdd75f263 100644
--- a/engines/ultima/ultima4/game/game.h
+++ b/engines/ultima/ultima4/game/game.h
@@ -75,6 +75,10 @@ bool creatureRangeAttack(const Coords &coords, Creature *m);
 void gameCreatureCleanup();
 bool gameSpawnCreature(const class Creature *m);
 void gameFixupObjects(Map *map);
+
+/**
+ * Destroys all creatures on the current map.
+ */
 void gameDestroyAllCreatures();
 void gameCreatureAttack(Creature *obj);
 
diff --git a/engines/ultima/ultima4/meta_engine.cpp b/engines/ultima/ultima4/meta_engine.cpp
index 1312a5e059..60c1e88a03 100644
--- a/engines/ultima/ultima4/meta_engine.cpp
+++ b/engines/ultima/ultima4/meta_engine.cpp
@@ -101,6 +101,7 @@ static const KeybindingRecord PARTY_KEYS[] = {
 };
 
 static const KeybindingRecord CHEAT_KEYS[] = {
+	{ KEYBIND_CHEAT_DESTROY_CREATURES, "CHEAT-DESTROY_CREATURES", "Destroy All Creatures", "destroy_creatures", "A+a", nullptr },
 	{ KEYBIND_CHEAT_COLLISIONS, "CHEAT-COLLISIONS", "Toggle Collision Handling", "collisions", "A+c", nullptr },
 	{ KEYBIND_CHEAT_DESTROY, "CHEAT-DESTROY", "Destroy Object", "destroy", "A+d", nullptr },
 	{ KEYBIND_CHEAT_EQUIPMENT, "CHEAT-EQUIPMENT", "Full Equipment", "equipment", "A+e", nullptr },
@@ -241,7 +242,7 @@ void MetaEngine::executeAction(KeybindingAction keyAction) {
 }
 
 Common::String MetaEngine::getMethod(KeybindingAction keyAction) {
-	for (int kCtr = 0; kCtr < 3; ++kCtr) {
+	for (int kCtr = 0; kCtr < 4; ++kCtr) {
 		for (const KeybindingRecord *r = NORMAL_RECORDS[kCtr]._keys; r->_id; ++r) {
 			if (r->_action == keyAction)
 				return r->_method;
diff --git a/engines/ultima/ultima4/meta_engine.h b/engines/ultima/ultima4/meta_engine.h
index 4afddc8883..3bdc99751a 100644
--- a/engines/ultima/ultima4/meta_engine.h
+++ b/engines/ultima/ultima4/meta_engine.h
@@ -47,7 +47,8 @@ enum KeybindingAction {
 	KEYBIND_PARTY4, KEYBIND_PARTY5, KEYBIND_PARTY6, KEYBIND_PARTY7,
 	KEYBIND_PARTY8,
 
-	KEYBIND_CHEAT_COLLISIONS, KEYBIND_CHEAT_DESTROY, KEYBIND_CHEAT_EQUIPMENT,
+	KEYBIND_CHEAT_COLLISIONS, KEYBIND_CHEAT_DESTROY,
+	KEYBIND_CHEAT_DESTROY_CREATURES, KEYBIND_CHEAT_EQUIPMENT,
 	KEYBIND_CHEAT_FLEE, KEYBIND_CHEAT_GOTO, KEYBIND_CHEAT_HELP,
 	KEYBIND_CHEAT_ITEMS, KEYBIND_CHEAT_KARMA, KEYBIND_CHEAT_LEAVE,
 	KEYBIND_CHEAT_MIXTURES, KEYBIND_CHEAT_PARTY, KEYBIND_CHEAT_REAGENTS,


Commit: 916e4390c6848bcba0686bc4a1df78630d9479d8
    https://github.com/scummvm/scummvm/commit/916e4390c6848bcba0686bc4a1df78630d9479d8
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2020-05-01T21:40:43-07:00

Commit Message:
ULTIMA4: Janitorial

Changed paths:
    engines/ultima/ultima4/game/game.cpp
    engines/ultima/ultima4/game/game.h


diff --git a/engines/ultima/ultima4/game/game.cpp b/engines/ultima/ultima4/game/game.cpp
index fedefb40e5..7e3cb19b89 100644
--- a/engines/ultima/ultima4/game/game.cpp
+++ b/engines/ultima/ultima4/game/game.cpp
@@ -91,9 +91,6 @@ void wearArmor(int player = -1);
 /* Functions END */
 /*---------------*/
 
-/**
- * Sets the view mode.
- */
 void gameSetViewMode(ViewMode newMode) {
 	g_context->_location->_viewMode = newMode;
 }
@@ -125,7 +122,6 @@ void gameUpdateScreen() {
 }
 
 void gameSpellEffect(int spell, int player, Sound sound) {
-
 	int time;
 	Spell::SpecialEffects effect = Spell::SFX_INVERT;
 
@@ -294,9 +290,6 @@ bool fireAt(const Coords &coords, bool originAvatar) {
 	return objectHit;
 }
 
-/**
- * Peers at a city from A-P (Lycaeum telescope) and functions like a gem
- */
 bool gamePeerCity(int city, void *data) {
 	Map *peerMap;
 
@@ -325,9 +318,6 @@ bool gamePeerCity(int city, void *data) {
 	return false;
 }
 
-/**
- * Peers at a gem
- */
 void peer(bool useGem) {
 
 	if (useGem) {
@@ -357,10 +347,6 @@ void peer(bool useGem) {
 	g_game->_paused = false;
 }
 
-/**
- * Checks the hull integrity of the ship and handles
- * the ship sinking, if necessary
- */
 void gameCheckHullIntegrity() {
 	int i;
 
@@ -391,10 +377,6 @@ void gameCheckHullIntegrity() {
 	}
 }
 
-/**
- * Fixes objects initially loaded by saveGameMonstersRead,
- * and alters movement behavior accordingly to match the creature
- */
 void gameFixupObjects(Map *map) {
 	int i;
 	Object *obj;
@@ -432,9 +414,6 @@ uint32 gameTimeSinceLastCommand() {
 	return (g_system->getMillis() - g_context->_lastCommandTime) / 1000;
 }
 
-/**
- * Handles what happens when a creature attacks you
- */
 void gameCreatureAttack(Creature *m) {
 	Object *under;
 	const Tile *ground;
@@ -456,9 +435,6 @@ void gameCreatureAttack(Creature *m) {
 	cc->begin();
 }
 
-/**
- * Performs a ranged attack for the creature at x,y on the world map
- */
 bool creatureRangeAttack(const Coords &coords, Creature *m) {
 //    int attackdelay = MAX_BATTLE_SPEED - settings.battleSpeed;
 
@@ -500,13 +476,6 @@ bool creatureRangeAttack(const Coords &coords, Creature *m) {
 	return false;
 }
 
-/**
- * Gets the path of coordinates for an action.  Each tile in the
- * direction specified by dirmask, between the minimum and maximum
- * distances given, is included in the path, until blockedPredicate
- * fails.  If a tile is blocked, that tile is included in the path
- * only if includeBlocked is true.
- */
 Std::vector<Coords> gameGetDirectionalActionPath(int dirmask, int validDirections, const Coords &origin, int minDistance, int maxDistance, bool (*blockedPredicate)(const Tile *tile), bool includeBlocked) {
 	Std::vector<Coords> path;
 	Direction dirx = DIR_NONE,
@@ -558,12 +527,6 @@ Std::vector<Coords> gameGetDirectionalActionPath(int dirmask, int validDirection
 	return path;
 }
 
-/**
- * Deals an amount of damage between 'minDamage' and 'maxDamage'
- * to each party member, with a 50% chance for each member to
- * avoid the damage.  If (minDamage == -1) or (minDamage >= maxDamage),
- * deals 'maxDamage' damage to each member.
- */
 void gameDamageParty(int minDamage, int maxDamage) {
 	int i;
 	int damage;
@@ -587,11 +550,6 @@ void gameDamageParty(int minDamage, int maxDamage) {
 	if (lastdmged != -1) g_context->_stats->highlightPlayer(lastdmged);
 }
 
-/**
- * Deals an amount of damage between 'minDamage' and 'maxDamage'
- * to the ship.  If (minDamage == -1) or (minDamage >= maxDamage),
- * deals 'maxDamage' damage to the ship.
- */
 void gameDamageShip(int minDamage, int maxDamage) {
 	int damage;
 
@@ -607,9 +565,6 @@ void gameDamageShip(int minDamage, int maxDamage) {
 	}
 }
 
-/**
- * Sets (or unsets) the active player
- */
 void gameSetActivePlayer(int player) {
 	if (player == -1) {
 		g_context->_party->setActivePlayer(-1);
@@ -623,10 +578,6 @@ void gameSetActivePlayer(int player) {
 	}
 }
 
-/**
- * Spawns a creature (m) just offscreen of the avatar.
- * If (m==nullptr) then it finds its own creature to spawn and spawns it.
- */
 bool gameSpawnCreature(const Creature *m) {
 	int t, i;
 	const Creature *creature;
diff --git a/engines/ultima/ultima4/game/game.h b/engines/ultima/ultima4/game/game.h
index dfdd75f263..1a950e7bd4 100644
--- a/engines/ultima/ultima4/game/game.h
+++ b/engines/ultima/ultima4/game/game.h
@@ -54,6 +54,10 @@ typedef enum {
 } ViewMode;
 
 /* map and screen functions */
+
+/**
+ * Sets the view mode.
+ */
 void gameSetViewMode(ViewMode newMode);
 void gameUpdateScreen();
 
@@ -61,34 +65,87 @@ void gameUpdateScreen();
 void gameSpellEffect(int spell, int player, Sound sound);
 
 /* action functions */
+/**
+ * Peers at a city from A-P (Lycaeum telescope) and functions like a gem
+ */
 bool gamePeerCity(int city, void *data);
+
+/**
+ * Peers at a gem
+ */
 void peer(bool useGem = true);
 bool fireAt(const Coords &coords, bool originAvatar);
 Direction gameGetDirection();
 uint32 gameTimeSinceLastCommand();
 
 /* checking functions */
+/**
+ * Checks the hull integrity of the ship and handles
+ * the ship sinking, if necessary
+ */
 void gameCheckHullIntegrity();
 
 /* creature functions */
+/**
+ * Performs a ranged attack for the creature at x,y on the world map
+ */
 bool creatureRangeAttack(const Coords &coords, Creature *m);
 void gameCreatureCleanup();
+
+/**
+ * Spawns a creature (m) just offscreen of the avatar.
+ * If (m==nullptr) then it finds its own creature to spawn and spawns it.
+ */
 bool gameSpawnCreature(const class Creature *m);
+
+/**
+ * Fixes objects initially loaded by saveGameMonstersRead,
+ * and alters movement behavior accordingly to match the creature
+ */
 void gameFixupObjects(Map *map);
 
 /**
  * Destroys all creatures on the current map.
  */
 void gameDestroyAllCreatures();
+
+/**
+ * Handles what happens when a creature attacks you
+ */
 void gameCreatureAttack(Creature *obj);
 
 /* etc */
 Common::String gameGetInput(int maxlen = 32);
 int gameGetPlayer(bool canBeDisabled, bool canBeActivePlayer);
 void gameGetPlayerForCommand(bool (*commandFn)(int player), bool canBeDisabled, bool canBeActivePlayer);
+
+/**
+ * Deals an amount of damage between 'minDamage' and 'maxDamage'
+ * to each party member, with a 50% chance for each member to
+ * avoid the damage.  If (minDamage == -1) or (minDamage >= maxDamage),
+ * deals 'maxDamage' damage to each member.
+ */
 void gameDamageParty(int minDamage, int maxDamage);
+
+/**
+ * Deals an amount of damage between 'minDamage' and 'maxDamage'
+ * to the ship.  If (minDamage == -1) or (minDamage >= maxDamage),
+ * deals 'maxDamage' damage to the ship.
+ */
 void gameDamageShip(int minDamage, int maxDamage);
+
+/**
+ * Sets (or unsets) the active player
+ */
 void gameSetActivePlayer(int player);
+
+/**
+ * Gets the path of coordinates for an action.  Each tile in the
+ * direction specified by dirmask, between the minimum and maximum
+ * distances given, is included in the path, until blockedPredicate
+ * fails.  If a tile is blocked, that tile is included in the path
+ * only if includeBlocked is true.
+ */
 Std::vector<Coords> gameGetDirectionalActionPath(int dirmask, int validDirections, const Coords &origin, int minDistance, int maxDistance, bool (*blockedPredicate)(const Tile *tile), bool includeBlocked);
 
 } // End of namespace Ultima4


Commit: 62adf445b1195ccb4dfd0aaabd1b9bd8a2f97f68
    https://github.com/scummvm/scummvm/commit/62adf445b1195ccb4dfd0aaabd1b9bd8a2f97f68
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2020-05-01T21:54:54-07:00

Commit Message:
ULTIMA4: Fix screen shaking

Changed paths:
    engines/ultima/ultima4/gfx/screen.cpp


diff --git a/engines/ultima/ultima4/gfx/screen.cpp b/engines/ultima/ultima4/gfx/screen.cpp
index b51eb6e4a3..195f7c52a4 100644
--- a/engines/ultima/ultima4/gfx/screen.cpp
+++ b/engines/ultima/ultima4/gfx/screen.cpp
@@ -1119,42 +1119,21 @@ void Screen::screenEraseTextArea(int x, int y, int width, int height) {
 }
 
 void Screen::screenShake(int iterations) {
-	int shakeOffset;
-	unsigned short i;
-	Image *screen = imageMgr->get("screen")->_image;
-	Image *bottom;
-
-	// the MSVC8 binary was generating a Access Violation when using
-	// drawSubRectOn() or drawOn() to draw the screen surface on top
-	// of itself.  Occured on settings.scale 2 and 4 only.
-	// Therefore, a temporary Image buffer is used to store the area
-	// that gets clipped at the bottom.
-
 	if (settings._screenShakes) {
-		// specify the size of the offset, and create a buffer
-		// to store the offset row plus 1
-		shakeOffset = 1;
-		bottom = Image::create(SCALED(320), SCALED(shakeOffset + 1), false, Image::HARDWARE);
-
-		for (i = 0; i < iterations; i++) {
-			// store the bottom row
-			screen->drawOn(bottom, 0, SCALED((shakeOffset + 1) - 200));
-
-			// shift the screen down and make the top row black
-			screen->drawSubRectOn(screen, 0, SCALED(shakeOffset), 0, 0, SCALED(320), SCALED(200 - (shakeOffset + 1)));
-			bottom->drawOn(screen, 0, SCALED(200 - (shakeOffset)));
-			screen->fillRect(0, 0, SCALED(320), SCALED(shakeOffset), 0, 0, 0);
-			update();
+		// specify the size of the shake
+		const int SHAKE_OFFSET = 1 * settings._scale;
+
+		for (int i = 0; i < iterations; ++i) {
+			// Shift the screen down
+			g_system->setShakePos(0, SHAKE_OFFSET);
+			g_system->updateScreen();
 			EventHandler::sleep(settings._shakeInterval);
 
-			// shift the screen back up, and replace the bottom row
-			screen->drawOn(screen, 0, 0 - SCALED(shakeOffset));
-			bottom->drawOn(screen, 0, SCALED(200 - (shakeOffset + 1)));
-			update();
+			// shift the screen back up
+			g_system->setShakePos(0, 0);
+			g_system->updateScreen();
 			EventHandler::sleep(settings._shakeInterval);
 		}
-		// free the bottom row image
-		delete bottom;
 	}
 }
 




More information about the Scummvm-git-logs mailing list