Skip to content

Commit

Permalink
DREAMWEB: Move a few methods to DreamBase, remove some unused code
Browse files Browse the repository at this point in the history
  • Loading branch information
fingolfin authored and wjp committed Dec 7, 2011
1 parent 2521646 commit c0e2ddd
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 23 deletions.
6 changes: 5 additions & 1 deletion engines/dreamweb/dreambase.h
Expand Up @@ -48,7 +48,11 @@ class DreamBase {


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.
};


Expand Down
21 changes: 4 additions & 17 deletions engines/dreamweb/print.cpp
Expand Up @@ -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) {
Expand All @@ -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;
Expand All @@ -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;
Expand Down Expand Up @@ -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) {
Expand Down Expand Up @@ -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;
Expand Down
5 changes: 0 additions & 5 deletions engines/dreamweb/stubs.h
Expand Up @@ -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();
Expand All @@ -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();
Expand Down

0 comments on commit c0e2ddd

Please sign in to comment.