mirror of
https://github.com/OpenMW/openmw.git
synced 2025-04-01 13:06:40 +00:00
GetWindSpeed
This commit is contained in:
parent
5063d90dda
commit
67422c397c
7 changed files with 36 additions and 2 deletions
apps/openmw
mwbase
mwscript
mwworld
|
@ -333,6 +333,7 @@ namespace MWBase
|
||||||
|
|
||||||
virtual bool getPlayerStandingOn (const MWWorld::Ptr& object) = 0; ///< @return true if the player is standing on \a object
|
virtual bool getPlayerStandingOn (const MWWorld::Ptr& object) = 0; ///< @return true if the player is standing on \a object
|
||||||
virtual bool getActorStandingOn (const MWWorld::Ptr& object) = 0; ///< @return true if any actor is standing on \a object
|
virtual bool getActorStandingOn (const MWWorld::Ptr& object) = 0; ///< @return true if any actor is standing on \a object
|
||||||
|
virtual float getWindSpeed() = 0;
|
||||||
|
|
||||||
virtual void setupExternalRendering (MWRender::ExternalRendering& rendering) = 0;
|
virtual void setupExternalRendering (MWRender::ExternalRendering& rendering) = 0;
|
||||||
|
|
||||||
|
|
|
@ -337,5 +337,6 @@ op 0x200020e: GetStandingActor
|
||||||
op 0x200020f: GetStandingActor, explicit
|
op 0x200020f: GetStandingActor, explicit
|
||||||
op 0x2000210: GetStartingAngle
|
op 0x2000210: GetStartingAngle
|
||||||
op 0x2000211: GetStartingAngle, explicit
|
op 0x2000211: GetStartingAngle, explicit
|
||||||
|
op 0x2000212: GetWindSpeed
|
||||||
|
|
||||||
opcodes 0x2000212-0x3ffffff unused
|
opcodes 0x2000213-0x3ffffff unused
|
||||||
|
|
|
@ -589,6 +589,16 @@ namespace MWScript
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
class OpGetWindSpeed : public Interpreter::Opcode0
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
|
||||||
|
virtual void execute (Interpreter::Runtime& runtime)
|
||||||
|
{
|
||||||
|
runtime.push(MWBase::Environment::get().getWorld()->getWindSpeed());
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
const int opcodeXBox = 0x200000c;
|
const int opcodeXBox = 0x200000c;
|
||||||
const int opcodeOnActivate = 0x200000d;
|
const int opcodeOnActivate = 0x200000d;
|
||||||
const int opcodeActivate = 0x2000075;
|
const int opcodeActivate = 0x2000075;
|
||||||
|
@ -636,6 +646,7 @@ namespace MWScript
|
||||||
const int opcodeGetStandingPcExplicit = 0x200020d;
|
const int opcodeGetStandingPcExplicit = 0x200020d;
|
||||||
const int opcodeGetStandingActor = 0x200020e;
|
const int opcodeGetStandingActor = 0x200020e;
|
||||||
const int opcodeGetStandingActorExplicit = 0x200020f;
|
const int opcodeGetStandingActorExplicit = 0x200020f;
|
||||||
|
const int opcodeGetWindSpeed = 0x2000212;
|
||||||
|
|
||||||
const int opcodePlayBink = 0x20001f7;
|
const int opcodePlayBink = 0x20001f7;
|
||||||
|
|
||||||
|
@ -680,6 +691,7 @@ namespace MWScript
|
||||||
extensions.registerInstruction ("fall", "", opcodeFall, opcodeFallExplicit);
|
extensions.registerInstruction ("fall", "", opcodeFall, opcodeFallExplicit);
|
||||||
extensions.registerFunction ("getstandingpc", 'l', "", opcodeGetStandingPc, opcodeGetStandingPcExplicit);
|
extensions.registerFunction ("getstandingpc", 'l', "", opcodeGetStandingPc, opcodeGetStandingPcExplicit);
|
||||||
extensions.registerFunction ("getstandingactor", 'l', "", opcodeGetStandingActor, opcodeGetStandingActorExplicit);
|
extensions.registerFunction ("getstandingactor", 'l', "", opcodeGetStandingActor, opcodeGetStandingActorExplicit);
|
||||||
|
extensions.registerFunction ("getwindspeed", 'f', "", opcodeGetWindSpeed);
|
||||||
}
|
}
|
||||||
|
|
||||||
void installOpcodes (Interpreter::Interpreter& interpreter)
|
void installOpcodes (Interpreter::Interpreter& interpreter)
|
||||||
|
@ -732,6 +744,7 @@ namespace MWScript
|
||||||
interpreter.installSegment5 (opcodeGetStandingPcExplicit, new OpGetStandingPc<ExplicitRef>);
|
interpreter.installSegment5 (opcodeGetStandingPcExplicit, new OpGetStandingPc<ExplicitRef>);
|
||||||
interpreter.installSegment5 (opcodeGetStandingActor, new OpGetStandingActor<ImplicitRef>);
|
interpreter.installSegment5 (opcodeGetStandingActor, new OpGetStandingActor<ImplicitRef>);
|
||||||
interpreter.installSegment5 (opcodeGetStandingActorExplicit, new OpGetStandingActor<ExplicitRef>);
|
interpreter.installSegment5 (opcodeGetStandingActorExplicit, new OpGetStandingActor<ExplicitRef>);
|
||||||
|
interpreter.installSegment5 (opcodeGetWindSpeed, new OpGetWindSpeed);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -65,7 +65,7 @@ WeatherManager::WeatherManager(MWRender::RenderingManager* rendering,MWWorld::Fa
|
||||||
mHour(14), mCurrentWeather("clear"), mFirstUpdate(true), mWeatherUpdateTime(0),
|
mHour(14), mCurrentWeather("clear"), mFirstUpdate(true), mWeatherUpdateTime(0),
|
||||||
mThunderFlash(0), mThunderChance(0), mThunderChanceNeeded(50), mThunderSoundDelay(0),
|
mThunderFlash(0), mThunderChance(0), mThunderChanceNeeded(50), mThunderSoundDelay(0),
|
||||||
mRemainingTransitionTime(0), mMonth(0), mDay(0),
|
mRemainingTransitionTime(0), mMonth(0), mDay(0),
|
||||||
mTimePassed(0), mFallback(fallback)
|
mTimePassed(0), mFallback(fallback), mWindSpeed(0.f)
|
||||||
{
|
{
|
||||||
mRendering = rendering;
|
mRendering = rendering;
|
||||||
//Globals
|
//Globals
|
||||||
|
@ -367,6 +367,8 @@ void WeatherManager::update(float duration)
|
||||||
else
|
else
|
||||||
result = getResult(mCurrentWeather);
|
result = getResult(mCurrentWeather);
|
||||||
|
|
||||||
|
mWindSpeed = result.mWindSpeed;
|
||||||
|
|
||||||
mRendering->configureFog(result.mFogDepth, result.mFogColor);
|
mRendering->configureFog(result.mFogDepth, result.mFogColor);
|
||||||
|
|
||||||
// disable sun during night
|
// disable sun during night
|
||||||
|
@ -653,3 +655,8 @@ void WeatherManager::changeWeather(const std::string& region, const unsigned int
|
||||||
if (Misc::StringUtils::ciEqual(region, playerRegion))
|
if (Misc::StringUtils::ciEqual(region, playerRegion))
|
||||||
setWeather(weather);
|
setWeather(weather);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
float WeatherManager::getWindSpeed() const
|
||||||
|
{
|
||||||
|
return mWindSpeed;
|
||||||
|
}
|
||||||
|
|
|
@ -131,6 +131,8 @@ namespace MWWorld
|
||||||
|
|
||||||
void setHour(const float hour);
|
void setHour(const float hour);
|
||||||
|
|
||||||
|
float getWindSpeed() const;
|
||||||
|
|
||||||
void setDate(const int day, const int month);
|
void setDate(const int day, const int month);
|
||||||
|
|
||||||
void advanceTime(double hours)
|
void advanceTime(double hours)
|
||||||
|
@ -143,6 +145,7 @@ namespace MWWorld
|
||||||
private:
|
private:
|
||||||
float mHour;
|
float mHour;
|
||||||
int mDay, mMonth;
|
int mDay, mMonth;
|
||||||
|
float mWindSpeed;
|
||||||
MWWorld::Fallback* mFallback;
|
MWWorld::Fallback* mFallback;
|
||||||
void setFallbackWeather(Weather& weather,const std::string& name);
|
void setFallbackWeather(Weather& weather,const std::string& name);
|
||||||
MWRender::RenderingManager* mRendering;
|
MWRender::RenderingManager* mRendering;
|
||||||
|
|
|
@ -1599,4 +1599,12 @@ namespace MWWorld
|
||||||
{
|
{
|
||||||
return mPhysEngine->isAnyActorStandingOn(object.getRefData().getBaseNode()->getName());
|
return mPhysEngine->isAnyActorStandingOn(object.getRefData().getBaseNode()->getName());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
float World::getWindSpeed()
|
||||||
|
{
|
||||||
|
if (isCellExterior() || isCellQuasiExterior())
|
||||||
|
return mWeatherManager->getWindSpeed();
|
||||||
|
else
|
||||||
|
return 0.f;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -383,6 +383,7 @@ namespace MWWorld
|
||||||
|
|
||||||
virtual bool getPlayerStandingOn (const MWWorld::Ptr& object); ///< @return true if the player is standing on \a object
|
virtual bool getPlayerStandingOn (const MWWorld::Ptr& object); ///< @return true if the player is standing on \a object
|
||||||
virtual bool getActorStandingOn (const MWWorld::Ptr& object); ///< @return true if any actor is standing on \a object
|
virtual bool getActorStandingOn (const MWWorld::Ptr& object); ///< @return true if any actor is standing on \a object
|
||||||
|
virtual float getWindSpeed();
|
||||||
|
|
||||||
virtual void setupExternalRendering (MWRender::ExternalRendering& rendering);
|
virtual void setupExternalRendering (MWRender::ExternalRendering& rendering);
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue