void Command_Charability_f(void) { if (gamestate != GS_LEVEL || demoplayback) { CONS_Printf("%s", text[MUSTBEINLEVEL]); return; } G_ModifyGame(); if (COM_Argc() < 3) { CONS_Printf("charability <1/2> <value>\n"); return; } if (netgame || multiplayer) { CONS_Printf("%s", text[CANTUSEMULTIPLAYER]); return; } if (atoi(COM_Argv(1)) == 1) players[consoleplayer].charability = atoi(COM_Argv(2)); else if (atoi(COM_Argv(1)) == 2) players[consoleplayer].charability2 = atoi(COM_Argv(2)); else CONS_Printf("charability <1/2> <value>\n"); }
void Command_Ping_f(void) { #ifndef NEWPING if(server) { #endif INT32 i; for (i = 0; i < MAXPLAYERS;i++) { #ifndef NEWPING const INT32 node = playernode[i]; if (playeringame[i] && node != 0) CONS_Printf(M_GetText("%.2d : %s\n %d tics, %d ms.\n"), i, player_names[i], GetLag(node), G_TicsToMilliseconds(GetLag(node))); #else if (playeringame[i] && i != 0) CONS_Printf(M_GetText("%.2d : %s\n %d ms\n"), i, player_names[i], playerpingtable[i]); #endif } #ifndef NEWPING } else CONS_Printf(M_GetText("Only the server can use this.\n")); #endif }
void Command_Hurtme_f(void) { if (gamestate != GS_LEVEL || demoplayback) { CONS_Printf("%s", text[MUSTBEINLEVEL]); return; } if (!cv_debug) { CONS_Printf("%s", text[NEED_DEVMODE]); return; } if (netgame || multiplayer) { CONS_Printf("%s", text[CANTUSEMULTIPLAYER]); return; } if (COM_Argc() < 2) { CONS_Printf("hurtme <damage>\n"); return; } P_DamageMobj(players[consoleplayer].mo, NULL, NULL, atoi(COM_Argv(1))); }
void Command_Gravflip_f(void) { if (gamestate != GS_LEVEL || demoplayback) { CONS_Printf("%s", text[MUSTBEINLEVEL]); return; } if (!cv_debug) { CONS_Printf("%s", text[NEED_DEVMODE]); return; } if (netgame || multiplayer) { CONS_Printf("%s", text[SINGLEPLAYERONLY]); return; } if (players[consoleplayer].powers[pw_gravityboots]) players[consoleplayer].powers[pw_gravityboots] = 0; else players[consoleplayer].powers[pw_gravityboots] += 3600 * TICRATE; }
void Command_Scale_f(void) { INT32 scale = atoi(COM_Argv(1)); if (!cv_debug) { CONS_Printf("%s", text[NEED_DEVMODE]); return; } if (netgame || multiplayer) { CONS_Printf("%s", text[SINGLEPLAYERONLY]); return; } if (!(scale >= 5 && scale <= 400)) //COM_Argv(1) will return a null string if they did not give a paramater, so... { CONS_Printf("SCALE <value> (5-400): Set player scale size.\n"); return; } if (!players[consoleplayer].mo) return; players[consoleplayer].mo->destscale = (UINT16)scale; CONS_Printf("Scale set to %d\n", players[consoleplayer].mo->destscale); }
/// Start (or unpause) an ACS script in this map. Returns the script instance if succesful. acs_t *Map::ACS_StartScript(unsigned scriptnum, byte *args, Actor *triggerer, line_t *line, int side) { acs_script_t *s = ACS_FindScript(scriptnum); if (!s) { CONS_Printf("Map::StartACS: Unknown script number %d\n", scriptnum); return NULL; // not found } CONS_Printf("Starting ACS script %d\n", scriptnum); if (s->state == ACS_suspended) { s->state = ACS_running; // resume execution return s->instance; // FIXME problem? } if (s->state != ACS_stopped) return NULL; // already running or waiting for an event acs_t *script = new acs_t(s); script->triggerer = triggerer; script->line = line; script->side = side; for (unsigned i = 0; i < s->num_args; i++) script->vars[i] = args[i]; s->state = ACS_running; AddThinker(script); return script; }
/************************************************************************** * * function: CDAudio_GetAudioDiskInfo * * description: * set number of tracks if CD is available * **************************************************************************/ static INT32 CDAudio_GetAudioDiskInfo(void) { cdValid = SDL_FALSE; maxTrack = 0; if (!cdrom) return 0;//Alam: Lies! cdStatus = SDL_CDStatus(cdrom); if (!CD_INDRIVE(cdStatus)) { CONS_Printf("%s", M_GetText("No CD in drive\n")); return -1; } if (cdStatus == CD_ERROR) { CONS_Printf(M_GetText("CD Error: %s\n"), SDL_GetError()); return -1; } cdValid = SDL_TRUE; maxTrack = (Uint8)cdrom->numtracks; return 0; }
void UnregisterServer(void) { if (con_state != MSCS_REGISTERED) { con_state = MSCS_NONE; CloseConnection(); return; } con_state = MSCS_NONE; CONS_Printf("Unregistering this server to the master server...\n"); if (MS_Connect(registered_server.ip, registered_server.port, 0)) { CONS_Printf("cannot connect to the master server\n"); return; } if (RemoveFromMasterSever() < 0) CONS_Printf("cannot remove this server from the master server\n"); CloseConnection(); MSCloseUDPSocket(); MSLastPing = 0; }
/** Executes a script file. */ static void COM_Exec_f(void) { size_t length; UINT8 *buf = NULL; if (COM_Argc() < 2 || COM_Argc() > 3) { CONS_Printf("exec <filename> : run a script file\n"); return; } // load file length = FIL_ReadFile(COM_Argv(1), &buf); if (!buf) { if (!COM_CheckParm("-noerror")) CONS_Printf("couldn't execute file %s\n", COM_Argv(1)); return; } if (!COM_CheckParm("-silent")) CONS_Printf("executing %s\n", COM_Argv(1)); // insert text file into the command buffer COM_BufAddText((char *)buf); COM_BufAddText("\n"); // free buffer Z_Free(buf); }
static boolean NET_OpenSocket(void) { memset(clientaddress, 0, sizeof (clientaddress)); //CONS_Printf("SDL_Net Code starting up\n"); I_NetSend = NET_Send; I_NetGet = NET_Get; I_NetCloseSocket = NET_CloseSocket; I_NetFreeNodenum = NET_FreeNodenum; I_NetMakeNode = NET_NetMakeNode; //I_NetCanSend = NET_CanSend; // build the socket but close it first NET_CloseSocket(); mysocket = NET_Socket(); if (!mysocket) return false; // for select myset = SDLNet_AllocSocketSet(1); if (!myset) { CONS_Printf("SDL_Net: %s",SDLNet_GetError()); return false; } if (SDLNet_UDP_AddSocket(myset,mysocket) == -1) { CONS_Printf("SDL_Net: %s",SDLNet_GetError()); return false; } return true; }
/** Toggles a console variable. Useful for on/off values. * * This works on on/off, yes/no values only */ static void COM_Toggle_f(void) { consvar_t *cvar; if (COM_Argc() != 2) { CONS_Printf("Toggle <cvar_name>\n" "Toggle the value of a cvar\n"); return; } cvar = CV_FindVar(COM_Argv(1)); if (!cvar) { CONS_Printf("%s is not a cvar\n",COM_Argv(1)); return; } if (!(cvar->PossibleValue == CV_YesNo || cvar->PossibleValue == CV_OnOff)) { CONS_Printf("%s is not a boolean value\n",COM_Argv(1)); return; } // netcvar don't change imediately cvar->flags |= CV_SHOWMODIFONETIME; CV_AddValue(cvar, +1); }
static SINT8 NET_NetMakeNode(const char *hostname) { INT32 newnode; char *portchar; UINT16 portnum = sock_port; IPaddress hostnameIP; // retrieve portnum from address! { char *localhostname = strdup(hostname); strtok(localhostname, ":"); portchar = strtok(NULL, ":"); if (portchar) portnum = atoi(portchar); free(localhostname); } if (SDLNet_ResolveHost(&hostnameIP,hostname,portnum) == -1) { CONS_Printf("SDL_Net: %s",SDLNet_GetError()); return -1; } newnode = SDLNet_UDP_Bind(mysocket,-1,&hostnameIP); if (newnode == -1) { CONS_Printf("SDL_Net: %s",SDLNet_GetError()); return newnode; } newnode++; M_Memcpy(&clientaddress[newnode],&hostnameIP,sizeof (IPaddress)); return (SINT8)newnode; }
// Pass a null terminated list of files to use. // All files are optional, but at least one file must be found. // The name searcher looks backwards, so a later file does override all earlier ones. // Also adds GWA files if they exist. bool FileCache::InitMultipleFiles(const char *const*filenames) { CONS_Printf("Loading resource files...\n"); bool result = true; for ( ; *filenames != NULL; filenames++) { const char *curfile = *filenames; if (AddFile(curfile) == -1) result = false; // try finding corresponding GWA file (GL-nodes data) string gwafile(curfile); // Try lower case. gwafile.replace(gwafile.length()-3, 3, "gwa"); if (AddFile(gwafile.c_str(), true) == -1) { // not found, try upper case gwafile.replace(gwafile.length()-3, 3, "GWA"); if (AddFile(gwafile.c_str(), true) == -1) { // CONS_Printf(" No GL information for file %s.\n", curfile); continue; // not found } } CONS_Printf(" Added GL information from file %s.\n", gwafile.c_str()); } if (vfiles.size() == 0) I_Error("FileCache::InitMultipleFiles: no files found"); // result = false : at least one file was missing return result; }
void SCR_CheckDefaultMode(void) { INT32 scr_forcex, scr_forcey; // resolution asked from the cmd-line if (dedicated) return; // 0 means not set at the cmd-line scr_forcex = scr_forcey = 0; if (M_CheckParm("-width") && M_IsNextParm()) scr_forcex = atoi(M_GetNextParm()); if (M_CheckParm("-height") && M_IsNextParm()) scr_forcey = atoi(M_GetNextParm()); if (scr_forcex && scr_forcey) { CONS_Printf(M_GetText("Using resolution: %d x %d\n"), scr_forcex, scr_forcey); // returns -1 if not found, thus will be 0 (no mode change) if not found setmodeneeded = VID_GetModeForSize(scr_forcex, scr_forcey) + 1; } else { CONS_Printf(M_GetText("Default resolution: %d x %d (%d bits)\n"), cv_scr_width.value, cv_scr_height.value, cv_scr_depth.value); // see note above setmodeneeded = VID_GetModeForSize(cv_scr_width.value, cv_scr_height.value) + 1; } }
/** Gets a list of game servers from the master server. */ static INT32 GetServersList(void) { msg_t msg; INT32 count = 0; msg.type = GET_SERVER_MSG; msg.length = 0; msg.room = 0; if (MS_Write(&msg) < 0) return MS_WRITE_ERROR; while (MS_Read(&msg) >= 0) { if (!msg.length) { if (!count) CONS_Printf("No servers currently running.\n"); return MS_NO_ERROR; } count++; CONS_Printf("%s",msg.buffer); } return MS_READ_ERROR; }
/** Prints a line of text to the console. */ static void COM_Echo_f(void) { size_t i; for (i = 1; i < COM_Argc(); i++) CONS_Printf("%s ", COM_Argv(i)); CONS_Printf("\n"); }
void Command_CountMobjs_f(void) { thinker_t *th; mobjtype_t i; INT32 count; if (gamestate != GS_LEVEL) { CONS_Printf(M_GetText("You must be in a level to use this.\n")); return; } if (COM_Argc() >= 2) { size_t j; for (j = 1; j < COM_Argc(); j++) { i = atoi(COM_Argv(j)); if (i >= NUMMOBJTYPES) { CONS_Printf(M_GetText("Object number %d out of range (max %d).\n"), i, NUMMOBJTYPES-1); continue; } count = 0; for (th = thinkercap.next; th != &thinkercap; th = th->next) { if (th->function.acp1 != (actionf_p1)P_MobjThinker) continue; if (((mobj_t *)th)->type == i) count++; } CONS_Printf(M_GetText("There are %d objects of type %d currently in the level.\n"), count, i); } return; } CONS_Printf(M_GetText("Count of active objects in level:\n")); for (i = 0; i < NUMMOBJTYPES; i++) { count = 0; for (th = thinkercap.next; th != &thinkercap; th = th->next) { if (th->function.acp1 != (actionf_p1)P_MobjThinker) continue; if (((mobj_t *)th)->type == i) count++; } CONS_Printf(" * %d: %d\n", i, count); } }
void GameInfo::LoadGame(int slot) { CONS_Printf("Loading a game...\n"); char savename[255]; byte *savebuffer; sprintf(savename, savegamename, slot); int length = FIL_ReadFile(savename, &savebuffer); if (!length) { CONS_Printf("Couldn't open save file %s\n", savename); return; } LArchive a; if (!a.Open(savebuffer, length)) return; Z_Free(savebuffer); // the compressed buffer is no longer needed Downgrade(LEGACY_VERSION); // reset the game version SV_Reset(); ReadResourceLumps(); // dearchive all the modifications if (Unserialize(a)) { CONS_Printf("\aSavegame file corrupted!\n\n"); SV_Reset(); return; } SetState(GS_LEVEL); if (netgame) net->SV_Open(true); // let the remote players in paused = false; // view the local human players by default for (int i=0; i < NUM_LOCALHUMANS; i++) if (LocalPlayers[i].info) ViewPlayers.push_back(LocalPlayers[i].info); // TODO have other playerinfos waiting for clients to rejoin if (ViewPlayers.size()) hud.ST_Start(); // done /* if (setsizeneeded) R_ExecuteSetViewSize(); R_FillBackScreen(); // draw the pattern into the back screen */ con.Toggle(true); CONS_Printf("...done.\n"); }
// -------- // I_InitCD // Init CD Audio subsystem // -------- void I_InitCD (void) { MCI_SET_PARMS mciSet; MCIERROR iErr; int i; // We don't have an open device yet m_MCIOpen.wDeviceID = 0; m_nTracksCount = 0; cdaudio_started = false; m_MCIOpen.lpstrDeviceType = (LPCTSTR)MCI_DEVTYPE_CD_AUDIO; iErr = mciSendCommand(0, MCI_OPEN, MCI_OPEN_TYPE|MCI_OPEN_TYPE_ID, (DWORD_PTR)&m_MCIOpen); if (iErr) { MCIErrorMessageBox (iErr); return; } // Set the time format to track/minute/second/frame (TMSF). mciSet.dwTimeFormat = MCI_FORMAT_TMSF; iErr = mciSendCommand(m_MCIOpen.wDeviceID, MCI_SET, MCI_SET_TIME_FORMAT, (DWORD_PTR)&mciSet); if (iErr) { MCIErrorMessageBox (iErr); mciSendCommand(m_MCIOpen.wDeviceID, MCI_CLOSE, 0, 0); return; } I_AddExitFunc (I_ShutdownCD); cdaudio_started = true; CONS_Printf ("I_InitCD: CD Audio started\n"); // last saved in config.cfg i = cd_volume.value; //I_SetVolumeCD (0); // initialize to 0 for some odd cd drivers I_SetVolumeCD (i); // now set the last saved volume for (i = 0; i < MAX_CD_TRACKS; i++) cdRemap[i] = (UINT8)i; if (!CD_ReadTrackInfo()) { CONS_Printf("\2I_InitCD: no CD in player.\n"); cdEnabled = false; cdValid = false; } else { cdEnabled = true; cdValid = true; } COM_AddCommand ("cd", Command_Cd_f); }
static void wattcp_outch(char s) { static char old = '\0'; char pr[2] = {s,0}; if (s == old && old == ' ') return; else old = s; if (s == '\r') CONS_Printf("\n"); else if (s != '\n') CONS_Printf(pr); }
// Compile a script by name and dump it back to disk. void LUA_DumpFile(const char *filename) { FILE *handle; char filenamebuf[MAX_WADPATH]; if (!gL) // Lua needs to be initialized LUA_ClearState(false); // find the file the SRB2 way strncpy(filenamebuf, filename, MAX_WADPATH); filenamebuf[MAX_WADPATH - 1] = '\0'; filename = filenamebuf; if ((handle = fopen(filename, "rb")) == NULL) { // If we failed to load the file with the path as specified by // the user, strip the directories and search for the file. nameonly(filenamebuf); // If findfile finds the file, the full path will be returned // in filenamebuf == filename. if (findfile(filenamebuf, NULL, true)) { if ((handle = fopen(filename, "rb")) == NULL) { CONS_Alert(CONS_ERROR, M_GetText("Can't open %s\n"), filename); return; } } else { CONS_Alert(CONS_ERROR, M_GetText("File %s not found.\n"), filename); return; } } fclose(handle); // pass the path we found to Lua // luaL_loadfile will open and read the file in as a Lua function if (luaL_loadfile(gL, filename)) { CONS_Alert(CONS_ERROR,"%s\n",lua_tostring(gL,-1)); lua_pop(gL, 1); return; } // dump it back to disk if ((handle = fopen(filename, "wb")) == NULL) CONS_Alert(CONS_ERROR, M_GetText("Can't write to %s\n"), filename); if (lua_dump(gL, dumpWriter, handle)) CONS_Printf("Failed while writing %s to disk... Sorry!\n", filename); else CONS_Printf("Successfully compiled %s into bytecode.\n", filename); fclose(handle); lua_pop(gL, 1); // function is still on stack after lua_dump lua_gc(gL, LUA_GCCOLLECT, 0); return; }
void I_InitCD() { int i; const char *cdName; // Don't start music on a dedicated server if (M_CheckParm("-dedicated")) return ; // Has been checked in d_main.c, but doesn't hurt here if (M_CheckParm("-nocd")) return ; CONS_Printf(" Initializing CD audio...\n"); // Initialize SDL first if (SDL_Init(SDL_INIT_CDROM) < 0) { CONS_Printf(" Couldn't initialize SDL CD: %s\n", SDL_GetError()); return; } // Open drive cdrom = SDL_CDOpen(0); cdName = SDL_CDName(0); if (cdrom == NULL) { if (cdName == NULL) { CONS_Printf(" Couldn't open default CD-ROM drive: %s\n", SDL_GetError()); } else { CONS_Printf(" Couldn't open default CD-ROM drive %s: %s\n", cdName, SDL_GetError()); } return; } for (i = 0; i < MAX_CD_TRACKS; i++) cdRemap[i] = i; initialized = true; enabled = true; CDAudio_GetAudioDiskInfo(); COM.AddCommand("cd", Command_Cd_f); CONS_Printf(" CD audio initialized.\n"); return ; }
/// Builds the bot nodes for the Map, BotNodes::BotNodes(Map *m) { mp = m; // origin for the node grid xOrigin = m->root_bbox[BOXLEFT]; yOrigin = m->root_bbox[BOXBOTTOM]; xSize = x2PosX(m->root_bbox[BOXRIGHT]) + 1; ySize = y2PosY(m->root_bbox[BOXTOP]) + 1; numbotnodes = 0; botNodeArray = (SearchNode_t***)Z_Malloc(xSize * sizeof(SearchNode_t**), PU_LEVEL, 0); for (int i=0; i<xSize; i++) { botNodeArray[i] = (SearchNode_t**)Z_Malloc(ySize * sizeof(SearchNode_t*), PU_LEVEL, 0); for (int j=0; j<ySize; j++) botNodeArray[i][j] = NULL; } CONS_Printf("Building nodes for acbot.....\n"); SearchNode_t *temp; int px, py; multimap<int, mapthing_t *>::iterator t; for (t = m->playerstarts.begin(); t != m->playerstarts.end(); t++) { mapthing_t *mt = t->second; px = x2PosX(mt->x); py = y2PosY(mt->y); if (((px >= 0) && (px < xSize) && (py >= 0) && (py < ySize)) && (!botNodeArray[px][py])) { temp = botNodeArray[px][py] = new SearchNode_t(px, py, posX2x(px), posY2y(py)); numbotnodes++; BuildNodes(temp); } } int n = m->dmstarts.size(); for (int i = 0; i < n; i++) { px = x2PosX(m->dmstarts[i]->x); py = y2PosY(m->dmstarts[i]->y); if (((px >= 0) && (px < xSize) && (py >= 0) && (py < ySize)) && (!botNodeArray[px][py])) { temp = botNodeArray[px][py] = new SearchNode_t(px, py, posX2x(px), posY2y(py)); numbotnodes++; BuildNodes(temp); } } CONS_Printf("Completed building %d nodes.\n", numbotnodes); }
void Command_Resetemeralds_f(void) { if (netgame || multiplayer) { CONS_Printf("%s", text[SINGLEPLAYERONLY]); return; } emeralds = 0; CONS_Printf("Emeralds reset to zero.\n"); }
// Wrapper for COM_AddCommand static int lib_comAddCommand(lua_State *L) { int com_return = -1; const char *luaname = luaL_checkstring(L, 1); // must store in all lowercase char *name = Z_StrDup(luaname); strlwr(name); luaL_checktype(L, 2, LUA_TFUNCTION); NOHUD if (lua_gettop(L) >= 3) { // For the third argument, only take a boolean or a number. lua_settop(L, 3); if (lua_type(L, 3) != LUA_TBOOLEAN) luaL_checktype(L, 3, LUA_TNUMBER); } else { // No third argument? Default to 0. lua_settop(L, 2); lua_pushinteger(L, 0); } lua_getfield(L, LUA_REGISTRYINDEX, "COM_Command"); I_Assert(lua_istable(L, -1)); lua_createtable(L, 2, 0); lua_pushvalue(L, 2); lua_rawseti(L, -2, 1); lua_pushvalue(L, 3); lua_rawseti(L, -2, 2); lua_setfield(L, -2, name); // Try to add the Lua command com_return = COM_AddLuaCommand(name); if (com_return < 0) { // failed to add -- free the lowercased name and return error Z_Free(name); return luaL_error(L, "Couldn't add a new console command \"%s\"", luaname); } else if (com_return == 1) { // command existed already -- free our name as the old string will continue to be used CONS_Printf("Replaced command \"%s\"\n", name); Z_Free(name); } else { // new command was added -- do NOT free the string as it will forever be used by the console CONS_Printf("Added command \"%s\"\n", name); } return 0; }
/** Registers a variable for later use from the console. * * \param variable The variable to register. */ void CV_RegisterVar(consvar_t *variable) { // first check to see if it has already been defined if (CV_FindVar(variable->name)) { CONS_Printf("Variable %s is already defined\n", variable->name); return; } // check for overlap with a command if (COM_Exists(variable->name)) { CONS_Printf("%s is a command name\n", variable->name); return; } // check net variables if (variable->flags & CV_NETVAR) { variable->netid = CV_ComputeNetid(variable->name); if (CV_FindNetVar(variable->netid)) I_Error("Variable %s have same netid\n", variable->name); } // link the variable in if (!(variable->flags & CV_HIDEN)) { variable->next = consvar_vars; consvar_vars = variable; } variable->string = variable->zstring = NULL; variable->changed = 0; // new variable has not been modified by the user #ifdef PARANOIA if ((variable->flags & CV_NOINIT) && !(variable->flags & CV_CALL)) I_Error("variable %s has CV_NOINIT without CV_CALL", variable->name); if ((variable->flags & CV_CALL) && !variable->func) I_Error("variable %s has CV_CALL without a function", variable->name); #endif if (variable->flags & CV_NOINIT) variable->flags &= ~CV_CALL; Setvalue(variable, variable->defaultvalue, false); if (variable->flags & CV_NOINIT) variable->flags |= CV_CALL; // the SetValue will set this bit variable->flags &= ~CV_MODIFIED; }
void I_PlayCD (UINT8 track, UINT8 looping) { #ifdef NOSDLCD (void)track; (void)looping; #else if (!cdrom || !cdEnabled) return; if (!cdValid) { CDAudio_GetAudioDiskInfo(); if (!cdValid) return; } track = cdRemap[track]; if (track < 1 || track > maxTrack) { CONS_Printf("I_PlayCD: Bad track number %u.\n", track); return; } // don't try to play a non-audio track if (cdrom->track[track].type == SDL_DATA_TRACK) { CONS_Printf("I_PlayCD: track %u is not audio\n", track); return; } if (cdPlaying) { if (playTrack == track) return; I_StopCD(); } if (SDL_CDPlayTracks(cdrom, track, 0, 1, 0)) { CONS_Printf("Error playing track %d: %s\n", track, SDL_GetError()); return; } playLooping = looping; playTrack = (Uint8)track; cdPlaying = true; if (cd_volume.value == 0) I_PauseCD(); #endif }
static void NET_Get(void) { INT32 mystatus; INT32 newnode; mypacket.len = MAXPACKETLENGTH; if (!NET_CanGet()) { doomcom->remotenode = -1; // no packet return; } mystatus = SDLNet_UDP_Recv(mysocket,&mypacket); if (mystatus != -1) { if (mypacket.channel != -1) { doomcom->remotenode = mypacket.channel+1; // good packet from a game player doomcom->datalength = mypacket.len; return; } newnode = SDLNet_UDP_Bind(mysocket,-1,&mypacket.address); if (newnode != -1) { size_t i; newnode++; M_Memcpy(&clientaddress[newnode], &mypacket.address, sizeof (IPaddress)); DEBFILE(va("New node detected: node:%d address:%s\n", newnode, NET_GetNodeAddress(newnode))); doomcom->remotenode = newnode; // good packet from a game player doomcom->datalength = mypacket.len; for (i = 0; i < numbans; i++) { if (NET_cmpaddr(&mypacket.address, &banned[i])) { DEBFILE("This dude has been banned\n"); NET_bannednode[newnode] = true; break; } } if (i == numbans) NET_bannednode[newnode] = false; return; } else CONS_Printf("SDL_Net: %s",SDLNet_GetError()); } else if (mystatus == -1) { CONS_Printf("SDL_Net: %s",SDLNet_GetError()); } DEBFILE("New node detected: No more free slots\n"); doomcom->remotenode = -1; // no packet }
void I_PlayCD(int track, bool looping) { if (cdrom == NULL || !enabled) return; if (!cdValid) { CDAudio_GetAudioDiskInfo(); if (!cdValid) return; } track = cdRemap[track]; if (track < 1 || track > maxTrack) { CONS_Printf("I_PlayCD: Bad track number %u.\n", track); return; } // don't try to play a non-audio track if (cdrom->track[track].type == SDL_DATA_TRACK) { CONS_Printf("I_PlayCD: track %i is not audio\n", track); return; } if (playing) { if (playTrack == track) return; I_StopCD(); } if (SDL_CDPlayTracks(cdrom, track, 0, 1, 0)) { CONS_Printf("Error playing track %d: %s\n", track, SDL_GetError()); return; } playLooping = looping; playTrack = track; playing = true; if (cd_volume.value == 0) { I_PauseCD(); } }
void Command_CheatNoClip_f() { if (!game.server || !com_player) return; PlayerPawn *p = com_player->pawn; if (p == NULL) return; p->cheats ^= CF_NOCLIP; if (p->cheats & CF_NOCLIP) CONS_Printf (STSTR_NCON); else CONS_Printf (STSTR_NCOFF); }