Need Help (menu)

Posts 111 of 11 · Page 1 of 1
Need Help (menu)
Hi im only asking if u can say me where is the problem in the (menu) Source code. Im actualy new i C++ so i need help

here is the code :
Code:
#include "stdafx.h"
#include "cMenu.h"
#include "cSound.h"
#include "cBase.h"
#include "cCrypt.h"
#include "Sounds.h"
//-----------------------------------------------------------------------------
// Name: PostReset()
// Desc: Creates Fonts and other Resources for Menu
//-----------------------------------------------------------------------------

void cMenu::PostReset(LPDIRECT3DDEVICE8 pDevice)
{
	font = new cFont("Tahoma", 7, FT_BOLD);
	font->InitDeviceObjects(pDevice);
	font->RestoreDeviceObjects();
	
}
//-----------------------------------------------------------------------------
// Name: PreReset()
// Desc: Releases Fonts / objects for menu
//-----------------------------------------------------------------------------

void cMenu::PreReset(void)
{
	font->InvalidateDeviceObjects();
	font->DeleteDeviceObjects();
	delete font;
	font = NULL;
}

//-----------------------------------------------------------------------------
// Name: Init()
// Desc: Load Menu Defaults / Prepare Menu For Usage
//-----------------------------------------------------------------------------

void cMenu::Init()
{
	if (opt.options.reset)INIT=false;
	if(!INIT){
		opt.options.move=0;		// BUG FIX FOR RESET DISABLE MOVE BEFORE SETTING COORDINATES
		X=Y=10;			        // TOP LEFT START
		WIDTH=175;			    // MENU WIDTH
		I_OFS=4;			    // OFSET FOR ITEM
		S_OFS=WIDTH-2;			// OFSET FOR STATE
		T_SPC=16;				// Space from Title and Start of Items
		F_SPC=16;				// Footer Spacing Hook Menu
		I_SPC=15;				// Item Spacing
		I_CUR=0;				// Set current Item
		ABOR=0;					// ANIMATION MOVE
		BDIR=0;					// ANIMATION HIGHLIGHT
		SHOW=true;				// false=hide  true=show
		INIT=true;				// STOP INITATION
	}
}

//-----------------------------------------------------------------------------
// Name: FPS()
// Desc: Keeps Track of Current Frames Persecond Make sure if its already called to specify a 1 as parameter
//-----------------------------------------------------------------------------

char* cMenu::FPS(int en)
{
	static int	 FPScounter = 0;
	static float FPSfLastTickCount = 0.0f;
	static float FPSfCurrentTickCount;
	static char  cfps[6] = "";

	if(!en)
	{
		FPSfCurrentTickCount = clock() * 0.001f;
		FPScounter++;

		if((FPSfCurrentTickCount - FPSfLastTickCount) > 1.0f)
		{
			FPSfLastTickCount = FPSfCurrentTickCount;
			sprintf(cfps," %d",FPScounter);
			FPScounter = 0;
		}
	}

	return cfps;

}

//-----------------------------------------------------------------------------
// Name: TIME()
// Desc: Outputs Current Time in USA Format
//-----------------------------------------------------------------------------

char* cMenu::TIME(void)
{
	static char ctime[20] = "" ;
	struct tm * current_tm;
	time_t current_time;
	time (&current_time);
	current_tm = localtime (&current_time);
	if(current_tm->tm_hour>12)
		sprintf( ctime, "%d:%02d:%02d PM", current_tm->tm_hour - 12, current_tm->tm_min, current_tm->tm_sec );
	else
		sprintf( ctime, "%d:%02d:%02d AM", current_tm->tm_hour, current_tm->tm_min, current_tm->tm_sec );
	return ctime;
}

//-----------------------------------------------------------------------------
// Name: DATE()
// Desc: Outputs Current Date in USA Format
//-----------------------------------------------------------------------------

char* cMenu::DATE(void)
{
	static char cdate[20] = "" ;
	struct tm * current_tm;
	time_t current_time;
	time (&current_time);
	current_tm = localtime (&current_time);
	sprintf( cdate, "%d-%02d-%d",current_tm->tm_mon+1,current_tm->tm_mday,current_tm->tm_year-100+2000);
	return cdate;
}
//-----------------------------------------------------------------------------
// Name: oprintf()
// Desc: equiv to sprintf but for output into of dest
//-----------------------------------------------------------------------------

char* cMenu::oprintf (const char *fmt, ...)
{
	static char buffer[225] = "";
	va_list va_alist;
	va_start (va_alist, fmt);
	_vsnprintf (buffer,sizeof(buffer), fmt, va_alist);
	va_end (va_alist);
	return buffer;
}
//-----------------------------------------------------------------------------
// Name: Save()
// Desc: Saves Menu Item states for later Restoration
//-----------------------------------------------------------------------------

void cMenu::Save(char* szSection, char* szKey, int iValue,LPCSTR file)
{
	char szValue[255];
	sprintf(szValue, "%d", iValue);
	WritePrivateProfileString(szSection,  szKey, szValue, file); 
}

//-----------------------------------------------------------------------------
// Name: Load()
// Desc: Loads Menu Item States From Previously Saved File
//-----------------------------------------------------------------------------

int cMenu::Load(char* szSection, char* szKey, int iDefaultValue,LPCSTR file)
{
	int iResult = GetPrivateProfileInt(szSection,  szKey, iDefaultValue, file); 
	return iResult;
}

//-----------------------------------------------------------------------------
// Name: additem()
// Desc: BaseFunction for aitem,acat,and atext
//-----------------------------------------------------------------------------

void cMenu::additem(char *title, char *states,int type, int *var, int show, int when)
{
	if(show==when)
	{
		strcpy(items[NO].title,title);
		getfield(states,items[NO].state,*var+1);
		items[NO].type=type;
		items[NO].max=nofields(states);
		items[NO].val=var;

		NO++;
	}
	if(type!=T_TEXT)
	{
		if (opt.options.load)
			*var = Load("Items", title, *var,Base.GetFile("mset.ini"));
		if (opt.options.save)
			Save("Items", title, *var,Base.GetFile("mset.ini"));
		if (opt.options.reset)
			*var=0;
	}
}

//-----------------------------------------------------------------------------
// Name: acat()
// Desc: Adds Folder/Category to Item index
//-----------------------------------------------------------------------------

