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

📄 winmain.h

📁 这是一个服务端/客户端模式的小型网络游戏
💻 H
字号:
#ifndef _WINMAIN_H_
#define _WINMAIN_H_

#include "Game_Chars.h"
#include "Game_Script.h"
class cApp;

// Maximum # of players allowed to be connected at once
#define MAX_PLAYERS           10

///////////////////////////////////////////////////////////////////
// Network message data
///////////////////////////////////////////////////////////////////
// # of messages to process per frame
#define MESSAGES_PER_FRAME   64









///////////////////////////////////////////////////////////////////
// Application class definition
///////////////////////////////////////////////////////////////////
class cApp : public cApplication
{
  friend class cGameScript;
  friend class cChars;
 // friend class cServer;
  private:
    HWND             m_Controls[3];  // The app window handles

    CRITICAL_SECTION m_MessageCS;

    GUID            *m_guidAdapter;  // Adapter used to connect
    cNetworkAdapter  m_Adapters;     // List of adapters
    cServer          m_Server;       // Derived server class
    cFont           m_Font;         // Font object

    cGraphics        m_Graphics;     // Graphics Core interface
    cMesh            m_LevelMesh;    // Mesh of world

    long             m_NumPlayers;   // # players connected

    sItem           m_MIL[1024];
	cChars           m_CharController;
	cSpellController m_SpellController;
	cGameScript     m_Script;
    
    BOOL SelectAdapter();            // Select network adapter
    void SetupApplicationWindow();   // Set application window
    BOOL InitializeGame();           // Initialize game
    BOOL HostGame();                 // Begin hosting game
    // Get player's number in list
    sCharacter* GetCharacterPoint(DPNID dpnidPlayer);

    void ListPlayers();              // List connected players

    void ProcessQueuedMessages();    // Process waiting messages
    void UpdatePlayers();            // Move all players
    void UpdateNetwork();            // Send updates to players
    void UpdateLatency();            // Update latency values
	float GetHeightBelow(cMesh *Mesh, float XPos, float YPos, float ZPos);

    //  Functions to process queued network messages 
    BOOL PlayerID(sMessage *Msg, DPNID To);
    BOOL PlayerInfo(sMessage *Msg, DPNID To);
    BOOL AddPlayer(sMessage *Msg);
    BOOL RemovePlayer(sMessage *Msg);
    BOOL PlayerStateChange(sMessage *Msg);
	BOOL ChangeSpell(sMessage *Msg);
	BOOL ChangeAttack(sMessage *Msg);
	BOOL ItemChange(sMessage *Msg);
//BOOL PlayerSpellChange(sMessage *Msg);
    // Check if player collides with level mesh
    BOOL CheckIntersect(cMesh *Mesh,                          \
                 float XStart, float YStart, float ZStart,    \
                 float XEnd,   float YEnd,   float ZEnd);

  public:
    // Overloaded class functions
    cApp();

    BOOL Init();
    BOOL Shutdown();
    BOOL Frame();
    FAR PASCAL MsgProc(HWND hWnd, UINT uMsg,                  \
                       WPARAM wParam, LPARAM lParam);

    void SetAdapter(GUID *Adapter); // Select adapter GUID

};

int PASCAL WinMain(HINSTANCE hInst, HINSTANCE hPrev,          \
                   LPSTR szCmdLine, int nCmdShow);
BOOL CALLBACK ConfigDialogProc(HWND hWnd, UINT uMsg,          \
                               WPARAM wParam, LPARAM lParam);

#endif

⌨️ 快捷键说明

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