aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--sky/skydefs.h2
-rw-r--r--sky/text.cpp33
-rw-r--r--sky/text.h12
3 files changed, 37 insertions, 10 deletions
diff --git a/sky/skydefs.h b/sky/skydefs.h
index 0174731fc7..df7ffcd5db 100644
--- a/sky/skydefs.h
+++ b/sky/skydefs.h
@@ -49,6 +49,8 @@
//item list defines
#define section_0_item 119
+#define MAIN_CHAR_HEIGHT 12
+
#define c_base_mode 0
#define c_base_mode56 56
#define c_action_mode 4
diff --git a/sky/text.cpp b/sky/text.cpp
index 6f289ba64d..d88b83a4d9 100644
--- a/sky/text.cpp
+++ b/sky/text.cpp
@@ -28,7 +28,6 @@
#define FIRST_TEXT_SEC 77
#define NO_OF_TEXT_SECTIONS 8 // 8 sections per language
#define CHAR_SET_FILE 60150
-#define SET_FONT_DATA_SIZE 12
#define MAX_SPEECH_SECTION 7
SkyText::SkyText(SkyDisk *skyDisk, uint32 gameVersion) {
@@ -36,11 +35,19 @@ SkyText::SkyText(SkyDisk *skyDisk, uint32 gameVersion) {
_gameVersion = gameVersion;
_mainCharacterSet.addr = _skyDisk->loadFile(CHAR_SET_FILE, NULL);
+ _mainCharacterSet.charHeight = MAIN_CHAR_HEIGHT;
+ _mainCharacterSet.charSpacing = 0;
+
fnSetFont(0);
if (!SkyState::isDemo(_gameVersion)) {
_controlCharacterSet.addr = _skyDisk->loadFile(60520, NULL);
+ _controlCharacterSet.charHeight = 12;
+ _controlCharacterSet.charSpacing = 1;
+
_linkCharacterSet.addr = _skyDisk->loadFile(60521, NULL);
+ _linkCharacterSet.charHeight = 12;
+ _linkCharacterSet.charSpacing = 0;
}
if (SkyState::isCDVersion(_gameVersion)) {
@@ -49,11 +56,27 @@ SkyText::SkyText(SkyDisk *skyDisk, uint32 gameVersion) {
}
void SkyText::fnSetFont(uint32 fontNr) {
+
+ struct charSet *newCharSet;
+
+ switch (fontNr) {
+ case 0:
+ newCharSet = &_mainCharacterSet;
+ break;
+ case 1:
+ newCharSet = &_controlCharacterSet;
+ break;
+ case 2:
+ newCharSet = &_linkCharacterSet;
+ break;
+ default:
+ error("Tried to set invalid font (%d)", fontNr);
+ }
+
_curCharSet = fontNr;
- byte *charSetPtr = _mainCharacterSet.addr + (fontNr * SET_FONT_DATA_SIZE);
- _characterSet = READ_LE_UINT32(charSetPtr);
- _charHeight = READ_LE_UINT32(charSetPtr + 4);
- _dtCharSpacing = READ_LE_UINT32(charSetPtr + 8);
+ _characterSet = newCharSet->addr;
+ _charHeight = newCharSet->charHeight;
+ _dtCharSpacing = newCharSet->charSpacing;
}
void SkyText::getText(uint32 textNr, void **itemList, uint16 language) { //load text #"textNr" into textBuffer
diff --git a/sky/text.h b/sky/text.h
index ebd1ab0cd1..897770b009 100644
--- a/sky/text.h
+++ b/sky/text.h
@@ -43,18 +43,20 @@ protected:
struct charSet {
uint8 *addr;
uint32 charHeight;
- uint32 thirdVal;
+ uint32 charSpacing;
} _mainCharacterSet, _linkCharacterSet, _controlCharacterSet;
uint32 _curCharSet;
- uint32 _characterSet;
+ uint8 *_characterSet;
uint32 _charHeight;
uint8 *_preAfterTableArea;
uint8 _textBuffer[1024];
-
+ uint8 _centreTable[40];
+
uint8 *_mouseTextData; //space for the mouse text
- uint32 _dtLineWidth; //width of line in pixels
+ uint8 _dlCol;
+ uint16 _dtLineWidth; //width of line in pixels
uint32 _dtLines; //no of lines to do
uint32 _dtLineSize; //size of one line in bytes
uint8 *_dtData; //address of textdata
@@ -62,7 +64,7 @@ protected:
uint8 *_dtText; //pointer to text
uint32 _dtCharSpacing; //character seperation adjustment
uint32 _dtWidth; //width of chars in last line (for editing (?))
- uint32 _dtCentre; //set for centre text
+ bool _dtCentre; //set for centre text
};
class SkyText_v00267 : public SkyText {