[Scummvm-git-logs] scummvm master -> 0cefaaaa74ddd8ef8deb3012e82299f3bcf9c6de
neuromancer
noreply at scummvm.org
Sat Nov 12 11:06:46 UTC 2022
This automated email contains information about 4 new commits which have been
pushed to the 'scummvm' repo located at https://github.com/scummvm/scummvm .
Summary:
56eeb06b0a FREESCAPE: adjusted the view area for supported driller releases
cc56b8e3f9 FREESCAPE: reimplemented crossair as texture and removed its code from renderers
d92f661517 FREESCAPE: removed areaScale unused variable warnings
0cefaaaa74 FREESCAPE: corrected player aim when shooting in movement mode
Commit: 56eeb06b0a65f8198b31670f629b0b1e6c307674
https://github.com/scummvm/scummvm/commit/56eeb06b0a65f8198b31670f629b0b1e6c307674
Author: neuromancer (gustavo.grieco at gmail.com)
Date: 2022-11-12T09:58:32+01:00
Commit Message:
FREESCAPE: adjusted the view area for supported driller releases
Changed paths:
engines/freescape/games/driller.cpp
diff --git a/engines/freescape/games/driller.cpp b/engines/freescape/games/driller.cpp
index bc38ab8ddce..993158b7175 100644
--- a/engines/freescape/games/driller.cpp
+++ b/engines/freescape/games/driller.cpp
@@ -31,7 +31,11 @@ DrillerEngine::DrillerEngine(OSystem *syst, const ADGameDescription *gd) : Frees
// if (isAmiga())
// _viewArea = Common::Rect(72, 66, 567, 269);
// else
- _viewArea = Common::Rect(40, 16, 279, 116);
+ if (isDOS())
+ _viewArea = Common::Rect(40, 16, 280, 117);
+ else if (isAmiga() || isAtariST())
+ _viewArea = Common::Rect(36, 16, 284, 118);
+
_playerHeightNumber = 1;
_playerHeights.push_back(16);
_playerHeights.push_back(48);
Commit: cc56b8e3f9a91c19f9d51ebca7e37957d578e30d
https://github.com/scummvm/scummvm/commit/cc56b8e3f9a91c19f9d51ebca7e37957d578e30d
Author: neuromancer (gustavo.grieco at gmail.com)
Date: 2022-11-12T11:33:44+01:00
Commit Message:
FREESCAPE: reimplemented crossair as texture and removed its code from renderers
Changed paths:
engines/freescape/freescape.cpp
engines/freescape/freescape.h
engines/freescape/games/dark.cpp
engines/freescape/games/driller.cpp
engines/freescape/games/eclipse.cpp
engines/freescape/gfx.h
engines/freescape/gfx_opengl.cpp
engines/freescape/gfx_opengl.h
engines/freescape/gfx_tinygl.cpp
engines/freescape/gfx_tinygl.h
diff --git a/engines/freescape/freescape.cpp b/engines/freescape/freescape.cpp
index 0b7d4adfc7c..f5ec93d560e 100644
--- a/engines/freescape/freescape.cpp
+++ b/engines/freescape/freescape.cpp
@@ -177,10 +177,25 @@ Math::Vector3d FreescapeEngine::directionToVector(float pitch, float heading) {
}
void FreescapeEngine::drawUI() {
- _gfx->renderCrossair(0, _crossairPosition);
+ // TODO: crossair
_gfx->setViewport(_viewArea);
}
+void FreescapeEngine::drawCrossair(Graphics::Surface *surface) {
+ uint32 white = _gfx->_texturePixelFormat.ARGBToColor(0xFF, 0x00, 0x00, 0x00);
+
+ surface->drawLine(_crossairPosition.x - 3, _crossairPosition.y, _crossairPosition.x - 2, _crossairPosition.y, white);
+ surface->drawLine(_crossairPosition.x + 2, _crossairPosition.y, _crossairPosition.x + 3, _crossairPosition.y, white);
+
+ surface->drawLine(_crossairPosition.x, _crossairPosition.y - 3, _crossairPosition.x, _crossairPosition.y - 2, white);
+ surface->drawLine(_crossairPosition.x, _crossairPosition.y + 2, _crossairPosition.x, _crossairPosition.y + 3, white);
+}
+
+void FreescapeEngine::centerCrossair() {
+ _crossairPosition.x = _viewArea.left + _viewArea.width() / 2;
+ _crossairPosition.y = _viewArea.top + _viewArea.height() / 2;
+}
+
void FreescapeEngine::drawFrame() {
_gfx->updateProjectionMatrix(70.0, _nearClipPlane, _farClipPlane);
_gfx->positionCamera(_position, _position + _cameraFront);
@@ -325,10 +340,8 @@ void FreescapeEngine::processInput() {
break;
case Common::KEYCODE_SPACE:
_shootMode = !_shootMode;
- if (!_shootMode) {
- _crossairPosition.x = _screenW / 2;
- _crossairPosition.y = _screenH / 2;
- }
+ if (!_shootMode)
+ centerCrossair();
break;
default:
pressedKey(event.kbd.keycode);
@@ -418,6 +431,7 @@ Common::Error FreescapeEngine::run() {
// Simple main event loop
int saveSlot = ConfMan.getInt("save_slot");
_system->lockMouse(true);
+ centerCrossair();
if (_title) {
if (saveSlot == -1) {
diff --git a/engines/freescape/freescape.h b/engines/freescape/freescape.h
index fd1485893d4..5d3bc3fb8c8 100644
--- a/engines/freescape/freescape.h
+++ b/engines/freescape/freescape.h
@@ -103,11 +103,13 @@ public:
// UI
Common::Rect _viewArea;
Common::Rect _fullscreenViewArea;
+ void centerCrossair();
void convertBorder();
void drawBorder();
void drawTitle();
virtual void drawUI();
+ virtual void drawCrossair(Graphics::Surface *surface);
Graphics::Surface *_border;
Graphics::Surface *_title;
Texture *_borderTexture;
diff --git a/engines/freescape/games/dark.cpp b/engines/freescape/games/dark.cpp
index 9bcd3603524..7458d20aa7a 100644
--- a/engines/freescape/games/dark.cpp
+++ b/engines/freescape/games/dark.cpp
@@ -109,7 +109,6 @@ void DarkEngine::gotoArea(uint16 areaID, int entranceID) {
}
void DarkEngine::drawUI() {
- _gfx->renderCrossair(0, _crossairPosition);
uint32 gray = _gfx->_texturePixelFormat.ARGBToColor(0x00, 0xA0, 0xA0, 0xA0);
uint32 yellow = _gfx->_texturePixelFormat.ARGBToColor(0xFF, 0xFF, 0xFF, 0x55);
uint32 black = _gfx->_texturePixelFormat.ARGBToColor(0xFF, 0x00, 0x00, 0x00);
@@ -119,6 +118,7 @@ void DarkEngine::drawUI() {
surface = new Graphics::Surface();
surface->create(_screenW, _screenH, _gfx->_texturePixelFormat);
surface->fillRect(_fullscreenViewArea, gray);
+ drawCrossair(surface);
} else
return;
diff --git a/engines/freescape/games/driller.cpp b/engines/freescape/games/driller.cpp
index 993158b7175..f4cbe659b71 100644
--- a/engines/freescape/games/driller.cpp
+++ b/engines/freescape/games/driller.cpp
@@ -333,14 +333,13 @@ void DrillerEngine::loadAssetsFullGame() {
}
void DrillerEngine::drawUI() {
- _gfx->renderCrossair(0, _crossairPosition);
-
Graphics::Surface *surface = nullptr;
if (_border) { // This can be removed when all the borders are loaded
uint32 gray = _gfx->_texturePixelFormat.ARGBToColor(0x00, 0xA0, 0xA0, 0xA0);
surface = new Graphics::Surface();
surface->create(_screenW, _screenH, _gfx->_texturePixelFormat);
surface->fillRect(_fullscreenViewArea, gray);
+ drawCrossair(surface);
} else
return;
diff --git a/engines/freescape/games/eclipse.cpp b/engines/freescape/games/eclipse.cpp
index ad128026193..87e466d5766 100644
--- a/engines/freescape/games/eclipse.cpp
+++ b/engines/freescape/games/eclipse.cpp
@@ -167,13 +167,13 @@ void EclipseEngine::gotoArea(uint16 areaID, int entranceID) {
}
void EclipseEngine::drawUI() {
- _gfx->renderCrossair(0, _crossairPosition);
_gfx->setViewport(_fullscreenViewArea);
Graphics::Surface *surface = new Graphics::Surface();
surface->create(_screenW, _screenH, _gfx->_texturePixelFormat);
uint32 gray = _gfx->_texturePixelFormat.ARGBToColor(0x00, 0xA0, 0xA0, 0xA0);
surface->fillRect(_fullscreenViewArea, gray);
+ drawCrossair(surface);
int score = _gameStateVars[k8bitVariableScore];
uint32 yellow = _gfx->_texturePixelFormat.ARGBToColor(0xFF, 0xFF, 0xFF, 0x55);
diff --git a/engines/freescape/gfx.h b/engines/freescape/gfx.h
index 440869b8345..9fb4d6c6d65 100644
--- a/engines/freescape/gfx.h
+++ b/engines/freescape/gfx.h
@@ -81,7 +81,6 @@ public:
virtual void freeTexture(Texture *texture) = 0;
virtual void drawTexturedRect2D(const Common::Rect &screenRect, const Common::Rect &textureRect, Texture *texture) = 0;
- virtual void renderCrossair(byte color, const Common::Point position) = 0;
virtual void renderShoot(byte color, const Common::Point position) = 0;
virtual void renderCube(const Math::Vector3d &position, const Math::Vector3d &size, Common::Array<uint8> *colours);
virtual void renderRectangle(const Math::Vector3d &position, const Math::Vector3d &size, Common::Array<uint8> *colours);
diff --git a/engines/freescape/gfx_opengl.cpp b/engines/freescape/gfx_opengl.cpp
index 7ac2564a555..f10aa9ec0c6 100644
--- a/engines/freescape/gfx_opengl.cpp
+++ b/engines/freescape/gfx_opengl.cpp
@@ -172,37 +172,6 @@ void OpenGLRenderer::positionCamera(const Math::Vector3d &pos, const Math::Vecto
glTranslatef(-pos.x(), -pos.y(), -pos.z());
}
-void OpenGLRenderer::renderCrossair(byte color, const Common::Point position) {
- uint8 r, g, b;
- readFromPalette(color, r, g, b); // TODO: should use opposite color
-
- glMatrixMode(GL_PROJECTION);
- glLoadIdentity();
- glOrtho(0, _screenW, _screenH, 0, 0, 1);
- glMatrixMode(GL_MODELVIEW);
- glLoadIdentity();
-
- glDisable(GL_DEPTH_TEST);
- glDepthMask(GL_FALSE);
-
- glColor3ub(r, g, b);
-
- glLineWidth(15); // It will not work in every OpenGL implementation since the
- // spec doesn't require support for line widths other than 1
- glEnableClientState(GL_VERTEX_ARRAY);
- copyToVertexArray(0, Math::Vector3d(position.x - 1, position.y, 0));
- copyToVertexArray(1, Math::Vector3d(position.x + 3, position.y, 0));
- copyToVertexArray(2, Math::Vector3d(position.x, position.y - 3, 0));
- copyToVertexArray(3, Math::Vector3d(position.x, position.y + 3, 0));
- glVertexPointer(3, GL_FLOAT, 0, _verts);
- glDrawArrays(GL_LINES, 0, 4);
- glDisableClientState(GL_VERTEX_ARRAY);
- glLineWidth(1);
-
- glDepthMask(GL_TRUE);
- glEnable(GL_DEPTH_TEST);
-}
-
void OpenGLRenderer::renderShoot(byte color, const Common::Point position) {
uint8 r, g, b;
readFromPalette(color, r, g, b); // TODO: should use opposite color
diff --git a/engines/freescape/gfx_opengl.h b/engines/freescape/gfx_opengl.h
index f8878b39ec9..f81bf1cf3ec 100644
--- a/engines/freescape/gfx_opengl.h
+++ b/engines/freescape/gfx_opengl.h
@@ -73,7 +73,6 @@ public:
void freeTexture(Texture *texture) override;
virtual void drawTexturedRect2D(const Common::Rect &screenRect, const Common::Rect &textureRect, Texture *texture) override;
- virtual void renderCrossair(byte color, const Common::Point position) override;
virtual void renderShoot(byte color, const Common::Point position) override;
virtual void renderFace(const Common::Array<Math::Vector3d> &vertices) override;
diff --git a/engines/freescape/gfx_tinygl.cpp b/engines/freescape/gfx_tinygl.cpp
index a4b3949058e..ab2cff7cb78 100644
--- a/engines/freescape/gfx_tinygl.cpp
+++ b/engines/freescape/gfx_tinygl.cpp
@@ -122,34 +122,6 @@ void TinyGLRenderer::positionCamera(const Math::Vector3d &pos, const Math::Vecto
tglTranslatef(-pos.x(), -pos.y(), -pos.z());
}
-void TinyGLRenderer::renderCrossair(byte color, const Common::Point position) {
- uint8 r, g, b;
- readFromPalette(color, r, g, b); // TODO: should use opposite color
-
- tglMatrixMode(TGL_PROJECTION);
- tglLoadIdentity();
- tglOrtho(0, _screenW, _screenH, 0, 0, 1);
- tglMatrixMode(TGL_MODELVIEW);
- tglLoadIdentity();
-
- tglDisable(TGL_DEPTH_TEST);
- tglDepthMask(TGL_FALSE);
-
- tglColor3ub(r, g, b);
-
- tglEnableClientState(TGL_VERTEX_ARRAY);
- copyToVertexArray(0, Math::Vector3d(position.x - 1, position.y, 0));
- copyToVertexArray(1, Math::Vector3d(position.x + 3, position.y, 0));
- copyToVertexArray(2, Math::Vector3d(position.x, position.y - 3, 0));
- copyToVertexArray(3, Math::Vector3d(position.x, position.y + 3, 0));
- tglVertexPointer(3, TGL_FLOAT, 0, _verts);
- tglDrawArrays(TGL_LINES, 0, 4);
- tglDisableClientState(TGL_VERTEX_ARRAY);
-
- tglDepthMask(TGL_TRUE);
- tglEnable(TGL_DEPTH_TEST);
-}
-
void TinyGLRenderer::renderShoot(byte color, const Common::Point position) {
uint8 r, g, b;
readFromPalette(color, r, g, b); // TODO: should use opposite color
diff --git a/engines/freescape/gfx_tinygl.h b/engines/freescape/gfx_tinygl.h
index 41a06324080..7f79a73b36a 100644
--- a/engines/freescape/gfx_tinygl.h
+++ b/engines/freescape/gfx_tinygl.h
@@ -59,7 +59,6 @@ public:
void freeTexture(Texture *texture) override;
virtual void drawTexturedRect2D(const Common::Rect &screenRect, const Common::Rect &textureRect, Texture *texture) override;
- virtual void renderCrossair(byte color, const Common::Point position) override;
virtual void renderShoot(byte color, const Common::Point position) override;
virtual void renderFace(const Common::Array<Math::Vector3d> &vertices) override;
Commit: d92f66151792061141655da50e1d27bdc4cf2aad
https://github.com/scummvm/scummvm/commit/d92f66151792061141655da50e1d27bdc4cf2aad
Author: neuromancer (gustavo.grieco at gmail.com)
Date: 2022-11-12T11:36:27+01:00
Commit Message:
FREESCAPE: removed areaScale unused variable warnings
Changed paths:
engines/freescape/movement.cpp
diff --git a/engines/freescape/movement.cpp b/engines/freescape/movement.cpp
index f1381b19108..4d57d7d9ccc 100644
--- a/engines/freescape/movement.cpp
+++ b/engines/freescape/movement.cpp
@@ -151,9 +151,8 @@ void FreescapeEngine::lower() {
void FreescapeEngine::move(CameraMovement direction, uint8 scale, float deltaTime) {
debugC(1, kFreescapeDebugMove, "old player position: %f, %f, %f", _position.x(), _position.y(), _position.z());
int previousAreaID = _currentArea->getAreaID();
- int areaScale = _currentArea->getScale();
- float velocity = _movementSpeed * deltaTime /** areaScale*/;
+ float velocity = _movementSpeed * deltaTime;
float positionY = _position.y();
switch (direction) {
case kForwardMovement:
@@ -223,7 +222,6 @@ void FreescapeEngine::move(CameraMovement direction, uint8 scale, float deltaTim
}
}
}
- areaScale = _currentArea->getScale();
_lastPosition = _position;
debugC(1, kFreescapeDebugMove, "new player position: %f, %f, %f", _position.x(), _position.y(), _position.z());
@@ -244,7 +242,6 @@ bool FreescapeEngine::checkFloor(Math::Vector3d currentPosition) {
bool FreescapeEngine::tryStepUp(Math::Vector3d currentPosition) {
debugC(1, kFreescapeDebugMove, "Try to step up!");
- int areaScale = _currentArea->getScale();
_position.set(_position.x(), _position.y() + 64, _position.z());
bool collided = checkCollisions(false);
if (collided) {
@@ -258,7 +255,6 @@ bool FreescapeEngine::tryStepUp(Math::Vector3d currentPosition) {
bool FreescapeEngine::tryStepDown(Math::Vector3d currentPosition) {
debugC(1, kFreescapeDebugMove, "Try to step down!");
- int areaScale = _currentArea->getScale();
_position.set(_position.x(), _position.y() - 1, _position.z());
if (checkFloor(_position)) {
return true;
@@ -271,7 +267,6 @@ bool FreescapeEngine::tryStepDown(Math::Vector3d currentPosition) {
bool FreescapeEngine::checkCollisions(bool executeCode) {
if (_noClipMode)
return false;
- int areaScale = _currentArea->getScale();
Math::AABB boundingBox(_lastPosition, _lastPosition);
Math::Vector3d v1(_position.x() - 1, _position.y() - _playerHeight, _position.z() - 1);
Commit: 0cefaaaa74ddd8ef8deb3012e82299f3bcf9c6de
https://github.com/scummvm/scummvm/commit/0cefaaaa74ddd8ef8deb3012e82299f3bcf9c6de
Author: neuromancer (gustavo.grieco at gmail.com)
Date: 2022-11-12T12:07:37+01:00
Commit Message:
FREESCAPE: corrected player aim when shooting in movement mode
Changed paths:
engines/freescape/movement.cpp
diff --git a/engines/freescape/movement.cpp b/engines/freescape/movement.cpp
index 4d57d7d9ccc..43104ffda2c 100644
--- a/engines/freescape/movement.cpp
+++ b/engines/freescape/movement.cpp
@@ -59,10 +59,13 @@ void FreescapeEngine::traverseEntrance(uint16 entranceID) {
void FreescapeEngine::shoot() {
//_mixer->stopHandle(_soundFxHandle);
playSound(1, true);
+ _gfx->setViewport(_fullscreenViewArea);
_gfx->renderShoot(0, _crossairPosition);
+ _gfx->setViewport(_viewArea);
- float xoffset = _crossairPosition.x - float(_screenW) / 2;
- float yoffset = _crossairPosition.y - float(_screenH) / 2;
+ Common::Point center(_viewArea.left + _viewArea.width() / 2, _viewArea.top + _viewArea.height() / 2);
+ float xoffset = _crossairPosition.x - center.x;
+ float yoffset = _crossairPosition.y - center.y;
Math::Vector3d direction = directionToVector(_pitch + yoffset, _yaw - xoffset);
Math::Ray ray(_position, direction);
More information about the Scummvm-git-logs
mailing list