From bc9ae76c1f5c91810cd36e5d19ccad3790b35715 Mon Sep 17 00:00:00 2001 From: Andrey Nazarov Date: Fri, 25 Mar 2011 19:59:39 +0300 Subject: Clean up and fix 32-bit color API. Make color_t a union to work around aliasing issues. Get rid of FastColorCopy macro in favor of direct assignment. Get rid of DRAW_COLOR_* macros in favor of separate APIs for clearing and setting 32-bit color and alpha values. Rename R_DrawFill/R_DrawFillEx into R_DrawFill8/R_DrawFill32 for consistency. Remove unused fields from laser_t struct. Fix 32-bit particles fading out too soon. Fix console text drawing with software renderer. Fix possible SCR_ParseColor buffer overflow. --- src/ui_script.c | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) (limited to 'src/ui_script.c') diff --git a/src/ui_script.c b/src/ui_script.c index e656471..772073b 100644 --- a/src/ui_script.c +++ b/src/ui_script.c @@ -312,9 +312,9 @@ static void Parse_Blank( menuFrameWork_t *menu ) { static void Parse_Background( menuFrameWork_t *menu ) { char *s = Cmd_Argv( 1 ); - if( SCR_ParseColor( s, menu->color ) ) { + if( SCR_ParseColor( s, &menu->color ) ) { menu->image = 0; - if( menu->color[3] != 255 ) { + if( menu->color.u8[3] != 255 ) { menu->transparent = qtrue; } } else { @@ -335,13 +335,13 @@ static void Parse_Color( void ) { c = Cmd_Argv( 2 ); if( !strcmp( s, "normal" ) ) { - SCR_ParseColor( c, uis.color.normal ); + SCR_ParseColor( c, &uis.color.normal ); } else if( !strcmp( s, "active" ) ) { - SCR_ParseColor( c, uis.color.active ); + SCR_ParseColor( c, &uis.color.active ); } else if( !strcmp( s, "selection" ) ) { - SCR_ParseColor( c, uis.color.selection ); + SCR_ParseColor( c, &uis.color.selection ); } else if( !strcmp( s, "disabled" ) ) { - SCR_ParseColor( c, uis.color.disabled ); + SCR_ParseColor( c, &uis.color.disabled ); } else { Com_Printf( "Unknown state '%s'\n", s ); } @@ -473,7 +473,7 @@ static qboolean Parse_File( const char *path, int depth ) { menu->pop = Menu_Pop; menu->free = Menu_Free; menu->image = uis.backgroundHandle; - FastColorCopy( uis.color.background, menu->color ); + menu->color.u32 = uis.color.background.u32; } else if( !strcmp( cmd, "include" ) ) { char *s = Cmd_Argv( 1 ); if( !*s ) { @@ -490,7 +490,7 @@ static qboolean Parse_File( const char *path, int depth ) { } else if( !strcmp( cmd, "background" ) ) { char *s = Cmd_Argv( 1 ); - if( SCR_ParseColor( s, uis.color.background ) ) { + if( SCR_ParseColor( s, &uis.color.background ) ) { uis.backgroundHandle = 0; } else { uis.backgroundHandle = R_RegisterPic( s ); -- cgit v1.2.3