From e9b68609237b3c11978d9e08f8bece7f5b4f6155 Mon Sep 17 00:00:00 2001 From: "wagic.jeck" Date: Fri, 26 Feb 2010 00:46:03 +0000 Subject: [PATCH] Jeck - reverted fix for invalid issue 359. --- projects/mtg/include/GameOptions.h | 1 + projects/mtg/src/ActionStack.cpp | 2 +- projects/mtg/src/GameOptions.cpp | 1 + projects/mtg/src/GameStateOptions.cpp | 1 + projects/mtg/src/GuiCombat.cpp | 5 ++ projects/mtg/src/GuiHand.cpp | 2 +- projects/mtg/src/MTGGamePhase.cpp | 112 +++++++++++++------------- 7 files changed, 66 insertions(+), 58 deletions(-) diff --git a/projects/mtg/include/GameOptions.h b/projects/mtg/include/GameOptions.h index 0e7f58af1..7c40f80b9 100644 --- a/projects/mtg/include/GameOptions.h +++ b/projects/mtg/include/GameOptions.h @@ -39,6 +39,7 @@ public: CLOSEDHAND, HANDDIRECTION, MANADISPLAY, + REVERSETRIGGERS, DISABLECARDS, MAX_GRADE, ECON_DIFFICULTY, diff --git a/projects/mtg/src/ActionStack.cpp b/projects/mtg/src/ActionStack.cpp index 1b40884bf..e5e5ef6c6 100644 --- a/projects/mtg/src/ActionStack.cpp +++ b/projects/mtg/src/ActionStack.cpp @@ -621,7 +621,7 @@ void ActionStack::endOfInterruption(){ bool ActionStack::CheckUserInput(JButton key){ - JButton trigger = JGE_BTN_PREV; + JButton trigger = (options[Options::REVERSETRIGGERS].number ? JGE_BTN_NEXT : JGE_BTN_PREV); if (mode == ACTIONSTACK_STANDARD){ if (askIfWishesToInterrupt){ if (JGE_BTN_SEC == key){ diff --git a/projects/mtg/src/GameOptions.cpp b/projects/mtg/src/GameOptions.cpp index 55bff1320..01346fd54 100644 --- a/projects/mtg/src/GameOptions.cpp +++ b/projects/mtg/src/GameOptions.cpp @@ -26,6 +26,7 @@ const string Options::optionNames[] = { "closed_hand", "hand_direction", "mana_display", + "reverse_triggers", "disable_cards", "maxGrade", "economic_difficulty", diff --git a/projects/mtg/src/GameStateOptions.cpp b/projects/mtg/src/GameStateOptions.cpp index 67c1f2d58..fb66caebf 100644 --- a/projects/mtg/src/GameStateOptions.cpp +++ b/projects/mtg/src/GameStateOptions.cpp @@ -42,6 +42,7 @@ void GameStateOptions::Start() optionsList->Add(NEW WDecoEnum(NEW OptionInteger(Options::CLOSEDHAND,"Closed hand",1,1,0))); optionsList->Add(NEW WDecoEnum(NEW OptionInteger(Options::HANDDIRECTION,"Hand direction",1,1,0))); optionsList->Add(NEW WDecoEnum(NEW OptionInteger(Options::MANADISPLAY,"Mana display",2,1,0))); + optionsList->Add(NEW OptionInteger(Options::REVERSETRIGGERS, "Reverse left and right triggers")); optionsList->Add(NEW OptionInteger(Options::DISABLECARDS,"Disable card images")); optionsList->Add(NEW OptionInteger(Options::TRANSITIONS,"Disable screen transitions")); optionsTabs->Add(optionsList); diff --git a/projects/mtg/src/GuiCombat.cpp b/projects/mtg/src/GuiCombat.cpp index ee0aa7106..a0653ffe4 100644 --- a/projects/mtg/src/GuiCombat.cpp +++ b/projects/mtg/src/GuiCombat.cpp @@ -243,7 +243,12 @@ bool GuiCombat::CheckUserInput(JButton key) case JGE_BTN_PRI: active = activeAtk = NULL; cursor_pos = OK; break; + case JGE_BTN_NEXT: + if (!options[Options::REVERSETRIGGERS].number) return false; + active = activeAtk = NULL; cursor_pos = OK; + break; case JGE_BTN_PREV: + if (options[Options::REVERSETRIGGERS].number) return false; active = activeAtk = NULL; cursor_pos = OK; break; default: diff --git a/projects/mtg/src/GuiHand.cpp b/projects/mtg/src/GuiHand.cpp index ee7bc14b3..14d8d4511 100644 --- a/projects/mtg/src/GuiHand.cpp +++ b/projects/mtg/src/GuiHand.cpp @@ -139,7 +139,7 @@ void GuiHandSelf::Repos() bool GuiHandSelf::CheckUserInput(JButton key) { - JButton trigger = JGE_BTN_NEXT; + JButton trigger = (options[Options::REVERSETRIGGERS].number ? JGE_BTN_PREV : JGE_BTN_NEXT); if (trigger == key) { state = (Open == state ? Closed : Open); diff --git a/projects/mtg/src/MTGGamePhase.cpp b/projects/mtg/src/MTGGamePhase.cpp index 4c256d2bb..4148543fb 100644 --- a/projects/mtg/src/MTGGamePhase.cpp +++ b/projects/mtg/src/MTGGamePhase.cpp @@ -1,56 +1,56 @@ -#include "../include/config.h" -#include "../include/MTGGamePhase.h" - - -MTGGamePhase::MTGGamePhase(int id):ActionElement(id){ - animation = 0; - currentState = -1; - mFont= resources.GetJLBFont("simon"); - mFont->SetBase(0); // using 2nd font -} - - -void MTGGamePhase::Update(float dt){ - - int newState = GameObserver::GetInstance()->getCurrentGamePhase(); - if (newState != currentState){ - activeState = ACTIVE; - animation = 4; - currentState = newState; - } - - - if (animation > 0){ - animation -- ; - }else{ - activeState = INACTIVE; - animation = 0; - - } - -} - -bool MTGGamePhase::CheckUserInput(JButton key){ - GameObserver * game = GameObserver::GetInstance(); - if (activeState == INACTIVE){ - JButton trigger = JGE_BTN_PREV; - if ((trigger == key) && game->currentActionPlayer == game->currentlyActing()) - { - activeState = ACTIVE; - game->userRequestNextGamePhase(); - return true; - } - } - return false; -} - - MTGGamePhase * MTGGamePhase::clone() const{ - MTGGamePhase * a = NEW MTGGamePhase(*this); - a->isClone = 1; - return a; - } - -ostream& MTGGamePhase::toString(ostream& out) const -{ - return out << "MTGGamePhase ::: animation " << animation << " ; currentState : " << currentState; -} +#include "../include/config.h" +#include "../include/MTGGamePhase.h" + + +MTGGamePhase::MTGGamePhase(int id):ActionElement(id){ + animation = 0; + currentState = -1; + mFont= resources.GetJLBFont("simon"); + mFont->SetBase(0); // using 2nd font +} + + +void MTGGamePhase::Update(float dt){ + + int newState = GameObserver::GetInstance()->getCurrentGamePhase(); + if (newState != currentState){ + activeState = ACTIVE; + animation = 4; + currentState = newState; + } + + + if (animation > 0){ + animation -- ; + }else{ + activeState = INACTIVE; + animation = 0; + + } + +} + +bool MTGGamePhase::CheckUserInput(JButton key){ + GameObserver * game = GameObserver::GetInstance(); + if (activeState == INACTIVE){ + JButton trigger = (options[Options::REVERSETRIGGERS].number ? JGE_BTN_NEXT : JGE_BTN_PREV); + if ((trigger == key) && game->currentActionPlayer == game->currentlyActing()) + { + activeState = ACTIVE; + game->userRequestNextGamePhase(); + return true; + } + } + return false; +} + + MTGGamePhase * MTGGamePhase::clone() const{ + MTGGamePhase * a = NEW MTGGamePhase(*this); + a->isClone = 1; + return a; + } + +ostream& MTGGamePhase::toString(ostream& out) const +{ + return out << "MTGGamePhase ::: animation " << animation << " ; currentState : " << currentState; +}