From: terencehill Date: Wed, 31 Dec 2014 17:43:45 +0000 (+0100) Subject: Optimize ModalController_draw code once more X-Git-Tag: xonotic-v0.8.1~138^2~1 X-Git-Url: https://git.rm.cloudns.org/?a=commitdiff_plain;h=855007679;p=xonotic%2Fxonotic-data.pk3dir.git Optimize ModalController_draw code once more --- diff --git a/qcsrc/menu/item/modalcontroller.c b/qcsrc/menu/item/modalcontroller.c index 5f6799902..1fec7af28 100644 --- a/qcsrc/menu/item/modalcontroller.c +++ b/qcsrc/menu/item/modalcontroller.c @@ -150,11 +150,22 @@ void ModalController_draw(entity me) if(e.ModalController_state) { if(front) + { me.switchState(me, front, 2, 0); + if(front.ModalController_factor < 1) + animating = 1; + } front = e; } if(front) + { me.switchState(me, front, 1, 0); + if(front.ModalController_factor < 1) + animating = 1; + } + + if(front && front.Container_alpha == front.ModalController_initialAlpha) + goto update_done; // update isn't needed, everything stay as is df = frametime * 3; // animation speed @@ -198,7 +209,6 @@ void ModalController_draw(entity me) me.setAlphaOf(me, e, e.Container_alpha * prevFactor); else { - animating = 1; targetFactor = df / (1 - f + df); if(e.ModalController_state == 1) @@ -224,6 +234,8 @@ void ModalController_draw(entity me) e.Container_fontscale_y = fs_y * e.ModalController_initialFontScale_y; } } + :update_done + if(animating || !me.focused) me.setFocus(me, NULL); else