[Scummvm-cvs-logs] SF.net SVN: scummvm: [28101] scummvm/branches/branch-0-10-0/backends/ platform/ds

agent-q at users.sourceforge.net agent-q at users.sourceforge.net
Sun Jul 15 16:26:43 CEST 2007


Revision: 28101
          http://scummvm.svn.sourceforge.net/scummvm/?rev=28101&view=rev
Author:   agent-q
Date:     2007-07-15 07:26:42 -0700 (Sun, 15 Jul 2007)

Log Message:
-----------
- Changed word completion keyboard to get the word list from the pred.dic main dictionary instead of the game dictionary

- Fixed several key repeat bugs

- Improved control system in Goblins 3

- Added icons for build D - F

- Added snap to borders option to make it easier to get the mouse cursor to the edges of the screen. 

Modified Paths:
--------------
    scummvm/branches/branch-0-10-0/backends/platform/ds/arm9/makefile
    scummvm/branches/branch-0-10-0/backends/platform/ds/arm9/source/dsmain.cpp
    scummvm/branches/branch-0-10-0/backends/platform/ds/arm9/source/dsmain.h
    scummvm/branches/branch-0-10-0/backends/platform/ds/arm9/source/dsoptions.cpp
    scummvm/branches/branch-0-10-0/backends/platform/ds/arm9/source/dsoptions.h
    scummvm/branches/branch-0-10-0/backends/platform/ds/arm9/source/wordcompletion.cpp
    scummvm/branches/branch-0-10-0/backends/platform/ds/arm9/source/wordcompletion.h

Added Paths:
-----------
    scummvm/branches/branch-0-10-0/backends/platform/ds/logod.bmp
    scummvm/branches/branch-0-10-0/backends/platform/ds/logoe.bmp
    scummvm/branches/branch-0-10-0/backends/platform/ds/logof.bmp

Modified: scummvm/branches/branch-0-10-0/backends/platform/ds/arm9/makefile
===================================================================
--- scummvm/branches/branch-0-10-0/backends/platform/ds/arm9/makefile	2007-07-15 13:33:37 UTC (rev 28100)
+++ scummvm/branches/branch-0-10-0/backends/platform/ds/arm9/makefile	2007-07-15 14:26:42 UTC (rev 28101)
@@ -5,10 +5,10 @@
 # Select the build you want by uncommenting one of the following lines:
 
 
-#DS_BUILD_A = 1
+DS_BUILD_A = 1
 #DS_BUILD_B = 1
 #DS_BUILD_C = 1
-DS_BUILD_D = 1
+#DS_BUILD_D = 1
 #DS_BUILD_E = 1
 #DS_BUILD_F = 1
 
@@ -111,7 +111,7 @@
 
 ifdef DS_BUILD_D
 	DEFINES = -DDS_NON_SCUMM_BUILD -DDS_BUILD_D
-	LOGO = logoc.bmp
+	LOGO = logod.bmp
 	DISABLE_HE = 1
 	DISABLE_SCUMM = 1
 	DISABLE_SCUMM_7_8 = 1
@@ -134,7 +134,7 @@
 
 ifdef DS_BUILD_E
 	DEFINES = -DDS_NON_SCUMM_BUILD -DDS_BUILD_E
-	LOGO = logoc.bmp
+	LOGO = logoe.bmp
 	DISABLE_HE = 1
 	DISABLE_SCUMM = 1
 	DISABLE_SCUMM_7_8 = 1
@@ -157,7 +157,7 @@
 
 ifdef DS_BUILD_F
 	DEFINES = -DDS_NON_SCUMM_BUILD -DDS_BUILD_F
-	LOGO = logoc.bmp
+	LOGO = logof.bmp
 	DISABLE_HE = 1
 	DISABLE_SCUMM = 1
 	DISABLE_SCUMM_7_8 = 1

Modified: scummvm/branches/branch-0-10-0/backends/platform/ds/arm9/source/dsmain.cpp
===================================================================
--- scummvm/branches/branch-0-10-0/backends/platform/ds/arm9/source/dsmain.cpp	2007-07-15 13:33:37 UTC (rev 28100)
+++ scummvm/branches/branch-0-10-0/backends/platform/ds/arm9/source/dsmain.cpp	2007-07-15 14:26:42 UTC (rev 28101)
@@ -176,6 +176,7 @@
 // Game id
 u8 gameID;
 
+bool snapToBorder = false;
 bool consoleEnable = false;
 bool gameScreenSwap = false;
 bool isCpuScalerEnabled();
@@ -204,6 +205,7 @@
 int mouseHotspotX, mouseHotspotY;
 bool cursorEnable = false;
 bool mouseCursorVisible = true;
+bool rightButtonDown = false;
 
 // Dragging
 int dragStartX, dragStartY;
@@ -495,6 +497,10 @@
 	leftHandedMode = enable;
 }
 
+void setSnapToBorder(bool enable) {
+	snapToBorder = enable;
+}
+
 void setTouchXOffset(int x) {
 	touchXOffset = x;
 }
@@ -1166,13 +1172,16 @@
 
 			if (!indyFightState) {
 
-				if ((!(getKeysHeld() & KEY_L)) && (!(getKeysHeld() & KEY_R)) && (getKeysChanged() & KEY_B)) {	
-					event.kbd.keycode = 27;		
-					event.kbd.ascii = 27;		
+				if ((!(getKeysHeld() & KEY_L)) && (!(getKeysHeld() & KEY_R)) && (getKeysDown() & KEY_B)) {	
+					event.kbd.keycode = 27;
+					event.kbd.ascii = 27;
 					event.kbd.flags = 0;
 
-					event.type = getKeyEvent(KEY_B);
+					event.type = Common::EVENT_KEYDOWN;
 					system->addEvent(event);
+
+					event.type = Common::EVENT_KEYUP;
+					system->addEvent(event);
 				}
 		
 			}
@@ -1188,34 +1197,45 @@
 				}
 			}
 	
