⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 menu.cpp

📁 我对他如何控制准星、显示敌友很好奇
💻 CPP
字号:
// 
// Online Game Cheats Client.dll hook
// Copyright (c) system   2001-2002
// Copyright (c) bunny771 2001-2002
// 
// This program is free software; you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation; either version 2 of the License, or
// (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
// GNU General Public License for more details.
// 
// You should have received a copy of the GNU General Public License
// along with this program; if not, write to the Free Software
// Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
// 
// NOTE:
// GNU license doesn't cover Engine directory.
// Content of Engine directory is copyrighted (c) 1999, 2000, by Valve LLC
// and it is licensed under Valve's proprietary license (see original HL SDK).
// 

#include <vector>
#include <string>
using namespace std;
#include "menu.h"
#include <fstream>

//========================================================================================
OgcCommandMenu ogcMenu;
typedef OgcCommandMenu::Menu Menu;
typedef OgcCommandMenu::MenuEntry MenuEntry;


//========================================================================================
void getToken(istream& in, string& token)
{
	char ch;
	
	for(;;){
		in.get(ch);
		if(ch=='\"')
		{
			token.erase();
			for(;;)
			{
				in.get(ch);
				if(!in||ch=='\"') return;
				token+=ch;
			}
		} 
		else if(ch=='{') {token = "{";return;}
		else if(ch=='}') {token = "}";return;}
		//else if(ch=='-') {token = "-";return;}
		if(!in)          {token = "}";return;}
	}
}

//========================================================================================
void extractCommentString(istream& in, string& dest)
{
	dest.erase();
	char ch;in.get(ch);
	while(ch==' ' && ch!='\t')in.get(ch);
	if(ch=='/')
	{
		in.get(ch);
		if(ch=='/')
		{
			while(ch!=0x0D && ch!=0x0A)
			{
				in.get(ch);
				dest+=ch;
			}
		}
	}
}

#include <windows.h>

//========================================================================================
void readMenu(istream& in, Menu* pMenu)
{
	string dummy;
	for(;;)
	{
		getToken(in, dummy);    // " " or }
		if(dummy[0]=='}') { return; } // done with menu

		MenuEntry newEntry;

		getToken(in, newEntry.name    ); // "name"
		getToken(in, newEntry.content ); // "asdf;qqq" or {

		// extract comments
		extractCommentString(in, newEntry.description);

		if( newEntry.content[0]=='{' )
		{
			newEntry.menu = new Menu;
			newEntry.menu->name = newEntry.name;
			newEntry.menu->parent = pMenu;

			pMenu->items.push_back(newEntry);
			readMenu(in,newEntry.menu);
		} else {
			newEntry.menu = 0;
			pMenu->items.push_back(newEntry);
		}
		if(!in) break;
	}
}

//========================================================================================
void OgcCommandMenu::init(const char* filename)
{
	if(baseMenu) return;

	ifstream ifs;
	ifs.open(filename);

	baseMenu = new Menu;
	baseMenu->name = "OGC Hook";
	readMenu(ifs,baseMenu);
}



⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -