unknowncheats uc-forum.com ucdownloads ucdownloads.com

Go Back   UC-Tutorials - Multiplayer Game Hacking and Cheat Tutorials > Programming > C and C++

- Sponsored Advertisement -
http://www.myfpscheats.com/


Reply
 
Thread Tools Display Modes
  #1  
Old 12-23-2006, 07:00 AM
zero_tolerance zero_tolerance is offline
Senior Member
 
Join Date: Dec 2006
Posts: 289
Default Steps (joolz)

By Shu Shiwa

Tutorial: Steps (joolz)

Difficulté du tutorial : *****

j'ai pris ce tuto et je l'ai testé sur une joolz de base et ca marche nikel
donc si ca marche pas chez vous,
refaites les étapes une a une car il y en a pas mal !!!

MAIS FAITES UNE SAUVEGARDE DE VOTRE SOURCE AVANT D'AJOUTER CE TUTO, ON C JAMAIS !!!


cvars a ajouter dans client.cpp avec les autres :
Code:
	cmd.AddCvarInt("sounddisplay",&cvar.sounddisplay);
	cmd.AddCvarInt("soundfilter",&cvar.soundfilter);// what sounds should be displayed? (enum)
	cmd.AddCvarInt("soundtol",   &cvar.soundtol);   // filter tolerance (200 works best)
	cmd.AddCvarInt("soundmax",   &cvar.soundmax);  // max nr of displayed sounds
	cmd.AddCvarInt("colorsteps",&cvar.colorsteps);
	cmd.AddCvarInt("soundradar",&cvar.soundradar);
dans cvar.h avec les autres :
Code:
int sounddisplay;
int soundfilter;
int soundtol;
int soundmax;
int colorsteps;
int soundradar;
Ajouter le fichier Gpatch.cpp au projet et mettre Gpatch.h dans le répertoire racine

A télécharger ici

//===========================================================================================
//===========================================================================================
//=================================== Client.cpp ============================================
//===========================================================================================
//===========================================================================================

dessous
Code:
#include "engine\studio.h"
#include "sprites.h"
mettre

Code:
#include "GPatch.h"

//===========================================================================================

en haut juste avant
Code:
int WallActive(void)
{
	return cvar.wallhack;
}
mettre

Code:
extern GPatch soundPatch;
extern bool detour_S_DynamicSound();

// ====== sound data
static ColorEntry dummycolor;
class SoundMarker
{
public:
	SoundMarker() : color(&dummycolor),priority(0) {} // "snd_default"

	float origin[3];
	char  description[16];
	int team;
	int index;
	StopTimer timer;
	ColorEntry* color;
	int priority; // 0/1/2
};
typedef vector<SoundMarker> SoundMarkerVector;
SoundMarkerVector vecSoundMarker(65);
int soundMarkerCurrentIndex = 0;
//===========================================================================================

après
Code:
HSPRITE	SPR_Load(const char *szPicName)
{
OGC_TRY
	HSPRITE spr = gEngfuncs.pfnSPR_Load (szPicName);
	
	if(strstr(szPicName,"sniper_scope"))   sniper_scope = spr;
	else if(strstr(szPicName,"ch_sniper")) ch_sniper = spr;

    add_sprite (spr, szPicName);
	
	return spr;
OGC_CATCH(return 0;)
}
Mettre

Code:
bool passesSoundFilter(const float* const origin)
{
	if( GetPseudoDistance(origin,me.pmOrigin)<cvar.soundtol ){ return false; }

	int ax=0;
	switch(cvar.soundfilter)
	{
	case 1:
		for (ax=0;ax<vPlayers.size();ax++)
		{
			if( vPlayers[ax].inpvs) 
			{
				if( GetPseudoDistance(vPlayers[ax].ent->origin, origin)<cvar.soundtol )
				{
					return false;
				}
			}
		}
		return true;
	
	case 2:
		for (ax=0;ax<vPlayers.size();ax++)
		{
			if( vPlayers[ax].inpvs && !isEnemy(ax) )
			{
				if( GetPseudoDistance(vPlayers[ax].ent->origin, origin)<cvar.soundtol )
				{
					return false;
				}
			}
		}
		return true;
	
	default:
		return true;
	}
}
//========================================================================================
inline void strcpy_x(char* dest, const char* pos)
{
	do{ 
		while( *pos>='0' && *pos<='9' )  ++pos; // ignore numbers
		
		if(*pos=='.')              {*dest=0;break; } // cut off ".wav"
		*dest=*pos;
		++dest;
		++pos; 
	}
	while(*pos);
}

