⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 m_menu.c

📁 The source code of Doom legacy for windows
💻 C
📖 第 1 页 / 共 4 页
字号:
menu_t  NetOptionDef ={    "M_OPTTTL",    "OPTIONS",    sizeof(NetOptionsMenu)/sizeof(menuitem_t),    &MultiPlayerDef,    NetOptionsMenu,    M_DrawGenericMenu,    60,40,    0};void M_NetOption(int choice){    if(!server)    {        M_StartMessage("You are not the server\nYou can't change the options\n",NULL,MM_NOTHING);        return;    }    M_SetupNextMenu(&NetOptionDef);}//===========================================================================//                        Server OPTIONS MENU//===========================================================================menuitem_t ServerOptionsMenu[]={    {IT_STRING | IT_CVAR,0, "Internet server",     &cv_internetserver   ,  0},    {IT_STRING | IT_CVAR        | IT_CV_STRING  ,0, "Master server",       &cv_masterserver     ,  0},    {IT_STRING | IT_CVAR        | IT_CV_STRING  ,0, "Server name",         &cv_servername       ,  0},};menu_t  ServerOptionsDef ={    "M_OPTTTL",    "OPTIONS",    sizeof(ServerOptionsMenu)/sizeof(menuitem_t),    &OptionsDef,    ServerOptionsMenu,    M_DrawGenericMenu,    28,40,    0};//===========================================================================//                          Read This! MENU 1//===========================================================================void M_DrawReadThis1(void);void M_DrawReadThis2(void);enum{    rdthsempty1,    read1_end} read_e;menuitem_t ReadMenu1[] ={    {IT_SUBMENU | IT_NOTHING,0,"",&ReadDef2,0}};menu_t  ReadDef1 ={    NULL,    NULL,    read1_end,    &MainDef,    ReadMenu1,    M_DrawReadThis1,    280,185,    0};//// Read This Menus// Had a "quick hack to fix romero bug"//void M_DrawReadThis1(void){    switch ( gamemode )    {      case commercial:        V_DrawScaledPatch (0,0,0,W_CachePatchName("HELP",PU_CACHE));        break;      case shareware:      case registered:      case retail:        V_DrawScaledPatch (0,0,0,W_CachePatchName("HELP1",PU_CACHE));        break;      case heretic:        V_DrawRawScreen(0,0,W_GetNumForName("HELP1"), 320, 200);        break;      default:        break;    }    return;}//===========================================================================//                          Read This! MENU 2//===========================================================================enum{    rdthsempty2,    read2_end} read_e2;menuitem_t ReadMenu2[]={    {IT_SUBMENU | IT_NOTHING,0,"",&MainDef,0}};menu_t  ReadDef2 ={    NULL,    NULL,    read2_end,    &ReadDef1,    ReadMenu2,    M_DrawReadThis2,    330,175,    0};//// Read This Menus - optional second page.//void M_DrawReadThis2(void){    switch ( gamemode )    {      case retail:      case commercial:        // This hack keeps us from having to change menus.        V_DrawScaledPatch (0,0,0,W_CachePatchName("CREDIT",PU_CACHE));        break;      case shareware:      case registered:        V_DrawScaledPatch (0,0,0,W_CachePatchName("HELP2",PU_CACHE));        break;      case heretic :        V_DrawRawScreen(0,0,W_GetNumForName("HELP2"), 320, 200);      default:        break;    }    return;}//===========================================================================//                        SOUND VOLUME MENU//===========================================================================void M_DrawSound(void);void M_SfxVol(int choice);void M_MusicVol(int choice);void M_CDAudioVol (int choice);enum{    sfx_vol,    sfx_empty1,    music_vol,    sfx_empty2,    cdaudio_vol,    sfx_empty3,    sound_end} sound_e;menuitem_t SoundMenu[]={    {IT_CVARMAX | IT_PATCH,"M_SFXVOL","Sound Volume",&cv_soundvolume  ,'s'},    {IT_BIGSPACE          ,NULL      ,NULL             ,0},    {IT_CVARMAX | IT_PATCH,"M_MUSVOL","Music Volume",&cv_musicvolume  ,'m'},    {IT_BIGSPACE          ,NULL      ,NULL             ,0},    {IT_CVARMAX | IT_PATCH,"M_CDVOL" ,"CD Volume"   ,&cd_volume       ,'c'},    {IT_BIGSPACE          ,NULL      ,NULL             ,0}};menu_t  SoundDef ={    "M_SVOL",    "Sound Volume",    sound_end,    &OptionsDef,    SoundMenu,    M_DrawSound,    80,50,    0};//// Change Sfx & Music volumes//void M_DrawSound(void){    M_DrawThermo(SoundDef.x,SoundDef.y+LINEHEIGHT*(sfx_vol+1),                 16,cv_soundvolume.value);    M_DrawThermo(SoundDef.x,SoundDef.y+LINEHEIGHT*(music_vol+1),                 16,cv_musicvolume.value);    M_DrawThermo(SoundDef.x,SoundDef.y+LINEHEIGHT*(cdaudio_vol+1),                 16,cd_volume.value);    M_DrawGenericMenu();}//===========================================================================//                          CONTROLS MENU//===========================================================================void M_DrawControl(void);               // added 3-1-98void M_ChangeControl(int choice);//// this is the same for all control pages//menuitem_t ControlMenu[]={    {IT_CALL | IT_STRING2,0,"Fire"        ,M_ChangeControl,gc_fire       },    {IT_CALL | IT_STRING2,0,"Use/Open"    ,M_ChangeControl,gc_use        },    {IT_CALL | IT_STRING2,0,"Jump"        ,M_ChangeControl,gc_jump       },    {IT_CALL | IT_STRING2,0,"Forward"     ,M_ChangeControl,gc_forward    },    {IT_CALL | IT_STRING2,0,"Backpedal"   ,M_ChangeControl,gc_backward   },    {IT_CALL | IT_STRING2,0,"Turn Left"   ,M_ChangeControl,gc_turnleft   },    {IT_CALL | IT_STRING2,0,"Turn Right"  ,M_ChangeControl,gc_turnright  },    {IT_CALL | IT_STRING2,0,"Run"         ,M_ChangeControl,gc_speed      },    {IT_CALL | IT_STRING2,0,"Strafe On"   ,M_ChangeControl,gc_strafe     },    {IT_CALL | IT_STRING2,0,"Strafe Left" ,M_ChangeControl,gc_strafeleft },    {IT_CALL | IT_STRING2,0,"Strafe Right",M_ChangeControl,gc_straferight},    {IT_CALL | IT_STRING2,0,"Look Up"     ,M_ChangeControl,gc_lookup     },    {IT_CALL | IT_STRING2,0,"Look Down"   ,M_ChangeControl,gc_lookdown   },    {IT_CALL | IT_STRING2,0,"Center View" ,M_ChangeControl,gc_centerview },    {IT_CALL | IT_STRING2,0,"Mouselook"   ,M_ChangeControl,gc_mouseaiming},    {IT_SUBMENU | IT_WHITESTRING,0,"next" ,&ControlDef2,128}};menu_t  ControlDef ={    "M_CONTRO",    "Setup Controles",    sizeof(ControlMenu)/sizeof(menuitem_t),    &OptionsDef,    ControlMenu,    M_DrawControl,    50,40,    0};////  Controls page 1//menuitem_t ControlMenu2[]={  {IT_CALL | IT_STRING2,0,"Fist/Chainsaw"  ,M_ChangeControl,gc_weapon1},  {IT_CALL | IT_STRING2,0,"Pistol"         ,M_ChangeControl,gc_weapon2},  {IT_CALL | IT_STRING2,0,"Shotgun/Double" ,M_ChangeControl,gc_weapon3},  {IT_CALL | IT_STRING2,0,"Chaingun"       ,M_ChangeControl,gc_weapon4},  {IT_CALL | IT_STRING2,0,"Rocket Launcher",M_ChangeControl,gc_weapon5},  {IT_CALL | IT_STRING2,0,"Plasma rifle"   ,M_ChangeControl,gc_weapon6},  {IT_CALL | IT_STRING2,0,"BFG"            ,M_ChangeControl,gc_weapon7},  {IT_CALL | IT_STRING2,0,"Chainsaw"       ,M_ChangeControl,gc_weapon8},  {IT_CALL | IT_STRING2,0,"Previous Weapon",M_ChangeControl,gc_prevweapon},  {IT_CALL | IT_STRING2,0,"Next Weapon"    ,M_ChangeControl,gc_nextweapon},  {IT_CALL | IT_STRING2,0,"Talk key"       ,M_ChangeControl,gc_talkkey},  {IT_CALL | IT_STRING2,0,"Rankings/Scores",M_ChangeControl,gc_scores },  {IT_CALL | IT_STRING2,0,"Console"        ,M_ChangeControl,gc_console},  {IT_CALL | IT_STRING2,0,"Inventory Left" ,M_ChangeControl,gc_invprev},    {IT_CALL | IT_STRING2,0,"Inventory Right",M_ChangeControl,gc_invnext},  {IT_CALL | IT_STRING2,0,"Inventory Use"  ,M_ChangeControl,gc_invuse },  {IT_CALL | IT_STRING2,0,"Fly down"       ,M_ChangeControl,gc_flydown},                          {IT_SUBMENU | IT_WHITESTRING,0,"next"    ,&ControlDef,140}};menu_t  ControlDef2 ={    "M_CONTRO",    "Setup Controles",    sizeof(ControlMenu2)/sizeof(menuitem_t),    &OptionsDef,    ControlMenu2,    M_DrawControl,    50,40,    0};//// Start the controls menu, setting it up for either the console player,// or the secondary splitscreen player//static  boolean setupcontrols_secondaryplayer;static  int   (*setupcontrols)[2];  // pointer to the gamecontrols of the player being editedvoid M_SetupControlsMenu (int choice){    // set the gamecontrols to be edited    if (choice == setupmultiplayer_controls) {        setupcontrols_secondaryplayer = true;        setupcontrols = gamecontrolbis;     // was called from secondary player's multiplayer setup menu    }    else {        setupcontrols_secondaryplayer = false;        setupcontrols = gamecontrol;        // was called from main Options (for console player, then)    }    currentMenu->lastOn = itemOn;    M_SetupNextMenu(&ControlDef);}////  Draws the Customise Controls menu//void M_DrawControl(void){    char     tmp[50];    int      i;    int      keys[2];    // draw title, strings and submenu    M_DrawGenericMenu();    M_CentreText (ControlDef.y-12,        (setupcontrols_secondaryplayer ? "SET CONTROLS FOR SECONDARY PLAYER" :                                         "PRESS ENTER TO CHANGE, BACKSPACE TO CLEAR") );    for(i=0;i<currentMenu->numitems;i++)    {        if (currentMenu->menuitems[i].status!=IT_CONTROL)            continue;        keys[0] = setupcontrols[currentMenu->menuitems[i].alphaKey][0];        keys[1] = setupcontrols[currentMenu->menuitems[i].alphaKey][1];        tmp[0]='\0';        if (keys[0] == KEY_NULL && keys[1] == KEY_NULL)        {            strcpy(tmp, "---");        }        else        {            if( keys[0] != KEY_NULL )                strcat (tmp, G_KeynumToString (keys[0]));            if( keys[0] != KEY_NULL && keys[1] != KEY_NULL )                strcat(tmp," or ");            if( keys[1] != KEY_NULL )                strcat (tmp, G_KeynumToString (keys[1]));        }        V_DrawStringWhite(ControlDef.x+220-V_StringWidth(tmp), ControlDef.y + i*8, tmp);    }}static int controltochange;void M_ChangecontrolResponse(event_t* ev){    int        control;    int        found;    int        ch=ev->data1;    // ESCAPE cancels    if (ch!=KEY_ESCAPE && ch!=KEY_PAUSE)    {        switch (ev->type)        {          // ignore mouse/joy movements, just get buttons          case ev_mouse:               ch = KEY_NULL;      // no key            break;          case ev_joystick:               ch = KEY_NULL;      // no key            break;          // keypad arrows are converted for the menu in cursor arrows          // so use the event instead of ch          case ev_keydown:            ch = ev->data1;            break;          default:            break;        }        control = controltochange;        // check if we already entered this key        found = -1;        if (setupcontrols[control][0]==ch)            found = 0;        else        if (setupcontrols[control][1]==ch)            found = 1;        if (found>=0)        {            // replace mouse and joy clicks by double clicks            if (ch>=KEY_MOUSE1 && ch<=KEY_MOUSE1+MOUSEBUTTONS)                setupcontrols[control][found] = ch-KEY_MOUSE1+KEY_DBLMOUSE1;            else              if (ch>=KEY_JOY1 && ch<=KEY_JOY1+JOYBUTTONS)                setupcontrols[control][found] = ch-KEY_JOY1+KEY_DBLJOY1;        }        else        {            // check if change key1 or key2, or replace the two by the new            found = 0;            if (setupcontrols[control][0] == KEY_NULL)                found++;            if (setupcontrols[control][1] == KEY_NULL)                found++;            if (found==2)            {                found = 0;                setupcontrols[control][1] = KEY_NULL;  //replace key 1 ,clear key2            }            G_CheckDoubleUsage(ch);            setupcontrols[control][found] = ch;        }    }    M_StopMessage(0);}void M_ChangeControl(int choice){    static char tmp[55];    controltochange = currentMenu->menuitems[choice].alphaKey;    sprintf (tmp,"Hit the new key for\n%s\nESC for Cancel",currentMenu->menuitems[choice].text);    M_StartMessage (tmp,M_ChangecontrolResponse,MM_EVENTHANDLER);}//===========================================================================//                        VIDEO MODE MENU//===========================================================================void M_DrawVideoMode(void);             //added:30-01-98:void M_HandleVideoMode (int ch);menuitem_t VideoModeMenu[]={    {IT_KEYHANDLER | IT_NOTHING, 0, "", M_HandleVideoMode, '\0'},     // dummy menuitem for the control func};menu_t  VidModeDef ={    NULL,    NULL,    1,                  // # of menu items    //sizeof(VideoModeMenu)/sizeof(menuitem_t),    &OptionsDef,        // previous menu    VideoModeMenu,      // menuitem_t ->    M_DrawVideoMode,    // drawing routine ->    48,60,              // x,y    0                   // lastOn};//added:30-01-98:#define MAXCOLUMNMODES   10     //max modes displayed in one column#define MAXMODEDESCS     (MAXCOLUMNMODES*3)// shhh... what am I doing... nooooo!int   VID_NumModes(void);char  *VID_GetModeName(int modenum);#ifdef LINUXvoid VID_PrepareModeList(void); // FIXME: hack, we should avoid those #ifdef LINUX#endifstatic int vidm_testingmode=0;static int vidm_previousmode;static int vidm_current=0;static int vidm_nummodes;static int vidm_column_size;typedef struct{    int     modenum;    //video mode number in the vidmodes list    char    *desc;      //XXXxYYY    int     iscur;      //1 if it is the current active mode} modedesc_t;static modedesc_t   modedescs[MAXMODEDESCS];//// Draw the video modes list, 

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -