const char *GetMODVersion(void) { static msg_t msg; // we must be connected to the master server before writing to it if (MS_Connect(GetMasterServerIP(), GetMasterServerPort(), 0)) { CONS_Printf("cannot connect to the master server\n"); M_StartMessage("There was a problem connecting to\nthe Master Server", NULL, MM_NOTHING); return NULL; } msg.type = GET_VERSION_MSG; msg.length = sizeof MODVERSION; msg.room = MODID; // Might as well use it for something. sprintf(msg.buffer,"%d",MODVERSION); if (MS_Write(&msg) < 0) return NULL; MS_Read(&msg); CloseConnection(); if(strcmp(msg.buffer,"NULL") != 0) { return msg.buffer; } else return NULL; }
void M_QuickSave(void) { if (multiplayer) { S_Sound (CHAN_INTERFACE, "player/male/grunt1", 1, ATTN_NONE); M_ClearMenus (); return; } if (!usergame) { S_Sound (CHAN_INTERFACE, "player/male/grunt1", 1, ATTN_NONE); M_ClearMenus (); return; } if (gamestate != GS_LEVEL) return; if (quickSaveSlot < 0) { M_StartControlPanel(); M_ReadSaveStrings(); M_SetupNextMenu(&SaveDef); quickSaveSlot = -2; // means to pick a slot now return; } sprintf (tempstring, GStrings(QSPROMPT), savegamestrings[quickSaveSlot]); M_StartMessage (tempstring, M_QuickSaveResponse, true); }
void M_QuickLoad(void) { if (::g->netgame) { M_StartMessage(QLOADNET,NULL,false); return; } if (::g->quickSaveSlot < 0) { M_StartMessage(QSAVESPOT,NULL,false); return; } sprintf(::g->tempstring,QLPROMPT,::g->savegamestrings[::g->quickSaveSlot]); M_StartMessage(::g->tempstring,M_QuickLoadResponse,true); }
void M_EndGame(int choice) { choice = 0; if (!::g->usergame) { S_StartSound(NULL,sfx_oof); return; } if (::g->netgame) { M_StartMessage(NETEND,NULL,false); return; } M_StartMessage(ENDGAME,M_EndGameResponse,true); }
void M_ChooseSkill(int choice) { if (choice == nightmare) { M_StartMessage(GStrings(NIGHTMARE),M_VerifyNightmare,true); return; } M_StartGame(choice); }
void M_EndGame(int choice) { choice = 0; if (!usergame) { S_Sound (CHAN_INTERFACE, "player/male/grunt1", 1, ATTN_NONE); return; } M_StartMessage(GStrings(multiplayer ? NETEND : ENDGAME), M_EndGameResponse, true); }
void M_Episode (int choice) { if ((gameinfo.flags & GI_SHAREWARE) && choice) { M_StartMessage(GStrings(SWSTRING),NULL,false); //M_SetupNextMenu(&ReadDef1); M_ClearMenus (); return; } epi = choice; M_SetupNextMenu(&NewDef); }
void M_NewGame(int choice) { if (::g->netgame && !::g->demoplayback) { M_StartMessage(NEWGAME,NULL,false); return; } if ( ::g->gamemode == commercial ) M_SetupNextMenu(&::g->ExpDef); else M_SetupNextMenu(&::g->EpiDef); }
// // Selected from DOOM menu // void M_SaveGame (int choice) { if (!::g->usergame) { M_StartMessage(SAVEDEAD,NULL,false); return; } else if( ::g->plyr && ::g->plyr->mo && ::g->plyr->mo->health <= 0 ) { M_StartMessage("you can't save if you're dead!\n\npress any button",NULL,false); return; } if (::g->gamestate != GS_LEVEL) return; // Reset back to what expansion we are currently playing. DoomLib::SetIdealExpansion( DoomLib::expansionSelected ); M_SetupNextMenu(&::g->SaveDef); M_ReadSaveStrings(); }
// // Selected from DOOM menu // [ML] 7 Sept 08: Bringing game saving/loading in from // zdoom 1.22 source, see MAINTAINERS // void M_SaveGame (int choice) { if (multiplayer && !demoplayback) { M_StartMessage("you can't save while in a net game!\n\npress a key.", NULL,false); M_ClearMenus (); return; } if (!usergame) { M_StartMessage(GStrings(SAVEDEAD),NULL,false); M_ClearMenus (); return; } if (gamestate != GS_LEVEL) return; M_SetupNextMenu(&SaveDef); M_ReadSaveStrings(); }
void M_NewGame(int choice) { choice = 0; if (netgame) { M_StartMessage(NEWGAME,NULL,false); return; } if ( gamemode == commercial ) M_SetupNextMenu(&NewDef); else M_SetupNextMenu(&EpiDef); }
// // Selected from DOOM menu // void M_LoadGame (int choice) { if (::g->netgame) { M_StartMessage(LOADNET,NULL,false); return; } if (::g->gamemode == commercial) { M_SetupNextMenu(&::g->LoadExpDef); } else{ M_SetupNextMenu(&::g->LoadDef); M_ReadSaveStrings(); } }
void M_QuickLoad(void) { /*if (netgame) { M_StartMessage(QLOADNET,NULL,false); return; }*/ if (quickSaveSlot < 0) { M_StartControlPanel(); M_LoadGame (0); return; } sprintf(tempstring,GStrings(QLPROMPT),savegamestrings[quickSaveSlot]); M_StartMessage(tempstring,M_QuickLoadResponse,true); }
void M_Episode(int choice) { if ( (gamemode == shareware) && choice) { M_StartMessage(SWSTRING,NULL,false); M_SetupNextMenu(&ReadDef1); } // Yet another hack... if ( (gamemode == registered) && (choice > 2)) { //printf( "M_Episode: 4th episode requires UltimateDOOM\n"); choice = 0; } epi = choice; M_SetupNextMenu(&NewDef); }
const msg_server_t *GetShortServersList(INT32 room) { static msg_server_t server_list[NUM_LIST_SERVER+1]; // +1 for easy test msg_t msg; INT32 i; // updated now oldroomnum = room; // we must be connected to the master server before writing to it if (MS_Connect(GetMasterServerIP(), GetMasterServerPort(), 0)) { CONS_Printf("cannot connect to the master server\n"); M_StartMessage("There was a problem connecting to\nthe Master Server", NULL, MM_NOTHING); return NULL; } msg.type = GET_SHORT_SERVER_MSG; msg.length = 0; msg.room = room; if (MS_Write(&msg) < 0) return NULL; for (i = 0; i < NUM_LIST_SERVER && MS_Read(&msg) >= 0; i++) { if (!msg.length) { server_list[i].header.buffer[0] = 0; CloseConnection(); return server_list; } M_Memcpy(&server_list[i], msg.buffer, sizeof (msg_server_t)); server_list[i].header.buffer[0] = 1; } CloseConnection(); if (i == NUM_LIST_SERVER) { server_list[i].header.buffer[0] = 0; return server_list; } else return NULL; }
void M_Episode (int choice) { if ((gameinfo.flags & GI_SHAREWARE) && choice) { M_StartMessage(GStrings(SWSTRING),NULL,false); //M_SetupNextMenu(&ReadDef1); M_ClearMenus (); return; } epi = choice; if (gameinfo.gametype & GAME_Heretic) { NewDef.menuitems = HereticNewGameMenu; NewDef.routine = NULL; NewDef.x = 38; NewDef.y = 30; } M_SetupNextMenu(&NewDef); }
void M_QuickSave(void) { if (!::g->usergame) { S_StartSound(NULL,sfx_oof); return; } if (::g->gamestate != GS_LEVEL) return; if (::g->quickSaveSlot < 0) { M_StartControlPanel(); M_ReadSaveStrings(); M_SetupNextMenu(&::g->SaveDef); ::g->quickSaveSlot = -2; // means to pick a slot now return; } sprintf(::g->tempstring,QSPROMPT,::g->savegamestrings[::g->quickSaveSlot]); M_StartMessage(::g->tempstring,M_QuickSaveResponse,true); }
INT32 GetRoomsList(boolean hosting) { static msg_ban_t banned_info[1]; msg_t msg; INT32 i; // we must be connected to the master server before writing to it if (MS_Connect(GetMasterServerIP(), GetMasterServerPort(), 0)) { CONS_Printf("cannot connect to the master server\n"); M_StartMessage("There was a problem connecting to\nthe Master Server", NULL, MM_NOTHING); return -1; } if (hosting) msg.type = GET_ROOMS_HOST_MSG; else msg.type = GET_ROOMS_MSG; msg.length = 0; msg.room = 0; if (MS_Write(&msg) < 0) { room_list[0].id = 1; strcpy(room_list[0].motd,"Master Server Offline."); strcpy(room_list[0].name,"Offline"); return -1; } for (i = 0; i < NUM_LIST_ROOMS && MS_Read(&msg) >= 0; i++) { if(msg.type == GET_BANNED_MSG) { char banmsg[1000]; M_Memcpy(&banned_info[0], msg.buffer, sizeof (msg_ban_t)); if (hosting) sprintf(banmsg, "You have been banned from\nhosting netgames.\n\nUnder the following IP Range:\n%s - %s\n\nFor the following reason:\n%s\n\nYour ban will expire on:\n%s",banned_info[0].ipstart,banned_info[0].ipend,banned_info[0].reason,banned_info[0].endstamp); else sprintf(banmsg, "You have been banned from\njoining netgames.\n\nUnder the following IP Range:\n%s - %s\n\nFor the following reason:\n%s\n\nYour ban will expire on:\n%s",banned_info[0].ipstart,banned_info[0].ipend,banned_info[0].reason,banned_info[0].endstamp); M_StartMessage(banmsg, NULL, MM_NOTHING); cv_internetserver.value = false; return -2; } if (!msg.length) { room_list[i].header.buffer[0] = 0; CloseConnection(); return 1; } M_Memcpy(&room_list[i], msg.buffer, sizeof (msg_rooms_t)); room_list[i].header.buffer[0] = 1; } CloseConnection(); if (i == NUM_LIST_ROOMS) { room_list[i].header.buffer[0] = 0; return 1; } else { room_list[0].id = 1; strcpy(room_list[0].motd,"Master Server Offline."); strcpy(room_list[0].name,"Offline"); return -1; } }
void M_SetMenu(FName menu, int param) { // some menus need some special treatment switch (menu) { case NAME_Episodemenu: // sent from the player class menu GameStartupInfo.Skill = -1; GameStartupInfo.Episode = -1; GameStartupInfo.PlayerClass = param == -1000? NULL : param == -1? "Random" : GetPrintableDisplayName(PlayerClasses[param].Type).GetChars(); break; case NAME_Skillmenu: // sent from the episode menu if ((gameinfo.flags & GI_SHAREWARE) && param > 0) { // Only Doom and Heretic have multi-episode shareware versions. M_StartMessage(GStrings("SWSTRING"), 1); return; } GameStartupInfo.Episode = param; M_StartupSkillMenu(&GameStartupInfo); // needs player class name from class menu (later) break; case NAME_StartgameConfirm: { // sent from the skill menu for a skill that needs to be confirmed GameStartupInfo.Skill = param; const char *msg = AllSkills[param].MustConfirmText; if (*msg==0) msg = GStrings("NIGHTMARE"); M_StartMessage (msg, 0, NAME_StartgameConfirmed); return; } case NAME_Startgame: // sent either from skill menu or confirmation screen. Skill gets only set if sent from skill menu // Now we can finally start the game. Ugh... GameStartupInfo.Skill = param; case NAME_StartgameConfirmed: G_DeferedInitNew (&GameStartupInfo); if (gamestate == GS_FULLCONSOLE) { gamestate = GS_HIDECONSOLE; gameaction = ga_newgame; } M_ClearMenus (); return; case NAME_Savegamemenu: if (!usergame || (players[consoleplayer].health <= 0 && !multiplayer) || gamestate != GS_LEVEL) { // cannot save outside the game. M_StartMessage (GStrings("SAVEDEAD"), 1); return; } } // End of special checks FMenuDescriptor **desc = MenuDescriptors.CheckKey(menu); if (desc != NULL) { if ((*desc)->mNetgameMessage.IsNotEmpty() && netgame && !demoplayback) { M_StartMessage((*desc)->mNetgameMessage, 1); return; } if ((*desc)->mType == MDESC_ListMenu) { FListMenuDescriptor *ld = static_cast<FListMenuDescriptor*>(*desc); if (ld->mAutoselect >= 0 && ld->mAutoselect < (int)ld->mItems.Size()) { // recursively activate the autoselected item without ever creating this menu. ld->mItems[ld->mAutoselect]->Activate(); } else { const PClass *cls = ld->mClass == NULL? RUNTIME_CLASS(DListMenu) : ld->mClass; DListMenu *newmenu = (DListMenu *)cls->CreateNew(); newmenu->Init(DMenu::CurrentMenu, ld); M_ActivateMenu(newmenu); } } else if ((*desc)->mType == MDESC_OptionsMenu) { FOptionMenuDescriptor *ld = static_cast<FOptionMenuDescriptor*>(*desc); const PClass *cls = ld->mClass == NULL? RUNTIME_CLASS(DOptionMenu) : ld->mClass; DOptionMenu *newmenu = (DOptionMenu *)cls->CreateNew(); newmenu->Init(DMenu::CurrentMenu, ld); M_ActivateMenu(newmenu); } return; } else { const PClass *menuclass = PClass::FindClass(menu); if (menuclass != NULL) { if (menuclass->IsDescendantOf(RUNTIME_CLASS(DMenu))) { DMenu *newmenu = (DMenu*)menuclass->CreateNew(); newmenu->mParentMenu = DMenu::CurrentMenu; M_ActivateMenu(newmenu); return; } } } Printf("Attempting to open menu of unknown type '%s'\n", menu.GetChars()); M_ClearMenus(); }