| 1958 | } |
| 1959 | |
| 1960 | void ContextAction::processTick() |
| 1961 | { |
| 1962 | if (mActive) |
| 1963 | { |
| 1964 | F32 currTime = Sim::getCurrentTime(); |
| 1965 | static const char *argv[3]; |
| 1966 | |
| 1967 | //see if this key even is still active |
| 1968 | if (!mBreakEvent) |
| 1969 | { |
| 1970 | //are we only checking if it's holding? |
| 1971 | if (mHoldOnly) |
| 1972 | { |
| 1973 | //yes, we are, and since it's held, we fire off our function |
| 1974 | if (mReturnHoldTime) |
| 1975 | { |
| 1976 | argv[0] = mConsoleFunctionHeld; |
| 1977 | argv[1] = Con::getFloatArg(mEventValue); |
| 1978 | argv[2] = Con::getFloatArg((currTime - mStartTime)); |
| 1979 | Con::execute(3, argv); |
| 1980 | } |
| 1981 | else |
| 1982 | { |
| 1983 | argv[0] = mConsoleFunctionHeld; |
| 1984 | argv[1] = Con::getFloatArg(mEventValue); |
| 1985 | Con::execute(2, argv); |
| 1986 | } |
| 1987 | } |
| 1988 | //if we don't care if we're just holding, check our time |
| 1989 | //have we passed our min limit? |
| 1990 | else if ((currTime - mStartTime) >= mMinHoldTime) |
| 1991 | { |
| 1992 | //holy crap, we have, fire off our hold function |
| 1993 | mDidHold = true; |
| 1994 | argv[0] = mConsoleFunctionHeld; |
| 1995 | argv[1] = Con::getFloatArg(mEventValue); |
| 1996 | Con::execute(2, argv); |
| 1997 | } |
| 1998 | //otherwise we haven't yet, so keep our active status |
| 1999 | return; |
| 2000 | } |
| 2001 | //hmm, apparently not, so see if we tapped the key instead |
| 2002 | else |
| 2003 | { |
| 2004 | if (!mHoldOnly && !mDidHold) |
| 2005 | { |
| 2006 | //yes, we tapped and we care, so fire off the tap function. |
| 2007 | argv[0] = mButton->consoleFunction; |
| 2008 | argv[1] = Con::getFloatArg(mEventValue); |
| 2009 | Con::execute(2, argv); |
| 2010 | } |
| 2011 | //otherwise we don't care and we're done, so reset everything |
| 2012 | mActive = false; |
| 2013 | mStartTime = 0; |
| 2014 | mBreakEvent = false; |
| 2015 | mDidHold = false; |
| 2016 | } |
| 2017 | } |
nothing calls this directly
no test coverage detected