[Scummvm-cvs-logs] CVS: scummvm/saga font.cpp,1.37,1.38 game.cpp,1.118,1.119 interface.cpp,1.159,1.160 interface.h,1.78,1.79 itedata.cpp,1.10,1.11 itedata.h,1.8,1.9 render.cpp,1.71,1.72 saga.cpp,1.146,1.147 saga.h,1.133,1.134 sfuncs.cpp,1.176,1.177

Eugene Sandulenko sev at users.sourceforge.net
Sun Oct 16 20:33:37 CEST 2005


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

Modified Files:
	font.cpp game.cpp interface.cpp interface.h itedata.cpp 
	itedata.h render.cpp saga.cpp saga.h sfuncs.cpp 
Log Message:
Fix bug #1326833 "ITE: Missing copy protection". Though it is disabled
by default by kind permission from Wyrmkeep Entertainment Co.


Index: font.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/saga/font.cpp,v
retrieving revision 1.37
retrieving revision 1.38
diff -u -d -r1.37 -r1.38
--- font.cpp	11 Oct 2005 17:39:31 -0000	1.37
+++ font.cpp	17 Oct 2005 03:28:21 -0000	1.38
@@ -438,7 +438,7 @@
 
 	if (fitWidth < textWidth) {
 		warning("text too long to be displayed in one line");
-		return;
+		textWidth = fitWidth;
 	}
 	// Entire string fits, draw it
 	textPoint.x = textPoint.x - (textWidth / 2);

Index: game.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/saga/game.cpp,v
retrieving revision 1.118
retrieving revision 1.119
diff -u -d -r1.118 -r1.119
--- game.cpp	16 Oct 2005 16:50:05 -0000	1.118
+++ game.cpp	17 Oct 2005 03:28:21 -0000	1.119
@@ -120,6 +120,11 @@
 	{kPanelButtonSaveText, -1,5, 0,0, kTextEnterSaveGameName,'-',0, 0,0,0},
 };
 
