SuperHackio / GalaxyLevelEngine

A new Level Engine for Super Mario Galaxy 2. Featuring a hubworld system replacing the worldmap, 8 stars per galaxy, and more!
56 stars 3 forks source link

QuickWarpArea Cameras #127

Closed SuperHackio closed 10 months ago

SuperHackio commented 10 months ago

QuickWarpAreas really need cameras that are used for the warping process (just like how pipes work)

Pipes do this with an ActorCameraInfo so I need to get one of these in here (presumably).

There's just one problem -- The "Area" object type does NOT have CameraSetId as a field. Will need to figure out an alternative somehow... (maybe link Camera ID to Destination Position?)

chendeni commented 10 months ago

Does QuickWarpArea have the same options of screen wipe similar to SceneChangeArea? GeneralPos does not support Camera ID, so is it better to use a custom object for destination position instead similar to PetitPorterWarpPoint?

SuperHackio commented 10 months ago

Does QuickWarpArea have the same options of screen wipe similar to SceneChangeArea?

Yes, ObjArg2 is the Closing Wipe type for both the QuickWarpArea and SceneChangeArea.

I do not think that a new object is needed in order to do the camera. I think that I will add another bitflag to QuickWarpArea ObjArg6 that toggles camera. Still debating if the default should be "Use Camera" or "No Camera" though...

chendeni commented 10 months ago

I think defaulting to "No Camera" would be better since you don't need to worry about the game crashing if the camera has not been set up yet. How will it support having different cameras for each QuickWarpArea without using Camera ID?

SuperHackio commented 10 months ago

Thank you for your input.

I have added the feature now, here's how it works:

First, you need to Enable Cameras by setting bit 3 in ObjArg6 to 1. The table below simplifies what this means by giving fixed values, but the ObjArg is now treated as a bitfield by the code.

Value Description
-1 / 0 No special options enabled
1 Display the LoadIcon
2 Clear the players powerup
3 Display the LoadIcon AND Clear the players powerup
4 Enable Cameras
5 Enable Cameras AND Display the LoadIcon
6 Enable Cameras AND Clear the players powerup
7 Enable Cameras AND Display the LoadIcon, AND Clear the players powerup

Once Cameras are enabled, you can create a camera for each General Position that the QuickWarpArea can take you to (meaning the Range Operator is supported)

Each GeneralPos can only have 1 camera tied to it, but multiple QuickWarpArea instances can reference it. The Camera ID format is the same as the GeneralPos name format.

It's worth noting that Cameras will not work properly if a QuickWarpArea's ObjArg1 is set to 0. The game simply doesn't have enough time to process the camera if ObjArg1 is set to 0.

Note: If a camera is not present for the General Position, IF cameras are enabled, a default one will be used (this is provided by the game itself, I did not explicitly make a default). This applies to General Positions that are used with the Range Operator.
It is recommended to give all General Positions that are used by the Range Operator a camera.
There is no way to disable a camera for specific positions within the Range Operator.

Example:

A General Position with name QuickWarpPos69 will use Camera ID e:QuickWarpPos69.
Any QuickWarpArea that has cameras enabled and uses QuickWarpPos69 will use e:QuickWarpPos69.
You will also need to set the Event Length (evfrm) to something greater than 0 in order for the camera to work properly.

Note: It is recommended to set the CamInt value in the camera data to 0 so that it jumps to the desired position instantly. You may also need to set the eflag.enableErpFrame value to 1,