New def token for "cutscene": "aspect"

Overrides the aspect ratio for IVF files.

cutscene <path> { aspect <numerator> <denominator> }

Note: For ANMs, you can use rotatesprite and setaspect to draw TILE_ANIM (currently defined as 30716) in EVENT_CUTSCENE with a custom aspect.

Patch from Fox.

git-svn-id: https://svn.eduke32.com/eduke32@6551 1a8010ca-5511-0410-912e-c29ae57300e0
This commit is contained in:
hendricks266 2017-12-12 05:13:32 +00:00
parent 415c5e219e
commit 45a8742e42
5 changed files with 30 additions and 3 deletions

View file

@ -85,7 +85,7 @@ int32_t animvpx_nextpic(animvpx_codec_ctx *codec, uint8_t **pic);
void animvpx_setup_glstate(void); void animvpx_setup_glstate(void);
void animvpx_restore_glstate(void); void animvpx_restore_glstate(void);
int32_t animvpx_render_frame(animvpx_codec_ctx *codec); int32_t animvpx_render_frame(animvpx_codec_ctx *codec, double animvpx_aspect);
void animvpx_print_stats(const animvpx_codec_ctx *codec); void animvpx_print_stats(const animvpx_codec_ctx *codec);
#endif #endif

View file

@ -491,7 +491,7 @@ void animvpx_restore_glstate(void)
texuploaded = 0; texuploaded = 0;
} }
int32_t animvpx_render_frame(animvpx_codec_ctx *codec) int32_t animvpx_render_frame(animvpx_codec_ctx *codec, double animvpx_aspect)
{ {
int32_t t = getticks(); int32_t t = getticks();
@ -518,6 +518,8 @@ int32_t animvpx_render_frame(animvpx_codec_ctx *codec)
} }
float vid_wbyh = ((float)codec->width)/codec->height; float vid_wbyh = ((float)codec->width)/codec->height;
if (animvpx_aspect > 0)
vid_wbyh = animvpx_aspect;
float scr_wbyh = ((float)xdim)/ydim; float scr_wbyh = ((float)xdim)/ydim;
float x=1.0, y=1.0; float x=1.0, y=1.0;

View file

@ -329,7 +329,20 @@ int32_t Anim_Play(const char *fn)
ototalclock = totalclock + 1; // pause game like ANMs ototalclock = totalclock + 1; // pause game like ANMs
animvpx_render_frame(&codec); if (anim)
{
if (anim->frameaspect1 == 0 || anim->frameaspect2 == 0)
animvpx_render_frame(&codec, 0);
else
animvpx_render_frame(&codec, anim->frameaspect1 / anim->frameaspect2);
}
else
{
if (origanim->frameaspect1 == 0 || origanim->frameaspect2 == 0)
animvpx_render_frame(&codec, 0);
else
animvpx_render_frame(&codec, origanim->frameaspect1 / origanim->frameaspect2);
}
VM_OnEventWithReturn(EVENT_CUTSCENE, g_player[screenpeek].ps->i, screenpeek, framenum); VM_OnEventWithReturn(EVENT_CUTSCENE, g_player[screenpeek].ps->i, screenpeek, framenum);

View file

@ -30,6 +30,7 @@ typedef struct {
typedef struct typedef struct
{ {
double frameaspect1, frameaspect2;
uint8_t* animbuf; uint8_t* animbuf;
animsound_t *sounds; animsound_t *sounds;
uint16_t numsounds; uint16_t numsounds;

View file

@ -172,6 +172,7 @@ enum gametokens
T_DELAY, T_DELAY,
T_RENAMEFILE, T_RENAMEFILE,
T_GLOBALGAMEFLAGS, T_GLOBALGAMEFLAGS,
T_ASPECT,
}; };
void G_HandleSpecialKeys(void) void G_HandleSpecialKeys(void)
@ -5191,6 +5192,7 @@ static int parsedefinitions_game(scriptfile *pScript, int firstPass)
static const tokenlist animTokens [] = static const tokenlist animTokens [] =
{ {
{ "delay", T_DELAY }, { "delay", T_DELAY },
{ "aspect", T_ASPECT },
{ "sounds", T_SOUND }, { "sounds", T_SOUND },
}; };
@ -5318,6 +5320,15 @@ static int parsedefinitions_game(scriptfile *pScript, int firstPass)
scriptfile_getnumber(pScript, &temp); scriptfile_getnumber(pScript, &temp);
animPtr->framedelay = temp; animPtr->framedelay = temp;
break; break;
case T_ASPECT:
{
double dtemp, dtemp2;
scriptfile_getdouble(pScript, &dtemp);
scriptfile_getdouble(pScript, &dtemp2);
animPtr->frameaspect1 = dtemp;
animPtr->frameaspect2 = dtemp2;
break;
}
case T_SOUND: case T_SOUND:
{ {
char *animSoundsEnd = NULL; char *animSoundsEnd = NULL;