[dasher: 2/38] Rewrite logic determining when to display help in Game Mode
- From: Patrick Welche <pwelche src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [dasher: 2/38] Rewrite logic determining when to display help in Game Mode
- Date: Tue, 3 Jan 2012 15:32:49 +0000 (UTC)
commit c5241c53bd672961f911d2e65c5f0dedb403f31e
Author: Alan Lawrence <acl33 inf phy cam ac uk>
Date: Fri Nov 25 19:44:57 2011 +0000
Rewrite logic determining when to display help in Game Mode
Src/DasherCore/GameModule.cpp | 33 ++++++++++++++++++++-------------
1 files changed, 20 insertions(+), 13 deletions(-)
---
diff --git a/Src/DasherCore/GameModule.cpp b/Src/DasherCore/GameModule.cpp
index 1dd6887..b055748 100644
--- a/Src/DasherCore/GameModule.cpp
+++ b/Src/DasherCore/GameModule.cpp
@@ -120,19 +120,26 @@ void CGameModule::DecorateView(unsigned long lTime, CDasherView *pView, CDasherM
const myint iNewTarget((m_y1+m_y2)/2);
m_vTargetY.push_back(iNewTarget);
- bool bDrawHelper=false;
-
- // gcc 4.5.3 abs(myint) returns __gnu_cxx::__enable_if<true, double>::__type
- // rather than myint, so max doesn't receive 2 of the same type.
- myint gcc45_workaround = abs(m_iTargetY-CDasherModel::ORIGIN_Y);
- if (abs(iNewTarget - CDasherModel::ORIGIN_Y) >=
- max(myint(GetLongParameter(LP_GAME_HELP_DIST)),gcc45_workaround)) {
- //needs help - offscreen and not decreasing
- if (m_uHelpStart==std::numeric_limits<unsigned long>::max())
- m_uHelpStart = lTime;
- else
- bDrawHelper = (lTime-m_uHelpStart >= GetLongParameter(LP_GAME_HELP_TIME));
- } else m_uHelpStart = std::numeric_limits<unsigned long>::max();
+ bool bDrawHelper;
+
+ if (abs(iNewTarget - CDasherModel::ORIGIN_Y) >= GetLongParameter(LP_GAME_HELP_DIST)) {
+ //offscreen
+ if (abs(iNewTarget - CDasherModel::ORIGIN_Y) >= abs(m_iTargetY - CDasherModel::ORIGIN_Y)) {
+ //not decreasing
+ if (m_uHelpStart == std::numeric_limits<unsigned long>::max())
+ m_uHelpStart = lTime + GetLongParameter(LP_GAME_HELP_TIME);
+ } else {
+ //they're heading in the right direction
+ if (m_uHelpStart >= lTime) //never displayed help, so assume they don't need it
+ m_uHelpStart = std::numeric_limits<unsigned long>::max();
+ //else, we were displaying help; keep so doing.
+ }
+ bDrawHelper = m_uHelpStart <= lTime;
+ } else {
+ //onscreen
+ m_uHelpStart = std::numeric_limits<unsigned long>::max();
+ bDrawHelper=false;
+ }
m_iTargetY = iNewTarget;
if (bDrawHelper) {
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]