From 414b3c47146ebcc684fb37bccbbb66ff2ac68e2d Mon Sep 17 00:00:00 2001 From: yinsimei Date: Mon, 5 Jun 2017 08:34:20 +0200 Subject: SLUDGE: text display --- engines/sludge/sprites.cpp | 26 +++++++++++++++++--------- engines/sludge/sprites.h | 1 + engines/sludge/talk.cpp | 4 ---- engines/sludge/talk.h | 2 -- 4 files changed, 18 insertions(+), 15 deletions(-) (limited to 'engines/sludge') diff --git a/engines/sludge/sprites.cpp b/engines/sludge/sprites.cpp index ef6d5218e3..936bb67a6c 100644 --- a/engines/sludge/sprites.cpp +++ b/engines/sludge/sprites.cpp @@ -181,6 +181,9 @@ bool loadSpriteBank(int fileNum, spriteBank &loadhere, bool isFont) { // init data loadhere.sprites[i].surface.create(picwidth, picheight, Graphics::PixelFormat(4, 8, 8, 8, 8, 24, 16, 8, 0)); + if (isFont) { + loadhere.sprites[i].burnSurface.create(picwidth, picheight, Graphics::PixelFormat(4, 8, 8, 8, 8, 24, 16, 8, 0)); + } data = (byte *)new byte[picwidth * (picheight + 1)]; if (!checkNew(data)) return false; int ooo = picwidth * picheight; @@ -260,9 +263,9 @@ bool loadSpriteBank(int fileNum, spriteBank &loadhere, bool isFont) { target[3] = (byte)loadhere.myPalette.r[transColour]; } if (isFont) { - target = (byte *)loadhere.sprites[i].surface.getBasePtr(x, y); + target = (byte *)loadhere.sprites[i].burnSurface.getBasePtr(x, y); if (s) - target[0] = loadhere.myPalette.r[s]; + target[0] = loadhere.myPalette.r[s]; target[1] = (byte)255; target[2] = (byte)255; target[3] = (byte)255; @@ -490,20 +493,25 @@ void burnSpriteToBackDrop(int x1, int y1, sprite &single, extern GLuint backdropTextureName; #endif -void fontSprite(bool flip, int x, int y, sprite &single, - const spritePalette &fontPal) { +void fontSprite(bool flip, int x, int y, sprite &single, const spritePalette &fontPal) { + float x1 = (float) x - (float) single.xhot / cameraZoom; + float y1 = (float) y - (float) single.yhot / cameraZoom; + + // Use Transparent surface to scale and blit + Graphics::TransparentSurface tmp(single.surface, false); + Graphics::TransparentSurface tmp2(single.burnSurface, false); + tmp.blit(renderSurface, x1, y1, (flip? Graphics::FLIP_H : Graphics::FLIP_NONE)); + tmp2.blit(renderSurface, x1, y1, (flip? Graphics::FLIP_H : Graphics::FLIP_NONE), 0, TS_RGB(fontPal.originalRed, fontPal.originalGreen, fontPal.originalBlue)); + #if 0 + float x2 = x1 + (float) single.surface.w / cameraZoom; + float y2 = y1 + (float) single.surface.h / cameraZoom; float tx1 = (float) (single.tex_x - 0.5) / fontPal.tex_w[single.texNum]; float ty1 = 0.0; float tx2 = (float) (single.tex_x + single.width + (flip ? 1.0 : 0.5)) / fontPal.tex_w[single.texNum]; float ty2 = (float) (single.height + 2) / fontPal.tex_h[single.texNum]; - float x1 = (float) x - (float) single.xhot / cameraZoom; - float y1 = (float) y - (float) single.yhot / cameraZoom; - float x2 = x1 + (float) single.width / cameraZoom; - float y2 = y1 + (float) single.height / cameraZoom; - GLfloat vertices[] = { x1, y1, 0.0f, x2, y1, 0.0f, diff --git a/engines/sludge/sprites.h b/engines/sludge/sprites.h index efc0fcc7ad..c09ae39d02 100644 --- a/engines/sludge/sprites.h +++ b/engines/sludge/sprites.h @@ -31,6 +31,7 @@ struct onScreenPerson; struct sprite { int xhot, yhot; Graphics::Surface surface; + Graphics::Surface burnSurface; }; class spritePalette { diff --git a/engines/sludge/talk.cpp b/engines/sludge/talk.cpp index 0b66815a35..86e2174e0e 100644 --- a/engines/sludge/talk.cpp +++ b/engines/sludge/talk.cpp @@ -78,9 +78,7 @@ void killAllSpeech() { #define TF_min(a, b) ((a > b) ? b : a) inline void setObjFontColour(objectType *t) { -#if 0 setFontColour(speech->talkCol, t->r, t->g, t->b); -#endif } void addSpeechLine(char *theLine, int x, int &offset) { @@ -203,7 +201,6 @@ int wrapSpeech(char *theText, int objT, int sampleFile, bool animPerson) { } void viewSpeech() { -#if 0 int viewY = speech->speechY; speechLine *viewLine = speech->allSpeech; fixFont(speech->talkCol); @@ -212,7 +209,6 @@ void viewSpeech() { viewY -= fontHeight / cameraZoom; viewLine = viewLine->next; } -#endif } void saveSpeech(speechStruct *sS, Common::WriteStream *stream) { diff --git a/engines/sludge/talk.h b/engines/sludge/talk.h index 5e32def11e..39da742062 100644 --- a/engines/sludge/talk.h +++ b/engines/sludge/talk.h @@ -36,9 +36,7 @@ struct speechStruct { onScreenPerson *currentTalker; speechLine *allSpeech; int speechY, lastFile, lookWhosTalking; -#if 0 spritePalette talkCol; -#endif }; int wrapSpeech(char *theText, int objT, int sampleFile, bool); -- cgit v1.2.3