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

strangerke at users.sourceforge.net strangerke at users.sourceforge.net
Sun Jan 30 00:05:12 CET 2011


Revision: 55642
          http://scummvm.svn.sourceforge.net/scummvm/?rev=55642&view=rev
Author:   strangerke
Date:     2011-01-29 23:05:12 +0000 (Sat, 29 Jan 2011)

Log Message:
-----------
HUGO: Cleanup drawRectangle() and keyHandler()

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

Modified: scummvm/trunk/engines/hugo/display.cpp
===================================================================
--- scummvm/trunk/engines/hugo/display.cpp	2011-01-29 23:03:08 UTC (rev 55641)
+++ scummvm/trunk/engines/hugo/display.cpp	2011-01-29 23:05:12 UTC (rev 55642)
@@ -106,9 +106,9 @@
 	debugC(3, kDebugDisplay, "displayRect(%d, %d, %d, %d)", x, y, dx, dy);
 
 	int16 xClip, yClip;
-	xClip = CLIP<int16>(x, 0, 320);
-	yClip = CLIP<int16>(y, 0, 200);
-	g_system->copyRectToScreen(&_frontBuffer[x + y * 320], 320, xClip, yClip, CLIP<int16>(dx, 0, 320 - x), CLIP<int16>(dy, 0, 200 - y));
+	xClip = CLIP<int16>(x, 0, 319);
+	yClip = CLIP<int16>(y, 0, 199);
+	g_system->copyRectToScreen(&_frontBuffer[xClip + yClip * 320], 320, xClip, yClip, CLIP<int16>(dx, 0, 319 - xClip), CLIP<int16>(dy, 0, 199 - yClip));
 }
 
 /**
@@ -493,21 +493,20 @@
 void Screen::drawRectangle(bool filledFl, int16 x1, int16 y1, int16 x2, int16 y2, int color) {
 	assert(x1 <= x2);
 	assert(y1 <= y2);
+	int16 x2Clip = CLIP<int16>(x2, 0, 320);
+	int16 y2Clip = CLIP<int16>(y2, 0, 200);
 
 	if (filledFl) {
-		for (int i = y1; i <= CLIP<int16>(y2, 0, 200); i++) {
-			for (int j = x1; j <= CLIP<int16>(x2, 0, 320); j++) {
-				_backBuffer[320 * i + j] = color;
+		for (int i = y1; i < y2Clip; i++) {
+			for (int j = x1; j < x2Clip; j++)
 				_frontBuffer[320 * i + j] = color;
-				_backBufferBackup[320 * i + j] = color;
-			}
 		}
 	} else {
-		for (int i = y1; i <= CLIP<int16>(y2, 0, 200); i++) {
+		for (int i = y1; i < y2Clip; i++) {
 			_frontBuffer[320 * i + x1] = color;
 			_frontBuffer[320 * i + x2] = color;
 		}
-		for (int i = x1; i < CLIP<int16>(x2, 0, 320); i++) {
+		for (int i = x1; i < x2Clip; i++) {
 			_frontBuffer[320 * y1 + i] = color;
 			_frontBuffer[320 * y2 + i] = color;
 		}

Modified: scummvm/trunk/engines/hugo/hugo.cpp
===================================================================
--- scummvm/trunk/engines/hugo/hugo.cpp	2011-01-29 23:03:08 UTC (rev 55641)
+++ scummvm/trunk/engines/hugo/hugo.cpp	2011-01-29 23:05:12 UTC (rev 55642)
@@ -264,10 +264,6 @@
 		while (_eventMan->pollEvent(event)) {
 			switch (event.type) {
 			case Common::EVENT_KEYDOWN:
-				if (event.kbd.keycode == Common::KEYCODE_d && event.kbd.hasFlags(Common::KBD_CTRL)) {
-					this->getDebugger()->attach();
-					this->getDebugger()->onFrame();
-				}
 				_parser->keyHandler(event);
 				break;
 			case Common::EVENT_MOUSEMOVE:

Modified: scummvm/trunk/engines/hugo/parser.cpp
===================================================================
--- scummvm/trunk/engines/hugo/parser.cpp	2011-01-29 23:03:08 UTC (rev 55641)
+++ scummvm/trunk/engines/hugo/parser.cpp	2011-01-29 23:05:12 UTC (rev 55642)
@@ -33,6 +33,10 @@
 #include "common/system.h"
 #include "common/events.h"
 
+#include "common/random.h"
+#include "common/EventRecorder.h"
+#include "common/debug-channels.h"
+
 #include "hugo/hugo.h"
 #include "hugo/display.h"
 #include "hugo/parser.h"
@@ -131,6 +135,37 @@
 	status_t &gameStatus = _vm->getGameStatus();
 	uint16 nChar = event.kbd.keycode;
 
+	if ((event.kbd.hasFlags(Common::KBD_ALT)) || (event.kbd.hasFlags(Common::KBD_SCRL)))
+		return;
+
+	if (event.kbd.hasFlags(Common::KBD_CTRL)) {
+		switch (nChar) {
+		case Common::KEYCODE_d:
+			_vm->getDebugger()->attach();
+			_vm->getDebugger()->onFrame();
+			break;
+		case Common::KEYCODE_l:
+			_vm->_file->restoreGame(-1);
+			_vm->_scheduler->restoreScreen(*_vm->_screen_p);
+			gameStatus.viewState = kViewPlay;
+			break;
+		case Common::KEYCODE_n:
+			warning("STUB: CTRL-N (WIN) - New Game");
+			break;
+		case Common::KEYCODE_s:
+			if (gameStatus.viewState == kViewPlay) {
+				if (gameStatus.gameOverFl)
+					Utils::gameOverMsg();
+				else
+					_vm->_file->saveGame(-1, Common::String());
+			}
+			break;
+		default:
+			break;
+		}
+		return;
+	}
+
 	// Process key down event - called from OnKeyDown()
 	switch (nChar) {                                // Set various toggle states
 	case Common::KEYCODE_ESCAPE:                    // Escape key, may want to QUIT
@@ -197,61 +232,6 @@
 	case Common::KEYCODE_F9:                        // Boss button
 		warning("STUB: F9 (DOS) - BossKey");
 		break;
-	case Common::KEYCODE_l:
-		if (event.kbd.hasFlags(Common::KBD_CTRL)) {
-			_vm->_file->restoreGame(-1);
-			_vm->_scheduler->restoreScreen(*_vm->_screen_p);
-			gameStatus.viewState = kViewPlay;
-		} else {
-			if (!gameStatus.storyModeFl) {          // Keyboard disabled
-				// Add printable keys to ring buffer
-				uint16 bnext = _putIndex + 1;
-				if (bnext >= sizeof(_ringBuffer))
-					bnext = 0;
-				if (bnext != _getIndex) {
-					_ringBuffer[_putIndex] = event.kbd.ascii;
-					_putIndex = bnext;
-				}
-			}
-		}
-		break;
-	case Common::KEYCODE_n:
-		if (event.kbd.hasFlags(Common::KBD_CTRL)) {
-			warning("STUB: CTRL-N (WIN) - New Game");
-		} else {
-			if (!gameStatus.storyModeFl) {          // Keyboard disabled
-				// Add printable keys to ring buffer
-				uint16 bnext = _putIndex + 1;
-				if (bnext >= sizeof(_ringBuffer))
-					bnext = 0;
-				if (bnext != _getIndex) {
-					_ringBuffer[_putIndex] = event.kbd.ascii;
-					_putIndex = bnext;
-				}
-			}
-		}
-		break;
-	case Common::KEYCODE_s:
-		if (event.kbd.hasFlags(Common::KBD_CTRL)) {
-			if (gameStatus.viewState == kViewPlay) {
-				if (gameStatus.gameOverFl)
-					Utils::gameOverMsg();
-				else
-					_vm->_file->saveGame(-1, Common::String());
-			}
-		} else {
-			if (!gameStatus.storyModeFl) {          // Keyboard disabled
-				// Add printable keys to ring buffer
-				uint16 bnext = _putIndex + 1;
-				if (bnext >= sizeof(_ringBuffer))
-					bnext = 0;
-				if (bnext != _getIndex) {
-					_ringBuffer[_putIndex] = event.kbd.ascii;
-					_putIndex = bnext;
-				}
-			}
-		}
-		break;
 	default:                                        // Any other key
 		if (!gameStatus.storyModeFl) {              // Keyboard disabled
 			// Add printable keys to ring buffer


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