aboutsummaryrefslogtreecommitdiff
path: root/engines
diff options
context:
space:
mode:
authorStrangerke2012-05-14 21:29:27 +0200
committerStrangerke2012-05-14 21:29:27 +0200
commit88762667b52e4b904c56ecc94bf304c1a91e9feb (patch)
treee426444bceeac0fab8eaff774970f6100cf3cf1e /engines
parentd5b80688e773427e0a96fe9270b0177efd953b14 (diff)
downloadscummvm-rg350-88762667b52e4b904c56ecc94bf304c1a91e9feb.tar.gz
scummvm-rg350-88762667b52e4b904c56ecc94bf304c1a91e9feb.tar.bz2
scummvm-rg350-88762667b52e4b904c56ecc94bf304c1a91e9feb.zip
TONY: Fix some formatting
Diffstat (limited to 'engines')
-rw-r--r--engines/tony/adv.h24
-rw-r--r--engines/tony/custom.cpp1008
-rw-r--r--engines/tony/custom.h30
-rw-r--r--engines/tony/detection.cpp20
-rw-r--r--engines/tony/font.cpp472
-rw-r--r--engines/tony/font.h407
-rw-r--r--engines/tony/game.cpp272
-rw-r--r--engines/tony/game.h89
-rw-r--r--engines/tony/gfxcore.cpp528
-rw-r--r--engines/tony/gfxcore.h277
-rw-r--r--engines/tony/gfxengine.cpp357
-rw-r--r--engines/tony/gfxengine.h26
-rw-r--r--engines/tony/globals.h46
-rw-r--r--engines/tony/input.cpp10
-rw-r--r--engines/tony/input.h30
-rw-r--r--engines/tony/inventory.cpp199
-rw-r--r--engines/tony/tonychar.cpp31
-rw-r--r--engines/tony/window.cpp44
18 files changed, 2000 insertions, 1870 deletions
diff --git a/engines/tony/adv.h b/engines/tony/adv.h
index 314672fe39..90a9c245b5 100644
--- a/engines/tony/adv.h
+++ b/engines/tony/adv.h
@@ -37,24 +37,24 @@
namespace Tony {
// X & Y dimensions of the adventure
-#define RM_SX 640
-#define RM_SY 480
+#define RM_SX 640
+#define RM_SY 480
// X&Y dimensions of bigbuf
-#define RM_BBX (RM_SX)
-#define RM_BBY (RM_SY)
+#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
+// Skipping X&Y
+#define RM_SKIPY ((RM_BBY - RM_SY) / 2)
+#define RM_SKIPX 0
// Name lengths
// FIXME: Some of these can likely be removed when refactoring is completed
-#define MAX_DRIVE 10
-#define MAX_DIR 255
-#define MAX_PATH 255
-#define MAX_FNAME 100
-#define MAX_EXT 10
+#define MAX_DRIVE 10
+#define MAX_DIR 255
+#define MAX_PATH 255
+#define MAX_FNAME 100
+#define MAX_EXT 10
// Tony's actions
enum RMTonyAction {
diff --git a/engines/tony/custom.cpp b/engines/tony/custom.cpp
index d6e7fdd2ee..d38f840011 100644
--- a/engines/tony/custom.cpp
+++ b/engines/tony/custom.cpp
@@ -44,120 +44,60 @@ namespace Tony {
const char *tappetiFile[] = {
"None",
- "1.ADP", // Grilli.WAV
- "2.ADP", // Grilli-Ovattati.WAV
- "3.ADP", // Grilli-Vento.WAV
- "3.ADP", // Grilli-Vento1.WAV
- "5.ADP", // Vento1.WAV
- "4.ADP", // Mare1.WAV
- "6.ADP" // Mare1.WAV metà volume
+ "1.ADP", // Grilli.WAV
+ "2.ADP", // Grilli-Ovattati.WAV
+ "3.ADP", // Grilli-Vento.WAV
+ "3.ADP", // Grilli-Vento1.WAV
+ "5.ADP", // Vento1.WAV
+ "4.ADP", // Mare1.WAV
+ "6.ADP" // Mare1.WAV metà volume
};
struct MusicFileEntry {
const char *name;
int sync;
};
-const MusicFileEntry musicFiles[] = {
-/*
- { "PREGAME1.ADP", 0 }, { "SONO1.ADP", 0 },
- { "SONO2.ADP", 0 }, { "SONO3.ADP", 0 },
- { "CADUTA.ADP",0 }, { "RISVEGLIO.ADP", 0 },
- { "BACKGROUND.ADP", 0 }, { "PREGAME3.ADP", 0 },
- { "BARBUTA1.ADP", 2450 }, { "BARBUTA2.ADP", 0 },
-*/
- { "00.ADP", 0 }, { "01.ADP", 0 },
- { "02.ADP", 0 }, { "03.ADP", 0 },
- { "04.ADP",0 }, { "05.ADP", 0 },
- { "06.ADP", 0 }, { "07.ADP", 0 },
- { "08.ADP", 2450 }, { "09.ADP", 0 },
-
-/*
- { "BARBUTA3.ADP", 0 }, { "15-RUFUS.ADP", 0 },
- { "20-MAMMA.ADP", 0 }, { "32-MAMMARADIO.ADP", 0 },
- { "24-TUNNELOV-MIDI.ADP", 0 }, { "34-RAZZO.ADP", 0 },
- { "27-ZUCC1.ADP", 0 }, { "BEAST.ADP", 0 },
- { "22-MORTIMER.ADP", 0 }, { "25-PUB-OVATTATO.ADP", 0 },
-*/
- { "10.ADP", 0 }, { "11.ADP", 0 },
- { "12.ADP", 0 }, { "13.ADP", 0 },
- { "14.ADP", 0 }, { "15.ADP", 0 },
- { "16.ADP", 0 }, { "17.ADP", 0 },
- { "18.ADP", 0 }, { "19.ADP", 0 },
-/*
- { "25-PUB.ADP", 0 }, { "ALBERGO.ADP", 0 },
- { "37.ADP", 0 }, { "26-PIRAT.ADP", 0 },
- { "LORENZBACK.ADP", 0 }, { "LORENZ3.ADP", 0 },
- { "CASTLE.ADP", 0 }, { "53-BACKR.ADP", 0 },
- { "16-SMIL1.ADP", 1670 }, { "16-SMIL2.ADP", 0 },
-*/
- { "20.ADP", 0 }, { "21.ADP", 0 },
- { "22.ADP", 0 }, { "23.ADP", 0 },
- { "24.ADP", 0 }, { "25.ADP", 0 },
- { "26.ADP", 0 }, { "27.ADP", 0 },
- { "28.ADP", 1670 }, { "29.ADP", 0 },
-/*
- { "16-SMILE.ADP", 0 }, { "16-DIALOG2.ADP", 0 },
- { "07-SHAKE1.ADP", 2900 }, { "07-SHAKE2.ADP", 0 },
- { "07-SHAKE3.ADP", 0 }, { "46-BEEE.ADP", 0 },
- { "434748.ADP", 0 }, { "TORRE.ADP", 0 },
- { "50-DRAGO.ADP", 0 }, { "56-OPERA.ADP", 0 },
-*/
- { "30.ADP", 0 }, { "31.ADP", 0 },
- { "32.ADP", 2900 }, { "33.ADP", 0 },
- { "34.ADP", 0 }, { "35.ADP", 0 },
- { "36.ADP", 0 }, { "37.ADP", 0 },
- { "38.ADP", 0 }, { "39.ADP", 0 },
-/*
- { "FLAUTARP.ADP", 0 }, { "01-2001.ADP", 1920 },
- { "02-INTROPANORAMICA.ADP", 1560 }, { "03-PANORAMICA.ADP", 1920 },
- { "04-INTERNI.ADP", 1920 }, { "05-CADEPIUMA.ADP", 1920 },
- { "06-SCENDESCALE.ADP", 1920 }, { "07-THRILL.ADP", 1920 },
- { "08-CADUTAZUCCA.ADP", 1920 }, { "09-PIUMAALEGGIA.ADP", 1920 },
-*/
- { "40.ADP", 0 }, { "41.ADP", 1920 },
- { "42.ADP", 1560 }, { "43.ADP", 1920 },
- { "44.ADP", 1920 }, { "45.ADP", 1920 },
- { "46.ADP", 1920 }, { "47.ADP", 1920 },
- { "48.ADP", 1920 }, { "49.ADP", 1920 },
-
-/*
- { "10-JACKZUCCONA.ADP", 1920 }, { "11-JACKIMPRECAALLAGRANDELUNA.ADP", 1920 },
- { "12-GRANDELUNALOGO.ADP", 1920 }, { "60-BACKGROUND.ADP", 0 },
- { "TONYSTAR.ADP", 0 }, { "FUNNY.ADP", 0 },
- { "60-INIZIODIALOGO.ADP", 0 }, { "60-DIALOGO.ADP", 0 },
- { "60-JACKFELICE.ADP", 0 }, { "24-TONYVIOLENTATO.ADP", 0 }
-*/
-
- { "50.ADP", 1920 }, { "51.ADP", 1920 },
- { "52.ADP", 1920 }, { "53.ADP", 0 },
- { "54.ADP", 0 }, { "55.ADP", 0 },
- { "56.ADP", 0 }, { "57.ADP", 0 },
- { "58.ADP", 0 }, { "59.ADP", 0 }
+const MusicFileEntry musicFiles[] = {
+ {"00.ADP", 0}, {"01.ADP", 0},
+ {"02.ADP", 0}, {"03.ADP", 0},
+ {"04.ADP", 0}, {"05.ADP", 0},
+ {"06.ADP", 0}, {"07.ADP", 0},
+ {"08.ADP", 2450}, {"09.ADP", 0},
+ {"10.ADP", 0}, {"11.ADP", 0},
+ {"12.ADP", 0}, {"13.ADP", 0},
+ {"14.ADP", 0}, {"15.ADP", 0},
+ {"16.ADP", 0}, {"17.ADP", 0},
+ {"18.ADP", 0}, {"19.ADP", 0},
+ {"20.ADP", 0}, {"21.ADP", 0},
+ {"22.ADP", 0}, {"23.ADP", 0},
+ {"24.ADP", 0}, {"25.ADP", 0},
+ {"26.ADP", 0}, {"27.ADP", 0},
+ {"28.ADP", 1670}, {"29.ADP", 0},
+ {"30.ADP", 0}, {"31.ADP", 0},
+ {"32.ADP", 2900}, {"33.ADP", 0},
+ {"34.ADP", 0}, {"35.ADP", 0},
+ {"36.ADP", 0}, {"37.ADP", 0},
+ {"38.ADP", 0}, {"39.ADP", 0},
+ {"40.ADP", 0}, {"41.ADP", 1920},
+ {"42.ADP", 1560}, {"43.ADP", 1920},
+ {"44.ADP", 1920}, {"45.ADP", 1920},
+ {"46.ADP", 1920}, {"47.ADP", 1920},
+ {"48.ADP", 1920}, {"49.ADP", 1920},
+ {"50.ADP", 1920}, {"51.ADP", 1920},
+ {"52.ADP", 1920}, {"53.ADP", 0},
+ {"54.ADP", 0}, {"55.ADP", 0},
+ {"56.ADP", 0}, {"57.ADP", 0},
+ {"58.ADP", 0}, {"59.ADP", 0}
};
-const char *staccFileNames[] = {
-/*
- "05-MUCCA.ADP", "06-HALOW.ADP",
- "LETTERAINIZIO.ADP", "LETTERAPAURA.ADP",
- "LETTERAFINE.ADP", "PREGAME2.ADP",
- "07-TIMOT.ADP", "15-SHOTRUFUS.ADP",
- "15-SHOTTONY.ADP", "27-ZUCC2.ADP",
-*/
- "S00.ADP", "S01.ADP",
- "S02.ADP", "S03.ADP",
+const char *staccFileNames[] = {
+ "S00.ADP", "S01.ADP",
+ "S02.ADP", "S03.ADP",
"S04.ADP", "S05.ADP",
"S06.ADP", "S07.ADP",
"S08.ADP", "S09.ADP",
-
-/*
- "53-DLOGO.ADP", "16-DIALOG1.ADP",
- "TORRE1.ADP", "GARG1.ADP",
- "LORENZ1.ADP", "24-FIGHT.ADP",
- "08-MACBETH-PREPARA.ADP", "08-MACBETH-RECITA.ADP",
- "GATTO1.ADP"
-*/
"S10.ADP", "S11.ADP",
"S12.ADP", "S13.ADP",
"S14.ADP", "S15.ADP",
@@ -169,7 +109,7 @@ const char *staccFileNames[] = {
void ReapplyChangedHotspot(void) {
int i;
for (i = 0; i < GLOBALS.curChangedHotspot; i++)
- GLOBALS.Loc->GetItemFromCode(GLOBALS.ChangedHotspot[i].dwCode)->ChangeHotspot(RMPoint(GLOBALS.ChangedHotspot[i].nX, GLOBALS.ChangedHotspot[i].nY));
+ GLOBALS.Loc->GetItemFromCode(GLOBALS.ChangedHotspot[i].dwCode)->ChangeHotspot(RMPoint(GLOBALS.ChangedHotspot[i].nX, GLOBALS.ChangedHotspot[i].nY));
}
void SaveChangedHotspot(Common::OutSaveFile *f) {
@@ -182,7 +122,7 @@ void SaveChangedHotspot(Common::OutSaveFile *f) {
void LoadChangedHotspot(Common::InSaveFile *f) {
GLOBALS.curChangedHotspot = f->readByte();
-
+
if (GLOBALS.curChangedHotspot > 0) {
for (int i = 0; i < GLOBALS.curChangedHotspot; ++i)
GLOBALS.ChangedHotspot[i].Load(f);
@@ -191,13 +131,13 @@ void LoadChangedHotspot(Common::InSaveFile *f) {
/*
- Classi richieste per le funzioni custom!
+ Classi richieste per le funzioni custom!
- Tony (per muoverlo) -> si puo' fare tramite MPAL l'animazione? Penso proprio di sì
+ Tony (per muoverlo) -> si puo' fare tramite MPAL l'animazione? Penso proprio di sì
- SendMessage -> Direi che basta theEngine.SendMessage()
- ChangeLocation -> theEngine.ChangeLocation()
- AddInventory -> theEngine.AddInventory()
+ SendMessage -> Direi che basta theEngine.SendMessage()
+ ChangeLocation -> theEngine.ChangeLocation()
+ AddInventory -> theEngine.AddInventory()
*/
void MCharResetCodes(void) {
@@ -246,12 +186,12 @@ DECLARE_CUSTOM_FUNCTION(RightToMe)(CORO_PARAM, uint32, uint32, uint32, uint32) {
DECLARE_CUSTOM_FUNCTION(TonySetPalesati)(CORO_PARAM, uint32 bStatus, uint32, uint32, uint32) {
- GLOBALS.SetPalesati(bStatus);
+ GLOBALS.SetPalesati(bStatus);
}
DECLARE_CUSTOM_FUNCTION(MySleep)(CORO_PARAM, uint32 dwTime, uint32, uint32, uint32) {
CORO_BEGIN_CONTEXT;
- int i;
+ int i;
CORO_END_CONTEXT(_ctx);
CORO_BEGIN_CODE(_ctx);
@@ -269,25 +209,25 @@ DECLARE_CUSTOM_FUNCTION(SetAlwaysDisplay)(CORO_PARAM, uint32 val, uint32, uint32
DECLARE_CUSTOM_FUNCTION(SetPointer)(CORO_PARAM, uint32 dwPointer, uint32, uint32, uint32) {
switch (dwPointer) {
- case 1:
- GLOBALS.Pointer->SetSpecialPointer(GLOBALS.Pointer->PTR_FRECCIASU);
- break;
- case 2:
- GLOBALS.Pointer->SetSpecialPointer(GLOBALS.Pointer->PTR_FRECCIAGIU);
- break;
- case 3:
- GLOBALS.Pointer->SetSpecialPointer(GLOBALS.Pointer->PTR_FRECCIASINISTRA);
- break;
- case 4:
- GLOBALS.Pointer->SetSpecialPointer(GLOBALS.Pointer->PTR_FRECCIADESTRA);
- break;
- case 5:
- GLOBALS.Pointer->SetSpecialPointer(GLOBALS.Pointer->PTR_FRECCIAMAPPA);
- break;
+ case 1:
+ GLOBALS.Pointer->SetSpecialPointer(GLOBALS.Pointer->PTR_FRECCIASU);
+ break;
+ case 2:
+ GLOBALS.Pointer->SetSpecialPointer(GLOBALS.Pointer->PTR_FRECCIAGIU);
+ break;
+ case 3:
+ GLOBALS.Pointer->SetSpecialPointer(GLOBALS.Pointer->PTR_FRECCIASINISTRA);
+ break;
+ case 4:
+ GLOBALS.Pointer->SetSpecialPointer(GLOBALS.Pointer->PTR_FRECCIADESTRA);
+ break;
+ case 5:
+ GLOBALS.Pointer->SetSpecialPointer(GLOBALS.Pointer->PTR_FRECCIAMAPPA);
+ break;
- default:
- GLOBALS.Pointer->SetSpecialPointer(GLOBALS.Pointer->PTR_NONE);
- break;
+ default:
+ GLOBALS.Pointer->SetSpecialPointer(GLOBALS.Pointer->PTR_NONE);
+ break;
}
}
@@ -296,7 +236,7 @@ VoiceHeader *SearchVoiceHeader(uint32 codehi, uint32 codelo) {
int code;
code = (codehi << 16) | codelo;
-
+
if (_vm->_voices.size() == 0)
return NULL;
@@ -310,12 +250,12 @@ VoiceHeader *SearchVoiceHeader(uint32 codehi, uint32 codelo) {
DECLARE_CUSTOM_FUNCTION(SendTonyMessage)(CORO_PARAM, uint32 dwMessage, uint32 nX, uint32 nY, uint32) {
CORO_BEGIN_CONTEXT;
- RMMessage msg;
- int i;
- int curOffset;
- VoiceHeader *curVoc;
- FPSFX *voice;
- RMTextDialog text;
+ RMMessage msg;
+ int i;
+ int curOffset;
+ VoiceHeader *curVoc;
+ FPSFX *voice;
+ RMTextDialog text;
CORO_END_CONTEXT(_ctx);
CORO_BEGIN_CODE(_ctx);
@@ -337,11 +277,11 @@ DECLARE_CUSTOM_FUNCTION(SendTonyMessage)(CORO_PARAM, uint32 dwMessage, uint32 nX
// PRIMA VOLTA PREALLOCA
g_system->lockMutex(GLOBALS.vdb);
- //fseek(_vm->m_vdbFP, _ctx->curOffset, SEEK_SET);
+ // fseek(_vm->m_vdbFP, _ctx->curOffset, SEEK_SET);
_vm->_vdbFP.seek(_ctx->curOffset);
_vm->_theSound.CreateSfx(&_ctx->voice);
_ctx->voice->LoadVoiceFromVDB(_vm->_vdbFP);
-// _ctx->curOffset = ftell(_vm->m_vdbFP);
+ // _ctx->curOffset = ftell(_vm->m_vdbFP);
_ctx->curOffset = _vm->_vdbFP.pos();
_ctx->voice->SetLoop(false);
@@ -367,12 +307,12 @@ DECLARE_CUSTOM_FUNCTION(SendTonyMessage)(CORO_PARAM, uint32 dwMessage, uint32 nX
for (_ctx->i = 0; _ctx->i < _ctx->msg.NumPeriods() && !GLOBALS.bSkipIdle; _ctx->i++) {
_ctx->text.SetInput(GLOBALS.Input);
-
+
// Allineamento
_ctx->text.SetAlignType(RMText::HCENTER, RMText::VBOTTOM);
-
+
// Colore
- _ctx->text.SetColor(0,255,0);
+ _ctx->text.SetColor(0, 255, 0);
// Scrive il testo
_ctx->text.WriteText(_ctx->msg[_ctx->i], 0);
@@ -384,7 +324,10 @@ DECLARE_CUSTOM_FUNCTION(SendTonyMessage)(CORO_PARAM, uint32 dwMessage, uint32 nX
_ctx->text.SetPosition(RMPoint(nX, nY) - GLOBALS.Loc->ScrollPosition());
// Setta l'always display
- if (GLOBALS.bAlwaysDisplay) { _ctx->text.SetAlwaysDisplay(); _ctx->text.ForceTime(); }
+ if (GLOBALS.bAlwaysDisplay) {
+ _ctx->text.SetAlwaysDisplay();
+ _ctx->text.ForceTime();
+ }
// Registra il testo
GLOBALS.LinkGraphicTask(&_ctx->text);
@@ -395,11 +338,11 @@ DECLARE_CUSTOM_FUNCTION(SendTonyMessage)(CORO_PARAM, uint32 dwMessage, uint32 nX
_ctx->text.SetCustomSkipHandle2(_ctx->voice->hEndOfBuffer);
} else {
g_system->lockMutex(GLOBALS.vdb);
- // fseek(_vm->m_vdbFP, _ctx->curOffset, SEEK_SET);
+ // fseek(_vm->m_vdbFP, _ctx->curOffset, SEEK_SET);
_vm->_vdbFP.seek(_ctx->curOffset);
_vm->_theSound.CreateSfx(&_ctx->voice);
_ctx->voice->LoadVoiceFromVDB(_vm->_vdbFP);
- // _ctx->curOffset = ftell(_vm->m_vdbFP);
+ // _ctx->curOffset = ftell(_vm->m_vdbFP);
_ctx->curOffset = _vm->_vdbFP.pos();
_ctx->voice->SetLoop(false);
_ctx->voice->Play();
@@ -408,14 +351,14 @@ DECLARE_CUSTOM_FUNCTION(SendTonyMessage)(CORO_PARAM, uint32 dwMessage, uint32 nX
}
}
- // Aspetta la fine della visualizzazione
+ // Aspetta la fine della visualizzazione
_ctx->text.SetCustomSkipHandle(GLOBALS.hSkipIdle);
CORO_INVOKE_0(_ctx->text.WaitForEndDisplay);
if (_ctx->curVoc) {
_ctx->voice->Stop();
_ctx->voice->Release();
- _ctx->voice=NULL;
+ _ctx->voice = NULL;
}
}
@@ -435,7 +378,7 @@ DECLARE_CUSTOM_FUNCTION(ChangeBoxStatus)(CORO_PARAM, uint32 nLoc, uint32 nBox, u
DECLARE_CUSTOM_FUNCTION(CustLoadLocation)(CORO_PARAM, uint32 nLoc, uint32 tX, uint32 tY, uint32 bUseStartPos) {
CORO_BEGIN_CONTEXT;
- uint32 h;
+ uint32 h;
CORO_END_CONTEXT(_ctx);
CORO_BEGIN_CODE(_ctx);
@@ -461,20 +404,20 @@ DECLARE_CUSTOM_FUNCTION(CustLoadLocation)(CORO_PARAM, uint32 nLoc, uint32 tX, ui
DECLARE_CUSTOM_FUNCTION(SendFullscreenMsgStart)(CORO_PARAM, uint32 nMsg, uint32 nFont, uint32, uint32) {
CORO_BEGIN_CONTEXT;
- RMMessage *msg;
- RMGfxClearTask clear;
- int i;
- RMTextDialog text;
+ RMMessage *msg;
+ RMGfxClearTask clear;
+ int i;
+ RMTextDialog text;
CORO_END_CONTEXT(_ctx);
CORO_BEGIN_CODE(_ctx);
_ctx->msg = new RMMessage(nMsg);
-
+
GLOBALS.SFM_nLoc = GLOBALS.Loc->TEMPGetNumLoc();
GLOBALS.SFM_pt = GLOBALS.Tony->Position();
-
- if (GLOBALS.bSkipIdle)
+
+ if (GLOBALS.bSkipIdle)
return;
CORO_INVOKE_2(GLOBALS.UnloadLocation, false, NULL);
@@ -485,13 +428,13 @@ DECLARE_CUSTOM_FUNCTION(SendFullscreenMsgStart)(CORO_PARAM, uint32 nMsg, uint32
_ctx->text.SetInput(GLOBALS.Input);
// Allineamento
- _ctx->text.SetAlignType(RMText::HCENTER,RMText::VCENTER);
-
- // Forza il testo a scomparire a tempo
+ _ctx->text.SetAlignType(RMText::HCENTER, RMText::VCENTER);
+
+ // Forza il testo a scomparire a tempo
_ctx->text.ForceTime();
// Colore
- _ctx->text.SetColor(255,255,255);
+ _ctx->text.SetColor(255, 255, 255);
// Scrive il testo
if (nFont == 0)
@@ -509,7 +452,7 @@ DECLARE_CUSTOM_FUNCTION(SendFullscreenMsgStart)(CORO_PARAM, uint32 nMsg, uint32
GLOBALS.LinkGraphicTask(&_ctx->clear);
GLOBALS.LinkGraphicTask(&_ctx->text);
- // Aspetta la fine della visualizzazione
+ // Aspetta la fine della visualizzazione
_ctx->text.SetCustomSkipHandle(GLOBALS.hSkipIdle);
CORO_INVOKE_0(_ctx->text.WaitForEndDisplay);
}
@@ -521,14 +464,14 @@ DECLARE_CUSTOM_FUNCTION(SendFullscreenMsgStart)(CORO_PARAM, uint32 nMsg, uint32
DECLARE_CUSTOM_FUNCTION(ClearScreen)(CORO_PARAM, uint32, uint32, uint32, uint32) {
CORO_BEGIN_CONTEXT;
- char buf[256];
- RMGfxClearTask clear;
+ char buf[256];
+ RMGfxClearTask clear;
CORO_END_CONTEXT(_ctx);
CORO_BEGIN_CODE(_ctx);
GLOBALS.LinkGraphicTask(&_ctx->clear);
-
+
CORO_INVOKE_0(GLOBALS.WaitFrame);
CORO_END_CODE;
@@ -536,7 +479,7 @@ DECLARE_CUSTOM_FUNCTION(ClearScreen)(CORO_PARAM, uint32, uint32, uint32, uint32)
DECLARE_CUSTOM_FUNCTION(SendFullscreenMsgEnd)(CORO_PARAM, uint32 bNotEnableTony, uint32, uint32, uint32) {
GLOBALS.Freeze();
- GLOBALS.LoadLocation(GLOBALS.SFM_nLoc,RMPoint(GLOBALS.SFM_pt.x,GLOBALS.SFM_pt.y),RMPoint(-1,-1));
+ GLOBALS.LoadLocation(GLOBALS.SFM_nLoc, RMPoint(GLOBALS.SFM_pt.x, GLOBALS.SFM_pt.y), RMPoint(-1, -1));
if (!bNotEnableTony)
GLOBALS.Tony->Show();
GLOBALS.Unfreeze();
@@ -569,8 +512,8 @@ DECLARE_CUSTOM_FUNCTION(CloseLocation)(CORO_PARAM, uint32, uint32, uint32, uint3
CORO_BEGIN_CODE(_ctx);
if (!GLOBALS.bNoOcchioDiBue) {
- GLOBALS.InitWipe(1);
- CORO_INVOKE_0(GLOBALS.WaitWipeEnd);
+ GLOBALS.InitWipe(1);
+ CORO_INVOKE_0(GLOBALS.WaitWipeEnd);
}
_vm->StopMusic(4);
@@ -585,7 +528,7 @@ DECLARE_CUSTOM_FUNCTION(CloseLocation)(CORO_PARAM, uint32, uint32, uint32, uint3
DECLARE_CUSTOM_FUNCTION(ChangeLocation)(CORO_PARAM, uint32 nLoc, uint32 tX, uint32 tY, uint32 bUseStartPos) {
CORO_BEGIN_CONTEXT;
- uint32 h;
+ uint32 h;
CORO_END_CONTEXT(_ctx);
CORO_BEGIN_CODE(_ctx);
@@ -598,7 +541,7 @@ DECLARE_CUSTOM_FUNCTION(ChangeLocation)(CORO_PARAM, uint32 nLoc, uint32 tX, uint
if (GLOBALS.lastTappeto != GLOBALS.tappeti[nLoc]) {
_vm->StopMusic(4);
}
-
+
// On Exit e lascia freezzato
CORO_INVOKE_2(GLOBALS.UnloadLocation, true, NULL);
@@ -615,16 +558,16 @@ DECLARE_CUSTOM_FUNCTION(ChangeLocation)(CORO_PARAM, uint32 nLoc, uint32 tX, uint
}
if (!GLOBALS.bNoOcchioDiBue) {
- GLOBALS.InitWipe(2);
+ GLOBALS.InitWipe(2);
}
-
+
GLOBALS.Unfreeze();
_ctx->h = mpalQueryDoAction(0, nLoc, 0);
if (!GLOBALS.bNoOcchioDiBue) {
- CORO_INVOKE_0(GLOBALS.WaitWipeEnd);
+ CORO_INVOKE_0(GLOBALS.WaitWipeEnd);
GLOBALS.CloseWipe();
}
@@ -638,7 +581,7 @@ DECLARE_CUSTOM_FUNCTION(ChangeLocation)(CORO_PARAM, uint32 nLoc, uint32 tX, uint
}
DECLARE_CUSTOM_FUNCTION(SetLocStartPosition)(CORO_PARAM, uint32 nLoc, uint32 lX, uint32 lY, uint32) {
- GLOBALS.StartLocPos[nLoc].Set(lX,lY);
+ GLOBALS.StartLocPos[nLoc].Set(lX, lY);
}
DECLARE_CUSTOM_FUNCTION(SaveTonyPosition)(CORO_PARAM, uint32, uint32, uint32, uint32) {
@@ -653,7 +596,7 @@ DECLARE_CUSTOM_FUNCTION(RestoreTonyPosition)(CORO_PARAM, uint32, uint32, uint32,
CORO_BEGIN_CODE(_ctx);
CORO_INVOKE_4(ChangeLocation, GLOBALS.saveTonyLoc, GLOBALS.saveTonyPos.x, GLOBALS.saveTonyPos.y, 0);
-
+
MCharResetCodes();
CORO_END_CODE;
@@ -675,7 +618,7 @@ DECLARE_CUSTOM_FUNCTION(StopTony)(CORO_PARAM, uint32, uint32, uint32, uint32) {
DECLARE_CUSTOM_FUNCTION(CustEnableGUI)(CORO_PARAM, uint32, uint32, uint32, uint32) {
- GLOBALS.EnableGUI();
+ GLOBALS.EnableGUI();
}
DECLARE_CUSTOM_FUNCTION(CustDisableGUI)(CORO_PARAM, uint32, uint32, uint32, uint32) {
@@ -693,7 +636,7 @@ void TonyGenericTake1(CORO_PARAM, uint32 nDirection) {
GLOBALS.Freeze();
GLOBALS.Tony->Take(nDirection, 0);
GLOBALS.Unfreeze();
-
+
if (!GLOBALS.bSkipIdle)
CORO_INVOKE_0(GLOBALS.Tony->WaitForEndPattern);
@@ -714,7 +657,7 @@ void TonyGenericTake2(CORO_PARAM, uint32 nDirection) {
CORO_INVOKE_0(GLOBALS.Tony->WaitForEndPattern);
GLOBALS.Freeze();
- GLOBALS.Tony->Take(nDirection,2);
+ GLOBALS.Tony->Take(nDirection, 2);
GLOBALS.Unfreeze();
CORO_END_CODE;
@@ -729,7 +672,7 @@ void TonyGenericPut1(CORO_PARAM, uint32 nDirection) {
GLOBALS.Freeze();
GLOBALS.Tony->Put(nDirection, 0);
GLOBALS.Unfreeze();
-
+
if (!GLOBALS.bSkipIdle)
CORO_INVOKE_0(GLOBALS.Tony->WaitForEndPattern);
@@ -743,14 +686,14 @@ void TonyGenericPut2(CORO_PARAM, uint32 nDirection) {
CORO_BEGIN_CODE(_ctx);
GLOBALS.Freeze();
- GLOBALS.Tony->Put(nDirection,1);
+ GLOBALS.Tony->Put(nDirection, 1);
GLOBALS.Unfreeze();
if (!GLOBALS.bSkipIdle)
CORO_INVOKE_0(GLOBALS.Tony->WaitForEndPattern);
GLOBALS.Freeze();
- GLOBALS.Tony->Put(nDirection,2);
+ GLOBALS.Tony->Put(nDirection, 2);
GLOBALS.Unfreeze();
CORO_END_CODE;
@@ -831,7 +774,7 @@ DECLARE_CUSTOM_FUNCTION(TonySiRialza)(CORO_PARAM, uint32 dwParte, uint32, uint32
GLOBALS.Tony->SetPattern(GLOBALS.Tony->PAT_SIRIALZALEFT);
else
GLOBALS.Tony->SetPattern(GLOBALS.Tony->PAT_SIRIALZARIGHT);
-
+
if (!GLOBALS.bSkipIdle)
CORO_INVOKE_0(GLOBALS.Tony->WaitForEndPattern);
@@ -839,7 +782,7 @@ DECLARE_CUSTOM_FUNCTION(TonySiRialza)(CORO_PARAM, uint32 dwParte, uint32, uint32
}
DECLARE_CUSTOM_FUNCTION(TonyPastorella)(CORO_PARAM, uint32 bIsPast, uint32, uint32, uint32) {
- GLOBALS.Tony->SetPastorella(bIsPast);
+ GLOBALS.Tony->SetPastorella(bIsPast);
}
DECLARE_CUSTOM_FUNCTION(TonyFischietto)(CORO_PARAM, uint32, uint32, uint32, uint32) {
@@ -1189,7 +1132,7 @@ DECLARE_CUSTOM_FUNCTION(TonySniffaRight)(CORO_PARAM, uint32, uint32, uint32, uin
}
DECLARE_CUSTOM_FUNCTION(TonyNaah)(CORO_PARAM, uint32 dwText, uint32, uint32, uint32) {
- TonySetNumTexts(dwText);
+ TonySetNumTexts(dwText);
GLOBALS.nTonyNextTalkType = GLOBALS.Tony->TALK_NAAH;
}
@@ -1236,15 +1179,15 @@ DECLARE_CUSTOM_FUNCTION(DisableTony)(CORO_PARAM, uint32 bShowOmbra, uint32, uint
DECLARE_CUSTOM_FUNCTION(WaitForPatternEnd)(CORO_PARAM, uint32 nItem, uint32, uint32, uint32) {
CORO_BEGIN_CONTEXT;
- RMItem *item;
+ RMItem *item;
CORO_END_CONTEXT(_ctx);
CORO_BEGIN_CODE(_ctx);
_ctx->item = GLOBALS.Loc->GetItemFromCode(nItem);
-
+
if (!GLOBALS.bSkipIdle && _ctx->item != NULL)
- CORO_INVOKE_1(_ctx->item->WaitForEndPattern, GLOBALS.hSkipIdle);
+ CORO_INVOKE_1(_ctx->item->WaitForEndPattern, GLOBALS.hSkipIdle);
CORO_END_CODE;
}
@@ -1261,7 +1204,7 @@ DECLARE_CUSTOM_FUNCTION(MoveTonyAndWait)(CORO_PARAM, uint32 nX, uint32 nY, uint3
CORO_BEGIN_CODE(_ctx);
CORO_INVOKE_1(GLOBALS.Tony->Move, RMPoint(nX, nY));
-
+
if (!GLOBALS.bSkipIdle)
CORO_INVOKE_0(GLOBALS.Tony->WaitForEndMovement);
@@ -1274,8 +1217,8 @@ DECLARE_CUSTOM_FUNCTION(MoveTony)(CORO_PARAM, uint32 nX, uint32 nY, uint32, uint
DECLARE_CUSTOM_FUNCTION(ScrollLocation)(CORO_PARAM, uint32 nX, uint32 nY, uint32 sX, uint32 sY) {
CORO_BEGIN_CONTEXT;
- int lx, ly;
- RMPoint pt;
+ int lx, ly;
+ RMPoint pt;
CORO_END_CONTEXT(_ctx);
CORO_BEGIN_CODE(_ctx);
@@ -1285,21 +1228,25 @@ DECLARE_CUSTOM_FUNCTION(ScrollLocation)(CORO_PARAM, uint32 nX, uint32 nY, uint32
_ctx->ly = (int32)nY;
_ctx->pt = GLOBALS.Loc->ScrollPosition();
-
+
while ((_ctx->lx != 0 || _ctx->ly != 0) && !GLOBALS.bSkipIdle) {
if (_ctx->lx > 0) {
- _ctx->lx -= (int32)sX; if (_ctx->lx < 0) _ctx->lx = 0;
+ _ctx->lx -= (int32)sX;
+ if (_ctx->lx < 0) _ctx->lx = 0;
_ctx->pt.Offset((int32)sX, 0);
} else if (_ctx->lx < 0) {
- _ctx->lx += (int32)sX; if (_ctx->lx > 0) _ctx->lx = 0;
+ _ctx->lx += (int32)sX;
+ if (_ctx->lx > 0) _ctx->lx = 0;
_ctx->pt.Offset(-(int32)sX, 0);
}
if (_ctx->ly > 0) {
- _ctx->ly -= sY; if (_ctx->ly < 0) _ctx->ly = 0;
+ _ctx->ly -= sY;
+ if (_ctx->ly < 0) _ctx->ly = 0;
_ctx->pt.Offset(0, sY);
} else if (_ctx->ly < 0) {
- _ctx->ly += sY; if (_ctx->ly > 0) _ctx->ly = 0;
+ _ctx->ly += sY;
+ if (_ctx->ly > 0) _ctx->ly = 0;
_ctx->pt.Offset(0, -(int32)sY);
}
@@ -1316,11 +1263,11 @@ DECLARE_CUSTOM_FUNCTION(ScrollLocation)(CORO_PARAM, uint32 nX, uint32 nY, uint32
DECLARE_CUSTOM_FUNCTION(SyncScrollLocation)(CORO_PARAM, uint32 nX, uint32 nY, uint32 sX, uint32 sY) {
CORO_BEGIN_CONTEXT;
- int lx, ly;
- RMPoint pt, startpt;
- uint32 dwStartTime, dwCurTime, dwTotalTime;
- uint32 stepX, stepY;
- int dimx, dimy;
+ int lx, ly;
+ RMPoint pt, startpt;
+ uint32 dwStartTime, dwCurTime, dwTotalTime;
+ uint32 stepX, stepY;
+ int dimx, dimy;
CORO_END_CONTEXT(_ctx);
CORO_BEGIN_CODE(_ctx);
@@ -1330,16 +1277,19 @@ DECLARE_CUSTOM_FUNCTION(SyncScrollLocation)(CORO_PARAM, uint32 nX, uint32 nY, ui
_ctx->ly = (int32)nY;
_ctx->dimx = _ctx->lx;
_ctx->dimy = _ctx->ly;
- if (_ctx->lx < 0) _ctx->dimx = -_ctx->lx;
- if (_ctx->ly < 0) _ctx->dimy = -_ctx->ly;
+ if (_ctx->lx < 0)
+ _ctx->dimx = -_ctx->lx;
+
+ if (_ctx->ly < 0)
+ _ctx->dimy = -_ctx->ly;
_ctx->stepX = sX;
_ctx->stepY = sY;
_ctx->startpt = GLOBALS.Loc->ScrollPosition();
-
+
_ctx->dwStartTime = _vm->GetTime();
-
+
if (sX)
_ctx->dwTotalTime = _ctx->dimx * (1000 / 35) / sX;
else
@@ -1351,7 +1301,7 @@ DECLARE_CUSTOM_FUNCTION(SyncScrollLocation)(CORO_PARAM, uint32 nX, uint32 nY, ui
break;
_ctx->pt = _ctx->startpt;
-
+
if (sX) {
if (_ctx->lx > 0)
_ctx->pt.x += (_ctx->dimx * _ctx->dwCurTime) / _ctx->dwTotalTime;
@@ -1359,30 +1309,41 @@ DECLARE_CUSTOM_FUNCTION(SyncScrollLocation)(CORO_PARAM, uint32 nX, uint32 nY, ui
_ctx->pt.x -= (_ctx->dimx * _ctx->dwCurTime) / _ctx->dwTotalTime;
} else {
if (_ctx->ly > 0)
- _ctx->pt.y += (_ctx->dimy*_ctx->dwCurTime) / _ctx->dwTotalTime;
+ _ctx->pt.y += (_ctx->dimy * _ctx->dwCurTime) / _ctx->dwTotalTime;
else
- _ctx->pt.y -= (_ctx->dimy*_ctx->dwCurTime) / _ctx->dwTotalTime;
+ _ctx->pt.y -= (_ctx->dimy * _ctx->dwCurTime) / _ctx->dwTotalTime;
}
-/*
+/*
sX = _ctx->stepX * (_ctx->dwCurTime-dwLastTime) / (1000 / 35);
sY = _ctx->stepY * (_ctx->dwCurTime-dwLastTime) / (1000 / 35);
if (_ctx->lx > 0) {
- _ctx->lx-=sX; if (_ctx->lx < 0) _ctx->lx = 0;
- _ctx->pt.Offset(sX,0);
+ _ctx->lx -= sX;
+ if (_ctx->lx < 0)
+ _ctx->lx = 0;
+ _ctx->pt.Offset(sX, 0);
} else if (_ctx->lx < 0) {
- _ctx->lx+=sX; if (_ctx->lx > 0) _ctx->lx = 0;
- _ctx->pt.Offset(-sX,0);
+ _ctx->lx += sX;
+
+ if (_ctx->lx > 0)
+ _ctx->lx = 0;
+
+ _ctx->pt.Offset(-sX, 0);
}
if (_ctx->ly > 0) {
- _ctx->ly-=sY; if (_ctx->ly<0) _ctx->ly = 0;
- _ctx->pt.Offset(0,sY);
- } else if (_ctx->ly<0) {
- _ctx->ly+=sY; if (_ctx->ly > 0) _ctx->ly = 0;
- _ctx->pt.Offset(0,-sY);
+ _ctx->ly -= sY;
+ if (_ctx->ly < 0)
+ _ctx->ly = 0;
+ _ctx->pt.Offset(0, sY);
+ } else if (_ctx->ly < 0) {
+ _ctx->ly += sY;
+ if (_ctx->ly > 0)
+ _ctx->ly = 0;
+
+ _ctx->pt.Offset(0, -sY);
}
*/
CORO_INVOKE_0(GLOBALS.WaitFrame);
@@ -1422,15 +1383,15 @@ DECLARE_CUSTOM_FUNCTION(ChangeHotspot)(CORO_PARAM, uint32 dwCode, uint32 nX, uin
for (i = 0; i < GLOBALS.curChangedHotspot; i++)
if (GLOBALS.ChangedHotspot[i].dwCode == dwCode) {
- GLOBALS.ChangedHotspot[i].nX=nX;
- GLOBALS.ChangedHotspot[i].nY=nY;
+ GLOBALS.ChangedHotspot[i].nX = nX;
+ GLOBALS.ChangedHotspot[i].nY = nY;
break;
}
if (i == GLOBALS.curChangedHotspot) {
- GLOBALS.ChangedHotspot[i].dwCode=dwCode;
- GLOBALS.ChangedHotspot[i].nX=nX;
- GLOBALS.ChangedHotspot[i].nY=nY;
+ GLOBALS.ChangedHotspot[i].dwCode = dwCode;
+ GLOBALS.ChangedHotspot[i].nX = nX;
+ GLOBALS.ChangedHotspot[i].nY = nY;
GLOBALS.curChangedHotspot++;
}
@@ -1448,15 +1409,15 @@ DECLARE_CUSTOM_FUNCTION(Abort)(CORO_PARAM, uint32, uint32, uint32, uint32) {
DECLARE_CUSTOM_FUNCTION(TremaSchermo)(CORO_PARAM, uint32 nScosse, uint32, uint32, uint32) {
CORO_BEGIN_CONTEXT;
- uint32 i;
- uint32 curTime;
- int dirx,diry;
+ uint32 i;
+ uint32 curTime;
+ int dirx, diry;
CORO_END_CONTEXT(_ctx);
CORO_BEGIN_CODE(_ctx);
_ctx->curTime = _vm->GetTime();
-
+
_ctx->dirx = 1;
_ctx->diry = 1;
@@ -1480,14 +1441,14 @@ DECLARE_CUSTOM_FUNCTION(TremaSchermo)(CORO_PARAM, uint32 nScosse, uint32, uint32
GLOBALS.Loc->SetFixedScroll(RMPoint(0, 0));
GLOBALS.Tony->SetFixedScroll(RMPoint(0, 0));
GLOBALS.Unfreeze();
-
+
CORO_END_CODE;
}
/*
- * Personaggi
+ * Personaggi
*/
DECLARE_CUSTOM_FUNCTION(CharSetCode)(CORO_PARAM, uint32 nChar, uint32 nCode, uint32, uint32) {
@@ -1496,7 +1457,7 @@ DECLARE_CUSTOM_FUNCTION(CharSetCode)(CORO_PARAM, uint32 nChar, uint32 nCode, uin
GLOBALS.Character[nChar].item = GLOBALS.Loc->GetItemFromCode(nCode);
GLOBALS.Character[nChar].r = 255;
GLOBALS.Character[nChar].g = 255;
- GLOBALS.Character[nChar].b = 255;
+ GLOBALS.Character[nChar].b = 255;
GLOBALS.Character[nChar].talkpattern = 0;
GLOBALS.Character[nChar].starttalkpattern = 0;
GLOBALS.Character[nChar].endtalkpattern = 0;
@@ -1506,33 +1467,33 @@ DECLARE_CUSTOM_FUNCTION(CharSetCode)(CORO_PARAM, uint32 nChar, uint32 nCode, uin
}
DECLARE_CUSTOM_FUNCTION(CharSetColor)(CORO_PARAM, uint32 nChar, uint32 r, uint32 g, uint32 b) {
- assert(nChar<16);
+ assert(nChar < 16);
GLOBALS.Character[nChar].r = r;
GLOBALS.Character[nChar].g = g;
GLOBALS.Character[nChar].b = b;
}
DECLARE_CUSTOM_FUNCTION(CharSetTalkPattern)(CORO_PARAM, uint32 nChar, uint32 tp, uint32 sp, uint32) {
- assert(nChar<16);
+ assert(nChar < 16);
GLOBALS.Character[nChar].talkpattern = tp;
GLOBALS.Character[nChar].standpattern = sp;
}
DECLARE_CUSTOM_FUNCTION(CharSetStartEndTalkPattern)(CORO_PARAM, uint32 nChar, uint32 sp, uint32 ep, uint32) {
- assert(nChar<16);
- GLOBALS.Character[nChar].starttalkpattern=sp;
- GLOBALS.Character[nChar].endtalkpattern=ep;
+ assert(nChar < 16);
+ GLOBALS.Character[nChar].starttalkpattern = sp;
+ GLOBALS.Character[nChar].endtalkpattern = ep;
}
DECLARE_CUSTOM_FUNCTION(CharSendMessage)(CORO_PARAM, uint32 nChar, uint32 dwMessage, uint32 bIsBack, uint32) {
CORO_BEGIN_CONTEXT;
- RMMessage *msg;
- int i;
- RMPoint pt;
- RMTextDialog *text;
- int curOffset;
- VoiceHeader *curVoc;
- FPSFX *voice;
+ RMMessage *msg;
+ int i;
+ RMPoint pt;
+ RMTextDialog *text;
+ int curOffset;
+ VoiceHeader *curVoc;
+ FPSFX *voice;
CORO_END_CONTEXT(_ctx);
CORO_BEGIN_CODE(_ctx);
@@ -1542,16 +1503,16 @@ DECLARE_CUSTOM_FUNCTION(CharSendMessage)(CORO_PARAM, uint32 nChar, uint32 dwMess
assert(nChar < 16);
_ctx->pt = GLOBALS.Character[nChar].item->CalculatePos() - RMPoint(-60, 20) - GLOBALS.Loc->ScrollPosition();
-
+
if (GLOBALS.Character[nChar].starttalkpattern != 0) {
GLOBALS.Freeze();
GLOBALS.Character[nChar].item->SetPattern(GLOBALS.Character[nChar].starttalkpattern);
GLOBALS.Unfreeze();
-
+
CORO_INVOKE_0(GLOBALS.Character[nChar].item->WaitForEndPattern);
}
- GLOBALS.Freeze();
+ GLOBALS.Freeze();
GLOBALS.Character[nChar].item->SetPattern(GLOBALS.Character[nChar].talkpattern);
GLOBALS.Unfreeze();
@@ -1559,14 +1520,14 @@ DECLARE_CUSTOM_FUNCTION(CharSendMessage)(CORO_PARAM, uint32 nChar, uint32 dwMess
_ctx->voice = NULL;
if (_ctx->curVoc) {
// Si posiziona all'interno del database delle voci all'inizio della prima
-// fseek(_vm->m_vdbFP, _ctx->curVoc->offset, SEEK_SET);
+ // fseek(_vm->m_vdbFP, _ctx->curVoc->offset, SEEK_SET);
g_system->lockMutex(GLOBALS.vdb);
_vm->_vdbFP.seek(_ctx->curVoc->offset);
_ctx->curOffset = _ctx->curVoc->offset;
g_system->unlockMutex(GLOBALS.vdb);
}
- for (_ctx->i = 0; _ctx->i<_ctx->msg->NumPeriods() && !GLOBALS.bSkipIdle; _ctx->i++) {
+ for (_ctx->i = 0; _ctx->i < _ctx->msg->NumPeriods() && !GLOBALS.bSkipIdle; _ctx->i++) {
if (bIsBack) {
GLOBALS.curBackText = _ctx->text = new RMTextDialogScrolling(GLOBALS.Loc);
if (GLOBALS.bTonyIsSpeaking)
@@ -1578,21 +1539,24 @@ DECLARE_CUSTOM_FUNCTION(CharSendMessage)(CORO_PARAM, uint32 nChar, uint32 dwMess
// Skipping
_ctx->text->SetSkipStatus(!bIsBack);
-
+
// Allineamento
- _ctx->text->SetAlignType(RMText::HCENTER,RMText::VBOTTOM);
-
+ _ctx->text->SetAlignType(RMText::HCENTER, RMText::VBOTTOM);
+
// Colore
- _ctx->text->SetColor(GLOBALS.Character[nChar].r,GLOBALS.Character[nChar].g,GLOBALS.Character[nChar].b);
+ _ctx->text->SetColor(GLOBALS.Character[nChar].r, GLOBALS.Character[nChar].g, GLOBALS.Character[nChar].b);
// Scrive il testo
- _ctx->text->WriteText((*_ctx->msg)[_ctx->i],0);
+ _ctx->text->WriteText((*_ctx->msg)[_ctx->i], 0);
// Setta la posizione
_ctx->text->SetPosition(_ctx->pt);
// Setta l'always display
- if (GLOBALS.bAlwaysDisplay) { _ctx->text->SetAlwaysDisplay(); _ctx->text->ForceTime(); }
+ if (GLOBALS.bAlwaysDisplay) {
+ _ctx->text->SetAlwaysDisplay();
+ _ctx->text->ForceTime();
+ }
// Registra il testo
GLOBALS.LinkGraphicTask(_ctx->text);
@@ -1610,14 +1574,14 @@ DECLARE_CUSTOM_FUNCTION(CharSendMessage)(CORO_PARAM, uint32 nChar, uint32 dwMess
g_system->unlockMutex(GLOBALS.vdb);
}
- // Aspetta la fine della visualizzazione
+ // Aspetta la fine della visualizzazione
_ctx->text->SetCustomSkipHandle(GLOBALS.hSkipIdle);
CORO_INVOKE_0(_ctx->text->WaitForEndDisplay);
if (_ctx->curVoc) {
_ctx->voice->Stop();
_ctx->voice->Release();
- _ctx->voice=NULL;
+ _ctx->voice = NULL;
}
@@ -1630,7 +1594,7 @@ DECLARE_CUSTOM_FUNCTION(CharSendMessage)(CORO_PARAM, uint32 nChar, uint32 dwMess
GLOBALS.Character[nChar].item->SetPattern(GLOBALS.Character[nChar].endtalkpattern);
GLOBALS.Unfreeze();
CORO_INVOKE_0(GLOBALS.Character[nChar].item->WaitForEndPattern);
- }
+ }
GLOBALS.Freeze();
GLOBALS.Character[nChar].item->SetPattern(GLOBALS.Character[nChar].standpattern);
@@ -1641,7 +1605,7 @@ DECLARE_CUSTOM_FUNCTION(CharSendMessage)(CORO_PARAM, uint32 nChar, uint32 dwMess
}
DECLARE_CUSTOM_FUNCTION(AddInventory)(CORO_PARAM, uint32 dwCode, uint32, uint32, uint32) {
- GLOBALS.Inventory->AddItem(dwCode);
+ GLOBALS.Inventory->AddItem(dwCode);
}
DECLARE_CUSTOM_FUNCTION(RemoveInventory)(CORO_PARAM, uint32 dwCode, uint32, uint32, uint32) {
@@ -1649,67 +1613,66 @@ DECLARE_CUSTOM_FUNCTION(RemoveInventory)(CORO_PARAM, uint32 dwCode, uint32, uint
}
DECLARE_CUSTOM_FUNCTION(ChangeInventoryStatus)(CORO_PARAM, uint32 dwCode, uint32 dwStatus, uint32, uint32) {
- GLOBALS.Inventory->ChangeItemStatus(dwCode,dwStatus);
+ GLOBALS.Inventory->ChangeItemStatus(dwCode, dwStatus);
}
/*
- * Mastri Personaggi
+ * Mastri Personaggi
*/
DECLARE_CUSTOM_FUNCTION(MCharSetCode)(CORO_PARAM, uint32 nChar, uint32 nCode, uint32, uint32) {
assert(nChar < 10);
- GLOBALS.MCharacter[nChar].code=nCode;
- if (nCode== 0)
- GLOBALS.MCharacter[nChar].item=NULL;
+ GLOBALS.MCharacter[nChar].code = nCode;
+ if (nCode == 0)
+ GLOBALS.MCharacter[nChar].item = NULL;
else
- GLOBALS.MCharacter[nChar].item=GLOBALS.Loc->GetItemFromCode(nCode);
- GLOBALS.MCharacter[nChar].r=255;
- GLOBALS.MCharacter[nChar].g=255;
- GLOBALS.MCharacter[nChar].b=255;
- GLOBALS.MCharacter[nChar].x=-1;
- GLOBALS.MCharacter[nChar].y=-1;
+ GLOBALS.MCharacter[nChar].item = GLOBALS.Loc->GetItemFromCode(nCode);
+ GLOBALS.MCharacter[nChar].r = 255;
+ GLOBALS.MCharacter[nChar].g = 255;
+ GLOBALS.MCharacter[nChar].b = 255;
+ GLOBALS.MCharacter[nChar].x = -1;
+ GLOBALS.MCharacter[nChar].y = -1;
GLOBALS.MCharacter[nChar].bAlwaysBack = 0;
for (int i = 0; i < 10; i++)
GLOBALS.MCharacter[nChar].numtalks[i] = 1;
GLOBALS.MCharacter[nChar].curgroup = 0;
-
+
GLOBALS.IsMChar[nChar] = true;
}
DECLARE_CUSTOM_FUNCTION(MCharResetCode)(CORO_PARAM, uint32 nChar, uint32, uint32, uint32) {
- GLOBALS.MCharacter[nChar].item=GLOBALS.Loc->GetItemFromCode(GLOBALS.MCharacter[nChar].code);
+ GLOBALS.MCharacter[nChar].item = GLOBALS.Loc->GetItemFromCode(GLOBALS.MCharacter[nChar].code);
}
DECLARE_CUSTOM_FUNCTION(MCharSetPosition)(CORO_PARAM, uint32 nChar, uint32 nX, uint32 nY, uint32) {
assert(nChar < 10);
- GLOBALS.MCharacter[nChar].x=nX;
- GLOBALS.MCharacter[nChar].y=nY;
+ GLOBALS.MCharacter[nChar].x = nX;
+ GLOBALS.MCharacter[nChar].y = nY;
}
DECLARE_CUSTOM_FUNCTION(MCharSetColor)(CORO_PARAM, uint32 nChar, uint32 r, uint32 g, uint32 b) {
assert(nChar < 10);
- GLOBALS.MCharacter[nChar].r=r;
- GLOBALS.MCharacter[nChar].g=g;
- GLOBALS.MCharacter[nChar].b=b;
+ GLOBALS.MCharacter[nChar].r = r;
+ GLOBALS.MCharacter[nChar].g = g;
+ GLOBALS.MCharacter[nChar].b = b;
}
DECLARE_CUSTOM_FUNCTION(MCharSetNumTalksInGroup)(CORO_PARAM, uint32 nChar, uint32 nGroup, uint32 nTalks, uint32) {
- assert(nChar < 10);
+ assert(nChar < 10);
assert(nGroup < 10);
- GLOBALS.MCharacter[nChar].numtalks[nGroup]=nTalks;
+ GLOBALS.MCharacter[nChar].numtalks[nGroup] = nTalks;
}
-DECLARE_CUSTOM_FUNCTION(MCharSetCurrentGroup)(CORO_PARAM, uint32 nChar, uint32 nGroup, uint32, uint32)
-{
- assert(nChar < 10);
+DECLARE_CUSTOM_FUNCTION(MCharSetCurrentGroup)(CORO_PARAM, uint32 nChar, uint32 nGroup, uint32, uint32) {
+ assert(nChar < 10);
assert(nGroup < 10);
GLOBALS.MCharacter[nChar].curgroup = nGroup;
@@ -1718,28 +1681,28 @@ DECLARE_CUSTOM_FUNCTION(MCharSetCurrentGroup)(CORO_PARAM, uint32 nChar, uint32 n
DECLARE_CUSTOM_FUNCTION(MCharSetNumTexts)(CORO_PARAM, uint32 nChar, uint32 nTexts, uint32, uint32) {
assert(nChar < 10);
- GLOBALS.MCharacter[nChar].numtexts=nTexts-1;
+ GLOBALS.MCharacter[nChar].numtexts = nTexts - 1;
GLOBALS.MCharacter[nChar].bInTexts = false;
}
DECLARE_CUSTOM_FUNCTION(MCharSetAlwaysBack)(CORO_PARAM, uint32 nChar, uint32 bAlwaysBack, uint32, uint32) {
assert(nChar < 10);
- GLOBALS.MCharacter[nChar].bAlwaysBack=bAlwaysBack;
+ GLOBALS.MCharacter[nChar].bAlwaysBack = bAlwaysBack;
}
DECLARE_CUSTOM_FUNCTION(MCharSendMessage)(CORO_PARAM, uint32 nChar, uint32 dwMessage, uint32 bIsBack, uint32 nFont) {
CORO_BEGIN_CONTEXT;
- RMMessage *msg;
- int i;
- int parm;
- RMPoint pt;
- uint32 h;
- RMTextDialog *text;
- int curOffset;
- VoiceHeader *curVoc;
- FPSFX *voice;
+ RMMessage *msg;
+ int i;
+ int parm;
+ RMPoint pt;
+ uint32 h;
+ RMTextDialog *text;
+ int curOffset;
+ VoiceHeader *curVoc;
+ FPSFX *voice;
CORO_END_CONTEXT(_ctx);
CORO_BEGIN_CODE(_ctx);
@@ -1752,14 +1715,14 @@ DECLARE_CUSTOM_FUNCTION(MCharSendMessage)(CORO_PARAM, uint32 nChar, uint32 dwMes
bIsBack |= GLOBALS.MCharacter[nChar].bAlwaysBack ? 1 : 0;
// Calcola la posizione del testo in base al frame corrente
- if (GLOBALS.MCharacter[nChar].x==-1)
- _ctx->pt=GLOBALS.MCharacter[nChar].item->CalculatePos()-RMPoint(-60,20)-GLOBALS.Loc->ScrollPosition();
+ if (GLOBALS.MCharacter[nChar].x == -1)
+ _ctx->pt = GLOBALS.MCharacter[nChar].item->CalculatePos() - RMPoint(-60, 20) - GLOBALS.Loc->ScrollPosition();
else
- _ctx->pt=RMPoint(GLOBALS.MCharacter[nChar].x,GLOBALS.MCharacter[nChar].y);
-
+ _ctx->pt = RMPoint(GLOBALS.MCharacter[nChar].x, GLOBALS.MCharacter[nChar].y);
+
// Parametro per le azioni speciali: random tra le parlate
_ctx->parm = (GLOBALS.MCharacter[nChar].curgroup * 10) + _vm->_randomSource.getRandomNumber(
- GLOBALS.MCharacter[nChar].numtalks[GLOBALS.MCharacter[nChar].curgroup] - 1) + 1;
+ GLOBALS.MCharacter[nChar].numtalks[GLOBALS.MCharacter[nChar].curgroup] - 1) + 1;
// Cerca di eseguire la funzione custom per inizializzare la parlata
if (GLOBALS.MCharacter[nChar].item) {
@@ -1774,7 +1737,7 @@ DECLARE_CUSTOM_FUNCTION(MCharSendMessage)(CORO_PARAM, uint32 nChar, uint32 dwMes
if (_ctx->curVoc) {
// Si posiziona all'interno del database delle voci all'inizio della prima
g_system->lockMutex(GLOBALS.vdb);
- // fseek(_vm->m_vdbFP, curVoc->offset, SEEK_SET);
+ // fseek(_vm->m_vdbFP, curVoc->offset, SEEK_SET);
_vm->_vdbFP.seek(_ctx->curVoc->offset);
_ctx->curOffset = _ctx->curVoc->offset;
g_system->unlockMutex(GLOBALS.vdb);
@@ -1786,20 +1749,19 @@ DECLARE_CUSTOM_FUNCTION(MCharSendMessage)(CORO_PARAM, uint32 nChar, uint32 dwMes
GLOBALS.curBackText = _ctx->text = new RMTextDialogScrolling(GLOBALS.Loc);
if (GLOBALS.bTonyIsSpeaking)
CORO_INVOKE_0(GLOBALS.curBackText->Hide);
- }
- else
+ } else
_ctx->text = new RMTextDialog;
_ctx->text->SetInput(GLOBALS.Input);
// Skipping
_ctx->text->SetSkipStatus(!bIsBack);
-
+
// Allineamento
- _ctx->text->SetAlignType(RMText::HCENTER,RMText::VBOTTOM);
-
+ _ctx->text->SetAlignType(RMText::HCENTER, RMText::VBOTTOM);
+
// Colore
- _ctx->text->SetColor(GLOBALS.MCharacter[nChar].r,GLOBALS.MCharacter[nChar].g,GLOBALS.MCharacter[nChar].b);
+ _ctx->text->SetColor(GLOBALS.MCharacter[nChar].r, GLOBALS.MCharacter[nChar].g, GLOBALS.MCharacter[nChar].b);
// Scrive il testo
_ctx->text->WriteText((*_ctx->msg)[_ctx->i], nFont);
@@ -1808,7 +1770,10 @@ DECLARE_CUSTOM_FUNCTION(MCharSendMessage)(CORO_PARAM, uint32 nChar, uint32 dwMes
_ctx->text->SetPosition(_ctx->pt);
// Setta l'always display
- if (GLOBALS.bAlwaysDisplay) { _ctx->text->SetAlwaysDisplay(); _ctx->text->ForceTime(); }
+ if (GLOBALS.bAlwaysDisplay) {
+ _ctx->text->SetAlwaysDisplay();
+ _ctx->text->ForceTime();
+ }
// Registra il testo
GLOBALS.LinkGraphicTask(_ctx->text);
@@ -1826,7 +1791,7 @@ DECLARE_CUSTOM_FUNCTION(MCharSendMessage)(CORO_PARAM, uint32 nChar, uint32 dwMes
g_system->unlockMutex(GLOBALS.vdb);
}
- // Aspetta la fine della visualizzazione
+ // Aspetta la fine della visualizzazione
_ctx->text->SetCustomSkipHandle(GLOBALS.hSkipIdle);
CORO_INVOKE_0(_ctx->text->WaitForEndDisplay);
@@ -1836,7 +1801,7 @@ DECLARE_CUSTOM_FUNCTION(MCharSendMessage)(CORO_PARAM, uint32 nChar, uint32 dwMes
_ctx->voice = NULL;
}
- GLOBALS.curBackText = NULL;
+ GLOBALS.curBackText = NULL;
delete _ctx->text;
delete _ctx->msg;
}
@@ -1858,21 +1823,21 @@ DECLARE_CUSTOM_FUNCTION(MCharSendMessage)(CORO_PARAM, uint32 nChar, uint32 dwMes
/*
- * Dialoghi
+ * Dialoghi
*/
int curDialog;
DECLARE_CUSTOM_FUNCTION(SendDialogMessage)(CORO_PARAM, uint32 nPers, uint32 nMsg, uint32, uint32) {
CORO_BEGIN_CONTEXT;
- LPSTR string;
- RMTextDialog *text;
- int parm;
- uint32 h;
- bool bIsBack;
- VoiceHeader *curVoc;
- FPSFX *voice;
- RMPoint pt;
+ LPSTR string;
+ RMTextDialog *text;
+ int parm;
+ uint32 h;
+ bool bIsBack;
+ VoiceHeader *curVoc;
+ FPSFX *voice;
+ RMPoint pt;
CORO_END_CONTEXT(_ctx);
CORO_BEGIN_CODE(_ctx);
@@ -1881,7 +1846,7 @@ DECLARE_CUSTOM_FUNCTION(SendDialogMessage)(CORO_PARAM, uint32 nPers, uint32 nMsg
// La SendDialogMessage può andare in background se è un personaggio in MCHAR settato
// con la SetAlwaysBack
- if (nPers != 0 && GLOBALS.IsMChar[nPers] && GLOBALS.MCharacter[nPers].bAlwaysBack)
+ if (nPers != 0 && GLOBALS.IsMChar[nPers] && GLOBALS.MCharacter[nPers].bAlwaysBack)
_ctx->bIsBack = true;
_ctx->curVoc = SearchVoiceHeader(curDialog, nMsg);
@@ -1890,7 +1855,7 @@ DECLARE_CUSTOM_FUNCTION(SendDialogMessage)(CORO_PARAM, uint32 nPers, uint32 nMsg
if (_ctx->curVoc) {
// Si posiziona all'interno del database delle voci all'inizio della prima
g_system->lockMutex(GLOBALS.vdb);
-// fseek(_vm->m_vdbFP, _ctx->curVoc->offset, SEEK_SET);
+ // fseek(_vm->m_vdbFP, _ctx->curVoc->offset, SEEK_SET);
_vm->_vdbFP.seek(_ctx->curVoc->offset);
_vm->_theSound.CreateSfx(&_ctx->voice);
_ctx->voice->LoadVoiceFromVDB(_vm->_vdbFP);
@@ -1903,12 +1868,12 @@ DECLARE_CUSTOM_FUNCTION(SendDialogMessage)(CORO_PARAM, uint32 nPers, uint32 nMsg
if (nPers == 0) {
_ctx->text = new RMTextDialog;
- _ctx->text->SetColor(0,255,0);
- _ctx->text->SetPosition(GLOBALS.Tony->Position()-RMPoint(0,130)-GLOBALS.Loc->ScrollPosition());
- _ctx->text->WriteText(_ctx->string,0);
+ _ctx->text->SetColor(0, 255, 0);
+ _ctx->text->SetPosition(GLOBALS.Tony->Position() - RMPoint(0, 130) - GLOBALS.Loc->ScrollPosition());
+ _ctx->text->WriteText(_ctx->string, 0);
if (GLOBALS.dwTonyNumTexts > 0) {
- if (!GLOBALS.bTonyInTexts) {
+ if (!GLOBALS.bTonyInTexts) {
if (GLOBALS.nTonyNextTalkType != GLOBALS.Tony->TALK_NORMAL) {
CORO_INVOKE_1(GLOBALS.Tony->StartTalk, GLOBALS.nTonyNextTalkType);
if (!GLOBALS.bStaticTalk)
@@ -1930,15 +1895,15 @@ DECLARE_CUSTOM_FUNCTION(SendDialogMessage)(CORO_PARAM, uint32 nPers, uint32 nMsg
_ctx->pt = GLOBALS.Character[nPers].item->CalculatePos() - RMPoint(-60, 20) - GLOBALS.Loc->ScrollPosition();
if (GLOBALS.Character[nPers].starttalkpattern != 0) {
- GLOBALS.Freeze();
- GLOBALS.Character[nPers].item->SetPattern(GLOBALS.Character[nPers].starttalkpattern);
- GLOBALS.Unfreeze();
+ GLOBALS.Freeze();
+ GLOBALS.Character[nPers].item->SetPattern(GLOBALS.Character[nPers].starttalkpattern);
+ GLOBALS.Unfreeze();
CORO_INVOKE_0(GLOBALS.Character[nPers].item->WaitForEndPattern);
- }
+ }
GLOBALS.Character[nPers].item->SetPattern(GLOBALS.Character[nPers].talkpattern);
- _ctx->text->SetColor(GLOBALS.Character[nPers].r, GLOBALS.Character[nPers].g,GLOBALS.Character[nPers].b);
+ _ctx->text->SetColor(GLOBALS.Character[nPers].r, GLOBALS.Character[nPers].g, GLOBALS.Character[nPers].b);
_ctx->text->WriteText(_ctx->string, 0);
_ctx->text->SetPosition(_ctx->pt);
} else {
@@ -1949,7 +1914,7 @@ DECLARE_CUSTOM_FUNCTION(SendDialogMessage)(CORO_PARAM, uint32 nPers, uint32 nMsg
// Parametro per le azioni speciali: random tra le parlate
_ctx->parm = (GLOBALS.MCharacter[nPers].curgroup * 10) + _vm->_randomSource.getRandomNumber(
- GLOBALS.MCharacter[nPers].numtalks[GLOBALS.MCharacter[nPers].curgroup] - 1) + 1;
+ GLOBALS.MCharacter[nPers].numtalks[GLOBALS.MCharacter[nPers].curgroup] - 1) + 1;
if (GLOBALS.MCharacter[nPers].numtexts != 0 && GLOBALS.MCharacter[nPers].bInTexts) {
GLOBALS.MCharacter[nPers].numtexts--;
@@ -1960,7 +1925,7 @@ DECLARE_CUSTOM_FUNCTION(SendDialogMessage)(CORO_PARAM, uint32 nPers, uint32 nMsg
CORO_INVOKE_2(CoroScheduler.waitForSingleObject, _ctx->h, CORO_INFINITE);
GLOBALS.MCharacter[nPers].curTalk = _ctx->parm;
-
+
if (GLOBALS.MCharacter[nPers].numtexts != 0) {
GLOBALS.MCharacter[nPers].bInTexts = true;
GLOBALS.MCharacter[nPers].numtexts--;
@@ -1977,15 +1942,18 @@ DECLARE_CUSTOM_FUNCTION(SendDialogMessage)(CORO_PARAM, uint32 nPers, uint32 nMsg
_ctx->text = new RMTextDialog;
_ctx->text->SetSkipStatus(!GLOBALS.MCharacter[nPers].bAlwaysBack);
- _ctx->text->SetColor(GLOBALS.MCharacter[nPers].r,GLOBALS.MCharacter[nPers].g,GLOBALS.MCharacter[nPers].b);
- _ctx->text->WriteText(_ctx->string,0);
+ _ctx->text->SetColor(GLOBALS.MCharacter[nPers].r, GLOBALS.MCharacter[nPers].g, GLOBALS.MCharacter[nPers].b);
+ _ctx->text->WriteText(_ctx->string, 0);
_ctx->text->SetPosition(_ctx->pt);
}
if (!GLOBALS.bSkipIdle) {
_ctx->text->SetInput(GLOBALS.Input);
- if (GLOBALS.bAlwaysDisplay) { _ctx->text->SetAlwaysDisplay(); _ctx->text->ForceTime(); }
- _ctx->text->SetAlignType(RMText::HCENTER,RMText::VBOTTOM);
+ if (GLOBALS.bAlwaysDisplay) {
+ _ctx->text->SetAlwaysDisplay();
+ _ctx->text->ForceTime();
+ }
+ _ctx->text->SetAlignType(RMText::HCENTER, RMText::VBOTTOM);
GLOBALS.LinkGraphicTask(_ctx->text);
if (_ctx->curVoc) {
@@ -1993,7 +1961,7 @@ DECLARE_CUSTOM_FUNCTION(SendDialogMessage)(CORO_PARAM, uint32 nPers, uint32 nMsg
_ctx->text->SetCustomSkipHandle2(_ctx->voice->hEndOfBuffer);
}
- // Aspetta la fine della visualizzazione
+ // Aspetta la fine della visualizzazione
_ctx->text->SetCustomSkipHandle(GLOBALS.hSkipIdle);
CORO_INVOKE_0(_ctx->text->WaitForEndDisplay);
}
@@ -2001,25 +1969,25 @@ DECLARE_CUSTOM_FUNCTION(SendDialogMessage)(CORO_PARAM, uint32 nPers, uint32 nMsg
if (_ctx->curVoc) {
_ctx->voice->Stop();
_ctx->voice->Release();
- _ctx->voice=NULL;
+ _ctx->voice = NULL;
}
if (nPers != 0) {
if (!GLOBALS.IsMChar[nPers]) {
- if (GLOBALS.Character[nPers].endtalkpattern != 0) {
+ if (GLOBALS.Character[nPers].endtalkpattern != 0) {
GLOBALS.Freeze();
GLOBALS.Character[nPers].item->SetPattern(GLOBALS.Character[nPers].endtalkpattern);
GLOBALS.Unfreeze();
CORO_INVOKE_0(GLOBALS.Character[nPers].item->WaitForEndPattern);
- }
-
+ }
+
GLOBALS.Character[nPers].item->SetPattern(GLOBALS.Character[nPers].standpattern);
delete _ctx->text;
} else {
- if ((GLOBALS.MCharacter[nPers].bInTexts && GLOBALS.MCharacter[nPers].numtexts== 0) || !GLOBALS.MCharacter[nPers].bInTexts) {
+ if ((GLOBALS.MCharacter[nPers].bInTexts && GLOBALS.MCharacter[nPers].numtexts == 0) || !GLOBALS.MCharacter[nPers].bInTexts) {
// Cerca di eseguire la funzione custom per chiudere la parlata
- GLOBALS.MCharacter[nPers].curTalk = (GLOBALS.MCharacter[nPers].curTalk%10) + GLOBALS.MCharacter[nPers].curgroup*10;
- _ctx->h = mpalQueryDoAction(31,GLOBALS.MCharacter[nPers].item->MpalCode(),GLOBALS.MCharacter[nPers].curTalk);
+ GLOBALS.MCharacter[nPers].curTalk = (GLOBALS.MCharacter[nPers].curTalk % 10) + GLOBALS.MCharacter[nPers].curgroup * 10;
+ _ctx->h = mpalQueryDoAction(31, GLOBALS.MCharacter[nPers].item->MpalCode(), GLOBALS.MCharacter[nPers].curTalk);
if (_ctx->h != CORO_INVALID_PID_VALUE)
CORO_INVOKE_2(CoroScheduler.waitForSingleObject, _ctx->h, CORO_INFINITE);
@@ -2031,7 +1999,7 @@ DECLARE_CUSTOM_FUNCTION(SendDialogMessage)(CORO_PARAM, uint32 nPers, uint32 nMsg
delete _ctx->text;
}
} else {
- if ((GLOBALS.dwTonyNumTexts== 0 && GLOBALS.bTonyInTexts) || !GLOBALS.bTonyInTexts) {
+ if ((GLOBALS.dwTonyNumTexts == 0 && GLOBALS.bTonyInTexts) || !GLOBALS.bTonyInTexts) {
CORO_INVOKE_0(GLOBALS.Tony->EndTalk);
GLOBALS.dwTonyNumTexts = 0;
GLOBALS.bTonyInTexts = false;
@@ -2050,24 +2018,24 @@ DECLARE_CUSTOM_FUNCTION(SendDialogMessage)(CORO_PARAM, uint32 nPers, uint32 nMsg
DECLARE_CUSTOM_FUNCTION(StartDialog)(CORO_PARAM, uint32 nDialog, uint32 nStartGroup, uint32, uint32) {
CORO_BEGIN_CONTEXT;
- uint32 nChoice;
- uint32 *sl;
- uint32 i, num;
- char *string;
- RMDialogChoice dc;
- int sel;
+ uint32 nChoice;
+ uint32 *sl;
+ uint32 i, num;
+ char *string;
+ RMDialogChoice dc;
+ int sel;
CORO_END_CONTEXT(_ctx);
CORO_BEGIN_CODE(_ctx);
curDialog = nDialog;
-
+
// Call MPAL to start the dialog
mpalQueryDoDialog(nDialog, nStartGroup);
// Wait until a choice is selected
mpalQueryDialogWaitForChoice(&_ctx->nChoice);
- while (_ctx->nChoice != (uint32)-1) {
+ while (_ctx->nChoice != (uint32) - 1) {
// Si fa dare la lista di opzioni e le conta
_ctx->sl = mpalQueryDialogSelectList(_ctx->nChoice);
for (_ctx->num = 0; _ctx->sl[_ctx->num] != 0; _ctx->num++)
@@ -2082,7 +2050,7 @@ DECLARE_CUSTOM_FUNCTION(StartDialog)(CORO_PARAM, uint32 nDialog, uint32 nStartGr
mpalQueryDialogWaitForChoice(&_ctx->nChoice);
continue;
}
-
+
// Crea una scelta per il dialogo
_ctx->dc.Init();
_ctx->dc.SetNumChoices(_ctx->num);
@@ -2102,17 +2070,17 @@ DECLARE_CUSTOM_FUNCTION(StartDialog)(CORO_PARAM, uint32 nDialog, uint32 nStartGr
// Disegna il puntatore
GLOBALS.Pointer->SetSpecialPointer(GLOBALS.Pointer->PTR_NONE);
MainShowMouse();
-
+
while (!(GLOBALS.Input->MouseLeftClicked() && ((_ctx->sel = _ctx->dc.GetSelection()) != -1))) {
CORO_INVOKE_0(GLOBALS.WaitFrame);
GLOBALS.Freeze();
CORO_INVOKE_1(_ctx->dc.DoFrame, GLOBALS.Input->MousePos());
GLOBALS.Unfreeze();
- }
+ }
// Nascondi il puntatore
MainHideMouse();
-
+
CORO_INVOKE_0(_ctx->dc.Hide);
mpalQueryDialogSelectionDWORD(_ctx->nChoice, _ctx->sl[_ctx->sel]);
@@ -2130,7 +2098,7 @@ DECLARE_CUSTOM_FUNCTION(StartDialog)(CORO_PARAM, uint32 nDialog, uint32 nStartGr
/*
- * Sync tra idle e mpal
+ * Sync tra idle e mpal
*/
DECLARE_CUSTOM_FUNCTION(TakeOwnership)(CORO_PARAM, uint32 num, uint32, uint32, uint32) {
@@ -2138,7 +2106,7 @@ DECLARE_CUSTOM_FUNCTION(TakeOwnership)(CORO_PARAM, uint32 num, uint32, uint32, u
}
DECLARE_CUSTOM_FUNCTION(ReleaseOwnership)(CORO_PARAM, uint32 num, uint32, uint32, uint32) {
- CoroScheduler.pulseEvent(GLOBALS.mut[num]);
+ CoroScheduler.pulseEvent(GLOBALS.mut[num]);
warning("TODO: Validate that the use of events in TakeOwnership/ReleaseOwnership match original");
}
@@ -2153,20 +2121,20 @@ DECLARE_CUSTOM_FUNCTION(ReleaseOwnership)(CORO_PARAM, uint32 num, uint32, uint32
/*
- * Musica
+ * Musica
* ------
*
* Effetti di fade supportati:
*
* nFX = 0 - La nuova musica si sostituisce a quella vecchia
* nFX=1 - La nuova musica si interfade con quella vecchia
- * nFX=2 - La nuova musica subentra a tempo con quella vecchia
+ * nFX=2 - La nuova musica subentra a tempo con quella vecchia
*
*/
void ThreadFadeInMusic(CORO_PARAM, const void *nMusic) {
CORO_BEGIN_CONTEXT;
- int i;
+ int i;
CORO_END_CONTEXT(_ctx);
int nChannel = *(const int *)nMusic;
@@ -2183,7 +2151,7 @@ void ThreadFadeInMusic(CORO_PARAM, const void *nMusic) {
_vm->SetMusicVolume(nChannel, 64);
debug("End FadeIn Music");
-
+
CORO_KILL_SELF();
CORO_END_CODE;
@@ -2191,8 +2159,8 @@ void ThreadFadeInMusic(CORO_PARAM, const void *nMusic) {
void ThreadFadeOutMusic(CORO_PARAM, const void *nMusic) {
CORO_BEGIN_CONTEXT;
- int i;
- int startVolume;
+ int i;
+ int startVolume;
CORO_END_CONTEXT(_ctx);
int nChannel = *(const int *)nMusic;
@@ -2209,7 +2177,7 @@ void ThreadFadeOutMusic(CORO_PARAM, const void *nMusic) {
CORO_INVOKE_1(CoroScheduler.sleep, 100);
}
-
+
if (!GLOBALS.bFadeOutStop)
_vm->SetMusicVolume(nChannel, 0);
@@ -2282,21 +2250,21 @@ void CustPlayMusic(uint32 nChannel, const char *mFN, uint32 nFX, bool bLoop, int
}
DECLARE_CUSTOM_FUNCTION(PlaySonoriz)(CORO_PARAM, uint32 nMusic, uint32 nFX, uint32 bNoLoop, uint32) {
- if (nFX == 0 || nFX == 1 || nFX==2) {
+ if (nFX == 0 || nFX == 1 || nFX == 2) {
debug("PlaySonoriz stop fadeout");
GLOBALS.bFadeOutStop = true;
}
-
+
GLOBALS.lastMusic = nMusic;
CustPlayMusic(GLOBALS.curSonoriz, musicFiles[nMusic].name, nFX, bNoLoop ? false : true, musicFiles[nMusic].sync);
}
DECLARE_CUSTOM_FUNCTION(PlayStacchetto)(CORO_PARAM, uint32 nMusic, uint32 nFX, uint32 bLoop, uint32) {
- CustPlayMusic(2,staccFileNames[nMusic],nFX,bLoop);
+ CustPlayMusic(2, staccFileNames[nMusic], nFX, bLoop);
}
DECLARE_CUSTOM_FUNCTION(PlayItemSfx)(CORO_PARAM, uint32 nItem, uint32 nSFX, uint32, uint32) {
- if (nItem== 0) {
+ if (nItem == 0) {
GLOBALS.Tony->PlaySfx(nSFX);
} else {
RMItem *item = GLOBALS.Loc->GetItemFromCode(nItem);
@@ -2340,7 +2308,7 @@ DECLARE_CUSTOM_FUNCTION(StacchettoFadeStart)(CORO_PARAM, uint32 nStacc, uint32 b
CORO_INVOKE_4(FadeOutSonoriz, 0, 0, 0, 0);
CORO_INVOKE_4(MuteStacchetto, 0, 0, 0, 0);
CORO_INVOKE_4(PlayStacchetto, nStacc, 0, bLoop, 0);
- CORO_INVOKE_4(FadeInStacchetto, 0, 0, 0, 0);
+ CORO_INVOKE_4(FadeInStacchetto, 0, 0, 0, 0);
CORO_END_CODE;
}
@@ -2403,21 +2371,21 @@ DECLARE_CUSTOM_FUNCTION(OpenInitOptions)(CORO_PARAM, uint32, uint32, uint32, uin
DECLARE_CUSTOM_FUNCTION(DoCredits)(CORO_PARAM, uint32 nMsg, uint32 dwTime, uint32, uint32) {
CORO_BEGIN_CONTEXT;
- RMMessage *msg;
- RMTextDialog *text;
- uint32 hDisable;
- int i;
- uint32 startTime;
+ RMMessage *msg;
+ RMTextDialog *text;
+ uint32 hDisable;
+ int i;
+ uint32 startTime;
CORO_END_CONTEXT(_ctx);
CORO_BEGIN_CODE(_ctx);
_ctx->msg = new RMMessage(nMsg);
_ctx->hDisable = CoroScheduler.createEvent(true, false);
-
+
_ctx->text = new RMTextDialog[_ctx->msg->NumPeriods()];
- for (_ctx->i = 0; _ctx->i < _ctx->msg->NumPeriods(); _ctx->i++) {
+ for (_ctx->i = 0; _ctx->i < _ctx->msg->NumPeriods(); _ctx->i++) {
_ctx->text[_ctx->i].SetInput(GLOBALS.Input);
// Alignment
@@ -2426,24 +2394,24 @@ DECLARE_CUSTOM_FUNCTION(DoCredits)(CORO_PARAM, uint32 nMsg, uint32 dwTime, uint3
_ctx->text[_ctx->i].WriteText(&(*_ctx->msg)[_ctx->i][1], 3);
_ctx->text[_ctx->i].SetPosition(RMPoint(414, 70 + _ctx->i * 26)); // 70
} else {
- _ctx->text[_ctx->i].SetAlignType(RMText::HLEFT,RMText::VTOP);
+ _ctx->text[_ctx->i].SetAlignType(RMText::HLEFT, RMText::VTOP);
_ctx->text[_ctx->i].WriteText((*_ctx->msg)[_ctx->i], 3);
_ctx->text[_ctx->i].SetPosition(RMPoint(260, 70 + _ctx->i * 26));
}
-
-
+
+
// Setta la posizione
_ctx->text[_ctx->i].SetAlwaysDisplay();
_ctx->text[_ctx->i].SetForcedTime(dwTime * 1000);
_ctx->text[_ctx->i].SetNoTab();
- // Aspetta la fine della visualizzazione
+ // Aspetta la fine della visualizzazione
_ctx->text[_ctx->i].SetCustomSkipHandle(_ctx->hDisable);
// Registra il testo
GLOBALS.LinkGraphicTask(&_ctx->text[_ctx->i]);
}
-
+
_ctx->startTime = _vm->GetTime();
while (_ctx->startTime + dwTime * 1000 > _vm->GetTime()) {
@@ -2469,155 +2437,155 @@ DECLARE_CUSTOM_FUNCTION(DoCredits)(CORO_PARAM, uint32 nMsg, uint32 dwTime, uint3
BEGIN_CUSTOM_FUNCTION_MAP()
- ASSIGN( 1, CustLoadLocation)
- ASSIGN( 2, MySleep)
- ASSIGN( 3, SetPointer)
- ASSIGN( 5, MoveTony)
- ASSIGN( 6, FaceToMe)
- ASSIGN( 7, BackToMe)
- ASSIGN( 8, LeftToMe)
- ASSIGN( 9, RightToMe)
- ASSIGN( 10, SendTonyMessage)
- ASSIGN( 11, ChangeBoxStatus)
- ASSIGN( 12, ChangeLocation)
- ASSIGN( 13, DisableTony)
- ASSIGN( 14, EnableTony)
- ASSIGN( 15, WaitForPatternEnd)
- ASSIGN( 16, SetLocStartPosition)
- ASSIGN( 17, ScrollLocation)
- ASSIGN( 18, MoveTonyAndWait)
- ASSIGN( 19, ChangeHotspot)
- ASSIGN( 20, AddInventory)
- ASSIGN( 21, RemoveInventory)
- ASSIGN( 22, ChangeInventoryStatus)
- ASSIGN( 23, SetTonyPosition)
- ASSIGN( 24, SendFullscreenMessage)
- ASSIGN( 25, SaveTonyPosition)
- ASSIGN( 26, RestoreTonyPosition)
- ASSIGN( 27, DisableInput)
- ASSIGN( 28, EnableInput)
- ASSIGN( 29, StopTony)
-
- ASSIGN( 30, TonyTakeUp1)
- ASSIGN( 31, TonyTakeMid1)
- ASSIGN( 32, TonyTakeDown1)
- ASSIGN( 33, TonyTakeUp2)
- ASSIGN( 34, TonyTakeMid2)
- ASSIGN( 35, TonyTakeDown2)
-
- ASSIGN( 72, TonyPutUp1)
- ASSIGN( 73, TonyPutMid1)
- ASSIGN( 74, TonyPutDown1)
- ASSIGN( 75, TonyPutUp2)
- ASSIGN( 76, TonyPutMid2)
- ASSIGN( 77, TonyPutDown2)
-
- ASSIGN( 36, TonyPerTerra)
- ASSIGN( 37, TonySiRialza)
- ASSIGN( 38, TonyPastorella)
- ASSIGN( 39, TonyFischietto)
-
- ASSIGN( 40, TonyRide)
- ASSIGN( 41, TonyFianchi)
- ASSIGN( 42, TonyCanta)
- ASSIGN( 43, TonySiIndica)
- ASSIGN( 44, TonySpaventatoConMani)
- ASSIGN( 49, TonySpaventatoSenzaMani)
- ASSIGN( 45, TonyConBicchiere)
- ASSIGN( 46, TonyConVerme)
- ASSIGN( 47, TonyConMartello)
- ASSIGN( 48, TonyConCorda)
- ASSIGN( 90, TonyConConiglioANIM)
- ASSIGN( 91, TonyConRicettaANIM)
- ASSIGN( 92, TonyConCarteANIM)
- ASSIGN( 93, TonyConPupazzoANIM)
- ASSIGN( 94, TonyConPupazzoStart)
- ASSIGN( 95, TonyConPupazzoEnd)
- ASSIGN( 96, TonyConConiglioStart)
- ASSIGN( 97, TonyConConiglioEnd)
- ASSIGN( 98, TonyConRicettaStart)
- ASSIGN( 99, TonyConRicettaEnd)
- ASSIGN(100, TonyConCarteStart)
- ASSIGN(101, TonyConCarteEnd)
- ASSIGN(102, TonyConTaccuinoStart)
- ASSIGN(103, TonyConTaccuinoEnd)
- ASSIGN(104, TonyConMegafonoStart)
- ASSIGN(105, TonyConMegafonoEnd)
- ASSIGN(106, TonyConBarbaStart)
- ASSIGN(107, TonyConBarbaEnd)
- ASSIGN(108, TonyRidacchia)
- ASSIGN(109, TonySchifato)
- ASSIGN(110, TonyNaah)
- ASSIGN(111, TonyMacbeth)
- ASSIGN(112, TonySniffaLeft)
- ASSIGN(113, TonySniffaRight)
- ASSIGN(114, TonySpaventatoStart)
- ASSIGN(115, TonySpaventatoEnd)
- ASSIGN(116, TonyConSegretaria)
-
- ASSIGN( 50, CharSetCode)
- ASSIGN( 51, CharSetColor)
- ASSIGN( 52, CharSetTalkPattern)
- ASSIGN( 53, CharSendMessage)
- ASSIGN( 54, CharSetStartEndTalkPattern)
-
- ASSIGN( 60, MCharSetCode)
- ASSIGN( 61, MCharSetColor)
- ASSIGN( 62, MCharSetCurrentGroup)
- ASSIGN( 63, MCharSetNumTalksInGroup)
- ASSIGN( 64, MCharSetNumTexts)
- ASSIGN( 65, MCharSendMessage)
- ASSIGN( 66, MCharSetPosition)
- ASSIGN( 67, MCharSetAlwaysBack)
- ASSIGN( 68, MCharResetCode)
-
- ASSIGN( 70, StartDialog)
- ASSIGN( 71, SendDialogMessage)
-
- ASSIGN( 80, TakeOwnership)
- ASSIGN( 81, ReleaseOwnership)
-
- ASSIGN( 86, PlaySonoriz)
- ASSIGN( 87, PlayStacchetto)
- ASSIGN( 88, FadeInSonoriz)
- ASSIGN( 89, FadeOutSonoriz)
- ASSIGN(123, FadeInStacchetto)
- ASSIGN(124, FadeOutStacchetto)
- ASSIGN(125, MuteSonoriz)
- ASSIGN(126, DemuteSonoriz)
- ASSIGN(127, MuteStacchetto)
- ASSIGN(128, DemuteStacchetto)
- ASSIGN( 84, StopSonoriz)
- ASSIGN( 85, StopStacchetto)
- ASSIGN( 83, PlayItemSfx)
- ASSIGN(129, StacchettoFadeStart)
- ASSIGN(130, StacchettoFadeEnd)
-
- ASSIGN(120, TremaSchermo)
- ASSIGN(121, AutoSave)
- ASSIGN(122, Abort)
- ASSIGN(131, NoOcchioDiBue)
- ASSIGN(132, SendFullscreenMsgStart)
- ASSIGN(133, SendFullscreenMsgEnd)
- ASSIGN(134, CustEnableGUI)
- ASSIGN(135, CustDisableGUI)
- ASSIGN(136, ClearScreen)
- ASSIGN(137, PatIrqFreeze)
- ASSIGN(138, TonySetPalesati)
- ASSIGN(139, OpenInitLoadMenu)
- ASSIGN(140, OpenInitOptions)
- ASSIGN(141, SyncScrollLocation)
- ASSIGN(142, CloseLocation)
- ASSIGN(143, SetAlwaysDisplay)
- ASSIGN(144, DoCredits)
-
- ASSIGN( 200, MustSkipIdleStart);
- ASSIGN( 201, MustSkipIdleEnd);
+ASSIGN(1, CustLoadLocation)
+ASSIGN(2, MySleep)
+ASSIGN(3, SetPointer)
+ASSIGN(5, MoveTony)
+ASSIGN(6, FaceToMe)
+ASSIGN(7, BackToMe)
+ASSIGN(8, LeftToMe)
+ASSIGN(9, RightToMe)
+ASSIGN(10, SendTonyMessage)
+ASSIGN(11, ChangeBoxStatus)
+ASSIGN(12, ChangeLocation)
+ASSIGN(13, DisableTony)
+ASSIGN(14, EnableTony)
+ASSIGN(15, WaitForPatternEnd)
+ASSIGN(16, SetLocStartPosition)
+ASSIGN(17, ScrollLocation)
+ASSIGN(18, MoveTonyAndWait)
+ASSIGN(19, ChangeHotspot)
+ASSIGN(20, AddInventory)
+ASSIGN(21, RemoveInventory)
+ASSIGN(22, ChangeInventoryStatus)
+ASSIGN(23, SetTonyPosition)
+ASSIGN(24, SendFullscreenMessage)
+ASSIGN(25, SaveTonyPosition)
+ASSIGN(26, RestoreTonyPosition)
+ASSIGN(27, DisableInput)
+ASSIGN(28, EnableInput)
+ASSIGN(29, StopTony)
+
+ASSIGN(30, TonyTakeUp1)
+ASSIGN(31, TonyTakeMid1)
+ASSIGN(32, TonyTakeDown1)
+ASSIGN(33, TonyTakeUp2)
+ASSIGN(34, TonyTakeMid2)
+ASSIGN(35, TonyTakeDown2)
+
+ASSIGN(72, TonyPutUp1)
+ASSIGN(73, TonyPutMid1)
+ASSIGN(74, TonyPutDown1)
+ASSIGN(75, TonyPutUp2)
+ASSIGN(76, TonyPutMid2)
+ASSIGN(77, TonyPutDown2)
+
+ASSIGN(36, TonyPerTerra)
+ASSIGN(37, TonySiRialza)
+ASSIGN(38, TonyPastorella)
+ASSIGN(39, TonyFischietto)
+
+ASSIGN(40, TonyRide)
+ASSIGN(41, TonyFianchi)
+ASSIGN(42, TonyCanta)
+ASSIGN(43, TonySiIndica)
+ASSIGN(44, TonySpaventatoConMani)
+ASSIGN(49, TonySpaventatoSenzaMani)
+ASSIGN(45, TonyConBicchiere)
+ASSIGN(46, TonyConVerme)
+ASSIGN(47, TonyConMartello)
+ASSIGN(48, TonyConCorda)
+ASSIGN(90, TonyConConiglioANIM)
+ASSIGN(91, TonyConRicettaANIM)
+ASSIGN(92, TonyConCarteANIM)
+ASSIGN(93, TonyConPupazzoANIM)
+ASSIGN(94, TonyConPupazzoStart)
+ASSIGN(95, TonyConPupazzoEnd)
+ASSIGN(96, TonyConConiglioStart)
+ASSIGN(97, TonyConConiglioEnd)
+ASSIGN(98, TonyConRicettaStart)
+ASSIGN(99, TonyConRicettaEnd)
+ASSIGN(100, TonyConCarteStart)
+ASSIGN(101, TonyConCarteEnd)
+ASSIGN(102, TonyConTaccuinoStart)
+ASSIGN(103, TonyConTaccuinoEnd)
+ASSIGN(104, TonyConMegafonoStart)
+ASSIGN(105, TonyConMegafonoEnd)
+ASSIGN(106, TonyConBarbaStart)
+ASSIGN(107, TonyConBarbaEnd)
+ASSIGN(108, TonyRidacchia)
+ASSIGN(109, TonySchifato)
+ASSIGN(110, TonyNaah)
+ASSIGN(111, TonyMacbeth)
+ASSIGN(112, TonySniffaLeft)
+ASSIGN(113, TonySniffaRight)
+ASSIGN(114, TonySpaventatoStart)
+ASSIGN(115, TonySpaventatoEnd)
+ASSIGN(116, TonyConSegretaria)
+
+ASSIGN(50, CharSetCode)
+ASSIGN(51, CharSetColor)
+ASSIGN(52, CharSetTalkPattern)
+ASSIGN(53, CharSendMessage)
+ASSIGN(54, CharSetStartEndTalkPattern)
+
+ASSIGN(60, MCharSetCode)
+ASSIGN(61, MCharSetColor)
+ASSIGN(62, MCharSetCurrentGroup)
+ASSIGN(63, MCharSetNumTalksInGroup)
+ASSIGN(64, MCharSetNumTexts)
+ASSIGN(65, MCharSendMessage)
+ASSIGN(66, MCharSetPosition)
+ASSIGN(67, MCharSetAlwaysBack)
+ASSIGN(68, MCharResetCode)
+
+ASSIGN(70, StartDialog)
+ASSIGN(71, SendDialogMessage)
+
+ASSIGN(80, TakeOwnership)
+ASSIGN(81, ReleaseOwnership)
+
+ASSIGN(86, PlaySonoriz)
+ASSIGN(87, PlayStacchetto)
+ASSIGN(88, FadeInSonoriz)
+ASSIGN(89, FadeOutSonoriz)
+ASSIGN(123, FadeInStacchetto)
+ASSIGN(124, FadeOutStacchetto)
+ASSIGN(125, MuteSonoriz)
+ASSIGN(126, DemuteSonoriz)
+ASSIGN(127, MuteStacchetto)
+ASSIGN(128, DemuteStacchetto)
+ASSIGN(84, StopSonoriz)
+ASSIGN(85, StopStacchetto)
+ASSIGN(83, PlayItemSfx)
+ASSIGN(129, StacchettoFadeStart)
+ASSIGN(130, StacchettoFadeEnd)
+
+ASSIGN(120, TremaSchermo)
+ASSIGN(121, AutoSave)
+ASSIGN(122, Abort)
+ASSIGN(131, NoOcchioDiBue)
+ASSIGN(132, SendFullscreenMsgStart)
+ASSIGN(133, SendFullscreenMsgEnd)
+ASSIGN(134, CustEnableGUI)
+ASSIGN(135, CustDisableGUI)
+ASSIGN(136, ClearScreen)
+ASSIGN(137, PatIrqFreeze)
+ASSIGN(138, TonySetPalesati)
+ASSIGN(139, OpenInitLoadMenu)
+ASSIGN(140, OpenInitOptions)
+ASSIGN(141, SyncScrollLocation)
+ASSIGN(142, CloseLocation)
+ASSIGN(143, SetAlwaysDisplay)
+ASSIGN(144, DoCredits)
+
+ASSIGN(200, MustSkipIdleStart);
+ASSIGN(201, MustSkipIdleEnd);
END_CUSTOM_FUNCTION_MAP()
void SetupGlobalVars(RMTony *tony, RMPointer *ptr, RMGameBoxes *box, RMLocation *loc, RMInventory *inv, RMInput *input) {
- GLOBALS.Tony = tony;
+ GLOBALS.Tony = tony;
GLOBALS.Pointer = ptr;
GLOBALS.Boxes = box;
GLOBALS.Loc = loc;
@@ -2643,7 +2611,7 @@ void SetupGlobalVars(RMTony *tony, RMPointer *ptr, RMGameBoxes *box, RMLocation
GLOBALS.bAlwaysDisplay = false;
int i;
- for (i = 0;i < 10; i++)
+ for (i = 0; i < 10; i++)
GLOBALS.mut[i] = CoroScheduler.createEvent(false, false);
for (i = 0; i < 200; i++)
diff --git a/engines/tony/custom.h b/engines/tony/custom.h
index 875710f974..9b53dc32d7 100644
--- a/engines/tony/custom.h
+++ b/engines/tony/custom.h
@@ -38,32 +38,30 @@ namespace Tony {
using namespace MPAL;
/*
- * Defines
+ * Defines
*/
typedef uint32 HWND;
-#define INIT_CUSTOM_FUNCTION MapCustomFunctions
-#define INIT_CUSTOM_FUNCTION_STRING "MapCustomFunctions"
+#define INIT_CUSTOM_FUNCTION MapCustomFunctions
+#define INIT_CUSTOM_FUNCTION_STRING "MapCustomFunctions"
-#define DECLARE_CUSTOM_FUNCTION(x) void x
+#define DECLARE_CUSTOM_FUNCTION(x) void x
-#define BEGIN_CUSTOM_FUNCTION_MAP() \
- static void AssignError(int num) { \
- error("Custom function %u has been already assigned!", num); \
- } \
+#define BEGIN_CUSTOM_FUNCTION_MAP() \
+ static void AssignError(int num) { \
+ error("Custom function %u has been already assigned!", num); \
+ } \
void INIT_CUSTOM_FUNCTION(LPCUSTOMFUNCTION *lpMap, Common::String *lpStrMap) \
- {
+ {
-
-#define END_CUSTOM_FUNCTION_MAP() \
+#define END_CUSTOM_FUNCTION_MAP() \
}
-
-#define ASSIGN(num, func) \
- if (lpMap[num] != NULL) \
- AssignError(num); \
- lpMap[num] = func; \
+#define ASSIGN(num, func) \
+ if (lpMap[num] != NULL) \
+ AssignError(num); \
+ lpMap[num] = func; \
lpStrMap[num] = #func;
class RMTony;
diff --git a/engines/tony/detection.cpp b/engines/tony/detection.cpp
index 7a943223a4..944f717f26 100644
--- a/engines/tony/detection.cpp
+++ b/engines/tony/detection.cpp
@@ -44,8 +44,8 @@ Common::Language TonyEngine::getLanguage() const {
return _gameDescription->desc.language;
}
-bool TonyEngine::getIsDemo() const {
- return _gameDescription->desc.flags & ADGF_DEMO;
+bool TonyEngine::getIsDemo() const {
+ return _gameDescription->desc.flags & ADGF_DEMO;
}
}
@@ -79,14 +79,14 @@ public:
bool TonyMetaEngine::hasFeature(MetaEngineFeature f) const {
return
- (f == kSupportsListSaves) ||
+ (f == kSupportsListSaves) ||
// (f == kSupportsLoadingDuringStartup) ||
- (f == kSupportsDeleteSave);
+ (f == kSupportsDeleteSave);
}
bool Tony::TonyEngine::hasFeature(EngineFeature f) const {
return
- (f == kSupportsRTL);
+ (f == kSupportsRTL);
}
bool TonyMetaEngine::createInstance(OSystem *syst, Engine **engine, const ADGameDescription *desc) const {
@@ -104,7 +104,7 @@ SaveStateList TonyMetaEngine::listSaves(const char *target) const {
Common::String pattern = "tony.0??";
filenames = saveFileMan->listSavefiles(pattern);
- sort(filenames.begin(), filenames.end()); // Sort (hopefully ensuring we are sorted numerically..)
+ sort(filenames.begin(), filenames.end()); // Sort (hopefully ensuring we are sorted numerically..)
SaveStateList saveList;
for (Common::StringArray::const_iterator file = filenames.begin(); file != filenames.end(); ++file) {
@@ -126,7 +126,9 @@ SaveStateList TonyMetaEngine::listSaves(const char *target) const {
return saveList;
}
-int TonyMetaEngine::getMaximumSaveSlot() const { return 99; }
+int TonyMetaEngine::getMaximumSaveSlot() const {
+ return 99;
+}
void TonyMetaEngine::removeSaveState(const char *target, int slot) const {
Common::String filename = Tony::TonyEngine::GetSaveStateFileName(slot);
@@ -135,7 +137,7 @@ void TonyMetaEngine::removeSaveState(const char *target, int slot) const {
}
#if PLUGIN_ENABLED_DYNAMIC(TONY)
- REGISTER_PLUGIN_DYNAMIC(TONY, PLUGIN_TYPE_ENGINE, TonyMetaEngine);
+REGISTER_PLUGIN_DYNAMIC(TONY, PLUGIN_TYPE_ENGINE, TonyMetaEngine);
#else
- REGISTER_PLUGIN_STATIC(TONY, PLUGIN_TYPE_ENGINE, TonyMetaEngine);
+REGISTER_PLUGIN_STATIC(TONY, PLUGIN_TYPE_ENGINE, TonyMetaEngine);
#endif
diff --git a/engines/tony/font.cpp b/engines/tony/font.cpp
index c2af10c74a..5396b73796 100644
--- a/engines/tony/font.cpp
+++ b/engines/tony/font.cpp
@@ -73,8 +73,7 @@ void RMFont::Load(const byte *buf, int nChars, int dimx, int dimy, uint32 palRes
if (nChars == 112 && palResID == RES_F_PAL) {
// Font parla
DumpFontBMP("font_parla.bmp", buf, nChars, dimx, dimy, RMRes(palResID));
- }
- else if (nChars == 102 && palResID == RES_F_PAL) {
+ } else if (nChars == 102 && palResID == RES_F_PAL) {
// Font macc
DumpFontBMP("font_macc.bmp", buf, nChars, dimx, dimy, RMRes(palResID));
} else if (nChars == 85 && palResID == RES_F_PAL) {
@@ -82,7 +81,7 @@ void RMFont::Load(const byte *buf, int nChars, int dimx, int dimy, uint32 palRes
DumpFontBMP("font_obj.bmp", buf, nChars, dimx, dimy, RMRes(palResID));
} else if (nChars == 112 && palResID == RES_F_CPAL) {
// Font credits
- DumpFontBMP("font_credits.bmp", buf, nChars, dimx, dimy, RMRes(palResID));
+ DumpFontBMP("font_credits.bmp", buf, nChars, dimx, dimy, RMRes(palResID));
}
#endif
@@ -96,7 +95,7 @@ void RMFont::Load(const byte *buf, int nChars, int dimx, int dimy, uint32 palRes
m_fontDimx = dimx;
m_fontDimy = dimy;
- nLetters=nChars;
+ nLetters = nChars;
}
void RMFont::Load(uint32 resID, int nChars, int dimx, int dimy, uint32 palResID) {
@@ -172,7 +171,7 @@ int RMFont::StringLen(char bChar, char bNext) {
\****************************************************************************/
RMFontColor::RMFontColor() : RMFont() {
- m_r = m_g = m_b = 255;
+ m_r = m_g = m_b = 255;
}
RMFontColor::~RMFontColor() {
@@ -189,7 +188,7 @@ void RMFontColor::SetBaseColor(byte r1, byte g1, byte b1) {
int bstep = b / 14;
int i;
- byte pal[768*3];
+ byte pal[768 * 3];
// Controlla se siamo gia' sul colore giusto
if (m_r == r1 && m_g == g1 && m_b == b1)
@@ -201,18 +200,18 @@ void RMFontColor::SetBaseColor(byte r1, byte g1, byte b1) {
// Costruisce la nuova palette per il font
for (i = 1; i < 16; i++) {
- pal[i * 3 + 0] = r >> 16;
- pal[i * 3 + 1] = g >> 16;
- pal[i * 3 + 2] = b >> 16;
+ pal[i * 3 + 0] = r >> 16;
+ pal[i * 3 + 1] = g >> 16;
+ pal[i * 3 + 2] = b >> 16;
r -= rstep;
g -= gstep;
b -= bstep;
}
- pal[15*3 + 0] += 8;
- pal[15*3 + 1] += 8;
- pal[15*3 + 2] += 8;
+ pal[15 * 3 + 0] += 8;
+ pal[15 * 3 + 1] += 8;
+ pal[15 * 3 + 2] += 8;
// La mette in tutte le lettere
for (i = 0; i < nLetters; i++)
@@ -229,12 +228,12 @@ void RMFontParla::Init(void) {
// bernie: numero di caratteri nel font
int nchars =
- 112 // base
- + 18 // polish
- + 66 // russian
- + 30 // czech
- + 8 // french
- + 5; // deutsch
+ 112 // base
+ + 18 // polish
+ + 66 // russian
+ + 30 // czech
+ + 8 // french
+ + 5; // deutsch
Load(RES_F_PARL, nchars, 20, 20);
@@ -306,8 +305,8 @@ void RMFontParla::Init(void) {
cTable[(byte)'æ'] = 107;
cTable[(byte)'Æ'] = 108;
cTable[(byte)'ø'] = 109;
- //cTable['ƒ'] = 110; integrale
- cTable['\''] = 111;
+ //cTable['ƒ'] = 110; integrale
+ cTable['\''] = 111;
// Un po' di lunghezze
lTable[' '] = 9;
@@ -346,7 +345,7 @@ void RMFontParla::Init(void) {
// Polish characters
//AaCcEeLlNnOoSsZzZz
//¥¹ÆæÊꣳÑñÓ󌜯¿Ÿ
-
+
cTable[(byte)'¥'] = 112;
cTable[(byte)'¹'] = 113;
cTable[(byte)'Æ'] = 114;
@@ -487,7 +486,7 @@ void RMFontParla::Init(void) {
lTable[(byte)'Ø'] = 17;
lTable[(byte)'Ù'] = 18;
lTable[(byte)'Ü'] = 16;
- lTable[(byte)'Ú'] = 18;
+ lTable[(byte)'Ú'] = 18;
lTable[(byte)'Û'] = 19;
lTable[(byte)'Ý'] = 11;
lTable[(byte)'Þ'] = 16;
@@ -640,12 +639,12 @@ void RMFontMacc::Init(void) {
// bernie: numero di caratteri nel font
int nchars =
- 102 // base
- + 18 // polish
- + 66 // russian
- + 30 // czech
- + 8 // francais
- + 5; // deutsch
+ 102 // base
+ + 18 // polish
+ + 66 // russian
+ + 30 // czech
+ + 8 // francais
+ + 5; // deutsch
Load(RES_F_MACC, nchars, 11, 16);
@@ -654,41 +653,41 @@ void RMFontMacc::Init(void) {
lDefault = 10;
hDefault = 17;
Common::fill(&l2Table[0][0], &l2Table[0][0] + (256 * 256), '\0');
-
+
for (i = 0; i < 256; i++) {
cTable[i] = -1;
lTable[i] = lDefault;
}
for (i = 0; i < 26; i++)
- cTable['A'+i] = i + 0;
+ cTable['A' + i] = i + 0;
for (i = 0; i < 26; i++)
- cTable['a'+i] = i + 26;
+ cTable['a' + i] = i + 26;
for (i = 0; i < 10; i++)
- cTable['0'+i] = i + 52;
+ cTable['0' + i] = i + 52;
cTable['!'] = 62;
- //cTable['!'] = 63; // ! rovescia
- cTable['\"'] = 64;
- cTable['$'] = 65;
- cTable['%'] = 66;
- cTable['&'] = 67;
- cTable['/'] = 68;
- cTable['('] = 69;
- cTable[')'] = 70;
- cTable['='] = 71;
- cTable['?'] = 72;
- //cTable['?'] = 73; // ? rovescia
- cTable['*'] = 74;
- cTable['+'] = 75;
- cTable[(byte)'ñ'] = 76;
- cTable[';'] = 77;
- cTable[','] = 78;
+ //cTable['!'] = 63; // ! rovescia
+ cTable['\"'] = 64;
+ cTable['$'] = 65;
+ cTable['%'] = 66;
+ cTable['&'] = 67;
+ cTable['/'] = 68;
+ cTable['('] = 69;
+ cTable[')'] = 70;
+ cTable['='] = 71;
+ cTable['?'] = 72;
+ //cTable['?'] = 73; // ? rovescia
+ cTable['*'] = 74;
+ cTable['+'] = 75;
+ cTable[(byte)'ñ'] = 76;
+ cTable[';'] = 77;
+ cTable[','] = 78;
cTable['.'] = 79;
- cTable[':'] = 80;
- cTable['-'] = 81;
+ cTable[':'] = 80;
+ cTable['-'] = 81;
cTable['<'] = 82;
cTable['>'] = 83;
cTable['/'] = 84;
@@ -698,22 +697,22 @@ void RMFontMacc::Init(void) {
cTable[(byte)'å'] = 88;
cTable[(byte)'è'] = 89;
cTable[(byte)'ë'] = 90;
- //cTable[(byte)''] = 91; // e col pallino
- cTable[(byte)'ì'] = 92;
- cTable[(byte)'ï'] = 93;
- //cTable[(byte)''] = 94; // i col pallino
- cTable[(byte)'ò'] = 95;
- cTable[(byte)'ö'] = 96;
- //cTable[(byte)''] = 97; // o col pallino
- cTable[(byte)'ù'] = 98;
- cTable[(byte)'ü'] = 99;
- //cTable[(byte)''] = 100; // u col pallino
- cTable[(byte)'ç'] = 101;
+ //cTable[(byte)''] = 91; // e col pallino
+ cTable[(byte)'ì'] = 92;
+ cTable[(byte)'ï'] = 93;
+ //cTable[(byte)''] = 94; // i col pallino
+ cTable[(byte)'ò'] = 95;
+ cTable[(byte)'ö'] = 96;
+ //cTable[(byte)''] = 97; // o col pallino
+ cTable[(byte)'ù'] = 98;
+ cTable[(byte)'ü'] = 99;
+ //cTable[(byte)''] = 100; // u col pallino
+ cTable[(byte)'ç'] = 101;
// Polish characters
//AaCcEeLlNnOoSsZzZz
//¥¹ÆæÊꣳÑñÓ󌜯¿Ÿ
-
+
cTable[(byte)'¥'] = 102;
cTable[(byte)'¹'] = 103;
cTable[(byte)'Æ'] = 104;
@@ -732,7 +731,7 @@ void RMFontMacc::Init(void) {
cTable[(byte)'¿'] = 117;
cTable[(byte)''] = 118;
cTable[(byte)'Ÿ'] = 119;
-
+
lTable[(byte)'¥'] = 14;
lTable[(byte)'¹'] = 16;
lTable[(byte)'Æ'] = 12;
@@ -898,7 +897,7 @@ void RMFontMacc::Init(void) {
#endif // FONT_RUSSIAN
#ifdef FONT_CZECH
-
+
cTable[(byte)'Ì'] = 186;
cTable[(byte)'Š'] = 187;
cTable[(byte)'È'] = 188;
@@ -1007,21 +1006,21 @@ void RMFontCredits::Init(void) {
// bernie: numero di caratteri nel font
int nchars =
- 112 // base
- + 18 // polish
- + 66 // russian
- + 30 // czech
- + 8 // french
- + 2; // deutsch
+ 112 // base
+ + 18 // polish
+ + 66 // russian
+ + 30 // czech
+ + 8 // french
+ + 2; // deutsch
Load(RES_F_CREDITS, nchars, 27, 28, RES_F_CPAL);
// Default
- lDefault=10;
- hDefault=28;
+ lDefault = 10;
+ hDefault = 28;
Common::fill(&l2Table[0][0], &l2Table[0][0] + (256 * 256), '\0');
-
+
for (i = 0; i < 256; i++) {
cTable[i] = -1;
lTable[i] = lDefault;
@@ -1040,7 +1039,7 @@ void RMFontCredits::Init(void) {
// cTable[''] = 54; // a ^
// cTable[''] = 55; // a pallini
cTable[(byte)'è'] = 56;
- cTable[(byte)'é'] = 57;
+ cTable[(byte)'é'] = 57;
// cTable[''] = 58; // e ^
// cTable[''] = 59; // e pallini
cTable[(byte)'ì'] = 60;
@@ -1057,14 +1056,14 @@ void RMFontCredits::Init(void) {
// cTable[''] = 71; // u pallini
// cTable[''] = 72; // y pallini
cTable[(byte)'ñ'] = 73;
- cTable[(byte)'ç'] = 74;
+ cTable[(byte)'ç'] = 74;
// cTable[''] = 75; // o barrato
// cTable[''] = 76; // ac
cTable[(byte)'©'] = 77;
// cTable[''] = 78; // ? rovesciato
- cTable['?'] = 79;
+ cTable['?'] = 79;
// cTable[''] = 80; // ! rovesciato
- cTable['!'] = 81;
+ cTable['!'] = 81;
// cTable[''] = 82; // 1/2
// cTable[''] = 83; // 1/4
cTable['('] = 84;
@@ -1081,13 +1080,13 @@ void RMFontCredits::Init(void) {
cTable[','] = 95;
cTable['^'] = 96;
cTable['='] = 97;
- cTable['_'] = 98;
- cTable['*'] = 99;
- cTable['.'] = 100;
+ cTable['_'] = 98;
+ cTable['*'] = 99;
+ cTable['.'] = 100;
for (i = 0; i < 10; i++)
- cTable['0'+i] = i+101;
- cTable['\''] = 111;
+ cTable['0' + i] = i + 101;
+ cTable['\''] = 111;
lTable[' '] = 11;
lTable[(byte)'Ä'] = lTable['A'] = 19;
@@ -1168,7 +1167,7 @@ void RMFontCredits::Init(void) {
// Polish characters
//AaCcEeLlNnOoSsZzZz
//¥¹ÆæÊꣳÑñÓ󌜯¿Ÿ
-
+
cTable[(byte)'¥'] = 112;
cTable[(byte)'¹'] = 113;
cTable[(byte)'Æ'] = 114;
@@ -1187,7 +1186,7 @@ void RMFontCredits::Init(void) {
cTable[(byte)'¿'] = 127;
cTable[(byte)''] = 128;
cTable[(byte)'Ÿ'] = 129;
-
+
lTable[(byte)'¥'] = 20;
lTable[(byte)'¹'] = 12;
lTable[(byte)'Æ'] = 15;
@@ -1310,7 +1309,7 @@ void RMFontCredits::Init(void) {
lTable[(byte)'Ø'] = 23;
lTable[(byte)'Ù'] = 23;
lTable[(byte)'Ü'] = 10;
- lTable[(byte)'Ú'] = 12;
+ lTable[(byte)'Ú'] = 12;
lTable[(byte)'Û'] = 16;
lTable[(byte)'Ý'] = 12;
lTable[(byte)'Þ'] = 20;
@@ -1462,8 +1461,8 @@ void RMFontCredits::Init(void) {
* Metodi di RMFontObj
\****************************************************************************/
-#define TOUPPER(a) ((a) >='a'&&(a)<='z'?(a)+'A'-'a':(a))
-#define TOLOWER(a) ((a) >='A'&&(a)<='Z'?(a)+'a'-'A':(a))
+#define TOUPPER(a) ((a) >='a'&&(a)<='z'?(a)+'A'-'a':(a))
+#define TOLOWER(a) ((a) >='A'&&(a)<='Z'?(a)+'a'-'A':(a))
void RMFontObj::SetBothCase(int nChar, int nNext, signed char spiazz) {
l2Table[TOUPPER(nChar)][TOUPPER(nNext)] = spiazz;
@@ -1478,12 +1477,12 @@ void RMFontObj::Init(void) {
//bernie: numero di caratteri nel font (solo maiuscolo)
int nchars =
- 85 // base
- + 9 // polish
- + 33 // russian
- + 15 // czech
- + 0 // francais (no uppercase chars)
- + 1; // deutsch
+ 85 // base
+ + 9 // polish
+ + 33 // russian
+ + 15 // czech
+ + 0 // francais (no uppercase chars)
+ + 1; // deutsch
Load(RES_F_OBJ, nchars, 25, 30);
@@ -1499,8 +1498,8 @@ void RMFontObj::Init(void) {
}
for (i = 0; i < 26; i++) {
- cTable['A' + i] = i+0;
- cTable['a' + i] = i+0;
+ cTable['A' + i] = i + 0;
+ cTable['a' + i] = i + 0;
}
for (i = 0; i < 10; i++)
@@ -1547,13 +1546,13 @@ void RMFontObj::Init(void) {
//cTable[(byte)' '] = 74; e cerchietto
cTable[(byte)'Ì'] = 75;
cTable[(byte)'Ï'] = 76;
- //cTable[(byte)' '] = 77; i cerchietto
+ //cTable[(byte)' '] = 77; i cerchietto
cTable[(byte)'Ò'] = 78;
cTable[(byte)'Ö'] = cTable[(byte)'ö'] = 79;
- //cTable[(byte)' '] = 80; o cerchietto
+ //cTable[(byte)' '] = 80; o cerchietto
cTable[(byte)'Ù'] = 81;
cTable[(byte)'Ü'] = cTable[(byte)'ü'] = 82;
- //cTable[' '] = 83; u cerchietto
+ //cTable[' '] = 83; u cerchietto
//cTable[' '] = 84; y dieresi
/* Un po' di lunghezze */
@@ -1572,7 +1571,7 @@ void RMFontObj::Init(void) {
lTable['8'] = 20;
lTable['9'] = 20;
-
+
lTable['a'] = lTable['A'] = lTable['ä'] = lTable['Ä'] = 17;
lTable['b'] = lTable['B'] = 17;
lTable['c'] = lTable['C'] = 19;
@@ -1601,17 +1600,17 @@ void RMFontObj::Init(void) {
lTable[(byte)'Ñ'] = 17;
/* Casi particolari */
- SetBothCase('C','C',2);
- SetBothCase('A','T',-2);
- SetBothCase('R','S',2);
- SetBothCase('H','I',-2);
- SetBothCase('T','S',2);
- SetBothCase('O','R',2);
- SetBothCase('O','L',2);
- SetBothCase('O','G',2);
- SetBothCase('Z','A',-1);
- SetBothCase('R','R',1);
- SetBothCase('R','U',3);
+ SetBothCase('C', 'C', 2);
+ SetBothCase('A', 'T', -2);
+ SetBothCase('R', 'S', 2);
+ SetBothCase('H', 'I', -2);
+ SetBothCase('T', 'S', 2);
+ SetBothCase('O', 'R', 2);
+ SetBothCase('O', 'L', 2);
+ SetBothCase('O', 'G', 2);
+ SetBothCase('Z', 'A', -1);
+ SetBothCase('R', 'R', 1);
+ SetBothCase('R', 'U', 3);
// Polish characters
@@ -1622,10 +1621,10 @@ void RMFontObj::Init(void) {
cTable[(byte)'Æ'] = cTable[(byte)'æ'] = 86;
lTable[(byte)'Æ'] = lTable[(byte)'æ'] = 22;
-
+
cTable[(byte)'Ê'] = cTable[(byte)'ê'] = 87;
lTable[(byte)'Ê'] = lTable[(byte)'ê'] = 17;
-
+
cTable[(byte)'£'] = cTable[(byte)'³'] = 88;
lTable[(byte)'£'] = lTable[(byte)'³'] = 19;
@@ -1654,39 +1653,39 @@ void RMFontObj::Init(void) {
cTable[(byte)'¥'] = cTable[(byte)'¹'] = 85;
lTable[(byte)'¥'] = lTable[(byte)'¹'] = 20;
- cTable[(byte)'À'] = cTable[(byte)'à'] =94;
- cTable[(byte)'Á'] = cTable[(byte)'á'] =95;
- cTable[(byte)'Â'] = cTable[(byte)'â'] =96;
- cTable[(byte)'Ã'] = cTable[(byte)'ã'] =97;
- cTable[(byte)'Ä'] = cTable[(byte)'ä'] =98;
- cTable[(byte)'Å'] = cTable[(byte)'å'] =99;
- cTable[(byte)'¨'] = cTable[(byte)'¸'] =100;
- cTable[(byte)'Æ'] = cTable[(byte)'æ'] =101;
- cTable[(byte)'Ç'] = cTable[(byte)'ç'] =102;
- cTable[(byte)'È'] = cTable[(byte)'è'] =103;
- cTable[(byte)'É'] = cTable[(byte)'é'] =104;
- cTable[(byte)'Ê'] = cTable[(byte)'ê'] =105;
- cTable[(byte)'Ë'] = cTable[(byte)'ë'] =106;
- cTable[(byte)'Ì'] = cTable[(byte)'ì'] =107;
- cTable[(byte)'Í'] = cTable[(byte)'í'] =108;
- cTable[(byte)'Î'] = cTable[(byte)'î'] =109;
- cTable[(byte)'Ï'] = cTable[(byte)'ï'] =110;
- cTable[(byte)'Ð'] = cTable[(byte)'ð'] =111;
- cTable[(byte)'Ñ'] = cTable[(byte)'ñ'] =112;
- cTable[(byte)'Ò'] = cTable[(byte)'ò'] =113;
- cTable[(byte)'Ó'] = cTable[(byte)'ó'] =114;
- cTable[(byte)'Ô'] = cTable[(byte)'ô'] =115;
- cTable[(byte)'Õ'] = cTable[(byte)'õ'] =116;
- cTable[(byte)'Ö'] = cTable[(byte)'ö'] =117;
- cTable[(byte)'×'] = cTable[(byte)'÷'] =118;
- cTable[(byte)'Ø'] = cTable[(byte)'ø'] =119;
- cTable[(byte)'Ù'] = cTable[(byte)'ù'] =120;
- cTable[(byte)'Ü'] = cTable[(byte)'ü'] =121;
- cTable[(byte)'Ú'] = cTable[(byte)'ú'] =122;
- cTable[(byte)'Û'] = cTable[(byte)'û'] =123;
- cTable[(byte)'Ý'] = cTable[(byte)'ý'] =124;
- cTable[(byte)'Þ'] = cTable[(byte)'þ'] =125;
- cTable[(byte)'ß'] = cTable[(byte)'ÿ'] =126;
+ cTable[(byte)'À'] = cTable[(byte)'à'] = 94;
+ cTable[(byte)'Á'] = cTable[(byte)'á'] = 95;
+ cTable[(byte)'Â'] = cTable[(byte)'â'] = 96;
+ cTable[(byte)'Ã'] = cTable[(byte)'ã'] = 97;
+ cTable[(byte)'Ä'] = cTable[(byte)'ä'] = 98;
+ cTable[(byte)'Å'] = cTable[(byte)'å'] = 99;
+ cTable[(byte)'¨'] = cTable[(byte)'¸'] = 100;
+ cTable[(byte)'Æ'] = cTable[(byte)'æ'] = 101;
+ cTable[(byte)'Ç'] = cTable[(byte)'ç'] = 102;
+ cTable[(byte)'È'] = cTable[(byte)'è'] = 103;
+ cTable[(byte)'É'] = cTable[(byte)'é'] = 104;
+ cTable[(byte)'Ê'] = cTable[(byte)'ê'] = 105;
+ cTable[(byte)'Ë'] = cTable[(byte)'ë'] = 106;
+ cTable[(byte)'Ì'] = cTable[(byte)'ì'] = 107;
+ cTable[(byte)'Í'] = cTable[(byte)'í'] = 108;
+ cTable[(byte)'Î'] = cTable[(byte)'î'] = 109;
+ cTable[(byte)'Ï'] = cTable[(byte)'ï'] = 110;
+ cTable[(byte)'Ð'] = cTable[(byte)'ð'] = 111;
+ cTable[(byte)'Ñ'] = cTable[(byte)'ñ'] = 112;
+ cTable[(byte)'Ò'] = cTable[(byte)'ò'] = 113;
+ cTable[(byte)'Ó'] = cTable[(byte)'ó'] = 114;
+ cTable[(byte)'Ô'] = cTable[(byte)'ô'] = 115;
+ cTable[(byte)'Õ'] = cTable[(byte)'õ'] = 116;
+ cTable[(byte)'Ö'] = cTable[(byte)'ö'] = 117;
+ cTable[(byte)'×'] = cTable[(byte)'÷'] = 118;
+ cTable[(byte)'Ø'] = cTable[(byte)'ø'] = 119;
+ cTable[(byte)'Ù'] = cTable[(byte)'ù'] = 120;
+ cTable[(byte)'Ü'] = cTable[(byte)'ü'] = 121;
+ cTable[(byte)'Ú'] = cTable[(byte)'ú'] = 122;
+ cTable[(byte)'Û'] = cTable[(byte)'û'] = 123;
+ cTable[(byte)'Ý'] = cTable[(byte)'ý'] = 124;
+ cTable[(byte)'Þ'] = cTable[(byte)'þ'] = 125;
+ cTable[(byte)'ß'] = cTable[(byte)'ÿ'] = 126;
lTable[(byte)'À'] = lTable[(byte)'à'] = 18;
@@ -1717,7 +1716,7 @@ void RMFontObj::Init(void) {
lTable[(byte)'Ø'] = lTable[(byte)'ø'] = 19;
lTable[(byte)'Ù'] = lTable[(byte)'ù'] = 22;
lTable[(byte)'Ü'] = lTable[(byte)'ü'] = 18;
- lTable[(byte)'Ú'] = lTable[(byte)'ú'] = 19;
+ lTable[(byte)'Ú'] = lTable[(byte)'ú'] = 19;
lTable[(byte)'Û'] = lTable[(byte)'û'] = 19;
lTable[(byte)'Ý'] = lTable[(byte)'ý'] = 15;
lTable[(byte)'Þ'] = lTable[(byte)'þ'] = 18;
@@ -1726,7 +1725,7 @@ void RMFontObj::Init(void) {
#endif // FONT_RUSSIAN
#ifdef FONT_CZECH
- // rep. ceca characters
+ // rep. ceca characters
cTable[(byte)'Ì'] = cTable[(byte)'ì'] = 127;
cTable[(byte)'Š'] = cTable[(byte)'š'] = 128;
@@ -1744,21 +1743,21 @@ void RMFontObj::Init(void) {
cTable[(byte)'Ù'] = cTable[(byte)'ù'] = 140;
cTable[(byte)'Ú'] = cTable[(byte)'ú'] = 141;
- lTable[(byte)'Ì'] = lTable[(byte)'ì'] =17;
- lTable[(byte)'Š'] = lTable[(byte)'š'] =15;
- lTable[(byte)'È'] = lTable[(byte)'è'] =22;
- lTable[(byte)'Ø'] = lTable[(byte)'ø'] =18;
- lTable[(byte)'Ž'] = lTable[(byte)'ž'] =21;
- lTable[(byte)'Ý'] = lTable[(byte)'ý'] =16;
- lTable[(byte)'Á'] = lTable[(byte)'á'] =18;
- lTable[(byte)'Í'] = lTable[(byte)'í'] =19;
- lTable[(byte)'É'] = lTable[(byte)'é'] =17;
- lTable[(byte)'Ï'] = lTable[(byte)'ï'] =23;
- lTable[(byte)''] = lTable[(byte)''] =24;
- lTable[(byte)'Ò'] = lTable[(byte)'ò'] =17;
- lTable[(byte)'Ó'] = lTable[(byte)'ó'] =22;
- lTable[(byte)'Ù'] = lTable[(byte)'ù'] =16;
- lTable[(byte)'Ú'] = lTable[(byte)'ú'] =16;
+ lTable[(byte)'Ì'] = lTable[(byte)'ì'] = 17;
+ lTable[(byte)'Š'] = lTable[(byte)'š'] = 15;
+ lTable[(byte)'È'] = lTable[(byte)'è'] = 22;
+ lTable[(byte)'Ø'] = lTable[(byte)'ø'] = 18;
+ lTable[(byte)'Ž'] = lTable[(byte)'ž'] = 21;
+ lTable[(byte)'Ý'] = lTable[(byte)'ý'] = 16;
+ lTable[(byte)'Á'] = lTable[(byte)'á'] = 18;
+ lTable[(byte)'Í'] = lTable[(byte)'í'] = 19;
+ lTable[(byte)'É'] = lTable[(byte)'é'] = 17;
+ lTable[(byte)'Ï'] = lTable[(byte)'ï'] = 23;
+ lTable[(byte)''] = lTable[(byte)''] = 24;
+ lTable[(byte)'Ò'] = lTable[(byte)'ò'] = 17;
+ lTable[(byte)'Ó'] = lTable[(byte)'ó'] = 22;
+ lTable[(byte)'Ù'] = lTable[(byte)'ù'] = 16;
+ lTable[(byte)'Ú'] = lTable[(byte)'ú'] = 16;
#endif // FONT_CZECH
@@ -1817,7 +1816,7 @@ RMText::RMText() {
}
RMText::~RMText() {
-
+
}
void RMText::Unload() {
@@ -1835,19 +1834,23 @@ void RMText::SetMaxLineLength(int max) {
}
void RMText::RemoveThis(CORO_PARAM, bool &result) {
- // Qui possiamo fare i controlli sul numero di frame, sul tempo trascorso
- // etc.
+// Qui possiamo fare i controlli sul numero di frame, sul tempo trascorso
+// etc.
result = true;
}
void RMText::WriteText(const RMString &text, int nFont, int *time) {
- // Inizializza i font (una volta sola)
+ // Inizializza i font (una volta sola)
if (m_fonts[0] == NULL) {
- m_fonts[0] = new RMFontParla; m_fonts[0]->Init();
- m_fonts[1] = new RMFontObj; m_fonts[1]->Init();
- m_fonts[2] = new RMFontMacc; m_fonts[2]->Init();
- m_fonts[3] = new RMFontCredits; m_fonts[3]->Init();
+ m_fonts[0] = new RMFontParla;
+ m_fonts[0]->Init();
+ m_fonts[1] = new RMFontObj;
+ m_fonts[1]->Init();
+ m_fonts[2] = new RMFontMacc;
+ m_fonts[2]->Init();
+ m_fonts[3] = new RMFontCredits;
+ m_fonts[3]->Init();
}
WriteText(text, m_fonts[nFont], time);
@@ -1870,13 +1873,13 @@ void RMText::WriteText(const RMString &text, RMFontColor *font, int *time) {
// Si autodistrugge il buffer prima di iniziare
Destroy();
- // Se la stringa è vuota, non fare nulla
+ // Se la stringa è vuota, non fare nulla
if (text == NULL || text[0] == '\0')
return;
-
+
// Divide la frase in linee. In questo ciclo, X contiene la lunghezza massima raggiunta da una linea
// e I il numero delle linee
- string=p = text;
+ string = p = text;
i = j = x = 0;
while (*p != '\0') {
j += font->StringLen(*p);
@@ -1912,7 +1915,7 @@ void RMText::WriteText(const RMString &text, RMFontColor *font, int *time) {
}
if (j > x) x = j;
-
+
i++;
numlines = i;
@@ -1945,7 +1948,7 @@ void RMText::WriteText(const RMString &text, RMFontColor *font, int *time) {
case HLEFTPAR:
if (i == numlines)
- x=0;
+ x = 0;
else
x = 25;
break;
@@ -1988,8 +1991,8 @@ void RMText::ClipOnScreen(RMGfxPrimitive *prim) {
// Cerca di non farlo uscire dallo schermo
if (prim->Dst().x1 < 5) prim->Dst().x1 = 5;
if (prim->Dst().y1 < 5) prim->Dst().y1 = 5;
- if (prim->Dst().x1+m_dimx > 635) prim->Dst().x1 = 635 - m_dimx;
- if (prim->Dst().y1+m_dimy > 475) prim->Dst().y1 = 475 - m_dimy;
+ if (prim->Dst().x1 + m_dimx > 635) prim->Dst().x1 = 635 - m_dimx;
+ if (prim->Dst().y1 + m_dimy > 475) prim->Dst().y1 = 475 - m_dimy;
}
void RMText::Draw(CORO_PARAM, RMGfxTargetBuffer &bigBuf, RMGfxPrimitive *prim) {
@@ -2027,7 +2030,7 @@ void RMText::Draw(CORO_PARAM, RMGfxTargetBuffer &bigBuf, RMGfxPrimitive *prim) {
RMTextDialog::RMTextDialog() : RMText() {
m_startTime = 0;
- dst = RMPoint(0,0);
+ dst = RMPoint(0, 0);
m_bSkipStatus = true;
m_bShowed = true;
@@ -2056,14 +2059,14 @@ void RMTextDialog::Hide(CORO_PARAM) {
}
void RMTextDialog::WriteText(const RMString &text, int font, int *time) {
- RMText::WriteText(text,font,&m_time);
+ RMText::WriteText(text, font, &m_time);
if (time != NULL)
*time = m_time;
}
void RMTextDialog::WriteText(const RMString &text, RMFontColor *font, int *time) {
- RMText::WriteText(text,font,&m_time);
+ RMText::WriteText(text, font, &m_time);
if (time != NULL)
*time = m_time;
@@ -2087,7 +2090,7 @@ void RMTextDialog::SetNoTab(void) {
}
void RMTextDialog::SetForcedTime(uint32 dwTime) {
- m_time = dwTime;
+ m_time = dwTime;
}
void RMTextDialog::SetAlwaysDisplay(void) {
@@ -2096,7 +2099,7 @@ void RMTextDialog::SetAlwaysDisplay(void) {
void RMTextDialog::RemoveThis(CORO_PARAM, bool &result) {
CORO_BEGIN_CONTEXT;
- bool expired;
+ bool expired;
CORO_END_CONTEXT(_ctx);
CORO_BEGIN_CODE(_ctx);
@@ -2168,7 +2171,7 @@ void RMTextDialog::Draw(CORO_PARAM, RMGfxTargetBuffer &bigBuf, RMGfxPrimitive *p
if (m_startTime == 0)
m_startTime = _vm->GetTime();
-
+
if (m_bShowed) {
if (GLOBALS.bCfgSottotitoli || m_bAlwaysDisplay) {
prim->Dst().TopLeft() = dst;
@@ -2213,7 +2216,7 @@ RMTextDialogScrolling::~RMTextDialogScrolling() {
void RMTextDialogScrolling::Draw(CORO_PARAM, RMGfxTargetBuffer &bigBuf, RMGfxPrimitive *prim) {
CORO_BEGIN_CONTEXT;
- RMPoint curDst;
+ RMPoint curDst;
CORO_END_CONTEXT(_ctx);
CORO_BEGIN_CODE(_ctx);
@@ -2250,8 +2253,8 @@ RMTextItemName::~RMTextItemName() {
void RMTextItemName::DoFrame(CORO_PARAM, RMGfxTargetBuffer &bigBuf, RMLocation &loc, RMPointer &ptr, RMInventory &inv) {
CORO_BEGIN_CONTEXT;
- RMItem *lastItem;
- uint32 hThread;
+ RMItem *lastItem;
+ uint32 hThread;
CORO_END_CONTEXT(_ctx);
RMString itemName;
@@ -2263,7 +2266,7 @@ void RMTextItemName::DoFrame(CORO_PARAM, RMGfxTargetBuffer &bigBuf, RMLocation &
// Adds to the list if there is need
if (!m_nInList)
bigBuf.AddPrim(new RMGfxPrimitive(this));
-
+
// Update the scrolling co-ordinates
m_curscroll = loc.ScrollPosition();
@@ -2272,7 +2275,7 @@ void RMTextItemName::DoFrame(CORO_PARAM, RMGfxTargetBuffer &bigBuf, RMLocation &
m_item = inv.WhichItemIsIn(m_mpos);
else
m_item = loc.WhichItemIsIn(m_mpos);
-
+
itemName = "";
// If there an item, get it's name
@@ -2287,7 +2290,7 @@ void RMTextItemName::DoFrame(CORO_PARAM, RMGfxTargetBuffer &bigBuf, RMLocation &
if (m_item == NULL)
ptr.SetSpecialPointer(RMPointer::PTR_NONE);
else {
- _ctx->hThread = mpalQueryDoAction(20, m_item->MpalCode(), 0);
+ _ctx->hThread = mpalQueryDoAction(20, m_item->MpalCode(), 0);
if (_ctx->hThread == CORO_INVALID_PID_VALUE)
ptr.SetSpecialPointer(RMPointer::PTR_NONE);
else
@@ -2310,30 +2313,30 @@ void RMTextItemName::Draw(CORO_PARAM, RMGfxTargetBuffer &bigBuf, RMGfxPrimitive
return;
// Setta come coordinate destinazione quelle del mouse
- prim->Dst().TopLeft() = m_mpos-RMPoint(0, 30);
+ prim->Dst().TopLeft() = m_mpos - RMPoint(0, 30);
CORO_INVOKE_2(RMText::Draw, bigBuf, prim);
CORO_END_CODE;
}
-RMPoint RMTextItemName::GetHotspot() {
- if (m_item == NULL)
- return m_mpos + m_curscroll;
- else
- return m_item->Hotspot();
+RMPoint RMTextItemName::GetHotspot() {
+ if (m_item == NULL)
+ return m_mpos + m_curscroll;
+ else
+ return m_item->Hotspot();
}
-RMItem *RMTextItemName::GetSelectedItem() {
- return m_item;
+RMItem *RMTextItemName::GetSelectedItem() {
+ return m_item;
}
-bool RMTextItemName::IsItemSelected() {
- return m_item != NULL;
+bool RMTextItemName::IsItemSelected() {
+ return m_item != NULL;
}
-bool RMTextItemName::IsNormalItemSelected() {
- return m_item != NULL && m_itemName.Length() > 0;
+bool RMTextItemName::IsNormalItemSelected() {
+ return m_item != NULL && m_itemName.Length() > 0;
}
@@ -2345,13 +2348,13 @@ RMDialogChoice::RMDialogChoice() {
RMResRaw dlg1(RES_I_DLGTEXT);
RMResRaw dlg2(RES_I_DLGTEXTLINE);
RMRes dlgpal(RES_I_DLGTEXTPAL);
-
+
DlgText.Init(dlg1, dlg1.Width(), dlg1.Height());
DlgTextLine.Init(dlg2, dlg2.Width(), dlg2.Height());
DlgText.LoadPaletteWA(dlgpal);
DlgTextLine.LoadPaletteWA(dlgpal);
-
+
hUnreg = CoroScheduler.createEvent(false, false);
bRemoveFromOT = false;
}
@@ -2368,8 +2371,7 @@ void RMDialogChoice::Unregister(void) {
bRemoveFromOT = false;
}
-void RMDialogChoice::Init(void)
-{
+void RMDialogChoice::Init(void) {
m_numChoices = 0;
m_drawedStrings = NULL;
m_ptDrawStrings = NULL;
@@ -2399,7 +2401,7 @@ void RMDialogChoice::SetNumChoices(int num) {
m_numChoices = num;
m_curAdded = 0;
-
+
// Alloca lo spazio per le stringhe disegnate
m_drawedStrings = new RMText[num];
m_ptDrawStrings = new RMPoint[num];
@@ -2416,43 +2418,43 @@ void RMDialogChoice::SetNumChoices(int num) {
void RMDialogChoice::AddChoice(const RMString &string) {
// Si disegna la stringa
assert(m_curAdded < m_numChoices);
- m_drawedStrings[m_curAdded++].WriteText(string, 0);
+ m_drawedStrings[m_curAdded++].WriteText(string, 0);
}
void RMDialogChoice::Prepare(CORO_PARAM) {
CORO_BEGIN_CONTEXT;
- int i;
- RMPoint ptPos;
+ int i;
+ RMPoint ptPos;
CORO_END_CONTEXT(_ctx);
CORO_BEGIN_CODE(_ctx);
- AddPrim(new RMGfxPrimitive(&DlgText,RMPoint(0,0)));
- AddPrim(new RMGfxPrimitive(&DlgTextLine,RMPoint(0,155)));
- AddPrim(new RMGfxPrimitive(&DlgTextLine,RMPoint(0,155+83)));
- AddPrim(new RMGfxPrimitive(&DlgTextLine,RMPoint(0,155+83+83)));
- AddPrim(new RMGfxPrimitive(&DlgTextLine,RMPoint(0,155+83+83+83)));
+ AddPrim(new RMGfxPrimitive(&DlgText, RMPoint(0, 0)));
+ AddPrim(new RMGfxPrimitive(&DlgTextLine, RMPoint(0, 155)));
+ AddPrim(new RMGfxPrimitive(&DlgTextLine, RMPoint(0, 155 + 83)));
+ AddPrim(new RMGfxPrimitive(&DlgTextLine, RMPoint(0, 155 + 83 + 83)));
+ AddPrim(new RMGfxPrimitive(&DlgTextLine, RMPoint(0, 155 + 83 + 83 + 83)));
- _ctx->ptPos.Set(20,90);
+ _ctx->ptPos.Set(20, 90);
for (_ctx->i = 0; _ctx->i < m_numChoices; _ctx->i++) {
AddPrim(new RMGfxPrimitive(&m_drawedStrings[_ctx->i], _ctx->ptPos));
m_ptDrawStrings[_ctx->i] = _ctx->ptPos;
- _ctx->ptPos.Offset(0,m_drawedStrings[_ctx->i].Dimy() + 15);
+ _ctx->ptPos.Offset(0, m_drawedStrings[_ctx->i].Dimy() + 15);
}
CORO_INVOKE_0(DrawOT);
ClearOT();
- m_ptDrawPos.Set(0,480-_ctx->ptPos.y);
+ m_ptDrawPos.Set(0, 480 - _ctx->ptPos.y);
CORO_END_CODE;
}
void RMDialogChoice::SetSelected(CORO_PARAM, int pos) {
CORO_BEGIN_CONTEXT;
- RMGfxBox box;
- RMRect rc;
+ RMGfxBox box;
+ RMRect rc;
CORO_END_CONTEXT(_ctx);
CORO_BEGIN_CODE(_ctx);
@@ -2464,7 +2466,7 @@ void RMDialogChoice::SetSelected(CORO_PARAM, int pos) {
if (m_curSelection != -1) {
_ctx->box.SetColor(0xCC, 0xCC, 0xFF);
- _ctx->rc.TopLeft()=RMPoint(18, m_ptDrawStrings[m_curSelection].y);
+ _ctx->rc.TopLeft() = RMPoint(18, m_ptDrawStrings[m_curSelection].y);
_ctx->rc.BottomRight() = _ctx->rc.TopLeft() + RMPoint(597, m_drawedStrings[m_curSelection].Dimy());
AddPrim(new RMGfxPrimitive(&_ctx->box, _ctx->rc));
@@ -2475,8 +2477,8 @@ void RMDialogChoice::SetSelected(CORO_PARAM, int pos) {
if (pos != -1) {
_ctx->box.SetColor(100, 100, 100);
- _ctx->rc.TopLeft()=RMPoint(18, m_ptDrawStrings[pos].y);
- _ctx->rc.BottomRight() = _ctx->rc.TopLeft()+RMPoint(597, m_drawedStrings[pos].Dimy());
+ _ctx->rc.TopLeft() = RMPoint(18, m_ptDrawStrings[pos].y);
+ _ctx->rc.BottomRight() = _ctx->rc.TopLeft() + RMPoint(597, m_drawedStrings[pos].Dimy());
AddPrim(new RMGfxPrimitive(&_ctx->box, _ctx->rc));
AddPrim(new RMGfxPrimitive(&m_drawedStrings[pos], m_ptDrawStrings[pos]));
}
@@ -2491,10 +2493,10 @@ void RMDialogChoice::SetSelected(CORO_PARAM, int pos) {
void RMDialogChoice::Show(CORO_PARAM, RMGfxTargetBuffer *bigBuf) {
CORO_BEGIN_CONTEXT;
- RMPoint destpt;
- int deltay;
- int starttime;
- int elaps;
+ RMPoint destpt;
+ int deltay;
+ int starttime;
+ int elaps;
CORO_END_CONTEXT(_ctx);
CORO_BEGIN_CODE(_ctx);
@@ -2513,8 +2515,8 @@ void RMDialogChoice::Show(CORO_PARAM, RMGfxTargetBuffer *bigBuf) {
_ctx->destpt = m_ptDrawPos;
m_ptDrawPos.Set(0, 480);
- if (!m_nInList && bigBuf != NULL)
- bigBuf->AddPrim(new RMGfxPrimitive(this));
+ if (!m_nInList && bigBuf != NULL)
+ bigBuf->AddPrim(new RMGfxPrimitive(this));
m_bShow = true;
_ctx->elaps = 0;
@@ -2550,9 +2552,9 @@ void RMDialogChoice::Draw(CORO_PARAM, RMGfxTargetBuffer &bigBuf, RMGfxPrimitive
void RMDialogChoice::Hide(CORO_PARAM) {
CORO_BEGIN_CONTEXT;
- int deltay;
- int starttime;
- int elaps;
+ int deltay;
+ int starttime;
+ int elaps;
CORO_END_CONTEXT(_ctx);
CORO_BEGIN_CODE(_ctx);
@@ -2565,7 +2567,7 @@ void RMDialogChoice::Hide(CORO_PARAM) {
while (_ctx->elaps < 700) {
CORO_INVOKE_0(MainWaitFrame);
MainFreeze();
- _ctx->elaps = _vm->GetTime()-_ctx->starttime;
+ _ctx->elaps = _vm->GetTime() - _ctx->starttime;
m_ptDrawPos.y = 480 - ((_ctx->deltay * 100) / 700 * (700 - _ctx->elaps)) / 100;
MainUnfreeze();
}
@@ -2585,14 +2587,14 @@ void RMDialogChoice::RemoveThis(CORO_PARAM, bool &result) {
void RMDialogChoice::DoFrame(CORO_PARAM, RMPoint ptMousePos) {
CORO_BEGIN_CONTEXT;
- int i;
+ int i;
CORO_END_CONTEXT(_ctx);
CORO_BEGIN_CODE(_ctx);
- if (ptMousePos.y > m_ptDrawPos.y) {
+ if (ptMousePos.y > m_ptDrawPos.y) {
for (_ctx->i = 0; _ctx->i < m_numChoices; _ctx->i++) {
- if ((ptMousePos.y >= m_ptDrawPos.y+m_ptDrawStrings[_ctx->i].y) && (ptMousePos.y < m_ptDrawPos.y+m_ptDrawStrings[_ctx->i].y+m_drawedStrings[_ctx->i].Dimy())) {
+ if ((ptMousePos.y >= m_ptDrawPos.y + m_ptDrawStrings[_ctx->i].y) && (ptMousePos.y < m_ptDrawPos.y + m_ptDrawStrings[_ctx->i].y + m_drawedStrings[_ctx->i].Dimy())) {
CORO_INVOKE_1(SetSelected, _ctx->i);
break;
}
diff --git a/engines/tony/font.h b/engines/tony/font.h
index 9715e95043..3ada4d76c0 100644
--- a/engines/tony/font.h
+++ b/engines/tony/font.h
@@ -47,118 +47,126 @@ class RMPointer;
*/
class RMFont : public RMGfxTaskSetPrior {
protected:
- int nLetters;
- RMGfxSourceBuffer8RLEByte *m_letter;
+ int nLetters;
+ RMGfxSourceBuffer8RLEByte *m_letter;
public:
- int m_fontDimx,m_fontDimy;
+ int m_fontDimx, m_fontDimy;
private:
- int m_dimx,m_dimy;
+ int m_dimx, m_dimy;
- class RMFontPrimitive : public RMGfxPrimitive {
- public:
- RMFontPrimitive() : RMGfxPrimitive() {}
- RMFontPrimitive(RMGfxTask *task) : RMGfxPrimitive(task) {}
+ class RMFontPrimitive : public RMGfxPrimitive {
+ public:
+ RMFontPrimitive() : RMGfxPrimitive() {}
+ RMFontPrimitive(RMGfxTask *task) : RMGfxPrimitive(task) {}
virtual ~RMFontPrimitive() { }
- virtual RMGfxPrimitive *Duplicate() { return new RMFontPrimitive(*this); }
+ virtual RMGfxPrimitive *Duplicate() {
+ return new RMFontPrimitive(*this);
+ }
- int m_nChar;
- };
+ 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);
+ // 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);
+ // Scaricamente del font (anche da distruttore)
+ void Unload(void);
protected:
- // Conversione (da overloadare)
- virtual int ConvertToLetter(int nChar) = 0;
+ // Conversione (da overloadare)
+ virtual int ConvertToLetter(int nChar) = 0;
- // Lunghezza dei caratteri (da overloadare)
- virtual int LetterLength(int nChar, int nNext=0) = 0;
+ // Lunghezza dei caratteri (da overloadare)
+ virtual int LetterLength(int nChar, int nNext = 0) = 0;
public:
- virtual int LetterHeight(void) = 0;
+ virtual int LetterHeight(void) = 0;
public:
- RMFont();
- virtual ~RMFont();
+ RMFont();
+ virtual ~RMFont();
- // Inizializzazione e chiusura
- virtual void Init(void) = 0;
- virtual void Close(void);
+ // Inizializzazione e chiusura
+ virtual void Init(void) = 0;
+ virtual void Close(void);
- // Funzione del task da overloadare
- virtual void Draw(CORO_PARAM, RMGfxTargetBuffer &bigBug, RMGfxPrimitive *prim);
+ // Funzione del task da overloadare
+ virtual void Draw(CORO_PARAM, RMGfxTargetBuffer &bigBug, RMGfxPrimitive *prim);
- // Crea una primitiva per una lettera
- RMGfxPrimitive *MakeLetterPrimitive(byte bChar, int& nLength);
+ // Crea una primitiva per una lettera
+ RMGfxPrimitive *MakeLetterPrimitive(byte bChar, int &nLength);
- // Lunghezza in pixel di una stringa con il font corrente
- int StringLen(const RMString &text);
- int StringLen(char bChar, char bNext = 0);
+ // Lunghezza in pixel di una stringa con il font corrente
+ int StringLen(const RMString &text);
+ int StringLen(char bChar, char bNext = 0);
};
class RMFontColor : public virtual RMFont {
private:
- byte m_r,m_g,m_b;
+ byte m_r, m_g, m_b;
public:
- RMFontColor();
+ RMFontColor();
virtual ~RMFontColor();
- virtual void SetBaseColor(byte r, byte g, byte b);
+ 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];
+ 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); }
-
+ // 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; }
+ int LetterHeight() {
+ return hDefault;
+ }
virtual ~RMFontWithTables() {}
};
class RMFontParla : public RMFontColor, public RMFontWithTables {
public:
- void Init(void);
+ void Init(void);
virtual ~RMFontParla() {}
};
class RMFontObj : public RMFontColor, public RMFontWithTables {
private:
- void SetBothCase(int nChar, int nNext, signed char spiazz);
+ void SetBothCase(int nChar, int nNext, signed char spiazz);
public:
- void Init(void);
+ void Init(void);
virtual ~RMFontObj() {}
};
class RMFontMacc : public RMFontColor, public RMFontWithTables {
public:
- void Init(void);
+ void Init(void);
virtual ~RMFontMacc() {}
};
class RMFontCredits : public RMFontColor, public RMFontWithTables {
public:
- void Init(void);
+ void Init(void);
virtual ~RMFontCredits() {}
- virtual void SetBaseColor(byte r, byte g, byte b) {}
+ virtual void SetBaseColor(byte r, byte g, byte b) {}
};
/**
@@ -166,131 +174,140 @@ public:
*/
class RMText : public RMGfxWoodyBuffer {
private:
- static RMFontColor *m_fonts[4];
- static RMGfxClearTask m_clear;
- int maxLineLength;
+ static RMFontColor *m_fonts[4];
+ static RMGfxClearTask m_clear;
+ int maxLineLength;
public:
- enum HORALIGN {
- HLEFT,
- HLEFTPAR,
- HCENTER,
- HRIGHT
- };
-
- enum VERALIGN {
- VTOP,
- VCENTER,
- VBOTTOM
- };
+ enum HORALIGN {
+ HLEFT,
+ HLEFTPAR,
+ HCENTER,
+ HRIGHT
+ };
+
+ enum VERALIGN {
+ VTOP,
+ VCENTER,
+ VBOTTOM
+ };
private:
HORALIGN aHorType;
- VERALIGN aVerType;
- byte m_r,m_g,m_b;
+ VERALIGN aVerType;
+ byte m_r, m_g, m_b;
protected:
- virtual void ClipOnScreen(RMGfxPrimitive* prim);
+ virtual void ClipOnScreen(RMGfxPrimitive *prim);
public:
- RMText();
- virtual ~RMText();
+ RMText();
+ virtual ~RMText();
static void InitStatics();
static void Unload();
- // 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);
+ // 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(const RMString &text, int font, int *time = NULL);
- void WriteText(const RMString &text, RMFontColor *font, int *time = NULL);
+ // Scrive un testo
+ void WriteText(const RMString &text, int font, int *time = NULL);
+ void WriteText(const RMString &text, RMFontColor *font, int *time = NULL);
- // Overloading della funzione ereditata da RMGfxTask per decidere
- // quando eliminare un oggetto dalla OTLIST
- virtual void RemoveThis(CORO_PARAM, bool &result);
+ // Overloading della funzione ereditata da RMGfxTask per decidere
+ // quando eliminare un oggetto dalla OTLIST
+ virtual void RemoveThis(CORO_PARAM, bool &result);
- // Overloading del Draw per centrare la scritta, se necessario
- virtual void Draw(CORO_PARAM, RMGfxTargetBuffer &bigBuf, RMGfxPrimitive *prim);
+ // Overloading del Draw per centrare la scritta, se necessario
+ virtual void Draw(CORO_PARAM, 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; }
+ // 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
+ * Gestisce il testo di un dialogo
*/
class RMTextDialog : public RMText {
- protected:
- int m_startTime;
- int m_time;
- bool m_bSkipStatus;
- RMPoint dst;
- uint32 hEndDisplay;
- bool m_bShowed;
+protected:
+ int m_startTime;
+ int m_time;
+ bool m_bSkipStatus;
+ RMPoint dst;
+ uint32 hEndDisplay;
+ bool m_bShowed;
bool m_bForceTime;
- bool m_bForceNoTime;
+ bool m_bForceNoTime;
uint32 hCustomSkip;
- uint32 hCustomSkip2;
- RMInput *m_input;
+ uint32 hCustomSkip2;
+ RMInput *m_input;
bool m_bAlwaysDisplay;
bool m_bNoTab;
- public:
- RMTextDialog();
- virtual ~RMTextDialog();
-
- // Scrive un testo
- void WriteText(const RMString &text, int font, int *time = NULL);
- void WriteText(const RMString &text, RMFontColor *font, int *time = NULL);
-
- // Overloading della funzione ereditata da RMGfxTask per decidere
- // quando eliminare un oggetto dalla OTLIST
- virtual void RemoveThis(CORO_PARAM, bool &result);
-
- // 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(CORO_PARAM, RMGfxTargetBuffer &bigBuf, RMGfxPrimitive *prim);
-
- // Setta la posizione
- void SetPosition(const RMPoint &pt) { dst = pt; }
-
- // Aspetta che venga finita la visualizzazione
- void WaitForEndDisplay(CORO_PARAM);
- void SetCustomSkipHandle(uint32 hCustomSkip);
- void SetCustomSkipHandle2(uint32 hCustomSkip);
- void SetSkipStatus(bool bEnabled);
+public:
+ RMTextDialog();
+ virtual ~RMTextDialog();
+
+ // Scrive un testo
+ void WriteText(const RMString &text, int font, int *time = NULL);
+ void WriteText(const RMString &text, RMFontColor *font, int *time = NULL);
+
+ // Overloading della funzione ereditata da RMGfxTask per decidere
+ // quando eliminare un oggetto dalla OTLIST
+ virtual void RemoveThis(CORO_PARAM, bool &result);
+
+ // 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(CORO_PARAM, RMGfxTargetBuffer &bigBuf, RMGfxPrimitive *prim);
+
+ // Setta la posizione
+ void SetPosition(const RMPoint &pt) {
+ dst = pt;
+ }
+
+ // Aspetta che venga finita la visualizzazione
+ void WaitForEndDisplay(CORO_PARAM);
+ void SetCustomSkipHandle(uint32 hCustomSkip);
+ void SetCustomSkipHandle2(uint32 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(CORO_PARAM);
+ // Setta il dispositivo di input, per permettere skip da mouse
+ void SetInput(RMInput *input);
+
+ void Show(void);
+ void Hide(CORO_PARAM);
};
class RMTextDialogScrolling : public RMTextDialog {
protected:
- RMLocation *curLoc;
- RMPoint startScroll;
+ RMLocation *curLoc;
+ RMPoint startScroll;
- virtual void ClipOnScreen(RMGfxPrimitive* prim);
+ virtual void ClipOnScreen(RMGfxPrimitive *prim);
public:
- RMTextDialogScrolling();
- RMTextDialogScrolling(RMLocation* loc);
+ RMTextDialogScrolling();
+ RMTextDialogScrolling(RMLocation *loc);
virtual ~RMTextDialogScrolling();
- virtual void Draw(CORO_PARAM, RMGfxTargetBuffer &bigBuf, RMGfxPrimitive *prim);
+ virtual void Draw(CORO_PARAM, RMGfxTargetBuffer &bigBuf, RMGfxPrimitive *prim);
};
@@ -302,26 +319,30 @@ public:
class RMTextItemName : protected RMText {
protected:
- RMPoint m_mpos;
- RMPoint m_curscroll;
- RMItem *m_item;
- RMString m_itemName;
+ RMPoint m_mpos;
+ RMPoint m_curscroll;
+ RMItem *m_item;
+ RMString m_itemName;
public:
- RMTextItemName();
+ RMTextItemName();
virtual ~RMTextItemName();
-
- void SetMouseCoord(const RMPoint &m) { m_mpos = m; }
- void DoFrame(CORO_PARAM, RMGfxTargetBuffer &bigBuf, RMLocation &loc, RMPointer &ptr, RMInventory &inv);
- virtual void Draw(CORO_PARAM, RMGfxTargetBuffer &bigBuf, RMGfxPrimitive *prim);
+ void SetMouseCoord(const RMPoint &m) {
+ m_mpos = m;
+ }
+
+ void DoFrame(CORO_PARAM, RMGfxTargetBuffer &bigBuf, RMLocation &loc, RMPointer &ptr, RMInventory &inv);
+ virtual void Draw(CORO_PARAM, RMGfxTargetBuffer &bigBuf, RMGfxPrimitive *prim);
- RMPoint GetHotspot();
- RMItem *GetSelectedItem();
- bool IsItemSelected();
- bool IsNormalItemSelected();
+ RMPoint GetHotspot();
+ RMItem *GetSelectedItem();
+ bool IsItemSelected();
+ bool IsNormalItemSelected();
- virtual void RemoveThis(CORO_PARAM, bool &result) { result = true; }
+ virtual void RemoveThis(CORO_PARAM, bool &result) {
+ result = true;
+ }
};
@@ -330,54 +351,54 @@ public:
*/
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;
- uint32 hUnreg;
- bool bRemoveFromOT;
+ 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;
+ uint32 hUnreg;
+ bool bRemoveFromOT;
protected:
- void Prepare(CORO_PARAM);
- void SetSelected(CORO_PARAM, int pos);
-
+ void Prepare(CORO_PARAM);
+ void SetSelected(CORO_PARAM, int pos);
+
public:
- virtual void RemoveThis(CORO_PARAM, bool &result);
- virtual void Draw(CORO_PARAM, RMGfxTargetBuffer& bigBuf, RMGfxPrimitive* prim);
- void Unregister(void);
+ virtual void RemoveThis(CORO_PARAM, bool &result);
+ virtual void Draw(CORO_PARAM, 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(const 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(CORO_PARAM, RMGfxTargetBuffer* bigBuf = NULL);
- void Hide(CORO_PARAM);
-
- // Polling di aggiornamento
- void DoFrame(CORO_PARAM, RMPoint ptMousePos);
-
- // Ritorna la voce attualmente selezionata, o -1 se nessuna è selezionata
- int GetSelection(void);
+ // 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(const 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(CORO_PARAM, RMGfxTargetBuffer *bigBuf = NULL);
+ void Hide(CORO_PARAM);
+
+ // Polling di aggiornamento
+ void DoFrame(CORO_PARAM, RMPoint ptMousePos);
+
+ // Ritorna la voce attualmente selezionata, o -1 se nessuna è selezionata
+ int GetSelection(void);
};
} // End of namespace Tony
diff --git a/engines/tony/game.cpp b/engines/tony/game.cpp
index 8844374821..64c91008a5 100644
--- a/engines/tony/game.cpp
+++ b/engines/tony/game.cpp
@@ -44,11 +44,11 @@ namespace Tony {
using namespace MPAL;
/****************************************/
-/* Funzioni globali per la DLL Custom */
+/* Funzioni globali per la DLL Custom */
/****************************************/
uint32 MainLoadLocation(int nLoc, RMPoint pt, RMPoint start) {
- return _vm->GetEngine()->LoadLocation(nLoc, pt,start);
+ return _vm->GetEngine()->LoadLocation(nLoc, pt, start);
}
void MainUnloadLocation(CORO_PARAM, bool bDoOnExit, uint32 *result) {
@@ -72,11 +72,11 @@ void MainWaitFrame(CORO_PARAM) {
}
void MainShowMouse(void) {
- _vm->GetEngine()->EnableMouse();
+ _vm->GetEngine()->EnableMouse();
}
void MainHideMouse(void) {
- _vm->GetEngine()->DisableMouse();
+ _vm->GetEngine()->DisableMouse();
}
void MainPlayMusic(int nChannel, const char *filename, int nFX, bool bLoop, int nSync) {
@@ -161,7 +161,7 @@ bool RMOptionButton::DoFrame(const RMPoint &mousePos, bool bLeftClick, bool bRig
}
}
} else {
- if (bLeftClick && m_rect.PtInRect(mousePos)) {
+ if (bLeftClick && m_rect.PtInRect(mousePos)) {
m_bActive = !m_bActive;
return true;
}
@@ -176,7 +176,7 @@ void RMOptionButton::Draw(CORO_PARAM, RMGfxTargetBuffer &bigBuf, RMGfxPrimitive
CORO_BEGIN_CONTEXT;
CORO_END_CONTEXT(_ctx);
- CORO_BEGIN_CODE(_ctx);
+ CORO_BEGIN_CODE(_ctx);
if (!m_bActive)
return;
@@ -274,9 +274,9 @@ bool RMOptionSlide::DoFrame(const RMPoint &mousePos, bool bLeftClick, bool bRigh
void RMOptionSlide::Draw(CORO_PARAM, RMGfxTargetBuffer &bigBuf, RMGfxPrimitive *prim) {
CORO_BEGIN_CONTEXT;
- int i;
- int val;
- RMPoint pos;
+ int i;
+ int val;
+ RMPoint pos;
CORO_END_CONTEXT(_ctx);
CORO_BEGIN_CODE(_ctx);
@@ -384,22 +384,22 @@ RMOptionScreen::~RMOptionScreen(void) {
void RMOptionScreen::RefreshAll(CORO_PARAM) {
CORO_BEGIN_CONTEXT;
- RMGfxSourceBuffer16 *thumb;
- RMText* title;
- RMText *num[6];
- int i;
+ RMGfxSourceBuffer16 *thumb;
+ RMText *title;
+ RMText *num[6];
+ int i;
CORO_END_CONTEXT(_ctx);
CORO_BEGIN_CODE(_ctx);
ClearOT();
AddPrim(new RMGfxPrimitive(m_menu));
-
+
if (m_bNoLoadSave)
- AddPrim(new RMGfxPrimitive(m_HideLoadSave,RMPoint(0, 401)));
+ AddPrim(new RMGfxPrimitive(m_HideLoadSave, RMPoint(0, 401)));
if (m_bQuitConfirm) {
- AddPrim(new RMGfxPrimitive(m_QuitConfirm,RMPoint(270, 200)));
+ AddPrim(new RMGfxPrimitive(m_QuitConfirm, RMPoint(270, 200)));
m_ButtonQuitYes->AddToList(*this);
m_ButtonQuitNo->AddToList(*this);
}
@@ -450,47 +450,65 @@ void RMOptionScreen::RefreshAll(CORO_PARAM) {
AddPrim(new RMGfxPrimitive(_ctx->title, RMPoint(320, 10)));
- if (m_curThumbDiff[0] == 0) AddPrim(new RMGfxPrimitive(m_SaveHard, RMPoint(48, 57)));
- else if (m_curThumbDiff[0] == 1) AddPrim(new RMGfxPrimitive(m_SaveEasy, RMPoint(48, 57)));
- if (m_curThumbDiff[1] == 0) AddPrim(new RMGfxPrimitive(m_SaveHard, RMPoint(240, 57)));
- else if (m_curThumbDiff[1] == 1) AddPrim(new RMGfxPrimitive(m_SaveEasy,RMPoint(240, 57)));
- if (m_curThumbDiff[2] == 0) AddPrim(new RMGfxPrimitive(m_SaveHard,RMPoint(432, 57)));
- else if (m_curThumbDiff[2] == 1) AddPrim(new RMGfxPrimitive(m_SaveEasy,RMPoint(432, 57)));
- if (m_curThumbDiff[3] == 0) AddPrim(new RMGfxPrimitive(m_SaveHard,RMPoint(48, 239)));
- else if (m_curThumbDiff[3] == 1) AddPrim(new RMGfxPrimitive(m_SaveEasy,RMPoint(48, 239)));
- if (m_curThumbDiff[4] == 0) AddPrim(new RMGfxPrimitive(m_SaveHard,RMPoint(240, 239)));
- else if (m_curThumbDiff[4] == 1) AddPrim(new RMGfxPrimitive(m_SaveEasy,RMPoint(240, 239)));
- if (m_curThumbDiff[5] == 0) AddPrim(new RMGfxPrimitive(m_SaveHard,RMPoint(432, 239)));
- else if (m_curThumbDiff[5] == 1) AddPrim(new RMGfxPrimitive(m_SaveEasy,RMPoint(432, 239)));
-
- if (m_curThumb[0] && !(m_bEditSaveName && m_nEditPos == 0)) AddPrim(new RMGfxPrimitive(m_curThumb[0], RMPoint(48, 57)));
- if (m_curThumb[1] && !(m_bEditSaveName && m_nEditPos == 1)) AddPrim(new RMGfxPrimitive(m_curThumb[1], RMPoint(240, 57)));
- if (m_curThumb[2] && !(m_bEditSaveName && m_nEditPos == 2)) AddPrim(new RMGfxPrimitive(m_curThumb[2], RMPoint(432, 57)));
- if (m_curThumb[3] && !(m_bEditSaveName && m_nEditPos == 3)) AddPrim(new RMGfxPrimitive(m_curThumb[3], RMPoint(48, 239)));
- if (m_curThumb[4] && !(m_bEditSaveName && m_nEditPos == 4)) AddPrim(new RMGfxPrimitive(m_curThumb[4], RMPoint(240, 239)));
- if (m_curThumb[5] && !(m_bEditSaveName && m_nEditPos == 5)) AddPrim(new RMGfxPrimitive(m_curThumb[5], RMPoint(432, 239)));
+ if (m_curThumbDiff[0] == 0)
+ AddPrim(new RMGfxPrimitive(m_SaveHard, RMPoint(48, 57)));
+ else if (m_curThumbDiff[0] == 1)
+ AddPrim(new RMGfxPrimitive(m_SaveEasy, RMPoint(48, 57)));
+ if (m_curThumbDiff[1] == 0)
+ AddPrim(new RMGfxPrimitive(m_SaveHard, RMPoint(240, 57)));
+ else if (m_curThumbDiff[1] == 1)
+ AddPrim(new RMGfxPrimitive(m_SaveEasy, RMPoint(240, 57)));
+ if (m_curThumbDiff[2] == 0)
+ AddPrim(new RMGfxPrimitive(m_SaveHard, RMPoint(432, 57)));
+ else if (m_curThumbDiff[2] == 1)
+ AddPrim(new RMGfxPrimitive(m_SaveEasy, RMPoint(432, 57)));
+ if (m_curThumbDiff[3] == 0)
+ AddPrim(new RMGfxPrimitive(m_SaveHard, RMPoint(48, 239)));
+ else if (m_curThumbDiff[3] == 1)
+ AddPrim(new RMGfxPrimitive(m_SaveEasy, RMPoint(48, 239)));
+ if (m_curThumbDiff[4] == 0)
+ AddPrim(new RMGfxPrimitive(m_SaveHard, RMPoint(240, 239)));
+ else if (m_curThumbDiff[4] == 1)
+ AddPrim(new RMGfxPrimitive(m_SaveEasy, RMPoint(240, 239)));
+ if (m_curThumbDiff[5] == 0)
+ AddPrim(new RMGfxPrimitive(m_SaveHard, RMPoint(432, 239)));
+ else if (m_curThumbDiff[5] == 1)
+ AddPrim(new RMGfxPrimitive(m_SaveEasy, RMPoint(432, 239)));
+
+ if (m_curThumb[0] && !(m_bEditSaveName && m_nEditPos == 0))
+ AddPrim(new RMGfxPrimitive(m_curThumb[0], RMPoint(48, 57)));
+ if (m_curThumb[1] && !(m_bEditSaveName && m_nEditPos == 1))
+ AddPrim(new RMGfxPrimitive(m_curThumb[1], RMPoint(240, 57)));
+ if (m_curThumb[2] && !(m_bEditSaveName && m_nEditPos == 2))
+ AddPrim(new RMGfxPrimitive(m_curThumb[2], RMPoint(432, 57)));
+ if (m_curThumb[3] && !(m_bEditSaveName && m_nEditPos == 3))
+ AddPrim(new RMGfxPrimitive(m_curThumb[3], RMPoint(48, 239)));
+ if (m_curThumb[4] && !(m_bEditSaveName && m_nEditPos == 4))
+ AddPrim(new RMGfxPrimitive(m_curThumb[4], RMPoint(240, 239)));
+ if (m_curThumb[5] && !(m_bEditSaveName && m_nEditPos == 5))
+ AddPrim(new RMGfxPrimitive(m_curThumb[5], RMPoint(432, 239)));
if (m_bEditSaveName) {
_ctx->thumb = new RMGfxSourceBuffer16;
_ctx->thumb->Init((byte *)_vm->GetThumbnail(), 640 / 4, 480 / 4);
if (m_nEditPos == 0)
- AddPrim(new RMGfxPrimitive(_ctx->thumb,RMPoint(48, 57)));
+ AddPrim(new RMGfxPrimitive(_ctx->thumb, RMPoint(48, 57)));
else if (m_nEditPos == 1)
- AddPrim(new RMGfxPrimitive(_ctx->thumb,RMPoint(240, 57)));
+ AddPrim(new RMGfxPrimitive(_ctx->thumb, RMPoint(240, 57)));
else if (m_nEditPos == 2)
- AddPrim(new RMGfxPrimitive(_ctx->thumb,RMPoint(432, 57)));
+ AddPrim(new RMGfxPrimitive(_ctx->thumb, RMPoint(432, 57)));
else if (m_nEditPos == 3)
- AddPrim(new RMGfxPrimitive(_ctx->thumb,RMPoint(48, 239)));
+ AddPrim(new RMGfxPrimitive(_ctx->thumb, RMPoint(48, 239)));
else if (m_nEditPos == 4)
- AddPrim(new RMGfxPrimitive(_ctx->thumb,RMPoint(240, 239)));
+ AddPrim(new RMGfxPrimitive(_ctx->thumb, RMPoint(240, 239)));
else if (m_nEditPos == 5)
- AddPrim(new RMGfxPrimitive(_ctx->thumb,RMPoint(432, 239)));
+ AddPrim(new RMGfxPrimitive(_ctx->thumb, RMPoint(432, 239)));
}
for (_ctx->i = 0; _ctx->i < 6; _ctx->i++) {
RMString s;
-
+
if (m_bEditSaveName && m_nEditPos == _ctx->i)
s.Format("%02d)%s*", m_statePos + _ctx->i, m_EditName);
else {
@@ -499,23 +517,23 @@ void RMOptionScreen::RefreshAll(CORO_PARAM) {
else
s.Format("%02d)%s", m_statePos + _ctx->i, (const char *)m_curThumbName[_ctx->i]);
}
-
+
_ctx->num[_ctx->i] = new RMText;
_ctx->num[_ctx->i]->SetAlignType(RMText::HLEFT, RMText::VTOP);
_ctx->num[_ctx->i]->WriteText(s, 2);
}
-
+
AddPrim(new RMGfxPrimitive(_ctx->num[0], RMPoint(55 - 3, 180 + 14)));
AddPrim(new RMGfxPrimitive(_ctx->num[1], RMPoint(247 - 3, 180 + 14)));
- AddPrim(new RMGfxPrimitive(_ctx->num[2],RMPoint(439 - 3, 180 + 14)));
- AddPrim(new RMGfxPrimitive(_ctx->num[3],RMPoint(55 - 3, 362 + 14)));
- AddPrim(new RMGfxPrimitive(_ctx->num[4],RMPoint(247 - 3, 362 + 14)));
- AddPrim(new RMGfxPrimitive(_ctx->num[5],RMPoint(439 - 3, 362 + 14)));
-
+ AddPrim(new RMGfxPrimitive(_ctx->num[2], RMPoint(439 - 3, 180 + 14)));
+ AddPrim(new RMGfxPrimitive(_ctx->num[3], RMPoint(55 - 3, 362 + 14)));
+ AddPrim(new RMGfxPrimitive(_ctx->num[4], RMPoint(247 - 3, 362 + 14)));
+ AddPrim(new RMGfxPrimitive(_ctx->num[5], RMPoint(439 - 3, 362 + 14)));
+
m_ButtonSave_ArrowLeft->AddToList(*this);
m_ButtonSave_ArrowRight->AddToList(*this);
}
-
+
CORO_INVOKE_0(DrawOT);
if (m_nState == MENULOAD || m_nState == MENUSAVE) {
@@ -535,7 +553,7 @@ void RMOptionScreen::RefreshThumbnails(void) {
for (i = 0; i < 6; i++) {
if (m_curThumb[i])
delete m_curThumb[i];
-
+
m_curThumb[i] = new RMGfxSourceBuffer16;
m_curThumb[i]->Create(640 / 4, 480 / 4);
if (!LoadThumbnailFromSaveState(m_statePos + i, *m_curThumb[i], m_curThumbName[i], m_curThumbDiff[i])) {
@@ -550,11 +568,11 @@ void RMOptionScreen::RefreshThumbnails(void) {
void RMOptionScreen::InitState(CORO_PARAM) {
CORO_BEGIN_CONTEXT;
- RMResRaw *raw;
+ RMResRaw *raw;
CORO_END_CONTEXT(_ctx);
CORO_BEGIN_CODE(_ctx);
-
+
if (m_nState == MENUGAME || m_nState == MENUGFX || m_nState == MENUSOUND)
_ctx->raw = new RMResRaw(20000 + m_nState);
else if (m_nState == MENULOAD || m_nState == MENUSAVE) {
@@ -601,14 +619,14 @@ void RMOptionScreen::InitState(CORO_PARAM) {
if (m_bAlterGfx) {
assert(m_ButtonSave_ArrowLeft == NULL);
- m_ButtonSave_ArrowLeft = new RMOptionButton(20026,RMPoint(3,196));
+ m_ButtonSave_ArrowLeft = new RMOptionButton(20026, RMPoint(3, 196));
assert(m_ButtonSave_ArrowRight == NULL);
m_ButtonSave_ArrowRight = new RMOptionButton(20027, RMPoint(601, 197));
} else {
assert(m_ButtonSave_ArrowLeft == NULL);
m_ButtonSave_ArrowLeft = new RMOptionButton(20013, RMPoint(0, 197));
assert(m_ButtonSave_ArrowRight == NULL);
- m_ButtonSave_ArrowRight = new RMOptionButton(20014,RMPoint(601, 197));
+ m_ButtonSave_ArrowRight = new RMOptionButton(20014, RMPoint(601, 197));
}
} else if (m_nState == MENUGAME || m_nState == MENUGFX || m_nState == MENUSOUND) {
assert(m_ButtonExit == NULL);
@@ -638,7 +656,7 @@ void RMOptionScreen::InitState(CORO_PARAM) {
m_ButtonQuitYes = new RMOptionButton(20022, RMPoint(281, 265));
m_ButtonQuitYes->SetPriority(30);
assert(m_ButtonQuitNo == NULL);
- m_ButtonQuitNo = new RMOptionButton(20023,RMPoint(337, 264));
+ m_ButtonQuitNo = new RMOptionButton(20023, RMPoint(337, 264));
m_ButtonQuitNo->SetPriority(30);
if (m_bNoLoadSave) {
@@ -653,16 +671,16 @@ void RMOptionScreen::InitState(CORO_PARAM) {
// Menu GAME
if (m_nState == MENUGAME) {
assert(m_ButtonGame_Lock == NULL);
- m_ButtonGame_Lock = new RMOptionButton(20008,RMPoint(176, 262), true);
+ m_ButtonGame_Lock = new RMOptionButton(20008, RMPoint(176, 262), true);
m_ButtonGame_Lock->SetActiveState(GLOBALS.bCfgInvLocked);
assert(m_ButtonGame_TimerizedText == NULL);
- m_ButtonGame_TimerizedText = new RMOptionButton(20009,RMPoint(463, 273), true);
+ m_ButtonGame_TimerizedText = new RMOptionButton(20009, RMPoint(463, 273), true);
m_ButtonGame_TimerizedText->SetActiveState(!GLOBALS.bCfgTimerizedText);
assert(m_ButtonGame_Scrolling == NULL);
m_ButtonGame_Scrolling = new RMOptionButton(20010, RMPoint(315, 263), true);
m_ButtonGame_Scrolling->SetActiveState(GLOBALS.bCfgInvNoScroll);
assert(m_ButtonGame_InterUp == NULL);
- m_ButtonGame_InterUp = new RMOptionButton(20011,RMPoint(36, 258), true);
+ m_ButtonGame_InterUp = new RMOptionButton(20011, RMPoint(36, 258), true);
m_ButtonGame_InterUp->SetActiveState(GLOBALS.bCfgInvUp);
assert(m_SlideTextSpeed == NULL);
@@ -673,19 +691,19 @@ void RMOptionScreen::InitState(CORO_PARAM) {
// Menu Graphics
else if (m_nState == MENUGFX) {
assert(m_ButtonGfx_Anni30 == NULL);
- m_ButtonGfx_Anni30 = new RMOptionButton(20015,RMPoint(247, 178), true);
+ m_ButtonGfx_Anni30 = new RMOptionButton(20015, RMPoint(247, 178), true);
m_ButtonGfx_Anni30->SetActiveState(GLOBALS.bCfgAnni30);
assert(m_ButtonGfx_AntiAlias == NULL);
m_ButtonGfx_AntiAlias = new RMOptionButton(20016, RMPoint(430, 83), true);
m_ButtonGfx_AntiAlias->SetActiveState(!GLOBALS.bCfgAntiAlias);
assert(m_ButtonGfx_Sottotitoli == NULL);
- m_ButtonGfx_Sottotitoli = new RMOptionButton(20017,RMPoint(98, 82), true);
+ m_ButtonGfx_Sottotitoli = new RMOptionButton(20017, RMPoint(98, 82), true);
m_ButtonGfx_Sottotitoli->SetActiveState(!GLOBALS.bCfgSottotitoli);
assert(m_ButtonGfx_Tips == NULL);
- m_ButtonGfx_Tips = new RMOptionButton(20018,RMPoint(431, 246), true);
+ m_ButtonGfx_Tips = new RMOptionButton(20018, RMPoint(431, 246), true);
m_ButtonGfx_Tips->SetActiveState(GLOBALS.bCfgInterTips);
assert(m_ButtonGfx_Trans == NULL);
- m_ButtonGfx_Trans = new RMOptionButton(20019,RMPoint(126, 271), true);
+ m_ButtonGfx_Trans = new RMOptionButton(20019, RMPoint(126, 271), true);
m_ButtonGfx_Trans->SetActiveState(!GLOBALS.bCfgTransparence);
} else if (m_nState == MENUSOUND) {
@@ -700,10 +718,10 @@ void RMOptionScreen::InitState(CORO_PARAM) {
m_ButtonSound_DubbingOn = new RMOptionButton(20033, RMPoint(339, 75), true);
m_ButtonSound_DubbingOn->SetActiveState(GLOBALS.bCfgDubbing);
assert(m_ButtonSound_MusicOn == NULL);
- m_ButtonSound_MusicOn = new RMOptionButton(20034,RMPoint(338, 179), true);
+ m_ButtonSound_MusicOn = new RMOptionButton(20034, RMPoint(338, 179), true);
m_ButtonSound_MusicOn->SetActiveState(GLOBALS.bCfgMusic);
assert(m_ButtonSound_SFXOn == NULL);
- m_ButtonSound_SFXOn = new RMOptionButton(20035,RMPoint(338, 283), true);
+ m_ButtonSound_SFXOn = new RMOptionButton(20035, RMPoint(338, 283), true);
m_ButtonSound_SFXOn->SetActiveState(GLOBALS.bCfgSFX);
}
}
@@ -728,7 +746,7 @@ void RMOptionScreen::CloseState(void) {
delete m_curThumb[i];
m_curThumb[i] = NULL;
}
-
+
delete m_ButtonSave_States[i];
m_ButtonSave_States[i] = NULL;
}
@@ -817,11 +835,11 @@ void RMOptionScreen::CloseState(void) {
GLOBALS.nCfgDubbingVolume = m_SliderSound_Dubbing->GetValue();
delete m_SliderSound_Dubbing;
m_SliderSound_Dubbing = NULL;
-
+
GLOBALS.nCfgMusicVolume = m_SliderSound_Music->GetValue();
delete m_SliderSound_Music;
m_SliderSound_Music = NULL;
-
+
GLOBALS.nCfgSFXVolume = m_SliderSound_SFX->GetValue();
delete m_SliderSound_SFX;
m_SliderSound_SFX = NULL;
@@ -870,7 +888,7 @@ void RMOptionScreen::Init(CORO_PARAM, RMGfxTargetBuffer &bigBuf, bool &result) {
m_nState = MENUGAME;
CORO_INVOKE_0(InitState);
-
+
result = true;
CORO_END_CODE;
@@ -899,7 +917,7 @@ void RMOptionScreen::InitLoadMenuOnly(CORO_PARAM, RMGfxTargetBuffer &bigBuf, boo
m_nState = MENULOAD;
CORO_INVOKE_0(InitState);
-
+
result = true;
CORO_END_CODE;
@@ -910,7 +928,7 @@ void RMOptionScreen::InitSaveMenuOnly(CORO_PARAM, RMGfxTargetBuffer &bigBuf, boo
CORO_END_CONTEXT(_ctx);
CORO_BEGIN_CODE(_ctx);
-
+
if (m_FadeStep != 0) {
result = false;
return;
@@ -928,7 +946,7 @@ void RMOptionScreen::InitSaveMenuOnly(CORO_PARAM, RMGfxTargetBuffer &bigBuf, boo
m_nState = MENUSAVE;
CORO_INVOKE_0(InitState);
-
+
result = true;
CORO_END_CODE;
@@ -956,7 +974,7 @@ void RMOptionScreen::InitNoLoadSave(CORO_PARAM, RMGfxTargetBuffer &bigBuf, bool
m_nState = MENUGAME;
CORO_INVOKE_0(InitState);
-
+
result = true;
CORO_END_CODE;
@@ -995,12 +1013,12 @@ void RMOptionScreen::ChangeState(CORO_PARAM, STATE newState) {
CORO_END_CODE;
}
-void RMOptionScreen::DoFrame(CORO_PARAM, RMInput *input) {
+void RMOptionScreen::DoFrame(CORO_PARAM, RMInput *input) {
CORO_BEGIN_CONTEXT;
- bool bLeftClick, bRightClick;
- RMPoint mousePos;
- bool bRefresh;
- int i;
+ bool bLeftClick, bRightClick;
+ RMPoint mousePos;
+ bool bRefresh;
+ int i;
CORO_END_CONTEXT(_ctx);
CORO_BEGIN_CODE(_ctx);
@@ -1063,11 +1081,11 @@ void RMOptionScreen::DoFrame(CORO_PARAM, RMInput *input) {
_ctx->bRefresh |= m_ButtonSound_DubbingOn->DoFrame(_ctx->mousePos, _ctx->bLeftClick, _ctx->bRightClick);
_ctx->bRefresh |= m_ButtonSound_MusicOn->DoFrame(_ctx->mousePos, _ctx->bLeftClick, _ctx->bRightClick);
_ctx->bRefresh |= m_ButtonSound_SFXOn->DoFrame(_ctx->mousePos, _ctx->bLeftClick, _ctx->bRightClick);
-
+
} else if (m_nState == MENULOAD || m_nState == MENUSAVE) {
- for (_ctx->i=0;_ctx->i<6;_ctx->i++)
+ for (_ctx->i = 0; _ctx->i < 6; _ctx->i++)
m_ButtonSave_States[_ctx->i]->DoFrame(_ctx->mousePos, _ctx->bLeftClick, _ctx->bRightClick);
-
+
if (m_statePos > 0)
_ctx->bRefresh |= m_ButtonSave_ArrowLeft->DoFrame(_ctx->mousePos, _ctx->bLeftClick, _ctx->bRightClick);
if (m_statePos < 90)
@@ -1075,10 +1093,10 @@ void RMOptionScreen::DoFrame(CORO_PARAM, RMInput *input) {
}
}
-
-#define KEYPRESS(c) (_vm->GetEngine()->GetInput().GetAsyncKeyState(c))
+
+#define KEYPRESS(c) (_vm->GetEngine()->GetInput().GetAsyncKeyState(c))
#define PROCESS_CHAR(cod,c) if (KEYPRESS(cod)) { \
- m_EditName[strlen(m_EditName) +1 ] = '\0'; m_EditName[strlen(m_EditName)] = c; _ctx->bRefresh = true; }
+ m_EditName[strlen(m_EditName) +1 ] = '\0'; m_EditName[strlen(m_EditName)] = c; _ctx->bRefresh = true; }
/**************** STATO BOTTONI **************/
if (m_bEditSaveName) {
@@ -1089,9 +1107,9 @@ void RMOptionScreen::DoFrame(CORO_PARAM, RMInput *input) {
}
}
- for (_ctx->i=0;_ctx->i<26 && strlen(m_EditName)<12;_ctx->i++)
+ for (_ctx->i = 0; _ctx->i < 26 && strlen(m_EditName) < 12; _ctx->i++)
if (KEYPRESS(Common::KEYCODE_LSHIFT) ||
- KEYPRESS(Common::KEYCODE_RSHIFT)) {
+ KEYPRESS(Common::KEYCODE_RSHIFT)) {
PROCESS_CHAR((Common::KeyCode)((int)'a' + _ctx->i), _ctx->i + 'A');
} else {
PROCESS_CHAR((Common::KeyCode)((int)'a' + _ctx->i), _ctx->i + 'a');
@@ -1099,23 +1117,33 @@ void RMOptionScreen::DoFrame(CORO_PARAM, RMInput *input) {
for (_ctx->i = 0; _ctx->i < 10 && strlen(m_EditName) < 12; _ctx->i++)
PROCESS_CHAR((Common::KeyCode)((int)'0' + _ctx->i), _ctx->i + '0');
-
+
+ if (strlen(m_EditName) < 12)
+ PROCESS_CHAR(Common::KEYCODE_SPACE, ' ');
+
+ if (strlen(m_EditName) < 12)
+ PROCESS_CHAR(Common::KEYCODE_KP0, '0');
+ if (strlen(m_EditName) < 12)
+ PROCESS_CHAR(Common::KEYCODE_KP1, '1');
+ if (strlen(m_EditName) < 12)
+ PROCESS_CHAR(Common::KEYCODE_KP2, '2');
+ if (strlen(m_EditName) < 12)
+ PROCESS_CHAR(Common::KEYCODE_KP3, '3');
if (strlen(m_EditName) < 12)
- PROCESS_CHAR(Common::KEYCODE_SPACE,' ');
-
- if (strlen(m_EditName)<12) PROCESS_CHAR(Common::KEYCODE_KP0, '0');
- if (strlen(m_EditName)<12) PROCESS_CHAR(Common::KEYCODE_KP1, '1');
- if (strlen(m_EditName)<12) PROCESS_CHAR(Common::KEYCODE_KP2, '2');
- if (strlen(m_EditName)<12) PROCESS_CHAR(Common::KEYCODE_KP3, '3');
- if (strlen(m_EditName)<12) PROCESS_CHAR(Common::KEYCODE_KP4, '4');
- if (strlen(m_EditName)<12) PROCESS_CHAR(Common::KEYCODE_KP5, '5');
- if (strlen(m_EditName)<12) PROCESS_CHAR(Common::KEYCODE_KP6, '6');
- if (strlen(m_EditName)<12) PROCESS_CHAR(Common::KEYCODE_KP7, '7');
- if (strlen(m_EditName)<12) PROCESS_CHAR(Common::KEYCODE_KP8, '8');
- if (strlen(m_EditName)<12) PROCESS_CHAR(Common::KEYCODE_KP9, '9');
+ PROCESS_CHAR(Common::KEYCODE_KP4, '4');
+ if (strlen(m_EditName) < 12)
+ PROCESS_CHAR(Common::KEYCODE_KP5, '5');
+ if (strlen(m_EditName) < 12)
+ PROCESS_CHAR(Common::KEYCODE_KP6, '6');
+ if (strlen(m_EditName) < 12)
+ PROCESS_CHAR(Common::KEYCODE_KP7, '7');
+ if (strlen(m_EditName) < 12)
+ PROCESS_CHAR(Common::KEYCODE_KP8, '8');
+ if (strlen(m_EditName) < 12)
+ PROCESS_CHAR(Common::KEYCODE_KP9, '9');
// ANNULLA
- if (KEYPRESS(Common::KEYCODE_ESCAPE)) {
+ if (KEYPRESS(Common::KEYCODE_ESCAPE)) {
m_bEditSaveName = false;
_ctx->bRefresh = true;
}
@@ -1155,11 +1183,11 @@ void RMOptionScreen::DoFrame(CORO_PARAM, RMInput *input) {
}
} else {
for (_ctx->i = 0; _ctx->i < 6; _ctx->i++)
- if (m_ButtonSave_States[_ctx->i]->IsActive()) {
+ if (m_ButtonSave_States[_ctx->i]->IsActive()) {
// C'è da effettuare il salvataggio o il caricamento!!!!
if (m_nState == MENULOAD && m_curThumb[_ctx->i] != NULL) {
// Caricamento
- CORO_INVOKE_1(_vm->LoadState, m_statePos+_ctx->i);
+ CORO_INVOKE_1(_vm->LoadState, m_statePos + _ctx->i);
Close();
} else if (m_nState == MENUSAVE && (m_statePos != 0 || _ctx->i != 0)) {
// Attiva la modalità di editing
@@ -1247,7 +1275,7 @@ void RMOptionScreen::DoFrame(CORO_PARAM, RMInput *input) {
void RMOptionScreen::Draw(CORO_PARAM, RMGfxTargetBuffer &bigBuf, RMGfxPrimitive *prim) {
CORO_BEGIN_CONTEXT;
- int curTime;
+ int curTime;
CORO_END_CONTEXT(_ctx);
CORO_BEGIN_CODE(_ctx);
@@ -1255,17 +1283,17 @@ void RMOptionScreen::Draw(CORO_PARAM, RMGfxTargetBuffer &bigBuf, RMGfxPrimitive
_ctx->curTime = _vm->GetTime();
#define FADE_SPEED 20
-#define SYNC (_ctx->curTime-m_FadeTime) / 25
-
+#define SYNC (_ctx->curTime-m_FadeTime) / 25
+
if (m_bExit)
return;
if (m_FadeStep == 1) {
- // Discesa veloce
+ // Discesa veloce
if (m_FadeTime == -1)
m_FadeY += FADE_SPEED;
else
- m_FadeY += FADE_SPEED*SYNC;
+ m_FadeY += FADE_SPEED * SYNC;
if (m_FadeY > 480) {
m_FadeY = 480;
m_FadeStep++;
@@ -1334,7 +1362,7 @@ void RMOptionScreen::Draw(CORO_PARAM, RMGfxTargetBuffer &bigBuf, RMGfxPrimitive
m_bExit = true;
m_FadeStep = 0;
- // Libera la memoria
+ // Libera la memoria
CloseState();
return;
@@ -1357,13 +1385,13 @@ void RMOptionScreen::RemoveThis(CORO_PARAM, bool &result) {
}
-bool RMOptionScreen::LoadThumbnailFromSaveState(int nState, byte *lpDestBuf, RMString &name, byte &diff) {
+bool RMOptionScreen::LoadThumbnailFromSaveState(int nState, byte *lpDestBuf, RMString &name, byte &diff) {
Common::String buf;
- char namebuf[256];
+ char namebuf[256];
int i;
Common::InSaveFile *f;
char id[4];
-
+
// Pulisce la destinazione
Common::fill(lpDestBuf, lpDestBuf + 160 * 120 * 2, 0);
name = "No name";
@@ -1371,7 +1399,7 @@ bool RMOptionScreen::LoadThumbnailFromSaveState(int nState, byte *lpDestBuf, RMS
// Get the savegame filename for the given slot
buf = _vm->GetSaveStateFileName(nState);
-
+
// Try and open the savegame
f = g_system->getSavefileManager()->openForLoading(buf);
if (f == NULL)
@@ -1397,19 +1425,19 @@ bool RMOptionScreen::LoadThumbnailFromSaveState(int nState, byte *lpDestBuf, RMS
uint32 cmpsize, size;
cmpbuf = new byte[160 * 120 * 4];
-
+
// Se la versione >= 5, è compresso!
cmpsize = f->readUint32LE();
f->read(cmpbuf, cmpsize);
- lzo1x_decompress(cmpbuf,cmpsize,lpDestBuf,&size);
+ lzo1x_decompress(cmpbuf, cmpsize, lpDestBuf, &size);
delete[] cmpbuf;
} else {
// Read in the screenshot as an uncompressed data block
if (id[3] >= 8)
// Recent versions use hardcoded 160x120 uncomrpessed data, so size can be skipped
- f->skip(4);
+ f->skip(4);
f->read(lpDestBuf, 160 * 120 * 2);
}
@@ -1467,7 +1495,7 @@ void RMPointer::Init(void) {
m_specialPointer[i] = new RMItem;
ds >> *m_specialPointer[i];
}
-
+
//m_hotspot[0].Set(19,5);
m_hotspot[0].Set(5, 1);
m_hotspot[1].Set(32, 28);
@@ -1504,10 +1532,10 @@ int RMPointer::Priority() {
void RMPointer::Draw(CORO_PARAM, RMGfxTargetBuffer &bigBuf, RMGfxPrimitive *prim) {
CORO_BEGIN_CONTEXT;
- int n;
+ int n;
CORO_END_CONTEXT(_ctx);
- CORO_BEGIN_CODE(_ctx);
+ CORO_BEGIN_CODE(_ctx);
// Controlla il pointer
_ctx->n = m_nCurPointer;
@@ -1518,7 +1546,7 @@ void RMPointer::Draw(CORO_PARAM, RMGfxTargetBuffer &bigBuf, RMGfxPrimitive *prim
if (m_pos.x >= 0 && m_pos.y >= 0 && m_pos.x < RM_SX && m_pos.y < RM_SY) {
// Richiama il draw del puntatore
- prim->Dst()-=m_hotspot[_ctx->n];
+ prim->Dst() -= m_hotspot[_ctx->n];
if (m_nCurSpecialPointer == 0) {
CORO_INVOKE_2(m_pointer[_ctx->n]->Draw, bigBuf, prim);
@@ -1527,7 +1555,7 @@ void RMPointer::Draw(CORO_PARAM, RMGfxTargetBuffer &bigBuf, RMGfxPrimitive *prim
CORO_INVOKE_2(m_nCurCustomPointer->Draw, bigBuf, prim);
else
// Richiama il draw sul puntatore speciale
- CORO_INVOKE_2(m_specialPointer[m_nCurSpecialPointer-1]->Draw, bigBuf, prim);
+ CORO_INVOKE_2(m_specialPointer[m_nCurSpecialPointer - 1]->Draw, bigBuf, prim);
}
}
@@ -1539,8 +1567,8 @@ void RMPointer::DoFrame(RMGfxTargetBuffer *bigBuf) {
bigBuf->AddPrim(new RMGfxPrimitive(this));
// Se c'e' un puntatore speciale, fa la DoFrame
- if (m_nCurSpecialPointer!=0 && m_nCurSpecialPointer!=PTR_CUSTOM)
- m_specialPointer[m_nCurSpecialPointer-1]->DoFrame(bigBuf,false);
+ if (m_nCurSpecialPointer != 0 && m_nCurSpecialPointer != PTR_CUSTOM)
+ m_specialPointer[m_nCurSpecialPointer - 1]->DoFrame(bigBuf, false);
}
void RMPointer::RemoveThis(CORO_PARAM, bool &result) {
diff --git a/engines/tony/game.h b/engines/tony/game.h
index 22df40c6d8..160637d9c2 100644
--- a/engines/tony/game.h
+++ b/engines/tony/game.h
@@ -37,19 +37,19 @@
namespace Tony {
-#define INIT_GFX16_FROMRAW(dwRes, buf16) \
- raw = new RMResRaw(dwRes); \
- assert(raw->IsValid()); \
- assert((buf16) == NULL); \
- (buf16) = new RMGfxSourceBuffer16(false); \
- (buf16)->Init(*raw,raw->Width(),raw->Height()); \
+#define INIT_GFX16_FROMRAW(dwRes, buf16) \
+ raw = new RMResRaw(dwRes); \
+ assert(raw->IsValid()); \
+ assert((buf16) == NULL); \
+ (buf16) = new RMGfxSourceBuffer16(false); \
+ (buf16)->Init(*raw,raw->Width(),raw->Height()); \
delete raw;
-#define INIT_GFX8_FROMRAW(raw, dwRes, buf8) \
- raw = new RMResRaw(dwRes); \
- assert(raw->IsValid()); \
- assert((buf8) == NULL); \
- (buf8) = new RMGfxSourceBuffer8RLEByte(); \
+#define INIT_GFX8_FROMRAW(raw, dwRes, buf8) \
+ raw = new RMResRaw(dwRes); \
+ assert(raw->IsValid()); \
+ assert((buf8) == NULL); \
+ (buf8) = new RMGfxSourceBuffer8RLEByte(); \
(buf8)->Init(*raw, raw->Width(), raw->Height(), true); \
delete raw;
@@ -80,7 +80,7 @@ public:
public:
// Constructor & destructor
- RMPointer();
+ RMPointer();
virtual ~RMPointer();
// Initialisation
@@ -97,25 +97,34 @@ public:
// Overloading draw method
virtual void Draw(CORO_PARAM, RMGfxTargetBuffer &bigBuf, RMGfxPrimitive *prim);
-
+
// Sets the current co-ordinates
- void SetCoord(const RMPoint &pt) { m_pos = pt; }
+ void SetCoord(const RMPoint &pt) {
+ m_pos = pt;
+ }
// Overloading of the method to see if rising from the list
virtual void RemoveThis(CORO_PARAM, bool &result);
// Sets a new action as current
- void SetAction(RMTonyAction action) { m_nCurPointer = action; }
+ 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);
+ 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;
}
- POINTER GetSpecialPointer(void) { return (POINTER)m_nCurSpecialPointer; }
// Set the new custom pointer
- void SetCustomPointer(RMGfxSourceBuffer8 *ptr) { m_nCurCustomPointer = ptr; }
+ void SetCustomPointer(RMGfxSourceBuffer8 *ptr) {
+ m_nCurCustomPointer = ptr;
+ }
// Return the current action to be applied according to the pointer
int CurAction(void);
@@ -137,18 +146,22 @@ public:
bool DoFrame(const RMPoint &mousePos, bool bLeftClick, bool bRightClick);
virtual void Draw(CORO_PARAM, RMGfxTargetBuffer &bigBuf, RMGfxPrimitive *prim);
void AddToList(RMGfxTargetBuffer &bigBuf);
- bool IsActive() { return m_bActive; }
- void SetActiveState(bool bState) { m_bActive=bState; }
+ 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;
+ 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;
@@ -161,9 +174,11 @@ public:
bool DoFrame(const RMPoint &mousePos, bool bLeftClick, bool bRightClick);
virtual void Draw(CORO_PARAM, RMGfxTargetBuffer &bigBuf, RMGfxPrimitive *prim);
- void AddToList(RMGfxTargetBuffer& bigBuf);
+ void AddToList(RMGfxTargetBuffer &bigBuf);
- int GetValue() { return m_nValue; }
+ int GetValue() {
+ return m_nValue;
+ }
};
class RMOptionScreen : public RMGfxWoodyBuffer {
@@ -202,7 +217,7 @@ private:
bool m_bEditSaveName;
int m_nEditPos;
char m_EditName[256];
-
+
union {
RMOptionButton *m_ButtonGame_Lock;
RMOptionButton *m_ButtonGfx_Anni30;
@@ -233,11 +248,11 @@ private:
bool m_bAlterGfx;
enum STATE {
- MENUGAME,
- MENUGFX,
- MENUSOUND,
- MENULOAD,
- MENUSAVE
+ MENUGAME,
+ MENUGFX,
+ MENUSOUND,
+ MENULOAD,
+ MENUSAVE
};
STATE m_nState;
@@ -276,7 +291,7 @@ protected:
// Ridisegna tutto il menu delle opzioni
void RefreshAll(CORO_PARAM);
void RefreshThumbnails(void);
-
+
};
} // End of namespace Tony
diff --git a/engines/tony/gfxcore.cpp b/engines/tony/gfxcore.cpp
index 826159a8d7..ae68860e79 100644
--- a/engines/tony/gfxcore.cpp
+++ b/engines/tony/gfxcore.cpp
@@ -64,9 +64,9 @@ void RMGfxTaskSetPrior::SetPriority(int nPrior) {
\****************************************************************************/
RMGfxBuffer::RMGfxBuffer() {
- m_dimx = m_dimy = 0;
- m_bUseDDraw = false;
- m_origBuf = m_buf = NULL;
+ m_dimx = m_dimy = 0;
+ m_bUseDDraw = false;
+ m_origBuf = m_buf = NULL;
}
RMGfxBuffer::~RMGfxBuffer() {
@@ -102,7 +102,7 @@ void RMGfxBuffer::Destroy(void) {
void RMGfxBuffer::Lock(void) {
if (m_bUseDDraw) {
- // Gestisce l'accelerazione
+ // Gestisce l'accelerazione
}
}
@@ -113,7 +113,7 @@ void RMGfxBuffer::Unlock(void) {
}
void RMGfxBuffer::OffsetY(int nLines, int nBpp) {
- m_buf += nLines* Dimx() * nBpp / 8;
+ m_buf += nLines * Dimx() * nBpp / 8;
}
@@ -148,7 +148,7 @@ RMGfxBuffer::RMGfxBuffer(int dimx, int dimy, int nBpp, bool bUseDDraw) {
int RMGfxSourceBuffer::Init(const byte *buf, int dimx, int dimy, bool bLoadPalette) {
Create(dimx, dimy, Bpp());
CopyMemory(m_buf, buf, dimx * dimy * Bpp() / 8);
-
+
// Richiama la funzione di preparazione della surface (ereditata)
PrepareImage();
@@ -156,10 +156,10 @@ int RMGfxSourceBuffer::Init(const byte *buf, int dimx, int dimy, bool bLoadPalet
}
-void RMGfxSourceBuffer::Init(RMDataStream& ds, int dimx, int dimy, bool bLoadPalette) {
- Create(dimx, dimy,Bpp());
- ds.Read(m_buf, dimx * dimy*Bpp() / 8);
-
+void RMGfxSourceBuffer::Init(RMDataStream &ds, int dimx, int dimy, bool bLoadPalette) {
+ Create(dimx, dimy, Bpp());
+ ds.Read(m_buf, dimx * dimy * Bpp() / 8);
+
// Richiama la funzione di preparazione della surface (ereditata)
PrepareImage();
}
@@ -171,11 +171,11 @@ void RMGfxSourceBuffer::PrepareImage(void) {
// Non fa nulla: puo' essere overloadata se necessaria
}
-bool RMGfxSourceBuffer::Clip2D(int &x1, int &y1, int &u, int &v, int &width, int &height, bool bUseSrc, RMGfxTargetBuffer* buf) {
+bool RMGfxSourceBuffer::Clip2D(int &x1, int &y1, int &u, int &v, int &width, int &height, bool bUseSrc, RMGfxTargetBuffer *buf) {
int destw, desth;
/*
- OBSOLETE CODE:
+ OBSOLETE CODE:
if (buf == NULL) {
destw=RM_SX;
@@ -185,6 +185,7 @@ bool RMGfxSourceBuffer::Clip2D(int &x1, int &y1, int &u, int &v, int &width, int
desth = buf->Dimy();
}
*/
+
destw = buf->Dimx();
desth = buf->Dimy();
@@ -193,20 +194,25 @@ bool RMGfxSourceBuffer::Clip2D(int &x1, int &y1, int &u, int &v, int &width, int
width = m_dimx;
height = m_dimy;
}
-
- if (x1 > destw - 1) return false;
- if (y1 > desth - 1) return false;
- if (x1 < 0) {
+ if (x1 > destw - 1)
+ return false;
+
+ if (y1 > desth - 1)
+ return false;
+
+ if (x1 < 0) {
width += x1;
- if (width < 0) return false;
+ if (width < 0)
+ return false;
u -= x1;
- x1 = 0;
+ x1 = 0;
}
- if (y1 < 0) {
+ if (y1 < 0) {
height += y1;
- if (height < 0) return false;
+ if (height < 0)
+ return false;
v -= y1;
y1 = 0;
}
@@ -227,7 +233,7 @@ bool RMGfxSourceBuffer::Clip2D(int &x1, int &y1, int &u, int &v, int &width, int
* Description: Carica una surface partendo dall'ID della risorsa
*
* Input: uint32 resID ID della risorsa
-* int dimx, dimy Dimensione del buffer
+* int dimx, dimy Dimensione del buffer
*
\****************************************************************************/
@@ -263,7 +269,7 @@ RMGfxWoodyBuffer::RMGfxWoodyBuffer() {
}
RMGfxWoodyBuffer::RMGfxWoodyBuffer(int dimx, int dimy, bool bUseDDraw)
- : RMGfxBuffer(dimx,dimy,16,bUseDDraw) {
+ : RMGfxBuffer(dimx, dimy, 16, bUseDDraw) {
}
@@ -307,11 +313,11 @@ void RMGfxTargetBuffer::ClearOT(void) {
void RMGfxTargetBuffer::DrawOT(CORO_PARAM) {
CORO_BEGIN_CONTEXT;
- OTList *cur;
- OTList *prev;
- OTList *next;
- RMGfxPrimitive *myprim;
- bool result;
+ OTList *cur;
+ OTList *prev;
+ OTList *next;
+ RMGfxPrimitive *myprim;
+ bool result;
CORO_END_CONTEXT(_ctx);
CORO_BEGIN_CODE(_ctx);
@@ -323,9 +329,9 @@ void RMGfxTargetBuffer::DrawOT(CORO_PARAM) {
Lock();
// g_system->lockMutex(csModifyingOT);
- while (_ctx->cur != NULL) {
+ while (_ctx->cur != NULL) {
// Richiama la draw sul task, passandogli una copia della primitiva
- _ctx->myprim=_ctx->cur->prim->Duplicate();
+ _ctx->myprim = _ctx->cur->prim->Duplicate();
CORO_INVOKE_2(_ctx->cur->prim->m_task->Draw, *this, _ctx->myprim);
delete _ctx->myprim;
@@ -335,7 +341,7 @@ void RMGfxTargetBuffer::DrawOT(CORO_PARAM) {
// Deregistra il task
_ctx->cur->prim->m_task->Unregister();
- // Cancella il task liberando la memoria
+ // Cancella il task liberando la memoria
delete _ctx->cur->prim;
_ctx->next = _ctx->cur->next;
delete _ctx->cur;
@@ -388,7 +394,7 @@ void RMGfxTargetBuffer::AddPrim(RMGfxPrimitive *prim) {
} else {
cur = otlist;
while (cur->next != NULL && nPrior > cur->next->prim->m_task->Priority())
- cur=cur->next;
+ cur = cur->next;
n->next = cur->next;
cur->next = n;
@@ -403,7 +409,7 @@ void RMGfxTargetBuffer::AddClearTask(void) {
/****************************************************************************\
-* Metodi di RMGfxSourceBufferPal
+* Metodi di RMGfxSourceBufferPal
\****************************************************************************/
RMGfxSourceBufferPal::~RMGfxSourceBufferPal() {
@@ -420,11 +426,11 @@ int RMGfxSourceBufferPal::LoadPaletteWA(const byte *buf, bool bSwapped) {
m_pal[i * 3 + 2] = buf[i * 3 + 0];
}
else
- CopyMemory(m_pal,buf,(1<<Bpp())*3);
-
+ CopyMemory(m_pal, buf, (1 << Bpp()) * 3);
+
PreparePalette();
- return (1<<Bpp())*3;
+ return (1 << Bpp()) * 3;
}
int RMGfxSourceBufferPal::LoadPalette(const byte *buf) {
@@ -432,7 +438,7 @@ int RMGfxSourceBufferPal::LoadPalette(const byte *buf) {
for (i = 0; i < 256; i++)
CopyMemory(m_pal + i * 3, buf + i * 4, 3);
-
+
PreparePalette();
return (1 << Bpp()) * 4;
@@ -444,17 +450,17 @@ void RMGfxSourceBufferPal::PreparePalette(void) {
for (i = 0; i < 256; i++) {
m_palFinal[i] = (((int)m_pal[i * 3 + 0] >> 3) << 10) |
- (((int)m_pal[i * 3 + 1] >> 3) << 5) |
- (((int)m_pal[i * 3 + 2] >> 3) << 0);
+ (((int)m_pal[i * 3 + 1] >> 3) << 5) |
+ (((int)m_pal[i * 3 + 2] >> 3) << 0);
}
}
int RMGfxSourceBufferPal::Init(const byte *buf, int dimx, int dimy, bool bLoadPalette) {
int read;
-
+
// Carica l'immagine RAW
read = RMGfxSourceBuffer::Init(buf, dimx, dimy);
-
+
// Carica la palette se necessario
if (bLoadPalette)
read += LoadPaletteWA(&buf[read]);
@@ -465,7 +471,7 @@ int RMGfxSourceBufferPal::Init(const byte *buf, int dimx, int dimy, bool bLoadPa
void RMGfxSourceBufferPal::Init(RMDataStream &ds, int dimx, int dimy, bool bLoadPalette) {
// Carica l'immagine RAW
RMGfxSourceBuffer::Init(ds, dimx, dimy);
-
+
// Carica la palette se necessario
if (bLoadPalette) {
byte *suxpal = new byte[256 * 3];
@@ -484,14 +490,14 @@ int RMGfxSourceBufferPal::LoadPaletteWA(uint32 resID, bool bSwapped) {
}
/****************************************************************************\
-* Metodi di RMGfxSourceBuffer4
+* Metodi di RMGfxSourceBuffer4
\****************************************************************************/
void RMGfxSourceBuffer4::Draw(CORO_PARAM, RMGfxTargetBuffer &bigBuf, RMGfxPrimitive *prim) {
}
RMGfxSourceBuffer4::RMGfxSourceBuffer4(int dimx, int dimy, bool bUseDDraw)
- : RMGfxBuffer(dimx,dimy,4,bUseDDraw) {
+ : RMGfxBuffer(dimx, dimy, 4, bUseDDraw) {
SetPriority(0);
}
@@ -510,11 +516,11 @@ int RMGfxSourceBuffer4::Bpp() {
}
void RMGfxSourceBuffer4::Create(int dimx, int dimy, bool bUseDDraw) {
- RMGfxBuffer::Create(dimx,dimy,4,bUseDDraw);
+ RMGfxBuffer::Create(dimx, dimy, 4, bUseDDraw);
}
/****************************************************************************\
-* Metodi di RMGfxSourceBuffer8
+* Metodi di RMGfxSourceBuffer8
\****************************************************************************/
RMGfxSourceBuffer8::~RMGfxSourceBuffer8() {
@@ -530,13 +536,13 @@ void RMGfxSourceBuffer8::Draw(CORO_PARAM, RMGfxTargetBuffer &bigBuf, RMGfxPrimit
// Destination nel buffer
RMRect dst;
if (prim->HaveDst())
- dst=prim->Dst();
-
+ dst = prim->Dst();
+
// Esegue il clip
if (prim->HaveSrc()) {
u = prim->Src().x1;
v = prim->Src().y1;
-
+
width = prim->Src().Width();
height = prim->Src().Height();
}
@@ -567,7 +573,7 @@ void RMGfxSourceBuffer8::Draw(CORO_PARAM, RMGfxTargetBuffer &bigBuf, RMGfxPrimit
for (x = 0; x < width; x += 2) {
buf[0] = m_palFinal[raw[0]];
buf[1] = m_palFinal[raw[1]];
-
+
buf += 2;
raw += 2;
}
@@ -578,7 +584,7 @@ void RMGfxSourceBuffer8::Draw(CORO_PARAM, RMGfxTargetBuffer &bigBuf, RMGfxPrimit
}
RMGfxSourceBuffer8::RMGfxSourceBuffer8(int dimx, int dimy, bool bUseDDraw)
- : RMGfxBuffer(dimx,dimy,8,bUseDDraw) {
+ : RMGfxBuffer(dimx, dimy, 8, bUseDDraw) {
SetPriority(0);
}
@@ -601,26 +607,25 @@ int RMGfxSourceBuffer8::Bpp() {
return 8;
}
-void RMGfxSourceBuffer8::Create(int dimx, int dimy, bool bUseDDraw) {
+void RMGfxSourceBuffer8::Create(int dimx, int dimy, bool bUseDDraw) {
RMGfxBuffer::Create(dimx, dimy, 8, bUseDDraw);
}
-#define GETRED(x) (((x) >> 10) & 0x1F)
+#define GETRED(x) (((x) >> 10) & 0x1F)
#define GETGREEN(x) (((x) >> 5) & 0x1F)
#define GETBLUE(x) ((x) & 0x1F)
/****************************************************************************\
-* Metodi di RMGfxSourceBuffer8AB
+* Metodi di RMGfxSourceBuffer8AB
\****************************************************************************/
RMGfxSourceBuffer8AB::~RMGfxSourceBuffer8AB() {
}
-int RMGfxSourceBuffer8AB::CalcTrasp(int fore, int back)
-{
- int r,g,b;
+int RMGfxSourceBuffer8AB::CalcTrasp(int fore, int back) {
+ int r, g, b;
r = (GETRED(fore) >> 2) + (GETRED(back) >> 1);
g = (GETGREEN(fore) >> 2) + (GETGREEN(back) >> 1);
@@ -630,13 +635,13 @@ int RMGfxSourceBuffer8AB::CalcTrasp(int fore, int back)
if (g > 0x1F) g = 0x1F;
if (b > 0x1F) b = 0x1F;
- return (r<<10)|(g<<5)|b;
+ return (r << 10) | (g << 5) | b;
}
void RMGfxSourceBuffer8AB::Draw(CORO_PARAM, RMGfxTargetBuffer &bigBuf, RMGfxPrimitive *prim) {
int x, y, width, height, u, v;
- int bufx=bigBuf.Dimx();
+ int bufx = bigBuf.Dimx();
uint16 *buf = bigBuf;
byte *raw = m_buf;
@@ -644,12 +649,12 @@ void RMGfxSourceBuffer8AB::Draw(CORO_PARAM, RMGfxTargetBuffer &bigBuf, RMGfxPrim
RMRect dst;
if (prim->HaveDst())
dst = prim->Dst();
-
+
// Esegue il clip
if (prim->HaveSrc()) {
- u=prim->Src().x1;
- v=prim->Src().y1;
-
+ u = prim->Src().x1;
+ v = prim->Src().y1;
+
width = prim->Src().Width();
height = prim->Src().Height();
}
@@ -675,12 +680,12 @@ void RMGfxSourceBuffer8AB::Draw(CORO_PARAM, RMGfxTargetBuffer &bigBuf, RMGfxPrim
}
} else {
for (y = 0; y < height; y++) {
- raw = m_buf + (y+v) * m_dimx + u;
+ raw = m_buf + (y + v) * m_dimx + u;
for (x = 0; x < width; x += 2) {
buf[0] = CalcTrasp(m_palFinal[raw[0]], buf[0]);
buf[1] = CalcTrasp(m_palFinal[raw[1]], buf[1]);
-
+
buf += 2;
raw += 2;
}
@@ -695,7 +700,7 @@ void RMGfxSourceBuffer8AB::Draw(CORO_PARAM, RMGfxTargetBuffer &bigBuf, RMGfxPrim
/****************************************************************************\
-* Metodi di RMGfxSourceBuffer8RLE
+* Metodi di RMGfxSourceBuffer8RLE
\****************************************************************************/
byte RMGfxSourceBuffer8RLE::MegaRLEBuf[512 * 1024];
@@ -724,7 +729,7 @@ int RMGfxSourceBuffer8RLE::Init(const byte *buf, int dimx, int dimy, bool bLoadP
void RMGfxSourceBuffer8RLE::Init(RMDataStream &ds, int dimx, int dimy, bool bLoadPalette) {
if (bNeedRLECompress) {
- RMGfxSourceBufferPal::Init(ds, dimx, dimy,bLoadPalette);
+ RMGfxSourceBufferPal::Init(ds, dimx, dimy, bLoadPalette);
} else {
int size;
@@ -745,7 +750,7 @@ void RMGfxSourceBuffer8RLE::PreparePalette(void) {
if (alphaBlendColor != -1) {
alphaR = (m_palFinal[alphaBlendColor] >> 10) & 0x1F;
alphaG = (m_palFinal[alphaBlendColor] >> 5) & 0x1F;
- alphaB = (m_palFinal[alphaBlendColor]) & 0x1F;
+ alphaB = (m_palFinal[alphaBlendColor]) & 0x1F;
}
}
@@ -770,14 +775,14 @@ void RMGfxSourceBuffer8RLE::CompressRLE(void) {
byte *src;
byte *startsrc;
int rep;
-
+
// Esegue la compressione RLE, per linee
cur = MegaRLEBuf;
src = m_buf;
- for (y = 0;y < m_dimy; y++) {
+ for (y = 0; y < m_dimy; y++) {
// Si salva l'inizio della linea
startline = cur;
-
+
// Lascia lo spazio per la lunghezza della linea
cur += 2;
@@ -787,7 +792,7 @@ void RMGfxSourceBuffer8RLE::CompressRLE(void) {
startsrc = src;
for (x = 0; x < m_dimx;) {
if ((curdata == 0 && *src == 0) || (curdata == 1 && *src == alphaBlendColor)
- || (curdata == 2 && (*src != alphaBlendColor && *src != 0))) {
+ || (curdata == 2 && (*src != alphaBlendColor && *src != 0))) {
src++;
rep++;
x++;
@@ -795,8 +800,7 @@ void RMGfxSourceBuffer8RLE::CompressRLE(void) {
if (curdata == 0) {
RLEWriteTrasp(cur, rep);
curdata++;
- }
- else if (curdata == 1) {
+ } else if (curdata == 1) {
RLEWriteAlphaBlend(cur, rep);
curdata++;
} else {
@@ -807,14 +811,14 @@ void RMGfxSourceBuffer8RLE::CompressRLE(void) {
rep = 0;
startsrc = src;
}
- }
-
+ }
+
// Dati in sospeso?
if (curdata == 1) {
RLEWriteAlphaBlend(cur, rep);
RLEWriteData(cur, 0, NULL);
}
-
+
if (curdata == 2) {
RLEWriteData(cur, rep, startsrc);
}
@@ -825,9 +829,9 @@ void RMGfxSourceBuffer8RLE::CompressRLE(void) {
// Scrive la lunghezza della linea
WRITE_LE_UINT16(startline, (uint16)(cur - startline));
}
-
+
// Cancella l'immagine originale
- delete[] m_buf;
+ delete[] m_buf;
// Ci copia l'immagine compressa
x = cur - MegaRLEBuf;
@@ -840,20 +844,20 @@ void RMGfxSourceBuffer8RLE::Draw(CORO_PARAM, RMGfxTargetBuffer &bigBuf, RMGfxPri
byte *src;
uint16 *buf = bigBuf;
int x1, y1, u, v, width, height;
-
+
// Clippiamo lo sprite
- x1=prim->Dst().x1;
- y1=prim->Dst().y1;
- if (!Clip2D(x1,y1,u,v,width,height,false,&bigBuf))
+ x1 = prim->Dst().x1;
+ y1 = prim->Dst().y1;
+ if (!Clip2D(x1, y1, u, v, width, height, false, &bigBuf))
return;
// Andiamo avanti di V linee nell'immagine RLE
src = m_buf;
- for (y = 0;y<v;y++)
+ for (y = 0; y < v; y++)
src += READ_LE_UINT16(src);
// Posizionamoci nel buffer di destinazione
- buf += y1*bigBuf.Dimx();
+ buf += y1 * bigBuf.Dimx();
// Looppone
if (prim->IsFlipped()) {
@@ -861,8 +865,8 @@ void RMGfxSourceBuffer8RLE::Draw(CORO_PARAM, RMGfxTargetBuffer &bigBuf, RMGfxPri
// width = m_dimx;
// x1=prim->Dst().x1;
- // Flippiamo il clipping
- u = m_dimx - (width+u);
+ // Flippiamo il clipping
+ u = m_dimx - (width + u);
x1 = (prim->Dst().x1 + m_dimx - 1) - u;
for (y = 0; y < height; y++) {
@@ -873,7 +877,7 @@ void RMGfxSourceBuffer8RLE::Draw(CORO_PARAM, RMGfxTargetBuffer &bigBuf, RMGfxPri
src += READ_LE_UINT16(src);
// Skippa alla linea successiva
- buf += bigBuf.Dimx();
+ buf += bigBuf.Dimx();
}
} else {
for (y = 0; y < height; y++) {
@@ -884,14 +888,14 @@ void RMGfxSourceBuffer8RLE::Draw(CORO_PARAM, RMGfxTargetBuffer &bigBuf, RMGfxPri
src += READ_LE_UINT16(src);
// Skippa alla linea successiva
- buf += bigBuf.Dimx();
+ buf += bigBuf.Dimx();
}
}
}
/****************************************************************************\
-* Metodi di RMGfxSourceBuffer8RLEByte
+* Metodi di RMGfxSourceBuffer8RLEByte
\****************************************************************************/
RMGfxSourceBuffer8RLEByte::~RMGfxSourceBuffer8RLEByte() {
@@ -900,18 +904,18 @@ RMGfxSourceBuffer8RLEByte::~RMGfxSourceBuffer8RLEByte() {
void RMGfxSourceBuffer8RLEByte::RLEWriteTrasp(byte *&cur, int rep) {
assert(rep < 255);
- *cur ++= rep;
+ *cur ++ = rep;
}
void RMGfxSourceBuffer8RLEByte::RLEWriteAlphaBlend(byte *&cur, int rep) {
assert(rep < 255);
- *cur ++= rep;
+ *cur ++ = rep;
}
void RMGfxSourceBuffer8RLEByte::RLEWriteData(byte *&cur, int rep, byte *src) {
assert(rep < 256);
-
- *cur ++= rep;
+
+ *cur ++ = rep;
if (rep > 0) {
CopyMemory(cur, src, rep);
cur += rep;
@@ -922,15 +926,15 @@ void RMGfxSourceBuffer8RLEByte::RLEWriteData(byte *&cur, int rep, byte *src) {
}
void RMGfxSourceBuffer8RLEByte::RLEWriteEOL(byte *&cur) {
- *cur ++= 0xFF;
+ *cur ++ = 0xFF;
}
void RMGfxSourceBuffer8RLEByte::RLEDecompressLine(uint16 *dst, byte *src, int nStartSkip, int nLength) {
int i, n;
int r, g, b;
- if (nStartSkip == 0)
- goto RLEByteDoTrasp;
+ if (nStartSkip == 0)
+ goto RLEByteDoTrasp;
while (1) {
assert(nStartSkip > 0);
@@ -939,7 +943,7 @@ void RMGfxSourceBuffer8RLEByte::RLEDecompressLine(uint16 *dst, byte *src, int nS
n = *src++;
if (n == 0xFF)
return;
-
+
if (n >= nStartSkip) {
dst += n - nStartSkip;
nLength -= n - nStartSkip;
@@ -952,7 +956,7 @@ void RMGfxSourceBuffer8RLEByte::RLEDecompressLine(uint16 *dst, byte *src, int nS
assert(nStartSkip > 0);
-
+
// ALPHA
n = *src++;
if (n >= nStartSkip) {
@@ -979,11 +983,11 @@ void RMGfxSourceBuffer8RLEByte::RLEDecompressLine(uint16 *dst, byte *src, int nS
RLEByteDoTrasp:
// Via il trasp di merda
n = *src++;
-
+
// EOL?
if (n == 0xFF)
- return;
-
+ return;
+
dst += n;
nLength -= n;
if (nLength <= 0)
@@ -997,15 +1001,15 @@ RLEByteDoAlpha2:
if (n > nLength)
n = nLength;
for (i = 0; i < n; i++) {
- r=(*dst >> 10) & 0x1F;
- g=(*dst >> 5) & 0x1F;
- b=*dst & 0x1F;
+ r = (*dst >> 10) & 0x1F;
+ g = (*dst >> 5) & 0x1F;
+ b = *dst & 0x1F;
- r=(r >> 2) + (alphaR >> 1);
- g=(g >> 2) + (alphaG >> 1);
- b=(b >> 2) + (alphaB >> 1);
+ r = (r >> 2) + (alphaR >> 1);
+ g = (g >> 2) + (alphaG >> 1);
+ b = (b >> 2) + (alphaB >> 1);
- *dst ++= (r << 10) | (g << 5) | b;
+ *dst ++ = (r << 10) | (g << 5) | b;
}
nLength -= n;
@@ -1020,9 +1024,9 @@ RLEByteDoAlpha2:
RLEByteDoCopy2:
if (n > nLength)
n = nLength;
-
- for (i = 0; i < n; i++)
- *dst ++= m_palFinal[*src++];
+
+ for (i = 0; i < n; i++)
+ *dst ++ = m_palFinal[*src++];
nLength -= n;
if (!nLength)
@@ -1035,8 +1039,8 @@ void RMGfxSourceBuffer8RLEByte::RLEDecompressLineFlipped(uint16 *dst, byte *src,
int i, n;
int r, g, b;
- if (nStartSkip == 0)
- goto RLEByteFlippedDoTrasp;
+ if (nStartSkip == 0)
+ goto RLEByteFlippedDoTrasp;
while (1) {
assert(nStartSkip > 0);
@@ -1045,7 +1049,7 @@ void RMGfxSourceBuffer8RLEByte::RLEDecompressLineFlipped(uint16 *dst, byte *src,
n = *src++;
if (n == 0xFF)
return;
-
+
if (n >= nStartSkip) {
dst -= n - nStartSkip;
nLength -= n - nStartSkip;
@@ -1058,7 +1062,7 @@ void RMGfxSourceBuffer8RLEByte::RLEDecompressLineFlipped(uint16 *dst, byte *src,
assert(nStartSkip > 0);
-
+
// ALPHA
n = *src++;
if (n >= nStartSkip) {
@@ -1071,7 +1075,7 @@ void RMGfxSourceBuffer8RLEByte::RLEDecompressLineFlipped(uint16 *dst, byte *src,
// DATA
n = *src++;
- if (n >= nStartSkip){
+ if (n >= nStartSkip) {
src += nStartSkip;
n -= nStartSkip;
goto RLEByteFlippedDoCopy2;
@@ -1085,11 +1089,11 @@ void RMGfxSourceBuffer8RLEByte::RLEDecompressLineFlipped(uint16 *dst, byte *src,
RLEByteFlippedDoTrasp:
// Via il trasp di merda
n = *src++;
-
+
// EOL?
if (n == 0xFF)
- return;
-
+ return;
+
dst -= n;
nLength -= n;
if (nLength <= 0)
@@ -1103,15 +1107,15 @@ RLEByteFlippedDoAlpha2:
if (n > nLength)
n = nLength;
for (i = 0; i < n; i++) {
- r=(*dst >> 10) & 0x1F;
- g=(*dst >> 5) & 0x1F;
- b=*dst & 0x1F;
+ r = (*dst >> 10) & 0x1F;
+ g = (*dst >> 5) & 0x1F;
+ b = *dst & 0x1F;
- r=(r >> 2) + (alphaR >> 1);
- g=(g >> 2) + (alphaG >> 1);
- b=(b >> 2) + (alphaB >> 1);
+ r = (r >> 2) + (alphaR >> 1);
+ g = (g >> 2) + (alphaG >> 1);
+ b = (b >> 2) + (alphaB >> 1);
- *dst--=(r << 10) | (g << 5) | b;
+ *dst-- = (r << 10) | (g << 5) | b;
}
nLength -= n;
@@ -1126,9 +1130,9 @@ RLEByteFlippedDoAlpha2:
RLEByteFlippedDoCopy2:
if (n > nLength)
n = nLength;
-
- for (i = 0; i < n; i++)
- *dst --= m_palFinal[*src++];
+
+ for (i = 0; i < n; i++)
+ *dst -- = m_palFinal[*src++];
nLength -= n;
if (!nLength)
@@ -1139,10 +1143,10 @@ RLEByteFlippedDoCopy2:
/****************************************************************************\
-* Metodi di RMGfxSourceBuffer8RLEWord
+* Metodi di RMGfxSourceBuffer8RLEWord
\****************************************************************************/
-RMGfxSourceBuffer8RLEWord::~RMGfxSourceBuffer8RLEWord(){
+RMGfxSourceBuffer8RLEWord::~RMGfxSourceBuffer8RLEWord() {
}
@@ -1161,23 +1165,23 @@ void RMGfxSourceBuffer8RLEWord::RLEWriteData(byte *&cur, int rep, byte *src) {
cur += 2;
if (rep > 0) {
- CopyMemory(cur, src,rep);
+ CopyMemory(cur, src, rep);
cur += rep;
- src +=rep;
+ src += rep;
}
}
void RMGfxSourceBuffer8RLEWord::RLEWriteEOL(byte *&cur) {
- *cur ++= 0xFF;
- *cur ++= 0xFF;
+ *cur ++ = 0xFF;
+ *cur ++ = 0xFF;
}
void RMGfxSourceBuffer8RLEWord::RLEDecompressLine(uint16 *dst, byte *src, int nStartSkip, int nLength) {
int i, n;
int r, g, b;
- if (nStartSkip == 0)
- goto RLEWordDoTrasp;
+ if (nStartSkip == 0)
+ goto RLEWordDoTrasp;
while (1) {
assert(nStartSkip > 0);
@@ -1188,11 +1192,11 @@ void RMGfxSourceBuffer8RLEWord::RLEDecompressLine(uint16 *dst, byte *src, int nS
if (n == 0xFFFF)
return;
-
+
if (n >= nStartSkip) {
dst += n - nStartSkip;
nLength -= n - nStartSkip;
-
+
if (nLength > 0)
goto RLEWordDoAlpha;
else
@@ -1215,7 +1219,7 @@ void RMGfxSourceBuffer8RLEWord::RLEDecompressLine(uint16 *dst, byte *src, int nS
// DATA
n = READ_LE_UINT16(src);
src += 2;
-
+
if (n >= nStartSkip) {
src += nStartSkip;
n -= nStartSkip;
@@ -1231,11 +1235,11 @@ RLEWordDoTrasp:
// Via il trasp di merda
n = READ_LE_UINT16(src);
src += 2;
-
+
// EOL?
if (n == 0xFFFF)
- return;
-
+ return;
+
dst += n;
nLength -= n;
@@ -1252,15 +1256,15 @@ RLEWordDoAlpha2:
n = nLength;
for (i = 0; i < n; i++) {
- r=(*dst >> 10) & 0x1F;
- g=(*dst >> 5) & 0x1F;
- b=*dst & 0x1F;
+ r = (*dst >> 10) & 0x1F;
+ g = (*dst >> 5) & 0x1F;
+ b = *dst & 0x1F;
- r=(r >> 2) + (alphaR >> 1);
- g=(g >> 2) + (alphaG >> 1);
- b=(b >> 2) + (alphaB >> 1);
+ r = (r >> 2) + (alphaR >> 1);
+ g = (g >> 2) + (alphaG >> 1);
+ b = (b >> 2) + (alphaB >> 1);
- *dst++=(r<<10)|(g<<5)|b;
+ *dst++ = (r << 10) | (g << 5) | b;
}
nLength -= n;
@@ -1273,29 +1277,29 @@ RLEWordDoAlpha2:
// Copia la roba
n = READ_LE_UINT16(src);
src += 2;
-
+
RLEWordDoCopy2:
if (n > nLength)
n = nLength;
- for (i = 0; i < n; i++)
- *dst ++= m_palFinal[*src++];
+ for (i = 0; i < n; i++)
+ *dst ++ = m_palFinal[*src++];
nLength -= n;
if (!nLength)
return;
-
+
assert(nLength > 0);
}
}
void RMGfxSourceBuffer8RLEWord::RLEDecompressLineFlipped(uint16 *dst, byte *src, int nStartSkip, int nLength) {
- int i,n;
- int r,g,b;
+ int i, n;
+ int r, g, b;
- if (nStartSkip == 0)
- goto RLEWordFlippedDoTrasp;
+ if (nStartSkip == 0)
+ goto RLEWordFlippedDoTrasp;
while (1) {
assert(nStartSkip > 0);
@@ -1306,11 +1310,11 @@ void RMGfxSourceBuffer8RLEWord::RLEDecompressLineFlipped(uint16 *dst, byte *src,
if (n == 0xFFFF)
return;
-
+
if (n >= nStartSkip) {
dst -= n - nStartSkip;
nLength -= n - nStartSkip;
-
+
if (nLength > 0)
goto RLEWordFlippedDoAlpha;
else
@@ -1333,7 +1337,7 @@ void RMGfxSourceBuffer8RLEWord::RLEDecompressLineFlipped(uint16 *dst, byte *src,
// DATA
n = READ_LE_UINT16(src);
src += 2;
-
+
if (n >= nStartSkip) {
src += nStartSkip;
n -= nStartSkip;
@@ -1349,11 +1353,11 @@ RLEWordFlippedDoTrasp:
// Via il trasp di merda
n = READ_LE_UINT16(src);
src += 2;
-
+
// EOL?
if (n == 0xFFFF)
- return;
-
+ return;
+
dst -= n;
nLength -= n;
@@ -1370,15 +1374,15 @@ RLEWordFlippedDoAlpha2:
n = nLength;
for (i = 0; i < n; i++) {
- r=(*dst >> 10) & 0x1F;
- g=(*dst >> 5) & 0x1F;
- b=*dst & 0x1F;
+ r = (*dst >> 10) & 0x1F;
+ g = (*dst >> 5) & 0x1F;
+ b = *dst & 0x1F;
- r=(r >> 2) + (alphaR >> 1);
- g=(g >> 2) + (alphaG >> 1);
- b=(b >> 2) + (alphaB >> 1);
+ r = (r >> 2) + (alphaR >> 1);
+ g = (g >> 2) + (alphaG >> 1);
+ b = (b >> 2) + (alphaB >> 1);
- *dst--=(r << 10) | (g << 5) | b;
+ *dst-- = (r << 10) | (g << 5) | b;
}
nLength -= n;
@@ -1391,24 +1395,24 @@ RLEWordFlippedDoAlpha2:
// Copia la roba
n = READ_LE_UINT16(src);
src += 2;
-
+
RLEWordFlippedDoCopy2:
if (n > nLength)
n = nLength;
- for (i = 0;i<n;i++)
- *dst --= m_palFinal[*src++];
+ for (i = 0; i < n; i++)
+ *dst -- = m_palFinal[*src++];
nLength -= n;
if (!nLength)
return;
-
+
assert(nLength > 0);
}
}
/****************************************************************************\
-* Metodi di RMGfxSourceBuffer8RLEWord
+* Metodi di RMGfxSourceBuffer8RLEWord
\****************************************************************************/
RMGfxSourceBuffer8RLEWordAB::~RMGfxSourceBuffer8RLEWordAB() {
@@ -1424,8 +1428,8 @@ void RMGfxSourceBuffer8RLEWordAB::RLEDecompressLine(uint16 *dst, byte *src, int
return;
}
- if (nStartSkip == 0)
- goto RLEWordDoTrasp;
+ if (nStartSkip == 0)
+ goto RLEWordDoTrasp;
while (1) {
assert(nStartSkip > 0);
@@ -1436,11 +1440,11 @@ void RMGfxSourceBuffer8RLEWordAB::RLEDecompressLine(uint16 *dst, byte *src, int
if (n == 0xFFFF)
return;
-
+
if (n >= nStartSkip) {
dst += n - nStartSkip;
nLength -= n - nStartSkip;
-
+
if (nLength > 0)
goto RLEWordDoAlpha;
else
@@ -1463,7 +1467,7 @@ void RMGfxSourceBuffer8RLEWordAB::RLEDecompressLine(uint16 *dst, byte *src, int
// DATA
n = READ_LE_UINT16(src);
src += 2;
-
+
if (n >= nStartSkip) {
src += nStartSkip;
n -= nStartSkip;
@@ -1479,11 +1483,11 @@ RLEWordDoTrasp:
// Via il trasp di merda
n = READ_LE_UINT16(src);
src += 2;
-
+
// EOL?
if (n == 0xFFFF)
- return;
-
+ return;
+
dst += n;
nLength -= n;
@@ -1499,17 +1503,17 @@ RLEWordDoAlpha2:
if (n > nLength)
n = nLength;
- // @@@ NON DOVREBBE ESSERCI!!!!!
+ // @@@ NON DOVREBBE ESSERCI!!!!!
for (i = 0; i < n; i++) {
- r=(*dst >> 10) & 0x1F;
- g=(*dst >> 5) & 0x1F;
- b=*dst & 0x1F;
+ r = (*dst >> 10) & 0x1F;
+ g = (*dst >> 5) & 0x1F;
+ b = *dst & 0x1F;
- r=(r >> 2) + (alphaR >> 1);
- g=(g >> 2) + (alphaG >> 1);
- b=(b >> 2) + (alphaB >> 1);
+ r = (r >> 2) + (alphaR >> 1);
+ g = (g >> 2) + (alphaG >> 1);
+ b = (b >> 2) + (alphaB >> 1);
- *dst++=(r<<10)|(g<<5)|b;
+ *dst++ = (r << 10) | (g << 5) | b;
}
nLength -= n;
@@ -1522,7 +1526,7 @@ RLEWordDoAlpha2:
// Copia la roba
n = READ_LE_UINT16(src);
src += 2;
-
+
RLEWordDoCopy2:
if (n > nLength)
n = nLength;
@@ -1540,14 +1544,14 @@ RLEWordDoCopy2:
g = (g >> 1) + (g2 >> 1);
b = (b >> 1) + (b2 >> 1);
- *dst ++= (r << 10) | (g << 5) | b;
+ *dst ++ = (r << 10) | (g << 5) | b;
src++;
}
nLength -= n;
if (!nLength)
return;
-
+
assert(nLength > 0);
}
@@ -1555,16 +1559,16 @@ RLEWordDoCopy2:
/****************************************************************************\
-* Metodi di RMGfxSourceBuffer8AA
+* Metodi di RMGfxSourceBuffer8AA
\****************************************************************************/
-byte RMGfxSourceBuffer8AA::MegaAABuf[256*1024];
-byte RMGfxSourceBuffer8AA::MegaAABuf2[64*1024];
+byte RMGfxSourceBuffer8AA::MegaAABuf[256 * 1024];
+byte RMGfxSourceBuffer8AA::MegaAABuf2[64 * 1024];
void RMGfxSourceBuffer8AA::PrepareImage(void) {
// Richiama il metodo padre
RMGfxSourceBuffer::PrepareImage();
-
+
// Prepara il buffer di antialiasing
CalculateAA();
}
@@ -1574,44 +1578,44 @@ void RMGfxSourceBuffer8AA::CalculateAA(void) {
// Io suxo tu suxi egli suxa noi suxiamo voi suxate essi suxano ---> ANTI ALIASING SUX!
// ************************************************************
- int x,y;
+ int x, y;
byte *src, *srcaa;
/* Prima passata: cerchiamo i bordi */
Common::fill(MegaAABuf, MegaAABuf + m_dimx * m_dimy, 0);
-
+
src = m_buf;
- srcaa=MegaAABuf;
- for (y = 0;y < m_dimy; y++) {
+ srcaa = MegaAABuf;
+ for (y = 0; y < m_dimy; y++) {
for (x = 0; x < m_dimx; x++) {
if (*src == 0) {
if ((y > 0 && src[-m_dimx] != 0) ||
- (y<m_dimy-1 && src[m_dimx] != 0) ||
- (x > 0 && src[-1] != 0) ||
- (x<m_dimx-1 && src[1] != 0))
+ (y < m_dimy - 1 && src[m_dimx] != 0) ||
+ (x > 0 && src[-1] != 0) ||
+ (x < m_dimx - 1 && src[1] != 0))
*srcaa = 1;
}
src++;
srcaa++;
- }
+ }
}
src = m_buf;
- srcaa=MegaAABuf;
+ srcaa = MegaAABuf;
for (y = 0; y < m_dimy; y++) {
for (x = 0; x < m_dimx; x++) {
if (*src != 0) {
- if ((y > 0 && srcaa[-m_dimx]==1) ||
- (y<m_dimy-1 && srcaa[m_dimx]==1) ||
- (x > 0 && srcaa[-1]==1) ||
- (x<m_dimx-1 && srcaa[1]==1))
+ if ((y > 0 && srcaa[-m_dimx] == 1) ||
+ (y < m_dimy - 1 && srcaa[m_dimx] == 1) ||
+ (x > 0 && srcaa[-1] == 1) ||
+ (x < m_dimx - 1 && srcaa[1] == 1))
*srcaa = 2;
}
src++;
srcaa++;
- }
+ }
}
if (m_aabuf != NULL)
@@ -1631,14 +1635,14 @@ RMGfxSourceBuffer8AA::~RMGfxSourceBuffer8AA() {
}
void RMGfxSourceBuffer8AA::DrawAA(RMGfxTargetBuffer &bigBuf, RMGfxPrimitive *prim) {
- int x,y;
+ int x, y;
byte *src;
uint16 *mybuf;
uint16 *buf;
int x1, y1, u, v, width, height;
int r, g, b;
int step;
-
+
// Clippiamo lo sprite
x1 = prim->Dst().x1;
y1 = prim->Dst().y1;
@@ -1652,7 +1656,7 @@ void RMGfxSourceBuffer8AA::DrawAA(RMGfxTargetBuffer &bigBuf, RMGfxPrimitive *pri
// Annulliamo il clipping orizzontale
- // Flippiamo il clipping
+ // Flippiamo il clipping
if (prim->IsFlipped()) {
u = m_dimx - (width + u);
x1 = (prim->Dst().x1 + m_dimx - 1) - u;
@@ -1660,7 +1664,7 @@ void RMGfxSourceBuffer8AA::DrawAA(RMGfxTargetBuffer &bigBuf, RMGfxPrimitive *pri
// width = m_dimx;
// x1=prim->Dst().x1;
-
+
// Posizionamoci nel buffer di destinazione
buf = bigBuf;
buf += y1 * bigBuf.Dimx();
@@ -1673,12 +1677,12 @@ void RMGfxSourceBuffer8AA::DrawAA(RMGfxTargetBuffer &bigBuf, RMGfxPrimitive *pri
// Looppone
buf += bigBuf.Dimx(); // skippa la prima linea
for (y = 1; y < height - 1; y++) {
-/*
- if (prim->IsFlipped())
- mybuf=&buf[x1+m_dimx-1];
- else
-*/
- mybuf=&buf[x1];
+ /*
+ if (prim->IsFlipped())
+ mybuf=&buf[x1+m_dimx-1];
+ else
+ */
+ mybuf = &buf[x1];
for (x = 0; x < width; x++, mybuf += step)
if (m_aabuf[(y + v) * m_dimx + x + u] == 2 && x != 0 && x != width - 1) {
@@ -1689,7 +1693,7 @@ void RMGfxSourceBuffer8AA::DrawAA(RMGfxTargetBuffer &bigBuf, RMGfxPrimitive *pri
r += GETRED(mybuf[0]);
g += GETGREEN(mybuf[0]);
b += GETBLUE(mybuf[0]);
-
+
r /= 5;
g /= 5;
b /= 5;
@@ -1698,28 +1702,28 @@ void RMGfxSourceBuffer8AA::DrawAA(RMGfxTargetBuffer &bigBuf, RMGfxPrimitive *pri
if (g > 31) g = 31;
if (b > 31) b = 31;
- mybuf[0]=(r<<10)|(g<<5)|b;
+ mybuf[0] = (r << 10) | (g << 5) | b;
}
-
+
// Skippa alla linea successiva
- buf += bigBuf.Dimx();
+ buf += bigBuf.Dimx();
}
// Posizionamoci nel buffer di destinazione
buf = bigBuf;
- buf += y1*bigBuf.Dimx();
+ buf += y1 * bigBuf.Dimx();
// Looppone
- buf+=bigBuf.Dimx();
+ buf += bigBuf.Dimx();
for (y = 1; y < height - 1; y++) {
-/*
- if (prim->IsFlipped())
- mybuf=&buf[x1+m_dimx-1];
- else
-*/
- mybuf=&buf[x1];
+ /*
+ if (prim->IsFlipped())
+ mybuf=&buf[x1+m_dimx-1];
+ else
+ */
+ mybuf = &buf[x1];
- for (x = 0;x < width; x++, mybuf += step)
+ for (x = 0; x < width; x++, mybuf += step)
if (m_aabuf[(y + v) * m_dimx + x + u] == 1 && x != 0 && x != width - 1) {
r = GETRED(mybuf[1]) + GETRED(mybuf[-1]) + GETRED(mybuf[-bigBuf.Dimx()]) + GETRED(mybuf[bigBuf.Dimx()]);
g = GETGREEN(mybuf[1]) + GETGREEN(mybuf[-1]) + GETGREEN(mybuf[-bigBuf.Dimx()]) + GETGREEN(mybuf[bigBuf.Dimx()]);
@@ -1728,7 +1732,7 @@ void RMGfxSourceBuffer8AA::DrawAA(RMGfxTargetBuffer &bigBuf, RMGfxPrimitive *pri
r += GETRED(mybuf[0]) * 2;
g += GETGREEN(mybuf[0]) * 2;
b += GETBLUE(mybuf[0]) * 2;
-
+
r /= 6;
g /= 6;
b /= 6;
@@ -1737,11 +1741,11 @@ void RMGfxSourceBuffer8AA::DrawAA(RMGfxTargetBuffer &bigBuf, RMGfxPrimitive *pri
if (g > 31) g = 31;
if (b > 31) b = 31;
- mybuf[0]=(r<<10)|(g<<5)|b;
+ mybuf[0] = (r << 10) | (g << 5) | b;
}
-
+
// Skippa alla linea successiva
- buf += bigBuf.Dimx();
+ buf += bigBuf.Dimx();
}
}
@@ -1761,7 +1765,7 @@ void RMGfxSourceBuffer8AA::Draw(CORO_PARAM, RMGfxTargetBuffer &bigBuf, RMGfxPrim
/****************************************************************************\
-* Metodi di RMGfxSourceBuffer8RLEAA
+* Metodi di RMGfxSourceBuffer8RLEAA
\****************************************************************************/
RMGfxSourceBuffer8RLEByteAA::~RMGfxSourceBuffer8RLEByteAA() {
@@ -1782,7 +1786,7 @@ void RMGfxSourceBuffer8RLEByteAA::Draw(CORO_PARAM, RMGfxTargetBuffer &bigBuf, RM
CORO_INVOKE_2(RMGfxSourceBuffer8RLE::Draw, bigBuf, prim);
if (GLOBALS.bCfgAntiAlias)
- DrawAA(bigBuf,prim);
+ DrawAA(bigBuf, prim);
CORO_END_CODE;
}
@@ -1791,8 +1795,8 @@ int RMGfxSourceBuffer8RLEByteAA::Init(const byte *buf, int dimx, int dimy, bool
return RMGfxSourceBuffer8RLE::Init(buf, dimx, dimy, bLoadPalette);
}
-void RMGfxSourceBuffer8RLEByteAA::Init(RMDataStream& ds, int dimx, int dimy, bool bLoadPalette) {
- RMGfxSourceBuffer8RLE::Init(ds, dimx, dimy,bLoadPalette);
+void RMGfxSourceBuffer8RLEByteAA::Init(RMDataStream &ds, int dimx, int dimy, bool bLoadPalette) {
+ RMGfxSourceBuffer8RLE::Init(ds, dimx, dimy, bLoadPalette);
if (!bNeedRLECompress) {
// Carica la maschera di antialiasing
@@ -1820,17 +1824,17 @@ void RMGfxSourceBuffer8RLEWordAA::Draw(CORO_PARAM, RMGfxTargetBuffer &bigBuf, RM
CORO_INVOKE_2(RMGfxSourceBuffer8RLE::Draw, bigBuf, prim);
if (GLOBALS.bCfgAntiAlias)
- DrawAA(bigBuf,prim);
+ DrawAA(bigBuf, prim);
CORO_END_CODE;
}
int RMGfxSourceBuffer8RLEWordAA::Init(byte *buf, int dimx, int dimy, bool bLoadPalette) {
- return RMGfxSourceBuffer8RLE::Init(buf, dimx, dimy,bLoadPalette);
+ return RMGfxSourceBuffer8RLE::Init(buf, dimx, dimy, bLoadPalette);
}
-void RMGfxSourceBuffer8RLEWordAA::Init(RMDataStream& ds, int dimx, int dimy, bool bLoadPalette) {
- RMGfxSourceBuffer8RLE::Init(ds, dimx, dimy,bLoadPalette);
+void RMGfxSourceBuffer8RLEWordAA::Init(RMDataStream &ds, int dimx, int dimy, bool bLoadPalette) {
+ RMGfxSourceBuffer8RLE::Init(ds, dimx, dimy, bLoadPalette);
if (!bNeedRLECompress) {
// Carica la maschera di antialiasing
@@ -1841,11 +1845,11 @@ void RMGfxSourceBuffer8RLEWordAA::Init(RMDataStream& ds, int dimx, int dimy, boo
/****************************************************************************\
-* Metodi di RMGfxSourceBuffer16
+* Metodi di RMGfxSourceBuffer16
\****************************************************************************/
RMGfxSourceBuffer16::RMGfxSourceBuffer16(bool bTrasp0) {
- m_bTrasp0=bTrasp0;
+ m_bTrasp0 = bTrasp0;
}
RMGfxSourceBuffer16::~RMGfxSourceBuffer16() {
@@ -1854,10 +1858,10 @@ RMGfxSourceBuffer16::~RMGfxSourceBuffer16() {
void RMGfxSourceBuffer16::Draw(CORO_PARAM, RMGfxTargetBuffer &bigBuf, RMGfxPrimitive *prim) {
int x, y;
uint16 *buf = bigBuf;
- uint16 *raw = (uint16*)m_buf;
+ uint16 *raw = (uint16 *)m_buf;
int dimx, dimy;
- int u,v;
- int x1,y1;
+ int u, v;
+ int x1, y1;
dimx = m_dimx;
dimy = m_dimy;
@@ -1881,16 +1885,16 @@ void RMGfxSourceBuffer16::Draw(CORO_PARAM, RMGfxTargetBuffer &bigBuf, RMGfxPrimi
if (!Clip2D(x1, y1, u, v, dimx, dimy, true, &bigBuf))
return;
- raw += v * m_dimx+u;
+ raw += v * m_dimx + u;
buf += y1 * bigBuf.Dimx() + x1;
if (m_bTrasp0) {
for (y = 0; y < dimy; y++) {
for (x = 0; x < dimx;) {
- while (x<dimx && raw[x] == 0)
+ while (x < dimx && raw[x] == 0)
x++;
- while (x<dimx && raw[x] != 0) {
+ while (x < dimx && raw[x] != 0) {
buf[x] = raw[x];
x++;
}
@@ -1919,7 +1923,7 @@ void RMGfxSourceBuffer16::PrepareImage(void) {
RMGfxSourceBuffer16::RMGfxSourceBuffer16(int dimx, int dimy, bool bUseDDraw)
- : RMGfxBuffer(dimx,dimy,16,bUseDDraw) {
+ : RMGfxBuffer(dimx, dimy, 16, bUseDDraw) {
SetPriority(0);
}
@@ -1938,11 +1942,11 @@ int RMGfxSourceBuffer16::Bpp() {
}
void RMGfxSourceBuffer16::Create(int dimx, int dimy, bool bUseDDraw) {
- RMGfxBuffer::Create(dimx,dimy,16,bUseDDraw);
+ RMGfxBuffer::Create(dimx, dimy, 16, bUseDDraw);
}
/****************************************************************************\
-* Metodi di RMGfxBox
+* Metodi di RMGfxBox
\****************************************************************************/
void RMGfxBox::RemoveThis(CORO_PARAM, bool &result) {
@@ -1960,15 +1964,15 @@ void RMGfxBox::Draw(CORO_PARAM, RMGfxTargetBuffer &bigBuf, RMGfxPrimitive *prim)
int i, j;
uint16 *buf = bigBuf;
RMRect rcDst;
-
+
// Prende il rettangolo di destinazione
rcDst = prim->Dst();
- buf += rcDst.y1*bigBuf.Dimx() + rcDst.x1;
+ buf += rcDst.y1 * bigBuf.Dimx() + rcDst.x1;
// Fa il suo bravo loop di put
for (j = 0; j < rcDst.Height(); j++) {
for (i = 0; i < rcDst.Width(); i++)
- *buf ++= wFillColor;
+ *buf ++ = wFillColor;
buf += bigBuf.Dimx() - rcDst.Width();
}
diff --git a/engines/tony/gfxcore.h b/engines/tony/gfxcore.h
index dacb66d68c..3fa29e20f6 100644
--- a/engines/tony/gfxcore.h
+++ b/engines/tony/gfxcore.h
@@ -58,103 +58,157 @@ class RMGfxClearTask; // Task
*/
class RMGfxBuffer {
protected:
- int m_dimx, m_dimy;
- byte *m_buf;
+ int m_dimx, m_dimy;
+ byte *m_buf;
byte *m_origBuf;
- bool m_bUseDDraw;
+ bool m_bUseDDraw;
public:
- RMGfxBuffer();
- RMGfxBuffer(int dimx, int dimy, int nBpp, bool bUseDDraw = false);
- virtual ~RMGfxBuffer();
+ RMGfxBuffer();
+ RMGfxBuffer(int dimx, int dimy, int nBpp, bool bUseDDraw = false);
+ virtual ~RMGfxBuffer();
- // Attributes
- int Dimx() { return m_dimx; }
- int Dimy() { return m_dimy; }
+ // 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);
+ // 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);
+ // Buffer access
+ void Lock(void);
+ void Unlock(void);
- // These are valid only if the buffer is locked
- operator byte *();
- operator 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
+ * Graphics primitive
*/
class RMGfxPrimitive {
public:
- RMGfxTask *m_task;
+ RMGfxTask *m_task;
protected:
- RMRect m_src;
- RMRect m_dst;
+ RMRect m_src;
+ RMRect m_dst;
-bool m_bStretch;
+ bool m_bStretch;
byte m_bFlag;
public:
- RMGfxPrimitive() { m_bFlag = 0; m_task = NULL; m_src.SetEmpty(); m_dst.SetEmpty(); }
+ 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) {
+ m_task = task;
+ m_bFlag = 0;
+ }
RMGfxPrimitive(RMGfxTask *task, const RMRect &src, RMRect &dst) {
- m_task = task; m_src = src; m_dst = dst; m_bFlag = 0;
+ 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, const RMPoint &src, RMRect &dst) {
- m_task = task; m_src.TopLeft() = src; m_dst = dst; m_bFlag = 0;
- }
+ RMGfxPrimitive(RMGfxTask *task, const RMPoint &src, RMRect &dst) {
+ m_task = task;
+ m_src.TopLeft() = src;
+ m_dst = dst;
+ m_bFlag = 0;
+ }
- RMGfxPrimitive(RMGfxTask *task, const RMPoint &src, RMPoint &dst) {
- m_task = task; m_src.TopLeft() = src; m_dst.TopLeft() = dst; m_bFlag = 0;
- }
+ RMGfxPrimitive(RMGfxTask *task, const RMPoint &src, RMPoint &dst) {
+ m_task = task;
+ m_src.TopLeft() = src;
+ m_dst.TopLeft() = dst;
+ m_bFlag = 0;
+ }
- RMGfxPrimitive(RMGfxTask *task, const RMRect &src, RMPoint &dst) {
- m_task = task; m_src = src; m_dst.TopLeft() = dst; m_bFlag = 0;
- }
+ RMGfxPrimitive(RMGfxTask *task, const RMRect &src, RMPoint &dst) {
+ m_task = task;
+ m_src = src;
+ m_dst.TopLeft() = dst;
+ m_bFlag = 0;
+ }
- RMGfxPrimitive(RMGfxTask *task, const RMRect &dst) {
- m_task = task; m_dst = dst; m_src.SetEmpty(); m_bFlag = 0;
- }
+ RMGfxPrimitive(RMGfxTask *task, const RMRect &dst) {
+ m_task = task;
+ m_dst = dst;
+ m_src.SetEmpty();
+ m_bFlag = 0;
+ }
- RMGfxPrimitive(RMGfxTask *task, const RMPoint &dst) {
- m_task = task; m_dst.TopLeft() = dst; m_src.SetEmpty(); m_bFlag = 0;
- }
+ RMGfxPrimitive(RMGfxTask *task, const RMPoint &dst) {
+ m_task = task;
+ m_dst.TopLeft() = dst;
+ m_src.SetEmpty();
+ m_bFlag = 0;
+ }
virtual ~RMGfxPrimitive() { }
- void SetFlag(byte bFlag) { m_bFlag=bFlag; }
- void SetTask(RMGfxTask *task) { m_task = task; }
- void SetSrc(const RMRect &src) { m_src = src; }
- void SetSrc(const RMPoint &src) { m_src.TopLeft() = src; }
- void SetDst(const RMRect &dst) { m_dst = dst; }
- void SetDst(const RMPoint &dst) { m_dst.TopLeft() = dst; }
- void SetStrecth(bool bStretch) { m_bStretch = bStretch; }
+ void SetFlag(byte bFlag) {
+ m_bFlag = bFlag;
+ }
+ void SetTask(RMGfxTask *task) {
+ m_task = task;
+ }
+ void SetSrc(const RMRect &src) {
+ m_src = src;
+ }
+ void SetSrc(const RMPoint &src) {
+ m_src.TopLeft() = src;
+ }
+ void SetDst(const RMRect &dst) {
+ m_dst = dst;
+ }
+ void SetDst(const 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 HaveDst() {
+ return !m_dst.IsEmpty();
+ }
+ RMRect &Dst() {
+ return m_dst;
+ }
- bool HaveSrc() { return !m_src.IsEmpty(); }
- RMRect &Src() { return m_src; }
+ bool HaveSrc() {
+ return !m_src.IsEmpty();
+ }
+ RMRect &Src() {
+ return m_src;
+ }
// Flags
- bool IsFlipped() { return m_bFlag&1; }
+ bool IsFlipped() {
+ return m_bFlag & 1;
+ }
// Duplicate
- virtual RMGfxPrimitive* Duplicate() { return new RMGfxPrimitive(*this); }
+ virtual RMGfxPrimitive *Duplicate() {
+ return new RMGfxPrimitive(*this);
+ }
};
@@ -168,16 +222,21 @@ protected:
public:
// Costruttore standard
- RMGfxTask();
+ RMGfxTask();
virtual ~RMGfxTask() { }
virtual int Priority();
- virtual void Draw(CORO_PARAM, RMGfxTargetBuffer &bigBuf, RMGfxPrimitive *prim) = 0;
- virtual void RemoveThis(CORO_PARAM, bool &result);
-
+ virtual void Draw(CORO_PARAM, RMGfxTargetBuffer &bigBuf, RMGfxPrimitive *prim) = 0;
+ virtual void RemoveThis(CORO_PARAM, bool &result);
+
// Registration
- virtual void Register(void) { m_nInList++; }
- virtual void Unregister(void) { m_nInList--; assert(m_nInList >= 0); }
+ virtual void Register(void) {
+ m_nInList++;
+ }
+ virtual void Unregister(void) {
+ m_nInList--;
+ assert(m_nInList >= 0);
+ }
};
@@ -187,7 +246,7 @@ public:
class RMGfxTaskSetPrior : public RMGfxTask {
public:
virtual ~RMGfxTaskSetPrior() { }
- void SetPriority(int nPrior);
+ void SetPriority(int nPrior);
};
@@ -199,7 +258,7 @@ public:
virtual ~RMGfxClearTask() { }
int Priority();
- virtual void Draw(CORO_PARAM, RMGfxTargetBuffer &bigBuf, RMGfxPrimitive *prim);
+ virtual void Draw(CORO_PARAM, RMGfxTargetBuffer &bigBuf, RMGfxPrimitive *prim);
virtual void RemoveThis(CORO_PARAM, bool &result);
};
@@ -207,7 +266,7 @@ public:
/**
* Task that draws a coloured box
*/
-class RMGfxBox : public RMGfxTaskSetPrior {
+class RMGfxBox : public RMGfxTaskSetPrior {
protected:
uint16 wFillColor;
@@ -225,20 +284,22 @@ public:
*/
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(const byte *buf, int dimx, int dimy, bool bLoadPalette = false);
+ // Carica i dati della surface a basso livello
+ virtual int Init(uint32 resID, 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 ~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()); }
+ void OffsetY(int nLines) {
+ RMGfxBuffer::OffsetY(nLines, Bpp());
+ }
public:
- virtual int Bpp() = 0;
+ virtual int Bpp() = 0;
};
@@ -249,17 +310,17 @@ 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);
+ 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(CORO_PARAM, RMGfxTargetBuffer &bigBuf, RMGfxPrimitive *prim);
+ int Bpp();
+ virtual void Draw(CORO_PARAM, RMGfxTargetBuffer &bigBuf, RMGfxPrimitive *prim);
};
@@ -279,8 +340,8 @@ public:
virtual ~RMGfxSourceBufferPal();
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);
+
int LoadPaletteWA(uint32 resID, bool bSwapped = false);
int LoadPaletteWA(const byte *buf, bool bSwapped = false);
int LoadPalette(uint32 resID);
@@ -294,7 +355,7 @@ public:
class RMGfxSourceBuffer8 : public RMGfxSourceBufferPal {
protected:
bool m_bTrasp0;
-
+
public:
RMGfxSourceBuffer8(bool bTrasp0 = true);
RMGfxSourceBuffer8(int dimx, int dimy, bool bUseDDraw = false);
@@ -304,7 +365,7 @@ public:
void Create(int dimx, int dimy, bool bUseDDraw = false);
int Bpp();
- virtual void Draw(CORO_PARAM, RMGfxTargetBuffer& bigBuf, RMGfxPrimitive *prim);
+ virtual void Draw(CORO_PARAM, RMGfxTargetBuffer &bigBuf, RMGfxPrimitive *prim);
};
@@ -333,7 +394,7 @@ protected:
protected:
static byte MegaRLEBuf[];
-
+
virtual void RLEWriteTrasp(byte *&cur, int rep) = 0;
virtual void RLEWriteData(byte *&cur, int rep, byte *src) = 0;
virtual void RLEWriteEOL(byte *&cur) = 0;
@@ -343,18 +404,18 @@ protected:
// Perform image compression in RLE
void CompressRLE(void);
-
+
protected:
// Overriding initialization methods
virtual void PrepareImage(void);
- virtual void PreparePalette(void);
+ virtual void PreparePalette(void);
public:
RMGfxSourceBuffer8RLE();
virtual ~RMGfxSourceBuffer8RLE();
// Overload of the initialization method
- 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 int Init(const byte *buf, int dimx, int dimy, bool bLoadPalette = false);
// Draw image with RLE decompression
@@ -438,7 +499,7 @@ public:
// Overloaded initialisation methods
virtual void Init(RMDataStream &ds, int dimx, int dimy, bool bLoadPalette = false);
- virtual int Init(const byte *buf, int dimx, int dimy, bool bLoadPalette = false);
+ virtual int Init(const byte *buf, int dimx, int dimy, bool bLoadPalette = false);
virtual ~RMGfxSourceBuffer8RLEByteAA();
};
@@ -451,8 +512,8 @@ public:
virtual void Draw(CORO_PARAM, RMGfxTargetBuffer &bigBuf, RMGfxPrimitive *prim);
// Overloaded initialisation method
- virtual void Init(RMDataStream& ds, 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 int Init(byte *buf, int dimx, int dimy, bool bLoadPalette = false);
virtual ~RMGfxSourceBuffer8RLEWordAA();
};
@@ -463,14 +524,14 @@ public:
*/
class RMGfxSourceBuffer4 : public RMGfxSourceBufferPal {
public:
- RMGfxSourceBuffer4();
- RMGfxSourceBuffer4(int dimx, int dimy, bool bUseDDraw = false);
+ RMGfxSourceBuffer4();
+ RMGfxSourceBuffer4(int dimx, int dimy, bool bUseDDraw = false);
// Initialisation
void Create(int dimx, int dimy, bool bUseDDraw = false);
- int Bpp();
- virtual void Draw(CORO_PARAM, RMGfxTargetBuffer &bigBuf, RMGfxPrimitive *prim);
+ int Bpp();
+ virtual void Draw(CORO_PARAM, RMGfxTargetBuffer &bigBuf, RMGfxPrimitive *prim);
};
@@ -479,14 +540,16 @@ public:
*/
class RMGfxTargetBuffer : public virtual RMGfxBuffer {
private:
-static RMGfxClearTask taskClear;
+ static RMGfxClearTask taskClear;
struct OTList {
- RMGfxPrimitive* prim;
- OTList* next;
+ RMGfxPrimitive *prim;
+ OTList *next;
OTList();
- OTList(RMGfxPrimitive* pr) { prim=pr; }
+ OTList(RMGfxPrimitive *pr) {
+ prim = pr;
+ }
};
private:
@@ -508,15 +571,21 @@ public:
// Adds a task to clear the screen
void AddClearTask(void);
- operator byte *() { return m_buf; }
- operator void *() { return (void *)m_buf; }
- operator uint16 *() {
+ operator byte *() {
+ return m_buf;
+ }
+ operator void *() {
+ return (void *)m_buf;
+ }
+ operator uint16 *() {
// FIXME: This may not be endian safe
- return (uint16 *)m_buf;
+ return (uint16 *)m_buf;
}
// Offseting buffer
- void OffsetY(int nLines) { RMGfxBuffer::OffsetY(nLines, 16); }
+ void OffsetY(int nLines) {
+ RMGfxBuffer::OffsetY(nLines, 16);
+ }
};
@@ -525,11 +594,11 @@ public:
*/
class RMGfxWoodyBuffer: public RMGfxSourceBuffer16, public RMGfxTargetBuffer {
public:
- RMGfxWoodyBuffer();
- RMGfxWoodyBuffer(int dimx, int dimy, bool bUseDDraw = false);
+ RMGfxWoodyBuffer();
+ RMGfxWoodyBuffer(int dimx, int dimy, bool bUseDDraw = false);
virtual ~RMGfxWoodyBuffer();
- virtual void Draw(CORO_PARAM, RMGfxTargetBuffer &bigBuf, RMGfxPrimitive *prim);
+ virtual void Draw(CORO_PARAM, RMGfxTargetBuffer &bigBuf, RMGfxPrimitive *prim);
};
} // End of namespace Tony
diff --git a/engines/tony/gfxengine.cpp b/engines/tony/gfxengine.cpp
index a2b58f660e..384e80f209 100644
--- a/engines/tony/gfxengine.cpp
+++ b/engines/tony/gfxengine.cpp
@@ -68,9 +68,9 @@ RMGfxEngine::RMGfxEngine() {
m_nCurLoc = 0;
m_curAction = TA_GOTO;
m_curActionObj = 0;
- m_nWipeType = 0;
+ m_nWipeType = 0;
m_hWipeEvent = 0;
- m_nWipeStep = 0;
+ m_nWipeStep = 0;
m_bMustEnterMenu = false;
m_bWiping = false;
m_bGUIOption = false;
@@ -90,7 +90,7 @@ RMGfxEngine::~RMGfxEngine() {
void RMGfxEngine::OpenOptionScreen(CORO_PARAM, int type) {
CORO_BEGIN_CONTEXT;
- bool bRes;
+ bool bRes;
CORO_END_CONTEXT(_ctx);
CORO_BEGIN_CODE(_ctx);
@@ -120,9 +120,9 @@ void RMGfxEngine::OpenOptionScreen(CORO_PARAM, int type) {
m_point.SetCustomPointer(NULL);
EnableMouse();
_vm->GrabThumbnail();
-
+
// Esce la IDLE onde evitare la morte prematura in caricamento
- m_bMustEnterMenu = true;
+ m_bMustEnterMenu = true;
if (type == 1 || type == 2) {
GLOBALS.bIdleExited = true;
} else {
@@ -144,7 +144,7 @@ void RMGfxEngine::DoFrame(CORO_PARAM, bool bDrawLocation) {
CORO_BEGIN_CODE(_ctx);
g_system->lockMutex(csMainLoop);
-
+
// Poll dei dispositivi di input
m_input.Poll();
@@ -153,8 +153,8 @@ void RMGfxEngine::DoFrame(CORO_PARAM, bool bDrawLocation) {
m_bMustEnterMenu = false;
GLOBALS.bIdleExited = false;
}
-
- if (m_bOption) {
+
+ if (m_bOption) {
CORO_INVOKE_1(m_opt.DoFrame, &m_input);
m_bOption = !m_opt.IsClosing();
if (!m_bOption) {
@@ -177,33 +177,32 @@ void RMGfxEngine::DoFrame(CORO_PARAM, bool bDrawLocation) {
// **************
if (m_input.MouseLeftClicked()/* && m_itemName.IsItemSelected()*/) {
// Left click attiva il combine, se siamo su un oggetto
- if (m_inv.LeftClick(m_input.MousePos(),m_curActionObj)) {
+ if (m_inv.LeftClick(m_input.MousePos(), m_curActionObj)) {
m_curAction = TA_COMBINE;
m_point.SetAction(m_curAction);
}
- }
- else
+ } else
- // CLICK DESTRO
- // ************
- if (m_input.MouseRightClicked()) {
- if(m_itemName.IsItemSelected()) {
- m_curActionObj=0;
- m_inv.RightClick(m_input.MousePos());
+ // CLICK DESTRO
+ // ************
+ if (m_input.MouseRightClicked()) {
+ if (m_itemName.IsItemSelected()) {
+ m_curActionObj = 0;
+ m_inv.RightClick(m_input.MousePos());
+ } else
+ m_inv.RightClick(m_input.MousePos());
} else
- m_inv.RightClick(m_input.MousePos());
- } else
- // RILASCIO DESTRO
- // ***************
- if (m_input.MouseRightReleased()) {
- if (m_inv.RightRelease(m_input.MousePos(), m_curAction)) {
- CORO_INVOKE_3(m_tony.MoveAndDoAction, m_itemName.GetHotspot(), m_itemName.GetSelectedItem(), m_curAction);
+ // RILASCIO DESTRO
+ // ***************
+ if (m_input.MouseRightReleased()) {
+ if (m_inv.RightRelease(m_input.MousePos(), m_curAction)) {
+ CORO_INVOKE_3(m_tony.MoveAndDoAction, m_itemName.GetHotspot(), m_itemName.GetSelectedItem(), m_curAction);
- m_curAction = TA_GOTO;
- m_point.SetAction(m_curAction);
- }
- }
+ m_curAction = TA_GOTO;
+ m_point.SetAction(m_curAction);
+ }
+ }
} else {
// Menu Opzioni
// ************
@@ -236,7 +235,7 @@ void RMGfxEngine::DoFrame(CORO_PARAM, bool bDrawLocation) {
else if (m_itemName.GetSelectedItem() != NULL)
CORO_INVOKE_4(m_tony.MoveAndDoAction, m_itemName.GetHotspot(), m_itemName.GetSelectedItem(), TA_COMBINE, m_curActionObj);
}
-
+
if (m_curAction == TA_COMBINE) {
m_inv.EndCombine();
m_point.SetSpecialPointer(RMPointer::PTR_NONE);
@@ -267,13 +266,13 @@ SKIPCLICKSINISTRO:
m_inter.Clicked(m_input.MousePos());
}
}
-
+
// RILASCIO DESTRO
// ***************
if (m_input.MouseRightReleased()) {
if (m_bGUIInterface) {
- if (m_inter.Released(m_input.MousePos(),m_curAction)) {
+ if (m_inter.Released(m_input.MousePos(), m_curAction)) {
m_point.SetAction(m_curAction);
CORO_INVOKE_3(m_tony.MoveAndDoAction, m_itemName.GetHotspot(), m_itemName.GetSelectedItem(), m_curAction);
@@ -287,7 +286,7 @@ SKIPCLICKSINISTRO:
// Aggiorna il nome sotto il puntatore del mouse
m_itemName.SetMouseCoord(m_input.MousePos());
if (!m_inter.Active() && !m_inv.MiniActive())
- CORO_INVOKE_4(m_itemName.DoFrame, m_bigBuf, m_loc, m_point, m_inv);
+ CORO_INVOKE_4(m_itemName.DoFrame, m_bigBuf, m_loc, m_point, m_inv);
}
// Inventario & interfaccia
@@ -297,7 +296,7 @@ SKIPCLICKSINISTRO:
// Anima Tony
CORO_INVOKE_2(m_tony.DoFrame, &m_bigBuf, m_nCurLoc);
-
+
// Aggiorna lo scrolling per tenere Tony dentro lo schermo
if (m_tony.MustUpdateScrolling() && m_bLocationLoaded) {
RMPoint showThis = m_tony.Position();
@@ -323,31 +322,31 @@ SKIPCLICKSINISTRO:
// Wipe
if (m_bWiping) {
switch (m_nWipeType) {
- case 1:
- if (!(m_rcWipeEllipse.bottom - m_rcWipeEllipse.top >= FSTEP * 2)) {
- CoroScheduler.setEvent(m_hWipeEvent);
- m_nWipeType = 3;
- break;
- }
-
- m_rcWipeEllipse.top += FSTEP;
- m_rcWipeEllipse.left += FSTEP;
- m_rcWipeEllipse.right -= FSTEP;
- m_rcWipeEllipse.bottom -= FSTEP;
+ case 1:
+ if (!(m_rcWipeEllipse.bottom - m_rcWipeEllipse.top >= FSTEP * 2)) {
+ CoroScheduler.setEvent(m_hWipeEvent);
+ m_nWipeType = 3;
break;
+ }
- case 2:
- if (!(m_rcWipeEllipse.bottom - m_rcWipeEllipse.top < 480 - FSTEP)) {
- CoroScheduler.setEvent(m_hWipeEvent);
- m_nWipeType = 3;
- break;
- }
+ m_rcWipeEllipse.top += FSTEP;
+ m_rcWipeEllipse.left += FSTEP;
+ m_rcWipeEllipse.right -= FSTEP;
+ m_rcWipeEllipse.bottom -= FSTEP;
+ break;
- m_rcWipeEllipse.top -= FSTEP;
- m_rcWipeEllipse.left -= FSTEP;
- m_rcWipeEllipse.right += FSTEP;
- m_rcWipeEllipse.bottom += FSTEP;
+ case 2:
+ if (!(m_rcWipeEllipse.bottom - m_rcWipeEllipse.top < 480 - FSTEP)) {
+ CoroScheduler.setEvent(m_hWipeEvent);
+ m_nWipeType = 3;
break;
+ }
+
+ m_rcWipeEllipse.top -= FSTEP;
+ m_rcWipeEllipse.left -= FSTEP;
+ m_rcWipeEllipse.right += FSTEP;
+ m_rcWipeEllipse.bottom += FSTEP;
+ break;
}
}
@@ -371,7 +370,7 @@ void RMGfxEngine::ItemIrq(uint32 dwItem, int nPattern, int nStatus) {
if (nPattern != -1) {
if (GLOBALS.bPatIrqFreeze)
MainFreeze();
- item->SetPattern(nPattern,true);
+ item->SetPattern(nPattern, true);
if (GLOBALS.bPatIrqFreeze)
MainUnfreeze();
}
@@ -382,41 +381,41 @@ void RMGfxEngine::ItemIrq(uint32 dwItem, int nPattern, int nStatus) {
}
/*
- // WINBUG: This is a special case for the file open/save dialog,
- // which sometimes pumps while it is coming up but before it has
- // disabled the main window.
- HWND hWndFocus = ::GetFocus();
- bool bEnableParent = false;
- m_ofn.hwndOwner = PreModal();
- AfxUnhookWindowCreate();
- if (m_ofn.hwndOwner != NULL && ::IsWindowEnabled(m_ofn.hwndOwner)) {
- bEnableParent = true;
- ::EnableWindow(m_ofn.hwndOwner, false);
- }
-
- _AFX_THREAD_STATE* pThreadState = AfxGetThreadState();
- ASSERT(pThreadState->m_pAlternateWndInit == NULL);
-
- if (m_ofn.Flags & OFN_EXPLORER)
- pThreadState->m_pAlternateWndInit = this;
- else
- AfxHookWindowCreate(this);
-
- int nResult;
- if (m_bOpenFileDialog)
- nResult = ::GetOpenFileName(&m_ofn);
- else
- nResult = ::GetSaveFileName(&m_ofn);
-
- if (nResult)
- ASSERT(pThreadState->m_pAlternateWndInit == NULL);
- pThreadState->m_pAlternateWndInit = NULL;
-
- // WINBUG: Second part of special case for file open/save dialog.
- if (bEnableParent)
- ::EnableWindow(m_ofn.hwndOwner, true);
- if (::IsWindow(hWndFocus))
- ::SetFocus(hWndFocus);
+ // WINBUG: This is a special case for the file open/save dialog,
+ // which sometimes pumps while it is coming up but before it has
+ // disabled the main window.
+ HWND hWndFocus = ::GetFocus();
+ bool bEnableParent = false;
+ m_ofn.hwndOwner = PreModal();
+ AfxUnhookWindowCreate();
+ if (m_ofn.hwndOwner != NULL && ::IsWindowEnabled(m_ofn.hwndOwner)) {
+ bEnableParent = true;
+ ::EnableWindow(m_ofn.hwndOwner, false);
+ }
+
+ _AFX_THREAD_STATE* pThreadState = AfxGetThreadState();
+ ASSERT(pThreadState->m_pAlternateWndInit == NULL);
+
+ if (m_ofn.Flags & OFN_EXPLORER)
+ pThreadState->m_pAlternateWndInit = this;
+ else
+ AfxHookWindowCreate(this);
+
+ int nResult;
+ if (m_bOpenFileDialog)
+ nResult = ::GetOpenFileName(&m_ofn);
+ else
+ nResult = ::GetSaveFileName(&m_ofn);
+
+ if (nResult)
+ ASSERT(pThreadState->m_pAlternateWndInit == NULL);
+ pThreadState->m_pAlternateWndInit = NULL;
+
+ // WINBUG: Second part of special case for file open/save dialog.
+ if (bEnableParent)
+ ::EnableWindow(m_ofn.hwndOwner, true);
+ if (::IsWindow(hWndFocus))
+ ::SetFocus(hWndFocus);
*/
@@ -427,46 +426,46 @@ void RMGfxEngine::SelectLocation(const RMPoint &ptTonyStart, const RMPoint &star
// @@@ Con TonyStart=-1,-1 allora usa la posizione scritta nella locazione
- // Sceglie la locazione
- ZeroMemory(lpszFileName,512);
- ZeroMemory(&ofn,sizeof(ofn));
- ofn.lStructSize=sizeof(ofn);
- ofn.hwndOwner=NULL;
- ofn.lpstrFilter="Locazione (*.LOC)\0*.LOC\0Locazione ottimizzata (*.LOX)\0*.LOX\0Tutti i files (*.*)\0*.*\0";
- ofn.lpstrCustomFilter=NULL;
- ofn.nFilterIndex=1;
- ofn.lpstrFile=lpszFileName;
- ofn.nMaxFile=512;
- ofn.lpstrInitialDir=NULL;
- ofn.lpstrTitle="Load Location";
- ofn.Flags=OFN_FILEMUSTEXIST|OFN_HIDEREADONLY|OFN_PATHMUSTEXIST;
-
- if (!GetOpenFileName(&ofn))
+ // Sceglie la locazione
+ ZeroMemory(lpszFileName, 512);
+ ZeroMemory(&ofn, sizeof(ofn));
+ ofn.lStructSize = sizeof(ofn);
+ ofn.hwndOwner = NULL;
+ ofn.lpstrFilter = "Locazione (*.LOC)\0*.LOC\0Locazione ottimizzata (*.LOX)\0*.LOX\0Tutti i files (*.*)\0*.*\0";
+ ofn.lpstrCustomFilter = NULL;
+ ofn.nFilterIndex = 1;
+ ofn.lpstrFile = lpszFileName;
+ ofn.nMaxFile = 512;
+ ofn.lpstrInitialDir = NULL;
+ ofn.lpstrTitle = "Load Location";
+ ofn.Flags = OFN_FILEMUSTEXIST | OFN_HIDEREADONLY | OFN_PATHMUSTEXIST;
+
+ if (!GetOpenFileName(&ofn))
ASSERT(0);
// Carica la locazione
m_loc.Load(lpszFileName);
m_bLocationLoaded = true;
- m_nCurLoc=m_loc.TEMPGetNumLoc();
-
- if (ptTonyStart.x==-1 && ptTonyStart.y==-1)
- InitForNewLocation(m_loc.TEMPGetNumLoc(),m_loc.TEMPGetTonyStart(),RMPoint(-1,-1));
+ m_nCurLoc = m_loc.TEMPGetNumLoc();
+
+ if (ptTonyStart.x == -1 && ptTonyStart.y == -1)
+ InitForNewLocation(m_loc.TEMPGetNumLoc(), m_loc.TEMPGetTonyStart(), RMPoint(-1, -1));
else
- InitForNewLocation(m_loc.TEMPGetNumLoc(),ptTonyStart,start);
+ InitForNewLocation(m_loc.TEMPGetNumLoc(), ptTonyStart, start);
#endif
}
void RMGfxEngine::InitForNewLocation(int nLoc, RMPoint ptTonyStart, RMPoint start) {
if (start.x == -1 || start.y == -1) {
- start.x = ptTonyStart.x-RM_SX / 2;
- start.y = ptTonyStart.y-RM_SY / 2;
+ start.x = ptTonyStart.x - RM_SX / 2;
+ start.y = ptTonyStart.y - RM_SY / 2;
}
m_loc.SetScrollPosition(start);
-
- if (ptTonyStart.x==0 && ptTonyStart.y == 0) {
+
+ if (ptTonyStart.x == 0 && ptTonyStart.y == 0) {
} else {
- m_tony.SetPosition(ptTonyStart,nLoc);
+ m_tony.SetPosition(ptTonyStart, nLoc);
m_tony.SetScrollPosition(start);
}
@@ -484,10 +483,10 @@ uint32 RMGfxEngine::LoadLocation(int nLoc, RMPoint ptTonyStart, RMPoint start) {
bool bLoaded;
int i;
- m_nCurLoc=nLoc;
+ m_nCurLoc = nLoc;
bLoaded = false;
- for (i=0; i < 5; i++) {
+ for (i = 0; i < 5; i++) {
// Retry sul loading della locazione
RMRes res(m_nCurLoc);
if (!res.IsValid())
@@ -501,13 +500,13 @@ uint32 RMGfxEngine::LoadLocation(int nLoc, RMPoint ptTonyStart, RMPoint start) {
}
#endif
m_loc.Load(res);
- InitForNewLocation(nLoc,ptTonyStart,start);
+ InitForNewLocation(nLoc, ptTonyStart, start);
bLoaded = true;
break;
}
-
+
if (!bLoaded)
- SelectLocation(ptTonyStart,start);
+ SelectLocation(ptTonyStart, start);
if (m_bOption)
m_opt.ReInit(m_bigBuf);
@@ -520,11 +519,11 @@ uint32 RMGfxEngine::LoadLocation(int nLoc, RMPoint ptTonyStart, RMPoint start) {
void RMGfxEngine::UnloadLocation(CORO_PARAM, bool bDoOnExit, uint32 *result) {
CORO_BEGIN_CONTEXT;
- uint32 h;
+ uint32 h;
CORO_END_CONTEXT(_ctx);
CORO_BEGIN_CODE(_ctx);
-
+
// Scarica tutta la memoria della locazione
CORO_INVOKE_2(mpalEndIdlePoll, m_nCurLoc, NULL);
@@ -538,7 +537,7 @@ void RMGfxEngine::UnloadLocation(CORO_PARAM, bool bDoOnExit, uint32 *result) {
MainFreeze();
m_bLocationLoaded = false;
-
+
m_bigBuf.ClearOT();
m_loc.Unload();
@@ -549,19 +548,19 @@ void RMGfxEngine::UnloadLocation(CORO_PARAM, bool bDoOnExit, uint32 *result) {
}
void RMGfxEngine::Init(/*HINSTANCE hInst*/) {
-/*
- //RECUPERARE UNA LOCAZIONE:
-
- RMRes res(5);
- ASSERT(res.IsValid());
- FILE *f;
- f=fopen("c:\\code\\rm\\new\\pippo.loc","wb");
- fwrite(res,1,5356900,f);
- fclose(f);
-*/
+ /*
+ //RECUPERARE UNA LOCAZIONE:
+
+ RMRes res(5);
+ ASSERT(res.IsValid());
+ FILE *f;
+ f=fopen("c:\\code\\rm\\new\\pippo.loc","wb");
+ fwrite(res,1,5356900,f);
+ fclose(f);
+ */
// Schermata di loading
- RMResRaw *raw;
+ RMResRaw *raw;
RMGfxSourceBuffer16 *load = NULL;
INIT_GFX16_FROMRAW(20038, load);
m_bigBuf.AddPrim(new RMGfxPrimitive(load));
@@ -592,8 +591,8 @@ void RMGfxEngine::Init(/*HINSTANCE hInst*/) {
// Inizializza la funzione di IRQ di Item per l'MPAL
GLOBALS.GfxEngine = this;
mpalInstallItemIrq(ItemIrq);
-
- // Inizializza DirectInput
+
+ // Inizializza DirectInput
m_input.Init(/*hInst*/);
// Inizializza il puntatore del mouse
@@ -607,25 +606,25 @@ void RMGfxEngine::Init(/*HINSTANCE hInst*/) {
m_inv.Init();
m_inter.Init();
- // Carica la locazione e setta le priorità @@@@@
+ // Carica la locazione e setta le priorità @@@@@
m_bLocationLoaded = false;
-/*
- m_nCurLoc=1;
- RMRes res(m_nCurLoc);
- m_loc.Load(res);
- m_loc.SetPriority(1);
- m_tony.SetPosition(RMPoint(201,316),1);
- //m_tony.SetPosition(RMPoint(522,305),2);
- //m_tony.SetPosition(RMPoint(158,398),4);
- m_tony.SetPattern(m_tony.PAT_STANDDOWN);
- m_curAction=TA_GOTO;
-*/
+ /*
+ m_nCurLoc=1;
+ RMRes res(m_nCurLoc);
+ m_loc.Load(res);
+ m_loc.SetPriority(1);
+ m_tony.SetPosition(RMPoint(201,316),1);
+ //m_tony.SetPosition(RMPoint(522,305),2);
+ //m_tony.SetPosition(RMPoint(158,398),4);
+ m_tony.SetPattern(m_tony.PAT_STANDDOWN);
+ m_curAction=TA_GOTO;
+ */
EnableInput();
// Inizio del gioco
//m_tony.ExecuteAction(4,1,0); //PREGAME
-
- m_tony.ExecuteAction(20,1,0);
+
+ m_tony.ExecuteAction(20, 1, 0);
// theLog << "Seleziona la locazione\n";
//LoadLocation(1,RMPoint(201,316),RMPoint(-1,-1));
@@ -639,9 +638,9 @@ void RMGfxEngine::Init(/*HINSTANCE hInst*/) {
//LoadLocation(25,RMPoint(221,415),RMPoint(-1,-1));
//LoadLocation(16,RMPoint(111,438),RMPoint(-1,-1));
//LoadLocation(60,RMPoint(18,302),RMPoint(-1,-1));
-
+
// CASTELLO
-
+
//LoadLocation(40,RMPoint(233,441),RMPoint(-1,-1));
}
@@ -716,14 +715,14 @@ void RMGfxEngine::SaveState(const char *fn, byte *curThumb, const char *name, bo
mpalSaveState(state);
thumbsize = 160 * 120 * 2;
-
+
buf[0] = 'R';
buf[1] = 'M';
buf[2] = 'S';
buf[3] = TONY_SAVEGAME_VERSION;
f = g_system->getSavefileManager()->openForSaving(fn);
- if (f == NULL)
+ if (f == NULL)
return;
f->write(buf, 4);
@@ -763,13 +762,13 @@ void RMGfxEngine::SaveState(const char *fn, byte *curThumb, const char *name, bo
// New Ver5
bool bStat;
-
+
// Saves the state of the shepherdess and show yourself
bStat = m_tony.GetPastorella();
f->writeByte(bStat);
bStat = m_inter.GetPalesati();
f->writeByte(bStat);
-
+
// Save the chars
CharsSaveAll(f);
@@ -805,20 +804,20 @@ void RMGfxEngine::SaveState(const char *fn, byte *curThumb, const char *name, bo
void RMGfxEngine::LoadState(CORO_PARAM, const char *fn) {
// PROBLEMA: Bisognerebbe caricare la locazione in un thread a parte per fare la OnEnter ...
CORO_BEGIN_CONTEXT;
- Common::InSaveFile *f;
- byte *state, *statecmp;
- uint size, sizecmp;
- char buf[4];
- RMPoint tp;
- int loc;
- int ver;
- int i;
+ Common::InSaveFile *f;
+ byte *state, *statecmp;
+ uint size, sizecmp;
+ char buf[4];
+ RMPoint tp;
+ int loc;
+ int ver;
+ int i;
CORO_END_CONTEXT(_ctx);
CORO_BEGIN_CODE(_ctx);
_ctx->f = g_system->getSavefileManager()->openForLoading(fn);
- if (_ctx->f == NULL)
+ if (_ctx->f == NULL)
return;
_ctx->f->read(_ctx->buf, 4);
@@ -826,14 +825,14 @@ void RMGfxEngine::LoadState(CORO_PARAM, const char *fn) {
delete _ctx->f;
return;
}
-
+
_ctx->ver = _ctx->buf[3];
-
+
if (_ctx->ver == 0 || _ctx->ver > TONY_SAVEGAME_VERSION) {
delete _ctx->f;
return;
}
-
+
if (_ctx->ver >= 0x3) {
// There is a thumbnail. If the version is between 5 and 7, it's compressed
if ((_ctx->ver >= 0x5) && (_ctx->ver <= 0x7)) {
@@ -854,7 +853,7 @@ void RMGfxEngine::LoadState(CORO_PARAM, const char *fn) {
_ctx->f->seek(1, SEEK_CUR);
}
- if (_ctx->ver >= 0x4) { // Skip the savegame name, which serves no purpose
+ if (_ctx->ver >= 0x4) { // Skip the savegame name, which serves no purpose
_ctx->i = _ctx->f->readByte();
_ctx->f->seek(_ctx->i, SEEK_CUR);
}
@@ -870,7 +869,7 @@ void RMGfxEngine::LoadState(CORO_PARAM, const char *fn) {
_ctx->state = new byte[_ctx->size];
_ctx->statecmp = new byte[_ctx->sizecmp];
_ctx->f->read(_ctx->statecmp, _ctx->sizecmp);
- lzo1x_decompress(_ctx->statecmp,_ctx->sizecmp,_ctx->state,&_ctx->size);
+ lzo1x_decompress(_ctx->statecmp, _ctx->sizecmp, _ctx->state, &_ctx->size);
delete[] _ctx->statecmp;
} else {
// Read uncompressed MPAL data
@@ -888,7 +887,7 @@ void RMGfxEngine::LoadState(CORO_PARAM, const char *fn) {
m_inv.LoadState(_ctx->state);
delete[] _ctx->state;
- if (_ctx->ver >= 0x2) { // Versione 2: box please
+ if (_ctx->ver >= 0x2) { // Versione 2: box please
_ctx->size = _ctx->f->readUint32LE();
_ctx->state = new byte[_ctx->size];
_ctx->f->read(_ctx->state, _ctx->size);
@@ -897,13 +896,13 @@ void RMGfxEngine::LoadState(CORO_PARAM, const char *fn) {
}
if (_ctx->ver >= 5) {
- // Versione 5:
+ // Versione 5:
bool bStat = false;
-
+
bStat = _ctx->f->readByte();
- m_tony.SetPastorella(bStat);
+ m_tony.SetPastorella(bStat);
bStat = _ctx->f->readByte();
- m_inter.SetPalesati(bStat);
+ m_inter.SetPalesati(bStat);
CharsLoadAll(_ctx->f);
}
@@ -939,10 +938,10 @@ void RMGfxEngine::LoadState(CORO_PARAM, const char *fn) {
delete _ctx->f;
CORO_INVOKE_2(UnloadLocation, false, NULL);
- LoadLocation(_ctx->loc,_ctx->tp,RMPoint(-1, -1));
+ LoadLocation(_ctx->loc, _ctx->tp, RMPoint(-1, -1));
m_tony.SetPattern(RMTony::PAT_STANDRIGHT);
MainUnfreeze();
-
+
// On older versions, need to an enter action
if (_ctx->ver < 5)
mpalQueryDoAction(0, _ctx->loc, 0);
@@ -970,8 +969,8 @@ void RMGfxEngine::PauseSound(bool bPause) {
void RMGfxEngine::InitWipe(int type) {
m_bWiping = true;
- m_nWipeType=type;
- m_nWipeStep=0;
+ m_nWipeType = type;
+ m_nWipeStep = 0;
if (m_nWipeType == 1)
m_rcWipeEllipse = Common::Rect(80, 0, 640 - 80, 480);
diff --git a/engines/tony/gfxengine.h b/engines/tony/gfxengine.h
index 2aae0b6ea6..24deb47ec4 100644
--- a/engines/tony/gfxengine.h
+++ b/engines/tony/gfxengine.h
@@ -44,7 +44,7 @@ namespace Tony {
class RMGfxEngine {
private:
- RMGfxTargetBuffer m_bigBuf;
+ RMGfxTargetBuffer m_bigBuf;
RMInput m_input;
RMPointer m_point;
RMLocation m_loc;
@@ -62,7 +62,7 @@ private:
int m_nCurLoc;
RMTonyAction m_curAction;
- int m_curActionObj;
+ int m_curActionObj;
OSystem::MutexRef csMainLoop;
int m_nWipeType;
@@ -80,8 +80,8 @@ public:
bool m_bGUIInterface;
bool m_bGUIInventory;
public:
- RMGfxEngine();
- virtual ~RMGfxEngine();
+ RMGfxEngine();
+ virtual ~RMGfxEngine();
// Draw the next frame
void DoFrame(CORO_PARAM, bool bDrawLocation);
@@ -109,14 +109,20 @@ public:
void EnableMouse(void);
void DisableMouse(void);
- operator byte *() { return (byte *)m_bigBuf; }
- RMInput &GetInput() { return m_input; }
+ operator byte *() {
+ return (byte *)m_bigBuf;
+ }
+ RMInput &GetInput() {
+ return m_input;
+ }
// Link to the custom function list
void InitCustomDll(void);
// Link to graphic task
- void LinkGraphicTask(RMGfxTask *task) { m_bigBuf.AddPrim(new RMGfxPrimitive(task)); };
+ void LinkGraphicTask(RMGfxTask *task) {
+ m_bigBuf.AddPrim(new RMGfxPrimitive(task));
+ };
// Manage a location
uint32 LoadLocation(int nLoc, RMPoint ptTonyStart, RMPoint start);
@@ -131,7 +137,7 @@ public:
void LoadState(CORO_PARAM, const char *fn);
// Selects a location
- void SelectLocation(const RMPoint &ptTonyStart = RMPoint(-1, -1), const RMPoint &start = RMPoint(-1,-1));
+ void SelectLocation(const RMPoint &ptTonyStart = RMPoint(-1, -1), const RMPoint &start = RMPoint(-1, -1));
// Pauses sound
void PauseSound(bool bPause);
@@ -141,7 +147,9 @@ public:
void CloseWipe(void);
void WaitWipeEnd(CORO_PARAM);
- void SetPalesati(bool bpal) { m_inter.SetPalesati(bpal); }
+ void SetPalesati(bool bpal) {
+ m_inter.SetPalesati(bpal);
+ }
};
} // End of namespace Tony
diff --git a/engines/tony/globals.h b/engines/tony/globals.h
index d82e0fcaf2..1c2835cf40 100644
--- a/engines/tony/globals.h
+++ b/engines/tony/globals.h
@@ -150,12 +150,12 @@ struct ChangedHotspotStruct {
\****************************************************************************/
typedef struct {
- int nCf;
+ int nCf;
- int arg1, arg2, arg3, arg4;
+ int arg1, arg2, arg3, arg4;
} CFCALL;
-typedef CFCALL* LPCFCALL;
-typedef LPCFCALL* LPLPCFCALL;
+typedef CFCALL *LPCFCALL;
+typedef LPCFCALL *LPLPCFCALL;
/****************************************************************************\
@@ -201,9 +201,9 @@ public:
bool bCfgSFX;
int nCfgTonySpeed;
int nCfgTextSpeed;
- int nCfgDubbingVolume;
- int nCfgMusicVolume;
- int nCfgSFXVolume;
+ int nCfgDubbingVolume;
+ int nCfgMusicVolume;
+ int nCfgSFXVolume;
bool bSkipSfxNoLoop;
bool bIdleExited;
bool bNoOcchioDiBue;
@@ -219,18 +219,18 @@ public:
RMInput *Input;
RMGfxEngine *GfxEngine;
- uint32 (*LoadLocation)(int, RMPoint, RMPoint start);
+ uint32(*LoadLocation)(int, RMPoint, RMPoint start);
void (*UnloadLocation)(CORO_PARAM, bool bDoOnExit, uint32 *result);
void (*LinkGraphicTask)(RMGfxTask *task);
- void (*Freeze)(void);
- void (*Unfreeze)(void);
- void (*WaitFrame)(CORO_PARAM);
+ void (*Freeze)(void);
+ void (*Unfreeze)(void);
+ void (*WaitFrame)(CORO_PARAM);
void (*PlayMusic)(int nChannel, const char *fileName, int nFX, bool bLoop, int nSync);
- void (*WaitWipeEnd)(CORO_PARAM);
- void (*CloseWipe)(void);
- void (*InitWipe)(int type);
- void (*EnableGUI)(void);
- void (*DisableGUI)(void);
+ void (*WaitWipeEnd)(CORO_PARAM);
+ void (*CloseWipe)(void);
+ void (*InitWipe)(int type);
+ void (*EnableGUI)(void);
+ void (*DisableGUI)(void);
void (*SetPalesati)(bool bpal);
uint32 dwTonyNumTexts;
@@ -259,7 +259,7 @@ public:
uint32 mpalError;
LPITEMIRQFUNCTION lpiifCustom;
LPLPCUSTOMFUNCTION lplpFunctions;
- Common::String * lplpFunctionStrings;
+ Common::String *lplpFunctionStrings;
uint16 nObjs;
uint16 nVars;
HGLOBAL hVars;
@@ -281,14 +281,14 @@ public:
LPMPALSCRIPT lpmsScripts;
Common::File hMpr;
uint16 nResources;
- uint32 * lpResources;
+ uint32 *lpResources;
bool bExecutingAction;
bool bExecutingDialog;
- uint32 nPollingLocations[MAXPOLLINGLOCATIONS];
- uint32 hEndPollingLocations[MAXPOLLINGLOCATIONS];
- uint32 PollingThreads[MAXPOLLINGLOCATIONS];
- uint32 hAskChoice;
- uint32 hDoneChoice;
+ uint32 nPollingLocations[MAXPOLLINGLOCATIONS];
+ uint32 hEndPollingLocations[MAXPOLLINGLOCATIONS];
+ uint32 PollingThreads[MAXPOLLINGLOCATIONS];
+ uint32 hAskChoice;
+ uint32 hDoneChoice;
uint32 nExecutingAction;
uint32 nExecutingDialog;
uint32 nExecutingChoice;
diff --git a/engines/tony/input.cpp b/engines/tony/input.cpp
index 97425e49c9..7663774ee4 100644
--- a/engines/tony/input.cpp
+++ b/engines/tony/input.cpp
@@ -32,7 +32,7 @@ namespace Tony {
RMInput::RMInput() {
// Setup mouse fields
- _clampMouse = false;
+ _clampMouse = false;
_mousePos.Set(0, 0);
_leftButton = _rightButton = false;;
@@ -89,7 +89,7 @@ void RMInput::Poll(void) {
default:
break;
}
- }
+ }
}
void RMInput::Init() {
@@ -107,12 +107,12 @@ bool RMInput::MouseRight() {
}
/**
- * Return true if a key has been pressed
+ * Return true if a key has been pressed
*/
-bool RMInput::GetAsyncKeyState(Common::KeyCode kc) {
+bool RMInput::GetAsyncKeyState(Common::KeyCode kc) {
// The act of testing for a particular key automatically clears the state, to prevent
// the same key being registered in multiple different frames
- bool result = _keyDown[(int)kc];
+ bool result = _keyDown[(int)kc];
_keyDown[(int)kc] = false;
return result;
}
diff --git a/engines/tony/input.h b/engines/tony/input.h
index 544424581f..524f604ec2 100644
--- a/engines/tony/input.h
+++ b/engines/tony/input.h
@@ -49,7 +49,7 @@ private:
private:
// Deinizializza DirectInput
void DIClose(void);
-
+
public:
RMInput();
~RMInput();
@@ -64,19 +64,33 @@ public:
void Poll(void);
// Reading of the mouse
- RMPoint MousePos() { return _mousePos; }
+ RMPoint MousePos() {
+ return _mousePos;
+ }
// Current status of the mouse buttons
bool MouseLeft();
bool MouseRight();
// Events of mouse clicks
- bool MouseLeftClicked() { return _leftClickMouse; }
- bool MouseRightClicked() { return _rightClickMouse; }
- bool MouseBothClicked() { return _leftClickMouse && _rightClickMouse; }
- bool MouseLeftReleased() { return _leftReleaseMouse; }
- bool MouseRightReleased() { return _rightReleaseMouse; }
- bool MouseBothReleased() { return _leftReleaseMouse && _rightReleaseMouse; }
+ bool MouseLeftClicked() {
+ return _leftClickMouse;
+ }
+ bool MouseRightClicked() {
+ return _rightClickMouse;
+ }
+ bool MouseBothClicked() {
+ return _leftClickMouse && _rightClickMouse;
+ }
+ bool MouseLeftReleased() {
+ return _leftReleaseMouse;
+ }
+ bool MouseRightReleased() {
+ return _rightReleaseMouse;
+ }
+ bool MouseBothReleased() {
+ return _leftReleaseMouse && _rightReleaseMouse;
+ }
// Returns true if the given key is pressed
bool GetAsyncKeyState(Common::KeyCode kc);
diff --git a/engines/tony/inventory.cpp b/engines/tony/inventory.cpp
index 7b53e75cdd..e10fe228d3 100644
--- a/engines/tony/inventory.cpp
+++ b/engines/tony/inventory.cpp
@@ -36,7 +36,7 @@ namespace Tony {
/****************************************************************************\
-* RMInventory Methods
+* RMInventory Methods
\****************************************************************************/
RMInventory::RMInventory() {
@@ -74,7 +74,7 @@ bool RMInventory::CheckPointInside(const RMPoint &pt) {
void RMInventory::Init(void) {
- int i,j;
+ int i, j;
int curres;
// Crea il buffer principale
@@ -87,7 +87,7 @@ void RMInventory::Init(void) {
m_bCombining = false;
// Nuovi oggetti
- m_nItems = 78; // @@@ Numero di oggetti prendibili
+ m_nItems = 78; // @@@ Numero di oggetti prendibili
m_items = new RMInventoryItem[m_nItems + 1];
curres = 10500;
@@ -115,14 +115,14 @@ void RMInventory::Init(void) {
curres++;
if (i == 0 || i == 28 || i == 29) continue;
-
+
m_items[i].pointer = new RMGfxSourceBuffer8RLEByteAA[m_items[i].icon.NumPattern()];
for (j = 0; j < m_items[i].icon.NumPattern(); j++) {
RMResRaw raw(curres);
assert(raw.IsValid());
-
+
m_items[i].pointer[j].Init((const byte *)raw, raw.Width(), raw.Height(), true);
curres++;
}
@@ -141,24 +141,24 @@ void RMInventory::Init(void) {
ds.Close();
// Crea il testo per gli hints sulla mini interfaccia
- m_hints[0].SetAlignType(RMText::HCENTER,RMText::VTOP);
- m_hints[1].SetAlignType(RMText::HCENTER,RMText::VTOP);
- m_hints[2].SetAlignType(RMText::HCENTER,RMText::VTOP);
+ m_hints[0].SetAlignType(RMText::HCENTER, RMText::VTOP);
+ m_hints[1].SetAlignType(RMText::HCENTER, RMText::VTOP);
+ m_hints[2].SetAlignType(RMText::HCENTER, RMText::VTOP);
// Il testo viene preso da MPAL per la traduzione
RMMessage msg1(15);
RMMessage msg2(13);
RMMessage msg3(14);
- m_hints[0].WriteText(msg1[0],1);
- m_hints[1].WriteText(msg2[0],1);
- m_hints[2].WriteText(msg3[0],1);
+ m_hints[0].WriteText(msg1[0], 1);
+ m_hints[1].WriteText(msg2[0], 1);
+ m_hints[2].WriteText(msg3[0], 1);
-/*
- m_hints[0].WriteText("Examine",1);
- m_hints[1].WriteText("Talk",1);
- m_hints[2].WriteText("Use",1);
-*/
+ /*
+ m_hints[0].WriteText("Examine",1);
+ m_hints[1].WriteText("Talk",1);
+ m_hints[2].WriteText("Use",1);
+ */
// Prepara il primo inventario
Prepare();
@@ -167,7 +167,7 @@ void RMInventory::Init(void) {
}
void RMInventory::Close(void) {
- // Ciao memoria
+ // Ciao memoria
if (m_items != NULL) {
// Delete the item pointers
for (int i = 0; i <= m_nItems; i++)
@@ -188,10 +188,10 @@ void RMInventory::Reset(void) {
void RMInventory::Draw(CORO_PARAM, RMGfxTargetBuffer &bigBuf, RMGfxPrimitive *prim) {
CORO_BEGIN_CONTEXT;
- RMPoint pos;
- RMPoint pos2;
- RMGfxPrimitive *p;
- RMGfxPrimitive *p2;
+ RMPoint pos;
+ RMPoint pos2;
+ RMGfxPrimitive *p;
+ RMGfxPrimitive *p2;
CORO_END_CONTEXT(_ctx);
CORO_BEGIN_CODE(_ctx);
@@ -208,13 +208,13 @@ void RMInventory::Draw(CORO_PARAM, RMGfxTargetBuffer &bigBuf, RMGfxPrimitive *pr
if (m_state == SELECTING) {
if (!GLOBALS.bCfgInvUp) {
- _ctx->pos.Set((m_nSelectObj+1)*64 - 20,RM_SY - 113);
- _ctx->pos2.Set((m_nSelectObj+1)*64 + 34,RM_SY - 150);
+ _ctx->pos.Set((m_nSelectObj + 1) * 64 - 20, RM_SY - 113);
+ _ctx->pos2.Set((m_nSelectObj + 1) * 64 + 34, RM_SY - 150);
} else {
- _ctx->pos.Set((m_nSelectObj+1)*64 - 20, 72 - 4); // la parte marrone sta in alto :(
- _ctx->pos2.Set((m_nSelectObj+1)*64 + 34, 119 - 4);
+ _ctx->pos.Set((m_nSelectObj + 1) * 64 - 20, 72 - 4); // la parte marrone sta in alto :(
+ _ctx->pos2.Set((m_nSelectObj + 1) * 64 + 34, 119 - 4);
}
-
+
_ctx->p = new RMGfxPrimitive(prim->m_task, _ctx->pos);
_ctx->p2 = new RMGfxPrimitive(prim->m_task, _ctx->pos2);
@@ -254,7 +254,7 @@ void RMInventory::RemoveItem(int code) {
Common::copy(&m_inv[i + 1], &m_inv[i + 1] + (m_nInv - i), &m_inv[i]);
// m_inv[m_nInv-1]=0;
m_nInv--;
-
+
Prepare();
DrawOT(Common::nullContext);
ClearOT();
@@ -272,12 +272,12 @@ void RMInventory::AddItem(int code) {
warning("Cannot find a valid icon for this item, and then it will not be added to the inventory");
} else {
g_system->lockMutex(m_csModifyInterface);
- if (m_curPos + 8 == m_nInv) {
+ if (m_curPos + 8 == m_nInv) {
// Sfondiamo l'inventario! Attivo il pattern di lampeggio
m_items[28].icon.SetPattern(2);
}
- m_inv[m_nInv++]=code-10000;
+ m_inv[m_nInv++] = code - 10000;
Prepare();
DrawOT(Common::nullContext);
@@ -302,8 +302,7 @@ void RMInventory::ChangeItemStatus(uint32 code, uint32 dwStatus) {
}
-void RMInventory::Prepare(void)
-{
+void RMInventory::Prepare(void) {
int i;
for (i = 1; i < RM_SX / 64 - 1; i++) {
@@ -332,7 +331,7 @@ bool RMInventory::HaveFocus(const RMPoint &mpos) {
// Se l'inventario è aperto, abbiamo il focus quando ci andiamo sopra
if (m_state == OPENED && !m_bCombining && CheckPointInside(mpos))
return true;
-
+
// Se stiamo selezionando un verbo (quindi tasto destro premuto), abbiamo il focus alltime
if (m_state == SELECTING)
return true;
@@ -344,11 +343,11 @@ void RMInventory::EndCombine(void) {
m_bCombining = false;
}
-bool RMInventory::LeftClick(const RMPoint &mpos, int& nCombineObj) {
+bool RMInventory::LeftClick(const RMPoint &mpos, int &nCombineObj) {
int n;
// Il click sinistro prende in mano un oggetto dell'inventario per utilizzarlo con lo sfondo
- n=mpos.x / 64;
+ n = mpos.x / 64;
if (m_state == OPENED) {
if (n > 0 && n < RM_SX / 64 - 1 && m_inv[n - 1 + m_curPos] != 0) {
@@ -360,13 +359,13 @@ bool RMInventory::LeftClick(const RMPoint &mpos, int& nCombineObj) {
return true;
}
}
-
+
// Click sulla freccia destra
if ((m_state == OPENED) && m_bBlinkingRight) {
g_system->lockMutex(m_csModifyInterface);
m_curPos++;
- if (m_curPos+8 >= m_nInv) {
+ if (m_curPos + 8 >= m_nInv) {
m_bBlinkingRight = false;
m_items[28].icon.SetPattern(1);
}
@@ -383,7 +382,7 @@ bool RMInventory::LeftClick(const RMPoint &mpos, int& nCombineObj) {
}
// Click sulla freccia sinistra
else if ((m_state == OPENED) && m_bBlinkingLeft) {
- assert(m_curPos>0);
+ assert(m_curPos > 0);
g_system->lockMutex(m_csModifyInterface);
m_curPos--;
@@ -417,7 +416,7 @@ void RMInventory::RightClick(const RMPoint &mpos) {
// Apre l'interfaccina contestuale
n = mpos.x / 64;
- if (n > 0 && n < RM_SX / 64 - 1 && m_inv[n - 1 + m_curPos] != 0) {
+ if (n > 0 && n < RM_SX / 64 - 1 && m_inv[n - 1 + m_curPos] != 0) {
m_state = SELECTING;
miniAction = 0;
m_nSelectObj = n - 1;
@@ -437,7 +436,7 @@ void RMInventory::RightClick(const RMPoint &mpos) {
m_items[28].icon.SetPattern(1);
}
- if (m_curPos>0) {
+ if (m_curPos > 0) {
m_bBlinkingLeft = true;
m_items[29].icon.SetPattern(2);
}
@@ -469,7 +468,7 @@ void RMInventory::RightClick(const RMPoint &mpos) {
}
}
-bool RMInventory::RightRelease(const RMPoint &mpos, RMTonyAction& curAction) {
+bool RMInventory::RightRelease(const RMPoint &mpos, RMTonyAction &curAction) {
if (m_state == SELECTING) {
m_state = OPENED;
@@ -488,7 +487,7 @@ bool RMInventory::RightRelease(const RMPoint &mpos, RMTonyAction& curAction) {
return false;
}
-#define INVSPEED 20
+#define INVSPEED 20
void RMInventory::DoFrame(RMGfxTargetBuffer &bigBuf, RMPointer &ptr, RMPoint mpos, bool bCanOpen) {
int i;
@@ -523,7 +522,7 @@ void RMInventory::DoFrame(RMGfxTargetBuffer &bigBuf, RMPointer &ptr, RMPoint mpo
m_items[29].icon.SetPattern(3);
m_bBlinkingLeft = true;
bNeedRedraw = true;
- }
+ }
} else if (m_bBlinkingLeft) {
m_items[29].icon.SetPattern(2);
m_bBlinkingLeft = false;
@@ -542,12 +541,12 @@ void RMInventory::DoFrame(RMGfxTargetBuffer &bigBuf, RMPointer &ptr, RMPoint mpo
g_system->unlockMutex(m_csModifyInterface);
}
-
+
if (_vm->GetEngine()->GetInput().GetAsyncKeyState(Common::KEYCODE_i)) {
GLOBALS.bCfgInvLocked = !GLOBALS.bCfgInvLocked;
}
- if (m_bCombining) {//m_state == COMBINING)
+ if (m_bCombining) {//m_state == COMBINING)
ptr.SetCustomPointer(&m_items[m_nCombine].pointer[m_items[m_nCombine].status - 1]);
ptr.SetSpecialPointer(RMPointer::PTR_CUSTOM);
}
@@ -557,12 +556,12 @@ void RMInventory::DoFrame(RMGfxTargetBuffer &bigBuf, RMPointer &ptr, RMPoint mpo
if (!GLOBALS.bCfgInvNoScroll) {
m_state = OPENING;
m_curPutY = RM_SY - 1;
- m_curPutTime=_vm->GetTime();
+ m_curPutTime = _vm->GetTime();
} else {
m_state = OPENED;
m_curPutY = RM_SY - 68;
}
- } else if (m_state == OPENED) {
+ } else if (m_state == OPENED) {
if ((mpos.y < RM_SY - 70 && !GLOBALS.bCfgInvLocked) || !bCanOpen) {
if (!GLOBALS.bCfgInvNoScroll) {
m_state = CLOSING;
@@ -593,18 +592,17 @@ void RMInventory::DoFrame(RMGfxTargetBuffer &bigBuf, RMPointer &ptr, RMPoint mpo
m_state = CLOSED;
}
} else {
- if ((m_state == CLOSED) && (mpos.y<10 || GLOBALS.bCfgInvLocked) && bCanOpen) {
+ if ((m_state == CLOSED) && (mpos.y < 10 || GLOBALS.bCfgInvLocked) && bCanOpen) {
if (!GLOBALS.bCfgInvNoScroll) {
m_state = OPENING;
- m_curPutY =- 68;
+ m_curPutY = - 68;
m_curPutTime = _vm->GetTime();
} else {
m_state = OPENED;
m_curPutY = 0;
}
- }
- else if (m_state == OPENED) {
- if ((mpos.y>70 && !GLOBALS.bCfgInvLocked) || !bCanOpen) {
+ } else if (m_state == OPENED) {
+ if ((mpos.y > 70 && !GLOBALS.bCfgInvLocked) || !bCanOpen) {
if (!GLOBALS.bCfgInvNoScroll) {
m_state = CLOSING;
m_curPutY = -2;
@@ -637,31 +635,31 @@ void RMInventory::DoFrame(RMGfxTargetBuffer &bigBuf, RMPointer &ptr, RMPoint mpo
if (m_state == SELECTING) {
int startx = (m_nSelectObj + 1) * 64 - 20;
int starty;
-
+
if (!GLOBALS.bCfgInvUp)
- starty=RM_SY-109;
+ starty = RM_SY - 109;
else
- starty=70;
-
+ starty = 70;
+
// Controlla se si trova su uno dei verbi
if (mpos.y > starty && mpos.y < starty + 45) {
- if (mpos.x > startx && mpos.x < startx + 40) {
- if (miniAction !=1 ) {
+ if (mpos.x > startx && mpos.x < startx + 40) {
+ if (miniAction != 1) {
miniInterface.SetPattern(2);
miniAction = 1;
- _vm->PlayUtilSFX(1);
+ _vm->PlayUtilSFX(1);
}
} else if (mpos.x >= startx + 40 && mpos.x < startx + 80) {
if (miniAction != 2) {
miniInterface.SetPattern(3);
miniAction = 2;
_vm->PlayUtilSFX(1);
- }
+ }
} else if (mpos.x >= startx + 80 && mpos.x < startx + 108) {
if (miniAction != 3) {
miniInterface.SetPattern(4);
miniAction = 3;
- _vm->PlayUtilSFX(1);
+ _vm->PlayUtilSFX(1);
}
} else {
miniInterface.SetPattern(1);
@@ -671,12 +669,12 @@ void RMInventory::DoFrame(RMGfxTargetBuffer &bigBuf, RMPointer &ptr, RMPoint mpo
miniInterface.SetPattern(1);
miniAction = 0;
}
-
+
// Aggiorna la miniinterface
miniInterface.DoFrame(&bigBuf, false);
}
- if ((m_state!= CLOSED) && !m_nInList) {
+ if ((m_state != CLOSED) && !m_nInList) {
bigBuf.AddPrim(new RMGfxPrimitive(this));
}
}
@@ -694,10 +692,10 @@ RMItem *RMInventory::WhichItemIsIn(const RMPoint &mpt) {
if (m_state == OPENED) {
if (CheckPointInside(mpt)) {
- n=mpt.x / 64;
- if (n>0 && n < RM_SX / 64 - 1 && m_inv[n - 1 + m_curPos] != 0 && (!m_bCombining || m_inv[n - 1 + m_curPos] != m_nCombine))
+ n = mpt.x / 64;
+ if (n > 0 && n < RM_SX / 64 - 1 && m_inv[n - 1 + m_curPos] != 0 && (!m_bCombining || m_inv[n - 1 + m_curPos] != m_nCombine))
return &m_items[m_inv[n - 1 + m_curPos]].icon;
- }
+ }
}
return NULL;
@@ -707,14 +705,16 @@ RMItem *RMInventory::WhichItemIsIn(const RMPoint &mpt) {
int RMInventory::GetSaveStateSize(void) {
// m_inv pattern m_nInv
- return 256*4 + 256*4 + 4 ;
+ return 256 * 4 + 256 * 4 + 4 ;
}
void RMInventory::SaveState(byte *state) {
int i, x;
- WRITE_LE_UINT32(state, m_nInv); state += 4;
- Common::copy(m_inv, m_inv + 256, (uint32 *)state); state += 256 * 4;
+ WRITE_LE_UINT32(state, m_nInv);
+ state += 4;
+ Common::copy(m_inv, m_inv + 256, (uint32 *)state);
+ state += 256 * 4;
for (i = 0; i < 256; i++) {
if (i < m_nItems)
@@ -722,19 +722,23 @@ void RMInventory::SaveState(byte *state) {
else
x = 0;
- WRITE_LE_UINT32(state, x); state += 4;
+ WRITE_LE_UINT32(state, x);
+ state += 4;
}
}
int RMInventory::LoadState(byte *state) {
int i, x;
- m_nInv = READ_LE_UINT32(state); state += 4;
- Common::copy((uint32 *)state, (uint32 *)state + 256, m_inv); state += 256 * 4;
+ m_nInv = READ_LE_UINT32(state);
+ state += 4;
+ Common::copy((uint32 *)state, (uint32 *)state + 256, m_inv);
+ state += 256 * 4;
for (i = 0; i < 256; i++) {
- x = READ_LE_UINT32(state); state += 4;
-
+ x = READ_LE_UINT32(state);
+ state += 4;
+
if (i < m_nItems) {
m_items[i].status = x;
m_items[i].icon.SetPattern(x);
@@ -745,7 +749,7 @@ int RMInventory::LoadState(byte *state) {
m_bCombining = false;
m_items[29].icon.SetPattern(1);
-
+
if (m_nInv > 8)
m_items[28].icon.SetPattern(2);
else
@@ -760,7 +764,7 @@ int RMInventory::LoadState(byte *state) {
/****************************************************************************\
-* RMInterface methods
+* RMInterface methods
\****************************************************************************/
RMInterface::~RMInterface() {
@@ -777,8 +781,9 @@ int RMInterface::OnWhichBox(RMPoint pt) {
pt -= m_openStart;
// Controlla quanti verbi bisogna considerare
- max = 4; if (m_bPalesati) max = 5;
-
+ max = 4;
+ if (m_bPalesati) max = 5;
+
// Cerca il verbo
for (i = 0; i < max; i++)
if (m_hotbbox[i].PtInRect(pt))
@@ -790,7 +795,7 @@ int RMInterface::OnWhichBox(RMPoint pt) {
void RMInterface::Draw(CORO_PARAM, RMGfxTargetBuffer &bigBuf, RMGfxPrimitive *prim) {
CORO_BEGIN_CONTEXT;
- int h;
+ int h;
CORO_END_CONTEXT(_ctx);
CORO_BEGIN_CODE(_ctx);
@@ -803,7 +808,7 @@ void RMInterface::Draw(CORO_PARAM, RMGfxTargetBuffer &bigBuf, RMGfxPrimitive *pr
if (_ctx->h != -1) {
prim->Dst().TopLeft() = m_openStart;
CORO_INVOKE_2(m_hotzone[_ctx->h].Draw, bigBuf, prim);
-
+
if (m_lastHotZone != _ctx->h) {
m_lastHotZone = _ctx->h;
_vm->PlayUtilSFX(1);
@@ -839,8 +844,8 @@ void RMInterface::Clicked(const RMPoint &mousepos) {
// La tiene dentro lo schermo
if (m_openStart.x < 0) m_openStart.x = 0;
if (m_openStart.y < 0) m_openStart.y = 0;
- if (m_openStart.x+m_dimx > RM_SX) m_openStart.x = RM_SX - m_dimx;
- if (m_openStart.y+m_dimy > RM_SY) m_openStart.y = RM_SY - m_dimy;
+ if (m_openStart.x + m_dimx > RM_SX) m_openStart.x = RM_SX - m_dimx;
+ if (m_openStart.y + m_dimy > RM_SY) m_openStart.y = RM_SY - m_dimy;
// Play dell'effetto sonoro
_vm->PlayUtilSFX(0);
@@ -868,16 +873,16 @@ bool RMInterface::Released(const RMPoint &mousepos, RMTonyAction &action) {
case 3:
action = TA_EXAMINE;
break;
-
+
case 4:
action = TA_PALESATI;
break;
- default: // Nessun verbo
+ default: // Nessun verbo
return false;
- }
-
- return true;
+ }
+
+ return true;
}
void RMInterface::Reset(void) {
@@ -885,7 +890,7 @@ void RMInterface::Reset(void) {
}
void RMInterface::SetPalesati(bool bOn) {
- m_bPalesati=bOn;
+ m_bPalesati = bOn;
}
bool RMInterface::GetPalesati(void) {
@@ -894,7 +899,7 @@ bool RMInterface::GetPalesati(void) {
void RMInterface::Init(void) {
int i;
- RMResRaw inter(RES_I_INTERFACE);
+ RMResRaw inter(RES_I_INTERFACE);
RMRes pal(RES_I_INTERPPAL);
SetPriority(191);
@@ -909,8 +914,8 @@ void RMInterface::Init(void) {
m_hotzone[i].LoadPaletteWA(pal);
}
- m_hotbbox[0].SetRect(126, 123, 159, 208); // prendi
- m_hotbbox[1].SetRect(90, 130, 125, 186); // parla
+ m_hotbbox[0].SetRect(126, 123, 159, 208); // prendi
+ m_hotbbox[1].SetRect(90, 130, 125, 186); // parla
m_hotbbox[2].SetRect(110, 60, 152, 125);
m_hotbbox[3].SetRect(56, 51, 93, 99);
m_hotbbox[4].SetRect(51, 105, 82, 172);
@@ -933,13 +938,13 @@ void RMInterface::Init(void) {
m_hints[2].WriteText(msg2[0], 1);
m_hints[3].WriteText(msg3[0], 1);
m_hints[4].WriteText(msg4[0], 1);
-/*
- m_hints[0].WriteText("Take",1);
- m_hints[1].WriteText("Talk",1);
- m_hints[2].WriteText("Use",1);
- m_hints[3].WriteText("Examine",1);
- m_hints[4].WriteText("Palesati",1);
-*/
+ /*
+ m_hints[0].WriteText("Take",1);
+ m_hints[1].WriteText("Talk",1);
+ m_hints[2].WriteText("Use",1);
+ m_hints[3].WriteText("Examine",1);
+ m_hints[4].WriteText("Palesati",1);
+ */
m_bActive = false;
m_bPalesati = false;
m_lastHotZone = 0;
diff --git a/engines/tony/tonychar.cpp b/engines/tony/tonychar.cpp
index df92cafebd..c612ebbf77 100644
--- a/engines/tony/tonychar.cpp
+++ b/engines/tony/tonychar.cpp
@@ -334,14 +334,14 @@ void RMTony::Stop(CORO_PARAM) {
ExecuteAction(m_Action, m_ActionItem->MpalCode(), m_ActionParm);
- m_ActionItem=NULL;
+ m_ActionItem = NULL;
CORO_END_CODE;
}
int RMTony::GetCurPattern(void) {
- int nPatt=RMCharacter::GetCurPattern();
+ int nPatt = RMCharacter::GetCurPattern();
if (!m_bPastorella)
return nPatt;
@@ -355,7 +355,6 @@ int RMTony::GetCurPattern(void) {
return PAT_STANDLEFT;
case PAT_PAST_STANDRIGHT:
return PAT_STANDRIGHT;
-
case PAT_PAST_WALKUP:
return PAT_WALKUP;
case PAT_PAST_WALKDOWN:
@@ -438,7 +437,6 @@ void RMTony::Take(int nWhere, int nPart) {
}
break;
-
case PAT_STANDLEFT:
switch (nWhere) {
case 0:
@@ -454,7 +452,7 @@ void RMTony::Take(int nWhere, int nPart) {
break;
}
} else if (nPart == 1) {
- SetPattern(GetCurPattern()+1);
+ SetPattern(GetCurPattern() + 1);
} else if (nPart == 2) {
switch (GetCurPattern()) {
case PAT_TAKEUP_UP2:
@@ -514,7 +512,6 @@ void RMTony::Put(int nWhere, int nPart) {
}
break;
-
case PAT_STANDLEFT:
switch (nWhere) {
case 0:
@@ -530,7 +527,7 @@ void RMTony::Put(int nWhere, int nPart) {
break;
}
} else if (nPart == 1) {
- SetPattern(GetCurPattern()+1);
+ SetPattern(GetCurPattern() + 1);
} else if (nPart == 2) {
switch (GetCurPattern()) {
case PAT_PUTUP_UP2:
@@ -567,7 +564,7 @@ bool RMTony::StartTalkCalculate(TALKTYPE nTalkType, int &headStartPat, int &body
if (!m_bIsStaticTalk) {
switch (m_nPatB4Talking) {
case PAT_STANDDOWN:
- m_TalkDirection=DOWN;
+ m_TalkDirection = DOWN;
break;
case PAT_TAKELEFT_UP2:
@@ -575,7 +572,7 @@ bool RMTony::StartTalkCalculate(TALKTYPE nTalkType, int &headStartPat, int &body
case PAT_TAKELEFT_DOWN2:
case PAT_SIRIALZALEFT:
case PAT_STANDLEFT:
- m_TalkDirection=LEFT;
+ m_TalkDirection = LEFT;
break;
case PAT_TAKERIGHT_UP2:
@@ -583,14 +580,14 @@ bool RMTony::StartTalkCalculate(TALKTYPE nTalkType, int &headStartPat, int &body
case PAT_TAKERIGHT_DOWN2:
case PAT_SIRIALZARIGHT:
case PAT_STANDRIGHT:
- m_TalkDirection=RIGHT;
+ m_TalkDirection = RIGHT;
break;
case PAT_TAKEUP_UP2:
case PAT_TAKEUP_MID2:
case PAT_TAKEUP_DOWN2:
case PAT_STANDUP:
- m_TalkDirection=UP;
+ m_TalkDirection = UP;
break;
}
@@ -1220,9 +1217,9 @@ bool RMTony::EndTalkCalculate(int &headStandPat, int &headEndPat, int &bodyEndPa
case TALK_RIDE:
case TALK_RIDE2:
- if (m_TalkDirection==LEFT)
+ if (m_TalkDirection == LEFT)
headEndPat = PAT_RIDELEFT_END;
- else if (m_TalkDirection==RIGHT)
+ else if (m_TalkDirection == RIGHT)
headEndPat = PAT_RIDERIGHT_END;
bodyEndPat = 0;
@@ -1532,7 +1529,7 @@ void RMTony::StartStaticCalculate(TALKTYPE nTalk, int &headPat, int &headLoopPat
switch (nPat) {
case PAT_STANDDOWN:
- m_TalkDirection=DOWN;
+ m_TalkDirection = DOWN;
headPat = PAT_TESTA_RIGHT;
break;
@@ -1541,7 +1538,7 @@ void RMTony::StartStaticCalculate(TALKTYPE nTalk, int &headPat, int &headLoopPat
case PAT_TAKELEFT_DOWN2:
case PAT_SIRIALZALEFT:
case PAT_STANDLEFT:
- m_TalkDirection=LEFT;
+ m_TalkDirection = LEFT;
headPat = PAT_TESTA_LEFT;
break;
@@ -1550,7 +1547,7 @@ void RMTony::StartStaticCalculate(TALKTYPE nTalk, int &headPat, int &headLoopPat
case PAT_TAKERIGHT_DOWN2:
case PAT_SIRIALZARIGHT:
case PAT_STANDRIGHT:
- m_TalkDirection=RIGHT;
+ m_TalkDirection = RIGHT;
headPat = PAT_TESTA_RIGHT;
break;
@@ -1558,7 +1555,7 @@ void RMTony::StartStaticCalculate(TALKTYPE nTalk, int &headPat, int &headLoopPat
case PAT_TAKEUP_MID2:
case PAT_TAKEUP_DOWN2:
case PAT_STANDUP:
- m_TalkDirection=UP;
+ m_TalkDirection = UP;
headPat = PAT_TESTA_LEFT;
break;
}
diff --git a/engines/tony/window.cpp b/engines/tony/window.cpp
index 92f6dea032..58d0bba2ba 100644
--- a/engines/tony/window.cpp
+++ b/engines/tony/window.cpp
@@ -211,9 +211,9 @@ bool RMSnapshot::GetFreeSnapName(char *fn) {
_splitpath(fn, bufDrive, bufDir, NULL, NULL);
for (i = 1; i < 10; i++) {
- wsprintf(bufName,"rm%d00",i);
- _makepath(fn,bufDrive,bufDir,bufName,".bmp");
- h = CreateFile(fn,GENERIC_READ,FILE_SHARE_READ, NULL,OPEN_EXISTING,FILE_ATTRIBUTE_NORMAL, NULL);
+ wsprintf(bufName, "rm%d00", i);
+ _makepath(fn, bufDrive, bufDir, bufName, ".bmp");
+ h = CreateFile(fn, GENERIC_READ, FILE_SHARE_READ, NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL);
if (h == CORO_INVALID_PID_VALUE)
break;
CloseHandle(h);
@@ -222,10 +222,10 @@ bool RMSnapshot::GetFreeSnapName(char *fn) {
i--;
for (j = 1; j < 10; j++) {
- wsprintf(bufName,"rm%d%d0",i,j);
- _makepath(fn,bufDrive,bufDir,bufName,".bmp");
- h=CreateFile(fn,GENERIC_READ,FILE_SHARE_READ, NULL,OPEN_EXISTING,FILE_ATTRIBUTE_NORMAL, NULL);
- if (h==CORO_INVALID_PID_VALUE)
+ wsprintf(bufName, "rm%d%d0", i, j);
+ _makepath(fn, bufDrive, bufDir, bufName, ".bmp");
+ h = CreateFile(fn, GENERIC_READ, FILE_SHARE_READ, NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL);
+ if (h == CORO_INVALID_PID_VALUE)
break;
CloseHandle(h);
}
@@ -233,10 +233,10 @@ bool RMSnapshot::GetFreeSnapName(char *fn) {
j--;
for (k = 0; k < 10; k++) {
- wsprintf(bufName,"rm%d%d%d",i,j,k);
- _makepath(fn,bufDrive,bufDir,bufName,".bmp");
- h = CreateFile(fn,GENERIC_READ,FILE_SHARE_READ, NULL,OPEN_EXISTING,FILE_ATTRIBUTE_NORMAL, NULL);
- if (h==CORO_INVALID_PID_VALUE)
+ wsprintf(bufName, "rm%d%d%d", i, j, k);
+ _makepath(fn, bufDrive, bufDir, bufName, ".bmp");
+ h = CreateFile(fn, GENERIC_READ, FILE_SHARE_READ, NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL);
+ if (h == CORO_INVALID_PID_VALUE)
break;
CloseHandle(h);
}
@@ -251,8 +251,8 @@ bool RMSnapshot::GetFreeSnapName(char *fn) {
return false;
}
- wsprintf(bufName,"rm%d%d%d",i,j,k);
- _makepath(fn,bufDrive,bufDir,bufName,".bmp");
+ wsprintf(bufName, "rm%d%d%d", i, j, k);
+ _makepath(fn, bufDrive, bufDir, bufName, ".bmp");
}
#endif
return true;
@@ -299,7 +299,7 @@ void RMSnapshot::GrabScreenshot(byte *lpBuf, int dezoom, uint16 *lpDestBuf) {
cursrc = &src[RM_SKIPX + x * dezoom];
sommar = sommab = sommag = 0;
- for (v = 0; v < dezoom; v++)
+ for (v = 0; v < dezoom; v++) {
for (u = 0; u < dezoom; u++) {
if (lpDestBuf == NULL)
curv = -v;
@@ -310,16 +310,16 @@ void RMSnapshot::GrabScreenshot(byte *lpBuf, int dezoom, uint16 *lpDestBuf) {
sommag += (cursrc[curv*RM_BBX + u] >> 5) & 0x1F;
sommar += (cursrc[curv*RM_BBX + u] >> 10) & 0x1F;
}
+ }
+ rgb[k + 0] = (byte) (sommab * 8 / (dezoom * dezoom));
+ rgb[k + 1] = (byte) (sommag * 8 / (dezoom * dezoom));
+ rgb[k + 2] = (byte) (sommar * 8 / (dezoom * dezoom));
- rgb[k + 0] = (byte) (sommab * 8 / (dezoom * dezoom));
- rgb[k + 1] = (byte) (sommag * 8 / (dezoom * dezoom));
- rgb[k + 2] = (byte) (sommar * 8 / (dezoom * dezoom));
-
- if (lpDestBuf!=NULL)
- lpDestBuf[k / 3] = ((int)rgb[k + 0] >> 3) | (((int)rgb[k + 1] >> 3) << 5) |
- (((int)rgb[k + 2] >> 3) << 10);
+ if (lpDestBuf!=NULL)
+ lpDestBuf[k / 3] = ((int)rgb[k + 0] >> 3) | (((int)rgb[k + 1] >> 3) << 5) |
+ (((int)rgb[k + 2] >> 3) << 10);
- k += 3;
+ k += 3;
}
if (lpDestBuf == NULL)