svn-id: r39147
This commit is contained in:
Joost Peters 2009-03-06 00:41:46 +00:00
parent 188d8f4414
commit 0c681f85a4
12 changed files with 107 additions and 125 deletions

View File

@ -50,7 +50,7 @@
namespace Sky {
ConResource::ConResource(void *pSpData, uint32 pNSprites, uint32 pCurSprite, uint16 pX, uint16 pY, uint32 pText, uint8 pOnClick, OSystem *system, uint8 *screen) {
_spriteData = (dataFileHeader *)pSpData;
_spriteData = (DataFileHeader *)pSpData;
_numSprites = pNSprites;
_curSprite = pCurSprite;
_x = pX;
@ -74,7 +74,7 @@ void ConResource::drawToScreen(bool doMask) {
if (!_spriteData)
return;
uint8 *spriteData = ((uint8 *)_spriteData) + sizeof(dataFileHeader);
uint8 *spriteData = ((uint8 *)_spriteData) + sizeof(DataFileHeader);
spriteData += _spriteData->s_sp_size * _curSprite;
if (doMask) {
for (uint16 cnty = 0; cnty < _spriteData->s_height; cnty++) {
@ -144,7 +144,7 @@ void TextResource::drawToScreen(bool doMask) {
uint8 *screenPos = _screen + _y * GAME_SCREEN_WIDTH + _x;
uint8 *copyDest = _oldScreen;
uint8 *copySrc = ((uint8 *)_spriteData) + sizeof(dataFileHeader);
uint8 *copySrc = ((uint8 *)_spriteData) + sizeof(DataFileHeader);
for (cnty = 0; cnty < cpHeight; cnty++) {
memcpy(copyDest, screenPos, cpWidth);
for (cntx = 0; cntx < cpWidth; cntx++)
@ -177,8 +177,8 @@ void ControlStatus::setToText(const char *newText) {
_statusText->flushForRedraw();
free(_textData);
}
displayText_t disText = _skyText->displayText(tmpLine, NULL, true, STATUS_WIDTH, 255);
_textData = (dataFileHeader *)disText.textData;
DisplayedText disText = _skyText->displayText(tmpLine, NULL, true, STATUS_WIDTH, 255);
_textData = (DataFileHeader *)disText.textData;
_statusText->setSprite(_textData);
_statusText->drawToScreen(WITH_MASK);
}
@ -186,8 +186,8 @@ void ControlStatus::setToText(const char *newText) {
void ControlStatus::setToText(uint16 textNum) {
if (_textData)
free(_textData);
displayText_t disText = _skyText->displayText(textNum, NULL, true, STATUS_WIDTH, 255);
_textData = (dataFileHeader *)disText.textData;
DisplayedText disText = _skyText->displayText(textNum, NULL, true, STATUS_WIDTH, 255);
_textData = (DataFileHeader *)disText.textData;
_statusText->setSprite(_textData);
_statusText->drawToScreen(WITH_MASK);
}
@ -343,12 +343,12 @@ void Control::buttonControl(ConResource *pButton) {
_textSprite = NULL;
_curButtonText = pButton->_text;
if (pButton->_text) {
displayText_t textRes;
DisplayedText textRes;
if (pButton->_text == 0xFFFF) // text for autosave button
textRes = _skyText->displayText(autoSave, NULL, false, PAN_LINE_WIDTH, 255);
else
textRes = _skyText->displayText(pButton->_text, NULL, false, PAN_LINE_WIDTH, 255);
_textSprite = (dataFileHeader *)textRes.textData;
_textSprite = (DataFileHeader *)textRes.textData;
_text->setSprite(_textSprite);
} else
_text->setSprite(NULL);
@ -605,13 +605,13 @@ bool Control::getYesNo(char *text) {
bool quitPanel = false;
uint8 mouseType = MOUSE_NORMAL;
uint8 wantMouse = MOUSE_NORMAL;
dataFileHeader *dlgTextDat;
DataFileHeader *dlgTextDat;
uint16 textY = MPNL_Y;
_yesNo->drawToScreen(WITH_MASK);
if (text) {
displayText_t dlgLtm = _skyText->displayText(text, NULL, true, _yesNo->_spriteData->s_width - 8, 37);
dlgTextDat = (dataFileHeader *)dlgLtm.textData;
DisplayedText dlgLtm = _skyText->displayText(text, NULL, true, _yesNo->_spriteData->s_width - 8, 37);
dlgTextDat = (DataFileHeader *)dlgLtm.textData;
textY = MPNL_Y + 44 + (28 - dlgTextDat->s_height) / 2;
} else
dlgTextDat = NULL;
@ -844,7 +844,7 @@ uint16 Control::saveRestorePanel(bool allowSave) {
bool withAutoSave = (lookListLen == 7);
Common::StringList saveGameTexts;
dataFileHeader *textSprites[MAX_ON_SCREEN + 1];
DataFileHeader *textSprites[MAX_ON_SCREEN + 1];
for (cnt = 0; cnt < MAX_ON_SCREEN + 1; cnt++)
textSprites[cnt] = NULL;
_firstText = 0;
@ -987,12 +987,12 @@ void Control::handleKeyPress(Common::KeyState kbd, Common::String &textBuf) {
}
}
void Control::setUpGameSprites(const Common::StringList &saveGameNames, dataFileHeader **nameSprites, uint16 firstNum, uint16 selectedGame) {
void Control::setUpGameSprites(const Common::StringList &saveGameNames, DataFileHeader **nameSprites, uint16 firstNum, uint16 selectedGame) {
char cursorChar[2] = "-";
displayText_t textSpr;
DisplayedText textSpr;
if (!nameSprites[MAX_ON_SCREEN]) {
textSpr = _skyText->displayText(cursorChar, NULL, false, 15, 0);
nameSprites[MAX_ON_SCREEN] = (dataFileHeader *)textSpr.textData;
nameSprites[MAX_ON_SCREEN] = (DataFileHeader *)textSpr.textData;
}
for (uint16 cnt = 0; cnt < MAX_ON_SCREEN; cnt++) {
char nameBuf[MAX_TEXT_LEN + 10];
@ -1002,7 +1002,7 @@ void Control::setUpGameSprites(const Common::StringList &saveGameNames, dataFile
textSpr = _skyText->displayText(nameBuf, NULL, false, PAN_LINE_WIDTH, 0);
else
textSpr = _skyText->displayText(nameBuf, NULL, false, PAN_LINE_WIDTH, 37);
nameSprites[cnt] = (dataFileHeader *)textSpr.textData;
nameSprites[cnt] = (DataFileHeader *)textSpr.textData;
if (firstNum + cnt == selectedGame) {
nameSprites[cnt]->flag = 1;
_enteredTextWidth = (uint16)textSpr.textWidth;
@ -1011,7 +1011,7 @@ void Control::setUpGameSprites(const Common::StringList &saveGameNames, dataFile
}
}
void Control::showSprites(dataFileHeader **nameSprites, bool allowSave) {
void Control::showSprites(DataFileHeader **nameSprites, bool allowSave) {
ConResource *drawResource = new ConResource(NULL, 1, 0, 0, 0, 0, 0, _system, _screenBuf);
for (uint16 cnt = 0; cnt < MAX_ON_SCREEN; cnt++) {
drawResource->setSprite(nameSprites[cnt]);
@ -1539,8 +1539,8 @@ void Control::delay(unsigned int amount) {
void Control::showGameQuitMsg(void) {
_skyText->fnSetFont(0);
uint8 *textBuf1 = (uint8 *)malloc(GAME_SCREEN_WIDTH * 14 + sizeof(dataFileHeader));
uint8 *textBuf2 = (uint8 *)malloc(GAME_SCREEN_WIDTH * 14 + sizeof(dataFileHeader));
uint8 *textBuf1 = (uint8 *)malloc(GAME_SCREEN_WIDTH * 14 + sizeof(DataFileHeader));
uint8 *textBuf2 = (uint8 *)malloc(GAME_SCREEN_WIDTH * 14 + sizeof(DataFileHeader));
uint8 *screenData;
if (_skyScreen->sequenceRunning())
_skyScreen->stopSequence();
@ -1549,8 +1549,8 @@ void Control::showGameQuitMsg(void) {
_skyText->displayText(_quitTexts[SkyEngine::_systemVars.language * 2 + 0], textBuf1, true, 320, 255);
_skyText->displayText(_quitTexts[SkyEngine::_systemVars.language * 2 + 1], textBuf2, true, 320, 255);
uint8 *curLine1 = textBuf1 + sizeof(dataFileHeader);
uint8 *curLine2 = textBuf2 + sizeof(dataFileHeader);
uint8 *curLine1 = textBuf1 + sizeof(DataFileHeader);
uint8 *curLine2 = textBuf2 + sizeof(DataFileHeader);
uint8 *targetLine = screenData + GAME_SCREEN_WIDTH * 80;
for (uint8 cnty = 0; cnty < PAN_CHAR_HEIGHT; cnty++) {
for (uint16 cntx = 0; cntx < GAME_SCREEN_WIDTH; cntx++) {

View File

@ -46,7 +46,7 @@ class MusicBase;
class Sound;
class SkyCompact;
struct Compact;
struct dataFileHeader;
struct DataFileHeader;
struct MegaSet;
#define MAX_SAVE_GAMES 999
@ -138,13 +138,13 @@ class ConResource {
public:
ConResource(void *pSpData, uint32 pNSprites, uint32 pCurSprite, uint16 pX, uint16 pY, uint32 pText, uint8 pOnClick, OSystem *system, uint8 *screen);
virtual ~ConResource(void) {}
void setSprite(void *pSpData) { _spriteData = (dataFileHeader*)pSpData; }
void setSprite(void *pSpData) { _spriteData = (DataFileHeader*)pSpData; }
void setText(uint32 pText) { if (pText) _text = pText + 0x7000; else _text = 0; }
void setXY(uint16 x, uint16 y) { _x = x; _y = y; }
bool isMouseOver(uint32 mouseX, uint32 mouseY);
virtual void drawToScreen(bool doMask);
dataFileHeader *_spriteData;
DataFileHeader *_spriteData;
uint32 _numSprites, _curSprite;
uint16 _x, _y;
uint32 _text;
@ -174,7 +174,7 @@ public:
void drawToScreen(void);
private:
TextResource *_statusText;
dataFileHeader *_textData;
DataFileHeader *_textData;
Text *_skyText;
OSystem *_system;
uint8 *_screenBuf;
@ -222,8 +222,8 @@ private:
void drawCross(uint16 x, uint16 y);
uint16 saveRestorePanel(bool allowSave);
void setUpGameSprites(const Common::StringList &saveGameNames, dataFileHeader **nameSprites, uint16 firstNum, uint16 selectedGame);
void showSprites(dataFileHeader **nameSprites, bool allowSave);
void setUpGameSprites(const Common::StringList &saveGameNames, DataFileHeader **nameSprites, uint16 firstNum, uint16 selectedGame);
void showSprites(DataFileHeader **nameSprites, bool allowSave);
void handleKeyPress(Common::KeyState kbd, Common::String &textBuf);
uint32 prepareSaveData(uint8 *destBuf);
@ -271,7 +271,7 @@ private:
ConResource *createResource(void *pSpData, uint32 pNSprites, uint32 pCurSprite, int16 pX, int16 pY, uint32 pText, uint8 pOnClick, uint8 panelType);
dataFileHeader *_textSprite;
DataFileHeader *_textSprite;
TextResource *_text;
ConResource *_controlPanel, *_exitButton, *_slide, *_slide2, *_slode;

View File

@ -120,7 +120,7 @@ uint8 *Disk::loadFile(uint16 fileNr) {
cflag = (uint8)((fileFlags >> 23) & 0x1);
//if cflag == 0 then file is compressed, 1 == uncompressed
dataFileHeader *fileHeader = (dataFileHeader*)fileDest;
DataFileHeader *fileHeader = (DataFileHeader*)fileDest;
if ((!cflag) && ((FROM_LE_16(fileHeader->flag) >> 7) & 1)) {
debug(2, "File is RNC compressed.");
@ -131,7 +131,7 @@ uint8 *Disk::loadFile(uint16 fileNr) {
uint8 *uncompDest = (uint8 *)malloc(decompSize);
int32 unpackLen;
void *output, *input = fileDest + sizeof(dataFileHeader);
void *output, *input = fileDest + sizeof(DataFileHeader);
if ((fileFlags >> 22) & 0x1) { //do we include the header?
// don't return the file's header
@ -139,17 +139,17 @@ uint8 *Disk::loadFile(uint16 fileNr) {
unpackLen = _rncDecoder.unpackM1(input, output, 0);
} else {
#ifdef SCUMM_BIG_ENDIAN
// Convert dataFileHeader to BE (it only consists of 16 bit words)
// Convert DataFileHeader to BE (it only consists of 16 bit words)
uint16 *headPtr = (uint16 *)fileDest;
for (uint i = 0; i < sizeof(struct dataFileHeader) / 2; i++)
for (uint i = 0; i < sizeof(DataFileHeader) / 2; i++)
*(headPtr + i) = READ_LE_UINT16(headPtr + i);
#endif
memcpy(uncompDest, fileDest, sizeof(dataFileHeader));
output = uncompDest + sizeof(dataFileHeader);
memcpy(uncompDest, fileDest, sizeof(DataFileHeader));
output = uncompDest + sizeof(DataFileHeader);
unpackLen = _rncDecoder.unpackM1(input, output, 0);
if (unpackLen)
unpackLen += sizeof(dataFileHeader);
unpackLen += sizeof(DataFileHeader);
}
debug(3, "UnpackM1 returned: %d", unpackLen);
@ -169,7 +169,7 @@ uint8 *Disk::loadFile(uint16 fileNr) {
#ifdef SCUMM_BIG_ENDIAN
if (!cflag) {
uint16 *headPtr = (uint16 *)fileDest;
for (uint i = 0; i < sizeof(struct dataFileHeader) / 2; i++)
for (uint i = 0; i < sizeof(DataFileHeader) / 2; i++)
*(headPtr + i) = READ_LE_UINT16(headPtr + i);
}
#endif

View File

@ -732,7 +732,7 @@ bool Intro::nextPart(uint16 *&data) {
// HACK: Fill the header with silence. We should
// probably use _skySound instead of calling playRaw()
// directly, but this will have to do for now.
memset(vData, 127, sizeof(struct dataFileHeader));
memset(vData, 127, sizeof(DataFileHeader));
_mixer->playRaw(Audio::Mixer::kSpeechSoundType, &_voice, vData, _skyDisk->_lastLoadedFileSize, 11025,
Audio::Mixer::FLAG_AUTOFREE | Audio::Mixer::FLAG_UNSIGNED, SOUND_VOICE);
return true;
@ -821,8 +821,8 @@ bool Intro::commandFlirt(uint16 *&data) {
_skyText->displayText(*data++, _textBuf, true, INTRO_TEXT_WIDTH, 255);
break;
case IC_SHOW_TEXT:
((dataFileHeader*)_textBuf)->s_x = *data++;
((dataFileHeader*)_textBuf)->s_y = *data++;
((DataFileHeader*)_textBuf)->s_x = *data++;
((DataFileHeader*)_textBuf)->s_y = *data++;
showTextBuf();
break;
case IC_REMOVE_TEXT:
@ -849,14 +849,14 @@ bool Intro::commandFlirt(uint16 *&data) {
}
void Intro::showTextBuf(void) {
uint16 x = ((dataFileHeader*)_textBuf)->s_x;
uint16 y = ((dataFileHeader*)_textBuf)->s_y;
uint16 width = ((dataFileHeader*)_textBuf)->s_width;
uint16 height = ((dataFileHeader*)_textBuf)->s_height;
uint16 x = ((DataFileHeader*)_textBuf)->s_x;
uint16 y = ((DataFileHeader*)_textBuf)->s_y;
uint16 width = ((DataFileHeader*)_textBuf)->s_width;
uint16 height = ((DataFileHeader*)_textBuf)->s_height;
uint8 *screenBuf = _skyScreen->giveCurrent() + y * GAME_SCREEN_WIDTH + x;
memcpy(_saveBuf, _textBuf, sizeof(dataFileHeader));
uint8 *saveBuf = _saveBuf + sizeof(dataFileHeader);
uint8 *textBuf = _textBuf + sizeof(dataFileHeader);
memcpy(_saveBuf, _textBuf, sizeof(DataFileHeader));
uint8 *saveBuf = _saveBuf + sizeof(DataFileHeader);
uint8 *textBuf = _textBuf + sizeof(DataFileHeader);
for (uint16 cnty = 0; cnty < height; cnty++) {
memcpy(saveBuf, screenBuf, width);
for (uint16 cntx = 0; cntx < width; cntx++)
@ -871,18 +871,18 @@ void Intro::showTextBuf(void) {
}
void Intro::restoreScreen(void) {
uint16 x = ((dataFileHeader*)_saveBuf)->s_x;
uint16 y = ((dataFileHeader*)_saveBuf)->s_y;
uint16 width = ((dataFileHeader*)_saveBuf)->s_width;
uint16 height = ((dataFileHeader*)_saveBuf)->s_height;
uint16 x = ((DataFileHeader*)_saveBuf)->s_x;
uint16 y = ((DataFileHeader*)_saveBuf)->s_y;
uint16 width = ((DataFileHeader*)_saveBuf)->s_width;
uint16 height = ((DataFileHeader*)_saveBuf)->s_height;
uint8 *screenBuf = _skyScreen->giveCurrent() + y * GAME_SCREEN_WIDTH + x;
uint8 *saveBuf = _saveBuf + sizeof(dataFileHeader);
uint8 *saveBuf = _saveBuf + sizeof(DataFileHeader);
for (uint16 cnt = 0; cnt < height; cnt++) {
memcpy(screenBuf, saveBuf, width);
screenBuf += GAME_SCREEN_WIDTH;
saveBuf += width;
}
_system->copyRectToScreen(_saveBuf + sizeof(dataFileHeader), width, x, y, width, height);
_system->copyRectToScreen(_saveBuf + sizeof(DataFileHeader), width, x, y, width, height);
}
bool Intro::escDelay(uint32 msecs) {

View File

@ -1766,18 +1766,18 @@ bool Logic::fnChooser(uint32 a, uint32 b, uint32 c) {
while (*p) {
uint32 textNum = *p++;
struct lowTextManager_t lowText = _skyText->lowTextManager(textNum, GAME_SCREEN_WIDTH, 0, 241, 0);
DisplayedText lowText = _skyText->lowTextManager(textNum, GAME_SCREEN_WIDTH, 0, 241, 0);
uint8 *data = lowText.textData;
// stipple the text
uint32 size = ((dataFileHeader *)data)->s_height * ((dataFileHeader *)data)->s_width;
uint32 size = ((DataFileHeader *)data)->s_height * ((DataFileHeader *)data)->s_width;
uint32 index = 0;
uint32 width = ((dataFileHeader *)data)->s_width;
uint32 height = ((dataFileHeader *)data)->s_height;
uint32 width = ((DataFileHeader *)data)->s_width;
uint32 height = ((DataFileHeader *)data)->s_height;
data += sizeof(dataFileHeader);
data += sizeof(DataFileHeader);
while (index < size) {
if (index % width <= 1)
@ -2179,7 +2179,6 @@ bool Logic::fnPersonHere(uint32 id, uint32 room, uint32 c) {
}
bool Logic::fnToggleMouse(uint32 a, uint32 b, uint32 c) {
_skyCompact->fetchCpt(a)->status ^= ST_MOUSE;
return true;
}
@ -2319,7 +2318,6 @@ bool Logic::fnLeaveSection(uint32 sectionNo, uint32 b, uint32 c) {
}
bool Logic::fnEnterSection(uint32 sectionNo, uint32 b, uint32 c) {
if (SkyEngine::isDemo() && (sectionNo > 2))
_skyControl->showGameQuitMsg();
@ -2378,8 +2376,7 @@ bool Logic::fnBlankScreen(uint32 a, uint32 b, uint32 c) {
}
bool Logic::fnPrintCredit(uint32 a, uint32 b, uint32 c) {
lowTextManager_t creditText = _skyText->lowTextManager(a, 240, 0, 248, true);
DisplayedText creditText = _skyText->lowTextManager(a, 240, 0, 248, true);
Compact *credCompact = _skyCompact->fetchCpt(creditText.compactNum);
credCompact->xcood = 168;
if ((a == 558) && (c == 215))
@ -2391,8 +2388,7 @@ bool Logic::fnPrintCredit(uint32 a, uint32 b, uint32 c) {
}
bool Logic::fnLookAt(uint32 a, uint32 b, uint32 c) {
struct lowTextManager_t textInfo = _skyText->lowTextManager(a, 240, 0, 248, true);
DisplayedText textInfo = _skyText->lowTextManager(a, 240, 0, 248, true);
Compact *textCpt = _skyCompact->fetchCpt(textInfo.compactNum);
textCpt->xcood = 168;
textCpt->ycood = (uint16)c;
@ -2414,7 +2410,6 @@ bool Logic::fnLookAt(uint32 a, uint32 b, uint32 c) {
}
bool Logic::fnLincTextModule(uint32 textPos, uint32 textNo, uint32 buttonAction) {
uint16 cnt;
if (buttonAction & 0x8000)
for (cnt = LINC_DIGIT_0; cnt <= LINC_DIGIT_9; cnt++)
@ -2423,7 +2418,7 @@ bool Logic::fnLincTextModule(uint32 textPos, uint32 textNo, uint32 buttonAction)
if (buttonAction < 10)
_scriptVariables[LINC_DIGIT_0 + buttonAction] = textNo;
lowTextManager_t text = _skyText->lowTextManager(textNo, 220, 0, 215, false);
DisplayedText text = _skyText->lowTextManager(textNo, 220, 0, 215, false);
Compact *textCpt = _skyCompact->fetchCpt(text.compactNum);
@ -2511,7 +2506,6 @@ bool Logic::fnPrintf(uint32 a, uint32 b, uint32 c) {
}
void Logic::stdSpeak(Compact *target, uint32 textNum, uint32 animNum, uint32 base) {
animNum += target->megaSet / NEXT_MEGA_SET;
animNum &= 0xFF;
@ -2543,7 +2537,7 @@ void Logic::stdSpeak(Compact *target, uint32 textNum, uint32 animNum, uint32 bas
if ((SkyEngine::_systemVars.systemFlags & SF_ALLOW_TEXT) || !speechFileFound) {
// form the text sprite, if player wants subtitles or
// if we couldn't find the speech file
struct lowTextManager_t textInfo;
DisplayedText textInfo;
textInfo = _skyText->lowTextManager(textNum, FIXED_TEXT_WIDTH, 0, (uint8)target->spColour, true);
Compact *textCompact = _skyCompact->fetchCpt(textInfo.compactNum);
target->spTextId = textInfo.compactNum; //So we know what text to kill
@ -2556,8 +2550,8 @@ void Logic::stdSpeak(Compact *target, uint32 textNum, uint32 animNum, uint32 bas
//create the x coordinate for the speech text
//we need the talkers sprite information
byte *targetGfx = (byte *)SkyEngine::fetchItem(target->frame >> 6);
uint16 xPos = target->xcood + ((struct dataFileHeader *)targetGfx)->s_offset_x;
uint16 width = (((struct dataFileHeader *)targetGfx)->s_width >> 1);
uint16 xPos = target->xcood + ((DataFileHeader *)targetGfx)->s_offset_x;
uint16 width = (((DataFileHeader *)targetGfx)->s_width >> 1);
xPos += width - (FIXED_TEXT_WIDTH / 2); //middle of talker
@ -2571,7 +2565,7 @@ void Logic::stdSpeak(Compact *target, uint32 textNum, uint32 animNum, uint32 bas
}
textCompact->xcood = xPos;
uint16 yPos = target->ycood + ((struct dataFileHeader *)targetGfx)->s_offset_y - 6 - ((struct dataFileHeader *)textGfx)->s_height;
uint16 yPos = target->ycood + ((DataFileHeader *)targetGfx)->s_offset_y - 6 - ((DataFileHeader *)textGfx)->s_height;
if (yPos < TOP_LEFT_Y)
yPos = TOP_LEFT_Y;

View File

@ -206,11 +206,11 @@ void Mouse::spriteMouse(uint16 frameNum, uint8 mouseX, uint8 mouseY) {
_currentCursor = frameNum;
byte *newCursor = _miceData;
newCursor += ((struct dataFileHeader *)_miceData)->s_sp_size * frameNum;
newCursor += sizeof(struct dataFileHeader);
newCursor += ((DataFileHeader *)_miceData)->s_sp_size * frameNum;
newCursor += sizeof(DataFileHeader);
uint16 mouseWidth = ((struct dataFileHeader *)_miceData)->s_width;
uint16 mouseHeight = ((struct dataFileHeader *)_miceData)->s_height;
uint16 mouseWidth = ((DataFileHeader *)_miceData)->s_width;
uint16 mouseHeight = ((DataFileHeader *)_miceData)->s_height;
CursorMan.replaceCursor(newCursor, mouseWidth, mouseHeight, mouseX, mouseY, 0);
if (frameNum == MOUSE_BLANK)
@ -321,12 +321,12 @@ void Mouse::fnOpenCloseHand(bool open) {
if (open)
cursor++;
uint32 size = ((dataFileHeader*)_objectMouseData)->s_sp_size;
uint32 size = ((DataFileHeader*)_objectMouseData)->s_sp_size;
uint8 *srcData;
uint8 *destData;
srcData = (uint8 *)_objectMouseData + size * cursor + sizeof(dataFileHeader);
destData = (uint8 *)_miceData + sizeof(dataFileHeader);
srcData = (uint8 *)_objectMouseData + size * cursor + sizeof(DataFileHeader);
destData = (uint8 *)_miceData + sizeof(DataFileHeader);
memcpy(destData, srcData, size);
spriteMouse(0, 5, 5);
}

View File

@ -540,8 +540,8 @@ void Screen::sortSprites(void) {
Compact *spriteComp = _skyCompact->fetchCpt(drawListData[0]);
if ((spriteComp->status & 4) && // is it sortable playfield?(!?!)
(spriteComp->screen == Logic::_scriptVariables[SCREEN])) { // on current screen
dataFileHeader *spriteData =
(dataFileHeader *)SkyEngine::fetchItem(spriteComp->frame >> 6);
DataFileHeader *spriteData =
(DataFileHeader *)SkyEngine::fetchItem(spriteComp->frame >> 6);
if (!spriteData) {
debug(9,"Missing file %d", spriteComp->frame >> 6);
spriteComp->status = 0;
@ -630,12 +630,12 @@ void Screen::drawSprite(uint8 *spriteInfo, Compact *sprCompact) {
sprCompact->status = 0;
return;
}
dataFileHeader *sprDataFile = (dataFileHeader *)spriteInfo;
DataFileHeader *sprDataFile = (DataFileHeader *)spriteInfo;
_sprWidth = sprDataFile->s_width;
_sprHeight = sprDataFile->s_height;
_maskX1 = _maskX2 = 0;
uint8 *spriteData = spriteInfo + (sprCompact->frame & 0x3F) * sprDataFile->s_sp_size;
spriteData += sizeof(dataFileHeader);
spriteData += sizeof(DataFileHeader);
int32 spriteY = sprCompact->ycood + sprDataFile->s_offset_y - TOP_LEFT_Y;
if (spriteY < 0) {
spriteY = -spriteY;

View File

@ -41,7 +41,7 @@ class Disk;
class SkyEngine;
class SkyCompact;
struct Compact;
struct dataFileHeader;
struct DataFileHeader;
#define SCROLL_JUMP 16
#define VGA_COLOURS 256
@ -54,7 +54,7 @@ struct dataFileHeader;
typedef struct {
uint16 yCood;
Compact *compact;
dataFileHeader *sprite;
DataFileHeader *sprite;
} StSortList;
class Screen {

View File

@ -1029,7 +1029,6 @@ Sound::Sound(Audio::Mixer *mixer, Disk *pDisk, uint8 pVolume) {
}
Sound::~Sound(void) {
_mixer->stopAll();
if (_soundData)
free(_soundData);
@ -1038,9 +1037,9 @@ Sound::~Sound(void) {
void Sound::playSound(uint32 id, byte *sound, uint32 size, Audio::SoundHandle *handle) {
byte flags = 0;
flags |= Audio::Mixer::FLAG_UNSIGNED|Audio::Mixer::FLAG_AUTOFREE;
size -= sizeof(struct dataFileHeader);
size -= sizeof(DataFileHeader);
byte *buffer = (byte *)malloc(size);
memcpy(buffer, sound+sizeof(struct dataFileHeader), size);
memcpy(buffer, sound+sizeof(DataFileHeader), size);
_mixer->stopID(id);
_mixer->playRaw(Audio::Mixer::kSFXSoundType, handle, buffer, size, 11025, flags, id);
@ -1226,9 +1225,9 @@ bool Sound::startSpeech(uint16 textNum) {
return false;
}
uint32 speechSize = ((dataFileHeader *)speechData)->s_tot_size - sizeof(dataFileHeader);
uint32 speechSize = ((DataFileHeader *)speechData)->s_tot_size - sizeof(DataFileHeader);
uint8 *playBuffer = (uint8 *)malloc(speechSize);
memcpy(playBuffer, speechData + sizeof(dataFileHeader), speechSize);
memcpy(playBuffer, speechData + sizeof(DataFileHeader), speechSize);
free(speechData);

View File

@ -28,20 +28,15 @@
namespace Sky {
struct lowTextManager_t {
struct DisplayedText {
byte *textData;
uint32 textWidth;
uint16 compactNum;
};
struct displayText_t {
byte *textData;
uint32 textWidth;
};
#include "common/pack-start.h" // START STRUCT PACKING
struct dataFileHeader {
struct DataFileHeader {
uint16 flag; // bit 0: set for colour data, clear for not
// bit 1: set for compressed, clear for uncompressed
// bit 2: set for 32 colours, clear for 16 colours

View File

@ -87,7 +87,7 @@ Text::~Text(void) {
}
void Text::fnSetFont(uint32 fontNr) {
struct charSet *newCharSet;
charSet *newCharSet;
switch (fontNr) {
case 0:
@ -112,7 +112,7 @@ void Text::fnSetFont(uint32 fontNr) {
void Text::fnTextModule(uint32 textInfoId, uint32 textNo) {
fnSetFont(1);
uint16* msgData = (uint16 *)_skyCompact->fetchCpt(textInfoId);
lowTextManager_t textId = lowTextManager(textNo, msgData[1], msgData[2], 209, false);
DisplayedText textId = lowTextManager(textNo, msgData[1], msgData[2], 209, false);
Logic::_scriptVariables[RESULT] = textId.compactNum;
Compact *textCompact = _skyCompact->fetchCpt(textId.compactNum);
textCompact->xcood = msgData[3];
@ -183,7 +183,7 @@ void Text::getText(uint32 textNr) { //load text #"textNr" into textBuffer
void Text::fnPointerText(uint32 pointedId, uint16 mouseX, uint16 mouseY) {
Compact *ptrComp = _skyCompact->fetchCpt(pointedId);
lowTextManager_t text = lowTextManager(ptrComp->cursorText, TEXT_MOUSE_WIDTH, L_CURSOR, 242, false);
DisplayedText text = lowTextManager(ptrComp->cursorText, TEXT_MOUSE_WIDTH, L_CURSOR, 242, false);
Logic::_scriptVariables[CURSOR_ID] = text.compactNum;
if (Logic::_scriptVariables[MENU]) {
_mouseOfsY = TOP_LEFT_Y - 2;
@ -234,13 +234,13 @@ char Text::getTextChar(uint8 **data, uint32 *bitPos) {
}
}
displayText_t Text::displayText(uint32 textNum, uint8 *dest, bool centre, uint16 pixelWidth, uint8 color) {
DisplayedText Text::displayText(uint32 textNum, uint8 *dest, bool centre, uint16 pixelWidth, uint8 color) {
//Render text into buffer *dest
getText(textNum);
return displayText(_textBuffer, dest, centre, pixelWidth, color);
}
displayText_t Text::displayText(char *textPtr, uint8 *dest, bool centre, uint16 pixelWidth, uint8 color) {
DisplayedText Text::displayText(char *textPtr, uint8 *dest, bool centre, uint16 pixelWidth, uint8 color) {
//Render text pointed to by *textPtr in buffer *dest
uint32 centerTable[10];
uint16 lineWidth = 0;
@ -278,7 +278,6 @@ displayText_t Text::displayText(char *textPtr, uint8 *dest, bool centre, uint16
lineWidth += (uint16)_dtCharSpacing; //include character spacing
if (pixelWidth <= lineWidth) {
if (*(lastSpace-1) == 10)
error("line width exceeded!");
@ -300,25 +299,25 @@ displayText_t Text::displayText(char *textPtr, uint8 *dest, bool centre, uint16
error("Maximum no. of lines exceeded!");
uint32 dtLineSize = pixelWidth * _charHeight;
uint32 numBytes = (dtLineSize * numLines) + sizeof(struct dataFileHeader) + 4;
uint32 numBytes = (dtLineSize * numLines) + sizeof(DataFileHeader) + 4;
if (!dest)
dest = (uint8*)malloc(numBytes);
// clear text sprite buffer
memset(dest + sizeof(struct dataFileHeader), 0, numBytes - sizeof(struct dataFileHeader));
memset(dest + sizeof(DataFileHeader), 0, numBytes - sizeof(DataFileHeader));
//make the header
((struct dataFileHeader *)dest)->s_width = pixelWidth;
((struct dataFileHeader *)dest)->s_height = (uint16)(_charHeight * numLines);
((struct dataFileHeader *)dest)->s_sp_size = (uint16)(pixelWidth * _charHeight * numLines);
((struct dataFileHeader *)dest)->s_offset_x = 0;
((struct dataFileHeader *)dest)->s_offset_y = 0;
((DataFileHeader *)dest)->s_width = pixelWidth;
((DataFileHeader *)dest)->s_height = (uint16)(_charHeight * numLines);
((DataFileHeader *)dest)->s_sp_size = (uint16)(pixelWidth * _charHeight * numLines);
((DataFileHeader *)dest)->s_offset_x = 0;
((DataFileHeader *)dest)->s_offset_y = 0;
//reset position
curPos = textPtr;
uint8 *curDest = dest + sizeof(struct dataFileHeader); //point to where pixels start
uint8 *curDest = dest + sizeof(DataFileHeader); //point to where pixels start
byte *prevDest = curDest;
uint32 *centerTblPtr = centerTable;
@ -339,7 +338,7 @@ displayText_t Text::displayText(char *textPtr, uint8 *dest, bool centre, uint16
} while (textChar >= 10);
struct displayText_t ret;
DisplayedText ret;
ret.textData = dest;
ret.textWidth = dtLastWidth;
return ret;
@ -354,7 +353,6 @@ void Text::makeGameCharacter(uint8 textChar, uint8 *charSetPtr, uint8 *&dest, ui
byte *curPos = startPos;
for (int i = 0; i < _charHeight; i++) {
byte *prevPos = curPos;
data = READ_BE_UINT16(charSpritePtr);
@ -383,9 +381,9 @@ void Text::makeGameCharacter(uint8 textChar, uint8 *charSetPtr, uint8 *&dest, ui
dest = startPos + charWidth + _dtCharSpacing * 2 - 1;
}
lowTextManager_t Text::lowTextManager(uint32 textNum, uint16 width, uint16 logicNum, uint8 color, bool centre) {
DisplayedText Text::lowTextManager(uint32 textNum, uint16 width, uint16 logicNum, uint8 color, bool centre) {
getText(textNum);
struct displayText_t textInfo = displayText(_textBuffer, NULL, centre, width, color);
DisplayedText textInfo = displayText(_textBuffer, NULL, centre, width, color);
uint32 compactNum = FIRST_TEXT_COMPACT;
Compact *cpt = _skyCompact->fetchCpt(compactNum);
@ -405,17 +403,13 @@ lowTextManager_t Text::lowTextManager(uint32 textNum, uint16 width, uint16 logic
cpt->status = ST_LOGIC | ST_FOREGROUND | ST_RECREATE;
cpt->screen = (uint16) Logic::_scriptVariables[SCREEN];
struct lowTextManager_t ret;
ret.textData = textInfo.textData;
ret.textWidth = textInfo.textWidth;
ret.compactNum = (uint16)compactNum;
return ret;
textInfo.compactNum = (uint16)compactNum;
return textInfo;
}
void Text::changeTextSpriteColour(uint8 *sprData, uint8 newCol) {
dataFileHeader *header = (dataFileHeader *)sprData;
sprData += sizeof(dataFileHeader);
DataFileHeader *header = (DataFileHeader *)sprData;
sprData += sizeof(DataFileHeader);
for (uint16 cnt = 0; cnt < header->s_sp_size; cnt++)
if (sprData[cnt] >= 241)
sprData[cnt] = newCol;

View File

@ -52,9 +52,9 @@ class Text {
public:
Text(Disk *skyDisk, SkyCompact *skyCompact);
~Text(void);
struct displayText_t displayText(uint32 textNum, uint8 *dest, bool centre, uint16 pixelWidth, uint8 color);
struct displayText_t displayText(char *textPtr, uint8 *dest, bool centre, uint16 pixelWidth, uint8 color);
struct lowTextManager_t lowTextManager(uint32 textNum, uint16 width, uint16 logicNum, uint8 color, bool centre);
struct DisplayedText displayText(uint32 textNum, uint8 *dest, bool centre, uint16 pixelWidth, uint8 color);
struct DisplayedText displayText(char *textPtr, uint8 *dest, bool centre, uint16 pixelWidth, uint8 color);
struct DisplayedText lowTextManager(uint32 textNum, uint16 width, uint16 logicNum, uint8 color, bool centre);
void fnSetFont(uint32 fontNr);
void fnTextModule(uint32 textInfoId, uint32 textNo);
void fnPointerText(uint32 pointedId, uint16 mouseX, uint16 mouseY);