mirror of
https://github.com/panda3d/panda3d.git
synced 2025-10-17 20:23:47 -04:00
added legacy mode for Toontown, only throws events for floor that Toon is standing on
This commit is contained in:
parent
5201b9bfcd
commit
9531a23ef1
@ -200,3 +200,27 @@ INLINE float CollisionHandlerGravity::
|
|||||||
get_max_velocity() const {
|
get_max_velocity() const {
|
||||||
return _max_velocity;
|
return _max_velocity;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
////////////////////////////////////////////////////////////////////
|
||||||
|
// Function: CollisionHandlerGravity::set_legacy_mode
|
||||||
|
// Access: Public
|
||||||
|
// Description: Enables old behavior required by Toontown
|
||||||
|
// (Sellbot Factory lava room is good test case,
|
||||||
|
// lava and conveyor belt specifically). Behavior
|
||||||
|
// is to throw enter/exit events only for floor
|
||||||
|
// that the toon is in contact with
|
||||||
|
////////////////////////////////////////////////////////////////////
|
||||||
|
INLINE void CollisionHandlerGravity::
|
||||||
|
set_legacy_mode(bool legacy_mode) {
|
||||||
|
_legacy_mode = legacy_mode;
|
||||||
|
}
|
||||||
|
|
||||||
|
////////////////////////////////////////////////////////////////////
|
||||||
|
// Function: CollisionHandlerGravity::get_legacy_mode
|
||||||
|
// Access: Public
|
||||||
|
// Description: returns true if legacy mode is enabled
|
||||||
|
////////////////////////////////////////////////////////////////////
|
||||||
|
INLINE bool CollisionHandlerGravity::
|
||||||
|
get_legacy_mode() const {
|
||||||
|
return _legacy_mode;
|
||||||
|
}
|
||||||
|
@ -100,11 +100,13 @@ set_highest_collision(const NodePath &target_node_path, const NodePath &from_nod
|
|||||||
cout<<endl;
|
cout<<endl;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
// We only collide with things we are impacting with.
|
if (_legacy_mode) {
|
||||||
// Remove the collisions:
|
// We only collide with things we are impacting with.
|
||||||
//_current_colliding.clear();
|
// Remove the collisions:
|
||||||
// Add only the one that we're impacting with:
|
_current_colliding.clear();
|
||||||
// add_entry(highest);
|
// Add only the one that we're impacting with:
|
||||||
|
add_entry(highest);
|
||||||
|
}
|
||||||
|
|
||||||
return max_height;
|
return max_height;
|
||||||
}
|
}
|
||||||
@ -177,8 +179,12 @@ set_highest_collision(const NodePath &target_node_path, const NodePath &from_nod
|
|||||||
// We only collide with things we are impacting with.
|
// We only collide with things we are impacting with.
|
||||||
// Remove the collisions:
|
// Remove the collisions:
|
||||||
_current_colliding.clear();
|
_current_colliding.clear();
|
||||||
// Add only the one that we're impacting with:
|
if (_legacy_mode) {
|
||||||
_current_colliding.insert(valid_entries.begin(), valid_entries.end());
|
// Add only the one that we're impacting with:
|
||||||
|
add_entry(highest);
|
||||||
|
} else {
|
||||||
|
_current_colliding.insert(valid_entries.begin(), valid_entries.end());
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
// Set the contact normal so that other code can make use of the
|
// Set the contact normal so that other code can make use of the
|
||||||
@ -275,14 +281,10 @@ handle_entries() {
|
|||||||
_impact_velocity = _current_velocity;
|
_impact_velocity = _current_velocity;
|
||||||
// These values are used by is_on_ground().
|
// These values are used by is_on_ground().
|
||||||
_current_velocity = _airborne_height = 0.0f;
|
_current_velocity = _airborne_height = 0.0f;
|
||||||
}
|
} else if (_legacy_mode) {
|
||||||
/* //ZAC - Commented out, until someone can give me a good reason why we
|
|
||||||
//need such wierd behaviour
|
|
||||||
} else {
|
|
||||||
// ...we're airborne.
|
// ...we're airborne.
|
||||||
_current_colliding.clear();
|
_current_colliding.clear();
|
||||||
}
|
}
|
||||||
*/
|
|
||||||
|
|
||||||
CPT(TransformState) trans = def._target.get_transform();
|
CPT(TransformState) trans = def._target.get_transform();
|
||||||
LVecBase3f pos = trans->get_pos();
|
LVecBase3f pos = trans->get_pos();
|
||||||
|
@ -54,6 +54,9 @@ PUBLISHED:
|
|||||||
INLINE void set_max_velocity(float max_vel);
|
INLINE void set_max_velocity(float max_vel);
|
||||||
INLINE float get_max_velocity() const;
|
INLINE float get_max_velocity() const;
|
||||||
|
|
||||||
|
INLINE void set_legacy_mode(bool legacy_mode);
|
||||||
|
INLINE bool get_legacy_mode() const;
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
float set_highest_collision(const NodePath &target_node_path, const NodePath &from_node_path, const Entries &entries);
|
float set_highest_collision(const NodePath &target_node_path, const NodePath &from_node_path, const Entries &entries);
|
||||||
virtual bool handle_entries();
|
virtual bool handle_entries();
|
||||||
@ -68,6 +71,7 @@ private:
|
|||||||
float _current_velocity;
|
float _current_velocity;
|
||||||
float _max_velocity;
|
float _max_velocity;
|
||||||
LVector3f _contact_normal;
|
LVector3f _contact_normal;
|
||||||
|
bool _legacy_mode;
|
||||||
|
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
Loading…
x
Reference in New Issue
Block a user