diff options
| -rw-r--r-- | engines/tony/custom.cpp | 94 | ||||
| -rw-r--r-- | engines/tony/font.cpp | 40 | ||||
| -rw-r--r-- | engines/tony/game.cpp | 22 | ||||
| -rw-r--r-- | engines/tony/gfxcore.cpp | 87 | ||||
| -rw-r--r-- | engines/tony/gfxengine.cpp | 74 | ||||
| -rw-r--r-- | engines/tony/input.cpp | 50 | ||||
| -rw-r--r-- | engines/tony/inventory.cpp | 24 | ||||
| -rw-r--r-- | engines/tony/loc.cpp | 29 | ||||
| -rw-r--r-- | engines/tony/mpal/mpal.cpp | 6 | ||||
| -rw-r--r-- | engines/tony/tonychar.cpp | 6 | ||||
| -rw-r--r-- | engines/tony/window.cpp | 15 | 
11 files changed, 163 insertions, 284 deletions
| diff --git a/engines/tony/custom.cpp b/engines/tony/custom.cpp index 55f6cbe77d..209fc11212 100644 --- a/engines/tony/custom.cpp +++ b/engines/tony/custom.cpp @@ -218,7 +218,7 @@ int curChangedHotspot = 0;  struct {  	uint32 dwCode; -	uint32 nX,nY; +	uint32 nX, nY;  	void Save(Common::OutSaveFile *f) {  		f->writeUint32LE(dwCode); @@ -629,7 +629,7 @@ DECLARE_CUSTOM_FUNCTION(ChangeLocation)(uint32 nLoc, uint32 tX, uint32 tY, uint3  	Unfreeze(); -	h = mpalQueryDoAction(0,nLoc,0); +	h = mpalQueryDoAction(0, nLoc,0);  	if (!bNoOcchioDiBue) {    		WaitWipeEnd(); @@ -1079,18 +1079,18 @@ DECLARE_CUSTOM_FUNCTION(WaitForPatternEnd)(uint32 nItem, uint32, uint32, uint32)  DECLARE_CUSTOM_FUNCTION(SetTonyPosition)(uint32 nX, uint32 nY, uint32 nLoc, uint32) { -	Tony->SetPosition(RMPoint(nX,nY),nLoc); +	Tony->SetPosition(RMPoint(nX, nY), nLoc);  }  DECLARE_CUSTOM_FUNCTION(MoveTonyAndWait)(uint32 nX, uint32 nY, uint32, uint32) { -	Tony->Move(RMPoint(nX,nY)); +	Tony->Move(RMPoint(nX, nY));  	if (!bSkipIdle)  		Tony->WaitForEndMovement();  }  DECLARE_CUSTOM_FUNCTION(MoveTony)(uint32 nX, uint32 nY, uint32, uint32) { -	Tony->Move(RMPoint(nX,nY)); +	Tony->Move(RMPoint(nX, nY));  }  DECLARE_CUSTOM_FUNCTION(ScrollLocation)(uint32 nX, uint32 nY, uint32 sX, uint32 sY) { @@ -1103,22 +1103,20 @@ DECLARE_CUSTOM_FUNCTION(ScrollLocation)(uint32 nX, uint32 nY, uint32 sX, uint32  	pt=Loc->ScrollPosition(); -	while ((lx != 0 || ly != 0) && !bSkipIdle) 	{ -		if (lx>0) { -			lx -= (int32)sX; if (lx<0) lx = 0; +	while ((lx != 0 || ly != 0) && !bSkipIdle) { +		if (lx > 0) { +			lx -= (int32)sX; if (lx < 0) lx = 0;  			pt.Offset((int32)sX, 0); -		} else if (lx<0) { -			lx += (int32)sX; if (lx>0) lx = 0; +		} else if (lx < 0) { +			lx += (int32)sX; if (lx > 0) lx = 0;  			pt.Offset(-(int32)sX, 0);  		}  		if (ly > 0) { -			ly-=sY; if (ly<0) ly = 0; -			pt.Offset(0,sY); -		} -		else if (ly<0) -		{ -			ly+=sY; if (ly>0) ly = 0; +			ly -= sY; if (ly < 0) ly = 0; +			pt.Offset(0, sY); +		} else if (ly < 0) { +			ly += sY; if (ly > 0) ly = 0;  			pt.Offset(0, -(int32)sY);  		} @@ -1134,18 +1132,18 @@ DECLARE_CUSTOM_FUNCTION(ScrollLocation)(uint32 nX, uint32 nY, uint32 sX, uint32  DECLARE_CUSTOM_FUNCTION(SyncScrollLocation)(uint32 nX, uint32 nY, uint32 sX, uint32 sY) {  	int lx, ly; -	RMPoint pt,startpt; -	uint32 dwStartTime,dwCurTime,dwTotalTime; +	RMPoint pt, startpt; +	uint32 dwStartTime, dwCurTime, dwTotalTime;  	uint32 stepX, stepY; -	int dimx,dimy; +	int dimx, dimy;  	// Prende le coordinate di quanto scrollare  	lx=*((int*)&nX);  	ly=*((int*)&nY); -	dimx=lx; -	dimy=ly; -	if (lx<0) dimx = -lx; -	if (ly<0) dimy = -ly; +	dimx = lx; +	dimy = ly; +	if (lx < 0) dimx = -lx; +	if (ly < 0) dimy = -ly;  	stepX = sX;  	stepY = sY; @@ -1155,13 +1153,12 @@ DECLARE_CUSTOM_FUNCTION(SyncScrollLocation)(uint32 nX, uint32 nY, uint32 sX, uin    dwStartTime = timeGetTime();  	if (sX) -		dwTotalTime = dimx*(1000/35)/sX; +		dwTotalTime = dimx * (1000 / 35) / sX;  	else -		dwTotalTime = dimy*(1000/35)/sY; +		dwTotalTime = dimy * (1000 / 35) / sY; -	while ((lx != 0 || ly != 0) && !bSkipIdle) -	{ -   	dwCurTime=timeGetTime()-dwStartTime; +	while ((lx != 0 || ly != 0) && !bSkipIdle) { +		dwCurTime = _vm->GetTime() - dwStartTime;  		if (dwCurTime>dwTotalTime)  			break; @@ -1181,28 +1178,22 @@ DECLARE_CUSTOM_FUNCTION(SyncScrollLocation)(uint32 nX, uint32 nY, uint32 sX, uin  		}  /*		 -		sX = stepX * (dwCurTime-dwLastTime) / (1000/35); -		sY = stepY * (dwCurTime-dwLastTime) / (1000/35); +		sX = stepX * (dwCurTime-dwLastTime) / (1000 / 35); +		sY = stepY * (dwCurTime-dwLastTime) / (1000 / 35); -		if (lx>0) -		{ -			lx-=sX; if (lx<0) lx = 0; +		if (lx > 0) { +			lx-=sX; if (lx < 0) lx = 0;  			pt.Offset(sX,0); -		} -		else if (lx<0) -		{ -			lx+=sX; if (lx>0) lx = 0; +		} else if (lx < 0) { +			lx+=sX; if (lx > 0) lx = 0;  			pt.Offset(-sX,0);  		} -		if (ly>0) -		{ +		if (ly > 0) {  			ly-=sY; if (ly<0) ly = 0;  			pt.Offset(0,sY); -		} -		else if (ly<0) -		{ -			ly+=sY; if (ly>0) ly = 0; +		} else if (ly<0) { +			ly+=sY; if (ly > 0) ly = 0;  			pt.Offset(0,-sY);  		}  */ @@ -1218,12 +1209,12 @@ DECLARE_CUSTOM_FUNCTION(SyncScrollLocation)(uint32 nX, uint32 nY, uint32 sX, uin  	// Setta la posizione finale  	if (sX) { -		if (lx>0) +		if (lx > 0)  			pt.x = startpt.x + dimx;  		else  			pt.x = startpt.x - dimx;  	} else { -		if (ly>0) +		if (ly > 0)  			pt.y = startpt.y + dimy;  		else  			pt.y = startpt.y - dimy; @@ -1254,7 +1245,7 @@ DECLARE_CUSTOM_FUNCTION(ChangeHotspot)(uint32 dwCode, uint32 nX, uint32 nY, uint  		curChangedHotspot++;  	} -	Loc->GetItemFromCode(dwCode)->ChangeHotspot(RMPoint(nX,nY)); +	Loc->GetItemFromCode(dwCode)->ChangeHotspot(RMPoint(nX, nY));  } @@ -1274,7 +1265,7 @@ DECLARE_CUSTOM_FUNCTION(TremaSchermo)(uint32 nScosse, uint32, uint32, uint32) {  	dirx = 1;  	diry = 1; -	while (_vm->GetTime() < curTime + nScosse) 	{ +	while (_vm->GetTime() < curTime + nScosse) {  		WaitFrame();  		Freeze(); @@ -1359,7 +1350,7 @@ DECLARE_CUSTOM_FUNCTION(CharSendMessage)(uint32 nChar, uint32 dwMessage, uint32  	VoiceHeader *curVoc = SearchVoiceHeader(0, dwMessage);  	FPSFX *voice = NULL; -	if (curVoc) 	{ +	if (curVoc) {  		// Si posiziona all'interno del database delle voci all'inizio della prima  //		fseek(_vm->m_vdbFP, curVoc->offset, SEEK_SET);  		g_system->lockMutex(vdb); @@ -1734,7 +1725,7 @@ DECLARE_CUSTOM_FUNCTION(SendDialogMessage)(uint32 nPers, uint32 nMsg, uint32, ui  		parm = (MCharacter[nPers].curgroup * 10) + _vm->_randomSource.getRandomNumber(  			MCharacter[nPers].numtalks[MCharacter[nPers].curgroup] - 1) + 1; -		if (MCharacter[nPers].numtexts != 0 && MCharacter[nPers].bInTexts) 		{ +		if (MCharacter[nPers].numtexts != 0 && MCharacter[nPers].bInTexts) {  			MCharacter[nPers].numtexts--;  		} else {  			// Cerca di eseguire la funzione custom per inizializzare la parlata @@ -1849,9 +1840,8 @@ DECLARE_CUSTOM_FUNCTION(StartDialog)(uint32 nDialog, uint32 nStartGroup, uint32,  			;  		// Se c'e' una sola opzione, la fa automaticamente, e aspetta la prossima scelta -		if (num==1) -		{ -			mpalQueryDialogSelection(nChoice,sl[0]); +		if (num == 1) { +			mpalQueryDialogSelection(nChoice, sl[0]);  			GlobalFree(sl);  			continue;  		} diff --git a/engines/tony/font.cpp b/engines/tony/font.cpp index a0500047b6..4bfddc8d68 100644 --- a/engines/tony/font.cpp +++ b/engines/tony/font.cpp @@ -89,31 +89,24 @@ void RMFont::Load(const byte *buf, int nChars, int dimx, int dimy, uint32 palRes  	m_letter = new RMGfxSourceBuffer8RLEByte[nChars];  #if 0 -	if (nChars == 112 && palResID == RES_F_PAL) -	{ +	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) -	{ +	} 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) -	{ +	} else if (nChars == 112 && palResID == RES_F_CPAL) {  		// Font credits  		DumpFontBMP("font_credits.bmp", buf, nChars, dimx, dimy, RMRes(palResID));		  	}  #endif  	// Carichiamoce 'sto font -	for (int i = 0; i < nChars; i++) -	{ +	for (int i = 0; i < nChars; i++) {  		// Inizializza il buffer con le lettere  		m_letter[i].Init(buf + i * (dimx * dimy + 8) + 8, dimx, dimy);  		m_letter[i].LoadPaletteWA(palResID); @@ -261,8 +254,7 @@ void RMFontParla::Init(void) {  	lDefault = 13;  	hDefault = 18;  	Common::fill(&l2Table[0][0], &l2Table[0][0] + (256 * 256), '\0'); -	for (i = 0; i < 256; i++) -	{ +	for (i = 0; i < 256; i++) {  		cTable[i] = -1;  		lTable[i] = lDefault;  	} @@ -1042,8 +1034,7 @@ void RMFontCredits::Init(void) {  	hDefault=28;  	Common::fill(&l2Table[0][0], &l2Table[0][0] + (256 * 256), '\0'); -	for (i = 0; i < 256; i++) -	{ +	for (i = 0; i < 256; i++) {  		cTable[i] = -1;  		lTable[i] = lDefault;  	} @@ -1514,20 +1505,18 @@ void RMFontObj::Init(void) {  	hDefault = 30;  	Common::fill(&l2Table[0][0], &l2Table[0][0] + (256 * 256), '\0'); -	for (i = 0; i < 256; i++) -	{ +	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+0; +		cTable['a' + i] = i+0;  	}  	for (i = 0; i < 10; i++) -		cTable['0'+i] = i+26; +		cTable['0' + i] = i + 26;  	cTable[','] = 36;  	cTable[';'] = 37; @@ -2255,8 +2244,7 @@ void RMTextItemName::DoFrame(RMGfxTargetBuffer& bigBuf, RMLocation &loc, RMPoint  	WriteText(itemName, 1);  	// Se e' diverso dal precedente, e' il caso di aggiornare anche il puntatore con la WhichPointer -	if (lastItem != m_item) -	{ +	if (lastItem != m_item) {  		if (m_item == NULL)  			ptr.SetSpecialPointer(RMPointer::PTR_NONE);  		else { @@ -2395,7 +2383,7 @@ void RMDialogChoice::Prepare(void) {  	ptPos.Set(20,90); -	for (i = 0; i < m_numChoices; i++) 	{ +	for (i = 0; i < m_numChoices; i++) {  		AddPrim(new RMGfxPrimitive(&m_drawedStrings[i], ptPos));  		m_ptDrawStrings[i] = ptPos;  		ptPos.Offset(0,m_drawedStrings[i].Dimy() + 15); diff --git a/engines/tony/game.cpp b/engines/tony/game.cpp index 00bb81dcf4..6853c53bf0 100644 --- a/engines/tony/game.cpp +++ b/engines/tony/game.cpp @@ -398,8 +398,7 @@ void RMOptionScreen::RefreshAll(void) {  	if (m_bNoLoadSave)  		AddPrim(new RMGfxPrimitive(m_HideLoadSave,RMPoint(0, 401))); -	if (m_bQuitConfirm) -	{ +	if (m_bQuitConfirm) {  		AddPrim(new RMGfxPrimitive(m_QuitConfirm,RMPoint(270, 200)));  		m_ButtonQuitYes->AddToList(*this);  		m_ButtonQuitNo->AddToList(*this); @@ -568,9 +567,7 @@ void RMOptionScreen::InitState(void) {  		if (m_bAlterGfx) {  			assert(m_ButtonExit == NULL);  			m_ButtonExit = new RMOptionButton(20025, RMPoint(561, 406)); -		} -		else -		{ +		} else {  			assert(m_ButtonExit == NULL);  			m_ButtonExit = new RMOptionButton(20012, RMPoint(560, 404));  		} @@ -974,12 +971,12 @@ void RMOptionScreen::DoFrame(RMInput *input) {  			m_ButtonSoundMenu->DoFrame(mousePos, bLeftClick, bRightClick);  			// bottoni con grafica -			if (!m_bNoLoadSave) -			{ -#ifndef DEMO -				bRefresh |= m_ButtonLoad->DoFrame(mousePos, bLeftClick, bRightClick); -				bRefresh |= m_ButtonSave->DoFrame(mousePos, bLeftClick, bRightClick); -#endif				 +			if (!m_bNoLoadSave) { +				if (!_vm->getIsDemo()) { +					bRefresh |= m_ButtonLoad->DoFrame(mousePos, bLeftClick, bRightClick); +					bRefresh |= m_ButtonSave->DoFrame(mousePos, bLeftClick, bRightClick); +				} +  				bRefresh |= m_ButtonQuit->DoFrame(mousePos, bLeftClick, bRightClick);  			}  		} @@ -1207,8 +1204,7 @@ void RMOptionScreen::Draw(RMGfxTargetBuffer &bigBuf, RMGfxPrimitive *prim) {  			m_FadeY += FADE_SPEED;  		else  			m_FadeY += FADE_SPEED*SYNC; -		if (m_FadeY > 480) -		{ +		if (m_FadeY > 480) {  			m_FadeY = 480;  			m_FadeStep++;  		} diff --git a/engines/tony/gfxcore.cpp b/engines/tony/gfxcore.cpp index 1d289fbecc..a25c28a03d 100644 --- a/engines/tony/gfxcore.cpp +++ b/engines/tony/gfxcore.cpp @@ -198,13 +198,10 @@ bool RMGfxSourceBuffer::Clip2D(int &x1, int &y1, int &u, int &v, int &width, int  /*     OBSOLETE CODE:  -	if (buf == NULL) -	{ +	if (buf == NULL) {  		destw=RM_SX;  		desth=RM_SY; -	} -	else -	{ +	} else {  		destw = buf->Dimx();  		desth = buf->Dimy();  	} @@ -391,8 +388,7 @@ void RMGfxTargetBuffer::AddPrim(RMGfxPrimitive *prim) {  		otlist->next = NULL;  	}  	// Inserimento in testa -	else if (nPrior < otlist->prim->m_task->Priority()) -	{ +	else if (nPrior < otlist->prim->m_task->Priority()) {  		n->next = otlist;  		otlist = n;  	} else { @@ -452,8 +448,7 @@ int RMGfxSourceBufferPal::LoadPalette(const byte *buf) {  void RMGfxSourceBufferPal::PreparePalette(void) {  	int i; -	for (i = 0; i < 256; i++) -	{ +	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); @@ -575,16 +570,15 @@ void RMGfxSourceBuffer8::Draw(RMGfxTargetBuffer &bigBuf, RMGfxPrimitive *prim) {  		for (y = 0; y < height; y++) {  			raw = m_buf + (y + v) * m_dimx + u; -			for (x = 0;x<width;x+=2) -			{ +			for (x = 0; x < width; x += 2) {  				buf[0] = m_palFinal[raw[0]];  				buf[1] = m_palFinal[raw[1]]; -				buf+=2; -				raw+=2; +				buf += 2; +				raw += 2;  			} -			buf += bufx-width; +			buf += bufx - width;  		}  	}  } @@ -595,7 +589,7 @@ RMGfxSourceBuffer8::RMGfxSourceBuffer8(int dimx, int dimy, bool bUseDDraw)  }  RMGfxSourceBuffer8::RMGfxSourceBuffer8(bool bTrasp0) { -	m_bTrasp0=bTrasp0; +	m_bTrasp0 = bTrasp0;  } @@ -867,8 +861,7 @@ void RMGfxSourceBuffer8RLE::Draw(RMGfxTargetBuffer &bigBuf, RMGfxPrimitive *prim  	buf += y1*bigBuf.Dimx();  	// Looppone -	if (prim->IsFlipped()) -	{ +	if (prim->IsFlipped()) {  // Annulliamo il clipping orizzontale  //		width = m_dimx;  //		x1=prim->Dst().x1; @@ -877,30 +870,26 @@ void RMGfxSourceBuffer8RLE::Draw(RMGfxTargetBuffer &bigBuf, RMGfxPrimitive *prim  		u = m_dimx - (width+u);  		x1 = (prim->Dst().x1 + m_dimx - 1) - u; -		for (y = 0;y<height;y++) -		{ +		for (y = 0; y < height; y++) {  			// Decompressione -			RLEDecompressLineFlipped(buf+x1, src+2,u,width); +			RLEDecompressLineFlipped(buf + x1, src + 2, u, width);  			// Prossima linea  			src += READ_LE_UINT16(src);  			// Skippa alla linea successiva -			buf+=bigBuf.Dimx();		 +			buf += bigBuf.Dimx();		  		} -	} -	else -	{ -		for (y = 0;y<height;y++) -		{ +	} else { +		for (y = 0; y < height; y++) {  			// Decompressione -			RLEDecompressLine(buf+x1, src+2,u,width); +			RLEDecompressLine(buf + x1, src + 2, u, width);  			// Prossima linea  			src += READ_LE_UINT16(src);  			// Skippa alla linea successiva -			buf+=bigBuf.Dimx();		 +			buf += bigBuf.Dimx();		  		}  	}  } @@ -956,7 +945,7 @@ void RMGfxSourceBuffer8RLEByte::RLEDecompressLine(uint16 *dst, byte *src, int nS  		if (n == 0xFF)  			return; -		if (n >= nStartSkip) 		{ +		if (n >= nStartSkip) {  			dst += n - nStartSkip;  			nLength -= n - nStartSkip;  			if (nLength > 0) @@ -1012,8 +1001,7 @@ RLEByteDoAlpha:  RLEByteDoAlpha2:  		if (n > nLength)  			n = nLength; -		for (i = 0; i < n; i++) -		{ +		for (i = 0; i < n; i++) {  			r=(*dst >> 10) & 0x1F;  			g=(*dst >> 5) & 0x1F;  			b=*dst & 0x1F; @@ -1022,7 +1010,7 @@ RLEByteDoAlpha2:  			g=(g >> 2) + (alphaG >> 1);  			b=(b >> 2) + (alphaB >> 1); -			*dst++=(r<<10)|(g<<5)|b; +			*dst ++= (r << 10) | (g << 5) | b;  		}  		nLength -= n; @@ -1233,8 +1221,7 @@ void RMGfxSourceBuffer8RLEWord::RLEDecompressLine(uint16 *dst, byte *src, int nS  		n = READ_LE_UINT16(src);  		src += 2; -		if (n>=nStartSkip) -		{ +		if (n >= nStartSkip) {  			src += nStartSkip;  			n -= nStartSkip;  			goto RLEWordDoCopy2; @@ -1244,8 +1231,7 @@ void RMGfxSourceBuffer8RLEWord::RLEDecompressLine(uint16 *dst, byte *src, int nS  	} -	while (1) -	{ +	while (1) {  RLEWordDoTrasp:  		// Via il trasp di merda  		n = READ_LE_UINT16(src); @@ -1326,8 +1312,7 @@ void RMGfxSourceBuffer8RLEWord::RLEDecompressLineFlipped(uint16 *dst, byte *src,  		if (n == 0xFFFF)  			return; -		if (n>=nStartSkip) -		{ +		if (n >= nStartSkip) {  			dst -= n - nStartSkip;  			nLength -= n - nStartSkip; @@ -1344,8 +1329,7 @@ void RMGfxSourceBuffer8RLEWord::RLEDecompressLineFlipped(uint16 *dst, byte *src,  		n = READ_LE_UINT16(src);  		src += 2; -		if (n>=nStartSkip) -		{ +		if (n >= nStartSkip) {  			n -= nStartSkip;  			goto RLEWordFlippedDoAlpha2;  		} @@ -1440,7 +1424,7 @@ void RMGfxSourceBuffer8RLEWordAB::RLEDecompressLine(uint16 *dst, byte *src,  int  	int i, n;  	int r, g, b, r2, g2, b2; -	if (!bCfgTransparence) 	{ +	if (!bCfgTransparence) {  		RMGfxSourceBuffer8RLEWord::RLEDecompressLine(dst, src, nStartSkip, nLength);  		return;  	} @@ -1485,8 +1469,7 @@ void RMGfxSourceBuffer8RLEWordAB::RLEDecompressLine(uint16 *dst, byte *src,  int  		n = READ_LE_UINT16(src);  		src += 2; -		if (n >= nStartSkip) -		{ +		if (n >= nStartSkip) {  			src += nStartSkip;  			n -= nStartSkip;  			goto RLEWordDoCopy2; @@ -1549,18 +1532,18 @@ RLEWordDoCopy2:  		if (n > nLength)  			n = nLength; -		for (i = 0; i < n; i++)	{ -			r=(*dst >> 10) & 0x1F; -			g=(*dst >> 5) & 0x1F; -			b=*dst & 0x1F; +		for (i = 0; i < n; i++) { +			r = (*dst >> 10) & 0x1F; +			g = (*dst >> 5) & 0x1F; +			b = *dst & 0x1F; -			r2=(m_palFinal[*src] >> 10) & 0x1F; -			g2=(m_palFinal[*src] >> 5) & 0x1F; +			r2 = (m_palFinal[*src] >> 10) & 0x1F; +			g2 = (m_palFinal[*src] >> 5) & 0x1F;  			b2 = m_palFinal[*src] & 0x1F; -			r=(r >> 1) + (r2 >> 1); -			g=(g >> 1) + (g2 >> 1); -			b=(b >> 1) + (b2 >> 1); +			r = (r >> 1) + (r2 >> 1); +			g = (g >> 1) + (g2 >> 1); +			b = (b >> 1) + (b2 >> 1);  			*dst ++= (r << 10) | (g << 5) | b;  			src++; diff --git a/engines/tony/gfxengine.cpp b/engines/tony/gfxengine.cpp index d4ea8ee821..77a196f853 100644 --- a/engines/tony/gfxengine.cpp +++ b/engines/tony/gfxengine.cpp @@ -139,7 +139,7 @@ void RMGfxEngine::DoFrame(bool bDrawLocation) {  	// Poll dei dispositivi di input  	m_input.Poll(); -	if (m_bMustEnterMenu && bIdleExited) 	{ +	if (m_bMustEnterMenu && bIdleExited) {  		m_bOption = true;  		m_bMustEnterMenu = false;  		bIdleExited = false; @@ -216,8 +216,7 @@ void RMGfxEngine::DoFrame(bool bDrawLocation) {  				// CLICK SINISTRO  				// ************** -				if (m_input.MouseLeftClicked() && !m_inter.Active()) -				{ +				if (m_input.MouseLeftClicked() && !m_inter.Active()) {  					// Se clicko dentro un oggetto, esegui l'azione  					//if (m_itemName.IsItemSelected())  					{ @@ -383,8 +382,7 @@ void RMGfxEngine::ItemIrq(uint32 dwItem, int nPattern, int nStatus) {  	bool bEnableParent = false;  	m_ofn.hwndOwner = PreModal();  	AfxUnhookWindowCreate(); -	if (m_ofn.hwndOwner != NULL && ::IsWindowEnabled(m_ofn.hwndOwner)) -	{ +	if (m_ofn.hwndOwner != NULL && ::IsWindowEnabled(m_ofn.hwndOwner)) {  		bEnableParent = true;  		::EnableWindow(m_ofn.hwndOwner, false);  	} @@ -489,8 +487,7 @@ HANDLE RMGfxEngine::LoadLocation(int nLoc, RMPoint ptTonyStart, RMPoint start) {  			continue;  #if 0  		// codice per dumpare una locazione in caso serva una modifica -		if (nLoc == 106) -		{ +		if (nLoc == 106) {  			FILE *f = fopen("loc106.lox", "wb");  			fwrite(res.DataPointer(), res.Size(), 1, f);  			fclose(f); @@ -514,19 +511,17 @@ HANDLE RMGfxEngine::LoadLocation(int nLoc, RMPoint ptTonyStart, RMPoint start) {  	return INVALID_HANDLE_VALUE; //mpalQueryDoAction(0,m_nCurLoc,0);  } -HANDLE RMGfxEngine::UnloadLocation(bool bDoOnExit) -{ +HANDLE RMGfxEngine::UnloadLocation(bool bDoOnExit) {  	HANDLE h;  	// Scarica tutta la memoria della locazione  	mpalEndIdlePoll(m_nCurLoc);  	// On Exit? -	if (bDoOnExit) -	{ -		h=mpalQueryDoAction(1,m_nCurLoc,0); -		if (h!=INVALID_HANDLE_VALUE) -			WaitForSingleObject(h,INFINITE); +	if (bDoOnExit) { +		h = mpalQueryDoAction(1, m_nCurLoc, 0); +		if (h != INVALID_HANDLE_VALUE) +			WaitForSingleObject(h, INFINITE);  	}  	MainFreeze(); @@ -633,8 +628,7 @@ void RMGfxEngine::Init(/*HINSTANCE hInst*/) {  	//LoadLocation(40,RMPoint(233,441),RMPoint(-1,-1));  } -void RMGfxEngine::Close(void) -{ +void RMGfxEngine::Close(void) {  	m_bigBuf.ClearOT();  	m_inter.Close(); @@ -644,68 +638,36 @@ void RMGfxEngine::Close(void)  	m_input.Close();  } -void RMGfxEngine::SwitchFullscreen(bool bFull) -{ +void RMGfxEngine::SwitchFullscreen(bool bFull) {  	m_input.SwitchFullscreen(bFull);  } -void RMGfxEngine::GDIControl(bool bCon) -{ +void RMGfxEngine::GDIControl(bool bCon) {  	m_input.GDIControl(bCon);  } -/* -void RMGfxEngine::OptionScreen(void) -{ -	if (!m_bOption) -	{ -		if (m_opt.Init(m_bigBuf)) -		{ -			m_bOption = true; -			DisableInput(); -			EnableMouse(); -		} -	} -	else -	{ -		if (m_opt.Close()) -		{ -			m_bOption = false; -			DisableMouse(); -			EnableInput(); -		} -	} -} -*/ - -void RMGfxEngine::EnableInput(void) -{ +void RMGfxEngine::EnableInput(void) {  	m_bInput = true;  } -void RMGfxEngine::DisableInput(void) -{ +void RMGfxEngine::DisableInput(void) {  	m_bInput = false;  	m_inter.Reset();  } -void RMGfxEngine::EnableMouse(void) -{ +void RMGfxEngine::EnableMouse(void) {  	m_bAlwaysDrawMouse = true;  } -void RMGfxEngine::DisableMouse(void) -{ +void RMGfxEngine::DisableMouse(void) {  	m_bAlwaysDrawMouse = false;  } -void RMGfxEngine::Freeze(void) -{ +void RMGfxEngine::Freeze(void) {  	g_system->lockMutex(csMainLoop);  } -void RMGfxEngine::Unfreeze(void) -{ +void RMGfxEngine::Unfreeze(void) {  	g_system->unlockMutex(csMainLoop);  } diff --git a/engines/tony/input.cpp b/engines/tony/input.cpp index 72c7bf06f7..25f271d7eb 100644 --- a/engines/tony/input.cpp +++ b/engines/tony/input.cpp @@ -57,8 +57,7 @@ void RMInput::DIInit(/*HINSTANCE hInst*/) {  	// Crea l'oggetto madre  	err = DirectInputCreate(hInst, DIRECTINPUT_VERSION, &m_DI, NULL); -	if (err!=DI_OK) -	{ +	if (err!=DI_OK) {  		MessageBox(theGame.m_wnd,"Error initializing DirectInput!","RMInput::DIInit()",MB_OK);  		assert(0);  	} @@ -66,24 +65,21 @@ void RMInput::DIInit(/*HINSTANCE hInst*/) {  	// Crea il device del mouse  	// ************************  	err=m_DI->CreateDevice(GUID_SysMouse,&m_DIDMouse,NULL); -	if (err!=DI_OK) -	{ +	if (err!=DI_OK) {  		MessageBox(theGame.m_wnd,"Error creating mouse device!","RMInput::DIInit()",MB_OK);  		assert(0);  	}  	// Setta il data format  	err=m_DIDMouse->SetDataFormat(&c_dfDIMouse); -	if (err!=DI_OK) -	{ +	if (err!=DI_OK) {  		MessageBox(theGame.m_wnd,"Error setting mouse data format!","RMInput::DIInit()",MB_OK);  		assert(0);  	}		  	// Setta il cooperative level  	err=m_DIDMouse->SetCooperativeLevel(theGame.m_wnd,DISCL_FOREGROUND|DISCL_NONEXCLUSIVE); -	if (err!=DI_OK) -	{ +	if (err!=DI_OK) {  		MessageBox(theGame.m_wnd,"Error setting cooperative level!","RMInput::DIInit()",MB_OK);  		assert(0);  	}	 @@ -91,24 +87,21 @@ void RMInput::DIInit(/*HINSTANCE hInst*/) {  	// Crea il device della tastiera  	// *****************************  	err=m_DI->CreateDevice(GUID_SysKeyboard,&m_DIDKeyboard,NULL); -	if (err!=DI_OK) -	{ +	if (err!=DI_OK) {  		MessageBox(theGame.m_wnd,"Error creating keyboard device!","RMInput::DIInit()",MB_OK);  		assert(0);  	}  	// Setta il data format  	err=m_DIDKeyboard->SetDataFormat(&c_dfDIKeyboard); -	if (err!=DI_OK) -	{ +	if (err!=DI_OK) {  		MessageBox(theGame.m_wnd,"Error setting keyboard data format!","RMInput::DIInit()",MB_OK);  		assert(0);  	}	  	// Setta il cooperative level  	err=m_DIDKeyboard->SetCooperativeLevel(theGame.m_wnd,DISCL_FOREGROUND|DISCL_NONEXCLUSIVE); -	if (err!=DI_OK) -	{ +	if (err!=DI_OK) {  		MessageBox(theGame.m_wnd,"Error setting cooperative level!","RMInput::DIInit()",MB_OK);  		assert(0);  	} @@ -126,22 +119,17 @@ void RMInput::SwitchFullscreen(bool bFull) {  	//  cooperative level  	Unacquire(); -	if (bFull) -	{ +	if (bFull) {  		// Setta il cooperative level  		err=m_DIDMouse->SetCooperativeLevel(theGame.m_wnd,DISCL_FOREGROUND|DISCL_EXCLUSIVE); -		if (err!=DI_OK) -		{ +		if (err!=DI_OK) {  			MessageBox(theGame.m_wnd,"Error setting cooperative level!","RMInput::DIInit()",MB_OK);  			assert(0);  		}	 -	} -	else -	{ +	} else {  		// Setta il cooperative level  		err=m_DIDMouse->SetCooperativeLevel(theGame.m_wnd,DISCL_FOREGROUND|DISCL_EXCLUSIVE); -		if (err!=DI_OK) -		{ +		if (err!=DI_OK) {  			MessageBox(theGame.m_wnd,"Error setting cooperative level!","RMInput::DIInit()",MB_OK);  			assert(0);  		}	 @@ -197,13 +185,10 @@ void RMInput::Unacquire(void) {  void RMInput::GDIControl(bool bCon) {  #ifdef REFACTOR_ME -	if (bCon) -	{ +	if (bCon) {  		Unacquire();  		ShowCursor(true); -	} -	else -	{ +	} else {  		ShowCursor(false);  		Acquire();  	} @@ -220,14 +205,12 @@ void RMInput::Poll(void) {  	m_bLeftClickMouse=m_bLeftReleaseMouse=m_bRightClickMouse=m_bRightReleaseMouse=false;  	// Legge lo stato del mouse -	while (1) -	{ +	while (1) {  		ZeroMemory(&m_mState,sizeof(m_mState));  		err=m_DIDMouse->GetDeviceState(sizeof(m_mState),&m_mState);  		if (err==DI_OK)  			break; -		else if (err==DIERR_INPUTLOST || err==DIERR_NOTACQUIRED) -		{ +		else if (err==DIERR_INPUTLOST || err==DIERR_NOTACQUIRED) {  			ZeroMemory(&m_mState,sizeof(m_mState));  			// Se l'acquire non funziona (ad esempio, quando siamo in background, allora lasciamo perdere  			if (!Acquire()) @@ -242,8 +225,7 @@ void RMInput::Poll(void) {  	m_mY+=m_mState.lY;  	// Clamp dei valori sui bordi della finestra -	if (m_bClampMouse) -	{ +	if (m_bClampMouse) {  		if (m_mX<0) m_mX=0;  		if (m_mY<0) m_mY=0;  		if (m_mX>=640) m_mX=639; diff --git a/engines/tony/inventory.cpp b/engines/tony/inventory.cpp index 2ce88b1cec..50969afca8 100644 --- a/engines/tony/inventory.cpp +++ b/engines/tony/inventory.cpp @@ -121,8 +121,7 @@ void RMInventory::Init(void) {  		m_items[i].pointer=new RMGfxSourceBuffer8RLEByteAA[m_items[i].icon.NumPattern()]; -		for (j=0;j<m_items[i].icon.NumPattern();j++) -		{ +		for (j = 0; j < m_items[i].icon.NumPattern(); j++) {  			RMResRaw raw(curres);  			assert(raw.IsValid()); @@ -235,8 +234,7 @@ void RMInventory::RemoveItem(int code) {  	int i;  	for (i=0;i<m_nInv;i++) -		if (m_inv[i] == code-10000) -		{ +		if (m_inv[i] == code - 10000) {  			g_system->lockMutex(m_csModifyInterface);  			Common::copy_backward(&m_inv[i + 1], &m_inv[i + 1] + (m_nInv - i), &m_inv[i]); @@ -254,15 +252,13 @@ void RMInventory::RemoveItem(int code) {  }  void RMInventory::AddItem(int code) { -	if (code <= 10000 && code >= 10101) -	{ +	if (code <= 10000 && code >= 10101) {  		// Se siamo qui, vuol dire che stiamo aggiungendo un oggetto che non dovrebbe essere  		// nell'inventario  		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);  		} @@ -352,8 +348,7 @@ bool RMInventory::LeftClick(RMPoint mpos, int& nCombineObj) {  	}  	// Click sulla freccia destra -	if ((m_state == OPENED) && m_bBlinkingRight) -	{ +	if ((m_state == OPENED) && m_bBlinkingRight) {  		g_system->lockMutex(m_csModifyInterface);  		m_curPos++; @@ -408,11 +403,10 @@ void RMInventory::RightClick(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) -		{	 -			m_state=SELECTING; -			miniAction=0; -			m_nSelectObj=n-1; +		if (n > 0 && n < RM_SX / 64 - 1 && m_inv[n - 1 + m_curPos] != 0) {	 +			m_state = SELECTING; +			miniAction = 0; +			m_nSelectObj = n - 1;  			_vm->PlayUtilSFX(0);  		} diff --git a/engines/tony/loc.cpp b/engines/tony/loc.cpp index 141b993714..3d86b78f31 100644 --- a/engines/tony/loc.cpp +++ b/engines/tony/loc.cpp @@ -222,20 +222,15 @@ int RMPattern::Init(RMSfx *sfx, bool bPlayP0, byte *bFlag) {  	//  Se speed! = 0, suona solo quelli in loop  	for (i = 0;i < m_nSlots; i++) {  		if (m_slots[i].m_type == SOUND) { -			if (i == 0) -			{ -				if (sfx[m_slots[i].m_data].m_name[0]=='_') -				{ +			if (i == 0) { +				if (sfx[m_slots[i].m_data].m_name[0] == '_') {  	  			sfx[m_slots[i].m_data].SetVolume(m_slots[i].Pos().x);  					sfx[m_slots[i].m_data].Play(true); -				} -				else -				{ -	  			sfx[m_slots[i].m_data].SetVolume(m_slots[i].Pos().x); +				} else { +	  				sfx[m_slots[i].m_data].SetVolume(m_slots[i].Pos().x);  					sfx[m_slots[i].m_data].Play();  				} -			} -			else if (m_speed == 0) { +			} else if (m_speed == 0) {  				if (bPlayP0) {  	  				sfx[m_slots[i].m_data].SetVolume(m_slots[i].Pos().x);  					sfx[m_slots[i].m_data].Play(); @@ -330,8 +325,7 @@ RMPattern::RMPattern() {  }  RMPattern::~RMPattern() { -	if (m_slots != NULL) -	{ +	if (m_slots != NULL) {  		delete[] m_slots;  		m_slots = NULL;  	} @@ -807,8 +801,7 @@ bool RMItem::GetName(RMString& name)  void RMItem::Unload(void) { -	if (m_patterns != NULL) -	{ +	if (m_patterns != NULL) {  		delete[] m_patterns;  		m_patterns = NULL;  	} @@ -943,8 +936,7 @@ void RMWipe::DoFrame(RMGfxTargetBuffer &bigBuf) {  		m_bMustRegister = false;  	} -	if (m_bFading) -	{ +	if (m_bFading) {  		m_wip0r.DoFrame(&bigBuf, false);  		m_nFadeStep++; @@ -1671,8 +1663,7 @@ void RMBox::ReadFromStream(RMDataStream &ds) {  	ds >> bottom;  	// Adiacenza -	for (i = 0; i < MAXBOXES; i++) -	{ +	for (i = 0; i < MAXBOXES; i++) {  		ds >> adj[i];  	} @@ -2174,7 +2165,7 @@ RMItem *RMLocation::WhichItemIsIn(RMPoint pt) {  	int foundSize = 0;  	int size; -	for (int i = 0; i < m_nItems; i++) 	{ +	for (int i = 0; i < m_nItems; i++) {  		size = 0;  		if (m_items[i].IsIn(pt, &size)) {  			if (found == -1 || size < foundSize) { diff --git a/engines/tony/mpal/mpal.cpp b/engines/tony/mpal/mpal.cpp index b4b37e7723..74dbedd90f 100644 --- a/engines/tony/mpal/mpal.cpp +++ b/engines/tony/mpal/mpal.cpp @@ -2902,10 +2902,8 @@ case num:	\  		return DLG##num[nPers]; -char *GetPersonName(uint16 nDlg, int nPers) -{ -	switch (nDlg) -	{ +char *GetPersonName(uint16 nDlg, int nPers) { +	switch (nDlg) {  	HANDLE_DIALOG(10);  	HANDLE_DIALOG(51);  	HANDLE_DIALOG(52); diff --git a/engines/tony/tonychar.cpp b/engines/tony/tonychar.cpp index 493f10ef29..7809d9c080 100644 --- a/engines/tony/tonychar.cpp +++ b/engines/tony/tonychar.cpp @@ -126,7 +126,7 @@ void RMTony::DoFrame(RMGfxTargetBuffer *bigBuf, int curLoc) {  	// Esegue il movimento normale del personaggio  	int time = _vm->GetTime(); -	do 	{ +	do {  		m_nTimeLastStep += (1000 / 40);  		RMCharacter::DoFrame(bigBuf, curLoc); @@ -155,8 +155,8 @@ void RMTony::Hide(bool bShowOmbra) {  void RMTony::Draw(RMGfxTargetBuffer &bigBuf, RMGfxPrimitive *prim) {  	// Richiama il Draw() della classe madre se tony è visibile -	if (m_bShow && bDrawNow) 	{ -		if (m_bCorpoDavanti) 		{ +	if (m_bShow && bDrawNow) { +		if (m_bCorpoDavanti) {  			prim->Dst().SetEmpty();  			prim->Dst().Offset(-44, -134);  			if (m_bPastorella) diff --git a/engines/tony/window.cpp b/engines/tony/window.cpp index ab68030b90..a6dd20b875 100644 --- a/engines/tony/window.cpp +++ b/engines/tony/window.cpp @@ -102,8 +102,7 @@ LRESULT RMWindow::WindowProc(uint32 msg, uint16 wParam, int32 lParam) {  		return 0;  /*  		case WM_KEYDOWN: -			switch (wParam) -			{ +			switch (wParam) {  				case '0':  				case '1':  				case '2': @@ -180,12 +179,10 @@ LRESULT RMWindow::WindowProc(uint32 msg, uint16 wParam, int32 lParam) {  HANDLE hWaitFlip;  bool bExitThread; -void DoFlipThread(LPDIRECTDRAWSURFACE lpDDSPrimary) -{ +void DoFlipThread(LPDIRECTDRAWSURFACE lpDDSPrimary) {  	bExitThread=false; -	while (1) -	{ +	while (1) {  		WaitForSingleObject(hWaitFlip,INFINITE);  		if (bExitThread) _endthread();  		lpDDSPrimary->Flip(NULL,DDFLIP_WAIT); @@ -330,8 +327,7 @@ void RMWindow::CreateBWPrecalcTable(void) {  	CLAMP(shiftG, 0, 15);  	CLAMP(shiftB, 0, 15); -	for (i = 0;i<0x10000;i++) -	{ +	for (i = 0; i < 0x10000; i++) {  		r=(i >> shiftR) & 0x1F;  		g=(i >> shiftG) & 0x1F;  		b=(i >> shiftB) & 0x1F; @@ -412,8 +408,7 @@ void RMWindow::DDInit(void) {  #endif  /* -	if (!ISMODE1() && !ISMODE2() && !ISMODE3() && !ISMODE4()) -	{ +	if (!ISMODE1() && !ISMODE2() && !ISMODE3() && !ISMODE4()) {  		RMString str;  		str.Format("Graphic mode not supported: %04x %04x %04x",mskRed,mskGreen,mskBlue);  		MessageBox(m_hWnd,str,"Debug",MB_OK); | 
