[Scummvm-cvs-logs] SF.net SVN: scummvm: [26518] scummvm/trunk/engines/parallaction

peres001 at users.sourceforge.net peres001 at users.sourceforge.net
Sun Apr 15 22:57:57 CEST 2007


Revision: 26518
          http://scummvm.svn.sourceforge.net/scummvm/?rev=26518&view=rev
Author:   peres001
Date:     2007-04-15 13:57:56 -0700 (Sun, 15 Apr 2007)

Log Message:
-----------
- Fonts are now preloaded at start.
- Replaced font string names with enums.
- Some slight simplification to Disk.

Modified Paths:
--------------
    scummvm/trunk/engines/parallaction/callables.cpp
    scummvm/trunk/engines/parallaction/dialogue.cpp
    scummvm/trunk/engines/parallaction/disk.cpp
    scummvm/trunk/engines/parallaction/graphics.cpp
    scummvm/trunk/engines/parallaction/graphics.h
    scummvm/trunk/engines/parallaction/intro.cpp
    scummvm/trunk/engines/parallaction/location.cpp
    scummvm/trunk/engines/parallaction/menu.cpp
    scummvm/trunk/engines/parallaction/parallaction.cpp
    scummvm/trunk/engines/parallaction/zone.cpp

Modified: scummvm/trunk/engines/parallaction/callables.cpp
===================================================================
--- scummvm/trunk/engines/parallaction/callables.cpp	2007-04-15 20:45:55 UTC (rev 26517)
+++ scummvm/trunk/engines/parallaction/callables.cpp	2007-04-15 20:57:56 UTC (rev 26518)
@@ -250,7 +250,7 @@
 	r.moveTo(7, 7);
 	_vm->_gfx->floodFill(Gfx::kBitFront, r, 1);
 
-	_vm->_gfx->setFont("comic");
+	_vm->_gfx->setFont(kFontDialogue);
 	_vm->_gfx->displayWrappedString(_vm->_location._endComment, 3, 5, 130, 0);
 
 	uint32 di = 0;
@@ -365,7 +365,7 @@
 	_vm->_gfx->extendPalette(_vm->_gfx->_palette);
 
 	if (gameCompleted) {
-		_vm->_gfx->setFont("slide");
+		_vm->_gfx->setFont(kFontMenu);
 		_vm->_gfx->_proportionalFont = false;
 		uint16 _ax = _vm->_gfx->getStringWidth(v4C[_language]);
 		_vm->_gfx->displayString((SCREEN_WIDTH - _ax)/2, 70, v4C[_language]);
@@ -384,7 +384,7 @@
 
 		_engineFlags |= kEngineChangeLocation;
 	} else {
-		_vm->_gfx->setFont("slide");
+		_vm->_gfx->setFont(kFontMenu);
 		_vm->_gfx->_proportionalFont = false;
 		uint16 _ax = _vm->_gfx->getStringWidth(v8C[_language]);
 		_vm->_gfx->displayString((SCREEN_WIDTH - _ax)/2, 70, v8C[_language]);
@@ -436,7 +436,7 @@
 	_vm->_gfx->swapBuffers();
 	_vm->parseLocation("common");
 
-	_vm->_gfx->setFont("slide");
+	_vm->_gfx->setFont(kFontMenu);
 	_vm->_gfx->_proportionalFont = false;
 
 	uint16 _ax = _vm->_gfx->getStringWidth(_slideText[0]);

Modified: scummvm/trunk/engines/parallaction/dialogue.cpp
===================================================================
--- scummvm/trunk/engines/parallaction/dialogue.cpp	2007-04-15 20:45:55 UTC (rev 26517)
+++ scummvm/trunk/engines/parallaction/dialogue.cpp	2007-04-15 20:57:56 UTC (rev 26518)
@@ -348,7 +348,7 @@
 
 	enterDialogue();
 
-	_gfx->setFont("comic");
+	_gfx->setFont(kFontDialogue);
 
 	bool isNpc = scumm_stricmp(data->_name, "yourself") && data->_name[0] != '\0';
 	Cnv *face = isNpc ? _disk->loadTalk(data->_name) : _char._talk;

Modified: scummvm/trunk/engines/parallaction/disk.cpp
===================================================================
--- scummvm/trunk/engines/parallaction/disk.cpp	2007-04-15 20:45:55 UTC (rev 26517)
+++ scummvm/trunk/engines/parallaction/disk.cpp	2007-04-15 20:57:56 UTC (rev 26518)
@@ -920,10 +920,7 @@
 	debugC(1, kDebugDisk, "AmigaDisk::loadFont '%s'", name);
 
 	char path[PATH_LEN];
-	if (scumm_stricmp(name, "topaz"))
-		sprintf(path, "%sfont", name);
-	else
-		strcpy(path, "introfont");
+	sprintf(path, "%sfont", name);
 
 	if (!_resArchive.openArchivedFile(path))
 		errorFileNotFound(path);

Modified: scummvm/trunk/engines/parallaction/graphics.cpp
===================================================================
--- scummvm/trunk/engines/parallaction/graphics.cpp	2007-04-15 20:45:55 UTC (rev 26517)
+++ scummvm/trunk/engines/parallaction/graphics.cpp	2007-04-15 20:57:56 UTC (rev 26518)
@@ -706,10 +706,9 @@
 }
 
 
-void Gfx::setFont(const char* name) {
-	if (_font) delete _font;
-
-	_font = _vm->_disk->loadFont(name);
+void Gfx::setFont(Fonts name) {
+	assert(name < 3);
+	_font = _fonts[name];
 }
 
 
@@ -904,6 +903,16 @@
 
 	initMouse( 0 );
 
+	if (_vm->getPlatform() == Common::kPlatformPC) {
+		_fonts[kFontDialogue] = _vm->_disk->loadFont("comic");
+		_fonts[kFontLabel] = _vm->_disk->loadFont("topaz");
+		_fonts[kFontMenu] = _vm->_disk->loadFont("slide");
+	} else {
+		_fonts[kFontDialogue] = _vm->_disk->loadFont("comic");
+		_fonts[kFontLabel] = _vm->_disk->loadFont("intro");
+		_fonts[kFontMenu] = _vm->_disk->loadFont("slide");
+	}
+
 	_font = NULL;
 
 	return;
@@ -916,7 +925,9 @@
 	free(_buffers[kBitBack]);
 	free(_buffers[kBit2]);
 
-	if (_font) delete _font;
+	delete _fonts[kFontDialogue];
+	delete _fonts[kFontLabel];
+	delete _fonts[kFontMenu];
 
 	return;
 }

Modified: scummvm/trunk/engines/parallaction/graphics.h
===================================================================
--- scummvm/trunk/engines/parallaction/graphics.h	2007-04-15 20:45:55 UTC (rev 26517)
+++ scummvm/trunk/engines/parallaction/graphics.h	2007-04-15 20:57:56 UTC (rev 26518)
@@ -117,6 +117,12 @@
 struct DoorData;
 struct GetData;
 
