📄 server_de.h
字号:
// child without removing the attachment, the results are undefined.
// Returns DE_OK, DE_NODENOTFOUND, or DE_INVALIDPARAMS.
DRESULT (*CreateAttachment)(HOBJECT hParent, HOBJECT hChild, char *pNodeName,
DVector *pOffset, DRotation *pRotationOffset, HATTACHMENT *pAttachment);
// Removes an attachment. Note: an attachment becomes invalid when you remove the parent
// so it'll crash if you call it with an attachment with a parent you've removed.
DRESULT (*RemoveAttachment)(HATTACHMENT hAttachment);
// Look for an attachment on the parent. Returns LT_ERROR, DE_NOTFOUND,
// or LT_OK if it found it. hAttachment is set to NULL if there's an error.
DRESULT (*FindAttachment)(HOBJECT hParent, HOBJECT hChild, HATTACHMENT *hAttachment);
// Get/Set object color info (RGBA 0-1).
// All objects default to (0,0,0,1)
// For lights, this changes the light's color.
// For models, this brightens a model's shading.
DBOOL (*GetObjectColor)(HOBJECT hObject, float *r, float *g, float *b, float *a);
DBOOL (*SetObjectColor)(HOBJECT hObject, float r, float g, float b, float a);
// Get/Set an object's user-defined flags.
DDWORD (*GetObjectUserFlags)(HOBJECT hObj);
DRESULT (*SetObjectUserFlags)(HOBJECT hObj, DDWORD flags);
// OBSOLETE: use the CommonLT ones.
virtual float GetObjectMass(HOBJECT hObj)=0;
virtual void SetObjectMass(HOBJECT hObj, float mass)=0;
// OBSOLETE: Use PhysicsLT.
virtual float GetForceIgnoreLimit(HOBJECT hObj, float &limit)=0;
virtual void SetForceIgnoreLimit(HOBJECT hObj, float limit)=0;
// Use this to iterate thru all the objects in the world.
// Pass in NULL to start off with. It'll return NULL when
// you have iterated through all the objects.
// This is generally a bad idea, but sometimes you have to.
HOBJECT (*GetNextObject)(HOBJECT hObj);
// Same as GetNextObject, but this iterates over all the inactive objects.
HOBJECT (*GetNextInactiveObject)(HOBJECT hObj);
// OBSOLETE: Use CommonLT version.
short GetObjectType(HOBJECT hObj) {DDWORD temp; Common()->GetObjectType(hObj, &temp); return (short)temp;}
// Get the object's name.
char* (*GetObjectName)(HOBJECT hObject);
// Set an object's friction coefficient.
virtual DRESULT SetFrictionCoefficient(HOBJECT hObj, float coeff)=0;
// This is a counter that controls when each object gets its Update()
// function called. This is set to 0.0001 when an object is created
// so by default, Update() gets called right away.
void (*SetNextUpdate)(HOBJECT hObj, DFLOAT nextUpdate);
// Sets the time which the engine will automatically deactivate an object. If object
// is currently autodeactivated, then this call will activate the object
void (*SetDeactivationTime)(HOBJECT hObj, DFLOAT fDeactivationTime);
// Activates any objects seen by this object
void (*PingObjects)(HOBJECT hObj);
// Object data accessors.
void (*GetObjectPos)(HOBJECT hObj, DVector *pos);
void (*SetObjectPos)(HOBJECT hObj, DVector *pos); // Exactly the same as calling Teleport().
// Scale the object (only works on models and sprites).
void (*ScaleObject)(HOBJECT hObj, DVector *pNewScale);
DRESULT (*GetObjectScale)(HOBJECT hObj, DVector *pScale);
// OBSOLETE. Use PhysicsLT::MoveObject.
virtual DRESULT MoveObject(HOBJECT hObj, DVector *pNewPos)=0;
// Teleports the object directly to the position.
DRESULT (*TeleportObject)(HOBJECT hObj, DVector *pNewPos);
// OBSOLETE. Use PhysicsLT::GetStandingOn.
virtual DRESULT GetStandingOn(HOBJECT hObj, CollisionInfo *pInfo)=0;
// Get information about the last collision. Only valid during MID_TOUCHNOTIFY or MID_CRUSH messages.
DRESULT (*GetLastCollision)(CollisionInfo *pInfo);
// Get/Set the object's rotation.
DRESULT (*GetObjectRotation)(HOBJECT hObj, DRotation *pRotation);
DRESULT (*SetObjectRotation)(HOBJECT hObj, DRotation *pRotation);
// This rotates the object to the new rotation with possible client side interpolation
DRESULT (*RotateObject)(HOBJECT hObj, DRotation *pRotation);
// Tilt their acceleration to be along the plane they're standing on.
void (*TiltToPlane)(HOBJECT hObj, DVector *pNormal);
// Get/Set the object's flags.
DDWORD (*GetObjectFlags)(HOBJECT hObj);
void (*SetObjectFlags)(HOBJECT hObj, DDWORD flags);
// Get/set an object's net flags. Net flags are a combination of NETFLAG_ defines.
virtual DRESULT GetNetFlags(HOBJECT hObj, DDWORD &flags)=0;
virtual DRESULT SetNetFlags(HOBJECT hObj, DDWORD flags)=0;
// Get/Set the object's state. State is one of the OBJSTATE_ defines above.
void (*SetObjectState)(HOBJECT hObj, int state);
int (*GetObjectState)(HOBJECT hObj);
// OBSOLETE. Use PhysicsLT.
virtual void GetObjectDims(HOBJECT hObj, DVector *pNewDims)=0;
virtual DRESULT SetObjectDims(HOBJECT hObj, DVector *pNewDims)=0;
virtual DRESULT SetObjectDims2(HOBJECT hObj, DVector *pNewDims)=0;
// OBSOLETE: use CommonLT functions.
virtual DRESULT GetVelocity(HOBJECT hObj, DVector *pVel)=0;
virtual DRESULT SetVelocity(HOBJECT hObj, DVector *pVel)=0;
virtual DRESULT GetAcceleration(HOBJECT hObj, DVector *pAccel)=0;
virtual DRESULT SetAcceleration(HOBJECT hObj, DVector *pAccel)=0;
// Get/Set blocking priority (defaults to 0).
// See FAQ for a description of how this works.
void (*SetBlockingPriority)(HOBJECT hObj, DBYTE pri);
DBYTE (*GetBlockingPriority)(HOBJECT hObj);
// Sprite manipulation.
// This clips the sprite on the poly.
// Returns DE_OK or DE_ERROR if not a sprite.
// Pass in INVALID_HPOLY to un-clip the sprite.
DRESULT (*ClipSprite)(HOBJECT hObj, HPOLY hPoly);
// Light manipulation.
// Get/Set a light's color (RGB, 0.0f to 1.0f).
// When you create a light, its color defaults to (0,0,0).
// Note: a light's color is snapped to 256 different values, so if
// you want to do any fancy interpolation or anything, you'll need
// to store your own, higher precision, color values.
// Note: this just calls GetObjectColor/SetObjectColor.
void (*GetLightColor)(HOBJECT hObj, float *r, float *g, float *b);
void (*SetLightColor)(HOBJECT hObj, float r, float g, float b);
// Get/Set a light's radius.
// When you create a light, its radius defaults to 100.
float (*GetLightRadius)(HOBJECT hObj);
void (*SetLightRadius)(HOBJECT hObj, float radius);
// Model manipulation.
// Iterate through the model's nodes. Returns DE_FINISHED when there are no more.
// hCurNode = INVALID_MODEL_NODE;
// while(interface->GetNextModelNode(hModel, hCurNode, &hCurNode) == DE_OK)
// { ... }
DRESULT (*GetNextModelNode)(HOBJECT hObject, HMODELNODE hNode, HMODELNODE *pNext);
// Get a model node's name.
DRESULT (*GetModelNodeName)(HOBJECT hObject, HMODELNODE hNode, char *pName, DDWORD maxLen);
// Get a model's command string.
DRESULT (*GetModelCommandString)(HOBJECT hObj, char *pStr, DDWORD maxLen);
// Hide/unhide a node on the model (they're all unhidden by default).
// Returns DE_OK, DE_ERROR, LT_NOCHANGE, or DE_NODENOTFOUND.
DRESULT (*SetModelNodeHideStatus)(HOBJECT hObj, char *pNodeName, DBOOL bHidden);
DRESULT (*GetModelNodeHideStatus)(HOBJECT hObj, char *pNodeName, /* out */DBOOL *bHidden);
// Get the current (global) transformation for a model node.
// Returns DFALSE if the node does not exist or if the object
// you pass in is not a model.
DBOOL (*GetModelNodeTransform)(HOBJECT hObj, char *pNodeName,
DVector *pPos, DRotation *pRot);
// Get the absolute world position and rotation of a node on an attached model.
// Inputs:
// hAttachment - Attachment created with CreateAttachment
// pChildNodeName - name of node on attached child model
// Outputs:
// pPos - absolute world position of node.
// pRot - absolute world rotation of node.
DRESULT (*GetAttachedModelNodeTransform)( HATTACHMENT hAttachment, char *pChildNodeName, DVector *pPos, DRotation *pRot);
// Get an animation index from a model.
// Returns -1 if the animation doesn't exist (or if the object isn't a model).
HMODELANIM (*GetAnimIndex)(HOBJECT hObj, char *pAnimName);
// If the object is a model, this sets its current animation.
void (*SetModelAnimation)(HOBJECT hObj, HMODELANIM hAnim);
// Returns the animation the model is currently on. (HMODELANIM)-1 if none.
HMODELANIM (*GetModelAnimation)(HOBJECT hObj);
// Starts the current animation over.
DRESULT (*ResetModelAnimation)(HOBJECT hObj);
// Tells what the playback state of the model is (a combination of the
// MS_ bits defined in basedefs_de.h).
DDWORD (*GetModelPlaybackState)(HOBJECT hObj);
// Get/Set the looping state of the model. The default state is TRUE.
void (*SetModelLooping)(HOBJECT hObj, DBOOL bLoop);
DBOOL (*GetModelLooping)(HOBJECT hObj);
// Get the model filenames. You can pass in DNULL for pFilename and pSkinName.
// Returns DFALSE if the object is not a model.
// Initializes pFilename or pSkinName to zero length if the model doesn't have
// a filename or skin.
DBOOL (*GetModelFilenames)(HOBJECT hObj, char *pFilename, int fileBufLen, char *pSkinName, int skinBufLen);
// Change the object filenames (works on models and sprites.. SetModelFilenames
// is the same as SetObjectFilenames). Even if it fails on the server and
// returns an error, it'll still send a message to the clients.
DRESULT (*SetModelFilenames)(HOBJECT hObj, char *pFilename, char *pSkinName);
DRESULT (*SetObjectFilenames)(HOBJECT hObj, char *pFilename, char *pSkinName);
// Get the endpoints of the model's extents for its current animation frame.
// This is in world space so if you just want the dimensions, take (pMax - pMin) / 2.
// Returns DE_ERROR if it's not a model.
DRESULT (*GetModelFrameBox)(HOBJECT hObj, DVector *pMin, DVector *pMax);
// OBSOLETE: use CommonLT.
virtual DRESULT GetModelAnimUserDims(HOBJECT hObj, DVector *pDims, HMODELANIM hAnim)=0;
// Container manipulation.
// Get the container's container code (can only be set in the ObjectCreateStruct during creation).
// Returns DFALSE if the object isn't a container.
DBOOL (*GetContainerCode)(HOBJECT hObj, D_WORD *pCode);
// Gets the list of containers the object is inside.
// pFlagList must be the same size as pContainerList.
// Returns the number of elements in pList filled in.
DDWORD (*GetObjectContainers)(HOBJECT hObj,
HOBJECT *pContainerList, DDWORD *pFlagList, DDWORD maxListSize);
// Gets the list of objects inside the container.
// Returns the number of elements in pList filled in.
DDWORD (*GetContainedObjects)(HOBJECT hContainer,
HOBJECT *pObjectList, DDWORD *pFlagList, DDWORD maxListSize);
DDWORD (*GetPointContainers)(DVector *pPoint, HOBJECT *pList, DDWORD maxListSize);
// Surface manipulation.
// OBSOLETE: use CommonLT.
virtual DRESULT GetPolyTextureFlags(HPOLY hPoly, DDWORD *pFlags)=0;
// Save game
// dwParam gets passed into MID_SAVEOBJECT as fData.
// Flags is a SAVEOBJECTS_ define.
DRESULT (*SaveObjects)(char *pszSaveFileName, ObjectList *pList, DDWORD dwParam, DDWORD flags);
// dwParam gets passed into MID_LOADOBJECT as fData.
// Flags is a combination of RESTOREOBJECTS_ defines.
DRESULT (*RestoreObjects)( char *pszRestoreFileName, DDWORD dwParam, DDWORD flags );
// Load world
// Flags is a combination of the LOADWORLD_ flags.
DRESULT (*LoadWorld)(char *pszWorldFileName, DDWORD flags);
DRESULT (*RunWorld)();
// Network session manipulation
// Updates the sessions' name.
DRESULT (*UpdateSessionName)(const char* sName);
// Gets the sessions' name.
DRESULT (*GetSessionName)(char* sName, DDWORD dwBufferSize);
// Send a message to the standalone server app. Returns LT_NOTFOUND
// if there is no server app or if it isn't setup to receive the message.
DRESULT (*SendToServerApp)(char *pMsg);
// Gets the tcp/ip address of the main driver if available.
// If you're hosting a game, hostPort is filled in with the port you're hosting on.
// If not, it's set to 0xFFFF.
DRESULT (*GetTcpIpAddress)(char* sAddress, DDWORD dwBufferSize, D_WORD &hostPort);
// 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);
protected:
CommonLT *m_pCommonLT;
PhysicsLT *m_pPhysicsLT;
};
// For backward compatibility.. never use this.
#define CServerDE ServerDE
#endif // __SERVER_DE_H__
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -