mirror of
https://github.com/libretro/scummvm.git
synced 2024-12-13 12:39:56 +00:00
FREESCAPE: better implementation of outside areas
This commit is contained in:
parent
1d62fd293a
commit
5655096bd7
@ -394,12 +394,13 @@ void Area::addFloor() {
|
||||
for (int i = 0; i < 6; i++)
|
||||
gColors->push_back(_groundColor);
|
||||
|
||||
int maxSize = 10000000 / 4;
|
||||
Object *obj = (Object *)new GeometricObject(
|
||||
ObjectType::kCubeType,
|
||||
id,
|
||||
0, // flags
|
||||
Math::Vector3d(-4128, -1, -4128), // Position
|
||||
Math::Vector3d(4128 * 4, 1, 4128 * 4), // size
|
||||
0, // flags
|
||||
Math::Vector3d(-maxSize, -3, -maxSize), // Position
|
||||
Math::Vector3d(maxSize * 4, 1, maxSize * 4), // size
|
||||
gColors,
|
||||
nullptr,
|
||||
FCLInstructionVector());
|
||||
@ -435,4 +436,9 @@ void Area::changeObjectID(uint16 objectID, uint16 newObjectID) {
|
||||
(*_objectsByID)[newObjectID] = obj;
|
||||
}
|
||||
|
||||
|
||||
bool Area::isOutside() {
|
||||
return _skyColor < 255 && _groundColor < 255;
|
||||
}
|
||||
|
||||
} // End of namespace Freescape
|
||||
|
@ -66,6 +66,7 @@ public:
|
||||
void addStructure(Area *global);
|
||||
void removeObject(int16 id);
|
||||
void resetArea();
|
||||
bool isOutside();
|
||||
|
||||
Common::Array<Common::String> _conditionSources;
|
||||
Common::Array<FCLInstructionVector> _conditions;
|
||||
|
@ -322,7 +322,11 @@ void FreescapeEngine::drawBackground() {
|
||||
}
|
||||
|
||||
void FreescapeEngine::drawFrame() {
|
||||
_gfx->updateProjectionMatrix(90.0, _nearClipPlane, _farClipPlane);
|
||||
int farClipPlane = _farClipPlane;
|
||||
if (_currentArea->isOutside())
|
||||
farClipPlane *= 100;
|
||||
|
||||
_gfx->updateProjectionMatrix(90.0, _nearClipPlane, farClipPlane);
|
||||
_gfx->positionCamera(_position, _position + _cameraFront);
|
||||
|
||||
if (_underFireFrames > 0) {
|
||||
|
@ -297,11 +297,19 @@ void FreescapeEngine::lower() {
|
||||
}
|
||||
|
||||
void FreescapeEngine::checkIfStillInArea() {
|
||||
int maxPositiveDistance = 8192;
|
||||
int maxNegativeDistance = 0;
|
||||
|
||||
if (_currentArea->isOutside()) {
|
||||
maxPositiveDistance = 16384;
|
||||
maxNegativeDistance = -16384;
|
||||
}
|
||||
|
||||
for (int i = 0; i < 3; i++) {
|
||||
if (_position.getValue(i) < 0)
|
||||
_position.setValue(i, 0);
|
||||
else if (_position.getValue(i) > 8128)
|
||||
_position.setValue(i, 8128);
|
||||
if (_position.getValue(i) < maxNegativeDistance)
|
||||
_position.setValue(i, maxNegativeDistance);
|
||||
else if (_position.getValue(i) > maxPositiveDistance)
|
||||
_position.setValue(i, maxPositiveDistance);
|
||||
}
|
||||
if (_position.y() >= 2016)
|
||||
_position.y() = _lastPosition.z();
|
||||
|
Loading…
Reference in New Issue
Block a user