[Scummvm-cvs-logs] CVS: scummvm/kyra gui.cpp,1.3,1.4 kyra.cpp,1.119,1.120 kyra.h,1.67,1.68 screen.cpp,1.37,1.38 screen.h,1.23,1.24 script_v1.cpp,1.65,1.66 sprites.cpp,1.22,1.23 staticres.cpp,1.38,1.39

Oystein Eftevaag vinterstum at users.sourceforge.net
Thu Jan 12 19:28:03 CET 2006


Update of /cvsroot/scummvm/scummvm/kyra
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv7938

Modified Files:
	gui.cpp kyra.cpp kyra.h screen.cpp screen.h script_v1.cpp 
	sprites.cpp staticres.cpp 
Log Message:
Implemented a few drawing functions used by the menu, corrected a few incorrect
opcode debug messages, and blocked unnecessary sprite anim script looping.


Index: gui.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/kyra/gui.cpp,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -d -r1.3 -r1.4
--- gui.cpp	12 Jan 2006 13:16:42 -0000	1.3
+++ gui.cpp	13 Jan 2006 03:27:01 -0000	1.4
@@ -289,5 +289,11 @@
 		(this->*callback)(button);
 	}
 }
+
+int KyraEngine::buttonMenuCallback(Button *caller) {
+	warning("Menu not implemented yet!");
+	return 0;
+}
+
 } // end of namespace Kyra
  

Index: kyra.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/kyra/kyra.cpp,v
retrieving revision 1.119
retrieving revision 1.120
diff -u -d -r1.119 -r1.120
--- kyra.cpp	12 Jan 2006 15:38:04 -0000	1.119
+++ kyra.cpp	13 Jan 2006 03:27:01 -0000	1.120
@@ -5546,6 +5546,7 @@
 	uint32 nextFrame = 0;
 	_abortWalkFlag = false;
 	_mousePressFlag = false;
+
 	while (running) {
 		if (_abortWalkFlag) {
 			*table = 8;

Index: kyra.h
===================================================================
RCS file: /cvsroot/scummvm/scummvm/kyra/kyra.h,v
retrieving revision 1.67
retrieving revision 1.68
diff -u -d -r1.67 -r1.68
--- kyra.h	12 Jan 2006 14:53:23 -0000	1.67
+++ kyra.h	13 Jan 2006 03:27:01 -0000	1.68
@@ -597,6 +597,8 @@
 	
 	int buttonInventoryCallback(Button *caller);
 	int buttonAmuletCallback(Button *caller);
+	int buttonMenuCallback(Button *caller);
+
 	Button *initButton(Button *list, Button *newButton);
 	void processButtonList(Button *list);
 	void processButton(Button *button);

Index: screen.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/kyra/screen.cpp,v
retrieving revision 1.37
retrieving revision 1.38
diff -u -d -r1.37 -r1.38
--- screen.cpp	11 Jan 2006 13:28:36 -0000	1.37
+++ screen.cpp	13 Jan 2006 03:27:01 -0000	1.38
@@ -435,6 +435,79 @@
 	}
 }
 
+void Screen::drawBox(int x1, int y1, int x2, int y2, int color1, int color2) {
+	debug(9, "Screen::drawBox(%i, %i, %i, %i, %i, %i)", x1, y1, x2, y2, color1, color2);
+
+	//if (_menuUnk1 == 0)
+		//return;
+
+	hideMouse();
+
+	fillRect(x1, y1, x2, y1 + 1, color1);
+	fillRect(x2 - 1, y1, x2, y2, color1);
+
+	drawClippedLine(x1, y1, x1, y2, color2);
+	drawClippedLine(x1 + 1, y1 + 1, x1 + 1, y2 - 1, color2);
+	drawClippedLine(x1, y2, x2, y2, color2);
+	drawClippedLine(x1, y2 - 1, x2 - 1, y2 - 1, color2);
+
+	showMouse();
+}
+
+void Screen::drawClippedLine(int x1, int y1, int x2, int y2, int color) {
+	debug(9, "Screen::drawClippedLine(%i, %i, %i, %i, %i)", x1, y1, x2, y2, color);
+
+	if (x1 < 0)
+		x1 = 0;
+	else if (x1 > 319)
+		x1 = 319;
+
+	if (x2 < 0)
+		x2 = 0;
+	else if (x2 > 319)
+		x2 = 319;
+
+	if (y1 < 0)
+		y1 = 0;
+	else if (y1 > 199)
+		y1 = 199;
+
+	if (y2 < 0)
+		y2 = 0;
+	else if (y2 > 199)
+		y2 = 199;
+
+	if (x1 == x2)
+		if (y1 > y2)
+			drawLine(true, x1, y2, y1 - y2 + 1, color);
+		else
+			drawLine(true, x1, y1, y2 - y1 + 1, color);
+	else
+		if (x1 > x2)
+			drawLine(false, x2, y1, x1 - x2 + 1, color);
+		else
+			drawLine(false, x1, y1, x2 - x1 + 1, color);
+}
+
+void Screen::drawLine(bool horizontal, int x, int y, int length, int color) {
+	debug(9, "Screen::drawLine(%i, %i, %i, %i, %i)", horizontal, x, y, length, color);
+
+	uint8 *ptr = getPagePtr(_curPage) + y * SCREEN_W + x;
+
+	if (horizontal) {
+		assert((y + length) <= SCREEN_H);
+		int currLine = 0;
+		while (currLine < length) {
+			*ptr = color;
+			ptr += SCREEN_W;
+			currLine++;
+		}
+	} else {
+		assert((x + length) <= SCREEN_W);
+		memset(ptr, color, length);
+	}
+}
+
 void Screen::setAnimBlockPtr(int size) {
 	debug(9, "Screen::setAnimBlockPtr(%d)", size);
 	free(_animBlockPtr);

Index: screen.h
===================================================================
RCS file: /cvsroot/scummvm/scummvm/kyra/screen.h,v
retrieving revision 1.23
retrieving revision 1.24
diff -u -d -r1.23 -r1.24
--- screen.h	10 Jan 2006 02:43:30 -0000	1.23
+++ screen.h	13 Jan 2006 03:27:01 -0000	1.24
@@ -107,6 +107,9 @@
 	void copyCurPageBlock(int x, int y, int w, int h, uint8 *dst);
 	void shuffleScreen(int sx, int sy, int w, int h, int srcPage, int dstPage, int ticks, bool transparent);
 	void fillRect(int x1, int y1, int x2, int y2, uint8 color, int pageNum = -1);
+	void drawLine(bool horizontal, int x, int y, int length, int color);
+	void drawClippedLine(int x1, int y1, int x2, int y2, int color);
+	void drawBox(int x1, int y1, int x2, int y2, int color1, int color2);
 	void setAnimBlockPtr(int size);
 	void setTextColorMap(const uint8 *cmap);
 	void setTextColor(const uint8 *cmap, int a, int b);

Index: script_v1.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/kyra/script_v1.cpp,v
retrieving revision 1.65
retrieving revision 1.66
diff -u -d -r1.65 -r1.66
--- script_v1.cpp	12 Jan 2006 13:16:42 -0000	1.65
+++ script_v1.cpp	13 Jan 2006 03:27:01 -0000	1.66
@@ -1215,7 +1215,7 @@
 }
 
 int KyraEngine::cmd_setDeathHandlerFlag(ScriptState *script) {
-	debug(3, "cmd_drinkPotionAnimation(0x%X) (%d)", script, stackPos(0));
+	debug(3, "cmd_setDeathHandlerFlag(0x%X) (%d)", script, stackPos(0));
 	_deathHandler = stackPos(0);
 	return 0;
 }
@@ -1375,7 +1375,7 @@
 }
 
 int KyraEngine::cmd_poisonBrandonAndRemaps(ScriptState *script) {
-	debug(3, "cmd_setSceneAnimCurrXY(0x%X) ()", script);
+	debug(3, "cmd_poisonBrandonAndRemaps(0x%X) ()", script);
 	setBrandonPoisonFlags(1);
 	return 0;
 }
@@ -1440,7 +1440,7 @@
 }
 
 int KyraEngine::cmd_restoreBrandonsMovementDelay(ScriptState *script) {
-	debug(3, "cmd_restoreBrandonsMovemenyDelay(0x%X) ()", script);
+	debug(3, "cmd_restoreBrandonsMovementDelay(0x%X) ()", script);
 	//TODO: Use movement set by menu, instead of 5.
 	setTimerDelay(5, 5);
 	return 0;

Index: sprites.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/kyra/sprites.cpp,v
retrieving revision 1.22
retrieving revision 1.23
diff -u -d -r1.22 -r1.23
--- sprites.cpp	12 Jan 2006 13:16:42 -0000	1.22
+++ sprites.cpp	13 Jan 2006 03:27:01 -0000	1.23
@@ -136,6 +136,8 @@
 
 		if (_anims[i].reentry == 0) {
 			data = _anims[i].script;
+			if (READ_LE_UINT16(data) == 0xFF8B)
+				continue;
 		} else {
 			data = _anims[i].reentry;
 			_anims[i].reentry = 0;

Index: staticres.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/kyra/staticres.cpp,v
retrieving revision 1.38
retrieving revision 1.39
diff -u -d -r1.38 -r1.39
--- staticres.cpp	12 Jan 2006 13:16:42 -0000	1.38
+++ staticres.cpp	13 Jan 2006 03:27:01 -0000	1.39
@@ -714,7 +714,7 @@
 
 Button KyraEngine::_buttonData[] = {
 	{ 0, 0x02, /*XXX,*/0, 0, 0, /*XXX,*/ 0x0400, 0, 0, 0, 0, 0, 0, 0, 0x05D, 0x9E, 0x13, 0x14, /*XXX,*/ 0, &KyraEngine::buttonInventoryCallback/*, XXX*/ },
-	{ 0, 0x01, /*XXX,*/1, 1, 1, /*XXX,*/ 0x0487, 0, 0, 0, 0, 0, 0, 0, 0x009, 0xA4, 0x36, 0x1E, /*XXX,*/ 0, 0/*opt_handleMenu, XXX*/ },
+	{ 0, 0x01, /*XXX,*/1, 1, 1, /*XXX,*/ 0x0487, 0, 0, 0, 0, 0, 0, 0, 0x009, 0xA4, 0x36, 0x1E, /*XXX,*/ 0, &KyraEngine::buttonMenuCallback/*, XXX*/ },
 	{ 0, 0x03, /*XXX,*/0, 0, 0, /*XXX,*/ 0x0400, 0, 0, 0, 0, 0, 0, 0, 0x071, 0x9E, 0x13, 0x14, /*XXX,*/ 0, &KyraEngine::buttonInventoryCallback/*, XXX*/ },
 	{ 0, 0x04, /*XXX,*/0, 0, 0, /*XXX,*/ 0x0400, 0, 0, 0, 0, 0, 0, 0, 0x085, 0x9E, 0x13, 0x14, /*XXX,*/ 0, &KyraEngine::buttonInventoryCallback/*, XXX*/ },
 	{ 0, 0x05, /*XXX,*/0, 0, 0, /*XXX,*/ 0x0400, 0, 0, 0, 0, 0, 0, 0, 0x099, 0x9E, 0x13, 0x14, /*XXX,*/ 0, &KyraEngine::buttonInventoryCallback/*, XXX*/ },





More information about the Scummvm-git-logs mailing list