All pastes #907156 Raw Edit

CG_SYSCALL

public cpp v1 · immutable
·published 2008-02-17 08:58 UTC
rendered paste body
#include "main.h"#include "syscall.h"bool Player::Friendly( int Num ){	if( cgs->clientinfo[ Num ].team == cgs->clientinfo[ cg->clientNum ].team )			return true;	return false;}bool Player::Enemy( int Num ){	if( cgs->clientinfo[ Num ].team != cgs->clientinfo[ cg->clientNum ].team )			return true;	return false;}bool Player::Both( int Num){	centity_t *cent;	if( Is_A_Player > MAX_GENTITIES ) 	{		return false; 	}	cent = &cg_entities[Is_A_Player];	if ( cent->currentState.clientNum > MAX_CLIENTS )	{		return false; 	}	if ( cent->currentState.eType != ET_PLAYER  || cent->currentState.eFlags & EF_DEAD ) 	{		return false; 	}	return true;}int (QDECL *psyscall)(int cmd, ...);int QDECL osyscall(int cmd, ...){		 LPVOID arg[10];	 va_list arglist;	 va_start( arglist, cmd );	 for( int i = 9, j = 0; i > 0; i-- )		 arg[j++] = va_arg( arglist, LPVOID );	 va_end( arglist );	 refEntity_t * re = (refEntity_t *)arg[0]; 	 switch(cmd) 	 {	 	 case CG_R_ADDREFENTITYTOSCENE:		 int Num = re->entityNum;		 if(cg_entities[Num].currentValid && cg_entities[re->entityNum].currentState.solid && Player::Both( re->entityNum ) && (re->renderfx == 32) || (re->renderfx ==33))			re->renderfx |= RF_DEPTHHACK | RF_NOSHADOW | RF_HILIGHT; //Wallhack		 if(Player::Friendly( Num ))			re->customShader = 14; //Friend		 if(Player::Enemy( Num ))			re->renderfx |= RF_DEPTHHACK | RF_NOSHADOW | RF_HILIGHT; //Enemy		 break;	 }	 return psyscall(cmd, arg[0], arg[1], arg[2], arg[3], arg[4], arg[5], arg[6], arg[7], arg[8], arg[9]); //return the original}