]> de.git.xonotic.org Git - xonotic/darkplaces.git/blobdiff - host_cmd.c
new entity protocol has been canceled due to a fatal design flaw only detected today...
[xonotic/darkplaces.git] / host_cmd.c
index 4852da38f29fd41ec163ef72390f3210d35acde3..f2737124f97d6926cddb0ac4cc097afff20a3cf5 100644 (file)
@@ -486,7 +486,7 @@ void Host_Loadgame_f (void)
                return;
        }
 
-       sprintf (sv_loadgame, "%s/%s", fs_gamedir, Cmd_Argv(1));
+       strcpy (sv_loadgame, Cmd_Argv(1));
        FS_DefaultExtension (sv_loadgame, ".sav");
 
        Con_Printf ("Loading game from %s...\n", sv_loadgame);
@@ -602,11 +602,11 @@ void Host_PerformLoadGame(char *name)
                        // parse an edict
                        ent = EDICT_NUM(entnum);
                        memset (ent->v, 0, progs->entityfields * 4);
-                       ent->free = false;
+                       ent->e->free = false;
                        ED_ParseEdict (start, ent);
 
                        // link it into the bsp tree
-                       if (!ent->free)
+                       if (!ent->e->free)
                                SV_LinkEdict (ent, false);
                }
 
@@ -665,7 +665,7 @@ void Host_Name_f (void)
                if (strcmp(host_client->name, newName) != 0)
                        Con_Printf ("%s renamed to %s\n", host_client->name, newName);
        strcpy (host_client->name, newName);
-       host_client->edict->v->netname = PR_SetString(host_client->name);
+       sv_player->v->netname = PR_SetString(host_client->name);
 
 // send notification to all clients
 
@@ -883,13 +883,13 @@ void Host_Color_f(void)
                Con_DPrintf("Calling SV_ChangeTeam\n");
                pr_global_struct->time = sv.time;
                pr_globals[OFS_PARM0] = playercolor;
-               pr_global_struct->self = EDICT_TO_PROG(host_client->edict);
+               pr_global_struct->self = EDICT_TO_PROG(sv_player);
                PR_ExecuteProgram (SV_ChangeTeam, "");
        }
        else
        {
                host_client->colors = playercolor;
-               host_client->edict->v->team = bottom + 1;
+               sv_player->v->team = bottom + 1;
 
                // send notification to all clients
                MSG_WriteByte (&sv.reliable_datagram, svc_updatecolors);
@@ -918,7 +918,7 @@ void Host_Kill_f (void)
        }
 
        pr_global_struct->time = sv.time;
-       pr_global_struct->self = EDICT_TO_PROG(sv_player);
+       pr_global_struct->self = EDICT_TO_PROG(host_client->edict);
        PR_ExecuteProgram (pr_global_struct->ClientKill, "QC function ClientKill is missing");
 }
 
@@ -1014,6 +1014,8 @@ void Host_Spawn_f (void)
 // send all current names, colors, and frag counts
        SZ_Clear (&host_client->message);
 
+       ent = sv_player;
+
 // run the entrance script
        if (sv.loadgame)
        {
@@ -1034,13 +1036,11 @@ void Host_Spawn_f (void)
        {
                eval_t *val;
                // set up the edict
-               ent = host_client->edict;
-
-               memset (ent->v, 0, progs->entityfields * 4);
+               ED_ClearEdict(ent);
                ent->v->colormap = NUM_FOR_EDICT(ent);
                ent->v->team = (host_client->colors & 15) + 1;
                ent->v->netname = PR_SetString(host_client->name);
-               if ((val = GETEDICTFIELDVALUE(host_client->edict, eval_pmodel)))
+               if ((val = GETEDICTFIELDVALUE(ent, eval_pmodel)))
                        val->_float = host_client->pmodel;
 
                // copy spawn parms out of the client_t
@@ -1110,7 +1110,6 @@ void Host_Spawn_f (void)
 // in a state where it is expecting the client to correct the angle
 // and it won't happen if the game was just loaded, so you wind up
 // with a permanent head tilt
-       ent = EDICT_NUM( 1 + (host_client - svs.clients) );
        MSG_WriteByte (&host_client->message, svc_setangle);
        for (i=0 ; i < 2 ; i++)
                MSG_WriteAngle (&host_client->message, ent->v->angles[i] );