📄 server_de.h
字号:
///////////////// NOT IMPLEMENTED YET /////////////////
// Find the objects intersecting this box.
ObjectList* (*GetBoxIntersecters)(DVector *pMin, DVector *pMax);
// Get the shade (RGB, 0-255) at the point you specify.
// Returns DFALSE if the point is outside the world.
DBOOL (*GetPointShade)(DVector *pPoint, DVector *pColor);
// Gets all the objects with the given name.
// Don't forget to relinquish the list you get!
ObjectList* (*FindNamedObjects)(char *pName);
// Find all the objects touching the given sphere.
// Don't forget to relinquish the list you get!
// Be VERY careful of using a large radius. This function can take
// tons of cycles if the radius is too large.
ObjectList* (*FindObjectsTouchingSphere)(DVector *pPosition, float radius);
// Finds objects touching the cone you specify. This will provide a slight
// overestimation of the cone you specify. This can be much faster than
// FindObjectsTouchingSphere, depending on how small the angle is.
ObjectList* (*FindObjectsTouchingCone)(DVector *pPos, DVector *pDir, float angle, float dist);
// Any time the engine gives you a list, you must 'give it back' with this,
// or else you'll have tons of memory leaks.
void (*RelinquishList)(ObjectList *pList);
// Get the bounding box for the current world.
virtual DRESULT GetWorldBox(DVector &min, DVector &max)=0;
// Object list management.
// Allocate a list (free it with RelinquishList).
ObjectList* (*CreateObjectList)();
// Add objects to a list.
ObjectLink* (*AddObjectToList)(ObjectList *pList, HOBJECT hObj);
// Remove an object from the list given the handle.
// Note: DirectEngine will just do a search over all the objects in the
// list for this, so be warned.
void (*RemoveObjectFromList)(ObjectList *pList, HOBJECT hObj);
// OBSOLETE messaging functions. Use CommonLT::CreateMessage, LMessage::Release,
// and ServerDE::SendToX.
virtual HMESSAGEWRITE StartSpecialEffectMessage(LPBASECLASS pObject)=0;
virtual HMESSAGEWRITE StartInstantSpecialEffectMessage(DVector *pPos)=0;
virtual HMESSAGEWRITE StartMessageToObject(LPBASECLASS pSender, HOBJECT hSendTo, DDWORD messageID)=0;
virtual DRESULT StartMessageToServer(LPBASECLASS pSender, DDWORD messageID, HMESSAGEWRITE *hWrite)=0;
virtual HMESSAGEWRITE StartMessage(HCLIENT hSendTo, DBYTE messageID)=0;
virtual DRESULT EndMessage2(HMESSAGEWRITE hMessage, DDWORD flags)=0;
virtual DRESULT EndMessage(HMESSAGEWRITE hMessage)=0; // Just calls EndMessage2 with MESSAGE_GUARANTEED.
// NEW message functions. The main difference between these and the functions above is
// that these don't free the message for you so you can send it multiple times.
// Use this to setup a special effect message. If your object has
// a special effect message, the client shell's SpecialEffectNotify()
// will be called. An object can only have ONE special effect message.
// If the object already has a special effect message, then it
// clears out the current one.
virtual DRESULT SetObjectSFXMessage(HOBJECT hObject, LMessage &msg)=0;
// Send a message to an object. hSender can be NULL.
virtual DRESULT SendToObject(LMessage &msg, DDWORD msgID, HOBJECT hSender, HOBJECT hSendTo, DDWORD flags)=0;
// Send the message to the server shell. hSender can be NULL.
virtual DRESULT SendToServer(LMessage &msg, DDWORD msgID, HOBJECT hSender, DDWORD flags)=0;
// Send the message to the client. If hSendTo is NULL, it sends to them all.
virtual DRESULT SendToClient(LMessage &msg, DBYTE msgID, HCLIENT hSendTo, DDWORD flags)=0;
// Sends the sfx message to all the clients who can see pos.
virtual DRESULT SendSFXMessage(LMessage &msg, DVector &pos, DDWORD flags)=0;
// Client Functions.
// Attach one client to another. This means that messages sent to hParent
// will also go to hClient, and hClient's client object will be reported
// as hParent's object. This is useful for demo playback when you want
// to watch another player's view.
DRESULT (*AttachClient)(HCLIENT hParent, HCLIENT hChild);
// Detach a client from its parent attachment.
DRESULT (*DetachClient)(HCLIENT hClient);
// Iterate over the clients. Pass in NULL to start. Returns NULL
// when there are no more.
HCLIENT (*GetNextClient)(HCLIENT hPrev);
// Iterate over the saved client references. These come from when
// a world is saved. Pass in DNULL to start. See the Client Functions
// section for the functions to look at these.
HCLIENTREF (*GetNextClientRef)(HCLIENTREF hRef);
// HCLIENTREFs are used for comparison to HCLIENTs.
DDWORD (*GetClientRefInfoFlags)(HCLIENTREF hClient);
DBOOL (*GetClientRefName)(HCLIENTREF hClient, char *pName, int maxLen);
HOBJECT (*GetClientRefObject)(HCLIENTREF hClient);
// Get a client's (unique) ID.
DDWORD (*GetClientID)(HCLIENT hClient);
// Get a client's ping time.
virtual DRESULT GetClientPing(HCLIENT hClient, float &ping)=0;
// Get a client's name.
DBOOL (*GetClientName)(HCLIENT hClient, char *pName, int maxLen);
// A combination of the CIF_ flags above.
void (*SetClientInfoFlags)(HCLIENT hClient, DDWORD dwClientFlags );
DDWORD (*GetClientInfoFlags)(HCLIENT hClient);
// User data for HCLIENTs.
void (*SetClientUserData)(HCLIENT hClient, void *pData);
void* (*GetClientUserData)(HCLIENT hClient);
// Kick a client off the server.
// OnRemoveClient will be called.
void (*KickClient)(HCLIENT hClient);
// Set where the client is seeing/hearing from. This controls what the
// server sends the client. You should set this every frame.
DRESULT (*SetClientViewPos)(HCLIENT hClient, DVector *pPos);
// The 'game console state'. This is a set of console variables and functions
// that is used internally by the application DLLs. The user can't access this
// at all. It's very useful for tracking global game variables and triggering
// them through game objects.
// Run a string through the game console. The syntax is the same as any
// other console string (semicolons separate commands, and new variable names
// create new HCONVARs).
void (*RunGameConString)(char *pString);
// Sets a console variable. Creates a new one if it doesn't exist.
void (*SetGameConVar)(char *pName, char *pVal);
// Get a handle to a console variable.
HCONVAR (*GetGameConVar)(char *pName);
// Get the floating point value of a console variable. If the hVar is
// NULL, then it returns 0.
float (*GetVarValueFloat)(HCONVAR hVar);
// Get the string value of a console variable. If the hVar is
// NULL, then it returns NULL.
char* (*GetVarValueString)(HCONVAR hVar);
// Helpers.
// These are used to get the property values from the world file.
// The property names are case sensitive. If the property doesn't exist,
// it will return DE_NOTFOUND.
DRESULT (*GetPropString)(char *pPropName, char *pRet, int maxLen);
DRESULT (*GetPropVector)(char *pPropName, DVector *pRet);
DRESULT (*GetPropColor)(char *pPropName, DVector *pRet);
DRESULT (*GetPropReal)(char *pPropName, float *pRet);
DRESULT (*GetPropFlags)(char *pPropName, DDWORD *pRet);
DRESULT (*GetPropBool)(char *pPropName, DBOOL *pRet);
DRESULT (*GetPropLongInt)(char *pPropName, long *pRet);
DRESULT (*GetPropRotation)(char *pPropName, DRotation *pRet);
DRESULT (*GetPropRotationEuler)(char *pPropName, DVector *pAngles); // pAngles = (pitch, yaw, roll)
// Fills in the GenericProp for the different data types. For a list
// of which property types map to which GenericProp variable, see
// the GenericProp structure.
// Note: if the property exists, it always initializes the members in the prop first,
// so if the GenericProp variable doesn't support that property type,
// it'll be zero (or ROT_INIT'd).
DRESULT (*GetPropGeneric)(char *pPropName, GenericProp *pProp);
// See if a property exists. If so, pPropType is filled in (if it's non-NULL) with
// on of the PT_ defines. Returns DE_NOTFOUND if it doesn't exist.
DRESULT (*DoesPropExist)(char *pPropName, int *pPropType);
// Get handles from objects and objects from handles. Note: HandleToObject will return
// NULL if the given object doesn't reside on this server (it's controlled remotely).
HOBJECT (*ObjectToHandle)(LPBASECLASS pObject);
LPBASECLASS (*HandleToObject)(HOBJECT hObject);
// Tests if a command is on for this client.
DBOOL (*IsCommandOn)(HCLIENT hClient, int command);
// OBSOLETE. Use CommonLT::GetRotationVectors.
virtual DRESULT GetRotationVectors(DRotation *pRotation,
DVector *pUp, DVector *pRight, DVector *pForward)=0;
// Gets orientation vectors, given an angle vector (x, y, and z rotations).
void (*GetRotationVectorsFromMatrix)(DMatrix *pMat,
DVector *pUp, DVector *pRight, DVector *pForward);
// Does a (fast) upper-case string comparison of the 2 strings.
DBOOL (*UpperStrcmp)(char *pStr1, char *pStr2);
// Rotate this rotation around the given axis by a certain amount.
void (*RotateAroundAxis)(DRotation *pRotation, DVector *pAxis, float amount);
// Treat the rotation like Euler angles...
void (*EulerRotateX)(DRotation *pRotation, float amount);
void (*EulerRotateY)(DRotation *pRotation, float amount);
void (*EulerRotateZ)(DRotation *pRotation, float amount);
// Align a rotation to a normal and spin it.
// Use pUp to set the frame of reference.
// If pUp is NULL or the same direction as pVector, then DirectEngine
// will kludge an up vector.
void (*AlignRotation)(DRotation *pRotation, DVector *pVector, DVector *pUp);
// OBSOLETE: use CommonLT::SetupEuler.
virtual DRESULT SetupEuler(DRotation *pRotation, float pitch, float yaw, float roll)=0;
// Interpolate between two rotations (with quaternions).
DRESULT (*InterpolateRotation)(DRotation *pDest, DRotation *pRot1, DRotation *pRot2, float t);
// Create a transformation matrix from a translation, rotation.
void (*SetupTransformationMatrix)( DMatrix *pMat, DVector *pTranslation, DRotation *pRotation );
// Create a translation matrix for the given translation.
void (*SetupTranslationMatrix)( DMatrix *pMat, DVector *pTranslation );
// Create a rotation matrix for the given rotation.
void (*SetupRotationMatrix)(DMatrix *pMat, DRotation *pRot);
// Create a translation vector from a tranformation matrix.
void (*SetupTranslationFromMatrix)( DVector *pTranslation, DMatrix *pMat );
// Create a rotation for the given tranformation matrix.
void (*SetupRotationFromMatrix)(DRotation *pRot, DMatrix *pMat);
// Rotate around a point.
void (*SetupRotationAroundPoint)(DMatrix *pMat, DRotation *pRot, DVector *pPoint);
// Parse a string for arguments. Works similar to command line parser.
// args within quotation marks are considered one arg.
// Returns the all args after pCommand and before end of string or semi-colon.
// pCommand - Beginning of string.
// pNewCommandPos - Parse fills this in with the ending position
// argBuffer - memory Parse can use as scratchpad
// argPointers - Parse fills these pointers in to point to args found.
// nArgs - Parse fills in the number of arguments found.
// Return - DTRUE, semicolon found, more args in string. DFALSE, no more args.
int (*Parse)(char *pCommand, char **pNewCommandPos, char *argBuffer, char **argPointers, int *nArgs);
// Sound functions.
// Play a sound with full control
// Arguments:
// pPlaySoundInfo - sound control structure
// Returns:
// DE_OK if successful.
// DE_ERROR on error.
DRESULT (*PlaySound)( PlaySoundInfo *pPlaySoundInfo );
// Get total length in seconds of sound.
// Arguments:
// hSound - Handle to sound.
// fDuration - Duration of sound.
// Returns:
// DE_OK if successful.
// DE_INVALIDPARAMS if hSound not available or not tracking time.
DRESULT (*GetSoundDuration)( HSOUNDDE hSound, DFLOAT *fDuration );
// IsSoundDone
// Arguments:
// hSound - Handle to sound.
// bDone - Indicates sound is completed.
// Returns:
// DE_OK if successful.
// DE_INVALIDPARAMS if hSound not available or not tracking time.
DRESULT (*IsSoundDone)( HSOUNDDE hSound, DBOOL *bDone );
// Kill a sound.
// Arguments:
// hSoundHandle - Handle to sound.
// Returns:
// DE_OK if successful.
// DE_ERROR on error.
DRESULT (*KillSound)( HSOUNDDE hSound );
// Inter-object link manipulation.
// If you want to hold on to an HOBJECT and get notification when the
// object is removed from the world, you can create an inter-object link
// between the two. The owner will get MID_LINKBROKEN notification when
// the link is being broken (by either the owner or linked object being removed).
// If a link between the two objects already exists, the function will not
// create another link and return DE_OK.
// An object cannot make a link to itself. This will return DE_ERROR.
DRESULT (*CreateInterObjectLink)(HOBJECT hOwner, HOBJECT hLinked);
// Breaks an inter-object link between the owner and linked object
// (if one exists..) You can only break a link from the owner, since
// the linked object doesn't even know it's linked to the owner..
// Note: MID_LINKBROKEN will NOT be called.
void (*BreakInterObjectLink)(HOBJECT hOwner, HOBJECT hLinked);
// Object manipulation.
// Attaches hChild to hParent. If pNodeName is set, it'll attach hChild to a
// specific node on hParent.
// DE will automatically detach if you remove hParent,
// but it will NOT automatically detach if you remove hChild. If you remove the
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -