Fix set_view altering pev properties instead of entity_state for rendering players (bug 5382, r=arkshine)

Former-commit-id: 89a65c6a7fc4e257580c0fcc1a759c0f5b488ae6
This commit is contained in:
connorr 2013-06-15 22:02:24 +02:00
parent f608ae76ed
commit de8257d7aa
4 changed files with 13 additions and 40 deletions

View File

@ -136,23 +136,12 @@ qboolean Voice_SetClientListening(int iReceiver, int iSender, qboolean bListen)
RETURN_META_VALUE(MRES_IGNORED, bListen); RETURN_META_VALUE(MRES_IGNORED, bListen);
} }
int AddToFullPack(struct entity_state_s *state, int e, edict_t *ent, edict_t *host, int hostflags, int player, unsigned char *pSet) int AddToFullPack_Post(struct entity_state_s *state, int e, edict_t *ent, edict_t *host, int hostflags, int player, unsigned char *pSet)
{ {
if(ent == host) { if( player && ent == host && plinfo[ENTINDEX(ent)].iViewType != CAMERA_NONE )
if(FStrEq(STRING(ent->v.classname), "player")) { {
if(plinfo[ENTINDEX(ent)].iViewType != CAMERA_NONE) { state->rendermode = kRenderTransTexture;
ent->v.rendermode = kRenderTransTexture; state->renderamt = 100;
ent->v.renderamt = 100;
RETURN_META_VALUE(MRES_IGNORED, 0);
}
}
}
if(FStrEq(STRING(ent->v.classname), "player")) {
if(plinfo[ENTINDEX(ent)].iViewType != CAMERA_NONE) {
ent->v.rendermode = plinfo[ENTINDEX(ent)].iRenderMode;
ent->v.renderamt = plinfo[ENTINDEX(ent)].fRenderAmt;
}
} }
RETURN_META_VALUE(MRES_IGNORED, 0); RETURN_META_VALUE(MRES_IGNORED, 0);
@ -173,8 +162,6 @@ void ClientDisconnect(edict_t *pEntity)
plinfo[id].iSpeakFlags = SPEAK_NORMAL; plinfo[id].iSpeakFlags = SPEAK_NORMAL;
plinfo[id].iViewType = CAMERA_NONE; plinfo[id].iViewType = CAMERA_NONE;
plinfo[id].iRenderMode = 0;
plinfo[id].fRenderAmt = 0;
RETURN_META(MRES_IGNORED); RETURN_META(MRES_IGNORED);
} }
@ -186,8 +173,6 @@ BOOL ClientConnect(edict_t *pEntity, const char *pszName, const char *pszAddress
plinfo[id].iSpeakFlags = SPEAK_NORMAL; plinfo[id].iSpeakFlags = SPEAK_NORMAL;
plinfo[id].iViewType = CAMERA_NONE; plinfo[id].iViewType = CAMERA_NONE;
plinfo[id].pViewEnt = NULL; plinfo[id].pViewEnt = NULL;
plinfo[id].iRenderMode = 0;
plinfo[id].fRenderAmt = 0;
RETURN_META_VALUE(MRES_IGNORED, 0); RETURN_META_VALUE(MRES_IGNORED, 0);
} }

View File

@ -414,13 +414,6 @@ static cell AMX_NATIVE_CALL set_view(AMX *amx, cell *params) {
plinfo[ENTINDEX(pPlayer)].iViewType = CAMERA_NONE; plinfo[ENTINDEX(pPlayer)].iViewType = CAMERA_NONE;
plinfo[ENTINDEX(pPlayer)].pViewEnt = NULL; plinfo[ENTINDEX(pPlayer)].pViewEnt = NULL;
pPlayer->v.rendermode = plinfo[ENTINDEX(pPlayer)].iRenderMode;
pPlayer->v.renderamt = plinfo[ENTINDEX(pPlayer)].fRenderAmt;
plinfo[ENTINDEX(pPlayer)].iRenderMode = 0;
plinfo[ENTINDEX(pPlayer)].fRenderAmt = 0;
return 1; return 1;
break; break;
case CAMERA_3RDPERSON: case CAMERA_3RDPERSON:
@ -429,10 +422,8 @@ static cell AMX_NATIVE_CALL set_view(AMX *amx, cell *params) {
return 1; return 1;
} }
g_CameraCount++; g_CameraCount++;
g_pFunctionTable->pfnAddToFullPack=AddToFullPack; g_pFunctionTable_Post->pfnAddToFullPack=AddToFullPack_Post;
g_pFunctionTable_Post->pfnPlayerPostThink=PlayerPostThink_Post; g_pFunctionTable_Post->pfnPlayerPostThink=PlayerPostThink_Post;
plinfo[ENTINDEX(pPlayer)].iRenderMode = pPlayer->v.rendermode;
plinfo[ENTINDEX(pPlayer)].fRenderAmt = pPlayer->v.renderamt;
plinfo[ENTINDEX(pPlayer)].iViewType = CAMERA_3RDPERSON; plinfo[ENTINDEX(pPlayer)].iViewType = CAMERA_3RDPERSON;
pNewCamera = CREATE_NAMED_ENTITY(MAKE_STRING("info_target")); pNewCamera = CREATE_NAMED_ENTITY(MAKE_STRING("info_target"));
@ -461,10 +452,8 @@ static cell AMX_NATIVE_CALL set_view(AMX *amx, cell *params) {
} }
g_CameraCount++; g_CameraCount++;
g_pFunctionTable->pfnAddToFullPack=AddToFullPack; g_pFunctionTable_Post->pfnAddToFullPack=AddToFullPack_Post;
g_pFunctionTable_Post->pfnPlayerPostThink=PlayerPostThink_Post; g_pFunctionTable_Post->pfnPlayerPostThink=PlayerPostThink_Post;
plinfo[ENTINDEX(pPlayer)].iRenderMode = pPlayer->v.rendermode;
plinfo[ENTINDEX(pPlayer)].fRenderAmt = pPlayer->v.renderamt;
plinfo[ENTINDEX(pPlayer)].iViewType = CAMERA_UPLEFT; plinfo[ENTINDEX(pPlayer)].iViewType = CAMERA_UPLEFT;
pNewCamera = CREATE_NAMED_ENTITY(MAKE_STRING("info_target")); pNewCamera = CREATE_NAMED_ENTITY(MAKE_STRING("info_target"));
@ -493,10 +482,8 @@ static cell AMX_NATIVE_CALL set_view(AMX *amx, cell *params) {
} }
g_CameraCount++; g_CameraCount++;
g_pFunctionTable->pfnAddToFullPack=AddToFullPack; g_pFunctionTable_Post->pfnAddToFullPack=AddToFullPack_Post;
g_pFunctionTable_Post->pfnPlayerPostThink=PlayerPostThink_Post; g_pFunctionTable_Post->pfnPlayerPostThink=PlayerPostThink_Post;
plinfo[ENTINDEX(pPlayer)].iRenderMode = pPlayer->v.rendermode;
plinfo[ENTINDEX(pPlayer)].fRenderAmt = pPlayer->v.renderamt;
plinfo[ENTINDEX(pPlayer)].iViewType = CAMERA_TOPDOWN; plinfo[ENTINDEX(pPlayer)].iViewType = CAMERA_TOPDOWN;
pNewCamera = CREATE_NAMED_ENTITY(MAKE_STRING("info_target")); pNewCamera = CREATE_NAMED_ENTITY(MAKE_STRING("info_target"));

View File

@ -11,6 +11,7 @@
#include <usercmd.h> #include <usercmd.h>
#include "entity.h" #include "entity.h"
#include "gpglobals.h" #include "gpglobals.h"
#include "entity_state.h"
extern DLL_FUNCTIONS *g_pFunctionTable; extern DLL_FUNCTIONS *g_pFunctionTable;
extern DLL_FUNCTIONS *g_pFunctionTable_Post; extern DLL_FUNCTIONS *g_pFunctionTable_Post;
@ -98,8 +99,8 @@ struct PlayerInfo {
int iSpeakFlags; int iSpeakFlags;
edict_t *pViewEnt; edict_t *pViewEnt;
int iViewType; int iViewType;
int iRenderMode; //int iRenderMode;
float fRenderAmt; //float fRenderAmt;
}; };
struct GlobalInfo { struct GlobalInfo {

View File

@ -124,7 +124,7 @@
// #define FN_PM_FindTextureType PM_FindTextureType /* pfnPM_FindTextureType() (wd) SDK2 */ // #define FN_PM_FindTextureType PM_FindTextureType /* pfnPM_FindTextureType() (wd) SDK2 */
// #define FN_SetupVisibility SetupVisibility /* pfnSetupVisibility() Set up PVS and PAS for networking for this client; (wd) SDK2 */ // #define FN_SetupVisibility SetupVisibility /* pfnSetupVisibility() Set up PVS and PAS for networking for this client; (wd) SDK2 */
// #define FN_UpdateClientData UpdateClientData /* pfnUpdateClientData() Set up data sent only to specific client; (wd) SDK2 */ // #define FN_UpdateClientData UpdateClientData /* pfnUpdateClientData() Set up data sent only to specific client; (wd) SDK2 */
#define FN_AddToFullPack AddToFullPack /* pfnAddToFullPack() (wd) SDK2 */ // #define FN_AddToFullPack AddToFullPack /* pfnAddToFullPack() (wd) SDK2 */
// #define FN_CreateBaseline CreateBaseline /* pfnCreateBaseline() Tweak entity baseline for network encoding allows setup of player baselines too.; (wd) SDK2 */ // #define FN_CreateBaseline CreateBaseline /* pfnCreateBaseline() Tweak entity baseline for network encoding allows setup of player baselines too.; (wd) SDK2 */
// #define FN_RegisterEncoders RegisterEncoders /* pfnRegisterEncoders() Callbacks for network encoding; (wd) SDK2 */ // #define FN_RegisterEncoders RegisterEncoders /* pfnRegisterEncoders() Callbacks for network encoding; (wd) SDK2 */
// #define FN_GetWeaponData GetWeaponData /* pfnGetWeaponData() (wd) SDK2 */ // #define FN_GetWeaponData GetWeaponData /* pfnGetWeaponData() (wd) SDK2 */
@ -176,7 +176,7 @@
// #define FN_PM_FindTextureType_Post PM_FindTextureType_Post // #define FN_PM_FindTextureType_Post PM_FindTextureType_Post
// #define FN_SetupVisibility_Post SetupVisibility_Post // #define FN_SetupVisibility_Post SetupVisibility_Post
// #define FN_UpdateClientData_Post UpdateClientData_Post // #define FN_UpdateClientData_Post UpdateClientData_Post
// #define FN_AddToFullPack_Post AddToFullPack_Post #define FN_AddToFullPack_Post AddToFullPack_Post
// #define FN_CreateBaseline_Post CreateBaseline_Post // #define FN_CreateBaseline_Post CreateBaseline_Post
// #define FN_RegisterEncoders_Post RegisterEncoders_Post // #define FN_RegisterEncoders_Post RegisterEncoders_Post
// #define FN_GetWeaponData_Post GetWeaponData_Post // #define FN_GetWeaponData_Post GetWeaponData_Post