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

📄 client_de.h

📁 Blood 2全套源码
💻 H
📖 第 1 页 / 共 4 页
字号:


#ifndef __CLIENT_DE_H__
#define __CLIENT_DE_H__


	#include "basedefs_de.h"
	#include "clientshell_de.h"
	#include "common_de.h"
	#include "CSBase.h"

													

	// Particle system flags. Each one slows it down a little more
	// except for PS_NEVERDIE which speeds it up..
	#define PS_BOUNCE		1	// Do they bounce?
	#define PS_SHADOWS		2	// Enable shadows.
	#define PS_NEVERDIE		4	// The particles never die (and it doesn't have to check).
	#define PS_DUMB			8	// The engine leaves the system alone.. you must
								// update and move them.


	class SpriteControl;


	
	// The particle structure for particle systems.
	typedef struct DEParticle_t
	{
		DVector m_Velocity;
		DVector	m_Color;	// Particle colors are 0-255.
		struct DEParticle_t *m_pNext;
	} DEParticle;

	
	// The line structure for line system.
	typedef struct DELinePt_t
	{
		DVector		m_Pos;
		float		r, g, b, a;	// Values 0-1.
	} DELinePt;

	typedef struct DELine_t
	{
		DELinePt	m_Points[2];
	} DELine;

	DEFINE_HANDLE_TYPE(HDELINE)

	// ------------------------------------------------------------------ //
	// Client-side object flags.
	// ------------------------------------------------------------------ //

	// The engine calls ClientShell::OnObjectRemove() when the object goes away.
	#define CF_NOTIFYREMOVE		(1<<0)
	#define CF_NOTIFYMODELKEYS	(1<<1)	// Calls ClientShellDE::OnModelKey when it hits model keys.
	#define CF_DONTSETDIMS		(1<<2)	// The engine automatically sets the object's dims to its
										// animation dims.  This tells it not to.

	


	//  Music info

	#define MUSIC_IMMEDIATE			0
	#define MUSIC_NEXTMEASURE		1
	#define MUSIC_NEXTSONG			2
	#define MUSIC_QUEUE				3


	// Used in AddSurfaceEffect.
	typedef struct SurfaceEffectDesc_t
	{
		char	*m_pName;  // You don't have to allocate this..
		
		// If you return NULL from here, the effect won't be initialized.
		void*	(*InitEffect)(struct SurfaceData_t *pSurfaceData, int argc, char **argv);
		int		(*UpdateEffect)(struct SurfaceData_t *pSurfaceData, void *pData);	// pData is what you returned from InitEffect.
												// Return 1 if you changed the surface.
		void	(*TermEffect)(void *pData);
	} SurfaceEffectDesc;


	// ------------------------------------------------------------------ //
	// Model hook stuff.
	// ------------------------------------------------------------------ //

	typedef void (*ModelHookFn)(struct ModelHookData_t *pData, void *pUser);



	class CPhysicsLT;


	// ------------------------------------------------------------------ //
	// ClientDE interface. This is what the ClientShells and special
	// effect plugins use to do the interface and client objects for the game.
	// ------------------------------------------------------------------ //

	class ClientDE : public CSBase
	{
	friend class CClientMgr;

	protected:

			virtual			~ClientDE() {}

	
	public:
		
			
		
		// Access to the smaller interfaces.

			CommonLT*	Common()	{return m_pCommonLT;}
			CPhysicsLT*	Physics()	{return m_pPhysicsLT;}

		
		// Connection stuff.

			// Tries to start the game in the mode you specify.
			// This will keep the existing game running until it successfully starts
			// the new game.. ie: if there's an error starting the new world, it
			// will still leave the current one running and put up an error message.
			DRESULT		(*StartGame)(StartGameRequest *pRequest);

			// Find out what the current game mode is (how we started the last
			// game with StartGame or thru the console).  Fills in mode with 
			// one of the STARTGAME_ defines above.
			DRESULT		(*GetGameMode)(int *mode);

			// Gets the local client ID.
			// Returns DE_NOTCONNECTED if we're not on a server or haven't
			// gotten a client ID yet.
			DRESULT		(*GetLocalClientID)(DDWORD *pID);

			DBOOL		(*IsConnected)();	// Are we on a server currently?

			// Disconnect from the server we're on (if any).
			// NOTE: this will destroy any client-side objects you've created!
			void		(*Disconnect)();

			// Shuts down the app (not right away, but after the current update).
			void		(*Shutdown)();

			// Shuts down the app (not right away, but after the current update).
			void		(*ShutdownWithMessage)( char *pMsg, ... );

			// OBSOLETE: use the CommonDE one.
			virtual DRESULT GetPointStatus(DVector *pPoint)=0;

			// Get the shade (RGB, 0-255) at the point you specify.
			// Returns DE_NOTINWORLD if the point is outside the world.
			virtual DRESULT	GetPointShade(DVector *pPoint, DVector *pColor)=0;
			
		
		// Renderer management.

			// Flip the screen.  Flags are a combination of FLIPSCREEN_ flags in de_codes.
			// Returns LT_OK or LT_NOTINITIALIZED.
			DRESULT		(*FlipScreen)(DDWORD flags);

			// Clear the backbuffer.  Pass in NULL to clear the whole screen.
			// Flags is a combination of the CLEARSCREEN_ flags in de_codes.h.
			// Returns LT_OK or LT_NOTINITIALIZED.
			DRESULT		(*ClearScreen)(DRect *pClearRect, DDWORD flags);

			// You must be in a Start3D()/End3D() block in order to render
			// through any cameras.
			// Returns LT_OK or LT_NOTINITIALIZED or LT_ALREADYIN3D.
			DRESULT		(*Start3D)();
			
				// Render from the camera's position into its rectangle.
				// Returns LT_OK or LT_NOTINITIALIZED or LT_NOTIN3D.
				DRESULT		(*RenderCamera)(HLOCALOBJ hCamera);

				// Renders the list of objects through the given camera.
				// Returns LT_OK or LT_NOTINITIALIZED or LT_NOTIN3D.
				DRESULT		(*RenderObjects)(HLOCALOBJ hCamera, HLOCALOBJ *pObjects, int nObjects);

				// You must be in a StartOptimized2D()/EndOptimized2D() block to draw any optimized 2D surfaces.
				DRESULT		(*StartOptimized2D)();
				DRESULT		(*EndOptimized2D)();
			
			// Returns LT_OK or LT_NOTINITIALIZED or LT_NOTIN3D.
			DRESULT		(*End3D)();

			// Get a (NULL-terminated) list of supported render modes.
			RMode*		(*GetRenderModes)();
			void		(*RelinquishRenderModes)(RMode *pModes);
			
			// Fills in the current render mode.
			DRESULT		(*GetRenderMode)(RMode *pMode);

			// Goes into the requested render mode.
			// Returns LT_OK if successful.  Note: it may not have set the _exact_ mode you
			// requested.  You can check with GetRenderMode() to see what the new mode is.
			// Returns LT_KEPTSAMEMODE if it couldn't set the mode requested, but
			// was able to restore the previous mode.
			// Returns DE_UNABLETORESTOREVIDEO if it couldn't set the mode and couldn't
			// restore the video mode (in which case it will give a message and shutdown
			// afterwards).
			DRESULT		(*SetRenderMode)(RMode *pMode);
			
			// Shutdown the renderer.  flags is a combination of the RSHUTDOWN_ flags in de_codes.h.
			// The renderer won't come back until you call SetRenderMode().
			DRESULT		(*ShutdownRender)(DDWORD flags);


		// File management.

			// Open a file up.  Pass in the relative filename.
			// Free the file by calling DStream::Release().
			virtual DRESULT	OpenFile(char *pFilename, DStream **pStream)=0;
		
			// Get a list of files/directories in a directory (pass in "" to start with).
			// The list is a noncircular linked list with DNULL terminating it.
			FileEntry*	(*GetFileList)(char *pDirName);
			
			// Use FreeFileList when you're done with each list you get.
			void		(*FreeFileList)(FileEntry *pHead);

			// Get the world info string from the World Info dialog in DEdit.
			// Returns DE_NOTFOUND if it can't open the file and DE_INVALIDWORLDFILE
			// if the file is an invalid version.
			DRESULT		(*GetWorldInfoString)(char *pFilename, char *pInfoString, DDWORD maxLen, DDWORD *pActualLen);

			// Read/write configuration files.  Returns LT_ERROR if the file doesn't exist
			// or if it can't open the file for writing.
			DRESULT		(*ReadConfigFile)(char *pFilename);
			DRESULT		(*WriteConfigFile)(char *pFilename);


		// Interface stuff.

			// offsets is NUM_AXIS_OFFSETS large.
			void		(*GetAxisOffsets)(DFLOAT *offsets);

			void		(*PlayJoystickEffect)(char *pEffectName, float x, float y);
		

		// Music functions.

			DBOOL		(*InitMusic)( char *szMusicDLL );

			// Sets the directory to find music data files.
			// IMA only.
			DBOOL		(*SetMusicDirectory)( char *szMusicDirectory );

			// Downloads DLS.
			// szDLSFile is the Downloadable Synthizer file containing the waves for 
			// instruments.  szStyleFile is a style file, that is a compainion to the 
			// DLS file.  It must contain bands that define the program changes for
			// each instrument in DLS...
			// IMA only.
			DBOOL		(*InitInstruments)( char *szDLSFile, char *szStyleFile );

			// Cache in a song file.
			DBOOL		(*LoadSong)(char *szSong);

			// Remove all the songs from memory...
			void		(*DestroyAllSongs)();

			// Plays a playlist.  All songs will be played until end of list.  
			// Arguments:
			//		szPlayList - Name of playlist.
			//		szTransition - Name of transition song to play before playlist starts.  IMA only.
			//		bLoop - Loop the list.
			//		dwBoundaryFlags - Can be MUSIC_IMMEDIATE, MUSIC_MEASURE, MUSIC_SONG, MUSIC_QUEUE.  Valid for IMA only.
			DBOOL		(*PlayList)( char *szPlayList, char *szTransition, DBOOL bLoop, DDWORD dwBoundaryFlags );

			// Plays a musical break.
			// IMA only.
			// Arguments:
			//		szSong - Name of song.
			//		dwBoundaryFlags - Can be MUSIC_IMMEDIATE, MUSIC_MEASURE, MUSIC_SONG, MUSIC_QUEUE.  Valid for IMA only.
			DBOOL		(*PlayBreak)( char *szSong, DDWORD dwBoundaryFlags );

			// Stops music.  
			// Arguments:
			//		dwBoundaryFlags - Can be MUSIC_IMMEDIATE, MUSIC_MEASURE, MUSIC_SONG, MUSIC_QUEUE.  Valid for IMA only.
			void		(*StopMusic)( DDWORD dwBoundaryFlags );

			// Pause music.  Can be resumed...
			DBOOL		(*PauseMusic)();

			// Resume music...
			DBOOL		(*ResumeMusic)();

⌨️ 快捷键说明

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