diff options
Diffstat (limited to 'engines/lab')
| -rw-r--r-- | engines/lab/engine.cpp | 3 | ||||
| -rw-r--r-- | engines/lab/intro.cpp | 3 | ||||
| -rw-r--r-- | engines/lab/labfun.h | 2 | ||||
| -rw-r--r-- | engines/lab/map.cpp | 41 | ||||
| -rw-r--r-- | engines/lab/special.cpp | 13 | ||||
| -rw-r--r-- | engines/lab/text.cpp | 42 | ||||
| -rw-r--r-- | engines/lab/text.h | 1 | 
7 files changed, 14 insertions, 91 deletions
diff --git a/engines/lab/engine.cpp b/engines/lab/engine.cpp index 34ca89c192..571b72d88d 100644 --- a/engines/lab/engine.cpp +++ b/engines/lab/engine.cpp @@ -38,6 +38,7 @@  #include "lab/parsefun.h"  #include "lab/interface.h"  #include "lab/mouse.h" +#include "lab/resource.h"  namespace Lab { @@ -1361,7 +1362,7 @@ void LabEngine::go() {  	if (!dointro)  		g_music->initMusic(); -	openFont("P:AvanteG.12", &MsgFont); +	MsgFont = g_resource->getFont("P:AvanteG.12");  	mouseHide(); diff --git a/engines/lab/intro.cpp b/engines/lab/intro.cpp index 4f1720fe23..2ffddf7dc5 100644 --- a/engines/lab/intro.cpp +++ b/engines/lab/intro.cpp @@ -31,6 +31,7 @@  #include "lab/lab.h"  #include "lab/stddefines.h"  #include "lab/labfun.h" +#include "lab/resource.h"  #include "lab/timing.h"  #include "lab/diff.h"  #include "lab/text.h" @@ -352,7 +353,7 @@ void introSequence() {  	blackAllScreen();  	g_music->updateMusic(); -	getFont("P:Map.fon", msgfont); +	msgfont = g_resource->getFont("P:Map.fon");  	nopalchange = true;  	NReadPict("Intro.1", true); diff --git a/engines/lab/labfun.h b/engines/lab/labfun.h index 1db04a8c09..9ed334f431 100644 --- a/engines/lab/labfun.h +++ b/engines/lab/labfun.h @@ -99,7 +99,6 @@ uint32 flowTextToMem(Image *DestIm, void *font,     /* the TextAttr pointer */  void drawMessage(const char *text);  int32 longDrawMessage(const char *text); -bool readFont(char *filename, void *font, void *data);  /* The Wipes */ @@ -255,7 +254,6 @@ char *translateFileName(const char *filename);  void fade(bool fadein, uint16 res);  void setAmigaPal(uint16 *pal, uint16 numcolors);  char *getText(const char *filename); -bool getFont(const char *filename, TextFont *textfont);  void readImage(byte **buffer, Image **im);  void doMap(uint16 CurRoom);  void doJournal(); diff --git a/engines/lab/map.cpp b/engines/lab/map.cpp index 2e3dffc943..34eb018f94 100644 --- a/engines/lab/map.cpp +++ b/engines/lab/map.cpp @@ -37,6 +37,7 @@  #include "lab/mouse.h"  #include "lab/parsefun.h"  #include "lab/parsetypes.h" +#include "lab/resource.h"  #include "lab/interface.h"  #include "lab/text.h" @@ -74,44 +75,6 @@ void setAmigaPal(uint16 *pal, uint16 numcolors) {  } -/*****************************************************************************/ -/* Gets a font from disk and puts it into temporary memory.                  */ -/*****************************************************************************/ -bool getFont(const char *filename, TextFont *textfont) { -	byte **file = NULL; -	char header[5]; -	uint32 filesize, headersize = 4L + 2L + 256 * 3 + 4L; - -	file = g_music->newOpen(filename, filesize); -	g_music->updateMusic(); - -	if ((file != NULL) && (filesize > headersize)) { -		byte *fontbuffer = (byte *)stealBufMem(filesize - (sizeof(TextFont) + 4)); -		if (!fontbuffer) -			return false; - -		header[4] = 0; -		readBlock(&header, 4L, file); - -		if (strcmp(header, "VGAF") == 0) { -			textfont->DataLength = filesize - headersize; -			readBlock(&(textfont->Height), 2L, file); -			swapUShortPtr(&(textfont->Height), 1); - -			readBlock(textfont->Widths, 256L, file); -			readBlock(textfont->Offsets, 256L * 2L, file); -			swapUShortPtr(textfont->Offsets, 256); - -			(*file) += 4; -			textfont->data = fontbuffer; -			readBlock(textfont->data, textfont->DataLength, file); -			return true; -		} -	} - -	return false; -} -  /*****************************************************************************/  /* Gets a chunk of text and puts it into the graphics memory.                */ @@ -234,7 +197,7 @@ static bool loadMapData() {  	BigMsgFont = &bmf; -	if (!getFont("P:Map.fon", BigMsgFont)) +	if (!(BigMsgFont = g_resource->getFont("P:Map.fon")))  		BigMsgFont = MsgFont;  	resetBuffer();  /* Make images load into start of buffer */ diff --git a/engines/lab/special.cpp b/engines/lab/special.cpp index bedf7215d0..b7f14729a9 100644 --- a/engines/lab/special.cpp +++ b/engines/lab/special.cpp @@ -44,6 +44,7 @@  #include "lab/timing.h"  #include "lab/stddefines.h"  #include "lab/parsetypes.h" +#include "lab/resource.h"  namespace Lab { @@ -474,7 +475,7 @@ void doNotes() {  	/* Load in the data */  	BigMsgFont = &bmfont; -	if (!getFont("P:Note.fon", BigMsgFont)) { +	if (!(BigMsgFont = g_resource->getFont("P:Note.fon"))) {  		BigMsgFont = NULL;  		return;  	} @@ -500,7 +501,7 @@ void doWestPaper() {  	BigMsgFont = &bmfont; -	if (!getFont("P:News22.fon", BigMsgFont)) { +	if (!(BigMsgFont = g_resource->getFont("P:News22.fon"))) {  		BigMsgFont = NULL;  		return;  	} @@ -512,7 +513,7 @@ void doWestPaper() {  	BigMsgFont = &bmfont; -	if (!getFont("P:News32.fon", BigMsgFont)) { +	if (!(BigMsgFont = g_resource->getFont("P:News32.fon"))) {  		BigMsgFont = NULL;  		return;  	} @@ -531,7 +532,7 @@ void doWestPaper() {  	BigMsgFont = &bmfont; -	if (!getFont("P:Note.fon", BigMsgFont)) { +	if (!(BigMsgFont = g_resource->getFont("P:Note.fon"))) {  		BigMsgFont = NULL;  		return;  	} @@ -562,7 +563,7 @@ static bool loadJournalData() {  	BigMsgFont = &bmfont; -	if (!getFont("P:Journal.fon", BigMsgFont)) { +	if (!(BigMsgFont = g_resource->getFont("P:Journal.fon"))) {  		BigMsgFont = NULL;  		return false;  	} @@ -1071,7 +1072,7 @@ void doMonitor(char *background, char *textfile, bool isinteractive, uint16 x1,  	BigMsgFont = &bmfont; -	if (!getFont("P:Map.fon", BigMsgFont)) { +	if (!(BigMsgFont = g_resource->getFont("P:Map.fon"))) {  		freeAllStolenMem();  		BigMsgFont = NULL;  		return; diff --git a/engines/lab/text.cpp b/engines/lab/text.cpp index f31515fa5f..807df45a04 100644 --- a/engines/lab/text.cpp +++ b/engines/lab/text.cpp @@ -38,52 +38,12 @@ namespace Lab {  extern uint32 VGAScreenWidth, VGABytesPerPage;  /*****************************************************************************/ -/* Opens up a font from disk.                                                */ -/*****************************************************************************/ -bool openFont(const char *TextFontPath, struct TextFont **tf) { -	byte **file = NULL; -	char header[5]; -	uint32 filesize, headersize = 4L + 2L + 256 * 3 + 4L; - -	if ((*tf = (TextFont *)calloc(sizeof(struct TextFont), 1))) { -		file = g_music->newOpen(TextFontPath, filesize); - -		if ((file != NULL) && (filesize > headersize)) { -			header[4] = 0; -			readBlock(&header, 4L, file); - -			if (strcmp(header, "VGAF") == 0) { -				(*tf)->DataLength = filesize - headersize; -				readBlock(&((*tf)->Height), 2L, file); -				swapUShortPtr(&((*tf)->Height), 1); - -				readBlock((*tf)->Widths, 256L, file); -				readBlock((*tf)->Offsets, 256L * 2L, file); -				swapUShortPtr((*tf)->Offsets, 256); - -				(*file) += 4; - -				if (((*tf)->data = (byte *)calloc((*tf)->DataLength, 1))) { -					readBlock((*tf)->data, (*tf)->DataLength, file); -					return true; -				} -			} -		} - -		free(*tf); -	} - -	*tf = NULL; -	return false; -} - -/*****************************************************************************/  /* Closes a font and frees all memory associated with it.                    */  /*****************************************************************************/  void closeFont(struct TextFont *tf) {  	if (tf) {  		if (tf->data && tf->DataLength) -			free(tf->data); +			delete[] tf->data;  		free(tf);  	} diff --git a/engines/lab/text.h b/engines/lab/text.h index 333f449203..8d171b2094 100644 --- a/engines/lab/text.h +++ b/engines/lab/text.h @@ -52,7 +52,6 @@ struct TextFont {  #pragma pack(pop)  #endif -bool openFont(const char *TextFontPath, TextFont **tf);  void closeFont(TextFont *tf);  uint16 textLength(TextFont *tf, const char *text, uint16 numchars);  uint16 textHeight(TextFont *tf);  | 
