[Scummvm-cvs-logs] SF.net SVN: scummvm: [26482] scummvm/trunk/engines/agos

kirben at users.sourceforge.net kirben at users.sourceforge.net
Sun Apr 15 07:33:23 CEST 2007


Revision: 26482
          http://scummvm.svn.sourceforge.net/scummvm/?rev=26482&view=rev
Author:   kirben
Date:     2007-04-14 22:33:21 -0700 (Sat, 14 Apr 2007)

Log Message:
-----------
Cleanup.

Modified Paths:
--------------
    scummvm/trunk/engines/agos/agos.h
    scummvm/trunk/engines/agos/verb.cpp

Modified: scummvm/trunk/engines/agos/agos.h
===================================================================
--- scummvm/trunk/engines/agos/agos.h	2007-04-15 05:04:48 UTC (rev 26481)
+++ scummvm/trunk/engines/agos/agos.h	2007-04-15 05:33:21 UTC (rev 26482)
@@ -630,8 +630,8 @@
 	void defineBox(int id, int x, int y, int width, int height, int flags, int verb, Item *item_ptr);
 	HitArea *findEmptyHitArea();
 
-	void resetVerbs();
-	void setVerb(HitArea * ha);
+	virtual void resetVerbs();
+	virtual void setVerb(HitArea * ha);
 	void hitarea_leave(HitArea * ha, bool state = false);
 	void leaveHitAreaById(uint hitarea_id);
 
@@ -737,8 +737,8 @@
 
 	void checkUp(WindowBlock *window);
 	void checkDown(WindowBlock *window);
-	void inventoryUp(WindowBlock *window);
-	void inventoryDown(WindowBlock *window);
+	virtual void inventoryUp(WindowBlock *window);
+	virtual void inventoryDown(WindowBlock *window);
 
 	WindowBlock *openWindow(uint x, uint y, uint w, uint h, uint flags, uint fillColor, uint textColor);
 	uint getWindowNum(WindowBlock *window);
@@ -752,7 +752,7 @@
 	HitArea *findBox(uint hitarea_id);
 	void boxController(uint x, uint y, uint mode);
 	void handleVerbClicked(uint verb);
-	void clearName();
+	virtual void clearName();
 	void displayName(HitArea * ha);
 	void resetNameWindow();
 	void displayBoxStars();
@@ -1471,8 +1471,15 @@
 
 	virtual void drawMousePointer();
 protected:
+	virtual void resetVerbs();
+	virtual void setVerb(HitArea * ha);
+
+	virtual void inventoryUp(WindowBlock *window);
+	virtual void inventoryDown(WindowBlock *window);
+
+	virtual void clearName();
+
 	virtual void drawIconArray(uint i, Item *item_ptr, int line, int classMask);
-
 private:
 };
 
@@ -1483,6 +1490,8 @@
 
 	virtual void setupOpcodes(OpcodeProc *op);
 
+protected:
+	virtual void resetVerbs();
 private:
 };
 

Modified: scummvm/trunk/engines/agos/verb.cpp
===================================================================
--- scummvm/trunk/engines/agos/verb.cpp	2007-04-15 05:04:48 UTC (rev 26481)
+++ scummvm/trunk/engines/agos/verb.cpp	2007-04-15 05:33:21 UTC (rev 26482)
@@ -176,6 +176,14 @@
 	"", "", "", "to whom ?"
 };
 
