mirror of
https://git.code.sf.net/p/quake/quakeforge
synced 2024-11-26 06:10:56 +00:00
[model] Clean up the globals around model loading
Covers only the generic load code (alias etc to follow), but this should take care of a lot of issues in the future.
This commit is contained in:
parent
afe8e9633e
commit
bb6c6963d2
44 changed files with 408 additions and 399 deletions
|
@ -102,13 +102,14 @@ typedef struct aliasctx_s {
|
|||
|
||||
struct vulkan_ctx_s;
|
||||
struct entity_s;
|
||||
void *Vulkan_Mod_LoadSkin (byte *skin, int skinsize, int snum, int gnum,
|
||||
qboolean group, maliasskindesc_t *skindesc,
|
||||
void *Vulkan_Mod_LoadSkin (model_t *mod, byte *skin, int skinsize, int snum,
|
||||
int gnum, qboolean group,
|
||||
maliasskindesc_t *skindesc,
|
||||
struct vulkan_ctx_s *ctx);
|
||||
void Vulkan_Mod_FinalizeAliasModel (model_t *m, aliashdr_t *hdr,
|
||||
struct vulkan_ctx_s *ctx);
|
||||
void Vulkan_Mod_LoadExternalSkins (model_t *mod, struct vulkan_ctx_s *ctx);
|
||||
void Vulkan_Mod_MakeAliasModelDisplayLists (model_t *m, aliashdr_t *hdr,
|
||||
void Vulkan_Mod_MakeAliasModelDisplayLists (model_t *mod, aliashdr_t *hdr,
|
||||
void *_m, int _s, int extra,
|
||||
struct vulkan_ctx_s *ctx);
|
||||
|
||||
|
|
|
@ -346,6 +346,8 @@ typedef enum {mod_brush, mod_sprite, mod_alias, mod_iqm} modtype_t;
|
|||
#define EF_GLOWTRAIL 4096 // glowcolor particle trail
|
||||
|
||||
typedef struct model_s {
|
||||
//FIXME use pointers. needs care in bsp submodel loading
|
||||
char path[MAX_QPATH];
|
||||
char name[MAX_QPATH];
|
||||
const struct vpath_s *vpath;// virtual path where this model was found
|
||||
qboolean needload; // bmodels and sprites don't cache normally
|
||||
|
@ -431,40 +433,20 @@ typedef struct model_s {
|
|||
|
||||
// ============================================================================
|
||||
|
||||
extern float RadiusFromBounds (const vec3_t mins, const vec3_t maxs) __attribute__((pure));
|
||||
void Mod_Init (void);
|
||||
void Mod_Init_Cvars (void);
|
||||
void Mod_ClearAll (void);
|
||||
model_t *Mod_ForName (const char *name, qboolean crash);
|
||||
void *Mod_Extradata (model_t *mod); // handles caching
|
||||
void Mod_TouchModel (const char *name);
|
||||
|
||||
// brush specific
|
||||
mleaf_t *Mod_PointInLeaf (const vec3_t p, model_t *model) __attribute__((pure));
|
||||
byte *Mod_LeafPVS (mleaf_t *leaf, model_t *model);
|
||||
model_t *Mod_FindName (const char *name);
|
||||
int Mod_CalcFullbright (const byte *in, byte *out, int pixels);
|
||||
void Mod_ClearFullbright (const byte *in, byte *out, int pixels);
|
||||
int Mod_Fullbright (byte * skin, int width, int height, const char *name);
|
||||
|
||||
void *Mod_LoadAliasFrame (void *pin, int *posenum, maliasframedesc_t *frame,
|
||||
int extra);
|
||||
void *Mod_LoadAliasGroup (void *pin, int *posenum, maliasframedesc_t *frame,
|
||||
int extra);
|
||||
|
||||
void Mod_FindClipDepth (hull_t *hull);
|
||||
void Mod_LoadBrushModel (model_t *mod, void *buffer);
|
||||
void Mod_FloodFillSkin (byte *skin, int skinwidth, int skinheight);
|
||||
|
||||
void Mod_Print (void);
|
||||
|
||||
extern struct cvar_s *gl_mesh_cache;
|
||||
extern struct cvar_s *gl_subdivide_size;
|
||||
extern struct cvar_s *gl_alias_render_tri;
|
||||
extern struct cvar_s *gl_textures_external;
|
||||
extern model_t *loadmodel;
|
||||
extern char *loadname;
|
||||
extern byte *mod_base;
|
||||
extern byte mod_novis[MAX_MAP_LEAFS / 8];
|
||||
extern int mod_lightmap_bytes;
|
||||
|
||||
#endif//__QF_model_h
|
||||
|
|
|
@ -81,22 +81,24 @@ typedef struct vid_particle_funcs_s {
|
|||
|
||||
typedef struct vid_model_funcs_s {
|
||||
size_t texture_render_size;// size of renderer specific texture data
|
||||
void (*Mod_LoadLighting) (bsp_t *bsp);
|
||||
void (*Mod_SubdivideSurface) (msurface_t *fa);
|
||||
void (*Mod_ProcessTexture) (texture_t *tx);
|
||||
void (*Mod_LoadLighting) (model_t *mod, bsp_t *bsp);
|
||||
void (*Mod_SubdivideSurface) (model_t *mod, msurface_t *fa);
|
||||
void (*Mod_ProcessTexture) (model_t *mod, texture_t *tx);
|
||||
void (*Mod_LoadIQM) (model_t *mod, void *buffer);
|
||||
void (*Mod_LoadAliasModel) (model_t *mod, void *buffer,
|
||||
cache_allocator_t allocator);
|
||||
void (*Mod_LoadSpriteModel) (model_t *mod, void *buffer);
|
||||
void (*Mod_MakeAliasModelDisplayLists) (model_t *m, aliashdr_t *hdr,
|
||||
void *_m, int _s, int extra);
|
||||
void *(*Mod_LoadSkin) (byte *skin, int skinsize, int snum, int gnum,
|
||||
void *(*Mod_LoadSkin) (model_t *mod, byte *skin, int skinsize, int snum,
|
||||
int gnum,
|
||||
qboolean group, maliasskindesc_t *skindesc);
|
||||
void (*Mod_FinalizeAliasModel) (model_t *m, aliashdr_t *hdr);
|
||||
void (*Mod_LoadExternalSkins) (model_t *mod);
|
||||
void (*Mod_IQMFinish) (model_t *mod);
|
||||
int alias_cache;
|
||||
void (*Mod_SpriteLoadTexture) (mspriteframe_t *pspriteframe, int framenum);
|
||||
void (*Mod_SpriteLoadTexture) (model_t *mod, mspriteframe_t *pspriteframe,
|
||||
int framenum);
|
||||
|
||||
struct skin_s *(*Skin_SetColormap) (struct skin_s *skin, int cmap);
|
||||
struct skin_s *(*Skin_SetSkin) (struct skin_s *skin, int cmap,
|
||||
|
|
|
@ -6,50 +6,68 @@
|
|||
#include "QF/skin.h"
|
||||
#include "QF/plugin/vid_render.h"
|
||||
|
||||
int Mod_CalcFullbright (const byte *in, byte *out, int pixels);
|
||||
void Mod_ClearFullbright (const byte *in, byte *out, int pixels);
|
||||
void Mod_FloodFillSkin (byte *skin, int skinwidth, int skinheight);
|
||||
//FIXME gl specific. rewrite to use above
|
||||
int Mod_Fullbright (byte * skin, int width, int height, const char *name);
|
||||
|
||||
void Mod_LoadBrushModel (model_t *mod, void *buffer);
|
||||
void Mod_FindClipDepth (hull_t *hull);
|
||||
|
||||
model_t *Mod_FindName (const char *name);
|
||||
float RadiusFromBounds (const vec3_t mins, const vec3_t maxs) __attribute__((pure));
|
||||
|
||||
struct vulkan_ctx_s;
|
||||
|
||||
extern vid_model_funcs_t *m_funcs;
|
||||
|
||||
void gl_Mod_MakeAliasModelDisplayLists (model_t *m, aliashdr_t *hdr, void *_m,
|
||||
int _s, int extra);
|
||||
void *gl_Mod_LoadSkin (byte *skin, int skinsize, int snum, int gnum,
|
||||
qboolean group, maliasskindesc_t *skindesc);
|
||||
void *gl_Mod_LoadSkin (model_t *mod, byte *skin, int skinsize, int snum,
|
||||
int gnum, qboolean group, maliasskindesc_t *skindesc);
|
||||
void gl_Mod_FinalizeAliasModel (model_t *m, aliashdr_t *hdr);
|
||||
void gl_Mod_LoadExternalSkins (model_t *mod);
|
||||
void gl_Mod_IQMFinish (model_t *mod);
|
||||
|
||||
void glsl_Mod_MakeAliasModelDisplayLists (model_t *m, aliashdr_t *hdr,
|
||||
void *_m, int _s, int extra);
|
||||
void *glsl_Mod_LoadSkin (byte *skin, int skinsize, int snum, int gnum,
|
||||
qboolean group, maliasskindesc_t *skindesc);
|
||||
void *glsl_Mod_LoadSkin (model_t *mod, byte *skin, int skinsize, int snum,
|
||||
int gnum, qboolean group, maliasskindesc_t *skindesc);
|
||||
void glsl_Mod_FinalizeAliasModel (model_t *m, aliashdr_t *hdr);
|
||||
void glsl_Mod_LoadExternalSkins (model_t *mod);
|
||||
void glsl_Mod_IQMFinish (model_t *mod);
|
||||
|
||||
void sw_Mod_MakeAliasModelDisplayLists (model_t *m, aliashdr_t *hdr, void *_m,
|
||||
int _s, int extra);
|
||||
void *sw_Mod_LoadSkin (byte *skin, int skinsize, int snum, int gnum,
|
||||
qboolean group, maliasskindesc_t *skindesc);
|
||||
void *sw_Mod_LoadSkin (model_t *mod, byte *skin, int skinsize, int snum,
|
||||
int gnum, qboolean group, maliasskindesc_t *skindesc);
|
||||
void sw_Mod_FinalizeAliasModel (model_t *m, aliashdr_t *hdr);
|
||||
void sw_Mod_LoadExternalSkins (model_t *mod);
|
||||
void sw_Mod_IQMFinish (model_t *mod);
|
||||
|
||||
void gl_Mod_LoadLighting (bsp_t *bsp);
|
||||
void gl_Mod_SubdivideSurface (msurface_t *fa);
|
||||
void gl_Mod_ProcessTexture(texture_t *tx);
|
||||
void gl_Mod_LoadLighting (model_t *mod, bsp_t *bsp);
|
||||
void gl_Mod_SubdivideSurface (model_t *mod, msurface_t *fa);
|
||||
void gl_Mod_ProcessTexture (model_t *mod, texture_t *tx);
|
||||
|
||||
void glsl_Mod_LoadLighting (bsp_t *bsp);
|
||||
void glsl_Mod_ProcessTexture(texture_t *tx);
|
||||
void glsl_Mod_LoadLighting (model_t *mod, bsp_t *bsp);
|
||||
void glsl_Mod_ProcessTexture (model_t *mod, texture_t *tx);
|
||||
|
||||
void sw_Mod_LoadLighting (bsp_t *bsp);
|
||||
void sw_Mod_LoadLighting (model_t *mod, bsp_t *bsp);
|
||||
|
||||
void Vulkan_Mod_LoadLighting (bsp_t *bsp, struct vulkan_ctx_s *ctx);
|
||||
void Vulkan_Mod_SubdivideSurface (msurface_t *fa, struct vulkan_ctx_s *ctx);
|
||||
void Vulkan_Mod_ProcessTexture(texture_t *tx, struct vulkan_ctx_s *ctx);
|
||||
void Vulkan_Mod_LoadLighting (model_t *mod, bsp_t *bsp,
|
||||
struct vulkan_ctx_s *ctx);
|
||||
void Vulkan_Mod_SubdivideSurface (model_t *mod, msurface_t *fa,
|
||||
struct vulkan_ctx_s *ctx);
|
||||
void Vulkan_Mod_ProcessTexture (model_t *mod, texture_t *tx,
|
||||
struct vulkan_ctx_s *ctx);
|
||||
|
||||
void gl_Mod_SpriteLoadTexture (mspriteframe_t *pspriteframe, int framenum);
|
||||
void glsl_Mod_SpriteLoadTexture (mspriteframe_t *pspriteframe, int framenum);
|
||||
void sw_Mod_SpriteLoadTexture (mspriteframe_t *pspriteframe, int framenum);
|
||||
void gl_Mod_SpriteLoadTexture (model_t *mod, mspriteframe_t *pspriteframe,
|
||||
int framenum);
|
||||
void glsl_Mod_SpriteLoadTexture (model_t *mod, mspriteframe_t *pspriteframe,
|
||||
int framenum);
|
||||
void sw_Mod_SpriteLoadTexture (model_t *mod, mspriteframe_t *pspriteframe,
|
||||
int framenum);
|
||||
|
||||
void Mod_LoadIQM (model_t *mod, void *buffer);
|
||||
void Mod_FreeIQM (iqm_t *iqm);
|
||||
|
|
|
@ -361,8 +361,8 @@ gl_Mod_MakeAliasModelDisplayLists (model_t *m, aliashdr_t *hdr, void *_m,
|
|||
|
||||
// look for a cached version
|
||||
dstring_copystr (cache, "glquake/");
|
||||
dstring_appendstr (cache, m->name);
|
||||
QFS_StripExtension (m->name + strlen ("progs/"),
|
||||
dstring_appendstr (cache, m->path);
|
||||
QFS_StripExtension (m->path + strlen ("progs/"),
|
||||
cache->str + strlen ("glquake/"));
|
||||
dstring_appendstr (cache, ".qfms");
|
||||
|
||||
|
@ -433,7 +433,7 @@ gl_Mod_MakeAliasModelDisplayLists (model_t *m, aliashdr_t *hdr, void *_m,
|
|||
}
|
||||
if (remesh) {
|
||||
// build it from scratch
|
||||
Sys_MaskPrintf (SYS_DEV, "meshing %s...\n", m->name);
|
||||
Sys_MaskPrintf (SYS_DEV, "meshing %s...\n", m->path);
|
||||
|
||||
BuildTris (); // trifans or lists
|
||||
|
||||
|
|
|
@ -53,15 +53,15 @@
|
|||
#include "compat.h"
|
||||
|
||||
void *
|
||||
gl_Mod_LoadSkin (byte *skin, int skinsize, int snum, int gnum, qboolean group,
|
||||
maliasskindesc_t *skindesc)
|
||||
gl_Mod_LoadSkin (model_t *mod, byte *skin, int skinsize, int snum, int gnum,
|
||||
qboolean group, maliasskindesc_t *skindesc)
|
||||
{
|
||||
byte *pskin;
|
||||
char modname[MAX_QPATH + 4];
|
||||
int fb_texnum = 0, texnum = 0;
|
||||
dstring_t *name = dstring_new ();
|
||||
|
||||
pskin = Hunk_AllocName (skinsize, loadname);
|
||||
pskin = Hunk_AllocName (skinsize, mod->name);
|
||||
skindesc->skin = (byte *) pskin - (byte *) pheader;
|
||||
|
||||
memcpy (pskin, skin, skinsize);
|
||||
|
@ -69,13 +69,13 @@ gl_Mod_LoadSkin (byte *skin, int skinsize, int snum, int gnum, qboolean group,
|
|||
Mod_FloodFillSkin (pskin, pheader->mdl.skinwidth, pheader->mdl.skinheight);
|
||||
// save 8 bit texels for the player model to remap
|
||||
// FIXME remove model restriction
|
||||
if (strequal (loadmodel->name, "progs/player.mdl"))
|
||||
if (strequal (mod->path, "progs/player.mdl"))
|
||||
gl_Skin_SetPlayerSkin (pheader->mdl.skinwidth, pheader->mdl.skinheight,
|
||||
pskin);
|
||||
|
||||
QFS_StripExtension (loadmodel->name, modname);
|
||||
QFS_StripExtension (mod->path, modname);
|
||||
|
||||
if (!loadmodel->fullbright) {
|
||||
if (!mod->fullbright) {
|
||||
if (group) {
|
||||
dsprintf (name, "fb_%s_%i_%i", modname, snum, gnum);
|
||||
} else {
|
||||
|
@ -95,7 +95,7 @@ gl_Mod_LoadSkin (byte *skin, int skinsize, int snum, int gnum, qboolean group,
|
|||
Sys_MaskPrintf (SYS_GLT, "%s %d\n", name->str, texnum);
|
||||
skindesc->texnum = texnum;
|
||||
skindesc->fb_texnum = fb_texnum;
|
||||
loadmodel->hasfullbrights = fb_texnum;
|
||||
mod->hasfullbrights = fb_texnum;
|
||||
dstring_delete (name);
|
||||
// alpha param was true for non group skins
|
||||
return skin + skinsize;
|
||||
|
@ -104,7 +104,7 @@ gl_Mod_LoadSkin (byte *skin, int skinsize, int snum, int gnum, qboolean group,
|
|||
void
|
||||
gl_Mod_FinalizeAliasModel (model_t *m, aliashdr_t *hdr)
|
||||
{
|
||||
if (strequal (m->name, "progs/eyes.mdl")) {
|
||||
if (strequal (m->path, "progs/eyes.mdl")) {
|
||||
hdr->mdl.scale_origin[2] -= (22 + 8);
|
||||
VectorScale (hdr->mdl.scale, 2, hdr->mdl.scale);
|
||||
}
|
||||
|
@ -158,7 +158,7 @@ gl_Mod_LoadExternalSkins (model_t *mod)
|
|||
maliasskingroup_t *pskingroup;
|
||||
dstring_t *filename = dstring_new ();
|
||||
|
||||
QFS_StripExtension (mod->name, modname);
|
||||
QFS_StripExtension (mod->path, modname);
|
||||
|
||||
for (i = 0; i < pheader->mdl.numskins; i++) {
|
||||
pskindesc = ((maliasskindesc_t *)
|
||||
|
|
|
@ -91,7 +91,7 @@ glsl_alias_clear (model_t *m, void *data)
|
|||
}
|
||||
|
||||
void *
|
||||
glsl_Mod_LoadSkin (byte *skin, int skinsize, int snum, int gnum,
|
||||
glsl_Mod_LoadSkin (model_t *mod, byte *skin, int skinsize, int snum, int gnum,
|
||||
qboolean group, maliasskindesc_t *skindesc)
|
||||
{
|
||||
byte *tskin;
|
||||
|
@ -104,9 +104,9 @@ glsl_Mod_LoadSkin (byte *skin, int skinsize, int snum, int gnum,
|
|||
memcpy (tskin, skin, skinsize);
|
||||
Mod_FloodFillSkin (tskin, w, h);
|
||||
if (group)
|
||||
name = va (0, "%s_%i_%i", loadmodel->name, snum, gnum);
|
||||
name = va (0, "%s_%i_%i", mod->path, snum, gnum);
|
||||
else
|
||||
name = va (0, "%s_%i", loadmodel->name, snum);
|
||||
name = va (0, "%s_%i", mod->path, snum);
|
||||
skindesc->texnum = GLSL_LoadQuakeTexture (name, w, h, tskin);
|
||||
free (tskin);
|
||||
return skin + skinsize;
|
||||
|
|
|
@ -62,7 +62,8 @@ int aliasbboxmins[3], aliasbboxmaxs[3];
|
|||
|
||||
|
||||
static void *
|
||||
Mod_LoadAllSkins (int numskins, daliasskintype_t *pskintype, int *pskinindex)
|
||||
Mod_LoadAllSkins (model_t *mod, int numskins, daliasskintype_t *pskintype,
|
||||
int *pskinindex)
|
||||
{
|
||||
byte *skin;
|
||||
float *poutskinintervals;
|
||||
|
@ -77,7 +78,7 @@ Mod_LoadAllSkins (int numskins, daliasskintype_t *pskintype, int *pskinindex)
|
|||
|
||||
skinsize = pheader->mdl.skinwidth * pheader->mdl.skinheight;
|
||||
pskindesc = Hunk_AllocName (numskins * sizeof (maliasskindesc_t),
|
||||
loadname);
|
||||
mod->name);
|
||||
|
||||
*pskinindex = (byte *) pskindesc - (byte *) pheader;
|
||||
|
||||
|
@ -85,7 +86,7 @@ Mod_LoadAllSkins (int numskins, daliasskintype_t *pskintype, int *pskinindex)
|
|||
pskindesc[snum].type = pskintype->type;
|
||||
if (pskintype->type == ALIAS_SKIN_SINGLE) {
|
||||
skin = (byte *) (pskintype + 1);
|
||||
skin = m_funcs->Mod_LoadSkin (skin, skinsize, snum, 0, false,
|
||||
skin = m_funcs->Mod_LoadSkin (mod, skin, skinsize, snum, 0, false,
|
||||
&pskindesc[snum]);
|
||||
} else {
|
||||
pskintype++;
|
||||
|
@ -93,14 +94,14 @@ Mod_LoadAllSkins (int numskins, daliasskintype_t *pskintype, int *pskinindex)
|
|||
groupskins = LittleLong (pinskingroup->numskins);
|
||||
|
||||
t = field_offset (maliasskingroup_t, skindescs[groupskins]);
|
||||
paliasskingroup = Hunk_AllocName (t, loadname);
|
||||
paliasskingroup = Hunk_AllocName (t, mod->name);
|
||||
paliasskingroup->numskins = groupskins;
|
||||
|
||||
pskindesc[snum].skin = (byte *) paliasskingroup - (byte *) pheader;
|
||||
|
||||
pinskinintervals = (daliasskininterval_t *) (pinskingroup + 1);
|
||||
poutskinintervals = Hunk_AllocName (groupskins * sizeof (float),
|
||||
loadname);
|
||||
mod->name);
|
||||
paliasskingroup->intervals =
|
||||
(byte *) poutskinintervals - (byte *) pheader;
|
||||
for (gnum = 0; gnum < groupskins; gnum++) {
|
||||
|
@ -117,8 +118,9 @@ Mod_LoadAllSkins (int numskins, daliasskintype_t *pskintype, int *pskinindex)
|
|||
|
||||
for (gnum = 0; gnum < groupskins; gnum++) {
|
||||
paliasskingroup->skindescs[gnum].type = ALIAS_SKIN_SINGLE;
|
||||
skin = mod_funcs->Mod_LoadSkin (skin, skinsize, snum, gnum,
|
||||
true, &paliasskingroup->skindescs[gnum]);
|
||||
skin = mod_funcs->Mod_LoadSkin (mod, skin, skinsize, snum,
|
||||
gnum, true,
|
||||
&paliasskingroup->skindescs[gnum]);
|
||||
}
|
||||
}
|
||||
pskintype = (daliasskintype_t *) skin;
|
||||
|
@ -127,9 +129,9 @@ Mod_LoadAllSkins (int numskins, daliasskintype_t *pskintype, int *pskinindex)
|
|||
return pskintype;
|
||||
}
|
||||
|
||||
void *
|
||||
Mod_LoadAliasFrame (void *pin, int *posenum, maliasframedesc_t *frame,
|
||||
int extra)
|
||||
static void *
|
||||
Mod_LoadAliasFrame (model_t *mod, void *pin, int *posenum,
|
||||
maliasframedesc_t *frame, int extra)
|
||||
{
|
||||
daliasframe_t *pdaliasframe;
|
||||
trivertx_t *pinframe;
|
||||
|
@ -159,9 +161,9 @@ Mod_LoadAliasFrame (void *pin, int *posenum, maliasframedesc_t *frame,
|
|||
return pinframe;
|
||||
}
|
||||
|
||||
void *
|
||||
Mod_LoadAliasGroup (void *pin, int *posenum, maliasframedesc_t *frame,
|
||||
int extra)
|
||||
static void *
|
||||
Mod_LoadAliasGroup (model_t *mod, void *pin, int *posenum,
|
||||
maliasframedesc_t *frame, int extra)
|
||||
{
|
||||
daliasgroup_t *pingroup;
|
||||
daliasinterval_t *pin_intervals;
|
||||
|
@ -178,7 +180,7 @@ Mod_LoadAliasGroup (void *pin, int *posenum, maliasframedesc_t *frame,
|
|||
frame->numposes = numframes;
|
||||
|
||||
paliasgroup = Hunk_AllocName (field_offset (maliasgroup_t,
|
||||
frames[numframes]), loadname);
|
||||
frames[numframes]), mod->name);
|
||||
paliasgroup->numframes = numframes;
|
||||
frame->frame = (byte *) paliasgroup - (byte *) pheader;
|
||||
|
||||
|
@ -189,7 +191,7 @@ Mod_LoadAliasGroup (void *pin, int *posenum, maliasframedesc_t *frame,
|
|||
VectorCompMax (frame->bboxmax.v, aliasbboxmaxs, aliasbboxmaxs);
|
||||
|
||||
pin_intervals = (daliasinterval_t *) (pingroup + 1);
|
||||
poutintervals = Hunk_AllocName (numframes * sizeof (float), loadname);
|
||||
poutintervals = Hunk_AllocName (numframes * sizeof (float), mod->name);
|
||||
paliasgroup->intervals = (byte *) poutintervals - (byte *) pheader;
|
||||
frame->interval = LittleFloat (pin_intervals->interval);
|
||||
for (i = 0; i < numframes; i++) {
|
||||
|
@ -203,7 +205,7 @@ Mod_LoadAliasGroup (void *pin, int *posenum, maliasframedesc_t *frame,
|
|||
ptemp = (void *) pin_intervals;
|
||||
for (i = 0; i < numframes; i++) {
|
||||
maliasframedesc_t temp_frame;
|
||||
ptemp = Mod_LoadAliasFrame (ptemp, posenum, &temp_frame, extra);
|
||||
ptemp = Mod_LoadAliasFrame (mod, ptemp, posenum, &temp_frame, extra);
|
||||
memcpy (&paliasgroup->frames[i], &temp_frame,
|
||||
sizeof (paliasgroup->frames[i]));
|
||||
}
|
||||
|
@ -242,7 +244,7 @@ Mod_LoadAliasModel (model_t *mod, void *buffer, cache_allocator_t allocator)
|
|||
// allocate space for a working header, plus all the data except the
|
||||
// frames, skin and group info
|
||||
size = field_offset (aliashdr_t, frames[LittleLong (pinmodel->numframes)]);
|
||||
pheader = Hunk_AllocName (size, loadname);
|
||||
pheader = Hunk_AllocName (size, mod->name);
|
||||
memset (pheader, 0, size);
|
||||
pmodel = &pheader->mdl;
|
||||
pheader->model = (byte *) pmodel - (byte *) pheader;
|
||||
|
@ -294,7 +296,7 @@ Mod_LoadAliasModel (model_t *mod, void *buffer, cache_allocator_t allocator)
|
|||
|
||||
// load the skins
|
||||
pskintype = (daliasskintype_t *) &pinmodel[1];
|
||||
pskintype = Mod_LoadAllSkins (pheader->mdl.numskins, pskintype,
|
||||
pskintype = Mod_LoadAllSkins (mod, pheader->mdl.numskins, pskintype,
|
||||
&pheader->skindesc);
|
||||
|
||||
// load base s and t vertices
|
||||
|
@ -332,11 +334,11 @@ Mod_LoadAliasModel (model_t *mod, void *buffer, cache_allocator_t allocator)
|
|||
|
||||
if (frametype == ALIAS_SINGLE) {
|
||||
pframetype = (daliasframetype_t *)
|
||||
Mod_LoadAliasFrame (pframetype + 1, &posenum,
|
||||
Mod_LoadAliasFrame (mod, pframetype + 1, &posenum,
|
||||
&pheader->frames[i], extra);
|
||||
} else {
|
||||
pframetype = (daliasframetype_t *)
|
||||
Mod_LoadAliasGroup (pframetype + 1, &posenum,
|
||||
Mod_LoadAliasGroup (mod, pframetype + 1, &posenum,
|
||||
&pheader->frames[i], extra);
|
||||
}
|
||||
}
|
||||
|
@ -367,7 +369,7 @@ Mod_LoadAliasModel (model_t *mod, void *buffer, cache_allocator_t allocator)
|
|||
end = Hunk_LowMark ();
|
||||
total = end - start;
|
||||
|
||||
mem = allocator (&mod->cache, total, loadname);
|
||||
mem = allocator (&mod->cache, total, mod->name);
|
||||
if (mem)
|
||||
memcpy (mem, pheader, total);
|
||||
|
||||
|
|
|
@ -50,12 +50,12 @@
|
|||
|
||||
|
||||
void *
|
||||
sw_Mod_LoadSkin (byte *skin, int skinsize, int snum, int gnum,
|
||||
sw_Mod_LoadSkin (model_t *mod, byte *skin, int skinsize, int snum, int gnum,
|
||||
qboolean group, maliasskindesc_t *skindesc)
|
||||
{
|
||||
byte *pskin;
|
||||
|
||||
pskin = Hunk_AllocName (skinsize, loadname);
|
||||
pskin = Hunk_AllocName (skinsize, mod->name);
|
||||
skindesc->skin = (byte *) pskin - (byte *) pheader;
|
||||
|
||||
memcpy (pskin, skin, skinsize);
|
||||
|
@ -64,7 +64,7 @@ sw_Mod_LoadSkin (byte *skin, int skinsize, int snum, int gnum,
|
|||
}
|
||||
|
||||
static void
|
||||
process_frame (maliasframedesc_t *frame, int posenum, int extra)
|
||||
process_frame (model_t *mod, maliasframedesc_t *frame, int posenum, int extra)
|
||||
{
|
||||
int size = pheader->mdl.numverts * sizeof (trivertx_t);
|
||||
trivertx_t *frame_verts;
|
||||
|
@ -72,7 +72,7 @@ process_frame (maliasframedesc_t *frame, int posenum, int extra)
|
|||
if (extra)
|
||||
size *= 2;
|
||||
|
||||
frame_verts = Hunk_AllocName (size, loadname);
|
||||
frame_verts = Hunk_AllocName (size, mod->name);
|
||||
frame->frame = (byte *) frame_verts - (byte *) pheader;
|
||||
|
||||
// The low-order 8 bits (actually, fractional) are completely separate
|
||||
|
@ -83,7 +83,7 @@ process_frame (maliasframedesc_t *frame, int posenum, int extra)
|
|||
}
|
||||
|
||||
void
|
||||
sw_Mod_MakeAliasModelDisplayLists (model_t *m, aliashdr_t *hdr, void *_m,
|
||||
sw_Mod_MakeAliasModelDisplayLists (model_t *mod, aliashdr_t *hdr, void *_m,
|
||||
int _s, int extra)
|
||||
{
|
||||
int i, j;
|
||||
|
@ -93,9 +93,9 @@ sw_Mod_MakeAliasModelDisplayLists (model_t *m, aliashdr_t *hdr, void *_m,
|
|||
mtriangle_t *ptri;
|
||||
|
||||
pstverts = (stvert_t *) Hunk_AllocName (numv * sizeof (stvert_t),
|
||||
loadname);
|
||||
mod->name);
|
||||
ptri = (mtriangle_t *) Hunk_AllocName (numt * sizeof (mtriangle_t),
|
||||
loadname);
|
||||
mod->name);
|
||||
|
||||
hdr->stverts = (byte *) pstverts - (byte *) hdr;
|
||||
hdr->triangles = (byte *) ptri - (byte *) hdr;
|
||||
|
@ -117,16 +117,16 @@ sw_Mod_MakeAliasModelDisplayLists (model_t *m, aliashdr_t *hdr, void *_m,
|
|||
maliasgroup_t *group;
|
||||
group = (maliasgroup_t *) ((byte *) pheader + frame->frame);
|
||||
for (j = 0; j < group->numframes; j++)
|
||||
process_frame ((maliasframedesc_t *) &group->frames[j],
|
||||
process_frame (mod, (maliasframedesc_t *) &group->frames[j],
|
||||
posenum++, extra);
|
||||
} else {
|
||||
process_frame (frame, posenum++, extra);
|
||||
process_frame (mod, frame, posenum++, extra);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
sw_Mod_FinalizeAliasModel (model_t *m, aliashdr_t *hdr)
|
||||
sw_Mod_FinalizeAliasModel (model_t *mod, aliashdr_t *hdr)
|
||||
{
|
||||
}
|
||||
|
||||
|
|
|
@ -110,8 +110,8 @@ vulkan_alias_clear (model_t *m, void *data)
|
|||
}
|
||||
|
||||
void *
|
||||
Vulkan_Mod_LoadSkin (byte *skinpix, int skinsize, int snum, int gnum,
|
||||
qboolean group, maliasskindesc_t *skindesc,
|
||||
Vulkan_Mod_LoadSkin (model_t *mod, byte *skinpix, int skinsize, int snum,
|
||||
int gnum, qboolean group, maliasskindesc_t *skindesc,
|
||||
vulkan_ctx_t *ctx)
|
||||
{
|
||||
aliasskin_t *skin;
|
||||
|
@ -131,25 +131,25 @@ Vulkan_Mod_LoadSkin (byte *skinpix, int skinsize, int snum, int gnum,
|
|||
if (Mod_CalcFullbright (tskin, tskin + skinsize, skinsize)) {
|
||||
skin->glow = Vulkan_LoadTex (ctx, &skin_tex, 1,
|
||||
va (ctx->va_ctx, "%s:%d:%d:glow",
|
||||
loadmodel->name, snum, gnum));
|
||||
mod->name, snum, gnum));
|
||||
Mod_ClearFullbright (tskin, tskin, skinsize);
|
||||
}
|
||||
if (Skin_CalcTopColors (tskin, tskin + skinsize, skinsize)) {
|
||||
skin->colora = Vulkan_LoadTex (ctx, &skin_tex, 1,
|
||||
va (ctx->va_ctx, "%s:%d:%d:colora",
|
||||
loadmodel->name, snum, gnum));
|
||||
mod->name, snum, gnum));
|
||||
Skin_ClearTopColors (tskin, tskin, skinsize);
|
||||
}
|
||||
if (Skin_CalcBottomColors (tskin, tskin + skinsize, skinsize)) {
|
||||
skin->colorb = Vulkan_LoadTex (ctx, &skin_tex, 1,
|
||||
va (ctx->va_ctx, "%s:%d:%d:colorb",
|
||||
loadmodel->name, snum, gnum));
|
||||
mod->name, snum, gnum));
|
||||
Skin_ClearBottomColors (tskin, tskin, skinsize);
|
||||
}
|
||||
skin_tex.data = tskin;
|
||||
skin->tex = Vulkan_LoadTex (ctx, &skin_tex, 1,
|
||||
va (ctx->va_ctx, "%s:%d:%d:tex",
|
||||
loadmodel->name,
|
||||
mod->name,
|
||||
snum, gnum));
|
||||
|
||||
free (tskin);
|
||||
|
@ -185,7 +185,7 @@ get_buffer_size (qfv_device_t *device, VkBuffer buffer)
|
|||
}
|
||||
|
||||
void
|
||||
Vulkan_Mod_MakeAliasModelDisplayLists (model_t *m, aliashdr_t *hdr, void *_m,
|
||||
Vulkan_Mod_MakeAliasModelDisplayLists (model_t *mod, aliashdr_t *hdr, void *_m,
|
||||
int _s, int extra, vulkan_ctx_t *ctx)
|
||||
{
|
||||
qfv_device_t *device = ctx->device;
|
||||
|
@ -255,13 +255,13 @@ Vulkan_Mod_MakeAliasModelDisplayLists (model_t *m, aliashdr_t *hdr, void *_m,
|
|||
| VK_BUFFER_USAGE_INDEX_BUFFER_BIT);
|
||||
QFV_duSetObjectName (device, VK_OBJECT_TYPE_BUFFER, vbuff,
|
||||
va (ctx->va_ctx, "buffer:alias:vertex:%s",
|
||||
loadmodel->name));
|
||||
mod->name));
|
||||
QFV_duSetObjectName (device, VK_OBJECT_TYPE_BUFFER, uvbuff,
|
||||
va (ctx->va_ctx, "buffer:alias:uv:%s",
|
||||
loadmodel->name));
|
||||
mod->name));
|
||||
QFV_duSetObjectName (device, VK_OBJECT_TYPE_BUFFER, ibuff,
|
||||
va (ctx->va_ctx, "buffer:alias:index:%s",
|
||||
loadmodel->name));
|
||||
mod->name));
|
||||
size_t voffs = 0;
|
||||
size_t uvoffs = voffs + get_buffer_size (device, vbuff);
|
||||
size_t ioffs = uvoffs + get_buffer_size (device, uvbuff);
|
||||
|
@ -272,7 +272,7 @@ Vulkan_Mod_MakeAliasModelDisplayLists (model_t *m, aliashdr_t *hdr, void *_m,
|
|||
buff_size, 0);
|
||||
QFV_duSetObjectName (device, VK_OBJECT_TYPE_DEVICE_MEMORY, mem,
|
||||
va (ctx->va_ctx, "memory:alias:vuvi:%s",
|
||||
loadmodel->name));
|
||||
mod->name));
|
||||
QFV_BindBufferMemory (device, vbuff, mem, voffs);
|
||||
QFV_BindBufferMemory (device, uvbuff, mem, uvoffs);
|
||||
QFV_BindBufferMemory (device, ibuff, mem, ioffs);
|
||||
|
@ -280,7 +280,7 @@ Vulkan_Mod_MakeAliasModelDisplayLists (model_t *m, aliashdr_t *hdr, void *_m,
|
|||
qfv_stagebuf_t *stage = QFV_CreateStagingBuffer (device,
|
||||
va (ctx->va_ctx,
|
||||
"alias:%s",
|
||||
loadmodel->name),
|
||||
mod->name),
|
||||
buff_size, ctx->cmdpool);
|
||||
qfv_packet_t *packet = QFV_PacketAcquire (stage);
|
||||
verts = QFV_PacketExtend (packet, vert_size);
|
||||
|
|
|
@ -86,7 +86,7 @@ Mod_LoadExternalTextures (model_t *mod, texture_t *tx)
|
|||
int external = 0;
|
||||
|
||||
gltx = tx->render;
|
||||
if ((base = Mod_LoadAnExternalTexture (tx->name, mod->name))) {
|
||||
if ((base = Mod_LoadAnExternalTexture (tx->name, mod->path))) {
|
||||
external = 1;
|
||||
gltx->gl_texturenum =
|
||||
GL_LoadTexture (tx->name, base->width, base->height,
|
||||
|
@ -94,10 +94,10 @@ Mod_LoadExternalTextures (model_t *mod, texture_t *tx)
|
|||
base->format > 2 ? base->format : 1);
|
||||
|
||||
luma = Mod_LoadAnExternalTexture (va (0, "%s_luma", tx->name),
|
||||
mod->name);
|
||||
mod->path);
|
||||
if (!luma)
|
||||
luma = Mod_LoadAnExternalTexture (va (0, "%s_glow", tx->name),
|
||||
mod->name);
|
||||
mod->path);
|
||||
|
||||
gltx->gl_fb_texturenum = 0;
|
||||
|
||||
|
@ -116,7 +116,7 @@ Mod_LoadExternalTextures (model_t *mod, texture_t *tx)
|
|||
}
|
||||
|
||||
void
|
||||
gl_Mod_ProcessTexture (texture_t *tx)
|
||||
gl_Mod_ProcessTexture (model_t *mod, texture_t *tx)
|
||||
{
|
||||
const char *name;
|
||||
|
||||
|
@ -125,7 +125,7 @@ gl_Mod_ProcessTexture (texture_t *tx)
|
|||
return;
|
||||
}
|
||||
if (gl_textures_external && gl_textures_external->int_val) {
|
||||
if (Mod_LoadExternalTextures (loadmodel, tx)) {
|
||||
if (Mod_LoadExternalTextures (mod, tx)) {
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
@ -142,7 +142,7 @@ gl_Mod_ProcessTexture (texture_t *tx)
|
|||
}
|
||||
|
||||
void
|
||||
gl_Mod_LoadLighting (bsp_t *bsp)
|
||||
gl_Mod_LoadLighting (model_t *mod, bsp_t *bsp)
|
||||
{
|
||||
byte d;
|
||||
byte *in, *out, *data;
|
||||
|
@ -151,13 +151,13 @@ gl_Mod_LoadLighting (bsp_t *bsp)
|
|||
int ver;
|
||||
QFile *lit_file;
|
||||
|
||||
dstring_copystr (litfilename, loadmodel->name);
|
||||
loadmodel->lightdata = NULL;
|
||||
dstring_copystr (litfilename, mod->path);
|
||||
mod->lightdata = NULL;
|
||||
if (mod_lightmap_bytes > 1) {
|
||||
// LordHavoc: check for a .lit file to load
|
||||
QFS_StripExtension (litfilename->str, litfilename->str);
|
||||
dstring_appendstr (litfilename, ".lit");
|
||||
lit_file = QFS_VOpenFile (litfilename->str, 0, loadmodel->vpath);
|
||||
lit_file = QFS_VOpenFile (litfilename->str, 0, mod->vpath);
|
||||
data = (byte *) QFS_LoadHunkFile (lit_file);
|
||||
if (data) {
|
||||
if (data[0] == 'Q' && data[1] == 'L' && data[2] == 'I'
|
||||
|
@ -165,7 +165,7 @@ gl_Mod_LoadLighting (bsp_t *bsp)
|
|||
ver = LittleLong (((int32_t *) data)[1]);
|
||||
if (ver == 1) {
|
||||
Sys_MaskPrintf (SYS_DEV, "%s loaded", litfilename->str);
|
||||
loadmodel->lightdata = data + 8;
|
||||
mod->lightdata = data + 8;
|
||||
return;
|
||||
} else
|
||||
Sys_MaskPrintf (SYS_DEV,
|
||||
|
@ -179,11 +179,10 @@ gl_Mod_LoadLighting (bsp_t *bsp)
|
|||
dstring_delete (litfilename);
|
||||
return;
|
||||
}
|
||||
loadmodel->lightdata = Hunk_AllocName (bsp->lightdatasize
|
||||
* mod_lightmap_bytes,
|
||||
mod->lightdata = Hunk_AllocName (bsp->lightdatasize * mod_lightmap_bytes,
|
||||
litfilename->str);
|
||||
in = bsp->lightdata;
|
||||
out = loadmodel->lightdata;
|
||||
out = mod->lightdata;
|
||||
|
||||
if (mod_lightmap_bytes > 1)
|
||||
for (i = 0; i < bsp->lightdatasize ; i++) {
|
||||
|
@ -304,7 +303,7 @@ SubdividePolygon (int numverts, float *verts)
|
|||
can be done reasonably.
|
||||
*/
|
||||
void
|
||||
gl_Mod_SubdivideSurface (msurface_t *fa)
|
||||
gl_Mod_SubdivideSurface (model_t *mod, msurface_t *fa)
|
||||
{
|
||||
float *vec;
|
||||
int lindex, numverts, i;
|
||||
|
@ -315,12 +314,12 @@ gl_Mod_SubdivideSurface (msurface_t *fa)
|
|||
// convert edges back to a normal polygon
|
||||
numverts = 0;
|
||||
for (i = 0; i < fa->numedges; i++) {
|
||||
lindex = loadmodel->surfedges[fa->firstedge + i];
|
||||
lindex = mod->surfedges[fa->firstedge + i];
|
||||
|
||||
if (lindex > 0)
|
||||
vec = loadmodel->vertexes[loadmodel->edges[lindex].v[0]].position;
|
||||
vec = mod->vertexes[mod->edges[lindex].v[0]].position;
|
||||
else
|
||||
vec = loadmodel->vertexes[loadmodel->edges[-lindex].v[1]].position;
|
||||
vec = mod->vertexes[mod->edges[-lindex].v[1]].position;
|
||||
VectorCopy (vec, verts[numverts]);
|
||||
numverts++;
|
||||
}
|
||||
|
|
|
@ -101,7 +101,7 @@ load_skytex (texture_t *tx, byte *data)
|
|||
}
|
||||
|
||||
void
|
||||
glsl_Mod_ProcessTexture (texture_t *tx)
|
||||
glsl_Mod_ProcessTexture (model_t *mod, texture_t *tx)
|
||||
{
|
||||
if (!tx) {
|
||||
r_notexture_mip->render = &glsl_notexture;
|
||||
|
@ -145,15 +145,15 @@ glsl_Mod_ProcessTexture (texture_t *tx)
|
|||
}
|
||||
|
||||
void
|
||||
glsl_Mod_LoadLighting (bsp_t *bsp)
|
||||
glsl_Mod_LoadLighting (model_t *mod, bsp_t *bsp)
|
||||
{
|
||||
// a bit hacky, but it's as good a place as any
|
||||
loadmodel->clear = glsl_brush_clear;
|
||||
mod->clear = glsl_brush_clear;
|
||||
mod_lightmap_bytes = 1;
|
||||
if (!bsp->lightdatasize) {
|
||||
loadmodel->lightdata = NULL;
|
||||
mod->lightdata = NULL;
|
||||
return;
|
||||
}
|
||||
loadmodel->lightdata = Hunk_AllocName (bsp->lightdatasize, loadname);
|
||||
memcpy (loadmodel->lightdata, bsp->lightdata, bsp->lightdatasize);
|
||||
mod->lightdata = Hunk_AllocName (bsp->lightdatasize, mod->name);
|
||||
memcpy (mod->lightdata, bsp->lightdata, bsp->lightdatasize);
|
||||
}
|
||||
|
|
|
@ -53,8 +53,9 @@
|
|||
#include "QF/plugin/vid_render.h"
|
||||
|
||||
#include "compat.h"
|
||||
#include "mod_internal.h"
|
||||
|
||||
byte mod_novis[MAX_MAP_LEAFS / 8];
|
||||
static byte mod_novis[MAX_MAP_LEAFS / 8];
|
||||
|
||||
VISIBLE cvar_t *gl_sky_divide; //FIXME visibility?
|
||||
VISIBLE int mod_lightmap_bytes = 1; //FIXME should this be visible?
|
||||
|
@ -122,8 +123,12 @@ Mod_DecompressVis (byte * in, model_t *model)
|
|||
VISIBLE byte *
|
||||
Mod_LeafPVS (mleaf_t *leaf, model_t *model)
|
||||
{
|
||||
if (leaf == model->leafs)
|
||||
if (leaf == model->leafs) {
|
||||
if (!mod_novis[0]) {
|
||||
memset (mod_novis, 0xff, sizeof (mod_novis));
|
||||
}
|
||||
return mod_novis;
|
||||
}
|
||||
return Mod_DecompressVis (leaf->compressed_vis, model);
|
||||
}
|
||||
|
||||
|
@ -158,7 +163,7 @@ mod_unique_miptex_name (texture_t **textures, texture_t *tx, int ind)
|
|||
}
|
||||
|
||||
static void
|
||||
Mod_LoadTextures (bsp_t *bsp)
|
||||
Mod_LoadTextures (model_t *mod, bsp_t *bsp)
|
||||
{
|
||||
dmiptexlump_t *m;
|
||||
int i, j, pixels, num, max, altmax;
|
||||
|
@ -167,14 +172,14 @@ Mod_LoadTextures (bsp_t *bsp)
|
|||
texture_t *anims[10], *altanims[10];
|
||||
|
||||
if (!bsp->texdatasize) {
|
||||
loadmodel->textures = NULL;
|
||||
mod->textures = NULL;
|
||||
return;
|
||||
}
|
||||
m = (dmiptexlump_t *) bsp->texdata;
|
||||
|
||||
loadmodel->numtextures = m->nummiptex;
|
||||
loadmodel->textures = Hunk_AllocName (m->nummiptex * sizeof
|
||||
(*loadmodel->textures), loadname);
|
||||
mod->numtextures = m->nummiptex;
|
||||
mod->textures = Hunk_AllocName (m->nummiptex * sizeof (*mod->textures),
|
||||
mod->name);
|
||||
|
||||
for (i = 0; i < m->nummiptex; i++) {
|
||||
if (m->dataofs[i] == -1)
|
||||
|
@ -188,12 +193,12 @@ Mod_LoadTextures (bsp_t *bsp)
|
|||
if ((mt->width & 15) || (mt->height & 15))
|
||||
Sys_Error ("Texture %s is not 16 aligned", mt->name);
|
||||
pixels = mt->width * mt->height / 64 * 85;
|
||||
tx = Hunk_AllocName (sizeof (texture_t) + pixels, loadname);
|
||||
tx = Hunk_AllocName (sizeof (texture_t) + pixels, mod->name);
|
||||
|
||||
loadmodel->textures[i] = tx;
|
||||
mod->textures[i] = tx;
|
||||
|
||||
tx->name = strndup(mt->name, sizeof (mt->name));
|
||||
mod_unique_miptex_name (loadmodel->textures, tx, i);
|
||||
mod_unique_miptex_name (mod->textures, tx, i);
|
||||
tx->width = mt->width;
|
||||
tx->height = mt->height;
|
||||
for (j = 0; j < MIPLEVELS; j++)
|
||||
|
@ -203,28 +208,28 @@ Mod_LoadTextures (bsp_t *bsp)
|
|||
memcpy (tx + 1, mt + 1, pixels);
|
||||
|
||||
if (!strncmp (mt->name, "sky", 3))
|
||||
loadmodel->skytexture = tx;
|
||||
mod->skytexture = tx;
|
||||
}
|
||||
if (mod_funcs && mod_funcs->Mod_ProcessTexture) {
|
||||
size_t render_size = mod_funcs->texture_render_size;
|
||||
byte *render_data = 0;
|
||||
if (render_size) {
|
||||
render_data = Hunk_AllocName (m->nummiptex * render_size,
|
||||
loadname);
|
||||
mod->name);
|
||||
}
|
||||
for (i = 0; i < m->nummiptex; i++) {
|
||||
tx = loadmodel->textures[i];
|
||||
tx = mod->textures[i];
|
||||
tx->render = render_data;
|
||||
render_data += render_size;
|
||||
mod_funcs->Mod_ProcessTexture (tx);
|
||||
mod_funcs->Mod_ProcessTexture (mod, tx);
|
||||
}
|
||||
// signal the end of the textures
|
||||
mod_funcs->Mod_ProcessTexture (0);
|
||||
mod_funcs->Mod_ProcessTexture (mod, 0);
|
||||
}
|
||||
|
||||
// sequence the animations
|
||||
for (i = 0; i < m->nummiptex; i++) {
|
||||
tx = loadmodel->textures[i];
|
||||
tx = mod->textures[i];
|
||||
if (!tx || tx->name[0] != '+')
|
||||
continue;
|
||||
if (tx->anim_next)
|
||||
|
@ -251,7 +256,7 @@ Mod_LoadTextures (bsp_t *bsp)
|
|||
Sys_Error ("Bad animating texture %s", tx->name);
|
||||
|
||||
for (j = i + 1; j < m->nummiptex; j++) {
|
||||
tx2 = loadmodel->textures[j];
|
||||
tx2 = mod->textures[j];
|
||||
if (!tx2 || tx2->name[0] != '+')
|
||||
continue;
|
||||
if (strcmp (tx2->name + 2, tx->name + 2))
|
||||
|
@ -302,29 +307,29 @@ Mod_LoadTextures (bsp_t *bsp)
|
|||
}
|
||||
|
||||
static void
|
||||
Mod_LoadVisibility (bsp_t *bsp)
|
||||
Mod_LoadVisibility (model_t *mod, bsp_t *bsp)
|
||||
{
|
||||
if (!bsp->visdatasize) {
|
||||
loadmodel->visdata = NULL;
|
||||
mod->visdata = NULL;
|
||||
return;
|
||||
}
|
||||
loadmodel->visdata = Hunk_AllocName (bsp->visdatasize, loadname);
|
||||
memcpy (loadmodel->visdata, bsp->visdata, bsp->visdatasize);
|
||||
mod->visdata = Hunk_AllocName (bsp->visdatasize, mod->name);
|
||||
memcpy (mod->visdata, bsp->visdata, bsp->visdatasize);
|
||||
}
|
||||
|
||||
static void
|
||||
Mod_LoadEntities (bsp_t *bsp)
|
||||
Mod_LoadEntities (model_t *mod, bsp_t *bsp)
|
||||
{
|
||||
if (!bsp->entdatasize) {
|
||||
loadmodel->entities = NULL;
|
||||
mod->entities = NULL;
|
||||
return;
|
||||
}
|
||||
loadmodel->entities = Hunk_AllocName (bsp->entdatasize, loadname);
|
||||
memcpy (loadmodel->entities, bsp->entdata, bsp->entdatasize);
|
||||
mod->entities = Hunk_AllocName (bsp->entdatasize, mod->name);
|
||||
memcpy (mod->entities, bsp->entdata, bsp->entdatasize);
|
||||
}
|
||||
|
||||
static void
|
||||
Mod_LoadVertexes (bsp_t *bsp)
|
||||
Mod_LoadVertexes (model_t *mod, bsp_t *bsp)
|
||||
{
|
||||
dvertex_t *in;
|
||||
int count, i;
|
||||
|
@ -332,27 +337,27 @@ Mod_LoadVertexes (bsp_t *bsp)
|
|||
|
||||
in = bsp->vertexes;
|
||||
count = bsp->numvertexes;
|
||||
out = Hunk_AllocName (count * sizeof (*out), loadname);
|
||||
out = Hunk_AllocName (count * sizeof (*out), mod->name);
|
||||
|
||||
loadmodel->vertexes = out;
|
||||
loadmodel->numvertexes = count;
|
||||
mod->vertexes = out;
|
||||
mod->numvertexes = count;
|
||||
|
||||
for (i = 0; i < count; i++, in++, out++)
|
||||
VectorCopy (in->point, out->position);
|
||||
}
|
||||
|
||||
static void
|
||||
Mod_LoadSubmodels (bsp_t *bsp)
|
||||
Mod_LoadSubmodels (model_t *mod, bsp_t *bsp)
|
||||
{
|
||||
dmodel_t *in, *out;
|
||||
int count, i, j;
|
||||
|
||||
in = bsp->models;
|
||||
count = bsp->nummodels;
|
||||
out = Hunk_AllocName (count * sizeof (*out), loadname);
|
||||
out = Hunk_AllocName (count * sizeof (*out), mod->name);
|
||||
|
||||
loadmodel->submodels = out;
|
||||
loadmodel->numsubmodels = count;
|
||||
mod->submodels = out;
|
||||
mod->numsubmodels = count;
|
||||
|
||||
for (i = 0; i < count; i++, in++, out++) {
|
||||
static vec3_t offset = {1, 1, 1};
|
||||
|
@ -367,11 +372,11 @@ Mod_LoadSubmodels (bsp_t *bsp)
|
|||
out->numfaces = in->numfaces;
|
||||
}
|
||||
|
||||
out = loadmodel->submodels;
|
||||
out = mod->submodels;
|
||||
|
||||
if (out->visleafs > MAX_MAP_LEAFS) {
|
||||
Sys_Error ("Mod_LoadSubmodels: too many visleafs (%d, max = %d) in %s",
|
||||
out->visleafs, MAX_MAP_LEAFS, loadmodel->name);
|
||||
out->visleafs, MAX_MAP_LEAFS, mod->path);
|
||||
}
|
||||
|
||||
if (out->visleafs > 8192)
|
||||
|
@ -381,7 +386,7 @@ Mod_LoadSubmodels (bsp_t *bsp)
|
|||
}
|
||||
|
||||
static void
|
||||
Mod_LoadEdges (bsp_t *bsp)
|
||||
Mod_LoadEdges (model_t *mod, bsp_t *bsp)
|
||||
{
|
||||
dedge_t *in;
|
||||
int count, i;
|
||||
|
@ -389,10 +394,10 @@ Mod_LoadEdges (bsp_t *bsp)
|
|||
|
||||
in = bsp->edges;
|
||||
count = bsp->numedges;
|
||||
out = Hunk_AllocName ((count + 1) * sizeof (*out), loadname);
|
||||
out = Hunk_AllocName ((count + 1) * sizeof (*out), mod->name);
|
||||
|
||||
loadmodel->edges = out;
|
||||
loadmodel->numedges = count;
|
||||
mod->edges = out;
|
||||
mod->numedges = count;
|
||||
|
||||
for (i = 0; i < count; i++, in++, out++) {
|
||||
out->v[0] = in->v[0];
|
||||
|
@ -401,7 +406,7 @@ Mod_LoadEdges (bsp_t *bsp)
|
|||
}
|
||||
|
||||
static void
|
||||
Mod_LoadTexinfo (bsp_t *bsp)
|
||||
Mod_LoadTexinfo (model_t *mod, bsp_t *bsp)
|
||||
{
|
||||
float len1, len2;
|
||||
int count, miptex, i, j;
|
||||
|
@ -410,10 +415,10 @@ Mod_LoadTexinfo (bsp_t *bsp)
|
|||
|
||||
in = bsp->texinfo;
|
||||
count = bsp->numtexinfo;
|
||||
out = Hunk_AllocName (count * sizeof (*out), loadname);
|
||||
out = Hunk_AllocName (count * sizeof (*out), mod->name);
|
||||
|
||||
loadmodel->texinfo = out;
|
||||
loadmodel->numtexinfo = count;
|
||||
mod->texinfo = out;
|
||||
mod->numtexinfo = count;
|
||||
|
||||
for (i = 0; i < count; i++, in++, out++) {
|
||||
for (j = 0; j < 4; j++) {
|
||||
|
@ -436,13 +441,13 @@ Mod_LoadTexinfo (bsp_t *bsp)
|
|||
miptex = in->miptex;
|
||||
out->flags = in->flags;
|
||||
|
||||
if (!loadmodel->textures) {
|
||||
if (!mod->textures) {
|
||||
out->texture = r_notexture_mip; // checkerboard texture
|
||||
out->flags = 0;
|
||||
} else {
|
||||
if (miptex >= loadmodel->numtextures)
|
||||
Sys_Error ("miptex >= loadmodel->numtextures");
|
||||
out->texture = loadmodel->textures[miptex];
|
||||
if (miptex >= mod->numtextures)
|
||||
Sys_Error ("miptex >= mod->numtextures");
|
||||
out->texture = mod->textures[miptex];
|
||||
if (!out->texture) {
|
||||
out->texture = r_notexture_mip; // texture not found
|
||||
out->flags = 0;
|
||||
|
@ -457,7 +462,7 @@ Mod_LoadTexinfo (bsp_t *bsp)
|
|||
Fills in s->texturemins[] and s->extents[]
|
||||
*/
|
||||
static void
|
||||
CalcSurfaceExtents (msurface_t *s)
|
||||
CalcSurfaceExtents (model_t *mod, msurface_t *s)
|
||||
{
|
||||
float mins[2], maxs[2], val;
|
||||
int e, i, j;
|
||||
|
@ -471,11 +476,11 @@ CalcSurfaceExtents (msurface_t *s)
|
|||
tex = s->texinfo;
|
||||
|
||||
for (i = 0; i < s->numedges; i++) {
|
||||
e = loadmodel->surfedges[s->firstedge + i];
|
||||
e = mod->surfedges[s->firstedge + i];
|
||||
if (e >= 0)
|
||||
v = &loadmodel->vertexes[loadmodel->edges[e].v[0]];
|
||||
v = &mod->vertexes[mod->edges[e].v[0]];
|
||||
else
|
||||
v = &loadmodel->vertexes[loadmodel->edges[-e].v[1]];
|
||||
v = &mod->vertexes[mod->edges[-e].v[1]];
|
||||
|
||||
for (j = 0; j < 2; j++) {
|
||||
val = v->position[0] * tex->vecs[j][0] +
|
||||
|
@ -502,7 +507,7 @@ CalcSurfaceExtents (msurface_t *s)
|
|||
}
|
||||
|
||||
static void
|
||||
Mod_LoadFaces (bsp_t *bsp)
|
||||
Mod_LoadFaces (model_t *mod, bsp_t *bsp)
|
||||
{
|
||||
dface_t *in;
|
||||
int count, planenum, side, surfnum, i;
|
||||
|
@ -510,15 +515,15 @@ Mod_LoadFaces (bsp_t *bsp)
|
|||
|
||||
in = bsp->faces;
|
||||
count = bsp->numfaces;
|
||||
out = Hunk_AllocName (count * sizeof (*out), loadname);
|
||||
out = Hunk_AllocName (count * sizeof (*out), mod->name);
|
||||
|
||||
if (count > 32767) {
|
||||
Sys_MaskPrintf (SYS_WARN,
|
||||
"%i faces exceeds standard limit of 32767.\n", count);
|
||||
}
|
||||
|
||||
loadmodel->surfaces = out;
|
||||
loadmodel->numsurfaces = count;
|
||||
mod->surfaces = out;
|
||||
mod->numsurfaces = count;
|
||||
|
||||
for (surfnum = 0; surfnum < count; surfnum++, in++, out++) {
|
||||
out->firstedge = in->firstedge;
|
||||
|
@ -530,11 +535,11 @@ Mod_LoadFaces (bsp_t *bsp)
|
|||
if (side)
|
||||
out->flags |= SURF_PLANEBACK;
|
||||
|
||||
out->plane = loadmodel->planes + planenum;
|
||||
out->plane = mod->planes + planenum;
|
||||
|
||||
out->texinfo = loadmodel->texinfo + in->texinfo;
|
||||
out->texinfo = mod->texinfo + in->texinfo;
|
||||
|
||||
CalcSurfaceExtents (out);
|
||||
CalcSurfaceExtents (mod, out);
|
||||
|
||||
// lighting info
|
||||
|
||||
|
@ -544,7 +549,7 @@ Mod_LoadFaces (bsp_t *bsp)
|
|||
if (i == -1)
|
||||
out->samples = NULL;
|
||||
else
|
||||
out->samples = loadmodel->lightdata + (i * mod_lightmap_bytes);
|
||||
out->samples = mod->lightdata + (i * mod_lightmap_bytes);
|
||||
|
||||
// set the drawing flags flag
|
||||
if (!out->texinfo->texture || !out->texinfo->texture->name)
|
||||
|
@ -554,7 +559,7 @@ Mod_LoadFaces (bsp_t *bsp)
|
|||
out->flags |= (SURF_DRAWSKY | SURF_DRAWTILED);
|
||||
if (gl_sky_divide && gl_sky_divide->int_val)
|
||||
if (mod_funcs && mod_funcs->Mod_SubdivideSurface)
|
||||
mod_funcs->Mod_SubdivideSurface (out);
|
||||
mod_funcs->Mod_SubdivideSurface (mod, out);
|
||||
continue;
|
||||
}
|
||||
|
||||
|
@ -568,7 +573,7 @@ Mod_LoadFaces (bsp_t *bsp)
|
|||
}
|
||||
if (mod_funcs && mod_funcs->Mod_SubdivideSurface) {
|
||||
// cut up polygon for warps
|
||||
mod_funcs->Mod_SubdivideSurface (out);
|
||||
mod_funcs->Mod_SubdivideSurface (mod, out);
|
||||
}
|
||||
continue;
|
||||
}
|
||||
|
@ -586,7 +591,7 @@ Mod_SetParent (mnode_t *node, mnode_t *parent)
|
|||
}
|
||||
|
||||
static void
|
||||
Mod_LoadNodes (bsp_t *bsp)
|
||||
Mod_LoadNodes (model_t *mod, bsp_t *bsp)
|
||||
{
|
||||
dnode_t *in;
|
||||
int count, i, j, p;
|
||||
|
@ -594,15 +599,15 @@ Mod_LoadNodes (bsp_t *bsp)
|
|||
|
||||
in = bsp->nodes;
|
||||
count = bsp->numnodes;
|
||||
out = Hunk_AllocName (count * sizeof (*out), loadname);
|
||||
out = Hunk_AllocName (count * sizeof (*out), mod->name);
|
||||
|
||||
if (count > 32767) {
|
||||
Sys_MaskPrintf (SYS_WARN,
|
||||
"%i nodes exceeds standard limit of 32767.\n", count);
|
||||
}
|
||||
|
||||
loadmodel->nodes = out;
|
||||
loadmodel->numnodes = count;
|
||||
mod->nodes = out;
|
||||
mod->numnodes = count;
|
||||
|
||||
for (i = 0; i < count; i++, in++, out++) {
|
||||
for (j = 0; j < 3; j++) {
|
||||
|
@ -611,7 +616,7 @@ Mod_LoadNodes (bsp_t *bsp)
|
|||
}
|
||||
|
||||
p = in->planenum;
|
||||
out->plane = loadmodel->planes + p;
|
||||
out->plane = mod->planes + p;
|
||||
|
||||
out->firstsurface = in->firstface;
|
||||
out->numsurfaces = in->numfaces;
|
||||
|
@ -620,27 +625,27 @@ Mod_LoadNodes (bsp_t *bsp)
|
|||
p = in->children[j];
|
||||
// this check is for extended bsp 29 files
|
||||
if (p >= 0) {
|
||||
out->children[j] = loadmodel->nodes + p;
|
||||
out->children[j] = mod->nodes + p;
|
||||
} else {
|
||||
p = ~p;
|
||||
if (p < loadmodel->numleafs) {
|
||||
out->children[j] = (mnode_t *) (loadmodel->leafs + p);
|
||||
if (p < mod->numleafs) {
|
||||
out->children[j] = (mnode_t *) (mod->leafs + p);
|
||||
} else {
|
||||
Sys_Printf ("Mod_LoadNodes: invalid leaf index %i "
|
||||
"(file has only %i leafs)\n", p,
|
||||
loadmodel->numleafs);
|
||||
mod->numleafs);
|
||||
//map it to the solid leaf
|
||||
out->children[j] = (mnode_t *)(loadmodel->leafs);
|
||||
out->children[j] = (mnode_t *)(mod->leafs);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Mod_SetParent (loadmodel->nodes, NULL); // sets nodes and leafs
|
||||
Mod_SetParent (mod->nodes, NULL); // sets nodes and leafs
|
||||
}
|
||||
|
||||
static void
|
||||
Mod_LoadLeafs (bsp_t *bsp)
|
||||
Mod_LoadLeafs (model_t *mod, bsp_t *bsp)
|
||||
{
|
||||
dleaf_t *in;
|
||||
int count, i, j, p;
|
||||
|
@ -649,13 +654,13 @@ Mod_LoadLeafs (bsp_t *bsp)
|
|||
|
||||
in = bsp->leafs;
|
||||
count = bsp->numleafs;
|
||||
out = Hunk_AllocName (count * sizeof (*out), loadname);
|
||||
out = Hunk_AllocName (count * sizeof (*out), mod->name);
|
||||
|
||||
loadmodel->leafs = out;
|
||||
loadmodel->numleafs = count;
|
||||
mod->leafs = out;
|
||||
mod->numleafs = count;
|
||||
// snprintf(s, sizeof (s), "maps/%s.bsp",
|
||||
// Info_ValueForKey(cl.serverinfo,"map"));
|
||||
if (!strncmp ("maps/", loadmodel->name, 5))
|
||||
if (!strncmp ("maps/", mod->path, 5))
|
||||
isnotmap = false;
|
||||
for (i = 0; i < count; i++, in++, out++) {
|
||||
for (j = 0; j < 3; j++) {
|
||||
|
@ -666,14 +671,14 @@ Mod_LoadLeafs (bsp_t *bsp)
|
|||
p = in->contents;
|
||||
out->contents = p;
|
||||
|
||||
out->firstmarksurface = loadmodel->marksurfaces + in->firstmarksurface;
|
||||
out->firstmarksurface = mod->marksurfaces + in->firstmarksurface;
|
||||
out->nummarksurfaces = in->nummarksurfaces;
|
||||
|
||||
p = in->visofs;
|
||||
if (p == -1)
|
||||
out->compressed_vis = NULL;
|
||||
else
|
||||
out->compressed_vis = loadmodel->visdata + p;
|
||||
out->compressed_vis = mod->visdata + p;
|
||||
out->efrags = NULL;
|
||||
|
||||
for (j = 0; j < 4; j++)
|
||||
|
@ -692,7 +697,7 @@ Mod_LoadLeafs (bsp_t *bsp)
|
|||
}
|
||||
|
||||
static void
|
||||
Mod_LoadClipnodes (bsp_t *bsp)
|
||||
Mod_LoadClipnodes (model_t *mod, bsp_t *bsp)
|
||||
{
|
||||
dclipnode_t *in;
|
||||
mclipnode_t *out;
|
||||
|
@ -701,7 +706,7 @@ Mod_LoadClipnodes (bsp_t *bsp)
|
|||
|
||||
in = bsp->clipnodes;
|
||||
count = bsp->numclipnodes;
|
||||
out = Hunk_AllocName (count * sizeof (*out), loadname);
|
||||
out = Hunk_AllocName (count * sizeof (*out), mod->name);
|
||||
|
||||
if (count > 32767) {
|
||||
Sys_MaskPrintf (SYS_WARN,
|
||||
|
@ -709,15 +714,15 @@ Mod_LoadClipnodes (bsp_t *bsp)
|
|||
count);
|
||||
}
|
||||
|
||||
loadmodel->clipnodes = out;
|
||||
loadmodel->numclipnodes = count;
|
||||
mod->clipnodes = out;
|
||||
mod->numclipnodes = count;
|
||||
|
||||
hull = &loadmodel->hulls[1];
|
||||
loadmodel->hull_list[1] = hull;
|
||||
hull = &mod->hulls[1];
|
||||
mod->hull_list[1] = hull;
|
||||
hull->clipnodes = out;
|
||||
hull->firstclipnode = 0;
|
||||
hull->lastclipnode = count - 1;
|
||||
hull->planes = loadmodel->planes;
|
||||
hull->planes = mod->planes;
|
||||
hull->clip_mins[0] = -16;
|
||||
hull->clip_mins[1] = -16;
|
||||
hull->clip_mins[2] = -24;
|
||||
|
@ -725,12 +730,12 @@ Mod_LoadClipnodes (bsp_t *bsp)
|
|||
hull->clip_maxs[1] = 16;
|
||||
hull->clip_maxs[2] = 32;
|
||||
|
||||
hull = &loadmodel->hulls[2];
|
||||
loadmodel->hull_list[2] = hull;
|
||||
hull = &mod->hulls[2];
|
||||
mod->hull_list[2] = hull;
|
||||
hull->clipnodes = out;
|
||||
hull->firstclipnode = 0;
|
||||
hull->lastclipnode = count - 1;
|
||||
hull->planes = loadmodel->planes;
|
||||
hull->planes = mod->planes;
|
||||
hull->clip_mins[0] = -32;
|
||||
hull->clip_mins[1] = -32;
|
||||
hull->clip_mins[2] = -24;
|
||||
|
@ -740,7 +745,7 @@ Mod_LoadClipnodes (bsp_t *bsp)
|
|||
|
||||
for (i = 0; i < count; i++, out++, in++) {
|
||||
out->planenum = in->planenum;
|
||||
if (out->planenum < 0 || out->planenum >= loadmodel->numplanes)
|
||||
if (out->planenum < 0 || out->planenum >= mod->numplanes)
|
||||
Sys_Error ("Mod_LoadClipnodes: planenum out of bounds");
|
||||
out->children[0] = in->children[0];
|
||||
out->children[1] = in->children[1];
|
||||
|
@ -765,39 +770,39 @@ Mod_LoadClipnodes (bsp_t *bsp)
|
|||
Replicate the drawing hull structure as a clipping hull
|
||||
*/
|
||||
static void
|
||||
Mod_MakeHull0 (void)
|
||||
Mod_MakeHull0 (model_t *mod)
|
||||
{
|
||||
mclipnode_t *out;
|
||||
hull_t *hull;
|
||||
int count, i, j;
|
||||
mnode_t *in, *child;
|
||||
|
||||
hull = &loadmodel->hulls[0];
|
||||
loadmodel->hull_list[0] = hull;
|
||||
hull = &mod->hulls[0];
|
||||
mod->hull_list[0] = hull;
|
||||
|
||||
in = loadmodel->nodes;
|
||||
count = loadmodel->numnodes;
|
||||
out = Hunk_AllocName (count * sizeof (*out), loadname);
|
||||
in = mod->nodes;
|
||||
count = mod->numnodes;
|
||||
out = Hunk_AllocName (count * sizeof (*out), mod->name);
|
||||
|
||||
hull->clipnodes = out;
|
||||
hull->firstclipnode = 0;
|
||||
hull->lastclipnode = count - 1;
|
||||
hull->planes = loadmodel->planes;
|
||||
hull->planes = mod->planes;
|
||||
|
||||
for (i = 0; i < count; i++, out++, in++) {
|
||||
out->planenum = in->plane - loadmodel->planes;
|
||||
out->planenum = in->plane - mod->planes;
|
||||
for (j = 0; j < 2; j++) {
|
||||
child = in->children[j];
|
||||
if (child->contents < 0)
|
||||
out->children[j] = child->contents;
|
||||
else
|
||||
out->children[j] = child - loadmodel->nodes;
|
||||
out->children[j] = child - mod->nodes;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
Mod_LoadMarksurfaces (bsp_t *bsp)
|
||||
Mod_LoadMarksurfaces (model_t *mod, bsp_t *bsp)
|
||||
{
|
||||
int count, i, j;
|
||||
msurface_t **out;
|
||||
|
@ -805,7 +810,7 @@ Mod_LoadMarksurfaces (bsp_t *bsp)
|
|||
|
||||
in = bsp->marksurfaces;
|
||||
count = bsp->nummarksurfaces;
|
||||
out = Hunk_AllocName (count * sizeof (*out), loadname);
|
||||
out = Hunk_AllocName (count * sizeof (*out), mod->name);
|
||||
|
||||
if (count > 32767) {
|
||||
Sys_MaskPrintf (SYS_WARN,
|
||||
|
@ -813,19 +818,19 @@ Mod_LoadMarksurfaces (bsp_t *bsp)
|
|||
count);
|
||||
}
|
||||
|
||||
loadmodel->marksurfaces = out;
|
||||
loadmodel->nummarksurfaces = count;
|
||||
mod->marksurfaces = out;
|
||||
mod->nummarksurfaces = count;
|
||||
|
||||
for (i = 0; i < count; i++) {
|
||||
j = in[i];
|
||||
if (j >= loadmodel->numsurfaces)
|
||||
if (j >= mod->numsurfaces)
|
||||
Sys_Error ("Mod_ParseMarksurfaces: bad surface number");
|
||||
out[i] = loadmodel->surfaces + j;
|
||||
out[i] = mod->surfaces + j;
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
Mod_LoadSurfedges (bsp_t *bsp)
|
||||
Mod_LoadSurfedges (model_t *mod, bsp_t *bsp)
|
||||
{
|
||||
int count, i;
|
||||
int32_t *in;
|
||||
|
@ -833,17 +838,17 @@ Mod_LoadSurfedges (bsp_t *bsp)
|
|||
|
||||
in = bsp->surfedges;
|
||||
count = bsp->numsurfedges;
|
||||
out = Hunk_AllocName (count * sizeof (*out), loadname);
|
||||
out = Hunk_AllocName (count * sizeof (*out), mod->name);
|
||||
|
||||
loadmodel->surfedges = out;
|
||||
loadmodel->numsurfedges = count;
|
||||
mod->surfedges = out;
|
||||
mod->numsurfedges = count;
|
||||
|
||||
for (i = 0; i < count; i++)
|
||||
out[i] = in[i];
|
||||
}
|
||||
|
||||
static void
|
||||
Mod_LoadPlanes (bsp_t *bsp)
|
||||
Mod_LoadPlanes (model_t *mod, bsp_t *bsp)
|
||||
{
|
||||
dplane_t *in;
|
||||
int bits, count, i, j;
|
||||
|
@ -851,10 +856,10 @@ Mod_LoadPlanes (bsp_t *bsp)
|
|||
|
||||
in = bsp->planes;
|
||||
count = bsp->numplanes;
|
||||
out = Hunk_AllocName (count * 2 * sizeof (*out), loadname);
|
||||
out = Hunk_AllocName (count * 2 * sizeof (*out), mod->name);
|
||||
|
||||
loadmodel->planes = out;
|
||||
loadmodel->numplanes = count;
|
||||
mod->planes = out;
|
||||
mod->numplanes = count;
|
||||
|
||||
for (i = 0; i < count; i++, in++, out++) {
|
||||
bits = 0;
|
||||
|
@ -897,22 +902,22 @@ do_checksums (const bsp_t *bsp, void *_mod)
|
|||
}
|
||||
|
||||
static void
|
||||
recurse_draw_tree (mnode_t *node, int depth)
|
||||
recurse_draw_tree (model_t *mod, mnode_t *node, int depth)
|
||||
{
|
||||
if (!node || node->contents < 0) {
|
||||
if (depth > loadmodel->depth)
|
||||
loadmodel->depth = depth;
|
||||
if (depth > mod->depth)
|
||||
mod->depth = depth;
|
||||
return;
|
||||
}
|
||||
recurse_draw_tree (node->children[0], depth + 1);
|
||||
recurse_draw_tree (node->children[1], depth + 1);
|
||||
recurse_draw_tree (mod, node->children[0], depth + 1);
|
||||
recurse_draw_tree (mod, node->children[1], depth + 1);
|
||||
}
|
||||
|
||||
static void
|
||||
Mod_FindDrawDepth (void)
|
||||
Mod_FindDrawDepth (model_t *mod)
|
||||
{
|
||||
loadmodel->depth = 0;
|
||||
recurse_draw_tree (loadmodel->nodes, 1);
|
||||
mod->depth = 0;
|
||||
recurse_draw_tree (mod, mod->nodes, 1);
|
||||
}
|
||||
|
||||
void
|
||||
|
@ -922,34 +927,34 @@ Mod_LoadBrushModel (model_t *mod, void *buffer)
|
|||
int i, j;
|
||||
bsp_t *bsp;
|
||||
|
||||
loadmodel->type = mod_brush;
|
||||
mod->type = mod_brush;
|
||||
|
||||
bsp = LoadBSPMem (buffer, qfs_filesize, do_checksums, mod);
|
||||
|
||||
// load into heap
|
||||
Mod_LoadVertexes (bsp);
|
||||
Mod_LoadEdges (bsp);
|
||||
Mod_LoadSurfedges (bsp);
|
||||
Mod_LoadTextures (bsp);
|
||||
Mod_LoadVertexes (mod, bsp);
|
||||
Mod_LoadEdges (mod, bsp);
|
||||
Mod_LoadSurfedges (mod, bsp);
|
||||
Mod_LoadTextures (mod, bsp);
|
||||
if (mod_funcs && mod_funcs->Mod_LoadLighting) {
|
||||
mod_funcs->Mod_LoadLighting (bsp);
|
||||
mod_funcs->Mod_LoadLighting (mod, bsp);
|
||||
}
|
||||
Mod_LoadPlanes (bsp);
|
||||
Mod_LoadTexinfo (bsp);
|
||||
Mod_LoadFaces (bsp);
|
||||
Mod_LoadMarksurfaces (bsp);
|
||||
Mod_LoadVisibility (bsp);
|
||||
Mod_LoadLeafs (bsp);
|
||||
Mod_LoadNodes (bsp);
|
||||
Mod_LoadClipnodes (bsp);
|
||||
Mod_LoadEntities (bsp);
|
||||
Mod_LoadSubmodels (bsp);
|
||||
Mod_LoadPlanes (mod, bsp);
|
||||
Mod_LoadTexinfo (mod, bsp);
|
||||
Mod_LoadFaces (mod, bsp);
|
||||
Mod_LoadMarksurfaces (mod, bsp);
|
||||
Mod_LoadVisibility (mod, bsp);
|
||||
Mod_LoadLeafs (mod, bsp);
|
||||
Mod_LoadNodes (mod, bsp);
|
||||
Mod_LoadClipnodes (mod, bsp);
|
||||
Mod_LoadEntities (mod, bsp);
|
||||
Mod_LoadSubmodels (mod, bsp);
|
||||
|
||||
BSP_Free(bsp);
|
||||
|
||||
Mod_MakeHull0 ();
|
||||
Mod_MakeHull0 (mod);
|
||||
|
||||
Mod_FindDrawDepth ();
|
||||
Mod_FindDrawDepth (mod);
|
||||
for (i = 0; i < MAX_MAP_HULLS; i++)
|
||||
Mod_FindClipDepth (&mod->hulls[i]);
|
||||
|
||||
|
@ -984,7 +989,7 @@ Mod_LoadBrushModel (model_t *mod, void *buffer)
|
|||
snprintf (name, sizeof (name), "*%i", i + 1);
|
||||
model_t *m = Mod_FindName (name);
|
||||
*m = *mod;
|
||||
strcpy (m->name, name);
|
||||
strcpy (m->path, name);
|
||||
mod = m;
|
||||
// make sure clear is called only for the main model
|
||||
m->clear = 0;
|
||||
|
|
|
@ -41,13 +41,13 @@
|
|||
#include "mod_internal.h"
|
||||
|
||||
void
|
||||
sw_Mod_LoadLighting (bsp_t *bsp)
|
||||
sw_Mod_LoadLighting (model_t *mod, bsp_t *bsp)
|
||||
{
|
||||
mod_lightmap_bytes = 1;
|
||||
if (!bsp->lightdatasize) {
|
||||
loadmodel->lightdata = NULL;
|
||||
mod->lightdata = NULL;
|
||||
return;
|
||||
}
|
||||
loadmodel->lightdata = Hunk_AllocName (bsp->lightdatasize, loadname);
|
||||
memcpy (loadmodel->lightdata, bsp->lightdata, bsp->lightdatasize);
|
||||
mod->lightdata = Hunk_AllocName (bsp->lightdatasize, mod->name);
|
||||
memcpy (mod->lightdata, bsp->lightdata, bsp->lightdatasize);
|
||||
}
|
||||
|
|
|
@ -63,15 +63,15 @@
|
|||
|
||||
static vulktex_t vulkan_notexture = { };
|
||||
|
||||
static void vulkan_brush_clear (model_t *model, void *data)
|
||||
static void vulkan_brush_clear (model_t *mod, void *data)
|
||||
{
|
||||
modelctx_t *mctx = data;
|
||||
vulkan_ctx_t *ctx = mctx->ctx;
|
||||
qfv_device_t *device = ctx->device;
|
||||
qfv_devfuncs_t *dfunc = device->funcs;
|
||||
|
||||
for (int i = 0; i < model->numtextures; i++) {
|
||||
texture_t *tx = model->textures[i];
|
||||
for (int i = 0; i < mod->numtextures; i++) {
|
||||
texture_t *tx = mod->textures[i];
|
||||
if (!tx) {
|
||||
continue;
|
||||
}
|
||||
|
@ -173,19 +173,19 @@ copy_mips (qfv_packet_t *packet, texture_t *tx, qfv_tex_t *tex,
|
|||
}
|
||||
|
||||
static void
|
||||
load_textures (model_t *model, vulkan_ctx_t *ctx)
|
||||
load_textures (model_t *mod, vulkan_ctx_t *ctx)
|
||||
{
|
||||
qfv_device_t *device = ctx->device;
|
||||
qfv_devfuncs_t *dfunc = device->funcs;
|
||||
modelctx_t *mctx = model->data;
|
||||
modelctx_t *mctx = mod->data;
|
||||
VkImage image = 0;
|
||||
byte *buffer;
|
||||
|
||||
size_t image_count = 0;
|
||||
size_t copy_count = 0;
|
||||
size_t memsize = 0;
|
||||
for (int i = 0; i < model->numtextures; i++) {
|
||||
texture_t *tx = model->textures[i];
|
||||
for (int i = 0; i < mod->numtextures; i++) {
|
||||
texture_t *tx = mod->textures[i];
|
||||
if (!tx) {
|
||||
continue;
|
||||
}
|
||||
|
@ -211,20 +211,18 @@ load_textures (model_t *model, vulkan_ctx_t *ctx)
|
|||
VK_MEMORY_PROPERTY_DEVICE_LOCAL_BIT,
|
||||
memsize, 0);
|
||||
QFV_duSetObjectName (device, VK_OBJECT_TYPE_DEVICE_MEMORY,
|
||||
mem, va (ctx->va_ctx, "memory:%s:texture",
|
||||
loadmodel->name));
|
||||
mem, va (ctx->va_ctx, "memory:%s:texture", mod->name));
|
||||
mctx->texture_memory = mem;
|
||||
|
||||
qfv_stagebuf_t *stage = QFV_CreateStagingBuffer (device,
|
||||
va (ctx->va_ctx,
|
||||
"brush:%s",
|
||||
loadmodel->name),
|
||||
"brush:%s", mod->name),
|
||||
memsize, ctx->cmdpool);
|
||||
qfv_packet_t *packet = QFV_PacketAcquire (stage);
|
||||
buffer = QFV_PacketExtend (packet, memsize);
|
||||
|
||||
for (int i = 0; i < model->numtextures; i++) {
|
||||
texture_t *tx = model->textures[i];
|
||||
for (int i = 0; i < mod->numtextures; i++) {
|
||||
texture_t *tx = mod->textures[i];
|
||||
byte *palette = vid.palette32;
|
||||
if (!tx) {
|
||||
continue;
|
||||
|
@ -249,7 +247,7 @@ load_textures (model_t *model, vulkan_ctx_t *ctx)
|
|||
QFV_duSetObjectName (device, VK_OBJECT_TYPE_IMAGE_VIEW,
|
||||
tex->tex->view,
|
||||
va (ctx->va_ctx, "iview:%s:%s:tex",
|
||||
loadmodel->name, tx->name));
|
||||
mod->name, tx->name));
|
||||
transfer_mips (buffer + tex->tex->offset, tx + 1, tx, palette);
|
||||
if (tex->glow) {
|
||||
dfunc->vkBindImageMemory (device->dev, tex->glow->image, mem,
|
||||
|
@ -263,8 +261,7 @@ load_textures (model_t *model, vulkan_ctx_t *ctx)
|
|||
QFV_duSetObjectName (device, VK_OBJECT_TYPE_IMAGE_VIEW,
|
||||
tex->glow->view,
|
||||
va (ctx->va_ctx, "iview:%s:%s:glow",
|
||||
loadmodel->name,
|
||||
tx->name));
|
||||
mod->name, tx->name));
|
||||
transfer_mips (buffer + tex->glow->offset, tex->glow->memory, tx,
|
||||
palette);
|
||||
}
|
||||
|
@ -278,8 +275,8 @@ load_textures (model_t *model, vulkan_ctx_t *ctx)
|
|||
|
||||
__auto_type barriers = QFV_AllocImageBarrierSet (image_count, malloc);
|
||||
barriers->size = 0;
|
||||
for (int i = 0; i < model->numtextures; i++) {
|
||||
texture_t *tx = model->textures[i];
|
||||
for (int i = 0; i < mod->numtextures; i++) {
|
||||
texture_t *tx = mod->textures[i];
|
||||
if (!tx) {
|
||||
continue;
|
||||
}
|
||||
|
@ -299,8 +296,8 @@ load_textures (model_t *model, vulkan_ctx_t *ctx)
|
|||
dfunc->vkCmdPipelineBarrier (packet->cmd, stages.src, stages.dst,
|
||||
0, 0, 0, 0, 0,
|
||||
barriers->size, barriers->a);
|
||||
for (int i = 0, j = 0; i < model->numtextures; i++) {
|
||||
texture_t *tx = model->textures[i];
|
||||
for (int i = 0, j = 0; i < mod->numtextures; i++) {
|
||||
texture_t *tx = mod->textures[i];
|
||||
if (!tx) {
|
||||
continue;
|
||||
}
|
||||
|
@ -330,19 +327,18 @@ load_textures (model_t *model, vulkan_ctx_t *ctx)
|
|||
}
|
||||
|
||||
void
|
||||
Vulkan_Mod_ProcessTexture (texture_t *tx, vulkan_ctx_t *ctx)
|
||||
Vulkan_Mod_ProcessTexture (model_t *mod, texture_t *tx, vulkan_ctx_t *ctx)
|
||||
{
|
||||
qfv_device_t *device = ctx->device;
|
||||
|
||||
if (!tx) {
|
||||
modelctx_t *mctx = Hunk_AllocName (sizeof (modelctx_t),
|
||||
loadmodel->name);
|
||||
modelctx_t *mctx = Hunk_AllocName (sizeof (modelctx_t), mod->name);
|
||||
mctx->ctx = ctx;
|
||||
loadmodel->clear = vulkan_brush_clear;
|
||||
loadmodel->data = mctx;
|
||||
mod->clear = vulkan_brush_clear;
|
||||
mod->data = mctx;
|
||||
|
||||
r_notexture_mip->render = &vulkan_notexture;
|
||||
load_textures (loadmodel, ctx);
|
||||
load_textures (mod, ctx);
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -369,7 +365,7 @@ Vulkan_Mod_ProcessTexture (texture_t *tx, vulkan_ctx_t *ctx)
|
|||
| VK_IMAGE_USAGE_SAMPLED_BIT);
|
||||
QFV_duSetObjectName (device, VK_OBJECT_TYPE_IMAGE,
|
||||
tex->tex->image,
|
||||
va (ctx->va_ctx, "image:%s:%s:tex", loadmodel->name,
|
||||
va (ctx->va_ctx, "image:%s:%s:tex", mod->name,
|
||||
tx->name));
|
||||
if (layers > 1) {
|
||||
// skys are unlit, so no fullbrights
|
||||
|
@ -394,7 +390,7 @@ Vulkan_Mod_ProcessTexture (texture_t *tx, vulkan_ctx_t *ctx)
|
|||
| VK_IMAGE_USAGE_SAMPLED_BIT);
|
||||
QFV_duSetObjectName (device, VK_OBJECT_TYPE_IMAGE,
|
||||
tex->glow->image,
|
||||
va (ctx->va_ctx, "image:%s:%s:glow", loadmodel->name,
|
||||
va (ctx->va_ctx, "image:%s:%s:glow", mod->name,
|
||||
tx->name));
|
||||
// store the pointer to the fullbright data: memory will never be set to
|
||||
// actual device memory because all of the textures will be loaded in one
|
||||
|
@ -403,11 +399,11 @@ Vulkan_Mod_ProcessTexture (texture_t *tx, vulkan_ctx_t *ctx)
|
|||
}
|
||||
|
||||
void
|
||||
Vulkan_Mod_LoadLighting (bsp_t *bsp, vulkan_ctx_t *ctx)
|
||||
Vulkan_Mod_LoadLighting (model_t *mod, bsp_t *bsp, vulkan_ctx_t *ctx)
|
||||
{
|
||||
mod_lightmap_bytes = 3;
|
||||
if (!bsp->lightdatasize) {
|
||||
loadmodel->lightdata = NULL;
|
||||
mod->lightdata = NULL;
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -417,14 +413,14 @@ Vulkan_Mod_LoadLighting (bsp_t *bsp, vulkan_ctx_t *ctx)
|
|||
int ver;
|
||||
QFile *lit_file;
|
||||
|
||||
loadmodel->lightdata = 0;
|
||||
mod->lightdata = 0;
|
||||
if (mod_lightmap_bytes > 1) {
|
||||
// LordHavoc: check for a .lit file to load
|
||||
dstring_t *litfilename = dstring_new ();
|
||||
dstring_copystr (litfilename, loadmodel->name);
|
||||
dstring_copystr (litfilename, mod->name);
|
||||
QFS_StripExtension (litfilename->str, litfilename->str);
|
||||
dstring_appendstr (litfilename, ".lit");
|
||||
lit_file = QFS_VOpenFile (litfilename->str, 0, loadmodel->vpath);
|
||||
lit_file = QFS_VOpenFile (litfilename->str, 0, mod->vpath);
|
||||
data = (byte *) QFS_LoadHunkFile (lit_file);
|
||||
if (data) {
|
||||
if (data[0] == 'Q' && data[1] == 'L' && data[2] == 'I'
|
||||
|
@ -432,7 +428,7 @@ Vulkan_Mod_LoadLighting (bsp_t *bsp, vulkan_ctx_t *ctx)
|
|||
ver = LittleLong (((int32_t *) data)[1]);
|
||||
if (ver == 1) {
|
||||
Sys_MaskPrintf (SYS_DEV, "%s loaded", litfilename->str);
|
||||
loadmodel->lightdata = data + 8;
|
||||
mod->lightdata = data + 8;
|
||||
} else {
|
||||
Sys_MaskPrintf (SYS_DEV,
|
||||
"Unknown .lit file version (%d)\n", ver);
|
||||
|
@ -443,14 +439,13 @@ Vulkan_Mod_LoadLighting (bsp_t *bsp, vulkan_ctx_t *ctx)
|
|||
}
|
||||
dstring_delete (litfilename);
|
||||
}
|
||||
if (loadmodel->lightdata || !bsp->lightdatasize) {
|
||||
if (mod->lightdata || !bsp->lightdatasize) {
|
||||
return;
|
||||
}
|
||||
// LordHavoc: oh well, expand the white lighting data
|
||||
loadmodel->lightdata = Hunk_AllocName (bsp->lightdatasize * 3,
|
||||
loadmodel->name);
|
||||
mod->lightdata = Hunk_AllocName (bsp->lightdatasize * 3, mod->name);
|
||||
in = bsp->lightdata;
|
||||
out = loadmodel->lightdata;
|
||||
out = mod->lightdata;
|
||||
|
||||
for (i = 0; i < bsp->lightdatasize ; i++) {
|
||||
d = *in++;
|
||||
|
|
|
@ -36,6 +36,7 @@
|
|||
#include "QF/clip_hull.h"
|
||||
#include "QF/model.h"
|
||||
|
||||
#include "mod_internal.h"
|
||||
|
||||
VISIBLE clip_hull_t *
|
||||
MOD_Alloc_Hull (int nodes, int planes)
|
||||
|
|
|
@ -31,7 +31,7 @@
|
|||
# include "config.h"
|
||||
#endif
|
||||
|
||||
#include "r_local.h"
|
||||
#include "mod_internal.h"
|
||||
|
||||
VISIBLE int
|
||||
Mod_CalcFullbright (const byte *in, byte *out, int pixels)
|
||||
|
|
|
@ -38,7 +38,7 @@
|
|||
#include "QF/qendian.h"
|
||||
#include "QF/sys.h"
|
||||
|
||||
#include "r_local.h"
|
||||
#include "mod_internal.h"
|
||||
|
||||
int
|
||||
Mod_Fullbright (byte *skin, int width, int height, const char *name)
|
||||
|
|
|
@ -497,25 +497,25 @@ Mod_LoadIQM (model_t *mod, void *buffer)
|
|||
uint32_t *swap;
|
||||
|
||||
if (!strequal (hdr->magic, IQM_MAGIC))
|
||||
Sys_Error ("%s: not an IQM", loadname);
|
||||
Sys_Error ("%s: not an IQM", mod->path);
|
||||
// Byte swap the header. Everything is the same type, so no problem :)
|
||||
for (swap = &hdr->version; swap <= &hdr->ofs_extensions; swap++)
|
||||
*swap = LittleLong (*swap);
|
||||
//if (hdr->version < 1 || hdr->version > IQM_VERSION)
|
||||
if (hdr->version != IQM_VERSION)
|
||||
Sys_Error ("%s: unable to handle iqm version %d", loadname,
|
||||
Sys_Error ("%s: unable to handle iqm version %d", mod->path,
|
||||
hdr->version);
|
||||
if (hdr->filesize != (uint32_t) qfs_filesize)
|
||||
Sys_Error ("%s: invalid filesize", loadname);
|
||||
Sys_Error ("%s: invalid filesize", mod->path);
|
||||
iqm = calloc (1, sizeof (iqm_t));
|
||||
iqm->text = malloc (hdr->num_text);
|
||||
memcpy (iqm->text, (byte *) buffer + hdr->ofs_text, hdr->num_text);
|
||||
mod->aliashdr = (aliashdr_t *) iqm;
|
||||
mod->type = mod_iqm;
|
||||
if (hdr->num_meshes && !load_iqm_meshes (mod, hdr, (byte *) buffer))
|
||||
Sys_Error ("%s: error loading meshes", loadname);
|
||||
Sys_Error ("%s: error loading meshes", mod->path);
|
||||
if (hdr->num_anims && !load_iqm_anims (mod, hdr, (byte *) buffer))
|
||||
Sys_Error ("%s: error loading anims", loadname);
|
||||
Sys_Error ("%s: error loading anims", mod->path);
|
||||
m_funcs->Mod_IQMFinish (mod);
|
||||
}
|
||||
|
||||
|
|
|
@ -48,12 +48,10 @@
|
|||
#include "QF/plugin/vid_render.h"
|
||||
|
||||
#include "compat.h"
|
||||
#include "mod_internal.h"
|
||||
|
||||
vid_model_funcs_t *mod_funcs;
|
||||
|
||||
model_t *loadmodel;
|
||||
char *loadname; // for hunk tags
|
||||
|
||||
#define MOD_BLOCK 16 // allocate 16 models at a time
|
||||
model_t **mod_known;
|
||||
int mod_numknown;
|
||||
|
@ -75,7 +73,6 @@ Mod_Init (void)
|
|||
int m, x, y;
|
||||
int mip0size = 16*16, mip1size = 8*8, mip2size = 4*4, mip3size = 2*2;
|
||||
|
||||
memset (mod_novis, 0xff, sizeof (mod_novis));
|
||||
r_notexture_mip = Hunk_AllocName (sizeof (texture_t) + mip0size + mip1size
|
||||
+ mip2size + mip3size, "notexture");
|
||||
|
||||
|
@ -145,7 +142,7 @@ Mod_FindName (const char *name)
|
|||
|
||||
// search the currently loaded models
|
||||
for (i = 0, mod = mod_known; i < mod_numknown; i++, mod++)
|
||||
if (!strcmp ((*mod)->name, name))
|
||||
if (!strcmp ((*mod)->path, name))
|
||||
break;
|
||||
|
||||
if (i == mod_numknown) {
|
||||
|
@ -158,7 +155,7 @@ Mod_FindName (const char *name)
|
|||
mod[i] = mod[0] + i;
|
||||
}
|
||||
memset ((*mod), 0, sizeof (model_t));
|
||||
strncpy ((*mod)->name, name, sizeof (*mod)->name - 1);
|
||||
strncpy ((*mod)->path, name, sizeof (*mod)->path - 1);
|
||||
(*mod)->needload = true;
|
||||
mod_numknown++;
|
||||
Cache_Add (&(*mod)->cache, *mod, Mod_CallbackLoad);
|
||||
|
@ -173,17 +170,17 @@ Mod_RealLoadModel (model_t *mod, qboolean crash, cache_allocator_t allocator)
|
|||
uint32_t *buf;
|
||||
|
||||
// load the file
|
||||
buf = (uint32_t *) QFS_LoadFile (QFS_FOpenFile (mod->name), 0);
|
||||
buf = (uint32_t *) QFS_LoadFile (QFS_FOpenFile (mod->path), 0);
|
||||
if (!buf) {
|
||||
if (crash)
|
||||
Sys_Error ("Mod_LoadModel: %s not found", mod->name);
|
||||
Sys_Error ("Mod_LoadModel: %s not found", mod->path);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
if (loadname)
|
||||
free (loadname);
|
||||
loadname = QFS_FileBase (mod->name);
|
||||
loadmodel = mod;
|
||||
char *name = QFS_FileBase (mod->path);
|
||||
strncpy (mod->name, name, sizeof (mod->name - 1));
|
||||
mod->name[sizeof (mod->name) - 1] = 0;
|
||||
free (name);
|
||||
|
||||
// fill it in
|
||||
mod->vpath = qfs_foundfile.vpath;
|
||||
|
@ -204,17 +201,17 @@ Mod_RealLoadModel (model_t *mod, qboolean crash, cache_allocator_t allocator)
|
|||
break;
|
||||
case IDHEADER_MDL: // Type 6: Quake 1 .mdl
|
||||
case HEADER_MDL16: // QF Type 6 extended for 16bit precision
|
||||
if (strequal (mod->name, "progs/grenade.mdl")) {
|
||||
if (strequal (mod->path, "progs/grenade.mdl")) {
|
||||
mod->fullbright = 0;
|
||||
mod->shadow_alpha = 255;
|
||||
} else if (strnequal (mod->name, "progs/flame", 11)
|
||||
|| strnequal (mod->name, "progs/bolt", 10)) {
|
||||
} else if (strnequal (mod->path, "progs/flame", 11)
|
||||
|| strnequal (mod->path, "progs/bolt", 10)) {
|
||||
mod->fullbright = 1;
|
||||
mod->shadow_alpha = 0;
|
||||
}
|
||||
if (strnequal (mod->name, "progs/v_", 8)) {
|
||||
if (strnequal (mod->path, "progs/v_", 8)) {
|
||||
mod->min_light = 0.12;
|
||||
} else if (strequal (mod->name, "progs/player.mdl")) {
|
||||
} else if (strequal (mod->path, "progs/player.mdl")) {
|
||||
mod->min_light = 0.04;
|
||||
}
|
||||
if (mod_funcs)
|
||||
|
@ -309,7 +306,7 @@ Mod_Print (void)
|
|||
|
||||
Sys_Printf ("Cached models:\n");
|
||||
for (i = 0, mod = mod_known; i < mod_numknown; i++, mod++) {
|
||||
Sys_Printf ("%8p : %s\n", (*mod)->cache.data, (*mod)->name);
|
||||
Sys_Printf ("%8p : %s\n", (*mod)->cache.data, (*mod)->path);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -44,12 +44,13 @@
|
|||
#include "mod_internal.h"
|
||||
|
||||
void
|
||||
gl_Mod_SpriteLoadTexture (mspriteframe_t *pspriteframe, int framenum)
|
||||
gl_Mod_SpriteLoadTexture (model_t *mod, mspriteframe_t *pspriteframe,
|
||||
int framenum)
|
||||
{
|
||||
tex_t *targa;
|
||||
const char *name;
|
||||
|
||||
targa = LoadImage (name = va (0, "%s_%i", loadmodel->name, framenum), 1);
|
||||
targa = LoadImage (name = va (0, "%s_%i", mod->path, framenum), 1);
|
||||
if (targa) {
|
||||
if (targa->format < 4)
|
||||
pspriteframe->gl_texturenum = GL_LoadTexture (name,
|
||||
|
|
|
@ -71,12 +71,13 @@ glsl_sprite_clear (model_t *m, void *data)
|
|||
}
|
||||
|
||||
void
|
||||
glsl_Mod_SpriteLoadTexture (mspriteframe_t *pspriteframe, int framenum)
|
||||
glsl_Mod_SpriteLoadTexture (model_t *mod, mspriteframe_t *pspriteframe,
|
||||
int framenum)
|
||||
{
|
||||
const char *name;
|
||||
|
||||
loadmodel->clear = glsl_sprite_clear;
|
||||
name = va (0, "%s_%i", loadmodel->name, framenum);
|
||||
mod->clear = glsl_sprite_clear;
|
||||
name = va (0, "%s_%i", mod->path, framenum);
|
||||
pspriteframe->gl_texturenum =
|
||||
GLSL_LoadQuakeTexture (name, pspriteframe->width, pspriteframe->height,
|
||||
pspriteframe->pixels);
|
||||
|
|
|
@ -42,7 +42,8 @@
|
|||
#include "mod_internal.h"
|
||||
|
||||
static void *
|
||||
Mod_LoadSpriteFrame (void *pin, mspriteframe_t **ppframe, int framenum)
|
||||
Mod_LoadSpriteFrame (model_t *mod, void *pin, mspriteframe_t **ppframe,
|
||||
int framenum)
|
||||
{
|
||||
dspriteframe_t *pinframe;
|
||||
int width, height, size, origin[2];
|
||||
|
@ -54,7 +55,7 @@ Mod_LoadSpriteFrame (void *pin, mspriteframe_t **ppframe, int framenum)
|
|||
height = LittleLong (pinframe->height);
|
||||
size = width * height;
|
||||
|
||||
pspriteframe = Hunk_AllocName (sizeof (mspriteframe_t) + size, loadname);
|
||||
pspriteframe = Hunk_AllocName (sizeof (mspriteframe_t) + size, mod->name);
|
||||
|
||||
memset (pspriteframe, 0, sizeof (mspriteframe_t) + size);
|
||||
|
||||
|
@ -72,13 +73,14 @@ Mod_LoadSpriteFrame (void *pin, mspriteframe_t **ppframe, int framenum)
|
|||
|
||||
memcpy (pspriteframe->pixels, (byte *) (pinframe + 1), size);
|
||||
|
||||
m_funcs->Mod_SpriteLoadTexture (pspriteframe, framenum);
|
||||
m_funcs->Mod_SpriteLoadTexture (mod, pspriteframe, framenum);
|
||||
|
||||
return (void *) ((byte *) pinframe + sizeof (dspriteframe_t) + size);
|
||||
}
|
||||
|
||||
static void *
|
||||
Mod_LoadSpriteGroup (void *pin, mspriteframe_t **ppframe, int framenum)
|
||||
Mod_LoadSpriteGroup (model_t *mod, void *pin, mspriteframe_t **ppframe,
|
||||
int framenum)
|
||||
{
|
||||
dspritegroup_t *pingroup;
|
||||
dspriteinterval_t *pin_intervals;
|
||||
|
@ -92,7 +94,8 @@ Mod_LoadSpriteGroup (void *pin, mspriteframe_t **ppframe, int framenum)
|
|||
numframes = LittleLong (pingroup->numframes);
|
||||
|
||||
pspritegroup = Hunk_AllocName (field_offset (mspritegroup_t,
|
||||
frames[numframes]), loadname);
|
||||
frames[numframes]),
|
||||
mod->name);
|
||||
|
||||
pspritegroup->numframes = numframes;
|
||||
|
||||
|
@ -100,7 +103,7 @@ Mod_LoadSpriteGroup (void *pin, mspriteframe_t **ppframe, int framenum)
|
|||
|
||||
pin_intervals = (dspriteinterval_t *) (pingroup + 1);
|
||||
|
||||
poutintervals = Hunk_AllocName (numframes * sizeof (float), loadname);
|
||||
poutintervals = Hunk_AllocName (numframes * sizeof (float), mod->name);
|
||||
|
||||
pspritegroup->intervals = poutintervals;
|
||||
|
||||
|
@ -117,7 +120,7 @@ Mod_LoadSpriteGroup (void *pin, mspriteframe_t **ppframe, int framenum)
|
|||
|
||||
for (i = 0; i < numframes; i++) {
|
||||
ptemp =
|
||||
Mod_LoadSpriteFrame (ptemp, &pspritegroup->frames[i],
|
||||
Mod_LoadSpriteFrame (mod, ptemp, &pspritegroup->frames[i],
|
||||
framenum * 100 + i);
|
||||
}
|
||||
|
||||
|
@ -136,14 +139,14 @@ Mod_LoadSpriteModel (model_t *mod, void *buffer)
|
|||
|
||||
version = LittleLong (pin->version);
|
||||
if (version != SPR_VERSION)
|
||||
Sys_Error ("%s has wrong version number "
|
||||
"(%i should be %i)", mod->name, version, SPR_VERSION);
|
||||
Sys_Error ("%s has wrong version number (%i should be %i)",
|
||||
mod->path, version, SPR_VERSION);
|
||||
|
||||
numframes = LittleLong (pin->numframes);
|
||||
|
||||
size = field_offset (msprite_t, frames[numframes]);
|
||||
|
||||
psprite = Hunk_AllocName (size, loadname);
|
||||
psprite = Hunk_AllocName (size, mod->name);
|
||||
|
||||
mod->cache.data = psprite;
|
||||
|
||||
|
@ -175,11 +178,11 @@ Mod_LoadSpriteModel (model_t *mod, void *buffer)
|
|||
|
||||
if (frametype == SPR_SINGLE) {
|
||||
pframetype = (dspriteframetype_t *)
|
||||
Mod_LoadSpriteFrame (pframetype + 1,
|
||||
Mod_LoadSpriteFrame (mod, pframetype + 1,
|
||||
&psprite->frames[i].frameptr, i);
|
||||
} else {
|
||||
pframetype = (dspriteframetype_t *)
|
||||
Mod_LoadSpriteGroup (pframetype + 1,
|
||||
Mod_LoadSpriteGroup (mod, pframetype + 1,
|
||||
&psprite->frames[i].frameptr, i);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -31,6 +31,7 @@
|
|||
#include "mod_internal.h"
|
||||
|
||||
void
|
||||
sw_Mod_SpriteLoadTexture (mspriteframe_t *pspriteframe, int framenum)
|
||||
sw_Mod_SpriteLoadTexture (model_t *mod, mspriteframe_t *pspriteframe,
|
||||
int framenum)
|
||||
{
|
||||
}
|
||||
|
|
|
@ -205,7 +205,7 @@ gl_R_ReadPointFile_f (void)
|
|||
vec3_t org;
|
||||
QFile *f;
|
||||
|
||||
mapname = strdup (r_worldentity.model->name);
|
||||
mapname = strdup (r_worldentity.model->path);
|
||||
if (!mapname)
|
||||
Sys_Error ("Can't duplicate mapname!");
|
||||
QFS_StripExtension (mapname, mapname);
|
||||
|
|
|
@ -585,7 +585,7 @@ gl_overbright_f (cvar_t *var)
|
|||
|
||||
if (m->type != mod_brush)
|
||||
continue;
|
||||
if (m->name[0] == '*')
|
||||
if (m->path[0] == '*')
|
||||
continue;
|
||||
|
||||
for (j = 0, fa = m->surfaces; j < m->numsurfaces; j++, fa++) {
|
||||
|
@ -732,7 +732,7 @@ GL_BuildLightmaps (model_t **models, int num_models)
|
|||
m = models[j];
|
||||
if (!m)
|
||||
break;
|
||||
if (m->name[0] == '*') {
|
||||
if (m->path[0] == '*') {
|
||||
// sub model surfaces are processed as part of the main model
|
||||
continue;
|
||||
}
|
||||
|
|
|
@ -226,7 +226,7 @@ gl_R_NewMap (model_t *worldmodel, struct model_s **models, int num_models)
|
|||
for (i = 0; i < num_models; i++) {
|
||||
if (!models[i])
|
||||
continue;
|
||||
if (*models[i]->name == '*')
|
||||
if (*models[i]->path == '*')
|
||||
continue;
|
||||
if (models[i] != r_worldentity.model && models[i]->type == mod_brush)
|
||||
register_textures (models[i]);
|
||||
|
|
|
@ -436,7 +436,7 @@ glsl_R_RegisterTextures (model_t **models, int num_models)
|
|||
if (!m)
|
||||
continue;
|
||||
// sub-models are done as part of the main model
|
||||
if (*m->name == '*')
|
||||
if (*m->path == '*')
|
||||
continue;
|
||||
// world has already been done, not interested in non-brush models
|
||||
if (m == r_worldentity.model || m->type != mod_brush)
|
||||
|
@ -561,7 +561,7 @@ glsl_R_BuildDisplayLists (model_t **models, int num_models)
|
|||
if (!m)
|
||||
continue;
|
||||
// sub-models are done as part of the main model
|
||||
if (*m->name == '*')
|
||||
if (*m->path == '*')
|
||||
continue;
|
||||
// non-bsp models don't have surfaces.
|
||||
dm = m->submodels;
|
||||
|
|
|
@ -210,7 +210,7 @@ glsl_R_BuildLightmaps (model_t **models, int num_models)
|
|||
m = models[j];
|
||||
if (!m)
|
||||
break;
|
||||
if (m->name[0] == '*') {
|
||||
if (m->path[0] == '*') {
|
||||
// sub model surfaces are processed as part of the main model
|
||||
continue;
|
||||
}
|
||||
|
@ -231,7 +231,7 @@ glsl_R_BuildLightmaps (model_t **models, int num_models)
|
|||
m = models[j];
|
||||
if (!m)
|
||||
break;
|
||||
if (m->name[0] == '*') {
|
||||
if (m->path[0] == '*') {
|
||||
// sub model surfaces are processed as part of the main model
|
||||
continue;
|
||||
}
|
||||
|
|
|
@ -313,7 +313,7 @@ glsl_R_ReadPointFile_f (void)
|
|||
vec3_t org;
|
||||
QFile *f;
|
||||
|
||||
mapname = strdup (r_worldentity.model->name);
|
||||
mapname = strdup (r_worldentity.model->path);
|
||||
if (!mapname)
|
||||
Sys_Error ("Can't duplicate mapname!");
|
||||
QFS_StripExtension (mapname, mapname);
|
||||
|
|
|
@ -106,7 +106,7 @@ R_AliasCheckBBox (void)
|
|||
frame = currententity->frame;
|
||||
// TODO: don't repeat this check when drawing?
|
||||
if ((frame >= pmdl->numframes) || (frame < 0)) {
|
||||
Sys_MaskPrintf (SYS_DEV, "No such frame %d %s\n", frame, pmodel->name);
|
||||
Sys_MaskPrintf (SYS_DEV, "No such frame %d %s\n", frame, pmodel->path);
|
||||
frame = 0;
|
||||
}
|
||||
|
||||
|
|
|
@ -83,7 +83,7 @@ R_ReadPointFile_f (void)
|
|||
const char *name;
|
||||
char *mapname;
|
||||
|
||||
mapname = strdup (r_worldentity.model->name);
|
||||
mapname = strdup (r_worldentity.model->path);
|
||||
if (!mapname)
|
||||
Sys_Error ("Can't duplicate mapname!");
|
||||
QFS_StripExtension (mapname, mapname);
|
||||
|
|
|
@ -109,7 +109,7 @@ sw32_R_AliasCheckBBox (void)
|
|||
frame = currententity->frame;
|
||||
// TODO: don't repeat this check when drawing?
|
||||
if ((frame >= pmdl->numframes) || (frame < 0)) {
|
||||
Sys_MaskPrintf (SYS_DEV, "No such frame %d %s\n", frame, pmodel->name);
|
||||
Sys_MaskPrintf (SYS_DEV, "No such frame %d %s\n", frame, pmodel->path);
|
||||
frame = 0;
|
||||
}
|
||||
|
||||
|
|
|
@ -88,7 +88,7 @@ sw32_R_ReadPointFile_f (void)
|
|||
const char *name;
|
||||
char *mapname;
|
||||
|
||||
mapname = strdup (r_worldentity.model->name);
|
||||
mapname = strdup (r_worldentity.model->path);
|
||||
if (!mapname)
|
||||
Sys_Error ("Can't duplicate mapname!");
|
||||
QFS_StripExtension (mapname, mapname);
|
||||
|
|
|
@ -401,35 +401,35 @@ vulkan_r_particles_style_f (struct cvar_s *var)
|
|||
}
|
||||
|
||||
static void
|
||||
vulkan_Mod_LoadLighting (bsp_t *bsp)
|
||||
vulkan_Mod_LoadLighting (model_t *mod, bsp_t *bsp)
|
||||
{
|
||||
Vulkan_Mod_LoadLighting (bsp, vulkan_ctx);
|
||||
Vulkan_Mod_LoadLighting (mod, bsp, vulkan_ctx);
|
||||
}
|
||||
|
||||
static void
|
||||
vulkan_Mod_SubdivideSurface (msurface_t *fa)
|
||||
vulkan_Mod_SubdivideSurface (model_t *mod, msurface_t *fa)
|
||||
{
|
||||
}
|
||||
|
||||
static void
|
||||
vulkan_Mod_ProcessTexture (texture_t *tx)
|
||||
vulkan_Mod_ProcessTexture (model_t *mod, texture_t *tx)
|
||||
{
|
||||
Vulkan_Mod_ProcessTexture (tx, vulkan_ctx);
|
||||
Vulkan_Mod_ProcessTexture (mod, tx, vulkan_ctx);
|
||||
}
|
||||
|
||||
static void
|
||||
vulkan_Mod_MakeAliasModelDisplayLists (model_t *m, aliashdr_t *hdr,
|
||||
vulkan_Mod_MakeAliasModelDisplayLists (model_t *mod, aliashdr_t *hdr,
|
||||
void *_m, int _s, int extra)
|
||||
{
|
||||
Vulkan_Mod_MakeAliasModelDisplayLists (m, hdr, _m, _s, extra, vulkan_ctx);
|
||||
Vulkan_Mod_MakeAliasModelDisplayLists (mod, hdr, _m, _s, extra, vulkan_ctx);
|
||||
}
|
||||
|
||||
static void *
|
||||
vulkan_Mod_LoadSkin (byte *skin, int skinsize, int snum, int gnum,
|
||||
qboolean group, maliasskindesc_t *skindesc)
|
||||
vulkan_Mod_LoadSkin (model_t *mod, byte *skin, int skinsize, int snum,
|
||||
int gnum, qboolean group, maliasskindesc_t *skindesc)
|
||||
{
|
||||
return Vulkan_Mod_LoadSkin (skin, skinsize, snum, gnum, group, skindesc,
|
||||
vulkan_ctx);
|
||||
return Vulkan_Mod_LoadSkin (mod, skin, skinsize, snum, gnum, group,
|
||||
skindesc, vulkan_ctx);
|
||||
}
|
||||
|
||||
static void
|
||||
|
@ -449,7 +449,8 @@ vulkan_Mod_IQMFinish (model_t *mod)
|
|||
}
|
||||
|
||||
static void
|
||||
vulkan_Mod_SpriteLoadTexture (mspriteframe_t *pspriteframe, int framenum)
|
||||
vulkan_Mod_SpriteLoadTexture (model_t *mod, mspriteframe_t *pspriteframe,
|
||||
int framenum)
|
||||
{
|
||||
}
|
||||
|
||||
|
|
|
@ -280,7 +280,7 @@ Vulkan_RegisterTextures (model_t **models, int num_models, vulkan_ctx_t *ctx)
|
|||
if (!m)
|
||||
continue;
|
||||
// sub-models are done as part of the main model
|
||||
if (*m->name == '*')
|
||||
if (*m->path == '*')
|
||||
continue;
|
||||
// world has already been done, not interested in non-brush models
|
||||
if (m == r_worldentity.model || m->type != mod_brush)
|
||||
|
@ -421,7 +421,7 @@ Vulkan_BuildDisplayLists (model_t **models, int num_models, vulkan_ctx_t *ctx)
|
|||
if (!m)
|
||||
continue;
|
||||
// sub-models are done as part of the main model
|
||||
if (*m->name == '*')
|
||||
if (*m->path == '*')
|
||||
continue;
|
||||
// non-bsp models don't have surfaces.
|
||||
dm = m->submodels;
|
||||
|
|
|
@ -228,7 +228,7 @@ Vulkan_BuildLightmaps (model_t **models, int num_models, vulkan_ctx_t *ctx)
|
|||
m = models[j];
|
||||
if (!m)
|
||||
break;
|
||||
if (m->name[0] == '*') {
|
||||
if (m->path[0] == '*') {
|
||||
// sub model surfaces are processed as part of the main model
|
||||
continue;
|
||||
}
|
||||
|
@ -251,7 +251,7 @@ Vulkan_BuildLightmaps (model_t **models, int num_models, vulkan_ctx_t *ctx)
|
|||
if (!m) {
|
||||
break;
|
||||
}
|
||||
if (m->name[0] == '*') {
|
||||
if (m->path[0] == '*') {
|
||||
// sub model surfaces are processed as part of the main model
|
||||
continue;
|
||||
}
|
||||
|
|
|
@ -338,7 +338,7 @@ demo_default_name (const char *argv1)
|
|||
strftime (timestring, 19, "%Y-%m-%d-%H-%M", localtime (&tim));
|
||||
|
||||
// the leading path-name is to be removed from cl.worldmodel->name
|
||||
mapname = QFS_SkipPath (cl.worldmodel->name);
|
||||
mapname = QFS_SkipPath (cl.worldmodel->path);
|
||||
|
||||
// the map name is cut off after any "." because this would prevent
|
||||
// an extension being appended
|
||||
|
|
|
@ -408,7 +408,7 @@ CL_PrintEntities_f (void)
|
|||
continue;
|
||||
}
|
||||
Sys_Printf ("%s:%2i (%5.1f,%5.1f,%5.1f) [%5.1f %5.1f %5.1f]\n",
|
||||
ent->model->name, ent->frame, VectorExpand (ent->origin),
|
||||
ent->model->path, ent->frame, VectorExpand (ent->origin),
|
||||
VectorExpand (ent->angles));
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1198,7 +1198,7 @@ SV_SpawnServer (const char *server)
|
|||
ent = EDICT_NUM (&sv_pr_state, 0);
|
||||
memset (&ent->v, 0, sv_pr_state.progs->entityfields * 4);
|
||||
ent->free = false;
|
||||
SVstring (ent, model) = PR_SetString (&sv_pr_state, sv.worldmodel->name);
|
||||
SVstring (ent, model) = PR_SetString (&sv_pr_state, sv.worldmodel->path);
|
||||
SVfloat (ent, modelindex) = 1; // world model
|
||||
SVfloat (ent, solid) = SOLID_BSP;
|
||||
SVfloat (ent, movetype) = MOVETYPE_PUSH;
|
||||
|
|
|
@ -634,7 +634,7 @@ demo_default_name (const char *argv1)
|
|||
strftime (timestring, 19, "%Y-%m-%d-%H-%M", localtime (&tim));
|
||||
|
||||
// the leading path-name is to be removed from cl.worldmodel->name
|
||||
mapname = QFS_SkipPath (cl.worldmodel->name);
|
||||
mapname = QFS_SkipPath (cl.worldmodel->path);
|
||||
|
||||
// the map name is cut off after any "." because this would prevent
|
||||
// an extension being appended
|
||||
|
|
|
@ -1108,7 +1108,7 @@ Sbar_LogFrags (void)
|
|||
if (t)
|
||||
Qwrite (file, t, strlen (t));
|
||||
|
||||
Qprintf (file, "%s\n%s %s\n", cls.servername->str, cl.worldmodel->name,
|
||||
Qprintf (file, "%s\n%s %s\n", cls.servername->str, cl.worldmodel->path,
|
||||
cl.levelname);
|
||||
|
||||
// scores
|
||||
|
|
|
@ -420,7 +420,7 @@ SV_SpawnServer (const char *server)
|
|||
|
||||
ent = EDICT_NUM (&sv_pr_state, 0);
|
||||
ent->free = false;
|
||||
SVstring (ent, model) = PR_SetString (&sv_pr_state, sv.worldmodel->name);
|
||||
SVstring (ent, model) = PR_SetString (&sv_pr_state, sv.worldmodel->path);
|
||||
SVfloat (ent, modelindex) = 1; // world model
|
||||
SVfloat (ent, solid) = SOLID_BSP;
|
||||
SVfloat (ent, movetype) = MOVETYPE_PUSH;
|
||||
|
|
|
@ -288,8 +288,8 @@ Team_NewMap (void)
|
|||
|
||||
died = false;
|
||||
recorded_location = false;
|
||||
mapname = strdup (cl.worldmodel->name);
|
||||
t2 = malloc (sizeof (cl.worldmodel->name));
|
||||
mapname = strdup (cl.worldmodel->path);
|
||||
t2 = malloc (sizeof (cl.worldmodel->path));
|
||||
if (!mapname || !t2)
|
||||
Sys_Error ("Can't duplicate mapname!");
|
||||
map_to_loc (mapname,t2);
|
||||
|
@ -345,10 +345,10 @@ locs_loc (void)
|
|||
}
|
||||
if (Cmd_Argc () >= 3)
|
||||
desc = Cmd_Args (2);
|
||||
mapname = malloc (sizeof (cl.worldmodel->name));
|
||||
mapname = malloc (sizeof (cl.worldmodel->path));
|
||||
if (!mapname)
|
||||
Sys_Error ("Can't duplicate mapname!");
|
||||
map_to_loc (cl.worldmodel->name, mapname);
|
||||
map_to_loc (cl.worldmodel->path, mapname);
|
||||
snprintf (locfile, sizeof (locfile), "%s/%s",
|
||||
qfs_gamedir->dir.def, mapname);
|
||||
free (mapname);
|
||||
|
|
Loading…
Reference in a new issue