[Scummvm-git-logs] scummvm master -> 44eb7fec4b7e09b5135f4771291603ad810a0099
neuromancer
noreply at scummvm.org
Sun Oct 27 09:07:41 UTC 2024
This automated email contains information about 3 new commits which have been
pushed to the 'scummvm' repo located at https://github.com/scummvm/scummvm .
Summary:
d1f8da8a7f FREESCAPE: avoid duplicate objects if they already exist when adding them to a group
ffc4cc53cd FREESCAPE: rise can fail if there is no place
44eb7fec4b FREESCAPE: ugly workaround for collision detection in certain castle areas
Commit: d1f8da8a7f5478dab7e8284b89375d03d0c70c5b
https://github.com/scummvm/scummvm/commit/d1f8da8a7f5478dab7e8284b89375d03d0c70c5b
Author: neuromancer (gustavo.grieco at gmail.com)
Date: 2024-10-27T10:07:31+01:00
Commit Message:
FREESCAPE: avoid duplicate objects if they already exist when adding them to a group
Changed paths:
engines/freescape/area.cpp
diff --git a/engines/freescape/area.cpp b/engines/freescape/area.cpp
index f56c02255aa..9a73627ff2a 100644
--- a/engines/freescape/area.cpp
+++ b/engines/freescape/area.cpp
@@ -556,7 +556,8 @@ void Area::addGroupFromArea(int16 id, Area *global) {
if (!global->objectWithID(it))
continue;
- addObjectFromArea(it, global);
+ if (!objectWithID(it))
+ addObjectFromArea(it, global);
group->linkObject(objectWithID(it));
}
}
Commit: ffc4cc53cd8204b7967a69f3c642751b61835c0c
https://github.com/scummvm/scummvm/commit/ffc4cc53cd8204b7967a69f3c642751b61835c0c
Author: neuromancer (gustavo.grieco at gmail.com)
Date: 2024-10-27T10:07:31+01:00
Commit Message:
FREESCAPE: rise can fail if there is no place
Changed paths:
engines/freescape/freescape.h
engines/freescape/games/castle/castle.cpp
engines/freescape/movement.cpp
diff --git a/engines/freescape/freescape.h b/engines/freescape/freescape.h
index a033dc3da63..20ea38aac3a 100644
--- a/engines/freescape/freescape.h
+++ b/engines/freescape/freescape.h
@@ -58,7 +58,7 @@ enum CameraMovement {
kRightMovement
};
-enum FREESCAPEAction {
+enum FreescapeAction {
kActionNone,
kActionEscape,
kActionSave,
@@ -69,7 +69,6 @@ enum FREESCAPEAction {
kActionMoveLeft,
kActionMoveRight,
kActionShoot,
- kActionRunMode,
kActionChangeAngle,
kActionChangeStepSize,
kActionToggleRiseLower,
@@ -94,6 +93,9 @@ enum FREESCAPEAction {
// Total Eclipse
kActionRest,
// Castle
+ kActionRunMode,
+ kActionWalkMode,
+ kActionCrawlMode,
kActionSelectPrince,
kActionSelectPrincess,
};
@@ -332,7 +334,7 @@ public:
void changeStepSize();
void changeAngle();
- void rise();
+ bool rise();
void lower();
bool checkFloor(Math::Vector3d currentPosition);
bool tryStepUp(Math::Vector3d currentPosition);
diff --git a/engines/freescape/games/castle/castle.cpp b/engines/freescape/games/castle/castle.cpp
index 7a03e8a3c3a..fea9a6259be 100644
--- a/engines/freescape/games/castle/castle.cpp
+++ b/engines/freescape/games/castle/castle.cpp
@@ -267,13 +267,13 @@ void CastleEngine::initKeymaps(Common::Keymap *engineKeyMap, Common::Keymap *inf
engineKeyMap->addAction(act);
act = new Common::Action("WALK", _("Walk"));
- act->setCustomEngineActionEvent(kActionRiseOrFlyUp);
+ act->setCustomEngineActionEvent(kActionWalkMode);
act->addDefaultInputMapping("JOY_B");
act->addDefaultInputMapping("w");
engineKeyMap->addAction(act);
act = new Common::Action("CRAWL", _("Crawl"));
- act->setCustomEngineActionEvent(kActionLowerOrFlyDown);
+ act->setCustomEngineActionEvent(kActionCrawlMode);
act->addDefaultInputMapping("JOY_Y");
act->addDefaultInputMapping("c");
engineKeyMap->addAction(act);
@@ -400,18 +400,39 @@ void CastleEngine::pressedKey(const int keycode) {
} else if (keycode == Common::KEYCODE_s) {
// TODO: show score
} else if (keycode == kActionRunMode) {
- if (_playerHeightNumber == 0)
- rise();
+ if (_playerHeightNumber == 0) {
+ if (_gameStateVars[k8bitVariableShield] <= 3) {
+ insertTemporaryMessage(_messagesList[12], _countdown - 2);
+ return;
+ }
+
+ if (!rise()) {
+ _playerStepIndex = 0;
+ insertTemporaryMessage(_messagesList[11], _countdown - 2);
+ return;
+ }
+ }
// TODO: raising can fail if there is no room, so the action should fail
_playerStepIndex = 2;
insertTemporaryMessage(_messagesList[15], _countdown - 2);
- } else if (keycode == kActionRiseOrFlyUp) {
- if (_playerHeightNumber == 0)
- rise();
+ } else if (keycode == kActionWalkMode) {
+ if (_playerHeightNumber == 0) {
+ if (_gameStateVars[k8bitVariableShield] <= 3) {
+ insertTemporaryMessage(_messagesList[12], _countdown - 2);
+ return;
+ }
+
+ if (!rise()) {
+ _playerStepIndex = 0;
+ insertTemporaryMessage(_messagesList[11], _countdown - 2);
+ return;
+ }
+ }
+
// TODO: raising can fail if there is no room, so the action should fail
_playerStepIndex = 1;
insertTemporaryMessage(_messagesList[14], _countdown - 2);
- } else if (keycode == kActionLowerOrFlyDown) {
+ } else if (keycode == kActionCrawlMode) {
if (_playerHeightNumber == 1)
lower();
_playerStepIndex = 0;
diff --git a/engines/freescape/movement.cpp b/engines/freescape/movement.cpp
index 1d82482bae3..d850d613783 100644
--- a/engines/freescape/movement.cpp
+++ b/engines/freescape/movement.cpp
@@ -267,7 +267,8 @@ void FreescapeEngine::decreaseStepSize() {
_playerStepIndex--;
}
-void FreescapeEngine::rise() {
+bool FreescapeEngine::rise() {
+ bool result = false;
debugC(1, kFreescapeDebugMove, "playerHeightNumber: %d", _playerHeightNumber);
int previousAreaID = _currentArea->getAreaID();
if (_flyMode) {
@@ -276,7 +277,7 @@ void FreescapeEngine::rise() {
resolveCollisions(destination);
} else {
if (_playerHeightNumber >= _playerHeightMaxNumber)
- return;
+ return result;
_playerHeightNumber++;
changePlayerHeight(_playerHeightNumber);
@@ -288,13 +289,16 @@ void FreescapeEngine::rise() {
if (_currentArea->getAreaID() == previousAreaID) {
_playerHeightNumber--;
changePlayerHeight(_playerHeightNumber);
+
}
- }
+ } else
+ result = true;
}
checkIfStillInArea();
_lastPosition = _position;
debugC(1, kFreescapeDebugMove, "new player position: %f, %f, %f", _position.x(), _position.y(), _position.z());
executeMovementConditions();
+ return result;
}
void FreescapeEngine::lower() {
Commit: 44eb7fec4b7e09b5135f4771291603ad810a0099
https://github.com/scummvm/scummvm/commit/44eb7fec4b7e09b5135f4771291603ad810a0099
Author: neuromancer (gustavo.grieco at gmail.com)
Date: 2024-10-27T10:07:31+01:00
Commit Message:
FREESCAPE: ugly workaround for collision detection in certain castle areas
Changed paths:
engines/freescape/area.cpp
engines/freescape/language/instruction.cpp
engines/freescape/movement.cpp
engines/freescape/sweepAABB.h
diff --git a/engines/freescape/area.cpp b/engines/freescape/area.cpp
index 9a73627ff2a..26acb1178a8 100644
--- a/engines/freescape/area.cpp
+++ b/engines/freescape/area.cpp
@@ -436,12 +436,20 @@ ObjectArray Area::checkCollisions(const Math::AABB &boundingBox) {
return collided;
}
-extern Math::AABB createPlayerAABB(Math::Vector3d const position, int playerHeight);
-
Math::Vector3d Area::resolveCollisions(const Math::Vector3d &lastPosition_, const Math::Vector3d &newPosition_, int playerHeight) {
Math::Vector3d position = newPosition_;
Math::Vector3d lastPosition = lastPosition_;
- Math::AABB boundingBox = createPlayerAABB(lastPosition, playerHeight);
+
+ float reductionHeight = 0.0;
+ // Ugly hack to fix the collisions in tight spaces in the stores and junk room
+ // for Castle Master
+ if (_name == " STORES " && _areaID == 62) {
+ reductionHeight = 0.3;
+ } else if (_name == " JUNK ROOM " && _areaID == 61) {
+ reductionHeight = 0.3;
+ }
+
+ Math::AABB boundingBox = createPlayerAABB(lastPosition, playerHeight, reductionHeight);
float epsilon = 1.5;
int i = 0;
diff --git a/engines/freescape/language/instruction.cpp b/engines/freescape/language/instruction.cpp
index 7b4ffe8c6c8..177bb37fcce 100644
--- a/engines/freescape/language/instruction.cpp
+++ b/engines/freescape/language/instruction.cpp
@@ -24,6 +24,7 @@
#include "freescape/freescape.h"
#include "freescape/language/8bitDetokeniser.h"
+#include "freescape/sweepAABB.h"
namespace Freescape {
@@ -589,8 +590,6 @@ void FreescapeEngine::executeMakeInvisible(FCLInstruction &instruction) {
}
-extern Math::AABB createPlayerAABB(Math::Vector3d const position, int playerHeight);
-
void FreescapeEngine::executeMakeVisible(FCLInstruction &instruction) {
uint16 objectID = 0;
uint16 areaID = _currentArea->getAreaID();
diff --git a/engines/freescape/movement.cpp b/engines/freescape/movement.cpp
index d850d613783..29cdf92d975 100644
--- a/engines/freescape/movement.cpp
+++ b/engines/freescape/movement.cpp
@@ -105,12 +105,12 @@ void FreescapeEngine::initKeymaps(Common::Keymap *engineKeyMap, Common::Keymap *
engineKeyMap->addAction(act);
}
-Math::AABB createPlayerAABB(Math::Vector3d const position, int playerHeight) {
- Math::AABB boundingBox(position, position);
-
- Math::Vector3d v1(position.x() + 1, position.y() - 1, position.z() + 1);
+Math::AABB createPlayerAABB(Math::Vector3d const position, int playerHeight, float reductionHeight = 0.0f) {
+ Math::Vector3d v1(position.x() + 1, position.y() - playerHeight * reductionHeight - 1, position.z() + 1);
Math::Vector3d v2(position.x() - 1, position.y() - playerHeight, position.z() - 1);
+ Math::AABB boundingBox(v1, v2);
+
boundingBox.expand(v1);
boundingBox.expand(v2);
return boundingBox;
diff --git a/engines/freescape/sweepAABB.h b/engines/freescape/sweepAABB.h
index 71110740b6d..ea29a1f0683 100644
--- a/engines/freescape/sweepAABB.h
+++ b/engines/freescape/sweepAABB.h
@@ -24,6 +24,7 @@
namespace Freescape {
+extern Math::AABB createPlayerAABB(Math::Vector3d const position, int playerHeight, float reductionHeight = 0.0f);
extern float sweepAABB(Math::AABB const &a, Math::AABB const &b, Math::Vector3d const &direction, Math::Vector3d &normal);
}
More information about the Scummvm-git-logs
mailing list