diff options
| author | gaa-cifasis <gg@cifasis-conicet.gov.ar> | 2018-02-18 18:48:51 -0300 |
|---|---|---|
| committer | Patryk Obara <dreamer.tan@gmail.com> | 2019-08-20 03:56:27 +0200 |
| commit | 310cf0da7cf4186fde42222e6835d5a8ad485c8a (patch) | |
| tree | 89dc7bb9bdb692a42a77ed57755d1d7f5211e7cf /src/menus.c | |
| parent | 7aea1acf4490b7d68f6915cf63d28c1f18b49b5d (diff) | |
merged support for playing bink cutscenes and added 1366x768 resolution
Diffstat (limited to 'src/menus.c')
| -rw-r--r-- | src/menus.c | 40 |
1 files changed, 40 insertions, 0 deletions
diff --git a/src/menus.c b/src/menus.c index 6c862a2..ec73820 100644 --- a/src/menus.c +++ b/src/menus.c @@ -1179,6 +1179,46 @@ void ReleaseAllAvPMenuGfx() UnloadMenuFont(); } +void DrawAvpMenuBink(unsigned char* buf, int width, int height, int pitch) +{ + int topleftX = ((ScreenDescriptorBlock.SDB_Width - width)>>1); + int topleftY = ((ScreenDescriptorBlock.SDB_Height - height)>>1); + + int length = width; + if (ScreenDescriptorBlock.SDB_Width - topleftX < length) { + length = ScreenDescriptorBlock.SDB_Width - topleftX; + } + if (length <= 0) return; + + + if (SDL_MUSTLOCK(surface)) { + if (SDL_LockSurface(surface) < 0) { + return; + } + } + + unsigned short* srcPtr = (unsigned short*) buf; + unsigned short* dstPtr = (unsigned short*) ((((unsigned char *)surface->pixels) + (topleftY*surface->pitch)) + (topleftX*2)); + + unsigned int srcPitch = (pitch>>1); + unsigned int dstPitch = (surface->pitch>>1); + + for(int y=height; y!=0; y--) + { + unsigned short* s = srcPtr; + unsigned short* d = dstPtr; + for(int x=width; x!=0; x--) + *d++ = *s++; + + srcPtr += srcPitch; + dstPtr += dstPitch; + } + + if (SDL_MUSTLOCK(surface)) { + SDL_UnlockSurface(surface); + } +} + void DrawAvPMenuGfx(enum AVPMENUGFX_ID menuGfxID, int topleftX, int topleftY, int alpha,enum AVPMENUFORMAT_ID format) { AVPMENUGFX *gfxPtr; |
