mirror of
https://github.com/libretro/scummvm.git
synced 2025-01-11 04:06:12 +00:00
MYST3: Add the rotation effect used by ENPP 11
This commit is contained in:
parent
b4962f645e
commit
bb760d4a47
@ -570,4 +570,40 @@ bool ShakeEffect::update() {
|
|||||||
void ShakeEffect::applyForFace(uint face, Graphics::Surface* src, Graphics::Surface* dst) {
|
void ShakeEffect::applyForFace(uint face, Graphics::Surface* src, Graphics::Surface* dst) {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
RotationEffect::RotationEffect(Myst3Engine *vm) :
|
||||||
|
Effect(vm),
|
||||||
|
_lastUpdate(0),
|
||||||
|
_headingOffset(0) {
|
||||||
|
}
|
||||||
|
|
||||||
|
RotationEffect::~RotationEffect() {
|
||||||
|
}
|
||||||
|
|
||||||
|
RotationEffect *RotationEffect::create(Myst3Engine *vm) {
|
||||||
|
if (vm->_state->getRotationEffectSpeed() == 0) {
|
||||||
|
return nullptr;
|
||||||
|
}
|
||||||
|
|
||||||
|
return new RotationEffect(vm);
|
||||||
|
}
|
||||||
|
|
||||||
|
bool RotationEffect::update() {
|
||||||
|
// Check if the effect is active
|
||||||
|
int32 speed = _vm->_state->getRotationEffectSpeed();
|
||||||
|
if (speed == 0) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (_lastUpdate != 0) {
|
||||||
|
_headingOffset = speed * (g_system->getMillis() - _lastUpdate) / 1000.0;
|
||||||
|
}
|
||||||
|
|
||||||
|
_lastUpdate = g_system->getMillis();
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
void RotationEffect::applyForFace(uint face, Graphics::Surface* src, Graphics::Surface* dst) {
|
||||||
|
}
|
||||||
|
|
||||||
} // End of namespace Myst3
|
} // End of namespace Myst3
|
||||||
|
@ -147,6 +147,24 @@ protected:
|
|||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
class RotationEffect : public Effect {
|
||||||
|
public:
|
||||||
|
static RotationEffect *create(Myst3Engine *vm);
|
||||||
|
virtual ~RotationEffect();
|
||||||
|
|
||||||
|
bool update();
|
||||||
|
void applyForFace(uint face, Graphics::Surface *src, Graphics::Surface *dst);
|
||||||
|
|
||||||
|
float getHeadingOffset() { return _headingOffset; }
|
||||||
|
|
||||||
|
protected:
|
||||||
|
RotationEffect(Myst3Engine *vm);
|
||||||
|
|
||||||
|
uint32 _lastUpdate;
|
||||||
|
float _headingOffset;
|
||||||
|
|
||||||
|
};
|
||||||
|
|
||||||
} // End of namespace Myst3
|
} // End of namespace Myst3
|
||||||
|
|
||||||
#endif // EFFECTS_H_
|
#endif // EFFECTS_H_
|
||||||
|
@ -77,7 +77,7 @@ Myst3Engine::Myst3Engine(OSystem *syst, const Myst3GameDescription *version) :
|
|||||||
_inputSpacePressed(false), _inputEnterPressed(false),
|
_inputSpacePressed(false), _inputEnterPressed(false),
|
||||||
_inputEscapePressed(false), _inputTildePressed(false),
|
_inputEscapePressed(false), _inputTildePressed(false),
|
||||||
_menuAction(0), _projectorBackground(0),
|
_menuAction(0), _projectorBackground(0),
|
||||||
_shakeEffect(0) {
|
_shakeEffect(0), _rotationEffect(0) {
|
||||||
DebugMan.addDebugChannel(kDebugVariable, "Variable", "Track Variable Accesses");
|
DebugMan.addDebugChannel(kDebugVariable, "Variable", "Track Variable Accesses");
|
||||||
DebugMan.addDebugChannel(kDebugSaveLoad, "SaveLoad", "Track Save/Load Function");
|
DebugMan.addDebugChannel(kDebugSaveLoad, "SaveLoad", "Track Save/Load Function");
|
||||||
DebugMan.addDebugChannel(kDebugScript, "Script", "Track Script Execution");
|
DebugMan.addDebugChannel(kDebugScript, "Script", "Track Script Execution");
|
||||||
@ -526,6 +526,14 @@ void Myst3Engine::drawFrame(bool noSwap) {
|
|||||||
float heading = _state->getLookAtHeading();
|
float heading = _state->getLookAtHeading();
|
||||||
float fov = _state->getLookAtFOV();
|
float fov = _state->getLookAtFOV();
|
||||||
|
|
||||||
|
// Apply the rotation effect
|
||||||
|
if (_rotationEffect) {
|
||||||
|
_rotationEffect->update();
|
||||||
|
|
||||||
|
heading += _rotationEffect->getHeadingOffset();
|
||||||
|
_state->lookAt(pitch, heading);
|
||||||
|
}
|
||||||
|
|
||||||
// Apply the shake effect
|
// Apply the shake effect
|
||||||
if (_shakeEffect) {
|
if (_shakeEffect) {
|
||||||
_shakeEffect->update();
|
_shakeEffect->update();
|
||||||
@ -677,8 +685,9 @@ void Myst3Engine::loadNode(uint16 nodeID, uint32 roomID, uint32 ageID) {
|
|||||||
|
|
||||||
runNodeInitScripts();
|
runNodeInitScripts();
|
||||||
|
|
||||||
// The shake effect can only be created after running the scripts
|
// These effects can only be created after running the node init scripts
|
||||||
_shakeEffect = ShakeEffect::create(this);
|
_shakeEffect = ShakeEffect::create(this);
|
||||||
|
_rotationEffect = RotationEffect::create(this);
|
||||||
|
|
||||||
// WORKAROUND: In Narayan, the scripts in node NACH 9 test on var 39
|
// WORKAROUND: In Narayan, the scripts in node NACH 9 test on var 39
|
||||||
// without first reinitializing it leading to Saavedro not always giving
|
// without first reinitializing it leading to Saavedro not always giving
|
||||||
@ -700,12 +709,15 @@ void Myst3Engine::unloadNode() {
|
|||||||
|
|
||||||
_sunspots.clear();
|
_sunspots.clear();
|
||||||
|
|
||||||
// Clean up the shake effect
|
// Clean up the effects
|
||||||
delete _shakeEffect;
|
delete _shakeEffect;
|
||||||
|
_shakeEffect = nullptr;
|
||||||
_state->setShakeEffectAmpl(0);
|
_state->setShakeEffectAmpl(0);
|
||||||
|
delete _rotationEffect;
|
||||||
|
_rotationEffect = nullptr;
|
||||||
|
|
||||||
delete _node;
|
delete _node;
|
||||||
_node = 0;
|
_node = nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
void Myst3Engine::runNodeInitScripts() {
|
void Myst3Engine::runNodeInitScripts() {
|
||||||
|
@ -87,6 +87,7 @@ class Menu;
|
|||||||
class Sound;
|
class Sound;
|
||||||
class Ambient;
|
class Ambient;
|
||||||
class ShakeEffect;
|
class ShakeEffect;
|
||||||
|
class RotationEffect;
|
||||||
struct NodeData;
|
struct NodeData;
|
||||||
struct Myst3GameDescription;
|
struct Myst3GameDescription;
|
||||||
|
|
||||||
@ -197,8 +198,10 @@ private:
|
|||||||
|
|
||||||
uint16 _menuAction;
|
uint16 _menuAction;
|
||||||
|
|
||||||
// Used Amateria's magnetic rings
|
// Used by Amateria's magnetic rings
|
||||||
ShakeEffect *_shakeEffect;
|
ShakeEffect *_shakeEffect;
|
||||||
|
// Used by Voltaic's spinning gears
|
||||||
|
RotationEffect *_rotationEffect;
|
||||||
|
|
||||||
bool _inputSpacePressed;
|
bool _inputSpacePressed;
|
||||||
bool _inputEnterPressed;
|
bool _inputEnterPressed;
|
||||||
|
@ -142,7 +142,7 @@ GameState::GameState(Myst3Engine *vm):
|
|||||||
|
|
||||||
VAR(112, ShakeEffectAmpl, false)
|
VAR(112, ShakeEffectAmpl, false)
|
||||||
VAR(113, ShakeEffectFramePeriod, false)
|
VAR(113, ShakeEffectFramePeriod, false)
|
||||||
|
VAR(114, RotationEffectSpeed, false)
|
||||||
VAR(115, SunspotIntensity, false)
|
VAR(115, SunspotIntensity, false)
|
||||||
VAR(116, SunspotColor, false)
|
VAR(116, SunspotColor, false)
|
||||||
VAR(117, SunspotRadius, false)
|
VAR(117, SunspotRadius, false)
|
||||||
|
@ -122,7 +122,7 @@ public:
|
|||||||
|
|
||||||
DECLARE_VAR(112, ShakeEffectAmpl)
|
DECLARE_VAR(112, ShakeEffectAmpl)
|
||||||
DECLARE_VAR(113, ShakeEffectFramePeriod)
|
DECLARE_VAR(113, ShakeEffectFramePeriod)
|
||||||
|
DECLARE_VAR(114, RotationEffectSpeed)
|
||||||
DECLARE_VAR(115, SunspotIntensity)
|
DECLARE_VAR(115, SunspotIntensity)
|
||||||
DECLARE_VAR(116, SunspotColor)
|
DECLARE_VAR(116, SunspotColor)
|
||||||
DECLARE_VAR(117, SunspotRadius)
|
DECLARE_VAR(117, SunspotRadius)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user