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

kirben at users.sourceforge.net kirben at users.sourceforge.net
Mon Oct 2 07:39:36 CEST 2006


Revision: 24061
          http://svn.sourceforge.net/scummvm/?rev=24061&view=rev
Author:   kirben
Date:     2006-10-01 22:39:27 -0700 (Sun, 01 Oct 2006)

Log Message:
-----------
Add last tiles code and corrections for Swampy

Modified Paths:
--------------
    scummvm/trunk/engines/agos/agos.cpp
    scummvm/trunk/engines/agos/agos.h
    scummvm/trunk/engines/agos/event.cpp
    scummvm/trunk/engines/agos/items.cpp
    scummvm/trunk/engines/agos/vga.cpp

Modified: scummvm/trunk/engines/agos/agos.cpp
===================================================================
--- scummvm/trunk/engines/agos/agos.cpp	2006-10-02 04:46:50 UTC (rev 24060)
+++ scummvm/trunk/engines/agos/agos.cpp	2006-10-02 05:39:27 UTC (rev 24061)
@@ -1201,6 +1201,8 @@
 			if ((getGameType() == GType_SIMON1 || getGameType() == GType_SIMON2) && _keyPressed == 35)
 				displayBoxStars();
 			processSpecialKeys();
+			if (_keyPressed != 0)
+				break;
 			if (_lastHitArea3 == (HitArea *) -1)
 				goto startOver;
 			if (_lastHitArea3 != 0)
@@ -1731,8 +1733,10 @@
 }
 
 Item *AGOSEngine::derefItem(uint item) {
-	if (item >= _itemArraySize)
-		error("derefItem: invalid item %d", item);
+	if (item >= _itemArraySize) {
+		debug(1, "derefItem: invalid item %d", item);
+		return 0;
+	}
 	return _itemArrayPtr[item];
 }
 
