Use LoadBSPMem to load brush models.

Now that Mod_LoadBrushModel uses bspfile.[ch], the engine uses the same
code as the tools to work with bsp files.
This commit is contained in:
Bill Currie 2010-08-23 11:56:43 +09:00
parent 7fca21837a
commit cd159e1cc1
7 changed files with 138 additions and 145 deletions

View file

@ -292,7 +292,24 @@ typedef struct bsp_s {
int32_t *surfedges;
} bsp_t;
bsp_t *LoadBSPMem (void *mem, size_t size);
/** Create a bsp structure from a memory buffer.
The returned structure will be setup to point into the supplied buffer.
All structures within the bsp will be byte-swapped. For this reason, if
a callback is provided, the callback be called after byteswapping the
header, but before byteswapping any data in the lumps.
\param mem The buffer holding the bsp data.
\param size The size of the buffer. This is used for sanity checking.
\param cb Pointer to the callback function.
\param cbdata Pointer to extra data for the callback.
\return Initialized bsp structure.
\note The caller maintains ownership of the memory buffer. BSP_Free will
free only the bsp structure itself. However, if the caller wishes to
relinquish ownership of the buffer, set bsp_t::own_header to true.
*/
bsp_t *LoadBSPMem (void *mem, size_t size, void (*cb) (const bsp_t *, void *),
void *cbdata);
bsp_t *LoadBSPFile (QFile *file, size_t size);
void WriteBSPFile (const bsp_t *bsp, QFile *file);
bsp_t *BSP_New (void);

View file

@ -436,7 +436,7 @@ model_t *Mod_FindName (const char *name);
void Mod_ProcessTexture(miptex_t *mt, texture_t *tx);
void Mod_LoadExternalSkins (model_t * mod);
void Mod_LoadExternalTextures (model_t * mod);
void Mod_LoadLighting (lump_t *l);
void Mod_LoadLighting (bsp_t *bsp);
int Mod_CalcFullbright (byte *in, byte *out, int pixels);
int Mod_Fullbright (byte * skin, int width, int height, char *name);