fixed state transitions from highscore->main menu
parent
3950195593
commit
545c370816
|
@ -21,6 +21,7 @@ END_ENUM(GameEntityType)
|
|||
|
||||
BEGIN_ENUM(ViewState)
|
||||
{
|
||||
DECL_ENUM_ELEMENT(ViewStateUnknown),
|
||||
DECL_ENUM_ELEMENT(ViewStateMainMenu),
|
||||
DECL_ENUM_ELEMENT(ViewStateGameRunning),
|
||||
DECL_ENUM_ELEMENT(ViewStatePaused),
|
||||
|
|
|
@ -818,7 +818,7 @@ void Model::OnLevelComplete() {
|
|||
mLevelTimeBonusPoints = 0;
|
||||
}
|
||||
|
||||
int extra_lives = floor ((mPoints + mLevelPoints) / 200000.f) - floor (mPoints / 200000.f);
|
||||
int extra_lives = floor ((mPoints + mLevelPoints) / 400000.f) - floor (mPoints / 400000.f);
|
||||
if (extra_lives > 0) {
|
||||
mPlayerLives += extra_lives;
|
||||
}
|
||||
|
|
|
@ -514,13 +514,6 @@ void View::DrawUiMainMenu() {
|
|||
PushViewState(ViewStateCredits);
|
||||
}
|
||||
|
||||
/*
|
||||
if (Engine::GUI::Button (6, "E", screen_right - 48, 20, 32, button_height)) {
|
||||
PushViewState(ViewStateEditor);
|
||||
GetController()->ResetLevel();
|
||||
}
|
||||
*/
|
||||
|
||||
if (Engine::GUI::Button (5, "Quit", screen_right * 0.5 - 100, 430, button_width, button_height)) {
|
||||
Engine::RunCommand("quit");
|
||||
}
|
||||
|
@ -643,7 +636,7 @@ void View::DrawUiGameOver() {
|
|||
if (mFadeTimerSecValue > 0.)
|
||||
return;
|
||||
|
||||
if (Engine::GUI::Button (2, "Continue...",
|
||||
if (Engine::GUI::Button (2, "Highscores",
|
||||
(screen_right - button_width) * 0.5,
|
||||
screen_bottom * 0.5 + 100, button_width, button_height)) {
|
||||
// We do not want the background to show the remaining bits of the game
|
||||
|
@ -1055,9 +1048,13 @@ void View::DrawUiHighscore() {
|
|||
|
||||
if (Engine::GUI::Button (1, "Back to Menu", screen_right * 0.5 - 250 * 0.5, y + 16, button_width, button_height)
|
||||
|| Engine::GUI::CheckKeyPressed(SDLK_ESCAPE) ) {
|
||||
// Remove the ViewStateGameRunning
|
||||
|
||||
while (GetViewState() != ViewStateMainMenu) {
|
||||
PopViewState();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void View::DrawUiOptions() {
|
||||
DrawPageTitle ("Options");
|
||||
|
@ -1119,9 +1116,9 @@ _Top Level Designer\r\
|
|||
_Additional Level Design\r\
|
||||
Martin Felis\r\
|
||||
michi\r\
|
||||
Khai-Long Ho Hoang\r\
|
||||
Andi\r\
|
||||
Sebastian Felis\r\
|
||||
Khai-Long Ho Hoang\r\
|
||||
\r\
|
||||
_Music\r\
|
||||
DJad - Space Exploration\r\
|
||||
|
|
|
@ -46,7 +46,9 @@ class View : public Engine::ViewBase {
|
|||
return mViewStateStack.top();
|
||||
}
|
||||
/** \brief Removes the top element of the current ViewState stack */
|
||||
void PopViewState () {
|
||||
ViewState PopViewState () {
|
||||
ViewState top = mViewStateStack.top();
|
||||
|
||||
// Warning: you must not query for an invalid enum with
|
||||
// GetStringENUM_NAME!
|
||||
std::string popped_name = GetStringViewState(mViewStateStack.top());
|
||||
|
@ -68,6 +70,8 @@ class View : public Engine::ViewBase {
|
|||
Engine::EventBasePtr changeviewstate_event (new Engine::EventBase());
|
||||
changeviewstate_event->mEventType = EventChangeViewState;
|
||||
QueueEvent (changeviewstate_event);
|
||||
|
||||
return top;
|
||||
}
|
||||
|
||||
protected:
|
||||
|
|
|
@ -179,6 +179,8 @@ int main (int argc, char* argv[]) {
|
|||
config_file << "set effects_volume " << Engine::GetEffectsVolume() << std::endl;
|
||||
config_file << "set music_volume " << Engine::GetMusicVolume() << std::endl;
|
||||
config_file << "set use_server_highscore " << Engine::GetVariableString("use_server_highscore") << std::endl;
|
||||
if (Engine::GetVariableBool("cheat_mode"))
|
||||
config_file << "set cheat_mode " << true << std::endl;
|
||||
config_file.close();
|
||||
|
||||
SDL_WM_SetIcon(NULL,NULL);
|
||||
|
|
|
@ -179,6 +179,24 @@ float &GetVariableFloat (const std::string &name, float def) {
|
|||
return var->GetFloatValue ();
|
||||
}
|
||||
|
||||
/** \brief Returns the boolean value of the Variable with the given name */
|
||||
bool& GetVariableBool (const std::string &name, bool def) {
|
||||
/* We use a static result variable for the case that def was not passed to
|
||||
* is function */
|
||||
static bool def_result = def;
|
||||
|
||||
if (! VariablesInstance ) {
|
||||
LogError ("Unable to register Variable '%s': Variables System not initialized!", name.c_str());
|
||||
return def_result;
|
||||
}
|
||||
|
||||
Variable *var = VariablesInstance->GetVariable (name);
|
||||
if (!var) {
|
||||
return def_result;
|
||||
}
|
||||
|
||||
return var->GetBoolValue ();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue