diff options
author | Joost Peters | 2003-04-29 19:52:24 +0000 |
---|---|---|
committer | Joost Peters | 2003-04-29 19:52:24 +0000 |
commit | 5ea40b6778726f80e53a409f7cc8c5d75709aca3 (patch) | |
tree | ba33940a8cb4c744141d82c5dd4755edc8829026 /sky | |
parent | e0e0247b4701fef4817666da34c733624881fec2 (diff) | |
download | scummvm-rg350-5ea40b6778726f80e53a409f7cc8c5d75709aca3.tar.gz scummvm-rg350-5ea40b6778726f80e53a409f7cc8c5d75709aca3.tar.bz2 scummvm-rg350-5ea40b6778726f80e53a409f7cc8c5d75709aca3.zip |
added lowTextManager(), moved language from getText() to SkyText constructor + some cleanup
svn-id: r7202
Diffstat (limited to 'sky')
-rw-r--r-- | sky/intro.cpp | 4 | ||||
-rw-r--r-- | sky/logic.cpp | 3 | ||||
-rw-r--r-- | sky/logic.h | 2 | ||||
-rw-r--r-- | sky/sky.cpp | 10 | ||||
-rw-r--r-- | sky/skydefs.h | 2 | ||||
-rw-r--r-- | sky/struc.h | 5 | ||||
-rw-r--r-- | sky/text.cpp | 47 | ||||
-rw-r--r-- | sky/text.h | 17 |
8 files changed, 72 insertions, 18 deletions
diff --git a/sky/intro.cpp b/sky/intro.cpp index 9003fbbb76..5e2ef9e24f 100644 --- a/sky/intro.cpp +++ b/sky/intro.cpp @@ -227,7 +227,7 @@ void SkyState::intro(void) { _introTextSpace = (uint8 *)calloc(10000, 1); _introTextSave = (uint8 *)calloc(10000, 1); - _skyText->getText(77, _language); + _skyText->getText(77); delay(8000); // keep revolution up for 8 seconds @@ -455,7 +455,7 @@ void SkyState::checkCommands(uint32 *&cmdPtr) { void SkyState::prepareText(uint32 *&cmdPtr) { uint32 textNum = *(cmdPtr + 2); - _skyText->getText(textNum, _language); + _skyText->getText(textNum); _skyText->displayText(_introTextSpace, true, INTRO_TEXT_WIDTH, 255); cmdPtr += 3; } diff --git a/sky/logic.cpp b/sky/logic.cpp index 22b95397a3..3b5498fe60 100644 --- a/sky/logic.cpp +++ b/sky/logic.cpp @@ -25,6 +25,7 @@ #include "sky/compact.h" #include "sky/skydefs.h" +uint16 SkyLogic::_screen; typedef void (SkyLogic::*LogicTable) (); static const LogicTable logicTable[] = { @@ -55,7 +56,7 @@ SkyLogic::SkyLogic(SkyDisk *skyDisk, SkyGrid *skyGrid) { for (uint i = 0; i < sizeof(_moduleList)/sizeof(uint16*); i++) _moduleList[i] = 0; _stackPtr = 0; - + initScriptVariables(); } diff --git a/sky/logic.h b/sky/logic.h index 9914159a60..414b4acd33 100644 --- a/sky/logic.h +++ b/sky/logic.h @@ -167,6 +167,8 @@ public: uint32 fnUnPauseFx(uint32 a, uint32 b, uint32 c); uint32 fnPrintf(uint32 a, uint32 b, uint32 c); + static uint16 SkyLogic::_screen; + protected: void push(uint32); uint32 pop(); diff --git a/sky/sky.cpp b/sky/sky.cpp index de63dbab26..bd944300d1 100644 --- a/sky/sky.cpp +++ b/sky/sky.cpp @@ -209,23 +209,23 @@ SkyText *SkyState::getSkyText() { switch (_gameVersion) { case 267: //floppy demo - return new SkyText_v00267(_skyDisk, _gameVersion); + return new SkyText_v00267(_skyDisk, _gameVersion, _language); case 288: //floppy version - return new SkyText_v00288(_skyDisk, _gameVersion); + return new SkyText_v00288(_skyDisk, _gameVersion, _language); case 303: //floppy version - return new SkyText_v00303(_skyDisk, _gameVersion); + return new SkyText_v00303(_skyDisk, _gameVersion, _language); case 331: //floppy version - return new SkyText_v00331(_skyDisk, _gameVersion); + return new SkyText_v00331(_skyDisk, _gameVersion, _language); case 365: //cd demo, uses a slightly modified version of v00372 case 368: //cd version, uses a slightly modified version of v00372 case 372: //cd version - return new SkyText_v00372(_skyDisk, _gameVersion); + return new SkyText_v00372(_skyDisk, _gameVersion, _language); default: error("Unknown game version"); } diff --git a/sky/skydefs.h b/sky/skydefs.h index 214dc90dd4..b4c0c4b3b4 100644 --- a/sky/skydefs.h +++ b/sky/skydefs.h @@ -26,6 +26,8 @@ #define KEY_BUFFER_SIZE 80 #define SEQUENCE_COUNT 3 +#define FIRST_TEXT_COMPACT 23 + //screen/grid defines #define GAME_SCREEN_WIDTH 320 #define GAME_SCREEN_HEIGHT 192 diff --git a/sky/struc.h b/sky/struc.h index 295fdf40e6..90f1cfc090 100644 --- a/sky/struc.h +++ b/sky/struc.h @@ -22,6 +22,11 @@ #ifndef SKYSTRUC_H #define SKYSTRUC_H +struct lowTextManager_t { + byte *textData; + uint16 compactNum; +}; + struct displayText_t { byte *textData; uint32 textWidth; diff --git a/sky/text.cpp b/sky/text.cpp index ddd7a19898..f36431a54b 100644 --- a/sky/text.cpp +++ b/sky/text.cpp @@ -24,16 +24,19 @@ #include "sky/skydefs.h" #include "sky/sky.h" #include "sky/text.h" +#include "sky/logic.h" #define FIRST_TEXT_SEC 77 +#define FIRST_TEXT_BUFFER 274 #define NO_OF_TEXT_SECTIONS 8 // 8 sections per language #define CHAR_SET_FILE 60150 #define MAX_SPEECH_SECTION 7 #define CHAR_SET_HEADER 128 #define MAX_NO_LINES 10 -SkyText::SkyText(SkyDisk *skyDisk, uint32 gameVersion) { +SkyText::SkyText(SkyDisk *skyDisk, uint32 gameVersion, uint16 language) { _skyDisk = skyDisk; + _language = language; _gameVersion = gameVersion; _mainCharacterSet.addr = _skyDisk->loadFile(CHAR_SET_FILE, NULL); @@ -81,14 +84,14 @@ void SkyText::fnSetFont(uint32 fontNr) { _dtCharSpacing = newCharSet->charSpacing; } -void SkyText::getText(uint32 textNr, uint16 language) { //load text #"textNr" into textBuffer +void SkyText::getText(uint32 textNr) { //load text #"textNr" into textBuffer uint32 sectionNo = (textNr & 0x0F000) >> 10; if (SkyState::_itemList[FIRST_TEXT_SEC + sectionNo] == (void **)NULL) { //check if already loaded debug(5, "Loading Text item(s) for Section %d", (sectionNo>>2)); uint32 fileNo = (sectionNo >> 2); - fileNo += ((language * NO_OF_TEXT_SECTIONS) + 60600); + fileNo += ((_language * NO_OF_TEXT_SECTIONS) + 60600); SkyState::_itemList[FIRST_TEXT_SEC + sectionNo] = (void **)_skyDisk->loadFile((uint16)fileNo, NULL); } _textItemPtr = (uint8 *)SkyState::_itemList[FIRST_TEXT_SEC + sectionNo]; @@ -325,6 +328,44 @@ void SkyText::makeGameCharacter(char textChar, uint8 *charSetPtr, uint8 *&dest, } +lowTextManager_t SkyText::lowTextManager(uint32 textNum, uint16 width, uint16 logicNum, uint8 color, bool centre) { + + getText(textNum); + + struct displayText_t textInfo = displayText(NULL, centre, width, color); + + _lowTextWidth = textInfo.textWidth; + byte *textData = textInfo.textData; + + uint32 compactNum = FIRST_TEXT_COMPACT; + + Compact *cpt = SkyState::fetchCompact(compactNum); + + while (cpt->status != 0xFFFF) { //-1 + compactNum++; + cpt = SkyState::fetchCompact(compactNum); + } + + cpt->flag = (compactNum - FIRST_TEXT_COMPACT) + FIRST_TEXT_BUFFER; + + byte *oldText = (byte *)SkyState::_itemList[compactNum]; + SkyState::_itemList[compactNum] = (void **)textData; + + if (oldText != NULL) + free (oldText); + + cpt->logic = logicNum; + cpt->status = ST_LOGIC | ST_FOREGROUND | ST_RECREATE; + cpt->screen = SkyLogic::_screen; + + struct lowTextManager_t ret; + ret.textData = _dtData; + ret.compactNum = compactNum; + + return ret; + +} + char SkyText_v00267::getTextChar() { //NOTE: The decoding code for the floppy versions (both demo and full version) is _completely_ different. diff --git a/sky/text.h b/sky/text.h index a6ecd1f1c4..ffebcc79dd 100644 --- a/sky/text.h +++ b/sky/text.h @@ -26,11 +26,12 @@ class SkyText { public: - SkyText(SkyDisk *skyDisk, uint32 gameVersion); - void getText(uint32 textNr, uint16 language); + SkyText(SkyDisk *skyDisk, uint32 gameVersion, uint16 _language); + void getText(uint32 textNr); struct displayText_t displayText(uint8 *dest, bool centre, uint16 pixelWidth, uint8 color); struct displayText_t displayText(char *textPtr, uint8 *dest, bool centre, uint16 pixelWidth, uint8 color); void makeGameCharacter(char textChar, uint8 *charSetPtr, uint8 *&data, uint8 color); + struct lowTextManager_t lowTextManager(uint32 textNum, uint16 width, uint16 logicNum, uint8 color, bool centre); protected: bool getTBit(); @@ -38,6 +39,7 @@ protected: virtual char getTextChar() = 0; SkyDisk *_skyDisk; + uint16 _language; uint32 _gameVersion; uint8 _inputValue; uint8 _shiftBits; @@ -69,39 +71,40 @@ protected: uint32 _dtWidth; //width of chars in last line (for editing (?)) uint32 _dtLastWidth; bool _dtCentre; //set for centre text + uint32 _lowTextWidth; }; class SkyText_v00267 : public SkyText { public: - SkyText_v00267(SkyDisk *skyDisk, uint32 gameVersion) : SkyText(skyDisk, gameVersion) {}; + SkyText_v00267(SkyDisk *skyDisk, uint32 gameVersion, uint16 language) : SkyText(skyDisk, gameVersion, language) {}; protected: char getTextChar(); }; class SkyText_v00288 : public SkyText { public: - SkyText_v00288(SkyDisk *skyDisk, uint32 gameVersion) : SkyText(skyDisk, gameVersion) {}; + SkyText_v00288(SkyDisk *skyDisk, uint32 gameVersion, uint16 language) : SkyText(skyDisk, gameVersion, language) {}; protected: char getTextChar(); }; class SkyText_v00303 : public SkyText { public: - SkyText_v00303(SkyDisk *skyDisk, uint32 gameVersion) : SkyText(skyDisk, gameVersion) {}; + SkyText_v00303(SkyDisk *skyDisk, uint32 gameVersion, uint16 language) : SkyText(skyDisk, gameVersion, language) {}; protected: char getTextChar(); }; class SkyText_v00331 : public SkyText { public: - SkyText_v00331(SkyDisk *skyDisk, uint32 gameVersion) : SkyText(skyDisk, gameVersion) {}; + SkyText_v00331(SkyDisk *skyDisk, uint32 gameVersion, uint16 language) : SkyText(skyDisk, gameVersion, language) {}; protected: char getTextChar(); }; class SkyText_v00372 : public SkyText { public: - SkyText_v00372(SkyDisk *skyDisk, uint32 gameVersion) : SkyText(skyDisk, gameVersion) {}; + SkyText_v00372(SkyDisk *skyDisk, uint32 gameVersion, uint16 language) : SkyText(skyDisk, gameVersion, language) {}; protected: char getTextChar(); }; |