fixed misimplementation of fnSetFont()

svn-id: r7011
This commit is contained in:
Joost Peters 2003-04-14 17:26:42 +00:00
parent 942bcef563
commit aa7e9e17bc
3 changed files with 37 additions and 10 deletions

View file

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

View file

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

View file

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