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

📄 tool.cpp

📁 国内著名网络游戏dragon的客户端登陆用完整源码 配套一起上传的服务端部分可开服 无说明文档
💻 CPP
📖 第 1 页 / 共 5 页
字号:
#include "StdAfx.h"
#include <windowsx.H>
#include "DirectDraw.h"

#include "Dragon.h"
#include "Resource.h"
#include "Hong_Sprite.h"	
#include "Hong_Sub.h"
#include "GameProc.h"
#include "Char.h"
#include "Item.h"
#include "Map.h"
#include "Object.h"
#include "Hong_Light.h"
#include "SkillTool.h"
#include "MouseCursor.h"
#include "CharDataTable.h"
#include "Effect.h"
#include "Counseler.h"
#include "Skill.h"
#include "DirectSound.h"
#include "LineCommand.h"
#include "Menu.h"
#include "Music.h"
#include "SmallMenu.h"
#include "Menuset.h"
#include "Tool.h"
#include "MenuNetWork.h"// 030307 soto眠啊.

extern HWND	g_hMultiDlg;//soto-030603

extern bool	bCharListUp;				// 瓷仿摹 函版阑 焊郴囱促.
extern bool	bTackListUp ;				// 琶平胶 函版
extern bool	ScreenCaptureStartFlag;
extern int g_StartMenuOn;				//  泅犁 胶鸥飘 皋春牢瘤, 酒丛 皋牢 皋春牢瘤 魄窜...
extern NPC_INFO g_infNpc[MAX_CHARACTER_SPRITE_]; // CSD-030419

extern void LoadHeroClothAccessoryDataOne_tool(int sprno, int no); // CSD-030306
extern void FreeHeroClothAccessoryDataOne_tool(int sprno, int no); // CSD-030306
extern void	ChangeItem(int start);	// 烙矫 酒捞袍 官操扁 		
extern DWORD GetExpByLv(int lv);		// 饭骇阑 版氰摹肺 函券秦 霖促.
extern bool LoadItemJoinTable();
extern void WarLoopTime(char* Arg);		// 030308 soto

///////////////// SoundUp lkh 抛胶飘甫 困秦 ////////////////////
//extern int	RainAmount;
extern BOOL	Statue_Weather;

extern HWND g_hSetScenarioDlgWnd = NULL; // 030307 soto

// << 031013 kyo
extern bool g_IsActiveProFiler;	
extern ProFileShowType g_ProFileType;
void ShowProFileDlg();
BOOL CALLBACK ProFilerProc(HWND hDlg, UINT Message, WPARAM wParam, LPARAM lParam);
// >> 031013 kyo


//////////////////////////////////////////////////////////////////////////////////////
/////   extern 

extern CHARACTERLIST g_CharacterList;

extern int		EndOfAnimationFlag;		

////////////////////////////////////////////////////////////////////////////////////////
/////	

int				SpriteOrderFrame, SpriteOrderDir;
int				AnimationEditWorkStartFlag;
int				CheckEquipmentFlag;
int				TempAnimationCount;
int				IDCheckedMapObject;

HWND			CheckAnimationHwnd;

DEVELOPE_ENVIR	SysInfo;



int				tool_ViewAttrEventFlag;
int				tool_ViewAttrDontFlag;
int				tool_ViewAttrRoofOnOff;


int tool_AnimationEditCurFrame;
int tool_AnimationEditTotalSpriteNo;
int tool_ViewAnimationFrame;
bool tool_DrawMap, tool_DrawObject, tool_DrawFrontMap, tool_ViewMessage, tool_ViewChat, tool_ViewNumber, tool_ViewMenu;					
int tool_DrawRoofMap;
int tool_MultiChar;

int tool_FrameCheck;

int tool_mapobject_modify;
int tool_ViewAttrFrontFlag;
int tool_ID_INPUT_MAP_ATTR;
int tool_ViewAttrRiver;
int tool_ViewAttrGEffect;
int tool_ViewAttrInside;
int tool_ViewAttrNoBattle;
int tool_ViewAttrCanMatch;
int tool_ViewAttrTop;				// 010904 LTS
int tool_ViewAttrOccupied;
int tool_Pathfind	= 1;
bool tool_ViewMyExp;



int		tool_MouseCursorBlock;
char	tool_ID_EFFECT_TEST;
char	tool_IDD_INPUT_MAPOBJECT;
int		tool_CurMapObjectId=1;
char	tool_ViewAllCharacter;
bool	tool_SkillTool_FARMING;
bool	tool_SkillTool_MINING;	
bool	tool_SkillTool_FISHING;	
bool	tool_SkillTool_CHOPPING;
bool	tool_SkillTool_HUB;
bool	tool_SkillTool_NPC;
bool	tool_SkillTool_ITEM_SEAL;