-			if (!((getKeysHeld() & KEY_L) || (getKeysHeld() & KEY_R)) && (getKeyboardEnable())) {
+			if ((getKeyboardEnable())) {
 				event.kbd.flags = 0;
 
-				if (getKeysChanged() & KEY_LEFT) {
-					event.kbd.keycode = SDLK_LEFT;
-					event.kbd.ascii = SDLK_LEFT;
-					event.type = getKeyEvent(KEY_LEFT);
-				}
+				bool down = getKeysDown() & (KEY_LEFT | KEY_RIGHT | KEY_UP | KEY_DOWN);
+				bool release = getKeysReleased() & (KEY_LEFT | KEY_RIGHT | KEY_UP | KEY_DOWN);
+				bool shoulders = getKeysHeld() & (KEY_L | KEY_R);
 
-				if (getKeysChanged() & KEY_RIGHT) {
-					event.kbd.keycode = SDLK_RIGHT;
-					event.kbd.ascii = SDLK_RIGHT;
-					event.type = getKeyEvent(KEY_RIGHT);
+				if ( (down && (!shoulders)) || release) 
+				{
+	
+					if (getKeysChanged() & KEY_LEFT) {
+						event.kbd.keycode = SDLK_LEFT;
+						event.kbd.ascii = SDLK_LEFT;
+						event.type = getKeyEvent(KEY_LEFT);
+						system->addEvent(event);
+					}
+	
+					if (getKeysChanged() & KEY_RIGHT) {
+						event.kbd.keycode = SDLK_RIGHT;
+						event.kbd.ascii = SDLK_RIGHT;
+						event.type = getKeyEvent(KEY_RIGHT);
+						system->addEvent(event);
+					}
+	
+					if (getKeysChanged() & KEY_UP) {
+						event.kbd.keycode = SDLK_UP;
+						event.kbd.ascii = SDLK_UP;
+						event.type = getKeyEvent(KEY_UP);
+						system->addEvent(event);
+					}
+	
+					if (getKeysChanged() & KEY_DOWN) {
+						event.kbd.keycode = SDLK_DOWN;
+						event.kbd.ascii = SDLK_DOWN;
+						event.type = getKeyEvent(KEY_DOWN);
+						system->addEvent(event);
+					}
 				}
-
-				if (getKeysChanged() & KEY_UP) {
-					event.kbd.keycode = SDLK_UP;
-					event.kbd.ascii = SDLK_UP;
-					event.type = getKeyEvent(KEY_UP);
-				}
-
-				if (getKeysChanged() & KEY_DOWN) {
-					event.kbd.keycode = SDLK_DOWN;
-					event.kbd.ascii = SDLK_DOWN;
-					event.type = getKeyEvent(KEY_DOWN);
-				}
 					
-				system->addEvent(event);
 			}
 	
 			if (!((getKeysHeld() & KEY_L) || (getKeysHeld() & KEY_R)) && (!getIndyFightState()) && (!getKeyboardEnable())) {
@@ -1229,8 +1249,18 @@
 						mouseMode = MOUSE_LEFT;
 					}
 
+					if (rightButtonDown)
+					{
+						Common::Event event;
+						event.mouse = Common::Point(getPenX(), getPenY());
+						event.type = Common::EVENT_RBUTTONUP;
+						system->addEvent(event);
+						rightButtonDown = false;
+					}
+						
+
 					if (getKeysDown() & KEY_RIGHT) {
-						if ((currentGame->control != CONT_SCUMM_SAMNMAX) && (currentGame->control != CONT_FUTURE_WARS)) {
+						if ((currentGame->control != CONT_SCUMM_SAMNMAX) && (currentGame->control != CONT_FUTURE_WARS) && (currentGame->control != CONT_GOBLINS)) {
 							mouseMode = MOUSE_RIGHT;
 						} else {
 							// If we're playing sam and max, click and release the right mouse
@@ -1244,15 +1274,20 @@
 							} else {
 								event.mouse = Common::Point(getPenX(), getPenY());
 							}
+							
+							rightButtonDown = true;
 
 		
 							event.type = Common::EVENT_RBUTTONDOWN;
 							system->addEvent(event);
 		
-							event.type = Common::EVENT_RBUTTONUP;
-							system->addEvent(event);
+							//event.type = Common::EVENT_RBUTTONUP;
+							//system->addEvent(event);
 						}
 					}
+
+
+
 					if (getKeysDown() & KEY_UP) {
 						mouseMode = MOUSE_HOVER;
 					}
@@ -1343,28 +1378,34 @@
 
 				if (currentGame->control == CONT_SIMON) {
 					// Extra controls for Simon the Sorcerer
-					if ((getKeysChanged() & KEY_DOWN)) {
+					if ((getKeysDown() & KEY_DOWN)) {
 						Common::Event event;
 					
-						event.type = getKeyEvent(KEY_DOWN);
+						event.type = Common::EVENT_KEYDOWN;
 						event.kbd.keycode = '#';		// F10 or # - show hotspots
 						event.kbd.ascii = '#';
 						event.kbd.flags = 0;
 						system->addEvent(event);
 //						consolePrintf("F10\n");
+
+						event.type = Common::EVENT_KEYUP;
+						system->addEvent(event);
 					}
 				}
 	
 				if (currentGame->control == CONT_SCUMM_ORIGINAL) {
 					// Extra controls for Scumm v1-5 games
-					if ((getKeysChanged() & KEY_DOWN)) {
+					if ((getKeysDown() & KEY_DOWN)) {
 						Common::Event event;
 					
-						event.type = getKeyEvent(KEY_DOWN);
+						event.type = Common::EVENT_KEYDOWN;
 						event.kbd.keycode = '.';		// Full stop - skips current dialogue line
 						event.kbd.ascii = '.';
 						event.kbd.flags = 0;
 						system->addEvent(event);
+
+						event.type = Common::EVENT_KEYUP;
+						system->addEvent(event);
 					}
 					
 					if (indyFightState) {
@@ -1396,11 +1437,14 @@
 			}
 
 			if (leftHandedSwap(getKeysDown()) & KEY_A) {
-				event.type = getKeyEvent(leftHandedSwap(KEY_A));
+				event.type = Common::EVENT_KEYDOWN;
 				event.kbd.keycode = SDLK_RETURN;
 				event.kbd.ascii = 0;
 				event.kbd.flags = 0;
 				system->addEvent(event);
+
+				event.type = Common::EVENT_KEYUP;
+				system->addEvent(event);
 			}
 		
 		}
@@ -1451,7 +1495,7 @@
 }
 
 void setIconMain(int num, int x, int y, int imageNum, int flags, bool enable) {
-	spritesMain[num].attribute[0] = ATTR0_BMP | (y & 0x1FF) | (!enable? ATTR0_DISABLED: 0); 
+	spritesMain[num].attribute[0] = ATTR0_BMP | (y & 0xFF) | (!enable? ATTR0_DISABLED: 0); 
 	spritesMain[num].attribute[1] = ATTR1_SIZE_32 | (x & 0x1FF) | flags;
 	spritesMain[num].attribute[2] = ATTR2_ALPHA(1)| (imageNum * 16);
 }
@@ -2228,12 +2272,26 @@
 int getPenX() {
 	int x = ((penX * touchScX) >> 8) + touchX;
 	x = x < 0? 0: (x > gameWidth - 1? gameWidth - 1: x);
+
+	if (snapToBorder)
+	{
+		if (x < 8) x = 0;
+		if (x > gameWidth - 8) x = gameWidth - 1;
+	}
+
 	return x;
 }
 
 int getPenY() {
 	int y = ((penY * touchScY) >> 8) + touchY;
 	y = y < 0? 0: (y > gameHeight - 1? gameHeight - 1: y);
+
+	if (snapToBorder)
+	{
+		if (y < 8) y = 0;
+		if (y > gameHeight - 8) y = gameHeight - 1;
+	}
+
 	return y;
 }
 
@@ -2528,7 +2586,7 @@
 	consolePrintf("-------------------------------\n");
 	consolePrintf("ScummVM DS\n");
 	consolePrintf("Ported by Neil Millstone\n");
-	consolePrintf("Version 0.10.0 beta1 ");
+	consolePrintf("Version 0.10.0 beta2 ");
 #if defined(DS_BUILD_A)
 	consolePrintf("build A\n");
 	consolePrintf("Lucasarts SCUMM games (SCUMM)\n");

Modified: scummvm/branches/branch-0-10-0/backends/platform/ds/arm9/source/dsmain.h
===================================================================
--- scummvm/branches/branch-0-10-0/backends/platform/ds/arm9/source/dsmain.h	2007-07-15 13:33:37 UTC (rev 28100)
+++ scummvm/branches/branch-0-10-0/backends/platform/ds/arm9/source/dsmain.h	2007-07-15 14:26:42 UTC (rev 28101)
@@ -126,6 +126,7 @@
 void 	setTouchXOffset(int x);
 void 	setTouchYOffset(int y);
 void 	setUnscaledMode(bool enable);
+void	setSnapToBorder(bool enable);
 void 	setIndyFightState(bool st);
 bool 	getIndyFightState();
 bool    isCpuScalerEnabled();

Modified: scummvm/branches/branch-0-10-0/backends/platform/ds/arm9/source/dsoptions.cpp
===================================================================
--- scummvm/branches/branch-0-10-0/backends/platform/ds/arm9/source/dsoptions.cpp	2007-07-15 13:33:37 UTC (rev 28100)
+++ scummvm/branches/branch-0-10-0/backends/platform/ds/arm9/source/dsoptions.cpp	2007-07-15 14:26:42 UTC (rev 28101)
@@ -38,8 +38,8 @@
 
 namespace DS {
 
-DSOptionsDialog::DSOptionsDialog() : GUI::Dialog(20, 0, 320 - 40, 200 - 20) {
-	addButton(this, 10, 160, "Close", GUI::kCloseCmd, 'C');
+DSOptionsDialog::DSOptionsDialog() : GUI::Dialog(20, 0, 320 - 40, 230 - 20) {
+	addButton(this, 10, 175, "Close", GUI::kCloseCmd, 'C');
 	
 #ifdef DS_SCUMM_BUILD
 	if (!DS::isGBAMPAvailable()) {
@@ -57,33 +57,44 @@
 	_disablePowerOff = new GUI::CheckboxWidget(this, 20, 100, 250, 20, "Disable power off on quit", 0, 'T');
 //	_cpuScaler = new GUI::CheckboxWidget(this, 20, 115, 250, 20, "CPU scaler", 0, 'T');
 	_showCursorCheckbox = new GUI::CheckboxWidget(this, 20, 115, 250, 20, "Show mouse cursor", 0, 'T');
+	_snapToBorderCheckbox = new GUI::CheckboxWidget(this, 20, 130, 250, 20, "Snap to border", 0, 'T');
 
-	new GUI::StaticTextWidget(this, 20, 130, 110, 15, "Touch X Offset", GUI::kTextAlignLeft);
-	_touchX = new GUI::SliderWidget(this, 130, 130, 130, 12, 1);
+	new GUI::StaticTextWidget(this, 20, 145, 110, 15, "Touch X Offset", GUI::kTextAlignLeft);
+	_touchX = new GUI::SliderWidget(this, 130, 145, 130, 12, 1);
 	_touchX->setMinValue(-8);
 	_touchX->setMaxValue(+8);
 	_touchX->setValue(0);
 	_touchX->setFlags(GUI::WIDGET_CLEARBG);
 
-	new GUI::StaticTextWidget(this, 20, 145, 110, 15, "Touch Y Offset", GUI::kTextAlignLeft);
-	_touchY = new GUI::SliderWidget(this, 130, 145, 130, 12, 2);
+	new GUI::StaticTextWidget(this, 20, 160, 110, 15, "Touch Y Offset", GUI::kTextAlignLeft);
+	_touchY = new GUI::SliderWidget(this, 130, 160, 130, 12, 2);
 	_touchY->setMinValue(-8);
 	_touchY->setMaxValue(+8);
 	_touchY->setValue(0);
 	_touchY->setFlags(GUI::WIDGET_CLEARBG);
 
-	new GUI::StaticTextWidget(this, 130 + 65 - 10, 160, 20, 15, "0", GUI::kTextAlignCenter);
-	new GUI::StaticTextWidget(this, 130 + 130 - 10, 160, 20, 15, "8", GUI::kTextAlignCenter);
-	new GUI::StaticTextWidget(this, 130 - 10, 160, 20, 15, "-8", GUI::kTextAlignCenter);
+	new GUI::StaticTextWidget(this, 130 + 65 - 10, 175, 20, 15, "0", GUI::kTextAlignCenter);
+	new GUI::StaticTextWidget(this, 130 + 130 - 10, 175, 20, 15, "8", GUI::kTextAlignCenter);
+	new GUI::StaticTextWidget(this, 130 - 10, 175, 20, 15, "-8", GUI::kTextAlignCenter);
 
 #ifdef DS_SCUMM_BUILD
 	_delDialog = new Scumm::SaveLoadChooser("Delete game:", "Delete", false, Scumm::g_scumm);
 #endif
 
+	if (ConfMan.hasKey("snaptoborder", "ds")) {
+		_snapToBorderCheckbox->setState(ConfMan.getBool("snaptoborder", "ds"));
+	} else {
+#ifdef DS_BUILD_D
+		_snapToBorderCheckbox->setState(true);
+#else
+		_snapToBorderCheckbox->setState(false);
+#endif
+	}
+
 	if (ConfMan.hasKey("showcursor", "ds")) {
 		_showCursorCheckbox->setState(ConfMan.getBool("showcursor", "ds"));
 	} else {
-		_showCursorCheckbox->setState(false);
+		_showCursorCheckbox->setState(true);
 	}
 
 	if (ConfMan.hasKey("lefthanded", "ds")) {
@@ -148,6 +159,7 @@
 	ConfMan.setInt("xoffset", _touchX->getValue(), "ds");
 	ConfMan.setInt("yoffset", _touchY->getValue(), "ds");
 	ConfMan.setBool("showcursor", _showCursorCheckbox->getState(), "ds");
+	ConfMan.setBool("snaptoborder", _snapToBorderCheckbox->getState(), "ds");
 	DS::setOptions();
 	DS::setIndyFightState(_indyFightCheckbox->getState());
 	ConfMan.flushToDisk();
@@ -239,6 +251,16 @@
 		DS::setMouseCursorVisible(true);
 	}
 
+	if (ConfMan.hasKey("snaptoborder", "ds")) {
+		DS::setSnapToBorder(ConfMan.getBool("snaptoborder", "ds"));
+	} else {
+#ifdef DS_BUILD_D
+		DS::setSnapToBorder(true);
+#else
+		DS::setSnapToBorder(false);
+#endif
+	}
+
 	if (ConfMan.hasKey("unscaled", "ds")) {
 		DS::setUnscaledMode(ConfMan.getBool("unscaled", "ds"));
 	} else {

Modified: scummvm/branches/branch-0-10-0/backends/platform/ds/arm9/source/dsoptions.h
===================================================================
--- scummvm/branches/branch-0-10-0/backends/platform/ds/arm9/source/dsoptions.h	2007-07-15 13:33:37 UTC (rev 28100)
+++ scummvm/branches/branch-0-10-0/backends/platform/ds/arm9/source/dsoptions.h	2007-07-15 14:26:42 UTC (rev 28101)
@@ -55,6 +55,7 @@
 	GUI::CheckboxWidget* _disablePowerOff;
 	GUI::CheckboxWidget* _cpuScaler;
 	GUI::CheckboxWidget* _showCursorCheckbox;
+	GUI::CheckboxWidget* _snapToBorderCheckbox;
 	
 #ifdef DS_SCUMM_BUILD
 	Scumm::SaveLoadChooser* _delDialog;

Modified: scummvm/branches/branch-0-10-0/backends/platform/ds/arm9/source/wordcompletion.cpp
===================================================================
--- scummvm/branches/branch-0-10-0/backends/platform/ds/arm9/source/wordcompletion.cpp	2007-07-15 13:33:37 UTC (rev 28100)
+++ scummvm/branches/branch-0-10-0/backends/platform/ds/arm9/source/wordcompletion.cpp	2007-07-15 14:26:42 UTC (rev 28101)
@@ -5,8 +5,85 @@
 #ifndef DISABLE_AGI
 
 namespace DS {
+// Default dictionary is about 64Kb, so 128Kb should be enough for future expansion
+#define WORD_BUFFER_SIZE (128 * 1024)
 
-void findWordCompletions(char* input) {
+// Default dictionary has ~8000 words
+#define MAX_WORD_COUNT 16000
+
+char wordBuffer[WORD_BUFFER_SIZE];
+int wordBufferPos = 0;
+
+char* wordBufferPtr[MAX_WORD_COUNT];
+int wordBufferPtrPos = 0;
+
+void addAutoCompleteLine(char* line) {
+
+	while (*line != 0)
+	{
+		char word[32];
+		int length;
+		
+		// Skip the T9-style numbers
+		while (*line != ' ')
+		{
+			line++;
+		}
+		line++;
+
+		do {
+			length = 0;
+
+			if (*line == ' ') line++;
+
+
+			// Copy the new word 
+			do {
+				word[length++] = *line++;
+			} while ((*line != '\0') && (*line != ' ') && (*line != '\n'));
+
+			word[length] = '\0';
+
+
+			// Store a pointer to the start of the word
+			wordBufferPtr[wordBufferPtrPos++] = &wordBuffer[wordBufferPos];
+	
+			// copy the new word into the buffer
+			strcpy(&wordBuffer[wordBufferPos], word);
+			wordBufferPos += strlen(word) + 1;
+		} while (*line == ' ');
+	}
+}
+
+int stringCompare(const void* a, const void* b) {
+	const char** as = (const char **) a;
+	const char** bs = (const char **) b;
+
+	return scumm_stricmp(*as, *bs);
+}
+
+void sortAutoCompleteWordList() {
+	// Sort the whole word list into alphabetical order
+	qsort((void *) wordBufferPtr, wordBufferPtrPos, 4, stringCompare);
+}
+
+// Sends the current available words to the virtual keyboard code for display
+bool findWordCompletions(char* input)
+{
+	char testWord[32];
+	int min = 0;
+	int max = wordBufferPtrPos - 1;
+	char* word;
+	int position;
+	char partialWord[32];
+
+	// Early out if dictionary not loaded
+	if (wordBufferPtrPos == 0)
+		return false;
+
+	OSystem_DS* system = (OSystem_DS *) g_system;
+	system->clearAutoComplete();
+
 	int start = 0;
 	for (int r = strlen(input) - 1; r>0; r--) {
 		if (input[r] == ' ') {
@@ -14,53 +91,90 @@
 			break;
 		}
 	}
+	strcpy(partialWord, &input[start]);
 
-	char word[32];
-	strcpy(word, &input[start]);
+	if (strlen(partialWord) == 0)
+	{
+		return false;
+	}
 
-	int fchr = word[0] - 'a';
-	int len = strlen(word);
+	do {
+		position = min + ((max - min) / 2);
 
-	OSystem_DS* system = (OSystem_DS *) g_system;
-	system->clearAutoComplete();
-	system->setCharactersEntered(strlen(word));
+		// Get the word from the dictonary line
+		word = wordBufferPtr[position];
 
-	if (strlen(word) == 0) {
-		return;
-	}		
+		
 
-	uint8 *wordList = Agi::AgiEngine::getWordsData();
-	uint8 *wordListEnd = Agi::AgiEngine::getWordsData() + Agi::AgiEngine::getWordsDataSize();
+		// Now check to see if the word is before or after the stub we're after
+		int result = scumm_stricmp((const char *) partialWord, (const char *) word);
+		
+		if (result == 0) {
+			// We've found the whole word.  Aren't we good.
+			break;
+		} else if (result > 0) {
+			// We're too early, so change the minimum position
+			min = position + 1;
+		} else if (result < 0) {
+			// We're too early, so change the maximum position
+			max = position - 1;
+		}
 
-	/* Get the offset to the first word beginning with the
-	 * right character
-	 */
-	wordList += READ_BE_UINT16(wordList + 2 * fchr);
+//		consolePrintf("Word: %s, (%d, %d) result: %d\n", word, min, max, result);
 
-	char currentWord[32];
+	} while (max - min > 0);
 
+	position = min;
+	word = wordBufferPtr[position];
+	//consolePrintf("Final word: %s\n", word);
+
 	
-	while (wordList < wordListEnd) {
-		int pos = *wordList++;		// Number of chars to keep from previous word
 
-		if (wordList == wordListEnd)
+	system->setCharactersEntered(strlen(partialWord));
+	
+
+	bool match = true;
+
+
+	for (int r = 0; r < strlen(partialWord); r++) {
+		if (word[r] != partialWord[r]) {
+			match = false;
 			break;
+		}
+	}
 
-		char c;
-		do {
-			c = *wordList++;
-			currentWord[pos++] =  (~c) & 0x7F;
-		} while ((c & 0x80) == 0);		// Top bit indicates end of word
-		currentWord[pos++] = '\0';
+	if (!match) {
+		position++;
+		if (position == wordBufferPtrPos) return false;
+		word = wordBufferPtr[position];
+//		consolePrintf("Final word: %s\n", word);
+	}
 
-		if (!strncmp(currentWord, word, strlen(word))) {
-			system->addAutoComplete(currentWord);
+
+	match = true;
+
+	do {
+
+		for (int r = 0; r < strlen(partialWord); r++) {
+			if (word[r] != partialWord[r]) {
+				match = false;
+				break;
+			}
 		}
+	
+		if (match) {
+			system->addAutoComplete(word);
+		}
 
-		wordList += 2;	// Skip the two byte word id.
+		position++;
+		if (position < wordBufferPtrPos) {
+			word = wordBufferPtr[position];
+		}
 
-	}
+	} while ((match) && (position < wordBufferPtrPos));
 
+	return true;
+
 }
 
 }

Modified: scummvm/branches/branch-0-10-0/backends/platform/ds/arm9/source/wordcompletion.h
===================================================================
--- scummvm/branches/branch-0-10-0/backends/platform/ds/arm9/source/wordcompletion.h	2007-07-15 13:33:37 UTC (rev 28100)
+++ scummvm/branches/branch-0-10-0/backends/platform/ds/arm9/source/wordcompletion.h	2007-07-15 14:26:42 UTC (rev 28101)
@@ -3,6 +3,8 @@
 
 namespace DS {
 
-extern void findWordCompletions(char* input);
+extern bool findWordCompletions(char* input);
+extern void addAutoCompleteLine(char* line);
+extern void sortAutoCompleteWordList();
 
 }
\ No newline at end of file

Added: scummvm/branches/branch-0-10-0/backends/platform/ds/logod.bmp
===================================================================
(Binary files differ)


Property changes on: scummvm/branches/branch-0-10-0/backends/platform/ds/logod.bmp
___________________________________________________________________
Name: svn:mime-type
   + application/octet-stream

Added: scummvm/branches/branch-0-10-0/backends/platform/ds/logoe.bmp
===================================================================
(Binary files differ)


Property changes on: scummvm/branches/branch-0-10-0/backends/platform/ds/logoe.bmp
___________________________________________________________________
Name: svn:mime-type
   + application/octet-stream

Added: scummvm/branches/branch-0-10-0/backends/platform/ds/logof.bmp
===================================================================
(Binary files differ)


Property changes on: scummvm/branches/branch-0-10-0/backends/platform/ds/logof.bmp
___________________________________________________________________
Name: svn:mime-type
   + application/octet-stream


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