]> de.git.xonotic.org Git - xonotic/xonotic-data.pk3dir.git/blobdiff - qcsrc/menu/item/nexposee.c
Merge remote-tracking branch 'origin/master' into terencehill/menu_focus_stuff
[xonotic/xonotic-data.pk3dir.git] / qcsrc / menu / item / nexposee.c
index c9232b192d62b3d40b97cb460288f8cd4deb6a67..97eabd7d66beffd07e0263f5474a63c572db5270 100644 (file)
@@ -35,6 +35,7 @@ void ExposeeCloseButton_Click(entity button, entity other); // un-exposees the c
 #ifdef IMPLEMENTATION
 
 .vector Nexposee_initialSize;
+.vector Nexposee_initialFontScale;
 .vector Nexposee_initialOrigin;
 .float Nexposee_initialAlpha;
 
@@ -61,7 +62,7 @@ void ExposeeCloseButton_Click(entity button, entity other)
 void Nexposee_resizeNotify(entity me, vector relOrigin, vector relSize, vector absOrigin, vector absSize)
 {
        me.calc(me);
-       me.resizeNotifyLie(me, relOrigin, relSize, absOrigin, absSize, Nexposee_initialOrigin, Nexposee_initialSize);
+       me.resizeNotifyLie(me, relOrigin, relSize, absOrigin, absSize, Nexposee_initialOrigin, Nexposee_initialSize, Nexposee_initialFontScale);
 }
 
 void Nexposee_Calc_Scale(entity me, float scale)
@@ -141,14 +142,13 @@ void Nexposee_draw(entity me)
        float a0;
        entity e;
        float f;
+       vector fs;
 
        if(me.animationState == -1)
        {
                me.animationState = 0;
        }
 
-       //print(ftos(me.animationState), "\n");
-
        f = min(1, frametime * 5);
        switch(me.animationState)
        {
@@ -203,11 +203,13 @@ void Nexposee_draw(entity me)
                }
                me.setAlphaOf(me, e, e.Container_alpha * (1 - f) + a * f);
 
-               e.Container_fontscale = globalToBoxSize(e.Container_size, e.Nexposee_initialSize);
+               fs = globalToBoxSize(e.Container_size, e.Nexposee_initialSize);
+               e.Container_fontscale_x = fs_x * e.Nexposee_initialFontScale_x;
+               e.Container_fontscale_y = fs_y * e.Nexposee_initialFontScale_y;
        }
 
        SUPER(Nexposee).draw(me);
-};
+}
 
 float Nexposee_mousePress(entity me, vector pos)
 {
@@ -261,7 +263,7 @@ float Nexposee_mouseMove(entity me, vector pos)
        if(me.animationState == 0)
        {
                if(me.mouseFocusedChild)
-                       if(me.mouseFocusedChild != e)
+                       if(me.mouseFocusedChild != e || me.mouseFocusedChild != me.selectedChild)
                                me.selectedChild = me.mouseFocusedChild;
                return 1;
        }
@@ -277,7 +279,7 @@ float Nexposee_keyUp(entity me, float scan, float ascii, float shift)
 
 float Nexposee_keyDown(entity me, float scan, float ascii, float shift)
 {
-       float nexposeeKey;
+       float nexposeeKey = 0;
        if(me.animationState == 2)
                if(SUPER(Nexposee).keyDown(me, scan, ascii, shift))
                        return 1;
@@ -303,9 +305,10 @@ float Nexposee_keyDown(entity me, float scan, float ascii, float shift)
        }
        switch(me.animationState)
        {
+               default:
                case 0:
                case 3:
-                       nexposeeKey = ((scan == K_SPACE) || (scan == K_ENTER));
+                       nexposeeKey = ((scan == K_SPACE) || (scan == K_ENTER) || (scan == K_KP_ENTER));
                        break;
                case 1:
                case 2:
@@ -316,6 +319,7 @@ float Nexposee_keyDown(entity me, float scan, float ascii, float shift)
        {
                switch(me.animationState)
                {
+                       default:
                        case 0:
                        case 3:
                                me.animationState = 1;
@@ -338,9 +342,12 @@ float Nexposee_keyDown(entity me, float scan, float ascii, float shift)
 void Nexposee_addItem(entity me, entity other, vector theOrigin, vector theSize, float theAlpha)
 {
        SUPER(Nexposee).addItem(me, other, theOrigin, theSize, theAlpha);
+       other.Nexposee_initialFontScale = other.Container_fontscale;
        other.Nexposee_initialSize = other.Container_size;
        other.Nexposee_initialOrigin = other.Container_origin;
        other.Nexposee_initialAlpha = other.Container_alpha;
+       if(other.Nexposee_initialFontScale == '0 0 0')
+               other.Nexposee_initialFontScale = '1 1 0';
 }
 
 void Nexposee_focusEnter(entity me)