X-Git-Url: http://de.git.xonotic.org/?p=xonotic%2Fdarkplaces.git;a=blobdiff_plain;f=host_cmd.c;h=21ad53e6ee25648a4d5f916509a867dd269e7c75;hp=dda37a1f23d328f3b1598121f924ac889066b7cb;hb=7101ee8792b04808dbe15d80a06bdad5c281db20;hpb=48978ee14d2f77912ad239c5797fc23f12a2fc94 diff --git a/host_cmd.c b/host_cmd.c index dda37a1f..21ad53e6 100644 --- a/host_cmd.c +++ b/host_cmd.c @@ -65,8 +65,8 @@ void Host_Status_f (void) for (players = 0, j = 0;j < svs.maxclients;j++) if (svs.clients[j].active) players++; - print ("host: %s\n", Cvar_VariableString ("hostname")); - print ("version: %s build %s\n", gamename, buildstring); + print ("host: %s\n", Cvar_VariableString ("hostname")); + print ("version: %s build %s\n", gamename, buildstring); switch(sv.protocol) { case PROTOCOL_QUAKE: protocolname = sv.netquakecompatible ? "QUAKE" : "QUAKEDP";break; @@ -75,11 +75,12 @@ void Host_Status_f (void) case PROTOCOL_DARKPLACES3: protocolname = "PROTOCOL_DARKPLACES3";break; case PROTOCOL_DARKPLACES4: protocolname = "PROTOCOL_DARKPLACES4";break; case PROTOCOL_DARKPLACES5: protocolname = "PROTOCOL_DARKPLACES5";break; + case PROTOCOL_DARKPLACES6: protocolname = "PROTOCOL_DARKPLACES6";break; default: protocolname = "PROTOCOL_UNKNOWN";break; } print ("protocol: %i (%s)\n", sv.protocol, protocolname); - print ("map: %s\n", sv.name); - print ("players: %i active (%i max)\n\n", players, svs.maxclients); + print ("map: %s\n", sv.name); + print ("players: %i active (%i max)\n\n", players, svs.maxclients); for (j = 0, client = svs.clients;j < svs.maxclients;j++, client++) { if (!client->active) @@ -275,7 +276,6 @@ void Host_Map_f (void) if (cmd_source != src_command) return; - SCR_BeginLoadingPlaque (); cls.demonum = -1; // stop demo loop in case this fails CL_Disconnect (); @@ -303,7 +303,7 @@ Goes to a new map, taking all clients along void Host_Changelevel_f (void) { char level[MAX_QPATH]; - + if (Cmd_Argc() != 2) { Con_Print("changelevel : continue game on a new level\n"); @@ -322,7 +322,6 @@ void Host_Changelevel_f (void) key_consoleactive = 0; SV_SaveSpawnparms (); - SCR_BeginLoadingPlaque(); allowcheats = sv_cheats.integer != 0; strcpy(level, Cmd_Argv(1)); SV_SpawnServer(level); @@ -340,7 +339,7 @@ Restarts the current server for a dead player void Host_Restart_f (void) { char mapname[MAX_QPATH]; - + if (Cmd_Argc() != 1) { Con_Print("restart : restart current level\n"); @@ -358,7 +357,6 @@ void Host_Restart_f (void) key_dest = key_game; key_consoleactive = 0; - SCR_BeginLoadingPlaque(); allowcheats = sv_cheats.integer != 0; strcpy(mapname, sv.name); SV_SpawnServer(mapname); @@ -386,7 +384,6 @@ void Host_Reconnect_f (void) //Con_Print("reconnect: no signon, ignoring reconnect\n"); return; } - SCR_BeginLoadingPlaque(); cls.signon = 0; // need new connection messages } @@ -503,7 +500,7 @@ void Host_Savegame_f (void) FS_DefaultExtension (name, ".sav", sizeof (name)); Con_Printf("Saving game to %s...\n", name); - f = FS_Open (name, "w", false); + f = FS_Open (name, "wb", false, false); if (!f) { Con_Print("ERROR: couldn't open.\n"); @@ -519,8 +516,7 @@ void Host_Savegame_f (void) FS_Printf(f, "%s\n", sv.name); FS_Printf(f, "%f\n",sv.time); -// write the light styles - + // write the light styles for (i=0 ; i= MAX_EDICTS) + { + Mem_Free(text); Host_Error("Host_PerformLoadGame: too many edicts in save file (reached MAX_EDICTS %i)\n", MAX_EDICTS); + } while (entnum >= sv.max_edicts) SV_IncreaseEdicts(); ent = EDICT_NUM(entnum); @@ -690,8 +682,6 @@ void Host_Loadgame_f (void) sv.num_edicts = entnum; sv.time = time; - FS_Close (f); - for (i = 0;i < NUM_SPAWN_PARMS;i++) svs.clients[0].spawn_parms[i] = spawn_parms[i]; @@ -742,7 +732,7 @@ void Host_Name_f (void) SV_ClientPrintf("You can't change name more than once every 5 seconds!\n"); return; } - + host_client->nametime = sv.time + 5; // point the string back at updateclient->name to keep it safe @@ -760,6 +750,128 @@ void Host_Name_f (void) } } +/* +====================== +Host_Playermodel_f +====================== +*/ +cvar_t cl_playermodel = {CVAR_SAVE, "_cl_playermodel", ""}; +// the old cl_playermodel in cl_main has been renamed to __cl_playermodel +void Host_Playermodel_f (void) +{ + int i, j; + char newPath[sizeof(host_client->playermodel)]; + + if (Cmd_Argc () == 1) + { + Con_Printf("\"playermodel\" is \"%s\"\n", cl_playermodel.string); + return; + } + + if (Cmd_Argc () == 2) + strlcpy (newPath, Cmd_Argv(1), sizeof (newPath)); + else + strlcpy (newPath, Cmd_Args(), sizeof (newPath)); + + for (i = 0, j = 0;newPath[i];i++) + if (newPath[i] != '\r' && newPath[i] != '\n') + newPath[j++] = newPath[i]; + newPath[j] = 0; + + if (cmd_source == src_command) + { + Cvar_Set ("_cl_playermodel", newPath); + if (cls.state == ca_connected) + Cmd_ForwardToServer (); + return; + } + + /* + if (sv.time < host_client->nametime) + { + SV_ClientPrintf("You can't change playermodel more than once every 5 seconds!\n"); + return; + } + + host_client->nametime = sv.time + 5; + */ + + // point the string back at updateclient->name to keep it safe + strlcpy (host_client->playermodel, newPath, sizeof (host_client->playermodel)); + if( eval_playermodel ) + GETEDICTFIELDVALUE(host_client->edict, eval_playermodel)->string = PR_SetString(host_client->playermodel); + if (strcmp(host_client->old_model, host_client->playermodel)) + { + if (host_client->spawned) + SV_BroadcastPrintf("%s changed model to %s\n", host_client->old_model, host_client->playermodel); + strcpy(host_client->old_model, host_client->playermodel); + /*// send notification to all clients + MSG_WriteByte (&sv.reliable_datagram, svc_updatepmodel); + MSG_WriteByte (&sv.reliable_datagram, host_client - svs.clients); + MSG_WriteString (&sv.reliable_datagram, host_client->playermodel);*/ + } +} + +/* +====================== +Host_Playerskin_f +====================== +*/ +cvar_t cl_playerskin = {CVAR_SAVE, "_cl_playerskin", ""}; +void Host_Playerskin_f (void) +{ + int i, j; + char newPath[sizeof(host_client->playerskin)]; + + if (Cmd_Argc () == 1) + { + Con_Printf("\"playerskin\" is \"%s\"\n", cl_playerskin.string); + return; + } + + if (Cmd_Argc () == 2) + strlcpy (newPath, Cmd_Argv(1), sizeof (newPath)); + else + strlcpy (newPath, Cmd_Args(), sizeof (newPath)); + + for (i = 0, j = 0;newPath[i];i++) + if (newPath[i] != '\r' && newPath[i] != '\n') + newPath[j++] = newPath[i]; + newPath[j] = 0; + + if (cmd_source == src_command) + { + Cvar_Set ("_cl_playerskin", newPath); + if (cls.state == ca_connected) + Cmd_ForwardToServer (); + return; + } + + /* + if (sv.time < host_client->nametime) + { + SV_ClientPrintf("You can't change playermodel more than once every 5 seconds!\n"); + return; + } + + host_client->nametime = sv.time + 5; + */ + + // point the string back at updateclient->name to keep it safe + strlcpy (host_client->playerskin, newPath, sizeof (host_client->playerskin)); + if( eval_playerskin ) + GETEDICTFIELDVALUE(host_client->edict, eval_playerskin)->string = PR_SetString(host_client->playerskin); + if (strcmp(host_client->old_skin, host_client->playerskin)) + { + if (host_client->spawned) + SV_BroadcastPrintf("%s changed skin to %s\n", host_client->old_skin, host_client->playerskin); + strcpy(host_client->old_skin, host_client->playerskin); + /*// send notification to all clients + MSG_WriteByte (&sv.reliable_datagram, svc_updatepskin); + MSG_WriteByte (&sv.reliable_datagram, host_client - svs.clients); + MSG_WriteString (&sv.reliable_datagram, host_client->playerskin);*/ + } +} void Host_Version_f (void) { @@ -805,9 +917,9 @@ void Host_Say(qboolean teamonly) p1++; } if (!fromServer) - snprintf (text, sizeof(text), "%c%s: %s", 1, host_client->name, p1); + dpsnprintf (text, sizeof(text), "%c%s: %s", 1, host_client->name, p1); else - snprintf (text, sizeof(text), "%c<%s> %s", 1, hostname.string, p1); + dpsnprintf (text, sizeof(text), "%c<%s> %s", 1, hostname.string, p1); p2 = text + strlen(text); while ((const char *)p2 > (const char *)text && (p2[-1] == '\r' || p2[-1] == '\n' || (p2[-1] == '\"' && quoted))) { @@ -825,7 +937,7 @@ void Host_Say(qboolean teamonly) SV_ClientPrint(text); host_client = save; - Sys_Print(&text[1]); + //Con_Print(&text[1]); } @@ -1130,6 +1242,7 @@ void Host_Spawn_f (void) client_t *client; func_t RestoreGame; mfunction_t *f; + int stats[MAX_CL_STATS]; if (cmd_source == src_command) { @@ -1184,7 +1297,7 @@ void Host_Spawn_f (void) PR_ExecuteProgram (pr_global_struct->ClientConnect, "QC function ClientConnect is missing"); if ((Sys_DoubleTime() - host_client->connecttime) <= sv.time) - Sys_Printf("%s entered the game\n", host_client->name); + Con_Printf("%s entered the game\n", host_client->name); PR_ExecuteProgram (pr_global_struct->PutClientInServer, "QC function PutClientInServer is missing"); } @@ -1244,7 +1357,7 @@ void Host_Spawn_f (void) MSG_WriteAngle (&host_client->message, host_client->edict->v->angles[1], sv.protocol); MSG_WriteAngle (&host_client->message, 0, sv.protocol); - SV_WriteClientdataToMessage (host_client->edict, &host_client->message); + SV_WriteClientdataToMessage (host_client, host_client->edict, &host_client->message, stats); MSG_WriteByte (&host_client->message, svc_signonnum); MSG_WriteByte (&host_client->message, 3); @@ -1657,7 +1770,7 @@ void Host_Startdemos_f (void) Con_Printf("Max %i demos in demoloop\n", MAX_DEMOS); c = MAX_DEMOS; } - Con_DPrintf("%i demo(s) in loop\n", c); + Con_Printf("%i demo(s) in loop\n", c); for (i=1 ; i