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_squash_slowdown;
|
||||||
float RubberBall::m_st_target_distance;
|
float RubberBall::m_st_target_distance;
|
||||||
float RubberBall::m_st_target_max_angle;
|
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_max_height_difference;
|
||||||
float RubberBall::m_st_fast_ping_distance;
|
float RubberBall::m_st_fast_ping_distance;
|
||||||
float RubberBall::m_st_early_target_factor;
|
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_min_interpolation_distance = 30.0f;
|
||||||
m_st_target_distance = 50.0f;
|
m_st_target_distance = 50.0f;
|
||||||
m_st_target_max_angle = 25.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_max_height_difference = 10.0f;
|
||||||
m_st_fast_ping_distance = 50.0f;
|
m_st_fast_ping_distance = 50.0f;
|
||||||
m_st_early_target_factor = 1.0f;
|
m_st_early_target_factor = 1.0f;
|
||||||
@ -892,7 +892,7 @@ BareNetworkString* RubberBall::saveState(std::vector<std::string>* ru)
|
|||||||
if (!buffer)
|
if (!buffer)
|
||||||
return NULL;
|
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[0]);
|
||||||
buffer->add(m_control_points[1]);
|
buffer->add(m_control_points[1]);
|
||||||
buffer->add(m_control_points[2]);
|
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_t_increase);
|
||||||
buffer->addFloat(m_interval);
|
buffer->addFloat(m_interval);
|
||||||
buffer->addFloat(m_height_timer);
|
buffer->addFloat(m_height_timer);
|
||||||
buffer->addUInt32(m_delete_ticks);
|
buffer->addUInt16(m_delete_ticks);
|
||||||
buffer->addFloat(m_current_max_height);
|
buffer->addFloat(m_current_max_height);
|
||||||
buffer->addUInt8(m_tunnel_count | (m_aiming_at_target ? (1 << 7) : 0));
|
buffer->addUInt8(m_tunnel_count | (m_aiming_at_target ? (1 << 7) : 0));
|
||||||
TrackSector::saveState(buffer);
|
TrackSector::saveState(buffer);
|
||||||
@ -917,7 +917,8 @@ void RubberBall::restoreState(BareNetworkString *buffer, int count)
|
|||||||
{
|
{
|
||||||
Flyable::restoreState(buffer, count);
|
Flyable::restoreState(buffer, count);
|
||||||
m_restoring_state = true;
|
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[0] = buffer->getVec3();
|
||||||
m_control_points[1] = buffer->getVec3();
|
m_control_points[1] = buffer->getVec3();
|
||||||
m_control_points[2] = 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_t_increase = buffer->getFloat();
|
||||||
m_interval = buffer->getFloat();
|
m_interval = buffer->getFloat();
|
||||||
m_height_timer = buffer->getFloat();
|
m_height_timer = buffer->getFloat();
|
||||||
m_delete_ticks = buffer->getUInt32();
|
m_delete_ticks = buffer->getUInt16();
|
||||||
m_current_max_height = buffer->getFloat();
|
m_current_max_height = buffer->getFloat();
|
||||||
uint8_t tunnel_and_aiming = buffer->getUInt8();
|
uint8_t tunnel_and_aiming = buffer->getUInt8();
|
||||||
m_tunnel_count = tunnel_and_aiming & 127;
|
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
|
/** 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
|
* originally shot the rubber ball, after this amount of time the
|
||||||
* ball will be deleted. */
|
* 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
|
/** If the ball is closer to its target than min_offset_distance, the speed
|
||||||
* in addition to the difficulty's default max 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. */
|
/** How long it takes from one bounce of the ball to the next. */
|
||||||
float m_interval;
|
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
|
/** Distance to target. This is measured in terms of 'distance along
|
||||||
* track', but also takes the 3d distance and height difference into
|
* track', but also takes the 3d distance and height difference into
|
||||||
* account (in case that the target is on a different part of the
|
* 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. */
|
* It is always between 0 and m_interval. */
|
||||||
float m_height_timer;
|
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
|
/** 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
|
* 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
|
* ball will be deleted. This timer tracks this time. If it is < 0
|
||||||
* it indicates that the ball is targeting another kart atm. */
|
* 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
|
/** This variable counts how often a ball tunneled (in consecutive
|
||||||
* reduced if the ball gets closer to the target. */
|
* frames). If a ball tunnels a certain number of times, it is
|
||||||
float m_current_max_height;
|
* 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
|
/** 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,
|
* 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. */
|
* used to keep track of the state of this ball. */
|
||||||
bool m_aiming_at_target;
|
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. */
|
/** A 'ping' sound effect to be played when the ball hits the ground. */
|
||||||
SFXBase *m_ping_sfx;
|
SFXBase *m_ping_sfx;
|
||||||
|
|
||||||
|
@ -177,23 +177,18 @@ float TrackSector::getRelativeDistanceToCenter() const
|
|||||||
} // getRelativeDistanceToCenter
|
} // getRelativeDistanceToCenter
|
||||||
|
|
||||||
// ----------------------------------------------------------------------------
|
// ----------------------------------------------------------------------------
|
||||||
|
/** Only basket ball is used for rewind for TrackSector so save the minimum.
|
||||||
|
*/
|
||||||
void TrackSector::saveState(BareNetworkString* buffer) const
|
void TrackSector::saveState(BareNetworkString* buffer) const
|
||||||
{
|
{
|
||||||
buffer->addUInt32(m_current_graph_node);
|
buffer->addUInt16((int16_t)m_current_graph_node);
|
||||||
buffer->addUInt32(m_last_valid_graph_node);
|
buffer->addFloat(m_current_track_coords.getZ());
|
||||||
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);
|
|
||||||
} // saveState
|
} // saveState
|
||||||
|
|
||||||
// ----------------------------------------------------------------------------
|
// ----------------------------------------------------------------------------
|
||||||
void TrackSector::rewindTo(BareNetworkString* buffer)
|
void TrackSector::rewindTo(BareNetworkString* buffer)
|
||||||
{
|
{
|
||||||
m_current_graph_node = buffer->getUInt32();
|
int16_t node = buffer->getUInt16();
|
||||||
m_last_valid_graph_node = buffer->getUInt32();
|
m_current_graph_node = node;
|
||||||
m_current_track_coords = buffer->getVec3();
|
m_current_track_coords.setZ(buffer->getFloat());
|
||||||
m_latest_valid_track_coords = buffer->getVec3();
|
|
||||||
m_on_road = buffer->getUInt8() == 1;
|
|
||||||
m_last_triggered_checkline = buffer->getUInt32();
|
|
||||||
} // rewindTo
|
} // rewindTo
|
||||||
|
Loading…
x
Reference in New Issue
Block a user