[Scummvm-cvs-logs] SF.net SVN: scummvm: [28398] scummvm/trunk/engines/saga

thebluegr at users.sourceforge.net thebluegr at users.sourceforge.net
Thu Aug 2 03:04:44 CEST 2007


Revision: 28398
          http://scummvm.svn.sourceforge.net/scummvm/?rev=28398&view=rev
Author:   thebluegr
Date:     2007-08-01 18:04:44 -0700 (Wed, 01 Aug 2007)

Log Message:
-----------
Partially implemented opcodes 87, 88 and 89, used in the help system of the IHNM demo. It's still buggy, though

Modified Paths:
--------------
    scummvm/trunk/engines/saga/interface.cpp
    scummvm/trunk/engines/saga/scene.cpp
    scummvm/trunk/engines/saga/scene.h
    scummvm/trunk/engines/saga/script.h
    scummvm/trunk/engines/saga/sfuncs.cpp

Modified: scummvm/trunk/engines/saga/interface.cpp
===================================================================
--- scummvm/trunk/engines/saga/interface.cpp	2007-08-01 23:38:31 UTC (rev 28397)
+++ scummvm/trunk/engines/saga/interface.cpp	2007-08-02 01:04:44 UTC (rev 28398)
@@ -463,12 +463,18 @@
 		_vm->_render->setFlag(RF_DEMO_SUBST);
 		break;
 	case kPanelProtect:
-		_protectPanel.currentButton = NULL;
-		_textInputMaxWidth = _protectEdit->width - 10;
-		_textInput = true;
-		_textInputString[0] = 0;
-		_textInputStringLength = 0;
-		_textInputPos = _textInputStringLength + 1;
+		if (_vm->getGameType() == GType_ITE) {
+			// This is used as the copy protection panel in ITE
+			_protectPanel.currentButton = NULL;
+			_textInputMaxWidth = _protectEdit->width - 10;
+			_textInput = true;
+			_textInputString[0] = 0;
+			_textInputStringLength = 0;
+			_textInputPos = _textInputStringLength + 1;
+		} else {
+			// In the IHNM demo, this panel mode is set by the scripts
+			// to flip through the pages of the help system
+		}
 		break;
 	}
 
@@ -671,18 +677,25 @@
 		keyBossExit();
 		break;
 	case kPanelProtect:
-		if (_textInput && processTextInput(ascii)) {
-			return true;
-		}
+		if (_vm->getGameType() == GType_ITE) {
+			if (_textInput && processTextInput(ascii)) {
+				return true;
+			}
 
-		if (ascii == 27 || ascii == 13) { // Esc or Enter
-			_vm->_script->wakeUpThreads(kWaitTypeRequest);
-			_vm->_interface->setMode(kPanelMain);
-			
-			_protectHash = 0;
+			if (ascii == 27 || ascii == 13) { // Esc or Enter
+				_vm->_script->wakeUpThreads(kWaitTypeRequest);
+				_vm->_interface->setMode(kPanelMain);
+				
+				_protectHash = 0;
 
-			for (char *p = _textInputString; *p; p++)
-				_protectHash = (_protectHash << 1) + toupper(*p);
+				for (char *p = _textInputString; *p; p++)
+					_protectHash = (_protectHash << 1) + toupper(*p);
+			}
+		} else {
+			// In the IHNM demo, this panel mode is set by the scripts
+			// to flip through the pages of the help system
+			// Any keypress here returns the user back to the game
+			_vm->_scene->clearPsychicProfile();
 		}
 		break;
 	case kPanelPlacard:

Modified: scummvm/trunk/engines/saga/scene.cpp
===================================================================
--- scummvm/trunk/engines/saga/scene.cpp	2007-08-01 23:38:31 UTC (rev 28397)
+++ scummvm/trunk/engines/saga/scene.cpp	2007-08-02 01:04:44 UTC (rev 28398)
@@ -1360,6 +1360,99 @@
 	q_event = _vm->_events->chain(q_event, &event);
 }
 
