DREAMWEB: Move a few methods to DreamBase, remove some unused code

This commit is contained in:
Max Horn 2011-12-06 19:59:52 +01:00 committed by Willem Jan Palenstijn
parent 2521646676
commit c0e2dddd27
3 changed files with 9 additions and 23 deletions

View File

@ -48,7 +48,11 @@ public:
public:
// TODO: Move functions from stubs.h which do not access any Context member variables to here.
uint8 getNextWord(const Frame *charSet, const uint8 *string, uint8 *totalWidth, uint8 *charCount);
uint8 getNumber(const Frame *charSet, const uint8 *string, uint16 maxWidth, bool centered, uint16 *offset);
uint8 kernChars(uint8 firstChar, uint8 secondChar, uint8 width);
// TODO: Move more methods from stubs.h to here.
};

View File

@ -32,7 +32,7 @@ void DreamGenContext::printBoth(const Frame *charSet, uint16 *x, uint16 y, uint8
*x = newX;
}
uint8 DreamGenContext::getNextWord(const Frame *charSet, const uint8 *string, uint8 *totalWidth, uint8 *charCount) {
uint8 DreamBase::getNextWord(const Frame *charSet, const uint8 *string, uint8 *totalWidth, uint8 *charCount) {
*totalWidth = 0;
*charCount = 0;
while(true) {
@ -50,22 +50,13 @@ uint8 DreamGenContext::getNextWord(const Frame *charSet, const uint8 *string, ui
firstChar = engine->modifyChar(firstChar);
if (firstChar != 255) {
uint8 secondChar = *string;
uint8 width = charSet[firstChar - 32 + data.word(kCharshift)].width;
uint8 width = charSet[firstChar - 32 + data.word(DreamGenContext::kCharshift)].width;
width = kernChars(firstChar, secondChar, width);
*totalWidth += width;
}
}
}
void DreamGenContext::printChar() {
uint16 x = di;
uint8 width, height;
printChar((const Frame *)ds.ptr(0, 0), &x, bx, al, ah, &width, &height);
di = x;
cl = width;
ch = height;
}
void DreamGenContext::printChar(const Frame *charSet, uint16* x, uint16 y, uint8 c, uint8 nextChar, uint8 *width, uint8 *height) {
if (c == 255)
return;
@ -88,10 +79,6 @@ void DreamGenContext::printChar(const Frame *charSet, uint16 x, uint16 y, uint8
printChar(charSet, &x, y, c, nextChar, width, height);
}
void DreamGenContext::printSlow() {
al = printSlow(es.ptr(si, 0), di, bx, dl, (bool)(dl & 1));
}
uint8 DreamGenContext::printSlow(const uint8 *string, uint16 x, uint16 y, uint8 maxWidth, bool centered) {
data.byte(kPointerframe) = 1;
data.byte(kPointermode) = 3;
@ -171,7 +158,7 @@ uint8 DreamGenContext::printDirect(const uint8** string, uint16 x, uint16 *y, ui
}
}
uint8 DreamGenContext::getNumber(const Frame *charSet, const uint8 *string, uint16 maxWidth, bool centered, uint16* offset) {
uint8 DreamBase::getNumber(const Frame *charSet, const uint8 *string, uint16 maxWidth, bool centered, uint16* offset) {
uint8 totalWidth = 0;
uint8 charCount = 0;
while (true) {
@ -210,7 +197,7 @@ uint8 DreamGenContext::getNumber(const Frame *charSet, const uint8 *string, uint
}
}
uint8 DreamGenContext::kernChars(uint8 firstChar, uint8 secondChar, uint8 width) {
uint8 DreamBase::kernChars(uint8 firstChar, uint8 secondChar, uint8 width) {
if ((firstChar == 'a') || (firstChar == 'u')) {
if ((secondChar == 'n') || (secondChar == 't') || (secondChar == 'r') || (secondChar == 'i') || (secondChar == 'l'))
return width-1;

View File

@ -70,9 +70,7 @@
void seeCommandTail();
void randomNumber();
void quickQuit2();
uint8 getNextWord(const Frame *charSet, const uint8 *string, uint8 *totalWidth, uint8 *charCount);
void printBoth(const Frame* charSet, uint16 *x, uint16 y, uint8 c, uint8 nextChar);
void printChar();
void printChar(const Frame* charSet, uint16 *x, uint16 y, uint8 c, uint8 nextChar, uint8 *width, uint8 *height);
void printChar(const Frame* charSet, uint16 x, uint16 y, uint8 c, uint8 nextChar, uint8 *width, uint8 *height);
void printDirect();
@ -86,10 +84,7 @@
void getUnderTimed();
void putUnderTimed();
uint8 printSlow(const uint8 *string, uint16 x, uint16 y, uint8 maxWidth, bool centered);
void printSlow();
void dumpTextLine();
uint8 getNumber(const Frame *charSet, const uint8 *string, uint16 maxWidth, bool centered, uint16 *offset);
uint8 kernChars(uint8 firstChar, uint8 secondChar, uint8 width);
void oldToNames();
void namesToOld();
void loadPalFromIFF();