Vinifera
Vinifera copied to clipboard
[Vanilla Bug] Centering Camera on Waypoint or Team does not un-follow camera-followed unit
First Check
- [X] I added a very descriptive title to this issue.
- [X] I used the GitHub search to find a similar issue and didn't find it.
- [X] I have attached as much information as possible (screenshots, debug and exception logs, etc).
Description
You can tell the camera to follow a selected unit by pressing the "Follow" keyboard command (IIRC the default is F).
Missions often use the "Center Camera on Waypoint" trigger action (action #48) to center the camera on a waypoint. This works properly otherwise, but if the camera is following a unit, these mechanisms clash in a bad way, with the camera moving to the waypoint, and then instantly teleporting back to the unit.
Required Code (optional)
No response
Steps To Reproduce
Create a map that has
- a trigger that uses the "Center Camera on Waypoint" action and a simple event, for example "Elapsed time" with 30 as the parameter
- a unit that is owned by the player
Start the map, tell the unit to move somewhere and press F to have the camera follow the unit.
Expected Behaviour
When the trigger is executed, the camera should move to the specified waypoint and stay there.
Actual Behaviour
When the trigger is executed, the camera moves to the specified waypoint and then instantly jumps back to the followed unit.
Additional Context
The function at 0x0060F800
is used for making the camera smoothly move to a specific location. It is used by trigger action no. 48 as well as the "Center On Team" team script action. The function should at some point make a Map.Follow_This(nullptr);
call to clear the camera's unit following status.
For example, the following code seems to fix this:
/**
* #issue-1050
*
* Fixes a bug where the camera keeps following a followed object
* when a trigger or script tells it to center on a waypoint
* or a team.
*
* @author: Rampastring
*/
DECLARE_PATCH(_Tactical_Center_On_Location_Unfollow_Object_Patch)
{
Map.Follow_This(nullptr);
// Rebuild function epilogue
_asm { pop edi }
_asm { pop esi }
_asm { pop ebp }
_asm { pop ebx }
_asm { add esp, 8 }
_asm { retn 8 }
}
Patch_Jump(0x0060F953, &_Tactical_Center_On_Location_Unfollow_Object_Patch);