int tool_ID_SKILL_INPUT;
HWND	InputSkillAttrHdlg;
HWND	tool_IDD_INPUT_MAPOBJECTHdlg;
HWND	tool_MouseCursorHdlg;

int tool_ID_INPUT_MYHOUSE;
int tool_ID_OUTPUT_MYHOUSE;
HWND	InputMyhouseHdlg;

//------------------------------------------------
HWND	InputMapAttrHdlg;
int tMapAttrBrush;
int tMapAttrX, tMapAttrY;
int tMapAttr = IDC_ATTR_DONT;
int tMapAttrAllAffect = IDC_SOURCE_AFFECT_NO;
int tMapAttr_Offset_Modify = IDC_ATTR_OFFSET_NO2;
int tMapAttr_Brush_Paint = IDC_PAINT_NO;
int tMapAttr_Brush_DePaint = IDC_DEPAINT_NO;			// 010904 LTS

int SoundRangeX=200;	// LTS SOUND
int SoundRangeY=170;

//------------------------------------------------


#ifdef _DEBUG
char			AnimationName[MAX_ANIMATION][ 110];					
#endif



////////////////////////////////////////////////////////////////////////////////////////////
////   user function



void XLine( int x, int y, DWORD xl, WORD color )
{
	LPVOID	Dtmp = (LPVOID)( (char*)g_DestBackBuf + y * dDxSize + (x * 2 ));
	
	_asm{
		push	es;
		push	ds;
		pop		es;
		
		mov		edi, Dtmp;
		
		xor		eax, eax;
		mov		ax, color;
		mov		ecx, 16;
		shl		eax, cl;
		
		mov		ax, color;
		
		mov		ecx, xl;
		shr		ecx, 1;
		
		
loop_1:
		mov		[edi], eax;
		add		edi, 4;
		
		loop	loop_1;
		
		pop		es;
	};
}	


void Line(int sx, int sy, int ex, int ey, int color)
{	
	int t,distance;
	int xerr = 0, yerr = 0, delta_x, delta_y;
	int incx, incy;
	int temp;
	
	sx -= Mapx;
	sy -= Mapy;
	ex -= Mapx;
	ey -= Mapy;
	
	delta_x = ex - sx;
	delta_y = ey - sy;
	
	incx = (delta_x > 0) ?  1 : ((delta_x == 0) ? 0 : -1) ;
	incy = (delta_y > 0) ?  1 : ((delta_y == 0) ? 0 : -1) ;
	
	delta_x = abs(delta_x);
	delta_y = abs(delta_y);
	
	distance = (delta_x > delta_y) ? delta_x : delta_y ;
	int maxoff = dDxSize * SCREEN_HEIGHT;
	for(t=0; t<=distance; t++)
	{
		if( sx >= 0 && sx < SCREEN_WIDTH && sy >= 0 && sy < SCREEN_HEIGHT ) 
		{
			temp = 2*sx + sy * dDxSize;
			*(WORD *)( g_DestBackBuf + temp ) = color;
		}
		
		xerr += delta_x;
		yerr += delta_y;
		if(xerr > distance)    {        xerr -= distance;       sx += incx;      }
		if(yerr > distance)    {        yerr -= distance;       sy += incy;      }
	}
}	






void PutDot( int x, int y, WORD color )
{
	if( x < 0 ) return;
	if( y < 0 ) return;
	if( x > SCREEN_WIDTH -1 ) return;
	if( y > SCREEN_HEIGHT -1 ) return;
	
	
	*(WORD *)(g_DestBackBuf + x*2 + y * dDxSize ) = color;
}

void Box_( int sx, int sy,  int xl, int yl, int color )
{	
	Line( sx, sy, sx, sy+yl-1, color );
	Line( sx, sy, sx+xl-1, sy, color );
	Line( sx+xl-1, sy+yl-1, sx, sy+yl-1, color );
	Line( sx+xl-1, sy+yl-1, sx+xl-1, sy, color );
}

void Box( int sx, int sy,  int ex, int ey, int color )
{	
	Line( sx, sy, sx, ey+1, color );
	Line( sx, sy, ex+1, sy, color );
	Line( ex, ey, sx, ey, color );
	Line( ex, ey, ex, sy, color );
}

void BoxFill( int sx, int sy, int xl, int yl, int color)
{
	int i;
	yl += sy;
	for( i = sy ; i < yl ; i ++)
	{
		XLine( sx, sy, xl, color);
	}
}





void Box( int x1, int y1,  int x2, int y2,  int x3, int y3,  int x4, int y4, int color )
{	
	Line( x1, y1, x2, y2, color );
	Line( x2, y2, x3, y3, color );
	Line( x3, y3, x4, y4, color );
	Line( x4, y4, x1, y1, color );
}	



