TONY: More header files and functionality added

This commit is contained in:
Paul Gilbert 2012-04-30 23:16:19 +10:00
parent b0eef82972
commit 68bcaa61b9
21 changed files with 4512 additions and 26 deletions

View file

@ -48,8 +48,24 @@
#ifndef TONY_ADV_H #ifndef TONY_ADV_H
#define TONY_ADV_H #define TONY_ADV_H
#include "tony/mpal/memory.h"
#include "tony/gfxcore.h"
namespace Tony { namespace Tony {
// X & Y dimensions of the adventure
#define RM_SX 640
#define RM_SY 480
// Dimensioni X&Y del bigbuf
#define RM_BBX (RM_SX)
#define RM_BBY (RM_SY)
// Skipping X&Y
#define RM_SKIPY ((RM_BBY - RM_SY) / 2)
#define RM_SKIPX 0
// Tony's actions // Tony's actions
enum RMTonyAction { enum RMTonyAction {
TA_GOTO = 0, TA_GOTO = 0,
@ -65,6 +81,25 @@ enum RMTonyAction {
TA_RECEIVECOMBINEGIVE TA_RECEIVECOMBINEGIVE
}; };
// Funzioni globali
HANDLE MainLoadLocation(int nLoc, RMPoint pt, RMPoint start);
HANDLE MainUnloadLocation(bool bDoOnExit);
void MainLinkGraphicTask(RMGfxTask *task);
void MainFreeze(void);
void MainUnfreeze(void);
void MainWaitFrame(void);
void MainShowMouse(void);
void MainHideMouse(void);
void MainEnableInput(void);
void MainDisableInput(void);
void MainPlayMusic(int nChannel, const char *fn, int nFX, bool bLoop, int nSync);
void MainInitWipe(int type);
void MainCloseWipe(void);
void MainWaitWipeEnd(void);
void MainEnableGUI(void);
void MainDisableGUI(void);
void MainSetPalesati(bool bPalesati);
} // End of namespace Tony } // End of namespace Tony
#endif #endif

2511
engines/tony/custom.cpp Normal file

File diff suppressed because it is too large Load diff

106
engines/tony/custom.h Normal file
View file

@ -0,0 +1,106 @@
/* 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.
*
*
*/
/**************************************************************************
* ÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍ *
* Nayma Software srl *
* e -= We create much MORE than ALL =- *
* u- z$$$c '. ÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍ *
* .d" d$$$$$b "b. *
* .z$* d$$$$$$$L ^*$c. *
* #$$$. $$$$$$$$$ .$$$" Project: Roasted Moths........ *
* ^*$b 4$$$$$$$$$F .d$*" *
* ^$$. 4$$$$$$$$$F .$P" Module: Custom.CPP........... *
* *$. '$$$$$$$$$ 4$P 4 *
* J *$ "$$$$$$$" $P r Author: Giovanni Bajo........ *
* z$ '$$$P*4c.*$$$*.z@*R$$$ $. *
* z$" "" #$F^ "" '$c Desc: Custom functions..... *
* z$$beu .ue=" $ "=e.. .zed$$c ..................... *
* "#$e z$*" . `. ^*Nc e$"" ..................... *
* "$$". .r" ^4. .^$$" ..................... *
* ^.@*"6L=\ebu^+C$"*b." *
* "**$. "c 4$$$ J" J$P*" OS: [ ] DOS [X] WIN95 [ ] PORT *
* ^"--.^ 9$" .--"" COMP: [ ] WATCOM [X] VISUAL C++ *
* " [ ] EIFFEL [ ] GCC/GXX/DJGPP *
* *
* This source code is Copyright (C) Nayma Software. ALL RIGHTS RESERVED *
* *
**************************************************************************
/** RCS
*
* $Id: $
*
**/
#ifndef TONY_CUSTOM_H
#define TONY_CUSTOM_H
#include "tony/mpal/mpal.h"
namespace Tony {
using namespace MPAL;
/*
* Defines
*/
typedef uint32 HWND;
typedef void __declspec(dllexport) (*INIT_CUSTOM_FUNCTION_TYPE)(HWND, LPCUSTOMFUNCTION *);
#define INIT_CUSTOM_FUNCTION MapCustomFunctions
#define INIT_CUSTOM_FUNCTION_STRING "MapCustomFunctions"
#define DECLARE_CUSTOM_FUNCTION(x) void x
#define BEGIN_CUSTOM_FUNCTION_MAP() \
static void AssignError(HWND hWnd, int num) { \
error("Custom function %u has been already assigned!", num); \
} \
void INIT_CUSTOM_FUNCTION(HWND hWnd, LPCUSTOMFUNCTION *lpMap) \
{
#define END_CUSTOM_FUNCTION_MAP() \
}
#define ASSIGN(num,func) \
if (lpMap[num]!=NULL) \
AssignError(hWnd,num); \
lpMap[num]=func;
class RMTony;
class RMPointer;
class RMGameBoxes;
class RMLocation;
class RMInventory;
class RMInput;
void INIT_CUSTOM_FUNCTION(HWND hWnd, LPCUSTOMFUNCTION *lpMap);
void SetupGlobalVars(RMTony *tony, RMPointer *ptr, RMGameBoxes *box, RMLocation *loc, RMInventory *inv, RMInput *input);
#endif
} // end of namespace Tony

View file

@ -43,6 +43,10 @@ Common::Language TonyEngine::getLanguage() const {
return _gameDescription->desc.language; return _gameDescription->desc.language;
} }
bool TonyEngine::getIsDemo() const {
return _gameDescription->desc.flags & ADGF_DEMO;
}
} }
static const PlainGameDescriptor tonyGames[] = { static const PlainGameDescriptor tonyGames[] = {

View file

@ -55,6 +55,8 @@
namespace Tony { namespace Tony {
class RMInventory; class RMInventory;
class RMLoc;
class RMItem;
/** /**
* Gestisce un font, in cui ha varie surface per ogni lettera * Gestisce un font, in cui ha varie surface per ogni lettera
@ -318,7 +320,7 @@ class RMTextItemName : protected RMText {
protected: protected:
RMPoint m_mpos; RMPoint m_mpos;
RMPoint m_curscroll; RMPoint m_curscroll;
RMItem* m_item; RMItem *m_item;
RMString m_itemName; RMString m_itemName;
public: public:
@ -330,10 +332,10 @@ public:
void DoFrame(RMGfxTargetBuffer &bigBuf, RMLocation &loc, RMPointer &ptr, RMInventory &inv); void DoFrame(RMGfxTargetBuffer &bigBuf, RMLocation &loc, RMPointer &ptr, RMInventory &inv);
virtual void Draw(RMGfxTargetBuffer& bigBuf, RMGfxPrimitive* prim); virtual void Draw(RMGfxTargetBuffer& bigBuf, RMGfxPrimitive* prim);
RMPoint GetHotspot() { if (m_item==NULL) return m_mpos+m_curscroll; else return m_item->Hotspot(); } RMPoint GetHotspot();
RMItem* GetSelectedItem() { return m_item; } RMItem *GetSelectedItem();
bool IsItemSelected() { return m_item!=NULL; } bool IsItemSelected();
bool IsNormalItemSelected() { return m_item!=NULL && m_itemName.Length()>0; } bool IsNormalItemSelected();
virtual bool RemoveThis() { return true; } virtual bool RemoveThis() { return true; }
}; };

File diff suppressed because it is too large Load diff

View file

@ -237,7 +237,7 @@ class RMGfxSourceBuffer : public virtual RMGfxBuffer, public RMGfxTaskSetPrior {
public: public:
// Carica i dati della surface a basso livello // Carica i dati della surface a basso livello
virtual int Init(uint32 resID, int dimx, int dimy, bool bLoadPalette = false); virtual int Init(uint32 resID, int dimx, int dimy, bool bLoadPalette = false);
virtual int Init(byte *buf, int dimx, int dimy, bool bLoadPalette = false); virtual int Init(const byte *buf, int dimx, int dimy, bool bLoadPalette = false);
virtual void Init(RMDataStream &ds, int dimx, int dimy, bool bLoadPalette = false); virtual void Init(RMDataStream &ds, int dimx, int dimy, bool bLoadPalette = false);
virtual ~RMGfxSourceBuffer(); virtual ~RMGfxSourceBuffer();

View file

@ -145,8 +145,8 @@ public:
void Unfreeze(void); void Unfreeze(void);
// State management // State management
void SaveState(char *fn, byte *curThumb, char *name, bool bFastCompress = false); void SaveState(const char *fn, byte *curThumb, const char *name, bool bFastCompress = false);
void LoadState(char *fn); void LoadState(const char *fn);
// Selects a location // Selects a location
void SelectLocation(RMPoint ptTonyStart=RMPoint(-1,-1), RMPoint start=RMPoint(-1,-1)); void SelectLocation(RMPoint ptTonyStart=RMPoint(-1,-1), RMPoint start=RMPoint(-1,-1));

View file

@ -75,7 +75,7 @@ public:
~RMInput(); ~RMInput();
// Class initialisation // Class initialisation
void Init(uint32 hInst); void Init(/*uint32 hInst*/);
// Closes the class // Closes the class
void Close(void); void Close(void);

View file

@ -541,7 +541,7 @@ public:
// Caricamento da disco // Caricamento da disco
bool Load(char *lpszFileName); bool Load(char *lpszFileName);
bool Load(HANDLE hFile); bool Load(HANDLE hFile);
bool Load(byte *buf); bool Load(const byte *buf);
bool Load(RMDataStream &ds); bool Load(RMDataStream &ds);
bool LoadLOX(RMDataStream &ds); bool LoadLOX(RMDataStream &ds);
@ -561,10 +561,10 @@ public:
RMItem* GetItemFromCode(uint32 dwCode); RMItem* GetItemFromCode(uint32 dwCode);
// Setta la posizione corrente di scrolling // Setta la posizione corrente di scrolling
void SetScrollPosition(RMPoint &scroll); void SetScrollPosition(const RMPoint &scroll);
// Setta un offset aggiuntivo di scrolling da aggiungere sempre // Setta un offset aggiuntivo di scrolling da aggiungere sempre
void SetFixedScroll(RMPoint &scroll); void SetFixedScroll(const RMPoint &scroll);
// Aggiorna le coordinate di scrolling in modo da visualizzare sempre il punto fornito // Aggiorna le coordinate di scrolling in modo da visualizzare sempre il punto fornito
void UpdateScrolling(RMPoint ptShowThis); void UpdateScrolling(RMPoint ptShowThis);

View file

@ -1,6 +1,7 @@
MODULE := engines/tony MODULE := engines/tony
MODULE_OBJS := \ MODULE_OBJS := \
custom.o \
detection.o \ detection.o \
game.o \ game.o \
gfxcore.o \ gfxcore.o \

View file

@ -63,6 +63,7 @@
*/ */
#include "lzo.h" #include "lzo.h"
#include "common/textconsole.h"
namespace Tony { namespace Tony {
@ -505,6 +506,19 @@ lookbehind_overrun:
#endif #endif
} }
int lzo1x_1_compress(const byte *src, uint32 src_len, byte *dst, uint32 *dst_len, void *wrkmem) {
warning("TODO: lzo1x_1_compress");
return 0;
}
/**
* better compression ratio at the cost of more memory and time
*/
int lzo1x_999_compress(const byte *src, uint32 src_len, byte *dst, uint32 *dst_len, void *wrkmem) {
warning("TODO: lzo1x_999_compress");
return 0;
}
} // end of namespace MPAL } // end of namespace MPAL
} // end of namespace Tony } // end of namespace Tony

View file

@ -87,12 +87,23 @@ namespace MPAL {
#define LZO_E_NOT_YET_IMPLEMENTED (-9) /* [not used right now] */ #define LZO_E_NOT_YET_IMPLEMENTED (-9) /* [not used right now] */
#define LZO_E_INVALID_ARGUMENT (-10) #define LZO_E_INVALID_ARGUMENT (-10)
#define LZO1X_999_MEM_COMPRESS ((uint32) (14 * 16384L * sizeof(uint16)))
/** /**
* Decompresses an LZO compressed resource * Decompresses an LZO compressed resource
*/ */
int lzo1x_decompress(const byte *src, uint32 src_len, byte *dst, uint32 *dst_len); int lzo1x_decompress(const byte *src, uint32 src_len, byte *dst, uint32 *dst_len);
/**
* Comrpess a data block into an LZO stream
*/
int lzo1x_1_compress(const byte *src, uint32 src_len, byte *dst, uint32 *dst_len, void *wrkmem);
/**
* better compression ratio at the cost of more memory and time
*/
int lzo1x_999_compress(const byte *src, uint32 src_len, byte *dst, uint32 *dst_len, void *wrkmem);
} // end of namespace MPAL } // end of namespace MPAL
} // end of namespace Tony } // end of namespace Tony

View file

@ -59,9 +59,15 @@ HANDLE CreateThread(void *lpThreadAttributes, size_t dwStackSize,
return 0; return 0;
} }
void _beginthread(LPTHREAD_ROUTINE lpStartAddress, size_t dwStackSize, void *lpParameter) {
}
void ExitThread(int ThreadId) { void ExitThread(int ThreadId) {
} }
void _endthread() {
}
void TerminateThread(HANDLE ThreadId, uint32 dwExitCode) { void TerminateThread(HANDLE ThreadId, uint32 dwExitCode) {
} }
@ -91,6 +97,10 @@ void SetEvent(HANDLE hEvent) {
void ResetEvent(HANDLE hEvent) { void ResetEvent(HANDLE hEvent) {
} }
uint16 GetAsyncKeyState(Common::KeyCode kc) {
return 0;
}
} // end of namespace MPAL } // end of namespace MPAL
} // end of namespace Tony } // end of namespace Tony

View file

@ -31,6 +31,7 @@
#include "common/scummsys.h" #include "common/scummsys.h"
#include "common/algorithm.h" #include "common/algorithm.h"
#include "common/keyboard.h"
#include "tony/mpal/memory.h" #include "tony/mpal/memory.h"
namespace Tony { namespace Tony {
@ -42,6 +43,7 @@ namespace MPAL {
\****************************************************************************/ \****************************************************************************/
typedef uint32 (*LPTHREAD_START_ROUTINE)(void *lpThreadParameter); typedef uint32 (*LPTHREAD_START_ROUTINE)(void *lpThreadParameter);
typedef void (*LPTHREAD_ROUTINE)(void *lpThreadParameter);
/****************************************************************************\ /****************************************************************************\
* Defines * Defines
@ -82,8 +84,12 @@ extern HANDLE CreateThread(void *lpThreadAttributes, size_t dwStackSize,
LPTHREAD_START_ROUTINE lpStartAddress, void *lpParameter, LPTHREAD_START_ROUTINE lpStartAddress, void *lpParameter,
uint32 dwCreationFlags, uint32 *lpThreadId); uint32 dwCreationFlags, uint32 *lpThreadId);
extern void _beginthread(LPTHREAD_ROUTINE lpStartAddress, size_t dwStackSize, void *lpParameter);
extern void ExitThread(int ThreadId); extern void ExitThread(int ThreadId);
extern void _endthread();
extern void TerminateThread(HANDLE ThreadId, uint32 dwExitCode); extern void TerminateThread(HANDLE ThreadId, uint32 dwExitCode);
extern void CloseHandle(HANDLE ThreadId); extern void CloseHandle(HANDLE ThreadId);
@ -100,6 +106,8 @@ extern void SetEvent(HANDLE hEvent);
extern void ResetEvent(HANDLE hEvent); extern void ResetEvent(HANDLE hEvent);
extern uint16 GetAsyncKeyState(Common::KeyCode kc);
} // end of namespace MPAL } // end of namespace MPAL
} // end of namespace Tony } // end of namespace Tony

View file

@ -54,7 +54,9 @@
namespace Tony { namespace Tony {
class FPSTREAM;
class FPSFX; class FPSFX;
class CODEC;
enum CODECS { enum CODECS {
FPCODEC_RAW, FPCODEC_RAW,
@ -62,6 +64,144 @@ enum CODECS {
FPCODEC_WAV FPCODEC_WAV
}; };
/****************************************************************************\
*****************************************************************************
* class FPSound
* -------------
* Description: Sound driver per Falling Pumpkins
*****************************************************************************
\****************************************************************************/
class FPSOUND {
private:
bool bSoundSupported;
/*
LPDIRECTSOUND lpDS;
LPDIRECTSOUNDBUFFER lpDSBPrimary;
DSCAPS dscaps;
HWND hwnd;
*/
/****************************************************************************\
* Metodi
\****************************************************************************/
public:
/****************************************************************************\
*
* Function: FPSOUND::FPSOUND();
*
* Description: Costruttore di default. Inizializza gli attributi.
*
\****************************************************************************/
FPSOUND();
/****************************************************************************\
*
* Function: FPSOUND::~FPSOUND();
*
* Description: Deinizializza l'oggetto, disallocando la memoria.
*
\****************************************************************************/
~FPSOUND();
/****************************************************************************\
*
* Function: bool FPSOUND::Init(HWND hWnd);
*
* Description: Inizializza l'oggetto, e prepara tutto il necessario per
* creare stream e effetti sonori.
*
* Input: HWND hWnd Handle della finestra principale
*
* Return: True se tutto OK, FALSE in caso di errore.
*
\****************************************************************************/
bool Init(/*HWND hWnd*/);
/****************************************************************************\
*
* Function: bool CreateStream(FPSTREAM** lplpStream);
*
* Description: Alloca un oggetti di tipo FPSTREAM, e ritorna il suo
* puntatore dopo averlo inizializzato.
*
* Input: FPSTREAM** lplpStream Conterra' il pointer all'oggetto
* appena creato.
*
* Return: TRUE se tutto OK, FALSE in caso di errore
*
* Note: L'utilizzo di funzioni del tipo CreateStream(), CreateSfx(),
* sono dovute al fatto che i costruttori delle classi FPSTREAM
* e FPSFX richiedono che DirectSound sia gia' stato
* inzializzato. In questo modo quindi si evitano dei bugs
* che si verrebbero a creare se venisse dichiarata un oggetto
* di tipo FPSTREAM o FPSFX globale (o cmq prima della
* inizializzazione di DirectSound).
*
\****************************************************************************/
bool CreateStream(FPSTREAM **lplpStream);
/****************************************************************************\
*
* Function: bool CreateSfx(FPSFX** lplpSfx);
*
* Description: Alloca un oggetti di tipo FPSFX e ritorna il suo
* puntatore dopo averlo inizializzato.
*
* Input: FPSFX** lplpSfx Conterra' il pointer all'oggetto
* appena creato.
*
* Return: TRUE se tutto OK, FALSE in caso di errore
*
* Note: Vedi le note di CreateStream()
*
\****************************************************************************/
bool CreateSfx(FPSFX **lplpSfx);
/****************************************************************************\
*
* Function: void SetMasterVolume(int dwVolume);
*
* Description: Setta il volume generale
*
* Input: int dwVolume Volume da settare (0-63)
*
\****************************************************************************/
void SetMasterVolume(int dwVolume);
/****************************************************************************\
*
* Function: void GetMasterVolume(LPINT lpdwVolume);
*
* Description: Richiede il volume generale
*
* Input: LPINT lpdwVolume Variabile che conterra' il volume (0-63)
*
\****************************************************************************/
void GetMasterVolume(int *lpdwVolume);
};
class FPSFX { class FPSFX {
/****************************************************************************\ /****************************************************************************\
@ -93,7 +233,7 @@ private:
// DSBPOSITIONNOTIFY dspnHot[2]; // DSBPOSITIONNOTIFY dspnHot[2];
public: public:
// HANDLE hEndOfBuffer; HANDLE hEndOfBuffer;
private: private:
@ -159,9 +299,9 @@ public:
* *
\****************************************************************************/ \****************************************************************************/
bool LoadFile(char *lpszFileName, uint32 dwCodec = FPCODEC_RAW); bool LoadFile(char *lpszFileName, uint32 dwCodec = FPCODEC_RAW);
bool LoadFile(byte *lpBuf, uint32 dwCodec); bool LoadFile(byte *lpBuf, uint32 dwCodec);
bool LoadVoiceFromVDB(HANDLE hvdb); bool LoadVoiceFromVDB(Common::File &hvdb);
/****************************************************************************\ /****************************************************************************\
@ -249,6 +389,223 @@ public:
void GetVolume(int * lpdwVolume); void GetVolume(int * lpdwVolume);
}; };
class FPSTREAM {
/****************************************************************************\
* Attributi
\****************************************************************************/
private:
/*
HWND hwnd;
LPDIRECTSOUND lpDS;
LPDIRECTSOUNDBUFFER lpDSBuffer; // Buffer DirectSound circolare
LPDIRECTSOUNDNOTIFY lpDSNotify; // Notify degli hotspot nel buffer
*/
byte *lpTempBuffer; // Buffer temporaneo per decompressione
uint32 dwBufferSize; // Dimensione del buffer in bytes
uint32 dwSize; // Dimensione dello stream in bytes
uint32 dwCodec; // CODEC utilizzato
HANDLE hThreadEnd; // Evento per chiudere il thread
HANDLE hFile; // Handle del file di stream
HANDLE hPlayThread; // Handle del thread di play
HANDLE hHot1, hHot2, hHot3; // Eventi settati da DirectSoundNotify
HANDLE hPlayThread_PlayFast;
HANDLE hPlayThread_PlayNormal;
bool bSoundSupported; // TRUE se il suono e' attivo
bool bFileLoaded; // TRUE se e' stato aperto un file
bool bLoop; // TRUE se bisogna loopare lo stream
bool bDoFadeOut; // TRUE se bisogna fare un fade out
bool bSyncExit;
bool bPaused;
int lastVolume;
FPSTREAM *SyncToPlay;
// DSBPOSITIONNOTIFY dspnHot[3];
CODEC *lpCodec; // CODEC da utilizzare.
bool CreateBuffer(int nBufSize);
public:
bool bIsPlaying; // TRUE se si sta playando lo stream
private:
static void PlayThread(FPSTREAM *This);
/****************************************************************************\
* Metodi
\****************************************************************************/
public:
/****************************************************************************\
*
* Function: FPSTREAM(LPDIRECTSOUND lpDS, bool bSoundOn);
*
* Description: Costruttore di default. *NON* bisogna dichiarare direttamente
* un oggetto, ma crearlo piuttosto tramite FPSOUND::CreateStream()
*
\****************************************************************************/
FPSTREAM(void * /*LPDIRECTSOUND*/ lpDS, uint32 /*HWND hWnd */, bool bSoundOn);
/****************************************************************************\
*
* Function: ~FPSTREAM();
*
* Description: Distruttore di default. Si preoccupa anche di fermare stream
* eventualmente in esecuzione, e disallocare la memoria da
* essi occupata.
*
\****************************************************************************/
~FPSTREAM();
/****************************************************************************\
*
* Function: Release();
*
* Description: Rilascia la memoria dell'oggetto. Deve essere richiamata quando
* l'oggetto non serve piu' e **SOLO SE** l'oggetto e' stato
* creato con la FPSOUND::CreateStream().
*
* Note: Eventuali puntatori all'oggetto non sono piu' validi dopo
* questa chiamata.
*
\****************************************************************************/
void Release();
/****************************************************************************\
*
* Function: bool LoadFile(char *lpszFileName, uint32 dwCodec=FPCODEC_RAW);
*
* Description: Apre un file di stream.
*
* Input: char *lpszFile Nome del file di stream da aprire
* uint32 dwCodec CODEC da utilizzare per decomprimere
* i campioni sonori
*
* Return: TRUE se tutto OK, FALSE in caso di errore
*
\****************************************************************************/
bool LoadFile(char *lpszFileName, uint32 dwCodec = FPCODEC_RAW, int nSync = 2000);
/****************************************************************************\
*
* Function: UnloadFile();
*
* Description: Chiude un file di stream eventualmente aperto. E' necessario
* richiamare questa funzione per disallocare la memoria
* occupata dallo stream.
*
* Return: Il distruttore della classe per sicurezza richiama la
* UnloadFile() se non e' stata richiamata esplicitamente.
*
\****************************************************************************/
bool UnloadFile();
/****************************************************************************\
*
* Function: bool Play();
*
* Description: Suona lo stream caricato.
*
* Return: TRUE se tutto OK, FALSE in caso di errore.
*
\****************************************************************************/
bool Play();
void PlayFast(void);
void Prefetch(void);
/****************************************************************************\
*
* Function: bool Stop();
*
* Description: Ferma il play dello stream.
*
* Return: TRUE se tutto OK, FALSE in caso di errore.
*
\****************************************************************************/
bool Stop(bool bSync = false);
void WaitForSync(FPSTREAM* toplay);
/****************************************************************************\
*
* Function: void Pause(bool bPause);
*
* Description: Pause dell'effetto sonoro
*
\****************************************************************************/
void Pause(bool bPause);
/****************************************************************************\
*
* Function: bool SetLoop(bool bLoop);
*
* Description: Attiva o disattiva il loop dello stream.
*
* Input: bool bLoop TRUE per attivare il loop, FALSE per
* disattivarlo
*
* Note: Il loop deve essere attivato PRIMA di eseguire il play
* dello stream. Qualsiasi modifica effettuata durante il play
* non avra' effetto fino a che lo stream non viene fermato,
* e poi rimesso in play.
*
\****************************************************************************/
void SetLoop(bool bLoop);
/****************************************************************************\
*
* Function: void SetVolume(int dwVolume);
*
* Description: Cambia il volume dello stream
*
* Input: int dwVolume Volume da settare (0-63)
*
\****************************************************************************/
void SetVolume(int dwVolume);
/****************************************************************************\
*
* Function: void GetVolume(LPINT lpdwVolume);
*
* Description: Chiede il volume dello stream
*
* Input: LPINT lpdwVolume Variabile in cui verra' inserito
* il volume corrente
*
\****************************************************************************/
void GetVolume(int *lpdwVolume);
};
} // End of namespace Tony } // End of namespace Tony
#endif #endif

View file

@ -49,10 +49,9 @@ Common::Error TonyEngine::run() {
if (result != Common::kNoError) if (result != Common::kNoError)
return result; return result;
/*
Play(); Play();
Close(); Close();
*/
return Common::kNoError; return Common::kNoError;
} }
@ -60,6 +59,12 @@ Common::Error TonyEngine::run() {
* Initialise the game * Initialise the game
*/ */
Common::ErrorCode TonyEngine::Init() { Common::ErrorCode TonyEngine::Init() {
m_hEndOfFrame = CreateEvent(NULL, false, false, NULL);
m_bPaused = false;
m_bDrawLocation = true;
m_startTime = g_system->getMillis();
// Initialise the function list // Initialise the function list
Common::fill(FuncList, FuncList + 300, (LPCUSTOMFUNCTION)NULL); Common::fill(FuncList, FuncList + 300, (LPCUSTOMFUNCTION)NULL);
@ -98,6 +103,60 @@ void TonyEngine::GUIError(const Common::String &msg) {
GUIErrorMessage(msg); GUIErrorMessage(msg);
} }
char nextMusic[_MAX_PATH];
bool nextLoop;
int nextChannel;
int nextSync;
int curChannel;
int flipflop=0;
OSystem::MutexRef csMusic;
void TonyEngine::PlayMusic(int nChannel, char* fn, int nFX, bool bLoop, int nSync) {
warning("TonyEngine::PlayMusic");
}
void TonyEngine::PlaySFX(int nChannel, int nFX) {
warning("TonyEngine::PlaySFX");
}
void TonyEngine::StopMusic(int nChannel) {
warning("TonyEngine::StopMusic");
}
void TonyEngine::StopSFX(int nChannel) {
warning("TonyEngine::StopSFX");
}
void TonyEngine::PlayUtilSFX(int nChannel, int nFX) {
warning("TonyEngine::PlayUtilSFX");
}
void TonyEngine::StopUtilSFX(int nChannel) {
warning("TonyEngine::StopUtilSFX");
}
void TonyEngine::PreloadSFX(int nChannel, char* fn) {
warning("TonyEngine::PreloadSFX");
}
FPSFX *TonyEngine::CreateSFX(byte *buf) {
warning("TonyEngine::CreateSFX");
return NULL;
}
void TonyEngine::PreloadUtilSFX(int nChannel, char *fn) {
warning("TonyEngine::PreloadUtilSFX");
}
void TonyEngine::UnloadAllSFX(void) {
warning("TonyEngine::UnloadAllSFX");
}
void TonyEngine::UnloadAllUtilSFX(void) {
warning("TonyEngine::UnloadAllUtilSFX");
}
void TonyEngine::InitMusic() { void TonyEngine::InitMusic() {
warning("TODO: TonyEngine::InitMusic"); warning("TODO: TonyEngine::InitMusic");
} }
@ -160,4 +219,9 @@ void TonyEngine::CloseVoiceDatabase() {
_voices.clear(); _voices.clear();
} }
void TonyEngine::GrabThumbnail(void) {
//m_wnd.GrabThumbnail(m_curThumbnail);
warning("TODO: TonyEngine::GrabThumbnail");
}
} // End of namespace Tony } // End of namespace Tony

View file

@ -36,6 +36,7 @@
#include "tony/gfxEngine.h" #include "tony/gfxEngine.h"
#include "tony/loc.h" #include "tony/loc.h"
#include "tony/utils.h" #include "tony/utils.h"
#include "tony/window.h"
/** /**
* This is the namespace of the Tony engine. * This is the namespace of the Tony engine.
@ -72,11 +73,9 @@ struct VoiceHeader {
class TonyEngine : public Engine { class TonyEngine : public Engine {
private: private:
Common::ErrorCode Init(); Common::ErrorCode Init();
void InitMusic(); void InitMusic();
void CloseMusic(); void CloseMusic();
void PauseSound(bool bPause);
void SetMusicVolume(int nChannel, int volume);
int GetMusicVolume(int nChannel);
bool OpenVoiceDatabase(); bool OpenVoiceDatabase();
void CloseVoiceDatabase(); void CloseVoiceDatabase();
protected: protected:
@ -88,24 +87,105 @@ public:
Common::RandomSource _randomSource; Common::RandomSource _randomSource;
MPAL::MemoryManager _memoryManager; MPAL::MemoryManager _memoryManager;
RMResUpdate _resUpdate; RMResUpdate _resUpdate;
HANDLE m_hEndOfFrame;
Common::File _vdbFP; Common::File _vdbFP;
Common::Array<VoiceHeader> _voices; Common::Array<VoiceHeader> _voices;
FPSOUND _theSound;
// Bounding box list manager // Bounding box list manager
RMGameBoxes _theBoxes; RMGameBoxes _theBoxes;
RMGfxEngine _theEngine; RMGfxEngine _theEngine;
RMWindow m_wnd;
bool m_bPaused;
bool m_bDrawLocation;
int m_startTime;
uint16 *m_curThumbnail;
bool m_bQuitNow;
bool m_bTimeFreezed;
int m_nTimeFreezed;
enum DATADIR {
DD_BASE = 1,
DD_SAVE,
DD_SHOTS,
DD_MUSIC,
DD_LAYER,
DD_UTILSFX,
DD_VOICES,
DD_BASE2
};
public: public:
TonyEngine(OSystem *syst, const TonyGameDescription *gameDesc); TonyEngine(OSystem *syst, const TonyGameDescription *gameDesc);
virtual ~TonyEngine(); virtual ~TonyEngine();
const TonyGameDescription *_gameDescription; const TonyGameDescription *_gameDescription;
uint32 getGameID() const;
uint32 getFeatures() const; uint32 getFeatures() const;
Common::Language getLanguage() const; Common::Language getLanguage() const;
uint16 getVersion() const; uint16 getVersion() const;
uint32 getFlags() const; bool getIsDemo() const;
Common::Platform getPlatform() const; RMGfxEngine *GetEngine() { return &_theEngine; }
void GUIError(const Common::String &msg); void GUIError(const Common::String &msg);
void Play();
void Close();
void Abort();
void GetDataDirectory(DATADIR dir, char *path);
void SwitchFullscreen(bool bFull);
void OptionScreen(void);
void ShowLocation(void) { m_bDrawLocation = true; }
void HideLocation(void) { m_bDrawLocation = false; }
// Mette o leva la pausa
void Pause(bool bPause);
bool IsPaused() { return m_bPaused; }
// Reads the time
uint32 GetTime(void);
void FreezeTime(void);
void UnfreezeTime(void);
// Music
// ******
void PlayMusic(int nChannel, char *fn, int nFX, bool bLoop, int nSync);
void StopMusic(int nChannel);
void PlaySFX(int nSfx, int nFX = 0);
void StopSFX(int nSfx);
void PlayUtilSFX(int nSfx, int nFX = 0);
void StopUtilSFX(int nSfx);
FPSFX *CreateSFX(byte *buf);
void PreloadSFX(int nSfx, char *fn);
void UnloadAllSFX(void);
void PreloadUtilSFX(int nSfx, char *fn);
void UnloadAllUtilSFX(void);
// Ferma tutta la parte audio
void PauseSound(bool bPause);
void SetMusicVolume(int nChannel, int volume);
int GetMusicVolume(int nChannel);
// Salvataggio
void AutoSave(void);
void SaveState(int n, char *name);
void LoadState(int n);
void GetSaveStateFileName(int n, char* buf);
// Prende il thumbnail
void GrabThumbnail(void);
uint16 *GetThumbnail(void) { return m_curThumbnail; }
void Quit(void) { m_bQuitNow = true; }
void OpenInitLoadMenu(void);
void OpenInitOptions(void);
}; };
// Global reference to the TonyEngine object // Global reference to the TonyEngine object

View file

@ -49,6 +49,7 @@
#define TONY_TONYCHAR_H #define TONY_TONYCHAR_H
#include "tony/mpal/stubs.h" #include "tony/mpal/stubs.h"
#include "tony/loc.h"
namespace Tony { namespace Tony {

View file

@ -980,7 +980,7 @@ HGLOBAL RMResUpdate::QueryResource(uint32 dwRes) {
uint32 dwSize; uint32 dwSize;
// Decompress the data // Decompress the data
MPAL::lzo1x_decompress(cmpBuf, info.cmpSize, lpDestBuf, &dwSize); lzo1x_decompress(cmpBuf, info.cmpSize, lpDestBuf, &dwSize);
// Delete buffer for compressed data // Delete buffer for compressed data
delete [] cmpBuf; delete [] cmpBuf;

134
engines/tony/window.h Normal file
View file

@ -0,0 +1,134 @@
/* 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.
*
*/
/**************************************************************************
* ÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍ *
* Nayma Software srl *
* e -= We create much MORE than ALL =- *
* u- z$$$c '. ÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍ *
* .d" d$$$$$b "b. *
* .z$* d$$$$$$$L ^*$c. *
* #$$$. $$$$$$$$$ .$$$" Project: Roasted Moths........ *
* ^*$b 4$$$$$$$$$F .d$*" *
* ^$$. 4$$$$$$$$$F .$P" Module: Window.HPP........... *
* *$. '$$$$$$$$$ 4$P 4 *
* J *$ "$$$$$$$" $P r Author: Giovanni Bajo........ *
* z$ '$$$P*4c.*$$$*.z@*R$$$ $. *
* z$" "" #$F^ "" '$c Desc: Classi per la gestione *
* z$$beu .ue=" $ "=e.. .zed$$c di una finestra Direct
* "#$e z$*" . `. ^*Nc e$"" Draw................. *
* "$$". .r" ^4. .^$$" ..................... *
* ^.@*"6L=\ebu^+C$"*b." *
* "**$. "c 4$$$ J" J$P*" OS: [ ] DOS [X] WIN95 [ ] PORT *
* ^"--.^ 9$" .--"" COMP: [ ] WATCOM [X] VISUAL C++ *
* " [ ] EIFFEL [ ] GCC/GXX/DJGPP *
* *
* This source code is Copyright (C) Nayma Software. ALL RIGHTS RESERVED *
* *
**************************************************************************/
#ifndef TONY_WINDOW_H
#define TONY_WINDOW_H
#include "common/scummsys.h"
#include "common/rect.h"
namespace Tony {
typedef uint32 HWND;
class RMWindow {
private:
bool Lock(/*DDSURFACEDESC& ddsd */);
void Unlock(/*DDSURFACEDESC& ddsd */);
// Inizializza DirectDraw
void DDInit(void);
// Chiude DirectDraw
void DDClose(void);
// Repaint grafico tramite DirectDraw
void Repaint(void);
// Window Proc principale che richiama la WindowProc dentro la classe
// friend LRESULT CALLBACK GlobalWindowProc(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam);
// Procedura di gestione messaggi
// LRESULT WindowProc(UINT msg, WPARAM wParam, LPARAM lParam);
protected:
HWND m_hWnd;
bool m_bFullscreen;
void * /*LPDIRECTDRAW*/ m_DD;
void * /*LPDIRECTDRAWSURFACE*/ m_Primary;
void * /*LPDIRECTDRAWSURFACE*/ m_Back;
void * /*LPDIRECTDRAWCLIPPER*/ m_MainClipper;
void * /*LPDIRECTDRAWCLIPPER*/ m_BackClipper;
int fps, fcount;
int lastsecond, lastfcount;
int mskRed, mskGreen, mskBlue;
bool m_bGrabScreenshot;
bool m_bGrabThumbnail;
bool m_bGrabMovie;
uint16 *m_wThumbBuf;
void CreateBWPrecalcTable(void);
void UpdatePixelFormat(void);
void WipeEffect(Common::Rect &rcBoundEllipse);
public:
RMWindow() { m_Primary = NULL; m_Back = NULL; };
~RMWindow() { Close(); }
// Inizializzazione
void Init(/*HINSTANCE hInst*/);
void InitDirectDraw(void);
void Close(void);
// Switch tra windowed e fullscreen
void SwitchFullscreen(bool bFull);
// Legge il prossimo frame
void GetNewFrame(byte *lpBuf, Common::Rect *rcBoundEllipse);
// Avverte di grabbare un thumbnail per il salvataggio
// void GrabThumbnail(uint16 *buf);
operator HWND() { return m_hWnd; }
// Modi pixel format
// MODE1: 1555
// MODE2: 5515
// MODE3: 5551
bool ISMODE1() { return (mskRed == 0x7C00 && mskGreen == 0x3E0 && mskBlue== 0x1F); }
bool ISMODE2() { return (mskRed == 0xF800 && mskGreen == 0x7E0 && mskBlue== 0x1F); }
bool ISMODE3() { return (mskRed == 0xF800 && mskGreen == 0x7C0 && mskBlue== 0x3E); }
bool ISMODE4() { return (mskBlue == 0xF800 && mskGreen == 0x7E0 && mskRed== 0x1F); }
};
} // End of namespace Tony
#endif /* TONY_WINDOW_H */