📄 basedefs_de.h
字号:
// If the m_hObject is the world, then m_hPoly contains a handle to the polygon the object collided with.
// Otherwise it is equal to DNULL.
HPOLY m_hPoly;
// Stopping velocity. Engine will automatically apply this velocity to stop object from continuing
// to collide with blocker.
DVector m_vStopVel;
};
// ---------------------------------------------------------------------- //
// Sound 3D Provider
//
// Used with GetSoundSW3DProviderList, GetSoundHW3DProviderList and
// ReleaseSound3DProviderList.
// ---------------------------------------------------------------------- //
// Sound 3D provider ID's
#define SOUND3DPROVIDERID_NONE 0
#define SOUND3DPROVIDERID_DS3D_HARDWARE 1
#define SOUND3DPROVIDERID_DS3D_HARDWARE_EAX 2
#define SOUND3DPROVIDERID_DS3D_SOFTWARE 3
#define SOUND3DPROVIDERID_A3D 4
#define SOUND3DPROVIDERID_INTEL_RSX 5
#define SOUND3DPROVIDERID_MILES3D 6
#define SOUND3DPROVIDERID_UNKNOWN 7
// Caps bits
#define SOUND3DPROVIDER_CAPS_REVERB (1<<0)
struct Sound3DProvider
{
DDWORD m_dwProviderID;
char m_szProvider[_MAX_PATH+1];
DDWORD m_dwCaps;
Sound3DProvider * m_pNextProvider;
};
// ---------------------------------------------------------------------- //
// Reverb properties
//
// Use this structure with SetReverb and GetReverb
// ---------------------------------------------------------------------- //
#define REVERBPARAM_VOLUME (1<<0) // m_fVolume field valid
#define REVERBPARAM_ACOUSTICS (1<<1) // m_dwAcoustics field valid
#define REVERBPARAM_REFLECTTIME (1<<2) // m_fReflectTime field valid
#define REVERBPARAM_DECAYTIME (1<<3) // m_fDecayTime field valid
#define REVERBPARAM_DAMPING (1<<4) // m_fDamping field valid
#define REVERBPARAM_ALL REVERBPARAM_VOLUME | REVERBPARAM_ACOUSTICS | REVERBPARAM_REFLECTTIME | REVERBPARAM_DECAYTIME | REVERBPARAM_DAMPING
// These are the valid values for m_dwAcoustics field
enum
{
REVERB_ACOUSTICS_GENERIC,
REVERB_ACOUSTICS_PADDEDCELL,
REVERB_ACOUSTICS_ROOM,
REVERB_ACOUSTICS_BATHROOM,
REVERB_ACOUSTICS_LIVINGROOM,
REVERB_ACOUSTICS_STONEROOM,
REVERB_ACOUSTICS_AUDITORIUM,
REVERB_ACOUSTICS_CONCERTHALL,
REVERB_ACOUSTICS_CAVE,
REVERB_ACOUSTICS_ARENA,
REVERB_ACOUSTICS_HANGAR,
REVERB_ACOUSTICS_CARPETEDHALLWAY,
REVERB_ACOUSTICS_HALLWAY,
REVERB_ACOUSTICS_STONECORRIDOR,
REVERB_ACOUSTICS_ALLEY,
REVERB_ACOUSTICS_FOREST,
REVERB_ACOUSTICS_CITY,
REVERB_ACOUSTICS_MOUNTAINS,
REVERB_ACOUSTICS_QUARRY,
REVERB_ACOUSTICS_PLAIN,
REVERB_ACOUSTICS_PARKINGLOT,
REVERB_ACOUSTICS_SEWERPIPE,
REVERB_ACOUSTICS_UNDERWATER,
REVERB_ACOUSTICS_DRUGGED,
REVERB_ACOUSTICS_DIZZY,
REVERB_ACOUSTICS_PSYCHOTIC,
REVERB_ACOUSTICS_COUNT // total number of room types
};
struct ReverbProperties
{
DDWORD m_dwParams; // Set the params bits for which fields are valid
float m_fVolume; // 0.0 - 1.0
DDWORD m_dwAcoustics; // One of the REVERB_ACOUSTICS_xxx values
float m_fReflectTime; // 0.0 - 5.0 Time for first reflection
float m_fDecayTime; // 0.1 - 20.0 Determines how quickly reflection diminish
float m_fDamping; // 0.0 - 2.0, == 1.0f is even damping, < 1.0f low frequencies dampen faster
// > 1.0f high frequencies dampen faster
};
// ---------------------------------------------------------------------- //
// Sound effects.
//
// The type of sounds are: ambient, local and 3D. The flags controlling
// these types are mutually exclusive. An ambient sound will have distance
// effects of rolloff, but no orientation effects. A local sound will have
// no orientation or distance effects and will be as if the sound was played
// inside the player's head. The 3d sound will have distance, orientation
// and doppler effects.
//
// Sounds are played from the beginning once the message reaches the client.
// If it is important that the playback be synchronized with the server's
// beginning time, then set PLAYSOUND_TIMESYNC. Normally, this is not
// that important. The server will use it internally if a client comes in
// after a sound has already been played.
//
// The server keeps a sound object if any of the following flags are set:
// PLAYSOUND_LOOP, PLAYSOUND_ATTACHED, PLAYSOUND_GETHANDLE, PLAYSOUND_TIMESYNC,
// PLAYSOUND_TIME. Server kept sounds will update clients that come and go.
// Non-server kept sounds are sent to the existing clients once, so the
// overhead is much less.
//
// Server kept sounds with PLAYSOUND_GETHANDLE must be removed by the game.
// Other server kept sounds are removed if they time out, or the object they
// are attached to is removed. When a sound is removed from the server,
// it tells the clients to remove their copies.
//
// Server tells clients about its sounds if the client object is within
// twice the outer radius of the sound. If local sound, then server always
// tells all the clients.
//
// Sounds that have a client object in m_hObject and PLAYSOUND_CLIENTLOCAL
// or PLAYSOUND_ATTACHED are played with PLAYSOUND_LOCAL for that particular client.
//
// The PLAYSOUND_CLIENT is for client initiated sounds only. When playing
// client side sounds, the PLAYSOUND_ATTACHED and PLAYSOUND_CLIENTLOCAL
// flags and m_wObjectID are ignored.
//
// Using PLAYSOUND_FILESTREAM tells the client to stream the file from disk.
// This prevents the loading of all of the sound data, but is slower.
// ---------------------------------------------------------------------- //
#define PLAYSOUND_LOCAL 0x0000 // Play sound locally (inside head)
#define PLAYSOUND_AMBIENT 0x0001 // Play sound as ambient sound.
#define PLAYSOUND_3D 0x0002 // Play sound as 3D sound.
#define PLAYSOUND_LOOP 0x0004 // Loop the sound.
#define PLAYSOUND_ATTACHED 0x0008 // Sounds position & orientation comes from object in m_hObject
#define PLAYSOUND_GETHANDLE 0x0010 // Handle requested
#define PLAYSOUND_TIME 0x0020 // Server must time sound
#define PLAYSOUND_CTRL_VOL 0x0040 // Control volume m_nVolume
#define PLAYSOUND_REVERB 0x0080 // Allow reverb
#define PLAYSOUND_CLIENT 0x0100 // Client side sound
#define PLAYSOUND_TIMESYNC 0x0200 // Playback synchronized with server clock
#define PLAYSOUND_FILESTREAM 0x0400 // Stream the file
#define PLAYSOUND_CLIENTLOCAL 0x0800 // Sound is played with PLAYSOUND_LOCAL for object in m_hObject
typedef struct PlaySoundInfo_t
{
// PLAYSOUND flags.
DDWORD m_dwFlags;
// File name of sound
char m_szSoundName[_MAX_PATH+1];
// SERVER ONLY: Object sound is attached to.
// Only needed if PLAYSOUND_ATTACHED or PLAYSOUND_CLIENTLOCAL set
HOBJECT m_hObject;
// Handle of sound
// Filled by PlaySound if PLAYSOUND_GETHANDLE set
HSOUNDDE m_hSound;
// Voice priority
// 0 is lowest priority
unsigned char m_nPriority;
// Maximum radius of sound. No sound outside this.
// Only needed if PLAYSOUND_3D or PLAYSOUND_AMBIENT
float m_fOuterRadius;
// Inner radius of sound. Sound at maximum volume inside this radius
// Only needed if PLAYSOUND_3D or PLAYSOUND_AMBIENT
float m_fInnerRadius;
// Volume of sound in percent [0,100].
// Only needed if PLAYSOUND_CTRL_VOL set, otherwise defaults 100
DBYTE m_nVolume;
// Position of sound.
// Only needed if PLAYSOUND_AMBIENT and PLAYSOUND_3D set
// Only needed if PLAYSOUND_ATTACHED cleared
DVector m_vPosition;
} PlaySoundInfo;
#define PLAYSOUNDINFO_COPY( dest, src ) \
memcpy(( void * )&( dest ), ( void * )&( src ), sizeof( PlaySoundInfo ));
#define PLAYSOUNDINFO_INIT(x) memset(&x, 0, sizeof(x));
// ---------------------------------------------------------------------- //
// InitSoundInfo
//
// Used to initialize the sound engine.
// ---------------------------------------------------------------------- //
// Maximum number of voices allowed for either sw or 3d
#define INITSOUNDINFO_MAXVOICES 128
// Used for m_dwFlags parameter
#define INITSOUNDINFOFLAG_CONVERT16TO8 (1<<0) // Convert all 16 bit buffers to 8 bit
#define INITSOUNDINFOFLAG_RELOADSOUNDS (1<<1) // Reload any sounds that exist before InitSound called
// Engine can fill these flags in the m_dwResults parameter
#define INITSOUNDINFORESULTS_REVERB (1<<0) // Provider chosen supports reverb
typedef struct InitSoundInfo_t
{
// Name of 3d provider to use
char m_sz3DProvider[_MAX_PATH+1];
// Number of sw voices
DBYTE m_nNumSWVoices;
// Number of 3D voices
DBYTE m_nNum3DVoices;
// Output sound format. Sample rate (8000, 11025, 22050 or
// 44100 kHz), Bits per sample (8 or 16)...
unsigned short m_nSampleRate;
unsigned short m_nBitsPerSample;
// Use INITSOUNDINFOFLAG_xxx flags
unsigned long m_dwFlags;
// Engine fills in this parameter with INITSOUNDINFORESULTS_xxx after InitSound is called.
unsigned long m_dwResults;
// Initial volume (0-100)
unsigned short m_nVolume;
// Distance factor in meters/game unit
float m_fDistanceFactor;
// Number of seconds to make streaming buffer. Don't go less than 0.2, though. The buffer
// is also limited by a minimum size of 20k.
float m_fMinStreamTime;
} InitSoundInfo;
// Initialize the InitSoundInfo structure to the default values...
#define INITSOUNDINFO_INIT( initSoundInfo ) \
initSoundInfo.m_sz3DProvider[0] = 0; \
initSoundInfo.m_nNumSWVoices = 32; \
initSoundInfo.m_nNum3DVoices = 0; \
initSoundInfo.m_nSampleRate = 22050; \
initSoundInfo.m_nBitsPerSample = 16; \
initSoundInfo.m_dwFlags = 0; \
initSoundInfo.m_nVolume = 100; \
initSoundInfo.m_fDistanceFactor = 1.0f; \
initSoundInfo.m_fMinStreamTime = 0.5f;
// ------------------------------------------------------------------ //
// Use this to start a game.
// ------------------------------------------------------------------ //
#define STARTGAME_HOST 0 // Start a world and host it (using dialogs).
#define STARTGAME_HOSTTCP 1 // Start a world and host on TCP/IP.
#define STARTGAME_CLIENT 2 // Connect to a server using dialogs.
#define STARTGAME_CLIENTTCP 3 // Connect to the first TCP/IP game it can find
// at m_pTCPAddress.
#define STARTGAME_NORMAL 4 // Start a normal game.
#define GAMEMODE_NONE 5 // (Used for GetGameMode, means we're not
// running a world or on a server yet).
#define SG_LOBBY 1 // Game was lobby-launched
#define MAX_SGR_STRINGLEN 100
class StartGameRequest
{
public:
StartGameRequest()
{
m_Type = STARTGAME_NORMAL;
m_WorldName[0] = 0;
m_TCPAddress[0] = 0;
m_RecordFilename[0] = 0;
m_PlaybackFilename[0] = 0;
m_flags = 0;
m_pGameInfo = DNULL;
m_GameInfoLen = 0;
m_pNetSession = DNULL;
m_pClientData = DNULL;
m_ClientDataLen = 0;
}
int m_Type;
char m_WorldName[MAX_SGR_STRINGLEN];
char m_TCPAddress[MAX_SGR_STRINGLEN]; // TCP/IP address, if any.
// Filename to record into, if any (set to 0 length if you don't want to record).
// NOTE: when this is set, the engine starts the server but doesn't run the level, you must
// send a message to the server telling it to load the world.
char m_RecordFilename[MAX_SGR_STRINGLEN];
// The filename of a recorded demo. If this is filled in, the engine starts a server
// and fills in m_WorldName with the world that the demo record uses. You need to
// send a message to the server telling it to load that world.
char m_PlaybackFilename[MAX_SGR_STRINGLEN];
NetSession *m_pNetSession; // This must be used with STARTGAME_CLIENT.
NetHost m_HostInfo; // This must be used with STARTGAME_HOST.
DDWORD m_flags; // Various flags
void *m_pGameInfo; // This data is copied over and can be accessed by
DDWORD m_GameInfoLen; // the server with ServerDE::GetGameInfo() (if you're
// running a local or hosted game).
// This data gets sent up and passed into OnClientEnterWorld on the server.
void *m_pClientData;
DDWORD m_ClientDataLen;
};
// The new console parsing thing.
class ConParse
{
public:
ConParse() {m_pCommandPos = NULL;}
ConParse(char *pBuffer) {m_pCommandPos = pBuffer;}
// Sets it up to parse the specified buffer.
void Init(char *pBuffer) {m_pCommandPos = pBuffer;}
// The parsed arguments.
char *m_Args[PARSE_MAXTOKENS];
int m_nArgs;
// Used internally by the engine.
public:
// Parse the next set of tokens. Returns TRUE if it parsed anything.
DBOOL Parse();
// Parses until it finds tokens with pLookFor as the first one.
// You can use this just like Parse like this:
// while(ParseFind("AmbientLight", FALSE)) { ... }
DBOOL ParseFind(char *pLookFor, DBOOL bCaseSensitive, DDWORD minTokens=1);
private:
char *m_pCommandPos;
char m_ArgBuffer[PARSE_MAXTOKENS*PARSE_MAXTOKENSIZE];
};
// ---------------------------------------------------------------------- //
// Intersection stuff.
// ---------------------------------------------------------------------- //
// Return DTRUE to select this object and DFALSE to not select it.
typedef DBOOL (*ObjectFilterFn)(HOBJECT hObj, void *pUserData);
// Pass this in to the IntersectSegment routine.
class IntersectQuery
{
public:
IntersectQuery()
{
m_Flags = 0;
m_FilterFn = 0;
}
// Start and end points.
DVector m_From;
DVector m_To;
// Only used for CastRay.. this is the direction the ray should be cast in.
// This doesn't need to be normalized.
DVector m_Direction;
// A combination of the intersect flags (in de_codes.h).
DDWORD m_Flags;
// If this is not NULL, then it'll call this function when it has a
// POSSIBLE object intersection (it doesn't know if it really intersects
// yet when it calls this). If you return FALSE from this function,
// then it will ignore the object and continue on.
ObjectFilterFn m_FilterFn;
// Passed into pUserData of the filter function.
void *m_pUserData;
};
typedef struct IntersectInfo_t
{
// Point of intersection.
DVector m_Point;
// Plane of intersection.
DPlane m_Plane;
// Object it hit.
HOBJECT m_hObject;
// The polygon it hit (if it's a world poly).
// Value is INVALID_HPOLY if it didn't hit one.
HPOLY m_hPoly;
// Surface flags of what it hit (these aren't object flags, and are
// only set if it hit the world or a WorldModel).
DDWORD m_SurfaceFlags;
} IntersectInfo;
#define ClientIntersectInfo IntersectInfo
#define ClientIntersectQuery IntersectQuery
#endif // __BASEDEFS_H__
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -