diff options
| author | Steven Fuller <relnev@icculus.org> | 2001-07-01 00:55:22 +0000 |
|---|---|---|
| committer | Patryk Obara <dreamer.tan@gmail.com> | 2019-08-20 02:09:04 +0200 |
| commit | 2186d5f3f95cd74a070a490d899291648d58667a (patch) | |
| tree | 55241a1afa3e1a22e0b6593a8dead0b703800f44 /3dc/win95/bink.c | |
| parent | 218ca90543758a20ac326e444ca0643174ca7384 (diff) | |
Initial revision
Diffstat (limited to '3dc/win95/bink.c')
| -rw-r--r-- | 3dc/win95/bink.c | 208 |
1 files changed, 0 insertions, 208 deletions
diff --git a/3dc/win95/bink.c b/3dc/win95/bink.c deleted file mode 100644 index 6050fbe..0000000 --- a/3dc/win95/bink.c +++ /dev/null @@ -1,208 +0,0 @@ -/* Bink! player, KJL 99/4/30 */ -#include "bink.h" - -#include "3dc.h" -#include "d3_func.h" - -#define UseLocalAssert 1 -#include "ourasert.h" - -extern char *ScreenBuffer; -extern LPDIRECTSOUND DSObject; -extern int GotAnyKey; -extern int IntroOutroMoviesAreActive; -extern DDPIXELFORMAT DisplayPixelFormat; - -extern void DirectReadKeyboard(void); - - -static int BinkSurfaceType; - -void PlayBinkedFMV(char *filenamePtr) -{ - BINK* binkHandle; - int playing = 1; - - if (!IntroOutroMoviesAreActive) return; - -// if (!IntroOutroMoviesAreActive) return; - BinkSurfaceType = GetBinkPixelFormat(); - - /* skip FMV if surface type not supported */ - if (BinkSurfaceType == -1) return; - - /* use Direct sound */ - BinkSoundUseDirectSound(DSObject); - /* open smacker file */ - binkHandle = BinkOpen(filenamePtr,0); - if (!binkHandle) - { - char message[100]; - sprintf(message,"Unable to access file: %s\n",filenamePtr); - MessageBox(NULL,message,"AvP Error",MB_OK+MB_SYSTEMMODAL); - exit(0x111); - return; - } - - while(playing) - { - CheckForWindowsMessages(); - if (!BinkWait(binkHandle)) - playing = NextBinkFrame(binkHandle); - - FlipBuffers(); - DirectReadKeyboard(); - if (GotAnyKey) playing = 0; - } - /* close file */ - BinkClose(binkHandle); -} - -static int NextBinkFrame(BINK *binkHandle) -{ - /* unpack frame */ - BinkDoFrame(binkHandle); - - BinkCopyToBuffer(binkHandle,(void*)ScreenBuffer,640*2,480,(640-binkHandle->Width)/2,(480-binkHandle->Height)/2,BinkSurfaceType); - - //BinkToBuffer(binkHandle,(640-binkHandle->Width)/2,(480-binkHandle->Height)/2,640*2,480,(void*)ScreenBuffer,GetBinkPixelFormat(&DisplayPixelFormat)); - - /* are we at the last frame yet? */ - if ((binkHandle->FrameNum==(binkHandle->Frames-1))) return 0; - - /* next frame, please */ - BinkNextFrame(binkHandle); - return 1; -} - -static int GetBinkPixelFormat(void) -{ - if( (DisplayPixelFormat.dwFlags & DDPF_RGB) && !(DisplayPixelFormat.dwFlags & DDPF_PALETTEINDEXED8) ) - { - int m; - int redShift=0; - int greenShift=0; - int blueShift=0; - - m = DisplayPixelFormat.dwRBitMask; - LOCALASSERT(m); - while(!(m&1)) m>>=1; - while(m&1) - { - m>>=1; - redShift++; - } - - m = DisplayPixelFormat.dwGBitMask; - LOCALASSERT(m); - while(!(m&1)) m>>=1; - while(m&1) - { - m>>=1; - greenShift++; - } - - m = DisplayPixelFormat.dwBBitMask; - LOCALASSERT(m); - while(!(m&1)) m>>=1; - while(m&1) - { - m>>=1; - blueShift++; - } - - if(redShift == 5) - { - if (greenShift == 5) - { - if (blueShift == 5) - { - return BINKSURFACE555; - } - else // not supported - { - return -1; - } - } - else if (greenShift == 6) - { - if (blueShift == 5) - { - return BINKSURFACE565; - } - else // not supported - { - return -1; - } - } - } - else if (redShift == 6) - { - if (greenShift == 5) - { - if (blueShift == 5) - { - return BINKSURFACE655; - } - else // not supported - { - return -1; - } - } - else if (greenShift == 6) - { - if (blueShift == 4) - { - return BINKSURFACE664; - } - else // not supported - { - return -1; - } - } - } - else - { - return -1; - } - } - - return -1; -} - -BINK *MenuBackground = 0; - -extern void StartMenuBackgroundBink(void) -{ - char *filenamePtr = "fmvs/menubackground.bik";//newer.bik"; - - /* open smacker file */ - MenuBackground = BinkOpen(filenamePtr,0); - BinkSurfaceType = GetBinkPixelFormat(); - BinkDoFrame(MenuBackground); -} - -extern int PlayMenuBackgroundBink(void) -{ - int newframe = 0; - if(!MenuBackground) return 0; - - if (!BinkWait(MenuBackground)&&IntroOutroMoviesAreActive) newframe=1; - - if(newframe) BinkDoFrame(MenuBackground); - - BinkCopyToBuffer(MenuBackground,(void*)ScreenBuffer,640*2,480,(640-MenuBackground->Width)/2,(480-MenuBackground->Height)/2,BinkSurfaceType|BINKSURFACECOPYALL); - - /* next frame, please */ - if(newframe)BinkNextFrame(MenuBackground); - - return 1; -} -extern void EndMenuBackgroundBink(void) -{ - if(!MenuBackground) return; - - BinkClose(MenuBackground); - MenuBackground = 0; -} - |
