TONY: Removal of code that was commented out in the original source

This commit is contained in:
Paul Gilbert 2012-05-20 16:34:38 +10:00
parent c38bbce20c
commit 7da213cd32
9 changed files with 29 additions and 300 deletions

View file

@ -276,11 +276,10 @@ DECLARE_CUSTOM_FUNCTION(SendTonyMessage)(CORO_PARAM, uint32 dwMessage, uint32 nX
// First time allocation
g_system->lockMutex(GLOBALS.vdb);
// 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 = _vm->_vdbFP.pos();
_ctx->voice->SetLoop(false);
@ -337,11 +336,10 @@ 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);
_vm->_vdbFP.seek(_ctx->curOffset);
_vm->_theSound.CreateSfx(&_ctx->voice);
_ctx->voice->LoadVoiceFromVDB(_vm->_vdbFP);
// _ctx->curOffset = ftell(_vm->m_vdbFP);
_ctx->curOffset = _vm->_vdbFP.pos();
_ctx->voice->SetLoop(false);
_ctx->voice->Play();
@ -517,7 +515,7 @@ DECLARE_CUSTOM_FUNCTION(CloseLocation)(CORO_PARAM, uint32, uint32, uint32, uint3
_vm->StopMusic(4);
// On Exit e lascia freezzato
// On exit, unload and unfreeze
CORO_INVOKE_2(GLOBALS.UnloadLocation, true, NULL);
GLOBALS.Unfreeze();
@ -541,7 +539,7 @@ DECLARE_CUSTOM_FUNCTION(ChangeLocation)(CORO_PARAM, uint32 nLoc, uint32 tX, uint
_vm->StopMusic(4);
}
// On Exit e lascia freezzato
// On exit, unfreeze
CORO_INVOKE_2(GLOBALS.UnloadLocation, true, NULL);
GLOBALS.curChangedHotspot = 0;
@ -1314,37 +1312,6 @@ DECLARE_CUSTOM_FUNCTION(SyncScrollLocation)(CORO_PARAM, uint32 nX, uint32 nY, ui
}
/*
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);
} else if (_ctx->lx < 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);
}
*/
CORO_INVOKE_0(GLOBALS.WaitFrame);
GLOBALS.Freeze();
@ -1519,7 +1486,6 @@ DECLARE_CUSTOM_FUNCTION(CharSendMessage)(CORO_PARAM, uint32 nChar, uint32 dwMess
_ctx->voice = NULL;
if (_ctx->curVoc) {
// Position within the database of entries, beginning at the first
// 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;
@ -1853,7 +1819,6 @@ DECLARE_CUSTOM_FUNCTION(SendDialogMessage)(CORO_PARAM, uint32 nPers, uint32 nMsg
if (_ctx->curVoc) {
// Position within the database of entries, beginning at the first
g_system->lockMutex(GLOBALS.vdb);
// 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);
@ -2119,8 +2084,8 @@ DECLARE_CUSTOM_FUNCTION(ReleaseOwnership)(CORO_PARAM, uint32 num, uint32, uint32
/*
* Musica
* ------
* Music
* -----
*
* Fadeout effects supposed:
*

View file

@ -66,23 +66,7 @@ void DumpFontBMP(const char *filename, const byte *buf, int nChars, int charX, i
void RMFont::Load(const byte *buf, int nChars, int dimx, int dimy, uint32 palResID) {
m_letter = new RMGfxSourceBuffer8RLEByte[nChars];
#if 0
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) {
// Font macc
DumpFontBMP("font_macc.bmp", buf, nChars, dimx, dimy, RMRes(palResID));
} else if (nChars == 85 && palResID == RES_F_PAL) {
// Font obj
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));
}
#endif
// Initialisation the fonts
// Initialise the fonts
for (int i = 0; i < nChars; i++) {
// Initialise the buffer with the letters
m_letter[i].Init(buf + i * (dimx * dimy + 8) + 8, dimx, dimy);

View file

@ -1194,9 +1194,6 @@ void RMOptionScreen::DoFrame(CORO_PARAM, RMInput *input) {
m_nEditPos = _ctx->i;
strcpy(m_EditName, m_curThumbName[_ctx->i]);
_ctx->bRefresh = true;
//_vm->SaveState(m_statePos+_ctx->i,"No name");
//Close();
}
break;

View file

@ -162,18 +162,6 @@ void RMGfxSourceBuffer::PrepareImage(void) {
bool RMGfxSourceBuffer::Clip2D(int &x1, int &y1, int &u, int &v, int &width, int &height, bool bUseSrc, RMGfxTargetBuffer *buf) {
int destw, desth;
/*
OBSOLETE CODE:
if (buf == NULL) {
destw=RM_SX;
desth=RM_SY;
} else {
destw = buf->Dimx();
desth = buf->Dimy();
}
*/
destw = buf->Dimx();
desth = buf->Dimy();

View file

@ -227,14 +227,11 @@ void RMGfxEngine::DoFrame(CORO_PARAM, bool bDrawLocation) {
// Left Click
// **************
if (m_input.MouseLeftClicked() && !m_inter.Active()) {
// If click inside an item, perform action
//if (m_itemName.IsItemSelected())
{
if (m_curAction != TA_COMBINE)
CORO_INVOKE_3(m_tony.MoveAndDoAction, m_itemName.GetHotspot(), m_itemName.GetSelectedItem(), m_point.CurAction());
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();
@ -380,80 +377,6 @@ 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);
*/
void RMGfxEngine::SelectLocation(const RMPoint &ptTonyStart, const RMPoint &start) {
#if 0
OPENFILENAME ofn;
char lpszFileName[512];
// @@@ 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))
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));
else
InitForNewLocation(m_loc.TEMPGetNumLoc(), ptTonyStart, start);
#endif
}
void RMGfxEngine::InitForNewLocation(int nLoc, RMPoint ptTonyStart, RMPoint start) {
if (start.x == -1 || start.y == -1) {
@ -487,18 +410,11 @@ uint32 RMGfxEngine::LoadLocation(int nLoc, RMPoint ptTonyStart, RMPoint start) {
bLoaded = false;
for (i = 0; i < 5; i++) {
// Retry the loading of the location
// Try the loading of the location
RMRes res(m_nCurLoc);
if (!res.IsValid())
continue;
#if 0
// codice per dumpare una locazione in caso serva una modifica
if (nLoc == 106) {
FILE *f = fopen("loc106.lox", "wb");
fwrite(res.DataPointer(), res.Size(), 1, f);
fclose(f);
}
#endif
m_loc.Load(res);
InitForNewLocation(nLoc, ptTonyStart, start);
bLoaded = true;
@ -506,7 +422,7 @@ uint32 RMGfxEngine::LoadLocation(int nLoc, RMPoint ptTonyStart, RMPoint start) {
}
if (!bLoaded)
SelectLocation(ptTonyStart, start);
error("Location was not loaded");
if (m_bOption)
m_opt.ReInit(m_bigBuf);
@ -547,19 +463,8 @@ void RMGfxEngine::UnloadLocation(CORO_PARAM, bool bDoOnExit, uint32 *result) {
CORO_END_CODE;
}
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);
*/
// Schermata di loading
void RMGfxEngine::Init() {
// Screen loading
RMResRaw *raw;
RMGfxSourceBuffer16 *load = NULL;
INIT_GFX16_FROMRAW(20038, load);
@ -573,7 +478,7 @@ void RMGfxEngine::Init(/*HINSTANCE hInst*/) {
GLOBALS.bPatIrqFreeze = true;
// GUI attivabile
// Activate GUI
m_bGUIOption = true;
m_bGUIInterface = true;
m_bGUIInventory = true;
@ -593,7 +498,7 @@ void RMGfxEngine::Init(/*HINSTANCE hInst*/) {
mpalInstallItemIrq(ItemIrq);
// Initialise the input
m_input.Init(/*hInst*/);
m_input.Init();
// Initialise the mouse pointer
m_point.Init();
@ -608,40 +513,11 @@ void RMGfxEngine::Init(/*HINSTANCE hInst*/) {
// Download the location and set priorities @@@@@
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;
*/
EnableInput();
// Starting the game
//m_tony.ExecuteAction(4,1,0); //PREGAME
m_tony.ExecuteAction(20, 1, 0);
// theLog << "Seleziona la locazione\n";
//LoadLocation(1,RMPoint(201,316),RMPoint(-1,-1));
//SelectLocation();
//LoadLocation(5,RMPoint(685,338),RMPoint(-1,-1));
//LoadLocation(7,RMPoint(153,424),RMPoint(-1,-1));
//LoadLocation(70,RMPoint(10,10),RMPoint(-1,-1));
//LoadLocation(20,RMPoint(112,348),RMPoint(-1,-1));
//LoadLocation(26,RMPoint(95,456),RMPoint(-1,-1));
//LoadLocation(12,RMPoint(221,415),RMPoint(-1,-1));
//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));
}
void RMGfxEngine::Close(void) {

View file

@ -136,9 +136,6 @@ public:
void SaveState(const Common::String &fn, byte *curThumb, const Common::String &name);
void LoadState(CORO_PARAM, const Common::String &fn);
// Selects a location
void SelectLocation(const RMPoint &ptTonyStart = RMPoint(-1, -1), const RMPoint &start = RMPoint(-1, -1));
// Pauses sound
void PauseSound(bool bPause);

View file

@ -149,15 +149,10 @@ void RMInventory::Init(void) {
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); // Examine
m_hints[1].WriteText(msg2[0], 1); // Take
m_hints[2].WriteText(msg3[0], 1); // Use
/*
m_hints[0].WriteText("Examine",1);
m_hints[1].WriteText("Talk",1);
m_hints[2].WriteText("Use",1);
*/
// Prepare initial inventory
Prepare();
@ -251,7 +246,6 @@ void RMInventory::RemoveItem(int code) {
g_system->lockMutex(m_csModifyInterface);
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();
@ -260,8 +254,6 @@ void RMInventory::RemoveItem(int code) {
g_system->unlockMutex(m_csModifyInterface);
return;
}
//MessageBox(NULL,"Specified object is not in the inventory","INTERNAL ERROR",MB_OK|MB_ICONEXCLAMATION);
}
void RMInventory::AddItem(int code) {
@ -313,8 +305,6 @@ void RMInventory::Prepare(void) {
// Frecce
AddPrim(new RMGfxPrimitive(&m_items[29].icon, RMPoint(0, 0)));
AddPrim(new RMGfxPrimitive(&m_items[28].icon, RMPoint(640 - 64, 0)));
//AddPrim(new RMGfxPrimitive(&m_items[0].icon,RMPoint(0,0)));
}
bool RMInventory::MiniActive(void) {
@ -931,18 +921,12 @@ void RMInterface::Init(void) {
RMMessage msg3(15);
RMMessage msg4(16);
m_hints[0].WriteText(msg0[0], 1);
m_hints[1].WriteText(msg1[0], 1);
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(msg0[0], 1); // Take
m_hints[1].WriteText(msg1[0], 1); // Talk
m_hints[2].WriteText(msg2[0], 1); // Use
m_hints[3].WriteText(msg3[0], 1); // Examine
m_hints[4].WriteText(msg4[0], 1); // Show Yourself
m_bActive = false;
m_bPalesati = false;
m_lastHotZone = 0;

View file

@ -892,8 +892,6 @@ void RMWipe::WaitForFadeEnd(CORO_PARAM) {
}
void RMWipe::CloseFade(void) {
// m_bUnregister = true;
// WaitForSingleObject(m_hUnregistered,CORO_INFINITE);
m_wip0r.Unload();
}
@ -1122,7 +1120,6 @@ void RMCharacter::GoTo(CORO_PARAM, RMPoint destcoord, bool bReversed) {
olddx = dx;
olddy = dy;
// ResetEvent(hTonyEndMovement); @@@
CORO_END_CODE;
}
@ -1186,28 +1183,6 @@ RMPoint RMCharacter::Searching(char UP, char DOWN, char RIGHT, char LEFT, RMPoin
RMPoint RMCharacter::NearestPoint(const RMPoint &punto) {
/*
RMPoint tofind;
signed short difx,dify;
difx = m_pos.x-punto.x;
dify = m_pos.y-punto.y;
if ((difx>0) && (dify>0)) tofind=Searching(0,1,1,0,punto);
if ((difx>0) && (dify<0)) tofind=Searching(1,0,1,0,punto);
if ((difx<0) && (dify>0)) tofind=Searching(0,1,0,1,punto);
if ((difx<0) && (dify<0)) tofind=Searching(1,0,0,1,punto);
// Could be removed? Think @@@@
if ((difx= = 0) && (dify>0)) tofind=Searching(0,1,1,1,punto);
if ((difx= = 0) && (dify<0)) tofind=Searching(1,0,1,1,punto);
if ((dify= = 0) && (difx>0)) tofind=Searching(1,1,1,0,punto);
if ((dify= = 0) && (difx<0)) tofind=Searching(1,1,0,1,punto);
if ((dify= = 0) && (difx= = 0)) tofind=punto;
return tofind;
*/
return Searching(1, 1, 1, 1, punto);
}
@ -1547,8 +1522,6 @@ void RMCharacter::Stop(CORO_PARAM) {
break;
default:
// assert(0);
// MessageBox(NULL,"E' lo stesso errore di prima, ma non crasha","Ehi!",MB_OK);
SetPattern(PAT_STANDDOWN);
break;
}
@ -1989,28 +1962,12 @@ bool RMLocation::Load(const char *lpszFileName) {
*/
bool RMLocation::Load(Common::File &file) {
int size;
// byte *buf;
// uint32 dwReadBytes;
bool bRet;
// Calcola la lunghezza del file
size = file.size();
file.seek(0);
/*
// Alloca la memoria per caricare il file in memoria
buf=(LPBYTE)GlobalAlloc(GMEM_FIXED,size);
// Legge il file in memoria
ReadFile(hFile,buf,size,&dwReadBytes,0);
// Parsing del file, utilizzando la funzione di load da memorira
bRet=Load(buf);
// Free della memoria
GlobalFree(buf);
*/
RMFileStreamSlow fs;
fs.OpenFile(file);
@ -2112,10 +2069,6 @@ bool RMLocation::Load(RMDataStream &ds) {
ds >> m_items[i];
_vm->UnfreezeTime();
// Sets the initial pattern @@@ duplication!
//for (i = 0;i<m_nItems;i++)
// m_items[i].SetPattern(mpalQueryItemPattern(m_items[i].MpalCode()));
return ds.IsError();
}
@ -2147,9 +2100,6 @@ bool RMLocation::LoadLOX(RMDataStream &ds) {
// Initialise the surface, loading in the palette if necessary
m_buf->Init(ds, dimx, dimy, true);
// Check the size of the location
// assert(dimy!=512);
// Number of items
ds >> m_nItems;

View file

@ -311,15 +311,6 @@ void TonyEngine::PreloadSFX(int nChannel, const char *fn) {
_theSound.CreateSfx(&m_sfx[nChannel]);
/*
// Mette il path giusto
GetDataDirectory(DD_UTILSFX, path_buffer);
_splitpath(path_buffer,drive,dir,NULL,NULL);
_splitpath(fn,NULL,NULL,fname,ext);
_makepath(path_buffer,drive,dir,fname,ext);
m_sfx[nChannel]->LoadFile(path_buffer, FPCODEC_ADPCM);
*/
m_sfx[nChannel]->LoadFile(fn, FPCODEC_ADPCM);
}
@ -360,9 +351,6 @@ void TonyEngine::InitMusic() {
// csMusic = g_system->createMutex();
// Preload sound effects
// PreloadUtilSFX(0,"AccendiOpzione.ADP");
// PreloadUtilSFX(1,"ApriInterfaccia.ADP");
PreloadUtilSFX(0, "U01.ADP"); // Reversed!!
PreloadUtilSFX(1, "U02.ADP");
}