📄 bloodclientshell.h
字号:
#ifndef __BLOODCLIENTSHELL_H__
#define __BLOODCLIENTSHELL_H__
#include <stdio.h>
#include <math.h>
#include <mbstring.h>
#include "cpp_clientshell_de.h"
#include "MainMenus.h"
#include "SharedDefs.h"
#include "MessageMgr.h"
#include "NewStatusBar.h"
#include "CommLink.h"
#include "ViewWeapon.h"
#include "SFXMgr.h"
#include "PlayerCamera.h"
#include "ContainerCodes.h"
#include "LoadSave.h"
#include "Music.h"
#include "CameraFX.h"
#include "viewcreature.h"
#include "FragInfo.h"
#include "Credits.h"
#include "VoiceMgr.h"
#include "LTGUIMgr.h"
#include "MessageBoxHandler.h"
#include "TeamMgr.h"
// game version
#ifdef _DEMO
#define version_string "DEMO v1.0a (Build 109)"
#else
#ifdef _ADDON
#define version_string "NIGHTMARES v1.0.233"
#else
#define version_string "v2.1.233"
#endif
#endif
// game states
#define GS_NONE 666 // No game state
#define GS_PLAYING 0 // Playing the game
#define GS_MENU 1 // Running the menu
#define GS_MENUANIM 2 // Menu is sliding onto the screen
#define GS_LOADINGLEVEL 3 // Waiting for a new level to load
#define GS_SAVING 4 // Waiting for a save game acknowledgement
#define GS_MPLOADINGLEVEL 5 // Loading a multiplayer level
#define GS_CREDITS 6 // Credits screen
#define GS_MOVIES 7 // Logo movies
#define GS_SPLASH 8 // Splash screen displayed
#define GS_WAITING 9 // Waiting for a key press
#define GS_MPCHANGINGLEVELS 10 // Changing levels in a multiplayer game
#define CLIENTWEAPONSLOTS 18 // 10 standard slots, plus inventory weapons
#define CLIENTITEMSLOTS 6
#define CLIENTSPELLSLOTS 6
#define CLIENTBINDINGSLOTS 3
#define DETAIL_LOW 0
#define DETAIL_MEDIUM 1
#define DETAIL_HIGH 2
// Message box command ID
#define MESSAGE_BOX_ID_KILL 1
// Structure to hold data read from the player.cfg file
struct ConfigStruct
{
ConfigStruct()
{
memset(this, 0, sizeof(ConfigStruct));
nStrength = nSpeed = nMagic = nResistance = 1;
_mbscpy((unsigned char*)szName, (const unsigned char*)"New Player");
}
DBYTE nStrength;
DBYTE nSpeed;
DBYTE nMagic;
DBYTE nResistance;
DBYTE nCharacter;
DBYTE nSkin;
char szName[MAX_PLAYERNAME_LEN];
DBYTE nWeaponSlots[CLIENTWEAPONSLOTS];
DBYTE nItemSlots[CLIENTITEMSLOTS];
DBYTE nSpellSlots[CLIENTSPELLSLOTS];
DBYTE nProximityBombs;
DBYTE nRemoteBombs;
DBYTE nSmokeBombs;
DBYTE nTimeBombs;
DBYTE nBindingSlots[CLIENTBINDINGSLOTS];
};
//DBOOL LoadConfig(char* pfilename, ConfigStruct *pConfig);
// Structure to hold various data items sent by the client
typedef struct
{
DBYTE byFlags;
DFLOAT fPitch;
DFLOAT fYaw;
DVector GunMuzzlePos;
DVector lGunMuzzlePos;
DFLOAT MouseAxis0;
DFLOAT MouseAxis1;
ContainerCode eContainer;
HOBJECT hContainerAtBottom;
} ClientData;
// Abort function prototypes.
void Abort(char* sErrorMsg, DDWORD dwCode);
void Abort(int nErrorID, DDWORD dwCode);
class CMoveMgr;
// Definition of the client shell structure.
class CBloodClientShell : public CClientShellDE
{
public:
CBloodClientShell();
~CBloodClientShell();
void CSPrint (char* msg, ...);
void CSPrint (int nStringID);
void CSPrint2 (char* msg);
CVoiceMgr* GetVoiceMgr() { return &m_VoiceMgr; }
CTeamMgr* GetTeamMgr() { return &m_TeamMgr; }
CSFXMgr* GetSFXMgr() { return &m_sfxMgr; }
HLOCALOBJ GetCameraObj() { return m_hCamera; }
CSavedGameInfo* GetSavedGameInfo() { return &m_SavedGameInfo; }
void ShakeScreen(DVector *vShake, DFLOAT fTime);
void FlashScreen(DVector *vFlashColor, DFLOAT fTime, DFLOAT fRampUp);
void UpdateWonkyVision(DBOOL bUpdate=DTRUE); //for thief attaching
DBOOL IsWonky() { return(m_bWonkyVision); }
DBOOL IsWonkyVision() { return(m_bWonkyVision); }
DBOOL IsWonkyNoMove() { return(m_bWonkyNoMove); }
void StartWonkyVision(DFLOAT fWonkyTime, DBOOL bNoMove);
void EndWonkyVision();
DVector GetLightScale() {return m_vLightScale;}
void RemoveCreature() {delete m_pCreature; m_pCreature = DNULL;}
void StartNewGame(char *pszWorld);
DBOOL StartNewWorld(char *pszWorld, DBYTE nGameType, DBYTE nLoadType, DBYTE nDifficulty = DIFFICULTY_EASY);
DRESULT InitSound();
HSOUNDDE PlaySound(char* sSound, DBOOL bStream=DFALSE, DBOOL bLoop=DFALSE, DBOOL bGetHandle=DFALSE);
void DisplayStatusBarFlagIcon(DBOOL bDisplay);
void AssignFrags(DDWORD dwLocalID, DDWORD dwVictim, DDWORD dwKiller);
DBOOL SetCharacterInfo(int nCharacter, int nSkin);
void ResetPlayerInventory();
// Advanced options from launcher
DBOOL AdvancedDisableMusic() { return m_bAdvancedDisableMusic; }
DBOOL AdvancedDisableSound() { return m_bAdvancedDisableSound; }
DBOOL AdvancedDisableMovies() { return m_bAdvancedDisableMovies; }
DBOOL AdvancedDisableJoystick() { return m_bAdvancedDisableJoystick; }
DBOOL AdvancedEnableOptSurf() { return m_bAdvancedEnableOptSurf; }
DBOOL AdvancedDisableLightMap() { return m_bAdvancedDisableLightMap; }
DBOOL AdvancedEnableTripBuf() { return m_bAdvancedEnableTripBuf; }
DBOOL AdvancedDisableDx6Cmds() { return m_bAdvancedDisableDx6Cmds; }
DBOOL AdvancedEnableTJuncs() { return m_bAdvancedEnableTJuncs; }
DBOOL AdvancedDisableFog() { return m_bAdvancedDisableFog; }
DBOOL AdvancedDisableLines() { return m_bAdvancedDisableLines; }
DBOOL AdvancedDisableModelFB() { return m_bAdvancedDisableModelFB; }
DBOOL AdvancedEnablePixelDoubling() { return m_bAdvancedEnablePixelDoubling; }
DBOOL AdvancedEnableMultiTexturing() { return m_bAdvancedEnableMultiTexturing; }
// Movie stuff
DBOOL PlayMovie(CClientDE* pClientDE, char* sMovie, DBOOL bCheckExistOnly = DFALSE);
DBOOL StartMovies(CClientDE* pClientDE);
DBOOL EndMovies(CClientDE* pClientDE, DBOOL bShowTitle = DFALSE);
DBOOL AdvanceMovies(CClientDE* pClientDE);
void UpdateMoviesState();
// Menu execute functions
DBOOL MenuQuit();
DBOOL MenuNewGame(int nDifficulty, int nCharacter = CHARACTER_CALEB, int nGameType = GAMETYPE_SINGLE);
DBOOL MenuNewNightmaresGame(int nDifficulty);
DBOOL MenuHostGame();
DBOOL MenuJoinGame();
DBOOL MenuCredits();
DBOOL MenuHelp();
DBOOL MenuLoadGame(int nSlot);
DBOOL MenuSaveGame(int nSlot, DBYTE bySaveType = SAVETYPE_CURRENT);
DBOOL MenuLoadCustomLevel(char* sLevel, int nDifficulty);
DBOOL MenuReturnToGame();
DBOOL MenuSetDetail();
// Mouse access
void SetMouseSensitivity(float fSpeed);
float GetMouseSensitivity();
DBOOL IsMouseInvertYAxis() { return m_bMouseInvertYAxis; }
void SetMouseInvertYAxis(DBOOL bInvert) { m_bMouseInvertYAxis=bInvert; }
DBOOL IsMouseLook() { return m_bMouseLook; }
void SetMouseLook(DBOOL bMouseLook) { m_bMouseLook=bMouseLook; }
DBOOL IsLookSpring() { return m_bLookSpring; }
void SetLookSpring(DBOOL bLookSpring) { m_bLookSpring=bLookSpring; }
// Joystick routines
DBOOL IsUseJoystick() { return m_bUseJoystick; }
void SetUseJoystick(DBOOL bUseJoystick);
// Keyboard stuff
float GetKeyboardTurnRate() { return m_fKeyboardTurnRate; }
void SetKeyboardTurnRate(float fRate);
// Puts a message box on the screen. It is removed when ENTER, ESC, or SPACE is pressed
// or on the next page flip if bAsync is FALSE.
void DoMessageBox(char *lpszMessage, DBOOL bAsync=DTRUE);
// Kills the message box on the screen
void KillMessageBox();
// Game state management
int GetGameState() { return(m_nGameState); }
DBOOL SetGameState(int nState);
// Determines if we are in a multiplayer game
int GetGameType() { return(m_nGameType); }
DBOOL IsMultiplayerGame();
DBOOL IsMultiplayerTeamBasedGame();
DBOOL IsMultiplayerTeams() { return(m_nGameType == NGT_TEAMS); }
DBOOL IsMultiplayerCtf() { return(m_nGameType == NGT_CAPTUREFLAG); }
// Access to member variables
DBOOL IsInWorld() { return m_bInWorld; }
DBOOL IsDead() { return m_bDead; }
DBOOL IsTrapped() { return (DBOOL)m_nTrapped; }
void IgnoreKeyboardMessage(DBOOL bIgnore) { m_bIgnoreKeyboardMessage=bIgnore; }
DBYTE GetGlobalDetail() { return m_nGlobalDetail; }
DBOOL NightGogglesActive( ) { return m_bNightGogglesActive; }
DBOOL BinocularsActive( ) { return m_bBinocularsActive; }
DBOOL IsPaused() { return m_bPaused; }
DBOOL IsExternalCamera() { return !!m_pExternalCamera; }
DBOOL IsSpectatorMode() { return m_bSpectatorMode; }
DBOOL IsZoomed() { return m_bZoomView; }
DBOOL IsNetFriendlyFire() { return(m_bNetFriendlyFire); }
DBOOL IsNetNegTeamFrags() { return(m_bNetNegTeamFrags); }
DBOOL IsNetOnlyFlagScores() { return(m_bNetOnlyFlagScores); }
DBOOL IsNetOnlyGoalScores() { return(m_bNetOnlyGoalScores); }
// New physics stuff
DBYTE GetCDataFlags() { return cdata.byFlags; }
void GetCameraRotation(DRotation *pRot);
ContainerCode GetCurContainerCode() const { return m_eCurContainerCode; }
void SetVelMagnitude(DFLOAT fMag) { m_fVelMagnitude = fMag; }
DFLOAT GetEyeLevel() { return m_fEyeLevel; }
DBYTE GetCharacter() { return m_Config.nCharacter; }
void SetPowerBarLevel(DFLOAT fPercent);
DDWORD GetAmmo() { return m_dwAmmo; }
DDWORD GetAltAmmo() { return m_dwAltAmmo; }
protected:
DRESULT OnEngineInitialized(RMode *pMode, DGUID *pAppGuid);
void OnEngineTerm();
void OnEnterWorld();
void OnExitWorld();
void OnEvent(DDWORD dwEventID, DDWORD dwParam);
void UpdateCamera();
void FirstUpdate();
void Update();
void PostUpdate();
void UpdateCredits();
DRESULT OnObjectMove(HOBJECT hObj, DBOOL bTeleport, DVector *pPos);
DRESULT OnObjectRotate(HOBJECT hObj, DBOOL bTeleport, DRotation *pNewRot);
void PreLoadWorld(char *pWorldName);
void OnCommandOn(int command);
void OnCommandOff(int command);
void OnKeyDown(int key, int rep);
void OnKeyUp(int key);
void OnMessage(DBYTE messageID, HMESSAGEREAD hMessage);
void SpecialEffectNotify(HLOCALOBJ hObj, HMESSAGEREAD hMessage);
void OnObjectRemove(HLOCALOBJ hObj);
void OnModelKey(HLOCALOBJ hObj, ArgList *pArgs);
void SendPlayerUpdateMessage(DBOOL bSendAll);
void SendPlayerInitMessage(DBYTE messageID);
// Get the mouse device name and axis names
void GetMouseDeviceInfo(char *lpszDeviceName, int nDeviceBufferSize,
char *lpszXAxis, int nXAxisBufferSize,
char *lpszYAxis, int nYAxisBufferSize);
void UpdateSoundReverb( );
private:
void InitSinglePlayer();
void InitMultiPlayer();
void UpdateBob();
void UpdateHeadCant();
DBOOL UpdatePlayerCamera();
void SetCameraStuff(HLOCALOBJ hPlayerObj, HLOCALOBJ hCamera);
void UpdateGun(DRotation *rot, DVector *pos);
void ChangeWeapon(DBYTE slot);
void PauseGame (DBOOL bPause);
void UpdateScreenShake();
void UpdateScreenFlash();
void UpdateContainerFX();
void UpdateUnderWaterFX(DBOOL bUpdate=DTRUE);
void HandleExitWorld(HMESSAGEREAD hMessage);
DBOOL StartNewGame(char *pszWorldName, DBYTE nStartType, DBYTE nGameType, DBYTE nLoadType, DBYTE nDifficulty);
void ShowPlayer(DBOOL bShow);
void DrawLoadingScreen();
DBOOL DoMultiplayer(DBOOL bMinimize, DBOOL bHost);
void HandleInvAction( DBYTE nType, DBOOL bActivate );
void ShowInfoBox(char *lpszMessage, DBOOL bCloseButton);
void KillInfoBox();
DBOOL HandleFiring();
CViewWeapon* CreateWeapon(DBYTE byType, DBOOL bLeftHand);
// Internal game state management
DBOOL TransitionGameState(int nOldState, int nNewState);
DBOOL IsGameStateValid(int nState);
DBOOL OnEnterPlayingState(int nOldState);
DBOOL OnEnterMenuState(int nOldState);
DBOOL OnEnterMenuAnimState(int nOldState);
DBOOL OnEnterLoadingLevelState(int nOldState);
DBOOL OnEnterSavingState(int nOldState);
DBOOL OnEnterMultiLoadingLevelState(int nOldState);
DBOOL OnEnterCreditsState(int nOldState);
DBOOL OnEnterMoviesState(int nOldState);
DBOOL OnEnterSplashState(int nOldState);
DBOOL OnEnterWaitingState(int nOldState);
DBOOL OnExitPlayingState(int nNewState);
DBOOL OnExitMenuState(int nNewState);
DBOOL OnExitMenuAnimState(int nNewState);
DBOOL OnExitLoadingLevelState(int nNewState);
DBOOL OnExitSavingState(int nNewState);
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -