[Scummvm-git-logs] scummvm master -> 9d6087f27e730647e876a35c4e7bca56204fa499

Strangerke noreply at scummvm.org
Mon Jan 13 21:16:58 UTC 2025


This automated email contains information about 1 new commit which have been
pushed to the 'scummvm' repo located at https://github.com/scummvm/scummvm .

Summary:
9d6087f27e GOT: more global array access and code formating in views


Commit: 9d6087f27e730647e876a35c4e7bca56204fa499
    https://github.com/scummvm/scummvm/commit/9d6087f27e730647e876a35c4e7bca56204fa499
Author: Strangerke (arnaud.boutonne at gmail.com)
Date: 2025-01-13T22:16:49+01:00

Commit Message:
GOT: more global array access and code formating in views

Changed paths:
    engines/got/views/opening.cpp
    engines/got/views/opening.h
    engines/got/views/part_title.cpp
    engines/got/views/part_title.h
    engines/got/views/splash_screen.cpp
    engines/got/views/splash_screen.h
    engines/got/views/story.cpp
    engines/got/views/story.h
    engines/got/views/title_background.cpp
    engines/got/views/title_background.h
    engines/got/views/view.cpp
    engines/got/views/view.h
    engines/got/views/views.h


diff --git a/engines/got/views/opening.cpp b/engines/got/views/opening.cpp
index 71f479998be..78626fd45b2 100644
--- a/engines/got/views/opening.cpp
+++ b/engines/got/views/opening.cpp
@@ -29,89 +29,83 @@ namespace Views {
 int ctr = 0;
 
 void Opening::draw() {
-    GfxSurface s = getSurface();
-
-    if (_shakeX == 0) {
-        s.blitFrom(_surface, Common::Rect(0, 0, 320, 400), Common::Rect(0, 0, 320, 240));
-    } else {
-        s.clear();
-        Common::Rect destRect(0, 0, 320, 240);
-        destRect.translate(_shakeX, 0);
-        s.blitFrom(_surface, Common::Rect(0, 0, 320, 400), destRect);
-    }
+	GfxSurface s = getSurface();
+
+	if (_shakeX == 0) {
+		s.blitFrom(_surface, Common::Rect(0, 0, 320, 400), Common::Rect(0, 0, 320, 240));
+	} else {
+		s.clear();
+		Common::Rect destRect(0, 0, 320, 240);
+		destRect.translate(_shakeX, 0);
+		s.blitFrom(_surface, Common::Rect(0, 0, 320, 400), destRect);
+	}
 }
 
 bool Opening::msgFocus(const FocusMessage &msg) {
-    const byte *src;
-    byte *dest;
+	_surface.create(320, 400);
+	for (int chunkNum = 0; chunkNum < 4; ++chunkNum) {
+		const byte *src = _G(gfx[36 + chunkNum])._data;
+		byte *dest = (byte *)_surface.getBasePtr(chunkNum, 0);
 
-    _surface.create(320, 400);
-    for (int chunkNum = 0; chunkNum < 4; ++chunkNum) {
-        src = _G(gfx)[36 + chunkNum]._data;
-        dest = (byte *)_surface.getBasePtr(chunkNum, 0);
+		for (int i = 0; i < (320 * 400 / 4); ++i, ++src, dest += 4)
+			*dest = *src;
+	}
 
-        for (int i = 0; i < (320 * 400 / 4); ++i, ++src, dest += 4)
-            *dest = *src;
-    }
+	// Fade in the screen
+	Gfx::Palette63 pal = _G(gfx[35]);
+	draw();
+	fadeIn(pal);
 
-    // Fade in the screen
-    Gfx::Palette63 pal = _G(gfx)[35];
-    draw();
-    fadeIn(pal);
-
-    return true;
+	return true;
 }
 
 void Opening::drawTitle() {
-    const byte *src;
-    byte *dest;
-
-    src = _G(gfx)[40]._data;
+	const byte *src = _G(gfx[40])._data;
 
-    for (int pane = 0; pane < 4; ++pane) {
-        dest = (byte *)_surface.getBasePtr(pane, 0);
+	for (int pane = 0; pane < 4; ++pane) {
+		byte *dest = (byte *)_surface.getBasePtr(pane, 0);
 
-        for (int i = 0; i < (320 * 80 / 4); ++i, ++src, dest += 4)
-            *dest = *src;
-    }
+		for (int i = 0; i < (320 * 80 / 4); ++i, ++src, dest += 4)
+			*dest = *src;
+	}
 }
 
 bool Opening::msgUnfocus(const UnfocusMessage &msg) {
-    _surface.clear();
-    return true;
+	_surface.clear();
+	return true;
 }
 
 bool Opening::msgAction(const ActionMessage &msg) {
-    if (msg._action == KEYBIND_ESCAPE) {
-        fadeOut();
-        send("TitleBackground", GameMessage("MAIN_MENU"));
-        return true;
-    }
+	if (msg._action == KEYBIND_ESCAPE) {
+		fadeOut();
+		send("TitleBackground", GameMessage("MAIN_MENU"));
+		return true;
+	}
 
-    return false;
+	return false;
 }
 
 bool Opening::tick() {
-    ++_frameCtr;
-
-    if (_frameCtr == 20) {
-        drawTitle();
-        redraw();
-        play_sound(_G(gfx)[104]);
-    } else if (_frameCtr < 40) {
-        if ((_frameCtr % 4) == 0) {
-            _shakeX = g_engine->getRandomNumber(19) - 10;
-            redraw();
-        }
-    } else if (_frameCtr == 41) {
-        _shakeX = 0;
-        redraw();
-    } else if (_frameCtr == 150) {
-        fadeOut();
-        replaceView("Credits", true);
-    }
-
-    return true;
+	++_frameCtr;
+
+	if (_frameCtr == 20) {
+		drawTitle();
+		redraw();
+		play_sound(_G(gfx[104]));
+	} else if (_frameCtr < 40) {
+		if ((_frameCtr % 4) == 0) {
+			_shakeX = g_engine->getRandomNumber(19) - 10;
+			redraw();
+		}
+	} else if (_frameCtr == 41) {
+		_shakeX = 0;
+		redraw();
+	} else if (_frameCtr == 150) {
+		fadeOut();
+		replaceView("Credits", true);
+	}
+
+	return true;
 }
 
 } // namespace Views
