diff options
| author | XaviDCR92 <xavi.dcr@gmail.com> | 2017-06-11 13:58:33 +0200 |
|---|---|---|
| committer | XaviDCR92 <xavi.dcr@gmail.com> | 2017-06-11 13:58:33 +0200 |
| commit | d1f55e8b45df2dfd84bdde3e2566ef14c9ba40f1 (patch) | |
| tree | 1b6f25f6dfecbbd94b7b9db271dea7cde8ea6221 /Source/GameGui.c | |
| parent | 022c72fe369da0045f9ca7dd4b8d4d7dd169c87c (diff) | |
| download | airport-d1f55e8b45df2dfd84bdde3e2566ef14c9ba40f1.tar.gz | |
* Tried to get some work done in MapEditor with no success so far.
* Timers with no repeat flag were being set to NULL, but this is not actually desired!
* Reenabled transparency for aircraft shadow.
* Deprecated NotificationRequest flags, and replaced by system timer handling.
Diffstat (limited to 'Source/GameGui.c')
| -rw-r--r-- | Source/GameGui.c | 110 |
1 files changed, 63 insertions, 47 deletions
diff --git a/Source/GameGui.c b/Source/GameGui.c index c69747a..b8b1261 100644 --- a/Source/GameGui.c +++ b/Source/GameGui.c @@ -180,6 +180,8 @@ enum static void GameGuiShowAircraftData(TYPE_PLAYER* ptrPlayer, TYPE_FLIGHT_DATA* ptrFlightData);
static void GameGuiClearPassengersLeft(void);
+static void GameGuiBubbleStop(void);
+static void GameGuiBubbleStopVibration(void);
/* **************************************
* Local variables *
@@ -193,6 +195,8 @@ static GsGPoly4 PauseRect; static GsSprite SecondDisplay;
static TYPE_TIMER* ShowAircraftPassengersTimer;
static bool GameGuiClearPassengersLeft_Flag;
+static bool GameGuiBubbleShowFlag;
+static bool GameGuiBubbleVibrationFlag;
static char* GameFileList[] = {"cdrom:\\DATA\\SPRITES\\BUBBLE.TIM;1" ,
"cdrom:\\DATA\\FONTS\\FONT_1.FNT;1" ,
@@ -267,6 +271,8 @@ void GameGuiInit(void) ArrowsSpr.h = AIRCRAFT_DATA_FLIGHT_ARROWS_SIZE;
slowScore = 0;
+
+ GameGuiBubbleShowFlag = false;
}
bool GameGuiPauseDialog(TYPE_PLAYER* ptrPlayer)
@@ -577,64 +583,62 @@ void GameGuiAircraftList(TYPE_PLAYER* ptrPlayer, TYPE_FLIGHT_DATA* ptrFlightData }
-void GameGuiBubble(TYPE_FLIGHT_DATA* ptrFlightData)
+void GameGuiBubbleShow(void)
{
- uint8_t i;
- static uint16_t BubbleVibrationTimer;
- static uint8_t FirstNotification;
- bool AtLeastOneEnabled = false;
-
- if(GameStartupFlag == true)
+ static TYPE_TIMER* GameGuiBubbleTimer = NULL;
+
+ if(GameGuiBubbleTimer == NULL)
{
- // Set initial values to static variables
- BubbleVibrationTimer = 0;
- FirstNotification = 0;
+ dprintf("Started GameGuiBubbleTimer...\n");
+ GameGuiBubbleTimer = SystemCreateTimer(50, false, &GameGuiBubbleStop);
}
-
- for(i = FirstNotification ; i < ptrFlightData->nAircraft ; i++)
+ else
+ {
+ SystemTimerRestart(GameGuiBubbleTimer);
+ }
+
+ GameGuiBubbleShowFlag = true;
+ GameGuiBubbleVibrationFlag = true;
+}
+
+void GameGuiBubble(TYPE_FLIGHT_DATA* ptrFlightData)
+{
+ static bool GameGuiBubbleShowFlagOld;
+
+ if(GameGuiBubbleShowFlag == true)
{
- if(ptrFlightData->NotificationRequest[i] != 0)
+ static TYPE_TIMER* GameGuiBubbleVibrationTimer = NULL;
+
+ if(GameGuiBubbleShowFlagOld == false)
{
- AtLeastOneEnabled = true;
-
- BubbleSpr.x = BUBBLE_SPRITE_X;
- BubbleSpr.y = BUBBLE_SPRITE_Y;
-
- if(BubbleVibrationTimer >= BUBBLE_VIBRATION_TIMER_LIMIT)
+ if(GameGuiBubbleVibrationTimer == NULL)
{
- // Reset timer and notification request for current aircraft
- if(ptrFlightData->NotificationRequest[i] == 0)
- {
- FirstNotification = 0;
- BubbleVibrationTimer = 0;
- }
+ dprintf("Started GameGuiBubbleVibrationTimer...\n");
+ GameGuiBubbleVibrationTimer = SystemCreateTimer(20, false, &GameGuiBubbleStopVibration);
}
else
{
- BubbleSpr.x += SystemRand(BUBBLE_SPRITE_RAND_MIN,BUBBLE_SPRITE_RAND_MAX);
- BubbleSpr.y += SystemRand(BUBBLE_SPRITE_RAND_MIN,BUBBLE_SPRITE_RAND_MAX);
-
- // Keep information about last aircraft notified...
- // so that it gets called on next cycle
- FirstNotification = i;
- BubbleVibrationTimer++;
+ SystemTimerRestart(GameGuiBubbleVibrationTimer);
}
-
- GfxSortSprite(&BubbleSpr);
- FontSetFlags(&SmallFont, FONT_CENTERED);
- FontPrintText(&SmallFont,BubbleSpr.x + 8 , BubbleSpr.y + 2, "%d", ptrFlightData->ActiveAircraft);
-
- GfxDrawButton(NOTIFICATION_BUTTON_X, NOTIFICATION_BUTTON_Y, PAD_CIRCLE);
- break;
}
+
+ BubbleSpr.x = BUBBLE_SPRITE_X;
+ BubbleSpr.y = BUBBLE_SPRITE_Y;
+
+ if(GameGuiBubbleVibrationFlag == true)
+ {
+ BubbleSpr.x += SystemRand(BUBBLE_SPRITE_RAND_MIN,BUBBLE_SPRITE_RAND_MAX);
+ BubbleSpr.y += SystemRand(BUBBLE_SPRITE_RAND_MIN,BUBBLE_SPRITE_RAND_MAX);
+ }
+
+ GfxSortSprite(&BubbleSpr);
+ FontSetFlags(&SmallFont, FONT_CENTERED);
+ FontPrintText(&SmallFont,BubbleSpr.x + 8 , BubbleSpr.y + 2, "%d", ptrFlightData->ActiveAircraft);
+
+ GfxDrawButton(NOTIFICATION_BUTTON_X, NOTIFICATION_BUTTON_Y, PAD_CIRCLE);
}
-
- if(AtLeastOneEnabled == false)
- {
- FirstNotification = 0;
- BubbleVibrationTimer = 0;
- }
- //dprintf("Bubble timer: %d\n",BubbleVibrationTimer);
+
+ GameGuiBubbleShowFlagOld = GameGuiBubbleShowFlag;
}
void GameGuiClock(uint8_t hour, uint8_t min)
@@ -825,7 +829,7 @@ void GameGuiShowAircraftData(TYPE_PLAYER* ptrPlayer, TYPE_FLIGHT_DATA* ptrFlight FontPrintText( &SmallFont,
AircraftDataRemainingTime_X,
AircraftDataRemainingTime_Y + (AIRCRAFT_DATA_FLIGHT_GSGPOLY4_H * j),
- "Time: %d sec.",
+ "%d sec.",
ptrFlightData->RemainingTime[ptrPlayer->ActiveAircraftList[i]] );
}
}
@@ -967,3 +971,15 @@ void GameGuiAircraftCollision(TYPE_PLAYER* ptrPlayer) }while(ptrPlayer->PadKeySinglePress_Callback(PAD_CROSS) == false);
}
+
+void GameGuiBubbleStop(void)
+{
+ dprintf("GameGuiBubbleStop\n");
+ GameGuiBubbleShowFlag = false;
+}
+
+void GameGuiBubbleStopVibration(void)
+{
+ dprintf("GameGuiBubbleStopVibration\n");
+ GameGuiBubbleVibrationFlag = false;
+}
|
