Save only the minimum for basketball rewind
This commit is contained in:
parent
ddeab51917
commit
be089ae9bd
@ -46,7 +46,7 @@ float RubberBall::m_st_squash_duration;
|
||||
float RubberBall::m_st_squash_slowdown;
|
||||
float RubberBall::m_st_target_distance;
|
||||
float RubberBall::m_st_target_max_angle;
|
||||
int RubberBall::m_st_delete_ticks;
|
||||
int16_t RubberBall::m_st_delete_ticks;
|
||||
float RubberBall::m_st_max_height_difference;
|
||||
float RubberBall::m_st_fast_ping_distance;
|
||||
float RubberBall::m_st_early_target_factor;
|
||||
@ -316,7 +316,7 @@ void RubberBall::init(const XMLNode &node, scene::IMesh *rubberball)
|
||||
m_st_min_interpolation_distance = 30.0f;
|
||||
m_st_target_distance = 50.0f;
|
||||
m_st_target_max_angle = 25.0f;
|
||||
m_st_delete_ticks = stk_config->time2Ticks(10.0f);
|
||||
m_st_delete_ticks = (int16_t)stk_config->time2Ticks(10.0f);
|
||||
m_st_max_height_difference = 10.0f;
|
||||
m_st_fast_ping_distance = 50.0f;
|
||||
m_st_early_target_factor = 1.0f;
|
||||
@ -892,7 +892,7 @@ BareNetworkString* RubberBall::saveState(std::vector<std::string>* ru)
|
||||
if (!buffer)
|
||||
return NULL;
|
||||
|
||||
buffer->addUInt32(m_last_aimed_graph_node);
|
||||
buffer->addUInt16((int16_t)m_last_aimed_graph_node);
|
||||
buffer->add(m_control_points[0]);
|
||||
buffer->add(m_control_points[1]);
|
||||
buffer->add(m_control_points[2]);
|
||||
@ -905,7 +905,7 @@ BareNetworkString* RubberBall::saveState(std::vector<std::string>* ru)
|
||||
buffer->addFloat(m_t_increase);
|
||||
buffer->addFloat(m_interval);
|
||||
buffer->addFloat(m_height_timer);
|
||||
buffer->addUInt32(m_delete_ticks);
|
||||
buffer->addUInt16(m_delete_ticks);
|
||||
buffer->addFloat(m_current_max_height);
|
||||
buffer->addUInt8(m_tunnel_count | (m_aiming_at_target ? (1 << 7) : 0));
|
||||
TrackSector::saveState(buffer);
|
||||
@ -917,7 +917,8 @@ void RubberBall::restoreState(BareNetworkString *buffer, int count)
|
||||
{
|
||||
Flyable::restoreState(buffer, count);
|
||||
m_restoring_state = true;
|
||||
m_last_aimed_graph_node = buffer->getUInt32();
|
||||
int16_t last_aimed_graph_node = buffer->getUInt16();
|
||||
m_last_aimed_graph_node = last_aimed_graph_node;
|
||||
m_control_points[0] = buffer->getVec3();
|
||||
m_control_points[1] = buffer->getVec3();
|
||||
m_control_points[2] = buffer->getVec3();
|
||||
@ -930,7 +931,7 @@ void RubberBall::restoreState(BareNetworkString *buffer, int count)
|
||||
m_t_increase = buffer->getFloat();
|
||||
m_interval = buffer->getFloat();
|
||||
m_height_timer = buffer->getFloat();
|
||||
m_delete_ticks = buffer->getUInt32();
|
||||
m_delete_ticks = buffer->getUInt16();
|
||||
m_current_max_height = buffer->getFloat();
|
||||
uint8_t tunnel_and_aiming = buffer->getUInt8();
|
||||
m_tunnel_count = tunnel_and_aiming & 127;
|
||||
|
@ -80,7 +80,7 @@ private:
|
||||
/** If the ball overtakes its target or starts to aim at the kart which
|
||||
* originally shot the rubber ball, after this amount of time the
|
||||
* ball will be deleted. */
|
||||
static int m_st_delete_ticks;
|
||||
static int16_t m_st_delete_ticks;
|
||||
|
||||
/** If the ball is closer to its target than min_offset_distance, the speed
|
||||
* in addition to the difficulty's default max speed. */
|
||||
@ -158,10 +158,6 @@ private:
|
||||
/** How long it takes from one bounce of the ball to the next. */
|
||||
float m_interval;
|
||||
|
||||
/** This flag is set if the target is within the fast ping distance. It
|
||||
* will cause the rubber ball to decrese the jump height and intervall. */
|
||||
bool m_fast_ping;
|
||||
|
||||
/** Distance to target. This is measured in terms of 'distance along
|
||||
* track', but also takes the 3d distance and height difference into
|
||||
* account (in case that the target is on a different part of the
|
||||
@ -172,15 +168,24 @@ private:
|
||||
* It is always between 0 and m_interval. */
|
||||
float m_height_timer;
|
||||
|
||||
/** The current maximum height of the ball. This value will be
|
||||
* reduced if the ball gets closer to the target. */
|
||||
float m_current_max_height;
|
||||
|
||||
/** If the ball overtakes its target or starts to aim at the kart which
|
||||
* originally shot the rubber ball, after a certain amount of time the
|
||||
* ball will be deleted. This timer tracks this time. If it is < 0
|
||||
* it indicates that the ball is targeting another kart atm. */
|
||||
int m_delete_ticks;
|
||||
int16_t m_delete_ticks;
|
||||
|
||||
/** The current maximum height of the ball. This value will be
|
||||
* reduced if the ball gets closer to the target. */
|
||||
float m_current_max_height;
|
||||
/** This variable counts how often a ball tunneled (in consecutive
|
||||
* frames). If a ball tunnels a certain number of times, it is
|
||||
* considered stuck and will be removed. */
|
||||
uint8_t m_tunnel_count;
|
||||
|
||||
/** This flag is set if the target is within the fast ping distance. It
|
||||
* will cause the rubber ball to decrese the jump height and intervall. */
|
||||
bool m_fast_ping;
|
||||
|
||||
/** Once the ball is close enough, it will aim for the kart. If the
|
||||
* kart should be able to then increase the distance to the ball,
|
||||
@ -188,11 +193,6 @@ private:
|
||||
* used to keep track of the state of this ball. */
|
||||
bool m_aiming_at_target;
|
||||
|
||||
/** This variable counts how often a ball tunneled (in consecutive
|
||||
* frames). If a ball tunnels a certain number of times, it is
|
||||
* considered stuck and will be removed. */
|
||||
uint8_t m_tunnel_count;
|
||||
|
||||
/** A 'ping' sound effect to be played when the ball hits the ground. */
|
||||
SFXBase *m_ping_sfx;
|
||||
|
||||
|
@ -177,23 +177,18 @@ float TrackSector::getRelativeDistanceToCenter() const
|
||||
} // getRelativeDistanceToCenter
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
/** Only basket ball is used for rewind for TrackSector so save the minimum.
|
||||
*/
|
||||
void TrackSector::saveState(BareNetworkString* buffer) const
|
||||
{
|
||||
buffer->addUInt32(m_current_graph_node);
|
||||
buffer->addUInt32(m_last_valid_graph_node);
|
||||
buffer->add(m_current_track_coords);
|
||||
buffer->add(m_latest_valid_track_coords);
|
||||
buffer->addUInt8(m_on_road ? 1 : 0);
|
||||
buffer->addUInt32(m_last_triggered_checkline);
|
||||
buffer->addUInt16((int16_t)m_current_graph_node);
|
||||
buffer->addFloat(m_current_track_coords.getZ());
|
||||
} // saveState
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
void TrackSector::rewindTo(BareNetworkString* buffer)
|
||||
{
|
||||
m_current_graph_node = buffer->getUInt32();
|
||||
m_last_valid_graph_node = buffer->getUInt32();
|
||||
m_current_track_coords = buffer->getVec3();
|
||||
m_latest_valid_track_coords = buffer->getVec3();
|
||||
m_on_road = buffer->getUInt8() == 1;
|
||||
m_last_triggered_checkline = buffer->getUInt32();
|
||||
int16_t node = buffer->getUInt16();
|
||||
m_current_graph_node = node;
|
||||
m_current_track_coords.setZ(buffer->getFloat());
|
||||
} // rewindTo
|
||||
|
Loading…
Reference in New Issue
Block a user