diff --git a/CHANGELOG.md b/CHANGELOG.md index c38dc125..ddb7be2a 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,16 @@ +## [4.0.0-alpha.224](https://github.com/godot-escoria/escoria-demo-game/compare/v0.0.0...v4.0.0-alpha.224) (2022-10-31) + + +### Bug Fixes + +* camera_push now validates against camera_node like ESCCamera. ([3009fe1](https://github.com/godot-escoria/escoria-demo-game/commit/3009fe1242a83f18a6f8a7c8daa9ce9f679056e2)) +* cleaning up and updating validation code. ([e807044](https://github.com/godot-escoria/escoria-demo-game/commit/e807044e45d75548858b671e85faa6ea6209d2ec)) +* room 7 lift interaction fixed based on new camera behavior. ([1657c0d](https://github.com/godot-escoria/escoria-demo-game/commit/1657c0d452757b786ec60de32a424e9d7a2555bc)) +* updates camera limit checking in commands to respect viewport limits (i.e. taking into account camera centre and half-screen limits); also updates warning message and no longer fails on limit violation. ([d95d26f](https://github.com/godot-escoria/escoria-demo-game/commit/d95d26ff5fb00030c4d8a06ea95f7b040e2f2bc2)) +* Updates those camera commands that make use of translation to compensate for drag margins. ([cc74206](https://github.com/godot-escoria/escoria-demo-game/commit/cc74206e6c1877d50ab29f3febd65f533620cfd5)) + + + ## [4.0.0-alpha.223](https://github.com/godot-escoria/escoria-demo-game/compare/v0.0.0...v4.0.0-alpha.223) (2022-10-31) diff --git a/addons/escoria-core/game/core-scripts/esc/types/esc_camera_base_command.gd b/addons/escoria-core/game/core-scripts/esc/types/esc_camera_base_command.gd index 2e63f704..a5869f57 100644 --- a/addons/escoria-core/game/core-scripts/esc/types/esc_camera_base_command.gd +++ b/addons/escoria-core/game/core-scripts/esc/types/esc_camera_base_command.gd @@ -12,10 +12,10 @@ func generate_viewport_warning(pos: Vector2, camera: ESCCamera) -> void: var camera_limit: Rect2 = camera.get_camera_limit_rect() var message: String = \ """ - [%s]: Invalid camera position. Camera cannot be moved to %s as this is outside the viewport with current camera limit %s. + [%s]: Invalid camera position. Camera cannot be moved to %s as this is outside the viewport with current camera limit %s. Current valid ranges for positions are: x = %s inclusive; y = %s inclusive. """ - + escoria.logger.warn( self, message diff --git a/addons/escoria-core/game/scenes/camera_player/esc_camera.gd b/addons/escoria-core/game/scenes/camera_player/esc_camera.gd index 81f5a1d7..53519e5c 100644 --- a/addons/escoria-core/game/scenes/camera_player/esc_camera.gd +++ b/addons/escoria-core/game/scenes/camera_player/esc_camera.gd @@ -1,7 +1,7 @@ # Camera handling extends Camera2D class_name ESCCamera - + # Reference to the tween node for animating camera movements var _tween: Tween @@ -112,7 +112,7 @@ func set_target(p_target, p_time : float = 0.0): self, "Current camera position = %s." % str(self.global_position) ) - + if p_time == 0.0: self.global_position = _target else: @@ -239,7 +239,7 @@ func push(p_target, p_time: float = 0.0, p_type: int = 0): set_drag_margin_enabled(false, false) _convert_current_global_pos_for_disabled_drag_margin() - + _tween.interpolate_property( self, "global_position", @@ -327,7 +327,7 @@ func check_point_is_inside_viewport_limits(point: Vector2) -> bool: # **Returns** the inclusive minimum and maximum values for the x-component of the current valid viewport. func get_current_valid_viewport_values_x() -> Array: var viewport_rect: Rect2 = get_viewport_rect() - + return [limit_left + viewport_rect.size.x * 0.5, limit_right - viewport_rect.size.x * 0.5] @@ -337,7 +337,7 @@ func get_current_valid_viewport_values_x() -> Array: # **Returns* the inclusive minimum and maximum values for the y-component of the current valid viewport. func get_current_valid_viewport_values_y() -> Array: var viewport_rect: Rect2 = get_viewport_rect() - + return [limit_top + viewport_rect.size.y * 0.5, limit_bottom - viewport_rect.size.y * 0.5] @@ -353,20 +353,20 @@ func get_camera_limit_rect() -> Rect2: # the camera limits. func clamp_to_viewport_limits() -> void: var viewport_rect: Rect2 = get_viewport_rect() - + var cur_camera_pos: Vector2 = self.get_camera_screen_center() var ret_position: Vector2 = cur_camera_pos - + if cur_camera_pos.x - viewport_rect.size.x * 0.5 * zoom.x <= limit_left: ret_position.x = limit_left + viewport_rect.size.x * 0.5 * zoom.x * (1 + drag_margin_left) elif cur_camera_pos.x + viewport_rect.size.x * 0.5 * zoom.x >= limit_right: ret_position.x = limit_right - viewport_rect.size.x * 0.5 * zoom.x * (1 + drag_margin_right) - + if cur_camera_pos.y - viewport_rect.size.y * 0.5 * zoom.y <= limit_top: ret_position.y = limit_top + viewport_rect.size.y * 0.5 * zoom.y * (1 + drag_margin_top) elif cur_camera_pos.y + viewport_rect.size.y * 0.5 * zoom.y >= limit_bottom: ret_position.y = limit_bottom - viewport_rect.size.y * 0.5 * zoom.y * (1 + drag_margin_bottom) - + self.global_position = ret_position @@ -405,7 +405,7 @@ func _convert_current_global_pos_for_disabled_drag_margin() -> void: func _convert_pos_for_disabled_drag_margin(pos: Vector2) -> Vector2: var viewport_rect: Rect2 = get_viewport_rect() var ret_position: Vector2 = pos - + # If the current calculated centre of the camera/viewport is close enough to the set camera # limits (i.e. the centre is upto and including half the viewport's size to the limit being # tested), then we make sure the global_position is at the same coordinates since Camera2D will @@ -418,7 +418,7 @@ func _convert_pos_for_disabled_drag_margin(pos: Vector2) -> Vector2: ret_position.x = limit_left + viewport_rect.size.x * 0.5 * zoom.x elif ret_position.x + viewport_rect.size.x * 0.5 * zoom.x >= limit_right: ret_position.x = limit_right - viewport_rect.size.x * 0.5 * zoom.x - + if ret_position.y - viewport_rect.size.y * 0.5 * zoom.y <= limit_top: ret_position.y = limit_top + viewport_rect.size.y * 0.5 * zoom.y elif ret_position.y + viewport_rect.size.y * 0.5 * zoom.y >= limit_bottom: diff --git a/addons/escoria-wizard/CharacterCreator.gd b/addons/escoria-wizard/CharacterCreator.gd index f658dc48..3ab63771 100644 --- a/addons/escoria-wizard/CharacterCreator.gd +++ b/addons/escoria-wizard/CharacterCreator.gd @@ -1342,9 +1342,9 @@ func export_generate_animations(character_node, num_directions) -> void: var current_ticks = OS.get_ticks_msec() if current_ticks - display_refresh_timer > 30: yield(get_tree(), "idle_frame") - + display_refresh_timer = current_ticks - + if num_directions == 4: progress_bar_update("Processing "+str(animtype)+" "+str(anim_dir),2) else: