diff options
| author | XaviDCR92 <xavi.dcr@gmail.com> | 2017-05-25 07:38:58 +0200 |
|---|---|---|
| committer | XaviDCR92 <xavi.dcr@gmail.com> | 2017-05-25 07:38:58 +0200 |
| commit | 656eec576e46bf80da052710508e93b26ec8bdb5 (patch) | |
| tree | f54106e08d0b2d862c1ffca1c351045eb33a9196 /Source/Pad.c | |
| parent | 8d2e08d7448e6c3514a747c0dff5db5f27eb8788 (diff) | |
| download | airport-656eec576e46bf80da052710508e93b26ec8bdb5.tar.gz | |
* Implemented remaining time for flights.
* Initial STATE_UNBOARDING implementation. Still some work to do.
* Added score logic.
Diffstat (limited to 'Source/Pad.c')
| -rw-r--r-- | Source/Pad.c | 32 |
1 files changed, 30 insertions, 2 deletions
diff --git a/Source/Pad.c b/Source/Pad.c index 1606535..5fd313c 100644 --- a/Source/Pad.c +++ b/Source/Pad.c @@ -80,6 +80,10 @@ static uint8_t pad2_small_vibration_force; // Timers for each key pressed (used for PadXXKeyRepeat() ) static uint8_t pad1_keys_repeat[NUMBER_OF_KEYS]; static uint8_t pad2_keys_repeat[NUMBER_OF_KEYS]; + +static unsigned short pad1_last_key_single_pressed; +static unsigned short pad2_last_key_single_pressed; + // These arrays include last 16 buttons pressed by user and keeps them // for cheating purposes. They are cleaned if no keys are pressed during // PAD_CHEAT_TIMEOUT milliseconds. @@ -179,12 +183,26 @@ bool PadTwoKeyPressed(unsigned short key) bool PadOneKeySinglePress(unsigned short key) { - return (bool)( !(previous_pad1 & key) && (pad1 & key) ); + bool singlePress = (bool)( !(previous_pad1 & key) && (pad1 & key) ); + + if(singlePress == true) + { + pad1_last_key_single_pressed = key; + } + + return singlePress; } bool PadTwoKeySinglePress(unsigned short key) { - return (bool)( !(previous_pad2 & key) && (pad2 & key) ); + bool singlePress = (bool)( !(previous_pad2 & key) && (pad2 & key) ); + + if(singlePress == true) + { + pad2_last_key_single_pressed = key; + } + + return singlePress; } bool PadOneKeyRepeat(unsigned short key, uint8_t time) @@ -496,3 +514,13 @@ unsigned short* PadGetPlayerOneCheatArray(void) { return pad1_cheat_array; } + +unsigned short PadOneGetLastKeySinglePressed(void) +{ + return pad1_last_key_single_pressed; +} + +unsigned short PadTwoGetLastKeySinglePressed(void) +{ + return pad2_last_key_single_pressed; +} |
