Try to make things a little more stable.
git-svn-id: https://svn.code.sf.net/p/fteqw/code/trunk@5983 fc73d0e0-1445-4013-8a0c-d673dee63da5
This commit is contained in:
parent
2599af212a
commit
90aae69db3
9 changed files with 89 additions and 23 deletions
|
@ -11335,7 +11335,28 @@ void Image_BlockSizeForEncoding(uploadfmt_t encoding, unsigned int *blockbytes,
|
|||
case PTI_ASTC_6X6X6_LDR: w = 6; h = 6; d = 6; b = 16; break;
|
||||
#endif
|
||||
|
||||
case PTI_EMULATED:
|
||||
case TF_BGR24_FLIP:
|
||||
case TF_SOLID8:
|
||||
case TF_TRANS8:
|
||||
case TF_TRANS8_FULLBRIGHT:
|
||||
case TF_HEIGHT8:
|
||||
case TF_HEIGHT8PAL:
|
||||
case TF_H2_T7G1:
|
||||
case TF_H2_TRANS8_0:
|
||||
case TF_H2_T4A4:
|
||||
b=1;
|
||||
break;
|
||||
case PTI_LLLX8:
|
||||
case PTI_LLLA8:
|
||||
b=4;
|
||||
break;
|
||||
case TF_8PAL24:
|
||||
case TF_8PAL32:
|
||||
case TF_INVALID:
|
||||
case TF_MIP4_P8:
|
||||
case TF_MIP4_SOLID8:
|
||||
case TF_MIP4_8PAL24:
|
||||
case TF_MIP4_8PAL24_T255:
|
||||
#ifdef FTE_TARGET_WEB
|
||||
case PTI_WHOLEFILE: //UNKNOWN!
|
||||
#endif
|
||||
|
@ -14622,8 +14643,6 @@ void Image_DestroyTexture(image_t *tex)
|
|||
Z_Free(tex);
|
||||
}
|
||||
|
||||
|
||||
void Shader_TouchTextures(void);
|
||||
void Image_Purge(void)
|
||||
{
|
||||
image_t *tex;
|
||||
|
|
|
@ -1807,8 +1807,28 @@ static void *QDECL PlugBI_GetEngineInterface(const char *interfacename, size_t s
|
|||
Plug_Cmd_AddCommand,
|
||||
Plug_Cmd_AddText,
|
||||
};
|
||||
|
||||
static struct
|
||||
{
|
||||
qboolean (QDECL*AddCommand) (const char *cmdname);
|
||||
void (QDECL*TokenizeString) (const char *msg);
|
||||
void (QDECL*Args) (char *buffer, int bufsize);
|
||||
void (QDECL*Argv) (int argnum, char *buffer, size_t bufsize);
|
||||
int (QDECL*Argc) (void);
|
||||
void (QDECL*AddText) (const char *text, qboolean insert);
|
||||
} oldfuncs =
|
||||
{
|
||||
Plug_Cmd_AddCommand,
|
||||
Plug_Cmd_TokenizeString,
|
||||
Plug_Cmd_Args,
|
||||
Plug_Cmd_Argv,
|
||||
Plug_Cmd_Argc,
|
||||
Plug_Cmd_AddText,
|
||||
};
|
||||
if (structsize == sizeof(funcs))
|
||||
return &funcs;
|
||||
if (structsize == sizeof(oldfuncs))
|
||||
return &oldfuncs;
|
||||
}
|
||||
if (!strcmp(interfacename, plugcvarfuncs_name))
|
||||
{
|
||||
|
|
|
@ -2954,7 +2954,7 @@ void BE_GenModelBatches(batch_t **batches, const dlight_t *dl, unsigned int bemo
|
|||
continue;
|
||||
}
|
||||
|
||||
switch(emodel->type)
|
||||
safeswitch(emodel->type)
|
||||
{
|
||||
case mod_brush:
|
||||
if (r_drawentities.ival == 2 && cls.allow_cheats) //2 is considered a cheat, because it can be used as a wallhack (whereas mdls are not normally considered as occluding).
|
||||
|
@ -2981,6 +2981,8 @@ void BE_GenModelBatches(batch_t **batches, const dlight_t *dl, unsigned int bemo
|
|||
Terr_DrawTerrainModel(batches, ent);
|
||||
#endif
|
||||
break;
|
||||
safedefault:
|
||||
break;
|
||||
}
|
||||
break;
|
||||
case RT_SPRITE:
|
||||
|
|
|
@ -1515,6 +1515,13 @@ static void R_HL_BuildMeshes(batch_t *b)
|
|||
}
|
||||
qboolean R_CalcModelLighting(entity_t *e, model_t *clmodel);
|
||||
|
||||
void R_HalfLife_TouchTextures(model_t *mod)
|
||||
{
|
||||
hlmodel_t *model = Mod_Extradata(mod);
|
||||
unsigned int t;
|
||||
for (t = 0; t < model->header->numtextures; t++)
|
||||
Shader_TouchTexnums(&model->shaders[t].defaulttex);
|
||||
}
|
||||
void R_HalfLife_GenerateBatches(entity_t *rent, batch_t **batches)
|
||||
{
|
||||
hlmodel_t *model = Mod_Extradata(rent->model);
|
||||
|
|
|
@ -592,6 +592,10 @@ void Mod_Purge(enum mod_purge_e ptype)
|
|||
Con_DLPrintf(2, "model \"%s\" no longer needed\n", mod->name);
|
||||
Mod_PurgeModel(mod, (ptype==MP_FLUSH && unused)?MP_RESET:ptype);
|
||||
}
|
||||
#if defined(HALFLIFEMODELS) && defined(HAVE_CLIENT)
|
||||
else if (mod->fromgame == fg_halflife)
|
||||
R_HalfLife_TouchTextures(mod);
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -7940,12 +7940,36 @@ void Shader_ShowShader_f(void)
|
|||
Con_Printf("Shader \"%s\" is not loaded\n", sourcename);
|
||||
}
|
||||
|
||||
void Shader_TouchTexnums(texnums_t *t)
|
||||
{
|
||||
if (t->base)
|
||||
t->base->regsequence = r_regsequence;
|
||||
if (t->bump)
|
||||
t->bump->regsequence = r_regsequence;
|
||||
if (t->specular)
|
||||
t->specular->regsequence = r_regsequence;
|
||||
if (t->upperoverlay)
|
||||
t->upperoverlay->regsequence = r_regsequence;
|
||||
if (t->loweroverlay)
|
||||
t->loweroverlay->regsequence = r_regsequence;
|
||||
if (t->paletted)
|
||||
t->paletted->regsequence = r_regsequence;
|
||||
if (t->fullbright)
|
||||
t->fullbright->regsequence = r_regsequence;
|
||||
if (t->reflectcube)
|
||||
t->reflectcube->regsequence = r_regsequence;
|
||||
if (t->reflectmask)
|
||||
t->reflectmask->regsequence = r_regsequence;
|
||||
if (t->displacement)
|
||||
t->displacement->regsequence = r_regsequence;
|
||||
if (t->occlusion)
|
||||
t->occlusion->regsequence = r_regsequence;
|
||||
}
|
||||
void Shader_TouchTextures(void)
|
||||
{
|
||||
int i, j, k;
|
||||
shader_t *s;
|
||||
shaderpass_t *p;
|
||||
texnums_t *t;
|
||||
for (i = 0; i < r_numshaders; i++)
|
||||
{
|
||||
s = r_shaders[i];
|
||||
|
@ -7960,23 +7984,7 @@ void Shader_TouchTextures(void)
|
|||
p->anim_frames[k]->regsequence = r_regsequence;
|
||||
}
|
||||
for (j = 0; j < max(1,s->numdefaulttextures); j++)
|
||||
{
|
||||
t = &s->defaulttextures[j];
|
||||
if (t->base)
|
||||
t->base->regsequence = r_regsequence;
|
||||
if (t->paletted)
|
||||
t->paletted->regsequence = r_regsequence;
|
||||
if (t->bump)
|
||||
t->bump->regsequence = r_regsequence;
|
||||
if (t->fullbright)
|
||||
t->fullbright->regsequence = r_regsequence;
|
||||
if (t->specular)
|
||||
t->specular->regsequence = r_regsequence;
|
||||
if (t->upperoverlay)
|
||||
t->upperoverlay->regsequence = r_regsequence;
|
||||
if (t->loweroverlay)
|
||||
t->loweroverlay->regsequence = r_regsequence;
|
||||
}
|
||||
Shader_TouchTexnums(&s->defaulttextures[j]);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -339,9 +339,10 @@ const char *HLMDL_GetBoneName(model_t *mod, int bonenum);
|
|||
int HLMDL_GetBoneData(model_t *model, int firstbone, int lastbone, const framestate_t *fstate, float *result);
|
||||
int HLMDL_GetAttachment(model_t *model, int tagnum, float *resultmatrix);
|
||||
|
||||
#ifndef SERVERONLY
|
||||
#ifdef HAVE_CLIENT
|
||||
//stuff only useful for clients that need to draw stuff
|
||||
void R_DrawHLModel(entity_t *curent);
|
||||
void HLMDL_DrawHitBoxes(entity_t *ent);
|
||||
void R_HalfLife_GenerateBatches(entity_t *rent, batch_t **batches);
|
||||
void R_HalfLife_TouchTextures(model_t *mod);
|
||||
#endif
|
||||
|
|
|
@ -731,6 +731,9 @@ void QDECL R_BuildDefaultTexnums(texnums_t *tn, shader_t *shader, unsigned int i
|
|||
void QDECL R_BuildLegacyTexnums(shader_t *shader, const char *fallbackname, const char *subpath, unsigned int loadflags, unsigned int imageflags, uploadfmt_t basefmt, size_t width, size_t height, qbyte *mipdata, qbyte *palette);
|
||||
void R_RemapShader(const char *sourcename, const char *destname, float timeoffset);
|
||||
|
||||
void Shader_TouchTexnums(texnums_t *t);
|
||||
void Shader_TouchTextures(void);
|
||||
|
||||
cin_t *R_ShaderGetCinematic(shader_t *s);
|
||||
cin_t *R_ShaderFindCinematic(const char *name);
|
||||
shader_t *R_ShaderFind(const char *name); //does NOT increase the shader refcount.
|
||||
|
|
|
@ -234,6 +234,8 @@ qboolean NATIVEEXPORT FTEPlug_Init(plugcorefuncs_t *corefuncs)
|
|||
plugfuncs = corefuncs;
|
||||
cmdfuncs = (plugcmdfuncs_t*)plugfuncs->GetEngineInterface(plugcmdfuncs_name, sizeof(*cmdfuncs));
|
||||
cvarfuncs = (plugcvarfuncs_t*)plugfuncs->GetEngineInterface(plugcvarfuncs_name, sizeof(*cvarfuncs));
|
||||
if (!plugfuncs || !cmdfuncs || !cvarfuncs)
|
||||
return false; //erk
|
||||
|
||||
return Plug_Init();
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue