diff options
| -rw-r--r-- | engines/agos/agos.cpp | 24 | ||||
| -rw-r--r-- | engines/agos/agos.h | 7 | ||||
| -rw-r--r-- | engines/agos/event.cpp | 5 | ||||
| -rw-r--r-- | engines/agos/items.cpp | 2 | ||||
| -rw-r--r-- | engines/agos/vga.cpp | 108 | 
5 files changed, 133 insertions, 13 deletions
diff --git a/engines/agos/agos.cpp b/engines/agos/agos.cpp index 323ecf1c80..d86b7e9a48 100644 --- a/engines/agos/agos.cpp +++ b/engines/agos/agos.cpp @@ -1201,6 +1201,8 @@ startOver:  			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 @@ void AGOSEngine::skipSpeech() {  }  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 @@ bool AGOSEngine::isSpriteLoaded(uint16 id, uint16 zoneNum) {  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; diff --git a/engines/agos/agos.h b/engines/agos/agos.h index 1f11c69690..8e51c1615d 100644 --- a/engines/agos/agos.h +++ b/engines/agos/agos.h @@ -660,9 +660,9 @@ protected:  	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 @@ protected:  	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); diff --git a/engines/agos/event.cpp b/engines/agos/event.cpp index f0e949b645..fccecd7162 100644 --- a/engines/agos/event.cpp +++ b/engines/agos/event.cpp @@ -331,11 +331,12 @@ void AGOSEngine::timer_proc1() {  						pairCheck();  						gravityCheck();  					} -					printf("CheckIfClickedOnBlock\n"); +					if (_leftButtonDown || _rightButtonDown) +						checkIfClickedOnBlock();  					if (getBitFlag(99)) {  						moveBlocks(); -						droppingBlock();  					} +					droppingBlock();  				}  			} else {  				if (_scrollCount == 0) { diff --git a/engines/agos/items.cpp b/engines/agos/items.cpp index 5953abd45e..356b552c22 100644 --- a/engines/agos/items.cpp +++ b/engines/agos/items.cpp @@ -2479,8 +2479,8 @@ void AGOSEngine::o4_checkTiles() {  void AGOSEngine::o4_loadMouseImage() {  	// 38: load mouse image -	getVarOrByte();  	getNextItemPtr(); +	getVarOrByte();  	loadMouseImage();  } diff --git a/engines/agos/vga.cpp b/engines/agos/vga.cpp index 83846ef556..1ecd4fd6c1 100644 --- a/engines/agos/vga.cpp +++ b/engines/agos/vga.cpp @@ -2930,9 +2930,11 @@ void AGOSEngine::startAnOverlayAnim() {  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 @@ void AGOSEngine::startBlock(uint windowNum, uint zoneNum, uint vgaSpriteId, uint  		_droppingBlockY = _variableArray[203];  		_droppingBlockZ = _variableArray[204];  		_droppingBlockLength = windowNum; -		if (windowNum == 1) { -			priority += 9; -			y += 10; +		_droppingBlockType = 0; +		if (windowNum != 1) { +			_droppingBlockType = 1;  			x += 15; +			y += 10; +			priority += 9;  		}  		_droppingBlockCount = 4; -		_droppingBlockType = 4;  	}  	for (i = 0; i < windowNum; i++) { @@ -2969,16 +2972,111 @@ void AGOSEngine::startBlock(uint windowNum, uint zoneNum, uint vgaSpriteId, uint  		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  | 
