Skip to content

Expand Haven zoom while preserving road surface detail - #319

Merged
netniV merged 5 commits into
STFC-Mod:devfrom
Guffawaffle:feature/haven-expanded-zoom-roads
Oct 9, 2026
Merged

netniV merged 5 commits into
STFC-Mod:devfrom
Guffawaffle:feature/haven-expanded-zoom-roads

Conversation

@Guffawaffle

@Guffawaffle Guffawaffle commented Oct 6, 2026 •

Copy link
Copy Markdown
Contributor

Haven's native zoom-out range makes it difficult to see larger layouts. Extend the camera's fresh output along its existing direction while preserving native input, panning and close-range selection. A small depth bias on the known Haven asphalt materials keeps road surface detail visible across the expanded range.

  • [graphics].haven_zoom sets the maximum camera distance: default 4000.0, or 0.0 for native behavior.
  • [patches].havenzoomhooks independently controls hook installation and defaults to true; it is separate from the ordinary zoomhooks switch.

Validation: Windows mods and release DLL builds, English example TOML parsing, and git diff --check passed. The camera and road implementation passed Windows player testing at 6000 with full-out panning, roads, close-range selection and leave/reopen.

Comment thread mods/src/patches/parts/haven_zoom.cc Outdated
Comment on lines +33 to +40
FieldInfo *HavenField(Il2CppClass *cls, const char *name, const char *type)
{
auto *field = cls != nullptr ? il2cpp_class_get_field_from_name(cls, name) : nullptr;
return field != nullptr && !(il2cpp_field_get_flags(field) & FIELD_ATTRIBUTE_STATIC)
&& method_contract::Type(field->type, type)
? field
: nullptr;
}

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why is this haven specific? We seem to be creating lots of little helpers all over the place doing unique things which leads to confusion as to which method to use. and some feel like duplicates.

Comment thread mods/src/patches/parts/haven_zoom.cc Outdated
Comment on lines +52 to +57
template <typename T> T ReadHavenField(Il2CppObject *object, FieldInfo *field)
{
T value{};
il2cpp_field_get_value(object, field, &value);
return value;
}

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Another duplicated mehtod I'm sure.

Comment thread mods/src/patches/parts/haven_zoom.cc Outdated
Comment on lines +228 to +238
for (auto *field :
{blend_source, blend_target, blend_curve, blend_minimum, blend_maximum,
blend_ratio, provider_pivot, provider_look_target, blend_source_frame, blend_target_frame,
blend_result_frame, provider_constraint, provider_radius, constraint_radius, radius_enabled,
radius_minimum, radius_maximum, frame_position, frame_rotation, frame_fov,
frame_far_clip, frame_orthographic}) {
if (field == nullptr) {
spdlog::warn("[HavenZoom] camera fields unavailable; keeping native zoom range");
return;
}
}

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Whilst this reduces duplicated code, it doesn't tell us what actually failed.

@Guffawaffle

Copy link
Copy Markdown
Contributor Author

This is partly my coding style: when a broadly used helper doesn't quite provide the behavior I need, I've tended to keep that logic local rather than change its existing behavior.

Here, the intent is to detect incompatible game-field changes and disable the affected feature gracefully, reducing the risk of taking down the game. But I understand the concern about accumulating similar helpers. I'm looking at whether we can extend the existing helper while preserving its current callers.

I've been working to apply this feedback, though clearly I still need to be more consistent. I also agree that the failure diagnostics should identify the specific field or contract that failed.

@Guffawaffle
Guffawaffle requested a review from netniV October 9, 2026 00:18
@netniV
netniV merged commit 16f8a7e into STFC-Mod:dev Oct 9, 2026
6 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants