本文整理汇总了C++中SELECTOR函数的典型用法代码示例。如果您正苦于以下问题:C++ SELECTOR函数的具体用法?C++ SELECTOR怎么用?C++ SELECTOR使用的例子?那么, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了SELECTOR函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: 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);
}
}
}
示例2: 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);
}
}
}
示例3: 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;
}
示例4: 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;
}
}
}
示例5: debugC
reg_t SoundCommandParser::kDoSoundSetVolume(int argc, reg_t *argv, reg_t acc) {
reg_t obj = argv[0];
int16 value = argv[1].toSint16();
MusicEntry *musicSlot = _music->getSlot(obj);
if (!musicSlot) {
// Do not throw a warning if the sound can't be found, as in some games
// this is called before the actual sound is loaded (e.g. SQ4CD, with
// the drum sounds of the energizer bunny at the beginning), so this is
// normal behavior.
//warning("cmdSetSoundVolume: Slot not found (%04x:%04x)", PRINT_REG(obj));
return acc;
}
debugC(kDebugLevelSound, "kDoSound(setVolume): %d", value);
value = CLIP<int>(value, 0, MUSIC_VOLUME_MAX);
if (musicSlot->volume != value) {
musicSlot->volume = value;
_music->soundSetVolume(musicSlot, value);
writeSelectorValue(_segMan, obj, SELECTOR(vol), value);
}
return acc;
}
示例6: warning
void SoundCommandParser::processDisposeSound(reg_t obj) {
MusicEntry *musicSlot = _music->getSlot(obj);
if (!musicSlot) {
warning("kDoSound(dispose): Slot not found (%04x:%04x)", PRINT_REG(obj));
return;
}
processStopSound(obj, false);
_music->soundKill(musicSlot);
writeSelectorValue(_segMan, obj, SELECTOR(handle), 0);
if (_soundVersion >= SCI_VERSION_1_EARLY)
writeSelector(_segMan, obj, SELECTOR(nodePtr), NULL_REG);
else
writeSelectorValue(_segMan, obj, SELECTOR(state), kSoundStopped);
}
示例7: kArrayGetData
reg_t kArrayGetData(EngineState *s, int argc, reg_t *argv) {
if (s->_segMan->isObject(argv[0])) {
return readSelector(s->_segMan, argv[0], SELECTOR(data));
}
return argv[0];
}
示例8: getDetectionAddr
bool GameFeatures::autoDetectSci21StringFunctionType() {
// Look up the script address
reg_t addr = getDetectionAddr("Str", SELECTOR(size));
if (!addr.segment)
return false;
uint16 offset = addr.offset;
Script *script = _segMan->getScript(addr.segment);
while (true) {
int16 opparams[4];
byte extOpcode;
byte opcode;
offset += readPMachineInstruction(script->getBuf(offset), extOpcode, opparams);
opcode = extOpcode >> 1;
// Check for end of script
if (opcode == op_ret || offset >= script->getBufSize())
break;
if (opcode == op_callk) {
uint16 kFuncNum = opparams[0];
// SCI2.1 games which use the new kString functions call kString(8).
// Earlier ones call the callKernel script function, but not kString
// directly
if (_kernel->getKernelName(kFuncNum) == "String")
return true;
}
}
return false; // not found a call to kString
}
示例9: if
SciVersion GameFeatures::detectDoSoundType() {
if (_doSoundType == SCI_VERSION_NONE) {
if (getSciVersion() == SCI_VERSION_0_EARLY) {
// Almost all of the SCI0EARLY games use different sound resources than
// SCI0LATE. Although the last SCI0EARLY game (lsl2) uses SCI0LATE resources
_doSoundType = g_sci->getResMan()->detectEarlySound() ? SCI_VERSION_0_EARLY : SCI_VERSION_0_LATE;
#ifdef ENABLE_SCI32
} else if (getSciVersion() >= SCI_VERSION_2_1_EARLY) {
_doSoundType = SCI_VERSION_2_1_EARLY;
#endif
} else if (SELECTOR(nodePtr) == -1) {
// No nodePtr selector, so this game is definitely using newer
// SCI0 sound code (i.e. SCI_VERSION_0_LATE)
_doSoundType = SCI_VERSION_0_LATE;
} else if (getSciVersion() >= SCI_VERSION_1_LATE) {
// All SCI1 late games use the newer doSound semantics
_doSoundType = SCI_VERSION_1_LATE;
} else {
if (!autoDetectSoundType()) {
warning("DoSound detection failed, taking an educated guess");
if (getSciVersion() >= SCI_VERSION_1_MIDDLE)
_doSoundType = SCI_VERSION_1_LATE;
else if (getSciVersion() > SCI_VERSION_01)
_doSoundType = SCI_VERSION_1_EARLY;
}
}
debugC(1, kDebugLevelSound, "Detected DoSound type: %s", getSciVersionDesc(_doSoundType));
}
return _doSoundType;
}
示例10: kSaid
reg_t kSaid(EngineState *s, int argc, reg_t *argv) {
reg_t heap_said_block = argv[0];
byte *said_block;
int new_lastmatch;
Vocabulary *voc = g_sci->getVocabulary();
#ifdef DEBUG_PARSER
const int debug_parser = 1;
#else
const int debug_parser = 0;
#endif
if (!heap_said_block.getSegment())
return NULL_REG;
said_block = (byte *)s->_segMan->derefBulkPtr(heap_said_block, 0);
if (!said_block) {
warning("Said on non-string, pointer %04x:%04x", PRINT_REG(heap_said_block));
return NULL_REG;
}
#ifdef DEBUG_PARSER
debugN("Said block: ");
g_sci->getVocabulary()->debugDecipherSaidBlock(said_block);
#endif
if (voc->parser_event.isNull() || (readSelectorValue(s->_segMan, voc->parser_event, SELECTOR(claimed)))) {
return NULL_REG;
}
new_lastmatch = said(said_block, debug_parser);
if (new_lastmatch != SAID_NO_MATCH) { /* Build and possibly display a parse tree */
#ifdef DEBUG_PARSER
debugN("kSaid: Match.\n");
#endif
s->r_acc = make_reg(0, 1);
if (new_lastmatch != SAID_PARTIAL_MATCH)
writeSelectorValue(s->_segMan, voc->parser_event, SELECTOR(claimed), 1);
} else {
return NULL_REG;
}
return s->r_acc;
}
示例11: readSelectorValue
Common::Rect GfxCompare::getNSRect(reg_t object, bool fixRect) {
Common::Rect nsRect;
nsRect.top = readSelectorValue(_segMan, object, SELECTOR(nsTop));
nsRect.left = readSelectorValue(_segMan, object, SELECTOR(nsLeft));
nsRect.bottom = readSelectorValue(_segMan, object, SELECTOR(nsBottom));
nsRect.right = readSelectorValue(_segMan, object, SELECTOR(nsRight));
if (fixRect) {
// nsRect top/left may be negative, adjust accordingly
if (nsRect.top < 0)
nsRect.top = 0;
if (nsRect.left < 0)
nsRect.left = 0;
}
return nsRect;
}
示例12: 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;
}
示例13: make_reg
void GuestAdditions::syncGK2VolumeFromScummVM(const int16 musicVolume) const {
_state->variables[VAR_GLOBAL][kGlobalVarGK2MusicVolume] = make_reg(0, musicVolume);
// Calling `setVol` on all sounds is necessary to propagate the volume
// change to existing sounds, and matches how game scripts propagate
// volume changes when the in-game music slider is moved
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);
reg_t params[] = { make_reg(0, musicVolume) };
invokeSelector(sound->value, SELECTOR(setVol), 1, params);
soundId = sound->succ;
}
}
}
示例14: while
bool GfxAnimate::invoke(List *list, int argc, reg_t *argv) {
reg_t curAddress = list->first;
Node *curNode = _s->_segMan->lookupNode(curAddress);
reg_t curObject;
uint16 signal;
while (curNode) {
curObject = curNode->value;
if (_fastCastEnabled) {
// Check if the game has a fastCast object set
// if we don't abort kAnimate processing, at least in kq5 there will be animation cels drawn into speech boxes.
if (!_s->variables[VAR_GLOBAL][84].isNull()) {
// This normally points to an object called "fastCast",
// but for example in Eco Quest 1 it may also point to an object called "EventHandler" (see bug #5170)
// Original SCI only checked, if this global was not 0.
return false;
}
}
signal = readSelectorValue(_s->_segMan, curObject, SELECTOR(signal));
if (!(signal & kSignalFrozen)) {
// Call .doit method of that object
invokeSelector(_s, curObject, SELECTOR(doit), argc, argv, 0);
// If a game is being loaded, stop processing
if (_s->abortScriptProcessing != kAbortNone)
return true; // Stop processing
// Lookup node again, since the nodetable it was in may have been reallocated.
// The node might have been deallocated at this point (e.g. LSL2, room 42),
// in which case the node reference will be null and the loop will stop below.
// If the node is deleted from kDeleteKey, it won't have a successor node, thus
// list processing will stop here (which is what SSCI does).
curNode = _s->_segMan->lookupNode(curAddress, false);
}
if (curNode) {
curAddress = curNode->succ;
curNode = _s->_segMan->lookupNode(curAddress);
}
}
return true;
}
示例15: kRobot
reg_t kRobot(EngineState *s, int argc, reg_t *argv) {
int16 subop = argv[0].toUint16();
switch (subop) {
case 0: { // init
int id = argv[1].toUint16();
reg_t obj = argv[2];
int16 flag = argv[3].toSint16();
int16 x = argv[4].toUint16();
int16 y = argv[5].toUint16();
warning("kRobot(init), id %d, obj %04x:%04x, flag %d, x=%d, y=%d", id, PRINT_REG(obj), flag, x, y);
g_sci->_robotDecoder->load(id);
g_sci->_robotDecoder->start();
g_sci->_robotDecoder->setPos(x, y);
}
break;
case 1: // LSL6 hires (startup)
// TODO
return NULL_REG; // an integer is expected
case 4: { // start - we don't really have a use for this one
//int id = argv[1].toUint16();
//warning("kRobot(start), id %d", id);
}
break;
case 7: // unknown, called e.g. by Phantasmagoria
warning("kRobot(%d)", subop);
break;
case 8: // sync
//if (true) { // debug: automatically skip all robot videos
if (g_sci->_robotDecoder->endOfVideo()) {
g_sci->_robotDecoder->close();
// Signal the engine scripts that the video is done
writeSelector(s->_segMan, argv[1], SELECTOR(signal), SIGNAL_REG);
} else {
writeSelector(s->_segMan, argv[1], SELECTOR(signal), NULL_REG);
}
break;
default:
warning("kRobot(%d)", subop);
break;
}
return s->r_acc;
}