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

📄 color.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 "stringfinder.h"
#include <vector>


typedef unsigned long DWORD;
#include "color.h"

// Color Manager
ColorManager colorList;


//========================================================================================
void ColorManager::init()
{
	indexes.clear();
	list.clear();
	insertpos = 0;

	//   identifer     R   G   B   A      Access Index
	add("cross"      ,255,255,255,200  ); // index: 0
	add("team1"      ,255, 40, 40      ); // index: 1
	add("team2"      , 40, 80,255      ); // index: 2
	add("special"    ,155,155,155      ); // index: 3
	add("target"     ,102,204, 51      ); // index: 4
	add("hud"        ,120,120,255      ); // index: 5
	add("sound"      , 68, 68,255      ); // index: 6
	add("bombtimer"  ,255, 40, 40      ); // index: 7
	add("systime"    ,255,255,255      ); // index: 8
	add("esp"        ,255,255,  0      ); // index: 9
	add("back"       ,  0,  0,  0, 128 ); // index:10
	add("radar1"     , 80,150, 30, 110 ); // index:11
	add("radar2"     ,150,150,150,  60 ); // index:12
	add("text"       , 50,100,255      ); // index:13
	add("wire"       ,255,255,  0      ); // index:14
	add("lambert"    ,255,255,255      ); // index:15
	add("death"      ,255,  0,  0      ); // index:16
	add("con_back"   , 10, 10, 30, 128 ); // index:17
	add("con_text"   ,255,255, 30      ); // index:18
	add("con_text2"  ,160,160,222, 128 ); // index:19
	add("con_edit"   ,255,255,255      ); // index:20
	add("menu_back"  , 10, 10, 30, 128 ); // index:21
	add("menu_select",150, 70, 10, 128 ); // index:22
	add("menu_text"  ,255,255,255      ); // index:23
	add("text_back" ,  0,  0,  0,  100 ); // index:24
	add("snake_back" ,  0,  0,  0, 128 ); // index:25
	add("snake_body" ,  0,200, 66, 200 ); // index:26
	add("snake_item" ,  0, 55,222, 200 ); // index:27
	add("snake_wall" ,222, 66, 22, 200 ); // index:28
	add("tlight"     ,222,111,111, 255 ); // index:29
	add("snd_step"   ,255,255,255, 255 ); // index:30
	add("snd_weapon" ,144,155,255, 255 ); // index:31
	add("snd_hit"    ,222,100, 61, 254 ); // index:32
	add("snd_special",222,111,111, 254 ); // index:33
	add("snd_default",222,255,222, 255 ); // index:34
	add("team3"      ,200,200,  0      ); // index:35
	add("team4"      , 20,222,100      ); // index:36
	add("nade"       ,100,255,160      ); // index:37

}

//========================================================================================
void ColorEntry::fill_missing()
{
	compiled = (r<<24) + (g<<16) + (b<<8) + a;
	fr= float(r)/255.0f/30.0f;
	fg= float(g)/255.0f/30.0f;
	fb= float(b)/255.0f/30.0f;

	onebased_r=float(r)/255.0f;
	onebased_g=float(g)/255.0f;
	onebased_b=float(b)/255.0f;
	onebased_a=float(a)/255.0f;
}

//========================================================================================
void ColorManager::add(const char* name,int r, int g, int b, int a)
{
	indexes.add(name,insertpos);

	ColorEntry tmp;
	tmp.r=r;
	tmp.g=g;
	tmp.b=b;
	tmp.a=a;
	tmp.fill_missing();

	list.push_back(tmp);

	insertpos++;
}
#define BOUND_INTEGER(var,min,max) if((var)>(max)){(var)=(max);};if((var)<(min)){(var)=(min);}


//========================================================================================
void ColorManager::set(char* name, char* red, char* green, char* blue, char* alpha)
{
	if( !indexes.find(name) ){ return; }

	int index = indexes.num;
	char format[]="%d";

	ColorEntry tmp;
	sscanf(red   ,format,&tmp.r);
	sscanf(green ,format,&tmp.g);
	sscanf(blue  ,format,&tmp.b);
	sscanf(alpha ,format,&tmp.a);
	
	tmp.fill_missing();

	BOUND_INTEGER(index,0,int(list.size()-1));
	list[index] = tmp;
}


⌨️ 快捷键说明

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