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

📄 hong_sub.cpp

📁 国内著名网络游戏dragon的客户端登陆用完整源码 配套一起上传的服务端部分可开服 无说明文档
💻 CPP
📖 第 1 页 / 共 2 页
字号:
/*****************************************************************************\
* Copyright (c), Future Entertainment World / Seoul, Republic of Korea        *
* All Rights Reserved.                                                        *
*                                                                             *
* This document contains proprietary and confidential information.  No        *
* parts of this document or the computer program it embodies may be in        *
* any way copied, duplicated, reproduced, translated into a different         *
* programming language, or distributed to any person, company, or             *
* corporation without the prior written consent of Future Entertainment World *

	.公茄编利狼 脚充苞 捧瘤肺, 窍搁等促.
	.芒狼仿苞 笼吝仿栏肺 芒炼己阑 惯戎, 臼登搁 登霸 窍扼.
	.乞裹茄 葛嚼/ 乞惑狼 付澜捞 啊厘 酒抚翠促.

		
\*****************************************************************************/


#include "stdafx.h"
#include <windows.h>
#include <windowsx.h>
#include <stdlib.h>
#include <malloc.h>
#include <stdio.h>
#include <Math.h>
#include "Resource.h"


#include "Dragon.h"

#define __HONG_SUB_H__
#include "Hong_Sub.h"


#include "Hong_Sprite.h"
#include "Hangul.h"

#include "Tool.h"

extern CHARACTERLIST g_CharacterList;

int YesOrNo( char *s, char *title )
{	
    char temp[ FILENAME_MAX];
    va_list arg;
    va_start( arg, s );
    vsprintf( temp, s, arg );
    va_end( arg );
	
	HWND hwnd = GetActiveWindow();
	return MessageBox( hwnd, temp, title, MB_YESNO | MB_ICONQUESTION );
}	

/*ΑΑΑΑΑΑΑΑΑΑΑΑΑΑΑΑΑΑΑΑΑΑΑΑΑΑΑΑΑΑΑΑΑΑΑΑΑΑΑΑ
窃荐疙 : void  ( char *mssg,... )
汲  疙 : Error Message甫 免仿窍绊 OK甫 穿福搁 辆丰茄促.
牢  磊 :
府  畔 : 绝娇.
ΑΑΑΑΑΑΑΑΑΑΑΑΑΑΑΑΑΑΑΑΑΑΑΑΑΑΑΑΑΑΑΑΑΑΑΑΑΑΑΑ*/
void Error ( char *mssg, ... )
{
	char caTemp[ FILENAME_MAX];
	va_list va;
	HWND hwnd;

	va_start( va, mssg );
	vsprintf( caTemp, mssg, va );
	va_end( va );

	hwnd = GetActiveWindow();

	MessageBox( hwnd, caTemp, "DragonRaja On-Line", MB_OK );

	_fcloseall();
	PostQuitMessage(0); 

	return;
}

void MemFree_Sub( char **buf, char *file, int line  )
{
	if( *buf == NULL ) {return;}

    IMemUseCount--;

	SAFE_DELETE_ARRAY(*buf);
}

void __Alloc( char **s, int size, const char *file, int line )
{	
	SAFE_DELETE_ARRAY(*s);
    *s = new char[size];
	ITotalUseMemory += size;
    if( !(*s) )
	{
        Error( lan->OutputMessage(6,62), file, line, size );//lsw
	}
	::memset( *s, 0, size );
    IMemUseCount++;
}	

/*ΑΑΑΑΑΑΑΑΑΑΑΑΑΑΑΑΑΑΑΑΑΑΑΑΑΑΑΑΑΑΑΑΑΑΑΑΑΑΑΑ
窃荐疙 : FILE *FopenSub_( char *name, char *mode )
汲  疙 :
牢  磊 :
府  畔 :
ΑΑΑΑΑΑΑΑΑΑΑΑΑΑΑΑΑΑΑΑΑΑΑΑΑΑΑΑΑΑΑΑΑΑΑΑΑΑΑΑ*/
char checkbeta=2;

