[Scummvm-git-logs] scummvm master -> 65ee661c4e0c174edf7b550a45baae15e6dd5053
neuromancer
noreply at scummvm.org
Tue Nov 4 08:27:47 UTC 2025
This automated email contains information about 3 new commits which have been
pushed to the 'scummvm' repo located at https://api.github.com/repos/scummvm/scummvm .
Summary:
ad9c275f6e FREESCAPE: hercules related fixes for player shots
6657b559e5 FREESCAPE: refactor handling of groups in castle to make sure global conditions can be executed
65ee661c4e FREESCAPE: added missing condition in loadAssets for castle
Commit: ad9c275f6ee37acc162f9b3ebc1a61fe5f58726f
https://github.com/scummvm/scummvm/commit/ad9c275f6ee37acc162f9b3ebc1a61fe5f58726f
Author: neuromancer (gustavo.grieco at gmail.com)
Date: 2025-11-04T09:27:32+01:00
Commit Message:
FREESCAPE: hercules related fixes for player shots
Changed paths:
engines/freescape/gfx_opengl.cpp
engines/freescape/gfx_opengl_shaders.cpp
engines/freescape/gfx_tinygl.cpp
diff --git a/engines/freescape/gfx_opengl.cpp b/engines/freescape/gfx_opengl.cpp
index 0015230df67..a73b4420ffc 100644
--- a/engines/freescape/gfx_opengl.cpp
+++ b/engines/freescape/gfx_opengl.cpp
@@ -344,7 +344,17 @@ void OpenGLRenderer::renderPlayerShootRay(byte color, const Common::Point &posit
if (_renderMode == Common::kRenderCGA || _renderMode == Common::kRenderZX) {
r = g = b = 255;
} else {
- r = g = b = 255;
+ if (_renderMode == Common::kRenderHercG) {
+ // Hercules Green
+ r = b = 0;
+ g = 255;
+ } else if (_renderMode == Common::kRenderHercA) {
+ // Hercules Amber
+ r = 255;
+ g = 191;
+ b = 0;
+ } else
+ r = g = b = 255;
glEnable(GL_BLEND);
glBlendFunc(GL_ONE_MINUS_DST_COLOR, GL_ZERO);
}
@@ -460,7 +470,17 @@ void OpenGLRenderer::renderPlayerShootBall(byte color, const Common::Point &posi
if (_renderMode == Common::kRenderCGA || _renderMode == Common::kRenderZX) {
r = g = b = 255;
} else {
- r = g = b = 255;
+ if (_renderMode == Common::kRenderHercG) {
+ // Hercules Green
+ r = b = 0;
+ g = 255;
+ } else if (_renderMode == Common::kRenderHercA) {
+ // Hercules Amber
+ r = 255;
+ g = 191;
+ b = 0;
+ } else
+ r = g = b = 255;
glEnable(GL_BLEND);
glBlendFunc(GL_ONE_MINUS_DST_COLOR, GL_ZERO);
}
diff --git a/engines/freescape/gfx_opengl_shaders.cpp b/engines/freescape/gfx_opengl_shaders.cpp
index 76e3659d67e..5dbea5080b8 100644
--- a/engines/freescape/gfx_opengl_shaders.cpp
+++ b/engines/freescape/gfx_opengl_shaders.cpp
@@ -261,7 +261,17 @@ void OpenGLShaderRenderer::renderPlayerShootBall(byte color, const Common::Point
if (_renderMode == Common::kRenderCGA || _renderMode == Common::kRenderZX) {
r = g = b = 255;
} else {
- r = g = b = 255;
+ if (_renderMode == Common::kRenderHercG) {
+ // Hercules Green
+ r = b = 0;
+ g = 255;
+ } else if (_renderMode == Common::kRenderHercA) {
+ // Hercules Amber
+ r = 255;
+ g = 191;
+ b = 0;
+ } else
+ r = g = b = 255;
glEnable(GL_BLEND);
glBlendFunc(GL_ONE_MINUS_DST_COLOR, GL_ZERO);
}
@@ -315,7 +325,17 @@ void OpenGLShaderRenderer::renderPlayerShootRay(byte color, const Common::Point
if (_renderMode == Common::kRenderCGA || _renderMode == Common::kRenderZX) {
r = g = b = 255;
} else {
- r = g = b = 255;
+ if (_renderMode == Common::kRenderHercG) {
+ // Hercules Green
+ r = b = 0;
+ g = 255;
+ } else if (_renderMode == Common::kRenderHercA) {
+ // Hercules Amber
+ r = 255;
+ g = 191;
+ b = 0;
+ } else
+ r = g = b = 255;
glEnable(GL_BLEND);
glBlendFunc(GL_ONE_MINUS_DST_COLOR, GL_ZERO);
}
diff --git a/engines/freescape/gfx_tinygl.cpp b/engines/freescape/gfx_tinygl.cpp
index e2534be9ded..e5796397f68 100644
--- a/engines/freescape/gfx_tinygl.cpp
+++ b/engines/freescape/gfx_tinygl.cpp
@@ -236,7 +236,18 @@ void TinyGLRenderer::renderPlayerShootBall(byte color, const Common::Point &posi
if (_renderMode == Common::kRenderCGA || _renderMode == Common::kRenderZX) {
r = g = b = 255;
} else {
- r = g = b = 255;
+ if (_renderMode == Common::kRenderHercG) {
+ // Hercules Green
+ r = b = 0;
+ g = 255;
+ } else if (_renderMode == Common::kRenderHercA) {
+ // Hercules Amber
+ r = 255;
+ g = 191;
+ b = 0;
+ } else
+ r = g = b = 255;
+
tglEnable(TGL_BLEND);
tglBlendFunc(TGL_ONE_MINUS_DST_COLOR, TGL_ZERO);
}
@@ -285,7 +296,17 @@ void TinyGLRenderer::renderPlayerShootRay(byte color, const Common::Point &posit
if (_renderMode == Common::kRenderCGA || _renderMode == Common::kRenderZX) {
r = g = b = 255;
} else {
- r = g = b = 255;
+ if (_renderMode == Common::kRenderHercG) {
+ // Hercules Green
+ r = b = 0;
+ g = 255;
+ } else if (_renderMode == Common::kRenderHercA) {
+ // Hercules Amber
+ r = 255;
+ g = 191;
+ b = 0;
+ } else
+ r = g = b = 255;
tglEnable(TGL_BLEND);
tglBlendFunc(TGL_ONE_MINUS_DST_COLOR, TGL_ZERO);
}
Commit: 6657b559e5a7ef9f2a9af6e343fecb377c48aafb
https://github.com/scummvm/scummvm/commit/6657b559e5a7ef9f2a9af6e343fecb377c48aafb
Author: neuromancer (gustavo.grieco at gmail.com)
Date: 2025-11-04T09:27:32+01:00
Commit Message:
FREESCAPE: refactor handling of groups in castle to make sure global conditions can be executed
Changed paths:
engines/freescape/freescape.h
engines/freescape/games/castle/castle.cpp
engines/freescape/games/castle/zx.cpp
engines/freescape/language/instruction.cpp
engines/freescape/objects/group.cpp
engines/freescape/objects/group.h
diff --git a/engines/freescape/freescape.h b/engines/freescape/freescape.h
index 5b087a3a2e6..2e10f5e1f21 100644
--- a/engines/freescape/freescape.h
+++ b/engines/freescape/freescape.h
@@ -441,7 +441,7 @@ public:
bool checkConditional(FCLInstruction &instruction, bool shot, bool collided, bool timer, bool activated);
bool checkIfGreaterOrEqual(FCLInstruction &instruction);
bool checkIfLessOrEqual(FCLInstruction &instruction);
- void executeExecute(FCLInstruction &instruction, bool shot, bool collided, bool activated);
+ void executeExecute(FCLInstruction &instruction);
void executeIncrementVariable(FCLInstruction &instruction);
void executeDecrementVariable(FCLInstruction &instruction);
void executeSetVariable(FCLInstruction &instruction);
diff --git a/engines/freescape/games/castle/castle.cpp b/engines/freescape/games/castle/castle.cpp
index a4923b14fb0..66e1c1f5031 100644
--- a/engines/freescape/games/castle/castle.cpp
+++ b/engines/freescape/games/castle/castle.cpp
@@ -415,12 +415,9 @@ void CastleEngine::gotoArea(uint16 areaID, int entranceID) {
}
resetInput();
- /*if (entranceID > 0) {
- Entrance *entrance = (Entrance *)_currentArea->entranceWithID(entranceID);
- assert(entrance);
- executeEntranceConditions(entrance);
+ if (entranceID > 0) {
executeMovementConditions();
- }*/
+ }
}
void CastleEngine::initGameState() {
@@ -932,6 +929,7 @@ void CastleEngine::executeDestroy(FCLInstruction &instruction) {
if (obj->isDestroyed())
debugC(1, kFreescapeDebugCode, "WARNING: Destroying obj %d in area %d already destroyed!", objectID, areaID);
+ obj->makeInvisible();
obj->destroy();
}
@@ -983,22 +981,39 @@ void CastleEngine::loadAssets() {
delete tmp;
}
- if (isDOS()) {
- // Discard some global conditions
- // It is unclear why they hide/unhide objects that formed the spirits
- for (int i = 0; i < 3; i++) {
- debugC(kFreescapeDebugParser, "Discarding condition %s", _conditionSources[1].c_str());
- _conditions.remove_at(1);
- _conditionSources.remove_at(1);
+ Common::List<int> globalIds = _areaMap[255]->getEntranceIds();
+ for (auto &it : _areaMap) {
+ if (it._value->getAreaID() == 255)
+ continue;
+
+ it._value->addStructure(_areaMap[255]);
+ if (it._value->objectWithID(125)) {
+ _areaMap[it._key]->addGroupFromArea(195, _areaMap[255]);
+ //group = (Group *)_areaMap[it._key]->objectWithID(195);
+
+ _areaMap[it._key]->addGroupFromArea(212, _areaMap[255]);
+ //group = (Group *)_areaMap[it._key]->objectWithID(212);
+ }
+
+ if (it._value->objectWithID(126)) {
+ _areaMap[it._key]->addGroupFromArea(191, _areaMap[255]);
+ //group = (Group *)_areaMap[it._key]->objectWithID(191);
+ }
+
+ if (it._value->objectWithID(127)) {
+ _areaMap[it._key]->addGroupFromArea(182, _areaMap[255]);
+ //group = (Group *)_areaMap[it._key]->objectWithID(193);
}
- for (auto &it : _areaMap) {
- it._value->addStructure(_areaMap[255]);
- it._value->addObjectFromArea(227, _areaMap[255]);
- it._value->addObjectFromArea(228, _areaMap[255]);
- it._value->addObjectFromArea(229, _areaMap[255]);
- it._value->addObjectFromArea(242, _areaMap[255]);
- it._value->addObjectFromArea(139, _areaMap[255]);
+ for (auto &id : globalIds) {
+ if (it._value->entranceWithID(id))
+ continue;
+
+ Object *obj = _areaMap[255]->entranceWithID(id);
+ assert(obj);
+ assert(obj->getType() == ObjectType::kEntranceType);
+ // The entrance is not in the current area, so we need to add it
+ it._value->addObjectFromArea(id, _areaMap[255]);
}
}
_areaMap[1]->addFloor();
@@ -1251,37 +1266,6 @@ void CastleEngine::drawEnergyMeter(Graphics::Surface *surface, Common::Point ori
}
void CastleEngine::addGhosts() {
- for (auto &it : _areaMap) {
- for (auto &sensor : it._value->getSensors()) {
- if (sensor->getObjectID() == 125) {
- if (isDOS()) {
- _areaMap[it._key]->addGroupFromArea(195, _areaMap[255]);
- _areaMap[it._key]->addGroupFromArea(212, _areaMap[255]);
- } else if (isSpectrum() || isCPC()) {
- _areaMap[it._key]->addObjectFromArea(170, _areaMap[255]);
- _areaMap[it._key]->addObjectFromArea(172, _areaMap[255]);
- _areaMap[it._key]->addObjectFromArea(173, _areaMap[255]);
- }
- } else if (sensor->getObjectID() == 126) {
- if (isDOS())
- _areaMap[it._key]->addGroupFromArea(191, _areaMap[255]);
- else if (isSpectrum()) {
- _areaMap[it._key]->addObjectFromArea(145, _areaMap[255]);
- _areaMap[it._key]->addObjectFromArea(165, _areaMap[255]);
- _areaMap[it._key]->addObjectFromArea(166, _areaMap[255]);
- }
- } else if (sensor->getObjectID() == 127) {
- if (isDOS())
- _areaMap[it._key]->addGroupFromArea(182, _areaMap[255]);
- else if (isSpectrum() || isCPC()) {
- _areaMap[it._key]->addObjectFromArea(142, _areaMap[255]);
- _areaMap[it._key]->addObjectFromArea(143, _areaMap[255]);
- _areaMap[it._key]->addObjectFromArea(144, _areaMap[255]);
- }
- } else
- debugC(1, kFreescapeDebugParser, "Sensor %d in area %d", sensor->getObjectID(), it._key);
- }
- }
}
void CastleEngine::checkSensors() {
@@ -1295,39 +1279,6 @@ void CastleEngine::checkSensors() {
return;
}
- for (auto &it : _sensors) {
- Sensor *sensor = (Sensor *)it;
- if (isDOS()) { // Should be similar to Amiga/AtariST
- if (sensor->getObjectID() == 125) {
- Group *group = (Group *)_currentArea->objectWithID(195);
- if (!group->isDestroyed() && !group->isInvisible()) {
- group->_active = true;
- } else
- return;
-
- group = (Group *)_currentArea->objectWithID(212);
- if (!group->isDestroyed() && !group->isInvisible()) {
- group->_active = true;
- } else
- return;
-
- } else if (sensor->getObjectID() == 126) {
- Group *group = (Group *)_currentArea->objectWithID(191);
- if (!group->isDestroyed() && !group->isInvisible()) {
- group->_active = true;
- } else
- return;
- } else if (sensor->getObjectID() == 197) {
- Group *group = (Group *)_currentArea->objectWithID(182);
- if (!group->isDestroyed() && !group->isInvisible()) {
- group->_active = true;
- } else
- return;
- }
- }
- }
-
-
if (!ghostInArea()) {
_mixer->stopHandle(_soundFxGhostHandle);
_gfx->_shakeOffset = Common::Point();
diff --git a/engines/freescape/games/castle/zx.cpp b/engines/freescape/games/castle/zx.cpp
index e6a81d6a202..2623cf9f901 100644
--- a/engines/freescape/games/castle/zx.cpp
+++ b/engines/freescape/games/castle/zx.cpp
@@ -230,29 +230,6 @@ void CastleEngine::loadAssetsZXFullGame() {
tmp->free();
delete tmp;
_riddleBottomFrame->convertToInPlace(_gfx->_texturePixelFormat);
-
- for (auto &it : _areaMap) {
- it._value->addStructure(_areaMap[255]);
-
- it._value->addObjectFromArea(164, _areaMap[255]);
- it._value->addObjectFromArea(174, _areaMap[255]);
- it._value->addObjectFromArea(175, _areaMap[255]);
- for (int16 id = 136; id < 140; id++) {
- it._value->addObjectFromArea(id, _areaMap[255]);
- }
-
- it._value->addObjectFromArea(195, _areaMap[255]);
- for (int16 id = 214; id < 228; id++) {
- it._value->addObjectFromArea(id, _areaMap[255]);
- }
- }
- // Discard some global conditions
- // It is unclear why they hide/unhide objects that formed the spirits
- for (int i = 0; i < 3; i++) {
- debugC(kFreescapeDebugParser, "Discarding condition %s", _conditionSources[0].c_str());
- _conditions.remove_at(0);
- _conditionSources.remove_at(0);
- }
}
void CastleEngine::drawZXUI(Graphics::Surface *surface) {
diff --git a/engines/freescape/language/instruction.cpp b/engines/freescape/language/instruction.cpp
index 55963fa0a78..acd779c3a1d 100644
--- a/engines/freescape/language/instruction.cpp
+++ b/engines/freescape/language/instruction.cpp
@@ -291,7 +291,7 @@ bool FreescapeEngine::executeCode(FCLInstructionVector &code, bool shot, bool co
executeRedraw(instruction);
break;
case Token::EXECUTE:
- executeExecute(instruction, shot, collided, activated);
+ executeExecute(instruction);
ip = codeSize;
break;
case Token::DELAY:
@@ -357,7 +357,7 @@ void FreescapeEngine::executeRedraw(FCLInstruction &instruction) {
waitInLoop(delay);
}
-void FreescapeEngine::executeExecute(FCLInstruction &instruction, bool shot, bool collided, bool activated) {
+void FreescapeEngine::executeExecute(FCLInstruction &instruction) {
uint16 objId = instruction._source;
debugC(1, kFreescapeDebugCode, "Executing instructions from object %d", objId);
Object *obj = _currentArea->objectWithID(objId);
@@ -371,11 +371,11 @@ void FreescapeEngine::executeExecute(FCLInstruction &instruction, bool shot, boo
}
assert(obj);
FCLInstructionVector &condition = ((Entrance *)obj)->_condition;
- executeCode(condition, shot, collided, false, activated);
+ executeCode(condition, true, true, true, true);
return;
}
}
- executeObjectConditions((GeometricObject *)obj, shot, collided, activated);
+ executeObjectConditions((GeometricObject *)obj, true, true, true);
}
void FreescapeEngine::executeSound(FCLInstruction &instruction) {
@@ -479,7 +479,7 @@ bool FreescapeEngine::executeEndIfVisibilityIsEqual(FCLInstruction &instruction)
if (additional == 0) {
obj = _currentArea->objectWithID(source);
if (!obj && isCastle())
- return false; // The value is not important
+ return (true == (value != 0));
assert(obj);
debugC(1, kFreescapeDebugCode, "End condition if visibility of obj with id %d is %d!", source, value);
} else {
@@ -605,6 +605,7 @@ void FreescapeEngine::executeDestroy(FCLInstruction &instruction) {
debugC(1, kFreescapeDebugCode, "WARNING: Destroying obj %d in area %d already destroyed!", objectID, areaID);
obj->destroy();
+ obj->makeInvisible();
}
void FreescapeEngine::executeMakeInvisible(FCLInstruction &instruction) {
@@ -656,9 +657,6 @@ void FreescapeEngine::executeMakeVisible(FCLInstruction &instruction) {
debugC(1, kFreescapeDebugCode, "Making obj %d visible in area %d!", objectID, areaID);
if (_areaMap.contains(areaID)) {
Object *obj = _areaMap[areaID]->objectWithID(objectID);
- if (!obj && isCastle() && _executingGlobalCode)
- return; // No side effects
-
if (!obj) {
obj = _areaMap[255]->objectWithID(objectID);
if (!obj) {
@@ -666,7 +664,11 @@ void FreescapeEngine::executeMakeVisible(FCLInstruction &instruction) {
error("obj %d does not exists in area %d nor in the global one!", objectID, areaID);
return;
}
- _currentArea->addObjectFromArea(objectID, _areaMap[255]);
+
+ if (obj->getType() != kGroupType)
+ _currentArea->addObjectFromArea(objectID, _areaMap[255]);
+ else if (obj->_partOfGroup)
+ _currentArea->addGroupFromArea(objectID, _areaMap[255]);
obj = _areaMap[areaID]->objectWithID(objectID);
assert(obj); // We know that an object should be there
}
diff --git a/engines/freescape/objects/group.cpp b/engines/freescape/objects/group.cpp
index c0a3d3bb605..9a1509a2a39 100644
--- a/engines/freescape/objects/group.cpp
+++ b/engines/freescape/objects/group.cpp
@@ -215,4 +215,11 @@ bool Group::collides(const Math::AABB &aabb) {
return false;
}
+void Group::makePartsInvisible() {
+ uint32 groupSize = _objects.size();
+ for (uint32 i = 0; i < groupSize ; i++) {
+ _objects[i]->makeInvisible();
+ }
+}
+
} // End of namespace Freescape
diff --git a/engines/freescape/objects/group.h b/engines/freescape/objects/group.h
index 2351ebca5ab..4568ae22014 100644
--- a/engines/freescape/objects/group.h
+++ b/engines/freescape/objects/group.h
@@ -53,6 +53,7 @@ public:
void reset();
void start();
bool collides(const Math::AABB &aabb);
+ void makePartsInvisible();
Common::Array<Object *> _objects;
Common::Array<Math::Vector3d> _origins;
Commit: 65ee661c4e0c174edf7b550a45baae15e6dd5053
https://github.com/scummvm/scummvm/commit/65ee661c4e0c174edf7b550a45baae15e6dd5053
Author: neuromancer (gustavo.grieco at gmail.com)
Date: 2025-11-04T09:27:32+01:00
Commit Message:
FREESCAPE: added missing condition in loadAssets for 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 66e1c1f5031..39ef9718d84 100644
--- a/engines/freescape/games/castle/castle.cpp
+++ b/engines/freescape/games/castle/castle.cpp
@@ -987,22 +987,25 @@ void CastleEngine::loadAssets() {
continue;
it._value->addStructure(_areaMap[255]);
- if (it._value->objectWithID(125)) {
- _areaMap[it._key]->addGroupFromArea(195, _areaMap[255]);
- //group = (Group *)_areaMap[it._key]->objectWithID(195);
- _areaMap[it._key]->addGroupFromArea(212, _areaMap[255]);
- //group = (Group *)_areaMap[it._key]->objectWithID(212);
- }
+ if (isDOS() || isAmiga() || isAtariST()) {
+ if (it._value->objectWithID(125)) {
+ _areaMap[it._key]->addGroupFromArea(195, _areaMap[255]);
+ //group = (Group *)_areaMap[it._key]->objectWithID(195);
- if (it._value->objectWithID(126)) {
- _areaMap[it._key]->addGroupFromArea(191, _areaMap[255]);
- //group = (Group *)_areaMap[it._key]->objectWithID(191);
- }
+ _areaMap[it._key]->addGroupFromArea(212, _areaMap[255]);
+ //group = (Group *)_areaMap[it._key]->objectWithID(212);
+ }
- if (it._value->objectWithID(127)) {
- _areaMap[it._key]->addGroupFromArea(182, _areaMap[255]);
- //group = (Group *)_areaMap[it._key]->objectWithID(193);
+ if (it._value->objectWithID(126)) {
+ _areaMap[it._key]->addGroupFromArea(191, _areaMap[255]);
+ //group = (Group *)_areaMap[it._key]->objectWithID(191);
+ }
+
+ if (it._value->objectWithID(127)) {
+ _areaMap[it._key]->addGroupFromArea(182, _areaMap[255]);
+ //group = (Group *)_areaMap[it._key]->objectWithID(193);
+ }
}
for (auto &id : globalIds) {
More information about the Scummvm-git-logs
mailing list