]> de.git.xonotic.org Git - xonotic/darkplaces.git/blobdiff - menu.c
critical fix for COM_FileBase (could go hunting through mem for /)
[xonotic/darkplaces.git] / menu.c
diff --git a/menu.c b/menu.c
index cde022532364203eabef70fc56e07af20fb054d9..28de58ec0a7350862d67f4765d3fbcb6fb19f772 100644 (file)
--- a/menu.c
+++ b/menu.c
@@ -150,11 +150,6 @@ void M_PrintWhite (int cx, int cy, char *str)
        }
 }
 
-void M_DrawTransPic (int x, int y, qpic_t *pic)
-{
-       Draw_TransPic (x + ((vid.width - 320)>>1), y, pic);
-}
-
 void M_DrawPic (int x, int y, qpic_t *pic)
 {
        Draw_Pic (x + ((vid.width - 320)>>1), y, pic);
@@ -190,9 +185,9 @@ void M_BuildTranslationTable(int top, int bottom)
 }
 
 
-void M_DrawTransPicTranslate (int x, int y, qpic_t *pic)
+void M_DrawPicTranslate (int x, int y, qpic_t *pic)
 {
-       Draw_TransPicTranslate (x + ((vid.width - 320)>>1), y, pic, translationTable);
+       Draw_PicTranslate (x + ((vid.width - 320)>>1), y, pic, translationTable);
 }
 
 
@@ -206,15 +201,15 @@ void M_DrawTextBox (int x, int y, int width, int lines)
        cx = x;
        cy = y;
        p = Draw_CachePic ("gfx/box_tl.lmp");
-       M_DrawTransPic (cx, cy, p);
+       M_DrawPic (cx, cy, p);
        p = Draw_CachePic ("gfx/box_ml.lmp");
        for (n = 0; n < lines; n++)
        {
                cy += 8;
-               M_DrawTransPic (cx, cy, p);
+               M_DrawPic (cx, cy, p);
        }
        p = Draw_CachePic ("gfx/box_bl.lmp");
-       M_DrawTransPic (cx, cy+8, p);
+       M_DrawPic (cx, cy+8, p);
 
        // draw middle
        cx += 8;
@@ -222,17 +217,17 @@ void M_DrawTextBox (int x, int y, int width, int lines)
        {
                cy = y;
                p = Draw_CachePic ("gfx/box_tm.lmp");
-               M_DrawTransPic (cx, cy, p);
+               M_DrawPic (cx, cy, p);
                p = Draw_CachePic ("gfx/box_mm.lmp");
                for (n = 0; n < lines; n++)
                {
                        cy += 8;
                        if (n == 1)
                                p = Draw_CachePic ("gfx/box_mm2.lmp");
-                       M_DrawTransPic (cx, cy, p);
+                       M_DrawPic (cx, cy, p);
                }
                p = Draw_CachePic ("gfx/box_bm.lmp");
-               M_DrawTransPic (cx, cy+8, p);
+               M_DrawPic (cx, cy+8, p);
                width -= 2;
                cx += 16;
        }
@@ -240,15 +235,15 @@ void M_DrawTextBox (int x, int y, int width, int lines)
        // draw right side
        cy = y;
        p = Draw_CachePic ("gfx/box_tr.lmp");
-       M_DrawTransPic (cx, cy, p);
+       M_DrawPic (cx, cy, p);
        p = Draw_CachePic ("gfx/box_mr.lmp");
        for (n = 0; n < lines; n++)
        {
                cy += 8;
-               M_DrawTransPic (cx, cy, p);
+               M_DrawPic (cx, cy, p);
        }
        p = Draw_CachePic ("gfx/box_br.lmp");
-       M_DrawTransPic (cx, cy+8, p);
+       M_DrawPic (cx, cy+8, p);
 }
 
 //=============================================================================
@@ -307,40 +302,40 @@ void M_Menu_Demos_f (void)
 
         NumberOfDemos = 34;
 
-        strcpy(Demos[0].name,  "INTRO");         strcpy(Demos[0].desc,  "Prologue");
-        strcpy(Demos[1].name,  "GENF");          strcpy(Demos[1].desc,  "The Beginning");
-        strcpy(Demos[2].name,  "GENLAB");        strcpy(Demos[2].desc,  "A Doomed Project");
-        strcpy(Demos[3].name,  "NEHCRE");        strcpy(Demos[3].desc,  "The New Recruits");
-        strcpy(Demos[4].name,  "MAXNEH");        strcpy(Demos[4].desc,  "Breakthrough");
-        strcpy(Demos[5].name,  "MAXCHAR");       strcpy(Demos[5].desc,  "Renewal and Duty");
-        strcpy(Demos[6].name,  "CRISIS");        strcpy(Demos[6].desc,  "Worlds Collide");
-        strcpy(Demos[7].name,  "POSTCRIS");      strcpy(Demos[7].desc,  "Darkening Skies");
-        strcpy(Demos[8].name,  "HEARING");       strcpy(Demos[8].desc,  "The Hearing");
-        strcpy(Demos[9].name,  "GETJACK");       strcpy(Demos[9].desc,  "On a Mexican Radio");
-        strcpy(Demos[10].name, "PRELUDE");       strcpy(Demos[10].desc, "Honor and Justice");
-        strcpy(Demos[11].name, "ABASE");         strcpy(Demos[11].desc, "A Message Sent");
-        strcpy(Demos[12].name, "EFFECT");        strcpy(Demos[12].desc, "The Other Side");
-        strcpy(Demos[13].name, "UHOH");          strcpy(Demos[13].desc, "Missing in Action");
-        strcpy(Demos[14].name, "PREPARE");       strcpy(Demos[14].desc, "The Response");
-        strcpy(Demos[15].name, "VISION");        strcpy(Demos[15].desc, "Farsighted Eyes");
-        strcpy(Demos[16].name, "MAXTURNS");      strcpy(Demos[16].desc, "Enter the Immortal");
-        strcpy(Demos[17].name, "BACKLOT");       strcpy(Demos[17].desc, "Separate Ways");
-        strcpy(Demos[18].name, "MAXSIDE");       strcpy(Demos[18].desc, "The Ancient Runes");
-        strcpy(Demos[19].name, "COUNTER");       strcpy(Demos[19].desc, "The New Initiative");
-        strcpy(Demos[20].name, "WARPREP");       strcpy(Demos[20].desc, "Ghosts to the World");
-        strcpy(Demos[21].name, "COUNTER1");      strcpy(Demos[21].desc, "A Fate Worse Than Death");
-        strcpy(Demos[22].name, "COUNTER2");      strcpy(Demos[22].desc, "Friendly Fire");
-        strcpy(Demos[23].name, "COUNTER3");      strcpy(Demos[23].desc, "Minor Setback");
-        strcpy(Demos[24].name, "MADMAX");        strcpy(Demos[24].desc, "Scores to Settle");
-        strcpy(Demos[25].name, "QUAKE");         strcpy(Demos[25].desc, "One Man");
-        strcpy(Demos[26].name, "CTHMM");         strcpy(Demos[26].desc, "Shattered Masks");
-        strcpy(Demos[27].name, "SHADES");        strcpy(Demos[27].desc, "Deal with the Dead");
-        strcpy(Demos[28].name, "GOPHIL");        strcpy(Demos[28].desc, "An Unlikely Hero");
-        strcpy(Demos[29].name, "CSTRIKE");       strcpy(Demos[29].desc, "War in Hell");
-        strcpy(Demos[30].name, "SHUBSET");       strcpy(Demos[30].desc, "The Conspiracy");
-        strcpy(Demos[31].name, "SHUBDIE");       strcpy(Demos[31].desc, "Even Death May Die");
-        strcpy(Demos[32].name, "NEWRANKS");      strcpy(Demos[32].desc, "An Empty Throne");
-        strcpy(Demos[33].name, "SEAL");          strcpy(Demos[33].desc, "The Seal is Broken");
+        strcpy(Demos[0].name,  "intro");         strcpy(Demos[0].desc,  "Prologue");
+        strcpy(Demos[1].name,  "genf");          strcpy(Demos[1].desc,  "The Beginning");
+        strcpy(Demos[2].name,  "genlab");        strcpy(Demos[2].desc,  "A Doomed Project");
+        strcpy(Demos[3].name,  "nehcre");        strcpy(Demos[3].desc,  "The New Recruits");
+        strcpy(Demos[4].name,  "maxneh");        strcpy(Demos[4].desc,  "Breakthrough");
+        strcpy(Demos[5].name,  "maxchar");       strcpy(Demos[5].desc,  "Renewal and Duty");
+        strcpy(Demos[6].name,  "crisis");        strcpy(Demos[6].desc,  "Worlds Collide");
+        strcpy(Demos[7].name,  "postcris");      strcpy(Demos[7].desc,  "Darkening Skies");
+        strcpy(Demos[8].name,  "hearing");       strcpy(Demos[8].desc,  "The Hearing");
+        strcpy(Demos[9].name,  "getjack");       strcpy(Demos[9].desc,  "On a Mexican Radio");
+        strcpy(Demos[10].name, "prelude");       strcpy(Demos[10].desc, "Honor and Justice");
+        strcpy(Demos[11].name, "abase");         strcpy(Demos[11].desc, "A Message Sent");
+        strcpy(Demos[12].name, "effect");        strcpy(Demos[12].desc, "The Other Side");
+        strcpy(Demos[13].name, "uhoh");          strcpy(Demos[13].desc, "Missing in Action");
+        strcpy(Demos[14].name, "prepare");       strcpy(Demos[14].desc, "The Response");
+        strcpy(Demos[15].name, "vision");        strcpy(Demos[15].desc, "Farsighted Eyes");
+        strcpy(Demos[16].name, "maxturns");      strcpy(Demos[16].desc, "Enter the Immortal");
+        strcpy(Demos[17].name, "backlot");       strcpy(Demos[17].desc, "Separate Ways");
+        strcpy(Demos[18].name, "maxside");       strcpy(Demos[18].desc, "The Ancient Runes");
+        strcpy(Demos[19].name, "counter");       strcpy(Demos[19].desc, "The New Initiative");
+        strcpy(Demos[20].name, "warprep");       strcpy(Demos[20].desc, "Ghosts to the World");
+        strcpy(Demos[21].name, "counter1");      strcpy(Demos[21].desc, "A Fate Worse Than Death");
+        strcpy(Demos[22].name, "counter2");      strcpy(Demos[22].desc, "Friendly Fire");
+        strcpy(Demos[23].name, "counter3");      strcpy(Demos[23].desc, "Minor Setback");
+        strcpy(Demos[24].name, "madmax");        strcpy(Demos[24].desc, "Scores to Settle");
+        strcpy(Demos[25].name, "quake");         strcpy(Demos[25].desc, "One Man");
+        strcpy(Demos[26].name, "cthmm");         strcpy(Demos[26].desc, "Shattered Masks");
+        strcpy(Demos[27].name, "shades");        strcpy(Demos[27].desc, "Deal with the Dead");
+        strcpy(Demos[28].name, "gophil");        strcpy(Demos[28].desc, "An Unlikely Hero");
+        strcpy(Demos[29].name, "cstrike");       strcpy(Demos[29].desc, "War in Hell");
+        strcpy(Demos[30].name, "shubset");       strcpy(Demos[30].desc, "The Conspiracy");
+        strcpy(Demos[31].name, "shubdie");       strcpy(Demos[31].desc, "Even Death May Die");
+        strcpy(Demos[32].name, "newranks");      strcpy(Demos[32].desc, "An Empty Throne");
+        strcpy(Demos[33].name, "seal");          strcpy(Demos[33].desc, "The Seal is Broken");
 }
 
 void M_Demo_Key (int k)