extern void DeleteBetaFile( char *dir );
void SaveBetaFileName( char *file_name )
{
	static int first = 1;
	FILE *fp;
	if( first )
	{
		first = 0;
		fp = fopen( "./SaveBetaFileName.txt", "wt" );
	}
	else fp = fopen( "./SaveBetaFileName.txt", "at+" );

	if( !fp ) return;
	fprintf( fp, "%s\n", file_name );
	fclose( fp );
}

// thai2 YGI
#ifdef _DEBUG
class KeinFile
{	//< CSD-030324
public :
	FILE *m_fp;
public :	
	KeinFile( const char *filename, const char *mode )
	{
		m_fp = fopen( filename, mode );
	}
	~KeinFile()
	{
		if( m_fp ) fclose( m_fp );
	}
};	//> CSD-030324

//KeinFile temp_fp("UsedFileName.txt", "wt") ;
#endif


FILE *FopenSub_( char *name, char *filemode, char *wherefile, int line )
{ 
	/*
	// thai2 YGI
#ifdef _DEBUG
	if( temp_fp.m_fp )
	{
		fprintf( temp_fp.m_fp, "%s\n", name );
	}
#endif
	*/

	FILE *fp;
	if(checkbeta == 2 )//茄锅父 龋免登绰 何盒.. 绢掳登带 蔼捞 0肚绰 1肺 
	{
		fp = fopen("./beta.ini","r");
		if(fp!=NULL)
		{
			fread( &checkbeta, 4,4,fp );
			fclose( fp );

			if (checkbeta=='1')
			{	//< CSD-031030
				fp = fopen( "./data_b5/beta.txt", "r" );
				if( !fp )
				{
					MessageBox( GetActiveWindow(), "橇府 海鸥 辑滚肺 立加窍妨搁 权其捞瘤俊辑 怖 菩摹颇老阑 促款 罐酒具 钦聪促. \n http://www.dr-online.co.kr", "Information", MB_OK | MB_ICONINFORMATION );
					exit(0);
				}
				else fclose( fp );

				DeleteBetaFile( "./delete_dir.txt" );
			}	//< CSD-031030
		}
		else
		{
			checkbeta='0';
		}
	}

	if(checkbeta=='1')	//海鸥促.. 傍楼 亮窍绰仇甸.. 
	{
		char save_name[_MAX_PATH];
		char result_str[_MAX_PATH];
		strcpy( save_name, name );
		char *work_name = save_name;
		char *temp;
		if( *GetCurrentWorkingDirectory() )
		{			
			temp = strstr( save_name, GetCurrentWorkingDirectory() );
			if( temp ) 
			{
				work_name = temp + strlen( GetCurrentWorkingDirectory() )+1;
			}
		}
		char *conv_slash = work_name;
		while( conv_slash = strchr( conv_slash, '\\' ) )
		{
			*conv_slash = '/';
		}		

		temp = strstr( work_name, "./" );
		if( temp ) work_name += 2;

		char *token = strstr( work_name, "/" );
		if( token )		// / 啊 窍唱档 绝绰 版快甫困秦辑.. 
		{	//< CSD-031030
			*token=0;
			token++;
			sprintf( result_str, "%s_b5/%s", work_name, token );
			fp = fopen( result_str, filemode );
			if( fp ) return fp;
		#ifdef _DEBUG
			else
			{
				SaveBetaFileName( result_str );
			}
		#endif
		}	//> CSD-031030
	}

	return fopen( name, filemode );
}	
/*ΑΑΑΑΑΑΑΑΑΑΑΑΑΑΑΑΑΑΑΑΑΑΑΑΑΑΑΑΑΑΑΑΑΑΑΑΑΑΑΑ
窃荐疙 : void MakeFullPathName( char *d, char *path, char *filename )
汲  疙 : 罐篮 牢磊肺 full filename阑 父电促.
牢  磊 : char *d : 积己瞪 拳老捞抚 历厘  Pointer ( size绰 FILENAME_MAX== 80 ( stdio.h) ).
         char *path : "./data/"客 鞍篮 屈怕狼 String.
         char *filename: "han.fnt"客 鞍篮 屈怕狼 String.
府  畔 : 绝娇.
ΑΑΑΑΑΑΑΑΑΑΑΑΑΑΑΑΑΑΑΑΑΑΑΑΑΑΑΑΑΑΑΑΑΑΑΑΑΑΑΑ*/
void MakeFullPathName( char *d, char *path, char *filename )
{
   memset( d, 0, FILENAME_MAX );
   strcpy( d, path );
   strcat( d, filename );

   if( strlen( d ) >= FILENAME_MAX ) Error( "too long [%s %d]\n", __FILE__, __LINE__ );
}




/*ΑΑΑΑΑΑΑΑΑΑΑΑΑΑΑΑΑΑΑΑΑΑΑΑΑΑΑΑΑΑΑΑΑΑΑΑΑΑΑΑ
窃荐疙 : void MakeFullPathNameCD( char *d, char drive, char *path, char *filename )
汲  疙 : Full File Name阑 父电促.
牢  磊 : char *d     : 积己瞪 拳老捞抚 历厘  Pointer ( size绰 FILENAME_MAX== 80 ( stdio.h) ).
         char drive  : 靛府捞宏 疙.( 'D'肚绰 'd' )
         char *path  : ":/data/"客 鞍篮 屈怕狼 String.
         char *filename: "han.fnt"客 鞍篮 屈怕狼 String.
府  畔 :
ΑΑΑΑΑΑΑΑΑΑΑΑΑΑΑΑΑΑΑΑΑΑΑΑΑΑΑΑΑΑΑΑΑΑΑΑΑΑΑΑ*/
void MakeFullPathNameCD( char *d, char drive, char *path, char *filename )
{
	memset( d, 0, FILENAME_MAX );
	if( SysInfo.cddata == 1 )
	{
		*d= drive;
		strcat( d, path );
		strcat( d, filename );
	    if( strlen( d ) >= FILENAME_MAX ) Error( "too long [%s %d]\n", __FILE__, __LINE__ );
	}
	else
	{
		strcpy( d, "./CD1" );
		strcat( d, path+1 );
		strcat( d, filename );
	}
}


/*ΑΑΑΑΑΑΑΑΑΑΑΑΑΑΑΑΑΑΑΑΑΑΑΑΑΑΑΑΑΑΑΑΑΑΑΑΑΑΑΑ
窃荐疙 : void MakeFullPathNameWithNum( char *d, char *path, char *filename,... )
汲  疙 : 啊函牢磊甫 罐酒 Full File Name阑 父电促.
牢  磊 : char *d     : 积己瞪 拳老捞抚 历厘  Pointer ( size绰 FILENAME_MAX== 80 ( stdio.h) ).
         char drive  : 靛府捞宏 疙.( 'D'肚绰 'd' )
         char *path  : ":/data/"客 鞍篮 屈怕狼 String.
         char *filename: "han%03d.fnt"客 鞍篮 屈怕狼 String.
府  畔 :
ΑΑΑΑΑΑΑΑΑΑΑΑΑΑΑΑΑΑΑΑΑΑΑΑΑΑΑΑΑΑΑΑΑΑΑΑΑΑΑΑ*/
void MakeFullPathNameWithNum( char *d, char *path, char *filename,... )
{
   char Str[ FILENAME_MAX];
   va_list val;

   va_start( val, filename);
   vsprintf(Str, filename, val);
   va_end(val);

   MakeFullPathName( d, path, Str );
}




/*ΑΑΑΑΑΑΑΑΑΑΑΑΑΑΑΑΑΑΑΑΑΑΑΑΑΑΑΑΑΑΑΑΑΑΑΑΑΑΑΑ
窃荐疙 : void MakeFullPathNameWithNumCD( char *d, char drive, char *path, char *filename,... )
汲  疙 : 啊函牢磊甫 罐酒 Full File Name阑 父电促.
牢  磊 : char *d     : 积己瞪 拳老捞抚 历厘  Pointer ( size绰 FILENAME_MAX== 80 ( stdio.h) ).
         char drive  : 靛府捞宏 疙.( 'D'肚绰 'd' )
         char *path  : ":/data/"客 鞍篮 屈怕狼 String.
         char *filename: "han%03d.fnt"客 鞍篮 屈怕狼 String.
府  畔 :
ΑΑΑΑΑΑΑΑΑΑΑΑΑΑΑΑΑΑΑΑΑΑΑΑΑΑΑΑΑΑΑΑΑΑΑΑΑΑΑΑ*/
void MakeFullPathNameWithNumCD( char *d, char drive, char *path, char *filename,... )
{
   char Str[ FILENAME_MAX];
   va_list val;

   va_start( val, filename);
   vsprintf(Str, filename, val);
   va_end(val);

   MakeFullPathNameCD( d, drive,path, Str );
}

/*ΑΑΑΑΑΑΑΑΑΑΑΑΑΑΑΑΑΑΑΑΑΑΑΑΑΑΑΑΑΑΑΑΑΑΑΑΑΑΑΑ
窃荐疙 : int Distance( int sx, int sy, int dx, int dy )
汲  疙 : 滴痢荤捞狼 芭府狼 力蚌阑 府畔茄促.
牢  磊 :
府  畔 :
ΑΑΑΑΑΑΑΑΑΑΑΑΑΑΑΑΑΑΑΑΑΑΑΑΑΑΑΑΑΑΑΑΑΑΑΑΑΑΑΑ*/
int Distance( int sx, int sy, int dx, int dy )
{
   int ddx = abs( dx - sx );
   int ddy = abs( dy - sy );

   return ddx * ddx + ddy * ddy;
}

void JustMsg( const char *s, ... )
{	
    char temp[ FILENAME_MAX];
    va_list arg;
    va_start( arg, s );
    vsprintf( temp, s, arg );
    va_end( arg );
	HWND hwnd = GetActiveWindow();
	
	if(g_DirectDrawInfo.lpDirectDraw )
		g_DirectDrawInfo.lpDirectDraw->FlipToGDISurface();
	
	MessageBox( hwnd, temp, "Information", MB_OK | MB_ICONINFORMATION );
}	
	
int BoxAndDotCrash( int dx, int dy, int dxl, int dyl, int x, int y )
{
//	BoxOneColor( dx + IMapX, dy+ IMapY, dxl, dyl, 255);
	if( dx <= x && x <= dx + dxl  ) if( dy <= y && y <= dy+dyl ) return 1;
	return 0;
}	
int BoxAndBoxCrash( int ax, int ay, int axl, int ayl,  int bx, int by, int bxl, int byl )
{	
	if( ax + axl >= bx && bx + bxl >= ax &&	ay + ayl >= by && by + byl >= ay ) return 1;
	return 0;
}	

