]> de.git.xonotic.org Git - xonotic/darkplaces.git/commitdiff
-Fixed the stupid bug introduced by my NEX_PLAYERMODEL/NEX_PLAYERSKIN commit.
authorblack <black@d7cf8633-e32d-0410-b094-e92efae38249>
Mon, 13 Dec 2004 16:20:15 +0000 (16:20 +0000)
committerblack <black@d7cf8633-e32d-0410-b094-e92efae38249>
Mon, 13 Dec 2004 16:20:15 +0000 (16:20 +0000)
-Hopefully playermodel and playerskin work still now.

git-svn-id: svn://svn.icculus.org/twilight/trunk/darkplaces@4839 d7cf8633-e32d-0410-b094-e92efae38249

host_cmd.c
pr_edict.c
progdefs.h
progs.h
sv_main.c
sv_user.c

index 6272c143bbcd7adf500944fb9c373eb045997021..882d7e7a4264f66955b8402a67e1482447dd3585 100644 (file)
@@ -812,7 +812,8 @@ void Host_Playermodel_f (void)
 
        // point the string back at updateclient->name to keep it safe
        strlcpy (host_client->playermodel, newPath, sizeof (host_client->playermodel));
-       host_client->edict->v->playermodel = PR_SetString(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)
@@ -872,7 +873,8 @@ void Host_Playerskin_f (void)
 
        // point the string back at updateclient->name to keep it safe
        strlcpy (host_client->playerskin, newPath, sizeof (host_client->playerskin));
-       host_client->edict->v->playerskin = PR_SetString(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)
index 884bff1af04d70374d2f6f3b584f0a959dd050e5..62688275ad08d60e94774ae820caf11d3c469dc3 100644 (file)
@@ -134,6 +134,8 @@ int eval_cursor_trace_start;
 int eval_cursor_trace_endpos;
 int eval_cursor_trace_ent;
 int eval_colormod;
+int eval_playermodel;
+int eval_playerskin;
 
 mfunction_t *SV_PlayerPhysicsQC;
 mfunction_t *EndFrameQC;
@@ -200,6 +202,8 @@ void FindEdictFieldOffsets(void)
        eval_cursor_trace_endpos = FindFieldOffset("cursor_trace_endpos");
        eval_cursor_trace_ent = FindFieldOffset("cursor_trace_ent");
        eval_colormod = FindFieldOffset("colormod");
+       eval_playermodel = FindFieldOffset("playermodel");
+       eval_playerskin = FindFieldOffset("playerskin");
 
        // LordHavoc: allowing QuakeC to override the player movement code
        SV_PlayerPhysicsQC = ED_FindFunction ("SV_PlayerPhysics");
@@ -236,8 +240,10 @@ void ED_ClearEdict (edict_t *e)
                if ((val = GETEDICTFIELDVALUE(e, eval_clientcolors)))
                        val->_float = svs.clients[num].colors;
                // NEXUIZ_PLAYERMODEL and NEXUIZ_PLAYERSKIN
-               e->v->playermodel = PR_SetString(svs.clients[num].playermodel);
-               e->v->playerskin = PR_SetString(svs.clients[num].playerskin);
+               if( eval_playermodel )
+                       GETEDICTFIELDVALUE(host_client->edict, eval_playermodel)->string = PR_SetString(svs.clients[num].playermodel);
+               if( eval_playerskin )
+                       GETEDICTFIELDVALUE(host_client->edict, eval_playerskin)->string = PR_SetString(svs.clients[num].playerskin);
        }
 }
 
@@ -1002,7 +1008,7 @@ qboolean ED_ParseEpair(edict_t *ent, ddef_t *key, const char *s)
                        Con_DPrintf("ED_ParseEpair: Can't find field %s\n", s);
                        return false;
                }
-               //val->_int = G_INT(def->ofs); AK Please check this - seems to be an org. quake bug
+               //val->_int = G_INT(def->ofs); // AK Please check this - seems to be an org. quake bug
                val->_int = def->ofs;
                break;
 
index 82b589d691f5094be22ff7366f245ff3cefb8e19..14e2e919cbc1abff7818b0a07fcc1ce9abf4079a 100644 (file)
@@ -161,8 +161,6 @@ typedef struct
        string_t        noise1;
        string_t        noise2;
        string_t        noise3;
-       string_t        playermodel;
-       string_t        playerskin;
 } entvars_t;
 
 #define PROGHEADER_CRC 5927
diff --git a/progs.h b/progs.h
index 8e717d3f54e53e80ad17ccde258289735ac4dd2e..5e01bd87262b04adf87e1af7112853955b652e50 100644 (file)
--- a/progs.h
+++ b/progs.h
@@ -131,6 +131,8 @@ extern int eval_cursor_trace_start;
 extern int eval_cursor_trace_endpos;
 extern int eval_cursor_trace_ent;
 extern int eval_colormod;
+extern int eval_playermodel;
+extern int eval_playerskin;
 
 #define GETEDICTFIELDVALUE(ed, fieldoffset) (fieldoffset ? (eval_t *)((qbyte *)ed->v + fieldoffset) : NULL)
 
index 48c3b912b25af65f50a4de3f6ee8a2fc5d8e74e4..afdd8c7965a7843c9c1330e4d78963346999c35c 100644 (file)
--- a/sv_main.c
+++ b/sv_main.c
@@ -1160,20 +1160,24 @@ void SV_UpdateToReliableMessages (void)
                }
 
                // NEXUIZ_PLAYERMODEL
-               model = PR_GetString(host_client->edict->v->playermodel);
-               if (model == NULL)
-                       model = "";
-               // always point the string back at host_client->name to keep it safe
-               strlcpy (host_client->playermodel, model, sizeof (host_client->playermodel));
-               host_client->edict->v->playermodel = PR_SetString(host_client->playermodel);
+               if( eval_playermodel ) {
+                       model = PR_GetString(GETEDICTFIELDVALUE(host_client->edict, eval_playermodel)->string);
+                       if (model == NULL)
+                               model = "";
+                       // always point the string back at host_client->name to keep it safe
+                       strlcpy (host_client->playermodel, model, sizeof (host_client->playermodel));
+                       GETEDICTFIELDVALUE(host_client->edict, eval_playermodel)->string = PR_SetString(host_client->playermodel);
+               }
 
                // NEXUIZ_PLAYERSKIN
-               skin = PR_GetString(host_client->edict->v->playerskin);
-               if (skin == NULL)
-                       skin = "";
-               // always point the string back at host_client->name to keep it safe
-               strlcpy (host_client->playerskin, skin, sizeof (host_client->playerskin));
-               host_client->edict->v->playerskin = PR_SetString(host_client->playerskin);
+               if( eval_playerskin ) {
+                       skin = PR_GetString(GETEDICTFIELDVALUE(host_client->edict, eval_playerskin)->string);
+                       if (skin == NULL)
+                               skin = "";
+                       // always point the string back at host_client->name to keep it safe
+                       strlcpy (host_client->playerskin, skin, sizeof (host_client->playerskin));
+                       GETEDICTFIELDVALUE(host_client->edict, eval_playerskin)->string = PR_SetString(host_client->playerskin);
+               }
 
                // frags
                host_client->frags = (int)host_client->edict->v->frags;
index b870bf596646f287a904fcbd4d03552fd76b66a3..7015dd5011f4b35539296d0df1e9be79bea43710 100644 (file)
--- a/sv_user.c
+++ b/sv_user.c
@@ -794,7 +794,7 @@ void SV_ReadClientMessage(void)
                         || strncasecmp(s, "pmodel", 6) == 0
                         || strncasecmp(s, "rate", 4) == 0
                         || strncasecmp(s, "playermodel", 11) == 0
-                        || strncasecmp(s, "playerskin", 10) == 00
+                        || strncasecmp(s, "playerskin", 10) == 0
                         || (gamemode == GAME_NEHAHRA && (strncasecmp(s, "max", 3) == 0 || strncasecmp(s, "monster", 7) == 0 || strncasecmp(s, "scrag", 5) == 0 || strncasecmp(s, "gimme", 5) == 0 || strncasecmp(s, "wraith", 6) == 0))
                         || (gamemode != GAME_NEHAHRA && (strncasecmp(s, "god", 3) == 0 || strncasecmp(s, "notarget", 8) == 0 || strncasecmp(s, "fly", 3) == 0 || strncasecmp(s, "give", 4) == 0 || strncasecmp(s, "noclip", 6) == 0)))
                                Cmd_ExecuteString (s, src_client);