[Scummvm-git-logs] scummvm master -> 9b45b6b9402b2f81e631ec48105533921abd9913
neuromancer
noreply at scummvm.org
Tue Nov 15 17:28:08 UTC 2022
This automated email contains information about 5 new commits which have been
pushed to the 'scummvm' repo located at https://github.com/scummvm/scummvm .
Summary:
611bfff3aa FREESCAPE: better implementation of renderShoot for OpenGL
194c551c9a FREESCAPE: disable sensors if they are destroyed or invisible
a4b657700d FREESCAPE: render sensors as small cubes
34a743cecf FREESCAPE: several fixes to be able to better reproduce the DOS demo
9b45b6b940 FREESCAPE: first implementation of mouse event in DOS demo data
Commit: 611bfff3aa03f53f7ffd569ac273949ce7687329
https://github.com/scummvm/scummvm/commit/611bfff3aa03f53f7ffd569ac273949ce7687329
Author: neuromancer (gustavo.grieco at gmail.com)
Date: 2022-11-15T18:28:59+01:00
Commit Message:
FREESCAPE: better implementation of renderShoot for OpenGL
Changed paths:
engines/freescape/gfx_opengl.cpp
diff --git a/engines/freescape/gfx_opengl.cpp b/engines/freescape/gfx_opengl.cpp
index b7310a3b2c3..37aa1197a9c 100644
--- a/engines/freescape/gfx_opengl.cpp
+++ b/engines/freescape/gfx_opengl.cpp
@@ -193,14 +193,14 @@ void OpenGLRenderer::renderShoot(byte color, const Common::Point position, const
glLineWidth(10); // 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(0, _screenH - 2, 0));
+ copyToVertexArray(0, Math::Vector3d(viewArea.left, viewArea.height() + viewArea.top - 1, 0));
copyToVertexArray(1, Math::Vector3d(position.x, position.y, 0));
- copyToVertexArray(2, Math::Vector3d(0, _screenH - 2, 0));
+ copyToVertexArray(2, Math::Vector3d(viewArea.left, viewArea.height() + viewArea.top - 1, 0));
copyToVertexArray(3, Math::Vector3d(position.x, position.y, 0));
- copyToVertexArray(4, Math::Vector3d(_screenW, _screenH - 2, 0));
+ copyToVertexArray(4, Math::Vector3d(viewArea.right, viewArea.width() - viewArea.bottom, 0));
copyToVertexArray(5, Math::Vector3d(position.x, position.y, 0));
- copyToVertexArray(6, Math::Vector3d(_screenW, _screenH, 0));
+ copyToVertexArray(6, Math::Vector3d(viewArea.right, viewArea.width() - viewArea.bottom, 0));
copyToVertexArray(7, Math::Vector3d(position.x, position.y, 0));
glVertexPointer(3, GL_FLOAT, 0, _verts);
Commit: 194c551c9afd902173a6ba0238c1730327fe6b54
https://github.com/scummvm/scummvm/commit/194c551c9afd902173a6ba0238c1730327fe6b54
Author: neuromancer (gustavo.grieco at gmail.com)
Date: 2022-11-15T18:28:59+01:00
Commit Message:
FREESCAPE: disable sensors if they are destroyed or invisible
Changed paths:
engines/freescape/freescape.cpp
diff --git a/engines/freescape/freescape.cpp b/engines/freescape/freescape.cpp
index 9aadfe82b0d..1977fcc0037 100644
--- a/engines/freescape/freescape.cpp
+++ b/engines/freescape/freescape.cpp
@@ -212,6 +212,8 @@ void FreescapeEngine::centerCrossair() {
void FreescapeEngine::checkSensors() {
for (auto &it : _sensors) {
Sensor *sensor = (Sensor *)it;
+ if (sensor->isDestroyed() || sensor->isInvisible())
+ continue;
if ((sensor->getOrigin() - _position).length() <= sensor->_firingRange) {
if (_ticks % sensor->_firingInterval == 0)
warning("shoot!");
Commit: a4b657700dff085bdc6d64013363ecff2f55c2b3
https://github.com/scummvm/scummvm/commit/a4b657700dff085bdc6d64013363ecff2f55c2b3
Author: neuromancer (gustavo.grieco at gmail.com)
Date: 2022-11-15T18:28:59+01:00
Commit Message:
FREESCAPE: render sensors as small cubes
Changed paths:
engines/freescape/loaders/8bitBinaryLoader.cpp
engines/freescape/objects/sensor.h
diff --git a/engines/freescape/loaders/8bitBinaryLoader.cpp b/engines/freescape/loaders/8bitBinaryLoader.cpp
index c57cdff9ac3..3f46edc9de6 100644
--- a/engines/freescape/loaders/8bitBinaryLoader.cpp
+++ b/engines/freescape/loaders/8bitBinaryLoader.cpp
@@ -230,7 +230,8 @@ Object *FreescapeEngine::load8bitObject(Common::SeekableReadStream *file) {
}
assert(byteSizeOfObject >= 5);
- byte color = readField(file, 8);
+ byte color = readField(file, 8) & 0xf;
+ assert(color > 0);
byte firingInterval = readField(file, 8);
uint16 firingRange = readField(file, 16);
byte sensorFlags = readField(file, 8);
diff --git a/engines/freescape/objects/sensor.h b/engines/freescape/objects/sensor.h
index 8bc2190a771..e2e2e0c82cb 100644
--- a/engines/freescape/objects/sensor.h
+++ b/engines/freescape/objects/sensor.h
@@ -45,30 +45,40 @@ public:
_objectID = objectID_;
_origin = origin_;
_rotation = rotation_;
- _color = color_;
+ _size = Math::Vector3d(3, 3, 3);
+ _colours = new Common::Array<uint8>;
+ for (int i = 0; i < 6; i++)
+ _colours->push_back(color_);
_firingInterval = firingInterval_;
_firingRange = firingRange_;
_flags = flags_;
_conditionSource = conditionSource_;
_condition = condition_;
}
- byte _color;
byte _firingInterval;
uint16 _firingRange;
Common::String _conditionSource;
FCLInstructionVector _condition;
- virtual ~Sensor() {}
- bool isDrawable() override { return false; }
+ virtual ~Sensor() {
+ delete _colours;
+ }
+ bool isDrawable() override { return true; }
bool isPlanar() override { return true; }
void scale(int factor) override { _origin = _origin / factor; };
- Object *duplicate() override { return (new Sensor(_objectID, _origin, _rotation, _color, _firingInterval, _firingRange, _flags, _condition, _conditionSource)); };
+ Object *duplicate() override { return (new Sensor(_objectID, _origin, _rotation, (*_colours)[0], _firingInterval, _firingRange, _flags, _condition, _conditionSource)); };
ObjectType getType() override { return kSensorType; };
Math::Vector3d getRotation() { return _rotation; }
- void draw(Freescape::Renderer *gfx) override { error("cannot render sensor"); };
+ void draw(Freescape::Renderer *gfx) override {
+ Math::Vector3d origin(_origin.x() - 1, _origin.y() - 1, _origin.z() - 1);
+ gfx->renderCube(_origin, _size, _colours);
+ };
+
+ private:
+ Common::Array<uint8> *_colours;
};
} // End of namespace Freescape
Commit: 34a743cecf066e288f9451b646c92791c6ff4050
https://github.com/scummvm/scummvm/commit/34a743cecf066e288f9451b646c92791c6ff4050
Author: neuromancer (gustavo.grieco at gmail.com)
Date: 2022-11-15T18:28:59+01:00
Commit Message:
FREESCAPE: several fixes to be able to better reproduce the DOS demo
Changed paths:
engines/freescape/freescape.cpp
engines/freescape/games/driller.cpp
engines/freescape/movement.cpp
diff --git a/engines/freescape/freescape.cpp b/engines/freescape/freescape.cpp
index 1977fcc0037..acd5e8f47bd 100644
--- a/engines/freescape/freescape.cpp
+++ b/engines/freescape/freescape.cpp
@@ -239,9 +239,9 @@ void FreescapeEngine::generateInput() {
_currentDemoInputRepetition = 1;
_currentDemoInputCode = _demoData[_demoIndex++];
if (_currentDemoInputCode & 0x80) {
- _currentDemoInputRepetition = (_currentDemoInputCode & 0x7F) + 1;
- if (_currentDemoInputRepetition == 1)
- _currentDemoInputRepetition = 255;
+ _currentDemoInputRepetition = (_currentDemoInputCode & 0x7F) /*+ 1*/;
+ //if (_currentDemoInputRepetition == 1)
+ // _currentDemoInputRepetition = 255;
_currentDemoInputCode = _demoData[_demoIndex++];
}
}
diff --git a/engines/freescape/games/driller.cpp b/engines/freescape/games/driller.cpp
index bd000ef5666..a5511ee9495 100644
--- a/engines/freescape/games/driller.cpp
+++ b/engines/freescape/games/driller.cpp
@@ -48,6 +48,9 @@ DrillerEngine::DrillerEngine(OSystem *syst, const ADGameDescription *gd) : Frees
_playerHeights.push_back(80);
_playerHeights.push_back(112);
+ _angleRotations.push_back(5);
+ _angleRotations.push_back(9.5);
+
_playerHeight = _playerHeights[_playerHeightNumber];
_playerWidth = 12;
_playerDepth = 32;
@@ -126,9 +129,6 @@ void DrillerEngine::loadAssets() {
else
loadAssetsFullGame();
- _angleRotations.push_back(5.0);
- _angleRotations.push_back(9.5);
-
// Start playing music, if any, in any supported format
playMusic("Matt Gray - The Best Of Reformation - 07 Driller Theme");
}
@@ -378,6 +378,7 @@ void DrillerEngine::drawDOSUI(Graphics::Surface *surface) {
else
drawStringInSurface(Common::String::format("%s", "J"), 57, 161, yellow, black, surface);
+ drawStringInSurface(Common::String::format("%02d", int(_angleRotations[_angleRotationIndex])), 46, 145, yellow, black, surface);
drawStringInSurface(Common::String::format("%3d", _playerSteps[_playerStepIndex]), 46, 153, yellow, black, surface);
drawStringInSurface(Common::String::format("%07d", score), 238, 129, yellow, black, surface);
diff --git a/engines/freescape/movement.cpp b/engines/freescape/movement.cpp
index 934560ec909..d4f26ff26e0 100644
--- a/engines/freescape/movement.cpp
+++ b/engines/freescape/movement.cpp
@@ -38,11 +38,13 @@ void FreescapeEngine::traverseEntrance(uint16 entranceID) {
Math::Vector3d rotation = entrance->getRotation();
_position = entrance->getOrigin();
_pitch = rotation.x();
- if (ABS(diff.x()) > ABS(diff.z()) && _lastPosition != Math::Vector3d(0, 0, 0)) {
+ if (_lastPosition == Math::Vector3d(0, 0, 0))
+ _yaw = rotation.y() + 110; // TODO: check why Driller needs this when it starts
+ else if (ABS(diff.x()) > ABS(diff.z()))
_yaw = rotation.y() - 90;
- } else {
+ else
_yaw = rotation.y() + 90;
- }
+
debugC(1, kFreescapeDebugMove, "entrace position: %f %f %f", _position.x(), _position.y(), _position.z());
int delta = 0;
Commit: 9b45b6b9402b2f81e631ec48105533921abd9913
https://github.com/scummvm/scummvm/commit/9b45b6b9402b2f81e631ec48105533921abd9913
Author: neuromancer (gustavo.grieco at gmail.com)
Date: 2022-11-15T18:28:59+01:00
Commit Message:
FREESCAPE: first implementation of mouse event in DOS demo data
Changed paths:
engines/freescape/freescape.cpp
engines/freescape/freescape.h
engines/freescape/keyboard.cpp
diff --git a/engines/freescape/freescape.cpp b/engines/freescape/freescape.cpp
index acd5e8f47bd..98195b1b02b 100644
--- a/engines/freescape/freescape.cpp
+++ b/engines/freescape/freescape.cpp
@@ -77,6 +77,7 @@ FreescapeEngine::FreescapeEngine(OSystem *syst, const ADGameDescription *gd)
_demoIndex = 0;
_currentDemoInputCode = 0;
_currentDemoInputRepetition = 0;
+ _currentDemoMousePosition = _crossairPosition;
_flyMode = false;
_noClipMode = false;
_playerHeightNumber = 1;
@@ -247,14 +248,13 @@ void FreescapeEngine::generateInput() {
}
if (_currentDemoInputCode >= 0x16 && _currentDemoInputCode <= 0x1a) {
- // 0x16 -> left click / shoot
- // 0x17 -> right?
- // 0x18 -> left
- // 0x19 -> down?
- // 0x1a -> up
- // TODO: mouse events
+ event = decodeDOSMouseEvent(_currentDemoInputCode, _currentDemoInputRepetition);
+ g_system->getEventManager()->pushEvent(event);
+ g_system->delayMillis(10);
+ _currentDemoInputRepetition = 0;
} else if (_currentDemoInputCode == 0x7f) {
// NOP
+ _currentDemoInputRepetition--;
} else {
event = Common::Event();
event.type = Common::EVENT_KEYDOWN;
@@ -263,8 +263,9 @@ void FreescapeEngine::generateInput() {
g_system->getEventManager()->pushEvent(event);
debugC(1, kFreescapeDebugMove, "Pushing key: %x with repetition %d", event.kbd.keycode, _currentDemoInputRepetition);
g_system->delayMillis(100);
+ _currentDemoInputRepetition--;
}
- _currentDemoInputRepetition--;
+
return;
}
diff --git a/engines/freescape/freescape.h b/engines/freescape/freescape.h
index 84335e61267..0d4c58657e1 100644
--- a/engines/freescape/freescape.h
+++ b/engines/freescape/freescape.h
@@ -23,6 +23,7 @@
#define FREESCAPE_H
#include "common/bitarray.h"
+#include "common/events.h"
#include "engines/advancedDetector.h"
#include "graphics/surface.h"
@@ -132,9 +133,11 @@ public:
int _demoIndex;
int _currentDemoInputCode;
int _currentDemoInputRepetition;
+ Common::Point _currentDemoMousePosition;
void loadDemoData(Common::SeekableReadStream *file, int offset, int size);
int decodeAmigaAtariKey(int code);
int decodeDOSKey(int code);
+ Common::Event decodeDOSMouseEvent(int code, int repetition);
uint16 readField(Common::SeekableReadStream *file, int nbits);
Common::Array<uint8> readArray(Common::SeekableReadStream *file, int size);
diff --git a/engines/freescape/keyboard.cpp b/engines/freescape/keyboard.cpp
index b74dba9424a..985ec7fec90 100644
--- a/engines/freescape/keyboard.cpp
+++ b/engines/freescape/keyboard.cpp
@@ -19,12 +19,37 @@
*
*/
-#include "common/events.h"
-
#include "freescape/freescape.h"
namespace Freescape {
+Common::Event FreescapeEngine::decodeDOSMouseEvent(int index, int repetition) {
+ Common::Event event;
+ event.type = Common::EVENT_MOUSEMOVE;
+ event.customType = 0xde00;
+ switch(index) {
+ case 0x16:
+ 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;
+}
+
int FreescapeEngine::decodeAmigaAtariKey(int index) {
switch (index) {
case 0x44:
More information about the Scummvm-git-logs
mailing list