X-Git-Url: http://de.git.xonotic.org/?p=xonotic%2Fdarkplaces.git;a=blobdiff_plain;f=host_cmd.c;h=1e18df996305f07311dc68d1b8c91ac67cb35bd1;hp=f23dc033e169d160b604636af4a349fa41e11f28;hb=4f5f234f775525e477a78f7efcfe228d679a6f51;hpb=8dcce44300385b12c46d494c06aadcfa35a8bc14 diff --git a/host_cmd.c b/host_cmd.c index f23dc033..1e18df99 100644 --- a/host_cmd.c +++ b/host_cmd.c @@ -26,21 +26,26 @@ int current_skill; void Mod_Print (void); +dfunction_t *ED_FindFunction (char *name); + /* ================== Host_Quit_f ================== */ -extern void M_Menu_Quit_f (void); +// LordHavoc: didn't like it asking me if I wanted to quit +//extern void M_Menu_Quit_f (void); void Host_Quit_f (void) { + /* if (key_dest != key_console && cls.state != ca_dedicated) { M_Menu_Quit_f (); return; } + */ CL_Disconnect (); Host_ShutdownServer(false); @@ -118,7 +123,7 @@ void Host_God_f (void) return; } - if (pr_global_struct->deathmatch && !host_client->privileged) + if (pr_global_struct->deathmatch) return; sv_player->v.flags = (int)sv_player->v.flags ^ FL_GODMODE; @@ -136,7 +141,7 @@ void Host_Notarget_f (void) return; } - if (pr_global_struct->deathmatch && !host_client->privileged) + if (pr_global_struct->deathmatch) return; sv_player->v.flags = (int)sv_player->v.flags ^ FL_NOTARGET; @@ -156,7 +161,7 @@ void Host_Noclip_f (void) return; } - if (pr_global_struct->deathmatch && !host_client->privileged) + if (pr_global_struct->deathmatch) return; if (sv_player->v.movetype != MOVETYPE_NOCLIP) @@ -188,7 +193,7 @@ void Host_Fly_f (void) return; } - if (pr_global_struct->deathmatch && !host_client->privileged) + if (pr_global_struct->deathmatch) return; if (sv_player->v.movetype != MOVETYPE_FLY) @@ -707,59 +712,6 @@ void Host_Version_f (void) Con_Printf ("Exe: "__TIME__" "__DATE__"\n"); } -#ifdef IDGODS -void Host_Please_f (void) -{ - client_t *cl; - int j; - - if (cmd_source != src_command) - return; - - if ((Cmd_Argc () == 3) && strcmp(Cmd_Argv(1), "#") == 0) - { - j = atof(Cmd_Argv(2)) - 1; - if (j < 0 || j >= svs.maxclients) - return; - if (!svs.clients[j].active) - return; - cl = &svs.clients[j]; - if (cl->privileged) - { - cl->privileged = false; - cl->edict->v.flags = (int)cl->edict->v.flags & ~(FL_GODMODE|FL_NOTARGET); - cl->edict->v.movetype = MOVETYPE_WALK; - noclip_anglehack = false; - } - else - cl->privileged = true; - } - - if (Cmd_Argc () != 2) - return; - - for (j=0, cl = svs.clients ; jactive) - continue; - if (strcasecmp(cl->name, Cmd_Argv(1)) == 0) - { - if (cl->privileged) - { - cl->privileged = false; - cl->edict->v.flags = (int)cl->edict->v.flags & ~(FL_GODMODE|FL_NOTARGET); - cl->edict->v.movetype = MOVETYPE_WALK; - noclip_anglehack = false; - } - else - cl->privileged = true; - break; - } - } -} -#endif - - void Host_Say(qboolean teamonly) { client_t *client; @@ -898,6 +850,8 @@ void Host_Color_f(void) { int top, bottom; int playercolor; + dfunction_t *f; + func_t SV_ChangeTeam; if (Cmd_Argc() == 1) { @@ -933,13 +887,25 @@ void Host_Color_f(void) return; } - host_client->colors = playercolor; - host_client->edict->v.team = bottom + 1; + // void(float color) SV_ChangeTeam; + if ((f = ED_FindFunction ("SV_ChangeTeam")) && (SV_ChangeTeam = (func_t)(f - pr_functions))) + { + Con_DPrintf("Calling SV_ChangeTeam\n"); + pr_global_struct->time = sv.time; + pr_globals[0] = playercolor; + pr_global_struct->self = EDICT_TO_PROG(host_client->edict); + PR_ExecuteProgram (SV_ChangeTeam); + } + else + { + host_client->colors = playercolor; + host_client->edict->v.team = bottom + 1; -// send notification to all clients - MSG_WriteByte (&sv.reliable_datagram, svc_updatecolors); - MSG_WriteByte (&sv.reliable_datagram, host_client - svs.clients); - MSG_WriteByte (&sv.reliable_datagram, host_client->colors); + // send notification to all clients + MSG_WriteByte (&sv.reliable_datagram, svc_updatecolors); + MSG_WriteByte (&sv.reliable_datagram, host_client - svs.clients); + MSG_WriteByte (&sv.reliable_datagram, host_client->colors); + } } /* @@ -1029,8 +995,6 @@ void Host_PreSpawn_f (void) host_client->sendsignon = true; } -dfunction_t *ED_FindFunction (char *name); - /* ================== Host_Spawn_f @@ -1056,14 +1020,18 @@ void Host_Spawn_f (void) return; } + // LordHavoc: moved this above the QC calls at FrikaC's request +// send all current names, colors, and frag counts + SZ_Clear (&host_client->message); + // run the entrance script if (sv.loadgame) { // loaded games are fully inited allready // if this is the last client to be connected, unpause sv.paused = false; - if (f = ED_FindFunction ("RestoreGame")) - if (RestoreGame = (func_t)(f - pr_functions)) + if ((f = ED_FindFunction ("RestoreGame"))) + if ((RestoreGame = (func_t)(f - pr_functions))) { Con_DPrintf("Calling RestoreGame\n"); pr_global_struct->time = sv.time; @@ -1073,6 +1041,7 @@ void Host_Spawn_f (void) } else { + eval_t *val; // set up the edict ent = host_client->edict; @@ -1080,6 +1049,8 @@ void Host_Spawn_f (void) ent->v.colormap = NUM_FOR_EDICT(ent); ent->v.team = (host_client->colors & 15) + 1; ent->v.netname = host_client->name - pr_strings; + if ((val = GETEDICTFIELDVALUE(host_client->edict, eval_pmodel))) + val->_float = host_client->pmodel; // copy spawn parms out of the client_t @@ -1099,9 +1070,6 @@ void Host_Spawn_f (void) } -// send all current names, colors, and frag counts - SZ_Clear (&host_client->message); - // send time of update MSG_WriteByte (&host_client->message, svc_time); MSG_WriteFloat (&host_client->message, sv.time); @@ -1207,7 +1175,7 @@ void Host_Kick_f (void) return; } } - else if (pr_global_struct->deathmatch && !host_client->privileged) + else if (pr_global_struct->deathmatch) return; save = host_client; @@ -1295,7 +1263,7 @@ void Host_Give_f (void) return; } - if (pr_global_struct->deathmatch && !host_client->privileged) + if (pr_global_struct->deathmatch) return; t = Cmd_Argv(1); @@ -1340,7 +1308,7 @@ void Host_Give_f (void) case 's': if (rogue) { - if (val = GETEDICTFIELDVALUE(sv_player, eval_ammo_shells1)) + if ((val = GETEDICTFIELDVALUE(sv_player, eval_ammo_shells1))) val->_float = v; } @@ -1349,7 +1317,7 @@ void Host_Give_f (void) case 'n': if (rogue) { - if (val = GETEDICTFIELDVALUE(sv_player, eval_ammo_nails1)) + if ((val = GETEDICTFIELDVALUE(sv_player, eval_ammo_nails1))) { val->_float = v; if (sv_player->v.weapon <= IT_LIGHTNING) @@ -1501,15 +1469,15 @@ void Host_Viewframe_f (void) void PrintFrameName (model_t *m, int frame) { - aliashdr_t *hdr; - maliasframedesc_t *pframedesc; + maliashdr_t *mheader; + maliasframe_t *frameinfo; - hdr = (aliashdr_t *)Mod_Extradata (m); - if (!hdr) + mheader = (maliashdr_t *)Mod_Extradata (m); + if (!mheader) return; - pframedesc = &hdr->frames[frame]; + frameinfo = &((maliasframe_t *)(mheader->framedata + (int) mheader))[frame]; - Con_Printf ("frame %i: %s\n", frame, pframedesc->name); + Con_Printf ("frame %i: %s\n", frame, frameinfo->name); } /* @@ -1671,9 +1639,6 @@ void Host_InitCommands (void) Cmd_AddCommand ("reconnect", Host_Reconnect_f); Cmd_AddCommand ("name", Host_Name_f); Cmd_AddCommand ("version", Host_Version_f); -#ifdef IDGODS - Cmd_AddCommand ("please", Host_Please_f); -#endif Cmd_AddCommand ("say", Host_Say_f); Cmd_AddCommand ("say_team", Host_Say_Team_f); Cmd_AddCommand ("tell", Host_Tell_f);