***************************************************************************** SERVICE FUNCTIONS ***************************************************************************** These functions provide an easy interface to VPE internals. You can use them either in your main program or effects (unless stated otherwise). ============================================================================= void LoadZone(char *Filename); ----------------------------------------------------------------------------- Description: Loads a zone file. Do NOT call it from an effect. It uses functions from FileSystem to load the file. Parameters: Filename - Full filename of the zone to load Return: None ============================================================================= ============================================================================= void TexAlloc(struct TexCon *pTC,char *Name); ----------------------------------------------------------------------------- Description: Allocates a texture. The actual raw data is not loaded - the engine will load it automatically when needed. Parameters: pTC - Ptr to TexCon structure. Note: You have to have this structure allocated before the call. Name - Texture name to allocate (no extension). If VPE does not find TEX file with this name it'll create a dummy texture and try to load PIC file with the same name into it. If it is not found you get FatalError. Return: None ============================================================================= ============================================================================= void TexUpdate(struct TexCon *pTC); ----------------------------------------------------------------------------- Description: Has to be called each frame for multi-frame textures not loaded with the zone eg overlays in an effect routine. Parameters: pTC - Ptr to TexCon structure. It should be initialized with TexAlloc() Return: None ============================================================================= ============================================================================= void TexAction(struct TexCon *pTC, int Seq); ----------------------------------------------------------------------------- Description: Go to a new animation sequence in a texture. For example you might have Action #3 to be a death sequence for a monster. When you find that the monster should start dying call TexAction(pTC,3). For this to work you must create appropriate texture in TE. Parameters: pTC - Ptr to TexCon structure. Seq - Sequence to start. Return: None ============================================================================= ============================================================================= void TexFree(struct TexCon *pTC); ----------------------------------------------------------------------------- Description: If you have allocated your own texture and now know that it will never be used, you can use this function to unload the texture manually. Parameters: pTC - Ptr to TexCon structure. It should be initialized with TexAlloc() Return: None ============================================================================= //===================== // Structure functions //===================== void StructStart(struct Point *, int); // Start struct. movement void StructStop(struct Point *); // Stop struct. movement int StructUpdate(struct Point *); // Update struct. for the next frame //========================= // VPE resource management //========================= void UpdateObject(struct Object *); // Update obj physics/col det struct Object *AddObject(void); // Add a new object struct Object *DelObject(struct Object *); // Delete an object struct Point *AddPoint(void); // Add a new point struct Point *DelPoint(struct Point *); // Delete a point struct Region *FindRegion(FIXED,FIXED,FIXED); // Find region for given coords void SetObjRegion(struct Object *,struct Region *);// Set reg for an object void ClearObjRegion(struct Object *); // Clear reg. from an obj. void SetViewSize(struct View *,int,int,BYTE *,int);// Set view dimensions void SetViewDir(struct View *,int,int); // Set view direction //=================== // Effect management //=================== void RegisterEffect(char *, void (*func)(void *,DWORD,DWORD), DWORD); struct Effect *GetEffect(char *, void *); void ProcessEffect(struct Effect *, void *, DWORD, DWORD); //================== // Effect functions //================== void ActivateTag(int); struct Wall *RAdjWall(struct Region *,int *); //================ // Math functions //================ FIXED FixSin(SHORT); // SIN of an angle given in units FIXED FixCos(SHORT); // COS FIXED FixITan(FIXED,FIXED); // Angle in units FIXED FixDist(FIXED,FIXED,FIXED,FIXED); // Find approx distance LONG LongSqrt(LONG); // Pretty fast sqrt //================= // Misc. functions //================= void *CacheAlloc(LONG); // Alloc. mem. freeing some cache void *AddEntry(struct Table *); // Add entry to a table void *DelEntry(struct Table *, int); // Del entry from a table by idx void *DelEntry2(struct Table *, void *);// Del entry by ptr BYTE IsVisible(struct Region *, struct Region *); // Check visibility FIXED GetSPF(FIXED); // Get speed per frame void DrawOverlay(struct TexCon *,int,int,int);// Draw overlay on screen void SetPickWatch(int,int); // Set pick watch for scr coords WORD GetPickWatch(void *,FIXED *); // Get result of pick watching void SetTrace(struct Object *); // Set object to trace BYTE GetTrace(int *,int *,int *,int *);// Get results of object tracing