[Scummvm-cvs-logs] SF.net SVN: scummvm:[55599] scummvm/trunk/engines/hugo

strangerke at users.sourceforge.net strangerke at users.sourceforge.net
Fri Jan 28 20:54:48 CET 2011


Revision: 55599
          http://scummvm.svn.sourceforge.net/scummvm/?rev=55599&view=rev
Author:   strangerke
Date:     2011-01-28 19:54:48 +0000 (Fri, 28 Jan 2011)

Log Message:
-----------
HUGO: Add a function to display exit hotspots in God Mode

Modified Paths:
--------------
    scummvm/trunk/engines/hugo/display.cpp
    scummvm/trunk/engines/hugo/display.h
    scummvm/trunk/engines/hugo/hugo.cpp

Modified: scummvm/trunk/engines/hugo/display.cpp
===================================================================
--- scummvm/trunk/engines/hugo/display.cpp	2011-01-28 18:58:12 UTC (rev 55598)
+++ scummvm/trunk/engines/hugo/display.cpp	2011-01-28 19:54:48 UTC (rev 55599)
@@ -486,7 +486,9 @@
 		}
 	}
 }
-
+/**
+* Display rectangle (filles or empty)
+*/
 void Screen::drawRectangle(bool filledFl, int16 x1, int16 y1, int16 x2, int16 y2, int color) {
 	assert(x1 <= x2);
 	assert(y1 <= y2);
@@ -496,10 +498,18 @@
 			for (int j = x1; j < x2; j++) {
 				_backBuffer[320 * i + j] = color;
 				_frontBuffer[320 * i + j] = color;
+				_backBufferBackup[320 * i + j] = color;
 			}
 		}
 	} else {
-		warning("STUB: drawRectangle()");
+		for (int i = y1; i < y2; i++) {
+			_frontBuffer[320 * i + x1] = color;
+			_frontBuffer[320 * i + x2] = color;
+		}
+		for (int i = x1; i < x2; i++) {
+			_frontBuffer[320 * y1 + i] = color;
+			_frontBuffer[320 * y2 + i] = color;
+		}
 	}
 }
 
@@ -595,11 +605,29 @@
 	return (y >= rect->y) && (y <= rect->y + rect->dy);
 }
 
+/**
+* Check if two rectangles are over lapping
+*/
 bool Screen::isOverlaping(rect_t *rectA, rect_t *rectB) {
 	return (isInX(rectA->x, rectB) || isInX(rectA->x + rectA->dx, rectB) || isInX(rectB->x, rectA) || isInX(rectB->x + rectB->dx, rectA)) && 
 		   (isInY(rectA->y, rectB) || isInY(rectA->y + rectA->dy, rectB) || isInY(rectB->y, rectA) || isInY(rectB->y + rectB->dy, rectA));
 }
 
+/**
+* Display exit hotspots in God Mode
+*/
+void Screen::drawHotspots() {
+	if (!_vm->getGameStatus().godModeFl)
+		return;
+
+	for (int i = 0; _vm->_hotspots[i].screenIndex >= 0; i++) {
+		hotspot_t *hotspot = &_vm->_hotspots[i];
+		if (hotspot->screenIndex == _vm->_hero->screenIndex)
+			drawRectangle(false, hotspot->x1, hotspot->y1, hotspot->x2, hotspot->y2, _TLIGHTRED);
+	}
+	g_system->copyRectToScreen(_frontBuffer, 320, 0, 0, 320, 200);
+}
+
 Screen_v1d::Screen_v1d(HugoEngine *vm) : Screen(vm) {
 }
 

Modified: scummvm/trunk/engines/hugo/display.h
===================================================================
--- scummvm/trunk/engines/hugo/display.h	2011-01-28 18:58:12 UTC (rev 55598)
+++ scummvm/trunk/engines/hugo/display.h	2011-01-28 19:54:48 UTC (rev 55599)
@@ -97,6 +97,7 @@
 	void     displayFrame(int sx, int sy, seq_t *seq, bool foreFl);
 	void     displayList(dupdate_t update, ...);
 	void     displayRect(int16 x, int16 y, int16 dx, int16 dy);
+	void     drawHotspots();
 	void     drawRectangle(bool filledFl, int16 x1, int16 y1, int16 x2, int16 y2, int color);
 	void     drawShape(int x, int y, int color1, int color2);
 	void     drawStatusText();

Modified: scummvm/trunk/engines/hugo/hugo.cpp
===================================================================
--- scummvm/trunk/engines/hugo/hugo.cpp	2011-01-28 18:58:12 UTC (rev 55598)
+++ scummvm/trunk/engines/hugo/hugo.cpp	2011-01-28 19:54:48 UTC (rev 55599)
@@ -254,6 +254,8 @@
 	_status.doQuitFl = false;
 
 	while (!_status.doQuitFl) {
+		_screen->drawHotspots();
+
 		g_system->updateScreen();
 		_sound->pcspkr_player();
 		runMachine();
@@ -287,7 +289,6 @@
 		}
 		_mouse->mouseHandler();                     // Mouse activity - adds to display list
 		_screen->displayList(kDisplayDisplay);      // Blit the display list to screen
-
 		_status.doQuitFl |= shouldQuit();           // update game quit flag
 	}
 	return Common::kNoError;


This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.




More information about the Scummvm-git-logs mailing list