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

📄 basefunc.h

📁 网络游戏魔域源代码 测试可以完整变异
💻 H
字号:
#ifndef _BASEFUNC_H
#define _BASEFUNC_H
//---------------------------------------------------------------------
#include "StdAfx.h"
#include <stdio.h>
#include <stdlib.h>
#include <assert.h>
#include <math.h>
#include <time.h>

#include <windows.H>

#pragma warning(disable: 4786)
//const int _SCR_WIDTH	=1024;
//const int _SCR_HEIGHT	=768 ;

const DWORD _SHOWWAY_NORMAL		 =0;
const DWORD _SHOWWAY_ADDITIVE	 =1;

const DWORD _LOADWAY_NORMAL	 =0;
const DWORD _LOADWAY_MASK	 =0xff000000;
const DWORD _LOADWAY_TRANS   =0xffff00ff;


//----------------------------------------------------------
int		Double2Int	(double dValue);

BOOL	IniStrGet	(const char *pszFileName, const char *pszTitle, const char *pszSubTitle, char *pszStr);
BOOL	IniDataGet	(const char *pszFileName, const char *pszTitle, const char *pszSubTitle, int &iData);

BOOL	TxtStrGet	(const char *pszFileName, const char *pszTitle, char *pszStr);
BOOL	TxtDataGet	(const char *pszFileName, const char *pszTitle, int &iData);

DWORD	TimeGet		(void);
DWORD	SysTimeGet  (void);
int		RandGet		(int nMax, BOOL bRealRand=false);

void	ErrorMsg	(const char* fmt, ...);
void	ErrorOut	(const char* fmt, ...);
void	LogMsg		(const char* fmt, ...);
void	DebugMsg	(const char* fmt, ...);
BOOL	StringCheck	(char* pszString);

void	MouseInit		(void);
void	MouseSet		(int x, int y, int event);
void	MouseProcess	(void);
int		MouseCheck		(int& iMouseX, int& iMouseY);

void	KeyClearBuffer	(void);
int		KeyAppend		(void);
int		KeyGet			(void);
bool	KeyUnGet		(void);

void	AddMsg();
//----------------------------------------------------------
typedef DWORD OBJID;

typedef struct 
{
	int	x, y;
}CMyPos;

typedef struct 
{
	float fHorizontal;
	float fVertical;
}CMy3DDir;

typedef struct 
{
	int	x, y, z;
}CMy3DPos;

typedef struct {
	float		fRadianX;			// 右方向轴,顺时针
	float		fRadianY;			// 上方向轴,顺时针
	float		fRadianZ;			// 内方向轴,顺时针
}CMy3DPose;



typedef struct {
	int	iWidth, iHeight;
}CMySize;

//----------------------------------------------------------
const int _MAX_STRING		=256;
const int _MAX_NAMESIZE		=16;
const int _MAX_TITLESIZE	=128;
const OBJID	ID_NONE	=0;


//----------------------------------------------------------
#ifndef SAFE_DELETE
	#define SAFE_DELETE(p) { if(p){ try{ delete p; } catch(...){} p=NULL; }}
#endif

//----------------------------------------------------------
#ifndef MYASSERT
	#ifdef _DEBUG
		#define	MYASSERT(x) assert(x)
	#else
		#define	MYASSERT(x)	{if(!(x)) LogMsg("error.log", "★ASSERT(" #x ") in %d line of %s★", __LINE__, __FILE__); }
	#endif
#endif

//---------------------------------------------------------------------
// version define
const int _VERSION		=100;

// game status define
const unsigned int	_STATUS_NONE		=1000;
const unsigned int	_STATUS_ACCOUNT		=_STATUS_NONE+1;
const unsigned int	_STATUS_CONNECT		=_STATUS_NONE+2;
const unsigned int	_STATUS_LOGIN		=_STATUS_NONE+3;
const unsigned int	_STATUS_REGISTER	=_STATUS_NONE+4;
const unsigned int	_STATUS_MAINTAINROLE=_STATUS_NONE+5;

const unsigned int	_STATUS_WAITING		=_STATUS_NONE+8;
const unsigned int	_STATUS_FIGHTING	=_STATUS_NONE+9;
const unsigned int	_STATUS_NORMAL		=_STATUS_NONE+10;
const unsigned int	_STATUS_TASK		=_STATUS_NONE+11;
const unsigned int	_STATUS_GAMBLE		=_STATUS_NONE+12;

const unsigned int	_STATUS_EXIT		=_STATUS_NONE+100;
const unsigned int	_STATUS_DESTROY		=_STATUS_NONE+101;

//---------------------------------------------------------------------
// action define
const int _ACTION_STANDBY		=0;
const int _ACTION_WALK			=1;
const int _ACTION_ATTACK	    =2;
const int _ACTION_WOUND			=3;
const int _ACTION_FAINT	        =4;
const int _ACTION_LIE	        =5;
const int _ACTION_SAYHELLO		=6;
const int _ACTION_GENUFLECT     =7;
const int _ACTION_SAD	        =8;
const int _ACTION_FURY          =9;
const int _ACTION_SITDOWN       =10;
const int _ACTION_DEFEND		=11;
const int _ACTION_LAUGH			=12;
const int _ACTION_POLITENESS	=13;
const int _ACTION_SPATK			=14;
const int _ACTION_CAST          =15;
const int _ACTION_JUMP	        =16;
const int _ACTION_RUNL			=17;
const int _ACTION_RUNR			=18;
const int _ACTION_EXCITEMENT	=19;
const int _ACTION_DRAWBACK		=20;
const int _ACTION_REST1			=21;
const int _ACTION_REST2			=22;
const int _ACTION_DIE1			=23;
const int _ACTION_BODY1			=24;
const int _ACTION_DIE2			=25;
const int _ACTION_BODY2			=26;

const int _ACTION_SHITHAPPEN	=30;
//---------------------------------------------------------------------
#endif

⌨️ 快捷键说明

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