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

kirben at users.sourceforge.net kirben at users.sourceforge.net
Thu May 17 11:00:15 CEST 2007


Revision: 26858
          http://scummvm.svn.sourceforge.net/scummvm/?rev=26858&view=rev
Author:   kirben
Date:     2007-05-17 02:00:14 -0700 (Thu, 17 May 2007)

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

Modified Paths:
--------------
    scummvm/trunk/engines/agos/agos.h
    scummvm/trunk/engines/agos/cursor.cpp
    scummvm/trunk/engines/agos/event.cpp
    scummvm/trunk/engines/agos/input.cpp
    scummvm/trunk/engines/agos/verb.cpp
    scummvm/trunk/engines/agos/vga_ww.cpp
    scummvm/trunk/engines/agos/zones.cpp

Modified: scummvm/trunk/engines/agos/agos.h
===================================================================
--- scummvm/trunk/engines/agos/agos.h	2007-05-17 07:23:56 UTC (rev 26857)
+++ scummvm/trunk/engines/agos/agos.h	2007-05-17 09:00:14 UTC (rev 26858)
@@ -762,7 +762,7 @@
 	void displayBoxStars();
 	void invertBox(HitArea * ha, byte a, byte b, byte c, byte d);
 
-	void handleMouseMoved();
+	virtual void handleMouseMoved();
 	void initMouse();
 	virtual void drawMousePointer();
 
@@ -815,10 +815,10 @@
 	void writeChar(WindowBlock *window, int x, int y, int offs, int val);
 
 	byte *allocBlock(uint32 size);
-	void checkNoOverWrite();
+	virtual void checkNoOverWrite();
 	void checkRunningAnims();
-	void checkAnims(uint a);
-	void checkZonePtrs();
+	virtual void checkAnims(uint a);
+	virtual void checkZonePtrs();
 	void setZoneBuffers();
 
 	void runVgaScript();
@@ -1609,6 +1609,10 @@
 	void listSaveGames(int n);
 	void saveUserGame(int slot);
 	void windowBackSpace(WindowBlock *window);
+
+	virtual void checkNoOverWrite();
+	virtual void checkAnims(uint a);
+	virtual void checkZonePtrs();
 };
 
 class AGOSEngine_PuzzlePack : public AGOSEngine_Feeble {
@@ -1646,6 +1650,7 @@
 
 	const OpcodeEntryPuzzlePack *_opcodesPuzzlePack;
 
+	virtual void handleMouseMoved();
 	virtual void drawMousePointer();
 
 	virtual void resetVerbs();

Modified: scummvm/trunk/engines/agos/cursor.cpp
===================================================================
--- scummvm/trunk/engines/agos/cursor.cpp	2007-05-17 07:23:56 UTC (rev 26857)
+++ scummvm/trunk/engines/agos/cursor.cpp	2007-05-17 09:00:14 UTC (rev 26858)
@@ -300,7 +300,7 @@
 	0,0,10,7,10,6,10,5,10,4,10,3,10,4,10,5,10,6,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
 };
 
-void AGOSEngine::handleMouseMoved() {
+void AGOSEngine_PuzzlePack::handleMouseMoved() {
 	uint x;
 
 	if (getGameId() != GID_DIMP && _mouseHideCount) {
@@ -311,6 +311,38 @@
 	CursorMan.showMouse(true);
 	_mouse = _eventMan->getMousePos();
 
+	x = 0;
+	if (_lastHitArea3 == 0 && _leftButtonDown != 0) {
+		_verbHitArea = 300;
+		_leftButtonDown = 0;
+		x = 1;
+	}
+
+	if (_rightButtonDown != 0) {
+		_verbHitArea = (getGameId() == GID_DIMP) ? 301 : 300;
+		_rightButtonDown = 0;
+		x = 1;
+	}
+
+	boxController(_mouse.x, _mouse.y, x);
+	_lastHitArea3 = _lastHitArea;
+	if (x == 1 && _lastHitArea == NULL)
+		_lastHitArea3 = (HitArea *) -1;
+
+	drawMousePointer();
+}
+
+void AGOSEngine::handleMouseMoved() {
+	uint x;
+
+	if (_mouseHideCount) {
+		CursorMan.showMouse(false);
+		return;
+	}
+
+	CursorMan.showMouse(true);
+	_mouse = _eventMan->getMousePos();
+
 	if (_defaultVerb) {
 		uint id = 101;
 		if (_mouse.y >= 136)
@@ -386,8 +418,6 @@
 		}
 	}
 
-	// FIXME: The value of _mouseOld is *never* changed and hence
-	// always equal to (0,0). This seems like a bug.
 	if (_mouse != _mouseOld)
 		_needHitAreaRecalc++;
 
@@ -416,14 +446,8 @@
 
 	x = 0;
 	if (_lastHitArea3 == 0 && _leftButtonDown != 0) {
-		if (getGameType() == GType_PP)
-			_verbHitArea = 300;
 		_leftButtonDown = 0;
 		x = 1;
-	} else if (getGameType() == GType_PP && _rightButtonDown != 0) {
-		_verbHitArea = 300;
-		_rightButtonDown = 0;
-		x = 1;
 	} else {
 		if (_litBoxFlag == 0 && _needHitAreaRecalc == 0)
 			goto get_out;
@@ -436,6 +460,8 @@
 		_lastHitArea3 = (HitArea *) -1;
 
 get_out:
+
+	_mouseOld = _mouse;
 	drawMousePointer();
 
 	_needHitAreaRecalc = 0;

Modified: scummvm/trunk/engines/agos/event.cpp
===================================================================
--- scummvm/trunk/engines/agos/event.cpp	2007-05-17 07:23:56 UTC (rev 26857)
+++ scummvm/trunk/engines/agos/event.cpp	2007-05-17 09:00:14 UTC (rev 26858)
@@ -490,13 +490,13 @@
 				return;
 			}
 		}
-	} 
 
-	if (getGameType() == GType_FF) {
-		_moviePlay->nextFrame();
-	}
+		if (getGameType() == GType_FF) {
+			_moviePlay->nextFrame();
+		}
 
-	animateSprites();
+		animateSprites();
+	} 
 
 	if (_copyPartialMode == 2) {
 		fillFrontFromBack(0, 0, _screenWidth, _screenHeight);

Modified: scummvm/trunk/engines/agos/input.cpp
===================================================================
--- scummvm/trunk/engines/agos/input.cpp	2007-05-17 07:23:56 UTC (rev 26857)
+++ scummvm/trunk/engines/agos/input.cpp	2007-05-17 09:00:14 UTC (rev 26858)
@@ -40,7 +40,7 @@
 	if (ha->flags & kBFTextBox) {
 		if (getGameType() == GType_PP)
 			id = ha->id;
-		else if (getGameType() == GType_FF && (_lastHitArea->flags & kBFHyperBox))
+		else if (getGameType() == GType_FF && (ha->flags & kBFHyperBox))
 			id = ha->data;
 		else
 			id = ha->flags / 256;
@@ -160,6 +160,7 @@
 	_lastHitArea3 = 0;
 	_lastHitArea = 0;
 	_lastNameOn = NULL;
+
 	_mouseCursor = 0;
 	_noRightClick = 0;
 }
@@ -191,9 +192,9 @@
 		_dragAccept = 1;
 
 		for (;;) {
-			if (getGameType() != GType_FF && getGameType() != GType_PP && _keyPressed == 35)
+			if ((getGameType() == GType_SIMON1 || getGameType() == GType_SIMON2) && _keyPressed == 35)
 				displayBoxStars();
-			if (processSpecialKeys() != 0) {
+			if (processSpecialKeys()) {
 				if ((getGameType() == GType_PP && getGameId() != GID_DIMP) ||
 					getGameType() == GType_WW)
 					goto out_of_here;
@@ -203,14 +204,14 @@
 				_lastHitArea3 = NULL;
 				_dragAccept = 1;
 			} else {
-				if (_lastHitArea3 != 0 || _dragMode != 0)
+				if (_lastHitArea3 || _dragMode)
 					break;
 				hitarea_stuff_helper();
 				delay(100);
 			}
 		}
 
-		if (_lastHitArea3 == 0 && _dragMode != 0) {
+		if (!_lastHitArea3 && _dragMode) {
 			ha = _lastClickRem;
 
 			if (ha == 0 || ha->item_ptr == NULL || !(ha->flags & kBFDragBox)) {
@@ -254,11 +255,8 @@
 		}
 
 		ha = _lastHitArea;
-		if (_lastHitArea == NULL) {
-			continue;
-		}
-
-		if (ha->id == 0x7FFB) {
+		if (ha == NULL) {
+		} else if (ha->id == 0x7FFB) {
 			inventoryUp(ha->window);
 		} else if (ha->id == 0x7FFC) {
 			inventoryDown(ha->window);
@@ -298,7 +296,7 @@
 					waitForSync(34);
 				}
 			}
-			if (ha->item_ptr && (ha->verb == 0 || _verbHitArea != 0 ||
+			if (ha->item_ptr && (!ha->verb || _verbHitArea ||
 					(_hitAreaSubjectItem != ha->item_ptr && (ha->flags & kBFBoxItem)))
 				) {
 				_hitAreaSubjectItem = ha->item_ptr;
@@ -307,7 +305,7 @@
 				displayName(ha);
 				_nameLocked = 1;
 
-				if (_verbHitArea != 0) {
+				if (_verbHitArea) {
 					break;
 				}
 
@@ -318,8 +316,8 @@
 				else if (getGameType() == GType_ELVIRA1)
 					lightMenuStrip(getUserFlag1(ha->item_ptr, 6));
 			} else {
-				if (ha->verb != 0) {
-					if (getGameType() == GType_WW && _mouseCursor != 0 && _mouseCursor < 4) {
+				if (ha->verb) {
+					if (getGameType() == GType_WW && _mouseCursor && _mouseCursor < 4) {
 						_hitAreaSubjectItem = ha->item_ptr;
 						break;
 					}
@@ -371,7 +369,7 @@
 	} else if (getGameType() == GType_ELVIRA2 || getGameType() == GType_WW || 
 		getGameType() == GType_SIMON1) {
 		uint subr_id = (uint16)_variableArray[254];
-		if (subr_id != 0) {
+		if (subr_id) {
 			Subroutine *sub = getSubroutineByID(subr_id);
 			if (sub != NULL) {
 				startSubroutineEx(sub);
@@ -398,7 +396,7 @@
 	Subroutine *sub;
 
 	subr_id = (uint16)_variableArray[249];
-	if (subr_id != 0) {
+	if (subr_id) {
 		sub = getSubroutineByID(subr_id);
 		if (sub != NULL) {
 			_variableArray[249] = 0;
@@ -409,7 +407,7 @@
 	}
 
 	subr_id = (uint16)_variableArray[254];
-	if (subr_id != 0) {
+	if (subr_id) {
 		sub = getSubroutineByID(subr_id);
 		if (sub != NULL) {
 			_variableArray[254] = 0;
@@ -446,7 +444,7 @@
 	}
 
 	_curWindow = 0;
-	if (_windowArray[0] != 0) {
+	if (_windowArray[0]) {
 		_textWindow = _windowArray[0];
 		justifyStart();
 	}

Modified: scummvm/trunk/engines/agos/verb.cpp
===================================================================
--- scummvm/trunk/engines/agos/verb.cpp	2007-05-17 07:23:56 UTC (rev 26857)
+++ scummvm/trunk/engines/agos/verb.cpp	2007-05-17 09:00:14 UTC (rev 26858)
@@ -465,8 +465,7 @@
 	ha->verb = verb;
 	ha->item_ptr = item_ptr;
 
-	if ((getGameType() == GType_FF || getGameType() == GType_PP) &&
-		(ha->flags & kBFHyperBox)) {
+	if (getGameType() == GType_FF && (ha->flags & kBFHyperBox)) {
 		ha->data = _hyperLink;
 		ha->priority = 50;
 	}
@@ -535,9 +534,6 @@
 }
 
 void AGOSEngine_Feeble::setVerb(HitArea *ha) {
-	if (getGameType() == GType_PP)
-		return;
-
 	int cursor = _mouseCursor;
 	if (_noRightClick)
 		return;
@@ -736,13 +732,13 @@
 }
 
 void AGOSEngine::displayName(HitArea *ha) {
-	if (getGameType() == GType_ELVIRA1 || getGameType() == GType_ELVIRA2)
+	if (getGameType() == GType_ELVIRA1 || getGameType() == GType_ELVIRA2 || getGameType() == GType_PP)
 		return;
 
 	bool result;
 	int x = 0, y = 0;
 
-	if (getGameType() == GType_PP) {
+	if (getGameType() == GType_FF) {
 		if (ha->flags & kBFHyperBox) {
 			_lastNameOn = ha;
 			return;
@@ -750,20 +746,6 @@
 		if (findBox(50))
 			return;
 
-		y = ha->y;
-		y -= 17;
-		if (y < 0)
-			y = 0;
-		y += 2;
-		x = ha->width / 2 + ha->x;
-	} else if (getGameType() == GType_FF) {
-		if (ha->flags & kBFHyperBox) {
-			_lastNameOn = ha;
-			return;
-		}
-		if (findBox(50))
-			return;
-
 		if (getBitFlag(99))
 			_animatePointer = ((ha->flags & kBFTextBox) == 0);
 		else

Modified: scummvm/trunk/engines/agos/vga_ww.cpp
===================================================================
--- scummvm/trunk/engines/agos/vga_ww.cpp	2007-05-17 07:23:56 UTC (rev 26857)
+++ scummvm/trunk/engines/agos/vga_ww.cpp	2007-05-17 09:00:14 UTC (rev 26858)
@@ -177,7 +177,7 @@
 		memcpy(_videoBuf1, _currentPalette, _fastFadeCount * 4);
 
 		if (getGameType() == GType_FF || getGameType() == GType_PP) {
-			if (getBitFlag(75)) {
+			if (getGameType() == GType_FF && getBitFlag(75)) {
 				fadeCount = 4;
 				fadeSize = 64;
 			} else {
@@ -196,7 +196,7 @@
 		}
 
 		if (getGameType() == GType_FF || getGameType() == GType_PP) {
-			clearSurfaces(480);
+			clearSurfaces(_screenHeight);
 		} else if (getGameType() == GType_WW) {
 			memset(getFrontBuf(), 0, _screenWidth * _screenHeight);
 		} else {

Modified: scummvm/trunk/engines/agos/zones.cpp
===================================================================
--- scummvm/trunk/engines/agos/zones.cpp	2007-05-17 07:23:56 UTC (rev 26857)
+++ scummvm/trunk/engines/agos/zones.cpp	2007-05-17 09:00:14 UTC (rev 26858)
@@ -103,7 +103,21 @@
 	}
 }
 
-void AGOSEngine::checkNoOverWrite() {
+void AGOSEngine::checkRunningAnims() {
+	VgaSprite *vsp;
+	if (getGameType() != GType_FF && getGameType() != GType_PP &&
+		(_lockWord & 0x20)) {
+		return;
+	}
+
+	for (vsp = _vgaSprites; vsp->id; vsp++) {
+		checkAnims(vsp->zoneNum);
+		if (_rejectBlock == true)
+			return;
+	}
+}
+
+void AGOSEngine_Feeble::checkNoOverWrite() {
 	VgaPointersEntry *vpe;
 
 	if (_noOverWrite == 0xFFFF)
@@ -111,40 +125,70 @@
 
 	vpe = &_vgaBufferPointers[_noOverWrite];
 
-	if (getGameType() == GType_FF || getGameType() == GType_PP) {
-		if (vpe->vgaFile1 < _blockEnd && vpe->vgaFile1End > _block) {
-			_rejectBlock = true;
-			_vgaMemPtr = vpe->vgaFile1End;
-		} else if (vpe->vgaFile2 < _blockEnd && vpe->vgaFile2End > _block) {
-			_rejectBlock = true;
-			_vgaMemPtr = vpe->vgaFile2End;
-		} else if (vpe->sfxFile && vpe->sfxFile < _blockEnd && vpe->sfxFileEnd > _block) {
-			_rejectBlock = true;
-			_vgaMemPtr = vpe->sfxFileEnd;
-		} else {
-			_rejectBlock = false;
-		}
+	if (vpe->vgaFile1 < _blockEnd && vpe->vgaFile1End > _block) {
+		_rejectBlock = true;
+		_vgaMemPtr = vpe->vgaFile1End;
+	} else if (vpe->vgaFile2 < _blockEnd && vpe->vgaFile2End > _block) {
+		_rejectBlock = true;
+		_vgaMemPtr = vpe->vgaFile2End;
+	} else if (vpe->sfxFile && vpe->sfxFile < _blockEnd && vpe->sfxFileEnd > _block) {
+		_rejectBlock = true;
+		_vgaMemPtr = vpe->sfxFileEnd;
 	} else {
-		if (_block <= vpe->vgaFile1 && _blockEnd >= vpe->vgaFile1 ||
-			_vgaMemPtr <= vpe->vgaFile2 && _blockEnd >= vpe->vgaFile2) {
-			_rejectBlock = true;
-			_vgaMemPtr = vpe->vgaFile1 + 0x5000;
-		} else {
-			_rejectBlock = false;
-		}
+		_rejectBlock = false;
 	}
 }
 
-void AGOSEngine::checkRunningAnims() {
-	VgaSprite *vsp;
-	if (getGameType() != GType_FF && getGameType() != GType_PP && (_lockWord & 0x20)) {
-		return;
+void AGOSEngine_Feeble::checkAnims(uint a) {
+	VgaPointersEntry *vpe;
+
+	vpe = &_vgaBufferPointers[a];
+
+	if (vpe->vgaFile1 < _blockEnd && vpe->vgaFile1End > _block) {
+		_rejectBlock = true;
+		_vgaMemPtr = vpe->vgaFile1End;
+	} else if (vpe->vgaFile2 < _blockEnd && vpe->vgaFile2End > _block) {
+		_rejectBlock = true;
+		_vgaMemPtr = vpe->vgaFile2End;
+	} else if (vpe->sfxFile && vpe->sfxFile < _blockEnd && vpe->sfxFileEnd > _block) {
+		_rejectBlock = true;
+		_vgaMemPtr = vpe->sfxFileEnd;
+	} else {
+		_rejectBlock = false;
 	}
+}
 
-	for (vsp = _vgaSprites; vsp->id; vsp++) {
-		checkAnims(vsp->zoneNum);
-		if (_rejectBlock == true)
-			return;
+void AGOSEngine_Feeble::checkZonePtrs() {
+	uint count = ARRAYSIZE(_vgaBufferPointers);
+	VgaPointersEntry *vpe = _vgaBufferPointers;
+	do {
+		if (vpe->vgaFile1 < _blockEnd && vpe->vgaFile1End > _block ||
+			vpe->vgaFile2 < _blockEnd && vpe->vgaFile2End > _block ||
+			vpe->sfxFile < _blockEnd && vpe->sfxFileEnd > _block) {
+			vpe->vgaFile1 = NULL;
+			vpe->vgaFile1End = NULL;
+			vpe->vgaFile2 = NULL;
+			vpe->vgaFile2End = NULL;
+			vpe->sfxFile = NULL;
+			vpe->sfxFileEnd = NULL;
+		}
+	} while (++vpe, --count);
+}
+
+void AGOSEngine::checkNoOverWrite() {
+	VgaPointersEntry *vpe;
+
+	if (_noOverWrite == 0xFFFF)
+		return;
+
+	vpe = &_vgaBufferPointers[_noOverWrite];
+
+	if (_block <= vpe->vgaFile1 && _blockEnd >= vpe->vgaFile1 ||
+		_vgaMemPtr <= vpe->vgaFile2 && _blockEnd >= vpe->vgaFile2) {
+		_rejectBlock = true;
+		_vgaMemPtr = vpe->vgaFile1 + 0x5000;
+	} else {
+		_rejectBlock = false;
 	}
 }
 
@@ -153,27 +197,12 @@
 
 	vpe = &_vgaBufferPointers[a];
 
-	if (getGameType() == GType_FF || getGameType() == GType_PP) {
-		if (vpe->vgaFile1 < _blockEnd && vpe->vgaFile1End > _block) {
-			_rejectBlock = true;
-			_vgaMemPtr = vpe->vgaFile1End;
-		} else if (vpe->vgaFile2 < _blockEnd && vpe->vgaFile2End > _block) {
-			_rejectBlock = true;
-			_vgaMemPtr = vpe->vgaFile2End;
-		} else if (vpe->sfxFile && vpe->sfxFile < _blockEnd && vpe->sfxFileEnd > _block) {
-			_rejectBlock = true;
-			_vgaMemPtr = vpe->sfxFileEnd;
-		} else {
-			_rejectBlock = false;
-		}
+	if (_block <= vpe->vgaFile1 && _blockEnd >= vpe->vgaFile1 ||
+			_block <= vpe->vgaFile2 && _blockEnd >= vpe->vgaFile2) {
+		_rejectBlock = true;
+		_vgaMemPtr = vpe->vgaFile1 + 0x5000;
 	} else {
-		if (_block <= vpe->vgaFile1 && _blockEnd >= vpe->vgaFile1 ||
-				_block <= vpe->vgaFile2 && _blockEnd >= vpe->vgaFile2) {
-			_rejectBlock = true;
-			_vgaMemPtr = vpe->vgaFile1 + 0x5000;
-		} else {
-			_rejectBlock = false;
-		}
+		_rejectBlock = false;
 	}
 }
 
@@ -181,23 +210,10 @@
 	uint count = ARRAYSIZE(_vgaBufferPointers);
 	VgaPointersEntry *vpe = _vgaBufferPointers;
 	do {
-		if (getGameType() == GType_FF || getGameType() == GType_PP) {
-			if (vpe->vgaFile1 < _blockEnd && vpe->vgaFile1End > _block ||
-					vpe->vgaFile2 < _blockEnd && vpe->vgaFile2End > _block ||
-					vpe->sfxFile < _blockEnd && vpe->sfxFileEnd > _block) {
-				vpe->vgaFile1 = NULL;
-				vpe->vgaFile1End = NULL;
-				vpe->vgaFile2 = NULL;
-				vpe->vgaFile2End = NULL;
-				vpe->sfxFile = NULL;
-				vpe->sfxFileEnd = NULL;
-			}
-		} else {
-			if (_block <= vpe->vgaFile1 && _blockEnd >= vpe->vgaFile1 ||
-					_block <= vpe->vgaFile2 && _blockEnd >= vpe->vgaFile2) {
-				vpe->vgaFile1 = NULL;
-				vpe->vgaFile2 = NULL;
-			}
+		if (_block <= vpe->vgaFile1 && _blockEnd >= vpe->vgaFile1 ||
+			_block <= vpe->vgaFile2 && _blockEnd >= vpe->vgaFile2) {
+			vpe->vgaFile1 = NULL;
+			vpe->vgaFile2 = NULL;
 		}
 	} while (++vpe, --count);
 }


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