void cMenu::acat(char *title, char *states,int *var)
{
	additem(title,states,T_CAT,var,0,0);
}
//-----------------------------------------------------------------------------
// Name: aitem()
// Desc: Adds regular item to Item index
//-----------------------------------------------------------------------------

void cMenu::aitem(char *title, char *states,int *var,int show,int when)
{
	additem(title,states,T_ITEM,var,show,when);
}
//-----------------------------------------------------------------------------
// Name: atext()
// Desc: Adds Text item to item index
//-----------------------------------------------------------------------------

void cMenu::atext(char *title, char *states,int show,int when)
{
	additem(title,states,T_TEXT,&opt.text,show,when);
}

void cMenu::atext(char *title, char *states)
{
	additem(title,states,T_TEXT,&opt.text,1,1);
}

//-----------------------------------------------------------------------------
// Name: nofields()
// Desc: Calculates Number of Fields in a String based on deliminator
//-----------------------------------------------------------------------------

int cMenu::nofields(char *str)
{
	char *ptr;
	int  no;
	for(no=1; (ptr=strchr(str,(char)'|'))!=NULL; no++)str=ptr+1;
	
	return no;
}

//-----------------------------------------------------------------------------
// Name: getfield()
// Desc: Grabs Field in string based on deliminator
//-----------------------------------------------------------------------------

void cMenu::getfield(char *str,char *dst,int no)
{
	char *ptr;
	int  i;
	for(i=1; (ptr=strchr(str,(char)'|'))!=NULL ; i++) 
	{
		if(i==no) break;
		str=ptr+1;
	}
	if(ptr)
	{
		i=(int)(ptr-str);
		strncpy(dst,str,i);
		dst[i]=0;
	}
	else
		strcpy(dst,str);
}

//-----------------------------------------------------------------------------
// Name: DrawBox()
// Desc: Fills Rectangle using DrawPrimitive Up
//-----------------------------------------------------------------------------

void cMenu::DrawBox( int x, int y, int w, int h, D3DCOLOR Color,LPDIRECT3DDEVICE8 pDevice)
{
struct Vertex 
{
	float x,y,z,ht;
    DWORD Color;
}V[4] = {
			{x,y+h, 0.0f, 0.0f, Color},
			{x,y, 0.0f, 0.0f, Color},
			{x+w,y+h, 0.0f, 0.0f, Color},
			{x+w,y, 0.0f, 0.0f, Color}
		};
pDevice->SetTexture(0, NULL);
pDevice->SetVertexShader(D3DFVF_XYZRHW | D3DFVF_DIFFUSE | D3DFVF_TEX1); 
pDevice->SetRenderState(D3DRS_ALPHABLENDENABLE,true);
pDevice->SetRenderState(D3DRS_DESTBLEND,D3DBLEND_INVSRCALPHA);
pDevice->DrawPrimitiveUP(D3DPT_TRIANGLESTRIP,2,V,sizeof(Vertex));
return;
}


//-----------------------------------------------------------------------------
// Name: DrawBorder()
// Desc: Fills outside of Rectangle using 4 calls to DrawBox
//-----------------------------------------------------------------------------

void cMenu::DrawBorder( int x, int y, int w, int h, D3DCOLOR Color,LPDIRECT3DDEVICE8 pDevice)
{
	DrawBox(x,  y, 1,  h,Color,pDevice);
	DrawBox(x,y+h, w,  1,Color,pDevice);
	DrawBox(x,  y, w,  1,Color,pDevice);
	DrawBox(x+w,y, 1,h+1,Color,pDevice);
	return;
}
//-----------------------------------------------------------------------------
// Name: ShowMenu()
// Desc: Core Menu Function Displays Menu Calls Other Menu functions and navigation
//-----------------------------------------------------------------------------

void cMenu::ShowMenu(LPDIRECT3DDEVICE8 pDevice)
{

	//-----------------------------------------------------------------------------
	// Desc: Check Hotkeys
	//-----------------------------------------------------------------------------
	int	lm		=	GetAsyncKeyState(VK_LBUTTON)&1;
	int	rm		=	GetAsyncKeyState(VK_RBUTTON)&1;
	int	left	=	GetAsyncKeyState(VK_LEFT )&1;
	int	right	=	GetAsyncKeyState(VK_RIGHT)&1;
	int	up		=	GetAsyncKeyState(VK_UP   )&1;
	int	down	=	GetAsyncKeyState(VK_DOWN )&1;
	//-----------------------------------------------------------------------------
	// Desc: Prepare/Reset Menu
	//-----------------------------------------------------------------------------

	Init();

	//-----------------------------------------------------------------------------
	// Desc: Show The Menu
	//-----------------------------------------------------------------------------
	if(GetAsyncKeyState(VK_INSERT)&1) SHOW=(!SHOW);
	if(SHOW){

		//-----------------------------------------------------------------------------
		// Desc: Get Mouse Coordinates and translate
		//-----------------------------------------------------------------------------

		GetCursorPos(&mpos);// Update Mouse Coordinates
		ScreenToClient(GetForegroundWindow(),&mpos); // Translate to Current Window

		//-----------------------------------------------------------------------------
		// Desc: Move Menu
		//-----------------------------------------------------------------------------

		//if(mpos.x>X && mpos.x<X+WIDTH && mpos.y>Y && mpos.y<Y+T_SPC && GetAsyncKeyState(VK_LBUTTON)&1 && !opt.options.move)  // If Header Clicked on
		//{
		//	M_DRAG=1;
		//}
		//else
		//{
		//	mofs.x=mpos.x - X;
		//	mofs.y=mpos.y - Y;
		//}

		//if(M_DRAG)
		//{
		//	if(GetAsyncKeyState(VK_LBUTTON)&1)M_DRAG=0;
		//	X = mpos.x - mofs.x;
		//	Y = mpos.y - mofs.y;
		//}

		if(opt.options.move && GetAsyncKeyState(VK_LCONTROL))	// If Options for Left Control is Set
		{
			X =(((X<=mpos.x+4) && (X>=mpos.x)) || ((X>=mpos.x-4) && (X<=mpos.x)))?(X=mpos.x):(X+=((mpos.x-X)/4));
			Y =(((Y<=mpos.y+4) && (Y>=mpos.y)) || ((Y>=mpos.y-4) && (Y<=mpos.y)))?(Y=mpos.y):(Y+=((mpos.y-Y)/4));
		}

		//-----------------------------------------------------------------------------
		// Desc: Draw Menu Header
		//-----------------------------------------------------------------------------

		DrawBox(X,Y,WIDTH,T_SPC,C_BOX,pDevice);// Render Menu Header Backround
		DrawBorder(X,Y,WIDTH,T_SPC,C_BORDER,pDevice);// set-up border


	font->DrawText(MC_FCTR(X,MC_MAXX),Y+2,C_TITLE,"|T-M WarRock Hack "24.4"|",DT_CENTER|DT_SHADOW);

		//-----------------------------------------------------------------------------
		// Desc: Fill Item Array and Render Menu Border and Box
		//-----------------------------------------------------------------------------

		NO=0;
		acat("|INFO|","[0/1]|[1/1]",&opt******.main);
			atext("By:","Metalen & Tados",opt******.main,1);	
			atext("Posted by","Metalen",opt******.main,1);
			atext("FPS",FPS(0),opt******.main,1);
			atext("Time",TIME(),opt******.main,1);
			atext("Date",DATE(),opt******.main,1);

		/*acat("|PLAYER|","[0/1]|[1/1]",&opt.player.main);
			aitem("PlayerSpeed","Off|50|60|70|80|90|100|150|200|250|300|350|400|450|500|1000|2000",&opt.player.speed,opt.player.main,1);
			aitem("SuperJump","Off|2000",&opt.player.superj,opt.player.main,1);
			aitem("NoFallDmg","Off|None",&opt.player.nfd,opt.player.main,1);
			aitem("Stamina","Off|Stealth",&opt.player.stamina,opt.player.main,1);
			aitem("Recoil","Default|None",&opt.player.recoil,opt.player.main,1);
			aitem("Spread","Default|Stealth",&opt.player.spread,opt.player.main,1);
			aitem("TrigerBot","Off|On",&opt.player.trigger,opt.player.main,1); */

		//acat("|ASM|","[0/1]|[1/1]",&opt.asmm.main);
			//aitem("AntiKick","Off|On",&opt.asmm.antik,opt.asmm.main,1);
			aitem("BoneShot","Off|On",&opt.asmm.bone,opt.asmm.main,1);
			aitem("CQCProne","Off|On",&opt.asmm.prone,opt.asmm.main,1);
			aitem("Invisible","Off|On",&opt.asmm.invis,opt.asmm.main,1);
			aitem("NoDelay","Off|On",&opt.asmm.nodelay,opt.asmm.main,1);
			aitem("OPK","Off|On",&opt.asmm.opk,opt.asmm.main,1);
			aitem("Unl.Ammo","Off|On",&opt.asmm.uammo,opt.asmm.main,1);
			aitem("Uoxygen","Off|On",&opt.asmm.uoxy,opt.asmm.main,1);
			aitem("ShotGun Spread","Off|On",&opt.asmm.shotty,opt.asmm.main,1);
			aitem("STW","Off|On",&opt.asmm.stw,opt.asmm.main,1);
			aitem("WTW","Off|On",&opt.asmm.wtw,opt.asmm.main,1);

		acat("|SERVER|","[0/1]|[1/1]",&opt.server.main);
			//aitem("AllSlots","Off|On",&opt.server.slots,opt.server.main,1);
			aitem("Premium","Off|Bronze|Silver|Gold|Platnium",&opt.server.prem,opt.server.main,1);
			//aitem("QuickSpawn","Off|On",&opt.server.spawn,opt.server.main,1);

		/*acat("|USER-CP|","[0/1]|[1/1]",&opt.usercp.main);
			aitem("UserInfo","Hide|Show",&opt.usercp.pinfo,opt.usercp.main,1);
			aitem("PlayerID","Off|1|2|3|4|5|6|7|8|9|10|11|12|13|14|15|16|17|18|19|20|21|22|23|24|25|26|27|28|29|30|31|32",&opt.usercp.pfind,opt.usercp.main,1);
			aitem("UserTeleport","Off|Auto|HotKey-X",&opt.usercp.pkey,opt.usercp.main,1); */

		acat("|D3D|","[0/1]|[1/1]",&opt.d3d.main);
			aitem("CrossHair","Off|Black|Blue|Red",&opt.d3d.cross,opt.d3d.main,1);
			aitem("Fog","Off|Blue|Green|Red|Purple|White|Black|None",&opt.d3d.fog,opt.d3d.main,1);
			aitem("GlassWalls","Off|On",&opt.d3d.glass,opt.d3d.main,1);
			aitem("WallEffect","Off|Ghost|Red|Blue|Yellow|Green",&opt.d3d.wallcolor,opt.d3d.main,1);

		acat("|CHAMS|","[0/1]|[1/1]",&opt.chams.main);
			aitem("Chams","Off|ON",&opt.chams.chams,opt.chams.main,1);
			aitem("Color F","Red|Blue|Yellow|Green",&opt.chams.chamsf,opt.chams.main,1);
			aitem("Color B","Red|Blue|Yellow|Green",&opt.chams.chamsb,opt.chams.main,1);
			aitem("Type","Clear|Phantom|Ghost|Solid",&opt.chams.type,opt.chams.main,1);

		/* acat("|ESP|","[0/1]|[1/1]",&opt.esp.main);
			aitem("OLD ESP Name","Off|On",&opt.esp.oespn,opt.esp.main,1);
			aitem("OLD ESP Health","Off|On",&opt.esp.oesph,opt.esp.main,1);
			aitem("Enemy Only","Off|Yes",&opt.esp.eonly,opt.esp.main,1);
			aitem("Name Esp","Hide|Show",&opt.esp.espn,opt.esp.main,1);
			aitem("Health Esp","Hide|Show",&opt.esp.esph,opt.esp.main,1);
			aitem("IP Esp","Hide|Show",&opt.esp.espi,opt.esp.main,1);
			aitem("Distance Esp","Hide|Show",&opt.esp.espd,opt.esp.main,1); */

		acat("|OPTIONS|","[0/1]|[1/1]",&opt.options.main);
			aitem("Move Menu","NO|L-CTRL",&opt.options.move,opt.options.main,1);
			aitem("Save Menu","Off|Saving",&opt.options.save,opt.options.main,1);
			aitem("Load Menu","Off|Loading",&opt.options.load,opt.options.main,1);
			aitem("Reset Menu","Off|Resetting",&opt.options.reset,opt.options.main,1);

		opt.options.save=0;
		opt.options.load=0;

		DrawBox(X,MC_MSY,WIDTH,(NO*I_SPC),C_BOX,pDevice);// Render Menu Backround for items
		DrawBorder(X,MC_MSY,WIDTH,(NO*I_SPC),C_BORDER,pDevice);// set-up border

		//-----------------------------------------------------------------------------
		// Desc: Loop Threw Item Index and Render Items
		//-----------------------------------------------------------------------------
		for(int no=0; no<NO; no++)
		{	
			D3DCOLOR text;

			text=(*(items[no].val)>0)?C_ON:C_OFF;	// Is ON OR OFF

			if(items[no].type==T_CAT)
				text=C_CAT;	// Category

			if(I_CUR==no)
			{

			
				if(BDIR==0)
					(BTEX<0xFF/4)?BTEX+=1:BDIR=1;
				if(BDIR==1)
						(BTEX>0x00)?BTEX-=1:BDIR=0;

				if(ABOR>I_SPC*I_CUR)
					ABOR=I_SPC*I_CUR;
				else if (ABOR<(-I_SPC*I_CUR))
					ABOR=(-I_SPC*I_CUR);

				if(ABOR<0)
					ABOR++;
				else if(ABOR>0)
					ABOR--;

				text=0xFF000000+(0x10000*(BTEX*4))+(0x100*(BTEX*4))+0x1*(BTEX*4);

				DrawBorder(X,MC_ITEMY(no)-ABOR,WIDTH,I_SPC,C_CUR,pDevice);
			}

			if(mpos.x>X && mpos.x<MC_MAXX && mpos.y>MC_ITEMY(no) && mpos.y<MC_ITEMY(no)+I_SPC)
			{
				text=0xFF000000+(0x10000*(BTEX*4))+(0x100*(BTEX*4))+0x1*(BTEX*4);
				DrawBorder(X,MC_ITEMY(no),WIDTH,I_SPC,C_CUR,pDevice);
			}

			font->DrawText(X+I_OFS,MC_ITEMY(no)+2,text,items[no].title,DT_SHADOW);
			font->DrawText(X+S_OFS,MC_ITEMY(no)+2,text,items[no].state,DT_RIGHT|DT_SHADOW);
			
		}

		//-----------------------------------------------------------------------------
		// Desc: Draw Menu Footer
		//-----------------------------------------------------------------------------

		DrawBox(X,MC_ITEMY(NO)+(F_SPC/2),WIDTH,(F_SPC),C_BOX,pDevice);// Draw Footer Filled
		DrawBorder(X,MC_ITEMY(NO)+(F_SPC/2),WIDTH,(F_SPC),C_BORDER,pDevice);// Footer Border
        
		font->DrawText(MC_FCTR(X,MC_MAXX),MC_ITEMY(NO)+(F_SPC/2)+2,BLUE,"T-M Company",DT_CENTER|DT_SHADOW);

		//-----------------------------------------------------------------------------
		// Desc: Mouse Navigation
		//-----------------------------------------------------------------------------

		int mno = 999; // Item Mouse is on

		if(mpos.x>X && mpos.x<MC_MAXX && mpos.y<MC_ITEMY(NO) && mpos.y>Y)
			mno = ((mpos.y-T_SPC)>Y)?((mpos.y - Y - T_SPC - (T_SPC/2)) / I_SPC):(999);

		if(mno!=999 && rm && (*items[mno].val)>0)
		{
			(*items[mno].val)-=1;
			Sound.wav.playsoundmem((LPCSTR)SWITCH);
		}

		if(mno!=999 && lm && (*items[mno].val)<(items[mno].max-1))
		{
			(*items[mno].val)+=1;
			Sound.wav.playsoundmem((LPCSTR)SWITCH);
		}

		//-----------------------------------------------------------------------------
		// Desc: Keyboard Navigation
		//-----------------------------------------------------------------------------

		if(left && (*items[I_CUR].val)>0)
		{
			(*items[I_CUR].val)-=1;

				Sound.wav.playsoundmem((LPCSTR)SWITCH);
		}

		if(right && (*items[I_CUR].val)<(items[I_CUR].max-1))
		{
			(*items[I_CUR].val)+=1;
			Sound.wav.playsoundmem((LPCSTR)SWITCH);
		}

		if(up)
		{
			do {
				I_CUR=(I_CUR==0)?(NO-1):(I_CUR-1);
				if(ABOR>(-(I_SPC)))ABOR-=I_SPC;
			} while (items[I_CUR].type==T_TEXT);
			Sound.wav.playsoundmem((LPCSTR)MOVE);
			
		}

		if(down || items[I_CUR].type==T_TEXT)
		{
			do
			{
				I_CUR=(I_CUR+1)%NO;
				if(ABOR<(I_SPC))ABOR+=I_SPC;
			} while (items[I_CUR].type==T_TEXT);
			Sound.wav.playsoundmem((LPCSTR)MOVE);
		}
		//-----------------------------------------------------------------------------
		// Desc: Menu Saftey / Sanity Checks and ReEncryption
		//-----------------------------------------------------------------------------
		if(I_CUR>NO)I_CUR=NO-1; // Prevent Selection From Hiding be hind hidden item
		
		//-----------------------------------------------------------------------------
	}
}
and that is the Problem :
Code:
1>------ Build started: Project: PHC D3D Base, Configuration: Optimize Win32 ------
1>Compiling...
1>cMenu.cpp
1>Building D3D Credits: Metalen & Tados
1>.\cMenu.cpp(366) : error C2143: syntax error : missing ')' before 'constant'
1>.\cMenu.cpp(366) : error C2059: syntax error : ')'
1>Build log was saved at "file://c:\Users\Metalen\Desktop\for mpgh\Optimize\BuildLog.htm"
1>PHC D3D Base - 2 error(s), 0 warning(s)
========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ==========
Thx alot for help
do you have bypass?
if not, you should stop, because without bypass menu will never get shown..
Quote Originally Posted by Lukas59 View Post
do you have bypass?
if not, you should stop, because without bypass menu will never get shown..
i have the bypass
Quote Originally Posted by metalen666 View Post
Hi im only asking if u can say me where is the problem in the (menu) Source code. Im actualy new i C++ so i need help

