mirror of
https://github.com/libretro/scummvm.git
synced 2025-01-10 20:01:25 +00:00
SAGA2: Remove video routines
This commit is contained in:
parent
ee8ffa657d
commit
5d86b6c2f6
@ -24,370 +24,39 @@
|
||||
* (c) 1993-1996 The Wyrmkeep Entertainment Co.
|
||||
*/
|
||||
|
||||
#define FORBIDDEN_SYMBOL_ALLOW_ALL // FIXME: Remove
|
||||
|
||||
#include "saga2/std.h"
|
||||
|
||||
#include "saga2/video.h"
|
||||
#include "saga2/config.h"
|
||||
|
||||
#include "saga2/panel.h"
|
||||
|
||||
#include "saga2/fta.h"
|
||||
|
||||
#include "saga2/itevideo.h"
|
||||
#include "saga2/palette.h"
|
||||
#include "saga2/messager.h"
|
||||
|
||||
namespace Saga2 {
|
||||
|
||||
#define VIDEO_EXT ".SMK"
|
||||
|
||||
/* ===================================================================== *
|
||||
Imports
|
||||
* ===================================================================== */
|
||||
|
||||
extern gMouseState mouseState;
|
||||
extern gMousePointer pointer; // the actual pointer
|
||||
extern configuration globalConfig;
|
||||
extern bool cliWriteStatusF;
|
||||
extern configuration globalConfig;
|
||||
|
||||
#ifdef _WIN32
|
||||
extern HWND hWndMain;
|
||||
extern HINSTANCE mainInst;
|
||||
#endif
|
||||
|
||||
//-----------------------------------------------------------------------
|
||||
// External prototypes
|
||||
|
||||
HDIGDRIVER &digitalAudioDriver(void);
|
||||
|
||||
/* ===================================================================== *
|
||||
Locals
|
||||
* ===================================================================== */
|
||||
|
||||
static VideoPlayer *vp = NULL;
|
||||
|
||||
static gPort mouseVidSavePort; // for tweaking mouse backsave
|
||||
static gPort videoSavePort; // for tweaking mouse backsave
|
||||
static gPixelMap tileVidDrawMap;
|
||||
|
||||
/* ===================================================================== *
|
||||
Code
|
||||
* ===================================================================== */
|
||||
|
||||
//-----------------------------------------------------------------------
|
||||
// Name building hook
|
||||
|
||||
bool nameCheck(char name[], char ext[]) {
|
||||
static bool nameCheck(char name[], char ext[]) {
|
||||
size_t l = strlen(name);
|
||||
if (l < 5 || 0 != scumm_stricmp(name + (l - strlen(ext)), ext))
|
||||
strcat(name, ext);
|
||||
return TRUE; //fileExists(name);
|
||||
return true; //fileExists(name);
|
||||
}
|
||||
|
||||
|
||||
//-----------------------------------------------------------------------
|
||||
// Routine to play a video
|
||||
|
||||
void startVideo(char *fileName, int x, int y, bool erase, int16, int16) {
|
||||
void startVideo(char *fileName, int x, int y) {
|
||||
char file[260];
|
||||
strncpy(file, fileName, 260);
|
||||
nameCheck(file, VIDEO_EXT);
|
||||
|
||||
vp->StartPlay(file, x, y,VideoSMK, erase);
|
||||
//vp->StartPlay(file, x, y,VideoSMK);
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------
|
||||
// General video maintainence & status check
|
||||
|
||||
bool checkVideo(void) {
|
||||
return vp->CheckPlay();
|
||||
return true;
|
||||
//return vp->CheckPlay();
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------
|
||||
// Routine to abort a video
|
||||
|
||||
bool abortVideo(void) {
|
||||
bool old = checkVideo();
|
||||
endVideo();
|
||||
return old;
|
||||
void abortVideo(void) {
|
||||
//endVideo();
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------
|
||||
// Routine to end a video
|
||||
|
||||
void endVideo() {
|
||||
if (vp)
|
||||
vp->EndPlay();
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------
|
||||
// Obsolete
|
||||
|
||||
void beginVideo(char *, int, int, bool, int16, int16) {
|
||||
}
|
||||
|
||||
void resumeVideo(int16, int16) {
|
||||
}
|
||||
|
||||
void finaleVideo(int16, int16) {
|
||||
}
|
||||
|
||||
|
||||
//-----------------------------------------------------------------------
|
||||
// Config calls
|
||||
|
||||
void setVideoVolume(uint8 v) {
|
||||
#if USE_SMK
|
||||
vp->vright = v;
|
||||
vp->vleft = v;
|
||||
#endif
|
||||
}
|
||||
|
||||
bool OurBlits = TRUE;
|
||||
|
||||
//-----------------------------------------------------------------------
|
||||
// name hook
|
||||
|
||||
void pathHook(char *vPath, char *dPath, char *sPath) {
|
||||
char *ev;
|
||||
strcpy(vPath, ".\\");
|
||||
ev = globalConfig.videoFilePath;
|
||||
if (strlen(ev)) {
|
||||
strcpy(vPath, ev);
|
||||
}
|
||||
if (vPath[strlen(vPath) - 1] != '\\')
|
||||
strcat(vPath, "\\");
|
||||
strcpy(dPath, "");
|
||||
strcpy(sPath, "");
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------
|
||||
// General video initialization
|
||||
|
||||
void initVideo(void) {
|
||||
vp = new VideoPlayer(
|
||||
#if USE_SMK
|
||||
TICKSPERSECOND, 0
|
||||
#endif
|
||||
#ifdef _WIN32
|
||||
#if USE_SMK
|
||||
,
|
||||
#endif
|
||||
hWndMain
|
||||
#if USE_MOV
|
||||
,
|
||||
mainInst
|
||||
#endif
|
||||
#endif
|
||||
);
|
||||
if (vp == NULL)
|
||||
error("Cannot create video player");
|
||||
#if USE_SMK && defined(_WIN32)
|
||||
if (OurBlits) {
|
||||
vp->setBuffer(640, 480);
|
||||
}
|
||||
#endif
|
||||
#if DEBUG
|
||||
#if USE_SMK
|
||||
if (cliWriteStatusF)
|
||||
vp->dumpStats = 1;
|
||||
#endif
|
||||
#endif
|
||||
|
||||
setVideoVolume(globalConfig.soundVolume);
|
||||
}
|
||||
|
||||
|
||||
void cleanupVideo(void) {
|
||||
endVideo();
|
||||
if (vp)
|
||||
delete vp;
|
||||
vp = NULL;
|
||||
}
|
||||
|
||||
|
||||
//-----------------------------------------------------------------------
|
||||
// Video hook for blitting the buffer
|
||||
|
||||
#ifdef __WATCOMC__
|
||||
#pragma off (unreferenced);
|
||||
#endif
|
||||
|
||||
void bltBufferHook(const void *buffer,
|
||||
const uint16 bufferWidth,
|
||||
const uint16 bufferHeight,
|
||||
const uint16 left,
|
||||
const uint16 top,
|
||||
const uint16 width,
|
||||
const uint16 height) {
|
||||
#ifndef _WIN32
|
||||
Rect16 r(left, top, width, height);
|
||||
tileVidDrawMap.data = (uint8 *) buffer;
|
||||
tileVidDrawMap.size = Extent16(640, 480);
|
||||
videoSavePort.setMap(&tileVidDrawMap);
|
||||
//drawVideoMousePointer(r,(char *) buffer, bufferWidth);
|
||||
#endif
|
||||
}
|
||||
|
||||
#ifdef __WATCOMC__
|
||||
#pragma on (unreferenced);
|
||||
#endif
|
||||
|
||||
//-----------------------------------------------------------------------
|
||||
// This routine blits the video buffer foreward but the mouse pointer
|
||||
// is temporarily blitted into it
|
||||
|
||||
void drawVideoMousePointer(
|
||||
Rect16 showZone,
|
||||
char *buffer,
|
||||
int bufferWidth
|
||||
) {
|
||||
#ifndef _WIN32
|
||||
gPixelMap *currentPtr,
|
||||
*saveMap;
|
||||
Point16 offset;
|
||||
Rect16 saveExtent,
|
||||
blitExtent;
|
||||
|
||||
// Get the image of the pointer and the hotspot offset
|
||||
currentPtr = pointer.getImage(offset);
|
||||
|
||||
// If pointer exists, and is in a visible state
|
||||
if (currentPtr && pointer.isShown()) {
|
||||
// Get address of pointer's backsave rect
|
||||
saveMap = pointer.getSaveMap(saveExtent);
|
||||
|
||||
// If the pointer overlaps the tile scrolling area
|
||||
if (saveExtent.overlap(showZone)) {
|
||||
// get the intersecting area
|
||||
blitExtent = intersect(saveExtent, showZone);
|
||||
|
||||
mouseVidSavePort.setMap(saveMap);
|
||||
mouseVidSavePort.setMode(drawModeReplace);
|
||||
|
||||
// Blit the tile data into the backsave buffer
|
||||
mouseVidSavePort.bltPixels(
|
||||
tileVidDrawMap,
|
||||
blitExtent.x - showZone.x,
|
||||
blitExtent.y - showZone.y,
|
||||
blitExtent.x - saveExtent.x,
|
||||
blitExtent.y - saveExtent.y,
|
||||
blitExtent.width,
|
||||
blitExtent.height);
|
||||
|
||||
// Blit the mouse pointer onto the video buffer
|
||||
TBlit(&tileVidDrawMap,
|
||||
currentPtr,
|
||||
mouseState.pos.x + offset.x - showZone.x,
|
||||
mouseState.pos.y + offset.y - showZone.y);
|
||||
|
||||
|
||||
// blit the video buffer to the screen
|
||||
drawPage->writePixels(showZone, (uint8 *)buffer, bufferWidth);
|
||||
|
||||
// restore mouse area
|
||||
//videoSavePort.bltPixels(ngpm,0,0,x,y,w,h);
|
||||
videoSavePort.setMode(drawModeReplace);
|
||||
videoSavePort.bltPixels(
|
||||
*saveMap,
|
||||
blitExtent.x - saveExtent.x,
|
||||
blitExtent.y - saveExtent.y,
|
||||
blitExtent.x - showZone.x,
|
||||
blitExtent.y - showZone.y,
|
||||
blitExtent.width,
|
||||
blitExtent.height);
|
||||
|
||||
} else {
|
||||
// blit the video buffer to the screen
|
||||
drawPage->writePixels(showZone,(uint8 *)buffer, bufferWidth);
|
||||
}
|
||||
} else {
|
||||
// blit the video buffer to the screen
|
||||
drawPage->writePixels(showZone, (uint8 *)buffer, bufferWidth);
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
|
||||
//-----------------------------------------------------------------------
|
||||
// Video hook for crude mouse enabling / disabling
|
||||
|
||||
void mouseHook(const bool) {
|
||||
}
|
||||
|
||||
|
||||
void videoErrorHook(
|
||||
const char *errMsg
|
||||
) {
|
||||
error("%s", errMsg);
|
||||
}
|
||||
|
||||
|
||||
|
||||
//-----------------------------------------------------------------------
|
||||
// Video hook for generating filenames
|
||||
#define F_OK 0
|
||||
|
||||
#define FileForm "%s"
|
||||
|
||||
inline bool file_exists(const char f[]) {
|
||||
#if 0
|
||||
return (!access(f, F_OK));
|
||||
#endif
|
||||
warning("STUB: file_exists");
|
||||
return false;
|
||||
}
|
||||
|
||||
void nameHook(char *targ, const char *bpath, const char *, const char *fname) {
|
||||
char filename[260] = "";
|
||||
assert(targ);
|
||||
|
||||
if (strcmp(bpath, ".\\")) { //if env var set
|
||||
strcpy(filename, bpath);
|
||||
if (filename[strlen(filename) - 1] != '\\')
|
||||
strcat(filename, "\\");
|
||||
strcat(filename, fname);
|
||||
//if file not there
|
||||
if (file_exists(filename)) {
|
||||
sprintf(targ, FileForm, filename);
|
||||
return;
|
||||
}
|
||||
}
|
||||
sprintf(targ, FileForm, fname);
|
||||
return;
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------
|
||||
// Video hook to get the AIL digital audio driver
|
||||
|
||||
HDIGDRIVER &audioInitHook(void) {
|
||||
return digitalAudioDriver();
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------
|
||||
// Video hook to free the AIL digital audio driver
|
||||
|
||||
void audioTermHook(HDIGDRIVER) {}
|
||||
|
||||
|
||||
|
||||
/* palette Hook */
|
||||
/* Override this call to set the palette manually */
|
||||
|
||||
extern UByteHandle newPalette,
|
||||
our64Palette;
|
||||
|
||||
void setPaletteHook(
|
||||
void *paletteMinusFour
|
||||
) {
|
||||
#ifndef _WIN32
|
||||
gPalette *gp = (gPalette *)(void *)(((uint8 *) paletteMinusFour));
|
||||
_LoadPalette((uint8 *)paletteMinusFour, 0, 256);
|
||||
#endif
|
||||
//if (vp)
|
||||
// vp->EndPlay();
|
||||
}
|
||||
|
||||
} // end of namespace Saga2
|
||||
|
@ -27,18 +27,17 @@
|
||||
#ifndef SAGA2_ITEVIDEO_H
|
||||
#define SAGA2_ITEVIDEO_H
|
||||
|
||||
#include "saga2/video.h"
|
||||
#include "saga2/fta.h"
|
||||
|
||||
namespace Saga2 {
|
||||
|
||||
#define TICKSPERSECOND (728L/10L)
|
||||
|
||||
void initVideo(void);
|
||||
void cleanupVideo(void);
|
||||
|
||||
//-----------------------------------------------------------------------
|
||||
// Calls for individual videos
|
||||
|
||||
void startVideo(char *fileName, int x, int y, bool erase = TRUE, int16 from = 0, int16 to = 0);
|
||||
void startVideo(char *fileName, int x, int y);
|
||||
bool checkVideo(void);
|
||||
void endVideo(void);
|
||||
|
||||
@ -46,9 +45,7 @@ void endVideo(void);
|
||||
// Player configuration & other obsolete calls
|
||||
|
||||
void setVideoVolume(uint8 v);
|
||||
void drawVideoMousePointer(Rect16 showZone, char *buffer, int bufferWidth);
|
||||
|
||||
void playVideo(char *fileName, int x, int y); //, int16 from=0, int16 to=0 );
|
||||
bool abortVideo(void);
|
||||
|
||||
} // end of namespace Saga2
|
||||
|
@ -96,11 +96,7 @@ MODULE_OBJS := \
|
||||
tromode.o \
|
||||
uidialog.o \
|
||||
vbacksav.o \
|
||||
video.o \
|
||||
videobox.o \
|
||||
videomem.o \
|
||||
vidhook.o \
|
||||
vidsmk.o \
|
||||
vpal.o \
|
||||
vwdraw.o \
|
||||
vwpage.o \
|
||||
|
@ -93,7 +93,6 @@ void waitForVideoFile(char *fileName);
|
||||
static void waitForTimer(uint32 tenthsOfSecond);
|
||||
static void waitForVideo(void);
|
||||
void waitForInput(void);
|
||||
static void playVideo(char *fileName, int x, int y, int16 from, int16 to);
|
||||
|
||||
static void TroModeSetup(void);
|
||||
static void TroModeCleanup(void);
|
||||
@ -326,7 +325,6 @@ static void doIntro(void) {
|
||||
playAVideo(INTRO_VID1, 0, 0);
|
||||
abortFlag = FALSE;
|
||||
playAVideo(INTRO_VID2, 0, 0);
|
||||
// playVideo(INTRO_VID,VIDEO_X,VIDEO_Y,0,0); //if (abortFlag) { resumeAudio(); return; }
|
||||
}
|
||||
|
||||
// ------------------------------------------------------------------------
|
||||
@ -356,80 +354,4 @@ static void doLostro(void) {
|
||||
playAVideo(LOSE_VID, 0, 0);
|
||||
}
|
||||
|
||||
|
||||
|
||||
// ------------------------------------------------------------------------
|
||||
// ------------------------------------------------------------------------
|
||||
// ------------------------------------------------------------------------
|
||||
|
||||
|
||||
|
||||
#if 0
|
||||
// ------------------------------------------------------------------------
|
||||
// I didn't end up using GameModes
|
||||
|
||||
GameMode TroMode = {
|
||||
NULL, // no previous mode
|
||||
FALSE, // mode is not nestable
|
||||
TroModeSetup,
|
||||
TroModeCleanup,
|
||||
TroModeHandleTask,
|
||||
SystemKeyHandler,
|
||||
};
|
||||
|
||||
static GameMode *prevModeStackPtr[ Max_Modes ];
|
||||
static int prevModeStackCtr;
|
||||
|
||||
// ------------------------------------------------------------------------
|
||||
// dummy code (originally for game mode)
|
||||
|
||||
static void TroModeHandleTask(void) {
|
||||
|
||||
}
|
||||
|
||||
static void goTroMode(void) {
|
||||
prevModeStackCtr = GameMode::getStack(prevModeStackPtr);
|
||||
GameMode::SetStack(&TroMode, End_List);
|
||||
}
|
||||
|
||||
static void noTroMode(void) {
|
||||
GameMode::SetStack(prevModeStackPtr, prevModeStackCtr);
|
||||
}
|
||||
|
||||
|
||||
// ------------------------------------------------------------------------
|
||||
// I didn't end up using partial playback either
|
||||
|
||||
|
||||
void doVideo(char *fileName, int x, int y, int16 from, int16 to) {
|
||||
beginVideo(fileName, x, y, ERASE_BETWEEN, from, to);
|
||||
if (!checkVideo()) {
|
||||
endVideo();
|
||||
abortFlag = TRUE;
|
||||
return;
|
||||
}
|
||||
waitForVideo();
|
||||
}
|
||||
|
||||
void contVideo(int16 from, int16 to) {
|
||||
resumeVideo(from, to);
|
||||
if (!checkVideo()) {
|
||||
endVideo();
|
||||
abortFlag = TRUE;
|
||||
return;
|
||||
}
|
||||
waitForVideo();
|
||||
}
|
||||
|
||||
void lastVideo(int16 from, int16 to) {
|
||||
finaleVideo(from, to);
|
||||
if (!checkVideo()) {
|
||||
endVideo();
|
||||
abortFlag = TRUE;
|
||||
return;
|
||||
}
|
||||
//waitForVideo();
|
||||
}
|
||||
#endif
|
||||
|
||||
} // end of namespace Saga2
|
||||
|
@ -1,291 +0,0 @@
|
||||
/* ScummVM - Graphic Adventure Engine
|
||||
*
|
||||
* ScummVM is the legal property of its developers, whose names
|
||||
* are too numerous to list here. Please refer to the COPYRIGHT
|
||||
* file distributed with this source distribution.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License
|
||||
* as published by the Free Software Foundation; either version 2
|
||||
* of the License, or (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* aint32 with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||
*
|
||||
*
|
||||
* Based on the original sources
|
||||
* Faery Tale II -- The Halls of the Dead
|
||||
* (c) 1993-1996 The Wyrmkeep Entertainment Co.
|
||||
*/
|
||||
|
||||
// Tiny Smacker player for the Miles Sound System
|
||||
|
||||
#define FORBIDDEN_SYMBOL_ALLOW_ALL // FIXME: Remove
|
||||
|
||||
#include "saga2/std.h"
|
||||
#include "saga2/video.h"
|
||||
|
||||
namespace Saga2 {
|
||||
|
||||
/*****************************************************************************/
|
||||
/* globals */
|
||||
|
||||
char tNameBuffer[260];
|
||||
|
||||
/*****************************************************************************/
|
||||
/* ctor */
|
||||
|
||||
VideoPlayer::VideoPlayer(
|
||||
#if USE_SMK
|
||||
uint32 maxTimer, bool UseBuffer
|
||||
#endif
|
||||
#ifdef _WIN32
|
||||
#if USE_SMK
|
||||
,
|
||||
#endif
|
||||
HWND wnd
|
||||
#if USE_MOV
|
||||
,
|
||||
HINSTANCE inst
|
||||
#endif
|
||||
#endif
|
||||
) {
|
||||
type = VideoNone;
|
||||
#ifdef _WIN32
|
||||
hWnd = wnd;
|
||||
#endif
|
||||
autoEnd = FALSE;
|
||||
toBuffer = FALSE;
|
||||
buffer = NULL;
|
||||
bufferWidth = bufferHeight = bufferLeft = bufferTop = 0;
|
||||
pathHook(vidPath, dgvPath, smkPath);
|
||||
#if USE_SMK
|
||||
#ifdef _WIN32
|
||||
smBuf = NULL;
|
||||
#endif
|
||||
dig = audioInitHook();
|
||||
InitSMK(maxTimer, UseBuffer);
|
||||
#endif
|
||||
#if USE_MOV
|
||||
InitMOV(wnd, inst);
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
/*****************************************************************************/
|
||||
/* dtor */
|
||||
|
||||
VideoPlayer::~VideoPlayer() {
|
||||
setType(VideoNone);
|
||||
#if USE_SMK
|
||||
TermSMK();
|
||||
#endif
|
||||
#if USE_MOV
|
||||
TermMOV();
|
||||
#endif
|
||||
audioTermHook(dig);
|
||||
}
|
||||
|
||||
|
||||
/*****************************************************************************/
|
||||
/* set up video buffer */
|
||||
|
||||
void VideoPlayer::setBuffer(uint32 newWidth, uint32 newHeight) {
|
||||
bufferWidth = newWidth;
|
||||
toBuffer = (newWidth != 0 &&
|
||||
newHeight != 0);
|
||||
if (toBuffer)
|
||||
bufferHeight = newHeight;
|
||||
else {
|
||||
bufferHeight = 0;
|
||||
}
|
||||
buffer = NULL;
|
||||
}
|
||||
|
||||
void VideoPlayer::setBuffer(uint32 newWidth, uint32 newHeight, void *buf) {
|
||||
bufferWidth = newWidth;
|
||||
toBuffer = (newWidth != 0 && newHeight != 0);
|
||||
if (toBuffer) {
|
||||
bufferHeight = newHeight;
|
||||
buffer = buf;
|
||||
} else {
|
||||
bufferHeight = 0;
|
||||
buffer = NULL;
|
||||
}
|
||||
}
|
||||
|
||||
/*****************************************************************************/
|
||||
/* blitting call */
|
||||
|
||||
void VideoPlayer::bltBuffer(void) {
|
||||
bltBufferHook(buffer, bufferWidth, bufferHeight, bufferLeft, bufferTop, videoWidth, videoHeight);
|
||||
}
|
||||
|
||||
|
||||
/*****************************************************************************/
|
||||
/* file type detection */
|
||||
|
||||
VideoInterface VideoPlayer::detectType(char *filespec) {
|
||||
size_t l = strlen(filespec);
|
||||
if (l < 5)
|
||||
return VideoNone;
|
||||
// if ( 0==stricmp(filespec+(l-strlen(VEXT_DGV)),VEXT_DGV) )
|
||||
// return VideoDGV;
|
||||
#if USE_MOV
|
||||
if (0 == stricmp(filespec + (l - strlen(VEXT_MOV)), VEXT_MOV))
|
||||
return VideoMOV;
|
||||
#endif
|
||||
#if USE_SMK
|
||||
//if ( 0==stricmp(filespec+(l-strlen(VEXT_SMK)),VEXT_SMK) )
|
||||
return VideoSMK;
|
||||
#else
|
||||
return VideoNone;
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
/*****************************************************************************/
|
||||
/* type initialization to avoid multiple plays */
|
||||
|
||||
void VideoPlayer::setType(VideoInterface vi) {
|
||||
if (type && vi) EndPlay();
|
||||
type = vi;
|
||||
}
|
||||
|
||||
|
||||
/*****************************************************************************/
|
||||
/* Play */
|
||||
#ifdef __WATCOMC__
|
||||
#pragma off (unreferenced);
|
||||
#endif
|
||||
|
||||
bool VideoPlayer::StartPlay(char *filespec,
|
||||
uint16 xxx, uint16 yyy,
|
||||
#if USE_SMK
|
||||
uint32 extraBuf,
|
||||
bool noSkip,
|
||||
#endif
|
||||
VideoInterface vi,
|
||||
bool eraseWhenDone,
|
||||
int16 from,
|
||||
int16 to
|
||||
) {
|
||||
bool res;
|
||||
char fullPath[MAXVPATH];
|
||||
|
||||
if (vi == VideoAutoDetect)
|
||||
vi = detectType(filespec);
|
||||
setType(vi);
|
||||
mouseHook(FALSE);
|
||||
if (toBuffer) {
|
||||
bufferLeft = xxx;
|
||||
bufferTop = yyy;
|
||||
}
|
||||
strcpy(tNameBuffer, filespec);
|
||||
switch (vi) {
|
||||
// case VideoDGV:
|
||||
// nameHook(fullPath,vidPath,dgvPath,filespec);
|
||||
// res=StartDGV(fullPath,xxx,yyy);
|
||||
// break;
|
||||
#if USE_SMK
|
||||
case VideoSMK:
|
||||
nameHook(fullPath, vidPath, smkPath, filespec);
|
||||
res = StartSMK(fullPath, xxx, yyy, extraBuf, noSkip);
|
||||
break;
|
||||
#endif
|
||||
#if USE_MOV
|
||||
case VideoMOV:
|
||||
nameHook(fullPath, vidPath, smkPath, filespec);
|
||||
|
||||
res = StartMOV(fullPath, xxx, yyy, eraseWhenDone, from, to);
|
||||
|
||||
break;
|
||||
#endif
|
||||
case VideoNone:
|
||||
res = FALSE;
|
||||
break;
|
||||
default:
|
||||
assert(0);
|
||||
res = FALSE;
|
||||
}
|
||||
mouseHook(TRUE);
|
||||
playing = res;
|
||||
if (!res)
|
||||
setType(VideoNone);
|
||||
else
|
||||
abort = FALSE;
|
||||
return res;
|
||||
|
||||
}
|
||||
|
||||
#ifdef __WATCOMC__
|
||||
#pragma on (unreferenced);
|
||||
#endif
|
||||
|
||||
/*****************************************************************************/
|
||||
/* Update & status */
|
||||
|
||||
bool VideoPlayer::CheckPlay(void) {
|
||||
bool res = FALSE;
|
||||
if (playing && type) {
|
||||
mouseHook(FALSE);
|
||||
autoEnd = TRUE;
|
||||
switch (type) {
|
||||
// case VideoDGV: res=CheckDGV(); break;
|
||||
#if USE_SMK
|
||||
case VideoSMK:
|
||||
res = CheckSMK();
|
||||
break;
|
||||
#endif
|
||||
#if USE_MOV
|
||||
case VideoMOV:
|
||||
res = CheckMOV();
|
||||
break;
|
||||
#endif
|
||||
case VideoNone:
|
||||
break;
|
||||
default:
|
||||
assert(0);
|
||||
}
|
||||
autoEnd = FALSE;
|
||||
mouseHook(TRUE);
|
||||
}
|
||||
return res;
|
||||
}
|
||||
|
||||
|
||||
/*****************************************************************************/
|
||||
/* Stop */
|
||||
|
||||
void VideoPlayer::EndPlay(void) {
|
||||
abort = (!autoEnd);
|
||||
playing = FALSE;
|
||||
mouseHook(FALSE);
|
||||
switch (type) {
|
||||
case VideoNone:
|
||||
break;
|
||||
// case VideoDGV: EndDGV(); break;
|
||||
#if USE_SMK
|
||||
case VideoSMK:
|
||||
EndSMK();
|
||||
break;
|
||||
#endif
|
||||
#if USE_MOV
|
||||
case VideoMOV:
|
||||
EndMOV();
|
||||
break;
|
||||
#endif
|
||||
default:
|
||||
assert(0);
|
||||
}
|
||||
mouseHook(TRUE);
|
||||
setType(VideoNone);
|
||||
}
|
||||
|
||||
} // end of namespace Saga2
|
@ -1,378 +0,0 @@
|
||||
/* ScummVM - Graphic Adventure Engine
|
||||
*
|
||||
* ScummVM is the legal property of its developers, whose names
|
||||
* are too numerous to list here. Please refer to the COPYRIGHT
|
||||
* file distributed with this source distribution.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License
|
||||
* as published by the Free Software Foundation; either version 2
|
||||
* of the License, or (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* aint32 with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||
*
|
||||
*
|
||||
* Based on the original sources
|
||||
* Faery Tale II -- The Halls of the Dead
|
||||
* (c) 1993-1996 The Wyrmkeep Entertainment Co.
|
||||
*/
|
||||
|
||||
#ifndef SAGA2_VIDEO_H
|
||||
#define SAGA2_VIDEO_H
|
||||
|
||||
#include "saga2/videomem.h"
|
||||
|
||||
// ------------------------------------------------------------------
|
||||
// Interface selection
|
||||
|
||||
#define USE_DGV 0
|
||||
#define USE_SMK 1
|
||||
#define USE_MOV 0
|
||||
|
||||
|
||||
namespace Saga2 {
|
||||
|
||||
typedef int HDIGDRIVER;
|
||||
typedef void *Smack;
|
||||
#define SMACKAUTOEXTRA 1
|
||||
|
||||
/* ===================================================================== *
|
||||
Definitions
|
||||
* ===================================================================== */
|
||||
|
||||
// ------------------------------------------------------------------
|
||||
// AIL default
|
||||
|
||||
#ifndef TICKSPERSECOND
|
||||
#define TICKSPERSECOND ( 728L/10L )
|
||||
#endif
|
||||
|
||||
// ------------------------------------------------------------------
|
||||
// Known video interfaces
|
||||
|
||||
enum VideoInterface {
|
||||
VideoAutoDetect = -1, // Let the interface detect type
|
||||
VideoNone, // Invalid video type
|
||||
VideoDGV, // DGV video
|
||||
VideoSMK, // Smacker video
|
||||
VideoMOV, // Smacker video
|
||||
};
|
||||
|
||||
// ------------------------------------------------------------------
|
||||
// Extensions for video type autodetection
|
||||
|
||||
#define VEXT_DGV ".DGV"
|
||||
#define VEXT_SMK ".SMK"
|
||||
#define VEXT_MOV ".AVI"
|
||||
// Note : don't change these without recompiling the Library
|
||||
|
||||
// ------------------------------------------------------------------
|
||||
// sizes
|
||||
|
||||
#define MAXVPATH 260
|
||||
// Note : don't change this without recompiling the Library
|
||||
|
||||
|
||||
/* ===================================================================== *
|
||||
Class Definitions
|
||||
* ===================================================================== */
|
||||
|
||||
#ifdef __cplusplus
|
||||
|
||||
// ------------------------------------------------------------------
|
||||
// General video playback interface object
|
||||
// - yeah virtual functions would have been better
|
||||
|
||||
class VideoPlayer {
|
||||
private:
|
||||
VideoInterface type; // The type of video currently playing
|
||||
bool autoEnd;
|
||||
HDIGDRIVER dig;
|
||||
bool toBuffer;
|
||||
uint32 bufferWidth, bufferHeight;
|
||||
bool StartFrame; // time to show nother frame?
|
||||
#ifdef _WIN32
|
||||
HWND hWnd;
|
||||
#endif
|
||||
|
||||
#if USE_DGV
|
||||
// DGV internal variables
|
||||
char pal[256 * 3]; // palette?
|
||||
uint16 newcount; // ???
|
||||
uint16 x, y, lx, ly, x1, yy1, x2, y2; // assorted screen positions
|
||||
Image Im; // ???
|
||||
bool OldSoundOn; // ???
|
||||
bool dopal; // need new palette?
|
||||
bool norebuild; // ???
|
||||
ChunkyMap *DGVChunkyMap; // pointer to DGV structure
|
||||
ChunkyMap BackChunkyMap; // The thickerer chocolate bar
|
||||
#endif
|
||||
#if USE_SMK
|
||||
// SMK internal variables
|
||||
uint8 lvleft, lvright; // current volume levels
|
||||
Smack *smk; // pointer to smacker structure
|
||||
uint32 i; // current frame
|
||||
#ifdef _WIN32
|
||||
SmackBuf *smBuf;
|
||||
#endif
|
||||
#endif
|
||||
#if USE_MOV
|
||||
// MOV internal variables
|
||||
HINSTANCE hInst;
|
||||
HWND mciWnd;
|
||||
uint16 tox, toy;
|
||||
#endif
|
||||
|
||||
|
||||
public:
|
||||
|
||||
void *buffer;
|
||||
bool playing; // whether or not a video is playing
|
||||
bool abort; // terminate immediately
|
||||
char vidPath[MAXVPATH]; // base path for videos
|
||||
char dgvPath[MAXVPATH]; // added path for dgv videos
|
||||
char smkPath[MAXVPATH]; // added path for smk videos
|
||||
uint32 bufferLeft, bufferTop;
|
||||
uint32 videoWidth, videoHeight;
|
||||
#if USE_DGV
|
||||
// DGV public varaiables
|
||||
bool asBack; // show DGV as background pic only
|
||||
#endif
|
||||
#if USE_SMK
|
||||
// SMK public vars
|
||||
uint8 vright; // right volume
|
||||
uint8 vleft; // wrong volume
|
||||
uint8 changePalette; // palette changes enabled
|
||||
uint8 restoreChangePalette; // palette changes enabled
|
||||
bool dumpStats; // If enabled a .DMP file w/ stats is generated for each video
|
||||
#endif
|
||||
#if USE_MOV
|
||||
// MOV public
|
||||
#endif
|
||||
|
||||
private:
|
||||
void setType(VideoInterface vi);
|
||||
#if USE_DGV
|
||||
// DGV specific routines
|
||||
void InitDGV(void);
|
||||
bool StartDGV(char *filespec, uint16 xxx, uint16 yyy);
|
||||
bool CheckDGV(void);
|
||||
void EndDGV(void);
|
||||
void TermDGV(void);
|
||||
#endif
|
||||
#if USE_SMK
|
||||
// SMK specific routines
|
||||
void InitSMK(uint32 maxTimer, bool UseBuffer = TRUE);
|
||||
bool StartSMK(char *filespec, uint16 xxx, uint16 yyy, uint32 extraBuf = SMACKAUTOEXTRA, bool noSkip = FALSE);
|
||||
bool CheckSMK(void);
|
||||
void EndSMK(void);
|
||||
void TermSMK(void);
|
||||
#endif
|
||||
#if USE_MOV
|
||||
// MOV specific routines
|
||||
void InitMOV(HWND hWnd, HINSTANCE inst);
|
||||
bool StartMOV(char *filespec, uint16 xxx, uint16 yyy, bool eraseWhenDone, int16 from = 0, int16 to = 0);
|
||||
bool CheckMOV(void);
|
||||
void EndMOV(void);
|
||||
void TermMOV(void);
|
||||
public:
|
||||
void BeginMOV(char *fileName, int x, int y, bool erase = TRUE, int16 from = 0, int16 to = 0);
|
||||
void ResumeMOV(int16 from = 0, int16 to = 0);
|
||||
void FinaleMOV(int16 from = 0, int16 to = 0);
|
||||
#endif
|
||||
|
||||
public:
|
||||
VideoPlayer(
|
||||
#if USE_SMK
|
||||
uint32 maxTimer, bool UseBuffer
|
||||
#endif
|
||||
#ifdef _WIN32
|
||||
#if USE_SMK
|
||||
,
|
||||
#endif
|
||||
HWND wnd
|
||||
#if USE_MOV
|
||||
,
|
||||
HINSTANCE inst
|
||||
#endif
|
||||
#endif
|
||||
);
|
||||
~VideoPlayer();
|
||||
|
||||
// memory management mapping
|
||||
|
||||
void *operator new (size_t s) {
|
||||
return videoAlloc(s, "VidPlayer");
|
||||
}
|
||||
void operator delete (void *m) {
|
||||
videoFree(m);
|
||||
}
|
||||
|
||||
// detectType attempts to determine the video type based
|
||||
// on the filename extension
|
||||
|
||||
VideoInterface detectType(char *filespec);
|
||||
|
||||
// StartPlay attempts to open and start playing the video
|
||||
// file named in filespec at the given coordinates
|
||||
// if no file type is given detectType() will be used
|
||||
// returns true if the video was successfully started
|
||||
|
||||
bool StartPlay(char *filespec, // Filename of video
|
||||
uint16 xxx, uint16 yyy, // x,y of upper left corner
|
||||
#if USE_SMK
|
||||
uint32 extraBuf = SMACKAUTOEXTRA,
|
||||
bool noSkip = FALSE,
|
||||
#endif
|
||||
VideoInterface vi = VideoAutoDetect,
|
||||
bool eraseWhenDone = TRUE,
|
||||
int16 from = 0, int16 to = 0
|
||||
); // video type
|
||||
|
||||
// CheckPlay is a video maintainence call. It takes care of
|
||||
// any updating the video interface must do to the screen, sound
|
||||
// palettes etc. It can be safely called whether a video is
|
||||
// playing or not. This call should be put in a main event loop
|
||||
// or given itsown thread.
|
||||
// It returns true if a video is playing
|
||||
|
||||
bool CheckPlay(void);
|
||||
|
||||
// EndPlay is a cleanup routine for the video interfaces. It is
|
||||
// usually called automatically by CheckPlay at the end of
|
||||
// a video, but can be called manually to abort a video
|
||||
|
||||
void EndPlay(void);
|
||||
|
||||
// setBuffer tells the player that videos should be played into
|
||||
// a memory buffer of a given size. If 0 is passed for either
|
||||
// parameter, the screen will be used. This currently only
|
||||
// works for SMK files
|
||||
|
||||
void setBuffer(uint32 newWidth, uint32 newHeight);
|
||||
|
||||
// this version explicitly sets the buffer to use
|
||||
|
||||
void setBuffer(uint32 newWidth, uint32 newHeight, void *buffer);
|
||||
|
||||
// bltBuffer is called when a buffer is being used to blt that
|
||||
// buffer to the screen.
|
||||
|
||||
void bltBuffer(void);
|
||||
|
||||
#if USE_SMK
|
||||
Smack *getSmack(void) {
|
||||
return smk;
|
||||
}
|
||||
#ifdef _WIN32
|
||||
LRESULT OnPaletteChanged(HWND win_handle, WORD wparam, LONG lparam);
|
||||
LRESULT OnQueryNewPalette(HWND win_handle, WORD wparam, LONG lparam);
|
||||
#endif
|
||||
#endif
|
||||
|
||||
};
|
||||
#endif
|
||||
|
||||
|
||||
/*****************************************************************************/
|
||||
/* Global DGV stuff */
|
||||
/*****************************************************************************/
|
||||
|
||||
#if USE_DGV
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
extern uint16 VGAScreenWidth,
|
||||
VGAScreenHeight;
|
||||
extern bool SoundOn;
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
#endif
|
||||
|
||||
/*****************************************************************************/
|
||||
/* External Hooks */
|
||||
/* To override default behaviors you can create routines with these */
|
||||
/* prototypes that perform the appropriate function */
|
||||
/*****************************************************************************/
|
||||
|
||||
/* Mouse Hook */
|
||||
/* Use this routine to eliminate mouse droppings */
|
||||
/* put your local mouse pointer enable/disable code in it */
|
||||
|
||||
void mouseHook(
|
||||
const bool // TRUE=enable FALSE=disable
|
||||
) ;
|
||||
|
||||
/* Path Hook */
|
||||
/* Use this routine to initialize the base paths for video files */
|
||||
/* See the name hook for more on how these are used */
|
||||
|
||||
void pathHook(
|
||||
char *vPath, // base path for all video files, default=".\"
|
||||
char *dPath, // dgv file path modifier default=""
|
||||
char *sPath // smk file path modifier default=""
|
||||
) ;
|
||||
|
||||
/* Name Hook */
|
||||
/* Use this routine to change how filenames are built */
|
||||
/* By default the three sections are simply concatenated into the target */
|
||||
/* This can be modified if desired */
|
||||
/* This can be modified if desired */
|
||||
|
||||
|
||||
void nameHook(
|
||||
char *targ, // copy a valid filename into here
|
||||
const char *bpath, // vPath from pathHook
|
||||
const char *tpath, // either dPath or sPath from pathHook (dgv or smk)
|
||||
const char *fname // the filename that the we are about to try to open
|
||||
);
|
||||
|
||||
/* Audio Hooks */
|
||||
/* Use these routine to initialize audio somewhere else in the code. */
|
||||
|
||||
#ifdef __cplusplus
|
||||
HDIGDRIVER &audioInitHook(void);
|
||||
void audioTermHook(HDIGDRIVER d);
|
||||
#endif
|
||||
|
||||
/* blt Hook */
|
||||
/* Override this call to use an external blitting routine */
|
||||
|
||||
void bltBufferHook(
|
||||
const void *buffer,
|
||||
const uint16 bufferWidth,
|
||||
const uint16 bufferHeight,
|
||||
const uint16 left,
|
||||
const uint16 top,
|
||||
const uint16 width,
|
||||
const uint16 height
|
||||
);
|
||||
|
||||
|
||||
/* palette Hook */
|
||||
/* Override this call to set the palette manually */
|
||||
|
||||
void setPaletteHook(
|
||||
void *paletteMinusFour
|
||||
);
|
||||
|
||||
/* error Hook */
|
||||
/* This hook is called to deal with memory allocation errors */
|
||||
|
||||
void videoErrorHook(
|
||||
const char *errMsg
|
||||
);
|
||||
|
||||
} // end of namespace Saga2
|
||||
|
||||
#endif
|
@ -1,42 +0,0 @@
|
||||
/* ScummVM - Graphic Adventure Engine
|
||||
*
|
||||
* ScummVM is the legal property of its developers, whose names
|
||||
* are too numerous to list here. Please refer to the COPYRIGHT
|
||||
* file distributed with this source distribution.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License
|
||||
* as published by the Free Software Foundation; either version 2
|
||||
* of the License, or (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||
*
|
||||
*
|
||||
* Based on the original sources
|
||||
* Faery Tale II -- The Halls of the Dead
|
||||
* (c) 1993-1996 The Wyrmkeep Entertainment Co.
|
||||
*/
|
||||
|
||||
#define FORBIDDEN_SYMBOL_ALLOW_ALL // FIXME: Remove
|
||||
|
||||
#include "saga2/std.h"
|
||||
#include "saga2/videomem.h"
|
||||
|
||||
namespace Saga2 {
|
||||
|
||||
void *videoAlloc(size_t s, char desc[], bool noFail, bool noSwap) {
|
||||
warning("STUB: videoAlloc()");
|
||||
}
|
||||
|
||||
void videoFree(void *mem, bool unLock) {
|
||||
warning("STUB: videoFree()");
|
||||
}
|
||||
|
||||
} // end of namespace Saga2
|
@ -1,52 +0,0 @@
|
||||
/* ScummVM - Graphic Adventure Engine
|
||||
*
|
||||
* ScummVM is the legal property of its developers, whose names
|
||||
* are too numerous to list here. Please refer to the COPYRIGHT
|
||||
* file distributed with this source distribution.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License
|
||||
* as published by the Free Software Foundation; either version 2
|
||||
* of the License, or (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* aint32 with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||
*
|
||||
*
|
||||
* Based on the original sources
|
||||
* Faery Tale II -- The Halls of the Dead
|
||||
* (c) 1993-1996 The Wyrmkeep Entertainment Co.
|
||||
*/
|
||||
|
||||
#ifndef SAGA2_VIDEOMEM_H
|
||||
#define SAGA2_VIDEOMEM_H
|
||||
|
||||
namespace Saga2 {
|
||||
|
||||
#ifndef _WIN32
|
||||
#define VIDMEM_LOCK_DEFAULT TRUE
|
||||
#else
|
||||
#define VIDMEM_LOCK_DEFAULT FALSE
|
||||
#endif
|
||||
|
||||
/* ===================================================================== *
|
||||
Prototypes
|
||||
* ===================================================================== */
|
||||
|
||||
#ifdef __cplusplus
|
||||
void *videoAlloc(size_t s, char desc[], bool noFail = FALSE, bool noSwap = VIDMEM_LOCK_DEFAULT);
|
||||
void videoFree(void *mem, bool unLock = VIDMEM_LOCK_DEFAULT);
|
||||
#else
|
||||
void *videoAlloc(size_t s, char desc[], bool noFail, bool noSwap);
|
||||
void videoFree(void *mem, bool unLock);
|
||||
#endif
|
||||
|
||||
} // end of namespace Saga2
|
||||
|
||||
#endif
|
@ -1,135 +0,0 @@
|
||||
/* ScummVM - Graphic Adventure Engine
|
||||
*
|
||||
* ScummVM is the legal property of its developers, whose names
|
||||
* are too numerous to list here. Please refer to the COPYRIGHT
|
||||
* file distributed with this source distribution.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License
|
||||
* as published by the Free Software Foundation; either version 2
|
||||
* of the License, or (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* aint32 with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||
*
|
||||
*
|
||||
* Based on the original sources
|
||||
* Faery Tale II -- The Halls of the Dead
|
||||
* (c) 1993-1996 The Wyrmkeep Entertainment Co.
|
||||
*/
|
||||
|
||||
#define FORBIDDEN_SYMBOL_ALLOW_ALL // FIXME: Remove
|
||||
|
||||
#include "saga2/std.h"
|
||||
#include "saga2/video.h"
|
||||
|
||||
namespace Saga2 {
|
||||
|
||||
/*****************************************************************************/
|
||||
/* Constants used for paths */
|
||||
|
||||
const char DEFAULT_VID_PATH[] = ".\\";
|
||||
const char DEFAULT_DGV_PATH[] = "";
|
||||
const char DEFAULT_SMK_PATH[] = "";
|
||||
|
||||
|
||||
/*****************************************************************************/
|
||||
/* pre blit / post blit */
|
||||
|
||||
void mouseHook(const bool) {
|
||||
}
|
||||
|
||||
#ifndef _WIN32
|
||||
/*****************************************************************************/
|
||||
/* path defaults */
|
||||
|
||||
void pathHook(char *vPath, char *dPath, char *sPath) {
|
||||
strcpy(vPath, DEFAULT_VID_PATH); // base path for videos
|
||||
strcpy(dPath, DEFAULT_DGV_PATH); // base path for videos
|
||||
strcpy(sPath, DEFAULT_SMK_PATH); // base path for videos
|
||||
}
|
||||
|
||||
/*****************************************************************************/
|
||||
/* path building */
|
||||
|
||||
void nameHook(char *targ, const char *bpath, const char *tpath, const char *fname) {
|
||||
if (NULL == strchr(fname, '\\') && NULL == strchr(fname, ':')) {
|
||||
strcpy(targ, bpath);
|
||||
strcat(targ, tpath);
|
||||
} else
|
||||
targ[0] = '\0';
|
||||
strcat(targ, fname);
|
||||
}
|
||||
|
||||
/*****************************************************************************/
|
||||
/* AIL hooks */
|
||||
|
||||
HDIGDRIVER &audioInitHook(void) {
|
||||
HDIGDRIVER *d = new HDIGDRIVER;
|
||||
#if 0
|
||||
#ifndef _WIN32
|
||||
AIL_startup();
|
||||
AIL_install_DIG_INI(d);
|
||||
if (*d == NULL)
|
||||
AIL_shutdown();
|
||||
#endif
|
||||
|
||||
#endif
|
||||
return *d;
|
||||
}
|
||||
|
||||
void audioTermHook(HDIGDRIVER d) {
|
||||
#if 0
|
||||
#ifndef _WIN32
|
||||
if (d)
|
||||
AIL_uninstall_DIG_driver(d);
|
||||
AIL_shutdown();
|
||||
#endif
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
/*****************************************************************************/
|
||||
/* Blitting */
|
||||
|
||||
void bltBufferHook(
|
||||
const void *buffer,
|
||||
const uint16 bufferWidth,
|
||||
const uint16 bufferHeight,
|
||||
const uint16 left,
|
||||
const uint16 top,
|
||||
const uint16 width,
|
||||
const uint16 height
|
||||
) {
|
||||
}
|
||||
|
||||
/*****************************************************************************/
|
||||
/* Palette Setting */
|
||||
|
||||
#ifndef _WIN32
|
||||
void setPaletteHook(
|
||||
void *paletteMinusFour
|
||||
) {
|
||||
#if 0
|
||||
cSVGASetPalette(paletteMinusFour);
|
||||
#endif
|
||||
}
|
||||
#endif
|
||||
|
||||
/*****************************************************************************/
|
||||
/* Error Hook */
|
||||
|
||||
void videoErrorHook(
|
||||
const char *errMsg
|
||||
) {
|
||||
fprintf(stderr, errMsg);
|
||||
}
|
||||
#endif
|
||||
|
||||
} // end of namespace Saga2
|
@ -1,297 +0,0 @@
|
||||
/* ScummVM - Graphic Adventure Engine
|
||||
*
|
||||
* ScummVM is the legal property of its developers, whose names
|
||||
* are too numerous to list here. Please refer to the COPYRIGHT
|
||||
* file distributed with this source distribution.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License
|
||||
* as published by the Free Software Foundation; either version 2
|
||||
* of the License, or (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* aint32 with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||
*
|
||||
*
|
||||
* Based on the original sources
|
||||
* Faery Tale II -- The Halls of the Dead
|
||||
* (c) 1993-1996 The Wyrmkeep Entertainment Co.
|
||||
*/
|
||||
|
||||
#define FORBIDDEN_SYMBOL_ALLOW_ALL // FIXME: Remove
|
||||
|
||||
#include "saga2/std.h"
|
||||
#include "saga2/video.h"
|
||||
|
||||
namespace Saga2 {
|
||||
|
||||
// ------------------------------------------------------------------
|
||||
// Make sure we're actually using it
|
||||
|
||||
#if USE_SMK
|
||||
|
||||
/* ===================================================================== *
|
||||
definitions
|
||||
* ===================================================================== */
|
||||
|
||||
#ifndef _WIN32
|
||||
#define LOCK_MEM TRUE
|
||||
#else
|
||||
#define LOCK_MEM FALSE
|
||||
#endif
|
||||
|
||||
/* ===================================================================== *
|
||||
declarations
|
||||
* ===================================================================== */
|
||||
|
||||
extern char tNameBuffer[]; // filename storage for debugging
|
||||
|
||||
char errMsg[80];
|
||||
|
||||
/* ===================================================================== *
|
||||
VideoPlayer object implementation
|
||||
* ===================================================================== */
|
||||
|
||||
// ------------------------------------------------------------------
|
||||
// initialization
|
||||
|
||||
#ifndef _WIN32
|
||||
void VideoPlayer::InitSMK(uint32 maxTimer, bool UseBuffer)
|
||||
#else
|
||||
void VideoPlayer::InitSMK(uint32, bool)
|
||||
#endif
|
||||
{
|
||||
vleft = 128;
|
||||
vright = 128;
|
||||
changePalette = 1;
|
||||
restoreChangePalette = 1;
|
||||
dumpStats = FALSE;
|
||||
smk = NULL;
|
||||
|
||||
warning("STUB: InitSMK");
|
||||
|
||||
#if 0
|
||||
if (dig)
|
||||
//SetSmackAILDigDriver(dig,maxTimer);
|
||||
#ifndef _WIN32
|
||||
SmackSoundUseMSS(dig, maxTimer);
|
||||
#else
|
||||
SmackSoundUseMSS(dig);
|
||||
#endif
|
||||
else
|
||||
#ifndef _WIN32
|
||||
SmackSoundUseMSS(NULL, maxTimer);
|
||||
#else
|
||||
SmackSoundUseMSS(NULL);
|
||||
#endif
|
||||
#ifndef _WIN32
|
||||
if (!UseBuffer) {
|
||||
//SmackInitSVGA();
|
||||
SVGADetect(1);
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif
|
||||
}
|
||||
|
||||
// ------------------------------------------------------------------
|
||||
// cleanup
|
||||
|
||||
void VideoPlayer::TermSMK(void) {
|
||||
}
|
||||
|
||||
// ------------------------------------------------------------------
|
||||
// palette twiddling for Windows
|
||||
|
||||
#ifdef _WIN32
|
||||
|
||||
LRESULT VideoPlayer::OnPaletteChanged(HWND win_handle, WORD wparam, LONG lparam) {
|
||||
if ((HWND)wparam == win_handle)
|
||||
return (0L);
|
||||
return ((smBuf) ? SmackBufferSetPalette(smBuf) : 0);
|
||||
}
|
||||
|
||||
LRESULT VideoPlayer::OnQueryNewPalette(HWND win_handle, WORD wparam, LONG lparam) {
|
||||
return ((smBuf) ? SmackBufferSetPalette(smBuf) : 0);
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
// ------------------------------------------------------------------
|
||||
// START command
|
||||
|
||||
bool VideoPlayer::StartSMK(char *filespec,
|
||||
uint16 xxx, uint16 yyy,
|
||||
uint32 extraBuf,
|
||||
bool noSkip
|
||||
) {
|
||||
warning("STUB: StartSMK");
|
||||
return TRUE;
|
||||
#if 0
|
||||
|
||||
#ifdef _WIN32
|
||||
toBuffer = FALSE;
|
||||
smBuf = SmackBufferOpen(hWnd, SMACKAUTOBLIT, bufferWidth, bufferHeight, 0, 0);
|
||||
if (smBuf == NULL) {
|
||||
return FALSE;
|
||||
}
|
||||
#endif
|
||||
//smk=SmackOpen(filespec,SMACKTRACKS ,0); //| (noSkip ? SMACKNOSKIP : 0), extraBuf);
|
||||
|
||||
smk = SmackOpen(filespec, SMACKTRACKS | (noSkip ? SMACKNOSKIP : 0), extraBuf);
|
||||
|
||||
if (smk) {
|
||||
#ifndef _WIN32
|
||||
if (toBuffer) {
|
||||
buffer = videoAlloc(bufferWidth * bufferHeight, "VidWorkBuf");
|
||||
if (buffer == NULL) {
|
||||
SmackClose(smk);
|
||||
smk = NULL;
|
||||
return FALSE;
|
||||
}
|
||||
}
|
||||
if (toBuffer)
|
||||
SmackToBuffer(smk, 0, 0, bufferWidth, bufferHeight, buffer, FALSE);
|
||||
else {
|
||||
SetSmackerSVGA();
|
||||
SmackToScreen(smk, xxx, yyy, SVGABytesPS(), SVGAWinTbl(), SVGASetBank());
|
||||
}
|
||||
#else
|
||||
SmackToBuffer(smk, (smBuf->Width - smk->Width) / 2, (smBuf->Height - smk->Height) / 2, smBuf->Width, smBuf->Height, smBuf->Buffer, (u8)smBuf->Reversed);
|
||||
while (SmackToBufferRect(smk, smBuf->SurfaceType)) {
|
||||
SmackBufferBlit(smBuf, 0, 0, 0, smk->LastRectx, smk->LastRecty, smk->LastRectw, smk->LastRecth);
|
||||
}
|
||||
#endif
|
||||
videoWidth = smk->Width;
|
||||
videoHeight = smk->Height;
|
||||
StartFrame = TRUE;
|
||||
//SmackVolume(smk,SMACKTRACK1,vleft,vright);
|
||||
lvleft = vleft;
|
||||
lvright = vright;
|
||||
i = 1;
|
||||
return TRUE;
|
||||
}
|
||||
return FALSE;
|
||||
|
||||
#endif
|
||||
}
|
||||
|
||||
// ------------------------------------------------------------------
|
||||
// CHECK command
|
||||
|
||||
bool VideoPlayer::CheckSMK(void) {
|
||||
#if 0
|
||||
assert(smk);
|
||||
if (abort)
|
||||
i = smk->Frames + 1;
|
||||
if (i > smk->Frames) {
|
||||
EndPlay();
|
||||
return FALSE;
|
||||
}
|
||||
if (StartFrame) {
|
||||
#ifndef _WIN32
|
||||
if (smk->NewPalette && changePalette)
|
||||
//setPaletteHook((smk->NewPalette==1)?smk->Col1:smk->Col2);
|
||||
setPaletteHook(smk->Palette);
|
||||
#else
|
||||
if (smk->NewPalette) {
|
||||
SmackBufferNewPalette(smBuf, smk->Palette, 0);
|
||||
SmackColorRemap(smk, smBuf->Palette, smBuf->MaxPalColors, smBuf->PalType);
|
||||
}
|
||||
#endif
|
||||
|
||||
SmackDoFrame(smk);
|
||||
|
||||
#ifndef _WIN32
|
||||
if (toBuffer)
|
||||
bltBuffer();
|
||||
#else
|
||||
while (SmackToBufferRect(smk, smBuf->SurfaceType)) {
|
||||
if (SmackBufferBlit(smBuf, 0, 0, 0, smk->LastRectx, smk->LastRecty, smk->LastRectw, smk->LastRecth))
|
||||
break;
|
||||
}
|
||||
#endif
|
||||
StartFrame = FALSE;
|
||||
if (i < smk->Frames)
|
||||
SmackNextFrame(smk);
|
||||
i++;
|
||||
}
|
||||
if (lvleft != vleft || lvright != vright) {
|
||||
//SmackVolume(smk,SMACKTRACK1,vleft,vright);
|
||||
lvleft = vleft;
|
||||
lvright = vright;
|
||||
}
|
||||
if (!SmackWait(smk))
|
||||
StartFrame = TRUE;
|
||||
|
||||
#endif
|
||||
warning("STUB: CheckSMK");
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
|
||||
uint8 blackPal[1024];
|
||||
|
||||
// ------------------------------------------------------------------
|
||||
// END command
|
||||
|
||||
void VideoPlayer::EndSMK(void) {
|
||||
#if 0
|
||||
SmackSum ss;
|
||||
FILE *fp;
|
||||
char dNameBuffer[260];
|
||||
if (smk) {
|
||||
if (!abort) {
|
||||
while (SmackWait(smk));
|
||||
}
|
||||
if (dumpStats) {
|
||||
SmackSummary(smk, &ss);
|
||||
strcpy(dNameBuffer, tNameBuffer);
|
||||
strcpy(dNameBuffer + strlen(dNameBuffer) - 3, "DMP");
|
||||
if (NULL != (fp = fopen(dNameBuffer, "wt"))) {
|
||||
fprintf(fp, "File : %s\n", tNameBuffer);
|
||||
fprintf(fp, "Total time : %d\n", ss.TotalTime);
|
||||
fprintf(fp, "ms/100 frms: %d\n", ss.MS100PerFrame);
|
||||
fprintf(fp, "Total frms : %d\n", ss.TotalFrames);
|
||||
fprintf(fp, "Skippd frms: %d\n", ss.SkippedFrames);
|
||||
fprintf(fp, "Blit Time : %d\n", ss.TotalBlitTime);
|
||||
fprintf(fp, "Read Time : %d\n", ss.TotalReadTime);
|
||||
fprintf(fp, "Decomp Time: %d\n", ss.TotalReadTime);
|
||||
fclose(fp);
|
||||
}
|
||||
}
|
||||
memset(blackPal, 1024, '\0');
|
||||
setPaletteHook((void *)blackPal);
|
||||
SmackClose(smk);
|
||||
smk = NULL;
|
||||
if (toBuffer) {
|
||||
if (buffer)
|
||||
videoFree(buffer);
|
||||
}
|
||||
#ifndef _WIN32
|
||||
else {
|
||||
ClearSmackerSVGA();
|
||||
}
|
||||
#endif
|
||||
if (restoreChangePalette)
|
||||
changePalette = 1;
|
||||
}
|
||||
#ifdef _WIN32
|
||||
if (smBuf) {
|
||||
SmackBufferClose(smBuf);
|
||||
smBuf = NULL;
|
||||
}
|
||||
#endif
|
||||
#endif
|
||||
warning("STUB: EndSMK");
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
} // end of namespace Saga2
|
Loading…
Reference in New Issue
Block a user