int current_skill;
-void Mod_Print (void);
-
dfunction_t *ED_FindFunction (char *name);
/*
==================
*/
-// LordHavoc: didn't like it asking me if I wanted to quit
-//extern void M_Menu_Quit_f (void);
-
+extern qboolean host_shuttingdown;
void Host_Quit_f (void)
{
- /*
- if (key_dest != key_console && cls.state != ca_dedicated)
- {
- M_Menu_Quit_f ();
- return;
- }
- */
+ host_shuttingdown = true;
CL_Disconnect ();
- Host_ShutdownServer(false);
+ Host_ShutdownServer(false);
Sys_Quit ();
}
int hours = 0;
int j;
void (*print) (char *fmt, ...);
-
+
if (cmd_source == src_command)
{
if (!sv.active)
print = SV_ClientPrintf;
print ("host: %s\n", Cvar_VariableString ("hostname"));
- print ("version: %4.2f (build %i)\n", VERSION, buildnumber);
+ print ("version: %s build %s\n", gamename, buildstring);
if (tcpipAvailable)
print ("tcp/ip: %s\n", my_tcpip_address);
if (ipxAvailable)
======================
Host_Map_f
-handle a
+handle a
map <servername>
command from the console. Active clients are kicked off.
======================
*/
void Host_Map_f (void)
{
- int i;
- char name[MAX_QPATH];
+ int i;
+ char name[MAX_QPATH];
if (cmd_source != src_command)
return;
cls.demonum = -1; // stop demo loop in case this fails
-// SCR_BeginLoadingPlaque ();
+ SCR_BeginLoadingPlaque ();
CL_Disconnect ();
- Host_ShutdownServer(false);
+ Host_ShutdownServer(false);
key_dest = key_game; // remove console or menu
SV_SpawnServer (name);
if (!sv.active)
return;
-
+
if (cls.state != ca_dedicated)
{
+ /*
strcpy (cls.spawnparms, "");
for (i=2 ; i<Cmd_Argc() ; i++)
strcat (cls.spawnparms, Cmd_Argv(i));
strcat (cls.spawnparms, " ");
}
-
+ */
Cmd_ExecuteString ("connect local", src_command);
- }
+ }
}
/*
*/
void Host_Reconnect_f (void)
{
-// SCR_BeginLoadingPlaque ();
+ SCR_BeginLoadingPlaque ();
cls.signon = 0; // need new connection messages
}
cls.demonum = -1; // stop demo loop in case this fails
if (cls.demoplayback)
- {
- CL_StopPlayback ();
CL_Disconnect ();
- }
strcpy (name, Cmd_Argv(1));
CL_EstablishConnection (name);
Host_Reconnect_f ();
===============
Host_SavegameComment
-Writes a SAVEGAME_COMMENT_LENGTH character comment describing the current
+Writes a SAVEGAME_COMMENT_LENGTH character comment describing the current
===============
*/
void Host_SavegameComment (char *text)
Con_Printf ("Relative pathnames are not allowed.\n");
return;
}
-
+
for (i=0 ; i<svs.maxclients ; i++)
{
if (svs.clients[i].active && (svs.clients[i].edict->v.health <= 0) )
sprintf (name, "%s/%s", com_gamedir, Cmd_Argv(1));
COM_DefaultExtension (name, ".sav");
-
+
Con_Printf ("Saving game to %s...\n", name);
f = Qopen (name, "w");
if (!f)
Con_Printf ("ERROR: couldn't open.\n");
return;
}
-
+
Qprintf (f, "%i\n", SAVEGAME_VERSION);
Host_SavegameComment (comment);
Qprintf (f, "%s\n", comment);
}
+extern mempool_t *edictstring_mempool;
+
/*
===============
Host_Loadgame_f
edict_t *ent;
int entnum;
int version;
- float spawn_parms[NUM_SPAWN_PARMS];
+ float spawn_parms[NUM_SPAWN_PARMS];
if (cmd_source != src_command)
return;
sprintf (name, "%s/%s", com_gamedir, Cmd_Argv(1));
COM_DefaultExtension (name, ".sav");
- // LordHavoc: made SCR_UpdateScreen use a great deal less stack space, no longer an issue
- //// we can't call SCR_BeginLoadingPlaque, because too much stack space has
- //// been used. The menu calls it before stuffing loadgame command
-// SCR_BeginLoadingPlaque ();
-
Con_Printf ("Loading game from %s...\n", name);
f = Qopen (name, "rz");
if (!f)
Con_Printf ("Savegame is version %i, not %i\n", version, SAVEGAME_VERSION);
return;
}
+
+ SCR_BeginLoadingPlaque ();
+
str = Qgetline (f);
for (i=0 ; i<NUM_SPAWN_PARMS ; i++) {
str = Qgetline (f);
Cvar_SetValue ("skill", (float)current_skill);
strcpy (mapname, Qgetline (f));
+
str = Qgetline (f);
sscanf (str, "%f\n",&time);
CL_Disconnect_f ();
-
+
SV_SpawnServer (mapname);
if (!sv.active)
{
for (i=0 ; i<MAX_LIGHTSTYLES ; i++)
{
str = Qgetline (f);
- sv.lightstyles[i] = Hunk_AllocName (strlen(str)+1, "lightstyles");
+ sv.lightstyles[i] = Mem_Alloc(edictstring_mempool, strlen(str)+1);
strcpy (sv.lightstyles[i], str);
}
*/
void Host_Name_f (void)
{
- char *newName;
+ char newName[64];
if (Cmd_Argc () == 1)
{
Con_Printf ("\"name\" is \"%s\"\n", cl_name.string);
return;
}
+
if (Cmd_Argc () == 2)
- newName = Cmd_Argv(1);
+ strncpy(newName, Cmd_Argv(1), 15);
else
- newName = Cmd_Args();
+ strncpy(newName, Cmd_Args(), 15);
newName[15] = 0;
if (cmd_source == src_command)
void Host_Version_f (void)
{
- Con_Printf ("Version %4.2f (build %i)\n", VERSION, buildnumber);
- Con_Printf ("Exe: "__TIME__" "__DATE__"\n");
+ Con_Printf ("Version: %s build %s\n", gamename, buildstring);
}
void Host_Say(qboolean teamonly)
{
if (!client || !client->active || !client->spawned)
continue;
- if (teamplay.value && teamonly && client->edict->v.team != save->edict->v.team)
+ if (teamplay.integer && teamonly && client->edict->v.team != save->edict->v.team)
continue;
host_client = client;
SV_ClientPrintf("%s", text);
int playercolor;
dfunction_t *f;
func_t SV_ChangeTeam;
-
+
if (Cmd_Argc() == 1)
{
- Con_Printf ("\"color\" is \"%i %i\"\n", ((int)cl_color.value) >> 4, ((int)cl_color.value) & 0x0f);
- Con_Printf ("color <0-13> [0-13]\n");
+ Con_Printf ("\"color\" is \"%i %i\"\n", cl_color.integer >> 4, cl_color.integer & 15);
+ Con_Printf ("color <0-15> [0-15]\n");
return;
}
// LordHavoc: allow skin colormaps 14 and 15 (was 13)
if (bottom > 15)
bottom = 15;
-
+
playercolor = top*16 + bottom;
if (cmd_source == src_command)
return;
}
- // 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_globals[OFS_PARM0] = playercolor;
pr_global_struct->self = EDICT_TO_PROG(host_client->edict);
PR_ExecuteProgram (SV_ChangeTeam, "");
}
Cmd_ForwardToServer ();
return;
}
- if (!pausable.value)
+ if (!pausable.integer)
SV_ClientPrintf ("Pause not allowed.\n");
else
{
// run the entrance script
if (sv.loadgame)
- { // loaded games are fully inited already
+ {
+ // loaded games are fully initialized already
// if this is the last client to be connected, unpause
sv.paused = false;
MSG_WriteByte (&host_client->message, i);
MSG_WriteByte (&host_client->message, client->colors);
}
-
+
// send all current light styles
for (i=0 ; i<MAX_LIGHTSTYLES ; i++)
{
MSG_WriteByte (&host_client->message, STAT_MONSTERS);
MSG_WriteLong (&host_client->message, pr_global_struct->killed_monsters);
-//
// send a fixangle
// Never send a roll angle, because savegames can catch the server
// in a state where it is expecting the client to correct the angle
t = Cmd_Argv(1);
v = atoi (Cmd_Argv(2));
-
+
switch (t[0])
{
- case '0':
- case '1':
- case '2':
- case '3':
- case '4':
- case '5':
- case '6':
- case '7':
- case '8':
- case '9':
- // MED 01/04/97 added hipnotic give stuff
- if (hipnotic)
- {
- if (t[0] == '6')
- {
- if (t[1] == 'a')
- sv_player->v.items = (int)sv_player->v.items | HIT_PROXIMITY_GUN;
- else
- sv_player->v.items = (int)sv_player->v.items | IT_GRENADE_LAUNCHER;
- }
- else if (t[0] == '9')
- sv_player->v.items = (int)sv_player->v.items | HIT_LASER_CANNON;
- else if (t[0] == '0')
- sv_player->v.items = (int)sv_player->v.items | HIT_MJOLNIR;
- else if (t[0] >= '2')
- sv_player->v.items = (int)sv_player->v.items | (IT_SHOTGUN << (t[0] - '2'));
- }
- else
- {
- if (t[0] >= '2')
- sv_player->v.items = (int)sv_player->v.items | (IT_SHOTGUN << (t[0] - '2'));
- }
+ case '0':
+ case '1':
+ case '2':
+ case '3':
+ case '4':
+ case '5':
+ case '6':
+ case '7':
+ case '8':
+ case '9':
+ // MED 01/04/97 added hipnotic give stuff
+ if (gamemode == GAME_HIPNOTIC)
+ {
+ if (t[0] == '6')
+ {
+ if (t[1] == 'a')
+ sv_player->v.items = (int)sv_player->v.items | HIT_PROXIMITY_GUN;
+ else
+ sv_player->v.items = (int)sv_player->v.items | IT_GRENADE_LAUNCHER;
+ }
+ else if (t[0] == '9')
+ sv_player->v.items = (int)sv_player->v.items | HIT_LASER_CANNON;
+ else if (t[0] == '0')
+ sv_player->v.items = (int)sv_player->v.items | HIT_MJOLNIR;
+ else if (t[0] >= '2')
+ sv_player->v.items = (int)sv_player->v.items | (IT_SHOTGUN << (t[0] - '2'));
+ }
+ else
+ {
+ if (t[0] >= '2')
+ sv_player->v.items = (int)sv_player->v.items | (IT_SHOTGUN << (t[0] - '2'));
+ }
break;
-
- case 's':
- if (rogue)
+
+ case 's':
+ if (gamemode == GAME_ROGUE)
{
- if ((val = GETEDICTFIELDVALUE(sv_player, eval_ammo_shells1)))
- val->_float = v;
+ if ((val = GETEDICTFIELDVALUE(sv_player, eval_ammo_shells1)))
+ val->_float = v;
}
- sv_player->v.ammo_shells = v;
- break;
- case 'n':
- if (rogue)
+ sv_player->v.ammo_shells = v;
+ break;
+ case 'n':
+ if (gamemode == GAME_ROGUE)
{
- if ((val = GETEDICTFIELDVALUE(sv_player, eval_ammo_nails1)))
+ if ((val = GETEDICTFIELDVALUE(sv_player, eval_ammo_nails1)))
{
- val->_float = v;
+ val->_float = v;
if (sv_player->v.weapon <= IT_LIGHTNING)
sv_player->v.ammo_nails = v;
}
{
sv_player->v.ammo_nails = v;
}
- break;
- case 'l':
- if (rogue)
+ break;
+ case 'l':
+ if (gamemode == GAME_ROGUE)
{
val = GETEDICTFIELDVALUE(sv_player, eval_ammo_lava_nails);
if (val)
sv_player->v.ammo_nails = v;
}
}
- break;
- case 'r':
- if (rogue)
+ break;
+ case 'r':
+ if (gamemode == GAME_ROGUE)
{
val = GETEDICTFIELDVALUE(sv_player, eval_ammo_rockets1);
if (val)
{
sv_player->v.ammo_rockets = v;
}
- break;
- case 'm':
- if (rogue)
+ break;
+ case 'm':
+ if (gamemode == GAME_ROGUE)
{
val = GETEDICTFIELDVALUE(sv_player, eval_ammo_multi_rockets);
if (val)
sv_player->v.ammo_rockets = v;
}
}
- break;
- case 'h':
- sv_player->v.health = v;
- break;
- case 'c':
- if (rogue)
+ break;
+ case 'h':
+ sv_player->v.health = v;
+ break;
+ case 'c':
+ if (gamemode == GAME_ROGUE)
{
val = GETEDICTFIELDVALUE(sv_player, eval_ammo_cells1);
if (val)
{
sv_player->v.ammo_cells = v;
}
- break;
- case 'p':
- if (rogue)
+ break;
+ case 'p':
+ if (gamemode == GAME_ROGUE)
{
val = GETEDICTFIELDVALUE(sv_player, eval_ammo_plasma);
if (val)
sv_player->v.ammo_cells = v;
}
}
- break;
- }
+ break;
+ }
}
edict_t *FindViewthing (void)
{
int i;
edict_t *e;
-
+
for (i=0 ; i<sv.num_edicts ; i++)
{
e = EDICT_NUM(i);
if (!e)
return;
- m = Mod_ForName (Cmd_Argv(1), false);
+ m = Mod_ForName (Cmd_Argv(1), false, true, false);
if (!m)
{
Con_Printf ("Can't load %s\n", Cmd_Argv(1));
void PrintFrameName (model_t *m, int frame)
{
- int data;
- data = (int) Mod_Extradata(m);
- if (m->ofs_scenes && data)
- Con_Printf("frame %i: %s\n", frame, ((animscene_t *) (m->ofs_scenes + data))[frame].name);
+ if (m->animscenes)
+ Con_Printf("frame %i: %s\n", frame, m->animscenes[frame].name);
else
Con_Printf("frame %i\n", frame);
}
*/
void Host_Stopdemo_f (void)
{
- if (cls.state == ca_dedicated)
- return;
if (!cls.demoplayback)
return;
- CL_StopPlayback ();
CL_Disconnect ();
}
{
Cmd_AddCommand ("status", Host_Status_f);
Cmd_AddCommand ("quit", Host_Quit_f);
- if (nehahra)
+ if (gamemode == GAME_NEHAHRA)
{
Cmd_AddCommand ("max", Host_God_f);
Cmd_AddCommand ("monster", Host_Notarget_f);
Cmd_AddCommand ("viewframe", Host_Viewframe_f);
Cmd_AddCommand ("viewnext", Host_Viewnext_f);
Cmd_AddCommand ("viewprev", Host_Viewprev_f);
-
- Cmd_AddCommand ("mcache", Mod_Print);
}
+