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

kirben at users.sourceforge.net kirben at users.sourceforge.net
Sun Oct 8 03:46:46 CEST 2006


Revision: 24188
          http://svn.sourceforge.net/scummvm/?rev=24188&view=rev
Author:   kirben
Date:     2006-10-07 18:46:38 -0700 (Sat, 07 Oct 2006)

Log Message:
-----------
Add code for displaying stastics in Elvira 1

Modified Paths:
--------------
    scummvm/trunk/engines/agos/agos.cpp
    scummvm/trunk/engines/agos/agos.h
    scummvm/trunk/engines/agos/debug.h
    scummvm/trunk/engines/agos/items.cpp
    scummvm/trunk/engines/agos/string.cpp

Modified: scummvm/trunk/engines/agos/agos.cpp
===================================================================
--- scummvm/trunk/engines/agos/agos.cpp	2006-10-08 01:05:10 UTC (rev 24187)
+++ scummvm/trunk/engines/agos/agos.cpp	2006-10-08 01:46:38 UTC (rev 24188)
@@ -378,6 +378,7 @@
 
 	memset(_videoBuf1, 0, sizeof(_videoBuf1));
 
+	_dummyWindow = new WindowBlock;
 	_windowList = new WindowBlock[16];
 
 	memset(_lettersToPrintBuf, 0, sizeof(_lettersToPrintBuf));
@@ -724,6 +725,7 @@
 	delete _dummyItem2;
 	delete _dummyItem3;
 
+	delete [] _dummyWindow;
 	delete [] _windowList;
 
 	delete _debugger;

Modified: scummvm/trunk/engines/agos/agos.h
===================================================================
--- scummvm/trunk/engines/agos/agos.h	2006-10-08 01:05:10 UTC (rev 24187)
+++ scummvm/trunk/engines/agos/agos.h	2006-10-08 01:46:38 UTC (rev 24188)
@@ -439,6 +439,7 @@
 	int16 *_variableArray2;
 	int16 *_variableArrayPtr;
 
+	WindowBlock *_dummyWindow;
 	WindowBlock *_windowArray[8];
 
 	byte _fcsData1[8];
@@ -773,6 +774,13 @@
 	uint16 getBoxSize();
 	uint16 checkFit(char *Ptr, int width, int lines);
 
+	void printMonsterDamage();
+	void printPlayerDamage();
+	void printMonsterHit();
+	void printPlayerHit();
+	void printStats();
+	void writeChar(WindowBlock *window, int x, int y, int offs, int val);
+
 	byte *allocBlock(uint32 size);
 	void checkNoOverWrite();
 	void checkRunningAnims();
@@ -1062,11 +1070,16 @@
 	void oe1_findMaster();
 	void oe1_nextMaster();
 	void oe1_setTime();
+	void oe1_ifTime();
 	void oe1_bitClear();
 	void oe1_bitSet();
 	void oe1_bitTest();
 	void oe1_zoneDisk();
 	void oe1_printStats();
+	void oe1_printPlayerDamage();
+	void oe1_printMonsterDamage();
+	void oe1_printPlayerHit();
+	void oe1_printMonsterHit();
 	void oe1_setStore();
 
 	// Opcodes, Elvira 2 only

Modified: scummvm/trunk/engines/agos/debug.h
===================================================================
--- scummvm/trunk/engines/agos/debug.h	2006-10-08 01:05:10 UTC (rev 24187)
+++ scummvm/trunk/engines/agos/debug.h	2006-10-08 01:46:38 UTC (rev 24188)
@@ -353,7 +353,7 @@
 	NULL,
 	"|SET_TIME",
 	/* 260 */
-	NULL,
+	"WJ|IF_TIME",
 	"IJ|IS_SIBLING_WITH_A",
 	"IWW|DO_CLASS_ICONS",
 	"WW|PLAY_TUNE",
@@ -368,14 +368,14 @@
 	"|PRINT_STATS",
 	"|STOP_TUNE",
 	/* 272 */
