[Scummvm-git-logs] scummvm master -> fbf7216c30b37a66f439243d8f46e8450f5396f8
neuromancer
noreply at scummvm.org
Tue Oct 14 02:52:46 UTC 2025
This automated email contains information about 5 new commits which have been
pushed to the 'scummvm' repo located at https://api.github.com/repos/scummvm/scummvm .
Summary:
175067292c FREESCAPE: refine end game conditions in castle
d213c4ef3c FREESCAPE: corrected invalid value in the game state
38de90200d FREESCAPE: improved shake effect for opengl
ff5b6d253d TINYGL: extended tglStipple to allow background and foreground colors
fbf7216c30 FREESCAPE: reworked tinygl renderer to use glstipple extension
Commit: 175067292c3ea4b45d848a58039a79a70b334d06
https://github.com/scummvm/scummvm/commit/175067292c3ea4b45d848a58039a79a70b334d06
Author: neuromancer (gustavo.grieco at gmail.com)
Date: 2025-10-13T23:51:52-03:00
Commit Message:
FREESCAPE: refine end game conditions in castle
Changed paths:
engines/freescape/games/castle/castle.cpp
diff --git a/engines/freescape/games/castle/castle.cpp b/engines/freescape/games/castle/castle.cpp
index 7c889990cc5..acd8f1f6e8d 100644
--- a/engines/freescape/games/castle/castle.cpp
+++ b/engines/freescape/games/castle/castle.cpp
@@ -466,13 +466,12 @@ bool CastleEngine::checkIfGameEnded() {
insertTemporaryMessage(_fallenMessage, _countdown - 4);
_gameStateControl = kFreescapeGameStateEnd;
}
+ if ((isSpectrum() && getGameBit(31)) || (isDOS() && _currentArea->getAreaID() == 74)) { // Escaped!
+ _gameStateControl = kFreescapeGameMissionComplete;
+ return true;
+ }
}
-
- if (getGameBit(31) && _currentArea->getAreaID() == 74) { // Escaped!
- _gameStateControl = kFreescapeGameStateEnd;
- return true;
- } else
- return FreescapeEngine::checkIfGameEnded();
+ return FreescapeEngine::checkIfGameEnded();
}
void CastleEngine::endGame() {
@@ -480,7 +479,7 @@ void CastleEngine::endGame() {
_delayedShootObject = nullptr;
_endGamePlayerEndArea = true;
- if (getGameBit(31) || _currentArea->getAreaID() == 74) {
+ if ((isSpectrum() && getGameBit(31)) || (isDOS() && _currentArea->getAreaID() == 74)) { // Escaped!
insertTemporaryMessage(_messagesList[5], INT_MIN);
if (isDOS()) {
Commit: d213c4ef3c61b646f5b20037fbc46dc1fd17f478
https://github.com/scummvm/scummvm/commit/d213c4ef3c61b646f5b20037fbc46dc1fd17f478
Author: neuromancer (gustavo.grieco at gmail.com)
Date: 2025-10-13T23:51:52-03:00
Commit Message:
FREESCAPE: corrected invalid value in the game state
Changed paths:
engines/freescape/games/castle/castle.cpp
diff --git a/engines/freescape/games/castle/castle.cpp b/engines/freescape/games/castle/castle.cpp
index acd8f1f6e8d..a4923b14fb0 100644
--- a/engines/freescape/games/castle/castle.cpp
+++ b/engines/freescape/games/castle/castle.cpp
@@ -467,7 +467,7 @@ bool CastleEngine::checkIfGameEnded() {
_gameStateControl = kFreescapeGameStateEnd;
}
if ((isSpectrum() && getGameBit(31)) || (isDOS() && _currentArea->getAreaID() == 74)) { // Escaped!
- _gameStateControl = kFreescapeGameMissionComplete;
+ _gameStateControl = kFreescapeGameStateEnd;
return true;
}
}
Commit: 38de90200d9aeeff73f8537eee9ad8f39497b0de
https://github.com/scummvm/scummvm/commit/38de90200d9aeeff73f8537eee9ad8f39497b0de
Author: neuromancer (gustavo.grieco at gmail.com)
Date: 2025-10-13T23:51:52-03:00
Commit Message:
FREESCAPE: improved shake effect for opengl
Changed paths:
engines/freescape/gfx_opengl.cpp
diff --git a/engines/freescape/gfx_opengl.cpp b/engines/freescape/gfx_opengl.cpp
index 488469c2d2c..1caba8d79b5 100644
--- a/engines/freescape/gfx_opengl.cpp
+++ b/engines/freescape/gfx_opengl.cpp
@@ -264,7 +264,16 @@ void OpenGLRenderer::positionCamera(const Math::Vector3d &pos, const Math::Vecto
glMultMatrixf(lookMatrix.getData());
glRotatef(rollAngle, 0.0f, 0.0f, 1.0f);
glTranslatef(-pos.x(), -pos.y(), -pos.z());
- glTranslatef(_shakeOffset.x, _shakeOffset.y, 0);
+
+ // Apply a 2D shake effect on the projection matrix.
+ // This avoids moving the camera in the 3D world, which could cause clipping issues.
+ glMatrixMode(GL_PROJECTION);
+ GLfloat projMatrix[16];
+ glGetFloatv(GL_PROJECTION_MATRIX, projMatrix);
+ glLoadIdentity();
+ glTranslatef(_shakeOffset.x * 0.05f, _shakeOffset.y * 0.05f, 0.0f);
+ glMultMatrixf(projMatrix);
+ glMatrixMode(GL_MODELVIEW);
}
void OpenGLRenderer::renderSensorShoot(byte color, const Math::Vector3d sensor, const Math::Vector3d target, const Common::Rect &viewArea) {
Commit: ff5b6d253d8ad5aeb2d90d5d4afcc0c2f9b4aa89
https://github.com/scummvm/scummvm/commit/ff5b6d253d8ad5aeb2d90d5d4afcc0c2f9b4aa89
Author: neuromancer (gustavo.grieco at gmail.com)
Date: 2025-10-13T23:51:52-03:00
Commit Message:
TINYGL: extended tglStipple to allow background and foreground colors
Changed paths:
graphics/tinygl/api.cpp
graphics/tinygl/gl.h
graphics/tinygl/misc.cpp
graphics/tinygl/opinfo.h
graphics/tinygl/zbuffer.h
graphics/tinygl/zdirtyrect.cpp
graphics/tinygl/zdirtyrect.h
graphics/tinygl/zgl.h
graphics/tinygl/ztriangle.cpp
diff --git a/graphics/tinygl/api.cpp b/graphics/tinygl/api.cpp
index d82bdce6d16..46bb8810644 100644
--- a/graphics/tinygl/api.cpp
+++ b/graphics/tinygl/api.cpp
@@ -294,6 +294,17 @@ void tglPolygonStipple(const TGLubyte *mask) {
c->gl_add_op(p);
}
+void tglStippleColor(TGLubyte r, TGLubyte g, TGLubyte b) {
+ TinyGL::GLContext *c = TinyGL::gl_get_context();
+ TinyGL::GLParam p[7];
+
+ p[0].op = TinyGL::OP_StippleColor;
+ p[1].f = r;
+ p[2].f = g;
+ p[3].f = b;
+ c->gl_add_op(p);
+}
+
void tglPolygonMode(TGLenum face, TGLenum mode) {
TinyGL::GLContext *c = TinyGL::gl_get_context();
TinyGL::GLParam p[3];
diff --git a/graphics/tinygl/gl.h b/graphics/tinygl/gl.h
index 37626998dc7..e227fa3629a 100644
--- a/graphics/tinygl/gl.h
+++ b/graphics/tinygl/gl.h
@@ -97,6 +97,7 @@ enum {
TGL_FRONT_FACE = 0x0B46,
TGL_POLYGON_MODE = 0x0B40,
+ TGL_TWO_COLOR_STIPPLE = 0x0BFF,
// Display Lists
TGL_COMPILE = 0x1300,
TGL_COMPILE_AND_EXECUTE = 0x1301,
@@ -772,6 +773,8 @@ void tglLineStipple(TGLint factor, TGLushort pattern);
void tglPolygonStipple(const TGLubyte *mask);
void tglGetPolygonStipple(TGLubyte *mask);
+void tglStippleColor(TGLubyte r, TGLubyte g, TGLubyte b);
+
void tglLineWidth(TGLfloat width);
void tglPointSize(TGLfloat size);
diff --git a/graphics/tinygl/misc.cpp b/graphics/tinygl/misc.cpp
index f7c1f86b998..d38d107ccdd 100644
--- a/graphics/tinygl/misc.cpp
+++ b/graphics/tinygl/misc.cpp
@@ -130,6 +130,9 @@ void GLContext::glopEnableDisable(GLParam *p) {
else
offset_states &= ~TGL_OFFSET_LINE;
break;
+ case TGL_TWO_COLOR_STIPPLE:
+ two_color_stipple_enabled = v != 0;
+ break;
default:
if (code >= TGL_LIGHT0 && code < TGL_LIGHT0 + T_MAX_LIGHTS) {
gl_enable_disable_light(code - TGL_LIGHT0, v);
@@ -220,6 +223,13 @@ void GLContext::glopPolygonStipple(GLParam *p) {
}
}
+void GLContext::glopStippleColor(GLParam *p) {
+ int r = (int)p[1].f;
+ int g = (int)p[2].f;
+ int b = (int)p[3].f;
+ stippleColor = r << 16 | g << 8 | b;
+}
+
void GLContext::glopPolygonOffset(GLParam *p) {
offset_factor = p[1].f;
offset_units = p[2].f;
diff --git a/graphics/tinygl/opinfo.h b/graphics/tinygl/opinfo.h
index 5bad395699f..611d422b2db 100644
--- a/graphics/tinygl/opinfo.h
+++ b/graphics/tinygl/opinfo.h
@@ -86,6 +86,7 @@ ADD_OP(StencilFunc, 3, "%C %d %d")
ADD_OP(StencilOp, 3, "%C %C %C")
ADD_OP(PolygonStipple, 128, "%d")
+ADD_OP(StippleColor, 3, "%f %f %f")
ADD_OP(Fog, 5, "%d %f %f %f %f")
diff --git a/graphics/tinygl/zbuffer.h b/graphics/tinygl/zbuffer.h
index 27925d1f508..d3d75acc0ba 100644
--- a/graphics/tinygl/zbuffer.h
+++ b/graphics/tinygl/zbuffer.h
@@ -379,7 +379,7 @@ private:
int &dzdx, int &dsdx, int &dtdx, int &drdx, int &dgdx, int &dbdx, uint dadx,
uint &fog, int fog_r, int fog_g, int fog_b, int &dfdx);
- template <bool kDepthWrite, bool kEnableScissor, bool kStencilEnabled, bool StippleEnabled, bool kDepthTestEnabled>
+ template <bool kDepthWrite, bool kEnableScissor, bool kStencilEnabled, bool kStippleEnabled, bool kDepthTestEnabled>
void putPixelDepth(uint *pz, byte *ps, int _a, int x, int y, uint &z, int &dzdx);
@@ -652,6 +652,14 @@ public:
_polygonStipplePattern = stipple;
}
+ void enableTwoColorStipple(bool enable) {
+ _twoColorStippleEnabled = enable;
+ }
+
+ void setStippleColor(int r, int g, int b) {
+ _stippleColor = RGB_TO_PIXEL(r, g, b);
+ }
+
void setStencilTestFunc(int stencilFunc, byte stencilValue, byte stencilMask) {
_stencilTestFunc = stencilFunc;
_stencilRefVal = stencilValue;
@@ -838,6 +846,8 @@ private:
int _stencilDppass;
bool _polygonStippleEnabled;
+ bool _twoColorStippleEnabled;
+ uint32 _stippleColor;
const byte *_polygonStipplePattern;
int _depthFunc;
int _offsetStates;
diff --git a/graphics/tinygl/zdirtyrect.cpp b/graphics/tinygl/zdirtyrect.cpp
index b34947905fa..6af86ae35a6 100644
--- a/graphics/tinygl/zdirtyrect.cpp
+++ b/graphics/tinygl/zdirtyrect.cpp
@@ -492,6 +492,8 @@ RasterizationDrawCall::RasterizationState RasterizationDrawCall::captureState()
state.fogColorR = c->fog_color.X;
state.fogColorG = c->fog_color.Y;
state.fogColorB = c->fog_color.Z;
+ state.stippleColor = c->stippleColor;
+ state.two_color_stipple_enabled = c->two_color_stipple_enabled;
memcpy(state.scissor, c->scissor, sizeof(state.scissor));
memcpy(state.viewportScaling, c->viewport.scale._v, sizeof(c->viewport.scale._v));
@@ -521,6 +523,8 @@ void RasterizationDrawCall::applyState(const RasterizationDrawCall::Rasterizatio
c->fb->setFogEnabled(state.fogEnabled);
c->fb->setFogColor(state.fogColorR, state.fogColorG, state.fogColorB);
c->fb->setPolygonStipplePattern(state.polygonStipplePattern);
+ c->fb->setStippleColor(state.stippleColor >> 16, (state.stippleColor >> 8) & 0xff, state.stippleColor & 0xff);
+ c->fb->enableTwoColorStipple(state.two_color_stipple_enabled);
c->fb->enablePolygonStipple(state.polygonStippleEnabled);
c->scissor_test_enabled = state.enableScissor;
diff --git a/graphics/tinygl/zdirtyrect.h b/graphics/tinygl/zdirtyrect.h
index dafb59409c0..e7cab5a00c6 100644
--- a/graphics/tinygl/zdirtyrect.h
+++ b/graphics/tinygl/zdirtyrect.h
@@ -176,6 +176,8 @@ private:
int stencilDppass;
bool polygonStippleEnabled;
byte polygonStipplePattern[128];
+ uint32 stippleColor;
+ bool two_color_stipple_enabled;
GLTexture *texture;
uint wrapS, wrapT;
GLTextureEnv textureEnv;
diff --git a/graphics/tinygl/zgl.h b/graphics/tinygl/zgl.h
index 640db31de41..717896bdb9a 100644
--- a/graphics/tinygl/zgl.h
+++ b/graphics/tinygl/zgl.h
@@ -458,6 +458,8 @@ struct GLContext {
// stipple
bool polygon_stipple_enabled;
byte polygon_stipple_pattern[128];
+ uint32 stippleColor;
+ bool two_color_stipple_enabled;
// blit test
Common::List<BlitImage *> _blitImages;
diff --git a/graphics/tinygl/ztriangle.cpp b/graphics/tinygl/ztriangle.cpp
index 399f16e131d..649f2695cd2 100644
--- a/graphics/tinygl/ztriangle.cpp
+++ b/graphics/tinygl/ztriangle.cpp
@@ -50,12 +50,16 @@ void FrameBuffer::putPixelNoTexture(int fbOffset, uint *pz, byte *ps, int _a,
int x, int y, uint &z, uint &r, uint &g, uint &b, uint &a,
int &dzdx, int &drdx, int &dgdx, int &dbdx, uint dadx,
uint &fog, int fog_r, int fog_g, int fog_b, int &dfdx) {
+ bool useStippleColor = false;
if (kEnableScissor && scissorPixel(x + _a, y)) {
goto end;
}
- if (kStippleEnabled && !applyStipplePattern(x + _a, y, _polygonStipplePattern)) {
- goto end;
+ if (kStippleEnabled && applyStipplePattern(x + _a, y, _polygonStipplePattern)) {
+ if (_twoColorStippleEnabled)
+ useStippleColor = true;
+ else
+ goto end;
}
if (kStencilEnabled) {
@@ -75,9 +79,17 @@ void FrameBuffer::putPixelNoTexture(int fbOffset, uint *pz, byte *ps, int _a,
stencilOp(true, depthTestResult, ps + _a);
}
if (depthTestResult) {
- writePixel<kEnableAlphaTest, kEnableBlending, kDepthWrite, kFogMode>
- (fbOffset + _a, a >> (ZB_POINT_ALPHA_BITS - 8), r >> (ZB_POINT_RED_BITS - 8), g >> (ZB_POINT_GREEN_BITS - 8), b >> (ZB_POINT_BLUE_BITS - 8),
- z, fog, fog_r, fog_g, fog_b);
+ if (useStippleColor) {
+ uint sb = (_stippleColor >> 16) & 0xFF;
+ uint sg = (_stippleColor >> 8) & 0xFF;
+ uint sr = _stippleColor & 0xFF;
+ writePixel<kEnableAlphaTest, kEnableBlending, kDepthWrite, kFogMode>
+ (fbOffset + _a, a >> (ZB_POINT_ALPHA_BITS - 8), sr, sg, sb, z, fog, fog_r, fog_g, fog_b);
+ } else {
+ writePixel<kEnableAlphaTest, kEnableBlending, kDepthWrite, kFogMode>
+ (fbOffset + _a, a >> (ZB_POINT_ALPHA_BITS - 8), r >> (ZB_POINT_RED_BITS - 8), g >> (ZB_POINT_GREEN_BITS - 8), b >> (ZB_POINT_BLUE_BITS - 8),
+ z, fog, fog_r, fog_g, fog_b);
+ }
}
end:
z += dzdx;
Commit: fbf7216c30b37a66f439243d8f46e8450f5396f8
https://github.com/scummvm/scummvm/commit/fbf7216c30b37a66f439243d8f46e8450f5396f8
Author: neuromancer (gustavo.grieco at gmail.com)
Date: 2025-10-13T23:51:52-03:00
Commit Message:
FREESCAPE: reworked tinygl renderer to use glstipple extension
Changed paths:
engines/freescape/gfx.cpp
engines/freescape/gfx_tinygl.cpp
engines/freescape/gfx_tinygl.h
diff --git a/engines/freescape/gfx.cpp b/engines/freescape/gfx.cpp
index d7cbd89ff53..872b065ccc7 100644
--- a/engines/freescape/gfx.cpp
+++ b/engines/freescape/gfx.cpp
@@ -270,7 +270,7 @@ void Renderer::setColorMap(ColorMap *colorMap_) {
byte c2 = (pair >> 4) & 0xf;
byte *entry = (*_colorMap)[i];
for (int j = 0; j < 128; j++)
- _stipples[i][j] = getCGAStipple(entry[(j / 8) % 4], c1, c2);
+ _stipples[i][j] = getCGAStipple(entry[(j / 4) % 4], c1, c2);
}
} else if (_renderMode == Common::kRenderC64) {
fillColorPairArray();
@@ -280,7 +280,7 @@ void Renderer::setColorMap(ColorMap *colorMap_) {
byte c2 = (pair >> 4) & 0xf;
byte *entry = (*_colorMap)[i];
for (int j = 0; j < 128; j++)
- _stipples[i][j] = getC64Stipple(entry[(j / 8) % 4], c1, c2);
+ _stipples[i][j] = getC64Stipple(entry[(j / 4) % 4], c1, c2);
}
}
diff --git a/engines/freescape/gfx_tinygl.cpp b/engines/freescape/gfx_tinygl.cpp
index 1f778e21892..21470d3df14 100644
--- a/engines/freescape/gfx_tinygl.cpp
+++ b/engines/freescape/gfx_tinygl.cpp
@@ -46,9 +46,6 @@ TinyGLRenderer::TinyGLRenderer(int screenW, int screenH, Common::RenderMode rend
}
TinyGLRenderer::~TinyGLRenderer() {
- for (auto &it : _stippleTextureCache) {
- delete (TinyGL3DTexture *)it._value;
- }
TinyGL::destroyContext();
free(_verts);
free(_texCoord);
@@ -83,9 +80,6 @@ void TinyGLRenderer::init() {
tglDisable(TGL_TEXTURE_2D);
tglEnable(TGL_DEPTH_TEST);
_stippleEnabled = false;
- _lastColorSet0 = 0;
- _lastColorSet1 = 0;
- _stippleTexture = nullptr;
}
void TinyGLRenderer::setViewport(const Common::Rect &rect) {
@@ -362,16 +356,9 @@ void TinyGLRenderer::renderCrossair(const Common::Point &crossairPosition) {
void TinyGLRenderer::setStippleData(byte *data) {
if (!data) {
- _stippleTexture = nullptr;
- assert(_stippleEnabled == false);
_variableStippleArray = nullptr;
return;
}
- if (_stippleTextureCache.contains(uint64(data))) {
-
- }
- assert(_stippleTextureCache.size() <= 16);
-
_variableStippleArray = data;
}
@@ -381,12 +368,20 @@ void TinyGLRenderer::useStipple(bool enabled) {
if (enabled) {
if (!_variableStippleArray)
_variableStippleArray = _defaultStippleArray;
+ tglEnable(TGL_POLYGON_STIPPLE);
+ tglEnable(TGL_TWO_COLOR_STIPPLE);
+ tglPolygonStipple(_variableStippleArray);
} else {
- _stippleTexture = nullptr;
+ tglDisable(TGL_POLYGON_STIPPLE);
+ tglDisable(TGL_TWO_COLOR_STIPPLE);
+ _variableStippleArray = nullptr;
}
}
void TinyGLRenderer::renderFace(const Common::Array<Math::Vector3d> &vertices) {
+ if (_variableStippleArray && !_stippleEnabled)
+ return;
+
assert(vertices.size() >= 2);
const Math::Vector3d &v0 = vertices[0];
@@ -404,16 +399,6 @@ void TinyGLRenderer::renderFace(const Common::Array<Math::Vector3d> &vertices) {
return;
}
- if (_stippleEnabled) {
- if (_stippleTextureCache.contains(uint64(_variableStippleArray))) {
- _stippleTexture = _stippleTextureCache[uint64(_variableStippleArray)];
- } else {
- _stippleTexture = new TinyGL3DTexture(_variableStippleArray, _lastColorSet0, _lastColorSet1);
- _stippleTextureCache[uint64(_variableStippleArray)] = _stippleTexture;
- }
- } else if (_variableStippleArray)
- return; // We are in the middle of a stipple rendering operation, so we should skip this face
-
tglEnableClientState(TGL_VERTEX_ARRAY);
uint vi = 0;
for (uint i = 1; i < vertices.size() - 1; i++) { // no underflow since vertices.size() > 2
@@ -426,64 +411,8 @@ void TinyGLRenderer::renderFace(const Common::Array<Math::Vector3d> &vertices) {
}
tglVertexPointer(3, TGL_FLOAT, 0, _verts);
- if (_stippleEnabled) {
- tglClear(TGL_STENCIL_BUFFER_BIT);
- tglEnable(TGL_STENCIL_TEST);
- tglStencilFunc(TGL_ALWAYS, 1, 0xFF); // Always pass stencil test
- tglStencilOp(TGL_KEEP, TGL_KEEP, TGL_REPLACE); // Replace stencil buffer where drawn
- tglEnable(TGL_DEPTH_TEST);
- tglDepthMask(TGL_TRUE);
- tglColorMask(TGL_FALSE, TGL_FALSE, TGL_FALSE, TGL_FALSE);
- }
-
tglDrawArrays(TGL_TRIANGLES, 0, vi + 3);
tglDisableClientState(TGL_VERTEX_ARRAY);
-
- if (_stippleEnabled) {
- tglColorMask(TGL_TRUE, TGL_TRUE, TGL_TRUE, TGL_TRUE);
- tglStencilFunc(TGL_EQUAL, 1, 0xFF); // Only render where stencil value is 1
- tglStencilOp(TGL_KEEP, TGL_KEEP, TGL_KEEP); // Don't change stencil buffer
-
- tglMatrixMode(TGL_PROJECTION);
- tglPushMatrix();
-
- tglLoadIdentity();
- tglOrtho(0.0, 1.0, 0.0, 1.0, -1.0, 1.0); // Orthographic projection
-
- tglScalef(1, 1, 1);
- tglMatrixMode(TGL_MODELVIEW);
- tglPushMatrix();
- tglLoadIdentity();
-
- tglEnable(TGL_TEXTURE_2D);
- tglBindTexture(TGL_TEXTURE_2D, _stippleTexture->_id);
- tglColor4f(1.f, 1.f, 1.f, 1.f);
- 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);
- tglEnd();
-
- tglDepthMask(TGL_TRUE);
- tglDisable(TGL_STENCIL_TEST);
- tglDisable(TGL_TEXTURE_2D);
- tglDisable(TGL_TEXTURE);
- tglFlush();
- tglBindTexture(TGL_TEXTURE_2D, 0);
-
- tglMatrixMode(TGL_PROJECTION);
- tglPopMatrix();
-
- tglMatrixMode(TGL_MODELVIEW);
- tglPopMatrix();
- }
}
void TinyGLRenderer::drawCelestialBody(Math::Vector3d position, float radius, byte color) {
@@ -516,6 +445,10 @@ void TinyGLRenderer::drawCelestialBody(Math::Vector3d position, float radius, by
setStippleData(stipple);
useColor(r1, g1, b1);
+ if (r1 != r2 || g1 != g2 || b1 != b2) {
+ useStipple(true);
+ tglStippleColor(r2, g2, b2);
+ }
tglEnableClientState(TGL_VERTEX_ARRAY);
copyToVertexArray(0, position);
@@ -532,26 +465,7 @@ void TinyGLRenderer::drawCelestialBody(Math::Vector3d position, float radius, by
tglDrawArrays(TGL_TRIANGLE_FAN, 0, triangleAmount + 2);
tglDisableClientState(TGL_VERTEX_ARRAY);
- if (r1 != r2 || g1 != g2 || b1 != b2) {
- useStipple(true);
- useColor(r2, g2, b2);
-
- tglEnableClientState(TGL_VERTEX_ARRAY);
- copyToVertexArray(0, position);
-
- 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)))
- );
- }
-
- tglVertexPointer(3, TGL_FLOAT, 0, _verts);
- tglDrawArrays(TGL_TRIANGLE_FAN, 0, triangleAmount + 2);
- tglDisableClientState(TGL_VERTEX_ARRAY);
-
- useStipple(false);
- }
+ useStipple(false);
tglEnable(TGL_DEPTH_TEST);
tglDepthMask(TGL_TRUE);
@@ -578,9 +492,11 @@ void TinyGLRenderer::polygonOffset(bool enabled) {
}
void TinyGLRenderer::useColor(uint8 r, uint8 g, uint8 b) {
- _lastColorSet1 = _lastColorSet0;
- _lastColorSet0 = _texturePixelFormat.RGBToColor(r, g, b);
- tglColor4ub(r, g, b, 255);
+ if (_stippleEnabled) {
+ tglStippleColor(r, g, b);
+ } else {
+ tglColor4ub(r, g, b, 255);
+ }
}
void TinyGLRenderer::clear(uint8 r, uint8 g, uint8 b, bool ignoreViewport) {
diff --git a/engines/freescape/gfx_tinygl.h b/engines/freescape/gfx_tinygl.h
index 1b292640a16..a1a515ae88d 100644
--- a/engines/freescape/gfx_tinygl.h
+++ b/engines/freescape/gfx_tinygl.h
@@ -98,6 +98,26 @@ public:
virtual void flipBuffer() override;
virtual void drawFloor(uint8 color) override;
virtual Graphics::Surface *getScreenshot() override;
+
+ byte _defaultStippleArray[128] = {
+ 0x55, 0x55, 0x55, 0x55, 0x55, 0x55, 0x55, 0x55,
+ 0xAA, 0xAA, 0xAA, 0xAA, 0xAA, 0xAA, 0xAA, 0xAA,
+ 0x55, 0x55, 0x55, 0x55, 0x55, 0x55, 0x55, 0x55,
+ 0xAA, 0xAA, 0xAA, 0xAA, 0xAA, 0xAA, 0xAA, 0xAA,
+ 0x55, 0x55, 0x55, 0x55, 0x55, 0x55, 0x55, 0x55,
+ 0xAA, 0xAA, 0xAA, 0xAA, 0xAA, 0xAA, 0xAA, 0xAA,
+ 0x55, 0x55, 0x55, 0x55, 0x55, 0x55, 0x55, 0x55,
+ 0xAA, 0xAA, 0xAA, 0xAA, 0xAA, 0xAA, 0xAA, 0xAA,
+ 0x55, 0x55, 0x55, 0x55, 0x55, 0x55, 0x55, 0x55,
+ 0xAA, 0xAA, 0xAA, 0xAA, 0xAA, 0xAA, 0xAA, 0xAA,
+ 0x55, 0x55, 0x55, 0x55, 0x55, 0x55, 0x55, 0x55,
+ 0xAA, 0xAA, 0xAA, 0xAA, 0xAA, 0xAA, 0xAA, 0xAA,
+ 0x55, 0x55, 0x55, 0x55, 0x55, 0x55, 0x55, 0x55,
+ 0xAA, 0xAA, 0xAA, 0xAA, 0xAA, 0xAA, 0xAA, 0xAA,
+ 0x55, 0x55, 0x55, 0x55, 0x55, 0x55, 0x55, 0x55,
+ 0xAA, 0xAA, 0xAA, 0xAA, 0xAA, 0xAA, 0xAA, 0xAA,
+ };
+
};
} // End of namespace Freescape
More information about the Scummvm-git-logs
mailing list