p2sr / SourceAutoRecord

Speedrun plugin for Source engine games.
https://sar.portal2.sr/
MIT License
93 stars 29 forks source link

`sar_quickhud` doesn't show open portals on loading a save #135

Closed mlugg closed 1 year ago

mlugg commented 1 year ago

It's trying to fetch m_h{Primary,Secondary}Portal from the gun. That's a good fast check, but those handles aren't saved, so if that fails, we should actually try to find the prop_portal with the gun's linkage ID (see server->FindPortal, e.g. in Features/PlacementScanner.cpp).

ThisAMJ commented 1 year ago

The only issue here is that server->FindPortal is, well, on the server. The crosshair is client-side, and I think setting the handle to a server entity would make the game very unhappy. Even if that works, it surely wouldn't work for orange?

mlugg commented 1 year ago

You make a very good point! We might need a different approach, then. When the portal handle is NULL, scan through all the client entities for open prop_portals with the correct linkage ID, and use those instead. This handles can be safely cached off (check again if the entities die or if the portal is ever closed), so no major perf issue.

mlugg commented 1 year ago

with that being said, lemme check how default quickhud does it first lol

mlugg commented 1 year ago

okay scratch that there's literally just separate networked fields that indicate each portal position that's stupid