+void Scene::showPsychicProfile(const char *text) {
+	int textHeight;
+	static PalEntry cur_pal[PAL_ENTRIES];
+	PalEntry *pal;
+	TextListEntry textEntry;
+	Event event;
+	Event *q_event;
+
+	if (_vm->_interface->getMode() == kPanelPlacard)
+		return;
+
+	_vm->_interface->rememberMode();
+	_vm->_interface->setMode(kPanelPlacard);
+	_vm->_gfx->savePalette();
+
+	event.type = kEvTOneshot;
+	event.code = kCursorEvent;
+	event.op = kEventHide;
+
+	q_event = _vm->_events->queue(&event);
+
+	_vm->_gfx->getCurrentPal(cur_pal);
+
+	event.type = kEvTImmediate;
+	event.code = kPalEvent;
+	event.op = kEventPalToBlack;
+	event.time = 0;
+	event.duration = kNormalFadeDuration;
+	event.data = cur_pal;
+
+	q_event = _vm->_events->chain(q_event, &event);
+
+	event.type = kEvTOneshot;
+	event.code = kInterfaceEvent;
+	event.op = kEventClearStatus;
+
+	q_event = _vm->_events->chain(q_event, &event);
+
+	event.type = kEvTOneshot;
+	event.code = kGraphicsEvent;
+	event.op = kEventSetFlag;
+	event.param = RF_PLACARD;
+
+	q_event = _vm->_events->chain(q_event, &event);
+
+	// Set the background and palette for the psychic profile
+	event.type = kEvTOneshot;
+	event.code = kPsychicProfileBgEvent;
+
+	q_event = _vm->_events->chain(q_event, &event);
+
+	if (text != NULL) {
+		textHeight = _vm->_font->getHeight(kKnownFontVerb, text, 226, kFontCentered);
+
+		textEntry.knownColor = kKnownColorBlack;
+		textEntry.useRect = true;
+		textEntry.rect.left = 245;
+		textEntry.rect.setHeight(210 + 76);
+		textEntry.rect.setWidth(226);
+		textEntry.rect.top = 210 - textHeight;
+		textEntry.font = kKnownFontVerb;
+		textEntry.flags = (FontEffectFlags)(kFontCentered);
+		textEntry.text = text;
+
+		TextListEntry *_psychicProfileTextEntry = _vm->_scene->_textList.addEntry(textEntry);
+
+		event.type = kEvTOneshot;
+		event.code = kTextEvent;
+		event.op = kEventDisplay;
+		event.data = _psychicProfileTextEntry;
+
+		q_event = _vm->_events->chain(q_event, &event);
+	}
+
+	_vm->_scene->getBGPal(pal);
+
+	event.type = kEvTImmediate;
+	event.code = kPalEvent;
+	event.op = kEventBlackToPal;
+	event.time = 0;
+	event.duration = kNormalFadeDuration;
+	event.data = pal;
+
+	q_event = _vm->_events->chain(q_event, &event);
+
+	event.type = kEvTOneshot;
+	event.code = kScriptEvent;
+	event.op = kEventThreadWake;
+	event.param = kWaitTypePlacard;
+
+	q_event = _vm->_events->chain(q_event, &event);
+}
+
 void Scene::clearPsychicProfile() {
 	if (_vm->_interface->getMode() == kPanelPlacard) {
 		_vm->_scene->clearPlacard();

Modified: scummvm/trunk/engines/saga/scene.h
===================================================================
--- scummvm/trunk/engines/saga/scene.h	2007-08-01 23:38:31 UTC (rev 28397)
+++ scummvm/trunk/engines/saga/scene.h	2007-08-02 01:04:44 UTC (rev 28398)
@@ -341,6 +341,7 @@
 	}
 
 	void clearPlacard();
+	void showPsychicProfile(const char *text);
 	void clearPsychicProfile();
 	void showIHNMDemoSpecialScreen();
 

Modified: scummvm/trunk/engines/saga/script.h
===================================================================
--- scummvm/trunk/engines/saga/script.h	2007-08-01 23:38:31 UTC (rev 28397)
+++ scummvm/trunk/engines/saga/script.h	2007-08-02 01:04:44 UTC (rev 28398)
@@ -591,9 +591,9 @@
 	void sfScriptStartVideo(SCRIPTFUNC_PARAMS);
 	void sfScriptReturnFromVideo(SCRIPTFUNC_PARAMS);
 	void sfScriptEndVideo(SCRIPTFUNC_PARAMS);
-	void sf87(SCRIPTFUNC_PARAMS);
-	void sf88(SCRIPTFUNC_PARAMS);
-	void sf89(SCRIPTFUNC_PARAMS);
+	void sfShowIHNMDemoHelp(SCRIPTFUNC_PARAMS);
+	void sfShowIHNMDemoHelpText(SCRIPTFUNC_PARAMS);
+	void sfClearIHNMDemoHelpText(SCRIPTFUNC_PARAMS);
 	void sfGetPoints(SCRIPTFUNC_PARAMS);
 	void sfSetGlobalFlag(SCRIPTFUNC_PARAMS);
 	void sf92(SCRIPTFUNC_PARAMS);

Modified: scummvm/trunk/engines/saga/sfuncs.cpp
===================================================================
--- scummvm/trunk/engines/saga/sfuncs.cpp	2007-08-01 23:38:31 UTC (rev 28397)
+++ scummvm/trunk/engines/saga/sfuncs.cpp	2007-08-02 01:04:44 UTC (rev 28398)
@@ -225,9 +225,9 @@
 		OPCODE(sfScriptReturnFromVideo),
 		OPCODE(sfScriptEndVideo),
 		OPCODE(sfSetActorZ),
-		OPCODE(sf87),
-		OPCODE(sf88),
-		OPCODE(sf89),
+		OPCODE(sfShowIHNMDemoHelp),
+		OPCODE(sfShowIHNMDemoHelpText),
+		OPCODE(sfClearIHNMDemoHelpText),
 		OPCODE(sfVstopFX),
 		OPCODE(sfVstopLoopedFX),
 		OPCODE(sf92),	// only used in the demo version of IHNM
@@ -1417,95 +1417,10 @@
 }
 
 void Script::sfPsychicProfile(SCRIPTFUNC_PARAMS) {
-	int stringId, textHeight;
-	static PalEntry cur_pal[PAL_ENTRIES];
-	PalEntry *pal;
-	TextListEntry textEntry;
-	Event event;
-	Event *q_event;
-
 	thread->wait(kWaitTypePlacard);
 
-	_vm->_interface->rememberMode();
-	_vm->_interface->setMode(kPanelPlacard);
-	_vm->_gfx->savePalette();
-
-	stringId = thread->pop();
-
-	event.type = kEvTOneshot;
-	event.code = kCursorEvent;
-	event.op = kEventHide;
-
-	q_event = _vm->_events->queue(&event);
-
-	_vm->_gfx->getCurrentPal(cur_pal);
-
-	event.type = kEvTImmediate;
-	event.code = kPalEvent;
-	event.op = kEventPalToBlack;
-	event.time = 0;
-	event.duration = kNormalFadeDuration;
-	event.data = cur_pal;
-
-	q_event = _vm->_events->chain(q_event, &event);
-
-	event.type = kEvTOneshot;
-	event.code = kInterfaceEvent;
-	event.op = kEventClearStatus;
-
-	q_event = _vm->_events->chain(q_event, &event);
-
-	event.type = kEvTOneshot;
-	event.code = kGraphicsEvent;
-	event.op = kEventSetFlag;
-	event.param = RF_PLACARD;
-
-	q_event = _vm->_events->chain(q_event, &event);
-
-	// Set the background and palette for the psychic profile
-	event.type = kEvTOneshot;
-	event.code = kPsychicProfileBgEvent;
-
-	q_event = _vm->_events->chain(q_event, &event);
-
-	textHeight = _vm->_font->getHeight(kKnownFontVerb, thread->_strings->getString(stringId), 226, kFontCentered);
-
-	textEntry.knownColor = kKnownColorBlack;
-	textEntry.useRect = true;
-	textEntry.rect.left = 245;
-	textEntry.rect.setHeight(210 + 76);
-	textEntry.rect.setWidth(226);
-	textEntry.rect.top = 210 - textHeight;
-	textEntry.font = kKnownFontVerb;
-	textEntry.flags = (FontEffectFlags)(kFontCentered);
-	textEntry.text = thread->_strings->getString(stringId);
-
-	_placardTextEntry = _vm->_scene->_textList.addEntry(textEntry);
-
-	event.type = kEvTOneshot;
-	event.code = kTextEvent;
-	event.op = kEventDisplay;
-	event.data = _placardTextEntry;
-
-	q_event = _vm->_events->chain(q_event, &event);
-
-	_vm->_scene->getBGPal(pal);
-
-	event.type = kEvTImmediate;
-	event.code = kPalEvent;
-	event.op = kEventBlackToPal;
-	event.time = 0;
-	event.duration = kNormalFadeDuration;
-	event.data = pal;
-
-	q_event = _vm->_events->chain(q_event, &event);
-
-	event.type = kEvTOneshot;
-	event.code = kScriptEvent;
-	event.op = kEventThreadWake;
-	event.param = kWaitTypePlacard;
-
-	q_event = _vm->_events->chain(q_event, &event);
+	int stringId = thread->pop();
+	_vm->_scene->showPsychicProfile(thread->_strings->getString(stringId));
 }
 
 void Script::sfPsychicProfileOff(SCRIPTFUNC_PARAMS) {
@@ -2083,16 +1998,52 @@
 	_vm->_anim->endVideo();
 }
 
