some talk-related bugs fixed

svn-id: r8412
This commit is contained in:
Robert Göffringmann 2003-06-09 02:33:27 +00:00
parent b7ddc7bc57
commit 68bb844d63
9 changed files with 70 additions and 27 deletions

View File

@ -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))

View File

@ -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);
}

View File

@ -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);
_compact->status |= ST_MOUSE; // mouse detects
textCompact->getToFlag = (uint16)textNum;
textCompact->downFlag = (uint16)*p++; // get animation number
_compact->xcood = TOP_LEFT_X; // set coordinates
_compact->ycood = ycood;
textCompact->status |= ST_MOUSE; // mouse detects
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.

View File

@ -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;

View File

@ -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,

View File

@ -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];
};

View File

@ -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;

View File

@ -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[] = {

View File

@ -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();