+void AGOSEngine_Feeble::clearName() {
+	stopAnimateSimon2(2, 6);
+	_lastNameOn = NULL;
+	_animatePointer = 0;
+	_mouseAnim = 1;
+	return;
+}
+
 void AGOSEngine::clearName() {
 	if (getGameType() == GType_ELVIRA1 || getGameType() == GType_ELVIRA2)
 		return;
@@ -186,14 +194,6 @@
 	HitArea *last;
 	HitArea *ha;
 
-	if (getGameType() == GType_FF || getGameType() == GType_PP) {
-		stopAnimateSimon2(2, 6);
-		_lastNameOn = NULL;
-		_animatePointer = 0;
-		_mouseAnim = 1;
-		return;
-	}
-
 	if (getGameType() == GType_SIMON2) {
 		if (getBitFlag(79)) {
 			sendSync(202);
@@ -474,118 +474,121 @@
 	_needHitAreaRecalc++;
 }
 
+void AGOSEngine_PuzzlePack::resetVerbs() {
+	_verbHitArea = 300;
+}
+
+void AGOSEngine_Feeble::resetVerbs() {
+	_verbHitArea = 300;
+	int cursor = 0;
+	int animMax = 16;
+
+	if (getBitFlag(203)) {
+		cursor = 14;
+		animMax = 9;
+	} else if (getBitFlag(204)) {
+		cursor = 15;
+		animMax = 9;
+	} else if (getBitFlag(207)) {
+		cursor = 26;
+		animMax = 2;
+	}
+
+	_mouseCursor = cursor;
+	_mouseAnimMax = animMax;
+	_mouseAnim = 1;
+	_needHitAreaRecalc++;
+
+	if (getBitFlag(99)) {
+		setVerb(NULL);
+	}
+}
+
 void AGOSEngine::resetVerbs() {
 	if (getGameType() == GType_ELVIRA1 || getGameType() == GType_ELVIRA2)
 		return;
 
-	if (getGameType() == GType_PP) {
-		_verbHitArea = 300;
-	} else if (getGameType() == GType_FF) {
-		_verbHitArea = 300;
-		int cursor = 0;
-		int animMax = 16;
+	uint id;
+	HitArea *ha;
 
-		if (getBitFlag(203)) {
-			cursor = 14;
-			animMax = 9;
-		} else if (getBitFlag(204)) {
-			cursor = 15;
-			animMax = 9;
-		} else if (getBitFlag(207)) {
-			cursor = 26;
-			animMax = 2;
-		}
+	if (getGameType() == GType_SIMON2) {
+		id = 2;
+		if (!getBitFlag(79))
+		id = (_mouse.y >= 136) ? 102 : 101;
+	} else {
+		id = (_mouse.y >= 136) ? 102 : 101;
+	}
 
-		_mouseCursor = cursor;
-		_mouseAnimMax = animMax;
-		_mouseAnim = 1;
-		_needHitAreaRecalc++;
+	_defaultVerb = id;
 
-		if (getBitFlag(99)) {
-			setVerb(NULL);
-		}
+	ha = findBox(id);
+	if (ha == NULL)
+		return;
+
+	if (ha->flags & kBFBoxDead) {
+		_defaultVerb = 999;
+		_currentVerbBox = NULL;
 	} else {
-		uint id;
-		HitArea *ha;
+		_verbHitArea = ha->verb;
+		setVerb(ha);
+	}
+}
 
-		if (getGameType() == GType_SIMON2) {
-			id = 2;
-			if (!getBitFlag(79))
-				id = (_mouse.y >= 136) ? 102 : 101;
-		} else {
-			id = (_mouse.y >= 136) ? 102 : 101;
-		}
+void AGOSEngine_Feeble::setVerb(HitArea *ha) {
+	if (getGameType() == GType_PP)
+		return;
 
-		_defaultVerb = id;
+	int cursor = _mouseCursor;
+	if (_noRightClick)
+		return;
 
-		ha = findBox(id);
-		if (ha == NULL)
-			return;
-
-		if (ha->flags & kBFBoxDead) {
-			_defaultVerb = 999;
-			_currentVerbBox = NULL;
-		} else {
-			_verbHitArea = ha->verb;
-			setVerb(ha);
+	if (cursor > 13)
+		cursor = 0;
+	cursor++;
+	if (cursor == 5)
+		cursor = 1;
+	if (cursor == 4) {
+		if (getBitFlag(72)) {
+			cursor = 1;
 		}
+	} else if (cursor == 2) {
+		if (getBitFlag(99)) {
+			cursor = 3;
+		}
 	}
+
+	_mouseCursor = cursor;
+	_mouseAnimMax = (cursor == 4) ? 14: 16;
+	_mouseAnim = 1;
+	_needHitAreaRecalc++;
+	_verbHitArea = cursor + 300;
 }
 
 void AGOSEngine::setVerb(HitArea *ha) {
-	if (getGameType() == GType_PP) {
+	HitArea *tmp = _currentVerbBox;
+
+	if (ha == tmp)
 		return;
-	} else if (getGameType() == GType_FF) {
-		int cursor = _mouseCursor;
-		if (_noRightClick)
-			return;
 
-		if (cursor > 13)
-			cursor = 0;
-		cursor++;
-		if (cursor == 5)
-			cursor = 1;
-		if (cursor == 4) {
-			if (getBitFlag(72)) {
-				cursor = 1;
-			}
-		} else if (cursor == 2) {
-			if (getBitFlag(99)) {
-				cursor = 3;
-			}
+	if (getGameType() == GType_SIMON1) {
+		if (tmp != NULL) {
+			tmp->flags |= kBFInvertTouch;
+			invertBox(tmp, 213, 208, 213, 10);
 		}
 
-		_mouseCursor = cursor;
-		_mouseAnimMax = (cursor == 4) ? 14: 16;
-		_mouseAnim = 1;
-		_needHitAreaRecalc++;
-		_verbHitArea = cursor + 300;
+		if (ha->flags & kBFBoxSelected)
+			invertBox(ha, 218, 213, 213, 5);
+		else
+			invertBox(ha, 223, 218, 218, 10);
+
+		ha->flags &= ~(kBFBoxSelected + kBFInvertTouch);
 	} else {
-		HitArea *tmp = _currentVerbBox;
-
-		if (ha == tmp)
+		if (ha->id < 101)
 			return;
-
-		if (getGameType() == GType_SIMON1) {
-			if (tmp != NULL) {
-				tmp->flags |= kBFInvertTouch;
-				invertBox(tmp, 213, 208, 213, 10);
-			}
-
-			if (ha->flags & kBFBoxSelected)
-				invertBox(ha, 218, 213, 213, 5);
-			else
-				invertBox(ha, 223, 218, 218, 10);
-
-			ha->flags &= ~(kBFBoxSelected + kBFInvertTouch);
-		} else {
-			if (ha->id < 101)
-				return;
-			_mouseCursor = ha->id - 101;
-			_needHitAreaRecalc++;
-		}
-		_currentVerbBox = ha;
+		_mouseCursor = ha->id - 101;
+		_needHitAreaRecalc++;
 	}
+	_currentVerbBox = ha;
 }
 
 void AGOSEngine::hitarea_leave(HitArea *ha, bool state) {
@@ -658,57 +661,57 @@
 	}
 }
 
-void AGOSEngine::inventoryUp(WindowBlock *window) {
-	if (getGameType() == GType_FF) {
-		_marks = 0;
+void AGOSEngine_Feeble::inventoryUp(WindowBlock *window) {
+	_marks = 0;
+	checkUp(window);
+	animate(4, 9, 21, 0 ,0, 0);	
+	while (1) {
+		if (_currentBox->id != 0x7FFB || !getBitFlag(89))
+			break;
 		checkUp(window);
-		animate(4, 9, 21, 0 ,0, 0);	
-		while (1) {
-			if (_currentBox->id != 0x7FFB || !getBitFlag(89))
-				break;
-			checkUp(window);
-			delay(1);
-		}
-		waitForMark(2);
-		checkUp(window);
-		sendSync(922);
-		waitForMark(1);
-		checkUp(window);
-	} else {
-		if (window->iconPtr->line == 0)
-			return;
-
-		mouseOff();
-		uint index = getWindowNum(window);
-		drawIconArray(index, window->iconPtr->itemRef, window->iconPtr->line - 1, window->iconPtr->classMask);
-		mouseOn();
+		delay(1);
 	}
+	waitForMark(2);
+	checkUp(window);
+	sendSync(922);
+	waitForMark(1);
+	checkUp(window);
 }
 
-void AGOSEngine::inventoryDown(WindowBlock *window) {
-	if (getGameType() == GType_FF) {
-		_marks = 0;
+void AGOSEngine::inventoryUp(WindowBlock *window) {
+	if (window->iconPtr->line == 0)
+		return;
+
+	mouseOff();
+	uint index = getWindowNum(window);
+	drawIconArray(index, window->iconPtr->itemRef, window->iconPtr->line - 1, window->iconPtr->classMask);
+	mouseOn();
+}
+
+void AGOSEngine_Feeble::inventoryDown(WindowBlock *window) {
+	_marks = 0;
+	checkDown(window);
+	animate(4, 9, 23, 0, 0, 0);	
+	while (1) {
+		if (_currentBox->id != 0x7FFC || !getBitFlag(89))
+		break;
 		checkDown(window);
-		animate(4, 9, 23, 0, 0, 0);	
-		while (1) {
-			if (_currentBox->id != 0x7FFC || !getBitFlag(89))
-				break;
-			checkDown(window);
-			delay(1);
-		}
-		waitForMark(2);
-		checkDown(window);
-		sendSync(924);
-		waitForMark(1);
-		checkDown(window);
-	} else {
-		mouseOff();
-		uint index = getWindowNum(window);
-		drawIconArray(index, window->iconPtr->itemRef, window->iconPtr->line + 1, window->iconPtr->classMask);
-		mouseOn();
+		delay(1);
 	}
+	waitForMark(2);
+	checkDown(window);
+	sendSync(924);
+	waitForMark(1);
+	checkDown(window);
 }
 
+void AGOSEngine::inventoryDown(WindowBlock *window) {
+	mouseOff();
+	uint index = getWindowNum(window);
+	drawIconArray(index, window->iconPtr->itemRef, window->iconPtr->line + 1, window->iconPtr->classMask);
+	mouseOn();
+}
+
 void AGOSEngine::boxController(uint x, uint y, uint mode) {
 	HitArea *best_ha;
 	HitArea *ha = _hitAreas;


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