TWINE: connect some of the advanced options menu settings

This commit is contained in:
Martin Gerhardy 2020-10-24 14:26:50 +02:00 committed by Eugene Sandulenko
parent 764640ac74
commit 2ccbff91d8
6 changed files with 63 additions and 39 deletions

View File

@ -92,6 +92,13 @@ enum VolumeMenuType {
kMasterVolume = 5
};
enum AdvOptionsMenuType {
kAgressiveMode = 0,
kPolygonDetails = 6,
kShadowSettings = 7,
kSceneryZoom = 8
};
namespace _priv {
/** Main Menu Settings
@ -169,13 +176,13 @@ static const int16 AdvOptionsMenuSettings[] = {
0, // unused
0,
26, // return to main menu
0,
kAgressiveMode,
4, // aggressive mode (manual|auto)
6,
kPolygonDetails,
31, // Polygon detail (full|medium|low)
7,
kShadowSettings,
32, // Shadows (all|character|no)
8,
kSceneryZoom,
33, // scenary zoon (on|off)
};
@ -438,7 +445,6 @@ void Menu::drawButton(const int16 *menuSettings, bool hover) {
int32 Menu::processMenu(int16 *menuSettings) {
int16 currentButton = menuSettings[MenuSettings_CurrentLoadedButton];
bool buttonsNeedRedraw = true;
bool musicChanged = false;
const int32 numEntry = menuSettings[MenuSettings_NumberOfButtons];
int32 maxButton = numEntry - 1;
@ -462,18 +468,42 @@ int32 Menu::processMenu(int16 *menuSettings) {
buttonsNeedRedraw = true;
}
// if its a volume button
if (menuSettings == VolumeMenuState) {
const int16 id = *(&menuSettings[MenuSettings_FirstButtonState] + currentButton * 2); // get button parameters from settings array
const int16 id = *(&menuSettings[MenuSettings_FirstButtonState] + currentButton * 2); // get button parameters from settings array
if (menuSettings == AdvOptionsMenuState) {
switch (id) {
case kAgressiveMode:
if (_engine->_input->toggleActionIfActive(TwinEActionType::UILeft) || _engine->_input->toggleActionIfActive(TwinEActionType::UIRight)) {
_engine->cfgfile.AutoAgressive = !_engine->cfgfile.AutoAgressive;
// TODO: set into actor
}
break;
case kPolygonDetails:
// TODO:
break;
case kShadowSettings:
if (_engine->_input->toggleActionIfActive(TwinEActionType::UILeft)) {
_engine->cfgfile.ShadowMode--;
} else if (_engine->_input->toggleActionIfActive(TwinEActionType::UIRight)) {
_engine->cfgfile.ShadowMode++;
}
_engine->cfgfile.ShadowMode %= 3;
break;
case kSceneryZoom:
if (_engine->_input->toggleActionIfActive(TwinEActionType::UILeft) || _engine->_input->toggleActionIfActive(TwinEActionType::UIRight)) {
_engine->cfgfile.SceZoom = !_engine->cfgfile.SceZoom;
}
break;
default:
break;
}
} else if (menuSettings == VolumeMenuState) {
Audio::Mixer *mixer = _engine->_system->getMixer();
switch (id) {
case kMusicVolume: {
int volume = mixer->getVolumeForSoundType(Audio::Mixer::SoundType::kMusicSoundType);
if (_engine->_input->isActionActive(TwinEActionType::UILeft)) {
volume -= 4;
}
if (((uint8)_engine->_input->toggleActionIfActive(TwinEActionType::UIRight))) { // on arrow key right
} else if (_engine->_input->isActionActive(TwinEActionType::UIRight)) {
volume += 4;
}
_engine->_music->musicVolume(volume);
@ -481,10 +511,9 @@ int32 Menu::processMenu(int16 *menuSettings) {
}
case kSoundVolume: {
int volume = mixer->getVolumeForSoundType(Audio::Mixer::kSFXSoundType);
if (((uint8)_engine->_input->toggleActionIfActive(TwinEActionType::UILeft))) { // on arrow key left
if (_engine->_input->isActionActive(TwinEActionType::UILeft)) {
volume -= 4;
}
if (((uint8)_engine->_input->toggleActionIfActive(TwinEActionType::UIRight))) { // on arrow key right
} else if (_engine->_input->isActionActive(TwinEActionType::UIRight)) {
volume += 4;
}
mixer->setVolumeForSoundType(Audio::Mixer::kSFXSoundType, volume);
@ -492,10 +521,9 @@ int32 Menu::processMenu(int16 *menuSettings) {
}
case kCDVolume: {
AudioCDManager::Status status = _engine->_system->getAudioCDManager()->getStatus();
if (((uint8)_engine->_input->toggleActionIfActive(TwinEActionType::UILeft))) { // on arrow key left
if (_engine->_input->isActionActive(TwinEActionType::UILeft)) {
status.volume -= 4;
}
if (((uint8)_engine->_input->toggleActionIfActive(TwinEActionType::UIRight))) { // on arrow key right
} else if (_engine->_input->isActionActive(TwinEActionType::UIRight)) {
status.volume += 4;
}
_engine->_system->getAudioCDManager()->setVolume(status.volume);
@ -503,10 +531,9 @@ int32 Menu::processMenu(int16 *menuSettings) {
}
case kLineVolume: {
int volume = mixer->getVolumeForSoundType(Audio::Mixer::kSpeechSoundType);
if (((uint8)_engine->_input->toggleActionIfActive(TwinEActionType::UILeft))) { // on arrow key left
if (_engine->_input->isActionActive(TwinEActionType::UILeft)) {
volume -= 4;
}
if (((uint8)_engine->_input->toggleActionIfActive(TwinEActionType::UIRight))) { // on arrow key right
} else if (_engine->_input->isActionActive(TwinEActionType::UIRight)) {
volume += 4;
}
mixer->setVolumeForSoundType(Audio::Mixer::kSpeechSoundType, volume);
@ -514,10 +541,9 @@ int32 Menu::processMenu(int16 *menuSettings) {
}
case kMasterVolume: {
int volume = mixer->getVolumeForSoundType(Audio::Mixer::kPlainSoundType);
if (((uint8)_engine->_input->toggleActionIfActive(TwinEActionType::UILeft))) { // on arrow key left
if (_engine->_input->isActionActive(TwinEActionType::UILeft)) {
volume -= 4;
}
if (((uint8)_engine->_input->toggleActionIfActive(TwinEActionType::UIRight))) { // on arrow key right
} else if (_engine->_input->isActionActive(TwinEActionType::UIRight)) {
volume += 4;
}
mixer->setVolumeForSoundType(Audio::Mixer::kPlainSoundType, volume);
@ -538,9 +564,7 @@ int32 Menu::processMenu(int16 *menuSettings) {
// draw plasma effect for the current selected button
drawButton(menuSettings, true);
if (musicChanged) {
// TODO: update volume settings
}
// TODO: update volume settings
} while (!_engine->_input->toggleActionIfActive(TwinEActionType::UIEnter));
currentButton = *(menuSettings + MenuSettings_FirstButton + currentButton * 2); // get current browsed button
@ -816,7 +840,7 @@ void Menu::drawBehaviour(HeroBehaviourType behaviour, int32 angle, int16 cantDra
_engine->_text->setFontColor(15);
char dialText[256];
if (_engine->_actor->heroBehaviour == 2 && _engine->_actor->autoAgressive == 1) {
if (_engine->_actor->heroBehaviour == kAggressive && _engine->_actor->autoAgressive == 1) {
_engine->_text->getMenuText(4, dialText, sizeof(dialText));
} else {
_engine->_text->getMenuText(_engine->_actor->heroBehaviour, dialText, sizeof(dialText));

View File

@ -44,12 +44,11 @@ namespace TwinE {
static const char allowedCharIndex[] = " ABCDEFGHIJKLM.NOPQRSTUVWXYZ-abcdefghijklm?nopqrstuvwxyz!0123456789\040\b\r\0";
void MenuOptions::newGame() {
int32 tmpFlagDisplayText;
#if TWINE_PLAY_INTROS
_engine->_music->stopMusic();
tmpFlagDisplayText = _engine->cfgfile.FlagDisplayText;
_engine->cfgfile.FlagDisplayText = 1;
int32 tmpFlagDisplayText = _engine->cfgfile.FlagDisplayText;
_engine->cfgfile.FlagDisplayText = true;
// intro screen 1 - twinsun
_engine->_screens->loadImage(RESSHQR_INTROSCREEN1IMG);
@ -90,6 +89,7 @@ void MenuOptions::newGame() {
_engine->setPalette(_engine->_screens->paletteRGBA);
_engine->cfgfile.FlagDisplayText = tmpFlagDisplayText;
#endif
}
void MenuOptions::showCredits() {

View File

@ -380,6 +380,7 @@ void Movements::processActorMovements(int32 actorIdx) {
}
}
// TODO: remove loopPressedKey here
if (!_engine->loopPressedKey || heroAction) {
// if continue walking
if (_engine->_input->isActionActive(TwinEActionType::MoveForward) || _engine->_input->isActionActive(TwinEActionType::MoveBackward)) {

View File

@ -1342,16 +1342,14 @@ static int32 lSET_NORMAL_PAL(TwinEEngine *engine, int32 actorIdx, ActorStruct *a
/*0x5E*/
static int32 lMESSAGE_SENDELL(TwinEEngine *engine, int32 actorIdx, ActorStruct *actor) {
int32 tmpFlagDisplayText;
engine->freezeTime();
engine->_screens->fadeToBlack(engine->_screens->paletteRGBA);
engine->_screens->loadImage(25);
engine->_text->textClipFull();
engine->_text->setFontCrossColor(15);
engine->_text->newGameVar4 = 0;
tmpFlagDisplayText = engine->cfgfile.FlagDisplayText;
engine->cfgfile.FlagDisplayText = 1;
const bool tmpFlagDisplayText = engine->cfgfile.FlagDisplayText;
engine->cfgfile.FlagDisplayText = true;
engine->_text->drawTextFullscreen(6);
engine->_text->newGameVar4 = 1;
engine->_text->textClipSmall();

View File

@ -233,7 +233,7 @@ void TwinEEngine::initConfigurations() {
cfgfile.UseAutoSaving = ConfGetIntOrDefault("UseAutoSaving", 0);
cfgfile.AutoAgressive = ConfGetIntOrDefault("CombatAuto", 0);
cfgfile.ShadowMode = ConfGetIntOrDefault("Shadow", 0);
cfgfile.SceZoom = ConfGetIntOrDefault("SceZoom", 0);
cfgfile.SceZoom = ConfGetIntOrDefault("SceZoom", 0) == 0;
cfgfile.WallCollision = ConfGetIntOrDefault("WallCollision", 0);
}
@ -412,8 +412,8 @@ int32 TwinEEngine::runGameEngine() { // mainLoopInteration
_text->newGameVar4 = 0;
_text->textClipFull();
_text->setFontCrossColor(15);
int32 tmpFlagDisplayText = cfgfile.FlagDisplayText;
cfgfile.FlagDisplayText = 1;
const bool tmpFlagDisplayText = cfgfile.FlagDisplayText;
cfgfile.FlagDisplayText = true;
_text->drawTextFullscreen(161);
cfgfile.FlagDisplayText = tmpFlagDisplayText;
_text->textClipSmall();

View File

@ -86,6 +86,7 @@ enum MovieType {
CONF_MOVIE_FLAPCX = 3
};
// TODO: persist on shutdown
/** Configuration file structure
Used in the engine to load/use certain parts of code according with
@ -120,7 +121,7 @@ struct ConfigFile {
/** AutoAgressive mode type */
int32 AutoAgressive = 0;
/** SceZoom mode type */
int32 SceZoom = 0;
bool SceZoom = false;
/** Flag to toggle Wall Collision */
int32 WallCollision = 0;
};