Skip to content

Commit

Permalink
MORTEVIELLE: Make use of _mem more homogeneous, fix a couple of error…
Browse files Browse the repository at this point in the history
…s in phoneme handling
  • Loading branch information
Strangerke committed Jul 20, 2013
1 parent 590edf7 commit fb448d7
Show file tree
Hide file tree
Showing 4 changed files with 19 additions and 20 deletions.
2 changes: 1 addition & 1 deletion engines/mortevielle/graphics.cpp
Expand Up @@ -937,7 +937,7 @@ void ScreenSurface::drawPicture(GfxSurface &surface, int x, int y) {
(x + surface.w) * 2, (y + surface.h) * 2));

// Get a lookup for the palette mapping
const byte *paletteMap = &_vm->_mem[kAdrPictureComp * 16 + 2];
const byte *paletteMap = &_vm->_mem[(kAdrPictureComp * 16) + 2];

// Loop through writing
for (int yp = 0; yp < surface.h; ++yp) {
Expand Down
4 changes: 2 additions & 2 deletions engines/mortevielle/outtext.cpp
Expand Up @@ -181,7 +181,7 @@ void TextHandler::loadAniFile(Common::String filename, int32 skipSize, int lengt
f.close();

for (int i = remainingSkipSize; i <= length + remainingSkipSize; ++i)
_vm->_mem[kAdrAni * 16 + i - remainingSkipSize] = _vm->_mem[(kAdrPictureDecomp * 16) + i];
_vm->_mem[(kAdrAni * 16) + i - remainingSkipSize] = _vm->_mem[(kAdrPictureDecomp * 16) + i];
}

void TextHandler::taffich() {
Expand Down Expand Up @@ -288,7 +288,7 @@ void TextHandler::taffich() {
loadDesFile(filename, lgt, handle);
if (_vm->_currGraphicalDevice == MODE_HERCULES) {
for (int i = 0; i <= 15; ++i) {
int palh = READ_LE_UINT16(&_vm->_mem[(kAdrPictureComp * 16) + ((i + 1) << 1)]);
int palh = READ_LE_UINT16(&_vm->_mem[(kAdrPictureComp * 16) + 2 + (i << 1)]);
alllum[i] = (palh & 15) + (((uint)palh >> 12) & 15) + (((uint)palh >> 8) & 15);
}
for (int i = 0; i <= 15; ++i) {
Expand Down
16 changes: 8 additions & 8 deletions engines/mortevielle/speech.cpp
Expand Up @@ -83,7 +83,7 @@ void SpeechManager::spfrac(int wor) {
}

void SpeechManager::charg_car(int &currWordNumb) {
int wor = swap(READ_LE_UINT16(&_vm->_mem[kAdrWord + currWordNumb]));
int wor = swap(READ_LE_UINT16(&_vm->_mem[(kAdrWord * 16) + currWordNumb]));
int int_ = wor & 0x3f; // 63

if ((int_ >= 0) && (int_ <= 13)) {
Expand Down Expand Up @@ -123,7 +123,7 @@ void SpeechManager::charg_car(int &currWordNumb) {


void SpeechManager::entroct(byte o) {
_vm->_mem[kAdrTroct * 16 + _ptr_oct] = o;
_vm->_mem[(kAdrTroct * 16) + _ptr_oct] = o;
++_ptr_oct;
}

Expand All @@ -145,7 +145,7 @@ void SpeechManager::regenbruit() {
int i = kOffsetB3 + 8590;
int j = 0;
do {
_cfiphBuffer[j] = READ_LE_UINT16(&_vm->_mem[kAdrNoise3 + i]);
_cfiphBuffer[j] = READ_LE_UINT16(&_vm->_mem[(kAdrNoise3 * 16) + i]);
i += 2;
++j;
} while (i < kOffsetB3 + 8790);
Expand All @@ -161,7 +161,7 @@ void SpeechManager::loadMusicSound() {
if (!f.open("sonmus.mor"))
error("Missing file - sonmus.mor");

f.read(&_vm->_mem[0x7414 * 16 + 0], 273);
f.read(&_vm->_mem[0x7414 * 16], 273);

_vm->_soundManager.decodeMusic(&_vm->_mem[0x7414 * 16], &_vm->_mem[kAdrNoise * 16], 273);
f.close();
Expand Down Expand Up @@ -194,10 +194,10 @@ void SpeechManager::loadNoise() {
if (!f.open("bruits")) //Translation: "noise"
error("Missing file - bruits");

f.read(&_vm->_mem[kAdrNoise * 16 + 0], 250);
f.read(&_vm->_mem[kAdrNoise * 16], 250);
for (i = 0; i <= 19013; ++i)
_vm->_mem[kAdrNoise * 16 + 32000 + i] = _vm->_mem[kAdrNoise5 + i];
f.read(&_vm->_mem[kAdrNoise1 * 16 + kOffsetB1], 149);
_vm->_mem[(kAdrNoise * 16) + 32000 + i] = _vm->_mem[(kAdrNoise5 * 16) + i];
f.read(&_vm->_mem[(kAdrNoise1 * 16) + kOffsetB1], 149);

f.close();
}
Expand Down Expand Up @@ -533,7 +533,7 @@ void SpeechManager::handlePhoneme() {
int endPos = swap(_cfiphBuffer[_phonemeNumb]) + deca[_typlec];
int wordCount = endPos - startPos;
for (int i = (uint)startPos >> 1, currWord = 0; i < (int)((uint)endPos >> 1); i++, currWord += 2)
WRITE_LE_UINT16(&_vm->_mem[kAdrWord + currWord], _cfiphBuffer[i]);
WRITE_LE_UINT16(&_vm->_mem[(kAdrWord * 16) + currWord], _cfiphBuffer[i]);

_ptr_oct = 0;
int currWord = 0;
Expand Down
17 changes: 8 additions & 9 deletions engines/mortevielle/utils.cpp
Expand Up @@ -2152,7 +2152,7 @@ void MortevielleEngine::loadBRUIT5() {
if (!f.open("bruit5"))
error("Missing file - bruit5");

f.read(&_mem[kAdrNoise5 * 16 + 0], 149 * 128);
f.read(&_mem[kAdrNoise5 * 16], 149 * 128);
f.close();
}

Expand Down Expand Up @@ -2212,8 +2212,8 @@ void MortevielleEngine::music() {
if (!fic.open("mort.img"))
error("Missing file - mort.img");

fic.read(&_mem[0x3800 * 16 + 0], 500);
fic.read(&_mem[0x47a0 * 16 + 0], 123);
fic.read(&_mem[0x3800 * 16], 500);
fic.read(&_mem[0x47a0 * 16], 123);
fic.close();

_soundManager.decodeMusic(&_mem[0x3800 * 16], &_mem[kAdrMusic * 16], 623);
Expand Down Expand Up @@ -2558,7 +2558,7 @@ void MortevielleEngine::displayControlMenu() {

void MortevielleEngine::pictout(int seg, int dep, int x, int y) {
GfxSurface surface;
surface.decode(&_mem[seg * 16 + dep]);
surface.decode(&_mem[(seg * 16) + dep]);

if (_currGraphicalDevice == MODE_HERCULES) {
_mem[(kAdrPictureComp * 16) + 2] = 0;
Expand Down Expand Up @@ -2589,20 +2589,20 @@ void MortevielleEngine::adzon() {
if (!f.open("dec.mor"))
error("Missing file - dec.mor");

f.read(&_mem[0x73a2 * 16 + 0], 1 * 1664);
f.read(&_mem[0x73a2 * 16], 1664);
f.close();
}

/**
* Returns the offset within the compressed image data resource of the desired image
*/
int MortevielleEngine::animof(int ouf, int num) {
int nani = _mem[kAdrAni * 16 + 1];
int nani = _mem[(kAdrAni * 16) + 1];
int aux = num;
if (ouf != 1)
aux += nani;

int animof_result = (nani << 2) + 2 + READ_BE_UINT16(&_mem[kAdrAni * 16 + (aux << 1)]);
int animof_result = (nani << 2) + 2 + READ_BE_UINT16(&_mem[(kAdrAni * 16) + (aux << 1)]);

return animof_result;
}
Expand Down Expand Up @@ -2981,11 +2981,10 @@ void MortevielleEngine::aniof(int ouf, int num) {
num = 3;
}

int ad = kAdrAni;
int offset = animof(ouf, num);

GfxSurface surface;
surface.decode(&_mem[ad * 16 + offset]);
surface.decode(&_mem[(kAdrAni * 16) + offset]);
_screenSurface.drawPicture(surface, 0, 12);

prepareScreenType1();
Expand Down

0 comments on commit fb448d7

Please sign in to comment.