CookiePLMonster / SilentPatch

SilentPatch for GTA III, Vice City, and San Andreas
MIT License
382 stars 15 forks source link

SA: Let's get back to the interior of the Hunter #67

Open B1ack-Wh1te opened 2 weeks ago

B1ack-Wh1te commented 2 weeks ago

Your fix for returning the alpha of the blades along with the Hunter interior fix breaks it if the transparent blades end up above the cockpit. image You don't actually need to start a separate callback for rendering the interior of the hunter. Fixing it is much simpler - you just need to disable the flag at the door atomic:

CVisibilityPlugins::ClearAtomicFlag(pAtomic, VEHICLE_ATOMIC_LEFT);

Because of this CVisibilityPlugins::GetDotProductWithCameraVector will return a different value and the interior of the hunter will always be visible, since it no longer considers the left door.

But, it still doesn't fix things like. Bullet's rear window that stops showing the engine at a certain camera rotation: image

Blista Compact's rear window at a certain camera rotation: Снимок экрана 2024-11-03 033535

And other such vehicles problems.

CookiePLMonster commented 2 weeks ago

You don't actually need to start a separate callback for rendering the interior of the hunter. Fixing it is much simpler - you just need to disable the flag at the door atomic:

Do you know if this is how Hydra does it? As I remember Hydra was unaffected.

B1ack-Wh1te commented 2 weeks ago

Do you know if this is how Hydra does it? As I remember Hydra was unaffected.

These flags for atomics are set in the CVehicleModelInfo::SetVehicleComponentFlags function. Specifically the flag we are interested in (VEHICLE_ATOMIC_LEFT) is set at address 0x4C7C9D. Before that it compares other flags that the game takes from ms_vehicleDescs. If we look at what values the left door component of helicopters (heliIds) takes, we see the following:

{ .pName = “door_lf_dummy”, .hierId = CAR_DOOR_LF, .flags = VEHICLE_CRUSH | VEHICLE_DOOR | VEHICLE_DONTCULL | VEHICLE_LEFT | VEHICLE_FRONTDOOR }

As you can see, it is because of the VEHICLE_LEFT flag that the game assigns the VEHICLE_ATOMIC_LEFT flag to the atomics of this component. Regarding Hydra. Let's see what values the left door component of planes (planeIds) takes:

{ .pName = “door_lf_dummy”, .hierId = CAR_DOOR_LF, .flags = VEHICLE_CRUSH | VEHICLE_ALPHA | VEHICLE_DOOR | VEHICLE_DONTCULL }

As you can see, the VEHICLE_LEFT flag is missing. Therefore, the VEHICLE_ATOMIC_LEFT flag is not assigned to the atomics of this component.

Solniz commented 2 weeks ago

So I am not 100% sure this is related but the Sparrow has similar transparency issues...

On PS2, the window is always visible. Captura de ecrã 2024-11-02 195906

While on PC it can go invisible while pointing at the water or grass... Sem título1 Sem título33

Initially I thought it would be a model issue but even when using the PS2 Sparrow/Sea Sparrow model & texture, the bug remains. I think the Hydra and Hunter have a similar issue but it's a lot harder to see since they're not as open as the Sparrow.