New def tokens for "cutscene": "texturefilter", "forcefilter", "forcenofilter"

Changes the filtering for cutscenes. By default, ANMs are unfiltered and IVFs filtered regardless of the filtering option in the menu. Use “texturefilter” to use the same filtering as textures, “forcenofilter” to never use filtering and “forcefilter” to always use filtering.

cutscene <path> { texturefilter }

Patch from Fox.

git-svn-id: https://svn.eduke32.com/eduke32@6552 1a8010ca-5511-0410-912e-c29ae57300e0
This commit is contained in:
hendricks266 2017-12-12 05:13:38 +00:00
parent 45a8742e42
commit 084c661fa0
6 changed files with 46 additions and 6 deletions

View file

@ -83,7 +83,7 @@ int32_t animvpx_uninit_codec(animvpx_codec_ctx *codec);
extern const char *animvpx_nextpic_errmsg[8];
int32_t animvpx_nextpic(animvpx_codec_ctx *codec, uint8_t **pic);
void animvpx_setup_glstate(void);
void animvpx_setup_glstate(int32_t animvpx_flags);
void animvpx_restore_glstate(void);
int32_t animvpx_render_frame(animvpx_codec_ctx *codec, double animvpx_aspect);

View file

@ -1291,6 +1291,12 @@ enum {
TEXFILTER_ON = 5, // GL_LINEAR_MIPMAP_LINEAR
};
enum cutsceneflags {
CUTSCENE_FORCEFILTER = 1,
CUTSCENE_FORCENOFILTER = 2,
CUTSCENE_TEXTUREFILTER = 4,
};
extern int32_t glusetexcache, glusememcache;
extern int32_t glmultisample, glnvmultisamplehint;
extern int32_t glprojectionhacks;

View file

@ -400,7 +400,7 @@ static const char *fragprog_src =
"}\n";
#endif
void animvpx_setup_glstate(void)
void animvpx_setup_glstate(int32_t animvpx_flags)
{
#ifdef USE_GLEXT
if (glinfo.glsl)
@ -467,8 +467,17 @@ void animvpx_setup_glstate(void)
bglTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, glinfo.clamptoedge?GL_CLAMP_TO_EDGE:GL_CLAMP);
bglTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, glinfo.clamptoedge?GL_CLAMP_TO_EDGE:GL_CLAMP);
bglTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
bglTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR);
if ((animvpx_flags & CUTSCENE_TEXTUREFILTER && gltexfiltermode == TEXFILTER_ON) || animvpx_flags & CUTSCENE_FORCEFILTER ||
(!(animvpx_flags & CUTSCENE_TEXTUREFILTER) && !(animvpx_flags & CUTSCENE_FORCENOFILTER))) // if no flags, then use filter for IVFs
{
bglTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
bglTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR);
}
else
{
bglTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST);
bglTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST);
}
texuploaded = 0;
////////////////////

View file

@ -216,6 +216,8 @@ void Anim_Init(void)
}
anim->numsounds = numsounds;
}
anim->frameflags = 0;
}
}
@ -282,7 +284,10 @@ int32_t Anim_Play(const char *fn)
return 0;
}
animvpx_setup_glstate();
if (anim)
animvpx_setup_glstate(anim->frameflags);
else
animvpx_setup_glstate(origanim->frameflags);
animvpx_codec_ctx codec;
@ -463,7 +468,10 @@ int32_t Anim_Play(const char *fn)
P_SetGamePalette(g_player[myconnectindex].ps, ANIMPAL, 8 + 2);
#ifdef USE_OPENGL
gltexfiltermode = 0;
if ((anim->frameflags & CUTSCENE_TEXTUREFILTER && gltexfiltermode == TEXFILTER_ON) || anim->frameflags & CUTSCENE_FORCEFILTER)
gltexfiltermode = TEXFILTER_ON;
else
gltexfiltermode = TEXFILTER_OFF;
gltexapplyprops();
#endif

View file

@ -35,6 +35,7 @@ typedef struct
animsound_t *sounds;
uint16_t numsounds;
uint8_t framedelay;
uint8_t frameflags;
char animlock;
} dukeanim_t;

View file

@ -173,6 +173,9 @@ enum gametokens
T_RENAMEFILE,
T_GLOBALGAMEFLAGS,
T_ASPECT,
T_FORCEFILTER,
T_FORCENOFILTER,
T_TEXTUREFILTER,
};
void G_HandleSpecialKeys(void)
@ -5194,6 +5197,9 @@ static int parsedefinitions_game(scriptfile *pScript, int firstPass)
{ "delay", T_DELAY },
{ "aspect", T_ASPECT },
{ "sounds", T_SOUND },
{ "forcefilter", T_FORCEFILTER },
{ "forcenofilter", T_FORCENOFILTER },
{ "texturefilter", T_TEXTUREFILTER },
};
do
@ -5308,6 +5314,7 @@ static int parsedefinitions_game(scriptfile *pScript, int firstPass)
{
animPtr = Anim_Create(fileName);
animPtr->framedelay = 10;
animPtr->frameflags = 0;
}
int32_t temp;
@ -5337,6 +5344,15 @@ static int parsedefinitions_game(scriptfile *pScript, int firstPass)
parsedefinitions_game_animsounds(pScript, animSoundsEnd, fileName, animPtr);
break;
}
case T_FORCEFILTER:
animPtr->frameflags |= CUTSCENE_FORCEFILTER;
break;
case T_FORCENOFILTER:
animPtr->frameflags |= CUTSCENE_FORCENOFILTER;
break;
case T_TEXTUREFILTER:
animPtr->frameflags |= CUTSCENE_TEXTUREFILTER;
break;
}
}
}