From: black Date: Mon, 13 Dec 2004 16:20:15 +0000 (+0000) Subject: -Fixed the stupid bug introduced by my NEX_PLAYERMODEL/NEX_PLAYERSKIN commit. X-Git-Tag: xonotic-v0.1.0preview~5300 X-Git-Url: http://git.xonotic.org/?p=xonotic%2Fdarkplaces.git;a=commitdiff_plain;h=8da5e844ba7488e7bc78b4f18fe5324f1526a6d0 -Fixed the stupid bug introduced by my NEX_PLAYERMODEL/NEX_PLAYERSKIN commit. -Hopefully playermodel and playerskin work still now. git-svn-id: svn://svn.icculus.org/twilight/trunk/darkplaces@4839 d7cf8633-e32d-0410-b094-e92efae38249 --- diff --git a/host_cmd.c b/host_cmd.c index 6272c143..882d7e7a 100644 --- a/host_cmd.c +++ b/host_cmd.c @@ -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) diff --git a/pr_edict.c b/pr_edict.c index 884bff1a..62688275 100644 --- a/pr_edict.c +++ b/pr_edict.c @@ -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; diff --git a/progdefs.h b/progdefs.h index 82b589d6..14e2e919 100644 --- a/progdefs.h +++ b/progdefs.h @@ -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 8e717d3f..5e01bd87 100644 --- 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) diff --git a/sv_main.c b/sv_main.c index 48c3b912..afdd8c79 100644 --- 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; diff --git a/sv_user.c b/sv_user.c index b870bf59..7015dd50 100644 --- 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);