All pastes #404432 Raw Edit

Anonymous

public cpp v1 · immutable
·published 2007-03-21 00:29 UTC
rendered paste body
//============================//LTFX Menu Base By GHOSTER#include "stdafx.h"#include "cLTFX.h"#include <stdio.h>CD3DFont* menuFont = NULL;pMenu mainMenu[15];cvars cvar;extern cFont ltfx;int curItem;void cFont::InitalizeFont(char *font, int size, IDirect3DDevice8* pD3Ddev){	menuFont = new CD3DFont(font, size, 0);	menuFont->InitDeviceObjects(pD3Ddev);	menuFont->RestoreDeviceObjects();}void cFont::PostReset(char *font, int size, IDirect3DDevice8* pD3Ddev){	menuFont = new CD3DFont(font, size,0);	menuFont->InitDeviceObjects(pD3Ddev);	menuFont->RestoreDeviceObjects();}void cFont::PreReset(){	menuFont->InvalidateDeviceObjects();	menuFont->DeleteDeviceObjects();	menuFont = NULL;}void cFont::DrawGameText(int x, int y, DWORD color, char *text){	menuFont->DrawText((float)x, (float)y, color, text);}cMenu::cMenu( ){	MAX_ITEMS = 0;}cMenu::~cMenu( ){	MAX_ITEMS = 0;}void cMenu::AddMenuItem(char title[16], float *cvar, int min, int max){	mainMenu[MAX_ITEMS].value = cvar;	strcpy(mainMenu[MAX_ITEMS].title, title); 	mainMenu[MAX_ITEMS].max = max;	mainMenu[MAX_ITEMS].min = min;	MAX_ITEMS++;}void cMenu::DrawMenu(int x, int y){	char value[256];	for (int i = 0; i < MAX_ITEMS + 1; i++)	{		sprintf(value, "%2.2f", mainMenu[i].value[0]);		if( i == curItem && mainMenu[i].value[0] >= 0)		{			ltfx.DrawGameText(x, y + (i * 20), 0xFF00FF00, mainMenu[i].title);			ltfx.DrawGameText(x + 50, y + (i * 20), 0xFFFFFFFF, value);		}		else		{			ltfx.DrawGameText(x, y + (i * 20), 0xFFFFFF00, mainMenu[i].title);			ltfx.DrawGameText(x + 50, y + (i * 20), 0xFFFFFFFF, value);		}	}}void cMenu::CheckNav(){	 if(GetAsyncKeyState(VK_UP)&1) curItem--;	 if(GetAsyncKeyState(VK_DOWN)&1) curItem++;	 if(curItem < 0) curItem = MAX_ITEMS;	 if(curItem > MAX_ITEMS) curItem = 0;	 if(GetAsyncKeyState(VK_RIGHT)&1) 	 { 		mainMenu[curItem].value[0] += 1;			 		if( mainMenu[curItem].value[0] > mainMenu[curItem].max )               mainMenu[curItem].value[0] = (float)mainMenu[curItem].min;	 }	 if(GetAsyncKeyState(VK_LEFT)&1) 	 { 		mainMenu[curItem].value[0] -= 1;		 if( mainMenu[curItem].value[0] < mainMenu[curItem].min )                mainMenu[curItem].value[0] = (float)mainMenu[curItem].max;	 }}//============================#include "d3dfont.h"#define MAX_MENU 15class cFont{	public:		void InitalizeFont(char *font, int size, IDirect3DDevice8* pD3Ddev); //Set font name, and size. (Call in initalize)		void PreReset(); // Call in prereset		void PostReset(char *font, int size, IDirect3DDevice8* pD3Ddev); //Call in prereset		void DrawGameText(int x, int y, DWORD color, char *text); //Color can by D3DCOLOR_ARGB(x, x, x, x)) or 0xFFFFFFFF etc	private:};class cMenu{	public:	cMenu( );	~cMenu( );		void AddMenuItem(char title[16], float* cvar, int min, int max); //Add a menu item		void DrawMenu(int x, int y); //Draw our menu on coords we want		void CheckNav(); //...	private:		int MAX_ITEMS;};struct cvars{	float menu; };struct pMenu{    char title[16];     float* value; 	int max, min;};extern pMenu mainMenu[MAX_MENU]; //15 itemsextern cMenu menu;//============================#include "stdafx.h"#include "d3d8hook.h"#include "d3d8dev.h"#include "CDetour.h"#include <d3d8.h>#include <d3dx8.h>#include "cLTFX.h"#include "modulehandler.h"Reset_t pReset;BeginScene_t pBeginScene;EndScene_t pEndScene;DrawIndexedPrimitive_t pDrawIndexedPrimitive;SetStreamSource_t pSetStreamSource;cMenu* ltfx;cFont* font;struct sVars{	float walls;	float zoom;	float clock;	float opk;	float asus;};sVars cvar;//----------bool bSetup = false;//----------//=====================================================================================================================================================void InitHack( LPDIRECT3DDEVICE8 pDev ){	font = new cFont( );	ltfx = new cMenu( );	ltfx->AddMenuItem( "WallHack", &cvar.walls, 0, 4 );	ltfx->AddMenuItem( "Asus", &cvar.asus, 0, 1 );	ltfx->AddMenuItem( "Clock", &cvar.clock, 0, 1 );}//=====================================================================================================================================================void PreReset( LPDIRECT3DDEVICE8 pDevice ){	font->PreReset( );	//pre-reset, destroy}//=====================================================================================================================================================void PostReset( LPDIRECT3DDEVICE8 pDevice ){	font->PostReset( "Arial", 8, pDevice );	//post-reset, re-init}//=====================================================================================================================================================HRESULT WINAPI nReset( LPDIRECT3DDEVICE8 pDevice, D3DPRESENT_PARAMETERS* pPresentationParameters ){	PreReset( pDevice );	HRESULT hRet = pReset( pDevice, pPresentationParameters );	if( SUCCEEDED( hRet ) )	{		PostReset( pDevice );	}	return hRet;}//=====================================================================================================================================================HRESULT WINAPI nBeginScene(LPDIRECT3DDEVICE8 pDevice){	if( !bSetup )	{		InitHack( pDevice );		bSetup = true;	}	return pBeginScene(pDevice);}//=====================================================================================================================================================HRESULT WINAPI nEndScene(LPDIRECT3DDEVICE8 pDevice){	ltfx->CheckNav( );	ltfx->DrawMenu( 10, 10 );	return pEndScene(pDevice);}//=====================================================================================================================================================HRESULT WINAPI nDrawIndexedPrimitive(LPDIRECT3DDEVICE8 pDevice, D3DPRIMITIVETYPE pType, unsigned int uiMinIndex, unsigned int uiNumVertices, unsigned int uiStartIndex, unsigned int uiPrimitiveCount){	return pDrawIndexedPrimitive(pDevice, pType, uiMinIndex, uiNumVertices, uiStartIndex, uiPrimitiveCount);}//=====================================================================================================================================================HRESULT WINAPI nSetStreamSource(LPDIRECT3DDEVICE8 pDevice, unsigned int uiStreamNumber, LPDIRECT3DVERTEXBUFFER8 pStreamData, unsigned int uiStride){	return pSetStreamSource(pDevice, uiStreamNumber, pStreamData, uiStride);}//=====================================================================================================================================================