mirror of
https://github.com/DrBeef/ioq3quest.git
synced 2024-11-13 07:57:23 +00:00
Support non-256x256 videos in shaders, by Zack Middleton (#4745)
This commit is contained in:
parent
8bb9a261bd
commit
6516be2fed
1 changed files with 84 additions and 48 deletions
|
@ -1510,29 +1510,16 @@ void CIN_SetLooping(int handle, qboolean loop) {
|
||||||
|
|
||||||
/*
|
/*
|
||||||
==================
|
==================
|
||||||
SCR_DrawCinematic
|
CIN_ResampleCinematic
|
||||||
|
|
||||||
|
Resample cinematic to 256x256 and store in buf2
|
||||||
==================
|
==================
|
||||||
*/
|
*/
|
||||||
void CIN_DrawCinematic (int handle) {
|
void CIN_ResampleCinematic(int handle, int *buf2) {
|
||||||
float x, y, w, h;
|
int ix, iy, *buf3, xm, ym, ll;
|
||||||
byte *buf;
|
byte *buf;
|
||||||
|
|
||||||
if (handle < 0 || handle>= MAX_VIDEO_HANDLES || cinTable[handle].status == FMV_EOF) return;
|
|
||||||
|
|
||||||
if (!cinTable[handle].buf) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
x = cinTable[handle].xpos;
|
|
||||||
y = cinTable[handle].ypos;
|
|
||||||
w = cinTable[handle].width;
|
|
||||||
h = cinTable[handle].height;
|
|
||||||
buf = cinTable[handle].buf;
|
buf = cinTable[handle].buf;
|
||||||
SCR_AdjustFrom640( &x, &y, &w, &h );
|
|
||||||
|
|
||||||
if (cinTable[handle].dirty && (cinTable[handle].CIN_WIDTH != cinTable[handle].drawX || cinTable[handle].CIN_HEIGHT != cinTable[handle].drawY)) {
|
|
||||||
int ix, iy, *buf2, *buf3, xm, ym, ll;
|
|
||||||
|
|
||||||
xm = cinTable[handle].CIN_WIDTH/256;
|
xm = cinTable[handle].CIN_WIDTH/256;
|
||||||
ym = cinTable[handle].CIN_HEIGHT/256;
|
ym = cinTable[handle].CIN_HEIGHT/256;
|
||||||
|
@ -1542,7 +1529,6 @@ void CIN_DrawCinematic (int handle) {
|
||||||
}
|
}
|
||||||
|
|
||||||
buf3 = (int*)buf;
|
buf3 = (int*)buf;
|
||||||
buf2 = Hunk_AllocateTempMemory( 256*256*4 );
|
|
||||||
if (xm==2 && ym==2) {
|
if (xm==2 && ym==2) {
|
||||||
byte *bc2, *bc3;
|
byte *bc2, *bc3;
|
||||||
int ic, iiy;
|
int ic, iiy;
|
||||||
|
@ -1580,6 +1566,38 @@ void CIN_DrawCinematic (int handle) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
==================
|
||||||
|
SCR_DrawCinematic
|
||||||
|
|
||||||
|
==================
|
||||||
|
*/
|
||||||
|
void CIN_DrawCinematic (int handle) {
|
||||||
|
float x, y, w, h;
|
||||||
|
byte *buf;
|
||||||
|
|
||||||
|
if (handle < 0 || handle>= MAX_VIDEO_HANDLES || cinTable[handle].status == FMV_EOF) return;
|
||||||
|
|
||||||
|
if (!cinTable[handle].buf) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
x = cinTable[handle].xpos;
|
||||||
|
y = cinTable[handle].ypos;
|
||||||
|
w = cinTable[handle].width;
|
||||||
|
h = cinTable[handle].height;
|
||||||
|
buf = cinTable[handle].buf;
|
||||||
|
SCR_AdjustFrom640( &x, &y, &w, &h );
|
||||||
|
|
||||||
|
if (cinTable[handle].dirty && (cinTable[handle].CIN_WIDTH != cinTable[handle].drawX || cinTable[handle].CIN_HEIGHT != cinTable[handle].drawY)) {
|
||||||
|
int *buf2;
|
||||||
|
|
||||||
|
buf2 = Hunk_AllocateTempMemory( 256*256*4 );
|
||||||
|
|
||||||
|
CIN_ResampleCinematic(handle, buf2);
|
||||||
|
|
||||||
re.DrawStretchRaw( x, y, w, h, 256, 256, (byte *)buf2, handle, qtrue);
|
re.DrawStretchRaw( x, y, w, h, 256, 256, (byte *)buf2, handle, qtrue);
|
||||||
cinTable[handle].dirty = qfalse;
|
cinTable[handle].dirty = qfalse;
|
||||||
Hunk_FreeTempMemory(buf2);
|
Hunk_FreeTempMemory(buf2);
|
||||||
|
@ -1659,7 +1677,25 @@ void CIN_UploadCinematic(int handle) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
re.UploadCinematic( 256, 256, 256, 256, cinTable[handle].buf, handle, cinTable[handle].dirty);
|
|
||||||
|
// Resample the video if needed
|
||||||
|
if (cinTable[handle].dirty && (cinTable[handle].CIN_WIDTH != cinTable[handle].drawX || cinTable[handle].CIN_HEIGHT != cinTable[handle].drawY)) {
|
||||||
|
int *buf2;
|
||||||
|
|
||||||
|
buf2 = Hunk_AllocateTempMemory( 256*256*4 );
|
||||||
|
|
||||||
|
CIN_ResampleCinematic(handle, buf2);
|
||||||
|
|
||||||
|
re.UploadCinematic( cinTable[handle].CIN_WIDTH, cinTable[handle].CIN_HEIGHT, 256, 256, (byte *)buf2, handle, qtrue);
|
||||||
|
cinTable[handle].dirty = qfalse;
|
||||||
|
Hunk_FreeTempMemory(buf2);
|
||||||
|
} else {
|
||||||
|
// Upload video at normal resolution
|
||||||
|
re.UploadCinematic( cinTable[handle].CIN_WIDTH, cinTable[handle].CIN_HEIGHT, cinTable[handle].drawX, cinTable[handle].drawY,
|
||||||
|
cinTable[handle].buf, handle, cinTable[handle].dirty);
|
||||||
|
cinTable[handle].dirty = qfalse;
|
||||||
|
}
|
||||||
|
|
||||||
if (cl_inGameVideo->integer == 0 && cinTable[handle].playonwalls == 1) {
|
if (cl_inGameVideo->integer == 0 && cinTable[handle].playonwalls == 1) {
|
||||||
cinTable[handle].playonwalls--;
|
cinTable[handle].playonwalls--;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue