void DrasculaEngine::hipo_sin_nadie(int counter){ int y = 0, trackCharacter = 0; if (currentChapter == 3) y = -1; do { counter--; copyBackground(); if (currentChapter == 3) updateScreen(0, 0, 0, y, 320, 200, screenSurface); else updateScreen(0, 1, 0, y, 320, 198, screenSurface); if (trackCharacter == 0) y++; else y--; if (currentChapter == 3) { if (y == 1) trackCharacter = 1; if (y == -1) trackCharacter = 0; } else { if (y == 2) trackCharacter = 1; if (y == 0) trackCharacter = 0; } } while (counter > 0); copyBackground(); updateScreen(); }
void DrasculaEngine::enterName() { Common::KeyCode key; flushKeyBuffer(); int v = 0, h = 0; char select2[23]; strcpy(select2, " "); for (;;) { select2[v] = '-'; copyBackground(115, 14, 115, 14, 176, 9, bgSurface, screenSurface); print_abc(select2, 117, 15); updateScreen(); key = getScan(); if (key != 0) { if (key >= 0 && key <= 0xFF && isalpha(key)) select2[v] = tolower(key); else if ((key >= Common::KEYCODE_0 && key <= Common::KEYCODE_9) || key == Common::KEYCODE_SPACE) select2[v] = key; else if (key == Common::KEYCODE_ESCAPE) break; else if (key == Common::KEYCODE_RETURN) { select2[v] = '\0'; h = 1; break; } else if (key == Common::KEYCODE_BACKSPACE) select2[v] = '\0'; else v--; if (key == Common::KEYCODE_BACKSPACE) v--; else v++; } if (v == 22) v = 21; else if (v == -1) v = 0; } if (h == 1) { strcpy(select, select2); selectionMade = 1; } }
void DrasculaEngine::moveCursor() { copyBackground(); updateRefresh_pre(); moveCharacters(); updateRefresh(); if (!strcmp(textName, "hacker") && _hasName) { if (_color != kColorRed && !_menuScreen) color_abc(kColorRed); } else if (!_menuScreen && _color != kColorLightGreen) color_abc(kColorLightGreen); if (_hasName && !_menuScreen) centerText(textName, _mouseX, _mouseY); if (_menuScreen) showMenu(); else if (_menuBar) clearMenu(); }
void DrasculaEngine::showMenu() { int h, n, x; char textIcon[13]; byte *srcSurface = (currentChapter == 6) ? tableSurface : frontSurface; x = whichObject(); strcpy(textIcon, iconName[x]); for (n = 1; n < ARRAYSIZE(inventoryObjects); n++) { h = inventoryObjects[n]; if (h != 0) { copyBackground(_polX[n], _polY[n], _itemLocations[n].x, _itemLocations[n].y, OBJWIDTH, OBJHEIGHT, srcSurface, screenSurface); } copyRect(_x1d_menu[h], _y1d_menu[h], _itemLocations[n].x, _itemLocations[n].y, OBJWIDTH, OBJHEIGHT, cursorSurface, screenSurface); } if (x < 7) print_abc(textIcon, _itemLocations[x].x - 2, _itemLocations[x].y - 7); }
void DrasculaEngine::volumeControls() { if (_lang == kSpanish) loadPic(95, tableSurface); copyRect(1, 56, 73, 63, 177, 97, tableSurface, screenSurface); updateScreen(73, 63, 73, 63, 177, 97, screenSurface); setCursor(kCursorCrosshair); showCursor(); while (!shouldQuit()) { int masterVolume = CLIP((_mixer->getVolumeForSoundType(Audio::Mixer::kPlainSoundType) / 16), 0, 15); int voiceVolume = CLIP((_mixer->getVolumeForSoundType(Audio::Mixer::kSpeechSoundType) / 16), 0, 15); int musicVolume = CLIP((_mixer->getVolumeForSoundType(Audio::Mixer::kMusicSoundType) / 16), 0, 15); int masterVolumeY = 72 + 61 - masterVolume * 4; int voiceVolumeY = 72 + 61 - voiceVolume * 4; int musicVolumeY = 72 + 61 - musicVolume * 4; updateRoom(); copyRect(1, 56, 73, 63, 177, 97, tableSurface, screenSurface); copyBackground(183, 56, 82, masterVolumeY, 39, 2 + masterVolume * 4, tableSurface, screenSurface); copyBackground(183, 56, 138, voiceVolumeY, 39, 2 + voiceVolume * 4, tableSurface, screenSurface); copyBackground(183, 56, 194, musicVolumeY, 39, 2 + musicVolume * 4, tableSurface, screenSurface); updateScreen(); updateEvents(); // we're ignoring keypresses, so just empty the keyboard buffer while (getScan()) ; if (rightMouseButton == 1) { delay(100); break; } if (leftMouseButton == 1) { delay(100); if (mouseX > 80 && mouseX < 121) { updateVolume(Audio::Mixer::kPlainSoundType, masterVolumeY); } if (mouseX > 136 && mouseX < 178) { updateVolume(Audio::Mixer::kSpeechSoundType, voiceVolumeY); } if (mouseX > 192 && mouseX < 233) { updateVolume(Audio::Mixer::kMusicSoundType, musicVolumeY); } } } if (_lang == kSpanish) loadPic(974, tableSurface); selectVerb(kVerbNone); updateEvents(); }
bool DrasculaEngine::saveLoadScreen() { char names[10][23]; char file[50]; char fileEpa[50]; int n, n2, num_sav = 0, y = 27; Common::InSaveFile *sav; clearRoom(); snprintf(fileEpa, 50, "%s.epa", _targetName.c_str()); if (!(sav = _saveFileMan->openForLoading(fileEpa))) { Common::OutSaveFile *epa; if (!(epa = _saveFileMan->openForSaving(fileEpa))) error("Can't open %s file", fileEpa); for (n = 0; n < NUM_SAVES; n++) epa->writeString("*\n"); epa->finalize(); delete epa; if (!(sav = _saveFileMan->openForLoading(fileEpa))) { error("Can't open %s file", fileEpa); } } for (n = 0; n < NUM_SAVES; n++) { strncpy(names[n], sav->readLine().c_str(), 23); names[n][22] = '\0'; // make sure the savegame name is 0-terminated } delete sav; loadPic("savescr.alg", bgSurface, HALF_PAL); color_abc(kColorLightGreen); select[0] = 0; _system->setFeatureState(OSystem::kFeatureVirtualKeyboard, true); setCursor(kCursorCrosshair); while (!shouldQuit()) { y = 27; copyBackground(); for (n = 0; n < NUM_SAVES; n++) { print_abc(names[n], 116, y); y = y + 9; } print_abc(select, 117, 15); updateScreen(); y = 27; updateEvents(); if (leftMouseButton == 1) { delay(50); for (n = 0; n < NUM_SAVES; n++) { if (mouseX > 115 && mouseY > y + (9 * n) && mouseX < 115 + 175 && mouseY < y + 10 + (9 * n)) { strcpy(select, names[n]); if (strcmp(select, "*")) selectionMade = 1; else { enterName(); strcpy(names[n], select); if (selectionMade == 1) { snprintf(file, 50, "%s%02d", _targetName.c_str(), n + 1); saveGame(file); Common::OutSaveFile *tsav; if (!(tsav = _saveFileMan->openForSaving(fileEpa))) { error("Can't open %s file", fileEpa); } for (n = 0; n < NUM_SAVES; n++) { tsav->writeString(names[n]); tsav->writeString("\n"); } tsav->finalize(); delete tsav; } } print_abc(select, 117, 15); y = 27; for (n2 = 0; n2 < NUM_SAVES; n2++) { print_abc(names[n2], 116, y); y = y + 9; } if (selectionMade == 1) { snprintf(file, 50, "%s%02d", _targetName.c_str(), n + 1); } num_sav = n; } } if (mouseX > 117 && mouseY > 15 && mouseX < 295 && mouseY < 24 && selectionMade == 1) { enterName(); strcpy(names[num_sav], select); print_abc(select, 117, 15); y = 27; for (n2 = 0; n2 < NUM_SAVES; n2++) { print_abc(names[n2], 116, y); y = y + 9; } if (selectionMade == 1) { snprintf(file, 50, "%s%02d", _targetName.c_str(), n + 1); saveGame(file); Common::OutSaveFile *tsav; if (!(tsav = _saveFileMan->openForSaving(fileEpa))) { error("Can't open %s file", fileEpa); } for (n = 0; n < NUM_SAVES; n++) { tsav->writeString(names[n]); tsav->writeString("\n"); } tsav->finalize(); delete tsav; } } if (mouseX > 125 && mouseY > 123 && mouseX < 199 && mouseY < 149 && selectionMade == 1) { if (!loadGame(file)) { _system->setFeatureState(OSystem::kFeatureVirtualKeyboard, false); return false; } break; } else if (mouseX > 208 && mouseY > 123 && mouseX < 282 && mouseY < 149 && selectionMade == 1) { saveGame(file); Common::OutSaveFile *tsav; if (!(tsav = _saveFileMan->openForSaving(fileEpa))) { error("Can't open %s file", fileEpa); } for (n = 0; n < NUM_SAVES; n++) { tsav->writeString(names[n]); tsav->writeString("\n"); } tsav->finalize(); delete tsav; } else if (mouseX > 168 && mouseY > 154 && mouseX < 242 && mouseY < 180) break; else if (selectionMade == 0) { print_abc("Please select a slot", 117, 15); } updateScreen(); delay(200); } y = 26; delay(5); } selectVerb(kVerbNone); clearRoom(); loadPic(roomNumber, bgSurface, HALF_PAL); selectionMade = 0; _system->setFeatureState(OSystem::kFeatureVirtualKeyboard, false); return true; }