Merge branch 'game_protocol'
This commit is contained in:
commit
bb88ffc460
@ -199,11 +199,11 @@ void MaxSpeed::SpeedIncrease::rewindTo(BareNetworkString *buffer,
|
||||
* value is changed to something else).
|
||||
*/
|
||||
void MaxSpeed::setSlowdown(unsigned int category, float max_speed_fraction,
|
||||
int fade_in_time, int duration)
|
||||
int fade_in_ticks, int duration)
|
||||
{
|
||||
assert(category>=MS_DECREASE_MIN && category <MS_DECREASE_MAX);
|
||||
m_speed_decrease[category].m_max_speed_fraction = max_speed_fraction;
|
||||
m_speed_decrease[category].m_fade_in_time = fade_in_time;
|
||||
m_speed_decrease[category].m_fade_in_ticks = fade_in_ticks;
|
||||
m_speed_decrease[category].m_duration = duration;
|
||||
} // setSlowdown
|
||||
|
||||
@ -227,11 +227,11 @@ void MaxSpeed::SpeedDecrease::update(int ticks)
|
||||
}
|
||||
|
||||
float diff = m_current_fraction - m_max_speed_fraction;
|
||||
if(diff > 0)
|
||||
|
||||
if (diff > 0)
|
||||
{
|
||||
float dt = stk_config->ticks2Time(ticks);
|
||||
if (diff * m_fade_in_time > ticks)
|
||||
m_current_fraction -= float(dt)/m_fade_in_time;
|
||||
if (diff * m_fade_in_ticks > ticks)
|
||||
m_current_fraction -= float(ticks) / float(m_fade_in_ticks);
|
||||
else
|
||||
m_current_fraction = m_max_speed_fraction;
|
||||
}
|
||||
@ -247,7 +247,7 @@ void MaxSpeed::SpeedDecrease::update(int ticks)
|
||||
void MaxSpeed::SpeedDecrease::saveState(BareNetworkString *buffer) const
|
||||
{
|
||||
buffer->addFloat(m_max_speed_fraction);
|
||||
buffer->addUInt32(m_fade_in_time);
|
||||
buffer->addUInt32(m_fade_in_ticks);
|
||||
buffer->addFloat(m_current_fraction);
|
||||
buffer->addUInt32(m_duration);
|
||||
} // saveState
|
||||
@ -261,7 +261,7 @@ void MaxSpeed::SpeedDecrease::rewindTo(BareNetworkString *buffer,
|
||||
if(is_active)
|
||||
{
|
||||
m_max_speed_fraction = buffer->getFloat();
|
||||
m_fade_in_time = buffer->getUInt32();
|
||||
m_fade_in_ticks = buffer->getUInt32();
|
||||
m_current_fraction = buffer->getFloat();
|
||||
m_duration = buffer->getUInt32();
|
||||
}
|
||||
|
@ -127,7 +127,7 @@ private:
|
||||
/** The maximum slowdown to apply. */
|
||||
float m_max_speed_fraction;
|
||||
/** How long it should take for the full slowdown to take effect. */
|
||||
int m_fade_in_time;
|
||||
int m_fade_in_ticks;
|
||||
/** The current slowdown fraction, taking the fade-in time
|
||||
* into account. */
|
||||
float m_current_fraction;
|
||||
@ -148,7 +148,7 @@ private:
|
||||
{
|
||||
m_max_speed_fraction = 1.0f;
|
||||
m_current_fraction = 1.0f;
|
||||
m_fade_in_time = 0;
|
||||
m_fade_in_ticks = 0;
|
||||
m_duration = 0;
|
||||
} //reset
|
||||
// --------------------------------------------------------------------
|
||||
|
@ -234,9 +234,8 @@ void CutsceneWorld::update(int ticks)
|
||||
double prev_time = m_time;
|
||||
double now = StkTime::getRealTime();
|
||||
m_time = now - m_time_at_second_reset;
|
||||
ticks = stk_config->time2Ticks(float(m_time - prev_time));
|
||||
}
|
||||
|
||||
|
||||
float fade = 0.0f;
|
||||
float fadeIn = -1.0f;
|
||||
float fadeOut = -1.0f;
|
||||
|
@ -562,8 +562,9 @@ namespace Scripting
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
void ScriptEngine::update(double dt)
|
||||
void ScriptEngine::update(int ticks)
|
||||
{
|
||||
double dt = stk_config->ticks2Time(ticks);
|
||||
for (int i = m_pending_timeouts.size() - 1; i >= 0; i--)
|
||||
{
|
||||
PendingTimeout& curr = m_pending_timeouts[i];
|
||||
|
@ -82,7 +82,7 @@ namespace Scripting
|
||||
|
||||
void addPendingTimeout(double time, const std::string& callback_name);
|
||||
void addPendingTimeout(double time, asIScriptFunction* delegate_fn);
|
||||
void update(double dt);
|
||||
void update(int ticks);
|
||||
|
||||
asIScriptEngine* getEngine() { return m_engine; }
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user