//========================================================================================
inline void strcpy_x2(char* dest, const char* pos)
{
	do{ 
		if(*pos=='.'||*pos=='-'||*pos=='_') {*dest=0;break; } // cut off ".wav"
		*dest=*pos;
		++dest;
		++pos; 
	}
	while(*pos);
}

//========================================================================================
void PreS_DynamicSound(const DWORD a,const DWORD b,const DWORD c,const char*const sample,
						 const float*const origin,DWORD f,const DWORD g,const DWORD h)
{
	if(!cvar.soundfilter) { return; }

	BOUND_VALUE(soundMarkerCurrentIndex,0,64);
	SoundMarker& ref = vecSoundMarker[soundMarkerCurrentIndex];

	// setup color and description of sound marker depending on it's type
	// or drop it if it doesn't pass the filter
	if(sample[0]=='p' && sample[3]=='y' && sample[6]=='/')  // "player/pl_step1.wav"
	{
		if(!passesSoundFilter(origin)) return;
		const char* pos = sample+7;
		if(pos[0]=='p' && pos[2]=='_') // pl_xx
		{
			if(pos[3]=='s' && pos[4]=='h' && pos[5]=='e' && pos[6]=='l' )  return; // pl_shell#      
			pos+=3;

			if(cvar.colorsteps)
			{
				ColorEntry* tmcolor = PlayerColor(GetPlayerByIndex(b));
				ref.color = tmcolor;
			}else{
				ref.color    = colorList.get(32); // "snd_step"
			}

			ref.priority = 0;
		}
		strcpy_x(ref.description,pos);
	}
	else
	{
		return;
	}

	// activate sound marker
	VectorCopy( origin, ref.origin );
	ref.timer.countdown( cvar.soundtime );
	
	// advance to next sound marker
	++soundMarkerCurrentIndex;
	if(soundMarkerCurrentIndex>=cvar.soundmax){ soundMarkerCurrentIndex=0;}
}
//===========================================================================================

Dans int Initialize( cl_enginefunc_t *pEnginefuncs, int iVersion )
Code:
	// SOUND ESP
	detour_S_DynamicSound();
	soundPatch.apply();
//===========================================================================================

Sous
Code:
	if(cvar.radar&&special){ drawRadarPoint(EntViewOrg,color->r,color->g,color->b,special); }
				
	if(cvar.esp && CalcScreen(EntViewOrg,vecScreen) && (!special||blinkPhase) )
	{
		weapon[strlen(weapon)-4]=(char)0;
		DrawHudStringCenter(vecScreen[0],vecScreen[1],color->r,color->g,color->b,weapon);
	}
}
Mettre

Code:
void drawSound()
{
	int old = cvar.confont;cvar.confont = 1;
	for(int pri=0;pri<3;pri++)
	for(int i=0;i<cvar.soundmax;i++)
	{
		SoundMarker& ref = vecSoundMarker[i];
		if( ref.priority==pri && ref.timer.running() )
		{  
			ColorEntry* clr = colorList.get(6);

			if(cvar.sounddisplay==1)
			{
				float timeleft = ref.timer.timeleft();
				int alpha = (int)( (255.0f/cvar.soundtime)*(timeleft) );
				
				float distance = GetPseudoDistance(me.pmOrigin, ref.origin);
				int boxradius = (int)(3000.0f/distance);
				BOUND_VALUE(boxradius,2,40);

				clr->compiled &= 0xFFFFFF00;
				clr->compiled += alpha;

				gDrawFilledBoxAtLocation( ref.origin, clr->compiled, boxradius );
			} else if(cvar.sounddisplay==2) {
				float vecScreen[2];
				if (CalcScreen(ref.origin,vecScreen))
				{					
					DrawHudStringCenter(vecScreen[0],vecScreen[1],ref.color->r,ref.color->g,ref.color->b,ref.description);
				}
			}

			if(cvar.soundradar)
			{
				drawRadarPoint(ref.origin,ref.color->r,ref.color->g,ref.color->b);			
			}
		}
	}
	cvar.confont = old;
}
//===========================================================================================

Remplacer

float GetPseudoDistance(float* pos1, float* pos2)
par
float GetPseudoDistance(const float* pos1, const float* pos2)

//===========================================================================================

Chercher
Code:
// Draw console?
	      if (cvar.info)	 	{ displayInformation();   }
		if (cvar.crosshair ) { drawCrosshair();        }
		if (cvar.czoom)	    { handleContinuousZoom(); }
		if (cvar.radar)	    { drawRadarFrame      (); }
		if (OGC_Console_Active) { drawConsole     (); }
		if (curMenu)        { drawMenu            (); }
et rajouter
Code:
if (cvar.soundfilter)	{ drawSound();}


//===========================================================================================
//===========================================================================================
//=================================== Winmain.cpp ===========================================
//===========================================================================================
//===========================================================================================
dessous
Code:
#include "utils.h"
#include "cvar.h"
mettre

Code:
#include "GPatch.h"
//===========================================================================================

en dessous
Code:
using namespace std;
Mettre

Code:
GPatch soundPatch;
//===========================================================================================

en dessous
Code:
	last_fake += diff_fake;
	last_real += diff_real;

	return ret;
}
mettre

Code:
void PreS_DynamicSound(const DWORD a,const DWORD entindex,const DWORD c,const char*const sample,const float*const origin,DWORD f,const DWORD g,const DWORD h);
static DWORD sound_reloc_addr1=0;
__declspec(naked) void JumpGate_DynamicSound()
{
    __asm{
        // 8 args on stack
		call PreS_DynamicSound;  

        // exec caller instructions & jump back
        sub esp,0x48;
        
        mov  eax, soundPatch.patchloc;
        add  eax, soundPatch.patchsize;
        push eax;
        
        mov  eax,sound_reloc_addr1;
        mov  eax,[eax];

        ret;
	}
}

bool detour_S_DynamicSound()
{
        static bool applied = false;
        if( applied )   { return true; }
		applied = true;
		//assert(stackret);

        BYTE* offs = (BYTE*)0x01D7E3B0;
		BYTE* sig   = (BYTE*)"\x83\xEC\x48\xA1\x00\x00\x00\x00";
		char* mask  = "xxxx????";

		
		if(!soundPatch.find_location(offs,sig,mask))
		{
				MessageBox(0,"blah","blah",0);
                return false;
		}
		//soundPatch.set_location(offs,8);
		
	
		// prepare patch:
		soundPatch.patchdata[0]=0x68;
		*(DWORD*)(soundPatch.patchdata+1) = (DWORD)JumpGate_DynamicSound;
		soundPatch.patchdata[5]=0xC3;
		soundPatch.patchdata[6]=0x90;
		soundPatch.patchdata[7]=0x90;

        // relocated addr needed in detour
		sound_reloc_addr1 = *(DWORD*)(soundPatch.backup+4);

		// soundPatch.apply();// applied in dynamic_hook()

        return true;
}
//===========================================================================================


Okay maintenant avec

soundfilter 3;soundmax 8;sounddisplay 2;colorsteps 1;
soundradar 1 vous avez les steps sur le radar

Kiffez bien !!!

© S3 2003
© www.CsCodes.net 2004
Reply With Quote
Reply

  • Submit Thread to Digg
  • Submit Thread to del.icio.us
  • Submit Thread to StumbleUpon
  • Submit Thread to Google
  • Submit Thread to Facebook
  • Submit Thread to My Yahoo!
  • Submit Thread to MySpace
  • Submit Thread to Twitter
  • Submit Thread to Reddit

Tags
joolz, steps

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off



All times are GMT. The time now is 06:17 AM.