@@ -415,25 +410,25 @@ void M_Main_Draw (void)
        int             f;
        qpic_t  *p;
 
-       M_DrawTransPic (16, 4, Draw_CachePic ("gfx/qplaque.lmp") );
+       M_DrawPic (16, 4, Draw_CachePic ("gfx/qplaque.lmp") );
        p = Draw_CachePic ("gfx/ttl_main.lmp");
        M_DrawPic ( (320-p->width)/2, 4, p);
 // Nehahra
        if (nehahra)
        {
                if (NehGameType == TYPE_BOTH)
-                       M_DrawTransPic (72, 32, Draw_CachePic ("gfx/mainmenu.lmp"));
+                       M_DrawPic (72, 32, Draw_CachePic ("gfx/mainmenu.lmp"));
                else if (NehGameType == TYPE_GAME)
-                       M_DrawTransPic (72, 32, Draw_CachePic ("gfx/gamemenu.lmp"));
+                       M_DrawPic (72, 32, Draw_CachePic ("gfx/gamemenu.lmp"));
                else
-                       M_DrawTransPic (72, 32, Draw_CachePic ("gfx/demomenu.lmp"));
+                       M_DrawPic (72, 32, Draw_CachePic ("gfx/demomenu.lmp"));
        }
        else
-               M_DrawTransPic (72, 32, Draw_CachePic ("gfx/mainmenu.lmp"));
+               M_DrawPic (72, 32, Draw_CachePic ("gfx/mainmenu.lmp"));
 
        f = (int)(host_time * 10)%6;
 
-       M_DrawTransPic (54, 32 + m_main_cursor * 20,Draw_CachePic( va("gfx/menudot%i.lmp", f+1 ) ) );
+       M_DrawPic (54, 32 + m_main_cursor * 20,Draw_CachePic( va("gfx/menudot%i.lmp", f+1 ) ) );
 }
 
 
@@ -491,7 +486,7 @@ void M_Main_Key (int key)
                                        key_dest = key_game;
                                        if (sv.active)
                                                Cbuf_AddText ("disconnect\n");
-                                       Cbuf_AddText ("playdemo ENDCRED\n");
+                                       Cbuf_AddText ("playdemo endcred\n");
                                        break;
 
                                case 5:
@@ -518,7 +513,7 @@ void M_Main_Key (int key)
                                        key_dest = key_game;
                                        if (sv.active)
                                                Cbuf_AddText ("disconnect\n");
-                                       Cbuf_AddText ("playdemo ENDCRED\n");
+                                       Cbuf_AddText ("playdemo endcred\n");
                                        break;
 
                                case 4:
@@ -537,7 +532,7 @@ void M_Main_Key (int key)
                                        key_dest = key_game;
                                        if (sv.active)
                                                Cbuf_AddText ("disconnect\n");
-                                       Cbuf_AddText ("playdemo ENDCRED\n");
+                                       Cbuf_AddText ("playdemo endcred\n");
                                        break;
 
                                case 2:
@@ -599,14 +594,14 @@ void M_SinglePlayer_Draw (void)
        int             f;
        qpic_t  *p;
 
-       M_DrawTransPic (16, 4, Draw_CachePic ("gfx/qplaque.lmp") );
+       M_DrawPic (16, 4, Draw_CachePic ("gfx/qplaque.lmp") );
        p = Draw_CachePic ("gfx/ttl_sgl.lmp");
        M_DrawPic ( (320-p->width)/2, 4, p);
-       M_DrawTransPic (72, 32, Draw_CachePic ("gfx/sp_menu.lmp") );
+       M_DrawPic (72, 32, Draw_CachePic ("gfx/sp_menu.lmp") );
 
        f = (int)(host_time * 10)%6;
 
-       M_DrawTransPic (54, 32 + m_singleplayer_cursor * 20,Draw_CachePic( va("gfx/menudot%i.lmp", f+1 ) ) );
+       M_DrawPic (54, 32 + m_singleplayer_cursor * 20,Draw_CachePic( va("gfx/menudot%i.lmp", f+1 ) ) );
 }
 
 
@@ -847,14 +842,14 @@ void M_MultiPlayer_Draw (void)
        int             f;
        qpic_t  *p;
 
-       M_DrawTransPic (16, 4, Draw_CachePic ("gfx/qplaque.lmp") );
+       M_DrawPic (16, 4, Draw_CachePic ("gfx/qplaque.lmp") );
        p = Draw_CachePic ("gfx/p_multi.lmp");
        M_DrawPic ( (320-p->width)/2, 4, p);
-       M_DrawTransPic (72, 32, Draw_CachePic ("gfx/mp_menu.lmp") );
+       M_DrawPic (72, 32, Draw_CachePic ("gfx/mp_menu.lmp") );
 
        f = (int)(host_time * 10)%6;
 
-       M_DrawTransPic (54, 32 + m_multiplayer_cursor * 20,Draw_CachePic( va("gfx/menudot%i.lmp", f+1 ) ) );
+       M_DrawPic (54, 32 + m_multiplayer_cursor * 20,Draw_CachePic( va("gfx/menudot%i.lmp", f+1 ) ) );
 
        if (serialAvailable || ipxAvailable || tcpipAvailable)
                return;
@@ -934,7 +929,7 @@ void M_Setup_Draw (void)
 {
        qpic_t  *p;
 
-       M_DrawTransPic (16, 4, Draw_CachePic ("gfx/qplaque.lmp") );
+       M_DrawPic (16, 4, Draw_CachePic ("gfx/qplaque.lmp") );
        p = Draw_CachePic ("gfx/p_multi.lmp");
        M_DrawPic ( (320-p->width)/2, 4, p);
 
@@ -953,10 +948,10 @@ void M_Setup_Draw (void)
        M_Print (72, 140, "Accept Changes");
 
        p = Draw_CachePic ("gfx/bigbox.lmp");
-       M_DrawTransPic (160, 64, p);
+       M_DrawPic (160, 64, p);
        p = Draw_CachePic ("gfx/menuplyr.lmp");
        M_BuildTranslationTable(setup_top*16, setup_bottom*16);
-       M_DrawTransPicTranslate (172, 72, p);
+       M_DrawPicTranslate (172, 72, p);
 
        M_DrawCharacter (56, setup_cursor_table [setup_cursor], 12+((int)(realtime*4)&1));
 
@@ -1127,7 +1122,7 @@ void M_Net_Draw (void)
        int             f;
        qpic_t  *p;
 
-       M_DrawTransPic (16, 4, Draw_CachePic ("gfx/qplaque.lmp") );
+       M_DrawPic (16, 4, Draw_CachePic ("gfx/qplaque.lmp") );
        p = Draw_CachePic ("gfx/p_multi.lmp");
        M_DrawPic ( (320-p->width)/2, 4, p);
 
@@ -1147,7 +1142,7 @@ void M_Net_Draw (void)
        }
 
        if (p)
-               M_DrawTransPic (72, f, p);
+               M_DrawPic (72, f, p);
 
        f += 19;
 
@@ -1165,27 +1160,27 @@ void M_Net_Draw (void)
        }
 
        if (p)
-               M_DrawTransPic (72, f, p);
+               M_DrawPic (72, f, p);
 
        f += 19;
        if (ipxAvailable)
                p = Draw_CachePic ("gfx/netmen3.lmp");
        else
                p = Draw_CachePic ("gfx/dim_ipx.lmp");
-       M_DrawTransPic (72, f, p);
+       M_DrawPic (72, f, p);
 
        f += 19;
        if (tcpipAvailable)
                p = Draw_CachePic ("gfx/netmen4.lmp");
        else
                p = Draw_CachePic ("gfx/dim_tcp.lmp");
-       M_DrawTransPic (72, f, p);
+       M_DrawPic (72, f, p);
 
        if (m_net_items == 5)   // JDC, could just be removed
        {
                f += 19;
                p = Draw_CachePic ("gfx/netmen5.lmp");
-               M_DrawTransPic (72, f, p);
+               M_DrawPic (72, f, p);
        }
 
        f = (320-26*8)/2;
@@ -1197,7 +1192,7 @@ void M_Net_Draw (void)
        M_Print (f, 166, net_helpMessage[m_net_cursor*4+3]);
 
        f = (int)(host_time * 10)%6;
-       M_DrawTransPic (54, 32 + m_net_cursor * 20,Draw_CachePic( va("gfx/menudot%i.lmp", f+1 ) ) );
+       M_DrawPic (54, 32 + m_net_cursor * 20,Draw_CachePic( va("gfx/menudot%i.lmp", f+1 ) ) );
 }
 
 
