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

kirben at users.sourceforge.net kirben at users.sourceforge.net
Mon Oct 2 03:10:01 CEST 2006


Revision: 24058
          http://svn.sourceforge.net/scummvm/?rev=24058&view=rev
Author:   kirben
Date:     2006-10-01 18:09:50 -0700 (Sun, 01 Oct 2006)

Log Message:
-----------
Add more tiles code 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/rules.cpp
    scummvm/trunk/engines/agos/vga.cpp

Modified: scummvm/trunk/engines/agos/agos.cpp
===================================================================
--- scummvm/trunk/engines/agos/agos.cpp	2006-10-01 11:18:05 UTC (rev 24057)
+++ scummvm/trunk/engines/agos/agos.cpp	2006-10-02 01:09:50 UTC (rev 24058)
@@ -297,6 +297,7 @@
 	_vgaWaitFor = 0;
 	_lastVgaWaitFor = 0;
 
+	_overlayAnimationZone = 0;
 	_vgaCurZoneNum = 0;
 	_vgaCurSpriteId = 0;
 	_vgaCurSpritePriority = 0;
@@ -387,6 +388,15 @@
 	_oracleMaxScrollY = 0;
 	_noOracleScroll = 0;
 
+	_droppingBlockAnim = 0;
+	_droppingBlockLength = 0;
+	_droppingBlockCount = 0;
+	_droppingBlockLand = 0;
+	_droppingBlockType = 0;
+	_droppingBlockX = 0;
+	_droppingBlockY = 0;
+	_droppingBlockZ = 0;
+
 	_sdlMouseX = 0;
 	_sdlMouseY = 0;
 

Modified: scummvm/trunk/engines/agos/agos.h
===================================================================
--- scummvm/trunk/engines/agos/agos.h	2006-10-01 11:18:05 UTC (rev 24057)
+++ scummvm/trunk/engines/agos/agos.h	2006-10-02 01:09:50 UTC (rev 24058)
@@ -304,6 +304,15 @@
  	uint16 _oracleMaxScrollY, _noOracleScroll;
  	uint16 _interactY;
 
+	uint16 _droppingBlockAnim;
+	uint16 _droppingBlockLength;
+	uint16 _droppingBlockCount;
+	uint16 _droppingBlockLand;
+	uint16 _droppingBlockType;
+	uint16 _droppingBlockX;
+	uint16 _droppingBlockY;
+	uint16 _droppingBlockZ;
+
 	int16 _scriptVerb, _scriptNoun1, _scriptNoun2;
 	int16 _scriptAdj1, _scriptAdj2;
 
@@ -398,6 +407,7 @@
 
 	uint16 _zoneNumber;
 	uint16 _vgaWaitFor, _lastVgaWaitFor;
+	uint16 _overlayAnimationZone;
 	uint16 _vgaCurSpriteId, _vgaCurZoneNum;
 	uint16 _vgaCurSpritePriority;
 
@@ -648,11 +658,14 @@
 
 	bool block0Supported(int i, int y);
 	bool block1Supported(int i, int y);
+	void checkTiles();
+	void moveBlocks();
+	void dropBlock(int a, int b, int c);
+	void droppingBlock();
 	void stopBlock(int a, int b);
 	void remove0Block(int i);
 	void remove1Block(int i);
 	void pairCheck();
-	void dropBlock(int a, int b, int c);
 	void gravityCheck();
 	bool hasBlockLanded(int16 yofs, int16 block, int16 priority, int16 type, int16 x, int16 y, int16 z);
 
@@ -1049,7 +1062,6 @@
 	void o3_oracleTextDown();
 	void o3_oracleTextUp();
 	void o3_ifTime();
-	void o3_playTune();
 	void o3_setTime();
 	void o3_saveUserGame();
 	void o3_loadUserGame();
@@ -1113,6 +1125,9 @@
 	void checkScrollY(int16 y, int16 ypos);
 	void centreScroll();
 
+	void startOverlayAnims();
+	void startAnOverlayAnim();
+
 	bool itemIsSiblingOf(uint16 val);
 	bool itemIsParentOf(uint16 a, uint16 b);
 	bool vc_maybe_skip_proc_1(uint16 a, int16 b);

Modified: scummvm/trunk/engines/agos/event.cpp
===================================================================
--- scummvm/trunk/engines/agos/event.cpp	2006-10-01 11:18:05 UTC (rev 24057)
+++ scummvm/trunk/engines/agos/event.cpp	2006-10-02 01:09:50 UTC (rev 24058)
@@ -328,13 +328,13 @@
 				processVgaEvents();
 				if (getBitFlag(98)) {
 					if (!getBitFlag(97)) {
-						printf("PairCheck\n");
-						printf("GravityCheck\n");
+						pairCheck();
+						gravityCheck();
 					}
 					printf("CheckIfClickedOnBlock\n");
 					if (getBitFlag(99)) {
-						printf("MoveBlocks\n");
-						printf("DroppingBlock\n");
+						moveBlocks();
+						droppingBlock();
 					}
 				}
 			} else {

Modified: scummvm/trunk/engines/agos/items.cpp
===================================================================
--- scummvm/trunk/engines/agos/items.cpp	2006-10-01 11:18:05 UTC (rev 24057)
+++ scummvm/trunk/engines/agos/items.cpp	2006-10-02 01:09:50 UTC (rev 24058)
@@ -400,13 +400,14 @@
 	op[122] = &AGOSEngine::o3_oracleTextDown;
 	op[123] = &AGOSEngine::o3_oracleTextUp;
 	op[124] = &AGOSEngine::o3_ifTime;
-	op[127] = &AGOSEngine::o3_playTune;
+	op[127] = NULL;
 	op[131] = &AGOSEngine::o3_setTime;
 	op[132] = &AGOSEngine::o3_saveUserGame;
 	op[133] = &AGOSEngine::o3_loadUserGame;
 	op[134] = &AGOSEngine::o3_listSaveGames;
 	op[135] = &AGOSEngine::o3_checkCD;
 	op[161] = &AGOSEngine::o3_screenTextBox;
+	op[163] = NULL;
 	op[165] = &AGOSEngine::o3_isAdjNoun;
 	op[171] = &AGOSEngine::o3_hyperLinkOn;
 	op[172] = &AGOSEngine::o3_hyperLinkOff;
@@ -452,12 +453,13 @@
 	op[122] = &AGOSEngine::o3_oracleTextDown;
 	op[123] = &AGOSEngine::o3_oracleTextUp;
 	op[124] = &AGOSEngine::o3_ifTime;
-	op[127] = &AGOSEngine::o3_playTune;
+	op[127] = NULL;
 	op[131] = &AGOSEngine::o3_setTime;
 	op[132] = &AGOSEngine::o3_saveUserGame;
 	op[133] = &AGOSEngine::o4_loadUserGame;
 	op[134] = &AGOSEngine::o3_listSaveGames;
 	op[161] = &AGOSEngine::o3_screenTextBox;
+	op[163] = NULL;
 	op[165] = &AGOSEngine::o3_isAdjNoun;
 	op[166] = NULL;
 	op[167] = NULL;
@@ -1051,7 +1053,7 @@
 
 	if (num == _curWindow) {
 		_textWindow = _windowArray[num];
-		if (getGameType() == GType_FF)
+		if (getGameType() == GType_FF || getGameType() == GType_PP)
 			showmessage_helper_3(_textWindow->textColumn, _textWindow->width);
 		else
 			showmessage_helper_3(_textWindow->textLength, _textWindow->textMaxLength);
@@ -1480,9 +1482,6 @@
 	// 163: play sound
 	uint soundId = getVarOrWord();
 
-	if (getGameType() == GType_FF)
-		error("o_playEffect: triggered");
-
 	if (getGameId() == GID_SIMON1DOS)
 		playSting(soundId);
 	else
@@ -1568,13 +1567,12 @@
 	uint prev_i;
 	uint x_diff, y_diff;
 	uint best_i = 0, best_j = 0, best_dist = 0xFFFFFFFF;
-	uint maxPath = (getGameType() == GType_FF) ? 100 : 20;
+	uint maxPath = (getGameType() == GType_FF || getGameType() == GType_PP) ? 100 : 20;
 
-	if (getGameType() == GType_FF) {
+	if (getGameType() == GType_FF || getGameType() == GType_PP) {
 		x += _scrollX;
 		y += _scrollY;
-	}
-	if (getGameType() == GType_SIMON2) {
+	} else if (getGameType() == GType_SIMON2) {
 		x += _scrollX * 8;
 	}
 
@@ -1618,7 +1616,7 @@
 	if (getFeatures() & GF_TALKIE)
 		speechId = _longSound[stringId];
 
-	if (getGameType() == GType_FF)
+	if (getGameType() == GType_FF || getGameType() == GType_PP)
 		vgaSpriteId = 1;
 	tl = getTextLocation(vgaSpriteId);
 
@@ -2200,13 +2198,6 @@
 		setScriptCondition(false);
 }
 
-void AGOSEngine::o3_playTune() {
-	// 127: usually deals with music, but is a no-op in FF.
-	getVarOrWord();
-	getVarOrWord();
-	getVarOrByte();
-}
-
 void AGOSEngine::o3_setTime() {
 	// 131
 	time(&_timeStore);
@@ -2479,6 +2470,7 @@
 void AGOSEngine::o4_checkTiles() {
 	// 37: for MahJongg game
 	getVarOrByte();
+	checkTiles();
 }
 
 void AGOSEngine::o4_loadMouseImage() {
@@ -2642,11 +2634,10 @@
 }
 
 void AGOSEngine::scriptMouseOn() {
-	if (getGameType() == GType_FF && _mouseCursor != 5) {
+	if ((getGameType() == GType_FF || getGameType() == GType_PP) && _mouseCursor != 5) {
 		resetVerbs();
 		_noRightClick = 0;
-	}
-	if (getGameType() == GType_SIMON2 && getBitFlag(79)) {
+	} else if (getGameType() == GType_SIMON2 && getBitFlag(79)) {
 		_mouseCursor = 0;
 	}
 	_mouseHideCount = 0;

Modified: scummvm/trunk/engines/agos/rules.cpp
===================================================================
--- scummvm/trunk/engines/agos/rules.cpp	2006-10-01 11:18:05 UTC (rev 24057)
+++ scummvm/trunk/engines/agos/rules.cpp	2006-10-02 01:09:50 UTC (rev 24058)
@@ -29,6 +29,215 @@
 
 namespace AGOS {
 
+static const byte tileDefs[] = {
+	2,0,0,0,
+	3,0,0,0,
+	2,0,4,0,
+	3,0,5,0,
+	4,0,6,0,
+	5,0,7,0,
+	6,0,8,0,
+	7,0,9,0,
+	8,0,10,0,
+	9,0,11,0,
+	10,0,0,0,
+	11,0,0,0,
+	14,85,0,0,
+	15,86,0,0,
+	14,85,16,87,
+	15,86,17,88,
+	16,87,18,89,
+	17,88,19,90,
+	18,89,0,0,
+	19,90,0,0,
+	22,0,0,0,
+	23,91,0,0,
+	22,0,24,92,
+	23,91,25,93,
+	24,92,26,94,
+	25,93,27,95,
+	26,94,28,96,
+	27,95,29,0,
+	28,96,0,0,
+	29,0,0,0,
+	32,0,0,0,
+	31,0,33,0,
+	32,0,34,97,
+	33,0,35,98,
+	34,97,36,99,
+	35,98,37,100,
+	36,99,38,101,
+	37,100,39,102,
+	38,101,40,0,
+	39,102,41,0,
+	40,0,42,0,
+	41,0,0,0,
+	44,0,0,0,
+	43,0,45,0,
+	44,0,46,103,
+	45,0,47,104,
+	46,103,48,105,
+	47,104,49,106,
+	48,105,50,107,
+	49,106,51,108,
+	50,107,52,0,
+	51,108,53,0,
+	52,0,54,0,
+	53,0,0,0,
+	56,0,0,0,
+	57,109,0,0,
+	56,0,58,110,
+	57,109,59,111,
+	58,110,60,112,
+	59,111,61,113,
+	60,112,62,114,
+	61,113,63,0,
+	62,114,0,0,
+	63,0,0,0,
+	66,115,0,0,
+	67,116,0,0,
+	66,115,68,117,
+	67,116,69,118,
+	68,117,70,119,
+	69,118,71,120,
+	70,119,0,0,
+	71,120,0,0,
+	74,0,0,0,
+	75,0,0,0,	
+	74,0,76,0,
+	75,0,77,0,
+	76,0,78,0,
+	77,0,79,0,
+	78,0,80,0,
+	79,0,81,0,
+	80,0,82,0,
+	81,0,83,0,
+	82,0,0,0,
+	83,0,0,0,
+	86,0,0,0,
+	87,0,0,0,
+	86,0,88,0,
+	87,0,89,0,
+	88,0,0,0,
+	89,0,0,0,	
+	92,121,0,0,
+	93,122,0,0,
+	92,121,94,123,
+	93,122,95,124,
+	94,123,0,0,
+	95,124,0,0,
+	98,125,0,0,
+	99,126,0,0,
+	98,125,100,127,
+	99,126,101,128,
+	100,127,0,0,
+	101,128,0,0,
+	104,129,0,0,
+	105,130,0,0,
+	104,129,106,131,
+	105,130,107,132,
+	106,131,0,0,
+	107,132,0,0,
+	110,133,0,0,
+	111,134,0,0,
+	110,133,112,135,
+	111,134,113,136,
+	112,135,0,0,
+	113,136,0,0,
+	116,0,0,0,
+	117,0,0,0,
+	116,0,118,0,
+	117,0,119,0,
+	118,0,0,0,
+	119,0,0,0,
+	122,0,0,0,
+	123,0,0,0,			
+	122,0,0,0,	
+	123,0,0,0,
+	126,137,0,0,
+	127,138,0,0,
+	126,137,0,0,
+	127,138,0,0,
+	130,139,0,0,
+	131,140,0,0,
+	130,139,0,0,
+	131,140,0,0,
+	134,0,0,0,
+	135,0,0,0,
+	134,0,0,0,
+	135,0,0,0,
+	0,0,0,0,
+	0,0,0,0,
+	0,0,0,0,
+	0,0,0,0,
+	0,0,0,0,	
+	31,0,43,0,
+	42,0,54,0,
+	143,0,0,0,
+};
+
+static const byte tileDefs1[] = {
+	14,13,14,15,0,0,0,0,
+	15,14,15,16,0,0,0,0,
+	16,15,16,17,0,0,0,0,
+	17,16,17,18,0,0,0,0,
+	18,17,18,19,0,0,0,0,
+	19,18,19,20,0,0,0,0,
+	23,22,23,24,0,0,0,0,
+	24,23,24,25,0,0,0,0,
+	25,24,25,26,0,0,0,0,
+	26,25,26,27,0,0,0,0,
+	27,26,27,28,0,0,0,0,
+	28,27,28,29,0,0,0,0,
+	34,33,34,35,0,0,0,0,
+	35,34,35,36,0,0,0,0,
+	36,35,36,37,0,0,0,0,
+	37,36,37,38,0,0,0,0,
+	38,37,38,39,0,0,0,0,
+	39,38,39,40,0,0,0,0,
+	46,45,46,47,0,0,0,0,
+	47,46,47,48,0,0,0,0,
+	48,47,48,49,0,0,0,0,
+	49,48,49,50,0,0,0,0,
+	50,49,50,51,0,0,0,0,
+	51,50,51,52,0,0,0,0,
+	57,56,57,58,0,0,0,0,
+	58,57,58,59,0,0,0,0,
+	59,58,59,60,0,0,0,0,
+	60,59,60,61,0,0,0,0,
+	61,60,61,62,0,0,0,0,
+	62,61,62,63,0,0,0,0,
+	66,65,66,67,0,0,0,0,
+	67,66,67,68,0,0,0,0,
+	68,67,68,69,0,0,0,0,
+	69,68,69,70,0,0,0,0,
+	70,69,70,71,0,0,0,0,
+	71,70,71,72,0,0,0,0,
+	92,91,92,93,0,0,0,0,
+	93,92,93,94,0,0,0,0,
+	94,93,94,95,0,0,0,0,
+	95,94,95,96,0,0,0,0,
+	98,97,98,99,0,0,0,0,
+	99,98,99,100,0,0,0,0,
+	100,99,100,101,0,0,0,0,
+	101,100,101,102,0,0,0,0,
+	104,103,104,105,0,0,0,0,
+	105,104,105,106,0,0,0,0,
+	106,105,106,107,0,0,0,0,
+	107,106,107,108,0,0,0,0,
+	110,109,110,111,0,0,0,0,
+	111,110,111,112,0,0,0,0,
+	112,111,112,113,0,0,0,0,
+	113,112,113,114,0,0,0,0,
+	126,125,126,127,0,0,0,0,
+	127,126,127,128,0,0,0,0,
+	130,129,130,131,0,0,0,0,
+	131,130,131,132,0,0,0,0,
+	137,0,138,0,139,0,140,0,
+	0,0,0,0,0,0,0,0,
+	0,0,0,0,0,0,0,0,
+};
+
 bool AGOSEngine::block0Supported(int i, int y) {
 	if (y == 0) {
 		// Always supported at bottom level
@@ -52,8 +261,7 @@
 	}
 }
 
-bool AGOSEngine::block1Supported(int i, int y)
-{
+bool AGOSEngine::block1Supported(int i, int y) {
 	if (y == 0) {
 		// Always supported at bottom level
 		return true;
@@ -76,11 +284,163 @@
 	}
 }
 
-void AGOSEngine::stopBlock(int a, int b) {
+void AGOSEngine::checkTiles() {
+	const byte *tile;
+	uint i, slot;
+
+	slot = _variableArray[400] - 1;
+
+	tile = &tileDefs[slot * 4 + 1];
+	for (i = 0; i < 2; i++) {
+		if (tile[1] != 0 && findBox(tile[1]) != 0)
+			continue;
+		if (tile[0] != 0)
+			enableBox(tile[0]);
+		tile += 2;
+	}
+
+	tile = &tileDefs1[slot * 8 + 1];
+	for (i = 0; i < 4; i++) {
+		if (tile[1] != 0 && findBox(tile[1]) != 0)
+			continue;
+		if (tile[0] != 0)
+			enableBox(tile[0]);
+		tile += 2;
+	}
 }
 
-void AGOSEngine::remove0Block(int i)
-{
+void AGOSEngine::moveBlocks() {
+	printf("moveBlocks\n");
+
+	VgaSprite *vsp;
+	const byte *vcPtrOrg;
+	uint16 tmp;
+	uint num, i;
+
+	num = _variableArray[414] + 1;
+
+	for (i = 0; i < num; i++) {
+		_vgaCurSpriteId = _variableArray[410];
+		_vgaCurZoneNum = 60;
+
+		vsp = findCurSprite();
+		vsp->x += _variableArray[411];
+		vsp->y += _variableArray[412];
+
+		tmp = to16Wrapper(_variableArray[413]);
+
+		vcPtrOrg = _vcPtr;
+		_vcPtr = (byte *)&tmp;
+		vc23_setSpritePriority();
+		_vcPtr = vcPtrOrg;
+		
+		_variableArray[410] += 1;
+		_variableArray[413] -= 8;
+	}
+
+	setBitFlag(99, false);
+	_marks |= (1 << 1);
+}
+
+void AGOSEngine::dropBlock(int id, int priority, int num) {
+	VgaSprite *vsp;
+	const byte *vcPtrOrg;
+	uint16 tmp;
+	int i;
+
+	for (i = 0; i < num; i++) {
+		_vgaCurSpriteId = id;
+		_vgaCurZoneNum = 60;
+
+		vsp = findCurSprite();
+		vsp->y += 20;
+
+		tmp = to16Wrapper(priority);
+
+		vcPtrOrg = _vcPtr;
+		_vcPtr = (byte *)&tmp;
+		vc23_setSpritePriority();
+		_vcPtr = vcPtrOrg;
+		
+		id += 1;
+		priority -= 8;
+	}
+}
+
+void AGOSEngine::droppingBlock() {
+	if (_droppingBlockAnim == 0)
+		return;
+
+	printf("droppingBlock\n");
+
+	VgaSprite *vsp;
+	const byte *vcPtrOrg;
+	uint i, result, speed;
+	uint16 tmp;
+
+	speed = (getBitFlag(82) != 0) ? 10 : 5;
+	for (i = 0; i < _droppingBlockLength; i++) {
+		_vgaCurSpriteId = _droppingBlockAnim + i;
+		_vgaCurZoneNum = 60;
+		vsp = findCurSprite();
+		vsp->y += speed;
+	}
+
+	_vgaCurSpriteId = _droppingBlockAnim;
+	_vgaCurZoneNum = 60;
+	vsp = findCurSprite();
+
+	result = _droppingBlockCount - 1;
+	if (result  == 0 || (speed == 10 && result == 2)) {
+		result = hasBlockLanded(vsp->y, _droppingBlockAnim, vsp->priority, _droppingBlockType, _droppingBlockX, _droppingBlockY, _droppingBlockZ);
+		result += 4;
+		if (result == 0) {
+			_droppingBlockAnim = 0;
+			_droppingBlockLand = 0;
+			setBitFlag(94, 0);
+		}
+	}
+
+	_droppingBlockCount = result;
+	if (result == 3) {
+		for (i = 0; i < _droppingBlockLength; i++) {
+			vsp = findCurSprite();
+
+			tmp = to16Wrapper(vsp->priority - 64);
+
+			vcPtrOrg = _vcPtr;
+			_vcPtr = (byte *)&tmp;
+			vc23_setSpritePriority();
+			_vcPtr = vcPtrOrg;
+	
+			_vgaCurSpriteId += 1;
+		}
+	}
+
+	if (_droppingBlockLand == 0) {
+		droppingBlock();
+	}
+}
+
+
+void AGOSEngine::stopBlock(int id, int num) {
+	const byte *vcPtrOrg;
+	uint16 i, items[2];
+
+	for (i = 0; i < num; i++) {
+		items[0] = to16Wrapper(60);
+		items[1] = to16Wrapper(id);
+
+		vcPtrOrg = _vcPtr;
+		_vcPtr = (byte *)&items;
+		vc60_killSprite();
+		_vcPtr = vcPtrOrg;
+
+		id++;
+	}
+}
+
+void AGOSEngine::remove0Block(int i) {
 	int a = _variableArray[i];
 	if(a == 0)
 		return;
@@ -93,8 +453,7 @@
 	_variableArray[a]--;
 }
 
-void AGOSEngine::remove1Block(int i)
-{
+void AGOSEngine::remove1Block(int i) {
 	int a = _variableArray[i];
 	int b = -1;
 	if (a == 0)
@@ -112,8 +471,9 @@
 	_variableArray[a]--;
 }
 
-void AGOSEngine::pairCheck()
-{
+void AGOSEngine::pairCheck() {
+	printf("pairCheck\n");
+
 	int i, j, j1, k;
 	int x, y, z;
 	int flag;
@@ -125,7 +485,6 @@
 	j = 0;
 
 	// For each level
-
 	for (y = 0; y < 16; y++) {
 		// Check Type 0 blocks - blocks totally covered by others
 		// further away along Z axis
@@ -331,11 +690,9 @@
 	}
 }
 
-void AGOSEngine::dropBlock(int a, int b, int c) {
-}
+void AGOSEngine::gravityCheck() {
+	printf("GravityCheck\n");
 
-void AGOSEngine::gravityCheck()
-{
 	int i, k;
 	int x, y, z;
 	int flag;
@@ -419,8 +776,7 @@
 	}
 }
 
-bool AGOSEngine::hasBlockLanded(int16 yofs, int16 block, int16 priority, int16 type, int16 x, int16 y, int16 z)
-{
+bool AGOSEngine::hasBlockLanded(int16 yofs, int16 block, int16 priority, int16 type, int16 x, int16 y, int16 z) {
 	if (type == 1) {
 		x++;
 		z--;

Modified: scummvm/trunk/engines/agos/vga.cpp
===================================================================
--- scummvm/trunk/engines/agos/vga.cpp	2006-10-01 11:18:05 UTC (rev 24057)
+++ scummvm/trunk/engines/agos/vga.cpp	2006-10-02 01:09:50 UTC (rev 24058)
@@ -418,6 +418,11 @@
 	byte *p, *pp;
 	byte *old_file_1;
 
+	if (getGameType() == GType_PP && getBitFlag(100)) {
+		startAnOverlayAnim();
+		return;
+	}
+
 	windowNum = vcReadNextWord();		/* 0 */
 
 	if (getGameType() == GType_SIMON2 || getGameType() == GType_FF || getGameType() == GType_PP) {
@@ -432,10 +437,6 @@
 	y = vcReadNextWord();			/* 6 */
 	palette = vcReadNextWord();		/* 8 */
 
-	if (getGameType() == GType_PP && getBitFlag(100)) {
-		printf("StartAnOverlayAnim\n");
-	}
-
 	if (isSpriteLoaded(vgaSpriteId, zoneNum))
 		return;
 
@@ -2419,7 +2420,7 @@
 	if (getGameType() == GType_PP) {
 		_fastFadeInFlag = 256;
 		if (getBitFlag(100)) {
-			printf("StartOverlayAnims\n");
+			startOverlayAnims();
 		} else if (getBitFlag(103)) {
 			printf("NameAndTime\n");
 		} else if (getBitFlag(104)) {
@@ -2845,4 +2846,85 @@
 	}
 }
 
+void AGOSEngine::startOverlayAnims() {
+	printf("StartOverlayAnims\n");
+
+	VgaSprite *vsp = _vgaSprites;
+	int i;
+
+	_overlayAnimationZone = _variableArray[999];
+	
+	for (i = 0; i < 600; i++) {
+		if (_variableArray[1000 + i] < 100)
+			continue;
+
+		while (vsp->id)
+			vsp++;
+
+		vsp->windowNum = 4;
+		vsp->priority = 4;
+		vsp->flags = 0;
+		vsp->palette = 0;
+		vsp->image = _variableArray[i];
+		if (i >= 300)
+			vsp->x = (i - 300) / 20 * 32;
+		else
+			vsp->x = i / 20 * 32;
+		vsp->y = 0;
+		vsp->id = 1000 + i;
+		vsp->zoneNum = _overlayAnimationZone;
+	}
+}
+
+void AGOSEngine::startAnOverlayAnim() {
+	printf("StartAnOverlayAnim\n");
+
+	VgaSprite *vsp = _vgaSprites;
+	const byte *vcPtrOrg;
+	uint16 a, sprite, file, tmp;
+	int16 x;
+
+	_overlayAnimationZone = _variableArray[999];
+
+	_vcPtr += 4;
+	a = vcReadNextWord();
+	_vcPtr += 4;
+
+	while (vsp->id)
+		vsp++;
+
+	vsp->windowNum = 4;
+	vsp->priority = 20;
+	vsp->flags = 0;
+	vsp->palette = 0;
+	vsp->image = vcReadVar(vcReadVar(a));
+
+	x = vcReadVar(a) - 1300;
+	if (x < 0) {
+		x += 300;
+		vsp->priority = 10;
+	}
+
+	vsp->x = x / 20 * 32;
+	vsp->y = 0;
+	vsp->id = vcReadVar(a);
+	vsp->zoneNum = _overlayAnimationZone;
+
+	sprite = _vgaCurSpriteId;
+	file = _vgaCurZoneNum;
+
+	_vgaCurZoneNum = vsp->zoneNum;
+	_vgaCurSpriteId = vsp->id;
+
+	tmp = to16Wrapper(vsp->priority);
+
+	vcPtrOrg = _vcPtr;
+	_vcPtr = (byte *)&tmp;
+	vc23_setSpritePriority();
+
+	_vcPtr = vcPtrOrg;
+	_vgaCurSpriteId = sprite;
+	_vgaCurZoneNum = file;
+}
+
 } // 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