Imports the current Win32 source for the pod-racing game 'Red Planet', built on the MUNGA engine and its L4 (Win32/DirectX) platform layer: - MUNGA / MUNGA_L4: cross-platform engine core and Win32 backend - RP / RP_L4: Red Planet game logic and Win32 application - DivLoader, Setup1: asset loader and installer project - lib, MUNGA_L4/openal, MUNGA_L4/sos: third-party audio dependencies Removed stale Subversion metadata and added .gitignore/.gitattributes. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
230 lines
6.5 KiB
C++
230 lines
6.5 KiB
C++
/*
|
|
-- ----------------------------------------------------------------------------
|
|
--
|
|
-- Copyright 1995 Division Limited.
|
|
-- All Rights Reserved
|
|
--
|
|
--
|
|
-- System :
|
|
-- Module :
|
|
-- Object Name : $RCSfile: vdifile.h,v $
|
|
-- Revision : $Revision: 1.4 $
|
|
-- Date : $Date: 95/04/27 23:01:16 $
|
|
-- Author : $Author: bill $
|
|
--
|
|
-- Description
|
|
--
|
|
-- Notes
|
|
--
|
|
-- History
|
|
--
|
|
--
|
|
-- ----------------------------------------------------------------------------
|
|
*/
|
|
|
|
#ifndef __VDIFILE_H__
|
|
|
|
#define __VDIFILE_H__
|
|
|
|
#ifdef _PF_LOCAL
|
|
#include "pfile.h"
|
|
#else
|
|
#include <dsys/pfile.h>
|
|
#endif
|
|
|
|
/* vdifile error numbers */
|
|
|
|
|
|
#define dvf_OBJECT_TYPE 0x01 /* if flag bit set then obj in scene */
|
|
#define dvf_PARENT_TYPE 0x02 /* if flag bit set then obj is parent */
|
|
#define dvf_OBJECT_LIB 0x04 /* if flag bit set obj is a library */
|
|
|
|
#define dvf_TABSIZE 4
|
|
|
|
typedef enum { dvfLIGHT_AMBIENT, dvfLIGHT_DIRECT } dvfLIGHTTYPE ;
|
|
typedef enum { dvfSTATE_ON=0, dvfSTATE_OFF } dvfSTATE ;
|
|
|
|
extern char *progname ;
|
|
|
|
typedef struct dvfMFILETYPE
|
|
{
|
|
char *name ;
|
|
dpfFILEPTR file ;
|
|
struct dvfMFILETYPE *next ;
|
|
} dvfMFILE, *dvfMFILEPTR ;
|
|
|
|
typedef struct
|
|
{
|
|
/* lighting stuff */
|
|
dvfLIGHTTYPE lightType ;
|
|
dvfSTATE lightState ;
|
|
dpfRGBA colour ;
|
|
} dvfLIGHT, *dvfLIGHTPTR ;
|
|
|
|
typedef struct dvfOBJECTTYPE
|
|
{
|
|
/* Object name, library file name, template name and comment */
|
|
char *name ;
|
|
char *libName ;
|
|
char *tempName ;
|
|
char *comment ;
|
|
|
|
/* position in the world relative to parent */
|
|
dmPoint point ;
|
|
dmScale scale ;
|
|
dmEuler orien ;
|
|
|
|
/* visual info */
|
|
char *geomName ;
|
|
dpfFILEPTR geometry ;
|
|
dvfSTATE geomState ; /* if ON then visible else invisble */
|
|
|
|
/* Light setting of the object */
|
|
dvfLIGHTPTR light ;
|
|
|
|
/* User data - do what you want with these.
|
|
* Guaranteed to be initialised to 0s and NULLs
|
|
*/
|
|
int32 userFlags ;
|
|
void *userData ;
|
|
int32 userFlags2 ;
|
|
void *userData2 ;
|
|
|
|
/* internal flags */
|
|
int32 flags ;
|
|
struct dvfOBJECTTYPE *child_hd, *child_tl ;
|
|
struct dvfOBJECTTYPE *next, *objParent ;
|
|
struct dvfFILETYPE *fileParent ;
|
|
} dvfOBJECT, *dvfOBJECTPTR ;
|
|
|
|
|
|
typedef struct dvfFILETYPE
|
|
{
|
|
char *fileName, *sceneName ;
|
|
char *basePath, *extPath ;
|
|
FILE *fp ;
|
|
int32 useMid, type ;
|
|
int32 disLight ;
|
|
int32 tab ;
|
|
|
|
int32 userFlags ;
|
|
void *userData ;
|
|
|
|
dvfOBJECTPTR defs_hd, defs_tl ;
|
|
dvfOBJECTPTR scene_hd, scene_tl ;
|
|
dvfMFILEPTR mfile_hd ;
|
|
dpfFILETYPE outType ;
|
|
} dvfFILE, *dvfFILEPTR ;
|
|
|
|
|
|
/* Copies sname into dname, correcting any bad characters to '_'
|
|
*
|
|
* Note:- if the name starts with a non alpha character (inc numeric),
|
|
* it is illegal so a pre-pending 'A' is added. For this reason
|
|
* dname must be 1 character bigger than sname.
|
|
*
|
|
* dname can been sname! (if so ensure sname is 1 character bigger)
|
|
*/
|
|
void
|
|
dvfCorrectName(char *dname, char *sname) ;
|
|
|
|
/* File setup and saving ****************************************************/
|
|
dvfFILEPTR
|
|
dvfCreateFile(void) ;
|
|
int32
|
|
dvfSaveFile(dvfFILEPTR file) ;
|
|
int32
|
|
dvfFreeFile(dvfFILEPTR file) ;
|
|
|
|
|
|
int32
|
|
dvfSetFileName(dvfFILEPTR file, char *name) ;
|
|
/* if type is non-zero then the file is a library and saved with the
|
|
* extension of .vdl
|
|
*/
|
|
#define dvfSetFileType(f,t) ((f)->type = t)
|
|
#define dvfDisableDefaultLighting(f) ((f)->disLight = 1)
|
|
int32
|
|
dvfSetFilePaths(dvfFILEPTR file, dpfFILETYPE outType, char *basePath,
|
|
int32 useMid, char *extPath) ;
|
|
#define dvfGetFileSceneName(f) ((f)->sceneName)
|
|
#define dvfGetFileFileName(f) ((f)->fileName)
|
|
|
|
/* Material File calls ******************************************************/
|
|
dvfMFILEPTR
|
|
dvfCreateMaterialFile(void) ;
|
|
int32
|
|
dvfAddMaterialFile(dvfFILEPTR file, dvfMFILEPTR mfile) ;
|
|
int32
|
|
dvfSetMaterialFileName(dvfMFILEPTR mfile, char *name) ;
|
|
|
|
/* OBJECT Functions *********************************************************/
|
|
dvfOBJECTPTR
|
|
dvfCreateObject(void) ;
|
|
void
|
|
dvfUnlinkObject(dvfOBJECTPTR object) ;
|
|
|
|
/* adding object to the hierarchy */
|
|
int32
|
|
dvfAddDefinitionObject(dvfFILEPTR file, dvfOBJECTPTR object) ;
|
|
int32
|
|
dvfAddSceneObject(dvfFILEPTR file, dvfOBJECTPTR object) ;
|
|
int32
|
|
dvfAddObjectObject(dvfOBJECTPTR parent, dvfOBJECTPTR object) ;
|
|
|
|
/* setting object information */
|
|
int32
|
|
dvfSetObjectName(dvfOBJECTPTR object, char *name) ;
|
|
int32
|
|
dvfSetObjectGeometryName(dvfOBJECTPTR object, char *name) ;
|
|
#define dvfSetObjectGeometryState(o,s) ((o)->geomState = s)
|
|
int32
|
|
dvfSetObjectGeometryFile(dvfOBJECTPTR object, dpfFILEPTR file) ;
|
|
int32
|
|
dvfSetObjectLight(dvfOBJECTPTR object, dvfLIGHTPTR light) ;
|
|
#define dvfSetObjectPoint(o,p) dmVectorCopy((o)->point,p)
|
|
#define dvfSetObjectScale(o,s) dmVectorCopy((o)->scale,s)
|
|
#define dvfSetObjectOrien(o,r) dmVectorCopy((o)->orien,r)
|
|
|
|
/* Getting information back again */
|
|
#define dvfGetObjectName(o) ((o)->name)
|
|
#define dvfGetObjectObjectParent(o) ((o)->objParent)
|
|
#define dvfGetObjectFileParent(o) ((o)->fileParent)
|
|
#define dvfGetObjectGeometryName(o) ((o)->geomName)
|
|
#define dvfGetObjectGeometryFile(o) ((o)->geometry)
|
|
#define dvfGetObjectLight(o) ((o)->light)
|
|
#define dvfGetObjectPoint(o,p) dmVectorCopy(p,(o)->point)
|
|
#define dvfGetObjectScale(o,s) dmVectorCopy(s,(o)->scale)
|
|
#define dvfGetObjectOrien(o,r) dmVectorCopy(r,(o)->orien)
|
|
#define dvfGetObjectGeometryState(o) ((o)->geomState)
|
|
|
|
/* The next makes it a UseLibrary if the file name is not NULL or
|
|
* a defineLibrary if NULL
|
|
*/
|
|
int32
|
|
dvfSetObjectLibrary(dvfOBJECTPTR object, char *filename) ;
|
|
/* Sets the library name and object name the use as a Template */
|
|
int32
|
|
dvfSetObjectTemplate(dvfOBJECTPTR object, char *library, char *oname) ;
|
|
int32
|
|
dvfSaveFreeGeometry(dvfFILEPTR file, dvfOBJECTPTR object) ;
|
|
int32
|
|
dvfFreeObject(dvfOBJECTPTR object) ;
|
|
/* Dont use the following as it doesnt up-date pointers */
|
|
int32
|
|
dvfFreeObjectList(dvfOBJECTPTR object) ;
|
|
|
|
/* Light Functions **********************************************************/
|
|
dvfLIGHTPTR
|
|
dvfCreateLight(void) ;
|
|
|
|
#define dvfGetLightType(l) ((l)->lightType)
|
|
#define dvfGetLightState(l) ((l)->lightState)
|
|
#define dvfGetLightColour(l,c) (dpfRGBCpy(c,(l)->light))
|
|
|
|
#define dvfSetLightType(l,t) ((l)->lightType = t)
|
|
#define dvfSetLightState(l,s) ((l)->lightState = s)
|
|
#define dvfSetLightColour(l,c) (dpfRGBACpy((l)->colour,c))
|
|
|
|
#endif /* __VDIFILE_H__ */
|