-	NULL,
-	NULL,
+	"|PRINT_PLAYER_DAMAGE",
+	"|PRINT_MONSTER_DAMAGE",
 	"|PAUSE",
 	"IW|COPY_SF",
 	/* 276 */
 	"W|RESTORE_ICONS",
-	NULL,
-	NULL,
+	"|PRINT_PLAYER_HIT",
+	"|PRINT_MONSTER_HIT",
 	"|FREEZE_ZONES",
 	/* 280 */
 	"II|SET_PARENT_SPECIAL",

Modified: scummvm/trunk/engines/agos/items.cpp
===================================================================
--- scummvm/trunk/engines/agos/items.cpp	2006-10-08 01:05:10 UTC (rev 24187)
+++ scummvm/trunk/engines/agos/items.cpp	2006-10-08 01:46:38 UTC (rev 24188)
@@ -306,12 +306,12 @@
 	op[252] = &AGOSEngine::oe1_bitSet;
 	op[253] = &AGOSEngine::oe1_bitTest;
 
-	op[259] = &AGOSEngine::oe1_setTime;
-
 	op[255] = &AGOSEngine::o_waitSync;
 	op[256] = &AGOSEngine::o_sync;
 	op[257] = &AGOSEngine::o_defObj;
 
+	op[259] = &AGOSEngine::oe1_setTime;
+	op[260] = &AGOSEngine::oe1_ifTime;
 	op[261] = &AGOSEngine::o_here;
 	op[262] = &AGOSEngine::o_doClassIcons;
 	op[263] = &AGOSEngine::o1_playTune;
@@ -323,15 +323,17 @@
 	op[269] = &AGOSEngine::o_loadUserGame;
 	op[270] = &AGOSEngine::oe1_printStats;
 	op[271] = &AGOSEngine::o_stopTune;
-
+	op[272] = &AGOSEngine::oe1_printPlayerDamage;
+	op[273] = &AGOSEngine::oe1_printMonsterDamage;
 	op[274] = &AGOSEngine::o_pauseGame;
 	op[275] = &AGOSEngine::o_copysf;
 	op[276] = &AGOSEngine::o_restoreIcons;
-
+	op[277] = &AGOSEngine::oe1_printPlayerHit;
+	op[278] = &AGOSEngine::oe1_printMonsterHit;
 	op[279] = &AGOSEngine::o_freezeZones;
 	op[280] = &AGOSEngine::o_placeNoIcons;
 	op[281] = &AGOSEngine::o_clearTimers;
-
+	op[282] = &AGOSEngine::oe1_setStore;
 	op[283] = &AGOSEngine::o_isBox;
 }
 
@@ -2025,6 +2027,19 @@
 	time(&_timeStore);
 }
 
+void AGOSEngine::oe1_ifTime() {
+	// 260: if time
+	time_t t;
+
+	uint a = getVarOrWord();
+	time(&t);
+	t -= a;
+	if (t >= _timeStore)
+		setScriptCondition(true);
+	else
+		setScriptCondition(false);
+}
+
 void AGOSEngine::oe1_zoneDisk() {
 	// 267: set disk number of each zone
 	getVarOrWord();
@@ -2033,8 +2048,29 @@
 
 void AGOSEngine::oe1_printStats() {
 	// 270: print stats
+	printStats();
 }
 
+void AGOSEngine::oe1_printPlayerDamage() {
+	// 272: print player damage
+	printStats();
+}
+
+void AGOSEngine::oe1_printMonsterDamage() {
+	// 273: print monster damage
+	printStats();
+}
+
+void AGOSEngine::oe1_printPlayerHit() {
+	// 277: print player hit
+	printStats();
+}
+
+void AGOSEngine::oe1_printMonsterHit() {
+	// 278: print monster hit
+	printStats();
+}
+
 void AGOSEngine::oe1_setStore() {
 	// 282: set store
 	Item *item = getNextItemPtr();

Modified: scummvm/trunk/engines/agos/string.cpp
===================================================================
--- scummvm/trunk/engines/agos/string.cpp	2006-10-08 01:05:10 UTC (rev 24187)
+++ scummvm/trunk/engines/agos/string.cpp	2006-10-08 01:46:38 UTC (rev 24188)
@@ -725,4 +725,134 @@
 	changeWindow(0);
 }
 
+// String code for statistics in Elvira 1
+void AGOSEngine::printMonsterDamage() {
+	WindowBlock *window = _dummyWindow;
+	window->flags = 1;
+
+	mouseOff();
+	writeChar(window, 36, 88, 2, _variableArray[442]);
+	mouseOn();
+}
+
+void AGOSEngine::printPlayerDamage() {
+	WindowBlock *window = _dummyWindow;
+	window->flags = 1;
+
+	mouseOff();
+	writeChar(window, 36, 38, 2, _variableArray[441]);
+	mouseOn();
+}
+
+void AGOSEngine::printMonsterHit() {
+	WindowBlock *window = _dummyWindow;
+	window->flags = 1;
+
+	mouseOff();
+	writeChar(window, 35, 166, 4, _variableArray[415]);
+	mouseOn();
+}
+
+void AGOSEngine::printPlayerHit() {
+	WindowBlock *window = _dummyWindow;
+	window->flags = 1;
+
+	mouseOff();
+	writeChar(window, 3, 166, 0, _variableArray[414]);
+	mouseOn();
+}
+
+void AGOSEngine::printStats() {
+	WindowBlock *window = _dummyWindow;
+	int val;
+
+	window->flags = 1;
+
+	mouseOff();
+
+	// Strength
+	val = _variableArray[0];
+	if (val < -99)
+		val = -99;
+	if (val > 99)
+		val = 99;	
+	writeChar(window, 5, 133, 6, val);
+
+	// Resolution
+	val = _variableArray[1];
+	if (val < -99)
+		val = -99;
+	if (val > 99)
+		val = 99;	
+	writeChar(window, 11, 133, 6, val);
+
+	// Dexterity
+	val = _variableArray[2];
+	if (val < -99)
+		val = -99;
+	if (val > 99)
+		val = 99;	
+	writeChar(window, 18, 133, 0, val);
+
+	// Skill
+	val = _variableArray[3];
+	if (val < -99)
+		val = -99;
+	if (val > 99)
+		val = 99;	
+	writeChar(window, 24, 133, 0, val);
+
+	// Life
+	val = _variableArray[5];
+	if (val < -99)
+		val = -99;
+	if (val > 99)
+		val = 99;	
+	writeChar(window, 30, 133, 2, val);
+
+	// Experience
+	val = _variableArray[6];
+	if (val < -99)
+		val = -99;
+	if (val > 99)
+		val = 99;	
+	writeChar(window, 36, 133, 4, val);
+
+	mouseOn();
+}
+
+void AGOSEngine::writeChar(WindowBlock *window, int x, int y, int offs, int val) {
+	int chr;
+
+	// Clear background of first digit
+	window->textColumnOffset = offs;
+	window->text_color = 0;
+	video_putchar_drawchar(window, x, y, 129);
+
+	if (val != -1) {
+		// Print first digit
+		chr = val / 10 + 48;
+		window->text_color = 15;
+		video_putchar_drawchar(window, x, y, chr);
+	}
+
+	offs += 6;
+	if (offs >= 7) {
+		offs -= 8;
+		x++;
+	}
+
+	// Clear background of second digit
+	window->textColumnOffset = offs;
+	window->text_color = 0;
+	video_putchar_drawchar(window, x, y, 129);
+
+	if (val != -1) {
+		// Print second digit
+		chr = val % 10 + 48;
+		window->text_color = 15;
+		video_putchar_drawchar(window, x, y, chr);
+	}
+}
+
 } // 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