[Scummvm-git-logs] scummvm master -> 9b14b844bb110a78f12b43eeac8832d41f890a79

dreammaster dreammaster at scummvm.org
Tue Dec 12 04:15:11 CET 2017


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

Summary:
171a86acc7 XEEN: Fix Coverity identified warnings
9b14b844bb XEEN: Added logic for Dwarf cutscene


Commit: 171a86acc71713a0d25d0858c7a9d3e5c8f64289
    https://github.com/scummvm/scummvm/commit/171a86acc71713a0d25d0858c7a9d3e5c8f64289
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2017-12-11T22:14:39-05:00

Commit Message:
XEEN: Fix Coverity identified warnings

Changed paths:
    engines/xeen/dialogs_map.cpp
    engines/xeen/interface_minimap.cpp
    engines/xeen/interface_scene.cpp


diff --git a/engines/xeen/dialogs_map.cpp b/engines/xeen/dialogs_map.cpp
index f47f1b6..8008d46 100644
--- a/engines/xeen/dialogs_map.cpp
+++ b/engines/xeen/dialogs_map.cpp
@@ -127,6 +127,7 @@ void MapDialog::drawOutdoors() {
 		for (int xp = MAP_XSTART, mazeX = _pt.x - (MAP_DIFF - 1); mazeX <= (_pt.x + MAP_DIFF);
 				xp += TILE_WIDTH, ++mazeX) {
 			v = map.mazeLookup(Common::Point(mazeX, mazeY), 0);
+			assert(v != INVALID_CELL);
 			frame = map.mazeDataCurrent()._surfaceTypes[v];
 
 			if (map._currentSteppedOn) {
@@ -140,6 +141,7 @@ void MapDialog::drawOutdoors() {
 		for (int xp = MAP_XSTART, mazeX = _pt.x - (MAP_DIFF - 1); mazeX <= (_pt.x + MAP_DIFF);
 				xp += TILE_WIDTH, ++mazeX) {
 			v = map.mazeLookup(Common::Point(mazeX, mazeY), 4);
+			assert(v != INVALID_CELL);
 			frame = map.mazeDataCurrent()._wallTypes[v];
 
 			if (frame && map._currentSteppedOn)
diff --git a/engines/xeen/interface_minimap.cpp b/engines/xeen/interface_minimap.cpp
index 8ac3523..c9bbf10 100644
--- a/engines/xeen/interface_minimap.cpp
+++ b/engines/xeen/interface_minimap.cpp
@@ -75,6 +75,7 @@ void InterfaceMinimap::drawOutdoorsMinimap() {
 		for (int xp = MINIMAP_XSTART, mazeX = pt.x - MINIMAP_DIFF; mazeX <= (pt.x + MINIMAP_DIFF);
 				xp += TILE_WIDTH, ++mazeX) {
 			v = map.mazeLookup(Common::Point(mazeX, mazeY), 0);
+			assert(v != INVALID_CELL);
 			frame = map.mazeDataCurrent()._surfaceTypes[v];
 
 			if (frame && (map._currentSteppedOn || party._wizardEyeActive)) {
@@ -88,6 +89,7 @@ void InterfaceMinimap::drawOutdoorsMinimap() {
 		for (int xp = MINIMAP_XSTART, mazeX = pt.x - MINIMAP_DIFF; mazeX <= (pt.x + MINIMAP_DIFF);
 				xp += TILE_WIDTH, ++mazeX) {
 			v = map.mazeLookup(Common::Point(mazeX, mazeY), 4);
+			assert(v != INVALID_CELL);
 			frame = map.mazeData()._wallTypes[v];
 
 			if (frame && (map._currentSteppedOn || party._wizardEyeActive)) {
diff --git a/engines/xeen/interface_scene.cpp b/engines/xeen/interface_scene.cpp
index 999c852..d495d46 100644
--- a/engines/xeen/interface_scene.cpp
+++ b/engines/xeen/interface_scene.cpp
@@ -4419,26 +4419,31 @@ void InterfaceScene::drawOutdoors() {
 	assert(map._currentWall != INVALID_CELL);
 	for (int idx = 0; idx < 9; ++idx) {
 		map.getCell(TERRAIN_INDEXES1[idx]);
+		assert(map._currentWall != INVALID_CELL);
 		SpriteResource &spr = map._wallSprites._surfaces[map._currentWall];
 		_outdoorList[28 + idx]._sprites = spr.size() == 0 ? (SpriteResource *)nullptr : &spr;
 	}
 	for (int idx = 0; idx < 5; ++idx) {
 		map.getCell(TERRAIN_INDEXES2[idx]);
+		assert(map._currentWall != INVALID_CELL);
 		SpriteResource &spr = map._wallSprites._surfaces[map._currentWall];
 		_outdoorList[61 + idx]._sprites = spr.size() == 0 ? (SpriteResource *)nullptr : &spr;
 	}
 	for (int idx = 0; idx < 3; ++idx) {
 		map.getCell(TERRAIN_INDEXES3[idx]);
+		assert(map._currentWall != INVALID_CELL);
 		SpriteResource &spr = map._wallSprites._surfaces[map._currentWall];
 		_outdoorList[84 + idx]._sprites = spr.size() == 0 ? (SpriteResource *)nullptr : &spr;
 	}
 	for (int idx = 0; idx < 5; ++idx) {
 		map.getCell(TERRAIN_INDEXES4[idx]);
+		assert(map._currentWall != INVALID_CELL);
 		SpriteResource &spr = map._wallSprites._surfaces[map._currentWall];
 		_outdoorList[103 + idx]._sprites = spr.size() == 0 ? (SpriteResource *)nullptr : &spr;
 	}
 
 	map.getCell(1);
+	assert(map._currentWall != INVALID_CELL);
 	SpriteResource &surface = map._wallSprites._surfaces[map._currentWall];
 	_outdoorList[108]._sprites = surface.size() == 0 ? (SpriteResource *)nullptr : &surface;
 	_outdoorList[109]._sprites = _outdoorList[108]._sprites;


Commit: 9b14b844bb110a78f12b43eeac8832d41f890a79
    https://github.com/scummvm/scummvm/commit/9b14b844bb110a78f12b43eeac8832d41f890a79
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2017-12-11T22:14:58-05:00

Commit Message:
XEEN: Added logic for Dwarf cutscene

Changed paths:
    engines/xeen/town.cpp
    engines/xeen/town.h


diff --git a/engines/xeen/town.cpp b/engines/xeen/town.cpp
index 1ebd683..34d19da 100644
--- a/engines/xeen/town.cpp
+++ b/engines/xeen/town.cpp
@@ -33,15 +33,18 @@ namespace Xeen {
 TownLocation::TownLocation(TownAction action) : ButtonContainer(g_vm),
 		_townActionId(action), _isDarkCc(g_vm->_files->_isDarkCc),
 		_vocName("hello1.voc") {
-	_townMaxId = Res.TOWN_MAXES[_isDarkCc][action];
-	_songName = Res.TOWN_ACTION_MUSIC[_isDarkCc][action];
-	_townSprites.resize(Res.TOWN_ACTION_FILES[_isDarkCc][action]);
+	_townMaxId = (action >= SPHINX) ? 0 : Res.TOWN_MAXES[_isDarkCc][action];
+	if (action < NO_ACTION) {
+		_songName = Res.TOWN_ACTION_MUSIC[_isDarkCc][action];
+		_townSprites.resize(Res.TOWN_ACTION_FILES[_isDarkCc][action]);
+	}
 
 	_animFrame = 0;
 	_drawFrameIndex = 0;
 	_farewellTime = 0;
 	_drawCtr1 = _drawCtr2 = 0;
 	_townPos = Common::Point(8, 8);
+	_animCtr = 0;
 }
 
 TownLocation::~TownLocation() {
@@ -288,6 +291,10 @@ int TownLocation::wait() {
 	return _buttonValue;
 }
 
+void TownLocation::animUpdate() {
+	// TODO
+}
+
 /*------------------------------------------------------------------------*/
 
 BankLocation::BankLocation() : TownLocation(BANK) {
@@ -963,6 +970,7 @@ TrainingLocation::TrainingLocation() : TownLocation(TRAINING) {
 	Common::fill(&_charsTrained[0], &_charsTrained[6], 0);
 	_maxLevel = 0;
 	_experienceToNextLevel = 0;
+	_charIndex = 0;
 
 	_icons1.load("train.icn");
 	addButton(Common::Rect(281, 108, 305, 128), Common::KEYCODE_ESCAPE, &_icons1);
@@ -1116,8 +1124,239 @@ GolemLocation::GolemLocation() : TownLocation(GOLEM) {
 
 /*------------------------------------------------------------------------*/
 
+const int16 DWARF_X0[2][13] = {
+	{  0, -5, -7, -8, -11, -9, -3, 1, 6, 10, 15, 18, 23 },
+	{ 0, 4, 6, 8, 11, 12, 15, 17, 19, 22, 25, 0, 0 }
+};
+const int DWARF_X1[2][13] = {
+	{ 160, 145, 133, 122, 109, 101, 97, 91, 86, 80, 75, 68, 63 },
+	{ 160, 154, 146, 138, 131, 122, 115, 107, 99, 92, 85, 0, 0 }
+};
+const int DWARF_X2[13] = {
+	0, -1, -4, -7, -9, -13, -15, -18, -21, -23, -25, 0, 0
+};
+const int16 DWARF_Y[2][13] = {
+	{ 0, 0, 4, 9, 13, 15, 20, 24, 30, 37, 45, 51, 58 },
+	{ 0, 12, 25, 36, 38, 40, 41, 42, 44, 45, 50, 0, 0 }
+};
+const int16 DWARF2_X[2][16] = {
+	{ 0, -2, -4, -6, -8, -10, -12, -14, -16, -18, -20, -20, -20, -20, -20, -20 },
+	{ 0, 10, 20, 30, 40, 50, 60, 70, 80, 90, 100, 110, 120, 130, 140, 150 }
+};
+const int16 DWARF2_Y[2][16] = {
+	{ 0, 12, 25, 37, 50, 62, 75, 87, 100, 112, 125, 137, 150, 162, 175, 187 },
+	{ 0, 12, 25, 37, 50, 62, 75, 87, 100, 112, 125, 137, 150, 162, 175, 186 }
+};
+
 DwarfLocation::DwarfLocation(bool isDwarf) : TownLocation(NO_ACTION) {
 	_townMaxId = Res.TOWN_MAXES[_isDarkCc][isDwarf ? DWARF1 : DWARF2];
+	loadStrings("special.bin");
+}
+
+int DwarfLocation::show() {
+	EventsManager &events = *g_vm->_events;
+	Interface &intf = *g_vm->_interface;
+	Party &party = *g_vm->_party;
+	Screen &screen = *g_vm->_screen;
+	Sound &sound = *g_vm->_sound;
+	Windows &windows = *g_vm->_windows;
+
+	SpriteResource sprites1(_isDarkCc ? "town1.zom" : "dwarf1.vga");
+	SpriteResource sprites2(_isDarkCc ? "town2.zom" : "dwarf2.vga");
+	SpriteResource sprites3(_isDarkCc ? "town3.zom" : "dwarf3.vga");
+	SpriteResource boxSprites("box.vga");
+	bool mazeFlag = setNewLocation();
+
+	// Save the screen contents
+	Graphics::ManagedSurface savedBg;
+	savedBg.copyFrom(screen);
+
+	for (int idx = 0; idx < (_isDarkCc ? 10 : 12); ++idx) {
+		screen.copyFrom(savedBg);
+		sprites1.draw(0, 0,
+			Common::Point(DWARF_X0[_isDarkCc][idx], DWARF_Y[_isDarkCc][idx]));
+		sprites1.draw(0, 1,
+			Common::Point(DWARF_X1[_isDarkCc][idx], DWARF_Y[_isDarkCc][idx]));
+		if (_isDarkCc)
+			sprites1.draw(0, 2,
+				Common::Point(DWARF_X2[idx], DWARF_Y[_isDarkCc][idx]));
+
+		windows[0].update();
+		events.wait(1);
+	}
+
+	savedBg.copyFrom(screen);
+	for (int idx = 15; idx >= 0; --idx) {
+		screen.copyFrom(savedBg);
+		sprites2.draw(0, 0, Common::Point(DWARF2_X[_isDarkCc][idx], DWARF2_Y[_isDarkCc][idx]));
+		windows[0].update();
+		events.wait(1);
+	}
+
+	sound.setMusicVolume(48);
+	screen.copyFrom(savedBg);
+	sprites2.draw(0, 0);
+	windows[0].update();
+
+	for (int idx = 0; idx < (_isDarkCc ? 2 : 3); ++idx) {
+		switch (idx) {
+		case 0:
+			sound.playSound(_isDarkCc ? "pass2.voc" : "dwarf10.voc");
+			break;
+
+		case 1:
+			if (_isDarkCc) {
+				sprites2.draw(0, 0);
+				sprites3.draw(0, 0);
+				animUpdate();
+
+				events.timeMark5();
+				while (!g_vm->shouldQuit() && events.timeElapsed5() < 7)
+					events.pollEventsAndWait();
+
+				sound.playSound(mazeFlag ? "ok2.voc" : "back2.voc");
+			} else {
+				sound.playSound("dwarf11.voc");
+			}
+			break;
+
+		case 2:
+			sound.playSound("dwarf12.voc");
+			break;
+		}
+
+		events.updateGameCounter();
+		do {
+			sprites2.draw(0, 0);
+			sprites3.draw(0, g_vm->getRandomNumber(_isDarkCc ? 8 : 9));
+			animUpdate();
+
+			events.timeMark5();
+			while (!g_vm->shouldQuit() && events.timeElapsed5() < 2)
+				events.pollEventsAndWait();
+		} while (!g_vm->shouldQuit() && (sound.isPlaying() || _animCtr));
+
+		while (!g_vm->shouldQuit() && events.timeElapsed() < 3)
+			events.pollEventsAndWait();
+	}
+
+	sprites2.draw(0, 0);
+	if (!_isDarkCc)
+		sprites3.draw(0, 1);
+	windows[0].update();
+
+	// Restore game screen
+	sound.setMusicVolume(95);
+	screen.loadBackground("back.raw");
+	intf.drawParty(false);
+	intf.draw3d(false, false);
+
+	events.clearEvents();
+	return 0;
+}
+
+bool DwarfLocation::setNewLocation() {
+	Map &map = *g_vm->_map;
+	Party &party = *g_vm->_party;
+	Common::Point mazePos;
+	Direction mazeDir = DIR_NORTH;
+	int mazeId = 0;
+	bool mazeFlag = false;
+
+	// Set 
+	if (_isDarkCc) {
+		switch (party._mazeId) {
+		case 4:
+			if (party._questItems[35]) {
+				mazeId = 29;
+				mazePos = Common::Point(15, 31);
+				mazeDir = DIR_SOUTH;
+			}
+			break;
+
+		case 6:
+			if (party._questItems[38]) {
+				mazeId = 35;
+				mazePos = Common::Point(15, 8);
+				mazeDir = DIR_WEST;
+			}
+			break;
+
+		case 19:
+			if (party._questItems[36]) {
+				mazeId = 31;
+				mazePos = Common::Point(31, 16);
+				mazeDir = DIR_WEST;
+			}
+			break;
+
+		case 22:
+			if (party._questItems[37]) {
+				mazeId = 33;
+				mazePos = Common::Point(0, 3);
+				mazeDir = DIR_EAST;
+			}
+			break;
+
+		case 98:
+			if (party._questItems[39]) {
+				mazeId = 37;
+				mazePos = Common::Point(7, 0);
+				mazeDir = DIR_NORTH;
+			}
+			break;
+
+		default:
+			break;
+		}
+
+		mazeFlag = mazeId != 0;
+		if (!mazeFlag) {
+			mazeId = party._mazeId;
+			mazePos = party._mazePosition;
+			mazeDir = party._mazeDirection;
+		}
+	} else {
+		switch (party._mazeId) {
+		case 14:
+			mazeId = 37;
+			mazePos = Common::Point(1, 4);
+			mazeDir = DIR_EAST;
+			break;
+
+		case 18:
+			if (party._mazePosition.x == 9) {
+				mazeId = 35;
+				mazePos = Common::Point(1, 12);
+				mazeDir = DIR_EAST;
+			} else {
+				mazeId = 36;
+				mazePos = Common::Point(7, 1);
+				mazeDir = DIR_NORTH;
+			}
+			break;
+
+		case 23:
+			if (party._mazePosition.x == 5) {
+				mazeId = 33;
+				mazePos = Common::Point(7, 1);
+				mazeDir = DIR_NORTH;
+			} else {
+				mazeId = 34;
+				mazePos = Common::Point(7, 30);
+				mazeDir = DIR_SOUTH;
+			}
+			break;
+
+		default:
+			break;
+		}
+	}
+
+	map.load(mazeId);
+	party._mazePosition = mazePos;
+	party._mazeDirection = mazeDir;
+	return mazeFlag;
 }
 
 /*------------------------------------------------------------------------*/
diff --git a/engines/xeen/town.h b/engines/xeen/town.h
index 1f2728b..b4b70fa 100644
--- a/engines/xeen/town.h
+++ b/engines/xeen/town.h
@@ -53,6 +53,7 @@ protected:
 	int _drawFrameIndex;
 	uint _farewellTime;
 	int _drawCtr1, _drawCtr2;
+	int _animCtr;
 protected:
 	/**
 	 * Draw the window
@@ -65,6 +66,11 @@ protected:
 	int wait();
 
 	/**
+	 * Handles animation updates for Sphinx, Golem, Repear, and Dwarf events
+	 */
+	void animUpdate();
+
+	/**
 	 * Generates the display text for the location, for a given character
 	 */
 	virtual Common::String createLocationText(Character &ch) { return ""; }
@@ -253,9 +259,19 @@ public:
 };
 
 class DwarfLocation : public TownLocation {
+private:
+	/**
+	 * Set the new location
+	 */
+	bool setNewLocation();
 public:
 	DwarfLocation(bool isDwarf1);
 	virtual ~DwarfLocation() {}
+
+	/**
+	 * Show the town location
+	 */
+	virtual int show();
 };
 
 class SphinxLocation : public TownLocation {





More information about the Scummvm-git-logs mailing list