void DreamWebEngine::lookAtPlace() { commandOnlyCond(27, 224); if (!(_mouseButton & 1) || _mouseButton == _oldButton || _destPos >= 15) return; // noinfo delPointer(); delTextLine(); getUnderCentre(); showFrame(_newplaceGraphics3, 60, 72, 0, 0); showFrame(_newplaceGraphics3, 60, 72 + 55, 4, 0); if (_foreignRelease) showFrame(_newplaceGraphics3, 60, 72+55+21, 4, 0); const uint8 *string = (const uint8 *)_travelText.getString(_destPos); findNextColon(&string); uint16 y = (_foreignRelease) ? 84 + 4 : 84; printDirect(&string, 63, &y, 191, 191 & 1); workToScreenM(); hangOnP(500); _pointerMode = 0; _pointerFrame = 0; putUnderCentre(); workToScreenM(); }
void decode(char* str, int len) { int colon = findNextColon(str, 0, len); char* shifts = str; int slen = colon; char* code = str + colon + 1; int clen = len - colon - 1; for(int i=0,j=0;i<clen;++i,++j) { if(j == slen) { j = 0; } char t = decodeChar(code[i], shifts[j]); if(t == '\n') { printf("\\n"); } else { printf("%c", t); } } printf("\n"); }
const uint8 *DreamWebEngine::getObTextStart() { const uint8 *textBase = 0; const uint8 *text; uint16 textOff = 0; if (_objectType == kFreeObjectType) { text = (const uint8 *)_freeDesc.getString(_command); } else if (_objectType == kSetObjectType1) { textBase = (const uint8 *)_setDesc._text; textOff = kNumSetTexts * 2; text = (const uint8 *)_setDesc.getString(_command); } else { text = (const uint8 *)_exText.getString(_command); } if (_objectType != kSetObjectType1) return text; const uint8 *obname = text; while (true) { const uint8 *start = text; findNextColon(&text); // Not an empty description string? if (*text != 0 && *text != ':') return start; // If the description string (of a SetObjectType1 object) is empty, // look for an object with the same name. // Example: Eden's garage door outside has two parts. The right part // has no description of its own but uses that of the left part. bool found = false; do { text++; uint8 c = *obname; // scan for matching first character while (*text != c) { text++; // arbitrary give-up counter // FIXME: Make this more precise to avoid reading out of bounds if (text - (textBase - textOff) >= 8000) { warning("Object description for %d/%d not found", _objectType, _command); return obname; } } // found matching first character, so match the rest const uint8 *s1 = obname; const uint8 *s2 = text; do { s1++; s2++; } while (*s1 != ':' && *s1 != 0 && *s1 == *s2); if (*s1 == ':' || *s1 == 0) found = true; // (prefix) matched the entire object name } while (!found); // We found an object with the same name. The next loop iteration // will check if this one again has an empty description. } }