Cleanup Modify_Layer() a bit more.

This commit is contained in:
riccardom 2009-01-12 22:41:19 +00:00
parent aa62c44724
commit 3f9c4cf341
1 changed files with 24 additions and 13 deletions

View File

@ -1073,43 +1073,54 @@ static void Modify_ScreenCoeff(GtkWidget* widget, gpointer data)
static void Modify_Layer(GtkWidget* widget, gpointer data) static void Modify_Layer(GtkWidget* widget, gpointer data)
{ {
guint Layer = GPOINTER_TO_UINT(data); guint Layer = GPOINTER_TO_UINT(data);
gboolean active;
if (!desmume_running()) if (!desmume_running())
return; return;
active = gtk_check_menu_item_get_active(GTK_CHECK_MENU_ITEM(widget));
switch (Layer) { switch (Layer) {
case MAIN_BG_0: case MAIN_BG_0:
case MAIN_BG_1: case MAIN_BG_1:
case MAIN_BG_2: case MAIN_BG_2:
case MAIN_BG_3: case MAIN_BG_3:
if(gtk_check_menu_item_get_active(GTK_CHECK_MENU_ITEM(widget)) == TRUE) { if(active == TRUE) {
if(!MainScreen.gpu->dispBG[Layer]) GPU_addBack(MainScreen.gpu, Layer); if (!MainScreen.gpu->dispBG[Layer])
GPU_addBack(MainScreen.gpu, Layer);
} else { } else {
if(MainScreen.gpu->dispBG[Layer]) GPU_remove(MainScreen.gpu, Layer); if (MainScreen.gpu->dispBG[Layer])
GPU_remove(MainScreen.gpu, Layer);
} }
break; break;
case MAIN_OBJ: case MAIN_OBJ:
if(gtk_check_menu_item_get_active(GTK_CHECK_MENU_ITEM(widget)) == TRUE) { if(active == TRUE) {
if(!MainScreen.gpu->dispOBJ) GPU_addBack(MainScreen.gpu, Layer); if (!MainScreen.gpu->dispOBJ)
GPU_addBack(MainScreen.gpu, Layer);
} else { } else {
if(MainScreen.gpu->dispOBJ) GPU_remove(MainScreen.gpu, Layer); if (MainScreen.gpu->dispOBJ)
GPU_remove(MainScreen.gpu, Layer);
} }
break; break;
case SUB_BG_0: case SUB_BG_0:
case SUB_BG_1: case SUB_BG_1:
case SUB_BG_2: case SUB_BG_2:
case SUB_BG_3: case SUB_BG_3:
if(gtk_check_menu_item_get_active(GTK_CHECK_MENU_ITEM(widget)) == TRUE) { if(active == TRUE) {
if(!SubScreen.gpu->dispBG[Layer-SUB_BG_0]) GPU_addBack(SubScreen.gpu, Layer-SUB_BG_0); if (!SubScreen.gpu->dispBG[Layer-SUB_BG_0])
GPU_addBack(SubScreen.gpu, Layer-SUB_BG_0);
} else { } else {
if(SubScreen.gpu->dispBG[Layer-SUB_BG_0]) GPU_remove(SubScreen.gpu, Layer-SUB_BG_0); if (SubScreen.gpu->dispBG[Layer-SUB_BG_0])
GPU_remove(SubScreen.gpu, Layer-SUB_BG_0);
} }
break; break;
case SUB_OBJ: case SUB_OBJ:
if(gtk_check_menu_item_get_active(GTK_CHECK_MENU_ITEM(widget)) == TRUE) { if(active == TRUE) {
if(!SubScreen.gpu->dispOBJ) GPU_addBack(SubScreen.gpu, Layer-SUB_BG_0); if (!SubScreen.gpu->dispOBJ)
GPU_addBack(SubScreen.gpu, Layer-SUB_BG_0);
} else { } else {
if(SubScreen.gpu->dispOBJ) GPU_remove(SubScreen.gpu, Layer-SUB_BG_0); if (SubScreen.gpu->dispOBJ)
GPU_remove(SubScreen.gpu, Layer-SUB_BG_0);
} }
break; break;
default: default: