KCore.h
上传用户:dzyhzl
上传日期:2019-04-29
资源大小:56270k
文件大小:4k
源码类别:

模拟服务器

开发平台:

C/C++

  1. //---------------------------------------------------------------------------
  2. // Sword3 Engine (c) 1999-2000 by Kingsoft
  3. //
  4. // File: KCore.h
  5. // Date: 2000.08.08
  6. // Code: Daphnis Wang
  7. // Desc: Header File
  8. //---------------------------------------------------------------------------
  9. #ifndef KCore_H
  10. #define KCore_H
  11. //---------------------------------------------------------------------------
  12. #ifdef _STANDALONE
  13. #define CORE_API
  14. #else
  15. #ifdef CORE_EXPORTS
  16. #define CORE_API __declspec(dllexport)
  17. #else
  18. #define CORE_API __declspec(dllimport)
  19. #endif
  20. #endif
  21. //---------------------------------------------------------------------------
  22. #define DIR_DOWN 0
  23. #define DIR_LEFTDOWN 1
  24. #define DIR_LEFT 2
  25. #define DIR_LEFTUP 3
  26. #define DIR_UP 4
  27. #define DIR_RIGHTUP 5
  28. #define DIR_RIGHT 6
  29. #define DIR_RIGHTDOWN 7
  30. //---------------------------------------------------------------------------
  31. #include "KWin32.h"
  32. #include "KDebug.h"
  33. #include "KMemBase.h"
  34. #include "KStrBase.h"
  35. #ifndef _SERVER
  36. #include "KSpriteCache.h"
  37. #include "KFont.h"
  38. #endif
  39. #include "KTabFile.h"
  40. #include "KProtocol.h"
  41. #include "KEngine.h"
  42. #include "KScriptList.h"
  43. #include "KScriptCache.h"
  44. #include "KSkillManager.h"
  45. #include "MyAssert.H"
  46. class ISkill ;
  47. #ifdef _SERVER
  48. #ifdef _STANDALONE
  49. #include "IServer.h"
  50. #else
  51. #include "../../Headers/IServer.h"
  52. #endif
  53. #else
  54. #include "../../Headers/IClient.h"
  55. #include "KMusic.h"
  56. #include "KSoundCache.h"
  57. #endif
  58. #pragma warning (disable: 4512)
  59. #pragma warning (disable: 4786)
  60. #define TASKCONTENT
  61. //#define BMPMAPDEBUG
  62. //---------------------------------------------------------------------------
  63. #ifdef TOOLVERSION
  64. extern CORE_API int g_ScreenX;
  65. extern CORE_API int g_ScreenY;
  66. #endif
  67. #define ITOA(NUMBER)  #NUMBER
  68. #define __TEXT_LINE__(LINE) ITOA(LINE)
  69. //#ifdef _DEBUG
  70. #define ATTENTION(MSG) __FILE__"("__TEXT_LINE__(__LINE__)") : ★ATTENTION★ → "#MSG
  71. //#else
  72. //#define ATTENTION(MSG) __FILE__"("__TEXT_LINE__(__LINE__)") : ATTENTION!! error: "#MSG
  73. //#endif
  74. #define NET_DEBUG
  75. extern CORE_API KTabFile g_OrdinSkillsSetting, g_MisslesSetting;
  76. extern CORE_API KTabFile g_SkillLevelSetting;
  77. extern CORE_API KTabFile g_NpcSetting;
  78. extern CORE_API KTabFile g_NpcImageSetting;
  79. extern KTabFile g_RankTabSetting;
  80. #ifdef TOOLVERSION
  81. #ifndef __linux
  82. extern CORE_API KSpriteCache g_SpriteCache;
  83. #endif
  84. #endif
  85. #ifndef _SERVER
  86. extern KSoundCache g_SoundCache;
  87. extern KMusic *g_pMusic;
  88. extern unsigned int * g_pAdjustColorTab;
  89. extern unsigned int g_ulAdjustColorCount;
  90. //#define defPLAY_MUSIC(lpszMusicName, nVolume, bLoopFlag)
  91. // if (g_pMusic)
  92. // {
  93. // g_SetFilePath("\");
  94. // g_pMusic->Open(lpszMusicName);
  95. // g_pMusic->SetVolume(nVolume);
  96. // g_pMusic->Play(bLoopFlag);
  97. // }
  98. #endif
  99. //#ifdef _DEBUG
  100. extern CORE_API BOOL g_bDebugScript;
  101. //#endif
  102. extern KTabFile g_NpcKindFile; //记录Npc人物类型文件
  103. #ifndef _SERVER
  104. extern BOOL g_bUISelIntelActiveWithServer;//当前选择框是否与服务器端交互
  105. extern BOOL g_bUISpeakActiveWithServer;
  106. extern int g_bUISelLastSelCount;
  107. #endif
  108. #ifdef _SERVER
  109. enum DBMESSAGE
  110. {
  111. DBMSG_PUSH,
  112. DBMSG_POP,
  113. };
  114. enum DBI_COMMAND
  115. {
  116. DBI_PLAYERSAVE,  // 参数1 是否可以新建角色
  117. DBI_PLAYERLOAD,
  118. DBI_PLAYERDELETE,
  119. DBI_GETPLAYERLISTFROMACCOUNT,
  120. };
  121. BOOL CORE_API g_AccessDBMsgList(DBMESSAGE Msg,  int* pnPlayerIndex, DBI_COMMAND * pnDBICommand, void ** ppParam1, void ** ppParam2);
  122. extern KLuaScript g_WorldScript;
  123. extern KList g_DBMsgList;
  124. class KDBMsgNode :public KNode
  125. {
  126. public:
  127. void * pParam1;
  128. void * pParam2;
  129. int    nPlayerIndex;
  130. DBI_COMMAND Command;
  131. KDBMsgNode(){pParam1 = pParam2 = NULL; nPlayerIndex =  0; Command = DBI_PLAYERSAVE;};
  132. };
  133. #endif
  134. #ifndef _SERVER
  135. class KImageNode : public KNode
  136. {
  137. public:
  138. char m_szFile[32];
  139. int m_nFrame;
  140. int m_nXpos;
  141. int m_nYpos;
  142. };
  143. #endif
  144. #ifndef _SERVER
  145. extern char* g_GetStringRes(int nStringID, char * szString, int nMaxLen);
  146. #endif
  147. BOOL InitSkillSetting();
  148. BOOL InitMissleSetting();
  149. BOOL InitNpcSetting();
  150. void g_ReleaseCore();
  151. inline int GetRandomNumber(int nMin, int nMax)
  152. {
  153. return g_Random(nMax - nMin + 1) + nMin;
  154. }
  155. #ifdef _SERVER
  156. void g_SetServer(LPVOID pServer);
  157. extern IServer* g_pServer;
  158. #else
  159. void g_SetClient(LPVOID pClient);
  160. extern IClient* g_pClient;
  161. //extern BOOL g_bPingReply;
  162. #endif
  163. //---------------------------------------------------------------------------
  164. #endif