diff options
author | Robert Göffringmann | 2003-06-09 02:33:27 +0000 |
---|---|---|
committer | Robert Göffringmann | 2003-06-09 02:33:27 +0000 |
commit | 68bb844d638b654d37c7f03ebc55a351de5229ff (patch) | |
tree | 5f8a418cc83db6c9a1cc5fd5c1c2760ed5a25705 /sky | |
parent | b7ddc7bc5765328f81628bb6b5e7083a0101971e (diff) | |
download | scummvm-rg350-68bb844d638b654d37c7f03ebc55a351de5229ff.tar.gz scummvm-rg350-68bb844d638b654d37c7f03ebc55a351de5229ff.tar.bz2 scummvm-rg350-68bb844d638b654d37c7f03ebc55a351de5229ff.zip |
some talk-related bugs fixed
svn-id: r8412
Diffstat (limited to 'sky')
-rw-r--r-- | sky/compact.cpp | 10 | ||||
-rw-r--r-- | sky/disk.cpp | 2 | ||||
-rw-r--r-- | sky/logic.cpp | 49 | ||||
-rw-r--r-- | sky/screen.cpp | 5 | ||||
-rw-r--r-- | sky/sound.cpp | 11 | ||||
-rw-r--r-- | sky/sound.h | 4 | ||||
-rw-r--r-- | sky/struc.h | 8 | ||||
-rw-r--r-- | sky/text.cpp | 7 | ||||
-rw-r--r-- | sky/text.h | 1 |
9 files changed, 70 insertions, 27 deletions
diff --git a/sky/compact.cpp b/sky/compact.cpp index f88e71b149..acd721f8ac 100644 --- a/sky/compact.cpp +++ b/sky/compact.cpp @@ -20,6 +20,12 @@ */ #include "stdafx.h" +#ifdef _MSC_VER +// disable warning "truncation of constant value". Some signed +// fields of the structs are saved as unsigned in the .h files +#pragma warning(disable : 4309) +#endif + #include "sky/compact.h" #include "sky/compacts/0compact.h" @@ -37,6 +43,10 @@ #include "sky/compacts/lincmenu.h" #include "sky/compacts/z_compac.h" +#ifdef _MSC_VER +#pragma warning(default : 4309) +#endif + #define COMPACT_SIZE (sizeof(compactOffsets)/sizeof(uint32)) #define EXTCOMPACT_SIZE (sizeof(extCompactOffsets)/sizeof(uint32)) #define MEGASET_SIZE (sizeof(megaSetOffsets)/sizeof(uint32)) diff --git a/sky/disk.cpp b/sky/disk.cpp index de82040b42..17fb77d5bc 100644 --- a/sky/disk.cpp +++ b/sky/disk.cpp @@ -351,7 +351,7 @@ void SkyDisk::fnMiniLoad(uint16 fileNum) { if (_loadedFilesList[cnt] == fileNum) return ; cnt++; } - _loadedFilesList[cnt] = fileNum; + _loadedFilesList[cnt] = fileNum & 0x7FFFU; _loadedFilesList[cnt + 1] = 0; SkyState::_itemList[fileNum & 2047] = (void**)loadFile(fileNum, NULL); } diff --git a/sky/logic.cpp b/sky/logic.cpp index 4295b126d6..cecfb378b9 100644 --- a/sky/logic.cpp +++ b/sky/logic.cpp @@ -1594,22 +1594,27 @@ bool SkyLogic::fnChooser(uint32 a, uint32 b, uint32 c) { uint16 width = ((dataFileHeader *)data)->s_width; width >>= 1; - for (uint16 i = height; i > 0; i--) { - for (uint16 j = width; j > 0; j--) { + data += sizeof(dataFileHeader); + + width--; + for (uint16 i = 0; i < height; i++) { + for (uint16 j = 0; j < width; j++) { if (!*data) // only change 0's *data = 1; - *data += 2; + data += 2; } data++; } - _compact->getToFlag = (uint16)(textNum & 0xffff); - _compact->downFlag = (uint16)(*p++ & 0xffff); // get animation number + Compact *textCompact = SkyState::fetchCompact(lowText.compactNum); + + textCompact->getToFlag = (uint16)textNum; + textCompact->downFlag = (uint16)*p++; // get animation number - _compact->status |= ST_MOUSE; // mouse detects + textCompact->status |= ST_MOUSE; // mouse detects - _compact->xcood = TOP_LEFT_X; // set coordinates - _compact->ycood = ycood; + textCompact->xcood = TOP_LEFT_X; // set coordinates + textCompact->ycood = ycood; ycood += 12; } @@ -1623,7 +1628,13 @@ bool SkyLogic::fnChooser(uint32 a, uint32 b, uint32 c) { } bool SkyLogic::fnHighlight(uint32 itemNo, uint32 pen, uint32 c) { - error("Stub: fnHighlight"); + pen -= 11; + pen ^= 1; + pen += 241; + Compact *textCompact = SkyState::fetchCompact(itemNo); + uint8 *sprData = (uint8*)SkyState::fetchItem(textCompact->flag); + _skyText->changeTextSpriteColour(sprData, (uint8)pen); + return true; } bool SkyLogic::fnTextKill(uint32 a, uint32 b, uint32 c) { @@ -2224,7 +2235,7 @@ bool SkyLogic::fnStartFx(uint32 sound, uint32 b, uint32 c) { } bool SkyLogic::fnStopFx(uint32 a, uint32 b, uint32 c) { - warning("Stub: fnStopFx"); + _skySound->fnStopFx(); return true; } @@ -2253,12 +2264,12 @@ bool SkyLogic::fnQuitToDos(uint32 a, uint32 b, uint32 c) { } bool SkyLogic::fnPauseFx(uint32 a, uint32 b, uint32 c) { - warning("Stub: fnPauseFx"); + _skySound->fnPauseFx(); return true; } bool SkyLogic::fnUnPauseFx(uint32 a, uint32 b, uint32 c) { - warning("Stub: fnUnPauseFx"); + _skySound->fnUnPauseFx(); return true; } @@ -2278,9 +2289,12 @@ void SkyLogic::stdSpeak(Compact *target, uint32 textNum, uint32 animNum, uint32 else //then it must be a value animPtr = (uint16 *)SkyState::fetchCompact(SkyTalkAnims::animTalkTableVal[animNum]); - target->offset = *animPtr++; - target->getToFlag = *animPtr++; - target->grafixProg = animPtr; + if (animPtr) { + target->offset = *animPtr++; + target->getToFlag = *animPtr++; + target->grafixProg = animPtr; + } else + target->grafixProg = 0; if (SkyState::isCDVersion()) _skySound->fnStartSpeech((uint16)textNum); @@ -2295,7 +2309,8 @@ void SkyLogic::stdSpeak(Compact *target, uint32 textNum, uint32 animNum, uint32 //create the x coordinate for the speech text //we need the talkers sprite information - _compact->screen = target->screen; //put our screen in + //_compact->screen = target->screen; + textCompact->screen = target->screen; //put our screen in if (_scriptVariables[SCREEN] == target->screen) { // Only use coordinates if we are on the current screen //talking on-screen @@ -2326,7 +2341,7 @@ void SkyLogic::stdSpeak(Compact *target, uint32 textNum, uint32 animNum, uint32 } else { //talking off-screen target->extCompact->spTextId = 0; //don't kill any text 'cos none was made - _compact->status = 0; //don't display text + textCompact->status = 0; //don't display text //_logicTalkButtonRelease = 1; } // In CD version, we're doing the timing by checking when the VOC has stopped playing. diff --git a/sky/screen.cpp b/sky/screen.cpp index 09b2efa8ed..0073176dcd 100644 --- a/sky/screen.cpp +++ b/sky/screen.cpp @@ -560,7 +560,6 @@ void SkyScreen::doSprites(uint8 layer) { uint8 *toBeDrawn = (uint8*)SkyState::fetchItem(spriteData->frame >> 6); if (!toBeDrawn) { printf("Spritedata %d not loaded!\n",spriteData->frame >> 6); - getchar(); spriteData->status = 0; } else { drawSprite(toBeDrawn, spriteData); @@ -570,7 +569,7 @@ void SkyScreen::doSprites(uint8 layer) { } } } - if (drawList[0] == 0xFFFF) + while (drawList[0] == 0xFFFF) drawList = (uint16*)SkyState::fetchCompact(drawList[1]); } } @@ -641,7 +640,7 @@ void SkyScreen::drawSprite(uint8 *spriteInfo, Compact *sprCompact) { } for (uint8 cnty = 0; cnty < _sprHeight; cnty++) { - for (uint8 cntx = 0; cntx < _sprWidth; cntx++) + for (uint16 cntx = 0; cntx < _sprWidth; cntx++) if (spriteData[cntx + _maskX1]) screenPtr[cntx] = spriteData[cntx + _maskX1]; spriteData += _sprWidth + _maskX2 + _maskX1; screenPtr += GAME_SCREEN_WIDTH; diff --git a/sky/sound.cpp b/sky/sound.cpp index 314a328377..297f2a88ab 100644 --- a/sky/sound.cpp +++ b/sky/sound.cpp @@ -1014,6 +1014,7 @@ SkySound::SkySound(SoundMixer *mixer, SkyDisk *pDisk) { _bgSoundHandle = 0; _ingameSound = 0; _ingameSpeech = 0; + _sfxPaused = false; } SkySound::~SkySound(void) { @@ -1093,8 +1094,14 @@ void SkySound::playSound(uint16 sound, uint16 volume) { _mixer->playRaw(&_ingameSound, _soundData + dataOfs, dataSize, sampleRate, flags); } +void SkySound::fnPauseFx(void) { + + if (_ingameSound) _mixer->stop(_ingameSound - 1); + _sfxPaused = true; +} + bool SkySound::fnStartFx(uint32 sound) { - if (sound < 256 || sound > MAX_FX_NUMBER) + if (sound < 256 || sound > MAX_FX_NUMBER || _sfxPaused) return true; uint8 screen = (uint8)(SkyLogic::_scriptVariables[SCREEN] & 0xff); @@ -1116,7 +1123,7 @@ bool SkySound::fnStartFx(uint32 sound) { // get fx volume - uint8 volume = 0x7f; // start with max vol + uint8 volume = 0x40; // start with max vol if (!SkyState::isCDVersion()) { // as long as we can't set the volume for sfx without changing the speech volume, diff --git a/sky/sound.h b/sky/sound.h index bcdb56f88f..c9127ad730 100644 --- a/sky/sound.h +++ b/sky/sound.h @@ -52,6 +52,9 @@ public: bool fnStartFx(uint32 sound); void fnStartSpeech(uint16 textNum); bool speechFinished(void) { return _ingameSpeech == 0; }; + void fnPauseFx(void); + void fnUnPauseFx(void) { _sfxPaused = false; }; + void fnStopFx(void) { if (_ingameSound) _mixer->stop(_ingameSound - 1); }; private: SkyDisk *_skyDisk; @@ -59,6 +62,7 @@ private: uint16 _sfxBaseOfs; uint8 *_soundData; uint8 *_sampleRates, *_sfxInfo; + bool _sfxPaused; static uint16 _speechConvertTable[8]; }; diff --git a/sky/struc.h b/sky/struc.h index 367c2d2700..85ae3b685a 100644 --- a/sky/struc.h +++ b/sky/struc.h @@ -43,8 +43,8 @@ struct dataFileHeader { uint16 s_sp_size; uint16 s_tot_size; uint16 s_n_sprites; - uint16 s_offset_x; - uint16 s_offset_y; + int16 s_offset_x; + int16 s_offset_y; uint16 s_compressed_size; }; @@ -134,8 +134,8 @@ struct Compact { uint16 mouseOff; uint16 mouseClick; // dword script - uint16 mouseRelX; - uint16 mouseRelY; + int16 mouseRelX; + int16 mouseRelY; uint16 mouseSizeX; uint16 mouseSizeY; diff --git a/sky/text.cpp b/sky/text.cpp index 54c2117246..ab81809796 100644 --- a/sky/text.cpp +++ b/sky/text.cpp @@ -408,7 +408,14 @@ lowTextManager_t SkyText::lowTextManager(uint32 textNum, uint16 width, uint16 lo ret.compactNum = (uint16)compactNum; return ret; +} + +void SkyText::changeTextSpriteColour(uint8 *sprData, uint8 newCol) { + dataFileHeader *header = (dataFileHeader*)sprData; + sprData += sizeof(dataFileHeader); + for (uint16 cnt = 0; cnt < header->s_sp_size; cnt++) + if (sprData[cnt] < 241) sprData[cnt] = newCol; } static const HuffTree huffTree_00267[] = { diff --git a/sky/text.h b/sky/text.h index 8d947ed766..581d1ce071 100644 --- a/sky/text.h +++ b/sky/text.h @@ -44,6 +44,7 @@ public: void fnTextModule(uint32 textInfoId, uint32 textNo); void fnPointerText(uint32 pointedId, uint16 mouseX, uint16 mouseY); void logicCursor(Compact *textCompact, uint16 mouseX, uint16 mouseY); + void changeTextSpriteColour(uint8 *sprData, uint8 newCol); protected: bool getTBit(); |