+enum Fonts {
+	kFontDialogue = 0,
+	kFontLabel = 1,
+	kFontMenu = 2
+};
+
 class Gfx {
 
 public:
@@ -189,7 +195,7 @@
 
 	void setMousePointer(int16 index);
 
-	void setFont(const char* name);
+	void setFont(Fonts name);
 
 public:
 	Common::Point		_labelPosition[2];
@@ -204,6 +210,7 @@
 	static byte			_mouseArrow[256];
 	StaticCnv			*_mouseComposedArrow;
 	Cnv					*_font;
+	Cnv					*_fonts[3];
 
 protected:
 	byte mapChar(byte c);

Modified: scummvm/trunk/engines/parallaction/intro.cpp
===================================================================
--- scummvm/trunk/engines/parallaction/intro.cpp	2007-04-15 20:45:55 UTC (rev 26517)
+++ scummvm/trunk/engines/parallaction/intro.cpp	2007-04-15 20:57:56 UTC (rev 26518)
@@ -134,7 +134,7 @@
 
 void _c_endIntro(void *parm) {
 
-	_vm->_gfx->setFont("slide");
+	_vm->_gfx->setFont(kFontMenu);
 	_vm->_gfx->_proportionalFont = false;
 
 	uint16 _di;

Modified: scummvm/trunk/engines/parallaction/location.cpp
===================================================================
--- scummvm/trunk/engines/parallaction/location.cpp	2007-04-15 20:45:55 UTC (rev 26517)
+++ scummvm/trunk/engines/parallaction/location.cpp	2007-04-15 20:57:56 UTC (rev 26518)
@@ -44,7 +44,7 @@
 
 	uint16 _si = 1;
 	_gfx->_proportionalFont = false;
-	_gfx->setFont("topaz");
+	_gfx->setFont(kFontLabel);
 
 	Script *_locationScript = _disk->loadLocation(filename);
 
@@ -273,7 +273,7 @@
 	debugC(1, kDebugLocation, "changeLocation: new background set");
 
 	_gfx->_proportionalFont = false;
-	_gfx->setFont("slide");
+	_gfx->setFont(kFontMenu);
 
 	uint16 _ax = strlen(_slideText[0]);
 	_ax <<= 3;	// text width
@@ -438,7 +438,7 @@
 	jobEraseAnimations(NULL, NULL);
 	jobDisplayAnimations(NULL, NULL);
 
-	_gfx->setFont("comic");
+	_gfx->setFont(kFontDialogue);
 	_gfx->swapBuffers();
 	_gfx->copyScreen(Gfx::kBitFront, Gfx::kBitBack);
 

Modified: scummvm/trunk/engines/parallaction/menu.cpp
===================================================================
--- scummvm/trunk/engines/parallaction/menu.cpp	2007-04-15 20:45:55 UTC (rev 26517)
+++ scummvm/trunk/engines/parallaction/menu.cpp	2007-04-15 20:57:56 UTC (rev 26518)
@@ -106,7 +106,7 @@
 	_vm->_disk->selectArchive((_vm->getPlatform() == Common::kPlatformPC) ? "disk1" : "disk0");
 
 	_vm->_gfx->_proportionalFont = false;
-	_vm->_gfx->setFont("slide");
+	_vm->_gfx->setFont(kFontMenu);
 
 	_vm->_disk->loadSlide("intro");
 	_vm->_gfx->extendPalette(_vm->_gfx->_palette);
@@ -294,7 +294,7 @@
 	_vm->_midiPlayer->stop();
 
 	_vm->_gfx->_proportionalFont = false;
-	_vm->_gfx->setFont("slide");
+	_vm->_gfx->setFont(kFontMenu);
 
 	_vm->_disk->selectArchive((_vm->getPlatform() == Common::kPlatformPC) ? "disk1" : "disk0");
 

Modified: scummvm/trunk/engines/parallaction/parallaction.cpp
===================================================================
--- scummvm/trunk/engines/parallaction/parallaction.cpp	2007-04-15 20:45:55 UTC (rev 26517)
+++ scummvm/trunk/engines/parallaction/parallaction.cpp	2007-04-15 20:57:56 UTC (rev 26518)
@@ -174,8 +174,10 @@
 
 	if (getPlatform() == Common::kPlatformPC)
 		_disk = new DosDisk(this);
-	else
+	else {
 		_disk = new AmigaDisk(this);
+		_disk->selectArchive("disk0");
+	}
 
 	_engineFlags = 0;
 

Modified: scummvm/trunk/engines/parallaction/zone.cpp
===================================================================
--- scummvm/trunk/engines/parallaction/zone.cpp	2007-04-15 20:45:55 UTC (rev 26517)
+++ scummvm/trunk/engines/parallaction/zone.cpp	2007-04-15 20:57:56 UTC (rev 26518)
@@ -304,7 +304,7 @@
 	v3C._data0 = _char._talk->getFramePtr(0);
 	v3C._data1 = NULL; //_talk->field_8[0];
 
-	_gfx->setFont("comic");
+	_gfx->setFont(kFontDialogue);
 	_gfx->flatBlitCnv(&v3C, 190, 80, Gfx::kBitFront);
 
 	int16 v26, v28;
@@ -343,7 +343,7 @@
 
 	int16 v6A = 0, v6C = 0;
 
-	_gfx->setFont("comic");
+	_gfx->setFont(kFontDialogue);
 	_gfx->getStringExtent(data->_description, 130, &v6C, &v6A);
 	Common::Rect r(v6C, v6A);
 	r.moveTo(0, 90);


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