[Scummvm-git-logs] scummvm master -> e8595481d1e8da5bddc04d730becbc5750fe4a46

athrxx noreply at scummvm.org
Sun Nov 24 16:07:29 UTC 2024


This automated email contains information about 2 new commits which have been
pushed to the 'scummvm' repo located at https://github.com/scummvm/scummvm .

Summary:
5109cd081f KYRA: minor cleanup
e8595481d1 SCUMM: (IMS/Mac) - minor cleanup


Commit: 5109cd081f4efa2ffc6ec6c4e2592c57c15efedc
    https://github.com/scummvm/scummvm/commit/5109cd081f4efa2ffc6ec6c4e2592c57c15efedc
Author: athrxx (athrxx at scummvm.org)
Date: 2024-11-24T17:06:32+01:00

Commit Message:
KYRA: minor cleanup

(add/rename some constants, whitespace)

Changed paths:
    engines/kyra/engine/eobcommon.cpp
    engines/kyra/engine/eobcommon.h
    engines/kyra/engine/item.h
    engines/kyra/engine/items_eob.cpp
    engines/kyra/engine/kyra_lok.cpp
    engines/kyra/graphics/animator_lok.cpp
    engines/kyra/graphics/screen.cpp
    engines/kyra/graphics/screen.h
    engines/kyra/gui/gui_eob.cpp
    engines/kyra/gui/gui_mr.cpp
    engines/kyra/gui/saveload.cpp
    engines/kyra/resource/staticres.cpp
    engines/kyra/sequence/seqplayer_lok.cpp
    engines/kyra/sequence/sequences_darkmoon.cpp
    engines/kyra/sequence/sequences_lok.cpp
    engines/kyra/sequence/sequences_lol.cpp
    engines/kyra/sound/sound_pc98_darkmoon.cpp
    engines/kyra/text/text.cpp
    engines/kyra/text/text_lok.cpp
    engines/kyra/text/text_rpg.cpp


diff --git a/engines/kyra/engine/eobcommon.cpp b/engines/kyra/engine/eobcommon.cpp
index 0b3a3332bd7..741563676e9 100644
--- a/engines/kyra/engine/eobcommon.cpp
+++ b/engines/kyra/engine/eobcommon.cpp
@@ -2289,11 +2289,11 @@ int EoBCoreEngine::projectileWeaponAttack(int charIndex, Item item) {
 
 	Item ammoItem = 0;
 
-	if (ammoItemType == ITEM_TYPE_ARROW) {
+	if (ammoItemType == kItemTypeArrow) {
 		/* Fire arrow in hand first, then take from quiver. */
-		if (_characters[charIndex].inventory[0] && _items[_characters[charIndex].inventory[0]].type == ITEM_TYPE_ARROW)
+		if (_characters[charIndex].inventory[0] && _items[_characters[charIndex].inventory[0]].type == kItemTypeArrow)
 			SWAP(ammoItem, _characters[charIndex].inventory[0]);
-		else if (_characters[charIndex].inventory[1] && _items[_characters[charIndex].inventory[1]].type == ITEM_TYPE_ARROW)
+		else if (_characters[charIndex].inventory[1] && _items[_characters[charIndex].inventory[1]].type == kItemTypeArrow)
 			SWAP(ammoItem, _characters[charIndex].inventory[1]);
 		else if (_characters[charIndex].inventory[16])
 			ammoItem = getQueuedItem(&_characters[charIndex].inventory[16], 0, -1);
@@ -2378,7 +2378,7 @@ int EoBCoreEngine::calcCharacterDamage(int charIndex, int times, int itemOrPips,
 	}
 
 	if (flags & 4) {
-		if (checkInventoryForRings(charIndex, 3))
+		if (checkInventoryForRings(charIndex, kRingOfFeatherFalling))
 			s = 0;
 	}
 
@@ -2443,14 +2443,14 @@ bool EoBCoreEngine::isElf(int charIndex)
 
 bool EoBCoreEngine::isSword(Item item)
 {
-	return _items[item].type == ITEM_TYPE_LONG_SWORD || _items[item].type == ITEM_TYPE_SHORT_SWORD;
+	return _items[item].type == kItemTypeLongSword || _items[item].type == kItemTypeShortSword;
 }
 
 bool EoBCoreEngine::isBow(Item projectileWeapon)
 {
 	if (projectileWeapon == kItemNone) return false;
 	int projectileWeaopnType = normalizeProjectileWeaponType(_items[projectileWeapon].type);
-	return projectileWeaopnType == ITEM_TYPE_BOW;
+	return projectileWeaopnType == kItemTypeBow;
 }
 
 bool EoBCoreEngine::characterAttackHitTest(int charIndex, int monsterIndex, int item, int attackType, Item projectileWeapon) {
diff --git a/engines/kyra/engine/eobcommon.h b/engines/kyra/engine/eobcommon.h
index 27e286e412b..4a640ad0a06 100644
--- a/engines/kyra/engine/eobcommon.h
+++ b/engines/kyra/engine/eobcommon.h
@@ -34,14 +34,6 @@ class Keymap;
 
 namespace Kyra {
 
-const int8 ITEM_TYPE_BOW = 0;
-const int8 ITEM_TYPE_LONG_SWORD = 1;
-const int8 ITEM_TYPE_SHORT_SWORD = 2;
-const int8 ITEM_TYPE_SLING = 7;
-const int8 ITEM_TYPE_ARROW = 16;
-const int8 ITEM_TYPE_ROCK= 18;
-const int8 ITEM_TYPE_RATIONS = 31;
-
 #define releaseShpArr(shapes, num) \
 if (shapes) { \
 	for (int iii = 0; iii < num; iii++) { \
diff --git a/engines/kyra/engine/item.h b/engines/kyra/engine/item.h
index f8bba4020e6..0e3214a7048 100644
--- a/engines/kyra/engine/item.h
+++ b/engines/kyra/engine/item.h
@@ -28,13 +28,29 @@ namespace Kyra {
 
 typedef int16 Item;
 
-enum {
+enum ItemIndex : Item {
 	/**
 	 * Constant for invalid item.
 	 */
 	kItemNone = -1
 };
 
+enum ItemTypes : int8 {
+	kItemTypeBow = 0,
+	kItemTypeLongSword = 1,
+	kItemTypeShortSword = 2,
+	kItemTypeSling = 7,
+	kItemTypeArrow = 16,
+	kItemTypeRock = 18,
+	kItemTypeRations = 31
+};
+
+enum RingTypes : int8 {
+	kRingOfWizardry  = 1,
+	kRingOfSustenance  = 2,
+	kRingOfFeatherFalling = 3
+};
+
 } // End of namespace Kyra
 
 #endif
diff --git a/engines/kyra/engine/items_eob.cpp b/engines/kyra/engine/items_eob.cpp
index b8788efb353..315ca857a20 100644
--- a/engines/kyra/engine/items_eob.cpp
+++ b/engines/kyra/engine/items_eob.cpp
@@ -126,13 +126,13 @@ void EoBCoreEngine::loadItemDefs() {
 	 */
 	if (_flags.gameID == GI_EOB1 && _configADDRuleEnhancements) {
 		debugC(1, kDebugLevelMain, "patching EotB 1 bow   (%d), old dice S d%d, L d%d, new dice S d6, L d6",
-			   ITEM_TYPE_BOW, _itemTypes[ITEM_TYPE_BOW].dmgNumPipsS, _itemTypes[ITEM_TYPE_BOW].dmgNumPipsL);
-		_itemTypes[ITEM_TYPE_BOW].dmgNumPipsS = 6;
-		_itemTypes[ITEM_TYPE_BOW].dmgNumPipsL = 6;
+			   kItemTypeBow, _itemTypes[kItemTypeBow].dmgNumPipsS, _itemTypes[kItemTypeBow].dmgNumPipsL);
+		_itemTypes[kItemTypeBow].dmgNumPipsS = 6;
+		_itemTypes[kItemTypeBow].dmgNumPipsL = 6;
 		debugC(1, kDebugLevelMain, "patching EotB 1 sling (%d), old dice S d%d, L  d%d, new dice S d4, L d4",
-			   ITEM_TYPE_SLING, _itemTypes[ITEM_TYPE_SLING].dmgNumPipsS, _itemTypes[ITEM_TYPE_SLING].dmgNumPipsL);
-		_itemTypes[ITEM_TYPE_SLING].dmgNumPipsS = 4;
-		_itemTypes[ITEM_TYPE_SLING].dmgNumPipsL = 4;
+			   kItemTypeSling, _itemTypes[kItemTypeSling].dmgNumPipsS, _itemTypes[kItemTypeSling].dmgNumPipsL);
+		_itemTypes[kItemTypeSling].dmgNumPipsS = 4;
+		_itemTypes[kItemTypeSling].dmgNumPipsL = 4;
 	}
 
 	delete s;
diff --git a/engines/kyra/engine/kyra_lok.cpp b/engines/kyra/engine/kyra_lok.cpp
index 75a6a976025..f2331ae7f8f 100644
--- a/engines/kyra/engine/kyra_lok.cpp
+++ b/engines/kyra/engine/kyra_lok.cpp
@@ -488,7 +488,7 @@ void KyraEngine_LoK::mainLoop() {
 
 		if (_deathHandler != -1) {
 			snd_playWanderScoreViaMap(0, 1);
- 			snd_playSoundEffect(49);
+			snd_playSoundEffect(49);
 			if (_flags.platform == Common::kPlatformMacintosh)
 				_sound->playTrack(15);
 			_screen->setMouseCursor(1, 1, _shapes[0]);
diff --git a/engines/kyra/graphics/animator_lok.cpp b/engines/kyra/graphics/animator_lok.cpp
index 09753e01457..601dd033608 100644
--- a/engines/kyra/graphics/animator_lok.cpp
+++ b/engines/kyra/graphics/animator_lok.cpp
@@ -35,7 +35,7 @@ Animator_LoK::Animator_LoK(KyraEngine_LoK *vm, OSystem *system) {
 	_noDrawShapesFlag = 0;
 	_brandonDrawFrame = 0;
 	_brandonScaleX = _brandonScaleY = _brandonAnimSeqSizeWidth = _brandonAnimSeqSizeHeight = 0;
-	
+
 	_actorBkgBackUp[0] = new uint8[_screen->getRectSize(8, 69)]();
 	_actorBkgBackUp[1] = new uint8[_screen->getRectSize(8, 69)]();
 }
diff --git a/engines/kyra/graphics/screen.cpp b/engines/kyra/graphics/screen.cpp
index 606ca9f973a..0cab7c62bd2 100644
--- a/engines/kyra/graphics/screen.cpp
+++ b/engines/kyra/graphics/screen.cpp
@@ -570,7 +570,7 @@ void Screen::resetPagePtrsAndBuffers(int pageSize) {
 
 	int numPages = realPages.size();
 	uint32 bufferSize = numPages * _screenPageSize;
- 
+
 	uint8 *pos = new uint8[bufferSize]();
 	_pagePtrsBuff = pos;
 
diff --git a/engines/kyra/graphics/screen.h b/engines/kyra/graphics/screen.h
index fac6c4dffbf..fa9bcd794ab 100644
--- a/engines/kyra/graphics/screen.h
+++ b/engines/kyra/graphics/screen.h
@@ -372,7 +372,7 @@ class ChineseOneByteFontLoL final : public ChineseFont {
 public:
 	ChineseOneByteFontLoL(int pitch) : ChineseFont(pitch, 8, 14, 8, 16, 0, 0) { _pixelColorShading = false; }
 	void setStyles(int styles) override {}
-	
+
 private:
 	bool hasGlyphForCharacter(uint16 c) const override { return !(c & 0x80); }
 	uint32 getFontOffset(uint16 c) const override { return (c & 0x7F) * 14; }
@@ -421,7 +421,7 @@ public:
 	// already been filled. It will then try the next slot. So, unlike other fonts the
 	// subset fonts cannot be allowed to call the load method as often as they want
 	// (which we never did anyway - we only ever load each font exactly one time).
-	// But this also means that different 
+	// But this also means that different
 	bool load(Common::SeekableReadStream &data) override;
 
 	void setStyles(int styles) override;
diff --git a/engines/kyra/gui/gui_eob.cpp b/engines/kyra/gui/gui_eob.cpp
index cc88be56fdf..0783528fbd3 100644
--- a/engines/kyra/gui/gui_eob.cpp
+++ b/engines/kyra/gui/gui_eob.cpp
@@ -3591,7 +3591,7 @@ void GUI_EoB::runMemorizePrayMenu(int charIndex, int spellType) {
 				np[i] = _vm->_numSpellsMage[lv * _numPages + i];
 			avltyFlags = c->mageSpellsAvailableFlags;
 		}
-		if (_vm->checkInventoryForRings(charIndex, 1)) {
+		if (_vm->checkInventoryForRings(charIndex, kRingOfWizardry)) {
 			np[3] <<= 1;
 			np[4] <<= 1;
 		}
@@ -4191,7 +4191,7 @@ bool GUI_EoB::restParty() {
 							_vm->gui_drawCharPortraitWithStats(i);
 						}
 
-						if (!_vm->checkInventoryForRings(i, 2)) {
+						if (!_vm->checkInventoryForRings(i, kRingOfSustenance)) {
 							if (_vm->_characters[i].food <= 5) {
 								_vm->_characters[i].food = 0;
 								starving = true;
diff --git a/engines/kyra/gui/gui_mr.cpp b/engines/kyra/gui/gui_mr.cpp
index 304e4cd5200..0041cb4371e 100644
--- a/engines/kyra/gui/gui_mr.cpp
+++ b/engines/kyra/gui/gui_mr.cpp
@@ -238,7 +238,7 @@ void KyraEngine_MR::showInventory() {
 		_screen->copyRegion(0, 0, 0, y, 320, height, 2, 0, Screen::CR_NO_P_CHECK);
 		if (times++ == 0)
 			_screen->updateScreen();
-	
+
 		if (_inventoryScrollSpeed == 1 && times == 3) {
 			while (waitTill > _system->getMillis())
 				_system->delayMillis(10);
diff --git a/engines/kyra/gui/saveload.cpp b/engines/kyra/gui/saveload.cpp
index 61665019061..06fd48cb89c 100644
--- a/engines/kyra/gui/saveload.cpp
+++ b/engines/kyra/gui/saveload.cpp
@@ -250,7 +250,7 @@ Common::OutSaveFile *KyraEngine_v1::openSaveForWriting(const char *filename, con
 	out->writeSint32BE(td.tm_hour);
 	out->writeSint32BE(td.tm_mday);
 	out->writeSint32BE(td.tm_mon);
-	out->writeSint32BE(td.tm_year);		
+	out->writeSint32BE(td.tm_year);
 	out->writeSint32BE(td.tm_wday);
 
 	out->writeUint32BE(_totalPlaySecs);
diff --git a/engines/kyra/resource/staticres.cpp b/engines/kyra/resource/staticres.cpp
index 8840da5358c..70b93bdcfbd 100644
--- a/engines/kyra/resource/staticres.cpp
+++ b/engines/kyra/resource/staticres.cpp
@@ -313,7 +313,7 @@ const uint16 *StaticResource::loadRawDataBe16(int id, int &entries) {
 bool StaticResource::setLanguage(Common::Language lang, int id) {
 	if (lang == Common::UNK_LANG)
 		lang = _vm->gameFlags().lang;
-	
+
 	unloadId(id);
 
 	// load the ID map for our game
diff --git a/engines/kyra/sequence/seqplayer_lok.cpp b/engines/kyra/sequence/seqplayer_lok.cpp
index 207ab13ae8d..9ca53e18f4c 100644
--- a/engines/kyra/sequence/seqplayer_lok.cpp
+++ b/engines/kyra/sequence/seqplayer_lok.cpp
@@ -252,7 +252,7 @@ void SeqPlayer::s1_skip() {
 	uint32 vocPlayTime = _vm->snd_getVoicePlayTime();
 	if (vocPlayTime) {
 		if (((_system->getMillis() - _seqVocStartTimer) / _vm->tickLength()) < (val * (vocPlayTime / _vm->tickLength()) / 100))
-			_seqSkipCommand = false;		
+			_seqSkipCommand = false;
 	}
 }
 
diff --git a/engines/kyra/sequence/sequences_darkmoon.cpp b/engines/kyra/sequence/sequences_darkmoon.cpp
index 46202aa834f..f2f8c7b68ef 100644
--- a/engines/kyra/sequence/sequences_darkmoon.cpp
+++ b/engines/kyra/sequence/sequences_darkmoon.cpp
@@ -1596,7 +1596,7 @@ int DarkmoonSequenceHelper::hScroll(bool restart) {
 	}
 
 	_hScrollResumeTimeStamp = ct;
-	
+
 	if (state != _hScrollState) {
 		_screen->copyRegion(9, 8, 8, 8, 303, 128, 0, 0, Screen::CR_NO_P_CHECK);
 		_screen->copyRegion(state, 0, 311, 8, 1, 128, 2, 0, Screen::CR_NO_P_CHECK);
diff --git a/engines/kyra/sequence/sequences_lok.cpp b/engines/kyra/sequence/sequences_lok.cpp
index c996cc6eea6..77394ca4c95 100644
--- a/engines/kyra/sequence/sequences_lok.cpp
+++ b/engines/kyra/sequence/sequences_lok.cpp
@@ -1332,7 +1332,7 @@ void KyraEngine_LoK::seq_playCredits() {
 		}
 
 		line.font = _screen->_currentFont;
-		
+
 		if (alignment == 3)
 			line.x = alignX3 - _screen->getTextWidth((const char *)currentString);
 		else if (alignment == 4)
diff --git a/engines/kyra/sequence/sequences_lol.cpp b/engines/kyra/sequence/sequences_lol.cpp
index ad803e011c0..4a8863e23a2 100644
--- a/engines/kyra/sequence/sequences_lol.cpp
+++ b/engines/kyra/sequence/sequences_lol.cpp
@@ -42,7 +42,7 @@ int LoLEngine::processPrologue() {
 		setupPrologueData(true);
 		bool hasSave = false;
 		for (int i = 0; i < 20 && !hasSave; ++i) {
-			if (saveFileLoadable(i)) 
+			if (saveFileLoadable(i))
 				hasSave = true;
 		}
 		if (!hasSave || _flags.isDemo)
diff --git a/engines/kyra/sound/sound_pc98_darkmoon.cpp b/engines/kyra/sound/sound_pc98_darkmoon.cpp
index e1111d6c131..83ceb080fb5 100644
--- a/engines/kyra/sound/sound_pc98_darkmoon.cpp
+++ b/engines/kyra/sound/sound_pc98_darkmoon.cpp
@@ -133,7 +133,7 @@ void SoundPC98_Darkmoon::loadSoundFile(const Common::Path &name) {
 	uint16 instrOffs = READ_LE_UINT16(_soundData);
 	if (instrOffs >= 20600)
 		error("SoundPC98_Darkmoon::loadSoundFile(): Failed to load sound file '%s'", path.toString().c_str());
-	
+
 	_driver->loadFMInstruments(_soundData + instrOffs);
 	_driver->reset();
 }
diff --git a/engines/kyra/text/text.cpp b/engines/kyra/text/text.cpp
index cf1f9c44303..57c4c8a92f8 100644
--- a/engines/kyra/text/text.cpp
+++ b/engines/kyra/text/text.cpp
@@ -210,7 +210,7 @@ void TextDisplayer::printTalkTextMessage(const char *text, int x, int y, uint8 c
 
 	_talkMessageY = top;
 	_talkMessageH = (lineCount * _screen->getFontHeight() + (lineCount - 1) * _screen->_lineSpacing) + _langExtraSpacing;
-	
+
 	int x1 = 12;
 	int x2 = Screen::SCREEN_W - 12;
 	if (_vm->gameFlags().lang != Common::ZH_TWN || lineCount == 1)
diff --git a/engines/kyra/text/text_lok.cpp b/engines/kyra/text/text_lok.cpp
index a723b1055df..362a9f0debb 100644
--- a/engines/kyra/text/text_lok.cpp
+++ b/engines/kyra/text/text_lok.cpp
@@ -296,7 +296,7 @@ void KyraEngine_LoK::characterSays(int vocFile, const char *chatStr, int16 charN
 		_animator->restoreAllObjectBackgrounds();
 
 		_screen->copyRegion(8, _text->_talkMessageY, 8, 136, 304, _text->_talkMessageH, 2, 2);
-	
+
 		_text->printCharacterText(processedString, charNum, _characterList[charNum].x1);
 	}
 
diff --git a/engines/kyra/text/text_rpg.cpp b/engines/kyra/text/text_rpg.cpp
index 5b0a292f80c..31e88f4c3d0 100644
--- a/engines/kyra/text/text_rpg.cpp
+++ b/engines/kyra/text/text_rpg.cpp
@@ -359,7 +359,7 @@ void TextDisplayer_rpg::printLine(char *str) {
 
 		// HACK: In Chinese EOBII some characters overdraw the valid boundaries by one pixel
 		// (at least the ',' does). So, the original redraws the border here. We do the same
-		// since for now I don't have any good idea how to do this less ugly... 
+		// since for now I don't have any good idea how to do this less ugly...
 		if (_isChinese && _vm->_flags.gameID == GI_EOB2 && sdx == 7)
 			_screen->drawBox(3, 170, 290, 199, _vm->guiSettings()->colors.fill);
 
@@ -416,7 +416,7 @@ void TextDisplayer_rpg::printLine(char *str) {
 			s = strlen(str);
 			if ((lw + _textDimData[sdx].column) >= w) {
 				s -= ((lw + _textDimData[sdx].column - w) >> 3);
-				w -= _textDimData[sdx].column;	
+				w -= _textDimData[sdx].column;
 			}
 
 		} else if ((lw + _textDimData[sdx].column) >= w) {
@@ -436,7 +436,7 @@ void TextDisplayer_rpg::printLine(char *str) {
 				for (strPos = 0; strPos < s; ++strPos) {
 					uint8 c = str[strPos];
 					if (isTwoByteChar(c))
-						lw += (_screen->getCharWidth(c | (uint8)str[++strPos] << 8) + _textDimData[sdx].charSpacing);						
+						lw += (_screen->getCharWidth(c | (uint8)str[++strPos] << 8) + _textDimData[sdx].charSpacing);
 					else
 						lw += _screen->getCharWidth(c);
 


Commit: e8595481d1e8da5bddc04d730becbc5750fe4a46
    https://github.com/scummvm/scummvm/commit/e8595481d1e8da5bddc04d730becbc5750fe4a46
Author: athrxx (athrxx at scummvm.org)
Date: 2024-11-24T17:06:54+01:00

Commit Message:
SCUMM: (IMS/Mac) - minor cleanup

Changed paths:
    engines/scumm/imuse/drivers/macintosh.cpp


diff --git a/engines/scumm/imuse/drivers/macintosh.cpp b/engines/scumm/imuse/drivers/macintosh.cpp
index 8dd0ecba19c..6510a40d0a3 100644
--- a/engines/scumm/imuse/drivers/macintosh.cpp
+++ b/engines/scumm/imuse/drivers/macintosh.cpp
@@ -170,9 +170,9 @@ public:
 private:
 	bool loadInstruments(const char *const *fileNames, int numFileNames) override;
 	Common::SharedPtr<MacSndResource> getNoteRangeSndResource(uint16 id, byte note);
-	void setInstrument(DeviceChannel *c) override;
-	void recalcFrequency(DeviceChannel *c) override;
-	void recalcVolume(DeviceChannel *c) override;
+	void setInstrument(DeviceChannel *chan) override;
+	void recalcFrequency(DeviceChannel *chan) override;
+	void recalcVolume(DeviceChannel *chan) override;
 	void noteOffIntern(DeviceChannel *chan) override;
 
 	DeviceChannel *allocateChannel(const ChanControlNode *node) override;
@@ -873,28 +873,28 @@ Common::SharedPtr<MacSndResource> NewMacSoundSystem::getNoteRangeSndResource(uin
 	return res;
 }
 
-void NewMacSoundSystem::setInstrument(DeviceChannel *c) {
-	assert(c && c->node);
-	if (c->instr == nullptr || (c->node->number != 9 && c->prog != c->node->prog) || c->note != c->node->note) {
-		c->note = c->node->note;
-		c->prog = c->node->prog;
-		c->instr = (c->node->number == 9) ? getSndResource(6000 + c->note) : getNoteRangeSndResource(c->prog, c->note);
+void NewMacSoundSystem::setInstrument(DeviceChannel *chan) {
+	assert(chan && chan->node);
+	if (chan->instr == nullptr || (chan->node->number != 9 && chan->prog != chan->node->prog) || chan->note != chan->node->note) {
+		chan->note = chan->node->note;
+		chan->prog = chan->node->prog;
+		chan->instr = (chan->node->number == 9) ? getSndResource(6000 + chan->note) : getNoteRangeSndResource(chan->prog, chan->note);
 	}
 }
 
-void NewMacSoundSystem::recalcFrequency(DeviceChannel *c) {
-	assert(c && c->node);
-	if (c->node->number == 9)
-		c->frequency = 0x8000;
+void NewMacSoundSystem::recalcFrequency(DeviceChannel *chan) {
+	assert(chan && chan->node);
+	if (chan->node->number == 9)
+		chan->frequency = 0x8000;
 	else
-		c->recalcFrequency();
-	c->frequency = MacLowLevelPCMDriver::calcRate(0x56220000, c->rate , c->frequency);
-	//if (c->frequency == (uint32)-1)
+		chan->recalcFrequency();
+	chan->frequency = MacLowLevelPCMDriver::calcRate(0x56220000, chan->rate , chan->frequency);
+	//if (chan->frequency == (uint32)-1)
 	//	error("%s(): Frequency calculation failed", __FUNCTION__);
 }
 
-void NewMacSoundSystem::recalcVolume(DeviceChannel *c) {
-	assert(c && c->node);
+void NewMacSoundSystem::recalcVolume(DeviceChannel *chan) {
+	assert(chan && chan->node);
 
 	static const byte volumeTable[] = {
 		0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x02,
@@ -916,10 +916,10 @@ void NewMacSoundSystem::recalcVolume(DeviceChannel *c) {
 	};
 
 	if (_stereo) {
-		c->volumeL = (volumeTable[127 - (c->node->panPos >> 2)] * c->node->volume) >> 7;
-		c->volumeR = (volumeTable[96 + (c->node->panPos >> 2)] * c->node->volume) >> 7;
+		chan->volumeL = (volumeTable[127 - (chan->node->panPos >> 2)] * chan->node->volume) >> 7;
+		chan->volumeR = (volumeTable[96 + (chan->node->panPos >> 2)] * chan->node->volume) >> 7;
 	} else {
-		c->volumeL = c->node->volume;
+		chan->volumeL = chan->node->volume;
 	}
 
 	static const byte veloTable[] = {
@@ -941,14 +941,15 @@ void NewMacSoundSystem::recalcVolume(DeviceChannel *c) {
 		0x75, 0x76, 0x77, 0x79, 0x7a, 0x7b, 0x7d, 0x7f
 	};
 
-	if (c->release)
+	if (chan->release)
 		return;
 
-	c->totalLevelL = volumeTable[(veloTable[c->node->velocity] * c->volumeL) >> 7];
-	c->totalLevelR = volumeTable[(veloTable[c->node->velocity] * c->volumeR) >> 7];
+	chan->totalLevelL = volumeTable[(veloTable[chan->node->velocity] * chan->volumeL) >> 7];
+	chan->totalLevelR = volumeTable[(veloTable[chan->node->velocity] * chan->volumeR) >> 7];
 }
 
 void NewMacSoundSystem::noteOffIntern(DeviceChannel *chan) {
+	assert(chan && chan->node);
 	if (chan->node->number != 9)
 		chan->release = true;
 	chan->loopStart = nullptr;




More information about the Scummvm-git-logs mailing list