diff --git a/engines/got/views/opening.h b/engines/got/views/opening.h
index 8209dffebc7..b0123cf3e27 100644
--- a/engines/got/views/opening.h
+++ b/engines/got/views/opening.h
@@ -29,21 +29,21 @@ namespace Views {
 
 class Opening : public View {
 private:
-    Graphics::ManagedSurface _surface;
-    int _frameCtr = 0;
-    int _shakeX = 0;
+	Graphics::ManagedSurface _surface;
+	int _frameCtr = 0;
+	int _shakeX = 0;
 
-    void drawTitle();
+	void drawTitle();
 
 public:
-    Opening() : View("Opening") {}
-    virtual ~Opening() {}
-
-    bool msgFocus(const FocusMessage &msg) override;
-    bool msgUnfocus(const UnfocusMessage &msg) override;
-    bool msgAction(const ActionMessage &msg) override;
-    void draw() override;
-    bool tick() override;
+	Opening() : View("Opening") {}
+	virtual ~Opening() {}
+
+	bool msgFocus(const FocusMessage &msg) override;
+	bool msgUnfocus(const UnfocusMessage &msg) override;
+	bool msgAction(const ActionMessage &msg) override;
+	void draw() override;
+	bool tick() override;
 };
 
 } // namespace Views
diff --git a/engines/got/views/part_title.cpp b/engines/got/views/part_title.cpp
index 4c89fc7b945..d63952c8e01 100644
--- a/engines/got/views/part_title.cpp
+++ b/engines/got/views/part_title.cpp
@@ -27,43 +27,43 @@ namespace Got {
 namespace Views {
 
 void PartTitle::draw() {
-    GfxSurface s = getSurface();
-    s.clear();
-    s.print(Common::Point(13 * 8, 13 * 8), "God of Thunder", 14);
+	GfxSurface s = getSurface();
+	s.clear();
+	s.print(Common::Point(13 * 8, 13 * 8), "God of Thunder", 14);
 
-    switch (_G(area)) {
-    case 1:
-        s.print(Common::Point(8 * 8, 15 * 8), "Part I: Serpent Surprise", 32);
-        break;
-    case 2:
-        s.print(Common::Point(7 * 8, 15 * 8), "Part II: Non-Stick Nognir", 32);
-        break;
-    case 3:
-        s.print(Common::Point(7 * 8, 15 * 8), "Part III: Lookin' for Loki", 32);
-        break;
-    default:
-        break;
-    }
+	switch (_G(area)) {
+	case 1:
+		s.print(Common::Point(8 * 8, 15 * 8), "Part I: Serpent Surprise", 32);
+		break;
+	case 2:
+		s.print(Common::Point(7 * 8, 15 * 8), "Part II: Non-Stick Nognir", 32);
+		break;
+	case 3:
+		s.print(Common::Point(7 * 8, 15 * 8), "Part III: Lookin' for Loki", 32);
+		break;
+	default:
+		break;
+	}
 }
 
 bool PartTitle::msgAction(const ActionMessage &msg) {
-    if (msg._action == KEYBIND_ESCAPE)
-        done();
+	if (msg._action == KEYBIND_ESCAPE)
+		done();
 
-    return true;
+	return true;
 }
 
 bool PartTitle::tick() {
-    if (++_timeoutCtr == 80) {
-        _timeoutCtr = 0;
-        done();
-    }
+	if (++_timeoutCtr == 80) {
+		_timeoutCtr = 0;
+		done();
+	}
 
-    return true;
+	return true;
 }
 
 void PartTitle::done() {
-    replaceView("Game", true, true);
+	replaceView("Game", true, true);
 }
 
 } // namespace Views
diff --git a/engines/got/views/part_title.h b/engines/got/views/part_title.h
index 3969cbdd4fd..12cdea230b4 100644
--- a/engines/got/views/part_title.h
+++ b/engines/got/views/part_title.h
@@ -29,17 +29,17 @@ namespace Views {
 
 class PartTitle : public View {
 private:
-    int _timeoutCtr = 0;
+	int _timeoutCtr = 0;
 
-    void done();
+	void done();
 
 public:
-    PartTitle() : View("PartTitle") {}
-    virtual ~PartTitle() {}
+	PartTitle() : View("PartTitle") {}
+	virtual ~PartTitle() {}
 
-    bool msgAction(const ActionMessage &msg) override;
-    void draw() override;
-    bool tick() override;
+	bool msgAction(const ActionMessage &msg) override;
+	void draw() override;
+	bool tick() override;
 };
 
 } // namespace Views
diff --git a/engines/got/views/splash_screen.cpp b/engines/got/views/splash_screen.cpp
index 5f287e79d74..702b905576d 100644
--- a/engines/got/views/splash_screen.cpp
+++ b/engines/got/views/splash_screen.cpp
@@ -19,8 +19,8 @@
  *
  */
 
-#include "common/file.h"
 #include "got/views/splash_screen.h"
+#include "common/file.h"
 #include "got/gfx/palette.h"
 #include "got/vars.h"
 
@@ -30,135 +30,135 @@ namespace Views {
 #define SPLASH_FRAME_INTERVAL 2
 
 void SplashScreen::draw() {
-    if (_frameCtr == -1) {
-        _frameCtr = 0;
-        GfxSurface s = getSurface();
-
-        // Display background. The rest of the logo animation will be
-        // done in the frame routines called from tick
-        s.clear();
-        s.simpleBlitFrom(_G(gfx)[92], Common::Point(0, 24));
-    }
+	if (_frameCtr == -1) {
+		_frameCtr = 0;
+		GfxSurface s = getSurface();
+
+		// Display background. The rest of the logo animation will be
+		// done in the frame routines called from tick
+		s.clear();
+		s.simpleBlitFrom(_G(gfx[92]), Common::Point(0, 24));
+	}
 }
 
 bool SplashScreen::msgFocus(const FocusMessage &msg) {
-    auto chunk = _G(gfx)[93];
-    _frameCount = READ_LE_UINT16(chunk._data);
-    _chunkSize = chunk._data + 2;
-    _chunkPtr = chunk._data + 2 + _frameCount * 4;
+	Gfx::GraphicChunk chunk = _G(gfx[93]);
+	_frameCount = READ_LE_UINT16(chunk._data);
+	_chunkSize = chunk._data + 2;
+	_chunkPtr = chunk._data + 2 + _frameCount * 4;
 
-    _frameCtr = -1;
-    _delayCtr = 0;
+	_frameCtr = -1;
+	_delayCtr = 0;
 
-    // This is the first screen shown, so start with black, and fade it in
-    byte blackPal[PALETTE_SIZE];
-    Common::fill(blackPal, blackPal + PALETTE_SIZE, 0);
-    Gfx::xsetpal(blackPal);
+	// This is the first screen shown, so start with black, and fade it in
+	byte blackPal[PALETTE_SIZE];
+	Common::fill(blackPal, blackPal + PALETTE_SIZE, 0);
+	Gfx::xsetpal(blackPal);
 
-    draw();
-    Gfx::Palette63 pal = _G(gfx)[91];
-    Gfx::fade_in(pal);
+	draw();
+	Gfx::Palette63 pal = _G(gfx[91]);
+	Gfx::fade_in(pal);
 
-    return true;
+	return true;
 }
 
 bool SplashScreen::msgUnfocus(const UnfocusMessage &msg) {
-    fadeOut();
-    return true;
+	fadeOut();
+	return true;
 }
 
 bool SplashScreen::tick() {
-    if (++_delayCtr == SPLASH_FRAME_INTERVAL) {
-        _delayCtr = 0;
-
-        if (++_frameCtr < _frameCount) {
-            GfxSurface s = getSurface();
-            byte *dest = (byte *)s.getBasePtr(0, 24);
-            executeFrame(_chunkPtr, dest);
-            s.markAllDirty();
-
-            _chunkPtr += READ_LE_UINT32(_chunkSize);
-            _chunkSize += 4;
-        } else if (_frameCtr == (_frameCount + 50)) {
-            // Switch to the opening screen showing the game name
-            replaceView("Opening", true);
-        }
-    }
-
-    return true;
+	if (++_delayCtr == SPLASH_FRAME_INTERVAL) {
+		_delayCtr = 0;
+
+		if (++_frameCtr < _frameCount) {
+			GfxSurface s = getSurface();
+			byte *dest = (byte *)s.getBasePtr(0, 24);
+			executeFrame(_chunkPtr, dest);
+			s.markAllDirty();
+
+			_chunkPtr += READ_LE_UINT32(_chunkSize);
+			_chunkSize += 4;
+		} else if (_frameCtr == (_frameCount + 50)) {
+			// Switch to the opening screen showing the game name
+			replaceView("Opening", true);
+		}
+	}
+
+	return true;
 }
 int frame = -1;
 
 void SplashScreen::executeFrame(const byte *src, byte *dest) {
-    const byte *codeP = src;
-    int count = 0;
-    int val = 0;
-
-    while (*codeP != 0xcb) {
-        if (codeP[0] == 0xc9) {
-            // leave
-            codeP++;
-        } else if (codeP[0] == 0x33 && codeP[1] == 0xc9) {
-            // xor cx, cx
-            count = 0;
-            codeP += 2;
-        } else if (codeP[0] == 0x81 && codeP[1] == 0xc6) {
-            // add si, 16-bit
-            src += READ_LE_INT16(codeP + 2);
-            codeP += 4;
-        } else if (codeP[0] == 0x81 && codeP[1] == 0xee) {
-            // sub si, 16-bit
-            src -= READ_LE_INT16(codeP + 2);
-            codeP += 4;
-        } else if (codeP[0] == 0x8b && codeP[1] == 0xdf) {
-            // mov bx, di
-            codeP += 2;
-        } else if (codeP[0] == 0x81 && codeP[1] == 0xc7) {
-            // add di, 16-bit
-            dest += READ_LE_INT16(codeP + 2);
-            codeP += 4;
-        } else if (codeP[0] == 0xb8) {
-            // mov ax, 16-bit
-            val = READ_LE_UINT16(codeP + 1);
-            codeP += 3;
-        } else if (codeP[0] == 0xb0) {
-            // mov al, 8-bit
-            val = codeP[1];
-            codeP += 2;
-        } else if (codeP[0] == 0xb1) {
-            // mov cl, 8-bit
-            count = codeP[1];
-            codeP += 2;
-        } else if (codeP[0] == 0xf3 && codeP[1] == 0xab) {
-            // rep stosw
-            while (count-- > 0) {
-                WRITE_LE_UINT16(dest, val);
-                dest += 2;
-            }
-            codeP += 2;
-        } else if (codeP[0] == 0xab) {
-            // stosw
-            WRITE_LE_UINT16(dest, val);
-            dest += 2;
-            codeP++;
-        } else if (codeP[0] == 0xaa) {
-            // stosb
-            *dest++ = (byte)val;
-            ++codeP;
-        } else if (codeP[0] == 0xf3 && codeP[1] == 0xa5) {
-            // rep movsw
-            Common::copy(src, src + count * 2, dest);
-            src += count * 2;
-            dest += count * 2;
-            codeP += 2;
-        } else if (codeP[0] == 0xa4) {
-            // movsb
-            *dest++ = *src++;
-            ++codeP;
-        } else {
-            error("Unhandled opcode");
-        }
-    }
+	const byte *codeP = src;
+	int count = 0;
+	int val = 0;
+
+	while (*codeP != 0xcb) {
+		if (codeP[0] == 0xc9) {
+			// leave
+			codeP++;
+		} else if (codeP[0] == 0x33 && codeP[1] == 0xc9) {
+			// xor cx, cx
+			count = 0;
+			codeP += 2;
+		} else if (codeP[0] == 0x81 && codeP[1] == 0xc6) {
+			// add si, 16-bit
+			src += READ_LE_INT16(codeP + 2);
+			codeP += 4;
+		} else if (codeP[0] == 0x81 && codeP[1] == 0xee) {
+			// sub si, 16-bit
+			src -= READ_LE_INT16(codeP + 2);
+			codeP += 4;
+		} else if (codeP[0] == 0x8b && codeP[1] == 0xdf) {
+			// mov bx, di
+			codeP += 2;
+		} else if (codeP[0] == 0x81 && codeP[1] == 0xc7) {
+			// add di, 16-bit
+			dest += READ_LE_INT16(codeP + 2);
+			codeP += 4;
+		} else if (codeP[0] == 0xb8) {
+			// mov ax, 16-bit
+			val = READ_LE_UINT16(codeP + 1);
+			codeP += 3;
+		} else if (codeP[0] == 0xb0) {
+			// mov al, 8-bit
+			val = codeP[1];
+			codeP += 2;
+		} else if (codeP[0] == 0xb1) {
+			// mov cl, 8-bit
+			count = codeP[1];
+			codeP += 2;
+		} else if (codeP[0] == 0xf3 && codeP[1] == 0xab) {
+			// rep stosw
+			while (count-- > 0) {
+				WRITE_LE_UINT16(dest, val);
+				dest += 2;
+			}
+			codeP += 2;
+		} else if (codeP[0] == 0xab) {
+			// stosw
+			WRITE_LE_UINT16(dest, val);
+			dest += 2;
+			codeP++;
+		} else if (codeP[0] == 0xaa) {
+			// stosb
+			*dest++ = (byte)val;
+			++codeP;
+		} else if (codeP[0] == 0xf3 && codeP[1] == 0xa5) {
+			// rep movsw
+			Common::copy(src, src + count * 2, dest);
+			src += count * 2;
+			dest += count * 2;
+			codeP += 2;
+		} else if (codeP[0] == 0xa4) {
+			// movsb
+			*dest++ = *src++;
+			++codeP;
+		} else {
+			error("Unhandled opcode");
+		}
+	}
 }
 
 } // namespace Views
diff --git a/engines/got/views/splash_screen.h b/engines/got/views/splash_screen.h
index 34fd728f74b..453ecd42346 100644
--- a/engines/got/views/splash_screen.h
+++ b/engines/got/views/splash_screen.h
@@ -29,21 +29,21 @@ namespace Views {
 
 class SplashScreen : public View {
 private:
-    const byte *_chunkSize = nullptr;
-    const byte *_chunkPtr = nullptr;
+	const byte *_chunkSize = nullptr;
+	const byte *_chunkPtr = nullptr;
 	int _frameCount = 0;
-    int _delayCtr = 0, _frameCtr = 0;
+	int _delayCtr = 0, _frameCtr = 0;
 
-    void executeFrame(const byte *src, byte *dest);
+	void executeFrame(const byte *src, byte *dest);
 
 public:
-    SplashScreen() : View("SplashScreen") {}
-    virtual ~SplashScreen() {}
+	SplashScreen() : View("SplashScreen") {}
+	virtual ~SplashScreen() {}
 
-    bool msgFocus(const FocusMessage &msg) override;
-    bool msgUnfocus(const UnfocusMessage &msg) override;
-    void draw() override;
-    bool tick() override;
+	bool msgFocus(const FocusMessage &msg) override;
+	bool msgUnfocus(const UnfocusMessage &msg) override;
+	void draw() override;
+	bool tick() override;
 };
 
 } // namespace Views
diff --git a/engines/got/views/story.cpp b/engines/got/views/story.cpp
index 2408178ecfd..2a656a5ec94 100644
--- a/engines/got/views/story.cpp
+++ b/engines/got/views/story.cpp
@@ -21,8 +21,8 @@
 
 #include "got/views/story.h"
 #include "got/gfx/palette.h"
-#include "got/utils/file.h"
 #include "got/metaengine.h"
+#include "got/utils/file.h"
 #include "got/vars.h"
 
 namespace Got {
@@ -31,67 +31,67 @@ namespace Views {
 #define MAX_Y 236
 
 bool Story::msgFocus(const FocusMessage &msg) {
-    res_read(Common::String::format("STORY%d", _G(area)), _G(tmp_buff));
-
-    res_read("STORYPAL", _G(pbuff));
-
-    for (int i = 0; i < PALETTE_SIZE; ++i)
-        _G(pbuff)[i] = ((int)_G(pbuff)[i] * 255 + 31) / 63;
-    Gfx::set_palette(_G(pbuff));
-
-    // Create story image and load in it's fragments
-    _surface.create(320, 240 * 2);
-
-    for (int i = 0; i < 12; i++) {
-        Gfx::Pics pics(Common::String::format("OPENP%d", i + 1));
-        pics.load();
-
-        _surface.simpleBlitFrom(pics[0], Common::Point(0, i * 40));
-    }
-
-    // Set up the story text
-    int i = 0;
-    int x = 8, y = 2;
-    byte color = 72;
-    char s[21];
-
-    const char *p = (const char *)_G(tmp_buff);
-
-    while (i < 46) {
-        if (*p == '\n') {
-            x = 8;
-            y += 10;
-            i++;
-
-            if (i == 23) {
-                // Move to start of of "second page" of the surface
-                y = 240 + 2;
-            }
-        } else if (*p == '/' && *(p + 4) == '/') {
-            p++;
-            s[0] = *p++;
-            s[1] = *p++;
-            s[2] = *p++;
-            s[3] = 0;
-            color = atoi(s);
-        } else if (*p != '\r') {
-            _surface.rawPrintChar(*p, x - 1, y - 1, 255);
-            _surface.rawPrintChar(*p, x + 1, y + 1, 255);
-            _surface.rawPrintChar(*p, x - 1, y + 1, 255);
-            _surface.rawPrintChar(*p, x + 1, y - 1, 255);
-            _surface.rawPrintChar(*p, x, y - 1, 255);
-            _surface.rawPrintChar(*p, x, y + 1, 255);
-            _surface.rawPrintChar(*p, x - 1, y, 255);
-            _surface.rawPrintChar(*p, x + 1, y, 255);
+	res_read(Common::String::format("STORY%d", _G(area)), _G(tmp_buff));
+
+	res_read("STORYPAL", _G(pbuff));
+
+	for (int i = 0; i < PALETTE_SIZE; ++i)
+		_G(pbuff[i]) = ((int)_G(pbuff[i]) * 255 + 31) / 63;
+	Gfx::set_palette(_G(pbuff));
+
+	// Create story image and load in it's fragments
+	_surface.create(320, 240 * 2);
+
+	for (int i = 0; i < 12; i++) {
+		Gfx::Pics pics(Common::String::format("OPENP%d", i + 1));
+		pics.load();
+
+		_surface.simpleBlitFrom(pics[0], Common::Point(0, i * 40));
+	}
+
+	// Set up the story text
+	int i = 0;
+	int x = 8, y = 2;
+	byte color = 72;
+	char s[21];
+
+	const char *p = (const char *)_G(tmp_buff);
+
+	while (i < 46) {
+		if (*p == '\n') {
+			x = 8;
+			y += 10;
+			i++;
+
+			if (i == 23) {
+				// Move to start of of "second page" of the surface
+				y = 240 + 2;
+			}
+		} else if (*p == '/' && *(p + 4) == '/') {
+			p++;
+			s[0] = *p++;
+			s[1] = *p++;
+			s[2] = *p++;
+			s[3] = 0;
+			color = atoi(s);
+		} else if (*p != '\r') {
+			_surface.rawPrintChar(*p, x - 1, y - 1, 255);
+			_surface.rawPrintChar(*p, x + 1, y + 1, 255);
+			_surface.rawPrintChar(*p, x - 1, y + 1, 255);
+			_surface.rawPrintChar(*p, x + 1, y - 1, 255);
+			_surface.rawPrintChar(*p, x, y - 1, 255);
+			_surface.rawPrintChar(*p, x, y + 1, 255);
+			_surface.rawPrintChar(*p, x - 1, y, 255);
+			_surface.rawPrintChar(*p, x + 1, y, 255);
 			_surface.rawPrintChar(*p, x, y, color);
-            x += 8;
-        }
+			x += 8;
+		}
 
-        p++;
-    }
+		p++;
+	}
 
-    // Final two glyphs
-    Gfx::Pics glyphs("STORYPIC", 262);
+	// Final two glyphs
+	Gfx::Pics glyphs("STORYPIC", 262);
 
 	if (_G(area) == 1) {
 		_surface.simpleBlitFrom(glyphs[0], Common::Point(146, 64));
@@ -100,68 +100,68 @@ bool Story::msgFocus(const FocusMessage &msg) {
 		_surface.simpleBlitFrom(glyphs[0], Common::Point(146, 16));
 	}
 
-    // Play the opening music
-    music_play("OPENSONG", 1);
+	// Play the opening music
+	music_play("OPENSONG", 1);
 
 	_yp = 0;
 	_scrolling = false;
 
-    return true;
+	return true;
 }
 
 bool Story::msgUnfocus(const UnfocusMessage &msg) {
-    _surface.clear();
-    music_pause();
+	_surface.clear();
+	music_pause();
 
-    return true;
+	return true;
 }
 
 void Story::draw() {
-    GfxSurface s = getSurface();
+	GfxSurface s = getSurface();
 
-    // Draw the currently visible part of the surface
-    s.simpleBlitFrom(_surface, Common::Rect(0, _yp, 320, _yp + 240),
-               Common::Point(0, 0));
+	// Draw the currently visible part of the surface
+	s.simpleBlitFrom(_surface, Common::Rect(0, _yp, 320, _yp + 240),
+					 Common::Point(0, 0));
 }
 
 bool Story::msgAction(const ActionMessage &msg) {
-    if (msg._action == KEYBIND_ESCAPE || _yp == MAX_Y)
-        done();
-    else if (!_scrolling)
-        _scrolling = true;
-    else
-        _yp = MAX_Y;
-
-    return true;
+	if (msg._action == KEYBIND_ESCAPE || _yp == MAX_Y)
+		done();
+	else if (!_scrolling)
+		_scrolling = true;
+	else
+		_yp = MAX_Y;
+
+	return true;
 }
 
 bool Story::msgKeypress(const KeypressMessage &msg) {
-    if (_yp == MAX_Y)
-        done();
-    else if (!_scrolling)
-        _scrolling = true;
-    else
-        _yp = 240;
-
-    return true;
+	if (_yp == MAX_Y)
+		done();
+	else if (!_scrolling)
+		_scrolling = true;
+	else
+		_yp = 240;
+
+	return true;
 }
 
 bool Story::tick() {
-    if (_scrolling && _yp < MAX_Y) {
-        _yp = MIN(_yp + 4, MAX_Y);
-        redraw();
-    }
+	if (_scrolling && _yp < MAX_Y) {
+		_yp = MIN(_yp + 4, MAX_Y);
+		redraw();
+	}
 
-    return true;
+	return true;
 }
 
 void Story::done() {
-    music_stop();
+	music_stop();
 
-    fadeOut();
-    Gfx::load_palette();
-    replaceView("PartTitle");
-    fadeIn();
+	fadeOut();
+	Gfx::load_palette();
+	replaceView("PartTitle");
+	fadeIn();
 }
 
 } // namespace Views
diff --git a/engines/got/views/story.h b/engines/got/views/story.h
index 45f2f5a4512..e528ef0ec08 100644
--- a/engines/got/views/story.h
+++ b/engines/got/views/story.h
@@ -22,7 +22,6 @@
 #ifndef GOT_VIEWS_STORY_H
 #define GOT_VIEWS_STORY_H
 
-#include "graphics/managed_surface.h"
 #include "got/views/view.h"
 
 namespace Got {
@@ -30,22 +29,22 @@ namespace Views {
 
 class Story : public View {
 private:
-    Gfx::GfxSurface _surface;
-    int _yp = 0;
-    bool _scrolling = false;
+	Gfx::GfxSurface _surface;
+	int _yp = 0;
+	bool _scrolling = false;
 
-    void done();
+	void done();
 
 public:
-    Story() : View("Story") {}
-    virtual ~Story() {}
-
-    bool msgFocus(const FocusMessage &msg) override;
-    bool msgUnfocus(const UnfocusMessage &msg) override;
-    bool msgAction(const ActionMessage &msg) override;
-    bool msgKeypress(const KeypressMessage &msg) override;
-    void draw() override;
-    bool tick() override;
+	Story() : View("Story") {}
+	virtual ~Story() {}
+
+	bool msgFocus(const FocusMessage &msg) override;
+	bool msgUnfocus(const UnfocusMessage &msg) override;
+	bool msgAction(const ActionMessage &msg) override;
+	bool msgKeypress(const KeypressMessage &msg) override;
+	void draw() override;
+	bool tick() override;
 };
 
 } // namespace Views
diff --git a/engines/got/views/title_background.cpp b/engines/got/views/title_background.cpp
index c26e00d2f53..afc9ff24bd1 100644
--- a/engines/got/views/title_background.cpp
+++ b/engines/got/views/title_background.cpp
@@ -26,26 +26,26 @@ namespace Got {
 namespace Views {
 
 bool TitleBackground::msgGame(const GameMessage &msg) {
-    if (msg._name == "MAIN_MENU") {
-        replaceView("TitleBackground", true);
-        draw();
-        Gfx::load_palette();
-        fadeIn();
+	if (msg._name == "MAIN_MENU") {
+		replaceView("TitleBackground", true);
+		draw();
+		Gfx::load_palette();
+		fadeIn();
 
-        addView("MainMenu");
-        return true;
-    }
+		addView("MainMenu");
+		return true;
+	}
 
-    return false;
+	return false;
 }
 
 void TitleBackground::draw() {
-    GfxSurface s = getSurface();
+	GfxSurface s = getSurface();
 
-    for (int col = 0, xp = 0; col < 10; ++col, xp += 32) {
-        for (int yp = 0; yp < 240; yp += 32)
-            s.simpleBlitFrom(_G(gfx)[26], Common::Point(xp, yp));
-    }
+	for (int col = 0, xp = 0; col < 10; ++col, xp += 32) {
+		for (int yp = 0; yp < 240; yp += 32)
+			s.simpleBlitFrom(_G(gfx)[26], Common::Point(xp, yp));
+	}
 }
 
 } // namespace Views
diff --git a/engines/got/views/title_background.h b/engines/got/views/title_background.h
index bebba098084..5c3512d1714 100644
--- a/engines/got/views/title_background.h
+++ b/engines/got/views/title_background.h
@@ -22,7 +22,6 @@
 #ifndef GOT_VIEWS_TITLE_BACKGROUND_H
 #define GOT_VIEWS_TITLE_BACKGROUND_H
 
-#include "graphics/managed_surface.h"
 #include "got/views/view.h"
 
 namespace Got {
@@ -34,11 +33,11 @@ namespace Views {
  */
 class TitleBackground : public View {
 public:
-    TitleBackground() : View("TitleBackground") {}
-    virtual ~TitleBackground() {}
+	TitleBackground() : View("TitleBackground") {}
+	virtual ~TitleBackground() {}
 
-    bool msgGame(const GameMessage &msg) override;
-    void draw() override;
+	bool msgGame(const GameMessage &msg) override;
+	void draw() override;
 };
 
 } // namespace Views
diff --git a/engines/got/views/view.cpp b/engines/got/views/view.cpp
index d22f1b6ab2b..6db1a3ba969 100644
--- a/engines/got/views/view.cpp
+++ b/engines/got/views/view.cpp
@@ -27,98 +27,97 @@ namespace Got {
 namespace Views {
 
 void View::checkFocusedControl(const Common::Point &mousePos) {
-    if (_focusedElement) {
-        if (!_focusedElement->getBounds().contains(mousePos)) {
-            _focusedElement->send(MouseLeaveMessage());
-            _focusedElement = nullptr;
-        }
-
-    } else {
-        for (UIElement *child : _children) {
-            if (child->getBounds().contains(mousePos)) {
-                _focusedElement = child;
-                child->send(MouseEnterMessage());
-                break;
-            }
-        }
-    }
+	if (_focusedElement) {
+		if (!_focusedElement->getBounds().contains(mousePos)) {
+			_focusedElement->send(MouseLeaveMessage());
+			_focusedElement = nullptr;
+		}
+
+	} else {
+		for (UIElement *child : _children) {
+			if (child->getBounds().contains(mousePos)) {
+				_focusedElement = child;
+				child->send(MouseEnterMessage());
+				break;
+			}
+		}
+	}
 }
 
 UIElement *View::getElementAtPos(const Common::Point &pos) const {
-    for (UIElement *child : _children) {
-        if (child->getBounds().contains(pos))
-            return child;
-    }
+	for (UIElement *child : _children) {
+		if (child->getBounds().contains(pos))
+			return child;
+	}
 
-    return nullptr;
+	return nullptr;
 }
 
-
 bool View::msgFocus(const FocusMessage &msg) {
-    _focusedElement = nullptr;
-    return UIElement::msgFocus(msg);
+	_focusedElement = nullptr;
+	return UIElement::msgFocus(msg);
 }
 
 bool View::msgUnfocus(const UnfocusMessage &msg) {
-    if (_focusedElement)
-        _focusedElement->send(MouseLeaveMessage());
+	if (_focusedElement)
+		_focusedElement->send(MouseLeaveMessage());
 
-    return UIElement::msgUnfocus(msg);
+	return UIElement::msgUnfocus(msg);
 }
 
 bool View::msgMouseMove(const MouseMoveMessage &msg) {
-    checkFocusedControl(msg._pos);
-    return true;
+	checkFocusedControl(msg._pos);
+	return true;
 }
 
 bool View::msgMouseDown(const MouseDownMessage &msg) {
-    UIElement *child = getElementAtPos(msg._pos);
-    return child ? child->send(msg) : false;
+	UIElement *child = getElementAtPos(msg._pos);
+	return child ? child->send(msg) : false;
 }
 
 bool View::msgMouseUp(const MouseUpMessage &msg) {
-    UIElement *child = getElementAtPos(msg._pos);
-    return child ? child->send(msg) : false;
+	UIElement *child = getElementAtPos(msg._pos);
+	return child ? child->send(msg) : false;
 }
 
 void View::play_sound(int index, bool priority_override) {
-    _G(sound).play_sound(index, priority_override);
+	_G(sound).play_sound(index, priority_override);
 }
 
 void View::play_sound(const Gfx::GraphicChunk &src) {
-    _G(sound).play_sound(src);
+	_G(sound).play_sound(src);
 }
 
 void View::music_play(int num, bool override) {
-    _G(sound).music_play(num, override);
+	_G(sound).music_play(num, override);
 }
 
 void View::music_play(const char *name, bool override) {
-    _G(sound).music_play(name, override);
+	_G(sound).music_play(name, override);
 }
 
 void View::music_pause() {
-    _G(sound).music_pause();
+	_G(sound).music_pause();
 }
 
 void View::music_resume() {
-    _G(sound).music_resume();
+	_G(sound).music_resume();
 }
 
 void View::music_stop() {
-    _G(sound).music_stop();
+	_G(sound).music_stop();
 }
 
 bool View::music_is_on() const {
-    return _G(sound).music_is_on();
+	return _G(sound).music_is_on();
 }
 
 void View::fadeOut() {
-    Gfx::fade_out();
+	Gfx::fade_out();
 }
 
 void View::fadeIn(const byte *pal) {
-    Gfx::fade_in(pal);
+	Gfx::fade_in(pal);
 }
 
 } // namespace Views
diff --git a/engines/got/views/view.h b/engines/got/views/view.h
index 0f185426724..85713be4b51 100644
--- a/engines/got/views/view.h
+++ b/engines/got/views/view.h
@@ -41,47 +41,42 @@ namespace Views {
  */
 class View : public UIElement {
 private:
-    UIElement *_focusedElement = nullptr;
+	UIElement *_focusedElement = nullptr;
 
-    /**
+	/**
      * Checks if a control is entered or left
      */
-    void checkFocusedControl(const Common::Point &mousePos);
+	void checkFocusedControl(const Common::Point &mousePos);
 
-    /**
+	/**
      * Check for an element at the given position
      */
-    UIElement *getElementAtPos(const Common::Point &pos) const;
+	UIElement *getElementAtPos(const Common::Point &pos) const;
 
 protected:
-    void play_sound(int index, bool priority_override);
-    void play_sound(const Gfx::GraphicChunk &src);
+	void play_sound(int index, bool priority_override);
+	void play_sound(const Gfx::GraphicChunk &src);
 
-    void music_play(int num, bool override);
-    void music_play(const char *name, bool override);
-    void music_pause();
-    void music_resume();
-    void music_stop();
-    bool music_is_on() const;
+	void music_play(int num, bool override);
+	void music_play(const char *name, bool override);
+	void music_pause();
+	void music_resume();
+	void music_stop();
+	bool music_is_on() const;
 
-    void fadeOut();
-    void fadeIn(const byte *pal = nullptr);
+	void fadeOut();
+	void fadeIn(const byte *pal = nullptr);
 
 public:
-    View(const Common::String &name, UIElement *uiParent) :
-        UIElement(name, uiParent) {
-    }
-    View(const Common::String &name) :
-        UIElement(name) {
-    }
-    virtual ~View() {
-    }
+	View(const Common::String &name, UIElement *uiParent) : UIElement(name, uiParent) {}
+	View(const Common::String &name) : UIElement(name) {}
+	virtual ~View() {}
 
-    bool msgFocus(const FocusMessage &msg) override;
-    bool msgUnfocus(const UnfocusMessage &msg) override;
-    bool msgMouseMove(const MouseMoveMessage &msg) override;
-    bool msgMouseDown(const MouseDownMessage &msg) override;
-    bool msgMouseUp(const MouseUpMessage &msg) override;
+	bool msgFocus(const FocusMessage &msg) override;
+	bool msgUnfocus(const UnfocusMessage &msg) override;
+	bool msgMouseMove(const MouseMoveMessage &msg) override;
+	bool msgMouseDown(const MouseDownMessage &msg) override;
+	bool msgMouseUp(const MouseUpMessage &msg) override;
 };
 
 } // namespace Views
diff --git a/engines/got/views/views.h b/engines/got/views/views.h
index eecbc145c6d..8291ecd06cd 100644
--- a/engines/got/views/views.h
+++ b/engines/got/views/views.h
@@ -23,12 +23,6 @@
 #define GOT_VIEWS_H
 
 #include "got/views/credits.h"
-#include "got/views/game.h"
-#include "got/views/opening.h"
-#include "got/views/part_title.h"
-#include "got/views/splash_screen.h"
-#include "got/views/story.h"
-#include "got/views/title_background.h"
 #include "got/views/dialogs/ask.h"
 #include "got/views/dialogs/high_scores.h"
 #include "got/views/dialogs/main_menu.h"
@@ -38,38 +32,44 @@
 #include "got/views/dialogs/save_game.h"
 #include "got/views/dialogs/say.h"
 #include "got/views/dialogs/select_game.h"
+#include "got/views/dialogs/select_item.h"
 #include "got/views/dialogs/select_scroll.h"
 #include "got/views/dialogs/select_slow.h"
-#include "got/views/dialogs/select_item.h"
 #include "got/views/dialogs/set_music.h"
 #include "got/views/dialogs/set_sound.h"
+#include "got/views/game.h"
+#include "got/views/opening.h"
+#include "got/views/part_title.h"
+#include "got/views/splash_screen.h"
+#include "got/views/story.h"
+#include "got/views/title_background.h"
 
 namespace Got {
 namespace Views {
 
 struct Views {
-    Credits _credits;
-    Game _game;
-    Opening _opening;
-    PartTitle _partTitle;
-    SplashScreen _splashScreen;
-    Story _story;
-    TitleBackground _titleBackground;
+	Credits _credits;
+	Game _game;
+	Opening _opening;
+	PartTitle _partTitle;
+	SplashScreen _splashScreen;
+	Story _story;
+	TitleBackground _titleBackground;
 
-    Dialogs::Ask _ask;
-    Dialogs::HighScores _highScores;
-    Dialogs::MainMenu _mainMenu;
-    Dialogs::OptionsMenu _optionsMenu;
-    Dialogs::Quit _quit;
-    Dialogs::QuitGame _quitGame;
-    Dialogs::SaveGame _saveGame;
-    Dialogs::Say _say;
-    Dialogs::SelectGame _selectGame;
-    Dialogs::SelectItem _selectItem;
-    Dialogs::SelectScroll _selectScroll;
-    Dialogs::SelectSlow _selectSlow;
-    Dialogs::SetMusic _setMusic;
-    Dialogs::SetSound _setSound;
+	Dialogs::Ask _ask;
+	Dialogs::HighScores _highScores;
+	Dialogs::MainMenu _mainMenu;
+	Dialogs::OptionsMenu _optionsMenu;
+	Dialogs::Quit _quit;
+	Dialogs::QuitGame _quitGame;
+	Dialogs::SaveGame _saveGame;
+	Dialogs::Say _say;
+	Dialogs::SelectGame _selectGame;
+	Dialogs::SelectItem _selectItem;
+	Dialogs::SelectScroll _selectScroll;
+	Dialogs::SelectSlow _selectSlow;
+	Dialogs::SetMusic _setMusic;
+	Dialogs::SetSound _setSound;
 };
 
 } // namespace Views




More information about the Scummvm-git-logs mailing list