DREAMWEB: Cleanup

This commit is contained in:
Willem Jan Palenstijn 2011-12-04 14:17:39 +01:00
parent f154ff626b
commit 5871a6943f
2 changed files with 10 additions and 18 deletions

View File

@ -171,12 +171,6 @@ uint8 DreamGenContext::printDirect(const uint8** string, uint16 x, uint16 *y, ui
}
}
void DreamGenContext::getNumber() {
uint16 offset = di;
cl = getNumber((Frame *)ds.ptr(0, 0), es.ptr(si, 0), dl, (bool)(dl & 1), &offset);
di = offset;
}
uint8 DreamGenContext::getNumber(const Frame *charSet, const uint8 *string, uint16 maxWidth, bool centered, uint16* offset) {
uint8 totalWidth = 0;
uint8 charCount = 0;
@ -185,31 +179,30 @@ uint8 DreamGenContext::getNumber(const Frame *charSet, const uint8 *string, uint
uint8 done = getNextWord(charSet, string, &wordTotalWidth, &wordCharCount);
string += wordCharCount;
uint16 tmp = totalWidth + wordTotalWidth - 10;
if (done == 1) { //endoftext
ax = totalWidth + wordTotalWidth - 10;
if (ax < maxWidth) {
if (tmp < maxWidth) {
totalWidth += wordTotalWidth;
charCount += wordCharCount;
}
if (centered) {
ax = (maxWidth & 0xfe) + 2 + 20 - totalWidth;
ax /= 2;
tmp = (maxWidth & 0xfe) + 2 + 20 - totalWidth;
tmp /= 2;
} else {
ax = 0;
tmp = 0;
}
*offset += ax;
return charCount;
}
ax = totalWidth + wordTotalWidth - 10;
if (ax >= maxWidth) { //gotoverend
if (tmp >= maxWidth) { //gotoverend
if (centered) {
ax = (maxWidth & 0xfe) - totalWidth + 20;
ax /= 2;
tmp = (maxWidth & 0xfe) - totalWidth + 20;
tmp /= 2;
} else {
ax = 0;
tmp = 0;
}
*offset += ax;
*offset += tmp;
return charCount;
}
totalWidth += wordTotalWidth;

View File

@ -88,7 +88,6 @@
uint8 printSlow(const uint8 *string, uint16 x, uint16 y, uint8 maxWidth, bool centered);
void printSlow();
void dumpTextLine();
void getNumber();
uint8 getNumber(const Frame *charSet, const uint8 *string, uint16 maxWidth, bool centered, uint16 *offset);
uint8 kernChars(uint8 firstChar, uint8 secondChar, uint8 width);
void oldToNames();