/////////////////////////////// 捞痹绕 1025 荐沥 /////////////////////////////////////////////	
int BoxAndDotCrash( int dx, int dy, int dxl, int dyl, int x, int y, int dz, int dzl, int z)
{
//	BoxOneColor( dx + IMapX, dy+ IMapY, dxl, dyl, 255);
	if( dx <= x && x <= dx + dxl  ) if( dy <= y && y <= dy+dyl )
		if(dz<=z && z<=dz+dzl)	return 1;		//臭捞蔼 眉农		
		else					return 0;
	return 0;
}	
	
	
int BoxAndBoxCrash( int ax, int ay, int axl, int ayl,  int bx, int by, int bxl, int byl, int az, int azl, int bz, int bzl )
{	
	
	if( ax + axl >= bx && bx + bxl >= ax &&	ay + ayl >= by && by + byl >= ay ) 
		if(az+azl >= bz && bz+bzl>= az)		return 1;		//臭捞蔼 眉农
		else								return 0;
	return 0;
}	
/////////////////////////////////////////////////////////////////////////////////////////////	
// ------------------------------------------------------------------
int ViewCheckRoutine( const int t )
{	
	return 0;
#ifdef _DEBUG

	static int TimeCheckCount;
	static int TickCount, OldTickCount, TickFlag;
	static int currentfps;
	
	if( t == 0 ) TickFlag = 0;
	if( TickFlag == 0 )	{	OldTickCount = TickCount = ::timeGetTime();		TickFlag = 1; 	}
	else
	{
		OldTickCount= TickCount;
		TickCount	= ::timeGetTime();
	}
	char temp[ FILENAME_MAX];
	sprintf( temp, "%d : %d \n", t, TickCount - OldTickCount );
	OutputDebugString( temp );
	return OldTickCount - TickCount;

#else

	return 0;

#endif
}					





int Determinant( int ax, int ay, int bx, int by, int X, int Y)
{
	int ret = ( ax * ( by - Y ) - ay * ( bx - X ) + bx * Y - (by * X ));
	return ret;
}



int IsInBox( int x1, int y1, int x2, int y2, int x3, int y3, int x4, int y4, int x, int y )
{
		if( Determinant( x1,y1,x2,y2,x,y ) > 0 )
		if( Determinant( x2,y2,x3,y3,x,y ) > 0 )
		if( Determinant( x3,y3,x4,y4,x,y ) > 0 )
		if( Determinant( x4,y4,x1,y1,x,y ) > 0 )
			return 1;
	return 0;
}

static inline void swap( int  *a, int *b )
{
	int t;

	t = *a;
	*a = *b;
	*b = t;	
}			
			
			
int CheckIntersect(int p1x, int p1y, int p2x, int p2y, int p3x, int p3y, int p4x, int p4y)
{			
    long m;	
    float x;

	if( p1x == p2x ) p1x++;
	if( p1y == p2y ) p1y++;
	if( p3x == p4x ) p3x++;
	if( p3y == p4y ) p3y++;

    if (p1x > p2x)
	{		
	swap(&p1x, &p2x);
	swap(&p1y, &p2y);
	}		
    if (p3x > p4x)
	{		
	swap(&p3x, &p4x);
	swap(&p3y, &p4y);
	}		
    m = (p4x - p3x)*(p2y - p1y) - (p4y - p3y)*(p2x - p1x);
			
    x = ((float)(p3y - p1y)*(p2x - p1x)*(p4x - p3x)
	 + (float)p1x*(p2y - p1y)*(p4x - p3x)
	 - (float)p3x*(p4y - p3y)*(p2x - p1x)) / (float)m;
    if (p1x <= x && x <= p2x && p3x <= x && x <= p4x) return 1;
    else return -1;
}			

void SaveAliasHeader( int xl, int yl, FILE *fp )
{
	unsigned char tt[10]={ 0x02, 0x80, 0x01, 0xe0, 0x00, 0x00, 0x01,  0xdf, 0x00, 0x18};
	fwrite( tt, 10, 1, fp );
}	
	
	
void CaptureScreen ( void )
{	
	char temp[FILENAME_MAX];
	unsigned char r,g,b;
	FILE *fp;
	int c;

	fp =Fopen( "capturescreen.tmp", "rt" );
	if( fp )
	{
		fscanf( fp, "%d", &c );
		fclose(fp);
	}
	else
	{
		c = 0;
	}

⌨️ 快捷键说明

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