[HL25] model_t surfaces field contains invalid data
LAGonauta opened this issue · comments
I am developing a mod that aims to add SteamAudio support to GoldSrc, but since the HL25 update I am having trouble getting the BSP data from the engine.
I am using GetEntityByIndex(0)
to get the map entity, and then processing the model like this:
cl_entity_s* map = gEngfuncs.GetEntityByIndex(0);
model_s* mapModel = map->model;
// Process every surface
for (int i = 0; i < mapModel->nummodelsurfaces; ++i)
{
msurface_t surface = mapModel->surfaces[mapModel->firstmodelsurface + i];
// ... processing code ...
}
However, after engine HL25, the surface returned by mapModel->surfaces
is not always valid so I cannot get all the polys of the model.
I am not sure if it is a matter of updating com_model.h
, but it would be really helpful to have this fixed. I don't really want to manually parse and load the map BSP...
Thank you!
model_t
's contents vary depending on which renderer is in use. Chances are it's changed again to accommodate the shader functionality. If you need to access BSP data you're better off loading it yourself.
This helped me, when tracing light-level server-side: yapb/linkage@c91a51d , i.e. msuraface_t contains additional displaylist_t field on struct end with hl25.
This helped me, when tracing light-level server-side: yapb/linkage@c91a51d , i.e. msuraface_t contains additional displaylist_t field on struct end with hl25.
This fixed it, thanks :)
I will use your solution in the interim, but it is good to know that it will work again when the SDK gets updated.