-void Script::sf87(SCRIPTFUNC_PARAMS) {
-	SF_stub("sf87", thread, nArgs);
+void Script::sfShowIHNMDemoHelp(SCRIPTFUNC_PARAMS) {
+	thread->wait(kWaitTypePlacard);
+
+	_vm->_scene->showPsychicProfile(NULL);
 }
 
-void Script::sf88(SCRIPTFUNC_PARAMS) {
-	SF_stub("sf88", thread, nArgs);
+void Script::sfShowIHNMDemoHelpText(SCRIPTFUNC_PARAMS) {
+	int stringId, textHeight;
+	TextListEntry textEntry;
+	Event event;
+
+	stringId = thread->pop();
+
+	// FIXME: This is called multiple times in a row, one for each page of the help screens. We should wait
+	// somehow before showing the next page
+
+	textHeight = _vm->_font->getHeight(kKnownFontVerb, thread->_strings->getString(stringId), 226, kFontCentered);
+
+	textEntry.knownColor = kKnownColorBlack;
+	textEntry.useRect = true;
+	textEntry.rect.left = 245;
+	textEntry.rect.setHeight(210 + 76);
+	textEntry.rect.setWidth(226);
+	textEntry.rect.top = 210 - textHeight;
+	textEntry.font = kKnownFontVerb;
+	textEntry.flags = (FontEffectFlags)(kFontCentered);
+	textEntry.text = thread->_strings->getString(stringId);
+
+	TextListEntry *_psychicProfileTextEntry = _vm->_scene->_textList.addEntry(textEntry);
+
+	event.type = kEvTOneshot;
+	event.code = kTextEvent;
+	event.op = kEventDisplay;
+	event.data = _psychicProfileTextEntry;
+
+	_vm->_events->queue(&event);
 }
 
-void Script::sf89(SCRIPTFUNC_PARAMS) {
-	SF_stub("sf89", thread, nArgs);
+void Script::sfClearIHNMDemoHelpText(SCRIPTFUNC_PARAMS) {
+	thread->wait(kWaitTypePlacard);
+
+	// This is called a while after the psychic profile is
+	// opened in the IHNM demo, to flip through the help system pages
+	_vm->_scene->clearPsychicProfile();
+	// FIXME: The demo uses mode 8 when changing pages
+	//_vm->_interface->setMode(8);
 }
 
 void Script::sfVstopFX(SCRIPTFUNC_PARAMS) {


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