void Circle(int xc,int yc,int a0,int col )
{				
	int x1 = 0 ;
	int y1 = a0;
				
	long a = a0;
	long b = a0;
				
	long Asquared = a*a;
	long TwoAsquared = 2 * Asquared;
	long Bsquared = b * b;
	long TwoBsquared = 2 * Bsquared;
				
	long d;		
	long dx,dy;	
	d = Bsquared - Asquared * b + Asquared/4l;
	dx = 0;		
	dy = TwoAsquared * b;
				
	while(dx < dy)
	{			
        PutDot(xc+x1,yc+y1,col);
        PutDot(xc-x1,yc+y1,col);
        PutDot(xc-x1,yc-y1,col);
        PutDot(xc+x1,yc-y1,col);
		if(d>0l)
		{		
			--y1;
			dy -= TwoAsquared;
			d -= dy;
		}		
		++x1;	
		dx += TwoBsquared;
		d += Bsquared + dx;
	}			
	d += (3l*(Asquared - Bsquared)/2l - (dx + dy)) /2l;
				
	while(y1>=0)
	{			
		PutDot(xc+x1,yc+y1,col);
        PutDot(xc-x1,yc+y1,col);
        PutDot(xc-x1,yc-y1,col);
        PutDot(xc+x1,yc-y1,col);
		
		if(d<0l)
		{		
			++x1;
			dx += TwoBsquared;
			d += dx;
		}		
		-- y1;	
		dy -= TwoAsquared;
		d += Asquared - dy;
	}			
}				




int GetTile( int x, int y )
{
	return TileMap[ x][y].attr_dont;
}

void PutTile( int x, int y, int v )
{
	TileMap[ x][y].attr_dont = v;
}


void PaintTileAttrDont(int x, int y )
{	
	int sx, ex;
	
	sx = x;
	while( TileMap[sx][y].attr_dont == 0 && sx >= 0 )	sx--;
	if( sx < 0 ) sx = 0;
	
	ex = x;
	while( TileMap[ex][y].attr_dont == 0 && ex < g_Map.file.wWidth )	ex++;
	if( ex >= g_Map.file.wWidth ) ex = g_Map.file.wWidth -1;
	
	for( ; sx <= ex ; sx ++)
	{
		TileMap[ sx][y].attr_dont = 1;
	}
}		

//___________________________________________________________________________ // 010904 LTS DEPAINT GROUP
void DePaintTileAttrDont(int x, int y )   
{	
	int sx, ex;
	
	sx = x;
	while( TileMap[sx][y].attr_dont == 1 && sx >= 0 )	sx--;
	if( sx < 0 ) sx = 0;
	
	ex = x;
	while( TileMap[ex][y].attr_dont == 1 && ex < g_Map.file.wWidth )	ex++;
	if( ex >= g_Map.file.wWidth ) ex = g_Map.file.wWidth -1;
	
	for( ; sx <= ex ; sx ++)
	{
		TileMap[ sx][y].attr_dont = 0;
	}
}		
//___________________________________________________________________________ // 010904 LTS

void PaintTileAttrRiver(int x, int y )
{	
	int sx, ex;
	
	sx = x;
	while( TileMap[sx][y].attr_river == 0 && sx >= 0 )	sx--;
	if( sx < 0 ) sx = 0;
	
	ex = x;
	while( TileMap[ex][y].attr_river == 0 && ex < g_Map.file.wWidth )	ex++;
	if( ex >= g_Map.file.wWidth ) ex = g_Map.file.wWidth -1;
	
	for( ; sx <= ex ; sx ++)
	{
		TileMap[ sx][y].attr_river = 1;
	}
}		

//___________________________________________________________________________ // 010904 LTS DEPAINT GROUP
void DePaintTileAttrRiver(int x, int y )             
{	
	int sx, ex;
	
	sx = x;
	while( TileMap[sx][y].attr_river == 1 && sx >= 0 )	sx--;
	if( sx < 0 ) sx = 0;
	
	ex = x;
	while( TileMap[ex][y].attr_river == 1 && ex < g_Map.file.wWidth )	ex++;
	if( ex >= g_Map.file.wWidth ) ex = g_Map.file.wWidth -1;
	
	for( ; sx <= ex ; sx ++)
	{
		TileMap[ sx][y].attr_river = 0;
	}
}		
//___________________________________________________________________________ // 010904 LTS


void PaintTileAttrGeffect(int x, int y )
{	
	int sx, ex;
	
	sx = x;
	while( TileMap[sx][y].attr_light == 0 && sx >= 0 )	sx--;
	if( sx < 0 ) sx = 0;
	

⌨️ 快捷键说明

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