rtx: load rad files from rad/<mapname>.rad, fix #43

This commit is contained in:
Ivan 'provod' Avdeev 2021-09-11 11:20:29 -07:00 committed by Ivan Avdeev
parent d802ce279b
commit 5ce91209ce
1 changed files with 17 additions and 2 deletions

View File

@ -44,10 +44,12 @@ static void loadRadData( const model_t *map, const char *fmt, ... ) {
buffer = gEngine.COM_LoadFile( filename, &size, false);
if (!buffer) {
gEngine.Con_Printf(S_ERROR "Couldn't load rad data from file %s, the map will be completely black\n", filename);
gEngine.Con_Printf(S_ERROR "Couldn't load RAD data from file %s, the map will be completely black\n", filename);
return;
}
gEngine.Con_Reportf("Loading RAD data from file %s\n", filename);
data = (char*)buffer;
for (;;) {
string name;
@ -417,7 +419,20 @@ void VK_LightsNewMap( void )
// Load RAD data based on map name
memset(g_lights.map.emissive_textures, 0, sizeof(g_lights.map.emissive_textures));
loadRadData( map, "rad/lights.rad" );
loadRadData( map, "rad/%s.rad", map->name );
{
char mapname[sizeof(map->name)];
Q_strcpy(mapname, map->name);
char *suffix_bsp = Q_stristr(mapname, ".bsp");
if (suffix_bsp)
*suffix_bsp = '\0';
const char *name_begin = Q_strrchr(mapname, '/');
if (name_begin)
++name_begin;
else
name_begin = mapname;
loadRadData( map, "rad/%s.rad", name_begin );
}
}
void VK_LightsFrameInit( void )