From b0eef829728183b7ea170b30a33eca091bcc4574 Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Mon, 30 Apr 2012 09:27:12 +1000 Subject: TONY: Added include files for graphics engine and all dependent classes --- engines/tony/adv.h | 70 ++++++ engines/tony/font.h | 399 +++++++++++++++++++++++++++++++++ engines/tony/game.cpp | 54 +++++ engines/tony/game.h | 285 +++++++++++++++++++++++ engines/tony/gfxcore.cpp | 54 +++++ engines/tony/gfxcore.h | 547 +++++++++++++++++++++++++++++++++++++++++++++ engines/tony/gfxengine.cpp | 53 +++++ engines/tony/gfxengine.h | 167 ++++++++++++++ engines/tony/input.cpp | 54 +++++ engines/tony/input.h | 116 ++++++++++ engines/tony/inventory.h | 212 ++++++++++++++++++ engines/tony/loc.cpp | 8 +- engines/tony/loc.h | 488 +++++++++++++++++++++++++++++++++++++++- engines/tony/module.mk | 5 + engines/tony/mpal/memory.h | 4 + engines/tony/mpal/stubs.h | 4 - engines/tony/resid.h | 76 +++++++ engines/tony/sound.cpp | 54 +++++ engines/tony/sound.h | 254 +++++++++++++++++++++ engines/tony/tony.cpp | 3 + engines/tony/tony.h | 2 + engines/tony/tonychar.h | 448 +++++++++++++++++++++++++++++++++++++ engines/tony/utils.cpp | 10 +- engines/tony/utils.h | 10 +- 24 files changed, 3354 insertions(+), 23 deletions(-) create mode 100644 engines/tony/adv.h create mode 100644 engines/tony/font.h create mode 100644 engines/tony/game.cpp create mode 100644 engines/tony/game.h create mode 100644 engines/tony/gfxcore.cpp create mode 100644 engines/tony/gfxcore.h create mode 100644 engines/tony/gfxengine.cpp create mode 100644 engines/tony/gfxengine.h create mode 100644 engines/tony/input.cpp create mode 100644 engines/tony/input.h create mode 100644 engines/tony/inventory.h create mode 100644 engines/tony/resid.h create mode 100644 engines/tony/sound.cpp create mode 100644 engines/tony/sound.h create mode 100644 engines/tony/tonychar.h diff --git a/engines/tony/adv.h b/engines/tony/adv.h new file mode 100644 index 0000000000..b29e4eb0cd --- /dev/null +++ b/engines/tony/adv.h @@ -0,0 +1,70 @@ +/* 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: ADV.CPP.............. * + * *$. '$$$$$$$$$ 4$P 4 * + * J *$ "$$$$$$$" $P r Author: Giovanni Bajo........ * + * z$ '$$$P*4c.*$$$*.z@*R$$$ $. * + * z$" "" #$F^ "" '$c * + * 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 * + * * + **************************************************************************/ + +#ifndef TONY_ADV_H +#define TONY_ADV_H + +namespace Tony { + +// Tony's actions +enum RMTonyAction { + TA_GOTO = 0, + TA_TAKE, + TA_USE, + TA_EXAMINE, + TA_TALK, + TA_PALESATI, + + TA_COMBINE = 10, + TA_RECEIVECOMBINE, + TA_COMBINEGIVE, + TA_RECEIVECOMBINEGIVE +}; + +} // End of namespace Tony + +#endif diff --git a/engines/tony/font.h b/engines/tony/font.h new file mode 100644 index 0000000000..348e7618ea --- /dev/null +++ b/engines/tony/font.h @@ -0,0 +1,399 @@ +/* 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: Font.CPP............. * + * *$. '$$$$$$$$$ 4$P 4 * + * J *$ "$$$$$$$" $P r Author: Giovanni Bajo........ * + * z$ '$$$P*4c.*$$$*.z@*R$$$ $. * + * z$" "" #$F^ "" '$c * + * 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 * + * * + **************************************************************************/ + +#ifndef TONY_FONT_H +#define TONY_FONT_H + +#include "common/system.h" +#include "tony/gfxcore.h" +#include "tony/resid.h" + +namespace Tony { + +class RMInventory; + +/** + * Gestisce un font, in cui ha varie surface per ogni lettera + */ +class RMFont : public RMGfxTaskSetPrior { +protected: + int nLetters; + RMGfxSourceBuffer8RLEByte *m_letter; +public: + int m_fontDimx,m_fontDimy; + +private: + int m_dimx,m_dimy; + + class RMFontPrimitive : public RMGfxPrimitive { + public: + RMFontPrimitive() : RMGfxPrimitive() {} + RMFontPrimitive(RMGfxTask *task) : RMGfxPrimitive(task) {} + + virtual RMGfxPrimitive* Duplicate() { return new RMFontPrimitive(*this); } + + int m_nChar; + }; + +protected: + // Caricamento del font + void Load(uint32 resID, int nChars, int dimx, int dimy, uint32 palResID = RES_F_PAL); + void Load(const byte *buf, int nChars, int dimx, int dimy, uint32 palResID = RES_F_PAL); + + // Scaricamente del font (anche da distruttore) + void Unload(void); + +protected: + // Conversione (da overloadare) + virtual int ConvertToLetter(int nChar) = 0; + + // Lunghezza dei caratteri (da overloadare) + virtual int LetterLength(int nChar, int nNext=0) = 0; + +public: + virtual int LetterHeight(void) = 0; + +public: + RMFont(); + virtual ~RMFont(); + + // Inizializzazione e chiusura + virtual void Init(void) = 0; + virtual void Close(void); + + // Funzione del task da overloadare + void Draw(RMGfxTargetBuffer &bigBug, RMGfxPrimitive *prim); + + // Crea una primitiva per una lettera + RMGfxPrimitive *MakeLetterPrimitive(byte bChar, int& nLength); + + // Lunghezza in pixel di una stringa con il font corrente + int StringLen(RMString text); + int StringLen(char bChar, char bNext=0); +}; + + +class RMFontColor : public virtual RMFont { +private: + byte m_r,m_g,m_b; + +public: + RMFontColor(); + virtual ~RMFontColor(); + virtual void SetBaseColor(byte r, byte g, byte b); +}; + + +class RMFontWithTables : public virtual RMFont { +protected: + int cTable[256]; + int lTable[256]; + int lDefault; + int hDefault; + signed char l2Table[256][256]; + +protected: + // Overload dei metodi + int ConvertToLetter(int nChar) { return cTable[nChar]; } + int LetterLength(int nChar, int nNext=0) { return (nChar!=-1 ? lTable[nChar]+l2Table[nChar][nNext] : lDefault); } + +public: + int LetterHeight() { return hDefault; } + virtual ~RMFontWithTables() {} +}; + + +class RMFontParla : public RMFontColor, public RMFontWithTables { +public: + void Init(void); + virtual ~RMFontParla() {} +}; + +class RMFontObj : public RMFontColor, public RMFontWithTables { +private: + void SetBothCase(int nChar, int nNext, signed char spiazz); + +public: + void Init(void); + virtual ~RMFontObj() {} +}; + +class RMFontMacc : public RMFontColor, public RMFontWithTables { +public: + void Init(void); + virtual ~RMFontMacc() {} +}; + +class RMFontCredits : public RMFontColor, public RMFontWithTables { +public: + void Init(void); + virtual ~RMFontCredits() {} + virtual void SetBaseColor(byte r, byte g, byte b) {} +}; + +/** + * Gestisce una scritta su schermo, con tutte le possibilita' di formattazione disponibile + */ +class RMText : public RMGfxWoodyBuffer { +private: + static RMFontColor *m_fonts[4]; + static RMGfxClearTask m_clear; + static OSystem::MutexRef m_cs; + int maxLineLength; + +public: + enum HORALIGN { + HLEFT, + HLEFTPAR, + HCENTER, + HRIGHT + }; + + enum VERALIGN { + VTOP, + VCENTER, + VBOTTOM + }; + +private: + HORALIGN aHorType; + VERALIGN aVerType; + byte m_r,m_g,m_b; + +protected: + virtual void ClipOnScreen(RMGfxPrimitive* prim); + +public: + RMText(); + virtual ~RMText(); + + // Setta il tipo di allineamento + void SetAlignType(HORALIGN aHor, VERALIGN aVer) { aHorType=aHor; aVerType=aVer; } + + // Setta la lunghezza massima di una linea in pixel (utilizzato per formattare il testo) + void SetMaxLineLength(int max); + + // Scrive un testo + void WriteText(RMString text, int font, int *time = NULL); + void WriteText(RMString text, RMFontColor* font, int *time = NULL); + + // Overloading della funzione ereditata da RMGfxTask per decidere + // quando eliminare un oggetto dalla OTLIST + virtual bool RemoveThis(void); + + // Overloading del Draw per centrare la scritta, se necessario + virtual void Draw(RMGfxTargetBuffer& bigBuf, RMGfxPrimitive* prim); + + // Setta il colore di base + void SetColor(byte r, byte g, byte b) { m_r=r; m_g=g; m_b=b; } +}; + +/** + * Gestisce il testo di un dialogo + */ +class RMTextDialog : public RMText +{ + protected: + int m_startTime; + int m_time; + bool m_bSkipStatus; + RMPoint dst; + HANDLE hEndDisplay; + bool m_bShowed; + bool m_bForceTime; + bool m_bForceNoTime; + HANDLE hCustomSkip; + HANDLE hCustomSkip2; + RMInput* m_input; + bool m_bAlwaysDisplay; + bool m_bNoTab; + + public: + RMTextDialog(); + virtual ~RMTextDialog(); + + // Scrive un testo + void WriteText(RMString text, int font, int *time=NULL); + void WriteText(RMString text, RMFontColor* font, int *time=NULL); + + // Overloading della funzione ereditata da RMGfxTask per decidere + // quando eliminare un oggetto dalla OTLIST + virtual bool RemoveThis(void); + + // Overloading della funzione di deregistrazione, utilizzata per capire + // quando ci leviamo di torno + virtual void Unregister(void); + + // Overloading del Draw per centrare la scritta, se necessario + virtual void Draw(RMGfxTargetBuffer& bigBuf, RMGfxPrimitive* prim); + + // Setta la posizione + void SetPosition(RMPoint pt) { dst=pt; } + + // Aspetta che venga finita la visualizzazione + void WaitForEndDisplay(void); + void SetCustomSkipHandle(HANDLE hCustomSkip); + void SetCustomSkipHandle2(HANDLE hCustomSkip); + void SetSkipStatus(bool bEnabled); + void SetForcedTime(uint32 dwTime); + void SetNoTab(void); + void ForceTime(void); + void ForceNoTime(void); + void SetAlwaysDisplay(void); + + // Setta il dispositivo di input, per permettere skip da mouse + void SetInput(RMInput* input); + + void Show(void); + void Hide(void); +}; + +class RMTextDialogScrolling : public RMTextDialog { +protected: + RMLocation* curLoc; + RMPoint startScroll; + + virtual void ClipOnScreen(RMGfxPrimitive* prim); + +public: + RMTextDialogScrolling(); + RMTextDialogScrolling(RMLocation* loc); + virtual ~RMTextDialogScrolling(); + + virtual void Draw(RMGfxTargetBuffer& bigBuf, RMGfxPrimitive* prim); +}; + + +/****************************************************************************\ +* class RMTextItemName +* -------------------- +* Description: Gestisce il nome dell'oggetto selezionato su schermo +\****************************************************************************/ + +class RMTextItemName : protected RMText { +protected: + RMPoint m_mpos; + RMPoint m_curscroll; + RMItem* m_item; + RMString m_itemName; + +public: + RMTextItemName(); + virtual ~RMTextItemName(); + + void SetMouseCoord(RMPoint m) { m_mpos=m; } + + void DoFrame(RMGfxTargetBuffer &bigBuf, RMLocation &loc, RMPointer &ptr, RMInventory &inv); + virtual void Draw(RMGfxTargetBuffer& bigBuf, RMGfxPrimitive* prim); + + RMPoint GetHotspot() { if (m_item==NULL) return m_mpos+m_curscroll; else return m_item->Hotspot(); } + RMItem* GetSelectedItem() { return m_item; } + bool IsItemSelected() { return m_item!=NULL; } + bool IsNormalItemSelected() { return m_item!=NULL && m_itemName.Length()>0; } + + virtual bool RemoveThis() { return true; } +}; + + +/** + * Gestisce la schermata di scelta delle voci di un dialogo + */ +class RMDialogChoice : public RMGfxWoodyBuffer { +private: + int m_curSelection; + int m_numChoices; + RMText* m_drawedStrings; + RMPoint *m_ptDrawStrings; + int m_curAdded; + bool m_bShow; + RMGfxSourceBuffer8 DlgText; + RMGfxSourceBuffer8 DlgTextLine; + RMPoint m_ptDrawPos; + HANDLE hUnreg; + bool bRemoveFromOT; + +protected: + void Prepare(void); + void SetSelected(int pos); + +public: + bool RemoveThis(void); + void Draw(RMGfxTargetBuffer& bigBuf, RMGfxPrimitive* prim); + void Unregister(void); + +public: + // Inizializzazione + RMDialogChoice(); + virtual ~RMDialogChoice(); + + // Inizializzazione e chiusura + void Init(void); + void Close(void); + + // Setta il numero delle frasi possibili, che dovranno essere poi aggiunte + // con AddChoice() + void SetNumChoices(int num); + + // Aggiunge una stringa con la scelta + void AddChoice(RMString string); + + // Mostra e nasconde la scelta, con eventuali animazioni + // NOTA: Se non viene passato parametro alla Show(), è obbligo del + // chiamante assicurarsi che la classe venga inserita alla OTlist + void Show(RMGfxTargetBuffer* bigBuf = NULL); + void Hide(void); + + // Polling di aggiornamento + void DoFrame(RMPoint ptMousePos); + + // Ritorna la voce attualmente selezionata, o -1 se nessuna è selezionata + int GetSelection(void); +}; + +} // End of namespace Tony + +#endif diff --git a/engines/tony/game.cpp b/engines/tony/game.cpp new file mode 100644 index 0000000000..48827cbc2a --- /dev/null +++ b/engines/tony/game.cpp @@ -0,0 +1,54 @@ +/* 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: Loc.CPP.............. * + * *$. '$$$$$$$$$ 4$P 4 * + * J *$ "$$$$$$$" $P r Author: Giovanni Bajo........ * + * z$ '$$$P*4c.*$$$*.z@*R$$$ $. * + * z$" "" #$F^ "" '$c * + * 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 * + * * + **************************************************************************/ + +#include "tony/game.h" + +namespace Tony { + + + +} // End of namespace Tony diff --git a/engines/tony/game.h b/engines/tony/game.h new file mode 100644 index 0000000000..28f9489267 --- /dev/null +++ b/engines/tony/game.h @@ -0,0 +1,285 @@ +/* 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: Game.CPP............. * + * *$. '$$$$$$$$$ 4$P 4 * + * J *$ "$$$$$$$" $P r Author: Giovanni Bajo........ * + * z$ '$$$P*4c.*$$$*.z@*R$$$ $. * + * z$" "" #$F^ "" '$c * + * 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 * + * * + **************************************************************************/ + +#ifndef TONY_GAME_H +#define TONY_GAME_H + +#include "tony/adv.h" +#include "tony/gfxcore.h" +#include "tony/input.h" +#include "tony/loc.h" +#include "tony/utils.h" + +namespace Tony { + +class RMPointer : public RMGfxTask { +private: + RMGfxSourceBuffer8 *m_pointer[16]; + RMPoint m_hotspot[16]; + RMPoint m_pos; + + RMItem *m_specialPointer[16]; + + int m_nCurPointer; + int m_nCurSpecialPointer; + + RMGfxSourceBuffer8 *m_nCurCustomPointer; + +public: + enum POINTER { + PTR_NONE = 0, + PTR_FRECCIASU, + PTR_FRECCIAGIU, + PTR_FRECCIASINISTRA, + PTR_FRECCIADESTRA, + PTR_FRECCIAMAPPA, + PTR_CUSTOM + }; + +public: + // Constructor & destructor + RMPointer(); + virtual ~RMPointer(); + + // Initialisation + void Init(void); + + // Deinitialisation + void Close(void); + + // Process a frame + void DoFrame(RMGfxTargetBuffer *bigBuf); + + // Overloading of priorities + int Priority(); + + // Overloading draw method + void Draw(RMGfxTargetBuffer &bigBuf, RMGfxPrimitive *prim); + + // Sets the current co-ordinates + void SetCoord(RMPoint pt) { m_pos = pt; } + + // Overloading of the method to see if rising from the list + bool RemoveThis(); + + // Sets a new action as current + void SetAction(RMTonyAction action) { m_nCurPointer = action; } + + // Sets a new pointer + void SetSpecialPointer(POINTER ptr) { + m_nCurSpecialPointer=ptr; + if (m_nCurSpecialPointer && m_nCurSpecialPointer != PTR_CUSTOM) m_specialPointer[ptr-1]->SetPattern(1); + } + POINTER GetSpecialPointer(void) { return (POINTER)m_nCurSpecialPointer; } + + // Set the new custom pointer + void SetCustomPointer(RMGfxSourceBuffer8 *ptr) { m_nCurCustomPointer = ptr; } + + // Return the current action to be applied according to the pointer + int CurAction(void); +}; + +class RMOptionButton: public RMGfxTaskSetPrior { +public: + RMRect m_rect; + RMGfxSourceBuffer16 *m_buf; + bool m_bActive; + bool m_bHasGfx; + bool m_bDoubleState; + +public: + RMOptionButton(uint32 dwRes, RMPoint pt, bool bDoubleState = false); + RMOptionButton(RMRect pt); + virtual ~RMOptionButton(); + + bool DoFrame(RMPoint mousePos, bool bLeftClick, bool bRightClick); + void Draw(RMGfxTargetBuffer &bigBuf, RMGfxPrimitive *prim); + void AddToList(RMGfxTargetBuffer &bigBuf); + bool IsActive() { return m_bActive; } + void SetActiveState(bool bState) { m_bActive=bState; } +}; + +class RMOptionSlide : public RMGfxTaskSetPrior { +private: + RMOptionButton* m_PushLeft; + RMOptionButton* m_PushRight; + RMGfxSourceBuffer16* m_SliderCenter; + RMGfxSourceBuffer16* m_SliderLeft; + RMGfxSourceBuffer16* m_SliderRight; + RMGfxSourceBuffer16* m_SliderSingle; + int m_nSlideSize; + RMPoint m_pos; + int m_nValue; + int m_nMax; + int m_nStep; + +public: + RMOptionSlide(RMPoint pt, int m_nRange=100, int m_nStartValue=0, int slideSize=300); + virtual ~RMOptionSlide(); + + bool DoFrame(RMPoint mousePos, bool bLeftClick, bool bRightClick); + void Draw(RMGfxTargetBuffer& bigBuf, RMGfxPrimitive* prim); + void AddToList(RMGfxTargetBuffer& bigBuf); + + int GetValue() { return m_nValue; } +}; + +class RMOptionScreen : public RMGfxWoodyBuffer { +private: + RMGfxSourceBuffer16 *m_menu; + RMGfxSourceBuffer16 *m_QuitConfirm; + RMGfxSourceBuffer16 *m_HideLoadSave; + RMOptionButton *m_ButtonQuitYes; + RMOptionButton *m_ButtonQuitNo; + RMOptionButton *m_ButtonExit; + RMOptionButton *m_ButtonQuit; + RMOptionButton *m_ButtonLoad; + RMOptionButton *m_ButtonSave; + RMOptionButton *m_ButtonGameMenu; + RMOptionButton *m_ButtonGfxMenu; + RMOptionButton *m_ButtonSoundMenu; + RMGfxSourceBuffer8 *m_SaveEasy; + RMGfxSourceBuffer8 *m_SaveHard; + RMGfxSourceBuffer16 *m_curThumb[6]; + RMString m_curThumbName[6]; + byte m_curThumbDiff[6]; + RMOptionButton *m_ButtonSave_States[6]; + RMOptionButton *m_ButtonSave_ArrowLeft; + RMOptionButton *m_ButtonSave_ArrowRight; + RMOptionButton *m_ButtonGfx_Tips; + + RMOptionButton *m_ButtonSound_DubbingOn; + RMOptionButton *m_ButtonSound_MusicOn; + RMOptionButton *m_ButtonSound_SFXOn; + + RMOptionSlide *m_SlideTonySpeed; + RMOptionSlide *m_SlideTextSpeed; + + + int m_statePos; + bool m_bEditSaveName; + int m_nEditPos; + char m_EditName[256]; + + union { + RMOptionButton *m_ButtonGame_Lock; + RMOptionButton *m_ButtonGfx_Anni30; + RMOptionSlide *m_SliderSound_Music; + }; + union { + RMOptionButton *m_ButtonGame_TimerizedText; + RMOptionButton *m_ButtonGfx_AntiAlias; + RMOptionSlide *m_SliderSound_SFX; + }; + union { + RMOptionButton *m_ButtonGame_Scrolling; + RMOptionButton *m_ButtonGfx_Sottotitoli; + RMOptionSlide *m_SliderSound_Dubbing; + }; + union { + RMOptionButton *m_ButtonGame_InterUp; + RMOptionButton *m_ButtonGfx_Trans; + }; + + int m_FadeStep; + bool m_bExit; + bool m_bQuitConfirm; + int m_FadeY; + int m_FadeTime; + bool m_bLoadMenuOnly; + bool m_bNoLoadSave; + bool m_bAlterGfx; + + enum STATE { + MENUGAME, + MENUGFX, + MENUSOUND, + MENULOAD, + MENUSAVE + }; + + STATE m_nState; + STATE m_nLastState; + +public: + RMOptionScreen(); + virtual ~RMOptionScreen(); + + bool Init(RMGfxTargetBuffer& bigBuf); + bool InitLoadMenuOnly(RMGfxTargetBuffer &bigBuf, bool bAlternateGfx = false); + bool InitSaveMenuOnly(RMGfxTargetBuffer &bigBuf, bool bAlternateGfx = false); + bool InitNoLoadSave(RMGfxTargetBuffer &bigBuf); + void ReInit(RMGfxTargetBuffer &bigBuf); + bool Close(); + bool IsClosing(); + + // Metodi in overloading da RMGfxTask + int Priority(); + void Draw(RMGfxTargetBuffer &bigBuf, RMGfxPrimitive *prim); + bool RemoveThis(); + + // Polling per l'option screen + void DoFrame(RMInput *m_input); + +protected: + + // Inizializza tutto per il nuovo stato + void InitState(void); + void CloseState(void); + void ChangeState(STATE newState); + + // Ridisegna tutto il menu delle opzioni + void RefreshAll(void); + void RefreshThumbnails(void); + + // Carica lo screenshot per il salvataggio + bool LoadThumbnailFromSaveState(int numState, byte *lpDestBuf, RMString &name, byte &diff); +}; + +} // End of namespace Tony + +#endif diff --git a/engines/tony/gfxcore.cpp b/engines/tony/gfxcore.cpp new file mode 100644 index 0000000000..731521832f --- /dev/null +++ b/engines/tony/gfxcore.cpp @@ -0,0 +1,54 @@ +/* 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: GfxCore.CPP.......... * + * *$. '$$$$$$$$$ 4$P 4 * + * J *$ "$$$$$$$" $P r Author: Giovanni Bajo........ * + * z$ '$$$P*4c.*$$$*.z@*R$$$ $. * + * z$" "" #$F^ "" '$c * + * 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 * + * * + **************************************************************************/ + +#include "tony/gfxEngine.h" + +namespace Tony { + + + +} // End of namespace Tony diff --git a/engines/tony/gfxcore.h b/engines/tony/gfxcore.h new file mode 100644 index 0000000000..313e471cdf --- /dev/null +++ b/engines/tony/gfxcore.h @@ -0,0 +1,547 @@ +/* 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: GfxCore.CPP.......... * + * *$. '$$$$$$$$$ 4$P 4 * + * J *$ "$$$$$$$" $P r Author: Giovanni Bajo........ * + * z$ '$$$P*4c.*$$$*.z@*R$$$ $. * + * z$" "" #$F^ "" '$c * + * 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 * + * * + **************************************************************************/ + +#ifndef TONY_GFXCORE_H +#define TONY_GFXCORE_H + +#include "common/system.h" +#include "tony/utils.h" + +namespace Tony { + +/****************************************************************************\ +* Prototipi di classi +\****************************************************************************/ + +// Nome della classe Albero genealogico Astratto? +class RMGfxTask; // Si +class RMGfxTaskSetPrior; // Task Si +class RMGfxBuffer; // +class RMGfxSourceBuffer; // TaskP+[Buffer] Si +class RMGfxTargetBuffer; // [Buffer] +class RMGfxSourceBufferPal; // Source Si +class RMGfxSourceBuffer4; // SourcePal +class RMGfxSourceBuffer8; // SourcePal +class RMGfxSourceBuffer16; // Source +class RMGfxWoodyBuffer; // Source16+Target +class RMGfxClearTask; // Task + + +/** + * Graphics buffer + */ +class RMGfxBuffer { +protected: + int m_dimx, m_dimy; + byte *m_buf; + byte *m_origBuf; + bool m_bUseDDraw; + +public: + RMGfxBuffer(); + RMGfxBuffer(int dimx, int dimy, int nBpp, bool bUseDDraw = false); + virtual ~RMGfxBuffer(); + + // Attributes + int Dimx() { return m_dimx; } + int Dimy() { return m_dimy; } + + // Creation + virtual void Create(int dimx, int dimy, int nBpp, bool bUseDDraw = false); + virtual void Destroy(void); + + // Buffer access + void Lock(void); + void Unlock(void); + + // These are valid only if the buffer is locked + operator byte *(); + operator void *(); + + // Getting the offset for a given Y position + void OffsetY(int nLines, int nBpp); +}; + +/** + * Graphics primitive + */ +class RMGfxPrimitive { +public: + RMGfxTask *m_task; + +protected: + RMRect m_src; + RMRect m_dst; + +bool m_bStretch; + byte m_bFlag; + +public: + RMGfxPrimitive() { m_bFlag = 0; m_task = NULL; m_src.SetEmpty(); m_dst.SetEmpty(); } + + RMGfxPrimitive(RMGfxTask *task) { + m_task = task; m_bFlag = 0; + } + + RMGfxPrimitive(RMGfxTask *task, RMRect &src, RMRect &dst) { + m_task = task; m_src = src; m_dst = dst; m_bFlag = 0; + m_bStretch = (src.Width() != dst.Width() || src.Height() != dst.Height()); + } + + RMGfxPrimitive(RMGfxTask *task, RMPoint &src, RMRect &dst) { + m_task = task; m_src.TopLeft() = src; m_dst = dst; m_bFlag = 0; + } + + RMGfxPrimitive(RMGfxTask *task, RMPoint &src, RMPoint &dst) { + m_task = task; m_src.TopLeft() = src; m_dst.TopLeft() = dst; m_bFlag = 0; + } + + RMGfxPrimitive(RMGfxTask *task, RMRect &src, RMPoint &dst) { + m_task = task; m_src = src; m_dst.TopLeft() = dst; m_bFlag = 0; + } + + RMGfxPrimitive(RMGfxTask *task, RMRect &dst) { + m_task = task; m_dst = dst; m_src.SetEmpty(); m_bFlag = 0; + } + + RMGfxPrimitive(RMGfxTask *task, RMPoint &dst) { + m_task = task; m_dst.TopLeft() = dst; m_src.SetEmpty(); m_bFlag = 0; + } + + void SetFlag(byte bFlag) { m_bFlag=bFlag; } + void SetTask(RMGfxTask *task) { m_task = task; } + void SetSrc(RMRect &src) { m_src = src; } + void SetSrc(RMPoint &src) { m_src.TopLeft() = src; } + void SetDst(RMRect &dst) { m_dst = dst; } + void SetDst(RMPoint &dst) { m_dst.TopLeft() = dst; } + void SetStrecth(bool bStretch) { m_bStretch = bStretch; } + + bool HaveDst() { return !m_dst.IsEmpty(); } + RMRect &Dst() { return m_dst; } + + bool HaveSrc() { return !m_src.IsEmpty(); } + RMRect &Src() { return m_src; } + + // Flags + bool IsFlipped() { return m_bFlag&1; } + + // Duplicate + virtual RMGfxPrimitive* Duplicate() { return new RMGfxPrimitive(*this); } +}; + + +/** + * Graphic drawing task + */ +class RMGfxTask { +protected: + int m_nPrior; + int m_nInList; + +public: + // Costruttore standard + RMGfxTask(); + + virtual int Priority(); + virtual void Draw(RMGfxTargetBuffer &bigBuf, RMGfxPrimitive *prim) = 0; + virtual bool RemoveThis(); + + // Registration + virtual void Register(void) { m_nInList++; } + virtual void Unregister(void) { m_nInList--; assert(m_nInList>=0); } +}; + + +/** + * Graphic drawing with priority + */ +class RMGfxTaskSetPrior : public RMGfxTask { +public: + void SetPriority(int nPrior); +}; + + +/** + * Task that cleans the destination buffer + */ +class RMGfxClearTask : public RMGfxTask { +public: + int Priority(); + void Draw(RMGfxTargetBuffer& bigBuf, RMGfxPrimitive* prim); + bool RemoveThis(); +}; + + +/** + * Task that draws a coloured box + */ +class RMGfxBox : public RMGfxTaskSetPrior { +protected: + uint16 wFillColor; + +public: + void SetColor(byte r, byte g, byte b); + void Draw(RMGfxTargetBuffer &bigBuf, RMGfxPrimitive *prim); + bool RemoveThis(); +}; + + +/** + * Buffer source for the design, which is a task. This is an abstract base. + */ +class RMGfxSourceBuffer : public virtual RMGfxBuffer, public RMGfxTaskSetPrior { +public: + // Carica i dati della surface a basso livello + 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 void Init(RMDataStream &ds, int dimx, int dimy, bool bLoadPalette = false); + + virtual ~RMGfxSourceBuffer(); + +protected: + virtual void PrepareImage(void); + bool Clip2D(int &x1, int &y1, int &u, int &v, int &width, int &height, bool bUseSrc, RMGfxTargetBuffer *buf); + void OffsetY(int nLines) { RMGfxBuffer::OffsetY(nLines,Bpp()); } + +public: + virtual int Bpp() = 0; +}; + + +/** + * 16-bit colour source + */ +class RMGfxSourceBuffer16 : public RMGfxSourceBuffer { +protected: + virtual void PrepareImage(void); + bool m_bTrasp0; + +public: + RMGfxSourceBuffer16(bool bUseTrasp = false); + RMGfxSourceBuffer16(int dimx, int dimy, bool bUseDDraw = false); + virtual ~RMGfxSourceBuffer16(); + + // Inizializzazione + void Create(int dimx, int dimy, bool bUseDDraw = false); + + int Bpp(); + virtual void Draw(RMGfxTargetBuffer &bigBuf, RMGfxPrimitive *prim); +}; + + +/** + * Buffer source with palette + */ +class RMGfxSourceBufferPal : public RMGfxSourceBuffer { +protected: + // The size of the palette is (1<MpalCode()); return *this; } + RMInventory& operator+=(RMItem &item) { AddItem(item.MpalCode()); return *this; } + RMInventory& operator+=(int code) { AddItem(code); return *this; } + + // Rimozione di oggetto + void RemoveItem(int code); + + // Siamo sopra un oggetto? + RMItem* WhichItemIsIn(RMPoint mpt); + bool ItemInFocus(RMPoint mpt); + + // Cambia l'icona di un oggetto + void ChangeItemStatus(uint32 dwCode, uint32 dwStatus); + + // Salvataggio + int GetSaveStateSize(void); + void SaveState(byte *state); + int LoadState(byte *state); +}; + + +class RMInterface : public RMGfxSourceBuffer8RLEByte { +private: + bool m_bActive; + RMPoint m_mpos; + RMPoint m_openPos; + RMPoint m_openStart; + RMText m_hints[5]; + RMGfxSourceBuffer8RLEByte m_hotzone[5]; + RMRect m_hotbbox[5]; + bool m_bPalesati; + int m_lastHotZone; + +protected: + // Dice su quale zona calda si trova il punto + int OnWhichBox(RMPoint pt); + +public: + virtual ~RMInterface(); + + // Il solito DoFrame (polling del motore grafico) + void DoFrame(RMGfxTargetBuffer& bigBuf, RMPoint mousepos); + + // TRUE se è attiva (non si può selezionare oggetti) + bool Active(); + + // Inizializzazione + void Init(void); + void Close(void); + + // Resetta l'interfaccia + void Reset(void); + + // Avverte dei click e rilasci del mouse + void Clicked(RMPoint mousepos); + bool Released(RMPoint mousepos, RMTonyAction &action); + + // Attiva o disattiva il quinto verbo + void SetPalesati(bool bOn); + bool GetPalesati(void); + + // Overloading del Draw per il posizionamente + virtual void Draw(RMGfxTargetBuffer &bigBuf, RMGfxPrimitive *prim); +}; + +} // End of namespace Tony + +#endif diff --git a/engines/tony/loc.cpp b/engines/tony/loc.cpp index a40248f57d..83c48bb938 100644 --- a/engines/tony/loc.cpp +++ b/engines/tony/loc.cpp @@ -32,10 +32,10 @@ * *$. '$$$$$$$$$ 4$P 4 * * J *$ "$$$$$$$" $P r Author: Giovanni Bajo........ * * z$ '$$$P*4c.*$$$*.z@*R$$$ $. * - * z$" "" #$F^ "" '$c Desc: Classi di gestione * - * z$$beu .ue=" $ "=e.. .zed$$c dei dati di una loca- * - * "#$e z$*" . `. ^*Nc e$"" zione................ * - * "$$". .r" ^4. .^$$" ..................... * + * z$" "" #$F^ "" '$c * + * 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++ * diff --git a/engines/tony/loc.h b/engines/tony/loc.h index e09a7389d9..1cae9edb1e 100644 --- a/engines/tony/loc.h +++ b/engines/tony/loc.h @@ -32,10 +32,10 @@ * *$. '$$$$$$$$$ 4$P 4 * * J *$ "$$$$$$$" $P r Author: Giovanni Bajo........ * * z$ '$$$P*4c.*$$$*.z@*R$$$ $. * - * z$" "" #$F^ "" '$c Desc: Classi di gestione * - * z$$beu .ue=" $ "=e.. .zed$$c dei dati di una loca- * - * "#$e z$*" . `. ^*Nc e$"" zione................ * - * "$$". .r" ^4. .^$$" ..................... * + * z$" "" #$F^ "" '$c * + * 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++ * @@ -49,10 +49,269 @@ #define TONY_LOC_H #include "common/scummsys.h" -#include "utils.h" +#include "common/system.h" +#include "tony/mpal/stubs.h" +#include "tony/sound.h" +#include "tony/utils.h" namespace Tony { +/****************************************************************************\ +* Various defines +\****************************************************************************/ + +/** + * Valid colour modes + */ +typedef enum { + CM_256, + CM_65K +} RMColorMode; + + +/****************************************************************************\ +* Class declarations +\****************************************************************************/ + +/** + * Generic palette + */ +class RMPalette { +public: + byte m_data[1024]; + +public: + friend RMDataStream &operator>>(RMDataStream &ds, RMPalette &pal); +}; + + +/** + * Sound effect of an object + */ +class RMSfx { +public: + RMString m_name; + FPSFX *m_fx; + bool m_bPlayingLoop; + +public: + RMSfx(); + virtual ~RMSfx(); + + friend RMDataStream& operator>>(RMDataStream &ds, RMSfx &sfx); + + void Play(bool bLoop = false); + void SetVolume(int vol); + void Pause(bool bPause); + void Stop(void); + + void ReadFromStream(RMDataStream& ds, bool bLOX = false); +}; + + +/** + * Object pattern + */ +class RMPattern { +public: + // Type of slot + enum RMSlotType { + DUMMY1 = 0, + DUMMY2, + SPRITE, + SOUND, + COMMAND, + SPECIAL + }; + + // Class slot + class RMSlot { + private: + RMPoint m_pos; // Child co-ordinates + + public: + RMSlotType m_type; + int m_data; + byte m_flag; + + public: + friend RMDataStream& operator>>(RMDataStream& ds, RMSlot& slot); + + RMPoint Pos() { return m_pos; } + + void ReadFromStream(RMDataStream& ds, bool bLOX = false); + }; + +public: + RMString m_name; + +private: + int m_speed; + RMPoint m_pos; // Coordinate babbo + RMPoint m_curPos; // Coordinate babbo+figlio + int m_bLoop; + int m_nSlots; + int m_nCurSlot; + int m_nCurSprite; + + RMSlot *m_slots; + + uint32 m_nStartTime; + +public: + RMPattern(); + virtual ~RMPattern(); + + friend RMDataStream& operator>>(RMDataStream& ds, RMPattern& pat); + + // A warning that the pattern now and the current + int Init(RMSfx* sfx, bool bPlayP0=false, byte* bFlag=NULL); + + // Update the pattern, checking to see if it's time to change slot and executing + // any associated commands + int Update(HANDLE hEndPattern, byte& bFlag, RMSfx* sfx); + + // Stop a sound effect + void StopSfx(RMSfx *sfx); + + // Reads the position of the pattern + RMPoint Pos() { return m_curPos; } + + void ReadFromStream(RMDataStream& ds, bool bLOX = false); + +private: + void UpdateCoord(void); +}; + + +/** + * Sprite (frame) animation of an item + */ +class RMSprite : public RMGfxTask { +public: + RMString m_name; + RMRect m_rcBox; + +protected: + RMGfxSourceBuffer* m_buf; + +public: + RMSprite(); + virtual ~RMSprite(); + + void Init(RMGfxSourceBuffer* buf); + friend RMDataStream& operator>>(RMDataStream& ds, RMSprite& sprite); + void Draw(RMGfxTargetBuffer& bigBuf, RMGfxPrimitive* prim); + void SetPalette(byte *lpBuf); + void GetSizeFromStream(RMDataStream& ds, int* dimx, int* dimy); + void LOXGetSizeFromStream(RMDataStream& ds, int* dimx, int* dimy); + + void ReadFromStream(RMDataStream& ds, bool bLOX = false); +}; + + +/** + * Data on an item + */ +class RMItem : public RMGfxTask { +public: + RMString m_name; + +protected: + int m_z; + RMPoint m_pos; // Coordinate nonno + RMColorMode m_cm; + RMPoint m_curScroll; + + byte m_FX; + byte m_FXparm; + + virtual int GetCurPattern() { return m_nCurPattern; } + +private: + int m_nCurPattern; + int m_mpalCode; + RMPoint m_hot; + RMRect m_rcBox; + int m_nSprites,m_nSfx,m_nPatterns; + byte m_bPal; + RMPalette m_pal; + + RMSprite *m_sprites; + RMSfx *m_sfx; + RMPattern *m_patterns; + + byte m_bCurFlag; + int m_nCurSprite; + bool m_bIsActive; + HANDLE m_hEndPattern; + bool m_bInitCurPattern; + +public: + RMPoint CalculatePos(void); + +public: + RMItem(); + virtual ~RMItem(); + + friend RMDataStream& operator>>(RMDataStream &ds, RMItem &item); + + // Processa l'oggetto per fare andare avanti eventuale animazioni. Ritorna TRUE se dovrà + // essere ridisegnato il prossimo frame + bool DoFrame(RMGfxTargetBuffer *bigBuf, bool bAddToList = true); + + // Setta la posizione corrente di scrolling + void SetScrollPosition(RMPoint scroll); + + // Overloading della funzione per la rimozione da ot list + virtual bool RemoveThis(); + + // Overloading del draw + virtual void Draw(RMGfxTargetBuffer &bigBuf, RMGfxPrimitive *prim); + + // Overloading della priorità: è la Z + virtual int Priority() { return m_z; } + + // Numero di pattern + int NumPattern() { return m_nPatterns; } + + // Setta un nuovo pattern di animazione, cambiando bruscamente da quello corrente + virtual void SetPattern(int nPattern, bool bPlayP0 = false); + + // Setta un nuovo status. + void SetStatus(int nStatus); + + bool IsIn(RMPoint pt, int* size=NULL); + RMPoint Hotspot() { return m_hot; } + bool GetName(RMString& name); + int MpalCode() { return m_mpalCode; } + + // Scarica l'item + void Unload(void); + + // Aspetta la fine del pattern in play + void WaitForEndPattern(HANDLE hCustomSkip = INVALID_HANDLE_VALUE); + + // Setta un nuovo hotspot per l'oggetto + void ChangeHotspot(RMPoint pt); + + void SetInitCurPattern(bool status) { m_bInitCurPattern=status; } + + void PlaySfx(int nSfx); + +void ReadFromStream(RMDataStream& ds, bool bLOX=false); + + void PauseSound(bool bPause); + +protected: + // Crea una primitiva che ha come task l'item stesso + virtual RMGfxPrimitive *NewItemPrimitive(); + + // Alloca la memoria per gli sprites + virtual RMGfxSourceBuffer* NewItemSpriteBuffer(int dimx, int dimy, bool bPreRLE); +}; + + #define MAXBOXES 50 // Non si puo' cambiare, comanda cosi' il boxed #define MAXHOTSPOT 20 // Idem @@ -122,6 +381,225 @@ public: void LoadState(byte *buf); }; +class RMCharacter : protected RMItem { +public: + enum PATTERNS { + PAT_STANDUP = 1, + PAT_STANDDOWN, + PAT_STANDLEFT, + PAT_STANDRIGHT, + PAT_WALKUP, + PAT_WALKDOWN, + PAT_WALKLEFT, + PAT_WALKRIGHT + }; + +private: + enum STATUS { + STAND, + WALK + }; + + signed short walkcount; + int dx, dy, olddx, olddy; + float fx, fy, slope; + RMPoint linestart, lineend, pathend; + signed char walkspeed, walkstatus; + char minpath; + short nextbox; + short path[MAXBOXES]; + short pathlenght, pathcount; + int curbox; + + STATUS status; + int curSpeed; + bool bEndOfPath; + HANDLE hEndOfPath; + OSystem::MutexRef csMove; + int curLocation; + bool bRemoveFromOT; + bool bMovingWithoutMinpath; + RMGameBoxes *theBoxes; + + RMPoint m_fixedScroll; + +private: + int InWhichBox(RMPoint pt); + + short FindPath(short source, short destination); + RMPoint Searching(char UP, char DOWN, char RIGHT, char LEFT, RMPoint punto); + RMPoint NearestPoint(RMPoint punto); + + void GoTo(RMPoint destcoord, bool bReversed=false); + short ScanLine(RMPoint punto); + RMPoint InvScanLine(RMPoint punto); + RMPoint NearestHotSpot(int sourcebox, int destbox); + + void NewBoxEntered(int nBox); + +protected: + bool bMoving; + bool bDrawNow; + bool bNeedToStop; +// virtual RMGfxPrimitive* NewItemPrimitive(); + +public: + RMCharacter(); + virtual ~RMCharacter(); + + void LinkToBoxes(RMGameBoxes* theBoxes); + + virtual bool RemoveThis(void); + + // Aggiorna la posizione del personaggio + void DoFrame(RMGfxTargetBuffer* bigBuf, int loc); + + // Overloading del Draw + void Draw(RMGfxTargetBuffer& bigBuf, RMGfxPrimitive* prim); + + // TRUE se si è appena fermato + bool EndOfPath() { return bEndOfPath; } + + // Cambia il pattern del personaggio per fermarlo + virtual void Stop(void); + + // Controlla se il personaggio si sta muovendo + bool IsMoving() { return bMoving; } + + // Muove il personaggio a una certa posizione + bool Move(RMPoint pt); + + // Posiziona il personaggio a una certa posizione SENZA farlo muovere + void SetPosition(RMPoint pt, int newloc=-1); + + // Aspetta la fine del movimento + void WaitForEndMovement(void) { if (bMoving) WaitForSingleObject(hEndOfPath, INFINITE); } + + void SetFixedScroll(RMPoint fix) { m_fixedScroll = fix; } + void SetSpeed(int speed) { curSpeed=speed; } +}; + + +class RMWipe : public RMGfxTask { +private: + bool m_bFading; + bool m_bEndFade; + bool m_bUnregister; + HANDLE m_hUnregistered; + int m_nFadeStep; + HANDLE m_hEndOfFade; + bool m_bMustRegister; + + RMItem m_wip0r; + +public: + RMWipe(); + virtual ~RMWipe(); + + void DoFrame(RMGfxTargetBuffer& bigBuf); + void Draw(RMGfxTargetBuffer& bigBuf, RMGfxPrimitive* prim); + + void InitFade(int type); + void CloseFade(void); + void WaitForFadeEnd(void); + + virtual void Unregister(void); + virtual bool RemoveThis(void); + virtual int Priority(void); +}; + + +/** + * Location + */ +class RMLocation : public RMGfxTaskSetPrior { +public: + RMString m_name; // Nome + + private: + RMColorMode m_cmode; // Color mode + RMGfxSourceBuffer* m_buf; // Immagine della locazione + + int m_nItems; // Numero oggetti +RMItem* m_items; // Oggetti + + RMPoint m_curScroll; // Posizione corrente di scroll + RMPoint m_fixedScroll; + +public: + // @@@@@@@@@@@@@@@@@@@@@@@ + RMPoint TEMPTonyStart; + RMPoint TEMPGetTonyStart() { return TEMPTonyStart; } + + int TEMPNumLoc; + int TEMPGetNumLoc() { return TEMPNumLoc; } + +public: + RMLocation(); + virtual ~RMLocation(); + + // Caricamento da disco + bool Load(char *lpszFileName); + bool Load(HANDLE hFile); + bool Load(byte *buf); + bool Load(RMDataStream &ds); + bool LoadLOX(RMDataStream &ds); + + // Scaricamento + void Unload(void); + + // Overloading del Draw + void Draw(RMGfxTargetBuffer &bigBuf, RMGfxPrimitive *prim); + + // Prepara un frame disegnando la locazione e tutti i suoi item + void DoFrame(RMGfxTargetBuffer *bigBuf); + + // Si fa dare il numero dell'item + RMItem* WhichItemIsIn(RMPoint pt); + + // Si fa dare un elemento dal suo codice MPAL + RMItem* GetItemFromCode(uint32 dwCode); + + // Setta la posizione corrente di scrolling + void SetScrollPosition(RMPoint &scroll); + + // Setta un offset aggiuntivo di scrolling da aggiungere sempre + void SetFixedScroll(RMPoint &scroll); + + // Aggiorna le coordinate di scrolling in modo da visualizzare sempre il punto fornito + void UpdateScrolling(RMPoint ptShowThis); + + // Legge la posizione di scrolling corrente + RMPoint ScrollPosition() { return m_curScroll; } + + // Pausa sonoro + void PauseSound(bool bPause); +}; + + +/** + * MPAL message, composed of more ASCIIZ + */ +class RMMessage { +private: + char *lpMessage; + char *lpPeriods[256]; + int nPeriods; + +private: + void ParseMessage(void); + +public: + RMMessage(uint32 dwId); + virtual ~RMMessage(); + + bool IsValid() { return lpMessage != NULL; } + int NumPeriods() { return nPeriods; } + char *Period(int num) { return lpPeriods[num]; } + char *operator[](int num) { return lpPeriods[num]; } +}; + + } // End of namespace Tony #endif /* TONY_H */ diff --git a/engines/tony/module.mk b/engines/tony/module.mk index 6aeb0a1583..cbc07d27b7 100644 --- a/engines/tony/module.mk +++ b/engines/tony/module.mk @@ -2,7 +2,12 @@ MODULE := engines/tony MODULE_OBJS := \ detection.o \ + game.o \ + gfxcore.o \ + gfxengine.o \ + input.o \ loc.o \ + sound.o \ tony.o \ utils.o \ mpal/expr.o \ diff --git a/engines/tony/mpal/memory.h b/engines/tony/mpal/memory.h index dde2e8908c..fde0d33b3e 100644 --- a/engines/tony/mpal/memory.h +++ b/engines/tony/mpal/memory.h @@ -75,6 +75,10 @@ public: #define GlobalUnlock(handle) {} #define GlobalSize(handle) (_vm->_memoryManager.getItem(handle).Size()) +#define GMEM_FIXED 1 +#define GMEM_MOVEABLE 2 +#define GMEM_ZEROINIT 4 + } // end of namespace MPAL } // end of namespace Tony diff --git a/engines/tony/mpal/stubs.h b/engines/tony/mpal/stubs.h index be856790bc..a8d3253ddb 100644 --- a/engines/tony/mpal/stubs.h +++ b/engines/tony/mpal/stubs.h @@ -47,10 +47,6 @@ typedef uint32 (*LPTHREAD_START_ROUTINE)(void *lpThreadParameter); * Defines \****************************************************************************/ -#define GMEM_FIXED 1 -#define GMEM_MOVEABLE 2 -#define GMEM_ZEROINIT 4 - #define MB_OK 1 #define PASCAL diff --git a/engines/tony/resid.h b/engines/tony/resid.h new file mode 100644 index 0000000000..01ed9b9bd2 --- /dev/null +++ b/engines/tony/resid.h @@ -0,0 +1,76 @@ +/* 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. + * + */ +/* + * ResID.H - Include per le risorse MPAL + * + * Coded by Giovanni Bajo - Nayma/Prograph + * + * (C) 1997-98, Nayma Software + * (C) 1998, Prograph Research srl + * + */ + +/* + Da 10500 in poi ci sono gli .OGG per l'inventario e i ritagli +*/ +#ifndef TONY_RESID_H +#define TONY_RESID_H + + +#define RES_I_INTERFACE 10300 +#define RES_I_INTERPAL 10301 +#define RES_I_INTERPPAL 10302 +#define RES_I_INTERP1 10303 +#define RES_I_INTERP2 10304 +#define RES_I_INTERP3 10305 +#define RES_I_INTERP4 10306 +#define RES_I_INTERP5 10307 + +#define RES_I_DLGTEXT 10350 +#define RES_I_DLGTEXTLINE 10351 +#define RES_I_DLGTEXTPAL 10352 + +#define RES_I_MINIINTER 10360 + +#define RES_P_PAL 10410 +#define RES_P_GO 10400 +#define RES_P_TAKE 10401 +#define RES_P_USE 10402 +#define RES_P_EXAM 10403 +#define RES_P_TALK 10404 + +#define RES_P_PAP1 10420 +#define RES_P_PAP2 10421 +#define RES_P_PAP3 10422 +#define RES_P_PAP4 10423 +#define RES_P_FRMAP 10424 + +#define RES_F_PAL 10700 +#define RES_F_PARL 10701 +#define RES_F_OBJ 10702 +#define RES_F_MACC 10703 +#define RES_F_CREDITS 10704 +#define RES_F_CPAL 10705 + +#define RES_W_CERCHIO 10800 + +#endif diff --git a/engines/tony/sound.cpp b/engines/tony/sound.cpp new file mode 100644 index 0000000000..5d940b3145 --- /dev/null +++ b/engines/tony/sound.cpp @@ -0,0 +1,54 @@ +/* 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: Sound.CPP............ * + * *$. '$$$$$$$$$ 4$P 4 * + * J *$ "$$$$$$$" $P r Author: Giovanni Bajo........ * + * z$ '$$$P*4c.*$$$*.z@*R$$$ $. * + * z$" "" #$F^ "" '$c * + * 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 * + * * + **************************************************************************/ + +#include "tony/game.h" + +namespace Tony { + + + +} // End of namespace Tony diff --git a/engines/tony/sound.h b/engines/tony/sound.h new file mode 100644 index 0000000000..75a70553ef --- /dev/null +++ b/engines/tony/sound.h @@ -0,0 +1,254 @@ +/* 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: Sound.CPP............ * + * *$. '$$$$$$$$$ 4$P 4 * + * J *$ "$$$$$$$" $P r Author: Giovanni Bajo........ * + * z$ '$$$P*4c.*$$$*.z@*R$$$ $. * + * z$" "" #$F^ "" '$c * + * 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 * + * * + **************************************************************************/ + +#ifndef TONY_SOUND_H +#define TONY_SOUND_H + +#include "tony/gfxcore.h" +#include "tony/loc.h" +#include "tony/utils.h" + +namespace Tony { + +class FPSFX; + +enum CODECS { + FPCODEC_RAW, + FPCODEC_ADPCM, + FPCODEC_WAV +}; + +class FPSFX { + +/****************************************************************************\ +* Attributi +\****************************************************************************/ + +private: +/* + HWND hwnd; + LPDIRECTSOUND lpDS; + LPDIRECTSOUNDBUFFER lpDSBuffer; // Buffer DirectSound +*/ + bool bSoundSupported; // TRUE se il suono e' attivo + bool bFileLoaded; // TRUE se e' stato aperto un file + bool bLoop; // TRUE se bisogna loopare l'effetto sonoro + bool bPaused; + int lastVolume; + + bool bStereo; // TRUE se è stereo + bool b16bit; // TRUE se è 16 bit + uint32 dwFreq; // Frequenza originale di campionamento + +// CODEC* lpCodec; // CODEC da utilizzare. + bool bIsPlaying; // TRUE se si sta playando l'effetto sonoro + + bool bIsVoice; + +// LPDIRECTSOUNDNOTIFY lpDSNotify; // Notify degli hotspot nel buffer +// DSBPOSITIONNOTIFY dspnHot[2]; + +public: +// HANDLE hEndOfBuffer; + +private: + + +/****************************************************************************\ +* Metodi +\****************************************************************************/ + +public: + +/****************************************************************************\ +* +* Function: FPSFX(LPDIRECTSOUND lpDS, bool bSoundOn); +* +* Description: Costruttore di default. *NON* bisogna dichiarare direttamente +* un oggetto, ma crearlo piuttosto tramite FPSOUND::CreateSfx() +* +\****************************************************************************/ + + FPSFX(void * /*LPDIRECTSOUND */lpDS, uint32 /*HWND*/ hwnd, bool bSoundOn); + + +/****************************************************************************\ +* +* Function: ~FPSFX(); +* +* Description: Distruttore di default. Si preoccupa anche di fermare il sound +* effect eventualmente in esecuzione, e disallocare la memoria +* da esso occupata. +* +\****************************************************************************/ + + ~FPSFX(); + + +/****************************************************************************\ +* +* 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 effetto sonoro e lo carica. +* +* Input: char *lpszFile Nome del file di sfx 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); + bool LoadFile(byte *lpBuf, uint32 dwCodec); + bool LoadVoiceFromVDB(HANDLE hvdb); + + +/****************************************************************************\ +* +* Function: bool Play(); +* +* Description: Suona lo sfx caricato. +* +* Return: TRUE se tutto OK, FALSE in caso di errore. +* +\****************************************************************************/ + + bool Play(); + + +/****************************************************************************\ +* +* Function: bool Stop(); +* +* Description: Ferma il play dello sfx. +* +* Return: TRUE se tutto OK, FALSE in caso di errore. +* +\****************************************************************************/ + + bool Stop(); + + +/****************************************************************************\ +* +* 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 sfx. +* +* Input: bool bLoop TRUE per attivare il loop, FALSE per +* disattivarlo +* +* Note: Il loop deve essere attivato PRIMA di eseguire il play +* dello sfx. Qualsiasi modifica effettuata durante il play +* non avra' effetto fino a che lo sfx non viene fermato, +* e poi rimesso in play. +* +\****************************************************************************/ + + void SetLoop(bool bLoop); + + + +/****************************************************************************\ +* +* Function: void SetVolume(int dwVolume); +* +* Description: Cambia il volume dello sfx +* +* Input: int dwVolume Volume da settare (0-63) +* +\****************************************************************************/ + + void SetVolume(int dwVolume); + + + +/****************************************************************************\ +* +* Function: void GetVolume(int * lpdwVolume); +* +* Description: Chiede il volume dello sfx +* +* Input: int * lpdwVolume Variabile in cui verra' inserito +* il volume corrente +* +\****************************************************************************/ + + void GetVolume(int * lpdwVolume); +}; + +} // End of namespace Tony + +#endif diff --git a/engines/tony/tony.cpp b/engines/tony/tony.cpp index d5a5e467df..a370c8efaf 100644 --- a/engines/tony/tony.cpp +++ b/engines/tony/tony.cpp @@ -85,6 +85,9 @@ Common::ErrorCode TonyEngine::Init() { // Initialise the boxes _theBoxes.Init(); + // Link to the custom graphics engine + + return Common::kNoError; } diff --git a/engines/tony/tony.h b/engines/tony/tony.h index 384b7a1f4c..a372260c34 100644 --- a/engines/tony/tony.h +++ b/engines/tony/tony.h @@ -33,6 +33,7 @@ #include "tony/mpal/mpal.h" #include "tony/mpal/memory.h" +#include "tony/gfxEngine.h" #include "tony/loc.h" #include "tony/utils.h" @@ -91,6 +92,7 @@ public: Common::Array _voices; // Bounding box list manager RMGameBoxes _theBoxes; + RMGfxEngine _theEngine; public: TonyEngine(OSystem *syst, const TonyGameDescription *gameDesc); virtual ~TonyEngine(); diff --git a/engines/tony/tonychar.h b/engines/tony/tonychar.h new file mode 100644 index 0000000000..9d3c0202d0 --- /dev/null +++ b/engines/tony/tonychar.h @@ -0,0 +1,448 @@ +/* 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: TonyChar.CPP......... * + * *$. '$$$$$$$$$ 4$P 4 * + * J *$ "$$$$$$$" $P r Author: Giovanni Bajo........ * + * z$ '$$$P*4c.*$$$*.z@*R$$$ $. * + * z$" "" #$F^ "" '$c * + * 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 * + * * + **************************************************************************/ + +#ifndef TONY_TONYCHAR_H +#define TONY_TONYCHAR_H + +#include "tony/mpal/stubs.h" + +namespace Tony { + +class RMTony : public RMCharacter { +private: + enum DIRECTION { + UP, DOWN, LEFT, RIGHT + }; + +public: + enum TALKTYPE { + TALK_NORMAL, + TALK_FIANCHI, + TALK_CANTA, + TALK_RIDE, + TALK_SIINDICA, + TALK_SPAVENTATO, + TALK_SPAVENTATO2, + TALK_CONBICCHIERE, + TALK_CONMARTELLO, + TALK_CONVERME, + TALK_CONCORDA, + TALK_CONCONIGLIO, + TALK_CONRICETTA, + TALK_CONCARTE, + TALK_CONPUPAZZO, + TALK_CONPUPAZZOSTATIC, + TALK_CONCONIGLIOSTATIC, + TALK_CONRICETTASTATIC, + TALK_CONCARTESTATIC, + TALK_CONTACCUINOSTATIC, + TALK_CONMEGAFONOSTATIC, + TALK_CONBARBASTATIC, + TALK_RIDE2, + TALK_SCHIFATO, + TALK_NAAH, + TALK_MACBETH1, + TALK_MACBETH2, + TALK_MACBETH3, + TALK_MACBETH4, + TALK_MACBETH5, + TALK_MACBETH6, + TALK_MACBETH7, + TALK_MACBETH8, + TALK_MACBETH9, + TALK_SPAVENTATOSTATIC, + TALK_CONSEGRETARIA + }; + +private: + bool m_bShow; + bool m_bShowOmbra; + bool m_bCorpoDavanti; + RMGfxSourceBuffer8AB m_ombra; + bool m_bActionPending; + RMItem *m_ActionItem; + int m_Action; + int m_ActionParm; + static bool m_bAction; + + bool m_bPastorella; + + bool m_bIsStaticTalk; + bool m_bIsTalking; + int m_nPatB4Talking; + TALKTYPE m_nTalkType; + DIRECTION m_TalkDirection; + RMPoint m_nBodyOffset; + + int m_nTimeLastStep; + + RMItem m_body; + HANDLE hActionThread; + +protected: + // Overload dell'allocazione degli sprites per cambiare il tipo + virtual RMGfxSourceBuffer* NewItemSpriteBuffer(int dimx, int dimy, bool bPreRLE); + + // Thread che aspetta la fine di un azione + static uint32 WaitEndOfAction(HANDLE hThread); + +public: // per farlo rialzare, altrimenti private + enum PATTERNS { + PAT_TAKEUP_UP1 = 9, + PAT_TAKEUP_UP2, + PAT_TAKEUP_MID1, + PAT_TAKEUP_MID2, + PAT_TAKEUP_DOWN1, + PAT_TAKEUP_DOWN2, + + PAT_TAKELEFT_UP1, + PAT_TAKELEFT_UP2, + PAT_TAKELEFT_MID1, + PAT_TAKELEFT_MID2, + PAT_TAKELEFT_DOWN1, + PAT_TAKELEFT_DOWN2, + + PAT_TAKERIGHT_UP1, + PAT_TAKERIGHT_UP2, + PAT_TAKERIGHT_MID1, + PAT_TAKERIGHT_MID2, + PAT_TAKERIGHT_DOWN1, + PAT_TAKERIGHT_DOWN2, + + PAT_SIRIALZALEFT, + PAT_PERTERRALEFT, + PAT_SIRIALZARIGHT, + PAT_PERTERRARIGHT, + + // Pastorella! + PAT_PAST_WALKUP, + PAT_PAST_WALKDOWN, + PAT_PAST_WALKLEFT, + PAT_PAST_WALKRIGHT, + + PAT_PAST_STANDUP, + PAT_PAST_STANDDOWN, + PAT_PAST_STANDLEFT, + PAT_PAST_STANDRIGHT, + + // Parlata + PAT_TALK_UP, + PAT_TALK_DOWN, + PAT_TALK_LEFT, + PAT_TALK_RIGHT, + + // Testa statica + PAT_TESTA_UP, + PAT_TESTA_DOWN, + PAT_TESTA_LEFT, + PAT_TESTA_RIGHT, + + // Risata + PAT_RIDELEFT_START, + PAT_RIDELEFT_LOOP, + PAT_RIDELEFT_END, + PAT_RIDERIGHT_START, + PAT_RIDERIGHT_LOOP, + PAT_RIDERIGHT_END, + + // Parlata da pastorella + PAT_PAST_TALKUP, + PAT_PAST_TALKDOWN, + PAT_PAST_TALKLEFT, + PAT_PAST_TALKRIGHT, + + // Spavento + PAT_SPAVENTOLEFT_START, + PAT_SPAVENTOLEFT_LOOP, + PAT_SPAVENTOLEFT_END, + PAT_SPAVENTORIGHT_START, + PAT_SPAVENTORIGHT_LOOP, + PAT_SPAVENTORIGHT_END, + PAT_SPAVENTODOWN_START, + PAT_SPAVENTODOWN_LOOP, + PAT_SPAVENTODOWN_END, + + // Con oggetti: corpo completo + PAT_CONBICCHIERE, + PAT_CONCORDA, + PAT_CONVERME, + PAT_CONMARTELLO, + + // Suona il fischietto + PAT_FISCHIETTORIGHT, + + // Testa con barba + PAT_TALKBARBA_LEFT, + PAT_TALKBARBA_RIGHT, + + // Sniff + PAT_SNIFFA_LEFT, + PAT_SNIFFA_RIGHT, + + // Schifato + PAT_SCHIFATOLEFT_START, + PAT_SCHIFATOLEFT_LOOP, + PAT_SCHIFATOLEFT_END, + PAT_SCHIFATORIGHT_START, + PAT_SCHIFATORIGHT_LOOP, + PAT_SCHIFATORIGHT_END, + PAT_NAAHLEFT_START, + PAT_NAAHLEFT_LOOP, + PAT_NAAHLEFT_END, + PAT_NAAHRIGHT_START, + PAT_NAAHRIGHT_LOOP, + PAT_NAAHRIGHT_END, + + // Stand spaventato + PAT_SPAVENTOLEFT_STAND, + PAT_SPAVENTORIGHT_STAND, + PAT_SPAVENTODOWN_STAND, + + PAT_PUTLEFT_UP1, + PAT_PUTLEFT_UP2, + PAT_PUTRIGHT_UP1, + PAT_PUTRIGHT_UP2, + PAT_PUTLEFT_MID1, + PAT_PUTLEFT_MID2, + PAT_PUTRIGHT_MID1, + PAT_PUTRIGHT_MID2, + PAT_PUTLEFT_DOWN1, + PAT_PUTLEFT_DOWN2, + PAT_PUTRIGHT_DOWN1, + PAT_PUTRIGHT_DOWN2, + PAT_PUTUP_UP1, + PAT_PUTUP_UP2, + PAT_PUTUP_MID1, + PAT_PUTUP_MID2, + PAT_PUTUP_DOWN1, + PAT_PUTUP_DOWN2, + + PAT_CONSEGRETARIA + }; + + enum BODYPATTERNS { + BPAT_STANDUP = 1, + BPAT_STANDDOWN, + BPAT_STANDLEFT, + BPAT_STANDRIGHT, + + BPAT_MARTELLO, + BPAT_PUPAZZO, + BPAT_VERME, + BPAT_BICCHIERE, + + BPAT_CANTALEFT_START, + BPAT_CANTALEFT_LOOP, + BPAT_CANTALEFT_END, + + BPAT_FIANCHILEFT_START, + BPAT_FIANCHILEFT_LOOP, + BPAT_FIANCHILEFT_END, + BPAT_FIANCHIRIGHT_START, + BPAT_FIANCHIRIGHT_LOOP, + BPAT_FIANCHIRIGHT_END, + BPAT_FIANCHIUP_START, + BPAT_FIANCHIUP_LOOP, + BPAT_FIANCHIUP_END, + BPAT_FIANCHIDOWN_START, + BPAT_FIANCHIDOWN_LOOP, + BPAT_FIANCHIDOWN_END, + + BPAT_RIDELEFT, + BPAT_RIDERIGHT, + + BPAT_SIINDICALEFT, + BPAT_SIINDICARIGHT, + + BPAT_SPAVENTODOWN_START, + BPAT_SPAVENTODOWN_LOOP, + BPAT_SPAVENTODOWN_END, + BPAT_SPAVENTOLEFT_START, + BPAT_SPAVENTOLEFT_LOOP, + BPAT_SPAVENTOLEFT_END, + BPAT_SPAVENTORIGHT_START, + BPAT_SPAVENTORIGHT_LOOP, + BPAT_SPAVENTORIGHT_END, + BPAT_SPAVENTOUP_START, + BPAT_SPAVENTOUP_LOOP, + BPAT_SPAVENTOUP_END, + + BPAT_CORDA, + + BPAT_CONCONIGLIOLEFT_START, + BPAT_CONCONIGLIOLEFT_LOOP, + BPAT_CONCONIGLIOLEFT_END, + BPAT_CONCONIGLIORIGHT_START, + BPAT_CONCONIGLIORIGHT_LOOP, + BPAT_CONCONIGLIORIGHT_END, + + BPAT_CONRICETTALEFT_START, + BPAT_CONRICETTALEFT_LOOP, + BPAT_CONRICETTALEFT_END, + BPAT_CONRICETTARIGHT_START, + BPAT_CONRICETTARIGHT_LOOP, + BPAT_CONRICETTARIGHT_END, + + BPAT_CONCARTELEFT_START, + BPAT_CONCARTELEFT_LOOP, + BPAT_CONCARTELEFT_END, + BPAT_CONCARTERIGHT_START, + BPAT_CONCARTERIGHT_LOOP, + BPAT_CONCARTERIGHT_END, + + BPAT_CONPUPAZZOLEFT_START, + BPAT_CONPUPAZZOLEFT_LOOP, + BPAT_CONPUPAZZOLEFT_END, + BPAT_CONPUPAZZORIGHT_START, + BPAT_CONPUPAZZORIGHT_LOOP, + BPAT_CONPUPAZZORIGHT_END, + + BPAT_CONTACCUINOLEFT_START, + BPAT_CONTACCUINOLEFT_LOOP, + BPAT_CONTACCUINOLEFT_END, + BPAT_CONTACCUINORIGHT_START, + BPAT_CONTACCUINORIGHT_LOOP, + BPAT_CONTACCUINORIGHT_END, + + BPAT_CONMEGAFONOLEFT_START, + BPAT_CONMEGAFONOLEFT_LOOP, + BPAT_CONMEGAFONOLEFT_END, + BPAT_CONMEGAFONORIGHT_START, + BPAT_CONMEGAFONORIGHT_LOOP, + BPAT_CONMEGAFONORIGHT_END, + + BPAT_CONBARBALEFT_START, + BPAT_CONBARBALEFT_END, + BPAT_CONBARBARIGHT_START, + BPAT_CONBARBARIGHT_END, + BPAT_CONBARBALEFT_STATIC, + BPAT_CONBARBARIGHT_STATIC, + + BPAT_MACBETH1, + BPAT_MACBETH2, + BPAT_MACBETH3, + BPAT_MACBETH4, + BPAT_MACBETH5, + BPAT_MACBETH6, + BPAT_MACBETH7, + BPAT_MACBETH8, + BPAT_MACBETH9, + + BPAT_CONSEGRETARIA + }; + +public: + // Inizializza Tony + void Init(void); + + // Libera tutta la memoria + void Close(void); + + // Fa un frame di Tony, aggiornando il movimento, etc + void DoFrame(RMGfxTargetBuffer *bigBuf, int curLoc); + + // Metodi di Draw, che controlla la variabile di show + void Draw(RMGfxTargetBuffer &bigBuf, RMGfxPrimitive *prim); + + // Mostra o nascondi + void Show(void); + void Hide(bool bShowOmbra = false); + + // Si muove e fa un azione, se necessario + void MoveAndDoAction(RMPoint dst, RMItem *item, int nAction, int nActionParm = 0); + + // Ferma Tony (dalla parte giusta rispetto a un eventuale oggetto) + virtual void Stop(void); + void StopNoAction(void); + + // Setta un pattern + void SetPattern(int npatt, bool bPlayP0 = false); + + // Legge il pattern corrente + int GetCurPattern(); + + // Attende la fine di un pattern + void WaitForEndPattern(HANDLE hCustomSkip = INVALID_HANDLE_VALUE) { RMCharacter::WaitForEndPattern(hCustomSkip);} + + // Controlla se si trova in azione + bool InAction() { return (m_bActionPending&&m_Action != 0) | m_bAction; } + + // Controlla se c'è da aggiornare il movimento di scrolling + bool MustUpdateScrolling() { return ((!InAction()) || (IsMoving())); } + + // Prende la posizione di Tony + RMPoint Position() { return m_pos; } + + // Setta la posizione di scrolling + void SetScrollPosition(RMPoint pt) { RMCharacter::SetScrollPosition(pt); } + + // Setta l'animazione di Take + void Take(int nWhere, int nPart); + void Put(int nWhere, int nPart); + + // Start e End Talk + void StartTalk(TALKTYPE nTalkType); + void EndTalk(void); + + // Start e End Static + void StartStatic(TALKTYPE nTalkType); + void EndStatic(TALKTYPE nTalkType); + + // Tony si traveste! + void SetPastorella(bool bIsPast) { m_bPastorella=bIsPast; } + int GetPastorella(void) { return m_bPastorella; } + + // Esegue una azione + void ExecuteAction(int nAction, int nActionItem, int nParm); + + void PlaySfx(int nSfx) { RMItem::PlaySfx(nSfx); } +}; + + +} // End of namespace Tony + +#endif diff --git a/engines/tony/utils.cpp b/engines/tony/utils.cpp index 76d168e27a..48dcb9392a 100644 --- a/engines/tony/utils.cpp +++ b/engines/tony/utils.cpp @@ -28,14 +28,14 @@ * .z$* d$$$$$$$L ^*$c. * * #$$$. $$$$$$$$$ .$$$" Project: Roasted Moths........ * * ^*$b 4$$$$$$$$$F .d$*" * - * ^$$. 4$$$$$$$$$F .$P" Module: Loc.CPP.............. * + * ^$$. 4$$$$$$$$$F .$P" Module: Utils.CPP............ * * *$. '$$$$$$$$$ 4$P 4 * * J *$ "$$$$$$$" $P r Author: Giovanni Bajo........ * * z$ '$$$P*4c.*$$$*.z@*R$$$ $. * - * z$" "" #$F^ "" '$c Desc: Classi di gestione * - * z$$beu .ue=" $ "=e.. .zed$$c dei dati di una loca- * - * "#$e z$*" . `. ^*Nc e$"" zione................ * - * "$$". .r" ^4. .^$$" ..................... * + * z$" "" #$F^ "" '$c * + * 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++ * diff --git a/engines/tony/utils.h b/engines/tony/utils.h index bec42b343b..54e4cd0eae 100644 --- a/engines/tony/utils.h +++ b/engines/tony/utils.h @@ -28,14 +28,14 @@ * .z$* d$$$$$$$L ^*$c. * * #$$$. $$$$$$$$$ .$$$" Project: Roasted Moths........ * * ^*$b 4$$$$$$$$$F .d$*" * - * ^$$. 4$$$$$$$$$F .$P" Module: Loc.CPP.............. * + * ^$$. 4$$$$$$$$$F .$P" Module: Utils.CPP............ * * *$. '$$$$$$$$$ 4$P 4 * * J *$ "$$$$$$$" $P r Author: Giovanni Bajo........ * * z$ '$$$P*4c.*$$$*.z@*R$$$ $. * - * z$" "" #$F^ "" '$c Desc: Classi di gestione * - * z$$beu .ue=" $ "=e.. .zed$$c dei dati di una loca- * - * "#$e z$*" . `. ^*Nc e$"" zione................ * - * "$$". .r" ^4. .^$$" ..................... * + * z$" "" #$F^ "" '$c * + * 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++ * -- cgit v1.2.3