here is the code :
Code:
#include "stdafx.h"
#include "cMenu.h"
#include "cSound.h"
#include "cBase.h"
#include "cCrypt.h"
#include "Sounds.h"
//-----------------------------------------------------------------------------
// Name: PostReset()
// Desc: Creates Fonts and other Resources for Menu
//-----------------------------------------------------------------------------

void cMenu::PostReset(LPDIRECT3DDEVICE8 pDevice)
{
	font = new cFont("Tahoma", 7, FT_BOLD);
	font->InitDeviceObjects(pDevice);
	font->RestoreDeviceObjects();
	
}
//-----------------------------------------------------------------------------
// Name: PreReset()
// Desc: Releases Fonts / objects for menu
//-----------------------------------------------------------------------------

void cMenu::PreReset(void)
{
	font->InvalidateDeviceObjects();
	font->DeleteDeviceObjects();
	delete font;
	font = NULL;
}

//-----------------------------------------------------------------------------
// Name: Init()
// Desc: Load Menu Defaults / Prepare Menu For Usage
//-----------------------------------------------------------------------------

void cMenu::Init()
{
	if (opt.options.reset)INIT=false;
	if(!INIT){
		opt.options.move=0;		// BUG FIX FOR RESET DISABLE MOVE BEFORE SETTING COORDINATES
		X=Y=10;			        // TOP LEFT START
		WIDTH=175;			    // MENU WIDTH
		I_OFS=4;			    // OFSET FOR ITEM
		S_OFS=WIDTH-2;			// OFSET FOR STATE
		T_SPC=16;				// Space from Title and Start of Items
		F_SPC=16;				// Footer Spacing Hook Menu
		I_SPC=15;				// Item Spacing
		I_CUR=0;				// Set current Item
		ABOR=0;					// ANIMATION MOVE
		BDIR=0;					// ANIMATION HIGHLIGHT
		SHOW=true;				// false=hide  true=show
		INIT=true;				// STOP INITATION
	}
}

