aboutsummaryrefslogtreecommitdiff
path: root/engines/sword1/text.cpp
diff options
context:
space:
mode:
authorJohannes Schickel2011-09-07 23:54:34 +0200
committerJohannes Schickel2011-09-07 23:54:34 +0200
commit928cb5ab1196f800049ba3e22038acf9cab3bc60 (patch)
treeae0b956c483dd157e06ae04a85e586f09757306c /engines/sword1/text.cpp
parentc346bf79b472eefea2a1e6b9ce01c5c3e342de73 (diff)
downloadscummvm-rg350-928cb5ab1196f800049ba3e22038acf9cab3bc60.tar.gz
scummvm-rg350-928cb5ab1196f800049ba3e22038acf9cab3bc60.tar.bz2
scummvm-rg350-928cb5ab1196f800049ba3e22038acf9cab3bc60.zip
SWORD1: Made code conform a bit better to our formatting guidelines.
Most is automatically converted via astyle + some manual fixes, hopefully I did not miss anything astyle messed up...
Diffstat (limited to 'engines/sword1/text.cpp')
-rw-r--r--engines/sword1/text.cpp30
1 files changed, 15 insertions, 15 deletions
diff --git a/engines/sword1/text.cpp b/engines/sword1/text.cpp
index 2d4b07020f..3bd2fdb2e6 100644
--- a/engines/sword1/text.cpp
+++ b/engines/sword1/text.cpp
@@ -35,7 +35,7 @@ namespace Sword1 {
#define OVERLAP 3
#define SPACE ' '
-#define MAX_LINES 30
+#define MAX_LINES 30
Text::Text(ObjectMan *pObjMan, ResMan *pResMan, bool czechVersion) {
@@ -43,7 +43,7 @@ Text::Text(ObjectMan *pObjMan, ResMan *pResMan, bool czechVersion) {
_resMan = pResMan;
_textCount = 0;
_fontId = (czechVersion) ? CZECH_GAME_FONT : GAME_FONT;
- _font = (uint8*)_resMan->openFetchRes(_fontId);
+ _font = (uint8 *)_resMan->openFetchRes(_fontId);
_joinWidth = charWidth(SPACE) - 2 * OVERLAP;
_charHeight = _resMan->getUint16(_resMan->fetchFrame(_font, 0)->height); // all chars have the same height
@@ -86,16 +86,16 @@ void Text::makeTextSprite(uint8 slot, const uint8 *text, uint16 maxWidth, uint8
uint16 sprHeight = _charHeight * numLines;
uint32 sprSize = sprWidth * sprHeight;
assert(!_textBlocks[slot]); // if this triggers, the speechDriver failed to call Text::releaseText.
- _textBlocks[slot] = (FrameHeader*)malloc(sprSize + sizeof(FrameHeader));
+ _textBlocks[slot] = (FrameHeader *)malloc(sprSize + sizeof(FrameHeader));
memcpy(_textBlocks[slot]->runTimeComp, "Nu ", 4);
- _textBlocks[slot]->compSize = 0;
- _textBlocks[slot]->width = _resMan->toUint16(sprWidth);
- _textBlocks[slot]->height = _resMan->toUint16(sprHeight);
- _textBlocks[slot]->offsetX = 0;
- _textBlocks[slot]->offsetY = 0;
+ _textBlocks[slot]->compSize = 0;
+ _textBlocks[slot]->width = _resMan->toUint16(sprWidth);
+ _textBlocks[slot]->height = _resMan->toUint16(sprHeight);
+ _textBlocks[slot]->offsetX = 0;
+ _textBlocks[slot]->offsetY = 0;
- uint8 *linePtr = ((uint8*)_textBlocks[slot]) + sizeof(FrameHeader);
+ uint8 *linePtr = ((uint8 *)_textBlocks[slot]) + sizeof(FrameHeader);
memset(linePtr, NO_COL, sprSize);
for (lineCnt = 0; lineCnt < numLines; lineCnt++) {
uint8 *sprPtr = linePtr + (sprWidth - lines[lineCnt].width) / 2; // center the text
@@ -132,7 +132,7 @@ uint16 Text::analyzeSentence(const uint8 *text, uint16 maxWidth, LineInfo *line)
text++;
wordWidth += OVERLAP; // no overlap on final letter of word!
- if (firstWord) { // first word on first line, so no separating SPACE needed
+ if (firstWord) { // first word on first line, so no separating SPACE needed
line[0].width = wordWidth;
line[0].length = wordLength;
firstWord = false;
@@ -144,7 +144,7 @@ uint16 Text::analyzeSentence(const uint8 *text, uint16 maxWidth, LineInfo *line)
if (line[lineNo].width + spaceNeeded <= maxWidth) {
line[lineNo].width += spaceNeeded;
line[lineNo].length += 1 + wordLength; // NB. space+word characters
- } else { // put word (without separating SPACE) at start of next line
+ } else { // put word (without separating SPACE) at start of next line
lineNo++;
assert(lineNo < MAX_LINES);
line[lineNo].width = wordWidth;
@@ -152,21 +152,21 @@ uint16 Text::analyzeSentence(const uint8 *text, uint16 maxWidth, LineInfo *line)
}
}
}
- return lineNo+1; // return no of lines
+ return lineNo + 1; // return no of lines
}
uint16 Text::copyChar(uint8 ch, uint8 *sprPtr, uint16 sprWidth, uint8 pen) {
FrameHeader *chFrame = _resMan->fetchFrame(_font, ch - SPACE);
- uint8 *chData = ((uint8*)chFrame) + sizeof(FrameHeader);
+ uint8 *chData = ((uint8 *)chFrame) + sizeof(FrameHeader);
uint8 *dest = sprPtr;
uint8 *decBuf = NULL;
uint8 *decChr;
uint16 frameHeight = 0;
if (SwordEngine::isPsx()) {
- frameHeight = _resMan->getUint16(chFrame->height)/2;
+ frameHeight = _resMan->getUint16(chFrame->height) / 2;
if (_fontId == CZECH_GAME_FONT) { //Czech game fonts are compressed
- decBuf = (uint8*) malloc((_resMan->getUint16(chFrame->width))*(_resMan->getUint16(chFrame->height)/2));
+ decBuf = (uint8 *)malloc((_resMan->getUint16(chFrame->width)) * (_resMan->getUint16(chFrame->height) / 2));
Screen::decompressHIF(chData, decBuf);
decChr = decBuf;
} else //Normal game fonts are not compressed