本文整理汇总了C++中reg_t::toSint16方法的典型用法代码示例。如果您正苦于以下问题:C++ reg_t::toSint16方法的具体用法?C++ reg_t::toSint16怎么用?C++ reg_t::toSint16使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类reg_t
的用法示例。
在下文中一共展示了reg_t::toSint16方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: make_reg
reg_t reg_t::operator+(const reg_t right) const {
if (isPointer() && right.isNumber()) {
// Pointer arithmetics. Only some pointer types make sense here
SegmentObj *mobj = g_sci->getEngineState()->_segMan->getSegmentObj(getSegment());
if (!mobj)
error("[VM]: Attempt to add %d to invalid pointer %04x:%04x", right.getOffset(), PRINT_REG(*this));
switch (mobj->getType()) {
case SEG_TYPE_LOCALS:
case SEG_TYPE_SCRIPT:
case SEG_TYPE_STACK:
case SEG_TYPE_DYNMEM:
return make_reg(getSegment(), getOffset() + right.toSint16());
default:
return lookForWorkaround(right, "addition");
}
} else if (isNumber() && right.isPointer()) {
// Adding a pointer to a number, flip the order
return right + *this;
} else if (isNumber() && right.isNumber()) {
// Normal arithmetics
return make_reg(0, toSint16() + right.toSint16());
} else {
return lookForWorkaround(right, "addition");
}
}
示例2: syncAudioVolumeGlobalsToScummVM
void GuestAdditions::syncAudioVolumeGlobalsToScummVM(const int index, const reg_t value) const {
switch (g_sci->getGameId()) {
case GID_GK2:
if (index == kGlobalVarGK2MusicVolume) {
const int16 musicVolume = value.toSint16() * Audio::Mixer::kMaxMixerVolume / Audio32::kMaxVolume;
ConfMan.setInt("music_volume", musicVolume);
}
break;
case GID_LSL6HIRES:
if (index == kGlobalVarLSL6HiresMusicVolume) {
const int16 musicVolume = value.toSint16() * Audio::Mixer::kMaxMixerVolume / kLSL6HiresUIVolumeMax;
ConfMan.setInt("music_volume", musicVolume);
}
break;
case GID_PHANTASMAGORIA:
if (index == kGlobalVarPhant1MusicVolume) {
const int16 musicVolume = value.toSint16() * Audio::Mixer::kMaxMixerVolume / MUSIC_MASTERVOLUME_MAX;
ConfMan.setInt("music_volume", musicVolume);
} else if (index == kGlobalVarPhant1DACVolume) {
const int16 dacVolume = value.toSint16() * Audio::Mixer::kMaxMixerVolume / Audio32::kMaxVolume;
ConfMan.setInt("sfx_volume", dacVolume);
ConfMan.setInt("speech_volume", dacVolume);
}
break;
case GID_TORIN:
if (index == kGlobalVarTorinMusicVolume ||
index == kGlobalVarTorinSFXVolume ||
index == kGlobalVarTorinSpeechVolume) {
const int16 volume = value.toSint16() * Audio::Mixer::kMaxMixerVolume / 100;
switch (index) {
case kGlobalVarTorinMusicVolume:
ConfMan.setInt("music_volume", volume);
break;
case kGlobalVarTorinSFXVolume:
ConfMan.setInt("sfx_volume", volume);
break;
case kGlobalVarTorinSpeechVolume:
ConfMan.setInt("speech_volume", volume);
break;
}
}
break;
default:
break;
}
}
示例3: syncMessageTypeToScummVMUsingDefaultStrategy
void GuestAdditions::syncMessageTypeToScummVMUsingDefaultStrategy(const int index, const reg_t value) {
if (index == kGlobalVarMessageType) {
// ScummVM audio options haven't been applied yet. Use this set call
// as a trigger to apply defaults from ScummVM, ignoring the default
// value that was just received from the game scripts
if (!_messageTypeSynced || _state->variables[VAR_GLOBAL][kGlobalVarQuit] == TRUE_REG) {
_messageTypeSynced = true;
syncAudioOptionsFromScummVM();
return;
}
ConfMan.setBool("subtitles", value.toSint16() & kMessageTypeSubtitles);
ConfMan.setBool("speech_mute", !(value.toSint16() & kMessageTypeSpeech));
}
}
示例4: syncTextSpeedToScummVM
void GuestAdditions::syncTextSpeedToScummVM(const int index, const reg_t value) const {
if (index == kGlobalVarTextSpeed) {
ConfMan.setInt("talkspeed", (8 - value.toSint16()) * 255 / 8);
}
}