mirror of
https://git.code.sf.net/p/quake/quakeforge
synced 2024-11-22 20:41:20 +00:00
turns out the sprite models are /not/ relocatable, so back out that change
in favor of cleaning up the accessors
This commit is contained in:
parent
896d304ac9
commit
ea614fc2c6
5 changed files with 17 additions and 21 deletions
|
@ -49,7 +49,7 @@
|
|||
#include "QF/vfs.h"
|
||||
|
||||
void Mod_LoadAliasModel (model_t *mod, void *buf, cache_allocator_t allocator);
|
||||
void Mod_LoadSpriteModel (model_t *mod, void *buf, cache_allocator_t allocator);
|
||||
void Mod_LoadSpriteModel (model_t *mod, void *buf);
|
||||
void Mod_LoadBrushModel (model_t *mod, void *buf);
|
||||
model_t *Mod_RealLoadModel (model_t *mod, qboolean crash, cache_allocator_t allocator);
|
||||
void Mod_CallbackLoad (void *object, cache_allocator_t allocator);
|
||||
|
@ -160,14 +160,12 @@ model_t *
|
|||
Mod_LoadModel (model_t *mod, qboolean crash)
|
||||
{
|
||||
if (!mod->needload) {
|
||||
if (mod->type == mod_alias || mod->type == mod_sprite) {
|
||||
if (mod->type == mod_alias) {
|
||||
if (Cache_Check (&mod->cache))
|
||||
return mod;
|
||||
} else
|
||||
return mod; // not cached at all
|
||||
}
|
||||
if (Cache_Check (&mod->cache))
|
||||
Cache_Free (&mod->cache);
|
||||
return Mod_RealLoadModel (mod, crash, Cache_Alloc);
|
||||
}
|
||||
|
||||
|
@ -203,7 +201,7 @@ Mod_RealLoadModel (model_t *mod, qboolean crash, cache_allocator_t allocator)
|
|||
break;
|
||||
|
||||
case IDSPRITEHEADER:
|
||||
Mod_LoadSpriteModel (mod, buf, allocator);
|
||||
Mod_LoadSpriteModel (mod, buf);
|
||||
break;
|
||||
|
||||
default:
|
||||
|
@ -222,8 +220,8 @@ Mod_RealLoadModel (model_t *mod, qboolean crash, cache_allocator_t allocator)
|
|||
void
|
||||
Mod_CallbackLoad (void *object, cache_allocator_t allocator)
|
||||
{
|
||||
if (((model_t *)object)->type == mod_brush)
|
||||
Sys_Error ("Mod_CallbackLoad for mod_brush not yet supported. FIXME!\n");
|
||||
if (((model_t *)object)->type != mod_alias)
|
||||
Sys_Error ("Mod_CallbackLoad for non-alias model? FIXME!\n");
|
||||
// FIXME: do we want crash set to true?
|
||||
Mod_RealLoadModel (object, true, allocator);
|
||||
}
|
||||
|
@ -265,6 +263,6 @@ Mod_Print (void)
|
|||
|
||||
Con_Printf ("Cached models:\n");
|
||||
for (i = 0, mod = mod_known; i < mod_numknown; i++, mod++) {
|
||||
Con_Printf ("%8p : %s\n", Cache_Check (&mod->cache), mod->name);
|
||||
Con_Printf ("%8p : %s\n", mod->cache.data, mod->name);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -90,7 +90,7 @@ Mod_LoadSpriteGroup (void *pin, mspriteframe_t **ppframe, int framenum)
|
|||
}
|
||||
|
||||
void
|
||||
Mod_LoadSpriteModel (model_t *mod, void *buffer, cache_allocator_t allocator)
|
||||
Mod_LoadSpriteModel (model_t *mod, void *buffer)
|
||||
{
|
||||
int i;
|
||||
int version;
|
||||
|
@ -111,7 +111,9 @@ Mod_LoadSpriteModel (model_t *mod, void *buffer, cache_allocator_t allocator)
|
|||
|
||||
size = field_offset (msprite_t, frames[numframes]);
|
||||
|
||||
psprite = allocator (&mod->cache, size, loadname);
|
||||
psprite = Hunk_AllocName (size, loadname);
|
||||
|
||||
mod->cache.data = psprite;
|
||||
|
||||
psprite->type = LittleLong (pin->type);
|
||||
psprite->maxwidth = LittleLong (pin->width);
|
||||
|
|
|
@ -133,13 +133,15 @@ R_RotateForEntity (entity_t *e)
|
|||
}
|
||||
|
||||
static mspriteframe_t *
|
||||
R_GetSpriteFrame (entity_t *currententity, msprite_t *psprite)
|
||||
R_GetSpriteFrame (entity_t *currententity)
|
||||
{
|
||||
msprite_t *psprite;
|
||||
mspritegroup_t *pspritegroup;
|
||||
mspriteframe_t *pspriteframe;
|
||||
int i, numframes, frame;
|
||||
float *pintervals, fullinterval, targettime, time;
|
||||
|
||||
psprite = currententity->model->cache.data;
|
||||
frame = currententity->frame;
|
||||
|
||||
if ((frame >= psprite->numframes) || (frame < 0)) {
|
||||
|
@ -184,8 +186,8 @@ R_DrawSpriteModel (entity_t *e)
|
|||
|
||||
// don't even bother culling, because it's just a single
|
||||
// polygon without a surface cache
|
||||
psprite = Cache_Get (¤tentity->model->cache);
|
||||
frame = R_GetSpriteFrame (e, psprite);
|
||||
frame = R_GetSpriteFrame (e);
|
||||
psprite = currententity->model->cache.data;
|
||||
|
||||
if (psprite->type == SPR_ORIENTED) { // bullet marks on walls
|
||||
AngleVectors (currententity->angles, v_forward, v_right, v_up);
|
||||
|
@ -224,8 +226,6 @@ R_DrawSpriteModel (entity_t *e)
|
|||
qfglEnd ();
|
||||
|
||||
qfglDisable (GL_ALPHA_TEST);
|
||||
|
||||
Cache_Release (¤tentity->model->cache);
|
||||
}
|
||||
|
||||
/*
|
||||
|
|
|
@ -282,7 +282,7 @@ R_DrawSprite (void)
|
|||
vec3_t tvec;
|
||||
float dot, angle, sr, cr;
|
||||
|
||||
psprite = Cache_Get (¤tentity->model->cache);
|
||||
psprite = currententity->model->cache.data;
|
||||
|
||||
r_spritedesc.pspriteframe = R_GetSpriteframe (psprite);
|
||||
|
||||
|
@ -378,6 +378,4 @@ R_DrawSprite (void)
|
|||
R_RotateSprite (psprite->beamlength);
|
||||
|
||||
R_SetupAndDrawSprite ();
|
||||
|
||||
Cache_Release (¤tentity->model->cache);
|
||||
}
|
||||
|
|
|
@ -282,7 +282,7 @@ R_DrawSprite (void)
|
|||
vec3_t tvec;
|
||||
float dot, angle, sr, cr;
|
||||
|
||||
psprite = Cache_Get (¤tentity->model->cache);
|
||||
psprite = currententity->model->cache.data;
|
||||
|
||||
r_spritedesc.pspriteframe = R_GetSpriteframe (psprite);
|
||||
|
||||
|
@ -378,6 +378,4 @@ R_DrawSprite (void)
|
|||
R_RotateSprite (psprite->beamlength);
|
||||
|
||||
R_SetupAndDrawSprite ();
|
||||
|
||||
Cache_Release (¤tentity->model->cache);
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue