?? hong_sub.cpp
字號:
/*****************************************************************************\
* 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 + -