本文整理汇总了C++中writeSelectorValue函数的典型用法代码示例。如果您正苦于以下问题:C++ writeSelectorValue函数的具体用法?C++ writeSelectorValue怎么用?C++ writeSelectorValue使用的例子?那么, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了writeSelectorValue函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: readSelectorValue
void GfxCompare::kernelBaseSetter(reg_t object) {
if (lookupSelector(_segMan, object, SELECTOR(brLeft), NULL, NULL) == kSelectorVariable) {
int16 x = readSelectorValue(_segMan, object, SELECTOR(x));
int16 y = readSelectorValue(_segMan, object, SELECTOR(y));
int16 z = (SELECTOR(z) > -1) ? readSelectorValue(_segMan, object, SELECTOR(z)) : 0;
int16 yStep = readSelectorValue(_segMan, object, SELECTOR(yStep));
GuiResourceId viewId = readSelectorValue(_segMan, object, SELECTOR(view));
int16 loopNo = readSelectorValue(_segMan, object, SELECTOR(loop));
int16 celNo = readSelectorValue(_segMan, object, SELECTOR(cel));
uint16 scaleSignal = 0;
if (getSciVersion() >= SCI_VERSION_1_1)
scaleSignal = readSelectorValue(_segMan, object, SELECTOR(scaleSignal));
Common::Rect celRect;
GfxView *tmpView = _cache->getView(viewId);
if (!tmpView->isScaleable())
scaleSignal = 0;
if (scaleSignal & kScaleSignalDoScaling) {
celRect = getNSRect(object);
} else {
tmpView->getCelRect(loopNo, celNo, x, y, z, celRect);
}
celRect.bottom = y + 1;
celRect.top = celRect.bottom - yStep;
writeSelectorValue(_segMan, object, SELECTOR(brLeft), celRect.left);
writeSelectorValue(_segMan, object, SELECTOR(brRight), celRect.right);
writeSelectorValue(_segMan, object, SELECTOR(brTop), celRect.top);
writeSelectorValue(_segMan, object, SELECTOR(brBottom), celRect.bottom);
}
}
示例2: switch
void GuestAdditions::syncGK1StartupVolumeFromScummVM(const int index, const reg_t value) const {
if (index == kGlobalVarGK1Music1 || index == kGlobalVarGK1Music2 ||
index == kGlobalVarGK1DAC1 || index == kGlobalVarGK1DAC2 ||
index == kGlobalVarGK1DAC3) {
int16 volume;
Selector selector;
switch (readSelectorValue(_segMan, value, SELECTOR(type))) {
case kSoundsMusicType: {
volume = (ConfMan.getInt("music_volume") + 1) * MUSIC_VOLUME_MAX / Audio::Mixer::kMaxMixerVolume;
selector = SELECTOR(musicVolume);
break;
}
case kSoundsSoundType: {
volume = (ConfMan.getInt("sound_volume") + 1) * MUSIC_VOLUME_MAX / Audio::Mixer::kMaxMixerVolume;
selector = SELECTOR(soundVolume);
break;
}
default:
error("Unknown sound type");
}
writeSelectorValue(_segMan, value, selector, volume);
writeSelectorValue(_segMan, value, selector, volume);
}
}
示例3: SELECTOR
void GuestAdditions::syncGK1VolumeFromScummVM(const int16 musicVolume, const int16 dacVolume) const {
const reg_t soundsId = _state->variables[VAR_GLOBAL][kGlobalVarSounds];
if (!soundsId.isNull()) {
List *sounds = _segMan->lookupList(readSelector(_segMan, soundsId, SELECTOR(elements)));
reg_t soundId = sounds->first;
while (!soundId.isNull()) {
Node *sound = _segMan->lookupNode(soundId);
const int16 type = readSelectorValue(_segMan, sound->value, SELECTOR(type));
int16 volume;
if (type == kSoundsMusicType) {
volume = ConfMan.getBool("mute") ? 0 : musicVolume;
writeSelectorValue(_segMan, sound->value, SELECTOR(musicVolume), musicVolume);
} else if (type == kSoundsSoundType) {
volume = dacVolume;
writeSelectorValue(_segMan, sound->value, SELECTOR(soundVolume), dacVolume);
} else {
error("Unknown sound type %d", type);
}
// `setVolume` will set the `vol` property on the sound object;
// if it did not do this, an invocation of the `setVol` selector
// would need to be here (though doing so would result in
// recursion, so don't)
g_sci->_soundCmd->setVolume(sound->value, volume);
soundId = sound->succ;
}
}
}
示例4: warning
void SoundCommandParser::processStopSound(reg_t obj, bool sampleFinishedPlaying) {
MusicEntry *musicSlot = _music->getSlot(obj);
if (!musicSlot) {
warning("kDoSound(stop): Slot not found (%04x:%04x)", PRINT_REG(obj));
return;
}
if (_soundVersion <= SCI_VERSION_0_LATE) {
writeSelectorValue(_segMan, obj, SELECTOR(state), kSoundStopped);
} else {
writeSelectorValue(_segMan, obj, SELECTOR(handle), 0);
}
// Set signal selector in sound SCI0 games only, when the sample has
// finished playing. If we don't set it at all, we get a problem when using
// vaporizer on the 2 guys. If we set it all the time, we get no music in
// sq3new and kq1.
// FIXME: This *may* be wrong, it's impossible to find out in Sierra DOS
// SCI, because SCI0 under DOS didn't have sfx drivers included.
// We need to set signal in sound SCI1+ games all the time.
if ((_soundVersion > SCI_VERSION_0_LATE) || sampleFinishedPlaying)
writeSelectorValue(_segMan, obj, SELECTOR(signal), SIGNAL_OFFSET);
musicSlot->dataInc = 0;
musicSlot->signal = SIGNAL_OFFSET;
_music->soundStop(musicSlot);
}
示例5: debugC
reg_t SoundCommandParser::kDoSoundSetPriority(int argc, reg_t *argv, reg_t acc) {
reg_t obj = argv[0];
int16 value = argv[1].toSint16();
debugC(kDebugLevelSound, "kDoSound(setPriority): %04x:%04x, %d", PRINT_REG(obj), value);
MusicEntry *musicSlot = _music->getSlot(obj);
if (!musicSlot) {
debugC(kDebugLevelSound, "kDoSound(setPriority): Slot not found (%04x:%04x)", PRINT_REG(obj));
return acc;
}
if (value == -1) {
uint16 resourceId = musicSlot->resourceId;
// Set priority from the song data
Resource *song = _resMan->findResource(ResourceId(kResourceTypeSound, resourceId), 0);
if (song->data[0] == 0xf0)
_music->soundSetPriority(musicSlot, song->data[1]);
else
warning("kDoSound(setPriority): Attempt to unset song priority when there is no built-in value");
//pSnd->prio=0;field_15B=0
writeSelectorValue(_segMan, obj, SELECTOR(flags), readSelectorValue(_segMan, obj, SELECTOR(flags)) & 0xFD);
} else {
// Scripted priority
//pSnd->field_15B=1;
writeSelectorValue(_segMan, obj, SELECTOR(flags), readSelectorValue(_segMan, obj, SELECTOR(flags)) | 2);
//DoSOund(0xF,hobj,w)
}
return acc;
}
示例6: writeSelectorValue
void GfxAnimate::restoreAndDelete(int argc, reg_t *argv) {
AnimateList::iterator it;
const AnimateList::iterator end = _list.end();
// This has to be done in a separate loop. At least in sq1 some .dispose
// modifies FIXEDLOOP flag in signal for another object. In that case we
// would overwrite the new signal with our version of the old signal.
for (it = _list.begin(); it != end; ++it) {
// Finally update signal
writeSelectorValue(_s->_segMan, it->object, SELECTOR(signal), it->signal);
}
for (it = _list.legacy_reverse_begin(); it != end; --it) {
// We read out signal here again, this is not by accident but to ensure
// that we got an up-to-date signal
it->signal = readSelectorValue(_s->_segMan, it->object, SELECTOR(signal));
if ((it->signal & (kSignalNoUpdate | kSignalRemoveView)) == 0) {
_paint16->bitsRestore(readSelector(_s->_segMan, it->object, SELECTOR(underBits)));
writeSelectorValue(_s->_segMan, it->object, SELECTOR(underBits), 0);
}
if (it->signal & kSignalDisposeMe) {
// Call .delete_ method of that object
invokeSelector(_s, it->object, SELECTOR(delete_), argc, argv, 0);
}
}
}
示例7: kMapKeyToDir
reg_t kMapKeyToDir(EngineState *s, int argc, reg_t *argv) {
reg_t obj = argv[0];
SegManager *segMan = s->_segMan;
if (readSelectorValue(segMan, obj, SELECTOR(type)) == SCI_EVENT_KEYBOARD) { // Keyboard
uint16 message = readSelectorValue(segMan, obj, SELECTOR(message));
uint16 eventType = SCI_EVENT_DIRECTION;
// Check if the game is using cursor views. These games allowed control
// of the mouse cursor via the keyboard controls (the so called
// "PseudoMouse" functionality in script 933).
if (g_sci->_features->detectSetCursorType() == SCI_VERSION_1_1)
eventType |= SCI_EVENT_KEYBOARD;
for (int i = 0; i < 9; i++) {
if (keyToDirMap[i].key == message) {
writeSelectorValue(segMan, obj, SELECTOR(type), eventType);
writeSelectorValue(segMan, obj, SELECTOR(message), keyToDirMap[i].direction);
return TRUE_REG; // direction mapped
}
}
return NULL_REG; // unknown direction
}
return s->r_acc; // no keyboard event to map, leave accumulator unchanged
}
示例8: readSelectorValue
void GfxAnimate::applyGlobalScaling(AnimateList::iterator entry, GfxView *view) {
// Global scaling uses global var 2 and some other stuff to calculate scaleX/scaleY
int16 maxScale = readSelectorValue(_s->_segMan, entry->object, SELECTOR(maxScale));
int16 celHeight = view->getHeight(entry->loopNo, entry->celNo);
int16 maxCelHeight = (maxScale * celHeight) >> 7;
reg_t globalVar2 = _s->variables[VAR_GLOBAL][2]; // current room object
int16 vanishingY = readSelectorValue(_s->_segMan, globalVar2, SELECTOR(vanishingY));
int16 fixedPortY = _ports->getPort()->rect.bottom - vanishingY;
int16 fixedEntryY = entry->y - vanishingY;
if (!fixedEntryY)
fixedEntryY = 1;
if ((celHeight == 0) || (fixedPortY == 0))
error("global scaling panic");
entry->scaleY = ( maxCelHeight * fixedEntryY ) / fixedPortY;
entry->scaleY = (entry->scaleY * 128) / celHeight;
entry->scaleX = entry->scaleY;
// and set objects scale selectors
writeSelectorValue(_s->_segMan, entry->object, SELECTOR(scaleX), entry->scaleX);
writeSelectorValue(_s->_segMan, entry->object, SELECTOR(scaleY), entry->scaleY);
}
示例9: writeSelectorValue
void SciEngine::setLauncherLanguage() {
if (_gameDescription->flags & ADGF_ADDENGLISH) {
// If game is multilingual
if (Common::parseLanguage(ConfMan.get("language")) == Common::EN_ANY) {
// and English was selected as language
if (SELECTOR(printLang) != -1) // set text language to English
writeSelectorValue(_gamestate->_segMan, _gameObjectAddress, SELECTOR(printLang), K_LANG_ENGLISH);
if (SELECTOR(parseLang) != -1) // and set parser language to English as well
writeSelectorValue(_gamestate->_segMan, _gameObjectAddress, SELECTOR(parseLang), K_LANG_ENGLISH);
}
}
}
示例10: writeSelectorValue
void GuestAdditions::syncLSL6HiresUI(const int16 musicVolume) const {
const reg_t musicDialId = _segMan->findObjectByName("volumeDial");
if (!musicDialId.isNull()) {
writeSelectorValue(_segMan, musicDialId, SELECTOR(curPos), musicVolume);
writeSelectorValue(_segMan, musicDialId, SELECTOR(cel), musicVolume);
reg_t params[] = { make_reg(0, musicVolume) };
invokeSelector(musicDialId, SELECTOR(update), 1, params);
if (_segMan->getObject(musicDialId)->isInserted()) {
g_sci->_gfxFrameout->kernelUpdateScreenItem(musicDialId);
}
}
}
示例11: warning
void SoundCommandParser::processPlaySound(reg_t obj) {
MusicEntry *musicSlot = _music->getSlot(obj);
if (!musicSlot) {
warning("kDoSound(play): Slot not found (%04x:%04x), initializing it manually", PRINT_REG(obj));
// The sound hasn't been initialized for some reason, so initialize it
// here. Happens in KQ6, room 460, when giving the creature (child) to
// the bookworm. Fixes bugs #3413301 and #3421098.
processInitSound(obj);
musicSlot = _music->getSlot(obj);
if (!musicSlot)
error("Failed to initialize uninitialized sound slot");
}
int resourceId = getSoundResourceId(obj);
if (musicSlot->resourceId != resourceId) { // another sound loaded into struct
processDisposeSound(obj);
processInitSound(obj);
// Find slot again :)
musicSlot = _music->getSlot(obj);
}
writeSelector(_segMan, obj, SELECTOR(handle), obj);
if (_soundVersion >= SCI_VERSION_1_EARLY) {
writeSelector(_segMan, obj, SELECTOR(nodePtr), obj);
writeSelectorValue(_segMan, obj, SELECTOR(min), 0);
writeSelectorValue(_segMan, obj, SELECTOR(sec), 0);
writeSelectorValue(_segMan, obj, SELECTOR(frame), 0);
writeSelectorValue(_segMan, obj, SELECTOR(signal), 0);
} else {
writeSelectorValue(_segMan, obj, SELECTOR(state), kSoundPlaying);
}
musicSlot->loop = readSelectorValue(_segMan, obj, SELECTOR(loop));
musicSlot->priority = readSelectorValue(_segMan, obj, SELECTOR(priority));
// Reset hold when starting a new song. kDoSoundSetHold is always called after
// kDoSoundPlay to set it properly, if needed. Fixes bug #3413589.
musicSlot->hold = -1;
if (_soundVersion >= SCI_VERSION_1_EARLY)
musicSlot->volume = readSelectorValue(_segMan, obj, SELECTOR(vol));
debugC(kDebugLevelSound, "kDoSound(play): %04x:%04x number %d, loop %d, prio %d, vol %d", PRINT_REG(obj),
resourceId, musicSlot->loop, musicSlot->priority, musicSlot->volume);
_music->soundPlay(musicSlot);
// Reset any left-over signals
musicSlot->signal = 0;
musicSlot->fadeStep = 0;
}
示例12: readSelectorValue
void GfxCompare::kernelBaseSetter(reg_t object) {
if (lookupSelector(_segMan, object, SELECTOR(brLeft), NULL, NULL) == kSelectorVariable) {
int16 x = readSelectorValue(_segMan, object, SELECTOR(x));
int16 y = readSelectorValue(_segMan, object, SELECTOR(y));
int16 z = (SELECTOR(z) > -1) ? readSelectorValue(_segMan, object, SELECTOR(z)) : 0;
int16 yStep = readSelectorValue(_segMan, object, SELECTOR(yStep));
GuiResourceId viewId = readSelectorValue(_segMan, object, SELECTOR(view));
int16 loopNo = readSelectorValue(_segMan, object, SELECTOR(loop));
int16 celNo = readSelectorValue(_segMan, object, SELECTOR(cel));
// HACK: Ignore invalid views for now (perhaps unimplemented text views?)
if (viewId == 0xFFFF) // invalid view
return;
uint16 scaleSignal = 0;
if (getSciVersion() >= SCI_VERSION_1_1) {
scaleSignal = readSelectorValue(_segMan, object, SELECTOR(scaleSignal));
}
Common::Rect celRect;
GfxView *tmpView = _cache->getView(viewId);
if (!tmpView->isScaleable())
scaleSignal = 0;
if (scaleSignal & kScaleSignalDoScaling) {
celRect = getNSRect(object);
} else {
if (tmpView->isSci2Hires())
tmpView->adjustToUpscaledCoordinates(y, x);
tmpView->getCelRect(loopNo, celNo, x, y, z, celRect);
if (tmpView->isSci2Hires()) {
tmpView->adjustBackUpscaledCoordinates(celRect.top, celRect.left);
tmpView->adjustBackUpscaledCoordinates(celRect.bottom, celRect.right);
}
}
celRect.bottom = y + 1;
celRect.top = celRect.bottom - yStep;
writeSelectorValue(_segMan, object, SELECTOR(brLeft), celRect.left);
writeSelectorValue(_segMan, object, SELECTOR(brRight), celRect.right);
writeSelectorValue(_segMan, object, SELECTOR(brTop), celRect.top);
writeSelectorValue(_segMan, object, SELECTOR(brBottom), celRect.bottom);
}
}
示例13: adjustInvalidCels
void GfxAnimate::fill(byte &old_picNotValid) {
GfxView *view = NULL;
AnimateList::iterator it;
const AnimateList::iterator end = _list.end();
for (it = _list.begin(); it != end; ++it) {
// Get the corresponding view
view = _cache->getView(it->viewId);
adjustInvalidCels(view, it);
processViewScaling(view, it);
setNsRect(view, it);
//warning("%s view %d, loop %d, cel %d, signal %x", _s->_segMan->getObjectName(curObject), it->viewId, it->loopNo, it->celNo, it->signal);
// Calculate current priority according to y-coordinate
if (!(it->signal & kSignalFixedPriority)) {
it->priority = _ports->kernelCoordinateToPriority(it->y);
writeSelectorValue(_s->_segMan, it->object, SELECTOR(priority), it->priority);
}
if (it->signal & kSignalNoUpdate) {
if ((it->signal & (kSignalForceUpdate | kSignalViewUpdated))
|| (it->signal & kSignalHidden && !(it->signal & kSignalRemoveView))
|| (!(it->signal & kSignalHidden) && it->signal & kSignalRemoveView)
|| (it->signal & kSignalAlwaysUpdate))
old_picNotValid++;
it->signal &= ~kSignalStopUpdate;
} else {
if ((it->signal & kSignalStopUpdate) || (it->signal & kSignalAlwaysUpdate))
old_picNotValid++;
it->signal &= ~kSignalForceUpdate;
}
}
}
示例14: getSoundResourceId
void SoundCommandParser::processInitSound(reg_t obj) {
int resourceId = getSoundResourceId(obj);
// Check if a track with the same sound object is already playing
MusicEntry *oldSound = _music->getSlot(obj);
if (oldSound)
processDisposeSound(obj);
MusicEntry *newSound = new MusicEntry();
newSound->resourceId = resourceId;
newSound->soundObj = obj;
newSound->loop = readSelectorValue(_segMan, obj, SELECTOR(loop));
newSound->priority = readSelectorValue(_segMan, obj, SELECTOR(pri)) & 0xFF;
if (_soundVersion >= SCI_VERSION_1_EARLY)
newSound->volume = CLIP<int>(readSelectorValue(_segMan, obj, SELECTOR(vol)), 0, MUSIC_VOLUME_MAX);
newSound->reverb = -1; // initialize to SCI invalid, it'll be set correctly in soundInitSnd() below
debugC(kDebugLevelSound, "kDoSound(init): %04x:%04x number %d, loop %d, prio %d, vol %d", PRINT_REG(obj),
resourceId, newSound->loop, newSound->priority, newSound->volume);
initSoundResource(newSound);
_music->pushBackSlot(newSound);
if (newSound->soundRes || newSound->pStreamAud) {
// Notify the engine
if (_soundVersion <= SCI_VERSION_0_LATE)
writeSelectorValue(_segMan, obj, SELECTOR(state), kSoundInitialized);
else
writeSelector(_segMan, obj, SELECTOR(nodePtr), obj);
}
}
示例15: kLocalToGlobal
reg_t kLocalToGlobal(EngineState *s, int argc, reg_t *argv) {
reg_t obj = argv[0];
reg_t planeObject = argc > 1 ? argv[1] : NULL_REG; // SCI32
SegManager *segMan = s->_segMan;
if (obj.getSegment()) {
int16 x = readSelectorValue(segMan, obj, SELECTOR(x));
int16 y = readSelectorValue(segMan, obj, SELECTOR(y));
g_sci->_gfxCoordAdjuster->kernelLocalToGlobal(x, y, planeObject);
writeSelectorValue(segMan, obj, SELECTOR(x), x);
writeSelectorValue(segMan, obj, SELECTOR(y), y);
}
return s->r_acc;
}