mirror of
https://github.com/vcmi/vcmi.git
synced 2024-12-26 22:57:00 +02:00
Implemnted enemy turn speed selection:
- implemented switch in settings screen - implemented "0 speed", animation-free. *may* also work for player-owned heroes - removed no longer used creature window switch
This commit is contained in:
parent
8838607669
commit
e692f3f520
@ -250,10 +250,6 @@ void CPlayerInterface::heroMoved(const TryMoveHero & details)
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
adventureInt->centerOn(hero); //actualizing screen pos
|
|
||||||
adventureInt->minimap.redraw();
|
|
||||||
adventureInt->heroList.redraw();
|
|
||||||
|
|
||||||
bool directlyAttackingCreature =
|
bool directlyAttackingCreature =
|
||||||
details.attackedFrom
|
details.attackedFrom
|
||||||
&& adventureInt->terrain.currentPath //in case if movement has been canceled in the meantime and path was already erased
|
&& adventureInt->terrain.currentPath //in case if movement has been canceled in the meantime and path was already erased
|
||||||
@ -310,12 +306,30 @@ void CPlayerInterface::heroMoved(const TryMoveHero & details)
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
ui32 speed;
|
||||||
|
if (makingTurn) // our turn, our hero moves
|
||||||
|
speed = settings["adventure"]["heroSpeed"].Float();
|
||||||
|
else
|
||||||
|
speed = settings["adventure"]["enemySpeed"].Float();
|
||||||
|
|
||||||
|
if (speed == 0)
|
||||||
|
{
|
||||||
|
//FIXME: is this a proper solution?
|
||||||
|
CGI->mh->hideObject(hero);
|
||||||
|
CGI->mh->printObject(hero);
|
||||||
|
return; // no animation
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
adventureInt->centerOn(hero); //actualizing screen pos
|
||||||
|
adventureInt->minimap.redraw();
|
||||||
|
adventureInt->heroList.redraw();
|
||||||
|
|
||||||
initMovement(details, hero, hp);
|
initMovement(details, hero, hp);
|
||||||
|
|
||||||
//first initializing done
|
//first initializing done
|
||||||
GH.mainFPSmng->framerateDelay(); // after first move
|
GH.mainFPSmng->framerateDelay(); // after first move
|
||||||
|
|
||||||
ui32 speed = settings["adventure"]["heroSpeed"].Float();
|
|
||||||
//main moving
|
//main moving
|
||||||
for(int i=1; i<32; i+=2*speed)
|
for(int i=1; i<32; i+=2*speed)
|
||||||
{
|
{
|
||||||
|
@ -621,6 +621,8 @@ CSlider::CSlider(Point position, int totalw, std::function<void(int)> Moved, int
|
|||||||
{
|
{
|
||||||
OBJ_CONSTRUCTION_CAPTURING_ALL;
|
OBJ_CONSTRUCTION_CAPTURING_ALL;
|
||||||
setAmount(amount);
|
setAmount(amount);
|
||||||
|
vstd::amax(value, 0);
|
||||||
|
vstd::amin(value, positions);
|
||||||
|
|
||||||
addUsedEvents(LCLICK | KEYBOARD | WHEEL);
|
addUsedEvents(LCLICK | KEYBOARD | WHEEL);
|
||||||
strongInterest = true;
|
strongInterest = true;
|
||||||
|
@ -483,28 +483,16 @@ CLevelWindow::~CLevelWindow()
|
|||||||
LOCPLINT->showingDialog->setn(false);
|
LOCPLINT->showingDialog->setn(false);
|
||||||
}
|
}
|
||||||
|
|
||||||
void CSystemOptionsWindow::setMusicVolume( int newVolume )
|
static void setIntSetting(std::string group, std::string field, int value)
|
||||||
{
|
{
|
||||||
Settings volume = settings.write["general"]["music"];
|
Settings entry = settings.write[group][field];
|
||||||
volume->Float() = newVolume;
|
entry->Float() = value;
|
||||||
}
|
}
|
||||||
|
|
||||||
void CSystemOptionsWindow::setSoundVolume( int newVolume )
|
static void setBoolSetting(std::string group, std::string field, bool value)
|
||||||
{
|
{
|
||||||
Settings volume = settings.write["general"]["sound"];
|
Settings fullscreen = settings.write[group][field];
|
||||||
volume->Float() = newVolume;
|
fullscreen->Bool() = value;
|
||||||
}
|
|
||||||
|
|
||||||
void CSystemOptionsWindow::setHeroMoveSpeed( int newSpeed )
|
|
||||||
{
|
|
||||||
Settings speed = settings.write["adventure"]["heroSpeed"];
|
|
||||||
speed->Float() = newSpeed;
|
|
||||||
}
|
|
||||||
|
|
||||||
void CSystemOptionsWindow::setMapScrollingSpeed( int newSpeed )
|
|
||||||
{
|
|
||||||
Settings speed = settings.write["adventure"]["scrollSpeed"];
|
|
||||||
speed->Float() = newSpeed;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
CSystemOptionsWindow::CSystemOptionsWindow():
|
CSystemOptionsWindow::CSystemOptionsWindow():
|
||||||
@ -560,48 +548,52 @@ CSystemOptionsWindow::CSystemOptionsWindow():
|
|||||||
heroMoveSpeed->addToggle(4, new CToggleButton(Point(124, 77), "sysopb3.def", CGI->generaltexth->zelp[351]));
|
heroMoveSpeed->addToggle(4, new CToggleButton(Point(124, 77), "sysopb3.def", CGI->generaltexth->zelp[351]));
|
||||||
heroMoveSpeed->addToggle(8, new CToggleButton(Point(172, 77), "sysopb4.def", CGI->generaltexth->zelp[352]));
|
heroMoveSpeed->addToggle(8, new CToggleButton(Point(172, 77), "sysopb4.def", CGI->generaltexth->zelp[352]));
|
||||||
heroMoveSpeed->setSelected(settings["adventure"]["heroSpeed"].Float());
|
heroMoveSpeed->setSelected(settings["adventure"]["heroSpeed"].Float());
|
||||||
heroMoveSpeed->addCallback(std::bind(&CSystemOptionsWindow::setHeroMoveSpeed, this, _1));
|
heroMoveSpeed->addCallback(std::bind(&setIntSetting, "adventure", "heroSpeed", _1));
|
||||||
|
|
||||||
|
enemyMoveSpeed = new CToggleGroup(0);
|
||||||
|
enemyMoveSpeed->addToggle(2, new CToggleButton(Point( 28, 144), "sysopb5.def", CGI->generaltexth->zelp[353]));
|
||||||
|
enemyMoveSpeed->addToggle(4, new CToggleButton(Point( 76, 144), "sysopb6.def", CGI->generaltexth->zelp[354]));
|
||||||
|
enemyMoveSpeed->addToggle(8, new CToggleButton(Point(124, 144), "sysopb7.def", CGI->generaltexth->zelp[355]));
|
||||||
|
enemyMoveSpeed->addToggle(0, new CToggleButton(Point(172, 144), "sysopb8.def", CGI->generaltexth->zelp[356]));
|
||||||
|
enemyMoveSpeed->setSelected(settings["adventure"]["enemySpeed"].Float());
|
||||||
|
enemyMoveSpeed->addCallback(std::bind(&setIntSetting, "adventure", "enemySpeed", _1));
|
||||||
|
|
||||||
mapScrollSpeed = new CToggleGroup(0);
|
mapScrollSpeed = new CToggleGroup(0);
|
||||||
mapScrollSpeed->addToggle(1, new CToggleButton(Point( 28, 210), "sysopb9.def", CGI->generaltexth->zelp[357]));
|
mapScrollSpeed->addToggle(1, new CToggleButton(Point( 28, 210), "sysopb9.def", CGI->generaltexth->zelp[357]));
|
||||||
mapScrollSpeed->addToggle(2, new CToggleButton(Point( 92, 210), "sysob10.def", CGI->generaltexth->zelp[358]));
|
mapScrollSpeed->addToggle(2, new CToggleButton(Point( 92, 210), "sysob10.def", CGI->generaltexth->zelp[358]));
|
||||||
mapScrollSpeed->addToggle(4, new CToggleButton(Point(156, 210), "sysob11.def", CGI->generaltexth->zelp[359]));
|
mapScrollSpeed->addToggle(4, new CToggleButton(Point(156, 210), "sysob11.def", CGI->generaltexth->zelp[359]));
|
||||||
mapScrollSpeed->setSelected(settings["adventure"]["scrollSpeed"].Float());
|
mapScrollSpeed->setSelected(settings["adventure"]["scrollSpeed"].Float());
|
||||||
mapScrollSpeed->addCallback(std::bind(&CSystemOptionsWindow::setMapScrollingSpeed, this, _1));
|
mapScrollSpeed->addCallback(std::bind(&setIntSetting, "adventure", "scrollSpeed", _1));
|
||||||
|
|
||||||
musicVolume = new CToggleGroup(0, true);
|
musicVolume = new CToggleGroup(0, true);
|
||||||
for(int i=0; i<10; ++i)
|
for(int i=0; i<10; ++i)
|
||||||
musicVolume->addToggle(i*11, new CToggleButton(Point(29 + 19*i, 359), "syslb.def", CGI->generaltexth->zelp[326+i]));
|
musicVolume->addToggle(i*11, new CToggleButton(Point(29 + 19*i, 359), "syslb.def", CGI->generaltexth->zelp[326+i]));
|
||||||
|
|
||||||
musicVolume->setSelected(CCS->musich->getVolume());
|
musicVolume->setSelected(CCS->musich->getVolume());
|
||||||
musicVolume->addCallback(std::bind(&CSystemOptionsWindow::setMusicVolume, this, _1));
|
musicVolume->addCallback(std::bind(&setIntSetting, "general", "music", _1));
|
||||||
|
|
||||||
effectsVolume = new CToggleGroup(0, true);
|
effectsVolume = new CToggleGroup(0, true);
|
||||||
for(int i=0; i<10; ++i)
|
for(int i=0; i<10; ++i)
|
||||||
effectsVolume->addToggle(i*11, new CToggleButton(Point(29 + 19*i, 425), "syslb.def", CGI->generaltexth->zelp[336+i]));
|
effectsVolume->addToggle(i*11, new CToggleButton(Point(29 + 19*i, 425), "syslb.def", CGI->generaltexth->zelp[336+i]));
|
||||||
|
|
||||||
effectsVolume->setSelected(CCS->soundh->getVolume());
|
effectsVolume->setSelected(CCS->soundh->getVolume());
|
||||||
effectsVolume->addCallback(std::bind(&CSystemOptionsWindow::setSoundVolume, this, _1));
|
effectsVolume->addCallback(std::bind(&setIntSetting, "general", "sound", _1));
|
||||||
|
|
||||||
showReminder = new CToggleButton(Point(246, 87), "sysopchk.def", CGI->generaltexth->zelp[361],
|
showReminder = new CToggleButton(Point(246, 87), "sysopchk.def", CGI->generaltexth->zelp[361],
|
||||||
[&] (bool value) { toggleReminder(value);});
|
[&] (bool value) { setBoolSetting("adventure", "heroReminder", value); });
|
||||||
|
|
||||||
quickCombat = new CToggleButton(Point(246, 87+32), "sysopchk.def", CGI->generaltexth->zelp[362],
|
quickCombat = new CToggleButton(Point(246, 87+32), "sysopchk.def", CGI->generaltexth->zelp[362],
|
||||||
[&] (bool value) { toggleQuickCombat(value);});
|
[&] (bool value) { setBoolSetting("adventure", "quickCombat", value); });
|
||||||
|
|
||||||
spellbookAnim = new CToggleButton(Point(246, 87+64), "sysopchk.def", CGI->generaltexth->zelp[364],
|
spellbookAnim = new CToggleButton(Point(246, 87+64), "sysopchk.def", CGI->generaltexth->zelp[364],
|
||||||
[&] (bool value) { toggleSpellbookAnim(value);});
|
[&] (bool value) { setBoolSetting("video", "spellbookAnimation", value); });
|
||||||
|
|
||||||
newCreatureWin = new CToggleButton(Point(246, 183), "sysopchk.def", CButton::tooltip(texts["creatureWindowButton"]),
|
|
||||||
[&] (bool value) { toggleCreatureWin(value);});
|
|
||||||
|
|
||||||
fullscreen = new CToggleButton(Point(246, 215), "sysopchk.def", CButton::tooltip(texts["fullscreenButton"]),
|
fullscreen = new CToggleButton(Point(246, 215), "sysopchk.def", CButton::tooltip(texts["fullscreenButton"]),
|
||||||
[&] (bool value) { toggleFullscreen(value);});
|
[&] (bool value) { setBoolSetting("video", "fullscreen", value); });
|
||||||
|
|
||||||
showReminder->setSelected(settings["adventure"]["heroReminder"].Bool());
|
showReminder->setSelected(settings["adventure"]["heroReminder"].Bool());
|
||||||
quickCombat->setSelected(settings["adventure"]["quickCombat"].Bool());
|
quickCombat->setSelected(settings["adventure"]["quickCombat"].Bool());
|
||||||
spellbookAnim->setSelected(settings["video"]["spellbookAnimation"].Bool());
|
spellbookAnim->setSelected(settings["video"]["spellbookAnimation"].Bool());
|
||||||
newCreatureWin->setSelected(settings["general"]["classicCreatureWindow"].Bool());
|
|
||||||
fullscreen->setSelected(settings["video"]["fullscreen"].Bool());
|
fullscreen->setSelected(settings["video"]["fullscreen"].Bool());
|
||||||
|
|
||||||
onFullscreenChanged([&](const JsonNode &newState){ fullscreen->setSelected(newState.Bool());});
|
onFullscreenChanged([&](const JsonNode &newState){ fullscreen->setSelected(newState.Bool());});
|
||||||
@ -652,36 +644,6 @@ void CSystemOptionsWindow::setGameRes(int index)
|
|||||||
gameResLabel->setText(resText);
|
gameResLabel->setText(resText);
|
||||||
}
|
}
|
||||||
|
|
||||||
void CSystemOptionsWindow::toggleReminder(bool on)
|
|
||||||
{
|
|
||||||
Settings heroReminder = settings.write["adventure"]["heroReminder"];
|
|
||||||
heroReminder->Bool() = on;
|
|
||||||
}
|
|
||||||
|
|
||||||
void CSystemOptionsWindow::toggleQuickCombat(bool on)
|
|
||||||
{
|
|
||||||
Settings quickCombat = settings.write["adventure"]["quickCombat"];
|
|
||||||
quickCombat->Bool() = on;
|
|
||||||
}
|
|
||||||
|
|
||||||
void CSystemOptionsWindow::toggleSpellbookAnim(bool on)
|
|
||||||
{
|
|
||||||
Settings quickCombat = settings.write["video"]["spellbookAnimation"];
|
|
||||||
quickCombat->Bool() = on;
|
|
||||||
}
|
|
||||||
|
|
||||||
void CSystemOptionsWindow::toggleCreatureWin(bool on)
|
|
||||||
{
|
|
||||||
Settings classicCreatureWindow = settings.write["general"]["classicCreatureWindow"];
|
|
||||||
classicCreatureWindow->Bool() = on;
|
|
||||||
}
|
|
||||||
|
|
||||||
void CSystemOptionsWindow::toggleFullscreen(bool on)
|
|
||||||
{
|
|
||||||
Settings fullscreen = settings.write["video"]["fullscreen"];
|
|
||||||
fullscreen->Bool() = on;
|
|
||||||
}
|
|
||||||
|
|
||||||
void CSystemOptionsWindow::bquitf()
|
void CSystemOptionsWindow::bquitf()
|
||||||
{
|
{
|
||||||
LOCPLINT->showYesNoDialog(CGI->generaltexth->allTexts[578], [this]{ closeAndPushEvent(SDL_QUIT); }, 0);
|
LOCPLINT->showYesNoDialog(CGI->generaltexth->allTexts[578], [this]{ closeAndPushEvent(SDL_QUIT); }, 0);
|
||||||
|
@ -190,6 +190,7 @@ private:
|
|||||||
CLabelGroup *rightGroup;
|
CLabelGroup *rightGroup;
|
||||||
CButton *load, *save, *restart, *mainMenu, *quitGame, *backToMap; //load and restart are not used yet
|
CButton *load, *save, *restart, *mainMenu, *quitGame, *backToMap; //load and restart are not used yet
|
||||||
CToggleGroup * heroMoveSpeed;
|
CToggleGroup * heroMoveSpeed;
|
||||||
|
CToggleGroup * enemyMoveSpeed;
|
||||||
CToggleGroup * mapScrollSpeed;
|
CToggleGroup * mapScrollSpeed;
|
||||||
CToggleGroup * musicVolume, * effectsVolume;
|
CToggleGroup * musicVolume, * effectsVolume;
|
||||||
|
|
||||||
@ -197,7 +198,6 @@ private:
|
|||||||
CToggleButton * showReminder;
|
CToggleButton * showReminder;
|
||||||
CToggleButton * quickCombat;
|
CToggleButton * quickCombat;
|
||||||
CToggleButton * spellbookAnim;
|
CToggleButton * spellbookAnim;
|
||||||
CToggleButton * newCreatureWin;
|
|
||||||
CToggleButton * fullscreen;
|
CToggleButton * fullscreen;
|
||||||
|
|
||||||
CButton *gameResButton;
|
CButton *gameResButton;
|
||||||
@ -205,11 +205,6 @@ private:
|
|||||||
|
|
||||||
SettingsListener onFullscreenChanged;
|
SettingsListener onFullscreenChanged;
|
||||||
|
|
||||||
void setMusicVolume( int newVolume );
|
|
||||||
void setSoundVolume( int newVolume );
|
|
||||||
void setHeroMoveSpeed( int newSpeed );
|
|
||||||
void setMapScrollingSpeed( int newSpeed );
|
|
||||||
|
|
||||||
//functions bound to buttons
|
//functions bound to buttons
|
||||||
void bloadf(); //load game
|
void bloadf(); //load game
|
||||||
void bsavef(); //save game
|
void bsavef(); //save game
|
||||||
@ -218,13 +213,6 @@ private:
|
|||||||
void brestartf(); //restart game
|
void brestartf(); //restart game
|
||||||
void bmainmenuf(); //return to main menu
|
void bmainmenuf(); //return to main menu
|
||||||
|
|
||||||
//functions for checkboxes
|
|
||||||
void toggleReminder(bool on);
|
|
||||||
void toggleQuickCombat(bool on);
|
|
||||||
void toggleSpellbookAnim(bool on);
|
|
||||||
void toggleCreatureWin(bool on);
|
|
||||||
void toggleFullscreen(bool on);
|
|
||||||
|
|
||||||
void selectGameRes();
|
void selectGameRes();
|
||||||
void setGameRes(int index);
|
void setGameRes(int index);
|
||||||
void closeAndPushEvent(int eventType, int code = 0);
|
void closeAndPushEvent(int eventType, int code = 0);
|
||||||
|
@ -19,10 +19,6 @@
|
|||||||
"additionalProperties" : false,
|
"additionalProperties" : false,
|
||||||
"required" : [ "classicCreatureWindow", "playerName", "showfps", "music", "sound", "encoding" ],
|
"required" : [ "classicCreatureWindow", "playerName", "showfps", "music", "sound", "encoding" ],
|
||||||
"properties" : {
|
"properties" : {
|
||||||
"classicCreatureWindow" : {
|
|
||||||
"type" : "boolean",
|
|
||||||
"default" : false
|
|
||||||
},
|
|
||||||
"playerName" : {
|
"playerName" : {
|
||||||
"type":"string",
|
"type":"string",
|
||||||
"default" : "Player"
|
"default" : "Player"
|
||||||
|
@ -29,11 +29,6 @@
|
|||||||
"label" : "Fullscreen",
|
"label" : "Fullscreen",
|
||||||
"help" : "{Fullscreen}\n\n If selected, VCMI will run in fullscreen mode, othervice VCMI will run in window",
|
"help" : "{Fullscreen}\n\n If selected, VCMI will run in fullscreen mode, othervice VCMI will run in window",
|
||||||
},
|
},
|
||||||
"creatureWindowButton" :
|
|
||||||
{
|
|
||||||
"label" : "Classic creature window",
|
|
||||||
"help" : "{Classic creature window}\n\n Enable original Heroes 3 creature window instead of new window from VCMI"
|
|
||||||
},
|
|
||||||
"resolutionButton" :
|
"resolutionButton" :
|
||||||
{
|
{
|
||||||
"label" : "Resolution",
|
"label" : "Resolution",
|
||||||
|
Loading…
Reference in New Issue
Block a user