extern void R_Q1BSP_Draw(entity_render_t *ent);
extern void R_Q1BSP_DrawShadowVolume(entity_render_t *ent, vec3_t relativelightorigin, float lightradius, int numsurfaces, const int *surfacelist, const vec3_t lightmins, const vec3_t lightmaxs);
extern void R_Q1BSP_DrawLight(entity_render_t *ent, float *lightcolor, int numsurfaces, const int *surfacelist);
-void Mod_IDP0_Load(model_t *mod, void *buffer)
+void Mod_IDP0_Load(model_t *mod, void *buffer, void *bufferend)
{
int i, j, version, totalskins, skinwidth, skinheight, groupframes, groupskins, numverts;
float scales, scalet, scale[3], translate[3], interval;
}
}
-void Mod_IDP2_Load(model_t *mod, void *buffer)
+void Mod_IDP2_Load(model_t *mod, void *buffer, void *bufferend)
{
int i, j, k, hashindex, num, numxyz, numst, xyz, st, skinwidth, skinheight, *vertremap, version, end, numverts;
float *stverts, s, t, scale[3], translate[3];
surface->num_vertices = surface->groupmesh->num_vertices;
}
-void Mod_IDP3_Load(model_t *mod, void *buffer)
+void Mod_IDP3_Load(model_t *mod, void *buffer, void *bufferend)
{
int i, j, k, version;
qbyte *data;
Mod_FreeSkinFiles(skinfiles);
}
-void Mod_ZYMOTICMODEL_Load(model_t *mod, void *buffer)
+void Mod_ZYMOTICMODEL_Load(model_t *mod, void *buffer, void *bufferend)
{
zymtype1header_t *pinmodel, *pheader;
qbyte *pbase;
Mem_Free(outtexcoord2f);
}
-void Mod_DARKPLACESMODEL_Load(model_t *mod, void *buffer)
+void Mod_DARKPLACESMODEL_Load(model_t *mod, void *buffer, void *bufferend)
{
dpmheader_t *pheader;
dpmframe_t *frame;
int ofs_end; // end of file
} md2_t;
-extern void Mod_IDP0_Load(struct model_s *mod, void *buffer);
-extern void Mod_IDP2_Load(struct model_s *mod, void *buffer);
-extern void Mod_IDP3_Load(struct model_s *mod, void *buffer);
-extern void Mod_ZYMOTICMODEL_Load(struct model_s *mod, void *buffer);
-extern void Mod_DARKPLACESMODEL_Load(struct model_s *mod, void *buffer);
-
-extern void Mod_AliasInit(void);
-
#include "model_zymotic.h"
#include "model_dpmodel.h"
}
aliasbone_t;
-struct frameblend_s;
-void Mod_Alias_GetMesh_Vertex3f(const struct model_s *model, const struct frameblend_s *frameblend, const struct surfmesh_s *mesh, float *out3f);
-int Mod_Alias_GetTagMatrix(const struct model_s *model, int poseframe, int tagindex, matrix4x4_t *outmatrix);
-int Mod_Alias_GetTagIndexForName(const struct model_s *model, unsigned int skin, const char *tagname);
-
#endif
extern void R_Q1BSP_GetLightInfo(entity_render_t *ent, vec3_t relativelightorigin, float lightradius, vec3_t outmins, vec3_t outmaxs, int *outleaflist, qbyte *outleafpvs, int *outnumleafspointer, int *outsurfacelist, qbyte *outsurfacepvs, int *outnumsurfacespointer);
extern void R_Q1BSP_DrawShadowVolume(entity_render_t *ent, vec3_t relativelightorigin, float lightradius, int numsurfaces, const int *surfacelist, const vec3_t lightmins, const vec3_t lightmaxs);
extern void R_Q1BSP_DrawLight(entity_render_t *ent, float *lightcolor, int numsurfaces, const int *surfacelist);
-void Mod_Q1BSP_Load(model_t *mod, void *buffer)
+void Mod_Q1BSP_Load(model_t *mod, void *buffer, void *bufferend)
{
int i, j, k;
dheader_t *header;
*/
}
-void static Mod_Q2BSP_Load(model_t *mod, void *buffer)
+void static Mod_Q2BSP_Load(model_t *mod, void *buffer, void *bufferend)
{
int i;
q2dheader_t *header;
loadmodel->brush.num_leafs = numleafs;
}
-void Mod_Q3BSP_Load(model_t *mod, void *buffer)
+void Mod_Q3BSP_Load(model_t *mod, void *buffer, void *bufferend)
{
int i, j, numshadowmeshtriangles;
q3dheader_t *header;
}
}
-void Mod_IBSP_Load(model_t *mod, void *buffer)
+void Mod_IBSP_Load(model_t *mod, void *buffer, void *bufferend)
{
int i = LittleLong(((int *)buffer)[1]);
if (i == Q3BSPVERSION)
- Mod_Q3BSP_Load(mod,buffer);
+ Mod_Q3BSP_Load(mod,buffer, bufferend);
else if (i == Q2BSPVERSION)
- Mod_Q2BSP_Load(mod,buffer);
+ Mod_Q2BSP_Load(mod,buffer, bufferend);
else
Host_Error("Mod_IBSP_Load: unknown/unsupported version %i\n", i);
}
-void Mod_MAP_Load(model_t *mod, void *buffer)
+void Mod_MAP_Load(model_t *mod, void *buffer, void *bufferend)
{
Host_Error("Mod_MAP_Load: not yet implemented\n");
}
}
mlight_t;
-struct model_s;
-void Mod_Q1BSP_Load(struct model_s *mod, void *buffer);
-void Mod_IBSP_Load(struct model_s *mod, void *buffer);
-void Mod_MAP_Load(struct model_s *mod, void *buffer);
-void Mod_BrushInit(void);
-
// Q2 bsp stuff
#define Q2BSPVERSION 38
if (buf)
{
+ char *bufend = buf + fs_filesize;
num = LittleLong(*((int *)buf));
// call the apropriate loader
loadmodel = mod;
- if (!memcmp(buf, "IDPO", 4)) Mod_IDP0_Load(mod, buf);
- else if (!memcmp(buf, "IDP2", 4)) Mod_IDP2_Load(mod, buf);
- else if (!memcmp(buf, "IDP3", 4)) Mod_IDP3_Load(mod, buf);
- else if (!memcmp(buf, "IDSP", 4)) Mod_IDSP_Load(mod, buf);
- else if (!memcmp(buf, "IDS2", 4)) Mod_IDS2_Load(mod, buf);
- else if (!memcmp(buf, "IBSP", 4)) Mod_IBSP_Load(mod, buf);
- else if (!memcmp(buf, "ZYMOTICMODEL", 12)) Mod_ZYMOTICMODEL_Load(mod, buf);
- else if (!memcmp(buf, "DARKPLACESMODEL", 16)) Mod_DARKPLACESMODEL_Load(mod, buf);
- else if (strlen(mod->name) >= 4 && !strcmp(mod->name - 4, ".map")) Mod_MAP_Load(mod, buf);
- else if (num == BSPVERSION || num == 30) Mod_Q1BSP_Load(mod, buf);
+ if (!memcmp(buf, "IDPO", 4)) Mod_IDP0_Load(mod, buf, bufend);
+ else if (!memcmp(buf, "IDP2", 4)) Mod_IDP2_Load(mod, buf, bufend);
+ else if (!memcmp(buf, "IDP3", 4)) Mod_IDP3_Load(mod, buf, bufend);
+ else if (!memcmp(buf, "IDSP", 4)) Mod_IDSP_Load(mod, buf, bufend);
+ else if (!memcmp(buf, "IDS2", 4)) Mod_IDS2_Load(mod, buf, bufend);
+ else if (!memcmp(buf, "IBSP", 4)) Mod_IBSP_Load(mod, buf, bufend);
+ else if (!memcmp(buf, "ZYMOTICMODEL", 12)) Mod_ZYMOTICMODEL_Load(mod, buf, bufend);
+ else if (!memcmp(buf, "DARKPLACESMODEL", 16)) Mod_DARKPLACESMODEL_Load(mod, buf, bufend);
+ else if (strlen(mod->name) >= 4 && !strcmp(mod->name - 4, ".map")) Mod_MAP_Load(mod, buf, bufend);
+ else if (num == BSPVERSION || num == 30) Mod_Q1BSP_Load(mod, buf, bufend);
else Con_Printf("Mod_LoadModel: model \"%s\" is of unknown/unsupported type\n", mod->name);
Mem_Free(buf);
}
int Mod_LoadSkinFrame(skinframe_t *skinframe, char *basename, int textureflags, int loadpantsandshirt, int usedetailtexture, int loadglowtexture);
int Mod_LoadSkinFrame_Internal(skinframe_t *skinframe, char *basename, int textureflags, int loadpantsandshirt, int usedetailtexture, int loadglowtexture, qbyte *skindata, int width, int height);
-// used for talking to the QuakeC mainly
-int Mod_Q1BSP_NativeContentsFromSuperContents(struct model_s *model, int supercontents);
-int Mod_Q1BSP_SuperContentsFromNativeContents(struct model_s *model, int nativecontents);
-
extern cvar_t r_mipskins;
typedef struct skinfileitem_s
void Mod_SnapVertices(int numcomponents, int numvertices, float *vertices, float snap);
int Mod_RemoveDegenerateTriangles(int numtriangles, const int *inelement3i, int *outelement3i, const float *vertex3f);
+// bsp models
+void Mod_BrushInit(void);
+// used for talking to the QuakeC mainly
+int Mod_Q1BSP_NativeContentsFromSuperContents(struct model_s *model, int supercontents);
+int Mod_Q1BSP_SuperContentsFromNativeContents(struct model_s *model, int nativecontents);
+
+// alias models
+struct frameblend_s;
+void Mod_AliasInit(void);
+void Mod_Alias_GetMesh_Vertex3f(const model_t *model, const struct frameblend_s *frameblend, const struct surfmesh_s *mesh, float *out3f);
+int Mod_Alias_GetTagMatrix(const model_t *model, int poseframe, int tagindex, matrix4x4_t *outmatrix);
+int Mod_Alias_GetTagIndexForName(const model_t *model, unsigned int skin, const char *tagname);
+
+// sprite models
+void Mod_SpriteInit(void);
+
+// loaders
+void Mod_Q1BSP_Load(model_t *mod, void *buffer, void *bufferend);
+void Mod_IBSP_Load(model_t *mod, void *buffer, void *bufferend);
+void Mod_MAP_Load(model_t *mod, void *buffer, void *bufferend);
+void Mod_IDP0_Load(model_t *mod, void *buffer, void *bufferend);
+void Mod_IDP2_Load(model_t *mod, void *buffer, void *bufferend);
+void Mod_IDP3_Load(model_t *mod, void *buffer, void *bufferend);
+void Mod_ZYMOTICMODEL_Load(model_t *mod, void *buffer, void *bufferend);
+void Mod_DARKPLACESMODEL_Load(model_t *mod, void *buffer, void *bufferend);
+void Mod_IDSP_Load(model_t *mod, void *buffer, void *bufferend);
+void Mod_IDS2_Load(model_t *mod, void *buffer, void *bufferend);
+
#endif // MODEL_SHARED_H
}
extern void R_Model_Sprite_Draw(entity_render_t *ent);
-void Mod_IDSP_Load(model_t *mod, const void *buffer)
+void Mod_IDSP_Load(model_t *mod, void *buffer, void *bufferend)
{
int version;
const qbyte *datapointer;
}
-void Mod_IDS2_Load(model_t *mod, const void *buffer)
+void Mod_IDS2_Load(model_t *mod, void *buffer, void *bufferend)
{
int i, version;
const dsprite2_t *pinqsprite;
float modelradius;
-
+
loadmodel->type = mod_sprite;
loadmodel->flags2 = EF_FULLBRIGHT;
rtexture_t *texture, *fogtexture;
} mspriteframe_t;
-extern void Mod_IDSP_Load(struct model_s *mod, const void *buffer);
-extern void Mod_IDS2_Load(struct model_s *mod, const void *buffer);
-extern void Mod_SpriteInit(void);
-
#endif