@@ -1762,6 +1766,22 @@
 
 void AGOSEngine::processSpecialKeys() {
 	switch (_keyPressed) {
+	case 17: // Up
+		if (getGameType() == GType_PP)
+			_verbHitArea = 302;
+		break;
+	case 18: // Down
+		if (getGameType() == GType_PP)
+			_verbHitArea = 304;
+		break;
+	case 19: // Right
+		if (getGameType() == GType_PP)
+			_verbHitArea = 303;
+		break;
+	case 20: // Left
+		if (getGameType() == GType_PP)
+			_verbHitArea = 301;
+		break;
 	case 27: // escape
 		_exitCutscene = true;
 		break;

Modified: scummvm/trunk/engines/agos/agos.h
===================================================================
--- scummvm/trunk/engines/agos/agos.h	2006-10-02 04:46:50 UTC (rev 24060)
+++ scummvm/trunk/engines/agos/agos.h	2006-10-02 05:39:27 UTC (rev 24061)
@@ -660,9 +660,9 @@
 	bool block1Supported(int i, int y);
 	void checkTiles();
 	void moveBlocks();
-	void dropBlock(int a, int b, int c);
+	void dropBlock(int id, int priority, int num);
 	void droppingBlock();
-	void stopBlock(int a, int b);
+	void stopBlock(int id, int num);
 	void remove0Block(int i);
 	void remove1Block(int i);
 	void pairCheck();
@@ -1127,7 +1127,8 @@
 
 	void startOverlayAnims();
 	void startAnOverlayAnim();
-	void startBlock(uint windowNum, uint vga_res, uint vga_sprite_id, uint x, uint y, uint palette);
+	void startBlock(uint windowNum, uint vga_res, uint vga_sprite_id, uint x, uint y, uint priority);
+	void checkIfClickedOnBlock();
 
 	bool itemIsSiblingOf(uint16 val);
 	bool itemIsParentOf(uint16 a, uint16 b);

Modified: scummvm/trunk/engines/agos/event.cpp
===================================================================
--- scummvm/trunk/engines/agos/event.cpp	2006-10-02 04:46:50 UTC (rev 24060)
+++ scummvm/trunk/engines/agos/event.cpp	2006-10-02 05:39:27 UTC (rev 24061)
@@ -331,11 +331,12 @@
 						pairCheck();
 						gravityCheck();
 					}
-					printf("CheckIfClickedOnBlock\n");
+					if (_leftButtonDown || _rightButtonDown)
+						checkIfClickedOnBlock();
 					if (getBitFlag(99)) {
 						moveBlocks();
-						droppingBlock();
 					}
+					droppingBlock();
 				}
 			} else {
 				if (_scrollCount == 0) {

Modified: scummvm/trunk/engines/agos/items.cpp
===================================================================
--- scummvm/trunk/engines/agos/items.cpp	2006-10-02 04:46:50 UTC (rev 24060)
+++ scummvm/trunk/engines/agos/items.cpp	2006-10-02 05:39:27 UTC (rev 24061)
@@ -2479,8 +2479,8 @@
 
 void AGOSEngine::o4_loadMouseImage() {
 	// 38: load mouse image
+	getNextItemPtr();
 	getVarOrByte();
-	getNextItemPtr();
 	loadMouseImage();
 }
 

Modified: scummvm/trunk/engines/agos/vga.cpp
===================================================================
--- scummvm/trunk/engines/agos/vga.cpp	2006-10-02 04:46:50 UTC (rev 24060)
+++ scummvm/trunk/engines/agos/vga.cpp	2006-10-02 05:39:27 UTC (rev 24061)
@@ -2930,9 +2930,11 @@
 void AGOSEngine::startBlock(uint windowNum, uint zoneNum, uint vgaSpriteId, uint x, uint y, uint priority) {
 	VgaSprite *vsp = _vgaSprites;
 	const byte *vcPtrOrg;
-	uint16 tmp;
+	uint16 sprite, tmp, zone;
 	uint i;
 
+	_lockWord |= 0x40;
+
 	while (vsp->id != 0)
 		vsp++;
 
@@ -2944,13 +2946,14 @@
 		_droppingBlockY = _variableArray[203];
 		_droppingBlockZ = _variableArray[204];
 		_droppingBlockLength = windowNum;
-		if (windowNum == 1) {
+		_droppingBlockType = 0;
+		if (windowNum != 1) {
+			_droppingBlockType = 1;
+			x += 15;
+			y += 10;
 			priority += 9;
-			y += 10;
-			x += 15;
 		}
 		_droppingBlockCount = 4;
-		_droppingBlockType = 4;
 	}
 
 	for (i = 0; i < windowNum; i++) {
@@ -2969,16 +2972,111 @@
 
 		tmp = to16Wrapper(priority);
 
+		sprite = _vgaCurSpriteId;
+		zone = _vgaCurZoneNum;
 		vcPtrOrg = _vcPtr;
+
 		_vcPtr = (byte *)&tmp;
 		vc23_setSpritePriority();
+
 		_vcPtr = vcPtrOrg;
+		_vgaCurSpriteId = sprite;
+		_vgaCurZoneNum = zone;
 		
 		vgaSpriteId++;
 		x += 15;
 		y += 10;
 		priority += 8;
+
+		vsp++;
 	}
+
+	_lockWord &= ~0x40;
 }
 
+void AGOSEngine::checkIfClickedOnBlock() {
+	 printf("CheckIfClickedOnBlock\n");
+
+	VgaSprite *vsp = _vgaSprites;
+	uint16 items[2];
+	uint16 image, x, y, zone, priority;
+
+	if (_droppingBlockAnim == 0) {
+		goto get_out;
+	}
+
+	_vgaCurSpriteId = _droppingBlockAnim;
+	_vgaCurZoneNum = 60;
+
+	if (_droppingBlockType == 0) {
+		if (_mouseX >= vsp->x)
+			goto get_out;
+		if (_mouseX - 75 < vsp->x)
+			goto get_out;
+		if (_mouseY >= vsp->y)
+			goto get_out;
+		if (_mouseY - 30 < vsp->y)
+			goto get_out;
+
+		if (_leftButtonDown == 0) {
+			_droppingBlockLand = 1;
+			goto get_out;
+		}
+
+		image = (vsp->image - 2) / 3 + 20;
+		zone = _droppingBlockAnim + 1024;
+		x = vsp->x + 15;
+		y = vsp->y + 10;
+		priority = vsp->priority + 9;
+
+		items[0] = to16Wrapper(60);
+		items[1] = to16Wrapper(_droppingBlockAnim);
+
+		_vcPtr = (byte *)&items;
+		vc60_killSprite();
+
+		startBlock(3, image, zone, x, y, priority);
+
+		_droppingBlockAnim = _variableArray[201];
+		_droppingBlockType = 1;
+		_droppingBlockLength = 3;
+	} else {
+		if (_mouseX >= vsp->x)
+			goto get_out;
+		if (_mouseX - 75 < vsp->x)
+			goto get_out;
+		if (_mouseY - 20 >= vsp->y)
+			goto get_out;
+		if (_mouseY + 30 < vsp->y)
+			goto get_out;
+
+		if (_leftButtonDown == 0) {
+			_droppingBlockLand = 1;
+			goto get_out;
+		}
+
+		image = (vsp->image - 20) * 3 + 2;
+		zone = _droppingBlockAnim - 1024;
+		x = vsp->x - 15;
+		y = vsp->y - 10;
+		priority = vsp->priority - 9;
+
+		items[0] = to16Wrapper(60);
+		items[1] = to16Wrapper(_droppingBlockAnim);
+
+		_vcPtr = (byte *)&items;
+		vc60_killSprite();
+
+		startBlock(1, image, zone, x, y, priority);
+
+		_droppingBlockAnim = _variableArray[201];
+		_droppingBlockType = 0;
+		_droppingBlockLength = 1;
+	}
+
+get_out:;
+	_leftButtonDown = 0;
+	_rightButtonDown = 0;
+}
+
 } // End of namespace AGOS


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