Permalink
Browse files

fixes to dungeon platforms

  • Loading branch information...
1 parent 12d8b1f commit 83221ba4bba0fdff100c16470f1218bf5f45c406 @davewx7 davewx7 committed May 2, 2012
View
4 data/objects/enemies/milgram-hazards/trap_door.cfg
@@ -66,11 +66,11 @@ object_type: [
zorder: -1,
platform_area: [0,23,54,24],
on_create: "[fire_event('solidify')]",
- on_falldown: "[animation('falling'),set(platform_area, [0,0,0,0])]",
+ on_falldown: "[animation('falling'),set(platform_area, [])]",
on_process_falling: "if(abs(rotate) < 90, add(rotate, facing*time_in_animation*20), set(rotate, 90*facing))",
on_rise: "animation('rising')",
on_process_rising: "if(abs(rotate) > 0, add(rotate, -1*facing), fire_event('solidify'))",
- on_solidify: "[set(rotate, 0),set(platform_area, [0,23,54,24]), animation('walkable')]",
+ on_solidify: "[set(rotate, 0),set(platform_area, null), animation('walkable')]",
animation: [
#no_remove_alpha_borders="props/trap-door.png"
View
6 data/objects/props-interactive/platforms/dungeon_platform_stationary_rotating_5wide.cfg
@@ -8,11 +8,11 @@ on_create: "[fire_event('still'),spawn('dungeon_platform_stationary_rotating_5wi
on_process_turning: "if(time_in_animation > 20,fire_event('still'),add(rotate,4.5))",
on_still: "[ set(animation,'normal'),
schedule(if(safe_to_stand,vars.delay_standable,vars.delay_unstandable), fire_event('tilt')),
- if(safe_to_stand, [set(platform_area, [0,0,80,1])])
+ if(safe_to_stand, [set(platform_area, null)])
]",
#deliberate 2 frame grace period.
-on_tilt: "[animation('turning'),schedule(2,set(platform_area, [0,0,1,1]))]",
+on_tilt: "[animation('turning'),schedule(2,set(platform_area, []))]",
#prototype=platform
editor_info: {
@@ -60,4 +60,4 @@ object_type: {
h: 32,
},
},
-}
+}
View
4 src/custom_object.cpp
@@ -2917,8 +2917,12 @@ void custom_object::set_value_by_slot(int slot, const variant& value)
case CUSTOM_OBJECT_PLATFORM_AREA: {
if(value.is_null()) {
platform_area_.reset();
+ platform_solid_info_ = const_solid_info_ptr();
calculate_solid_rect();
break;
+ } else if(value.is_list() && value.num_elements() == 0) {
+ set_platform_area(rect());
+ break;
}
ASSERT_GE(value.num_elements(), 3);
View
2 src/custom_object_type.cpp
@@ -534,7 +534,7 @@ custom_object_type::custom_object_type(variant node, const custom_object_type* b
has_solid_(solid_ || use_image_for_collisions_),
solid_dimensions_(has_solid_ || platform_ ? 0xFFFFFFFF : 0),
collide_dimensions_(0xFFFFFFFF),
- weak_solid_dimensions_(has_solid_ || platform_ ? 0xFFFFFFFF : 0),
+ weak_solid_dimensions_(has_solid_ || platform_ || node["has_platform"].as_bool(false) ? 0xFFFFFFFF : 0),
weak_collide_dimensions_(0xFFFFFFFF),
activation_border_(node["activation_border"].as_int(100)),
editor_force_standing_(node["editor_force_standing"].as_bool(false)),
View
3 src/entity.cpp
@@ -95,7 +95,7 @@ void entity::set_platform_motion_x(int value)
int entity::map_platform_pos(int xpos) const
{
- if(xpos >= prev_platform_rect_.x() && xpos < prev_platform_rect_.x() + prev_platform_rect_.w()) {
+ if(platform_rect_.w() > 0 && platform_rect_.h() > 0 && xpos >= prev_platform_rect_.x() && xpos < prev_platform_rect_.x() + prev_platform_rect_.w()) {
const int proportion = xpos - prev_platform_rect_.x();
int maps_to = (1024*proportion*platform_rect_.w())/prev_platform_rect_.w();
if(maps_to%1024 >= 512) {
@@ -104,6 +104,7 @@ int entity::map_platform_pos(int xpos) const
maps_to = platform_rect_.x() + maps_to/1024;
}
+
return maps_to - xpos - (feet_x() - prev_feet_x_);
}

0 comments on commit 83221ba

Please sign in to comment.