engine: touch: allow smoother migration from old engine touch configs by stripping .tga extension

This commit is contained in:
Alibek Omarov 2025-01-22 13:40:47 +03:00
parent fc017286a6
commit a5c88bdda9

View file

@ -902,9 +902,10 @@ static void Touch_AddButton_f( void )
rgba_t color;
int argc = Cmd_Argc( );
touch_button_t *button = NULL;
const char *name, *texture, *command;
const char *name, *command;
float x1, y1, x2, y2;
qboolean privileged = Cmd_CurrentCommandIsPrivileged();
string texture;
if( argc < 4 )
{
@ -913,9 +914,18 @@ static void Touch_AddButton_f( void )
}
name = Cmd_Argv( 1 );
texture = Cmd_Argv( 2 );
Q_strncpy( texture, Cmd_Argv( 2 ), sizeof( texture ));
command = Cmd_Argv( 3 );
// HACKHACK: old engine specifically used .tga for touch buttons
// and because new engine extras.pk3 don't have .tga textures
// (which instead were converted to .png) strip extension to let
// to let imagelib choose better format
//
// Remove this when old engine migration would be done
if( Q_stricmp( COM_FileExtension( texture ), "tga" ))
COM_StripExtension( texture );
if( argc < 8 )
{
x1 = y1 = 0.4f;