[Scummvm-git-logs] scummvm master -> d25c824cb0de2ed7ce55f946054f148a116ccdec
neuromancer
noreply at scummvm.org
Tue Mar 28 17:11:57 UTC 2023
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:
3e35f7328a FREESCAPE: parsed and added ECD for driller dos demo
ddab0afec3 FREESCAPE: better rendering of lines in OpenGL
d61c32f03d FREESCAPE: added ECDs for driller for dos
d25c824cb0 FREESCAPE: added walls and simplified area change code for driller for dos
Commit: 3e35f7328a2f114d8464b1e8f73f1b716841ea2c
https://github.com/scummvm/scummvm/commit/3e35f7328a2f114d8464b1e8f73f1b716841ea2c
Author: neuromancer (gustavo.grieco at gmail.com)
Date: 2023-03-28T19:11:47+02:00
Commit Message:
FREESCAPE: parsed and added ECD for driller dos demo
Changed paths:
engines/freescape/freescape.h
engines/freescape/games/dark/dark.cpp
engines/freescape/games/dark/dos.cpp
diff --git a/engines/freescape/freescape.h b/engines/freescape/freescape.h
index ae3a2f8dc0b..d1c96cf705c 100644
--- a/engines/freescape/freescape.h
+++ b/engines/freescape/freescape.h
@@ -539,6 +539,8 @@ public:
private:
void loadGlobalObjects(Common::SeekableReadStream *file, int offset);
+ void addECDs(Area *area);
+ void addECD(Area *area, const Math::Vector3d position, int index);
};
class EclipseEngine : public FreescapeEngine {
diff --git a/engines/freescape/games/dark/dark.cpp b/engines/freescape/games/dark/dark.cpp
index 1165f60243b..48bee2a33ba 100644
--- a/engines/freescape/games/dark/dark.cpp
+++ b/engines/freescape/games/dark/dark.cpp
@@ -23,6 +23,7 @@
#include "freescape/freescape.h"
#include "freescape/language/8bitDetokeniser.h"
+#include "freescape/objects/global.h"
#include "freescape/objects/connections.h"
namespace Freescape {
@@ -65,7 +66,7 @@ void DarkEngine::loadGlobalObjects(Common::SeekableReadStream *file, int offset)
assert(!_areaMap.contains(255));
ObjectMap *globalObjectsByID = new ObjectMap;
file->seek(offset);
- for (int i = 0; i < 22; i++) {
+ for (int i = 0; i < 23; i++) {
Object *gobj = load8bitObject(file);
assert(gobj);
assert(!globalObjectsByID->contains(gobj->getObjectID()));
@@ -76,6 +77,48 @@ void DarkEngine::loadGlobalObjects(Common::SeekableReadStream *file, int offset)
_areaMap[255] = new Area(255, 0, globalObjectsByID, nullptr);
}
+void DarkEngine::addECDs(Area *area) {
+ GlobalStructure *rs = (GlobalStructure *)area->entranceWithID(255);
+ debugC(1, kFreescapeDebugParser, "ECD positions:");
+ for (uint i = 0; i < rs->_structure.size(); i = i + 3) {
+ int x = 32 * rs->_structure[i];
+ int y = 32 * rs->_structure[i + 1];
+ int z = 32 * rs->_structure[i + 2];
+
+ debugC(1, kFreescapeDebugParser, "%d %d %d", x, y, z);
+ if (x == 0 && y == 0 && z == 0) {
+ debugC(1, kFreescapeDebugParser, "Skiping ECD zero position");
+ continue;
+ }
+ addECD(area, Math::Vector3d(x, y, z), i / 3);
+ }
+}
+
+void DarkEngine::addECD(Area *area, const Math::Vector3d position, int index) {
+ GeometricObject *obj = nullptr;
+ Math::Vector3d origin = position;
+
+ int16 id = 227 + index * 6;
+ int heightLastObject = 0;
+ for (int i = 0; i < 4; i++) {
+ debugC(1, kFreescapeDebugParser, "Adding object %d to room structure", id);
+ obj = (GeometricObject *)_areaMap[255]->objectWithID(id);
+ assert(obj);
+ // Set position for object
+ origin.setValue(0, origin.x());
+ origin.setValue(1, origin.y() + heightLastObject);
+ origin.setValue(2, origin.z());
+
+ obj = (GeometricObject *)obj->duplicate();
+ obj->setOrigin(origin);
+ obj->makeVisible();
+ area->addObject(obj);
+
+ heightLastObject = obj->getSize().y();
+ id--;
+ }
+}
+
void DarkEngine::initGameState() {
_flyMode = false;
_noClipMode = false;
diff --git a/engines/freescape/games/dark/dos.cpp b/engines/freescape/games/dark/dos.cpp
index 24c4396d079..220d6c3cabd 100644
--- a/engines/freescape/games/dark/dos.cpp
+++ b/engines/freescape/games/dark/dos.cpp
@@ -48,6 +48,12 @@ void DarkEngine::loadAssetsDOSDemo() {
load8bitBinary(&file, 0xa700, 16);
_border = load8bitBinImage(&file, 0x210);
_border->setPalette((byte *)&kEGADefaultPaletteData, 0, 16);
+
+ for (auto &it : _areaMap) {
+ if (!it._value->entranceWithID(255))
+ continue;
+ addECDs(it._value);
+ }
} else if (_renderMode == Common::kRenderCGA) {
//loadBundledImages();
file.open("DSIDEC.EXE");
Commit: ddab0afec301e5d95214e2be332b570b23cfb142
https://github.com/scummvm/scummvm/commit/ddab0afec301e5d95214e2be332b570b23cfb142
Author: neuromancer (gustavo.grieco at gmail.com)
Date: 2023-03-28T19:11:48+02:00
Commit Message:
FREESCAPE: better rendering of lines in OpenGL
Changed paths:
engines/freescape/gfx_opengl.cpp
diff --git a/engines/freescape/gfx_opengl.cpp b/engines/freescape/gfx_opengl.cpp
index 2848f48e9fb..0c09bb0f5ba 100644
--- a/engines/freescape/gfx_opengl.cpp
+++ b/engines/freescape/gfx_opengl.cpp
@@ -243,7 +243,9 @@ void OpenGLRenderer::renderFace(const Common::Array<Math::Vector3d> &vertices) {
copyToVertexArray(0, v0);
copyToVertexArray(1, v1);
glVertexPointer(3, GL_FLOAT, 0, _verts);
+ glLineWidth(MAX(1, g_system->getWidth() / 192));
glDrawArrays(GL_LINES, 0, 2);
+ glLineWidth(1);
glDisableClientState(GL_VERTEX_ARRAY);
return;
}
Commit: d61c32f03da599aefbb2a24fa9145e742dbc047a
https://github.com/scummvm/scummvm/commit/d61c32f03da599aefbb2a24fa9145e742dbc047a
Author: neuromancer (gustavo.grieco at gmail.com)
Date: 2023-03-28T19:11:48+02:00
Commit Message:
FREESCAPE: added ECDs for driller for dos
Changed paths:
engines/freescape/games/dark/dos.cpp
diff --git a/engines/freescape/games/dark/dos.cpp b/engines/freescape/games/dark/dos.cpp
index 220d6c3cabd..55c19ce6c5d 100644
--- a/engines/freescape/games/dark/dos.cpp
+++ b/engines/freescape/games/dark/dos.cpp
@@ -88,11 +88,11 @@ void DarkEngine::loadAssetsDOSFullGame() {
_border->setPalette((byte *)&kEGADefaultPaletteData, 0, 16);
// TODO: load objects
- /*for (auto &it : _areaMap) {
+ for (auto &it : _areaMap) {
if (!it._value->entranceWithID(255))
continue;
- it._value->addStructure(_areaMap[255]);
- }*/
+ addECDs(it._value);
+ }
} else if (_renderMode == Common::kRenderCGA) {
loadBundledImages();
file.open("DSIDEC.EXE");
Commit: d25c824cb0de2ed7ce55f946054f148a116ccdec
https://github.com/scummvm/scummvm/commit/d25c824cb0de2ed7ce55f946054f148a116ccdec
Author: neuromancer (gustavo.grieco at gmail.com)
Date: 2023-03-28T19:11:48+02:00
Commit Message:
FREESCAPE: added walls and simplified area change code for driller for dos
Changed paths:
engines/freescape/freescape.h
engines/freescape/games/dark/dark.cpp
engines/freescape/games/dark/dos.cpp
engines/freescape/language/8bitDetokeniser.cpp
engines/freescape/language/instruction.cpp
engines/freescape/language/instruction.h
engines/freescape/objects/geometricobject.cpp
diff --git a/engines/freescape/freescape.h b/engines/freescape/freescape.h
index d1c96cf705c..f8c7c95a376 100644
--- a/engines/freescape/freescape.h
+++ b/engines/freescape/freescape.h
@@ -522,7 +522,6 @@ public:
void titleScreen() override;
void gotoArea(uint16 areaID, int entranceID) override;
- void checkIfStillInArea() override;
void pressedKey(const int keycode) override;
void executePrint(FCLInstruction &instruction) override;
@@ -541,6 +540,7 @@ private:
void loadGlobalObjects(Common::SeekableReadStream *file, int offset);
void addECDs(Area *area);
void addECD(Area *area, const Math::Vector3d position, int index);
+ void addWalls(Area *area);
};
class EclipseEngine : public FreescapeEngine {
diff --git a/engines/freescape/games/dark/dark.cpp b/engines/freescape/games/dark/dark.cpp
index 48bee2a33ba..b0d5a396340 100644
--- a/engines/freescape/games/dark/dark.cpp
+++ b/engines/freescape/games/dark/dark.cpp
@@ -78,6 +78,9 @@ void DarkEngine::loadGlobalObjects(Common::SeekableReadStream *file, int offset)
}
void DarkEngine::addECDs(Area *area) {
+ if (!area->entranceWithID(255))
+ return;
+
GlobalStructure *rs = (GlobalStructure *)area->entranceWithID(255);
debugC(1, kFreescapeDebugParser, "ECD positions:");
for (uint i = 0; i < rs->_structure.size(); i = i + 3) {
@@ -94,6 +97,29 @@ void DarkEngine::addECDs(Area *area) {
}
}
+void DarkEngine::addWalls(Area *area) {
+ if (!area->entranceWithID(254))
+ return;
+
+ AreaConnections *cons = (AreaConnections *)area->entranceWithID(254);
+ debugC(1, kFreescapeDebugParser, "Adding walls for area %d:", area->getAreaID());
+ int id = 240;
+ for (uint i = 1; i < cons->_connections.size(); i = i + 2) {
+ int target = cons->_connections[i];
+ debugC(1, kFreescapeDebugParser, "Connection to %d using id: %d", target, id);
+ if (target > 0) {
+ area->addObjectFromArea(id, _areaMap[255]);
+ GeometricObject *gobj = (GeometricObject *)area->objectWithID(id);
+ assert((*(gobj->_condition[1]._thenInstructions))[0].getType() == Token::Type::GOTO);
+ assert((*(gobj->_condition[1]._thenInstructions))[0]._destination == 0);
+ (*(gobj->_condition[1]._thenInstructions))[0].setSource(target);
+ } else
+ area->addObjectFromArea(id + 1, _areaMap[255]);
+
+ id = id + 2;
+ }
+}
+
void DarkEngine::addECD(Area *area, const Math::Vector3d position, int index) {
GeometricObject *obj = nullptr;
Math::Vector3d origin = position;
@@ -220,30 +246,6 @@ void DarkEngine::pressedKey(const int keycode) {
}
}
-void DarkEngine::checkIfStillInArea() {
- AreaConnections *cons = (AreaConnections *)_currentArea->entranceWithID(254);
- if (!cons) {
- FreescapeEngine::checkIfStillInArea();
- return;
- }
-
- int nextAreaID = 0;
-
- if (_position.z() >= 4064 - 16)
- nextAreaID = cons->_connections[1];
- else if (_position.x() >= 4064 - 16)
- nextAreaID = cons->_connections[3];
- else if (_position.z() <= 16)
- nextAreaID = cons->_connections[5];
- else if (_position.x() <= 16)
- nextAreaID = cons->_connections[7];
-
- if (nextAreaID > 0)
- gotoArea(nextAreaID, 0);
- else
- FreescapeEngine::checkIfStillInArea();
-}
-
void DarkEngine::updateTimeVariables() {
// This function only executes "on collision" room/global conditions
int seconds, minutes, hours;
diff --git a/engines/freescape/games/dark/dos.cpp b/engines/freescape/games/dark/dos.cpp
index 55c19ce6c5d..b7b22563665 100644
--- a/engines/freescape/games/dark/dos.cpp
+++ b/engines/freescape/games/dark/dos.cpp
@@ -50,8 +50,7 @@ void DarkEngine::loadAssetsDOSDemo() {
_border->setPalette((byte *)&kEGADefaultPaletteData, 0, 16);
for (auto &it : _areaMap) {
- if (!it._value->entranceWithID(255))
- continue;
+ addWalls(it._value);
addECDs(it._value);
}
} else if (_renderMode == Common::kRenderCGA) {
@@ -89,8 +88,7 @@ void DarkEngine::loadAssetsDOSFullGame() {
// TODO: load objects
for (auto &it : _areaMap) {
- if (!it._value->entranceWithID(255))
- continue;
+ addWalls(it._value);
addECDs(it._value);
}
} else if (_renderMode == Common::kRenderCGA) {
diff --git a/engines/freescape/language/8bitDetokeniser.cpp b/engines/freescape/language/8bitDetokeniser.cpp
index 6b00ecc926e..16f57bf2924 100644
--- a/engines/freescape/language/8bitDetokeniser.cpp
+++ b/engines/freescape/language/8bitDetokeniser.cpp
@@ -42,7 +42,7 @@ Common::String detokenise8bitCondition(Common::Array<uint8> &tokenisedCondition,
// we'll want to convert them into runs of "if shot? then", "if collided? then" or "if timer? then",
// and we'll want to start that from the top
FCLInstructionVector *conditionalInstructions = new FCLInstructionVector();
- FCLInstruction currentInstruction;
+ FCLInstruction currentInstruction = FCLInstruction(Token::UNKNOWN);
// this lookup table tells us how many argument bytes to read per opcode
uint8 argumentsRequiredByOpcode[49] =
diff --git a/engines/freescape/language/instruction.cpp b/engines/freescape/language/instruction.cpp
index a528ec48275..7b845bf28b1 100644
--- a/engines/freescape/language/instruction.cpp
+++ b/engines/freescape/language/instruction.cpp
@@ -27,6 +27,29 @@
namespace Freescape {
+FCLInstructionVector *duplicateCondition(FCLInstructionVector *condition) {
+ if (!condition)
+ return nullptr;
+
+ FCLInstructionVector *copy = new FCLInstructionVector();
+ for (uint i = 0; i < condition->size(); i++) {
+ copy->push_back((*condition)[i].duplicate());
+ }
+ return copy;
+}
+
+FCLInstruction FCLInstruction::duplicate() {
+ FCLInstruction copy(_type);
+ copy.setSource(_source);
+ copy.setDestination(_destination);
+ copy.setAdditional(_additional);
+
+ copy._thenInstructions = duplicateCondition(_thenInstructions);
+ copy._elseInstructions = duplicateCondition(_elseInstructions);
+
+ return copy;
+}
+
FCLInstruction::FCLInstruction(Token::Type type_) {
_source = 0;
_destination = 0;
diff --git a/engines/freescape/language/instruction.h b/engines/freescape/language/instruction.h
index c045cc7e2ff..e5e01ea2887 100644
--- a/engines/freescape/language/instruction.h
+++ b/engines/freescape/language/instruction.h
@@ -44,6 +44,8 @@ public:
Token::Type getType();
void setBranches(FCLInstructionVector *thenBranch, FCLInstructionVector *elseBranch);
+ FCLInstruction duplicate();
+
int32 _source;
int32 _additional;
int32 _destination;
diff --git a/engines/freescape/objects/geometricobject.cpp b/engines/freescape/objects/geometricobject.cpp
index ed19eeafd08..954f67755fb 100644
--- a/engines/freescape/objects/geometricobject.cpp
+++ b/engines/freescape/objects/geometricobject.cpp
@@ -26,6 +26,8 @@
namespace Freescape {
+extern FCLInstructionVector *duplicateCondition(FCLInstructionVector *condition);
+
int GeometricObject::numberOfColoursForObjectOfType(ObjectType type) {
switch (type) {
default:
@@ -186,14 +188,18 @@ void GeometricObject::scale(int factor) {
}
Object *GeometricObject::duplicate() {
- Common::Array<uint8> *colours_copy = nullptr;
- Common::Array<uint16> *ordinates_copy = nullptr;
+ Common::Array<uint8> *coloursCopy = nullptr;
+ Common::Array<uint16> *ordinatesCopy = nullptr;
+ FCLInstructionVector *conditionCopy = nullptr;
if (_colours)
- colours_copy = new Common::Array<uint8>(*_colours);
+ coloursCopy = new Common::Array<uint8>(*_colours);
if (_ordinates)
- ordinates_copy = new Common::Array<uint16>(*_ordinates);
+ ordinatesCopy = new Common::Array<uint16>(*_ordinates);
+
+ conditionCopy = duplicateCondition(&_condition);
+ assert(conditionCopy);
return new GeometricObject(
_type,
@@ -201,9 +207,9 @@ Object *GeometricObject::duplicate() {
_flags,
_origin,
_size,
- colours_copy,
- ordinates_copy,
- _condition,
+ coloursCopy,
+ ordinatesCopy,
+ *conditionCopy,
_conditionSource);
}
More information about the Scummvm-git-logs
mailing list