[Scummvm-git-logs] scummvm master -> 61e0021edf86bf0b4dddee2c388cd89d68b90874
bluegr
noreply at scummvm.org
Wed Mar 5 23:11:02 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:
61e0021edf FREESCAPE: astyle whitespace fixes
Commit: 61e0021edf86bf0b4dddee2c388cd89d68b90874
https://github.com/scummvm/scummvm/commit/61e0021edf86bf0b4dddee2c388cd89d68b90874
Author: Filippos Karapetis (bluegr at gmail.com)
Date: 2025-03-06T01:10:09+02:00
Commit Message:
FREESCAPE: astyle whitespace fixes
Changed paths:
engines/freescape/demo.cpp
engines/freescape/detection.cpp
engines/freescape/doodle.cpp
engines/freescape/doodle.h
engines/freescape/events.cpp
engines/freescape/font.cpp
engines/freescape/font.h
engines/freescape/freescape.cpp
engines/freescape/gfx.cpp
engines/freescape/gfx_opengl.cpp
engines/freescape/gfx_opengl.h
engines/freescape/gfx_opengl_shaders.cpp
engines/freescape/gfx_opengl_shaders.h
engines/freescape/gfx_opengl_texture.cpp
engines/freescape/gfx_tinygl.cpp
engines/freescape/gfx_tinygl.h
engines/freescape/movement.cpp
engines/freescape/sound.cpp
engines/freescape/sweepAABB.cpp
engines/freescape/ui.cpp
engines/freescape/unpack.cpp
diff --git a/engines/freescape/demo.cpp b/engines/freescape/demo.cpp
index 775452d574b..396042c26e7 100644
--- a/engines/freescape/demo.cpp
+++ b/engines/freescape/demo.cpp
@@ -111,25 +111,25 @@ Common::Event FreescapeEngine::decodeDOSMouseEvent(int index, int repetition) {
Common::Event event;
event.type = Common::EVENT_MOUSEMOVE;
event.customType = 0xde00;
- switch(index) {
- case 0x16:
- assert(repetition == 1);
- event.type = Common::EVENT_LBUTTONDOWN;
- break;
- case 0x17:
- _currentDemoMousePosition.x += repetition;
- break;
- case 0x18:
- _currentDemoMousePosition.x -= repetition;
- break;
- case 0x19:
- _currentDemoMousePosition.y += repetition;
- break;
- case 0x1a:
- _currentDemoMousePosition.y -= repetition;
- break;
- default:
- error("Unreachable");
+ switch (index) {
+ case 0x16:
+ assert(repetition == 1);
+ event.type = Common::EVENT_LBUTTONDOWN;
+ break;
+ case 0x17:
+ _currentDemoMousePosition.x += repetition;
+ break;
+ case 0x18:
+ _currentDemoMousePosition.x -= repetition;
+ break;
+ case 0x19:
+ _currentDemoMousePosition.y += repetition;
+ break;
+ case 0x1a:
+ _currentDemoMousePosition.y -= repetition;
+ break;
+ default:
+ error("Unreachable");
}
event.mouse = _currentDemoMousePosition;
return event;
diff --git a/engines/freescape/detection.cpp b/engines/freescape/detection.cpp
index d3116cbe0ae..e5f38afc52c 100644
--- a/engines/freescape/detection.cpp
+++ b/engines/freescape/detection.cpp
@@ -35,7 +35,8 @@ static const PlainGameDescriptor freescapeGames[] = {
{"totaleclipse", "Total Eclipse"},
{"totaleclipse2", "Total Eclipse 2"},
{"castlemaster", "Castle Master"},
- {0, 0}};
+ {0, 0}
+};
static const ADGameDescription gameDescriptions[] = {
// Original Freescape games
@@ -128,7 +129,8 @@ static const ADGameDescription gameDescriptions[] = {
ADGF_NO_FLAGS,
GUIO5(GUIO_NOMIDI, GUIO_RENDEREGA, GUIO_RENDERCGA, GUIO_RENDERHERCGREEN, GAMEOPTION_AUTOMATIC_DRILLING)
},
- { // Retail release
+ {
+ // Retail release
"driller",
"",
AD_ENTRY1s("x.prg", "d002983a8b652f25b18a09425db78c4c", 293159),
@@ -137,7 +139,8 @@ static const ADGameDescription gameDescriptions[] = {
GF_ATARI_RETAIL,
GUIO3(GUIO_NOMIDI, GUIO_RENDERATARIST, GAMEOPTION_AUTOMATIC_DRILLING)
},
- { // Budget release
+ {
+ // Budget release
"driller",
"",
AD_ENTRY1s("x.prg", "1a79e68e6c2c223c96de0ca2d65149ae", 293062),
@@ -146,7 +149,8 @@ static const ADGameDescription gameDescriptions[] = {
GF_ATARI_BUDGET,
GUIO3(GUIO_NOMIDI, GUIO_RENDERATARIST, GAMEOPTION_AUTOMATIC_DRILLING)
},
- { // Virtual Worlds release
+ {
+ // Virtual Worlds release
"driller",
"This release requires unpacking, check the wiki for instructions: https://wiki.scummvm.org/index.php?title=Driller#AtariST_releases",
{
@@ -172,7 +176,8 @@ static const ADGameDescription gameDescriptions[] = {
GF_AMIGA_RETAIL,
GUIO3(GUIO_NOMIDI, GUIO_RENDERAMIGA, GAMEOPTION_AUTOMATIC_DRILLING)
},
- { // Virtual Worlds release
+ {
+ // Virtual Worlds release
"driller",
"",
{
@@ -398,13 +403,14 @@ static const ADGameDescription gameDescriptions[] = {
ADGF_UNSUPPORTED,
GUIO2(GUIO_NOMIDI, GUIO_RENDERATARIST)
},
- { // Stampede AtariST, Issue 1
+ {
+ // Stampede AtariST, Issue 1
"darkside",
"",
{
{"0.DRK", 0, "86794a6cb2d371cdf892a2173e3b7568", 47966},
{"1.DRK", 0, "9e700d991054f4393b1ccef706586b5b", 223272},
- AD_LISTEND
+ AD_LISTEND
},
Common::EN_ANY,
Common::kPlatformAtariST,
@@ -639,7 +645,8 @@ static const ADGameDescription gameDescriptions[] = {
ADGF_NO_FLAGS,
GUIO3(GUIO_NOMIDI, GUIO_RENDEREGA, GUIO_RENDERCGA)
},
- { // Erbe Software release
+ {
+ // Erbe Software release
"totaleclipse",
"",
{
@@ -668,13 +675,14 @@ static const ADGameDescription gameDescriptions[] = {
ADGF_UNSUPPORTED,
GUIO2(GUIO_NOMIDI, GUIO_RENDERAMIGA)
},
- { // Virtual Worlds release
+ {
+ // Virtual Worlds release
"totaleclipse",
"",
{
{"0.TEC", 0, "8daa244d6814f06b9a081b7bd0ec542d", 89500},
{"1.TEC", 0, "c1b022ad7284578f97aa2ff46ed3db38", 304030},
- AD_LISTEND
+ AD_LISTEND
},
Common::EN_ANY,
Common::kPlatformAmiga,
@@ -694,7 +702,8 @@ static const ADGameDescription gameDescriptions[] = {
ADGF_UNSTABLE,
GUIO2(GUIO_NOMIDI, GUIO_RENDERATARIST)
},
- { // Stampede Atari, Issue 7
+ {
+ // Stampede Atari, Issue 7
"totaleclipse",
"",
{
@@ -1050,7 +1059,7 @@ static const ADGameDescription gameDescriptions[] = {
"3dkit",
"3D House v4",
AD_ENTRY2s("3DHOUSE4.EXE", "49f7a832104ae76d38851d1b4fd8f0a1", 8859,
- "RUNNER.3WD", "cc0bfa95f695d2b7eadc1d6f3dd6e8f9", 62434),
+ "RUNNER.3WD", "cc0bfa95f695d2b7eadc1d6f3dd6e8f9", 62434),
Common::EN_ANY,
Common::kPlatformDOS,
ADGF_UNSUPPORTED,
@@ -1060,7 +1069,7 @@ static const ADGameDescription gameDescriptions[] = {
"3dkit",
"Anarchy Academy",
AD_ENTRY2s("ANARCHY.PRG", "78d543be4aad9608093c1e91bc100307", 270,
- "RUNNER.DAT", "1cf7c049ee59503dd7218b0f45828132", 42802),
+ "RUNNER.DAT", "1cf7c049ee59503dd7218b0f45828132", 42802),
Common::EN_ANY,
Common::kPlatformAtariST,
ADGF_UNSUPPORTED,
@@ -1070,14 +1079,15 @@ static const ADGameDescription gameDescriptions[] = {
"3dkit",
"The World of Stairs",
AD_ENTRY2s("RUNNER.EXE", "8d20d849694fb098b5fa7883f770a122", 96439,
- "RUNNER.3WD", "daf373f23a122dd1b7eda48f33d3aa54", 44694),
+ "RUNNER.3WD", "daf373f23a122dd1b7eda48f33d3aa54", 44694),
Common::EN_ANY,
Common::kPlatformDOS,
ADGF_UNSUPPORTED,
GUIO1(GUIO_NOMIDI)
},
- AD_TABLE_END_MARKER};
+ AD_TABLE_END_MARKER
+};
} // End of namespace Freescape
static const DebugChannelDef debugFlagList[] = {
diff --git a/engines/freescape/doodle.cpp b/engines/freescape/doodle.cpp
index bb018e463a1..63849e406a2 100644
--- a/engines/freescape/doodle.cpp
+++ b/engines/freescape/doodle.cpp
@@ -8,116 +8,124 @@
namespace Image {
DoodleDecoder::DoodleDecoder(const byte *palette) : _surface(nullptr), _palette(nullptr) {
- // Copy the pointer to the provided palette
- _palette = palette;
+ // Copy the pointer to the provided palette
+ _palette = palette;
}
DoodleDecoder::~DoodleDecoder() {
- destroy();
+ destroy();
}
void DoodleDecoder::destroy() {
- if (_surface) {
- _surface->free();
- delete _surface;
- _surface = nullptr;
- }
+ if (_surface) {
+ _surface->free();
+ delete _surface;
+ _surface = nullptr;
+ }
}
bool DoodleDecoder::loadStream(Common::SeekableReadStream &stream) {
- // This method should not be used
- error("DoodleDecoder::loadStream - Use loadStreams instead");
- return false;
+ // This method should not be used
+ error("DoodleDecoder::loadStream - Use loadStreams instead");
+ return false;
}
bool DoodleDecoder::loadStreams(Common::SeekableReadStream &highresStream,
- Common::SeekableReadStream &colorStream1,
- Common::SeekableReadStream &colorStream2) {
- destroy();
+ Common::SeekableReadStream &colorStream1,
+ Common::SeekableReadStream &colorStream2) {
+ destroy();
- // Check stream sizes
- if (highresStream.size() != 8192) {
- error("DoodleDecoder: Invalid high-resolution data size");
- return false;
- }
+ // Check stream sizes
+ if (highresStream.size() != 8192) {
+ error("DoodleDecoder: Invalid high-resolution data size");
+ return false;
+ }
- if (colorStream1.size() != 1026 || colorStream2.size() != 1026) {
- error("DoodleDecoder: Invalid color data size");
- return false;
- }
+ if (colorStream1.size() != 1026 || colorStream2.size() != 1026) {
+ error("DoodleDecoder: Invalid color data size");
+ return false;
+ }
- // Skip headers
- highresStream.skip(2);
- colorStream1.skip(2);
- colorStream2.skip(2);
+ // Skip headers
+ highresStream.skip(2);
+ colorStream1.skip(2);
+ colorStream2.skip(2);
- // Read high-resolution data
- byte *highresData = new byte[8000];
- highresStream.read(highresData, 8000);
+ // Read high-resolution data
+ byte *highresData = new byte[8000];
+ highresStream.read(highresData, 8000);
- // Skip remaining header bytes in highres file
- highresStream.skip(190);
+ // Skip remaining header bytes in highres file
+ highresStream.skip(190);
- // Read color data
- byte *colorData1 = new byte[kColorDataSize];
- byte *colorData2 = new byte[kColorDataSize];
+ // Read color data
+ byte *colorData1 = new byte[kColorDataSize];
+ byte *colorData2 = new byte[kColorDataSize];
- colorStream1.read(colorData1, kColorDataSize);
- colorStream2.read(colorData2, kColorDataSize);
+ colorStream1.read(colorData1, kColorDataSize);
+ colorStream2.read(colorData2, kColorDataSize);
int width = 320;
int height = 200;
- // Create surface
- _surface = new Graphics::Surface();
- _surface->create(width, height, Graphics::PixelFormat::createFormatCLUT8());
+ // Create surface
+ _surface = new Graphics::Surface();
+ _surface->create(width, height, Graphics::PixelFormat::createFormatCLUT8());
- // Process each cell
- for (int cellIdx = 0; cellIdx < 1000; ++cellIdx) {
- processDoodleCell(cellIdx, highresData, colorData1, colorData2);
- }
+ // Process each cell
+ for (int cellIdx = 0; cellIdx < 1000; ++cellIdx) {
+ processDoodleCell(cellIdx, highresData, colorData1, colorData2);
+ }
- // Cleanup
- delete[] highresData;
- delete[] colorData1;
- delete[] colorData2;
+ // Cleanup
+ delete[] highresData;
+ delete[] colorData1;
+ delete[] colorData2;
- return true;
+ return true;
}
void DoodleDecoder::processDoodleCell(int cellIdx, const byte *highresData,
- const byte *colorData1, const byte *colorData2) {
- // Calculate cell coordinates
- int cellX = (cellIdx % 40) * 8;
- int cellY = (cellIdx / 40) * 8;
-
- // Get colors for this cell
- byte color1 = colorData2[cellIdx] & 0xf;
- byte color2 = colorData1[cellIdx] >> 4;
- byte color3 = colorData1[cellIdx] & 0xf;
-
- // Process each row in the cell
- for (int row = 0; row < 8; ++row) {
- byte pixelByte = highresData[cellIdx * 8 + row];
-
- // Process 4 pixel pairs (8 pixels total) in multicolor mode
- for (int bit = 0; bit < 4; ++bit) {
- byte pixelPair = (pixelByte >> (6 - bit * 2)) & 0x03;
-
- // Determine final color
- byte color = 0;
- switch (pixelPair) {
- case 0: color = 0; break;
- case 1: color = color2; break;
- case 2: color = color3; break;
- case 3: color = color1; break;
- }
-
- // Set pixel colors (2 pixels for each pair due to multicolor mode)
- _surface->setPixel(cellX + bit * 2, cellY + row, color);
- _surface->setPixel(cellX + bit * 2 + 1, cellY + row, color);
- }
- }
+ const byte *colorData1, const byte *colorData2) {
+ // Calculate cell coordinates
+ int cellX = (cellIdx % 40) * 8;
+ int cellY = (cellIdx / 40) * 8;
+
+ // Get colors for this cell
+ byte color1 = colorData2[cellIdx] & 0xf;
+ byte color2 = colorData1[cellIdx] >> 4;
+ byte color3 = colorData1[cellIdx] & 0xf;
+
+ // Process each row in the cell
+ for (int row = 0; row < 8; ++row) {
+ byte pixelByte = highresData[cellIdx * 8 + row];
+
+ // Process 4 pixel pairs (8 pixels total) in multicolor mode
+ for (int bit = 0; bit < 4; ++bit) {
+ byte pixelPair = (pixelByte >> (6 - bit * 2)) & 0x03;
+
+ // Determine final color
+ byte color = 0;
+ switch (pixelPair) {
+ case 0:
+ color = 0;
+ break;
+ case 1:
+ color = color2;
+ break;
+ case 2:
+ color = color3;
+ break;
+ case 3:
+ color = color1;
+ break;
+ }
+
+ // Set pixel colors (2 pixels for each pair due to multicolor mode)
+ _surface->setPixel(cellX + bit * 2, cellY + row, color);
+ _surface->setPixel(cellX + bit * 2 + 1, cellY + row, color);
+ }
+ }
}
} // End of namespace Image
\ No newline at end of file
diff --git a/engines/freescape/doodle.h b/engines/freescape/doodle.h
index 85a4bf063a6..54366f49f87 100644
--- a/engines/freescape/doodle.h
+++ b/engines/freescape/doodle.h
@@ -9,49 +9,49 @@ namespace Image {
class DoodleDecoder : public ImageDecoder {
public:
- /**
- * Constructor for the DoodleDecoder
- * @param palette Pointer to RGB palette data (16 colors * 3 components)
- */
- DoodleDecoder(const byte *palette);
- ~DoodleDecoder() override;
-
- // ImageDecoder interface
- bool loadStream(Common::SeekableReadStream &stream) override;
- void destroy() override;
- const Graphics::Surface *getSurface() const override { return _surface; }
- const byte *getPalette() const override { return _palette; }
- uint16 getPaletteColorCount() const override { return 16; }
-
- /**
- * Load a C64 doodle image from its component streams
- * @param highresStream Stream containing high-resolution pixel data
- * @param colorStream1 Stream containing first color data file
- * @param colorStream2 Stream containing second color data file
- * @return Whether loading succeeded
- */
- bool loadStreams(Common::SeekableReadStream &highresStream,
- Common::SeekableReadStream &colorStream1,
- Common::SeekableReadStream &colorStream2);
+ /**
+ * Constructor for the DoodleDecoder
+ * @param palette Pointer to RGB palette data (16 colors * 3 components)
+ */
+ DoodleDecoder(const byte *palette);
+ ~DoodleDecoder() override;
+
+ // ImageDecoder interface
+ bool loadStream(Common::SeekableReadStream &stream) override;
+ void destroy() override;
+ const Graphics::Surface *getSurface() const override { return _surface; }
+ const byte *getPalette() const override { return _palette; }
+ uint16 getPaletteColorCount() const override { return 16; }
+
+ /**
+ * Load a C64 doodle image from its component streams
+ * @param highresStream Stream containing high-resolution pixel data
+ * @param colorStream1 Stream containing first color data file
+ * @param colorStream2 Stream containing second color data file
+ * @return Whether loading succeeded
+ */
+ bool loadStreams(Common::SeekableReadStream &highresStream,
+ Common::SeekableReadStream &colorStream1,
+ Common::SeekableReadStream &colorStream2);
private:
- static const int kWidth = 320;
- static const int kHeight = 200;
- static const int kHeaderSize = 192;
- static const int kColorDataSize = 1000; // 40x25 color cells
-
- Graphics::Surface *_surface;
- const byte *_palette;
-
- /**
- * Process an 8x8 cell of the image
- * @param cellIdx Cell index (0-999)
- * @param highresData Pointer to high-resolution pixel data
- * @param colorData1 First color data array
- * @param colorData2 Second color data array
- */
- void processDoodleCell(int cellIdx, const byte *highresData,
- const byte *colorData1, const byte *colorData2);
+ static const int kWidth = 320;
+ static const int kHeight = 200;
+ static const int kHeaderSize = 192;
+ static const int kColorDataSize = 1000; // 40x25 color cells
+
+ Graphics::Surface *_surface;
+ const byte *_palette;
+
+ /**
+ * Process an 8x8 cell of the image
+ * @param cellIdx Cell index (0-999)
+ * @param highresData Pointer to high-resolution pixel data
+ * @param colorData1 First color data array
+ * @param colorData2 Second color data array
+ */
+ void processDoodleCell(int cellIdx, const byte *highresData,
+ const byte *colorData1, const byte *colorData2);
};
} // End of namespace Image
diff --git a/engines/freescape/events.cpp b/engines/freescape/events.cpp
index 50316308c3a..e8b0df0e968 100644
--- a/engines/freescape/events.cpp
+++ b/engines/freescape/events.cpp
@@ -25,9 +25,9 @@
namespace Freescape {
EventManagerWrapper::EventManagerWrapper(Common::EventManager *delegate) :
- _delegate(delegate),
- _keyRepeatTime(0),
- _currentActionDown(kActionNone) {
+ _delegate(delegate),
+ _keyRepeatTime(0),
+ _currentActionDown(kActionNone) {
assert(delegate);
}
diff --git a/engines/freescape/font.cpp b/engines/freescape/font.cpp
index cc89e022425..73969bab488 100644
--- a/engines/freescape/font.cpp
+++ b/engines/freescape/font.cpp
@@ -164,7 +164,7 @@ Common::Array<Graphics::ManagedSurface *> FreescapeEngine::getCharsAmigaAtariInt
Common::Array<Graphics::ManagedSurface *> chars;
for (int c = 0; c < charsNumber - 1; c++) {
- int position = 8 * (m1*c + 1);
+ int position = 8 * (m1 * c + 1);
Graphics::ManagedSurface *surface = new Graphics::ManagedSurface();
surface->create(sizeX, sizeY, Graphics::PixelFormat::createFormatCLUT8());
for (int j = 0; j < sizeY; j++) {
diff --git a/engines/freescape/font.h b/engines/freescape/font.h
index cea0e5ca9bc..80ca9acbf94 100644
--- a/engines/freescape/font.h
+++ b/engines/freescape/font.h
@@ -48,7 +48,7 @@ public:
//const Graphics::ManagedSurface &getImageSurface() const { return _image; }
private:
- Common::Array<Graphics::ManagedSurface *> _chars;
+ Common::Array<Graphics::ManagedSurface *> _chars;
uint32 _backgroundColor;
uint32 _secondaryColor;
int _kerningOffset;
diff --git a/engines/freescape/freescape.cpp b/engines/freescape/freescape.cpp
index c4331c48f29..5c7a5211f33 100644
--- a/engines/freescape/freescape.cpp
+++ b/engines/freescape/freescape.cpp
@@ -527,7 +527,7 @@ void FreescapeEngine::processInput() {
if (event.type == Common::EVENT_SCREEN_CHANGED)
; // Allow event
else if (_gameStateControl == kFreescapeGameStateEnd
- && (event.type == Common::EVENT_KEYDOWN || event.type == Common::EVENT_CUSTOM_ENGINE_ACTION_START)) {
+ && (event.type == Common::EVENT_KEYDOWN || event.type == Common::EVENT_CUSTOM_ENGINE_ACTION_START)) {
_endGameKeyPressed = true;
continue;
} else if (event.type == Common::EVENT_CUSTOM_ENGINE_ACTION_START && event.customType == kActionEscape)
@@ -999,9 +999,9 @@ bool FreescapeEngine::hasFeature(EngineFeature f) const {
// The TinyGL renderer does not support arbitrary resolutions for now
bool softRenderer = determinateRenderType() == Graphics::kRendererTypeTinyGL;
return (f == kSupportsReturnToLauncher) ||
- (f == kSupportsLoadingDuringRuntime) ||
- (f == kSupportsSavingDuringRuntime) ||
- (f == kSupportsArbitraryResolutions && !softRenderer);
+ (f == kSupportsLoadingDuringRuntime) ||
+ (f == kSupportsSavingDuringRuntime) ||
+ (f == kSupportsArbitraryResolutions && !softRenderer);
}
Common::Error FreescapeEngine::loadGameStream(Common::SeekableReadStream *stream) {
diff --git a/engines/freescape/gfx.cpp b/engines/freescape/gfx.cpp
index 9625dc15178..4c31fbbf59a 100644
--- a/engines/freescape/gfx.cpp
+++ b/engines/freescape/gfx.cpp
@@ -26,7 +26,7 @@
#include "engines/util.h"
#if defined(USE_OPENGL_GAME) || defined(USE_OPENGL_SHADERS) || defined(USE_GLES2)
-#include "graphics/opengl/context.h"
+ #include "graphics/opengl/context.h"
#endif
#include "freescape/gfx.h"
@@ -36,9 +36,9 @@ namespace Freescape {
const Graphics::PixelFormat getRGBAPixelFormat() {
#ifdef SCUMM_BIG_ENDIAN
- return Graphics::PixelFormat(4, 8, 8, 8, 8, 24, 16, 8, 0);
+ return Graphics::PixelFormat(4, 8, 8, 8, 8, 24, 16, 8, 0);
#else
- return Graphics::PixelFormat(4, 8, 8, 8, 8, 0, 8, 16, 24);
+ return Graphics::PixelFormat(4, 8, 8, 8, 8, 0, 8, 16, 24);
#endif
}
@@ -137,7 +137,7 @@ byte getCGAStipple(byte x, int back, int fore) {
st = st | (0x3 << 4);
if (c3 == fore)
- st = st | (0x3 << 6);
+ st = st | (0x3 << 6);
return st;
}
@@ -163,7 +163,7 @@ byte getC64Stipple(byte x, int back, int fore) {
st = st | (0x3 << 4);
if (c3 == fore)
- st = st | (0x3 << 6);
+ st = st | (0x3 << 6);
return st;
}
@@ -178,7 +178,7 @@ int getC64Color(uint8 index, bool isBackground) {
return index;
if (isBackground) {
- switch(index) {
+ switch (index) {
case 4:
return 1;
case 5: // OK
@@ -206,31 +206,31 @@ int getC64Color(uint8 index, bool isBackground) {
}
}
- switch(index) {
- case 4:
- return 0;
- case 5: // OK
- return 0;
- case 6: // OK
- return 3;
- case 7: // OK
- return 2;
- case 8:
- return 3; // ??
- case 9: // OK
- return 2;
- case 10: // ??
- return 0;
- case 11:
- return 0;
- case 12:
- return 0;
- case 13:
- return 2;
- case 14:
- return 0;
- default:
- error("invalid c64 color index %d", index);
+ switch (index) {
+ case 4:
+ return 0;
+ case 5: // OK
+ return 0;
+ case 6: // OK
+ return 3;
+ case 7: // OK
+ return 2;
+ case 8:
+ return 3; // ??
+ case 9: // OK
+ return 2;
+ case 10: // ??
+ return 0;
+ case 11:
+ return 0;
+ case 12:
+ return 0;
+ case 13:
+ return 2;
+ case 14:
+ return 0;
+ default:
+ error("invalid c64 color index %d", index);
}
error("unreachable");
@@ -281,26 +281,26 @@ void Renderer::fillColorPairArray() {
uint16 duplicate_bits(uint8 byte) {
- uint16 result = 0;
-
- for (int i = 0; i < 8; i++) {
- // Extract the bit at position i
- uint8 bit = (byte >> i) & 1;
- // Duplicate the bit
- uint16 duplicated_bits = (bit << 1) | bit;
- // Position the duplicated bits in the appropriate place in the result
- result |= (duplicated_bits << (2 * i));
- }
-
- return result;
+ uint16 result = 0;
+
+ for (int i = 0; i < 8; i++) {
+ // Extract the bit at position i
+ uint8 bit = (byte >> i) & 1;
+ // Duplicate the bit
+ uint16 duplicated_bits = (bit << 1) | bit;
+ // Position the duplicated bits in the appropriate place in the result
+ result |= (duplicated_bits << (2 * i));
+ }
+
+ return result;
}
void Renderer::scaleStipplePattern(byte originalPattern[128], byte newPattern[128]) {
- // Initialize the new pattern to all 0
- memset(newPattern, 0, 128);
+ // Initialize the new pattern to all 0
+ memset(newPattern, 0, 128);
- for (int i = 0; i < 64; i++) {
+ for (int i = 0; i < 64; i++) {
// Duplicate the bits of the original pattern
uint16 duplicated_bits = duplicate_bits(originalPattern[i]);
// Position the duplicated bits in the appropriate place in the new pattern
@@ -393,7 +393,7 @@ bool Renderer::getRGBAtCGA(uint8 index, uint8 &r1, uint8 &g1, uint8 &b1, uint8 &
if (index == _keyColor)
return false;
- assert (_renderMode == Common::kRenderCGA);
+ assert(_renderMode == Common::kRenderCGA);
stipple = (byte *)_stipples[index - 1];
byte pair = _colorPair[index - 1];
byte c1 = pair & 0xf;
@@ -427,7 +427,7 @@ bool Renderer::getRGBAtC64(uint8 index, uint8 &r1, uint8 &g1, uint8 &b1, uint8 &
stipple = nullptr;
return true;
}
- assert (_renderMode == Common::kRenderC64);
+ assert(_renderMode == Common::kRenderC64);
uint8 i1, i2;
stipple = (byte *)_stipples[index - 1];
@@ -531,7 +531,7 @@ bool Renderer::getRGBAtCPC(uint8 index, uint8 &r1, uint8 &g1, uint8 &b1, uint8 &
stipple = nullptr;
return true;
}
- assert (_renderMode == Common::kRenderCPC);
+ assert(_renderMode == Common::kRenderCPC);
stipple = (byte *)_stipples[index - 1];
byte *entry = (*_colorMap)[index - 1];
uint8 i1 = getCPCPixel(entry[0], 0, true);
@@ -550,7 +550,7 @@ uint8 Renderer::mapEGAColor(uint8 index) {
uint8 acc = 1;
for (int i = 0; i < 4; i++) {
byte be = *entry;
- assert (be == 0 || be == 0xff);
+ assert(be == 0 || be == 0xff);
if (be == 0xff)
color = color + acc;
@@ -669,17 +669,17 @@ bool Renderer::computeScreenViewport() {
Common::Rect viewport;
if (g_system->getFeatureState(OSystem::kFeatureAspectRatioCorrection)) {
- // Aspect ratio correction
- int32 viewportWidth = MIN<int32>(screenWidth, screenHeight * float(4) / 3);
- int32 viewportHeight = MIN<int32>(screenHeight, screenWidth * float(3) / 3);
- viewport = Common::Rect(viewportWidth, viewportHeight);
-
- // Pillarboxing
- viewport.translate((screenWidth - viewportWidth) / 2,
- (screenHeight - viewportHeight) / 2);
+ // Aspect ratio correction
+ int32 viewportWidth = MIN<int32>(screenWidth, screenHeight * float(4) / 3);
+ int32 viewportHeight = MIN<int32>(screenHeight, screenWidth * float(3) / 3);
+ viewport = Common::Rect(viewportWidth, viewportHeight);
+
+ // Pillarboxing
+ viewport.translate((screenWidth - viewportWidth) / 2,
+ (screenHeight - viewportHeight) / 2);
} else {
- // Aspect ratio correction disabled, just stretch
- viewport = Common::Rect(screenWidth, screenHeight);
+ // Aspect ratio correction disabled, just stretch
+ viewport = Common::Rect(screenWidth, screenHeight);
}
if (viewport == _screenViewport) {
@@ -1278,15 +1278,15 @@ Graphics::RendererType determinateRenderType() {
Graphics::RendererType desiredRendererType = Graphics::Renderer::parseTypeCode(rendererConfig);
Graphics::RendererType matchingRendererType = Graphics::Renderer::getBestMatchingAvailableType(desiredRendererType,
#if defined(USE_OPENGL_GAME)
- Graphics::kRendererTypeOpenGL |
+ Graphics::kRendererTypeOpenGL |
#endif
#if defined(USE_OPENGL_SHADERS)
- Graphics::kRendererTypeOpenGLShaders |
+ Graphics::kRendererTypeOpenGLShaders |
#endif
#if defined(USE_TINYGL)
- Graphics::kRendererTypeTinyGL |
+ Graphics::kRendererTypeTinyGL |
#endif
- 0);
+ 0);
if (matchingRendererType != desiredRendererType && desiredRendererType != Graphics::kRendererTypeDefault) {
// Display a warning if unable to use the desired renderer
@@ -1294,17 +1294,17 @@ Graphics::RendererType determinateRenderType() {
}
#if defined(USE_OPENGL_GAME) && !defined(USE_GLES2)
- if (matchingRendererType == Graphics::kRendererTypeOpenGL)
- return matchingRendererType;
+ if (matchingRendererType == Graphics::kRendererTypeOpenGL)
+ return matchingRendererType;
#endif
#if defined(USE_OPENGL_SHADERS)
- if (matchingRendererType == Graphics::kRendererTypeOpenGLShaders)
- return matchingRendererType;
+ if (matchingRendererType == Graphics::kRendererTypeOpenGLShaders)
+ return matchingRendererType;
#endif
#if defined(USE_TINYGL)
- return Graphics::kRendererTypeTinyGL;
+ return Graphics::kRendererTypeTinyGL;
#endif
return Graphics::kRendererTypeDefault;
@@ -1323,15 +1323,15 @@ Renderer *createRenderer(int screenW, int screenH, Common::RenderMode renderMode
}
#if defined(USE_OPENGL_GAME) && !defined(USE_GLES2)
- if (rendererType == Graphics::kRendererTypeOpenGL) {
- return CreateGfxOpenGL(screenW, screenH, renderMode, authenticGraphics);
- }
+ if (rendererType == Graphics::kRendererTypeOpenGL) {
+ return CreateGfxOpenGL(screenW, screenH, renderMode, authenticGraphics);
+ }
#endif
#if defined(USE_OPENGL_SHADERS)
- if (rendererType == Graphics::kRendererTypeOpenGLShaders) {
- return CreateGfxOpenGLShader(screenW, screenH, renderMode, authenticGraphics);
- }
+ if (rendererType == Graphics::kRendererTypeOpenGLShaders) {
+ return CreateGfxOpenGLShader(screenW, screenH, renderMode, authenticGraphics);
+ }
#endif
#if defined(USE_TINYGL)
diff --git a/engines/freescape/gfx_opengl.cpp b/engines/freescape/gfx_opengl.cpp
index eb51a158d07..c1d66754860 100644
--- a/engines/freescape/gfx_opengl.cpp
+++ b/engines/freescape/gfx_opengl.cpp
@@ -88,14 +88,14 @@ void OpenGLRenderer::init() {
void OpenGLRenderer::setViewport(const Common::Rect &rect) {
_viewport = Common::Rect(
- _screenViewport.width() * rect.width() / _screenW,
- _screenViewport.height() * rect.height() / _screenH
- );
+ _screenViewport.width() * rect.width() / _screenW,
+ _screenViewport.height() * rect.height() / _screenH
+ );
_viewport.translate(
- _screenViewport.left + _screenViewport.width() * rect.left / _screenW,
- _screenViewport.top + _screenViewport.height() * rect.top / _screenH
- );
+ _screenViewport.left + _screenViewport.width() * rect.left / _screenW,
+ _screenViewport.top + _screenViewport.height() * rect.top / _screenH
+ );
_unscaledViewport = rect;
glViewport(_viewport.left, g_system->getHeight() - _viewport.bottom, _viewport.width(), _viewport.height());
@@ -257,7 +257,7 @@ void OpenGLRenderer::renderCrossair(const Common::Point crossairPosition) {
useColor(255, 255, 255);
glLineWidth(MAX(2, g_system->getWidth() / 192)); // It will not work in every OpenGL implementation since the
- // spec doesn't require support for line widths other than 1
+ // spec doesn't require support for line widths other than 1
glEnableClientState(GL_VERTEX_ARRAY);
copyToVertexArray(0, Math::Vector3d(crossairPosition.x - 3, crossairPosition.y, 0));
copyToVertexArray(1, Math::Vector3d(crossairPosition.x - 1, crossairPosition.y, 0));
@@ -303,7 +303,7 @@ void OpenGLRenderer::renderPlayerShootRay(byte color, const Common::Point positi
glColor3ub(r, g, b);
glLineWidth(5); // It will not work in every OpenGL implementation since the
- // spec doesn't require support for line widths other than 1
+ // spec doesn't require support for line widths other than 1
glEnableClientState(GL_VERTEX_ARRAY);
copyToVertexArray(0, Math::Vector3d(viewArea.left, viewArea.height() + viewArea.top, 0));
copyToVertexArray(1, Math::Vector3d(position.x, position.y, 0));
@@ -339,14 +339,14 @@ void OpenGLRenderer::drawCelestialBody(Math::Vector3d position, float radius, by
glPushMatrix();
GLfloat m[16];
glGetFloatv(GL_MODELVIEW_MATRIX, m);
- for(int i = 1; i < 4; i++)
- for(int j = 0; j < 4; j++ ) {
+ for (int i = 1; i < 4; i++)
+ for (int j = 0; j < 4; j++) {
if (i == 2)
continue;
if (i == j)
- m[i*4 + j] = 1.0;
+ m[i * 4 + j] = 1.0;
else
- m[i*4 + j] = 0.0;
+ m[i * 4 + j] = 0.0;
}
glLoadMatrixf(m);
@@ -360,11 +360,11 @@ void OpenGLRenderer::drawCelestialBody(Math::Vector3d position, float radius, by
copyToVertexArray(0, position);
float adj = 1.25; // Perspective correction
- for(int i = 0; i <= triangleAmount; i++) {
+ for (int i = 0; i <= triangleAmount; i++) {
copyToVertexArray(i + 1,
- Math::Vector3d(position.x(), position.y() + (radius * cos(i * twicePi / triangleAmount)),
- position.z() + (adj * radius * sin(i * twicePi / triangleAmount)))
- );
+ Math::Vector3d(position.x(), position.y() + (radius * cos(i * twicePi / triangleAmount)),
+ position.z() + (adj * radius * sin(i * twicePi / triangleAmount)))
+ );
}
glVertexPointer(3, GL_FLOAT, 0, _verts);
@@ -378,11 +378,11 @@ void OpenGLRenderer::drawCelestialBody(Math::Vector3d position, float radius, by
glEnableClientState(GL_VERTEX_ARRAY);
copyToVertexArray(0, position);
- for(int i = 0; i <= triangleAmount; i++) {
+ for (int i = 0; i <= triangleAmount; i++) {
copyToVertexArray(i + 1,
- Math::Vector3d(position.x(), position.y() + (radius * cos(i * twicePi / triangleAmount)),
- position.z() + (adj * radius * sin(i * twicePi / triangleAmount)))
- );
+ Math::Vector3d(position.x(), position.y() + (radius * cos(i * twicePi / triangleAmount)),
+ position.z() + (adj * radius * sin(i * twicePi / triangleAmount)))
+ );
}
glVertexPointer(3, GL_FLOAT, 0, _verts);
@@ -428,7 +428,7 @@ void OpenGLRenderer::renderPlayerShootBall(byte color, const Common::Point posit
glEnableClientState(GL_VERTEX_ARRAY);
copyToVertexArray(0, Math::Vector3d(ball_position.x, ball_position.y, 0));
- for(int i = 0; i <= triangleAmount; i++) {
+ for (int i = 0; i <= triangleAmount; i++) {
float x = ball_position.x + (radius * cos(i * twicePi / triangleAmount));
float y = ball_position.y + (radius * sin(i * twicePi / triangleAmount));
copyToVertexArray(i + 1, Math::Vector3d(x, y, 0));
@@ -516,9 +516,9 @@ void OpenGLRenderer::useStipple(bool enabled) {
glPolygonOffset(factor - 0.5f, -1.0f);
glEnable(GL_POLYGON_STIPPLE);
if (_renderMode == Common::kRenderZX ||
- _renderMode == Common::kRenderCPC ||
- _renderMode == Common::kRenderCGA ||
- _renderMode == Common::kRenderHercG)
+ _renderMode == Common::kRenderCPC ||
+ _renderMode == Common::kRenderCGA ||
+ _renderMode == Common::kRenderHercG)
glPolygonStipple(_variableStippleArray);
else
glPolygonStipple(_defaultStippleArray);
diff --git a/engines/freescape/gfx_opengl.h b/engines/freescape/gfx_opengl.h
index 5ed5a02326f..a0738a2b4f3 100644
--- a/engines/freescape/gfx_opengl.h
+++ b/engines/freescape/gfx_opengl.h
@@ -45,7 +45,9 @@ public:
void copyToVertexArray(uint idx, const Math::Vector3d &src) {
assert(idx < kVertexArraySize);
- _verts[idx].x = src.x(); _verts[idx].y = src.y(); _verts[idx].z = src.z();
+ _verts[idx].x = src.x();
+ _verts[idx].y = src.y();
+ _verts[idx].z = src.z();
}
Vertex *_verts;
@@ -59,7 +61,8 @@ public:
void copyToCoordArray(uint idx, const Math::Vector2d &src) {
assert(idx < kCoordsArraySize);
- _coords[idx].x = src.getValue(0); _coords[idx].y = src.getValue(1);
+ _coords[idx].x = src.getValue(0);
+ _coords[idx].y = src.getValue(1);
}
virtual void init() override;
diff --git a/engines/freescape/gfx_opengl_shaders.cpp b/engines/freescape/gfx_opengl_shaders.cpp
index cb9d188876a..0b29afdb851 100644
--- a/engines/freescape/gfx_opengl_shaders.cpp
+++ b/engines/freescape/gfx_opengl_shaders.cpp
@@ -114,7 +114,7 @@ void OpenGLShaderRenderer::init() {
_cubemapShader->enableVertexAttribute("texcoord", _cubemapTexCoordVBO, 2, GL_FLOAT, GL_TRUE, 2 * sizeof(float), 0);
// populate default stipple data for shader rendering
- for(int i = 0; i < 128; i++)
+ for (int i = 0; i < 128; i++)
_defaultShaderStippleArray[i] = _defaultStippleArray[i];
glDisable(GL_TEXTURE_2D);
@@ -125,14 +125,14 @@ void OpenGLShaderRenderer::init() {
void OpenGLShaderRenderer::setViewport(const Common::Rect &rect) {
_viewport = Common::Rect(
- _screenViewport.width() * rect.width() / _screenW,
- _screenViewport.height() * rect.height() / _screenH
- );
+ _screenViewport.width() * rect.width() / _screenW,
+ _screenViewport.height() * rect.height() / _screenH
+ );
_viewport.translate(
- _screenViewport.left + _screenViewport.width() * rect.left / _screenW,
- _screenViewport.top + _screenViewport.height() * rect.top / _screenH
- );
+ _screenViewport.left + _screenViewport.width() * rect.left / _screenW,
+ _screenViewport.top + _screenViewport.height() * rect.top / _screenH
+ );
_unscaledViewport = rect;
glViewport(_viewport.left, g_system->getHeight() - _viewport.bottom, _viewport.width(), _viewport.height());
@@ -209,7 +209,7 @@ void OpenGLShaderRenderer::positionCamera(const Math::Vector3d &pos, const Math:
Math::Matrix4 lookMatrix = Math::makeLookAtMatrix(pos, interest, up_vec);
Math::Matrix4 viewMatrix;
viewMatrix.translate(-pos);
- viewMatrix.transpose();
+ viewMatrix.transpose();
_modelViewMatrix = viewMatrix * lookMatrix;
@@ -283,7 +283,7 @@ void OpenGLShaderRenderer::renderPlayerShootBall(byte color, const Common::Point
copyToVertexArray(0, Math::Vector3d(remap(ball_position.x, _screenW), remap(ball_position.y, _screenH), 0));
- for(int i = 0; i <= triangleAmount; i++) {
+ for (int i = 0; i <= triangleAmount; i++) {
float x = remap(ball_position.x + (radius * cos(i * twicePi / triangleAmount)), _screenW);
float y = remap(ball_position.y + (radius * sin(i * twicePi / triangleAmount)), _screenH);
copyToVertexArray(i + 1, Math::Vector3d(x, y, 0));
@@ -326,7 +326,7 @@ void OpenGLShaderRenderer::renderPlayerShootRay(byte color, const Common::Point
useColor(r, g, b);
glLineWidth(5); // It will not work in every OpenGL implementation since the
- // spec doesn't require support for line widths other than 1
+ // spec doesn't require support for line widths other than 1
copyToVertexArray(0, Math::Vector3d(remap(viewArea.left, _screenW), remap(viewArea.height() - viewArea.top, _screenH), 0));
copyToVertexArray(1, Math::Vector3d(remap(position.x, _screenW), remap(_screenH - position.y, _screenH), 0));
@@ -385,7 +385,7 @@ void OpenGLShaderRenderer::drawCelestialBody(Math::Vector3d position, float radi
copyToVertexArray(0, position);
- for(int i = 0; i <= triangleAmount; i++) {
+ for (int i = 0; i <= triangleAmount; i++) {
float x = position.x();
float y = position.y() + (radius * cos(i * twicePi / triangleAmount));
float z = position.z() + (adj * radius * sin(i * twicePi / triangleAmount));
@@ -422,7 +422,7 @@ void OpenGLShaderRenderer::renderCrossair(const Common::Point crossairPosition)
useColor(255, 255, 255);
glLineWidth(MAX(2, g_system->getWidth() / 192)); // It will not work in every OpenGL implementation since the
- // spec doesn't require support for line widths other than 1
+ // spec doesn't require support for line widths other than 1
copyToVertexArray(0, Math::Vector3d(remap(crossairPosition.x - 3, _screenW), remap(_screenH - crossairPosition.y, _screenH), 0));
copyToVertexArray(1, Math::Vector3d(remap(crossairPosition.x - 1, _screenW), remap(_screenH - crossairPosition.y, _screenH), 0));
@@ -527,9 +527,9 @@ void OpenGLShaderRenderer::useStipple(bool enabled) {
glEnable(GL_POLYGON_OFFSET_FILL);
glPolygonOffset(factor - 0.5f, -1.0f);
if (_renderMode == Common::kRenderZX ||
- _renderMode == Common::kRenderCPC ||
- _renderMode == Common::kRenderCGA ||
- _renderMode == Common::kRenderHercG)
+ _renderMode == Common::kRenderCPC ||
+ _renderMode == Common::kRenderCGA ||
+ _renderMode == Common::kRenderHercG)
_triangleShader->setUniform("stipple", 128, _variableStippleArray);
else
_triangleShader->setUniform("stipple", 128, _defaultShaderStippleArray);
diff --git a/engines/freescape/gfx_opengl_shaders.h b/engines/freescape/gfx_opengl_shaders.h
index 38252a69954..2b78b16ddce 100644
--- a/engines/freescape/gfx_opengl_shaders.h
+++ b/engines/freescape/gfx_opengl_shaders.h
@@ -48,7 +48,9 @@ public:
void copyToVertexArray(uint idx, const Math::Vector3d &src) {
assert(idx < kVertexArraySize);
- _verts[idx].x = src.x(); _verts[idx].y = src.y(); _verts[idx].z = src.z();
+ _verts[idx].x = src.x();
+ _verts[idx].y = src.y();
+ _verts[idx].z = src.z();
}
Vertex *_verts;
diff --git a/engines/freescape/gfx_opengl_texture.cpp b/engines/freescape/gfx_opengl_texture.cpp
index bcbd1a6c054..cd70fc76bee 100644
--- a/engines/freescape/gfx_opengl_texture.cpp
+++ b/engines/freescape/gfx_opengl_texture.cpp
@@ -42,11 +42,11 @@ static uint32 upperPowerOfTwo(uint32 v) {
}
OpenGLTexture::OpenGLTexture() :
- _internalFormat(0),
- _sourceFormat(0),
- _internalWidth(0),
- _internalHeight(0),
- _upsideDown(false) {
+ _internalFormat(0),
+ _sourceFormat(0),
+ _internalWidth(0),
+ _internalHeight(0),
+ _upsideDown(false) {
glGenTextures(1, &_id);
}
diff --git a/engines/freescape/gfx_tinygl.cpp b/engines/freescape/gfx_tinygl.cpp
index bc1d5cb73d0..4fa5aa24c93 100644
--- a/engines/freescape/gfx_tinygl.cpp
+++ b/engines/freescape/gfx_tinygl.cpp
@@ -414,10 +414,14 @@ void TinyGLRenderer::renderFace(const Common::Array<Math::Vector3d> &vertices) {
tglDepthMask(TGL_FALSE);
tglBegin(TGL_QUADS);
- tglTexCoord2f(0.0f, 0.0f); tglVertex2f(0.0f, 0.0f);
- tglTexCoord2f(1.0, 0.0f); tglVertex2f(1.0, 0.0f);
- tglTexCoord2f(1.0, 1.0); tglVertex2f(1.0, 1.0);
- tglTexCoord2f(0.0f, 1.0); tglVertex2f(0.0f, 1.0);
+ tglTexCoord2f(0.0f, 0.0f);
+ tglVertex2f(0.0f, 0.0f);
+ tglTexCoord2f(1.0, 0.0f);
+ tglVertex2f(1.0, 0.0f);
+ tglTexCoord2f(1.0, 1.0);
+ tglVertex2f(1.0, 1.0);
+ tglTexCoord2f(0.0f, 1.0);
+ tglVertex2f(0.0f, 1.0);
tglEnd();
tglDepthMask(TGL_TRUE);
@@ -470,11 +474,11 @@ void TinyGLRenderer::drawCelestialBody(Math::Vector3d position, float radius, by
copyToVertexArray(0, position);
float adj = 1.25; // Perspective correction
- for(int i = 0; i <= triangleAmount; i++) {
+ for (int i = 0; i <= triangleAmount; i++) {
copyToVertexArray(i + 1,
- Math::Vector3d(position.x(), position.y() + (radius * cos(i * twicePi / triangleAmount)),
- position.z() + (adj * radius * sin(i * twicePi / triangleAmount)))
- );
+ Math::Vector3d(position.x(), position.y() + (radius * cos(i * twicePi / triangleAmount)),
+ position.z() + (adj * radius * sin(i * twicePi / triangleAmount)))
+ );
}
tglVertexPointer(3, TGL_FLOAT, 0, _verts);
@@ -488,11 +492,11 @@ void TinyGLRenderer::drawCelestialBody(Math::Vector3d position, float radius, by
tglEnableClientState(TGL_VERTEX_ARRAY);
copyToVertexArray(0, position);
- for(int i = 0; i <= triangleAmount; i++) {
+ for (int i = 0; i <= triangleAmount; i++) {
copyToVertexArray(i + 1,
- Math::Vector3d(position.x(), position.y() + (radius * cos(i * twicePi / triangleAmount)),
- position.z() + (adj * radius * sin(i * twicePi / triangleAmount)))
- );
+ Math::Vector3d(position.x(), position.y() + (radius * cos(i * twicePi / triangleAmount)),
+ position.z() + (adj * radius * sin(i * twicePi / triangleAmount)))
+ );
}
tglVertexPointer(3, TGL_FLOAT, 0, _verts);
@@ -601,7 +605,7 @@ void TinyGLRenderer::flipBuffer() {
if (!dirtyAreas.empty()) {
for (auto &it : dirtyAreas) {
g_system->copyRectToScreen(glBuffer.getBasePtr(it.left, it.top), glBuffer.pitch,
- it.left, it.top, it.width(), it.height());
+ it.left, it.top, it.width(), it.height());
}
}
}
diff --git a/engines/freescape/gfx_tinygl.h b/engines/freescape/gfx_tinygl.h
index 973b1b63282..489cc5fa3b2 100644
--- a/engines/freescape/gfx_tinygl.h
+++ b/engines/freescape/gfx_tinygl.h
@@ -44,7 +44,9 @@ public:
Vertex *_verts;
void copyToVertexArray(uint idx, const Math::Vector3d &src) {
assert(idx < kVertexArraySize);
- _verts[idx].x = src.x(); _verts[idx].y = src.y(); _verts[idx].z = src.z();
+ _verts[idx].x = src.x();
+ _verts[idx].y = src.y();
+ _verts[idx].z = src.z();
}
struct Coord {
@@ -56,7 +58,8 @@ public:
void copyToTexCoordArray(uint idx, float x, float y) {
assert(idx < kVertexArraySize);
- _texCoord[idx].x = x; _texCoord[idx].y = y;
+ _texCoord[idx].x = x;
+ _texCoord[idx].y = y;
}
bool _stippleEnabled;
diff --git a/engines/freescape/movement.cpp b/engines/freescape/movement.cpp
index e2e4b17dbbc..604d73ab53a 100644
--- a/engines/freescape/movement.cpp
+++ b/engines/freescape/movement.cpp
@@ -91,7 +91,7 @@ void FreescapeEngine::initKeymaps(Common::Keymap *engineKeyMap, Common::Keymap *
act->addDefaultInputMapping("JOY_X");
engineKeyMap->addAction(act);
- // I18N: Toggles between cursor lock modes, switching between free cursor movement and camera/head movement.
+ // I18N: Toggles between cursor lock modes, switching between free cursor movement and camera/head movement.
act = new Common::Action("SWITCH", _("Change mode"));
act->setCustomEngineActionEvent(kActionChangeMode);
act->addDefaultInputMapping("SPACE");
diff --git a/engines/freescape/sound.cpp b/engines/freescape/sound.cpp
index 32507952ee2..37fa398f6f6 100644
--- a/engines/freescape/sound.cpp
+++ b/engines/freescape/sound.cpp
@@ -197,7 +197,7 @@ void FreescapeEngine::loadSpeakerFxZX(Common::SeekableReadStream *file, int sfxT
//bVar4 = bVar4 ^ 0x10;
beep = !beep;
repetitions = (((uint16)soundType * 0x100 + (uint16)soundType * -2) -
- (uint16)((uint16)soundType * 0x100 < (uint16)soundType)) + (uVar2 & 0xff);
+ (uint16)((uint16)soundType * 0x100 < (uint16)soundType)) + (uVar2 & 0xff);
uint8 bVar9 = (byte)repetitions;
uint8 bVar8 = (byte)((uint16)repetitions >> 8);
uint8 bVar1 = bVar9 - bVar8;
diff --git a/engines/freescape/sweepAABB.cpp b/engines/freescape/sweepAABB.cpp
index a28502d7ab7..05f4b5566e6 100644
--- a/engines/freescape/sweepAABB.cpp
+++ b/engines/freescape/sweepAABB.cpp
@@ -50,7 +50,7 @@ float sweepAABB(Math::AABB const &a, Math::AABB const &b, Math::Vector3d const &
// X min
s = lineToPlane(zero, direction, m, Math::Vector3d(-1, 0, 0));
- if (s >= 0 && direction.x() > 0 && s < h && between(s * direction.y(), m.y(), m.y()+mh.y()) && between(s * direction.z(), m.z(), m.z() + mh.z())) {
+ if (s >= 0 && direction.x() > 0 && s < h && between(s * direction.y(), m.y(), m.y() + mh.y()) && between(s * direction.z(), m.z(), m.z() + mh.z())) {
h = s;
normal = Math::Vector3d(-1, 0, 0);
}
@@ -83,7 +83,7 @@ float sweepAABB(Math::AABB const &a, Math::AABB const &b, Math::Vector3d const &
// Z min
m.y() = m.y() - mh.y();
s = lineToPlane(zero, direction, m, Math::Vector3d(0, 0, -1));
- if (s >= 0 && direction.z() > 0 && s < h && between(s * direction.x(), m.x() , m.x() + mh.x()) && between(s * direction.y(), m.y(), m.y() + mh.y())) {
+ if (s >= 0 && direction.z() > 0 && s < h && between(s * direction.x(), m.x(), m.x() + mh.x()) && between(s * direction.y(), m.y(), m.y() + mh.y())) {
h = s;
normal = Math::Vector3d(0, 0, -1);
}
diff --git a/engines/freescape/ui.cpp b/engines/freescape/ui.cpp
index 5837cf773cb..bc01512d581 100644
--- a/engines/freescape/ui.cpp
+++ b/engines/freescape/ui.cpp
@@ -24,7 +24,7 @@
namespace Freescape {
void FreescapeEngine::waitInLoop(int maxWait) {
- for (int i = 0; i < maxWait; i++ ) {
+ for (int i = 0; i < maxWait; i++) {
Common::Event event;
while (_eventManager->pollEvent(event)) {
Common::Point mousePos;
@@ -42,13 +42,14 @@ void FreescapeEngine::waitInLoop(int maxWait) {
if (_demoMode)
break;
- if (_shootMode) {;
+ if (_shootMode) {
+ ;
break;
} else {
// Mouse pointer is locked into the the middle of the screen
// since we only need the relative movements. This will not affect any touchscreen device
// so on-screen controls are still accesible
- mousePos.x = g_system->getWidth() * ( _viewArea.left + _viewArea.width() / 2) / _screenW;
+ mousePos.x = g_system->getWidth() * (_viewArea.left + _viewArea.width() / 2) / _screenW;
mousePos.y = g_system->getHeight() * (_viewArea.top + _viewArea.height() / 2) / _screenW;
if (_invertY)
event.relMouse.y = -event.relMouse.y;
@@ -82,7 +83,7 @@ void FreescapeEngine::titleScreen() {
return;
int maxWait = 60 * 6;
- for (int i = 0; i < maxWait; i++ ) {
+ for (int i = 0; i < maxWait; i++) {
Common::Event event;
while (_eventManager->pollEvent(event)) {
switch (event.type) {
@@ -103,9 +104,9 @@ void FreescapeEngine::titleScreen() {
default:
break;
}
- break;
+ break;
case Common::EVENT_RBUTTONDOWN:
- // fallthrough
+ // fallthrough
case Common::EVENT_LBUTTONDOWN:
if (g_system->hasFeature(OSystem::kFeatureTouchscreen))
maxWait = -1;
@@ -131,20 +132,20 @@ Graphics::Surface *FreescapeEngine::drawStringsInSurface(const Common::Array<Com
uint32 back = _gfx->_texturePixelFormat.ARGBToColor(0x00, 0x00, 0x00, 0x00);
switch (_renderMode) {
- case Common::kRenderCGA:
- case Common::kRenderHercG:
- color = 1;
- break;
- case Common::kRenderZX:
- color = isCastle() ? 7 : 6;
- break;
- case Common::kRenderCPC:
- color = _gfx->_underFireBackgroundColor;
- if (color == uint32(-1))
- color = 14;
- break;
- default:
+ case Common::kRenderCGA:
+ case Common::kRenderHercG:
+ color = 1;
+ break;
+ case Common::kRenderZX:
+ color = isCastle() ? 7 : 6;
+ break;
+ case Common::kRenderCPC:
+ color = _gfx->_underFireBackgroundColor;
+ if (color == uint32(-1))
color = 14;
+ break;
+ default:
+ color = 14;
}
uint8 r, g, b;
@@ -281,7 +282,7 @@ void FreescapeEngine::drawFullscreenMessageAndWait(Common::String message) {
}
void FreescapeEngine::drawBorderScreenAndWait(Graphics::Surface *surface, int maxWait) {
- for (int i = 0; i < maxWait; i++ ) {
+ for (int i = 0; i < maxWait; i++) {
Common::Event event;
while (_eventManager->pollEvent(event)) {
switch (event.type) {
@@ -314,7 +315,7 @@ void FreescapeEngine::drawBorderScreenAndWait(Graphics::Surface *surface, int ma
}
break;
case Common::EVENT_RBUTTONDOWN:
- // fallthrough
+ // fallthrough
case Common::EVENT_LBUTTONDOWN:
if (g_system->hasFeature(OSystem::kFeatureTouchscreen))
maxWait = -1;
diff --git a/engines/freescape/unpack.cpp b/engines/freescape/unpack.cpp
index 82ba15c6b63..0becfdf1b76 100644
--- a/engines/freescape/unpack.cpp
+++ b/engines/freescape/unpack.cpp
@@ -127,8 +127,7 @@ void unpack_data(unsigned char *unpacked_data, unsigned char *buf, unsigned int
memset(unpacked_data, fillbyte, count);
unpacked_data += count;
cur_unpacked_data_size += count;
- }
- else if ((opcode & 0xFE) == 0xB2) {
+ } else if ((opcode & 0xFE) == 0xB2) {
if ((cur_unpacked_data_size + count) > *unpacked_data_size) {
debug("overflow");
}
@@ -136,8 +135,7 @@ void unpack_data(unsigned char *unpacked_data, unsigned char *buf, unsigned int
unpacked_data += count;
cur_unpacked_data_size += count;
buf += count;
- }
- else {
+ } else {
debug("unknown opcode");
}
if ((opcode & 1) == 1) {
@@ -176,18 +174,18 @@ unsigned char *create_reloc_table(struct memstream *ms, struct dos_header *dh, s
}
reloc_length = (unsigned int)(eh->exepack_size - ((reloc - (ms->buf + exepack_offset)) & 0xFFFFFFFF) + strlen("Packed file is corrupt"));
- nb_reloc = (reloc_length - 16 * sizeof (unsigned short)) / 2;
+ nb_reloc = (reloc_length - 16 * sizeof(unsigned short)) / 2;
*reloc_table_size = nb_reloc * 2 * sizeof(unsigned short);
- buf_reloc = (unsigned char*)malloc(sizeof (char) * *reloc_table_size);
+ buf_reloc = (unsigned char*)malloc(sizeof(char) * *reloc_table_size);
assert(buf_reloc);
reloc += strlen("Packed file is corrupt");
msseek(ms, (reloc - ms->buf) & 0xFFFFFFFF);
for (i = 0; i < 16; i++) {
- if (msread(ms, &count, sizeof (unsigned short)) != sizeof (unsigned short)) {
+ if (msread(ms, &count, sizeof(unsigned short)) != sizeof(unsigned short)) {
debug("msread failed");
}
for (j = 0; j < count; j++) {
- if (msread(ms, &entry, sizeof (unsigned short)) != sizeof (unsigned short)) {
+ if (msread(ms, &entry, sizeof(unsigned short)) != sizeof(unsigned short)) {
debug("msread failed");
}
if (reloc_position >= *reloc_table_size) {
@@ -209,7 +207,7 @@ unsigned char *create_reloc_table(struct memstream *ms, struct dos_header *dh, s
Common::MemoryReadStream *writeExe(struct dos_header *dh, unsigned char *unpacked_data, unsigned int unpacked_data_size, unsigned char *reloc, size_t reloc_size, size_t padding) {
Common::MemoryWriteStreamDynamic buf(DisposeAfterUse::NO);
- buf.write(dh, sizeof (struct dos_header));
+ buf.write(dh, sizeof(struct dos_header));
buf.write(reloc, reloc_size);
for (size_t i = 0; i < padding; i++) {
buf.write("\x00", 1);
@@ -224,8 +222,8 @@ Common::MemoryReadStream *craftexec(struct dos_header *dh, struct exepack_header
int total_length;
int padding_length;
- memset(&dhead, 0, sizeof (struct dos_header));
- header_size = sizeof (struct dos_header) + reloc_size;
+ memset(&dhead, 0, sizeof(struct dos_header));
+ header_size = sizeof(struct dos_header) + reloc_size;
dhead.e_magic = DOS_SIGNATURE;
dhead.e_cparhdr = (header_size / 16) & 0xFFFF;
dhead.e_cparhdr = (dhead.e_cparhdr / 32 + 1) * 32;
@@ -237,8 +235,8 @@ Common::MemoryReadStream *craftexec(struct dos_header *dh, struct exepack_header
dhead.e_cs = eh->real_cs;
dhead.e_minalloc = dh->e_minalloc;
dhead.e_maxalloc = 0xFFFF;
- dhead.e_lfarlc = sizeof (struct dos_header);
- dhead.e_crlc = (reloc_size / (2 * sizeof (unsigned short))) & 0xFFFF;
+ dhead.e_lfarlc = sizeof(struct dos_header);
+ dhead.e_crlc = (reloc_size / (2 * sizeof(unsigned short))) & 0xFFFF;
dhead.e_cblp = total_length % 512;
dhead.e_cp = (total_length / 512 + 1) & 0xFFFF;
//print_dos_header(&dhead);
@@ -257,13 +255,13 @@ Common::MemoryReadStream *unpack(struct memstream *ms) {
unsigned int reloc_size;
unsigned char *reloc = NULL;
- if (msread(ms, &dh, sizeof (struct dos_header)) != sizeof (struct dos_header)) {
+ if (msread(ms, &dh, sizeof(struct dos_header)) != sizeof(struct dos_header)) {
return nullptr;
}
//print_dos_header(&dh);
exepack_offset = (dh.e_cparhdr + dh.e_cs) * 16;
msseek(ms, exepack_offset);
- if (msread(ms, &eh, sizeof (struct exepack_header)) != sizeof (struct exepack_header)) {
+ if (msread(ms, &eh, sizeof(struct exepack_header)) != sizeof(struct exepack_header)) {
return nullptr;
}
//print_exepack_header(&eh);
@@ -274,9 +272,9 @@ Common::MemoryReadStream *unpack(struct memstream *ms) {
debug("Header exepack = %X\n", exepack_offset);
//print_exepack_header(&eh);
unpacked_data_size = eh.dest_len * 16;
- unpacked_data = (unsigned char*)malloc(sizeof (char) * unpacked_data_size);
+ unpacked_data = (unsigned char*)malloc(sizeof(char) * unpacked_data_size);
assert(unpacked_data);
- memset(unpacked_data, 0x00, sizeof (char) * unpacked_data_size);
+ memset(unpacked_data, 0x00, sizeof(char) * unpacked_data_size);
packed_data_start = dh.e_cparhdr * 16;
packed_data_end = exepack_offset;
packed_data_len = packed_data_end - packed_data_start;
@@ -321,7 +319,7 @@ void *memmem(void *l, size_t l_len, const void *s, size_t s_len) {
void msopen(Common::File &file, struct memstream *ms) {
assert(ms);
- ms->buf = (unsigned char*)malloc(sizeof (char) * file.size());
+ ms->buf = (unsigned char*)malloc(sizeof(char) * file.size());
assert(ms->buf);
assert(file.read(ms->buf, file.size()) == file.size());
@@ -340,8 +338,7 @@ unsigned int msread(struct memstream *ms, void *buf, unsigned int count) {
}
if (count < (ms->length - ms->pos)) {
length = count;
- }
- else {
+ } else {
length = ms->length - ms->pos;
}
if (length > 0) {
@@ -390,7 +387,7 @@ int test_dos_header(struct memstream *ms) {
if (ms == NULL) {
return 0;
}
- if (msread(ms, &dh, sizeof (struct dos_header)) != sizeof (struct dos_header)) {
+ if (msread(ms, &dh, sizeof(struct dos_header)) != sizeof(struct dos_header)) {
return 0;
}
msseek(ms, 0x00);
More information about the Scummvm-git-logs
mailing list