@@ -1406,7 +1401,7 @@ void M_Options_Draw (void)
        float           r;
        qpic_t  *p;
 
-       M_DrawTransPic (16, 4, Draw_CachePic ("gfx/qplaque.lmp") );
+       M_DrawPic (16, 4, Draw_CachePic ("gfx/qplaque.lmp") );
        p = Draw_CachePic ("gfx/p_option.lmp");
        M_DrawPic ( (320-p->width)/2, 4, p);
 
@@ -2004,7 +1999,7 @@ void M_SerialConfig_Draw (void)
        char    *startJoin;
        char    *directModem;
 
-       M_DrawTransPic (16, 4, Draw_CachePic ("gfx/qplaque.lmp") );
+       M_DrawPic (16, 4, Draw_CachePic ("gfx/qplaque.lmp") );
        p = Draw_CachePic ("gfx/p_multi.lmp");
        basex = (320-p->width)/2;
        M_DrawPic (basex, 4, p);
@@ -2216,16 +2211,20 @@ forward:
        }
 
        if (DirectConfig && (serialConfig_cursor == 3 || serialConfig_cursor == 4))
+       {
                if (key == K_UPARROW)
                        serialConfig_cursor = 2;
                else
                        serialConfig_cursor = 5;
+       }
 
        if (SerialConfig && StartingGame && serialConfig_cursor == 4)
+       {
                if (key == K_UPARROW)
                        serialConfig_cursor = 3;
                else
                        serialConfig_cursor = 5;
+       }
 }
 
 //=============================================================================
@@ -2254,7 +2253,7 @@ void M_ModemConfig_Draw (void)
        qpic_t  *p;
        int             basex;
 
-       M_DrawTransPic (16, 4, Draw_CachePic ("gfx/qplaque.lmp") );
+       M_DrawPic (16, 4, Draw_CachePic ("gfx/qplaque.lmp") );
        p = Draw_CachePic ("gfx/p_multi.lmp");
        basex = (320-p->width)/2;
        M_DrawPic (basex, 4, p);
@@ -2440,7 +2439,7 @@ void M_LanConfig_Draw (void)
        char    *startJoin;
        char    *protocol;
 
-       M_DrawTransPic (16, 4, Draw_CachePic ("gfx/qplaque.lmp") );
+       M_DrawPic (16, 4, Draw_CachePic ("gfx/qplaque.lmp") );
        p = Draw_CachePic ("gfx/p_multi.lmp");
        basex = (320-p->width)/2;
        M_DrawPic (basex, 4, p);
@@ -2589,10 +2588,12 @@ void M_LanConfig_Key (int key)
        }
 
        if (StartingGame && lanConfig_cursor == 2)
+       {
                if (key == K_UPARROW)
                        lanConfig_cursor = 1;
                else
                        lanConfig_cursor = 0;
+       }
 
        l =  atoi(lanConfig_portname);
        if (l > 65535)
@@ -2807,7 +2808,7 @@ void M_GameOptions_Draw (void)
        qpic_t  *p;
        int             x;
 
-       M_DrawTransPic (16, 4, Draw_CachePic ("gfx/qplaque.lmp") );
+       M_DrawPic (16, 4, Draw_CachePic ("gfx/qplaque.lmp") );
        p = Draw_CachePic ("gfx/p_multi.lmp");
        M_DrawPic ( (320-p->width)/2, 4, p);
 
@@ -3347,9 +3348,7 @@ void M_Draw (void)
                if (scr_con_current)
                {
                        Draw_ConsoleBackground (vid.height);
-                       VID_UnlockBuffer ();
                        S_ExtraUpdate ();
-                       VID_LockBuffer ();
                }
 //             else
 //                     Draw_FadeScreen ();
@@ -3449,9 +3448,7 @@ void M_Draw (void)
                m_entersound = false;
        }
 
-       VID_UnlockBuffer ();
        S_ExtraUpdate ();
-       VID_LockBuffer ();
 }