//-----------------------------------------------------------------------------
// Name: FPS()
// Desc: Keeps Track of Current Frames Persecond Make sure if its already called to specify a 1 as parameter
//-----------------------------------------------------------------------------

char* cMenu::FPS(int en)
{
	static int	 FPScounter = 0;
	static float FPSfLastTickCount = 0.0f;
	static float FPSfCurrentTickCount;
	static char  cfps[6] = "";

	if(!en)
	{
		FPSfCurrentTickCount = clock() * 0.001f;
		FPScounter++;

		if((FPSfCurrentTickCount - FPSfLastTickCount) > 1.0f)
		{
			FPSfLastTickCount = FPSfCurrentTickCount;
			sprintf(cfps," %d",FPScounter);
			FPScounter = 0;
		}
	}

	return cfps;

}

//-----------------------------------------------------------------------------
// Name: TIME()
// Desc: Outputs Current Time in USA Format
//-----------------------------------------------------------------------------

char* cMenu::TIME(void)
{
	static char ctime[20] = "" ;
	struct tm * current_tm;
	time_t current_time;
	time (&current_time);
	current_tm = localtime (&current_time);
	if(current_tm->tm_hour>12)
		sprintf( ctime, "%d:%02d:%02d PM", current_tm->tm_hour - 12, current_tm->tm_min, current_tm->tm_sec );
	else
		sprintf( ctime, "%d:%02d:%02d AM", current_tm->tm_hour, current_tm->tm_min, current_tm->tm_sec );
	return ctime;
}

//-----------------------------------------------------------------------------
// Name: DATE()
// Desc: Outputs Current Date in USA Format
//-----------------------------------------------------------------------------

char* cMenu::DATE(void)
{
	static char cdate[20] = "" ;
	struct tm * current_tm;
	time_t current_time;
	time (&current_time);
	current_tm = localtime (&current_time);
	sprintf( cdate, "%d-%02d-%d",current_tm->tm_mon+1,current_tm->tm_mday,current_tm->tm_year-100+2000);
	return cdate;
}
//-----------------------------------------------------------------------------
// Name: oprintf()
// Desc: equiv to sprintf but for output into of dest
//-----------------------------------------------------------------------------

char* cMenu::oprintf (const char *fmt, ...)
{
	static char buffer[225] = "";
	va_list va_alist;
	va_start (va_alist, fmt);
	_vsnprintf (buffer,sizeof(buffer), fmt, va_alist);
	va_end (va_alist);
	return buffer;
}
//-----------------------------------------------------------------------------
// Name: Save()
// Desc: Saves Menu Item states for later Restoration
//-----------------------------------------------------------------------------

void cMenu::Save(char* szSection, char* szKey, int iValue,LPCSTR file)
{
	char szValue[255];
	sprintf(szValue, "%d", iValue);
	WritePrivateProfileString(szSection,  szKey, szValue, file); 
}

//-----------------------------------------------------------------------------
// Name: Load()
// Desc: Loads Menu Item States From Previously Saved File
//-----------------------------------------------------------------------------

int cMenu::Load(char* szSection, char* szKey, int iDefaultValue,LPCSTR file)
{
	int iResult = GetPrivateProfileInt(szSection,  szKey, iDefaultValue, file); 
	return iResult;
}

//-----------------------------------------------------------------------------
// Name: additem()
// Desc: BaseFunction for aitem,acat,and atext
//-----------------------------------------------------------------------------

void cMenu::additem(char *title, char *states,int type, int *var, int show, int when)
{
	if(show==when)
	{
		strcpy(items[NO].title,title);
		getfield(states,items[NO].state,*var+1);
		items[NO].type=type;
		items[NO].max=nofields(states);
		items[NO].val=var;

		NO++;
	}
	if(type!=T_TEXT)
	{
		if (opt.options.load)
			*var = Load("Items", title, *var,Base.GetFile("mset.ini"));
		if (opt.options.save)
			Save("Items", title, *var,Base.GetFile("mset.ini"));
		if (opt.options.reset)
			*var=0;
	}
}

//-----------------------------------------------------------------------------
// Name: acat()
// Desc: Adds Folder/Category to Item index
//-----------------------------------------------------------------------------

void cMenu::acat(char *title, char *states,int *var)
{
	additem(title,states,T_CAT,var,0,0);
}
//-----------------------------------------------------------------------------
// Name: aitem()
// Desc: Adds regular item to Item index
//-----------------------------------------------------------------------------

void cMenu::aitem(char *title, char *states,int *var,int show,int when)
{
	additem(title,states,T_ITEM,var,show,when);
}
//-----------------------------------------------------------------------------
// Name: atext()
// Desc: Adds Text item to item index
//-----------------------------------------------------------------------------

void cMenu::atext(char *title, char *states,int show,int when)
{
	additem(title,states,T_TEXT,&opt.text,show,when);
}

void cMenu::atext(char *title, char *states)
{
	additem(title,states,T_TEXT,&opt.text,1,1);
}

//-----------------------------------------------------------------------------
// Name: nofields()
// Desc: Calculates Number of Fields in a String based on deliminator
//-----------------------------------------------------------------------------

int cMenu::nofields(char *str)
{
	char *ptr;
	int  no;
	for(no=1; (ptr=strchr(str,(char)'|'))!=NULL; no++)str=ptr+1;
	
	return no;
}

//-----------------------------------------------------------------------------
// Name: getfield()
// Desc: Grabs Field in string based on deliminator
//-----------------------------------------------------------------------------

void cMenu::getfield(char *str,char *dst,int no)
{
	char *ptr;
	int  i;
	for(i=1; (ptr=strchr(str,(char)'|'))!=NULL ; i++) 
	{
		if(i==no) break;
		str=ptr+1;
	}
	if(ptr)
	{
		i=(int)(ptr-str);
		strncpy(dst,str,i);
		dst[i]=0;
	}
	else
		strcpy(dst,str);
}

//-----------------------------------------------------------------------------
// Name: DrawBox()
// Desc: Fills Rectangle using DrawPrimitive Up
//-----------------------------------------------------------------------------

void cMenu::DrawBox( int x, int y, int w, int h, D3DCOLOR Color,LPDIRECT3DDEVICE8 pDevice)
{
struct Vertex 
{
	float x,y,z,ht;
    DWORD Color;
}V[4] = {
			{x,y+h, 0.0f, 0.0f, Color},
			{x,y, 0.0f, 0.0f, Color},
			{x+w,y+h, 0.0f, 0.0f, Color},
			{x+w,y, 0.0f, 0.0f, Color}
		};
pDevice->SetTexture(0, NULL);
pDevice->SetVertexShader(D3DFVF_XYZRHW | D3DFVF_DIFFUSE | D3DFVF_TEX1); 
pDevice->SetRenderState(D3DRS_ALPHABLENDENABLE,true);
pDevice->SetRenderState(D3DRS_DESTBLEND,D3DBLEND_INVSRCALPHA);
pDevice->DrawPrimitiveUP(D3DPT_TRIANGLESTRIP,2,V,sizeof(Vertex));
return;
}


//-----------------------------------------------------------------------------
// Name: DrawBorder()
// Desc: Fills outside of Rectangle using 4 calls to DrawBox
//-----------------------------------------------------------------------------

void cMenu::DrawBorder( int x, int y, int w, int h, D3DCOLOR Color,LPDIRECT3DDEVICE8 pDevice)
{
	DrawBox(x,  y, 1,  h,Color,pDevice);
	DrawBox(x,y+h, w,  1,Color,pDevice);
	DrawBox(x,  y, w,  1,Color,pDevice);
	DrawBox(x+w,y, 1,h+1,Color,pDevice);
	return;
}
//-----------------------------------------------------------------------------
// Name: ShowMenu()
// Desc: Core Menu Function Displays Menu Calls Other Menu functions and navigation
//-----------------------------------------------------------------------------

void cMenu::ShowMenu(LPDIRECT3DDEVICE8 pDevice)
{

	//-----------------------------------------------------------------------------
	// Desc: Check Hotkeys
	//-----------------------------------------------------------------------------
	int	lm		=	GetAsyncKeyState(VK_LBUTTON)&1;
	int	rm		=	GetAsyncKeyState(VK_RBUTTON)&1;
	int	left	=	GetAsyncKeyState(VK_LEFT )&1;
	int	right	=	GetAsyncKeyState(VK_RIGHT)&1;
	int	up		=	GetAsyncKeyState(VK_UP   )&1;
	int	down	=	GetAsyncKeyState(VK_DOWN )&1;
	//-----------------------------------------------------------------------------
	// Desc: Prepare/Reset Menu
	//-----------------------------------------------------------------------------

	Init();

	//-----------------------------------------------------------------------------
	// Desc: Show The Menu
	//-----------------------------------------------------------------------------
	if(GetAsyncKeyState(VK_INSERT)&1) SHOW=(!SHOW);
	if(SHOW){

		//-----------------------------------------------------------------------------
		// Desc: Get Mouse Coordinates and translate
		//-----------------------------------------------------------------------------

		GetCursorPos(&mpos);// Update Mouse Coordinates
		ScreenToClient(GetForegroundWindow(),&mpos); // Translate to Current Window

		//-----------------------------------------------------------------------------
		// Desc: Move Menu
		//-----------------------------------------------------------------------------

		//if(mpos.x>X && mpos.x<X+WIDTH && mpos.y>Y && mpos.y<Y+T_SPC && GetAsyncKeyState(VK_LBUTTON)&1 && !opt.options.move)  // If Header Clicked on
		//{
		//	M_DRAG=1;
		//}
		//else
		//{
		//	mofs.x=mpos.x - X;
		//	mofs.y=mpos.y - Y;
		//}

		//if(M_DRAG)
		//{
		//	if(GetAsyncKeyState(VK_LBUTTON)&1)M_DRAG=0;
		//	X = mpos.x - mofs.x;
		//	Y = mpos.y - mofs.y;
		//}

		if(opt.options.move && GetAsyncKeyState(VK_LCONTROL))	// If Options for Left Control is Set
		{
			X =(((X<=mpos.x+4) && (X>=mpos.x)) || ((X>=mpos.x-4) && (X<=mpos.x)))?(X=mpos.x):(X+=((mpos.x-X)/4));
			Y =(((Y<=mpos.y+4) && (Y>=mpos.y)) || ((Y>=mpos.y-4) && (Y<=mpos.y)))?(Y=mpos.y):(Y+=((mpos.y-Y)/4));
		}

		//-----------------------------------------------------------------------------
		// Desc: Draw Menu Header
		//-----------------------------------------------------------------------------

		DrawBox(X,Y,WIDTH,T_SPC,C_BOX,pDevice);// Render Menu Header Backround
		DrawBorder(X,Y,WIDTH,T_SPC,C_BORDER,pDevice);// set-up border


	font->DrawText(MC_FCTR(X,MC_MAXX),Y+2,C_TITLE,"|T-M WarRock Hack "24.4"|",DT_CENTER|DT_SHADOW);

		//-----------------------------------------------------------------------------
		// Desc: Fill Item Array and Render Menu Border and Box
		//-----------------------------------------------------------------------------

		NO=0;
		acat("|INFO|","[0/1]|[1/1]",&opt******.main);
			atext("By:","Metalen & Tados",opt******.main,1);	
			atext("Posted by","Metalen",opt******.main,1);
			atext("FPS",FPS(0),opt******.main,1);
			atext("Time",TIME(),opt******.main,1);
			atext("Date",DATE(),opt******.main,1);

		/*acat("|PLAYER|","[0/1]|[1/1]",&opt.player.main);
			aitem("PlayerSpeed","Off|50|60|70|80|90|100|150|200|250|300|350|400|450|500|1000|2000",&opt.player.speed,opt.player.main,1);
			aitem("SuperJump","Off|2000",&opt.player.superj,opt.player.main,1);
			aitem("NoFallDmg","Off|None",&opt.player.nfd,opt.player.main,1);
			aitem("Stamina","Off|Stealth",&opt.player.stamina,opt.player.main,1);
			aitem("Recoil","Default|None",&opt.player.recoil,opt.player.main,1);
			aitem("Spread","Default|Stealth",&opt.player.spread,opt.player.main,1);
			aitem("TrigerBot","Off|On",&opt.player.trigger,opt.player.main,1); */

		//acat("|ASM|","[0/1]|[1/1]",&opt.asmm.main);
			//aitem("AntiKick","Off|On",&opt.asmm.antik,opt.asmm.main,1);
			aitem("BoneShot","Off|On",&opt.asmm.bone,opt.asmm.main,1);
			aitem("CQCProne","Off|On",&opt.asmm.prone,opt.asmm.main,1);
			aitem("Invisible","Off|On",&opt.asmm.invis,opt.asmm.main,1);
			aitem("NoDelay","Off|On",&opt.asmm.nodelay,opt.asmm.main,1);
			aitem("OPK","Off|On",&opt.asmm.opk,opt.asmm.main,1);
			aitem("Unl.Ammo","Off|On",&opt.asmm.uammo,opt.asmm.main,1);
			aitem("Uoxygen","Off|On",&opt.asmm.uoxy,opt.asmm.main,1);
			aitem("ShotGun Spread","Off|On",&opt.asmm.shotty,opt.asmm.main,1);
			aitem("STW","Off|On",&opt.asmm.stw,opt.asmm.main,1);
			aitem("WTW","Off|On",&opt.asmm.wtw,opt.asmm.main,1);

		acat("|SERVER|","[0/1]|[1/1]",&opt.server.main);
			//aitem("AllSlots","Off|On",&opt.server.slots,opt.server.main,1);
			aitem("Premium","Off|Bronze|Silver|Gold|Platnium",&opt.server.prem,opt.server.main,1);
			//aitem("QuickSpawn","Off|On",&opt.server.spawn,opt.server.main,1);

		/*acat("|USER-CP|","[0/1]|[1/1]",&opt.usercp.main);
			aitem("UserInfo","Hide|Show",&opt.usercp.pinfo,opt.usercp.main,1);
			aitem("PlayerID","Off|1|2|3|4|5|6|7|8|9|10|11|12|13|14|15|16|17|18|19|20|21|22|23|24|25|26|27|28|29|30|31|32",&opt.usercp.pfind,opt.usercp.main,1);
			aitem("UserTeleport","Off|Auto|HotKey-X",&opt.usercp.pkey,opt.usercp.main,1); */

		acat("|D3D|","[0/1]|[1/1]",&opt.d3d.main);
			aitem("CrossHair","Off|Black|Blue|Red",&opt.d3d.cross,opt.d3d.main,1);
			aitem("Fog","Off|Blue|Green|Red|Purple|White|Black|None",&opt.d3d.fog,opt.d3d.main,1);
			aitem("GlassWalls","Off|On",&opt.d3d.glass,opt.d3d.main,1);
			aitem("WallEffect","Off|Ghost|Red|Blue|Yellow|Green",&opt.d3d.wallcolor,opt.d3d.main,1);

		acat("|CHAMS|","[0/1]|[1/1]",&opt.chams.main);
			aitem("Chams","Off|ON",&opt.chams.chams,opt.chams.main,1);
			aitem("Color F","Red|Blue|Yellow|Green",&opt.chams.chamsf,opt.chams.main,1);
			aitem("Color B","Red|Blue|Yellow|Green",&opt.chams.chamsb,opt.chams.main,1);
			aitem("Type","Clear|Phantom|Ghost|Solid",&opt.chams.type,opt.chams.main,1);

		/* acat("|ESP|","[0/1]|[1/1]",&opt.esp.main);
			aitem("OLD ESP Name","Off|On",&opt.esp.oespn,opt.esp.main,1);
			aitem("OLD ESP Health","Off|On",&opt.esp.oesph,opt.esp.main,1);
			aitem("Enemy Only","Off|Yes",&opt.esp.eonly,opt.esp.main,1);
			aitem("Name Esp","Hide|Show",&opt.esp.espn,opt.esp.main,1);
			aitem("Health Esp","Hide|Show",&opt.esp.esph,opt.esp.main,1);
			aitem("IP Esp","Hide|Show",&opt.esp.espi,opt.esp.main,1);
			aitem("Distance Esp","Hide|Show",&opt.esp.espd,opt.esp.main,1); */

		acat("|OPTIONS|","[0/1]|[1/1]",&opt.options.main);
			aitem("Move Menu","NO|L-CTRL",&opt.options.move,opt.options.main,1);
			aitem("Save Menu","Off|Saving",&opt.options.save,opt.options.main,1);
			aitem("Load Menu","Off|Loading",&opt.options.load,opt.options.main,1);
			aitem("Reset Menu","Off|Resetting",&opt.options.reset,opt.options.main,1);

		opt.options.save=0;
		opt.options.load=0;

		DrawBox(X,MC_MSY,WIDTH,(NO*I_SPC),C_BOX,pDevice);// Render Menu Backround for items
		DrawBorder(X,MC_MSY,WIDTH,(NO*I_SPC),C_BORDER,pDevice);// set-up border

		//-----------------------------------------------------------------------------
		// Desc: Loop Threw Item Index and Render Items
		//-----------------------------------------------------------------------------
		for(int no=0; no<NO; no++)
		{	
			D3DCOLOR text;

			text=(*(items[no].val)>0)?C_ON:C_OFF;	// Is ON OR OFF

			if(items[no].type==T_CAT)
				text=C_CAT;	// Category

			if(I_CUR==no)
			{

			
				if(BDIR==0)
					(BTEX<0xFF/4)?BTEX+=1:BDIR=1;
				if(BDIR==1)
						(BTEX>0x00)?BTEX-=1:BDIR=0;

				if(ABOR>I_SPC*I_CUR)
					ABOR=I_SPC*I_CUR;
				else if (ABOR<(-I_SPC*I_CUR))
					ABOR=(-I_SPC*I_CUR);

				if(ABOR<0)
					ABOR++;
				else if(ABOR>0)
					ABOR--;

				text=0xFF000000+(0x10000*(BTEX*4))+(0x100*(BTEX*4))+0x1*(BTEX*4);

				DrawBorder(X,MC_ITEMY(no)-ABOR,WIDTH,I_SPC,C_CUR,pDevice);
			}

			if(mpos.x>X && mpos.x<MC_MAXX && mpos.y>MC_ITEMY(no) && mpos.y<MC_ITEMY(no)+I_SPC)
			{
				text=0xFF000000+(0x10000*(BTEX*4))+(0x100*(BTEX*4))+0x1*(BTEX*4);
				DrawBorder(X,MC_ITEMY(no),WIDTH,I_SPC,C_CUR,pDevice);
			}

			font->DrawText(X+I_OFS,MC_ITEMY(no)+2,text,items[no].title,DT_SHADOW);
			font->DrawText(X+S_OFS,MC_ITEMY(no)+2,text,items[no].state,DT_RIGHT|DT_SHADOW);
			
		}

		//-----------------------------------------------------------------------------
		// Desc: Draw Menu Footer
		//-----------------------------------------------------------------------------

		DrawBox(X,MC_ITEMY(NO)+(F_SPC/2),WIDTH,(F_SPC),C_BOX,pDevice);// Draw Footer Filled
		DrawBorder(X,MC_ITEMY(NO)+(F_SPC/2),WIDTH,(F_SPC),C_BORDER,pDevice);// Footer Border
        
		font->DrawText(MC_FCTR(X,MC_MAXX),MC_ITEMY(NO)+(F_SPC/2)+2,BLUE,"T-M Company",DT_CENTER|DT_SHADOW);

		//-----------------------------------------------------------------------------
		// Desc: Mouse Navigation
		//-----------------------------------------------------------------------------

		int mno = 999; // Item Mouse is on

		if(mpos.x>X && mpos.x<MC_MAXX && mpos.y<MC_ITEMY(NO) && mpos.y>Y)
			mno = ((mpos.y-T_SPC)>Y)?((mpos.y - Y - T_SPC - (T_SPC/2)) / I_SPC):(999);

		if(mno!=999 && rm && (*items[mno].val)>0)
		{
			(*items[mno].val)-=1;
			Sound.wav.playsoundmem((LPCSTR)SWITCH);
		}

		if(mno!=999 && lm && (*items[mno].val)<(items[mno].max-1))
		{
			(*items[mno].val)+=1;
			Sound.wav.playsoundmem((LPCSTR)SWITCH);
		}

		//-----------------------------------------------------------------------------
		// Desc: Keyboard Navigation
		//-----------------------------------------------------------------------------

		if(left && (*items[I_CUR].val)>0)
		{
			(*items[I_CUR].val)-=1;

				Sound.wav.playsoundmem((LPCSTR)SWITCH);
		}

		if(right && (*items[I_CUR].val)<(items[I_CUR].max-1))
		{
			(*items[I_CUR].val)+=1;
			Sound.wav.playsoundmem((LPCSTR)SWITCH);
		}

		if(up)
		{
			do {
				I_CUR=(I_CUR==0)?(NO-1):(I_CUR-1);
				if(ABOR>(-(I_SPC)))ABOR-=I_SPC;
			} while (items[I_CUR].type==T_TEXT);
			Sound.wav.playsoundmem((LPCSTR)MOVE);
			
		}

		if(down || items[I_CUR].type==T_TEXT)
		{
			do
			{
				I_CUR=(I_CUR+1)%NO;
				if(ABOR<(I_SPC))ABOR+=I_SPC;
			} while (items[I_CUR].type==T_TEXT);
			Sound.wav.playsoundmem((LPCSTR)MOVE);
		}
		//-----------------------------------------------------------------------------
		// Desc: Menu Saftey / Sanity Checks and ReEncryption
		//-----------------------------------------------------------------------------
		if(I_CUR>NO)I_CUR=NO-1; // Prevent Selection From Hiding be hind hidden item
		
		//-----------------------------------------------------------------------------
	}
}
and that is the Problem :
Code:
1>------ Build started: Project: PHC D3D Base, Configuration: Optimize Win32 ------
1>Compiling...
1>cMenu.cpp
1>Building D3D Credits: Metalen & Tados
1>.\cMenu.cpp(366) : error C2143: syntax error : missing ')' before 'constant'
1>.\cMenu.cpp(366) : error C2059: syntax error : ')'
1>Build log was saved at "file://c:\Users\Metalen\Desktop\for mpgh\Optimize\BuildLog.htm"
1>PHC D3D Base - 2 error(s), 0 warning(s)
========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ==========
Thx alot for help
For me too it do it when i test to create hack :/
but how ?? for me its dont work
Quote Originally Posted by metalen666 View Post
but how ?? for me its dont work
metalen, the bypass in that bybase isnt updated bypass,
bytes removed,
btw give your id & pass, i check for you
don´t give him bypass addie ikke..
he should pay or whatever..
i wont, just see at error, brw nice pic man
Moved to the C++ section.
and whats wrong with my code ?
There's nothing wrong with it ... if you use this calss properly you should have no errors...


Something prbly just got changed when u copied it from a forum or something. just click the line the errors on... it says 366 in the compiler.
Posts 111 of 11 · Page 1 of 1
This thread is closed for replies.

Similar Threads

Tags for this Thread

None

Need help?