+static PanelButton ITE_ProtectPanelButtons[] = {
+	{kPanelButtonProtectEdit, 26,17, 119,17, 0,'-',0, 0,0,0},
+	{kPanelButtonProtectText, -1,5, 0,0, kTextEnterProtectAnswer,'-',0, 0,0,0},
+};
+
 /*
 static PanelButton ITE_ProtectionPanelButtons[] = {
 	{kPanelButtonArrow, 0,0, 0,0, 0,'-',0, 0,0,0}, //TODO
@@ -184,7 +189,13 @@
 	74, 44,			// save panel offsets
 	172, 58,		// save panel width & height
 	ARRAYSIZE(ITE_SavePanelButtons),
-	ITE_SavePanelButtons
+	ITE_SavePanelButtons,
+
+	0,				// protect edit index
+	74, 44,			// protect panel offsets
+	172, 58,		// protect panel width & height
+	ARRAYSIZE(ITE_ProtectPanelButtons),
+	ITE_ProtectPanelButtons
 };
 
 static GameResourceDescription ITE_Resources = {
@@ -635,6 +646,13 @@
 	0, 0,			// save panel offsets
 	0, 0,			// save panel width & height
 	ARRAYSIZE(IHNM_SavePanelButtons),
+	IHNM_SavePanelButtons,
+
+	// No protection panel in IHNM
+	-1,				// protect edit index
+	0, 0,			// protect panel offsets
+	0, 0,			// protect panel width & height
+	ARRAYSIZE(IHNM_SavePanelButtons),
 	IHNM_SavePanelButtons
 };
 

Index: interface.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/saga/interface.cpp,v
retrieving revision 1.159
retrieving revision 1.160
diff -u -d -r1.159 -r1.160
--- interface.cpp	11 Oct 2005 17:39:31 -0000	1.159
+++ interface.cpp	17 Oct 2005 03:28:21 -0000	1.160
@@ -172,6 +172,15 @@
 	_saveEdit = _savePanel.getButton(_vm->getDisplayInfo().saveEditIndex);
 	_savePanel.currentButton = NULL;
 
+	_protectPanel.x = _vm->getDisplayInfo().protectPanelXOffset;
+	_protectPanel.y = _vm->getDisplayInfo().protectPanelYOffset;
+	_protectPanel.imageWidth = _vm->getDisplayInfo().protectPanelWidth;
+	_protectPanel.imageHeight = _vm->getDisplayInfo().protectPanelHeight;
+	_protectPanel.buttons = _vm->getDisplayInfo().protectPanelButtons;
+	_protectPanel.buttonsCount = _vm->getDisplayInfo().protectPanelButtonsCount;
+	_protectEdit = _protectPanel.getButton(_vm->getDisplayInfo().protectEditIndex);
+	_protectPanel.currentButton = NULL;
+
 	_active = true;
 	_panelMode = _lockedMode = kPanelNull;
 	_savedMode = -1;
@@ -315,6 +324,15 @@
 	case kPanelBoss:
 		_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;
+		_textInputRepeatPhase = 0;
+		break;
 	}
 
 	draw();
@@ -493,6 +511,21 @@
 		_vm->_render->clearFlag(RF_DEMO_SUBST);
 		keyBossExit();
 		break;
+	case kPanelProtect:
+		if (_textInput && processTextInput(ascii)) {
+			return true;
+		}
+
+		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);
+		}
+		break;
 	}
 	return false;
 }
@@ -1055,6 +1088,26 @@
 	drawTextInput(backBuffer, &_savePanel, _saveEdit);
 }
 
+void Interface::drawProtect() {
+	Surface *backBuffer;
+	Rect rect;
+	int i;
+	PanelButton *panelButton;
+
+	backBuffer = _vm->_gfx->getBackBuffer();
+
+	_protectPanel.getRect(rect);
+	drawButtonBox(backBuffer, rect, kButton, false);
+
+	for (i = 0; i < _protectPanel.buttonsCount; i++) {
+		panelButton = &_protectPanel.buttons[i];
+		if (panelButton->type == kPanelButtonProtectText) {
+			drawPanelText(backBuffer, &_protectPanel, panelButton);
+		}
+	}
+	drawTextInput(backBuffer, &_protectPanel, _protectEdit);
+}
+
 void Interface::handleSaveUpdate(const Point& mousePoint) {
 	bool releasedButton;
 
@@ -1460,6 +1513,11 @@
 				handleChapterSelectionClick(mousePoint);
 		}
 		break;
+
+	case kPanelProtect:
+		// No mouse interaction
+		break;
+
 	}
 
 	_lastMousePoint = mousePoint;

Index: interface.h
===================================================================
RCS file: /cvsroot/scummvm/scummvm/saga/interface.h,v
retrieving revision 1.78
retrieving revision 1.79
diff -u -d -r1.78 -r1.79
--- interface.h	9 Oct 2005 03:35:45 -0000	1.78
+++ interface.h	17 Oct 2005 03:28:21 -0000	1.79
@@ -237,6 +237,7 @@
 	void drawQuit();
 	void drawLoad();
 	void drawSave();
+	void drawProtect();
 	void update(const Point& mousePoint, int updateFlag);
 	void drawStatusBar();
 	void setVerbState(int verb, int state);
@@ -297,6 +298,8 @@
 
 	void mapPanelDrawCrossHair();
 
+	int32 getProtectHash() { return _protectHash; }
+
 private:
 	void handleMainUpdate(const Point& mousePoint);					// main panel update
 	void handleMainClick(const Point& mousePoint);					// main panel click
@@ -418,6 +421,8 @@
 	InterfacePanel _loadPanel;
 	InterfacePanel _savePanel;
 	PanelButton * _saveEdit;
+	InterfacePanel _protectPanel;
+	PanelButton * _protectEdit;
 
 	bool _disableAbortSpeeches;
 
@@ -472,6 +477,8 @@
 
 	PalEntry _mapSavedPal[PAL_ENTRIES];
 	bool _mapPanelCrossHairState;
+
+	int32 _protectHash;
 };
 
 } // End of namespace Saga

Index: itedata.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/saga/itedata.cpp,v
retrieving revision 1.10
retrieving revision 1.11
diff -u -d -r1.10 -r1.11
--- itedata.cpp	28 Sep 2005 14:27:18 -0000	1.10
+++ itedata.cpp	17 Oct 2005 03:28:21 -0000	1.11
@@ -334,7 +334,7 @@
 	{ FX_CROWD_17,      64 }
 };
 
-const char *ITEinterfaceTextStrings[][51] = {
+const char *ITEinterfaceTextStrings[][52] = {
 	{
 		"Walk to", "Look At", "Pick Up", "Talk to", "Open",
 		"Close", "Use", "Give", "Options", "Test",
@@ -351,7 +351,8 @@
 		"There's no place to open it.",
 		"There's no opening to close.",
 		"I don't know how to do that.",
-		"Show Dialog"
+		"Show Dialog",
+		"What is Rif's reply?"
 	},
 	// German
 	{
@@ -370,7 +371,8 @@
 		"Das kann man nicht \224ffnen.",
 		"Hier ist keine \231ffnung zum Schlie$en.",
 		"Ich wei$ nicht, wie ich das machen soll.",
-		"Text zeigen"
+		"Text zeigen",
+		"Wie lautet die Antwort?"
 	}
 };
 

Index: itedata.h
===================================================================
RCS file: /cvsroot/scummvm/scummvm/saga/itedata.h,v
retrieving revision 1.8
retrieving revision 1.9
diff -u -d -r1.8 -r1.9
--- itedata.h	16 Aug 2005 19:04:51 -0000	1.8
+++ itedata.h	17 Oct 2005 03:28:21 -0000	1.9
@@ -87,7 +87,7 @@
 extern ObjectTableData ITE_ObjectTable[ITE_OBJECTCOUNT];
 extern FxTable ITE_SfxTable[ITE_SFXCOUNT];
 
-extern const char *ITEinterfaceTextStrings[][51];
+extern const char *ITEinterfaceTextStrings[][52];
 
 } // End of namespace Saga
 

Index: render.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/saga/render.cpp,v
retrieving revision 1.71
retrieving revision 1.72
diff -u -d -r1.71 -r1.72
--- render.cpp	7 Aug 2005 14:54:11 -0000	1.71
+++ render.cpp	17 Oct 2005 03:28:21 -0000	1.72
@@ -128,6 +128,10 @@
 		}
 	}
 
+	if (_vm->_interface->getMode() == kPanelProtect) {
+		_vm->_interface->drawProtect();
+	}
+
 	// Draw queued text strings
 	_vm->_scene->drawTextList(backBufferSurface);
 

Index: saga.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/saga/saga.cpp,v
retrieving revision 1.146
retrieving revision 1.147
diff -u -d -r1.146 -r1.147
--- saga.cpp	14 Oct 2005 15:15:52 -0000	1.146
+++ saga.cpp	17 Oct 2005 03:28:21 -0000	1.147
@@ -181,6 +181,7 @@
 	_musicVolume = ConfMan.getInt("music_volume") / 25;
 	_subtitlesEnabled = ConfMan.getBool("subtitles");
 	_readingSpeed = ConfMan.getInt("talkspeed");
+	_copyProtection = ConfMan.getBool("copy_protection");
 
 	if (_readingSpeed > 3)
 		_readingSpeed = 0;

Index: saga.h
===================================================================
RCS file: /cvsroot/scummvm/scummvm/saga/saga.h,v
retrieving revision 1.133
retrieving revision 1.134
diff -u -d -r1.133 -r1.134
--- saga.h	14 Oct 2005 04:28:20 -0000	1.133
+++ saga.h	17 Oct 2005 03:28:21 -0000	1.134
@@ -144,25 +144,28 @@
 
 
 enum PanelButtonType {
-	kPanelButtonVerb = 1,
-	kPanelButtonArrow = 2,
-	kPanelButtonConverseText = 4,
-	kPanelButtonInventory = 8,
+	kPanelButtonVerb = 1 << 0,
+	kPanelButtonArrow = 1 << 1,
+	kPanelButtonConverseText = 1 << 2,
+	kPanelButtonInventory = 1 << 3,
 
-	kPanelButtonOption = 0x10,
-	kPanelButtonOptionSlider = 0x20,
-	kPanelButtonOptionSaveFiles = 0x40,
-	kPanelButtonOptionText = 0x80,
+	kPanelButtonOption = 1 << 4,
+	kPanelButtonOptionSlider = 1 << 5,
+	kPanelButtonOptionSaveFiles = 1 << 6,
+	kPanelButtonOptionText = 1 << 7,
 
-	kPanelButtonQuit = 0x100,
-	kPanelButtonQuitText = 0x200,
+	kPanelButtonQuit = 1 << 8,
+	kPanelButtonQuitText = 1 << 9,
 
-	kPanelButtonLoad = 0x400,
-	kPanelButtonLoadText = 0x800,
+	kPanelButtonLoad = 1 << 10,
+	kPanelButtonLoadText = 1 << 11,
 
-	kPanelButtonSave = 0x1000,
-	kPanelButtonSaveText = 0x2000,
-	kPanelButtonSaveEdit = 0x4000,
+	kPanelButtonSave = 1 << 12,
+	kPanelButtonSaveText = 1 << 13,
+	kPanelButtonSaveEdit = 1 << 14,
+
+	kPanelButtonProtectText = 1 << 15,
+	kPanelButtonProtectEdit = 1 << 16,
 
 	kPanelAllButtons = 0xFFFFF
 };
@@ -218,7 +221,8 @@
 	kTextNoPlaceToOpen,
 	kTextNoOpening,
 	kTextDontKnow,
-	kTextShowDialog
+	kTextShowDialog,
+	kTextEnterProtectAnswer
 };
 
 struct ImageHeader {
@@ -467,6 +471,14 @@
 	int savePanelHeight;
 	int savePanelButtonsCount;
 	PanelButton *savePanelButtons;
+
+	int protectEditIndex;
+	int protectPanelXOffset;
+	int protectPanelYOffset;
+	int protectPanelWidth;
+	int protectPanelHeight;
+	int protectPanelButtonsCount;
+	PanelButton *protectPanelButtons;
 };
 
 
@@ -587,6 +599,8 @@
 	bool _subtitlesEnabled;
 	int _readingSpeed;
 
+	bool _copyProtection;
+
 	SndRes *_sndRes;
 	Sound *_sound;
 	Music *_music;

Index: sfuncs.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/saga/sfuncs.cpp,v
retrieving revision 1.176
retrieving revision 1.177
diff -u -d -r1.176 -r1.177
--- sfuncs.cpp	11 Oct 2005 18:11:58 -0000	1.176
+++ sfuncs.cpp	17 Oct 2005 03:28:21 -0000	1.177
@@ -1781,19 +1781,25 @@
 
 // Script function #73 (0x49)
 void Script::sfShowProtect(SCRIPTFUNC_PARAMS) {
-	thread->wait(kWaitTypeRequest);
+	if (_vm->_copyProtection) {
+		thread->wait(kWaitTypeRequest);
 
-	//TODO:protection dialog
-	thread->_flags &= ~kTFlagWaiting;
+		_vm->_interface->setMode(kPanelProtect);
+	}
 }
 
 // Script function #74 (0x4A)
 void Script::sfProtectResult(SCRIPTFUNC_PARAMS) {
-	int protectHash;
-	//cheating
-	protectHash = thread->pop();
-	thread->push(protectHash);
-	thread->_returnValue = protectHash;
+	if (_vm->_copyProtection) {
+		thread->_returnValue = _vm->_interface->getProtectHash();
+	} else {
+		int protectHash;
+
+		//cheating
+		protectHash = thread->pop();
+		thread->push(protectHash);
+		thread->_returnValue = protectHash;
+	}
 }
 
 // Script function #75 (0x4b)





More information about the Scummvm-git-logs mailing list