Files
BT412/engine/MUNGA_L4/libDPL/dsys/VDIFILE.H
T
arcattackandClaude Opus 4.8 7b7d465e5e Initial commit: bt411 -- standalone Windows BattleTech (Tesla 4.10 port)
Clean, self-contained extraction of the BattleTech-specific work from the
reverse-engineering workspace -- engine + game + content + build, with nothing
from Red Planet or the raw archive dumps. Builds green (Win32) and runs the
single-player drive->animate->target->fire->damage->destroy loop out of the box.

Layout:
  engine/   MUNGA + MUNGA_L4 shared 2007 engine, carrying our BT render/loader
            work (bgfload/L4D3D/L4VIDEO: BSL bit-slice decode, LOD/ground/shadow
            models) + image codec; the minimal rp/ headers the audio HAL needs
  game/     reconstructed BT logic + surviving-original BT source + fwd shims
            + WinMain launcher
  content/  full runtime tree (BTL4.RES, VIDEO/, GAUGE/, AUDIO/, eggs, BTDPL.INI)
  docs/     format specs + reconstruction ledgers
  reference/ raw Ghidra pseudocode (recon source-of-truth) + decomp exporter
  tools/    MP console emulator + map/resource scanners

One top-level CMake builds munga_engine lib + bt410_l4 game lib + btl4.exe.
All paths relativized (186 fwd shims + ~437 CMake abs paths -> repo-relative);
DXSDK is the one external, overridable via -DDXSDK. Verified: builds to a
byte-identical 2.27MB exe and runs combat (TARGET DESTROYED, 0 crashes) against
the bundled content.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-07-05 21:03:40 -05:00

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__ */