mastercomfig / tf2-patches

Team Fortress 2, but with a lot of fixes, QoL improvements and performance optimizations!
Other
221 stars 27 forks source link

fix: load embedded navmeshes from workshop maps #643

Closed ReplayCoding closed 1 year ago

ReplayCoding commented 1 year ago

This was fixed in live tf2, but that fix broke loading navmeshes generated using the nav_generate command.

Tested using https://steamcommunity.com/sharedfiles/filedetails/?id=2808183313 and https://steamcommunity.com/sharedfiles/filedetails/?id=454812035 (logjam doesn't have a navmesh, it was used to ensure nav_generate still worked)

Related Issue

https://github.com/ValveSoftware/Source-1-Games/issues/4567

Implementation

The original issue was that the canonical name for a workshop map is formatted as "workshop/pl_aceholder.ugc1234". When the game tried to load a navmesh from the BSP, it would try to load "maps/workshop/pl_aceholder.ugc1234.nav", instead of "maps/pl_aceholder.nav". The fix currently implemented in live correctly uses the "clean" name for the BSP, but also uses the clean name when looking in the MOD directories (effectively everything except the BSP). Since nav_generate saves its navmeshes with the canonical name, they would never be found. This fix only uses the clean map name when looking for files in the BSP.

Screenshots

Checklist

Testing Checklist

Client Server Version
Windows
Linux Built, Tested 6.1.7-xanmod1 #1-NixOS SMP PREEMPT_DYNAMIC Tue Jan 1 00:00:00 UTC 1980
Mac OS

Alternatives

mastercoms commented 1 year ago

Closing, will be reviewed independently